From f6eefedcd537754978cc351ec8a78a7f67dd7979 Mon Sep 17 00:00:00 2001 From: Yehonal Date: Sun, 26 Jun 2016 19:23:57 +0200 Subject: [PATCH] converted all tabs to 4 spaces --- src/server/authserver/Server/AuthSocket.cpp | 48 +- .../collision/Management/MMapFactory.cpp | 16 +- .../collision/Management/MMapManager.cpp | 16 +- src/server/collision/Management/MMapManager.h | 6 +- .../collision/Management/VMapManager2.cpp | 6 +- .../collision/Models/GameObjectModel.cpp | 4 +- src/server/collision/RegularGrid.h | 92 +- src/server/game/AI/CoreAI/CombatAI.cpp | 4 +- src/server/game/AI/CoreAI/GameObjectAI.h | 2 +- src/server/game/AI/CoreAI/GuardAI.cpp | 4 +- src/server/game/AI/CoreAI/GuardAI.h | 2 +- src/server/game/AI/CoreAI/PassiveAI.cpp | 18 +- src/server/game/AI/CoreAI/PassiveAI.h | 8 +- src/server/game/AI/CoreAI/PetAI.cpp | 190 +- src/server/game/AI/CoreAI/PetAI.h | 6 +- src/server/game/AI/CoreAI/TotemAI.h | 18 +- src/server/game/AI/CoreAI/UnitAI.cpp | 12 +- src/server/game/AI/CoreAI/UnitAI.h | 12 +- src/server/game/AI/CreatureAI.cpp | 22 +- src/server/game/AI/CreatureAI.h | 4 +- src/server/game/AI/CreatureAISelector.cpp | 8 +- .../game/AI/ScriptedAI/ScriptedCreature.cpp | 60 +- .../game/AI/ScriptedAI/ScriptedCreature.h | 20 +- .../game/AI/ScriptedAI/ScriptedEscortAI.cpp | 22 +- .../game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 8 +- src/server/game/AI/SmartScripts/SmartAI.cpp | 322 +- src/server/game/AI/SmartScripts/SmartAI.h | 20 +- .../game/AI/SmartScripts/SmartScript.cpp | 1058 +-- src/server/game/AI/SmartScripts/SmartScript.h | 82 +- .../game/AI/SmartScripts/SmartScriptMgr.cpp | 88 +- .../game/AI/SmartScripts/SmartScriptMgr.h | 278 +- src/server/game/Accounts/AccountMgr.cpp | 392 +- src/server/game/Accounts/AccountMgr.h | 8 +- .../game/Achievements/AchievementMgr.cpp | 500 +- src/server/game/Achievements/AchievementMgr.h | 8 +- .../game/ArenaSpectator/ArenaSpectator.h | 330 +- .../game/AuctionHouse/AuctionHouseMgr.cpp | 148 +- src/server/game/Battlefield/Battlefield.cpp | 88 +- src/server/game/Battlefield/Battlefield.h | 6 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 374 +- .../game/Battlefield/Zones/BattlefieldWG.h | 232 +- src/server/game/Battlegrounds/ArenaTeam.cpp | 62 +- src/server/game/Battlegrounds/ArenaTeam.h | 2 +- .../game/Battlegrounds/ArenaTeamMgr.cpp | 2 +- src/server/game/Battlegrounds/ArenaTeamMgr.h | 6 +- .../game/Battlegrounds/Battleground.cpp | 468 +- src/server/game/Battlegrounds/Battleground.h | 74 +- .../game/Battlegrounds/BattlegroundMgr.cpp | 192 +- .../game/Battlegrounds/BattlegroundMgr.h | 28 +- .../game/Battlegrounds/BattlegroundQueue.cpp | 760 +- .../game/Battlegrounds/BattlegroundQueue.h | 34 +- .../Battlegrounds/Zones/BattlegroundAB.cpp | 338 +- .../game/Battlegrounds/Zones/BattlegroundAB.h | 90 +- .../Battlegrounds/Zones/BattlegroundAV.cpp | 54 +- .../game/Battlegrounds/Zones/BattlegroundAV.h | 60 +- .../Battlegrounds/Zones/BattlegroundBE.cpp | 42 +- .../game/Battlegrounds/Zones/BattlegroundBE.h | 4 +- .../Battlegrounds/Zones/BattlegroundDS.cpp | 36 +- .../game/Battlegrounds/Zones/BattlegroundDS.h | 4 +- .../Battlegrounds/Zones/BattlegroundEY.cpp | 300 +- .../game/Battlegrounds/Zones/BattlegroundEY.h | 78 +- .../Battlegrounds/Zones/BattlegroundIC.cpp | 312 +- .../game/Battlegrounds/Zones/BattlegroundIC.h | 42 +- .../Battlegrounds/Zones/BattlegroundNA.cpp | 12 +- .../game/Battlegrounds/Zones/BattlegroundNA.h | 4 +- .../Battlegrounds/Zones/BattlegroundRL.cpp | 66 +- .../game/Battlegrounds/Zones/BattlegroundRL.h | 4 +- .../Battlegrounds/Zones/BattlegroundRV.cpp | 96 +- .../game/Battlegrounds/Zones/BattlegroundRV.h | 6 +- .../Battlegrounds/Zones/BattlegroundSA.cpp | 242 +- .../game/Battlegrounds/Zones/BattlegroundSA.h | 14 +- .../Battlegrounds/Zones/BattlegroundWS.cpp | 262 +- .../game/Battlegrounds/Zones/BattlegroundWS.h | 36 +- src/server/game/Calendar/CalendarMgr.cpp | 2 +- src/server/game/Chat/Channels/Channel.cpp | 476 +- src/server/game/Chat/Channels/Channel.h | 50 +- src/server/game/Chat/Channels/ChannelMgr.cpp | 132 +- src/server/game/Chat/Channels/ChannelMgr.h | 4 +- src/server/game/Chat/Chat.cpp | 16 +- src/server/game/Chat/Chat.h | 2 +- src/server/game/Combat/HostileRefManager.cpp | 4 +- src/server/game/Combat/ThreatManager.cpp | 172 +- src/server/game/Conditions/ConditionMgr.cpp | 54 +- src/server/game/Conditions/ConditionMgr.h | 20 +- src/server/game/Conditions/DisableMgr.cpp | 12 +- src/server/game/Conditions/DisableMgr.h | 2 +- src/server/game/DataStores/DBCStores.cpp | 28 +- src/server/game/DataStores/DBCStructure.h | 24 +- src/server/game/DungeonFinding/LFG.h | 174 +- src/server/game/DungeonFinding/LFGMgr.cpp | 1344 ++-- src/server/game/DungeonFinding/LFGMgr.h | 218 +- .../game/DungeonFinding/LFGPlayerData.cpp | 12 +- .../game/DungeonFinding/LFGPlayerData.h | 12 +- src/server/game/DungeonFinding/LFGQueue.cpp | 380 +- src/server/game/DungeonFinding/LFGQueue.h | 6 +- src/server/game/DungeonFinding/LFGScripts.cpp | 74 +- .../game/Entities/Creature/Creature.cpp | 538 +- src/server/game/Entities/Creature/Creature.h | 50 +- .../game/Entities/Creature/CreatureGroups.cpp | 40 +- .../game/Entities/Creature/GossipDef.cpp | 52 +- src/server/game/Entities/Creature/GossipDef.h | 22 +- .../Entities/Creature/TemporarySummon.cpp | 88 +- .../game/Entities/Creature/TemporarySummon.h | 10 +- .../Entities/DynamicObject/DynamicObject.cpp | 4 +- .../Entities/DynamicObject/DynamicObject.h | 2 +- .../game/Entities/GameObject/GameObject.cpp | 412 +- .../game/Entities/GameObject/GameObject.h | 28 +- src/server/game/Entities/Item/Item.cpp | 10 +- src/server/game/Entities/Item/ItemPrototype.h | 2 +- src/server/game/Entities/Object/Object.cpp | 484 +- src/server/game/Entities/Object/Object.h | 40 +- .../game/Entities/Object/ObjectDefines.h | 2 +- src/server/game/Entities/Pet/Pet.cpp | 874 +-- src/server/game/Entities/Pet/Pet.h | 42 +- src/server/game/Entities/Pet/PetDefines.h | 176 +- src/server/game/Entities/Player/Player.cpp | 4336 ++++++------ src/server/game/Entities/Player/Player.h | 302 +- src/server/game/Entities/Player/SocialMgr.cpp | 10 +- src/server/game/Entities/Totem/Totem.cpp | 60 +- .../game/Entities/Transport/Transport.cpp | 452 +- .../game/Entities/Transport/Transport.h | 32 +- src/server/game/Entities/Unit/StatSystem.cpp | 154 +- src/server/game/Entities/Unit/Unit.cpp | 5250 +++++++------- src/server/game/Entities/Unit/Unit.h | 282 +- src/server/game/Entities/Vehicle/Vehicle.cpp | 210 +- src/server/game/Entities/Vehicle/Vehicle.h | 4 +- .../game/Entities/Vehicle/VehicleDefines.h | 8 +- src/server/game/Events/GameEventMgr.cpp | 12 +- src/server/game/Globals/ObjectAccessor.cpp | 126 +- src/server/game/Globals/ObjectAccessor.h | 12 +- src/server/game/Globals/ObjectMgr.cpp | 286 +- src/server/game/Globals/ObjectMgr.h | 32 +- .../game/Grids/Notifiers/GridNotifiers.cpp | 42 +- .../game/Grids/Notifiers/GridNotifiers.h | 138 +- src/server/game/Grids/ObjectGridLoader.cpp | 4 +- src/server/game/Groups/Group.cpp | 416 +- src/server/game/Groups/Group.h | 48 +- src/server/game/Groups/GroupMgr.cpp | 92 +- src/server/game/Groups/GroupMgr.h | 6 +- src/server/game/Guilds/Guild.cpp | 24 +- src/server/game/Guilds/Guild.h | 6 +- src/server/game/Guilds/GuildMgr.cpp | 2 +- src/server/game/Handlers/ArenaTeamHandler.cpp | 26 +- .../game/Handlers/AuctionHouseHandler.cpp | 58 +- .../game/Handlers/BattleGroundHandler.cpp | 484 +- src/server/game/Handlers/CalendarHandler.cpp | 52 +- src/server/game/Handlers/ChannelHandler.cpp | 10 +- src/server/game/Handlers/CharacterHandler.cpp | 762 +- src/server/game/Handlers/ChatHandler.cpp | 198 +- src/server/game/Handlers/GroupHandler.cpp | 36 +- src/server/game/Handlers/GuildHandler.cpp | 2 +- src/server/game/Handlers/ItemHandler.cpp | 260 +- src/server/game/Handlers/LFGHandler.cpp | 40 +- src/server/game/Handlers/LootHandler.cpp | 36 +- src/server/game/Handlers/MailHandler.cpp | 76 +- src/server/game/Handlers/MiscHandler.cpp | 622 +- src/server/game/Handlers/MovementHandler.cpp | 282 +- src/server/game/Handlers/NPCHandler.cpp | 18 +- src/server/game/Handlers/PetHandler.cpp | 560 +- src/server/game/Handlers/PetitionsHandler.cpp | 186 +- src/server/game/Handlers/QueryHandler.cpp | 6 +- src/server/game/Handlers/QuestHandler.cpp | 54 +- src/server/game/Handlers/SpellHandler.cpp | 74 +- src/server/game/Handlers/TaxiHandler.cpp | 2 +- src/server/game/Handlers/TradeHandler.cpp | 30 +- src/server/game/Handlers/VehicleHandler.cpp | 32 +- src/server/game/Instances/InstanceSaveMgr.cpp | 498 +- src/server/game/Instances/InstanceSaveMgr.h | 54 +- src/server/game/Instances/InstanceScript.cpp | 40 +- src/server/game/Instances/InstanceScript.h | 6 +- src/server/game/Loot/LootItemStorage.cpp | 214 +- src/server/game/Loot/LootItemStorage.h | 40 +- src/server/game/Loot/LootMgr.cpp | 34 +- src/server/game/Loot/LootMgr.h | 4 +- src/server/game/Mails/Mail.cpp | 10 +- src/server/game/Maps/Map.cpp | 492 +- src/server/game/Maps/Map.h | 36 +- src/server/game/Maps/MapInstanced.cpp | 46 +- src/server/game/Maps/MapManager.cpp | 88 +- src/server/game/Maps/MapUpdater.cpp | 10 +- src/server/game/Maps/MapUpdater.h | 4 +- src/server/game/Maps/TransportMgr.cpp | 84 +- src/server/game/Misc/AsyncAuctionListing.cpp | 58 +- src/server/game/Misc/AsyncAuctionListing.h | 80 +- src/server/game/Misc/AvgDiffTracker.h | 96 +- src/server/game/Misc/DynamicVisibility.cpp | 8 +- src/server/game/Misc/DynamicVisibility.h | 30 +- src/server/game/Misc/SavingSystem.cpp | 92 +- src/server/game/Misc/SavingSystem.h | 22 +- src/server/game/Misc/WhoListCache.cpp | 56 +- src/server/game/Misc/WhoListCache.h | 34 +- src/server/game/Miscellaneous/SharedDefines.h | 6 +- src/server/game/Movement/MotionMaster.cpp | 46 +- src/server/game/Movement/MotionMaster.h | 4 +- src/server/game/Movement/MovementGenerator.h | 2 +- .../ConfusedMovementGenerator.cpp | 12 +- .../EscortMovementGenerator.cpp | 6 +- .../EscortMovementGenerator.h | 4 +- .../HomeMovementGenerator.cpp | 28 +- .../IdleMovementGenerator.cpp | 2 +- .../MovementGenerators/PathGenerator.cpp | 1582 ++--- .../PointMovementGenerator.cpp | 38 +- .../PointMovementGenerator.h | 2 +- .../RandomMovementGenerator.cpp | 436 +- .../RandomMovementGenerator.h | 48 +- .../TargetedMovementGenerator.cpp | 194 +- .../WaypointMovementGenerator.cpp | 180 +- .../WaypointMovementGenerator.h | 4 +- src/server/game/Movement/Spline/MoveSpline.h | 6 +- .../game/Movement/Spline/MoveSplineInit.cpp | 20 +- .../game/Movement/Spline/MoveSplineInit.h | 30 +- .../game/Movement/Spline/MoveSplineInitArgs.h | 2 +- .../Movement/Spline/MovementPacketBuilder.cpp | 28 +- src/server/game/Movement/Spline/Spline.cpp | 2 +- .../Movement/Waypoints/WaypointManager.cpp | 4 +- src/server/game/OutdoorPvP/OutdoorPvP.cpp | 4 +- src/server/game/OutdoorPvP/OutdoorPvP.h | 2 +- src/server/game/OutdoorPvP/OutdoorPvPMgr.h | 4 +- src/server/game/Petitions/PetitionMgr.cpp | 130 +- src/server/game/Petitions/PetitionMgr.h | 58 +- src/server/game/Pools/PoolMgr.cpp | 36 +- src/server/game/Quests/QuestDef.cpp | 170 +- src/server/game/Reputation/ReputationMgr.cpp | 14 +- src/server/game/Scripting/MapScripts.cpp | 10 +- src/server/game/Scripting/ScriptLoader.cpp | 152 +- src/server/game/Scripting/ScriptMgr.h | 2 +- src/server/game/Server/Protocol/Opcodes.cpp | 2 +- src/server/game/Server/WorldSession.cpp | 492 +- src/server/game/Server/WorldSession.h | 86 +- src/server/game/Server/WorldSocket.cpp | 2 +- src/server/game/Skills/SkillDiscovery.cpp | 10 +- .../game/Spells/Auras/SpellAuraEffects.cpp | 1200 ++-- .../game/Spells/Auras/SpellAuraEffects.h | 48 +- src/server/game/Spells/Auras/SpellAuras.cpp | 562 +- src/server/game/Spells/Auras/SpellAuras.h | 16 +- src/server/game/Spells/Spell.cpp | 1796 ++--- src/server/game/Spells/Spell.h | 72 +- src/server/game/Spells/SpellEffects.cpp | 1052 +-- src/server/game/Spells/SpellInfo.cpp | 498 +- src/server/game/Spells/SpellInfo.h | 56 +- src/server/game/Spells/SpellMgr.cpp | 5348 +++++++------- src/server/game/Spells/SpellMgr.h | 80 +- src/server/game/Spells/SpellScript.cpp | 4 +- src/server/game/Spells/SpellScript.h | 4 +- src/server/game/Texts/CreatureTextMgr.h | 6 +- src/server/game/Tools/PlayerDump.cpp | 2 +- src/server/game/Warden/Warden.cpp | 66 +- src/server/game/Warden/WardenCheckMgr.cpp | 14 +- src/server/game/Warden/WardenWin.cpp | 26 +- src/server/game/World/World.cpp | 556 +- src/server/game/World/World.h | 106 +- src/server/scripts/Commands/cs_account.cpp | 1130 +-- src/server/scripts/Commands/cs_ban.cpp | 2 +- src/server/scripts/Commands/cs_cast.cpp | 2 +- src/server/scripts/Commands/cs_character.cpp | 64 +- src/server/scripts/Commands/cs_debug.cpp | 14 +- src/server/scripts/Commands/cs_gm.cpp | 14 +- src/server/scripts/Commands/cs_gobject.cpp | 60 +- src/server/scripts/Commands/cs_honor.cpp | 2 +- src/server/scripts/Commands/cs_instance.cpp | 26 +- src/server/scripts/Commands/cs_learn.cpp | 8 +- src/server/scripts/Commands/cs_lfg.cpp | 4 +- src/server/scripts/Commands/cs_list.cpp | 4 +- src/server/scripts/Commands/cs_lookup.cpp | 28 +- src/server/scripts/Commands/cs_misc.cpp | 518 +- src/server/scripts/Commands/cs_modify.cpp | 26 +- src/server/scripts/Commands/cs_npc.cpp | 38 +- src/server/scripts/Commands/cs_server.cpp | 24 +- src/server/scripts/Commands/cs_spectator.cpp | 342 +- src/server/scripts/Commands/cs_tele.cpp | 2 +- .../BlackrockDepths/blackrock_depths.cpp | 206 +- .../BlackrockDepths/blackrock_depths.h | 2 +- .../instance_blackrock_depths.cpp | 24 +- .../BlackrockSpire/blackrock_spire.h | 4 +- .../BlackrockSpire/boss_urok_doomhowl.cpp | 12 +- .../instance_blackrock_spire.cpp | 14 +- .../BlackwingLair/boss_nefarian.cpp | 52 +- .../BlackwingLair/instance_blackwing_lair.cpp | 6 +- .../MoltenCore/boss_majordomo_executus.cpp | 2 +- .../MoltenCore/boss_ragnaros.cpp | 12 +- .../Deadmines/boss_mr_smite.cpp | 224 +- .../EasternKingdoms/Deadmines/deadmines.h | 10 +- .../Deadmines/instance_deadmines.cpp | 116 +- .../Gnomeregan/instance_gnomeregan.cpp | 122 +- .../EasternKingdoms/Karazhan/boss_curator.cpp | 224 +- .../Karazhan/boss_maiden_of_virtue.cpp | 160 +- .../Karazhan/boss_midnight.cpp | 648 +- .../EasternKingdoms/Karazhan/boss_moroes.cpp | 350 +- .../Karazhan/boss_nightbane.cpp | 64 +- .../Karazhan/boss_servant_quarters.cpp | 246 +- .../Karazhan/instance_karazhan.cpp | 390 +- .../EasternKingdoms/Karazhan/karazhan.cpp | 74 +- .../EasternKingdoms/Karazhan/karazhan.h | 26 +- .../boss_felblood_kaelthas.cpp | 346 +- .../boss_priestess_delrissa.cpp | 1210 ++-- .../MagistersTerrace/boss_selin_fireheart.cpp | 202 +- .../MagistersTerrace/boss_vexallus.cpp | 140 +- .../instance_magisters_terrace.cpp | 42 +- .../MagistersTerrace/magisters_terrace.h | 32 +- .../ScarletEnclave/chapter1.cpp | 534 +- .../ScarletEnclave/chapter2.cpp | 86 +- .../ScarletEnclave/chapter5.cpp | 1752 ++--- .../instance_scarlet_monastery.cpp | 20 +- .../Scholomance/boss_kirtonos_the_herald.cpp | 66 +- .../Scholomance/instance_scholomance.cpp | 184 +- .../EasternKingdoms/Scholomance/scholomance.h | 30 +- .../instance_shadowfang_keep.cpp | 190 +- .../ShadowfangKeep/shadowfang_keep.h | 14 +- .../Stratholme/instance_stratholme.cpp | 598 +- .../EasternKingdoms/Stratholme/stratholme.h | 46 +- .../SunkenTemple/instance_sunken_temple.cpp | 392 +- .../SunkenTemple/sunken_temple.h | 32 +- .../SunwellPlateau/boss_brutallus.cpp | 636 +- .../SunwellPlateau/boss_eredar_twins.cpp | 612 +- .../SunwellPlateau/boss_felmyst.cpp | 642 +- .../SunwellPlateau/boss_kalecgos.cpp | 876 +-- .../SunwellPlateau/boss_kiljaeden.cpp | 1772 ++--- .../SunwellPlateau/boss_muru.cpp | 466 +- .../instance_sunwell_plateau.cpp | 136 +- .../SunwellPlateau/sunwell_plateau.h | 108 +- .../TheStockade/instance_the_stockade.cpp | 20 +- .../Uldaman/instance_uldaman.cpp | 164 +- .../scripts/EasternKingdoms/Uldaman/uldaman.h | 14 +- .../EasternKingdoms/ZulAman/boss_hexlord.cpp | 2 +- .../EasternKingdoms/ZulAman/boss_janalai.cpp | 10 +- .../EasternKingdoms/ZulAman/zulaman.cpp | 18 +- .../EasternKingdoms/ZulGurub/boss_hakkar.cpp | 2 +- .../EasternKingdoms/ZulGurub/boss_jeklik.cpp | 4 +- .../scripts/EasternKingdoms/zone_duskwood.cpp | 60 +- .../zone_eastern_plaguelands.cpp | 416 +- .../zone_isle_of_queldanas.cpp | 1108 +-- .../zone_redridge_mountains.cpp | 6 +- .../EasternKingdoms/zone_stormwind_city.cpp | 2 +- .../EasternKingdoms/zone_tirisfal_glades.cpp | 4 +- .../EasternKingdoms/zone_undercity.cpp | 6 +- .../zone_western_plaguelands.cpp | 2 +- .../scripts/EasternKingdoms/zone_westfall.cpp | 62 +- .../scripts/EasternKingdoms/zone_wetlands.cpp | 2 +- src/server/scripts/Events/brewfest.cpp | 2344 +++---- src/server/scripts/Events/hallows_end.cpp | 1706 ++--- src/server/scripts/Events/love_in_air.cpp | 750 +- src/server/scripts/Events/midsummer.cpp | 640 +- src/server/scripts/Events/pilgrims_bounty.cpp | 908 +-- src/server/scripts/Events/winter_veil.cpp | 206 +- .../BlackfathomDeeps/blackfathom_deeps.h | 14 +- .../instance_blackfathom_deeps.cpp | 208 +- .../BattleForMountHyjal/boss_kazrogal.cpp | 2 +- .../CullingOfStratholme/boss_epoch.cpp | 128 +- .../CullingOfStratholme/boss_infinite.cpp | 150 +- .../CullingOfStratholme/boss_mal_ganis.cpp | 170 +- .../CullingOfStratholme/boss_meathook.cpp | 76 +- .../CullingOfStratholme/boss_salramm.cpp | 158 +- .../culling_of_stratholme.cpp | 2074 +++--- .../culling_of_stratholme.h | 212 +- .../instance_culling_of_stratholme.cpp | 492 +- .../boss_captain_skarloc.cpp | 260 +- .../boss_epoch_hunter.cpp | 86 +- .../boss_lieutenant_drake.cpp | 174 +- .../instance_old_hillsbrad.cpp | 412 +- .../EscapeFromDurnholdeKeep/old_hillsbrad.cpp | 1246 ++-- .../EscapeFromDurnholdeKeep/old_hillsbrad.h | 90 +- .../TheBlackMorass/boss_aeonus.cpp | 96 +- .../TheBlackMorass/boss_chrono_lord_deja.cpp | 78 +- .../TheBlackMorass/boss_temporus.cpp | 72 +- .../instance_the_black_morass.cpp | 396 +- .../TheBlackMorass/the_black_morass.cpp | 500 +- .../TheBlackMorass/the_black_morass.h | 66 +- .../scripts/Kalimdor/DireMaul/dire_maul.h | 20 +- .../Kalimdor/DireMaul/instance_dire_maul.cpp | 248 +- .../Kalimdor/Maraudon/instance_maraudon.cpp | 124 +- .../scripts/Kalimdor/Maraudon/maraudon.h | 6 +- .../Kalimdor/OnyxiasLair/boss_onyxia.cpp | 1050 +-- .../OnyxiasLair/instance_onyxias_lair.cpp | 276 +- .../Kalimdor/OnyxiasLair/onyxias_lair.h | 18 +- .../RagefireChasm/instance_ragefire_chasm.cpp | 20 +- .../RazorfenDowns/instance_razorfen_downs.cpp | 138 +- .../Kalimdor/RazorfenDowns/razorfen_downs.cpp | 374 +- .../RazorfenKraul/instance_razorfen_kraul.cpp | 20 +- .../Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp | 4 +- .../Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp | 18 +- .../TempleOfAhnQiraj/boss_viscidus.cpp | 2 +- .../instance_wailing_caverns.cpp | 180 +- .../Kalimdor/WailingCaverns/wailing_caverns.h | 20 +- .../Kalimdor/ZulFarrak/instance_zulfarrak.cpp | 208 +- .../scripts/Kalimdor/ZulFarrak/zulfarrak.h | 6 +- .../scripts/Kalimdor/zone_azuremyst_isle.cpp | 14 +- .../scripts/Kalimdor/zone_darkshore.cpp | 188 +- src/server/scripts/Kalimdor/zone_desolace.cpp | 700 +- .../Kalimdor/zone_dustwallow_marsh.cpp | 8 +- src/server/scripts/Kalimdor/zone_silithus.cpp | 40 +- .../scripts/Kalimdor/zone_the_barrens.cpp | 44 +- .../scripts/Kalimdor/zone_winterspring.cpp | 284 +- .../AzjolNerub/AzjolNerub/azjol_nerub.h | 28 +- .../AzjolNerub/AzjolNerub/boss_anubarak.cpp | 428 +- .../AzjolNerub/AzjolNerub/boss_hadronox.cpp | 538 +- .../boss_krikthir_the_gatewatcher.cpp | 344 +- .../AzjolNerub/instance_azjol_nerub.cpp | 244 +- .../Northrend/AzjolNerub/ahnkahet/ahnkahet.h | 14 +- .../AzjolNerub/ahnkahet/boss_amanitar.cpp | 154 +- .../AzjolNerub/ahnkahet/boss_elder_nadox.cpp | 448 +- .../ahnkahet/boss_herald_volazj.cpp | 222 +- .../ahnkahet/boss_jedoga_shadowseeker.cpp | 644 +- .../ahnkahet/boss_prince_taldaram.cpp | 336 +- .../AzjolNerub/ahnkahet/def_ahnkahet.h | 26 +- .../AzjolNerub/ahnkahet/instance_ahnkahet.cpp | 110 +- .../ObsidianSanctum/boss_sartharion.cpp | 2144 +++--- .../instance_obsidian_sanctum.cpp | 366 +- .../ObsidianSanctum/obsidian_sanctum.h | 58 +- .../boss_baltharus_the_warborn.cpp | 192 +- .../RubySanctum/boss_general_zarithrian.cpp | 42 +- .../RubySanctum/boss_halion.cpp | 744 +- .../RubySanctum/boss_saviana_ragefire.cpp | 60 +- .../RubySanctum/instance_ruby_sanctum.cpp | 84 +- .../RubySanctum/ruby_sanctum.h | 12 +- .../boss_argent_challenge.cpp | 1346 ++-- .../TrialOfTheChampion/boss_black_knight.cpp | 768 +- .../boss_grand_champions.cpp | 1654 ++--- .../instance_trial_of_the_champion.cpp | 2412 +++---- .../trial_of_the_champion.cpp | 162 +- .../trial_of_the_champion.h | 338 +- .../boss_anubarak_trial.cpp | 1532 ++-- .../boss_faction_champions.cpp | 4130 +++++------ .../TrialOfTheCrusader/boss_lord_jaraxxus.cpp | 710 +- .../boss_northrend_beasts.cpp | 1680 ++--- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 1378 ++-- .../instance_trial_of_the_crusader.cpp | 3392 ++++----- .../trial_of_the_crusader.cpp | 106 +- .../trial_of_the_crusader.h | 476 +- .../Northrend/DraktharonKeep/boss_dred.cpp | 270 +- .../Northrend/DraktharonKeep/boss_novos.cpp | 408 +- .../DraktharonKeep/boss_tharon_ja.cpp | 422 +- .../DraktharonKeep/boss_trollgore.cpp | 234 +- .../DraktharonKeep/drak_tharon_keep.h | 30 +- .../instance_drak_tharon_keep.cpp | 188 +- .../ForgeOfSouls/boss_bronjahm.cpp | 556 +- .../ForgeOfSouls/boss_devourer_of_souls.cpp | 554 +- .../ForgeOfSouls/forge_of_souls.cpp | 430 +- .../FrozenHalls/ForgeOfSouls/forge_of_souls.h | 84 +- .../ForgeOfSouls/instance_forge_of_souls.cpp | 376 +- .../HallsOfReflection/boss_falric.cpp | 254 +- .../HallsOfReflection/boss_marwyn.cpp | 304 +- .../HallsOfReflection/halls_of_reflection.cpp | 3410 ++++----- .../HallsOfReflection/halls_of_reflection.h | 472 +- .../instance_halls_of_reflection.cpp | 2278 +++--- .../PitOfSaron/boss_forgemaster_garfrost.cpp | 578 +- .../PitOfSaron/boss_krickandick.cpp | 868 +-- .../PitOfSaron/boss_scourgelord_tyrannus.cpp | 370 +- .../PitOfSaron/instance_pit_of_saron.cpp | 710 +- .../FrozenHalls/PitOfSaron/pit_of_saron.cpp | 2658 +++---- .../FrozenHalls/PitOfSaron/pit_of_saron.h | 358 +- .../Gundrak/boss_drakkari_colossus.cpp | 614 +- .../scripts/Northrend/Gundrak/boss_eck.cpp | 192 +- .../Northrend/Gundrak/boss_gal_darah.cpp | 324 +- .../Northrend/Gundrak/boss_moorabi.cpp | 238 +- .../Northrend/Gundrak/boss_slad_ran.cpp | 272 +- .../scripts/Northrend/Gundrak/gundrak.h | 44 +- .../Northrend/Gundrak/instance_gundrak.cpp | 402 +- .../boss_blood_prince_council.cpp | 2832 ++++---- .../boss_blood_queen_lana_thel.cpp | 1592 ++--- .../boss_deathbringer_saurfang.cpp | 656 +- .../IcecrownCitadel/boss_festergut.cpp | 752 +- .../boss_icecrown_gunship_battle.cpp | 1154 +-- .../boss_lady_deathwhisper.cpp | 1866 ++--- .../IcecrownCitadel/boss_lord_marrowgar.cpp | 1026 +-- .../boss_professor_putricide.cpp | 2702 ++++---- .../IcecrownCitadel/boss_rotface.cpp | 1508 ++-- .../IcecrownCitadel/boss_sindragosa.cpp | 3318 ++++----- .../IcecrownCitadel/boss_the_lich_king.cpp | 6170 ++++++++--------- .../boss_valithria_dreamwalker.cpp | 2362 +++---- .../IcecrownCitadel/icecrown_citadel.cpp | 2842 ++++---- .../IcecrownCitadel/icecrown_citadel.h | 72 +- .../icecrown_citadel_teleport.cpp | 2 +- .../instance_icecrown_citadel.cpp | 934 +-- .../Northrend/Naxxramas/boss_anubrekhan.cpp | 272 +- .../Northrend/Naxxramas/boss_faerlina.cpp | 250 +- .../Naxxramas/boss_four_horsemen.cpp | 450 +- .../Northrend/Naxxramas/boss_gluth.cpp | 318 +- .../Northrend/Naxxramas/boss_gothik.cpp | 684 +- .../Northrend/Naxxramas/boss_grobbulus.cpp | 294 +- .../Northrend/Naxxramas/boss_heigan.cpp | 310 +- .../Northrend/Naxxramas/boss_kelthuzad.cpp | 882 +-- .../Northrend/Naxxramas/boss_loatheb.cpp | 184 +- .../Northrend/Naxxramas/boss_maexxna.cpp | 318 +- .../scripts/Northrend/Naxxramas/boss_noth.cpp | 354 +- .../Northrend/Naxxramas/boss_patchwerk.cpp | 248 +- .../Northrend/Naxxramas/boss_razuvious.cpp | 396 +- .../Northrend/Naxxramas/boss_sapphiron.cpp | 678 +- .../Northrend/Naxxramas/boss_thaddius.cpp | 774 +-- .../Naxxramas/instance_naxxramas.cpp | 1394 ++-- .../scripts/Northrend/Naxxramas/naxxramas.h | 164 +- .../Nexus/EyeOfEternity/boss_malygos.cpp | 2486 +++---- .../Nexus/EyeOfEternity/eye_of_eternity.h | 140 +- .../instance_eye_of_eternity.cpp | 446 +- .../Northrend/Nexus/Nexus/boss_anomalus.cpp | 222 +- .../boss_commander_stoutbeard_kolurg.cpp | 164 +- .../Nexus/Nexus/boss_keristrasza.cpp | 274 +- .../Nexus/Nexus/boss_magus_telestra.cpp | 396 +- .../Northrend/Nexus/Nexus/boss_ormorok.cpp | 308 +- .../Northrend/Nexus/Nexus/instance_nexus.cpp | 460 +- .../scripts/Northrend/Nexus/Nexus/nexus.h | 44 +- .../Northrend/Nexus/Oculus/boss_drakos.cpp | 324 +- .../Northrend/Nexus/Oculus/boss_eregos.cpp | 334 +- .../Northrend/Nexus/Oculus/boss_urom.cpp | 500 +- .../Northrend/Nexus/Oculus/boss_varos.cpp | 356 +- .../Nexus/Oculus/instance_oculus.cpp | 504 +- .../scripts/Northrend/Nexus/Oculus/oculus.cpp | 544 +- .../scripts/Northrend/Nexus/Oculus/oculus.h | 82 +- .../HallsOfLightning/boss_bjarngrim.cpp | 616 +- .../Ulduar/HallsOfLightning/boss_ionar.cpp | 354 +- .../Ulduar/HallsOfLightning/boss_loken.cpp | 332 +- .../Ulduar/HallsOfLightning/boss_volkhan.cpp | 864 +-- .../HallsOfLightning/halls_of_lightning.h | 34 +- .../instance_halls_of_lightning.cpp | 372 +- .../Ulduar/HallsOfStone/boss_krystallus.cpp | 236 +- .../HallsOfStone/boss_maiden_of_grief.cpp | 198 +- .../Ulduar/HallsOfStone/boss_sjonnir.cpp | 758 +- .../Ulduar/HallsOfStone/brann_bronzebeard.cpp | 1382 ++-- .../Ulduar/HallsOfStone/halls_of_stone.h | 48 +- .../HallsOfStone/instance_halls_of_stone.cpp | 402 +- .../Ulduar/boss_algalon_the_observer.cpp | 772 +-- .../Ulduar/Ulduar/boss_assembly_of_iron.cpp | 1498 ++-- .../Northrend/Ulduar/Ulduar/boss_auriaya.cpp | 668 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 2834 ++++---- .../Northrend/Ulduar/Ulduar/boss_freya.cpp | 2060 +++--- .../Ulduar/Ulduar/boss_general_vezax.cpp | 1062 +-- .../Northrend/Ulduar/Ulduar/boss_hodir.cpp | 2436 +++---- .../Northrend/Ulduar/Ulduar/boss_ignis.cpp | 896 +-- .../Northrend/Ulduar/Ulduar/boss_kologarn.cpp | 1040 +-- .../Northrend/Ulduar/Ulduar/boss_mimiron.cpp | 4354 ++++++------ .../Ulduar/Ulduar/boss_razorscale.cpp | 1780 ++--- .../Northrend/Ulduar/Ulduar/boss_thorim.cpp | 2880 ++++---- .../Northrend/Ulduar/Ulduar/boss_xt002.cpp | 1366 ++-- .../Ulduar/Ulduar/boss_yoggsaron.cpp | 3976 +++++------ .../Ulduar/Ulduar/instance_ulduar.cpp | 1866 ++--- .../Northrend/Ulduar/Ulduar/ulduar.cpp | 732 +- .../scripts/Northrend/Ulduar/Ulduar/ulduar.h | 410 +- .../UtgardeKeep/boss_ingvar_the_plunderer.cpp | 642 +- .../UtgardeKeep/UtgardeKeep/boss_keleseth.cpp | 556 +- .../UtgardeKeep/boss_skarvald_dalronn.cpp | 402 +- .../UtgardeKeep/instance_utgarde_keep.cpp | 624 +- .../UtgardeKeep/UtgardeKeep/utgarde_keep.cpp | 84 +- .../UtgardeKeep/UtgardeKeep/utgarde_keep.h | 66 +- .../UtgardePinnacle/boss_palehoof.cpp | 1220 ++-- .../UtgardePinnacle/boss_skadi.cpp | 796 +-- .../UtgardePinnacle/boss_svala.cpp | 626 +- .../UtgardePinnacle/boss_ymiron.cpp | 454 +- .../instance_utgarde_pinnacle.cpp | 424 +- .../UtgardePinnacle/utgarde_pinnacle.h | 72 +- .../VaultOfArchavon/boss_archavon.cpp | 122 +- .../Northrend/VaultOfArchavon/boss_emalon.cpp | 182 +- .../VaultOfArchavon/boss_koralon.cpp | 132 +- .../VaultOfArchavon/boss_toravon.cpp | 206 +- .../instance_vault_of_archavon.cpp | 326 +- .../VaultOfArchavon/vault_of_archavon.h | 14 +- .../Northrend/VioletHold/boss_cyanigosa.cpp | 260 +- .../Northrend/VioletHold/boss_erekem.cpp | 438 +- .../Northrend/VioletHold/boss_ichoron.cpp | 544 +- .../Northrend/VioletHold/boss_lavanthor.cpp | 172 +- .../Northrend/VioletHold/boss_moragg.cpp | 206 +- .../Northrend/VioletHold/boss_xevozz.cpp | 284 +- .../Northrend/VioletHold/boss_zuramat.cpp | 350 +- .../VioletHold/instance_violet_hold.cpp | 1210 ++-- .../Northrend/VioletHold/violet_hold.cpp | 1590 ++--- .../Northrend/VioletHold/violet_hold.h | 192 +- .../scripts/Northrend/isle_of_conquest.cpp | 288 +- .../scripts/Northrend/zone_borean_tundra.cpp | 78 +- .../Northrend/zone_crystalsong_forest.cpp | 194 +- src/server/scripts/Northrend/zone_dalaran.cpp | 370 +- .../scripts/Northrend/zone_dragonblight.cpp | 2134 +++--- .../scripts/Northrend/zone_grizzly_hills.cpp | 62 +- .../scripts/Northrend/zone_howling_fjord.cpp | 192 +- .../scripts/Northrend/zone_icecrown.cpp | 2062 +++--- .../scripts/Northrend/zone_sholazar_basin.cpp | 786 +-- .../scripts/Northrend/zone_storm_peaks.cpp | 912 +-- .../scripts/Northrend/zone_wintergrasp.cpp | 636 +- src/server/scripts/Northrend/zone_zuldrak.cpp | 882 +-- .../scripts/OutdoorPvP/OutdoorPvPGH.cpp | 22 +- src/server/scripts/OutdoorPvP/OutdoorPvPGH.h | 12 +- .../scripts/OutdoorPvP/OutdoorPvPNA.cpp | 2 +- .../scripts/OutdoorPvP/OutdoorPvPSI.cpp | 8 +- .../AuchenaiCrypts/boss_exarch_maladaar.cpp | 138 +- .../boss_shirrak_the_dead_watcher.cpp | 246 +- .../ManaTombs/boss_nexusprince_shaffar.cpp | 210 +- .../SethekkHalls/boss_talon_king_ikiss.cpp | 384 +- .../SethekkHalls/instance_sethekk_halls.cpp | 88 +- .../Auchindoun/SethekkHalls/sethekk_halls.h | 8 +- .../boss_ambassador_hellmaw.cpp | 128 +- .../boss_blackheart_the_inciter.cpp | 106 +- .../boss_grandmaster_vorpil.cpp | 162 +- .../ShadowLabyrinth/boss_murmur.cpp | 172 +- .../instance_shadow_labyrinth.cpp | 42 +- .../ShadowLabyrinth/shadow_labyrinth.h | 20 +- .../Outland/BlackTemple/black_temple.h | 54 +- .../Outland/BlackTemple/boss_bloodboil.cpp | 322 +- .../Outland/BlackTemple/boss_illidan.cpp | 2074 +++--- .../BlackTemple/boss_mother_shahraz.cpp | 360 +- .../BlackTemple/boss_reliquary_of_souls.cpp | 1110 +-- .../BlackTemple/boss_shade_of_akama.cpp | 956 +-- .../Outland/BlackTemple/boss_supremus.cpp | 314 +- .../BlackTemple/boss_teron_gorefiend.cpp | 472 +- .../BlackTemple/boss_warlord_najentus.cpp | 156 +- .../Outland/BlackTemple/illidari_council.cpp | 914 +-- .../BlackTemple/instance_black_temple.cpp | 558 +- .../boss_fathomlord_karathress.cpp | 264 +- .../boss_hydross_the_unstable.cpp | 592 +- .../SerpentShrine/boss_lady_vashj.cpp | 600 +- .../boss_leotheras_the_blind.cpp | 714 +- .../SerpentShrine/boss_lurker_below.cpp | 346 +- .../boss_morogrim_tidewalker.cpp | 304 +- .../SerpentShrine/instance_serpent_shrine.cpp | 380 +- .../SerpentShrine/serpent_shrine.h | 76 +- .../SlavePens/boss_ahune.cpp | 624 +- .../SteamVault/boss_hydromancer_thespia.cpp | 72 +- .../SteamVault/boss_mekgineer_steamrigger.cpp | 148 +- .../SteamVault/boss_warlord_kalithresh.cpp | 100 +- .../SteamVault/instance_steam_vault.cpp | 306 +- .../SteamVault/steam_vault.h | 18 +- .../underbog/boss_the_black_stalker.cpp | 216 +- .../scripts/Outland/GruulsLair/boss_gruul.cpp | 118 +- .../GruulsLair/boss_high_king_maulgar.cpp | 364 +- .../scripts/Outland/GruulsLair/gruuls_lair.h | 6 +- .../GruulsLair/instance_gruuls_lair.cpp | 34 +- .../BloodFurnace/blood_furnace.h | 42 +- .../BloodFurnace/boss_broggok.cpp | 64 +- .../BloodFurnace/boss_kelidan_the_breaker.cpp | 330 +- .../BloodFurnace/boss_the_maker.cpp | 72 +- .../BloodFurnace/instance_blood_furnace.cpp | 118 +- .../boss_omor_the_unscarred.cpp | 268 +- .../boss_vazruden_the_herald.cpp | 496 +- .../boss_watchkeeper_gargolmar.cpp | 224 +- .../HellfireRamparts/hellfire_ramparts.h | 20 +- .../instance_hellfire_ramparts.cpp | 4 +- .../MagtheridonsLair/boss_magtheridon.cpp | 358 +- .../instance_magtheridons_lair.cpp | 176 +- .../MagtheridonsLair/magtheridons_lair.h | 34 +- .../ShatteredHalls/boss_nethekurse.cpp | 224 +- .../ShatteredHalls/boss_warbringer_omrogg.cpp | 246 +- .../boss_warchief_kargath_bladefist.cpp | 150 +- .../instance_shattered_halls.cpp | 206 +- .../ShatteredHalls/shattered_halls.h | 50 +- .../Outland/TempestKeep/Eye/boss_alar.cpp | 578 +- .../TempestKeep/Eye/boss_astromancer.cpp | 298 +- .../Outland/TempestKeep/Eye/boss_kaelthas.cpp | 1328 ++-- .../TempestKeep/Eye/boss_void_reaver.cpp | 98 +- .../TempestKeep/Eye/instance_the_eye.cpp | 116 +- .../scripts/Outland/TempestKeep/Eye/the_eye.h | 36 +- .../Mechanar/boss_gatewatcher_gyrokill.cpp | 8 +- .../Mechanar/boss_gatewatcher_ironhand.cpp | 8 +- .../Mechanar/boss_mechano_lord_capacitus.cpp | 32 +- .../Mechanar/boss_nethermancer_sepethrea.cpp | 112 +- .../boss_pathaleon_the_calculator.cpp | 114 +- .../Mechanar/instance_mechanar.cpp | 252 +- .../Outland/TempestKeep/Mechanar/mechanar.h | 32 +- .../Outland/TempestKeep/arcatraz/arcatraz.cpp | 868 +-- .../Outland/TempestKeep/arcatraz/arcatraz.h | 16 +- .../arcatraz/boss_dalliah_the_doomsayer.cpp | 66 +- .../arcatraz/boss_harbinger_skyriss.cpp | 194 +- .../boss_wrath_scryer_soccothrates.cpp | 104 +- .../arcatraz/boss_zereketh_the_unbound.cpp | 14 +- .../arcatraz/instance_arcatraz.cpp | 10 +- .../botanica/boss_commander_sarannis.cpp | 42 +- .../botanica/boss_high_botanist_freywinn.cpp | 144 +- .../Outland/TempestKeep/botanica/boss_laj.cpp | 86 +- .../botanica/boss_thorngrin_the_tender.cpp | 86 +- .../botanica/boss_warp_splinter.cpp | 82 +- .../botanica/instance_the_botanica.cpp | 128 +- .../TempestKeep/botanica/the_botanica.h | 12 +- .../Outland/zone_blades_edge_mountains.cpp | 118 +- .../Outland/zone_hellfire_peninsula.cpp | 20 +- src/server/scripts/Outland/zone_nagrand.cpp | 8 +- .../scripts/Outland/zone_netherstorm.cpp | 448 +- .../Outland/zone_shadowmoon_valley.cpp | 88 +- .../scripts/Outland/zone_shattrath_city.cpp | 24 +- .../scripts/Outland/zone_terokkar_forest.cpp | 232 +- .../scripts/Outland/zone_zangarmarsh.cpp | 80 +- src/server/scripts/Pet/pet_dk.cpp | 406 +- src/server/scripts/Pet/pet_generic.cpp | 1372 ++-- src/server/scripts/Pet/pet_hunter.cpp | 128 +- src/server/scripts/Pet/pet_mage.cpp | 252 +- src/server/scripts/Pet/pet_priest.cpp | 42 +- src/server/scripts/Pet/pet_shaman.cpp | 66 +- src/server/scripts/Spells/spell_dk.cpp | 954 +-- src/server/scripts/Spells/spell_druid.cpp | 274 +- src/server/scripts/Spells/spell_generic.cpp | 1214 ++-- src/server/scripts/Spells/spell_hunter.cpp | 362 +- src/server/scripts/Spells/spell_item.cpp | 724 +- src/server/scripts/Spells/spell_mage.cpp | 410 +- src/server/scripts/Spells/spell_paladin.cpp | 248 +- src/server/scripts/Spells/spell_priest.cpp | 174 +- src/server/scripts/Spells/spell_quest.cpp | 888 +-- src/server/scripts/Spells/spell_rogue.cpp | 160 +- src/server/scripts/Spells/spell_shaman.cpp | 308 +- src/server/scripts/Spells/spell_warlock.cpp | 398 +- src/server/scripts/Spells/spell_warrior.cpp | 76 +- .../scripts/World/achievement_scripts.cpp | 10 +- .../scripts/World/areatrigger_scripts.cpp | 26 +- .../scripts/World/boss_emerald_dragons.cpp | 6 +- src/server/scripts/World/go_scripts.cpp | 212 +- src/server/scripts/World/npc_innkeeper.cpp | 4 +- src/server/scripts/World/npc_professions.cpp | 136 +- src/server/scripts/World/npcs_special.cpp | 618 +- src/server/shared/Common.cpp | 8 +- .../Implementation/CharacterDatabase.cpp | 12 +- .../Implementation/CharacterDatabase.h | 20 +- .../Database/Implementation/LoginDatabase.cpp | 6 +- .../Database/Implementation/LoginDatabase.h | 4 +- src/server/shared/Logging/Log.cpp | 2 +- src/server/shared/Logging/Log.h | 4 +- src/server/shared/Packets/ByteBuffer.cpp | 4 +- src/server/shared/Packets/ByteBuffer.h | 40 +- src/server/shared/Threading/DelayExecutor.cpp | 18 +- .../shared/Utilities/EventProcessor.cpp | 2 +- src/server/shared/Utilities/EventProcessor.h | 4 +- src/server/shared/Utilities/Util.h | 20 +- src/server/worldserver/Master.cpp | 18 +- .../worldserver/WorldThread/WorldRunnable.cpp | 68 +- .../worldserver/WorldThread/WorldRunnable.h | 4 +- 717 files changed, 132388 insertions(+), 132388 deletions(-) diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index 8ad12f7fc..126c50431 100644 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -234,7 +234,7 @@ void AuthSocket::OnRead() ++challengesInARow; if (challengesInARow == MAX_AUTH_LOGON_CHALLENGES_IN_A_ROW) { - sLog->outString("Got %u AUTH_LOGON_CHALLENGE in a row from '%s', possible ongoing DoS", challengesInARow, socket().getRemoteAddress().c_str()); + sLog->outString("Got %u AUTH_LOGON_CHALLENGE in a row from '%s', possible ongoing DoS", challengesInARow, socket().getRemoteAddress().c_str()); socket().shutdown(); return; } @@ -318,29 +318,29 @@ bool AuthSocket::_HandleLogonChallenge() if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) return false; - // pussywizard: logon flood protection: - { - TRINITY_GUARD(ACE_Thread_Mutex, LastLoginAttemptMutex); - std::string ipaddr = socket().getRemoteAddress(); - uint32 currTime = time(NULL); - std::map::iterator itr = LastLoginAttemptTimeForIP.find(ipaddr); - if (itr != LastLoginAttemptTimeForIP.end() && itr->second >= currTime) - { - ByteBuffer pkt; - pkt << uint8(AUTH_LOGON_CHALLENGE); - pkt << uint8(0x00); - pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT); - socket().send((char const*)pkt.contents(), pkt.size()); - return true; - } - if (LastLoginAttemptCleanTime+60 < currTime) - { - LastLoginAttemptTimeForIP.clear(); - LastLoginAttemptCleanTime = currTime; - } - else - LastLoginAttemptTimeForIP[ipaddr] = currTime; - } + // pussywizard: logon flood protection: + { + TRINITY_GUARD(ACE_Thread_Mutex, LastLoginAttemptMutex); + std::string ipaddr = socket().getRemoteAddress(); + uint32 currTime = time(NULL); + std::map::iterator itr = LastLoginAttemptTimeForIP.find(ipaddr); + if (itr != LastLoginAttemptTimeForIP.end() && itr->second >= currTime) + { + ByteBuffer pkt; + pkt << uint8(AUTH_LOGON_CHALLENGE); + pkt << uint8(0x00); + pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT); + socket().send((char const*)pkt.contents(), pkt.size()); + return true; + } + if (LastLoginAttemptCleanTime+60 < currTime) + { + LastLoginAttemptTimeForIP.clear(); + LastLoginAttemptCleanTime = currTime; + } + else + LastLoginAttemptTimeForIP[ipaddr] = currTime; + } // Read the first 4 bytes (header) to get the length of the remaining of the packet std::vector buf; diff --git a/src/server/collision/Management/MMapFactory.cpp b/src/server/collision/Management/MMapFactory.cpp index 52e418277..75d23c60d 100644 --- a/src/server/collision/Management/MMapFactory.cpp +++ b/src/server/collision/Management/MMapFactory.cpp @@ -41,14 +41,14 @@ namespace MMAP return !forbiddenMaps[map->GetId()] && (sWorld->getBoolConfig(CONFIG_ENABLE_MMAPS) ? true : map->IsBattlegroundOrArena()); } - void MMapFactory::InitializeDisabledMaps() - { - memset(&forbiddenMaps, 0, sizeof(forbiddenMaps)); - int32 f[] = {616 /*EoE*/, 649 /*ToC25*/, 650 /*ToC5*/, -1}; - uint32 i = 0; - while (f[i] >= 0) - forbiddenMaps[f[i++]] = true; - } + void MMapFactory::InitializeDisabledMaps() + { + memset(&forbiddenMaps, 0, sizeof(forbiddenMaps)); + int32 f[] = {616 /*EoE*/, 649 /*ToC25*/, 650 /*ToC5*/, -1}; + uint32 i = 0; + while (f[i] >= 0) + forbiddenMaps[f[i++]] = true; + } void MMapFactory::clear() { diff --git a/src/server/collision/Management/MMapManager.cpp b/src/server/collision/Management/MMapManager.cpp index d640ebc58..2ca45ee6b 100644 --- a/src/server/collision/Management/MMapManager.cpp +++ b/src/server/collision/Management/MMapManager.cpp @@ -311,7 +311,7 @@ namespace MMAP dtNavMesh const* MMapManager::GetNavMesh(uint32 mapId) { - // pussywizard: moved to calling function + // pussywizard: moved to calling function //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock); if (loadedMMaps.find(mapId) == loadedMMaps.end()) @@ -322,18 +322,18 @@ namespace MMAP dtNavMeshQuery const* MMapManager::GetNavMeshQuery(uint32 mapId, uint32 instanceId) { - // pussywizard: moved to calling function + // pussywizard: moved to calling function //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock); if (loadedMMaps.find(mapId) == loadedMMaps.end()) return NULL; MMapData* mmap = loadedMMaps[mapId]; - if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end()) - { - // pussywizard: different instances of the same map shouldn't access this simultaneously - TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId)); - // check again after acquiring mutex + if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end()) + { + // pussywizard: different instances of the same map shouldn't access this simultaneously + TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId)); + // check again after acquiring mutex if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end()) { // allocate mesh query @@ -349,7 +349,7 @@ namespace MMAP ;//sLog->outDetail("MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); mmap->navMeshQueries.insert(std::pair(instanceId, query)); } - } + } return mmap->navMeshQueries[instanceId]; } diff --git a/src/server/collision/Management/MMapManager.h b/src/server/collision/Management/MMapManager.h index 4c9e057a7..fb084f305 100644 --- a/src/server/collision/Management/MMapManager.h +++ b/src/server/collision/Management/MMapManager.h @@ -86,8 +86,8 @@ namespace MMAP uint32 getLoadedMapsCount() const { return loadedMMaps.size(); } ACE_RW_Thread_Mutex& GetMMapLock(uint32 mapId); - ACE_RW_Thread_Mutex& GetMMapGeneralLock() { return MMapLock; } // pussywizard: in case a per-map mutex can't be found, should never happen - ACE_RW_Thread_Mutex& GetManagerLock() { return MMapManagerLock; } + ACE_RW_Thread_Mutex& GetMMapGeneralLock() { return MMapLock; } // pussywizard: in case a per-map mutex can't be found, should never happen + ACE_RW_Thread_Mutex& GetManagerLock() { return MMapManagerLock; } private: bool loadMapData(uint32 mapId); uint32 packTileID(int32 x, int32 y); @@ -96,7 +96,7 @@ namespace MMAP uint32 loadedTiles; ACE_RW_Thread_Mutex MMapManagerLock; - ACE_RW_Thread_Mutex MMapLock; // pussywizard: in case a per-map mutex can't be found, should never happen + ACE_RW_Thread_Mutex MMapLock; // pussywizard: in case a per-map mutex can't be found, should never happen }; } diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp index 5c416ad2e..92d856525 100644 --- a/src/server/collision/Management/VMapManager2.cpp +++ b/src/server/collision/Management/VMapManager2.cpp @@ -96,10 +96,10 @@ namespace VMAP std::string mapFileName = getMapFileName(mapId); StaticMapTree* newTree = new StaticMapTree(mapId, basePath); if (!newTree->InitMap(mapFileName, this)) - { - delete newTree; + { + delete newTree; return false; - } + } instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, newTree)).first; } diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index dfeee4072..b5a2f36b4 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -120,8 +120,8 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn //ID = 0; iPos = Vector3(go.GetPositionX(), go.GetPositionY(), go.GetPositionZ()); - // pussywizard: - phasemask = (go.GetGoState() == GO_STATE_READY || go.IsTransport()) ? go.GetPhaseMask() : 0; + // pussywizard: + phasemask = (go.GetGoState() == GO_STATE_READY || go.IsTransport()) ? go.GetPhaseMask() : 0; iScale = go.GetFloatValue(OBJECT_FIELD_SCALE_X); iInvScale = 1.f / iScale; diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h index 775197dd1..f3e0f62e6 100644 --- a/src/server/collision/RegularGrid.h +++ b/src/server/collision/RegularGrid.h @@ -13,19 +13,19 @@ template class NodeArray { public: - explicit NodeArray() { memset(&_nodes, 0, sizeof(_nodes)); } - void AddNode(Node* n) - { - for (uint8 i=0; i<9; ++i) - if (_nodes[i] == 0) - { - _nodes[i] = n; - return; - } - else if (_nodes[i] == n) - return; - } - Node* _nodes[9]; + explicit NodeArray() { memset(&_nodes, 0, sizeof(_nodes)); } + void AddNode(Node* n) + { + for (uint8 i=0; i<9; ++i) + if (_nodes[i] == 0) + { + _nodes[i] = n; + return; + } + else if (_nodes[i] == n) + return; + } + Node* _nodes[9]; }; template @@ -68,47 +68,47 @@ public: void insert(const T& value) { G3D::Vector3 pos[9]; - pos[0] = value.getBounds().corner(0); - pos[1] = value.getBounds().corner(1); - pos[2] = value.getBounds().corner(2); - pos[3] = value.getBounds().corner(3); - pos[4] = (pos[0] + pos[1])/2.0f; - pos[5] = (pos[1] + pos[2])/2.0f; - pos[6] = (pos[2] + pos[3])/2.0f; - pos[7] = (pos[3] + pos[0])/2.0f; - pos[8] = (pos[0] + pos[2])/2.0f; + pos[0] = value.getBounds().corner(0); + pos[1] = value.getBounds().corner(1); + pos[2] = value.getBounds().corner(2); + pos[3] = value.getBounds().corner(3); + pos[4] = (pos[0] + pos[1])/2.0f; + pos[5] = (pos[1] + pos[2])/2.0f; + pos[6] = (pos[2] + pos[3])/2.0f; + pos[7] = (pos[3] + pos[0])/2.0f; + pos[8] = (pos[0] + pos[2])/2.0f; - NodeArray na; - for (uint8 i=0; i<9; ++i) - { - Cell c = Cell::ComputeCell(pos[i].x, pos[i].y); - if (!c.isValid()) - continue; - Node& node = getGridFor(pos[i].x, pos[i].y); - na.AddNode(&node); - } + NodeArray na; + for (uint8 i=0; i<9; ++i) + { + Cell c = Cell::ComputeCell(pos[i].x, pos[i].y); + if (!c.isValid()) + continue; + Node& node = getGridFor(pos[i].x, pos[i].y); + na.AddNode(&node); + } - for (uint8 i=0; i<9; ++i) - { - if (na._nodes[i]) - na._nodes[i]->insert(value); - else - break; - } + for (uint8 i=0; i<9; ++i) + { + if (na._nodes[i]) + na._nodes[i]->insert(value); + else + break; + } memberTable.set(&value, na); } void remove(const T& value) { - NodeArray& na = memberTable[&value]; - for (uint8 i=0; i<9; ++i) - { - if (na._nodes[i]) - na._nodes[i]->remove(value); - else - break; - } + NodeArray& na = memberTable[&value]; + for (uint8 i=0; i<9; ++i) + { + if (na._nodes[i]) + na._nodes[i]->remove(value); + else + break; + } // Remove the member memberTable.remove(&value); diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp index 8ab08d3ee..0e222b81a 100644 --- a/src/server/game/AI/CoreAI/CombatAI.cpp +++ b/src/server/game/AI/CoreAI/CombatAI.cpp @@ -274,8 +274,8 @@ void VehicleAI::UpdateAI(uint32 diff) m_DoDismiss = false; me->DespawnOrUnsummon(); } - else - m_DismissTimer -= diff; + else + m_DismissTimer -= diff; } } diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index ade3a76e5..020718840 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -61,7 +61,7 @@ class GameObjectAI virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {} virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {} virtual void EventInform(uint32 /*eventId*/) {} - virtual void SpellHit(Unit* unit, const SpellInfo* spellInfo) {} + virtual void SpellHit(Unit* unit, const SpellInfo* spellInfo) {} }; class NullGameObjectAI : public GameObjectAI diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index af2656b5d..5adf89d0f 100644 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -37,8 +37,8 @@ GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature) void GuardAI::Reset() { - ScriptedAI::Reset(); - me->CastSpell(me, 18950 /*SPELL_INVISIBILITY_AND_STEALTH_DETECTION*/, true); + ScriptedAI::Reset(); + me->CastSpell(me, 18950 /*SPELL_INVISIBILITY_AND_STEALTH_DETECTION*/, true); } void GuardAI::EnterEvadeMode() diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h index 3ebbfa1be..dede67ac1 100644 --- a/src/server/game/AI/CoreAI/GuardAI.h +++ b/src/server/game/AI/CoreAI/GuardAI.h @@ -30,7 +30,7 @@ class GuardAI : public ScriptedAI static int Permissible(Creature const* creature); - void Reset(); + void Reset(); void EnterEvadeMode(); void JustDied(Unit* killer); }; diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp index ce79c727d..5b6153a56 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.cpp +++ b/src/server/game/AI/CoreAI/PassiveAI.cpp @@ -64,7 +64,7 @@ void CritterAI::DamageTaken(Unit*, uint32&, DamageEffectType, SpellSchoolMask) if (!me->HasUnitState(UNIT_STATE_FLEEING)) me->SetControlled(true, UNIT_STATE_FLEEING); - _combatTimer = 1; + _combatTimer = 1; } void CritterAI::EnterEvadeMode() @@ -72,21 +72,21 @@ void CritterAI::EnterEvadeMode() if (me->HasUnitState(UNIT_STATE_FLEEING)) me->SetControlled(false, UNIT_STATE_FLEEING); CreatureAI::EnterEvadeMode(); - _combatTimer = 0; + _combatTimer = 0; } void CritterAI::UpdateAI(uint32 diff) { - if (me->IsInCombat()) - { - _combatTimer += diff; - if (_combatTimer >= 5000) - EnterEvadeMode(); - } + if (me->IsInCombat()) + { + _combatTimer += diff; + if (_combatTimer >= 5000) + EnterEvadeMode(); + } } void TriggerAI::IsSummonedBy(Unit* summoner) { if (me->m_spells[0]) - me->CastSpell(me, me->m_spells[0], false, 0, 0, summoner ? summoner->GetGUID() : 0); + me->CastSpell(me, me->m_spells[0], false, 0, 0, summoner ? summoner->GetGUID() : 0); } diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h index 2fa2299fa..030909439 100644 --- a/src/server/game/AI/CoreAI/PassiveAI.h +++ b/src/server/game/AI/CoreAI/PassiveAI.h @@ -71,11 +71,11 @@ class CritterAI : public PassiveAI void DamageTaken(Unit* /*done_by*/, uint32& /*damage*/, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask); void EnterEvadeMode(); - void UpdateAI(uint32); + void UpdateAI(uint32); - // Xinef: Added - private: - uint32 _combatTimer; + // Xinef: Added + private: + uint32 _combatTimer; }; class TriggerAI : public NullCreatureAI diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 6c7b88158..83ce0f9e6 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -51,22 +51,22 @@ bool PetAI::_needToStop() if (me->IsCharmed() && me->GetVictim() == me->GetCharmer()) return true; - // xinef: dont allow to follow targets out of visibility range - if (me->GetExactDist(me->GetVictim()) > me->GetVisibilityRange()-5.0f) - return true; + // xinef: dont allow to follow targets out of visibility range + if (me->GetExactDist(me->GetVictim()) > me->GetVisibilityRange()-5.0f) + return true; - // dont allow pets to follow targets far away from owner - if (Unit* owner = me->GetCharmerOrOwner()) - if (owner->GetExactDist(me) >= (owner->GetVisibilityRange()-10.0f)) - return true; + // dont allow pets to follow targets far away from owner + if (Unit* owner = me->GetCharmerOrOwner()) + if (owner->GetExactDist(me) >= (owner->GetVisibilityRange()-10.0f)) + return true; - if (!me->_CanDetectFeignDeathOf(me->GetVictim())) - return true; + if (!me->_CanDetectFeignDeathOf(me->GetVictim())) + return true; - if (me->isTargetNotAcceptableByMMaps(me->GetVictim()->GetGUID(), sWorld->GetGameTime(), me->GetVictim())) - return true; + if (me->isTargetNotAcceptableByMMaps(me->GetVictim()->GetGUID(), sWorld->GetGameTime(), me->GetVictim())) + return true; - return !me->CanCreatureAttack(me->GetVictim()); + return !me->CanCreatureAttack(me->GetVictim()); } void PetAI::_stopAttack() @@ -90,18 +90,18 @@ void PetAI::_stopAttack() void PetAI::_doMeleeAttack() { - // Xinef: Imps cannot attack with melee - if (!_canMeleeAttack()) - return; + // Xinef: Imps cannot attack with melee + if (!_canMeleeAttack()) + return; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } bool PetAI::_canMeleeAttack() const { - return me->GetEntry() != 416 /*ENTRY_IMP*/ && - me->GetEntry() != 510 /*ENTRY_WATER_ELEMENTAL*/ && - me->GetEntry() != 37994 /*ENTRY_WATER_ELEMENTAL_PERM*/; + return me->GetEntry() != 416 /*ENTRY_IMP*/ && + me->GetEntry() != 510 /*ENTRY_WATER_ELEMENTAL*/ && + me->GetEntry() != 37994 /*ENTRY_WATER_ELEMENTAL_PERM*/; } void PetAI::UpdateAI(uint32 diff) @@ -162,34 +162,34 @@ void PetAI::UpdateAI(uint32 diff) HandleReturnMovement(); } - // xinef: charm info must be always available - if (!me->GetCharmInfo()) - return; + // xinef: charm info must be always available + if (!me->GetCharmInfo()) + return; // Autocast (casted only in combat or persistent spells in any state) if (!me->HasUnitState(UNIT_STATE_CASTING)) { - if (owner && owner->GetTypeId() == TYPEID_PLAYER && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget()) - { - owner->ToPlayer()->GetSession()->HandlePetActionHelper(me, me->GetGUID(), abs(me->GetCharmInfo()->GetForcedSpell()), ACT_ENABLED, me->GetCharmInfo()->GetForcedTarget()); + if (owner && owner->GetTypeId() == TYPEID_PLAYER && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget()) + { + owner->ToPlayer()->GetSession()->HandlePetActionHelper(me, me->GetGUID(), abs(me->GetCharmInfo()->GetForcedSpell()), ACT_ENABLED, me->GetCharmInfo()->GetForcedTarget()); - // xinef: if spell was casted properly and we are in passive mode, handle return - if (!me->GetCharmInfo()->GetForcedSpell() && me->HasReactState(REACT_PASSIVE)) - { - if (me->HasUnitState(UNIT_STATE_CASTING)) - { - me->GetMotionMaster()->Clear(false); - me->StopMoving(); - } - else - _stopAttack(); - } - return; - } + // xinef: if spell was casted properly and we are in passive mode, handle return + if (!me->GetCharmInfo()->GetForcedSpell() && me->HasReactState(REACT_PASSIVE)) + { + if (me->HasUnitState(UNIT_STATE_CASTING)) + { + me->GetMotionMaster()->Clear(false); + me->StopMoving(); + } + else + _stopAttack(); + } + return; + } - // xinef: dont allow ghouls to cast spells below 75 energy - if (me->IsPet() && me->ToPet()->IsPetGhoul() && me->GetPower(POWER_ENERGY) < 75) - return; + // xinef: dont allow ghouls to cast spells below 75 energy + if (me->IsPet() && me->ToPet()->IsPetGhoul() && me->GetPower(POWER_ENERGY) < 75) + return; typedef std::vector > TargetSpellList; TargetSpellList targetSpellStore; @@ -221,7 +221,7 @@ void PetAI::UpdateAI(uint32 diff) } Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0); - spell->LoadScripts(); // xinef: load for CanAutoCast (calling CheckPetCast) + spell->LoadScripts(); // xinef: load for CanAutoCast (calling CheckPetCast) bool spellUsed = false; // Some spells can target enemy or friendly (DK Ghoul's Leap) @@ -333,7 +333,7 @@ void PetAI::UpdateAllies() for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->GetSource(); - if (!Target || !Target->IsInMap(owner) || !group->SameSubGroup(owner->ToPlayer(), Target)) + if (!Target || !Target->IsInMap(owner) || !group->SameSubGroup(owner->ToPlayer(), Target)) continue; if (Target->GetGUID() == owner->GetGUID()) @@ -353,9 +353,9 @@ void PetAI::KilledUnit(Unit* victim) if (me->GetVictim() && me->GetVictim() != victim) return; - // Xinef: if pet is channeling a spell and owner killed something different, dont interrupt it - if (me->HasUnitState(UNIT_STATE_CASTING) && me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) && me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) != victim->GetGUID()) - return; + // Xinef: if pet is channeling a spell and owner killed something different, dont interrupt it + if (me->HasUnitState(UNIT_STATE_CASTING) && me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) && me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) != victim->GetGUID()) + return; // Clear target just in case. May help problem where health / focus / mana // regen gets stuck. Also resets attack command. @@ -437,35 +437,35 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const // Check pet attackers first so we don't drag a bunch of targets to the owner if (Unit* myAttacker = me->getAttackerForHelper()) - if (!myAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(myAttacker) && me->CanCreatureAttack(myAttacker) && !me->isTargetNotAcceptableByMMaps(myAttacker->GetGUID(), sWorld->GetGameTime(), myAttacker)) + if (!myAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(myAttacker) && me->CanCreatureAttack(myAttacker) && !me->isTargetNotAcceptableByMMaps(myAttacker->GetGUID(), sWorld->GetGameTime(), myAttacker)) return myAttacker; // Check pet's attackers first to prevent dragging mobs back to owner - if (me->HasAuraType(SPELL_AURA_MOD_TAUNT)) - { - const Unit::AuraEffectList& tauntAuras = me->GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT); - if (!tauntAuras.empty()) - for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr) - if (Unit* caster = (*itr)->GetCaster()) - if (me->_CanDetectFeignDeathOf(caster) && me->CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, me->GetGUID())) - return caster; - } + if (me->HasAuraType(SPELL_AURA_MOD_TAUNT)) + { + const Unit::AuraEffectList& tauntAuras = me->GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT); + if (!tauntAuras.empty()) + for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr) + if (Unit* caster = (*itr)->GetCaster()) + if (me->_CanDetectFeignDeathOf(caster) && me->CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, me->GetGUID())) + return caster; + } // Not sure why we wouldn't have an owner but just in case... - Unit* owner = me->GetCharmerOrOwner(); + Unit* owner = me->GetCharmerOrOwner(); if (!owner) return NULL; // Check owner attackers if (Unit* ownerAttacker = owner->getAttackerForHelper()) - if (!ownerAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(ownerAttacker) && me->CanCreatureAttack(ownerAttacker) && !me->isTargetNotAcceptableByMMaps(ownerAttacker->GetGUID(), sWorld->GetGameTime(), ownerAttacker)) + if (!ownerAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(ownerAttacker) && me->CanCreatureAttack(ownerAttacker) && !me->isTargetNotAcceptableByMMaps(ownerAttacker->GetGUID(), sWorld->GetGameTime(), ownerAttacker)) return ownerAttacker; // Check owner victim // 3.0.2 - Pets now start attacking their owners victim in defensive mode as soon as the hunter does if (Unit* ownerVictim = owner->GetVictim()) - if (me->_CanDetectFeignDeathOf(ownerVictim) && me->CanCreatureAttack(ownerVictim) && !me->isTargetNotAcceptableByMMaps(ownerVictim->GetGUID(), sWorld->GetGameTime(), ownerVictim)) - return ownerVictim; + if (me->_CanDetectFeignDeathOf(ownerVictim) && me->CanCreatureAttack(ownerVictim) && !me->isTargetNotAcceptableByMMaps(ownerVictim->GetGUID(), sWorld->GetGameTime(), ownerVictim)) + return ownerVictim; // Neither pet or owner had a target and aggressive pets can pick any target // To prevent aggressive pets from chain selecting targets and running off, we @@ -509,7 +509,7 @@ void PetAI::HandleReturnMovement() { if (!me->GetCharmInfo()->IsFollowing() && !me->GetCharmInfo()->IsReturning()) { - if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE) + if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE) { ClearCharmInfoFlags(); me->GetCharmInfo()->SetIsReturning(true); @@ -519,23 +519,23 @@ void PetAI::HandleReturnMovement() } } - me->GetCharmInfo()->SetForcedSpell(0); - me->GetCharmInfo()->SetForcedTargetGUID(0); + me->GetCharmInfo()->SetForcedSpell(0); + me->GetCharmInfo()->SetForcedTargetGUID(0); - // xinef: remember that npcs summoned by npcs can also be pets - me->DeleteThreatList(); - me->ClearInPetCombat(); + // xinef: remember that npcs summoned by npcs can also be pets + me->DeleteThreatList(); + me->ClearInPetCombat(); } void PetAI::SpellHit(Unit* caster, const SpellInfo* spellInfo) { - // Xinef: taunt behavior code - if (spellInfo->HasAura(SPELL_AURA_MOD_TAUNT) && !me->HasReactState(REACT_PASSIVE)) - { - me->GetCharmInfo()->SetForcedSpell(0); - me->GetCharmInfo()->SetForcedTargetGUID(0); - AttackStart(caster); - } + // Xinef: taunt behavior code + if (spellInfo->HasAura(SPELL_AURA_MOD_TAUNT) && !me->HasReactState(REACT_PASSIVE)) + { + me->GetCharmInfo()->SetForcedSpell(0); + me->GetCharmInfo()->SetForcedTargetGUID(0); + AttackStart(caster); + } } void PetAI::DoAttack(Unit* target, bool chase) @@ -545,11 +545,11 @@ void PetAI::DoAttack(Unit* target, bool chase) if (me->Attack(target, true)) { - // xinef: properly fix fake combat after pet is sent to attack - if (Unit* owner = me->GetOwner()) - owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); + // xinef: properly fix fake combat after pet is sent to attack + if (Unit* owner = me->GetOwner()) + owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); // Play sound to let the player know the pet is attacking something it picked on its own if (me->HasReactState(REACT_AGGRESSIVE) && !me->GetCharmInfo()->IsCommandAttack()) @@ -565,12 +565,12 @@ void PetAI::DoAttack(Unit* target, bool chase) if (chase) { - me->GetMotionMaster()->MoveChase(target, !_canMeleeAttack() ? 20.0f: 0.0f, me->GetAngle(target)); + me->GetMotionMaster()->MoveChase(target, !_canMeleeAttack() ? 20.0f: 0.0f, me->GetAngle(target)); } else // (Stay && ((Aggressive || Defensive) && In Melee Range))) { me->GetCharmInfo()->SetIsAtStay(true); - me->GetMotionMaster()->MovementExpiredOnSlot(MOTION_SLOT_ACTIVE, false); + me->GetMotionMaster()->MovementExpiredOnSlot(MOTION_SLOT_ACTIVE, false); me->GetMotionMaster()->MoveIdle(); } } @@ -621,34 +621,34 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo) if (!target->IsAlive()) { - // xinef: if target is invalid, pet should evade automaticly + // xinef: if target is invalid, pet should evade automaticly // Clear target to prevent getting stuck on dead targets //me->AttackStop(); //me->InterruptNonMeleeSpells(false); return false; } - // xinef: check unit states of pet - if (me->HasUnitState(UNIT_STATE_LOST_CONTROL)) - return false; + // xinef: check unit states of pet + if (me->HasUnitState(UNIT_STATE_LOST_CONTROL)) + return false; - // xinef: pets of mounted players have stunned flag only, check this also - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED)) - return false; + // xinef: pets of mounted players have stunned flag only, check this also + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED)) + return false; - // pussywizard: ZOMG! TEMP! - if (!me->GetCharmInfo()) - { - sLog->outMisc("PetAI::CanAttack (A1) - %u, %u", me->GetEntry(), GUID_LOPART(me->GetOwnerGUID())); - return false; - } + // pussywizard: ZOMG! TEMP! + if (!me->GetCharmInfo()) + { + sLog->outMisc("PetAI::CanAttack (A1) - %u, %u", me->GetEntry(), GUID_LOPART(me->GetOwnerGUID())); + return false; + } // Passive - passive pets can attack if told to if (me->HasReactState(REACT_PASSIVE)) return me->GetCharmInfo()->IsCommandAttack(); // CC - mobs under crowd control can be attacked if owner commanded - if (target->HasBreakableByDamageCrowdControlAura() && (!spellInfo || !spellInfo->HasAttribute(SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS))) + if (target->HasBreakableByDamageCrowdControlAura() && (!spellInfo || !spellInfo->HasAttribute(SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS))) return me->GetCharmInfo()->IsCommandAttack(); // Returning - pets ignore attacks only if owner clicked follow @@ -658,7 +658,7 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo) // Stay - can attack if target is within range or commanded to if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY)) return (me->IsWithinMeleeRange(target) || me->GetCharmInfo()->IsCommandAttack()); - + // Pets attacking something (or chasing) should only switch targets if owner tells them to if (me->GetVictim() && me->GetVictim() != target) { @@ -668,7 +668,7 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo) ownerTarget = owner->GetSelectedUnit(); else ownerTarget = me->GetCharmerOrOwner()->GetVictim(); - + if (ownerTarget && me->GetCharmInfo()->IsCommandAttack()) return (target->GetGUID() == ownerTarget->GetGUID()); } diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index 05b88a973..a48f31a54 100644 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -48,14 +48,14 @@ class PetAI : public CreatureAI void MoveInLineOfSight(Unit* /*who*/) {} // CreatureAI interferes with returning pets void MoveInLineOfSight_Safe(Unit* /*who*/) {} // CreatureAI interferes with returning pets void EnterEvadeMode() {} // For fleeing, pets don't use this type of Evade mechanic - void SpellHit(Unit* caster, const SpellInfo* spellInfo); + void SpellHit(Unit* caster, const SpellInfo* spellInfo); private: bool _isVisible(Unit*) const; bool _needToStop(void); void _stopAttack(void); - void _doMeleeAttack(); - bool _canMeleeAttack() const; + void _doMeleeAttack(); + bool _canMeleeAttack() const; void UpdateAllies(); diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h index 46c24788f..393a6aa20 100644 --- a/src/server/game/AI/CoreAI/TotemAI.h +++ b/src/server/game/AI/CoreAI/TotemAI.h @@ -46,16 +46,16 @@ class TotemAI : public CreatureAI class KillMagnetEvent : public BasicEvent { - public: - KillMagnetEvent(Unit& self) : _self(self) { } - bool Execute(uint64 e_time, uint32 p_time) - { - _self.setDeathState(JUST_DIED); - return true; - } + public: + KillMagnetEvent(Unit& self) : _self(self) { } + bool Execute(uint64 e_time, uint32 p_time) + { + _self.setDeathState(JUST_DIED); + return true; + } - protected: - Unit& _self; + protected: + Unit& _self; }; #endif diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 88c8e29b1..0183b2016 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -53,10 +53,10 @@ void UnitAI::DoMeleeAttackIfReady() //Make sure our attack is ready and we aren't currently casting before checking distance if (me->isAttackReady()) { - // xinef: prevent base and off attack in same time, delay attack at 0.2 sec - if (me->haveOffhandWeapon()) - if (me->getAttackTimer(OFF_ATTACK) < ATTACK_DISPLAY_DELAY) - me->setAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY); + // xinef: prevent base and off attack in same time, delay attack at 0.2 sec + if (me->haveOffhandWeapon()) + if (me->getAttackTimer(OFF_ATTACK) < ATTACK_DISPLAY_DELAY) + me->setAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY); me->AttackerStateUpdate(victim); me->resetAttackTimer(); @@ -64,8 +64,8 @@ void UnitAI::DoMeleeAttackIfReady() if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK)) { - // xinef: delay main hand attack if both will hit at the same time (players code) - if (me->getAttackTimer(BASE_ATTACK) < ATTACK_DISPLAY_DELAY) + // xinef: delay main hand attack if both will hit at the same time (players code) + if (me->getAttackTimer(BASE_ATTACK) < ATTACK_DISPLAY_DELAY) me->setAttackTimer(BASE_ATTACK, ATTACK_DISPLAY_DELAY); me->AttackerStateUpdate(victim, OFF_ATTACK); diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 853fcb851..5eea3ccf1 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -121,7 +121,7 @@ struct PowerUsersSelector : public std::unary_function Unit const* _me; float const _dist; bool const _playerOnly; - Powers const _power; + Powers const _power; PowerUsersSelector(Unit const* unit, Powers power, float dist, bool playerOnly) : _me(unit), _power(power), _dist(dist), _playerOnly(playerOnly) { } @@ -131,8 +131,8 @@ struct PowerUsersSelector : public std::unary_function if (!_me || !target) return false; - if (target->getPowerType() != _power) - return false; + if (target->getPowerType() != _power) + return false; if (_playerOnly && target->GetTypeId() != TYPEID_PLAYER) return false; @@ -162,8 +162,8 @@ struct FarthestTargetSelector : public std::unary_function if (_dist > 0.0f && !_me->IsWithinCombatRange(target, _dist)) return false; - if (_inLos && !_me->IsWithinLOSInMap(target)) - return false; + if (_inLos && !_me->IsWithinLOSInMap(target)) + return false; return true; } @@ -172,7 +172,7 @@ private: const Unit* _me; float _dist; bool _playerOnly; - bool _inLos; + bool _inLos; }; class UnitAI diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 226fd7083..a01c64b1a 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -58,8 +58,8 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN return; } - // Xinef: Skip creatures in evade mode - if (!creature->HasReactState(REACT_PASSIVE) && !creature->GetVictim() && !creature->IsInEvadeMode()) + // Xinef: Skip creatures in evade mode + if (!creature->HasReactState(REACT_PASSIVE) && !creature->GetVictim() && !creature->IsInEvadeMode()) { if (Unit* nearTarget = creature->SelectNearestTarget(maxRangeToNearestTarget)) creature->AI()->AttackStart(nearTarget); @@ -128,12 +128,12 @@ void CreatureAI::MoveInLineOfSight(Unit* who) if (me->GetVictim()) return; - // pussywizard: civilian, non-combat pet or any other NOT HOSTILE TO ANYONE (!) - if (me->IsMoveInLineOfSightDisabled()) - if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || // nothing more to do, return - !who->IsInCombat() || // if not in combat, nothing more to do - !me->IsWithinDist(who, ATTACK_DISTANCE)) // if in combat and in dist - neutral to all can actually assist other creatures - return; + // pussywizard: civilian, non-combat pet or any other NOT HOSTILE TO ANYONE (!) + if (me->IsMoveInLineOfSightDisabled()) + if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || // nothing more to do, return + !who->IsInCombat() || // if not in combat, nothing more to do + !me->IsWithinDist(who, ATTACK_DISTANCE)) // if in combat and in dist - neutral to all can actually assist other creatures + return; if (me->CanStartAttack(who)) AttackStart(who); @@ -212,9 +212,9 @@ bool CreatureAI::UpdateVictim() AttackStart(victim); return me->GetVictim(); } - // xinef: if we have any victim, just return true - else if (me->GetVictim() && me->GetExactDist(me->GetVictim()) < 30.0f) - return true; + // xinef: if we have any victim, just return true + else if (me->GetVictim() && me->GetExactDist(me->GetVictim()) < 30.0f) + return true; else if (me->getThreatManager().isThreatListEmpty()) { EnterEvadeMode(); diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index debef76d2..060ae5a30 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -165,11 +165,11 @@ class CreatureAI : public UnitAI /// == Fields ======================================= virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) {} - virtual void OnSpellClick(Unit* /*clicker*/, bool& /*result*/) { } + virtual void OnSpellClick(Unit* /*clicker*/, bool& /*result*/) { } virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; } - virtual bool CanBeSeen(Player const* /*seer*/) { return true; } + virtual bool CanBeSeen(Player const* /*seer*/) { return true; } protected: virtual void MoveInLineOfSight(Unit* /*who*/); diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index 8870e8107..2b460bf86 100644 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -33,8 +33,8 @@ namespace FactorySelector const CreatureAICreator* ai_factory = NULL; CreatureAIRegistry& ai_registry(*CreatureAIRepository::instance()); - // xinef: if we have controlable guardian, define petai for players as they can steer him, otherwise db / normal ai - // xinef: dont remember why i changed this qq commented out as may break some quests + // xinef: if we have controlable guardian, define petai for players as they can steer him, otherwise db / normal ai + // xinef: dont remember why i changed this qq commented out as may break some quests if (creature->IsPet()/* || (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)*/) ai_factory = ai_registry.GetRegistryItem("PetAI"); @@ -95,7 +95,7 @@ namespace FactorySelector } // select NullCreatureAI if not another cases - // xinef: unused + // xinef: unused // ainame = (ai_factory == NULL) ? "NullCreatureAI" : ai_factory->key(); ;//sLog->outDebug(LOG_FILTER_TSCR, "Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str()); @@ -143,7 +143,7 @@ namespace FactorySelector //future goAI types go here - // xinef: unused + // xinef: unused //std::string ainame = (ai_factory == NULL || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key(); ;//sLog->outDebug(LOG_FILTER_TSCR, "GameObject %u used AI is %s.", go->GetGUIDLow(), ainame.c_str()); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 32ebf7063..fe2cff77b 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -90,7 +90,7 @@ bool SummonList::HasEntry(uint32 entry) const uint32 SummonList::GetEntryCount(uint32 entry) const { - uint32 count = 0; + uint32 count = 0; for (StorageType::const_iterator i = storage_.begin(); i != storage_.end(); ++i) { Creature* summon = ObjectAccessor::GetCreature(*me, *i); @@ -106,10 +106,10 @@ void SummonList::Respawn() for (StorageType::iterator i = storage_.begin(); i != storage_.end();) { if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) - { - summon->Respawn(true); + { + summon->Respawn(true); ++i; - } + } else i = storage_.erase(i); } @@ -120,8 +120,8 @@ Creature* SummonList::GetCreatureWithEntry(uint32 entry) const for (StorageType::const_iterator i = storage_.begin(); i != storage_.end(); ++i) { if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) - if (summon->GetEntry() == entry) - return summon; + if (summon->GetEntry() == entry) + return summon; } return NULL; @@ -296,7 +296,7 @@ void ScriptedAI::DoResetThreat() return; } - me->getThreatManager().resetAllAggro(); + me->getThreatManager().resetAllAggro(); } float ScriptedAI::DoGetThreat(Unit* unit) @@ -410,20 +410,20 @@ enum eNPCs NPC_BROODLORD = 12017, NPC_JAN_ALAI = 23578, NPC_SARTHARION = 28860, - NPC_FREYA = 32906, + NPC_FREYA = 32906, }; bool ScriptedAI::EnterEvadeIfOutOfCombatArea() { - if (me->IsInEvadeMode() || !me->IsInCombat()) + if (me->IsInEvadeMode() || !me->IsInCombat()) return false; - if (_evadeCheckCooldown == time(NULL)) - return false; - _evadeCheckCooldown = time(NULL); + if (_evadeCheckCooldown == time(NULL)) + return false; + _evadeCheckCooldown = time(NULL); - if (!CheckEvadeIfOutOfCombatArea()) - return false; + if (!CheckEvadeIfOutOfCombatArea()) + return false; EnterEvadeMode(); return true; @@ -431,22 +431,22 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea() Player* ScriptedAI::SelectTargetFromPlayerList(float maxdist, uint32 excludeAura, bool mustBeInLOS) const { - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - std::vector tList; - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - if (me->GetDistance(itr->GetSource()) > maxdist || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) - continue; - if (excludeAura && itr->GetSource()->HasAura(excludeAura)) - continue; - if (mustBeInLOS && !me->IsWithinLOSInMap(itr->GetSource())) - continue; - tList.push_back(itr->GetSource()); - } - if (!tList.empty()) - return tList[urand(0,tList.size()-1)]; - else - return NULL; + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + std::vector tList; + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + if (me->GetDistance(itr->GetSource()) > maxdist || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) + continue; + if (excludeAura && itr->GetSource()->HasAura(excludeAura)) + continue; + if (mustBeInLOS && !me->IsWithinLOSInMap(itr->GetSource())) + continue; + tList.push_back(itr->GetSource()); + } + if (!tList.empty()) + return tList[urand(0,tList.size()-1)]; + else + return NULL; } // BossAI - for instanced bosses diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 25f49cc13..e1ec520eb 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -79,10 +79,10 @@ public: return storage_.size(); } - void clear() - { - storage_.clear(); - } + void clear() + { + storage_.clear(); + } void Summon(Creature const* summon) { storage_.push_back(summon->GetGUID()); } void Despawn(Creature const* summon) { storage_.remove(summon->GetGUID()); } @@ -100,7 +100,7 @@ public: if (max) RemoveNotExisting(); // pussywizard: when max is set, non existing can be chosen and nothing will happen - StorageType listCopy = storage_; + StorageType listCopy = storage_; for (StorageType::const_iterator i = listCopy.begin(); i != listCopy.end(); ++i) { if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) @@ -135,8 +135,8 @@ public: void RemoveNotExisting(); bool HasEntry(uint32 entry) const; uint32 GetEntryCount(uint32 entry) const; - void Respawn(); - Creature* GetCreatureWithEntry(uint32 entry) const; + void Respawn(); + Creature* GetCreatureWithEntry(uint32 entry) const; private: Creature* me; @@ -159,7 +159,7 @@ class PlayerOrPetCheck bool operator() (WorldObject* unit) const { if (unit->GetTypeId() != TYPEID_PLAYER) - if (!IS_PLAYER_GUID(unit->ToUnit()->GetOwnerGUID())) + if (!IS_PLAYER_GUID(unit->ToUnit()->GetOwnerGUID())) return true; return false; @@ -291,7 +291,7 @@ struct ScriptedAI : public CreatureAI bool IsCombatMovementAllowed() const { return _isCombatMovementAllowed; } bool EnterEvadeIfOutOfCombatArea(); - virtual bool CheckEvadeIfOutOfCombatArea() const { return false; } + virtual bool CheckEvadeIfOutOfCombatArea() const { return false; } // return true for heroic mode. i.e. // - for dungeon in mode 10-heroic, @@ -358,7 +358,7 @@ struct ScriptedAI : public CreatureAI return heroic25; } - Player* SelectTargetFromPlayerList(float maxdist, uint32 excludeAura = 0, bool mustBeInLOS = false) const; + Player* SelectTargetFromPlayerList(float maxdist, uint32 excludeAura = 0, bool mustBeInLOS = false) const; private: Difficulty _difficulty; diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index f5a1cab1b..0853ffa5f 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -87,8 +87,8 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* who) void npc_escortAI::MoveInLineOfSight(Unit* who) { - if (me->GetVictim()) - return; + if (me->GetVictim()) + return; if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack(true, me) && who->isInAccessiblePlaceFor(me)) if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(who)) @@ -122,7 +122,7 @@ void npc_escortAI::JustDied(Unit* /*killer*/) void npc_escortAI::JustRespawned() { - RemoveEscortState(STATE_ESCORT_ESCORTING|STATE_ESCORT_RETURNING|STATE_ESCORT_PAUSED); + RemoveEscortState(STATE_ESCORT_ESCORTING|STATE_ESCORT_RETURNING|STATE_ESCORT_PAUSED); if (!IsCombatMovementAllowed()) SetCombatMovement(true); @@ -139,7 +139,7 @@ void npc_escortAI::JustRespawned() void npc_escortAI::ReturnToLastPoint() { float x, y, z, o; - me->SetWalk(false); + me->SetWalk(false); me->GetHomePosition(x, y, z, o); me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z); } @@ -213,8 +213,8 @@ void npc_escortAI::UpdateAI(uint32 diff) me->DespawnOrUnsummon(); } - // xinef: remove escort state, escort was finished (lack of this line resulted in skipping UpdateEscortAI calls after finished escort) - RemoveEscortState(STATE_ESCORT_ESCORTING); + // xinef: remove escort state, escort was finished (lack of this line resulted in skipping UpdateEscortAI calls after finished escort) + RemoveEscortState(STATE_ESCORT_ESCORTING); return; } @@ -239,7 +239,7 @@ void npc_escortAI::UpdateAI(uint32 diff) //Check if player or any member of his group is within range if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPlayerGUID && !me->GetVictim() && !HasEscortState(STATE_ESCORT_RETURNING)) { - m_uiPlayerCheckTimer += diff; + m_uiPlayerCheckTimer += diff; if (m_uiPlayerCheckTimer > 1000) { if (DespawnAtFar && !IsPlayerOrGroupInRange()) @@ -303,7 +303,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId) { //Call WP function me->SetPosition(CurrentWP->x, CurrentWP->y, CurrentWP->z, me->GetOrientation()); - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); WaypointReached(CurrentWP->id); m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1; @@ -495,9 +495,9 @@ bool npc_escortAI::SetNextWaypoint(uint32 pointId, bool setPosition) size_t const size = WaypointList.size(); Escort_Waypoint waypoint(0, 0, 0, 0, 0); - for (CurrentWP = WaypointList.begin(); CurrentWP != WaypointList.end(); ++CurrentWP) + for (CurrentWP = WaypointList.begin(); CurrentWP != WaypointList.end(); ++CurrentWP) { - if (CurrentWP->id == pointId) + if (CurrentWP->id == pointId) { if (setPosition) me->UpdatePosition(CurrentWP->x, CurrentWP->y, CurrentWP->z, me->GetOrientation()); @@ -540,7 +540,7 @@ void npc_escortAI::GenerateWaypointArray(Movement::PointsArray* points) { // xinef: first point in vector is unit real position points->clear(); - points->push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + points->push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); for (std::list::const_iterator itr = CurrentWP; itr != WaypointList.end(); ++itr) points->push_back(G3D::Vector3(itr->x, itr->y, itr->z)); } diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index fc236cee8..4490e3dc0 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -35,7 +35,7 @@ void FollowerAI::AttackStart(Unit* who) if (me->Attack(who, true)) { - // This is done in Unit::Attack function which wont bug npcs by not adding threat upon combat start... + // This is done in Unit::Attack function which wont bug npcs by not adding threat upon combat start... //me->AddThreat(who, 0.0f); //me->SetInCombatWith(who); //who->SetInCombatWith(me); @@ -80,14 +80,14 @@ bool FollowerAI::AssistPlayerInCombat(Unit* who) void FollowerAI::MoveInLineOfSight(Unit* who) { - if (me->GetVictim()) - return; + if (me->GetVictim()) + return; if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack(true, me) && who->isInAccessiblePlaceFor(me)) if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(who)) return; - if (me->CanStartAttack(who)) + if (me->CanStartAttack(who)) AttackStart(who); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 17ea9063e..29194632c 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -39,15 +39,15 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) mEscortState = SMART_ESCORT_NONE; mCurrentWPID = 0;//first wp id is 1 !! mWPReached = false; - mOOCReached = false; + mOOCReached = false; mWPPauseTimer = 0; mLastWP = NULL; - mEscortNPCFlags = 0; + mEscortNPCFlags = 0; mCanRepeatPath = false; // spawn in run mode - // Xinef: spawn in run mode and set mRun to run... this overrides SetWalk EVERYWHERE, RETARDS + // Xinef: spawn in run mode and set mRun to run... this overrides SetWalk EVERYWHERE, RETARDS mRun = true; mCanAutoAttack = true; @@ -73,10 +73,10 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) mJustReset = false; - // Xinef: Vehicle conditions - m_ConditionsTimer = 0; - if (me->GetVehicleKit()) - conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry()); + // Xinef: Vehicle conditions + m_ConditionsTimer = 0; + if (me->GetVehicleKit()) + conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry()); } void SmartAI::UpdateDespawn(const uint32 diff) @@ -95,8 +95,8 @@ void SmartAI::UpdateDespawn(const uint32 diff) else me->DespawnOrUnsummon(); } - else - mDespawnTime -= diff; + else + mDespawnTime -= diff; } WayPoint* SmartAI::GetNextWayPoint() @@ -192,10 +192,10 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker) StopPath(); if (path) - { + { if (!LoadPath(path)) return; - } + } if (!mWayPoints || mWayPoints->empty()) return; @@ -206,11 +206,11 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker) mCanRepeatPath = repeat; SetRun(run); - if (invoker && invoker->GetTypeId() == TYPEID_PLAYER) - { - mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS); - me->SetUInt32Value(UNIT_NPC_FLAGS, 0); - } + if (invoker && invoker->GetTypeId() == TYPEID_PLAYER) + { + mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS); + me->SetUInt32Value(UNIT_NPC_FLAGS, 0); + } Movement::PointsArray pathPoints; GenerateWayPointArray(&pathPoints); @@ -251,7 +251,7 @@ void SmartAI::PausePath(uint32 delay, bool forced) mWPPauseTimer = delay; if (forced && !mWPReached) { - mForcedPaused = forced; + mForcedPaused = forced; SetRun(mRun); if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == ESCORT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); @@ -288,11 +288,11 @@ void SmartAI::EndPath(bool fail) mLastWP = NULL; mWPPauseTimer = 0; - if (mEscortNPCFlags) - { - me->SetUInt32Value(UNIT_NPC_FLAGS, mEscortNPCFlags); - mEscortNPCFlags = 0; - } + if (mEscortNPCFlags) + { + me->SetUInt32Value(UNIT_NPC_FLAGS, mEscortNPCFlags); + mEscortNPCFlags = 0; + } ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS); if (targets && mEscortQuestID) @@ -305,8 +305,8 @@ void SmartAI::EndPath(bool fail) for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) { Player* groupGuy = groupRef->GetSource(); - if (!groupGuy || !player->IsInMap(groupGuy)) - continue; + if (!groupGuy || !player->IsInMap(groupGuy)) + continue; if (!fail && groupGuy->IsAtGroupRewardDistance(me) && !groupGuy->GetCorpse()) groupGuy->AreaExploredOrEventHappens(mEscortQuestID); @@ -314,15 +314,15 @@ void SmartAI::EndPath(bool fail) groupGuy->FailQuest(mEscortQuestID); } } - else - { - if (!fail && player->IsAtGroupRewardDistance(me) && !player->GetCorpse()) - player->GroupEventHappens(mEscortQuestID, me); - else if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE) - player->FailQuest(mEscortQuestID); - } + else + { + if (!fail && player->IsAtGroupRewardDistance(me) && !player->GetCorpse()) + player->GroupEventHappens(mEscortQuestID, me); + else if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE) + player->FailQuest(mEscortQuestID); + } } - else + else { for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter) { @@ -338,16 +338,16 @@ void SmartAI::EndPath(bool fail) } } - // Xinef: if the escort failed - DO NOT PROCESS ANYTHING, ITS RETARDED - // Xinef: End Path events should be only processed if it was SUCCESSFUL stop or stop called by SMART_ACTION_WAYPOINT_STOP - if (fail) - { - mCurrentWPID = 0; - return; - } + // Xinef: if the escort failed - DO NOT PROCESS ANYTHING, ITS RETARDED + // Xinef: End Path events should be only processed if it was SUCCESSFUL stop or stop called by SMART_ACTION_WAYPOINT_STOP + if (fail) + { + mCurrentWPID = 0; + return; + } - GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, NULL, mCurrentWPID, GetScript()->GetPathId()); - mCurrentWPID = 0; + GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, NULL, mCurrentWPID, GetScript()->GetPathId()); + mCurrentWPID = 0; if (mCanRepeatPath) StartPath(mRun, GetScript()->GetPathId(), mCanRepeatPath); @@ -373,8 +373,8 @@ void SmartAI::ResumePath() void SmartAI::ReturnToLastOOCPos() { - me->SetWalk(false); - float x, y, z, o; + me->SetWalk(false); + float x, y, z, o; me->GetHomePosition(x, y, z, o); me->GetMotionMaster()->MovePoint(SMART_ESCORT_LAST_OOC_POINT, x, y, z); } @@ -386,21 +386,21 @@ void SmartAI::UpdatePath(const uint32 diff) if (mEscortInvokerCheckTimer < diff) { - // Xinef: Escort failed - no players in range - // Xinef: Despawn immediately + // Xinef: Escort failed - no players in range + // Xinef: Despawn immediately if (!IsEscortInvokerInRange()) { StopPath(0, mEscortQuestID, true); - // Xinef: allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying - GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me); - me->DespawnOrUnsummon(1); - return; + // Xinef: allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying + GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me); + me->DespawnOrUnsummon(1); + return; } mEscortInvokerCheckTimer = 1000; } - else - mEscortInvokerCheckTimer -= diff; + else + mEscortInvokerCheckTimer -= diff; // handle pause if (HasEscortState(SMART_ESCORT_PAUSED)) @@ -415,13 +415,13 @@ void SmartAI::UpdatePath(const uint32 diff) { mWPReached = false; mForcedPaused = false; - ResumePath(); + ResumePath(); } - mWPPauseTimer = 0; + mWPPauseTimer = 0; } } - else + else mWPPauseTimer -= diff; } @@ -429,7 +429,7 @@ void SmartAI::UpdatePath(const uint32 diff) { if (mOOCReached)//reached OOC WP { - mOOCReached = false; + mOOCReached = false; RemoveEscortState(SMART_ESCORT_RETURNING); if (!HasEscortState(SMART_ESCORT_PAUSED)) ResumePath(); @@ -440,13 +440,13 @@ void SmartAI::UpdatePath(const uint32 diff) return; // handle next wp - if (!me->HasUnitState(UNIT_STATE_NOT_MOVE) && me->movespline->Finalized())//reached WP + if (!me->HasUnitState(UNIT_STATE_NOT_MOVE) && me->movespline->Finalized())//reached WP { - if (!mWPReached) - { - ResumePath(); - return; - } + if (!mWPReached) + { + ResumePath(); + return; + } mWPReached = false; if (mCurrentWPID == GetWPCount()) @@ -464,16 +464,16 @@ void SmartAI::UpdatePath(const uint32 diff) void SmartAI::CheckConditions(const uint32 diff) { - Vehicle* vehicle = me->GetVehicleKit(); - if (!vehicle) - return; + Vehicle* vehicle = me->GetVehicleKit(); + if (!vehicle) + return; if (m_ConditionsTimer < diff) { if (!conditions.empty()) { for (SeatMap::iterator itr = vehicle->Seats.begin(); itr != vehicle->Seats.end(); ++itr) - if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid)) + if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid)) { if (Player* player = passenger->ToPlayer()) { @@ -487,13 +487,13 @@ void SmartAI::CheckConditions(const uint32 diff) } m_ConditionsTimer = 1000; } - else - m_ConditionsTimer -= diff; + else + m_ConditionsTimer -= diff; } void SmartAI::UpdateAI(uint32 diff) { - CheckConditions(diff); + CheckConditions(diff); GetScript()->OnUpdate(diff); UpdatePath(diff); UpdateDespawn(diff); @@ -527,12 +527,12 @@ bool SmartAI::IsEscortInvokerInRange() ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS); if (targets) { - float checkDist = me->GetInstanceScript() ? SMART_ESCORT_MAX_PLAYER_DIST*2 : SMART_ESCORT_MAX_PLAYER_DIST; + float checkDist = me->GetInstanceScript() ? SMART_ESCORT_MAX_PLAYER_DIST*2 : SMART_ESCORT_MAX_PLAYER_DIST; if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin()))) { Player* player = (*targets->begin())->ToPlayer(); if (me->GetDistance(player) <= checkDist) - return true; + return true; if (Group* group = player->GetGroup()) { @@ -540,12 +540,12 @@ bool SmartAI::IsEscortInvokerInRange() { Player* groupGuy = groupRef->GetSource(); - if (groupGuy && me->IsInMap(groupGuy) && me->GetDistance(groupGuy) <= checkDist) + if (groupGuy && me->IsInMap(groupGuy) && me->GetDistance(groupGuy) <= checkDist) return true; } } } - else + else { for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter) { @@ -557,10 +557,10 @@ bool SmartAI::IsEscortInvokerInRange() } } - // Xinef: no valid target found - return false; + // Xinef: no valid target found + return false; } - // Xinef: no player invoker was stored, just ignore range check + // Xinef: no player invoker was stored, just ignore range check return true; } @@ -571,19 +571,19 @@ void SmartAI::MovepointReached(uint32 id) // xinef: both point movement and escort generator can enter this function if (id == SMART_ESCORT_LAST_OOC_POINT) - { - mOOCReached = true; + { + mOOCReached = true; return; - } + } - mWPReached = true; + mWPReached = true; GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, NULL, mCurrentWPID); if (mLastWP) - { + { me->SetPosition(mLastWP->x, mLastWP->y, mLastWP->z, me->GetOrientation()); - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - } + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + } if (HasEscortState(SMART_ESCORT_PAUSED)) { @@ -593,20 +593,20 @@ void SmartAI::MovepointReached(uint32 id) me->StopMovingOnCurrentPos(); me->GetMotionMaster()->MoveIdle(); } - // Xinef: Can be unset in ProcessEvents - else if (HasEscortState(SMART_ESCORT_ESCORTING) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE) - { - mWPReached = false; - if (mCurrentWPID == GetWPCount()) - EndPath(); - else if (GetNextWayPoint()) - { - SetRun(mRun); - // xinef: if we have reached waypoint, and there is no working spline movement it means our splitted array has ended, make new one - if (me->movespline->Finalized()) - ResumePath(); - } - } + // Xinef: Can be unset in ProcessEvents + else if (HasEscortState(SMART_ESCORT_ESCORTING) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE) + { + mWPReached = false; + if (mCurrentWPID == GetWPCount()) + EndPath(); + else if (GetNextWayPoint()) + { + SetRun(mRun); + // xinef: if we have reached waypoint, and there is no working spline movement it means our splitted array has ended, make new one + if (me->movespline->Finalized()) + ResumePath(); + } + } } void SmartAI::MovementInform(uint32 MovementType, uint32 Data) @@ -624,15 +624,15 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data) void SmartAI::EnterEvadeMode() { - // xinef: fixes strange jumps when charming SmartAI npc + // xinef: fixes strange jumps when charming SmartAI npc if (!me->IsAlive() || me->IsInEvadeMode()) - return; - - if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) - { - me->AttackStop(); return; - } + + if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + { + me->AttackStop(); + return; + } me->RemoveEvadeAuras(); @@ -656,19 +656,19 @@ void SmartAI::EnterEvadeMode() { if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid)) me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle); - me->ClearUnitState(UNIT_STATE_EVADE); + me->ClearUnitState(UNIT_STATE_EVADE); - // xinef: do not forget to reset scripts as we wont call reached home - GetScript()->OnReset(); + // xinef: do not forget to reset scripts as we wont call reached home + GetScript()->OnReset(); } else - { + { me->GetMotionMaster()->MoveTargetedHome(); - - // xinef: do not forget to reset scripts as we wont call reached home - if (!me->HasUnitState(UNIT_STATE_EVADE)) - GetScript()->OnReset(); - } + + // xinef: do not forget to reset scripts as we wont call reached home + if (!me->HasUnitState(UNIT_STATE_EVADE)) + GetScript()->OnReset(); + } } void SmartAI::MoveInLineOfSight(Unit* who) @@ -678,8 +678,8 @@ void SmartAI::MoveInLineOfSight(Unit* who) GetScript()->OnMoveInLineOfSight(who); - if (me->GetVictim()) - return; + if (me->GetVictim()) + return; if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who)) return; @@ -697,7 +697,7 @@ bool SmartAI::CanAIAttack(const Unit* /*who*/) const bool SmartAI::AssistPlayerInCombat(Unit* who) { - // Xinef: if unit has no victim, or victim is player controlled thing + // Xinef: if unit has no victim, or victim is player controlled thing if (!who->GetVictim() || IS_PLAYER_GUID(who->GetCharmerOrOwnerOrOwnGUID())) return false; @@ -741,7 +741,7 @@ void SmartAI::JustRespawned() mFollowArrivedTimer = 1000; mFollowArrivedEntry = 0; mFollowCreditType = 0; - mFollowArrivedAlive = true; + mFollowArrivedAlive = true; } int SmartAI::Permissible(const Creature* creature) @@ -768,8 +768,8 @@ void SmartAI::JustReachedHome() void SmartAI::EnterCombat(Unit* enemy) { - // Xinef: Interrupt channeled spells - me->InterruptSpell(CURRENT_CHANNELED_SPELL, true, true); + // Xinef: Interrupt channeled spells + me->InterruptSpell(CURRENT_CHANNELED_SPELL, true, true); GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy); } @@ -792,27 +792,27 @@ void SmartAI::JustSummoned(Creature* creature) void SmartAI::AttackStart(Unit* who) { - // xinef: dont allow charmed npcs to act on their own - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) - { - if (who && mCanAutoAttack) - me->Attack(who, true); - return; - } + // xinef: dont allow charmed npcs to act on their own + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + { + if (who && mCanAutoAttack) + me->Attack(who, true); + return; + } if (who && me->Attack(who, me->IsWithinMeleeRange(who))) { if (mCanCombatMove || GetScript()->GetMaxCombatDist()) - { - SetRun(mRun); - MovementGeneratorType type = me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE); - if (type == ESCORT_MOTION_TYPE || type == POINT_MOTION_TYPE) - { - me->GetMotionMaster()->MovementExpired(); - me->StopMoving(); - } + { + SetRun(mRun); + MovementGeneratorType type = me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE); + if (type == ESCORT_MOTION_TYPE || type == POINT_MOTION_TYPE) + { + me->GetMotionMaster()->MovementExpired(); + me->StopMoving(); + } me->GetMotionMaster()->MoveChase(who, GetScript()->GetCasterActualDist() ? GetScript()->GetCasterActualDist() : GetScript()->GetActualCombatDist()); - } + } } } @@ -831,7 +831,7 @@ void SmartAI::DamageTaken(Unit* doneBy, uint32& damage, DamageEffectType damaget if (doneBy) GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage); - // Xinef: skip nodamage type (eg. instakill effect) + // Xinef: skip nodamage type (eg. instakill effect) if (damagetype != NODAMAGE && mInvincibilityHpLevel && (damage >= me->GetHealth() - mInvincibilityHpLevel)) damage = me->GetHealth() - mInvincibilityHpLevel; // damage should not be nullified, because of player damage req. } @@ -869,9 +869,9 @@ void SmartAI::CorpseRemoved(uint32& respawnDelay) { GetScript()->ProcessEventsFor(SMART_EVENT_CORPSE_REMOVED, NULL, respawnDelay); - // xinef: end escort upon corpse remove, safe check in case of immediate despawn - if (IsEscorted()) - EndPath(true); + // xinef: end escort upon corpse remove, safe check in case of immediate despawn + if (IsEscorted()) + EndPath(true); } void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply) @@ -883,11 +883,11 @@ void SmartAI::InitializeAI() { GetScript()->OnInitialize(me); if (!me->isDead()) - { - mJustReset = true; - JustReachedHome(); - GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); - } + { + mJustReset = true; + JustReachedHome(); + GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); + } } void SmartAI::OnCharmed(bool apply) @@ -963,18 +963,18 @@ void SmartAI::sQuestReward(Player* player, Quest const* quest, uint32 opt) void SmartAI::SetForcedCombatMove(float dist) { - if (!me->GetVictim()) - return; + if (!me->GetVictim()) + return; - SetRun(mRun); + SetRun(mRun); me->GetMotionMaster()->MoveChase(me->GetVictim(), dist); } void SmartAI::SetCombatMove(bool on) { - // Xinef: Fix Combat Movement - if (GetScript()->GetMaxCombatDist()/* || GetScript()->GetCasterMaxDist()*/) // Xinef: we only need this hack for old caster movement system - return; + // Xinef: Fix Combat Movement + if (GetScript()->GetMaxCombatDist()/* || GetScript()->GetCasterMaxDist()*/) // Xinef: we only need this hack for old caster movement system + return; if (mCanCombatMove == on) return; @@ -1016,7 +1016,7 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui mFollowArrivedTimer = 1000; mFollowCredit = credit; mFollowArrivedEntry = end; - mFollowArrivedAlive = !aliveState; // negate - 0 is alive + mFollowArrivedAlive = !aliveState; // negate - 0 is alive me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle); mFollowCreditType = creditType; @@ -1036,10 +1036,10 @@ void SmartAI::StopFollow(bool complete) me->StopMoving(); me->GetMotionMaster()->MoveIdle(); - if (!complete) - return; + if (!complete) + return; - if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid)) + if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid)) { if (!mFollowCreditType) player->RewardPlayerAndGroupAtEvent(mFollowCredit, me); @@ -1047,10 +1047,10 @@ void SmartAI::StopFollow(bool complete) player->GroupEventHappens(mFollowCredit, me); } - SetDespawnTime(5000); + SetDespawnTime(5000); StartDespawn(); - GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED); + GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED); } void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker) @@ -1067,7 +1067,7 @@ void SmartAI::sOnGameEvent(bool start, uint16 eventId) void SmartAI::OnSpellClick(Unit* clicker, bool& result) { - // Xinef: i dont think this is necessery (can be made as event parameter) + // Xinef: i dont think this is necessery (can be made as event parameter) //if (!result) // return; @@ -1090,16 +1090,16 @@ void SmartGameObjectAI::InitializeAI() { GetScript()->OnInitialize(go); - // Xinef: do not call respawn event if go is not spawned - if (go->isSpawned()) - GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); + // Xinef: do not call respawn event if go is not spawned + if (go->isSpawned()) + GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); //Reset(); } void SmartGameObjectAI::Reset() { - // Xinef: call respawn event on reset - GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); + // Xinef: call respawn event on reset + GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); GetScript()->OnReset(); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 002f95f5a..afe923f29 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -39,7 +39,7 @@ enum SmartEscortState enum SmartEscortVars { SMART_ESCORT_MAX_PLAYER_DIST = 60, - SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2, + SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2, }; class SmartAI : public CreatureAI @@ -59,11 +59,11 @@ class SmartAI : public CreatureAI void GenerateWayPointArray(Movement::PointsArray* points); bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); } void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; } - virtual bool IsEscorted() { return (mEscortState & SMART_ESCORT_ESCORTING); } + virtual bool IsEscorted() { return (mEscortState & SMART_ESCORT_ESCORTING); } void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; } void SetAutoAttack(bool on) { mCanAutoAttack = on; } void SetCombatMove(bool on); - bool CanCombatMove() { return mCanCombatMove; } + bool CanCombatMove() { return mCanCombatMove; } void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0, bool aliveState = true); void StopFollow(bool complete); @@ -196,16 +196,16 @@ class SmartAI : public CreatureAI void OnSpellClick(Unit* clicker, bool& result); - // Xinef - void SetWPPauseTimer(uint32 time) { mWPPauseTimer = time; } - void SetForcedCombatMove(float dist); + // Xinef + void SetWPPauseTimer(uint32 time) { mWPPauseTimer = time; } + void SetForcedCombatMove(float dist); private: uint32 mFollowCreditType; uint32 mFollowArrivedTimer; uint32 mFollowCredit; uint32 mFollowArrivedEntry; - bool mFollowArrivedAlive; + bool mFollowArrivedAlive; uint64 mFollowGuid; float mFollowDist; float mFollowAngle; @@ -217,7 +217,7 @@ class SmartAI : public CreatureAI uint32 mEscortState; uint32 mCurrentWPID; bool mWPReached; - bool mOOCReached; + bool mOOCReached; uint32 mWPPauseTimer; WayPoint* mLastWP; uint32 mEscortNPCFlags; @@ -237,7 +237,7 @@ class SmartAI : public CreatureAI uint32 mEscortInvokerCheckTimer; bool mJustReset; - // Xinef: Vehicle conditions + // Xinef: Vehicle conditions void CheckConditions(const uint32 diff); ConditionList conditions; uint32 m_ConditionsTimer; @@ -266,7 +266,7 @@ class SmartGameObjectAI : public GameObjectAI void OnGameEvent(bool start, uint16 eventId); void OnStateChanged(uint32 state, Unit* unit); void EventInform(uint32 eventId); - void SpellHit(Unit* unit, const SpellInfo* spellInfo); + void SpellHit(Unit* unit, const SpellInfo* spellInfo); protected: SmartScript mScript; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 888619b18..629ee0761 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -78,15 +78,15 @@ SmartScript::SmartScript() mScriptType = SMART_SCRIPT_TYPE_CREATURE; isProcessingTimedActionList = false; - // Xinef: Fix Combat Movement - mActualCombatDist = 0; - mMaxCombatDist = 0; + // Xinef: Fix Combat Movement + mActualCombatDist = 0; + mMaxCombatDist = 0; - smartCasterActualDist = 0.0f; - smartCasterMaxDist = 0.0f; - smartCasterPowerType = POWER_MANA; + smartCasterActualDist = 0.0f; + smartCasterMaxDist = 0.0f; + smartCasterPowerType = POWER_MANA; - _allowPhaseReset = true; + _allowPhaseReset = true; } SmartScript::~SmartScript() @@ -100,9 +100,9 @@ SmartScript::~SmartScript() void SmartScript::OnReset() { - // xinef: check if we allow phase reset - if (AllowPhaseReset()) - SetPhase(0); + // xinef: check if we allow phase reset + if (AllowPhaseReset()) + SetPhase(0); ResetBaseObject(); for (SmartAIEventList::iterator i = mEvents.begin(); i != mEvents.end(); ++i) @@ -117,9 +117,9 @@ void SmartScript::OnReset() mLastInvoker = 0; mCounterList.clear(); - // Xinef: Fix Combat Movement - RestoreMaxCombatDist(); - RestoreCasterMaxDist(); + // Xinef: Fix Combat Movement + RestoreMaxCombatDist(); + RestoreCasterMaxDist(); } void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob) @@ -163,8 +163,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u case SMART_ACTION_TALK: { ObjectList* targets = GetTargets(e, unit); - Creature* talker = e.target.type == 0 ? me : NULL; // xinef: tc retardness fix - Unit* talkTarget = NULL; + Creature* talker = e.target.type == 0 ? me : NULL; // xinef: tc retardness fix + Unit* talkTarget = NULL; if (targets) { for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) @@ -172,17 +172,17 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsCreature((*itr)) && !(*itr)->ToCreature()->IsPet()) // Prevented sending text to pets. { if (e.action.talk.useTalkTarget) - { - talker = me; + { + talker = me; talkTarget = (*itr)->ToCreature(); - } + } else talker = (*itr)->ToCreature(); break; } else if (IsPlayer((*itr))) { - talker = me; // xinef: added + talker = me; // xinef: added talkTarget = (*itr)->ToPlayer(); break; } @@ -191,8 +191,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u delete targets; } - if (!talkTarget) - talkTarget = GetLastInvoker(); + if (!talkTarget) + talkTarget = GetLastInvoker(); if (!talker) break; @@ -398,7 +398,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u (*itr)->ToCreature()->SetReactState(ReactStates(e.action.react.state)); } - delete targets; + delete targets; break; } case SMART_ACTION_RANDOM_EMOTE: @@ -497,7 +497,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (Vehicle* vehicle = (*itr)->ToUnit()->GetVehicleKit()) for (SeatMap::iterator it = vehicle->Seats.begin(); it != vehicle->Seats.end(); ++it) - if (Player* player = ObjectAccessor::GetPlayer(*(*itr), it->second.Passenger.Guid)) + if (Player* player = ObjectAccessor::GetPlayer(*(*itr), it->second.Passenger.Guid)) player->AreaExploredOrEventHappens(e.action.quest.quest); if (Player* player = (*itr)->ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself()) @@ -518,48 +518,48 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!targets) break; - Unit* caster = me; - // Areatrigger Cast! - if (e.GetScriptType() == SMART_SCRIPT_TYPE_AREATRIGGER) - caster = unit->SummonTrigger(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetOrientation(), 5000); + Unit* caster = me; + // Areatrigger Cast! + if (e.GetScriptType() == SMART_SCRIPT_TYPE_AREATRIGGER) + caster = unit->SummonTrigger(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetOrientation(), 5000); - if (e.action.cast.targetsLimit > 0 && targets->size() > e.action.cast.targetsLimit) - Trinity::Containers::RandomResizeList(*targets, e.action.cast.targetsLimit); + if (e.action.cast.targetsLimit > 0 && targets->size() > e.action.cast.targetsLimit) + Trinity::Containers::RandomResizeList(*targets, e.action.cast.targetsLimit); for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (go) - { - // Xinef: may be NULL! - go->CastSpell((*itr)->ToUnit(), e.action.cast.spell); - } + if (go) + { + // Xinef: may be NULL! + go->CastSpell((*itr)->ToUnit(), e.action.cast.spell); + } - if (!IsUnit(*itr)) + if (!IsUnit(*itr)) continue; - if (caster && caster != me) // Areatrigger cast - { - caster->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); - } + if (caster && caster != me) // Areatrigger cast + { + caster->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); + } else if (me && (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell))) { if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) me->InterruptNonMeleeSpells(false); - // Xinef: flag usable only if caster has max dist set - if ((e.action.cast.flags & SMARTCAST_COMBAT_MOVE) && GetCasterMaxDist() > 0.0f && me->GetMaxPower(GetCasterPowerType()) > 0) + // Xinef: flag usable only if caster has max dist set + if ((e.action.cast.flags & SMARTCAST_COMBAT_MOVE) && GetCasterMaxDist() > 0.0f && me->GetMaxPower(GetCasterPowerType()) > 0) { // Xinef: check mana case only and operate movement accordingly, LoS and range is checked in targetet movement generator - if (me->GetPowerPct(GetCasterPowerType()) < 15.0f) - { - SetCasterActualDist(0); - CAST_AI(SmartAI, me->AI())->SetForcedCombatMove(0); - } - else if (GetCasterActualDist() == 0.0f && me->GetPowerPct(GetCasterPowerType()) > 30.0f) - { - RestoreCasterMaxDist(); - CAST_AI(SmartAI, me->AI())->SetForcedCombatMove(GetCasterActualDist()); - } + if (me->GetPowerPct(GetCasterPowerType()) < 15.0f) + { + SetCasterActualDist(0); + CAST_AI(SmartAI, me->AI())->SetForcedCombatMove(0); + } + else if (GetCasterActualDist() == 0.0f && me->GetPowerPct(GetCasterPowerType()) > 30.0f) + { + RestoreCasterMaxDist(); + CAST_AI(SmartAI, me->AI())->SetForcedCombatMove(GetCasterActualDist()); + } } me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); @@ -579,8 +579,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!targets) break; - if (e.action.cast.targetsLimit > 0 && targets->size() > e.action.cast.targetsLimit) - Trinity::Containers::RandomResizeList(*targets, e.action.cast.targetsLimit); + if (e.action.cast.targetsLimit > 0 && targets->size() > e.action.cast.targetsLimit) + Trinity::Containers::RandomResizeList(*targets, e.action.cast.targetsLimit); for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { @@ -629,9 +629,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsGameObject(*itr)) { // Activate - // xinef: wtf is this shit? - //(*itr)->ToGameObject()->SetLootState(GO_READY); - (*itr)->ToGameObject()->UseDoorOrButton(0, e.action.activateObject.alternative ? true : false, unit); + // xinef: wtf is this shit? + //(*itr)->ToGameObject()->SetLootState(GO_READY); + (*itr)->ToGameObject()->UseDoorOrButton(0, e.action.activateObject.alternative ? true : false, unit); ;//sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ACTIVATE_GOBJECT. Gameobject %u (entry: %u) activated", // (*itr)->GetGUIDLow(), (*itr)->GetEntry()); } @@ -749,15 +749,15 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - // Xinef: Fix Combat Movement + // Xinef: Fix Combat Movement bool move = e.action.combatMove.move; - if (move && GetMaxCombatDist() && e.GetEventType() == SMART_EVENT_MANA_PCT) - { - SetActualCombatDist(0); - CAST_AI(SmartAI, me->AI())->SetForcedCombatMove(0); - } - else - CAST_AI(SmartAI, me->AI())->SetCombatMove(move); + if (move && GetMaxCombatDist() && e.GetEventType() == SMART_EVENT_MANA_PCT) + { + SetActualCombatDist(0); + CAST_AI(SmartAI, me->AI())->SetForcedCombatMove(0); + } + else + CAST_AI(SmartAI, me->AI())->SetCombatMove(move); ;//sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature %u bool on = %u", // me->GetGUIDLow(), e.action.combatMove.move); break; @@ -785,25 +785,25 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_EVADE: { - if (!GetBaseObject()) + if (!GetBaseObject()) break; ObjectList* targets = GetTargets(e, unit); if (!targets) - break; + break; - for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature((*itr))) - if ((*itr)->ToCreature()->IsAIEnabled) - (*itr)->ToCreature()->AI()->EnterEvadeMode(); - - delete targets; + if ((*itr)->ToCreature()->IsAIEnabled) + (*itr)->ToCreature()->AI()->EnterEvadeMode(); + + delete targets; break; } case SMART_ACTION_FLEE_FOR_ASSIST: { - // Xinef: do not allow to flee without control (stun, fear etc) - if (!me || me->HasUnitState(UNIT_STATE_LOST_CONTROL) || me->GetSpeed(MOVE_RUN) < 0.1f) + // Xinef: do not allow to flee without control (stun, fear etc) + if (!me || me->HasUnitState(UNIT_STATE_LOST_CONTROL) || me->GetSpeed(MOVE_RUN) < 0.1f) break; me->DoFleeToGetAssistance(); @@ -825,25 +825,25 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_CALL_GROUPEVENTHAPPENS: { - if (!GetBaseObject()) + if (!GetBaseObject()) break; ObjectList* targets = GetTargets(e, unit); if (!targets) - break; + break; - for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { if (IsUnit((*itr))) - { - if (Player* player = (*itr)->ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->GroupEventHappens(e.action.quest.quest, GetBaseObject()); - ;//sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %u, group credit for quest %u", - // (*itr)->GetGUIDLow(), e.action.quest.quest); - } + { + if (Player* player = (*itr)->ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself()) + player->GroupEventHappens(e.action.quest.quest, GetBaseObject()); + ;//sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %u, group credit for quest %u", + // (*itr)->GetGUIDLow(), e.action.quest.quest); + } } - - delete targets; + + delete targets; break; } case SMART_ACTION_REMOVEAURASFROMSPELL: @@ -893,7 +893,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsUnit((*itr))) { - float angle = e.action.follow.angle > 6 ? (e.action.follow.angle * M_PI / 180.0f) : e.action.follow.angle; + float angle = e.action.follow.angle > 6 ? (e.action.follow.angle * M_PI / 180.0f) : e.action.follow.angle; CAST_AI(SmartAI, me->AI())->SetFollow((*itr)->ToUnit(), float(int32(e.action.follow.dist))+0.1f, angle, e.action.follow.credit, e.action.follow.entry, e.action.follow.creditType, e.action.follow.aliveState); ;//sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_FOLLOW: Creature %u following target %u", // me->GetGUIDLow(), (*itr)->GetGUIDLow()); @@ -949,7 +949,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_CALL_KILLEDMONSTER: { - if (trigger && IsPlayer(unit)) + if (trigger && IsPlayer(unit)) { unit->ToPlayer()->RewardPlayerAndGroupAtEvent(e.action.killedMonster.creature, unit); ;//sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: (trigger == true) Player %u, Killcredit: %u", @@ -975,10 +975,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (!IsUnit(*itr)) - continue; + if (!IsUnit(*itr)) + continue; - Player* player = (*itr)->ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself(); + Player* player = (*itr)->ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself(); if (!player) continue; @@ -1047,7 +1047,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature(*itr)) - (*itr)->ToCreature()->UpdateEntry(e.action.updateTemplate.creature, NULL, !e.action.updateTemplate.doNotChangeLevel); + (*itr)->ToCreature()->UpdateEntry(e.action.updateTemplate.creature, NULL, !e.action.updateTemplate.doNotChangeLevel); delete targets; break; @@ -1063,7 +1063,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: { - ObjectList* targets = GetTargets(e, unit); + ObjectList* targets = GetTargets(e, unit); if (!targets) break; @@ -1072,28 +1072,28 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u (*itr)->ToCreature()->SetInCombatWithZone(); delete targets; - break; - } + break; + } case SMART_ACTION_CALL_FOR_HELP: { - ObjectList* targets = GetTargets(e, unit); + ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature(*itr)) - { + { (*itr)->ToCreature()->CallForHelp((float)e.action.callHelp.range); - if (e.action.callHelp.withEmote) - { - TrinityStringTextBuilder builder(*itr, CHAT_MSG_MONSTER_EMOTE, LANG_CALL_FOR_HELP, LANG_UNIVERSAL, NULL); - sCreatureTextMgr->SendChatPacket(*itr, builder, CHAT_MSG_MONSTER_EMOTE); - } - } + if (e.action.callHelp.withEmote) + { + TrinityStringTextBuilder builder(*itr, CHAT_MSG_MONSTER_EMOTE, LANG_CALL_FOR_HELP, LANG_UNIVERSAL, NULL); + sCreatureTextMgr->SendChatPacket(*itr, builder, CHAT_MSG_MONSTER_EMOTE); + } + } delete targets; - break; - } + break; + } case SMART_ACTION_SET_SHEATH: { if (me) @@ -1106,7 +1106,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_FORCE_DESPAWN: { - ObjectList* targets = GetTargets(e, unit); + ObjectList* targets = GetTargets(e, unit); if (!targets) break; @@ -1119,8 +1119,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } delete targets; - break; - } + break; + } case SMART_ACTION_SET_INGAME_PHASE_MASK: { ObjectList* targets = GetTargets(e, unit); @@ -1135,7 +1135,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u (*itr)->ToGameObject()->SetPhaseMask(e.action.ingamePhaseMask.mask, true); } - delete targets; + delete targets; break; } case SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL: @@ -1175,16 +1175,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { if (IsCreature(*itr)) - { - SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI()); - if (!ai) - continue; + { + SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI()); + if (!ai) + continue; - if (e.action.invincHP.percent) - ai->SetInvincibilityHpLevel((*itr)->ToCreature()->CountPctFromMaxHealth(e.action.invincHP.percent)); - else - ai->SetInvincibilityHpLevel(e.action.invincHP.minHP); - } + if (e.action.invincHP.percent) + ai->SetInvincibilityHpLevel((*itr)->ToCreature()->CountPctFromMaxHealth(e.action.invincHP.percent)); + else + ai->SetInvincibilityHpLevel(e.action.invincHP.minHP); + } } delete targets; @@ -1259,8 +1259,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!targets) break; - // xinef: attack random target - if (Unit* target = Trinity::Containers::SelectRandomContainerElement(*targets)->ToUnit()) + // xinef: attack random target + if (Unit* target = Trinity::Containers::SelectRandomContainerElement(*targets)->ToUnit()) me->AI()->AttackStart(target); delete targets; @@ -1320,9 +1320,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u float x, y, z, o; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - // xinef: allow gameobjects to summon gameobjects! - //if(!IsUnit((*itr))) - // continue; + // xinef: allow gameobjects to summon gameobjects! + //if(!IsUnit((*itr))) + // continue; (*itr)->GetPosition(x, y, z, o); x += e.target.x; @@ -1330,9 +1330,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u z += e.target.z; o += e.target.o; if (!e.action.summonGO.targetsummon) - GetBaseObject()->SummonGameObject(e.action.summonGO.entry, x, y, z, o, 0, 0, 0, 0, e.action.summonGO.despawnTime); - else - (*itr)->SummonGameObject(e.action.summonGO.entry, GetBaseObject()->GetPositionX(), GetBaseObject()->GetPositionY(), GetBaseObject()->GetPositionZ(), GetBaseObject()->GetOrientation(), 0, 0, 0, 0, e.action.summonGO.despawnTime); + GetBaseObject()->SummonGameObject(e.action.summonGO.entry, x, y, z, o, 0, 0, 0, 0, e.action.summonGO.despawnTime); + else + (*itr)->SummonGameObject(e.action.summonGO.entry, GetBaseObject()->GetPositionX(), GetBaseObject()->GetPositionY(), GetBaseObject()->GetPositionZ(), GetBaseObject()->GetOrientation(), 0, 0, 0, 0, e.action.summonGO.despawnTime); } delete targets; @@ -1415,9 +1415,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { if (IsPlayer(*itr)) - (*itr)->ToPlayer()->TeleportTo(e.action.teleport.mapID, e.target.x, e.target.y, e.target.z, e.target.o); - else if (IsUnit(*itr)) - (*itr)->ToUnit()->NearTeleportTo(e.target.x, e.target.y, e.target.z, e.target.o); + (*itr)->ToPlayer()->TeleportTo(e.action.teleport.mapID, e.target.x, e.target.y, e.target.z, e.target.o); + else if (IsUnit(*itr)) + (*itr)->ToUnit()->NearTeleportTo(e.target.x, e.target.y, e.target.z, e.target.o); } delete targets; @@ -1429,12 +1429,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; CAST_AI(SmartAI, me->AI())->SetFly(e.action.setFly.fly); - // Xinef: Set speed if any - if (e.action.setFly.speed) - me->SetSpeed(MOVE_RUN, float(e.action.setFly.speed/100.0f), true); + // Xinef: Set speed if any + if (e.action.setFly.speed) + me->SetSpeed(MOVE_RUN, float(e.action.setFly.speed/100.0f), true); - // Xinef: this wil be executed only if state is different - me->SetDisableGravity(e.action.setFly.disableGravity); + // Xinef: this wil be executed only if state is different + me->SetDisableGravity(e.action.setFly.disableGravity); break; } case SMART_ACTION_SET_RUN: @@ -1445,13 +1445,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (IsCreature(*itr)) - { - if (IsSmart((*itr)->ToCreature())) - CAST_AI(SmartAI, (*itr)->ToCreature()->AI())->SetRun(e.action.setRun.run); - else - (*itr)->ToCreature()->SetWalk(e.action.setRun.run ? false : true); // Xinef: reversed - } + if (IsCreature(*itr)) + { + if (IsSmart((*itr)->ToCreature())) + CAST_AI(SmartAI, (*itr)->ToCreature()->AI())->SetRun(e.action.setRun.run); + else + (*itr)->ToCreature()->SetWalk(e.action.setRun.run ? false : true); // Xinef: reversed + } } delete targets; @@ -1476,7 +1476,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI())) ai->GetScript()->StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset); else - sLog->outError("SmartScript: Action target for SMART_ACTION_SET_COUNTER is not using SmartAI, skipping"); + sLog->outError("SmartScript: Action target for SMART_ACTION_SET_COUNTER is not using SmartAI, skipping"); } else if (IsGameObject(*itr)) { @@ -1503,23 +1503,23 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 entry = e.action.wpStart.pathID; bool repeat = e.action.wpStart.repeat; - // Xinef: ensure that SMART_ESCORT_TARGETS contains at least one player reference - bool stored = false; + // Xinef: ensure that SMART_ESCORT_TARGETS contains at least one player reference + bool stored = false; ObjectList* targets = GetTargets(e, unit); - if (targets) - { - for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) - { - if (IsPlayer(*itr)) - { - stored = true; - StoreTargetList(targets, SMART_ESCORT_TARGETS); - break; - } - } - if (!stored) - delete targets; - } + if (targets) + { + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (IsPlayer(*itr)) + { + stored = true; + StoreTargetList(targets, SMART_ESCORT_TARGETS); + break; + } + } + if (!stored) + delete targets; + } me->SetReactState((ReactStates)e.action.wpStart.reactState); CAST_AI(SmartAI, me->AI())->StartPath(run, entry, repeat, unit); @@ -1564,25 +1564,25 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; if (e.GetTargetType() == SMART_TARGET_SELF) - { + { me->SetFacingTo((me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && me->GetTransGUID() ? me->GetTransportHomePosition() : me->GetHomePosition()).GetOrientation()); - if (e.action.orientation.quickChange) - me->SetOrientation((me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && me->GetTransGUID() ? me->GetTransportHomePosition() : me->GetHomePosition()).GetOrientation()); - } + if (e.action.orientation.quickChange) + me->SetOrientation((me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && me->GetTransGUID() ? me->GetTransportHomePosition() : me->GetHomePosition()).GetOrientation()); + } else if (e.GetTargetType() == SMART_TARGET_POSITION) - { + { me->SetFacingTo(e.target.o); - if (e.action.orientation.quickChange) - me->SetOrientation(e.target.o); - } + if (e.action.orientation.quickChange) + me->SetOrientation(e.target.o); + } else if (ObjectList* targets = GetTargets(e, unit)) { if (!targets->empty()) - { + { me->SetFacingToObject(*targets->begin()); - if (e.action.orientation.quickChange) - me->SetInFront(*targets->begin()); - } + if (e.action.orientation.quickChange) + me->SetInFront(*targets->begin()); + } delete targets; } @@ -1619,32 +1619,32 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u e.GetTargetType() == SMART_TARGET_CLOSEST_CREATURE || e.GetTargetType() == SMART_TARGET_CLOSEST_GAMEOBJECT || e.GetTargetType() == SMART_TARGET_OWNER_OR_SUMMONER || e.GetTargetType() == SMART_TARGET_ACTION_INVOKER || e.GetTargetType() == SMART_TARGET_CLOSEST_ENEMY || e.GetTargetType() == SMART_TARGET_CLOSEST_FRIENDLY || - e.GetTargetType() == SMART_TARGET_SELF || e.GetTargetType() == SMART_TARGET_STORED) // Xinef: bieda i rozpierdol TC)*/ + e.GetTargetType() == SMART_TARGET_SELF || e.GetTargetType() == SMART_TARGET_STORED) // Xinef: bieda i rozpierdol TC)*/ { if (ObjectList* targets = GetTargets(e, unit)) - { - // xinef: we want to move to random element - target = Trinity::Containers::SelectRandomContainerElement(*targets); - delete targets; - } + { + // xinef: we want to move to random element + target = Trinity::Containers::SelectRandomContainerElement(*targets); + delete targets; + } } if (!target) - { + { G3D::Vector3 dest(e.target.x, e.target.y, e.target.z); if (e.action.MoveToPos.transport) if (TransportBase* trans = me->GetDirectTransport()) trans->CalculatePassengerPosition(dest.x, dest.y, dest.z); - me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, dest.x, dest.y, dest.z, true, true, e.action.MoveToPos.controlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); + me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, dest.x, dest.y, dest.z, true, true, e.action.MoveToPos.controlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); } else // Xinef: we can use dest.x, dest.y, dest.z to make offset :) me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, target->GetPositionX()+e.target.x, target->GetPositionY()+e.target.y, target->GetPositionZ()+e.target.z, true, true, e.action.MoveToPos.controlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); break; } - case SMART_ACTION_MOVE_TO_POS_TARGET: - { + case SMART_ACTION_MOVE_TO_POS_TARGET: + { ObjectList* targets = GetTargets(e, unit); if (!targets) return; @@ -1652,10 +1652,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { if (IsCreature(*itr)) - { - Creature* target = (*itr)->ToCreature(); - target->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, e.target.x, e.target.y , e.target.z, true, true, e.action.MoveToPos.controlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); - } + { + Creature* target = (*itr)->ToCreature(); + target->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, e.target.x, e.target.y , e.target.z, true, true, e.action.MoveToPos.controlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE); + } } delete targets; @@ -1672,13 +1672,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsCreature(*itr)) (*itr)->ToCreature()->Respawn(e.action.RespawnTarget.goRespawnTime); else if (IsGameObject(*itr)) - { - // Xinef: do not modify respawndelay of already spawned gameobjects QQ - if ((*itr)->ToGameObject()->isSpawnedByDefault()) - (*itr)->ToGameObject()->Respawn(); - else - (*itr)->ToGameObject()->SetRespawnTime(e.action.RespawnTarget.goRespawnTime); - } + { + // Xinef: do not modify respawndelay of already spawned gameobjects QQ + if ((*itr)->ToGameObject()->isSpawnedByDefault()) + (*itr)->ToGameObject()->Respawn(); + else + (*itr)->ToGameObject()->SetRespawnTime(e.action.RespawnTarget.goRespawnTime); + } } delete targets; @@ -1772,9 +1772,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u case SMART_ACTION_TRIGGER_TIMED_EVENT: ProcessEventsFor((SMART_EVENT)SMART_EVENT_TIMED_EVENT_TRIGGERED, NULL, e.action.timeEvent.id); - // xinef: remove this event if not repeatable - if (e.event.event_flags & SMART_EVENT_FLAG_NOT_REPEATABLE) - mRemIDs.push_back(e.action.timeEvent.id); + // xinef: remove this event if not repeatable + if (e.event.event_flags & SMART_EVENT_FLAG_NOT_REPEATABLE) + mRemIDs.push_back(e.action.timeEvent.id); break; case SMART_ACTION_REMOVE_TIMED_EVENT: mRemIDs.push_back(e.action.timeEvent.id); @@ -2172,22 +2172,22 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!targets) break; - // xinef: my implementation - if (e.action.jump.selfJump) - { - if (WorldObject* target = Trinity::Containers::SelectRandomContainerElement(*targets)) - if (me) - me->GetMotionMaster()->MoveJump(target->GetPositionX() + e.target.x, target->GetPositionY() + e.target.y, target->GetPositionZ() + e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz); + // xinef: my implementation + if (e.action.jump.selfJump) + { + if (WorldObject* target = Trinity::Containers::SelectRandomContainerElement(*targets)) + if (me) + me->GetMotionMaster()->MoveJump(target->GetPositionX() + e.target.x, target->GetPositionY() + e.target.y, target->GetPositionZ() + e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz); + } + else + { + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + if (WorldObject* obj = (*itr)) + { + if (Creature* creature = obj->ToCreature()) + creature->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz); + } } - else - { - for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) - if (WorldObject* obj = (*itr)) - { - if (Creature* creature = obj->ToCreature()) - creature->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, (float)e.action.jump.speedxy, (float)e.action.jump.speedz); - } - } delete targets; break; @@ -2269,33 +2269,33 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { ObjectList* targets = GetTargets(e, unit); if (targets) - { - float x, y, z, o; + { + float x, y, z, o; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature(*itr)) { - if (e.action.setHomePos.spawnPos) - { - (*itr)->ToCreature()->GetRespawnPosition(x, y, z, &o); - (*itr)->ToCreature()->SetHomePosition(x, y, z, o); - } - else + if (e.action.setHomePos.spawnPos) + { + (*itr)->ToCreature()->GetRespawnPosition(x, y, z, &o); + (*itr)->ToCreature()->SetHomePosition(x, y, z, o); + } + else (*itr)->ToCreature()->SetHomePosition((*itr)->GetPositionX(), (*itr)->GetPositionY(), (*itr)->GetPositionZ(), (*itr)->GetOrientation()); } delete targets; } else if (me && e.GetTargetType() == SMART_TARGET_POSITION) - { - if (e.action.setHomePos.spawnPos) - { - float x, y, z, o; - me->GetRespawnPosition(x, y, z, &o); - me->SetHomePosition(x, y, z, o); - } - else - me->SetHomePosition(e.target.x, e.target.y, e.target.z, e.target.o); - } + { + if (e.action.setHomePos.spawnPos) + { + float x, y, z, o; + me->GetRespawnPosition(x, y, z, &o); + me->SetHomePosition(x, y, z, o); + } + else + me->SetHomePosition(e.target.x, e.target.y, e.target.z, e.target.o); + } break; } /*{ @@ -2393,12 +2393,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u GetBaseObject()->SummonCreatureGroup(e.action.creatureGroup.group, &summonList); for (std::list::const_iterator itr = summonList.begin(); itr != summonList.end(); ++itr) - { + { if (unit && e.action.creatureGroup.attackInvoker) (*itr)->AI()->AttackStart(unit); - else if (me && e.action.creatureGroup.attackScriptOwner) - (*itr)->AI()->AttackStart(me); - } + else if (me && e.action.creatureGroup.attackScriptOwner) + (*itr)->AI()->AttackStart(me); + } break; } @@ -2443,7 +2443,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 eventId = e.action.gameEventStop.id; if (!sGameEventMgr->IsActiveEvent(eventId)) { - sLog->outError("SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_STOP, inactive event (id: %u)", eventId); + sLog->outError("SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_STOP, inactive event (id: %u)", eventId); break; } sGameEventMgr->StopEvent(eventId, true); @@ -2460,7 +2460,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u sGameEventMgr->StartEvent(eventId, true); break; } - case SMART_ACTION_START_CLOSEST_WAYPOINT: + case SMART_ACTION_START_CLOSEST_WAYPOINT: { uint32 waypoints[SMART_ACTION_PARAM_COUNT]; waypoints[0] = e.action.closestWaypointFromList.wp1; @@ -2518,7 +2518,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } break; } - case SMART_ACTION_SET_GO_STATE: + case SMART_ACTION_SET_GO_STATE: { ObjectList* targets = GetTargets(e, unit); if (!targets) @@ -2531,241 +2531,241 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u delete targets; break; } - case SMART_ACTION_EXIT_VEHICLE: - { + case SMART_ACTION_EXIT_VEHICLE: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - (*itr)->ToUnit()->ExitVehicle(); + (*itr)->ToUnit()->ExitVehicle(); - delete targets; - break; - } - case SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS: - { + delete targets; + break; + } + case SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - { - (*itr)->ToUnit()->SetUnitMovementFlags(e.action.movementFlag.flag); - (*itr)->ToUnit()->SendMovementFlagUpdate(); - } + { + (*itr)->ToUnit()->SetUnitMovementFlags(e.action.movementFlag.flag); + (*itr)->ToUnit()->SendMovementFlagUpdate(); + } - delete targets; - break; - } - case SMART_ACTION_SET_COMBAT_DISTANCE: - { + delete targets; + break; + } + case SMART_ACTION_SET_COMBAT_DISTANCE: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature(*itr)) - (*itr)->ToCreature()->m_CombatDistance = e.action.combatDistance.dist; + (*itr)->ToCreature()->m_CombatDistance = e.action.combatDistance.dist; - delete targets; - break; - } - case SMART_ACTION_SET_CASTER_COMBAT_DIST: - { - if (e.action.casterDistance.reset) - RestoreCasterMaxDist(); - else - SetCasterActualDist(e.action.casterDistance.dist); + delete targets; + break; + } + case SMART_ACTION_SET_CASTER_COMBAT_DIST: + { + if (e.action.casterDistance.reset) + RestoreCasterMaxDist(); + else + SetCasterActualDist(e.action.casterDistance.dist); - if (me->GetVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - me->GetMotionMaster()->MoveChase(me->GetVictim(), GetCasterActualDist()); - break; - } - case SMART_ACTION_SET_SIGHT_DIST: - { + if (me->GetVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) + me->GetMotionMaster()->MoveChase(me->GetVictim(), GetCasterActualDist()); + break; + } + case SMART_ACTION_SET_SIGHT_DIST: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature(*itr)) - (*itr)->ToCreature()->m_SightDistance = e.action.sightDistance.dist; + (*itr)->ToCreature()->m_SightDistance = e.action.sightDistance.dist; - delete targets; - break; - } - case SMART_ACTION_FLEE: - { + delete targets; + break; + } + case SMART_ACTION_FLEE: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature(*itr)) - (*itr)->ToCreature()->GetMotionMaster()->MoveFleeing(me, e.action.flee.withEmote); + (*itr)->ToCreature()->GetMotionMaster()->MoveFleeing(me, e.action.flee.withEmote); - delete targets; - break; - } - case SMART_ACTION_ADD_THREAT: - { + delete targets; + break; + } + case SMART_ACTION_ADD_THREAT: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - me->AddThreat((*itr)->ToUnit(), (float)e.action.threatPCT.threatINC - (float)e.action.threatPCT.threatDEC); + me->AddThreat((*itr)->ToUnit(), (float)e.action.threatPCT.threatINC - (float)e.action.threatPCT.threatDEC); - delete targets; - break; - } - case SMART_ACTION_LOAD_EQUIPMENT: - { + delete targets; + break; + } + case SMART_ACTION_LOAD_EQUIPMENT: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature(*itr)) - (*itr)->ToCreature()->LoadEquipment(e.action.loadEquipment.id, e.action.loadEquipment.force); + (*itr)->ToCreature()->LoadEquipment(e.action.loadEquipment.id, e.action.loadEquipment.force); - delete targets; - break; - } - case SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT: - { - uint32 eventId = urand(e.action.randomTimedEvent.minId, e.action.randomTimedEvent.maxId); - ProcessEventsFor((SMART_EVENT)SMART_EVENT_TIMED_EVENT_TRIGGERED, NULL, eventId); - break; - } - case SMART_ACTION_SET_HOVER: - { + delete targets; + break; + } + case SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT: + { + uint32 eventId = urand(e.action.randomTimedEvent.minId, e.action.randomTimedEvent.maxId); + ProcessEventsFor((SMART_EVENT)SMART_EVENT_TIMED_EVENT_TRIGGERED, NULL, eventId); + break; + } + case SMART_ACTION_SET_HOVER: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - (*itr)->ToUnit()->SetHover(e.action.setHover.state); + (*itr)->ToUnit()->SetHover(e.action.setHover.state); - delete targets; - break; - } - case SMART_ACTION_ADD_IMMUNITY: - { + delete targets; + break; + } + case SMART_ACTION_ADD_IMMUNITY: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - (*itr)->ToUnit()->ApplySpellImmune(e.action.immunity.id, e.action.immunity.type, e.action.immunity.value, true); + (*itr)->ToUnit()->ApplySpellImmune(e.action.immunity.id, e.action.immunity.type, e.action.immunity.value, true); - delete targets; - break; - } - case SMART_ACTION_REMOVE_IMMUNITY: - { + delete targets; + break; + } + case SMART_ACTION_REMOVE_IMMUNITY: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - (*itr)->ToUnit()->ApplySpellImmune(e.action.immunity.id, e.action.immunity.type, e.action.immunity.value, false); + (*itr)->ToUnit()->ApplySpellImmune(e.action.immunity.id, e.action.immunity.type, e.action.immunity.value, false); - delete targets; - break; - } - case SMART_ACTION_FALL: - { + delete targets; + break; + } + case SMART_ACTION_FALL: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - (*itr)->ToUnit()->GetMotionMaster()->MoveFall(); + (*itr)->ToUnit()->GetMotionMaster()->MoveFall(); - delete targets; - break; - } - case SMART_ACTION_SET_EVENT_FLAG_RESET: - { - SetPhaseReset(e.action.setActive.state); - break; - } - case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS: - { + delete targets; + break; + } + case SMART_ACTION_SET_EVENT_FLAG_RESET: + { + SetPhaseReset(e.action.setActive.state); + break; + } + case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - (*itr)->ToUnit()->RemoveAllGameObjects(); + (*itr)->ToUnit()->RemoveAllGameObjects(); - delete targets; - break; - } - case SMART_ACTION_STOP_MOTION: - { + delete targets; + break; + } + case SMART_ACTION_STOP_MOTION: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - { - if (e.action.stopMotion.stopMovement) - (*itr)->ToUnit()->StopMoving(); - if (e.action.stopMotion.movementExpired) - (*itr)->ToUnit()->GetMotionMaster()->MovementExpired(); - } + { + if (e.action.stopMotion.stopMovement) + (*itr)->ToUnit()->StopMoving(); + if (e.action.stopMotion.movementExpired) + (*itr)->ToUnit()->GetMotionMaster()->MovementExpired(); + } - delete targets; - break; - } - case SMART_ACTION_NO_ENVIRONMENT_UPDATE: - { + delete targets; + break; + } + case SMART_ACTION_NO_ENVIRONMENT_UPDATE: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - (*itr)->ToUnit()->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + (*itr)->ToUnit()->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - delete targets; - break; - } - case SMART_ACTION_ZONE_UNDER_ATTACK: - { + delete targets; + break; + } + case SMART_ACTION_ZONE_UNDER_ATTACK: + { ObjectList* targets = GetTargets(e, unit); if (!targets) break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsUnit(*itr)) - if (Player* player = (*itr)->ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - me->SendZoneUnderAttackMessage(player); - break; - } + if (Player* player = (*itr)->ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + me->SendZoneUnderAttackMessage(player); + break; + } - delete targets; - break; - } - case SMART_ACTION_LOAD_GRID: - { + delete targets; + break; + } + case SMART_ACTION_LOAD_GRID: + { if (me && me->FindMap()) - me->FindMap()->LoadGrid(e.target.x, e.target.y); - break; - } + me->FindMap()->LoadGrid(e.target.x, e.target.y); + break; + } default: sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); break; @@ -2783,9 +2783,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u void SmartScript::ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, uint32 const& max, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob) { - // xinef: extended by selfs victim + // xinef: extended by selfs victim ConditionList const conds = sConditionMgr->GetConditionsForSmartEvent(e.entryOrGuid, e.event_id, e.source_type); - ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject(), me ? me->GetVictim() : NULL); + ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject(), me ? me->GetVictim() : NULL); if (sConditionMgr->IsObjectMeetToConditions(info, conds)) { @@ -2928,58 +2928,58 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* break; case SMART_TARGET_HOSTILE_SECOND_AGGRO: if (me) - { - if (e.target.hostilRandom.powerType) - { - if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_TOPAGGRO, 1, PowerUsersSelector(me, Powers(e.target.hostilRandom.powerType-1), (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly))) - l->push_back(u); - } - else if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_TOPAGGRO, 1, (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly)) + { + if (e.target.hostilRandom.powerType) + { + if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_TOPAGGRO, 1, PowerUsersSelector(me, Powers(e.target.hostilRandom.powerType-1), (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly))) + l->push_back(u); + } + else if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_TOPAGGRO, 1, (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly)) l->push_back(u); - } + } break; case SMART_TARGET_HOSTILE_LAST_AGGRO: - if (me) - { - if (e.target.hostilRandom.powerType) - { - if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, PowerUsersSelector(me, Powers(e.target.hostilRandom.powerType-1), (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly))) - l->push_back(u); - } - else if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly)) + if (me) + { + if (e.target.hostilRandom.powerType) + { + if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, PowerUsersSelector(me, Powers(e.target.hostilRandom.powerType-1), (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly))) + l->push_back(u); + } + else if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly)) l->push_back(u); - } + } break; case SMART_TARGET_HOSTILE_RANDOM: - if (me) - { - if (e.target.hostilRandom.powerType) - { - if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, PowerUsersSelector(me, Powers(e.target.hostilRandom.powerType-1), (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly))) - l->push_back(u); - } - else if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly)) + if (me) + { + if (e.target.hostilRandom.powerType) + { + if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, PowerUsersSelector(me, Powers(e.target.hostilRandom.powerType-1), (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly))) + l->push_back(u); + } + else if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly)) l->push_back(u); - } + } break; case SMART_TARGET_HOSTILE_RANDOM_NOT_TOP: - if (me) - { - if (e.target.hostilRandom.powerType) - { - if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_RANDOM, 1, PowerUsersSelector(me, Powers(e.target.hostilRandom.powerType-1), (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly))) - l->push_back(u); - } - else if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_RANDOM, 1, (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly)) + if (me) + { + if (e.target.hostilRandom.powerType) + { + if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_RANDOM, 1, PowerUsersSelector(me, Powers(e.target.hostilRandom.powerType-1), (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly))) + l->push_back(u); + } + else if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_RANDOM, 1, (float)e.target.hostilRandom.maxDist, e.target.hostilRandom.playerOnly)) l->push_back(u); - } + } break; case SMART_TARGET_FARTHEST: - if (me) - { - if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_FARTHEST, 0, FarthestTargetSelector(me, e.target.farthest.maxDist, e.target.farthest.playerOnly, e.target.farthest.isInLos))) + if (me) + { + if (Unit* u = me->AI()->SelectTarget(SELECT_TARGET_FARTHEST, 0, FarthestTargetSelector(me, e.target.farthest.maxDist, e.target.farthest.playerOnly, e.target.farthest.isInLos))) l->push_back(u); - } + } break; case SMART_TARGET_ACTION_INVOKER: if (scriptTrigger) @@ -2998,8 +2998,8 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* { for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) if (Player* member = groupRef->GetSource()) - if (member->IsInMap(player)) - l->push_back(member); + if (member->IsInMap(player)) + l->push_back(member); } // We still add the player to the list if there is no group. If we do // this even if there is a group (thus the else-check), it will add the @@ -3021,14 +3021,14 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* if (me && me->GetGUID() == (*itr)->GetGUID()) continue; - // check alive state - 1 alive, 2 dead, 0 both - if (uint32 state = e.target.unitRange.livingState) - { - if ((*itr)->ToCreature()->IsAlive() && state == 2) - continue; - if (!(*itr)->ToCreature()->IsAlive() && state == 1) - continue; - } + // check alive state - 1 alive, 2 dead, 0 both + if (uint32 state = e.target.unitRange.livingState) + { + if ((*itr)->ToCreature()->IsAlive() && state == 2) + continue; + if (!(*itr)->ToCreature()->IsAlive() && state == 1) + continue; + } if (((e.target.unitRange.creature && (*itr)->ToCreature()->GetEntry() == e.target.unitRange.creature) || !e.target.unitRange.creature) && baseObject->IsInRange(*itr, (float)e.target.unitRange.minDist, (float)e.target.unitRange.maxDist)) l->push_back(*itr); @@ -3049,14 +3049,14 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* if (me && me->GetGUID() == (*itr)->GetGUID()) continue; - // check alive state - 1 alive, 2 dead, 0 both - if (uint32 state = e.target.unitDistance.livingState) - { - if ((*itr)->ToCreature()->IsAlive() && state == 2) - continue; - if (!(*itr)->ToCreature()->IsAlive() && state == 1) - continue; - } + // check alive state - 1 alive, 2 dead, 0 both + if (uint32 state = e.target.unitDistance.livingState) + { + if ((*itr)->ToCreature()->IsAlive() && state == 2) + continue; + if (!(*itr)->ToCreature()->IsAlive() && state == 1) + continue; + } if ((e.target.unitDistance.creature && (*itr)->ToCreature()->GetEntry() == e.target.unitDistance.creature) || !e.target.unitDistance.creature) l->push_back(*itr); @@ -3112,18 +3112,18 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* break; } - // xinef: my addition - if (e.target.unitGUID.getFromHashMap) - { - if (target = ObjectAccessor::GetCreature(scriptTrigger ? *scriptTrigger : *GetBaseObject(), MAKE_NEW_GUID(e.target.unitGUID.dbGuid, e.target.unitGUID.entry, HIGHGUID_UNIT))) - l->push_back(target); - } - else - { - target = FindCreatureNear(scriptTrigger ? scriptTrigger : GetBaseObject(), e.target.unitGUID.dbGuid); - if (target && (!e.target.unitGUID.entry || target->GetEntry() == e.target.unitGUID.entry)) - l->push_back(target); - } + // xinef: my addition + if (e.target.unitGUID.getFromHashMap) + { + if (target = ObjectAccessor::GetCreature(scriptTrigger ? *scriptTrigger : *GetBaseObject(), MAKE_NEW_GUID(e.target.unitGUID.dbGuid, e.target.unitGUID.entry, HIGHGUID_UNIT))) + l->push_back(target); + } + else + { + target = FindCreatureNear(scriptTrigger ? scriptTrigger : GetBaseObject(), e.target.unitGUID.dbGuid); + if (target && (!e.target.unitGUID.entry || target->GetEntry() == e.target.unitGUID.entry)) + l->push_back(target); + } break; } case SMART_TARGET_GAMEOBJECT_GUID: @@ -3135,18 +3135,18 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* break; } - // xinef: my addition - if (e.target.goGUID.getFromHashMap) - { - if (target = ObjectAccessor::GetGameObject(scriptTrigger ? *scriptTrigger : *GetBaseObject(), MAKE_NEW_GUID(e.target.goGUID.dbGuid, e.target.goGUID.entry, HIGHGUID_GAMEOBJECT))) - l->push_back(target); - } - else - { - target = FindGameObjectNear(scriptTrigger ? scriptTrigger : GetBaseObject(), e.target.goGUID.dbGuid); - if (target && (!e.target.goGUID.entry || target->GetEntry() == e.target.goGUID.entry)) - l->push_back(target); - } + // xinef: my addition + if (e.target.goGUID.getFromHashMap) + { + if (target = ObjectAccessor::GetGameObject(scriptTrigger ? *scriptTrigger : *GetBaseObject(), MAKE_NEW_GUID(e.target.goGUID.dbGuid, e.target.goGUID.entry, HIGHGUID_GAMEOBJECT))) + l->push_back(target); + } + else + { + target = FindGameObjectNear(scriptTrigger ? scriptTrigger : GetBaseObject(), e.target.goGUID.dbGuid); + if (target && (!e.target.goGUID.entry || target->GetEntry() == e.target.goGUID.entry)) + l->push_back(target); + } break; } case SMART_TARGET_PLAYER_RANGE: @@ -3186,7 +3186,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* l->assign(objectList->begin(), objectList->end()); } - // xinef: return l, retardness... what if list is empty? will return empty list instead of null pointer + // xinef: return l, retardness... what if list is empty? will return empty list instead of null pointer break; } case SMART_TARGET_CLOSEST_CREATURE: @@ -3216,28 +3216,28 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* case SMART_TARGET_OWNER_OR_SUMMONER: { if (me) - { + { if (Unit* owner = ObjectAccessor::GetUnit(*me, me->GetCharmerOrOwnerGUID())) l->push_back(owner); - // Xinef: dont add same unit twice - else if (me->IsSummon() && me->ToTempSummon()->GetSummoner()) - l->push_back(me->ToTempSummon()->GetSummoner()); - } - else if (go) - { - if (Unit* owner = ObjectAccessor::GetUnit(*go, go->GetOwnerGUID())) - l->push_back(owner); - } + // Xinef: dont add same unit twice + else if (me->IsSummon() && me->ToTempSummon()->GetSummoner()) + l->push_back(me->ToTempSummon()->GetSummoner()); + } + else if (go) + { + if (Unit* owner = ObjectAccessor::GetUnit(*go, go->GetOwnerGUID())) + l->push_back(owner); + } - // xinef: Get owner of owner - if (e.target.owner.useCharmerOrOwner && !l->empty()) - { - Unit* owner = l->front()->ToUnit(); - l->clear(); + // xinef: Get owner of owner + if (e.target.owner.useCharmerOrOwner && !l->empty()) + { + Unit* owner = l->front()->ToUnit(); + l->clear(); - if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->GetCharmerOrOwnerGUID())) - l->push_back(base); - } + if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->GetCharmerOrOwnerGUID())) + l->push_back(base); + } break; } case SMART_TARGET_THREAT_LIST: @@ -3247,9 +3247,9 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i) if (Unit* temp = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) - // Xinef: added distance check - if (e.target.hostilRandom.maxDist == 0 || me->IsWithinCombatRange(temp, (float)e.target.hostilRandom.maxDist)) - l->push_back(temp); + // Xinef: added distance check + if (e.target.hostilRandom.maxDist == 0 || me->IsWithinCombatRange(temp, (float)e.target.hostilRandom.maxDist)) + l->push_back(temp); } break; } @@ -3371,8 +3371,8 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui if (me->IsInRange(me->GetVictim(), (float)e.event.minMaxRepeat.min, (float)e.event.minMaxRepeat.max)) ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->GetVictim()); - else // xinef: make it predictable - RecalcTimer(e, 500, 500); + else // xinef: make it predictable + RecalcTimer(e, 500, 500); break; } case SMART_EVENT_VICTIM_CASTING: @@ -3400,11 +3400,11 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui Unit* target = DoSelectLowestHpFriendly((float)e.event.friendlyHealth.radius, e.event.friendlyHealth.hpDeficit); if (!target || !target->IsInCombat()) - { - // Xinef: if there are at least two same npcs, they will perform the same action immediately even if this is useless... - RecalcTimer(e, 1000, 3000); + { + // Xinef: if there are at least two same npcs, they will perform the same action immediately even if this is useless... + RecalcTimer(e, 1000, 3000); return; - } + } ProcessTimedAction(e, e.event.friendlyHealth.repeatMin, e.event.friendlyHealth.repeatMax, target); break; } @@ -3416,12 +3416,12 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui std::list pList; DoFindFriendlyCC(pList, (float)e.event.friendlyCC.radius); if (pList.empty()) - { - // Xinef: if there are at least two same npcs, they will perform the same action immediately even if this is useless... - RecalcTimer(e, 1000, 3000); + { + // Xinef: if there are at least two same npcs, they will perform the same action immediately even if this is useless... + RecalcTimer(e, 1000, 3000); return; - } - ProcessTimedAction(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax, Trinity::Containers::SelectRandomContainerElement(pList)); + } + ProcessTimedAction(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax, Trinity::Containers::SelectRandomContainerElement(pList)); break; } case SMART_EVENT_FRIENDLY_MISSING_BUFF: @@ -3477,10 +3477,10 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui case SMART_EVENT_ON_SPELLCLICK: ProcessAction(e, unit, var0, var1, bvar, spell, gob); break; - // Xinef: added no report use distinction for gameobjects + // Xinef: added no report use distinction for gameobjects case SMART_EVENT_GOSSIP_HELLO: - if (e.event.gossipHello.noReportUse && var0) - return; + if (e.event.gossipHello.noReportUse && var0) + return; ProcessAction(e, unit, var0, var1, bvar, spell, gob); break; case SMART_EVENT_IS_BEHIND_TARGET: @@ -3625,7 +3625,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui break; } case SMART_EVENT_SUMMON_DESPAWNED: - { + { if (e.event.summoned.creature && e.event.summoned.creature != var0) return; RecalcTimer(e, e.event.summoned.cooldownMin, e.event.summoned.cooldownMax); @@ -3715,7 +3715,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui ProcessAction(e, unit, var0, var1); break; } - case SMART_EVENT_GO_EVENT_INFORM: + case SMART_EVENT_GO_EVENT_INFORM: { if (e.event.eventInform.eventId != var0) return; @@ -3842,9 +3842,9 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui } case SMART_EVENT_COUNTER_SET: if (e.event.counter.id != var0 || GetCounterValue(e.event.counter.id) != e.event.counter.value) - return; + return; - ProcessTimedAction(e, e.event.counter.cooldownMin, e.event.counter.cooldownMax); + ProcessTimedAction(e, e.event.counter.cooldownMin, e.event.counter.cooldownMax); break; default: sLog->outErrorDb("SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType()); @@ -3983,14 +3983,14 @@ void SmartScript::OnUpdate(uint32 const diff) UpdateTimer(*i, diff); if (!mStoredEvents.empty()) - { - SmartAIEventStoredList::iterator i, icurr; + { + SmartAIEventStoredList::iterator i, icurr; for (i = mStoredEvents.begin(); i != mStoredEvents.end();) - { - icurr = i++; + { + icurr = i++; UpdateTimer(*icurr, diff); - } - } + } + } bool needCleanup = true; if (!mTimedActionList.empty()) @@ -4015,8 +4015,8 @@ void SmartScript::OnUpdate(uint32 const diff) for (std::list::const_iterator i = mRemIDs.begin(); i != mRemIDs.end(); ++i) RemoveStoredEvent(*i); - // xinef: clear list after cleaning... - mRemIDs.clear(); + // xinef: clear list after cleaning... + mRemIDs.clear(); } if (mUseTextTimer && me) { @@ -4127,38 +4127,38 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at) GetScript();//load copy of script - const SpellInfo* spellInfo = NULL; - uint32 maxDisableDist = 0; - uint32 minEnableDist = 0; + const SpellInfo* spellInfo = NULL; + uint32 maxDisableDist = 0; + uint32 minEnableDist = 0; for (SmartAIEventList::iterator i = mEvents.begin(); i != mEvents.end(); ++i) - { + { InitTimer((*i));//calculate timers for first time use - if (i->GetEventType() == SMART_EVENT_RANGE && i->GetActionType() == SMART_ACTION_ALLOW_COMBAT_MOVEMENT) - { - if (i->action.combatMove.move == 1 && i->event.minMaxRepeat.min > minEnableDist) - minEnableDist = i->event.minMaxRepeat.min; - else if (i->action.combatMove.move == 0 && (i->event.minMaxRepeat.max < maxDisableDist || maxDisableDist == 0)) - maxDisableDist = i->event.minMaxRepeat.max; - } + if (i->GetEventType() == SMART_EVENT_RANGE && i->GetActionType() == SMART_ACTION_ALLOW_COMBAT_MOVEMENT) + { + if (i->action.combatMove.move == 1 && i->event.minMaxRepeat.min > minEnableDist) + minEnableDist = i->event.minMaxRepeat.min; + else if (i->action.combatMove.move == 0 && (i->event.minMaxRepeat.max < maxDisableDist || maxDisableDist == 0)) + maxDisableDist = i->event.minMaxRepeat.max; + } - // Xinef: if smartcast combat move flag is present - if (i->GetActionType() == SMART_ACTION_CAST && (i->action.cast.flags & SMARTCAST_COMBAT_MOVE)) - { - if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(i->action.cast.spell)) - { - float maxRange = spellInfo->GetMaxRange(spellInfo->IsPositive()); - float minRange = spellInfo->GetMinRange(spellInfo->IsPositive()); + // Xinef: if smartcast combat move flag is present + if (i->GetActionType() == SMART_ACTION_CAST && (i->action.cast.flags & SMARTCAST_COMBAT_MOVE)) + { + if (const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(i->action.cast.spell)) + { + float maxRange = spellInfo->GetMaxRange(spellInfo->IsPositive()); + float minRange = spellInfo->GetMinRange(spellInfo->IsPositive()); - if (maxRange > 0 && minRange <= maxRange) - { - smartCasterMaxDist = minRange + ((maxRange - minRange) * 0.65f); - smartCasterPowerType = (Powers)spellInfo->PowerType; - } - } - } - } - if (maxDisableDist > 0 && minEnableDist >= maxDisableDist) - mMaxCombatDist = uint32(maxDisableDist + ((minEnableDist - maxDisableDist) / 2)); + if (maxRange > 0 && minRange <= maxRange) + { + smartCasterMaxDist = minRange + ((maxRange - minRange) * 0.65f); + smartCasterPowerType = (Powers)spellInfo->PowerType; + } + } + } + } + if (maxDisableDist > 0 && minEnableDist >= maxDisableDist) + mMaxCombatDist = uint32(maxDisableDist + ((minEnableDist - maxDisableDist) / 2)); ProcessEventsFor(SMART_EVENT_AI_INIT); InstallEvents(); @@ -4227,7 +4227,7 @@ Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) Trinity::MostHPMissingInRange u_check(me, range, MinHPDiff); Trinity::UnitLastSearcher searcher(me, unit, u_check); - me->VisitNearbyObject(range, searcher); + me->VisitNearbyObject(range, searcher); return unit; } @@ -4238,7 +4238,7 @@ void SmartScript::DoFindFriendlyCC(std::list& _list, float range) Trinity::FriendlyCCedInRange u_check(me, range); Trinity::CreatureListSearcher searcher(me, _list, u_check); - me->VisitNearbyObject(range, searcher); + me->VisitNearbyObject(range, searcher); } void SmartScript::DoFindFriendlyMissingBuff(std::list& list, float range, uint32 spellid) @@ -4248,7 +4248,7 @@ void SmartScript::DoFindFriendlyMissingBuff(std::list& list, float ra Trinity::FriendlyMissingBuffInRange u_check(me, range, spellid); Trinity::CreatureListSearcher searcher(me, list, u_check); - me->VisitNearbyObject(range, searcher); + me->VisitNearbyObject(range, searcher); } Unit* SmartScript::DoFindClosestFriendlyInRange(float range, bool playerOnly) @@ -4294,11 +4294,11 @@ void SmartScript::SetScript9(SmartScriptHolder& e, uint32 entry) Unit* SmartScript::GetLastInvoker(Unit* invoker) { - // Xinef: Look for invoker only on map of base object... Prevents multithreaded crashes - if (GetBaseObject()) - return ObjectAccessor::GetUnit(*GetBaseObject(), mLastInvoker); - // xinef: used for area triggers invoker cast - else if (invoker) - return ObjectAccessor::GetUnit(*invoker, mLastInvoker); - return NULL; + // Xinef: Look for invoker only on map of base object... Prevents multithreaded crashes + if (GetBaseObject()) + return ObjectAccessor::GetUnit(*GetBaseObject(), mLastInvoker); + // xinef: used for area triggers invoker cast + else if (invoker) + return ObjectAccessor::GetUnit(*invoker, mLastInvoker); + return NULL; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index 1d76cb458..cd29d23b0 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -152,11 +152,11 @@ class SmartScript { if (reset == 0) itr->second += value; - else - itr->second = value; + else + itr->second = value; } - else - mCounterList.insert(std::make_pair(id, value)); + else + mCounterList.insert(std::make_pair(id, value)); ProcessEventsFor(SMART_EVENT_COUNTER_SET, NULL, id); } @@ -232,42 +232,42 @@ class SmartScript typedef UNORDERED_MAP CounterMap; CounterMap mCounterList; - // Xinef: Fix Combat Movement - void SetActualCombatDist(uint32 dist) { mActualCombatDist = dist; } - void RestoreMaxCombatDist() { mActualCombatDist = mMaxCombatDist; } - uint32 GetActualCombatDist() const { return mActualCombatDist; } - uint32 GetMaxCombatDist() const { return mMaxCombatDist; } + // Xinef: Fix Combat Movement + void SetActualCombatDist(uint32 dist) { mActualCombatDist = dist; } + void RestoreMaxCombatDist() { mActualCombatDist = mMaxCombatDist; } + uint32 GetActualCombatDist() const { return mActualCombatDist; } + uint32 GetMaxCombatDist() const { return mMaxCombatDist; } - // Xinef: SmartCasterAI, replace above - void SetCasterActualDist(float dist) { smartCasterActualDist = dist; } - void RestoreCasterMaxDist() { smartCasterActualDist = smartCasterMaxDist; } - Powers GetCasterPowerType() const { return smartCasterPowerType; } - float GetCasterActualDist() const { return smartCasterActualDist; } - float GetCasterMaxDist() const { return smartCasterMaxDist; } + // Xinef: SmartCasterAI, replace above + void SetCasterActualDist(float dist) { smartCasterActualDist = dist; } + void RestoreCasterMaxDist() { smartCasterActualDist = smartCasterMaxDist; } + Powers GetCasterPowerType() const { return smartCasterPowerType; } + float GetCasterActualDist() const { return smartCasterActualDist; } + float GetCasterMaxDist() const { return smartCasterMaxDist; } - bool AllowPhaseReset() const { return _allowPhaseReset; } - void SetPhaseReset(bool allow) { _allowPhaseReset = allow; } + bool AllowPhaseReset() const { return _allowPhaseReset; } + void SetPhaseReset(bool allow) { _allowPhaseReset = allow; } private: void IncPhase(uint32 p) - { - // Xinef: protect phase from overflowing - mEventPhase = std::min(SMART_EVENT_PHASE_12, mEventPhase + p); - } + { + // Xinef: protect phase from overflowing + mEventPhase = std::min(SMART_EVENT_PHASE_12, mEventPhase + p); + } void DecPhase(uint32 p) - { - if (p >= mEventPhase) - mEventPhase = 0; - else - mEventPhase -= p; - } + { + if (p >= mEventPhase) + mEventPhase = 0; + else + mEventPhase -= p; + } bool IsInPhase(uint32 p) const - { - if (mEventPhase == 0) - return false; - return (1 << (mEventPhase - 1)) & p; - } + { + if (mEventPhase == 0) + return false; + return (1 << (mEventPhase - 1)) & p; + } void SetPhase(uint32 p = 0) { mEventPhase = p; } SmartAIEventList mEvents; @@ -292,17 +292,17 @@ class SmartScript uint32 mTalkerEntry; bool mUseTextTimer; - // Xinef: Fix Combat Movement - uint32 mActualCombatDist; - uint32 mMaxCombatDist; + // Xinef: Fix Combat Movement + uint32 mActualCombatDist; + uint32 mMaxCombatDist; - // Xinef: SmartCasterAI, replace above in future - uint32 smartCasterActualDist; - uint32 smartCasterMaxDist; - Powers smartCasterPowerType; + // Xinef: SmartCasterAI, replace above in future + uint32 smartCasterActualDist; + uint32 smartCasterMaxDist; + Powers smartCasterPowerType; - // Xinef: misc - bool _allowPhaseReset; + // Xinef: misc + bool _allowPhaseReset; SMARTAI_TEMPLATE mTemplate; void InstallEvents(); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 1185dcfb8..ab3273424 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -241,19 +241,19 @@ void SmartAIMgr::LoadSmartAIFromDB() break; case SMART_EVENT_VICTIM_CASTING: case SMART_EVENT_IS_BEHIND_TARGET: - if (temp.event.minMaxRepeat.min == 0 && temp.event.minMaxRepeat.max == 0) + if (temp.event.minMaxRepeat.min == 0 && temp.event.minMaxRepeat.max == 0) temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE; break; case SMART_EVENT_FRIENDLY_IS_CC: - if (temp.event.friendlyCC.repeatMin == 0 && temp.event.friendlyCC.repeatMax == 0) + if (temp.event.friendlyCC.repeatMin == 0 && temp.event.friendlyCC.repeatMax == 0) temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE; break; } - // xinef: rozpierdol tc, niedojeby ze szok - if (temp.action.type == SMART_ACTION_MOVE_TO_POS) - if (temp.target.type == SMART_TARGET_SELF && (fabs(temp.target.x) > 200.0f || fabs(temp.target.y) > 200.0f || fabs(temp.target.z) > 200.0f)) - temp.target.type = SMART_TARGET_POSITION; + // xinef: rozpierdol tc, niedojeby ze szok + if (temp.action.type == SMART_ACTION_MOVE_TO_POS) + if (temp.target.type == SMART_TARGET_SELF && (fabs(temp.target.x) > 200.0f || fabs(temp.target.y) > 200.0f || fabs(temp.target.z) > 200.0f)) + temp.target.type = SMART_TARGET_POSITION; // creature entry / guid not found in storage, create empty event list for it and increase counters if (mEventMap[source_type].find(temp.entryOrGuid) == mEventMap[source_type].end()) @@ -338,7 +338,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) case SMART_TARGET_CLOSEST_ENEMY: case SMART_TARGET_CLOSEST_FRIENDLY: case SMART_TARGET_STORED: - case SMART_TARGET_FARTHEST: + case SMART_TARGET_FARTHEST: break; default: sLog->outErrorDb("SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); @@ -671,7 +671,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } break; case SMART_EVENT_GO_STATE_CHANGED: - case SMART_EVENT_GO_EVENT_INFORM: + case SMART_EVENT_GO_EVENT_INFORM: case SMART_EVENT_TIMED_EVENT_TRIGGERED: case SMART_EVENT_INSTANCE_PLAYER_ENTER: case SMART_EVENT_TRANSPORT_RELOCATE: @@ -702,7 +702,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_GOSSIP_HELLO: case SMART_EVENT_JUST_CREATED: case SMART_EVENT_FOLLOW_COMPLETED: - case SMART_EVENT_ON_SPELLCLICK: + case SMART_EVENT_ON_SPELLCLICK: break; default: sLog->outErrorDb("SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); @@ -847,7 +847,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } - if (e.action.randomPhase.phase1 == 0 && + if (e.action.randomPhase.phase1 == 0 && e.action.randomPhase.phase2 == 0 && e.action.randomPhase.phase3 == 0 && e.action.randomPhase.phase4 == 0 && @@ -970,13 +970,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_REMOVE_POWER: if (e.action.power.powerType > MAX_POWERS) { - sLog->outError("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType); + sLog->outError("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType); return false; } break; case SMART_ACTION_GAME_EVENT_STOP: { - return false; + return false; uint32 eventId = e.action.gameEventStop.id; GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); @@ -996,7 +996,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } case SMART_ACTION_GAME_EVENT_START: { - return false; + return false; uint32 eventId = e.action.gameEventStart.id; GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); @@ -1033,15 +1033,15 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } break; } - case SMART_ACTION_LOAD_GRID: - { - if (!Trinity::IsValidMapCoord(e.target.x, e.target.y)) - { - sLog->outError("SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid); - return false; - } - break; - } + case SMART_ACTION_LOAD_GRID: + { + if (!Trinity::IsValidMapCoord(e.target.x, e.target.y)) + { + sLog->outError("SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid); + return false; + } + break; + } case SMART_ACTION_START_CLOSEST_WAYPOINT: case SMART_ACTION_FOLLOW: case SMART_ACTION_SET_ORIENTATION: @@ -1105,35 +1105,35 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_SEND_GOSSIP_MENU: case SMART_ACTION_GO_SET_LOOT_STATE: case SMART_ACTION_SEND_TARGET_TO_TARGET: - case SMART_ACTION_SET_HOME_POS: + case SMART_ACTION_SET_HOME_POS: case SMART_ACTION_SET_HEALTH_REGEN: case SMART_ACTION_SET_ROOT: case SMART_ACTION_SET_GO_FLAG: case SMART_ACTION_ADD_GO_FLAG: case SMART_ACTION_REMOVE_GO_FLAG: case SMART_ACTION_SUMMON_CREATURE_GROUP: - case SMART_ACTION_RISE_UP: + case SMART_ACTION_RISE_UP: case SMART_ACTION_MOVE_TO_POS_TARGET: - case SMART_ACTION_SET_GO_STATE: - case SMART_ACTION_EXIT_VEHICLE: - case SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS: - case SMART_ACTION_SET_COMBAT_DISTANCE: - case SMART_ACTION_SET_CASTER_COMBAT_DIST: - case SMART_ACTION_SET_SIGHT_DIST: - case SMART_ACTION_FLEE: - case SMART_ACTION_ADD_THREAT: - case SMART_ACTION_LOAD_EQUIPMENT: - case SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT: - case SMART_ACTION_SET_HOVER: - case SMART_ACTION_ADD_IMMUNITY: - case SMART_ACTION_REMOVE_IMMUNITY: - case SMART_ACTION_SET_COUNTER: - case SMART_ACTION_FALL: - case SMART_ACTION_SET_EVENT_FLAG_RESET: - case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS: - case SMART_ACTION_STOP_MOTION: - case SMART_ACTION_NO_ENVIRONMENT_UPDATE: - case SMART_ACTION_ZONE_UNDER_ATTACK: + case SMART_ACTION_SET_GO_STATE: + case SMART_ACTION_EXIT_VEHICLE: + case SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS: + case SMART_ACTION_SET_COMBAT_DISTANCE: + case SMART_ACTION_SET_CASTER_COMBAT_DIST: + case SMART_ACTION_SET_SIGHT_DIST: + case SMART_ACTION_FLEE: + case SMART_ACTION_ADD_THREAT: + case SMART_ACTION_LOAD_EQUIPMENT: + case SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT: + case SMART_ACTION_SET_HOVER: + case SMART_ACTION_ADD_IMMUNITY: + case SMART_ACTION_REMOVE_IMMUNITY: + case SMART_ACTION_SET_COUNTER: + case SMART_ACTION_FALL: + case SMART_ACTION_SET_EVENT_FLAG_RESET: + case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS: + case SMART_ACTION_STOP_MOTION: + case SMART_ACTION_NO_ENVIRONMENT_UPDATE: + case SMART_ACTION_ZONE_UNDER_ATTACK: break; default: sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 32925601c..4d60d715b 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -57,7 +57,7 @@ enum SMART_EVENT_PHASE SMART_EVENT_PHASE_9 = 9, SMART_EVENT_PHASE_10 = 10, SMART_EVENT_PHASE_11 = 11, - SMART_EVENT_PHASE_12 = 12, + SMART_EVENT_PHASE_12 = 12, SMART_EVENT_PHASE_MAX = 13, SMART_EVENT_PHASE_COUNT = 12 @@ -390,7 +390,7 @@ struct SmartEvent uint32 eventId; } eventInform; - struct + struct { uint32 eventId; } doAction; @@ -554,43 +554,43 @@ enum SMART_ACTION SMART_ACTION_GAME_EVENT_START = 112, // GameEventId SMART_ACTION_START_CLOSEST_WAYPOINT = 113, // wp1, wp2, wp3, wp4, wp5, wp6, wp7 SMART_ACTION_RISE_UP = 114, // distance - // RESERVED = 115, - // RESERVED = 116, - // RESERVED = 117, - // RESERVED = 118, - // RESERVED = 119, - // RESERVED = 120, - // RESERVED = 121, - // RESERVED = 122, - // RESERVED = 123, - // RESERVED = 124, - // RESERVED = 125, - // RESERVED = 126, - // RESERVED = 127, - // RESERVED = 128, - // RESERVED = 129, - // 113! - SMART_ACTION_MOVE_TO_POS_TARGET = 130, // pointId - SMART_ACTION_SET_GO_STATE = 131, // state - SMART_ACTION_EXIT_VEHICLE = 132, // none - SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS = 133, // flags - SMART_ACTION_SET_COMBAT_DISTANCE = 134, // combatDistance - SMART_ACTION_SET_CASTER_COMBAT_DIST = 135, // followDistance, resetToMax - SMART_ACTION_SET_SIGHT_DIST = 136, // sightDistance - SMART_ACTION_FLEE = 137, // fleeTime - SMART_ACTION_ADD_THREAT = 138, // +threat, -threat - SMART_ACTION_LOAD_EQUIPMENT = 139, // id - SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT = 140, // id min range, id max range - SMART_ACTION_SET_HOVER = 141, // 0/1 - SMART_ACTION_ADD_IMMUNITY = 142, // type, id, value - SMART_ACTION_REMOVE_IMMUNITY = 143, // type, id, value - SMART_ACTION_FALL = 144, // - SMART_ACTION_SET_EVENT_FLAG_RESET = 145, // 0/1 - SMART_ACTION_REMOVE_ALL_GAMEOBJECTS = 146, - SMART_ACTION_STOP_MOTION = 147, // stopMoving, movementExpired - SMART_ACTION_NO_ENVIRONMENT_UPDATE = 148, - SMART_ACTION_ZONE_UNDER_ATTACK = 149, - SMART_ACTION_LOAD_GRID = 150, + // RESERVED = 115, + // RESERVED = 116, + // RESERVED = 117, + // RESERVED = 118, + // RESERVED = 119, + // RESERVED = 120, + // RESERVED = 121, + // RESERVED = 122, + // RESERVED = 123, + // RESERVED = 124, + // RESERVED = 125, + // RESERVED = 126, + // RESERVED = 127, + // RESERVED = 128, + // RESERVED = 129, + // 113! + SMART_ACTION_MOVE_TO_POS_TARGET = 130, // pointId + SMART_ACTION_SET_GO_STATE = 131, // state + SMART_ACTION_EXIT_VEHICLE = 132, // none + SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS = 133, // flags + SMART_ACTION_SET_COMBAT_DISTANCE = 134, // combatDistance + SMART_ACTION_SET_CASTER_COMBAT_DIST = 135, // followDistance, resetToMax + SMART_ACTION_SET_SIGHT_DIST = 136, // sightDistance + SMART_ACTION_FLEE = 137, // fleeTime + SMART_ACTION_ADD_THREAT = 138, // +threat, -threat + SMART_ACTION_LOAD_EQUIPMENT = 139, // id + SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT = 140, // id min range, id max range + SMART_ACTION_SET_HOVER = 141, // 0/1 + SMART_ACTION_ADD_IMMUNITY = 142, // type, id, value + SMART_ACTION_REMOVE_IMMUNITY = 143, // type, id, value + SMART_ACTION_FALL = 144, // + SMART_ACTION_SET_EVENT_FLAG_RESET = 145, // 0/1 + SMART_ACTION_REMOVE_ALL_GAMEOBJECTS = 146, + SMART_ACTION_STOP_MOTION = 147, // stopMoving, movementExpired + SMART_ACTION_NO_ENVIRONMENT_UPDATE = 148, + SMART_ACTION_ZONE_UNDER_ATTACK = 149, + SMART_ACTION_LOAD_GRID = 150, SMART_ACTION_END = 151, // ZOMG!, zmienic w sql }; @@ -605,7 +605,7 @@ struct SmartAction { uint32 textGroupID; uint32 duration; - uint32 useTalkTarget; + uint32 useTalkTarget; } talk; struct @@ -668,10 +668,10 @@ struct SmartAction uint32 targetParam3; } crossCast; - struct - { - uint32 alternative; - } activateObject; + struct + { + uint32 alternative; + } activateObject; struct { @@ -679,7 +679,7 @@ struct SmartAction uint32 type; uint32 duration; uint32 attackInvoker; - uint32 attackScriptOwner; + uint32 attackScriptOwner; } summonCreature; struct @@ -742,7 +742,7 @@ struct SmartAction uint32 entry; uint32 credit; uint32 creditType; - uint32 aliveState; + uint32 aliveState; } follow; struct @@ -781,7 +781,7 @@ struct SmartAction { uint32 creature; uint32 team; - uint32 doNotChangeLevel; + uint32 doNotChangeLevel; } updateTemplate; struct @@ -836,7 +836,7 @@ struct SmartAction { uint32 entry; uint32 despawnTime; - uint32 targetsummon; + uint32 targetsummon; } summonGO; struct @@ -890,8 +890,8 @@ struct SmartAction struct { uint32 fly; - uint32 speed; - uint32 disableGravity; + uint32 speed; + uint32 disableGravity; } setFly; struct @@ -995,13 +995,13 @@ struct SmartAction { uint32 speedxy; uint32 speedz; - uint32 selfJump; + uint32 selfJump; } jump; - struct - { - uint32 flag; - } movementFlag; + struct + { + uint32 flag; + } movementFlag; struct { @@ -1017,7 +1017,7 @@ struct SmartAction { uint32 pointId; uint32 transport; - uint32 controlled; + uint32 controlled; } MoveToPos; struct @@ -1057,16 +1057,16 @@ struct SmartAction uint32 flag; } goFlag; - struct - { - uint32 state; - } goState; + struct + { + uint32 state; + } goState; struct { uint32 group; uint32 attackInvoker; - uint32 attackScriptOwner; + uint32 attackScriptOwner; } creatureGroup; struct @@ -1095,61 +1095,61 @@ struct SmartAction uint32 wp6; } closestWaypointFromList; - struct - { - uint32 dist; - } combatDistance; + struct + { + uint32 dist; + } combatDistance; - struct - { - uint32 dist; - } sightDistance; + struct + { + uint32 dist; + } sightDistance; - struct - { - uint32 dist; - uint32 reset; - } casterDistance; + struct + { + uint32 dist; + uint32 reset; + } casterDistance; - struct - { - uint32 spawnPos; - } setHomePos; + struct + { + uint32 spawnPos; + } setHomePos; - struct - { - uint32 id; - uint32 force; - } loadEquipment; + struct + { + uint32 id; + uint32 force; + } loadEquipment; - struct - { - uint32 minId; - uint32 maxId; - } randomTimedEvent; + struct + { + uint32 minId; + uint32 maxId; + } randomTimedEvent; - struct - { - uint32 state; - } setHover; + struct + { + uint32 state; + } setHover; - struct - { - uint32 type; - uint32 id; - uint32 value; - } immunity; + struct + { + uint32 type; + uint32 id; + uint32 value; + } immunity; - struct - { - uint32 quickChange; - } orientation; + struct + { + uint32 quickChange; + } orientation; - struct - { - uint32 stopMovement; - uint32 movementExpired; - } stopMotion; + struct + { + uint32 stopMovement; + uint32 movementExpired; + } stopMotion; //! Note for any new future actions //! All parameters must have type uint32 @@ -1206,20 +1206,20 @@ enum SMARTAI_TARGETS SMART_TARGET_THREAT_LIST = 24, // All units on creature's threat list, maxdist, playerOnly SMART_TARGET_CLOSEST_ENEMY = 25, // maxDist, playerOnly SMART_TARGET_CLOSEST_FRIENDLY = 26, // maxDist, playerOnly - // RESERVED = 27, - // RESERVED = 28, - // RESERVED = 29, - // RESERVED = 30, - // RESERVED = 31, - // RESERVED = 32, - // RESERVED = 33, - // RESERVED = 34, - // RESERVED = 35, - // RESERVED = 36, - // RESERVED = 37, - // RESERVED = 38, - // RESERVED = 39, - SMART_TARGET_FARTHEST = 40, + // RESERVED = 27, + // RESERVED = 28, + // RESERVED = 29, + // RESERVED = 30, + // RESERVED = 31, + // RESERVED = 32, + // RESERVED = 33, + // RESERVED = 34, + // RESERVED = 35, + // RESERVED = 36, + // RESERVED = 37, + // RESERVED = 38, + // RESERVED = 39, + SMART_TARGET_FARTHEST = 40, SMART_TARGET_END = 41 }; @@ -1232,7 +1232,7 @@ struct SmartTarget raw.param1 = p1; raw.param2 = p2; raw.param3 = p3; - raw.param4 = p4; + raw.param4 = p4; x = 0.0f; y = 0.0f; z = 0.0f; @@ -1242,19 +1242,19 @@ struct SmartTarget float x, y, z, o; union { - // Xinef: allow random selectors to limit distance - struct + // Xinef: allow random selectors to limit distance + struct { uint32 maxDist; - uint32 playerOnly; - uint32 powerType; + uint32 playerOnly; + uint32 powerType; } hostilRandom; - struct + struct { uint32 maxDist; - uint32 playerOnly; - uint32 isInLos; + uint32 playerOnly; + uint32 isInLos; } farthest; struct @@ -1262,21 +1262,21 @@ struct SmartTarget uint32 creature; uint32 minDist; uint32 maxDist; - uint32 livingState; + uint32 livingState; } unitRange; struct { uint32 dbGuid; uint32 entry; - uint32 getFromHashMap; // Does not work in instances + uint32 getFromHashMap; // Does not work in instances } unitGUID; struct { uint32 creature; uint32 dist; - uint32 livingState; + uint32 livingState; } unitDistance; struct @@ -1307,7 +1307,7 @@ struct SmartTarget { uint32 dbGuid; uint32 entry; - uint32 getFromHashMap; // Does not work in instances + uint32 getFromHashMap; // Does not work in instances } goGUID; struct @@ -1321,10 +1321,10 @@ struct SmartTarget uint32 map; } position; - struct - { - uint32 useCharmerOrOwner; - } owner; + struct + { + uint32 useCharmerOrOwner; + } owner; struct { @@ -1350,7 +1350,7 @@ struct SmartTarget uint32 param1; uint32 param2; uint32 param3; - uint32 param4; + uint32 param4; } raw; }; }; @@ -1476,7 +1476,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] = {SMART_EVENT_JUST_CREATED, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GOSSIP_HELLO, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_FOLLOW_COMPLETED, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_UNUSED_66, 0}, + {SMART_EVENT_UNUSED_66, 0}, {SMART_EVENT_IS_BEHIND_TARGET, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_GAME_EVENT_START, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_GAME_EVENT_END, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 9a952c7fd..45af83d56 100644 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -27,276 +27,276 @@ namespace AccountMgr { - AccountOpResult CreateAccount(std::string username, std::string password) - { - if (utf8length(username) > MAX_ACCOUNT_STR) - return AOR_NAME_TOO_LONG; // username's too long + AccountOpResult CreateAccount(std::string username, std::string password) + { + if (utf8length(username) > MAX_ACCOUNT_STR) + return AOR_NAME_TOO_LONG; // username's too long - normalizeString(username); - normalizeString(password); + normalizeString(username); + normalizeString(password); - if (GetId(username)) - return AOR_NAME_ALREDY_EXIST; // username does already exist + if (GetId(username)) + return AOR_NAME_ALREDY_EXIST; // username does already exist - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT); - stmt->setString(0, username); - stmt->setString(1, CalculateShaPassHash(username, password)); + stmt->setString(0, username); + stmt->setString(1, CalculateShaPassHash(username, password)); - LoginDatabase.Execute(stmt); + LoginDatabase.Execute(stmt); - stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS_INIT); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS_INIT); - LoginDatabase.Execute(stmt); + LoginDatabase.Execute(stmt); - return AOR_OK; // everything's fine - } + return AOR_OK; // everything's fine + } - AccountOpResult DeleteAccount(uint32 accountId) - { - // Check if accounts exists - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_ID); - stmt->setUInt32(0, accountId); - PreparedQueryResult result = LoginDatabase.Query(stmt); + AccountOpResult DeleteAccount(uint32 accountId) + { + // Check if accounts exists + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_ID); + stmt->setUInt32(0, accountId); + PreparedQueryResult result = LoginDatabase.Query(stmt); - if (!result) - return AOR_NAME_NOT_EXIST; + if (!result) + return AOR_NAME_NOT_EXIST; - // Obtain accounts characters - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARS_BY_ACCOUNT_ID); + // Obtain accounts characters + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARS_BY_ACCOUNT_ID); - stmt->setUInt32(0, accountId); + stmt->setUInt32(0, accountId); - result = CharacterDatabase.Query(stmt); + result = CharacterDatabase.Query(stmt); - if (result) - { - do - { - uint32 guidLow = (*result)[0].GetUInt32(); - uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); + if (result) + { + do + { + uint32 guidLow = (*result)[0].GetUInt32(); + uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); - // Kick if player is online - if (Player* p = ObjectAccessor::FindPlayer(guid)) - { - WorldSession* s = p->GetSession(); - s->KickPlayer(); // mark session to remove at next session list update - s->LogoutPlayer(false); // logout player without waiting next session list update - } + // Kick if player is online + if (Player* p = ObjectAccessor::FindPlayer(guid)) + { + WorldSession* s = p->GetSession(); + s->KickPlayer(); // mark session to remove at next session list update + s->LogoutPlayer(false); // logout player without waiting next session list update + } - Player::DeleteFromDB(guid, accountId, false, true); // no need to update realm characters - } while (result->NextRow()); - } + Player::DeleteFromDB(guid, accountId, false, true); // no need to update realm characters + } while (result->NextRow()); + } - // table realm specific but common for all characters of account for realm - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_TUTORIALS); - stmt->setUInt32(0, accountId); - CharacterDatabase.Execute(stmt); + // table realm specific but common for all characters of account for realm + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_TUTORIALS); + stmt->setUInt32(0, accountId); + CharacterDatabase.Execute(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ACCOUNT_DATA); - stmt->setUInt32(0, accountId); - CharacterDatabase.Execute(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ACCOUNT_DATA); + stmt->setUInt32(0, accountId); + CharacterDatabase.Execute(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_BAN); - stmt->setUInt32(0, accountId); - CharacterDatabase.Execute(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_BAN); + stmt->setUInt32(0, accountId); + CharacterDatabase.Execute(stmt); - SQLTransaction trans = LoginDatabase.BeginTransaction(); + SQLTransaction trans = LoginDatabase.BeginTransaction(); - stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT); - stmt->setUInt32(0, accountId); - trans->Append(stmt); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT); + stmt->setUInt32(0, accountId); + trans->Append(stmt); - stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS); - stmt->setUInt32(0, accountId); - trans->Append(stmt); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS); + stmt->setUInt32(0, accountId); + trans->Append(stmt); - stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS); - stmt->setUInt32(0, accountId); - trans->Append(stmt); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS); + stmt->setUInt32(0, accountId); + trans->Append(stmt); - stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_BANNED); - stmt->setUInt32(0, accountId); - trans->Append(stmt); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_BANNED); + stmt->setUInt32(0, accountId); + trans->Append(stmt); - LoginDatabase.CommitTransaction(trans); + LoginDatabase.CommitTransaction(trans); - return AOR_OK; - } + return AOR_OK; + } - AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword) - { - // Check if accounts exists - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_ID); - stmt->setUInt32(0, accountId); - PreparedQueryResult result = LoginDatabase.Query(stmt); + AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword) + { + // Check if accounts exists + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_ID); + stmt->setUInt32(0, accountId); + PreparedQueryResult result = LoginDatabase.Query(stmt); - if (!result) - return AOR_NAME_NOT_EXIST; + if (!result) + return AOR_NAME_NOT_EXIST; - if (utf8length(newUsername) > MAX_ACCOUNT_STR) - return AOR_NAME_TOO_LONG; + if (utf8length(newUsername) > MAX_ACCOUNT_STR) + return AOR_NAME_TOO_LONG; - if (utf8length(newPassword) > MAX_ACCOUNT_STR) - return AOR_PASS_TOO_LONG; + if (utf8length(newPassword) > MAX_ACCOUNT_STR) + return AOR_PASS_TOO_LONG; - normalizeString(newUsername); - normalizeString(newPassword); + normalizeString(newUsername); + normalizeString(newPassword); - stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_USERNAME); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_USERNAME); - stmt->setString(0, newUsername); - stmt->setString(1, CalculateShaPassHash(newUsername, newPassword)); - stmt->setUInt32(2, accountId); + stmt->setString(0, newUsername); + stmt->setString(1, CalculateShaPassHash(newUsername, newPassword)); + stmt->setUInt32(2, accountId); - LoginDatabase.Execute(stmt); + LoginDatabase.Execute(stmt); - return AOR_OK; - } + return AOR_OK; + } - AccountOpResult ChangePassword(uint32 accountId, std::string newPassword) - { - std::string username; + AccountOpResult ChangePassword(uint32 accountId, std::string newPassword) + { + std::string username; - if (!GetName(accountId, username)) - return AOR_NAME_NOT_EXIST; // account doesn't exist + if (!GetName(accountId, username)) + return AOR_NAME_NOT_EXIST; // account doesn't exist - if (utf8length(newPassword) > MAX_ACCOUNT_STR) - return AOR_PASS_TOO_LONG; + if (utf8length(newPassword) > MAX_ACCOUNT_STR) + return AOR_PASS_TOO_LONG; - normalizeString(username); - normalizeString(newPassword); + normalizeString(username); + normalizeString(newPassword); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_PASSWORD); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_PASSWORD); - stmt->setString(0, CalculateShaPassHash(username, newPassword)); - stmt->setUInt32(1, accountId); + stmt->setString(0, CalculateShaPassHash(username, newPassword)); + stmt->setUInt32(1, accountId); - LoginDatabase.Execute(stmt); + LoginDatabase.Execute(stmt); - return AOR_OK; - } + return AOR_OK; + } - uint32 GetId(std::string const& username) - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ID_BY_USERNAME); - stmt->setString(0, username); - PreparedQueryResult result = LoginDatabase.Query(stmt); + uint32 GetId(std::string const& username) + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ID_BY_USERNAME); + stmt->setString(0, username); + PreparedQueryResult result = LoginDatabase.Query(stmt); - return (result) ? (*result)[0].GetUInt32() : 0; - } + return (result) ? (*result)[0].GetUInt32() : 0; + } - uint32 GetSecurity(uint32 accountId) - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL); - stmt->setUInt32(0, accountId); - PreparedQueryResult result = LoginDatabase.Query(stmt); + uint32 GetSecurity(uint32 accountId) + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL); + stmt->setUInt32(0, accountId); + PreparedQueryResult result = LoginDatabase.Query(stmt); - return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER); - } + return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER); + } - uint32 GetSecurity(uint32 accountId, int32 realmId) - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID); - stmt->setUInt32(0, accountId); - stmt->setInt32(1, realmId); - PreparedQueryResult result = LoginDatabase.Query(stmt); + uint32 GetSecurity(uint32 accountId, int32 realmId) + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID); + stmt->setUInt32(0, accountId); + stmt->setInt32(1, realmId); + PreparedQueryResult result = LoginDatabase.Query(stmt); - return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER); - } + return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER); + } - bool GetName(uint32 accountId, std::string& name) - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_USERNAME_BY_ID); - stmt->setUInt32(0, accountId); - PreparedQueryResult result = LoginDatabase.Query(stmt); + bool GetName(uint32 accountId, std::string& name) + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_USERNAME_BY_ID); + stmt->setUInt32(0, accountId); + PreparedQueryResult result = LoginDatabase.Query(stmt); - if (result) - { - name = (*result)[0].GetString(); - return true; - } + if (result) + { + name = (*result)[0].GetString(); + return true; + } - return false; - } + return false; + } - bool CheckPassword(uint32 accountId, std::string password) - { - std::string username; + bool CheckPassword(uint32 accountId, std::string password) + { + std::string username; - if (!GetName(accountId, username)) - return false; + if (!GetName(accountId, username)) + return false; - normalizeString(username); - normalizeString(password); + normalizeString(username); + normalizeString(password); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_CHECK_PASSWORD); - stmt->setUInt32(0, accountId); - stmt->setString(1, CalculateShaPassHash(username, password)); - PreparedQueryResult result = LoginDatabase.Query(stmt); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_CHECK_PASSWORD); + stmt->setUInt32(0, accountId); + stmt->setString(1, CalculateShaPassHash(username, password)); + PreparedQueryResult result = LoginDatabase.Query(stmt); - return (result) ? true : false; - } + return (result) ? true : false; + } - uint32 GetCharactersCount(uint32 accountId) - { - // check character count - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_SUM_CHARS); - stmt->setUInt32(0, accountId); - PreparedQueryResult result = CharacterDatabase.Query(stmt); + uint32 GetCharactersCount(uint32 accountId) + { + // check character count + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_SUM_CHARS); + stmt->setUInt32(0, accountId); + PreparedQueryResult result = CharacterDatabase.Query(stmt); - return (result) ? (*result)[0].GetUInt64() : 0; - } + return (result) ? (*result)[0].GetUInt64() : 0; + } - bool normalizeString(std::string& utf8String) - { - wchar_t buffer[MAX_ACCOUNT_STR + 1]; + bool normalizeString(std::string& utf8String) + { + wchar_t buffer[MAX_ACCOUNT_STR + 1]; - size_t maxLength = MAX_ACCOUNT_STR; - if (!Utf8toWStr(utf8String, buffer, maxLength)) - return false; + size_t maxLength = MAX_ACCOUNT_STR; + if (!Utf8toWStr(utf8String, buffer, maxLength)) + return false; #ifdef _MSC_VER #pragma warning(disable: 4996) #endif - std::transform(&buffer[0], buffer + maxLength, &buffer[0], wcharToUpperOnlyLatin); + std::transform(&buffer[0], buffer + maxLength, &buffer[0], wcharToUpperOnlyLatin); #ifdef _MSC_VER #pragma warning(default: 4996) #endif - return WStrToUtf8(buffer, maxLength, utf8String); - } + return WStrToUtf8(buffer, maxLength, utf8String); + } - std::string CalculateShaPassHash(std::string const& name, std::string const& password) - { - SHA1Hash sha; - sha.Initialize(); - sha.UpdateData(name); - sha.UpdateData(":"); - sha.UpdateData(password); - sha.Finalize(); + std::string CalculateShaPassHash(std::string const& name, std::string const& password) + { + SHA1Hash sha; + sha.Initialize(); + sha.UpdateData(name); + sha.UpdateData(":"); + sha.UpdateData(password); + sha.Finalize(); - return ByteArrayToHexStr(sha.GetDigest(), sha.GetLength()); - } + return ByteArrayToHexStr(sha.GetDigest(), sha.GetLength()); + } - bool IsPlayerAccount(uint32 gmlevel) - { - return gmlevel == SEC_PLAYER; - } + bool IsPlayerAccount(uint32 gmlevel) + { + return gmlevel == SEC_PLAYER; + } - bool IsGMAccount(uint32 gmlevel) - { - return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE; - } + bool IsGMAccount(uint32 gmlevel) + { + return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE; + } - bool IsAdminAccount(uint32 gmlevel) - { - return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE; - } + bool IsAdminAccount(uint32 gmlevel) + { + return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE; + } - bool IsConsoleAccount(uint32 gmlevel) - { - return gmlevel == SEC_CONSOLE; - } + bool IsConsoleAccount(uint32 gmlevel) + { + return gmlevel == SEC_CONSOLE; + } } // Namespace AccountMgr diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h index 0a17e7da0..4bc954b37 100644 --- a/src/server/game/Accounts/AccountMgr.h +++ b/src/server/game/Accounts/AccountMgr.h @@ -36,10 +36,10 @@ enum AccountOpResult namespace AccountMgr { - AccountOpResult CreateAccount(std::string username, std::string password); - AccountOpResult DeleteAccount(uint32 accountId); - AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword); - AccountOpResult ChangePassword(uint32 accountId, std::string newPassword); + AccountOpResult CreateAccount(std::string username, std::string password); + AccountOpResult DeleteAccount(uint32 accountId); + AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword); + AccountOpResult ChangePassword(uint32 accountId, std::string newPassword); bool CheckPassword(uint32 accountId, std::string password); uint32 GetId(std::string const& username); diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index b3c6f1d53..8430ed027 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -379,14 +379,14 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT: return source->GetMap()->GetPlayersCountExceptGMs() <= map_players.maxcount; case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM: - { + { if (!target || target->GetTypeId() != TYPEID_PLAYER) return false; - // DB data compatibility... - uint32 teamOld = target->ToPlayer()->GetTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE; + // DB data compatibility... + uint32 teamOld = target->ToPlayer()->GetTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE; return teamOld == team.team; - } + } case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK: return Player::GetDrunkenstateByValue(source->GetDrunkValue()) >= DrunkenState(drunk.state); case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY: @@ -500,8 +500,8 @@ void AchievementMgr::Reset() void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete) { AchievementCriteriaEntryList const* achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByCondition(condition, value); - if (!achievementCriteriaList) - return; + if (!achievementCriteriaList) + return; for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList->begin(); i != achievementCriteriaList->end(); ++i) { @@ -569,7 +569,7 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans) stmt->setUInt16(1, iter->first); trans->Append(stmt); - // pussywizard: insert only for (counter != 0) is very important! this is how criteria of completed achievements gets deleted from db (by setting counter to 0); if conflicted during merge - contact me + // pussywizard: insert only for (counter != 0) is very important! this is how criteria of completed achievements gets deleted from db (by setting counter to 0); if conflicted during merge - contact me if (iter->second.counter) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT_PROGRESS); @@ -753,62 +753,62 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if (m_player->IsGameMaster()) return; - AchievementCriteriaEntryList const* achievementCriteriaList = NULL; + AchievementCriteriaEntryList const* achievementCriteriaList = NULL; - switch (type) - { - case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: - case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: - case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: - case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: - case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE: - case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND: - case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: - case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: - case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: - case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: - case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE: - case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA: - case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: - case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: - case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: - case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: - case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: - case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA: - case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: - case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: - case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE: - case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: - case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: - case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: - case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: - case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: - case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: - case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: - case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: - case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE: - if (miscValue1) - { - achievementCriteriaList = sAchievementMgr->GetSpecialAchievementCriteriaByType(type, miscValue1); - break; - } - achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type); - break; - case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: - if (miscValue2) - { - achievementCriteriaList = sAchievementMgr->GetSpecialAchievementCriteriaByType(type, miscValue2); - break; - } - achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type); - break; - default: - achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type); - break; - } + switch (type) + { + case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: + case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: + case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE: + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND: + case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: + case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE: + case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA: + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: + case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: + case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA: + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: + case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: + case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE: + case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: + case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE: + if (miscValue1) + { + achievementCriteriaList = sAchievementMgr->GetSpecialAchievementCriteriaByType(type, miscValue1); + break; + } + achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type); + break; + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: + if (miscValue2) + { + achievementCriteriaList = sAchievementMgr->GetSpecialAchievementCriteriaByType(type, miscValue2); + break; + } + achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type); + break; + default: + achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type); + break; + } - if (!achievementCriteriaList) - return; + if (!achievementCriteriaList) + return; for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList->begin(); i != achievementCriteriaList->end(); ++i) { @@ -848,7 +848,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS:/* FIXME: for online player only currently */ case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED: case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED: - case ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS: + case ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS: // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case if (!miscValue1) continue; @@ -1256,9 +1256,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; // Children's Week achievements have extra requirements - //if (achievement->categoryId == CATEGORY_CHILDRENS_WEEK || achievement->ID == 1291) // Lonely? + //if (achievement->categoryId == CATEGORY_CHILDRENS_WEEK || achievement->ID == 1291) // Lonely? { - // Xinef: skip progress only if data exists and is not meet + // Xinef: skip progress only if data exists and is not meet AchievementCriteriaDataSet const* data = sAchievementMgr->GetCriteriaDataSet(achievementCriteria); if (data && !data->Meets(GetPlayer(), NULL)) continue; @@ -1448,11 +1448,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter) { if (skillIter->second->skillId == achievementCriteria->learn_skillline_spell.skillLine) - { - // xinef: do not add couter twice if by any chance skill is listed twice in dbc (eg. skill 777 and spell 22717) + { + // xinef: do not add couter twice if by any chance skill is listed twice in dbc (eg. skill 777 and spell 22717) ++spellCount; - break; - } + break; + } } } @@ -1508,14 +1508,14 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui { SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellIter->first); for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter) - { + { if (skillIter->second->skillId == achievementCriteria->learn_skill_line.skillLine) - { - // xinef: do not add couter twice if by any chance skill is listed twice in dbc (eg. skill 777 and spell 22717) + { + // xinef: do not add couter twice if by any chance skill is listed twice in dbc (eg. skill 777 and spell 22717) ++spellCount; - break; - } - } + break; + } + } } SetCriteriaProgress(achievementCriteria, spellCount); @@ -1719,24 +1719,24 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve return false; } - // pussywizard: progress will be deleted after getting the achievement (optimization) - // finished achievement should indicate criteria completed, since not finding progress would start some timed achievements and probably other things - if (HasAchieved(achievement->ID)) - { - bool completed = true; + // pussywizard: progress will be deleted after getting the achievement (optimization) + // finished achievement should indicate criteria completed, since not finding progress would start some timed achievements and probably other things + if (HasAchieved(achievement->ID)) + { + bool completed = true; - // completed only after all referenced achievements are also completed - if (AchievementEntryList const* achRefList = sAchievementMgr->GetAchievementByReferencedId(achievement->ID)) + // completed only after all referenced achievements are also completed + if (AchievementEntryList const* achRefList = sAchievementMgr->GetAchievementByReferencedId(achievement->ID)) for (AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr) if (!IsCompletedAchievement(*itr)) - { - completed = false; - break; - } + { + completed = false; + break; + } - if (completed) - return true; - } + if (completed) + return true; + } CriteriaProgress const* progress = GetCriteriaProgress(achievementCriteria); if (!progress) @@ -2000,7 +2000,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, switch (ptype) { case PROGRESS_SET: - case PROGRESS_RESET: + case PROGRESS_RESET: newValue = changeValue; break; case PROGRESS_ACCUMULATE: @@ -2138,28 +2138,28 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) ca.date = time(NULL); ca.changed = true; - // pussywizard: set all progress counters to 0, so progress will be deleted from db during save - { - bool allRefsCompleted = true; - uint32 achiCheckId = achievement->refAchievement ? achievement->refAchievement : achievement->ID; + // pussywizard: set all progress counters to 0, so progress will be deleted from db during save + { + bool allRefsCompleted = true; + uint32 achiCheckId = achievement->refAchievement ? achievement->refAchievement : achievement->ID; - if (AchievementEntryList const* achRefList = sAchievementMgr->GetAchievementByReferencedId(achiCheckId)) - for (AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr) - if (!IsCompletedAchievement(*itr)) - { - allRefsCompleted = false; - break; - } + if (AchievementEntryList const* achRefList = sAchievementMgr->GetAchievementByReferencedId(achiCheckId)) + for (AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr) + if (!IsCompletedAchievement(*itr)) + { + allRefsCompleted = false; + break; + } - if (allRefsCompleted) - if (AchievementCriteriaEntryList const* cList = sAchievementMgr->GetAchievementCriteriaByAchievement(achiCheckId)) - for (AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr) - if (CriteriaProgress* progress = GetCriteriaProgress(*itr)) - { - progress->changed = true; - progress->counter = 0; - } - } + if (allRefsCompleted) + if (AchievementCriteriaEntryList const* cList = sAchievementMgr->GetAchievementCriteriaByAchievement(achiCheckId)) + for (AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr) + if (CriteriaProgress* progress = GetCriteriaProgress(*itr)) + { + progress->changed = true; + progress->counter = 0; + } + } // don't insert for ACHIEVEMENT_FLAG_REALM_FIRST_KILL since otherwise only the first group member would reach that achievement // TODO: where do set this instead? @@ -2188,10 +2188,10 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) // mail if (reward->sender) { - MailDraft draft(reward->mailTemplate); + MailDraft draft(reward->mailTemplate); if (!reward->mailTemplate) - draft = MailDraft(reward->subject, reward->text); + draft = MailDraft(reward->subject, reward->text); SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -2230,33 +2230,33 @@ void AchievementMgr::SendRespondInspectAchievements(Player* player) const */ void AchievementMgr::BuildAllDataPacket(WorldPacket* data, bool inspect) const { - if (!m_completedAchievements.empty()) - { - AchievementEntry const* achievement = NULL; - for (CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter) - { - // Skip hidden achievements - achievement = sAchievementStore.LookupEntry(iter->first); - if (!achievement || achievement->flags & ACHIEVEMENT_FLAG_HIDDEN) - continue; + if (!m_completedAchievements.empty()) + { + AchievementEntry const* achievement = NULL; + for (CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter) + { + // Skip hidden achievements + achievement = sAchievementStore.LookupEntry(iter->first); + if (!achievement || achievement->flags & ACHIEVEMENT_FLAG_HIDDEN) + continue; - *data << uint32(iter->first); - data->AppendPackedTime(iter->second.date); - } - } - *data << int32(-1); + *data << uint32(iter->first); + data->AppendPackedTime(iter->second.date); + } + } + *data << int32(-1); - if (!inspect && !m_criteriaProgress.empty()) - for (CriteriaProgressMap::const_iterator iter = m_criteriaProgress.begin(); iter != m_criteriaProgress.end(); ++iter) - { - *data << uint32(iter->first); - data->appendPackGUID(iter->second.counter); - data->append(GetPlayer()->GetPackGUID()); - *data << uint32(0); - data->AppendPackedTime(iter->second.date); - *data << uint32(0); - *data << uint32(0); - } + if (!inspect && !m_criteriaProgress.empty()) + for (CriteriaProgressMap::const_iterator iter = m_criteriaProgress.begin(); iter != m_criteriaProgress.end(); ++iter) + { + *data << uint32(iter->first); + data->appendPackGUID(iter->second.counter); + data->append(GetPlayer()->GetPackGUID()); + *data << uint32(0); + data->AppendPackedTime(iter->second.date); + *data << uint32(0); + *data << uint32(0); + } *data << int32(-1); } @@ -2329,122 +2329,122 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() m_AchievementCriteriaListByAchievement[criteria->referredAchievement].push_back(criteria); if (criteria->additionalRequirements[0].additionalRequirement_type != ACHIEVEMENT_CRITERIA_CONDITION_NONE) - m_AchievementCriteriasByCondition[criteria->additionalRequirements[0].additionalRequirement_type][criteria->additionalRequirements[0].additionalRequirement_value].push_back(criteria); - if (criteria->additionalRequirements[1].additionalRequirement_type != ACHIEVEMENT_CRITERIA_CONDITION_NONE && - criteria->additionalRequirements[1].additionalRequirement_type != criteria->additionalRequirements[0].additionalRequirement_type) - m_AchievementCriteriasByCondition[criteria->additionalRequirements[1].additionalRequirement_type][criteria->additionalRequirements[1].additionalRequirement_value].push_back(criteria); + m_AchievementCriteriasByCondition[criteria->additionalRequirements[0].additionalRequirement_type][criteria->additionalRequirements[0].additionalRequirement_value].push_back(criteria); + if (criteria->additionalRequirements[1].additionalRequirement_type != ACHIEVEMENT_CRITERIA_CONDITION_NONE && + criteria->additionalRequirements[1].additionalRequirement_type != criteria->additionalRequirements[0].additionalRequirement_type) + m_AchievementCriteriasByCondition[criteria->additionalRequirements[1].additionalRequirement_type][criteria->additionalRequirements[1].additionalRequirement_value].push_back(criteria); - switch (criteria->requiredType) - { - case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: - m_SpecialList[criteria->requiredType][criteria->kill_creature.creatureID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: - m_SpecialList[criteria->requiredType][criteria->win_bg.bgMapID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: - m_SpecialList[criteria->requiredType][criteria->reach_skill_level.skillID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: - m_SpecialList[criteria->requiredType][criteria->complete_achievement.linkedAchievement].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE: - m_SpecialList[criteria->requiredType][criteria->complete_quests_in_zone.zoneID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND: - m_SpecialList[criteria->requiredType][criteria->complete_battleground.mapID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: - m_SpecialList[criteria->requiredType][criteria->killed_by_creature.creatureEntry].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: - m_SpecialList[criteria->requiredType][criteria->complete_quest.questID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: - m_SpecialList[criteria->requiredType][criteria->be_spell_target.spellID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: - m_SpecialList[criteria->requiredType][criteria->cast_spell.spellID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE: - m_SpecialList[criteria->requiredType][criteria->bg_objective.objectiveId].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA: - m_SpecialList[criteria->requiredType][criteria->honorable_kill_at_area.areaID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: - m_SpecialList[criteria->requiredType][criteria->learn_spell.spellID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: - m_SpecialList[criteria->requiredType][criteria->own_item.itemID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: - m_SpecialList[criteria->requiredType][criteria->learn_skill_level.skillID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: - m_SpecialList[criteria->requiredType][criteria->use_item.itemID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: - m_SpecialList[criteria->requiredType][criteria->own_item.itemID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA: - { - WorldMapOverlayEntry const* worldOverlayEntry = sWorldMapOverlayStore.LookupEntry(criteria->explore_area.areaReference); - if (!worldOverlayEntry) - break; + switch (criteria->requiredType) + { + case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: + m_SpecialList[criteria->requiredType][criteria->kill_creature.creatureID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: + m_SpecialList[criteria->requiredType][criteria->win_bg.bgMapID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: + m_SpecialList[criteria->requiredType][criteria->reach_skill_level.skillID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: + m_SpecialList[criteria->requiredType][criteria->complete_achievement.linkedAchievement].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE: + m_SpecialList[criteria->requiredType][criteria->complete_quests_in_zone.zoneID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND: + m_SpecialList[criteria->requiredType][criteria->complete_battleground.mapID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: + m_SpecialList[criteria->requiredType][criteria->killed_by_creature.creatureEntry].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: + m_SpecialList[criteria->requiredType][criteria->complete_quest.questID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: + m_SpecialList[criteria->requiredType][criteria->be_spell_target.spellID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: + m_SpecialList[criteria->requiredType][criteria->cast_spell.spellID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE: + m_SpecialList[criteria->requiredType][criteria->bg_objective.objectiveId].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA: + m_SpecialList[criteria->requiredType][criteria->honorable_kill_at_area.areaID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: + m_SpecialList[criteria->requiredType][criteria->learn_spell.spellID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: + m_SpecialList[criteria->requiredType][criteria->own_item.itemID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: + m_SpecialList[criteria->requiredType][criteria->learn_skill_level.skillID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: + m_SpecialList[criteria->requiredType][criteria->use_item.itemID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: + m_SpecialList[criteria->requiredType][criteria->own_item.itemID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA: + { + WorldMapOverlayEntry const* worldOverlayEntry = sWorldMapOverlayStore.LookupEntry(criteria->explore_area.areaReference); + if (!worldOverlayEntry) + break; - for (uint8 j = 0; j < MAX_WORLD_MAP_OVERLAY_AREA_IDX; ++j) - if (worldOverlayEntry->areatableID[j]) - { - bool valid = true; - for (uint8 i=0; iareatableID[j] == worldOverlayEntry->areatableID[i]) - valid = false; - if (valid) - m_SpecialList[criteria->requiredType][worldOverlayEntry->areatableID[j]].push_back(criteria); - } - } - break; - case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: - m_SpecialList[criteria->requiredType][criteria->gain_reputation.factionID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: - m_SpecialList[criteria->requiredType][criteria->equip_epic_item.itemSlot].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: - m_SpecialList[criteria->requiredType][criteria->hk_class.classID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE: - m_SpecialList[criteria->requiredType][criteria->hk_race.raceID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: - m_SpecialList[criteria->requiredType][criteria->do_emote.emoteID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: - m_SpecialList[criteria->requiredType][criteria->equip_item.itemID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: - m_SpecialList[criteria->requiredType][criteria->use_gameobject.goEntry].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: - m_SpecialList[criteria->requiredType][criteria->be_spell_target.spellID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: - m_SpecialList[criteria->requiredType][criteria->fish_in_gameobject.goEntry].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: - m_SpecialList[criteria->requiredType][criteria->learn_skillline_spell.skillLine].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: - m_SpecialList[criteria->requiredType][criteria->loot_type.lootType].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: - m_SpecialList[criteria->requiredType][criteria->cast_spell.spellID].push_back(criteria); - break; - case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE: - m_SpecialList[criteria->requiredType][criteria->learn_skill_line.skillLine].push_back(criteria); - break; - } + for (uint8 j = 0; j < MAX_WORLD_MAP_OVERLAY_AREA_IDX; ++j) + if (worldOverlayEntry->areatableID[j]) + { + bool valid = true; + for (uint8 i=0; iareatableID[j] == worldOverlayEntry->areatableID[i]) + valid = false; + if (valid) + m_SpecialList[criteria->requiredType][worldOverlayEntry->areatableID[j]].push_back(criteria); + } + } + break; + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: + m_SpecialList[criteria->requiredType][criteria->gain_reputation.factionID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: + m_SpecialList[criteria->requiredType][criteria->equip_epic_item.itemSlot].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: + m_SpecialList[criteria->requiredType][criteria->hk_class.classID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE: + m_SpecialList[criteria->requiredType][criteria->hk_race.raceID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: + m_SpecialList[criteria->requiredType][criteria->do_emote.emoteID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: + m_SpecialList[criteria->requiredType][criteria->equip_item.itemID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: + m_SpecialList[criteria->requiredType][criteria->use_gameobject.goEntry].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: + m_SpecialList[criteria->requiredType][criteria->be_spell_target.spellID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: + m_SpecialList[criteria->requiredType][criteria->fish_in_gameobject.goEntry].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: + m_SpecialList[criteria->requiredType][criteria->learn_skillline_spell.skillLine].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: + m_SpecialList[criteria->requiredType][criteria->loot_type.lootType].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: + m_SpecialList[criteria->requiredType][criteria->cast_spell.spellID].push_back(criteria); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE: + m_SpecialList[criteria->requiredType][criteria->learn_skill_line.skillLine].push_back(criteria); + break; + } if (criteria->timeLimit) m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria); diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h index 536f90fd0..9ad013f76 100644 --- a/src/server/game/Achievements/AchievementMgr.h +++ b/src/server/game/Achievements/AchievementMgr.h @@ -279,7 +279,7 @@ class AchievementMgr void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0); void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); // used for quest and scripted timed achievements - void RemoveCriteriaProgress(AchievementCriteriaEntry const* entry); + void RemoveCriteriaProgress(AchievementCriteriaEntry const* entry); private: enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST, PROGRESS_RESET }; void SendAchievementEarned(AchievementEntry const* achievement) const; @@ -393,9 +393,9 @@ class AchievementGlobalMgr AchievementRewards m_achievementRewards; AchievementRewardLocales m_achievementRewardLocales; - // pussywizard: - std::map m_SpecialList[ACHIEVEMENT_CRITERIA_TYPE_TOTAL]; - std::map m_AchievementCriteriasByCondition[ACHIEVEMENT_CRITERIA_CONDITION_TOTAL]; + // pussywizard: + std::map m_SpecialList[ACHIEVEMENT_CRITERIA_TYPE_TOTAL]; + std::map m_AchievementCriteriasByCondition[ACHIEVEMENT_CRITERIA_CONDITION_TOTAL]; }; #define sAchievementMgr ACE_Singleton::instance() diff --git a/src/server/game/ArenaSpectator/ArenaSpectator.h b/src/server/game/ArenaSpectator/ArenaSpectator.h index 39e5dfa09..994b1d2e2 100644 --- a/src/server/game/ArenaSpectator/ArenaSpectator.h +++ b/src/server/game/ArenaSpectator/ArenaSpectator.h @@ -22,196 +22,196 @@ namespace ArenaSpectator { - template inline void SendCommand(T* o, const char* format, ...) ATTR_PRINTF(2, 3); - inline void CreatePacket(WorldPacket& data, const char* m); - inline void SendPacketTo(const Player* p, const char* m); - inline void SendPacketTo(const Map* map, const char* m); - inline void HandleResetCommand(Player* p); - inline bool ShouldSendAura(Aura* aura, uint8 effMask, uint64 targetGUID, bool remove); + template inline void SendCommand(T* o, const char* format, ...) ATTR_PRINTF(2, 3); + inline void CreatePacket(WorldPacket& data, const char* m); + inline void SendPacketTo(const Player* p, const char* m); + inline void SendPacketTo(const Map* map, const char* m); + inline void HandleResetCommand(Player* p); + inline bool ShouldSendAura(Aura* aura, uint8 effMask, uint64 targetGUID, bool remove); - template inline void SendCommand_String(T* p, uint64 targetGUID, const char* prefix, const std::string& c); - template inline void SendCommand_UInt32Value(T* o, uint64 targetGUID, const char* prefix, uint32 t); - template inline void SendCommand_GUID(T* o, uint64 targetGUID, const char* prefix, uint64 t); - template inline void SendCommand_Spell(T* o, uint64 targetGUID, const char* prefix, uint32 id, int32 casttime); - template inline void SendCommand_Cooldown(T* o, uint64 targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur); - template inline void SendCommand_Aura(T* o, uint64 targetGUID, const char* prefix, uint64 caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove); + template inline void SendCommand_String(T* p, uint64 targetGUID, const char* prefix, const std::string& c); + template inline void SendCommand_UInt32Value(T* o, uint64 targetGUID, const char* prefix, uint32 t); + template inline void SendCommand_GUID(T* o, uint64 targetGUID, const char* prefix, uint64 t); + template inline void SendCommand_Spell(T* o, uint64 targetGUID, const char* prefix, uint32 id, int32 casttime); + template inline void SendCommand_Cooldown(T* o, uint64 targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur); + template inline void SendCommand_Aura(T* o, uint64 targetGUID, const char* prefix, uint64 caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove); - bool HandleSpectatorSpectateCommand(ChatHandler* handler, char const* args); - bool HandleSpectatorWatchCommand(ChatHandler* handler, char const* args); + bool HandleSpectatorSpectateCommand(ChatHandler* handler, char const* args); + bool HandleSpectatorWatchCommand(ChatHandler* handler, char const* args); - // definitions below: + // definitions below: - template - void SendCommand(T* o, const char* format, ...) - { - if (!format) - return; + template + void SendCommand(T* o, const char* format, ...) + { + if (!format) + return; char buffer[SPECTATOR_BUFFER_LEN]; - va_list ap; + va_list ap; va_start(ap, format); vsnprintf(buffer, SPECTATOR_BUFFER_LEN, format, ap); va_end(ap); - SendPacketTo(o, buffer); - } + SendPacketTo(o, buffer); + } - void CreatePacket(WorldPacket& data, const char* m) - { - size_t len = strlen(m); - data.Initialize(SMSG_MESSAGECHAT, 1+4+8+4+8+4+1+len+1); - data << uint8(CHAT_MSG_WHISPER); - data << uint32(LANG_ADDON); - data << uint64(0); - data << uint32(0); - data << uint64(0); - data << uint32(len + 1); - data << m; - data << uint8(0); - } + void CreatePacket(WorldPacket& data, const char* m) + { + size_t len = strlen(m); + data.Initialize(SMSG_MESSAGECHAT, 1+4+8+4+8+4+1+len+1); + data << uint8(CHAT_MSG_WHISPER); + data << uint32(LANG_ADDON); + data << uint64(0); + data << uint32(0); + data << uint64(0); + data << uint32(len + 1); + data << m; + data << uint8(0); + } - void SendPacketTo(const Player* p, const char* m) - { - WorldPacket data; - CreatePacket(data, m); - p->GetSession()->SendPacket(&data); - } + void SendPacketTo(const Player* p, const char* m) + { + WorldPacket data; + CreatePacket(data, m); + p->GetSession()->SendPacket(&data); + } - void SendPacketTo(const Map* map, const char* m) - { - if (!map->IsBattleArena()) - return; - Battleground* bg = ((BattlegroundMap*)map)->GetBG(); - if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS) - return; - WorldPacket data; - CreatePacket(data, m); - bg->SpectatorsSendPacket(data); - } + void SendPacketTo(const Map* map, const char* m) + { + if (!map->IsBattleArena()) + return; + Battleground* bg = ((BattlegroundMap*)map)->GetBG(); + if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS) + return; + WorldPacket data; + CreatePacket(data, m); + bg->SpectatorsSendPacket(data); + } - template - void SendCommand_String(T* o, uint64 targetGUID, const char* prefix, const char* c) - { - if (!IS_PLAYER_GUID(targetGUID)) - return; - SendCommand(o, "%s0x%016llX;%s=%s;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, c); - } + template + void SendCommand_String(T* o, uint64 targetGUID, const char* prefix, const char* c) + { + if (!IS_PLAYER_GUID(targetGUID)) + return; + SendCommand(o, "%s0x%016llX;%s=%s;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, c); + } - template - void SendCommand_UInt32Value(T* o, uint64 targetGUID, const char* prefix, uint32 t) - { - if (!IS_PLAYER_GUID(targetGUID)) - return; - SendCommand(o, "%s0x%016llX;%s=%u;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, t); - } + template + void SendCommand_UInt32Value(T* o, uint64 targetGUID, const char* prefix, uint32 t) + { + if (!IS_PLAYER_GUID(targetGUID)) + return; + SendCommand(o, "%s0x%016llX;%s=%u;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, t); + } - template - void SendCommand_GUID(T* o, uint64 targetGUID, const char* prefix, uint64 t) - { - if (!IS_PLAYER_GUID(targetGUID)) - return; - SendCommand(o, "%s0x%016llX;%s=0x%016llX;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, t); - } + template + void SendCommand_GUID(T* o, uint64 targetGUID, const char* prefix, uint64 t) + { + if (!IS_PLAYER_GUID(targetGUID)) + return; + SendCommand(o, "%s0x%016llX;%s=0x%016llX;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, t); + } - template - void SendCommand_Spell(T* o, uint64 targetGUID, const char* prefix, uint32 id, int32 casttime) - { - if (!IS_PLAYER_GUID(targetGUID)) - return; - SendCommand(o, "%s0x%016llX;%s=%u,%i;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, id, casttime); - } + template + void SendCommand_Spell(T* o, uint64 targetGUID, const char* prefix, uint32 id, int32 casttime) + { + if (!IS_PLAYER_GUID(targetGUID)) + return; + SendCommand(o, "%s0x%016llX;%s=%u,%i;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, id, casttime); + } - template - void SendCommand_Cooldown(T* o, uint64 targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur) - { - if (!IS_PLAYER_GUID(targetGUID)) - return; - if (const SpellInfo* si = sSpellMgr->GetSpellInfo(id)) - if (si->SpellIconID == 1) - return; - SendCommand(o, "%s0x%016llX;%s=%u,%u,%u;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, id, dur, maxdur); - } + template + void SendCommand_Cooldown(T* o, uint64 targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur) + { + if (!IS_PLAYER_GUID(targetGUID)) + return; + if (const SpellInfo* si = sSpellMgr->GetSpellInfo(id)) + if (si->SpellIconID == 1) + return; + SendCommand(o, "%s0x%016llX;%s=%u,%u,%u;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, id, dur, maxdur); + } - template - void SendCommand_Aura(T* o, uint64 targetGUID, const char* prefix, uint64 caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove) - { - if (!IS_PLAYER_GUID(targetGUID)) - return; - SendCommand(o, "%s0x%016llX;%s=%u,%u,%i,%i,%u,%u,%u,0x%016llX;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, remove ? 1 : 0, stack, dur, maxdur, id, dispel, isDebuff ? 1 : 0, caster); - } + template + void SendCommand_Aura(T* o, uint64 targetGUID, const char* prefix, uint64 caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove) + { + if (!IS_PLAYER_GUID(targetGUID)) + return; + SendCommand(o, "%s0x%016llX;%s=%u,%u,%i,%i,%u,%u,%u,0x%016llX;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, remove ? 1 : 0, stack, dur, maxdur, id, dispel, isDebuff ? 1 : 0, caster); + } - void HandleResetCommand(Player* p) - { - if (!p->FindMap() || !p->IsInWorld() || !p->FindMap()->IsBattleArena()) - return; - Battleground* bg = ((BattlegroundMap*)p->FindMap())->GetBG(); - if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS) - return; - Battleground::BattlegroundPlayerMap const& pl = bg->GetPlayers(); - for (Battleground::BattlegroundPlayerMap::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - { - if (p->HasReceivedSpectatorResetFor(GUID_LOPART(itr->first))) - continue; + void HandleResetCommand(Player* p) + { + if (!p->FindMap() || !p->IsInWorld() || !p->FindMap()->IsBattleArena()) + return; + Battleground* bg = ((BattlegroundMap*)p->FindMap())->GetBG(); + if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS) + return; + Battleground::BattlegroundPlayerMap const& pl = bg->GetPlayers(); + for (Battleground::BattlegroundPlayerMap::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + { + if (p->HasReceivedSpectatorResetFor(GUID_LOPART(itr->first))) + continue; - Player* plr = itr->second; - p->AddReceivedSpectatorResetFor(GUID_LOPART(itr->first)); + Player* plr = itr->second; + p->AddReceivedSpectatorResetFor(GUID_LOPART(itr->first)); - SendCommand_String(p, itr->first, "NME", plr->GetName().c_str()); - // Xinef: addon compatibility - SendCommand_UInt32Value(p, itr->first, "TEM", plr->GetBgTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE); - SendCommand_UInt32Value(p, itr->first, "CLA", plr->getClass()); - SendCommand_UInt32Value(p, itr->first, "MHP", plr->GetMaxHealth()); - SendCommand_UInt32Value(p, itr->first, "CHP", plr->GetHealth()); - SendCommand_UInt32Value(p, itr->first, "STA", plr->IsAlive() ? 1 : 0); - Powers ptype = plr->getPowerType(); - SendCommand_UInt32Value(p, itr->first, "PWT", ptype); - SendCommand_UInt32Value(p, itr->first, "MPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetMaxPower(ptype)/10 : plr->GetMaxPower(ptype)); - SendCommand_UInt32Value(p, itr->first, "CPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetPower(ptype)/10 : plr->GetPower(ptype)); - Pet* pet = plr->GetPet(); - SendCommand_UInt32Value(p, itr->first, "PHP", pet && pet->GetCreatureTemplate()->family ? (uint32)pet->GetHealthPct() : 0); - SendCommand_UInt32Value(p, itr->first, "PET", pet ? pet->GetCreatureTemplate()->family : 0); - SendCommand_GUID(p, itr->first, "TRG", plr->GetTarget()); - SendCommand_UInt32Value(p, itr->first, "RES", 1); - SendCommand_UInt32Value(p, itr->first, "CDC", 1); - SendCommand_UInt32Value(p, itr->first, "TIM", (bg->GetStartTime() < 46*MINUTE*IN_MILLISECONDS) ? (46*MINUTE*IN_MILLISECONDS-bg->GetStartTime())/IN_MILLISECONDS : 0); - // "SPE" not here (only possible to send starting a new cast) + SendCommand_String(p, itr->first, "NME", plr->GetName().c_str()); + // Xinef: addon compatibility + SendCommand_UInt32Value(p, itr->first, "TEM", plr->GetBgTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE); + SendCommand_UInt32Value(p, itr->first, "CLA", plr->getClass()); + SendCommand_UInt32Value(p, itr->first, "MHP", plr->GetMaxHealth()); + SendCommand_UInt32Value(p, itr->first, "CHP", plr->GetHealth()); + SendCommand_UInt32Value(p, itr->first, "STA", plr->IsAlive() ? 1 : 0); + Powers ptype = plr->getPowerType(); + SendCommand_UInt32Value(p, itr->first, "PWT", ptype); + SendCommand_UInt32Value(p, itr->first, "MPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetMaxPower(ptype)/10 : plr->GetMaxPower(ptype)); + SendCommand_UInt32Value(p, itr->first, "CPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetPower(ptype)/10 : plr->GetPower(ptype)); + Pet* pet = plr->GetPet(); + SendCommand_UInt32Value(p, itr->first, "PHP", pet && pet->GetCreatureTemplate()->family ? (uint32)pet->GetHealthPct() : 0); + SendCommand_UInt32Value(p, itr->first, "PET", pet ? pet->GetCreatureTemplate()->family : 0); + SendCommand_GUID(p, itr->first, "TRG", plr->GetTarget()); + SendCommand_UInt32Value(p, itr->first, "RES", 1); + SendCommand_UInt32Value(p, itr->first, "CDC", 1); + SendCommand_UInt32Value(p, itr->first, "TIM", (bg->GetStartTime() < 46*MINUTE*IN_MILLISECONDS) ? (46*MINUTE*IN_MILLISECONDS-bg->GetStartTime())/IN_MILLISECONDS : 0); + // "SPE" not here (only possible to send starting a new cast) - // send all "CD" - SpellCooldowns const& sc = plr->GetSpellCooldownMap(); - for (SpellCooldowns::const_iterator itrc = sc.begin(); itrc != sc.end(); ++itrc) - if (itrc->second.sendToSpectator && itrc->second.maxduration >= SPECTATOR_COOLDOWN_MIN*IN_MILLISECONDS && itrc->second.maxduration <= SPECTATOR_COOLDOWN_MAX*IN_MILLISECONDS) - if (uint32 cd = (getMSTimeDiff(World::GetGameTimeMS(), itrc->second.end)/1000)) - SendCommand_Cooldown(p, itr->first, "ACD", itrc->first, cd, itrc->second.maxduration/1000); + // send all "CD" + SpellCooldowns const& sc = plr->GetSpellCooldownMap(); + for (SpellCooldowns::const_iterator itrc = sc.begin(); itrc != sc.end(); ++itrc) + if (itrc->second.sendToSpectator && itrc->second.maxduration >= SPECTATOR_COOLDOWN_MIN*IN_MILLISECONDS && itrc->second.maxduration <= SPECTATOR_COOLDOWN_MAX*IN_MILLISECONDS) + if (uint32 cd = (getMSTimeDiff(World::GetGameTimeMS(), itrc->second.end)/1000)) + SendCommand_Cooldown(p, itr->first, "ACD", itrc->first, cd, itrc->second.maxduration/1000); - // send all visible "AUR" - Unit::VisibleAuraMap const *visibleAuras = plr->GetVisibleAuras(); - for (Unit::VisibleAuraMap::const_iterator aitr = visibleAuras->begin(); aitr != visibleAuras->end(); ++aitr) - { - Aura *aura = aitr->second->GetBase(); - if (ShouldSendAura(aura, aitr->second->GetEffectMask(), plr->GetGUID(), false)) - SendCommand_Aura(p, itr->first, "AUR", aura->GetCasterGUID(), aura->GetSpellInfo()->Id, aura->GetSpellInfo()->IsPositive(), aura->GetSpellInfo()->Dispel, aura->GetDuration(), aura->GetMaxDuration(), (aura->GetCharges() > 1 ? aura->GetCharges() : aura->GetStackAmount()), false); - } - } - } + // send all visible "AUR" + Unit::VisibleAuraMap const *visibleAuras = plr->GetVisibleAuras(); + for (Unit::VisibleAuraMap::const_iterator aitr = visibleAuras->begin(); aitr != visibleAuras->end(); ++aitr) + { + Aura *aura = aitr->second->GetBase(); + if (ShouldSendAura(aura, aitr->second->GetEffectMask(), plr->GetGUID(), false)) + SendCommand_Aura(p, itr->first, "AUR", aura->GetCasterGUID(), aura->GetSpellInfo()->Id, aura->GetSpellInfo()->IsPositive(), aura->GetSpellInfo()->Dispel, aura->GetDuration(), aura->GetMaxDuration(), (aura->GetCharges() > 1 ? aura->GetCharges() : aura->GetStackAmount()), false); + } + } + } - bool ShouldSendAura(Aura* aura, uint8 effMask, uint64 targetGUID, bool remove) - { - if (aura->GetSpellInfo()->SpellIconID == 1 || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR)) - return false; + bool ShouldSendAura(Aura* aura, uint8 effMask, uint64 targetGUID, bool remove) + { + if (aura->GetSpellInfo()->SpellIconID == 1 || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR)) + return false; - if (remove || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_AURA_CC) || aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC) - return true; + if (remove || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_AURA_CC) || aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC) + return true; - for(uint8 i=EFFECT_0; iGetEffect(i)->GetAuraType(); - if (aura->GetEffect(i)->GetAmount() && (aura->GetSpellInfo()->IsPositive() || targetGUID != aura->GetCasterGUID()) || - at == SPELL_AURA_MECHANIC_IMMUNITY || at == SPELL_AURA_EFFECT_IMMUNITY || at == SPELL_AURA_STATE_IMMUNITY || at == SPELL_AURA_SCHOOL_IMMUNITY || at == SPELL_AURA_DISPEL_IMMUNITY) - return true; - } - } - return false; - } + for(uint8 i=EFFECT_0; iGetEffect(i)->GetAuraType(); + if (aura->GetEffect(i)->GetAmount() && (aura->GetSpellInfo()->IsPositive() || targetGUID != aura->GetCasterGUID()) || + at == SPELL_AURA_MECHANIC_IMMUNITY || at == SPELL_AURA_EFFECT_IMMUNITY || at == SPELL_AURA_STATE_IMMUNITY || at == SPELL_AURA_SCHOOL_IMMUNITY || at == SPELL_AURA_DISPEL_IMMUNITY) + return true; + } + } + return false; + } } #endif diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 52e37d23d..a9b3718b4 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -51,8 +51,8 @@ AuctionHouseMgr::~AuctionHouseMgr() AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId) { - if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) - return &mNeutralAuctions; + if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) + return &mNeutralAuctions; // team have linked auction houses FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId); @@ -95,13 +95,13 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& if (!pItem) return; - uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); - uint32 bidder_accId = 0; - Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid); - if (bidder) - bidder_accId = bidder->GetSession()->GetAccountId(); - else - bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(bidder_guid); + uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); + uint32 bidder_accId = 0; + Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid); + if (bidder) + bidder_accId = bidder->GetSession()->GetAccountId(); + else + bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(bidder_guid); // receiver exist if (bidder || bidder_accId) @@ -125,7 +125,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& .SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED); } else - sAuctionMgr->RemoveAItem(auction->item_guidlow, true); + sAuctionMgr->RemoveAItem(auction->item_guidlow, true); } void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans) @@ -161,20 +161,20 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa .AddMoney(profit) .SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY)); - if (auction->bid >= 500*GOLD) - if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(auction->bidder)) - { - uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); - Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid); - std::string owner_name = ""; - uint8 owner_level = 0; - if (const GlobalPlayerData* gpd_owner = sWorld->GetGlobalPlayerData(auction->owner)) - { - owner_name = gpd_owner->name; - owner_level = gpd_owner->level; - } - CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \" profit: %ug, bidder: %s %u lvl (guid: %u), seller: %s %u lvl (guid: %u), item %u (%u)\", NOW())", gpd->accountId, auction->bidder, gpd->name.c_str(), bidder ? bidder->GetSession()->GetRemoteAddress().c_str() : "", owner_accId, owner_name.c_str(), auction->bid, (profit/GOLD), gpd->name.c_str(), gpd->level, auction->bidder, owner_name.c_str(), owner_level, auction->owner, auction->item_template, auction->itemCount); - } + if (auction->bid >= 500*GOLD) + if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(auction->bidder)) + { + uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); + Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid); + std::string owner_name = ""; + uint8 owner_level = 0; + if (const GlobalPlayerData* gpd_owner = sWorld->GetGlobalPlayerData(auction->owner)) + { + owner_name = gpd_owner->name; + owner_level = gpd_owner->level; + } + CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \" profit: %ug, bidder: %s %u lvl (guid: %u), seller: %s %u lvl (guid: %u), item %u (%u)\", NOW())", gpd->accountId, auction->bidder, gpd->name.c_str(), bidder ? bidder->GetSession()->GetRemoteAddress().c_str() : "", owner_accId, owner_name.c_str(), auction->bid, (profit/GOLD), gpd->name.c_str(), gpd->level, auction->bidder, owner_name.c_str(), owner_level, auction->owner, auction->item_template, auction->itemCount); + } } } @@ -200,8 +200,8 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti .AddItem(pItem) .SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, 0); } - else - sAuctionMgr->RemoveAItem(auction->item_guidlow, true); + else + sAuctionMgr->RemoveAItem(auction->item_guidlow, true); } //this function sends mail to old bidder @@ -352,13 +352,13 @@ bool AuctionHouseMgr::RemoveAItem(uint32 id, bool deleteFromDB) if (i == mAitems.end()) return false; - if (deleteFromDB) - { - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - i->second->FSetState(ITEM_REMOVED); - i->second->SaveToDB(trans); - CharacterDatabase.CommitTransaction(trans); - } + if (deleteFromDB) + { + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + i->second->FSetState(ITEM_REMOVED); + i->second->SaveToDB(trans); + CharacterDatabase.CommitTransaction(trans); + } mAitems.erase(i); return true; @@ -443,13 +443,13 @@ void AuctionHouseObject::Update() SQLTransaction trans = CharacterDatabase.BeginTransaction(); - for (AuctionEntryMap::iterator itr, iter = AuctionsMap.begin(); iter != AuctionsMap.end(); ) - { - itr = iter++; - AuctionEntry* auction = (*itr).second; + for (AuctionEntryMap::iterator itr, iter = AuctionsMap.begin(); iter != AuctionsMap.end(); ) + { + itr = iter++; + AuctionEntry* auction = (*itr).second; - if (auction->expire_time > checkTime) - continue; + if (auction->expire_time > checkTime) + continue; ///- Either cancel the auction if there was no bidder if (auction->bidder == 0) @@ -512,34 +512,34 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& count, uint32& totalcount, uint8 getAll) { - uint32 itrcounter = 0; + uint32 itrcounter = 0; - // pussywizard: optimization, this is a simplified case - if (itemClass == 0xffffffff && itemSubClass == 0xffffffff && inventoryType == 0xffffffff && quality == 0xffffffff && levelmin == 0x00 && levelmax == 0x00 && usable == 0x00 && wsearchedname.empty()) - { - totalcount = Getcount(); - if (listfrom < totalcount) - { - AuctionEntryMap::iterator itr = AuctionsMap.begin(); - std::advance(itr, listfrom); - for (; itr != AuctionsMap.end(); ++itr) - { - itr->second->BuildAuctionInfo(data); - if ((++count) >= 50) - break; - } - } - return true; - } + // pussywizard: optimization, this is a simplified case + if (itemClass == 0xffffffff && itemSubClass == 0xffffffff && inventoryType == 0xffffffff && quality == 0xffffffff && levelmin == 0x00 && levelmax == 0x00 && usable == 0x00 && wsearchedname.empty()) + { + totalcount = Getcount(); + if (listfrom < totalcount) + { + AuctionEntryMap::iterator itr = AuctionsMap.begin(); + std::advance(itr, listfrom); + for (; itr != AuctionsMap.end(); ++itr) + { + itr->second->BuildAuctionInfo(data); + if ((++count) >= 50) + break; + } + } + return true; + } time_t curTime = sWorld->GetGameTime(); for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) { - if (AsyncAuctionListingMgr::IsAuctionListingAllowed() == false) // pussywizard: World::Update is waiting for us... - if ((itrcounter++) % 100 == 0) // check condition every 100 iterations - if (avgDiffTracker.getAverage() >= 30 || getMSTimeDiff(World::GetGameTimeMS(), getMSTime()) >= 10) // pussywizard: stop immediately if diff is high or waiting too long - return false; + if (AsyncAuctionListingMgr::IsAuctionListingAllowed() == false) // pussywizard: World::Update is waiting for us... + if ((itrcounter++) % 100 == 0) // check condition every 100 iterations + if (avgDiffTracker.getAverage() >= 30 || getMSTimeDiff(World::GetGameTimeMS(), getMSTime()) >= 10) // pussywizard: stop immediately if diff is high or waiting too long + return false; AuctionEntry* Aentry = itr->second; // Skip expired auctions @@ -559,11 +559,11 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player continue; if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType) - { - // xinef: exception, robes are counted as chests - if (inventoryType != INVTYPE_CHEST || proto->InventoryType != INVTYPE_ROBE) - continue; - } + { + // xinef: exception, robes are counted as chests + if (inventoryType != INVTYPE_CHEST || proto->InventoryType != INVTYPE_ROBE) + continue; + } if (quality != 0xffffffff && proto->Quality != quality) continue; @@ -572,14 +572,14 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player continue; if (usable != 0x00) - { - if (player->CanUseItem(item) != EQUIP_ERR_OK) - continue; + { + if (player->CanUseItem(item) != EQUIP_ERR_OK) + continue; - // xinef: check already learded recipes and pets - if (proto->Spells[1].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID && player->HasSpell(proto->Spells[1].SpellId)) - continue; - } + // xinef: check already learded recipes and pets + if (proto->Spells[1].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID && player->HasSpell(proto->Spells[1].SpellId)) + continue; + } // Allow search by suffix (ie: of the Monkey) or partial name (ie: Monkey) // No need to do any of this if no search term was entered @@ -639,7 +639,7 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player ++totalcount; } - return true; + return true; } //this function inserts to WorldPacket auction's data diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index e14c799da..db00ecc59 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -75,30 +75,30 @@ Battlefield::~Battlefield() // Called when a player enters the zone void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/) { - // Xinef: do not invite players on taxi - if (!player->IsInFlight()) - { - // If battle is started, - // If not full of players > invite player to join the war - // If full of players > announce to player that BF is full and kick him after a few second if he desn't leave - if (IsWarTime()) - { - if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces - InvitePlayerToWar(player); - else // No more vacant places - { - // TODO: Send a packet to announce it to player - m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + (player->IsGameMaster() ? 30*MINUTE : 10); - InvitePlayerToQueue(player); - } - } - else - { - // If time left is < 15 minutes invite player to join queue - if (m_Timer <= m_StartGroupingTimer) - InvitePlayerToQueue(player); - } - } + // Xinef: do not invite players on taxi + if (!player->IsInFlight()) + { + // If battle is started, + // If not full of players > invite player to join the war + // If full of players > announce to player that BF is full and kick him after a few second if he desn't leave + if (IsWarTime()) + { + if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces + InvitePlayerToWar(player); + else // No more vacant places + { + // TODO: Send a packet to announce it to player + m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + (player->IsGameMaster() ? 30*MINUTE : 10); + InvitePlayerToQueue(player); + } + } + else + { + // If time left is < 15 minutes invite player to join queue + if (m_Timer <= m_StartGroupingTimer) + InvitePlayerToQueue(player); + } + } // Add player in the list of player in zone m_players[player->GetTeamId()].insert(player->GetGUID()); @@ -116,8 +116,8 @@ void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/) m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID()); player->GetSession()->SendBfLeaveMessage(m_BattleId); if (Group* group = player->GetGroup()) // Remove the player from the raid group - if (group->isBFGroup()) - group->RemoveMember(player->GetGUID()); + if (group->isBFGroup()) + group->RemoveMember(player->GetGUID()); OnPlayerLeaveWar(player); } @@ -138,12 +138,12 @@ bool Battlefield::Update(uint32 diff) { if (m_Timer <= diff) { - if (!IsEnabled() || (!IsWarTime() && sWorld->GetActiveSessionCount() > 3500)) // if WG is disabled or there is more than 3500 connections, switch automaticly - { - m_isActive = true; - EndBattle(false); - return false; - } + if (!IsEnabled() || (!IsWarTime() && sWorld->GetActiveSessionCount() > 3500)) // if WG is disabled or there is more than 3500 connections, switch automaticly + { + m_isActive = true; + EndBattle(false); + return false; + } // Battlefield ends on time if (IsWarTime()) EndBattle(true); @@ -153,8 +153,8 @@ bool Battlefield::Update(uint32 diff) else m_Timer -= diff; - if (!IsEnabled()) - return false; + if (!IsEnabled()) + return false; // Invite players a few minutes before the battle's beginning if (!IsWarTime() && !m_StartGrouping && m_Timer <= m_StartGroupingTimer) @@ -466,7 +466,7 @@ void Battlefield::SendWarningToAllInZone(uint32 entry) { if (Unit* unit = ObjectAccessor::FindUnit(StalkerGuid)) if (Creature* stalker = unit->ToCreature()) - sCreatureTextMgr->SendChat(stalker, (uint8)entry, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); + sCreatureTextMgr->SendChat(stalker, (uint8)entry, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); } void Battlefield::SendWarningToPlayer(Player* player, uint32 entry) @@ -544,11 +544,11 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player) if (!player->IsInWorld()) return false; - if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup())) - { - sLog->outMisc("Battlefield::AddOrSetPlayerToCorrectBfGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF")); - return false; - } + if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup())) + { + sLog->outMisc("Battlefield::AddOrSetPlayerToCorrectBfGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF")); + return false; + } Group* group = GetFreeBfRaid(player->GetTeamId()); if (!group) @@ -802,7 +802,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl return NULL; } - creature->setFaction(BattlefieldFactions[teamId]); + creature->setFaction(BattlefieldFactions[teamId]); creature->SetHomePosition(x, y, z, o); CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); @@ -841,7 +841,7 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z // Add to world map->AddToMap(go); - go->setActive(true); + go->setActive(true); return go; } @@ -890,7 +890,7 @@ GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player) void BfCapturePoint::SendChangePhase() { - GameObject* capturePoint = GetCapturePointGo(); + GameObject* capturePoint = GetCapturePointGo(); if (!capturePoint) return; @@ -957,7 +957,7 @@ bool BfCapturePoint::DelCapturePoint() bool BfCapturePoint::Update(uint32 diff) { - GameObject* capturePoint = GetCapturePointGo(); + GameObject* capturePoint = GetCapturePointGo(); if (!capturePoint) return false; diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 64fc6b57e..99abce1a2 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -110,7 +110,7 @@ class BfCapturePoint bool SetCapturePointData(GameObject* capturePoint); GameObject* GetCapturePointGo() { return ObjectAccessor::GetObjectInWorld(m_capturePoint, (GameObject*)NULL); } - GameObject* GetCapturePointGo(WorldObject* obj) { return ObjectAccessor::GetGameObject(*obj, m_capturePoint); } + GameObject* GetCapturePointGo(WorldObject* obj) { return ObjectAccessor::GetGameObject(*obj, m_capturePoint); } TeamId GetTeamId() { return m_team; } protected: @@ -183,7 +183,7 @@ class BfGraveyard if (!m_SpiritGuide[0] && !m_SpiritGuide[1]) return false; - // performance + // performance /*if (!ObjectAccessor::FindUnit(m_SpiritGuide[0]) && !ObjectAccessor::FindUnit(m_SpiritGuide[1])) return false;*/ @@ -335,7 +335,7 @@ class Battlefield : public ZoneScript //virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {}; /// Send all worldstate data to all player in zone. - virtual void SendInitWorldStatesToAll() = 0; + virtual void SendInitWorldStatesToAll() = 0; virtual void FillInitialWorldStates(WorldPacket& /*data*/) = 0; /// Return if we can use mount in battlefield diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index d56b73d2b..101ab5c95 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -45,8 +45,8 @@ bool BattlefieldWG::SetupBattlefield() m_ZoneId = BATTLEFIELD_WG_ZONEID; m_MapId = BATTLEFIELD_WG_MAPID; - // init stalker AFTER setting map id... we spawn it at map=random memory value?... - InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]); + // init stalker AFTER setting map id... we spawn it at map=random memory value?... + InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]); m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX); m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE); @@ -61,7 +61,7 @@ bool BattlefieldWG::SetupBattlefield() m_StartGrouping = false; m_tenacityStack = 0; - m_titansRelic = 0; + m_titansRelic = 0; KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0); KickPosition.m_mapId = m_MapId; @@ -201,19 +201,19 @@ bool BattlefieldWG::Update(uint32 diff) else m_saveTimer -= diff; - // Update Tenacity - if (IsWarTime()) - { - if (m_tenacityUpdateTimer <= diff) - { - m_tenacityUpdateTimer = 10000; - if (!m_updateTenacityList.empty()) - UpdateTenacity(); - m_updateTenacityList.clear(); - } - else - m_tenacityUpdateTimer -= diff; - } + // Update Tenacity + if (IsWarTime()) + { + if (m_tenacityUpdateTimer <= diff) + { + m_tenacityUpdateTimer = 10000; + if (!m_updateTenacityList.empty()) + UpdateTenacity(); + m_updateTenacityList.clear(); + } + else + m_tenacityUpdateTimer -= diff; + } return m_return; } @@ -229,8 +229,8 @@ void BattlefieldWG::OnBattleStart() // Set in use (not allow to click on before last door is broken) go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - // save guid - m_titansRelic = go->GetGUID(); + // save guid + m_titansRelic = go->GetGUID(); } else sLog->outError("WG: Failed to spawn titan relic."); @@ -259,7 +259,7 @@ void BattlefieldWG::OnBattleStart() } } - SetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT, WG_MAX_ATTACKTOWERS); + SetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT, WG_MAX_ATTACKTOWERS); SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0); SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0); @@ -286,9 +286,9 @@ void BattlefieldWG::OnBattleStart() // Send start warning to all players SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START); - // Xinef: reset tenacity counter - m_tenacityStack = 0; - m_tenacityUpdateTimer = 20000; + // Xinef: reset tenacity counter + m_tenacityStack = 0; + m_tenacityUpdateTimer = 20000; if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE)) sWorld->SendWorldText(BATTLEFIELD_WG_WORLD_START_MESSAGE); @@ -324,29 +324,29 @@ void BattlefieldWG::UpdateVehicleCountWG() for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) - { + { player->SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); player->SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)); player->SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); player->SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)); - } + } } void BattlefieldWG::CapturePointTaken(uint32 areaId) { - for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) + for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) - if (player->GetAreaId() == areaId) - player->UpdateAreaDependentAuras(areaId); + if (player->GetAreaId() == areaId) + player->UpdateAreaDependentAuras(areaId); } void BattlefieldWG::OnBattleEnd(bool endByTimer) { - // Remove relic - if (GameObject* go = GetRelic()) - go->RemoveFromWorld(); - m_titansRelic = 0; + // Remove relic + if (GameObject* go = GetRelic()) + go->RemoveFromWorld(); + m_titansRelic = 0; // Remove turret for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr) @@ -401,11 +401,11 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer) // Saving data for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) - { - (*itr)->Rebuild(); + { + (*itr)->Rebuild(); (*itr)->Save(); - (*itr)->UpdateTurretAttack(true); - } + (*itr)->UpdateTurretAttack(true); + } for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) (*itr)->Save(); @@ -415,59 +415,59 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer) for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Unit* unit = ObjectAccessor::FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) - creature->DespawnOrUnsummon(1); + creature->DespawnOrUnsummon(1); m_vehicles[team].clear(); } - uint8 damagedTowersDef = GetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT); - uint8 brokenTowersDef = GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT); - uint8 damagedTowersAtt = GetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT); - uint8 brokenTowersAtt = GetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT); - uint32 spellDamagedDef = SPELL_DAMAGED_TOWER; - uint32 spellFullDef = SPELL_DESTROYED_TOWER; - uint32 spellDamagedAtt = SPELL_DAMAGED_BUILDING; - uint32 spellFullAtt = SPELL_INTACT_BUILDING; + uint8 damagedTowersDef = GetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT); + uint8 brokenTowersDef = GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT); + uint8 damagedTowersAtt = GetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT); + uint8 brokenTowersAtt = GetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT); + uint32 spellDamagedDef = SPELL_DAMAGED_TOWER; + uint32 spellFullDef = SPELL_DESTROYED_TOWER; + uint32 spellDamagedAtt = SPELL_DAMAGED_BUILDING; + uint32 spellFullAtt = SPELL_INTACT_BUILDING; - if (!endByTimer) - { - brokenTowersDef = GetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT); - brokenTowersAtt = GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT); - spellDamagedDef = SPELL_DAMAGED_BUILDING; - spellFullDef = SPELL_INTACT_BUILDING; - spellDamagedAtt = SPELL_DAMAGED_TOWER; - spellFullAtt = SPELL_DESTROYED_TOWER; - } + if (!endByTimer) + { + brokenTowersDef = GetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT); + brokenTowersAtt = GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT); + spellDamagedDef = SPELL_DAMAGED_BUILDING; + spellFullDef = SPELL_INTACT_BUILDING; + spellDamagedAtt = SPELL_DAMAGED_TOWER; + spellFullAtt = SPELL_DESTROYED_TOWER; + } - for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) + for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) { if (Player* player = ObjectAccessor::FindPlayer(*itr)) { - // Victory in Wintergrasp - player->AreaExploredOrEventHappens(GetDefenderTeam() ? 13183 : 13181); // HORDE / ALLY win wg quest id + // Victory in Wintergrasp + player->AreaExploredOrEventHappens(GetDefenderTeam() ? 13183 : 13181); // HORDE / ALLY win wg quest id - player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true); + player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true); player->CastSpell(player, SPELL_VICTORY_REWARD, true); - RemoveAurasFromPlayer(player); + RemoveAurasFromPlayer(player); - for (uint8 i = 0; i < damagedTowersDef; ++i) - player->CastSpell(player, spellDamagedDef, true); - for (uint8 i = 0; i < brokenTowersDef; ++i) - player->CastSpell(player, spellFullDef, true); + for (uint8 i = 0; i < damagedTowersDef; ++i) + player->CastSpell(player, spellDamagedDef, true); + for (uint8 i = 0; i < brokenTowersDef; ++i) + player->CastSpell(player, spellFullDef, true); } } for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) - { + { player->CastSpell(player, SPELL_DEFEAT_REWARD, true); - RemoveAurasFromPlayer(player); + RemoveAurasFromPlayer(player); - for (uint8 i = 0; i < damagedTowersAtt; ++i) - player->CastSpell(player, spellDamagedAtt, true); - for (uint8 i = 0; i < brokenTowersAtt; ++i) - player->CastSpell(player, spellFullAtt, true); - } + for (uint8 i = 0; i < damagedTowersAtt; ++i) + player->CastSpell(player, spellDamagedAtt, true); + for (uint8 i = 0; i < brokenTowersAtt; ++i) + player->CastSpell(player, spellFullAtt, true); + } if (!endByTimer) { @@ -484,9 +484,9 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer) } } - // Clear players in war list at the end. - m_PlayersInWar[TEAM_ALLIANCE].clear(); - m_PlayersInWar[TEAM_HORDE].clear(); + // Clear players in war list at the end. + m_PlayersInWar[TEAM_ALLIANCE].clear(); + m_PlayersInWar[TEAM_HORDE].clear(); if (!endByTimer) // win alli/horde SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : (BATTLEFIELD_WG_TEXT_WIN_KEEP + 2)); @@ -500,8 +500,8 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer) void BattlefieldWG::OnStartGrouping() { - if (!IsWarTime()) - SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); + if (!IsWarTime()) + SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); } uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const @@ -532,16 +532,16 @@ uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const uint32 BattlefieldWG::GetAreaByGraveyardId(uint8 gId) const { - switch (gId) + switch (gId) { - case BATTLEFIELD_WG_GY_WORKSHOP_NE: - return AREA_THE_SUNKEN_RING; - case BATTLEFIELD_WG_GY_WORKSHOP_NW: - return AREA_THE_BROKEN_TEMPLE; - case BATTLEFIELD_WG_GY_WORKSHOP_SW: - return AREA_WESTPARK_WORKSHOP; - case BATTLEFIELD_WG_GY_WORKSHOP_SE: - return AREA_EASTPARK_WORKSHOP; + case BATTLEFIELD_WG_GY_WORKSHOP_NE: + return AREA_THE_SUNKEN_RING; + case BATTLEFIELD_WG_GY_WORKSHOP_NW: + return AREA_THE_BROKEN_TEMPLE; + case BATTLEFIELD_WG_GY_WORKSHOP_SW: + return AREA_WESTPARK_WORKSHOP; + case BATTLEFIELD_WG_GY_WORKSHOP_SE: + return AREA_EASTPARK_WORKSHOP; } return 0; @@ -557,9 +557,9 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) { TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE); uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId(true)); - // xinef: little workaround, there are 2 spirit guides in same area - if (creature->IsWithinDist2d(5103.0f, 3461.5f, 5.0f)) - graveyardId = BATTLEFIELD_WG_GY_WORKSHOP_NW; + // xinef: little workaround, there are 2 spirit guides in same area + if (creature->IsWithinDist2d(5103.0f, 3461.5f, 5.0f)) + graveyardId = BATTLEFIELD_WG_GY_WORKSHOP_NW; if (m_GraveyardList[graveyardId]) m_GraveyardList[graveyardId]->SetSpirit(creature, teamId); @@ -577,12 +577,12 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) case NPC_WINTERGRASP_CATAPULT: case NPC_WINTERGRASP_DEMOLISHER: { - if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID()) + if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID()) return; - Player* creator = ObjectAccessor::FindPlayer(creature->ToTempSummon()->GetSummonerGUID()); - if (!creator) - return; + Player* creator = ObjectAccessor::FindPlayer(creature->ToTempSummon()->GetSummonerGUID()); + if (!creator) + return; TeamId team = creator->GetTeamId(); if (team == TEAM_HORDE) @@ -617,16 +617,16 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) } break; } - case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_HORDE: - case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_ALLIANCE: - { - if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID()) + case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_HORDE: + case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_ALLIANCE: + { + if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID()) return; - if (Unit* owner = creature->ToTempSummon()->GetSummoner()) - creature->setFaction(owner->getFaction()); - break; - } + if (Unit* owner = creature->ToTempSummon()->GetSummoner()) + creature->setFaction(owner->getFaction()); + break; + } } } } @@ -712,26 +712,26 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim) bool again = false; TeamId killerTeam = killer->GetTeamId(); - // xinef: tower cannons also grant rank - if (victim->GetTypeId() == TYPEID_PLAYER || IsKeepNpc(victim->GetEntry()) || victim->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON) + // xinef: tower cannons also grant rank + if (victim->GetTypeId() == TYPEID_PLAYER || IsKeepNpc(victim->GetEntry()) || victim->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON) { for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) if (player->GetDistance2d(killer) < 40) PromotePlayer(player); - // Xinef: Allow to Skin non-released corpse - if (victim->GetTypeId() == TYPEID_PLAYER) - victim->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); + // Xinef: Allow to Skin non-released corpse + if (victim->GetTypeId() == TYPEID_PLAYER) + victim->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); } - else if (victim->IsVehicle() && !killer->IsFriendlyTo(victim)) - { - // Quest - Wintergrasp - PvP Kill - Vehicle - for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr) + else if (victim->IsVehicle() && !killer->IsFriendlyTo(victim)) + { + // Quest - Wintergrasp - PvP Kill - Vehicle + for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) if (player->GetDistance2d(killer) < 40) player->KilledMonsterCredit(NPC_QUEST_PVP_KILL_VEHICLE, 0); - } + } } bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle) @@ -806,7 +806,7 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player) RemoveAurasFromPlayer(player); player->CastSpell(player, SPELL_RECRUIT, true); - AddUpdateTenacity(player); + AddUpdateTenacity(player); if (player->GetTeamId() == GetDefenderTeam()) player->TeleportTo(571, 5345, 2842, 410, 3.14f); @@ -841,7 +841,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player) RemoveAurasFromPlayer(player); } - RemoveUpdateTenacity(player); + RemoveUpdateTenacity(player); } void BattlefieldWG::OnPlayerLeaveZone(Player* player) @@ -864,18 +864,18 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player) // Send worldstate to player SendInitWorldStatesTo(player); - // xinef: Attacker, if hidden in relic room kick him out - if (player->GetTeamId() == GetAttackerTeam()) - if (player->GetPositionX() > 5400.0f && player->GetPositionX() < 5490.0f && player->GetPositionY() > 2803.0f && player->GetPositionY() < 2878.0f) - KickPlayerFromBattlefield(player->GetGUID()); + // xinef: Attacker, if hidden in relic room kick him out + if (player->GetTeamId() == GetAttackerTeam()) + if (player->GetPositionX() > 5400.0f && player->GetPositionX() < 5490.0f && player->GetPositionY() > 2803.0f && player->GetPositionY() < 2878.0f) + KickPlayerFromBattlefield(player->GetGUID()); } uint32 BattlefieldWG::GetData(uint32 data) const { - // xinef: little hack, same area for default horde graveyard - // this graveyard is the one of broken temple! - if (data == AREA_THE_CHILLED_QUAGMIRE) - data = AREA_THE_BROKEN_TEMPLE; + // xinef: little hack, same area for default horde graveyard + // this graveyard is the one of broken temple! + if (data == AREA_THE_CHILLED_QUAGMIRE) + data = AREA_THE_BROKEN_TEMPLE; switch (data) { @@ -919,15 +919,15 @@ void BattlefieldWG::FillInitialWorldStates(WorldPacket& data) void BattlefieldWG::SendInitWorldStatesTo(Player* player) { WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkshopsList.size() * 8))); - + data << uint32(m_MapId); data << uint32(m_ZoneId); - data << uint32(0); + data << uint32(0); data << uint16(10 + BuildingsInZone.size() + WorkshopsList.size()); // Number of fields - + FillInitialWorldStates(data); - - player->GetSession()->SendPacket(&data); + + player->GetSession()->SendPacket(&data); } void BattlefieldWG::SendInitWorldStatesToAll() @@ -970,9 +970,9 @@ void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team, GameObject* go) for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) { - // Quest - Wintergrasp - Southern Tower Kill - if (go && player->GetDistance2d(go) < 200.0f) - player->KilledMonsterCredit(NPC_QUEST_SOUTHERN_TOWER_KILL, 0); + // Quest - Wintergrasp - Southern Tower Kill + if (go && player->GetDistance2d(go) < 200.0f) + player->KilledMonsterCredit(NPC_QUEST_SOUTHERN_TOWER_KILL, 0); player->CastSpell(player, SPELL_TOWER_CONTROL, true); player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_LEANING_TOWER_ACHIEVEMENT, 0, 0); @@ -988,18 +988,18 @@ void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team, GameObject* go) SendInitWorldStatesToAll(); } } - else - { - // Xinef: rest of structures, quest credit + else + { + // Xinef: rest of structures, quest credit for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) { - // Quest - Wintergrasp - Vehicle Protected - if (go && player->GetDistance2d(go) < 100.0f) - player->KilledMonsterCredit(NPC_QUEST_VEHICLE_PROTECTED, 0); - } + // Quest - Wintergrasp - Vehicle Protected + if (go && player->GetDistance2d(go) < 100.0f) + player->KilledMonsterCredit(NPC_QUEST_VEHICLE_PROTECTED, 0); + } - } + } } void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId) @@ -1024,19 +1024,19 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId) // if destroy or damage event, search the wall/tower and update worldstate/send warning message for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) { - if (GameObject* build = ObjectAccessor::GetGameObject(*obj, (*itr)->m_Build)) - { - if (go->GetEntry() == build->GetEntry()) - { - if (build->GetGOInfo()->building.damagedEvent == eventId) - (*itr)->Damaged(); + if (GameObject* build = ObjectAccessor::GetGameObject(*obj, (*itr)->m_Build)) + { + if (go->GetEntry() == build->GetEntry()) + { + if (build->GetGOInfo()->building.damagedEvent == eventId) + (*itr)->Damaged(); - if (build->GetGOInfo()->building.destroyedEvent == eventId) - (*itr)->Destroyed(); + if (build->GetGOInfo()->building.destroyedEvent == eventId) + (*itr)->Destroyed(); - break; - } - } + break; + } + } } } @@ -1044,32 +1044,32 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId) void BattlefieldWG::UpdateDamagedTowerCount(TeamId team) { if (team == GetAttackerTeam()) - { + { UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 1); - UpdateData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT, -1); - } + UpdateData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT, -1); + } } uint32 BattlefieldWG::GetHonorBuff(int32 stack) const { - if (stack < 5) - return 0; - if (stack < 10) - return SPELL_GREAT_HONOR; - if (stack < 15) - return SPELL_GREATER_HONOR; - return SPELL_GREATEST_HONOR; + if (stack < 5) + return 0; + if (stack < 10) + return SPELL_GREAT_HONOR; + if (stack < 15) + return SPELL_GREATER_HONOR; + return SPELL_GREATEST_HONOR; } void BattlefieldWG::AddUpdateTenacity(Player* player) { - m_updateTenacityList.insert(player->GetGUID()); + m_updateTenacityList.insert(player->GetGUID()); } void BattlefieldWG::RemoveUpdateTenacity(Player* player) { - m_updateTenacityList.erase(player->GetGUID()); - m_updateTenacityList.insert(0); + m_updateTenacityList.erase(player->GetGUID()); + m_updateTenacityList.insert(0); } void BattlefieldWG::UpdateTenacity() @@ -1087,31 +1087,31 @@ void BattlefieldWG::UpdateTenacity() newStack = int32((1.0f - ((float)alliancePlayers / hordePlayers)) * 4.0f); // negative, should cast on horde } - // Return if no change in stack and apply tenacity to new player + // Return if no change in stack and apply tenacity to new player if (newStack == m_tenacityStack) - { - for (GuidSet::const_iterator itr = m_updateTenacityList.begin(); itr != m_updateTenacityList.end(); ++itr) - if (Player* newPlayer = ObjectAccessor::FindPlayer(*itr)) - if ((newPlayer->GetTeamId() == TEAM_ALLIANCE && m_tenacityStack > 0) || (newPlayer->GetTeamId() == TEAM_HORDE && m_tenacityStack < 0)) - { - newStack = std::min(abs(newStack), 20); - uint32 buff_honor = GetHonorBuff(newStack); - newPlayer->SetAuraStack(SPELL_TENACITY, newPlayer, newStack); - if (buff_honor) - newPlayer->CastSpell(newPlayer, buff_honor, true); - } + { + for (GuidSet::const_iterator itr = m_updateTenacityList.begin(); itr != m_updateTenacityList.end(); ++itr) + if (Player* newPlayer = ObjectAccessor::FindPlayer(*itr)) + if ((newPlayer->GetTeamId() == TEAM_ALLIANCE && m_tenacityStack > 0) || (newPlayer->GetTeamId() == TEAM_HORDE && m_tenacityStack < 0)) + { + newStack = std::min(abs(newStack), 20); + uint32 buff_honor = GetHonorBuff(newStack); + newPlayer->SetAuraStack(SPELL_TENACITY, newPlayer, newStack); + if (buff_honor) + newPlayer->CastSpell(newPlayer, buff_honor, true); + } return; - } + } if (m_tenacityStack != 0) - { - if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance - team = TEAM_ALLIANCE; - else if (m_tenacityStack < 0 && newStack >= 0) // old buff was on horde - team = TEAM_HORDE; - } + { + if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance + team = TEAM_ALLIANCE; + else if (m_tenacityStack < 0 && newStack >= 0) // old buff was on horde + team = TEAM_HORDE; + } - m_tenacityStack = newStack; + m_tenacityStack = newStack; // Remove old buff if (team != TEAM_NEUTRAL) { @@ -1128,24 +1128,24 @@ void BattlefieldWG::UpdateTenacity() if (newStack) { team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE; - newStack = std::min(abs(newStack), 20); + newStack = std::min(abs(newStack), 20); uint32 buff_honor = GetHonorBuff(newStack); for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) - { + { player->SetAuraStack(SPELL_TENACITY, player, newStack); - if (buff_honor) - player->CastSpell(player, buff_honor, true); - } + if (buff_honor) + player->CastSpell(player, buff_honor, true); + } for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr) if (Unit* unit = ObjectAccessor::FindUnit(*itr)) - { + { unit->SetAuraStack(SPELL_TENACITY_VEHICLE, unit, newStack); - if (buff_honor) - unit->CastSpell(unit, buff_honor, true); - } + if (buff_honor) + unit->CastSpell(unit, buff_honor, true); + } } } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index c9a4668be..108ad8061 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -80,7 +80,7 @@ enum WintergraspSpells SPELL_WINTERGRASP_WATER = 36444, SPELL_ESSENCE_OF_WINTERGRASP = 58045, SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA = 58730, - SPELL_LEANING_TOWER_ACHIEVEMENT = 60676, + SPELL_LEANING_TOWER_ACHIEVEMENT = 60676, // Phasing spells SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618,// ADDS PHASE 16 @@ -92,7 +92,7 @@ enum WintergraspSpells enum WintergraspData { - BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT, + BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT, BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, @@ -157,14 +157,14 @@ enum WGGraveyardId enum eWGGossipText { - BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = 20071, - BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = 20072, - BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = 20074, - BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = 20073, - BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = 20070, - BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = 20075, - BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = 20076, - BATTLEFIELD_WG_WORLD_START_MESSAGE = 20078, + BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = 20071, + BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = 20072, + BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = 20074, + BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = 20073, + BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = 20070, + BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = 20075, + BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = 20076, + BATTLEFIELD_WG_WORLD_START_MESSAGE = 20078, }; enum WintergraspNpcs @@ -182,19 +182,19 @@ enum WintergraspNpcs BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF = 31106, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT = 31053, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP = 31107, - BATTLEFIELD_WG_NPC_HORDE_WARBRINGER = 15350, - BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL = 15351, + BATTLEFIELD_WG_NPC_HORDE_WARBRINGER = 15350, + BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL = 15351, - BATTLEFIELD_WG_NPC_AV_PORTAL_HORDE = 32617, - BATTLEFIELD_WG_NPC_AV_PORTAL_ALLY = 32616, - BATTLEFIELD_WG_NPC_AB_PORTAL_HORDE = 32619, - BATTLEFIELD_WG_NPC_AB_PORTAL_ALLY = 32618, - BATTLEFIELD_WG_NPC_EOTS_PORTAL_HORDE = 32620, - BATTLEFIELD_WG_NPC_EOTS_PORTAL_ALLY = 32621, - BATTLEFIELD_WG_NPC_SOTA_PORTAL_HORDE = 32623, - BATTLEFIELD_WG_NPC_SOTA_PORTAL_ALLY = 32622, - BATTLEFIELD_WG_NPC_WG_PORTAL_HORDE = 32625, - BATTLEFIELD_WG_NPC_WG_PORTAL_ALLY = 32624, + BATTLEFIELD_WG_NPC_AV_PORTAL_HORDE = 32617, + BATTLEFIELD_WG_NPC_AV_PORTAL_ALLY = 32616, + BATTLEFIELD_WG_NPC_AB_PORTAL_HORDE = 32619, + BATTLEFIELD_WG_NPC_AB_PORTAL_ALLY = 32618, + BATTLEFIELD_WG_NPC_EOTS_PORTAL_HORDE = 32620, + BATTLEFIELD_WG_NPC_EOTS_PORTAL_ALLY = 32621, + BATTLEFIELD_WG_NPC_SOTA_PORTAL_HORDE = 32623, + BATTLEFIELD_WG_NPC_SOTA_PORTAL_ALLY = 32622, + BATTLEFIELD_WG_NPC_WG_PORTAL_HORDE = 32625, + BATTLEFIELD_WG_NPC_WG_PORTAL_ALLY = 32624, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH = 31052, BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294,// @@ -209,17 +209,17 @@ enum WintergraspNpcs NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp - NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_ALLIANCE = 28319, - NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_HORDE = 32629, - NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312, - NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627, + NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_ALLIANCE = 28319, + NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_HORDE = 32629, + NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312, + NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627, NPC_WINTERGRASP_CATAPULT = 27881, NPC_WINTERGRASP_DEMOLISHER = 28094, NPC_WINTERGRASP_TOWER_CANNON = 28366, - NPC_QUEST_SOUTHERN_TOWER_KILL = 35074, - NPC_QUEST_VEHICLE_PROTECTED = 31284, - NPC_QUEST_PVP_KILL_VEHICLE = 31093, + NPC_QUEST_SOUTHERN_TOWER_KILL = 35074, + NPC_QUEST_VEHICLE_PROTECTED = 31284, + NPC_QUEST_PVP_KILL_VEHICLE = 31093, }; struct BfWGCoordGY @@ -385,7 +385,7 @@ class BattlefieldWG : public Battlefield bool SetupBattlefield(); /// Return pointer to relic object - GameObject* GetRelic() { return ObjectAccessor::GetObjectInWorld(m_titansRelic, (GameObject*)NULL); } + GameObject* GetRelic() { return ObjectAccessor::GetObjectInWorld(m_titansRelic, (GameObject*)NULL); } /// Define relic object //void SetRelic(GameObject* relic) { m_titansRelic = relic; } @@ -398,8 +398,8 @@ class BattlefieldWG : public Battlefield /// Vehicle world states update void UpdateCounterVehicle(bool init); - void UpdateVehicleCountWG(); - void CapturePointTaken(uint32 areaId); + void UpdateVehicleCountWG(); + void CapturePointTaken(uint32 areaId); void SendInitWorldStatesTo(Player* player); void SendInitWorldStatesToAll(); @@ -409,17 +409,17 @@ class BattlefieldWG : public Battlefield void OnUnitDeath(Unit* unit); void PromotePlayer(Player* killer); - uint32 GetHonorBuff(int32 stack) const; + uint32 GetHonorBuff(int32 stack) const; void UpdateTenacity(); - void AddUpdateTenacity(Player* player); - void RemoveUpdateTenacity(Player* player); + void AddUpdateTenacity(Player* player); + void RemoveUpdateTenacity(Player* player); void ProcessEvent(WorldObject *obj, uint32 eventId); bool FindAndRemoveVehicleFromList(Unit* vehicle); // returns the graveyardId in the specified area. uint8 GetSpiritGraveyardId(uint32 areaId) const; - uint32 GetAreaByGraveyardId(uint8 gId) const; + uint32 GetAreaByGraveyardId(uint8 gId) const; uint32 GetData(uint32 data) const; protected: @@ -435,10 +435,10 @@ class BattlefieldWG : public Battlefield GuidSet CanonList; GuidSet KeepCreature[2]; GuidSet OutsideCreature[2]; - GuidSet m_updateTenacityList; + GuidSet m_updateTenacityList; int32 m_tenacityStack; - uint32 m_tenacityUpdateTimer; + uint32 m_tenacityUpdateTimer; uint32 m_saveTimer; uint64 m_titansRelic; @@ -498,31 +498,31 @@ enum WintergraspWorldstates // TODO: Handle this with creature_text ? enum eWGText { - BATTLEFIELD_WG_TEXT_START = 0, + BATTLEFIELD_WG_TEXT_START = 0, BATTLEFIELD_WG_TEXT_WORKSHOP_NE_ATTACK = 19, // Ally, horde +2 BATTLEFIELD_WG_TEXT_WORKSHOP_NW_ATTACK = 11, // Ally, horde +2 BATTLEFIELD_WG_TEXT_WORKSHOP_SE_ATTACK = 15, // Ally, horde +2 BATTLEFIELD_WG_TEXT_WORKSHOP_SW_ATTACK = 23, // Ally, horde +2 - BATTLEFIELD_WG_TEXT_WORKSHOP_NE_TAKEN = 20, // Ally, horde +2 + BATTLEFIELD_WG_TEXT_WORKSHOP_NE_TAKEN = 20, // Ally, horde +2 BATTLEFIELD_WG_TEXT_WORKSHOP_NW_TAKEN = 12, // Ally, horde +2 BATTLEFIELD_WG_TEXT_WORKSHOP_SE_TAKEN = 16, // Ally, horde +2 BATTLEFIELD_WG_TEXT_WORKSHOP_SW_TAKEN = 24, // Ally, horde +2 - BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 27, // Ally, horde +2 + BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 27, // Ally, horde +2 BATTLEFIELD_WG_TEXT_WIN_KEEP = 28, // Ally, horde +2 BATTLEFIELD_WG_TEXT_WILL_START = 31, BATTLEFIELD_WG_TEXT_FIRSTRANK = 32, BATTLEFIELD_WG_TEXT_SECONDRANK = 33, - BATTLEFIELD_WG_TEXT_TOWER_S_DAMAGED = 1, + BATTLEFIELD_WG_TEXT_TOWER_S_DAMAGED = 1, BATTLEFIELD_WG_TEXT_TOWER_E_DAMAGED = 3, BATTLEFIELD_WG_TEXT_TOWER_W_DAMAGED = 5, - BATTLEFIELD_WG_TEXT_TOWER_S_DESTROYED = 2, + BATTLEFIELD_WG_TEXT_TOWER_S_DESTROYED = 2, BATTLEFIELD_WG_TEXT_TOWER_E_DESTROYED = 4, BATTLEFIELD_WG_TEXT_TOWER_W_DESTROYED = 6, BATTLEFIELD_WG_TEXT_KEEPTOWER_NE_DAMAGED = 36, BATTLEFIELD_WG_TEXT_KEEPTOWER_NW_DAMAGED = 34, BATTLEFIELD_WG_TEXT_KEEPTOWER_SE_DAMAGED = 38, BATTLEFIELD_WG_TEXT_KEEPTOWER_SW_DAMAGED = 40, - BATTLEFIELD_WG_TEXT_KEEPTOWER_NE_DESTROYED = 37, + BATTLEFIELD_WG_TEXT_KEEPTOWER_NE_DESTROYED = 37, BATTLEFIELD_WG_TEXT_KEEPTOWER_NW_DESTROYED = 35, BATTLEFIELD_WG_TEXT_KEEPTOWER_SE_DESTROYED = 39, BATTLEFIELD_WG_TEXT_KEEPTOWER_SW_DESTROYED = 41, @@ -571,7 +571,7 @@ struct WintergraspBuildingSpawnData float o; uint32 type; uint32 damageText; - uint32 destroyText; + uint32 destroyText; }; const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = { @@ -637,38 +637,38 @@ const Position WGTurret[WG_MAX_TURRET] = { { 5390.95f, 2615.5f, 421.126f, 4.6409f }, { 5148.8f, 2820.24f, 421.621f, 3.16043f }, { 5147.98f, 2861.93f, 421.63f, 3.18792f }, - { 5352.22f, 3061.46f, 421.102f, 1.52235f } + { 5352.22f, 3061.46f, 421.102f, 1.52235f } }; static bool IsKeepNpc(uint32 entry) { - switch (entry) - { - case BATTLEFIELD_WG_NPC_GUARD_H: - case BATTLEFIELD_WG_NPC_GUARD_A: - case BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER: - case BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH: - case BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR: - case BATTLEFIELD_WG_NPC_KNIGHT_DAMERON: - case BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN: - case BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA: - case BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI: - case BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER: - case BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH: - case BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH: - case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH: - case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS: - case BATTLEFIELD_WG_NPC_HORDE_WARBRINGER: - case BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL: - case BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF: - case BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE: - case BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT: - case BATTLEFIELD_WG_NPC_ANCHORITE_TESSA: - case BATTLEFIELD_WG_NPC_LIEUTENANT_MURP: - case BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO: - return true; - } - return false; + switch (entry) + { + case BATTLEFIELD_WG_NPC_GUARD_H: + case BATTLEFIELD_WG_NPC_GUARD_A: + case BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER: + case BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH: + case BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR: + case BATTLEFIELD_WG_NPC_KNIGHT_DAMERON: + case BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN: + case BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA: + case BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI: + case BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER: + case BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH: + case BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH: + case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH: + case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS: + case BATTLEFIELD_WG_NPC_HORDE_WARBRINGER: + case BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL: + case BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF: + case BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE: + case BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT: + case BATTLEFIELD_WG_NPC_ANCHORITE_TESSA: + case BATTLEFIELD_WG_NPC_LIEUTENANT_MURP: + case BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO: + return true; + } + return false; } // Here there is all npc keeper spawn point @@ -690,13 +690,13 @@ const WintergraspObjectPositionData WGKeepNPC[WG_MAX_KEEP_NPC] = { 5388.560059f, 2834.770020f, 418.759003f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard { 5359.129883f, 2837.989990f, 409.364014f, 4.698930f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, // Commander Dardosh { 5366.129883f, 2833.399902f, 409.322998f, 3.141590f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, // Tactical Officer Kilrath - { 5467.590000f, 2841.060000f, 418.758000f, 1.396260f, BATTLEFIELD_WG_NPC_HORDE_WARBRINGER, BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL }, // Battlemaster + { 5467.590000f, 2841.060000f, 418.758000f, 1.396260f, BATTLEFIELD_WG_NPC_HORDE_WARBRINGER, BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL }, // Battlemaster - { 5415.120000f, 2811.420000f, 418.758000f, 2.321290f, BATTLEFIELD_WG_NPC_AV_PORTAL_HORDE, BATTLEFIELD_WG_NPC_AV_PORTAL_ALLY }, // Portal - { 5467.560000f, 2810.080000f, 418.758000f, 0.837758f, BATTLEFIELD_WG_NPC_AB_PORTAL_HORDE, BATTLEFIELD_WG_NPC_AB_PORTAL_ALLY }, // Portal - { 5476.330000f, 2863.210000f, 418.758000f, 0.471239f, BATTLEFIELD_WG_NPC_EOTS_PORTAL_HORDE, BATTLEFIELD_WG_NPC_EOTS_PORTAL_ALLY }, // Portal - { 5468.270000f, 2871.140000f, 418.758000f, 0.000000f, BATTLEFIELD_WG_NPC_SOTA_PORTAL_HORDE, BATTLEFIELD_WG_NPC_SOTA_PORTAL_ALLY }, // Portal - { 5476.100000f, 2818.040000f, 418.758000f, 4.380780f, BATTLEFIELD_WG_NPC_WG_PORTAL_HORDE, BATTLEFIELD_WG_NPC_WG_PORTAL_ALLY }, // Portal + { 5415.120000f, 2811.420000f, 418.758000f, 2.321290f, BATTLEFIELD_WG_NPC_AV_PORTAL_HORDE, BATTLEFIELD_WG_NPC_AV_PORTAL_ALLY }, // Portal + { 5467.560000f, 2810.080000f, 418.758000f, 0.837758f, BATTLEFIELD_WG_NPC_AB_PORTAL_HORDE, BATTLEFIELD_WG_NPC_AB_PORTAL_ALLY }, // Portal + { 5476.330000f, 2863.210000f, 418.758000f, 0.471239f, BATTLEFIELD_WG_NPC_EOTS_PORTAL_HORDE, BATTLEFIELD_WG_NPC_EOTS_PORTAL_ALLY }, // Portal + { 5468.270000f, 2871.140000f, 418.758000f, 0.000000f, BATTLEFIELD_WG_NPC_SOTA_PORTAL_HORDE, BATTLEFIELD_WG_NPC_SOTA_PORTAL_ALLY }, // Portal + { 5476.100000f, 2818.040000f, 418.758000f, 4.380780f, BATTLEFIELD_WG_NPC_WG_PORTAL_HORDE, BATTLEFIELD_WG_NPC_WG_PORTAL_ALLY }, // Portal // X Y Z O horde alliance // North West @@ -1059,7 +1059,7 @@ struct WGWorkshopData uint8 id; uint32 worldstate; uint8 attackText; - uint8 takenText; + uint8 takenText; }; const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] = @@ -1093,7 +1093,7 @@ struct BfWGGameObjectBuilding m_WorldState = 0; m_State = 0; m_damagedText = 0; - m_destroyedText = 0; + m_destroyedText = 0; } // the team that controls this point @@ -1116,7 +1116,7 @@ struct BfWGGameObjectBuilding // Name id for warning text uint8 m_damagedText; - uint8 m_destroyedText; + uint8 m_destroyedText; // GameObject associations GameObjectSet m_GameObjectList[2]; @@ -1145,13 +1145,13 @@ struct BfWGGameObjectBuilding break; } - GameObject* go = ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL); - if (go) - { - // Rebuild gameobject - go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); - go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]); - } + GameObject* go = ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL); + if (go) + { + // Rebuild gameobject + go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); + go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]); + } // Update worldstate m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3); @@ -1171,7 +1171,7 @@ struct BfWGGameObjectBuilding m_WG->SendWarningToAllInZone(m_damagedText); for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr) - if (Unit* unit = ObjectAccessor::FindUnit(*itr)) + if (Unit* unit = ObjectAccessor::FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) m_WG->HideNpc(creature); @@ -1199,8 +1199,8 @@ struct BfWGGameObjectBuilding { // Inform the global wintergrasp script of the destruction of this object case BATTLEFIELD_WG_OBJECTTYPE_TOWER: - m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL)); - break; + m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL)); + break; case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: m_WG->SetRelicInteractible(true); if (GameObject* go = m_WG->GetRelic()) @@ -1208,11 +1208,11 @@ struct BfWGGameObjectBuilding else sLog->outError("BattlefieldWG: Relic not found."); break; - case BATTLEFIELD_WG_OBJECTTYPE_DOOR: - case BATTLEFIELD_WG_OBJECTTYPE_WALL: - case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER: - m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL)); - break; + case BATTLEFIELD_WG_OBJECTTYPE_DOOR: + case BATTLEFIELD_WG_OBJECTTYPE_WALL: + case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER: + m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL)); + break; } m_WG->BrokenWallOrTower(TeamId(m_Team)); @@ -1231,7 +1231,7 @@ struct BfWGGameObjectBuilding // NameId for Warning text m_damagedText = damageText; - m_destroyedText = destroyText; + m_destroyedText = destroyText; switch (m_Type) { @@ -1388,17 +1388,17 @@ struct BfWGGameObjectBuilding void UpdateTurretAttack(bool disable) { - GameObject* build = ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL); - if (!build) - return; + GameObject* build = ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL); + if (!build) + return; - uint32 faction = 0; - switch (build->GetEntry()) + uint32 faction = 0; + switch (build->GetEntry()) { case GO_WINTERGRASP_FORTRESS_TOWER_1: case GO_WINTERGRASP_FORTRESS_TOWER_2: - case GO_WINTERGRASP_FORTRESS_TOWER_3: - case GO_WINTERGRASP_FORTRESS_TOWER_4: + case GO_WINTERGRASP_FORTRESS_TOWER_3: + case GO_WINTERGRASP_FORTRESS_TOWER_4: faction = WintergraspFaction[m_WG->GetDefenderTeam()]; break; case GO_WINTERGRASP_SHADOWSIGHT_TOWER: @@ -1408,19 +1408,19 @@ struct BfWGGameObjectBuilding break; } - for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr) - { + for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr) + { if (Unit* unit = ObjectAccessor::FindUnit(*itr)) - { + { if (Creature* creature = unit->ToCreature()) - { - creature->setFaction(faction); + { + creature->setFaction(faction); if (disable) m_WG->HideNpc(creature); else m_WG->ShowNpc(creature, true); - } - } + } + } } for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr) @@ -1429,7 +1429,7 @@ struct BfWGGameObjectBuilding { if (Creature* creature = unit->ToCreature()) { - creature->setFaction(faction); + creature->setFaction(faction); if (disable) m_WG->HideNpc(creature); else @@ -1499,10 +1499,10 @@ struct WGWorkshop } if (!init) - { + { bf->UpdateCounterVehicle(false); - bf->CapturePointTaken(bf->GetAreaByGraveyardId(workshopId)); - } + bf->CapturePointTaken(bf->GetAreaByGraveyardId(workshopId)); + } } void UpdateGraveyardAndWorkshop() diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 09b0177e7..1448ef2d0 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -94,7 +94,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) if (GetMembersSize() >= GetType() * 2) return false; - // xinef: Get player name and class from player storage or global data storage + // xinef: Get player name and class from player storage or global data storage Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(playerGuid); if (player) { @@ -103,12 +103,12 @@ bool ArenaTeam::AddMember(uint64 playerGuid) } else { - GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(playerGuid)); - if (!playerData) - return false; + GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(playerGuid)); + if (!playerData) + return false; - playerName = playerData->name; - playerClass = playerData->playerClass; + playerName = playerData->name; + playerClass = playerData->playerClass; } // Check if player is already in a similar arena team @@ -126,7 +126,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) else if (GetRating() >= 1000) personalRating = 1000; - // xinef: zomg! sync query + // xinef: zomg! sync query // Try to get player's match maker rating from db and fall back to config setting if not found PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING); stmt->setUInt32(0, GUID_LOPART(playerGuid)); @@ -162,10 +162,10 @@ bool ArenaTeam::AddMember(uint64 playerGuid) newMember.WeekWins = 0; newMember.PersonalRating = personalRating; newMember.MatchMakerRating = matchMakerRating; - newMember.MaxMMR = maxMMR; + newMember.MaxMMR = maxMMR; Members.push_back(newMember); - sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(playerGuid), GetSlot(), GetId()); + sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(playerGuid), GetSlot(), GetId()); // Save player's arena team membership to db stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER); @@ -244,7 +244,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) newMember.Class = fields[7].GetUInt8(); newMember.PersonalRating = fields[8].GetUInt16(); newMember.MatchMakerRating = fields[9].GetUInt16() > 0 ? fields[9].GetUInt16() : sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING);; - newMember.MaxMMR = std::max(fields[10].GetUInt16(), newMember.MatchMakerRating); + newMember.MaxMMR = std::max(fields[10].GetUInt16(), newMember.MatchMakerRating); // Delete member if character information is missing if (fields[6].GetString().empty()) @@ -260,7 +260,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) // Put the player in the team Members.push_back(newMember); - sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(newMember.Guid), GetSlot(), GetId()); + sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(newMember.Guid), GetSlot(), GetId()); } while (result->NextRow()); @@ -310,7 +310,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb) if (itr->Guid == guid) { Members.erase(itr); - sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(guid), GetSlot(), 0); + sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(guid), GetSlot(), 0); break; } @@ -367,7 +367,7 @@ void ArenaTeam::Roster(WorldSession* session) Player* player = NULL; uint8 unk308 = 0; - std::string tempName; + std::string tempName; WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100); data << uint32(GetId()); // team id @@ -381,9 +381,9 @@ void ArenaTeam::Roster(WorldSession* session) data << uint64(itr->Guid); // guid data << uint8((player ? 1 : 0)); // online flag - tempName = ""; - sObjectMgr->GetPlayerNameByGUID(itr->Guid, tempName); - data << tempName; // member name + tempName = ""; + sObjectMgr->GetPlayerNameByGUID(itr->Guid, tempName); + data << tempName; // member name data << uint32((itr->Guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member data << uint8((player ? player->getLevel() : 0)); // unknown, level? data << uint8(itr->Class); // class @@ -474,20 +474,20 @@ void ArenaTeamMember::ModifyPersonalRating(Player* player, int32 mod, uint32 typ void ArenaTeamMember::ModifyMatchmakerRating(int32 mod, uint32 /*slot*/) { - if (mod < 0) - { - // pussywizard: prevent lowering MMR too much from max achieved MMR - int32 maxAllowedDrop = (int32)sWorld->getIntConfig(CONFIG_MAX_ALLOWED_MMR_DROP); - mod = std::min(std::max(-((int32)MatchMakerRating - (int32)MaxMMR + maxAllowedDrop), mod), 0); - } + if (mod < 0) + { + // pussywizard: prevent lowering MMR too much from max achieved MMR + int32 maxAllowedDrop = (int32)sWorld->getIntConfig(CONFIG_MAX_ALLOWED_MMR_DROP); + mod = std::min(std::max(-((int32)MatchMakerRating - (int32)MaxMMR + maxAllowedDrop), mod), 0); + } if (int32(MatchMakerRating) + mod < 0) MatchMakerRating = 0; else MatchMakerRating += mod; - if (MatchMakerRating > MaxMMR) - MaxMMR = MatchMakerRating; + if (MatchMakerRating > MaxMMR) + MaxMMR = MatchMakerRating; } void ArenaTeam::BroadcastPacket(WorldPacket* packet) @@ -785,11 +785,11 @@ void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32 itr->ModifyPersonalRating(player, mod, GetType()); // update matchmaker rating (pussywizard: but don't allow it to go over team rating) - if (itr->MatchMakerRating < Stats.Rating) - { - mod = std::min(MatchmakerRatingChange, Stats.Rating - itr->MatchMakerRating); - itr->ModifyMatchmakerRating(mod, GetSlot()); - } + if (itr->MatchMakerRating < Stats.Rating) + { + mod = std::min(MatchmakerRatingChange, Stats.Rating - itr->MatchMakerRating); + itr->ModifyMatchmakerRating(mod, GetSlot()); + } // update personal stats itr->WeekGames +=1; @@ -867,7 +867,7 @@ void ArenaTeam::SaveToDB() stmt->setUInt32(0, GUID_LOPART(itr->Guid)); stmt->setUInt8(1, GetSlot()); stmt->setUInt16(2, itr->MatchMakerRating); - stmt->setUInt16(3, itr->MaxMMR); + stmt->setUInt16(3, itr->MaxMMR); trans->Append(stmt); } @@ -900,7 +900,7 @@ bool ArenaTeam::IsFighting() const ArenaTeamMember* ArenaTeam::GetMember(const std::string& name) { - return GetMember(sObjectMgr->GetPlayerGUIDByName(name)); + return GetMember(sObjectMgr->GetPlayerGUIDByName(name)); } ArenaTeamMember* ArenaTeam::GetMember(uint64 guid) diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h index 6817a8a13..dc9594d21 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.h +++ b/src/server/game/Battlegrounds/ArenaTeam.h @@ -97,7 +97,7 @@ struct ArenaTeamMember uint16 SeasonWins; uint16 PersonalRating; uint16 MatchMakerRating; - uint16 MaxMMR; + uint16 MaxMMR; void ModifyPersonalRating(Player* player, int32 mod, uint32 type); void ModifyMatchmakerRating(int32 mod, uint32 slot); diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index a2d407f16..4e023bbb0 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -27,7 +27,7 @@ ArenaTeamMgr::ArenaTeamMgr() { NextArenaTeamId = 1; - LastArenaLogId = 0; + LastArenaLogId = 0; } ArenaTeamMgr::~ArenaTeamMgr() diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.h b/src/server/game/Battlegrounds/ArenaTeamMgr.h index 4590e41c2..42cc5384d 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.h +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.h @@ -45,13 +45,13 @@ public: uint32 GenerateArenaTeamId(); void SetNextArenaTeamId(uint32 Id) { NextArenaTeamId = Id; } - uint32 GetNextArenaLogId() { return ++LastArenaLogId; } - void SetLastArenaLogId(uint32 id) { LastArenaLogId = id; } + uint32 GetNextArenaLogId() { return ++LastArenaLogId; } + void SetLastArenaLogId(uint32 id) { LastArenaLogId = id; } protected: uint32 NextArenaTeamId; ArenaTeamContainer ArenaTeamStore; - uint32 LastArenaLogId; + uint32 LastArenaLogId; }; #define sArenaTeamMgr ACE_Singleton::instance() diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 1378d45db..3300aab3e 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -175,8 +175,8 @@ Battleground::Battleground() m_PlayersCount[TEAM_ALLIANCE] = 0; m_PlayersCount[TEAM_HORDE] = 0; - m_BgInvitedPlayers[TEAM_ALLIANCE]= 0; - m_BgInvitedPlayers[TEAM_HORDE] = 0; + m_BgInvitedPlayers[TEAM_ALLIANCE]= 0; + m_BgInvitedPlayers[TEAM_HORDE] = 0; m_TeamScores[TEAM_ALLIANCE] = 0; m_TeamScores[TEAM_HORDE] = 0; @@ -196,8 +196,8 @@ Battleground::Battleground() StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; - // pussywizard: - m_UpdateTimer = 0; + // pussywizard: + m_UpdateTimer = 0; } Battleground::~Battleground() @@ -228,13 +228,13 @@ Battleground::~Battleground() void Battleground::Update(uint32 diff) { - // pussywizard: - m_UpdateTimer += diff; - if (m_UpdateTimer < BATTLEGROUND_UPDATE_INTERVAL) - return; + // pussywizard: + m_UpdateTimer += diff; + if (m_UpdateTimer < BATTLEGROUND_UPDATE_INTERVAL) + return; - diff = BATTLEGROUND_UPDATE_INTERVAL; // just change diff value, no need to replace variable name in many places - m_UpdateTimer -= BATTLEGROUND_UPDATE_INTERVAL; + diff = BATTLEGROUND_UPDATE_INTERVAL; // just change diff value, no need to replace variable name in many places + m_UpdateTimer -= BATTLEGROUND_UPDATE_INTERVAL; if (!PreUpdateImpl(diff)) return; @@ -303,7 +303,7 @@ inline void Battleground::_CheckSafePositions(uint32 diff) float x, y, z, o; for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) { - itr->second->GetPosition(&pos); + itr->second->GetPosition(&pos); GetTeamStartLoc(itr->second->GetBgTeamId(), x, y, z, o); if (pos.GetExactDistSq(x, y, z) > maxDist) { @@ -468,32 +468,32 @@ inline void Battleground::_ProcessJoin(uint32 diff) m_Events |= BG_STARTING_EVENT_3; SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); - if (isArena()) - switch (GetBgTypeID()) - { - case BATTLEGROUND_NA: - DelObject(BG_NA_OBJECT_READY_MARKER_1); - DelObject(BG_NA_OBJECT_READY_MARKER_2); - break; - case BATTLEGROUND_BE: - DelObject(BG_BE_OBJECT_READY_MARKER_1); - DelObject(BG_BE_OBJECT_READY_MARKER_2); - break; - case BATTLEGROUND_RL: - DelObject(BG_RL_OBJECT_READY_MARKER_1); - DelObject(BG_RL_OBJECT_READY_MARKER_2); - break; - case BATTLEGROUND_DS: - DelObject(BG_DS_OBJECT_READY_MARKER_1); - DelObject(BG_DS_OBJECT_READY_MARKER_2); - break; - case BATTLEGROUND_RV: - DelObject(BG_RV_OBJECT_READY_MARKER_1); - DelObject(BG_RV_OBJECT_READY_MARKER_2); - break; - default: - break; - } + if (isArena()) + switch (GetBgTypeID()) + { + case BATTLEGROUND_NA: + DelObject(BG_NA_OBJECT_READY_MARKER_1); + DelObject(BG_NA_OBJECT_READY_MARKER_2); + break; + case BATTLEGROUND_BE: + DelObject(BG_BE_OBJECT_READY_MARKER_1); + DelObject(BG_BE_OBJECT_READY_MARKER_2); + break; + case BATTLEGROUND_RL: + DelObject(BG_RL_OBJECT_READY_MARKER_1); + DelObject(BG_RL_OBJECT_READY_MARKER_2); + break; + case BATTLEGROUND_DS: + DelObject(BG_DS_OBJECT_READY_MARKER_1); + DelObject(BG_DS_OBJECT_READY_MARKER_2); + break; + case BATTLEGROUND_RV: + DelObject(BG_RV_OBJECT_READY_MARKER_1); + DelObject(BG_RV_OBJECT_READY_MARKER_2); + break; + default: + break; + } } // Delay expired (after 2 or 1 minute) else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4)) @@ -541,31 +541,31 @@ inline void Battleground::_ProcessJoin(uint32 diff) player->UpdateObjectVisibility(true); } - for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr) - ArenaSpectator::HandleResetCommand(*itr); + for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr) + ArenaSpectator::HandleResetCommand(*itr); CheckArenaWinConditions(); - // pussywizard: arena spectator stuff - if (GetStatus() == STATUS_IN_PROGRESS) - { - for (ToBeTeleportedMap::const_iterator itr = m_ToBeTeleported.begin(); itr != m_ToBeTeleported.end(); ++itr) - if (Player* p = ObjectAccessor::GetObjectInOrOutOfWorld(itr->first, (Player*)NULL)) - if (Player* t = ObjectAccessor::FindPlayer(itr->second)) - { - if (!t->FindMap() || t->FindMap() != GetBgMap()) - continue; + // pussywizard: arena spectator stuff + if (GetStatus() == STATUS_IN_PROGRESS) + { + for (ToBeTeleportedMap::const_iterator itr = m_ToBeTeleported.begin(); itr != m_ToBeTeleported.end(); ++itr) + if (Player* p = ObjectAccessor::GetObjectInOrOutOfWorld(itr->first, (Player*)NULL)) + if (Player* t = ObjectAccessor::FindPlayer(itr->second)) + { + if (!t->FindMap() || t->FindMap() != GetBgMap()) + continue; - p->SetSummonPoint(t->GetMapId(), t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 15, true); + p->SetSummonPoint(t->GetMapId(), t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 15, true); - WorldPacket data(SMSG_SUMMON_REQUEST, 8+4+4); - data << uint64(t->GetGUID()); - data << uint32(t->GetZoneId()); - data << uint32(15*IN_MILLISECONDS); - p->GetSession()->SendPacket(&data); - } - m_ToBeTeleported.clear(); - } + WorldPacket data(SMSG_SUMMON_REQUEST, 8+4+4); + data << uint64(t->GetGUID()); + data << uint32(t->GetZoneId()); + data << uint32(15*IN_MILLISECONDS); + p->GetSession()->SendPacket(&data); + } + m_ToBeTeleported.clear(); + } } else { @@ -599,7 +599,7 @@ inline void Battleground::_ProcessLeave(uint32 diff) { next = itr; ++next; - itr->second->LeaveBattleground(this); //itr is erased here! + itr->second->LeaveBattleground(this); //itr is erased here! } } } @@ -621,7 +621,7 @@ void Battleground::SendPacketToAll(WorldPacket* packet) void Battleground::SendPacketToTeam(TeamId teamId, WorldPacket* packet, Player* sender, bool self) { for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - if (itr->second->GetBgTeamId() == teamId && (self || sender != itr->second)) + if (itr->second->GetBgTeamId() == teamId && (self || sender != itr->second)) itr->second->GetSession()->SendPacket(packet); } @@ -651,8 +651,8 @@ void Battleground::YellToAll(Creature* creature, char const* text, uint32 langua for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { WorldPacket data; - ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, Language(language), creature, itr->second, text); - itr->second->SendDirectMessage(&data); + ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, Language(language), creature, itr->second, text); + itr->second->SendDirectMessage(&data); } } @@ -668,12 +668,12 @@ void Battleground::RewardReputationToTeam(uint32 factionId, uint32 reputation, T if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId)) for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) if (itr->second->GetBgTeamId() == teamId) - { - uint32 repGain = reputation; - AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN)); - AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, factionId)); - itr->second->GetReputationMgr().ModifyReputation(factionEntry, repGain); - } + { + uint32 repGain = reputation; + AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN)); + AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, factionId)); + itr->second->GetReputationMgr().ModifyReputation(factionEntry, repGain); + } } void Battleground::UpdateWorldState(uint32 Field, uint32 Value) @@ -692,15 +692,15 @@ void Battleground::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* void Battleground::EndBattleground(TeamId winnerTeamId) { - // xinef: if this is true, it means that endbattleground is called second time - // skip to avoid double rating reduce / add - // can bug out due to multithreading ? - // set as fast as possible - if (GetStatus() == STATUS_WAIT_LEAVE) - return; - uint32 startDelay = StartDelayTimes[BG_STARTING_EVENT_FIRST]; // = BG_START_DELAY_1M = 60000 for all arenas - bool bValidArena = isArena() && isRated() && GetStatus() == STATUS_IN_PROGRESS && GetStartTime() >= startDelay+15000; // pussywizard: only if arena lasted at least 15 secs - SetStatus(STATUS_WAIT_LEAVE); + // xinef: if this is true, it means that endbattleground is called second time + // skip to avoid double rating reduce / add + // can bug out due to multithreading ? + // set as fast as possible + if (GetStatus() == STATUS_WAIT_LEAVE) + return; + uint32 startDelay = StartDelayTimes[BG_STARTING_EVENT_FIRST]; // = BG_START_DELAY_1M = 60000 for all arenas + bool bValidArena = isArena() && isRated() && GetStatus() == STATUS_IN_PROGRESS && GetStartTime() >= startDelay+15000; // pussywizard: only if arena lasted at least 15 secs + SetStatus(STATUS_WAIT_LEAVE); ArenaTeam* winnerArenaTeam = NULL; ArenaTeam* loserArenaTeam = NULL; @@ -718,18 +718,18 @@ void Battleground::EndBattleground(TeamId winnerTeamId) if (winnerTeamId == TEAM_ALLIANCE) { - SetWinner(TEAM_HORDE); // reversed in packet + SetWinner(TEAM_HORDE); // reversed in packet winmsg_id = isBattleground() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS; PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound } else if (winnerTeamId == TEAM_HORDE) { - SetWinner(TEAM_ALLIANCE); // reversed in packet + SetWinner(TEAM_ALLIANCE); // reversed in packet winmsg_id = isBattleground() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS; PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound } - else - SetWinner(TEAM_NEUTRAL); + else + SetWinner(TEAM_NEUTRAL); //we must set it this way, because end time is sent in packet! m_EndTime = TIME_TO_AUTOREMOVE; @@ -756,58 +756,58 @@ void Battleground::EndBattleground(TeamId winnerTeamId) SetArenaTeamRatingChangeForTeam(GetOtherTeamId(winnerTeamId), loserChange); // pussywizard: arena logs in database - uint32 fightId = sArenaTeamMgr->GetNextArenaLogId(); + uint32 fightId = sArenaTeamMgr->GetNextArenaLogId(); uint32 currOnline = (uint32)(sWorld->GetActiveSessionCount()); - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT); - stmt->setUInt32(0, fightId); - stmt->setUInt8(1, m_ArenaType); - stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000)); - stmt->setUInt32(3, winnerArenaTeam->GetId()); - stmt->setUInt32(4, loserArenaTeam->GetId()); - stmt->setUInt16(5, (uint16)winnerTeamRating); - stmt->setUInt16(6, (uint16)winnerMatchmakerRating); - stmt->setInt16(7, (int16)winnerChange); - stmt->setUInt16(8, (uint16)loserTeamRating); - stmt->setUInt16(9, (uint16)loserMatchmakerRating); - stmt->setInt16(10, (int16)loserChange); - stmt->setUInt32(11, currOnline); - trans->Append(stmt); + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT); + stmt->setUInt32(0, fightId); + stmt->setUInt8(1, m_ArenaType); + stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000)); + stmt->setUInt32(3, winnerArenaTeam->GetId()); + stmt->setUInt32(4, loserArenaTeam->GetId()); + stmt->setUInt16(5, (uint16)winnerTeamRating); + stmt->setUInt16(6, (uint16)winnerMatchmakerRating); + stmt->setInt16(7, (int16)winnerChange); + stmt->setUInt16(8, (uint16)loserTeamRating); + stmt->setUInt16(9, (uint16)loserMatchmakerRating); + stmt->setInt16(10, (int16)loserChange); + stmt->setUInt32(11, currOnline); + trans->Append(stmt); - uint8 memberId = 0; + uint8 memberId = 0; for (Battleground::ArenaLogEntryDataMap::const_iterator itr = ArenaLogEntries.begin(); itr != ArenaLogEntries.end(); ++itr) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS); - stmt->setUInt32(0, fightId); - stmt->setUInt8(1, ++memberId); - stmt->setString(2, itr->second.Name); - stmt->setUInt32(3, itr->second.Guid); - stmt->setUInt32(4, itr->second.ArenaTeamId); - stmt->setUInt32(5, itr->second.Acc); - stmt->setString(6, itr->second.IP); - stmt->setUInt32(7, itr->second.DamageDone); - stmt->setUInt32(8, itr->second.HealingDone); - stmt->setUInt32(9, itr->second.KillingBlows); - trans->Append(stmt); - } + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS); + stmt->setUInt32(0, fightId); + stmt->setUInt8(1, ++memberId); + stmt->setString(2, itr->second.Name); + stmt->setUInt32(3, itr->second.Guid); + stmt->setUInt32(4, itr->second.ArenaTeamId); + stmt->setUInt32(5, itr->second.Acc); + stmt->setString(6, itr->second.IP); + stmt->setUInt32(7, itr->second.DamageDone); + stmt->setUInt32(8, itr->second.HealingDone); + stmt->setUInt32(9, itr->second.KillingBlows); + trans->Append(stmt); + } - CharacterDatabase.CommitTransaction(trans); - } + CharacterDatabase.CommitTransaction(trans); + } // Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes else { - // pussywizard: in case of a draw, the following is always true: - // winnerArenaTeam => TEAM_HORDE, loserArenaTeam => TEAM_ALLIANCE + // pussywizard: in case of a draw, the following is always true: + // winnerArenaTeam => TEAM_HORDE, loserArenaTeam => TEAM_ALLIANCE winnerTeamRating = winnerArenaTeam->GetRating(); winnerMatchmakerRating = GetArenaMatchmakerRating(TEAM_HORDE); - loserTeamRating = loserArenaTeam->GetRating(); + loserTeamRating = loserArenaTeam->GetRating(); loserMatchmakerRating = GetArenaMatchmakerRating(TEAM_ALLIANCE); - winnerMatchmakerChange = 0; + winnerMatchmakerChange = 0; loserMatchmakerChange = 0; - winnerChange = ARENA_TIMELIMIT_POINTS_LOSS; - loserChange = ARENA_TIMELIMIT_POINTS_LOSS; + winnerChange = ARENA_TIMELIMIT_POINTS_LOSS; + loserChange = ARENA_TIMELIMIT_POINTS_LOSS; SetArenaTeamRatingChangeForTeam(TEAM_ALLIANCE, ARENA_TIMELIMIT_POINTS_LOSS); SetArenaTeamRatingChangeForTeam(TEAM_HORDE, ARENA_TIMELIMIT_POINTS_LOSS); @@ -815,43 +815,43 @@ void Battleground::EndBattleground(TeamId winnerTeamId) loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS, GetBgMap()); // pussywizard: arena logs in database - uint32 fightId = sArenaTeamMgr->GetNextArenaLogId(); + uint32 fightId = sArenaTeamMgr->GetNextArenaLogId(); uint32 currOnline = (uint32)(sWorld->GetActiveSessionCount()); - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT); - stmt->setUInt32(0, fightId); - stmt->setUInt8(1, m_ArenaType); - stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000)); - stmt->setUInt32(3, winnerArenaTeam->GetId()); - stmt->setUInt32(4, loserArenaTeam->GetId()); - stmt->setUInt16(5, (uint16)winnerTeamRating); - stmt->setUInt16(6, (uint16)winnerMatchmakerRating); - stmt->setInt16(7, (int16)winnerChange); - stmt->setUInt16(8, (uint16)loserTeamRating); - stmt->setUInt16(9, (uint16)loserMatchmakerRating); - stmt->setInt16(10, (int16)loserChange); - stmt->setUInt32(11, currOnline); - trans->Append(stmt); + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT); + stmt->setUInt32(0, fightId); + stmt->setUInt8(1, m_ArenaType); + stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000)); + stmt->setUInt32(3, winnerArenaTeam->GetId()); + stmt->setUInt32(4, loserArenaTeam->GetId()); + stmt->setUInt16(5, (uint16)winnerTeamRating); + stmt->setUInt16(6, (uint16)winnerMatchmakerRating); + stmt->setInt16(7, (int16)winnerChange); + stmt->setUInt16(8, (uint16)loserTeamRating); + stmt->setUInt16(9, (uint16)loserMatchmakerRating); + stmt->setInt16(10, (int16)loserChange); + stmt->setUInt32(11, currOnline); + trans->Append(stmt); - uint8 memberId = 0; + uint8 memberId = 0; for (Battleground::ArenaLogEntryDataMap::const_iterator itr = ArenaLogEntries.begin(); itr != ArenaLogEntries.end(); ++itr) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS); - stmt->setUInt32(0, fightId); - stmt->setUInt8(1, ++memberId); - stmt->setString(2, itr->second.Name); - stmt->setUInt32(3, itr->second.Guid); - stmt->setUInt32(4, itr->second.ArenaTeamId); - stmt->setUInt32(5, itr->second.Acc); - stmt->setString(6, itr->second.IP); - stmt->setUInt32(7, itr->second.DamageDone); - stmt->setUInt32(8, itr->second.HealingDone); - stmt->setUInt32(9, itr->second.KillingBlows); - trans->Append(stmt); - } + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS); + stmt->setUInt32(0, fightId); + stmt->setUInt8(1, ++memberId); + stmt->setString(2, itr->second.Name); + stmt->setUInt32(3, itr->second.Guid); + stmt->setUInt32(4, itr->second.ArenaTeamId); + stmt->setUInt32(5, itr->second.Acc); + stmt->setString(6, itr->second.IP); + stmt->setUInt32(7, itr->second.DamageDone); + stmt->setUInt32(8, itr->second.HealingDone); + stmt->setUInt32(9, itr->second.KillingBlows); + trans->Append(stmt); + } - CharacterDatabase.CommitTransaction(trans); + CharacterDatabase.CommitTransaction(trans); } } else @@ -868,7 +868,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId) for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player* player = itr->second; - TeamId bgTeamId = player->GetBgTeamId(); + TeamId bgTeamId = player->GetBgTeamId(); // should remove spirit of redemption if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); @@ -894,15 +894,15 @@ void Battleground::EndBattleground(TeamId winnerTeamId) { if (bgTeamId == winnerTeamId) { - if (bValidArena) - { - // update achievement BEFORE personal rating update - uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot()); - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1); - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId()); + if (bValidArena) + { + // update achievement BEFORE personal rating update + uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot()); + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1); + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId()); - winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange); - } + winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange); + } } else { @@ -925,7 +925,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId) UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winner_kills)); // Xinef: check player level and not bracket level if (CanAwardArenaPoints()) - if (player->getLevel() >= BG_AWARD_ARENA_POINTS_MIN_LEVEL) + if (player->getLevel() >= BG_AWARD_ARENA_POINTS_MIN_LEVEL) player->ModifyArenaPoints(winner_arena); if (!player->GetRandomWinner()) @@ -983,7 +983,7 @@ void Battleground::BlockMovement(Player* player) void Battleground::RemovePlayerAtLeave(Player* player) { - TeamId teamId = player->GetBgTeamId(); + TeamId teamId = player->GetBgTeamId(); // check if the player was a participant of the match, or only entered through gm command bool participant = false; @@ -995,7 +995,7 @@ void Battleground::RemovePlayerAtLeave(Player* player) participant = true; } - // delete player score if exists + // delete player score if exists BattlegroundScoreMap::iterator itr2 = PlayerScores.find(player->GetGUID()); if (itr2 != PlayerScores.end()) { @@ -1005,7 +1005,7 @@ void Battleground::RemovePlayerAtLeave(Player* player) RemovePlayerFromResurrectQueue(player); - // resurrect on exit + // resurrect on exit if (!player->IsAlive()) { player->ResurrectPlayer(1.0f); @@ -1014,10 +1014,10 @@ void Battleground::RemovePlayerAtLeave(Player* player) player->RemoveAurasByType(SPELL_AURA_MOUNTED); - // BG subclass specific code + // BG subclass specific code RemovePlayer(player); - // if the player was a match participant + // if the player was a match participant if (participant) { WorldPacket data; @@ -1038,26 +1038,26 @@ void Battleground::RemovePlayerAtLeave(Player* player) // remove from raid group if player is member if (Group* group = GetBgRaid(teamId)) - if (group->IsMember(player->GetGUID())) - if (!group->RemoveMember(player->GetGUID())) // group was disbanded - SetBgRaid(teamId, NULL); + if (group->IsMember(player->GetGUID())) + if (!group->RemoveMember(player->GetGUID())) // group was disbanded + SetBgRaid(teamId, NULL); // let others know sBattlegroundMgr->BuildPlayerLeftBattlegroundPacket(&data, player->GetGUID()); SendPacketToTeam(teamId, &data, player, false); - // cast deserter - if (isBattleground() && !player->IsGameMaster() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_CAST_DESERTER)) - if (GetStatus() == STATUS_IN_PROGRESS || GetStatus() == STATUS_WAIT_JOIN) - player->ScheduleDelayedOperation(DELAYED_SPELL_CAST_DESERTER); + // cast deserter + if (isBattleground() && !player->IsGameMaster() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_CAST_DESERTER)) + if (GetStatus() == STATUS_IN_PROGRESS || GetStatus() == STATUS_WAIT_JOIN) + player->ScheduleDelayedOperation(DELAYED_SPELL_CAST_DESERTER); } - // Remove shapeshift auras - player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); + // Remove shapeshift auras + player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL); - // Xinef: remove all criterias on bg leave + // Xinef: remove all criterias on bg leave player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true); } @@ -1073,10 +1073,10 @@ void Battleground::Init() m_Events = 0; if (m_BgInvitedPlayers[TEAM_ALLIANCE] > 0 || m_BgInvitedPlayers[TEAM_HORDE] > 0) - { + { sLog->outError("Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", m_BgInvitedPlayers[TEAM_ALLIANCE], m_BgInvitedPlayers[TEAM_HORDE], m_MapId, m_InstanceID); - ASSERT(false); - } + ASSERT(false); + } m_BgInvitedPlayers[TEAM_ALLIANCE] = 0; m_BgInvitedPlayers[TEAM_HORDE] = 0; @@ -1142,10 +1142,10 @@ void Battleground::AddPlayer(Player* player) player->CastSpell(player, SPELL_ALLIANCE_GREEN_FLAG, true); } - // restore pets health before remove - if (Pet* pet = player->GetPet()) - if (pet->IsAlive()) - pet->SetHealth(pet->GetMaxHealth()); + // restore pets health before remove + if (Pet* pet = player->GetPet()) + if (pet->IsAlive()) + pet->SetHealth(pet->GetMaxHealth()); player->DestroyConjuredItems(true); player->UnsummonPetTemporaryIfAny(); @@ -1162,7 +1162,7 @@ void Battleground::AddPlayer(Player* player) player->CastSpell(player, SPELL_PREPARATION, true); // reduces all mana cost of spells. } - // Xinef: reset all map criterias on map enter + // Xinef: reset all map criterias on map enter player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true); // setup BG group membership @@ -1176,11 +1176,11 @@ void Battleground::AddPlayer(Player* player) // this method adds player to his team's bg group, or sets his correct group if player is already in bg group void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, TeamId teamId) { - if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup())) - { - sLog->outMisc("Battleground::AddOrSetPlayerToCorrectBgGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF")); - return; - } + if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup())) + { + sLog->outMisc("Battleground::AddOrSetPlayerToCorrectBgGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF")); + return; + } uint64 playerGuid = player->GetGUID(); Group* group = GetBgRaid(teamId); @@ -1193,7 +1193,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, TeamId teamId) else if (group->IsMember(playerGuid)) { uint8 subgroup = group->GetMemberGroup(playerGuid); - player->SetBattlegroundOrBattlefieldRaid(group, subgroup); + player->SetBattlegroundOrBattlefieldRaid(group, subgroup); } else { @@ -1215,39 +1215,39 @@ uint32 Battleground::GetFreeSlotsForTeam(TeamId teamId) const uint32 Battleground::GetMaxFreeSlots() const { - return std::max(GetFreeSlotsForTeam(TEAM_ALLIANCE), GetFreeSlotsForTeam(TEAM_HORDE)); + return std::max(GetFreeSlotsForTeam(TEAM_ALLIANCE), GetFreeSlotsForTeam(TEAM_HORDE)); } bool Battleground::HasFreeSlots() const { - if (GetStatus() != STATUS_WAIT_JOIN && GetStatus() != STATUS_IN_PROGRESS) - return false; - for (uint8 i=0; i 0) - return true; - return false; + if (GetStatus() != STATUS_WAIT_JOIN && GetStatus() != STATUS_IN_PROGRESS) + return false; + for (uint8 i=0; i 0) + return true; + return false; } void Battleground::SpectatorsSendPacket(WorldPacket& data) { - for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr) - (*itr)->GetSession()->SendPacket(&data); + for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr) + (*itr)->GetSession()->SendPacket(&data); } void Battleground::ReadyMarkerClicked(Player* p) { - if (!isArena() || GetStatus() >= STATUS_IN_PROGRESS || GetStartDelayTime() <= BG_START_DELAY_15S || (m_Events & BG_STARTING_EVENT_3) || p->IsSpectator()) - return; - readyMarkerClickedSet.insert(p->GetGUIDLow()); - uint32 count = readyMarkerClickedSet.size(); - uint32 req = GetArenaType()*2; - p->GetSession()->SendNotification("You are marked as ready %u/%u", count, req); - if (count == req) - { - m_Events |= BG_STARTING_EVENT_2; - m_StartTime += GetStartDelayTime()-BG_START_DELAY_15S; - SetStartDelayTime(BG_START_DELAY_15S); - } + if (!isArena() || GetStatus() >= STATUS_IN_PROGRESS || GetStartDelayTime() <= BG_START_DELAY_15S || (m_Events & BG_STARTING_EVENT_3) || p->IsSpectator()) + return; + readyMarkerClickedSet.insert(p->GetGUIDLow()); + uint32 count = readyMarkerClickedSet.size(); + uint32 req = GetArenaType()*2; + p->GetSession()->SendNotification("You are marked as ready %u/%u", count, req); + if (count == req) + { + m_Events |= BG_STARTING_EVENT_2; + m_StartTime += GetStartDelayTime()-BG_START_DELAY_15S; + SetStartDelayTime(BG_START_DELAY_15S); + } } void Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor) @@ -1486,10 +1486,10 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y, if (transport) { - transport->CalculatePassengerPosition(x, y, z, &o); - if (Creature* creature = transport->SummonCreature(entry, x, y, z, o, TEMPSUMMON_MANUAL_DESPAWN)) + transport->CalculatePassengerPosition(x, y, z, &o); + if (Creature* creature = transport->SummonCreature(entry, x, y, z, o, TEMPSUMMON_MANUAL_DESPAWN)) { - transport->AddPassenger(creature, true); + transport->AddPassenger(creature, true); BgCreatures[type] = creature->GetGUID(); return creature; } @@ -1531,9 +1531,9 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y, if (respawntime) creature->SetRespawnDelay(respawntime); - // Xinef: Set PVP state for vehicles, should be for all creatures in bg? - if (creature->IsVehicle()) - creature->SetPvP(true); + // Xinef: Set PVP state for vehicles, should be for all creatures in bg? + if (creature->IsVehicle()) + creature->SetPvP(true); return creature; } @@ -1670,9 +1670,9 @@ char const* Battleground::GetTrinityString(int32 entry) void Battleground::HandleTriggerBuff(GameObject* gameObject) { - // Xinef: crash fix? - if (GetStatus() != STATUS_IN_PROGRESS || !GetPlayersSize() || BgObjects.empty()) - return; + // Xinef: crash fix? + if (GetStatus() != STATUS_IN_PROGRESS || !GetPlayersSize() || BgObjects.empty()) + return; uint32 index = 0; for (; index < BgObjects.size() && BgObjects[index] != gameObject->GetGUID(); ++index); @@ -1680,19 +1680,19 @@ void Battleground::HandleTriggerBuff(GameObject* gameObject) return; if (m_BuffChange) - { - uint8 buff = urand(0, 2); - if (gameObject->GetEntry() != Buff_Entries[buff]) - { - SpawnBGObject(index, RESPAWN_ONE_DAY); - for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex) - if (gameObject->GetEntry() == Buff_Entries[currBuffTypeIndex]) - { - index -= currBuffTypeIndex; - index += buff; - } - } - } + { + uint8 buff = urand(0, 2); + if (gameObject->GetEntry() != Buff_Entries[buff]) + { + SpawnBGObject(index, RESPAWN_ONE_DAY); + for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex) + if (gameObject->GetEntry() == Buff_Entries[currBuffTypeIndex]) + { + index -= currBuffTypeIndex; + index += buff; + } + } + } SpawnBGObject(index, BUFF_RESPAWN_TIME); } @@ -1734,7 +1734,7 @@ void Battleground::HandleKillPlayer(Player* victim, Player* killer) TeamId Battleground::GetOtherTeamId(TeamId teamId) { - return teamId != TEAM_NEUTRAL ? (teamId == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE) : TEAM_NEUTRAL; + return teamId != TEAM_NEUTRAL ? (teamId == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE) : TEAM_NEUTRAL; } bool Battleground::IsPlayerInBattleground(uint64 guid) const diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 4b024062c..3aaa88fec 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -75,7 +75,7 @@ enum BattlegroundMarks SPELL_AV_MARK_WINNER = 24955, SPELL_SA_MARK_WINNER = 61160, SPELL_SA_MARK_LOSER = 61159, - SPELL_WG_MARK_WINNER = 56902, + SPELL_WG_MARK_WINNER = 56902, ITEM_AV_MARK_OF_HONOR = 20560, ITEM_WS_MARK_OF_HONOR = 20558, ITEM_AB_MARK_OF_HONOR = 20559, @@ -171,7 +171,7 @@ enum BattlegroundStatus enum BattlegroundTeams { - BG_TEAMS_COUNT = 2 + BG_TEAMS_COUNT = 2 }; struct BattlegroundObjectInfo @@ -256,30 +256,30 @@ struct BattlegroundScore uint32 BonusHonor; uint32 DamageDone; uint32 HealingDone; - Player* player; + Player* player; }; class ArenaLogEntryData { - public: - ArenaLogEntryData() : Guid(0), ArenaTeamId(0), DamageDone(0), HealingDone(0), KillingBlows(0) {} - void Fill(const char* name, uint32 guid, uint32 acc, uint32 arenaTeamId, std::string ip) - { - Name = std::string(name); - Guid = guid; - Acc = acc; - ArenaTeamId = arenaTeamId; - IP = ip; - } + public: + ArenaLogEntryData() : Guid(0), ArenaTeamId(0), DamageDone(0), HealingDone(0), KillingBlows(0) {} + void Fill(const char* name, uint32 guid, uint32 acc, uint32 arenaTeamId, std::string ip) + { + Name = std::string(name); + Guid = guid; + Acc = acc; + ArenaTeamId = arenaTeamId; + IP = ip; + } - std::string Name; - uint32 Guid; - uint32 Acc; - uint32 ArenaTeamId; - std::string IP; - uint32 DamageDone; - uint32 HealingDone; - uint32 KillingBlows; + std::string Name; + uint32 Guid; + uint32 Acc; + uint32 ArenaTeamId; + std::string IP; + uint32 DamageDone; + uint32 HealingDone; + uint32 KillingBlows; }; enum BGHonorMode @@ -368,23 +368,23 @@ class Battleground void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; } void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; } - void DecreaseInvitedCount(TeamId teamId) { ASSERT(m_BgInvitedPlayers[teamId] > 0); --m_BgInvitedPlayers[teamId]; } - void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; } - uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; } + void DecreaseInvitedCount(TeamId teamId) { ASSERT(m_BgInvitedPlayers[teamId] > 0); --m_BgInvitedPlayers[teamId]; } + void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; } + uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; } bool HasFreeSlots() const; uint32 GetFreeSlotsForTeam(TeamId teamId) const; - uint32 GetMaxFreeSlots() const; + uint32 GetMaxFreeSlots() const; typedef std::set SpectatorList; - typedef std::map ToBeTeleportedMap; + typedef std::map ToBeTeleportedMap; void AddSpectator(Player* p) { m_Spectators.insert(p); } void RemoveSpectator(Player* p) { m_Spectators.erase(p); } bool HaveSpectators() { return !m_Spectators.empty(); } - const SpectatorList& GetSpectators() const { return m_Spectators; } - void AddToBeTeleported(uint64 spectator, uint64 participant) { m_ToBeTeleported[spectator] = participant; } - void RemoveToBeTeleported(uint64 spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); } - void SpectatorsSendPacket(WorldPacket& data); + const SpectatorList& GetSpectators() const { return m_Spectators; } + void AddToBeTeleported(uint64 spectator, uint64 participant) { m_ToBeTeleported[spectator] = participant; } + void RemoveToBeTeleported(uint64 spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); } + void SpectatorsSendPacket(WorldPacket& data); bool isArena() const { return m_IsArena; } bool isBattleground() const { return !m_IsArena; } @@ -394,8 +394,8 @@ class Battleground BattlegroundPlayerMap const& GetPlayers() const { return m_Players; } uint32 GetPlayersSize() const { return m_Players.size(); } - void ReadyMarkerClicked(Player* p); // pussywizard - std::set readyMarkerClickedSet; // pussywizard + void ReadyMarkerClicked(Player* p); // pussywizard + std::set readyMarkerClickedSet; // pussywizard typedef std::map BattlegroundScoreMap; typedef std::map ArenaLogEntryDataMap;// pussywizard @@ -624,8 +624,8 @@ class Battleground BGHonorMode m_HonorMode; int32 m_TeamScores[BG_TEAMS_COUNT]; - // pussywizard: - uint32 m_UpdateTimer; + // pussywizard: + uint32 m_UpdateTimer; private: // Battleground BattlegroundTypeId m_RealTypeID; @@ -684,13 +684,13 @@ class Battleground // Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction // Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG // Invited players counters - uint32 m_BgInvitedPlayers[BG_TEAMS_COUNT]; + uint32 m_BgInvitedPlayers[BG_TEAMS_COUNT]; // Raid Group Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde - SpectatorList m_Spectators; - ToBeTeleportedMap m_ToBeTeleported; + SpectatorList m_Spectators; + ToBeTeleportedMap m_ToBeTeleported; // Players count by team uint32 m_PlayersCount[BG_TEAMS_COUNT]; diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index a42e039b2..0a419463c 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -54,8 +54,8 @@ BattlegroundMgr::BattlegroundMgr() : m_ArenaTesting(false), m_Testing(false), m_lastClientVisibleInstanceId(0), m_NextAutoDistributionTime(0), m_NextPeriodicQueueUpdateTime(5*IN_MILLISECONDS), randomBgDifficultyEntry(999, 0, 80, 80, 0) { - for (uint32 qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype) - m_BattlegroundQueues[qtype].SetBgTypeIdAndArenaType(BGTemplateId(BattlegroundQueueTypeId(qtype)), BGArenaType(BattlegroundQueueTypeId(qtype))); + for (uint32 qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype) + m_BattlegroundQueues[qtype].SetBgTypeIdAndArenaType(BGTemplateId(BattlegroundQueueTypeId(qtype)), BGArenaType(BattlegroundQueueTypeId(qtype))); } BattlegroundMgr::~BattlegroundMgr() @@ -65,19 +65,19 @@ BattlegroundMgr::~BattlegroundMgr() void BattlegroundMgr::DeleteAllBattlegrounds() { - while (!m_Battlegrounds.empty()) - delete m_Battlegrounds.begin()->second; - m_Battlegrounds.clear(); + while (!m_Battlegrounds.empty()) + delete m_Battlegrounds.begin()->second; + m_Battlegrounds.clear(); - while (!m_BattlegroundTemplates.empty()) - delete m_BattlegroundTemplates.begin()->second; - m_BattlegroundTemplates.clear(); + while (!m_BattlegroundTemplates.empty()) + delete m_BattlegroundTemplates.begin()->second; + m_BattlegroundTemplates.clear(); } // used to update running battlegrounds, and delete finished ones void BattlegroundMgr::Update(uint32 diff) { - // update all battlegrounds and delete if needed + // update all battlegrounds and delete if needed for (BattlegroundContainer::iterator itr = m_Battlegrounds.begin(), itrDelete; itr != m_Battlegrounds.end(); ) { itrDelete = itr++; @@ -91,8 +91,8 @@ void BattlegroundMgr::Update(uint32 diff) } } - // update to change current bg type the random system is trying to create - RandomSystem.Update(diff); + // update to change current bg type the random system is trying to create + RandomSystem.Update(diff); // update events for (int qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype) @@ -120,19 +120,19 @@ void BattlegroundMgr::Update(uint32 diff) for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket) m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), 0x03, true, 0); // pussywizard: 0 for rated means looking for opponents for every team - // for battlegrounds and not rated arenas - // in first loop try to fill already running battlegrounds, then in a second loop try to create new battlegrounds - for (uint8 action = 1; action <= 2; ++action) - for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype) - for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket) - m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), action, false, 0); + // for battlegrounds and not rated arenas + // in first loop try to fill already running battlegrounds, then in a second loop try to create new battlegrounds + for (uint8 action = 1; action <= 2; ++action) + for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype) + for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket) + m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), action, false, 0); m_NextPeriodicQueueUpdateTime = 5*IN_MILLISECONDS; } else m_NextPeriodicQueueUpdateTime -= diff; - // arena points auto-distribution + // arena points auto-distribution if (sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS)) { if (sWorld->GetGameTime() > m_NextAutoDistributionTime) @@ -146,8 +146,8 @@ void BattlegroundMgr::Update(uint32 diff) void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, TeamId teamId, bool isRated, BattlegroundTypeId forceBgTypeId) { - // pussywizard: - ASSERT(QueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES); + // pussywizard: + ASSERT(QueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES); if (StatusID == STATUS_NONE || !bg) { @@ -209,7 +209,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId+1)) { // Xinef: oryginally this was looping in reverse order, loop order was changed so we have to change checked teamId - int32 rating_change = bg->GetArenaTeamRatingChangeForTeam(Battleground::GetOtherTeamId(iTeamId)); + int32 rating_change = bg->GetArenaTeamRatingChangeForTeam(Battleground::GetOtherTeamId(iTeamId)); uint32 pointsLost = rating_change < 0 ? -rating_change : 0; uint32 pointsGained = rating_change > 0 ? rating_change : 0; @@ -233,7 +233,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) else { *data << uint8(1); // bg ended - *data << uint8(bg->GetWinner()); // who win + *data << uint8(bg->GetWinner()); // who win } size_t wpos = data->wpos(); @@ -304,7 +304,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) *data << uint32(0); break; } - break; + break; case BATTLEGROUND_AV: *data << uint32(0x00000005); // count of next fields *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted @@ -422,12 +422,12 @@ uint32 BattlegroundMgr::GetNextClientVisibleInstanceId() // create a new battleground that will really be used to play Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId, uint32 minLevel, uint32 maxLevel, uint8 arenaType, bool isRated) { - // pussywizard: random battleground is chosen before calling this function! - ASSERT(bgTypeId != BATTLEGROUND_RB); + // pussywizard: random battleground is chosen before calling this function! + ASSERT(bgTypeId != BATTLEGROUND_RB); - // pussywizard: randomize for all arena - if (bgTypeId == BATTLEGROUND_AA) - bgTypeId = RAND(BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL, BATTLEGROUND_DS, BATTLEGROUND_RV); + // pussywizard: randomize for all arena + if (bgTypeId == BATTLEGROUND_AA) + bgTypeId = RAND(BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL, BATTLEGROUND_DS, BATTLEGROUND_RV); // get the template BG Battleground* bg_template = GetBattlegroundTemplate(bgTypeId); @@ -599,7 +599,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() uint32 bgTypeId = fields[0].GetUInt32(); - // pussywizard: currently not supported + // pussywizard: currently not supported //if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId, NULL)) // continue; @@ -889,8 +889,8 @@ void BattlegroundMgr::SetHolidayWeekends(uint32 mask) { for (uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype) { - if (bgtype == BATTLEGROUND_RB) - continue; + if (bgtype == BATTLEGROUND_RB) + continue; if (Battleground* bgt = GetBattlegroundTemplate(BattlegroundTypeId(bgtype))) bgt->SetHoliday(mask & (1 << bgtype)); } @@ -1013,39 +1013,39 @@ bool BattlegroundMgr::IsBGWeekend(BattlegroundTypeId bgTypeId) void BattlegroundMgr::AddBattleground(Battleground* bg) { - if (bg->GetInstanceID() == 0) - m_BattlegroundTemplates[bg->GetBgTypeID()] = bg; - else - m_Battlegrounds[bg->GetInstanceID()] = bg; + if (bg->GetInstanceID() == 0) + m_BattlegroundTemplates[bg->GetBgTypeID()] = bg; + else + m_Battlegrounds[bg->GetInstanceID()] = bg; } void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId) { - if (instanceId == 0) - m_BattlegroundTemplates.erase(bgTypeId); - else - m_Battlegrounds.erase(instanceId); + if (instanceId == 0) + m_BattlegroundTemplates.erase(bgTypeId); + else + m_Battlegrounds.erase(instanceId); } void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId) { - ASSERT(!ginfo->IsInvitedToBGInstanceGUID); + ASSERT(!ginfo->IsInvitedToBGInstanceGUID); - // set side if needed - if (teamId != TEAM_NEUTRAL) - ginfo->teamId = teamId; + // set side if needed + if (teamId != TEAM_NEUTRAL) + ginfo->teamId = teamId; - // set invitation - ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID(); + // set invitation + ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID(); - BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(ginfo->BgTypeId, ginfo->ArenaType); - BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); + BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(ginfo->BgTypeId, ginfo->ArenaType); + BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); - // set ArenaTeamId for rated matches - if (bg->isArena() && bg->isRated()) - bg->SetArenaTeamIdForTeam(ginfo->teamId, ginfo->ArenaTeamId); + // set ArenaTeamId for rated matches + if (bg->isArena() && bg->isRated()) + bg->SetArenaTeamIdForTeam(ginfo->teamId, ginfo->ArenaTeamId); - ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME; + ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME; // loop through the players for (std::set::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr) @@ -1054,7 +1054,7 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(*itr); // player is removed from queue when logging out - ASSERT(player); + ASSERT(player); // update average wait time bgQueue.PlayerInvitedToBGUpdateAverageWaitTime(ginfo); @@ -1072,15 +1072,15 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T WorldPacket data; uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId); - ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES); + ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES); // send status packet - sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId); + sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId); player->GetSession()->SendPacket(&data); - // pussywizard: - if (bg->isArena() && bg->isRated()) - bg->ArenaLogEntries[player->GetGUID()].Fill(player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), ginfo->ArenaTeamId, player->GetSession()->GetRemoteAddress()); + // pussywizard: + if (bg->isArena() && bg->isRated()) + bg->ArenaLogEntries[player->GetGUID()].Fill(player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), ginfo->ArenaTeamId, player->GetSession()->GetRemoteAddress()); } } @@ -1090,52 +1090,52 @@ RandomBattlegroundSystem::RandomBattlegroundSystem() : m_CurrentRandomBg(BATTLEG void RandomBattlegroundSystem::Update(uint32 diff) { - if (m_SwitchTimer <= diff) - { - if (m_BgOrder.empty()) - { - // order it like: big, small, big, small, small, small (stored backwards, actually) + if (m_SwitchTimer <= diff) + { + if (m_BgOrder.empty()) + { + // order it like: big, small, big, small, small, small (stored backwards, actually) - std::vector big, small; - big.push_back(BATTLEGROUND_AV); - big.push_back(BATTLEGROUND_IC); - small.push_back(BATTLEGROUND_WS); - small.push_back(BATTLEGROUND_EY); - small.push_back(BATTLEGROUND_AB); - small.push_back(BATTLEGROUND_SA); + std::vector big, small; + big.push_back(BATTLEGROUND_AV); + big.push_back(BATTLEGROUND_IC); + small.push_back(BATTLEGROUND_WS); + small.push_back(BATTLEGROUND_EY); + small.push_back(BATTLEGROUND_AB); + small.push_back(BATTLEGROUND_SA); - std::random_shuffle(big.begin(), big.end()); - std::random_shuffle(small.begin(), small.end()); + std::random_shuffle(big.begin(), big.end()); + std::random_shuffle(small.begin(), small.end()); - m_BgOrder.push_back(small.back()); small.pop_back(); - m_BgOrder.push_back(small.back()); small.pop_back(); - m_BgOrder.push_back(small.back()); small.pop_back(); - m_BgOrder.push_back(big.back()); big.pop_back(); - m_BgOrder.push_back(small.back()); small.pop_back(); - m_BgOrder.push_back(big.back()); big.pop_back(); - } + m_BgOrder.push_back(small.back()); small.pop_back(); + m_BgOrder.push_back(small.back()); small.pop_back(); + m_BgOrder.push_back(small.back()); small.pop_back(); + m_BgOrder.push_back(big.back()); big.pop_back(); + m_BgOrder.push_back(small.back()); small.pop_back(); + m_BgOrder.push_back(big.back()); big.pop_back(); + } - m_CurrentRandomBg = m_BgOrder.back(); - m_BgOrder.pop_back(); + m_CurrentRandomBg = m_BgOrder.back(); + m_BgOrder.pop_back(); - switch (m_CurrentRandomBg) - { - case BATTLEGROUND_AV: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team - case BATTLEGROUND_WS: m_SwitchTimer = 30*IN_MILLISECONDS; break; // max 10 per team - case BATTLEGROUND_IC: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team - case BATTLEGROUND_EY: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team - case BATTLEGROUND_AB: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team - case BATTLEGROUND_SA: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team - default: ASSERT(false); break; - } - } - else - m_SwitchTimer -= diff; + switch (m_CurrentRandomBg) + { + case BATTLEGROUND_AV: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team + case BATTLEGROUND_WS: m_SwitchTimer = 30*IN_MILLISECONDS; break; // max 10 per team + case BATTLEGROUND_IC: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team + case BATTLEGROUND_EY: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team + case BATTLEGROUND_AB: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team + case BATTLEGROUND_SA: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team + default: ASSERT(false); break; + } + } + else + m_SwitchTimer -= diff; } void RandomBattlegroundSystem::BattlegroundCreated(BattlegroundTypeId bgTypeId) { - // if created current random bg, set current to another one - if (bgTypeId == m_CurrentRandomBg) - Update(0xffffffff); + // if created current random bg, set current to another one + if (bgTypeId == m_CurrentRandomBg) + Update(0xffffffff); } diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index 10dafbd96..25a7e92c1 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.h @@ -58,15 +58,15 @@ struct GroupQueueInfo; // pussywizard class RandomBattlegroundSystem { - public: - RandomBattlegroundSystem(); - void Update(uint32 diff); - BattlegroundTypeId GetCurrentRandomBg() const { return m_CurrentRandomBg; } - void BattlegroundCreated(BattlegroundTypeId bgTypeId); - private: - BattlegroundTypeId m_CurrentRandomBg; - uint32 m_SwitchTimer; - std::vector m_BgOrder; + public: + RandomBattlegroundSystem(); + void Update(uint32 diff); + BattlegroundTypeId GetCurrentRandomBg() const { return m_CurrentRandomBg; } + void BattlegroundCreated(BattlegroundTypeId bgTypeId); + private: + BattlegroundTypeId m_CurrentRandomBg; + uint32 m_SwitchTimer; + std::vector m_BgOrder; }; class BattlegroundMgr @@ -142,22 +142,22 @@ class BattlegroundMgr return BATTLEGROUND_TYPE_NONE; } - const BattlegroundContainer& GetBattlegroundList() { return m_Battlegrounds; } // pussywizard - RandomBattlegroundSystem RandomSystem; // pussywizard + const BattlegroundContainer& GetBattlegroundList() { return m_Battlegrounds; } // pussywizard + RandomBattlegroundSystem RandomSystem; // pussywizard private: bool CreateBattleground(CreateBattlegroundData& data); uint32 GetNextClientVisibleInstanceId(); typedef std::map BattlegroundTemplateContainer; - BattlegroundTemplateContainer m_BattlegroundTemplates; + BattlegroundTemplateContainer m_BattlegroundTemplates; BattlegroundContainer m_Battlegrounds; BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; std::vector m_ArenaQueueUpdateScheduler; - uint32 m_lastClientVisibleInstanceId; - uint32 m_NextPeriodicQueueUpdateTime; + uint32 m_lastClientVisibleInstanceId; + uint32 m_NextPeriodicQueueUpdateTime; time_t m_NextAutoDistributionTime; bool m_ArenaTesting; bool m_Testing; diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index d6581ac72..387489b68 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -76,22 +76,22 @@ void BattlegroundQueue::SelectionPool::Init() // returns true if we kicked more than requested bool BattlegroundQueue::SelectionPool::KickGroup(const uint32 size) { - if (SelectedGroups.empty()) - return false; + if (SelectedGroups.empty()) + return false; // find last group with proper size or largest - bool foundProper = false; + bool foundProper = false; GroupsQueueType::iterator groupToKick = SelectedGroups.begin(); for (GroupsQueueType::iterator itr = groupToKick; itr != SelectedGroups.end(); ++itr) { - // if proper size - overwrite to kick last one + // if proper size - overwrite to kick last one if (abs(int32((*itr)->Players.size()) - (int32)size) <= 1) { groupToKick = itr; - foundProper = true; + foundProper = true; } - else if (!foundProper && (*itr)->Players.size() >= (*groupToKick)->Players.size()) - groupToKick = itr; + else if (!foundProper && (*itr)->Players.size() >= (*groupToKick)->Players.size()) + groupToKick = itr; } // remove selected from pool @@ -99,8 +99,8 @@ bool BattlegroundQueue::SelectionPool::KickGroup(const uint32 size) SelectedGroups.erase(groupToKick); PlayerCount -= ginfo->Players.size(); - if (foundProper) - return false; + if (foundProper) + return false; return (ginfo->Players.size() > size); } @@ -131,8 +131,8 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDiffi // create new ginfo GroupQueueInfo* ginfo = new GroupQueueInfo; - ginfo->BgTypeId = m_bgTypeId; - ginfo->ArenaType = m_arenaType; + ginfo->BgTypeId = m_bgTypeId; + ginfo->ArenaType = m_arenaType; ginfo->ArenaTeamId = arenateamid; ginfo->IsRated = isRated; ginfo->IsInvitedToBGInstanceGUID = 0; @@ -153,9 +153,9 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDiffi if (ginfo->teamId == TEAM_HORDE) index++; - // pussywizard: store indices at which GroupQueueInfo is in m_QueuedGroups + // pussywizard: store indices at which GroupQueueInfo is in m_QueuedGroups ginfo->_bracketId = bracketId; - ginfo->_groupType = index; + ginfo->_groupType = index; //add players from group to ginfo if (grp) @@ -166,14 +166,14 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDiffi if (!member) continue; - ASSERT(m_QueuedPlayers.count(member->GetGUID()) == 0); + ASSERT(m_QueuedPlayers.count(member->GetGUID()) == 0); m_QueuedPlayers[member->GetGUID()] = ginfo; ginfo->Players.insert(member->GetGUID()); } } else { - ASSERT(m_QueuedPlayers.count(leader->GetGUID()) == 0); + ASSERT(m_QueuedPlayers.count(leader->GetGUID()) == 0); m_QueuedPlayers[leader->GetGUID()] = ginfo; ginfo->Players.insert(leader->GetGUID()); } @@ -199,14 +199,14 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDiffi qHorde += (*itr)->Players.size(); // show queue status to player when joining queue - if (ginfo->BgTypeId == BATTLEGROUND_RB) - ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_80_RANDOM, bgName, q_min_level, q_max_level, qAlliance, qHorde); - else if (bgt->isArena()) - ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_STANDARD, bgName, q_min_level, q_max_level, qAlliance, ((uint32)m_arenaType > qAlliance ? (uint32)m_arenaType - qAlliance : 0), qHorde, ((uint32)m_arenaType > qHorde ? (uint32)m_arenaType - qHorde : 0)); - else if (q_min_level >= 80) - ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_80_SPECIFIC, bgName, q_min_level, q_max_level, qAlliance, bgt->GetMinPlayersPerTeam(), qHorde, bgt->GetMinPlayersPerTeam()); - else - ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_STANDARD, bgName, q_min_level, q_max_level, qAlliance, (bgt->GetMinPlayersPerTeam() > qAlliance ? bgt->GetMinPlayersPerTeam() - qAlliance : 0), qHorde, (bgt->GetMinPlayersPerTeam() > qHorde ? bgt->GetMinPlayersPerTeam() - qHorde : 0)); + if (ginfo->BgTypeId == BATTLEGROUND_RB) + ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_80_RANDOM, bgName, q_min_level, q_max_level, qAlliance, qHorde); + else if (bgt->isArena()) + ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_STANDARD, bgName, q_min_level, q_max_level, qAlliance, ((uint32)m_arenaType > qAlliance ? (uint32)m_arenaType - qAlliance : 0), qHorde, ((uint32)m_arenaType > qHorde ? (uint32)m_arenaType - qHorde : 0)); + else if (q_min_level >= 80) + ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_80_SPECIFIC, bgName, q_min_level, q_max_level, qAlliance, bgt->GetMinPlayersPerTeam(), qHorde, bgt->GetMinPlayersPerTeam()); + else + ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_STANDARD, bgName, q_min_level, q_max_level, qAlliance, (bgt->GetMinPlayersPerTeam() > qAlliance ? bgt->GetMinPlayersPerTeam() - qAlliance : 0), qHorde, (bgt->GetMinPlayersPerTeam() > qHorde ? bgt->GetMinPlayersPerTeam() - qHorde : 0)); } return ginfo; @@ -214,21 +214,21 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDiffi void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo) { - uint32 timeInQueue = std::max(1, getMSTimeDiff(ginfo->JoinTime, World::GetGameTimeMS())); + uint32 timeInQueue = std::max(1, getMSTimeDiff(ginfo->JoinTime, World::GetGameTimeMS())); - // team_index: bg alliance - TEAM_ALLIANCE, bg horde - TEAM_HORDE, arena skirmish - TEAM_ALLIANCE, arena rated - TEAM_HORDE + // team_index: bg alliance - TEAM_ALLIANCE, bg horde - TEAM_HORDE, arena skirmish - TEAM_ALLIANCE, arena rated - TEAM_HORDE uint8 team_index; if (!ginfo->ArenaType) team_index = ginfo->teamId; else - team_index = (ginfo->IsRated ? TEAM_HORDE : TEAM_ALLIANCE); + team_index = (ginfo->IsRated ? TEAM_HORDE : TEAM_ALLIANCE); - // just to be sure - if (team_index >= TEAM_NEUTRAL) - return; + // just to be sure + if (team_index >= TEAM_NEUTRAL) + return; // pointer to last index - uint32* lastIndex = &m_WaitTimeLastIndex[team_index][ginfo->_bracketId]; + uint32* lastIndex = &m_WaitTimeLastIndex[team_index][ginfo->_bracketId]; // set time at index to new value m_WaitTimes[team_index][ginfo->_bracketId][*lastIndex] = timeInQueue; @@ -240,25 +240,25 @@ void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const { - // team_index: bg alliance - TEAM_ALLIANCE, bg horde - TEAM_HORDE, arena skirmish - TEAM_ALLIANCE, arena rated - TEAM_HORDE + // team_index: bg alliance - TEAM_ALLIANCE, bg horde - TEAM_HORDE, arena skirmish - TEAM_ALLIANCE, arena rated - TEAM_HORDE uint8 team_index; if (!ginfo->ArenaType) team_index = ginfo->teamId; else - team_index = (ginfo->IsRated ? TEAM_HORDE : TEAM_ALLIANCE); + team_index = (ginfo->IsRated ? TEAM_HORDE : TEAM_ALLIANCE); - // just to be sure - if (team_index >= TEAM_NEUTRAL) - return 0; + // just to be sure + if (team_index >= TEAM_NEUTRAL) + return 0; // if there are enough values: if (m_WaitTimes[team_index][ginfo->_bracketId][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1]) - { - uint32 sum = 0; - for (uint32 i=0; i_bracketId][i]; - return sum / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; - } + { + uint32 sum = 0; + for (uint32 i=0; i_bracketId][i]; + return sum / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; + } else return 0; } @@ -266,29 +266,29 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const //remove player from queue and from group info, if group info is empty then remove it too void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQueueSlot) { - // pussywizard: leave queue packet - if (playerQueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) - if (Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid)) - { - WorldPacket data; - sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, NULL, playerQueueSlot, STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL); - p->GetSession()->SendPacket(&data); - } + // pussywizard: leave queue packet + if (playerQueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) + if (Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid)) + { + WorldPacket data; + sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, NULL, playerQueueSlot, STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL); + p->GetSession()->SendPacket(&data); + } //remove player from map, if he's there QueuedPlayersMap::iterator itr = m_QueuedPlayers.find(guid); if (itr == m_QueuedPlayers.end()) - { - ASSERT(false); + { + ASSERT(false); return; - } + } GroupQueueInfo* groupInfo = itr->second; - uint32 _bracketId = groupInfo->_bracketId; - uint32 _groupType = groupInfo->_groupType; + uint32 _bracketId = groupInfo->_bracketId; + uint32 _groupType = groupInfo->_groupType; - // find iterator + // find iterator GroupsQueueType::iterator group_itr = m_QueuedGroups[_bracketId][_groupType].end(); for (GroupsQueueType::iterator k = m_QueuedGroups[_bracketId][_groupType].begin(); k != m_QueuedGroups[_bracketId][_groupType].end(); ++k) if ((*k) == groupInfo) @@ -299,22 +299,22 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu //player can't be in queue without group, but just in case if (group_itr == m_QueuedGroups[_bracketId][_groupType].end()) - { - ASSERT(false); + { + ASSERT(false); return; - } + } // remove player from group queue info std::set::iterator pitr = groupInfo->Players.find(guid); - ASSERT(pitr != groupInfo->Players.end()); + ASSERT(pitr != groupInfo->Players.end()); if (pitr != groupInfo->Players.end()) groupInfo->Players.erase(pitr); // if invited to bg, then always decrease invited count when removed from queue - // sending player to bg will increase it again + // sending player to bg will increase it again if (groupInfo->IsInvitedToBGInstanceGUID) if (Battleground* bg = sBattlegroundMgr->GetBattleground(groupInfo->IsInvitedToBGInstanceGUID)) - bg->DecreaseInvitedCount(groupInfo->teamId); + bg->DecreaseInvitedCount(groupInfo->teamId); // remove player queue info m_QueuedPlayers.erase(itr); @@ -336,11 +336,11 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu return; } - // group isn't yet empty, so not deleted yet - // if it's a rated arena and any member leaves when group not yet invited - everyone from group leaves too! + // group isn't yet empty, so not deleted yet + // if it's a rated arena and any member leaves when group not yet invited - everyone from group leaves too! if (groupInfo->IsRated && !groupInfo->IsInvitedToBGInstanceGUID) { - uint32 queueSlot = PLAYER_MAX_BATTLEGROUND_QUEUES; + uint32 queueSlot = PLAYER_MAX_BATTLEGROUND_QUEUES; if (Player* plr = ObjectAccessor::FindPlayerInOrOutOfWorld(*(groupInfo->Players.begin()))) { @@ -356,7 +356,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool sentToBg, uint32 playerQu void BattlegroundQueue::AddEvent(BasicEvent* Event, uint64 e_time) { - m_events.AddEvent(Event, m_events.CalculateTime(e_time)); + m_events.AddEvent(Event, m_events.CalculateTime(e_time)); } bool BattlegroundQueue::IsPlayerInvitedToRatedArena(uint64 pl_guid) @@ -384,15 +384,15 @@ bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginf // this function is filling pools given free slots on both sides, result is ballanced void BattlegroundQueue::FillPlayersToBG(const int32 aliFree, const int32 hordeFree, BattlegroundBracketId bracket_id) { - // clear selection pools + // clear selection pools m_SelectionPools[TEAM_ALLIANCE].Init(); m_SelectionPools[TEAM_HORDE].Init(); - // quick check if nothing we can do: - if (!sBattlegroundMgr->isTesting()) - if (aliFree > hordeFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() || - hordeFree > aliFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty()) - return; + // quick check if nothing we can do: + if (!sBattlegroundMgr->isTesting()) + if (aliFree > hordeFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() || + hordeFree > aliFree && m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty()) + return; // ally: at first fill as much as possible GroupsQueueType::const_iterator Ali_itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].begin(); @@ -406,26 +406,26 @@ void BattlegroundQueue::FillPlayersToBG(const int32 aliFree, const int32 hordeFr int32 aliDiff = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()); int32 hordeDiff = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount()); - // if free space differs too much, ballance + // if free space differs too much, ballance while (abs(aliDiff - hordeDiff) > 1 && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0)) { // if results in more alliance players than horde: if (aliDiff < hordeDiff) { - // no more alliance in pool, invite whatever we can from horde - if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()) - break; + // no more alliance in pool, invite whatever we can from horde + if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()) + break; // kick alliance, returns true if kicked more than needed, so then try to fill up if (m_SelectionPools[TEAM_ALLIANCE].KickGroup(hordeDiff - aliDiff)) - for (; Ali_itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree >= hordeDiff ? aliFree - hordeDiff : 0); ++Ali_itr); + for (; Ali_itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree >= hordeDiff ? aliFree - hordeDiff : 0); ++Ali_itr); } - // if results in more horde players than alliance: + // if results in more horde players than alliance: else { - // no more horde in pool, invite whatever we can from alliance - if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount()) - break; + // no more horde in pool, invite whatever we can from alliance + if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount()) + break; // kick horde, returns true if kicked more than needed, so then try to fill up if (m_SelectionPools[TEAM_HORDE].KickGroup(aliDiff - hordeDiff)) @@ -440,22 +440,22 @@ void BattlegroundQueue::FillPlayersToBG(const int32 aliFree, const int32 hordeFr void BattlegroundQueue::FillPlayersToBGWithSpecific(const int32 aliFree, const int32 hordeFree, BattlegroundBracketId thisBracketId, BattlegroundQueue* specificQueue, BattlegroundBracketId specificBracketId) { - // clear selection pools + // clear selection pools m_SelectionPools[TEAM_ALLIANCE].Init(); m_SelectionPools[TEAM_HORDE].Init(); - // quick check if nothing we can do: - if (!sBattlegroundMgr->isTesting()) - if (m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty() || - m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].empty()) - return; + // quick check if nothing we can do: + if (!sBattlegroundMgr->isTesting()) + if (m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].empty() || + m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].empty() && specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].empty()) + return; - // copy groups from both queues to new joined container - GroupsQueueType m_QueuedBoth[BG_TEAMS_COUNT]; - m_QueuedBoth[TEAM_ALLIANCE].insert(m_QueuedBoth[TEAM_ALLIANCE].end(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].end()); - m_QueuedBoth[TEAM_ALLIANCE].insert(m_QueuedBoth[TEAM_ALLIANCE].end(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].end()); - m_QueuedBoth[TEAM_HORDE].insert(m_QueuedBoth[TEAM_HORDE].end(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].begin(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].end()); - m_QueuedBoth[TEAM_HORDE].insert(m_QueuedBoth[TEAM_HORDE].end(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].begin(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].end()); + // copy groups from both queues to new joined container + GroupsQueueType m_QueuedBoth[BG_TEAMS_COUNT]; + m_QueuedBoth[TEAM_ALLIANCE].insert(m_QueuedBoth[TEAM_ALLIANCE].end(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_ALLIANCE].end()); + m_QueuedBoth[TEAM_ALLIANCE].insert(m_QueuedBoth[TEAM_ALLIANCE].end(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_ALLIANCE].end()); + m_QueuedBoth[TEAM_HORDE].insert(m_QueuedBoth[TEAM_HORDE].end(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].begin(), specificQueue->m_QueuedGroups[specificBracketId][BG_QUEUE_NORMAL_HORDE].end()); + m_QueuedBoth[TEAM_HORDE].insert(m_QueuedBoth[TEAM_HORDE].end(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].begin(), m_QueuedGroups[thisBracketId][BG_QUEUE_NORMAL_HORDE].end()); // ally: at first fill as much as possible GroupsQueueType::const_iterator Ali_itr = m_QueuedBoth[TEAM_ALLIANCE].begin(); @@ -469,26 +469,26 @@ void BattlegroundQueue::FillPlayersToBGWithSpecific(const int32 aliFree, const i int32 aliDiff = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()); int32 hordeDiff = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount()); - // if free space differs too much, ballance + // if free space differs too much, ballance while (abs(aliDiff - hordeDiff) > 1 && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0)) { // if results in more alliance players than horde: if (aliDiff < hordeDiff) { - // no more alliance in pool, invite whatever we can from horde - if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()) - break; + // no more alliance in pool, invite whatever we can from horde + if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()) + break; // kick alliance, returns true if kicked more than needed, so then try to fill up if (m_SelectionPools[TEAM_ALLIANCE].KickGroup(hordeDiff - aliDiff)) - for (; Ali_itr != m_QueuedBoth[TEAM_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree >= hordeDiff ? aliFree - hordeDiff : 0); ++Ali_itr); + for (; Ali_itr != m_QueuedBoth[TEAM_ALLIANCE].end() && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree >= hordeDiff ? aliFree - hordeDiff : 0); ++Ali_itr); } - // if results in more horde players than alliance: + // if results in more horde players than alliance: else { - // no more horde in pool, invite whatever we can from alliance - if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount()) - break; + // no more horde in pool, invite whatever we can from alliance + if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount()) + break; // kick horde, returns true if kicked more than needed, so then try to fill up if (m_SelectionPools[TEAM_HORDE].KickGroup(aliDiff - hordeDiff)) @@ -505,53 +505,53 @@ void BattlegroundQueue::FillPlayersToBGWithSpecific(const int32 aliFree, const i // then after 30 mins (default) in queue it moves premade group to normal queue bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam) { - // clear selection pools + // clear selection pools m_SelectionPools[TEAM_ALLIANCE].Init(); m_SelectionPools[TEAM_HORDE].Init(); if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && !m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty()) { - // find premade group for both factions: + // find premade group for both factions: GroupsQueueType::const_iterator ali_group, horde_group; for (ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group) - if (!(*ali_group)->IsInvitedToBGInstanceGUID && (*ali_group)->Players.size() >= MinPlayersPerTeam) + if (!(*ali_group)->IsInvitedToBGInstanceGUID && (*ali_group)->Players.size() >= MinPlayersPerTeam) break; for (horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group) if (!(*horde_group)->IsInvitedToBGInstanceGUID && (*horde_group)->Players.size() >= MinPlayersPerTeam) break; - // if found both groups + // if found both groups if (ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end()) { - // add premade groups to selection pools + // add premade groups to selection pools m_SelectionPools[TEAM_ALLIANCE].AddGroup((*ali_group), MaxPlayersPerTeam); m_SelectionPools[TEAM_HORDE].AddGroup((*horde_group), MaxPlayersPerTeam); - // battleground will be immediately filled (after calling this function and creating new battleground) with more players from normal queue + // battleground will be immediately filled (after calling this function and creating new battleground) with more players from normal queue - return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= MinPlayersPerTeam && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= MinPlayersPerTeam; + return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= MinPlayersPerTeam && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= MinPlayersPerTeam; } } // now check if we can move groups from premade queue to normal queue - // this happens if timer has expired or group size lowered + // this happens if timer has expired or group size lowered - uint32 premade_time = sWorld->getIntConfig(CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH); - uint32 time_before = World::GetGameTimeMS() >= premade_time ? World::GetGameTimeMS() - premade_time : 0; + uint32 premade_time = sWorld->getIntConfig(CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH); + uint32 time_before = World::GetGameTimeMS() >= premade_time ? World::GetGameTimeMS() - premade_time : 0; for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty()) - for (GroupsQueueType::iterator itr = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].end(); ) - { - if (!(*itr)->IsInvitedToBGInstanceGUID && ((*itr)->JoinTime < time_before || (*itr)->Players.size() < MinPlayersPerTeam)) - { - (*itr)->_groupType = BG_QUEUE_NORMAL_ALLIANCE + i; // pussywizard: update GroupQueueInfo internal variable - m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].push_front((*itr)); - m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].erase(itr++); - continue; - } - ++itr; - } + for (GroupsQueueType::iterator itr = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].end(); ) + { + if (!(*itr)->IsInvitedToBGInstanceGUID && ((*itr)->JoinTime < time_before || (*itr)->Players.size() < MinPlayersPerTeam)) + { + (*itr)->_groupType = BG_QUEUE_NORMAL_ALLIANCE + i; // pussywizard: update GroupQueueInfo internal variable + m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].push_front((*itr)); + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].erase(itr++); + continue; + } + ++itr; + } return false; } @@ -559,89 +559,89 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint // this method tries to create battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam bool BattlegroundQueue::CheckNormalMatch(Battleground* bgTemplate, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers) { - // if current queue is BATTLEGROUND_QUEUE_RB, then we are trying to create bg using players from 2 queues - if (bgTemplate->GetBgTypeID() == BATTLEGROUND_RB) - { - // specific template - Battleground* specificTemplate = sBattlegroundMgr->GetBattlegroundTemplate(sBattlegroundMgr->RandomSystem.GetCurrentRandomBg()); - if (!specificTemplate) - return false; + // if current queue is BATTLEGROUND_QUEUE_RB, then we are trying to create bg using players from 2 queues + if (bgTemplate->GetBgTypeID() == BATTLEGROUND_RB) + { + // specific template + Battleground* specificTemplate = sBattlegroundMgr->GetBattlegroundTemplate(sBattlegroundMgr->RandomSystem.GetCurrentRandomBg()); + if (!specificTemplate) + return false; - // specific bracket id - PvPDifficultyEntry const* specificBracket = GetBattlegroundBracketByLevel(specificTemplate->GetMapId(), sBattlegroundMgr->randomBgDifficultyEntry.minLevel); - if (!specificBracket || specificBracket->maxLevel < sBattlegroundMgr->randomBgDifficultyEntry.maxLevel) - return false; + // specific bracket id + PvPDifficultyEntry const* specificBracket = GetBattlegroundBracketByLevel(specificTemplate->GetMapId(), sBattlegroundMgr->randomBgDifficultyEntry.minLevel); + if (!specificBracket || specificBracket->maxLevel < sBattlegroundMgr->randomBgDifficultyEntry.maxLevel) + return false; - // specific queue - BattlegroundQueue& specificQueue = sBattlegroundMgr->GetBattlegroundQueue(BattlegroundMgr::BGQueueTypeId(sBattlegroundMgr->RandomSystem.GetCurrentRandomBg(), 0)); + // specific queue + BattlegroundQueue& specificQueue = sBattlegroundMgr->GetBattlegroundQueue(BattlegroundMgr::BGQueueTypeId(sBattlegroundMgr->RandomSystem.GetCurrentRandomBg(), 0)); - FillPlayersToBGWithSpecific(specificTemplate->GetMaxPlayersPerTeam(), specificTemplate->GetMaxPlayersPerTeam(), bracket_id, &specificQueue, BattlegroundBracketId(specificBracket->bracketId)); + FillPlayersToBGWithSpecific(specificTemplate->GetMaxPlayersPerTeam(), specificTemplate->GetMaxPlayersPerTeam(), bracket_id, &specificQueue, BattlegroundBracketId(specificBracket->bracketId)); - //allow 1v0 if debug bg - if (sBattlegroundMgr->isTesting() && bgTemplate->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount())) - return true; + //allow 1v0 if debug bg + if (sBattlegroundMgr->isTesting() && bgTemplate->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount())) + return true; - return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= std::min(specificTemplate->GetMinPlayersPerTeam(), 15) && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= std::min(specificTemplate->GetMinPlayersPerTeam(), 15); - } - // if this is not random bg queue - use players only from this queue - else - { - FillPlayersToBG(maxPlayers, maxPlayers, bracket_id); + return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= std::min(specificTemplate->GetMinPlayersPerTeam(), 15) && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= std::min(specificTemplate->GetMinPlayersPerTeam(), 15); + } + // if this is not random bg queue - use players only from this queue + else + { + FillPlayersToBG(maxPlayers, maxPlayers, bracket_id); - //allow 1v0 if debug bg - if (sBattlegroundMgr->isTesting() && bgTemplate->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount())) - return true; + //allow 1v0 if debug bg + if (sBattlegroundMgr->isTesting() && bgTemplate->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount())) + return true; - return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers; - } + return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers; + } } // this method will check if we can invite players to same faction skirmish match bool BattlegroundQueue::CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam) { - for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) - if (!m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].empty()) - { - // clear selection pools - m_SelectionPools[TEAM_ALLIANCE].Init(); - m_SelectionPools[TEAM_HORDE].Init(); + for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) + if (!m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].empty()) + { + // clear selection pools + m_SelectionPools[TEAM_ALLIANCE].Init(); + m_SelectionPools[TEAM_HORDE].Init(); - // fill one queue to both selection pools - for (GroupsQueueType::const_iterator itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr) - for (uint32 j = 0; j < BG_TEAMS_COUNT; j++) // try to add this group to both pools - if (m_SelectionPools[TEAM_ALLIANCE + j].GetPlayerCount() < minPlayersPerTeam) // if this pool is not full - if (m_SelectionPools[TEAM_ALLIANCE + j].AddGroup((*itr), minPlayersPerTeam)) // successfully added - { - // if both selection pools are full - if (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayersPerTeam && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayersPerTeam) - { - // need to move groups from one pool to another queue (for another faction) - TeamId wrongTeamId = (i == 0 ? TEAM_HORDE : TEAM_ALLIANCE); + // fill one queue to both selection pools + for (GroupsQueueType::const_iterator itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr) + for (uint32 j = 0; j < BG_TEAMS_COUNT; j++) // try to add this group to both pools + if (m_SelectionPools[TEAM_ALLIANCE + j].GetPlayerCount() < minPlayersPerTeam) // if this pool is not full + if (m_SelectionPools[TEAM_ALLIANCE + j].AddGroup((*itr), minPlayersPerTeam)) // successfully added + { + // if both selection pools are full + if (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayersPerTeam && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayersPerTeam) + { + // need to move groups from one pool to another queue (for another faction) + TeamId wrongTeamId = (i == 0 ? TEAM_HORDE : TEAM_ALLIANCE); - for (GroupsQueueType::iterator pitr = m_SelectionPools[wrongTeamId].SelectedGroups.begin(); pitr != m_SelectionPools[wrongTeamId].SelectedGroups.end(); ++pitr) - { - // update internal GroupQueueInfo data - (*pitr)->teamId = wrongTeamId; - (*pitr)->_groupType = BG_QUEUE_NORMAL_ALLIANCE + wrongTeamId; + for (GroupsQueueType::iterator pitr = m_SelectionPools[wrongTeamId].SelectedGroups.begin(); pitr != m_SelectionPools[wrongTeamId].SelectedGroups.end(); ++pitr) + { + // update internal GroupQueueInfo data + (*pitr)->teamId = wrongTeamId; + (*pitr)->_groupType = BG_QUEUE_NORMAL_ALLIANCE + wrongTeamId; - // add GroupQueueInfo to new queue - m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + wrongTeamId].push_front(*pitr); + // add GroupQueueInfo to new queue + m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + wrongTeamId].push_front(*pitr); - // remove GroupQueueInfo from old queue - for (GroupsQueueType::iterator qitr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); qitr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++qitr) - if (*qitr == *pitr) - { - m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].erase(qitr); - break; - } - } + // remove GroupQueueInfo from old queue + for (GroupsQueueType::iterator qitr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); qitr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++qitr) + if (*qitr == *pitr) + { + m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].erase(qitr); + break; + } + } - return true; - } + return true; + } - break; // added to one pool, prevent adding it to the second pool - } - } + break; // added to one pool, prevent adding it to the second pool + } + } return false; } @@ -672,39 +672,39 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id return; // battlegrounds with free slots should be populated first using players in queue - if ((actionMask & 0x01) && !BattlegroundMgr::IsArenaType(m_bgTypeId)) - { - const BattlegroundContainer& bgList = sBattlegroundMgr->GetBattlegroundList(); - BattlegroundNeedSet bgsToCheck; + if ((actionMask & 0x01) && !BattlegroundMgr::IsArenaType(m_bgTypeId)) + { + const BattlegroundContainer& bgList = sBattlegroundMgr->GetBattlegroundList(); + BattlegroundNeedSet bgsToCheck; - // sort from most needing (most empty) to least needing using a std::set with functor - for (BattlegroundContainer::const_iterator itr = bgList.begin(); itr != bgList.end(); ++itr) - { - Battleground* bg = itr->second; - if (!BattlegroundMgr::IsArenaType(bg->GetBgTypeID()) && (bg->GetBgTypeID() == m_bgTypeId || m_bgTypeId == BATTLEGROUND_RB) && - bg->HasFreeSlots() && bg->GetMinLevel() <= bracketEntry->minLevel && bg->GetMaxLevel() >= bracketEntry->maxLevel) - bgsToCheck.insert(bg); - } + // sort from most needing (most empty) to least needing using a std::set with functor + for (BattlegroundContainer::const_iterator itr = bgList.begin(); itr != bgList.end(); ++itr) + { + Battleground* bg = itr->second; + if (!BattlegroundMgr::IsArenaType(bg->GetBgTypeID()) && (bg->GetBgTypeID() == m_bgTypeId || m_bgTypeId == BATTLEGROUND_RB) && + bg->HasFreeSlots() && bg->GetMinLevel() <= bracketEntry->minLevel && bg->GetMaxLevel() >= bracketEntry->maxLevel) + bgsToCheck.insert(bg); + } - // now iterate needing battlegrounds - for (BattlegroundNeedSet::iterator itr = bgsToCheck.begin(); itr != bgsToCheck.end(); ++itr) - { - Battleground* bg = *itr; + // now iterate needing battlegrounds + for (BattlegroundNeedSet::iterator itr = bgsToCheck.begin(); itr != bgsToCheck.end(); ++itr) + { + Battleground* bg = *itr; - // call a function that fills whatever we can from normal queues - FillPlayersToBG(bg->GetFreeSlotsForTeam(TEAM_ALLIANCE), bg->GetFreeSlotsForTeam(TEAM_HORDE), bracket_id); + // call a function that fills whatever we can from normal queues + FillPlayersToBG(bg->GetFreeSlotsForTeam(TEAM_ALLIANCE), bg->GetFreeSlotsForTeam(TEAM_HORDE), bracket_id); - // invite players - for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) - for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) - BattlegroundMgr::InviteGroupToBG((*citr), bg, (*citr)->teamId); - } - } + // invite players + for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) + for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) + BattlegroundMgr::InviteGroupToBG((*citr), bg, (*citr)->teamId); + } + } // finished iterating through battlegrounds with free slots, maybe we need to create a new bg - if ((actionMask & 0x02) == 0) - return; + if ((actionMask & 0x02) == 0) + return; // get min and max players per team uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam(); @@ -715,7 +715,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id MaxPlayersPerTeam = m_arenaType; } - // check if can start new premade battleground + // check if can start new premade battleground if (bg_template->isBattleground() && m_bgTypeId != BATTLEGROUND_RB) if (CheckPremadeMatch(bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam)) { @@ -731,44 +731,44 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id bg->StartBattleground(); - // now fill the premade bg if possible (only one team for each side has been invited yet) - if (bg->HasFreeSlots()) - { - // call a function that fills whatever we can from normal queues - FillPlayersToBG(bg->GetFreeSlotsForTeam(TEAM_ALLIANCE), bg->GetFreeSlotsForTeam(TEAM_HORDE), bracket_id); + // now fill the premade bg if possible (only one team for each side has been invited yet) + if (bg->HasFreeSlots()) + { + // call a function that fills whatever we can from normal queues + FillPlayersToBG(bg->GetFreeSlotsForTeam(TEAM_ALLIANCE), bg->GetFreeSlotsForTeam(TEAM_HORDE), bracket_id); - // invite players - for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) - for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) - BattlegroundMgr::InviteGroupToBG((*citr), bg, (*citr)->teamId); - } + // invite players + for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) + for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) + BattlegroundMgr::InviteGroupToBG((*citr), bg, (*citr)->teamId); + } } // check if can start new normal battleground or non-rated arena if (!isRated) { if (CheckNormalMatch(bg_template, bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam) || - (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam))) + (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam))) { - BattlegroundTypeId newBgTypeId = m_bgTypeId; - uint32 minLvl = bracketEntry->minLevel; - uint32 maxLvl = bracketEntry->maxLevel; + BattlegroundTypeId newBgTypeId = m_bgTypeId; + uint32 minLvl = bracketEntry->minLevel; + uint32 maxLvl = bracketEntry->maxLevel; - // for random bg use values from specific - if (m_bgTypeId == BATTLEGROUND_RB) - { - newBgTypeId = sBattlegroundMgr->RandomSystem.GetCurrentRandomBg(); - Battleground* specificTemplate = sBattlegroundMgr->GetBattlegroundTemplate(newBgTypeId); - if (!specificTemplate) - return; - PvPDifficultyEntry const* specificBracket = GetBattlegroundBracketByLevel(specificTemplate->GetMapId(), sBattlegroundMgr->randomBgDifficultyEntry.minLevel); - if (!specificBracket) - return; - minLvl = specificBracket->minLevel; - maxLvl = specificBracket->maxLevel; + // for random bg use values from specific + if (m_bgTypeId == BATTLEGROUND_RB) + { + newBgTypeId = sBattlegroundMgr->RandomSystem.GetCurrentRandomBg(); + Battleground* specificTemplate = sBattlegroundMgr->GetBattlegroundTemplate(newBgTypeId); + if (!specificTemplate) + return; + PvPDifficultyEntry const* specificBracket = GetBattlegroundBracketByLevel(specificTemplate->GetMapId(), sBattlegroundMgr->randomBgDifficultyEntry.minLevel); + if (!specificBracket) + return; + minLvl = specificBracket->minLevel; + maxLvl = specificBracket->maxLevel; - sBattlegroundMgr->RandomSystem.BattlegroundCreated(newBgTypeId); - } + sBattlegroundMgr->RandomSystem.BattlegroundCreated(newBgTypeId); + } // create new battleground Battleground* bg = sBattlegroundMgr->CreateNewBattleground(newBgTypeId, minLvl, maxLvl, m_arenaType, false); @@ -783,158 +783,158 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id bg->StartBattleground(); } } - // check if can start new rated arenas (can create many in single queue update) + // check if can start new rated arenas (can create many in single queue update) else if (bg_template->isArena()) { - // pussywizard: everything inside this section is mine, do NOT destroy! + // pussywizard: everything inside this section is mine, do NOT destroy! - const uint32 currMSTime = World::GetGameTimeMS(); - const uint32 discardTime = sBattlegroundMgr->GetRatingDiscardTimer(); - const uint32 maxDefaultRatingDifference = (MaxPlayersPerTeam > 2 ? 300 : 200); - const uint32 maxCountedMMR = 2500; + const uint32 currMSTime = World::GetGameTimeMS(); + const uint32 discardTime = sBattlegroundMgr->GetRatingDiscardTimer(); + const uint32 maxDefaultRatingDifference = (MaxPlayersPerTeam > 2 ? 300 : 200); + const uint32 maxCountedMMR = 2500; - // we need to find 2 teams which will play next game - GroupsQueueType::iterator itr_teams[BG_TEAMS_COUNT]; + // we need to find 2 teams which will play next game + GroupsQueueType::iterator itr_teams[BG_TEAMS_COUNT]; - bool increaseItr = true; - bool reverse1 = urand(0,1) ? true : false; - for (uint8 ii = BG_QUEUE_PREMADE_ALLIANCE; ii <= BG_QUEUE_PREMADE_HORDE; ii++) - { - uint8 i = reverse1 ? (BG_QUEUE_PREMADE_HORDE-ii) : ii; - for (GroupsQueueType::iterator itr = m_QueuedGroups[bracket_id][i].begin(); itr != m_QueuedGroups[bracket_id][i].end(); (increaseItr ? ++itr : itr)) - { - increaseItr = true; + bool increaseItr = true; + bool reverse1 = urand(0,1) ? true : false; + for (uint8 ii = BG_QUEUE_PREMADE_ALLIANCE; ii <= BG_QUEUE_PREMADE_HORDE; ii++) + { + uint8 i = reverse1 ? (BG_QUEUE_PREMADE_HORDE-ii) : ii; + for (GroupsQueueType::iterator itr = m_QueuedGroups[bracket_id][i].begin(); itr != m_QueuedGroups[bracket_id][i].end(); (increaseItr ? ++itr : itr)) + { + increaseItr = true; - // if arenaRatedTeamId is set - look for oponents only for one team, if not - pair every possible team - if (arenaRatedTeamId != 0 && arenaRatedTeamId != (*itr)->ArenaTeamId) - continue; - if ((*itr)->IsInvitedToBGInstanceGUID) - continue; + // if arenaRatedTeamId is set - look for oponents only for one team, if not - pair every possible team + if (arenaRatedTeamId != 0 && arenaRatedTeamId != (*itr)->ArenaTeamId) + continue; + if ((*itr)->IsInvitedToBGInstanceGUID) + continue; - uint32 MMR1 = std::min((*itr)->ArenaMatchmakerRating, maxCountedMMR); + uint32 MMR1 = std::min((*itr)->ArenaMatchmakerRating, maxCountedMMR); - GroupsQueueType::iterator oponentItr; - uint8 oponentQueue = BG_QUEUE_GROUP_TYPES_COUNT; - uint32 minOponentMMRDiff = 0xffffffff; - uint8 oponentValid = 0; + GroupsQueueType::iterator oponentItr; + uint8 oponentQueue = BG_QUEUE_GROUP_TYPES_COUNT; + uint32 minOponentMMRDiff = 0xffffffff; + uint8 oponentValid = 0; - bool reverse2 = urand(0,1) ? true : false; - for (uint8 jj = BG_QUEUE_PREMADE_ALLIANCE; jj <= BG_QUEUE_PREMADE_HORDE; jj++) - { - uint8 j = reverse2 ? (BG_QUEUE_PREMADE_HORDE-jj) : jj; - bool brk = false; - for (GroupsQueueType::iterator itr2 = m_QueuedGroups[bracket_id][j].begin(); itr2 != m_QueuedGroups[bracket_id][j].end(); ++itr2) - { - if ((*itr)->ArenaTeamId == (*itr2)->ArenaTeamId) - continue; - if ((*itr2)->IsInvitedToBGInstanceGUID) - continue; - uint32 MMR2 = std::min((*itr2)->ArenaMatchmakerRating, maxCountedMMR); - uint32 MMRDiff = (MMR2>=MMR1 ? MMR2-MMR1 : MMR1-MMR2); + bool reverse2 = urand(0,1) ? true : false; + for (uint8 jj = BG_QUEUE_PREMADE_ALLIANCE; jj <= BG_QUEUE_PREMADE_HORDE; jj++) + { + uint8 j = reverse2 ? (BG_QUEUE_PREMADE_HORDE-jj) : jj; + bool brk = false; + for (GroupsQueueType::iterator itr2 = m_QueuedGroups[bracket_id][j].begin(); itr2 != m_QueuedGroups[bracket_id][j].end(); ++itr2) + { + if ((*itr)->ArenaTeamId == (*itr2)->ArenaTeamId) + continue; + if ((*itr2)->IsInvitedToBGInstanceGUID) + continue; + uint32 MMR2 = std::min((*itr2)->ArenaMatchmakerRating, maxCountedMMR); + uint32 MMRDiff = (MMR2>=MMR1 ? MMR2-MMR1 : MMR1-MMR2); - uint32 maxAllowedDiff = maxDefaultRatingDifference; - uint32 shorterWaitTime, longerWaitTime; - if (currMSTime-(*itr)->JoinTime <= currMSTime-(*itr2)->JoinTime) - { - shorterWaitTime = currMSTime-(*itr)->JoinTime; - longerWaitTime = currMSTime-(*itr2)->JoinTime; - } - else - { - shorterWaitTime = currMSTime-(*itr2)->JoinTime; - longerWaitTime = currMSTime-(*itr)->JoinTime; - } - if (longerWaitTime >= discardTime) - maxAllowedDiff += 150; - maxAllowedDiff += shorterWaitTime/600; // increased by 100 for each minute + uint32 maxAllowedDiff = maxDefaultRatingDifference; + uint32 shorterWaitTime, longerWaitTime; + if (currMSTime-(*itr)->JoinTime <= currMSTime-(*itr2)->JoinTime) + { + shorterWaitTime = currMSTime-(*itr)->JoinTime; + longerWaitTime = currMSTime-(*itr2)->JoinTime; + } + else + { + shorterWaitTime = currMSTime-(*itr2)->JoinTime; + longerWaitTime = currMSTime-(*itr)->JoinTime; + } + if (longerWaitTime >= discardTime) + maxAllowedDiff += 150; + maxAllowedDiff += shorterWaitTime/600; // increased by 100 for each minute - // now check if this team is more appropriate than previous ones: + // now check if this team is more appropriate than previous ones: - if (currMSTime-(*itr)->JoinTime >= 20*MINUTE*IN_MILLISECONDS && (oponentValid < 3 || MMRDiff < minOponentMMRDiff)) // after 20 minutes of waiting, pair with closest mmr, regardless the difference - { - oponentValid = 3; - minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j; - } - else if (MMR1 >= 2000 && MMR2 >= 2000 && longerWaitTime >= 2*discardTime && (oponentValid < 2 || MMRDiff < minOponentMMRDiff)) // after 6 minutes of waiting, pair any 2000+ vs 2000+ - { - oponentValid = 2; - minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j; - } - else if (oponentValid < 2 && MMRDiff < minOponentMMRDiff) - { - if (!oponentValid) - { - minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j; - if (MMRDiff <= maxAllowedDiff) - oponentValid = 1; - } - if ((MMR1 < 1800 || MMR2 < 1800) && MaxPlayersPerTeam == 2 && MMRDiff <= maxDefaultRatingDifference) // in 2v2 below 1800 mmr - priority for default allowed difference - { - minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j; - brk = true; - break; - } - } - } - if (brk) - break; - } + if (currMSTime-(*itr)->JoinTime >= 20*MINUTE*IN_MILLISECONDS && (oponentValid < 3 || MMRDiff < minOponentMMRDiff)) // after 20 minutes of waiting, pair with closest mmr, regardless the difference + { + oponentValid = 3; + minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j; + } + else if (MMR1 >= 2000 && MMR2 >= 2000 && longerWaitTime >= 2*discardTime && (oponentValid < 2 || MMRDiff < minOponentMMRDiff)) // after 6 minutes of waiting, pair any 2000+ vs 2000+ + { + oponentValid = 2; + minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j; + } + else if (oponentValid < 2 && MMRDiff < minOponentMMRDiff) + { + if (!oponentValid) + { + minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j; + if (MMRDiff <= maxAllowedDiff) + oponentValid = 1; + } + if ((MMR1 < 1800 || MMR2 < 1800) && MaxPlayersPerTeam == 2 && MMRDiff <= maxDefaultRatingDifference) // in 2v2 below 1800 mmr - priority for default allowed difference + { + minOponentMMRDiff = MMRDiff; oponentItr = itr2; oponentQueue = j; + brk = true; + break; + } + } + } + if (brk) + break; + } - if (oponentQueue != BG_QUEUE_GROUP_TYPES_COUNT) - { - if (oponentValid) - { - itr_teams[i] = itr; - itr_teams[i == 0 ? 1 : 0] = oponentItr; + if (oponentQueue != BG_QUEUE_GROUP_TYPES_COUNT) + { + if (oponentValid) + { + itr_teams[i] = itr; + itr_teams[i == 0 ? 1 : 0] = oponentItr; - { - GroupQueueInfo* aTeam = *itr_teams[TEAM_ALLIANCE]; - GroupQueueInfo* hTeam = *itr_teams[TEAM_HORDE]; - Battleground* arena = sBattlegroundMgr->CreateNewBattleground(m_bgTypeId, bracketEntry->minLevel, bracketEntry->maxLevel, m_arenaType, true); - if (!arena) - return; + { + GroupQueueInfo* aTeam = *itr_teams[TEAM_ALLIANCE]; + GroupQueueInfo* hTeam = *itr_teams[TEAM_HORDE]; + Battleground* arena = sBattlegroundMgr->CreateNewBattleground(m_bgTypeId, bracketEntry->minLevel, bracketEntry->maxLevel, m_arenaType, true); + if (!arena) + return; - aTeam->OpponentsTeamRating = hTeam->ArenaTeamRating; - hTeam->OpponentsTeamRating = aTeam->ArenaTeamRating; - aTeam->OpponentsMatchmakerRating = hTeam->ArenaMatchmakerRating; - hTeam->OpponentsMatchmakerRating = aTeam->ArenaMatchmakerRating; + aTeam->OpponentsTeamRating = hTeam->ArenaTeamRating; + hTeam->OpponentsTeamRating = aTeam->ArenaTeamRating; + aTeam->OpponentsMatchmakerRating = hTeam->ArenaMatchmakerRating; + hTeam->OpponentsMatchmakerRating = aTeam->ArenaMatchmakerRating; - // 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 (aTeam->teamId != TEAM_ALLIANCE) - { - aTeam->_groupType = BG_QUEUE_PREMADE_ALLIANCE; - m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(aTeam); - m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].erase(itr_teams[TEAM_ALLIANCE]); - increaseItr = false; - itr = m_QueuedGroups[bracket_id][i].begin(); - } - if (hTeam->teamId != TEAM_HORDE) - { - hTeam->_groupType = BG_QUEUE_PREMADE_HORDE; - m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].push_front(hTeam); - m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_teams[TEAM_HORDE]); - increaseItr = false; - itr = m_QueuedGroups[bracket_id][i].begin(); - } + // 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 (aTeam->teamId != TEAM_ALLIANCE) + { + aTeam->_groupType = BG_QUEUE_PREMADE_ALLIANCE; + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(aTeam); + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].erase(itr_teams[TEAM_ALLIANCE]); + increaseItr = false; + itr = m_QueuedGroups[bracket_id][i].begin(); + } + if (hTeam->teamId != TEAM_HORDE) + { + hTeam->_groupType = BG_QUEUE_PREMADE_HORDE; + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].push_front(hTeam); + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_teams[TEAM_HORDE]); + increaseItr = false; + itr = m_QueuedGroups[bracket_id][i].begin(); + } - arena->SetArenaMatchmakerRating(TEAM_ALLIANCE, aTeam->ArenaMatchmakerRating); - arena->SetArenaMatchmakerRating(TEAM_HORDE, hTeam->ArenaMatchmakerRating); - BattlegroundMgr::InviteGroupToBG(aTeam, arena, TEAM_ALLIANCE); - BattlegroundMgr::InviteGroupToBG(hTeam, arena, TEAM_HORDE); + arena->SetArenaMatchmakerRating(TEAM_ALLIANCE, aTeam->ArenaMatchmakerRating); + arena->SetArenaMatchmakerRating(TEAM_HORDE, hTeam->ArenaMatchmakerRating); + BattlegroundMgr::InviteGroupToBG(aTeam, arena, TEAM_ALLIANCE); + BattlegroundMgr::InviteGroupToBG(hTeam, arena, TEAM_HORDE); - arena->StartBattleground(); - } + arena->StartBattleground(); + } - if (arenaRatedTeamId) - return; - else - continue; - } - else if (arenaRatedTeamId) - return; - } - } - } + if (arenaRatedTeamId) + return; + else + continue; + } + else if (arenaRatedTeamId) + return; + } + } + } } } @@ -956,10 +956,10 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) if (!bg) return true; - // check if still in queue for this battleground - BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(m_BgTypeId, m_ArenaType); + // check if still in queue for this battleground + BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(m_BgTypeId, m_ArenaType); uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId); - if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) + if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) { // confirm the player is invited to this instance id (he didn't requeue in the meanwhile) BattlegroundQueue &bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); @@ -984,7 +984,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(m_PlayerGuid); - // player logged off, so he is no longer in queue + // player logged off, so he is no longer in queue if (!player) return true; @@ -992,7 +992,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) // battleground can be already deleted, bg may be NULL! - // check if still in queue for this battleground + // check if still in queue for this battleground uint32 queueSlot = player->GetBattlegroundQueueIndex(m_BgQueueTypeId); if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue { diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h index 7076400bd..8317c1fa5 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.h +++ b/src/server/game/Battlegrounds/BattlegroundQueue.h @@ -44,9 +44,9 @@ struct GroupQueueInfo // stores informatio uint32 OpponentsTeamRating; // for rated arena matches uint32 OpponentsMatchmakerRating; // for rated arena matches - // pussywizard: for internal use - uint8 _bracketId; - uint8 _groupType; + // pussywizard: for internal use + uint8 _bracketId; + uint8 _groupType; }; enum BattlegroundQueueGroupTypes @@ -81,8 +81,8 @@ class BattlegroundQueue void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo); uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const; - void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard - void AddEvent(BasicEvent* Event, uint64 e_time); + void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard + void AddEvent(BasicEvent* Event, uint64 e_time); typedef std::map QueuedPlayersMap; QueuedPlayersMap m_QueuedPlayers; @@ -104,24 +104,24 @@ class BattlegroundQueue // class to select and invite groups to bg class SelectionPool { - public: - SelectionPool(): PlayerCount(0) {}; - void Init(); - bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount); - bool KickGroup(const uint32 size); - uint32 GetPlayerCount() const {return PlayerCount;} - public: - GroupsQueueType SelectedGroups; - private: - uint32 PlayerCount; + public: + SelectionPool(): PlayerCount(0) {}; + void Init(); + bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount); + bool KickGroup(const uint32 size); + uint32 GetPlayerCount() const {return PlayerCount;} + public: + GroupsQueueType SelectedGroups; + private: + uint32 PlayerCount; }; //one selection pool for horde, other one for alliance SelectionPool m_SelectionPools[BG_TEAMS_COUNT]; private: - BattlegroundTypeId m_bgTypeId; - ArenaType m_arenaType; + BattlegroundTypeId m_bgTypeId; + ArenaType m_arenaType; uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME]; uint32 m_WaitTimeLastIndex[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS]; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 258fdbecf..779ead49e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -20,12 +20,12 @@ BattlegroundAB::BattlegroundAB() BgObjects.resize(BG_AB_OBJECT_MAX); BgCreatures.resize(BG_AB_ALL_NODES_COUNT + BG_AB_DYNAMIC_NODES_COUNT); // xinef: +BG_AB_DYNAMIC_NODES_COUNT buff triggers - _controlledPoints[TEAM_ALLIANCE] = 0; - _controlledPoints[TEAM_HORDE] = 0; + _controlledPoints[TEAM_ALLIANCE] = 0; + _controlledPoints[TEAM_HORDE] = 0; _teamScores500Disadvantage[TEAM_ALLIANCE] = false; - _teamScores500Disadvantage[TEAM_HORDE] = false; - _honorTics = 0; - _reputationTics = 0; + _teamScores500Disadvantage[TEAM_HORDE] = false; + _honorTics = 0; + _reputationTics = 0; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; @@ -41,77 +41,77 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) { if (GetStatus() == STATUS_IN_PROGRESS) { - _bgEvents.Update(diff); - while (uint32 eventId =_bgEvents.ExecuteEvent()) - switch (eventId) - { - case BG_AB_EVENT_UPDATE_BANNER_STABLE: - case BG_AB_EVENT_UPDATE_BANNER_FARM: - case BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH: - case BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL: - case BG_AB_EVENT_UPDATE_BANNER_GOLDMINE: - CreateBanner(eventId - BG_AB_EVENT_UPDATE_BANNER_STABLE, false); - break; - case BG_AB_EVENT_CAPTURE_STABLE: - case BG_AB_EVENT_CAPTURE_FARM: - case BG_AB_EVENT_CAPTURE_BLACKSMITH: - case BG_AB_EVENT_CAPTURE_LUMBERMILL: - case BG_AB_EVENT_CAPTURE_GOLDMINE: - { - uint8 node = eventId - BG_AB_EVENT_CAPTURE_STABLE; - TeamId teamId = _capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED ? TEAM_ALLIANCE : TEAM_HORDE; - DeleteBanner(node); - _capturePointInfo[node]._ownerTeamId = teamId; - _capturePointInfo[node]._state = teamId == TEAM_ALLIANCE ? BG_AB_NODE_STATE_ALLY_OCCUPIED : BG_AB_NODE_STATE_HORDE_OCCUPIED; - _capturePointInfo[node]._captured = true; + _bgEvents.Update(diff); + while (uint32 eventId =_bgEvents.ExecuteEvent()) + switch (eventId) + { + case BG_AB_EVENT_UPDATE_BANNER_STABLE: + case BG_AB_EVENT_UPDATE_BANNER_FARM: + case BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH: + case BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL: + case BG_AB_EVENT_UPDATE_BANNER_GOLDMINE: + CreateBanner(eventId - BG_AB_EVENT_UPDATE_BANNER_STABLE, false); + break; + case BG_AB_EVENT_CAPTURE_STABLE: + case BG_AB_EVENT_CAPTURE_FARM: + case BG_AB_EVENT_CAPTURE_BLACKSMITH: + case BG_AB_EVENT_CAPTURE_LUMBERMILL: + case BG_AB_EVENT_CAPTURE_GOLDMINE: + { + uint8 node = eventId - BG_AB_EVENT_CAPTURE_STABLE; + TeamId teamId = _capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED ? TEAM_ALLIANCE : TEAM_HORDE; + DeleteBanner(node); + _capturePointInfo[node]._ownerTeamId = teamId; + _capturePointInfo[node]._state = teamId == TEAM_ALLIANCE ? BG_AB_NODE_STATE_ALLY_OCCUPIED : BG_AB_NODE_STATE_HORDE_OCCUPIED; + _capturePointInfo[node]._captured = true; CreateBanner(node, false); NodeOccupied(node); SendNodeUpdate(node); - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, teamId == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, teamId == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE, LANG_BG_AB_NODE_STABLES + node); - PlaySoundToAll(teamId == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_CAPTURED_ALLIANCE : BG_AB_SOUND_NODE_CAPTURED_HORDE); - break; - } - case BG_AB_EVENT_ALLIANCE_TICK: - case BG_AB_EVENT_HORDE_TICK: - { - TeamId teamId = TeamId(eventId - BG_AB_EVENT_ALLIANCE_TICK); - uint8 controlledPoints = _controlledPoints[teamId]; - if (controlledPoints == 0) - { - _bgEvents.ScheduleEvent(eventId, 3000); - break; - } + SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, teamId == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, teamId == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE, LANG_BG_AB_NODE_STABLES + node); + PlaySoundToAll(teamId == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_CAPTURED_ALLIANCE : BG_AB_SOUND_NODE_CAPTURED_HORDE); + break; + } + case BG_AB_EVENT_ALLIANCE_TICK: + case BG_AB_EVENT_HORDE_TICK: + { + TeamId teamId = TeamId(eventId - BG_AB_EVENT_ALLIANCE_TICK); + uint8 controlledPoints = _controlledPoints[teamId]; + if (controlledPoints == 0) + { + _bgEvents.ScheduleEvent(eventId, 3000); + break; + } - uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics); - uint8 reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics); - uint8 information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE); - m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints]; - if (m_TeamScores[teamId] > BG_AB_MAX_TEAM_SCORE) - m_TeamScores[teamId] = BG_AB_MAX_TEAM_SCORE; + uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics); + uint8 reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics); + uint8 information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE); + m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints]; + if (m_TeamScores[teamId] > BG_AB_MAX_TEAM_SCORE) + m_TeamScores[teamId] = BG_AB_MAX_TEAM_SCORE; - if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics)) - RewardHonorToTeam(GetBonusHonorFromKill(1), teamId); - if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics)) - RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId); - if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE)) - { - SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_AB_A_NEAR_VICTORY : LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); - PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY); - } + if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics)) + RewardHonorToTeam(GetBonusHonorFromKill(1), teamId); + if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics)) + RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId); + if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE)) + { + SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_AB_A_NEAR_VICTORY : LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); + PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY); + } - UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_AB_OP_RESOURCES_ALLY : BG_AB_OP_RESOURCES_HORDE, m_TeamScores[teamId]); - if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500) - _teamScores500Disadvantage[GetOtherTeamId(teamId)] = true; - if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE) - EndBattleground(teamId); + UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_AB_OP_RESOURCES_ALLY : BG_AB_OP_RESOURCES_HORDE, m_TeamScores[teamId]); + if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500) + _teamScores500Disadvantage[GetOtherTeamId(teamId)] = true; + if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE) + EndBattleground(teamId); - _bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]); - break; - } - } - } + _bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]); + break; + } + } + } } void BattlegroundAB::StartingEventCloseDoors() @@ -140,8 +140,8 @@ void BattlegroundAB::StartingEventOpenDoors() DoorOpen(BG_AB_OBJECT_GATE_A); DoorOpen(BG_AB_OBJECT_GATE_H); StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_AB_EVENT_START_BATTLE); - _bgEvents.ScheduleEvent(BG_AB_EVENT_ALLIANCE_TICK, 3000); - _bgEvents.ScheduleEvent(BG_AB_EVENT_HORDE_TICK, 3000); + _bgEvents.ScheduleEvent(BG_AB_EVENT_ALLIANCE_TICK, 3000); + _bgEvents.ScheduleEvent(BG_AB_EVENT_HORDE_TICK, 3000); } void BattlegroundAB::AddPlayer(Player* player) @@ -152,7 +152,7 @@ void BattlegroundAB::AddPlayer(Player* player) void BattlegroundAB::RemovePlayer(Player* player) { - player->SetPhaseMask(1, false); + player->SetPhaseMask(1, false); } void BattlegroundAB::HandleAreaTrigger(Player* player, uint32 trigger) @@ -194,26 +194,26 @@ void BattlegroundAB::CreateBanner(uint8 node, bool delay) return; } - SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_IMMEDIATELY); - SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_IMMEDIATELY); + SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_IMMEDIATELY); + SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_IMMEDIATELY); } void BattlegroundAB::DeleteBanner(uint8 node) { - SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_ONE_DAY); - SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_ONE_DAY); + SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_ONE_DAY); + SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_ONE_DAY); } void BattlegroundAB::FillInitialWorldStates(WorldPacket& data) { for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) - { - if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL) - data << uint32(_capturePointInfo[node]._iconNone) << uint32(1); + { + if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL) + data << uint32(_capturePointInfo[node]._iconNone) << uint32(1); - for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i) - data << uint32(_capturePointInfo[node]._iconCapture + i-1) << uint32(_capturePointInfo[node]._state == i); - } + for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i) + data << uint32(_capturePointInfo[node]._iconCapture + i-1) << uint32(_capturePointInfo[node]._state == i); + } data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(_controlledPoints[TEAM_ALLIANCE]); data << uint32(BG_AB_OP_OCCUPIED_BASES_HORDE) << uint32(_controlledPoints[TEAM_HORDE]); @@ -226,9 +226,9 @@ void BattlegroundAB::FillInitialWorldStates(WorldPacket& data) void BattlegroundAB::SendNodeUpdate(uint8 node) { - UpdateWorldState(_capturePointInfo[node]._iconNone, 0); - for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i) - UpdateWorldState(_capturePointInfo[node]._iconCapture + i-1, _capturePointInfo[node]._state == i); + UpdateWorldState(_capturePointInfo[node]._iconNone, 0); + for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i) + UpdateWorldState(_capturePointInfo[node]._iconCapture + i-1, _capturePointInfo[node]._state == i); UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, _controlledPoints[TEAM_ALLIANCE]); UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, _controlledPoints[TEAM_HORDE]); @@ -236,16 +236,16 @@ void BattlegroundAB::SendNodeUpdate(uint8 node) void BattlegroundAB::NodeOccupied(uint8 node) { - ApplyPhaseMask(); - AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], _capturePointInfo[node]._ownerTeamId); + ApplyPhaseMask(); + AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], _capturePointInfo[node]._ownerTeamId); - ++_controlledPoints[_capturePointInfo[node]._ownerTeamId]; + ++_controlledPoints[_capturePointInfo[node]._ownerTeamId]; if (_controlledPoints[_capturePointInfo[node]._ownerTeamId] >= 5) CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, _capturePointInfo[node]._ownerTeamId); if (_controlledPoints[_capturePointInfo[node]._ownerTeamId] >= 4) CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, _capturePointInfo[node]._ownerTeamId); - Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_AB_ALL_NODES_COUNT + node]); + Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_AB_ALL_NODES_COUNT + node]); if (!trigger) trigger = AddCreature(WORLD_TRIGGER, BG_AB_ALL_NODES_COUNT + node, BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1], BG_AB_NodePositions[node][2], BG_AB_NodePositions[node][3]); @@ -258,10 +258,10 @@ void BattlegroundAB::NodeOccupied(uint8 node) void BattlegroundAB::NodeDeoccupied(uint8 node) { - --_controlledPoints[_capturePointInfo[node]._ownerTeamId]; + --_controlledPoints[_capturePointInfo[node]._ownerTeamId]; - _capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL; - RelocateDeadPlayers(BgCreatures[node]); + _capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL; + RelocateDeadPlayers(BgCreatures[node]); DelCreature(node); // Delete spirit healer DelCreature(BG_AB_ALL_NODES_COUNT + node); // Delete aura trigger @@ -270,90 +270,90 @@ void BattlegroundAB::NodeDeoccupied(uint8 node) void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameObject) { if (GetStatus() != STATUS_IN_PROGRESS || !player->IsWithinDistInMap(gameObject, 10.0f)) - return; + return; uint8 node = BG_AB_NODE_STABLES; - for (; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) - if (player->GetDistance2d(BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1]) < 10.0f) - break; + for (; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) + if (player->GetDistance2d(BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1]) < 10.0f) + break; if (node == BG_AB_DYNAMIC_NODES_COUNT || _capturePointInfo[node]._ownerTeamId == player->GetTeamId() || - (_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED && player->GetTeamId() == TEAM_ALLIANCE) || - (_capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED && player->GetTeamId() == TEAM_HORDE)) + (_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED && player->GetTeamId() == TEAM_ALLIANCE) || + (_capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED && player->GetTeamId() == TEAM_HORDE)) return; player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); uint32 sound = 0; - uint32 message = 0; - uint32 message2 = 0; - DeleteBanner(node); + uint32 message = 0; + uint32 message2 = 0; + DeleteBanner(node); CreateBanner(node, true); - if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL) + if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL) { - player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0); + player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0); UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1); - _capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId(); - _capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL; - _bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME); + _capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId(); + _capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL; + _bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME); sound = BG_AB_SOUND_NODE_CLAIMED; - message = LANG_BG_AB_NODE_CLAIMED; - message2 = player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE; + message = LANG_BG_AB_NODE_CLAIMED; + message2 = player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE; } else if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED || _capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED) { - if (!_capturePointInfo[node]._captured) + if (!_capturePointInfo[node]._captured) { - player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0); + player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0); UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1); - _capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId(); - _capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL; - _bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME); + _capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId(); + _capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL; + _bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME); message = LANG_BG_AB_NODE_ASSAULTED; } else { UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1); - _capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_OCCUPIED + player->GetTeamId(); - _capturePointInfo[node]._ownerTeamId = player->GetTeamId(); - _bgEvents.CancelEvent(BG_AB_EVENT_CAPTURE_STABLE + node); + _capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_OCCUPIED + player->GetTeamId(); + _capturePointInfo[node]._ownerTeamId = player->GetTeamId(); + _bgEvents.CancelEvent(BG_AB_EVENT_CAPTURE_STABLE + node); NodeOccupied(node); // after setting team owner message = LANG_BG_AB_NODE_DEFENDED; } - sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; + sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } else { - player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0); + player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0); UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1); NodeDeoccupied(node); // before setting team owner to neutral - _capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId(); + _capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId(); - ApplyPhaseMask(); - _bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME); + ApplyPhaseMask(); + _bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME); message = LANG_BG_AB_NODE_ASSAULTED; sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } SendNodeUpdate(node); PlaySoundToAll(sound); - SendMessage2ToAll(message, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, player, LANG_BG_AB_NODE_STABLES + node, message2); + SendMessage2ToAll(message, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, player, LANG_BG_AB_NODE_STABLES + node, message2); } TeamId BattlegroundAB::GetPrematureWinner() { if (_controlledPoints[TEAM_ALLIANCE] > _controlledPoints[TEAM_HORDE]) return TEAM_ALLIANCE; - return _controlledPoints[TEAM_HORDE] > _controlledPoints[TEAM_ALLIANCE] ? TEAM_HORDE : Battleground::GetPrematureWinner(); + return _controlledPoints[TEAM_HORDE] > _controlledPoints[TEAM_ALLIANCE] ? TEAM_HORDE : Battleground::GetPrematureWinner(); } bool BattlegroundAB::SetupBattleground() { for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) { - AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + BG_AB_OBJECTS_PER_NODE*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_NEUTRAL + BG_AB_OBJECTS_PER_NODE*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_ALLY + BG_AB_OBJECTS_PER_NODE*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); AddObject(BG_AB_OBJECT_BANNER_HORDE + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_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_CONT_A + BG_AB_OBJECTS_PER_NODE*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); @@ -373,22 +373,22 @@ bool BattlegroundAB::SetupBattleground() 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); } - AddSpiritGuide(BG_AB_SPIRIT_ALIANCE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][3], TEAM_ALLIANCE); - AddSpiritGuide(BG_AB_SPIRIT_HORDE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][3], TEAM_HORDE); + AddSpiritGuide(BG_AB_SPIRIT_ALIANCE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][3], TEAM_ALLIANCE); + AddSpiritGuide(BG_AB_SPIRIT_HORDE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][3], TEAM_HORDE); - for (uint32 i = BG_AB_OBJECT_BANNER_NEUTRAL; i < BG_AB_OBJECT_MAX; ++i) - if (BgObjects[i] == 0) - { - sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!"); - return false; - } + for (uint32 i = BG_AB_OBJECT_BANNER_NEUTRAL; i < BG_AB_OBJECT_MAX; ++i) + if (BgObjects[i] == 0) + { + sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!"); + return false; + } - for (uint32 i = BG_AB_SPIRIT_ALIANCE; i <= BG_AB_SPIRIT_HORDE; ++i) - if (BgCreatures[i] == 0) - { - sLog->outErrorDb("BatteGroundAB: Failed to spawn spirit guides Battleground not created!"); - return false; - } + for (uint32 i = BG_AB_SPIRIT_ALIANCE; i <= BG_AB_SPIRIT_HORDE; ++i) + if (BgCreatures[i] == 0) + { + sLog->outErrorDb("BatteGroundAB: Failed to spawn spirit guides Battleground not created!"); + return false; + } return true; } @@ -398,21 +398,21 @@ void BattlegroundAB::Init() //call parent's class reset Battleground::Init(); - _bgEvents.Reset(); + _bgEvents.Reset(); - _honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_HONOR_TICK_WEEKEND : BG_AB_HONOR_TICK_NORMAL; - _reputationTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_REP_TICK_WEEKEND : BG_AB_REP_TICK_NORMAL; + _honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_HONOR_TICK_WEEKEND : BG_AB_HONOR_TICK_NORMAL; + _reputationTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_REP_TICK_WEEKEND : BG_AB_REP_TICK_NORMAL; - _capturePointInfo[BG_AB_NODE_STABLES]._iconNone = BG_AB_OP_STABLE_ICON; - _capturePointInfo[BG_AB_NODE_FARM]._iconNone = BG_AB_OP_FARM_ICON; - _capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconNone = BG_AB_OP_BLACKSMITH_ICON; - _capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconNone = BG_AB_OP_LUMBERMILL_ICON; - _capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconNone = BG_AB_OP_GOLDMINE_ICON; - _capturePointInfo[BG_AB_NODE_STABLES]._iconCapture = BG_AB_OP_STABLE_STATE_ALIENCE; - _capturePointInfo[BG_AB_NODE_FARM]._iconCapture = BG_AB_OP_FARM_STATE_ALIENCE; - _capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconCapture = BG_AB_OP_BLACKSMITH_STATE_ALIENCE; - _capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconCapture = BG_AB_OP_LUMBERMILL_STATE_ALIENCE; - _capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconCapture = BG_AB_OP_GOLDMINE_STATE_ALIENCE; + _capturePointInfo[BG_AB_NODE_STABLES]._iconNone = BG_AB_OP_STABLE_ICON; + _capturePointInfo[BG_AB_NODE_FARM]._iconNone = BG_AB_OP_FARM_ICON; + _capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconNone = BG_AB_OP_BLACKSMITH_ICON; + _capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconNone = BG_AB_OP_LUMBERMILL_ICON; + _capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconNone = BG_AB_OP_GOLDMINE_ICON; + _capturePointInfo[BG_AB_NODE_STABLES]._iconCapture = BG_AB_OP_STABLE_STATE_ALIENCE; + _capturePointInfo[BG_AB_NODE_FARM]._iconCapture = BG_AB_OP_FARM_STATE_ALIENCE; + _capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconCapture = BG_AB_OP_BLACKSMITH_STATE_ALIENCE; + _capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconCapture = BG_AB_OP_LUMBERMILL_STATE_ALIENCE; + _capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconCapture = BG_AB_OP_GOLDMINE_STATE_ALIENCE; } void BattlegroundAB::EndBattleground(TeamId winnerTeamId) @@ -421,23 +421,23 @@ void BattlegroundAB::EndBattleground(TeamId winnerTeamId) RewardHonorToTeam(GetBonusHonorFromKill(1), TEAM_HORDE); RewardHonorToTeam(GetBonusHonorFromKill(1), TEAM_ALLIANCE); Battleground::EndBattleground(winnerTeamId); - _bgEvents.Reset(); + _bgEvents.Reset(); } WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveyard(Player* player) { - WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[BG_AB_SPIRIT_ALIANCE + player->GetTeamId()]); + WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[BG_AB_SPIRIT_ALIANCE + player->GetTeamId()]); WorldSafeLocsEntry const* nearestEntry = entry; - float pX = player->GetPositionX(); - float pY = player->GetPositionY(); - float dist = (entry->x - pX)*(entry->x - pX)+(entry->y - pY)*(entry->y - pY); - float minDist = dist; + float pX = player->GetPositionX(); + float pY = player->GetPositionY(); + float dist = (entry->x - pX)*(entry->x - pX)+(entry->y - pY)*(entry->y - pY); + float minDist = dist; - for (uint8 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) - if (_capturePointInfo[i]._ownerTeamId == player->GetTeamId()) - { - entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[i]); + for (uint8 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + if (_capturePointInfo[i]._ownerTeamId == player->GetTeamId()) + { + entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[i]); dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY); if (dist < minDist) { @@ -478,15 +478,15 @@ bool BattlegroundAB::AllNodesConrolledByTeam(TeamId teamId) const void BattlegroundAB::ApplyPhaseMask() { - uint32 phaseMask = 1; - for (uint32 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) - if (_capturePointInfo[i]._ownerTeamId != TEAM_NEUTRAL) - phaseMask |= 1 << (i*2+1 + _capturePointInfo[i]._ownerTeamId); + uint32 phaseMask = 1; + for (uint32 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + if (_capturePointInfo[i]._ownerTeamId != TEAM_NEUTRAL) + phaseMask |= 1 << (i*2+1 + _capturePointInfo[i]._ownerTeamId); - const BattlegroundPlayerMap& bgPlayerMap = GetPlayers(); - for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr) - { - itr->second->SetPhaseMask(phaseMask, false); - itr->second->UpdateObjectVisibility(true, false); - } + const BattlegroundPlayerMap& bgPlayerMap = GetPlayers(); + for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr) + { + itr->second->SetPhaseMask(phaseMask, false); + itr->second->UpdateObjectVisibility(true, false); + } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 4ff87eda8..c32936a76 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -9,20 +9,20 @@ REWRITTEN BY XINEF enum BG_AB_Events { - BG_AB_EVENT_UPDATE_BANNER_STABLE = 1, - BG_AB_EVENT_UPDATE_BANNER_FARM = 2, - BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH = 3, - BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL = 4, - BG_AB_EVENT_UPDATE_BANNER_GOLDMINE = 5, + BG_AB_EVENT_UPDATE_BANNER_STABLE = 1, + BG_AB_EVENT_UPDATE_BANNER_FARM = 2, + BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH = 3, + BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL = 4, + BG_AB_EVENT_UPDATE_BANNER_GOLDMINE = 5, - BG_AB_EVENT_CAPTURE_STABLE = 6, - BG_AB_EVENT_CAPTURE_FARM = 7, - BG_AB_EVENT_CAPTURE_BLACKSMITH = 8, - BG_AB_EVENT_CAPTURE_LUMBERMILL = 9, - BG_AB_EVENT_CAPTURE_GOLDMINE = 10, + BG_AB_EVENT_CAPTURE_STABLE = 6, + BG_AB_EVENT_CAPTURE_FARM = 7, + BG_AB_EVENT_CAPTURE_BLACKSMITH = 8, + BG_AB_EVENT_CAPTURE_LUMBERMILL = 9, + BG_AB_EVENT_CAPTURE_GOLDMINE = 10, - BG_AB_EVENT_ALLIANCE_TICK = 11, - BG_AB_EVENT_HORDE_TICK = 12 + BG_AB_EVENT_ALLIANCE_TICK = 11, + BG_AB_EVENT_HORDE_TICK = 12 }; enum BG_AB_WorldStates @@ -67,11 +67,11 @@ enum BG_AB_WorldStates enum BG_AB_ObjectIds { - BG_AB_OBJECTID_NODE_BANNER_0 = 180087, // Stables banner - BG_AB_OBJECTID_NODE_BANNER_1 = 180088, // Blacksmith banner - BG_AB_OBJECTID_NODE_BANNER_2 = 180089, // Farm banner - BG_AB_OBJECTID_NODE_BANNER_3 = 180090, // Lumber mill banner - BG_AB_OBJECTID_NODE_BANNER_4 = 180091, // Gold mine banner + BG_AB_OBJECTID_NODE_BANNER_0 = 180087, // Stables banner + BG_AB_OBJECTID_NODE_BANNER_1 = 180088, // Blacksmith banner + BG_AB_OBJECTID_NODE_BANNER_2 = 180089, // Farm banner + BG_AB_OBJECTID_NODE_BANNER_3 = 180090, // Lumber mill banner + BG_AB_OBJECTID_NODE_BANNER_4 = 180091, // Gold mine banner BG_AB_OBJECTID_BANNER_A = 180058, BG_AB_OBJECTID_BANNER_CONT_A = 180059, @@ -96,7 +96,7 @@ enum BG_AB_ObjectType BG_AB_OBJECT_AURA_ALLY = 5, BG_AB_OBJECT_AURA_HORDE = 6, BG_AB_OBJECT_AURA_CONTESTED = 7, - BG_AB_OBJECTS_PER_NODE = 8, + BG_AB_OBJECTS_PER_NODE = 8, BG_AB_OBJECT_GATE_A = 40, BG_AB_OBJECT_GATE_H = 41, @@ -135,11 +135,11 @@ enum BG_AB_BattlegroundNodes enum BG_AB_NodeStatus { - BG_AB_NODE_STATE_NEUTRAL = 0, - BG_AB_NODE_STATE_ALLY_OCCUPIED = 1, - BG_AB_NODE_STATE_HORDE_OCCUPIED = 2, - BG_AB_NODE_STATE_ALLY_CONTESTED = 3, - BG_AB_NODE_STATE_HORDE_CONTESTED = 4 + BG_AB_NODE_STATE_NEUTRAL = 0, + BG_AB_NODE_STATE_ALLY_OCCUPIED = 1, + BG_AB_NODE_STATE_HORDE_OCCUPIED = 2, + BG_AB_NODE_STATE_ALLY_CONTESTED = 3, + BG_AB_NODE_STATE_HORDE_CONTESTED = 4 }; enum BG_AB_Sounds @@ -156,19 +156,19 @@ enum BG_AB_Misc { BG_AB_OBJECTIVE_ASSAULT_BASE = 122, BG_AB_OBJECTIVE_DEFEND_BASE = 123, - BG_AB_EVENT_START_BATTLE = 9158, // Achievement: Let's Get This Done - BG_AB_QUEST_CREDIT_BASE = 15001, + BG_AB_EVENT_START_BATTLE = 9158, // Achievement: Let's Get This Done + BG_AB_QUEST_CREDIT_BASE = 15001, - BG_AB_HONOR_TICK_NORMAL = 260, - BG_AB_HONOR_TICK_WEEKEND = 160, - BG_AB_REP_TICK_NORMAL = 160, - BG_AB_REP_TICK_WEEKEND = 120, + BG_AB_HONOR_TICK_NORMAL = 260, + BG_AB_HONOR_TICK_WEEKEND = 160, + BG_AB_REP_TICK_NORMAL = 160, + BG_AB_REP_TICK_WEEKEND = 120, BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400, BG_AB_MAX_TEAM_SCORE = 1600, BG_AB_FLAG_CAPTURING_TIME = 60000, - BG_AB_BANNER_UPDATE_TIME = 2000 + BG_AB_BANNER_UPDATE_TIME = 2000 }; const uint32 BG_AB_TickIntervals[BG_AB_DYNAMIC_NODES_COUNT+1] = {0, 12000, 9000, 6000, 3000, 1000}; @@ -250,26 +250,26 @@ class BattlegroundAB : public Battleground void SendNodeUpdate(uint8 node); void NodeOccupied(uint8 node); void NodeDeoccupied(uint8 node); - void ApplyPhaseMask(); + void ApplyPhaseMask(); - struct CapturePointInfo - { - CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false) - { - } + struct CapturePointInfo + { + CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false) + { + } - uint8 _state; - uint32 _iconNone; - uint32 _iconCapture; - TeamId _ownerTeamId; - bool _captured; - }; + uint8 _state; + uint32 _iconNone; + uint32 _iconCapture; + TeamId _ownerTeamId; + bool _captured; + }; - CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT]; - EventMap _bgEvents; + CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT]; + EventMap _bgEvents; uint32 _honorTics; uint32 _reputationTics; - uint8 _controlledPoints[BG_TEAMS_COUNT]; + uint8 _controlledPoints[BG_TEAMS_COUNT]; bool _teamScores500Disadvantage[BG_TEAMS_COUNT]; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 08405106c..edbccdc17 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -736,7 +736,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) creatureid=(ownerId == TEAM_ALLIANCE)?AV_NPC_A_TOWERDEFENSE:AV_NPC_H_TOWERDEFENSE; else { - if (m_Team_QuestStatus[ownerId][0] < 500) + if (m_Team_QuestStatus[ownerId][0] < 500) creatureid = (ownerId == TEAM_ALLIANCE)? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0; else if (m_Team_QuestStatus[ownerId][0] < 1000) creatureid = (ownerId == TEAM_ALLIANCE)? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1; @@ -1008,8 +1008,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) } } - // xinef: moved here, assure that no call to m_Nodes is used in IF statement bellow as it is modified - AssaultNode(node, teamId); + // xinef: moved here, assure that no call to m_Nodes is used in IF statement bellow as it is modified + AssaultNode(node, teamId); //if snowfall gots capped it can be handled like all other graveyards if (m_Nodes[node].TotalOwnerId != TEAM_NEUTRAL) @@ -1134,8 +1134,8 @@ void BattlegroundAV::SendMineWorldStates(uint32 mine) else if (m_Mine_Owner[mine] == TEAM_HORDE) owner = 2; - for (uint8 i = 0; i < 3; ++i) - UpdateWorldState(BG_AV_MineWorldStates[mine][i], 0); // Xinef: Clear data for consistency and buglessness + for (uint8 i = 0; i < 3; ++i) + UpdateWorldState(BG_AV_MineWorldStates[mine][i], 0); // Xinef: Clear data for consistency and buglessness UpdateWorldState(BG_AV_MineWorldStates[mine][owner], 1); } @@ -1295,21 +1295,21 @@ bool BattlegroundAV::SetupBattleground() } } - // Handpacked snowdrift, only during holiday - if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) - for (uint16 i= 0 ; i <= (BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX-BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN); i++) - { - if (!AddObject(BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN+i, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), RESPAWN_ONE_DAY)) - return false; - } + // Handpacked snowdrift, only during holiday + if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) + for (uint16 i= 0 ; i <= (BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX-BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN); i++) + { + if (!AddObject(BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN+i, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), RESPAWN_ONE_DAY)) + return false; + } - // Quest banners - if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), RESPAWN_ONE_DAY)) + // Quest banners + if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), RESPAWN_ONE_DAY)) { sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8"); return false; } - if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), RESPAWN_ONE_DAY)) + if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), RESPAWN_ONE_DAY)) { sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8"); return false; @@ -1354,15 +1354,15 @@ bool BattlegroundAV::SetupBattleground() SpawnBGObject(i, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY); - - // Handpacked snowdrift, only during holiday - if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) - for (i = BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN ; i <= BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX; i++) - SpawnBGObject(i, RESPAWN_IMMEDIATELY); + + // Handpacked snowdrift, only during holiday + if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) + for (i = BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN ; i <= BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX; i++) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); - // Quest banners - SpawnBGObject(BG_AV_OBJECT_FROSTWOLF_BANNER, RESPAWN_IMMEDIATELY); - SpawnBGObject(BG_AV_OBJECT_STORMPIKE_BANNER, RESPAWN_IMMEDIATELY); + // Quest banners + SpawnBGObject(BG_AV_OBJECT_FROSTWOLF_BANNER, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_AV_OBJECT_STORMPIKE_BANNER, RESPAWN_IMMEDIATELY); //creatures ;//sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes"); @@ -1509,7 +1509,7 @@ void BattlegroundAV::ResetBGSubclass() bool BattlegroundAV::IsBothMinesControlledByTeam(TeamId teamId) const { for (uint8 mine = 0; mine < 2; mine++) - if (m_Mine_Owner[mine] != teamId) + if (m_Mine_Owner[mine] != teamId) return false; return true; @@ -1567,8 +1567,8 @@ bool BattlegroundAV::IsAllTowersControlledAndCaptainAlive(TeamId teamId) const TeamId BattlegroundAV::GetPrematureWinner() { - if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE)) - return TEAM_ALLIANCE; + if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE)) + return TEAM_ALLIANCE; - return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner(); + return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner(); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 66920e8d1..a6b7d4af9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -147,17 +147,17 @@ enum BG_AV_ObjectIds BG_AV_OBJECTID_GATE_H = 180424, //mine supplies - BG_AV_OBJECTID_MINE_N = 178785, - BG_AV_OBJECTID_MINE_S = 178784, + BG_AV_OBJECTID_MINE_N = 178785, + BG_AV_OBJECTID_MINE_S = 178784, - BG_AV_OBJECTID_FIRE = 179065, - BG_AV_OBJECTID_SMOKE = 179066, + BG_AV_OBJECTID_FIRE = 179065, + BG_AV_OBJECTID_SMOKE = 179066, - // Winter Veil Hardpacked Snowdrift - BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT = 180654, + // Winter Veil Hardpacked Snowdrift + BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT = 180654, - BG_AV_OBJECTID_FROSTWOLF_BANNER = 179025, - BG_AV_OBJECTID_STORMPIKE_BANNER = 179024, + BG_AV_OBJECTID_FROSTWOLF_BANNER = 179025, + BG_AV_OBJECTID_STORMPIKE_BANNER = 179024, }; enum BG_AV_Nodes @@ -310,10 +310,10 @@ enum BG_AV_ObjectTypes BG_AV_OBJECT_MINE_SUPPLY_N_MAX = 224, BG_AV_OBJECT_MINE_SUPPLY_S_MIN = 225, BG_AV_OBJECT_MINE_SUPPLY_S_MAX = 236, - BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN = 237, - BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX = 246, - BG_AV_OBJECT_FROSTWOLF_BANNER = 247, - BG_AV_OBJECT_STORMPIKE_BANNER = 248, + BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN = 237, + BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX = 246, + BG_AV_OBJECT_FROSTWOLF_BANNER = 247, + BG_AV_OBJECT_STORMPIKE_BANNER = 248, BG_AV_OBJECT_MAX = 249 }; @@ -362,10 +362,10 @@ enum BG_AV_OBJECTS AV_OPLACE_MINE_SUPPLY_N_MAX = 136, AV_OPLACE_MINE_SUPPLY_S_MIN = 137, AV_OPLACE_MINE_SUPPLY_S_MAX = 148, - AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN = 149, - AV_OPLACE_HANDPACKED_SNOWDRIFT_MAX = 158, - AV_OPLACE_FROSTWOLF_BANNER = 159, - AV_OPLACE_STORMPIKE_BANNER = 160, + AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN = 149, + AV_OPLACE_HANDPACKED_SNOWDRIFT_MAX = 158, + AV_OPLACE_FROSTWOLF_BANNER = 159, + AV_OPLACE_STORMPIKE_BANNER = 160, AV_OPLACE_MAX = 161 }; @@ -540,19 +540,19 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = {-820.644f, -136.043f, 63.1977f, 2.40855f}, {-947.642f, -208.807f, 77.0101f, 1.36136f}, {-951.394f, -193.695f, 67.634f, 0.802851f}, - // hardpacked snowdrift - {712.1f, -446.49f, 65.74f, 2.13f}, - {696.4f, -276.4f, 28.55f, 3.2f}, - {74.0f, -313.27f, 31.16f, 0.17f}, - {-75.4f, -224.4f, 10.24f, 2.99f}, - {-160.9f, -72.1f, 33.36f, 5.5f}, - {-255.8f, -217.55f, 7.66f, 2.8f}, - {-361.49f, -115.5f, 26.42f, 0.6f}, - {-389.5f, -325.0f, 17.98f, 3.89f}, - {-919.57f, -362.48f, 52.13f, 3.8f}, - {-1259.1f, -500.8f, 50.81f, 1.2f}, - {-1552.55f, -359.738f, 66.948f, 2.8875f}, - {40.0913f, 0.0153897f, -4.0962f, 0.96131f} + // hardpacked snowdrift + {712.1f, -446.49f, 65.74f, 2.13f}, + {696.4f, -276.4f, 28.55f, 3.2f}, + {74.0f, -313.27f, 31.16f, 0.17f}, + {-75.4f, -224.4f, 10.24f, 2.99f}, + {-160.9f, -72.1f, 33.36f, 5.5f}, + {-255.8f, -217.55f, 7.66f, 2.8f}, + {-361.49f, -115.5f, 26.42f, 0.6f}, + {-389.5f, -325.0f, 17.98f, 3.89f}, + {-919.57f, -362.48f, 52.13f, 3.8f}, + {-1259.1f, -500.8f, 50.81f, 1.2f}, + {-1552.55f, -359.738f, 66.948f, 2.8875f}, + {40.0913f, 0.0153897f, -4.0962f, 0.96131f} }; const float BG_AV_DoorPositons[2][4] = @@ -1593,7 +1593,7 @@ class BattlegroundAV : public Battleground void HandleKillUnit(Creature* unit, Player* killer); void HandleQuestComplete(uint32 questid, Player* player); bool PlayerCanDoMineQuest(int32 GOId, TeamId teamId); - TeamId GetMineOwner(uint8 mine) { return m_Mine_Owner[mine]; } + TeamId GetMineOwner(uint8 mine) { return m_Mine_Owner[mine]; } void EndBattleground(TeamId winnerTeamId); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index 545e23048..d99acccab 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -115,27 +115,27 @@ void BattlegroundBE::HandleAreaTrigger(Player* player, uint32 trigger) case 4539: // buff trigger? //buff_guid = BgObjects[BG_BE_OBJECT_BUFF_2]; break; - // OUTSIDE OF ARENA, TELEPORT! - case 4919: - player->NearTeleportTo(6220.90f, 318.94f, 5.1f, 5.3f); - break; - case 4921: - player->NearTeleportTo(6250.27f, 208.50f, 4.77f, 1.9f); - break; - case 4922: - player->NearTeleportTo(6214.4f, 227.12f, 4.28f, 0.8f); - break; - case 4923: - player->NearTeleportTo(6180.98f, 265.28f, 4.27f, 6.06f); - break; - case 4924: - player->NearTeleportTo(6269.0f, 295.06f, 4.46f, 3.98f); - break; - case 4944: // under arena -20 - case 5039: // under arena -40 - case 5040: // under arena -60 - player->NearTeleportTo(6238.930176f, 262.963470f, 0.889519f, player->GetOrientation()); - break; + // OUTSIDE OF ARENA, TELEPORT! + case 4919: + player->NearTeleportTo(6220.90f, 318.94f, 5.1f, 5.3f); + break; + case 4921: + player->NearTeleportTo(6250.27f, 208.50f, 4.77f, 1.9f); + break; + case 4922: + player->NearTeleportTo(6214.4f, 227.12f, 4.28f, 0.8f); + break; + case 4923: + player->NearTeleportTo(6180.98f, 265.28f, 4.27f, 6.06f); + break; + case 4924: + player->NearTeleportTo(6269.0f, 295.06f, 4.46f, 3.98f); + break; + case 4944: // under arena -20 + case 5039: // under arena -40 + case 5040: // under arena -60 + player->NearTeleportTo(6238.930176f, 262.963470f, 0.889519f, player->GetOrientation()); + break; } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h index 37d5c9262..67085120b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h @@ -29,8 +29,8 @@ enum BattlegroundBEObjectTypes BG_BE_OBJECT_DOOR_4 = 3, BG_BE_OBJECT_BUFF_1 = 4, BG_BE_OBJECT_BUFF_2 = 5, - BG_BE_OBJECT_READY_MARKER_1 = 6, - BG_BE_OBJECT_READY_MARKER_2 = 7, + BG_BE_OBJECT_READY_MARKER_1 = 6, + BG_BE_OBJECT_READY_MARKER_2 = 7, BG_BE_OBJECT_MAX = 8 }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 2a0f9affc..b411c70a9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -201,24 +201,24 @@ void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger) if (getPipeKnockBackCount() >= BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT) setPipeKnockBackCount(0); break; - // OUTSIDE OF ARENA, TELEPORT! - case 5328: - player->NearTeleportTo(1290.44f, 744.96f, 3.16f, 1.6f); - break; - case 5329: - player->NearTeleportTo(1292.6f, 837.07f, 3.161f, 4.7f); - break; - case 5330: - player->NearTeleportTo(1250.68f, 790.86f, 3.16f, 0.0f); - break; - case 5331: - player->NearTeleportTo(1332.50f, 790.9f, 3.16f, 3.14f); - break; - case 5326: // -10 - case 5343: // -40 - case 5344: // -60 - player->NearTeleportTo(1330.0f, 800.0f, 3.16f, player->GetOrientation()); - break; + // OUTSIDE OF ARENA, TELEPORT! + case 5328: + player->NearTeleportTo(1290.44f, 744.96f, 3.16f, 1.6f); + break; + case 5329: + player->NearTeleportTo(1292.6f, 837.07f, 3.161f, 4.7f); + break; + case 5330: + player->NearTeleportTo(1250.68f, 790.86f, 3.16f, 0.0f); + break; + case 5331: + player->NearTeleportTo(1332.50f, 790.9f, 3.16f, 3.14f); + break; + case 5326: // -10 + case 5343: // -40 + case 5344: // -60 + player->NearTeleportTo(1330.0f, 800.0f, 3.16f, player->GetOrientation()); + break; } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 1af950a34..26b8a2945 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -29,8 +29,8 @@ enum BattlegroundDSObjectTypes BG_DS_OBJECT_WATER_2 = 3, BG_DS_OBJECT_BUFF_1 = 4, BG_DS_OBJECT_BUFF_2 = 5, - BG_DS_OBJECT_READY_MARKER_1 = 6, - BG_DS_OBJECT_READY_MARKER_2 = 7, + BG_DS_OBJECT_READY_MARKER_1 = 6, + BG_DS_OBJECT_READY_MARKER_2 = 7, BG_DS_OBJECT_MAX = 8 }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 7b4156f62..8aaf50ce9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -16,17 +16,17 @@ REWRITTEN BY XINEF BattlegroundEY::BattlegroundEY() { - m_BuffChange = true; + m_BuffChange = true; BgObjects.resize(BG_EY_OBJECT_MAX); BgCreatures.resize(BG_EY_CREATURES_MAX); - _capturePointInfo[POINT_FEL_REAVER]._areaTrigger = AT_FEL_REAVER_BUFF; - _capturePointInfo[POINT_BLOOD_ELF]._areaTrigger = AT_BLOOD_ELF_BUFF; - _capturePointInfo[POINT_DRAENEI_RUINS]._areaTrigger = AT_DRAENEI_RUINS_BUFF; - _capturePointInfo[POINT_MAGE_TOWER]._areaTrigger = AT_MAGE_TOWER_BUFF; - _honorTics = 0; - _ownedPointsCount[TEAM_ALLIANCE] = 0; - _ownedPointsCount[TEAM_HORDE] = 0; + _capturePointInfo[POINT_FEL_REAVER]._areaTrigger = AT_FEL_REAVER_BUFF; + _capturePointInfo[POINT_BLOOD_ELF]._areaTrigger = AT_BLOOD_ELF_BUFF; + _capturePointInfo[POINT_DRAENEI_RUINS]._areaTrigger = AT_DRAENEI_RUINS_BUFF; + _capturePointInfo[POINT_MAGE_TOWER]._areaTrigger = AT_MAGE_TOWER_BUFF; + _honorTics = 0; + _ownedPointsCount[TEAM_ALLIANCE] = 0; + _ownedPointsCount[TEAM_HORDE] = 0; _flagKeeperGUID = 0; _droppedFlagGUID = 0; _flagState = BG_EY_FLAG_STATE_ON_BASE; @@ -46,28 +46,28 @@ void BattlegroundEY::PostUpdateImpl(uint32 diff) { if (GetStatus() == STATUS_IN_PROGRESS) { - _bgEvents.Update(diff); - while (uint32 eventId = _bgEvents.ExecuteEvent()) - switch (eventId) - { - case BG_EY_EVENT_ADD_POINTS: - if (_ownedPointsCount[TEAM_ALLIANCE] > 0) - AddPoints(TEAM_ALLIANCE, BG_EY_TickPoints[_ownedPointsCount[TEAM_ALLIANCE] - 1]); - if (_ownedPointsCount[TEAM_HORDE] > 0) - AddPoints(TEAM_HORDE, BG_EY_TickPoints[_ownedPointsCount[TEAM_HORDE] - 1]); - _bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_TICK_TIME)); - break; - case BG_EY_EVENT_FLAG_ON_GROUND: - RespawnFlagAfterDrop(); - break; - case BG_EY_EVENT_RESPAWN_FLAG: - RespawnFlag(); - break; - case BG_EY_EVENT_CHECK_CPOINTS: - UpdatePointsState(); - _bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_CHECK_TIME)); - break; - } + _bgEvents.Update(diff); + while (uint32 eventId = _bgEvents.ExecuteEvent()) + switch (eventId) + { + case BG_EY_EVENT_ADD_POINTS: + if (_ownedPointsCount[TEAM_ALLIANCE] > 0) + AddPoints(TEAM_ALLIANCE, BG_EY_TickPoints[_ownedPointsCount[TEAM_ALLIANCE] - 1]); + if (_ownedPointsCount[TEAM_HORDE] > 0) + AddPoints(TEAM_HORDE, BG_EY_TickPoints[_ownedPointsCount[TEAM_HORDE] - 1]); + _bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_TICK_TIME)); + break; + case BG_EY_EVENT_FLAG_ON_GROUND: + RespawnFlagAfterDrop(); + break; + case BG_EY_EVENT_RESPAWN_FLAG: + RespawnFlag(); + break; + case BG_EY_EVENT_CHECK_CPOINTS: + UpdatePointsState(); + _bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_CHECK_TIME)); + break; + } } } @@ -93,69 +93,69 @@ void BattlegroundEY::StartingEventOpenDoors() // Achievement: Flurry StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_EY_EVENT_START_BATTLE); - _bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, 0); - _bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, 0); + _bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, 0); + _bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, 0); } void BattlegroundEY::AddPoints(TeamId teamId, uint32 points) { - uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics); + uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics); m_TeamScores[teamId] += points; - for (; honorRewards < uint8(m_TeamScores[teamId] / _honorTics); ++honorRewards) + for (; honorRewards < uint8(m_TeamScores[teamId] / _honorTics); ++honorRewards) RewardHonorToTeam(GetBonusHonorFromKill(1), teamId); - UpdateWorldState(teamId == TEAM_ALLIANCE ? EY_ALLIANCE_RESOURCES : EY_HORDE_RESOURCES, std::min(m_TeamScores[teamId], BG_EY_MAX_TEAM_SCORE)); + UpdateWorldState(teamId == TEAM_ALLIANCE ? EY_ALLIANCE_RESOURCES : EY_HORDE_RESOURCES, std::min(m_TeamScores[teamId], BG_EY_MAX_TEAM_SCORE)); if (m_TeamScores[teamId] >= BG_EY_MAX_TEAM_SCORE) - EndBattleground(teamId); + EndBattleground(teamId); } void BattlegroundEY::UpdatePointsState() { - std::vector pointsVec; - for (uint8 point = 0; point < EY_POINTS_MAX; ++point) - { - pointsVec.push_back(GetBGObject(BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + point)); - _capturePointInfo[point]._playersCount[TEAM_ALLIANCE] = 0; - _capturePointInfo[point]._playersCount[TEAM_HORDE] = 0; - } + std::vector pointsVec; + for (uint8 point = 0; point < EY_POINTS_MAX; ++point) + { + pointsVec.push_back(GetBGObject(BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + point)); + _capturePointInfo[point]._playersCount[TEAM_ALLIANCE] = 0; + _capturePointInfo[point]._playersCount[TEAM_HORDE] = 0; + } - const BattlegroundPlayerMap& bgPlayerMap = GetPlayers(); - for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr) - { - UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, itr->second); - for (uint8 point = 0; point < EY_POINTS_MAX; ++point) - if (GameObject* pointObject = pointsVec[point]) - if (itr->second->CanCaptureTowerPoint() && itr->second->IsWithinDistInMap(pointObject, BG_EY_POINT_RADIUS)) - { - UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, itr->second); - UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, itr->second); - UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, _capturePointInfo[point]._barStatus, itr->second); - ++_capturePointInfo[point]._playersCount[itr->second->GetTeamId()]; + const BattlegroundPlayerMap& bgPlayerMap = GetPlayers(); + for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr) + { + UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, itr->second); + for (uint8 point = 0; point < EY_POINTS_MAX; ++point) + if (GameObject* pointObject = pointsVec[point]) + if (itr->second->CanCaptureTowerPoint() && itr->second->IsWithinDistInMap(pointObject, BG_EY_POINT_RADIUS)) + { + UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, itr->second); + UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, itr->second); + UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, _capturePointInfo[point]._barStatus, itr->second); + ++_capturePointInfo[point]._playersCount[itr->second->GetTeamId()]; - // Xinef: ugly hax... area trigger is no longer called by client... - if (pointObject->GetEntry() == BG_OBJECT_FR_TOWER_CAP_EY_ENTRY && itr->second->GetDistance2d(2043.96f, 1729.68f) < 3.0f) - HandleAreaTrigger(itr->second, AT_FEL_REAVER_POINT); - } + // Xinef: ugly hax... area trigger is no longer called by client... + if (pointObject->GetEntry() == BG_OBJECT_FR_TOWER_CAP_EY_ENTRY && itr->second->GetDistance2d(2043.96f, 1729.68f) < 3.0f) + HandleAreaTrigger(itr->second, AT_FEL_REAVER_POINT); + } } for (uint8 point = 0; point < EY_POINTS_MAX; ++point) { - _capturePointInfo[point]._barStatus += std::max(std::min(_capturePointInfo[point]._playersCount[TEAM_ALLIANCE] - _capturePointInfo[point]._playersCount[TEAM_HORDE], BG_EY_POINT_MAX_CAPTURERS_COUNT), -BG_EY_POINT_MAX_CAPTURERS_COUNT); - _capturePointInfo[point]._barStatus = std::max(std::min(_capturePointInfo[point]._barStatus, BG_EY_PROGRESS_BAR_ALI_CONTROLLED), BG_EY_PROGRESS_BAR_HORDE_CONTROLLED); + _capturePointInfo[point]._barStatus += std::max(std::min(_capturePointInfo[point]._playersCount[TEAM_ALLIANCE] - _capturePointInfo[point]._playersCount[TEAM_HORDE], BG_EY_POINT_MAX_CAPTURERS_COUNT), -BG_EY_POINT_MAX_CAPTURERS_COUNT); + _capturePointInfo[point]._barStatus = std::max(std::min(_capturePointInfo[point]._barStatus, BG_EY_PROGRESS_BAR_ALI_CONTROLLED), BG_EY_PROGRESS_BAR_HORDE_CONTROLLED); TeamId pointOwnerTeamId = TEAM_NEUTRAL; - if (_capturePointInfo[point]._barStatus <= BG_EY_PROGRESS_BAR_NEUTRAL_LOW) + if (_capturePointInfo[point]._barStatus <= BG_EY_PROGRESS_BAR_NEUTRAL_LOW) pointOwnerTeamId = TEAM_HORDE; - else if (_capturePointInfo[point]._barStatus >= BG_EY_PROGRESS_BAR_NEUTRAL_HIGH) + else if (_capturePointInfo[point]._barStatus >= BG_EY_PROGRESS_BAR_NEUTRAL_HIGH) pointOwnerTeamId = TEAM_ALLIANCE; - + if (pointOwnerTeamId != _capturePointInfo[point]._ownerTeamId) { if (_capturePointInfo[point].IsUncontrolled()) EventTeamCapturedPoint(pointOwnerTeamId, point); - if (pointOwnerTeamId == TEAM_NEUTRAL && _capturePointInfo[point].IsUnderControl()) + if (pointOwnerTeamId == TEAM_NEUTRAL && _capturePointInfo[point].IsUnderControl()) EventTeamLostPoint(pointOwnerTeamId, point); } } @@ -177,11 +177,11 @@ void BattlegroundEY::UpdatePointsCount() void BattlegroundEY::UpdatePointsIcons(uint32 point) { - if (_capturePointInfo[point].IsUnderControl()) + if (_capturePointInfo[point].IsUnderControl()) { UpdateWorldState(m_PointsIconStruct[point].WorldStateControlIndex, 0); - UpdateWorldState(m_PointsIconStruct[point].WorldStateAllianceControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_ALLIANCE)); - UpdateWorldState(m_PointsIconStruct[point].WorldStateHordeControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_HORDE)); + UpdateWorldState(m_PointsIconStruct[point].WorldStateAllianceControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_ALLIANCE)); + UpdateWorldState(m_PointsIconStruct[point].WorldStateHordeControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_HORDE)); } else { @@ -199,7 +199,7 @@ void BattlegroundEY::AddPlayer(Player* player) void BattlegroundEY::RemovePlayer(Player* player) { - if (GetFlagPickerGUID() == player->GetGUID()) + if (GetFlagPickerGUID() == player->GetGUID()) EventPlayerDroppedFlag(player); } @@ -211,22 +211,22 @@ void BattlegroundEY::HandleAreaTrigger(Player* player, uint32 trigger) switch (trigger) { case AT_BLOOD_ELF_POINT: - if (_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(player->GetTeamId())) + if (_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(player->GetTeamId())) if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID()) EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_BLOOD_ELF); break; case AT_FEL_REAVER_POINT: - if (_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(player->GetTeamId())) + if (_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(player->GetTeamId())) if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID()) EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_FEL_REAVER); break; case AT_MAGE_TOWER_POINT: - if (_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(player->GetTeamId())) + if (_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(player->GetTeamId())) if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID()) EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_MAGE_TOWER); break; case AT_DRAENEI_RUINS_POINT: - if (_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(player->GetTeamId())) + if (_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(player->GetTeamId())) if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID()) EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_DRAENEI_RUINS); break; @@ -237,10 +237,10 @@ void BattlegroundEY::HandleAreaTrigger(Player* player, uint32 trigger) case 4530: case 4531: case 5866: - case AT_BLOOD_ELF_BUFF: - case AT_FEL_REAVER_BUFF: - case AT_MAGE_TOWER_BUFF: - case AT_DRAENEI_RUINS_BUFF: + case AT_BLOOD_ELF_BUFF: + case AT_FEL_REAVER_BUFF: + case AT_MAGE_TOWER_BUFF: + case AT_DRAENEI_RUINS_BUFF: break; } } @@ -303,7 +303,7 @@ bool BattlegroundEY::SetupBattleground() for (uint8 i = 0; i < EY_POINTS_MAX; ++i) { - AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(_capturePointInfo[i]._areaTrigger); + AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(_capturePointInfo[i]._areaTrigger); AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 0, 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_REAVER + 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_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY); @@ -316,19 +316,19 @@ bool BattlegroundEY::SetupBattleground() sg = sWorldSafeLocsStore.LookupEntry(BG_EY_GRAVEYARD_MAIN_HORDE); AddSpiritGuide(BG_EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE); - for (uint32 i = BG_EY_OBJECT_DOOR_A; i < BG_EY_OBJECT_MAX; ++i) - if (BgObjects[i] == 0) - { - sLog->outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!"); - return false; - } + for (uint32 i = BG_EY_OBJECT_DOOR_A; i < BG_EY_OBJECT_MAX; ++i) + if (BgObjects[i] == 0) + { + sLog->outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!"); + return false; + } - for (uint32 i = BG_EY_SPIRIT_MAIN_ALLIANCE; i <= BG_EY_SPIRIT_MAIN_HORDE; ++i) - if (BgCreatures[i] == 0) - { - sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guides Battleground not created!"); - return false; - } + for (uint32 i = BG_EY_SPIRIT_MAIN_ALLIANCE; i <= BG_EY_SPIRIT_MAIN_HORDE; ++i) + if (BgCreatures[i] == 0) + { + sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guides Battleground not created!"); + return false; + } return true; } @@ -338,10 +338,10 @@ void BattlegroundEY::Init() //call parent's class reset Battleground::Init(); - _bgEvents.Reset(); - _honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_EY_HONOR_TICK_WEEKEND : BG_EY_HONOR_TICK_NORMAL; - _ownedPointsCount[TEAM_ALLIANCE] = 0; - _ownedPointsCount[TEAM_HORDE] = 0; + _bgEvents.Reset(); + _honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_EY_HONOR_TICK_WEEKEND : BG_EY_HONOR_TICK_NORMAL; + _ownedPointsCount[TEAM_ALLIANCE] = 0; + _ownedPointsCount[TEAM_HORDE] = 0; _flagKeeperGUID = 0; _droppedFlagGUID = 0; _flagState = BG_EY_FLAG_STATE_ON_BASE; @@ -350,8 +350,8 @@ void BattlegroundEY::Init() void BattlegroundEY::RespawnFlag() { - if (_flagState != BG_EY_FLAG_STATE_ON_BASE) - return; + if (_flagState != BG_EY_FLAG_STATE_ON_BASE) + return; if (_flagCapturedObject > 0) SpawnBGObject(_flagCapturedObject, RESPAWN_ONE_DAY); @@ -366,12 +366,12 @@ void BattlegroundEY::RespawnFlag() void BattlegroundEY::RespawnFlagAfterDrop() { - if (_flagState != BG_EY_FLAG_STATE_ON_GROUND) - return; + if (_flagState != BG_EY_FLAG_STATE_ON_GROUND) + return; _flagState = BG_EY_FLAG_STATE_ON_BASE; RespawnFlag(); - if (GameObject* flag = ObjectAccessor::GetObjectInMap(GetDroppedFlagGUID(), FindBgMap(), (GameObject*)NULL)) + if (GameObject* flag = ObjectAccessor::GetObjectInMap(GetDroppedFlagGUID(), FindBgMap(), (GameObject*)NULL)) flag->Delete(); SetDroppedFlagGUID(0); } @@ -387,8 +387,8 @@ void BattlegroundEY::HandleKillPlayer(Player* player, Player* killer) void BattlegroundEY::EventPlayerDroppedFlag(Player* player) { - if (GetFlagPickerGUID() != player->GetGUID()) - return; + if (GetFlagPickerGUID() != player->GetGUID()) + return; SetFlagPicker(0); player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); @@ -396,12 +396,12 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player) return; _flagState = BG_EY_FLAG_STATE_ON_GROUND; - _bgEvents.RescheduleEvent(BG_EY_EVENT_FLAG_ON_GROUND, BG_EY_FLAG_ON_GROUND_TIME); + _bgEvents.RescheduleEvent(BG_EY_EVENT_FLAG_ON_GROUND, BG_EY_FLAG_ON_GROUND_TIME); player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true); player->CastSpell(player, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true); - SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE); + SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE); } void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* gameObject) @@ -412,19 +412,19 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb _flagState = BG_EY_FLAG_STATE_ON_PLAYER; SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_ONE_DAY); SetFlagPicker(player->GetGUID()); - SetDroppedFlagGUID(0); + SetDroppedFlagGUID(0); player->CastSpell(player, BG_EY_NETHERSTORM_FLAG_SPELL, true); player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); - PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, player->GetName().c_str()); - PlaySoundToAll(player->GetTeamId() == TEAM_ALLIANCE ? BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE : BG_EY_SOUND_FLAG_PICKED_UP_HORDE); + PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, player->GetName().c_str()); + PlaySoundToAll(player->GetTeamId() == TEAM_ALLIANCE ? BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE : BG_EY_SOUND_FLAG_PICKED_UP_HORDE); UpdateWorldState(NETHERSTORM_FLAG, 0); } void BattlegroundEY::EventTeamLostPoint(TeamId teamId, uint32 point) { - TeamId oldTeamId = _capturePointInfo[point]._ownerTeamId; + TeamId oldTeamId = _capturePointInfo[point]._ownerTeamId; if (oldTeamId == TEAM_ALLIANCE) { _ownedPointsCount[TEAM_ALLIANCE]--; @@ -446,7 +446,7 @@ void BattlegroundEY::EventTeamLostPoint(TeamId teamId, uint32 point) SpawnBGObject(m_LosingPointTypes[point].SpawnNeutralObjectType + 1, RESPAWN_IMMEDIATELY); SpawnBGObject(m_LosingPointTypes[point].SpawnNeutralObjectType + 2, RESPAWN_IMMEDIATELY); - _capturePointInfo[point]._ownerTeamId = TEAM_NEUTRAL; + _capturePointInfo[point]._ownerTeamId = TEAM_NEUTRAL; UpdatePointsIcons(point); UpdatePointsCount(); @@ -476,7 +476,7 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point) SendMessageToAll(m_CapturingPointTypes[point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE); } - _capturePointInfo[point]._ownerTeamId = teamId; + _capturePointInfo[point]._ownerTeamId = teamId; if (BgCreatures[point]) DelCreature(point); @@ -486,8 +486,8 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point) UpdatePointsIcons(point); UpdatePointsCount(); - // Xinef: done this way to avoid errors in console - Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_EY_TRIGGER_FEL_REAVER + point]); + // Xinef: done this way to avoid errors in console + Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_EY_TRIGGER_FEL_REAVER + point]); if (!trigger) trigger = AddCreature(WORLD_TRIGGER, BG_EY_TRIGGER_FEL_REAVER + point, BG_EY_TriggerPositions[point][0], BG_EY_TriggerPositions[point][1], BG_EY_TriggerPositions[point][2], BG_EY_TriggerPositions[point][3]); @@ -506,19 +506,19 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); SpawnBGObject(BgObjectType, RESPAWN_IMMEDIATELY); - _bgEvents.RescheduleEvent(BG_EY_EVENT_RESPAWN_FLAG, BG_EY_FLAG_RESPAWN_TIME); + _bgEvents.RescheduleEvent(BG_EY_EVENT_RESPAWN_FLAG, BG_EY_FLAG_RESPAWN_TIME); _flagCapturedObject = BgObjectType; if (player->GetTeamId() == TEAM_ALLIANCE) - { - PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE); + { + PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE); SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); - } + } else - { - PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE); + { + PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE); SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, player); - } + } UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1); if (_ownedPointsCount[player->GetTeamId()] > 0) @@ -528,41 +528,41 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType void BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor) { if (type == SCORE_FLAG_CAPTURES) - { - BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID()); - if (itr != PlayerScores.end()) - ((BattlegroundEYScore*)itr->second)->FlagCaptures += value; + { + BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID()); + if (itr != PlayerScores.end()) + ((BattlegroundEYScore*)itr->second)->FlagCaptures += value; player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, BG_EY_OBJECTIVE_CAPTURE_FLAG); - return; - } + return; + } Battleground::UpdatePlayerScore(player, type, value, doAddHonor); } void BattlegroundEY::FillInitialWorldStates(WorldPacket& data) { - data << uint32(EY_HORDE_BASE) << uint32(_ownedPointsCount[TEAM_HORDE]); - data << uint32(EY_ALLIANCE_BASE) << uint32(_ownedPointsCount[TEAM_ALLIANCE]); - data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_HORDE)); - data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_ALLIANCE)); - data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUncontrolled()); - data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_HORDE)); - data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_ALLIANCE)); - data << uint32(MAGE_TOWER_UNCONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUncontrolled()); - data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_HORDE)); - data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_ALLIANCE)); - data << uint32(FEL_REAVER_UNCONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUncontrolled()); - data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_HORDE)); - data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_ALLIANCE)); - data << uint32(BLOOD_ELF_UNCONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUncontrolled()); + data << uint32(EY_HORDE_BASE) << uint32(_ownedPointsCount[TEAM_HORDE]); + data << uint32(EY_ALLIANCE_BASE) << uint32(_ownedPointsCount[TEAM_ALLIANCE]); + data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_HORDE)); + data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_ALLIANCE)); + data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUncontrolled()); + data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_HORDE)); + data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_ALLIANCE)); + data << uint32(MAGE_TOWER_UNCONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUncontrolled()); + data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_HORDE)); + data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_ALLIANCE)); + data << uint32(FEL_REAVER_UNCONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUncontrolled()); + data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_HORDE)); + data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_ALLIANCE)); + data << uint32(BLOOD_ELF_UNCONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUncontrolled()); data << uint32(NETHERSTORM_FLAG) << uint32(_flagState == BG_EY_FLAG_STATE_ON_BASE); - data << uint32(NETHERSTORM_FLAG_STATE_HORDE) << uint32(1); + data << uint32(NETHERSTORM_FLAG_STATE_HORDE) << uint32(1); data << uint32(NETHERSTORM_FLAG_STATE_ALLIANCE) << uint32(1); - data << uint32(EY_HORDE_RESOURCES) << uint32(GetTeamScore(TEAM_HORDE)); - data << uint32(EY_ALLIANCE_RESOURCES) << uint32(GetTeamScore(TEAM_ALLIANCE)); - data << uint32(PROGRESS_BAR_SHOW) << uint32(0); - data << uint32(PROGRESS_BAR_PERCENT_GREY) << uint32(0); - data << uint32(PROGRESS_BAR_STATUS) << uint32(0); + data << uint32(EY_HORDE_RESOURCES) << uint32(GetTeamScore(TEAM_HORDE)); + data << uint32(EY_ALLIANCE_RESOURCES) << uint32(GetTeamScore(TEAM_ALLIANCE)); + data << uint32(PROGRESS_BAR_SHOW) << uint32(0); + data << uint32(PROGRESS_BAR_PERCENT_GREY) << uint32(0); + data << uint32(PROGRESS_BAR_STATUS) << uint32(0); } WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player) @@ -574,10 +574,10 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player) float pY = player->GetPositionY(); float pZ = player->GetPositionZ(); float dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY) + (entry->z - pZ)*(entry->z - pZ); - float minDist = dist; + float minDist = dist; for (uint8 i = 0; i < EY_POINTS_MAX; ++i) - if (_capturePointInfo[i].IsUnderControl(player->GetTeamId())) + if (_capturePointInfo[i].IsUnderControl(player->GetTeamId())) { entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId); dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY) + (entry->z - pZ)*(entry->z - pZ); @@ -595,7 +595,7 @@ bool BattlegroundEY::AllNodesConrolledByTeam(TeamId teamId) const { uint32 count = 0; for (uint8 i = 0; i < EY_POINTS_MAX; ++i) - if (_capturePointInfo[i].IsUnderControl(teamId)) + if (_capturePointInfo[i].IsUnderControl(teamId)) ++count; return count == EY_POINTS_MAX; @@ -603,8 +603,8 @@ bool BattlegroundEY::AllNodesConrolledByTeam(TeamId teamId) const TeamId BattlegroundEY::GetPrematureWinner() { - if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE)) - return TEAM_ALLIANCE; + if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE)) + return TEAM_ALLIANCE; - return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner(); + return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner(); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 420f35b30..f502da9c7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -10,16 +10,16 @@ REWRITTEN BY XINEF enum BG_EY_Events { - BG_EY_EVENT_ADD_POINTS = 1, - BG_EY_EVENT_FLAG_ON_GROUND = 2, - BG_EY_EVENT_RESPAWN_FLAG = 3, - BG_EY_EVENT_CHECK_CPOINTS = 4 + BG_EY_EVENT_ADD_POINTS = 1, + BG_EY_EVENT_FLAG_ON_GROUND = 2, + BG_EY_EVENT_RESPAWN_FLAG = 3, + BG_EY_EVENT_CHECK_CPOINTS = 4 }; enum BG_EY_Timers { BG_EY_FLAG_RESPAWN_TIME = 20*IN_MILLISECONDS, - BG_EY_FLAG_ON_GROUND_TIME = 10*IN_MILLISECONDS, + BG_EY_FLAG_ON_GROUND_TIME = 10*IN_MILLISECONDS, BG_EY_FPOINTS_CHECK_TIME = 2*IN_MILLISECONDS, BG_EY_FPOINTS_TICK_TIME = 1*IN_MILLISECONDS }; @@ -98,14 +98,14 @@ enum BG_EY_ObjectEntry enum BG_EY_AreaTriggers { - AT_BLOOD_ELF_POINT = 4476, - AT_FEL_REAVER_POINT = 4514, - AT_MAGE_TOWER_POINT = 4516, - AT_DRAENEI_RUINS_POINT = 4518, - AT_BLOOD_ELF_BUFF = 4568, - AT_FEL_REAVER_BUFF = 4569, - AT_MAGE_TOWER_BUFF = 4570, - AT_DRAENEI_RUINS_BUFF = 4571 + AT_BLOOD_ELF_POINT = 4476, + AT_FEL_REAVER_POINT = 4514, + AT_MAGE_TOWER_POINT = 4516, + AT_DRAENEI_RUINS_POINT = 4518, + AT_BLOOD_ELF_BUFF = 4568, + AT_FEL_REAVER_BUFF = 4569, + AT_MAGE_TOWER_BUFF = 4570, + AT_DRAENEI_RUINS_BUFF = 4571 }; enum BG_EY_Graveyards @@ -120,11 +120,11 @@ enum BG_EY_Graveyards enum BG_EY_Points { - POINT_FEL_REAVER = 0, - POINT_BLOOD_ELF = 1, - POINT_DRAENEI_RUINS = 2, - POINT_MAGE_TOWER = 3, - EY_POINTS_MAX = 4 + POINT_FEL_REAVER = 0, + POINT_BLOOD_ELF = 1, + POINT_DRAENEI_RUINS = 2, + POINT_MAGE_TOWER = 3, + EY_POINTS_MAX = 4 }; enum BG_EY_CreatureTypes @@ -214,11 +214,11 @@ enum BG_EY_Score BG_EY_WARNING_NEAR_VICTORY_SCORE = 1400, BG_EY_MAX_TEAM_SCORE = 1600, - BG_EY_HONOR_TICK_WEEKEND = 160, - BG_EY_HONOR_TICK_NORMAL = 260, + BG_EY_HONOR_TICK_WEEKEND = 160, + BG_EY_HONOR_TICK_NORMAL = 260, - BG_EY_EVENT_START_BATTLE = 13180, // Achievement: Flurry - BG_EY_OBJECTIVE_CAPTURE_FLAG = 183 + BG_EY_EVENT_START_BATTLE = 13180, // Achievement: Flurry + BG_EY_OBJECTIVE_CAPTURE_FLAG = 183 }; enum BG_EY_FlagState @@ -366,26 +366,26 @@ class BattlegroundEY : public Battleground /* Scorekeeping */ void AddPoints(TeamId teamId, uint32 points); - struct CapturePointInfo - { - CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0) - { - _playersCount[TEAM_ALLIANCE] = 0; - _playersCount[TEAM_HORDE] = 0; - } + struct CapturePointInfo + { + CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0) + { + _playersCount[TEAM_ALLIANCE] = 0; + _playersCount[TEAM_HORDE] = 0; + } - TeamId _ownerTeamId; - uint32 _areaTrigger; - int8 _barStatus; - int8 _playersCount[BG_TEAMS_COUNT]; + TeamId _ownerTeamId; + uint32 _areaTrigger; + int8 _barStatus; + int8 _playersCount[BG_TEAMS_COUNT]; - bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; } - bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; } - bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; } - }; + bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; } + bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; } + bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; } + }; - CapturePointInfo _capturePointInfo[EY_POINTS_MAX]; - EventMap _bgEvents; + CapturePointInfo _capturePointInfo[EY_POINTS_MAX]; + EventMap _bgEvents; uint32 _honorTics; uint8 _ownedPointsCount[BG_TEAMS_COUNT]; uint64 _flagKeeperGUID; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index aeeb344f0..43e4a9180 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -56,7 +56,7 @@ BattlegroundIC::BattlegroundIC() gunshipHorde = NULL; gunshipAlliance = NULL; - respawnMap.clear(); + respawnMap.clear(); } BattlegroundIC::~BattlegroundIC() @@ -71,14 +71,14 @@ void BattlegroundIC::DoAction(uint32 action, uint64 guid) if (!gunshipAlliance || !gunshipHorde) return; - Player* player = ObjectAccessor::GetPlayer(*gunshipAlliance, guid); + Player* player = ObjectAccessor::GetPlayer(*gunshipAlliance, guid); if (!player) return; - MotionTransport* transport = player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde; - float x = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionX(); - float y = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionY(); - float z = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionZ(); + MotionTransport* transport = player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde; + float x = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionX(); + float y = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionY(); + float z = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionZ(); transport->CalculatePassengerPosition(x, y, z); player->TeleportTo(GetMapId(), x, y, z, player->GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); @@ -129,46 +129,46 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) { if (nodePoint[i].timer <= diff) { - // we need to confirm this, i am not sure if this every 3 minutes - for (uint8 j = 0; j < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++j) - { - uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+j; + // we need to confirm this, i am not sure if this every 3 minutes + for (uint8 j = 0; j < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++j) + { + uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+j; if (Creature* catapult = GetBGCreature(type)) if (!catapult->IsAlive()) - { - // Check if creature respawn time is properly saved - RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow()); - if (itr == respawnMap.end() || time(NULL) < itr->second) - continue; + { + // Check if creature respawn time is properly saved + RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow()); + if (itr == respawnMap.end() || time(NULL) < itr->second) + continue; - catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation()); - catapult->Respawn(true); - respawnMap.erase(itr); - } + catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation()); + catapult->Respawn(true); + respawnMap.erase(itr); + } } - // we need to confirm this is blizzlike, not sure if it is every 3 minutes - for (uint8 j = 0; j < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++j) - { - uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+j; + // we need to confirm this is blizzlike, not sure if it is every 3 minutes + for (uint8 j = 0; j < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++j) + { + uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+j; if (Creature* glaiveThrower = GetBGCreature(type)) if (!glaiveThrower->IsAlive()) - { - // Check if creature respawn time is properly saved - RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow()); - if (itr == respawnMap.end() || time(NULL) < itr->second) - continue; + { + // Check if creature respawn time is properly saved + RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow()); + if (itr == respawnMap.end() || time(NULL) < itr->second) + continue; - glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation()); + glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation()); glaiveThrower->Respawn(true); - respawnMap.erase(itr); - } + respawnMap.erase(itr); + } } docksTimer = DOCKS_UPDATE_TIME; } - else - nodePoint[i].timer -= diff; + else + nodePoint[i].timer -= diff; } } @@ -183,39 +183,39 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) if (Creature* siege = GetBGCreature(siegeType)) // this always should be true if (!siege->IsAlive()) { - // Check if creature respawn time is properly saved - RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow()); - if (itr == respawnMap.end() || time(NULL) < itr->second) - continue; + // Check if creature respawn time is properly saved + RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow()); + if (itr == respawnMap.end() || time(NULL) < itr->second) + continue; - siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation()); + siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation()); siege->Respawn(true); - respawnMap.erase(itr); - } + respawnMap.erase(itr); + } - // we need to confirm this, i am not sure if this every 3 minutes - for (uint8 u = 0; u < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++u) - { - - uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+u; - if (Creature* demolisher = GetBGCreature(type)) + // we need to confirm this, i am not sure if this every 3 minutes + for (uint8 u = 0; u < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++u) + { + + uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+u; + if (Creature* demolisher = GetBGCreature(type)) if (!demolisher->IsAlive()) - { - // Check if creature respawn time is properly saved - RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUIDLow()); - if (itr == respawnMap.end() || time(NULL) < itr->second) - continue; + { + // Check if creature respawn time is properly saved + RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUIDLow()); + if (itr == respawnMap.end() || time(NULL) < itr->second) + continue; - demolisher->Relocate(BG_IC_WorkshopVehicles[u].GetPositionX(), BG_IC_WorkshopVehicles[u].GetPositionY(), BG_IC_WorkshopVehicles[u].GetPositionZ(), BG_IC_WorkshopVehicles[u].GetOrientation()); - demolisher->Respawn(true); - respawnMap.erase(itr); - } + demolisher->Relocate(BG_IC_WorkshopVehicles[u].GetPositionX(), BG_IC_WorkshopVehicles[u].GetPositionY(), BG_IC_WorkshopVehicles[u].GetPositionZ(), BG_IC_WorkshopVehicles[u].GetOrientation()); + demolisher->Respawn(true); + respawnMap.erase(itr); + } } siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME; } - else - siegeEngineWorkshopTimer -= diff; + else + siegeEngineWorkshopTimer -= diff; } } @@ -339,27 +339,27 @@ void BattlegroundIC::HandleAreaTrigger(Player* player, uint32 trigger) if (GetStatus() != STATUS_IN_PROGRESS) return; - switch (trigger) - { - case AREA_TRIGGER_HORDE_KEEP: - if (player->GetTeamId() != TEAM_ALLIANCE) - return; - for (uint8 i = BG_IC_H_FRONT; i < BG_IC_A_FRONT; ++i) - if (GateStatus[i] == BG_IC_GATE_DESTROYED) - return; - if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB - player->CastSpell(player, SPELL_BACK_DOOR_JOB, true); - break; - case AREA_TRIGGER_ALLIANCE_KEEP: - if (player->GetTeamId() != TEAM_HORDE) - return; - for (uint8 i = BG_IC_A_FRONT; i < BG_IC_MAXDOOR; ++i) - if (GateStatus[i] == BG_IC_GATE_DESTROYED) - return; - if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB - player->CastSpell(player, SPELL_BACK_DOOR_JOB, true); - break; - } + switch (trigger) + { + case AREA_TRIGGER_HORDE_KEEP: + if (player->GetTeamId() != TEAM_ALLIANCE) + return; + for (uint8 i = BG_IC_H_FRONT; i < BG_IC_A_FRONT; ++i) + if (GateStatus[i] == BG_IC_GATE_DESTROYED) + return; + if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB + player->CastSpell(player, SPELL_BACK_DOOR_JOB, true); + break; + case AREA_TRIGGER_ALLIANCE_KEEP: + if (player->GetTeamId() != TEAM_HORDE) + return; + for (uint8 i = BG_IC_A_FRONT; i < BG_IC_MAXDOOR; ++i) + if (GateStatus[i] == BG_IC_GATE_DESTROYED) + return; + if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB + player->CastSpell(player, SPELL_BACK_DOOR_JOB, true); + break; + } } @@ -373,11 +373,11 @@ void BattlegroundIC::UpdatePlayerScore(Player* player, uint32 type, uint32 value { case SCORE_BASES_ASSAULTED: ((BattlegroundICScore*)itr->second)->BasesAssaulted += value; - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_ASSAULT_BASE); + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_ASSAULT_BASE); break; case SCORE_BASES_DEFENDED: ((BattlegroundICScore*)itr->second)->BasesDefended += value; - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_DEFEND_BASE); + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_DEFEND_BASE); break; default: Battleground::UpdatePlayerScore(player, type, value, doAddHonor); @@ -412,9 +412,9 @@ bool BattlegroundIC::SetupBattleground() return false; } - // Horde / Alliance gates, set active - if (i < 6) - GetBGObject(BG_IC_ObjSpawnlocs[i].type)->setActive(true); + // Horde / Alliance gates, set active + if (i < 6) + GetBGObject(BG_IC_ObjSpawnlocs[i].type)->setActive(true); } for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTERS_SPAWNS; ++i) @@ -470,40 +470,40 @@ bool BattlegroundIC::SetupBattleground() GetBGCreature(i)->setFaction(BG_IC_Factions[0]); for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i <= BG_IC_NPC_KEEP_CANNON_25; ++i) GetBGCreature(i)->setFaction(BG_IC_Factions[1]); - // Flags - if (GameObject* go = GetBGObject(BG_IC_GO_ALLIANCE_BANNER)) - { - go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[1]); - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } - if (GameObject* go = GetBGObject(BG_IC_GO_HORDE_BANNER)) - { - go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[0]); - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } + // Flags + if (GameObject* go = GetBGObject(BG_IC_GO_ALLIANCE_BANNER)) + { + go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[1]); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + if (GameObject* go = GetBGObject(BG_IC_GO_HORDE_BANNER)) + { + go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[0]); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } // correcting spawn time for keeps bombs for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; ++i) GetBGObject(i)->SetRespawnTime(10); - TurnBosses(false); + TurnBosses(false); return true; } void BattlegroundIC::TurnBosses(bool on) { - // Make Bosses invisible and passive - // or visible and active - if (Creature* boss = GetBGCreature(BG_IC_NPC_OVERLORD_AGMAR)) - { - boss->SetVisible(on); - boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE); - } - if (Creature* boss = GetBGCreature(BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE)) - { - boss->SetVisible(on); - boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE); - } + // Make Bosses invisible and passive + // or visible and active + if (Creature* boss = GetBGCreature(BG_IC_NPC_OVERLORD_AGMAR)) + { + boss->SetVisible(on); + boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE); + } + if (Creature* boss = GetBGCreature(BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE)) + { + boss->SetVisible(on); + boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE); + } } void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer) @@ -526,14 +526,14 @@ void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer) //Achievement Mowed Down // TO-DO: This should be done on the script of each vehicle of the BG. if (unit->IsVehicle()) - { + { killer->CastSpell(killer, SPELL_DESTROYED_VEHICLE_ACHIEVEMENT, true); - - // Xinef: Add to respawn list - if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A || - entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT) - respawnMap[unit->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME; - } + + // Xinef: Add to respawn list + if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A || + entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT) + respawnMap[unit->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME; + } } void BattlegroundIC::HandleKillPlayer(Player* player, Player* killer) @@ -572,21 +572,21 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb if (nodePoint[i].faction == player->GetTeamId()) return; - // Prevent capturing of keep if none of gates was destroyed - if (nodePoint[i].gameobject_entry == GO_ALLIANCE_BANNER) - { - if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED && - GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED && - GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED) - return; - } - else if (nodePoint[i].gameobject_entry == GO_HORDE_BANNER) - { - if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED && - GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED && - GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED) - return; - } + // Prevent capturing of keep if none of gates was destroyed + if (nodePoint[i].gameobject_entry == GO_ALLIANCE_BANNER) + { + if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED && + GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED && + GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED) + return; + } + else if (nodePoint[i].gameobject_entry == GO_HORDE_BANNER) + { + if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED && + GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED && + GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED) + return; + } uint32 nextBanner = GetNextBanner(&nodePoint[i], player->GetTeamId(), false); @@ -601,7 +601,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner) nodePoint[i].needChange = true; - RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + nodePoint[i].nodeType - 2]); + RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + nodePoint[i].nodeType - 2]); // if we are here means that the point has been lost, or it is the first capture @@ -615,7 +615,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_2, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE)); HandleContestedNodes(&nodePoint[i]); } - else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED]) + else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED]) // if we are going to spawn the definitve faction banner, we dont need the timer anymore { nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; @@ -718,7 +718,7 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint) else gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f); - for (std::list::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr) + for (std::list::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr) { (*itr)->GetVehicleKit()->RemoveAllPassengers(); (*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -755,26 +755,26 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) else gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f); - for (std::list::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr) + for (std::list::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr) (*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u) { uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1 + u; - if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY)) + if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY)) sLog->outError("Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u); } for (uint8 u = 0; u < MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS; ++u) { uint8 type = BG_IC_GO_HANGAR_TELEPORTER_EFFECT_1 + u; - if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u].GetPositionX(), BG_IC_HangarTeleporterEffects[u].GetPositionY(), BG_IC_HangarTeleporterEffects[u].GetPositionZ(), BG_IC_HangarTeleporterEffects[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE)) + if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u].GetPositionX(), BG_IC_HangarTeleporterEffects[u].GetPositionY(), BG_IC_HangarTeleporterEffects[u].GetPositionZ(), BG_IC_HangarTeleporterEffects[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE)) sLog->outError("Isle of Conquest: There was an error spawning a gunship portal effects. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u); } for (uint8 u = 0; u < MAX_TRIGGER_SPAWNS_PER_FACTION; ++u) { - if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction].GetPositionX(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionY(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionZ(), BG_IC_HangarTrigger[nodePoint->faction].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)) + if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction].GetPositionX(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionY(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionZ(), BG_IC_HangarTrigger[nodePoint->faction].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)) sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING); } @@ -783,11 +783,11 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) uint8 type = BG_IC_NPC_GUNSHIP_CAPTAIN_1 + u; if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_1) - if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetOrientation(), RESPAWN_ONE_DAY)) + if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetOrientation(), RESPAWN_ONE_DAY)) GetBGCreature(BG_IC_NPC_GUNSHIP_CAPTAIN_1)->GetAI()->DoAction(ACTION_GUNSHIP_READY); if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_2) - if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)) + if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)) sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_GUNSHIP_CAPTAIN_2); } @@ -869,17 +869,17 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) RESPAWN_ONE_DAY); } - if (Creature* siegeEngine = GetBGCreature(siegeType)) + if (Creature* siegeEngine = GetBGCreature(siegeType)) { siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]); - siegeEngine->SetCorpseDelay(5*MINUTE); + siegeEngine->SetCorpseDelay(5*MINUTE); - if (siegeEngine->IsAlive()) - if (Vehicle* siegeVehicle = siegeEngine->GetVehicleKit()) - if (!siegeVehicle->IsVehicleInUse()) - Unit::Kill(siegeEngine, siegeEngine); + if (siegeEngine->IsAlive()) + if (Vehicle* siegeVehicle = siegeEngine->GetVehicleKit()) + if (!siegeVehicle->IsVehicleInUse()) + Unit::Kill(siegeEngine, siegeEngine); - respawnMap[siegeEngine->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME; + respawnMap[siegeEngine->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME; } } @@ -914,33 +914,33 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go) UpdateWorldState(uws_open, 1); } - TeamId teamId = TEAM_ALLIANCE; + TeamId teamId = TEAM_ALLIANCE; uint32 lang_entry = 0; switch (go->GetEntry()) { case GO_HORDE_GATE_1: lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED; - break; - case GO_HORDE_GATE_2: + break; + case GO_HORDE_GATE_2: lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED; break; case GO_HORDE_GATE_3: lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED; break; case GO_ALLIANCE_GATE_1: - teamId = TEAM_HORDE; + teamId = TEAM_HORDE; lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED; break; case GO_ALLIANCE_GATE_2: - teamId = TEAM_HORDE; + teamId = TEAM_HORDE; lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED; break; case GO_ALLIANCE_GATE_3: - teamId = TEAM_HORDE; + teamId = TEAM_HORDE; lang_entry = LANG_BG_IC_SOUTH_GATE_DESTROYED; break; - default: - break; + default: + break; } if (teamId == TEAM_ALLIANCE) @@ -954,7 +954,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go) GetBGObject(BG_IC_GO_ALLIANCE_BANNER)->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } - TurnBosses(true); + TurnBosses(true); SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (teamId == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP)); } @@ -968,7 +968,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player) // Is there any occupied node for this team? std::vector nodes; for (uint8 i = 0; i < MAX_NODE_TYPES; ++i) - if (nodePoint[i].faction == player->GetTeamId() && !nodePoint[i].needChange) // xinef: controlled by faction and not contested! + if (nodePoint[i].faction == player->GetTeamId() && !nodePoint[i].needChange) // xinef: controlled by faction and not contested! nodes.push_back(i); WorldSafeLocsEntry const* good_entry = NULL; @@ -995,7 +995,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player) } // If not, place ghost on starting location if (!good_entry) - good_entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[player->GetTeamId()+MAX_NODE_TYPES]); + good_entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[player->GetTeamId()+MAX_NODE_TYPES]); return good_entry; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index edc4367c8..027d2d85b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -36,7 +36,7 @@ enum creaturesIC NPC_KOR_KRON_GUARD = 34918, // horde guard NPC_SEVEN_TH_LEGION_INFANTRY = 34919, // alliance guard NPC_KEEP_CANNON = 34944, - NPC_BROKEN_KEEP_CANNON = 35819, + NPC_BROKEN_KEEP_CANNON = 35819, NPC_DEMOLISHER = 34775, NPC_SIEGE_ENGINE_H = 35069, NPC_SIEGE_ENGINE_A = 34776, @@ -194,7 +194,7 @@ enum Times { WORKSHOP_UPDATE_TIME = 10000, // 10 seconds DOCKS_UPDATE_TIME = 10000, // 10 seconds - VEHICLE_RESPAWN_TIME = 180, // 3 minutes, not sure + VEHICLE_RESPAWN_TIME = 180, // 3 minutes, not sure IC_RESOURCE_TIME = 45000, // not sure, need more research CLOSE_DOORS_TIME = 20000, BANNER_STATE_CHANGE_TIME = 60000, @@ -203,11 +203,11 @@ enum Times enum Actions { - ACTION_GUNSHIP_READY = 1, - ACTION_TELEPORT_PLAYER_TO_TRANSPORT = 2, + ACTION_GUNSHIP_READY = 1, + ACTION_TELEPORT_PLAYER_TO_TRANSPORT = 2, - AREA_TRIGGER_HORDE_KEEP = 5535, - AREA_TRIGGER_ALLIANCE_KEEP = 5536 + AREA_TRIGGER_HORDE_KEEP = 5535, + AREA_TRIGGER_ALLIANCE_KEEP = 5536 }; struct ICNpc @@ -710,19 +710,19 @@ const Position workshopBombs[2] = enum Spells { - SPELL_OIL_REFINERY = 68719, - SPELL_QUARRY = 68720, + SPELL_OIL_REFINERY = 68719, + SPELL_QUARRY = 68720, - SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357, - SPELL_BACK_DOOR_JOB = 68502, + SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357, + SPELL_BACK_DOOR_JOB = 68502, - SPELL_DRIVING_CREDIT_DEMOLISHER = 68365, - SPELL_DRIVING_CREDIT_GLAIVE = 68363, - SPELL_DRIVING_CREDIT_SIEGE = 68364, - SPELL_DRIVING_CREDIT_CATAPULT = 68362, + SPELL_DRIVING_CREDIT_DEMOLISHER = 68365, + SPELL_DRIVING_CREDIT_GLAIVE = 68363, + SPELL_DRIVING_CREDIT_SIEGE = 68364, + SPELL_DRIVING_CREDIT_CATAPULT = 68362, - SPELL_REPAIR_TURRET_CHANNEL = 68077, - SPELL_REPAIR_TURRET_DUMMY = 68078, + SPELL_REPAIR_TURRET_CHANNEL = 68077, + SPELL_REPAIR_TURRET_DUMMY = 68078, SPELL_SIMPLE_TELEPORT = 12980, SPELL_TELEPORT_VISUAL_ONLY = 51347, @@ -932,8 +932,8 @@ class BattlegroundIC : public Battleground uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; } bool AllNodesConrolledByTeam(TeamId teamId) const; // overwrited - bool IsResourceGlutAllowed(TeamId teamId) const; - void DoAction(uint32 action, uint64 guid); + bool IsResourceGlutAllowed(TeamId teamId) const; + void DoAction(uint32 action, uint64 guid); private: uint32 closeFortressDoorsTimer; bool doorsClosed; @@ -944,8 +944,8 @@ class BattlegroundIC : public Battleground BG_IC_GateState GateStatus[6]; ICNodePoint nodePoint[7]; - typedef std::map RespawnMap; - RespawnMap respawnMap; + typedef std::map RespawnMap; + RespawnMap respawnMap; MotionTransport* gunshipAlliance; MotionTransport* gunshipHorde; @@ -998,7 +998,7 @@ class BattlegroundIC : public Battleground void UpdateNodeWorldState(ICNodePoint* nodePoint); void HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture); void HandleContestedNodes(ICNodePoint* nodePoint); - void TurnBosses(bool on); + void TurnBosses(bool on); }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index dfc3230bd..1ef7664ec 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -108,12 +108,12 @@ void BattlegroundNA::HandleAreaTrigger(Player* player, uint32 trigger) case 4536: // buff trigger? case 4537: // buff trigger? break; - // OUTSIDE OF ARENA, TELEPORT! - case 4917: - case 5006: - case 5008: - player->NearTeleportTo(4054.15f, 2923.7f, 13.4f, player->GetOrientation()); - break; + // OUTSIDE OF ARENA, TELEPORT! + case 4917: + case 5006: + case 5008: + player->NearTeleportTo(4054.15f, 2923.7f, 13.4f, player->GetOrientation()); + break; } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h index eb2ec5986..42cf57e11 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h @@ -28,8 +28,8 @@ enum BattlegroundNAObjectTypes BG_NA_OBJECT_DOOR_4 = 3, BG_NA_OBJECT_BUFF_1 = 4, BG_NA_OBJECT_BUFF_2 = 5, - BG_NA_OBJECT_READY_MARKER_1 = 6, - BG_NA_OBJECT_READY_MARKER_2 = 7, + BG_NA_OBJECT_READY_MARKER_1 = 6, + BG_NA_OBJECT_READY_MARKER_2 = 7, BG_NA_OBJECT_MAX = 8 }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index ff094a9c4..5ec94efc4 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -63,7 +63,7 @@ void BattlegroundRL::AddPlayer(Player* player) { Battleground::AddPlayer(player); PlayerScores[player->GetGUID()] = new BattlegroundScore(player); - Battleground::UpdateArenaWorldState(); + Battleground::UpdateArenaWorldState(); } void BattlegroundRL::RemovePlayer(Player* /*player*/) @@ -108,38 +108,38 @@ void BattlegroundRL::HandleAreaTrigger(Player* player, uint32 trigger) case 4696: // buff trigger? case 4697: // buff trigger? break; - // OUTSIDE OF ARENA, TELEPORT! - case 4927: - case 4928: - player->NearTeleportTo(1230.77f, 1662.42f, 34.56f, 0.0f); - break; - case 4929: - case 4930: - player->NearTeleportTo(1341.16f, 1673.52f, 34.43f, 3.5f); - break; - case 4931: - player->NearTeleportTo(1294.74f, 1584.5f, 31.62f, 1.66f); - break; - case 4932: - player->NearTeleportTo(1277.5f, 1751.07f, 31.61f, 4.7f); - break; - case 4933: - player->NearTeleportTo(1269.14f, 1713.85f, 34.46f, 5.23f); - break; - case 4934: - player->NearTeleportTo(1298.14f, 1713.8f, 33.58f, 4.55f); - break; - case 4935: - player->NearTeleportTo(1306.32f, 1620.75f, 34.25f, 1.97f); - break; - case 4936: - player->NearTeleportTo(1277.97f, 1615.51f, 34.56f, 1.15f); - break; - case 4941: // under arena +10 - case 5041: // under arena -10 - case 5042: // under arena -30 - player->NearTeleportTo(1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation()); - break; + // OUTSIDE OF ARENA, TELEPORT! + case 4927: + case 4928: + player->NearTeleportTo(1230.77f, 1662.42f, 34.56f, 0.0f); + break; + case 4929: + case 4930: + player->NearTeleportTo(1341.16f, 1673.52f, 34.43f, 3.5f); + break; + case 4931: + player->NearTeleportTo(1294.74f, 1584.5f, 31.62f, 1.66f); + break; + case 4932: + player->NearTeleportTo(1277.5f, 1751.07f, 31.61f, 4.7f); + break; + case 4933: + player->NearTeleportTo(1269.14f, 1713.85f, 34.46f, 5.23f); + break; + case 4934: + player->NearTeleportTo(1298.14f, 1713.8f, 33.58f, 4.55f); + break; + case 4935: + player->NearTeleportTo(1306.32f, 1620.75f, 34.25f, 1.97f); + break; + case 4936: + player->NearTeleportTo(1277.97f, 1615.51f, 34.56f, 1.15f); + break; + case 4941: // under arena +10 + case 5041: // under arena -10 + case 5042: // under arena -30 + player->NearTeleportTo(1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation()); + break; } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h index 0a738ba0e..42ea70d96 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h @@ -26,8 +26,8 @@ enum BattlegroundRLObjectTypes BG_RL_OBJECT_DOOR_2 = 1, BG_RL_OBJECT_BUFF_1 = 2, BG_RL_OBJECT_BUFF_2 = 3, - BG_RL_OBJECT_READY_MARKER_1 = 4, - BG_RL_OBJECT_READY_MARKER_2 = 5, + BG_RL_OBJECT_READY_MARKER_1 = 4, + BG_RL_OBJECT_READY_MARKER_2 = 5, BG_RL_OBJECT_MAX = 6 }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index cd6ba2c7d..9c149e496 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -46,26 +46,26 @@ BattlegroundRV::~BattlegroundRV() { } void BattlegroundRV::TeleportUnitToNewZ(Unit* unit, float newZ, bool casting) { - if (!unit->IsAlive()) - return; + if (!unit->IsAlive()) + return; unit->NearTeleportTo(unit->GetPositionX(), unit->GetPositionY(), newZ, unit->GetOrientation(), casting); unit->m_positionZ = newZ; } void BattlegroundRV::CheckPositionForUnit(Unit* unit) { - // get height at current pos, if something is wrong (below or high above) - teleport - if (!unit->IsFalling() && unit->IsAlive()) - { - float groundZ_vmap = unit->GetMap()->GetHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, true, 50.0f); - float groundZ_dyntree = unit->GetMap()->GetDynamicMapTree().getHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, 50.0f, unit->GetPhaseMask()); - if (groundZ_vmap > 28.0f && groundZ_vmap < 29.0f || groundZ_dyntree > 28.0f && groundZ_dyntree < 37.0f) - { - float groundZ = std::max(groundZ_vmap, groundZ_dyntree); - if (unit->GetPositionZ() < groundZ - 0.2f || unit->GetPositionZ() > groundZ + 3.5f) - TeleportUnitToNewZ(unit, groundZ+1.0f, true); - } - } + // get height at current pos, if something is wrong (below or high above) - teleport + if (!unit->IsFalling() && unit->IsAlive()) + { + float groundZ_vmap = unit->GetMap()->GetHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, true, 50.0f); + float groundZ_dyntree = unit->GetMap()->GetDynamicMapTree().getHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, 50.0f, unit->GetPhaseMask()); + if (groundZ_vmap > 28.0f && groundZ_vmap < 29.0f || groundZ_dyntree > 28.0f && groundZ_dyntree < 37.0f) + { + float groundZ = std::max(groundZ_vmap, groundZ_dyntree); + if (unit->GetPositionZ() < groundZ - 0.2f || unit->GetPositionZ() > groundZ + 3.5f) + TeleportUnitToNewZ(unit, groundZ+1.0f, true); + } + } } void BattlegroundRV::PostUpdateImpl(uint32 diff) @@ -87,11 +87,11 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) if (Player* player = itr->second) { // Demonic Circle Summon - if (GameObject* gObj = player->GetGameObject(48018)) - { - gObj->Relocate(gObj->GetPositionX(), gObj->GetPositionY(), 28.28f); - gObj->UpdateObjectVisibility(true); - } + if (GameObject* gObj = player->GetGameObject(48018)) + { + gObj->Relocate(gObj->GetPositionX(), gObj->GetPositionY(), 28.28f); + gObj->UpdateObjectVisibility(true); + } if (player->GetPositionZ() < 27.0f) TeleportUnitToNewZ(player, 28.28f, true); @@ -103,18 +103,18 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) TeleportUnitToNewZ(totem, 28.28f, true); for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr) - { + { if ((*itr)->GetPositionZ() < 28.0f) TeleportUnitToNewZ((*itr), 28.28f, true); - // Xinef: override stay position - if (CharmInfo* charmInfo = (*itr)->GetCharmInfo()) - if (charmInfo->IsAtStay()) - { - (*itr)->StopMovingOnCurrentPos(); - charmInfo->SaveStayPosition(false); - } - } + // Xinef: override stay position + if (CharmInfo* charmInfo = (*itr)->GetCharmInfo()) + if (charmInfo->IsAtStay()) + { + (*itr)->StopMovingOnCurrentPos(); + charmInfo->SaveStayPosition(false); + } + } } // fix ground on elevators (so aoe spells can be casted there) @@ -141,8 +141,8 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) else setTimer(getTimer() - diff); - if (getState() == BG_RV_STATE_OPEN_FENCES) - return; + if (getState() == BG_RV_STATE_OPEN_FENCES) + return; if (CheckPlayersTimer <= diff) { @@ -150,7 +150,7 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) CheckPositionForUnit(itr->second); - // maybe for pets and m_Controlled also, but not really necessary + // maybe for pets and m_Controlled also, but not really necessary } else CheckPlayersTimer -= diff; @@ -179,12 +179,12 @@ void BattlegroundRV::StartingEventOpenDoors() void BattlegroundRV::AddPlayer(Player* player) { - if (GetStatus() == STATUS_WAIT_JOIN && player->GetBgTeamId() == TEAM_HORDE) + if (GetStatus() == STATUS_WAIT_JOIN && player->GetBgTeamId() == TEAM_HORDE) player->SetPhaseMask(2, true); Battleground::AddPlayer(player); PlayerScores[player->GetGUID()] = new BattlegroundScore(player); - BattlegroundRV::UpdateArenaWorldState(); + BattlegroundRV::UpdateArenaWorldState(); } void BattlegroundRV::RemovePlayer(Player* player) @@ -195,7 +195,7 @@ void BattlegroundRV::RemovePlayer(Player* player) if (GetStatus() == STATUS_WAIT_JOIN) player->SetPhaseMask(1, true); - BattlegroundRV::UpdateArenaWorldState(); + BattlegroundRV::UpdateArenaWorldState(); CheckArenaWinConditions(); } @@ -208,7 +208,7 @@ void BattlegroundRV::HandleKillPlayer(Player* player, Player* killer) return; Battleground::HandleKillPlayer(player, killer); - BattlegroundRV::UpdateArenaWorldState(); + BattlegroundRV::UpdateArenaWorldState(); CheckArenaWinConditions(); } @@ -246,7 +246,7 @@ void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger) void BattlegroundRV::FillInitialWorldStates(WorldPacket &data) { data << uint32(BG_RV_WORLD_STATE) << uint32(1); - BattlegroundRV::UpdateArenaWorldState(); + BattlegroundRV::UpdateArenaWorldState(); } void BattlegroundRV::UpdateArenaWorldState() @@ -304,27 +304,27 @@ bool BattlegroundRV::SetupBattleground() void BattlegroundRV::UpdatePillars() { - GameObject* test = GetBgMap()->GetGameObject(BgObjects[BG_RV_OBJECT_PILAR_1]); - if (!test) - return; + GameObject* test = GetBgMap()->GetGameObject(BgObjects[BG_RV_OBJECT_PILAR_1]); + if (!test) + return; - if (test->GetGoState() == GO_STATE_READY) + if (test->GetGoState() == GO_STATE_READY) { for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_GEAR_2; ++i) - if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i])) - go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i])) + go->SetGoState(GO_STATE_ACTIVE); for (uint8 i = BG_RV_OBJECT_PILAR_2; i <= BG_RV_OBJECT_PULLEY_2; ++i) - if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i])) - go->SetGoState(GO_STATE_READY); + if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i])) + go->SetGoState(GO_STATE_READY); } else { for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_GEAR_2; ++i) - if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i])) - go->SetGoState(GO_STATE_READY); + if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i])) + go->SetGoState(GO_STATE_READY); for (uint8 i = BG_RV_OBJECT_PILAR_2; i <= BG_RV_OBJECT_PULLEY_2; ++i) - if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i])) - go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i])) + go->SetGoState(GO_STATE_ACTIVE); } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index 703054b4b..16356f640 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -42,8 +42,8 @@ enum BattlegroundRVObjectTypes BG_RV_OBJECT_ELEVATOR_1, BG_RV_OBJECT_ELEVATOR_2, - BG_RV_OBJECT_READY_MARKER_1, - BG_RV_OBJECT_READY_MARKER_2, + BG_RV_OBJECT_READY_MARKER_1, + BG_RV_OBJECT_READY_MARKER_2, BG_RV_OBJECT_MAX, }; @@ -99,7 +99,7 @@ class BattlegroundRV : public Battleground void StartingEventOpenDoors(); void Init(); void FillInitialWorldStates(WorldPacket &d); - void UpdateArenaWorldState(); + void UpdateArenaWorldState(); void HandleAreaTrigger(Player* player, uint32 trigger); bool SetupBattleground(); void HandleKillPlayer(Player* player, Player* killer); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 873535712..c54aad128 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -64,7 +64,7 @@ BattlegroundSA::~BattlegroundSA() void BattlegroundSA::Init() { - Battleground::Init(); + Battleground::Init(); TotalTime = 0; Attackers = ((urand(0, 1)) ? TEAM_ALLIANCE : TEAM_HORDE); @@ -74,7 +74,7 @@ void BattlegroundSA::Init() _notEvenAScratch[TEAM_ALLIANCE] = true; _notEvenAScratch[TEAM_HORDE] = true; Status = BG_SA_WARMUP; - _relicClicked = false; + _relicClicked = false; } bool BattlegroundSA::SetupBattleground() @@ -159,11 +159,11 @@ bool BattlegroundSA::ResetObjs() { SpawnBGObject(i, RESPAWN_IMMEDIATELY); if (GameObject* go = GetBGObject(i)) - { - go->setActive(true); - go->SetUInt32Value(GAMEOBJECT_FACTION, defF); - go->SetDestructibleBuildingModifyState(false); - } + { + go->setActive(true); + go->SetUInt32Value(GAMEOBJECT_FACTION, defF); + go->SetDestructibleBuildingModifyState(false); + } } GetBGObject(BG_SA_TITAN_RELIC)->SetUInt32Value(GAMEOBJECT_FACTION, atF); @@ -316,7 +316,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) SendMessageToAll(LANG_BG_SA_ROUND_TWO_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); } } - else + else { UpdateWaitTimer -= diff; return; @@ -354,7 +354,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) DemolisherStartState(false); Status = BG_SA_ROUND_TWO; StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE)?23748:21702); - + // status was set to STATUS_WAIT_JOIN manually for Preparation, set it back now SetStatus(STATUS_IN_PROGRESS); for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) @@ -377,27 +377,27 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) { if (TotalTime >= BG_SA_ROUNDLENGTH || _relicClicked) { - if (_relicClicked) - { - RoundScores[0].winner = Attackers; - RoundScores[0].time = TotalTime; - //Achievement Storm the Beach (1310) - for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) - if (itr->second->GetTeamId() == Attackers) - itr->second->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246); - } - else - { - // cast this before Attackers variable is switched - // cast this spell only upon timer end, no other ability for defenders to win :) - for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) - itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true); + if (_relicClicked) + { + RoundScores[0].winner = Attackers; + RoundScores[0].time = TotalTime; + //Achievement Storm the Beach (1310) + for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + if (itr->second->GetTeamId() == Attackers) + itr->second->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246); + } + else + { + // cast this before Attackers variable is switched + // cast this spell only upon timer end, no other ability for defenders to win :) + for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true); - RoundScores[0].winner = Attackers; - RoundScores[0].time = BG_SA_ROUNDLENGTH; - } + RoundScores[0].winner = Attackers; + RoundScores[0].time = BG_SA_ROUNDLENGTH; + } - _relicClicked = false; + _relicClicked = false; Attackers = (Attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE; Status = BG_SA_SECOND_WARMUP; TotalTime = 0; @@ -416,9 +416,9 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) { if (TotalTime >= EndRoundTimer) { - // cast this spell only upon timer end, no other ability for defenders to win :) - for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) - itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true); + // cast this spell only upon timer end, no other ability for defenders to win :) + for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true); RoundScores[1].time = BG_SA_ROUNDLENGTH; RoundScores[1].winner = GetOtherTeamId(Attackers); @@ -496,7 +496,7 @@ void BattlegroundSA::AddPlayer(Player* player) SendTransportInit(player); PlayerScores[player->GetGUID()] = sc; - TeleportToEntrancePosition(player); + TeleportToEntrancePosition(player); } void BattlegroundSA::RemovePlayer(Player* /*player*/) @@ -540,49 +540,49 @@ void BattlegroundSA::TeleportPlayers() player->SpawnCorpseBones(); } - if (Status == BG_SA_SECOND_WARMUP) - { - player->CastSpell(player, SPELL_PREPARATION, true); - player->GetMotionMaster()->MovementExpired(); - } + if (Status == BG_SA_SECOND_WARMUP) + { + player->CastSpell(player, SPELL_PREPARATION, true); + player->GetMotionMaster()->MovementExpired(); + } player->ResetAllPowers(); player->CombatStopWithPets(true); - TeleportToEntrancePosition(player); + TeleportToEntrancePosition(player); - // xinef: one more time, just to be sure - if (Status == BG_SA_SECOND_WARMUP) - player->GetMotionMaster()->Clear(false); + // xinef: one more time, just to be sure + if (Status == BG_SA_SECOND_WARMUP) + player->GetMotionMaster()->Clear(false); } } } void BattlegroundSA::TeleportToEntrancePosition(Player* player) { - if (player->GetTeamId() != Attackers) - { - player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0); - } - else - { - if (!ShipsStarted) - { - player->CastSpell(player, 12438, true);//Without this player falls before boat loads... - if (urand(0, 1)) - player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0); - else - player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0); - } - else - player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0); - } + if (player->GetTeamId() != Attackers) + { + player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0); + } + else + { + if (!ShipsStarted) + { + player->CastSpell(player, 12438, true);//Without this player falls before boat loads... + if (urand(0, 1)) + player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0); + else + player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0); + } + else + player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0); + } } void BattlegroundSA::DefendersPortalTeleport(GameObject* portal, Player* plr) { if (plr->GetTeamId() == Attackers) - return; + return; uint32 portal_num = 0; //get it via X @@ -629,29 +629,29 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui else SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name.c_str()); - uint32 i = GetGateIDFromEntry(go->GetEntry()); - switch (i) - { - case BG_SA_BLUE_GATE: - case BG_SA_GREEN_GATE: - { - GameObject* go = NULL; - if (go = GetBGObject(BG_SA_RED_GATE)) - go->SetDestructibleBuildingModifyState(true); - if (go = GetBGObject(BG_SA_PURPLE_GATE)) - go->SetDestructibleBuildingModifyState(true); - break; - } - case BG_SA_RED_GATE: - case BG_SA_PURPLE_GATE: - if (GameObject* go = GetBGObject(BG_SA_YELLOW_GATE)) - go->SetDestructibleBuildingModifyState(true); - break; - case BG_SA_YELLOW_GATE: - if (GameObject* go = GetBGObject(BG_SA_ANCIENT_GATE)) - go->SetDestructibleBuildingModifyState(true); - break; - } + uint32 i = GetGateIDFromEntry(go->GetEntry()); + switch (i) + { + case BG_SA_BLUE_GATE: + case BG_SA_GREEN_GATE: + { + GameObject* go = NULL; + if (go = GetBGObject(BG_SA_RED_GATE)) + go->SetDestructibleBuildingModifyState(true); + if (go = GetBGObject(BG_SA_PURPLE_GATE)) + go->SetDestructibleBuildingModifyState(true); + break; + } + case BG_SA_RED_GATE: + case BG_SA_PURPLE_GATE: + if (GameObject* go = GetBGObject(BG_SA_YELLOW_GATE)) + go->SetDestructibleBuildingModifyState(true); + break; + case BG_SA_YELLOW_GATE: + if (GameObject* go = GetBGObject(BG_SA_ANCIENT_GATE)) + go->SetDestructibleBuildingModifyState(true); + break; + } } if (eventType == go->GetGOInfo()->building.damageEvent) @@ -704,7 +704,7 @@ void BattlegroundSA::DemolisherStartState(bool start) dem->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); } - for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++) + for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++) if (Creature* gun = GetBGCreature(i)) { if (start) @@ -713,13 +713,13 @@ void BattlegroundSA::DemolisherStartState(bool start) gun->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); } - // xinef: enable first gates damaging at start - if (!start) - { + // xinef: enable first gates damaging at start + if (!start) + { if (GameObject* go = GetBGObject(BG_SA_GREEN_GATE)) - go->SetDestructibleBuildingModifyState(true); - if (GameObject* go = GetBGObject(BG_SA_BLUE_GATE)) - go->SetDestructibleBuildingModifyState(true); + go->SetDestructibleBuildingModifyState(true); + if (GameObject* go = GetBGObject(BG_SA_BLUE_GATE)) + go->SetDestructibleBuildingModifyState(true); } } @@ -758,17 +758,17 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go) break; } - UpdateObjectInteractionFlags(); + UpdateObjectInteractionFlags(); if (i < 5) DelObject(i+9); - if (player) - { - UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1); - if (rewardHonor) - UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1)); - } + if (player) + { + UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1); + if (rewardHonor) + UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1)); + } } } } @@ -788,24 +788,24 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveyard(Player* player) continue; WorldSafeLocsEntry const* ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); - - // if on beach - if (i == BG_SA_BEACH_GY) - { - if (x > 1400) - return ret; - continue; - } + + // if on beach + if (i == BG_SA_BEACH_GY) + { + if (x > 1400) + return ret; + continue; + } - float dist = sqrt(pow(ret->x - x, 2) * pow(ret->y - y, 2)); + float dist = sqrt(pow(ret->x - x, 2) * pow(ret->y - y, 2)); if (dist < mindist) - { + { mindist = dist; - closest = ret; - } + closest = ret; + } } - if (!closest && GraveyardStatus[BG_SA_BEACH_GY] == player->GetTeamId()) - return sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[BG_SA_BEACH_GY]); + if (!closest && GraveyardStatus[BG_SA_BEACH_GY] == player->GetTeamId()) + return sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[BG_SA_BEACH_GY]); return closest; @@ -891,7 +891,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source) if (GraveyardStatus[i] == Attackers || Source->GetTeamId() != Attackers) return; - GraveyardStatus[i] = Source->GetTeamId(); + GraveyardStatus[i] = Source->GetTeamId(); // Those who are waiting to resurrect at this node are taken to the closest own node's graveyard std::vector ghost_list = m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]]; if (!ghost_list.empty()) @@ -909,8 +909,8 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source) if (ClosestGrave) player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); } - // xinef: clear resurrect queue for this creature - m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]].clear(); + // xinef: clear resurrect queue for this creature + m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]].clear(); } DelCreature(BG_SA_MAXNPC + i); @@ -1017,7 +1017,7 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object) if (Status == BG_SA_ROUND_ONE) { - _relicClicked = true; + _relicClicked = true; } else if (Status == BG_SA_ROUND_TWO) { @@ -1123,14 +1123,14 @@ void BattlegroundSA::SendTransportsRemove(Player* player) bool BattlegroundSA::AllowDefenseOfTheAncients(Player* source) { - if (source->GetTeamId() == Attackers) - return false; + if (source->GetTeamId() == Attackers) + return false; - for (uint8 i = 0; i <= 5; i++) - { + for (uint8 i = 0; i <= 5; i++) + { if (GateStatus[i] == BG_SA_GATE_DESTROYED) - return false; - } + return false; + } - return true; + return true; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index b47784f8a..367e8dead 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -487,18 +487,18 @@ class BattlegroundSA : public Battleground /// Update score board void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true); - // Teleporters - void DefendersPortalTeleport(GameObject* portal, Player* plr); + // Teleporters + void DefendersPortalTeleport(GameObject* portal, Player* plr); - // Achievements - bool AllowDefenseOfTheAncients(Player* source); + // Achievements + bool AllowDefenseOfTheAncients(Player* source); // Achievement: Not Even a Scratch bool notEvenAScratch(TeamId teamId) const { return _notEvenAScratch[teamId]; } private: - /// Return gate id, relative to bg data, according to gameobject id + /// Return gate id, relative to bg data, according to gameobject id uint32 GetGateIDFromEntry(uint32 id) { uint32 i = 0; @@ -597,8 +597,8 @@ class BattlegroundSA : public Battleground bool InitSecondRound; std::map DemoliserRespawnList; - // xinef: - bool _relicClicked; + // xinef: + bool _relicClicked; // Achievement: Not Even a Scratch bool _notEvenAScratch[BG_TEAMS_COUNT]; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 712d2ccd5..96c344a1c 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -43,49 +43,49 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff) { if (GetStatus() == STATUS_IN_PROGRESS) { - _bgEvents.Update(diff); - switch (_bgEvents.ExecuteEvent()) - { - case BG_WS_EVENT_UPDATE_GAME_TIME: - UpdateWorldState(BG_WS_STATE_TIMER, GetMatchTime()); - _bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, ((BG_WS_TOTAL_GAME_TIME - GetStartTime()) % (MINUTE*IN_MILLISECONDS)) + 1); - break; - case BG_WS_EVENT_NO_TIME_LEFT: - if (GetTeamScore(TEAM_ALLIANCE) == GetTeamScore(TEAM_HORDE)) - EndBattleground(_lastFlagCaptureTeam); - else - EndBattleground(GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE); - break; - case BG_WS_EVENT_RESPAWN_BOTH_FLAGS: + _bgEvents.Update(diff); + switch (_bgEvents.ExecuteEvent()) + { + case BG_WS_EVENT_UPDATE_GAME_TIME: + UpdateWorldState(BG_WS_STATE_TIMER, GetMatchTime()); + _bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, ((BG_WS_TOTAL_GAME_TIME - GetStartTime()) % (MINUTE*IN_MILLISECONDS)) + 1); + break; + case BG_WS_EVENT_NO_TIME_LEFT: + if (GetTeamScore(TEAM_ALLIANCE) == GetTeamScore(TEAM_HORDE)) + EndBattleground(_lastFlagCaptureTeam); + else + EndBattleground(GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE); + break; + case BG_WS_EVENT_RESPAWN_BOTH_FLAGS: SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); - SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); - PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); - break; - case BG_WS_EVENT_ALLIANCE_DROP_FLAG: + SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); + SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); + PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); + break; + case BG_WS_EVENT_ALLIANCE_DROP_FLAG: RespawnFlagAfterDrop(TEAM_ALLIANCE); - break; - case BG_WS_EVENT_HORDE_DROP_FLAG: + break; + case BG_WS_EVENT_HORDE_DROP_FLAG: RespawnFlagAfterDrop(TEAM_HORDE); - break; - case BG_WS_EVENT_BOTH_FLAGS_KEPT10: + break; + case BG_WS_EVENT_BOTH_FLAGS_KEPT10: if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL)) player->CastSpell(player, BG_WS_SPELL_FOCUSED_ASSAULT, true); if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)NULL)) player->CastSpell(player, BG_WS_SPELL_FOCUSED_ASSAULT, true); - break; - case BG_WS_EVENT_BOTH_FLAGS_KEPT15: - if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL)) - { - player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT); + break; + case BG_WS_EVENT_BOTH_FLAGS_KEPT15: + if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL)) + { + player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT); player->CastSpell(player, BG_WS_SPELL_BRUTAL_ASSAULT, true); - } + } if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)NULL)) - { - player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT); + { + player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT); player->CastSpell(player, BG_WS_SPELL_BRUTAL_ASSAULT, true); - } - break; + } + break; } } } @@ -117,9 +117,9 @@ void BattlegroundWS::StartingEventOpenDoors() SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY); StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE); - UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1); - _bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, 0); - _bgEvents.ScheduleEvent(BG_WS_EVENT_NO_TIME_LEFT, BG_WS_TOTAL_GAME_TIME - 2*MINUTE*IN_MILLISECONDS); // 27 - 2 = 25 minutes + UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1); + _bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, 0); + _bgEvents.ScheduleEvent(BG_WS_EVENT_NO_TIME_LEFT, BG_WS_TOTAL_GAME_TIME - 2*MINUTE*IN_MILLISECONDS); // 27 - 2 = 25 minutes } void BattlegroundWS::AddPlayer(Player* player) @@ -133,18 +133,18 @@ void BattlegroundWS::RespawnFlagAfterDrop(TeamId teamId) if (GetStatus() != STATUS_IN_PROGRESS || GetFlagState(teamId) != BG_WS_FLAG_STATE_ON_GROUND) return; - UpdateFlagState(teamId, BG_WS_FLAG_STATE_ON_BASE); - SpawnBGObject(teamId == TEAM_ALLIANCE ? BG_WS_OBJECT_A_FLAG : BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED : LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); + UpdateFlagState(teamId, BG_WS_FLAG_STATE_ON_BASE); + SpawnBGObject(teamId == TEAM_ALLIANCE ? BG_WS_OBJECT_A_FLAG : BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); + SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED : LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); if (GameObject* flag = GetBgMap()->GetGameObject(GetDroppedFlagGUID(teamId))) flag->Delete(); SetDroppedFlagGUID(0, teamId); - _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10); - _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15); - RemoveAssaultAuras(); + _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10); + _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15); + RemoveAssaultAuras(); } void BattlegroundWS::EventPlayerCapturedFlag(Player* player) @@ -153,11 +153,11 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player) return; player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); - RemoveAssaultAuras(); + RemoveAssaultAuras(); AddPoints(player->GetTeamId(), 1); - SetFlagPicker(0, GetOtherTeamId(player->GetTeamId())); - UpdateFlagState(GetOtherTeamId(player->GetTeamId()), BG_WS_FLAG_STATE_ON_BASE); + SetFlagPicker(0, GetOtherTeamId(player->GetTeamId())); + UpdateFlagState(GetOtherTeamId(player->GetTeamId()), BG_WS_FLAG_STATE_ON_BASE); if (player->GetTeamId() == TEAM_ALLIANCE) { player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); @@ -176,30 +176,30 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player) SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME); SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME); - UpdateWorldState(player->GetTeamId() == TEAM_ALLIANCE ? BG_WS_FLAG_CAPTURES_ALLIANCE : BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(player->GetTeamId())); + UpdateWorldState(player->GetTeamId() == TEAM_ALLIANCE ? BG_WS_FLAG_CAPTURES_ALLIANCE : BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(player->GetTeamId())); UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1); // +1 flag captures - _lastFlagCaptureTeam = player->GetTeamId(); + _lastFlagCaptureTeam = player->GetTeamId(); RewardHonorToTeam(GetBonusHonorFromKill(2), player->GetTeamId()); if (GetTeamScore(TEAM_ALLIANCE) == BG_WS_MAX_TEAM_SCORE || GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE) { UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0); - EndBattleground(GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE ? TEAM_HORDE : TEAM_ALLIANCE); + EndBattleground(GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE ? TEAM_HORDE : TEAM_ALLIANCE); } else - _bgEvents.ScheduleEvent(BG_WS_EVENT_RESPAWN_BOTH_FLAGS, BG_WS_FLAG_RESPAWN_TIME); + _bgEvents.ScheduleEvent(BG_WS_EVENT_RESPAWN_BOTH_FLAGS, BG_WS_FLAG_RESPAWN_TIME); - _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10); - _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15); + _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10); + _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15); } void BattlegroundWS::EventPlayerDroppedFlag(Player* player) { - if (GetFlagPickerGUID(TEAM_HORDE) != player->GetGUID() && GetFlagPickerGUID(TEAM_ALLIANCE) != player->GetGUID()) - return; + if (GetFlagPickerGUID(TEAM_HORDE) != player->GetGUID() && GetFlagPickerGUID(TEAM_ALLIANCE) != player->GetGUID()) + return; - SetFlagPicker(0, GetOtherTeamId(player->GetTeamId())); + SetFlagPicker(0, GetOtherTeamId(player->GetTeamId())); player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT); player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT); @@ -210,17 +210,17 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player) player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true); if (player->GetTeamId() == TEAM_ALLIANCE) { - UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_GROUND); + UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_GROUND); player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true); SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player); - _bgEvents.RescheduleEvent(BG_WS_EVENT_HORDE_DROP_FLAG, BG_WS_FLAG_DROP_TIME); + _bgEvents.RescheduleEvent(BG_WS_EVENT_HORDE_DROP_FLAG, BG_WS_FLAG_DROP_TIME); } else { - UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_GROUND); + UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_GROUND); player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true); SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); - _bgEvents.RescheduleEvent(BG_WS_EVENT_ALLIANCE_DROP_FLAG, BG_WS_FLAG_DROP_TIME); + _bgEvents.RescheduleEvent(BG_WS_EVENT_ALLIANCE_DROP_FLAG, BG_WS_FLAG_DROP_TIME); } } @@ -243,14 +243,14 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED); PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); - SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player); + SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player); - if (GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_BASE) - { - _bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME); - _bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME); - } - return; + if (GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_BASE) + { + _bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME); + _bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME); + } + return; } // Horde Flag picked up from base @@ -263,75 +263,75 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED); PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); - SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); - if (GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_BASE) - { - _bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME); - _bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME); - } - return; + if (GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_BASE) + { + _bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME); + _bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME); + } + return; } // Alliance Flag on ground if (GetFlagState(TEAM_ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && player->IsWithinDistInMap(gameObject, 10.0f) && gameObject->GetEntry() == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY) { - SetDroppedFlagGUID(0, TEAM_ALLIANCE); + SetDroppedFlagGUID(0, TEAM_ALLIANCE); if (player->GetTeamId() == TEAM_ALLIANCE) { UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_BASE); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1); - PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED); - SendMessageToAll(LANG_BG_WS_RETURNED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); - _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10); - _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15); - RemoveAssaultAuras(); - return; + PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED); + SendMessageToAll(LANG_BG_WS_RETURNED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10); + _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15); + RemoveAssaultAuras(); + return; } else { - SetFlagPicker(player->GetGUID(), TEAM_ALLIANCE); + SetFlagPicker(player->GetGUID(), TEAM_ALLIANCE); UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER); player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG, true); - if (uint32 assaultSpellId = GetAssaultSpellId()) + if (uint32 assaultSpellId = GetAssaultSpellId()) player->CastSpell(player, assaultSpellId, true); - PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); - SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player); - return; + PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); + SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player); + return; } } // Horde Flag on ground if (GetFlagState(TEAM_HORDE) == BG_WS_FLAG_STATE_ON_GROUND && player->IsWithinDistInMap(gameObject, 10.0f) && gameObject->GetEntry() == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY) { - SetDroppedFlagGUID(0, TEAM_HORDE); + SetDroppedFlagGUID(0, TEAM_HORDE); if (player->GetTeamId() == TEAM_HORDE) { UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_BASE); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1); - PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED); - SendMessageToAll(LANG_BG_WS_RETURNED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player); - _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10); - _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15); - RemoveAssaultAuras(); - return; + PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED); + SendMessageToAll(LANG_BG_WS_RETURNED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player); + _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10); + _bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15); + RemoveAssaultAuras(); + return; } else { - SetFlagPicker(player->GetGUID(), TEAM_HORDE); + SetFlagPicker(player->GetGUID(), TEAM_HORDE); UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_PLAYER); player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG, true); - if (uint32 assaultSpellId = GetAssaultSpellId()) + if (uint32 assaultSpellId = GetAssaultSpellId()) player->CastSpell(player, assaultSpellId, true); - PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); - SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); - return; + PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); + SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + return; } } } @@ -344,8 +344,8 @@ void BattlegroundWS::RemovePlayer(Player* player) void BattlegroundWS::UpdateFlagState(TeamId teamId, uint32 value) { - _flagState[teamId] = value; - UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_WS_FLAG_STATE_HORDE : BG_WS_FLAG_STATE_ALLIANCE, value); + _flagState[teamId] = value; + UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_WS_FLAG_STATE_HORDE : BG_WS_FLAG_STATE_ALLIANCE, value); } void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger) @@ -367,13 +367,13 @@ void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger) case 3688: // Not used case 4628: // Not used case 4629: // Not used - case 3686: // Alliance elixir of speed spawn + case 3686: // Alliance elixir of speed spawn case 3687: // Horde elixir of speed spawn case 3706: // Alliance elixir of regeneration spawn case 3708: // Horde elixir of regeneration spawn case 3707: // Alliance elixir of berserk spawn case 3709: // Horde elixir of berserk spawn - break; + break; } } @@ -409,19 +409,19 @@ bool BattlegroundWS::SetupBattleground() sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE); AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE); - for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i < BG_WS_OBJECT_MAX; ++i) - if (BgObjects[i] == 0) - { - sLog->outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!"); - return false; - } + for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i < BG_WS_OBJECT_MAX; ++i) + if (BgObjects[i] == 0) + { + sLog->outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!"); + return false; + } - for (uint32 i = WS_SPIRIT_MAIN_ALLIANCE; i < BG_CREATURES_MAX_WS; ++i) - if (BgCreatures[i] == 0) - { - sLog->outErrorDb("BatteGroundWS: Failed to spawn spirit guides Battleground not created!"); - return false; - } + for (uint32 i = WS_SPIRIT_MAIN_ALLIANCE; i < BG_CREATURES_MAX_WS; ++i) + if (BgCreatures[i] == 0) + { + sLog->outErrorDb("BatteGroundWS: Failed to spawn spirit guides Battleground not created!"); + return false; + } return true; } @@ -431,7 +431,7 @@ void BattlegroundWS::Init() //call parent's class reset Battleground::Init(); - _bgEvents.Reset(); + _bgEvents.Reset(); _flagKeepers[TEAM_ALLIANCE] = 0; _flagKeepers[TEAM_HORDE] = 0; _droppedFlagGUID[TEAM_ALLIANCE] = 0; @@ -440,7 +440,7 @@ void BattlegroundWS::Init() _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; _lastFlagCaptureTeam = TEAM_NEUTRAL; - if (sBattlegroundMgr->IsBGWeekend(GetBgTypeID())) + if (sBattlegroundMgr->IsBGWeekend(GetBgTypeID())) { _reputationCapture = 45; _honorWinKills = 3; @@ -500,9 +500,9 @@ void BattlegroundWS::UpdatePlayerScore(Player* player, uint32 type, uint32 value WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveyard(Player* player) { if (GetStatus() == STATUS_IN_PROGRESS) - return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_MAIN_ALLIANCE : WS_GRAVEYARD_MAIN_HORDE); + return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_MAIN_ALLIANCE : WS_GRAVEYARD_MAIN_HORDE); else - return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_FLAGROOM_ALLIANCE : WS_GRAVEYARD_FLAGROOM_HORDE); + return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_FLAGROOM_ALLIANCE : WS_GRAVEYARD_FLAGROOM_HORDE); } void BattlegroundWS::FillInitialWorldStates(WorldPacket& data) @@ -520,32 +520,32 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data) TeamId BattlegroundWS::GetPrematureWinner() { - if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE)) - return TEAM_ALLIANCE; + if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE)) + return TEAM_ALLIANCE; - return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner(); + return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner(); } uint32 BattlegroundWS::GetAssaultSpellId() const { - if ((GetFlagPickerGUID(TEAM_ALLIANCE) == 0 && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) || - (GetFlagPickerGUID(TEAM_HORDE) == 0 && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) || - _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT10) > 0) - return 0; + if ((GetFlagPickerGUID(TEAM_ALLIANCE) == 0 && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) || + (GetFlagPickerGUID(TEAM_HORDE) == 0 && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) || + _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT10) > 0) + return 0; - return _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT15) > 0 ? BG_WS_SPELL_FOCUSED_ASSAULT : BG_WS_SPELL_BRUTAL_ASSAULT; + return _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT15) > 0 ? BG_WS_SPELL_FOCUSED_ASSAULT : BG_WS_SPELL_BRUTAL_ASSAULT; } void BattlegroundWS::RemoveAssaultAuras() { - if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL)) - { - player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT); + if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL)) + { + player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT); player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT); - } + } if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)NULL)) - { - player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT); + { + player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT); player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT); - } + } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 008329e99..71542ab2e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -9,24 +9,24 @@ REWRITTEN BY XINEF enum BG_WS_Events { - BG_WS_EVENT_UPDATE_GAME_TIME = 1, - BG_WS_EVENT_NO_TIME_LEFT = 2, - BG_WS_EVENT_RESPAWN_BOTH_FLAGS = 3, - BG_WS_EVENT_ALLIANCE_DROP_FLAG = 4, - BG_WS_EVENT_HORDE_DROP_FLAG = 5, - BG_WS_EVENT_BOTH_FLAGS_KEPT10 = 6, - BG_WS_EVENT_BOTH_FLAGS_KEPT15 = 7 + BG_WS_EVENT_UPDATE_GAME_TIME = 1, + BG_WS_EVENT_NO_TIME_LEFT = 2, + BG_WS_EVENT_RESPAWN_BOTH_FLAGS = 3, + BG_WS_EVENT_ALLIANCE_DROP_FLAG = 4, + BG_WS_EVENT_HORDE_DROP_FLAG = 5, + BG_WS_EVENT_BOTH_FLAGS_KEPT10 = 6, + BG_WS_EVENT_BOTH_FLAGS_KEPT15 = 7 }; enum BG_WS_TimerOrScore { - BG_WS_MAX_TEAM_SCORE = 3, + BG_WS_MAX_TEAM_SCORE = 3, - BG_WS_TOTAL_GAME_TIME = 27*MINUTE*IN_MILLISECONDS, - BG_WS_FLAG_RESPAWN_TIME = 23*IN_MILLISECONDS, - BG_WS_FLAG_DROP_TIME = 10*IN_MILLISECONDS, - BG_WS_SPELL_FORCE_TIME = 10*MINUTE*IN_MILLISECONDS, - BG_WS_SPELL_BRUTAL_TIME = 15*MINUTE*IN_MILLISECONDS + BG_WS_TOTAL_GAME_TIME = 27*MINUTE*IN_MILLISECONDS, + BG_WS_FLAG_RESPAWN_TIME = 23*IN_MILLISECONDS, + BG_WS_FLAG_DROP_TIME = 10*IN_MILLISECONDS, + BG_WS_SPELL_FORCE_TIME = 10*MINUTE*IN_MILLISECONDS, + BG_WS_SPELL_BRUTAL_TIME = 15*MINUTE*IN_MILLISECONDS }; enum BG_WS_Sound @@ -133,7 +133,7 @@ enum BG_WS_Objectives WS_OBJECTIVE_CAPTURE_FLAG = 42, WS_OBJECTIVE_RETURN_FLAG = 44, - WS_EVENT_START_BATTLE = 8563 + WS_EVENT_START_BATTLE = 8563 }; struct BattlegroundWGScore : public BattlegroundScore @@ -185,12 +185,12 @@ class BattlegroundWS : public Battleground void AddPoints(TeamId teamId, uint32 points) { m_TeamScores[teamId] += points; } TeamId GetPrematureWinner(); - uint32 GetMatchTime() const { return 1 + (BG_WS_TOTAL_GAME_TIME - GetStartTime()) / (MINUTE*IN_MILLISECONDS); } - uint32 GetAssaultSpellId() const; - void RemoveAssaultAuras(); + uint32 GetMatchTime() const { return 1 + (BG_WS_TOTAL_GAME_TIME - GetStartTime()) / (MINUTE*IN_MILLISECONDS); } + uint32 GetAssaultSpellId() const; + void RemoveAssaultAuras(); private: - EventMap _bgEvents; + EventMap _bgEvents; uint64 _flagKeepers[2]; uint64 _droppedFlagGUID[2]; diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index fb46516b8..ab4fe9d2d 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -69,7 +69,7 @@ void CalendarMgr::LoadFromDB() uint32 guildId = 0; if (flags & CALENDAR_FLAG_GUILD_EVENT || flags & CALENDAR_FLAG_WITHOUT_INVITES) - guildId = Player::GetGuildIdFromStorage(GUID_LOPART(creatorGUID)); + guildId = Player::GetGuildIdFromStorage(GUID_LOPART(creatorGUID)); CalendarEvent* calendarEvent = new CalendarEvent(eventId, creatorGUID, guildId, type, dungeonId, time_t(eventTime), flags, time_t(timezoneTime), title, description); _events.insert(calendarEvent); diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 8c801afef..dc287ed0d 100644 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -34,7 +34,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId, _teamId(teamId), _ownerGUID(0), _name(name), - _channelDBId(channelDBId), + _channelDBId(channelDBId), _password("") { // set special flags if built-in channel @@ -73,20 +73,20 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId, _IsSaved = true; - // Xinef: loading - if (channelDBId > 0) - return; + // Xinef: loading + if (channelDBId > 0) + return; // If storing custom channels in the db is enabled either load or save the channel if (sWorld->getBoolConfig(CONFIG_PRESERVE_CUSTOM_CHANNELS)) { - _channelDBId = ++ChannelMgr::_channelIdMax; + _channelDBId = ++ChannelMgr::_channelIdMax; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL); - stmt->setUInt32(0, _channelDBId); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL); + stmt->setUInt32(0, _channelDBId); stmt->setString(1, name); stmt->setUInt32(2, _teamId); - stmt->setUInt8(3, _announce); + stmt->setUInt8(3, _announce); CharacterDatabase.Execute(stmt); } } @@ -94,8 +94,8 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId, bool Channel::IsBanned(uint64 guid) const { - BannedContainer::const_iterator itr = bannedStore.find(GUID_LOPART(guid)); - return itr != bannedStore.end() && itr->second > time(NULL); + BannedContainer::const_iterator itr = bannedStore.find(GUID_LOPART(guid)); + return itr != bannedStore.end() && itr->second > time(NULL); } void Channel::UpdateChannelInDB() const @@ -105,7 +105,7 @@ void Channel::UpdateChannelInDB() const PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL); stmt->setBool(0, _announce); stmt->setString(1, _password); - stmt->setUInt32(2, _channelDBId); + stmt->setUInt32(2, _channelDBId); CharacterDatabase.Execute(stmt); ;//sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", _name.c_str()); @@ -115,24 +115,24 @@ void Channel::UpdateChannelInDB() const void Channel::UpdateChannelUseageInDB() const { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_USAGE); - stmt->setUInt32(0, _channelDBId); + stmt->setUInt32(0, _channelDBId); CharacterDatabase.Execute(stmt); } void Channel::AddChannelBanToDB(uint32 guid, uint32 time) const { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL_BAN); - stmt->setUInt32(0, _channelDBId); - stmt->setUInt32(1, guid); - stmt->setUInt32(2, time); + stmt->setUInt32(0, _channelDBId); + stmt->setUInt32(1, guid); + stmt->setUInt32(2, time); CharacterDatabase.Execute(stmt); } void Channel::RemoveChannelBanFromDB(uint32 guid) const { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHANNEL_BAN); - stmt->setUInt32(0, _channelDBId); - stmt->setUInt32(1, guid); + stmt->setUInt32(0, _channelDBId); + stmt->setUInt32(1, guid); CharacterDatabase.Execute(stmt); } @@ -140,16 +140,16 @@ void Channel::CleanOldChannelsInDB() { if (sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) > 0) { - SQLTransaction trans = CharacterDatabase.BeginTransaction(); + SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS); stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) * DAY); trans->Append(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS_BANS); - trans->Append(stmt); - - CharacterDatabase.CommitTransaction(trans); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS_BANS); + trans->Append(stmt); + + CharacterDatabase.CommitTransaction(trans); } } @@ -289,176 +289,176 @@ void Channel::LeaveChannel(Player* player, bool send) // If the channel owner left and there are still playersStore inside, pick a new owner if (changeowner && _ownership) { - if (!playersStore.empty()) - { - uint64 newowner = 0; - for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr) - { - newowner = itr->second.player; - if (!itr->second.plrPtr->GetSession()->GetSecurity()) - break; - } - SetOwner(newowner); - } - else - SetOwner(0); + if (!playersStore.empty()) + { + uint64 newowner = 0; + for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr) + { + newowner = itr->second.player; + if (!itr->second.plrPtr->GetSession()->GetSecurity()) + break; + } + SetOwner(newowner); + } + else + SetOwner(0); } } } void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban) { - AccountTypes sec = player->GetSession()->GetSecurity(); - uint64 good = player->GetGUID(); + AccountTypes sec = player->GetSession()->GetSecurity(); + uint64 good = player->GetGUID(); - if (!IsOn(good)) - { - WorldPacket data; - MakeNotMember(&data); - SendToOne(&data, good); - return; - } + if (!IsOn(good)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, good); + return; + } - if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec)) - { - WorldPacket data; - MakeNotModerator(&data); - SendToOne(&data, good); - return; - } + if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec)) + { + WorldPacket data; + MakeNotModerator(&data); + SendToOne(&data, good); + return; + } - bool banOffline = false; // pussywizard - bool isGoodConstantModerator = _channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end(); + bool banOffline = false; // pussywizard + bool isGoodConstantModerator = _channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end(); - uint64 victim = 0; - uint32 badAccId = 0; - uint32 badSecurity = 0; - Player* bad = ObjectAccessor::FindPlayerByName(badname, false); - if (bad) - { - victim = bad->GetGUID(); - badAccId = bad->GetSession()->GetAccountId(); - badSecurity = bad->GetSession()->GetSecurity(); - } + uint64 victim = 0; + uint32 badAccId = 0; + uint32 badSecurity = 0; + Player* bad = ObjectAccessor::FindPlayerByName(badname, false); + if (bad) + { + victim = bad->GetGUID(); + badAccId = bad->GetSession()->GetAccountId(); + badSecurity = bad->GetSession()->GetSecurity(); + } - bool isOnChannel = victim && IsOn(victim); - if (!isOnChannel) - { - if (ban && (AccountMgr::IsGMAccount(sec) || isGoodConstantModerator)) - { - if (uint32 lowGuid = sWorld->GetGlobalPlayerGUID(badname)) - if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(lowGuid)) - { - if (Player::TeamIdForRace(gpd->race) == Player::TeamIdForRace(player->getRace())) - { - banOffline = true; - victim = MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER); - badAccId = gpd->accountId; - } - else - { - ChatHandler(player->GetSession()).PSendSysMessage("Character %s has other faction!", badname.c_str()); - return; - } - } + bool isOnChannel = victim && IsOn(victim); + if (!isOnChannel) + { + if (ban && (AccountMgr::IsGMAccount(sec) || isGoodConstantModerator)) + { + if (uint32 lowGuid = sWorld->GetGlobalPlayerGUID(badname)) + if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(lowGuid)) + { + if (Player::TeamIdForRace(gpd->race) == Player::TeamIdForRace(player->getRace())) + { + banOffline = true; + victim = MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER); + badAccId = gpd->accountId; + } + else + { + ChatHandler(player->GetSession()).PSendSysMessage("Character %s has other faction!", badname.c_str()); + return; + } + } - if (!banOffline) - { - WorldPacket data; - MakePlayerNotFound(&data, badname); - SendToOne(&data, good); - return; - } - } - else - { - WorldPacket data; - MakePlayerNotFound(&data, badname); - SendToOne(&data, good); - return; - } - } + if (!banOffline) + { + WorldPacket data; + MakePlayerNotFound(&data, badname); + SendToOne(&data, good); + return; + } + } + else + { + WorldPacket data; + MakePlayerNotFound(&data, badname); + SendToOne(&data, good); + return; + } + } - bool changeowner = _ownerGUID == victim; - bool isBadConstantModerator = _channelRights.moderators.find(badAccId) != _channelRights.moderators.end(); + bool changeowner = _ownerGUID == victim; + bool isBadConstantModerator = _channelRights.moderators.find(badAccId) != _channelRights.moderators.end(); - if (!AccountMgr::IsGMAccount(sec) && !isGoodConstantModerator) - { - if (changeowner && good != _ownerGUID) - { - WorldPacket data; - MakeNotOwner(&data); - SendToOne(&data, good); - return; - } + if (!AccountMgr::IsGMAccount(sec) && !isGoodConstantModerator) + { + if (changeowner && good != _ownerGUID) + { + WorldPacket data; + MakeNotOwner(&data); + SendToOne(&data, good); + return; + } - if (ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN) || !ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_KICK)) - { - WorldPacket data; - MakeNotModerator(&data); - SendToOne(&data, good); - return; - } + if (ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN) || !ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_KICK)) + { + WorldPacket data; + MakeNotModerator(&data); + SendToOne(&data, good); + return; + } - if (isBadConstantModerator || AccountMgr::IsGMAccount(badSecurity)) - { - WorldPacket data; - MakeNotModerator(&data); - SendToOne(&data, good); - return; - } - } + if (isBadConstantModerator || AccountMgr::IsGMAccount(badSecurity)) + { + WorldPacket data; + MakeNotModerator(&data); + SendToOne(&data, good); + return; + } + } - bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)); + bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)); - if (ban) - { - if (!IsBanned(victim)) - { - bannedStore[GUID_LOPART(victim)] = time(NULL) + CHANNEL_BAN_DURATION; - AddChannelBanToDB(GUID_LOPART(victim), time(NULL) + CHANNEL_BAN_DURATION); + if (ban) + { + if (!IsBanned(victim)) + { + bannedStore[GUID_LOPART(victim)] = time(NULL) + CHANNEL_BAN_DURATION; + AddChannelBanToDB(GUID_LOPART(victim), time(NULL) + CHANNEL_BAN_DURATION); - if (notify) - { - WorldPacket data; - MakePlayerBanned(&data, victim, good); - SendToAll(&data); - } - } - } - else if (notify) - { - WorldPacket data; - MakePlayerKicked(&data, victim, good); - SendToAll(&data); - } + if (notify) + { + WorldPacket data; + MakePlayerBanned(&data, victim, good); + SendToAll(&data); + } + } + } + else if (notify) + { + WorldPacket data; + MakePlayerKicked(&data, victim, good); + SendToAll(&data); + } - if (isOnChannel) - { - playersStore.erase(victim); - bad->LeftChannel(this); - RemoveWatching(bad); - LeaveNotify(bad); - } + if (isOnChannel) + { + playersStore.erase(victim); + bad->LeftChannel(this); + RemoveWatching(bad); + LeaveNotify(bad); + } - if (changeowner && _ownership) - { - if (good != victim) - SetOwner(good); - else if (!playersStore.empty()) - { - uint64 newowner = 0; - for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr) - { - newowner = itr->second.player; - if (!itr->second.plrPtr->GetSession()->GetSecurity()) - break; - } - SetOwner(newowner); - } - else - SetOwner(0); - } + if (changeowner && _ownership) + { + if (good != victim) + SetOwner(good); + else if (!playersStore.empty()) + { + uint64 newowner = 0; + for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr) + { + newowner = itr->second.player; + if (!itr->second.plrPtr->GetSession()->GetSecurity()) + break; + } + SetOwner(newowner); + } + else + SetOwner(0); + } } void Channel::UnBan(Player const* player, std::string const& badname) @@ -482,9 +482,9 @@ void Channel::UnBan(Player const* player, std::string const& badname) return; } - uint64 victim = 0; - if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(badname)) - victim = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); + uint64 victim = 0; + if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(badname)) + victim = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); if (!victim || !IsBanned(victim)) { @@ -510,7 +510,7 @@ void Channel::UnBan(Player const* player, std::string const& badname) sLog->outCommand(player->GetSession()->GetAccountId(), "Command: /unban %s %s (Moderator %s [guid: %u, account: %u] unbanned %s [guid: %u])", GetName().c_str(), badname.c_str(), player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), badname.c_str(), GUID_LOPART(victim)); bannedStore.erase(GUID_LOPART(victim)); - RemoveChannelBanFromDB(GUID_LOPART(victim)); + RemoveChannelBanFromDB(GUID_LOPART(victim)); WorldPacket data; MakePlayerUnbanned(&data, victim, good); @@ -522,7 +522,7 @@ void Channel::UnBan(uint64 guid) if (!IsBanned(guid)) return; bannedStore.erase(GUID_LOPART(guid)); - RemoveChannelBanFromDB(GUID_LOPART(guid)); + RemoveChannelBanFromDB(GUID_LOPART(guid)); } void Channel::Password(Player const* player, std::string const& pass) @@ -595,7 +595,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo // allow make moderator from another team only if both is GMs // at this moment this only way to show channel post for GM from another team ((!AccountMgr::IsGMAccount(sec) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) && player->GetTeamId() != newp->GetTeamId() && - !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))) + !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))) { WorldPacket data; MakePlayerNotFound(&data, p2n); @@ -660,8 +660,8 @@ void Channel::SetOwner(Player const* player, std::string const& newname) Player* newp = ObjectAccessor::FindPlayerByName(newname, false); uint64 victim = newp ? newp->GetGUID() : 0; - if (!victim || !IsOn(victim) || newp->GetTeamId() != player->GetTeamId() && - !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) + if (!victim || !IsOn(victim) || newp->GetTeamId() != player->GetTeamId() && + !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) { WorldPacket data; MakePlayerNotFound(&data, newname); @@ -706,14 +706,14 @@ void Channel::List(Player const* player) data << uint32(0); // size of list, placeholder uint32 count = 0; - if (!(_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)) - for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) - if (AccountMgr::IsPlayerAccount(i->second.plrPtr->GetSession()->GetSecurity())) - { - data << uint64(i->first); - data << uint8(i->second.flags); // flags seems to be changed... - ++count; - } + if (!(_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)) + for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) + if (AccountMgr::IsPlayerAccount(i->second.plrPtr->GetSession()->GetSecurity())) + { + data << uint64(i->first); + data << uint8(i->second.flags); // flags seems to be changed... + ++count; + } data.put(pos, count); @@ -766,8 +766,8 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang) if (what.empty()) return; - if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) - lang = LANG_UNIVERSAL; + if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) + lang = LANG_UNIVERSAL; if (!IsOn(guid)) { @@ -790,22 +790,22 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang) Player* player = pinfo.plrPtr; if (player && !player->GetSession()->GetSecurity()) // pussywizard: prevent spam on populated channels - { - uint32 speakDelay = 0; - if (_channelRights.speakDelay > 0) - speakDelay = _channelRights.speakDelay; - else if (playersStore.size() >= 10) - speakDelay = 5; + { + uint32 speakDelay = 0; + if (_channelRights.speakDelay > 0) + speakDelay = _channelRights.speakDelay; + else if (playersStore.size() >= 10) + speakDelay = 5; - if (!pinfo.IsAllowedToSpeak(speakDelay)) + if (!pinfo.IsAllowedToSpeak(speakDelay)) { - std::string timeStr = secsToTimeString(pinfo.lastSpeakTime + speakDelay - sWorld->GetGameTime()); - if (_channelRights.speakMessage.length() > 0) - player->GetSession()->SendNotification(_channelRights.speakMessage.c_str()); - player->GetSession()->SendNotification("You must wait %s before speaking again.", timeStr.c_str()); + std::string timeStr = secsToTimeString(pinfo.lastSpeakTime + speakDelay - sWorld->GetGameTime()); + if (_channelRights.speakMessage.length() > 0) + player->GetSession()->SendNotification(_channelRights.speakMessage.c_str()); + player->GetSession()->SendNotification("You must wait %s before speaking again.", timeStr.c_str()); return; } - } + } WorldPacket data; if (player) @@ -818,28 +818,28 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang) void Channel::EveryoneSayToSelf(const char *what) { - if (!what) - return; + if (!what) + return; - uint32 messageLength = strlen(what) + 1; + uint32 messageLength = strlen(what) + 1; - WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+_name.size()+1+8+4+messageLength+1); - data << (uint8)CHAT_MSG_CHANNEL; - data << (uint32)LANG_UNIVERSAL; - data << uint64(0); // put player guid here - data << uint32(0); - data << _name; - data << uint64(0); // put player guid here - data << messageLength; - data << what; - data << uint8(0); + WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+_name.size()+1+8+4+messageLength+1); + data << (uint8)CHAT_MSG_CHANNEL; + data << (uint32)LANG_UNIVERSAL; + data << uint64(0); // put player guid here + data << uint32(0); + data << _name; + data << uint64(0); // put player guid here + data << messageLength; + data << what; + data << uint8(0); - for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) - { - data.put(5, i->first); - data.put(17+_name.size()+1, i->first); - i->second.plrPtr->GetSession()->SendPacket(&data); - } + for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i) + { + data.put(5, i->first); + data.put(17+_name.size()+1, i->first); + i->second.plrPtr->GetSession()->SendPacket(&data); + } } void Channel::Invite(Player const* player, std::string const& newname) @@ -1185,10 +1185,10 @@ void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid) void Channel::JoinNotify(Player* p) { - if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK) - return; - if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity())) - return; + if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK) + return; + if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity())) + return; WorldPacket data(SMSG_USERLIST_ADD, 8 + 1 + 1 + 4 + GetName().size()); data << uint64(p->GetGUID()); @@ -1202,10 +1202,10 @@ void Channel::JoinNotify(Player* p) void Channel::LeaveNotify(Player* p) { - if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK) - return; - if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity())) - return; + if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK) + return; + if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity())) + return; WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size()); data << uint64(p->GetGUID()); @@ -1218,10 +1218,10 @@ void Channel::LeaveNotify(Player* p) void Channel::FlagsNotify(Player* p) { - if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK) - return; - if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity())) - return; + if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK) + return; + if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity())) + return; WorldPacket data(SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size()); data << uint64(p->GetGUID()); @@ -1235,14 +1235,14 @@ void Channel::FlagsNotify(Player* p) void Channel::AddWatching(Player* p) { - if (!IsOn(p->GetGUID())) - return; - playersWatchingStore.insert(p); + if (!IsOn(p->GetGUID())) + return; + playersWatchingStore.insert(p); } void Channel::RemoveWatching(Player* p) { - PlayersWatchingContainer::iterator itr = playersWatchingStore.find(p); - if (itr != playersWatchingStore.end()) - playersWatchingStore.erase(itr); + PlayersWatchingContainer::iterator itr = playersWatchingStore.find(p); + if (itr != playersWatchingStore.end()) + playersWatchingStore.erase(itr); } diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h index 7a2de9cbb..7512c3439 100644 --- a/src/server/game/Chat/Channels/Channel.h +++ b/src/server/game/Chat/Channels/Channel.h @@ -30,7 +30,7 @@ class Player; -#define CHANNEL_BAN_DURATION DAY*60 +#define CHANNEL_BAN_DURATION DAY*60 enum ChatNotify { @@ -123,26 +123,26 @@ enum ChannelMemberFlags class ChannelRights { public: - ChannelRights() : flags(0), speakDelay(0) {} - ChannelRights(const uint32& f, const uint32& d, const std::string& jm, const std::string& sm, const std::set& ml) : flags(f), speakDelay(d), joinMessage(jm), speakMessage(sm), moderators(ml) {} - uint32 flags; - uint32 speakDelay; - std::string joinMessage; - std::string speakMessage; - std::set moderators; + ChannelRights() : flags(0), speakDelay(0) {} + ChannelRights(const uint32& f, const uint32& d, const std::string& jm, const std::string& sm, const std::set& ml) : flags(f), speakDelay(d), joinMessage(jm), speakMessage(sm), moderators(ml) {} + uint32 flags; + uint32 speakDelay; + std::string joinMessage; + std::string speakMessage; + std::set moderators; }; enum eChannelRights { - CHANNEL_RIGHT_FORCE_NO_ANNOUNCEMENTS = 0x001, - CHANNEL_RIGHT_FORCE_ANNOUNCEMENTS = 0x002, - CHANNEL_RIGHT_NO_OWNERSHIP = 0x004, - CHANNEL_RIGHT_CANT_SPEAK = 0x008, - CHANNEL_RIGHT_CANT_BAN = 0x010, - CHANNEL_RIGHT_CANT_KICK = 0x020, - CHANNEL_RIGHT_CANT_MUTE = 0x040, - CHANNEL_RIGHT_CANT_CHANGE_PASSWORD = 0x080, - CHANNEL_RIGHT_DONT_PRESERVE = 0x100, + CHANNEL_RIGHT_FORCE_NO_ANNOUNCEMENTS = 0x001, + CHANNEL_RIGHT_FORCE_ANNOUNCEMENTS = 0x002, + CHANNEL_RIGHT_NO_OWNERSHIP = 0x004, + CHANNEL_RIGHT_CANT_SPEAK = 0x008, + CHANNEL_RIGHT_CANT_BAN = 0x010, + CHANNEL_RIGHT_CANT_KICK = 0x020, + CHANNEL_RIGHT_CANT_MUTE = 0x040, + CHANNEL_RIGHT_CANT_CHANGE_PASSWORD = 0x080, + CHANNEL_RIGHT_DONT_PRESERVE = 0x100, }; class Channel @@ -204,7 +204,7 @@ class Channel void KickOrBan(Player const* player, std::string const& badname, bool ban); void Kick(Player const* player, std::string const& badname) { KickOrBan(player, badname, false); } void Ban(Player const* player, std::string const& badname) { KickOrBan(player, badname, true); } - void AddBan(uint32 guid, uint32 time) { bannedStore[guid] = time; } + void AddBan(uint32 guid, uint32 time) { bannedStore[guid] = time; } void UnBan(Player const* player, std::string const& badname); void UnBan(uint64 guid); void Password(Player const* player, std::string const& pass); @@ -219,7 +219,7 @@ class Channel void List(Player const* player); void Announce(Player const* player); void Say(uint64 guid, std::string const& what, uint32 lang); - void EveryoneSayToSelf(const char *what); + void EveryoneSayToSelf(const char *what); void Invite(Player const* player, std::string const& newp); void Voice(uint64 guid1, uint64 guid2); void DeVoice(uint64 guid1, uint64 guid2); @@ -228,9 +228,9 @@ class Channel void FlagsNotify(Player* p); static void CleanOldChannelsInDB(); - // pussywizard: - void AddWatching(Player* p); - void RemoveWatching(Player* p); + // pussywizard: + void AddWatching(Player* p); + void RemoveWatching(Player* p); private: // initial packet data (notify type and channel name) @@ -281,8 +281,8 @@ class Channel void UpdateChannelInDB() const; void UpdateChannelUseageInDB() const; - void AddChannelBanToDB(uint32 guid, uint32 time) const; - void RemoveChannelBanFromDB(uint32 guid) const; + void AddChannelBanToDB(uint32 guid, uint32 time) const; + void RemoveChannelBanFromDB(uint32 guid) const; uint8 GetPlayerFlags(uint64 guid) const { @@ -329,7 +329,7 @@ class Channel bool _IsSaved; uint8 _flags; uint32 _channelId; - uint32 _channelDBId; + uint32 _channelDBId; TeamId _teamId; uint64 _ownerGUID; std::string _name; diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 2826aa298..af7112da7 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -30,8 +30,8 @@ ChannelMgr::~ChannelMgr() ChannelMgr* ChannelMgr::forTeam(TeamId teamId) { - if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) - return ACE_Singleton::instance(); // cross-faction + if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) + return ACE_Singleton::instance(); // cross-faction if (teamId == TEAM_ALLIANCE) return ACE_Singleton::instance(); @@ -45,13 +45,13 @@ ChannelMgr* ChannelMgr::forTeam(TeamId teamId) void ChannelMgr::LoadChannels() { - uint32 oldMSTime = getMSTime(); - uint32 count = 0; + uint32 oldMSTime = getMSTime(); + uint32 count = 0; - QueryResult result = CharacterDatabase.PQuery("SELECT channelId, name, team, announce, password FROM channels WHERE team = %u ORDER BY channelId ASC", _teamId); + QueryResult result = CharacterDatabase.PQuery("SELECT channelId, name, team, announce, password FROM channels WHERE team = %u ORDER BY channelId ASC", _teamId); if (!result) { - sLog->outString(">> Loaded 0 channels for %s", _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde"); + sLog->outString(">> Loaded 0 channels for %s", _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde"); sLog->outString(); return; } @@ -62,31 +62,31 @@ void ChannelMgr::LoadChannels() if (!fields) break; - uint32 channelDBId = fields[0].GetUInt32(); - std::string channelName = fields[1].GetString(); - std::string password = fields[4].GetString(); - std::wstring channelWName; - Utf8toWStr(channelName, channelWName); + uint32 channelDBId = fields[0].GetUInt32(); + std::string channelName = fields[1].GetString(); + std::string password = fields[4].GetString(); + std::wstring channelWName; + Utf8toWStr(channelName, channelWName); - Channel* newChannel = new Channel(channelName, 0, channelDBId, TeamId(fields[2].GetUInt32()), fields[3].GetUInt8()); - newChannel->SetPassword(password); + Channel* newChannel = new Channel(channelName, 0, channelDBId, TeamId(fields[2].GetUInt32()), fields[3].GetUInt8()); + newChannel->SetPassword(password); channels[channelWName] = newChannel; - if (QueryResult banResult = CharacterDatabase.PQuery("SELECT playerGUID, banTime FROM channels_bans WHERE channelId = %u", channelDBId)) - { - do - { - Field* banFields = banResult->Fetch(); - if (!banFields) - break; - newChannel->AddBan(banFields[0].GetUInt32(), banFields[1].GetUInt32()); - } - while (banResult->NextRow()); - } + if (QueryResult banResult = CharacterDatabase.PQuery("SELECT playerGUID, banTime FROM channels_bans WHERE channelId = %u", channelDBId)) + { + do + { + Field* banFields = banResult->Fetch(); + if (!banFields) + break; + newChannel->AddBan(banFields[0].GetUInt32(), banFields[1].GetUInt32()); + } + while (banResult->NextRow()); + } - if (channelDBId > ChannelMgr::_channelIdMax) - ChannelMgr::_channelIdMax = channelDBId; - ++count; + if (channelDBId > ChannelMgr::_channelIdMax) + ChannelMgr::_channelIdMax = channelDBId; + ++count; } while (result->NextRow()); @@ -144,58 +144,58 @@ ChannelRights ChannelMgr::channelRightsEmpty; void ChannelMgr::LoadChannelRights() { - uint32 oldMSTime = getMSTime(); - channels_rights.clear(); + uint32 oldMSTime = getMSTime(); + channels_rights.clear(); - QueryResult result = CharacterDatabase.Query("SELECT name, flags, speakdelay, joinmessage, delaymessage, moderators FROM channels_rights"); - if (!result) - { - sLog->outString(); - sLog->outString(">> Loaded 0 Channel Rights!"); - return; - } + QueryResult result = CharacterDatabase.Query("SELECT name, flags, speakdelay, joinmessage, delaymessage, moderators FROM channels_rights"); + if (!result) + { + sLog->outString(); + sLog->outString(">> Loaded 0 Channel Rights!"); + return; + } - uint32 count = 0; - do - { - Field* fields = result->Fetch(); - std::set moderators; - const char* moderatorList = fields[5].GetCString(); - if (moderatorList) - { - Tokenizer tokens(moderatorList, ' '); - for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i) - { - uint64 moderator_acc = atol(*i); - if (moderator_acc && ((uint32)moderator_acc) == moderator_acc) - moderators.insert((uint32)moderator_acc); - } - } + uint32 count = 0; + do + { + Field* fields = result->Fetch(); + std::set moderators; + const char* moderatorList = fields[5].GetCString(); + if (moderatorList) + { + Tokenizer tokens(moderatorList, ' '); + for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i) + { + uint64 moderator_acc = atol(*i); + if (moderator_acc && ((uint32)moderator_acc) == moderator_acc) + moderators.insert((uint32)moderator_acc); + } + } - SetChannelRightsFor(fields[0].GetString(), fields[1].GetUInt32(), fields[2].GetUInt32(), fields[3].GetString(), fields[4].GetString(), moderators); + SetChannelRightsFor(fields[0].GetString(), fields[1].GetUInt32(), fields[2].GetUInt32(), fields[3].GetString(), fields[4].GetString(), moderators); - ++count; - } while (result->NextRow()); + ++count; + } while (result->NextRow()); - sLog->outString(">> Loaded %d Channel Rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outString(">> Loaded %d Channel Rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(); } const ChannelRights& ChannelMgr::GetChannelRightsFor(const std::string& name) { - std::string nameStr = name; - std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower); - ChannelRightsMap::const_iterator itr = channels_rights.find(nameStr); - if (itr != channels_rights.end()) - return itr->second; - return channelRightsEmpty; + std::string nameStr = name; + std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower); + ChannelRightsMap::const_iterator itr = channels_rights.find(nameStr); + if (itr != channels_rights.end()) + return itr->second; + return channelRightsEmpty; } void ChannelMgr::SetChannelRightsFor(const std::string& name, const uint32& flags, const uint32& speakDelay, const std::string& joinmessage, const std::string& speakmessage, const std::set& moderators) { - std::string nameStr = name; - std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower); - channels_rights[nameStr] = ChannelRights(flags, speakDelay, joinmessage, speakmessage, moderators); + std::string nameStr = name; + std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower); + channels_rights[nameStr] = ChannelRights(flags, speakDelay, joinmessage, speakmessage, moderators); } void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name) diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h index 6b680b468..1c8f7c20f 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.h +++ b/src/server/game/Chat/Channels/ChannelMgr.h @@ -44,12 +44,12 @@ class ChannelMgr Channel* GetJoinChannel(std::string const& name, uint32 channel_id); Channel* GetChannel(std::string const& name, Player* p, bool pkt = true); - void LoadChannels(); + void LoadChannels(); static void LoadChannelRights(); static const ChannelRights& GetChannelRightsFor(const std::string& name); static void SetChannelRightsFor(const std::string& name, const uint32& flags, const uint32& speakDelay, const std::string& joinmessage, const std::string& speakmessage, const std::set& moderators); - static uint32 _channelIdMax; + static uint32 _channelIdMax; private: ChannelMap channels; diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 906cdf4f3..8efd405d0 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -347,15 +347,15 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, st SetSentErrorMessage(false); // table[i].Name == "" is special case: send original command to handler const char* aText = table[i].Name[0] != '\0' ? text : oldtext; - if (aText) - fullcmd += aText; + if (aText) + fullcmd += aText; if ((table[i].Handler)(this, aText)) { - // pussywizard: ignore logging spect command - std::string fc = fullcmd; - if (fc.size() >= 5) - std::transform(fc.begin(), fc.end(), fc.begin(), ::tolower); - bool ignore = fc.size() >= 5 && fc.substr(0,5) == "spect"; + // pussywizard: ignore logging spect command + std::string fc = fullcmd; + if (fc.size() >= 5) + std::transform(fc.begin(), fc.end(), fc.begin(), ::tolower); + bool ignore = fc.size() >= 5 && fc.substr(0,5) == "spect"; if (!AccountMgr::IsPlayerAccount(table[i].SecurityLevel) && !ignore) { @@ -731,7 +731,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag if (Player const* playerSender = sender->ToPlayer()) { chatTag = playerSender->GetChatTag(); - gmMessage = playerSender->IsGameMaster(); + gmMessage = playerSender->IsGameMaster(); } } diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index e6c30f9a1..24e7b87ea 100644 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -123,7 +123,7 @@ class ChatHandler static bool LoadCommandTable() { return load_command_table; } static void SetLoadCommandTable(bool val) { load_command_table = val; } - bool ShowHelpForCommand(ChatCommand* table, const char* cmd); + bool ShowHelpForCommand(ChatCommand* table, const char* cmd); protected: explicit ChatHandler() : m_session(NULL), sentErrorMessage(false) {} // for CLI subclass static bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand); diff --git a/src/server/game/Combat/HostileRefManager.cpp b/src/server/game/Combat/HostileRefManager.cpp index 0470f0c12..dc0f016df 100644 --- a/src/server/game/Combat/HostileRefManager.cpp +++ b/src/server/game/Combat/HostileRefManager.cpp @@ -207,8 +207,8 @@ void HostileRefManager::UpdateVisibility(bool checkThreat) while (ref) { HostileReference* nextRef = ref->next(); - if ((!checkThreat || ref->GetSource()->getThreatList().size() <= 1) && - !ref->GetSource()->GetOwner()->CanSeeOrDetect(GetOwner())) + if ((!checkThreat || ref->GetSource()->getThreatList().size() <= 1) && + !ref->GetSource()->GetOwner()->CanSeeOrDetect(GetOwner())) { nextRef = ref->next(); ref->removeReference(); diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 1ea103698..add727d86 100644 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -156,10 +156,10 @@ void HostileReference::addThreat(float modThreat) void HostileReference::addThreatPercent(int32 percent) { - // Xinef: Do not allow to modify threat by percent if threat is negative (forced to big value < 0 by spells adding temporary threat) - // Xinef: When the temporary effect ends, temporary threat is added back which results in huge additional amount of threat - if (iThreat <= 0) - return; + // Xinef: Do not allow to modify threat by percent if threat is negative (forced to big value < 0 by spells adding temporary threat) + // Xinef: When the temporary effect ends, temporary threat is added back which results in huge additional amount of threat + if (iThreat <= 0) + return; float tmpThreat = iThreat; AddPct(tmpThreat, percent); @@ -302,95 +302,95 @@ void ThreatContainer::update() HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileReference* currentVictim) const { - // pussywizard: pretty much remade this whole function + // pussywizard: pretty much remade this whole function - HostileReference* currentRef = NULL; - bool found = false; - bool noPriorityTargetFound = false; - uint32 currTime = sWorld->GetGameTime(); + HostileReference* currentRef = NULL; + bool found = false; + bool noPriorityTargetFound = false; + uint32 currTime = sWorld->GetGameTime(); - // pussywizard: currentVictim is needed to compare if threat was exceeded by 10%/30% for melee/range targets (only then switching current target) - if (currentVictim) - { - Unit* cvUnit = currentVictim->getTarget(); - if (!attacker->_CanDetectFeignDeathOf(cvUnit) || !attacker->CanCreatureAttack(cvUnit) || attacker->isTargetNotAcceptableByMMaps(cvUnit->GetGUID(), currTime, cvUnit)) // pussywizard: if currentVictim is not valid => don't compare the threat with it, just take the highest threat valid target - currentVictim = NULL; - else if (cvUnit->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || cvUnit->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) // pussywizard: no 10%/30% if currentVictim is immune to damage or has auras breakable by damage - currentVictim = NULL; - } + // pussywizard: currentVictim is needed to compare if threat was exceeded by 10%/30% for melee/range targets (only then switching current target) + if (currentVictim) + { + Unit* cvUnit = currentVictim->getTarget(); + if (!attacker->_CanDetectFeignDeathOf(cvUnit) || !attacker->CanCreatureAttack(cvUnit) || attacker->isTargetNotAcceptableByMMaps(cvUnit->GetGUID(), currTime, cvUnit)) // pussywizard: if currentVictim is not valid => don't compare the threat with it, just take the highest threat valid target + currentVictim = NULL; + else if (cvUnit->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || cvUnit->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) // pussywizard: no 10%/30% if currentVictim is immune to damage or has auras breakable by damage + currentVictim = NULL; + } - ThreatContainer::StorageType::const_iterator lastRef = iThreatList.end(); - --lastRef; + ThreatContainer::StorageType::const_iterator lastRef = iThreatList.end(); + --lastRef; - // pussywizard: iterate from highest to lowest threat - for (ThreatContainer::StorageType::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;) - { - currentRef = (*iter); + // pussywizard: iterate from highest to lowest threat + for (ThreatContainer::StorageType::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;) + { + currentRef = (*iter); - Unit* target = currentRef->getTarget(); - ASSERT(target); // if the ref has status online the target must be there ! + Unit* target = currentRef->getTarget(); + ASSERT(target); // if the ref has status online the target must be there ! - // pussywizard: don't go to threat comparison if this ref is immune to damage or has aura breakable on damage (second choice target) - // pussywizard: if this is the last entry on the threat list, then all targets are second choice, set bool to true and loop threat list again, ignoring this section - if (!noPriorityTargetFound && (target->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE) || target->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, attacker->GetGUID()))) - { - if (iter != lastRef) - { - ++iter; - continue; - } - else - { - noPriorityTargetFound = true; - iter = iThreatList.begin(); - continue; - } - } + // pussywizard: don't go to threat comparison if this ref is immune to damage or has aura breakable on damage (second choice target) + // pussywizard: if this is the last entry on the threat list, then all targets are second choice, set bool to true and loop threat list again, ignoring this section + if (!noPriorityTargetFound && (target->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE) || target->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, attacker->GetGUID()))) + { + if (iter != lastRef) + { + ++iter; + continue; + } + else + { + noPriorityTargetFound = true; + iter = iThreatList.begin(); + continue; + } + } - // pussywizard: skip not valid targets - if (attacker->_CanDetectFeignDeathOf(target) && attacker->CanCreatureAttack(target) && !attacker->isTargetNotAcceptableByMMaps(target->GetGUID(), currTime, target)) - { - if (currentVictim) // pussywizard: if not NULL then target must have 10%/30% more threat - { - if (currentVictim == currentRef) // pussywizard: nothing found previously was good and enough, currentRef passed all necessary tests, so end now - { - found = true; - break; - } + // pussywizard: skip not valid targets + if (attacker->_CanDetectFeignDeathOf(target) && attacker->CanCreatureAttack(target) && !attacker->isTargetNotAcceptableByMMaps(target->GetGUID(), currTime, target)) + { + if (currentVictim) // pussywizard: if not NULL then target must have 10%/30% more threat + { + if (currentVictim == currentRef) // pussywizard: nothing found previously was good and enough, currentRef passed all necessary tests, so end now + { + found = true; + break; + } - // pussywizard: implement 110% threat rule for targets in melee range and 130% rule for targets in ranged distances - if (currentRef->getThreat() > 1.3f * currentVictim->getThreat()) // pussywizard: enough in all cases, end - { - found = true; - break; - } - else if (currentRef->getThreat() > 1.1f * currentVictim->getThreat()) // pussywizard: enought only if target in melee range - { - if (attacker->IsWithinMeleeRange(target)) - { - found = true; - break; - } - } - else // pussywizard: nothing found previously was good and enough, this and next entries on the list have less than 110% threat, and currentVictim is present and valid as checked before the loop (otherwise it's NULL), so end now - { - currentRef = currentVictim; - found = true; - break; - } - } - else // pussywizard: no currentVictim, first passing all checks is chosen (highest threat, list is sorted) - { - found = true; - break; - } - } - ++iter; - } - if (!found) - currentRef = NULL; + // pussywizard: implement 110% threat rule for targets in melee range and 130% rule for targets in ranged distances + if (currentRef->getThreat() > 1.3f * currentVictim->getThreat()) // pussywizard: enough in all cases, end + { + found = true; + break; + } + else if (currentRef->getThreat() > 1.1f * currentVictim->getThreat()) // pussywizard: enought only if target in melee range + { + if (attacker->IsWithinMeleeRange(target)) + { + found = true; + break; + } + } + else // pussywizard: nothing found previously was good and enough, this and next entries on the list have less than 110% threat, and currentVictim is present and valid as checked before the loop (otherwise it's NULL), so end now + { + currentRef = currentVictim; + found = true; + break; + } + } + else // pussywizard: no currentVictim, first passing all checks is chosen (highest threat, list is sorted) + { + found = true; + break; + } + } + ++iter; + } + if (!found) + currentRef = NULL; - return currentRef; + return currentRef; } //============================================================ @@ -432,8 +432,8 @@ void ThreatManager::doAddThreat(Unit* victim, float threat) { float redirectThreat = CalculatePct(threat, redirectThreadPct); threat -= redirectThreat; - if (ThreatCalcHelper::isValidProcess(redirectTarget, GetOwner())) - _addThreat(redirectTarget, redirectThreat); + if (ThreatCalcHelper::isValidProcess(redirectTarget, GetOwner())) + _addThreat(redirectTarget, redirectThreat); } } diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index d17ff269c..c521ce198 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -91,11 +91,11 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_TEAM: { if (Player* player = object->ToPlayer()) - { - // Xinef: DB Data compatibility... - uint32 teamOld = player->GetTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE; + { + // Xinef: DB Data compatibility... + uint32 teamOld = player->GetTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE; condMeets = teamOld == ConditionValue1; - } + } break; } case CONDITION_CLASS: @@ -155,16 +155,16 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) } break; } - case CONDITION_QUEST_SATISFY_EXCLUSIVE: - { + case CONDITION_QUEST_SATISFY_EXCLUSIVE: + { if (Player* player = object->ToPlayer()) { - // Xinef: cannot be null, checked at loading - const Quest* quest = sObjectMgr->GetQuestTemplate(ConditionValue1); - condMeets = !player->IsQuestRewarded(ConditionValue1) && player->SatisfyQuestExclusiveGroup(quest, false); + // Xinef: cannot be null, checked at loading + const Quest* quest = sObjectMgr->GetQuestTemplate(ConditionValue1); + condMeets = !player->IsQuestRewarded(ConditionValue1) && player->SatisfyQuestExclusiveGroup(quest, false); } break; - } + } case CONDITION_ACTIVE_EVENT: condMeets = sGameEventMgr->IsActiveEvent(ConditionValue1); break; @@ -227,9 +227,9 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) } case CONDITION_OBJECT_ENTRY_GUID: { - if (ConditionValue3 == 1 && object->ToUnit()) // pussywizard: if == 1, ignore not attackable/selectable targets - if (object->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) - break; + if (ConditionValue3 == 1 && object->ToUnit()) // pussywizard: if == 1, ignore not attackable/selectable targets + if (object->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) + break; if (uint32(object->GetTypeId()) == ConditionValue1) { @@ -372,7 +372,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_HAS_AURA_TYPE: { if (Unit* unit = object->ToUnit()) - condMeets = unit->HasAuraType(AuraType(ConditionValue1)); + condMeets = unit->HasAuraType(AuraType(ConditionValue1)); break; } default: @@ -492,7 +492,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition() default: break; } - break; + break; case CONDITION_TYPE_MASK: if (ConditionValue1 & TYPEMASK_UNIT) mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; @@ -535,7 +535,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition() break; case CONDITION_GENDER: mask |= GRID_MAP_TYPE_MASK_PLAYER; - break; + break; case CONDITION_UNIT_STATE: mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; break; @@ -563,8 +563,8 @@ uint32 Condition::GetMaxAvailableConditionTargets() // returns number of targets which are available for given source type switch(SourceType) { - case CONDITION_SOURCE_TYPE_SMART_EVENT: - return 3; + case CONDITION_SOURCE_TYPE_SMART_EVENT: + return 3; case CONDITION_SOURCE_TYPE_SPELL: case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET: case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE: @@ -1468,7 +1468,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) case TARGET_SELECT_CATEGORY_NEARBY: case TARGET_SELECT_CATEGORY_CONE: case TARGET_SELECT_CATEGORY_AREA: - case TARGET_SELECT_CATEGORY_TRAJ: + case TARGET_SELECT_CATEGORY_TRAJ: continue; default: break; @@ -1479,15 +1479,15 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) case TARGET_SELECT_CATEGORY_NEARBY: case TARGET_SELECT_CATEGORY_CONE: case TARGET_SELECT_CATEGORY_AREA: - case TARGET_SELECT_CATEGORY_TRAJ: + case TARGET_SELECT_CATEGORY_TRAJ: continue; default: break; } - // Xinef: chain targets are treated as area targets! Apply conditions! - if (spellInfo->Effects[i].ChainTarget > 1) - continue; + // Xinef: chain targets are treated as area targets! Apply conditions! + if (spellInfo->Effects[i].ChainTarget > 1) + continue; sLog->outErrorDb("SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i)); cond->SourceGroup &= ~(1<GetQuestTemplate(cond->ConditionValue1)) { @@ -1944,7 +1944,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) return false; } break; - } + } case CONDITION_TYPE_MASK: { if (!cond->ConditionValue1 || (cond->ConditionValue1 & ~(TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_CORPSE))) @@ -2124,9 +2124,9 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) break; } case CONDITION_IN_WATER: - { + { break; - } + } case CONDITION_HAS_AURA_TYPE: { if (cond->ConditionValue1 == SPELL_AURA_NONE || cond->ConditionValue1 >= TOTAL_AURAS) diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 34dacf114..dab56ed67 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -74,17 +74,17 @@ enum ConditionTypes CONDITION_HP_PCT = 38, // hpPct ComparisonType 0 true if unit's hp matches given pct CONDITION_REALM_ACHIEVEMENT = 39, // achievement_id 0 0 true if realm achievement is complete CONDITION_IN_WATER = 40, // 0 0 0 true if unit in water - // RESERVED = 41, - // RESERVED = 42, - // RESERVED = 43, - // RESERVED = 44, - // RESERVED = 45, - // RESERVED = 46, - // RESERVED = 47, - // RESERVED = 48, - // RESERVED = 49, + // RESERVED = 41, + // RESERVED = 42, + // RESERVED = 43, + // RESERVED = 44, + // RESERVED = 45, + // RESERVED = 46, + // RESERVED = 47, + // RESERVED = 48, + // RESERVED = 49, CONDITION_QUEST_SATISFY_EXCLUSIVE = 50, // quest_id 0 0 true if satisfied exclusive group - CONDITION_HAS_AURA_TYPE = 51, // aura_type 0 0 true if has aura type + CONDITION_HAS_AURA_TYPE = 51, // aura_type 0 0 true if has aura type CONDITION_MAX = 52 // MAX }; diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index c46fadffc..f63881da5 100644 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -123,12 +123,12 @@ void LoadDisables() data.params[1].insert(atoi(tokens[i++])); } - // xinef: if spell has disabled los, add flag - if (flags & SPELL_DISABLE_LOS) - { - SpellInfo* spellInfo = const_cast(sSpellMgr->GetSpellInfo(entry)); - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - } + // xinef: if spell has disabled los, add flag + if (flags & SPELL_DISABLE_LOS) + { + SpellInfo* spellInfo = const_cast(sSpellMgr->GetSpellInfo(entry)); + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + } break; // checked later diff --git a/src/server/game/Conditions/DisableMgr.h b/src/server/game/Conditions/DisableMgr.h index d33de6c73..eaba2e63e 100644 --- a/src/server/game/Conditions/DisableMgr.h +++ b/src/server/game/Conditions/DisableMgr.h @@ -32,7 +32,7 @@ enum DisableType DISABLE_TYPE_ACHIEVEMENT_CRITERIA = 4, DISABLE_TYPE_OUTDOORPVP = 5, DISABLE_TYPE_VMAP = 6, - DISABLE_TYPE_GO_LOS = 7, + DISABLE_TYPE_GO_LOS = 7, }; enum SpellDisableTypes diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index d09441091..3d57fee88 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -368,7 +368,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sItemSetStore, dbcPath, "ItemSet.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sLFGDungeonStore, dbcPath, "LFGDungeons.dbc"); - LoadDBC(availableDbcLocales, bad_dbc_files, sLightStore, dbcPath, "Light.dbc"); + LoadDBC(availableDbcLocales, bad_dbc_files, sLightStore, dbcPath, "Light.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sLiquidTypeStore, dbcPath, "LiquidType.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sLockStore, dbcPath, "Lock.dbc"); @@ -420,7 +420,7 @@ void LoadDBCStores(const std::string& dataPath) SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); - if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_PASSIVE)) + if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_PASSIVE)) { for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i) { @@ -822,12 +822,12 @@ MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &di PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level) { - if (mapid == sBattlegroundMgr->randomBgDifficultyEntry.mapId) - { - if (level < sBattlegroundMgr->randomBgDifficultyEntry.minLevel) - return NULL; - return &sBattlegroundMgr->randomBgDifficultyEntry; - } + if (mapid == sBattlegroundMgr->randomBgDifficultyEntry.mapId) + { + if (level < sBattlegroundMgr->randomBgDifficultyEntry.minLevel) + return NULL; + return &sBattlegroundMgr->randomBgDifficultyEntry; + } PvPDifficultyEntry const* maxEntry = NULL; // used for level > max listed level case for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) @@ -853,12 +853,12 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id) { - if (mapid == sBattlegroundMgr->randomBgDifficultyEntry.mapId) - { - if (id != sBattlegroundMgr->randomBgDifficultyEntry.bracketId) - return NULL; - return &sBattlegroundMgr->randomBgDifficultyEntry; - } + if (mapid == sBattlegroundMgr->randomBgDifficultyEntry.mapId) + { + if (id != sBattlegroundMgr->randomBgDifficultyEntry.bracketId) + return NULL; + return &sBattlegroundMgr->randomBgDifficultyEntry; + } for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 78c05b1db..26cceeb01 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -535,15 +535,15 @@ struct AreaTableEntry return (flags & AREA_FLAG_SANCTUARY); } - // Xinef: mark some zones / areas as inns - bool IsInn(TeamId teamId) const - { - if (teamId == TEAM_ALLIANCE) - return flags & AREA_FLAG_REST_ZONE_ALLIANCE; - else if (teamId == TEAM_HORDE) - return flags & AREA_FLAG_REST_ZONE_HORDE; - return false; - } + // Xinef: mark some zones / areas as inns + bool IsInn(TeamId teamId) const + { + if (teamId == TEAM_ALLIANCE) + return flags & AREA_FLAG_REST_ZONE_ALLIANCE; + else if (teamId == TEAM_HORDE) + return flags & AREA_FLAG_REST_ZONE_HORDE; + return false; + } }; #define MAX_GROUP_AREA_IDS 6 @@ -926,9 +926,9 @@ struct FactionTemplateEntry // helpers bool IsFriendlyTo(FactionTemplateEntry const& entry) const { - // Xinef: Always friendly to self faction - if (faction == entry.faction) - return true; + // Xinef: Always friendly to self faction + if (faction == entry.faction) + return true; if (entry.faction) { diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h index 4daef16ed..02e24db07 100644 --- a/src/server/game/DungeonFinding/LFG.h +++ b/src/server/game/DungeonFinding/LFG.h @@ -110,93 +110,93 @@ typedef std::map LfgGroupsMap; class Lfg5Guids { public: - uint64 guid[5]; - LfgRolesMap* roles; - Lfg5Guids() { memset(&guid, 0, 5*8); roles = NULL; } - Lfg5Guids(uint64 g) { memset(&guid, 0, 5*8); guid[0] = g; roles = NULL; } - Lfg5Guids(Lfg5Guids const& x) { memcpy(guid, x.guid, 5*8); if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; } - Lfg5Guids(Lfg5Guids const& x, bool copyRoles) { memcpy(guid, x.guid, 5*8); roles = NULL; } - ~Lfg5Guids() { delete roles; } - void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); } - void clear() { memset(&guid, 0, 5*8); } - bool empty() const { return guid[0] == 0; } - uint64 front() const { return guid[0]; } - uint8 size() const - { - if (guid[2]) - { - if (guid[4]) return 5; - else if (guid[3]) return 4; - return 3; - } - else if (guid[1]) return 2; - else if (guid[0]) return 1; - return 0; - } - void insert(const uint64& g) - { - // avoid loops for performance - if (guid[0] == 0) { guid[0] = g; return; } - else if (g <= guid[0]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g; return; } - if (guid[1] == 0) { guid[1] = g; return; } - else if (g <= guid[1]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; guid[2] = guid[1]; guid[1] = g; return; } - if (guid[2] == 0) { guid[2] = g; return; } - else if (g <= guid[2]) { if (guid[3]) guid[4] = guid[3]; guid[3] = guid[2]; guid[2] = g; return; } - if (guid[3] == 0) { guid[3] = g; return; } - else if (g <= guid[3]) { guid[4] = guid[3]; guid[3] = g; return; } - guid[4] = g; - } - void force_insert_front(const uint64& g) - { - if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g; - } - void remove(const uint64& g) - { - // avoid loops for performance - if (guid[0] == g) { if (guid[1]) guid[0] = guid[1]; else { guid[0] = 0; return; } if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; } - if (guid[1] == g) { if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; } - if (guid[2] == g) { if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; } - if (guid[3] == g) { if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; } - if (guid[4] == g) guid[4] = 0; - } - bool hasGuid(const uint64& g) const - { - return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g); - } - bool operator<(const Lfg5Guids& x) const - { - // not neat, but fast xD - if (guid[0]<=x.guid[0]) { - if (guid[0] == x.guid[0]) { - if (guid[1]<=x.guid[1]) { - if (guid[1] == x.guid[1]) { - if (guid[2]<=x.guid[2]) { - if (guid[2] == x.guid[2]) { - if (guid[3]<=x.guid[3]) { - if (guid[3] == x.guid[3]) { - if (guid[4]<=x.guid[4]) { - if (guid[4] == x.guid[4]) return false; else return true; - } else return false; - } else return true; - } else return false; - } else return true; - } else return false; - } else return true; - } else return false; - } else return true; - } else return false; - } - bool operator==(const Lfg5Guids& x) const - { - return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4]; - } - void operator=(const Lfg5Guids& x) { memcpy(guid, x.guid, 5*8); delete roles; if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; } - std::string toString() const // for debugging - { - std::ostringstream o; - o << GUID_LOPART(guid[0]) << "," << GUID_LOPART(guid[1]) << "," << GUID_LOPART(guid[2]) << "," << GUID_LOPART(guid[3]) << "," << GUID_LOPART(guid[4]) << ":" << (roles ? 1 : 0); - return o.str(); - } + uint64 guid[5]; + LfgRolesMap* roles; + Lfg5Guids() { memset(&guid, 0, 5*8); roles = NULL; } + Lfg5Guids(uint64 g) { memset(&guid, 0, 5*8); guid[0] = g; roles = NULL; } + Lfg5Guids(Lfg5Guids const& x) { memcpy(guid, x.guid, 5*8); if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; } + Lfg5Guids(Lfg5Guids const& x, bool copyRoles) { memcpy(guid, x.guid, 5*8); roles = NULL; } + ~Lfg5Guids() { delete roles; } + void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); } + void clear() { memset(&guid, 0, 5*8); } + bool empty() const { return guid[0] == 0; } + uint64 front() const { return guid[0]; } + uint8 size() const + { + if (guid[2]) + { + if (guid[4]) return 5; + else if (guid[3]) return 4; + return 3; + } + else if (guid[1]) return 2; + else if (guid[0]) return 1; + return 0; + } + void insert(const uint64& g) + { + // avoid loops for performance + if (guid[0] == 0) { guid[0] = g; return; } + else if (g <= guid[0]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g; return; } + if (guid[1] == 0) { guid[1] = g; return; } + else if (g <= guid[1]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; guid[2] = guid[1]; guid[1] = g; return; } + if (guid[2] == 0) { guid[2] = g; return; } + else if (g <= guid[2]) { if (guid[3]) guid[4] = guid[3]; guid[3] = guid[2]; guid[2] = g; return; } + if (guid[3] == 0) { guid[3] = g; return; } + else if (g <= guid[3]) { guid[4] = guid[3]; guid[3] = g; return; } + guid[4] = g; + } + void force_insert_front(const uint64& g) + { + if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g; + } + void remove(const uint64& g) + { + // avoid loops for performance + if (guid[0] == g) { if (guid[1]) guid[0] = guid[1]; else { guid[0] = 0; return; } if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; } + if (guid[1] == g) { if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; } + if (guid[2] == g) { if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; } + if (guid[3] == g) { if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; } + if (guid[4] == g) guid[4] = 0; + } + bool hasGuid(const uint64& g) const + { + return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g); + } + bool operator<(const Lfg5Guids& x) const + { + // not neat, but fast xD + if (guid[0]<=x.guid[0]) { + if (guid[0] == x.guid[0]) { + if (guid[1]<=x.guid[1]) { + if (guid[1] == x.guid[1]) { + if (guid[2]<=x.guid[2]) { + if (guid[2] == x.guid[2]) { + if (guid[3]<=x.guid[3]) { + if (guid[3] == x.guid[3]) { + if (guid[4]<=x.guid[4]) { + if (guid[4] == x.guid[4]) return false; else return true; + } else return false; + } else return true; + } else return false; + } else return true; + } else return false; + } else return true; + } else return false; + } else return true; + } else return false; + } + bool operator==(const Lfg5Guids& x) const + { + return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4]; + } + void operator=(const Lfg5Guids& x) { memcpy(guid, x.guid, 5*8); delete roles; if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; } + std::string toString() const // for debugging + { + std::ostringstream o; + o << GUID_LOPART(guid[0]) << "," << GUID_LOPART(guid[1]) << "," << GUID_LOPART(guid[2]) << "," << GUID_LOPART(guid[3]) << "," << GUID_LOPART(guid[4]) << ":" << (roles ? 1 : 0); + return o.str(); + } }; /* diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index c72eac569..2e04675e1 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -42,11 +42,11 @@ LFGMgr::LFGMgr(): m_lfgProposalId(1), m_options(sWorld->getIntConfig(CONFIG_LFG_ new LFGPlayerScript(); new LFGGroupScript(); - for (uint8 team=0; team<2; ++team) - { - m_raidBrowserUpdateTimer[team] = 10000; - m_raidBrowserLastUpdatedDungeonId[team] = 0; - } + for (uint8 team=0; team<2; ++team) + { + m_raidBrowserUpdateTimer[team] = 10000; + m_raidBrowserLastUpdatedDungeonId[team] = 0; + } } LFGMgr::~LFGMgr() @@ -155,7 +155,7 @@ void LFGMgr::LoadRewards() while (result->NextRow()); sLog->outString(">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outString(); } LFGDungeonData const* LFGMgr::GetLFGDungeon(uint32 id) @@ -267,109 +267,109 @@ void LFGMgr::Update(uint32 tdiff, uint8 task) if (!isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; - if (task == 0) - { - time_t currTime = time(NULL); + if (task == 0) + { + time_t currTime = time(NULL); - // Remove obsolete role checks - for (LfgRoleCheckContainer::iterator it = RoleChecksStore.begin(); it != RoleChecksStore.end();) - { - LfgRoleCheckContainer::iterator itRoleCheck = it++; - LfgRoleCheck& roleCheck = itRoleCheck->second; - if (currTime < roleCheck.cancelTime) - continue; - roleCheck.state = LFG_ROLECHECK_MISSING_ROLE; + // Remove obsolete role checks + for (LfgRoleCheckContainer::iterator it = RoleChecksStore.begin(); it != RoleChecksStore.end();) + { + LfgRoleCheckContainer::iterator itRoleCheck = it++; + LfgRoleCheck& roleCheck = itRoleCheck->second; + if (currTime < roleCheck.cancelTime) + continue; + roleCheck.state = LFG_ROLECHECK_MISSING_ROLE; - for (LfgRolesMap::const_iterator itRoles = roleCheck.roles.begin(); itRoles != roleCheck.roles.end(); ++itRoles) - { - uint64 guid = itRoles->first; - RestoreState(guid, "Remove Obsolete RoleCheck"); - SendLfgRoleCheckUpdate(guid, roleCheck); - if (guid == roleCheck.leader) - SendLfgJoinResult(guid, LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE)); - } + for (LfgRolesMap::const_iterator itRoles = roleCheck.roles.begin(); itRoles != roleCheck.roles.end(); ++itRoles) + { + uint64 guid = itRoles->first; + RestoreState(guid, "Remove Obsolete RoleCheck"); + SendLfgRoleCheckUpdate(guid, roleCheck); + if (guid == roleCheck.leader) + SendLfgJoinResult(guid, LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE)); + } - RestoreState(itRoleCheck->first, "Remove Obsolete RoleCheck"); - RoleChecksStore.erase(itRoleCheck); - } + RestoreState(itRoleCheck->first, "Remove Obsolete RoleCheck"); + RoleChecksStore.erase(itRoleCheck); + } - // Remove obsolete proposals - for (LfgProposalContainer::iterator it = ProposalsStore.begin(); it != ProposalsStore.end();) - { - LfgProposalContainer::iterator itRemove = it++; - if (itRemove->second.cancelTime < currTime) - RemoveProposal(itRemove, LFG_UPDATETYPE_PROPOSAL_FAILED); - } + // Remove obsolete proposals + for (LfgProposalContainer::iterator it = ProposalsStore.begin(); it != ProposalsStore.end();) + { + LfgProposalContainer::iterator itRemove = it++; + if (itRemove->second.cancelTime < currTime) + RemoveProposal(itRemove, LFG_UPDATETYPE_PROPOSAL_FAILED); + } - // Remove obsolete kicks - for (LfgPlayerBootContainer::iterator it = BootsStore.begin(); it != BootsStore.end();) - { - LfgPlayerBootContainer::iterator itBoot = it++; - LfgPlayerBoot& boot = itBoot->second; - if (boot.cancelTime < currTime) - { - boot.inProgress = false; - for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes) - { - uint64 pguid = itVotes->first; - if (pguid != boot.victim) - SendLfgBootProposalUpdate(pguid, boot); - SetState(pguid, LFG_STATE_DUNGEON); - } - SetState(itBoot->first, LFG_STATE_DUNGEON); - BootsStore.erase(itBoot); - } - } - } - else if (task == 1) - { - this->lastProposalId = m_lfgProposalId; // pussywizard: task 2 is done independantly, store previous value in LFGMgr for future use - uint8 newGroupsProcessed = 0; - // Check if a proposal can be formed with the new groups being added - for (LfgQueueContainer::iterator it = QueuesStore.begin(); it != QueuesStore.end(); ++it) - { - newGroupsProcessed += it->second.FindGroups(); - if (newGroupsProcessed) - break; - } + // Remove obsolete kicks + for (LfgPlayerBootContainer::iterator it = BootsStore.begin(); it != BootsStore.end();) + { + LfgPlayerBootContainer::iterator itBoot = it++; + LfgPlayerBoot& boot = itBoot->second; + if (boot.cancelTime < currTime) + { + boot.inProgress = false; + for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes) + { + uint64 pguid = itVotes->first; + if (pguid != boot.victim) + SendLfgBootProposalUpdate(pguid, boot); + SetState(pguid, LFG_STATE_DUNGEON); + } + SetState(itBoot->first, LFG_STATE_DUNGEON); + BootsStore.erase(itBoot); + } + } + } + else if (task == 1) + { + this->lastProposalId = m_lfgProposalId; // pussywizard: task 2 is done independantly, store previous value in LFGMgr for future use + uint8 newGroupsProcessed = 0; + // Check if a proposal can be formed with the new groups being added + for (LfgQueueContainer::iterator it = QueuesStore.begin(); it != QueuesStore.end(); ++it) + { + newGroupsProcessed += it->second.FindGroups(); + if (newGroupsProcessed) + break; + } - // Update all players status queue info - if (!newGroupsProcessed) // don't do this on updates that precessed groups (performance) - for (LfgQueueContainer::iterator it = QueuesStore.begin(); it != QueuesStore.end(); ++it) - it->second.UpdateQueueTimers(tdiff); - } - else if (task == 2) - { - if (lastProposalId != m_lfgProposalId) - { - // pussywizard: only one proposal can be created in World::Update (during maps update), and it has id == m_lfgProposalId, so try to find only that one, dunno why for loop here xD - for (LfgProposalContainer::const_iterator itProposal = ProposalsStore.find(m_lfgProposalId); itProposal != ProposalsStore.end(); ++itProposal) - { - uint32 proposalId = itProposal->first; - LfgProposal& proposal = ProposalsStore[proposalId]; + // Update all players status queue info + if (!newGroupsProcessed) // don't do this on updates that precessed groups (performance) + for (LfgQueueContainer::iterator it = QueuesStore.begin(); it != QueuesStore.end(); ++it) + it->second.UpdateQueueTimers(tdiff); + } + else if (task == 2) + { + if (lastProposalId != m_lfgProposalId) + { + // pussywizard: only one proposal can be created in World::Update (during maps update), and it has id == m_lfgProposalId, so try to find only that one, dunno why for loop here xD + for (LfgProposalContainer::const_iterator itProposal = ProposalsStore.find(m_lfgProposalId); itProposal != ProposalsStore.end(); ++itProposal) + { + uint32 proposalId = itProposal->first; + LfgProposal& proposal = ProposalsStore[proposalId]; - uint64 guid = 0; - for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers) - { - guid = itPlayers->first; - SetState(guid, LFG_STATE_PROPOSAL); - if (uint64 gguid = GetGroup(guid)) - { - SetState(gguid, LFG_STATE_PROPOSAL); - SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid))); - } - else - SendLfgUpdatePlayer(guid, LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid))); - SendLfgUpdateProposal(guid, proposal); - } + uint64 guid = 0; + for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers) + { + guid = itPlayers->first; + SetState(guid, LFG_STATE_PROPOSAL); + if (uint64 gguid = GetGroup(guid)) + { + SetState(gguid, LFG_STATE_PROPOSAL); + SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid))); + } + else + SendLfgUpdatePlayer(guid, LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid))); + SendLfgUpdateProposal(guid, proposal); + } - if (proposal.state == LFG_PROPOSAL_SUCCESS) // pussywizard: no idea what's the purpose of this xD - UpdateProposal(proposalId, guid, true); - } - } + if (proposal.state == LFG_PROPOSAL_SUCCESS) // pussywizard: no idea what's the purpose of this xD + UpdateProposal(proposalId, guid, true); + } + } - UpdateRaidBrowser(tdiff); - } + UpdateRaidBrowser(tdiff); + } } /** @@ -386,7 +386,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */) LfgDungeonSet const& dungeons = GetDungeonsByRandom(0); LfgLockMap lock; - float avgItemLevel = player->GetAverageItemLevelForDF(); + float avgItemLevel = player->GetAverageItemLevelForDF(); for (LfgDungeonSet::const_iterator it = dungeons.begin(); it != dungeons.end(); ++it) { @@ -412,7 +412,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */) { if (ar->achievement && !player->HasAchieved(ar->achievement)) lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT; - else if (ar->reqItemLevel && (float)ar->reqItemLevel > avgItemLevel) + else if (ar->reqItemLevel && (float)ar->reqItemLevel > avgItemLevel) lockData = LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE; else if (player->GetTeamId() == TEAM_ALLIANCE && ar->quest_A && !player->GetQuestRewardStatus(ar->quest_A)) lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED; @@ -464,16 +464,16 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const uint32 rDungeonId = 0; bool isContinue = grp && grp->isLFGGroup() && GetState(gguid) != LFG_STATE_FINISHED_DUNGEON; - if (grp && (grp->isBGGroup() || grp->isBFGroup())) - return; + if (grp && (grp->isBGGroup() || grp->isBFGroup())) + return; - // pussywizard: can't join LFG/LFR while using LFR - if (GetState(player->GetGUID()) == LFG_STATE_RAIDBROWSER) - { - LfgDungeonSet tmp; - SendRaidBrowserJoinedPacket(player, tmp, ""); // the df "eye" can disappear in various case, resend if needed - return; - } + // pussywizard: can't join LFG/LFR while using LFR + if (GetState(player->GetGUID()) == LFG_STATE_RAIDBROWSER) + { + LfgDungeonSet tmp; + SendRaidBrowserJoinedPacket(player, tmp, ""); // the df "eye" can disappear in various case, resend if needed + return; + } // Do not allow to change dungeon in the middle of a current dungeon if (isContinue) @@ -485,25 +485,25 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const LfgState state = GetState(gguid); switch (state) { - case LFG_STATE_ROLECHECK: // if joining again during rolecheck (eg. many players clicked continue inside instance) - if (IS_GROUP_GUID(gguid)) - UpdateRoleCheck(gguid); // abort role check and remove from RoleChecksStore - break; - case LFG_STATE_QUEUED: // joining again while in a queue - { - LFGQueue& queue = GetQueue(gguid); - queue.RemoveFromQueue(gguid); - } - break; - case LFG_STATE_PROPOSAL: // if joining again during proposal - joinData.result = LFG_JOIN_INTERNAL_ERROR; - break; - case LFG_STATE_FINISHED_DUNGEON: - if (grp && grp->isLFGGroup()) - joinData.result = LFG_JOIN_PARTY_NOT_MEET_REQS; - break; - default: - break; + case LFG_STATE_ROLECHECK: // if joining again during rolecheck (eg. many players clicked continue inside instance) + if (IS_GROUP_GUID(gguid)) + UpdateRoleCheck(gguid); // abort role check and remove from RoleChecksStore + break; + case LFG_STATE_QUEUED: // joining again while in a queue + { + LFGQueue& queue = GetQueue(gguid); + queue.RemoveFromQueue(gguid); + } + break; + case LFG_STATE_PROPOSAL: // if joining again during proposal + joinData.result = LFG_JOIN_INTERNAL_ERROR; + break; + case LFG_STATE_FINISHED_DUNGEON: + if (grp && grp->isLFGGroup()) + joinData.result = LFG_JOIN_PARTY_NOT_MEET_REQS; + break; + default: + break; } // Check if all dungeons are valid @@ -541,60 +541,60 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const } } - if (!isRaid && joinData.result == LFG_JOIN_OK) - { - // Check player or group member restrictions - if (player->InBattleground() || player->InArena() || player->InBattlegroundQueue()) - joinData.result = LFG_JOIN_USING_BG_SYSTEM; - else if (player->HasAura(LFG_SPELL_DUNGEON_DESERTER)) - joinData.result = LFG_JOIN_DESERTER; - else if (dungeons.empty()) - joinData.result = LFG_JOIN_NOT_MEET_REQS; - else if (grp) - { - if (grp->GetMembersCount() > MAXGROUPSIZE) - joinData.result = LFG_JOIN_TOO_MUCH_MEMBERS; - else - { - uint8 memberCount = 0; - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL && joinData.result == LFG_JOIN_OK; itr = itr->next()) - { - if (Player* plrg = itr->GetSource()) - { - if (plrg->HasAura(LFG_SPELL_DUNGEON_DESERTER)) - joinData.result = LFG_JOIN_PARTY_DESERTER; - else if (plrg->InBattleground() || plrg->InArena() || plrg->InBattlegroundQueue()) - joinData.result = LFG_JOIN_USING_BG_SYSTEM; - ++memberCount; - players.insert(plrg->GetGUID()); - } - } + if (!isRaid && joinData.result == LFG_JOIN_OK) + { + // Check player or group member restrictions + if (player->InBattleground() || player->InArena() || player->InBattlegroundQueue()) + joinData.result = LFG_JOIN_USING_BG_SYSTEM; + else if (player->HasAura(LFG_SPELL_DUNGEON_DESERTER)) + joinData.result = LFG_JOIN_DESERTER; + else if (dungeons.empty()) + joinData.result = LFG_JOIN_NOT_MEET_REQS; + else if (grp) + { + if (grp->GetMembersCount() > MAXGROUPSIZE) + joinData.result = LFG_JOIN_TOO_MUCH_MEMBERS; + else + { + uint8 memberCount = 0; + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL && joinData.result == LFG_JOIN_OK; itr = itr->next()) + { + if (Player* plrg = itr->GetSource()) + { + if (plrg->HasAura(LFG_SPELL_DUNGEON_DESERTER)) + joinData.result = LFG_JOIN_PARTY_DESERTER; + else if (plrg->InBattleground() || plrg->InArena() || plrg->InBattlegroundQueue()) + joinData.result = LFG_JOIN_USING_BG_SYSTEM; + ++memberCount; + players.insert(plrg->GetGUID()); + } + } - if (joinData.result == LFG_JOIN_OK && memberCount != grp->GetMembersCount()) - joinData.result = LFG_JOIN_DISCONNECTED; - } - } - else - players.insert(player->GetGUID()); + if (joinData.result == LFG_JOIN_OK && memberCount != grp->GetMembersCount()) + joinData.result = LFG_JOIN_DISCONNECTED; + } + } + else + players.insert(player->GetGUID()); - // Xinef: Check dungeon cooldown only for random dungeons - // Xinef: Moreover check this only if dungeon is not started, afterwards its obvious that players will have the cooldown - if (joinData.result == LFG_JOIN_OK && !isContinue && rDungeonId) - { - if (player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN)) // xinef: added !isContinue - joinData.result = LFG_JOIN_RANDOM_COOLDOWN; - else if (grp) - { - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL && joinData.result == LFG_JOIN_OK; itr = itr->next()) - if (Player* plrg = itr->GetSource()) - if (plrg->HasAura(LFG_SPELL_DUNGEON_COOLDOWN)) // xinef: added !isContinue - joinData.result = LFG_JOIN_PARTY_RANDOM_COOLDOWN; - } - } - } + // Xinef: Check dungeon cooldown only for random dungeons + // Xinef: Moreover check this only if dungeon is not started, afterwards its obvious that players will have the cooldown + if (joinData.result == LFG_JOIN_OK && !isContinue && rDungeonId) + { + if (player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN)) // xinef: added !isContinue + joinData.result = LFG_JOIN_RANDOM_COOLDOWN; + else if (grp) + { + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL && joinData.result == LFG_JOIN_OK; itr = itr->next()) + if (Player* plrg = itr->GetSource()) + if (plrg->HasAura(LFG_SPELL_DUNGEON_COOLDOWN)) // xinef: added !isContinue + joinData.result = LFG_JOIN_PARTY_RANDOM_COOLDOWN; + } + } + } - if (isRaid) - players.insert(player->GetGUID()); + if (isRaid) + players.insert(player->GetGUID()); if (joinData.result == LFG_JOIN_OK) { @@ -603,18 +603,18 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const dungeons = GetDungeonsByRandom(rDungeonId); // if we have lockmap then there are no compatible dungeons - // xinef: dont check compatibile dungeons for already running group (bind problems) - if (!isContinue) - { - GetCompatibleDungeons(dungeons, players, joinData.lockmap); - if (dungeons.empty()) - joinData.result = grp ? LFG_JOIN_PARTY_NOT_MEET_REQS : LFG_JOIN_NOT_MEET_REQS; - } + // xinef: dont check compatibile dungeons for already running group (bind problems) + if (!isContinue) + { + GetCompatibleDungeons(dungeons, players, joinData.lockmap); + if (dungeons.empty()) + joinData.result = grp ? LFG_JOIN_PARTY_NOT_MEET_REQS : LFG_JOIN_NOT_MEET_REQS; + } } - // pussywizard: - if (isRaid && grp && (grp->isLFGGroup() || guid != grp->GetLeaderGUID())) - return; + // pussywizard: + if (isRaid && grp && (grp->isLFGGroup() || guid != grp->GetLeaderGUID())) + return; // Can't join. Send result if (joinData.result != LFG_JOIN_OK) @@ -630,15 +630,15 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const if (isRaid) { - if (grp) - roles = PLAYER_ROLE_LEADER; - else - roles &= (PLAYER_ROLE_TANK | PLAYER_ROLE_HEALER | PLAYER_ROLE_DAMAGE); - if (!roles) - return; - JoinRaidBrowser(player, roles, dungeons, comment); - SetState(guid, LFG_STATE_RAIDBROWSER); - SendRaidBrowserJoinedPacket(player, dungeons, comment); + if (grp) + roles = PLAYER_ROLE_LEADER; + else + roles &= (PLAYER_ROLE_TANK | PLAYER_ROLE_HEALER | PLAYER_ROLE_DAMAGE); + if (!roles) + return; + JoinRaidBrowser(player, roles, dungeons, comment); + SetState(guid, LFG_STATE_RAIDBROWSER); + SendRaidBrowserJoinedPacket(player, dungeons, comment); return; } @@ -784,494 +784,494 @@ void LFGMgr::LeaveLfg(uint64 guid) SetState(guid, LFG_STATE_NONE); break; case LFG_STATE_RAIDBROWSER: - LeaveRaidBrowser(guid); - SetCanOverrideRBState(guid, true); - SetState(guid, LFG_STATE_NONE); - SetCanOverrideRBState(guid, false); - SendLfgUpdatePlayer(guid, LfgUpdateData(LFG_UPDATETYPE_LEAVE_RAIDBROWSER)); - SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_LEAVE_RAIDBROWSER)); - break; + LeaveRaidBrowser(guid); + SetCanOverrideRBState(guid, true); + SetState(guid, LFG_STATE_NONE); + SetCanOverrideRBState(guid, false); + SendLfgUpdatePlayer(guid, LfgUpdateData(LFG_UPDATETYPE_LEAVE_RAIDBROWSER)); + SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_LEAVE_RAIDBROWSER)); + break; } } void LFGMgr::JoinRaidBrowser(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string comment) { // pussywizard: client limit for comment length is 64 @ 3.3.5a - if (comment.size() > 64) - comment = comment.substr(0, 64); + if (comment.size() > 64) + comment = comment.substr(0, 64); - RBEntryInfo entry(roles, comment); - for (LfgDungeonSet::const_iterator itr = dungeons.begin(); itr != dungeons.end(); ++itr) - if (GetLFGDungeon(*itr)) // ensure dungeon data exists for such dungeon id - { - RaidBrowserStore[player->GetTeamId()][*itr][player->GetGUIDLow()] = entry; - RBUsedDungeonsStore[player->GetTeamId()].insert(*itr); - } + RBEntryInfo entry(roles, comment); + for (LfgDungeonSet::const_iterator itr = dungeons.begin(); itr != dungeons.end(); ++itr) + if (GetLFGDungeon(*itr)) // ensure dungeon data exists for such dungeon id + { + RaidBrowserStore[player->GetTeamId()][*itr][player->GetGUIDLow()] = entry; + RBUsedDungeonsStore[player->GetTeamId()].insert(*itr); + } } void LFGMgr::LeaveRaidBrowser(uint64 guid) { - uint32 guidLow = GUID_LOPART(guid); - for (uint8 team=0; team<2; ++team) - for (RBStoreMap::iterator itr = RaidBrowserStore[team].begin(); itr != RaidBrowserStore[team].end(); ++itr) - itr->second.erase(guidLow); + uint32 guidLow = GUID_LOPART(guid); + for (uint8 team=0; team<2; ++team) + for (RBStoreMap::iterator itr = RaidBrowserStore[team].begin(); itr != RaidBrowserStore[team].end(); ++itr) + itr->second.erase(guidLow); } void LFGMgr::SendRaidBrowserJoinedPacket(Player* p, LfgDungeonSet& dungeons, std::string comment) { - if (dungeons.empty()) - { - RBEntryInfoMap::iterator iter; - uint8 team = p->GetTeamId(); - bool setComment = true; - for (RBStoreMap::iterator itr = RaidBrowserStore[team].begin(); itr != RaidBrowserStore[team].end(); ++itr) - if ((iter = itr->second.find(p->GetGUIDLow())) != itr->second.end()) - { - dungeons.insert(itr->first); - if (setComment) - { - comment = iter->second.comment; - setComment = false; - } - } - } - LfgJoinResultData joinData; - p->GetSession()->SendLfgJoinResult(joinData); - LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_JOIN_RAIDBROWSER, dungeons, comment); - if (p->GetGroup()) - p->GetSession()->SendLfgUpdateParty(updateData); - else - p->GetSession()->SendLfgUpdatePlayer(updateData); + if (dungeons.empty()) + { + RBEntryInfoMap::iterator iter; + uint8 team = p->GetTeamId(); + bool setComment = true; + for (RBStoreMap::iterator itr = RaidBrowserStore[team].begin(); itr != RaidBrowserStore[team].end(); ++itr) + if ((iter = itr->second.find(p->GetGUIDLow())) != itr->second.end()) + { + dungeons.insert(itr->first); + if (setComment) + { + comment = iter->second.comment; + setComment = false; + } + } + } + LfgJoinResultData joinData; + p->GetSession()->SendLfgJoinResult(joinData); + LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_JOIN_RAIDBROWSER, dungeons, comment); + if (p->GetGroup()) + p->GetSession()->SendLfgUpdateParty(updateData); + else + p->GetSession()->SendLfgUpdatePlayer(updateData); } void LFGMgr::LfrSearchAdd(Player* p, uint32 dungeonId) { - RBSearchersStore[p->GetTeamId()][p->GetGUIDLow()] = dungeonId; + RBSearchersStore[p->GetTeamId()][p->GetGUIDLow()] = dungeonId; } void LFGMgr::LfrSearchRemove(Player* p) { - RBSearchersStore[p->GetTeamId()].erase(p->GetGUIDLow()); + RBSearchersStore[p->GetTeamId()].erase(p->GetGUIDLow()); } void LFGMgr::SendRaidBrowserCachedList(Player* player, uint32 dungeonId) { - RBCacheMap::iterator itr = RBCacheStore[player->GetTeamId()].find(dungeonId); - if (itr != RBCacheStore[player->GetTeamId()].end()) - { - player->GetSession()->SendPacket(&(itr->second)); - return; - } - // send empty packet if cache not found - WorldPacket data(SMSG_UPDATE_LFG_LIST, 1000); - data << (uint32)LFG_TYPE_RAID; - data << (uint32)dungeonId; - data << (uint8)0; - data << (uint32)0; - data << (uint32)0; - data << (uint32)0; - data << (uint32)0; - player->GetSession()->SendPacket(&data); + RBCacheMap::iterator itr = RBCacheStore[player->GetTeamId()].find(dungeonId); + if (itr != RBCacheStore[player->GetTeamId()].end()) + { + player->GetSession()->SendPacket(&(itr->second)); + return; + } + // send empty packet if cache not found + WorldPacket data(SMSG_UPDATE_LFG_LIST, 1000); + data << (uint32)LFG_TYPE_RAID; + data << (uint32)dungeonId; + data << (uint8)0; + data << (uint32)0; + data << (uint32)0; + data << (uint32)0; + data << (uint32)0; + player->GetSession()->SendPacket(&data); } void LFGMgr::UpdateRaidBrowser(uint32 diff) { - for (uint8 team=0; team<2; ++team) - { - if (m_raidBrowserUpdateTimer[team] > diff) - m_raidBrowserUpdateTimer[team] -= diff; - else - m_raidBrowserUpdateTimer[team] = 0; - } + for (uint8 team=0; team<2; ++team) + { + if (m_raidBrowserUpdateTimer[team] > diff) + m_raidBrowserUpdateTimer[team] -= diff; + else + m_raidBrowserUpdateTimer[team] = 0; + } - if (getMSTimeDiff(World::GetGameTimeMS(), getMSTime()) > (70*7)/5) // prevent lagging - return; + if (getMSTimeDiff(World::GetGameTimeMS(), getMSTime()) > (70*7)/5) // prevent lagging + return; - uint64 guid, groupGuid, instanceGuid; - uint8 level, Class, race, talents[3]; - float iLevel, mp5, mp5combat, baseAP, rangedAP; - int32 spellDamage, spellHeal; - uint32 dungeonId, encounterMask, maxPower; - uint32 deletedCounter, groupCounter, playerCounter; - ByteBuffer buffer_deleted, buffer_groups, buffer_players; - std::string emptyComment; - std::set deletedGroups, deletedGroupsToErase; - RBInternalInfoMap copy; + uint64 guid, groupGuid, instanceGuid; + uint8 level, Class, race, talents[3]; + float iLevel, mp5, mp5combat, baseAP, rangedAP; + int32 spellDamage, spellHeal; + uint32 dungeonId, encounterMask, maxPower; + uint32 deletedCounter, groupCounter, playerCounter; + ByteBuffer buffer_deleted, buffer_groups, buffer_players; + std::string emptyComment; + std::set deletedGroups, deletedGroupsToErase; + RBInternalInfoMap copy; - for (uint8 team=0; team<2; ++team) - { - if (m_raidBrowserLastUpdatedDungeonId[team] == 0) // new loop - { - if (m_raidBrowserUpdateTimer[team] > 0) // allowed only with some time interval - continue; - else // reset timer - m_raidBrowserUpdateTimer[team] = 5000; - } + for (uint8 team=0; team<2; ++team) + { + if (m_raidBrowserLastUpdatedDungeonId[team] == 0) // new loop + { + if (m_raidBrowserUpdateTimer[team] > 0) // allowed only with some time interval + continue; + else // reset timer + m_raidBrowserUpdateTimer[team] = 5000; + } - RBUsedDungeonsSet::const_iterator neitr, titr; - for (neitr = RBUsedDungeonsStore[team].begin(); neitr != RBUsedDungeonsStore[team].end(); ) - { - titr = neitr++; - dungeonId = (*titr); + RBUsedDungeonsSet::const_iterator neitr, titr; + for (neitr = RBUsedDungeonsStore[team].begin(); neitr != RBUsedDungeonsStore[team].end(); ) + { + titr = neitr++; + dungeonId = (*titr); - // go to next dungeon than previously (one dungeon updated in one LFGMgr::UpdateRaidBrowser) - if (dungeonId <= m_raidBrowserLastUpdatedDungeonId[team]) - continue; - m_raidBrowserLastUpdatedDungeonId[team] = dungeonId; + // go to next dungeon than previously (one dungeon updated in one LFGMgr::UpdateRaidBrowser) + if (dungeonId <= m_raidBrowserLastUpdatedDungeonId[team]) + continue; + m_raidBrowserLastUpdatedDungeonId[team] = dungeonId; - RBEntryInfoMap& entryInfoMap = RaidBrowserStore[team][dungeonId]; - LFGDungeonData const* dungeonData = GetLFGDungeon(dungeonId); // checked if exists before inserting to the container - RBInternalInfoMap& currInternalInfoMap = RBInternalInfoStoreCurr[team][dungeonId]; - for (RBEntryInfoMap::const_iterator sitr = entryInfoMap.begin(); sitr != entryInfoMap.end(); ++sitr) - { - guid = MAKE_NEW_GUID(sitr->first, 0, HIGHGUID_PLAYER); - groupGuid = 0; - Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); - ASSERT(p); - if (sitr->second.roles == PLAYER_ROLE_LEADER) - { - ASSERT(p->GetGroup()); - groupGuid = p->GetGroup()->GetGUID(); - } - encounterMask = 0; - instanceGuid = 0; - if (InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(sitr->first, dungeonData->map, dungeonData->difficulty)) - if (bind->perm) - { - instanceGuid = MAKE_NEW_GUID(bind->save->GetInstanceId(), 0, HIGHGUID_INSTANCE); - encounterMask = bind->save->GetCompletedEncounterMask(); - } + RBEntryInfoMap& entryInfoMap = RaidBrowserStore[team][dungeonId]; + LFGDungeonData const* dungeonData = GetLFGDungeon(dungeonId); // checked if exists before inserting to the container + RBInternalInfoMap& currInternalInfoMap = RBInternalInfoStoreCurr[team][dungeonId]; + for (RBEntryInfoMap::const_iterator sitr = entryInfoMap.begin(); sitr != entryInfoMap.end(); ++sitr) + { + guid = MAKE_NEW_GUID(sitr->first, 0, HIGHGUID_PLAYER); + groupGuid = 0; + Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); + ASSERT(p); + if (sitr->second.roles == PLAYER_ROLE_LEADER) + { + ASSERT(p->GetGroup()); + groupGuid = p->GetGroup()->GetGUID(); + } + encounterMask = 0; + instanceGuid = 0; + if (InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(sitr->first, dungeonData->map, dungeonData->difficulty)) + if (bind->perm) + { + instanceGuid = MAKE_NEW_GUID(bind->save->GetInstanceId(), 0, HIGHGUID_INSTANCE); + encounterMask = bind->save->GetCompletedEncounterMask(); + } - talents[0] = 0; - talents[1] = 0; - talents[2] = 0; - p->GetTalentTreePoints(talents); - spellDamage = p->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_ALL); - spellHeal = p->SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL); - mp5 = p->GetFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER); - mp5combat = p->GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER); - baseAP = p->GetTotalAttackPowerValue(BASE_ATTACK); - rangedAP = p->GetTotalAttackPowerValue(RANGED_ATTACK); - maxPower = 0; - if (p->getClass() == CLASS_DRUID) - maxPower = p->GetMaxPower(POWER_MANA); - else - maxPower = (p->getPowerType() == POWER_RAGE || p->getPowerType() == POWER_RUNIC_POWER) ? p->GetMaxPower(p->getPowerType())/10 : p->GetMaxPower(p->getPowerType()); + talents[0] = 0; + talents[1] = 0; + talents[2] = 0; + p->GetTalentTreePoints(talents); + spellDamage = p->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_ALL); + spellHeal = p->SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL); + mp5 = p->GetFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER); + mp5combat = p->GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER); + baseAP = p->GetTotalAttackPowerValue(BASE_ATTACK); + rangedAP = p->GetTotalAttackPowerValue(RANGED_ATTACK); + maxPower = 0; + if (p->getClass() == CLASS_DRUID) + maxPower = p->GetMaxPower(POWER_MANA); + else + maxPower = (p->getPowerType() == POWER_RAGE || p->getPowerType() == POWER_RUNIC_POWER) ? p->GetMaxPower(p->getPowerType())/10 : p->GetMaxPower(p->getPowerType()); - currInternalInfoMap[sitr->first] = RBInternalInfo(guid, sitr->second.comment, groupGuid != 0, groupGuid, sitr->second.roles, encounterMask, instanceGuid, - 1, p->getLevel(), p->getClass(), p->getRace(), p->GetAverageItemLevel(), - talents, p->m_last_area_id, p->GetArmor(), (uint32)std::max(0, spellDamage), (uint32)std::max(0, spellHeal), - p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_MELEE), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_RANGED), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_SPELL), std::max(0.0f, mp5), std::max(0.0f, mp5combat), - std::max(baseAP, rangedAP), (uint32)p->GetStat(STAT_AGILITY), p->GetMaxHealth(), maxPower, p->GetDefenseSkillValue(), - p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_DODGE), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_BLOCK), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_PARRY), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_HASTE_SPELL), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_EXPERTISE)); + currInternalInfoMap[sitr->first] = RBInternalInfo(guid, sitr->second.comment, groupGuid != 0, groupGuid, sitr->second.roles, encounterMask, instanceGuid, + 1, p->getLevel(), p->getClass(), p->getRace(), p->GetAverageItemLevel(), + talents, p->m_last_area_id, p->GetArmor(), (uint32)std::max(0, spellDamage), (uint32)std::max(0, spellHeal), + p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_MELEE), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_RANGED), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_CRIT_SPELL), std::max(0.0f, mp5), std::max(0.0f, mp5combat), + std::max(baseAP, rangedAP), (uint32)p->GetStat(STAT_AGILITY), p->GetMaxHealth(), maxPower, p->GetDefenseSkillValue(), + p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_DODGE), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_BLOCK), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_PARRY), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_HASTE_SPELL), p->GetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_EXPERTISE)); - if (!groupGuid) - continue; - for (Group::member_citerator mitr = p->GetGroup()->GetMemberSlots().begin(); mitr != p->GetGroup()->GetMemberSlots().end(); ++mitr) - { - if (mitr->guid == sitr->first) // leader already added - continue; - guid = MAKE_NEW_GUID(mitr->guid, 0, HIGHGUID_PLAYER); - level = 1; - Class = 0; - race = 0; - iLevel = 0.0f; - talents[0] = 0; - talents[1] = 0; - talents[2] = 0; - if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(mitr->guid)) - { - level = gpd->level; - Class = gpd->playerClass; - race = gpd->race; - } - Player* mplr = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); - if (mplr) - { - iLevel = mplr->GetAverageItemLevel(); - mplr->GetTalentTreePoints(talents); - } - currInternalInfoMap[mitr->guid] = RBInternalInfo(guid, emptyComment, false, groupGuid, 0, 0, 0, - (mplr ? 1 : 0), level, Class, race, iLevel, - talents, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0); - } - } + if (!groupGuid) + continue; + for (Group::member_citerator mitr = p->GetGroup()->GetMemberSlots().begin(); mitr != p->GetGroup()->GetMemberSlots().end(); ++mitr) + { + if (mitr->guid == sitr->first) // leader already added + continue; + guid = MAKE_NEW_GUID(mitr->guid, 0, HIGHGUID_PLAYER); + level = 1; + Class = 0; + race = 0; + iLevel = 0.0f; + talents[0] = 0; + talents[1] = 0; + talents[2] = 0; + if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(mitr->guid)) + { + level = gpd->level; + Class = gpd->playerClass; + race = gpd->race; + } + Player* mplr = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); + if (mplr) + { + iLevel = mplr->GetAverageItemLevel(); + mplr->GetTalentTreePoints(talents); + } + currInternalInfoMap[mitr->guid] = RBInternalInfo(guid, emptyComment, false, groupGuid, 0, 0, 0, + (mplr ? 1 : 0), level, Class, race, iLevel, + talents, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0); + } + } - copy.clear(); - copy = currInternalInfoMap; // will be saved as prev at the end + copy.clear(); + copy = currInternalInfoMap; // will be saved as prev at the end - // compare prev with curr to build difference packet - deletedCounter = 0; groupCounter = 0; playerCounter = 0; - buffer_deleted.clear(); buffer_groups.clear(); buffer_players.clear(); - deletedGroups.clear(); deletedGroupsToErase.clear(); + // compare prev with curr to build difference packet + deletedCounter = 0; groupCounter = 0; playerCounter = 0; + buffer_deleted.clear(); buffer_groups.clear(); buffer_players.clear(); + deletedGroups.clear(); deletedGroupsToErase.clear(); - RBInternalInfoMap& prevInternalInfoMap = RBInternalInfoStorePrev[team][dungeonId]; - RBInternalInfoMap::iterator iter, iterTmp; - for (RBInternalInfoMap::const_iterator sitr = prevInternalInfoMap.begin(); sitr != prevInternalInfoMap.end(); ++sitr) - { - iter = currInternalInfoMap.find(sitr->first); - if (iter == currInternalInfoMap.end()) // was -> isn't - { - if (sitr->second.isGroupLeader) - deletedGroups.insert(sitr->second.groupGuid); - ++deletedCounter; - buffer_deleted << (uint64)sitr->second.guid; - } - else // was -> is - { - if (sitr->second.isGroupLeader) // was a leader - { - if (!iter->second.isGroupLeader) // leader -> no longer a leader - deletedGroups.insert(sitr->second.groupGuid); - else if (sitr->second.groupGuid != iter->second.groupGuid) // leader -> leader of another group - { - deletedGroups.insert(sitr->second.groupGuid); - deletedGroupsToErase.insert(iter->second.groupGuid); - ++groupCounter; - RBPacketAppendGroup(iter->second, buffer_groups); - } - else if (sitr->second.comment != iter->second.comment || sitr->second.encounterMask != iter->second.encounterMask || sitr->second.instanceGuid != iter->second.instanceGuid) // leader -> nothing changed - { - ++groupCounter; - RBPacketAppendGroup(iter->second, buffer_groups); - } - } - else if (iter->second.isGroupLeader) // wasn't a leader -> is a leader - { - deletedGroupsToErase.insert(iter->second.groupGuid); - ++groupCounter; - RBPacketAppendGroup(iter->second, buffer_groups); - } + RBInternalInfoMap& prevInternalInfoMap = RBInternalInfoStorePrev[team][dungeonId]; + RBInternalInfoMap::iterator iter, iterTmp; + for (RBInternalInfoMap::const_iterator sitr = prevInternalInfoMap.begin(); sitr != prevInternalInfoMap.end(); ++sitr) + { + iter = currInternalInfoMap.find(sitr->first); + if (iter == currInternalInfoMap.end()) // was -> isn't + { + if (sitr->second.isGroupLeader) + deletedGroups.insert(sitr->second.groupGuid); + ++deletedCounter; + buffer_deleted << (uint64)sitr->second.guid; + } + else // was -> is + { + if (sitr->second.isGroupLeader) // was a leader + { + if (!iter->second.isGroupLeader) // leader -> no longer a leader + deletedGroups.insert(sitr->second.groupGuid); + else if (sitr->second.groupGuid != iter->second.groupGuid) // leader -> leader of another group + { + deletedGroups.insert(sitr->second.groupGuid); + deletedGroupsToErase.insert(iter->second.groupGuid); + ++groupCounter; + RBPacketAppendGroup(iter->second, buffer_groups); + } + else if (sitr->second.comment != iter->second.comment || sitr->second.encounterMask != iter->second.encounterMask || sitr->second.instanceGuid != iter->second.instanceGuid) // leader -> nothing changed + { + ++groupCounter; + RBPacketAppendGroup(iter->second, buffer_groups); + } + } + else if (iter->second.isGroupLeader) // wasn't a leader -> is a leader + { + deletedGroupsToErase.insert(iter->second.groupGuid); + ++groupCounter; + RBPacketAppendGroup(iter->second, buffer_groups); + } - if (!iter->second._online) // if offline, copy previous stats (itemLevel, talents, area, etc.) - { - iterTmp = copy.find(sitr->first); // copied container is for building a full packet, so modify it there (currInternalInfoMap is erased) - iterTmp->second.CopyStats(sitr->second); - if (!sitr->second.PlayerSameAs(iterTmp->second)) // player info changed - { - ++playerCounter; - RBPacketAppendPlayer(iterTmp->second, buffer_players); - } - } - else if (!sitr->second.PlayerSameAs(iter->second)) // player info changed - { - ++playerCounter; - RBPacketAppendPlayer(iter->second, buffer_players); - } - currInternalInfoMap.erase(iter); - } - } - // left entries (new) - for (RBInternalInfoMap::const_iterator sitr = currInternalInfoMap.begin(); sitr != currInternalInfoMap.end(); ++sitr) - { - if (sitr->second.isGroupLeader) - { - deletedGroupsToErase.insert(sitr->second.groupGuid); - ++groupCounter; - RBPacketAppendGroup(sitr->second, buffer_groups); - } - ++playerCounter; - RBPacketAppendPlayer(sitr->second, buffer_players); - } + if (!iter->second._online) // if offline, copy previous stats (itemLevel, talents, area, etc.) + { + iterTmp = copy.find(sitr->first); // copied container is for building a full packet, so modify it there (currInternalInfoMap is erased) + iterTmp->second.CopyStats(sitr->second); + if (!sitr->second.PlayerSameAs(iterTmp->second)) // player info changed + { + ++playerCounter; + RBPacketAppendPlayer(iterTmp->second, buffer_players); + } + } + else if (!sitr->second.PlayerSameAs(iter->second)) // player info changed + { + ++playerCounter; + RBPacketAppendPlayer(iter->second, buffer_players); + } + currInternalInfoMap.erase(iter); + } + } + // left entries (new) + for (RBInternalInfoMap::const_iterator sitr = currInternalInfoMap.begin(); sitr != currInternalInfoMap.end(); ++sitr) + { + if (sitr->second.isGroupLeader) + { + deletedGroupsToErase.insert(sitr->second.groupGuid); + ++groupCounter; + RBPacketAppendGroup(sitr->second, buffer_groups); + } + ++playerCounter; + RBPacketAppendPlayer(sitr->second, buffer_players); + } - if (!deletedGroupsToErase.empty()) - for (std::set::const_iterator sitr = deletedGroupsToErase.begin(); sitr != deletedGroupsToErase.end(); ++sitr) - deletedGroups.erase(*sitr); + if (!deletedGroupsToErase.empty()) + for (std::set::const_iterator sitr = deletedGroupsToErase.begin(); sitr != deletedGroupsToErase.end(); ++sitr) + deletedGroups.erase(*sitr); - if (!deletedGroups.empty()) - for (std::set::const_iterator sitr = deletedGroups.begin(); sitr != deletedGroups.end(); ++sitr) - { - ++deletedCounter; - buffer_deleted << (*sitr); - } + if (!deletedGroups.empty()) + for (std::set::const_iterator sitr = deletedGroups.begin(); sitr != deletedGroups.end(); ++sitr) + { + ++deletedCounter; + buffer_deleted << (*sitr); + } - WorldPacket differencePacket(SMSG_UPDATE_LFG_LIST, 1000); - RBPacketBuildDifference(differencePacket, dungeonId, deletedCounter, buffer_deleted, groupCounter, buffer_groups, playerCounter, buffer_players); - WorldPacket fullPacket(SMSG_UPDATE_LFG_LIST, 1000); - RBPacketBuildFull(fullPacket, dungeonId, copy); + WorldPacket differencePacket(SMSG_UPDATE_LFG_LIST, 1000); + RBPacketBuildDifference(differencePacket, dungeonId, deletedCounter, buffer_deleted, groupCounter, buffer_groups, playerCounter, buffer_players); + WorldPacket fullPacket(SMSG_UPDATE_LFG_LIST, 1000); + RBPacketBuildFull(fullPacket, dungeonId, copy); - RBCacheStore[team][dungeonId] = fullPacket; - prevInternalInfoMap = copy; - currInternalInfoMap.clear(); + RBCacheStore[team][dungeonId] = fullPacket; + prevInternalInfoMap = copy; + currInternalInfoMap.clear(); - if (entryInfoMap.empty()) - RBUsedDungeonsStore[team].erase(titr); + if (entryInfoMap.empty()) + RBUsedDungeonsStore[team].erase(titr); - // send difference packet to browsing players - for (RBSearchersMap::const_iterator sitr = RBSearchersStore[team].begin(); sitr != RBSearchersStore[team].end(); ++sitr) - if (sitr->second == dungeonId) - if (Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(MAKE_NEW_GUID(sitr->first, 0, HIGHGUID_PLAYER))) - p->GetSession()->SendPacket(&differencePacket); + // send difference packet to browsing players + for (RBSearchersMap::const_iterator sitr = RBSearchersStore[team].begin(); sitr != RBSearchersStore[team].end(); ++sitr) + if (sitr->second == dungeonId) + if (Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(MAKE_NEW_GUID(sitr->first, 0, HIGHGUID_PLAYER))) + p->GetSession()->SendPacket(&differencePacket); - break; // one dungeon updated in one LFGMgr::UpdateRaidBrowser - } + break; // one dungeon updated in one LFGMgr::UpdateRaidBrowser + } - // already updated all in this time interval - if (neitr == RBUsedDungeonsStore[team].end()) - m_raidBrowserLastUpdatedDungeonId[team] = 0; - } + // already updated all in this time interval + if (neitr == RBUsedDungeonsStore[team].end()) + m_raidBrowserLastUpdatedDungeonId[team] = 0; + } } void LFGMgr::RBPacketAppendGroup(const RBInternalInfo& info, ByteBuffer& buffer) { - buffer << (uint64)info.groupGuid; - uint32 flags = LFG_UPDATE_FLAG_COMMENT | LFG_UPDATE_FLAG_ROLES | LFG_UPDATE_FLAG_BINDED; - buffer << (uint32)flags; - if (flags & LFG_UPDATE_FLAG_COMMENT) - buffer << info.comment; - if (flags & LFG_UPDATE_FLAG_ROLES) - for (uint8 j=0; j<3; ++j) - buffer << (uint8)0; - if (!(flags & LFG_UPDATE_FLAG_BINDED)) - return; - buffer << (uint64)info.instanceGuid; - buffer << (uint32)info.encounterMask; + buffer << (uint64)info.groupGuid; + uint32 flags = LFG_UPDATE_FLAG_COMMENT | LFG_UPDATE_FLAG_ROLES | LFG_UPDATE_FLAG_BINDED; + buffer << (uint32)flags; + if (flags & LFG_UPDATE_FLAG_COMMENT) + buffer << info.comment; + if (flags & LFG_UPDATE_FLAG_ROLES) + for (uint8 j=0; j<3; ++j) + buffer << (uint8)0; + if (!(flags & LFG_UPDATE_FLAG_BINDED)) + return; + buffer << (uint64)info.instanceGuid; + buffer << (uint32)info.encounterMask; } void LFGMgr::RBPacketAppendPlayer(const RBInternalInfo& info, ByteBuffer& buffer) { - buffer << (uint64)info.guid; - uint32 flags = LFG_UPDATE_FLAG_CHARACTERINFO | LFG_UPDATE_FLAG_ROLES | LFG_UPDATE_FLAG_COMMENT | (info.groupGuid ? LFG_UPDATE_FLAG_GROUPGUID : LFG_UPDATE_FLAG_BINDED) | (info.isGroupLeader ? LFG_UPDATE_FLAG_GROUPLEADER : 0) | (!info.groupGuid || info.isGroupLeader ? LFG_UPDATE_FLAG_AREA : 0); - buffer << (uint32)flags; + buffer << (uint64)info.guid; + uint32 flags = LFG_UPDATE_FLAG_CHARACTERINFO | LFG_UPDATE_FLAG_ROLES | LFG_UPDATE_FLAG_COMMENT | (info.groupGuid ? LFG_UPDATE_FLAG_GROUPGUID : LFG_UPDATE_FLAG_BINDED) | (info.isGroupLeader ? LFG_UPDATE_FLAG_GROUPLEADER : 0) | (!info.groupGuid || info.isGroupLeader ? LFG_UPDATE_FLAG_AREA : 0); + buffer << (uint32)flags; - if (flags & LFG_UPDATE_FLAG_CHARACTERINFO) - { - buffer << (uint8)info._level; - buffer << (uint8)info._class; - buffer << (uint8)info._race; - buffer << (uint8)info._talents0; - buffer << (uint8)info._talents1; - buffer << (uint8)info._talents2; - buffer << (uint32)info._armor; - buffer << (uint32)info._spellDamage; - buffer << (uint32)info._spellHeal; - buffer << (uint32)info._critRatingMelee; - buffer << (uint32)info._critRatingRanged; - buffer << (uint32)info._critRatingSpell; - buffer << (float)info._mp5; - buffer << (float)info._mp5combat; - buffer << (uint32)info._attackPower; - buffer << (uint32)info._agility; - buffer << (uint32)info._health; - buffer << (uint32)info._mana; - buffer << (uint32)info._online; // talentpoints, used as online/offline marker :D - buffer << (float)info._avgItemLevel; // avgitemlevel - buffer << (uint32)info._defenseSkill; - buffer << (uint32)info._dodgeRating; - buffer << (uint32)info._blockRating; - buffer << (uint32)info._parryRating; - buffer << (uint32)info._hasteRating; - buffer << (uint32)info._expertiseRating; - } + if (flags & LFG_UPDATE_FLAG_CHARACTERINFO) + { + buffer << (uint8)info._level; + buffer << (uint8)info._class; + buffer << (uint8)info._race; + buffer << (uint8)info._talents0; + buffer << (uint8)info._talents1; + buffer << (uint8)info._talents2; + buffer << (uint32)info._armor; + buffer << (uint32)info._spellDamage; + buffer << (uint32)info._spellHeal; + buffer << (uint32)info._critRatingMelee; + buffer << (uint32)info._critRatingRanged; + buffer << (uint32)info._critRatingSpell; + buffer << (float)info._mp5; + buffer << (float)info._mp5combat; + buffer << (uint32)info._attackPower; + buffer << (uint32)info._agility; + buffer << (uint32)info._health; + buffer << (uint32)info._mana; + buffer << (uint32)info._online; // talentpoints, used as online/offline marker :D + buffer << (float)info._avgItemLevel; // avgitemlevel + buffer << (uint32)info._defenseSkill; + buffer << (uint32)info._dodgeRating; + buffer << (uint32)info._blockRating; + buffer << (uint32)info._parryRating; + buffer << (uint32)info._hasteRating; + buffer << (uint32)info._expertiseRating; + } - if (flags & LFG_UPDATE_FLAG_COMMENT) - buffer << (info.groupGuid ? std::string("") : info.comment); - if (flags & LFG_UPDATE_FLAG_GROUPLEADER) - buffer << (uint8)1; // isLFM - if (flags & LFG_UPDATE_FLAG_GROUPGUID) - buffer << (uint64)info.groupGuid; - if (flags & LFG_UPDATE_FLAG_ROLES) - buffer << (uint8)(info.groupGuid ? (info.isGroupLeader ? PLAYER_ROLE_LEADER : 0) : info.roles); - if (flags & LFG_UPDATE_FLAG_AREA) - buffer << (uint32)info._area; - if (flags & LFG_UPDATE_FLAG_STATUS) - buffer << (uint8)0; - if (!(flags & LFG_UPDATE_FLAG_BINDED)) - return; - buffer << (uint64)info.instanceGuid; - buffer << (uint32)info.encounterMask; + if (flags & LFG_UPDATE_FLAG_COMMENT) + buffer << (info.groupGuid ? std::string("") : info.comment); + if (flags & LFG_UPDATE_FLAG_GROUPLEADER) + buffer << (uint8)1; // isLFM + if (flags & LFG_UPDATE_FLAG_GROUPGUID) + buffer << (uint64)info.groupGuid; + if (flags & LFG_UPDATE_FLAG_ROLES) + buffer << (uint8)(info.groupGuid ? (info.isGroupLeader ? PLAYER_ROLE_LEADER : 0) : info.roles); + if (flags & LFG_UPDATE_FLAG_AREA) + buffer << (uint32)info._area; + if (flags & LFG_UPDATE_FLAG_STATUS) + buffer << (uint8)0; + if (!(flags & LFG_UPDATE_FLAG_BINDED)) + return; + buffer << (uint64)info.instanceGuid; + buffer << (uint32)info.encounterMask; } void LFGMgr::RBPacketBuildDifference(WorldPacket& differencePacket, uint32 dungeonId, uint32 deletedCounter, ByteBuffer& buffer_deleted, uint32 groupCounter, ByteBuffer& buffer_groups, uint32 playerCounter, ByteBuffer& buffer_players) { - differencePacket << (uint32)LFG_TYPE_RAID; - differencePacket << (uint32)dungeonId; - differencePacket << (uint8)1; - differencePacket << (uint32)deletedCounter; - differencePacket.append(buffer_deleted); - differencePacket << (uint32)groupCounter; - differencePacket << (uint32)0; - differencePacket.append(buffer_groups); - differencePacket << (uint32)playerCounter; - differencePacket << (uint32)0; - differencePacket.append(buffer_players); + differencePacket << (uint32)LFG_TYPE_RAID; + differencePacket << (uint32)dungeonId; + differencePacket << (uint8)1; + differencePacket << (uint32)deletedCounter; + differencePacket.append(buffer_deleted); + differencePacket << (uint32)groupCounter; + differencePacket << (uint32)0; + differencePacket.append(buffer_groups); + differencePacket << (uint32)playerCounter; + differencePacket << (uint32)0; + differencePacket.append(buffer_players); } void LFGMgr::RBPacketBuildFull(WorldPacket& fullPacket, uint32 dungeonId, RBInternalInfoMap& infoMap) { - fullPacket << (uint32)LFG_TYPE_RAID; - fullPacket << (uint32)dungeonId; - fullPacket << (uint8)0; - uint32 groupCounter = 0, playerCounter = 0; - ByteBuffer buffer_groups, buffer_players; - for (RBInternalInfoMap::const_iterator itr = infoMap.begin(); itr != infoMap.end(); ++itr) - { - if (itr->second.isGroupLeader) - { - ++groupCounter; - RBPacketAppendGroup(itr->second, buffer_groups); - } - ++playerCounter; - RBPacketAppendPlayer(itr->second, buffer_players); - } - fullPacket << (uint32)groupCounter; - fullPacket << (uint32)0; - fullPacket.append(buffer_groups); - fullPacket << (uint32)playerCounter; - fullPacket << (uint32)0; - fullPacket.append(buffer_players); + fullPacket << (uint32)LFG_TYPE_RAID; + fullPacket << (uint32)dungeonId; + fullPacket << (uint8)0; + uint32 groupCounter = 0, playerCounter = 0; + ByteBuffer buffer_groups, buffer_players; + for (RBInternalInfoMap::const_iterator itr = infoMap.begin(); itr != infoMap.end(); ++itr) + { + if (itr->second.isGroupLeader) + { + ++groupCounter; + RBPacketAppendGroup(itr->second, buffer_groups); + } + ++playerCounter; + RBPacketAppendPlayer(itr->second, buffer_players); + } + fullPacket << (uint32)groupCounter; + fullPacket << (uint32)0; + fullPacket.append(buffer_groups); + fullPacket << (uint32)playerCounter; + fullPacket << (uint32)0; + fullPacket.append(buffer_players); } // pussywizard: void LFGMgr::LeaveAllLfgQueues(uint64 guid, bool allowgroup, uint64 groupguid) { - uint64 pguid = 0, gguid = 0; - if (IS_GROUP_GUID(guid)) - gguid = guid; - else if (groupguid && IS_GROUP_GUID(groupguid)) - { - pguid = guid; - gguid = groupguid; - } - else - { - pguid = guid; - gguid = GetGroup(guid); - } - if (!allowgroup) - gguid = 0; + uint64 pguid = 0, gguid = 0; + if (IS_GROUP_GUID(guid)) + gguid = guid; + else if (groupguid && IS_GROUP_GUID(groupguid)) + { + pguid = guid; + gguid = groupguid; + } + else + { + pguid = guid; + gguid = GetGroup(guid); + } + if (!allowgroup) + gguid = 0; - if (pguid) - for (lfg::LfgQueueContainer::iterator itr = QueuesStore.begin(); itr != QueuesStore.end(); ++itr) - itr->second.RemoveFromQueue(pguid); - if (gguid) - for (lfg::LfgQueueContainer::iterator itr = QueuesStore.begin(); itr != QueuesStore.end(); ++itr) - itr->second.RemoveFromQueue(gguid); + if (pguid) + for (lfg::LfgQueueContainer::iterator itr = QueuesStore.begin(); itr != QueuesStore.end(); ++itr) + itr->second.RemoveFromQueue(pguid); + if (gguid) + for (lfg::LfgQueueContainer::iterator itr = QueuesStore.begin(); itr != QueuesStore.end(); ++itr) + itr->second.RemoveFromQueue(gguid); - if (pguid && !gguid) - { - if (GetState(pguid) == LFG_STATE_QUEUED) - { - SendLfgUpdatePlayer(pguid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE)); - SetState(pguid, LFG_STATE_NONE); - } - } - if (gguid) - { - if (GetState(gguid) == LFG_STATE_QUEUED) - { - SetState(gguid, LFG_STATE_NONE); - const LfgGuidSet& players = GetPlayers(gguid); - for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) - { - SetState(*it, LFG_STATE_NONE); - SendLfgUpdateParty(*it, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE)); - } - } - } + if (pguid && !gguid) + { + if (GetState(pguid) == LFG_STATE_QUEUED) + { + SendLfgUpdatePlayer(pguid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE)); + SetState(pguid, LFG_STATE_NONE); + } + } + if (gguid) + { + if (GetState(gguid) == LFG_STATE_QUEUED) + { + SetState(gguid, LFG_STATE_NONE); + const LfgGuidSet& players = GetPlayers(gguid); + for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) + { + SetState(*it, LFG_STATE_NONE); + SendLfgUpdateParty(*it, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE)); + } + } + } } /** @@ -1336,7 +1336,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* continue; case LFG_ROLECHECK_FINISHED: SetState(pguid, LFG_STATE_QUEUED); - SetRoles(pguid, it->second); + SetRoles(pguid, it->second); SendLfgUpdateParty(pguid, LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, GetComment(pguid))); break; default: @@ -1504,16 +1504,16 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) oldGroupGUID = group->GetGUID(); } - // Xinef: Store amount of random players player grouped with + // Xinef: Store amount of random players player grouped with if (group) { - SetRandomPlayersCount(pguid, group->GetMembersCount() >= MAXGROUPSIZE ? 0 : MAXGROUPSIZE-group->GetMembersCount()); + SetRandomPlayersCount(pguid, group->GetMembersCount() >= MAXGROUPSIZE ? 0 : MAXGROUPSIZE-group->GetMembersCount()); oldGroupGUID = group->GetGUID(); if (group != grp) group->RemoveMember(player->GetGUID()); } - else - SetRandomPlayersCount(pguid, MAXGROUPSIZE-1); + else + SetRandomPlayersCount(pguid, MAXGROUPSIZE-1); if (!grp) { @@ -1525,20 +1525,20 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) sGroupMgr->AddGroup(grp); } else if (group != grp) - { - // pussywizard: - if (!grp->IsFull()) - grp->AddMember(player); - //else // some cleanup? LeaveLFG? - // ; - } + { + // pussywizard: + if (!grp->IsFull()) + grp->AddMember(player); + //else // some cleanup? LeaveLFG? + // ; + } grp->SetLfgRoles(pguid, proposal.players.find(pguid)->second.role); } - // pussywizard: crashfix, group wasn't created when iterating players (no player found by guid), proposal is deleted by the calling function - if (!grp) - return; + // pussywizard: crashfix, group wasn't created when iterating players (no player found by guid), proposal is deleted by the calling function + if (!grp) + return; grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty)); uint64 gguid = grp->GetGUID(); @@ -1547,27 +1547,27 @@ void LFGMgr::MakeNewGroup(LfgProposal const& proposal) _SaveToDB(gguid); - bool randomDungeon = false; + bool randomDungeon = false; // Teleport Player for (LfgGuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it) if (Player* player = ObjectAccessor::FindPlayer(*it)) - { - if (player->GetGroup() != grp) // pussywizard: could not add because group was full (some shitness happened) - continue; - // Add the cooldown spell if queued for a random dungeon - // xinef: add aura - if ((randomDungeon || selectedRandomLfgDungeon(player->GetGUID())) && !player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN)) - { - randomDungeon = true; - player->AddAura(LFG_SPELL_DUNGEON_COOLDOWN, player); - } + { + if (player->GetGroup() != grp) // pussywizard: could not add because group was full (some shitness happened) + continue; + // Add the cooldown spell if queued for a random dungeon + // xinef: add aura + if ((randomDungeon || selectedRandomLfgDungeon(player->GetGUID())) && !player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN)) + { + randomDungeon = true; + player->AddAura(LFG_SPELL_DUNGEON_COOLDOWN, player); + } TeleportPlayer(player, false); - } + } - if (randomDungeon) - grp->AddLfgRandomInstanceFlag(); - if (Difficulty(dungeon->difficulty) == DUNGEON_DIFFICULTY_HEROIC) - grp->AddLfgHeroicFlag(); + if (randomDungeon) + grp->AddLfgRandomInstanceFlag(); + if (Difficulty(dungeon->difficulty) == DUNGEON_DIFFICULTY_HEROIC) + grp->AddLfgHeroicFlag(); // Update group info grp->SendUpdate(); @@ -1677,8 +1677,8 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) } // Remove players/groups from Queue - for (uint8 i=0; i<5 && proposal.queues.guid[i]; ++i) - queue.RemoveQueueData(proposal.queues.guid[i]); + for (uint8 i=0; i<5 && proposal.queues.guid[i]; ++i) + queue.RemoveQueueData(proposal.queues.guid[i]); MakeNewGroup(proposal); ProposalsStore.erase(itProposal); @@ -1702,12 +1702,12 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate if (it->second.accept == LFG_ANSWER_PENDING) it->second.accept = LFG_ANSWER_DENY; - // pussywizard: add cooldown for not accepting (after 40 secs) or declining - for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) - if (it->second.accept == LFG_ANSWER_DENY) - if (Player* plr = sObjectAccessor->FindPlayer(it->first)) - if (Aura* aura = plr->AddAura(LFG_SPELL_DUNGEON_COOLDOWN, plr)) - aura->SetDuration(150*IN_MILLISECONDS); + // pussywizard: add cooldown for not accepting (after 40 secs) or declining + for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) + if (it->second.accept == LFG_ANSWER_DENY) + if (Player* plr = sObjectAccessor->FindPlayer(it->first)) + if (Aura* aura = plr->AddAura(LFG_SPELL_DUNGEON_COOLDOWN, plr)) + aura->SetDuration(150*IN_MILLISECONDS); // Mark players/groups to be removed LfgGuidSet toRemove; @@ -1780,11 +1780,11 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate } // Readd to queue - for (uint8 i=0; i<5 && proposal.queues.guid[i]; ++i) + for (uint8 i=0; i<5 && proposal.queues.guid[i]; ++i) { - // xinef: this will work as data is not deleted, only references to this data are cleared - // xinef: when new proposal is created - // xinef: successful proposal is also taken into account is similar manner + // xinef: this will work as data is not deleted, only references to this data are cleared + // xinef: when new proposal is created + // xinef: successful proposal is also taken into account is similar manner queue.AddToQueue(proposal.queues.guid[i], true); } @@ -1905,9 +1905,9 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* if (!dungeon) { - player->GetSession()->SendLfgTeleportError(uint8(LFG_TELEPORTERROR_INVALID_LOCATION)); + player->GetSession()->SendLfgTeleportError(uint8(LFG_TELEPORTERROR_INVALID_LOCATION)); return; - } + } if (out) { @@ -1994,7 +1994,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId, const Map* curr } SetState(gguid, LFG_STATE_FINISHED_DUNGEON); - _SaveToDB(gguid); // pussywizard + _SaveToDB(gguid); // pussywizard const LfgGuidSet& players = GetPlayers(gguid); for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it) @@ -2040,8 +2040,8 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId, const Map* curr // Xinef: Update achievements, set correct amount of randomly grouped players if (dungeon->difficulty == DUNGEON_DIFFICULTY_HEROIC) - if (uint8 count = GetRandomPlayersCount(player->GetGUID())) - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS, count); + if (uint8 count = GetRandomPlayersCount(player->GetGUID())) + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS, count); LfgReward const* reward = GetRandomDungeonReward(rDungeonId, player->getLevel()); if (!reward) @@ -2278,14 +2278,14 @@ void LFGMgr::SetComment(uint64 guid, std::string const& comment) void LFGMgr::LfrSetComment(Player* p, std::string comment) { // pussywizard: client limit for comment length is 64 @ 3.3.5a - if (comment.size() > 64) - comment = comment.substr(0, 64); + if (comment.size() > 64) + comment = comment.substr(0, 64); - uint8 teamId = p->GetTeamId(); - RBEntryInfoMap::iterator iter; - for (RBStoreMap::iterator itr = RaidBrowserStore[teamId].begin(); itr != RaidBrowserStore[teamId].end(); ++itr) - if ((iter = itr->second.find(p->GetGUIDLow())) != itr->second.end()) - iter->second.comment = comment; + uint8 teamId = p->GetTeamId(); + RBEntryInfoMap::iterator iter; + for (RBStoreMap::iterator itr = RaidBrowserStore[teamId].begin(); itr != RaidBrowserStore[teamId].end(); ++itr) + if ((iter = itr->second.find(p->GetGUIDLow())) != itr->second.end()) + iter->second.comment = comment; } void LFGMgr::SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons) @@ -2351,8 +2351,8 @@ void LFGMgr::SetLeader(uint64 gguid, uint64 leader) void LFGMgr::SetTeam(uint64 guid, TeamId teamId) { - if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP)) - teamId = TEAM_ALLIANCE; // @Not Sure About That TeamId is supposed to be uint8 Team = 0(@TrinityCore) + if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP)) + teamId = TEAM_ALLIANCE; // @Not Sure About That TeamId is supposed to be uint8 Team = 0(@TrinityCore) PlayersStore[guid].SetTeam(teamId); } @@ -2384,12 +2384,12 @@ uint64 LFGMgr::GetLeader(uint64 guid) void LFGMgr::SetRandomPlayersCount(uint64 guid, uint8 count) { - PlayersStore[guid].SetRandomPlayersCount(count); + PlayersStore[guid].SetRandomPlayersCount(count); } uint8 LFGMgr::GetRandomPlayersCount(uint64 guid) { - return PlayersStore[guid].GetRandomPlayersCount(); + return PlayersStore[guid].GetRandomPlayersCount(); } bool LFGMgr::HasIgnore(uint64 guid1, uint64 guid2) @@ -2478,9 +2478,9 @@ bool LFGMgr::AllQueued(Lfg5Guids const& check) if (check.empty()) return false; - for (uint8 i=0; i<5 && check.guid[i]; ++i) + for (uint8 i=0; i<5 && check.guid[i]; ++i) { - uint64 guid = check.guid[i]; + uint64 guid = check.guid[i]; if (GetState(guid) != LFG_STATE_QUEUED) { LFGQueue& queue = GetQueue(guid); diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 47bfb37ad..d7fe22c99 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -140,86 +140,86 @@ enum LfgUpdateFlag // pussywizard: for raid browser struct RBEntryInfo { - RBEntryInfo() {} - RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {} - uint8 roles; - std::string comment; + RBEntryInfo() {} + RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {} + uint8 roles; + std::string comment; }; struct RBInternalInfo { - uint64 guid; - std::string comment; - bool isGroupLeader; - uint64 groupGuid; - uint8 roles; - uint32 encounterMask; - uint64 instanceGuid; + uint64 guid; + std::string comment; + bool isGroupLeader; + uint64 groupGuid; + uint8 roles; + uint32 encounterMask; + uint64 instanceGuid; - // additional character info parameters: - uint8 _online; - uint8 _level; - uint8 _class; - uint8 _race; - float _avgItemLevel; - // -- - uint8 _talents0; - uint8 _talents1; - uint8 _talents2; - uint32 _area; - uint32 _armor; - uint32 _spellDamage; - uint32 _spellHeal; - // -- - uint32 _critRatingMelee; - uint32 _critRatingRanged; - uint32 _critRatingSpell; - float _mp5; - float _mp5combat; - // -- - uint32 _attackPower; - uint32 _agility; - uint32 _health; - uint32 _mana; - uint32 _defenseSkill; - // -- - uint32 _dodgeRating; - uint32 _blockRating; - uint32 _parryRating; - uint32 _hasteRating; - uint32 _expertiseRating; + // additional character info parameters: + uint8 _online; + uint8 _level; + uint8 _class; + uint8 _race; + float _avgItemLevel; + // -- + uint8 _talents0; + uint8 _talents1; + uint8 _talents2; + uint32 _area; + uint32 _armor; + uint32 _spellDamage; + uint32 _spellHeal; + // -- + uint32 _critRatingMelee; + uint32 _critRatingRanged; + uint32 _critRatingSpell; + float _mp5; + float _mp5combat; + // -- + uint32 _attackPower; + uint32 _agility; + uint32 _health; + uint32 _mana; + uint32 _defenseSkill; + // -- + uint32 _dodgeRating; + uint32 _blockRating; + uint32 _parryRating; + uint32 _hasteRating; + uint32 _expertiseRating; - RBInternalInfo() {} - RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 instanceGuid, - uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel, - uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal, - uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat, - uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill, - uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating) - : guid(guid), comment(comment), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid), - _online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel), - _talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal), - _critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat), - _attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill), - _dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating) - {} - bool PlayerSameAs(RBInternalInfo const& i) const - { - return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid)) - && _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel-i._avgItemLevel) < 0.01f - && _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal - && _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5-i._mp5) < 0.01f && fabs(_mp5combat-i._mp5combat) < 0.01f - && _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill - && _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating; - } - void CopyStats(RBInternalInfo const& i) - { - _avgItemLevel = i._avgItemLevel; - _talents0 = i._talents0; _talents1 = i._talents1; _talents2 = i._talents2; _area = i._area; _armor = i._armor; _spellDamage = i._spellDamage; _spellHeal = i._spellHeal; - _critRatingMelee = i._critRatingMelee; _critRatingRanged = i._critRatingRanged; _critRatingSpell = i._critRatingSpell; _mp5 = i._mp5; _mp5combat = i._mp5combat; - _attackPower = i._attackPower; _agility = i._agility; _health = i._health; _mana = i._mana; _defenseSkill = i._defenseSkill; - _dodgeRating = i._dodgeRating; _blockRating = i._blockRating; _parryRating = i._parryRating; _hasteRating = i._hasteRating; _expertiseRating = i._expertiseRating; - } + RBInternalInfo() {} + RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 instanceGuid, + uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel, + uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal, + uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat, + uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill, + uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating) + : guid(guid), comment(comment), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid), + _online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel), + _talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal), + _critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat), + _attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill), + _dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating) + {} + bool PlayerSameAs(RBInternalInfo const& i) const + { + return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid)) + && _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel-i._avgItemLevel) < 0.01f + && _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal + && _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5-i._mp5) < 0.01f && fabs(_mp5combat-i._mp5combat) < 0.01f + && _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill + && _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating; + } + void CopyStats(RBInternalInfo const& i) + { + _avgItemLevel = i._avgItemLevel; + _talents0 = i._talents0; _talents1 = i._talents1; _talents2 = i._talents2; _area = i._area; _armor = i._armor; _spellDamage = i._spellDamage; _spellHeal = i._spellHeal; + _critRatingMelee = i._critRatingMelee; _critRatingRanged = i._critRatingRanged; _critRatingSpell = i._critRatingSpell; _mp5 = i._mp5; _mp5combat = i._mp5combat; + _attackPower = i._attackPower; _agility = i._agility; _health = i._health; _mana = i._mana; _defenseSkill = i._defenseSkill; + _dodgeRating = i._dodgeRating; _blockRating = i._blockRating; _parryRating = i._parryRating; _hasteRating = i._hasteRating; _expertiseRating = i._expertiseRating; + } }; // Forward declaration (just to have all typedef together) @@ -395,20 +395,20 @@ class LFGMgr LFGMgr(); ~LFGMgr(); - // pussywizard: RAIDBROWSER - typedef UNORDERED_MAP RBEntryInfoMap; - typedef UNORDERED_MAP RBStoreMap; - RBStoreMap RaidBrowserStore[2]; // for 2 factions - typedef UNORDERED_MAP RBSearchersMap; - RBSearchersMap RBSearchersStore[2]; // for 2 factions - typedef UNORDERED_MAP RBCacheMap; - RBCacheMap RBCacheStore[2]; // for 2 factions - typedef UNORDERED_MAP RBInternalInfoMap; - typedef UNORDERED_MAP RBInternalInfoMapMap; - RBInternalInfoMapMap RBInternalInfoStorePrev[2]; // for 2 factions - RBInternalInfoMapMap RBInternalInfoStoreCurr[2]; // for 2 factions - typedef std::set RBUsedDungeonsSet; // needs to be ordered - RBUsedDungeonsSet RBUsedDungeonsStore[2]; // for 2 factions + // pussywizard: RAIDBROWSER + typedef UNORDERED_MAP RBEntryInfoMap; + typedef UNORDERED_MAP RBStoreMap; + RBStoreMap RaidBrowserStore[2]; // for 2 factions + typedef UNORDERED_MAP RBSearchersMap; + RBSearchersMap RBSearchersStore[2]; // for 2 factions + typedef UNORDERED_MAP RBCacheMap; + RBCacheMap RBCacheStore[2]; // for 2 factions + typedef UNORDERED_MAP RBInternalInfoMap; + typedef UNORDERED_MAP RBInternalInfoMapMap; + RBInternalInfoMapMap RBInternalInfoStorePrev[2]; // for 2 factions + RBInternalInfoMapMap RBInternalInfoStoreCurr[2]; // for 2 factions + typedef std::set RBUsedDungeonsSet; // needs to be ordered + RBUsedDungeonsSet RBUsedDungeonsStore[2]; // for 2 factions public: // Functions used outside lfg namespace @@ -477,10 +477,10 @@ class LFGMgr uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid); /// Adds player to group void AddPlayerToGroup(uint64 gguid, uint64 guid); - /// Xinef: Set Random Players Count - void SetRandomPlayersCount(uint64 guid, uint8 count); - /// Xinef: Get Random Players Count - uint8 GetRandomPlayersCount(uint64 guid); + /// Xinef: Set Random Players Count + void SetRandomPlayersCount(uint64 guid, uint8 count); + /// Xinef: Get Random Players Count + uint8 GetRandomPlayersCount(uint64 guid); // LFGHandler /// Get locked dungeons @@ -511,21 +511,21 @@ class LFGMgr void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment); /// Leaves lfg void LeaveLfg(uint64 guid); - /// pussywizard: cleans all queues' data - void LeaveAllLfgQueues(uint64 guid, bool allowgroup, uint64 groupguid = 0); - /// pussywizard: Raid Browser - void JoinRaidBrowser(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string comment); - void LeaveRaidBrowser(uint64 guid); - void LfrSearchAdd(Player* p, uint32 dungeonId); - void LfrSearchRemove(Player* p); - void SendRaidBrowserCachedList(Player* player, uint32 dungeonId); - void UpdateRaidBrowser(uint32 diff); + /// pussywizard: cleans all queues' data + void LeaveAllLfgQueues(uint64 guid, bool allowgroup, uint64 groupguid = 0); + /// pussywizard: Raid Browser + void JoinRaidBrowser(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string comment); + void LeaveRaidBrowser(uint64 guid); + void LfrSearchAdd(Player* p, uint32 dungeonId); + void LfrSearchRemove(Player* p); + void SendRaidBrowserCachedList(Player* player, uint32 dungeonId); + void UpdateRaidBrowser(uint32 diff); void LfrSetComment(Player* p, std::string comment); - void SendRaidBrowserJoinedPacket(Player* p, LfgDungeonSet& dungeons, std::string comment); - void RBPacketAppendGroup(const RBInternalInfo& info, ByteBuffer& buffer); - void RBPacketAppendPlayer(const RBInternalInfo& info, ByteBuffer& buffer); - void RBPacketBuildDifference(WorldPacket& differencePacket, uint32 dungeonId, uint32 deletedCounter, ByteBuffer& buffer_deleted, uint32 groupCounter, ByteBuffer& buffer_groups, uint32 playerCounter, ByteBuffer& buffer_players); - void RBPacketBuildFull(WorldPacket& fullPacket, uint32 dungeonId, RBInternalInfoMap& infoMap); + void SendRaidBrowserJoinedPacket(Player* p, LfgDungeonSet& dungeons, std::string comment); + void RBPacketAppendGroup(const RBInternalInfo& info, ByteBuffer& buffer); + void RBPacketAppendPlayer(const RBInternalInfo& info, ByteBuffer& buffer); + void RBPacketBuildDifference(WorldPacket& differencePacket, uint32 dungeonId, uint32 deletedCounter, ByteBuffer& buffer_deleted, uint32 groupCounter, ByteBuffer& buffer_groups, uint32 playerCounter, ByteBuffer& buffer_players); + void RBPacketBuildFull(WorldPacket& fullPacket, uint32 dungeonId, RBInternalInfoMap& infoMap); // LfgQueue /// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON) @@ -554,7 +554,7 @@ class LFGMgr void SetLockedDungeons(uint64 guid, LfgLockMap const& lock); void DecreaseKicksLeft(uint64 guid); void SetState(uint64 guid, LfgState state); - void SetCanOverrideRBState(uint64 guid, bool val); + void SetCanOverrideRBState(uint64 guid, bool val); void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap); void _SaveToDB(uint64 guid); LFGDungeonData const* GetLFGDungeon(uint32 id); @@ -582,8 +582,8 @@ class LFGMgr uint32 m_lfgProposalId; ///< used as internal counter for proposals uint32 m_options; ///< Stores config options uint32 lastProposalId; ///< pussywizard, store it here because of splitting LFGMgr update into tasks - uint32 m_raidBrowserUpdateTimer[2]; ///< pussywizard - uint32 m_raidBrowserLastUpdatedDungeonId[2]; ///< pussywizard: for 2 factions + uint32 m_raidBrowserUpdateTimer[2]; ///< pussywizard + uint32 m_raidBrowserLastUpdatedDungeonId[2]; ///< pussywizard: for 2 factions LfgQueueContainer QueuesStore; ///< Queues LfgCachedDungeonContainer CachedDungeonMapStore; ///< Stores all dungeons by groupType diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp index 75757e1b8..4429f9065 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.cpp +++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp @@ -31,8 +31,8 @@ LfgPlayerData::~LfgPlayerData() void LfgPlayerData::SetState(LfgState state) { - if (m_State == LFG_STATE_RAIDBROWSER && state != LFG_STATE_RAIDBROWSER && !CanOverrideRBState()) - return; + if (m_State == LFG_STATE_RAIDBROWSER && state != LFG_STATE_RAIDBROWSER && !CanOverrideRBState()) + return; switch (state) { @@ -52,8 +52,8 @@ void LfgPlayerData::SetState(LfgState state) void LfgPlayerData::RestoreState() { - if (m_State == LFG_STATE_RAIDBROWSER && m_OldState != LFG_STATE_RAIDBROWSER && !CanOverrideRBState()) - return; + if (m_State == LFG_STATE_RAIDBROWSER && m_OldState != LFG_STATE_RAIDBROWSER && !CanOverrideRBState()) + return; if (m_OldState == LFG_STATE_NONE) { @@ -95,12 +95,12 @@ void LfgPlayerData::SetSelectedDungeons(LfgDungeonSet const& dungeons) void LfgPlayerData::SetRandomPlayersCount(uint8 count) { - m_randomPlayers = count; + m_randomPlayers = count; } uint8 LfgPlayerData::GetRandomPlayersCount() const { - return m_randomPlayers; + return m_randomPlayers; } LfgState LfgPlayerData::GetState() const diff --git a/src/server/game/DungeonFinding/LFGPlayerData.h b/src/server/game/DungeonFinding/LFGPlayerData.h index 5d59d8b68..912666f5b 100644 --- a/src/server/game/DungeonFinding/LFGPlayerData.h +++ b/src/server/game/DungeonFinding/LFGPlayerData.h @@ -39,7 +39,7 @@ class LfgPlayerData void SetLockedDungeons(LfgLockMap const& lock); void SetTeam(TeamId teamId); void SetGroup(uint64 group); - void SetRandomPlayersCount(uint8 count); + void SetRandomPlayersCount(uint8 count); // Queue void SetRoles(uint8 roles); @@ -52,9 +52,9 @@ class LfgPlayerData LfgLockMap const& GetLockedDungeons() const; TeamId GetTeam() const; uint64 GetGroup() const; - uint8 GetRandomPlayersCount() const; - void SetCanOverrideRBState(bool val) { m_canOverrideRBState = val; } - bool CanOverrideRBState() const { return m_canOverrideRBState; } + uint8 GetRandomPlayersCount() const; + void SetCanOverrideRBState(bool val) { m_canOverrideRBState = val; } + bool CanOverrideRBState() const { return m_canOverrideRBState; } // Queue uint8 GetRoles() const; @@ -65,12 +65,12 @@ class LfgPlayerData // General LfgState m_State; ///< State if group in LFG LfgState m_OldState; ///< Old State - Used to restore state after failed Rolecheck/Proposal - bool m_canOverrideRBState; ///< pussywizard + bool m_canOverrideRBState; ///< pussywizard // Player LfgLockMap m_LockedDungeons; ///< Dungeons player can't do and reason TeamId m_TeamId; ///< Player team - determines the queue to join uint64 m_Group; ///< Original group of player when joined LFG - uint8 m_randomPlayers; ///< Xinef: Amount of random players you raid with + uint8 m_randomPlayers; ///< Xinef: Amount of random players you raid with // Queue uint8 m_Roles; ///< Roles the player selected when joined LFG diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index c83f41426..639123bda 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -32,84 +32,84 @@ namespace lfg void LFGQueue::AddToQueue(uint64 guid, bool failedProposal) { - //sLog->outString("ADD AddToQueue: %u, failed proposal: %u", GUID_LOPART(guid), failedProposal ? 1 : 0); + //sLog->outString("ADD AddToQueue: %u, failed proposal: %u", GUID_LOPART(guid), failedProposal ? 1 : 0); LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); if (itQueue == QueueDataStore.end()) { sLog->outError("LFGQueue::AddToQueue: Queue data not found for [" UI64FMTD "]", guid); return; } - //sLog->outString("AddToQueue success: %u", GUID_LOPART(guid)); + //sLog->outString("AddToQueue success: %u", GUID_LOPART(guid)); AddToNewQueue(guid, failedProposal); } void LFGQueue::RemoveFromQueue(uint64 guid, bool partial) { - //sLog->outString("REMOVE RemoveFromQueue: %u, partial: %u", GUID_LOPART(guid), partial ? 1 : 0); + //sLog->outString("REMOVE RemoveFromQueue: %u, partial: %u", GUID_LOPART(guid), partial ? 1 : 0); RemoveFromNewQueue(guid); RemoveFromCompatibles(guid); LfgQueueDataContainer::iterator itDelete = QueueDataStore.end(); for (LfgQueueDataContainer::iterator itr = QueueDataStore.begin(); itr != QueueDataStore.end(); ++itr) - { + { if (itr->first != guid) { if (itr->second.bestCompatible.hasGuid(guid)) - { - //sLog->outString("CLEAR bestCompatible: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid)); + { + //sLog->outString("CLEAR bestCompatible: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid)); itr->second.bestCompatible.clear(); - } + } } else - { - //sLog->outString("CLEAR bestCompatible SELF: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid)); - //itr->second.bestCompatible.clear(); // don't clear here, because UpdateQueueTimers will try to find with every diff update + { + //sLog->outString("CLEAR bestCompatible SELF: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid)); + //itr->second.bestCompatible.clear(); // don't clear here, because UpdateQueueTimers will try to find with every diff update itDelete = itr; - } - } + } + } - // xinef: partial + // xinef: partial if (!partial && itDelete != QueueDataStore.end()) - { - //sLog->outString("ERASE QueueDataStore for: %u", GUID_LOPART(guid)); - //sLog->outString("ERASE QueueDataStore for: %u, itDelete: %u,%u,%u", GUID_LOPART(guid), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks); + { + //sLog->outString("ERASE QueueDataStore for: %u", GUID_LOPART(guid)); + //sLog->outString("ERASE QueueDataStore for: %u, itDelete: %u,%u,%u", GUID_LOPART(guid), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks); QueueDataStore.erase(itDelete); - //sLog->outString("ERASE QueueDataStore for: %u SUCCESS", GUID_LOPART(guid)); - } + //sLog->outString("ERASE QueueDataStore for: %u SUCCESS", GUID_LOPART(guid)); + } } void LFGQueue::AddToNewQueue(uint64 guid, bool front) { if (front) - { - //sLog->outString("ADD AddToNewQueue at FRONT: %u", GUID_LOPART(guid)); - restoredAfterProposal.push_back(guid); + { + //sLog->outString("ADD AddToNewQueue at FRONT: %u", GUID_LOPART(guid)); + restoredAfterProposal.push_back(guid); newToQueueStore.push_front(guid); - } + } else - { - //sLog->outString("ADD AddToNewQueue at the END: %u", GUID_LOPART(guid)); + { + //sLog->outString("ADD AddToNewQueue at the END: %u", GUID_LOPART(guid)); newToQueueStore.push_back(guid); - } + } } void LFGQueue::RemoveFromNewQueue(uint64 guid) { - //sLog->outString("REMOVE RemoveFromNewQueue: %u", GUID_LOPART(guid)); + //sLog->outString("REMOVE RemoveFromNewQueue: %u", GUID_LOPART(guid)); newToQueueStore.remove(guid); - restoredAfterProposal.remove(guid); + restoredAfterProposal.remove(guid); } void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap) { - //sLog->outString("JOINED AddQueueData: %u", GUID_LOPART(guid)); + //sLog->outString("JOINED AddQueueData: %u", GUID_LOPART(guid)); QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap); AddToQueue(guid); } void LFGQueue::RemoveQueueData(uint64 guid) { - //sLog->outString("LEFT RemoveQueueData: %u", GUID_LOPART(guid)); + //sLog->outString("LEFT RemoveQueueData: %u", GUID_LOPART(guid)); LfgQueueDataContainer::iterator it = QueueDataStore.find(guid); if (it != QueueDataStore.end()) QueueDataStore.erase(it); @@ -145,73 +145,73 @@ void LFGQueue::UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId) void LFGQueue::RemoveFromCompatibles(uint64 guid) { - //sLog->outString("COMPATIBLES REMOVE for: %u", GUID_LOPART(guid)); + //sLog->outString("COMPATIBLES REMOVE for: %u", GUID_LOPART(guid)); for (LfgCompatibleContainer::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ++it) if (it->hasGuid(guid)) - { - //sLog->outString("Removed Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid)); + { + //sLog->outString("Removed Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid)); it->clear(); // set to 0, this will be removed while iterating in FindNewGroups - } + } for (LfgCompatibleContainer::iterator itr = CompatibleTempList.begin(); itr != CompatibleTempList.end(); ) - { - LfgCompatibleContainer::iterator it = itr++; + { + LfgCompatibleContainer::iterator it = itr++; if (it->hasGuid(guid)) - { - //sLog->outString("Erased Temp Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid)); + { + //sLog->outString("Erased Temp Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid)); CompatibleTempList.erase(it); - } - } + } + } } void LFGQueue::AddToCompatibles(Lfg5Guids const& key) { - //sLog->outString("COMPATIBLES ADD: %s", key.toString().c_str()); + //sLog->outString("COMPATIBLES ADD: %s", key.toString().c_str()); CompatibleTempList.push_back(key); } uint8 LFGQueue::FindGroups() { - //sLog->outString("FIND GROUPS!"); - uint8 newGroupsProcessed = 0; + //sLog->outString("FIND GROUPS!"); + uint8 newGroupsProcessed = 0; while (!newToQueueStore.empty()) { - ++newGroupsProcessed; + ++newGroupsProcessed; uint64 newGuid = newToQueueStore.front(); - bool pushCompatiblesToFront = (std::find(restoredAfterProposal.begin(), restoredAfterProposal.end(), newGuid) != restoredAfterProposal.end()); - //sLog->outString("newToQueueStore guid: %u, front: %u", GUID_LOPART(newGuid), pushCompatiblesToFront ? 1 : 0); + bool pushCompatiblesToFront = (std::find(restoredAfterProposal.begin(), restoredAfterProposal.end(), newGuid) != restoredAfterProposal.end()); + //sLog->outString("newToQueueStore guid: %u, front: %u", GUID_LOPART(newGuid), pushCompatiblesToFront ? 1 : 0); RemoveFromNewQueue(newGuid); FindNewGroups(newGuid); - CompatibleList.splice((pushCompatiblesToFront ? CompatibleList.begin() : CompatibleList.end()), CompatibleTempList); - CompatibleTempList.clear(); + CompatibleList.splice((pushCompatiblesToFront ? CompatibleList.begin() : CompatibleList.end()), CompatibleTempList); + CompatibleTempList.clear(); - return newGroupsProcessed; // pussywizard: only one per update, shouldn't be a problem + return newGroupsProcessed; // pussywizard: only one per update, shouldn't be a problem } return newGroupsProcessed; } LfgCompatibility LFGQueue::FindNewGroups(const uint64& newGuid) { - // each combination of dps+heal+tank (tank*8 + heal+4 + dps) has a value assigned 0..15 - // first 16 bits of the mask are for marking if such combination was found once, second 16 bits for marking second occurence of that combination, etc - uint64 foundMask = 0; - uint32 foundCount = 0; + // each combination of dps+heal+tank (tank*8 + heal+4 + dps) has a value assigned 0..15 + // first 16 bits of the mask are for marking if such combination was found once, second 16 bits for marking second occurence of that combination, etc + uint64 foundMask = 0; + uint32 foundCount = 0; - //sLog->outString("FIND NEW GROUPS for: %u", GUID_LOPART(newGuid)); + //sLog->outString("FIND NEW GROUPS for: %u", GUID_LOPART(newGuid)); - // we have to take into account that FindNewGroups is called every X minutes if number of compatibles is low! - // build set of already present compatibles for this guid - std::set currentCompatibles; - for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ++it) - if (it->hasGuid(newGuid)) - { - // unset roles here so they are not copied, restore after insertion - LfgRolesMap* r = it->roles; - it->roles = NULL; - currentCompatibles.insert(*it); - it->roles = r; - } + // we have to take into account that FindNewGroups is called every X minutes if number of compatibles is low! + // build set of already present compatibles for this guid + std::set currentCompatibles; + for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ++it) + if (it->hasGuid(newGuid)) + { + // unset roles here so they are not copied, restore after insertion + LfgRolesMap* r = it->roles; + it->roles = NULL; + currentCompatibles.insert(*it); + it->roles = r; + } LfgCompatibility selfCompatibility = LFG_COMPATIBILITY_PENDING; if (currentCompatibles.empty()) @@ -221,35 +221,35 @@ LfgCompatibility LFGQueue::FindNewGroups(const uint64& newGuid) return selfCompatibility; } - for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ) - { - Lfg5GuidsList::iterator itr = it++; - if (itr->empty()) - { - //sLog->outString("ERASE from CompatibleList"); - CompatibleList.erase(itr); - continue; - } - LfgCompatibility compatibility = CheckCompatibility(*itr, newGuid, foundMask, foundCount, currentCompatibles); - if (compatibility == LFG_COMPATIBLES_MATCH) - return LFG_COMPATIBLES_MATCH; - if ((foundMask & 0x3FFF3FFF3FFF3FFF) == 0x3FFF3FFF3FFF3FFF) // each combination of dps+heal+tank already found 4 times - break; - } + for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ) + { + Lfg5GuidsList::iterator itr = it++; + if (itr->empty()) + { + //sLog->outString("ERASE from CompatibleList"); + CompatibleList.erase(itr); + continue; + } + LfgCompatibility compatibility = CheckCompatibility(*itr, newGuid, foundMask, foundCount, currentCompatibles); + if (compatibility == LFG_COMPATIBLES_MATCH) + return LFG_COMPATIBLES_MATCH; + if ((foundMask & 0x3FFF3FFF3FFF3FFF) == 0x3FFF3FFF3FFF3FFF) // each combination of dps+heal+tank already found 4 times + break; + } return selfCompatibility; } LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set& currentCompatibles) { - //sLog->outString("CHECK CheckCompatibility: %s, new guid: %u", checkWith.toString().c_str(), GUID_LOPART(newGuid)); - Lfg5Guids check(checkWith, false); // here newGuid is at front - Lfg5Guids strGuids(checkWith, false); // here guids are sorted - check.force_insert_front(newGuid); - strGuids.insert(newGuid); + //sLog->outString("CHECK CheckCompatibility: %s, new guid: %u", checkWith.toString().c_str(), GUID_LOPART(newGuid)); + Lfg5Guids check(checkWith, false); // here newGuid is at front + Lfg5Guids strGuids(checkWith, false); // here guids are sorted + check.force_insert_front(newGuid); + strGuids.insert(newGuid); - if (!currentCompatibles.empty() && currentCompatibles.find(strGuids) != currentCompatibles.end()) - return LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS; + if (!currentCompatibles.empty() && currentCompatibles.find(strGuids) != currentCompatibles.end()) + return LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS; LfgProposal proposal; LfgDungeonSet proposalDungeons; @@ -259,10 +259,10 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const // Check if more than one LFG group and number of players joining uint8 numPlayers = 0; uint8 numLfgGroups = 0; - uint64 guid; - uint64 addToFoundMask = 0; + uint64 guid; + uint64 addToFoundMask = 0; - for (uint8 i=0; i<5 && (guid=check.guid[i]) != 0 && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++i) + for (uint8 i=0; i<5 && (guid=check.guid[i]) != 0 && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++i) { LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); if (itQueue == QueueDataStore.end()) @@ -293,14 +293,14 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const if (check.size() == 1 && numPlayers < MAXGROUPSIZE) { LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front()); - LfgRolesMap roles = itQueue->second.roles; + LfgRolesMap roles = itQueue->second.roles; uint8 roleCheckResult = LFGMgr::CheckGroupRoles(roles); - strGuids.addRoles(roles); - itQueue->second.bestCompatible.clear(); // this may be left after a failed proposal (not cleared, because UpdateQueueTimers would try to generate it with every update) + strGuids.addRoles(roles); + itQueue->second.bestCompatible.clear(); // this may be left after a failed proposal (not cleared, because UpdateQueueTimers would try to generate it with every update) //UpdateBestCompatibleInQueue(itQueue, strGuids); AddToCompatibles(strGuids); - if (roleCheckResult && roleCheckResult <= 15) - foundMask |= ( (((uint64)1)<<(roleCheckResult-1)) | (((uint64)1)<<(16+roleCheckResult-1)) | (((uint64)1)<<(32+roleCheckResult-1)) | (((uint64)1)<<(48+roleCheckResult-1)) ); + if (roleCheckResult && roleCheckResult <= 15) + foundMask |= ( (((uint64)1)<<(roleCheckResult-1)) | (((uint64)1)<<(16+roleCheckResult-1)) | (((uint64)1)<<(32+roleCheckResult-1)) | (((uint64)1)<<(48+roleCheckResult-1)) ); return LFG_COMPATIBLES_WITH_LESS_PLAYERS; } @@ -310,7 +310,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const // If it's single group no need to check for duplicate players, ignores, bad roles or bad dungeons as it's been checked before joining if (check.size() > 1) { - for (uint8 i=0; i<5 && check.guid[i]; ++i) + for (uint8 i=0; i<5 && check.guid[i]; ++i) { const LfgRolesMap &roles = QueueDataStore[check.guid[i]].roles; for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles) @@ -319,51 +319,51 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const for (itPlayer = proposalRoles.begin(); itPlayer != proposalRoles.end(); ++itPlayer) { if (itRoles->first == itPlayer->first) - { - // pussywizard: LFG ZOMG! this means that this player was in two different LfgQueueData (in QueueDataStore), and at least one of them is a group guid, because we do checks so there aren't 2 same guids in current CHECK + { + // pussywizard: LFG ZOMG! this means that this player was in two different LfgQueueData (in QueueDataStore), and at least one of them is a group guid, because we do checks so there aren't 2 same guids in current CHECK //sLog->outError("LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first); - break; - } + break; + } else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first)) break; } if (itPlayer == proposalRoles.end()) proposalRoles[itRoles->first] = itRoles->second; - else - break; + else + break; } } if (numPlayers != proposalRoles.size()) return LFG_INCOMPATIBLES_HAS_IGNORES; - uint8 roleCheckResult = LFGMgr::CheckGroupRoles(proposalRoles); + uint8 roleCheckResult = LFGMgr::CheckGroupRoles(proposalRoles); if (!roleCheckResult || roleCheckResult > 0xF) return LFG_INCOMPATIBLES_NO_ROLES; - // now, every combination can occur only 4 times (explained in FindNewGroups) - if (foundMask & (((uint64)1)<<(roleCheckResult-1))) - { - if (foundMask & (((uint64)1)<<(16+roleCheckResult-1))) - { - if (foundMask & (((uint64)1)<<(32+roleCheckResult-1))) - { - if (foundMask & (((uint64)1)<<(48+roleCheckResult-1))) - { - if (foundCount >= 10) // but only after finding at least 10 compatibles (this helps when there are few groups) - return LFG_INCOMPATIBLES_NO_ROLES; - } - else - addToFoundMask |= (((uint64)1)<<(48+roleCheckResult-1)); - } - else - addToFoundMask |= (((uint64)1)<<(32+roleCheckResult-1)); - } - else - addToFoundMask |= (((uint64)1)<<(16+roleCheckResult-1)); - } - else - addToFoundMask |= (((uint64)1)<<(roleCheckResult-1)); + // now, every combination can occur only 4 times (explained in FindNewGroups) + if (foundMask & (((uint64)1)<<(roleCheckResult-1))) + { + if (foundMask & (((uint64)1)<<(16+roleCheckResult-1))) + { + if (foundMask & (((uint64)1)<<(32+roleCheckResult-1))) + { + if (foundMask & (((uint64)1)<<(48+roleCheckResult-1))) + { + if (foundCount >= 10) // but only after finding at least 10 compatibles (this helps when there are few groups) + return LFG_INCOMPATIBLES_NO_ROLES; + } + else + addToFoundMask |= (((uint64)1)<<(48+roleCheckResult-1)); + } + else + addToFoundMask |= (((uint64)1)<<(32+roleCheckResult-1)); + } + else + addToFoundMask |= (((uint64)1)<<(16+roleCheckResult-1)); + } + else + addToFoundMask |= (((uint64)1)<<(roleCheckResult-1)); proposalDungeons = QueueDataStore[check.front()].dungeons; for (uint8 i=1; i<5 && check.guid[i]; ++i) @@ -379,7 +379,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const } else { - uint64 gguid = check.front(); + uint64 gguid = check.front(); const LfgQueueData &queue = QueueDataStore[gguid]; proposalDungeons = queue.dungeons; proposalRoles = queue.roles; @@ -389,16 +389,16 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const // Enough players? if (numPlayers != MAXGROUPSIZE) { - strGuids.addRoles(proposalRoles); - for (uint8 i=0; i<5 && check.guid[i]; ++i) - { - LfgQueueDataContainer::iterator itr = QueueDataStore.find(check.guid[i]); - if (!itr->second.bestCompatible.empty()) // update if groups don't have it empty (for empty it will be generated in UpdateQueueTimers) - UpdateBestCompatibleInQueue(itr, strGuids); - } + strGuids.addRoles(proposalRoles); + for (uint8 i=0; i<5 && check.guid[i]; ++i) + { + LfgQueueDataContainer::iterator itr = QueueDataStore.find(check.guid[i]); + if (!itr->second.bestCompatible.empty()) // update if groups don't have it empty (for empty it will be generated in UpdateQueueTimers) + UpdateBestCompatibleInQueue(itr, strGuids); + } AddToCompatibles(strGuids); - foundMask |= addToFoundMask; - ++foundCount; + foundMask |= addToFoundMask; + ++foundCount; return LFG_COMPATIBLES_WITH_LESS_PLAYERS; } @@ -436,8 +436,8 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const data.accept = LFG_ANSWER_AGREE; } - for (uint8 i=0; i<5 && proposal.queues.guid[i]; ++i) - RemoveFromQueue(proposal.queues.guid[i], true); + for (uint8 i=0; i<5 && proposal.queues.guid[i]; ++i) + RemoveFromQueue(proposal.queues.guid[i], true); sLFGMgr->AddProposal(proposal); @@ -446,52 +446,52 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const void LFGQueue::UpdateQueueTimers(uint32 diff) { - time_t currTime = time(NULL); - bool sendQueueStatus = false; + time_t currTime = time(NULL); + bool sendQueueStatus = false; - if (m_QueueStatusTimer > LFG_QUEUEUPDATE_INTERVAL) - { - m_QueueStatusTimer = 0; - sendQueueStatus = true; - } - else - m_QueueStatusTimer += diff; - - //sLog->outString("UPDATE UpdateQueueTimers"); - for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ) + if (m_QueueStatusTimer > LFG_QUEUEUPDATE_INTERVAL) { - Lfg5GuidsList::iterator itr = it++; - if (itr->empty()) - { - //sLog->outString("UpdateQueueTimers ERASE compatible"); - CompatibleList.erase(itr); - } - } + m_QueueStatusTimer = 0; + sendQueueStatus = true; + } + else + m_QueueStatusTimer += diff; - if (!sendQueueStatus) - { - for (LfgQueueDataContainer::iterator itQueue = QueueDataStore.begin(); itQueue != QueueDataStore.end(); ) - { - if (currTime - itQueue->second.joinTime > 2*HOUR) - { - uint64 guid = itQueue->first; - QueueDataStore.erase(itQueue++); - sLFGMgr->LeaveAllLfgQueues(guid, true); - continue; - } - if (itQueue->second.bestCompatible.empty()) - { - uint32 numOfCompatibles = FindBestCompatibleInQueue(itQueue); - if (numOfCompatibles /*must be positive, because proposals don't delete QueueQueueData*/ && currTime-itQueue->second.lastRefreshTime >= 60 && numOfCompatibles < (5-itQueue->second.bestCompatible.roles->size())*25) - { - itQueue->second.lastRefreshTime = currTime; - AddToQueue(itQueue->first, false); - } - } - ++itQueue; - } - return; - } + //sLog->outString("UPDATE UpdateQueueTimers"); + for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ) + { + Lfg5GuidsList::iterator itr = it++; + if (itr->empty()) + { + //sLog->outString("UpdateQueueTimers ERASE compatible"); + CompatibleList.erase(itr); + } + } + + if (!sendQueueStatus) + { + for (LfgQueueDataContainer::iterator itQueue = QueueDataStore.begin(); itQueue != QueueDataStore.end(); ) + { + if (currTime - itQueue->second.joinTime > 2*HOUR) + { + uint64 guid = itQueue->first; + QueueDataStore.erase(itQueue++); + sLFGMgr->LeaveAllLfgQueues(guid, true); + continue; + } + if (itQueue->second.bestCompatible.empty()) + { + uint32 numOfCompatibles = FindBestCompatibleInQueue(itQueue); + if (numOfCompatibles /*must be positive, because proposals don't delete QueueQueueData*/ && currTime-itQueue->second.lastRefreshTime >= 60 && numOfCompatibles < (5-itQueue->second.bestCompatible.roles->size())*25) + { + itQueue->second.lastRefreshTime = currTime; + AddToQueue(itQueue->first, false); + } + } + ++itQueue; + } + return; + } //sLog->outTrace(LOG_FILTER_LFG, "Updating queue timers..."); for (LfgQueueDataContainer::iterator itQueue = QueueDataStore.begin(); itQueue != QueueDataStore.end(); ++itQueue) @@ -530,10 +530,10 @@ void LFGQueue::UpdateQueueTimers(uint32 diff) } if (queueinfo.bestCompatible.empty()) - { - //sLog->outString("found empty bestCompatible"); + { + //sLog->outString("found empty bestCompatible"); FindBestCompatibleInQueue(itQueue); - } + } LfgQueueStatusData queueData(dungeonId, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps); for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer) @@ -551,19 +551,19 @@ time_t LFGQueue::GetJoinTime(uint64 guid) uint32 LFGQueue::FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue) { - uint32 numOfCompatibles = 0; + uint32 numOfCompatibles = 0; for (LfgCompatibleContainer::const_iterator itr = CompatibleList.begin(); itr != CompatibleList.end(); ++itr) if (itr->hasGuid(itrQueue->first)) - { - ++numOfCompatibles; + { + ++numOfCompatibles; UpdateBestCompatibleInQueue(itrQueue, *itr); - } - return numOfCompatibles; + } + return numOfCompatibles; } void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, Lfg5Guids const& key) { - //sLog->outString("UpdateBestCompatibleInQueue: %s", key.toString().c_str()); + //sLog->outString("UpdateBestCompatibleInQueue: %s", key.toString().c_str()); LfgQueueData& queueData = itrQueue->second; uint8 storedSize = queueData.bestCompatible.size(); diff --git a/src/server/game/DungeonFinding/LFGQueue.h b/src/server/game/DungeonFinding/LFGQueue.h index 528049208..54e985ac9 100644 --- a/src/server/game/DungeonFinding/LFGQueue.h +++ b/src/server/game/DungeonFinding/LFGQueue.h @@ -108,20 +108,20 @@ class LFGQueue void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, Lfg5Guids const& key); LfgCompatibility FindNewGroups(const uint64& newGuid); - LfgCompatibility CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set& currentCompatibles); + LfgCompatibility CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set& currentCompatibles); // Queue uint32 m_QueueStatusTimer; ///< used to check interval of sending queue status LfgQueueDataContainer QueueDataStore; ///< Queued groups LfgCompatibleContainer CompatibleList; ///< Compatible dungeons - LfgCompatibleContainer CompatibleTempList; ///< new compatibles are added to this container while main one is being iterated + LfgCompatibleContainer CompatibleTempList; ///< new compatibles are added to this container while main one is being iterated LfgWaitTimesContainer waitTimesAvgStore; ///< Average wait time to find a group queuing as multiple roles LfgWaitTimesContainer waitTimesTankStore; ///< Average wait time to find a group queuing as tank LfgWaitTimesContainer waitTimesHealerStore; ///< Average wait time to find a group queuing as healer LfgWaitTimesContainer waitTimesDpsStore; ///< Average wait time to find a group queuing as dps LfgGuidList newToQueueStore; ///< New groups to add to queue - LfgGuidList restoredAfterProposal; + LfgGuidList restoredAfterProposal; }; } // namespace lfg diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 0bc639276..dc8393d95 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -55,13 +55,13 @@ void LFGPlayerScript::OnLogout(Player* player) sLFGMgr->LeaveLfg(player->GetGUID()); sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true, player->GetGroup() ? player->GetGroup()->GetGUID() : 0); - // pussywizard: after all necessary actions handle raid browser - // pussywizard: already done above - //if (sLFGMgr->GetState(player->GetGUID()) == LFG_STATE_RAIDBROWSER) - // sLFGMgr->LeaveLfg(player->GetGUID()); + // pussywizard: after all necessary actions handle raid browser + // pussywizard: already done above + //if (sLFGMgr->GetState(player->GetGUID()) == LFG_STATE_RAIDBROWSER) + // sLFGMgr->LeaveLfg(player->GetGUID()); } - sLFGMgr->LfrSearchRemove(player); + sLFGMgr->LfrSearchRemove(player); } void LFGPlayerScript::OnLogin(Player* player) @@ -126,14 +126,14 @@ void LFGPlayerScript::OnMapChanged(Player* player) player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true); } else - { + { player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW); - // Xinef: Destroy group if only one player is left - if (Group* group = player->GetGroup()) - if (group->GetMembersCount() <= 1u) - group->Disband(); - } + // Xinef: Destroy group if only one player is left + if (Group* group = player->GetGroup()) + if (group->GetMembersCount() <= 1u) + group->Disband(); + } } LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript") @@ -175,9 +175,9 @@ void LFGGroupScript::OnAddMember(Group* group, uint64 guid) sLFGMgr->SetGroup(guid, gguid); sLFGMgr->AddPlayerToGroup(gguid, guid); - // pussywizard: after all necessary actions handle raid browser - if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER) - sLFGMgr->LeaveLfg(guid); + // pussywizard: after all necessary actions handle raid browser + if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER) + sLFGMgr->LeaveLfg(guid); } void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) @@ -205,33 +205,33 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth sLFGMgr->SetGroup(guid, 0); uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid); - // pussywizard: after all necessary actions handle raid browser - // pussywizard: already done above - //if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER) - // sLFGMgr->LeaveLfg(guid); + // pussywizard: after all necessary actions handle raid browser + // pussywizard: already done above + //if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER) + // sLFGMgr->LeaveLfg(guid); - // Xinef: only LFG groups can go below - if (!isLFG) - return; + // Xinef: only LFG groups can go below + if (!isLFG) + return; if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid)) { - // xinef: fixed dungeon deserter - if (method != GROUP_REMOVEMETHOD_KICK_LFG && state != LFG_STATE_FINISHED_DUNGEON && - player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN) && players >= LFG_GROUP_KICK_VOTES_NEEDED) - { - player->AddAura(LFG_SPELL_DUNGEON_DESERTER, player); - } + // xinef: fixed dungeon deserter + if (method != GROUP_REMOVEMETHOD_KICK_LFG && state != LFG_STATE_FINISHED_DUNGEON && + player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN) && players >= LFG_GROUP_KICK_VOTES_NEEDED) + { + player->AddAura(LFG_SPELL_DUNGEON_DESERTER, player); + } //else if (state == LFG_STATE_BOOT) // Update internal kick cooldown of kicked player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_LEADER_UNK1)); if (player->GetMap()->IsDungeon()) // Teleport player out the dungeon - { + { // Xinef: no longer valid sLFGMgr->TeleportPlayer(player, true); - if (!player->IsBeingTeleportedFar() && player->GetMapId() == sLFGMgr->GetDungeonMapId(gguid)) - player->TeleportToEntryPoint(); - } + if (!player->IsBeingTeleportedFar() && player->GetMapId() == sLFGMgr->GetDungeonMapId(gguid)) + player->TeleportToEntryPoint(); + } } if (state != LFG_STATE_FINISHED_DUNGEON) // Need more players to finish the dungeon @@ -247,9 +247,9 @@ void LFGGroupScript::OnDisband(Group* group) uint64 gguid = group->GetGUID(); ;//sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnDisband [" UI64FMTD "]", gguid); - // pussywizard: after all necessary actions handle raid browser - if (sLFGMgr->GetState(group->GetLeaderGUID()) == LFG_STATE_RAIDBROWSER) - sLFGMgr->LeaveLfg(group->GetLeaderGUID()); + // pussywizard: after all necessary actions handle raid browser + if (sLFGMgr->GetState(group->GetLeaderGUID()) == LFG_STATE_RAIDBROWSER) + sLFGMgr->LeaveLfg(group->GetLeaderGUID()); sLFGMgr->RemoveGroupData(gguid); } @@ -264,9 +264,9 @@ void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 o ;//sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid); sLFGMgr->SetLeader(gguid, newLeaderGuid); - // pussywizard: after all necessary actions handle raid browser - if (sLFGMgr->GetState(oldLeaderGuid) == LFG_STATE_RAIDBROWSER) - sLFGMgr->LeaveLfg(oldLeaderGuid); + // pussywizard: after all necessary actions handle raid browser + if (sLFGMgr->GetState(oldLeaderGuid) == LFG_STATE_RAIDBROWSER) + sLFGMgr->LeaveLfg(oldLeaderGuid); } void LFGGroupScript::OnInviteMember(Group* group, uint64 guid) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 8104a840c..6382fe098 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -111,29 +111,29 @@ uint32 CreatureTemplate::GetFirstValidModelId() const void CreatureTemplate::InitializeQueryData() { - queryData.Initialize(SMSG_CREATURE_QUERY_RESPONSE, 1); + queryData.Initialize(SMSG_CREATURE_QUERY_RESPONSE, 1); - queryData << uint32(Entry); // creature entry - queryData << Name; - queryData << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty - queryData << SubName; - queryData << IconName; // "Directions" for guard, string for Icons 2.3.0 - queryData << uint32(type_flags); // flags - queryData << uint32(type); // CreatureType.dbc - queryData << uint32(family); // CreatureFamily.dbc - queryData << uint32(rank); // Creature Rank (elite, boss, etc) - queryData << uint32(KillCredit[0]); // new in 3.1, kill credit - queryData << uint32(KillCredit[1]); // new in 3.1, kill credit - queryData << uint32(Modelid1); // Modelid1 - queryData << uint32(Modelid2); // Modelid2 - queryData << uint32(Modelid3); // Modelid3 - queryData << uint32(Modelid4); // Modelid4 - queryData << float(ModHealth); // dmg/hp modifier - queryData << float(ModMana); // dmg/mana modifier - queryData << uint8(RacialLeader); - for (uint32 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) - queryData << uint32(questItems[i]); // itemId[6], quest drop - queryData << uint32(movementId); // CreatureMovementInfo.dbc + queryData << uint32(Entry); // creature entry + queryData << Name; + queryData << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty + queryData << SubName; + queryData << IconName; // "Directions" for guard, string for Icons 2.3.0 + queryData << uint32(type_flags); // flags + queryData << uint32(type); // CreatureType.dbc + queryData << uint32(family); // CreatureFamily.dbc + queryData << uint32(rank); // Creature Rank (elite, boss, etc) + queryData << uint32(KillCredit[0]); // new in 3.1, kill credit + queryData << uint32(KillCredit[1]); // new in 3.1, kill credit + queryData << uint32(Modelid1); // Modelid1 + queryData << uint32(Modelid2); // Modelid2 + queryData << uint32(Modelid3); // Modelid3 + queryData << uint32(Modelid4); // Modelid4 + queryData << float(ModHealth); // dmg/hp modifier + queryData << float(ModMana); // dmg/mana modifier + queryData << uint8(RacialLeader); + for (uint32 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) + queryData << uint32(questItems[i]); // itemId[6], quest drop + queryData << uint32(movementId); // CreatureMovementInfo.dbc } bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) @@ -182,8 +182,8 @@ m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo( for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) m_spells[i] = 0; - for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) - m_ProhibitSchoolTime[i] = 0; + for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) + m_ProhibitSchoolTime[i] = 0; m_CreatureSpellCooldowns.clear(); DisableReputationGain = false; @@ -213,9 +213,9 @@ void Creature::AddToWorld() ///- Register the creature for guid lookup if (!IsInWorld()) { - // pussywizard: motion master needs to be initialized before OnCreatureCreate, which may set death state to JUST_DIED, to prevent crash - // it's also initialized in AIM_Initialize(), few lines below, but it's not a problem - Motion_Initialize(); + // pussywizard: motion master needs to be initialized before OnCreatureCreate, which may set death state to JUST_DIED, to prevent crash + // it's also initialized in AIM_Initialize(), few lines below, but it's not a problem + Motion_Initialize(); if (GetZoneScript()) GetZoneScript()->OnCreatureCreate(this); @@ -237,8 +237,8 @@ void Creature::RemoveFromWorld() GetZoneScript()->OnCreatureRemove(this); if (m_formation) sFormationMgr->RemoveCreatureFromGroup(m_formation, this); - if (Transport* transport = GetTransport()) - transport->RemovePassenger(this, true); + if (Transport* transport = GetTransport()) + transport->RemovePassenger(this, true); Unit::RemoveFromWorld(); sObjectAccessor->RemoveObject(this); } @@ -285,22 +285,22 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility) // Should get removed later, just keep "compatibility" with scripts if (setSpawnTime) - { + { m_respawnTime = time(NULL) + respawnDelay; - //SaveRespawnTime(); - } + //SaveRespawnTime(); + } float x, y, z, o; GetRespawnPosition(x, y, z, &o); SetHomePosition(x, y, z, o); SetPosition(x, y, z, o); - // xinef: relocate notifier - m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + // xinef: relocate notifier + m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); - // pussywizard: if corpse was removed during falling then the falling will continue after respawn, so stop falling is such case - if (IsFalling()) - StopMoving(); + // pussywizard: if corpse was removed during falling then the falling will continue after respawn, so stop falling is such case + if (IsFalling()) + StopMoving(); } /** @@ -316,7 +316,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data) } // get difficulty 1 mode entry - // Xinef: Skip for pets! + // Xinef: Skip for pets! CreatureTemplate const* cinfo = normalInfo; for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();) { @@ -423,10 +423,10 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele else SetUInt32Value(UNIT_NPC_FLAGS, npcflag); - // Xinef: NPC is in combat, keep this flag! - unit_flags &= ~UNIT_FLAG_IN_COMBAT; - if (IsInCombat()) - unit_flags |= UNIT_FLAG_IN_COMBAT; + // Xinef: NPC is in combat, keep this flag! + unit_flags &= ~UNIT_FLAG_IN_COMBAT; + if (IsInCombat()) + unit_flags |= UNIT_FLAG_IN_COMBAT; SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags); SetUInt32Value(UNIT_FIELD_FLAGS_2, cInfo->unit_flags2); @@ -576,8 +576,8 @@ void Creature::Update(uint32 diff) NeedChangeAI = false; IsAIEnabled = true; - // xinef: update combat state, if npc is not in combat - return to spawn correctly by calling EnterEvadeMode - SelectVictim(); + // xinef: update combat state, if npc is not in combat - return to spawn correctly by calling EnterEvadeMode + SelectVictim(); } if (!IsInEvadeMode() && IsAIEnabled) @@ -612,31 +612,31 @@ void Creature::Update(uint32 diff) break; } - if (IsInWorld() && !IsDuringRemoveFromWorld()) - { - // pussywizard: - if (IS_PLAYER_GUID(GetOwnerGUID())) - { - if (m_transportCheckTimer <= diff) - { - m_transportCheckTimer = 1000; - Transport* newTransport = GetMap()->GetTransportForPos(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ(), this); - if (newTransport != GetTransport()) - { - if (GetTransport()) - GetTransport()->RemovePassenger(this, true); - if (newTransport) - newTransport->AddPassenger(this, true); - this->StopMovingOnCurrentPos(); - //SendMovementFlagUpdate(); - } - } - else - m_transportCheckTimer -= diff; - } + if (IsInWorld() && !IsDuringRemoveFromWorld()) + { + // pussywizard: + if (IS_PLAYER_GUID(GetOwnerGUID())) + { + if (m_transportCheckTimer <= diff) + { + m_transportCheckTimer = 1000; + Transport* newTransport = GetMap()->GetTransportForPos(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ(), this); + if (newTransport != GetTransport()) + { + if (GetTransport()) + GetTransport()->RemovePassenger(this, true); + if (newTransport) + newTransport->AddPassenger(this, true); + this->StopMovingOnCurrentPos(); + //SendMovementFlagUpdate(); + } + } + else + m_transportCheckTimer -= diff; + } - sScriptMgr->OnCreatureUpdate(this, diff); - } + sScriptMgr->OnCreatureUpdate(this, diff); + } } void Creature::Regenerate(Powers power) @@ -644,9 +644,9 @@ void Creature::Regenerate(Powers power) uint32 curValue = GetPower(power); uint32 maxValue = GetMaxPower(power); - // Xinef: implement power regeneration flag - if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER) && !IS_PLAYER_GUID(GetOwnerGUID())) - return; + // Xinef: implement power regeneration flag + if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER) && !IS_PLAYER_GUID(GetOwnerGUID())) + return; if (curValue >= maxValue) return; @@ -667,27 +667,27 @@ void Creature::Regenerate(Powers power) addvalue = 20; break; } - case POWER_MANA: - { - // Combat and any controlled creature - if (IsInCombat() || GetCharmerOrOwnerGUID()) - { - if (GetEntry() == NPC_IMP || GetEntry() == NPC_WATER_ELEMENTAL_TEMP || GetEntry() == NPC_WATER_ELEMENTAL_PERM) - { - addvalue = uint32((GetStat(STAT_SPIRIT) / (IsUnderLastManaUseEffect() ? 8.0f : 5.0f) + 17.0f)); - } - else if (!IsUnderLastManaUseEffect()) - { - float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA); - float Spirit = GetStat(STAT_SPIRIT); + case POWER_MANA: + { + // Combat and any controlled creature + if (IsInCombat() || GetCharmerOrOwnerGUID()) + { + if (GetEntry() == NPC_IMP || GetEntry() == NPC_WATER_ELEMENTAL_TEMP || GetEntry() == NPC_WATER_ELEMENTAL_PERM) + { + addvalue = uint32((GetStat(STAT_SPIRIT) / (IsUnderLastManaUseEffect() ? 8.0f : 5.0f) + 17.0f)); + } + else if (!IsUnderLastManaUseEffect()) + { + float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA); + float Spirit = GetStat(STAT_SPIRIT); - addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate); - } - } - else - addvalue = maxValue / 3; - break; - } + addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate); + } + } + else + addvalue = maxValue / 3; + break; + } default: return; } @@ -717,8 +717,8 @@ void Creature::RegenerateHealth() uint32 addvalue = 0; // Not only pet, but any controlled creature - // Xinef: fix polymorph rapid regen - if (!GetCharmerOrOwnerGUID() || IsPolymorphed()) + // Xinef: fix polymorph rapid regen + if (!GetCharmerOrOwnerGUID() || IsPolymorphed()) addvalue = maxValue/3; else //if (GetCharmerOrOwnerGUID()) { @@ -788,7 +788,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai) UnitAI* oldAI = i_AI; - // Xinef: called in add to world + // Xinef: called in add to world //Motion_Initialize(); i_AI = ai ? ai : FactorySelector::selectAI(this); @@ -856,11 +856,11 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_RAREELITE); break; case CREATURE_ELITE_WORLDBOSS: - // Xinef: Reduce corpse delay for bossess outside of instance - if (!GetInstanceId()) - m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE)*2; - else - m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_WORLDBOSS); + // Xinef: Reduce corpse delay for bossess outside of instance + if (!GetInstanceId()) + m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE)*2; + else + m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_WORLDBOSS); break; default: m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_NORMAL); @@ -886,8 +886,8 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST); m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST); } - else if (cinfo->type_flags & CREATURE_TYPEFLAGS_GHOST) // Xinef: Add ghost visibility for ghost units - m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST); + else if (cinfo->type_flags & CREATURE_TYPEFLAGS_GHOST) // Xinef: Add ghost visibility for ghost units + m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST); if (Entry == VISUAL_WAYPOINT) SetVisible(false); @@ -974,13 +974,13 @@ void Creature::SetLootRecipient(Unit* unit, bool withGroup) m_lootRecipient = player->GetGUID(); - if (withGroup) - { - if (Group* group = player->GetGroup()) - m_lootRecipientGroup = group->GetLowGUID(); - } - else - m_lootRecipientGroup = 0; + if (withGroup) + { + if (Group* group = player->GetGroup()) + m_lootRecipientGroup = group->GetLowGUID(); + } + else + m_lootRecipientGroup = 0; SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED); } @@ -1153,7 +1153,7 @@ void Creature::SelectLevel(bool changelevel) // damage - // pussywizard: disabled until it's fixed + // pussywizard: disabled until it's fixed /*float basedamage = stats->GenerateBaseDamage(cInfo); float weaponBaseMinDamage = basedamage; @@ -1174,14 +1174,14 @@ void Creature::SelectLevel(bool changelevel) SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cInfo->mindmg); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cInfo->maxdmg); - SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cInfo->mindmg); + SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cInfo->mindmg); SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cInfo->maxdmg); - SetBaseWeaponDamage(RANGED_ATTACK, MINDAMAGE, cInfo->minrangedmg); - SetBaseWeaponDamage(RANGED_ATTACK, MAXDAMAGE, cInfo->maxrangedmg); + SetBaseWeaponDamage(RANGED_ATTACK, MINDAMAGE, cInfo->minrangedmg); + SetBaseWeaponDamage(RANGED_ATTACK, MAXDAMAGE, cInfo->maxrangedmg); SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, cInfo->attackpower); - SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, cInfo->rangedattackpower); + SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, cInfo->rangedattackpower); } float Creature::_GetHealthMod(int32 Rank) @@ -1262,34 +1262,34 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, const Object::_Create(guidlow, Entry, (vehId || normalInfo->VehicleId) ? HIGHGUID_VEHICLE : HIGHGUID_UNIT); - // Xinef: select proper vehicle id - if (!vehId) - { - CreatureTemplate const* cinfo = normalInfo; - for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();) - { - // we already have valid Map pointer for current creature! - if (cinfo->DifficultyEntry[diff - 1]) - { - cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]); - if (cinfo && cinfo->VehicleId) - break; // template found + // Xinef: select proper vehicle id + if (!vehId) + { + CreatureTemplate const* cinfo = normalInfo; + for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0 && !IsPet();) + { + // we already have valid Map pointer for current creature! + if (cinfo->DifficultyEntry[diff - 1]) + { + cinfo = sObjectMgr->GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]); + if (cinfo && cinfo->VehicleId) + break; // template found - // check and reported at startup, so just ignore (restore normalInfo) - cinfo = normalInfo; - } + // check and reported at startup, so just ignore (restore normalInfo) + cinfo = normalInfo; + } - // for instances heroic to normal, other cases attempt to retrieve previous difficulty - if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid()) - diff -= 2; // to normal raid difficulty cases - else - --diff; - } + // for instances heroic to normal, other cases attempt to retrieve previous difficulty + if (diff >= RAID_DIFFICULTY_10MAN_HEROIC && GetMap()->IsRaid()) + diff -= 2; // to normal raid difficulty cases + else + --diff; + } - if (cinfo->VehicleId) - CreateVehicleKit(cinfo->VehicleId, (cinfo->VehicleId != normalInfo->VehicleId ? cinfo->Entry : normalInfo->Entry)); - } - else + if (cinfo->VehicleId) + CreateVehicleKit(cinfo->VehicleId, (cinfo->VehicleId != normalInfo->VehicleId ? cinfo->Entry : normalInfo->Entry)); + } + else CreateVehicleKit(vehId, Entry); @@ -1309,17 +1309,17 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap, bool gri return false; } - // xinef: fix shitness from db - if ((addToMap || gridLoad) && !data->overwrittenZ) - { - float tz = map->GetHeight(data->posX, data->posY, data->posZ+1.0f, true); - if (tz >= data->posZ && tz - data->posZ <= 1.0f) - const_cast(data)->posZ = tz+0.1f; + // xinef: fix shitness from db + if ((addToMap || gridLoad) && !data->overwrittenZ) + { + float tz = map->GetHeight(data->posX, data->posY, data->posZ+1.0f, true); + if (tz >= data->posZ && tz - data->posZ <= 1.0f) + const_cast(data)->posZ = tz+0.1f; - const_cast(data)->overwrittenZ = true; - } + const_cast(data)->overwrittenZ = true; + } - // xinef: this has to be assigned before Create function, properly loads equipment id from DB + // xinef: this has to be assigned before Create function, properly loads equipment id from DB m_creatureData = data; m_DBTableGuid = guid; @@ -1577,12 +1577,12 @@ void Creature::setDeathState(DeathState s, bool despawn) SetLootRecipient(NULL); ResetPlayerDamageReq(); CreatureTemplate const* cinfo = GetCreatureTemplate(); - // Xinef: npc run by default + // Xinef: npc run by default //SetWalk(true); - // pussywizard: - if (HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) - RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING); + // pussywizard: + if (HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) + RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING); UpdateEnvironmentIfNeeded(3); SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag); @@ -1592,7 +1592,7 @@ void Creature::setDeathState(DeathState s, bool despawn) Unit::setDeathState(ALIVE, despawn); // Xinef: Load auras AFTER setting alive state - LoadCreaturesAddon(true); + LoadCreaturesAddon(true); Motion_Initialize(); if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask) SetPhaseMask(GetCreatureData()->phaseMask, false); @@ -1620,7 +1620,7 @@ void Creature::Respawn(bool force) ;//sLog->outStaticDebug("Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry()); m_respawnTime = 0; - ResetPickPocketLootTime(); + ResetPickPocketLootTime(); if (m_originalEntry != GetEntry()) UpdateEntry(m_originalEntry); @@ -1656,8 +1656,8 @@ void Creature::Respawn(bool force) InitializeReactState(); } - // xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn) - m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + // xinef: relocate notifier, fixes npc appearing in corpse position after forced respawn (instead of spawn) + m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); UpdateObjectVisibility(false); } @@ -1674,7 +1674,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn) if (IsAlive()) setDeathState(JUST_DIED, true); - // Xinef: set new respawn time, ignore corpse decay time... + // Xinef: set new respawn time, ignore corpse decay time... RemoveCorpse(true); } @@ -1698,7 +1698,7 @@ void Creature::InitializeReactState() bool Creature::HasMechanicTemplateImmunity(uint32 mask) const { - return !IS_PLAYER_GUID(GetOwnerGUID()) && (GetCreatureTemplate()->MechanicImmuneMask & mask); + return !IS_PLAYER_GUID(GetOwnerGUID()) && (GetCreatureTemplate()->MechanicImmuneMask & mask); } bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) @@ -1706,7 +1706,7 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) if (!spellInfo) return false; - // Xinef: this should exclude self casts... + // Xinef: this should exclude self casts... // Spells that don't have effectMechanics. if (spellInfo->Mechanic > MECHANIC_NONE && HasMechanicTemplateImmunity(1 << (spellInfo->Mechanic - 1))) return true; @@ -1728,7 +1728,7 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo) bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const { - // Xinef: this should exclude self casts... + // Xinef: this should exclude self casts... if (spellInfo->Effects[index].Mechanic > MECHANIC_NONE && HasMechanicTemplateImmunity(1 << (spellInfo->Effects[index].Mechanic - 1))) return true; @@ -1868,8 +1868,8 @@ Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const Unit* target = NULL; - if (dist < ATTACK_DISTANCE) - dist = ATTACK_DISTANCE; + if (dist < ATTACK_DISTANCE) + dist = ATTACK_DISTANCE; if (dist > MAX_SEARCHER_DISTANCE) dist = MAX_SEARCHER_DISTANCE; @@ -1966,13 +1966,13 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / if (!IsAlive()) return false; - // Xinef: we cannot assist in evade mode - if (IsInEvadeMode()) - return false; + // Xinef: we cannot assist in evade mode + if (IsInEvadeMode()) + return false; - // pussywizard: or if enemy is in evade mode - if (enemy->GetTypeId() == TYPEID_UNIT && enemy->ToCreature()->IsInEvadeMode()) - return false; + // pussywizard: or if enemy is in evade mode + if (enemy->GetTypeId() == TYPEID_UNIT && enemy->ToCreature()->IsInEvadeMode()) + return false; // we don't need help from non-combatant ;) if (IsCivilian()) @@ -2051,31 +2051,31 @@ bool Creature::_CanDetectFeignDeathOf(const Unit* target) const void Creature::UpdateMoveInLineOfSightState() { - // xinef: pets, guardians and units with scripts / smartAI should be skipped - if (IsPet() || HasUnitTypeMask(UNIT_MASK_MINION|UNIT_MASK_SUMMON|UNIT_MASK_GUARDIAN|UNIT_MASK_CONTROLABLE_GUARDIAN) || - GetScriptId() || GetAIName() == "SmartAI") - { - m_moveInLineOfSightStrictlyDisabled = false; - m_moveInLineOfSightDisabled = false; - return; - } + // xinef: pets, guardians and units with scripts / smartAI should be skipped + if (IsPet() || HasUnitTypeMask(UNIT_MASK_MINION|UNIT_MASK_SUMMON|UNIT_MASK_GUARDIAN|UNIT_MASK_CONTROLABLE_GUARDIAN) || + GetScriptId() || GetAIName() == "SmartAI") + { + m_moveInLineOfSightStrictlyDisabled = false; + m_moveInLineOfSightDisabled = false; + return; + } - if (IsTrigger() || IsCivilian() || GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || IsCritter() || GetAIName() == "NullCreatureAI") - { - m_moveInLineOfSightDisabled = true; - m_moveInLineOfSightStrictlyDisabled = true; - return; - } + if (IsTrigger() || IsCivilian() || GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || IsCritter() || GetAIName() == "NullCreatureAI") + { + m_moveInLineOfSightDisabled = true; + m_moveInLineOfSightStrictlyDisabled = true; + return; + } - bool nonHostile = true; - if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(getFaction())) - if (factionTemplate->hostileMask || factionTemplate->enemyFaction[0] || factionTemplate->enemyFaction[1] || factionTemplate->enemyFaction[2] || factionTemplate->enemyFaction[3]) - nonHostile = false; + bool nonHostile = true; + if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(getFaction())) + if (factionTemplate->hostileMask || factionTemplate->enemyFaction[0] || factionTemplate->enemyFaction[1] || factionTemplate->enemyFaction[2] || factionTemplate->enemyFaction[3]) + nonHostile = false; - if (nonHostile) - m_moveInLineOfSightDisabled = true; - else - m_moveInLineOfSightDisabled = false; + if (nonHostile) + m_moveInLineOfSightDisabled = true; + else + m_moveInLineOfSightDisabled = false; } void Creature::SaveRespawnTime() @@ -2100,30 +2100,30 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const if (IsAIEnabled && !AI()->CanAIAttack(victim)) return false; - // pussywizard: we cannot attack in evade mode - if (IsInEvadeMode()) - return false; + // pussywizard: we cannot attack in evade mode + if (IsInEvadeMode()) + return false; - // pussywizard: or if enemy is in evade mode - if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode()) - return false; + // pussywizard: or if enemy is in evade mode + if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode()) + return false; if (!IS_PLAYER_GUID(GetCharmerOrOwnerGUID())) - { - if (GetMap()->IsDungeon()) - return true; + { + if (GetMap()->IsDungeon()) + return true; - // pussywizard: don't check distance to home position if recently damaged (allow kiting away from spawnpoint!) - // xinef: this should include taunt auras - if (!isWorldBoss() && (GetLastDamagedTime() > sWorld->GetGameTime() || HasAuraType(SPELL_AURA_MOD_TAUNT))) - return true; - } + // pussywizard: don't check distance to home position if recently damaged (allow kiting away from spawnpoint!) + // xinef: this should include taunt auras + if (!isWorldBoss() && (GetLastDamagedTime() > sWorld->GetGameTime() || HasAuraType(SPELL_AURA_MOD_TAUNT))) + return true; + } - if (skipDistCheck) - return true; + if (skipDistCheck) + return true; - // xinef: added size factor for huge npcs - float dist = std::min(GetMap()->GetVisibilityRange() + GetObjectSize()*2, 150.0f); + // xinef: added size factor for huge npcs + float dist = std::min(GetMap()->GetVisibilityRange() + GetObjectSize()*2, 150.0f); if (Unit* unit = GetCharmerOrOwner()) return victim->IsWithinDist(unit, dist); @@ -2279,23 +2279,23 @@ void Creature::SetInCombatWithZone() void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) { - for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) - if (idSchoolMask & (1 << i)) - m_ProhibitSchoolTime[i] = World::GetGameTimeMS() + unTimeMs; + for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) + if (idSchoolMask & (1 << i)) + m_ProhibitSchoolTime[i] = World::GetGameTimeMS() + unTimeMs; } bool Creature::IsSpellProhibited(SpellSchoolMask idSchoolMask) const { - const CreatureTemplate* cinfo = GetCreatureTemplate(); - if (!(cinfo && cinfo->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) && (isWorldBoss() || IsDungeonBoss())) - return false; + const CreatureTemplate* cinfo = GetCreatureTemplate(); + if (!(cinfo && cinfo->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) && (isWorldBoss() || IsDungeonBoss())) + return false; - for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) - if (idSchoolMask & (1 << i)) - if (m_ProhibitSchoolTime[i] >= World::GetGameTimeMS()) - return true; + for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) + if (idSchoolMask & (1 << i)) + if (m_ProhibitSchoolTime[i] >= World::GetGameTimeMS()) + return true; - return false; + return false; } void Creature::_AddCreatureSpellCooldown(uint32 spell_id, uint32 end_time) @@ -2309,45 +2309,45 @@ void Creature::AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_t if (!spellInfo) return; - // used in proc system, otherwise normal creature cooldown - if (end_time) - { - _AddCreatureSpellCooldown(spellInfo->Id, end_time); - return; - } + // used in proc system, otherwise normal creature cooldown + if (end_time) + { + _AddCreatureSpellCooldown(spellInfo->Id, end_time); + return; + } uint32 spellcooldown = spellInfo->RecoveryTime; - uint32 categorycooldown = spellInfo->CategoryRecoveryTime; + uint32 categorycooldown = spellInfo->CategoryRecoveryTime; if(Player* modOwner = GetSpellModOwner()) - { + { modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, spellcooldown); modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, categorycooldown); - } + } if (spellcooldown) _AddCreatureSpellCooldown(spellInfo->Id, spellcooldown); - if (categorycooldown) - if (spellInfo->GetCategory()) - { - SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(spellInfo->GetCategory()); - if (i_scstore != sSpellsByCategoryStore.end()) - { - uint32 cattime = categorycooldown; - for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset) - if (GetSpellCooldown(*i_scset) < cattime) - _AddCreatureSpellCooldown(*i_scset, cattime); - } - } + if (categorycooldown) + if (spellInfo->GetCategory()) + { + SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(spellInfo->GetCategory()); + if (i_scstore != sSpellsByCategoryStore.end()) + { + uint32 cattime = categorycooldown; + for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset) + if (GetSpellCooldown(*i_scset) < cattime) + _AddCreatureSpellCooldown(*i_scset, cattime); + } + } } uint32 Creature::GetSpellCooldown(uint32 spell_id) const { CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spell_id); if (itr == m_CreatureSpellCooldowns.end()) - return 0; - - return itr->second > World::GetGameTimeMS() ? itr->second - World::GetGameTimeMS() : 0; + return 0; + + return itr->second > World::GetGameTimeMS() ? itr->second - World::GetGameTimeMS() : 0; } bool Creature::HasSpellCooldown(uint32 spell_id) const @@ -2392,24 +2392,24 @@ void Creature::GetRespawnPosition(float &x, float &y, float &z, float* ori, floa } } - // xinef: changed this from current position to home position, fixes world summons with infinite duration - if (GetTransport()) - { - x = GetPositionX(); - y = GetPositionY(); - z = GetPositionZ(); - if (ori) - *ori = GetOrientation(); - } - else - { - Position homePos = GetHomePosition(); - x = homePos.GetPositionX(); - y = homePos.GetPositionY(); - z = homePos.GetPositionZ(); - if (ori) - *ori = homePos.GetOrientation(); - } + // xinef: changed this from current position to home position, fixes world summons with infinite duration + if (GetTransport()) + { + x = GetPositionX(); + y = GetPositionY(); + z = GetPositionZ(); + if (ori) + *ori = GetOrientation(); + } + else + { + Position homePos = GetHomePosition(); + x = homePos.GetPositionX(); + y = homePos.GetPositionY(); + z = homePos.GetPositionZ(); + if (ori) + *ori = homePos.GetOrientation(); + } if (dist) *dist = 0; } @@ -2601,9 +2601,9 @@ bool Creature::SetDisableGravity(bool disable, bool packetOnly/*=false*/) if (!movespline->Initialized()) return true; - // pussywizard: artificial disable_gravity to hovering npcs, don't send! - if (!disable && GetHoverHeight() >= 2.0f) - return true; + // pussywizard: artificial disable_gravity to hovering npcs, don't send! + if (!disable && GetHoverHeight() >= 2.0f) + return true; WorldPacket data(disable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9); data.append(GetPackGUID()); @@ -2743,8 +2743,8 @@ void Creature::SetDisplayId(uint32 modelId) if (CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(modelId)) { - SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (IsPet() ? 1.0f : minfo->bounding_radius) * GetFloatValue(OBJECT_FIELD_SCALE_X)); - SetFloatValue(UNIT_FIELD_COMBATREACH, (IsPet() ? DEFAULT_COMBAT_REACH : minfo->combat_reach) * GetFloatValue(OBJECT_FIELD_SCALE_X)); + SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (IsPet() ? 1.0f : minfo->bounding_radius) * GetFloatValue(OBJECT_FIELD_SCALE_X)); + SetFloatValue(UNIT_FIELD_COMBATREACH, (IsPet() ? DEFAULT_COMBAT_REACH : minfo->combat_reach) * GetFloatValue(OBJECT_FIELD_SCALE_X)); } } @@ -2766,10 +2766,10 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) AddUnitState(UNIT_STATE_ROTATING); // Set serverside orientation if needed (needs to be after attribute check) - if (this == target && (movespline->Finalized() || GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)) - SetFacingTo(GetOrientation()); - else - SetInFront(target); + if (this == target && (movespline->Finalized() || GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)) + SetFacingTo(GetOrientation()); + else + SetInFront(target); } void Creature::ReleaseFocus(Spell const* focusSpell) diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index fdc27b837..b44fece4f 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -56,7 +56,7 @@ enum CreatureFlagsExtra CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // Creature is subject to all diminishing returns as player are CREATURE_FLAG_EXTRA_KNOCKBACK_IMMUNE= 0x00200000, // pussywizard: set mostly for dungeon bosses and their summons CREATURE_FLAG_EXTRA_AVOID_AOE = 0x00400000, // pussywizard: ignored by aoe attacks (for icc blood prince council npc - Dark Nucleus) - CREATURE_FLAG_EXTRA_NO_DODGE = 0x00800000, // xinef: target cannot dodge + CREATURE_FLAG_EXTRA_NO_DODGE = 0x00800000, // xinef: target cannot dodge CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB) CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000 // creature ignore pathfinding }; @@ -67,7 +67,7 @@ enum CreatureFlagsExtra CREATURE_FLAG_EXTRA_NO_TAUNT | CREATURE_FLAG_EXTRA_WORLDEVENT | CREATURE_FLAG_EXTRA_NO_CRIT | \ CREATURE_FLAG_EXTRA_NO_SKILLGAIN | CREATURE_FLAG_EXTRA_TAUNT_DIMINISH | CREATURE_FLAG_EXTRA_ALL_DIMINISH | \ CREATURE_FLAG_EXTRA_GUARD | CREATURE_FLAG_EXTRA_KNOCKBACK_IMMUNE | CREATURE_FLAG_EXTRA_AVOID_AOE | \ - CREATURE_FLAG_EXTRA_NO_DODGE | CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING) + CREATURE_FLAG_EXTRA_NO_DODGE | CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING) #define MAX_AGGRO_RESET_TIME 10 // in seconds @@ -280,7 +280,7 @@ struct CreatureData uint32 unit_flags; // enum UnitFlags mask values uint32 dynamicflags; bool dbData; - bool overwrittenZ; + bool overwrittenZ; }; struct CreatureModelInfo @@ -475,7 +475,7 @@ class Creature : public Unit, public GridObject, public MovableMapObje bool CanCreatureAttack(Unit const* victim, bool skipDistCheck = false) const; bool IsImmunedToSpell(SpellInfo const* spellInfo); - bool HasMechanicTemplateImmunity(uint32 mask) const; + bool HasMechanicTemplateImmunity(uint32 mask) const; // redefine Unit::IsImmunedToSpell bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; // redefine Unit::IsImmunedToSpellEffect @@ -498,7 +498,7 @@ class Creature : public Unit, public GridObject, public MovableMapObje bool IsDungeonBoss() const; bool IsImmuneToKnockback() const; - bool IsAvoidingAOE() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_AVOID_AOE; } + bool IsAvoidingAOE() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_AVOID_AOE; } uint8 getLevelForTarget(WorldObject const* target) const; // overwrite Unit::getLevelForTarget for boss level support @@ -526,11 +526,11 @@ class Creature : public Unit, public GridObject, public MovableMapObje void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); } void _AddCreatureSpellCooldown(uint32 spell_id, uint32 end_time); - virtual void AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_time, bool needSendToClient = false, bool forceSendToSpectator = false); + virtual void AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_time, bool needSendToClient = false, bool forceSendToSpectator = false); virtual bool HasSpellCooldown(uint32 spell_id) const; - uint32 GetSpellCooldown(uint32 spell_id) const; - void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs); - bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const; + uint32 GetSpellCooldown(uint32 spell_id) const; + void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs); + bool IsSpellProhibited(SpellSchoolMask idSchoolMask) const; bool HasSpell(uint32 spellID) const; @@ -578,14 +578,14 @@ class Creature : public Unit, public GridObject, public MovableMapObje virtual void DeleteFromDB(); // overriden in Pet Loot loot; - uint64 GetLootRecipientGUID() const { return m_lootRecipient; } + uint64 GetLootRecipientGUID() const { return m_lootRecipient; } Player* GetLootRecipient() const; Group* GetLootRecipientGroup() const; bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; } bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party. - bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(NULL); } - void SetPickPocketLootTime() { lootPickPocketRestoreTime = time(NULL) + MINUTE + GetCorpseDelay() + GetRespawnTime(); } - void ResetPickPocketLootTime() { lootPickPocketRestoreTime = 0; } + bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(NULL); } + void SetPickPocketLootTime() { lootPickPocketRestoreTime = time(NULL) + MINUTE + GetCorpseDelay() + GetRespawnTime(); } + void ResetPickPocketLootTime() { lootPickPocketRestoreTime = 0; } void SetLootRecipient (Unit* unit, bool withGroup = true); void AllLootRemovedFromCorpse(); @@ -602,7 +602,7 @@ class Creature : public Unit, public GridObject, public MovableMapObje uint32 m_spells[CREATURE_MAX_SPELLS]; CreatureSpellCooldowns m_CreatureSpellCooldowns; - uint32 m_ProhibitSchoolTime[7]; + uint32 m_ProhibitSchoolTime[7]; bool CanStartAttack(Unit const* u) const; float GetAggroRange(Unit const* target) const; @@ -622,10 +622,10 @@ class Creature : public Unit, public GridObject, public MovableMapObje bool _IsTargetAcceptable(const Unit* target) const; bool _CanDetectFeignDeathOf(const Unit* target) const; // pussywizard - // pussywizard: updated at faction change, disable move in line of sight if actual faction is not hostile to anyone - void UpdateMoveInLineOfSightState(); - bool IsMoveInLineOfSightDisabled() { return m_moveInLineOfSightDisabled; } - bool IsMoveInLineOfSightStrictlyDisabled() { return m_moveInLineOfSightStrictlyDisabled; } + // pussywizard: updated at faction change, disable move in line of sight if actual faction is not hostile to anyone + void UpdateMoveInLineOfSightState(); + bool IsMoveInLineOfSightDisabled() { return m_moveInLineOfSightDisabled; } + bool IsMoveInLineOfSightStrictlyDisabled() { return m_moveInLineOfSightStrictlyDisabled; } MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; } void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; } @@ -657,7 +657,7 @@ class Creature : public Unit, public GridObject, public MovableMapObje bool hasInvolvedQuest(uint32 quest_id) const; bool isRegeneratingHealth() { return m_regenHealth; } - void SetRegeneratingHealth(bool c) { m_regenHealth = c; } + void SetRegeneratingHealth(bool c) { m_regenHealth = c; } virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; } virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const { @@ -739,7 +739,7 @@ class Creature : public Unit, public GridObject, public MovableMapObje uint32 m_respawnDelay; // (secs) delay between corpse disappearance and respawning uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance float m_respawnradius; - uint16 m_transportCheckTimer; + uint16 m_transportCheckTimer; uint32 lootPickPocketRestoreTime; ReactStates m_reactState; // for AI, not charmInfo @@ -757,12 +757,12 @@ class Creature : public Unit, public GridObject, public MovableMapObje SpellSchoolMask m_meleeDamageSchoolMask; uint32 m_originalEntry; - - bool m_moveInLineOfSightDisabled; - bool m_moveInLineOfSightStrictlyDisabled; + + bool m_moveInLineOfSightDisabled; + bool m_moveInLineOfSightStrictlyDisabled; Position m_homePosition; - Position m_transportHomePosition; + Position m_transportHomePosition; bool DisableReputationGain; @@ -775,7 +775,7 @@ class Creature : public Unit, public GridObject, public MovableMapObje bool CanAlwaysSee(WorldObject const* obj) const; private: - void ForcedDespawn(uint32 timeMSToDespawn = 0); + void ForcedDespawn(uint32 timeMSToDespawn = 0); //WaypointMovementGenerator vars uint32 m_waypointID; diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index 690b28154..3aa7283e9 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -196,9 +196,9 @@ void CreatureGroup::MemberAttackStart(Creature* member, Unit* target) void CreatureGroup::FormationReset(bool dismiss) { - if (m_members.size() && m_members.begin()->second->groupAI == 5) - return; - + if (m_members.size() && m_members.begin()->second->groupAI == 5) + return; + for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { if (itr->first != m_leader && itr->first->IsAlive()) @@ -220,11 +220,11 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run) if (!m_leader) return; - uint8 groupAI = sFormationMgr->CreatureGroupMap[m_leader->GetDBTableGUIDLow()]->groupAI; - if (groupAI == 5) - return; + uint8 groupAI = sFormationMgr->CreatureGroupMap[m_leader->GetDBTableGUIDLow()]->groupAI; + if (groupAI == 5) + return; - float pathDist = m_leader->GetExactDist(x, y, z); + float pathDist = m_leader->GetExactDist(x, y, z); float pathAngle = m_leader->GetAngle(x, y); for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) @@ -233,18 +233,18 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run) if (member == m_leader || !member->IsAlive() || member->GetVictim()) continue; - // Xinef: If member is stunned / rooted etc don't allow to move him - if (member->HasUnitState(UNIT_STATE_NOT_MOVE)) - continue; + // Xinef: If member is stunned / rooted etc don't allow to move him + if (member->HasUnitState(UNIT_STATE_NOT_MOVE)) + continue; - // Xinef: this should be automatized, if turn angle is greater than PI/2 (90°) we should swap formation angle + // Xinef: this should be automatized, if turn angle is greater than PI/2 (90°) we should swap formation angle if (M_PI - fabs(fabs(m_leader->GetOrientation() - pathAngle) - M_PI) > M_PI*0.50f) { - // pussywizard: in both cases should be 2*M_PI - follow_angle - // pussywizard: also, GetCurrentWaypointID() returns 0..n-1, while point_1 must be > 0, so +1 - // pussywizard: db table waypoint_data shouldn't have point id 0 and shouldn't have any gaps for this to work! + // pussywizard: in both cases should be 2*M_PI - follow_angle + // pussywizard: also, GetCurrentWaypointID() returns 0..n-1, while point_1 must be > 0, so +1 + // pussywizard: db table waypoint_data shouldn't have point id 0 and shouldn't have any gaps for this to work! // if (m_leader->GetCurrentWaypointID()+1 == itr->second->point_1 || m_leader->GetCurrentWaypointID()+1 == itr->second->point_2) - itr->second->follow_angle = Position::NormalizeOrientation(itr->second->follow_angle + M_PI); //(2 * M_PI) - itr->second->follow_angle; + itr->second->follow_angle = Position::NormalizeOrientation(itr->second->follow_angle + M_PI); //(2 * M_PI) - itr->second->follow_angle; } float followAngle = itr->second->follow_angle; @@ -260,16 +260,16 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z, bool run) member->UpdateGroundPositionZ(dx, dy, dz); member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags()); - // pussywizard: setting the same movementflags is not enough, spline decides whether leader walks/runs, so spline param is now passed as "run" parameter to this function + // pussywizard: setting the same movementflags is not enough, spline decides whether leader walks/runs, so spline param is now passed as "run" parameter to this function if (run && member->IsWalking()) member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); else if (!run && !member->IsWalking()) member->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - // xinef: if we move members to position without taking care of sizes, we should compare distance without sizes - // xinef: change members speed basing on distance - if too far speed up, if too close slow down - UnitMoveType mtype = Movement::SelectSpeedType(member->GetUnitMovementFlags()); - member->SetSpeedRate(mtype, m_leader->GetSpeedRate(mtype) * member->GetExactDist(dx, dy, dz) / pathDist); + // xinef: if we move members to position without taking care of sizes, we should compare distance without sizes + // xinef: change members speed basing on distance - if too far speed up, if too close slow down + UnitMoveType mtype = Movement::SelectSpeedType(member->GetUnitMovementFlags()); + member->SetSpeedRate(mtype, m_leader->GetSpeedRate(mtype) * member->GetExactDist(dx, dy, dz) / pathDist); member->GetMotionMaster()->MovePoint(0, dx, dy, dz); member->SetHomePosition(dx, dy, dz, pathAngle); diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 47efd492d..0d6806eec 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -36,7 +36,7 @@ GossipMenu::~GossipMenu() void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded /*= false*/) { - //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); ASSERT(_menuItems.size() <= GOSSIP_MAX_MENU_ITEMS); // Find a free new id - script case @@ -68,7 +68,7 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me void GossipMenu::AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi) { - //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); GossipMenuItemData& itemData = _menuItemData[menuItemId]; itemData.GossipActionMenuId = gossipActionMenuId; @@ -77,7 +77,7 @@ void GossipMenu::AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMen uint32 GossipMenu::GetMenuItemSender(uint32 menuItemId) const { - //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); GossipMenuItemContainer::const_iterator itr = _menuItems.find(menuItemId); if (itr == _menuItems.end()) return 0; @@ -87,7 +87,7 @@ uint32 GossipMenu::GetMenuItemSender(uint32 menuItemId) const uint32 GossipMenu::GetMenuItemAction(uint32 menuItemId) const { - //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); GossipMenuItemContainer::const_iterator itr = _menuItems.find(menuItemId); if (itr == _menuItems.end()) return 0; @@ -97,7 +97,7 @@ uint32 GossipMenu::GetMenuItemAction(uint32 menuItemId) const bool GossipMenu::IsMenuItemCoded(uint32 menuItemId) const { - //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); GossipMenuItemContainer::const_iterator itr = _menuItems.find(menuItemId); if (itr == _menuItems.end()) return false; @@ -107,7 +107,7 @@ bool GossipMenu::IsMenuItemCoded(uint32 menuItemId) const void GossipMenu::ClearMenu() { - //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); _menuItems.clear(); _menuItemData.clear(); } @@ -129,8 +129,8 @@ void PlayerMenu::ClearMenus() void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const { - //ACE_Read_Guard lock1(_gossipMenu.GetLock()); - //ACE_Read_Guard lock2(_questMenu.GetLock()); + //ACE_Read_Guard lock1(_gossipMenu.GetLock()); + //ACE_Read_Guard lock2(_questMenu.GetLock()); WorldPacket data(SMSG_GOSSIP_MESSAGE, 24 + _gossipMenu.GetMenuItemCount()*100 + _questMenu.GetMenuItemCount()*75); // guess size data << uint64(objectGUID); @@ -213,7 +213,7 @@ void QuestMenu::AddMenuItem(uint32 QuestId, uint8 Icon) if (!sObjectMgr->GetQuestTemplate(QuestId)) return; - //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); ASSERT(_questMenuItems.size() <= GOSSIP_MAX_MENU_ITEMS); @@ -227,7 +227,7 @@ void QuestMenu::AddMenuItem(uint32 QuestId, uint8 Icon) bool QuestMenu::HasItem(uint32 questId) const { - //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); for (QuestMenuItemList::const_iterator i = _questMenuItems.begin(); i != _questMenuItems.end(); ++i) if (i->QuestId == questId) return true; @@ -237,7 +237,7 @@ bool QuestMenu::HasItem(uint32 questId) const void QuestMenu::ClearMenu() { - //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); _questMenuItems.clear(); } @@ -467,22 +467,22 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, return; } - // Xinef: recheck completion on reward display - Player* _player = _session->GetPlayer(); - QuestStatusMap::iterator qsitr = _player->getQuestStatusMap().find(quest->GetQuestId()); - if (qsitr != _player->getQuestStatusMap().end() && qsitr->second.Status == QUEST_STATUS_INCOMPLETE) - { - for (uint8 i=0; i<6; ++i) - if (quest->RequiredItemId[i] && qsitr->second.ItemCount[i] < quest->RequiredItemCount[i]) - if (_player->GetItemCount(quest->RequiredItemId[i], false) >= quest->RequiredItemCount[i]) - qsitr->second.ItemCount[i] = quest->RequiredItemCount[i]; + // Xinef: recheck completion on reward display + Player* _player = _session->GetPlayer(); + QuestStatusMap::iterator qsitr = _player->getQuestStatusMap().find(quest->GetQuestId()); + if (qsitr != _player->getQuestStatusMap().end() && qsitr->second.Status == QUEST_STATUS_INCOMPLETE) + { + for (uint8 i=0; i<6; ++i) + if (quest->RequiredItemId[i] && qsitr->second.ItemCount[i] < quest->RequiredItemCount[i]) + if (_player->GetItemCount(quest->RequiredItemId[i], false) >= quest->RequiredItemCount[i]) + qsitr->second.ItemCount[i] = quest->RequiredItemCount[i]; - if (_player->CanCompleteQuest(quest->GetQuestId())) - { - _player->CompleteQuest(quest->GetQuestId()); - canComplete = true; - } - } + if (_player->CanCompleteQuest(quest->GetQuestId())) + { + _player->CompleteQuest(quest->GetQuestId()); + canComplete = true; + } + } WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 300); // guess size data << uint64(npcGUID); diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h index 71b9f5a52..e1c1d14a2 100644 --- a/src/server/game/Entities/Creature/GossipDef.h +++ b/src/server/game/Entities/Creature/GossipDef.h @@ -171,19 +171,19 @@ class GossipMenu uint32 GetMenuItemCount() const { - //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); return _menuItems.size(); } bool Empty() const { - //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); return _menuItems.empty(); } GossipMenuItem const* GetItem(uint32 id) const { - //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); GossipMenuItemContainer::const_iterator itr = _menuItems.find(id); if (itr != _menuItems.end()) return &itr->second; @@ -193,7 +193,7 @@ class GossipMenu GossipMenuItemData const* GetItemData(uint32 indexId) const { - //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); GossipMenuItemDataContainer::const_iterator itr = _menuItemData.find(indexId); if (itr != _menuItemData.end()) return &itr->second; @@ -212,8 +212,8 @@ class GossipMenu return _menuItems; } - //ACE_RW_Thread_Mutex& GetLock() const { return *(const_cast(&_menuLock)); } - //ACE_RW_Thread_Mutex _menuLock; // pussywizard + //ACE_RW_Thread_Mutex& GetLock() const { return *(const_cast(&_menuLock)); } + //ACE_RW_Thread_Mutex _menuLock; // pussywizard private: GossipMenuItemContainer _menuItems; @@ -232,13 +232,13 @@ class QuestMenu uint8 GetMenuItemCount() const { - //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); return _questMenuItems.size(); } bool Empty() const { - //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, GetLock()); return _questMenuItems.empty(); } @@ -246,12 +246,12 @@ class QuestMenu QuestMenuItem const& GetItem(uint16 index) const { - //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); + //TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetLock()); return _questMenuItems[index]; } - //ACE_RW_Thread_Mutex& GetLock() const { return *(const_cast(&_menuLock)); } - //ACE_RW_Thread_Mutex _menuLock; // pussywizard + //ACE_RW_Thread_Mutex& GetLock() const { return *(const_cast(&_menuLock)); } + //ACE_RW_Thread_Mutex _menuLock; // pussywizard private: QuestMenuItemList _questMenuItems; diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 5c9bfe8bb..d2bb276d7 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -49,7 +49,7 @@ void TempSummon::Update(uint32 diff) switch (m_type) { case TEMPSUMMON_MANUAL_DESPAWN: - case TEMPSUMMON_DESPAWNED: + case TEMPSUMMON_DESPAWNED: break; case TEMPSUMMON_TIMED_DESPAWN: { @@ -179,17 +179,17 @@ void TempSummon::InitStats(uint32 duration) Unit* owner = GetSummoner(); if (owner) - { - if (IsTrigger() && m_spells[0]) - { - setFaction(owner->getFaction()); - SetLevel(owner->getLevel()); - if (owner->GetTypeId() == TYPEID_PLAYER) - m_ControlledByPlayer = true; - } + { + if (IsTrigger() && m_spells[0]) + { + setFaction(owner->getFaction()); + SetLevel(owner->getLevel()); + if (owner->GetTypeId() == TYPEID_PLAYER) + m_ControlledByPlayer = true; + } - if (owner->GetTypeId() == TYPEID_PLAYER) - m_CreatedByPlayer = true; + if (owner->GetTypeId() == TYPEID_PLAYER) + m_CreatedByPlayer = true; } if (!m_Properties) @@ -224,9 +224,9 @@ void TempSummon::InitSummon() owner->ToCreature()->AI()->JustSummoned(this); } - // Xinef: Allow to call this hook when npc is summoned by gameobject, in this case pass this as summoner to avoid possible null checks - if (IsAIEnabled) - AI()->IsSummonedBy(owner); + // Xinef: Allow to call this hook when npc is summoned by gameobject, in this case pass this as summoner to avoid possible null checks + if (IsAIEnabled) + AI()->IsSummonedBy(owner); } void TempSummon::SetTempSummonType(TempSummonType type) @@ -244,10 +244,10 @@ void TempSummon::UnSummon(uint32 msTime) return; } - // Dont allow to call this function twice (possible) - if (m_type == TEMPSUMMON_DESPAWNED) - return; - SetTempSummonType(TEMPSUMMON_DESPAWNED); + // Dont allow to call this function twice (possible) + if (m_type == TEMPSUMMON_DESPAWNED) + return; + SetTempSummonType(TEMPSUMMON_DESPAWNED); //ASSERT(!IsPet()); if (IsPet()) @@ -301,7 +301,7 @@ void Minion::InitStats(uint32 duration) SetReactState(REACT_PASSIVE); - Unit *m_owner = GetOwner(); + Unit *m_owner = GetOwner(); SetCreatorGUID(m_owner->GetGUID()); setFaction(m_owner->getFaction()); @@ -313,15 +313,15 @@ void Minion::RemoveFromWorld() if (!IsInWorld()) return; - if (Unit *owner = GetOwner()) - owner->SetMinion(this, false); + if (Unit *owner = GetOwner()) + owner->SetMinion(this, false); TempSummon::RemoveFromWorld(); } Unit* Minion::GetOwner() const { - return ObjectAccessor::GetUnit(*this, m_owner); + return ObjectAccessor::GetUnit(*this, m_owner); } bool Minion::IsGuardianPet() const @@ -332,16 +332,16 @@ bool Minion::IsGuardianPet() const void Minion::setDeathState(DeathState s, bool despawn) { Creature::setDeathState(s, despawn); - if (s == JUST_DIED && IsGuardianPet()) - if (Unit* owner = GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER && owner->GetMinionGUID() == GetGUID()) - for (Unit::ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr) - if ((*itr)->IsAlive() && (*itr)->GetEntry() == GetEntry()) - { - owner->SetMinionGUID((*itr)->GetGUID()); - owner->SetPetGUID((*itr)->GetGUID()); - owner->ToPlayer()->CharmSpellInitialize(); - } + if (s == JUST_DIED && IsGuardianPet()) + if (Unit* owner = GetOwner()) + if (owner->GetTypeId() == TYPEID_PLAYER && owner->GetMinionGUID() == GetGUID()) + for (Unit::ControlSet::const_iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr) + if ((*itr)->IsAlive() && (*itr)->GetEntry() == GetEntry()) + { + owner->SetMinionGUID((*itr)->GetGUID()); + owner->SetPetGUID((*itr)->GetGUID()); + owner->ToPlayer()->CharmSpellInitialize(); + } } Guardian::Guardian(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject) : Minion(properties, owner, isWorldObject) @@ -358,7 +358,7 @@ void Guardian::InitStats(uint32 duration) { Minion::InitStats(duration); - Unit *m_owner = GetOwner(); + Unit *m_owner = GetOwner(); InitStatsForLevel(m_owner->getLevel()); if (m_owner->GetTypeId() == TYPEID_PLAYER && HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) @@ -371,7 +371,7 @@ void Guardian::InitSummon() { TempSummon::InitSummon(); - Unit *m_owner = GetOwner(); + Unit *m_owner = GetOwner(); if (m_owner->GetTypeId() == TYPEID_PLAYER && m_owner->GetMinionGUID() == GetGUID() && !m_owner->GetCharmGUID()) @@ -395,15 +395,15 @@ void Puppet::InitSummon() { Minion::InitSummon(); if (!SetCharmedBy(GetOwner(), CHARM_TYPE_POSSESS)) - { - if (Player* p = GetOwner()) - sLog->outMisc("Puppet::InitSummon (A1) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", p->GetTypeId(), p->GetEntry(), p->GetUnitTypeMask(), p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); - else - { - sLog->outMisc("Puppet::InitSummon (B1)"); - //ASSERT(false); // ZOMG! - } - } + { + if (Player* p = GetOwner()) + sLog->outMisc("Puppet::InitSummon (A1) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", p->GetTypeId(), p->GetEntry(), p->GetUnitTypeMask(), p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); + else + { + sLog->outMisc("Puppet::InitSummon (B1)"); + //ASSERT(false); // ZOMG! + } + } } void Puppet::Update(uint32 time) @@ -431,5 +431,5 @@ void Puppet::RemoveFromWorld() Player* Puppet::GetOwner() const { - return ObjectAccessor::GetPlayer(*this, m_owner); + return ObjectAccessor::GetPlayer(*this, m_owner); } diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index c3ffe632a..e5dab557d 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.h @@ -52,8 +52,8 @@ class TempSummon : public Creature Unit* GetSummoner() const; uint64 GetSummonerGUID() { return m_summonerGUID; } TempSummonType const& GetSummonType() { return m_type; } - uint32 GetTimer() { return m_timer; } - void SetTimer(uint32 t) { m_timer = t; } + uint32 GetTimer() { return m_timer; } + void SetTimer(uint32 t) { m_timer = t; } const SummonPropertiesEntry* const m_Properties; private: @@ -69,12 +69,12 @@ class Minion : public TempSummon Minion(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject); void InitStats(uint32 duration); void RemoveFromWorld(); - Unit* GetOwner() const; + Unit* GetOwner() const; float GetFollowAngle() const { return m_followAngle; } void SetFollowAngle(float angle) { m_followAngle = angle; } bool IsPetGhoul() const {return GetEntry() == 26125 /*normal ghoul*/ || GetEntry() == 30230 /*Raise Ally ghoul*/;} // Ghoul may be guardian or pet bool IsGuardianPet() const; - void setDeathState(DeathState s, bool despawn = false); // override virtual Unit::setDeathState + void setDeathState(DeathState s, bool despawn = false); // override virtual Unit::setDeathState protected: const uint64 m_owner; float m_followAngle; @@ -106,7 +106,7 @@ class Puppet : public Minion void Update(uint32 time); void RemoveFromWorld(); protected: - Player* GetOwner() const; + Player* GetOwner() const; const uint64 m_owner; }; diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index 9b305d4d0..4f87f2a66 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -88,8 +88,8 @@ void DynamicObject::RemoveFromWorld() return; UnbindFromCaster(); - if (Transport* transport = GetTransport()) - transport->RemovePassenger(this, true); + if (Transport* transport = GetTransport()) + transport->RemovePassenger(this, true); WorldObject::RemoveFromWorld(); sObjectAccessor->RemoveObject(this); } diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h index f19bbedcb..4a8e4ca27 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.h +++ b/src/server/game/Entities/DynamicObject/DynamicObject.h @@ -59,7 +59,7 @@ class DynamicObject : public WorldObject, public GridObject, publ uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); } uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); } float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); } - bool IsViewpoint() const { return _isViewpoint; } + bool IsViewpoint() const { return _isViewpoint; } protected: Aura* _aura; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 4fec5c0d9..c0db7f37c 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -49,7 +49,7 @@ GameObject::GameObject() : WorldObject(false), MovableMapObject(), m_respawnDelayTime = 300; m_lootState = GO_NOT_READY; m_spawnedByDefault = true; - m_allowModifyDestructibleBuilding = true; + m_allowModifyDestructibleBuilding = true; m_usetimes = 0; m_spellId = 0; m_cooldownTime = 0; @@ -64,7 +64,7 @@ GameObject::GameObject() : WorldObject(false), MovableMapObject(), m_lootRecipientGroup = 0; m_groupLootTimer = 0; lootingGroupLowGUID = 0; - m_lootGenerationTime = 0; + m_lootGenerationTime = 0; ResetLootMode(); // restore default loot mode m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f); @@ -127,7 +127,7 @@ void GameObject::RemoveFromOwner() return; } - // Xinef: not needed + // Xinef: not needed /*const char * ownerType = "creature"; if (IS_PLAYER_GUID(ownerGUID)) ownerType = "player"; @@ -144,7 +144,7 @@ void GameObject::AddToWorld() ///- Register the gameobject for guid lookup if (!IsInWorld()) { - if (m_zoneScript) + if (m_zoneScript) m_zoneScript->OnGameObjectCreate(this); sObjectAccessor->AddObject(this); @@ -173,8 +173,8 @@ void GameObject::RemoveFromWorld() if (m_model) if (GetMap()->ContainsGameObjectModel(*m_model)) GetMap()->RemoveGameObjectModel(*m_model); - if (Transport* transport = GetTransport()) - transport->RemovePassenger(this, true); + if (Transport* transport = GetTransport()) + transport->RemovePassenger(this, true); WorldObject::RemoveFromWorld(); sObjectAccessor->RemoveObject(this); } @@ -182,44 +182,44 @@ void GameObject::RemoveFromWorld() void GameObject::CheckRitualList() { - if (m_unique_users.empty()) - return; - for (std::set::iterator itr = m_unique_users.begin(); itr != m_unique_users.end();) - { - if (*itr == GetOwnerGUID()) - { - ++itr; - continue; - } - bool erase = true; - if (Player* channeler = ObjectAccessor::GetPlayer(*this, *itr)) - if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - if (spell->m_spellInfo->Id == GetGOInfo()->summoningRitual.animSpell) - erase = false; + if (m_unique_users.empty()) + return; + for (std::set::iterator itr = m_unique_users.begin(); itr != m_unique_users.end();) + { + if (*itr == GetOwnerGUID()) + { + ++itr; + continue; + } + bool erase = true; + if (Player* channeler = ObjectAccessor::GetPlayer(*this, *itr)) + if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + if (spell->m_spellInfo->Id == GetGOInfo()->summoningRitual.animSpell) + erase = false; - if (erase) - m_unique_users.erase(itr++); - else - ++itr; - } + if (erase) + m_unique_users.erase(itr++); + else + ++itr; + } } void GameObject::ClearRitualList() { - uint32 animSpell = GetGOInfo()->summoningRitual.animSpell; - if (!animSpell || m_unique_users.empty()) - return; - for (std::set::iterator itr = m_unique_users.begin(); itr != m_unique_users.end(); ++itr) - { - if (Player* channeler = ObjectAccessor::GetPlayer(*this, *itr)) - if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - if (spell->m_spellInfo->Id == animSpell) - { - spell->SendChannelUpdate(0); - spell->finish(); - } - } - m_unique_users.clear(); + uint32 animSpell = GetGOInfo()->summoningRitual.animSpell; + if (!animSpell || m_unique_users.empty()) + return; + for (std::set::iterator itr = m_unique_users.begin(); itr != m_unique_users.end(); ++itr) + { + if (Player* channeler = ObjectAccessor::GetPlayer(*this, *itr)) + if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + if (spell->m_spellInfo->Id == animSpell) + { + spell->SendChannelUpdate(0); + spell->finish(); + } + } + m_unique_users.clear(); } bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit) @@ -262,14 +262,14 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa return false; } - GameObjectAddon const* addon = sObjectMgr->GetGameObjectAddon(guidlow); - // xinef: hackfix - but make it possible to use original WorldRotation (using special gameobject addon data) + GameObjectAddon const* addon = sObjectMgr->GetGameObjectAddon(guidlow); + // xinef: hackfix - but make it possible to use original WorldRotation (using special gameobject addon data) // pussywizard: temporarily calculate WorldRotation from orientation, do so until values in db are correct - if (addon && addon->invisibilityType == INVISIBILITY_GENERAL && addon->InvisibilityValue == 0) - SetWorldRotation(rotation); - else - SetWorldRotationAngles(NormalizeOrientation(GetOrientation()), 0.0f, 0.0f); - // pussywizard: no PathRotation for normal gameobjects + if (addon && addon->invisibilityType == INVISIBILITY_GENERAL && addon->InvisibilityValue == 0) + SetWorldRotation(rotation); + else + SetWorldRotationAngles(NormalizeOrientation(GetOrientation()), 0.0f, 0.0f); + // pussywizard: no PathRotation for normal gameobjects SetTransportPathRotation(0.0f, 0.0f, 0.0f, 1.0f); SetObjectScale(goinfo->size); @@ -389,71 +389,71 @@ void GameObject::Update(uint32 diff) } return; } - case GAMEOBJECT_TYPE_SUMMONING_RITUAL: - { - if (World::GetGameTimeMS() < m_cooldownTime) - return; - GameObjectTemplate const* info = GetGOInfo(); - if (info->summoningRitual.animSpell) - { - // xinef: if ritual requires animation, ensure that all users performs channel - CheckRitualList(); - } - if (GetUniqueUseCount() < info->summoningRitual.reqParticipants) - { - SetLootState(GO_READY); - return; - } + case GAMEOBJECT_TYPE_SUMMONING_RITUAL: + { + if (World::GetGameTimeMS() < m_cooldownTime) + return; + GameObjectTemplate const* info = GetGOInfo(); + if (info->summoningRitual.animSpell) + { + // xinef: if ritual requires animation, ensure that all users performs channel + CheckRitualList(); + } + if (GetUniqueUseCount() < info->summoningRitual.reqParticipants) + { + SetLootState(GO_READY); + return; + } - bool triggered = info->summoningRitual.animSpell; - Unit* owner = GetOwner(); - Unit* spellCaster = owner ? owner : ObjectAccessor::GetPlayer(*this, MAKE_NEW_GUID(m_ritualOwnerGUIDLow, 0, HIGHGUID_PLAYER)); - if (!spellCaster) - { - SetLootState(GO_JUST_DEACTIVATED); - return; - } + bool triggered = info->summoningRitual.animSpell; + Unit* owner = GetOwner(); + Unit* spellCaster = owner ? owner : ObjectAccessor::GetPlayer(*this, MAKE_NEW_GUID(m_ritualOwnerGUIDLow, 0, HIGHGUID_PLAYER)); + if (!spellCaster) + { + SetLootState(GO_JUST_DEACTIVATED); + return; + } - uint32 spellId = info->summoningRitual.spellId; + uint32 spellId = info->summoningRitual.spellId; - if (spellId == 62330) // GO store nonexistent spell, replace by expected - { - // spell have reagent and mana cost but it not expected use its - // it triggered spell in fact casted at currently channeled GO - spellId = 61993; - triggered = true; - } + if (spellId == 62330) // GO store nonexistent spell, replace by expected + { + // spell have reagent and mana cost but it not expected use its + // it triggered spell in fact casted at currently channeled GO + spellId = 61993; + triggered = true; + } - // Cast casterTargetSpell at a random GO user - // on the current DB there is only one gameobject that uses this (Ritual of Doom) - // and its required target number is 1 (outter for loop will run once) - if (info->summoningRitual.casterTargetSpell && info->summoningRitual.casterTargetSpell != 1) // No idea why this field is a bool in some cases - for (uint32 i = 0; i < info->summoningRitual.casterTargetSpellTargets; i++) - // m_unique_users can contain only player GUIDs - if (Player* target = ObjectAccessor::GetPlayer(*this, Trinity::Containers::SelectRandomContainerElement(m_unique_users))) - spellCaster->CastSpell(target, info->summoningRitual.casterTargetSpell, true); + // Cast casterTargetSpell at a random GO user + // on the current DB there is only one gameobject that uses this (Ritual of Doom) + // and its required target number is 1 (outter for loop will run once) + if (info->summoningRitual.casterTargetSpell && info->summoningRitual.casterTargetSpell != 1) // No idea why this field is a bool in some cases + for (uint32 i = 0; i < info->summoningRitual.casterTargetSpellTargets; i++) + // m_unique_users can contain only player GUIDs + if (Player* target = ObjectAccessor::GetPlayer(*this, Trinity::Containers::SelectRandomContainerElement(m_unique_users))) + spellCaster->CastSpell(target, info->summoningRitual.casterTargetSpell, true); - // finish owners spell - // xinef: properly process event cooldowns - if (owner) - { - if (Spell* spell = owner->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - { - spell->SendChannelUpdate(0); - spell->finish(false); - } - } + // finish owners spell + // xinef: properly process event cooldowns + if (owner) + { + if (Spell* spell = owner->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + { + spell->SendChannelUpdate(0); + spell->finish(false); + } + } - // can be deleted now - if (!info->summoningRitual.ritualPersistent) - SetLootState(GO_JUST_DEACTIVATED); - else - SetLootState(GO_READY); + // can be deleted now + if (!info->summoningRitual.ritualPersistent) + SetLootState(GO_JUST_DEACTIVATED); + else + SetLootState(GO_READY); - ClearRitualList(); - spellCaster->CastSpell(spellCaster, spellId, triggered); - return; - } + ClearRitualList(); + spellCaster->CastSpell(spellCaster, spellId, triggered); + return; + } default: m_lootState = GO_READY; // for other GOis same switched without delay to GO_READY break; @@ -522,9 +522,9 @@ void GameObject::Update(uint32 diff) return; } - // Xinef: Call AI Reset (required for example in SmartAI to clear one time events) - if (AI()) - AI()->Reset(); + // Xinef: Call AI Reset (required for example in SmartAI to clear one time events) + if (AI()) + AI()->Reset(); // respawn timer uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr->IsPartOfAPool(GetDBTableGUIDLow()) : 0; @@ -541,8 +541,8 @@ void GameObject::Update(uint32 diff) GameObjectTemplate const* goInfo = GetGOInfo(); if (goInfo->type == GAMEOBJECT_TYPE_TRAP) { - if (World::GetGameTimeMS() < m_cooldownTime) - break; + if (World::GetGameTimeMS() < m_cooldownTime) + break; // Type 2 - Bomb (will go away after casting it's spell) if (goInfo->trap.type == 2) @@ -553,7 +553,7 @@ void GameObject::Update(uint32 diff) break; } - // Type 0 despawns after being triggered, type 1 does not. + // Type 0 despawns after being triggered, type 1 does not. bool isBattlegroundTrap = false; /// @todo This is activation radius. Casting radius must be selected from spell data. @@ -582,7 +582,7 @@ void GameObject::Update(uint32 diff) Trinity::UnitSearcher searcher(this, target, checker); VisitNearbyGridObject(radius, searcher); if (!target) - VisitNearbyWorldObject(radius, searcher); + VisitNearbyWorldObject(radius, searcher); } else // environmental trap { @@ -670,9 +670,9 @@ void GameObject::Update(uint32 diff) SetGoState(GO_STATE_READY); //any return here in case battleground traps - // Xinef: Do not return here for summoned gos that should be deleted few lines below - // Xinef: Battleground objects are treated as spawned by default - if ((GetGOInfo()->flags & GO_FLAG_NODESPAWN) && isSpawnedByDefault()) + // Xinef: Do not return here for summoned gos that should be deleted few lines below + // Xinef: Battleground objects are treated as spawned by default + if ((GetGOInfo()->flags & GO_FLAG_NODESPAWN) && isSpawnedByDefault()) return; } @@ -746,9 +746,9 @@ void GameObject::Delete() SetGoState(GO_STATE_READY); SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); - // Xinef: if ritual gameobject is removed, clear anim spells - if (GetGOInfo()->type == GAMEOBJECT_TYPE_SUMMONING_RITUAL) - ClearRitualList(); + // Xinef: if ritual gameobject is removed, clear anim spells + if (GetGOInfo()->type == GAMEOBJECT_TYPE_SUMMONING_RITUAL) + ClearRitualList(); uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr->IsPartOfAPool(GetDBTableGUIDLow()) : 0; if (poolid) @@ -1031,10 +1031,10 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const Unit* owner = GetOwner(); if (owner) - { - if (seer->isType(TYPEMASK_UNIT) && owner->IsFriendlyTo(seer->ToUnit())) - return true; - } + { + if (seer->isType(TYPEMASK_UNIT) && owner->IsFriendlyTo(seer->ToUnit())) + return true; + } } return false; @@ -1123,10 +1123,10 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target) if (!trapSpell) // checked at load already return; - // xinef: wtf, many spells have range 0 but radius > 0 + // xinef: wtf, many spells have range 0 but radius > 0 float range = float(target->GetSpellMaxRangeForTarget(GetOwner(), trapSpell)); - if (range < 1.0f) - range = 5.0f; + if (range < 1.0f) + range = 5.0f; // search nearest linked GO GameObject* trapGO = NULL; @@ -1143,9 +1143,9 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target) } // found correct GO - // xinef: we should use the trap (checks for despawn type) + // xinef: we should use the trap (checks for despawn type) if (trapGO) - trapGO->Use(target); //trapGO->CastSpell(target, trapInfo->trap.spellId); + trapGO->Use(target); //trapGO->CastSpell(target, trapInfo->trap.spellId); } GameObject* GameObject::LookupFishingHoleAround(float range) @@ -1225,9 +1225,9 @@ void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false * void GameObject::Use(Unit* user) { - // Xinef: we cannot use go with not selectable flags - if (HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE)) - return; + // Xinef: we cannot use go with not selectable flags + if (HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE)) + return; // by default spell caster is user Unit* spellCaster = user; @@ -1262,8 +1262,8 @@ void GameObject::Use(Unit* user) //doors/buttons never really despawn, only reset to default state/flags UseDoorOrButton(0, false, user); - // Xinef: properly link possible traps - if (uint32 trapEntry = GetGOInfo()->button.linkedTrap) + // Xinef: properly link possible traps + if (uint32 trapEntry = GetGOInfo()->button.linkedTrap) TriggeringLinkedGameObject(trapEntry, user); return; case GAMEOBJECT_TYPE_QUESTGIVER: //2 @@ -1335,12 +1335,12 @@ void GameObject::Use(Unit* user) if (itr->second) { if (Player* ChairUser = ObjectAccessor::GetPlayer(*this, itr->second)) - { + { if (ChairUser->IsSitState() && ChairUser->getStandState() != UNIT_STAND_STATE_SIT && ChairUser->GetExactDist2d(x_i, y_i) < 0.1f) continue; // This seat is already occupied by ChairUser. NOTE: Not sure if the ChairUser->getStandState() != UNIT_STAND_STATE_SIT check is required. else itr->second = 0; // This seat is unoccupied. - } + } else itr->second = 0; // The seat may of had an occupant, but they're offline. } @@ -1378,9 +1378,9 @@ void GameObject::Use(Unit* user) { GameObjectTemplate const* info = GetGOInfo(); - // xinef: Goober cannot be used with this flag, skip - if (HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE)) - return; + // xinef: Goober cannot be used with this flag, skip + if (HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE)) + return; if (user->GetTypeId() == TYPEID_PLAYER) { @@ -1422,13 +1422,13 @@ void GameObject::Use(Unit* user) if (uint32 trapEntry = info->goober.linkedTrapId) TriggeringLinkedGameObject(trapEntry, user); - if (info->GetAutoCloseTime()) - { - SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); - SetLootState(GO_ACTIVATED, user); - if (!info->goober.customAnim) - SetGoState(GO_STATE_ACTIVE); - } + if (info->GetAutoCloseTime()) + { + SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + SetLootState(GO_ACTIVATED, user); + if (!info->goober.customAnim) + SetGoState(GO_STATE_ACTIVE); + } // this appear to be ok, however others exist in addition to this that should have custom (ex: 190510, 188692, 187389) if (info->goober.customAnim) @@ -1571,36 +1571,36 @@ void GameObject::Use(Unit* user) } else { - Player* ritualOwner = ObjectAccessor::GetPlayer(*this, MAKE_NEW_GUID(m_ritualOwnerGUIDLow, 0, HIGHGUID_PLAYER)); - if (!ritualOwner) - return; + Player* ritualOwner = ObjectAccessor::GetPlayer(*this, MAKE_NEW_GUID(m_ritualOwnerGUIDLow, 0, HIGHGUID_PLAYER)); + if (!ritualOwner) + return; if (player != ritualOwner && (info->summoningRitual.castersGrouped && !player->IsInSameRaidWith(ritualOwner))) return; } if (info->summoningRitual.animSpell) { - // xinef: if ritual requires animation, ensure that all users performs channel - CheckRitualList(); + // xinef: if ritual requires animation, ensure that all users performs channel + CheckRitualList(); - // xinef: all participants found - if (GetUniqueUseCount() == info->summoningRitual.reqParticipants) - return; + // xinef: all participants found + if (GetUniqueUseCount() == info->summoningRitual.reqParticipants) + return; - player->CastSpell(player, info->summoningRitual.animSpell, true); - } + player->CastSpell(player, info->summoningRitual.animSpell, true); + } AddUniqueUse(player); // full amount unique participants including original summoner if (GetUniqueUseCount() == info->summoningRitual.reqParticipants) { - SetLootState(GO_NOT_READY); + SetLootState(GO_NOT_READY); // can be deleted now, if - if (!info->summoningRitual.animSpell) + if (!info->summoningRitual.animSpell) m_cooldownTime = 0; - else // channel ready, maintain this - m_cooldownTime = World::GetGameTimeMS()+5*IN_MILLISECONDS; + else // channel ready, maintain this + m_cooldownTime = World::GetGameTimeMS()+5*IN_MILLISECONDS; } return; @@ -1613,7 +1613,7 @@ void GameObject::Use(Unit* user) if (info->spellcaster.partyOnly) { - Player const* caster = ObjectAccessor::GetObjectInOrOutOfWorld(GetOwnerGUID(), (Player*)NULL); + Player const* caster = ObjectAccessor::GetObjectInOrOutOfWorld(GetOwnerGUID(), (Player*)NULL); if (!caster || user->GetTypeId() != TYPEID_PLAYER || !user->ToPlayer()->IsInSameRaidWith(caster)) return; } @@ -1822,21 +1822,21 @@ void GameObject::CastSpell(Unit* target, uint32 spellId) if (Unit* owner = GetOwner()) { - trigger->SetLevel(owner->getLevel(), false); + trigger->SetLevel(owner->getLevel(), false); trigger->setFaction(owner->getFaction()); // needed for GO casts for proper target validation checks trigger->SetOwnerGUID(owner->GetGUID()); - // xinef: fixes some duel bugs with traps] - if (owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) - trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - if (owner->IsFFAPvP()) - trigger->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); + // xinef: fixes some duel bugs with traps] + if (owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + if (owner->IsFFAPvP()) + trigger->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - // xinef: Remove Immunity flags - trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - // xinef: set proper orientation, fixes cast against stealthed targets - if (target) - trigger->SetInFront(target); + // xinef: Remove Immunity flags + trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + // xinef: set proper orientation, fixes cast against stealthed targets + if (target) + trigger->SetInFront(target); trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, owner->GetGUID()); } else @@ -1845,9 +1845,9 @@ void GameObject::CastSpell(Unit* target, uint32 spellId) trigger->setFaction(GetGOInfo()->faction ? GetGOInfo()->faction : 14); // Set owner guid for target if no owner availble - needed by trigger auras // - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell()) - // xinef: set proper orientation, fixes cast against stealthed targets - if (target) - trigger->SetInFront(target); + // xinef: set proper orientation, fixes cast against stealthed targets + if (target) + trigger->SetInFront(target); trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, target ? target->GetGUID() : 0); } } @@ -1877,7 +1877,7 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const if (G3D::fuzzyEq(dist, 0.0f)) return true; - float scale = GetFloatValue(OBJECT_FIELD_SCALE_X); + float scale = GetFloatValue(OBJECT_FIELD_SCALE_X); float sinB = dx / dist; float cosB = dy / dist; dx = dist * (cosA * cosB + sinA * sinB); @@ -1957,14 +1957,14 @@ void GameObject::SetWorldRotationAngles(float z_rot, float y_rot, float x_rot) void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, uint32 spellId /*= 0*/) { - if (!IsDestructibleBuilding()) - return; + if (!IsDestructibleBuilding()) + return; if (!m_goValue.Building.MaxHealth || !change) return; - if (!m_allowModifyDestructibleBuilding) - change = 0; + if (!m_allowModifyDestructibleBuilding) + change = 0; // prevent double destructions of the same object if (change < 0 && !m_goValue.Building.Health) @@ -2032,9 +2032,9 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* { EventInform(m_goInfo->building.damagedEvent); sScriptMgr->OnGameObjectDamaged(this, eventInvoker); - if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap()) - if (Battleground* bg = bgMap->GetBG()) - bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent); + if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap()) + if (Battleground* bg = bgMap->GetBG()) + bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.damagedEvent); RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED); SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); @@ -2061,8 +2061,8 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* sScriptMgr->OnGameObjectDestroyed(this, eventInvoker); EventInform(m_goInfo->building.destroyedEvent); if (BattlegroundMap* bgMap = GetMap()->ToBattlegroundMap()) - { - if (Battleground* bg = bgMap->GetBG()) + { + if (Battleground* bg = bgMap->GetBG()) { bg->EventPlayerDamagedGO(eventInvoker, this, m_goInfo->building.destroyedEvent); bg->DestroyGate(eventInvoker, this); @@ -2113,7 +2113,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) { m_lootState = state; AI()->OnStateChanged(state, unit); - sScriptMgr->OnGameObjectLootStateChanged(this, state, unit); + sScriptMgr->OnGameObjectLootStateChanged(this, state, unit); // pussywizard: lootState has nothing to do with collision, it depends entirely on GOState. Loot state is for timed close/open door and respawning, which then sets GOState /*if (m_model) { @@ -2134,7 +2134,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) void GameObject::SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); - sScriptMgr->OnGameObjectStateChanged(this, state); + sScriptMgr->OnGameObjectStateChanged(this, state); if (m_model) { if (!IsInWorld()) @@ -2167,8 +2167,8 @@ void GameObject::SetPhaseMask(uint32 newPhaseMask, bool update) { WorldObject::SetPhaseMask(newPhaseMask, update); - if (m_model && m_model->isEnabled()) - EnableCollision(true); + if (m_model && m_model->isEnabled()) + EnableCollision(true); } void GameObject::EnableCollision(bool enable) @@ -2246,8 +2246,8 @@ bool GameObject::IsLootAllowedFor(Player const* player) const if (player->GetGUID() == m_lootRecipient) return true; - if (player->HasPendingBind()) - return false; + if (player->HasPendingBind()) + return false; Group const* playerGroup = player->GetGroup(); if (!playerGroup || playerGroup != GetLootRecipientGroup()) // if we dont have a group we arent the recipient @@ -2304,25 +2304,25 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t dynFlags |= GO_DYNFLAG_LO_SPARKLE; break; case GAMEOBJECT_TYPE_TRANSPORT: - if (const StaticTransport* t = ToStaticTransport()) - if (t->GetPauseTime()) - { - if (GetGoState() == GO_STATE_READY) - { - if (t->GetPathProgress() >= t->GetPauseTime()) // if not, send 100% progress - pathProgress = int16(float(t->GetPathProgress() - t->GetPauseTime()) / float(t->GetPeriod() - t->GetPauseTime()) * 65535.0f); - } - else - { - if (t->GetPathProgress() <= t->GetPauseTime()) // if not, send 100% progress - pathProgress = int16(float(t->GetPathProgress()) / float(t->GetPauseTime()) * 65535.0f); - } - } - // else it's ignored + if (const StaticTransport* t = ToStaticTransport()) + if (t->GetPauseTime()) + { + if (GetGoState() == GO_STATE_READY) + { + if (t->GetPathProgress() >= t->GetPauseTime()) // if not, send 100% progress + pathProgress = int16(float(t->GetPathProgress() - t->GetPauseTime()) / float(t->GetPeriod() - t->GetPauseTime()) * 65535.0f); + } + else + { + if (t->GetPathProgress() <= t->GetPauseTime()) // if not, send 100% progress + pathProgress = int16(float(t->GetPathProgress()) / float(t->GetPauseTime()) * 65535.0f); + } + } + // else it's ignored break; case GAMEOBJECT_TYPE_MO_TRANSPORT: - if (const MotionTransport* t = ToMotionTransport()) - pathProgress = int16(float(t->GetPathProgress()) / float(t->GetPeriod()) * 65535.0f); + if (const MotionTransport* t = ToMotionTransport()) + pathProgress = int16(float(t->GetPathProgress()) / float(t->GetPeriod()) * 65535.0f); break; default: break; @@ -2374,7 +2374,7 @@ void GameObject::GetRespawnPosition(float &x, float &y, float &z, float* ori /* void GameObject::SetPosition(float x, float y, float z, float o) { - // pussywizard: do not call for MotionTransport and other gobjects not in grid + // pussywizard: do not call for MotionTransport and other gobjects not in grid if (!Trinity::IsValidMapCoord(x, y, z, o)) return; diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 78968e820..e8f7d48b8 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -539,10 +539,10 @@ struct GameObjectTemplate } } - bool IsGameObjectForQuests() const - { - return IsForQuests; - } + bool IsGameObjectForQuests() const + { + return IsForQuests; + } }; // Benchmarked: Faster than std::map (insert/find) @@ -782,8 +782,8 @@ class GameObject : public WorldObject, public GridObject, public Mov bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; } uint32 m_groupLootTimer; // (msecs)timer used for group loot uint32 lootingGroupLowGUID; // used to find group which is looting - void SetLootGenerationTime() { m_lootGenerationTime = time(NULL); } - uint32 GetLootGenerationTime() const { return m_lootGenerationTime; } + void SetLootGenerationTime() { m_lootGenerationTime = time(NULL); } + uint32 GetLootGenerationTime() const { return m_lootGenerationTime; } bool hasQuest(uint32 quest_id) const; bool hasInvolvedQuest(uint32 quest_id) const; @@ -815,7 +815,7 @@ class GameObject : public WorldObject, public GridObject, public Mov void SendMessageToSetInRange(WorldPacket* data, float dist, bool /*self*/, bool includeMargin = false, Player const* skipped_rcvr = NULL); // pussywizard! void ModifyHealth(int32 change, Unit* attackerOrHealer = NULL, uint32 spellId = 0); - void SetDestructibleBuildingModifyState(bool allow) { m_allowModifyDestructibleBuilding = allow; } + void SetDestructibleBuildingModifyState(bool allow) { m_allowModifyDestructibleBuilding = allow; } // sets GameObject type 33 destruction flags and optionally default health for that state void SetDestructibleState(GameObjectDestructibleState state, Player* eventInvoker = NULL, bool setHealth = false); GameObjectDestructibleState GetDestructibleState() const @@ -842,8 +842,8 @@ class GameObject : public WorldObject, public GridObject, public Mov void SetPosition(float x, float y, float z, float o); void SetPosition(const Position &pos) { SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); } - bool IsStaticTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT; } - bool IsMotionTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT; } + bool IsStaticTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT; } + bool IsMotionTransport() const { return GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT; } Transport* ToTransport() { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast(this); else return NULL; } Transport const* ToTransport() const { if (GetGOInfo()->type == GAMEOBJECT_TYPE_MO_TRANSPORT || GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT) return reinterpret_cast(this); else return NULL; } @@ -886,7 +886,7 @@ class GameObject : public WorldObject, public GridObject, public Mov GameObjectTemplate const* m_goInfo; GameObjectData const* m_goData; GameObjectValue m_goValue; - bool m_allowModifyDestructibleBuilding; + bool m_allowModifyDestructibleBuilding; int64 m_packedRotation; G3D::Quat m_worldRotation; @@ -895,10 +895,10 @@ class GameObject : public WorldObject, public GridObject, public Mov uint64 m_lootRecipient; uint32 m_lootRecipientGroup; uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable - uint32 m_lootGenerationTime; + uint32 m_lootGenerationTime; private: - void CheckRitualList(); - void ClearRitualList(); + void CheckRitualList(); + void ClearRitualList(); void RemoveFromOwner(); void SwitchDoorOrButton(bool activate, bool alternative = false); void UpdatePackedRotation(); @@ -907,7 +907,7 @@ class GameObject : public WorldObject, public GridObject, public Mov bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/) const { //! Following check does check 3d distance - dist2compare += obj->GetObjectSize(); + dist2compare += obj->GetObjectSize(); return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare); } GameObjectAI* m_AI; diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 90d90021c..6cccb5cf4 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -450,7 +450,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr SetUInt32Value(ITEM_FIELD_DURABILITY, durability); // update max durability (and durability) if need - // xinef: do not overwrite durability for wrapped items!! + // xinef: do not overwrite durability for wrapped items!! SetUInt32Value(ITEM_FIELD_MAXDURABILITY, proto->MaxDurability); if (durability > proto->MaxDurability && !HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED)) { @@ -758,9 +758,9 @@ bool Item::IsEquipped() const bool Item::CanBeTraded(bool mail, bool trade) const { - // Xinef: little protection - if (m_lootGenerated) - return false; + // Xinef: little protection + if (m_lootGenerated) + return false; if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE) || !trade))) return false; @@ -773,7 +773,7 @@ bool Item::CanBeTraded(bool mail, bool trade) const if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK) return false; - // Xinef: check if item is looted now + // Xinef: check if item is looted now if (owner->GetLootGUID() == GetGUID()) return false; } diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h index cc5bbfc69..467ec80cb 100644 --- a/src/server/game/Entities/Item/ItemPrototype.h +++ b/src/server/game/Entities/Item/ItemPrototype.h @@ -667,7 +667,7 @@ struct ItemTemplate uint32 FoodType; uint32 MinMoneyLoot; uint32 MaxMoneyLoot; - uint32 FlagsCu; + uint32 FlagsCu; WorldPacket queryData; // pussywizard // helpers diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 9661b0eef..11afa36f0 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -326,12 +326,12 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const // 0x08000000 if (unit->m_movementInfo.GetMovementFlags() & MOVEMENTFLAG_SPLINE_ENABLED) - { - if (unit->movespline->_Spline().getPoints(true).empty() || (!unit->movespline->_Spline().getPoints(true).empty() && &unit->movespline->_Spline().getPoints(true)[0] == NULL)) - const_cast(unit)->DisableSpline(); - else - Movement::PacketBuilder::WriteCreate(*unit->movespline, *data); - } + { + if (unit->movespline->_Spline().getPoints(true).empty() || (!unit->movespline->_Spline().getPoints(true).empty() && &unit->movespline->_Spline().getPoints(true)[0] == NULL)) + const_cast(unit)->DisableSpline(); + else + Movement::PacketBuilder::WriteCreate(*unit->movespline, *data); + } } else { @@ -1014,8 +1014,8 @@ void WorldObject::setActive(bool on) map->AddToActive(this->ToCreature()); else if (GetTypeId() == TYPEID_DYNAMICOBJECT) map->AddToActive((DynamicObject*)this); - else if (GetTypeId() == TYPEID_GAMEOBJECT) - map->AddToActive((GameObject*)this); + else if (GetTypeId() == TYPEID_GAMEOBJECT) + map->AddToActive((GameObject*)this); } else { @@ -1023,8 +1023,8 @@ void WorldObject::setActive(bool on) map->RemoveFromActive(this->ToCreature()); else if (GetTypeId() == TYPEID_DYNAMICOBJECT) map->RemoveFromActive((DynamicObject*)this); - else if (GetTypeId() == TYPEID_GAMEOBJECT) - map->RemoveFromActive((GameObject*)this); + else if (GetTypeId() == TYPEID_GAMEOBJECT) + map->RemoveFromActive((GameObject*)this); } } @@ -1315,7 +1315,7 @@ bool Position::HasInArc(float arc, const Position* obj, float targetRadius) cons float lborder = -1 * (arc/2.0f); // in range -pi..0 float rborder = (arc/2.0f); // in range 0..pi - // pussywizard: take into consideration target size + // pussywizard: take into consideration target size if (targetRadius > 0.0f) { float distSq = GetExactDist2dSq(obj); @@ -1338,18 +1338,18 @@ bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2, if (!size) size = GetObjectSize() / 2; - float pdist = obj1->GetExactDist2dSq(obj2) + size / 2.0f; - if (GetExactDist2dSq(obj1) >= pdist || GetExactDist2dSq(obj2) >= pdist) + float pdist = obj1->GetExactDist2dSq(obj2) + size / 2.0f; + if (GetExactDist2dSq(obj1) >= pdist || GetExactDist2dSq(obj2) >= pdist) return false; - if (G3D::fuzzyEq(obj1->GetPositionX(), obj2->GetPositionX())) - return GetPositionX() >= obj1->GetPositionX()-size && GetPositionX() <= obj1->GetPositionX()+size; + if (G3D::fuzzyEq(obj1->GetPositionX(), obj2->GetPositionX())) + return GetPositionX() >= obj1->GetPositionX()-size && GetPositionX() <= obj1->GetPositionX()+size; - float A = (obj2->GetPositionY()-obj1->GetPositionY())/(obj2->GetPositionX()-obj1->GetPositionX()); - float B = -1; - float C = obj1->GetPositionY() - A*obj1->GetPositionX(); - float dist = fabs(A*GetPositionX()+B*GetPositionY()+C)/sqrt(A*A+B*B); - return dist <= size; + float A = (obj2->GetPositionY()-obj1->GetPositionY())/(obj2->GetPositionX()-obj1->GetPositionX()); + float B = -1; + float C = obj1->GetPositionY() - A*obj1->GetPositionX(); + float dist = fabs(A*GetPositionX()+B*GetPositionY()+C)/sqrt(A*A+B*B); + return dist <= size; } bool WorldObject::isInFront(WorldObject const* target, float arc) const @@ -1469,8 +1469,8 @@ float WorldObject::GetGridActivationRange() const return IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP : GetMap()->GetVisibilityRange(); else if (ToCreature()) return ToCreature()->m_SightDistance; - else if (GetTypeId() == TYPEID_GAMEOBJECT && ToGameObject()->IsTransport()) - return GetMap()->GetVisibilityRange(); + else if (GetTypeId() == TYPEID_GAMEOBJECT && ToGameObject()->IsTransport()) + return GetMap()->GetVisibilityRange(); else return 0.0f; } @@ -1492,15 +1492,15 @@ float WorldObject::GetSightRange(const WorldObject* target) const if (ToPlayer()) { if (target) - { - if (target->isActiveObject() && !target->ToPlayer()) - return MAX_VISIBILITY_DISTANCE; - else if (target->GetTypeId() == TYPEID_GAMEOBJECT) - return IsInWintergrasp() && target->IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP+VISIBILITY_INC_FOR_GOBJECTS : GetMap()->GetVisibilityRange()+VISIBILITY_INC_FOR_GOBJECTS; + { + if (target->isActiveObject() && !target->ToPlayer()) + return MAX_VISIBILITY_DISTANCE; + else if (target->GetTypeId() == TYPEID_GAMEOBJECT) + return IsInWintergrasp() && target->IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP+VISIBILITY_INC_FOR_GOBJECTS : GetMap()->GetVisibilityRange()+VISIBILITY_INC_FOR_GOBJECTS; - return IsInWintergrasp() && target->IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP : GetMap()->GetVisibilityRange(); - } - return IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP : GetMap()->GetVisibilityRange(); + return IsInWintergrasp() && target->IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP : GetMap()->GetVisibilityRange(); + } + return IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP : GetMap()->GetVisibilityRange(); } else if (ToCreature()) return ToCreature()->m_SightDistance; @@ -1522,21 +1522,21 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj)) return true; - // Creature scripts - if (Creature const* cObj = obj->ToCreature()) - if (cObj->IsAIEnabled && this->ToPlayer() && !cObj->AI()->CanBeSeen(this->ToPlayer())) - return false; + // Creature scripts + if (Creature const* cObj = obj->ToCreature()) + if (cObj->IsAIEnabled && this->ToPlayer() && !cObj->AI()->CanBeSeen(this->ToPlayer())) + return false; - // pussywizard: arena spectator - if (obj->GetTypeId() == TYPEID_PLAYER) - if (((const Player*)obj)->IsSpectator() && ((const Player*)obj)->FindMap()->IsBattleArena()) - return false; + // pussywizard: arena spectator + if (obj->GetTypeId() == TYPEID_PLAYER) + if (((const Player*)obj)->IsSpectator() && ((const Player*)obj)->FindMap()->IsBattleArena()) + return false; bool corpseVisibility = false; if (distanceCheck) { bool corpseCheck = false; - WorldObject const* viewpoint = this; + WorldObject const* viewpoint = this; if (Player const* thisPlayer = ToPlayer()) { if (thisPlayer->isDead() && thisPlayer->GetHealth() > 0 && // Cheap way to check for ghost state @@ -1551,27 +1551,27 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo } } - // our additional checks - if (Unit const* target = obj->ToUnit()) - { - // xinef: don't allow to detect vehicle accessory if you can't see vehicle base! - if (Unit const* vehicle = target->GetVehicleBase()) - if (!thisPlayer->HaveAtClient(vehicle)) - return false; + // our additional checks + if (Unit const* target = obj->ToUnit()) + { + // xinef: don't allow to detect vehicle accessory if you can't see vehicle base! + if (Unit const* vehicle = target->GetVehicleBase()) + if (!thisPlayer->HaveAtClient(vehicle)) + return false; - // pussywizard: during arena preparation, don't allow to detect pets if can't see its owner (spoils enemy arena frames) - if (target->IsPet() && target->GetOwnerGUID() && target->FindMap()->IsBattleArena() && GetGUID() != target->GetOwnerGUID()) - if (BattlegroundMap* bgmap = target->FindMap()->ToBattlegroundMap()) - if (Battleground* bg = bgmap->GetBG()) - if (bg->GetStatus() < STATUS_IN_PROGRESS && !thisPlayer->HaveAtClient(target->GetOwnerGUID())) - return false; - } + // pussywizard: during arena preparation, don't allow to detect pets if can't see its owner (spoils enemy arena frames) + if (target->IsPet() && target->GetOwnerGUID() && target->FindMap()->IsBattleArena() && GetGUID() != target->GetOwnerGUID()) + if (BattlegroundMap* bgmap = target->FindMap()->ToBattlegroundMap()) + if (Battleground* bg = bgmap->GetBG()) + if (bg->GetStatus() < STATUS_IN_PROGRESS && !thisPlayer->HaveAtClient(target->GetOwnerGUID())) + return false; + } - if (thisPlayer->GetViewpoint()) - viewpoint = thisPlayer->GetViewpoint(); - } + if (thisPlayer->GetViewpoint()) + viewpoint = thisPlayer->GetViewpoint(); + } - // Xinef: check reversely obj vs viewpoint, object could be a gameObject which overrides _IsWithinDist function to include gameobject size + // Xinef: check reversely obj vs viewpoint, object could be a gameObject which overrides _IsWithinDist function to include gameobject size if (!corpseCheck && !viewpoint->IsWithinDist(obj, GetSightRange(obj), true)) return false; } @@ -1607,10 +1607,10 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo if (obj->IsInvisibleDueToDespawn()) return false; - // pussywizard: arena spectator - if (this->GetTypeId() == TYPEID_PLAYER) - if (((const Player*)this)->IsSpectator() && ((const Player*)this)->FindMap()->IsBattleArena() && (obj->m_invisibility.GetFlags() || obj->m_stealth.GetFlags())) - return false; + // pussywizard: arena spectator + if (this->GetTypeId() == TYPEID_PLAYER) + if (((const Player*)this)->IsSpectator() && ((const Player*)this)->FindMap()->IsBattleArena() && (obj->m_invisibility.GetFlags() || obj->m_stealth.GetFlags())) + return false; if (!CanDetect(obj, ignoreStealth, !distanceCheck)) return false; @@ -1620,9 +1620,9 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo bool WorldObject::CanNeverSee(WorldObject const* obj) const { - if (GetTypeId() == TYPEID_UNIT && obj->GetTypeId() == TYPEID_UNIT) - return GetMap() != obj->GetMap() || (!InSamePhase(obj) && ToUnit()->GetVehicleBase() != obj && this != obj->ToUnit()->GetVehicleBase()); - return GetMap() != obj->GetMap() || !InSamePhase(obj); + if (GetTypeId() == TYPEID_UNIT && obj->GetTypeId() == TYPEID_UNIT) + return GetMap() != obj->GetMap() || (!InSamePhase(obj) && ToUnit()->GetVehicleBase() != obj && this != obj->ToUnit()->GetVehicleBase()); + return GetMap() != obj->GetMap() || !InSamePhase(obj); } bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth, bool checkClient) const @@ -1661,8 +1661,8 @@ bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth, bool che bool WorldObject::CanDetectInvisibilityOf(WorldObject const* obj) const { uint32 mask = obj->m_invisibility.GetFlags() & m_invisibilityDetect.GetFlags(); - // xinef: include invisible flags of caster in the mask, 2 invisible objects should be able to detect eachother - mask |= obj->m_invisibility.GetFlags() & m_invisibility.GetFlags(); + // xinef: include invisible flags of caster in the mask, 2 invisible objects should be able to detect eachother + mask |= obj->m_invisibility.GetFlags() & m_invisibility.GetFlags(); // Check for not detected types if (mask != obj->m_invisibility.GetFlags()) @@ -1672,22 +1672,22 @@ bool WorldObject::CanDetectInvisibilityOf(WorldObject const* obj) const // (it's at least true for spell: 66) // It seems like that only Units are affected by this check (couldn't see arena doors with preparation invisibility) if (obj->ToUnit()) - { - uint32 objMask = m_invisibility.GetFlags() & obj->m_invisibilityDetect.GetFlags(); - // xinef: include invisible flags of caster in the mask, 2 invisible objects should be able to detect eachother - objMask |= m_invisibility.GetFlags() & obj->m_invisibility.GetFlags(); + { + uint32 objMask = m_invisibility.GetFlags() & obj->m_invisibilityDetect.GetFlags(); + // xinef: include invisible flags of caster in the mask, 2 invisible objects should be able to detect eachother + objMask |= m_invisibility.GetFlags() & obj->m_invisibility.GetFlags(); if (objMask != m_invisibility.GetFlags()) return false; - } + } for (uint32 i = 0; i < TOTAL_INVISIBILITY_TYPES; ++i) { if (!(mask & (1 << i))) continue; - // xinef: visible for the same invisibility type: - if (m_invisibility.GetValue(InvisibilityType(i)) && obj->m_invisibility.GetValue(InvisibilityType(i))) - continue; + // xinef: visible for the same invisibility type: + if (m_invisibility.GetValue(InvisibilityType(i)) && obj->m_invisibility.GetValue(InvisibilityType(i))) + continue; int32 objInvisibilityValue = obj->m_invisibility.GetValue(InvisibilityType(i)); int32 ownInvisibilityDetectValue = m_invisibilityDetect.GetValue(InvisibilityType(i)); @@ -1709,10 +1709,10 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const if (!obj->m_stealth.GetFlags()) return true; - // dead players shouldnt be able to detect stealth on arenas - if (isType(TYPEMASK_PLAYER)) - if (!ToPlayer()->IsAlive()) - return false; + // dead players shouldnt be able to detect stealth on arenas + if (isType(TYPEMASK_PLAYER)) + if (!ToPlayer()->IsAlive()) + return false; float distance = GetExactDist(obj); float combatReach = 0.0f; @@ -1903,7 +1903,7 @@ void WorldObject::MonsterTextEmote(int32 textId, WorldObject const* target, bool Trinity::LocalizedPacketDo say_do(say_build); Trinity::PlayerDistWorker > say_worker(this, (IsBossEmote ? 200.0f : sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE)), say_do); TypeContainerVisitor >, WorldTypeMapContainer > message(say_worker); - cell.Visit(p, message, *GetMap(), *this, (IsBossEmote ? 200.0f : sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE))); + cell.Visit(p, message, *GetMap(), *this, (IsBossEmote ? 200.0f : sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE))); } void WorldObject::MonsterWhisper(const char* text, Player const* target, bool IsBossWhisper) @@ -2032,7 +2032,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert mask = UNIT_MASK_GUARDIAN; break; case SUMMON_TYPE_TOTEM: - case SUMMON_TYPE_LIGHTWELL: + case SUMMON_TYPE_LIGHTWELL: mask = UNIT_MASK_TOTEM; break; case SUMMON_TYPE_VEHICLE: @@ -2040,7 +2040,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert mask = UNIT_MASK_SUMMON; break; case SUMMON_TYPE_MINIPET: - case SUMMON_TYPE_JEEVES: + case SUMMON_TYPE_JEEVES: mask = UNIT_MASK_MINION; break; default: @@ -2069,11 +2069,11 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert summon = new Guardian(properties, summoner ? summoner->GetGUID() : 0, false); break; case UNIT_MASK_PUPPET: - summon = new Puppet(properties, summoner ? summoner->GetGUID() : 0); - break; + summon = new Puppet(properties, summoner ? summoner->GetGUID() : 0); + break; case UNIT_MASK_TOTEM: - summon = new Totem(properties, summoner ? summoner->GetGUID() : 0); - break; + summon = new Totem(properties, summoner ? summoner->GetGUID() : 0); + break; case UNIT_MASK_MINION: summon = new Minion(properties, summoner ? summoner->GetGUID() : 0, false); break; @@ -2081,7 +2081,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert return NULL; } - EnsureGridLoaded(Cell(pos.GetPositionX(), pos.GetPositionY())); + EnsureGridLoaded(Cell(pos.GetPositionX(), pos.GetPositionY())); if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, vehId, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation())) { delete summon; @@ -2116,8 +2116,8 @@ void Map::SummonCreatureGroup(uint8 group, std::list* list /*= NULL for (std::vector::const_iterator itr = data->begin(); itr != data->end(); ++itr) if (TempSummon* summon = SummonCreature(itr->entry, itr->pos, NULL, itr->time)) - if (list) - list->push_back(summon); + if (list) + list->push_back(summon); } GameObject* Map::SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport) @@ -2136,9 +2136,9 @@ GameObject* Map::SummonGameObject(uint32 entry, float x, float y, float z, float return NULL; } - // Xinef: if gameobject is temporary, set custom spellid - if (respawnTime) - go->SetSpellId(1); + // Xinef: if gameobject is temporary, set custom spellid + if (respawnTime) + go->SetSpellId(1); go->SetRespawnTime(respawnTime); go->SetSpawnedByDefault(false); @@ -2199,9 +2199,9 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float go->SetRespawnTime(respawnTime); - // Xinef: if gameobject is temporary, set custom spellid - if (respawnTime) - go->SetSpellId(1); + // Xinef: if gameobject is temporary, set custom spellid + if (respawnTime) + go->SetSpellId(1); if (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT) //not sure how to handle this ToUnit()->AddGameObject(go); @@ -2226,8 +2226,8 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3 summon->SetLevel(((Unit*)this)->getLevel()); } - // Xinef: correctly set phase mask in case of gameobjects - summon->SetPhaseMask(GetPhaseMask(), false); + // Xinef: correctly set phase mask in case of gameobjects + summon->SetPhaseMask(GetPhaseMask(), false); if (GetAI) summon->AIM_Initialize(GetAI(summon)); @@ -2250,8 +2250,8 @@ void WorldObject::SummonCreatureGroup(uint8 group, std::list* list for (std::vector::const_iterator itr = data->begin(); itr != data->end(); ++itr) if (TempSummon* summon = SummonCreature(itr->entry, itr->pos, itr->type, itr->time)) - if (list) - list->push_back(summon); + if (list) + list->push_back(summon); } Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive) const @@ -2624,7 +2624,7 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle) break; } - pos.Relocate(destx, desty, destz); + pos.Relocate(destx, desty, destz); Trinity::NormalizeMapCoord(pos.m_positionX); Trinity::NormalizeMapCoord(pos.m_positionY); @@ -2638,9 +2638,9 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float float destx, desty, destz; destx = pos.m_positionX + dist * cos(angle); desty = pos.m_positionY + dist * sin(angle); - destz = pos.m_positionZ; - if (isType(TYPEMASK_UNIT|TYPEMASK_PLAYER) && !ToUnit()->IsInWater()) - destz += 2.0f; + destz = pos.m_positionZ; + if (isType(TYPEMASK_UNIT|TYPEMASK_PLAYER) && !ToUnit()->IsInWater()) + destz += 2.0f; // Prevent invalid coordinates here, position is unchanged if (!Trinity::IsValidMapCoord(destx, desty)) @@ -2649,30 +2649,30 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float return; } - // Xinef: ugly hack for dalaran arena - float selfAddition = 1.5f; - float allowedDiff = 6.0f; - float newDist = dist; - if (GetMapId() == 617) - { - allowedDiff = 3.5f; - selfAddition = 1.0f; - destz = pos.m_positionZ + 1.0f; - } - else - UpdateAllowedPositionZ(destx, desty, destz); + // Xinef: ugly hack for dalaran arena + float selfAddition = 1.5f; + float allowedDiff = 6.0f; + float newDist = dist; + if (GetMapId() == 617) + { + allowedDiff = 3.5f; + selfAddition = 1.0f; + destz = pos.m_positionZ + 1.0f; + } + else + UpdateAllowedPositionZ(destx, desty, destz); - bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ+selfAddition, destx, desty, destz+0.5f, destx, desty, destz, -0.5f); + bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ+selfAddition, destx, desty, destz+0.5f, destx, desty, destz, -0.5f); // collision occured if (col) { - // move back a bit - if (pos.GetExactDist2d(destx, desty) > CONTACT_DISTANCE) - { - destx -= CONTACT_DISTANCE * cos(angle); - desty -= CONTACT_DISTANCE * sin(angle); - } + // move back a bit + if (pos.GetExactDist2d(destx, desty) > CONTACT_DISTANCE) + { + destx -= CONTACT_DISTANCE * cos(angle); + desty -= CONTACT_DISTANCE * sin(angle); + } newDist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty)); } @@ -2683,12 +2683,12 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float // Collided with a gameobject if (col) { - // move back a bit - if (pos.GetExactDist2d(destx, desty) > CONTACT_DISTANCE) - { - destx -= CONTACT_DISTANCE * cos(angle); - desty -= CONTACT_DISTANCE * sin(angle); - } + // move back a bit + if (pos.GetExactDist2d(destx, desty) > CONTACT_DISTANCE) + { + destx -= CONTACT_DISTANCE * cos(angle); + desty -= CONTACT_DISTANCE * sin(angle); + } newDist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty)); } @@ -2715,115 +2715,115 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float float ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); float floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, destz, true); ground = fabs(ground - destz) <= fabs(floor - pos.m_positionZ) ? ground : floor; - if (destz < ground) - destz = ground; + if (destz < ground) + destz = ground; - // Xinef: check if last z updates did not move z too far away - //newDist = pos.GetExactDist(destx, desty, destz); - //float ratio = newDist / dist; - //if (ratio > 1.3f) - //{ - // ratio = (1 / ratio) + (0.3f / ratio); - // destx = pos.GetPositionX() + (fabs(destx - pos.GetPositionX()) * cos(angle) * ratio); - // desty = pos.GetPositionY() + (fabs(desty - pos.GetPositionY()) * sin(angle) * ratio); - // destz = pos.GetPositionZ() + (fabs(destz - pos.GetPositionZ()) * ratio * (destz < pos.GetPositionZ() ? -1.0f : 1.0f)); - //} + // Xinef: check if last z updates did not move z too far away + //newDist = pos.GetExactDist(destx, desty, destz); + //float ratio = newDist / dist; + //if (ratio > 1.3f) + //{ + // ratio = (1 / ratio) + (0.3f / ratio); + // destx = pos.GetPositionX() + (fabs(destx - pos.GetPositionX()) * cos(angle) * ratio); + // desty = pos.GetPositionY() + (fabs(desty - pos.GetPositionY()) * sin(angle) * ratio); + // destz = pos.GetPositionZ() + (fabs(destz - pos.GetPositionZ()) * ratio * (destz < pos.GetPositionZ() ? -1.0f : 1.0f)); + //} - pos.Relocate(destx, desty, destz); + pos.Relocate(destx, desty, destz); pos.m_orientation = m_orientation; } void WorldObject::MovePositionToFirstCollisionForTotem(Position &pos, float dist, float angle, bool forGameObject) { - angle += m_orientation; - float destx, desty, destz, ground, floor; - pos.m_positionZ += 2.0f; - destx = pos.m_positionX + dist * cos(angle); - desty = pos.m_positionY + dist * sin(angle); - destz = pos.GetPositionZ(); + angle += m_orientation; + float destx, desty, destz, ground, floor; + pos.m_positionZ += 2.0f; + destx = pos.m_positionX + dist * cos(angle); + desty = pos.m_positionY + dist * sin(angle); + destz = pos.GetPositionZ(); - // Prevent invalid coordinates here, position is unchanged - if (!Trinity::IsValidMapCoord(destx, desty)) - { - sLog->outCrash("WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty); - return; - } + // Prevent invalid coordinates here, position is unchanged + if (!Trinity::IsValidMapCoord(destx, desty)) + { + sLog->outCrash("WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty); + return; + } - bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ, destx, desty, destz, destx, desty, destz, -0.5f); + bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ, destx, desty, destz, destx, desty, destz, -0.5f); - // collision occured - if (col) - { - // move back a bit - if (pos.GetExactDist2d(destx, desty) > CONTACT_DISTANCE) - { - destx -= CONTACT_DISTANCE * cos(angle); - desty -= CONTACT_DISTANCE * sin(angle); - } + // collision occured + if (col) + { + // move back a bit + if (pos.GetExactDist2d(destx, desty) > CONTACT_DISTANCE) + { + destx -= CONTACT_DISTANCE * cos(angle); + desty -= CONTACT_DISTANCE * sin(angle); + } - dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty)); - } + dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty)); + } - // check dynamic collision - col = GetMap()->getObjectHitPos(GetPhaseMask(), pos.m_positionX, pos.m_positionY, pos.m_positionZ+0.5f, destx, desty, destz+0.5f, destx, desty, destz, -0.5f); + // check dynamic collision + col = GetMap()->getObjectHitPos(GetPhaseMask(), pos.m_positionX, pos.m_positionY, pos.m_positionZ+0.5f, destx, desty, destz+0.5f, destx, desty, destz, -0.5f); - // Collided with a gameobject - if (col) - { - // move back a bit - if (pos.GetExactDist2d(destx, desty) > CONTACT_DISTANCE) - { - destx -= CONTACT_DISTANCE * cos(angle); - desty -= CONTACT_DISTANCE * sin(angle); - } - dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty)); - } + // Collided with a gameobject + if (col) + { + // move back a bit + if (pos.GetExactDist2d(destx, desty) > CONTACT_DISTANCE) + { + destx -= CONTACT_DISTANCE * cos(angle); + desty -= CONTACT_DISTANCE * sin(angle); + } + dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty)); + } - float prevdx = destx, prevdy = desty, prevdz = destz; - bool anyvalid = false; + float prevdx = destx, prevdy = desty, prevdz = destz; + bool anyvalid = false; - ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); - floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); - destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; + ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); + floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); + destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; - // xinef: if we have gameobject, store last valid ground position - // xinef: I assume you wanted to spawn totem in air and allow it to fall down if no valid position was found - if (forGameObject) - prevdz = destz; + // xinef: if we have gameobject, store last valid ground position + // xinef: I assume you wanted to spawn totem in air and allow it to fall down if no valid position was found + if (forGameObject) + prevdz = destz; - float step = dist/10.0f; - for (uint8 j = 0; j < 10; ++j) - { - // do not allow too big z changes - if (fabs(pos.m_positionZ - destz) > 4.0f) - { - destx -= step * cos(angle); - desty -= step * sin(angle); - ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); - floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); - destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; - if (j == 9 && fabs(pos.m_positionZ - destz) <= 4.0f) - anyvalid = true; - } - // we have correct destz now - else - { - anyvalid = true; - break; - } - } - if (!anyvalid) - { - destx = prevdx; - desty = prevdy; - destz = prevdz; - } + float step = dist/10.0f; + for (uint8 j = 0; j < 10; ++j) + { + // do not allow too big z changes + if (fabs(pos.m_positionZ - destz) > 4.0f) + { + destx -= step * cos(angle); + desty -= step * sin(angle); + ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); + floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); + destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; + if (j == 9 && fabs(pos.m_positionZ - destz) <= 4.0f) + anyvalid = true; + } + // we have correct destz now + else + { + anyvalid = true; + break; + } + } + if (!anyvalid) + { + destx = prevdx; + desty = prevdy; + destz = prevdz; + } - Trinity::NormalizeMapCoord(destx); - Trinity::NormalizeMapCoord(desty); + Trinity::NormalizeMapCoord(destx); + Trinity::NormalizeMapCoord(desty); - pos.Relocate(destx, desty, destz); - pos.m_orientation = m_orientation; + pos.Relocate(destx, desty, destz); + pos.m_orientation = m_orientation; } void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update) @@ -2891,28 +2891,28 @@ void WorldObject::UpdateObjectVisibility(bool /*forced*/, bool /*fromUpdate*/) void WorldObject::AddToNotify(uint16 f) { - if (!(m_notifyflags & f)) - if (Unit* u = ToUnit()) - { - if (f & NOTIFY_VISIBILITY_CHANGED) - { - uint32 EVENT_VISIBILITY_DELAY = u->FindMap() ? DynamicVisibilityMgr::GetVisibilityNotifyDelay(u->FindMap()->GetEntry()->map_type) : 1000; + if (!(m_notifyflags & f)) + if (Unit* u = ToUnit()) + { + if (f & NOTIFY_VISIBILITY_CHANGED) + { + uint32 EVENT_VISIBILITY_DELAY = u->FindMap() ? DynamicVisibilityMgr::GetVisibilityNotifyDelay(u->FindMap()->GetEntry()->map_type) : 1000; - uint32 diff = getMSTimeDiff(u->m_last_notify_mstime, World::GetGameTimeMS()); - if (diff >= EVENT_VISIBILITY_DELAY/2) - EVENT_VISIBILITY_DELAY /= 2; - else - EVENT_VISIBILITY_DELAY -= diff; - u->m_delayed_unit_relocation_timer = EVENT_VISIBILITY_DELAY; - u->m_last_notify_mstime = World::GetGameTimeMS()+EVENT_VISIBILITY_DELAY-1; - } - else if (f & NOTIFY_AI_RELOCATION) - { - u->m_delayed_unit_ai_notify_timer = u->FindMap() ? DynamicVisibilityMgr::GetAINotifyDelay(u->FindMap()->GetEntry()->map_type) : 500; - } + uint32 diff = getMSTimeDiff(u->m_last_notify_mstime, World::GetGameTimeMS()); + if (diff >= EVENT_VISIBILITY_DELAY/2) + EVENT_VISIBILITY_DELAY /= 2; + else + EVENT_VISIBILITY_DELAY -= diff; + u->m_delayed_unit_relocation_timer = EVENT_VISIBILITY_DELAY; + u->m_last_notify_mstime = World::GetGameTimeMS()+EVENT_VISIBILITY_DELAY-1; + } + else if (f & NOTIFY_AI_RELOCATION) + { + u->m_delayed_unit_ai_notify_timer = u->FindMap() ? DynamicVisibilityMgr::GetAINotifyDelay(u->FindMap()->GetEntry()->map_type) : 500; + } - m_notifyflags |= f; - } + m_notifyflags |= f; + } } struct WorldObjectChangeAccumulator @@ -2921,9 +2921,9 @@ struct WorldObjectChangeAccumulator UpdatePlayerSet& i_playerSet; WorldObject& i_object; WorldObjectChangeAccumulator(WorldObject &obj, UpdateDataMapType &d, UpdatePlayerSet &p) : i_updateDatas(d), i_playerSet(p), i_object(obj) - { - i_playerSet.clear(); - } + { + i_playerSet.clear(); + } void Visit(PlayerMapType &m) { Player* source = NULL; @@ -3004,14 +3004,14 @@ void WorldObject::BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet& play void WorldObject::GetCreaturesWithEntryInRange(std::list &creatureList, float radius, uint32 entry) { - CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY())); + CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY())); Cell cell(pair); cell.SetNoCreate(); Trinity::AllCreaturesOfEntryInRange check(this, entry, radius); Trinity::CreatureListSearcher searcher(this, creatureList, check); - TypeContainerVisitor, WorldTypeMapContainer> world_visitor(searcher); + TypeContainerVisitor, WorldTypeMapContainer> world_visitor(searcher); cell.Visit(pair, world_visitor, *(this->GetMap()), *this, radius); TypeContainerVisitor, GridTypeMapContainer> grid_visitor(searcher); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index d7fdccced..1121e8cbf 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -90,7 +90,7 @@ enum TempSummonType TEMPSUMMON_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death TEMPSUMMON_DEAD_DESPAWN = 7, // despawns when the creature disappears TEMPSUMMON_MANUAL_DESPAWN = 8, // despawns when UnSummon() is called - TEMPSUMMON_DESPAWNED = 9, // xinef: DONT USE, INTERNAL USE ONLY + TEMPSUMMON_DESPAWNED = 9, // xinef: DONT USE, INTERNAL USE ONLY }; enum PhaseMasks @@ -145,7 +145,7 @@ class Object uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); } void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); } - virtual void SetObjectScale(float scale) { SetFloatValue(OBJECT_FIELD_SCALE_X, scale); } + virtual void SetObjectScale(float scale) { SetFloatValue(OBJECT_FIELD_SCALE_X, scale); } TypeID GetTypeId() const { return m_objectTypeId; } bool isType(uint16 mask) const { return (mask & m_objectType); } @@ -579,14 +579,14 @@ class WorldLocation : public Position void WorldRelocate(const WorldLocation &loc) { - m_mapId = loc.GetMapId(); - Relocate(loc); - } + m_mapId = loc.GetMapId(); + Relocate(loc); + } uint32 GetMapId() const - { - return m_mapId; - } + { + return m_mapId; + } WorldLocation GetWorldLocation() const { @@ -642,7 +642,7 @@ class MovableMapObject { friend class Map; //map for moving creatures friend class ObjectGridLoader; //grid loader for loading creatures - template friend class RandomMovementGenerator; + template friend class RandomMovementGenerator; protected: MovableMapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE) {} @@ -728,9 +728,9 @@ class WorldObject : public Object, public WorldLocation bool InSamePhase(WorldObject const* obj) const { return InSamePhase(obj->GetPhaseMask()); } bool InSamePhase(uint32 phasemask) const { return (GetPhaseMask() & phasemask); } - virtual uint32 GetZoneId(bool forceRecalc = false) const; - virtual uint32 GetAreaId(bool forceRecalc = false) const; - virtual void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, bool forceRecalc = false) const; + virtual uint32 GetZoneId(bool forceRecalc = false) const; + virtual uint32 GetAreaId(bool forceRecalc = false) const; + virtual void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, bool forceRecalc = false) const; InstanceScript* GetInstanceScript(); @@ -808,9 +808,9 @@ class WorldObject : public Object, public WorldLocation virtual void CleanupsBeforeDelete(bool finalCleanup = true); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units - virtual void SendMessageToSet(WorldPacket* data, bool self) { if (IsInWorld()) SendMessageToSetInRange(data, GetVisibilityRange(), self, true); } // pussywizard! + virtual void SendMessageToSet(WorldPacket* data, bool self) { if (IsInWorld()) SendMessageToSetInRange(data, GetVisibilityRange(), self, true); } // pussywizard! virtual void SendMessageToSetInRange(WorldPacket* data, float dist, bool /*self*/, bool includeMargin = false, Player const* skipped_rcvr = NULL); // pussywizard! - virtual void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr) { if (IsInWorld()) SendMessageToSetInRange(data, GetVisibilityRange(), false, true, skipped_rcvr); } // pussywizard! + virtual void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr) { if (IsInWorld()) SendMessageToSetInRange(data, GetVisibilityRange(), false, true, skipped_rcvr); } // pussywizard! virtual uint8 getLevelForTarget(WorldObject const* /*target*/) const { return 1; } @@ -887,11 +887,11 @@ class WorldObject : public Object, public WorldLocation void DestroyForNearbyPlayers(); virtual void UpdateObjectVisibility(bool forced = true, bool fromUpdate = false); void BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet& player_set); - void GetCreaturesWithEntryInRange(std::list &creatureList, float radius, uint32 entry); + void GetCreaturesWithEntryInRange(std::list &creatureList, float radius, uint32 entry); //relocation and visibility system functions void AddToNotify(uint16 f); - void RemoveFromNotify(uint16 f) { m_notifyflags &= ~f; } + void RemoveFromNotify(uint16 f) { m_notifyflags &= ~f; } bool isNeedNotify(uint16 f) const { return m_notifyflags & f;} uint16 GetNotifyFlags() const { return m_notifyflags; } bool NotifyExecuted(uint16 f) const { return m_executed_notifies & f;} @@ -908,10 +908,10 @@ class WorldObject : public Object, public WorldLocation template void VisitNearbyGridObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitGrid(GetPositionX(), GetPositionY(), radius, notifier); } template void VisitNearbyWorldObject(float const& radius, NOTIFIER& notifier) const { if (IsInWorld()) GetMap()->VisitWorld(GetPositionX(), GetPositionY(), radius, notifier); } - bool IsInWintergrasp() const - { - return GetMapId() == 571 && GetPositionX() > 3733.33331f && GetPositionX() < 5866.66663f && GetPositionY() > 1599.99999f && GetPositionY() < 4799.99997f; - } + bool IsInWintergrasp() const + { + return GetMapId() == 571 && GetPositionX() > 3733.33331f && GetPositionX() < 5866.66663f && GetPositionY() > 1599.99999f && GetPositionY() < 4799.99997f; + } #ifdef MAP_BASED_RAND_GEN int32 irand(int32 min, int32 max) const { return int32 (GetMap()->mtRand.randInt(max - min)) + min; } diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h index 4ea8f689b..5c6dde3e8 100644 --- a/src/server/game/Entities/Object/ObjectDefines.h +++ b/src/server/game/Entities/Object/ObjectDefines.h @@ -35,7 +35,7 @@ enum HighGuid HIGHGUID_CORPSE = 0xF101, // blizz F100 HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT) HIGHGUID_GROUP = 0x1F50, - HIGHGUID_INSTANCE = 0x1F42, // blizz 1F42/1F44/1F44/1F47 + HIGHGUID_INSTANCE = 0x1F42, // blizz 1F42/1F44/1F44/1F47 }; // used for creating values for respawn for example diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 511cd5f7a..1c07c1ac5 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -68,22 +68,22 @@ void Pet::AddToWorld() ///- Register the pet for guid lookup sObjectAccessor->AddObject(this); Unit::AddToWorld(); - Motion_Initialize(); + Motion_Initialize(); AIM_Initialize(); } - // pussywizard: apply ICC buff to pets - if (IS_PLAYER_GUID(GetOwnerGUID()) && GetMapId() == 631 && FindMap() && FindMap()->ToInstanceMap() && FindMap()->ToInstanceMap()->GetInstanceScript() && FindMap()->ToInstanceMap()->GetInstanceScript()->GetData(251 /*DATA_BUFF_AVAILABLE*/)) - if (Unit* owner = GetOwner()) - if (Player* plr = owner->ToPlayer()) - { - SpellAreaForAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForAreaMapBounds(4812); - for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) - if ((itr->second->raceMask & plr->getRaceMask()) && !HasAura(itr->second->spellId)) - if (const SpellInfo* si = sSpellMgr->GetSpellInfo(itr->second->spellId)) - if (si->HasAura(SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT)) - AddAura(itr->second->spellId, this); - } + // pussywizard: apply ICC buff to pets + if (IS_PLAYER_GUID(GetOwnerGUID()) && GetMapId() == 631 && FindMap() && FindMap()->ToInstanceMap() && FindMap()->ToInstanceMap()->GetInstanceScript() && FindMap()->ToInstanceMap()->GetInstanceScript()->GetData(251 /*DATA_BUFF_AVAILABLE*/)) + if (Unit* owner = GetOwner()) + if (Player* plr = owner->ToPlayer()) + { + SpellAreaForAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForAreaMapBounds(4812); + for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) + if ((itr->second->raceMask & plr->getRaceMask()) && !HasAura(itr->second->spellId)) + if (const SpellInfo* si = sSpellMgr->GetSpellInfo(itr->second->spellId)) + if (si->HasAura(SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT)) + AddAura(itr->second->spellId, this); + } // Prevent stuck pets when zoning. Pets default to "follow" when added to world // so we'll reset flags and let the AI handle things @@ -111,13 +111,13 @@ void Pet::RemoveFromWorld() bool Pet::LoadPetFromDB(Player* owner, uint8 asynchLoadType, uint32 petentry, uint32 petnumber, bool current, AsynchPetSummon* info) { - // we are loading pet at that moment - if (owner->IsSpectator() || owner->GetPet() || !owner->IsInWorld() || !owner->FindMap()) - return false; + // we are loading pet at that moment + if (owner->IsSpectator() || owner->GetPet() || !owner->IsInWorld() || !owner->FindMap()) + return false; - // DK Pet exception - if (owner->getClass() == CLASS_DEATH_KNIGHT && !owner->CanSeeDKPet()) - return false; + // DK Pet exception + if (owner->getClass() == CLASS_DEATH_KNIGHT && !owner->CanSeeDKPet()) + return false; uint32 ownerid = owner->GetGUIDLow(); PreparedStatement* stmt; @@ -154,22 +154,22 @@ bool Pet::LoadPetFromDB(Player* owner, uint8 asynchLoadType, uint32 petentry, ui stmt->setUInt8(2, uint8(PET_SAVE_LAST_STABLE_SLOT)); } - if (AsynchPetSummon* info = owner->GetSession()->_loadPetFromDBFirstCallback.GetSecondParam()) - delete info; - owner->GetSession()->_loadPetFromDBFirstCallback.Reset(); - owner->GetSession()->_loadPetFromDBFirstCallback.SetFirstParam(asynchLoadType); - owner->GetSession()->_loadPetFromDBFirstCallback.SetSecondParam(info); - owner->GetSession()->_loadPetFromDBFirstCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt)); - return true; + if (AsynchPetSummon* info = owner->GetSession()->_loadPetFromDBFirstCallback.GetSecondParam()) + delete info; + owner->GetSession()->_loadPetFromDBFirstCallback.Reset(); + owner->GetSession()->_loadPetFromDBFirstCallback.SetFirstParam(asynchLoadType); + owner->GetSession()->_loadPetFromDBFirstCallback.SetSecondParam(info); + owner->GetSession()->_loadPetFromDBFirstCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt)); + return true; } void Pet::SavePetToDB(PetSaveMode mode, bool logout) { - // not save not player pets + // not save not player pets if (!IS_PLAYER_GUID(GetOwnerGUID())) return; - // dont allow to save pet when it is loaded, possibly bugs action bar!, save only fully controlled creature + // dont allow to save pet when it is loaded, possibly bugs action bar!, save only fully controlled creature Player* owner = GetOwner()->ToPlayer(); if (!owner || m_loading || !GetEntry() || !isControlled()) return; @@ -233,29 +233,29 @@ void Pet::SavePetToDB(PetSaveMode mode, bool logout) } // save pet - stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHAR_PET); - stmt->setUInt32(0, m_charmInfo->GetPetNumber()); - stmt->setUInt32(1, GetEntry()); - stmt->setUInt32(2, ownerLowGUID); - stmt->setUInt32(3, GetNativeDisplayId()); - stmt->setUInt32(4, GetUInt32Value(UNIT_CREATED_BY_SPELL)); - stmt->setUInt8(5, uint8(getPetType())); - stmt->setUInt8(6, getLevel()); - stmt->setUInt32(7, GetUInt32Value(UNIT_FIELD_PETEXPERIENCE)); - stmt->setUInt8(8, uint8(GetReactState())); - stmt->setString(9, GetName()); - stmt->setUInt8(10, uint8(HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ? 0 : 1)); - stmt->setUInt8(11, uint8(mode)); - stmt->setUInt32(12, curhealth); - stmt->setUInt32(13, curmana); - stmt->setUInt32(14, GetPower(POWER_HAPPINESS)); - stmt->setUInt32(15, time(NULL)); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHAR_PET); + stmt->setUInt32(0, m_charmInfo->GetPetNumber()); + stmt->setUInt32(1, GetEntry()); + stmt->setUInt32(2, ownerLowGUID); + stmt->setUInt32(3, GetNativeDisplayId()); + stmt->setUInt32(4, GetUInt32Value(UNIT_CREATED_BY_SPELL)); + stmt->setUInt8(5, uint8(getPetType())); + stmt->setUInt8(6, getLevel()); + stmt->setUInt32(7, GetUInt32Value(UNIT_FIELD_PETEXPERIENCE)); + stmt->setUInt8(8, uint8(GetReactState())); + stmt->setString(9, GetName()); + stmt->setUInt8(10, uint8(HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ? 0 : 1)); + stmt->setUInt8(11, uint8(mode)); + stmt->setUInt32(12, curhealth); + stmt->setUInt32(13, curmana); + stmt->setUInt32(14, GetPower(POWER_HAPPINESS)); + stmt->setUInt32(15, time(NULL)); - std::ostringstream ss; - for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i) + std::ostringstream ss; + for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i) ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << ' ' << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' '; - stmt->setString(16, ss.str()); + stmt->setString(16, ss.str()); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); @@ -373,26 +373,26 @@ void Pet::Update(uint32 diff) } // xinef: m_regenTimer is decrased in Creature::Update() - // xinef: just check if we can update focus in current period - if (getPowerType() == POWER_FOCUS) - { - m_petRegenTimer -= diff; - if (m_petRegenTimer <= int32(0)) - { - m_petRegenTimer += PET_FOCUS_REGEN_INTERVAL; - Regenerate(POWER_FOCUS); - } - } + // xinef: just check if we can update focus in current period + if (getPowerType() == POWER_FOCUS) + { + m_petRegenTimer -= diff; + if (m_petRegenTimer <= int32(0)) + { + m_petRegenTimer += PET_FOCUS_REGEN_INTERVAL; + Regenerate(POWER_FOCUS); + } + } if (getPetType() == HUNTER_PET) - { - m_happinessTimer -= diff; - if (m_happinessTimer <= int32(0)) - { - LoseHappiness(); - m_happinessTimer += PET_LOSE_HAPPINES_INTERVAL; - } - } + { + m_happinessTimer -= diff; + if (m_happinessTimer <= int32(0)) + { + LoseHappiness(); + m_happinessTimer += PET_LOSE_HAPPINES_INTERVAL; + } + } break; } @@ -561,21 +561,21 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetLevel(petlevel); SetCanModifyStats(true); - Unit *m_owner = GetOwner(); - if (!m_owner) // just to be sure, asynchronous now - { - DespawnOrUnsummon(1000); - return false; - } + Unit *m_owner = GetOwner(); + if (!m_owner) // just to be sure, asynchronous now + { + DespawnOrUnsummon(1000); + return false; + } //Determine pet type PetType petType = MAX_PET_TYPE; if (IsPet() && m_owner->GetTypeId() == TYPEID_PLAYER) { if (m_owner->getClass() == CLASS_WARLOCK || - m_owner->getClass() == CLASS_SHAMAN || // Fire Elemental - m_owner->getClass() == CLASS_DEATH_KNIGHT || // Risen Ghoul - m_owner->getClass() == CLASS_MAGE) // Water Elemental with glyph + m_owner->getClass() == CLASS_SHAMAN || // Fire Elemental + m_owner->getClass() == CLASS_DEATH_KNIGHT || // Risen Ghoul + m_owner->getClass() == CLASS_MAGE) // Water Elemental with glyph petType = SUMMON_PET; else if (m_owner->getClass() == CLASS_HUNTER) { @@ -592,13 +592,13 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(petlevel*50)); - uint32 attackTime = BASE_ATTACK_TIME; - if (m_owner->getClass() != CLASS_HUNTER && cinfo->baseattacktime >= 1000) - attackTime = cinfo->baseattacktime; + uint32 attackTime = BASE_ATTACK_TIME; + if (m_owner->getClass() != CLASS_HUNTER && cinfo->baseattacktime >= 1000) + attackTime = cinfo->baseattacktime; - SetAttackTime(BASE_ATTACK, attackTime); + SetAttackTime(BASE_ATTACK, attackTime); SetAttackTime(OFF_ATTACK, attackTime); - SetAttackTime(RANGED_ATTACK, BASE_ATTACK_TIME); + SetAttackTime(RANGED_ATTACK, BASE_ATTACK_TIME); SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); @@ -618,22 +618,22 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) } // Resistance - // xinef: hunter pets should not inherit template resistances - if (!IsHunterPet()) - for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(cinfo->resistance[i])); + // xinef: hunter pets should not inherit template resistances + if (!IsHunterPet()) + for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) + SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(cinfo->resistance[i])); //health, mana, armor and resistance PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(creature_ID, petlevel); if (pInfo) // exist in DB { SetCreateHealth(pInfo->health); - SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)pInfo->health); + SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)pInfo->health); if (petType != HUNTER_PET) //hunter pet use focus - { + { SetCreateMana(pInfo->mana); - SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, (float)pInfo->mana); - } + SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, (float)pInfo->mana); + } if (pInfo->armor > 0) SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(pInfo->armor)); @@ -645,16 +645,16 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) { // remove elite bonuses included in DB values CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(petlevel, cinfo->unit_class); - // xinef: multiply base values by creature_template factors! - float factorHealth = m_owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModHealth) : cinfo->ModHealth; - float factorMana = m_owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModMana) : cinfo->ModMana; + // xinef: multiply base values by creature_template factors! + float factorHealth = m_owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModHealth) : cinfo->ModHealth; + float factorMana = m_owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModMana) : cinfo->ModMana; - SetCreateHealth(std::max(1, stats->BaseHealth[cinfo->expansion]*factorHealth)); - SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, GetCreateHealth()); + SetCreateHealth(std::max(1, stats->BaseHealth[cinfo->expansion]*factorHealth)); + SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, GetCreateHealth()); SetCreateMana(stats->BaseMana*factorMana); - SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, GetCreateMana()); + SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, GetCreateMana()); - // xinef: added some multipliers so debuffs can affect pets in any way... + // xinef: added some multipliers so debuffs can affect pets in any way... SetCreateStat(STAT_STRENGTH, 22 + 2*petlevel); SetCreateStat(STAT_AGILITY, 22 + 1.5f*petlevel); SetCreateStat(STAT_STAMINA, 25 + 2*petlevel); @@ -666,41 +666,41 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) { case HUNTER_PET: { - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); - SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32(sObjectMgr->GetXPForLevel(petlevel)*PET_XP_FACTOR)); break; } case SUMMON_PET: { - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); - SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); - switch(GetEntry()) + switch(GetEntry()) { case NPC_FELGUARD: { - float highAmt = petlevel / 11.0f; - float lowAmt = petlevel / 12.0f; + float highAmt = petlevel / 11.0f; + float lowAmt = petlevel / 12.0f; - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, lowAmt*lowAmt*lowAmt); - SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, highAmt*highAmt*highAmt); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, lowAmt*lowAmt*lowAmt); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, highAmt*highAmt*highAmt); - // xinef: Glyph of Felguard, so ugly im crying... no appropriate spell + // xinef: Glyph of Felguard, so ugly im crying... no appropriate spell if (AuraEffect* aurEff = m_owner->GetAuraEffectDummy(SPELL_GLYPH_OF_FELGUARD)) SetModifierValue(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, 1.0f + float(aurEff->GetAmount() / 100.0f)); break; } - case NPC_WATER_ELEMENTAL_PERM: + case NPC_WATER_ELEMENTAL_PERM: { - AddAura(SPELL_PET_AVOIDANCE, this); - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_MAGE_PET_SCALING_01, this); - AddAura(SPELL_MAGE_PET_SCALING_02, this); - AddAura(SPELL_MAGE_PET_SCALING_03, this); - AddAura(SPELL_MAGE_PET_SCALING_04, this); - ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); + AddAura(SPELL_PET_AVOIDANCE, this); + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_MAGE_PET_SCALING_01, this); + AddAura(SPELL_MAGE_PET_SCALING_02, this); + AddAura(SPELL_MAGE_PET_SCALING_03, this); + AddAura(SPELL_MAGE_PET_SCALING_04, this); + ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); break; } } @@ -710,69 +710,69 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) { switch (GetEntry()) { - case NPC_FIRE_ELEMENTAL: - { - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 3.5f - petlevel)); + case NPC_FIRE_ELEMENTAL: + { + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 3.5f - petlevel)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 3.5f + petlevel)); - AddAura(SPELL_PET_AVOIDANCE, this); - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_FIRE_ELEMENTAL_SCALING_01, this); - AddAura(SPELL_FIRE_ELEMENTAL_SCALING_02, this); - AddAura(SPELL_FIRE_ELEMENTAL_SCALING_03, this); - AddAura(SPELL_FIRE_ELEMENTAL_SCALING_04, this); - break; - } - case NPC_EARTH_ELEMENTAL: - { - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 2.0f - petlevel)); - SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 2.0f + petlevel)); - AddAura(SPELL_PET_AVOIDANCE, this); - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_EARTH_ELEMENTAL_SCALING_01, this); - AddAura(SPELL_EARTH_ELEMENTAL_SCALING_02, this); - AddAura(SPELL_EARTH_ELEMENTAL_SCALING_03, this); - AddAura(SPELL_EARTH_ELEMENTAL_SCALING_04, this); - break; - } - case NPC_INFERNAL: - { - float highAmt = petlevel / 11.0f; - float lowAmt = petlevel / 12.0f; - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, lowAmt*lowAmt*lowAmt); - SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, highAmt*highAmt*highAmt); - - AddAura(SPELL_PET_AVOIDANCE, this); - AddAura(SPELL_WARLOCK_PET_SCALING_05, this); - AddAura(SPELL_INFERNAL_SCALING_01, this); - AddAura(SPELL_INFERNAL_SCALING_02, this); - AddAura(SPELL_INFERNAL_SCALING_03, this); - AddAura(SPELL_INFERNAL_SCALING_04, this); + AddAura(SPELL_PET_AVOIDANCE, this); + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_FIRE_ELEMENTAL_SCALING_01, this); + AddAura(SPELL_FIRE_ELEMENTAL_SCALING_02, this); + AddAura(SPELL_FIRE_ELEMENTAL_SCALING_03, this); + AddAura(SPELL_FIRE_ELEMENTAL_SCALING_04, this); break; } - case NPC_DOOMGUARD: - { - float highAmt = petlevel / 11.0f; - float lowAmt = petlevel / 12.0f; - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, lowAmt*lowAmt*lowAmt); - SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, highAmt*highAmt*highAmt); + case NPC_EARTH_ELEMENTAL: + { + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 2.0f - petlevel)); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 2.0f + petlevel)); + AddAura(SPELL_PET_AVOIDANCE, this); + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_EARTH_ELEMENTAL_SCALING_01, this); + AddAura(SPELL_EARTH_ELEMENTAL_SCALING_02, this); + AddAura(SPELL_EARTH_ELEMENTAL_SCALING_03, this); + AddAura(SPELL_EARTH_ELEMENTAL_SCALING_04, this); + break; + } + case NPC_INFERNAL: + { + float highAmt = petlevel / 11.0f; + float lowAmt = petlevel / 12.0f; + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, lowAmt*lowAmt*lowAmt); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, highAmt*highAmt*highAmt); - AddAura(SPELL_PET_AVOIDANCE, this); - AddAura(SPELL_WARLOCK_PET_SCALING_01, this); - AddAura(SPELL_WARLOCK_PET_SCALING_02, this); - AddAura(SPELL_WARLOCK_PET_SCALING_03, this); - AddAura(SPELL_WARLOCK_PET_SCALING_04, this); - AddAura(SPELL_WARLOCK_PET_SCALING_05, this); + AddAura(SPELL_PET_AVOIDANCE, this); + AddAura(SPELL_WARLOCK_PET_SCALING_05, this); + AddAura(SPELL_INFERNAL_SCALING_01, this); + AddAura(SPELL_INFERNAL_SCALING_02, this); + AddAura(SPELL_INFERNAL_SCALING_03, this); + AddAura(SPELL_INFERNAL_SCALING_04, this); + break; + } + case NPC_DOOMGUARD: + { + float highAmt = petlevel / 11.0f; + float lowAmt = petlevel / 12.0f; + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, lowAmt*lowAmt*lowAmt); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, highAmt*highAmt*highAmt); + + AddAura(SPELL_PET_AVOIDANCE, this); + AddAura(SPELL_WARLOCK_PET_SCALING_01, this); + AddAura(SPELL_WARLOCK_PET_SCALING_02, this); + AddAura(SPELL_WARLOCK_PET_SCALING_03, this); + AddAura(SPELL_WARLOCK_PET_SCALING_04, this); + AddAura(SPELL_WARLOCK_PET_SCALING_05, this); break; } case NPC_WATER_ELEMENTAL_TEMP: { - AddAura(SPELL_PET_AVOIDANCE, this); - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_MAGE_PET_SCALING_01, this); - AddAura(SPELL_MAGE_PET_SCALING_02, this); - AddAura(SPELL_MAGE_PET_SCALING_03, this); - AddAura(SPELL_MAGE_PET_SCALING_04, this); - ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); + AddAura(SPELL_PET_AVOIDANCE, this); + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_MAGE_PET_SCALING_01, this); + AddAura(SPELL_MAGE_PET_SCALING_02, this); + AddAura(SPELL_MAGE_PET_SCALING_03, this); + AddAura(SPELL_MAGE_PET_SCALING_04, this); + ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); break; } case NPC_TREANT: //force of nature @@ -783,12 +783,12 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 2.5f - petlevel)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 2.5f + petlevel)); - AddAura(SPELL_PET_AVOIDANCE, this); - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_TREANT_SCALING_01, this); - AddAura(SPELL_TREANT_SCALING_02, this); - AddAura(SPELL_TREANT_SCALING_03, this); - AddAura(SPELL_TREANT_SCALING_04, this); + AddAura(SPELL_PET_AVOIDANCE, this); + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_TREANT_SCALING_01, this); + AddAura(SPELL_TREANT_SCALING_02, this); + AddAura(SPELL_TREANT_SCALING_03, this); + AddAura(SPELL_TREANT_SCALING_04, this); break; } case NPC_SHADOWFIEND: @@ -796,12 +796,12 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 2.5f - petlevel)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 2.5f + petlevel)); - AddAura(SPELL_PET_AVOIDANCE, this); - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_SHADOWFIEND_SCALING_01, this); - AddAura(SPELL_SHADOWFIEND_SCALING_02, this); - AddAura(SPELL_SHADOWFIEND_SCALING_03, this); - AddAura(SPELL_SHADOWFIEND_SCALING_04, this); + AddAura(SPELL_PET_AVOIDANCE, this); + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_SHADOWFIEND_SCALING_01, this); + AddAura(SPELL_SHADOWFIEND_SCALING_02, this); + AddAura(SPELL_SHADOWFIEND_SCALING_03, this); + AddAura(SPELL_SHADOWFIEND_SCALING_04, this); break; } case NPC_FERAL_SPIRIT: @@ -809,12 +809,12 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel * 4.0f - petlevel)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel * 4.0f + petlevel)); - AddAura(SPELL_PET_AVOIDANCE, this); + AddAura(SPELL_PET_AVOIDANCE, this); AddAura(SPELL_FERAL_SPIRIT_SPIRIT_HUNT, this); - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_FERAL_SPIRIT_SCALING_01, this); - AddAura(SPELL_FERAL_SPIRIT_SCALING_02, this); - AddAura(SPELL_FERAL_SPIRIT_SCALING_03, this); + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_FERAL_SPIRIT_SCALING_01, this); + AddAura(SPELL_FERAL_SPIRIT_SCALING_02, this); + AddAura(SPELL_FERAL_SPIRIT_SCALING_03, this); break; } case NPC_MIRROR_IMAGE: // Mirror Image @@ -826,12 +826,12 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateHealth(28 + 10*petlevel); } - AddAura(SPELL_PET_AVOIDANCE, this); - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_MAGE_PET_SCALING_01, this); - AddAura(SPELL_MAGE_PET_SCALING_02, this); - AddAura(SPELL_MAGE_PET_SCALING_03, this); - AddAura(SPELL_MAGE_PET_SCALING_04, this); + AddAura(SPELL_PET_AVOIDANCE, this); + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_MAGE_PET_SCALING_01, this); + AddAura(SPELL_MAGE_PET_SCALING_02, this); + AddAura(SPELL_MAGE_PET_SCALING_03, this); + AddAura(SPELL_MAGE_PET_SCALING_04, this); break; } case NPC_EBON_GARGOYLE: // Ebon Gargoyle @@ -841,31 +841,31 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateMana(28 + 10*petlevel); SetCreateHealth(28 + 30*petlevel); } - - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_DK_PET_SCALING_01, this); - AddAura(SPELL_DK_PET_SCALING_02, this); - AddAura(SPELL_DK_PET_SCALING_03, this); + + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_DK_PET_SCALING_01, this); + AddAura(SPELL_DK_PET_SCALING_02, this); + AddAura(SPELL_DK_PET_SCALING_03, this); break; } case NPC_BLOODWORM: { - // Xinef: Hit / Expertise scaling - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_PET_AVOIDANCE, this); + // Xinef: Hit / Expertise scaling + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_PET_AVOIDANCE, this); SetCreateHealth(4 * petlevel); SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - 30 - (petlevel / 4) + m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel - 30 + (petlevel / 4) + m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); - break; - } - case NPC_ARMY_OF_THE_DEAD: - { - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - AddAura(SPELL_DK_PET_SCALING_01, this); - AddAura(SPELL_PET_AVOIDANCE, this); break; - } - case NPC_GENERIC_IMP: + } + case NPC_ARMY_OF_THE_DEAD: + { + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_DK_PET_SCALING_01, this); + AddAura(SPELL_PET_AVOIDANCE, this); + break; + } + case NPC_GENERIC_IMP: case NPC_GENERIC_VOIDWALKER: { SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); @@ -877,27 +877,27 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) } } - // Can be summon and guardian - if (GetEntry() == NPC_RISEN_GHOUL) - { - // xinef: fixes orc death knight command racial - if (m_owner->getRace() == RACE_ORC) - CastSpell(this, SPELL_ORC_RACIAL_COMMAND, true, NULL, NULL, m_owner->GetGUID()); + // Can be summon and guardian + if (GetEntry() == NPC_RISEN_GHOUL) + { + // xinef: fixes orc death knight command racial + if (m_owner->getRace() == RACE_ORC) + CastSpell(this, SPELL_ORC_RACIAL_COMMAND, true, NULL, NULL, m_owner->GetGUID()); - // Avoidance, Night of the Dead - if (Aura *aur = AddAura(SPELL_NIGHT_OF_THE_DEAD_AVOIDANCE, this)) - if (AuraEffect *aurEff = m_owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0)) - if (aur->GetEffect(0)) - aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue()); + // Avoidance, Night of the Dead + if (Aura *aur = AddAura(SPELL_NIGHT_OF_THE_DEAD_AVOIDANCE, this)) + if (AuraEffect *aurEff = m_owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0)) + if (aur->GetEffect(0)) + aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue()); - AddAura(SPELL_HUNTER_PET_SCALING_04, this); - // Added to perm ghoul by default - if (!IsPet()) - { - AddAura(SPELL_DK_PET_SCALING_01, this); - AddAura(SPELL_DK_PET_SCALING_02, this); - } - } + AddAura(SPELL_HUNTER_PET_SCALING_04, this); + // Added to perm ghoul by default + if (!IsPet()) + { + AddAura(SPELL_DK_PET_SCALING_01, this); + AddAura(SPELL_DK_PET_SCALING_02, this); + } + } UpdateAllStats(); @@ -968,7 +968,7 @@ void Pet::_LoadSpellCooldowns(PreparedQueryResult result) if (db_time <= curTime) continue; - uint32 cooldown = (db_time-curTime)*IN_MILLISECONDS; + uint32 cooldown = (db_time-curTime)*IN_MILLISECONDS; cooldowns[spell_id] = cooldown; _AddCreatureSpellCooldown(spell_id, cooldown); @@ -994,16 +994,16 @@ void Pet::_SaveSpellCooldowns(SQLTransaction& trans, bool logout) uint32 checkTime = World::GetGameTimeMS() + 30*IN_MILLISECONDS; // remove oudated and save active - CreatureSpellCooldowns::iterator itr, itr2; + CreatureSpellCooldowns::iterator itr, itr2; for (itr = m_CreatureSpellCooldowns.begin(); itr != m_CreatureSpellCooldowns.end();) { - itr2 = itr; - ++itr; + itr2 = itr; + ++itr; if (itr2->second <= World::GetGameTimeMS()+1000) m_CreatureSpellCooldowns.erase(itr2); else if (logout || itr2->second > checkTime) { - uint32 cooldown = ((itr2->second-World::GetGameTimeMS())/IN_MILLISECONDS) + curTime; + uint32 cooldown = ((itr2->second-World::GetGameTimeMS())/IN_MILLISECONDS) + curTime; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_SPELL_COOLDOWN); stmt->setUInt32(0, m_charmInfo->GetPetNumber()); stmt->setUInt32(1, itr2->first); @@ -1160,28 +1160,28 @@ void Pet::_SaveAuras(SQLTransaction& trans, bool logout) continue; Aura* aura = itr->second; - if (!logout && aura->GetDuration() < 60*IN_MILLISECONDS) - continue; + if (!logout && aura->GetDuration() < 60*IN_MILLISECONDS) + continue; - // dont save infinite negative auras! (lavas, transformations etc) - if (aura->IsPermanent() && !aura->GetSpellInfo()->IsPositive()) - continue; + // dont save infinite negative auras! (lavas, transformations etc) + if (aura->IsPermanent() && !aura->GetSpellInfo()->IsPositive()) + continue; - // pussywizard: don't save auras that cannot be cancelled (needed for ICC buff on pets/summons) - if (aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CANT_CANCEL)) - continue; + // pussywizard: don't save auras that cannot be cancelled (needed for ICC buff on pets/summons) + if (aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CANT_CANCEL)) + continue; - // xinef: don't save hidden auras - if (aura->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR)) - continue; + // xinef: don't save hidden auras + if (aura->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR)) + continue; - // Xinef: Dont save auras with model change - if (aura->GetSpellInfo()->HasAura(SPELL_AURA_TRANSFORM)) - continue; + // Xinef: Dont save auras with model change + if (aura->GetSpellInfo()->HasAura(SPELL_AURA_TRANSFORM)) + continue; - // xinef: don's save auras with interrupt flags on map change - if (aura->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_CHANGE_MAP) - continue; + // xinef: don's save auras with interrupt flags on map change + if (aura->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_CHANGE_MAP) + continue; int32 damage[MAX_SPELL_EFFECTS]; int32 baseDamage[MAX_SPELL_EFFECTS]; @@ -1344,19 +1344,19 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel else m_charmInfo->AddSpellToActionBar(spellInfo); - // unapply aura stats if dont meet requirements - // handle only if player is not loaded, loading is handled in loadfromdb - if (!m_loading) - if (Aura* aura = GetAura(spellId)) - { - if (aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_35_PERCENT || - aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTH_ABOVE_75_PERCENT || - aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_20_PERCENT ) - if (!HasAuraState((AuraStateType)aura->GetSpellInfo()->CasterAuraState)) - aura->HandleAllEffects(aura->GetApplicationOfTarget(GetGUID()), AURA_EFFECT_HANDLE_REAL, false); - } + // unapply aura stats if dont meet requirements + // handle only if player is not loaded, loading is handled in loadfromdb + if (!m_loading) + if (Aura* aura = GetAura(spellId)) + { + if (aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_35_PERCENT || + aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTH_ABOVE_75_PERCENT || + aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_20_PERCENT ) + if (!HasAuraState((AuraStateType)aura->GetSpellInfo()->CasterAuraState)) + aura->HandleAllEffects(aura->GetApplicationOfTarget(GetGUID()), AURA_EFFECT_HANDLE_REAL, false); + } - ToggleAutocast(spellInfo, (newspell.active == ACT_ENABLED)); + ToggleAutocast(spellInfo, (newspell.active == ACT_ENABLED)); uint32 talentCost = GetTalentSpellCost(spellId); if (talentCost) @@ -1500,7 +1500,7 @@ void Pet::CleanupActionBar() if (!HasSpell(ab->GetAction())) m_charmInfo->SetActionBar(i, 0, ACT_PASSIVE); else if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(ab->GetAction())) - ToggleAutocast(spellInfo, ab->GetType() == ACT_ENABLED); + ToggleAutocast(spellInfo, ab->GetType() == ACT_ENABLED); } } @@ -1605,7 +1605,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/) // now need only reset for offline pets (all pets except online case) uint32 except_petnumber = online_pet ? online_pet->GetCharmInfo()->GetPetNumber() : 0; - // xinef: zomg! sync query + // xinef: zomg! sync query PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET); stmt->setUInt32(0, owner->GetGUIDLow()); stmt->setUInt32(1, except_petnumber); @@ -1615,7 +1615,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/) if (!resultPets) return; - // xinef: zomg! sync query + // xinef: zomg! sync query stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL_LIST); stmt->setUInt32(0, owner->GetGUIDLow()); stmt->setUInt32(1, except_petnumber); @@ -1758,8 +1758,8 @@ bool Pet::IsPermanentPetFor(Player* owner) const return GetCreatureTemplate()->type == CREATURE_TYPE_DEMON; case CLASS_DEATH_KNIGHT: return GetCreatureTemplate()->type == CREATURE_TYPE_UNDEAD; - case CLASS_MAGE: - return GetEntry() == 37994; + case CLASS_MAGE: + return GetEntry() == 37994; default: return false; } @@ -1872,18 +1872,18 @@ void Pet::SynchronizeLevelWithOwner() void Pet::HandleAsynchLoadSucceed() { - Player* owner = GetOwner(); - if (!owner) - return; + Player* owner = GetOwner(); + if (!owner) + return; - if (GetAsynchLoadType() == PET_LOAD_HANDLE_UNSTABLE_CALLBACK) - { - if (Player* player = owner->ToPlayer()) - player->GetSession()->SendStableResult(0x09 /*STABLE_SUCCESS_UNSTABLE*/); - } - else// if (GetAsynchLoadType() == PET_LOAD_BG_RESURRECT || GetAsynchLoadType() == PET_LOAD_SUMMON_PET || GetAsynchLoadType() == PET_LOAD_SUMMON_DEAD_PET) - { - // Remove Demonic Sacrifice auras (known pet) + if (GetAsynchLoadType() == PET_LOAD_HANDLE_UNSTABLE_CALLBACK) + { + if (Player* player = owner->ToPlayer()) + player->GetSession()->SendStableResult(0x09 /*STABLE_SUCCESS_UNSTABLE*/); + } + else// if (GetAsynchLoadType() == PET_LOAD_BG_RESURRECT || GetAsynchLoadType() == PET_LOAD_SUMMON_PET || GetAsynchLoadType() == PET_LOAD_SUMMON_DEAD_PET) + { + // Remove Demonic Sacrifice auras (known pet) Unit::AuraEffectList const& auraClassScripts = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) { @@ -1896,199 +1896,199 @@ void Pet::HandleAsynchLoadSucceed() ++itr; } - SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - if (GetAsynchLoadType() == PET_LOAD_SUMMON_DEAD_PET) - { - setDeathState(ALIVE); - ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_POSSESSED))); // xinef: added just in case... some linked auras and so on - SetHealth(CountPctFromMaxHealth(15)); // Xinef: well, only two pet reviving spells exist and both revive with 15% - SavePetToDB(PET_SAVE_AS_CURRENT, false); - } - } + SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); + if (GetAsynchLoadType() == PET_LOAD_SUMMON_DEAD_PET) + { + setDeathState(ALIVE); + ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_POSSESSED))); // xinef: added just in case... some linked auras and so on + SetHealth(CountPctFromMaxHealth(15)); // Xinef: well, only two pet reviving spells exist and both revive with 15% + SavePetToDB(PET_SAVE_AS_CURRENT, false); + } + } - // xinef: resurrect with full health if resurrected by BG / BF spirit - if (GetAsynchLoadType() == PET_LOAD_BG_RESURRECT) - SetHealth(GetMaxHealth()); + // xinef: resurrect with full health if resurrected by BG / BF spirit + if (GetAsynchLoadType() == PET_LOAD_BG_RESURRECT) + SetHealth(GetMaxHealth()); - // xinef: We are summoned in arena / battleground, remove all positive auras - // xinef: and set health to full if in preparation phase - if (GetMap()->IsBattlegroundOrArena()) - { - if (GetMap()->IsBattleArena()) - RemoveArenaAuras(); - - if (Player* player = owner->ToPlayer()) - if (Battleground* bg = player->GetBattleground()) - if (bg->GetStatus() == STATUS_WAIT_JOIN) - { - if (IsAlive()) - SetHealth(GetMaxHealth()); - - if (GetMap()->IsBattleground()) - CastSpell(this, SPELL_PREPARATION, true); - } - } - - // Fix aurastate auras, depending on health! - // Set aurastate manualy, prevents aura switching - if (HealthBelowPct(20)) - SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTHLESS_20_PERCENT-1)); - if (HealthBelowPct(35)) - SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTHLESS_35_PERCENT-1)); - if (HealthAbovePct(75)) - SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTH_ABOVE_75_PERCENT-1)); - - // unapply aura stats if dont meet requirements - AuraApplicationMap const& Auras = GetAppliedAuras(); - for (AuraApplicationMap::const_iterator itr = Auras.begin(); itr != Auras.end(); ++itr) + // xinef: We are summoned in arena / battleground, remove all positive auras + // xinef: and set health to full if in preparation phase + if (GetMap()->IsBattlegroundOrArena()) { - // we assume that all auras are applied now, aurastate was modfied MANUALY preventing any apply/unapply state switching + if (GetMap()->IsBattleArena()) + RemoveArenaAuras(); + + if (Player* player = owner->ToPlayer()) + if (Battleground* bg = player->GetBattleground()) + if (bg->GetStatus() == STATUS_WAIT_JOIN) + { + if (IsAlive()) + SetHealth(GetMaxHealth()); + + if (GetMap()->IsBattleground()) + CastSpell(this, SPELL_PREPARATION, true); + } + } + + // Fix aurastate auras, depending on health! + // Set aurastate manualy, prevents aura switching + if (HealthBelowPct(20)) + SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTHLESS_20_PERCENT-1)); + if (HealthBelowPct(35)) + SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTHLESS_35_PERCENT-1)); + if (HealthAbovePct(75)) + SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTH_ABOVE_75_PERCENT-1)); + + // unapply aura stats if dont meet requirements + AuraApplicationMap const& Auras = GetAppliedAuras(); + for (AuraApplicationMap::const_iterator itr = Auras.begin(); itr != Auras.end(); ++itr) + { + // we assume that all auras are applied now, aurastate was modfied MANUALY preventing any apply/unapply state switching Aura* aura = itr->second->GetBase(); SpellInfo const* m_spellInfo = aura->GetSpellInfo(); if (m_spellInfo->CasterAuraState != AURA_STATE_HEALTHLESS_20_PERCENT && - m_spellInfo->CasterAuraState != AURA_STATE_HEALTHLESS_35_PERCENT && - m_spellInfo->CasterAuraState != AURA_STATE_HEALTH_ABOVE_75_PERCENT) + m_spellInfo->CasterAuraState != AURA_STATE_HEALTHLESS_35_PERCENT && + m_spellInfo->CasterAuraState != AURA_STATE_HEALTH_ABOVE_75_PERCENT) continue; - if (!HasAuraState((AuraStateType)m_spellInfo->CasterAuraState)) - aura->HandleAllEffects(itr->second, AURA_EFFECT_HANDLE_REAL, false); + if (!HasAuraState((AuraStateType)m_spellInfo->CasterAuraState)) + aura->HandleAllEffects(itr->second, AURA_EFFECT_HANDLE_REAL, false); } - SetAsynchLoadType(PET_LOAD_DEFAULT); + SetAsynchLoadType(PET_LOAD_DEFAULT); - // Warlock pet exception, check if owner is casting new summon spell - if (Spell* spell = owner->GetCurrentSpell(CURRENT_GENERIC_SPELL)) - if (spell->GetSpellInfo()->HasEffect(SPELL_EFFECT_SUMMON_PET)) - CastSpell(this, 32752, true, NULL, NULL, GetGUID()); + // Warlock pet exception, check if owner is casting new summon spell + if (Spell* spell = owner->GetCurrentSpell(CURRENT_GENERIC_SPELL)) + if (spell->GetSpellInfo()->HasEffect(SPELL_EFFECT_SUMMON_PET)) + CastSpell(this, 32752, true, NULL, NULL, GetGUID()); - if (owner->NeedSendSpectatorData() && GetCreatureTemplate()->family) - { - ArenaSpectator::SendCommand_UInt32Value(owner->FindMap(), owner->GetGUID(), "PHP", (uint32)GetHealthPct()); - ArenaSpectator::SendCommand_UInt32Value(owner->FindMap(), owner->GetGUID(), "PET", GetCreatureTemplate()->family); - } + if (owner->NeedSendSpectatorData() && GetCreatureTemplate()->family) + { + ArenaSpectator::SendCommand_UInt32Value(owner->FindMap(), owner->GetGUID(), "PHP", (uint32)GetHealthPct()); + ArenaSpectator::SendCommand_UInt32Value(owner->FindMap(), owner->GetGUID(), "PET", GetCreatureTemplate()->family); + } } void Pet::HandleAsynchLoadFailed(AsynchPetSummon* info, Player* player, uint8 asynchLoadType, uint8 loadResult) { - if (loadResult == PET_LOAD_ERROR && asynchLoadType == PET_LOAD_HANDLE_UNSTABLE_CALLBACK) - { - player->GetSession()->SendStableResult(0x06 /*STABLE_ERR_STABLE*/); - } - else if (loadResult == PET_LOAD_NO_RESULT && info && (asynchLoadType == PET_LOAD_SUMMON_PET || asynchLoadType == PET_LOAD_SUMMON_DEAD_PET)) - { - // xinef: petentry == 0 for hunter "call pet" (current pet summoned if any) - if (!info->m_entry || !player) - return; + if (loadResult == PET_LOAD_ERROR && asynchLoadType == PET_LOAD_HANDLE_UNSTABLE_CALLBACK) + { + player->GetSession()->SendStableResult(0x06 /*STABLE_ERR_STABLE*/); + } + else if (loadResult == PET_LOAD_NO_RESULT && info && (asynchLoadType == PET_LOAD_SUMMON_PET || asynchLoadType == PET_LOAD_SUMMON_DEAD_PET)) + { + // xinef: petentry == 0 for hunter "call pet" (current pet summoned if any) + if (!info->m_entry || !player) + return; - Pet* pet = new Pet(player, info->m_petType); - pet->Relocate(info->pos); // already validated (IsPositionValid) + Pet* pet = new Pet(player, info->m_petType); + pet->Relocate(info->pos); // already validated (IsPositionValid) - Map* map = player->GetMap(); - uint32 pet_number = sObjectMgr->GeneratePetNumber(); - if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, player->GetPhaseMask(), info->m_entry, pet_number)) - { - sLog->outError("no such creature entry %u", info->m_entry); - delete pet; - return; - } + Map* map = player->GetMap(); + uint32 pet_number = sObjectMgr->GeneratePetNumber(); + if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, player->GetPhaseMask(), info->m_entry, pet_number)) + { + sLog->outError("no such creature entry %u", info->m_entry); + delete pet; + return; + } - if (info->m_createdBySpell) - pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, info->m_createdBySpell); - pet->SetCreatorGUID(player->GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); + if (info->m_createdBySpell) + pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, info->m_createdBySpell); + pet->SetCreatorGUID(player->GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); - pet->setPowerType(POWER_MANA); - pet->SetUInt32Value(UNIT_NPC_FLAGS, 0); - pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - pet->InitStatsForLevel(player->getLevel()); + pet->setPowerType(POWER_MANA); + pet->SetUInt32Value(UNIT_NPC_FLAGS, 0); + pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + pet->InitStatsForLevel(player->getLevel()); - player->SetMinion(pet, true); + player->SetMinion(pet, true); - if (info->m_petType == SUMMON_PET) - { - // this enables pet details window (Shift+P) - pet->GetCharmInfo()->SetPetNumber(pet_number, true); - pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); - pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); - pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); - pet->SetFullHealth(); - pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA)); - pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case - } + if (info->m_petType == SUMMON_PET) + { + // this enables pet details window (Shift+P) + pet->GetCharmInfo()->SetPetNumber(pet_number, true); + pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); + pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); + pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); + pet->SetFullHealth(); + pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA)); + pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case + } - map->AddToMap(pet->ToCreature(), true); + map->AddToMap(pet->ToCreature(), true); - if (info->m_petType == SUMMON_PET) - { - pet->InitPetCreateSpells(); - pet->InitTalentForLevel(); - pet->SavePetToDB(PET_SAVE_AS_CURRENT, false); - player->PetSpellInitialize(); // no need to check, no other possibility + if (info->m_petType == SUMMON_PET) + { + pet->InitPetCreateSpells(); + pet->InitTalentForLevel(); + pet->SavePetToDB(PET_SAVE_AS_CURRENT, false); + player->PetSpellInitialize(); // no need to check, no other possibility - // Remove Demonic Sacrifice auras (known pet) - Unit::AuraEffectList const& auraClassScripts = player->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) - { - if ((*itr)->GetMiscValue() == 2228) - { - player->RemoveAurasDueToSpell((*itr)->GetId()); - itr = auraClassScripts.begin(); - } - else - ++itr; - } - } + // Remove Demonic Sacrifice auras (known pet) + Unit::AuraEffectList const& auraClassScripts = player->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) + { + if ((*itr)->GetMiscValue() == 2228) + { + player->RemoveAurasDueToSpell((*itr)->GetId()); + itr = auraClassScripts.begin(); + } + else + ++itr; + } + } - if (info->m_duration > 0) - pet->SetDuration(info->m_duration); + if (info->m_duration > 0) + pet->SetDuration(info->m_duration); - // we are almost at home... - if (asynchLoadType == PET_LOAD_SUMMON_PET) - { - Unit* caster = ObjectAccessor::GetObjectInMap(info->m_casterGUID, map, (Unit*)NULL); - if (!caster) - caster = player; + // we are almost at home... + if (asynchLoadType == PET_LOAD_SUMMON_PET) + { + Unit* caster = ObjectAccessor::GetObjectInMap(info->m_casterGUID, map, (Unit*)NULL); + if (!caster) + caster = player; - if (caster->GetTypeId() == TYPEID_UNIT) - { - if (caster->ToCreature()->IsTotem()) - pet->SetReactState(REACT_AGGRESSIVE); - else - pet->SetReactState(REACT_DEFENSIVE); - } + if (caster->GetTypeId() == TYPEID_UNIT) + { + if (caster->ToCreature()->IsTotem()) + pet->SetReactState(REACT_AGGRESSIVE); + else + pet->SetReactState(REACT_DEFENSIVE); + } - // Reset cooldowns - if (player->getClass() != CLASS_HUNTER) - { - pet->m_CreatureSpellCooldowns.clear(); - player->ToPlayer()->PetSpellInitialize(); - } + // Reset cooldowns + if (player->getClass() != CLASS_HUNTER) + { + pet->m_CreatureSpellCooldowns.clear(); + player->ToPlayer()->PetSpellInitialize(); + } - // Set health to max if new pet is summoned - // in this function old pet is saved with current health eg. 20% and new one is loaded from db with same amount - // pet should have full health - pet->SetHealth(pet->GetMaxHealth()); + // Set health to max if new pet is summoned + // in this function old pet is saved with current health eg. 20% and new one is loaded from db with same amount + // pet should have full health + pet->SetHealth(pet->GetMaxHealth()); - // generate new name for summon pet - std::string new_name=sObjectMgr->GeneratePetName(info->m_entry); - if (!new_name.empty()) - pet->SetName(new_name); - } - else // if GetAsynchLoad() == PET_LOAD_SUMMON_DEAD_PET - { - pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); - pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - pet->setDeathState(ALIVE); - pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_POSSESSED))); // xinef: just in case - pet->SetHealth(pet->CountPctFromMaxHealth(uint32(info->m_casterGUID))); // damage for this effect is saved in caster guid, dont create next variable... + // generate new name for summon pet + std::string new_name=sObjectMgr->GeneratePetName(info->m_entry); + if (!new_name.empty()) + pet->SetName(new_name); + } + else // if GetAsynchLoad() == PET_LOAD_SUMMON_DEAD_PET + { + pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); + pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); + pet->setDeathState(ALIVE); + pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_POSSESSED))); // xinef: just in case + pet->SetHealth(pet->CountPctFromMaxHealth(uint32(info->m_casterGUID))); // damage for this effect is saved in caster guid, dont create next variable... - //AIM_Initialize(); - //owner->PetSpellInitialize(); - pet->SavePetToDB(PET_SAVE_AS_CURRENT, false); - } - } + //AIM_Initialize(); + //owner->PetSpellInitialize(); + pet->SavePetToDB(PET_SAVE_AS_CURRENT, false); + } + } } void Pet::SetDisplayId(uint32 modelId) diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index 85e21b5b3..c9db736fc 100644 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -22,8 +22,8 @@ #include "PetDefines.h" #include "TemporarySummon.h" -#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILLISECONDS -#define PET_LOSE_HAPPINES_INTERVAL 7500 +#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILLISECONDS +#define PET_LOSE_HAPPINES_INTERVAL 7500 #define HAPPINESS_LEVEL_SIZE 333000 struct PetSpell @@ -36,15 +36,15 @@ struct PetSpell class AsynchPetSummon { - public: - AsynchPetSummon(uint32 entry, Position position, PetType petType, uint32 duration, uint32 createdBySpell, uint64 casterGUID) : - m_entry(entry), pos(position), m_petType(petType), - m_duration(duration), m_createdBySpell(createdBySpell), m_casterGUID(casterGUID) { } - - Position pos; - uint32 m_entry, m_createdBySpell, m_duration; - PetType m_petType; - uint64 m_casterGUID; + public: + AsynchPetSummon(uint32 entry, Position position, PetType petType, uint32 duration, uint32 createdBySpell, uint64 casterGUID) : + m_entry(entry), pos(position), m_petType(petType), + m_duration(duration), m_createdBySpell(createdBySpell), m_casterGUID(casterGUID) { } + + Position pos; + uint32 m_entry, m_createdBySpell, m_duration; + PetType m_petType; + uint64 m_casterGUID; }; typedef UNORDERED_MAP PetSpellMap; @@ -74,7 +74,7 @@ class Pet : public Guardian bool CreateBaseAtCreature(Creature* creature); bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner); bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask); - static bool LoadPetFromDB(Player* owner, uint8 asynchLoadType, uint32 petentry = 0, uint32 petnumber = 0, bool current = false, AsynchPetSummon* info = NULL); + static bool LoadPetFromDB(Player* owner, uint8 asynchLoadType, uint32 petentry = 0, uint32 petnumber = 0, bool current = false, AsynchPetSummon* info = NULL); bool isBeingLoaded() const { return m_loading;} void SavePetToDB(PetSaveMode mode, bool logout); void Remove(PetSaveMode mode, bool returnreagent = false); @@ -100,7 +100,7 @@ class Pet : public Guardian bool HaveInDiet(ItemTemplate const* item) const; uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel) const; void SetDuration(int32 dur) { m_duration = dur; } - int32 GetDuration() const { return m_duration; } + int32 GetDuration() const { return m_duration; } /* bool UpdateStats(Stats stat); @@ -124,7 +124,7 @@ class Pet : public Guardian void _SaveAuras(SQLTransaction& trans, bool logout); void _SaveSpells(SQLTransaction& trans); - void _LoadSpellCooldowns(PreparedQueryResult result); + void _LoadSpellCooldowns(PreparedQueryResult result); void _LoadAuras(PreparedQueryResult result, uint32 timediff); void _LoadSpells(PreparedQueryResult result); @@ -160,11 +160,11 @@ class Pet : public Guardian bool m_removed; // prevent overwrite pet state in DB at next Pet::Update if pet already removed(saved) Player* GetOwner() const { return m_owner; } - void SetLoading(bool load) { m_loading = load; } - void HandleAsynchLoadSucceed(); - static void HandleAsynchLoadFailed(AsynchPetSummon* info, Player* player, uint8 asynchLoadType, uint8 loadResult); - uint8 GetAsynchLoadType() const { return asynchLoadType; } - void SetAsynchLoadType(uint8 type) { asynchLoadType = type; } + void SetLoading(bool load) { m_loading = load; } + void HandleAsynchLoadSucceed(); + static void HandleAsynchLoadFailed(AsynchPetSummon* info, Player* player, uint8 asynchLoadType, uint8 loadResult); + uint8 GetAsynchLoadType() const { return asynchLoadType; } + void SetAsynchLoadType(uint8 type) { asynchLoadType = type; } protected: Player* m_owner; int32 m_happinessTimer; @@ -172,10 +172,10 @@ class Pet : public Guardian int32 m_duration; // time until unsummon (used mostly for summoned guardians and not used for controlled pets) uint64 m_auraRaidUpdateMask; bool m_loading; - int32 m_petRegenTimer; // xinef: used for focus regeneration + int32 m_petRegenTimer; // xinef: used for focus regeneration DeclinedName *m_declinedname; - uint8 asynchLoadType; + uint8 asynchLoadType; private: void SaveToDB(uint32, uint8, uint32) // override of Creature::SaveToDB - must not be called diff --git a/src/server/game/Entities/Pet/PetDefines.h b/src/server/game/Entities/Pet/PetDefines.h index 4be96b1d2..fd25f181c 100644 --- a/src/server/game/Entities/Pet/PetDefines.h +++ b/src/server/game/Entities/Pet/PetDefines.h @@ -77,7 +77,7 @@ enum PetTalk // used at pet loading query list preparing, and later result selection enum PetLoadQueryIndex { - PET_LOAD_QUERY_LOADAURAS = 0, + PET_LOAD_QUERY_LOADAURAS = 0, PET_LOAD_QUERY_LOADSPELLS = 1, PET_LOAD_QUERY_LOADSPELLCOOLDOWN = 2, MAX_PET_LOAD_QUERY, @@ -85,118 +85,118 @@ enum PetLoadQueryIndex enum PetLoadStage { - PET_LOAD_DEFAULT = 0, - PET_LOAD_HANDLE_UNSTABLE_CALLBACK = 1, // used also in HandleStableSwapPetCallback, uses same error / ok messages - PET_LOAD_BG_RESURRECT = 2, - PET_LOAD_SUMMON_PET = 3, - PET_LOAD_SUMMON_DEAD_PET = 4 + PET_LOAD_DEFAULT = 0, + PET_LOAD_HANDLE_UNSTABLE_CALLBACK = 1, // used also in HandleStableSwapPetCallback, uses same error / ok messages + PET_LOAD_BG_RESURRECT = 2, + PET_LOAD_SUMMON_PET = 3, + PET_LOAD_SUMMON_DEAD_PET = 4 }; enum PetLoadState { - PET_LOAD_OK = 0, - PET_LOAD_NO_RESULT = 1, - PET_LOAD_ERROR = 2 + PET_LOAD_OK = 0, + PET_LOAD_NO_RESULT = 1, + PET_LOAD_ERROR = 2 }; enum NPCEntries { - // Warlock - NPC_INFERNAL = 89, - NPC_IMP = 416, - NPC_FELHUNTER = 417, - NPC_VOIDWALKER = 1860, - NPC_SUCCUBUS = 1863, - NPC_DOOMGUARD = 11859, - NPC_FELGUARD = 17252, + // Warlock + NPC_INFERNAL = 89, + NPC_IMP = 416, + NPC_FELHUNTER = 417, + NPC_VOIDWALKER = 1860, + NPC_SUCCUBUS = 1863, + NPC_DOOMGUARD = 11859, + NPC_FELGUARD = 17252, - // Mage - NPC_WATER_ELEMENTAL_TEMP = 510, - NPC_MIRROR_IMAGE = 31216, - NPC_WATER_ELEMENTAL_PERM = 37994, + // Mage + NPC_WATER_ELEMENTAL_TEMP = 510, + NPC_MIRROR_IMAGE = 31216, + NPC_WATER_ELEMENTAL_PERM = 37994, - // Druid - NPC_TREANT = 1964, + // Druid + NPC_TREANT = 1964, - // Priest - NPC_SHADOWFIEND = 19668, + // Priest + NPC_SHADOWFIEND = 19668, - // Shaman - NPC_FIRE_ELEMENTAL = 15438, - NPC_EARTH_ELEMENTAL = 15352, - NPC_FERAL_SPIRIT = 29264, + // Shaman + NPC_FIRE_ELEMENTAL = 15438, + NPC_EARTH_ELEMENTAL = 15352, + NPC_FERAL_SPIRIT = 29264, - // Death Knight - NPC_RISEN_GHOUL = 26125, - NPC_BLOODWORM = 28017, - NPC_ARMY_OF_THE_DEAD = 24207, - NPC_EBON_GARGOYLE = 27829, + // Death Knight + NPC_RISEN_GHOUL = 26125, + NPC_BLOODWORM = 28017, + NPC_ARMY_OF_THE_DEAD = 24207, + NPC_EBON_GARGOYLE = 27829, - // Generic - NPC_GENERIC_IMP = 12922, - NPC_GENERIC_VOIDWALKER = 8996 + // Generic + NPC_GENERIC_IMP = 12922, + NPC_GENERIC_VOIDWALKER = 8996 }; enum PetScalingSpells { - SPELL_PET_AVOIDANCE = 32233, + SPELL_PET_AVOIDANCE = 32233, - SPELL_HUNTER_PET_SCALING_01 = 34902, - SPELL_HUNTER_PET_SCALING_02 = 34903, - SPELL_HUNTER_PET_SCALING_03 = 34904, - SPELL_HUNTER_PET_SCALING_04 = 61017, // Hit / Expertise + SPELL_HUNTER_PET_SCALING_01 = 34902, + SPELL_HUNTER_PET_SCALING_02 = 34903, + SPELL_HUNTER_PET_SCALING_03 = 34904, + SPELL_HUNTER_PET_SCALING_04 = 61017, // Hit / Expertise - // Warlock - SPELL_WARLOCK_PET_SCALING_01 = 34947, - SPELL_WARLOCK_PET_SCALING_02 = 34956, - SPELL_WARLOCK_PET_SCALING_03 = 34957, - SPELL_WARLOCK_PET_SCALING_04 = 34958, - SPELL_WARLOCK_PET_SCALING_05 = 61013, // Hit / Expertise - SPELL_GLYPH_OF_FELGUARD = 56246, - SPELL_INFERNAL_SCALING_01 = 36186, - SPELL_INFERNAL_SCALING_02 = 36188, - SPELL_INFERNAL_SCALING_03 = 36189, - SPELL_INFERNAL_SCALING_04 = 36190, - SPELL_RITUAL_ENSLAVEMENT = 22987, + // Warlock + SPELL_WARLOCK_PET_SCALING_01 = 34947, + SPELL_WARLOCK_PET_SCALING_02 = 34956, + SPELL_WARLOCK_PET_SCALING_03 = 34957, + SPELL_WARLOCK_PET_SCALING_04 = 34958, + SPELL_WARLOCK_PET_SCALING_05 = 61013, // Hit / Expertise + SPELL_GLYPH_OF_FELGUARD = 56246, + SPELL_INFERNAL_SCALING_01 = 36186, + SPELL_INFERNAL_SCALING_02 = 36188, + SPELL_INFERNAL_SCALING_03 = 36189, + SPELL_INFERNAL_SCALING_04 = 36190, + SPELL_RITUAL_ENSLAVEMENT = 22987, - // Shaman - SPELL_FERAL_SPIRIT_SPIRIT_HUNT = 58877, - SPELL_FERAL_SPIRIT_SCALING_01 = 35674, - SPELL_FERAL_SPIRIT_SCALING_02 = 35675, - SPELL_FERAL_SPIRIT_SCALING_03 = 35676, - SPELL_FIRE_ELEMENTAL_SCALING_01 = 35665, - SPELL_FIRE_ELEMENTAL_SCALING_02 = 35666, - SPELL_FIRE_ELEMENTAL_SCALING_03 = 35667, - SPELL_FIRE_ELEMENTAL_SCALING_04 = 35668, - SPELL_EARTH_ELEMENTAL_SCALING_01 = 65225, - SPELL_EARTH_ELEMENTAL_SCALING_02 = 65226, - SPELL_EARTH_ELEMENTAL_SCALING_03 = 65227, - SPELL_EARTH_ELEMENTAL_SCALING_04 = 65228, + // Shaman + SPELL_FERAL_SPIRIT_SPIRIT_HUNT = 58877, + SPELL_FERAL_SPIRIT_SCALING_01 = 35674, + SPELL_FERAL_SPIRIT_SCALING_02 = 35675, + SPELL_FERAL_SPIRIT_SCALING_03 = 35676, + SPELL_FIRE_ELEMENTAL_SCALING_01 = 35665, + SPELL_FIRE_ELEMENTAL_SCALING_02 = 35666, + SPELL_FIRE_ELEMENTAL_SCALING_03 = 35667, + SPELL_FIRE_ELEMENTAL_SCALING_04 = 35668, + SPELL_EARTH_ELEMENTAL_SCALING_01 = 65225, + SPELL_EARTH_ELEMENTAL_SCALING_02 = 65226, + SPELL_EARTH_ELEMENTAL_SCALING_03 = 65227, + SPELL_EARTH_ELEMENTAL_SCALING_04 = 65228, - // Priest - SPELL_SHADOWFIEND_SCALING_01 = 35661, - SPELL_SHADOWFIEND_SCALING_02 = 35662, - SPELL_SHADOWFIEND_SCALING_03 = 35663, - SPELL_SHADOWFIEND_SCALING_04 = 35664, + // Priest + SPELL_SHADOWFIEND_SCALING_01 = 35661, + SPELL_SHADOWFIEND_SCALING_02 = 35662, + SPELL_SHADOWFIEND_SCALING_03 = 35663, + SPELL_SHADOWFIEND_SCALING_04 = 35664, - // Druid - SPELL_TREANT_SCALING_01 = 35669, - SPELL_TREANT_SCALING_02 = 35670, - SPELL_TREANT_SCALING_03 = 35671, - SPELL_TREANT_SCALING_04 = 35672, + // Druid + SPELL_TREANT_SCALING_01 = 35669, + SPELL_TREANT_SCALING_02 = 35670, + SPELL_TREANT_SCALING_03 = 35671, + SPELL_TREANT_SCALING_04 = 35672, - // Mage - SPELL_MAGE_PET_SCALING_01 = 35657, - SPELL_MAGE_PET_SCALING_02 = 35658, - SPELL_MAGE_PET_SCALING_03 = 35659, - SPELL_MAGE_PET_SCALING_04 = 35660, + // Mage + SPELL_MAGE_PET_SCALING_01 = 35657, + SPELL_MAGE_PET_SCALING_02 = 35658, + SPELL_MAGE_PET_SCALING_03 = 35659, + SPELL_MAGE_PET_SCALING_04 = 35660, - // Death Knight - SPELL_ORC_RACIAL_COMMAND = 65221, - SPELL_NIGHT_OF_THE_DEAD_AVOIDANCE = 62137, - SPELL_DK_PET_SCALING_01 = 51996, - SPELL_DK_PET_SCALING_02 = 54566, - SPELL_DK_PET_SCALING_03 = 61697 + // Death Knight + SPELL_ORC_RACIAL_COMMAND = 65221, + SPELL_NIGHT_OF_THE_DEAD_AVOIDANCE = 62137, + SPELL_DK_PET_SCALING_01 = 51996, + SPELL_DK_PET_SCALING_02 = 54566, + SPELL_DK_PET_SCALING_03 = 61697 }; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index a1c9d5017..34b7f3398 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -241,9 +241,9 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, TeamI if (m_TaxiDestinations.size() < 3) return false; - // xinef: current segment is saved as last destination in db - _taxiSegment = m_TaxiDestinations[m_TaxiDestinations.size()-1]; - m_TaxiDestinations.pop_back(); + // xinef: current segment is saved as last destination in db + _taxiSegment = m_TaxiDestinations[m_TaxiDestinations.size()-1]; + m_TaxiDestinations.pop_back(); for (size_t i = 0; i < m_TaxiDestinations.size()-1; ++i) { @@ -271,7 +271,7 @@ std::string PlayerTaxi::SaveTaxiDestinationsToString() for (size_t i = 0; i < m_TaxiDestinations.size(); ++i) ss << m_TaxiDestinations[i] << ' '; - ss << _taxiSegment << ' '; + ss << _taxiSegment << ' '; return ss.str(); } @@ -506,11 +506,11 @@ inline void KillRewarder::_InitXP(Player* player) if (_isBattleGround || (!_isPvP && !_killer->GetVehicle())) _xp = Trinity::XP::Gain(player, _victim); - if (_xp && !_isBattleGround && _victim) // pussywizard: npcs with relatively low hp give lower exp - if (_victim->GetTypeId() == TYPEID_UNIT) - if (const CreatureTemplate* ct = _victim->ToCreature()->GetCreatureTemplate()) - if (ct->ModHealth <= 0.75f && ct->ModHealth >= 0.0f) - _xp = uint32(_xp * ct->ModHealth); + if (_xp && !_isBattleGround && _victim) // pussywizard: npcs with relatively low hp give lower exp + if (_victim->GetTypeId() == TYPEID_UNIT) + if (const CreatureTemplate* ct = _victim->ToCreature()->GetCreatureTemplate()) + if (ct->ModHealth <= 0.75f && ct->ModHealth >= 0.0f) + _xp = uint32(_xp * ct->ModHealth); } inline void KillRewarder::_RewardHonor(Player* player) @@ -654,7 +654,7 @@ void KillRewarder::Reward() // (battleground rewards only XP, that's why). if (!_isBattleGround || _xp) // 3.2.2. Reward killer. - if (_killer->IsInMap(_victim)) // pussywizard: killer may be on other map (crashfix), when killing in a group same map is required, so its not a problem + if (_killer->IsInMap(_victim)) // pussywizard: killer may be on other map (crashfix), when killing in a group same map is required, so its not a problem _RewardPlayer(_killer, false); } @@ -858,7 +858,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this) m_summon_x = 0.0f; m_summon_y = 0.0f; m_summon_z = 0.0f; - m_summon_asSpectator = false; + m_summon_asSpectator = false; //m_mover = this; m_movedByPlayer.Initialize(this); @@ -916,21 +916,21 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this) m_achievementMgr = new AchievementMgr(this); m_reputationMgr = new ReputationMgr(this); - // Ours - m_NeedToSaveGlyphs = false; - m_comboPointGain = 0; - m_MountBlockId = 0; - m_realDodge = 0.0f; - m_realParry = 0.0f; - m_pendingSpectatorForBG = 0; - m_pendingSpectatorInviteInstanceId = 0; + // Ours + m_NeedToSaveGlyphs = false; + m_comboPointGain = 0; + m_MountBlockId = 0; + m_realDodge = 0.0f; + m_realParry = 0.0f; + m_pendingSpectatorForBG = 0; + m_pendingSpectatorInviteInstanceId = 0; - m_charmUpdateTimer = 0; + m_charmUpdateTimer = 0; - for( int i = 0; i < NUM_CAI_SPELLS; ++i ) - m_charmAISpells[i] = 0; + for( int i = 0; i < NUM_CAI_SPELLS; ++i ) + m_charmAISpells[i] = 0; - m_applyResilience = true; + m_applyResilience = true; } Player::~Player() @@ -967,16 +967,16 @@ Player::~Player() sWorld->DecreasePlayerCount(); - if (!m_isInSharedVisionOf.empty()) - { - sLog->outMisc("Player::~Player (A1)"); - do - { - sLog->outMisc("Player::~Player (A2)"); - Unit* u = *(m_isInSharedVisionOf.begin()); - u->RemovePlayerFromVision(this); - } while (!m_isInSharedVisionOf.empty()); - } + if (!m_isInSharedVisionOf.empty()) + { + sLog->outMisc("Player::~Player (A1)"); + do + { + sLog->outMisc("Player::~Player (A2)"); + Unit* u = *(m_isInSharedVisionOf.begin()); + u->RemovePlayerFromVision(this); + } while (!m_isInSharedVisionOf.empty()); + } } void Player::CleanupsBeforeDelete(bool finalCleanup) @@ -1331,13 +1331,13 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) uint32 absorb = 0; uint32 resist = 0; if (type == DAMAGE_LAVA) - Unit::CalcAbsorbResist(this, this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist); + Unit::CalcAbsorbResist(this, this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist); else if (type == DAMAGE_SLIME) - Unit::CalcAbsorbResist(this, this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist); + Unit::CalcAbsorbResist(this, this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist); damage -= absorb + resist; - Unit::DealDamageMods(this, damage, &absorb); + Unit::DealDamageMods(this, damage, &absorb); WorldPacket data(SMSG_ENVIRONMENTALDAMAGELOG, (21)); data << uint64(GetGUID()); @@ -1603,18 +1603,18 @@ void Player::Update(uint32 p_time) UpdateAfkReport(now); - // Xinef: update charm AI only if we are controlled by creature or non-posses player charm + // Xinef: update charm AI only if we are controlled by creature or non-posses player charm if (IsCharmed() && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) - { - m_charmUpdateTimer += p_time; - if (m_charmUpdateTimer >= 1000) - { - m_charmUpdateTimer = 0; - if (Unit* charmer = GetCharmer()) - if (charmer->IsAlive()) - UpdateCharmedAI(); - } - } + { + m_charmUpdateTimer += p_time; + if (m_charmUpdateTimer >= 1000) + { + m_charmUpdateTimer = 0; + if (Unit* charmer = GetCharmer()) + if (charmer->IsAlive()) + UpdateCharmedAI(); + } + } if (now > m_Last_tick) { @@ -1764,21 +1764,21 @@ void Player::Update(uint32 p_time) m_weaponChangeTimer -= p_time; } - if (!IsPositionValid()) // pussywizard: will crash below at eg. GetZoneAndAreaId - { - sLog->outMisc("Player::Update - invalid position (%.1f, %.1f, %.1f)! Map: %u, MapId: %u, GUID: %u", GetPositionX(), GetPositionY(), GetPositionZ(), (FindMap() ? FindMap()->GetId() : 0), GetMapId(), GetGUIDLow()); - GetSession()->KickPlayer(); - return; - } + if (!IsPositionValid()) // pussywizard: will crash below at eg. GetZoneAndAreaId + { + sLog->outMisc("Player::Update - invalid position (%.1f, %.1f, %.1f)! Map: %u, MapId: %u, GUID: %u", GetPositionX(), GetPositionY(), GetPositionZ(), (FindMap() ? FindMap()->GetId() : 0), GetMapId(), GetGUIDLow()); + GetSession()->KickPlayer(); + return; + } if (m_zoneUpdateTimer > 0) { if (p_time >= m_zoneUpdateTimer) { uint32 newzone, newarea; - GetZoneAndAreaId(newzone, newarea, true); - m_last_zone_id = newzone; - m_last_area_id = newarea; + GetZoneAndAreaId(newzone, newarea, true); + m_last_zone_id = newzone; + m_last_area_id = newarea; if (m_zoneUpdateId != newzone) UpdateZone(newzone, newarea); // also update area @@ -1824,15 +1824,15 @@ void Player::Update(uint32 p_time) if (m_additionalSaveMask & ADDITIONAL_SAVING_INVENTORY_AND_GOLD) SaveInventoryAndGoldToDB(trans); if (m_additionalSaveMask & ADDITIONAL_SAVING_QUEST_STATUS) - { + { _SaveQuestStatus(trans); - // xinef: if nothing changed, nothing will happen - _SaveDailyQuestStatus(trans); - _SaveWeeklyQuestStatus(trans); - _SaveSeasonalQuestStatus(trans); - _SaveMonthlyQuestStatus(trans); - } + // xinef: if nothing changed, nothing will happen + _SaveDailyQuestStatus(trans); + _SaveWeeklyQuestStatus(trans); + _SaveSeasonalQuestStatus(trans); + _SaveMonthlyQuestStatus(trans); + } CharacterDatabase.CommitTransaction(trans); @@ -1901,32 +1901,32 @@ void Player::Update(uint32 p_time) //if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGUID() && (pet->GetGUID() != GetCharmGUID()))) RemovePet(pet, PET_SAVE_NOT_IN_SLOT, true); - // pussywizard: - if (m_hostileReferenceCheckTimer <= p_time) - { - m_hostileReferenceCheckTimer = 15000; - if (!GetMap()->IsDungeon()) - getHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange()); - } - else - m_hostileReferenceCheckTimer -= p_time; + // pussywizard: + if (m_hostileReferenceCheckTimer <= p_time) + { + m_hostileReferenceCheckTimer = 15000; + if (!GetMap()->IsDungeon()) + getHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange()); + } + else + m_hostileReferenceCheckTimer -= p_time; //we should execute delayed teleports only for alive(!) players //because we don't want player's ghost teleported from graveyard - // xinef: so we store it to the end of the world and teleport out of the ass after resurrection? + // xinef: so we store it to the end of the world and teleport out of the ass after resurrection? if (HasDelayedTeleport()/* && IsAlive()*/) - { - SetHasDelayedTeleport(false); + { + SetHasDelayedTeleport(false); TeleportTo(teleportStore_dest, teleportStore_options); - } + } - if (!IsBeingTeleported() && bRequestForcedVisibilityUpdate) - { - bRequestForcedVisibilityUpdate = false; - UpdateObjectVisibility(true, true); - m_delayed_unit_relocation_timer = 0; - RemoveFromNotify(NOTIFY_VISIBILITY_CHANGED); - } + if (!IsBeingTeleported() && bRequestForcedVisibilityUpdate) + { + bRequestForcedVisibilityUpdate = false; + UpdateObjectVisibility(true, true); + m_delayed_unit_relocation_timer = 0; + RemoveFromNotify(NOTIFY_VISIBILITY_CHANGED); + } } void Player::setDeathState(DeathState s, bool /*despawn = false*/) @@ -1956,8 +1956,8 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/) // save value before aura remove in Unit::setDeathState ressSpellId = GetUInt32Value(PLAYER_SELF_RES_SPELL); - // xinef: disable passive area auras! - AddUnitState(UNIT_STATE_ISOLATED); + // xinef: disable passive area auras! + AddUnitState(UNIT_STATE_ISOLATED); // passive spell if (!ressSpellId) @@ -1966,17 +1966,17 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/) UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH, 1); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON, 1); - // Xinef: reset all death criterias + // Xinef: reset all death criterias ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH, 0); } - // xinef: enable passive area auras! - else if (s == ALIVE) - ClearUnitState(UNIT_STATE_ISOLATED); + // xinef: enable passive area auras! + else if (s == ALIVE) + ClearUnitState(UNIT_STATE_ISOLATED); Unit::setDeathState(s); - if (NeedSendSpectatorData()) - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "STA", IsAlive() ? 1 : 0); + if (NeedSendSpectatorData()) + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "STA", IsAlive() ? 1 : 0); // restore resurrection spell id for player after aura remove if (s == JUST_DIED && cur && ressSpellId) @@ -1991,14 +1991,14 @@ void Player::SetRestState(uint32 triggerId) { _innTriggerId = triggerId; _restTime = time(NULL); - SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); + SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); } void Player::RemoveRestState() { _innTriggerId = 0; _restTime = 0; - RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); + RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); } bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) @@ -2213,12 +2213,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (!InBattleground() && mEntry->IsBattlegroundOrArena()) return false; - // pussywizard: arena spectator, prevent teleporting from arena to instance/etc - if (GetMapId() != mapid && IsSpectator() && mEntry->Instanceable()) - { - SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); - return false; - } + // pussywizard: arena spectator, prevent teleporting from arena to instance/etc + if (GetMapId() != mapid && IsSpectator() && mEntry->Instanceable()) + { + SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); + return false; + } // client without expansion support if (GetSession()->Expansion() < mEntry->Expansion()) @@ -2241,12 +2241,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati else ;//sLog->outDebug(LOG_FILTER_MAPS, "Player %s is being teleported to map %u", GetName().c_str(), mapid); - // xinef: do this here in case teleport failed in above checks - if (!(options & TELE_TO_NOT_LEAVE_TAXI) && IsInFlight()) - { - GetMotionMaster()->MovementExpired(); - CleanupAfterTaxiFlight(); - } + // xinef: do this here in case teleport failed in above checks + if (!(options & TELE_TO_NOT_LEAVE_TAXI) && IsInFlight()) + { + GetMotionMaster()->MovementExpired(); + CleanupAfterTaxiFlight(); + } if (!(options & TELE_TO_NOT_LEAVE_VEHICLE) && m_vehicle) ExitVehicle(); @@ -2288,12 +2288,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati //lets reset far teleport flag if it wasn't reset during chained teleports SetSemaphoreTeleportFar(0); - SetHasDelayedTeleport(false); // pussywizard: current teleport cancels stored one + SetHasDelayedTeleport(false); // pussywizard: current teleport cancels stored one //if teleport spell is casted in Unit::Update() func //then we need to delay it until update process will be finished if (MustDelayTeleport()) { - SetHasDelayedTeleport(true); + SetHasDelayedTeleport(true); SetSemaphoreTeleportNear(time(NULL)); //lets save teleport destination for player teleportStore_dest = WorldLocation(mapid, x, y, z, orientation); @@ -2301,8 +2301,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return true; } - if (options & TELE_TO_WITH_PET) - UnsummonPetTemporaryIfAny(); + if (options & TELE_TO_WITH_PET) + UnsummonPetTemporaryIfAny(); if (!(options & TELE_TO_NOT_UNSUMMON_PET)) { @@ -2350,12 +2350,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati //lets reset near teleport flag if it wasn't reset during chained teleports SetSemaphoreTeleportNear(0); - SetHasDelayedTeleport(false); // pussywizard: current teleport cancels stored one + SetHasDelayedTeleport(false); // pussywizard: current teleport cancels stored one //if teleport spell is casted in Unit::Update() func //then we need to delay it until update process will be finished if (MustDelayTeleport()) { - SetHasDelayedTeleport(true); + SetHasDelayedTeleport(true); SetSemaphoreTeleportFar(time(NULL)); //lets save teleport destination for player teleportStore_dest = WorldLocation(mapid, x, y, z, orientation); @@ -2372,9 +2372,9 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // remove arena spell coldowns/buffs now to also remove pet's cooldowns before it's temporarily unsummoned if (mEntry->IsBattleArena() && (HasPendingSpectatorForBG(0) || !HasPendingSpectatorForBG(GetBattlegroundId()))) { - // KEEP THIS ORDER! - RemoveArenaAuras(); - if (pet) + // KEEP THIS ORDER! + RemoveArenaAuras(); + if (pet) pet->RemoveArenaAuras(); RemoveArenaSpellCooldowns(true); @@ -2411,16 +2411,16 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (oldmap) oldmap->RemovePlayerFromMap(this, false); - // xinef: do this before setting fall information! - if (IsMounted() && (!GetMap()->GetEntry()->IsDungeon() && !GetMap()->GetEntry()->IsBattlegroundOrArena())) - { - AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOUNTED); - if (!auras.empty()) - { - SetMountBlockId((*auras.begin())->GetId()); - RemoveAurasByType(SPELL_AURA_MOUNTED); - } - } + // xinef: do this before setting fall information! + if (IsMounted() && (!GetMap()->GetEntry()->IsDungeon() && !GetMap()->GetEntry()->IsBattlegroundOrArena())) + { + AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOUNTED); + if (!auras.empty()) + { + SetMountBlockId((*auras.begin())->GetId()); + RemoveAurasByType(SPELL_AURA_MOUNTED); + } + } teleportStore_dest = WorldLocation(mapid, x, y, z, orientation); SetFallInformation(time(NULL), z); @@ -2454,8 +2454,8 @@ bool Player::TeleportToEntryPoint() ScheduleDelayedOperation(DELAYED_BG_TAXI_RESTORE); ScheduleDelayedOperation(DELAYED_BG_GROUP_RESTORE); - if (m_entryPointData.joinPos.m_mapId == MAPID_INVALID) - return TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation()); + if (m_entryPointData.joinPos.m_mapId == MAPID_INVALID) + return TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation()); return TeleportTo(m_entryPointData.joinPos); } @@ -2505,9 +2505,9 @@ void Player::ProcessDelayedOperations() { if (m_entryPointData.HasTaxiPath()) { - for (size_t i = 0; i < m_entryPointData.taxiPath.size() - 1; ++i) - m_taxi.AddTaxiDestination(m_entryPointData.taxiPath[i]); - m_taxi.SetTaxiSegment(m_entryPointData.taxiPath[m_entryPointData.taxiPath.size() - 1]); + for (size_t i = 0; i < m_entryPointData.taxiPath.size() - 1; ++i) + m_taxi.AddTaxiDestination(m_entryPointData.taxiPath[i]); + m_taxi.SetTaxiSegment(m_entryPointData.taxiPath[m_entryPointData.taxiPath.size() - 1]); m_entryPointData.ClearTaxiPath(); ContinueTaxiFlight(); @@ -2520,19 +2520,19 @@ void Player::ProcessDelayedOperations() g->SendUpdateToPlayer(GetGUID()); } - if (m_DelayedOperations & DELAYED_VEHICLE_TELEPORT) - { - if (Vehicle* vehicle = GetVehicle()) - { - SeatMap::iterator itr = vehicle->GetSeatIteratorForPassenger(this); - if (itr != vehicle->Seats.end()) - if (Unit* base = vehicle->GetBase()) - { - ExitVehicle(); - base->HandleSpellClick(this, itr->first); - } - } - } + if (m_DelayedOperations & DELAYED_VEHICLE_TELEPORT) + { + if (Vehicle* vehicle = GetVehicle()) + { + SeatMap::iterator itr = vehicle->GetSeatIteratorForPassenger(this); + if (itr != vehicle->Seats.end()) + if (Unit* base = vehicle->GetBase()) + { + ExitVehicle(); + base->HandleSpellClick(this, itr->first); + } + } + } //we have executed ALL delayed ops, so clear the flag m_DelayedOperations = 0; @@ -2559,8 +2559,8 @@ void Player::RemoveFromWorld() StopCastingCharm(); StopCastingBindSight(); UnsummonPetTemporaryIfAny(); - ClearComboPoints(); // pussywizard: crashfix - ClearComboPointHolders(); // pussywizard: crashfix + ClearComboPoints(); // pussywizard: crashfix + ClearComboPointHolders(); // pussywizard: crashfix if (uint64 lguid = GetLootGUID()) // pussywizard: crashfix m_session->DoLootRelease(lguid); sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId); @@ -2694,7 +2694,7 @@ void Player::Regenerate(Powers power) case POWER_RUNE: case POWER_FOCUS: case POWER_HAPPINESS: - break; + break; case POWER_HEALTH: return; default: @@ -2882,10 +2882,10 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) return NULL; // xinef: perform better check - if (creature->GetReactionTo(this) <= REP_UNFRIENDLY) + if (creature->GetReactionTo(this) <= REP_UNFRIENDLY) return NULL; - // xinef: not needed, CORRECTLY checked above including forced reputations etc + // xinef: not needed, CORRECTLY checked above including forced reputations etc // not unfriendly //if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(creature->getFaction())) // if (factionTemplate->faction) @@ -2897,10 +2897,10 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) if (!creature->IsWithinDistInMap(this, INTERACTION_DISTANCE)) return NULL; - // pussywizard: many npcs have missing conditions for class training and rogue trainer can for eg. train dual wield to a shaman :/ too many to change in sql and watch in the future - // pussywizard: this function is not used when talking, but when already taking action (buy spell, reset talents, show spell list) - if (npcflagmask & (UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS) && creature->GetCreatureTemplate()->trainer_type == TRAINER_TYPE_CLASS && getClass() != creature->GetCreatureTemplate()->trainer_class) - return NULL; + // pussywizard: many npcs have missing conditions for class training and rogue trainer can for eg. train dual wield to a shaman :/ too many to change in sql and watch in the future + // pussywizard: this function is not used when talking, but when already taking action (buy spell, reset talents, show spell list) + if (npcflagmask & (UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS) && creature->GetCreatureTemplate()->trainer_type == TRAINER_TYPE_CLASS && getClass() != creature->GetCreatureTemplate()->trainer_class) + return NULL; return creature; } @@ -2923,20 +2923,20 @@ GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes bool Player::IsInWater(bool allowAbove) const { - if (m_isInWater || !allowAbove) - return m_isInWater; + if (m_isInWater || !allowAbove) + return m_isInWater; - float distsq = GetExactDistSq(&m_last_environment_position); - if (distsq < 3.0f*3.0f) - return m_last_islittleabovewater_status; - else - { - LiquidData liqData; liqData.level = INVALID_HEIGHT; - const_cast(&m_last_environment_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); - bool inWater = GetBaseMap()->IsInWater(GetPositionX(), GetPositionY(), GetPositionZ(), &liqData); - *(const_cast(&m_last_islittleabovewater_status)) = inWater || (liqData.level > INVALID_HEIGHT && liqData.level > liqData.depth_level && liqData.level <= GetPositionZ()+3.0f && liqData.level > GetPositionZ()-1.0f); - return m_last_islittleabovewater_status; - } + float distsq = GetExactDistSq(&m_last_environment_position); + if (distsq < 3.0f*3.0f) + return m_last_islittleabovewater_status; + else + { + LiquidData liqData; liqData.level = INVALID_HEIGHT; + const_cast(&m_last_environment_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); + bool inWater = GetBaseMap()->IsInWater(GetPositionX(), GetPositionY(), GetPositionZ(), &liqData); + *(const_cast(&m_last_islittleabovewater_status)) = inWater || (liqData.level > INVALID_HEIGHT && liqData.level > liqData.depth_level && liqData.level <= GetPositionZ()+3.0f && liqData.level > GetPositionZ()-1.0f); + return m_last_islittleabovewater_status; + } } bool Player::IsUnderWater() const @@ -2947,8 +2947,8 @@ bool Player::IsUnderWater() const bool Player::IsFalling() const { - // Xinef: Added !IsInFlight check - return GetPositionZ() < m_lastFallZ && !IsInFlight(); + // Xinef: Added !IsInFlight check + return GetPositionZ() < m_lastFallZ && !IsInFlight(); } void Player::SetInWater(bool apply) @@ -2983,7 +2983,7 @@ bool Player::IsInAreaTriggerRadius(const AreaTriggerEntry* trigger) const } else { - Position center = {trigger->x, trigger->y, trigger->z, trigger->box_orientation}; + Position center = {trigger->x, trigger->y, trigger->z, trigger->box_orientation}; if (!IsWithinBox(center, trigger->box_x / 2.f, trigger->box_y / 2.f, trigger->box_z / 2.f)) return false; } @@ -2996,15 +2996,15 @@ void Player::SetGameMaster(bool on) if (on) { m_ExtraFlags |= PLAYER_EXTRA_GM_ON; - if (GetSession()->GetSecurity() >= SEC_GAMEMASTER) - setFaction(35); + if (GetSession()->GetSecurity() >= SEC_GAMEMASTER) + setFaction(35); SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM); SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS); if (Pet* pet = GetPet()) { - if (GetSession()->GetSecurity() >= SEC_GAMEMASTER) - pet->setFaction(35); + if (GetSession()->GetSecurity() >= SEC_GAMEMASTER) + pet->setFaction(35); pet->getHostileRefManager().setOnlineOfflineState(false); } @@ -3106,13 +3106,13 @@ void Player::UninviteFromGroup() if (group->IsCreated()) { group->Disband(true); - group = NULL; // gets deleted in disband + group = NULL; // gets deleted in disband } else { group->RemoveAllInvites(); delete group; - group = NULL; + group = NULL; } } } @@ -3314,7 +3314,7 @@ void Player::InitTalentForLevel() // xinef: more talent points that we have are used, reset if (m_usedTalentCount > talentPointsForLevel) resetTalents(true); - // xinef: else, recalculate free talent points count + // xinef: else, recalculate free talent points count else SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount); @@ -3485,7 +3485,7 @@ void Player::InitStatsForLevel(bool reapplyMods) void Player::SendInitialSpells() { - uint32 curTime = World::GetGameTimeMS(); + uint32 curTime = World::GetGameTimeMS(); uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck; uint16 spellCount = 0; @@ -3510,25 +3510,25 @@ void Player::SendInitialSpells() ++spellCount; } - // xinef: we have to send talents, but not those on m_spells list - for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr) - { - if (itr->second->State == PLAYERSPELL_REMOVED) - continue; + // xinef: we have to send talents, but not those on m_spells list + for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr) + { + if (itr->second->State == PLAYERSPELL_REMOVED) + continue; - // xinef: remove all active talent auras - if (!(itr->second->specMask & GetActiveSpecMask())) - continue; + // xinef: remove all active talent auras + if (!(itr->second->specMask & GetActiveSpecMask())) + continue; - // xinef: already sent from m_spells - if (itr->second->inSpellBook) - continue; + // xinef: already sent from m_spells + if (itr->second->inSpellBook) + continue; data << uint32(itr->first); data << uint16(0); // it's not slot id ++spellCount; - } + } data.put(countPos, spellCount); // write real count value @@ -3536,8 +3536,8 @@ void Player::SendInitialSpells() data << uint16(spellCooldowns); for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr) { - if (!itr->second.needSendToClient) - continue; + if (!itr->second.needSendToClient) + continue; SpellInfo const* sEntry = sSpellMgr->GetSpellInfo(itr->first); if (!sEntry) @@ -3558,7 +3558,7 @@ void Player::SendInitialSpells() uint32 cooldown = itr->second.end > curTime ? itr->second.end-curTime : 0; - if (!sEntry->GetCategory() || (sEntry->CategoryRecoveryTime != sEntry->RecoveryTime && sEntry->RecoveryTime && sEntry->CategoryRecoveryTime)) // may be wrong, but anyway better than nothing... + if (!sEntry->GetCategory() || (sEntry->CategoryRecoveryTime != sEntry->RecoveryTime && sEntry->RecoveryTime && sEntry->CategoryRecoveryTime)) // may be wrong, but anyway better than nothing... { data << cooldown; // cooldown data << uint32(0); // category cooldown @@ -3646,59 +3646,59 @@ void Player::AddNewMailDeliverTime(time_t deliver_time) bool Player::addTalent(uint32 spellId, uint8 addSpecMask, uint8 oldTalentRank) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (!SpellMgr::CheckSpellValid(spellInfo, spellId, true)) - return false; + if (!SpellMgr::CheckSpellValid(spellInfo, spellId, true)) + return false; - TalentSpellPos const* talentPos = GetTalentSpellPos(spellId); - if (!talentPos) - return false; + TalentSpellPos const* talentPos = GetTalentSpellPos(spellId); + if (!talentPos) + return false; - TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id); - if (!talentInfo) - return false; + TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id); + if (!talentInfo) + return false; - // xinef: remove old talent rank if any - if (oldTalentRank) - { - _removeTalent(talentInfo->RankID[oldTalentRank-1], addSpecMask); - _removeTalentAurasAndSpells(talentInfo->RankID[oldTalentRank-1]); - SendLearnPacket(talentInfo->RankID[oldTalentRank-1], false); - } + // xinef: remove old talent rank if any + if (oldTalentRank) + { + _removeTalent(talentInfo->RankID[oldTalentRank-1], addSpecMask); + _removeTalentAurasAndSpells(talentInfo->RankID[oldTalentRank-1]); + SendLearnPacket(talentInfo->RankID[oldTalentRank-1], false); + } - // xinef: add talent auras and spells - if (GetActiveSpecMask() & addSpecMask) - _addTalentAurasAndSpells(spellId); + // xinef: add talent auras and spells + if (GetActiveSpecMask() & addSpecMask) + _addTalentAurasAndSpells(spellId); - // xinef: find the spell on our talent map + // xinef: find the spell on our talent map PlayerTalentMap::iterator itr = m_talents.find(spellId); - // xinef: we do not have such a spell on our talent map + // xinef: we do not have such a spell on our talent map if (itr == m_talents.end()) - { - PlayerSpellState state = isBeingLoaded() ? PLAYERSPELL_UNCHANGED : PLAYERSPELL_NEW; - PlayerTalent* newTalent = new PlayerTalent(); - newTalent->State = state; - newTalent->specMask = addSpecMask; - newTalent->talentID = talentInfo->TalentID; - newTalent->inSpellBook = talentInfo->addToSpellBook && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL); + { + PlayerSpellState state = isBeingLoaded() ? PLAYERSPELL_UNCHANGED : PLAYERSPELL_NEW; + PlayerTalent* newTalent = new PlayerTalent(); + newTalent->State = state; + newTalent->specMask = addSpecMask; + newTalent->talentID = talentInfo->TalentID; + newTalent->inSpellBook = talentInfo->addToSpellBook && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL); - m_talents[spellId] = newTalent; - return true; + m_talents[spellId] = newTalent; + return true; } - // xinef: if current mask does not cover addMask, add it to iterator and save changes to DB - else if (!(itr->second->specMask & addSpecMask)) - { - itr->second->specMask |= addSpecMask; - if (itr->second->State != PLAYERSPELL_NEW) - itr->second->State = PLAYERSPELL_CHANGED; + // xinef: if current mask does not cover addMask, add it to iterator and save changes to DB + else if (!(itr->second->specMask & addSpecMask)) + { + itr->second->specMask |= addSpecMask; + if (itr->second->State != PLAYERSPELL_NEW) + itr->second->State = PLAYERSPELL_CHANGED; - return true; - } - // xinef: error case, trying to add already present talent with present mask + return true; + } + // xinef: error case, trying to add already present talent with present mask else - { - sLog->outError("Player (%u) tries to learn talent %u with covered specMask (curr: %u, add: %u)", GetGUIDLow(), spellId, itr->second->specMask, addSpecMask); - } + { + sLog->outError("Player (%u) tries to learn talent %u with covered specMask (curr: %u, add: %u)", GetGUIDLow(), spellId, itr->second->specMask, addSpecMask); + } return false; } @@ -3706,70 +3706,70 @@ bool Player::addTalent(uint32 spellId, uint8 addSpecMask, uint8 oldTalentRank) void Player::_removeTalent(uint32 spellId, uint8 specMask) { PlayerTalentMap::iterator itr = m_talents.find(spellId); - if (itr == m_talents.end() || itr->second->State == PLAYERSPELL_REMOVED) - return; + if (itr == m_talents.end() || itr->second->State == PLAYERSPELL_REMOVED) + return; - _removeTalent(itr, specMask); + _removeTalent(itr, specMask); } void Player::_removeTalent(PlayerTalentMap::iterator& itr, uint8 specMask) { - // xinef: remove spec mask from iterator - itr->second->specMask &= ~specMask; + // xinef: remove spec mask from iterator + itr->second->specMask &= ~specMask; - // xinef: if talent is not present in any spec - remove - if (itr->second->specMask == 0) - { - if (itr->second->State == PLAYERSPELL_NEW) - { - delete itr->second; - m_talents.erase(itr); - return; - } - else - itr->second->State = PLAYERSPELL_REMOVED; - } - // xinef: otherwise save changes to DB - else if (itr->second->State != PLAYERSPELL_NEW) - itr->second->State = PLAYERSPELL_CHANGED; + // xinef: if talent is not present in any spec - remove + if (itr->second->specMask == 0) + { + if (itr->second->State == PLAYERSPELL_NEW) + { + delete itr->second; + m_talents.erase(itr); + return; + } + else + itr->second->State = PLAYERSPELL_REMOVED; + } + // xinef: otherwise save changes to DB + else if (itr->second->State != PLAYERSPELL_NEW) + itr->second->State = PLAYERSPELL_CHANGED; } void Player::_removeTalentAurasAndSpells(uint32 spellId) { RemoveOwnedAura(spellId); - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - { - // pussywizard: remove pet auras + { + // pussywizard: remove pet auras if (PetAura const* petSpell = sSpellMgr->GetPetAura(spellId, i)) RemovePetAura(petSpell); - // pussywizard: remove all triggered auras - if (spellInfo->Effects[i].TriggerSpell > 0) - RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell); + // pussywizard: remove all triggered auras + if (spellInfo->Effects[i].TriggerSpell > 0) + RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell); - // xinef: remove temporary spells added by talent - // xinef: recursively remove all learnt spells - if (spellInfo->Effects[i].TriggerSpell > 0 && spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL) - { - removeSpell(spellInfo->Effects[i].TriggerSpell, SPEC_MASK_ALL, true); - _removeTalentAurasAndSpells(spellInfo->Effects[i].TriggerSpell); - } - } + // xinef: remove temporary spells added by talent + // xinef: recursively remove all learnt spells + if (spellInfo->Effects[i].TriggerSpell > 0 && spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL) + { + removeSpell(spellInfo->Effects[i].TriggerSpell, SPEC_MASK_ALL, true); + _removeTalentAurasAndSpells(spellInfo->Effects[i].TriggerSpell); + } + } } void Player::_addTalentAurasAndSpells(uint32 spellId) { - // pussywizard: spells learnt from talents are added as TEMPORARY, so not saved to db (only the talent itself is saved) - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + // pussywizard: spells learnt from talents are added as TEMPORARY, so not saved to db (only the talent itself is saved) + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) { - for (uint8 i=0; iEffects[i].Effect == SPELL_EFFECT_LEARN_SPELL && !sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell)) - _addSpell(spellInfo->Effects[i].TriggerSpell, SPEC_MASK_ALL, true); + for (uint8 i=0; iEffects[i].Effect == SPELL_EFFECT_LEARN_SPELL && !sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell)) + _addSpell(spellInfo->Effects[i].TriggerSpell, SPEC_MASK_ALL, true); } - else if (spellInfo->IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE) && spellInfo->Stances)) + else if (spellInfo->IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE) && spellInfo->Stances)) { if (IsNeedCastPassiveSpellAtLearn(spellInfo)) CastSpell(this, spellId, true); @@ -3778,177 +3778,177 @@ void Player::_addTalentAurasAndSpells(uint32 spellId) void Player::SendLearnPacket(uint32 spellId, bool learn) { - if (learn) - { - WorldPacket data(SMSG_LEARNED_SPELL, 6); - data << uint32(spellId); - data << uint16(0); - GetSession()->SendPacket(&data); - } - else - { - WorldPacket data(SMSG_REMOVED_SPELL, 4); - data << uint32(spellId); - GetSession()->SendPacket(&data); - } + if (learn) + { + WorldPacket data(SMSG_LEARNED_SPELL, 6); + data << uint32(spellId); + data << uint16(0); + GetSession()->SendPacket(&data); + } + else + { + WorldPacket data(SMSG_REMOVED_SPELL, 4); + data << uint32(spellId); + GetSession()->SendPacket(&data); + } } bool Player::addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool temporary) { - if (!_addSpell(spellId, addSpecMask, temporary)) - return false; + if (!_addSpell(spellId, addSpecMask, temporary)) + return false; - if (!updateActive) - return true; + if (!updateActive) + return true; - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); // must exist, checked in _addSpell + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); // must exist, checked in _addSpell - // pussywizard: now update active state for all ranks of this spell! and send packet to swap on action bar - // pussywizard: assumption - it's in all specs, can't be a talent - if (!spellInfo->IsStackableWithRanks() && spellInfo->IsRanked()) - { - SpellInfo const* nextSpellInfo = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(spellInfo->Id)); - while (nextSpellInfo) - { - PlayerSpellMap::iterator itr = m_spells.find(nextSpellInfo->Id); - if (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->Active) - { - if (nextSpellInfo->GetRank() < spellInfo->GetRank()) - { - itr->second->Active = false; - if (IsInWorld()) - { - WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); - data << uint32(nextSpellInfo->Id); - data << uint32(spellInfo->Id); - GetSession()->SendPacket(&data); - } - return false; - } - else if (nextSpellInfo->GetRank() > spellInfo->GetRank()) - { - PlayerSpellMap::iterator itr2 = m_spells.find(spellInfo->Id); - if (itr2 != m_spells.end()) - itr2->second->Active = false; - return false; - } - } - nextSpellInfo = nextSpellInfo->GetNextRankSpell(); - } - } + // pussywizard: now update active state for all ranks of this spell! and send packet to swap on action bar + // pussywizard: assumption - it's in all specs, can't be a talent + if (!spellInfo->IsStackableWithRanks() && spellInfo->IsRanked()) + { + SpellInfo const* nextSpellInfo = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(spellInfo->Id)); + while (nextSpellInfo) + { + PlayerSpellMap::iterator itr = m_spells.find(nextSpellInfo->Id); + if (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->Active) + { + if (nextSpellInfo->GetRank() < spellInfo->GetRank()) + { + itr->second->Active = false; + if (IsInWorld()) + { + WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); + data << uint32(nextSpellInfo->Id); + data << uint32(spellInfo->Id); + GetSession()->SendPacket(&data); + } + return false; + } + else if (nextSpellInfo->GetRank() > spellInfo->GetRank()) + { + PlayerSpellMap::iterator itr2 = m_spells.find(spellInfo->Id); + if (itr2 != m_spells.end()) + itr2->second->Active = false; + return false; + } + } + nextSpellInfo = nextSpellInfo->GetNextRankSpell(); + } + } - return true; + return true; } bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary) { - // pussywizard: this can be called to OVERWRITE currently existing spell params! usually to set active = false for lower ranks of a spell + // pussywizard: this can be called to OVERWRITE currently existing spell params! usually to set active = false for lower ranks of a spell SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (!SpellMgr::CheckSpellValid(spellInfo, spellId, false)) - return false; + if (!SpellMgr::CheckSpellValid(spellInfo, spellId, false)) + return false; - // pussywizard: already found and temporary, nothing to do + // pussywizard: already found and temporary, nothing to do PlayerSpellMap::iterator itr = m_spells.find(spellId); if (itr != m_spells.end() && itr->second->State == PLAYERSPELL_TEMPORARY) return false; - // xinef: send packet so client can properly recognize this new spell - // xinef: ignore passive spells and spells with learn effect - // xinef: send spells with no aura effects (ie dual wield) - if (IsInWorld() && !isBeingLoaded() && temporary && (!spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) - SendLearnPacket(spellInfo->Id, true); + // xinef: send packet so client can properly recognize this new spell + // xinef: ignore passive spells and spells with learn effect + // xinef: send spells with no aura effects (ie dual wield) + if (IsInWorld() && !isBeingLoaded() && temporary && (!spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) + SendLearnPacket(spellInfo->Id, true); - // xinef: DO NOT allow to learn spell with effect learn spell! - // xinef: if spell possess spell learn effects only, learn those spells as temporary (eg. Metamorphosis, Tree of Life) - if (temporary && spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) - { - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (spellInfo->Effects[i].IsEffect()) - { - if (spellInfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL) - { - sLog->outString("TRYING TO LEARN SPELL WITH EFFECT LEARN: %u, PLAYER: %u", spellId, GetGUIDLow()); - return false; - //ASSERT(false); - } - else if (const SpellInfo* learnSpell = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell)) - _addSpell(learnSpell->Id, SPEC_MASK_ALL, true); - } + // xinef: DO NOT allow to learn spell with effect learn spell! + // xinef: if spell possess spell learn effects only, learn those spells as temporary (eg. Metamorphosis, Tree of Life) + if (temporary && spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) + { + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (spellInfo->Effects[i].IsEffect()) + { + if (spellInfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL) + { + sLog->outString("TRYING TO LEARN SPELL WITH EFFECT LEARN: %u, PLAYER: %u", spellId, GetGUIDLow()); + return false; + //ASSERT(false); + } + else if (const SpellInfo* learnSpell = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell)) + _addSpell(learnSpell->Id, SPEC_MASK_ALL, true); + } - return false; - } + return false; + } if (itr != m_spells.end()) // pussywizard: already know this spell, so update information { // pussywizard: do nothing if already set as wanted - if (itr->second->State != PLAYERSPELL_REMOVED && (itr->second->specMask & addSpecMask) == addSpecMask) + if (itr->second->State != PLAYERSPELL_REMOVED && (itr->second->specMask & addSpecMask) == addSpecMask) return false; - // pussywizard: need cast auras, learn linked spells, do professions stuff, etc. - // pussywizard: but only for spells that are really added (inactive -> active OR added to current spec) - bool spellIsNew = true; + // pussywizard: need cast auras, learn linked spells, do professions stuff, etc. + // pussywizard: but only for spells that are really added (inactive -> active OR added to current spec) + bool spellIsNew = true; - // pussywizard: present in m_spells, not removed, already in current spec, already active - if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec)) - spellIsNew = false; + // pussywizard: present in m_spells, not removed, already in current spec, already active + if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec)) + spellIsNew = false; - // pussywizard: update info in m_spells - if (itr->second->State != PLAYERSPELL_NEW && (itr->second->specMask & addSpecMask) != addSpecMask) - itr->second->State = PLAYERSPELL_CHANGED; - itr->second->Active = true; - itr->second->specMask |= addSpecMask; + // pussywizard: update info in m_spells + if (itr->second->State != PLAYERSPELL_NEW && (itr->second->specMask & addSpecMask) != addSpecMask) + itr->second->State = PLAYERSPELL_CHANGED; + itr->second->Active = true; + itr->second->specMask |= addSpecMask; - if (!spellIsNew) - return true; + if (!spellIsNew) + return true; } - else // pussywizard: not found in m_spells + else // pussywizard: not found in m_spells { PlayerSpell* newspell = new PlayerSpell; newspell->Active = true; - newspell->State = temporary ? PLAYERSPELL_TEMPORARY : (isBeingLoaded() ? PLAYERSPELL_UNCHANGED : PLAYERSPELL_NEW); - newspell->specMask = addSpecMask; + newspell->State = temporary ? PLAYERSPELL_TEMPORARY : (isBeingLoaded() ? PLAYERSPELL_UNCHANGED : PLAYERSPELL_NEW); + newspell->specMask = addSpecMask; m_spells[spellId] = newspell; } // pussywizard: return if spell not in current spec - // pussywizard: return true to fix active for ranks, this condition is true only at loading, so no problems with learning packets + // pussywizard: return true to fix active for ranks, this condition is true only at loading, so no problems with learning packets if (!((1<HasEffect(SPELL_EFFECT_LEARN_SPELL)) - { - sLog->outString("TRYING TO LEARN SPELL WITH EFFECT LEARN 2: %u, PLAYER: %u", spellId, GetGUIDLow()); - m_spells.erase(spellInfo->Id); // mem leak, but should never happen - return false; - //ASSERT(false); - } + // xinef: do not add spells with effect learn spell + if (spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) + { + sLog->outString("TRYING TO LEARN SPELL WITH EFFECT LEARN 2: %u, PLAYER: %u", spellId, GetGUIDLow()); + m_spells.erase(spellInfo->Id); // mem leak, but should never happen + return false; + //ASSERT(false); + } // pussywizard: cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks - else if (spellInfo->IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE) && spellInfo->Stances)) + else if (spellInfo->IsPassive() || (spellInfo->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE) && spellInfo->Stances)) { if (IsNeedCastPassiveSpellAtLearn(spellInfo)) CastSpell(this, spellId, true); } - // pussywizard: cast and return, learnt spells will update profession count, etc. + // pussywizard: cast and return, learnt spells will update profession count, etc. else if (spellInfo->HasEffect(SPELL_EFFECT_SKILL_STEP)) { CastSpell(this, spellId, true); return false; } - // xinef: unapply aura stats if dont meet requirements - // xinef: handle only if player is not loaded, loading is handled in loadfromdb - if (!isBeingLoaded()) - if (Aura* aura = GetAura(spellId)) - { - if (aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_35_PERCENT || - aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTH_ABOVE_75_PERCENT || - aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_20_PERCENT ) - if (!HasAuraState((AuraStateType)aura->GetSpellInfo()->CasterAuraState)) - aura->HandleAllEffects(aura->GetApplicationOfTarget(GetGUID()), AURA_EFFECT_HANDLE_REAL, false); - } + // xinef: unapply aura stats if dont meet requirements + // xinef: handle only if player is not loaded, loading is handled in loadfromdb + if (!isBeingLoaded()) + if (Aura* aura = GetAura(spellId)) + { + if (aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_35_PERCENT || + aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTH_ABOVE_75_PERCENT || + aura->GetSpellInfo()->CasterAuraState == AURA_STATE_HEALTHLESS_20_PERCENT ) + if (!HasAuraState((AuraStateType)aura->GetSpellInfo()->CasterAuraState)) + aura->HandleAllEffects(aura->GetApplicationOfTarget(GetGUID()), AURA_EFFECT_HANDLE_REAL, false); + } // pussywizard: update free primary prof points if (uint32 freeProfs = GetFreePrimaryProfessionPoints()) @@ -3957,16 +3957,16 @@ bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary) SetFreePrimaryProfessions(freeProfs-1); } - // pussywizard: update 310 flyer speed - if (!Has310Flyer(false)) - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && spellInfo->Effects[i].CalcValue() == 310) - SetHas310Flyer(true); + // pussywizard: update 310 flyer speed + if (!Has310Flyer(false)) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && spellInfo->Effects[i].CalcValue() == 310) + SetHas310Flyer(true); uint16 maxskill = GetMaxSkillValueForLevel(); SpellLearnSkillNode const* spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spellId); SkillLineAbilityMapBounds skill_bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId); - // xinef: set appropriate skill value + // xinef: set appropriate skill value if (spellLearnSkill) { uint32 skill_value = GetPureSkillValue(spellLearnSkill->skill); @@ -3980,37 +3980,37 @@ bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary) SetSkill(spellLearnSkill->skill, spellLearnSkill->step, skill_value, skill_max_value); } - else - { - // pussywizard: checked, ok - for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx) - { - SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId); - if (!pSkill || HasSkill(pSkill->id)) - continue; + else + { + // pussywizard: checked, ok + for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx) + { + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId); + if (!pSkill || HasSkill(pSkill->id)) + continue; - if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL || // pussywizard: learning autolearned spell from skill ensures having the skill - ((pSkill->id == SKILL_LOCKPICKING || pSkill->id == SKILL_RUNEFORGING) && _spell_idx->second->max_value == 0)) // pussywizard: learning any spell from lockpicking or runeforging ensures having the skill - { - switch (GetSkillRangeType(pSkill, _spell_idx->second->racemask != 0)) - { - case SKILL_RANGE_LANGUAGE: - SetSkill(pSkill->id, GetSkillStep(pSkill->id), 300, 300); - break; - case SKILL_RANGE_LEVEL: - SetSkill(pSkill->id, GetSkillStep(pSkill->id), 1, GetMaxSkillValueForLevel()); - break; - case SKILL_RANGE_MONO: - SetSkill(pSkill->id, GetSkillStep(pSkill->id), 1, 1); - break; - default: - break; - } - } - } - } + if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL || // pussywizard: learning autolearned spell from skill ensures having the skill + ((pSkill->id == SKILL_LOCKPICKING || pSkill->id == SKILL_RUNEFORGING) && _spell_idx->second->max_value == 0)) // pussywizard: learning any spell from lockpicking or runeforging ensures having the skill + { + switch (GetSkillRangeType(pSkill, _spell_idx->second->racemask != 0)) + { + case SKILL_RANGE_LANGUAGE: + SetSkill(pSkill->id, GetSkillStep(pSkill->id), 300, 300); + break; + case SKILL_RANGE_LEVEL: + SetSkill(pSkill->id, GetSkillStep(pSkill->id), 1, GetMaxSkillValueForLevel()); + break; + case SKILL_RANGE_MONO: + SetSkill(pSkill->id, GetSkillStep(pSkill->id), 1, 1); + break; + default: + break; + } + } + } + } - // xinef: update achievement criteria + // xinef: update achievement criteria if (!GetSession()->PlayerLoading()) { for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx) @@ -4036,39 +4036,39 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const void Player::learnSpell(uint32 spellId) { - // Xinef: don't allow to learn active spell once more - if (HasActiveSpell(spellId)) - { - sLog->outError("Player (%u) tries to learn already active spell: %u", GetGUIDLow(), spellId); - return; - } - - uint32 firstRankSpellId = sSpellMgr->GetFirstSpellInChain(spellId); - bool thisSpec = GetTalentSpellCost(firstRankSpellId) > 0 || sSpellMgr->IsAdditionalTalentSpell(firstRankSpellId); - bool added = addSpell(spellId, thisSpec ? GetActiveSpecMask() : SPEC_MASK_ALL, true); - if (added && IsInWorld()) + // Xinef: don't allow to learn active spell once more + if (HasActiveSpell(spellId)) { - // pussywizard: a system message "you have learnt spell X (rank Y)" - SendLearnPacket(spellId, true); + sLog->outError("Player (%u) tries to learn already active spell: %u", GetGUIDLow(), spellId); + return; } - // pussywizard: rank stuff at the end! + uint32 firstRankSpellId = sSpellMgr->GetFirstSpellInChain(spellId); + bool thisSpec = GetTalentSpellCost(firstRankSpellId) > 0 || sSpellMgr->IsAdditionalTalentSpell(firstRankSpellId); + bool added = addSpell(spellId, thisSpec ? GetActiveSpecMask() : SPEC_MASK_ALL, true); + if (added && IsInWorld()) + { + // pussywizard: a system message "you have learnt spell X (rank Y)" + SendLearnPacket(spellId, true); + } + + // pussywizard: rank stuff at the end! if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spellId)) { - // pussywizard: lookup next rank in m_spells (the only talents on m_spella are for example pyroblast, that have all ranks restored upon learning rank 1) - // pussywizard: next ranks must not be in current spec (otherwise no need to learn already learnt) + // pussywizard: lookup next rank in m_spells (the only talents on m_spella are for example pyroblast, that have all ranks restored upon learning rank 1) + // pussywizard: next ranks must not be in current spec (otherwise no need to learn already learnt) PlayerSpellMap::iterator itr = m_spells.find(nextSpell); - if (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && !itr->second->IsInSpec(m_activeSpec)) + if (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && !itr->second->IsInSpec(m_activeSpec)) learnSpell(nextSpell); } - // xinef: if we learn new spell, check all spells requiring this spell, if we have such a spell, and it is not in current spec - learn it + // xinef: if we learn new spell, check all spells requiring this spell, if we have such a spell, and it is not in current spec - learn it SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(spellId); for (SpellsRequiringSpellMap::const_iterator itr = spellsRequiringSpell.first; itr != spellsRequiringSpell.second; ++itr) { PlayerSpellMap::iterator itr2 = m_spells.find(itr->second); - if (itr2 != m_spells.end() && itr2->second->State != PLAYERSPELL_REMOVED && !itr2->second->IsInSpec(m_activeSpec)) - learnSpell(itr2->first); + if (itr2 != m_spells.end() && itr2->second->State != PLAYERSPELL_REMOVED && !itr2->second->IsInSpec(m_activeSpec)) + learnSpell(itr2->first); } } @@ -4078,39 +4078,39 @@ void Player::removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporar if (itr == m_spells.end()) return; - // pussywizard: nothing to do if already removed or not in specs of removeSpecMask - if (itr->second->State == PLAYERSPELL_REMOVED || (itr->second->specMask & removeSpecMask) == 0) + // pussywizard: nothing to do if already removed or not in specs of removeSpecMask + if (itr->second->State == PLAYERSPELL_REMOVED || (itr->second->specMask & removeSpecMask) == 0) return; - // pussywizard: avoid any possible bugs - if (onlyTemporary && itr->second->State != PLAYERSPELL_TEMPORARY) - return; + // pussywizard: avoid any possible bugs + if (onlyTemporary && itr->second->State != PLAYERSPELL_TEMPORARY) + return; // pussywizard: remove non-talent higher ranks (recursive) - // pussywizard: do this at the beginning, not in the middle of removing! + // pussywizard: do this at the beginning, not in the middle of removing! if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spellId)) if (!GetTalentSpellPos(nextSpell)) removeSpell(nextSpell, removeSpecMask, onlyTemporary); // xinef: if current spell has talentcost, remove spells requiring this spell - uint32 firstRankSpellId = sSpellMgr->GetFirstSpellInChain(spellId); - if (GetTalentSpellCost(firstRankSpellId)) - { - SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(spellId); - for (SpellsRequiringSpellMap::const_iterator itr = spellsRequiringSpell.first; itr != spellsRequiringSpell.second; ++itr) - removeSpell(itr->second, removeSpecMask, onlyTemporary); - } + uint32 firstRankSpellId = sSpellMgr->GetFirstSpellInChain(spellId); + if (GetTalentSpellCost(firstRankSpellId)) + { + SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(spellId); + for (SpellsRequiringSpellMap::const_iterator itr = spellsRequiringSpell.first; itr != spellsRequiringSpell.second; ++itr) + removeSpell(itr->second, removeSpecMask, onlyTemporary); + } // pussywizard: re-search, it can be corrupted in prev loop itr = m_spells.find(spellId); if (itr == m_spells.end()) return; - itr->second->specMask = (((uint8)itr->second->specMask) & ~removeSpecMask); // pussywizard: update specMask in map + itr->second->specMask = (((uint8)itr->second->specMask) & ~removeSpecMask); // pussywizard: update specMask in map - // pussywizard: some more conditions needed for spells like pyroblast (shouldn't be fully removed when not available in any spec, should stay in db with specMask = 0) - if (GetTalentSpellCost(firstRankSpellId) == 0 && !sSpellMgr->IsAdditionalTalentSpell(firstRankSpellId) && itr->second->specMask == 0) - { + // pussywizard: some more conditions needed for spells like pyroblast (shouldn't be fully removed when not available in any spec, should stay in db with specMask = 0) + if (GetTalentSpellCost(firstRankSpellId) == 0 && !sSpellMgr->IsAdditionalTalentSpell(firstRankSpellId) && itr->second->specMask == 0) + { if (itr->second->State == PLAYERSPELL_NEW || itr->second->State == PLAYERSPELL_TEMPORARY) { delete itr->second; @@ -4119,25 +4119,25 @@ void Player::removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporar else itr->second->State = PLAYERSPELL_REMOVED; } - else if (itr->second->State != PLAYERSPELL_NEW && itr->second->State != PLAYERSPELL_TEMPORARY) - itr->second->State = PLAYERSPELL_CHANGED; + else if (itr->second->State != PLAYERSPELL_NEW && itr->second->State != PLAYERSPELL_TEMPORARY) + itr->second->State = PLAYERSPELL_CHANGED; - // xinef: this is used for talents and they are not removed in removeSpell function... - // xinef: however ill leave this here just in case - // pussywizard: remove owned aura obtained from currently removed spell + // xinef: this is used for talents and they are not removed in removeSpell function... + // xinef: however ill leave this here just in case + // pussywizard: remove owned aura obtained from currently removed spell RemoveOwnedAura(spellId); - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - { - // pussywizard: remove pet auras + { + // pussywizard: remove pet auras if (PetAura const* petSpell = sSpellMgr->GetPetAura(spellId, i)) RemovePetAura(petSpell); - // pussywizard: remove all triggered auras - if (spellInfo->Effects[i].TriggerSpell > 0) - RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell); - } + // pussywizard: remove all triggered auras + if (spellInfo->Effects[i].TriggerSpell > 0) + RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell); + } // pussywizard: update free primary prof points if (spellInfo->IsPrimaryProfessionFirstRank()) @@ -4197,23 +4197,23 @@ void Player::removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporar if (!pSkill) continue; - // pussywizard: don't understand why whole skill is removed when just single spell from it is removed + // pussywizard: don't understand why whole skill is removed when just single spell from it is removed if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL && pSkill->categoryId != SKILL_CATEGORY_CLASS || // pussywizard: don't unlearn class skills (pSkill->id == SKILL_LOCKPICKING || pSkill->id == SKILL_RUNEFORGING) && _spell_idx->second->max_value == 0) { // not reset skills for professions and racial abilities if ((pSkill->categoryId == SKILL_CATEGORY_SECONDARY || pSkill->categoryId == SKILL_CATEGORY_PROFESSION) && (IsProfessionSkill(pSkill->id) || _spell_idx->second->racemask != 0)) continue; - - // pussywizard: this is needed for weapon/armor/language skills to remove them when loosing spell + + // pussywizard: this is needed for weapon/armor/language skills to remove them when loosing spell SetSkill(pSkill->id, GetSkillStep(pSkill->id), 0, 0); } } } // pussywizard: remove from spell book (can't be replaced by previous rank, because such spells can't be unlearnt) - if (!onlyTemporary || ((!spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))) - SendLearnPacket(spellId, false); + if (!onlyTemporary || ((!spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)) || !spellInfo->HasAnyAura()) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))) + SendLearnPacket(spellId, false); } bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId) @@ -4226,9 +4226,9 @@ bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId) SpellInfo const* spellInfo; for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) { - // pussywizard: - if (itr->second->State == PLAYERSPELL_REMOVED) - continue; + // pussywizard: + if (itr->second->State == PLAYERSPELL_REMOVED) + continue; if (itr->first == excludeSpellId) continue; @@ -4274,21 +4274,21 @@ void Player::RemoveCategoryCooldown(uint32 cat) void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns) { // remove cooldowns on spells that have < 10 min CD - uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck; + uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck; SpellCooldowns::iterator itr, next; for (itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); itr = next) { next = itr; ++next; SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - if (!spellInfo) // xinef: impossibru... - continue; + if (!spellInfo) // xinef: impossibru... + continue; - if (spellInfo->HasAttribute(SPELL_ATTR4_USABLE_IN_ARENA)) - RemoveSpellCooldown(itr->first, true); - else if (spellInfo->RecoveryTime < 10 * MINUTE * IN_MILLISECONDS && spellInfo->CategoryRecoveryTime < 10 * MINUTE * IN_MILLISECONDS && itr->second.end < infTime// xinef: dont remove active cooldowns - bugz - && itr->second.maxduration < 10 * MINUTE * IN_MILLISECONDS) // xinef: dont clear cooldowns that have maxduration > 10 minutes (eg item cooldowns with no spell.dbc cooldown info) - RemoveSpellCooldown(itr->first, true); + if (spellInfo->HasAttribute(SPELL_ATTR4_USABLE_IN_ARENA)) + RemoveSpellCooldown(itr->first, true); + else if (spellInfo->RecoveryTime < 10 * MINUTE * IN_MILLISECONDS && spellInfo->CategoryRecoveryTime < 10 * MINUTE * IN_MILLISECONDS && itr->second.end < infTime// xinef: dont remove active cooldowns - bugz + && itr->second.maxduration < 10 * MINUTE * IN_MILLISECONDS) // xinef: dont clear cooldowns that have maxduration > 10 minutes (eg item cooldowns with no spell.dbc cooldown info) + RemoveSpellCooldown(itr->first, true); } // pet cooldowns @@ -4306,12 +4306,12 @@ void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns) void Player::RemoveAllSpellCooldown() { - uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck; + uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck; if (!m_spellCooldowns.empty()) { for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr) - if (itr->second.end < infTime) - SendClearCooldown(itr->first, this); + if (itr->second.end < infTime) + SendClearCooldown(itr->first, this); m_spellCooldowns.clear(); } @@ -4360,7 +4360,7 @@ void Player::_SaveSpellCooldowns(SQLTransaction& trans, bool logout) trans->Append(stmt); time_t curTime = time(NULL); - uint32 curMSTime = World::GetGameTimeMS(); + uint32 curMSTime = World::GetGameTimeMS(); uint32 infTime = curMSTime + infinityCooldownDelayCheck; bool first_round = true; @@ -4369,16 +4369,16 @@ void Player::_SaveSpellCooldowns(SQLTransaction& trans, bool logout) // remove outdated and save active for (SpellCooldowns::iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end();) { - // Xinef: dummy cooldown for procs - if (itr->first == uint32(-1)) - { - ++itr; - continue; - } + // Xinef: dummy cooldown for procs + if (itr->first == uint32(-1)) + { + ++itr; + continue; + } if (itr->second.end <= curMSTime+1000) m_spellCooldowns.erase(itr++); - else if (itr->second.end <= infTime && (logout || itr->second.end > (curMSTime + 5*MINUTE*IN_MILLISECONDS))) // not save locked cooldowns, it will be reset or set at reload + else if (itr->second.end <= infTime && (logout || itr->second.end > (curMSTime + 5*MINUTE*IN_MILLISECONDS))) // not save locked cooldowns, it will be reset or set at reload { if (first_round) { @@ -4389,7 +4389,7 @@ void Player::_SaveSpellCooldowns(SQLTransaction& trans, bool logout) else ss << ','; - uint64 cooldown = uint64(((itr->second.end - curMSTime) / IN_MILLISECONDS) + curTime); + uint64 cooldown = uint64(((itr->second.end - curMSTime) / IN_MILLISECONDS) + curTime); ss << '(' << GetGUIDLow() << ',' << itr->first << ',' << itr->second.itemid << ',' << cooldown << ',' << (itr->second.needSendToClient ? '1' : '0') << ')'; ++itr; } @@ -4442,15 +4442,15 @@ bool Player::resetTalents(bool noResetCost) if (HasAtLoginFlag(AT_LOGIN_RESET_TALENTS)) RemoveAtLoginFlag(AT_LOGIN_RESET_TALENTS, true); - // xinef: get max available talent points amount + // xinef: get max available talent points amount uint32 talentPointsForLevel = CalculateTalentsPoints(); - // xinef: no talent points are used, return + // xinef: no talent points are used, return if (m_usedTalentCount == 0) return false; - m_usedTalentCount = 0; + m_usedTalentCount = 0; - // xinef: check if we have enough money + // xinef: check if we have enough money uint32 resetCost = 0; if (!noResetCost && !sWorld->getBoolConfig(CONFIG_NO_RESET_TALENT_COST)) { @@ -4464,50 +4464,50 @@ bool Player::resetTalents(bool noResetCost) RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); - // xinef: reset talents - for (PlayerTalentMap::iterator iter = m_talents.begin(); iter != m_talents.end(); ) - { - PlayerTalentMap::iterator itr = iter++; + // xinef: reset talents + for (PlayerTalentMap::iterator iter = m_talents.begin(); iter != m_talents.end(); ) + { + PlayerTalentMap::iterator itr = iter++; - if (itr->second->State == PLAYERSPELL_REMOVED) - continue; + if (itr->second->State == PLAYERSPELL_REMOVED) + continue; - // xinef: talent not in current spec - if (!(itr->second->specMask & GetActiveSpecMask())) - continue; + // xinef: talent not in current spec + if (!(itr->second->specMask & GetActiveSpecMask())) + continue; - // xinef: remove talent auras - _removeTalentAurasAndSpells(itr->first); + // xinef: remove talent auras + _removeTalentAurasAndSpells(itr->first); - // xinef: check if talent learns spell to spell book - TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID); - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(itr->first); + // xinef: check if talent learns spell to spell book + TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID); + const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - bool removed = false; - if (talentInfo->addToSpellBook) - if (!spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) - { - removeSpell(itr->first, GetActiveSpecMask(), false); - removed = true; - } + bool removed = false; + if (talentInfo->addToSpellBook) + if (!spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) + { + removeSpell(itr->first, GetActiveSpecMask(), false); + removed = true; + } - // Xinef: send unlearn spell packet at talent remove - if (!removed) - SendLearnPacket(itr->first, false); + // Xinef: send unlearn spell packet at talent remove + if (!removed) + SendLearnPacket(itr->first, false); - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL) - if (sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell)) - removeSpell(spellInfo->Effects[i].TriggerSpell, GetActiveSpecMask(), false); + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL) + if (sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell)) + removeSpell(spellInfo->Effects[i].TriggerSpell, GetActiveSpecMask(), false); - // xinef: remove talent modifies m_talents, move itr to map begin - _removeTalent(itr, GetActiveSpecMask()); - } + // xinef: remove talent modifies m_talents, move itr to map begin + _removeTalent(itr, GetActiveSpecMask()); + } - // xinef: remove titan grip if player had it set + // xinef: remove titan grip if player had it set if (m_canTitanGrip) SetCanTitanGrip(false); - // xinef: remove dual wield if player does not have dual wield spell (shamans) + // xinef: remove dual wield if player does not have dual wield spell (shamans) if (!HasSpell(674) && m_canDualWield) SetCanDualWield(false); @@ -4548,13 +4548,13 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c { if (target == this) { - for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) - { - if (m_items[i] == NULL) - continue; + for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) + { + if (m_items[i] == NULL) + continue; - m_items[i]->BuildCreateUpdateBlockForPlayer(data, target); - } + m_items[i]->BuildCreateUpdateBlockForPlayer(data, target); + } for (uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { @@ -4609,19 +4609,19 @@ void Player::DestroyForPlayer(Player* target, bool onDeath) const bool Player::HasSpell(uint32 spell) const { PlayerSpellMap::const_iterator itr = m_spells.find(spell); - return (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec)); + return (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec)); } bool Player::HasTalent(uint32 spell, uint8 spec) const { PlayerTalentMap::const_iterator itr = m_talents.find(spell); - return (itr != m_talents.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec)); + return (itr != m_talents.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(m_activeSpec)); } bool Player::HasActiveSpell(uint32 spell) const { PlayerSpellMap::const_iterator itr = m_spells.find(spell); - return (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->Active && itr->second->IsInSpec(m_activeSpec)); + return (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && itr->second->Active && itr->second->IsInSpec(m_activeSpec)); } TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell) const @@ -4729,15 +4729,15 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC // remove from arena teams LeaveAllArenaTeams(playerguid); - // remove from group - if (uint32 groupId = GetGroupIdFromStorage(guid)) - if (Group* group = sGroupMgr->GetGroupByGUID(groupId)) - RemoveFromGroup(group, playerguid); + // remove from group + if (uint32 groupId = GetGroupIdFromStorage(guid)) + if (Group* group = sGroupMgr->GetGroupByGUID(groupId)) + RemoveFromGroup(group, playerguid); // Remove signs from petitions (also remove petitions if owner); RemovePetitionsAndSigns(playerguid, 10); - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = NULL; switch (charDelete_method) { @@ -5023,7 +5023,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC } default: sLog->outError("Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method); - return; + return; } if (updateRealmChars) @@ -5179,7 +5179,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) // trigger update zone for alive state zone updates uint32 newzone, newarea; - GetZoneAndAreaId(newzone, newarea, true); + GetZoneAndAreaId(newzone, newarea, true); UpdateZone(newzone, newarea); sOutdoorPvPMgr->HandlePlayerResurrects(this, newzone); @@ -5286,12 +5286,12 @@ void Player::CreateCorpse() if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK)) flags |= CORPSE_FLAG_HIDE_CLOAK; - // Xinef: Player can loop corpses while in BG or in WG - if (InBattleground() && !InArena()) + // Xinef: Player can loop corpses while in BG or in WG + if (InBattleground() && !InArena()) flags |= CORPSE_FLAG_LOOTABLE; - Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (Bf && Bf->IsWarTime()) - flags |= CORPSE_FLAG_LOOTABLE; + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (Bf && Bf->IsWarTime()) + flags |= CORPSE_FLAG_LOOTABLE; corpse->SetUInt32Value(CORPSE_FIELD_FLAGS, flags); @@ -5326,19 +5326,19 @@ void Player::SpawnCorpseBones() { if (sObjectAccessor->ConvertCorpseForPlayer(GetGUID())) if (!GetSession()->PlayerLogoutWithSave()) // at logout we will already store the player - { - // prevent loading as ghost without corpse - SQLTransaction trans = CharacterDatabase.BeginTransaction(); + { + // prevent loading as ghost without corpse + SQLTransaction trans = CharacterDatabase.BeginTransaction(); - // pussywizard: update only ghost flag instead of whole character table entry! data integrity is crucial - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_REMOVE_GHOST); - stmt->setUInt32(0, GetGUIDLow()); - trans->Append(stmt); + // pussywizard: update only ghost flag instead of whole character table entry! data integrity is crucial + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_REMOVE_GHOST); + stmt->setUInt32(0, GetGUIDLow()); + trans->Append(stmt); - _SaveAuras(trans, false); + _SaveAuras(trans, false); - CharacterDatabase.CommitTransaction(trans); - } + CharacterDatabase.CommitTransaction(trans); + } } Corpse* Player::GetCorpse() const @@ -5553,7 +5553,7 @@ void Player::RepopAtGraveyard() AreaTableEntry const* zone = GetAreaEntryByAreaID(GetAreaId()); // Such zones are considered unreachable as a ghost and the player must be automatically revived - // Xinef: Get Transport Check is not needed + // Xinef: Get Transport Check is not needed if ((!IsAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) /*|| GetTransport()*/ || GetPositionZ() < -500.0f) { ResurrectPlayer(0.5f); @@ -5637,9 +5637,9 @@ void Player::ClearChannelWatch() void Player::UpdateLocalChannels(uint32 newZone) { - // pussywizard: mutex needed (tc changed opcode to THREAD UNSAFE) - static ACE_Thread_Mutex channelsLock; - TRINITY_GUARD(ACE_Thread_Mutex, channelsLock); + // pussywizard: mutex needed (tc changed opcode to THREAD UNSAFE) + static ACE_Thread_Mutex channelsLock; + TRINITY_GUARD(ACE_Thread_Mutex, channelsLock); if (GetSession()->PlayerLoading() && !IsBeingTeleportedFar()) return; // The client handles it automatically after loading, but not after teleporting @@ -6840,8 +6840,8 @@ void Player::CheckAreaExploreAndOutdoor() if (IsInFlight()) return; - bool isOutdoor = IsOutdoors(); - uint32 areaFlag = GetAreaFlagByAreaID(GetAreaId()); + bool isOutdoor = IsOutdoors(); + uint32 areaFlag = GetAreaFlagByAreaID(GetAreaId()); if (sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK) && !isOutdoor) RemoveAurasWithAttribute(SPELL_ATTR0_OUTDOORS_ONLY); @@ -7054,8 +7054,8 @@ void Player::RewardReputation(Unit* victim, float rate) FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1); uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); - if (factionEntry1) - GetReputationMgr().ModifyReputation(factionEntry1, donerep1, bool(current_reputation_rank1 > Rep->ReputationMaxCap1)); + if (factionEntry1) + GetReputationMgr().ModifyReputation(factionEntry1, donerep1, bool(current_reputation_rank1 > Rep->ReputationMaxCap1)); } if (Rep->RepFaction2 && (!Rep->TeamDependent || teamId == TEAM_HORDE)) @@ -7065,8 +7065,8 @@ void Player::RewardReputation(Unit* victim, float rate) FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2); uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); - if (factionEntry2) - GetReputationMgr().ModifyReputation(factionEntry2, donerep2, bool(current_reputation_rank2 > Rep->ReputationMaxCap2)); + if (factionEntry2) + GetReputationMgr().ModifyReputation(factionEntry2, donerep2, bool(current_reputation_rank2 > Rep->ReputationMaxCap2)); } } @@ -7168,12 +7168,12 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar if (HasAura(SPELL_AURA_PLAYER_INACTIVE)) return false; - // check if player has same IP - if (uVictim && uVictim->GetTypeId() == TYPEID_PLAYER) - { - if (GetSession()->GetRemoteAddress() == uVictim->ToPlayer()->GetSession()->GetRemoteAddress()) - return false; - } + // check if player has same IP + if (uVictim && uVictim->GetTypeId() == TYPEID_PLAYER) + { + if (GetSession()->GetRemoteAddress() == uVictim->ToPlayer()->GetSession()->GetRemoteAddress()) + return false; + } uint64 victim_guid = 0; uint32 victim_rank = 0; @@ -7182,7 +7182,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar UpdateHonorFields(); // do not reward honor in arenas, but return true to enable onkill spellproc - if (InArena()) + if (InArena()) return true; // Promote to float for calculations @@ -7241,7 +7241,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_RACE, victim->getRace()); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, GetAreaId()); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, 1, 0, victim); - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, victim); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, victim); } else { @@ -7275,24 +7275,24 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar data << victim_guid; data << victim_rank; - // Xinef: non quest case, quest honor obtain is send in quest reward packet - if (uVictim || groupsize > 0) - GetSession()->SendPacket(&data); + // Xinef: non quest case, quest honor obtain is send in quest reward packet + if (uVictim || groupsize > 0) + GetSession()->SendPacket(&data); // add honor points ModifyHonorPoints(honor); ApplyModUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, honor, true); - // Xinef: Battleground experience + // Xinef: Battleground experience if (awardXP) - if (Battleground* bg = GetBattleground()) - { + if (Battleground* bg = GetBattleground()) + { bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false); //false: prevent looping - // Xinef: Only for BG activities - if (!uVictim) - GiveXP(uint32(honor*(3+getLevel()*0.30f)), NULL); - } + // Xinef: Only for BG activities + if (!uVictim) + GiveXP(uint32(honor*(3+getLevel()*0.30f)), NULL); + } return true; } @@ -7349,23 +7349,23 @@ void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/) uint32 Player::GetGuildIdFromStorage(uint32 guid) { - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid)) - return playerData->guildId; - return 0; + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid)) + return playerData->guildId; + return 0; } uint32 Player::GetGroupIdFromStorage(uint32 guid) { - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid)) - return playerData->groupId; - return 0; + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid)) + return playerData->groupId; + return 0; } uint32 Player::GetArenaTeamIdFromStorage(uint32 guid, uint8 slot) { - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid)) - return playerData->arenaTeamId[slot]; - return 0; + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid)) + return playerData->arenaTeamId[slot]; + return 0; } uint32 Player::GetZoneIdFromDB(uint64 guid) @@ -7416,9 +7416,9 @@ uint32 Player::GetZoneIdFromDB(uint64 guid) uint32 Player::GetLevelFromStorage(uint64 guid) { - // xinef: Get data from global storage - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) - return playerData->level; + // xinef: Get data from global storage + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) + return playerData->level; return 0; } @@ -7434,103 +7434,103 @@ void Player::UpdateArea(uint32 newArea) m_areaUpdateId = newArea; AreaTableEntry const* area = GetAreaEntryByAreaID(newArea); - bool oldFFAPvPArea = pvpInfo.IsInFFAPvPArea; + bool oldFFAPvPArea = pvpInfo.IsInFFAPvPArea; pvpInfo.IsInFFAPvPArea = area && (area->flags & AREA_FLAG_ARENA); UpdatePvPState(true); - // xinef: check if we were in ffa arena and we left - if (oldFFAPvPArea && !pvpInfo.IsInFFAPvPArea) - { - // xinef: iterate attackers - AttackerSet toRemove; - AttackerSet const& attackers = getAttackers(); - for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end(); ++itr) - if (!(*itr)->IsValidAttackTarget(this)) - toRemove.insert(*itr); - - for (AttackerSet::const_iterator itr = toRemove.begin(); itr != toRemove.end(); ++itr) - (*itr)->AttackStop(); + // xinef: check if we were in ffa arena and we left + if (oldFFAPvPArea && !pvpInfo.IsInFFAPvPArea) + { + // xinef: iterate attackers + AttackerSet toRemove; + AttackerSet const& attackers = getAttackers(); + for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end(); ++itr) + if (!(*itr)->IsValidAttackTarget(this)) + toRemove.insert(*itr); + + for (AttackerSet::const_iterator itr = toRemove.begin(); itr != toRemove.end(); ++itr) + (*itr)->AttackStop(); - // xinef: remove our own victim - if (Unit* victim = GetVictim()) - if (!IsValidAttackTarget(victim)) - AttackStop(); - } + // xinef: remove our own victim + if (Unit* victim = GetVictim()) + if (!IsValidAttackTarget(victim)) + AttackStop(); + } UpdateAreaDependentAuras(newArea); - pvpInfo.IsInNoPvPArea = false; - if (!area) - { + pvpInfo.IsInNoPvPArea = false; + if (!area) + { RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); - RemoveRestState(); - return; - } + RemoveRestState(); + return; + } - // Xinef: area should inherit zone flags - AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone); - uint32 areaFlags = area->flags; - bool isSanctuary = area->IsSanctuary(); - bool isInn = area->IsInn(GetTeamId()); - if (zone) - { - areaFlags |= zone->flags; - isSanctuary |= zone->IsSanctuary(); - isInn |= zone->IsInn(GetTeamId()); - } + // Xinef: area should inherit zone flags + AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone); + uint32 areaFlags = area->flags; + bool isSanctuary = area->IsSanctuary(); + bool isInn = area->IsInn(GetTeamId()); + if (zone) + { + areaFlags |= zone->flags; + isSanctuary |= zone->IsSanctuary(); + isInn |= zone->IsInn(GetTeamId()); + } // previously this was in UpdateZone (but after UpdateArea) so nothing will break - if (isSanctuary) // in sanctuary - { - SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); - pvpInfo.IsInNoPvPArea = true; - CombatStopWithPets(); - } - else - RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); + if (isSanctuary) // in sanctuary + { + SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); + pvpInfo.IsInNoPvPArea = true; + CombatStopWithPets(); + } + else + RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); - if (isInn) - { - SetRestState(0); - if (sWorld->IsFFAPvPRealm()) - RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - } + if (isInn) + { + SetRestState(0); + if (sWorld->IsFFAPvPRealm()) + RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); + } else if (!(areaFlags & AREA_FLAG_CAPITAL)) - { - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(GetInnTriggerId()); + { + AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(GetInnTriggerId()); if (!atEntry || !IsInAreaTriggerRadius(atEntry)) - RemoveRestState(); - } + RemoveRestState(); + } } uint32 Player::GetZoneId(bool forceRecalc) const { - if (forceRecalc) - *(const_cast(&m_last_zone_id)) = WorldObject::GetZoneId(); + if (forceRecalc) + *(const_cast(&m_last_zone_id)) = WorldObject::GetZoneId(); - return m_last_zone_id; + return m_last_zone_id; } uint32 Player::GetAreaId(bool forceRecalc) const { - if (forceRecalc) - *(const_cast(&m_last_area_id)) = WorldObject::GetAreaId(); + if (forceRecalc) + *(const_cast(&m_last_area_id)) = WorldObject::GetAreaId(); - return m_last_area_id; + return m_last_area_id; } void Player::GetZoneAndAreaId(uint32& zoneid, uint32& areaid, bool forceRecalc) const { - if (forceRecalc) - { - WorldObject::GetZoneAndAreaId(zoneid, areaid); - *(const_cast(&m_last_zone_id)) = zoneid; - *(const_cast(&m_last_area_id)) = areaid; - return; - } + if (forceRecalc) + { + WorldObject::GetZoneAndAreaId(zoneid, areaid); + *(const_cast(&m_last_zone_id)) = zoneid; + *(const_cast(&m_last_area_id)) = areaid; + return; + } - zoneid = m_last_zone_id; - areaid = m_last_area_id; + zoneid = m_last_zone_id; + areaid = m_last_area_id; } void Player::UpdateZone(uint32 newZone, uint32 newArea) @@ -7991,7 +7991,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply case ITEM_MOD_SPELL_PENETRATION: ApplySpellPenetrationBonus(val, apply); break; - case ITEM_MOD_BLOCK_VALUE: + case ITEM_MOD_BLOCK_VALUE: HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(val), apply); break; // deprecated item mods @@ -8301,17 +8301,17 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, else RemoveAurasDueToSpell(spellInfo->Id); // un-apply spell (item set case) - // Xinef: Remove Proc Spells and Summons - for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) - { - // Xinef: Remove procs - if (spellInfo->Effects[i].TriggerSpell) - RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell); + // Xinef: Remove Proc Spells and Summons + for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) + { + // Xinef: Remove procs + if (spellInfo->Effects[i].TriggerSpell) + RemoveAurasDueToSpell(spellInfo->Effects[i].TriggerSpell); - // Xinef: remove minions summoned by item - if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SUMMON) - RemoveAllMinionsByEntry(spellInfo->Effects[i].MiscValue); - } + // Xinef: remove minions summoned by item + if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SUMMON) + RemoveAllMinionsByEntry(spellInfo->Effects[i].MiscValue); + } } } @@ -8349,10 +8349,10 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 if (!target || !target->IsAlive() || target == this) return; - // Xinef: do not use disarmed weapons, special exception - shaman ghost wolf form - // Xinef: normal forms proc on hit enchants / built in item bonuses - if (!CanUseAttackType(attType) || GetShapeshiftForm() == FORM_GHOSTWOLF) - return; + // Xinef: do not use disarmed weapons, special exception - shaman ghost wolf form + // Xinef: normal forms proc on hit enchants / built in item bonuses + if (!CanUseAttackType(attType) || GetShapeshiftForm() == FORM_GHOSTWOLF) + return; for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) { @@ -8485,17 +8485,17 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 if (roll_chance_f(chance)) { - // Xinef: implement enchant charges - if (uint32 charges = item->GetEnchantmentCharges(EnchantmentSlot(e_slot))) - { - if (!--charges) - { - ApplyEnchantment(item, EnchantmentSlot(e_slot), false); - item->ClearEnchantment(EnchantmentSlot(e_slot)); - } - else - item->SetEnchantmentCharges(EnchantmentSlot(e_slot), charges); - } + // Xinef: implement enchant charges + if (uint32 charges = item->GetEnchantmentCharges(EnchantmentSlot(e_slot))) + { + if (!--charges) + { + ApplyEnchantment(item, EnchantmentSlot(e_slot), false); + item->ClearEnchantment(EnchantmentSlot(e_slot)); + } + else + item->SetEnchantmentCharges(EnchantmentSlot(e_slot), charges); + } if (spellInfo->IsPositive()) CastSpell(this, spellInfo, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD), item); @@ -8534,7 +8534,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 // use triggered flag only for items with many spell casts and for not first cast uint8 count = 0; - std::list pushSpells; + std::list pushSpells; // item spells casted at use for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { @@ -8555,27 +8555,27 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 continue; } - if (HasSpellCooldown(spellInfo->Id)) - continue; + if (HasSpellCooldown(spellInfo->Id)) + continue; Spell* spell = new Spell(this, spellInfo, (count > 0) ? TRIGGERED_FULL_MASK : TRIGGERED_NONE); spell->m_CastItem = item; spell->m_cast_count = cast_count; // set count of casts spell->m_glyphIndex = glyphIndex; // glyph index - spell->InitExplicitTargets(targets); + spell->InitExplicitTargets(targets); - // Xinef: dont allow to cast such spells, it may happen that spell possess 2 spells, one for players and one for items / gameobjects - // Xinef: if first one is cast on player, it may be deleted thus resulting in crash because second spell has saved pointer to the item - // Xinef: there is one problem with scripts which wont be loaded at the moment of call - SpellCastResult result = spell->CheckCast(true); - if (result != SPELL_CAST_OK) - { - spell->SendCastResult(result); - delete spell; - continue; - } + // Xinef: dont allow to cast such spells, it may happen that spell possess 2 spells, one for players and one for items / gameobjects + // Xinef: if first one is cast on player, it may be deleted thus resulting in crash because second spell has saved pointer to the item + // Xinef: there is one problem with scripts which wont be loaded at the moment of call + SpellCastResult result = spell->CheckCast(true); + if (result != SPELL_CAST_OK) + { + spell->SendCastResult(result); + delete spell; + continue; + } - pushSpells.push_back(spell); + pushSpells.push_back(spell); //spell->prepare(&targets); ++count; @@ -8600,36 +8600,36 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 continue; } - if (HasSpellCooldown(spellInfo->Id)) - continue; + if (HasSpellCooldown(spellInfo->Id)) + continue; Spell* spell = new Spell(this, spellInfo, (count > 0) ? TRIGGERED_FULL_MASK : TRIGGERED_NONE); spell->m_CastItem = item; spell->m_cast_count = cast_count; // set count of casts spell->m_glyphIndex = glyphIndex; // glyph index - spell->InitExplicitTargets(targets); + spell->InitExplicitTargets(targets); - // Xinef: dont allow to cast such spells, it may happen that spell possess 2 spells, one for players and one for items / gameobjects - // Xinef: if first one is cast on player, it may be deleted thus resulting in crash because second spell has saved pointer to the item - // Xinef: there is one problem with scripts which wont be loaded at the moment of call - SpellCastResult result = spell->CheckCast(true); - if (result != SPELL_CAST_OK) - { - spell->SendCastResult(result); - delete spell; - continue; - } + // Xinef: dont allow to cast such spells, it may happen that spell possess 2 spells, one for players and one for items / gameobjects + // Xinef: if first one is cast on player, it may be deleted thus resulting in crash because second spell has saved pointer to the item + // Xinef: there is one problem with scripts which wont be loaded at the moment of call + SpellCastResult result = spell->CheckCast(true); + if (result != SPELL_CAST_OK) + { + spell->SendCastResult(result); + delete spell; + continue; + } - pushSpells.push_back(spell); + pushSpells.push_back(spell); //spell->prepare(&targets); ++count; } } - // xinef: send all spells in one go, prevents crash because container is not set - for (std::list::const_iterator itr = pushSpells.begin(); itr != pushSpells.end(); ++itr) - (*itr)->prepare(&targets); + // xinef: send all spells in one go, prevents crash because container is not set + for (std::list::const_iterator itr = pushSpells.begin(); itr != pushSpells.end(); ++itr) + (*itr)->prepare(&targets); } void Player::_RemoveAllItemMods() @@ -8808,7 +8808,7 @@ bool Player::CheckAmmoCompatibility(const ItemTemplate* ammo_proto) const Called by remove insignia spell effect */ void Player::RemovedInsignia(Player* looterPlr) { - // Xinef: If player is not in battleground and not in wintergrasp + // Xinef: If player is not in battleground and not in wintergrasp if (!GetBattlegroundId() && GetZoneId() != AREA_WINTERGRASP) return; @@ -8861,17 +8861,17 @@ void Player::SendLoot(uint64 guid, LootType loot_type) // And permit out of range GO with no owner in case fishing hole if (!go || (loot_type != LOOT_FISHINGHOLE && ((loot_type != LOOT_FISHING && loot_type != LOOT_FISHING_JUNK) || go->GetOwnerGUID() != GetGUID()) && !go->IsWithinDistInMap(this, INTERACTION_DISTANCE)) || (loot_type == LOOT_CORPSE && go->GetRespawnTime() && go->isSpawnedByDefault())) { - go->ForceValuesUpdateAtIndex(GAMEOBJECT_BYTES_1); + go->ForceValuesUpdateAtIndex(GAMEOBJECT_BYTES_1); SendLootRelease(guid); return; } loot = &go->loot; - // Xinef: loot was generated and respawntime has passed since then, allow to recreate loot - // Xinef: to avoid bugs, this rule covers spawned gameobjects only - if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime()+go->GetRespawnDelay() < time(NULL)) - go->SetLootState(GO_READY); + // Xinef: loot was generated and respawntime has passed since then, allow to recreate loot + // Xinef: to avoid bugs, this rule covers spawned gameobjects only + if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime()+go->GetRespawnDelay() < time(NULL)) + go->SetLootState(GO_READY); if (go->getLootState() == GO_READY) { @@ -8883,7 +8883,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) if (bg->GetBgTypeID() == BATTLEGROUND_AV) if (!bg->ToBattlegroundAV()->PlayerCanDoMineQuest(go->GetEntry(), GetTeamId())) { - go->ForceValuesUpdateAtIndex(GAMEOBJECT_BYTES_1); + go->ForceValuesUpdateAtIndex(GAMEOBJECT_BYTES_1); SendLootRelease(guid); return; } @@ -8900,7 +8900,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) group->UpdateLooterGuid(go, true); loot->FillLoot(lootid, LootTemplates_Gameobject, this, !groupRules, false, go->GetLootMode()); - go->SetLootGenerationTime(); + go->SetLootGenerationTime(); // get next RR player (for next loot) if (groupRules && !go->loot.empty()) @@ -8975,8 +8975,8 @@ void Player::SendLoot(uint64 guid, LootType loot_type) loot = &item->loot; - // Xinef: Store container id - loot->containerId = item->GetGUIDLow(); + // Xinef: Store container id + loot->containerId = item->GetGUIDLow(); if (!item->m_lootGenerated && !sLootItemStorage->LoadStoredLoot(item)) { @@ -9018,20 +9018,20 @@ void Player::SendLoot(uint64 guid, LootType loot_type) loot = &bones->loot; - if (loot->loot_type == LOOT_NONE) + if (loot->loot_type == LOOT_NONE) { uint32 pLevel = bones->loot.gold; bones->loot.clear(); - - // Xinef: For AV Achievement + + // Xinef: For AV Achievement if (Battleground* bg = GetBattleground()) - { + { if (bg->GetBgTypeID() == BATTLEGROUND_AV) loot->FillLoot(1, LootTemplates_Creature, this, true); - } - // Xinef: For wintergrasp Quests - else if (GetZoneId() == AREA_WINTERGRASP) - loot->FillLoot(1, LootTemplates_Creature, this, true); + } + // Xinef: For wintergrasp Quests + else if (GetZoneId() == AREA_WINTERGRASP) + loot->FillLoot(1, LootTemplates_Creature, this, true); // It may need a better formula // Now it works like this: lvl10: ~6copper, lvl70: ~9silver @@ -9064,46 +9064,46 @@ void Player::SendLoot(uint64 guid, LootType loot_type) if (loot_type == LOOT_PICKPOCKETING) { - if (loot->loot_type != LOOT_PICKPOCKETING) - { - if (creature->CanGeneratePickPocketLoot()) - { - creature->SetPickPocketLootTime(); - loot->clear(); + if (loot->loot_type != LOOT_PICKPOCKETING) + { + if (creature->CanGeneratePickPocketLoot()) + { + creature->SetPickPocketLootTime(); + loot->clear(); - if (uint32 lootid = creature->GetCreatureTemplate()->pickpocketLootId) - loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, true); + if (uint32 lootid = creature->GetCreatureTemplate()->pickpocketLootId) + loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, true); - // Generate extra money for pick pocket loot - const uint32 a = urand(0, creature->getLevel()/2); - const uint32 b = urand(0, getLevel()/2); - loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY)); - permission = OWNER_PERMISSION; - } - else - { - permission = NONE_PERMISSION; - SendLootError(guid, LOOT_ERROR_ALREADY_PICKPOCKETED); - return; - } - } + // Generate extra money for pick pocket loot + const uint32 a = urand(0, creature->getLevel()/2); + const uint32 b = urand(0, getLevel()/2); + loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY)); + permission = OWNER_PERMISSION; + } + else + { + permission = NONE_PERMISSION; + SendLootError(guid, LOOT_ERROR_ALREADY_PICKPOCKETED); + return; + } + } } else { - // Xinef: Exploit fix - if (!creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE)) - { - SendLootError(guid, LOOT_ERROR_DIDNT_KILL); - return; - } + // Xinef: Exploit fix + if (!creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE)) + { + SendLootError(guid, LOOT_ERROR_DIDNT_KILL); + return; + } // the player whose group may loot the corpse Player* recipient = creature->GetLootRecipient(); - Group* recipientGroup = creature->GetLootRecipientGroup(); + Group* recipientGroup = creature->GetLootRecipientGroup(); if (!recipient && !recipientGroup) return; - if (loot->loot_type == LOOT_NONE) + if (loot->loot_type == LOOT_NONE) { // for creature, loot is filled when creature is killed. if (recipientGroup) @@ -9127,25 +9127,25 @@ void Player::SendLoot(uint64 guid, LootType loot_type) } // if loot is already skinning loot then don't do anything else - if (loot->loot_type == LOOT_SKINNING) - { + if (loot->loot_type == LOOT_SKINNING) + { loot_type = LOOT_SKINNING; permission = creature->GetLootRecipientGUID() == GetGUID() ? OWNER_PERMISSION : NONE_PERMISSION; - } + } else if (loot_type == LOOT_SKINNING) { - loot->clear(); - loot->FillLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, this, true); - permission = OWNER_PERMISSION; + loot->clear(); + loot->FillLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, this, true); + permission = OWNER_PERMISSION; - // Xinef: Set new loot recipient - creature->SetLootRecipient(this, false); + // Xinef: Set new loot recipient + creature->SetLootRecipient(this, false); } // set group rights only for loot_type != LOOT_SKINNING else { - if (recipientGroup) - { + if (recipientGroup) + { if (GetGroup() == recipientGroup) { switch (recipientGroup->GetLootMethod()) @@ -9187,24 +9187,24 @@ void Player::SendLoot(uint64 guid, LootType loot_type) // need know merged fishing/corpse loot type for achievements loot->loot_type = loot_type; - if (permission != NONE_PERMISSION) - { - SetLootGUID(guid); + if (permission != NONE_PERMISSION) + { + SetLootGUID(guid); - WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size - data << uint64(guid); - data << uint8(loot_type); - data << LootView(*loot, this, permission); + WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size + data << uint64(guid); + data << uint8(loot_type); + data << LootView(*loot, this, permission); - SendDirectMessage(&data); + SendDirectMessage(&data); - // add 'this' player as one of the players that are looting 'loot' + // add 'this' player as one of the players that are looting 'loot' loot->AddLooter(GetGUID()); - - if (loot_type == LOOT_CORPSE && !IS_ITEM_GUID(guid)) - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING); - } - else + + if (loot_type == LOOT_CORPSE && !IS_ITEM_GUID(guid)) + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING); + } + else SendLootError(guid, LOOT_ERROR_DIDNT_KILL); } @@ -9245,7 +9245,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) uint32 mapid = GetMapId(); OutdoorPvP* pvp = sOutdoorPvPMgr->GetOutdoorPvPToZoneId(zoneid); InstanceScript* instance = GetInstanceScript(); - Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(zoneid); + Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(zoneid); ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending SMSG_INIT_WORLD_STATES to Map: %u, Zone: %u", mapid, zoneid); @@ -9830,23 +9830,23 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) data << uint32(4882) << uint32(0); // 10 WORLD_STATE_HOR_WAVE_COUNT } break; - // Scarlet Enclave (DK starting zone) - case 4298: - // Get Mograine, GUID and ENTRY should NEVER change - if (Creature* mograine = ObjectAccessor::GetCreature(*this, MAKE_NEW_GUID(130956, 29173, HIGHGUID_UNIT))) - { - if (CreatureAI* mograineAI = mograine->AI()) - { - data << uint32(3590) << uint32(mograineAI->GetData(3590)); - data << uint32(3591) << uint32(mograineAI->GetData(3591)); - data << uint32(3592) << uint32(mograineAI->GetData(3592)); - data << uint32(3603) << uint32(mograineAI->GetData(3603)); - data << uint32(3604) << uint32(mograineAI->GetData(3604)); - data << uint32(3605) << uint32(mograineAI->GetData(3605)); - } - } - break; - // Wintergrasp + // Scarlet Enclave (DK starting zone) + case 4298: + // Get Mograine, GUID and ENTRY should NEVER change + if (Creature* mograine = ObjectAccessor::GetCreature(*this, MAKE_NEW_GUID(130956, 29173, HIGHGUID_UNIT))) + { + if (CreatureAI* mograineAI = mograine->AI()) + { + data << uint32(3590) << uint32(mograineAI->GetData(3590)); + data << uint32(3591) << uint32(mograineAI->GetData(3591)); + data << uint32(3592) << uint32(mograineAI->GetData(3592)); + data << uint32(3603) << uint32(mograineAI->GetData(3603)); + data << uint32(3604) << uint32(mograineAI->GetData(3604)); + data << uint32(3605) << uint32(mograineAI->GetData(3605)); + } + } + break; + // Wintergrasp case 4197: if (bf && bf->GetTypeId() == BATTLEFIELD_WG) { @@ -9867,7 +9867,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) GetSession()->SendPacket(&data); SendBGWeekendWorldStates(); - SendBattlefieldWorldStates(); + SendBattlefieldWorldStates(); } void Player::SendBGWeekendWorldStates() @@ -9900,7 +9900,7 @@ void Player::SendBattlefieldWorldStates() for (uint32 i = 0; i < 2; ++i) SendUpdateWorldState(ClockWorldState[i], uint32(time(NULL) + (wg->GetTimer() / 1000))); } - } + } } uint32 Player::GetXPRestBonus(uint32 xp) @@ -10080,7 +10080,7 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c { if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate()) { - if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE) + if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE) { const_cast(this)->AutoUnequipOffhandIfNeed(true); break; @@ -10733,7 +10733,7 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const Item* pItem; for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) { - pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem && IsTotemCategoryCompatiableWith(pItem->GetTemplate(), TotemCategory)) return true; } @@ -10765,7 +10765,7 @@ bool Player::IsTotemCategoryCompatiableWith(const ItemTemplate* pProto, uint32 r if (pProto->TotemCategory == 0) return false; - TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(pProto->TotemCategory); + TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(pProto->TotemCategory); if (!itemEntry) return false; TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId); @@ -10776,14 +10776,14 @@ bool Player::IsTotemCategoryCompatiableWith(const ItemTemplate* pProto, uint32 r return false; if ((itemEntry->categoryMask & reqEntry->categoryMask) != reqEntry->categoryMask) - return false; + return false; - // xinef: check skill requirements, needed for enchants! - if (pProto->RequiredSkill) - if (this->GetSkillValue(pProto->RequiredSkill) < pProto->RequiredSkillRank) - return false; + // xinef: check skill requirements, needed for enchants! + if (pProto->RequiredSkill) + if (this->GetSkillValue(pProto->RequiredSkill) < pProto->RequiredSkillRank) + return false; - return true; + return true; } InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const @@ -10995,10 +10995,10 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des if (pItem) { - // you bad chet0rz, wpe pro - if( bag == NULL_BAG && slot == NULL_SLOT ) - if( pItem->IsBag() && pItem->IsNotEmptyBag() ) - return EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS; + // you bad chet0rz, wpe pro + if( bag == NULL_BAG && slot == NULL_SLOT ) + if( pItem->IsBag() && pItem->IsNotEmptyBag() ) + return EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS; // Xinef: Removed next bullshit loot generated check if (pItem->GetGUID() == GetLootGUID()) @@ -11481,7 +11481,7 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const return EQUIP_ERR_ITEM_NOT_FOUND; // Xinef: Removed next bullshit loot generated check - if (pItem->GetGUID() == GetLootGUID()) + if (pItem->GetGUID() == GetLootGUID()) return EQUIP_ERR_ALREADY_LOOTED; // item it 'bind' @@ -11743,9 +11743,9 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool if (eslot == NULL_SLOT) return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; - // Xinef: dont allow to equip items on disarmed slot - if (!CanUseAttackType(GetAttackBySlot(eslot))) - return EQUIP_ERR_NOT_WHILE_DISARMED; + // Xinef: dont allow to equip items on disarmed slot + if (!CanUseAttackType(GetAttackBySlot(eslot))) + return EQUIP_ERR_NOT_WHILE_DISARMED; res = CanUseItem(pItem, not_loading); if (res != EQUIP_ERR_OK) @@ -11804,7 +11804,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool if (eslot == EQUIPMENT_SLOT_OFFHAND) { // Do not allow polearm to be equipped in the offhand (rare case for the only 1h polearm 41750) - // xinef: same for fishing poles + // xinef: same for fishing poles if (type == INVTYPE_WEAPON && (pProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || pProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE)) return EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT; @@ -11888,9 +11888,9 @@ InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const return EQUIP_ERR_NOT_DURING_ARENA_MATCH; } - // Xinef: dont allow to unequip items on disarmed slot - if (!CanUseAttackType(GetAttackBySlot(pItem->GetSlot()))) - return EQUIP_ERR_NOT_WHILE_DISARMED; + // Xinef: dont allow to unequip items on disarmed slot + if (!CanUseAttackType(GetAttackBySlot(pItem->GetSlot()))) + return EQUIP_ERR_NOT_WHILE_DISARMED; if (!swap && pItem->IsNotEmptyBag()) return EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS; @@ -12382,7 +12382,7 @@ Item* Player::StoreItem(ItemPosCountVec const& dest, Item* pItem, bool update) return NULL; Item* lastItem = pItem; - const ItemTemplate *proto = pItem->GetTemplate(); + const ItemTemplate *proto = pItem->GetTemplate(); for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end();) { @@ -12400,12 +12400,12 @@ Item* Player::StoreItem(ItemPosCountVec const& dest, Item* pItem, bool update) lastItem = _StoreItem(pos, pItem, count, true, update); } - // cast after item storing - some checks in checkcast requires item to be present!! - if (lastItem) - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger - if (!HasAura(proto->Spells[i].SpellId)) - CastSpell(this, proto->Spells[i].SpellId, true, lastItem); + // cast after item storing - some checks in checkcast requires item to be present!! + if (lastItem) + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger + if (!HasAura(proto->Spells[i].SpellId)) + CastSpell(this, proto->Spells[i].SpellId, true, lastItem); return lastItem; } @@ -12657,7 +12657,7 @@ void Player::SetVisibleItemSlot(uint8 slot, Item* pItem) { if (pItem) { - SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2), pItem->GetEntry()); + SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2), pItem->GetEntry()); SetUInt16Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (slot * 2), 0, pItem->GetEnchantmentId(PERM_ENCHANTMENT_SLOT)); SetUInt16Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (slot * 2), 1, pItem->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)); } @@ -12723,9 +12723,9 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update, bool swap) // remove item dependent auras and casts (only weapon and armor slots) if (slot < EQUIPMENT_SLOT_END) { - // Xinef: Ensure that this function is called for places with swap=true - if (!swap) - RemoveItemDependentAurasAndCasts(pItem); + // Xinef: Ensure that this function is called for places with swap=true + if (!swap) + RemoveItemDependentAurasAndCasts(pItem); // remove held enchantments, update expertise if (slot == EQUIPMENT_SLOT_MAINHAND) @@ -12782,7 +12782,7 @@ void Player::MoveItemFromInventory(uint8 bag, uint8 slot, bool update) { ItemRemovedQuestCheck(it->GetEntry(), it->GetCount()); RemoveItem(bag, slot, update); - UpdateTitansGrip(); + UpdateTitansGrip(); it->SetNotRefundable(this, false); it->RemoveFromUpdateQueueOf(this); if (it->IsInWorld()) @@ -12902,7 +12902,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) // Xinef: item is removed, remove loot from storage if any if (proto->Flags & ITEM_PROTO_FLAG_OPENABLE) - sLootItemStorage->RemoveStoredLoot(pItem->GetGUIDLow()); + sLootItemStorage->RemoveStoredLoot(pItem->GetGUIDLow()); if (IsInWorld() && update) { @@ -13356,7 +13356,7 @@ void Player::SwapItem(uint16 src, uint16 dst) // SRC checks - if (GetLootGUID() == pSrcItem->GetGUID()) // prevent swap looting item + if (GetLootGUID() == pSrcItem->GetGUID()) // prevent swap looting item { //best error message found for attempting to swap while looting SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pSrcItem, NULL); @@ -13375,11 +13375,11 @@ void Player::SwapItem(uint16 src, uint16 dst) } } - // anti-wpe - if (pSrcItem->IsBag() && pSrcItem->IsNotEmptyBag() && !IsBagPos(dst)) - { - SendEquipError(EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, pSrcItem, pDstItem); - return; + // anti-wpe + if (pSrcItem->IsBag() && pSrcItem->IsNotEmptyBag() && !IsBagPos(dst)) + { + SendEquipError(EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS, pSrcItem, pDstItem); + return; } // prevent put equipped/bank bag in self @@ -13400,7 +13400,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (pDstItem) { - // Xinef: Removed next bullshit loot generated check + // Xinef: Removed next bullshit loot generated check if (pDstItem->GetGUID() == GetLootGUID()) // prevent swap looting item { //best error message found for attempting to swap while looting @@ -13439,7 +13439,7 @@ void Player::SwapItem(uint16 src, uint16 dst) RemoveItem(srcbag, srcslot, true); StoreItem(dest, pSrcItem, true); - UpdateTitansGrip(); + UpdateTitansGrip(); if (IsBankPos(src)) ItemAddedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount()); } @@ -13455,7 +13455,7 @@ void Player::SwapItem(uint16 src, uint16 dst) RemoveItem(srcbag, srcslot, true); BankItem(dest, pSrcItem, true); - UpdateTitansGrip(); + UpdateTitansGrip(); ItemRemovedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount()); } else if (IsEquipmentPos(dst)) @@ -13654,9 +13654,9 @@ void Player::SwapItem(uint16 src, uint16 dst) BankItem(sDest2, pDstItem, true); else if (IsEquipmentPos(src)) EquipItem(eDest2, pDstItem, true); - - // Xinef: Call this here after all needed items are equipped - RemoveItemDependentAurasAndCasts((Item*)NULL); + + // Xinef: Call this here after all needed items are equipped + RemoveItemDependentAurasAndCasts((Item*)NULL); // if player is moving bags and is looting an item inside this bag // release the loot @@ -13670,8 +13670,8 @@ void Player::SwapItem(uint16 src, uint16 dst) { if (Item* bagItem = bag->GetItemByPos(i)) { - // Xinef: Removed next bullshit loot generated check - if (bagItem->GetGUID() == GetLootGUID()) + // Xinef: Removed next bullshit loot generated check + if (bagItem->GetGUID() == GetLootGUID()) { m_session->DoLootRelease(GetLootGUID()); released = true; // so we don't need to look at dstBag @@ -13688,7 +13688,7 @@ void Player::SwapItem(uint16 src, uint16 dst) { if (Item* bagItem = bag->GetItemByPos(i)) { - // Xinef: Removed next bullshit loot generated check + // Xinef: Removed next bullshit loot generated check if (bagItem->GetGUID() == GetLootGUID()) { m_session->DoLootRelease(GetLootGUID()); @@ -13880,7 +13880,7 @@ void Player::TradeCancel(bool sendback) void Player::UpdateSoulboundTradeItems() { - TRINITY_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock); + TRINITY_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock); if (m_itemSoulboundTradeable.empty()) return; @@ -13904,14 +13904,14 @@ void Player::UpdateSoulboundTradeItems() void Player::AddTradeableItem(Item* item) { - TRINITY_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock); + TRINITY_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock); m_itemSoulboundTradeable.push_back(item); } //TODO: should never allow an item to be added to m_itemSoulboundTradeable twice void Player::RemoveTradeableItem(Item* item) { - TRINITY_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock); + TRINITY_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock); m_itemSoulboundTradeable.remove(item); } @@ -14023,24 +14023,24 @@ void Player::RemoveArenaEnchantments(EnchantmentSlot slot) ++next; } - // Xinef: check arena allowed enchantments :) + // Xinef: check arena allowed enchantments :) // remove enchants from inventory items // NOTE: no need to remove these from stats, since these aren't equipped // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (uint32 enchId = pItem->GetEnchantmentId(slot)) - if (!sSpellMgr->IsArenaAllowedEnchancment(enchId)) - pItem->ClearEnchantment(slot); + if (!sSpellMgr->IsArenaAllowedEnchancment(enchId)) + pItem->ClearEnchantment(slot); // in inventory bags for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) if (Bag* pBag = GetBagByPos(i)) for (uint32 j = 0; j < pBag->GetBagSize(); j++) if (Item* pItem = pBag->GetItemByPos(j)) - if (uint32 enchId = pItem->GetEnchantmentId(slot)) - if (!sSpellMgr->IsArenaAllowedEnchancment(enchId)) - pItem->ClearEnchantment(slot); + if (uint32 enchId = pItem->GetEnchantmentId(slot)) + if (!sSpellMgr->IsArenaAllowedEnchancment(enchId)) + pItem->ClearEnchantment(slot); } // duration == 0 will remove item enchant @@ -14302,7 +14302,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool // case ITEM_MOD_HASTE_MELEE_RATING: // ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply); // break; - case ITEM_MOD_HASTE_RANGED_RATING: + case ITEM_MOD_HASTE_RANGED_RATING: ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply); break; case ITEM_MOD_HASTE_SPELL_RATING: @@ -15105,8 +15105,8 @@ bool Player::CanCompleteQuest(uint32 quest_id, const QuestStatusData* q_savedSta if (!qInfo) return false; - // Xinef: take seasonals into account - if(!qInfo->IsRepeatable() && !qInfo->IsSeasonal() && IsQuestRewarded(quest_id)) + // Xinef: take seasonals into account + if(!qInfo->IsRepeatable() && !qInfo->IsSeasonal() && IsQuestRewarded(quest_id)) return false; // not allow re-complete quest // auto complete quest @@ -15387,9 +15387,9 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) SendQuestUpdate(quest_id); - // Xinef: area auras may change on quest accept! - UpdateZoneDependentAuras(GetZoneId()); - UpdateAreaDependentAuras(GetAreaId()); + // Xinef: area auras may change on quest accept! + UpdateZoneDependentAuras(GetZoneId()); + UpdateAreaDependentAuras(GetAreaId()); } void Player::CompleteQuest(uint32 quest_id) @@ -15410,9 +15410,9 @@ void Player::CompleteQuest(uint32 quest_id) SendQuestComplete(quest_id); } - // Xinef: area auras may change on quest completion! - UpdateZoneDependentAuras(GetZoneId()); - UpdateAreaDependentAuras(GetAreaId()); + // Xinef: area auras may change on quest completion! + UpdateZoneDependentAuras(GetZoneId()); + UpdateAreaDependentAuras(GetAreaId()); AdditionalSavingAddMask(ADDITIONAL_SAVING_INVENTORY_AND_GOLD | ADDITIONAL_SAVING_QUEST_STATUS); } } @@ -15427,9 +15427,9 @@ void Player::IncompleteQuest(uint32 quest_id) if (log_slot < MAX_QUEST_LOG_SIZE) RemoveQuestSlotState(log_slot, QUEST_STATE_COMPLETE); - // Xinef: area auras may change on quest completion! - UpdateZoneDependentAuras(GetZoneId()); - UpdateAreaDependentAuras(GetAreaId()); + // Xinef: area auras may change on quest completion! + UpdateZoneDependentAuras(GetZoneId()); + UpdateAreaDependentAuras(GetAreaId()); AdditionalSavingAddMask(ADDITIONAL_SAVING_QUEST_STATUS); } } @@ -15457,7 +15457,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, RemoveTimedQuest(quest_id); - std::vector > problematicItems; + std::vector > problematicItems; if (quest->GetRewChoiceItemsCount() > 0) { @@ -15469,8 +15469,8 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); SendNewItem(item, quest->RewardChoiceItemCount[reward], true, false); } - else - problematicItems.push_back(std::pair(itemId, quest->RewardChoiceItemCount[reward])); + else + problematicItems.push_back(std::pair(itemId, quest->RewardChoiceItemCount[reward])); } } @@ -15486,31 +15486,31 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); SendNewItem(item, quest->RewardItemIdCount[i], true, false); } - else - problematicItems.push_back(std::pair(itemId, quest->RewardItemIdCount[i])); + else + problematicItems.push_back(std::pair(itemId, quest->RewardItemIdCount[i])); } } } - // Xinef: send items that couldn't be added properly by mail - if (!problematicItems.empty()) - { - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - MailSender sender(MAIL_CREATURE, 34337 /* The Postmaster */ ); - MailDraft draft("Recovered Item", "We recovered a lost item in the twisting nether and noted that it was yours.$B$BPlease find said object enclosed."); // This is the text used in Cataclysm, it probably wasn't changed. - - for (std::vector >::const_iterator itr = problematicItems.begin(); itr != problematicItems.end(); ++itr) - { - if(Item* item = Item::CreateItem(itr->first, itr->second)) - { - item->SaveToDB(trans); - draft.AddItem(item); - } - } + // Xinef: send items that couldn't be added properly by mail + if (!problematicItems.empty()) + { + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + MailSender sender(MAIL_CREATURE, 34337 /* The Postmaster */ ); + MailDraft draft("Recovered Item", "We recovered a lost item in the twisting nether and noted that it was yours.$B$BPlease find said object enclosed."); // This is the text used in Cataclysm, it probably wasn't changed. + + for (std::vector >::const_iterator itr = problematicItems.begin(); itr != problematicItems.end(); ++itr) + { + if(Item* item = Item::CreateItem(itr->first, itr->second)) + { + item->SaveToDB(trans); + draft.AddItem(item); + } + } - draft.SendMailTo(trans, MailReceiver(this, this->GetGUIDLow()), sender); - CharacterDatabase.CommitTransaction(trans); - } + draft.SendMailTo(trans, MailReceiver(this, this->GetGUIDLow()), sender); + CharacterDatabase.CommitTransaction(trans); + } RewardReputation(quest); @@ -15518,7 +15518,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, if (log_slot < MAX_QUEST_LOG_SIZE) SetQuestSlot(log_slot, 0); - bool rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest(); + bool rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest(); // Not give XP in case already completed once repeatable quest uint32 XP = rewarded ? 0 : uint32(quest->XPValue(this)*sWorld->getRate(RATE_XP_QUEST)); @@ -15602,7 +15602,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, if (quest->GetRewSpellCast() > 0) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpellCast()); - if (questGiver->isType(TYPEMASK_UNIT) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) && !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM) && !spellInfo->IsSelfCast()) + if (questGiver->isType(TYPEMASK_UNIT) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) && !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM) && !spellInfo->IsSelfCast()) { if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID())) creature->CastSpell(this, quest->GetRewSpellCast(), true); @@ -15627,8 +15627,8 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST, quest->GetQuestId()); - // pussywizard: replaced partial save with full save - SaveToDB(false, false); + // pussywizard: replaced partial save with full save + SaveToDB(false, false); if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP)) { @@ -15641,19 +15641,19 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, //lets remove flag for delayed teleports SetMustDelayTeleport(false); - // Xinef: area auras may change on quest completion! - UpdateZoneDependentAuras(GetZoneId()); - UpdateAreaDependentAuras(GetAreaId()); + // Xinef: area auras may change on quest completion! + UpdateZoneDependentAuras(GetZoneId()); + UpdateAreaDependentAuras(GetAreaId()); } void Player::FailQuest(uint32 questId) { if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) { - QuestStatus qStatus = GetQuestStatus(questId); - // xinef: if quest is marked as failed, dont do it again - if (qStatus != QUEST_STATUS_INCOMPLETE) - return; + QuestStatus qStatus = GetQuestStatus(questId); + // xinef: if quest is marked as failed, dont do it again + if (qStatus != QUEST_STATUS_INCOMPLETE) + return; SetQuestStatus(questId, QUEST_STATUS_FAILED); @@ -16130,7 +16130,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg) return false; } - bool destroyItem = true; + bool destroyItem = true; for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n) if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n]) destroyItem = false; @@ -16148,8 +16148,8 @@ bool Player::GetQuestRewardStatus(uint32 quest_id) const Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id); if (qInfo) { - if (qInfo->IsSeasonal()) - return !SatisfyQuestSeasonal(qInfo, false); + if (qInfo->IsSeasonal()) + return !SatisfyQuestSeasonal(qInfo, false); // for repeatable quests: rewarded field is set after first reward only to prevent getting XP more than once if (!qInfo->IsRepeatable()) @@ -16167,13 +16167,13 @@ QuestStatus Player::GetQuestStatus(uint32 quest_id) const return itr->second.Status; if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id)) - { - if (qInfo->IsSeasonal()) - return SatisfyQuestSeasonal(qInfo, false) ? QUEST_STATUS_NONE : QUEST_STATUS_REWARDED; + { + if (qInfo->IsSeasonal()) + return SatisfyQuestSeasonal(qInfo, false) ? QUEST_STATUS_NONE : QUEST_STATUS_REWARDED; if (!qInfo->IsRepeatable() && IsQuestRewarded(quest_id)) return QUEST_STATUS_REWARDED; - } + } } return QUEST_STATUS_NONE; } @@ -16185,16 +16185,16 @@ bool Player::CanShareQuest(uint32 quest_id) const { QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id); if (itr != m_QuestStatus.end()) - { + { if (itr->second.Status != QUEST_STATUS_INCOMPLETE) - return false; + return false; - // pussywizard: in pool and not currently available (wintergrasp weekly, dalaran weekly) - can't share + // pussywizard: in pool and not currently available (wintergrasp weekly, dalaran weekly) - can't share if (sPoolMgr->IsPartOfAPool(quest_id) && !sPoolMgr->IsSpawnedObject(quest_id)) - return false; + return false; - return true; - } + return true; + } } return false; } @@ -16223,9 +16223,9 @@ void Player::RemoveActiveQuest(uint32 questId, bool update /*= true*/) if (update) SendQuestUpdate(questId); - // Xinef: area auras may change on quest remove! - UpdateZoneDependentAuras(GetZoneId()); - UpdateAreaDependentAuras(GetAreaId()); + // Xinef: area auras may change on quest remove! + UpdateZoneDependentAuras(GetZoneId()); + UpdateAreaDependentAuras(GetAreaId()); AdditionalSavingAddMask(ADDITIONAL_SAVING_QUEST_STATUS); } @@ -16245,8 +16245,8 @@ void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/) void Player::SendQuestUpdate(uint32 questId) { uint32 zone = 0, area = 0; - // xinef: shittness fixup - uint32 oldSpellId = 0; + // xinef: shittness fixup + uint32 oldSpellId = 0; SpellAreaForQuestMapBounds saBounds = sSpellMgr->GetSpellAreaForQuestMapBounds(questId); if (saBounds.first != saBounds.second) @@ -16254,58 +16254,58 @@ void Player::SendQuestUpdate(uint32 questId) GetZoneAndAreaId(zone, area); for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) - { - // xinef: spell was already casted, skip different areas with same spell - if (itr->second->spellId == oldSpellId) - continue; + { + // xinef: spell was already casted, skip different areas with same spell + if (itr->second->spellId == oldSpellId) + continue; if (itr->second->autocast && itr->second->IsFitToRequirements(this, zone, area)) if (!HasAura(itr->second->spellId)) - { + { CastSpell(this, itr->second->spellId, true); - oldSpellId = itr->second->spellId; - } - } + oldSpellId = itr->second->spellId; + } + } } saBounds = sSpellMgr->GetSpellAreaForQuestEndMapBounds(questId); - // xinef: shittness fixup - uint32 skipSpellId = 0; - oldSpellId = 0; + // xinef: shittness fixup + uint32 skipSpellId = 0; + oldSpellId = 0; if (saBounds.first != saBounds.second) { if (!zone || !area) GetZoneAndAreaId(zone, area); for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) - { - // xinef: skip spell for which condition is already fulfilled - if (itr->second->spellId == skipSpellId) - continue; - skipSpellId = 0; + { + // xinef: skip spell for which condition is already fulfilled + if (itr->second->spellId == skipSpellId) + continue; + skipSpellId = 0; - // xinef: spells are sorted, if no condition is fulfilled remove aura - if (oldSpellId && oldSpellId != itr->second->spellId) - { - RemoveAurasDueToSpell(oldSpellId); - oldSpellId = 0; - } + // xinef: spells are sorted, if no condition is fulfilled remove aura + if (oldSpellId && oldSpellId != itr->second->spellId) + { + RemoveAurasDueToSpell(oldSpellId); + oldSpellId = 0; + } if (!itr->second->IsFitToRequirements(this, zone, area)) - { + { //RemoveAurasDueToSpell(itr->second->spellId); - oldSpellId = itr->second->spellId; - } - else - { - skipSpellId = itr->second->spellId; - oldSpellId = 0; - } - } + oldSpellId = itr->second->spellId; + } + else + { + skipSpellId = itr->second->spellId; + oldSpellId = 0; + } + } - // xinef: check if we have something to remove yet - if (oldSpellId) - RemoveAurasDueToSpell(oldSpellId); + // xinef: check if we have something to remove yet + if (oldSpellId) + RemoveAurasDueToSpell(oldSpellId); } UpdateForQuestWorldObjects(); @@ -16461,20 +16461,20 @@ void Player::AreaExploredOrEventHappens(uint32 questId) if (questId) { uint16 log_slot = FindQuestSlot(questId); - QuestStatusData* q_status = NULL; + QuestStatusData* q_status = NULL; if (log_slot < MAX_QUEST_LOG_SIZE) { q_status = &m_QuestStatus[questId]; - // xinef: added failed check - if (!q_status->Explored && q_status->Status != QUEST_STATUS_FAILED) + // xinef: added failed check + if (!q_status->Explored && q_status->Status != QUEST_STATUS_FAILED) { q_status->Explored = true; m_QuestStatusSave[questId] = true; - // xinef: if we cannot complete quest send exploration succeded - if (!CanCompleteQuest(questId, q_status)) - SendQuestComplete(questId); + // xinef: if we cannot complete quest send exploration succeded + if (!CanCompleteQuest(questId, q_status)) + SendQuestComplete(questId); } } if (CanCompleteQuest(questId, q_status)) @@ -16563,7 +16563,7 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) if (reqitem == entry) { QuestStatusData& q_status = m_QuestStatus[questid]; - uint32 reqitemcount = qInfo->RequiredItemCount[j]; + uint32 reqitemcount = qInfo->RequiredItemCount[j]; uint16 curitemcount = q_status.ItemCount[j]; if (q_status.ItemCount[j] >= reqitemcount) // we may have more than what the status shows @@ -16586,7 +16586,7 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) void Player::KilledMonster(CreatureTemplate const* cInfo, uint64 guid) { - ASSERT(cInfo); + ASSERT(cInfo); if (cInfo->Entry) KilledMonsterCredit(cInfo->Entry, guid); @@ -16678,8 +16678,8 @@ void Player::KilledPlayerCredit() QuestStatusData& q_status = m_QuestStatus[questid]; if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty()))) { - // Xinef: PvP Killing quest require player to be in same zone as quest zone (only 2 quests so no doubt, can be extended to conditions in cata ;s) - if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL) && GetZoneId() == qInfo->GetZoneOrSort()) + // Xinef: PvP Killing quest require player to be in same zone as quest zone (only 2 quests so no doubt, can be extended to conditions in cata ;s) + if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL) && GetZoneId() == qInfo->GetZoneOrSort()) { uint32 reqkill = qInfo->GetPlayersSlain(); uint16 curkill = q_status.PlayerCount; @@ -17148,23 +17148,23 @@ void Player::_LoadArenaTeamInfo() memset((void*)&m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1], 0, sizeof(uint32) * MAX_ARENA_SLOT * ARENA_TEAM_END); for (uint8 slot = 0; slot <= 2; ++slot) - if (uint32 arenaTeamId = Player::GetArenaTeamIdFromStorage(GetGUIDLow(), slot)) - { + if (uint32 arenaTeamId = Player::GetArenaTeamIdFromStorage(GetGUIDLow(), slot)) + { ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId); if (!arenaTeam) // some shit, should be assert, but just ignore - continue; - ArenaTeamMember const* member = arenaTeam->GetMember(GetGUID()); - if (!member) // some shit, should be assert, but just ignore - continue; + continue; + ArenaTeamMember const* member = arenaTeam->GetMember(GetGUID()); + if (!member) // some shit, should be assert, but just ignore + continue; - SetArenaTeamInfoField(slot, ARENA_TEAM_ID, arenaTeamId); - SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, arenaTeam->GetType()); - SetArenaTeamInfoField(slot, ARENA_TEAM_MEMBER, (arenaTeam->GetCaptain() == GetGUID()) ? 0 : 1); - SetArenaTeamInfoField(slot, ARENA_TEAM_GAMES_WEEK, member->WeekGames); - SetArenaTeamInfoField(slot, ARENA_TEAM_GAMES_SEASON, member->SeasonGames); - SetArenaTeamInfoField(slot, ARENA_TEAM_WINS_SEASON, member->SeasonWins); - SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, member->PersonalRating); - } + SetArenaTeamInfoField(slot, ARENA_TEAM_ID, arenaTeamId); + SetArenaTeamInfoField(slot, ARENA_TEAM_TYPE, arenaTeam->GetType()); + SetArenaTeamInfoField(slot, ARENA_TEAM_MEMBER, (arenaTeam->GetCaptain() == GetGUID()) ? 0 : 1); + SetArenaTeamInfoField(slot, ARENA_TEAM_GAMES_WEEK, member->WeekGames); + SetArenaTeamInfoField(slot, ARENA_TEAM_GAMES_SEASON, member->SeasonGames); + SetArenaTeamInfoField(slot, ARENA_TEAM_WINS_SEASON, member->SeasonWins); + SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, member->PersonalRating); + } } void Player::_LoadEquipmentSets(PreparedQueryResult result) @@ -17211,20 +17211,20 @@ void Player::_LoadEntryPointData(PreparedQueryResult result) fields[2].GetFloat(), // Z fields[3].GetFloat()); // Orientation - std::string taxi = fields[5].GetString(); - if (!taxi.empty()) - { - Tokenizer tokens(taxi, ' '); - for (Tokenizer::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter) - { - uint32 node = uint32(atol(*iter)); - m_entryPointData.taxiPath.push_back(node); - } + std::string taxi = fields[5].GetString(); + if (!taxi.empty()) + { + Tokenizer tokens(taxi, ' '); + for (Tokenizer::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter) + { + uint32 node = uint32(atol(*iter)); + m_entryPointData.taxiPath.push_back(node); + } - // Check integrity - if (m_entryPointData.taxiPath.size() < 3) - m_entryPointData.ClearTaxiPath(); - } + // Check integrity + if (m_entryPointData.taxiPath.size() < 3) + m_entryPointData.ClearTaxiPath(); + } m_entryPointData.mountSpell = fields[6].GetUInt32(); } @@ -17409,8 +17409,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) //Other way is to saves m_team into characters table. setFactionForRace(getRace()); - // pussywizard: create empty instance bind containers if necessary - sInstanceSaveMgr->PlayerCreateBoundInstancesMaps(guid); + // pussywizard: create empty instance bind containers if necessary + sInstanceSaveMgr->PlayerCreateBoundInstancesMaps(guid); // load home bind and check in same time class/race pair, it used later for restore broken positions if (!_LoadHomeBind(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_HOME_BIND))) @@ -17456,25 +17456,25 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) GetSession()->SetPlayer(this); MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); - // pussywizard: group changed difficulty when player was offline, teleport to the enterance of new difficulty - if (mapEntry && (mapEntry->IsNonRaidDungeon() && dungeonDiff != GetDungeonDifficulty() || mapEntry->IsRaid() && raidDiff != GetRaidDifficulty())) - { - bool fixed = false; - if (uint32 destInstId = sInstanceSaveMgr->PlayerGetDestinationInstanceId(this, mapId, GetDifficulty(mapEntry->IsRaid()))) - { - instanceId = destInstId; - if (AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId)) - { - Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation); - fixed = true; - } - } - if (!fixed) - { - RelocateToHomebind(); - mapEntry = sMapStore.LookupEntry(mapId); - } - } + // pussywizard: group changed difficulty when player was offline, teleport to the enterance of new difficulty + if (mapEntry && (mapEntry->IsNonRaidDungeon() && dungeonDiff != GetDungeonDifficulty() || mapEntry->IsRaid() && raidDiff != GetRaidDifficulty())) + { + bool fixed = false; + if (uint32 destInstId = sInstanceSaveMgr->PlayerGetDestinationInstanceId(this, mapId, GetDifficulty(mapEntry->IsRaid()))) + { + instanceId = destInstId; + if (AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId)) + { + Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation); + fixed = true; + } + } + if (!fixed) + { + RelocateToHomebind(); + mapEntry = sMapStore.LookupEntry(mapId); + } + } if (!mapEntry || !IsPositionValid()) { @@ -17494,38 +17494,38 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) const WorldLocation& _loc = GetEntryPoint(); mapId = _loc.GetMapId(); - instanceId = 0; + instanceId = 0; if (mapId == MAPID_INVALID) - { + { RelocateToHomebind(); - } + } else - { + { Relocate(&_loc); - // xinef: restore taxi flight from entry point data - if (m_entryPointData.HasTaxiPath()) - { - for (size_t i = 0; i < m_entryPointData.taxiPath.size() - 1; ++i) - m_taxi.AddTaxiDestination(m_entryPointData.taxiPath[i]); - m_taxi.SetTaxiSegment(m_entryPointData.taxiPath[m_entryPointData.taxiPath.size() - 1]); + // xinef: restore taxi flight from entry point data + if (m_entryPointData.HasTaxiPath()) + { + for (size_t i = 0; i < m_entryPointData.taxiPath.size() - 1; ++i) + m_taxi.AddTaxiDestination(m_entryPointData.taxiPath[i]); + m_taxi.SetTaxiSegment(m_entryPointData.taxiPath[m_entryPointData.taxiPath.size() - 1]); - m_entryPointData.ClearTaxiPath(); - } - } + m_entryPointData.ClearTaxiPath(); + } + } } // currently we do not support transport in bg else if (transLowGUID) { uint64 transGUID = MAKE_NEW_GUID(transLowGUID, 0, HIGHGUID_MO_TRANSPORT); GameObject* transGO = HashMapHolder::Find(transGUID); - if (!transGO) // pussywizard: if not MotionTransport, look for StaticTransport - { - transGUID = MAKE_NEW_GUID(transLowGUID, 0, HIGHGUID_TRANSPORT); - transGO = HashMapHolder::Find(transGUID); - } - if (transGO) + if (!transGO) // pussywizard: if not MotionTransport, look for StaticTransport + { + transGUID = MAKE_NEW_GUID(transLowGUID, 0, HIGHGUID_TRANSPORT); + transGO = HashMapHolder::Find(transGUID); + } + if (transGO) if (transGO->IsInWorld() && transGO->FindMap()) // pussywizard: must be on map, for one world tick transport is not in map and has old GetMapId(), player would be added to old map and to the transport, multithreading crashfix m_transport = transGO->ToTransport(); @@ -17552,17 +17552,17 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) } } else - { - bool fixed = false; - if (mapEntry->Instanceable()) - if (AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId)) - { - fixed = true; - Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation); - } - if (!fixed) - RelocateToHomebind(); - } + { + bool fixed = false; + if (mapEntry->Instanceable()) + if (AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId)) + { + fixed = true; + Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation); + } + if (!fixed) + RelocateToHomebind(); + } } // currently we do not support taxi in instance else if (!taxi_nodes.empty()) @@ -17570,7 +17570,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) instanceId = 0; if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeamId())) { - // xinef: could no load valid data for taxi, relocate to homebind and clear + // xinef: could no load valid data for taxi, relocate to homebind and clear m_taxi.ClearTaxiDestinations(); RelocateToHomebind(); } @@ -17589,15 +17589,15 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // check whether player was unbound or is bound to another instance if (instanceId) - { + { InstanceSave* save = sInstanceSaveMgr->PlayerGetInstanceSave(GetGUIDLow(), mapId, GetDifficulty(mapEntry->IsRaid())); if (!save || save->GetInstanceId() != instanceId) instanceId = 0; - } + } } // if the player is in an instance and it has been reset in the meantime teleport him to the entrance - if ((instanceId && !sInstanceSaveMgr->GetInstanceSave(instanceId) && !mapEntry->IsBattlegroundOrArena()) || (!instanceId && mapEntry->IsDungeon())) + if ((instanceId && !sInstanceSaveMgr->GetInstanceSave(instanceId) && !mapEntry->IsBattlegroundOrArena()) || (!instanceId && mapEntry->IsDungeon())) { AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(mapId); if (at) @@ -17683,7 +17683,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) if (HasAtLoginFlag(AT_LOGIN_RENAME)) { - sLog->outError("Player (GUID: %u) tried to login while forced to rename, can't load.'", GetGUIDLow()); + sLog->outError("Player (GUID: %u) tried to login while forced to rename, can't load.'", GetGUIDLow()); return false; } @@ -17765,13 +17765,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) _LoadGlyphAuras(); // add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura) if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) - { + { m_deathState = DEAD; - AddUnitState(UNIT_STATE_ISOLATED); - } + AddUnitState(UNIT_STATE_ISOLATED); + } - // pussywizard: remove auras that are removed at map change (after _LoadAuras) - RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP); + // pussywizard: remove auras that are removed at map change (after _LoadAuras) + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP); // after spell load, learn rewarded spell if need also _LoadQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS)); @@ -17788,12 +17788,12 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // must be before inventory (some items required reputation check) m_reputationMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_REPUTATION)); - // xinef: load mails before inventory, so problematic items can be added to already loaded mails + // xinef: load mails before inventory, so problematic items can be added to already loaded mails // unread mails and next delivery time, actual mails not loaded _LoadMailInit(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_DATE)); - // pussywizard: - _LoadMailAsynch(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL)); + // pussywizard: + _LoadMailAsynch(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL)); _LoadInventory(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INVENTORY), time_diff); @@ -17902,38 +17902,38 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) _LoadEquipmentSets(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS)); - _LoadBrewOfTheMonth(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BREW_OF_THE_MONTH)); + _LoadBrewOfTheMonth(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BREW_OF_THE_MONTH)); - // Players are immune to taunt - ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + // Players are immune to taunt + ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); - // Init charm info - PrepareCharmAISpells(); + // Init charm info + PrepareCharmAISpells(); - // Fix aurastate auras, depending on health! - // Set aurastate manualy, prevents aura switching - if (HealthBelowPct(20)) - SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTHLESS_20_PERCENT-1)); - if (HealthBelowPct(35)) - SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTHLESS_35_PERCENT-1)); - if (HealthAbovePct(75)) - SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTH_ABOVE_75_PERCENT-1)); - - // unapply aura stats if dont meet requirements - AuraApplicationMap const& Auras = GetAppliedAuras(); - for (AuraApplicationMap::const_iterator itr = Auras.begin(); itr != Auras.end(); ++itr) + // Fix aurastate auras, depending on health! + // Set aurastate manualy, prevents aura switching + if (HealthBelowPct(20)) + SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTHLESS_20_PERCENT-1)); + if (HealthBelowPct(35)) + SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTHLESS_35_PERCENT-1)); + if (HealthAbovePct(75)) + SetFlag(UNIT_FIELD_AURASTATE, 1<<(AURA_STATE_HEALTH_ABOVE_75_PERCENT-1)); + + // unapply aura stats if dont meet requirements + AuraApplicationMap const& Auras = GetAppliedAuras(); + for (AuraApplicationMap::const_iterator itr = Auras.begin(); itr != Auras.end(); ++itr) { - // we assume that all auras are applied now, aurastate was modfied MANUALY preventing any apply/unapply state switching + // we assume that all auras are applied now, aurastate was modfied MANUALY preventing any apply/unapply state switching Aura* aura = itr->second->GetBase(); SpellInfo const* m_spellInfo = aura->GetSpellInfo(); if (m_spellInfo->CasterAuraState != AURA_STATE_HEALTHLESS_20_PERCENT && - m_spellInfo->CasterAuraState != AURA_STATE_HEALTHLESS_35_PERCENT && - m_spellInfo->CasterAuraState != AURA_STATE_HEALTH_ABOVE_75_PERCENT) + m_spellInfo->CasterAuraState != AURA_STATE_HEALTHLESS_35_PERCENT && + m_spellInfo->CasterAuraState != AURA_STATE_HEALTH_ABOVE_75_PERCENT) continue; - if (!HasAuraState((AuraStateType)m_spellInfo->CasterAuraState)) - aura->HandleAllEffects(itr->second, AURA_EFFECT_HANDLE_REAL, false); + if (!HasAuraState((AuraStateType)m_spellInfo->CasterAuraState)) + aura->HandleAllEffects(itr->second, AURA_EFFECT_HANDLE_REAL, false); } return true; } @@ -18050,15 +18050,15 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) continue; } - // Xinef: leave this - if (spellInfo->HasAura(SPELL_AURA_MOUNTED)) - { - SetMountBlockId(spellInfo->Id); - continue; - } + // Xinef: leave this + if (spellInfo->HasAura(SPELL_AURA_MOUNTED)) + { + SetMountBlockId(spellInfo->Id); + continue; + } // negative effects should continue counting down after logout - if (remaintime != -1 && ((!spellInfo->IsPositive() && spellInfo->Id != 15007) || spellInfo->HasAttribute(SPELL_ATTR4_FADES_WHILE_LOGGED_OUT))) // Xinef: resurrection sickness should not tick when logged off + if (remaintime != -1 && ((!spellInfo->IsPositive() && spellInfo->Id != 15007) || spellInfo->HasAttribute(SPELL_ATTR4_FADES_WHILE_LOGGED_OUT))) // Xinef: resurrection sickness should not tick when logged off { if (remaintime/IN_MILLISECONDS <= int32(timediff)) continue; @@ -18104,13 +18104,13 @@ void Player::_LoadGlyphAuras() { if (GlyphSlotEntry const* glyphSlotEntry = sGlyphSlotStore.LookupEntry(GetGlyphSlot(i))) { - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(glyphEntry->SpellId); - if (glyphEntry->TypeFlags == glyphSlotEntry->TypeFlags) - { - if (!spellInfo->Stances) - CastSpell(this, glyphEntry->SpellId, TriggerCastFlags(TRIGGERED_FULL_MASK&~(TRIGGERED_IGNORE_SHAPESHIFT|TRIGGERED_IGNORE_CASTER_AURASTATE))); - continue; - } + const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(glyphEntry->SpellId); + if (glyphEntry->TypeFlags == glyphSlotEntry->TypeFlags) + { + if (!spellInfo->Stances) + CastSpell(this, glyphEntry->SpellId, TriggerCastFlags(TRIGGERED_FULL_MASK&~(TRIGGERED_IGNORE_SHAPESHIFT|TRIGGERED_IGNORE_CASTER_AURASTATE))); + continue; + } else sLog->outError("Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), glyphEntry->TypeFlags, glyphSlotEntry->TypeFlags); } @@ -18282,7 +18282,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F item = NewItemOrBag(proto); if (item->LoadFromDB(itemGuid, GetGUID(), fields, itemEntry)) { - PreparedStatement* stmt = NULL; + PreparedStatement* stmt = NULL; // Do not allow to have item limited to another map/zone in alive state if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId)) @@ -18313,7 +18313,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else { - // xinef: zomg! sync query + // xinef: zomg! sync query stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_REFUNDS); stmt->setUInt32(0, item->GetGUIDLow()); stmt->setUInt32(1, GetGUIDLow()); @@ -18471,97 +18471,97 @@ void Player::_LoadMailInit(PreparedQueryResult resultUnread, PreparedQueryResult void Player::_LoadMailAsynch(PreparedQueryResult result) { - m_mail.clear(); - uint32 prevMailID = 0; - Mail* m = NULL; - if (result) - { - do - { - Field* fields = result->Fetch(); - if (fields[14].GetUInt32() != prevMailID) - { - if (m) - m_mail.push_back(m); + m_mail.clear(); + uint32 prevMailID = 0; + Mail* m = NULL; + if (result) + { + do + { + Field* fields = result->Fetch(); + if (fields[14].GetUInt32() != prevMailID) + { + if (m) + m_mail.push_back(m); - m = new Mail; + m = new Mail; - m->messageID = fields[14].GetUInt32(); - m->messageType = fields[15].GetUInt8(); - m->sender = fields[16].GetUInt32(); - m->receiver = fields[17].GetUInt32(); - m->subject = fields[18].GetString(); - m->body = fields[19].GetString(); - bool has_items = fields[20].GetBool(); - m->expire_time = time_t(fields[21].GetUInt32()); - m->deliver_time = time_t(fields[22].GetUInt32()); - m->money = fields[23].GetUInt32(); - m->COD = fields[24].GetUInt32(); - m->checked = fields[25].GetUInt8(); - m->stationery = fields[26].GetUInt8(); - m->mailTemplateId = fields[27].GetInt16(); + m->messageID = fields[14].GetUInt32(); + m->messageType = fields[15].GetUInt8(); + m->sender = fields[16].GetUInt32(); + m->receiver = fields[17].GetUInt32(); + m->subject = fields[18].GetString(); + m->body = fields[19].GetString(); + bool has_items = fields[20].GetBool(); + m->expire_time = time_t(fields[21].GetUInt32()); + m->deliver_time = time_t(fields[22].GetUInt32()); + m->money = fields[23].GetUInt32(); + m->COD = fields[24].GetUInt32(); + m->checked = fields[25].GetUInt8(); + m->stationery = fields[26].GetUInt8(); + m->mailTemplateId = fields[27].GetInt16(); - if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId)) - { - sLog->outError("Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); - m->mailTemplateId = 0; - } + if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId)) + { + sLog->outError("Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); + m->mailTemplateId = 0; + } - m->state = MAIL_STATE_UNCHANGED; - } + m->state = MAIL_STATE_UNCHANGED; + } - if (m && fields[20].GetBool() /*has_items*/ && fields[12].GetUInt32() /*itemEntry*/) - { - uint32 itemGuid = fields[11].GetUInt32(); - uint32 itemTemplate = fields[12].GetUInt32(); + if (m && fields[20].GetBool() /*has_items*/ && fields[12].GetUInt32() /*itemEntry*/) + { + uint32 itemGuid = fields[11].GetUInt32(); + uint32 itemTemplate = fields[12].GetUInt32(); - m->AddItem(itemGuid, itemTemplate); + m->AddItem(itemGuid, itemTemplate); - ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemTemplate); + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemTemplate); - if (!proto) - { - sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, m->messageID); + if (!proto) + { + sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, m->messageID); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM); - stmt->setUInt32(0, itemGuid); - CharacterDatabase.Execute(stmt); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM); + stmt->setUInt32(0, itemGuid); + CharacterDatabase.Execute(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); - stmt->setUInt32(0, itemGuid); - CharacterDatabase.Execute(stmt); - continue; - } + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); + stmt->setUInt32(0, itemGuid); + CharacterDatabase.Execute(stmt); + continue; + } - Item* item = NewItemOrBag(proto); + Item* item = NewItemOrBag(proto); - if (!item->LoadFromDB(itemGuid, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, itemTemplate)) - { - sLog->outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", m->messageID, itemGuid); + if (!item->LoadFromDB(itemGuid, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, itemTemplate)) + { + sLog->outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", m->messageID, itemGuid); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM); - stmt->setUInt32(0, itemGuid); - CharacterDatabase.Execute(stmt); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM); + stmt->setUInt32(0, itemGuid); + CharacterDatabase.Execute(stmt); - item->FSetState(ITEM_REMOVED); + item->FSetState(ITEM_REMOVED); - SQLTransaction temp = SQLTransaction(NULL); - item->SaveToDB(temp); // it also deletes item object ! - continue; - } + SQLTransaction temp = SQLTransaction(NULL); + item->SaveToDB(temp); // it also deletes item object ! + continue; + } - AddMItem(item); - } + AddMItem(item); + } - prevMailID = fields[14].GetUInt32(); - } - while (result->NextRow()); + prevMailID = fields[14].GetUInt32(); + } + while (result->NextRow()); - m_mail.push_back(m); - } - // Xinef: this is stored during storage initialization - sWorld->UpdateGlobalPlayerMails(GetGUIDLow(), m_mail.size(), false); - m_mailsLoaded = true; + m_mail.push_back(m); + } + // Xinef: this is stored during storage initialization + sWorld->UpdateGlobalPlayerMails(GetGUIDLow(), m_mail.size(), false); + m_mailsLoaded = true; } void Player::_LoadMail() @@ -18618,7 +18618,7 @@ void Player::LoadPet() // just not added to the map if (IsInWorld()) { - Pet::LoadPetFromDB(this, PET_LOAD_SUMMON_PET, 0, 0, true); + Pet::LoadPetFromDB(this, PET_LOAD_SUMMON_PET, 0, 0, true); } } @@ -18877,7 +18877,7 @@ void Player::_LoadSpells(PreparedQueryResult result) if (result) { do - // xinef: checked + // xinef: checked addSpell((*result)[0].GetUInt32(), (*result)[1].GetUInt8(), true); while (result->NextRow()); } @@ -18885,20 +18885,20 @@ void Player::_LoadSpells(PreparedQueryResult result) void Player::_LoadGroup() { - if (uint32 groupId = GetGroupIdFromStorage(GetGUIDLow())) - if (Group* group = sGroupMgr->GetGroupByGUID(groupId)) - if (group->GetMemberGroup(GetGUID()) <= MAX_RAID_SUBGROUPS) - { - if (group->IsLeader(GetGUID())) - SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER); + if (uint32 groupId = GetGroupIdFromStorage(GetGUIDLow())) + if (Group* group = sGroupMgr->GetGroupByGUID(groupId)) + if (group->GetMemberGroup(GetGUID()) <= MAX_RAID_SUBGROUPS) + { + if (group->IsLeader(GetGUID())) + SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER); - uint8 subgroup = group->GetMemberGroup(GetGUID()); - SetGroup(group, subgroup); + uint8 subgroup = group->GetMemberGroup(GetGUID()); + SetGroup(group, subgroup); - // the group leader may change the instance difficulty while the player is offline - SetDungeonDifficulty(group->GetDungeonDifficulty()); - SetRaidDifficulty(group->GetRaidDifficulty()); - } + // the group leader may change the instance difficulty while the player is offline + SetDungeonDifficulty(group->GetDungeonDifficulty()); + SetRaidDifficulty(group->GetRaidDifficulty()); + } if (!GetGroup() || !GetGroup()->IsLeader(GetGUID())) RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER); @@ -18929,7 +18929,7 @@ void Player::SendRaidInfo() for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) { - BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUIDLow(), Difficulty(i)); + BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUIDLow(), Difficulty(i)); for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) { if (itr->second.perm) @@ -18960,7 +18960,7 @@ void Player::SendSavedInstances() for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) { - BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUIDLow(), Difficulty(i)); + BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUIDLow(), Difficulty(i)); for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) { if (itr->second.perm) // only permanent binds are sent @@ -18981,7 +18981,7 @@ void Player::SendSavedInstances() for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) { - BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUIDLow(), Difficulty(i)); + BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GetGUIDLow(), Difficulty(i)); for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) { if (itr->second.perm) @@ -19087,9 +19087,9 @@ bool Player::CheckInstanceLoginValid() return false; } - // pussywizard: check CanEnter for GetMap(), because in CanPlayerEnter it is called for a map decided before loading screen (can change) - if (!GetMap()->CanEnter(this, true)) - return false; + // pussywizard: check CanEnter for GetMap(), because in CanPlayerEnter it is called for a map decided before loading screen (can change) + if (!GetMap()->CanEnter(this, true)) + return false; // do checks for satisfy accessreqs, instance full, encounter in progress (raid), perm bind group != perm bind player return sMapMgr->CanPlayerEnter(GetMap()->GetId(), this, true); @@ -19174,7 +19174,7 @@ void Player::SaveToDB(bool create, bool logout) return; } - // pussywizard: full save now, so clear partial additional saves + // pussywizard: full save now, so clear partial additional saves m_additionalSaveTimer = 0; m_additionalSaveMask = 0; @@ -19186,7 +19186,7 @@ void Player::SaveToDB(bool create, bool logout) SQLTransaction trans = CharacterDatabase.BeginTransaction(); - _SaveCharacter(create, trans); + _SaveCharacter(create, trans); if (m_mailsUpdated) //save mails only when needed _SaveMail(trans); @@ -19222,15 +19222,15 @@ void Player::SaveToDB(bool create, bool logout) if (Pet* pet = GetPet()) pet->SavePetToDB(PET_SAVE_AS_CURRENT, logout); - // our: saving system - if (!create && !logout) - { - // pussywizard: if it was not yet our time to save, be we are saved (additional save after important changes) - // pussywizard: then free our original ticket in saving queue, so saving is fluent with no gaps - SavingSystemMgr::InsertToSavingSkipListIfNeeded(m_nextSave); + // our: saving system + if (!create && !logout) + { + // pussywizard: if it was not yet our time to save, be we are saved (additional save after important changes) + // pussywizard: then free our original ticket in saving queue, so saving is fluent with no gaps + SavingSystemMgr::InsertToSavingSkipListIfNeeded(m_nextSave); - m_nextSave = SavingSystemMgr::IncreaseSavingMaxValue(1); - } + m_nextSave = SavingSystemMgr::IncreaseSavingMaxValue(1); + } } // fast save function for item/money cheating preventing - save only inventory and money state @@ -19308,8 +19308,8 @@ void Player::_SaveAuras(SQLTransaction& trans, bool logout) continue; Aura* aura = itr->second; - if( !logout && aura->GetDuration() < 60*IN_MILLISECONDS ) - continue; + if( !logout && aura->GetDuration() < 60*IN_MILLISECONDS ) + continue; int32 damage[MAX_SPELL_EFFECTS]; int32 baseDamage[MAX_SPELL_EFFECTS]; @@ -19363,15 +19363,15 @@ void Player::_SaveInventory(SQLTransaction& trans) { Item* item = m_items[i]; if (!item) - continue; - - if (item->GetState() == ITEM_NEW) - { - // Xinef: item is removed, remove loot from storage if any - if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_OPENABLE) - sLootItemStorage->RemoveStoredLoot(item->GetGUIDLow()); continue; - } + + if (item->GetState() == ITEM_NEW) + { + // Xinef: item is removed, remove loot from storage if any + if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_OPENABLE) + sLootItemStorage->RemoveStoredLoot(item->GetGUIDLow()); + continue; + } stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM); stmt->setUInt32(0, item->GetGUIDLow()); @@ -19382,9 +19382,9 @@ void Player::_SaveInventory(SQLTransaction& trans) trans->Append(stmt); m_items[i]->FSetState(ITEM_NEW); - // Xinef: item is removed, remove loot from storage if any - if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_OPENABLE) - sLootItemStorage->RemoveStoredLoot(item->GetGUIDLow()); + // Xinef: item is removed, remove loot from storage if any + if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_OPENABLE) + sLootItemStorage->RemoveStoredLoot(item->GetGUIDLow()); } // Updated played time for refundable items. We don't do this in Player::Update because there's simply no need for it, @@ -19445,9 +19445,9 @@ void Player::_SaveInventory(SQLTransaction& trans) stmt->setUInt32(2, lowGuid); trans->Append(stmt); - RemoveTradeableItem(item); // pussywizard - RemoveEnchantmentDurationsReferences(item); // pussywizard - RemoveItemDurations(item); // pussywizard + RemoveTradeableItem(item); // pussywizard + RemoveEnchantmentDurationsReferences(item); // pussywizard + RemoveItemDurations(item); // pussywizard // also THIS item should be somewhere else, cheat attempt item->FSetState(ITEM_REMOVED); // we are IN updateQueue right now, can't use SetState which modifies the queue @@ -19619,7 +19619,7 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) else // xinef: what the fuck is this shit? quest can be removed by spelleffect if (!keepAbandoned) stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); - stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(0, GetGUIDLow()); stmt->setUInt32(1, saveItr->first); trans->Append(stmt); } @@ -19803,14 +19803,14 @@ void Player::_SaveSpells(SQLTransaction& trans) for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end();) { - // xinef: skip temporary spells - if (itr->second->State == PLAYERSPELL_TEMPORARY) - { - ++itr; - continue; - } + // xinef: skip temporary spells + if (itr->second->State == PLAYERSPELL_TEMPORARY) + { + ++itr; + continue; + } - // xinef: Delete statement for removed / updated spell + // xinef: Delete statement for removed / updated spell if (itr->second->State == PLAYERSPELL_REMOVED || itr->second->State == PLAYERSPELL_CHANGED) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL); @@ -19822,10 +19822,10 @@ void Player::_SaveSpells(SQLTransaction& trans) // xinef: insert statement for new / updated spell if (itr->second->State == PLAYERSPELL_NEW || itr->second->State == PLAYERSPELL_CHANGED) { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SPELL); - stmt->setUInt32(0, GetGUIDLow()); - stmt->setUInt32(1, itr->first); - stmt->setUInt8(2, itr->second->specMask); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SPELL); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, itr->first); + stmt->setUInt8(2, itr->second->specMask); trans->Append(stmt); } @@ -19981,7 +19981,7 @@ void Player::SetUInt32ValueInArray(Tokenizer& tokens, uint16 index, uint32 value void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair) { - // xinef: zomg! sync query + // xinef: zomg! sync query PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PLAYERBYTES2); stmt->setUInt32(0, GUID_LOPART(guid)); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -20074,117 +20074,117 @@ void Player::SendResetFailedNotify(uint32 mapid) /// Reset all solo instances and optionally send a message on success for each void Player::ResetInstances(uint64 guid, uint8 method, bool isRaid) { - switch (method) - { - case INSTANCE_RESET_ALL: - { - Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); - if (!p || p->GetDifficulty(false) != DUNGEON_DIFFICULTY_NORMAL) - break; - std::vector toUnbind; - BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUIDLow(), Difficulty(DUNGEON_DIFFICULTY_NORMAL)); - for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) - { - InstanceSave* instanceSave = itr->second.save; - const MapEntry* entry = sMapStore.LookupEntry(itr->first); - if (!entry || entry->IsRaid() || !instanceSave->CanReset()) - continue; + switch (method) + { + case INSTANCE_RESET_ALL: + { + Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); + if (!p || p->GetDifficulty(false) != DUNGEON_DIFFICULTY_NORMAL) + break; + std::vector toUnbind; + BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUIDLow(), Difficulty(DUNGEON_DIFFICULTY_NORMAL)); + for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) + { + InstanceSave* instanceSave = itr->second.save; + const MapEntry* entry = sMapStore.LookupEntry(itr->first); + if (!entry || entry->IsRaid() || !instanceSave->CanReset()) + continue; - Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); - if (!map || map->ToInstanceMap()->Reset(method)) - { - p->SendResetInstanceSuccess(instanceSave->GetMapId()); - toUnbind.push_back(instanceSave); - } - else - p->SendResetInstanceFailed(0, instanceSave->GetMapId()); - } - for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) - sInstanceSaveMgr->UnbindAllFor(*itr); - } - break; - case INSTANCE_RESET_CHANGE_DIFFICULTY: - { - Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); - if (!p) - break; - std::vector toUnbind; - BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUIDLow(), p->GetDifficulty(isRaid)); - for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) - { - InstanceSave* instanceSave = itr->second.save; - const MapEntry* entry = sMapStore.LookupEntry(itr->first); - if (!entry || entry->IsRaid() != isRaid || !instanceSave->CanReset()) - continue; + Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); + if (!map || map->ToInstanceMap()->Reset(method)) + { + p->SendResetInstanceSuccess(instanceSave->GetMapId()); + toUnbind.push_back(instanceSave); + } + else + p->SendResetInstanceFailed(0, instanceSave->GetMapId()); + } + for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) + sInstanceSaveMgr->UnbindAllFor(*itr); + } + break; + case INSTANCE_RESET_CHANGE_DIFFICULTY: + { + Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); + if (!p) + break; + std::vector toUnbind; + BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUIDLow(), p->GetDifficulty(isRaid)); + for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) + { + InstanceSave* instanceSave = itr->second.save; + const MapEntry* entry = sMapStore.LookupEntry(itr->first); + if (!entry || entry->IsRaid() != isRaid || !instanceSave->CanReset()) + continue; - Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); - if (!map || map->ToInstanceMap()->Reset(method)) - { - p->SendResetInstanceSuccess(instanceSave->GetMapId()); - toUnbind.push_back(instanceSave); - } - else - p->SendResetInstanceFailed(0, instanceSave->GetMapId()); - } - for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) - sInstanceSaveMgr->UnbindAllFor(*itr); - } - break; - case INSTANCE_RESET_GROUP_JOIN: - { - Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); - if (!p) - break; - for (uint8 d = 0; d < MAX_DIFFICULTY; ++d) - { - std::vector toUnbind; - BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUIDLow(), Difficulty(d)); - for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) - { - if (itr->second.perm) - continue; - InstanceSave* instanceSave = itr->second.save; - Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); - if (!map || p->FindMap() != map) - { - //p->SendResetInstanceSuccess(instanceSave->GetMapId()); - toUnbind.push_back(instanceSave); - } - //else - // p->SendResetInstanceFailed(0, instanceSave->GetMapId()); - } - for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) - sInstanceSaveMgr->PlayerUnbindInstance(p->GetGUIDLow(), (*itr)->GetMapId(), (*itr)->GetDifficulty(), true, p); - } - } - break; - case INSTANCE_RESET_GROUP_LEAVE: - { - Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); - for (uint8 d = 0; d < MAX_DIFFICULTY; ++d) - { - std::vector toUnbind; - BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GUID_LOPART(guid), Difficulty(d)); - for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) - { - if (itr->second.perm) - continue; - InstanceSave* instanceSave = itr->second.save; - Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); - if (!p || !map || p->FindMap() != map) - { - //p->SendResetInstanceSuccess(instanceSave->GetMapId()); - toUnbind.push_back(instanceSave); - } - //else - // p->SendResetInstanceFailed(0, instanceSave->GetMapId()); - } - for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) - sInstanceSaveMgr->PlayerUnbindInstance(GUID_LOPART(guid), (*itr)->GetMapId(), (*itr)->GetDifficulty(), true, p); - } - } - break; - } + Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); + if (!map || map->ToInstanceMap()->Reset(method)) + { + p->SendResetInstanceSuccess(instanceSave->GetMapId()); + toUnbind.push_back(instanceSave); + } + else + p->SendResetInstanceFailed(0, instanceSave->GetMapId()); + } + for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) + sInstanceSaveMgr->UnbindAllFor(*itr); + } + break; + case INSTANCE_RESET_GROUP_JOIN: + { + Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); + if (!p) + break; + for (uint8 d = 0; d < MAX_DIFFICULTY; ++d) + { + std::vector toUnbind; + BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(p->GetGUIDLow(), Difficulty(d)); + for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) + { + if (itr->second.perm) + continue; + InstanceSave* instanceSave = itr->second.save; + Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); + if (!map || p->FindMap() != map) + { + //p->SendResetInstanceSuccess(instanceSave->GetMapId()); + toUnbind.push_back(instanceSave); + } + //else + // p->SendResetInstanceFailed(0, instanceSave->GetMapId()); + } + for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) + sInstanceSaveMgr->PlayerUnbindInstance(p->GetGUIDLow(), (*itr)->GetMapId(), (*itr)->GetDifficulty(), true, p); + } + } + break; + case INSTANCE_RESET_GROUP_LEAVE: + { + Player* p = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); + for (uint8 d = 0; d < MAX_DIFFICULTY; ++d) + { + std::vector toUnbind; + BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(GUID_LOPART(guid), Difficulty(d)); + for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) + { + if (itr->second.perm) + continue; + InstanceSave* instanceSave = itr->second.save; + Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); + if (!p || !map || p->FindMap() != map) + { + //p->SendResetInstanceSuccess(instanceSave->GetMapId()); + toUnbind.push_back(instanceSave); + } + //else + // p->SendResetInstanceFailed(0, instanceSave->GetMapId()); + } + for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) + sInstanceSaveMgr->PlayerUnbindInstance(GUID_LOPART(guid), (*itr)->GetMapId(), (*itr)->GetDifficulty(), true, p); + } + } + break; + } } void Player::SendResetInstanceSuccess(uint32 MapId) @@ -20239,12 +20239,12 @@ void Player::UpdatePvPFlag(time_t currTime) return; if (pvpInfo.EndTimer == 0 || pvpInfo.IsHostile) return; - if (currTime < (pvpInfo.EndTimer + 300 + 5)) - { - if (currTime > (pvpInfo.EndTimer + 4) && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER)) - SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER); - return; - } + if (currTime < (pvpInfo.EndTimer + 300 + 5)) + { + if (currTime > (pvpInfo.EndTimer + 4) && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER)) + SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER); + return; + } UpdatePvP(false); } @@ -20295,9 +20295,9 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) if (pet) { - // xinef: dont save dead pet as current, save him not in slot - if (!pet->IsAlive() && mode == PET_SAVE_AS_CURRENT && pet->getPetType() == HUNTER_PET) - mode = PET_SAVE_NOT_IN_SLOT; + // xinef: dont save dead pet as current, save him not in slot + if (!pet->IsAlive() && mode == PET_SAVE_AS_CURRENT && pet->getPetType() == HUNTER_PET) + mode = PET_SAVE_NOT_IN_SLOT; ;//sLog->outDebug(LOG_FILTER_PETS, "RemovePet %u, %u, %u", pet->GetEntry(), mode, returnreagent); if (pet->m_removed) @@ -20353,11 +20353,11 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) SetGroupUpdateFlag(GROUP_UPDATE_PET); } - if (NeedSendSpectatorData() && pet->GetCreatureTemplate()->family) - { - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PHP", 0); - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PET", 0); - } + if (NeedSendSpectatorData() && pet->GetCreatureTemplate()->family) + { + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PHP", 0); + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PET", 0); + } } void Player::StopCastingCharm() @@ -20407,7 +20407,7 @@ void Player::TextEmote(const std::string& text) { WorldPacket data; ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, text); - SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT)); + SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT)); } void Player::Whisper(const std::string& text, uint32 language, uint64 receiver) @@ -20658,10 +20658,10 @@ void Player::SendRemoveControlBar() bool Player::HasSpellMod(SpellModifier* mod, Spell* spell) { - if (!mod || !spell) - return false; + if (!mod || !spell) + return false; - return spell->m_appliedMods.find(mod->ownerAura) != spell->m_appliedMods.end(); + return spell->m_appliedMods.find(mod->ownerAura) != spell->m_appliedMods.end(); } bool Player::IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell) @@ -20700,10 +20700,10 @@ class MageSpellModPred { if (a->type != b->type) return a->type == SPELLMOD_FLAT; - if (a->spellId == 44401) - return true; - if (b->spellId == 44401) - return false; + if (a->spellId == 44401) + return true; + if (b->spellId == 44401) + return false; return a->value < b->value; } }; @@ -20741,10 +20741,10 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply) if (apply) { m_spellMods[mod->op].push_back(mod); - if (getClass() == CLASS_MAGE) - m_spellMods[mod->op].sort(MageSpellModPred()); - else - m_spellMods[mod->op].sort(SpellModPred()); + if (getClass() == CLASS_MAGE) + m_spellMods[mod->op].sort(MageSpellModPred()); + else + m_spellMods[mod->op].sort(SpellModPred()); } else { @@ -20818,9 +20818,9 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura) spell->m_appliedMods.erase(iterMod); } - // Xinef: clear the list just do be sure - if (!ownerAuraId && !aura) - spell->m_appliedMods.clear(); + // Xinef: clear the list just do be sure + if (!ownerAuraId && !aura) + spell->m_appliedMods.clear(); } void Player::RestoreAllSpellMods(uint32 ownerAuraId, Aura* aura) @@ -20838,7 +20838,7 @@ void Player::RemoveSpellMods(Spell* spell) if (spell->m_appliedMods.empty()) return; - const SpellInfo *const spellInfo = spell->m_spellInfo; + const SpellInfo *const spellInfo = spell->m_spellInfo; for (uint8 i=0; im_appliedMods.end()) continue; - // remove from list - // leave this here, if spell have two mods it will remove 2 charges - wrong + // remove from list + // leave this here, if spell have two mods it will remove 2 charges - wrong spell->m_appliedMods.erase(iterMod); - // MAGE T8P4 BONUS - if( spellInfo->SpellFamilyName == SPELLFAMILY_MAGE ) - { - const SpellInfo *sp = mod->ownerAura->GetSpellInfo(); - // Missile Barrage, Hot Streak, Brain Freeze (trigger spell - Fireball!) - if( sp->SpellIconID == 3261 || sp->SpellIconID == 2999 || sp->SpellIconID == 2938 ) - if( AuraEffect *aurEff = GetAuraEffectDummy(64869) ) - if( roll_chance_i(aurEff->GetAmount()) ) - { - mod->charges = 1; - continue; - } - } + // MAGE T8P4 BONUS + if( spellInfo->SpellFamilyName == SPELLFAMILY_MAGE ) + { + const SpellInfo *sp = mod->ownerAura->GetSpellInfo(); + // Missile Barrage, Hot Streak, Brain Freeze (trigger spell - Fireball!) + if( sp->SpellIconID == 3261 || sp->SpellIconID == 2999 || sp->SpellIconID == 2938 ) + if( AuraEffect *aurEff = GetAuraEffectDummy(64869) ) + if( roll_chance_i(aurEff->GetAmount()) ) + { + mod->charges = 1; + continue; + } + } - if (mod->ownerAura->DropCharge(AURA_REMOVE_BY_EXPIRE)) + if (mod->ownerAura->DropCharge(AURA_REMOVE_BY_EXPIRE)) itr = m_spellMods[i].begin(); } } @@ -20898,23 +20898,23 @@ void Player::DropModCharge(SpellModifier* mod, Spell* spell) void Player::SetSpellModTakingSpell(Spell* spell, bool apply) { - if (apply && m_spellModTakingSpell != NULL) - { - sLog->outMisc("Player::SetSpellModTakingSpell (A1) - %u, %u", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id); - return; - //ASSERT(m_spellModTakingSpell == NULL); - } - else if (!apply) - { - if (!m_spellModTakingSpell) - sLog->outMisc("Player::SetSpellModTakingSpell (B1) - %u", spell->m_spellInfo->Id); - else if (m_spellModTakingSpell != spell) - { - sLog->outMisc("Player::SetSpellModTakingSpell (C1) - %u, %u", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id); - return; - } - //ASSERT(m_spellModTakingSpell && m_spellModTakingSpell == spell); - } + if (apply && m_spellModTakingSpell != NULL) + { + sLog->outMisc("Player::SetSpellModTakingSpell (A1) - %u, %u", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id); + return; + //ASSERT(m_spellModTakingSpell == NULL); + } + else if (!apply) + { + if (!m_spellModTakingSpell) + sLog->outMisc("Player::SetSpellModTakingSpell (B1) - %u", spell->m_spellInfo->Id); + else if (m_spellModTakingSpell != spell) + { + sLog->outMisc("Player::SetSpellModTakingSpell (C1) - %u, %u", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id); + return; + } + //ASSERT(m_spellModTakingSpell && m_spellModTakingSpell == spell); + } m_spellModTakingSpell = apply ? spell : NULL; } @@ -20930,28 +20930,28 @@ void Player::SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) { SignatureContainer* signatureStore = sPetitionMgr->GetSignatureStore(); - uint32 playerGuid = GUID_LOPART(guid); + uint32 playerGuid = GUID_LOPART(guid); - for (SignatureContainer::iterator itr = signatureStore->begin(); itr != signatureStore->end(); ++itr) - { - SignatureMap::iterator signItr = itr->second.signatureMap.find(playerGuid); - if (signItr != itr->second.signatureMap.end()) - { - Petition const* petition = sPetitionMgr->GetPetition(itr->first); - if (!petition || (type != 10 && type != petition->petitionType)) - continue; + for (SignatureContainer::iterator itr = signatureStore->begin(); itr != signatureStore->end(); ++itr) + { + SignatureMap::iterator signItr = itr->second.signatureMap.find(playerGuid); + if (signItr != itr->second.signatureMap.end()) + { + Petition const* petition = sPetitionMgr->GetPetition(itr->first); + if (!petition || (type != 10 && type != petition->petitionType)) + continue; - // erase this - itr->second.signatureMap.erase(signItr); + // erase this + itr->second.signatureMap.erase(signItr); - uint64 ownerguid = MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER); - uint64 petitionguid = MAKE_NEW_GUID(petition->petitionGuid, 0, HIGHGUID_ITEM); + uint64 ownerguid = MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER); + uint64 petitionguid = MAKE_NEW_GUID(petition->petitionGuid, 0, HIGHGUID_ITEM); - // send update if charter owner in game - Player* owner = ObjectAccessor::FindPlayerInOrOutOfWorld(ownerguid); - if (owner) - owner->GetSession()->SendPetitionQueryOpcode(petitionguid); - } + // send update if charter owner in game + Player* owner = ObjectAccessor::FindPlayerInOrOutOfWorld(ownerguid); + if (owner) + owner->GetSession()->SendPetitionQueryOpcode(petitionguid); + } } if (type == 10) @@ -20979,8 +20979,8 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) stmt->setUInt32(0, playerGuid); trans->Append(stmt); - // xinef: clear petition store - sPetitionMgr->RemovePetitionByOwnerAndType(playerGuid, 0); + // xinef: clear petition store + sPetitionMgr->RemovePetitionByOwnerAndType(playerGuid, 0); } else { @@ -20994,15 +20994,15 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) stmt->setUInt8(1, uint8(type)); trans->Append(stmt); - // xinef: clear petition store - sPetitionMgr->RemovePetitionByOwnerAndType(playerGuid, uint8(type)); + // xinef: clear petition store + sPetitionMgr->RemovePetitionByOwnerAndType(playerGuid, uint8(type)); } CharacterDatabase.CommitTransaction(trans); } void Player::LeaveAllArenaTeams(uint64 guid) { - // xinef: zomg! sync query + // xinef: zomg! sync query PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PLAYER_ARENA_TEAMS); stmt->setUInt32(0, GUID_LOPART(guid)); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -21226,8 +21226,8 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc // prevent stealth flight //RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK); - // Xinef: dont use instant flight paths if spellid is present (custom calls use spellid = 1) - if (sWorld->getBoolConfig(CONFIG_INSTANT_TAXI) && !spellid) + // Xinef: dont use instant flight paths if spellid is present (custom calls use spellid = 1) + if (sWorld->getBoolConfig(CONFIG_INSTANT_TAXI) && !spellid) { TaxiNodesEntry const* lastPathNode = sTaxiNodesStore.LookupEntry(nodes[nodes.size()-1]); m_taxi.ClearTaxiDestinations(); @@ -21285,32 +21285,32 @@ void Player::ContinueTaxiFlight() TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path]; float bestDist = SIZE_OF_GRIDS*SIZE_OF_GRIDS; // xinef: large value - float currDist = 0.0f; + float currDist = 0.0f; - // xinef: changed to -1, we dont want to catch last node + // xinef: changed to -1, we dont want to catch last node for (uint32 i = 0; i < nodeList.size() - 1; ++i) { TaxiPathNodeEntry const* node = nodeList[i]; TaxiPathNodeEntry const* nextNode = nodeList[i+1]; // xinef: skip nodes at another map, get last valid node on current map - if (nextNode->mapid != GetMapId() || node->mapid != GetMapId()) + if (nextNode->mapid != GetMapId() || node->mapid != GetMapId()) continue; currDist = (node->x - GetPositionX())*(node->x - GetPositionX())+(node->y - GetPositionY())*(node->y - GetPositionY())+(node->z - GetPositionZ())*(node->z - GetPositionZ()); if (currDist < bestDist) - { + { startNode = i; - bestDist = currDist; - } + bestDist = currDist; + } } - // xinef: no proper node was found - if (startNode == 0) - { - m_taxi.ClearTaxiDestinations(); - return; - } + // xinef: no proper node was found + if (startNode == 0) + { + m_taxi.ClearTaxiDestinations(); + return; + } GetSession()->SendDoFlight(mountDisplayId, path, startNode); } @@ -21534,8 +21534,8 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 } - VendorItemData const* vItems = GetSession()->GetCurrentVendor() ? sObjectMgr->GetNpcVendorItemList(GetSession()->GetCurrentVendor()) : creature->GetVendorItems(); - if (!vItems || vItems->Empty()) + VendorItemData const* vItems = GetSession()->GetCurrentVendor() ? sObjectMgr->GetNpcVendorItemList(GetSession()->GetCurrentVendor()) : creature->GetVendorItems(); + if (!vItems || vItems->Empty()) { SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0); return false; @@ -21855,7 +21855,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite // self spell cooldown if (recTime > 0) - { + { AddSpellCooldown(spellInfo->Id, itemId, recTime, true, true); if (needsCooldownPacket) @@ -21877,7 +21877,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite if (*i_scset == spellInfo->Id) // skip main spell, already handled above continue; - AddSpellCooldown(*i_scset, itemId, catrecTime, !spellInfo->IsCooldownStartedOnEvent() && spellInfo->CategoryRecoveryTime != spellInfo->RecoveryTime && spellInfo->RecoveryTime && spellInfo->CategoryRecoveryTime); // Xinef: send category cooldowns on login if category cooldown is different from base cooldown + AddSpellCooldown(*i_scset, itemId, catrecTime, !spellInfo->IsCooldownStartedOnEvent() && spellInfo->CategoryRecoveryTime != spellInfo->RecoveryTime && spellInfo->RecoveryTime && spellInfo->CategoryRecoveryTime); // Xinef: send category cooldowns on login if category cooldown is different from base cooldown } } } @@ -21888,16 +21888,16 @@ void Player::AddSpellCooldown(uint32 spellid, uint32 itemid, uint32 end_time, bo SpellCooldown sc; sc.end = World::GetGameTimeMS()+end_time; sc.itemid = itemid; - sc.maxduration = end_time; - sc.sendToSpectator = false; - sc.needSendToClient = needSendToClient; + sc.maxduration = end_time; + sc.sendToSpectator = false; + sc.needSendToClient = needSendToClient; - if (end_time >= SPECTATOR_COOLDOWN_MIN*IN_MILLISECONDS && end_time <= SPECTATOR_COOLDOWN_MAX*IN_MILLISECONDS) - if (NeedSendSpectatorData() && forceSendToSpectator && (itemid || HasActiveSpell(spellid))) - { - sc.sendToSpectator = true; - ArenaSpectator::SendCommand_Cooldown(FindMap(), GetGUID(), "ACD", spellid, end_time/IN_MILLISECONDS, end_time/IN_MILLISECONDS); - } + if (end_time >= SPECTATOR_COOLDOWN_MIN*IN_MILLISECONDS && end_time <= SPECTATOR_COOLDOWN_MAX*IN_MILLISECONDS) + if (NeedSendSpectatorData() && forceSendToSpectator && (itemid || HasActiveSpell(spellid))) + { + sc.sendToSpectator = true; + ArenaSpectator::SendCommand_Cooldown(FindMap(), GetGUID(), "ACD", spellid, end_time/IN_MILLISECONDS, end_time/IN_MILLISECONDS); + } m_spellCooldowns[spellid] = sc; } @@ -21968,8 +21968,8 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) { for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot <= PRISMATIC_ENCHANTMENT_SLOT; ++enchant_slot) { - if (enchant_slot == BONUS_ENCHANTMENT_SLOT) - continue; + if (enchant_slot == BONUS_ENCHANTMENT_SLOT) + continue; uint32 enchant_id = pItem2->GetEnchantmentId(EnchantmentSlot(enchant_slot)); if (!enchant_id) @@ -22110,19 +22110,19 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply) void Player::SetEntryPoint() { - m_entryPointData.joinPos.m_mapId = MAPID_INVALID; - m_entryPointData.ClearTaxiPath(); + m_entryPointData.joinPos.m_mapId = MAPID_INVALID; + m_entryPointData.ClearTaxiPath(); if (!m_taxi.empty()) { m_entryPointData.mountSpell = 0; m_entryPointData.joinPos = WorldLocation(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); - std::vector const& taxi = m_taxi.GetPath(); - for (std::vector::const_iterator itr = taxi.begin(); itr != taxi.end(); ++itr) - m_entryPointData.taxiPath.push_back(*itr); + std::vector const& taxi = m_taxi.GetPath(); + for (std::vector::const_iterator itr = taxi.begin(); itr != taxi.end(); ++itr) + m_entryPointData.taxiPath.push_back(*itr); - m_entryPointData.taxiPath.push_back(m_taxi.GetTaxiSegment()); + m_entryPointData.taxiPath.push_back(m_taxi.GetTaxiSegment()); } else { @@ -22151,18 +22151,18 @@ void Player::SetEntryPoint() void Player::LeaveBattleground(Battleground* bg) { if (!bg) - bg = GetBattleground(); + bg = GetBattleground(); - if (!bg) - return; + if (!bg) + return; - // xinef: reset corpse reclaim time - m_deathExpireTime = time(NULL); + // xinef: reset corpse reclaim time + m_deathExpireTime = time(NULL); - // pussywizard: clear movement, because after porting player will move to arena cords - GetMotionMaster()->MovementExpired(); - StopMoving(); - TeleportToEntryPoint(); + // pussywizard: clear movement, because after porting player will move to arena cords + GetMotionMaster()->MovementExpired(); + StopMoving(); + TeleportToEntryPoint(); } bool Player::CanJoinToBattleground() const @@ -22191,9 +22191,9 @@ void Player::ReportedAfkBy(Player* reporter) if (!bg || bg != reporter->GetBattleground() || GetTeamId() != reporter->GetTeamId() || bg->GetStatus() != STATUS_IN_PROGRESS) return; - // Xinef: 2 minutes startup + 2 minute of match - if (bg->GetStartTime() < 4*MINUTE*IN_MILLISECONDS) - return; + // Xinef: 2 minutes startup + 2 minute of match + if (bg->GetStartTime() < 4*MINUTE*IN_MILLISECONDS) + return; // check if player has 'Idle' or 'Inactive' debuff if (m_bgData.bgAfkReporter.find(reporter->GetGUIDLow()) == m_bgData.bgAfkReporter.end() && !HasAura(43680) && !HasAura(43681) && reporter->CanReportAfkDueToLimit()) @@ -22419,13 +22419,13 @@ void Player::UpdateObjectVisibility(bool forced, bool fromUpdate) { if (!forced) AddToNotify(NOTIFY_VISIBILITY_CHANGED); - else if (!isBeingLoaded()) + else if (!isBeingLoaded()) { - if (!fromUpdate) // pussywizard: - { - bRequestForcedVisibilityUpdate = true; - return; - } + if (!fromUpdate) // pussywizard: + { + bRequestForcedVisibilityUpdate = true; + return; + } Unit::UpdateObjectVisibility(true); UpdateVisibilityForPlayer(); } @@ -22437,8 +22437,8 @@ void Player::UpdateVisibilityForPlayer(bool mapChange) m_seer->VisitNearbyObject(GetSightRange()+VISIBILITY_INC_FOR_GOBJECTS, notifier); notifier.SendToSelf(); - if (mapChange) - m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + if (mapChange) + m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); } void Player::InitPrimaryProfessions() @@ -22486,10 +22486,10 @@ Player* Player::GetSelectedPlayer() const void Player::SetSelection(uint64 guid) { - SetUInt64Value(UNIT_FIELD_TARGET, guid); + SetUInt64Value(UNIT_FIELD_TARGET, guid); - if (NeedSendSpectatorData()) - ArenaSpectator::SendCommand_GUID(FindMap(), GetGUID(), "TRG", guid); + if (NeedSendSpectatorData()) + ArenaSpectator::SendCommand_GUID(FindMap(), GetGUID(), "TRG", guid); } void Player::SendComboPoints() @@ -22657,18 +22657,18 @@ void Player::SendInitialPacketsAfterAddToMap() auraList.front()->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); } - // Fix mount shit... to tired to think, update block gets messed somewhere - { - if (!isBeingLoaded() && GetMountBlockId() && !HasAuraType(SPELL_AURA_MOUNTED)) - { - AddAura(GetMountBlockId(), this); - SetMountBlockId(0); - } - } + // Fix mount shit... to tired to think, update block gets messed somewhere + { + if (!isBeingLoaded() && GetMountBlockId() && !HasAuraType(SPELL_AURA_MOUNTED)) + { + AddAura(GetMountBlockId(), this); + SetMountBlockId(0); + } + } // update zone uint32 newzone, newarea; - GetZoneAndAreaId(newzone, newarea, true); + GetZoneAndAreaId(newzone, newarea, true); UpdateZone(newzone, newarea); // also call SendInitWorldStates(); if (HasAuraType(SPELL_AURA_MOD_STUN)) @@ -22734,14 +22734,14 @@ void Player::SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool onEnterMap) { - // pussywizard: - InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(GetGUIDLow(), mapid, difficulty); - if (bind && bind->extended) - { - if (!onEnterMap) // extended id player shouldn't be warned about lock expiration - return; - time += (bind->save->GetExtendedResetTime() - bind->save->GetResetTime()); // add lockout period to the time left - } + // pussywizard: + InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(GetGUIDLow(), mapid, difficulty); + if (bind && bind->extended) + { + if (!onEnterMap) // extended id player shouldn't be warned about lock expiration + return; + time += (bind->save->GetExtendedResetTime() - bind->save->GetResetTime()); // add lockout period to the time left + } // type of warning, based on the time remaining until reset uint32 type; @@ -22780,31 +22780,31 @@ void Player::ApplyEquipCooldown(Item* pItem) if (!spellData.SpellId) continue; - // xinef: apply hidden cooldown for procs - if (spellData.SpellTrigger == ITEM_SPELLTRIGGER_ON_EQUIP) - { - // xinef: uint32(-1) special marker for proc cooldowns - AddSpellCooldown(spellData.SpellId, uint32(-1), 30*IN_MILLISECONDS); - continue; - } + // xinef: apply hidden cooldown for procs + if (spellData.SpellTrigger == ITEM_SPELLTRIGGER_ON_EQUIP) + { + // xinef: uint32(-1) special marker for proc cooldowns + AddSpellCooldown(spellData.SpellId, uint32(-1), 30*IN_MILLISECONDS); + continue; + } // wrong triggering type (note: ITEM_SPELLTRIGGER_ON_NO_DELAY_USE not have cooldown) if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) continue; - // xinef: dont apply equip cooldown if spell on item has insignificant cooldown - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); - if (spellData.SpellCooldown <= 3000 && spellData.SpellCategoryCooldown <= 3000 && (!spellInfo || spellInfo->RecoveryTime <= 3000 && spellInfo->CategoryRecoveryTime <= 3000)) - continue; + // xinef: dont apply equip cooldown if spell on item has insignificant cooldown + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); + if (spellData.SpellCooldown <= 3000 && spellData.SpellCategoryCooldown <= 3000 && (!spellInfo || spellInfo->RecoveryTime <= 3000 && spellInfo->CategoryRecoveryTime <= 3000)) + continue; // Don't replace longer cooldowns by equip cooldown if we have any. SpellCooldowns::iterator itr = m_spellCooldowns.find(spellData.SpellId); if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > time(NULL) + 30) continue; - // xinef: dont apply eqiup cooldown for spells with this attribute - if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_CANT_USED_IN_COMBAT)) - continue; + // xinef: dont apply eqiup cooldown for spells with this attribute + if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_CANT_USED_IN_COMBAT)) + continue; AddSpellCooldown(spellData.SpellId, pItem->GetEntry(), 30*IN_MILLISECONDS, true, true); @@ -22825,8 +22825,8 @@ void Player::resetSpells() // and we can't use original map for safe iterative with visit each spell at loop end PlayerSpellMap spellMap = GetSpellMap(); - for (PlayerSpellMap::const_iterator iter = spellMap.begin(); iter != spellMap.end(); ++iter) - removeSpell(iter->first, SPEC_MASK_ALL, false); + for (PlayerSpellMap::const_iterator iter = spellMap.begin(); iter != spellMap.end(); ++iter) + removeSpell(iter->first, SPEC_MASK_ALL, false); learnDefaultSpells(); learnQuestRewardedSpells(); @@ -22842,7 +22842,7 @@ void Player::learnDefaultSpells() void Player::learnQuestRewardedSpells(Quest const* quest) { - // xinef: quest does not learn anything + // xinef: quest does not learn anything int32 spellId = quest->GetRewSpellCast(); if (!spellId) return; @@ -22856,10 +22856,10 @@ void Player::learnQuestRewardedSpells(Quest const* quest) for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL && spellInfo->Effects[i].TriggerSpell && !HasSpell(spellInfo->Effects[i].TriggerSpell)) { - // pusywizard: don't re-add profession specialties! - if (SpellInfo const* triggeredInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell)) - if (triggeredInfo->Effects[0].Effect == SPELL_EFFECT_TRADE_SKILL) - break; // pussywizard: break and not cast the spell (found is false) + // pusywizard: don't re-add profession specialties! + if (SpellInfo const* triggeredInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell)) + if (triggeredInfo->Effects[0].Effect == SPELL_EFFECT_TRADE_SKILL) + break; // pussywizard: break and not cast the spell (found is false) found = true; break; @@ -22908,24 +22908,24 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value) removeSpell(pAbility->spellId, SPEC_MASK_ALL, true); // need learn else - { - // Xinef: there is next spell and we have enough skill value to obtain it - skip current spell - if (pAbility->req_skill_value > 1 && pAbility->forward_spellid) - { - bool hasForwardSpell = false; - SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(pAbility->forward_spellid); - for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) - if (skill_value >= _spell_idx->second->req_skill_value) - { - hasForwardSpell = true; - break; - } - if (hasForwardSpell) - continue; - } + { + // Xinef: there is next spell and we have enough skill value to obtain it - skip current spell + if (pAbility->req_skill_value > 1 && pAbility->forward_spellid) + { + bool hasForwardSpell = false; + SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(pAbility->forward_spellid); + for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) + if (skill_value >= _spell_idx->second->req_skill_value) + { + hasForwardSpell = true; + break; + } + if (hasForwardSpell) + continue; + } addSpell(pAbility->spellId, SPEC_MASK_ALL, true, true); - } + } } } } @@ -23069,21 +23069,21 @@ bool Player::InArena() const void Player::SetBattlegroundId(uint32 id, BattlegroundTypeId bgTypeId, uint32 queueSlot, bool invited, bool isRandom, TeamId teamId) { - // if leaving current bg (and was invited) - decrease invited count for current one - if (m_bgData.bgInstanceID && m_bgData.isInvited) - if (Battleground* bg = sBattlegroundMgr->GetBattleground(m_bgData.bgInstanceID)) - bg->DecreaseInvitedCount(m_bgData.bgTeamId); + // if leaving current bg (and was invited) - decrease invited count for current one + if (m_bgData.bgInstanceID && m_bgData.isInvited) + if (Battleground* bg = sBattlegroundMgr->GetBattleground(m_bgData.bgInstanceID)) + bg->DecreaseInvitedCount(m_bgData.bgTeamId); - // if entering new bg (and is invited) - increase invited count for new one - if (id && invited) - if (Battleground* bg = sBattlegroundMgr->GetBattleground(id)) - bg->IncreaseInvitedCount(teamId); + // if entering new bg (and is invited) - increase invited count for new one + if (id && invited) + if (Battleground* bg = sBattlegroundMgr->GetBattleground(id)) + bg->IncreaseInvitedCount(teamId); m_bgData.bgInstanceID = id; m_bgData.bgTypeID = bgTypeId; - m_bgData.bgQueueSlot = queueSlot; - m_bgData.isInvited = invited; - m_bgData.bgIsRandom = isRandom; + m_bgData.bgQueueSlot = queueSlot; + m_bgData.isInvited = invited; + m_bgData.bgIsRandom = isRandom; m_bgData.bgTeamId = teamId; SetByteValue(PLAYER_BYTES_3, 3, uint8(teamId == TEAM_ALLIANCE ? 1 : 0)); @@ -23275,21 +23275,21 @@ void Player::AddItemDurations(Item* item) void Player::UpdateTitansGrip() { - // 10% damage reduce if 2x2h weapons are used - if (!CanTitanGrip()) - RemoveAurasDueToSpell(49152); - else if (Aura* aur = GetAura(49152)) - aur->RecalculateAmountOfEffects(); + // 10% damage reduce if 2x2h weapons are used + if (!CanTitanGrip()) + RemoveAurasDueToSpell(49152); + else if (Aura* aur = GetAura(49152)) + aur->RecalculateAmountOfEffects(); } void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/) { Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); if (!offItem) - { - UpdateTitansGrip(); + { + UpdateTitansGrip(); return; - } + } // unequip offhand weapon if player doesn't have dual wield anymore if (!CanDualWield() && (offItem->GetTemplate()->InventoryType == INVTYPE_WEAPONOFFHAND || offItem->GetTemplate()->InventoryType == INVTYPE_WEAPON)) @@ -23297,10 +23297,10 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/) // need unequip offhand for 2h-weapon without TitanGrip (in any from hands) if (!force && (CanTitanGrip() || (offItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed()))) - { - UpdateTitansGrip(); - return; - } + { + UpdateTitansGrip(); + return; + } ItemPosCountVec off_dest; uint8 off_msg = CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false); @@ -23321,7 +23321,7 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/) CharacterDatabase.CommitTransaction(trans); } - UpdateTitansGrip(); + UpdateTitansGrip(); } OutdoorPvP* Player::GetOutdoorPvP() const @@ -23495,7 +23495,7 @@ bool Player::GetsRecruitAFriendBonus(bool forXP) for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* player = itr->GetSource(); - if (!player || !player->IsInMap(this)) + if (!player || !player->IsInMap(this)) continue; if (!player->IsAtRecruitAFriendDistance(this)) @@ -23633,12 +23633,12 @@ void Player::SetClientControl(Unit* target, bool allowMove, bool packetOnly /*= { WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, target->GetPackGUID().size()+1); data.append(target->GetPackGUID()); - data << uint8((allowMove && !target->HasUnitState(UNIT_STATE_FLEEING|UNIT_STATE_CONFUSED)) ? 1 : 0); + data << uint8((allowMove && !target->HasUnitState(UNIT_STATE_FLEEING|UNIT_STATE_CONFUSED)) ? 1 : 0); GetSession()->SendPacket(&data); - // We want to set the packet only - if (packetOnly) - return; + // We want to set the packet only + if (packetOnly) + return; if (this != target) SetViewpoint(target, allowMove); @@ -23646,43 +23646,43 @@ void Player::SetClientControl(Unit* target, bool allowMove, bool packetOnly /*= if (allowMove) SetMover(target); - // Xinef: disable moving if target has disable move flag - if (target->GetTypeId() != TYPEID_UNIT) - return; + // Xinef: disable moving if target has disable move flag + if (target->GetTypeId() != TYPEID_UNIT) + return; - if (allowMove && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) - { - target->ClearUnitState(UNIT_STATE_ROOT); - target->SetControlled(true, UNIT_STATE_ROOT); - } - else if (!allowMove && target->HasUnitState(UNIT_STATE_ROOT) && !target->HasUnitTypeMask(UNIT_MASK_ACCESSORY)) - { - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) - { - // Xinef: restore original orientation, important for shooting vehicles! - Position pos = target->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && target->GetTransGUID() && IS_MO_TRANSPORT_GUID(target->GetTransGUID()) ? target->ToCreature()->GetTransportHomePosition() : target->ToCreature()->GetHomePosition(); - target->SetOrientation(pos.GetOrientation()); - target->SetFacingTo(pos.GetOrientation()); - target->DisableSpline(); - } - else - target->SetControlled(false, UNIT_STATE_ROOT); - } + if (allowMove && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) + { + target->ClearUnitState(UNIT_STATE_ROOT); + target->SetControlled(true, UNIT_STATE_ROOT); + } + else if (!allowMove && target->HasUnitState(UNIT_STATE_ROOT) && !target->HasUnitTypeMask(UNIT_MASK_ACCESSORY)) + { + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) + { + // Xinef: restore original orientation, important for shooting vehicles! + Position pos = target->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && target->GetTransGUID() && IS_MO_TRANSPORT_GUID(target->GetTransGUID()) ? target->ToCreature()->GetTransportHomePosition() : target->ToCreature()->GetHomePosition(); + target->SetOrientation(pos.GetOrientation()); + target->SetFacingTo(pos.GetOrientation()); + target->DisableSpline(); + } + else + target->SetControlled(false, UNIT_STATE_ROOT); + } } void Player::SetMover(Unit* target) { - if (this != target && target->m_movedByPlayer && target->m_movedByPlayer != target && target->m_movedByPlayer != this) - { - sLog->outMisc("Player::SetMover (A1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); - sLog->outMisc("Player::SetMover (A2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); - sLog->outMisc("Player::SetMover (A3) - %u, %u, %u, %u, %u, %u, %u, %u", target->m_movedByPlayer->GetGUIDLow(), target->m_movedByPlayer->GetMapId(), target->m_movedByPlayer->GetInstanceId(), target->m_movedByPlayer->FindMap(), target->m_movedByPlayer->IsInWorld() ? 1 : 0, target->m_movedByPlayer->IsDuringRemoveFromWorld() ? 1 : 0, target->m_movedByPlayer->ToPlayer()->IsBeingTeleported() ? 1 : 0, target->m_movedByPlayer->isBeingLoaded() ? 1 : 0); - } - if (this != target && (!target->IsInWorld() || target->IsDuringRemoveFromWorld() || GetMapId() != target->GetMapId() || GetInstanceId() != target->GetInstanceId())) - { - sLog->outMisc("Player::SetMover (B1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); - sLog->outMisc("Player::SetMover (B2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); - } + if (this != target && target->m_movedByPlayer && target->m_movedByPlayer != target && target->m_movedByPlayer != this) + { + sLog->outMisc("Player::SetMover (A1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); + sLog->outMisc("Player::SetMover (A2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); + sLog->outMisc("Player::SetMover (A3) - %u, %u, %u, %u, %u, %u, %u, %u", target->m_movedByPlayer->GetGUIDLow(), target->m_movedByPlayer->GetMapId(), target->m_movedByPlayer->GetInstanceId(), target->m_movedByPlayer->FindMap(), target->m_movedByPlayer->IsInWorld() ? 1 : 0, target->m_movedByPlayer->IsDuringRemoveFromWorld() ? 1 : 0, target->m_movedByPlayer->ToPlayer()->IsBeingTeleported() ? 1 : 0, target->m_movedByPlayer->isBeingLoaded() ? 1 : 0); + } + if (this != target && (!target->IsInWorld() || target->IsDuringRemoveFromWorld() || GetMapId() != target->GetMapId() || GetInstanceId() != target->GetInstanceId())) + { + sLog->outMisc("Player::SetMover (B1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); + sLog->outMisc("Player::SetMover (B2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); + } m_mover->m_movedByPlayer = NULL; m_mover = target; m_mover->m_movedByPlayer = this; @@ -23710,24 +23710,24 @@ void Player::UpdateAreaDependentAuras(uint32 newArea) ++iter; } - // Xinef: check controlled auras - if (!m_Controlled.empty()) - for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ) - { - Unit* controlled = *itr; - ++itr; - if (controlled && !controlled->IsPet()) - { - Unit::AuraMap& tAuras = controlled->GetOwnedAuras(); + // Xinef: check controlled auras + if (!m_Controlled.empty()) + for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ) + { + Unit* controlled = *itr; + ++itr; + if (controlled && !controlled->IsPet()) + { + Unit::AuraMap& tAuras = controlled->GetOwnedAuras(); for (Unit::AuraMap::iterator auraIter = tAuras.begin(); auraIter != tAuras.end();) { - if (auraIter->second->GetSpellInfo()->CheckLocation(GetMapId(), m_zoneUpdateId, newArea, NULL) != SPELL_CAST_OK) - controlled->RemoveOwnedAura(auraIter); - else - ++auraIter; - } - } - } + if (auraIter->second->GetSpellInfo()->CheckLocation(GetMapId(), m_zoneUpdateId, newArea, NULL) != SPELL_CAST_OK) + controlled->RemoveOwnedAura(auraIter); + else + ++auraIter; + } + } + } // some auras applied at subzone enter SpellAreaForAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForAreaMapBounds(newArea); @@ -23876,7 +23876,7 @@ PartyResult Player::CanUninviteFromGroup() const if (!sLFGMgr->GetKicksLeft(gguid)) return ERR_PARTY_LFG_BOOT_LIMIT; - lfg::LfgState state = sLFGMgr->GetState(gguid); + lfg::LfgState state = sLFGMgr->GetState(gguid); if (state == lfg::LFG_STATE_BOOT) return ERR_PARTY_LFG_BOOT_IN_PROGRESS; @@ -23891,7 +23891,7 @@ PartyResult Player::CanUninviteFromGroup() const // TODO: Should also be sent when anyone has recently left combat, with an aprox ~5 seconds timer. for (GroupReference const* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) - if (itr->GetSource() && itr->GetSource()->IsInMap(this) && itr->GetSource()->IsInCombat()) + if (itr->GetSource() && itr->GetSource()->IsInMap(this) && itr->GetSource()->IsInCombat()) return ERR_PARTY_LFG_BOOT_IN_COMBAT; /* Missing support for these types @@ -23913,7 +23913,7 @@ PartyResult Player::CanUninviteFromGroup() const bool Player::isUsingLfg() { - return sLFGMgr->GetState(GetGUID()) != lfg::LFG_STATE_NONE; + return sLFGMgr->GetState(GetGUID()) != lfg::LFG_STATE_NONE; } bool Player::inRandomLfgDungeon() @@ -23930,11 +23930,11 @@ bool Player::inRandomLfgDungeon() void Player::SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup) { //we must move references from m_group to m_originalGroup - if (GetGroup() && (GetGroup()->isBGGroup() || GetGroup()->isBFGroup())) - { - sLog->outMisc("Player::SetBattlegroundOrBattlefieldRaid - current group is %s group!", (GetGroup()->isBGGroup() ? "BG" : "BF")); - //ASSERT(false); // pussywizard: origanal group can never be bf/bg group - } + if (GetGroup() && (GetGroup()->isBGGroup() || GetGroup()->isBFGroup())) + { + sLog->outMisc("Player::SetBattlegroundOrBattlefieldRaid - current group is %s group!", (GetGroup()->isBGGroup() ? "BG" : "BF")); + //ASSERT(false); // pussywizard: origanal group can never be bf/bg group + } SetOriginalGroup(GetGroup(), GetSubGroup()); @@ -23970,13 +23970,13 @@ void Player::SetOriginalGroup(Group* group, int8 subgroup) void Player::UpdateUnderwaterState(Map* m, float x, float y, float z) { - // pussywizard: optimization - if (GetExactDistSq(&m_last_underwaterstate_position) < 3.0f*3.0f) - return; - m_last_underwaterstate_position.Relocate(m_positionX, m_positionY, m_positionZ); + // pussywizard: optimization + if (GetExactDistSq(&m_last_underwaterstate_position) < 3.0f*3.0f) + return; + m_last_underwaterstate_position.Relocate(m_positionX, m_positionY, m_positionZ); - if (!IsPositionValid()) // pussywizard: crashfix if calculated grid coords would be out of range 0-64 - return; + if (!IsPositionValid()) // pussywizard: crashfix if calculated grid coords would be out of range 0-64 + return; LiquidData liquid_status; ZLiquidStatus res = m->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquid_status); @@ -24069,7 +24069,7 @@ void Player::SetCanBlock(bool value) void Player::SetCanTitanGrip(bool value) { - m_canTitanGrip = value; + m_canTitanGrip = value; } bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const @@ -24097,12 +24097,12 @@ void Player::SetViewpoint(WorldObject* target, bool apply) { if (apply) { - // target must be in world - if (!target->IsInWorld()) - return; + // target must be in world + if (!target->IsInWorld()) + return; - if (!IsInWorld() || IsDuringRemoveFromWorld()) - return; + if (!IsInWorld() || IsDuringRemoveFromWorld()) + return; ;//sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId()); @@ -24120,12 +24120,12 @@ void Player::SetViewpoint(WorldObject* target, bool apply) } else { - //must immediately set seer back otherwise may crash + //must immediately set seer back otherwise may crash m_seer = this; ;//sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s remove seer", GetName().c_str()); - if (target->isType(TYPEMASK_UNIT) && !GetVehicle()) + if (target->isType(TYPEMASK_UNIT) && !GetVehicle()) ((Unit*)target)->RemovePlayerFromVision(this); if (!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) @@ -24287,16 +24287,16 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost) void Player::UpdateCharmedAI() { - // Xinef: maybe passed as argument? - Unit* charmer = GetCharmer(); - CharmInfo* charmInfo = GetCharmInfo(); + // Xinef: maybe passed as argument? + Unit* charmer = GetCharmer(); + CharmInfo* charmInfo = GetCharmInfo(); - // Xinef: needs more thinking, maybe kill player? - if (!charmer || !charmInfo) - return; + // Xinef: needs more thinking, maybe kill player? + if (!charmer || !charmInfo) + return; // Xinef: we should be killed if caster enters evade mode and charm is infinite - if (charmer->GetTypeId() == TYPEID_UNIT && charmer->ToCreature()->IsInEvadeMode()) + if (charmer->GetTypeId() == TYPEID_UNIT && charmer->ToCreature()->IsInEvadeMode()) { AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOD_CHARM); for (AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter) @@ -24307,148 +24307,148 @@ void Player::UpdateCharmedAI() } } - Unit* target = GetVictim(); - if (target) - { - SetInFront(target); - SendMovementFlagUpdate(true); - } + Unit* target = GetVictim(); + if (target) + { + SetInFront(target); + SendMovementFlagUpdate(true); + } - if (HasUnitState(UNIT_STATE_CASTING)) - return; + if (HasUnitState(UNIT_STATE_CASTING)) + return; - bool Mages = getClassMask() & (1<<(CLASS_MAGE-1) | 1<<(CLASS_WARLOCK-1) | 1<<(CLASS_DRUID-1) | 1<<(CLASS_HUNTER-1) | 1<<(CLASS_PRIEST-1)); + bool Mages = getClassMask() & (1<<(CLASS_MAGE-1) | 1<<(CLASS_WARLOCK-1) | 1<<(CLASS_DRUID-1) | 1<<(CLASS_HUNTER-1) | 1<<(CLASS_PRIEST-1)); - // Xinef: charmer type specific actions - if (charmer->GetTypeId() == TYPEID_PLAYER) - { - bool follow = false; - if (!target) - { - if (charmInfo->GetPlayerReactState() == REACT_PASSIVE) - follow = true; - else if (charmInfo->GetPlayerReactState() == REACT_DEFENSIVE) - { - if (charmer->GetVictim()) - target = charmer->GetVictim(); - else - follow = true; - } + // Xinef: charmer type specific actions + if (charmer->GetTypeId() == TYPEID_PLAYER) + { + bool follow = false; + if (!target) + { + if (charmInfo->GetPlayerReactState() == REACT_PASSIVE) + follow = true; + else if (charmInfo->GetPlayerReactState() == REACT_DEFENSIVE) + { + if (charmer->GetVictim()) + target = charmer->GetVictim(); + else + follow = true; + } - if (follow) - { - if (!HasUnitState(UNIT_STATE_FOLLOW)) - GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - return; - } - } - else if (target && GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE) - GetMotionMaster()->MoveChase(target, Mages ? 15 : 4); - } - + if (follow) + { + if (!HasUnitState(UNIT_STATE_FOLLOW)) + GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + return; + } + } + else if (target && GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE) + GetMotionMaster()->MoveChase(target, Mages ? 15 : 4); + } + if (!target || !IsValidAttackTarget(target)) { - target = SelectNearbyTarget(NULL, 30); + target = SelectNearbyTarget(NULL, 30); if (!target) - { - if (!HasUnitState(UNIT_STATE_FOLLOW)) - GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + { + if (!HasUnitState(UNIT_STATE_FOLLOW)) + GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); return; - } + } - GetMotionMaster()->MoveChase(target, Mages ? 15 : 4); + GetMotionMaster()->MoveChase(target, Mages ? 15 : 4); Attack(target, true); } - else - { - float Distance = GetDistance(target); - uint8 rnd = urand(0,1); + else + { + float Distance = GetDistance(target); + uint8 rnd = urand(0,1); - if (Mages) - { - if ((GetPower(POWER_MANA) * 100 / GetMaxPower(POWER_MANA)) < 10) - { - GetMotionMaster()->MoveChase(target, 4); - return; - } + if (Mages) + { + if ((GetPower(POWER_MANA) * 100 / GetMaxPower(POWER_MANA)) < 10) + { + GetMotionMaster()->MoveChase(target, 4); + return; + } - if (Distance <= 3) - { - if (urand(0,1)) - { - if (m_charmAISpells[SPELL_T_STUN] && !HasSpellCooldown(m_charmAISpells[SPELL_T_STUN])) - CastSpell(target, m_charmAISpells[SPELL_T_STUN], false); - else if (m_charmAISpells[SPELL_ROOT_OR_FEAR] && !HasSpellCooldown(m_charmAISpells[SPELL_ROOT_OR_FEAR])) - CastSpell(target, m_charmAISpells[SPELL_ROOT_OR_FEAR], false); - else if (m_charmAISpells[SPELL_IMMUNITY] && !HasSpellCooldown(m_charmAISpells[SPELL_IMMUNITY])) - CastSpell(this, m_charmAISpells[SPELL_IMMUNITY], true); - } - else - { - switch (urand(0,1)) - { - case 0: - if (m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd] && !HasSpellCooldown(m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd])) - CastSpell(target, m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd], false); - break; - case 1: - if (m_charmAISpells[SPELL_DOT_DAMAGE] && !HasSpellCooldown(m_charmAISpells[SPELL_DOT_DAMAGE])) - CastSpell(target, m_charmAISpells[SPELL_DOT_DAMAGE], false); - break; - } - } - } - else - { - switch (urand(0,2)) - { - case 0: - if (m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd] && !HasSpellCooldown(m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd])) - CastSpell(target, m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd], false); - break; - case 1: - if (m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd] && !HasSpellCooldown(m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd])) - CastSpell(target, m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd], false); - break; - case 2: - if (m_charmAISpells[SPELL_DOT_DAMAGE] && !HasSpellCooldown(m_charmAISpells[SPELL_DOT_DAMAGE])) - CastSpell(target, m_charmAISpells[SPELL_DOT_DAMAGE], false); - break; - } - } - } - else - { - if (Distance > 10) - { - GetMotionMaster()->MoveChase(target, 2.0f); - if (m_charmAISpells[SPELL_T_CHARGE] && !HasSpellCooldown(m_charmAISpells[SPELL_T_CHARGE])) - CastSpell(target, m_charmAISpells[SPELL_T_CHARGE], false); - else if (m_charmAISpells[SPELL_FAST_RUN] && !HasSpellCooldown(m_charmAISpells[SPELL_FAST_RUN])) - CastSpell(this, m_charmAISpells[SPELL_FAST_RUN], false); - } + if (Distance <= 3) + { + if (urand(0,1)) + { + if (m_charmAISpells[SPELL_T_STUN] && !HasSpellCooldown(m_charmAISpells[SPELL_T_STUN])) + CastSpell(target, m_charmAISpells[SPELL_T_STUN], false); + else if (m_charmAISpells[SPELL_ROOT_OR_FEAR] && !HasSpellCooldown(m_charmAISpells[SPELL_ROOT_OR_FEAR])) + CastSpell(target, m_charmAISpells[SPELL_ROOT_OR_FEAR], false); + else if (m_charmAISpells[SPELL_IMMUNITY] && !HasSpellCooldown(m_charmAISpells[SPELL_IMMUNITY])) + CastSpell(this, m_charmAISpells[SPELL_IMMUNITY], true); + } + else + { + switch (urand(0,1)) + { + case 0: + if (m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd] && !HasSpellCooldown(m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd])) + CastSpell(target, m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd], false); + break; + case 1: + if (m_charmAISpells[SPELL_DOT_DAMAGE] && !HasSpellCooldown(m_charmAISpells[SPELL_DOT_DAMAGE])) + CastSpell(target, m_charmAISpells[SPELL_DOT_DAMAGE], false); + break; + } + } + } + else + { + switch (urand(0,2)) + { + case 0: + if (m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd] && !HasSpellCooldown(m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd])) + CastSpell(target, m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd], false); + break; + case 1: + if (m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd] && !HasSpellCooldown(m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd])) + CastSpell(target, m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd], false); + break; + case 2: + if (m_charmAISpells[SPELL_DOT_DAMAGE] && !HasSpellCooldown(m_charmAISpells[SPELL_DOT_DAMAGE])) + CastSpell(target, m_charmAISpells[SPELL_DOT_DAMAGE], false); + break; + } + } + } + else + { + if (Distance > 10) + { + GetMotionMaster()->MoveChase(target, 2.0f); + if (m_charmAISpells[SPELL_T_CHARGE] && !HasSpellCooldown(m_charmAISpells[SPELL_T_CHARGE])) + CastSpell(target, m_charmAISpells[SPELL_T_CHARGE], false); + else if (m_charmAISpells[SPELL_FAST_RUN] && !HasSpellCooldown(m_charmAISpells[SPELL_FAST_RUN])) + CastSpell(this, m_charmAISpells[SPELL_FAST_RUN], false); + } - if (HasUnitState(UNIT_STATE_CASTING)) - return; + if (HasUnitState(UNIT_STATE_CASTING)) + return; - switch (urand(0,2)) - { - case 0: - if (m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd] && !HasSpellCooldown(m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd])) - CastSpell(target, m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd], false); - break; - case 1: - if (m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd] && !HasSpellCooldown(m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd])) - CastSpell(target, m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd], false); - break; - case 2: - if (m_charmAISpells[SPELL_DOT_DAMAGE] && !HasSpellCooldown(m_charmAISpells[SPELL_DOT_DAMAGE])) - CastSpell(target, m_charmAISpells[SPELL_DOT_DAMAGE], false); - break; - } - } - } + switch (urand(0,2)) + { + case 0: + if (m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd] && !HasSpellCooldown(m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd])) + CastSpell(target, m_charmAISpells[SPELL_INSTANT_DAMAGE+rnd], false); + break; + case 1: + if (m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd] && !HasSpellCooldown(m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd])) + CastSpell(target, m_charmAISpells[SPELL_HIGH_DAMAGE1+rnd], false); + break; + case 2: + if (m_charmAISpells[SPELL_DOT_DAMAGE] && !HasSpellCooldown(m_charmAISpells[SPELL_DOT_DAMAGE])) + CastSpell(target, m_charmAISpells[SPELL_DOT_DAMAGE], false); + break; + } + } + } } uint32 Player::GetRuneBaseCooldown(uint8 index, bool skipGrace) @@ -24612,14 +24612,14 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot) return; } - // Xinef: exploit protection, dont allow to loot normal items if player is not master loot - // Xinef: only quest, ffa and conditioned items - if (!IS_ITEM_GUID(GetLootGUID()) && GetGroup() && GetGroup()->GetLootMethod() == MASTER_LOOT && GetGUID() != GetGroup()->GetMasterLooterGuid()) - if (qitem == NULL && ffaitem == NULL && conditem == NULL) - { - SendLootRelease(GetLootGUID()); - return; - } + // Xinef: exploit protection, dont allow to loot normal items if player is not master loot + // Xinef: only quest, ffa and conditioned items + if (!IS_ITEM_GUID(GetLootGUID()) && GetGroup() && GetGroup()->GetLootMethod() == MASTER_LOOT && GetGUID() != GetGroup()->GetMasterLooterGuid()) + if (qitem == NULL && ffaitem == NULL && conditem == NULL) + { + SendLootRelease(GetLootGUID()); + return; + } if (!item->AllowedForPlayer(this)) { @@ -24634,9 +24634,9 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot) return; } - // xinef: dont allow protected item to be looted by someone else - if (item->rollWinnerGUID && item->rollWinnerGUID != GetGUID()) - { + // xinef: dont allow protected item to be looted by someone else + if (item->rollWinnerGUID && item->rollWinnerGUID != GetGUID()) + { SendLootRelease(GetLootGUID()); return; } @@ -24685,7 +24685,7 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot) // LootItem is being removed (looted) from the container, delete it from the DB. if (loot->containerId > 0) - sLootItemStorage->RemoveStoredLootItem(loot->containerId, item->itemid, item->count); + sLootItemStorage->RemoveStoredLootItem(loot->containerId, item->itemid, item->count); } else SendEquipError(msg, NULL, NULL, item->itemid); @@ -24693,7 +24693,7 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot) void Player::UpdateLootAchievements(LootItem *item, Loot* loot) { - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item->itemid, item->count); } @@ -24935,7 +24935,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) int32 safe_fall = GetTotalAuraModifier(SPELL_AURA_SAFE_FALL); float damageperc = 0.018f*(z_diff-safe_fall)-0.2426f; - uint32 original_health = GetHealth(), final_damage = 0; + uint32 original_health = GetHealth(), final_damage = 0; if (damageperc > 0 && !IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_NORMAL)) { @@ -24961,7 +24961,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) ;//sLog->outStaticDebug("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall); } - // recheck alive, might have died of EnvironmentalDamage, avoid cases when player die in fact like Spirit of Redemption case + // recheck alive, might have died of EnvironmentalDamage, avoid cases when player die in fact like Spirit of Redemption case if (IsAlive() && final_damage < original_health) UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING, uint32(z_diff*100)); } @@ -24969,7 +24969,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) void Player::CheckAllAchievementCriteria() { - m_achievementMgr->CheckAllAchievementCriteria(); + m_achievementMgr->CheckAllAchievementCriteria(); } void Player::ResetAchievements() @@ -25016,7 +25016,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) { uint32 CurTalentPoints = GetFreeTalentPoints(); - // xinef: check basic data + // xinef: check basic data if (CurTalentPoints == 0) return; @@ -25039,7 +25039,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) uint32 currentTalentRank = 0; for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) { - if (talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], GetActiveSpec())) + if (talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], GetActiveSpec())) { currentTalentRank = rank+1; break; @@ -25051,43 +25051,43 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) return; // xinef: check if we have enough free talent points - uint32 talentPointsChange = (talentRank - currentTalentRank + 1); + uint32 talentPointsChange = (talentRank - currentTalentRank + 1); if (CurTalentPoints < talentPointsChange) return; // xinef: check if talent deponds on another talent if (talentInfo->DependsOn > 0) if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) - { - bool hasEnoughRank = false; - for (uint8 rank = talentInfo->DependsOnRank; rank < MAX_TALENT_RANK; rank++) - { - if (depTalentInfo->RankID[rank] != 0) - if (HasTalent(depTalentInfo->RankID[rank], GetActiveSpec())) - { - hasEnoughRank = true; - break; - } - } + { + bool hasEnoughRank = false; + for (uint8 rank = talentInfo->DependsOnRank; rank < MAX_TALENT_RANK; rank++) + { + if (depTalentInfo->RankID[rank] != 0) + if (HasTalent(depTalentInfo->RankID[rank], GetActiveSpec())) + { + hasEnoughRank = true; + break; + } + } - // xinef: does not have enough talent points spend in required talent - if (!hasEnoughRank) - return; - } + // xinef: does not have enough talent points spend in required talent + if (!hasEnoughRank) + return; + } // xinef: check amount of points spent in current talent tree - // xinef: be smart and quick, not retarded like TC + // xinef: be smart and quick, not retarded like TC uint32 spentPoints = 0; if (talentInfo->Row > 0) - { - const PlayerTalentMap& talentMap = GetTalentMap(); - for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr) - if (TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first)) - if (TalentEntry const* itrTalentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) - if (itrTalentInfo->TalentTab == talentInfo->TalentTab) - if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec())) // pussywizard - spentPoints += talentPos->rank+1; - } + { + const PlayerTalentMap& talentMap = GetTalentMap(); + for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr) + if (TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first)) + if (TalentEntry const* itrTalentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) + if (itrTalentInfo->TalentTab == talentInfo->TalentTab) + if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec())) // pussywizard + spentPoints += talentPos->rank+1; + } // xinef: we do not have enough talent points to add talent of this tier if (spentPoints < (talentInfo->Row * MAX_TALENT_RANK)) @@ -25098,27 +25098,27 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) if (spellId == 0) return; - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (!spellInfo) - return; + const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId); + if (!spellInfo) + return; - bool learned = false; + bool learned = false; // xinef: if talent info has special marker in dbc - add to spell book - if (talentInfo->addToSpellBook) - if (!spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) - { - learnSpell(spellId); - learned = true; - } + if (talentInfo->addToSpellBook) + if (!spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) + { + learnSpell(spellId); + learned = true; + } - if (!learned) - SendLearnPacket(spellId, true); + if (!learned) + SendLearnPacket(spellId, true); - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL) - if (sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell)) - learnSpell(spellInfo->Effects[i].TriggerSpell); + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL) + if (sSpellMgr->IsAdditionalTalentSpell(spellInfo->Effects[i].TriggerSpell)) + learnSpell(spellInfo->Effects[i].TriggerSpell); addTalent(spellId, GetActiveSpecMask(), currentTalentRank); @@ -25304,7 +25304,7 @@ void Player::ResummonPetTemporaryUnSummonedIfAny() if (!CanResummonPet(GetLastPetSpell())) return; - Pet::LoadPetFromDB(this, PET_LOAD_SUMMON_PET, 0, m_temporaryUnsummonedPetNumber, true); + Pet::LoadPetFromDB(this, PET_LOAD_SUMMON_PET, 0, m_temporaryUnsummonedPetNumber, true); //m_temporaryUnsummonedPetNumber = 0; } @@ -25364,15 +25364,15 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket* data) size_t pos = data->wpos(); *data << uint8(talentIdCount); // [PH], talentIdCount - const PlayerTalentMap& talentMap = GetTalentMap(); - for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr) - if (TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first)) - if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(specIdx)) // pussywizard - { - *data << uint32(talentPos->talent_id); // Talent.dbc - *data << uint8(talentPos->rank); // talentMaxRank (0-4) - ++talentIdCount; - } + const PlayerTalentMap& talentMap = GetTalentMap(); + for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr) + if (TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first)) + if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(specIdx)) // pussywizard + { + *data << uint32(talentPos->talent_id); // Talent.dbc + *data << uint8(talentPos->rank); // talentMaxRank (0-4) + ++talentIdCount; + } data->put(pos, talentIdCount); // put real count @@ -25530,7 +25530,7 @@ void Player::SendEquipmentSetList() if (itr->second.IgnoreMask & (1 << i)) data.appendPackGUID(uint64(1)); else // xinef: send proper data (do not append 0 with high guid) - data.appendPackGUID(itr->second.Items[i] > 0 ? MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM) : uint64(0)); + data.appendPackGUID(itr->second.Items[i] > 0 ? MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM) : uint64(0)); } ++count; // client have limit but it checked at loading and set @@ -25633,10 +25633,10 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans) void Player::_SaveEntryPoint(SQLTransaction& trans) { - // xinef: dont save joinpos with invalid mapid - MapEntry const* mEntry = sMapStore.LookupEntry(m_entryPointData.joinPos.GetMapId()); - if (!mEntry) - return; + // xinef: dont save joinpos with invalid mapid + MapEntry const* mEntry = sMapStore.LookupEntry(m_entryPointData.joinPos.GetMapId()); + if (!mEntry) + return; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_ENTRY_POINT); stmt->setUInt32(0, GetGUIDLow()); @@ -25649,12 +25649,12 @@ void Player::_SaveEntryPoint(SQLTransaction& trans) stmt->setFloat (4, m_entryPointData.joinPos.GetOrientation()); stmt->setUInt32(5, m_entryPointData.joinPos.GetMapId()); - std::ostringstream ss(""); - if (m_entryPointData.HasTaxiPath()) - { - for (size_t i = 0; i < m_entryPointData.taxiPath.size(); ++i) - ss << m_entryPointData.taxiPath[i] << ' '; // xinef: segment is stored as last point - } + std::ostringstream ss(""); + if (m_entryPointData.HasTaxiPath()) + { + for (size_t i = 0; i < m_entryPointData.taxiPath.size(); ++i) + ss << m_entryPointData.taxiPath[i] << ' '; // xinef: segment is stored as last point + } stmt->setString(6, ss.str()); stmt->setUInt32(7, m_entryPointData.mountSpell); @@ -25698,8 +25698,8 @@ void Player::SendClearCooldown(uint32 spell_id, Unit* target) data << uint64(target->GetGUID()); SendDirectMessage(&data); - if (target == this && NeedSendSpectatorData()) - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "RCD", spell_id); + if (target == this && NeedSendSpectatorData()) + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "RCD", spell_id); } void Player::ResetMap() @@ -25850,13 +25850,13 @@ void Player::_SaveCharacter(bool create, SQLTransaction& trans) if (!IsBeingTeleported()) { - Difficulty dd = GetDungeonDifficulty(), rd = GetRaidDifficulty(); - if (Map* m = FindMap()) - if (m->IsDungeon()) - { - if (m->IsNonRaidDungeon()) dd = m->GetDifficulty(); - else rd = m->GetDifficulty(); - } + Difficulty dd = GetDungeonDifficulty(), rd = GetRaidDifficulty(); + if (Map* m = FindMap()) + if (m->IsDungeon()) + { + if (m->IsNonRaidDungeon()) dd = m->GetDifficulty(); + else rd = m->GetDifficulty(); + } stmt->setUInt16(index++, (uint16)GetMapId()); stmt->setUInt32(index++, (uint32)GetInstanceId()); stmt->setUInt8(index++, (uint8(dd) | uint8(rd) << 4)); @@ -25965,7 +25965,7 @@ void Player::_SaveCharacter(bool create, SQLTransaction& trans) stmt->setUInt32(index++, GetGUIDLow()); } - trans->Append(stmt); + trans->Append(stmt); } void Player::_LoadGlyphs(PreparedQueryResult result) @@ -25994,8 +25994,8 @@ void Player::_LoadGlyphs(PreparedQueryResult result) void Player::_SaveGlyphs(SQLTransaction& trans) { - if (!NeedToSaveGlyphs()) - return; + if (!NeedToSaveGlyphs()) + return; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GLYPHS); stmt->setUInt32(0, GetGUIDLow()); @@ -26022,18 +26022,18 @@ void Player::_LoadTalents(PreparedQueryResult result) if (result) { do - { - // xinef: checked - uint32 spellId = (*result)[0].GetUInt32(); - uint8 specMask = (*result)[1].GetUInt8(); + { + // xinef: checked + uint32 spellId = (*result)[0].GetUInt32(); + uint8 specMask = (*result)[1].GetUInt8(); addTalent(spellId, specMask, 0); - TalentSpellPos const* talentPos = GetTalentSpellPos(spellId); - ASSERT(talentPos); + TalentSpellPos const* talentPos = GetTalentSpellPos(spellId); + ASSERT(talentPos); - // xinef: increase used talent points count - if (GetActiveSpecMask() & specMask) - m_usedTalentCount += talentPos->rank+1; - } + // xinef: increase used talent points count + if (GetActiveSpecMask() & specMask) + m_usedTalentCount += talentPos->rank+1; + } while (result->NextRow()); } } @@ -26043,15 +26043,15 @@ void Player::_SaveTalents(SQLTransaction& trans) PreparedStatement* stmt = NULL; for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end();) - { - // xinef: skip temporary spells - if (itr->second->State == PLAYERSPELL_TEMPORARY) - { - ++itr; - continue; - } + { + // xinef: skip temporary spells + if (itr->second->State == PLAYERSPELL_TEMPORARY) + { + ++itr; + continue; + } - // xinef: delete statement for removed / updated talent + // xinef: delete statement for removed / updated talent if (itr->second->State == PLAYERSPELL_REMOVED || itr->second->State == PLAYERSPELL_CHANGED) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT_BY_SPELL); @@ -26060,7 +26060,7 @@ void Player::_SaveTalents(SQLTransaction& trans) trans->Append(stmt); } - // xinef: insert statement for new / updated spell + // xinef: insert statement for new / updated spell if (itr->second->State == PLAYERSPELL_NEW || itr->second->State == PLAYERSPELL_CHANGED) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_TALENT); @@ -26132,18 +26132,18 @@ void Player::UpdateSpecCount(uint8 count) void Player::ActivateSpec(uint8 spec) { - // xinef: some basic checks + // xinef: some basic checks if (GetActiveSpec() == spec) return; if (spec > GetSpecsCount()) return; - // xinef: interrupt currently casted spell just in case + // xinef: interrupt currently casted spell just in case if (IsNonMeleeSpellCast(false)) InterruptNonMeleeSpells(false); - // xinef: save current actions order + // xinef: save current actions order SQLTransaction trans = CharacterDatabase.BeginTransaction(); _SaveActions(trans); CharacterDatabase.CommitTransaction(trans); @@ -26152,31 +26152,31 @@ void Player::ActivateSpec(uint8 spec) if (Pet* pet = GetPet()) RemovePet(pet, PET_SAVE_NOT_IN_SLOT); - // xinef: remove other summoned units and clear reactives + // xinef: remove other summoned units and clear reactives ClearAllReactives(); UnsummonAllTotems(); RemoveAllControlled(); // xinef: let client clear his current Actions SendActionButtons(2); - uint8 oldSpec = GetActiveSpec(); + uint8 oldSpec = GetActiveSpec(); - // xinef: reset talent auras - for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr) - { - if (itr->second->State == PLAYERSPELL_REMOVED) - continue; + // xinef: reset talent auras + for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr) + { + if (itr->second->State == PLAYERSPELL_REMOVED) + continue; - // xinef: remove all active talent auras - if (!(itr->second->specMask & GetActiveSpecMask())) - continue; + // xinef: remove all active talent auras + if (!(itr->second->specMask & GetActiveSpecMask())) + continue; - _removeTalentAurasAndSpells(itr->first); + _removeTalentAurasAndSpells(itr->first); - // pussywizard: was => isn't - if (!itr->second->IsInSpec(spec) && !itr->second->inSpellBook) - SendLearnPacket(itr->first, false); - } + // pussywizard: was => isn't + if (!itr->second->IsInSpec(spec) && !itr->second->inSpellBook) + SendLearnPacket(itr->first, false); + } // xinef: remove glyph auras for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot) @@ -26184,42 +26184,42 @@ void Player::ActivateSpec(uint8 spec) if (GlyphPropertiesEntry const* glyphEntry = sGlyphPropertiesStore.LookupEntry(glyphId)) RemoveAurasDueToSpell(glyphEntry->SpellId); - // xinef: set active spec as new one + // xinef: set active spec as new one SetActiveSpec(spec); uint32 spentTalents = 0; - // xinef: add talent auras - for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr) - { - if (itr->second->State == PLAYERSPELL_REMOVED) - continue; + // xinef: add talent auras + for (PlayerTalentMap::iterator itr = m_talents.begin(); itr != m_talents.end(); ++itr) + { + if (itr->second->State == PLAYERSPELL_REMOVED) + continue; - // xinef: talent not in new spec - if (!(itr->second->specMask & GetActiveSpecMask())) - continue; + // xinef: talent not in new spec + if (!(itr->second->specMask & GetActiveSpecMask())) + continue; - // pussywizard: wasn't => is - if (!itr->second->IsInSpec(oldSpec) && !itr->second->inSpellBook) - SendLearnPacket(itr->first, true); + // pussywizard: wasn't => is + if (!itr->second->IsInSpec(oldSpec) && !itr->second->inSpellBook) + SendLearnPacket(itr->first, true); - _addTalentAurasAndSpells(itr->first); - TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first); - spentTalents += talentPos->rank+1; - } + _addTalentAurasAndSpells(itr->first); + TalentSpellPos const* talentPos = GetTalentSpellPos(itr->first); + spentTalents += talentPos->rank+1; + } - // pussywizard: remove spells that are in previous spec, but are not present in new one (or are in new spec, but not in the old one) - for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) - { - if (!itr->second->Active || itr->second->State == PLAYERSPELL_REMOVED) - continue; + // pussywizard: remove spells that are in previous spec, but are not present in new one (or are in new spec, but not in the old one) + for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) + { + if (!itr->second->Active || itr->second->State == PLAYERSPELL_REMOVED) + continue; - // pussywizard: was => isn't - if (itr->second->IsInSpec(oldSpec) && !itr->second->IsInSpec(spec)) - SendLearnPacket(itr->first, false); - // pussywizard: wasn't => is - else if (!itr->second->IsInSpec(oldSpec) && itr->second->IsInSpec(spec)) - SendLearnPacket(itr->first, true); - } + // pussywizard: was => isn't + if (itr->second->IsInSpec(oldSpec) && !itr->second->IsInSpec(spec)) + SendLearnPacket(itr->first, false); + // pussywizard: wasn't => is + else if (!itr->second->IsInSpec(oldSpec) && itr->second->IsInSpec(spec)) + SendLearnPacket(itr->first, true); + } // xinef: apply glyphs from second spec for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot) @@ -26230,37 +26230,37 @@ void Player::ActivateSpec(uint8 spec) m_usedTalentCount = spentTalents; InitTalentForLevel(); - // xinef: optimization, use callback to read the data + // xinef: optimization, use callback to read the data PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ACTIONS_SPEC); stmt->setUInt32(0, GetGUIDLow()); stmt->setUInt8(1, m_activeSpec); - GetSession()->_loadActionsSwitchSpecCallback = CharacterDatabase.AsyncQuery(stmt); // FutureResult + GetSession()->_loadActionsSwitchSpecCallback = CharacterDatabase.AsyncQuery(stmt); // FutureResult - // xinef: reset power + // xinef: reset power Powers pw = getPowerType(); if (pw != POWER_MANA) SetPower(POWER_MANA, 0); // Mana must be 0 even if it isn't the active power type. SetPower(pw, 0); - // xinef: remove titan grip if player had it set and does not have appropriate talent + // xinef: remove titan grip if player had it set and does not have appropriate talent if (!HasTalent(46917, GetActiveSpec()) && m_canTitanGrip) SetCanTitanGrip(false); - // xinef: remove dual wield if player does not have dual wield spell (shamans) + // xinef: remove dual wield if player does not have dual wield spell (shamans) if (!HasSpell(674) && m_canDualWield) SetCanDualWield(false); AutoUnequipOffhandIfNeed(); - // Xinef: Patch 3.2.0: Switching spec removes paladins spell Righteous Fury (25780) - if (getClass() == CLASS_PALADIN) - RemoveAurasDueToSpell(25780); + // Xinef: Patch 3.2.0: Switching spec removes paladins spell Righteous Fury (25780) + if (getClass() == CLASS_PALADIN) + RemoveAurasDueToSpell(25780); // Xinef: Remove talented single target auras at other targets AuraList& scAuras = GetSingleCastAuras(); for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();) { Aura* aura = *iter; - if (!HasActiveSpell(aura->GetId()) && !HasTalent(aura->GetId(), GetActiveSpec())) + if (!HasActiveSpell(aura->GetId()) && !HasTalent(aura->GetId(), GetActiveSpec())) { aura->Remove(); iter = scAuras.begin(); @@ -26272,60 +26272,60 @@ void Player::ActivateSpec(uint8 spec) void Player::GetTalentTreePoints(uint8 (&specPoints)[3]) const { - const PlayerTalentMap& talentMap = GetTalentMap(); - for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr) - if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec())) - if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID)) - if (TalentTabEntry const* tab = sTalentTabStore.LookupEntry(talentInfo->TalentTab)) - if (tab->tabpage < 3) - { - // find current talent rank - uint8 currentTalentRank = 0; - for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) - if (talentInfo->RankID[rank] && itr->first == talentInfo->RankID[rank]) - { - currentTalentRank = rank+1; - break; - } - specPoints[tab->tabpage] += currentTalentRank; - } + const PlayerTalentMap& talentMap = GetTalentMap(); + for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr) + if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec())) + if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID)) + if (TalentTabEntry const* tab = sTalentTabStore.LookupEntry(talentInfo->TalentTab)) + if (tab->tabpage < 3) + { + // find current talent rank + uint8 currentTalentRank = 0; + for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) + if (talentInfo->RankID[rank] && itr->first == talentInfo->RankID[rank]) + { + currentTalentRank = rank+1; + break; + } + specPoints[tab->tabpage] += currentTalentRank; + } } uint8 Player::GetMostPointsTalentTree() const { - uint32 specPoints[3] = {0, 0, 0}; - const PlayerTalentMap& talentMap = GetTalentMap(); - for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr) - if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec())) - if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID)) - if (TalentTabEntry const* tab = sTalentTabStore.LookupEntry(talentInfo->TalentTab)) - if (tab->tabpage < 3) - { - // find current talent rank - uint8 currentTalentRank = 0; - for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) - if (talentInfo->RankID[rank] && itr->first == talentInfo->RankID[rank]) - { - currentTalentRank = rank+1; - break; - } - specPoints[tab->tabpage] += currentTalentRank; - } - uint8 maxIndex = 0; - uint8 maxCount = specPoints[0]; - for (uint8 i=1; i<3; ++i) - if (specPoints[i] > maxCount) - { - maxIndex = i; - maxCount = specPoints[i]; - } - return maxIndex; + uint32 specPoints[3] = {0, 0, 0}; + const PlayerTalentMap& talentMap = GetTalentMap(); + for (PlayerTalentMap::const_iterator itr = talentMap.begin(); itr != talentMap.end(); ++itr) + if (itr->second->State != PLAYERSPELL_REMOVED && itr->second->IsInSpec(GetActiveSpec())) + if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(itr->second->talentID)) + if (TalentTabEntry const* tab = sTalentTabStore.LookupEntry(talentInfo->TalentTab)) + if (tab->tabpage < 3) + { + // find current talent rank + uint8 currentTalentRank = 0; + for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) + if (talentInfo->RankID[rank] && itr->first == talentInfo->RankID[rank]) + { + currentTalentRank = rank+1; + break; + } + specPoints[tab->tabpage] += currentTalentRank; + } + uint8 maxIndex = 0; + uint8 maxCount = specPoints[0]; + for (uint8 i=1; i<3; ++i) + if (specPoints[i] > maxCount) + { + maxIndex = i; + maxCount = specPoints[i]; + } + return maxIndex; } bool Player::IsHealerTalentSpec() const { - uint8 tree = GetMostPointsTalentTree(); - return (getClass() == CLASS_DRUID && tree == 2 || getClass() == CLASS_PALADIN && tree == 0 || getClass() == CLASS_PRIEST && tree <= 1 || getClass() == CLASS_SHAMAN && tree == 2); + uint8 tree = GetMostPointsTalentTree(); + return (getClass() == CLASS_DRUID && tree == 2 || getClass() == CLASS_PALADIN && tree == 0 || getClass() == CLASS_PRIEST && tree <= 1 || getClass() == CLASS_SHAMAN && tree == 2); } void Player::ResetTimeSync() @@ -26370,149 +26370,149 @@ void Player::SendDuelCountdown(uint32 counter) void Player::SetIsSpectator(bool on) { - if (on) - { - AddAura(SPECTATOR_SPELL_SPEED, this); - m_ExtraFlags |= PLAYER_EXTRA_SPECTATOR_ON; - AddUnitState(UNIT_STATE_ISOLATED); - //setFaction(1100); - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - ResetContestedPvP(); - SetDisplayId(23691); - } - else - { - RemoveAurasDueToSpell(SPECTATOR_SPELL_SPEED); - if (IsSpectator()) - ClearUnitState(UNIT_STATE_ISOLATED); + if (on) + { + AddAura(SPECTATOR_SPELL_SPEED, this); + m_ExtraFlags |= PLAYER_EXTRA_SPECTATOR_ON; + AddUnitState(UNIT_STATE_ISOLATED); + //setFaction(1100); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); + ResetContestedPvP(); + SetDisplayId(23691); + } + else + { + RemoveAurasDueToSpell(SPECTATOR_SPELL_SPEED); + if (IsSpectator()) + ClearUnitState(UNIT_STATE_ISOLATED); m_ExtraFlags &= ~PLAYER_EXTRA_SPECTATOR_ON; - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); RestoreDisplayId(); - if (!IsGameMaster()) - { - //setFactionForRace(getRace()); + if (!IsGameMaster()) + { + //setFactionForRace(getRace()); - // restore FFA PvP Server state - // Xinef: it will be removed if necessery in UpdateArea called in WorldPortOpcode - if (sWorld->IsFFAPvPRealm()) - SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); - } - } + // restore FFA PvP Server state + // Xinef: it will be removed if necessery in UpdateArea called in WorldPortOpcode + if (sWorld->IsFFAPvPRealm()) + SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); + } + } } bool Player::NeedSendSpectatorData() const { - if (FindMap() && FindMap()->IsBattleArena() && !IsSpectator()) - { - Battleground* bg = ((BattlegroundMap*)FindMap())->GetBG(); - if (bg && bg->HaveSpectators() && bg->GetStatus() == STATUS_IN_PROGRESS && !bg->GetPlayers().empty()) - if (bg->GetPlayers().find(GetGUID()) != bg->GetPlayers().end()) - return true; - } - return false; + if (FindMap() && FindMap()->IsBattleArena() && !IsSpectator()) + { + Battleground* bg = ((BattlegroundMap*)FindMap())->GetBG(); + if (bg && bg->HaveSpectators() && bg->GetStatus() == STATUS_IN_PROGRESS && !bg->GetPlayers().empty()) + if (bg->GetPlayers().find(GetGUID()) != bg->GetPlayers().end()) + return true; + } + return false; } void Player::PrepareCharmAISpells() { - for (int i = 0; i < NUM_CAI_SPELLS; ++i) - m_charmAISpells[i] = 0; + for (int i = 0; i < NUM_CAI_SPELLS; ++i) + m_charmAISpells[i] = 0; - uint32 damage_type[4] = {0, 0, 0, 0}; - uint32 stun_duration = 0; - uint32 periodic_damage = 0; - uint32 b = 0; - uint32 temp_spell = 0; - uint32 temp_damage = 0; + uint32 damage_type[4] = {0, 0, 0, 0}; + uint32 stun_duration = 0; + uint32 periodic_damage = 0; + uint32 b = 0; + uint32 temp_spell = 0; + uint32 temp_damage = 0; - for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) + for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) { - if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->Active || !itr->second->IsInSpec(GetActiveSpec())) - continue; + if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->Active || !itr->second->IsInSpec(GetActiveSpec())) + continue; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(itr->first); - if (!spellInfo) - continue; + SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(itr->first); + if (!spellInfo) + continue; - if (!spellInfo->SpellFamilyName || spellInfo->IsPassive() || spellInfo->NeedsComboPoints() || (spellInfo->Stances && !spellInfo->HasAttribute(SPELL_ATTR2_NOT_NEED_SHAPESHIFT))) - continue; + if (!spellInfo->SpellFamilyName || spellInfo->IsPassive() || spellInfo->NeedsComboPoints() || (spellInfo->Stances && !spellInfo->HasAttribute(SPELL_ATTR2_NOT_NEED_SHAPESHIFT))) + continue; - bool allow = false; - uint8 type = 0; - float cast = spellInfo->CalcCastTime() / 1000.0f; - if (cast > 3.0f) - continue; + bool allow = false; + uint8 type = 0; + float cast = spellInfo->CalcCastTime() / 1000.0f; + if (cast > 3.0f) + continue; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - { - if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) - { - int32 dmg = CalculateSpellDamage(this, spellInfo, i); - uint8 offset = 0; - if (cast) - { - dmg = dmg / cast; - offset = 2; - } + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) + { + int32 dmg = CalculateSpellDamage(this, spellInfo, i); + uint8 offset = 0; + if (cast) + { + dmg = dmg / cast; + offset = 2; + } - if ((int32)damage_type[offset] < dmg) - { - if (!m_charmAISpells[SPELL_INSTANT_DAMAGE+offset] || !spellInfo->IsHighRankOf(sSpellMgr->GetSpellInfo(m_charmAISpells[SPELL_INSTANT_DAMAGE+offset])) || urand(0,1)) - if (damage_type[1+offset] < damage_type[offset]) - { - m_charmAISpells[SPELL_INSTANT_DAMAGE2+offset] = m_charmAISpells[SPELL_INSTANT_DAMAGE+offset]; - damage_type[1+offset] = damage_type[offset]; - } + if ((int32)damage_type[offset] < dmg) + { + if (!m_charmAISpells[SPELL_INSTANT_DAMAGE+offset] || !spellInfo->IsHighRankOf(sSpellMgr->GetSpellInfo(m_charmAISpells[SPELL_INSTANT_DAMAGE+offset])) || urand(0,1)) + if (damage_type[1+offset] < damage_type[offset]) + { + m_charmAISpells[SPELL_INSTANT_DAMAGE2+offset] = m_charmAISpells[SPELL_INSTANT_DAMAGE+offset]; + damage_type[1+offset] = damage_type[offset]; + } - m_charmAISpells[SPELL_INSTANT_DAMAGE+offset] = spellInfo->Id; - damage_type[offset] = dmg; - } - else if ((int32)damage_type[1+offset] < dmg) - { - if (m_charmAISpells[SPELL_INSTANT_DAMAGE+offset] && sSpellMgr->GetSpellInfo(m_charmAISpells[SPELL_INSTANT_DAMAGE+offset])->IsHighRankOf(spellInfo) && urand(0,1)) - continue; + m_charmAISpells[SPELL_INSTANT_DAMAGE+offset] = spellInfo->Id; + damage_type[offset] = dmg; + } + else if ((int32)damage_type[1+offset] < dmg) + { + if (m_charmAISpells[SPELL_INSTANT_DAMAGE+offset] && sSpellMgr->GetSpellInfo(m_charmAISpells[SPELL_INSTANT_DAMAGE+offset])->IsHighRankOf(spellInfo) && urand(0,1)) + continue; - m_charmAISpells[SPELL_INSTANT_DAMAGE2+offset] = spellInfo->Id; - damage_type[1+offset] = dmg; - } - break; - } - else if (spellInfo->HasAttribute(SPELL_ATTR7_HAS_CHARGE_EFFECT)) - { - m_charmAISpells[SPELL_T_CHARGE] = spellInfo->Id; - break; - } - else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_SPEED) - { - m_charmAISpells[SPELL_FAST_RUN] = spellInfo->Id; - break; - } - else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY) - { - m_charmAISpells[SPELL_IMMUNITY] = spellInfo->Id; - break; - } - else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE) - { - if( (int32)periodic_damage < CalculateSpellDamage(this, spellInfo, i) ) - { - m_charmAISpells[SPELL_DOT_DAMAGE] = spellInfo->Id; - break; - } - } - else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_STUN) - { - m_charmAISpells[SPELL_T_STUN] = spellInfo->Id; - break; - } - else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_ROOT || spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_FEAR) - { - m_charmAISpells[SPELL_ROOT_OR_FEAR] = spellInfo->Id; - break; - } - } - } + m_charmAISpells[SPELL_INSTANT_DAMAGE2+offset] = spellInfo->Id; + damage_type[1+offset] = dmg; + } + break; + } + else if (spellInfo->HasAttribute(SPELL_ATTR7_HAS_CHARGE_EFFECT)) + { + m_charmAISpells[SPELL_T_CHARGE] = spellInfo->Id; + break; + } + else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_SPEED) + { + m_charmAISpells[SPELL_FAST_RUN] = spellInfo->Id; + break; + } + else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY) + { + m_charmAISpells[SPELL_IMMUNITY] = spellInfo->Id; + break; + } + else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE) + { + if( (int32)periodic_damage < CalculateSpellDamage(this, spellInfo, i) ) + { + m_charmAISpells[SPELL_DOT_DAMAGE] = spellInfo->Id; + break; + } + } + else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_STUN) + { + m_charmAISpells[SPELL_T_STUN] = spellInfo->Id; + break; + } + else if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_ROOT || spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_FEAR) + { + m_charmAISpells[SPELL_ROOT_OR_FEAR] = spellInfo->Id; + break; + } + } + } } void Player::AddRefundReference(uint32 it) @@ -26740,7 +26740,7 @@ float Player::GetAverageItemLevel() ++count; } - return std::max(0.0f, sum/(float)count); + return std::max(0.0f, sum/(float)count); } float Player::GetAverageItemLevelForDF() @@ -26766,7 +26766,7 @@ float Player::GetAverageItemLevelForDF() ++count; } - return std::max(0.0f, sum / (float)count); + return std::max(0.0f, sum / (float)count); } void Player::_LoadInstanceTimeRestrictions(PreparedQueryResult result) @@ -26783,43 +26783,43 @@ void Player::_LoadInstanceTimeRestrictions(PreparedQueryResult result) void Player::_LoadBrewOfTheMonth(PreparedQueryResult result) { - uint32 lastEventId = 0; - if (result) - { + uint32 lastEventId = 0; + if (result) + { Field* fields = result->Fetch(); lastEventId = fields[0].GetUInt32(); - } + } - time_t curtime = time(NULL); - tm localTime; - ACE_OS::localtime_r(&curtime, &localTime); + time_t curtime = time(NULL); + tm localTime; + ACE_OS::localtime_r(&curtime, &localTime); - uint16 month = uint16(localTime.tm_mon); - uint16 eventId = month; - if (eventId < 9) - eventId += 3; - else - eventId -= 9; + uint16 month = uint16(localTime.tm_mon); + uint16 eventId = month; + if (eventId < 9) + eventId += 3; + else + eventId -= 9; - // Brew of the Month October (first in list) - eventId += 34; + // Brew of the Month October (first in list) + eventId += 34; - if (lastEventId != eventId && IsEventActive(eventId) && HasAchieved(2796 /* Brew of the Month*/)) - { - // Send Mail - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - MailSender sender(MAIL_CREATURE, 27487 /*NPC_BREW_OF_THE_MONTH_CLUB*/); - MailDraft draft(uint16(212 + month)); // 212 is starting template id - draft.SendMailTo(trans, MailReceiver(this, GetGUIDLow()), sender); + if (lastEventId != eventId && IsEventActive(eventId) && HasAchieved(2796 /* Brew of the Month*/)) + { + // Send Mail + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + MailSender sender(MAIL_CREATURE, 27487 /*NPC_BREW_OF_THE_MONTH_CLUB*/); + MailDraft draft(uint16(212 + month)); // 212 is starting template id + draft.SendMailTo(trans, MailReceiver(this, GetGUIDLow()), sender); - // Update Event Id - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_BREW_OF_THE_MONTH); - stmt->setUInt32(0, GetGUIDLow()); - stmt->setUInt32(1, uint32(eventId)); - trans->Append(stmt); + // Update Event Id + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_BREW_OF_THE_MONTH); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, uint32(eventId)); + trans->Append(stmt); - CharacterDatabase.CommitTransaction(trans); - } + CharacterDatabase.CommitTransaction(trans); + } } void Player::_SaveInstanceTimeRestrictions(SQLTransaction& trans) @@ -26872,8 +26872,8 @@ bool Player::SetCanFly(bool apply, bool packetOnly /*= false*/) if (!packetOnly && !Unit::SetCanFly(apply)) return false; - if (!apply) - SetFallInformation(time(NULL), GetPositionZ()); + if (!apply) + SetFallInformation(time(NULL), GetPositionZ()); WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12); data.append(GetPackGUID()); @@ -26923,12 +26923,12 @@ bool Player::SetWaterWalking(bool apply, bool packetOnly /*= false*/) bool Player::SetFeatherFall(bool apply, bool packetOnly /*= false*/) { - // Xinef: moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed + // Xinef: moved inside, flag can be removed on landing and wont send appropriate packet to client when aura is removed if (!packetOnly/* && !Unit::SetFeatherFall(apply)*/) - { - Unit::SetFeatherFall(apply); + { + Unit::SetFeatherFall(apply); //return false; - } + } WorldPacket data(apply ? SMSG_MOVE_FEATHER_FALL : SMSG_MOVE_NORMAL_FALL, 12); data.append(GetPackGUID()); @@ -26950,10 +26950,10 @@ Guild* Player::GetGuild() const void Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration, uint32 createdBySpell, uint64 casterGUID, uint8 asynchLoadType) { - Position pos = {x, y, z, ang}; - if (!pos.IsPositionValid()) - return; + Position pos = {x, y, z, ang}; + if (!pos.IsPositionValid()) + return; - AsynchPetSummon* asynchPetInfo = new AsynchPetSummon(entry, pos, petType, duration, createdBySpell, casterGUID); - Pet::LoadPetFromDB(this, asynchLoadType, entry, 0, false, asynchPetInfo); + AsynchPetSummon* asynchPetInfo = new AsynchPetSummon(entry, pos, petType, duration, createdBySpell, casterGUID); + Pet::LoadPetFromDB(this, asynchLoadType, entry, 0, false, asynchPetInfo); } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index e4c73de63..e36a89030 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -100,18 +100,18 @@ enum PlayerSpellState struct PlayerSpell { PlayerSpellState State : 7; // UPPER CASE TO CAUSE CONSOLE ERRORS (CHECK EVERY USAGE)! - bool Active : 1; // UPPER CASE TO CAUSE CONSOLE ERRORS (CHECK EVERY USAGE)! lower rank of a spell are not useable, but learnt - uint8 specMask : 8; - bool IsInSpec(uint8 spec) { return (specMask & (1< SpellCooldowns; @@ -505,9 +505,9 @@ enum PlayerExtraFlags PLAYER_EXTRA_GM_INVISIBLE = 0x0010, PLAYER_EXTRA_GM_CHAT = 0x0020, // Show GM badge in chat messages PLAYER_EXTRA_HAS_310_FLYER = 0x0040, // Marks if player already has 310% speed flying mount - PLAYER_EXTRA_SPECTATOR_ON = 0x0080, // Marks if player is spectactor + PLAYER_EXTRA_SPECTATOR_ON = 0x0080, // Marks if player is spectactor PLAYER_EXTRA_PVP_DEATH = 0x0100, // store PvP death status until corpse creating. - PLAYER_EXTRA_SHOW_DK_PET = 0x0400, // Marks if player should see ghoul on login screen + PLAYER_EXTRA_SHOW_DK_PET = 0x0400, // Marks if player should see ghoul on login screen }; // 2^n values @@ -749,9 +749,9 @@ enum TeleportToOptions TELE_TO_NOT_LEAVE_COMBAT = 0x04, TELE_TO_NOT_UNSUMMON_PET = 0x08, TELE_TO_SPELL = 0x10, - TELE_TO_NOT_LEAVE_VEHICLE = 0x20, - TELE_TO_WITH_PET = 0x40, - TELE_TO_NOT_LEAVE_TAXI = 0x80 + TELE_TO_NOT_LEAVE_VEHICLE = 0x20, + TELE_TO_WITH_PET = 0x40, + TELE_TO_NOT_LEAVE_TAXI = 0x80 }; /// Type of environmental damages @@ -816,8 +816,8 @@ enum PlayerLoginQueryIndex PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES = 30, PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS = 31, PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS = 32, - PLAYER_LOGIN_QUERY_LOAD_MAIL = 33, - PLAYER_LOGIN_QUERY_LOAD_BREW_OF_THE_MONTH = 34, + PLAYER_LOGIN_QUERY_LOAD_MAIL = 33, + PLAYER_LOGIN_QUERY_LOAD_BREW_OF_THE_MONTH = 34, MAX_PLAYER_LOGIN_QUERY, }; @@ -829,23 +829,23 @@ enum PlayerDelayedOperations DELAYED_BG_MOUNT_RESTORE = 0x08, ///< Flag to restore mount state after teleport from BG DELAYED_BG_TAXI_RESTORE = 0x10, ///< Flag to restore taxi state after teleport from BG DELAYED_BG_GROUP_RESTORE = 0x20, ///< Flag to restore group state after teleport from BG - DELAYED_VEHICLE_TELEPORT = 0x40, + DELAYED_VEHICLE_TELEPORT = 0x40, DELAYED_END }; enum PlayerCharmedAISpells { - SPELL_T_STUN, - SPELL_ROOT_OR_FEAR, - SPELL_INSTANT_DAMAGE, - SPELL_INSTANT_DAMAGE2, - SPELL_HIGH_DAMAGE1, - SPELL_HIGH_DAMAGE2, - SPELL_DOT_DAMAGE, - SPELL_T_CHARGE, - SPELL_IMMUNITY, - SPELL_FAST_RUN, - NUM_CAI_SPELLS + SPELL_T_STUN, + SPELL_ROOT_OR_FEAR, + SPELL_INSTANT_DAMAGE, + SPELL_INSTANT_DAMAGE2, + SPELL_HIGH_DAMAGE1, + SPELL_HIGH_DAMAGE2, + SPELL_DOT_DAMAGE, + SPELL_T_CHARGE, + SPELL_IMMUNITY, + SPELL_FAST_RUN, + NUM_CAI_SPELLS }; // Player summoning auto-decline time (in secs) @@ -905,9 +905,9 @@ enum PlayerRestState enum AdditionalSaving { - ADDITIONAL_SAVING_NONE = 0x00, - ADDITIONAL_SAVING_INVENTORY_AND_GOLD = 0x01, - ADDITIONAL_SAVING_QUEST_STATUS = 0x02, + ADDITIONAL_SAVING_NONE = 0x00, + ADDITIONAL_SAVING_INVENTORY_AND_GOLD = 0x01, + ADDITIONAL_SAVING_QUEST_STATUS = 0x02, }; class PlayerTaxi @@ -946,7 +946,7 @@ class PlayerTaxi void ClearTaxiDestinations() { m_TaxiDestinations.clear(); _taxiSegment = 0; } void AddTaxiDestination(uint32 dest) { m_TaxiDestinations.push_back(dest); } uint32 GetTaxiSource() const { return m_TaxiDestinations.size() <= _taxiSegment+1 ? 0 : m_TaxiDestinations[_taxiSegment]; } - uint32 GetTaxiDestination() const { return m_TaxiDestinations.size() <= _taxiSegment+1 ? 0 : m_TaxiDestinations[_taxiSegment+1]; } + uint32 GetTaxiDestination() const { return m_TaxiDestinations.size() <= _taxiSegment+1 ? 0 : m_TaxiDestinations[_taxiSegment+1]; } uint32 GetCurrentTaxiPath() const; uint32 NextTaxiDestination() { @@ -954,9 +954,9 @@ class PlayerTaxi return GetTaxiDestination(); } - // xinef: - void SetTaxiSegment(uint32 segment) { _taxiSegment = segment; } - uint32 GetTaxiSegment() const { return _taxiSegment; } + // xinef: + void SetTaxiSegment(uint32 segment) { _taxiSegment = segment; } + uint32 GetTaxiSegment() const { return _taxiSegment; } std::vector const& GetPath() const { return m_TaxiDestinations; } bool empty() const { return m_TaxiDestinations.empty(); } @@ -965,7 +965,7 @@ class PlayerTaxi private: TaxiMask m_taximask; std::vector m_TaxiDestinations; - uint32 _taxiSegment; + uint32 _taxiSegment; }; std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi); @@ -975,14 +975,14 @@ class Player; // holder for Battleground data (pussywizard: not stored in db) struct BGData { - BGData() : bgInstanceID(0), bgTypeID(BATTLEGROUND_TYPE_NONE), bgTeamId(TEAM_NEUTRAL), bgQueueSlot(PLAYER_MAX_BATTLEGROUND_QUEUES), isInvited(false), bgIsRandom(false), bgAfkReportedCount(0), bgAfkReportedTimer(0) {} + BGData() : bgInstanceID(0), bgTypeID(BATTLEGROUND_TYPE_NONE), bgTeamId(TEAM_NEUTRAL), bgQueueSlot(PLAYER_MAX_BATTLEGROUND_QUEUES), isInvited(false), bgIsRandom(false), bgAfkReportedCount(0), bgAfkReportedTimer(0) {} uint32 bgInstanceID; BattlegroundTypeId bgTypeID; TeamId bgTeamId; - uint32 bgQueueSlot; - bool isInvited; - bool bgIsRandom; + uint32 bgQueueSlot; + bool isInvited; + bool bgIsRandom; std::set bgAfkReporter; uint8 bgAfkReportedCount; @@ -993,12 +993,12 @@ struct BGData struct EntryPointData { EntryPointData() : mountSpell(0) - { - ClearTaxiPath(); - } + { + ClearTaxiPath(); + } uint32 mountSpell; - std::vector taxiPath; + std::vector taxiPath; WorldLocation joinPos; void ClearTaxiPath() { taxiPath.clear(); } @@ -1122,12 +1122,12 @@ class Player : public Unit, public GridObject m_summon_x = x; m_summon_y = y; m_summon_z = z; - m_summon_asSpectator = asSpectator; + m_summon_asSpectator = asSpectator; } - bool IsSummonAsSpectator() const { return m_summon_asSpectator && m_summon_expire >= time(NULL); } - void SetSummonAsSpectator(bool on) { m_summon_asSpectator = on; } + bool IsSummonAsSpectator() const { return m_summon_asSpectator && m_summon_expire >= time(NULL); } + void SetSummonAsSpectator(bool on) { m_summon_asSpectator = on; } void SummonIfPossible(bool agree); - time_t GetSummonExpireTimer() const { return m_summon_expire; } + time_t GetSummonExpireTimer() const { return m_summon_expire; } bool Create(uint32 guidlow, CharacterCreateInfo* createInfo); @@ -1278,7 +1278,7 @@ class Player : public Unit, public GridObject InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading = true) const; InventoryResult CanUseItem(Item* pItem, bool not_loading = true) const; bool HasItemTotemCategory(uint32 TotemCategory) const; - bool IsTotemCategoryCompatiableWith(const ItemTemplate* pProto, uint32 requiredTotemCategoryId) const; + bool IsTotemCategoryCompatiableWith(const ItemTemplate* pProto, uint32 requiredTotemCategoryId) const; InventoryResult CanUseItem(ItemTemplate const* pItem) const; InventoryResult CanUseAmmo(uint32 item) const; InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const; @@ -1292,8 +1292,8 @@ class Player : public Unit, public GridObject void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false); void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, broadcast); } void StoreLootItem(uint8 lootSlot, Loot* loot); - void UpdateLootAchievements(LootItem *item, Loot* loot); - void UpdateTitansGrip(); + void UpdateLootAchievements(LootItem *item, Loot* loot); + void UpdateTitansGrip(); InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const; InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const; @@ -1667,7 +1667,7 @@ class Player : public Unit, public GridObject void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask); void SendInitialSpells(); - void SendLearnPacket(uint32 spellId, bool learn); + void SendLearnPacket(uint32 spellId, bool learn); bool addSpell(uint32 spellId, uint8 addSpecMask, bool updateActive, bool temporary = false); bool _addSpell(uint32 spellId, uint8 addSpecMask, bool temporary); void learnSpell(uint32 spellId); @@ -1692,10 +1692,10 @@ class Player : public Unit, public GridObject void LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank); bool addTalent(uint32 spellId, uint8 addSpecMask, uint8 oldTalentRank); - void _removeTalent(PlayerTalentMap::iterator& itr, uint8 specMask); - void _removeTalent(uint32 spellId, uint8 specMask); - void _removeTalentAurasAndSpells(uint32 spellId); - void _addTalentAurasAndSpells(uint32 spellId); + void _removeTalent(PlayerTalentMap::iterator& itr, uint8 specMask); + void _removeTalent(uint32 spellId, uint8 specMask); + void _removeTalentAurasAndSpells(uint32 spellId); + void _addTalentAurasAndSpells(uint32 spellId); bool HasTalent(uint32 spell_id, uint8 spec) const; uint32 CalculateTalentsPoints() const; @@ -1708,9 +1708,9 @@ class Player : public Unit, public GridObject uint8 GetSpecsCount() const { return m_specsCount; } void SetSpecsCount(uint8 count) { m_specsCount = count; } void ActivateSpec(uint8 spec); - void GetTalentTreePoints(uint8 (&specPoints)[3]) const; - uint8 GetMostPointsTalentTree() const; - bool IsHealerTalentSpec() const; + void GetTalentTreePoints(uint8 (&specPoints)[3]) const; + uint8 GetMostPointsTalentTree() const; + bool IsHealerTalentSpec() const; void InitGlyphsForLevel(); void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); } @@ -1720,8 +1720,8 @@ class Player : public Unit, public GridObject m_Glyphs[m_activeSpec][slot] = glyph; SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, glyph); - if (save) - SetNeedToSaveGlyphs(true); + if (save) + SetNeedToSaveGlyphs(true); } uint32 GetGlyph(uint8 slot) const { return m_Glyphs[m_activeSpec][slot]; } @@ -1737,7 +1737,7 @@ class Player : public Unit, public GridObject void AddSpellMod(SpellModifier* mod, bool apply); bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = NULL); - bool HasSpellMod(SpellModifier* mod, Spell* spell); + bool HasSpellMod(SpellModifier* mod, Spell* spell); template T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = NULL, bool temporaryPet = false); void RemoveSpellMods(Spell* spell); void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = NULL); @@ -1817,17 +1817,17 @@ class Player : public Unit, public GridObject void SetPvP(bool state) { Unit::SetPvP(state); - if (!m_Controlled.empty()) - for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) - (*itr)->SetPvP(state); + if (!m_Controlled.empty()) + for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) + (*itr)->SetPvP(state); } void UpdatePvP(bool state, bool _override=false); void UpdateZone(uint32 newZone, uint32 newArea); void UpdateArea(uint32 newArea); - uint32 GetZoneId(bool forceRecalc = false) const; - uint32 GetAreaId(bool forceRecalc = false) const; - void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, bool forceRecalc = false) const; + uint32 GetZoneId(bool forceRecalc = false) const; + uint32 GetAreaId(bool forceRecalc = false) const; + void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, bool forceRecalc = false) const; void UpdateZoneDependentAuras(uint32 zone_id); // zones void UpdateAreaDependentAuras(uint32 area_id); // subzones @@ -1859,11 +1859,11 @@ class Player : public Unit, public GridObject void SendUpdateToOutOfRangeGroupMembers(); void SetInGuild(uint32 GuildId) - { - SetUInt32Value(PLAYER_GUILDID, GuildId); - // xinef: update global storage - sWorld->UpdateGlobalPlayerGuild(GetGUIDLow(), GuildId); - } + { + SetUInt32Value(PLAYER_GUILDID, GuildId); + // xinef: update global storage + sWorld->UpdateGlobalPlayerGuild(GetGUIDLow(), GuildId); + } void SetRank(uint8 rankId) { SetUInt32Value(PLAYER_GUILDRANK, rankId); } uint8 GetRank() const { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); } void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; } @@ -1999,7 +1999,7 @@ class Player : public Unit, public GridObject void SendMessageToSet(WorldPacket* data, bool self) { SendMessageToSetInRange(data, GetVisibilityRange(), self, true); } // pussywizard! void SendMessageToSetInRange(WorldPacket* data, float dist, bool self, bool includeMargin = false, Player const* skipped_rcvr = NULL); // pussywizard! void SendMessageToSetInRange_OwnTeam(WorldPacket* data, float dist, bool self); // pussywizard! param includeMargin not needed here - void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr) { SendMessageToSetInRange(data, GetVisibilityRange(), skipped_rcvr != this, true, skipped_rcvr); } // pussywizard! + void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr) { SendMessageToSetInRange(data, GetVisibilityRange(), skipped_rcvr != this, true, skipped_rcvr); } // pussywizard! void SendTeleportAckPacket(); @@ -2064,8 +2064,8 @@ class Player : public Unit, public GridObject time_t GetSemaphoreTeleportNear() const { return mSemaphoreTeleport_Near; } time_t GetSemaphoreTeleportFar() const { return mSemaphoreTeleport_Far; } void ProcessDelayedOperations(); - uint32 GetDelayedOperations() const { return m_DelayedOperations; } - void ScheduleDelayedOperation(uint32 operation) + uint32 GetDelayedOperations() const { return m_DelayedOperations; } + void ScheduleDelayedOperation(uint32 operation) { if (operation < DELAYED_END) m_DelayedOperations |= operation; @@ -2200,9 +2200,9 @@ class Player : public Unit, public GridObject bool InArena() const; uint32 GetBattlegroundId() const { return m_bgData.bgInstanceID; } BattlegroundTypeId GetBattlegroundTypeId() const { return m_bgData.bgTypeID; } - uint32 GetCurrentBattlegroundQueueSlot() const { return m_bgData.bgQueueSlot; } + uint32 GetCurrentBattlegroundQueueSlot() const { return m_bgData.bgQueueSlot; } bool IsInvitedForBattlegroundInstance() const { return m_bgData.isInvited; } - bool IsCurrentBattlegroundRandom() const { return m_bgData.bgIsRandom; } + bool IsCurrentBattlegroundRandom() const { return m_bgData.bgIsRandom; } Battleground* GetBattleground(bool create = false) const; bool InBattlegroundQueue() const @@ -2259,7 +2259,7 @@ class Player : public Unit, public GridObject } } - TeamId GetBgTeamId() const { return m_bgData.bgTeamId != TEAM_NEUTRAL ? m_bgData.bgTeamId : GetTeamId(); } + TeamId GetBgTeamId() const { return m_bgData.bgTeamId != TEAM_NEUTRAL ? m_bgData.bgTeamId : GetTeamId(); } void LeaveBattleground(Battleground* bg = NULL); bool CanJoinToBattleground() const; @@ -2304,7 +2304,7 @@ class Player : public Unit, public GridObject void UpdateFallInformationIfNeed(MovementInfo const& minfo, uint16 opcode); SafeUnitPointer m_mover; WorldObject* m_seer; - std::set m_isInSharedVisionOf; + std::set m_isInSharedVisionOf; void SetFallInformation(uint32 time, float z) { m_lastFallTime = time; @@ -2420,8 +2420,8 @@ class Player : public Unit, public GridObject // last used pet number (for BG's) uint32 GetLastPetNumber() const { return m_lastpetnumber; } void SetLastPetNumber(uint32 petnumber) { m_lastpetnumber = petnumber; } - uint32 GetLastPetSpell() const { return m_oldpetspell; } - void SetLastPetSpell(uint32 petspell) { m_oldpetspell = petspell; } + uint32 GetLastPetSpell() const { return m_oldpetspell; } + void SetLastPetSpell(uint32 petspell) { m_oldpetspell = petspell; } /*********************************************************/ /*** GROUP SYSTEM ***/ @@ -2555,44 +2555,44 @@ class Player : public Unit, public GridObject } // OURS - // saving - void AdditionalSavingAddMask(uint8 mask) { m_additionalSaveTimer = 2000; m_additionalSaveMask |= mask; } - // arena spectator - bool IsSpectator() const { return m_ExtraFlags & PLAYER_EXTRA_SPECTATOR_ON; } - void SetIsSpectator(bool on); - bool NeedSendSpectatorData() const; - void SetPendingSpectatorForBG(uint32 bgInstanceId) { m_pendingSpectatorForBG = bgInstanceId; } - bool HasPendingSpectatorForBG(uint32 bgInstanceId) const { return m_pendingSpectatorForBG == bgInstanceId; } - void SetPendingSpectatorInviteInstanceId(uint32 bgInstanceId) { m_pendingSpectatorInviteInstanceId = bgInstanceId; } - uint32 GetPendingSpectatorInviteInstanceId() const { return m_pendingSpectatorInviteInstanceId; } - bool HasReceivedSpectatorResetFor(uint32 guid) { return m_receivedSpectatorResetFor.find(guid) != m_receivedSpectatorResetFor.end(); } - void ClearReceivedSpectatorResetFor() { m_receivedSpectatorResetFor.clear(); } - void AddReceivedSpectatorResetFor(uint32 guid) { m_receivedSpectatorResetFor.insert(guid); } - void RemoveReceivedSpectatorResetFor(uint32 guid) { m_receivedSpectatorResetFor.erase(guid); } - uint32 m_pendingSpectatorForBG; - uint32 m_pendingSpectatorInviteInstanceId; - std::set m_receivedSpectatorResetFor; + // saving + void AdditionalSavingAddMask(uint8 mask) { m_additionalSaveTimer = 2000; m_additionalSaveMask |= mask; } + // arena spectator + bool IsSpectator() const { return m_ExtraFlags & PLAYER_EXTRA_SPECTATOR_ON; } + void SetIsSpectator(bool on); + bool NeedSendSpectatorData() const; + void SetPendingSpectatorForBG(uint32 bgInstanceId) { m_pendingSpectatorForBG = bgInstanceId; } + bool HasPendingSpectatorForBG(uint32 bgInstanceId) const { return m_pendingSpectatorForBG == bgInstanceId; } + void SetPendingSpectatorInviteInstanceId(uint32 bgInstanceId) { m_pendingSpectatorInviteInstanceId = bgInstanceId; } + uint32 GetPendingSpectatorInviteInstanceId() const { return m_pendingSpectatorInviteInstanceId; } + bool HasReceivedSpectatorResetFor(uint32 guid) { return m_receivedSpectatorResetFor.find(guid) != m_receivedSpectatorResetFor.end(); } + void ClearReceivedSpectatorResetFor() { m_receivedSpectatorResetFor.clear(); } + void AddReceivedSpectatorResetFor(uint32 guid) { m_receivedSpectatorResetFor.insert(guid); } + void RemoveReceivedSpectatorResetFor(uint32 guid) { m_receivedSpectatorResetFor.erase(guid); } + uint32 m_pendingSpectatorForBG; + uint32 m_pendingSpectatorInviteInstanceId; + std::set m_receivedSpectatorResetFor; - bool CanSeeDKPet() const { return m_ExtraFlags & PLAYER_EXTRA_SHOW_DK_PET; } - void SetShowDKPet(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_SHOW_DK_PET; else m_ExtraFlags &= ~PLAYER_EXTRA_SHOW_DK_PET; }; - void PrepareCharmAISpells(); - uint32 m_charmUpdateTimer; + bool CanSeeDKPet() const { return m_ExtraFlags & PLAYER_EXTRA_SHOW_DK_PET; } + void SetShowDKPet(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_SHOW_DK_PET; else m_ExtraFlags &= ~PLAYER_EXTRA_SHOW_DK_PET; }; + void PrepareCharmAISpells(); + uint32 m_charmUpdateTimer; - int8 GetComboPointGain() { return m_comboPointGain; } - void SetComboPointGain(int8 combo) { m_comboPointGain = combo; } + int8 GetComboPointGain() { return m_comboPointGain; } + void SetComboPointGain(int8 combo) { m_comboPointGain = combo; } - bool NeedToSaveGlyphs() { return m_NeedToSaveGlyphs; } - void SetNeedToSaveGlyphs(bool val) { m_NeedToSaveGlyphs = val; } + bool NeedToSaveGlyphs() { return m_NeedToSaveGlyphs; } + void SetNeedToSaveGlyphs(bool val) { m_NeedToSaveGlyphs = val; } - uint32 GetMountBlockId() { return m_MountBlockId; } - void SetMountBlockId(uint32 mount) { m_MountBlockId = mount; } + uint32 GetMountBlockId() { return m_MountBlockId; } + void SetMountBlockId(uint32 mount) { m_MountBlockId = mount; } - float GetRealParry() const { return m_realParry; } - float GetRealDodge() const { return m_realDodge; } - // mt maps - const PlayerTalentMap& GetTalentMap() const { return m_talents; } - uint32 GetNextSave() const { return m_nextSave; } - SpellModList const& GetSpellModList(uint32 type) const { return m_spellMods[type]; } + float GetRealParry() const { return m_realParry; } + float GetRealDodge() const { return m_realDodge; } + // mt maps + const PlayerTalentMap& GetTalentMap() const { return m_talents; } + uint32 GetNextSave() const { return m_nextSave; } + SpellModList const& GetSpellModList(uint32 type) const { return m_spellMods[type]; } protected: // Gamemaster whisper whitelist @@ -2600,15 +2600,15 @@ class Player : public Unit, public GridObject // Combo Points int8 m_comboPointGain; - // Performance Varibales - bool m_NeedToSaveGlyphs; - // Mount block bug - uint32 m_MountBlockId; - // Real stats - float m_realDodge; - float m_realParry; + // Performance Varibales + bool m_NeedToSaveGlyphs; + // Mount block bug + uint32 m_MountBlockId; + // Real stats + float m_realDodge; + float m_realParry; - uint32 m_charmAISpells[NUM_CAI_SPELLS]; + uint32 m_charmAISpells[NUM_CAI_SPELLS]; uint32 m_AreaID; uint32 m_regenTimerCount; @@ -2654,7 +2654,7 @@ class Player : public Unit, public GridObject void _LoadGlyphAuras(); void _LoadInventory(PreparedQueryResult result, uint32 timeDiff); void _LoadMailInit(PreparedQueryResult resultUnread, PreparedQueryResult resultDelivery); - void _LoadMailAsynch(PreparedQueryResult result); + void _LoadMailAsynch(PreparedQueryResult result); void _LoadMail(); void _LoadMailedItems(Mail* mail); void _LoadQuestStatus(PreparedQueryResult result); @@ -2698,7 +2698,7 @@ class Player : public Unit, public GridObject void _SaveGlyphs(SQLTransaction& trans); void _SaveTalents(SQLTransaction& trans); void _SaveStats(SQLTransaction& trans); - void _SaveCharacter(bool create, SQLTransaction& trans); + void _SaveCharacter(bool create, SQLTransaction& trans); void _SaveInstanceTimeRestrictions(SQLTransaction& trans); /*********************************************************/ @@ -2782,7 +2782,7 @@ class Player : public Unit, public GridObject EnchantDurationList m_enchantDuration; ItemDurationList m_itemDuration; ItemDurationList m_itemSoulboundTradeable; - ACE_Thread_Mutex m_soulboundTradableLock; + ACE_Thread_Mutex m_soulboundTradableLock; void ResetTimeSync(); void SendTimeSync(); @@ -2855,7 +2855,7 @@ class Player : public Unit, public GridObject float m_summon_x; float m_summon_y; float m_summon_z; - bool m_summon_asSpectator; + bool m_summon_asSpectator; DeclinedName *m_declinedname; Runes *m_runes; @@ -2962,18 +2962,18 @@ template T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas if (!IsAffectedBySpellmod(spellInfo, mod, spell)) continue; - // xinef: temporary pets cannot use charged mods of owner, needed for mirror image QQ they should use their own auras - if (temporaryPet && mod->charges != 0) - continue; + // xinef: temporary pets cannot use charged mods of owner, needed for mirror image QQ they should use their own auras + if (temporaryPet && mod->charges != 0) + continue; if (mod->type == SPELLMOD_FLAT) - { - // xinef: do not allow to consume more than one 100% crit increasing spell - if (mod->op == SPELLMOD_CRITICAL_CHANCE && totalflat >= 100) - continue; + { + // xinef: do not allow to consume more than one 100% crit increasing spell + if (mod->op == SPELLMOD_CRITICAL_CHANCE && totalflat >= 100) + continue; totalflat += mod->value; - } + } else if (mod->type == SPELLMOD_PCT) { // skip percent mods for null basevalue (most important for spell mods with charges) @@ -2983,27 +2983,27 @@ template T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas // special case (skip > 10sec spell casts for instant cast setting) if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100) continue; - // xinef: special exception for surge of light, dont affect crit chance if previous mods were not applied - else if (mod->op == SPELLMOD_CRITICAL_CHANCE && spell && !HasSpellMod(mod, spell)) - continue; - // xinef: special case for backdraft gcd reduce with backlast time reduction, dont affect gcd if cast time was not applied - else if (mod->op == SPELLMOD_GLOBAL_COOLDOWN && spell && !HasSpellMod(mod, spell)) - continue; + // xinef: special exception for surge of light, dont affect crit chance if previous mods were not applied + else if (mod->op == SPELLMOD_CRITICAL_CHANCE && spell && !HasSpellMod(mod, spell)) + continue; + // xinef: special case for backdraft gcd reduce with backlast time reduction, dont affect gcd if cast time was not applied + else if (mod->op == SPELLMOD_GLOBAL_COOLDOWN && spell && !HasSpellMod(mod, spell)) + continue; - // xinef: those two mods should be multiplicative (Glyph of Renew) - if (mod->op == SPELLMOD_DAMAGE || mod->op == SPELLMOD_DOT) - totalmul *= CalculatePct(1.0f, 100.0f+mod->value); - else - totalmul += CalculatePct(1.0f, mod->value); + // xinef: those two mods should be multiplicative (Glyph of Renew) + if (mod->op == SPELLMOD_DAMAGE || mod->op == SPELLMOD_DOT) + totalmul *= CalculatePct(1.0f, 100.0f+mod->value); + else + totalmul += CalculatePct(1.0f, mod->value); } DropModCharge(mod, spell); } float diff = 0.0f; - if (op == SPELLMOD_CASTING_TIME || op == SPELLMOD_DURATION) - diff = ((float)basevalue + totalflat) * (totalmul - 1.0f) + (float)totalflat; - else - diff = (float)basevalue * (totalmul - 1.0f) + (float)totalflat; + if (op == SPELLMOD_CASTING_TIME || op == SPELLMOD_DURATION) + diff = ((float)basevalue + totalflat) * (totalmul - 1.0f) + (float)totalflat; + else + diff = (float)basevalue * (totalmul - 1.0f) + (float)totalflat; basevalue = T((float)basevalue + diff); return T(diff); } diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index 1616c70e0..0cb2b0fd5 100644 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -222,7 +222,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri TeamId teamId = player->GetTeamId(); AccountTypes security = player->GetSession()->GetSecurity(); - bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); + bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); AccountTypes gmLevelInWhoList = AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST)); PlayerSocialMap::iterator itr = player->GetSocial()->m_playerSocialMap.find(friendGUID); @@ -231,7 +231,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all - if (pFriend && (!AccountMgr::IsPlayerAccount(security) || ((pFriend->GetTeamId() == teamId || allowTwoSideWhoList) && pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList)) && pFriend->IsVisibleGloballyFor(player)) + if (pFriend && (!AccountMgr::IsPlayerAccount(security) || ((pFriend->GetTeamId() == teamId || allowTwoSideWhoList) && pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList)) && pFriend->IsVisibleGloballyFor(player)) { friendInfo.Status = FRIEND_STATUS_ONLINE; if (pFriend->isAFK()) @@ -294,8 +294,8 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet) TeamId teamId = player->GetTeamId(); AccountTypes security = player->GetSession()->GetSecurity(); - uint32 guid = player->GetGUIDLow(); - bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); + uint32 guid = player->GetGUIDLow(); + bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); AccountTypes gmLevelInWhoList = AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST)); for (SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr) @@ -307,7 +307,7 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet) // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all - if (pFriend && (!AccountMgr::IsPlayerAccount(pFriend->GetSession()->GetSecurity()) || ((pFriend->GetTeamId() == teamId || allowTwoSideWhoList) && security <= gmLevelInWhoList)) && player->IsVisibleGloballyFor(pFriend)) + if (pFriend && (!AccountMgr::IsPlayerAccount(pFriend->GetSession()->GetSecurity()) || ((pFriend->GetTeamId() == teamId || allowTwoSideWhoList) && security <= gmLevelInWhoList)) && player->IsVisibleGloballyFor(pFriend)) pFriend->GetSession()->SendPacket(packet); } } diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index 05ff6016c..0a5a3f3c9 100644 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -56,24 +56,24 @@ void Totem::Update(uint32 time) void Totem::InitStats(uint32 duration) { // client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem - // Xinef: Set level for Unit totems - if (Unit* owner = ObjectAccessor::FindUnit(m_owner)) - { - if (owner->GetTypeId() == TYPEID_PLAYER && m_Properties->Slot >= SUMMON_SLOT_TOTEM && m_Properties->Slot < MAX_TOTEM_SLOT) - { - WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4); - data << uint8(m_Properties->Slot - 1); - data << uint64(GetGUID()); - data << uint32(duration); - data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL)); - owner->ToPlayer()->SendDirectMessage(&data); + // Xinef: Set level for Unit totems + if (Unit* owner = ObjectAccessor::FindUnit(m_owner)) + { + if (owner->GetTypeId() == TYPEID_PLAYER && m_Properties->Slot >= SUMMON_SLOT_TOTEM && m_Properties->Slot < MAX_TOTEM_SLOT) + { + WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4); + data << uint8(m_Properties->Slot - 1); + data << uint64(GetGUID()); + data << uint32(duration); + data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL)); + owner->ToPlayer()->SendDirectMessage(&data); - // set display id depending on caster's race - SetDisplayId(owner->GetModelForTotem(PlayerTotemType(m_Properties->Id))); - } + // set display id depending on caster's race + SetDisplayId(owner->GetModelForTotem(PlayerTotemType(m_Properties->Id))); + } - SetLevel(owner->getLevel()); - } + SetLevel(owner->getLevel()); + } Minion::InitStats(duration); @@ -95,14 +95,14 @@ void Totem::InitSummon() if(GetSpell(1)) CastSpell(this, GetSpell(1), true); - // xinef: this is better than the script, 100% sure to work + // xinef: this is better than the script, 100% sure to work if(GetEntry() == SENTRY_TOTEM_ENTRY) - { + { SetReactState(REACT_AGGRESSIVE); - GetOwner()->CastSpell(this, 6277, true); - } + GetOwner()->CastSpell(this, 6277, true); + } - this->GetMotionMaster()->MoveFall(); + this->GetMotionMaster()->MoveFall(); } void Totem::UnSummon(uint32 msTime) @@ -116,7 +116,7 @@ void Totem::UnSummon(uint32 msTime) CombatStop(); RemoveAurasDueToSpell(GetSpell(), GetGUID()); - Unit *m_owner = GetOwner(); + Unit *m_owner = GetOwner(); // clear owner's totem slot for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) { @@ -146,7 +146,7 @@ void Totem::UnSummon(uint32 msTime) for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* target = itr->GetSource(); - if (target && target->IsInMap(owner) && group->SameSubGroup(owner, target)) + if (target && target->IsInMap(owner) && group->SameSubGroup(owner, target)) target->RemoveAurasDueToSpell(GetSpell(), GetGUID()); } } @@ -157,13 +157,13 @@ void Totem::UnSummon(uint32 msTime) bool Totem::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const { - // xinef: immune to all positive spells, except of stoneclaw totem absorb and sentry totem bind sight - // totems positive spells have unit_caster target - if (spellInfo->Effects[index].Effect != SPELL_EFFECT_DUMMY && - spellInfo->Effects[index].Effect != SPELL_EFFECT_SCRIPT_EFFECT && - spellInfo->IsPositive() && spellInfo->Effects[index].TargetA.GetTarget() != TARGET_UNIT_CASTER && - spellInfo->Effects[index].TargetA.GetCheckType() != TARGET_CHECK_ENTRY && spellInfo->Id != 55277 && spellInfo->Id != 6277) - return true; + // xinef: immune to all positive spells, except of stoneclaw totem absorb and sentry totem bind sight + // totems positive spells have unit_caster target + if (spellInfo->Effects[index].Effect != SPELL_EFFECT_DUMMY && + spellInfo->Effects[index].Effect != SPELL_EFFECT_SCRIPT_EFFECT && + spellInfo->IsPositive() && spellInfo->Effects[index].TargetA.GetTarget() != TARGET_UNIT_CASTER && + spellInfo->Effects[index].TargetA.GetCheckType() != TARGET_CHECK_ENTRY && spellInfo->Id != 55277 && spellInfo->Id != 6277) + return true; switch (spellInfo->Effects[index].ApplyAuraName) { diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 06fcf9cd8..1d86a2640 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -94,9 +94,9 @@ bool MotionTransport::CreateMoTrans(uint32 guidlow, uint32 entry, uint32 mapid, SetGoAnimProgress(animprogress); SetName(goinfo->name); - // pussywizard: no WorldRotation for MotionTransports - SetWorldRotation(G3D::Quat()); - // pussywizard: no PathRotation for MotionTransports + // pussywizard: no WorldRotation for MotionTransports + SetWorldRotation(G3D::Quat()); + // pussywizard: no PathRotation for MotionTransports SetTransportPathRotation(0.0f, 0.0f, 0.0f, 1.0f); m_model = GameObjectModel::Create(*this); @@ -258,47 +258,47 @@ void MotionTransport::UpdatePosition(float x, float y, float z, float o) void MotionTransport::AddPassenger(WorldObject* passenger, bool withAll) { - TRINITY_GUARD(ACE_Thread_Mutex, Lock); + TRINITY_GUARD(ACE_Thread_Mutex, Lock); if (_passengers.insert(passenger).second) { if (Player* plr = passenger->ToPlayer()) - sScriptMgr->OnAddPassenger(ToTransport(), plr); + sScriptMgr->OnAddPassenger(ToTransport(), plr); - if (withAll) - { - if (Transport* t = passenger->GetTransport()) // SHOULD NEVER HAPPEN - t->RemovePassenger(passenger, false); + if (withAll) + { + if (Transport* t = passenger->GetTransport()) // SHOULD NEVER HAPPEN + t->RemovePassenger(passenger, false); - float x, y, z, o; - passenger->GetPosition(x, y, z, o); - CalculatePassengerOffset(x, y, z, &o); + float x, y, z, o; + passenger->GetPosition(x, y, z, o); + CalculatePassengerOffset(x, y, z, &o); - passenger->SetTransport(this); - passenger->m_movementInfo.flags |= MOVEMENTFLAG_ONTRANSPORT; - passenger->m_movementInfo.transport.guid = GetGUID(); - passenger->m_movementInfo.transport.pos.Relocate(x, y, z, o); - } + passenger->SetTransport(this); + passenger->m_movementInfo.flags |= MOVEMENTFLAG_ONTRANSPORT; + passenger->m_movementInfo.transport.guid = GetGUID(); + passenger->m_movementInfo.transport.pos.Relocate(x, y, z, o); + } } } void MotionTransport::RemovePassenger(WorldObject* passenger, bool withAll) { - TRINITY_GUARD(ACE_Thread_Mutex, Lock); + TRINITY_GUARD(ACE_Thread_Mutex, Lock); if (_passengers.erase(passenger) || _staticPassengers.erase(passenger)) { if (Player* plr = passenger->ToPlayer()) - { + { sScriptMgr->OnRemovePassenger(ToTransport(), plr); - plr->SetFallInformation(time(NULL), plr->GetPositionZ()); - } + plr->SetFallInformation(time(NULL), plr->GetPositionZ()); + } - if (withAll) - { - passenger->SetTransport(NULL); - passenger->m_movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; - passenger->m_movementInfo.transport.guid = 0; - passenger->m_movementInfo.transport.pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); - } + if (withAll) + { + passenger->SetTransport(NULL); + passenger->m_movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; + passenger->m_movementInfo.transport.guid = 0; + passenger->m_movementInfo.transport.pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); + } } } @@ -333,7 +333,7 @@ Creature* MotionTransport::CreateNPCPassenger(uint32 guid, CreatureData const* d if (!creature->IsPositionValid()) { - sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)",creature->GetGUIDLow(),creature->GetEntry(),creature->GetPositionX(),creature->GetPositionY()); + sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)",creature->GetGUIDLow(),creature->GetEntry(),creature->GetPositionX(),creature->GetPositionY()); delete creature; return NULL; } @@ -391,9 +391,9 @@ GameObject* MotionTransport::CreateGOPassenger(uint32 guid, GameObjectData const void MotionTransport::LoadStaticPassengers() { - if (PassengersLoaded()) - return; - SetPassengersLoaded(true); + if (PassengersLoaded()) + return; + SetPassengersLoaded(true); if (uint32 mapId = GetGOInfo()->moTransport.mapID) { CellObjectGuidsMap const& cells = sObjectMgr->GetMapObjectGuids(mapId, GetMap()->GetSpawnMode()); @@ -415,7 +415,7 @@ void MotionTransport::LoadStaticPassengers() void MotionTransport::UnloadStaticPassengers() { - SetPassengersLoaded(false); + SetPassengersLoaded(false); while (!_staticPassengers.empty()) { WorldObject* obj = *_staticPassengers.begin(); @@ -425,15 +425,15 @@ void MotionTransport::UnloadStaticPassengers() void MotionTransport::UnloadNonStaticPassengers() { - for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ) + for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ) { - if ((*itr)->GetTypeId() == TYPEID_PLAYER) - { - ++itr; - continue; - } - PassengerSet::iterator itr2 = itr++; - (*itr2)->AddObjectToRemoveList(); + if ((*itr)->GetTypeId() == TYPEID_PLAYER) + { + ++itr; + continue; + } + PassengerSet::iterator itr2 = itr++; + (*itr2)->AddObjectToRemoveList(); } } @@ -520,71 +520,71 @@ bool MotionTransport::TeleportTransport(uint32 newMapid, float x, float y, float void MotionTransport::DelayedTeleportTransport() { - if (!_delayedTeleport) - return; + if (!_delayedTeleport) + return; - _delayedTeleport = false; + _delayedTeleport = false; - uint32 newMapId = _nextFrame->Node->mapid; - float x = _nextFrame->Node->x, - y = _nextFrame->Node->y, - z = _nextFrame->Node->z, - o =_nextFrame->InitialOrientation; + uint32 newMapId = _nextFrame->Node->mapid; + float x = _nextFrame->Node->x, + y = _nextFrame->Node->y, + z = _nextFrame->Node->z, + o =_nextFrame->InitialOrientation; - PassengerSet _passengersCopy = _passengers; - for (PassengerSet::iterator itr = _passengersCopy.begin(); itr != _passengersCopy.end(); ) - { - WorldObject* obj = (*itr++); + PassengerSet _passengersCopy = _passengers; + for (PassengerSet::iterator itr = _passengersCopy.begin(); itr != _passengersCopy.end(); ) + { + WorldObject* obj = (*itr++); - if (_passengers.find(obj) == _passengers.end()) - continue; + if (_passengers.find(obj) == _passengers.end()) + continue; - switch (obj->GetTypeId()) - { - case TYPEID_UNIT: - _passengers.erase(obj); - if (!obj->ToCreature()->IsPet()) - obj->ToCreature()->DespawnOrUnsummon(); - break; - case TYPEID_GAMEOBJECT: - _passengers.erase(obj); - obj->ToGameObject()->Delete(); - break; - case TYPEID_DYNAMICOBJECT: - _passengers.erase(obj); - if (Unit* caster = obj->ToDynObject()->GetCaster()) - if (Spell* s = caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - if (obj->ToDynObject()->GetSpellId() == s->GetSpellInfo()->Id) - { - s->SendChannelUpdate(0); - s->SendInterrupted(0); - caster->RemoveOwnedAura(s->GetSpellInfo()->Id, caster->GetGUID()); - } - obj->AddObjectToRemoveList(); - break; - case TYPEID_PLAYER: - { - float destX, destY, destZ, destO; - obj->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO); - TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, o); - if (!obj->ToPlayer()->TeleportTo(newMapId, destX, destY, destZ, destO, TELE_TO_NOT_LEAVE_TRANSPORT)) - _passengers.erase(obj); - } - break; - default: - break; - } - } + switch (obj->GetTypeId()) + { + case TYPEID_UNIT: + _passengers.erase(obj); + if (!obj->ToCreature()->IsPet()) + obj->ToCreature()->DespawnOrUnsummon(); + break; + case TYPEID_GAMEOBJECT: + _passengers.erase(obj); + obj->ToGameObject()->Delete(); + break; + case TYPEID_DYNAMICOBJECT: + _passengers.erase(obj); + if (Unit* caster = obj->ToDynObject()->GetCaster()) + if (Spell* s = caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + if (obj->ToDynObject()->GetSpellId() == s->GetSpellInfo()->Id) + { + s->SendChannelUpdate(0); + s->SendInterrupted(0); + caster->RemoveOwnedAura(s->GetSpellInfo()->Id, caster->GetGUID()); + } + obj->AddObjectToRemoveList(); + break; + case TYPEID_PLAYER: + { + float destX, destY, destZ, destO; + obj->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO); + TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, o); + if (!obj->ToPlayer()->TeleportTo(newMapId, destX, destY, destZ, destO, TELE_TO_NOT_LEAVE_TRANSPORT)) + _passengers.erase(obj); + } + break; + default: + break; + } + } - Map* newMap = sMapMgr->CreateBaseMap(newMapId); - GetMap()->RemoveFromMap(this, false); - newMap->LoadGrid(x, y); // xinef: load before adding passengers to new map - SetMap(newMap); + Map* newMap = sMapMgr->CreateBaseMap(newMapId); + GetMap()->RemoveFromMap(this, false); + newMap->LoadGrid(x, y); // xinef: load before adding passengers to new map + SetMap(newMap); - Relocate(x, y, z, o); - GetMap()->AddToMap(this); + Relocate(x, y, z, o); + GetMap()->AddToMap(this); - LoadStaticPassengers(); + LoadStaticPassengers(); } void MotionTransport::UpdatePassengerPositions(PassengerSet& passengers) @@ -606,22 +606,22 @@ void MotionTransport::UpdatePassengerPositions(PassengerSet& passengers) passenger->m_movementInfo.transport.pos.GetPosition(x, y, z, o); CalculatePassengerPosition(x, y, z, &o); - // check if position is valid - if (!Trinity::IsValidMapCoord(x, y, z)) - continue; + // check if position is valid + if (!Trinity::IsValidMapCoord(x, y, z)) + continue; switch (passenger->GetTypeId()) { case TYPEID_UNIT: - { - Creature* creature = passenger->ToCreature(); - GetMap()->CreatureRelocation(creature, x, y, z, o); + { + Creature* creature = passenger->ToCreature(); + GetMap()->CreatureRelocation(creature, x, y, z, o); - creature->GetTransportHomePosition(x, y, z, o); - CalculatePassengerPosition(x, y, z, &o); - creature->SetHomePosition(x, y, z, o); - } - break; + creature->GetTransportHomePosition(x, y, z, o); + CalculatePassengerPosition(x, y, z, &o); + creature->SetHomePosition(x, y, z, o); + } + break; case TYPEID_PLAYER: if (passenger->IsInWorld()) GetMap()->PlayerRelocation(passenger->ToPlayer(), x, y, z, o); @@ -701,9 +701,9 @@ bool StaticTransport::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 ph } // pussywizard: temporarily calculate WorldRotation from orientation, do so until values in db are correct - //SetWorldRotation( /*for StaticTransport we need 2 rotation Quats in db for World- and Path- Rotation*/ ); - SetWorldRotationAngles(NormalizeOrientation(GetOrientation()), 0.0f, 0.0f); - // pussywizard: PathRotation for StaticTransport (only StaticTransports have PathRotation) + //SetWorldRotation( /*for StaticTransport we need 2 rotation Quats in db for World- and Path- Rotation*/ ); + SetWorldRotationAngles(NormalizeOrientation(GetOrientation()), 0.0f, 0.0f); + // pussywizard: PathRotation for StaticTransport (only StaticTransports have PathRotation) SetTransportPathRotation(rotation.x, rotation.y, rotation.z, rotation.w); SetObjectScale(goinfo->size); @@ -726,16 +726,16 @@ bool StaticTransport::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 ph SetGoState(goinfo->transport.startOpen ? GO_STATE_ACTIVE : GO_STATE_READY); SetGoAnimProgress(animprogress); m_goValue.Transport.AnimationInfo = sTransportMgr->GetTransportAnimInfo(goinfo->entry); - //ASSERT(m_goValue.Transport.AnimationInfo); - //ASSERT(m_goValue.Transport.AnimationInfo->TotalTime > 0); - SetPauseTime(goinfo->transport.pauseAtTime); - if (goinfo->transport.startOpen && goinfo->transport.pauseAtTime) - { - SetPathProgress(goinfo->transport.pauseAtTime); - _needDoInitialRelocation = true; - } - else - SetPathProgress(0); + //ASSERT(m_goValue.Transport.AnimationInfo); + //ASSERT(m_goValue.Transport.AnimationInfo->TotalTime > 0); + SetPauseTime(goinfo->transport.pauseAtTime); + if (goinfo->transport.startOpen && goinfo->transport.pauseAtTime) + { + SetPathProgress(goinfo->transport.pauseAtTime); + _needDoInitialRelocation = true; + } + else + SetPathProgress(0); if (GameObjectAddon const* addon = sObjectMgr->GetGameObjectAddon(guidlow)) { @@ -749,7 +749,7 @@ bool StaticTransport::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 ph LastUsedScriptID = GetGOInfo()->ScriptId; AIM_Initialize(); - this->setActive(true); + this->setActive(true); return true; } @@ -781,102 +781,102 @@ void StaticTransport::BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet&) void StaticTransport::Update(uint32 diff) { - GameObject::Update(diff); + GameObject::Update(diff); - if (!IsInWorld()) - return; + if (!IsInWorld()) + return; - if (!m_goValue.Transport.AnimationInfo) - return; + if (!m_goValue.Transport.AnimationInfo) + return; - if (_needDoInitialRelocation) - { - _needDoInitialRelocation = false; - RelocateToProgress(GetPathProgress()); - } + if (_needDoInitialRelocation) + { + _needDoInitialRelocation = false; + RelocateToProgress(GetPathProgress()); + } - if (GetPauseTime()) + if (GetPauseTime()) { if (GetGoState() == GO_STATE_READY) - { - if (GetPathProgress() == 0) // waiting at it's destination for state change, do nothing - return; + { + if (GetPathProgress() == 0) // waiting at it's destination for state change, do nothing + return; - if (GetPathProgress() < GetPauseTime()) // GOState has changed before previous state was reached, move to new destination immediately - SetPathProgress(0); - else if (GetPathProgress() + diff < GetPeriod()) - SetPathProgress(GetPathProgress() + diff); - else - SetPathProgress(0); - } - else - { - if (GetPathProgress() == GetPauseTime()) // waiting at it's destination for state change, do nothing - return; + if (GetPathProgress() < GetPauseTime()) // GOState has changed before previous state was reached, move to new destination immediately + SetPathProgress(0); + else if (GetPathProgress() + diff < GetPeriod()) + SetPathProgress(GetPathProgress() + diff); + else + SetPathProgress(0); + } + else + { + if (GetPathProgress() == GetPauseTime()) // waiting at it's destination for state change, do nothing + return; - if (GetPathProgress() > GetPauseTime()) // GOState has changed before previous state was reached, move to new destination immediately - SetPathProgress(GetPauseTime()); - else if (GetPathProgress() + diff < GetPauseTime()) - SetPathProgress(GetPathProgress() + diff); - else - SetPathProgress(GetPauseTime()); - } + if (GetPathProgress() > GetPauseTime()) // GOState has changed before previous state was reached, move to new destination immediately + SetPathProgress(GetPauseTime()); + else if (GetPathProgress() + diff < GetPauseTime()) + SetPathProgress(GetPathProgress() + diff); + else + SetPathProgress(GetPauseTime()); + } } - else - { + else + { SetPathProgress(GetPathProgress() + diff); - if (GetPathProgress() >= GetPeriod()) - SetPathProgress(GetPathProgress() % GetPeriod()); - } + if (GetPathProgress() >= GetPeriod()) + SetPathProgress(GetPathProgress() % GetPeriod()); + } - RelocateToProgress(GetPathProgress()); + RelocateToProgress(GetPathProgress()); } void StaticTransport::RelocateToProgress(uint32 progress) { - TransportAnimationEntry const *curr = NULL, *next = NULL; - float percPos; - if (m_goValue.Transport.AnimationInfo->GetAnimNode(progress, curr, next, percPos)) - { - // curr node offset - G3D::Vector3 pos = G3D::Vector3(curr->X, curr->Y, curr->Z); + TransportAnimationEntry const *curr = NULL, *next = NULL; + float percPos; + if (m_goValue.Transport.AnimationInfo->GetAnimNode(progress, curr, next, percPos)) + { + // curr node offset + G3D::Vector3 pos = G3D::Vector3(curr->X, curr->Y, curr->Z); - // move by percentage of segment already passed - pos += G3D::Vector3(percPos * (next->X - curr->X), percPos * (next->Y - curr->Y), percPos * (next->Z - curr->Z)); + // move by percentage of segment already passed + pos += G3D::Vector3(percPos * (next->X - curr->X), percPos * (next->Y - curr->Y), percPos * (next->Z - curr->Z)); - // rotate path by PathRotation - // pussywizard: PathRotation in db is only simple orientation rotation, so don't use sophisticated and not working code - // reminder: WorldRotation only influences model rotation, not the path - float sign = GetFloatValue(GAMEOBJECT_PARENTROTATION + 2) >= 0.0f ? 1.0f : -1.0f; - float pathRotAngle = sign * 2.0f * acos(GetFloatValue(GAMEOBJECT_PARENTROTATION + 3)); - float cs = cos(pathRotAngle), sn = sin(pathRotAngle); - float nx = pos.x * cs - pos.y * sn; - float ny = pos.x * sn + pos.y * cs; - pos.x = nx; - pos.y = ny; + // rotate path by PathRotation + // pussywizard: PathRotation in db is only simple orientation rotation, so don't use sophisticated and not working code + // reminder: WorldRotation only influences model rotation, not the path + float sign = GetFloatValue(GAMEOBJECT_PARENTROTATION + 2) >= 0.0f ? 1.0f : -1.0f; + float pathRotAngle = sign * 2.0f * acos(GetFloatValue(GAMEOBJECT_PARENTROTATION + 3)); + float cs = cos(pathRotAngle), sn = sin(pathRotAngle); + float nx = pos.x * cs - pos.y * sn; + float ny = pos.x * sn + pos.y * cs; + pos.x = nx; + pos.y = ny; - // add stationary position to the calculated offset - pos += G3D::Vector3(GetStationaryX(), GetStationaryY(), GetStationaryZ()); + // add stationary position to the calculated offset + pos += G3D::Vector3(GetStationaryX(), GetStationaryY(), GetStationaryZ()); - // rotate by AnimRotation at current segment - // pussywizard: AnimRotation in dbc is only simple orientation rotation, so don't use sophisticated and not working code - G3D::Quat currRot, nextRot; - float percRot; - m_goValue.Transport.AnimationInfo->GetAnimRotation(progress, currRot, nextRot, percRot); - float signCurr = currRot.z >= 0.0f ? 1.0f : -1.0f; - float oriRotAngleCurr = signCurr * 2.0f * acos(currRot.w); - float signNext = nextRot.z >= 0.0f ? 1.0f : -1.0f; - float oriRotAngleNext = signNext * 2.0f * acos(nextRot.w); - float oriRotAngle = oriRotAngleCurr + percRot * (oriRotAngleNext - oriRotAngleCurr); + // rotate by AnimRotation at current segment + // pussywizard: AnimRotation in dbc is only simple orientation rotation, so don't use sophisticated and not working code + G3D::Quat currRot, nextRot; + float percRot; + m_goValue.Transport.AnimationInfo->GetAnimRotation(progress, currRot, nextRot, percRot); + float signCurr = currRot.z >= 0.0f ? 1.0f : -1.0f; + float oriRotAngleCurr = signCurr * 2.0f * acos(currRot.w); + float signNext = nextRot.z >= 0.0f ? 1.0f : -1.0f; + float oriRotAngleNext = signNext * 2.0f * acos(nextRot.w); + float oriRotAngle = oriRotAngleCurr + percRot * (oriRotAngleNext - oriRotAngleCurr); - // check if position is valid - if (!Trinity::IsValidMapCoord(pos.x, pos.y, pos.z)) - return; + // check if position is valid + if (!Trinity::IsValidMapCoord(pos.x, pos.y, pos.z)) + return; - // update position to new one - // also adding simplified orientation rotation here - UpdatePosition(pos.x, pos.y, pos.z, NormalizeOrientation(GetStationaryO() + oriRotAngle)); - } + // update position to new one + // also adding simplified orientation rotation here + UpdatePosition(pos.x, pos.y, pos.z, NormalizeOrientation(GetStationaryO() + oriRotAngle)); + } } void StaticTransport::UpdatePosition(float x, float y, float z, float o) @@ -884,7 +884,7 @@ void StaticTransport::UpdatePosition(float x, float y, float z, float o) if (!GetMap()->IsGridLoaded(x, y)) // pussywizard: should not happen, but just in case GetMap()->LoadGrid(x, y); - GetMap()->GameObjectRelocation(this, x, y, z, o); // this also relocates the model + GetMap()->GameObjectRelocation(this, x, y, z, o); // this also relocates the model UpdatePassengerPositions(); } @@ -904,9 +904,9 @@ void StaticTransport::UpdatePassengerPositions() passenger->m_movementInfo.transport.pos.GetPosition(x, y, z, o); CalculatePassengerPosition(x, y, z, &o); - // check if position is valid - if (!Trinity::IsValidMapCoord(x, y, z)) - continue; + // check if position is valid + if (!Trinity::IsValidMapCoord(x, y, z)) + continue; switch (passenger->GetTypeId()) { @@ -915,7 +915,7 @@ void StaticTransport::UpdatePassengerPositions() break; case TYPEID_PLAYER: if (passenger->IsInWorld()) - GetMap()->PlayerRelocation(passenger->ToPlayer(), x, y, z, o); + GetMap()->PlayerRelocation(passenger->ToPlayer(), x, y, z, o); break; case TYPEID_GAMEOBJECT: GetMap()->GameObjectRelocation(passenger->ToGameObject(), x, y, z, o); @@ -933,23 +933,23 @@ void StaticTransport::AddPassenger(WorldObject* passenger, bool withAll) { if (_passengers.insert(passenger).second) { - if (Player* plr = passenger->ToPlayer()) + if (Player* plr = passenger->ToPlayer()) sScriptMgr->OnAddPassenger(ToTransport(), plr); - if (withAll) - { - if (Transport* t = passenger->GetTransport()) // SHOULD NEVER HAPPEN - t->RemovePassenger(passenger, false); + if (withAll) + { + if (Transport* t = passenger->GetTransport()) // SHOULD NEVER HAPPEN + t->RemovePassenger(passenger, false); - float x, y, z, o; - passenger->GetPosition(x, y, z, o); - CalculatePassengerOffset(x, y, z, &o); + float x, y, z, o; + passenger->GetPosition(x, y, z, o); + CalculatePassengerOffset(x, y, z, &o); - passenger->SetTransport(this); - passenger->m_movementInfo.flags |= MOVEMENTFLAG_ONTRANSPORT; - passenger->m_movementInfo.transport.guid = GetGUID(); - passenger->m_movementInfo.transport.pos.Relocate(x, y, z, o); - } + passenger->SetTransport(this); + passenger->m_movementInfo.flags |= MOVEMENTFLAG_ONTRANSPORT; + passenger->m_movementInfo.transport.guid = GetGUID(); + passenger->m_movementInfo.transport.pos.Relocate(x, y, z, o); + } } } @@ -958,17 +958,17 @@ void StaticTransport::RemovePassenger(WorldObject* passenger, bool withAll) if (_passengers.erase(passenger)) { if (Player* plr = passenger->ToPlayer()) - { + { sScriptMgr->OnRemovePassenger(ToTransport(), plr); - plr->SetFallInformation(time(NULL), plr->GetPositionZ()); - } + plr->SetFallInformation(time(NULL), plr->GetPositionZ()); + } - if (withAll) - { - passenger->SetTransport(NULL); - passenger->m_movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; - passenger->m_movementInfo.transport.guid = 0; - passenger->m_movementInfo.transport.pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); - } + if (withAll) + { + passenger->SetTransport(NULL); + passenger->m_movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; + passenger->m_movementInfo.transport.guid = 0; + passenger->m_movementInfo.transport.pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); + } } } diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h index 8c1b5ade2..587359948 100644 --- a/src/server/game/Entities/Transport/Transport.h +++ b/src/server/game/Entities/Transport/Transport.h @@ -29,17 +29,17 @@ struct CreatureData; class Transport : public GameObject, public TransportBase { public: - Transport() : GameObject() {} - void CalculatePassengerPosition(float& x, float& y, float& z, float* o = NULL) const { TransportBase::CalculatePassengerPosition(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); } + Transport() : GameObject() {} + void CalculatePassengerPosition(float& x, float& y, float& z, float* o = NULL) const { TransportBase::CalculatePassengerPosition(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); } void CalculatePassengerOffset(float& x, float& y, float& z, float* o = NULL) const { TransportBase::CalculatePassengerOffset(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); } - typedef std::set PassengerSet; + typedef std::set PassengerSet; virtual void AddPassenger(WorldObject* passenger, bool withAll = false) = 0; virtual void RemovePassenger(WorldObject* passenger, bool withAll = false) = 0; PassengerSet const& GetPassengers() const { return _passengers; } uint32 GetPathProgress() const { return GetGOValue()->Transport.PathProgress; } - void SetPathProgress(uint32 val) { m_goValue.Transport.PathProgress = val; } + void SetPathProgress(uint32 val) { m_goValue.Transport.PathProgress = val; } protected: PassengerSet _passengers; @@ -53,14 +53,14 @@ public: ~MotionTransport(); bool CreateMoTrans(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress); - void CleanupsBeforeDelete(bool finalCleanup = true); + void CleanupsBeforeDelete(bool finalCleanup = true); void BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet&); void Update(uint32 diff); - void DelayedUpdate(uint32 diff); + void DelayedUpdate(uint32 diff); void UpdatePosition(float x, float y, float z, float o); - void AddPassenger(WorldObject* passenger, bool withAll = false); + void AddPassenger(WorldObject* passenger, bool withAll = false); void RemovePassenger(WorldObject* passenger, bool withAll = false); Creature* CreateNPCPassenger(uint32 guid, CreatureData const* data); GameObject* CreateGOPassenger(uint32 guid, GameObjectData const* data); @@ -69,8 +69,8 @@ public: PassengerSet const& GetStaticPassengers() const { return _staticPassengers; } void UnloadStaticPassengers(); void UnloadNonStaticPassengers(); - void SetPassengersLoaded(bool loaded) { _passengersLoaded = loaded; } - bool PassengersLoaded() const { return _passengersLoaded; } + void SetPassengersLoaded(bool loaded) { _passengersLoaded = loaded; } + bool PassengersLoaded() const { return _passengersLoaded; } KeyFrameVec const& GetKeyFrames() const { return _transportInfo->keyFrames; } void EnableMovement(bool enabled); @@ -104,22 +104,22 @@ private: PassengerSet _staticPassengers; mutable ACE_Thread_Mutex Lock; - bool _passengersLoaded; - bool _delayedTeleport; + bool _passengersLoaded; + bool _delayedTeleport; }; class StaticTransport : public Transport { public: - StaticTransport(); - ~StaticTransport(); + StaticTransport(); + ~StaticTransport(); virtual bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0); - void CleanupsBeforeDelete(bool finalCleanup = true); + void CleanupsBeforeDelete(bool finalCleanup = true); void BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet&); void Update(uint32 diff); - void RelocateToProgress(uint32 progress); + void RelocateToProgress(uint32 progress); void UpdatePosition(float x, float y, float z, float o); void UpdatePassengerPositions(); @@ -130,7 +130,7 @@ public: void SetPauseTime(uint32 val) { SetUInt32Value(GAMEOBJECT_LEVEL, val); } uint32 GetPeriod() const { return m_goValue.Transport.AnimationInfo ? m_goValue.Transport.AnimationInfo->TotalTime : GetPauseTime()+2; } private: - bool _needDoInitialRelocation; + bool _needDoInitialRelocation; }; #endif diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index 0fda39f9f..a121dda5c 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -230,7 +230,7 @@ void Player::UpdateResistances(uint32 school) for(AuraEffectList::const_iterator i = mResbyIntellect.begin();i != mResbyIntellect.end(); ++i) { if((*i)->GetMiscValue() & (1 << (school-1)) ) - value += int32(GetStat(Stats((*i)->GetMiscValueB())) * (*i)->GetAmount() / 100.0f); + value += int32(GetStat(Stats((*i)->GetMiscValueB())) * (*i)->GetAmount() / 100.0f); } value *= GetModifierValue(unitMod, TOTAL_PCT); @@ -407,35 +407,35 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) if (!proto) continue; - uint32 ap = proto->getFeralBonus(); - // Get AP Bonuses from weapon - for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i) - { - if (i >= proto->StatsCount) - break; + uint32 ap = proto->getFeralBonus(); + // Get AP Bonuses from weapon + for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i) + { + if (i >= proto->StatsCount) + break; - if (proto->ItemStat[i].ItemStatType == ITEM_MOD_ATTACK_POWER) - ap += proto->ItemStat[i].ItemStatValue; - } + if (proto->ItemStat[i].ItemStatType == ITEM_MOD_ATTACK_POWER) + ap += proto->ItemStat[i].ItemStatValue; + } - // Get AP Bonuses from weapon spells - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - { - // no spell - if (!proto->Spells[i].SpellId || proto->Spells[i].SpellTrigger != ITEM_SPELLTRIGGER_ON_EQUIP) - continue; + // Get AP Bonuses from weapon spells + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { + // no spell + if (!proto->Spells[i].SpellId || proto->Spells[i].SpellTrigger != ITEM_SPELLTRIGGER_ON_EQUIP) + continue; - // check if it is valid spell - SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(proto->Spells[i].SpellId); - if (!spellproto) - continue; + // check if it is valid spell + SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(proto->Spells[i].SpellId); + if (!spellproto) + continue; - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - if (spellproto->Effects[j].ApplyAuraName == SPELL_AURA_MOD_ATTACK_POWER) - ap += spellproto->Effects[j].CalcValue(); - } + for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) + if (spellproto->Effects[j].ApplyAuraName == SPELL_AURA_MOD_ATTACK_POWER) + ap += spellproto->Effects[j].CalcValue(); + } - weapon_bonus = CalculatePct(float(ap), aurEff->GetAmount()); + weapon_bonus = CalculatePct(float(ap), aurEff->GetAmount()); } break; default: @@ -586,13 +586,13 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo minDamage = ((weaponMinDamage + baseValue) * basePct + totalValue) * totalPct; maxDamage = ((weaponMaxDamage + baseValue) * basePct + totalValue) * totalPct; - // pussywizard: crashfix (casting negative to uint => min > max => assertion in urand) - if (minDamage < 0.0f || minDamage > 1000000000.0f) - minDamage = 0.0f; - if (maxDamage < 0.0f || maxDamage > 1000000000.0f) - maxDamage = 0.0f; - if (minDamage > maxDamage) - minDamage = maxDamage; + // pussywizard: crashfix (casting negative to uint => min > max => assertion in urand) + if (minDamage < 0.0f || minDamage > 1000000000.0f) + minDamage = 0.0f; + if (maxDamage < 0.0f || maxDamage > 1000000000.0f) + maxDamage = 0.0f; + if (minDamage > maxDamage) + minDamage = maxDamage; } void Player::UpdateDefenseBonusesMod() @@ -728,7 +728,7 @@ void Player::UpdateParryPercentage() // No parry float value = 0.0f; - m_realParry = 0.0f; + m_realParry = 0.0f; uint32 pclass = getClass()-1; if (CanParry() && parry_cap[pclass] > 0.0f) { @@ -744,7 +744,7 @@ void Player::UpdateParryPercentage() m_realParry = nondiminishing + diminishing * parry_cap[pclass] / (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]); m_realParry = m_realParry < 0.0f ? 0.0f : m_realParry; - value = std::max(diminishing + nondiminishing, 0.0f); + value = std::max(diminishing + nondiminishing, 0.0f); } SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value); @@ -779,9 +779,9 @@ void Player::UpdateDodgePercentage() // apply diminishing formula to diminishing dodge chance uint32 pclass = getClass()-1; m_realDodge = nondiminishing + (diminishing * dodge_cap[pclass] / (diminishing + dodge_cap[pclass] * m_diminishing_k[pclass])); - - m_realDodge = m_realDodge < 0.0f ? 0.0f : m_realDodge; - float value = std::max(diminishing + nondiminishing, 0.0f); + + m_realDodge = m_realDodge < 0.0f ? 0.0f : m_realDodge; + float value = std::max(diminishing + nondiminishing, 0.0f); SetStatFloatValue(PLAYER_DODGE_PERCENTAGE, value); } @@ -890,12 +890,12 @@ void Player::ApplyHealthRegenBonus(int32 amount, bool apply) void Player::UpdateManaRegen() { - if( HasAuraTypeWithMiscvalue(SPELL_AURA_PREVENT_REGENERATE_POWER, POWER_MANA+1) ) - { - SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, 0); - SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, 0); - return; - } + if( HasAuraTypeWithMiscvalue(SPELL_AURA_PREVENT_REGENERATE_POWER, POWER_MANA+1) ) + { + SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, 0); + SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, 0); + return; + } float Intellect = GetStat(STAT_INTELLECT); // Mana regen from spirit and intellect @@ -1089,8 +1089,8 @@ void Creature::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, weaponMaxDamage = 0.0f; } - // pussywizard: subtract value from database till its fixed (the way it worked before creature_levelstats damage implementation) - float attackPower = GetTotalAttackPowerValue(attType) - (attType == RANGED_ATTACK ? GetCreatureTemplate()->rangedattackpower : GetCreatureTemplate()->attackpower); + // pussywizard: subtract value from database till its fixed (the way it worked before creature_levelstats damage implementation) + float attackPower = GetTotalAttackPowerValue(attType) - (attType == RANGED_ATTACK ? GetCreatureTemplate()->rangedattackpower : GetCreatureTemplate()->attackpower); float baseValue = GetModifierValue(unitMod, BASE_VALUE) + (attackPower * GetAPMultiplier(attType, normalized) / 14.0f); float basePct = GetModifierValue(unitMod, BASE_PCT); float totalValue = GetModifierValue(unitMod, TOTAL_VALUE); @@ -1100,13 +1100,13 @@ void Creature::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, minDamage = ((weaponMinDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct; maxDamage = ((weaponMaxDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct; - // pussywizard: crashfix (casting negative to uint => min > max => assertion in urand) - if (minDamage < 0.0f || minDamage > 1000000000.0f) - minDamage = 0.0f; - if (maxDamage < 0.0f || maxDamage > 1000000000.0f) - maxDamage = 0.0f; - if (minDamage > maxDamage) - minDamage = maxDamage; + // pussywizard: crashfix (casting negative to uint => min > max => assertion in urand) + if (minDamage < 0.0f || minDamage > 1000000000.0f) + minDamage = 0.0f; + if (maxDamage < 0.0f || maxDamage > 1000000000.0f) + maxDamage = 0.0f; + if (minDamage > maxDamage) + minDamage = maxDamage; } /*####################################### @@ -1122,7 +1122,7 @@ bool Guardian::UpdateStats(Stats stat) if (stat >= MAX_STATS) return false; - float value = GetTotalStatValue(stat); + float value = GetTotalStatValue(stat); SetStat(stat, int32(value)); switch (stat) @@ -1153,7 +1153,7 @@ void Guardian::UpdateArmor() { float value = GetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE); value *= GetModifierValue(UNIT_MOD_ARMOR, BASE_PCT); - value += std::max(GetStat(STAT_AGILITY) - GetCreateStat(STAT_AGILITY), 0.0f) * 2.0f; + value += std::max(GetStat(STAT_AGILITY) - GetCreateStat(STAT_AGILITY), 0.0f) * 2.0f; value += GetModifierValue(UNIT_MOD_ARMOR, TOTAL_VALUE); value *= GetModifierValue(UNIT_MOD_ARMOR, TOTAL_PCT); SetArmor(int32(value)); @@ -1162,14 +1162,14 @@ void Guardian::UpdateArmor() void Guardian::UpdateMaxHealth() { UnitMods unitMod = UNIT_MOD_HEALTH; - float stamina = std::max(GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA), 0.0f); + float stamina = std::max(GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA), 0.0f); float multiplicator; switch (GetEntry()) { case NPC_IMP: multiplicator = 8.4f; break; - case NPC_WATER_ELEMENTAL_TEMP: multiplicator = 7.5f; break; - case NPC_WATER_ELEMENTAL_PERM: multiplicator = 7.5f; break; + case NPC_WATER_ELEMENTAL_TEMP: multiplicator = 7.5f; break; + case NPC_WATER_ELEMENTAL_PERM: multiplicator = 7.5f; break; case NPC_VOIDWALKER: multiplicator = 11.0f; break; case NPC_SUCCUBUS: multiplicator = 9.1f; break; case NPC_FELHUNTER: multiplicator = 9.5f; break; @@ -1190,29 +1190,29 @@ void Guardian::UpdateMaxPower(Powers power) { UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power); - float addValue = (power == POWER_MANA) ? std::max(GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT), 0.0f) : 0.0f; + float addValue = (power == POWER_MANA) ? std::max(GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT), 0.0f) : 0.0f; float multiplicator = 15.0f; switch (GetEntry()) { case NPC_IMP: - case NPC_WATER_ELEMENTAL_TEMP: - case NPC_WATER_ELEMENTAL_PERM: - multiplicator = 4.95f; - break; + case NPC_WATER_ELEMENTAL_TEMP: + case NPC_WATER_ELEMENTAL_PERM: + multiplicator = 4.95f; + break; case NPC_VOIDWALKER: case NPC_SUCCUBUS: case NPC_FELHUNTER: case NPC_FELGUARD: - multiplicator = 11.5f; - break; + multiplicator = 11.5f; + break; default: - multiplicator = 15.0f; - break; + multiplicator = 15.0f; + break; } - // xinef: Do NOT add base mana TWICE - float value = GetModifierValue(unitMod, BASE_VALUE) + (power != POWER_MANA ? GetCreatePowers(power) : 0); + // xinef: Do NOT add base mana TWICE + float value = GetModifierValue(unitMod, BASE_VALUE) + (power != POWER_MANA ? GetCreatePowers(power) : 0); value *= GetModifierValue(unitMod, BASE_PCT); value += GetModifierValue(unitMod, TOTAL_VALUE) + addValue * multiplicator; value *= GetModifierValue(unitMod, TOTAL_PCT); @@ -1231,12 +1231,12 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged) if (GetEntry() == NPC_IMP) // imp's attack power val = GetStat(STAT_STRENGTH) - 10.0f; else if (IsPetGhoul()) // DK's ghoul attack power - val = 589 /*xinef: base ap!*/ + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY); - else + val = 589 /*xinef: base ap!*/ + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY); + else val = 2 * GetStat(STAT_STRENGTH) - 20.0f; SetModifierValue(unitMod, BASE_VALUE, val); - + //in BASE_VALUE of UNIT_MOD_ATTACK_POWER for creatures we store data of meleeattackpower field in DB float base_attPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT); float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE); @@ -1273,12 +1273,12 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType) float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct; float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct; - if (mindamage < 0.0f || mindamage > 10000000.0f) - mindamage = BASE_MINDAMAGE; - if (maxdamage < 0.0f || maxdamage > 10000000.0f) - maxdamage = BASE_MAXDAMAGE; - if (mindamage > maxdamage) - mindamage = maxdamage; + if (mindamage < 0.0f || mindamage > 10000000.0f) + mindamage = BASE_MINDAMAGE; + if (maxdamage < 0.0f || maxdamage > 10000000.0f) + maxdamage = BASE_MAXDAMAGE; + if (mindamage > maxdamage) + mindamage = maxdamage; // Pet's base damage changes depending on happiness if (IsHunterPet() && attType == BASE_ATTACK) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c20ddcd3b..4f3b5f555 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -253,27 +253,27 @@ m_HostileRefManager(this), m_AutoRepeatFirstCast(false) m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE); - m_mmapNotAcceptableStartTime = 0; - m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); - m_last_notify_mstime = 0; - m_delayed_unit_relocation_timer = 0; - m_delayed_unit_ai_notify_timer = 0; - bRequestForcedVisibilityUpdate = false; - m_last_underwaterstate_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); - m_last_environment_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); - m_last_isinwater_status = false; - m_last_islittleabovewater_status = false; - m_last_isunderwater_status = false; - m_is_updating_environment = false; - m_last_area_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); - m_last_zone_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); - m_last_area_id = 0; - m_last_zone_id = 0; - m_last_outdoors_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); - m_last_outdoors_status = true; // true by default + m_mmapNotAcceptableStartTime = 0; + m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + m_last_notify_mstime = 0; + m_delayed_unit_relocation_timer = 0; + m_delayed_unit_ai_notify_timer = 0; + bRequestForcedVisibilityUpdate = false; + m_last_underwaterstate_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + m_last_environment_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + m_last_isinwater_status = false; + m_last_islittleabovewater_status = false; + m_last_isunderwater_status = false; + m_is_updating_environment = false; + m_last_area_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + m_last_zone_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + m_last_area_id = 0; + m_last_zone_id = 0; + m_last_outdoors_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + m_last_outdoors_status = true; // true by default - m_applyResilience = false; - _instantCast = false; + m_applyResilience = false; + _instantCast = false; _lastLiquid = NULL; @@ -320,18 +320,18 @@ Unit::~Unit() ASSERT(!m_attacking); ASSERT(m_attackers.empty()); - // pussywizard: clear m_sharedVision along with back references - if (!m_sharedVision.empty()) - { - sLog->outMisc("Unit::~Unit (B1)"); - do - { - sLog->outMisc("Unit::~Unit (B2)"); - Player* p = *(m_sharedVision.begin()); - p->m_isInSharedVisionOf.erase(this); - m_sharedVision.erase(p); - } while (!m_sharedVision.empty()); - } + // pussywizard: clear m_sharedVision along with back references + if (!m_sharedVision.empty()) + { + sLog->outMisc("Unit::~Unit (B1)"); + do + { + sLog->outMisc("Unit::~Unit (B2)"); + Player* p = *(m_sharedVision.begin()); + p->m_isInSharedVisionOf.erase(this); + m_sharedVision.erase(p); + } while (!m_sharedVision.empty()); + } ASSERT(m_Controlled.empty()); ASSERT(m_appliedAuras.empty()); @@ -340,10 +340,10 @@ Unit::~Unit() ASSERT(m_gameObj.empty()); ASSERT(m_dynObj.empty()); - if (m_movedByPlayer && m_movedByPlayer != this) - sLog->outMisc("Unit::~Unit (A1)"); + if (m_movedByPlayer && m_movedByPlayer != this) + sLog->outMisc("Unit::~Unit (A1)"); - HandleSafeUnitPointersOnDelete(this); + HandleSafeUnitPointersOnDelete(this); } void Unit::Update(uint32 p_time) @@ -353,34 +353,34 @@ void Unit::Update(uint32 p_time) // Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad. m_Events.Update(p_time); - if (!IsInWorld()) - return; + if (!IsInWorld()) + return; - // pussywizard: - if (GetTypeId() != TYPEID_PLAYER || (!ToPlayer()->IsBeingTeleported() && !bRequestForcedVisibilityUpdate)) - { - if (m_delayed_unit_relocation_timer) - { - if (m_delayed_unit_relocation_timer <= p_time) - { - m_delayed_unit_relocation_timer = 0; - //ExecuteDelayedUnitRelocationEvent(); - FindMap()->i_objectsForDelayedVisibility.insert(this); - } - else - m_delayed_unit_relocation_timer -= p_time; - } - if (m_delayed_unit_ai_notify_timer) - { - if (m_delayed_unit_ai_notify_timer <= p_time) - { - m_delayed_unit_ai_notify_timer = 0; - ExecuteDelayedUnitAINotifyEvent(); - } - else - m_delayed_unit_ai_notify_timer -= p_time; - } - } + // pussywizard: + if (GetTypeId() != TYPEID_PLAYER || (!ToPlayer()->IsBeingTeleported() && !bRequestForcedVisibilityUpdate)) + { + if (m_delayed_unit_relocation_timer) + { + if (m_delayed_unit_relocation_timer <= p_time) + { + m_delayed_unit_relocation_timer = 0; + //ExecuteDelayedUnitRelocationEvent(); + FindMap()->i_objectsForDelayedVisibility.insert(this); + } + else + m_delayed_unit_relocation_timer -= p_time; + } + if (m_delayed_unit_ai_notify_timer) + { + if (m_delayed_unit_ai_notify_timer <= p_time) + { + m_delayed_unit_ai_notify_timer = 0; + ExecuteDelayedUnitAINotifyEvent(); + } + else + m_delayed_unit_ai_notify_timer -= p_time; + } + } _UpdateSpells( p_time ); @@ -404,14 +404,14 @@ void Unit::Update(uint32 p_time) } // not implemented before 3.0.2 - // xinef: if attack time > 0, reduce by diff - // if on next update, attack time < 0 assume player didnt attack - set to 0 - if (int32 base_attack = getAttackTimer(BASE_ATTACK)) - setAttackTimer(BASE_ATTACK, base_attack > 0 ? base_attack - (int32)p_time : 0); - if (int32 ranged_attack = getAttackTimer(RANGED_ATTACK)) - setAttackTimer(RANGED_ATTACK, ranged_attack > 0 ? ranged_attack - (int32)p_time : 0); - if (int32 off_attack = getAttackTimer(OFF_ATTACK)) - setAttackTimer(OFF_ATTACK, off_attack > 0 ? off_attack - (int32)p_time : 0); + // xinef: if attack time > 0, reduce by diff + // if on next update, attack time < 0 assume player didnt attack - set to 0 + if (int32 base_attack = getAttackTimer(BASE_ATTACK)) + setAttackTimer(BASE_ATTACK, base_attack > 0 ? base_attack - (int32)p_time : 0); + if (int32 ranged_attack = getAttackTimer(RANGED_ATTACK)) + setAttackTimer(RANGED_ATTACK, ranged_attack > 0 ? ranged_attack - (int32)p_time : 0); + if (int32 off_attack = getAttackTimer(OFF_ATTACK)) + setAttackTimer(OFF_ATTACK, off_attack > 0 ? off_attack - (int32)p_time : 0); // update abilities available only for fraction of time UpdateReactives(p_time); @@ -463,22 +463,22 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 T class SplineHandler { public: - SplineHandler(Unit* unit) : _unit(unit) { } + SplineHandler(Unit* unit) : _unit(unit) { } bool operator()(Movement::MoveSpline::UpdateResult result) - { - if ((result & (Movement::MoveSpline::Result_NextSegment|Movement::MoveSpline::Result_JustArrived)) && - _unit->GetTypeId() == TYPEID_UNIT && _unit->GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE && - _unit->movespline->GetId() == _unit->GetMotionMaster()->GetCurrentSplineId()) - { - _unit->ToCreature()->AI()->MovementInform(ESCORT_MOTION_TYPE, _unit->movespline->currentPathIdx()-1); - } + { + if ((result & (Movement::MoveSpline::Result_NextSegment|Movement::MoveSpline::Result_JustArrived)) && + _unit->GetTypeId() == TYPEID_UNIT && _unit->GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE && + _unit->movespline->GetId() == _unit->GetMotionMaster()->GetCurrentSplineId()) + { + _unit->ToCreature()->AI()->MovementInform(ESCORT_MOTION_TYPE, _unit->movespline->currentPathIdx()-1); + } - return true; - } + return true; + } - private: - Unit* _unit; + private: + Unit* _unit; }; void Unit::UpdateSplineMovement(uint32 t_diff) @@ -488,14 +488,14 @@ void Unit::UpdateSplineMovement(uint32 t_diff) // xinef: process movementinform // this code cant be placed inside EscortMovementGenerator, because we cant delete active MoveGen while it is updated - SplineHandler handler(this); + SplineHandler handler(this); movespline->updateState(t_diff, handler); - // Xinef: Spline was cleared by StopMoving, return - if (!movespline->Initialized()) - { - DisableSpline(); - return; - } + // Xinef: Spline was cleared by StopMoving, return + if (!movespline->Initialized()) + { + DisableSpline(); + return; + } bool arrived = movespline->Finalized(); @@ -527,7 +527,7 @@ void Unit::UpdateSplinePosition() transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation); } - // Xinef: this is bullcrap, if we had spline running update orientation along with position + // Xinef: this is bullcrap, if we had spline running update orientation along with position //if (HasUnitState(UNIT_STATE_CANNOT_TURN)) // loc.orientation = GetOrientation(); @@ -545,8 +545,8 @@ void Unit::DisableSpline() void Unit::resetAttackTimer(WeaponAttackType type) { - int32 time = int32(GetAttackTime(type) * m_modAttackSpeedPct[type]); - m_attackTimer[type] = std::min(m_attackTimer[type]+time, time); + int32 time = int32(GetAttackTime(type) * m_modAttackSpeedPct[type]); + m_attackTimer[type] = std::min(m_attackTimer[type]+time, time); } bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const @@ -679,18 +679,18 @@ void Unit::DealDamageMods(Unit const* victim, uint32 &damage, uint32* absorb) uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss, bool allowGM) { - // Xinef: initialize damage done for rage calculations - // Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0 - uint32 rage_damage = damage + ((cleanDamage != NULL) ? cleanDamage->absorbed_damage : 0); + // Xinef: initialize damage done for rage calculations + // Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0 + uint32 rage_damage = damage + ((cleanDamage != NULL) ? cleanDamage->absorbed_damage : 0); //if (attacker) - { - if (victim->IsAIEnabled) - victim->GetAI()->DamageTaken(attacker, damage, damagetype, damageSchoolMask); + { + if (victim->IsAIEnabled) + victim->GetAI()->DamageTaken(attacker, damage, damagetype, damageSchoolMask); - if (attacker && attacker->IsAIEnabled) - attacker->GetAI()->DamageDealt(victim, damage, damagetype); - } + if (attacker && attacker->IsAIEnabled) + attacker->GetAI()->DamageDealt(victim, damage, damagetype); + } if (victim->GetTypeId() == TYPEID_PLAYER && attacker != victim) { @@ -737,22 +737,22 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage uint32 shareDamage = CalculatePct(damage, (*i)->GetAmount()); uint32 shareAbsorb = 0; - uint32 shareResist = 0; + uint32 shareResist = 0; - if (shareDamageTarget->IsImmunedToDamageOrSchool(damageSchoolMask)) - { - shareAbsorb = shareDamage; - shareDamage = 0; - } - else - { - Unit::DealDamageMods(shareDamageTarget, shareDamage, &shareAbsorb); - Unit::CalcAbsorbResist(attacker, shareDamageTarget, damageSchoolMask, damagetype, shareDamage, &shareAbsorb, &shareResist, spellProto, true); - shareDamage -= std::min(shareAbsorb, shareDamage); - } + if (shareDamageTarget->IsImmunedToDamageOrSchool(damageSchoolMask)) + { + shareAbsorb = shareDamage; + shareDamage = 0; + } + else + { + Unit::DealDamageMods(shareDamageTarget, shareDamage, &shareAbsorb); + Unit::CalcAbsorbResist(attacker, shareDamageTarget, damageSchoolMask, damagetype, shareDamage, &shareAbsorb, &shareResist, spellProto, true); + shareDamage -= std::min(shareAbsorb, shareDamage); + } - if (attacker && shareDamageTarget->GetTypeId() == TYPEID_PLAYER) - attacker->SendSpellNonMeleeDamageLog(shareDamageTarget, spell->Id, shareDamage+shareAbsorb+shareResist, damageSchoolMask, shareAbsorb, shareResist, damagetype == DIRECT_DAMAGE, 0, false); + if (attacker && shareDamageTarget->GetTypeId() == TYPEID_PLAYER) + attacker->SendSpellNonMeleeDamageLog(shareDamageTarget, spell->Id, shareDamage+shareAbsorb+shareResist, damageSchoolMask, shareAbsorb, shareResist, damagetype == DIRECT_DAMAGE, 0, false); Unit::DealDamage(attacker, shareDamageTarget, shareDamage, cleanDamage, NODAMAGE, damageSchoolMask, spellProto, false); } @@ -768,7 +768,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage case BASE_ATTACK: case OFF_ATTACK: { - weaponSpeedHitFactor = uint32(attacker->GetAttackTime(cleanDamage->attackType) / 1000.0f * (cleanDamage->attackType == BASE_ATTACK ? 3.5f : 1.75f)); + weaponSpeedHitFactor = uint32(attacker->GetAttackTime(cleanDamage->attackType) / 1000.0f * (cleanDamage->attackType == BASE_ATTACK ? 3.5f : 1.75f)); if (cleanDamage->hitOutCome == MELEE_HIT_CRIT) weaponSpeedHitFactor *= 2; @@ -807,13 +807,13 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage bool duel_wasMounted = false; if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->duel && damage >= (health-1)) { - // xinef: situation not possible earlier, just return silently. - if (!attacker) - return 0; + // xinef: situation not possible earlier, just return silently. + if (!attacker) + return 0; // prevent kill only if killed in duel and killed by opponent or opponent controlled creature - if (victim->ToPlayer()->duel->opponent == attacker || victim->ToPlayer()->duel->opponent->GetGUID() == attacker->GetOwnerGUID()) - damage = health - 1; + if (victim->ToPlayer()->duel->opponent == attacker || victim->ToPlayer()->duel->opponent->GetGUID() == attacker->GetOwnerGUID()) + damage = health - 1; duel_hasEnded = true; } @@ -823,9 +823,9 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage if (victimRider && victimRider->duel && victimRider->duel->isMounted) { - // xinef: situation not possible earlier, just return silently. - if (!attacker) - return 0; + // xinef: situation not possible earlier, just return silently. + if (!attacker) + return 0; // prevent kill only if killed in duel and killed by opponent or opponent controlled creature if (victimRider->duel->opponent == attacker || victimRider->duel->opponent->GetGUID() == attacker->GetCharmerGUID()) @@ -837,19 +837,19 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage } if (attacker && attacker != victim) - if (Player* killer = attacker->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - // pussywizard: don't allow GMs to deal damage in normal way (this leaves no evidence in logs!), they have commands to do so - //if (!allowGM && killer->GetSession()->GetSecurity() && killer->GetSession()->GetSecurity() <= SEC_ADMINISTRATOR) - // return 0; + if (Player* killer = attacker->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + // pussywizard: don't allow GMs to deal damage in normal way (this leaves no evidence in logs!), they have commands to do so + //if (!allowGM && killer->GetSession()->GetSecurity() && killer->GetSession()->GetSecurity() <= SEC_ADMINISTRATOR) + // return 0; - if (Battleground* bg = killer->GetBattleground()) - { - bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage); - killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, victim); // pussywizard: InBattleground() optimization - } - //killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage); // pussywizard: optimization - } + if (Battleground* bg = killer->GetBattleground()) + { + bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage); + killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, victim); // pussywizard: InBattleground() optimization + } + //killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage); // pussywizard: optimization + } if (victim->GetTypeId() == TYPEID_PLAYER) ;//victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage); // pussywizard: optimization @@ -869,7 +869,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage //if (attacker && victim->GetTypeId() == TYPEID_PLAYER && victim != attacker) //victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); // pussywizard: optimization - Unit::Kill(attacker, victim, durabilityLoss, cleanDamage ? cleanDamage->attackType : BASE_ATTACK, spellProto); + Unit::Kill(attacker, victim, durabilityLoss, cleanDamage ? cleanDamage->attackType : BASE_ATTACK, spellProto); } else { @@ -886,8 +886,8 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage if (victim->GetTypeId() != TYPEID_PLAYER) { // Part of Evade mechanics. DoT's and Thorns / Retribution Aura do not contribute to this - if (damagetype != DOT && damage > 0 && !IS_PLAYER_GUID(victim->GetOwnerGUID()) && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD))) - victim->ToCreature()->SetLastDamagedTime(sWorld->GetGameTime()+MAX_AGGRO_RESET_TIME); + if (damagetype != DOT && damage > 0 && !IS_PLAYER_GUID(victim->GetOwnerGUID()) && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD))) + victim->ToCreature()->SetLastDamagedTime(sWorld->GetGameTime()+MAX_AGGRO_RESET_TIME); if (attacker) victim->AddThreat(attacker, float(damage), damageSchoolMask, spellProto); @@ -919,7 +919,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage } } - if (damagetype != NODAMAGE && damage && (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR3_NO_PUSHBACK) || spellProto->HasAttribute(SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE)))) + if (damagetype != NODAMAGE && damage && (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR3_NO_PUSHBACK) || spellProto->HasAttribute(SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE)))) { if (victim != attacker && victim->GetTypeId() == TYPEID_PLAYER) // does not support creature push_back { @@ -1107,7 +1107,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask); uint32 crTypeMask = victim->GetCreatureTypeMask(); - if (Unit::IsDamageReducedByArmor(damageSchoolMask, spellInfo)) + if (Unit::IsDamageReducedByArmor(damageSchoolMask, spellInfo)) damage = Unit::CalcArmorReducedDamage(this, victim, damage, spellInfo, 0, attackType); bool blocked = false; @@ -1143,8 +1143,8 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama else critPctDamageMod += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE); - // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS - critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask()); + // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS + critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask()); // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask); @@ -1165,13 +1165,13 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama damage -= damageInfo->blocked; } - if (CanApplyResilience()) - { - if (attackType != RANGED_ATTACK) - Unit::ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_MELEE); - else - Unit::ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_RANGED); - } + if (CanApplyResilience()) + { + if (attackType != RANGED_ATTACK) + Unit::ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_MELEE); + else + Unit::ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_RANGED); + } break; } // Magical Attacks @@ -1182,11 +1182,11 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama if (crit) { damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT; - damage = Unit::SpellCriticalDamageBonus(this, spellInfo, damage, victim); + damage = Unit::SpellCriticalDamageBonus(this, spellInfo, damage, victim); } - if (CanApplyResilience()) - Unit::ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_SPELL); + if (CanApplyResilience()) + Unit::ApplyResilience(victim, NULL, &damage, crit, CR_CRIT_TAKEN_SPELL); break; } default: @@ -1196,13 +1196,13 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama // Calculate absorb resist if (damage > 0) { - Unit::CalcAbsorbResist(this, victim, damageSchoolMask, SPELL_DIRECT_DAMAGE, damage, &damageInfo->absorb, &damageInfo->resist, spellInfo); + Unit::CalcAbsorbResist(this, victim, damageSchoolMask, SPELL_DIRECT_DAMAGE, damage, &damageInfo->absorb, &damageInfo->resist, spellInfo); damage -= damageInfo->absorb + damageInfo->resist; } else damage = 0; - damageInfo->damage = std::max(damage, 0); + damageInfo->damage = std::max(damage, 0); } void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss) @@ -1333,11 +1333,11 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam if (damageInfo->attackType == RANGED_ATTACK) mod += damageInfo->target->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE); else - { + { mod += damageInfo->target->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE); - // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS - mod += (GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, damageInfo->damageSchoolMask) - 1.0f) * 100; + // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS + mod += (GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, damageInfo->damageSchoolMask) - 1.0f) * 100; } uint32 crTypeMask = damageInfo->target->GetCreatureTypeMask(); @@ -1409,9 +1409,9 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam int32 resilienceReduction = damageInfo->damage; - // attackType is checked already for BASE_ATTACK or OFF_ATTACK so it can't be RANGED_ATTACK here - if (CanApplyResilience()) - Unit::ApplyResilience(victim, NULL, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE); + // attackType is checked already for BASE_ATTACK or OFF_ATTACK so it can't be RANGED_ATTACK here + if (CanApplyResilience()) + Unit::ApplyResilience(victim, NULL, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE); resilienceReduction = damageInfo->damage - resilienceReduction; damageInfo->damage -= resilienceReduction; @@ -1422,7 +1422,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam { damageInfo->procVictim |= PROC_FLAG_TAKEN_DAMAGE; // Calculate absorb & resists - Unit::CalcAbsorbResist(this, damageInfo->target, SpellSchoolMask(damageInfo->damageSchoolMask), DIRECT_DAMAGE, damageInfo->damage, &damageInfo->absorb, &damageInfo->resist); + Unit::CalcAbsorbResist(this, damageInfo->target, SpellSchoolMask(damageInfo->damageSchoolMask), DIRECT_DAMAGE, damageInfo->damage, &damageInfo->absorb, &damageInfo->resist); if (damageInfo->absorb) { @@ -1504,13 +1504,13 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) uint32 VictimDefense=victim->GetDefenseSkillValue(); uint32 AttackerMeleeSkill=GetUnitMeleeSkill(); - // xinef: fix daze mechanics + // xinef: fix daze mechanics Probability -= ((float)VictimDefense - AttackerMeleeSkill) * 0.1428f; if (Probability > 40.0f) Probability = 40.0f; - if (roll_chance_f(std::max(0.0f, Probability))) + if (roll_chance_f(std::max(0.0f, Probability))) CastSpell(victim, 1604, true); } @@ -1540,13 +1540,13 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) continue; } - uint32 damage = uint32(std::max(0, (*dmgShieldItr)->GetAmount())); // xinef: done calculated at amount calculation + uint32 damage = uint32(std::max(0, (*dmgShieldItr)->GetAmount())); // xinef: done calculated at amount calculation if (Unit* caster = (*dmgShieldItr)->GetCaster()) damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE); // No Unit::CalcAbsorbResist here - opcode doesn't send that data - this damage is probably not affected by that - Unit::DealDamageMods(this, damage, NULL); + Unit::DealDamageMods(this, damage, NULL); // TODO: Move this to a packet handler WorldPacket data(SMSG_SPELLDAMAGESHIELD, (8+8+4+4+4+4)); @@ -1601,69 +1601,69 @@ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit const* victim, co float armor = float(victim->GetArmor()); // Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura - if (attacker) - { - armor += attacker->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL); + if (attacker) + { + armor += attacker->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL); - if (spellInfo) - if (Player* modOwner = attacker->GetSpellModOwner()) - modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor); + if (spellInfo) + if (Player* modOwner = attacker->GetSpellModOwner()) + modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor); - AuraEffectList const& ResIgnoreAurasAb = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST); - for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j) - { - if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL - && (*j)->IsAffectedOnSpell(spellInfo)) - armor = floor(AddPct(armor, -(*j)->GetAmount())); - } + AuraEffectList const& ResIgnoreAurasAb = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST); + for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j) + { + if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL + && (*j)->IsAffectedOnSpell(spellInfo)) + armor = floor(AddPct(armor, -(*j)->GetAmount())); + } - AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); - for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j) - { - if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) - armor = floor(AddPct(armor, -(*j)->GetAmount())); - } + AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); + for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j) + { + if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) + armor = floor(AddPct(armor, -(*j)->GetAmount())); + } - // Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc. - if (attacker->GetTypeId() == TYPEID_PLAYER) - { - float bonusPct = 0; - AuraEffectList const& armorPenAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); - for (AuraEffectList::const_iterator itr = armorPenAuras.begin(); itr != armorPenAuras.end(); ++itr) - { - if ((*itr)->GetSpellInfo()->EquippedItemClass == -1) - { - if (!spellInfo || (*itr)->IsAffectedOnSpell(spellInfo) || (*itr)->GetMiscValue() & spellInfo->GetSchoolMask()) - bonusPct += (*itr)->GetAmount(); - else if (!(*itr)->GetMiscValue() && !(*itr)->HasSpellClassMask()) - bonusPct += (*itr)->GetAmount(); - } - else - { - if (attacker->ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo())) - bonusPct += (*itr)->GetAmount(); - } - } + // Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc. + if (attacker->GetTypeId() == TYPEID_PLAYER) + { + float bonusPct = 0; + AuraEffectList const& armorPenAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); + for (AuraEffectList::const_iterator itr = armorPenAuras.begin(); itr != armorPenAuras.end(); ++itr) + { + if ((*itr)->GetSpellInfo()->EquippedItemClass == -1) + { + if (!spellInfo || (*itr)->IsAffectedOnSpell(spellInfo) || (*itr)->GetMiscValue() & spellInfo->GetSchoolMask()) + bonusPct += (*itr)->GetAmount(); + else if (!(*itr)->GetMiscValue() && !(*itr)->HasSpellClassMask()) + bonusPct += (*itr)->GetAmount(); + } + else + { + if (attacker->ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo())) + bonusPct += (*itr)->GetAmount(); + } + } - float maxArmorPen = 0; - if (victim->getLevel() < 60) - maxArmorPen = float(400 + 85 * victim->getLevel()); - else - maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59); + float maxArmorPen = 0; + if (victim->getLevel() < 60) + maxArmorPen = float(400 + 85 * victim->getLevel()); + else + maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59); - // Cap armor penetration to this number - maxArmorPen = std::min((armor + maxArmorPen) / 3, armor); - // Figure out how much armor do we ignore - float armorPen = CalculatePct(maxArmorPen, bonusPct + attacker->ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION)); - // Got the value, apply it - armor -= std::min(armorPen, maxArmorPen); - } - } + // Cap armor penetration to this number + maxArmorPen = std::min((armor + maxArmorPen) / 3, armor); + // Figure out how much armor do we ignore + float armorPen = CalculatePct(maxArmorPen, bonusPct + attacker->ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION)); + // Got the value, apply it + armor -= std::min(armorPen, maxArmorPen); + } + } if (armor < 0.0f) armor = 0.0f; - float levelModifier = attacker ? attacker->getLevel() : attackerLevel; + float levelModifier = attacker ? attacker->getLevel() : attackerLevel; if (levelModifier > 59) levelModifier = levelModifier + (4.5f * (levelModifier - 59)); @@ -1683,27 +1683,27 @@ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit const* victim, co float Unit::GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo) { float victimResistance = float(victim->GetResistance(schoolMask)); - if (owner) - { - // Xinef: pets inherit 100% of masters penetration - // Xinef: excluding traps - Player const* player = owner->GetSpellModOwner(); - if (player && owner->GetEntry() != WORLD_TRIGGER) - { - victimResistance += float(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask)); - victimResistance -= float(player->GetSpellPenetrationItemMod()); - } - else - victimResistance += float(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask)); - } + if (owner) + { + // Xinef: pets inherit 100% of masters penetration + // Xinef: excluding traps + Player const* player = owner->GetSpellModOwner(); + if (player && owner->GetEntry() != WORLD_TRIGGER) + { + victimResistance += float(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask)); + victimResistance -= float(player->GetSpellPenetrationItemMod()); + } + else + victimResistance += float(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask)); + } - // Chaos Bolt exception, ignore all target resistances (unknown attribute?) - if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && spellInfo->SpellIconID == 3178) - victimResistance = 0; + // Chaos Bolt exception, ignore all target resistances (unknown attribute?) + if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && spellInfo->SpellIconID == 3178) + victimResistance = 0; victimResistance = std::max(victimResistance, 0.0f); - if (owner) - victimResistance += std::max((float(victim->getLevel())-float(owner->getLevel()))*5.0f, 0.0f); + if (owner) + victimResistance += std::max((float(victim->getLevel())-float(owner->getLevel()))*5.0f, 0.0f); static uint32 const BOSS_LEVEL = 83; @@ -1728,10 +1728,10 @@ void Unit::CalcAbsorbResist(Unit* attacker, Unit* victim, SpellSchoolMask school // Magic damage, check for resists // Ignore spells that cant be resisted - // Xinef: holy resistance exists for npcs - if (!(schoolMask & SPELL_SCHOOL_MASK_NORMAL) && (!(schoolMask & SPELL_SCHOOL_MASK_HOLY) || victim->GetTypeId() == TYPEID_UNIT) && (!spellInfo || (!spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && !spellInfo->HasAttribute(SPELL_ATTR4_IGNORE_RESISTANCES)))) + // Xinef: holy resistance exists for npcs + if (!(schoolMask & SPELL_SCHOOL_MASK_NORMAL) && (!(schoolMask & SPELL_SCHOOL_MASK_HOLY) || victim->GetTypeId() == TYPEID_UNIT) && (!spellInfo || (!spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && !spellInfo->HasAttribute(SPELL_ATTR4_IGNORE_RESISTANCES)))) { - float averageResist = Unit::GetEffectiveResistChance(attacker, schoolMask, victim, spellInfo); + float averageResist = Unit::GetEffectiveResistChance(attacker, schoolMask, victim, spellInfo); float discreteResistProbability[11]; for (uint32 i = 0; i < 11; ++i) @@ -1757,59 +1757,59 @@ void Unit::CalcAbsorbResist(Unit* attacker, Unit* victim, SpellSchoolMask school float damageResisted = float(damage * i / 10); - if (damageResisted) // if equal to 0, checking these is pointless - { - if (attacker) - { - AuraEffectList const& ResIgnoreAurasAb = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST); - for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j) - if (((*j)->GetMiscValue() & schoolMask) && (*j)->IsAffectedOnSpell(spellInfo)) - AddPct(damageResisted, -(*j)->GetAmount()); + if (damageResisted) // if equal to 0, checking these is pointless + { + if (attacker) + { + AuraEffectList const& ResIgnoreAurasAb = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST); + for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j) + if (((*j)->GetMiscValue() & schoolMask) && (*j)->IsAffectedOnSpell(spellInfo)) + AddPct(damageResisted, -(*j)->GetAmount()); - AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); - for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j) - if ((*j)->GetMiscValue() & schoolMask) - AddPct(damageResisted, -(*j)->GetAmount()); - } + AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); + for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j) + if ((*j)->GetMiscValue() & schoolMask) + AddPct(damageResisted, -(*j)->GetAmount()); + } - // pussywizard: - if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC)) - { - uint32 damageAfterArmor = Unit::CalcArmorReducedDamage(attacker, victim, damage, spellInfo, 0, BASE_ATTACK); - uint32 armorReduction = damage - damageAfterArmor; - if (armorReduction < damageResisted) // pick the lower one, the weakest resistance counts - damageResisted = armorReduction; - } - } + // pussywizard: + if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC)) + { + uint32 damageAfterArmor = Unit::CalcArmorReducedDamage(attacker, victim, damage, spellInfo, 0, BASE_ATTACK); + uint32 armorReduction = damage - damageAfterArmor; + if (armorReduction < damageResisted) // pick the lower one, the weakest resistance counts + damageResisted = armorReduction; + } + } dmgInfo.ResistDamage(uint32(damageResisted)); } // Ignore Absorption Auras float auraAbsorbMod = 0; - if (attacker) - { - AuraEffectList const& AbsIgnoreAurasA = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL); - for (AuraEffectList::const_iterator itr = AbsIgnoreAurasA.begin(); itr != AbsIgnoreAurasA.end(); ++itr) - { - if (!((*itr)->GetMiscValue() & schoolMask)) - continue; + if (attacker) + { + AuraEffectList const& AbsIgnoreAurasA = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL); + for (AuraEffectList::const_iterator itr = AbsIgnoreAurasA.begin(); itr != AbsIgnoreAurasA.end(); ++itr) + { + if (!((*itr)->GetMiscValue() & schoolMask)) + continue; - if ((*itr)->GetAmount() > auraAbsorbMod) - auraAbsorbMod = float((*itr)->GetAmount()); - } + if ((*itr)->GetAmount() > auraAbsorbMod) + auraAbsorbMod = float((*itr)->GetAmount()); + } - AuraEffectList const& AbsIgnoreAurasB = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL); - for (AuraEffectList::const_iterator itr = AbsIgnoreAurasB.begin(); itr != AbsIgnoreAurasB.end(); ++itr) - { - if (!((*itr)->GetMiscValue() & schoolMask)) - continue; + AuraEffectList const& AbsIgnoreAurasB = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL); + for (AuraEffectList::const_iterator itr = AbsIgnoreAurasB.begin(); itr != AbsIgnoreAurasB.end(); ++itr) + { + if (!((*itr)->GetMiscValue() & schoolMask)) + continue; - if (((*itr)->GetAmount() > auraAbsorbMod) && (*itr)->IsAffectedOnSpell(spellInfo)) - auraAbsorbMod = float((*itr)->GetAmount()); - } - RoundToInterval(auraAbsorbMod, 0.0f, 100.0f); - } + if (((*itr)->GetAmount() > auraAbsorbMod) && (*itr)->IsAffectedOnSpell(spellInfo)) + auraAbsorbMod = float((*itr)->GetAmount()); + } + RoundToInterval(auraAbsorbMod, 0.0f, 100.0f); + } // We're going to call functions which can modify content of the list during iteration over it's elements // Let's copy the list so we can prevent iterator invalidation @@ -1926,7 +1926,7 @@ void Unit::CalcAbsorbResist(Unit* attacker, Unit* victim, SpellSchoolMask school } // split damage auras - only when not damaging self - // Xinef: not true - Warlock Hellfire + // Xinef: not true - Warlock Hellfire if (/*victim != attacker &&*/ !Splited) { // We're going to call functions which can modify content of the list during iteration over it's elements @@ -1955,28 +1955,28 @@ void Unit::CalcAbsorbResist(Unit* attacker, Unit* victim, SpellSchoolMask school uint32 splitted = splitDamage; uint32 splitted_absorb = 0; - uint32 splitted_resist = 0; + uint32 splitted_resist = 0; - uint32 procAttacker = 0, procVictim = 0, procEx = PROC_EX_NORMAL_HIT; - if (caster->IsImmunedToDamageOrSchool(schoolMask)) - { - procEx |= PROC_EX_IMMUNE; - splitted_absorb = splitted; - splitted = 0; - } - else - { - Unit::DealDamageMods(caster, splitted, &splitted_absorb); - Unit::CalcAbsorbResist(attacker, caster, schoolMask, damagetype, splitted, &splitted_absorb, &splitted_resist, spellInfo, true); - splitted -= std::min(splitted_absorb, splitted); - } + uint32 procAttacker = 0, procVictim = 0, procEx = PROC_EX_NORMAL_HIT; + if (caster->IsImmunedToDamageOrSchool(schoolMask)) + { + procEx |= PROC_EX_IMMUNE; + splitted_absorb = splitted; + splitted = 0; + } + else + { + Unit::DealDamageMods(caster, splitted, &splitted_absorb); + Unit::CalcAbsorbResist(attacker, caster, schoolMask, damagetype, splitted, &splitted_absorb, &splitted_resist, spellInfo, true); + splitted -= std::min(splitted_absorb, splitted); + } - // create procs - createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim); - caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, NULL); + // create procs + createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim); + caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, NULL); - if (attacker) - attacker->SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitted+splitted_absorb, schoolMask, splitted_absorb, 0, false, 0, false); + if (attacker) + attacker->SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo()->Id, splitted+splitted_absorb, schoolMask, splitted_absorb, 0, false, 0, false); CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL); Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false); @@ -2001,50 +2001,50 @@ void Unit::CalcAbsorbResist(Unit* attacker, Unit* victim, SpellSchoolMask school if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive()) continue; - // Xinef: Single Target splits require LoS - const SpellInfo* splitSpellInfo = (*itr)->GetSpellInfo(); - if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect() && !splitSpellInfo->HasAttribute(SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS)) - if (!caster->IsWithinLOSInMap(victim) || !caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster))) - continue; + // Xinef: Single Target splits require LoS + const SpellInfo* splitSpellInfo = (*itr)->GetSpellInfo(); + if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect() && !splitSpellInfo->HasAttribute(SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS)) + if (!caster->IsWithinLOSInMap(victim) || !caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster))) + continue; uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount()); - SpellSchoolMask splitSchoolMask = schoolMask; + SpellSchoolMask splitSchoolMask = schoolMask; (*itr)->GetBase()->CallScriptEffectSplitHandlers(*itr, aurApp, dmgInfo, splitDamage); // absorb must be smaller than the damage itself splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage())); - // Roar of Sacrifice, dont absorb it - if (splitSpellInfo->Id != 53480) - dmgInfo.AbsorbDamage(splitDamage); - else - splitSchoolMask = SPELL_SCHOOL_MASK_NATURE; + // Roar of Sacrifice, dont absorb it + if (splitSpellInfo->Id != 53480) + dmgInfo.AbsorbDamage(splitDamage); + else + splitSchoolMask = SPELL_SCHOOL_MASK_NATURE; uint32 splitted = splitDamage; uint32 splitted_absorb = 0; - uint32 splitted_resist = 0; + uint32 splitted_resist = 0; - uint32 procAttacker = 0, procVictim = 0, procEx = PROC_EX_NORMAL_HIT; - if (caster->IsImmunedToDamageOrSchool(schoolMask)) - { - procEx |= PROC_EX_IMMUNE; - splitted_absorb = splitted; - splitted = 0; - } - else - { - Unit::DealDamageMods(caster, splitted, &splitted_absorb); - Unit::CalcAbsorbResist(attacker, caster, splitSchoolMask, damagetype, splitted, &splitted_absorb, &splitted_resist, spellInfo, true); - splitted -= std::min(splitted_absorb, splitted); - } + uint32 procAttacker = 0, procVictim = 0, procEx = PROC_EX_NORMAL_HIT; + if (caster->IsImmunedToDamageOrSchool(schoolMask)) + { + procEx |= PROC_EX_IMMUNE; + splitted_absorb = splitted; + splitted = 0; + } + else + { + Unit::DealDamageMods(caster, splitted, &splitted_absorb); + Unit::CalcAbsorbResist(attacker, caster, splitSchoolMask, damagetype, splitted, &splitted_absorb, &splitted_resist, spellInfo, true); + splitted -= std::min(splitted_absorb, splitted); + } - // create procs - createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim); - caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, NULL); + // create procs + createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim); + caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, NULL); - if (attacker) - attacker->SendSpellNonMeleeDamageLog(caster, splitSpellInfo->Id, splitted+splitted_absorb, splitSchoolMask, splitted_absorb, 0, false, 0, false); + if (attacker) + attacker->SendSpellNonMeleeDamageLog(caster, splitSpellInfo->Id, splitted+splitted_absorb, splitSchoolMask, splitted_absorb, 0, false, 0, false); CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL); Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, splitSchoolMask, splitSpellInfo, false); @@ -2133,7 +2133,7 @@ void Unit::AttackerStateUpdate (Unit* victim, WeaponAttackType attType, bool ext // melee attack spell casted at main hand attack only - no normal melee dmg dealt if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL] && !extra) - m_currentSpells[CURRENT_MELEE_SPELL]->cast(); + m_currentSpells[CURRENT_MELEE_SPELL]->cast(); else { // attack can be redirected to another target @@ -2142,13 +2142,13 @@ void Unit::AttackerStateUpdate (Unit* victim, WeaponAttackType attType, bool ext CalcDamageInfo damageInfo; CalculateMeleeDamage(victim, 0, &damageInfo, attType); // Send log damage message to client - Unit::DealDamageMods(victim, damageInfo.damage, &damageInfo.absorb); + Unit::DealDamageMods(victim, damageInfo.damage, &damageInfo.absorb); SendAttackStateUpdate(&damageInfo); //TriggerAurasProcOnEvent(damageInfo); DealMeleeDamage(&damageInfo, true); - ProcDamageAndSpell(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, damageInfo.damage, damageInfo.attackType); + ProcDamageAndSpell(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, damageInfo.damage, damageInfo.attackType); /*if (GetTypeId() == TYPEID_PLAYER) ;//sLog->outStaticDebug("AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", @@ -2178,8 +2178,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy // Critical hit chance float crit_chance = GetUnitCriticalChance(attType, victim); - if( crit_chance < 0 ) - crit_chance = 0; + if( crit_chance < 0 ) + crit_chance = 0; float dodge_chance = victim->GetUnitDodgeChance(); float block_chance = victim->GetUnitBlockChance(); @@ -2233,7 +2233,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT { ;//sLog->outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind and victim was a player."); } - // Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag + // Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag else if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_DODGE)) { // Reduce dodge chance by attacker expertise rating @@ -2248,9 +2248,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT tmp = dodge_chance; - // xinef: if casting or stunned - cant dodge - if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) - tmp = 0; + // xinef: if casting or stunned - cant dodge + if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) + tmp = 0; if ((tmp > 0) // check if unit _can_ dodge && ((tmp -= skillBonus) > 0) @@ -2278,9 +2278,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT { tmp = parry_chance; - // xinef: cant parry while casting or while stunned - if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) - tmp = 0; + // xinef: cant parry while casting or while stunned + if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) + tmp = 0; if (tmp > 0 // check if unit _can_ parry && (tmp -= skillBonus) > 0 @@ -2295,9 +2295,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT { tmp = block_chance; - // xinef: cant block while casting or while stunned - if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) - tmp = 0; + // xinef: cant block while casting or while stunned + if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) + tmp = 0; if (tmp > 0 // check if unit _can_ block && (tmp -= skillBonus) > 0 @@ -2410,15 +2410,15 @@ uint32 Unit::CalculateDamage(WeaponAttackType attType, bool normalized, bool add float Unit::CalculateLevelPenalty(SpellInfo const* spellProto) const { - if (GetTypeId() != TYPEID_PLAYER) - return 1.0f; + if (GetTypeId() != TYPEID_PLAYER) + return 1.0f; if (spellProto->SpellLevel <= 0 || spellProto->SpellLevel >= spellProto->MaxLevel) return 1.0f; float LvlPenalty = 0.0f; - // xinef: added brackets, trinity retards... + // xinef: added brackets, trinity retards... if (spellProto->SpellLevel < 20) LvlPenalty = (20.0f - spellProto->SpellLevel) * 3.75f; @@ -2443,9 +2443,9 @@ void Unit::SendMeleeAttackStart(Unit* victim, Player* sendTo) void Unit::SendMeleeAttackStop(Unit* victim) { - // pussywizard: calling SendMeleeAttackStop without clearing UNIT_STATE_MELEE_ATTACKING and then AttackStart the same player may spoil npc rotating! - // pussywizard: this happens in some boss scripts, just add clearing here - // ClearUnitState(UNIT_STATE_MELEE_ATTACKING); // ZOMG! commented out for now + // pussywizard: calling SendMeleeAttackStop without clearing UNIT_STATE_MELEE_ATTACKING and then AttackStart the same player may spoil npc rotating! + // pussywizard: this happens in some boss scripts, just add clearing here + // ClearUnitState(UNIT_STATE_MELEE_ATTACKING); // ZOMG! commented out for now WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); data.append(GetPackGUID()); @@ -2476,7 +2476,7 @@ bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttac float blockChance = victim->GetUnitBlockChance(); blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(victim->GetMaxSkillValueForLevel())) * 0.04f; - // xinef: cant block while casting or while stunned + // xinef: cant block while casting or while stunned if (blockChance < 0.0f || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) blockChance = 0.0f; @@ -2564,7 +2564,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) if (attType == RANGED_ATTACK) { // only if in front - if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI,this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))) + if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI,this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))) { int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100; tmp+=deflect_chance; @@ -2572,12 +2572,12 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) return SPELL_MISS_DEFLECT; } - canDodge = false; - canParry = false; + canDodge = false; + canParry = false; } // Check for attack from behind - // xinef: if from behind or spell requires cast from behind + // xinef: if from behind or spell requires cast from behind if (!victim->HasInArc(M_PI, this) || spell->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET)) { if (!victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) @@ -2595,9 +2595,9 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) if (victim->GetTypeId() == TYPEID_UNIT) { uint32 flagEx = victim->ToCreature()->GetCreatureTemplate()->flags_extra; - // Xinef: no dodge flag - if (flagEx & CREATURE_FLAG_EXTRA_NO_DODGE) - canDodge = false; + // Xinef: no dodge flag + if (flagEx & CREATURE_FLAG_EXTRA_NO_DODGE) + canDodge = false; if (flagEx & CREATURE_FLAG_EXTRA_NO_PARRY) canParry = false; // Check creatures flags_extra for disable block @@ -2634,11 +2634,11 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) else dodgeChance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25; - // xinef: cant dodge while casting or while stunned + // xinef: cant dodge while casting or while stunned if (dodgeChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) dodgeChance = 0; - tmp += dodgeChance; + tmp += dodgeChance; if (roll < tmp) return SPELL_MISS_DODGE; } @@ -2653,7 +2653,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) else parryChance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25; - // xinef: cant parry while casting or while stunned + // xinef: cant parry while casting or while stunned if (parryChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) parryChance = 0; @@ -2666,7 +2666,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) { int32 blockChance = int32(victim->GetUnitBlockChance() * 100.0f) - skillDiff * 4; - // xinef: cant block while casting or while stunned + // xinef: cant block while casting or while stunned if (blockChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED)) blockChance = 0; @@ -2684,17 +2684,17 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) if (!victim->IsAlive() && victim->GetTypeId() != TYPEID_PLAYER) return SPELL_MISS_NONE; - // vehicles cant miss - if (IsVehicle()) - return SPELL_MISS_NONE; + // vehicles cant miss + if (IsVehicle()) + return SPELL_MISS_NONE; - // Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will additionally fully ignore + // Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will additionally fully ignore // resist and deflect chances // xinef: skip all calculations, proof: Toxic Tolerance quest if (spell->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT)) return SPELL_MISS_NONE; - SpellSchoolMask schoolMask = spell->GetSchoolMask(); + SpellSchoolMask schoolMask = spell->GetSchoolMask(); // PvP - PvE spell misschances per leveldif > 2 int32 lchance = victim->GetTypeId() == TYPEID_PLAYER ? 7 : 11; int32 thisLevel = getLevelForTarget(victim); @@ -2717,7 +2717,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) modHitChance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT, schoolMask); // Spells with SPELL_ATTR3_IGNORE_HIT_RESULT will ignore target's avoidance effects - // xinef: imo it should completly ignore all calculations, eg: 14792. Hits 80 level players on blizz without any problems + // xinef: imo it should completly ignore all calculations, eg: 14792. Hits 80 level players on blizz without any problems //if (!spell->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT)) { // Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras @@ -2733,13 +2733,13 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) int32 HitChance = modHitChance * 100; // Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings - // Xinef: Totems should inherit casters ratings? - if (IsTotem()) - { - if (Unit* owner = GetOwner()) - HitChance += int32(owner->m_modSpellHitChance * 100.0f); - } - else + // Xinef: Totems should inherit casters ratings? + if (IsTotem()) + { + if (Unit* owner = GetOwner()) + HitChance += int32(owner->m_modSpellHitChance * 100.0f); + } + else HitChance += int32(m_modSpellHitChance * 100.0f); if (HitChance < 100) @@ -2764,8 +2764,8 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) bool bNegativeAura = true; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - // Xinef: Check if effect exists! - if (spell->Effects[i].IsEffect() && spell->Effects[i].ApplyAuraName == 0) + // Xinef: Check if effect exists! + if (spell->Effects[i].IsEffect() && spell->Effects[i].ApplyAuraName == 0) { bNegativeAura = false; break; @@ -2778,9 +2778,9 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spell) tmp += victim->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spell->Dispel)) * 100; } - // Players resistance for binary spells - if (spell->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && (spell->GetSchoolMask() & (SPELL_SCHOOL_MASK_NORMAL|SPELL_SCHOOL_MASK_HOLY)) == 0) - tmp += int32(Unit::GetEffectiveResistChance(this, spell->GetSchoolMask(), victim, spell) * 10000.0f); // 100 for spell calculations, and 100 for return value percentage + // Players resistance for binary spells + if (spell->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && (spell->GetSchoolMask() & (SPELL_SCHOOL_MASK_NORMAL|SPELL_SCHOOL_MASK_HOLY)) == 0) + tmp += int32(Unit::GetEffectiveResistChance(this, spell->GetSchoolMask(), victim, spell) * 10000.0f); // 100 for spell calculations, and 100 for return value percentage } // Roll chance @@ -2820,7 +2820,7 @@ SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spell, bool Ca return SPELL_MISS_NONE; // Check for immune - // xinef: check for school immunity only + // xinef: check for school immunity only if (victim->IsImmunedToSchool(spell)) return SPELL_MISS_IMMUNE; @@ -2853,16 +2853,16 @@ SpellMissInfo Unit::SpellHitResult(Unit* victim, SpellInfo const* spell, bool Ca case SPELL_DAMAGE_CLASS_MELEE: return MeleeSpellHitResult(victim, spell); case SPELL_DAMAGE_CLASS_NONE: - { - if (spell->SpellFamilyName) - return SPELL_MISS_NONE; - // Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells - for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) - if (spell->Effects[i].Effect && spell->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE) - if (spell->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE) - return SPELL_MISS_NONE; - // no break intended - } + { + if (spell->SpellFamilyName) + return SPELL_MISS_NONE; + // Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells + for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) + if (spell->Effects[i].Effect && spell->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE) + if (spell->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE) + return SPELL_MISS_NONE; + // no break intended + } case SPELL_DAMAGE_CLASS_MAGIC: return MagicSpellHitResult(victim, spell); } @@ -2894,7 +2894,7 @@ float Unit::GetUnitDodgeChance() const return 0.0f; else { - float dodge = ToCreature()->isWorldBoss() ? 5.85f : 5.0f; // Xinef: bosses should have 6.5% dodge (5.9 + 0.6 from defense skill difference) + float dodge = ToCreature()->isWorldBoss() ? 5.85f : 5.0f; // Xinef: bosses should have 6.5% dodge (5.9 + 0.6 from defense skill difference) dodge += GetTotalAuraModifier(SPELL_AURA_MOD_DODGE_PERCENT); return dodge > 0.0f ? dodge : 0.0f; } @@ -2919,12 +2919,12 @@ float Unit::GetUnitParryChance() const } else if (GetTypeId() == TYPEID_UNIT) { - if (ToCreature()->isWorldBoss()) - chance = 13.4f; // + 0.6 by skill diff + if (ToCreature()->isWorldBoss()) + chance = 13.4f; // + 0.6 by skill diff else if (GetCreatureType() == CREATURE_TYPE_HUMANOID) chance = 5.0f; - // Xinef: if aura is present, type should not matter + // Xinef: if aura is present, type should not matter chance += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT); } @@ -3008,26 +3008,26 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit* victi else crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE); - AuraEffectList const& mTotalAuraList = victim->GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER); - for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - { - if (GetGUID() != (*i)->GetCasterGUID()) - continue; + AuraEffectList const& mTotalAuraList = victim->GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER); + for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) + { + if (GetGUID() != (*i)->GetCasterGUID()) + continue; - crit += (*i)->GetAmount(); - } + crit += (*i)->GetAmount(); + } // reduce crit chance from Rating for players if (attackType != RANGED_ATTACK) - Unit::ApplyResilience(victim, &crit, NULL, false, CR_CRIT_TAKEN_MELEE); + Unit::ApplyResilience(victim, &crit, NULL, false, CR_CRIT_TAKEN_MELEE); else - Unit::ApplyResilience(victim, &crit, NULL, false, CR_CRIT_TAKEN_RANGED); + Unit::ApplyResilience(victim, &crit, NULL, false, CR_CRIT_TAKEN_RANGED); // Apply crit chance from defence skill crit += (int32(GetMaxSkillValueForLevel(victim)) - int32(victim->GetDefenseSkillValue(this))) * 0.04f; - // xinef: SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE should be calculated at the end - crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE); + // xinef: SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE should be calculated at the end + crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE); if (crit < 0.0f) crit = 0.0f; @@ -3125,16 +3125,16 @@ void Unit::_UpdateSpells(uint32 time) { for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();) { - if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr)) - if (!go->isSpawned()) - { - go->SetOwnerGUID(0); - go->SetRespawnTime(0); - go->Delete(); - m_gameObj.erase(itr++); - continue; - } - ++itr; + if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr)) + if (!go->isSpawned()) + { + go->SetOwnerGUID(0); + go->SetRespawnTime(0); + go->Delete(); + m_gameObj.erase(itr++); + continue; + } + ++itr; } } } @@ -3222,7 +3222,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); AddUnitState(UNIT_STATE_CASTING); - break; + break; } case CURRENT_AUTOREPEAT_SPELL: { @@ -3236,7 +3236,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) // special action: set first cast flag m_AutoRepeatFirstCast = true; - break; + break; } default: @@ -3263,7 +3263,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi Spell* spell = m_currentSpells[spellType]; if (spell && (withDelayed || spell->getState() != SPELL_STATE_DELAYED) - && (withInstant || spell->GetCastTime() > 0 || spell->getState() == SPELL_STATE_CASTING)) // xinef: or spell is in casting state (channeled spells only) + && (withInstant || spell->GetCastTime() > 0 || spell->getState() == SPELL_STATE_CASTING)) // xinef: or spell is in casting state (channeled spells only) { // for example, do not let self-stun aura interrupt itself if (!spell->IsInterruptable()) @@ -3366,317 +3366,317 @@ bool Unit::isInBackInMap(Unit const* target, float distance, float arc) const bool Unit::isInAccessiblePlaceFor(Creature const* c) const { - if (c->GetMapId() == 618) // Ring of Valor - { - // skip transport check, check for being below floor level - if (this->GetPositionZ() < 28.0f) - return false; - if (BattlegroundMap* bgMap = c->GetMap()->ToBattlegroundMap()) - if (Battleground* bg = bgMap->GetBG()) - if (bg->GetStartTime() < 80133) // 60000ms preparation time + 20133ms elevator rise time - return false; - } - else if (c->GetMapId() == 631) // Icecrown Citadel - { - // if static transport doesn't match - return false - if (c->GetTransport() != this->GetTransport() && (c->GetTransport() && c->GetTransport()->IsStaticTransport() || this->GetTransport() && this->GetTransport()->IsStaticTransport())) - return false; + if (c->GetMapId() == 618) // Ring of Valor + { + // skip transport check, check for being below floor level + if (this->GetPositionZ() < 28.0f) + return false; + if (BattlegroundMap* bgMap = c->GetMap()->ToBattlegroundMap()) + if (Battleground* bg = bgMap->GetBG()) + if (bg->GetStartTime() < 80133) // 60000ms preparation time + 20133ms elevator rise time + return false; + } + else if (c->GetMapId() == 631) // Icecrown Citadel + { + // if static transport doesn't match - return false + if (c->GetTransport() != this->GetTransport() && (c->GetTransport() && c->GetTransport()->IsStaticTransport() || this->GetTransport() && this->GetTransport()->IsStaticTransport())) + return false; - // special handling for ICC (map 631), for non-flying pets in Gunship Battle, for trash npcs this is done via CanAIAttack - if (IS_PLAYER_GUID(c->GetOwnerGUID()) && !c->CanFly()) - { - if (c->GetTransport() && !this->GetTransport() || !c->GetTransport() && this->GetTransport()) - return false; - if (this->GetTransport()) - { - if (c->GetPositionY() < 2033.0f) - { - if (this->GetPositionY() > 2033.0f) - return false; - } - else if (c->GetPositionY() < 2438.0f) - { - if (this->GetPositionY() < 2033.0f || this->GetPositionY() > 2438.0f) - return false; - } - else if (this->GetPositionY() < 2438.0f) - return false; - } - } - } - else - { - // pussywizard: prevent any bugs by passengers exiting transports or normal creatures flying away - if (c->GetTransport() != this->GetTransport()) - return false; - } + // special handling for ICC (map 631), for non-flying pets in Gunship Battle, for trash npcs this is done via CanAIAttack + if (IS_PLAYER_GUID(c->GetOwnerGUID()) && !c->CanFly()) + { + if (c->GetTransport() && !this->GetTransport() || !c->GetTransport() && this->GetTransport()) + return false; + if (this->GetTransport()) + { + if (c->GetPositionY() < 2033.0f) + { + if (this->GetPositionY() > 2033.0f) + return false; + } + else if (c->GetPositionY() < 2438.0f) + { + if (this->GetPositionY() < 2033.0f || this->GetPositionY() > 2438.0f) + return false; + } + else if (this->GetPositionY() < 2438.0f) + return false; + } + } + } + else + { + // pussywizard: prevent any bugs by passengers exiting transports or normal creatures flying away + if (c->GetTransport() != this->GetTransport()) + return false; + } if (IsInWater()) - return IsUnderWater() ? c->CanSwim() : (c->CanSwim() || c->CanFly()); + return IsUnderWater() ? c->CanSwim() : (c->CanSwim() || c->CanFly()); else return c->CanWalk() || c->CanFly() || (c->CanSwim() && IsInWater(true)); } void Unit::UpdateEnvironmentIfNeeded(const uint8 option) { - if (m_is_updating_environment) - return; + if (m_is_updating_environment) + return; - if (GetTypeId() != TYPEID_UNIT || !IsAlive() || (!IsInWorld() && option != 3) || !FindMap() || IsDuringRemoveFromWorld() || !IsPositionValid()) - return; + if (GetTypeId() != TYPEID_UNIT || !IsAlive() || (!IsInWorld() && option != 3) || !FindMap() || IsDuringRemoveFromWorld() || !IsPositionValid()) + return; - if (option <= 2 && GetMotionMaster()->GetCleanFlags() != MMCF_NONE) - { - if (option == 2) - m_last_environment_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); - return; - } + if (option <= 2 && GetMotionMaster()->GetCleanFlags() != MMCF_NONE) + { + if (option == 2) + m_last_environment_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + return; + } - if (option <= 1 && GetExactDistSq(&m_last_environment_position) < 2.5f*2.5f) - return; - m_last_environment_position.Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); + if (option <= 1 && GetExactDistSq(&m_last_environment_position) < 2.5f*2.5f) + return; + m_last_environment_position.Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); - m_is_updating_environment = true; + m_is_updating_environment = true; - bool changed = false; - Creature* c = this->ToCreature(); - Map* baseMap = const_cast(GetBaseMap()); - if (!c || !baseMap) - { - m_is_updating_environment = false; - return; - } + bool changed = false; + Creature* c = this->ToCreature(); + Map* baseMap = const_cast(GetBaseMap()); + if (!c || !baseMap) + { + m_is_updating_environment = false; + return; + } - bool canChangeFlying = option == 3 || ((c->GetScriptId() == 0 || GetInstanceId() == 0) && GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE); - bool canFallGround = option == 0 && canChangeFlying && GetInstanceId() == 0 && !IsInCombat() && !GetVehicle() && !GetTransport() && !HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !c->IsTrigger() && !c->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && GetMotionMaster()->GetCurrentMovementGeneratorType() <= RANDOM_MOTION_TYPE && !HasUnitState(UNIT_STATE_EVADE) && !IsControlledByPlayer(); - float x = GetPositionX(), y = GetPositionY(), z = GetPositionZ(); - bool isInAir = true; - float ground_z = z; - LiquidData liquidData; liquidData.level = INVALID_HEIGHT; + bool canChangeFlying = option == 3 || ((c->GetScriptId() == 0 || GetInstanceId() == 0) && GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE); + bool canFallGround = option == 0 && canChangeFlying && GetInstanceId() == 0 && !IsInCombat() && !GetVehicle() && !GetTransport() && !HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && !c->IsTrigger() && !c->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && GetMotionMaster()->GetCurrentMovementGeneratorType() <= RANDOM_MOTION_TYPE && !HasUnitState(UNIT_STATE_EVADE) && !IsControlledByPlayer(); + float x = GetPositionX(), y = GetPositionY(), z = GetPositionZ(); + bool isInAir = true; + float ground_z = z; + LiquidData liquidData; liquidData.level = INVALID_HEIGHT; - ZLiquidStatus liquidStatus = baseMap->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquidData); + ZLiquidStatus liquidStatus = baseMap->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquidData); - // IsInWater - bool enoughWater = (liquidData.level > INVALID_HEIGHT && liquidData.level > liquidData.depth_level && liquidData.level-liquidData.depth_level >= 1.5f); // also check if theres enough water - at least 2yd - m_last_isinwater_status = (liquidStatus & (LIQUID_MAP_IN_WATER|LIQUID_MAP_UNDER_WATER)) && enoughWater; - m_last_islittleabovewater_status = (liquidData.level > INVALID_HEIGHT && liquidData.level > liquidData.depth_level && liquidData.level <= z+3.0f && liquidData.level > z-1.0f); + // IsInWater + bool enoughWater = (liquidData.level > INVALID_HEIGHT && liquidData.level > liquidData.depth_level && liquidData.level-liquidData.depth_level >= 1.5f); // also check if theres enough water - at least 2yd + m_last_isinwater_status = (liquidStatus & (LIQUID_MAP_IN_WATER|LIQUID_MAP_UNDER_WATER)) && enoughWater; + m_last_islittleabovewater_status = (liquidData.level > INVALID_HEIGHT && liquidData.level > liquidData.depth_level && liquidData.level <= z+3.0f && liquidData.level > z-1.0f); - // IsUnderWater - m_last_isunderwater_status = (liquidStatus & LIQUID_MAP_UNDER_WATER) && enoughWater; + // IsUnderWater + m_last_isunderwater_status = (liquidStatus & LIQUID_MAP_UNDER_WATER) && enoughWater; - // UpdateUnderwaterState - if (IsPet() || IsVehicle()) - { - if (option == 1) // Unit::IsInWater, Unit::IsUnderwater, adding/removing auras can cause crashes (eg threat change while iterating threat table), so skip - m_last_environment_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); - else - { - if (!liquidStatus) - { - if (_lastLiquid && _lastLiquid->SpellId) - RemoveAurasDueToSpell(_lastLiquid->SpellId); + // UpdateUnderwaterState + if (IsPet() || IsVehicle()) + { + if (option == 1) // Unit::IsInWater, Unit::IsUnderwater, adding/removing auras can cause crashes (eg threat change while iterating threat table), so skip + m_last_environment_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + else + { + if (!liquidStatus) + { + if (_lastLiquid && _lastLiquid->SpellId) + RemoveAurasDueToSpell(_lastLiquid->SpellId); - RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); - _lastLiquid = NULL; - } - else if (uint32 liqEntry = liquidData.entry) - { - LiquidTypeEntry const* liquid = sLiquidTypeStore.LookupEntry(liqEntry); - if (_lastLiquid && _lastLiquid->SpellId && _lastLiquid->Id != liqEntry) - RemoveAurasDueToSpell(_lastLiquid->SpellId); + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); + _lastLiquid = NULL; + } + else if (uint32 liqEntry = liquidData.entry) + { + LiquidTypeEntry const* liquid = sLiquidTypeStore.LookupEntry(liqEntry); + if (_lastLiquid && _lastLiquid->SpellId && _lastLiquid->Id != liqEntry) + RemoveAurasDueToSpell(_lastLiquid->SpellId); - if (liquid && liquid->SpellId) - { - if (liquidStatus & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER)) - { - if (!HasAura(liquid->SpellId)) - CastSpell(this, liquid->SpellId, true); - } - else - RemoveAurasDueToSpell(liquid->SpellId); - } + if (liquid && liquid->SpellId) + { + if (liquidStatus & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER)) + { + if (!HasAura(liquid->SpellId)) + CastSpell(this, liquid->SpellId, true); + } + else + RemoveAurasDueToSpell(liquid->SpellId); + } - RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_ABOVEWATER); - _lastLiquid = liquid; - } - else if (_lastLiquid && _lastLiquid->SpellId) - { - RemoveAurasDueToSpell(_lastLiquid->SpellId); - RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); - _lastLiquid = NULL; - } - } - } + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_ABOVEWATER); + _lastLiquid = liquid; + } + else if (_lastLiquid && _lastLiquid->SpellId) + { + RemoveAurasDueToSpell(_lastLiquid->SpellId); + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_NOT_UNDERWATER); + _lastLiquid = NULL; + } + } + } - bool flyingBarelyInWater = false; - // Refresh being in water - if (m_last_isinwater_status) - { - if (!c->CanFly() || z < liquidData.level-2.0f) - { - if (!HasUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD) && c->CanSwim() && (!HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) || !HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY))) - { - SetSwim(true); - SetDisableGravity(true); - changed = true; - } - isInAir = false; - } - else - { - m_last_isinwater_status = false; - flyingBarelyInWater = true; - } - } + bool flyingBarelyInWater = false; + // Refresh being in water + if (m_last_isinwater_status) + { + if (!c->CanFly() || z < liquidData.level-2.0f) + { + if (!HasUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD) && c->CanSwim() && (!HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) || !HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY))) + { + SetSwim(true); + SetDisableGravity(true); + changed = true; + } + isInAir = false; + } + else + { + m_last_isinwater_status = false; + flyingBarelyInWater = true; + } + } - if (!m_last_isinwater_status) - { - if (!HasUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD) && c->CanWalk() && HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING)) - { - SetSwim(false); - if (!c->CanFly()) // if can fly, this will be removed below if needed - SetDisableGravity(false); - changed = true; - } - } + if (!m_last_isinwater_status) + { + if (!HasUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD) && c->CanWalk() && HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING)) + { + SetSwim(false); + if (!c->CanFly()) // if can fly, this will be removed below if needed + SetDisableGravity(false); + changed = true; + } + } - // if not in water, check whether in air or not - if (isInAir) - { - if (GetMap()->GetGrid(x, y)) - { - float temp = GetMap()->GetHeight(GetPhaseMask(), x, y, z, true, 100.0f); - if (temp > INVALID_HEIGHT) - { - ground_z = (c->CanSwim() && liquidData.level > INVALID_HEIGHT) ? liquidData.level : temp; - isInAir = flyingBarelyInWater || G3D::fuzzyGt(z, ground_z + 0.75f) || G3D::fuzzyLt(z, ground_z - 0.5f); - } - else - isInAir = true; - } - else - { - m_is_updating_environment = false; - return; - } - } + // if not in water, check whether in air or not + if (isInAir) + { + if (GetMap()->GetGrid(x, y)) + { + float temp = GetMap()->GetHeight(GetPhaseMask(), x, y, z, true, 100.0f); + if (temp > INVALID_HEIGHT) + { + ground_z = (c->CanSwim() && liquidData.level > INVALID_HEIGHT) ? liquidData.level : temp; + isInAir = flyingBarelyInWater || G3D::fuzzyGt(z, ground_z + 0.75f) || G3D::fuzzyLt(z, ground_z - 0.5f); + } + else + isInAir = true; + } + else + { + m_is_updating_environment = false; + return; + } + } - if (!HasUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD) && canChangeFlying) - { - // xinef: summoned vehicles are treated as always in air, fixes flying on such units - if (IsVehicle() && !c->GetDBTableGUIDLow()) - isInAir = true; + if (!HasUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD) && canChangeFlying) + { + // xinef: summoned vehicles are treated as always in air, fixes flying on such units + if (IsVehicle() && !c->GetDBTableGUIDLow()) + isInAir = true; - // xinef: triggers with inhabit type air are treated as always in air - if (c->IsTrigger() && c->CanFly()) - isInAir = true; + // xinef: triggers with inhabit type air are treated as always in air + if (c->IsTrigger() && c->CanFly()) + isInAir = true; - if (IS_PLAYER_GUID(c->GetOwnerGUID()) && c->CanFly() && IsVehicle() && !c->GetDBTableGUIDLow()) // mainly for oculus drakes - { - if (!HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY) || !HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY)) - { - SetCanFly(true); - SetDisableGravity(true); - changed = true; - } - } - else if (c->CanFly() && isInAir) - { - if (!c->IsFalling() && (!HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY) || !HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY) /*|| !HasUnitMovementFlag(MOVEMENTFLAG_HOVER)*/)) - { - SetCanFly(true); - SetDisableGravity(true); - //SetHover(true); - changed = true; - } - } - else - { - if (HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY) || HasUnitMovementFlag(MOVEMENTFLAG_FLYING) /*|| HasUnitMovementFlag(MOVEMENTFLAG_HOVER)*/) - { - SetCanFly(false); - RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING); - //SetHover(false); - changed = true; - } - if (HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY) && !HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) /*&& !HasUnitMovementFlag(MOVEMENTFLAG_HOVER)*/) - { - SetDisableGravity(false); - changed = true; - } - } + if (IS_PLAYER_GUID(c->GetOwnerGUID()) && c->CanFly() && IsVehicle() && !c->GetDBTableGUIDLow()) // mainly for oculus drakes + { + if (!HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY) || !HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY)) + { + SetCanFly(true); + SetDisableGravity(true); + changed = true; + } + } + else if (c->CanFly() && isInAir) + { + if (!c->IsFalling() && (!HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY) || !HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY) /*|| !HasUnitMovementFlag(MOVEMENTFLAG_HOVER)*/)) + { + SetCanFly(true); + SetDisableGravity(true); + //SetHover(true); + changed = true; + } + } + else + { + if (HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY) || HasUnitMovementFlag(MOVEMENTFLAG_FLYING) /*|| HasUnitMovementFlag(MOVEMENTFLAG_HOVER)*/) + { + SetCanFly(false); + RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING); + //SetHover(false); + changed = true; + } + if (HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY) && !HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) /*&& !HasUnitMovementFlag(MOVEMENTFLAG_HOVER)*/) + { + SetDisableGravity(false); + changed = true; + } + } - if (isInAir && !c->CanFly() && option >= 2) - m_last_environment_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); - } + if (isInAir && !c->CanFly() && option >= 2) + m_last_environment_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f); + } - if (!isInAir && HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) + if (!isInAir && HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING); - if (changed) - propagateSpeedChange(); + if (changed) + propagateSpeedChange(); - if (!HasUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD) && canFallGround && !c->CanFly() && !c->IsFalling() && !m_last_isinwater_status && (c->GetUnitMovementFlags()&(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_DISABLE_GRAVITY|MOVEMENTFLAG_HOVER|MOVEMENTFLAG_SWIMMING)) == 0 && z - ground_z > 5.0f && z-ground_z < 80.0f) - GetMotionMaster()->MoveFall(); + if (!HasUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD) && canFallGround && !c->CanFly() && !c->IsFalling() && !m_last_isinwater_status && (c->GetUnitMovementFlags()&(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_DISABLE_GRAVITY|MOVEMENTFLAG_HOVER|MOVEMENTFLAG_SWIMMING)) == 0 && z - ground_z > 5.0f && z-ground_z < 80.0f) + GetMotionMaster()->MoveFall(); - m_is_updating_environment = false; + m_is_updating_environment = false; } SafeUnitPointer::~SafeUnitPointer() { - if (ptr != defaultValue && ptr) ptr->RemovePointedBy(this); - ptr = defaultValue; + if (ptr != defaultValue && ptr) ptr->RemovePointedBy(this); + ptr = defaultValue; } void SafeUnitPointer::SetPointedTo(Unit* u) { - if (ptr != defaultValue && ptr) ptr->RemovePointedBy(this); - ptr = u; - if (ptr != defaultValue && ptr) ptr->AddPointedBy(this); + if (ptr != defaultValue && ptr) ptr->RemovePointedBy(this); + ptr = u; + if (ptr != defaultValue && ptr) ptr->AddPointedBy(this); } void SafeUnitPointer::UnitDeleted() { - sLog->outMisc("SafeUnitPointer::UnitDeleted !!!"); - if (defaultValue) - { - if (Player* p = defaultValue->ToPlayer()) - { - sLog->outMisc("SafeUnitPointer::UnitDeleted (A1) - %u, %u, %u, %u, %u, %u, %u, %u", p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); - if (ptr) - sLog->outMisc("SafeUnitPointer::UnitDeleted (A2)"); + sLog->outMisc("SafeUnitPointer::UnitDeleted !!!"); + if (defaultValue) + { + if (Player* p = defaultValue->ToPlayer()) + { + sLog->outMisc("SafeUnitPointer::UnitDeleted (A1) - %u, %u, %u, %u, %u, %u, %u, %u", p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); + if (ptr) + sLog->outMisc("SafeUnitPointer::UnitDeleted (A2)"); - p->GetSession()->KickPlayer(); - } - } - else if (ptr) - sLog->outMisc("SafeUnitPointer::UnitDeleted (B1)"); + p->GetSession()->KickPlayer(); + } + } + else if (ptr) + sLog->outMisc("SafeUnitPointer::UnitDeleted (B1)"); - ptr = defaultValue; + ptr = defaultValue; } void Unit::HandleSafeUnitPointersOnDelete(Unit* thisUnit) { - if (thisUnit->SafeUnitPointerSet.empty()) - return; - for (std::set::iterator itr = thisUnit->SafeUnitPointerSet.begin(); itr != thisUnit->SafeUnitPointerSet.end(); ++itr) - (*itr)->UnitDeleted(); - thisUnit->SafeUnitPointerSet.clear(); + if (thisUnit->SafeUnitPointerSet.empty()) + return; + for (std::set::iterator itr = thisUnit->SafeUnitPointerSet.begin(); itr != thisUnit->SafeUnitPointerSet.end(); ++itr) + (*itr)->UnitDeleted(); + thisUnit->SafeUnitPointerSet.clear(); - ACE_Stack_Trace trace(0, 50); - sLog->outMisc("Unit::HandleSafeUnitPointersOnDelete CALL STACK (1):\n%s\n", trace.c_str()); + ACE_Stack_Trace trace(0, 50); + sLog->outMisc("Unit::HandleSafeUnitPointersOnDelete CALL STACK (1):\n%s\n", trace.c_str()); } bool Unit::IsInWater(bool allowAbove) const { - const_cast(this)->UpdateEnvironmentIfNeeded(1); - return m_last_isinwater_status || allowAbove && m_last_islittleabovewater_status; + const_cast(this)->UpdateEnvironmentIfNeeded(1); + return m_last_isinwater_status || allowAbove && m_last_islittleabovewater_status; } bool Unit::IsUnderWater() const { - const_cast(this)->UpdateEnvironmentIfNeeded(1); - return m_last_isunderwater_status; + const_cast(this)->UpdateEnvironmentIfNeeded(1); + return m_last_isunderwater_status; } void Unit::UpdateUnderwaterState(Map* m, float x, float y, float z) @@ -3694,9 +3694,9 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 if (!casterGUID) casterGUID = caster->GetGUID(); - // Xinef: Hax for mixology, best solution qq - if (sSpellMgr->GetSpellGroup(newAura->Id) == 1) - return NULL; + // Xinef: Hax for mixology, best solution qq + if (sSpellMgr->GetSpellGroup(newAura->Id) == 1) + return NULL; // passive and Incanter's Absorption and auras with different type can stack with themselves any number of times if (!newAura->IsMultiSlotAura()) @@ -3800,7 +3800,7 @@ AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask) uint32 aurId = aurSpellInfo->Id; // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load) - // Xinef: Added IsAllowingDeadTarget check + // Xinef: Added IsAllowingDeadTarget check if (!IsAlive() && !aurSpellInfo->IsDeathPersistent() && !aurSpellInfo->IsAllowingDeadTarget() && (GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetSession()->PlayerLoading())) return NULL; @@ -3809,8 +3809,8 @@ AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask) AuraApplication * aurApp = new AuraApplication(this, caster, aura, effMask); m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp)); - // xinef: do not insert our application to interruptible list if application target is not the owner (area auras) - // xinef: even if it gets removed, it will be reapplied in a second + // xinef: do not insert our application to interruptible list if application target is not the owner (area auras) + // xinef: even if it gets removed, it will be reapplied in a second if (aurSpellInfo->AuraInterruptFlags && this == aura->GetOwner()) { m_interruptableAuras.push_back(aurApp); @@ -3847,26 +3847,26 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask) if (aurApp->GetRemoveMode()) return; - Unit * caster = aura->GetCaster(); + Unit * caster = aura->GetCaster(); // Update target aura state flag - const SpellInfo* spellInfo = aura->GetSpellInfo(); + const SpellInfo* spellInfo = aura->GetSpellInfo(); if (AuraStateType aState = spellInfo->GetAuraState()) - { - if (aState != AURA_STATE_CONFLAGRATE) - { - // Sting (hunter's pet ability), Faerie Fire (druid versions) - if (aState == AURA_STATE_FAERIE_FIRE) - aurApp->GetTarget()->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); + { + if (aState != AURA_STATE_CONFLAGRATE) + { + // Sting (hunter's pet ability), Faerie Fire (druid versions) + if (aState == AURA_STATE_FAERIE_FIRE) + aurApp->GetTarget()->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); - ModifyAuraState(aState, true); - } - else if (caster) - { - ConflagrateAuraStateDelayEvent *pEvent = new ConflagrateAuraStateDelayEvent(GetGUID(), caster->GetGUID()); - m_Events.AddEvent(pEvent, m_Events.CalculateTime(700)); // intended 700ms delay before allowing to cast conflagrate - } - } + ModifyAuraState(aState, true); + } + else if (caster) + { + ConflagrateAuraStateDelayEvent *pEvent = new ConflagrateAuraStateDelayEvent(GetGUID(), caster->GetGUID()); + m_Events.AddEvent(pEvent, m_Events.CalculateTime(700)); // intended 700ms delay before allowing to cast conflagrate + } + } if (aurApp->GetRemoveMode()) return; @@ -3910,8 +3910,8 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo // Remove all pointers from lists here to prevent possible pointer invalidation on spellcast/auraapply/auraremove m_appliedAuras.erase(i); - // xinef: do not insert our application to interruptible list if application target is not the owner (area auras) - // xinef: event if it gets removed, it will be reapplied in a second + // xinef: do not insert our application to interruptible list if application target is not the owner (area auras) + // xinef: event if it gets removed, it will be reapplied in a second if (aura->GetSpellInfo()->AuraInterruptFlags && this == aura->GetOwner()) { m_interruptableAuras.remove(aurApp); @@ -3996,7 +3996,7 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura) // passive spell special case (only non stackable with ranks) - // xinef: this check makes caster to have 2 area auras thanks to spec switch + // xinef: this check makes caster to have 2 area auras thanks to spec switch // if (spellProto->IsPassiveStackableWithRanks()) // return; @@ -4228,37 +4228,37 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId switch (aura->GetSpellInfo()->SpellFamilyName) { - case SPELLFAMILY_HUNTER: - { - // Noxious Stings - if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x1000) - { - if (Unit* caster = aura->GetCaster()) - { - if (AuraEffect *aureff = caster->GetAuraEffect(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_HUNTER, 3521, 1)) - { - if (Aura *noxious = Aura::TryCreate(aura->GetSpellInfo(), aura->GetEffectMask(), dispeller, caster)) - { - noxious->SetDuration(aura->GetDuration() * aureff->GetAmount() / 100); - if (aura->GetUnitOwner() ) - if (const std::vector *spell_triggered = sSpellMgr->GetSpellLinked(-int32(aura->GetId()))) - for (std::vector::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) - aura->GetUnitOwner()->RemoveAurasDueToSpell(*itr); - } - } - } - } - break; - } - case SPELLFAMILY_DEATHKNIGHT: - { - // Icy Clutch, remove with Frost Fever - if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x4000000) - { - if (AuraEffect *aureff = GetAuraEffect(SPELL_AURA_MOD_DECREASE_SPEED, SPELLFAMILY_DEATHKNIGHT, 0, 0x40000, 0, casterGUID)) - RemoveAurasDueToSpell(aureff->GetId()); - } - } + case SPELLFAMILY_HUNTER: + { + // Noxious Stings + if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x1000) + { + if (Unit* caster = aura->GetCaster()) + { + if (AuraEffect *aureff = caster->GetAuraEffect(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_HUNTER, 3521, 1)) + { + if (Aura *noxious = Aura::TryCreate(aura->GetSpellInfo(), aura->GetEffectMask(), dispeller, caster)) + { + noxious->SetDuration(aura->GetDuration() * aureff->GetAmount() / 100); + if (aura->GetUnitOwner() ) + if (const std::vector *spell_triggered = sSpellMgr->GetSpellLinked(-int32(aura->GetId()))) + for (std::vector::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) + aura->GetUnitOwner()->RemoveAurasDueToSpell(*itr); + } + } + } + } + break; + } + case SPELLFAMILY_DEATHKNIGHT: + { + // Icy Clutch, remove with Frost Fever + if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x4000000) + { + if (AuraEffect *aureff = GetAuraEffect(SPELL_AURA_MOD_DECREASE_SPEED, SPELLFAMILY_DEATHKNIGHT, 0, 0x40000, 0, casterGUID)) + RemoveAurasDueToSpell(aureff->GetId()); + } + } default: break; } @@ -4317,23 +4317,23 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* if (aura->IsSingleTarget()) aura->UnregisterSingleTarget(); - // Xinef: if stealer has same aura - Aura* curAura = stealer->GetAura(aura->GetId()); - if (!curAura || (!curAura->IsPermanent() && curAura->GetDuration() < (int32)dur)) - if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellInfo(), effMask, stealer, NULL, &baseDamage[0], NULL, aura->GetCasterGUID())) - { - // created aura must not be single target aura,, so stealer won't loose it on recast - if (newAura->IsSingleTarget()) - { - newAura->UnregisterSingleTarget(); - // bring back single target aura status to the old aura - aura->SetIsSingleTarget(true); - caster->GetSingleCastAuras().push_back(aura); - } - // FIXME: using aura->GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate - newAura->SetLoadedState(aura->GetMaxDuration(), int32(dur), stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]); - newAura->ApplyForTargets(); - } + // Xinef: if stealer has same aura + Aura* curAura = stealer->GetAura(aura->GetId()); + if (!curAura || (!curAura->IsPermanent() && curAura->GetDuration() < (int32)dur)) + if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellInfo(), effMask, stealer, NULL, &baseDamage[0], NULL, aura->GetCasterGUID())) + { + // created aura must not be single target aura,, so stealer won't loose it on recast + if (newAura->IsSingleTarget()) + { + newAura->UnregisterSingleTarget(); + // bring back single target aura status to the old aura + aura->SetIsSingleTarget(true); + caster->GetSingleCastAuras().push_back(aura); + } + // FIXME: using aura->GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate + newAura->SetLoadedState(aura->GetMaxDuration(), int32(dur), stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]); + newAura->ApplyForTargets(); + } } if (stealCharge) @@ -4364,9 +4364,9 @@ void Unit::RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid) void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura* except, bool negative, bool positive) { - // simple check if list is empty - if (m_modAuras[auraType].empty()) - return; + // simple check if list is empty + if (m_modAuras[auraType].empty()) + return; for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();) { @@ -4482,23 +4482,23 @@ void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, ui void Unit::RemoveMovementImpairingAuras(bool withRoot) { - if (withRoot) - RemoveAurasWithMechanic(1<second->GetBase(); - if (aura->GetSpellInfo()->Mechanic == MECHANIC_SNARE) + if (aura->GetSpellInfo()->Mechanic == MECHANIC_SNARE) { RemoveAura(iter); continue; } - // Xinef: turn off snare auras by setting amount to 0 :) - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (((1 << i) & iter->second->GetEffectMask()) && aura->GetSpellInfo()->Effects[i].Mechanic == MECHANIC_SNARE) - aura->GetEffect(i)->ChangeAmount(0); + // Xinef: turn off snare auras by setting amount to 0 :) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (((1 << i) & iter->second->GetEffectMask()) && aura->GetSpellInfo()->Effects[i].Mechanic == MECHANIC_SNARE) + aura->GetEffect(i)->ChangeAmount(0); ++iter; } @@ -4523,12 +4523,12 @@ void Unit::RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemo void Unit::RemoveAurasByShapeShift() { - uint32 mechanic_mask = (1<second->GetBase(); - if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask) && - (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_AURA_CC) || (aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARRIOR && (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x20)))) + if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask) && + (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_AURA_CC) || (aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARRIOR && (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x20)))) { RemoveAura(iter); continue; @@ -4596,14 +4596,14 @@ void Unit::RemoveArenaAuras() Aura const* aura = aurApp->GetBase(); if (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR4_UNK21) // don't remove stances, shadowform, pally/hunter auras && !aura->IsPassive() // don't remove passive auras - && !aura->IsArea() // don't remove area auras, eg pet talents affecting owner + && !aura->IsArea() // don't remove area auras, eg pet talents affecting owner && (aurApp->IsPositive() || IsPet() || !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR3_DEATH_PERSISTENT))) // not negative death persistent auras - { + { + RemoveAura(iter); + } + // xinef: special marker, 95% sure + else if (aura->GetSpellInfo()->HasAttribute(SPELL_ATTR5_REMOVE_ON_ARENA_ENTER)) RemoveAura(iter); - } - // xinef: special marker, 95% sure - else if (aura->GetSpellInfo()->HasAttribute(SPELL_ATTR5_REMOVE_ON_ARENA_ENTER)) - RemoveAura(iter); else ++iter; } @@ -4616,7 +4616,7 @@ void Unit::RemoveAllAurasOnDeath() for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) { Aura const* aura = iter->second->GetBase(); - if ((!aura->IsPassive() || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_REACTIVATE_AT_RESURRECT)) && !aura->IsDeathPersistent()) + if ((!aura->IsPassive() || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_REACTIVATE_AT_RESURRECT)) && !aura->IsDeathPersistent()) _UnapplyAura(iter, AURA_REMOVE_BY_DEATH); else ++iter; @@ -4702,7 +4702,7 @@ void Unit::RemoveEvadeAuras() for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) { Aura const* aura = iter->second->GetBase(); - if (aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) || aura->GetSpellInfo()->HasAura(SPELL_AURA_CLONE_CASTER) || (aura->IsPassive() && IS_PLAYER_GUID(GetOwnerGUID()))) + if (aura->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE) || aura->GetSpellInfo()->HasAura(SPELL_AURA_CLONE_CASTER) || (aura->IsPassive() && IS_PLAYER_GUID(GetOwnerGUID()))) ++iter; else _UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT); @@ -4808,14 +4808,14 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 f AuraEffect* Unit::GetAuraEffectDummy(uint32 spellid) const { - AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_DUMMY); - for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - { - if ((*itr)->GetId() == spellid) - return *itr; - } + AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_DUMMY); + for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + if ((*itr)->GetId() == spellid) + return *itr; + } - return NULL; + return NULL; } AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication * except) const @@ -4867,9 +4867,9 @@ void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelCharges if (dispelMask & (1 << DISPEL_DISEASE) && HasAura(50536)) dispelMask &= ~(1 << DISPEL_DISEASE); - bool positive = IsFriendlyTo(caster); + bool positive = IsFriendlyTo(caster); Unit::VisibleAuraMap const *visibleAuras = GetVisibleAuras(); - for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr) + for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr) { Aura *aura = itr->second->GetBase(); @@ -4883,7 +4883,7 @@ void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelCharges { // do not remove positive auras if friendly target // negative auras if non-friendly target - if (itr->second->IsPositive() == positive) + if (itr->second->IsPositive() == positive) continue; } @@ -4953,10 +4953,10 @@ bool Unit::HasVisibleAuraType(AuraType auraType) const { AuraEffectList const& mAuraList = GetAuraEffectsByType(auraType); for (AuraEffectList::const_iterator i = mAuraList.begin(); i != mAuraList.end(); ++i) - if( (*i)->GetBase()->CanBeSentToClient() ) - return true; + if( (*i)->GetBase()->CanBeSentToClient() ) + return true; - return false; + return false; } bool Unit::HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const @@ -5064,14 +5064,14 @@ uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, uint8 mode) i = m_modAuras[diseaseAuraTypes[index]].begin(); continue; } - // used for glyph of scourge strike - else if (mode == 2) - { - Aura* aura = (*i)->GetBase(); - if (aura && !aura->IsRemoved() && aura->GetDuration() > 0) - if ((aura->GetApplyTime() + aura->GetMaxDuration()/1000 + 8) > (time(NULL) + aura->GetDuration()/1000)) - aura->SetDuration(aura->GetDuration()+3000); - } + // used for glyph of scourge strike + else if (mode == 2) + { + Aura* aura = (*i)->GetBase(); + if (aura && !aura->IsRemoved() && aura->GetDuration() > 0) + if ((aura->GetApplyTime() + aura->GetMaxDuration()/1000 + 8) > (time(NULL) + aura->GetDuration()/1000)) + aura->SetDuration(aura->GetDuration()+3000); + } } ++i; } @@ -5105,19 +5105,19 @@ uint32 Unit::GetDoTsByCaster(uint64 casterGUID) const int32 Unit::GetTotalAuraModifierAreaExclusive(AuraType auratype) const { int32 modifier = 0; - int32 areaModifier = 0; + int32 areaModifier = 0; AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - { - if ((*i)->GetSpellInfo()->HasAreaAuraEffect()) - { - if (areaModifier < (*i)->GetAmount()) - areaModifier = (*i)->GetAmount(); - } - else - modifier += (*i)->GetAmount(); - } + { + if ((*i)->GetSpellInfo()->HasAreaAuraEffect()) + { + if (areaModifier < (*i)->GetAmount()) + areaModifier = (*i)->GetAmount(); + } + else + modifier += (*i)->GetAmount(); + } return modifier + areaModifier; } @@ -5378,10 +5378,10 @@ void Unit::RemoveAllDynObjects() GameObject* Unit::GetGameObject(uint32 spellId) const { - for (GameObjectList::const_iterator itr = m_gameObj.begin(); itr != m_gameObj.end(); ++itr) - if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr)) - if (go->GetSpellId() == spellId) - return go; + for (GameObjectList::const_iterator itr = m_gameObj.begin(); itr != m_gameObj.end(); ++itr) + if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr)) + if (go->GetSpellId() == spellId) + return go; return NULL; } @@ -5451,22 +5451,22 @@ void Unit::RemoveGameObject(uint32 spellid, bool del) for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();) { - if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr)) - { - if (spellid > 0 && go->GetSpellId() != spellid) - { - ++itr; - continue; - } + if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr)) + { + if (spellid > 0 && go->GetSpellId() != spellid) + { + ++itr; + continue; + } - go->SetOwnerGUID(0); - if(del) - { - go->SetRespawnTime(0); - go->Delete(); - } - } - m_gameObj.erase(itr++); + go->SetOwnerGUID(0); + if(del) + { + go->SetRespawnTime(0); + go->Delete(); + } + } + m_gameObj.erase(itr++); } } @@ -5474,22 +5474,22 @@ void Unit::RemoveAllGameObjects() { while(!m_gameObj.empty()) { - GameObject* go = ObjectAccessor::GetGameObject(*this, *m_gameObj.begin()); + GameObject* go = ObjectAccessor::GetGameObject(*this, *m_gameObj.begin()); if(go) - { - go->SetOwnerGUID(0); - go->SetRespawnTime(0); - go->Delete(); - } + { + go->SetOwnerGUID(0); + go->SetRespawnTime(0); + go->Delete(); + } m_gameObj.erase(m_gameObj.begin()); } } void Unit::SendSpellNonMeleeReflectLog(SpellNonMeleeDamage* log, Unit* attacker) { - // Xinef: function for players only, placed in unit because of cosmetics - if (GetTypeId() != TYPEID_PLAYER) - return; + // Xinef: function for players only, placed in unit because of cosmetics + if (GetTypeId() != TYPEID_PLAYER) + return; WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+4+1+4+4+1+1+4+4+1)); // we guess size data.append(log->target->GetPackGUID()); @@ -5736,12 +5736,12 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere { switch (dummySpell->Id) { - // Overkill - case 58426: - { - triggered_spell_id = 58427; - break; - } + // Overkill + case 58426: + { + triggered_spell_id = 58427; + break; + } // Unstable Power case 24658: { @@ -5991,7 +5991,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (GetTypeId() != TYPEID_PLAYER || HasSpellCooldown(71484)) return false; - AddSpellCooldown(71484, 0, cooldown); + AddSpellCooldown(71484, 0, cooldown); std::vector RandomSpells; switch (getClass()) @@ -6034,7 +6034,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (GetTypeId() != TYPEID_PLAYER || HasSpellCooldown(71561)) return false; - AddSpellCooldown(71561, 0, cooldown); + AddSpellCooldown(71561, 0, cooldown); std::vector RandomSpells; switch (getClass()) @@ -6072,109 +6072,109 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere CastSpell(target, RandomSpells[rand_spell], true, castItem, triggeredByAura, originalCaster); break; } - // Freya, Petrified Bark - case 62933: - case 62337: - { - if (!victim) - return false; + // Freya, Petrified Bark + case 62933: + case 62337: + { + if (!victim) + return false; - int32 dmg = damage; - victim->CastCustomSpell(this, 62379, &dmg, 0, 0, true); - return true; - } - // Trial of the Champion, Earth Shield - case 67534: - { - const int32 dmg = (int32)damage; - CastCustomSpell(this, 67535, &dmg, NULL, NULL, true, 0, triggeredByAura, triggeredByAura->GetCasterGUID()); - return true; - } - // Trial of the Crusader, Faction Champions, Retaliation - case 65932: - { - // check attack comes not from behind - if (!victim || !HasInArc(M_PI, victim)) - return false; + int32 dmg = damage; + victim->CastCustomSpell(this, 62379, &dmg, 0, 0, true); + return true; + } + // Trial of the Champion, Earth Shield + case 67534: + { + const int32 dmg = (int32)damage; + CastCustomSpell(this, 67535, &dmg, NULL, NULL, true, 0, triggeredByAura, triggeredByAura->GetCasterGUID()); + return true; + } + // Trial of the Crusader, Faction Champions, Retaliation + case 65932: + { + // check attack comes not from behind + if (!victim || !HasInArc(M_PI, victim)) + return false; - triggered_spell_id = 65934; - break; - } - // Pit of Saron, Tyrannus, Overlord's Brand - case 69172: // everything except for DoTs - { - if (!target) - return false; - if (Unit* caster = triggeredByAura->GetCaster()) - { - if (procFlag & (PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS|PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS)) - { - int32 dmg = 5.5f*damage; - target->CastCustomSpell(caster, 69190, &dmg, 0, 0, true); - } - else - { - if (caster->GetVictim()) - { - int32 dmg = damage; - target->CastCustomSpell(caster->GetVictim(), 69189, &dmg, 0, 0, true); - } - } - } - return true; - } - // Pit of Saron, Tyrannus, Overlord's Brand - case 69173: // only DoTs - { - if (!target) - return false; - if (Unit* caster = triggeredByAura->GetCaster()) - { - if (procEx & PROC_EX_INTERNAL_HOT) - { - int32 dmg = 5.5f*damage; - target->CastCustomSpell(caster, 69190, &dmg, 0, 0, true); - } - else - { - if (caster->GetVictim()) - { - int32 dmg = damage; - target->CastCustomSpell(caster->GetVictim(), 69189, &dmg, 0, 0, true); - } - } - } - return true; - } - // Icecrown Citadel, Lady Deathwhisper, Vampiric Might - case 70674: - { - if (Unit* caster = triggeredByAura->GetCaster()) - { - int32 dmg = 3*damage; - caster->CastCustomSpell(caster, 70677, &dmg, 0, 0, true); - } - return true; - } - // Item: Purified Shard of the Gods - case 69755: - { - triggered_spell_id = ((procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) ? 69733 : 69729); - break; - } - // Item: Shiny Shard of the Gods - case 69739: - { - triggered_spell_id = ((procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) ? 69734 : 69730); - break; - } - // VoA: Meteor Fists koralon - case 66725: - case 68161: - { - triggered_spell_id = 66765; // handled by spell_difficulty - break; - } + triggered_spell_id = 65934; + break; + } + // Pit of Saron, Tyrannus, Overlord's Brand + case 69172: // everything except for DoTs + { + if (!target) + return false; + if (Unit* caster = triggeredByAura->GetCaster()) + { + if (procFlag & (PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS|PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS)) + { + int32 dmg = 5.5f*damage; + target->CastCustomSpell(caster, 69190, &dmg, 0, 0, true); + } + else + { + if (caster->GetVictim()) + { + int32 dmg = damage; + target->CastCustomSpell(caster->GetVictim(), 69189, &dmg, 0, 0, true); + } + } + } + return true; + } + // Pit of Saron, Tyrannus, Overlord's Brand + case 69173: // only DoTs + { + if (!target) + return false; + if (Unit* caster = triggeredByAura->GetCaster()) + { + if (procEx & PROC_EX_INTERNAL_HOT) + { + int32 dmg = 5.5f*damage; + target->CastCustomSpell(caster, 69190, &dmg, 0, 0, true); + } + else + { + if (caster->GetVictim()) + { + int32 dmg = damage; + target->CastCustomSpell(caster->GetVictim(), 69189, &dmg, 0, 0, true); + } + } + } + return true; + } + // Icecrown Citadel, Lady Deathwhisper, Vampiric Might + case 70674: + { + if (Unit* caster = triggeredByAura->GetCaster()) + { + int32 dmg = 3*damage; + caster->CastCustomSpell(caster, 70677, &dmg, 0, 0, true); + } + return true; + } + // Item: Purified Shard of the Gods + case 69755: + { + triggered_spell_id = ((procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) ? 69733 : 69729); + break; + } + // Item: Shiny Shard of the Gods + case 69739: + { + triggered_spell_id = ((procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) ? 69734 : 69730); + break; + } + // VoA: Meteor Fists koralon + case 66725: + case 68161: + { + triggered_spell_id = 66765; // handled by spell_difficulty + break; + } } break; } @@ -6321,7 +6321,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere uint32 spell = sSpellMgr->GetSpellWithRank(27285, dummySpell->GetRank()); // Cast finish spell (triggeredByAura already not exist!) - if (Unit* caster = ObjectAccessor::GetUnit(*this, casterGuid)) + if (Unit* caster = ObjectAccessor::GetUnit(*this, casterGuid)) { this->CastSpell(this, 37826, true); // VISUAL! caster->CastSpell(this, spell, true, castItem); @@ -6348,10 +6348,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Cast finish spell (triggeredByAura already not exist!) if (Unit* caster = ObjectAccessor::GetUnit(*this, casterGuid)) - { + { this->CastSpell(this, 37826, true); // VISUAL! caster->CastSpell(this, 32865, true, castItem); - } + } return true; // no hidden cooldown } // Damage counting @@ -6539,8 +6539,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (!blessHealing || !victim) return false; basepoints0 = int32(CalculatePct(damage, triggerAmount) / (blessHealing->GetMaxDuration() / blessHealing->Effects[0].Amplitude)); - victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_HEAL, basepoints0); - return true; + victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_HEAL, basepoints0); + return true; } break; } @@ -6745,15 +6745,15 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Glyph of Backstab case 56800: { - if (victim) - if (AuraEffect* aurEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0, 0, GetGUID())) - if (Aura* aur = aurEff->GetBase()) - if (!aur->IsRemoved() && aur->GetDuration() > 0) - if ((aur->GetApplyTime() + aur->GetMaxDuration()/1000 + 5) > (time(NULL) + aur->GetDuration()/1000) ) - { - aur->SetDuration(aur->GetDuration()+2000); - return true; - } + if (victim) + if (AuraEffect* aurEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0, 0, GetGUID())) + if (Aura* aur = aurEff->GetBase()) + if (!aur->IsRemoved() && aur->GetDuration() > 0) + if ((aur->GetApplyTime() + aur->GetMaxDuration()/1000 + 5) > (time(NULL) + aur->GetDuration()/1000) ) + { + aur->SetDuration(aur->GetDuration()+2000); + return true; + } return false; } // Deadly Throw Interrupt @@ -6767,13 +6767,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere break; } } - // Master of subtlety - if( dummySpell->SpellIconID == 2114 ) - { - triggered_spell_id = 31665; - basepoints0 = triggerAmount; - break; - } + // Master of subtlety + if( dummySpell->SpellIconID == 2114 ) + { + triggered_spell_id = 31665; + basepoints0 = triggerAmount; + break; + } // Cut to the Chase if (dummySpell->SpellIconID == 2909) { @@ -6885,8 +6885,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere { case 57870: // Glyph of Mend Pet { - if (!victim) - return false; + if (!victim) + return false; victim->CastSpell(victim, 57894, true, NULL, NULL, GetGUID()); return true; @@ -6894,7 +6894,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Glyph of Freezing Trap case 56845: { - victim->CastSpell(this, 61394, true, NULL, NULL, victim->GetGUID()); + victim->CastSpell(this, 61394, true, NULL, NULL, victim->GetGUID()); return true; } } @@ -6935,8 +6935,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Righteous Vengeance if (dummySpell->SpellIconID == 3025) { - if (!victim) - return false; + if (!victim) + return false; // 4 damage tick basepoints0 = triggerAmount * damage / 400; @@ -7083,9 +7083,9 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (this == victim) return false; - // dont allow non-positive dots to proc - if (!procSpell || !procSpell->IsPositive()) - return false; + // dont allow non-positive dots to proc + if (!procSpell || !procSpell->IsPositive()) + return false; // heal amount basepoints0 = int32(CalculatePct(std::min(damage, GetMaxHealth() - GetHealth()), triggerAmount)); @@ -7310,7 +7310,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if (procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK) triggered_spell_id = 33750; - // custom cooldown processing case + // custom cooldown processing case if (player->HasSpellCooldown(dummySpell->Id)) return false; @@ -7374,8 +7374,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere return false; basepoints0 = CalculatePct(int32(damage), triggerAmount); triggered_spell_id = 58879; - // Heal wolf - CastCustomSpell(this, triggered_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura, originalCaster); + // Heal wolf + CastCustomSpell(this, triggered_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura, originalCaster); break; } // Shaman T8 Elemental 4P Bonus @@ -7523,31 +7523,31 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere if(!procSpell || GetTypeId() != TYPEID_PLAYER || !victim) return false; - if (procEx & PROC_EX_CRITICAL_HIT) - damage /= 2; + if (procEx & PROC_EX_CRITICAL_HIT) + damage /= 2; - do - { - uint32 spell = 0; + do + { + uint32 spell = 0; - if (procSpell->SpellFamilyFlags[0] & 0x2) - { - // 1/3 of 33% if 11% - if (!roll_chance_i(33)) - return false; + if (procSpell->SpellFamilyFlags[0] & 0x2) + { + // 1/3 of 33% if 11% + if (!roll_chance_i(33)) + return false; - spell = 45297; - } - else - spell = 45284; + spell = 45297; + } + else + spell = 45284; - // do not reduce damage-spells have correct basepoints - damage /= 2; - int32 dmg = damage; - - // Cast - CastCustomSpell(victim, spell, &dmg, 0, 0, true, castItem, triggeredByAura); - } while (roll_chance_i(33)); + // do not reduce damage-spells have correct basepoints + damage /= 2; + int32 dmg = damage; + + // Cast + CastCustomSpell(victim, spell, &dmg, 0, 0, true, castItem, triggeredByAura); + } while (roll_chance_i(33)); return true; } // Static Shock @@ -7678,22 +7678,22 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere return false; } - // This should do, restore spell mod so next attack can also use this! - // crit chance for first strike is already computed - ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 51124, NULL); // Killing Machine - ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 49796, NULL); // Deathchill + // This should do, restore spell mod so next attack can also use this! + // crit chance for first strike is already computed + ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 51124, NULL); // Killing Machine + ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 49796, NULL); // Deathchill - // Xinef: Somehow basepoints are divided by 2 which is later divided by 2 (offhand multiplier) - SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id); - if (triggerEntry->SchoolMask & SPELL_SCHOOL_MASK_NORMAL) - basepoints0 = triggerEntry->Effects[EFFECT_0].BasePoints*2; + // Xinef: Somehow basepoints are divided by 2 which is later divided by 2 (offhand multiplier) + SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id); + if (triggerEntry->SchoolMask & SPELL_SCHOOL_MASK_NORMAL) + basepoints0 = triggerEntry->Effects[EFFECT_0].BasePoints*2; - SetCantProc(true); - if(basepoints0) - CastCustomSpell(target, triggered_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura, originalCaster); - else - CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster); - SetCantProc(false); + SetCantProc(true); + if(basepoints0) + CastCustomSpell(target, triggered_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura, originalCaster); + else + CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster); + SetCantProc(false); return true; } // Runic Power Back on Snare/Root @@ -7718,7 +7718,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { // check if shown in spell book - if (!itr->second->Active || !itr->second->IsInSpec(ToPlayer()->GetActiveSpec()) || itr->second->State == PLAYERSPELL_REMOVED) + if (!itr->second->Active || !itr->second->IsInSpec(ToPlayer()->GetActiveSpec()) || itr->second->State == PLAYERSPELL_REMOVED) continue; SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(itr->first); @@ -7860,16 +7860,16 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp case 72833: { if (Unit* caster = triggeredByAura->GetCaster()) - if (victim && caster->GetGUID() == victim->GetGUID()) - { - *handled = true; - uint32 stack = triggeredByAura->GetStackAmount(); - int32 const mod = (GetMap()->GetSpawnMode() & 1) ? 1500 : 1250; - int32 dmg = 0; - for (uint8 i = 1; i <= stack; ++i) - dmg += mod * i; - caster->CastCustomSpell(70701, SPELLVALUE_BASE_POINT0, dmg); - } + if (victim && caster->GetGUID() == victim->GetGUID()) + { + *handled = true; + uint32 stack = triggeredByAura->GetStackAmount(); + int32 const mod = (GetMap()->GetSpawnMode() & 1) ? 1500 : 1250; + int32 dmg = 0; + for (uint8 i = 1; i <= stack; ++i) + dmg += mod * i; + caster->CastCustomSpell(70701, SPELLVALUE_BASE_POINT0, dmg); + } break; } // Ball of Flames Proc @@ -7941,8 +7941,8 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp // Blood of the North // Reaping // Death Rune Mastery - // xinef: Icon 22 is used for item bonus, skip - if (dummySpell->SpellIconID == 3041 || (dummySpell->SpellIconID == 22 && dummySpell->Id != 62459) || dummySpell->SpellIconID == 2622) + // xinef: Icon 22 is used for item bonus, skip + if (dummySpell->SpellIconID == 3041 || (dummySpell->SpellIconID == 22 && dummySpell->Id != 62459) || dummySpell->SpellIconID == 2622) { *handled = true; // Convert recently used Blood Rune to Death Rune @@ -7951,7 +7951,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp if (player->getClass() != CLASS_DEATH_KNIGHT) return false; - // xinef: not true + // xinef: not true //RuneType rune = ToPlayer()->GetLastUsedRune(); // can't proc from death rune use //if (rune == RUNE_DEATH) @@ -8046,8 +8046,8 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg { case 43820: // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket) // Pct value stored in dummy - if (!victim) - return false; + if (!victim) + return false; basepoints0 = victim->GetCreateHealth() * auraSpellInfo->Effects[1].CalcValue() / 100; target = victim; break; @@ -8066,8 +8066,8 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg } case 67702: // Death's Choice, Item - Coliseum 25 Normal Melee Trinket { - if (!damage) - return false; + if (!damage) + return false; float stat = 0.0f; // strength if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67708;stat = GetStat(STAT_STRENGTH); } @@ -8077,8 +8077,8 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg } case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket { - if (!damage) - return false; + if (!damage) + return false; float stat = 0.0f; // strength if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67773;stat = GetStat(STAT_STRENGTH); } @@ -8097,27 +8097,27 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg CastSpell(victim, 27526, true, castItem, triggeredByAura); return true; } - // Forge of Souls, Devourer of Souls, Mirrored Soul - case 69023: - { - int32 dmg = damage * 0.45f; - if (dmg>0) - if (Aura* a = GetAura(69023)) - if (Unit* c = a->GetCaster()) - CastCustomSpell(c, 69034, &dmg, 0, 0, true); - return true; - } - // Soul-Trader Beacon proc aura - case 50051: - { - if (!victim) - return false; + // Forge of Souls, Devourer of Souls, Mirrored Soul + case 69023: + { + int32 dmg = damage * 0.45f; + if (dmg>0) + if (Aura* a = GetAura(69023)) + if (Unit* c = a->GetCaster()) + CastCustomSpell(c, 69034, &dmg, 0, 0, true); + return true; + } + // Soul-Trader Beacon proc aura + case 50051: + { + if (!victim) + return false; - if (Creature* cr = ObjectAccessor::GetCreature(*this, m_SummonSlot[SUMMON_SLOT_MINIPET])) - cr->CastSpell(victim, 50101, true); + if (Creature* cr = ObjectAccessor::GetCreature(*this, m_SummonSlot[SUMMON_SLOT_MINIPET])) + cr->CastSpell(victim, 50101, true); - return false; - } + return false; + } } break; case SPELLFAMILY_MAGE: @@ -8196,7 +8196,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg target = this; // Add remaining ticks to healing done CastDelayedSpellWithPeriodicAmount(this, trigger_spell_id, SPELL_AURA_PERIODIC_HEAL, basepoints0); - return true; + return true; } break; } @@ -8242,8 +8242,8 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg { if (auraSpellInfo->SpellIconID == 3247) // Piercing Shots { - if (!victim) - return false; + if (!victim) + return false; switch (auraSpellInfo->Id) { @@ -8264,16 +8264,16 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg victim->CastDelayedSpellWithPeriodicAmount(this, trigger_spell_id, SPELL_AURA_PERIODIC_DAMAGE, basepoints0); return true; } - // Item - Hunter T9 4P Bonus (Steady Shot) - else if (auraSpellInfo->Id == 67151) - { - if (GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetPet()) - return false; + // Item - Hunter T9 4P Bonus (Steady Shot) + else if (auraSpellInfo->Id == 67151) + { + if (GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetPet()) + return false; - target = ToPlayer()->GetPet(); - trigger_spell_id = 68130; - break; - } + target = ToPlayer()->GetPet(); + trigger_spell_id = 68130; + break; + } break; } case SPELLFAMILY_PALADIN: @@ -8331,13 +8331,13 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg break; } - if (cooldown && GetTypeId() == TYPEID_PLAYER) - { - if (ToPlayer()->HasSpellCooldown(stack_spell_id)) - return false; + if (cooldown && GetTypeId() == TYPEID_PLAYER) + { + if (ToPlayer()->HasSpellCooldown(stack_spell_id)) + return false; - ToPlayer()->AddSpellCooldown(stack_spell_id, 0, cooldown); - } + ToPlayer()->AddSpellCooldown(stack_spell_id, 0, cooldown); + } CastSpell(this, stack_spell_id, true, NULL, triggeredByAura); @@ -8465,7 +8465,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // Custom triggered spells switch (auraSpellInfo->Id) { - // Deep Wounds + // Deep Wounds case 12834: case 12849: case 12867: @@ -8545,11 +8545,11 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (!victim || !victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this)) return false; break; - // Ulduar, Hodir, Toasty Fire - case 62821: - if (this->GetTypeId() != TYPEID_PLAYER) // spell has Attribute, but persistent area auras ignore it - return false; - break; + // Ulduar, Hodir, Toasty Fire + case 62821: + if (this->GetTypeId() != TYPEID_PLAYER) // spell has Attribute, but persistent area auras ignore it + return false; + break; case 15337: // Improved Spirit Tap (Rank 1) case 15338: // Improved Spirit Tap (Rank 2) { @@ -8582,26 +8582,26 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // Sword Specialization if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_GENERIC) - { - if (auraSpellInfo->SpellIconID == 1462 && procSpell) - { - if (Player* plr = ToPlayer()) - { - if (!victim || plr->HasSpellCooldown(16459)) - return false; + { + if (auraSpellInfo->SpellIconID == 1462 && procSpell) + { + if (Player* plr = ToPlayer()) + { + if (!victim || plr->HasSpellCooldown(16459)) + return false; - plr->AddSpellCooldown(16459, 0, cooldown); + plr->AddSpellCooldown(16459, 0, cooldown); - if (plr->IsWithinMeleeRange(victim)) - plr->AttackerStateUpdate(victim); - return true; - } - } - } + if (plr->IsWithinMeleeRange(victim)) + plr->AttackerStateUpdate(victim); + return true; + } + } + } else if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT) { - // Xinef: keep this order, Aura 70656 has SpellIconID 85! - // Item - Death Knight T10 Melee 4P Bonus + // Xinef: keep this order, Aura 70656 has SpellIconID 85! + // Item - Death Knight T10 Melee 4P Bonus if (auraSpellInfo->Id == 70656) { if (GetTypeId() != TYPEID_PLAYER || getClass() != CLASS_DEATH_KNIGHT) @@ -8611,42 +8611,42 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (ToPlayer()->GetRuneCooldown(i) == 0) return false; } - // Blade Barrier - else if (auraSpellInfo->SpellIconID == 85) - { - Player* plr = ToPlayer(); - if (!plr || plr->getClass() != CLASS_DEATH_KNIGHT || !procSpell) - return false; + // Blade Barrier + else if (auraSpellInfo->SpellIconID == 85) + { + Player* plr = ToPlayer(); + if (!plr || plr->getClass() != CLASS_DEATH_KNIGHT || !procSpell) + return false; - if (!plr->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD)) - return false; - } - // Rime - else if (auraSpellInfo->SpellIconID == 56) - { - if (GetTypeId() != TYPEID_PLAYER) - return false; + if (!plr->IsBaseRuneSlotsOnCooldown(RUNE_BLOOD)) + return false; + } + // Rime + else if (auraSpellInfo->SpellIconID == 56) + { + if (GetTypeId() != TYPEID_PLAYER) + return false; - // Howling Blast - ToPlayer()->RemoveCategoryCooldown(1248); - } - } - else if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DRUID) - { - // Nature's Grasp - if( triggerEntry->SpellIconID == 20 ) - { - if (!victim) - return false; + // Howling Blast + ToPlayer()->RemoveCategoryCooldown(1248); + } + } + else if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DRUID) + { + // Nature's Grasp + if( triggerEntry->SpellIconID == 20 ) + { + if (!victim) + return false; - if (AuraEffect *aurEff = victim->GetAuraEffect(SPELL_AURA_MOD_ROOT, SPELLFAMILY_DRUID, 20, 0)) - if ((aurEff->GetBase()->GetMaxDuration() - aurEff->GetBase()->GetDuration()) < 1000) - return false; + if (AuraEffect *aurEff = victim->GetAuraEffect(SPELL_AURA_MOD_ROOT, SPELLFAMILY_DRUID, 20, 0)) + if ((aurEff->GetBase()->GetMaxDuration() - aurEff->GetBase()->GetDuration()) < 1000) + return false; - CastSpell(victim, trigger_spell_id, true); - return true; - } - } + CastSpell(victim, trigger_spell_id, true); + return true; + } + } // Custom basepoints/target for exist spell @@ -8665,7 +8665,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (!target) return false; - if (Player* pTarget = target->ToPlayer()) + if (Player* pTarget = target->ToPlayer()) { if (cooldown) { @@ -8701,14 +8701,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg target = victim; break; } - // Ruby Drake, Evasive Aura - case 50241: - { - if( GetAura(50240) ) - return false; + // Ruby Drake, Evasive Aura + case 50241: + { + if( GetAura(50240) ) + return false; - break; - } + break; + } // Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset) case 15250: // Rogue Setup { @@ -8731,7 +8731,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg { if (HasAura(70718)) CastSpell(this, 70721, true); - RemoveAurasDueToSpell(trigger_spell_id); + RemoveAurasDueToSpell(trigger_spell_id); break; } // Shamanistic Rage triggered spell @@ -8754,9 +8754,9 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (IsPet()) if (Unit* owner = GetOwner()) { - if (HasSpellCooldown(trigger_spell_id)) - return false; - AddSpellCooldown(trigger_spell_id, 0, cooldown); + if (HasSpellCooldown(trigger_spell_id)) + return false; + AddSpellCooldown(trigger_spell_id, 0, cooldown); if (AuraEffect* aurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 3220, 0)) { @@ -8774,25 +8774,25 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (AuraEffect const* aurEff = GetAuraEffect(70847, 0)) { if (!roll_chance_i(aurEff->GetAmount())) - { - // Xinef: dont allow normal proc to override set one - if (Aura* aura = GetAura((trigger_spell_id == 46916) ? 71072 : 71069)) - return false; - // Xinef: just to be sure - RemoveAurasDueToSpell(70849); + { + // Xinef: dont allow normal proc to override set one + if (Aura* aura = GetAura((trigger_spell_id == 46916) ? 71072 : 71069)) + return false; + // Xinef: just to be sure + RemoveAurasDueToSpell(70849); break; - } + } - // Xinef: fully remove all auras and reapply once more - RemoveAurasDueToSpell(70849); - RemoveAurasDueToSpell(71072); - RemoveAurasDueToSpell(71069); + // Xinef: fully remove all auras and reapply once more + RemoveAurasDueToSpell(70849); + RemoveAurasDueToSpell(71072); + RemoveAurasDueToSpell(71069); CastSpell(this, 70849, true, castItem, triggeredByAura); // Extra Charge! - if (trigger_spell_id == 46916) - CastSpell(this, 71072, true, castItem, triggeredByAura); // Slam GCD Reduced - else - CastSpell(this, 71069, true, castItem, triggeredByAura); // Execute GCD Reduced + if (trigger_spell_id == 46916) + CastSpell(this, 71072, true, castItem, triggeredByAura); // Slam GCD Reduced + else + CastSpell(this, 71069, true, castItem, triggeredByAura); // Execute GCD Reduced } break; } @@ -8817,7 +8817,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // Item - Shaman T10 Enhancement 4P Bonus if (AuraEffect const* aurEff = GetAuraEffect(70832, 0)) if (Aura const* maelstrom = GetAura(53817)) - // xinef: we have 4 charges and all proc conditions are met - aura reaches 5 charges + // xinef: we have 4 charges and all proc conditions are met - aura reaches 5 charges if ((maelstrom->GetStackAmount() == 4) && roll_chance_i(aurEff->GetAmount())) CastSpell(this, 70831, true, castItem, triggeredByAura); @@ -8838,10 +8838,10 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 56453: { // Proc only from Frost/Freezing trap activation or from Freezing Arrow (the periodic dmg proc handled elsewhere) - if (!(procFlags & PROC_FLAG_DONE_TRAP_ACTIVATION) || !procSpell || !roll_chance_i(triggerAmount)) + if (!(procFlags & PROC_FLAG_DONE_TRAP_ACTIVATION) || !procSpell || !roll_chance_i(triggerAmount)) + return false; + if (procSpell->Id != 63487 /*frost trap*/ && !(procSpell->SchoolMask & SPELL_SCHOOL_MASK_FROST)) return false; - if (procSpell->Id != 63487 /*frost trap*/ && !(procSpell->SchoolMask & SPELL_SCHOOL_MASK_FROST)) - return false; break; } // Glyph of Death's Embrace @@ -8886,24 +8886,24 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg return false; break; } - // Fingers of Frost, synchronise with Frostbite - case 44544: - { - // Find Frostbite - if (AuraEffect* aurEff = this->GetAuraEffect(SPELL_AURA_ADD_TARGET_TRIGGER, SPELLFAMILY_MAGE, 119, EFFECT_0)) - { - if (!victim) - return false; + // Fingers of Frost, synchronise with Frostbite + case 44544: + { + // Find Frostbite + if (AuraEffect* aurEff = this->GetAuraEffect(SPELL_AURA_ADD_TARGET_TRIGGER, SPELLFAMILY_MAGE, 119, EFFECT_0)) + { + if (!victim) + return false; - uint8 fofRank = sSpellMgr->GetSpellRank(triggeredByAura->GetId()); - uint8 fbRank = sSpellMgr->GetSpellRank(aurEff->GetId()); - uint8 chance = uint8(ceil(fofRank * fbRank * 16.6f)); + uint8 fofRank = sSpellMgr->GetSpellRank(triggeredByAura->GetId()); + uint8 fbRank = sSpellMgr->GetSpellRank(aurEff->GetId()); + uint8 chance = uint8(ceil(fofRank * fbRank * 16.6f)); - if (roll_chance_i(chance)) - CastSpell(victim, aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true); - } - break; - } + if (roll_chance_i(chance)) + CastSpell(victim, aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true); + } + break; + } } // try detect target manually if not set @@ -8912,7 +8912,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (cooldown) { - if (HasSpellCooldown(triggerEntry->Id)) + if (HasSpellCooldown(triggerEntry->Id)) return false; AddSpellCooldown(triggerEntry->Id, 0, cooldown); @@ -9027,7 +9027,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au CastSpell(victim, triggered_spell_id, true, castItem, triggeredByAura); - return true; + return true; } @@ -9077,13 +9077,13 @@ void Unit::setPowerType(Powers new_powertype) break; } - if (const Player* player = ToPlayer()) - if (player->NeedSendSpectatorData()) - { - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PWT", new_powertype); - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetMaxPower(new_powertype)/10 : GetMaxPower(new_powertype)); - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetPower(new_powertype)/10 : GetPower(new_powertype)); - } + if (const Player* player = ToPlayer()) + if (player->NeedSendSpectatorData()) + { + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PWT", new_powertype); + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetMaxPower(new_powertype)/10 : GetMaxPower(new_powertype)); + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetPower(new_powertype)/10 : GetPower(new_powertype)); + } } FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const @@ -9110,9 +9110,9 @@ FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const void Unit::setFaction(uint32 faction) { - SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); - if (GetTypeId() == TYPEID_UNIT) - ToCreature()->UpdateMoveInLineOfSightState(); + SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); + if (GetTypeId() == TYPEID_UNIT) + ToCreature()->UpdateMoveInLineOfSightState(); } // function based on function Unit::UnitReaction from 13850 client @@ -9298,9 +9298,9 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) if (!IsAlive() || !victim->IsAlive()) return false; - // pussywizard: check map, world, phase >_> multithreading crash fix - if (!IsInMap(victim) || !InSamePhase(victim)) - return false; + // pussywizard: check map, world, phase >_> multithreading crash fix + if (!IsInMap(victim) || !InSamePhase(victim)) + return false; // player cannot attack in mount state if (GetTypeId() == TYPEID_PLAYER && IsMounted()) @@ -9449,9 +9449,9 @@ void Unit::CombatStop(bool includingCast) ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel ClearInCombat(); - // xinef: just in case - if (IsPetInCombat() && GetTypeId() != TYPEID_PLAYER) - ClearInPetCombat(); + // xinef: just in case + if (IsPetInCombat() && GetTypeId() != TYPEID_PLAYER) + ClearInPetCombat(); } void Unit::CombatStopWithPets(bool includingCast) @@ -9467,10 +9467,10 @@ bool Unit::isAttackingPlayer() const if (HasUnitState(UNIT_STATE_ATTACK_PLAYER)) return true; - if (!m_Controlled.empty()) - for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) - if ((*itr)->isAttackingPlayer()) - return true; + if (!m_Controlled.empty()) + for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) + if ((*itr)->isAttackingPlayer()) + return true; for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i) if (m_SummonSlot[i]) @@ -9508,8 +9508,8 @@ void Unit::ModifyAuraState(AuraStateType flag, bool apply) continue; if( (*itr).second->GetSpellInfo()->CasterAuraState == flag ) - if( AuraApplication *aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()) ) - (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, true); + if( AuraApplication *aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()) ) + (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, true); } } @@ -9526,8 +9526,8 @@ void Unit::ModifyAuraState(AuraStateType flag, bool apply) for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr) { if( (*itr).second->GetSpellInfo()->CasterAuraState == flag ) - if( AuraApplication *aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()) ) - (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, false); + if( AuraApplication *aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()) ) + (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, false); } } } @@ -9580,7 +9580,7 @@ void Unit::SetOwnerGUID(uint64 owner) if (!owner) return; - m_applyResilience = !IsVehicle() && IS_PLAYER_GUID(owner); + m_applyResilience = !IsVehicle() && IS_PLAYER_GUID(owner); // Update owner dependent fields Player* player = ObjectAccessor::GetPlayer(*this, owner); @@ -9797,9 +9797,9 @@ void Unit::SetMinion(Minion *minion, bool apply) if (spellInfo && spellInfo->IsCooldownStartedOnEvent()) ToPlayer()->SendCooldownEvent(spellInfo); - // xinef: clear spell book - if (m_Controlled.empty()) - ToPlayer()->SendRemoveControlBar(); + // xinef: clear spell book + if (m_Controlled.empty()) + ToPlayer()->SendRemoveControlBar(); } //if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) @@ -9919,9 +9919,9 @@ void Unit::SetCharm(Unit* charm, bool apply) charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, player->GetByteValue(UNIT_FIELD_BYTES_2, 1)); - // Xinef: skip controlled erase if charmed unit is owned by charmer - if (charm->IsInWorld() && !charm->IsDuringRemoveFromWorld() && player->GetGUID() == this->GetGUID() && (charm->IsPet() || charm->HasUnitTypeMask(UNIT_MASK_MINION))) - return; + // Xinef: skip controlled erase if charmed unit is owned by charmer + if (charm->IsInWorld() && !charm->IsDuringRemoveFromWorld() && player->GetGUID() == this->GetGUID() && (charm->IsPet() || charm->HasUnitTypeMask(UNIT_MASK_MINION))) + return; } else { @@ -9938,14 +9938,14 @@ int32 Unit::DealHeal(Unit* healer, Unit* victim, uint32 addhealth) { int32 gain = 0; - if (healer) - { - if (victim->IsAIEnabled) - victim->GetAI()->HealReceived(healer, addhealth); + if (healer) + { + if (victim->IsAIEnabled) + victim->GetAI()->HealReceived(healer, addhealth); - if (healer->IsAIEnabled) - healer->GetAI()->HealDone(victim, addhealth); - } + if (healer->IsAIEnabled) + healer->GetAI()->HealDone(victim, addhealth); + } if (addhealth) gain = victim->ModifyHealth(int32(addhealth)); @@ -9955,8 +9955,8 @@ int32 Unit::DealHeal(Unit* healer, Unit* victim, uint32 addhealth) if (healer && healer->GetTypeId() == TYPEID_UNIT && healer->ToCreature()->IsTotem()) unit = healer->GetOwner(); - if (!unit) - return gain; + if (!unit) + return gain; if (Player* player = unit->ToPlayer()) { @@ -9981,22 +9981,22 @@ int32 Unit::DealHeal(Unit* healer, Unit* victim, uint32 addhealth) bool RedirectSpellEvent::Execute(uint64 e_time, uint32 p_time) { - if (Unit* auraOwner = ObjectAccessor::GetUnit(_self, _auraOwnerGUID)) - { - // Xinef: already removed - if (!auraOwner->HasAuraType(SPELL_AURA_SPELL_MAGNET)) - return true; + if (Unit* auraOwner = ObjectAccessor::GetUnit(_self, _auraOwnerGUID)) + { + // Xinef: already removed + if (!auraOwner->HasAuraType(SPELL_AURA_SPELL_MAGNET)) + return true; - Unit::AuraEffectList const& magnetAuras = auraOwner->GetAuraEffectsByType(SPELL_AURA_SPELL_MAGNET); - for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr) - if (*itr == _auraEffect) - { - (*itr)->GetBase()->DropCharge(AURA_REMOVE_BY_DEFAULT); - return true; - } - } + Unit::AuraEffectList const& magnetAuras = auraOwner->GetAuraEffectsByType(SPELL_AURA_SPELL_MAGNET); + for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr) + if (*itr == _auraEffect) + { + (*itr)->GetBase()->DropCharge(AURA_REMOVE_BY_DEFAULT); + return true; + } + } - return true; + return true; } Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo) @@ -10014,23 +10014,23 @@ Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo) && _IsValidAttackTarget(magnet, spellInfo) /*&& IsWithinLOSInMap(magnet)*/) { - // Xinef: We should choose minimum between flight time and queue time as in reflect, however we dont know flight time at this point, use arbitrary small number - magnet->m_Events.AddEvent(new RedirectSpellEvent(*magnet, victim->GetGUID(), *itr), magnet->m_Events.CalculateQueueTime(100)); + // Xinef: We should choose minimum between flight time and queue time as in reflect, however we dont know flight time at this point, use arbitrary small number + magnet->m_Events.AddEvent(new RedirectSpellEvent(*magnet, victim->GetGUID(), *itr), magnet->m_Events.CalculateQueueTime(100)); - if (magnet->IsTotem()) - { - uint64 queueTime = magnet->m_Events.CalculateQueueTime(100); - if (spellInfo->Speed > 0.0f) - { - float dist = GetDistance(magnet->GetPositionX(), magnet->GetPositionY(), magnet->GetPositionZ()); - if (dist < 5.0f) - dist = 5.0f; - queueTime = magnet->m_Events.CalculateTime((uint64)floor(dist / spellInfo->Speed * 1000.0f)); - } + if (magnet->IsTotem()) + { + uint64 queueTime = magnet->m_Events.CalculateQueueTime(100); + if (spellInfo->Speed > 0.0f) + { + float dist = GetDistance(magnet->GetPositionX(), magnet->GetPositionY(), magnet->GetPositionZ()); + if (dist < 5.0f) + dist = 5.0f; + queueTime = magnet->m_Events.CalculateTime((uint64)floor(dist / spellInfo->Speed * 1000.0f)); + } - magnet->m_Events.AddEvent(new KillMagnetEvent(*magnet), queueTime); - } - + magnet->m_Events.AddEvent(new KillMagnetEvent(*magnet), queueTime); + } + return magnet; } } @@ -10124,8 +10124,8 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* Target = itr->GetSource()) { - if (Target != this && !IsWithinDistInMap(Target, radius)) - continue; + if (Target != this && !IsWithinDistInMap(Target, radius)) + continue; // IsHostileTo check duel and controlled by enemy if (Target != this && Target->IsAlive() && !IsHostileTo(Target)) @@ -10216,7 +10216,7 @@ int32 Unit::HealBySpell(Unit* victim, SpellInfo const* spellInfo, uint32 addHeal // calculate heal absorb and reduce healing CalcHealAbsorb(victim, spellInfo, addHealth, absorb); - int32 gain = Unit::DealHeal(this, victim, addHealth); + int32 gain = Unit::DealHeal(this, victim, addHealth); SendHealSpellLog(victim, spellInfo->Id, addHealth, uint32(addHealth - gain), absorb, critical); return gain; } @@ -10248,7 +10248,7 @@ float Unit::SpellPctDamageModsDone(Unit* victim, SpellInfo const* spellProto, Da return 1.0f; // Some spells don't benefit from done mods - if (spellProto->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) + if (spellProto->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) return 1.0f; // For totems get damage bonus from owner @@ -10265,61 +10265,61 @@ float Unit::SpellPctDamageModsDone(Unit* victim, SpellInfo const* spellProto, Da if (Unit* owner = GetOwner()) return owner->SpellPctDamageModsDone(victim, spellProto, damagetype); } - } + } // Done total percent damage auras float DoneTotalMod = 1.0f; - AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) - { - if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1 && (*i)->GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization) - continue; + AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) + { + if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1 && (*i)->GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization) + continue; - if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT)) - continue; + if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT)) + continue; - if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) - { - if ((*i)->GetSpellInfo()->EquippedItemClass == -1) - AddPct(DoneTotalMod, (*i)->GetAmount()); - else if (!(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) - AddPct(DoneTotalMod, (*i)->GetAmount()); - else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) - AddPct(DoneTotalMod, (*i)->GetAmount()); - } - } + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) + { + if ((*i)->GetSpellInfo()->EquippedItemClass == -1) + AddPct(DoneTotalMod, (*i)->GetAmount()); + else if (!(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0)) + AddPct(DoneTotalMod, (*i)->GetAmount()); + else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) + AddPct(DoneTotalMod, (*i)->GetAmount()); + } + } - uint32 creatureTypeMask = victim->GetCreatureTypeMask(); - AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); - for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i) - if ((creatureTypeMask & uint32((*i)->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT)) - AddPct(DoneTotalMod, (*i)->GetAmount()); + uint32 creatureTypeMask = victim->GetCreatureTypeMask(); + AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); + for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i) + if ((creatureTypeMask & uint32((*i)->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT)) + AddPct(DoneTotalMod, (*i)->GetAmount()); - // bonus against aurastate - AuraEffectList const& mDamageDoneVersusAurastate = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE); - for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i) - if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT)) - AddPct(DoneTotalMod, (*i)->GetAmount()); + // bonus against aurastate + AuraEffectList const& mDamageDoneVersusAurastate = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE); + for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i) + if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT)) + AddPct(DoneTotalMod, (*i)->GetAmount()); // done scripted mod (take it from owner) Unit* owner = GetOwner() ? GetOwner() : this; AuraEffectList const& mOverrideClassScript= owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { - // Xinef: self cast is ommited (because of Rage of Rivendare) - if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT)) - continue; + // Xinef: self cast is ommited (because of Rage of Rivendare) + if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT)) + continue; - // xinef: Molten Fury should work on all spells - switch ((*i)->GetMiscValue()) + // xinef: Molten Fury should work on all spells + switch ((*i)->GetMiscValue()) { case 4920: // Molten Fury case 4919: if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this)) AddPct(DoneTotalMod, (*i)->GetAmount()); break; - } + } if (!(*i)->IsAffectedOnSpell(spellProto)) continue; @@ -10456,7 +10456,7 @@ float Unit::SpellPctDamageModsDone(Unit* victim, SpellInfo const* spellProto, Da // Torment the weak if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000) if (victim->HasAuraWithMechanic((1<GetAmount()); break; case SPELLFAMILY_PRIEST: @@ -10527,7 +10527,7 @@ float Unit::SpellPctDamageModsDone(Unit* victim, SpellInfo const* spellProto, Da } // Drain Soul - increased damage for targets under 25 % HP if (spellProto->SpellFamilyFlags[0] & 0x00004000) - if (!victim->HealthAbovePct(25)) + if (!victim->HealthAbovePct(25)) DoneTotalMod *= 4; // Shadow Bite (15% increase from each dot) if (spellProto->SpellFamilyFlags[1] & 0x00400000 && IsPet()) @@ -10564,7 +10564,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin return pdamage; // Some spells don't benefit from done mods - if (spellProto->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) + if (spellProto->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) return pdamage; // For totems get damage bonus from owner @@ -10581,24 +10581,24 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (Unit* owner = GetOwner()) return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, TotalMod, stack) / 2; } - } + } // Done total percent damage auras float ApCoeffMod = 1.0f; int32 DoneTotal = 0; - float DoneTotalMod = TotalMod ? TotalMod : SpellPctDamageModsDone(victim, spellProto, damagetype); - - // Config : RATE_CREATURE_X_SPELLDAMAGE & Do Not Modify Pet/Guardian/Mind Controled Damage - if (GetTypeId() == TYPEID_UNIT && (!ToCreature()->IsPet() || !ToCreature()->IsGuardian() || !ToCreature()->IsControlledByPlayer())) - DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); + float DoneTotalMod = TotalMod ? TotalMod : SpellPctDamageModsDone(victim, spellProto, damagetype); + + // Config : RATE_CREATURE_X_SPELLDAMAGE & Do Not Modify Pet/Guardian/Mind Controled Damage + if (GetTypeId() == TYPEID_UNIT && (!ToCreature()->IsPet() || !ToCreature()->IsGuardian() || !ToCreature()->IsControlledByPlayer())) + DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank); - // Some spells don't benefit from pct done mods + // Some spells don't benefit from pct done mods if (!spellProto->HasAttribute(SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS)) { - uint32 creatureTypeMask = victim->GetCreatureTypeMask(); - // Add flat bonus from spell damage versus - DoneTotal += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, creatureTypeMask); - } + uint32 creatureTypeMask = victim->GetCreatureTypeMask(); + // Add flat bonus from spell damage versus + DoneTotal += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, creatureTypeMask); + } // done scripted mod (take it from owner) Unit* owner = GetOwner() ? GetOwner() : this; @@ -10633,11 +10633,11 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin if (AuraEffect* aurEff = GetAuraEffect(64962, EFFECT_1)) AddPct(DoneTotal, aurEff->GetAmount()); - // Impurity - if (AuraEffect *aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 1986, 0)) - AddPct(ApCoeffMod, aurEff->GetAmount()); + // Impurity + if (AuraEffect *aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 1986, 0)) + AddPct(ApCoeffMod, aurEff->GetAmount()); - // Blood Boil - bonus for diseased targets + // Blood Boil - bonus for diseased targets if (spellProto->SpellFamilyFlags[0] & 0x00040000) if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0, 0x00000002, GetGUID())) { @@ -10692,7 +10692,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); } - + float tmpDamage = (float(pdamage) + DoneTotal) * DoneTotalMod; // apply spellmod to Done damage (flat and pct) if (Player* modOwner = GetSpellModOwner()) @@ -10711,11 +10711,11 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) - AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); + AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) if (((*i)->GetMiscValue() & spellProto->GetSchoolMask())) - if (spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT)) - AddPct(TakenTotalMod, (*i)->GetAmount()); + if (spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT)) + AddPct(TakenTotalMod, (*i)->GetAmount()); // .. taken pct: dummy auras @@ -10739,45 +10739,45 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui } // From caster spells - if (caster) - { - AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); - for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) - if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) - if (spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT)) - AddPct(TakenTotalMod, (*i)->GetAmount()); - } + if (caster) + { + AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); + for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) + if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) + if (spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT)) + AddPct(TakenTotalMod, (*i)->GetAmount()); + } if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask()) { - int32 modifierMax = 0; - int32 modifierMin = 0; - AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); - for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - { - if (!spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT)) - continue; + int32 modifierMax = 0; + int32 modifierMin = 0; + AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); + for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) + { + if (!spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT)) + continue; - // Only death knight spell with this aura, ZOMG! - if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT) - if (!caster || caster->GetGUID() != (*i)->GetCasterGUID()) - continue; + // Only death knight spell with this aura, ZOMG! + if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT) + if (!caster || caster->GetGUID() != (*i)->GetCasterGUID()) + continue; - if (mechanicMask & uint32(1 << (*i)->GetMiscValue())) - { - if ((*i)->GetAmount() > 0) - { - if ((*i)->GetAmount() > modifierMax) - modifierMax = (*i)->GetAmount(); - } - else if ((*i)->GetAmount() < modifierMin) - modifierMin = (*i)->GetAmount(); - } - } + if (mechanicMask & uint32(1 << (*i)->GetMiscValue())) + { + if ((*i)->GetAmount() > 0) + { + if ((*i)->GetAmount() > modifierMax) + modifierMax = (*i)->GetAmount(); + } + else if ((*i)->GetAmount() < modifierMin) + modifierMin = (*i)->GetAmount(); + } + } - AddPct(TakenTotalMod, modifierMax); - AddPct(TakenTotalMod, modifierMin); - } + AddPct(TakenTotalMod, modifierMax); + AddPct(TakenTotalMod, modifierMin); + } int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask(), damagetype == DOT); @@ -10790,43 +10790,43 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui // Default calculation if (TakenAdvertisedBenefit) { - if (coeff <= 0.0f) - { - if (caster) - coeff = caster->CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack); - else - coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack); - } + if (coeff <= 0.0f) + { + if (caster) + coeff = caster->CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack); + else + coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack); + } float factorMod = CalculateLevelPenalty(spellProto) * stack; TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod); } - // No positive taken bonus, custom attr - if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f) - { - TakenTotal = 0; - TakenTotalMod = 1.0f; - } + // No positive taken bonus, custom attr + if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f) + { + TakenTotal = 0; + TakenTotalMod = 1.0f; + } - // xinef: sanctified wrath talent - if (caster && TakenTotalMod < 1.0f && caster->HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST)) - { - float ignoreModifier = 1.0f - TakenTotalMod; - bool addModifier = false; - AuraEffectList const& ResIgnoreAuras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); + // xinef: sanctified wrath talent + if (caster && TakenTotalMod < 1.0f && caster->HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST)) + { + float ignoreModifier = 1.0f - TakenTotalMod; + bool addModifier = false; + AuraEffectList const& ResIgnoreAuras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j) - if ((*j)->GetMiscValue() & spellProto->SchoolMask) - { + if ((*j)->GetMiscValue() & spellProto->SchoolMask) + { ApplyPct(ignoreModifier, (*j)->GetAmount()); - addModifier = true; - } + addModifier = true; + } - if (addModifier) - TakenTotalMod += ignoreModifier; - } + if (addModifier) + TakenTotalMod += ignoreModifier; + } - float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod; + float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod; return uint32(std::max(tmpDamage, 0.0f)); } @@ -10877,14 +10877,14 @@ int32 Unit::SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask, bool isDoT) AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) if (((*i)->GetMiscValue() & schoolMask) != 0) - { - // Xinef: if we have DoT damage type and aura has charges, check if it affects DoTs - // Xinef: required for hemorrhage & rupture / garrote - if (isDoT && (*i)->GetBase()->IsUsingCharges() && !((*i)->GetSpellInfo()->ProcFlags & PROC_FLAG_TAKEN_PERIODIC)) - continue; + { + // Xinef: if we have DoT damage type and aura has charges, check if it affects DoTs + // Xinef: required for hemorrhage & rupture / garrote + if (isDoT && (*i)->GetBase()->IsUsingCharges() && !((*i)->GetSpellInfo()->ProcFlags & PROC_FLAG_TAKEN_PERIODIC)) + continue; TakenAdvertisedBenefit += (*i)->GetAmount(); - } + } return TakenAdvertisedBenefit; } @@ -10899,9 +10899,9 @@ float Unit::SpellDoneCritChance(Unit const* /*victim*/, SpellInfo const* spellPr if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT)) return 0.0f; - // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped - if (!skipEffectCheck && !spellProto->IsCritCapable()) - return 0.0f; + // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped + if (!skipEffectCheck && !spellProto->IsCritCapable()) + return 0.0f; float crit_chance = 0.0f; switch (spellProto->DmgClass) @@ -10922,26 +10922,26 @@ float Unit::SpellDoneCritChance(Unit const* /*victim*/, SpellInfo const* spellPr } case SPELL_DAMAGE_CLASS_MELEE: case SPELL_DAMAGE_CLASS_RANGED: - { - if (GetTypeId() == TYPEID_PLAYER) - { - switch (attackType) - { - case BASE_ATTACK: crit_chance = GetFloatValue(PLAYER_CRIT_PERCENTAGE); break; - case OFF_ATTACK: crit_chance = GetFloatValue(PLAYER_OFFHAND_CRIT_PERCENTAGE); break; - case RANGED_ATTACK: crit_chance = GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE); break; - } - } - else - { - crit_chance = 5.0f; - crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); - crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); - } - crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask); + { + if (GetTypeId() == TYPEID_PLAYER) + { + switch (attackType) + { + case BASE_ATTACK: crit_chance = GetFloatValue(PLAYER_CRIT_PERCENTAGE); break; + case OFF_ATTACK: crit_chance = GetFloatValue(PLAYER_OFFHAND_CRIT_PERCENTAGE); break; + case RANGED_ATTACK: crit_chance = GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE); break; + } + } + else + { + crit_chance = 5.0f; + crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); + crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT); + } + crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask); break; - } - // values overridden in spellmgr for lifebloom and earth shield + } + // values overridden in spellmgr for lifebloom and earth shield case SPELL_DAMAGE_CLASS_NONE: default: return 0.0f; @@ -10952,7 +10952,7 @@ float Unit::SpellDoneCritChance(Unit const* /*victim*/, SpellInfo const* spellPr if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance); - // xinef: can be negative! + // xinef: can be negative! return crit_chance; } @@ -10962,9 +10962,9 @@ float Unit::SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT)) return 0.0f; - // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped - if (!skipEffectCheck && !spellProto->IsCritCapable()) - return 0.0f; + // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped + if (!skipEffectCheck && !spellProto->IsCritCapable()) + return 0.0f; float crit_chance = doneChance; switch (spellProto->DmgClass) @@ -10974,185 +10974,185 @@ float Unit::SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto if (!spellProto->IsPositive()) { // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE - // xinef: apply max and min only - if (HasAuraType(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE)) - { - crit_chance += GetMaxNegativeAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask); - crit_chance += GetMaxPositiveAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask); - } + // xinef: apply max and min only + if (HasAuraType(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE)) + { + crit_chance += GetMaxNegativeAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask); + crit_chance += GetMaxPositiveAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, schoolMask); + } - Unit::ApplyResilience(this, &crit_chance, NULL, false, CR_CRIT_TAKEN_SPELL); + Unit::ApplyResilience(this, &crit_chance, NULL, false, CR_CRIT_TAKEN_SPELL); } // scripted (increase crit chance ... against ... target by x% - if (caster) - { - AuraEffectList const& mOverrideClassScript = caster->GetAuraEffectsByType(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()) - { - // Shatter - case 911: modChance+= 16; - case 910: modChance+= 17; - case 849: modChance+= 17; - if (!HasAuraState(AURA_STATE_FROZEN, spellProto, caster)) - break; - crit_chance+=modChance; - break; - case 7917: // Glyph of Shadowburn - if (HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, caster)) - crit_chance+=(*i)->GetAmount(); - break; - case 7997: // Renewed Hope - case 7998: - if (HasAura(6788)) - crit_chance+=(*i)->GetAmount(); - break; - default: - break; - } - } - // Custom crit by class - switch (spellProto->SpellFamilyName) - { - case SPELLFAMILY_MAGE: - // Glyph of Fire Blast - if (spellProto->SpellFamilyFlags[0] == 0x2 && spellProto->SpellIconID == 12) - if (HasAuraWithMechanic((1<GetAuraEffect(56369, EFFECT_0)) - crit_chance += aurEff->GetAmount(); - break; - case SPELLFAMILY_DRUID: - // Improved Faerie Fire - if (HasAuraState(AURA_STATE_FAERIE_FIRE)) - if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 109, 0)) - crit_chance += aurEff->GetAmount(); + if (caster) + { + AuraEffectList const& mOverrideClassScript = caster->GetAuraEffectsByType(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()) + { + // Shatter + case 911: modChance+= 16; + case 910: modChance+= 17; + case 849: modChance+= 17; + if (!HasAuraState(AURA_STATE_FROZEN, spellProto, caster)) + break; + crit_chance+=modChance; + break; + case 7917: // Glyph of Shadowburn + if (HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, caster)) + crit_chance+=(*i)->GetAmount(); + break; + case 7997: // Renewed Hope + case 7998: + if (HasAura(6788)) + crit_chance+=(*i)->GetAmount(); + break; + default: + break; + } + } + // Custom crit by class + switch (spellProto->SpellFamilyName) + { + case SPELLFAMILY_MAGE: + // Glyph of Fire Blast + if (spellProto->SpellFamilyFlags[0] == 0x2 && spellProto->SpellIconID == 12) + if (HasAuraWithMechanic((1<GetAuraEffect(56369, EFFECT_0)) + crit_chance += aurEff->GetAmount(); + break; + case SPELLFAMILY_DRUID: + // Improved Faerie Fire + if (HasAuraState(AURA_STATE_FAERIE_FIRE)) + if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 109, 0)) + crit_chance += aurEff->GetAmount(); - // cumulative effect - don't break + // cumulative effect - don't break - // Starfire - if (spellProto->SpellFamilyFlags[0] & 0x4 && spellProto->SpellIconID == 1485) - { - // Improved Insect Swarm - if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0)) - if (GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00000002, 0, 0)) - crit_chance += aurEff->GetAmount(); - break; - } - break; - case SPELLFAMILY_ROGUE: - // Shiv-applied poisons can't crit - if (caster->FindCurrentSpellBySpellId(5938)) - crit_chance = 0.0f; - break; - case SPELLFAMILY_PALADIN: - // Flash of light - if (spellProto->SpellFamilyFlags[0] & 0x40000000) - { - // Sacred Shield - if (AuraEffect const* aura = GetAuraEffect(58597, 1, GetGUID())) - crit_chance += aura->GetAmount(); - break; - } - // Exorcism - else if (spellProto->GetCategory() == 19) - { - if (GetCreatureTypeMask() & CREATURE_TYPEMASK_DEMON_OR_UNDEAD) - return 100.0f; - break; - } - break; - case SPELLFAMILY_SHAMAN: - // Lava Burst - if (spellProto->SpellFamilyFlags[1] & 0x00001000) - { - if (GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0, 0, caster->GetGUID())) - if (GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE) > -100) - return 100.0f; - break; - } - break; - } - } + // Starfire + if (spellProto->SpellFamilyFlags[0] & 0x4 && spellProto->SpellIconID == 1485) + { + // Improved Insect Swarm + if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0)) + if (GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00000002, 0, 0)) + crit_chance += aurEff->GetAmount(); + break; + } + break; + case SPELLFAMILY_ROGUE: + // Shiv-applied poisons can't crit + if (caster->FindCurrentSpellBySpellId(5938)) + crit_chance = 0.0f; + break; + case SPELLFAMILY_PALADIN: + // Flash of light + if (spellProto->SpellFamilyFlags[0] & 0x40000000) + { + // Sacred Shield + if (AuraEffect const* aura = GetAuraEffect(58597, 1, GetGUID())) + crit_chance += aura->GetAmount(); + break; + } + // Exorcism + else if (spellProto->GetCategory() == 19) + { + if (GetCreatureTypeMask() & CREATURE_TYPEMASK_DEMON_OR_UNDEAD) + return 100.0f; + break; + } + break; + case SPELLFAMILY_SHAMAN: + // Lava Burst + if (spellProto->SpellFamilyFlags[1] & 0x00001000) + { + if (GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0, 0, caster->GetGUID())) + if (GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE) > -100) + return 100.0f; + break; + } + break; + } + } break; } case SPELL_DAMAGE_CLASS_MELEE: // Custom crit by class - if (caster) - switch (spellProto->SpellFamilyName) - { - case SPELLFAMILY_DRUID: - // Rend and Tear - bonus crit chance for Ferocious Bite on bleeding targets - if (spellProto->SpellFamilyFlags[0] & 0x00800000 - && spellProto->SpellIconID == 1680 - && HasAuraState(AURA_STATE_BLEEDING)) - { - if (AuraEffect const* rendAndTear = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 1)) - crit_chance += rendAndTear->GetAmount(); - break; - } - break; - case SPELLFAMILY_WARRIOR: - // Victory Rush - if (spellProto->SpellFamilyFlags[1] & 0x100) - { - // Glyph of Victory Rush - if (AuraEffect const* aurEff = caster->GetAuraEffect(58382, 0)) - crit_chance += aurEff->GetAmount(); - break; - } - break; - } + if (caster) + switch (spellProto->SpellFamilyName) + { + case SPELLFAMILY_DRUID: + // Rend and Tear - bonus crit chance for Ferocious Bite on bleeding targets + if (spellProto->SpellFamilyFlags[0] & 0x00800000 + && spellProto->SpellIconID == 1680 + && HasAuraState(AURA_STATE_BLEEDING)) + { + if (AuraEffect const* rendAndTear = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 1)) + crit_chance += rendAndTear->GetAmount(); + break; + } + break; + case SPELLFAMILY_WARRIOR: + // Victory Rush + if (spellProto->SpellFamilyFlags[1] & 0x100) + { + // Glyph of Victory Rush + if (AuraEffect const* aurEff = caster->GetAuraEffect(58382, 0)) + crit_chance += aurEff->GetAmount(); + break; + } + break; + } case SPELL_DAMAGE_CLASS_RANGED: { - // flat aura mods - if (attackType == RANGED_ATTACK) - crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE); - else - crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE); + // flat aura mods + if (attackType == RANGED_ATTACK) + crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE); + else + crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE); - // reduce crit chance from Rating for players - if (attackType != RANGED_ATTACK) - { - // xinef: little hack, crit chance dont require caster to calculate, pass victim - Unit::ApplyResilience(this, &crit_chance, NULL, false, CR_CRIT_TAKEN_MELEE); - } - else - Unit::ApplyResilience(this, &crit_chance, NULL, false, CR_CRIT_TAKEN_RANGED); + // reduce crit chance from Rating for players + if (attackType != RANGED_ATTACK) + { + // xinef: little hack, crit chance dont require caster to calculate, pass victim + Unit::ApplyResilience(this, &crit_chance, NULL, false, CR_CRIT_TAKEN_MELEE); + } + else + Unit::ApplyResilience(this, &crit_chance, NULL, false, CR_CRIT_TAKEN_RANGED); - // Apply crit chance from defence skill - if (caster) - crit_chance += (int32(caster->GetMaxSkillValueForLevel(this)) - int32(GetDefenseSkillValue(caster))) * 0.04f; + // Apply crit chance from defence skill + if (caster) + crit_chance += (int32(caster->GetMaxSkillValueForLevel(this)) - int32(GetDefenseSkillValue(caster))) * 0.04f; break; } - // values overridden in spellmgr for lifebloom and earth shield + // values overridden in spellmgr for lifebloom and earth shield case SPELL_DAMAGE_CLASS_NONE: default: return 0.0f; } - if (caster) - { - AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER); - for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) - { - if (caster->GetGUID() != (*i)->GetCasterGUID()) - continue; + if (caster) + { + AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER); + for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) + { + if (caster->GetGUID() != (*i)->GetCasterGUID()) + continue; - crit_chance += (*i)->GetAmount(); - } - } + crit_chance += (*i)->GetAmount(); + } + } - // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE - // xinef: should be calculated at the end - if (!spellProto->IsPositive()) - crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE); + // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE + // xinef: should be calculated at the end + if (!spellProto->IsPositive()) + crit_chance += GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE); - // xinef: can be negative! + // xinef: can be negative! return crit_chance; } @@ -11174,27 +11174,27 @@ uint32 Unit::SpellCriticalDamageBonus(Unit const* caster, SpellInfo const* spell break; } - if (caster) - { - crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellProto->GetSchoolMask()); + if (caster) + { + crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellProto->GetSchoolMask()); - if (victim) - crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, victim->GetCreatureTypeMask()); + if (victim) + crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, victim->GetCreatureTypeMask()); - if (crit_bonus != 0 && crit_mod != 0.0f) - AddPct(crit_bonus, crit_mod); + if (crit_bonus != 0 && crit_mod != 0.0f) + AddPct(crit_bonus, crit_mod); - crit_bonus -= damage; + crit_bonus -= damage; - if (damage > uint32(crit_bonus)) - { - // adds additional damage to critBonus (from talents) - if (Player* modOwner = caster->GetSpellModOwner()) - modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus); - } + if (damage > uint32(crit_bonus)) + { + // adds additional damage to critBonus (from talents) + if (Player* modOwner = caster->GetSpellModOwner()) + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus); + } - crit_bonus += damage; - } + crit_bonus += damage; + } return crit_bonus; } @@ -11217,23 +11217,23 @@ uint32 Unit::SpellCriticalHealingBonus(Unit const* caster, SpellInfo const* spel if (caster) { - if (victim) - { - uint32 creatureTypeMask = victim->GetCreatureTypeMask(); - crit_bonus = int32(crit_bonus * caster->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, creatureTypeMask)); - } + if (victim) + { + uint32 creatureTypeMask = victim->GetCreatureTypeMask(); + crit_bonus = int32(crit_bonus * caster->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, creatureTypeMask)); + } - // adds additional damage to critBonus (from talents) - // xinef: used for death knight death coil - if (Player* modOwner = caster->GetSpellModOwner()) - modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus); - } + // adds additional damage to critBonus (from talents) + // xinef: used for death knight death coil + if (Player* modOwner = caster->GetSpellModOwner()) + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus); + } if (crit_bonus > 0) damage += crit_bonus; - if (caster) - damage = int32(float(damage) * caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT)); + if (caster) + damage = int32(float(damage) * caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT)); return damage; } @@ -11260,9 +11260,9 @@ float Unit::SpellPctHealingModsDone(Unit* victim, SpellInfo const* spellProto, D float DoneTotalMod = 1.0f; // Healing done percent - AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); - for (AuraEffectList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i) - AddPct(DoneTotalMod, (*i)->GetAmount()); + AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT); + for (AuraEffectList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i) + AddPct(DoneTotalMod, (*i)->GetAmount()); // done scripted mod (take it from owner) Unit* owner = GetOwner() ? GetOwner() : this; @@ -11289,7 +11289,7 @@ float Unit::SpellPctHealingModsDone(Unit* victim, SpellInfo const* spellProto, D case 7871: // Glyph of Lesser Healing Wave { - // xinef: affected by any earth shield + // xinef: affected by any earth shield if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0)) AddPct(DoneTotalMod, (*i)->GetAmount()); break; @@ -11299,30 +11299,30 @@ float Unit::SpellPctHealingModsDone(Unit* victim, SpellInfo const* spellProto, D } } - switch (spellProto->SpellFamilyName) - { - case SPELLFAMILY_GENERIC: - // Talents and glyphs for healing stream totem - if (spellProto->Id == 52042) - { - // Glyph of Healing Stream Totem - if (AuraEffect *dummy = owner->GetAuraEffect(55456, EFFECT_0)) - AddPct(DoneTotalMod, dummy->GetAmount()); + switch (spellProto->SpellFamilyName) + { + case SPELLFAMILY_GENERIC: + // Talents and glyphs for healing stream totem + if (spellProto->Id == 52042) + { + // Glyph of Healing Stream Totem + if (AuraEffect *dummy = owner->GetAuraEffect(55456, EFFECT_0)) + AddPct(DoneTotalMod, dummy->GetAmount()); - // Healing Stream totem - Restorative Totems - if (AuraEffect *aurEff = GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 338, 1)) - AddPct(DoneTotalMod, aurEff->GetAmount()); - } - break; - case SPELLFAMILY_PRIEST: - // T9 HEALING 4P, empowered renew instant heal - if (spellProto->Id == 63544) - if (AuraEffect *aurEff = GetAuraEffect(67202, EFFECT_0)) - AddPct(DoneTotalMod, aurEff->GetAmount()); - break; - } + // Healing Stream totem - Restorative Totems + if (AuraEffect *aurEff = GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 338, 1)) + AddPct(DoneTotalMod, aurEff->GetAmount()); + } + break; + case SPELLFAMILY_PRIEST: + // T9 HEALING 4P, empowered renew instant heal + if (spellProto->Id == 63544) + if (AuraEffect *aurEff = GetAuraEffect(67202, EFFECT_0)) + AddPct(DoneTotalMod, aurEff->GetAmount()); + break; + } - return DoneTotalMod; + return DoneTotalMod; } uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, float TotalMod, uint32 stack) @@ -11336,8 +11336,8 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui if (spellProto->SpellFamilyName == SPELLFAMILY_POTION) return healamount; - float ApCoeffMod = 1.0f; - float DoneTotalMod = TotalMod ? TotalMod : SpellPctHealingModsDone(victim, spellProto, damagetype); + float ApCoeffMod = 1.0f; + float DoneTotalMod = TotalMod ? TotalMod : SpellPctHealingModsDone(victim, spellProto, damagetype); int32 DoneTotal = 0; // done scripted mod (take it from owner) @@ -11361,15 +11361,15 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask()); float coeff = 0; - switch (spellProto->SpellFamilyName) - { - case SPELLFAMILY_DEATHKNIGHT: - // Impurity - if (AuraEffect *aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 1986, 0)) - AddPct(ApCoeffMod, aurEff->GetAmount()); + switch (spellProto->SpellFamilyName) + { + case SPELLFAMILY_DEATHKNIGHT: + // Impurity + if (AuraEffect *aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 1986, 0)) + AddPct(ApCoeffMod, aurEff->GetAmount()); - break; - } + break; + } // Check for table values SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id); @@ -11390,7 +11390,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass !=SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK)); } } - else + else { // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) @@ -11400,7 +11400,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui // Default calculation if (DoneAdvertisedBenefit) { - float factorMod = CalculateLevelPenalty(spellProto) * stack; + float factorMod = CalculateLevelPenalty(spellProto) * stack; if (Player* modOwner = GetSpellModOwner()) { coeff *= 100.0f; @@ -11410,7 +11410,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod); } - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { switch (spellProto->Effects[i].ApplyAuraName) { @@ -11431,7 +11431,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal); - return uint32(std::max(heal, 0.0f)); + return uint32(std::max(heal, 0.0f)); } uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack) @@ -11460,25 +11460,25 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u // Nourish cast, glyph of nourish if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000 && caster) { - bool any = false; - bool hasglyph = caster->GetAuraEffectDummy(62971); - AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL); - for (AuraEffectList::const_iterator i = auras.begin();i != auras.end(); ++i) - { - if (((*i)->GetCasterGUID() == caster->GetGUID())) - { - SpellInfo const *spell = (*i)->GetSpellInfo(); - // Rejuvenation, Regrowth, Lifebloom, or Wild Growth - if (!any && spell->SpellFamilyFlags.HasFlag(0x50, 0x4000010, 0)) - { - TakenTotalMod *= 1.2f; - any = true; - } + bool any = false; + bool hasglyph = caster->GetAuraEffectDummy(62971); + AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL); + for (AuraEffectList::const_iterator i = auras.begin();i != auras.end(); ++i) + { + if (((*i)->GetCasterGUID() == caster->GetGUID())) + { + SpellInfo const *spell = (*i)->GetSpellInfo(); + // Rejuvenation, Regrowth, Lifebloom, or Wild Growth + if (!any && spell->SpellFamilyFlags.HasFlag(0x50, 0x4000010, 0)) + { + TakenTotalMod *= 1.2f; + any = true; + } - if (hasglyph) - TakenTotalMod += 0.06f; - } - } + if (hasglyph) + TakenTotalMod += 0.06f; + } + } } if (damagetype == DOT) @@ -11499,7 +11499,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u float factorMod = 1.0f; if (bonus) coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage; - else + else { // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) @@ -11512,8 +11512,8 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u // Default calculation if (TakenAdvertisedBenefit) { - float TakenCoeff = 0.0f; - if (coeff <= 0) + float TakenCoeff = 0.0f; + if (coeff <= 0) coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells) factorMod *= CalculateLevelPenalty(spellProto) * int32(stack); @@ -11524,16 +11524,16 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u coeff /= 100.0f; } - TakenTotal += int32(TakenAdvertisedBenefit * (coeff > 0 ? coeff : TakenCoeff) * factorMod); + TakenTotal += int32(TakenAdvertisedBenefit * (coeff > 0 ? coeff : TakenCoeff) * factorMod); } - if (caster) - { - AuraEffectList const& mHealingGet= GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED); - for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) - if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto)) - AddPct(TakenTotalMod, (*i)->GetAmount()); - } + if (caster) + { + AuraEffectList const& mHealingGet= GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED); + for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) + if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto)) + AddPct(TakenTotalMod, (*i)->GetAmount()); + } for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { @@ -11549,12 +11549,12 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u TakenTotal = 0; } - // No positive taken bonus, custom attr - if ((spellProto->HasAttribute(SPELL_ATTR6_LIMIT_PCT_HEALING_MODS) || spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS)) && TakenTotalMod > 1.0f) - { - TakenTotal = 0; - TakenTotalMod = 1.0f; - } + // No positive taken bonus, custom attr + if ((spellProto->HasAttribute(SPELL_ATTR6_LIMIT_PCT_HEALING_MODS) || spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS)) && TakenTotalMod > 1.0f) + { + TakenTotal = 0; + TakenTotalMod = 1.0f; + } float heal = float(int32(healamount) + TakenTotal) * TakenTotalMod; @@ -11649,7 +11649,7 @@ bool Unit::IsImmunedToSchool(SpellInfo const* spellInfo) const return false; uint32 schoolMask = spellInfo->GetSchoolMask(); - if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471) + if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471) { // If m_immuneToSchool type contain this school type, IMMUNE damage. SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; @@ -11682,15 +11682,15 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) if (itr->type == spellInfo->Id) return true; - // xinef: my special immunity, if spellid is not on this list it means npc is immune - SpellImmuneList const& allowIdList = m_spellImmune[IMMUNITY_ALLOW_ID]; - if (!allowIdList.empty()) - { - for (SpellImmuneList::const_iterator itr = allowIdList.begin(); itr != allowIdList.end(); ++itr) - if (itr->type == spellInfo->Id) - return false; - return true; - } + // xinef: my special immunity, if spellid is not on this list it means npc is immune + SpellImmuneList const& allowIdList = m_spellImmune[IMMUNITY_ALLOW_ID]; + if (!allowIdList.empty()) + { + for (SpellImmuneList::const_iterator itr = allowIdList.begin(); itr != allowIdList.end(); ++itr) + if (itr->type == spellInfo->Id) + return false; + return true; + } if (spellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) && !HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) return false; @@ -11718,15 +11718,15 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) // State/effect immunities applied by aura expect full spell immunity // Ignore effects with mechanic, they are supposed to be checked separately if (!spellInfo->Effects[i].IsEffect()) - continue; - - // Xinef: if target is immune to one effect, and the spell has transform aura - it is immune to whole spell - if (IsImmunedToSpellEffect(spellInfo, i)) - { - if (spellInfo->HasAura(SPELL_AURA_TRANSFORM)) - return true; - continue; - } + continue; + + // Xinef: if target is immune to one effect, and the spell has transform aura - it is immune to whole spell + if (IsImmunedToSpellEffect(spellInfo, i)) + { + if (spellInfo->HasAura(SPELL_AURA_TRANSFORM)) + return true; + continue; + } immuneToAllEffects = false; break; @@ -11734,7 +11734,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects. return true; - if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471) + if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471) { SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) @@ -11755,12 +11755,12 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons if (!spellInfo || !spellInfo->Effects[index].IsEffect()) return false; - // xinef: pet scaling auras - if (spellInfo->HasAttribute(SPELL_ATTR4_IS_PET_SCALING)) - return false; + // xinef: pet scaling auras + if (spellInfo->HasAttribute(SPELL_ATTR4_IS_PET_SCALING)) + return false; - if (spellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) && !HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) - return false; + if (spellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) && !HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) + return false; //If m_immuneToEffect type contain this effect type, IMMUNE effect. uint32 effect = spellInfo->Effects[index].Effect; @@ -11783,16 +11783,16 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons for (SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr) if (itr->type == aura && (itr->spellId != 64848 || spellInfo->Effects[index].MiscValue == POWER_MANA)) if (!spellInfo->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT)) - if (itr->blockType == SPELL_BLOCK_TYPE_ALL || spellInfo->IsPositive()) // xinef: added for pet scaling - return true; + if (itr->blockType == SPELL_BLOCK_TYPE_ALL || spellInfo->IsPositive()) // xinef: added for pet scaling + return true; // Check for immune to application of harmful magical effects AuraEffectList const& immuneAuraApply = GetAuraEffectsByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL); for (AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter) - if (/*(spellInfo->Dispel == DISPEL_MAGIC || spellInfo->Dispel == DISPEL_CURSE || spellInfo->Dispel == DISPEL_DISEASE) &&*/ // Magic debuff, xinef: all kinds? + if (/*(spellInfo->Dispel == DISPEL_MAGIC || spellInfo->Dispel == DISPEL_CURSE || spellInfo->Dispel == DISPEL_DISEASE) &&*/ // Magic debuff, xinef: all kinds? ((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) && // Check school !spellInfo->IsPositiveEffect(index) && // Harmful - spellInfo->Effects[index].Effect != SPELL_EFFECT_PERSISTENT_AREA_AURA) // Not Persistent area auras + spellInfo->Effects[index].Effect != SPELL_EFFECT_PERSISTENT_AREA_AURA) // Not Persistent area auras return true; } @@ -11812,7 +11812,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType if (Unit* owner = GetOwner()) return owner->MeleeDamageBonusDone(victim, pdamage, attType, spellProto) / 2; } - } + } uint32 creatureTypeMask = victim->GetCreatureTypeMask(); @@ -11865,19 +11865,19 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType DoneFlatBenefit += int32(APbonus/14.0f * GetAPMultiplier(attType, normalized)); } - // Done total percent damage auras + // Done total percent damage auras float DoneTotalMod = 1.0f; // Some spells don't benefit from pct done mods if (spellProto) - { + { AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { - if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, false)) - continue; + if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, false)) + continue; - if (((*i)->GetMiscValue() & spellProto->GetSchoolMask()) && !((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)) + if (((*i)->GetMiscValue() & spellProto->GetSchoolMask()) && !((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)) { if ((*i)->GetSpellInfo()->EquippedItemClass == -1) AddPct(DoneTotalMod, (*i)->GetAmount()); @@ -11889,26 +11889,26 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType } } - AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); - for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i) - if (creatureTypeMask & uint32((*i)->GetMiscValue())) - if (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, *i, false)) - AddPct(DoneTotalMod, (*i)->GetAmount()); + AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); + for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i) + if (creatureTypeMask & uint32((*i)->GetMiscValue())) + if (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, *i, false)) + AddPct(DoneTotalMod, (*i)->GetAmount()); - // bonus against aurastate - AuraEffectList const& mDamageDoneVersusAurastate = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE); - for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i) - if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue()))) - if (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, *i, false)) - AddPct(DoneTotalMod, (*i)->GetAmount()); + // bonus against aurastate + AuraEffectList const& mDamageDoneVersusAurastate = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE); + for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i) + if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue()))) + if (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, *i, false)) + AddPct(DoneTotalMod, (*i)->GetAmount()); // done scripted mod (take it from owner) Unit* owner = GetOwner() ? GetOwner() : this; AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) { - if (spellProto && !spellProto->ValidateAttribute6SpellDamageMods(this, *i, false)) - continue; + if (spellProto && !spellProto->ValidateAttribute6SpellDamageMods(this, *i, false)) + continue; if (!(*i)->IsAffectedOnSpell(spellProto)) continue; @@ -11980,15 +11980,15 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType break; } - // Some spells don't benefit from done mods - if (spellProto) - if (spellProto->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) - { - DoneFlatBenefit = 0; - DoneTotalMod = 1.0f; - } + // Some spells don't benefit from done mods + if (spellProto) + if (spellProto->HasAttribute(SPELL_ATTR3_NO_DONE_BONUS)) + { + DoneFlatBenefit = 0; + DoneTotalMod = 1.0f; + } - float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod; + float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod; // apply spellmod to Done damage if (spellProto) @@ -12009,7 +12009,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT // ..taken AuraEffectList const& mDamageTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_TAKEN); for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) - if ((*i)->GetMiscValue() & (spellProto ? spellProto->SchoolMask : attacker->GetMeleeDamageSchoolMask())) + if ((*i)->GetMiscValue() & (spellProto ? spellProto->SchoolMask : attacker->GetMeleeDamageSchoolMask())) TakenFlatBenefit += (*i)->GetAmount(); if (attType != RANGED_ATTACK) @@ -12017,7 +12017,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT else TakenFlatBenefit += GetTotalAuraModifier(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN); - // Taken total percent damage auras + // Taken total percent damage auras float TakenTotalMod = 1.0f; TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, spellProto ? spellProto->SchoolMask : attacker->GetMeleeDamageSchoolMask()); @@ -12025,7 +12025,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT // .. taken pct (special attacks) if (spellProto) { - // From caster spells + // From caster spells AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) if ((*i)->GetCasterGUID() == attacker->GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) @@ -12089,30 +12089,30 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT AddPct(TakenTotalMod, (*i)->GetAmount()); } - // No positive taken bonus, custom attr - if (spellProto) - if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f) - { - TakenFlatBenefit = 0; - TakenTotalMod = 1.0f; - } + // No positive taken bonus, custom attr + if (spellProto) + if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f) + { + TakenFlatBenefit = 0; + TakenTotalMod = 1.0f; + } - // xinef: sanctified wrath talent - if (TakenTotalMod < 1.0f && attacker->HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST)) - { - float ignoreModifier = 1.0f - TakenTotalMod; - bool addModifier = false; - AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); + // xinef: sanctified wrath talent + if (TakenTotalMod < 1.0f && attacker->HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST)) + { + float ignoreModifier = 1.0f - TakenTotalMod; + bool addModifier = false; + AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j) - if ((*j)->GetMiscValue() & (spellProto ? spellProto->SchoolMask : SPELL_SCHOOL_MASK_NORMAL)) - { + if ((*j)->GetMiscValue() & (spellProto ? spellProto->SchoolMask : SPELL_SCHOOL_MASK_NORMAL)) + { ApplyPct(ignoreModifier, (*j)->GetAmount()); - addModifier = true; - } + addModifier = true; + } - if (addModifier) - TakenTotalMod += ignoreModifier; - } + if (addModifier) + TakenTotalMod += ignoreModifier; + } float tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod; @@ -12124,24 +12124,24 @@ class spellIdImmunityPredicate { public: spellIdImmunityPredicate(uint32 type) : _type(type) {} - bool operator()(SpellImmune const& spellImmune) { return spellImmune.spellId == 0 && spellImmune.type == _type; } + bool operator()(SpellImmune const& spellImmune) { return spellImmune.spellId == 0 && spellImmune.type == _type; } private: - uint32 _type; + uint32 _type; }; void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType) { if (apply) { - // xinef: immunities with spellId 0 are intended to be applied only once (script purposes mosty) - if (spellId == 0 && std::find_if(m_spellImmune[op].begin(), m_spellImmune[op].end(), spellIdImmunityPredicate(type)) != m_spellImmune[op].end()) - return; + // xinef: immunities with spellId 0 are intended to be applied only once (script purposes mosty) + if (spellId == 0 && std::find_if(m_spellImmune[op].begin(), m_spellImmune[op].end(), spellIdImmunityPredicate(type)) != m_spellImmune[op].end()) + return; SpellImmune Immune; Immune.spellId = spellId; Immune.type = type; - Immune.blockType = blockType; + Immune.blockType = blockType; m_spellImmune[op].push_back(Immune); } else @@ -12248,10 +12248,10 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry) player->UnsummonPetTemporaryIfAny(); } - // xinef: if we have charmed npc, stun him also - if (Unit* charm = player->GetCharm()) - if (charm->GetTypeId() == TYPEID_UNIT) - charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + // xinef: if we have charmed npc, stun him also + if (Unit* charm = player->GetCharm()) + if (charm->GetTypeId() == TYPEID_UNIT) + charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4); data.append(GetPackGUID()); @@ -12311,19 +12311,19 @@ void Unit::Dismount() else player->ResummonPetTemporaryUnSummonedIfAny(); - // xinef: if we have charmed npc, remove stun also - if (Unit* charm = player->GetCharm()) - if (charm->GetTypeId() == TYPEID_UNIT && !charm->HasUnitState(UNIT_STATE_STUNNED)) - charm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + // xinef: if we have charmed npc, remove stun also + if (Unit* charm = player->GetCharm()) + if (charm->GetTypeId() == TYPEID_UNIT && !charm->HasUnitState(UNIT_STATE_STUNNED)) + charm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); } } void Unit::SetInCombatWith(Unit* enemy, uint32 duration) { - - // Xinef: Dont allow to start combat with triggers - if (enemy->GetTypeId() == TYPEID_UNIT && enemy->ToCreature()->IsTrigger()) - return; + + // Xinef: Dont allow to start combat with triggers + if (enemy->GetTypeId() == TYPEID_UNIT && enemy->ToCreature()->IsTrigger()) + return; Unit* eOwner = enemy->GetCharmerOrOwnerOrSelf(); if (eOwner->IsPvP() || eOwner->IsFFAPvP()) @@ -12348,9 +12348,9 @@ void Unit::SetInCombatWith(Unit* enemy, uint32 duration) void Unit::CombatStart(Unit* target, bool initialAggro) { - // Xinef: Dont allow to start combat with triggers - if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsTrigger()) - return; + // Xinef: Dont allow to start combat with triggers + if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsTrigger()) + return; if (initialAggro) { @@ -12368,12 +12368,12 @@ void Unit::CombatStart(Unit* target, bool initialAggro) SetInCombatWith(target); target->SetInCombatWith(this); - // Xinef: If pet started combat - put owner in combat - if (Unit* owner = GetOwner()) - { - owner->SetInCombatWith(target); - target->SetInCombatWith(owner); - } + // Xinef: If pet started combat - put owner in combat + if (Unit* owner = GetOwner()) + { + owner->SetInCombatWith(target); + target->SetInCombatWith(owner); + } } Unit* who = target->GetCharmerOrOwnerOrSelf(); @@ -12390,17 +12390,17 @@ void Unit::CombatStart(Unit* target, bool initialAggro) void Unit::CombatStartOnCast(Unit* target, bool initialAggro, uint32 duration) { - // Xinef: Dont allow to start combat with triggers - if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsTrigger()) - return; + // Xinef: Dont allow to start combat with triggers + if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsTrigger()) + return; if (initialAggro) { SetInCombatWith(target, duration); - // Xinef: If pet started combat - put owner in combat - if (Unit* owner = GetOwner()) - owner->SetInCombatWith(target, duration); + // Xinef: If pet started combat - put owner in combat + if (Unit* owner = GetOwner()) + owner->SetInCombatWith(target, duration); } Unit* who = target->GetCharmerOrOwnerOrSelf(); @@ -12422,18 +12422,18 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration) return; if (PvP) - m_CombatTimer = std::max(GetCombatTimer(), std::max(5500, duration)); - else if (duration) - m_CombatTimer = std::max(GetCombatTimer(), duration); + m_CombatTimer = std::max(GetCombatTimer(), std::max(5500, duration)); + else if (duration) + m_CombatTimer = std::max(GetCombatTimer(), duration); if (HasUnitState(UNIT_STATE_EVADE) || GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET) return; - // xinef: if we somehow engage in combat (scripts, dunno) with player, remove this flag so he can fight back - if (GetTypeId() == TYPEID_UNIT && enemy && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && enemy->GetCharmerOrOwnerPlayerOrPlayerItself()) - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // unit has engaged in combat, remove immunity so players can fight back + // xinef: if we somehow engage in combat (scripts, dunno) with player, remove this flag so he can fight back + if (GetTypeId() == TYPEID_UNIT && enemy && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && enemy->GetCharmerOrOwnerPlayerOrPlayerItself()) + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // unit has engaged in combat, remove immunity so players can fight back - if (IsInCombat()) + if (IsInCombat()) return; SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); @@ -12446,7 +12446,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration) // Set home position at place of engaging combat for escorted creatures if ((IsAIEnabled && creature->AI()->IsEscorted()) || GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE || - GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE) + GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE) creature->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); if (enemy) @@ -12473,12 +12473,12 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration) for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();) { - Unit* controlled = *itr; - ++itr; + Unit* controlled = *itr; + ++itr; - // Xinef: Dont set combat for passive units, they will evade in next update... - if (controlled->GetTypeId() == TYPEID_UNIT && controlled->ToCreature()->HasReactState(REACT_PASSIVE)) - continue; + // Xinef: Dont set combat for passive units, they will evade in next update... + if (controlled->GetTypeId() == TYPEID_UNIT && controlled->ToCreature()->HasReactState(REACT_PASSIVE)) + continue; controlled->SetInCombatState(PvP, enemy); } @@ -12499,7 +12499,7 @@ void Unit::ClearInCombat() if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED)) SetUInt32Value(UNIT_DYNAMIC_FLAGS, creature->GetCreatureTemplate()->dynamicflags); - // Xinef: will be recalculated at follow movement generator initialization + // Xinef: will be recalculated at follow movement generator initialization if (!IsPet() && !IsCharmed()) return; } @@ -12514,9 +12514,9 @@ void Unit::ClearInCombat() void Unit::ClearInPetCombat() { - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); - if (Unit* owner = GetOwner()) - owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); + if (Unit* owner = GetOwner()) + owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); } bool Unit::isTargetableForAttack(bool checkFakeDeath, Unit const* byWho) const @@ -12525,9 +12525,9 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath, Unit const* byWho) const return false; if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) - return false; + return false; - if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && byWho && byWho->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && byWho && byWho->GetCharmerOrOwnerPlayerOrPlayerItself()) return false; if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->IsGameMaster()) @@ -12558,11 +12558,11 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo // can't attack own vehicle or passenger if (m_vehicle) if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target)) - if (!IsHostileTo(target)) // pussywizard: actually can attack own vehicle or passenger if it's hostile to us - needed for snobold in Gormok encounter - return false; + if (!IsHostileTo(target)) // pussywizard: actually can attack own vehicle or passenger if it's hostile to us - needed for snobold in Gormok encounter + return false; // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit. - if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea() && !bySpell->HasAttribute(SPELL_ATTR3_NO_INITIAL_AGGRO)) : !CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea() && !bySpell->HasAttribute(SPELL_ATTR3_NO_INITIAL_AGGRO)))) + if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea() && !bySpell->HasAttribute(SPELL_ATTR3_NO_INITIAL_AGGRO)) : !CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea() && !bySpell->HasAttribute(SPELL_ATTR3_NO_INITIAL_AGGRO)))) return false; // can't attack dead @@ -12594,8 +12594,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo // PvP, PvC, CvP case // can't attack friendly targets - ReputationRank repThisToTarget = GetReactionTo(target); - ReputationRank repTargetToThis; + ReputationRank repThisToTarget = GetReactionTo(target); + ReputationRank repTargetToThis; if (repThisToTarget > REP_NEUTRAL || (repTargetToThis = target->GetReactionTo(this)) > REP_NEUTRAL) @@ -12648,7 +12648,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo if (target->IsPvP()) return true; - if (IsFFAPvP() && target->IsFFAPvP()) + if (IsFFAPvP() && target->IsFFAPvP()) return true; return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_UNK1) || target->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_UNK1); @@ -12695,9 +12695,9 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co if (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_ASSIST_IGNORE_IMMUNE_FLAG)) { - // xinef: do not allow to assist non attackable units - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return false; + // xinef: do not allow to assist non attackable units + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return false; if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) { @@ -12879,12 +12879,12 @@ bool Unit::IsAlwaysDetectableFor(WorldObject const* seer) const if (HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, seer->GetGUID())) return true; - if (Player *ownerPlayer = GetSpellModOwner()) - if (const Player* seerPlayer = seer->ToPlayer()) - { - if (ownerPlayer->IsGroupVisibleFor(seerPlayer)) - return true; - } + if (Player *ownerPlayer = GetSpellModOwner()) + if (const Player* seerPlayer = seer->ToPlayer()) + { + if (ownerPlayer->IsGroupVisibleFor(seerPlayer)) + return true; + } return false; } @@ -12901,10 +12901,10 @@ void Unit::SetVisible(bool x) void Unit::SetModelVisible(bool on) { - if (on) - RemoveAurasDueToSpell(24401); - else - CastSpell(this, 24401, true); + if (on) + RemoveAurasDueToSpell(24401); + else + CastSpell(this, 24401, true); } void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) @@ -12940,19 +12940,19 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) } case MOVE_SWIM: { - // xinef: check for forced_speed_mod of sea turtle - Unit::AuraEffectList const& swimAuras = GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_SWIM_SPEED); - for (Unit::AuraEffectList::const_iterator itr = swimAuras.begin(); itr != swimAuras.end(); ++itr) - { - // xinef: sea turtle only, it is not affected by any increasing / decreasing effects - if ((*itr)->GetId() == 64731 /*SPELL_SEA_TURTLE*/) - { - SetSpeed(mtype, AddPct(non_stack_bonus, (*itr)->GetAmount()), forced); - return; - } - else if ((*itr)->GetAmount() > main_speed_mod) - main_speed_mod = (*itr)->GetAmount(); - } + // xinef: check for forced_speed_mod of sea turtle + Unit::AuraEffectList const& swimAuras = GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_SWIM_SPEED); + for (Unit::AuraEffectList::const_iterator itr = swimAuras.begin(); itr != swimAuras.end(); ++itr) + { + // xinef: sea turtle only, it is not affected by any increasing / decreasing effects + if ((*itr)->GetId() == 64731 /*SPELL_SEA_TURTLE*/) + { + SetSpeed(mtype, AddPct(non_stack_bonus, (*itr)->GetAmount()), forced); + return; + } + else if ((*itr)->GetAmount() > main_speed_mod) + main_speed_mod = (*itr)->GetAmount(); + } break; } case MOVE_FLIGHT: @@ -13002,16 +13002,16 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) case MOVE_FLIGHT: { if (GetTypeId() == TYPEID_UNIT) - { - Unit* pOwner = GetCharmerOrOwner(); - if (pOwner && !IsInCombat() && !IsVehicle() && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && (IsPet() || IsGuardian() || GetGUID() == pOwner->GetCritterGUID() || GetCharmerGUID() == pOwner->GetGUID())) - { - if (speed < pOwner->GetSpeedRate(mtype)+0.1f) - speed = pOwner->GetSpeedRate(mtype)+0.1f; // pets derive speed from owner when not in combat - } + { + Unit* pOwner = GetCharmerOrOwner(); + if (pOwner && !IsInCombat() && !IsVehicle() && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && (IsPet() || IsGuardian() || GetGUID() == pOwner->GetCritterGUID() || GetCharmerGUID() == pOwner->GetGUID())) + { + if (speed < pOwner->GetSpeedRate(mtype)+0.1f) + speed = pOwner->GetSpeedRate(mtype)+0.1f; // pets derive speed from owner when not in combat + } else speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached - } + } // Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need // TODO: possible affect only on MOVE_RUN @@ -13020,9 +13020,9 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) // Use speed from aura float max_speed = normalization / (IsControlledByPlayer() ? playerBaseMoveSpeed[mtype] : baseMoveSpeed[mtype]); - // Xinef: normal movement speed - multiply by creature db modifer - if (GetTypeId() == TYPEID_UNIT) - max_speed *= ToCreature()->GetCreatureTemplate()->speed_run; + // Xinef: normal movement speed - multiply by creature db modifer + if (GetTypeId() == TYPEID_UNIT) + max_speed *= ToCreature()->GetCreatureTemplate()->speed_run; if (speed > max_speed) speed = max_speed; @@ -13045,13 +13045,13 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) if (slow) AddPct(speed, slow); - if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED)) + if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED)) { float base_speed = (GetTypeId() == TYPEID_UNIT ? ToCreature()->GetCreatureTemplate()->speed_run : 1.0f); float min_speed = base_speed * (minSpeedMod / 100.0f); if (speed < min_speed) speed = min_speed; - } + } SetSpeed(mtype, speed, forced); } @@ -13123,22 +13123,22 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) // and do it only for real sent packets and use run for run/mounted as client expected ++ToPlayer()->m_forced_speed_changes[mtype]; - // Xinef: update speed of pet also - if (!IsInCombat()) - { - Unit* pet = ToPlayer()->GetPet(); - if (!pet) - pet = GetCharm(); - - // xinef: do not affect vehicles and possesed pets - if (pet && (pet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) || pet->IsVehicle())) - pet = NULL; + // Xinef: update speed of pet also + if (!IsInCombat()) + { + Unit* pet = ToPlayer()->GetPet(); + if (!pet) + pet = GetCharm(); + + // xinef: do not affect vehicles and possesed pets + if (pet && (pet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) || pet->IsVehicle())) + pet = NULL; - if (pet && pet->GetTypeId() == TYPEID_UNIT && !pet->IsInCombat() && pet->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE) - pet->UpdateSpeed(mtype, forced); - if (Unit* critter = ObjectAccessor::GetUnit(*this, GetCritterGUID())) - critter->UpdateSpeed(mtype, forced); - } + if (pet && pet->GetTypeId() == TYPEID_UNIT && !pet->IsInCombat() && pet->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE) + pet->UpdateSpeed(mtype, forced); + if (Unit* critter = ObjectAccessor::GetUnit(*this, GetCritterGUID())) + critter->UpdateSpeed(mtype, forced); + } } switch (mtype) @@ -13205,7 +13205,7 @@ void Unit::setDeathState(DeathState s, bool despawn) if (s == JUST_DIED) { - // xinef: needed for procs, this is refreshed in Unit::Update + // xinef: needed for procs, this is refreshed in Unit::Update //ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false); //ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); // remove aurastates allowing special moves @@ -13214,13 +13214,13 @@ void Unit::setDeathState(DeathState s, bool despawn) GetMotionMaster()->Clear(false); GetMotionMaster()->MoveIdle(); - // Xinef: Remove Hover so the corpse can fall to the ground - SetHover(false); + // Xinef: Remove Hover so the corpse can fall to the ground + SetHover(false); - if (despawn) - DisableSpline(); - else - StopMoving(); + if (despawn) + DisableSpline(); + else + StopMoving(); // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp // do not why since in IncreaseMaxHealth currenthealth is checked @@ -13378,13 +13378,13 @@ Unit* Creature::SelectVictim() // First checking if we have some taunt on us AuraEffectList const& tauntAuras = GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT); if (!tauntAuras.empty()) - for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr) - if (Unit* caster = (*itr)->GetCaster()) - if (_CanDetectFeignDeathOf(caster) && CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, GetGUID())) - { - target = caster; - break; - } + for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr) + if (Unit* caster = (*itr)->GetCaster()) + if (_CanDetectFeignDeathOf(caster) && CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, GetGUID())) + { + target = caster; + break; + } if (CanHaveThreatList()) { @@ -13421,25 +13421,25 @@ Unit* Creature::SelectVictim() } // pussywizard: if victim is not acceptable only due to mmaps, it may be for example a knockback, wait for a few secs before evading - if (!target && !isWorldBoss() && !GetInstanceId() && IsAlive() && (!CanHaveThreatList() || !getThreatManager().isThreatListEmpty())) - if (Unit* v = GetVictim()) - if (isTargetNotAcceptableByMMaps(v->GetGUID(), sWorld->GetGameTime(), v)) - if (_CanDetectFeignDeathOf(v) && CanCreatureAttack(v)) - { - if (m_mmapNotAcceptableStartTime) - { - if (sWorld->GetGameTime() <= m_mmapNotAcceptableStartTime+4) - return NULL; - } - else - { - m_mmapNotAcceptableStartTime = sWorld->GetGameTime(); - return NULL; - } - } + if (!target && !isWorldBoss() && !GetInstanceId() && IsAlive() && (!CanHaveThreatList() || !getThreatManager().isThreatListEmpty())) + if (Unit* v = GetVictim()) + if (isTargetNotAcceptableByMMaps(v->GetGUID(), sWorld->GetGameTime(), v)) + if (_CanDetectFeignDeathOf(v) && CanCreatureAttack(v)) + { + if (m_mmapNotAcceptableStartTime) + { + if (sWorld->GetGameTime() <= m_mmapNotAcceptableStartTime+4) + return NULL; + } + else + { + m_mmapNotAcceptableStartTime = sWorld->GetGameTime(); + return NULL; + } + } // pussywizard: not sure why it's here - // pussywizard: if some npc (not player pet) is attacking us and we can't fight back - don't evade o_O + // pussywizard: if some npc (not player pet) is attacking us and we can't fight back - don't evade o_O for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr) if ((*itr) && !CanCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER && !(*itr)->ToCreature()->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) return NULL; @@ -13450,13 +13450,13 @@ Unit* Creature::SelectVictim() // search nearby enemies before evading if (HasReactState(REACT_AGGRESSIVE)) { - target = SelectNearestTargetInAttackDistance(std::max(m_CombatDistance, ATTACK_DISTANCE)); + target = SelectNearestTargetInAttackDistance(std::max(m_CombatDistance, ATTACK_DISTANCE)); if (target && _CanDetectFeignDeathOf(target) && CanCreatureAttack(target)) return target; } - // pussywizard: not sure why it's here - // pussywizard: can't evade when having invisibility aura with duration? o_O + // pussywizard: not sure why it's here + // pussywizard: can't evade when having invisibility aura with duration? o_O Unit::AuraEffectList const& iAuras = GetAuraEffectsByType(SPELL_AURA_MOD_INVISIBILITY); if (!iAuras.empty()) { @@ -13534,7 +13534,7 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in return duration; // cut duration only of negative effects - // xinef: also calculate self casts, spell can be reflected for example + // xinef: also calculate self casts, spell can be reflected for example if (!positive) { int32 mechanic = spellProto->GetSpellMechanicMaskByEffectMask(effectMask); @@ -13548,9 +13548,9 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in if (!(mechanic & 1<GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, i); @@ -13629,16 +13629,16 @@ void Unit::ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell if (!spellProto || castTime < 0) return; // called from caster - if (Player* modOwner = GetSpellModOwner()) - modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime, spell, bool(modOwner != this && !IsPet())); + if (Player* modOwner = GetSpellModOwner()) + modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime, spell, bool(modOwner != this && !IsPet())); if (!spellProto->HasAttribute(SpellAttr0(SPELL_ATTR0_ABILITY|SPELL_ATTR0_TRADESPELL)) && (spellProto->SpellFamilyName || GetTypeId() != TYPEID_PLAYER)) - { - if (CanInstantCast()) - castTime = 0; - else - castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED)); - } + { + if (CanInstantCast()) + castTime = 0; + else + castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED)); + } else if (spellProto->HasAttribute(SPELL_ATTR0_REQ_AMMO) && !spellProto->HasAttribute(SPELL_ATTR2_AUTOREPEAT_FLAG)) castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]); else if (spellProto->SpellVisual[0] == 3881 && HasAura(67556)) // cooking with Chef Hat. @@ -13687,7 +13687,7 @@ void Unit::IncrDiminishing(DiminishingGroup group) float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration, Unit* caster, DiminishingLevels Level, int32 limitduration) { - // xinef: dont apply diminish to self casts + // xinef: dont apply diminish to self casts if (duration == -1 || group == DIMINISHING_NONE) return 1.0f; @@ -13702,7 +13702,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration, Unit const* source = casterOwner ? casterOwner : caster; if ((target->GetTypeId() == TYPEID_PLAYER - || target->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) + || target->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) && source->GetTypeId() == TYPEID_PLAYER) duration = limitduration; } @@ -13773,7 +13773,7 @@ float Unit::GetSpellMaxRangeForTarget(Unit const* target, SpellInfo const* spell return 0; if (spellInfo->RangeEntry->maxRangeFriend == spellInfo->RangeEntry->maxRangeHostile) return spellInfo->GetMaxRange(); - if (target == NULL) + if (target == NULL) return spellInfo->GetMaxRange(true); return spellInfo->GetMaxRange(!IsHostileTo(target)); } @@ -13926,9 +13926,9 @@ float Unit::GetTotalAuraModValue(UnitMods unitMod) const void Unit::ApplyStatPercentBuffMod(Stats stat, float val, bool apply) { if (val == -100.0f) // prevent set var to zero - val = -99.99f; - float var = GetStat(stat)*val/100.0f; - ApplyModSignedFloatValue((var > 0 ? UNIT_FIELD_POSSTAT0+stat : UNIT_FIELD_NEGSTAT0+stat), var, apply); + val = -99.99f; + float var = GetStat(stat)*val/100.0f; + ApplyModSignedFloatValue((var > 0 ? UNIT_FIELD_POSSTAT0+stat : UNIT_FIELD_NEGSTAT0+stat), var, apply); } SpellSchools Unit::GetSpellSchoolByAuraGroup(UnitMods unitMod) const @@ -14021,15 +14021,15 @@ void Unit::SetLevel(uint8 lvl, bool showLevelChange) { SetUInt32Value(UNIT_FIELD_LEVEL, lvl); - // Xinef: unmark field bit update - if (!showLevelChange) - _changesMask.UnsetBit(UNIT_FIELD_LEVEL); + // Xinef: unmark field bit update + if (!showLevelChange) + _changesMask.UnsetBit(UNIT_FIELD_LEVEL); // group update if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetGroup()) ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL); - // xinef: update global data + // xinef: update global data if (GetTypeId() == TYPEID_PLAYER) sWorld->UpdateGlobalPlayerData(ToPlayer()->GetGUIDLow(), PLAYER_UPDATE_DATA_LEVEL, "", lvl); } @@ -14052,9 +14052,9 @@ void Unit::SetHealth(uint32 val) // group update if (GetTypeId() == TYPEID_PLAYER) { - Player* player = ToPlayer(); - if (player->NeedSendSpectatorData()) - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CHP", val); + Player* player = ToPlayer(); + if (player->NeedSendSpectatorData()) + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CHP", val); if (player->GetGroup()) player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP); @@ -14064,14 +14064,14 @@ void Unit::SetHealth(uint32 val) if (pet->isControlled()) { if (Unit* owner = GetOwner()) - if (Player* player = owner->ToPlayer()) - { - if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family) - ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct()); + if (Player* player = owner->ToPlayer()) + { + if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family) + ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct()); - if (player->GetGroup()) - player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_HP); - } + if (player->GetGroup()) + player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_HP); + } } } } @@ -14087,9 +14087,9 @@ void Unit::SetMaxHealth(uint32 val) // group update if (GetTypeId() == TYPEID_PLAYER) { - Player* player = ToPlayer(); - if (player->NeedSendSpectatorData()) - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MHP", val); + Player* player = ToPlayer(); + if (player->NeedSendSpectatorData()) + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MHP", val); if (player->GetGroup()) player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_HP); @@ -14099,14 +14099,14 @@ void Unit::SetMaxHealth(uint32 val) if (pet->isControlled()) { if (Unit* owner = GetOwner()) - if (Player* player = owner->ToPlayer()) - { - if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family) - ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct()); + if (Player* player = owner->ToPlayer()) + { + if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family) + ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct()); - if (player->GetGroup()) - player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_HP); - } + if (player->GetGroup()) + player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_MAX_HP); + } } } @@ -14134,9 +14134,9 @@ void Unit::SetPower(Powers power, uint32 val) // group update if (GetTypeId() == TYPEID_PLAYER) { - Player* player = ToPlayer(); - if (getPowerType() == power && player->NeedSendSpectatorData()) - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val/10 : val); + Player* player = ToPlayer(); + if (getPowerType() == power && player->NeedSendSpectatorData()) + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val/10 : val); if (player->GetGroup()) player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER); @@ -14164,9 +14164,9 @@ void Unit::SetMaxPower(Powers power, uint32 val) // group update if (GetTypeId() == TYPEID_PLAYER) { - Player* player = ToPlayer(); - if (getPowerType() == power && player->NeedSendSpectatorData()) - ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val/10 : val); + Player* player = ToPlayer(); + if (getPowerType() == power && player->NeedSendSpectatorData()) + ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val/10 : val); if (player->GetGroup()) player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER); @@ -14247,8 +14247,8 @@ void Unit::RemoveFromWorld() { if (owner->m_Controlled.find(this) != owner->m_Controlled.end()) { - if (HasUnitTypeMask(UNIT_MASK_MINION|UNIT_MASK_GUARDIAN)) - owner->SetMinion((Minion*)this, false); + if (HasUnitTypeMask(UNIT_MASK_MINION|UNIT_MASK_GUARDIAN)) + owner->SetMinion((Minion*)this, false); sLog->outString("Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry()); //ASSERT(false); } @@ -14408,7 +14408,7 @@ void CharmInfo::InitPossessCreateSpells() case 24783: // Trained Rock Falcon case 27664: // Crashin' Thrashin' Racer case 40281: // Crashin' Thrashin' Racer - case 23109: // Vengeful Spirit + case 23109: // Vengeful Spirit break; default: InitEmptyActionBar(); @@ -14434,7 +14434,7 @@ void CharmInfo::InitPossessCreateSpells() void CharmInfo::InitCharmCreateSpells() { - InitPetActionBar(); + InitPetActionBar(); if (_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells { @@ -14654,7 +14654,7 @@ bool InitTriggerAuraData() isTriggerAura[SPELL_AURA_REFLECT_SPELLS_SCHOOL] = true; isTriggerAura[SPELL_AURA_MECHANIC_IMMUNITY] = true; isTriggerAura[SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN] = true; - isTriggerAura[SPELL_AURA_SPELL_MAGNET] = true; + isTriggerAura[SPELL_AURA_SPELL_MAGNET] = true; isTriggerAura[SPELL_AURA_MOD_ATTACK_POWER] = true; isTriggerAura[SPELL_AURA_ADD_CASTER_HIT_TRIGGER] = true; isTriggerAura[SPELL_AURA_OVERRIDE_CLASS_SCRIPTS] = true; @@ -14677,7 +14677,7 @@ bool InitTriggerAuraData() isAlwaysTriggeredAura[SPELL_AURA_MOD_ROOT] = true; isAlwaysTriggeredAura[SPELL_AURA_MOD_STUN] = true; isAlwaysTriggeredAura[SPELL_AURA_TRANSFORM] = true; - isAlwaysTriggeredAura[SPELL_AURA_SPELL_MAGNET] = true; + isAlwaysTriggeredAura[SPELL_AURA_SPELL_MAGNET] = true; isAlwaysTriggeredAura[SPELL_AURA_SCHOOL_ABSORB] = true; isAlwaysTriggeredAura[SPELL_AURA_MOD_STEALTH] = true; @@ -14686,73 +14686,73 @@ bool InitTriggerAuraData() void createProcFlags(const SpellInfo* spellInfo, WeaponAttackType attackType, bool positive, uint32& procAttacker, uint32& procVictim) { - if (spellInfo) - { - switch (spellInfo->DmgClass) - { - case SPELL_DAMAGE_CLASS_MAGIC: - if (positive) - { - procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; - procVictim |= PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS; - } - else - { - procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG; - procVictim |= PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG; - } - break; - case SPELL_DAMAGE_CLASS_NONE: - if (positive) - { - procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS; - procVictim |= PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS; - } - else - { - procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG; - procVictim |= PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG; - } - break; - case SPELL_DAMAGE_CLASS_MELEE: - procAttacker = PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS; - if (attackType == OFF_ATTACK) - procAttacker |= PROC_FLAG_DONE_OFFHAND_ATTACK; - else - procAttacker |= PROC_FLAG_DONE_MAINHAND_ATTACK; - procVictim = PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS; - break; - case SPELL_DAMAGE_CLASS_RANGED: - // Auto attack - if (spellInfo->HasAttribute(SPELL_ATTR2_AUTOREPEAT_FLAG)) - { - procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK; - procVictim = PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK; - } - else // Ranged spell attack - { - procAttacker = PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS; - procVictim = PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS; - } - break; - default: - if (spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && - spellInfo->EquippedItemSubClassMask & (1<HasAttribute(SPELL_ATTR2_AUTOREPEAT_FLAG)) // Wands auto attack - { - procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK; - procVictim = PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK; - } - break; - } + if (spellInfo) + { + switch (spellInfo->DmgClass) + { + case SPELL_DAMAGE_CLASS_MAGIC: + if (positive) + { + procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; + procVictim |= PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS; + } + else + { + procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG; + procVictim |= PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG; + } + break; + case SPELL_DAMAGE_CLASS_NONE: + if (positive) + { + procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS; + procVictim |= PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS; + } + else + { + procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG; + procVictim |= PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG; + } + break; + case SPELL_DAMAGE_CLASS_MELEE: + procAttacker = PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS; + if (attackType == OFF_ATTACK) + procAttacker |= PROC_FLAG_DONE_OFFHAND_ATTACK; + else + procAttacker |= PROC_FLAG_DONE_MAINHAND_ATTACK; + procVictim = PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS; + break; + case SPELL_DAMAGE_CLASS_RANGED: + // Auto attack + if (spellInfo->HasAttribute(SPELL_ATTR2_AUTOREPEAT_FLAG)) + { + procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK; + procVictim = PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK; + } + else // Ranged spell attack + { + procAttacker = PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS; + procVictim = PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS; + } + break; + default: + if (spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && + spellInfo->EquippedItemSubClassMask & (1<HasAttribute(SPELL_ATTR2_AUTOREPEAT_FLAG)) // Wands auto attack + { + procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK; + procVictim = PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK; + } + break; + } } - else if (attackType == BASE_ATTACK) - { + else if (attackType == BASE_ATTACK) + { procAttacker = PROC_FLAG_DONE_MELEE_AUTO_ATTACK | PROC_FLAG_DONE_MAINHAND_ATTACK; procVictim = PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK; - } - else if (attackType == OFF_ATTACK) - { + } + else if (attackType == OFF_ATTACK) + { procAttacker = PROC_FLAG_DONE_MELEE_AUTO_ATTACK | PROC_FLAG_DONE_OFFHAND_ATTACK; procVictim = PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK; } @@ -14804,9 +14804,9 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u // For melee/ranged based attack need update skills and set some Aura states if victim present if (procFlag & MELEE_BASED_TRIGGER_MASK && target) { - // Xinef: Shaman in ghost wolf form cant proc anything melee based - if (!isVictim && GetShapeshiftForm() == FORM_GHOSTWOLF) - return; + // Xinef: Shaman in ghost wolf form cant proc anything melee based + if (!isVictim && GetShapeshiftForm() == FORM_GHOSTWOLF) + return; // Update skills here for players if (GetTypeId() == TYPEID_PLAYER) @@ -14870,15 +14870,15 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u StartReactiveTimer(REACTIVE_OVERPOWER); } } - // Wolverine Bite - if (procExtra & PROC_EX_CRITICAL_HIT) - { + // Wolverine Bite + if (procExtra & PROC_EX_CRITICAL_HIT) + { if (GetTypeId() == TYPEID_UNIT && IsPet()) { ModifyAuraState(AURA_STATE_DEFENSE, true); StartReactiveTimer( REACTIVE_DEFENSE ); } - } + } } } } @@ -14898,9 +14898,9 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u if (procAura && procAura->Id == itr->first) continue; - // Xinef: Generic Item Equipment cooldown, -1 is a special marker - if (itr->second->GetBase()->GetCastItemGUID() && HasSpellItemCooldown(itr->first, uint32(-1))) - continue; + // Xinef: Generic Item Equipment cooldown, -1 is a special marker + if (itr->second->GetBase()->GetCastItemGUID() && HasSpellItemCooldown(itr->first, uint32(-1))) + continue; ProcTriggeredData triggerData(itr->second->GetBase()); // Defensive procs are active on absorbs (so absorption effects are not a hindrance) @@ -14915,12 +14915,12 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u if (damage || spellProto->Effects[EFFECT_0].TriggerSpell || spellProto->Effects[EFFECT_1].TriggerSpell || spellProto->Effects[EFFECT_2].TriggerSpell) active = true; - // xinef: fix spell procing from damaging / healing casts if spell has DoT / HoT effect only - // only player spells are taken into account - if (!active && !isVictim && !(procFlag & PROC_FLAG_DONE_PERIODIC) && procSpell && procSpell->SpellFamilyName && (procSpell->HasAura(SPELL_AURA_PERIODIC_DAMAGE) || procSpell->HasAura(SPELL_AURA_PERIODIC_HEAL))) - active = true; + // xinef: fix spell procing from damaging / healing casts if spell has DoT / HoT effect only + // only player spells are taken into account + if (!active && !isVictim && !(procFlag & PROC_FLAG_DONE_PERIODIC) && procSpell && procSpell->SpellFamilyName && (procSpell->HasAura(SPELL_AURA_PERIODIC_DAMAGE) || procSpell->HasAura(SPELL_AURA_PERIODIC_HEAL))) + active = true; - if (!IsTriggeredAtSpellProcEvent(target, triggerData.aura, procSpell, procFlag, procExtra, attType, isVictim, active, triggerData.spellProcEvent, eventInfo)) + if (!IsTriggeredAtSpellProcEvent(target, triggerData.aura, procSpell, procFlag, procExtra, attType, isVictim, active, triggerData.spellProcEvent, eventInfo)) continue; // do checks using conditions table @@ -14989,9 +14989,9 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u uint32 cooldown = 0; if (prepare && i->spellProcEvent && i->spellProcEvent->cooldown) cooldown = i->spellProcEvent->cooldown; - - // Xinef: set cooldown for actual proc - eventInfo.SetProcCooldown(cooldown); + + // Xinef: set cooldown for actual proc + eventInfo.SetProcCooldown(cooldown); // Note: must SetCantProc(false) before return if (spellInfo->HasAttribute(SPELL_ATTR3_DISABLE_PROC)) @@ -15095,10 +15095,10 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u } case SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK: // Skip melee hits or instant cast spells - // xinef: check channeled spells which are affected by haste also - if (procSpell && (procSpell->SpellFamilyName || GetTypeId() != TYPEID_PLAYER) && - (procSpell->CalcCastTime() > 0 /*|| - (procSpell->IsChanneled() && procSpell->GetDuration() > 0 && (HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, procSpell) || procSpell->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)))*/)) + // xinef: check channeled spells which are affected by haste also + if (procSpell && (procSpell->SpellFamilyName || GetTypeId() != TYPEID_PLAYER) && + (procSpell->CalcCastTime() > 0 /*|| + (procSpell->IsChanneled() && procSpell->GetDuration() > 0 && (HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, procSpell) || procSpell->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)))*/)) takeCharges = true; break; case SPELL_AURA_REFLECT_SPELLS_SCHOOL: @@ -15106,7 +15106,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u if (procSpell && (triggeredByAura->GetMiscValue() & procSpell->SchoolMask)) // School check takeCharges = true; break; - case SPELL_AURA_SPELL_MAGNET: + case SPELL_AURA_SPELL_MAGNET: // Skip Melee hits and targets with magnet aura if (procSpell && (triggeredByAura->GetBase()->GetUnitOwner()->ToUnit() == ToUnit())) // Magnet takeCharges = true; @@ -15115,7 +15115,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u case SPELL_AURA_MOD_POWER_COST_SCHOOL: // Skip melee hits and spells ws wrong school or zero cost if (procSpell && - (procSpell->ManaCost != 0 || procSpell->ManaCostPercentage != 0 || (procSpell->SpellFamilyFlags[1] & 0x2)) && // Cost check, mutilate include + (procSpell->ManaCost != 0 || procSpell->ManaCostPercentage != 0 || (procSpell->SpellFamilyFlags[1] & 0x2)) && // Cost check, mutilate include (triggeredByAura->GetMiscValue() & procSpell->SchoolMask)) // School check takeCharges = true; break; @@ -15142,8 +15142,8 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u case SPELL_AURA_MOD_ROOT: case SPELL_AURA_TRANSFORM: { - // Spell own direct damage at apply wont break the CC - // Xinef: Or when the aura is at full duration (assume that such auras should be added at the end, skipping all damage procs etc.) + // Spell own direct damage at apply wont break the CC + // Xinef: Or when the aura is at full duration (assume that such auras should be added at the end, skipping all damage procs etc.) if (procSpell) if ((!i->aura->IsPermanent() && i->aura->GetDuration() == i->aura->GetMaxDuration()) || procSpell->Id == triggeredByAura->GetId() || procSpell->HasAttribute(SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS)) break; @@ -15163,22 +15163,22 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u } break; } - case SPELL_AURA_ABILITY_IGNORE_AURASTATE: - if (procSpell && procSpell->Id == 20647) // hack for warriors execute, both dummy and damage spell are affected by ignore aurastate aura - break; - takeCharges = true; + case SPELL_AURA_ABILITY_IGNORE_AURASTATE: + if (procSpell && procSpell->Id == 20647) // hack for warriors execute, both dummy and damage spell are affected by ignore aurastate aura + break; + takeCharges = true; break; default: takeCharges = true; break; } - i->aura->CallScriptAfterEffectProcHandlers(triggeredByAura, aurApp, eventInfo); + i->aura->CallScriptAfterEffectProcHandlers(triggeredByAura, aurApp, eventInfo); } // Remove charge (aura can be removed by triggers) - // xinef: take into account attribute6 of proc spell + // xinef: take into account attribute6 of proc spell if (prepare && useCharges && takeCharges) - if (!procSpell || isVictim || !procSpell->HasAttribute(SPELL_ATTR6_DONT_CONSUME_CHARGES)) - i->aura->DropCharge(); + if (!procSpell || isVictim || !procSpell->HasAttribute(SPELL_ATTR6_DONT_CONSUME_CHARGES)) + i->aura->DropCharge(); i->aura->CallScriptAfterProcHandlers(aurApp, eventInfo); @@ -15316,9 +15316,9 @@ void Unit::StopMoving() // not need send any packets if not in world or not moving if (!IsInWorld()) - return; - - if (movespline->Finalized()) + return; + + if (movespline->Finalized()) return; Movement::MoveSplineInit init(this); @@ -15398,7 +15398,7 @@ void Unit::SetDisplayId(uint32 modelId) void Unit::RestoreDisplayId() { AuraEffect* handledAura = NULL; - AuraEffect* handledAuraForced = NULL; + AuraEffect* handledAuraForced = NULL; // try to receive model from transform auras Unit::AuraEffectList const& transforms = GetAuraEffectsByType(SPELL_AURA_TRANSFORM); if (!transforms.empty()) @@ -15411,7 +15411,7 @@ void Unit::RestoreDisplayId() if (!handledAura) handledAura = (*i); // xinef: prefer negative/forced auras - if ((*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) || !aurApp->IsPositive()) + if ((*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) || !aurApp->IsPositive()) { handledAuraForced = (*i); break; @@ -15420,25 +15420,25 @@ void Unit::RestoreDisplayId() } } - // Xinef: include clone auras (eg mirror images) - if (!handledAuraForced && !handledAura) - { - Unit::AuraEffectList const& cloneAuras = GetAuraEffectsByType(SPELL_AURA_CLONE_CASTER); - if (!cloneAuras.empty()) - for (Unit::AuraEffectList::const_iterator i = cloneAuras.begin(); i != cloneAuras.end(); ++i) - handledAura = *i; - } + // Xinef: include clone auras (eg mirror images) + if (!handledAuraForced && !handledAura) + { + Unit::AuraEffectList const& cloneAuras = GetAuraEffectsByType(SPELL_AURA_CLONE_CASTER); + if (!cloneAuras.empty()) + for (Unit::AuraEffectList::const_iterator i = cloneAuras.begin(); i != cloneAuras.end(); ++i) + handledAura = *i; + } - // xinef: order of execution is important! - // first forced transform auras, then shapeshifts, then normal transform + // xinef: order of execution is important! + // first forced transform auras, then shapeshifts, then normal transform // transform aura was found if (handledAuraForced) handledAuraForced->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); // we've found shapeshift else if (uint32 modelId = GetModelForForm(GetShapeshiftForm())) SetDisplayId(modelId); - else if (handledAura) - handledAura->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); + else if (handledAura) + handledAura->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); // no auras found - set modelid to default else SetDisplayId(GetNativeDisplayId()); @@ -15526,7 +15526,7 @@ Unit* Unit::SelectNearbyTarget(Unit* exclude, float dist) const // remove not LoS targets for (std::list::iterator tIter = targets.begin(); tIter != targets.end();) { - if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter)) + if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter)) { std::list::iterator tIter2 = tIter; ++tIter; @@ -15561,7 +15561,7 @@ Unit* Unit::SelectNearbyNoTotemTarget(Unit* exclude, float dist) const // remove not LoS targets for (std::list::iterator tIter = targets.begin(); tIter != targets.end();) { - if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter)) + if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter)) { std::list::iterator tIter2 = tIter; ++tIter; @@ -15581,7 +15581,7 @@ Unit* Unit::SelectNearbyNoTotemTarget(Unit* exclude, float dist) const void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply) { - float remainingTimePct = std::max((float)m_attackTimer[att], 0.0f) / (GetAttackTime(att) * m_modAttackSpeedPct[att]); + float remainingTimePct = std::max((float)m_attackTimer[att], 0.0f) / (GetAttackTime(att) * m_modAttackSpeedPct[att]); if (val > 0) { ApplyPercentModFloatVar(m_modAttackSpeedPct[att], val, !apply); @@ -15942,11 +15942,11 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellInfo const // return false; //} - // Xinef: additional check for player auras - only player spells can trigger player proc auras - // Xinef: skip victim auras - if (!isVictim && GetTypeId() == TYPEID_PLAYER) //spellProto->SpellFamilyName != SPELLFAMILY_GENERIC) - if (!(EventProcFlag & (PROC_FLAG_KILL|PROC_FLAG_DEATH)) && procSpell && procSpell->SpellFamilyName == SPELLFAMILY_GENERIC && (!eventInfo.GetTriggerAuraSpell() || eventInfo.GetTriggerAuraSpell()->SpellFamilyName == SPELLFAMILY_GENERIC)) - return false; + // Xinef: additional check for player auras - only player spells can trigger player proc auras + // Xinef: skip victim auras + if (!isVictim && GetTypeId() == TYPEID_PLAYER) //spellProto->SpellFamilyName != SPELLFAMILY_GENERIC) + if (!(EventProcFlag & (PROC_FLAG_KILL|PROC_FLAG_DEATH)) && procSpell && procSpell->SpellFamilyName == SPELLFAMILY_GENERIC && (!eventInfo.GetTriggerAuraSpell() || eventInfo.GetTriggerAuraSpell()->SpellFamilyName == SPELLFAMILY_GENERIC)) + return false; // Check spellProcEvent data requirements if (!sSpellMgr->IsSpellProcEventCanTriggeredBy(spellProto, spellProcEvent, EventProcFlag, procSpell, procFlag, procExtra, active)) @@ -16032,12 +16032,12 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellInfo const } break; } - case SPELLFAMILY_WARRIOR: - { - // Recklessness, allow to proc only once for whirlwind - if (spellProto->Id == 1719 && procSpell && procSpell->Id == 44949) - return false; - } + case SPELLFAMILY_WARRIOR: + { + // Recklessness, allow to proc only once for whirlwind + if (spellProto->Id == 1719 && procSpell && procSpell->Id == 44949) + return false; + } } // Apply chance modifer aura @@ -16073,63 +16073,63 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura) { if (Unit* caster = triggeredByAura->GetCaster()) { - // smart healing + // smart healing float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster); - std::list nearMembers; + std::list nearMembers; - Player* player = NULL; - if (GetTypeId() == TYPEID_PLAYER) - player = ToPlayer(); - else if (GetOwner()) - player = GetOwner()->ToPlayer(); + Player* player = NULL; + if (GetTypeId() == TYPEID_PLAYER) + player = ToPlayer(); + else if (GetOwner()) + player = GetOwner()->ToPlayer(); - if (player) - { - Group* group = player->GetGroup(); - if (!group) - { - if (player != this) - { - if (IsWithinDistInMap(player, radius)) - nearMembers.push_back(player); - } - else if (Unit* pet = GetGuardianPet()) - { - if (IsWithinDistInMap(pet, radius)) - nearMembers.push_back(pet); - } - } - else - { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - if (Player* Target = itr->GetSource()) - { - if (Target != this && !IsWithinDistInMap(Target, radius)) - continue; + if (player) + { + Group* group = player->GetGroup(); + if (!group) + { + if (player != this) + { + if (IsWithinDistInMap(player, radius)) + nearMembers.push_back(player); + } + else if (Unit* pet = GetGuardianPet()) + { + if (IsWithinDistInMap(pet, radius)) + nearMembers.push_back(pet); + } + } + else + { + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Player* Target = itr->GetSource()) + { + if (Target != this && !IsWithinDistInMap(Target, radius)) + continue; - // IsHostileTo check duel and controlled by enemy - if (Target != this && Target->IsAlive() && !IsHostileTo(Target)) - nearMembers.push_back(Target); + // IsHostileTo check duel and controlled by enemy + if (Target != this && Target->IsAlive() && !IsHostileTo(Target)) + nearMembers.push_back(Target); - // Push player's pet to vector - if (Unit* pet = Target->GetGuardianPet()) - if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet)) - nearMembers.push_back(pet); - } - } + // Push player's pet to vector + if (Unit* pet = Target->GetGuardianPet()) + if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet)) + nearMembers.push_back(pet); + } + } - if (!nearMembers.empty()) - { - nearMembers.sort(Trinity::HealthPctOrderPred()); - if (Unit* target = nearMembers.front()) - { - CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true); - CastCustomSpell(target, spellProto->Id, &heal, NULL, NULL, true, NULL, triggeredByAura, caster_guid); - if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID())) - aura->SetCharges(jumps); - } - } - } + if (!nearMembers.empty()) + { + nearMembers.sort(Trinity::HealthPctOrderPred()); + if (Unit* target = nearMembers.front()) + { + CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true); + CastCustomSpell(target, spellProto->Id, &heal, NULL, NULL, true, NULL, triggeredByAura, caster_guid); + if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID())) + aura->SetCharges(jumps); + } + } + } } } @@ -16195,11 +16195,11 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp if (!victim->GetHealth()) return; - if (killer && !killer->IsInMap(victim)) - killer = NULL; + if (killer && !killer->IsInMap(victim)) + killer = NULL; // find player: owner of controlled `this` or `this` itself maybe - Player* player = killer ? killer->GetCharmerOrOwnerPlayerOrPlayerItself() : NULL; + Player* player = killer ? killer->GetCharmerOrOwnerPlayerOrPlayerItself() : NULL; Creature* creature = victim->ToCreature(); bool isRewardAllowed = true; @@ -16210,25 +16210,25 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp creature->SetLootRecipient(NULL); } - // pussywizard: remade this if section (player is on the same map + // pussywizard: remade this if section (player is on the same map if (isRewardAllowed && creature) - { - Player* lr = creature->GetLootRecipient(); - if (lr && lr->IsInMap(creature)) - player = creature->GetLootRecipient(); - else if (Group* lrg = creature->GetLootRecipientGroup()) - for (GroupReference* itr = lrg->GetFirstMember(); itr != NULL; itr = itr->next()) - if (Player* member = itr->GetSource()) - if (member->IsAtGroupRewardDistance(creature)) - { - player = member; - break; - } - } + { + Player* lr = creature->GetLootRecipient(); + if (lr && lr->IsInMap(creature)) + player = creature->GetLootRecipient(); + else if (Group* lrg = creature->GetLootRecipientGroup()) + for (GroupReference* itr = lrg->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Player* member = itr->GetSource()) + if (member->IsAtGroupRewardDistance(creature)) + { + player = member; + break; + } + } - // Exploit fix - if (creature && creature->IsPet() && IS_PLAYER_GUID(creature->GetOwnerGUID())) - isRewardAllowed = false; + // Exploit fix + if (creature && creature->IsPet() && IS_PLAYER_GUID(creature->GetOwnerGUID())) + isRewardAllowed = false; // Reward player, his pets, and group/raid members // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop) @@ -16283,8 +16283,8 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp if (uint32 lootid = creature->GetCreatureTemplate()->lootid) loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode()); - if (creature->GetLootMode()) - loot->generateMoneyLoot(creature->GetCreatureTemplate()->mingold, creature->GetCreatureTemplate()->maxgold); + if (creature->GetLootMode()) + loot->generateMoneyLoot(creature->GetCreatureTemplate()->mingold, creature->GetCreatureTemplate()->maxgold); if (group) { @@ -16308,57 +16308,57 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp owner->ProcDamageAndSpell(victim, PROC_FLAG_KILL, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto); if (killer != victim && !victim->IsCritter()) - killer->ProcDamageAndSpell(victim, killer ? PROC_FLAG_KILL : 0, PROC_FLAG_KILLED, PROC_EX_NONE, 0, attackType, spellProto); + killer->ProcDamageAndSpell(victim, killer ? PROC_FLAG_KILL : 0, PROC_FLAG_KILLED, PROC_EX_NONE, 0, attackType, spellProto); // Proc auras on death - must be before aura/combat remove victim->ProcDamageAndSpell(NULL, PROC_FLAG_DEATH, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto); // update get killing blow achievements, must be done before setDeathState to be able to require auras on target // and before Spirit of Redemption as it also removes auras - if (killer) - if (Player* killerPlayer = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim); + if (killer) + if (Player* killerPlayer = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) + killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim); - // Spirit of Redemption + // Spirit of Redemption // if talent known but not triggered (check priest class for speedup check) bool spiritOfRedemption = false; if (victim->GetTypeId() == TYPEID_PLAYER && victim->getClass() == CLASS_PRIEST) { if (AuraEffect *aurEff = victim->GetAuraEffectDummy(20711)) { - // Xinef: aura_spirit_of_redemption is triggered by 27827 shapeshift - if (victim->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) || victim->HasAura(27827)) - { - /*sLog->outMisc("Player (%u) died with spirit of redemption. Killer (Entry: %u, Name: %s), Map: %u, x: %f, y: %f, z: %f", - victim->GetGUIDLow(), killer ? killer->GetEntry() : 1, killer ? killer->GetName().c_str() : "", victim->GetMapId(), victim->GetPositionX(), - victim->GetPositionY(), victim->GetPositionZ()); + // Xinef: aura_spirit_of_redemption is triggered by 27827 shapeshift + if (victim->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) || victim->HasAura(27827)) + { + /*sLog->outMisc("Player (%u) died with spirit of redemption. Killer (Entry: %u, Name: %s), Map: %u, x: %f, y: %f, z: %f", + victim->GetGUIDLow(), killer ? killer->GetEntry() : 1, killer ? killer->GetName().c_str() : "", victim->GetMapId(), victim->GetPositionX(), + victim->GetPositionY(), victim->GetPositionZ()); - ACE_Stack_Trace trace(0, 50); - sLog->outMisc("TRACE: %s\n\n", trace.c_str());*/ - } - else - { - // save value before aura remove - uint32 ressSpellId = victim->GetUInt32Value(PLAYER_SELF_RES_SPELL); - if (!ressSpellId) - ressSpellId = victim->ToPlayer()->GetResurrectionSpellId(); + ACE_Stack_Trace trace(0, 50); + sLog->outMisc("TRACE: %s\n\n", trace.c_str());*/ + } + else + { + // save value before aura remove + uint32 ressSpellId = victim->GetUInt32Value(PLAYER_SELF_RES_SPELL); + if (!ressSpellId) + ressSpellId = victim->ToPlayer()->GetResurrectionSpellId(); - //Remove all expected to remove at death auras (most important negative case like DoT or periodic triggers) - victim->RemoveAllAurasOnDeath(); + //Remove all expected to remove at death auras (most important negative case like DoT or periodic triggers) + victim->RemoveAllAurasOnDeath(); // Stop attacks victim->CombatStop(); victim->getHostileRefManager().deleteReferences(); - // restore for use at real death - victim->SetUInt32Value(PLAYER_SELF_RES_SPELL,ressSpellId); + // restore for use at real death + victim->SetUInt32Value(PLAYER_SELF_RES_SPELL,ressSpellId); - // FORM_SPIRITOFREDEMPTION and related auras + // FORM_SPIRITOFREDEMPTION and related auras victim->CastSpell(victim, 27827, true, NULL, aurEff); spiritOfRedemption = true; - } - } - } + } + } + } if (!spiritOfRedemption) { @@ -16423,7 +16423,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp // Call creature just died function if (creature->IsAIEnabled) - creature->AI()->JustDied(killer ? killer : victim); + creature->AI()->JustDied(killer ? killer : victim); if (TempSummon* summon = creature->ToTempSummon()) if (Unit* summoner = summon->GetSummoner()) @@ -16440,7 +16440,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp if (instanceMap->IsDungeon() && player) if (instanceMap->IsRaidOrHeroicDungeon()) if (creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) - instanceMap->ToInstanceMap()->PermBindAllPlayers(); + instanceMap->ToInstanceMap()->PermBindAllPlayers(); } } @@ -16479,21 +16479,21 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp } // Hook for OnPVPKill Event - if (killer) - { - if (Player* killerPlr = killer->ToPlayer()) - { - if (Player* killedPlr = victim->ToPlayer()) - sScriptMgr->OnPVPKill(killerPlr, killedPlr); - else if (Creature* killedCre = victim->ToCreature()) - sScriptMgr->OnCreatureKill(killerPlr, killedCre); - } - else if (Creature* killerCre = killer->ToCreature()) - { - if (Player* killed = victim->ToPlayer()) - sScriptMgr->OnPlayerKilledByCreature(killerCre, killed); - } - } + if (killer) + { + if (Player* killerPlr = killer->ToPlayer()) + { + if (Player* killedPlr = victim->ToPlayer()) + sScriptMgr->OnPVPKill(killerPlr, killedPlr); + else if (Creature* killedCre = victim->ToCreature()) + sScriptMgr->OnCreatureKill(killerPlr, killedCre); + } + else if (Creature* killerCre = killer->ToCreature()) + { + if (Player* killed = victim->ToPlayer()) + sScriptMgr->OnPlayerKilledByCreature(killerCre, killed); + } + } } void Unit::SetControlled(bool apply, UnitState state) @@ -16539,8 +16539,8 @@ void Unit::SetControlled(bool apply, UnitState state) } else { - // xinef: moved from below, checked all SetX functions, no calls to currently modified state - // xinef: added to each case because of return + // xinef: moved from below, checked all SetX functions, no calls to currently modified state + // xinef: added to each case because of return //ClearUnitState(state); switch (state) @@ -16548,32 +16548,32 @@ void Unit::SetControlled(bool apply, UnitState state) case UNIT_STATE_STUNNED: if (HasAuraType(SPELL_AURA_MOD_STUN)) return; - ClearUnitState(state); + ClearUnitState(state); SetStunned(false); break; case UNIT_STATE_ROOT: if (HasAuraType(SPELL_AURA_MOD_ROOT) || GetVehicle()) return; - ClearUnitState(state); + ClearUnitState(state); SetRooted(false); break; case UNIT_STATE_CONFUSED: if (HasAuraType(SPELL_AURA_MOD_CONFUSE)) return; - ClearUnitState(state); + ClearUnitState(state); SetConfused(false); break; case UNIT_STATE_FLEEING: if (HasAuraType(SPELL_AURA_MOD_FEAR)) return; - ClearUnitState(state); + ClearUnitState(state); SetFeared(false); break; default: return; } - //ClearUnitState(state); + //ClearUnitState(state); if (HasUnitState(UNIT_STATE_STUNNED) || HasAuraType(SPELL_AURA_MOD_STUN)) SetStunned(true); @@ -16608,10 +16608,10 @@ void Unit::SetStunned(bool apply) data << uint32(0); SendMessageToSet(&data, true); - // xinef: inform client about our current orientation - SendMovementFlagUpdate(); + // xinef: inform client about our current orientation + SendMovementFlagUpdate(); - // Creature specific + // Creature specific if (GetTypeId() != TYPEID_PLAYER) StopMoving(); else @@ -16624,20 +16624,20 @@ void Unit::SetStunned(bool apply) if (IsAlive() && GetVictim()) SetTarget(GetVictim()->GetGUID()); - if (GetTypeId() == TYPEID_UNIT) - { - // don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface) - Unit* owner = GetOwner(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !owner->ToPlayer()->IsMounted()) - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + if (GetTypeId() == TYPEID_UNIT) + { + // don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface) + Unit* owner = GetOwner(); + if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !owner->ToPlayer()->IsMounted()) + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - // Xinef: same for charmed npcs - owner = GetCharmer(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !owner->ToPlayer()->IsMounted()) - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - } - else - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + // Xinef: same for charmed npcs + owner = GetCharmer(); + if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !owner->ToPlayer()->IsMounted()) + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + } + else + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); if (!HasUnitState(UNIT_STATE_ROOT)) // prevent moving if it also has root effect { @@ -16704,13 +16704,13 @@ void Unit::SetRooted(bool apply) void Unit::DisableRotate(bool apply) { - if (GetTypeId() != TYPEID_UNIT) - return; + if (GetTypeId() != TYPEID_UNIT) + return; - if (apply) - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); - else if (!HasUnitState(UNIT_STATE_POSSESSED)) - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + if (apply) + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + else if (!HasUnitState(UNIT_STATE_POSSESSED)) + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); } void Unit::SetFeared(bool apply) @@ -16731,25 +16731,25 @@ void Unit::SetFeared(bool apply) { if (IsAlive()) { - if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == FLEEING_MOTION_TYPE) - { - GetMotionMaster()->MovementExpired(); - StopMoving(); - } + if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == FLEEING_MOTION_TYPE) + { + GetMotionMaster()->MovementExpired(); + StopMoving(); + } if (GetVictim()) SetTarget(GetVictim()->GetGUID()); } } - // xinef: block / allow control to real mover (eg. charmer) - if (GetTypeId() == TYPEID_PLAYER) - { - if (m_movedByPlayer) - m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified - //else - // ToPlayer()->SetClientControl(this, !apply); - } + // xinef: block / allow control to real mover (eg. charmer) + if (GetTypeId() == TYPEID_PLAYER) + { + if (m_movedByPlayer) + m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified + //else + // ToPlayer()->SetClientControl(this, !apply); + } } void Unit::SetConfused(bool apply) @@ -16764,24 +16764,24 @@ void Unit::SetConfused(bool apply) if (IsAlive()) { if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == CONFUSED_MOTION_TYPE) - { - GetMotionMaster()->MovementExpired(); - StopMoving(); - } + { + GetMotionMaster()->MovementExpired(); + StopMoving(); + } if (GetVictim()) SetTarget(GetVictim()->GetGUID()); } } - // xinef: block / allow control to real mover (eg. charmer) - if (GetTypeId() == TYPEID_PLAYER) - { - if (m_movedByPlayer) - m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified - //else - // ToPlayer()->SetClientControl(this, !apply); - } + // xinef: block / allow control to real mover (eg. charmer) + if (GetTypeId() == TYPEID_PLAYER) + { + if (m_movedByPlayer) + m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified + //else + // ToPlayer()->SetClientControl(this, !apply); + } } bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* aurApp) @@ -16789,12 +16789,12 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au if (!charmer) return false; - if (!charmer->IsInWorld() || charmer->IsDuringRemoveFromWorld()) - { - ACE_Stack_Trace trace(0, 50); - sLog->outMisc("Unit::SetCharmedBy CALL STACK (1):\n%s\n", trace.c_str()); + if (!charmer->IsInWorld() || charmer->IsDuringRemoveFromWorld()) + { + ACE_Stack_Trace trace(0, 50); + sLog->outMisc("Unit::SetCharmedBy CALL STACK (1):\n%s\n", trace.c_str()); return false; - } + } // dismount players when charmed if (GetTypeId() == TYPEID_PLAYER) @@ -16804,8 +16804,8 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au charmer->RemoveAurasByType(SPELL_AURA_MOUNTED); ASSERT(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER); - if (type == CHARM_TYPE_VEHICLE && !IsVehicle()) // pussywizard - throw 1; + if (type == CHARM_TYPE_VEHICLE && !IsVehicle()) // pussywizard + throw 1; ASSERT((type == CHARM_TYPE_VEHICLE) == IsVehicle()); ;//sLog->outDebug(LOG_FILTER_UNITS, "SetCharmedBy: charmer %u (GUID %u), charmed %u (GUID %u), type %u.", charmer->GetEntry(), charmer->GetGUIDLow(), GetEntry(), GetGUIDLow(), uint32(type)); @@ -16833,11 +16833,11 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au } CastStop(); - AttackStop(); + AttackStop(); - // Xinef: dont reset threat and combat, put them on offline list, moved down after faction changes - // CombatStop(); // TODO: CombatStop(true) may cause crash (interrupt spells) - // DeleteThreatList(); + // Xinef: dont reset threat and combat, put them on offline list, moved down after faction changes + // CombatStop(); // TODO: CombatStop(true) may cause crash (interrupt spells) + // DeleteThreatList(); Player* playerCharmer = charmer->ToPlayer(); @@ -16878,9 +16878,9 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au ToCreature()->AI()->OnCharmed(true); GetMotionMaster()->MoveIdle(); - // Xinef: If creature can fly, add normal player flying flag (fixes speed) - if (charmer->GetTypeId() == TYPEID_PLAYER && ToCreature()->CanFly()) - AddUnitMovementFlag(MOVEMENTFLAG_FLYING); + // Xinef: If creature can fly, add normal player flying flag (fixes speed) + if (charmer->GetTypeId() == TYPEID_PLAYER && ToCreature()->CanFly()) + AddUnitMovementFlag(MOVEMENTFLAG_FLYING); } else { @@ -16897,20 +16897,20 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au return false; // Pets already have a properly initialized CharmInfo, don't overwrite it. - // Xinef: I need charmInfo for vehicle so bullshit + // Xinef: I need charmInfo for vehicle so bullshit if (/*type != CHARM_TYPE_VEHICLE &&*/ !GetCharmInfo()) { InitCharmInfo(); if (type == CHARM_TYPE_POSSESS) GetCharmInfo()->InitPossessCreateSpells(); else if (type != CHARM_TYPE_VEHICLE) - { + { GetCharmInfo()->InitCharmCreateSpells(); - // Xinef: convert charm npcs dont have pet bar so initialize them as defensive helpers - if (type == CHARM_TYPE_CONVERT && GetTypeId() == TYPEID_UNIT) - ToCreature()->SetReactState(REACT_DEFENSIVE); - } + // Xinef: convert charm npcs dont have pet bar so initialize them as defensive helpers + if (type == CHARM_TYPE_CONVERT && GetTypeId() == TYPEID_UNIT) + ToCreature()->SetReactState(REACT_DEFENSIVE); + } } if (playerCharmer) @@ -16919,13 +16919,13 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au { case CHARM_TYPE_VEHICLE: SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); - AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); playerCharmer->SetClientControl(this, true); // verified playerCharmer->VehicleSpellInitialize(); break; case CHARM_TYPE_POSSESS: AddUnitState(UNIT_STATE_POSSESSED); - AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); charmer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); playerCharmer->SetClientControl(this, true); // verified @@ -16948,26 +16948,26 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped } } - GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, GetFollowAngle()); + GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, GetFollowAngle()); playerCharmer->CharmSpellInitialize(); break; default: - break; + break; } } - else if (GetTypeId() == TYPEID_PLAYER) - RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); + else if (GetTypeId() == TYPEID_PLAYER) + RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); - _charmThreatInfo.clear(); + _charmThreatInfo.clear(); - // Xinef: move invalid threat / hostile references to offline lists - ThreatContainer::StorageType threatList = getThreatManager().getThreatList(); + // Xinef: move invalid threat / hostile references to offline lists + ThreatContainer::StorageType threatList = getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) if (Unit* target = (*itr)->getTarget()) - _charmThreatInfo[target->GetGUID()] = (*itr)->getThreat() - (*itr)->getTempThreatModifier(); + _charmThreatInfo[target->GetGUID()] = (*itr)->getThreat() - (*itr)->getTempThreatModifier(); - CombatStop(); - DeleteThreatList(); + CombatStop(); + DeleteThreatList(); return true; } @@ -17003,29 +17003,29 @@ void Unit::RemoveCharmedBy(Unit* charmer) else RestoreFaction(); - CastStop(); + CastStop(); - CombatStop(); - getHostileRefManager().deleteReferences(); - DeleteThreatList(); + CombatStop(); + getHostileRefManager().deleteReferences(); + DeleteThreatList(); - // xinef: update speed after charming - UpdateSpeed(MOVE_RUN, false); + // xinef: update speed after charming + UpdateSpeed(MOVE_RUN, false); - // xinef: do not break any controlled motion slot - if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE) - { - StopMoving(); - GetMotionMaster()->MovementExpired(); - } - // xinef: if we have any controlled movement, clear active and idle only - else - GetMotionMaster()->MovementExpiredOnSlot(MOTION_SLOT_ACTIVE, false); + // xinef: do not break any controlled motion slot + if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE) + { + StopMoving(); + GetMotionMaster()->MovementExpired(); + } + // xinef: if we have any controlled movement, clear active and idle only + else + GetMotionMaster()->MovementExpiredOnSlot(MOTION_SLOT_ACTIVE, false); GetMotionMaster()->InitDefault(); - // xinef: remove stunned flag if owner was mounted - if (GetTypeId() == TYPEID_UNIT && !HasUnitState(UNIT_STATE_STUNNED)) + // xinef: remove stunned flag if owner was mounted + if (GetTypeId() == TYPEID_UNIT && !HasUnitState(UNIT_STATE_STUNNED)) RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); // If charmer still exists @@ -17046,7 +17046,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) playerCharmer->SetClientControl(this, false); playerCharmer->SetClientControl(charmer, true); // verified RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); - ClearUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + ClearUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); break; case CHARM_TYPE_POSSESS: playerCharmer->SetClientControl(this, false); @@ -17054,7 +17054,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) charmer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); ClearUnitState(UNIT_STATE_POSSESSED); - ClearUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + ClearUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); break; case CHARM_TYPE_CHARM: if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK) @@ -17071,43 +17071,43 @@ void Unit::RemoveCharmedBy(Unit* charmer) } break; default: - break; + break; } } - // xinef: restore threat - for (CharmThreatMap::const_iterator itr = _charmThreatInfo.begin(); itr != _charmThreatInfo.end(); ++itr) - { - if (Unit* target = ObjectAccessor::GetUnit(*this, itr->first)) - if (!IsFriendlyTo(target)) - AddThreat(target, itr->second); - } + // xinef: restore threat + for (CharmThreatMap::const_iterator itr = _charmThreatInfo.begin(); itr != _charmThreatInfo.end(); ++itr) + { + if (Unit* target = ObjectAccessor::GetUnit(*this, itr->first)) + if (!IsFriendlyTo(target)) + AddThreat(target, itr->second); + } - _charmThreatInfo.clear(); + _charmThreatInfo.clear(); if (Creature* creature = ToCreature()) { // Vehicle should not attack its passenger after he exists the seat if (type != CHARM_TYPE_VEHICLE && charmer && charmer->IsAlive() && !charmer->IsFriendlyTo(creature)) if (Attack(charmer, true)) - GetMotionMaster()->MoveChase(charmer); + GetMotionMaster()->MoveChase(charmer); // Creature will restore its old AI on next update if (creature->AI()) creature->AI()->OnCharmed(false); - // Xinef: Remove movement flag flying - RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING); + // Xinef: Remove movement flag flying + RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING); } else - ToPlayer()->SetClientControl(this, true); // verified + ToPlayer()->SetClientControl(this, true); // verified // a guardian should always have charminfo if (playerCharmer && this != charmer->GetFirstControlled()) playerCharmer->SendRemoveControlBar(); - // xinef: Always delete charm info (restores react state) - if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsGuardian())) + // xinef: Always delete charm info (restores react state) + if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsGuardian())) DeleteCharmInfo(); } @@ -17201,11 +17201,11 @@ bool Unit::IsInPartyWith(Unit const* unit) const if (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_PLAYER) return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer()); - // Xinef: we assume that npcs with the same faction are in party - else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer()) - return u1->getFaction() == u2->getFaction(); - // Xinef: creature type_flag should work for party check only if player group is not a raid - else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && (u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER) && u2->ToPlayer()->GetGroup() && !u2->ToPlayer()->GetGroup()->isRaidGroup()) || + // Xinef: we assume that npcs with the same faction are in party + else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer()) + return u1->getFaction() == u2->getFaction(); + // Xinef: creature type_flag should work for party check only if player group is not a raid + else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && (u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER) && u2->ToPlayer()->GetGroup() && !u2->ToPlayer()->GetGroup()->isRaidGroup()) || (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_UNIT && (u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER) && u1->ToPlayer()->GetGroup() && !u1->ToPlayer()->GetGroup()->isRaidGroup())) return true; else @@ -17224,9 +17224,9 @@ bool Unit::IsInRaidWith(Unit const* unit) const if (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_PLAYER) return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer()); - // Xinef: we assume that npcs with the same faction are in party - else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer()) - return u1->getFaction() == u2->getFaction(); + // Xinef: we assume that npcs with the same faction are in party + else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer()) + return u1->getFaction() == u2->getFaction(); else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER) || (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_UNIT && u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER)) return true; @@ -17256,12 +17256,12 @@ void Unit::GetPartyMembers(std::list &TagUnitMap) if (Target->IsAlive()) TagUnitMap.push_back(Target); - for (Unit::ControlSet::iterator itr = Target->m_Controlled.begin(); itr != Target->m_Controlled.end(); ++itr) - { - if (Unit* pet = *itr) - if (pet->IsGuardian() && pet->IsAlive()) - TagUnitMap.push_back(pet); - } + for (Unit::ControlSet::iterator itr = Target->m_Controlled.begin(); itr != Target->m_Controlled.end(); ++itr) + { + if (Unit* pet = *itr) + if (pet->IsGuardian() && pet->IsAlive()) + TagUnitMap.push_back(pet); + } } } } @@ -17270,13 +17270,13 @@ void Unit::GetPartyMembers(std::list &TagUnitMap) if (owner->IsAlive()) TagUnitMap.push_back(owner); - for (Unit::ControlSet::iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr) - { - if (Unit* pet = *itr) - if (pet->IsGuardian() && pet->IsAlive()) - TagUnitMap.push_back(pet); - } - } + for (Unit::ControlSet::iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr) + { + if (Unit* pet = *itr) + if (pet->IsGuardian() && pet->IsAlive()) + TagUnitMap.push_back(pet); + } + } } Aura* Unit::AddAura(uint32 spellId, Unit* target) @@ -17353,11 +17353,11 @@ void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool if (victim->GetTypeId() == TYPEID_PLAYER) target = victim; else if (victim->GetTypeId() == TYPEID_UNIT) - { - if (Unit* owner = victim->GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER) - target = owner; - } + { + if (Unit* owner = victim->GetOwner()) + if (owner->GetTypeId() == TYPEID_PLAYER) + target = owner; + } if (!target) return; @@ -17452,7 +17452,7 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update) if (IsInWorld()) { - // xinef: ZOMG!, to comment, bellow line should be removed + // xinef: ZOMG!, to comment, bellow line should be removed // pussywizard: goign to other phase (valithria, algalon) should not remove such auras //RemoveNotOwnSingleTargetAuras(newPhaseMask, true); // we can lost access to caster or target @@ -17474,7 +17474,7 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update) // modify threat lists for new phasemask if (GetTypeId() != TYPEID_PLAYER) { - ThreatContainer::StorageType threatList = getThreatManager().getThreatList(); + ThreatContainer::StorageType threatList = getThreatManager().getThreatList(); ThreatContainer::StorageType offlineThreatList = getThreatManager().getOfflineThreatList(); // merge expects sorted lists @@ -17495,12 +17495,12 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update) return; for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ) - { - Unit* controlled = *itr; - ++itr; + { + Unit* controlled = *itr; + ++itr; if (controlled->GetTypeId() == TYPEID_UNIT) controlled->SetPhaseMask(newPhaseMask, true); - } + } for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i) if (m_SummonSlot[i]) @@ -17866,7 +17866,7 @@ uint32 Unit::GetModelForTotem(PlayerTotemType totemType) Unit* Unit::GetRedirectThreatTarget() const { - return _redirectThreatInfo.GetTargetGUID() ? ObjectAccessor::GetUnit(*this, _redirectThreatInfo.GetTargetGUID()) : NULL; + return _redirectThreatInfo.GetTargetGUID() ? ObjectAccessor::GetUnit(*this, _redirectThreatInfo.GetTargetGUID()) : NULL; } void Unit::JumpTo(float speedXY, float speedZ, bool forward) @@ -18042,8 +18042,8 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a return; } - // Xinef: remove movement auras when entering vehicle (food buffs etc) - RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING|AURA_INTERRUPT_FLAG_MOVE); + // Xinef: remove movement auras when entering vehicle (food buffs etc) + RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING|AURA_INTERRUPT_FLAG_MOVE); } void Unit::ChangeSeat(int8 seatId, bool next) @@ -18086,11 +18086,11 @@ void Unit::ExitVehicle(Position const* /*exitPosition*/) bool VehicleDespawnEvent::Execute(uint64 e_time, uint32 p_time) { - Position pos = _self; - _self.MovePositionToFirstCollision(pos, 20.0f, M_PI); - _self.GetMotionMaster()->MovePoint(0, pos); - _self.ToCreature()->DespawnOrUnsummon(_duration); - return true; + Position pos = _self; + _self.MovePositionToFirstCollision(pos, 20.0f, M_PI); + _self.GetMotionMaster()->MovePoint(0, pos); + _self.ToCreature()->DespawnOrUnsummon(_duration); + return true; } void Unit::_ExitVehicle(Position const* exitPosition) @@ -18108,7 +18108,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) // This should be done before dismiss, because there may be some aura removal Vehicle* vehicle = m_vehicle; - Unit* vehicleBase = m_vehicle->GetBase(); + Unit* vehicleBase = m_vehicle->GetBase(); m_vehicle = NULL; SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT @@ -18120,19 +18120,19 @@ void Unit::_ExitVehicle(Position const* exitPosition) else pos = *exitPosition; - // HACK - if (vehicle->GetVehicleInfo()->m_ID == 380) // Kologarn right arm - pos.Relocate(1776.0f, -24.0f, 448.75f, 0.0f); - else if (vehicle->GetVehicleInfo()->m_ID == 91) // Helsman's Ship - pos.Relocate(2802.18f, 7054.91f, -0.6f, 4.67f); - else if (vehicle->GetVehicleInfo()->m_ID == 349) // AT Mounts, dismount to the right - { - float x = pos.GetPositionX() + 2.0f * cos(pos.GetOrientation() - M_PI / 2.0f); - float y = pos.GetPositionY() + 2.0f * sin(pos.GetOrientation() - M_PI / 2.0f); - float z = GetMap()->GetHeight(GetPhaseMask(), x, y, pos.GetPositionZ())+0.1f; - if (z > INVALID_HEIGHT) - pos.Relocate(x, y, z); - } + // HACK + if (vehicle->GetVehicleInfo()->m_ID == 380) // Kologarn right arm + pos.Relocate(1776.0f, -24.0f, 448.75f, 0.0f); + else if (vehicle->GetVehicleInfo()->m_ID == 91) // Helsman's Ship + pos.Relocate(2802.18f, 7054.91f, -0.6f, 4.67f); + else if (vehicle->GetVehicleInfo()->m_ID == 349) // AT Mounts, dismount to the right + { + float x = pos.GetPositionX() + 2.0f * cos(pos.GetOrientation() - M_PI / 2.0f); + float y = pos.GetPositionY() + 2.0f * sin(pos.GetOrientation() - M_PI / 2.0f); + float z = GetMap()->GetHeight(GetPhaseMask(), x, y, pos.GetPositionZ())+0.1f; + if (z > INVALID_HEIGHT) + pos.Relocate(x, y, z); + } AddUnitState(UNIT_STATE_MOVE); @@ -18145,54 +18145,54 @@ void Unit::_ExitVehicle(Position const* exitPosition) SendMessageToSet(&data, false); } - // xinef: hack for flameleviathan seat vehicle - if (vehicle->GetVehicleInfo()->m_ID != 341) - { - Movement::MoveSplineInit init(this); - init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); - init.SetFacing(GetOrientation()); - init.SetTransportExit(); - init.Launch(); - } - else - { - float o = pos.GetAngle(this); - Movement::MoveSplineInit init(this); - init.MoveTo(pos.GetPositionX()+8*cos(o), pos.GetPositionY()+8*sin(o), pos.GetPositionZ()+16.0f); - init.SetFacing(GetOrientation()); - init.SetTransportExit(); - init.Launch(); - DisableSpline(); - KnockbackFrom(pos.GetPositionX(), pos.GetPositionY(), 10.0f, 20.0f); - CastSpell(this, VEHICLE_SPELL_PARACHUTE, true); - } + // xinef: hack for flameleviathan seat vehicle + if (vehicle->GetVehicleInfo()->m_ID != 341) + { + Movement::MoveSplineInit init(this); + init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); + init.SetFacing(GetOrientation()); + init.SetTransportExit(); + init.Launch(); + } + else + { + float o = pos.GetAngle(this); + Movement::MoveSplineInit init(this); + init.MoveTo(pos.GetPositionX()+8*cos(o), pos.GetPositionY()+8*sin(o), pos.GetPositionZ()+16.0f); + init.SetFacing(GetOrientation()); + init.SetTransportExit(); + init.Launch(); + DisableSpline(); + KnockbackFrom(pos.GetPositionX(), pos.GetPositionY(), 10.0f, 20.0f); + CastSpell(this, VEHICLE_SPELL_PARACHUTE, true); + } - // xinef: move fall, should we support all creatures that exited vehicle in air? Currently Quest Drag and Drop only, Air Assault quest - if (GetTypeId() == TYPEID_UNIT && !CanFly() && - (vehicle->GetVehicleInfo()->m_ID == 113 || vehicle->GetVehicleInfo()->m_ID == 8 || vehicle->GetVehicleInfo()->m_ID == 290 || vehicle->GetVehicleInfo()->m_ID == 298)) - GetMotionMaster()->MoveFall(); + // xinef: move fall, should we support all creatures that exited vehicle in air? Currently Quest Drag and Drop only, Air Assault quest + if (GetTypeId() == TYPEID_UNIT && !CanFly() && + (vehicle->GetVehicleInfo()->m_ID == 113 || vehicle->GetVehicleInfo()->m_ID == 8 || vehicle->GetVehicleInfo()->m_ID == 290 || vehicle->GetVehicleInfo()->m_ID == 298)) + GetMotionMaster()->MoveFall(); //GetMotionMaster()->MoveFall(); // Enable this once passenger positions are calculater properly (see above) if ((!player || !(player->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT)) && vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION)) if (((Minion*)vehicleBase)->GetOwner() == this) - { - if (vehicle->GetVehicleInfo()->m_ID != 349) - vehicle->Dismiss(); - else if (vehicleBase->GetTypeId() == TYPEID_UNIT) - { - vehicle->Uninstall(); - vehicleBase->m_Events.AddEvent(new VehicleDespawnEvent(*vehicleBase, 2000), vehicleBase->m_Events.CalculateTime(2000)); - } + { + if (vehicle->GetVehicleInfo()->m_ID != 349) + vehicle->Dismiss(); + else if (vehicleBase->GetTypeId() == TYPEID_UNIT) + { + vehicle->Uninstall(); + vehicleBase->m_Events.AddEvent(new VehicleDespawnEvent(*vehicleBase, 2000), vehicleBase->m_Events.CalculateTime(2000)); + } - // xinef: ugly hack, no appripriate hook later to cast spell - if (player) - { - if (vehicleBase->GetEntry() == NPC_EIDOLON_WATCHER) - player->CastSpell(player, VEHICLE_SPELL_SHADE_CONTROL_END, true); - else if (vehicleBase->GetEntry() == NPC_LITHE_STALKER) - player->CastSpell(player, VEHICLE_SPELL_GEIST_CONTROL_END, true); - } - } + // xinef: ugly hack, no appripriate hook later to cast spell + if (player) + { + if (vehicleBase->GetEntry() == NPC_EIDOLON_WATCHER) + player->CastSpell(player, VEHICLE_SPELL_SHADE_CONTROL_END, true); + else if (vehicleBase->GetEntry() == NPC_LITHE_STALKER) + player->CastSpell(player, VEHICLE_SPELL_GEIST_CONTROL_END, true); + } + } if (HasUnitTypeMask(UNIT_MASK_ACCESSORY)) { @@ -18201,10 +18201,10 @@ void Unit::_ExitVehicle(Position const* exitPosition) setDeathState(JUST_DIED); // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon else - { - SetVisible(false); + { + SetVisible(false); ToTempSummon()->UnSummon(2000); // Approximation - } + } } if (player) @@ -18282,7 +18282,7 @@ void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool cas SendTeleportPacket(pos); UpdatePosition(x, y, z, orientation, true); UpdateObjectVisibility(); - GetMotionMaster()->ReinitializeMovement(); + GetMotionMaster()->ReinitializeMovement(); } } @@ -18307,19 +18307,19 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel if (!Trinity::IsValidMapCoord(x, y, z, orientation)) return false; - float old_orientation = GetOrientation(); - float current_z = GetPositionZ(); + float old_orientation = GetOrientation(); + float current_z = GetPositionZ(); bool turn = (old_orientation != orientation); bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || current_z != z); - if (!GetVehicle()) - { - uint32 mask = 0; - if (turn) mask |= AURA_INTERRUPT_FLAG_TURNING; - if (relocated) mask |= AURA_INTERRUPT_FLAG_MOVE; - if (mask) - RemoveAurasWithInterruptFlags(mask); - } + if (!GetVehicle()) + { + uint32 mask = 0; + if (turn) mask |= AURA_INTERRUPT_FLAG_TURNING; + if (relocated) mask |= AURA_INTERRUPT_FLAG_MOVE; + if (mask) + RemoveAurasWithInterruptFlags(mask); + } if (relocated) { @@ -18501,7 +18501,7 @@ void Unit::OutDebugInfo() const { sLog->outStringInLine("Passenger List: "); for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr) - if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid)) + if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid)) sLog->outStringInLine(UI64FMTD", ", passenger->GetGUID()); sLog->outString(); } @@ -18512,42 +18512,42 @@ void Unit::OutDebugInfo() const class AuraMunchingQueue : public BasicEvent { - public: - AuraMunchingQueue(Unit& owner, uint64 targetGUID, int32 basePoints, uint32 spellId) : _owner(owner), _targetGUID(targetGUID), _basePoints(basePoints), _spellId(spellId) { } + public: + AuraMunchingQueue(Unit& owner, uint64 targetGUID, int32 basePoints, uint32 spellId) : _owner(owner), _targetGUID(targetGUID), _basePoints(basePoints), _spellId(spellId) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - if (_owner.IsInWorld() && _owner.FindMap()) - if (Unit* target = ObjectAccessor::GetUnit(_owner, _targetGUID)) - _owner.CastCustomSpell(_spellId, SPELLVALUE_BASE_POINT0, _basePoints, target, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_NO_PERIODIC_RESET), NULL, NULL, _owner.GetGUID()); - - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + if (_owner.IsInWorld() && _owner.FindMap()) + if (Unit* target = ObjectAccessor::GetUnit(_owner, _targetGUID)) + _owner.CastCustomSpell(_spellId, SPELLVALUE_BASE_POINT0, _basePoints, target, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_NO_PERIODIC_RESET), NULL, NULL, _owner.GetGUID()); + + return true; + } - private: - uint64 _targetGUID; - Unit& _owner; - int32 _basePoints; - uint32 _spellId; + private: + uint64 _targetGUID; + Unit& _owner; + int32 _basePoints; + uint32 _spellId; }; void Unit::CastDelayedSpellWithPeriodicAmount(Unit* caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex) { for (AuraEffectList::iterator i = m_modAuras[auraType].begin(); i != m_modAuras[auraType].end(); ++i) { - AuraEffect* aurEff = *i; - if (aurEff->GetCasterGUID() != caster->GetGUID() || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks()) + AuraEffect* aurEff = *i; + if (aurEff->GetCasterGUID() != caster->GetGUID() || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks()) continue; addAmount += ((aurEff->GetOldAmount() * std::max(aurEff->GetTotalTicks() - int32(aurEff->GetTickNumber()), 0)) / aurEff->GetTotalTicks()); break; } - // xinef: delay only for casting on different unit - if (this == caster) - caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_NO_PERIODIC_RESET), NULL, NULL, caster->GetGUID()); - else - caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId), caster->m_Events.CalculateQueueTime(400)); + // xinef: delay only for casting on different unit + if (this == caster) + caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_NO_PERIODIC_RESET), NULL, NULL, caster->GetGUID()); + else + caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId), caster->m_Events.CalculateQueueTime(400)); } void Unit::SendClearTarget() @@ -18591,16 +18591,16 @@ bool CharmInfo::IsCommandFollow() void CharmInfo::SaveStayPosition(bool atCurrentPos) { //! At this point a new spline destination is enabled because of Unit::StopMoving() - G3D::Vector3 stayPos = G3D::Vector3(); - - if (atCurrentPos) - { - float z = INVALID_HEIGHT; - _unit->UpdateAllowedPositionZ(_unit->GetPositionX(), _unit->GetPositionY(), z); - stayPos = G3D::Vector3(_unit->GetPositionX(), _unit->GetPositionY(), z != INVALID_HEIGHT ? z : _unit->GetPositionZ()); - } - else - stayPos = _unit->movespline->FinalDestination(); + G3D::Vector3 stayPos = G3D::Vector3(); + + if (atCurrentPos) + { + float z = INVALID_HEIGHT; + _unit->UpdateAllowedPositionZ(_unit->GetPositionX(), _unit->GetPositionY(), z); + stayPos = G3D::Vector3(_unit->GetPositionX(), _unit->GetPositionY(), z != INVALID_HEIGHT ? z : _unit->GetPositionZ()); + } + else + stayPos = _unit->movespline->FinalDestination(); if (_unit->movespline->onTransport) if (TransportBase* transport = _unit->GetDirectTransport()) @@ -18650,52 +18650,52 @@ bool CharmInfo::IsReturning() void Unit::PetSpellFail(const SpellInfo* spellInfo, Unit* target, uint32 result) { - CharmInfo* charmInfo = GetCharmInfo(); - if (!charmInfo || GetTypeId() != TYPEID_UNIT) - return; + CharmInfo* charmInfo = GetCharmInfo(); + if (!charmInfo || GetTypeId() != TYPEID_UNIT) + return; if ((MMAP::MMapFactory::IsPathfindingEnabled(GetMap()) || result != SPELL_FAILED_LINE_OF_SIGHT) && target) - { - if ((result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE) || !ToCreature()->HasReactState(REACT_PASSIVE)) - if (Unit *owner = GetOwner()) - { - if (spellInfo->IsPositive() && IsFriendlyTo(target)) - { - AttackStop(); - charmInfo->SetIsAtStay(false); - charmInfo->SetIsCommandAttack(!ToCreature()->HasReactState(REACT_PASSIVE)); - charmInfo->SetIsReturning(false); - charmInfo->SetIsFollowing(false); - - GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, rand_norm()*2*M_PI); - } - else if (owner->IsValidAttackTarget(target)) - { - AttackStop(); - charmInfo->SetIsAtStay(false); - charmInfo->SetIsCommandAttack(!ToCreature()->HasReactState(REACT_PASSIVE)); - charmInfo->SetIsReturning(false); - charmInfo->SetIsFollowing(false); - - if (!ToCreature()->HasReactState(REACT_PASSIVE)) - ToCreature()->AI()->AttackStart(target); - else - GetMotionMaster()->MoveChase(target); - } - } + { + if ((result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE) || !ToCreature()->HasReactState(REACT_PASSIVE)) + if (Unit *owner = GetOwner()) + { + if (spellInfo->IsPositive() && IsFriendlyTo(target)) + { + AttackStop(); + charmInfo->SetIsAtStay(false); + charmInfo->SetIsCommandAttack(!ToCreature()->HasReactState(REACT_PASSIVE)); + charmInfo->SetIsReturning(false); + charmInfo->SetIsFollowing(false); + + GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, rand_norm()*2*M_PI); + } + else if (owner->IsValidAttackTarget(target)) + { + AttackStop(); + charmInfo->SetIsAtStay(false); + charmInfo->SetIsCommandAttack(!ToCreature()->HasReactState(REACT_PASSIVE)); + charmInfo->SetIsReturning(false); + charmInfo->SetIsFollowing(false); + + if (!ToCreature()->HasReactState(REACT_PASSIVE)) + ToCreature()->AI()->AttackStart(target); + else + GetMotionMaster()->MoveChase(target); + } + } - // can be extended in future - if (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE) - { - charmInfo->SetForcedSpell(spellInfo->IsPositive() ? -int32(spellInfo->Id) : spellInfo->Id); - charmInfo->SetForcedTargetGUID(target->GetGUID()); - } - else - { - charmInfo->SetForcedSpell(0); - charmInfo->SetForcedTargetGUID(0); - } - } + // can be extended in future + if (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE) + { + charmInfo->SetForcedSpell(spellInfo->IsPositive() ? -int32(spellInfo->Id) : spellInfo->Id); + charmInfo->SetForcedTargetGUID(target->GetGUID()); + } + else + { + charmInfo->SetForcedSpell(0); + charmInfo->SetForcedTargetGUID(0); + } + } } int32 Unit::CalculateAOEDamageReduction(int32 damage, uint32 schoolMask, Unit* caster) const @@ -18704,179 +18704,179 @@ int32 Unit::CalculateAOEDamageReduction(int32 damage, uint32 schoolMask, Unit* c if (caster && caster->GetTypeId() == TYPEID_UNIT) damage = int32(float(damage) * GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, schoolMask)); - return damage; + return damage; } bool ConflagrateAuraStateDelayEvent::Execute(uint64 e_time, uint32 p_time) { - if (Unit* owner = ObjectAccessor::FindUnit(m_owner)) - if (owner && m_caster && owner->IsInWorld()) - if (owner->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x4, 0, 0, m_caster) || // immolate - owner->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0, 0, 0x2, m_caster)) // shadowflame - owner->ModifyAuraState(AURA_STATE_CONFLAGRATE, true); + if (Unit* owner = ObjectAccessor::FindUnit(m_owner)) + if (owner && m_caster && owner->IsInWorld()) + if (owner->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x4, 0, 0, m_caster) || // immolate + owner->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0, 0, 0x2, m_caster)) // shadowflame + owner->ModifyAuraState(AURA_STATE_CONFLAGRATE, true); - return true; + return true; } uint32 Unit::GetZoneId(bool forceRecalc) const { - // xinef: optimization, zone calculated every few yards - if (!forceRecalc && GetExactDistSq(&m_last_zone_position) < 4.0f*4.0f) - return m_last_zone_id; - else - { - const_cast(&m_last_zone_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); - *(const_cast(&m_last_zone_id)) = WorldObject::GetZoneId(); - return m_last_zone_id; - } + // xinef: optimization, zone calculated every few yards + if (!forceRecalc && GetExactDistSq(&m_last_zone_position) < 4.0f*4.0f) + return m_last_zone_id; + else + { + const_cast(&m_last_zone_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); + *(const_cast(&m_last_zone_id)) = WorldObject::GetZoneId(); + return m_last_zone_id; + } } uint32 Unit::GetAreaId(bool forceRecalc) const { - // xinef: optimization, area calculated every few yards - if (!forceRecalc && GetExactDistSq(&m_last_area_position) < 4.0f*4.0f) - return m_last_area_id; - else - { - const_cast(&m_last_area_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); - *(const_cast(&m_last_area_id)) = WorldObject::GetAreaId(); - return m_last_area_id; - } + // xinef: optimization, area calculated every few yards + if (!forceRecalc && GetExactDistSq(&m_last_area_position) < 4.0f*4.0f) + return m_last_area_id; + else + { + const_cast(&m_last_area_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); + *(const_cast(&m_last_area_id)) = WorldObject::GetAreaId(); + return m_last_area_id; + } } void Unit::GetZoneAndAreaId(uint32& zoneid, uint32& areaid, bool forceRecalc) const { - // xinef: optimization, zone and area calculated every few yards - if (!forceRecalc && GetExactDistSq(&m_last_area_position) < 4.0f*4.0f && GetExactDistSq(&m_last_zone_position) < 4.0f*4.0f) - { - zoneid = m_last_zone_id; - areaid = m_last_area_id; - return; - } + // xinef: optimization, zone and area calculated every few yards + if (!forceRecalc && GetExactDistSq(&m_last_area_position) < 4.0f*4.0f && GetExactDistSq(&m_last_zone_position) < 4.0f*4.0f) + { + zoneid = m_last_zone_id; + areaid = m_last_area_id; + return; + } - const_cast(&m_last_zone_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); - const_cast(&m_last_area_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); - WorldObject::GetZoneAndAreaId(zoneid, areaid); - *(const_cast(&m_last_zone_id)) = zoneid; - *(const_cast(&m_last_area_id)) = areaid; + const_cast(&m_last_zone_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); + const_cast(&m_last_area_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); + WorldObject::GetZoneAndAreaId(zoneid, areaid); + *(const_cast(&m_last_zone_id)) = zoneid; + *(const_cast(&m_last_area_id)) = areaid; } bool Unit::IsOutdoors() const { - // xinef: optimization, outdoor status calculated every few yards - if (GetExactDistSq(&m_last_outdoors_position) < 4.0f*4.0f) - return m_last_outdoors_status; - else - { - const_cast(&m_last_outdoors_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); - *(const_cast(&m_last_outdoors_status)) = GetMap()->IsOutdoors(GetPositionX(), GetPositionY(), GetPositionZ()); - return m_last_outdoors_status; - } + // xinef: optimization, outdoor status calculated every few yards + if (GetExactDistSq(&m_last_outdoors_position) < 4.0f*4.0f) + return m_last_outdoors_status; + else + { + const_cast(&m_last_outdoors_position)->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); + *(const_cast(&m_last_outdoors_status)) = GetMap()->IsOutdoors(GetPositionX(), GetPositionY(), GetPositionZ()); + return m_last_outdoors_status; + } } void Unit::ExecuteDelayedUnitRelocationEvent() { - this->RemoveFromNotify(NOTIFY_VISIBILITY_CHANGED); - if (!this->IsInWorld() || this->IsDuringRemoveFromWorld()) - return; + this->RemoveFromNotify(NOTIFY_VISIBILITY_CHANGED); + if (!this->IsInWorld() || this->IsDuringRemoveFromWorld()) + return; - if (this->HasSharedVision()) - for (SharedVisionList::const_iterator itr = this->GetSharedVisionList().begin(); itr != this->GetSharedVisionList().end(); ++itr) - if (Player* player = (*itr)) - { - if (player->IsOnVehicle(this) || !player->IsInWorld() || player->IsDuringRemoveFromWorld()) // players on vehicles have their own event executed (due to passenger relocation) - continue; - WorldObject* viewPoint = player; - if (player->m_seer && player->m_seer->IsInWorld()) - viewPoint = player->m_seer; - if (!viewPoint->IsPositionValid() || !player->IsPositionValid()) - continue; + if (this->HasSharedVision()) + for (SharedVisionList::const_iterator itr = this->GetSharedVisionList().begin(); itr != this->GetSharedVisionList().end(); ++itr) + if (Player* player = (*itr)) + { + if (player->IsOnVehicle(this) || !player->IsInWorld() || player->IsDuringRemoveFromWorld()) // players on vehicles have their own event executed (due to passenger relocation) + continue; + WorldObject* viewPoint = player; + if (player->m_seer && player->m_seer->IsInWorld()) + viewPoint = player->m_seer; + if (!viewPoint->IsPositionValid() || !player->IsPositionValid()) + continue; - if (Unit* active = viewPoint->ToUnit()) - { - //if (active->IsVehicle()) // always check original unit here, last notify position is not relocated - // active = player; + if (Unit* active = viewPoint->ToUnit()) + { + //if (active->IsVehicle()) // always check original unit here, last notify position is not relocated + // active = player; - float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX(); - float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY(); - float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ(); - float distsq = dx*dx+dy*dy+dz*dz; - float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type); - if (distsq < mindistsq) - continue; + float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX(); + float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY(); + float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ(); + float distsq = dx*dx+dy*dy+dz*dz; + float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type); + if (distsq < mindistsq) + continue; - // this will be relocated below sharedvision! - //active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ()); - } + // this will be relocated below sharedvision! + //active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ()); + } - Trinity::PlayerRelocationNotifier relocate(*player); - viewPoint->VisitNearbyObject(player->GetSightRange()+VISIBILITY_INC_FOR_GOBJECTS, relocate); - relocate.SendToSelf(); - } + Trinity::PlayerRelocationNotifier relocate(*player); + viewPoint->VisitNearbyObject(player->GetSightRange()+VISIBILITY_INC_FOR_GOBJECTS, relocate); + relocate.SendToSelf(); + } - if (Player* player = this->ToPlayer()) - { - WorldObject* viewPoint = player; - if (player->m_seer && player->m_seer->IsInWorld()) - viewPoint = player->m_seer; + if (Player* player = this->ToPlayer()) + { + WorldObject* viewPoint = player; + if (player->m_seer && player->m_seer->IsInWorld()) + viewPoint = player->m_seer; - if (viewPoint->GetMapId() != player->GetMapId() || !viewPoint->IsPositionValid() || !player->IsPositionValid()) - return; + if (viewPoint->GetMapId() != player->GetMapId() || !viewPoint->IsPositionValid() || !player->IsPositionValid()) + return; - if (Unit* active = viewPoint->ToUnit()) - { - if (active->IsVehicle()) - active = player; + if (Unit* active = viewPoint->ToUnit()) + { + if (active->IsVehicle()) + active = player; - float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX(); - float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY(); - float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ(); - float distsq = dx*dx+dy*dy+dz*dz; + float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX(); + float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY(); + float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ(); + float distsq = dx*dx+dy*dy+dz*dz; - float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type); - if (distsq < mindistsq) - return; - - active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ()); - } + float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type); + if (distsq < mindistsq) + return; + + active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ()); + } - Trinity::PlayerRelocationNotifier relocate(*player); - viewPoint->VisitNearbyObject(player->GetSightRange()+VISIBILITY_INC_FOR_GOBJECTS, relocate); - relocate.SendToSelf(); + Trinity::PlayerRelocationNotifier relocate(*player); + viewPoint->VisitNearbyObject(player->GetSightRange()+VISIBILITY_INC_FOR_GOBJECTS, relocate); + relocate.SendToSelf(); - this->AddToNotify(NOTIFY_AI_RELOCATION); - } - else if (Creature* unit = this->ToCreature()) - { - if (!unit->IsPositionValid()) - return; + this->AddToNotify(NOTIFY_AI_RELOCATION); + } + else if (Creature* unit = this->ToCreature()) + { + if (!unit->IsPositionValid()) + return; - float dx = unit->m_last_notify_position.GetPositionX() - unit->GetPositionX(); - float dy = unit->m_last_notify_position.GetPositionY() - unit->GetPositionY(); - float dz = unit->m_last_notify_position.GetPositionZ() - unit->GetPositionZ(); - float distsq = dx*dx+dy*dy+dz*dz; - float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(unit->FindMap()->GetEntry()->map_type); - if (distsq < mindistsq) - return; + float dx = unit->m_last_notify_position.GetPositionX() - unit->GetPositionX(); + float dy = unit->m_last_notify_position.GetPositionY() - unit->GetPositionY(); + float dz = unit->m_last_notify_position.GetPositionZ() - unit->GetPositionZ(); + float distsq = dx*dx+dy*dy+dz*dz; + float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(unit->FindMap()->GetEntry()->map_type); + if (distsq < mindistsq) + return; - unit->m_last_notify_position.Relocate(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()); + unit->m_last_notify_position.Relocate(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()); - Trinity::CreatureRelocationNotifier relocate(*unit); - unit->VisitNearbyObject(unit->GetMap()->GetVisibilityRange(), relocate); + Trinity::CreatureRelocationNotifier relocate(*unit); + unit->VisitNearbyObject(unit->GetMap()->GetVisibilityRange(), relocate); - this->AddToNotify(NOTIFY_AI_RELOCATION); - } + this->AddToNotify(NOTIFY_AI_RELOCATION); + } } void Unit::ExecuteDelayedUnitAINotifyEvent() { - this->RemoveFromNotify(NOTIFY_AI_RELOCATION); - if (!this->IsInWorld() || this->IsDuringRemoveFromWorld()) - return; + this->RemoveFromNotify(NOTIFY_AI_RELOCATION); + if (!this->IsInWorld() || this->IsDuringRemoveFromWorld()) + return; - Trinity::AIRelocationNotifier notifier(*this); - float radius = 60.0f; - this->VisitNearbyObject(radius, notifier); + Trinity::AIRelocationNotifier notifier(*this); + float radius = 60.0f; + this->VisitNearbyObject(radius, notifier); } void Unit::SetInFront(WorldObject const* target) @@ -19194,32 +19194,32 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) // FG: pretend that OTHER players in own group are friendly ("blue") else if (index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE) { - if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target)) - { - FactionTemplateEntry const* ft1 = GetFactionTemplateEntry(); - FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry(); - if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2)) - { - if (index == UNIT_FIELD_BYTES_2) - // Allow targetting opposite faction in party when enabled in config - fieldBuffer << (m_uint32Values[UNIT_FIELD_BYTES_2] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8)); // this flag is at uint8 offset 1 !! - else - // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work) - fieldBuffer << uint32(target->getFaction()); - } - else - fieldBuffer << m_uint32Values[index]; - }// pussywizard / Callmephil - else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() && - (this->GetTypeId() == TYPEID_PLAYER || this->GetTypeId() == TYPEID_UNIT || this->GetTypeId() == TYPEID_DYNAMICOBJECT)) - { - if (index == UNIT_FIELD_BYTES_2) - fieldBuffer << (m_uint32Values[index] & 0xFFFFF2FF); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY - else - fieldBuffer << (uint32)target->getFaction(); - } - else - fieldBuffer << m_uint32Values[index]; + if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target)) + { + FactionTemplateEntry const* ft1 = GetFactionTemplateEntry(); + FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry(); + if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2)) + { + if (index == UNIT_FIELD_BYTES_2) + // Allow targetting opposite faction in party when enabled in config + fieldBuffer << (m_uint32Values[UNIT_FIELD_BYTES_2] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8)); // this flag is at uint8 offset 1 !! + else + // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work) + fieldBuffer << uint32(target->getFaction()); + } + else + fieldBuffer << m_uint32Values[index]; + }// pussywizard / Callmephil + else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() && + (this->GetTypeId() == TYPEID_PLAYER || this->GetTypeId() == TYPEID_UNIT || this->GetTypeId() == TYPEID_DYNAMICOBJECT)) + { + if (index == UNIT_FIELD_BYTES_2) + fieldBuffer << (m_uint32Values[index] & 0xFFFFF2FF); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY + else + fieldBuffer << (uint32)target->getFaction(); + } + else + fieldBuffer << m_uint32Values[index]; } else // send in current format (float as float, uint32 as uint32) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index a3a331f84..0447ac6fe 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -124,7 +124,7 @@ enum SpellValueMod SPELLVALUE_RADIUS_MOD, SPELLVALUE_MAX_TARGETS, SPELLVALUE_AURA_STACK, - SPELLVALUE_FORCED_CRIT_RESULT + SPELLVALUE_FORCED_CRIT_RESULT }; typedef std::pair CustomSpellValueMod; @@ -335,15 +335,15 @@ typedef std::list< std::pair > DispelChargesList; enum SpellImmuneBlockType { - SPELL_BLOCK_TYPE_ALL = 0, - SPELL_BLOCK_TYPE_POSITIVE = 1, + SPELL_BLOCK_TYPE_ALL = 0, + SPELL_BLOCK_TYPE_POSITIVE = 1, }; struct SpellImmune { uint32 spellId; - uint32 type : 16; - uint32 blockType : 16; + uint32 type : 16; + uint32 blockType : 16; }; typedef std::list SpellImmuneList; @@ -393,7 +393,7 @@ enum TriggerCastFlags TRIGGERED_DISALLOW_PROC_EVENTS = 0x00020000, //! Disallows proc events from triggered spell (default) TRIGGERED_DONT_REPORT_CAST_ERROR = 0x00040000, //! Will return SPELL_FAILED_DONT_REPORT in CheckCast functions TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT = 0x00080000, //! Will ignore equipped item requirements - TRIGGERED_NO_PERIODIC_RESET = 0x00100000, //! Periodic aura tick wont be reset on override + TRIGGERED_NO_PERIODIC_RESET = 0x00100000, //! Periodic aura tick wont be reset on override TRIGGERED_FULL_MASK = 0xFFFFFFFF }; @@ -944,11 +944,11 @@ private: uint32 _spellTypeMask; uint32 _spellPhaseMask; uint32 _hitMask; - uint32 _cooldown; + uint32 _cooldown; Spell* _spell; DamageInfo* _damageInfo; HealInfo* _healInfo; - SpellInfo const* const _triggeredByAuraSpell; + SpellInfo const* const _triggeredByAuraSpell; public: explicit ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, uint32 typeMask, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo, SpellInfo const* triggeredByAuraSpell); Unit* GetActor() { return _actor; }; @@ -962,9 +962,9 @@ public: SpellSchoolMask GetSchoolMask() const { return SPELL_SCHOOL_MASK_NONE; } DamageInfo* GetDamageInfo() const { return _damageInfo; } HealInfo* GetHealInfo() const { return _healInfo; } - SpellInfo const* GetTriggerAuraSpell() const { return _triggeredByAuraSpell; } - uint32 GetProcCooldown() const { return _cooldown; } - void SetProcCooldown(uint32 cooldown) { _cooldown = cooldown; } + SpellInfo const* GetTriggerAuraSpell() const { return _triggeredByAuraSpell; } + uint32 GetProcCooldown() const { return _cooldown; } + void SetProcCooldown(uint32 cooldown) { _cooldown = cooldown; } }; // Struct for use in Unit::CalculateMeleeDamage @@ -1225,14 +1225,14 @@ struct CharmInfo void SaveStayPosition(bool atCurrentPos); void GetStayPosition(float &x, float &y, float &z); - void SetForcedSpell(uint32 id) { _forcedSpellId = id; } - int32 GetForcedSpell() { return _forcedSpellId; } - void SetForcedTargetGUID(uint64 guid) { _forcedTargetGUID = guid; } - uint64 GetForcedTarget() { return _forcedTargetGUID; } + void SetForcedSpell(uint32 id) { _forcedSpellId = id; } + int32 GetForcedSpell() { return _forcedSpellId; } + void SetForcedTargetGUID(uint64 guid) { _forcedTargetGUID = guid; } + uint64 GetForcedTarget() { return _forcedTargetGUID; } - // Player react states - void SetPlayerReactState(ReactStates s) { _oldReactState = s; } - ReactStates GetPlayerReactState() const { return _oldReactState; } + // Player react states + void SetPlayerReactState(ReactStates s) { _oldReactState = s; } + ReactStates GetPlayerReactState() const { return _oldReactState; } private: @@ -1254,8 +1254,8 @@ struct CharmInfo float _stayY; float _stayZ; - int32 _forcedSpellId; - uint64 _forcedTargetGUID; + int32 _forcedSpellId; + uint64 _forcedTargetGUID; GlobalCooldownMgr _GlobalCooldownMgr; }; @@ -1308,43 +1308,43 @@ struct SpellProcEventEntry; // used only private class MMapTargetData { public: - MMapTargetData() {} - MMapTargetData(uint32 endTime, const Position* o, const Position* t) - { - _endTime = endTime; - _posOwner.Relocate(o); - _posTarget.Relocate(t); - } - MMapTargetData(const MMapTargetData& c) - { - _endTime = c._endTime; - _posOwner.Relocate(c._posOwner); - _posTarget.Relocate(c._posTarget); - } - bool PosChanged(const Position& o, const Position& t) const - { - return _posOwner.GetExactDistSq(&o) > 0.5f*0.5f || _posTarget.GetExactDistSq(&t) > 0.5f*0.5f; - } - uint32 _endTime; - Position _posOwner; - Position _posTarget; + MMapTargetData() {} + MMapTargetData(uint32 endTime, const Position* o, const Position* t) + { + _endTime = endTime; + _posOwner.Relocate(o); + _posTarget.Relocate(t); + } + MMapTargetData(const MMapTargetData& c) + { + _endTime = c._endTime; + _posOwner.Relocate(c._posOwner); + _posTarget.Relocate(c._posTarget); + } + bool PosChanged(const Position& o, const Position& t) const + { + return _posOwner.GetExactDistSq(&o) > 0.5f*0.5f || _posTarget.GetExactDistSq(&t) > 0.5f*0.5f; + } + uint32 _endTime; + Position _posOwner; + Position _posTarget; }; class SafeUnitPointer { public: - explicit SafeUnitPointer(Unit* defVal) : defaultValue(defVal), ptr(defVal) {} - SafeUnitPointer(const SafeUnitPointer& p) { ASSERT(false); } - void Initialize(Unit* defVal) { defaultValue = defVal; ptr = defVal; } - ~SafeUnitPointer(); - void SetPointedTo(Unit* u); - void UnitDeleted(); - Unit* operator->() const { return ptr; } - void operator=(Unit* u) { SetPointedTo(u); } - operator Unit*() const { return ptr; } + explicit SafeUnitPointer(Unit* defVal) : defaultValue(defVal), ptr(defVal) {} + SafeUnitPointer(const SafeUnitPointer& p) { ASSERT(false); } + void Initialize(Unit* defVal) { defaultValue = defVal; ptr = defVal; } + ~SafeUnitPointer(); + void SetPointedTo(Unit* u); + void UnitDeleted(); + Unit* operator->() const { return ptr; } + void operator=(Unit* u) { SetPointedTo(u); } + operator Unit*() const { return ptr; } private: - Unit* ptr; - Unit* defaultValue; + Unit* ptr; + Unit* defaultValue; }; class Unit : public WorldObject @@ -1440,14 +1440,14 @@ class Unit : public WorldObject void CombatStopWithPets(bool includingCast = false); void StopAttackFaction(uint32 faction_id); Unit* SelectNearbyTarget(Unit* exclude = NULL, float dist = NOMINAL_MELEE_RANGE) const; - Unit* SelectNearbyNoTotemTarget(Unit* exclude = NULL, float dist = NOMINAL_MELEE_RANGE) const; + Unit* SelectNearbyNoTotemTarget(Unit* exclude = NULL, float dist = NOMINAL_MELEE_RANGE) const; void SendMeleeAttackStop(Unit* victim = NULL); void SendMeleeAttackStart(Unit* victim, Player* sendTo = NULL); void AddUnitState(uint32 f) { m_state |= f; } bool HasUnitState(const uint32 f) const { return (m_state & f); } void ClearUnitState(uint32 f) { m_state &= ~f; } - uint32 GetUnitState() const { return m_state; } + uint32 GetUnitState() const { return m_state; } bool CanFreeMove() const { return !HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING | UNIT_STATE_IN_FLIGHT | @@ -1456,7 +1456,7 @@ class Unit : public WorldObject uint32 HasUnitTypeMask(uint32 mask) const { return mask & m_unitTypeMask; } void AddUnitTypeMask(uint32 mask) { m_unitTypeMask |= mask; } - uint32 GetUnitTypeMask() const { return m_unitTypeMask; } + uint32 GetUnitTypeMask() const { return m_unitTypeMask; } bool IsSummon() const { return m_unitTypeMask & UNIT_MASK_SUMMON; } bool IsGuardian() const { return m_unitTypeMask & UNIT_MASK_GUARDIAN; } bool IsPet() const { return m_unitTypeMask & UNIT_MASK_PET; } @@ -1481,7 +1481,7 @@ class Unit : public WorldObject uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES+school); } uint32 GetResistance(SpellSchoolMask mask) const; void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES+school, val); } - static float GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = NULL); + static float GetEffectiveResistChance(Unit const* owner, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = NULL); uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); } uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); } @@ -1494,7 +1494,7 @@ class Unit : public WorldObject float GetHealthPct() const { return GetMaxHealth() ? 100.f * GetHealth() / GetMaxHealth() : 0.0f; } uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePct(GetMaxHealth(), pct); } uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePct(GetHealth(), pct); } - float GetPowerPct(Powers power) const { return GetMaxPower(power) ? 100.f * GetPower(power) / GetMaxPower(power) : 0.0f; } + float GetPowerPct(Powers power) const { return GetMaxPower(power) ? 100.f * GetPower(power) / GetMaxPower(power) : 0.0f; } void SetHealth(uint32 val); void SetMaxHealth(uint32 val); @@ -1547,7 +1547,7 @@ class Unit : public WorldObject return false; } - bool IsInSanctuary() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); } + bool IsInSanctuary() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); } bool IsPvP() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); } bool IsFFAPvP() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); } void SetPvP(bool state) @@ -1698,7 +1698,7 @@ class Unit : public WorldObject void SetInCombatState(bool PvP, Unit* enemy = NULL, uint32 duration = 0); void SetInCombatWith(Unit* enemy, uint32 duration = 0); void ClearInCombat(); - void ClearInPetCombat(); + void ClearInPetCombat(); uint32 GetCombatTimer() const { return m_CombatTimer; } bool HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint32 familyFlags) const; @@ -1757,7 +1757,7 @@ class Unit : public WorldObject void SendAttackStateUpdate(CalcDamageInfo* damageInfo); void SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount); void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage* log); - void SendSpellNonMeleeReflectLog(SpellNonMeleeDamage* log, Unit* attacker); + void SendSpellNonMeleeReflectLog(SpellNonMeleeDamage* log, Unit* attacker); void SendSpellNonMeleeDamageLog(Unit* target, uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false); void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo); void SendSpellMiss(Unit* target, uint32 spellID, SpellMissInfo missInfo); @@ -1792,10 +1792,10 @@ class Unit : public WorldObject virtual bool SetFeatherFall(bool enable, bool packetOnly = false); virtual bool SetHover(bool enable, bool packetOnly = false); - // pussywizard: - void SendMovementWaterWalking(Player* sendTo); - void SendMovementFeatherFall(Player* sendTo); - void SendMovementHover(Player* sendTo); + // pussywizard: + void SendMovementWaterWalking(Player* sendTo); + void SendMovementFeatherFall(Player* sendTo); + void SendMovementHover(Player* sendTo); void SetInFront(WorldObject const* target); void SetFacingTo(float ori); @@ -1817,7 +1817,7 @@ class Unit : public WorldObject virtual void setDeathState(DeathState s, bool despawn = false); // overwrited in Creature/Player/Pet uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); } - void SetOwnerGUID(uint64 owner); + void SetOwnerGUID(uint64 owner); uint64 GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY); } void SetCreatorGUID(uint64 creator) { SetUInt64Value(UNIT_FIELD_CREATEDBY, creator); } uint64 GetMinionGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); } @@ -1831,7 +1831,7 @@ class Unit : public WorldObject uint64 GetCritterGUID() const { return GetUInt64Value(UNIT_FIELD_CRITTER); } bool IsControlledByPlayer() const { return m_ControlledByPlayer; } - bool IsCreatedByPlayer() const { return m_CreatedByPlayer; } + bool IsCreatedByPlayer() const { return m_CreatedByPlayer; } uint64 GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); } uint64 GetCharmerOrOwnerOrOwnGUID() const { @@ -1945,7 +1945,7 @@ class Unit : public WorldObject void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID); void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except=0); void RemoveMovementImpairingAuras(bool withRoot); - void RemoveAurasByShapeShift(); + void RemoveAurasByShapeShift(); void RemoveAreaAurasDueToLeaveWorld(); void RemoveAllAuras(); @@ -1968,7 +1968,7 @@ class Unit : public WorldObject AuraEffect* GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; // spell mustn't have familyflags AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0) const; - AuraEffect * GetAuraEffectDummy(uint32 spellid) const; + AuraEffect * GetAuraEffectDummy(uint32 spellid) const; inline AuraEffect* GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const { return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex);} AuraApplication * GetAuraApplication(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; @@ -1988,7 +1988,7 @@ class Unit : public WorldObject bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const; bool HasAuraTypeWithValue(AuraType auratype, int32 value) const; bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0); - bool HasVisibleAuraType(AuraType auraType) const; + bool HasVisibleAuraType(AuraType auraType) const; bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0); bool HasAuraWithMechanic(uint32 mechanicMask) const; @@ -1996,7 +1996,7 @@ class Unit : public WorldObject uint32 GetDiseasesByCaster(uint64 casterGUID, uint8 mode = 0); uint32 GetDoTsByCaster(uint64 casterGUID) const; - int32 GetTotalAuraModifierAreaExclusive(AuraType auratype) const; + int32 GetTotalAuraModifierAreaExclusive(AuraType auratype) const; int32 GetTotalAuraModifier(AuraType auratype) const; float GetTotalAuraMultiplier(AuraType auratype) const; int32 GetMaxPositiveAuraModifier(AuraType auratype); @@ -2124,7 +2124,7 @@ class Unit : public WorldObject // Visibility system bool IsVisible() const { return (m_serverSideVisibility.GetValue(SERVERSIDE_VISIBILITY_GM) > SEC_PLAYER) ? false : true; } void SetVisible(bool x); - void SetModelVisible(bool on); + void SetModelVisible(bool on); // common function for visibility checks for player/creatures with detection code void SetPhaseMask(uint32 newPhaseMask, bool update);// overwrite WorldObject::SetPhaseMask @@ -2204,8 +2204,8 @@ class Unit : public WorldObject bool isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK); bool isBlockCritical(); - float SpellDoneCritChance(Unit const* /*victim*/, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const; - float SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const; + float SpellDoneCritChance(Unit const* /*victim*/, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const; + float SpellTakenCritChance(Unit const* caster, SpellInfo const* spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const; static uint32 SpellCriticalDamageBonus(Unit const* caster, SpellInfo const* spellProto, uint32 damage, Unit const* victim); static uint32 SpellCriticalHealingBonus(Unit const* caster, SpellInfo const* spellProto, uint32 damage, Unit const* victim); @@ -2227,8 +2227,8 @@ class Unit : public WorldObject bool IsImmunedToDamage(SpellInfo const* spellInfo) const; bool IsImmunedToSchool(SpellSchoolMask meleeSchoolMask) const; bool IsImmunedToSchool(SpellInfo const* spellInfo) const; - bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const; - bool IsImmunedToDamageOrSchool(SpellInfo const* spellInfo) const; + bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const; + bool IsImmunedToDamageOrSchool(SpellInfo const* spellInfo) const; virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; // redefined in Creature static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS); @@ -2272,8 +2272,8 @@ class Unit : public WorldObject void SetExtraUnitMovementFlags(uint16 f) { m_movementInfo.flags2 = f; } void SetControlled(bool apply, UnitState state); - void DisableRotate(bool apply); - void DisableSpline(); + void DisableRotate(bool apply); + void DisableSpline(); void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); } void RemoveComboPointHolder(uint32 lowguid) { m_ComboPointHolders.erase(lowguid); } @@ -2339,7 +2339,7 @@ class Unit : public WorldObject TransportBase* GetDirectTransport() const; bool m_ControlledByPlayer; - bool m_CreatedByPlayer; + bool m_CreatedByPlayer; bool HandleSpellClick(Unit* clicker, int8 seatId = -1); void EnterVehicle(Unit* base, int8 seatId = -1); @@ -2357,9 +2357,9 @@ class Unit : public WorldObject bool isTurning() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_TURNING); } virtual bool CanFly() const = 0; bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_DISABLE_GRAVITY); } - bool IsHovering() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_HOVER); } + bool IsHovering() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_HOVER); } bool IsFalling() const; - float GetHoverHeight() const { return IsHovering() ? GetFloatValue(UNIT_FIELD_HOVERHEIGHT) : 0.0f; } + float GetHoverHeight() const { return IsHovering() ? GetFloatValue(UNIT_FIELD_HOVERHEIGHT) : 0.0f; } void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker); @@ -2374,60 +2374,60 @@ class Unit : public WorldObject TempSummon* ToTempSummon() { if (IsSummon()) return reinterpret_cast(this); else return NULL; } const TempSummon* ToTempSummon() const { if (IsSummon()) return reinterpret_cast(this); else return NULL; } - // pussywizard: - // MMaps - std::map m_targetsNotAcceptable; - bool isTargetNotAcceptableByMMaps(uint64 guid, uint32 currTime, const Position* t = NULL) const { std::map::const_iterator itr = m_targetsNotAcceptable.find(guid); if (itr != m_targetsNotAcceptable.end() && (itr->second._endTime >= currTime || t && !itr->second.PosChanged(*this, *t))) return true; return false; } - uint32 m_mmapNotAcceptableStartTime; - // Safe mover - std::set SafeUnitPointerSet; - void AddPointedBy(SafeUnitPointer* sup) { SafeUnitPointerSet.insert(sup); } - void RemovePointedBy(SafeUnitPointer* sup) { SafeUnitPointerSet.erase(sup); } - static void HandleSafeUnitPointersOnDelete(Unit* thisUnit); - // Relocation Nofier optimization - Position m_last_notify_position; - uint32 m_last_notify_mstime; - uint16 m_delayed_unit_relocation_timer; - uint16 m_delayed_unit_ai_notify_timer; - bool bRequestForcedVisibilityUpdate; - void ExecuteDelayedUnitRelocationEvent(); - void ExecuteDelayedUnitAINotifyEvent(); - // IsInWater, UpdateUnderwaterState, etc. optimizations - Position m_last_underwaterstate_position; - Position m_last_environment_position; - bool m_last_isinwater_status; - bool m_last_islittleabovewater_status; - bool m_last_isunderwater_status; - bool m_is_updating_environment; - // GetZone / GetArea optimization - Position m_last_area_position; - Position m_last_zone_position; - uint32 m_last_area_id; - uint32 m_last_zone_id; - Position m_last_outdoors_position; - bool m_last_outdoors_status; - bool IsOutdoors() const; + // pussywizard: + // MMaps + std::map m_targetsNotAcceptable; + bool isTargetNotAcceptableByMMaps(uint64 guid, uint32 currTime, const Position* t = NULL) const { std::map::const_iterator itr = m_targetsNotAcceptable.find(guid); if (itr != m_targetsNotAcceptable.end() && (itr->second._endTime >= currTime || t && !itr->second.PosChanged(*this, *t))) return true; return false; } + uint32 m_mmapNotAcceptableStartTime; + // Safe mover + std::set SafeUnitPointerSet; + void AddPointedBy(SafeUnitPointer* sup) { SafeUnitPointerSet.insert(sup); } + void RemovePointedBy(SafeUnitPointer* sup) { SafeUnitPointerSet.erase(sup); } + static void HandleSafeUnitPointersOnDelete(Unit* thisUnit); + // Relocation Nofier optimization + Position m_last_notify_position; + uint32 m_last_notify_mstime; + uint16 m_delayed_unit_relocation_timer; + uint16 m_delayed_unit_ai_notify_timer; + bool bRequestForcedVisibilityUpdate; + void ExecuteDelayedUnitRelocationEvent(); + void ExecuteDelayedUnitAINotifyEvent(); + // IsInWater, UpdateUnderwaterState, etc. optimizations + Position m_last_underwaterstate_position; + Position m_last_environment_position; + bool m_last_isinwater_status; + bool m_last_islittleabovewater_status; + bool m_last_isunderwater_status; + bool m_is_updating_environment; + // GetZone / GetArea optimization + Position m_last_area_position; + Position m_last_zone_position; + uint32 m_last_area_id; + uint32 m_last_zone_id; + Position m_last_outdoors_position; + bool m_last_outdoors_status; + bool IsOutdoors() const; - uint32 GetZoneId(bool forceRecalc = false) const; + uint32 GetZoneId(bool forceRecalc = false) const; uint32 GetAreaId(bool forceRecalc = false) const; void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, bool forceRecalc = false) const; - // cooldowns - virtual bool HasSpellCooldown(uint32 /*spell_id*/) const { return false; } - virtual bool HasSpellItemCooldown(uint32 /*spell_id*/, uint32 /*itemid*/) const { return false; } - virtual void AddSpellCooldown(uint32 /*spell_id*/, uint32 /*itemid*/, uint32 /*end_time*/, bool needSendToClient = false, bool forceSendToSpectator = false) {} + // cooldowns + virtual bool HasSpellCooldown(uint32 /*spell_id*/) const { return false; } + virtual bool HasSpellItemCooldown(uint32 /*spell_id*/, uint32 /*itemid*/) const { return false; } + virtual void AddSpellCooldown(uint32 /*spell_id*/, uint32 /*itemid*/, uint32 /*end_time*/, bool needSendToClient = false, bool forceSendToSpectator = false) {} - bool CanApplyResilience() const { return m_applyResilience; } + bool CanApplyResilience() const { return m_applyResilience; } - void PetSpellFail(const SpellInfo* spellInfo, Unit* target, uint32 result); + void PetSpellFail(const SpellInfo* spellInfo, Unit* target, uint32 result); - int32 CalculateAOEDamageReduction(int32 damage, uint32 schoolMask, Unit* caster) const; + int32 CalculateAOEDamageReduction(int32 damage, uint32 schoolMask, Unit* caster) const; uint64 GetTarget() const { return GetUInt64Value(UNIT_FIELD_TARGET); } virtual void SetTarget(uint64 /*guid*/) = 0; - void SetInstantCast(bool set) { _instantCast = set; } - bool CanInstantCast() const { return _instantCast; } + void SetInstantCast(bool set) { _instantCast = set; } + bool CanInstantCast() const { return _instantCast; } // Movement info Movement::MoveSpline * movespline; @@ -2496,8 +2496,8 @@ class Unit : public WorldObject int32 m_regenTimer; ThreatManager m_ThreatManager; - typedef std::map CharmThreatMap; - CharmThreatMap _charmThreatInfo; + typedef std::map CharmThreatMap; + CharmThreatMap _charmThreatInfo; Vehicle* m_vehicle; Vehicle* m_vehicleKit; @@ -2505,11 +2505,11 @@ class Unit : public WorldObject uint32 m_unitTypeMask; LiquidTypeEntry const* _lastLiquid; - // xinef: apply resilience - bool m_applyResilience; + // xinef: apply resilience + bool m_applyResilience; bool IsAlwaysVisibleFor(WorldObject const* seer) const; bool IsAlwaysDetectableFor(WorldObject const* seer) const; - bool _instantCast; + bool _instantCast; private: bool IsTriggeredAtSpellProcEvent(Unit* victim, Aura * aura, SpellInfo const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent, ProcEventInfo const& eventInfo); @@ -2619,30 +2619,30 @@ class ConflagrateAuraStateDelayEvent : public BasicEvent private: uint64 m_owner; - uint64 m_caster; + uint64 m_caster; }; class RedirectSpellEvent : public BasicEvent { - public: - RedirectSpellEvent(Unit& self, uint64 auraOwnerGUID, AuraEffect* auraEffect) : _self(self), _auraOwnerGUID(auraOwnerGUID), _auraEffect(auraEffect) { } - bool Execute(uint64 e_time, uint32 p_time); + public: + RedirectSpellEvent(Unit& self, uint64 auraOwnerGUID, AuraEffect* auraEffect) : _self(self), _auraOwnerGUID(auraOwnerGUID), _auraEffect(auraEffect) { } + bool Execute(uint64 e_time, uint32 p_time); - protected: - Unit& _self; - uint64 _auraOwnerGUID; - AuraEffect* _auraEffect; + protected: + Unit& _self; + uint64 _auraOwnerGUID; + AuraEffect* _auraEffect; }; class VehicleDespawnEvent : public BasicEvent { - public: - VehicleDespawnEvent(Unit& self, uint32 duration) : _self(self), _duration(duration) { } - bool Execute(uint64 e_time, uint32 p_time); + public: + VehicleDespawnEvent(Unit& self, uint32 duration) : _self(self), _duration(duration) { } + bool Execute(uint64 e_time, uint32 p_time); - protected: - Unit& _self; - uint32 _duration; + protected: + Unit& _self; + uint32 _duration; }; #endif diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 029055853..f9928d49c 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -47,9 +47,9 @@ _me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntr } } - // Ulduar demolisher - if (vehInfo->m_ID == 338) - ++_usableSeatNum; + // Ulduar demolisher + if (vehInfo->m_ID == 338) + ++_usableSeatNum; InitMovementInfoForBase(); } @@ -60,16 +60,16 @@ Vehicle::~Vehicle() ASSERT(_status == STATUS_UNINSTALLING); for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr) - if (itr->second.Passenger.Guid) - { - if (Unit* unit = ObjectAccessor::FindUnit(itr->second.Passenger.Guid)) - { - sLog->outString("ZOMG! ~Vehicle(), unit: %s, entry: %u, typeid: %u, this_entry: %u, this_typeid: %u!", unit->GetName().c_str(), unit->GetEntry(), unit->GetTypeId(), _me ? _me->GetEntry() : 0, _me ? _me->GetTypeId() : 0); - unit->_ExitVehicle(); - } - else - sLog->outString("ZOMG! ~Vehicle(), unknown guid!"); - } + if (itr->second.Passenger.Guid) + { + if (Unit* unit = ObjectAccessor::FindUnit(itr->second.Passenger.Guid)) + { + sLog->outString("ZOMG! ~Vehicle(), unit: %s, entry: %u, typeid: %u, this_entry: %u, this_typeid: %u!", unit->GetName().c_str(), unit->GetEntry(), unit->GetTypeId(), _me ? _me->GetEntry() : 0, _me ? _me->GetTypeId() : 0); + unit->_ExitVehicle(); + } + else + sLog->outString("ZOMG! ~Vehicle(), unknown guid!"); + } //ASSERT(!itr->second.IsEmpty()); } @@ -162,8 +162,8 @@ void Vehicle::ApplyAllImmunities() //_me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_UNATTACKABLE, true); _me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SHIELD, true); _me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_IMMUNE_SHIELD, true); - if (_me->GetZoneId() == BATTLEFIELD_WG_ZONEID || _me->ToCreature()->GetDBTableGUIDLow() || (_me->FindMap() && _me->FindMap()->Instanceable())) - _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_SCHOOL_ABSORB, true); + if (_me->GetZoneId() == BATTLEFIELD_WG_ZONEID || _me->ToCreature()->GetDBTableGUIDLow() || (_me->FindMap() && _me->FindMap()->Instanceable())) + _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_SCHOOL_ABSORB, true); // ... Resistance, Split damage, Change stats ... _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_DAMAGE_SHIELD, true); @@ -171,9 +171,9 @@ void Vehicle::ApplyAllImmunities() _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_RESISTANCE, true); _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_STAT, true); - // Taunt - _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - _me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); + // Taunt + _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + _me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); } // Different immunities for vehicles goes below @@ -191,13 +191,13 @@ void Vehicle::ApplyAllImmunities() //me->m_movementInfo.flags2=59; _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_DECREASE_SPEED, true); break; - // Ulduar vehicles, remove immunities used in flame leviathan spells - case 335: - case 336: - case 338: - _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, false); - _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_SCHOOL_ABSORB, false); - break; + // Ulduar vehicles, remove immunities used in flame leviathan spells + case 335: + case 336: + case 338: + _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, false); + _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_SCHOOL_ABSORB, false); + break; default: break; } @@ -224,7 +224,7 @@ bool Vehicle::HasEmptySeat(int8 seatId) const SeatMap::const_iterator seat = Seats.find(seatId); if (seat == Seats.end()) return false; - return seat->second.IsEmpty(); + return seat->second.IsEmpty(); } Unit* Vehicle::GetPassenger(int8 seatId) const @@ -233,7 +233,7 @@ Unit* Vehicle::GetPassenger(int8 seatId) const if (seat == Seats.end()) return NULL; - return ObjectAccessor::GetUnit(*GetBase(), seat->second.Passenger.Guid); + return ObjectAccessor::GetUnit(*GetBase(), seat->second.Passenger.Guid); } int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const @@ -325,7 +325,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) if (seatId < 0) // no specific seat requirement { for (seat = Seats.begin(); seat != Seats.end(); ++seat) - if (seat->second.IsEmpty() && (seat->second.SeatInfo->CanEnterOrExit() || seat->second.SeatInfo->IsUsableByOverride())) + if (seat->second.IsEmpty() && (seat->second.SeatInfo->CanEnterOrExit() || seat->second.SeatInfo->IsUsableByOverride())) break; if (seat == Seats.end()) // no available seat @@ -339,13 +339,13 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) if (!seat->second.IsEmpty()) { - if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), seat->second.Passenger.Guid)) + if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), seat->second.Passenger.Guid)) passenger->ExitVehicle(); - seat->second.Passenger.Guid = 0; + seat->second.Passenger.Guid = 0; } - ASSERT(seat->second.IsEmpty()); + ASSERT(seat->second.IsEmpty()); } ;//sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s enter vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); @@ -353,7 +353,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) seat->second.Passenger.Guid = unit->GetGUID(); seat->second.Passenger.IsUnselectable = unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (seat->second.SeatInfo->CanEnterOrExit()) + if (seat->second.SeatInfo->CanEnterOrExit()) { ASSERT(_usableSeatNum); --_usableSeatNum; @@ -366,12 +366,12 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) } } - if (!_me->IsInWorld() || _me->IsDuringRemoveFromWorld()) - return false; + if (!_me->IsInWorld() || _me->IsDuringRemoveFromWorld()) + return false; - // Xinef: moved from unit.cpp, if aura passes seatId == -1 (choose automaticly) we wont get appropriate flags - if (unit->GetTypeId() == TYPEID_PLAYER && !(seat->second.SeatInfo->m_flagsB & VEHICLE_SEAT_FLAG_B_KEEP_PET)) - unit->ToPlayer()->UnsummonPetTemporaryIfAny(); + // Xinef: moved from unit.cpp, if aura passes seatId == -1 (choose automaticly) we wont get appropriate flags + if (unit->GetTypeId() == TYPEID_PLAYER && !(seat->second.SeatInfo->m_flagsB & VEHICLE_SEAT_FLAG_B_KEEP_PET)) + unit->ToPlayer()->UnsummonPetTemporaryIfAny(); if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE) unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -383,30 +383,30 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) unit->m_movementInfo.transport.seat = seat->first; unit->m_movementInfo.transport.guid = _me->GetGUID(); - // xinef: removed retarded seat->first == 0 check... - if (_me->GetTypeId() == TYPEID_UNIT - && unit->GetTypeId() == TYPEID_PLAYER - && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) - { - try - { - if (!_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE)) - ASSERT(false); - } - catch (...) - { - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy()!"); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). not null: %u, this not null: %u", _me ? 1 : 0, this ? 1 : 0); - if (!_me || !this) - return false; - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is: %u!", _me->IsInWorld()); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is2: %u!", _me->IsDuringRemoveFromWorld()); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s!", _me->GetName().c_str()); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). typeid: %u!", _me->GetTypeId()); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s, typeid: %u, in world: %u, duringremove: %u has wrong CharmType! Charmer %s, typeid: %u, in world: %u, duringremove: %u.", _me->GetName().c_str(), _me->GetTypeId(), _me->IsInWorld(), _me->IsDuringRemoveFromWorld(), unit->GetName().c_str(), unit->GetTypeId(), unit->IsInWorld(), unit->IsDuringRemoveFromWorld()); - return false; - } - } + // xinef: removed retarded seat->first == 0 check... + if (_me->GetTypeId() == TYPEID_UNIT + && unit->GetTypeId() == TYPEID_PLAYER + && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) + { + try + { + if (!_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE)) + ASSERT(false); + } + catch (...) + { + sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy()!"); + sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). not null: %u, this not null: %u", _me ? 1 : 0, this ? 1 : 0); + if (!_me || !this) + return false; + sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is: %u!", _me->IsInWorld()); + sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is2: %u!", _me->IsDuringRemoveFromWorld()); + sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s!", _me->GetName().c_str()); + sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). typeid: %u!", _me->GetTypeId()); + sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s, typeid: %u, in world: %u, duringremove: %u has wrong CharmType! Charmer %s, typeid: %u, in world: %u, duringremove: %u.", _me->GetName().c_str(), _me->GetTypeId(), _me->IsInWorld(), _me->IsDuringRemoveFromWorld(), unit->GetName().c_str(), unit->GetTypeId(), unit->IsInWorld(), unit->IsDuringRemoveFromWorld()); + return false; + } + } if (_me->IsInWorld()) { @@ -416,15 +416,15 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) Movement::MoveSplineInit init(unit); init.DisableTransportPathTransformations(); init.MoveTo(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ); - // Xinef: did not found anything unique in dbc, maybe missed something - if (veSeat->m_ID == 3566 || veSeat->m_ID == 3567 || veSeat->m_ID == 3568 || veSeat->m_ID == 3570) - { - float x = veSeat->m_attachmentOffsetX, y = veSeat->m_attachmentOffsetY, z = veSeat->m_attachmentOffsetZ, o; - CalculatePassengerPosition(x, y, z, &o); - init.SetFacing(_me->GetAngle(x, y)); - } - else - init.SetFacing(0.0f); + // Xinef: did not found anything unique in dbc, maybe missed something + if (veSeat->m_ID == 3566 || veSeat->m_ID == 3567 || veSeat->m_ID == 3568 || veSeat->m_ID == 3570) + { + float x = veSeat->m_attachmentOffsetX, y = veSeat->m_attachmentOffsetY, z = veSeat->m_attachmentOffsetZ, o; + CalculatePassengerPosition(x, y, z, &o); + init.SetFacing(_me->GetAngle(x, y)); + } + else + init.SetFacing(0.0f); init.SetTransportEnter(); init.Launch(); @@ -439,8 +439,8 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnAddPassenger(this, unit, seatId); - // Remove parachute on vehicle switch - unit->RemoveAurasDueToSpell(VEHICLE_SPELL_PARACHUTE); + // Remove parachute on vehicle switch + unit->RemoveAurasDueToSpell(VEHICLE_SPELL_PARACHUTE); return true; } @@ -450,12 +450,12 @@ void Vehicle::RemovePassenger(Unit* unit) return; SeatMap::iterator seat = GetSeatIteratorForPassenger(unit); - // it can happen that unit enters vehicle and removes owner passenger - // then vehicles is dissmised and removes all existing passengers, even the unit (vehicle has aura of unit) - // but the unit is not on the vehicles seat yet, thus crashing at ASSERT(seat != Seats.end()); + // it can happen that unit enters vehicle and removes owner passenger + // then vehicles is dissmised and removes all existing passengers, even the unit (vehicle has aura of unit) + // but the unit is not on the vehicles seat yet, thus crashing at ASSERT(seat != Seats.end()); // ASSERT(seat != Seats.end()); - if (seat == Seats.end()) - return; + if (seat == Seats.end()) + return; ;//sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); @@ -500,7 +500,7 @@ void Vehicle::RelocatePassengers() // not sure that absolute position calculation is correct, it must depend on vehicle pitch angle for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr) { - if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid)) + if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid)) { ASSERT(passenger->IsInWorld()); @@ -524,35 +524,35 @@ void Vehicle::Dismiss() bool Vehicle::IsVehicleInUse() { - for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr) - if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid)) - { - if (passenger->GetTypeId() == TYPEID_PLAYER) - return true; - else if (passenger->GetTypeId() == TYPEID_UNIT && passenger->GetVehicleKit() && passenger->GetVehicleKit()->IsVehicleInUse()) - return true; - } + for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr) + if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid)) + { + if (passenger->GetTypeId() == TYPEID_PLAYER) + return true; + else if (passenger->GetTypeId() == TYPEID_UNIT && passenger->GetVehicleKit() && passenger->GetVehicleKit()->IsVehicleInUse()) + return true; + } - return false; + return false; } void Vehicle::TeleportVehicle(float x, float y, float z, float ang) { - _me->GetMap()->LoadGrid(x, y); - _me->NearTeleportTo(x, y, z, ang, true); - - for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr) - if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid)) - { - if (passenger->GetTypeId() == TYPEID_PLAYER) - { - passenger->ToPlayer()->SetMover(passenger); - passenger->NearTeleportTo(x, y, z, ang, false, true); - passenger->ToPlayer()->ScheduleDelayedOperation(DELAYED_VEHICLE_TELEPORT); - } - else if (passenger->GetTypeId() == TYPEID_UNIT && passenger->GetVehicleKit()) - passenger->GetVehicleKit()->TeleportVehicle(x, y, z, ang); - } + _me->GetMap()->LoadGrid(x, y); + _me->NearTeleportTo(x, y, z, ang, true); + + for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr) + if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid)) + { + if (passenger->GetTypeId() == TYPEID_PLAYER) + { + passenger->ToPlayer()->SetMover(passenger); + passenger->NearTeleportTo(x, y, z, ang, false, true); + passenger->ToPlayer()->ScheduleDelayedOperation(DELAYED_VEHICLE_TELEPORT); + } + else if (passenger->GetTypeId() == TYPEID_UNIT && passenger->GetVehicleKit()) + passenger->GetVehicleKit()->TeleportVehicle(x, y, z, ang); + } } void Vehicle::InitMovementInfoForBase() @@ -575,7 +575,7 @@ VehicleSeatEntry const* Vehicle::GetSeatForPassenger(Unit const* passenger) { SeatMap::iterator itr; for (itr = Seats.begin(); itr != Seats.end(); ++itr) - if (itr->second.Passenger.Guid == passenger->GetGUID()) + if (itr->second.Passenger.Guid == passenger->GetGUID()) return itr->second.SeatInfo; return NULL; @@ -585,7 +585,7 @@ SeatMap::iterator Vehicle::GetSeatIteratorForPassenger(Unit* passenger) { SeatMap::iterator itr; for (itr = Seats.begin(); itr != Seats.end(); ++itr) - if (itr->second.Passenger.Guid == passenger->GetGUID()) + if (itr->second.Passenger.Guid == passenger->GetGUID()) return itr; return Seats.end(); @@ -596,7 +596,7 @@ uint8 Vehicle::GetAvailableSeatCount() const uint8 ret = 0; SeatMap::const_iterator itr; for (itr = Seats.begin(); itr != Seats.end(); ++itr) - if (itr->second.IsEmpty() && (itr->second.SeatInfo->CanEnterOrExit() || itr->second.SeatInfo->IsUsableByOverride())) + if (itr->second.IsEmpty() && (itr->second.SeatInfo->CanEnterOrExit() || itr->second.SeatInfo->IsUsableByOverride())) ++ret; return ret; diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h index 2c95a4b61..f02772957 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.h +++ b/src/server/game/Entities/Vehicle/Vehicle.h @@ -53,12 +53,12 @@ class Vehicle : public TransportBase void RemoveAllPassengers(); void Dismiss(); bool IsVehicleInUse(); - void TeleportVehicle(float x, float y, float z, float ang); + void TeleportVehicle(float x, float y, float z, float ang); SeatMap Seats; VehicleSeatEntry const* GetSeatForPassenger(Unit const* passenger); - SeatMap::iterator GetSeatIteratorForPassenger(Unit* passenger); + SeatMap::iterator GetSeatIteratorForPassenger(Unit* passenger); protected: friend bool Unit::CreateVehicleKit(uint32 id, uint32 creatureEntry); diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h index 3492ca00c..d6406b2d9 100644 --- a/src/server/game/Entities/Vehicle/VehicleDefines.h +++ b/src/server/game/Entities/Vehicle/VehicleDefines.h @@ -52,14 +52,14 @@ enum VehicleSpells VEHICLE_SPELL_RIDE_HARDCODED = 46598, VEHICLE_SPELL_PARACHUTE = 45472, - VEHICLE_SPELL_GEIST_CONTROL_END = 58119, - VEHICLE_SPELL_SHADE_CONTROL_END = 58664 + VEHICLE_SPELL_GEIST_CONTROL_END = 58119, + VEHICLE_SPELL_SHADE_CONTROL_END = 58664 }; enum VehicleNPCs { - NPC_EIDOLON_WATCHER = 31110, - NPC_LITHE_STALKER = 30895 + NPC_EIDOLON_WATCHER = 31110, + NPC_LITHE_STALKER = 30895 }; struct PassengerInfo diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index ea53a5668..6547be36a 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1078,11 +1078,11 @@ uint32 GameEventMgr::Update() // return the next e { //sLog->outDebug("GameEvent %u is not active", itr->first); if (IsActiveEvent(itr)) - { - // Xinef: do not deactivate internal events on whim - if (mGameEvent[itr].state != GAMEEVENT_INTERNAL) - deactivate.insert(itr); - } + { + // Xinef: do not deactivate internal events on whim + if (mGameEvent[itr].state != GAMEEVENT_INTERNAL) + deactivate.insert(itr); + } else { if (!isSystemInit) @@ -1133,7 +1133,7 @@ void GameEventMgr::UnApplyEvent(uint16 event_id) UpdateEventNPCVendor(event_id, false); // update bg holiday UpdateBattlegroundSettings(); - // check for seasonal quest reset. + // check for seasonal quest reset. sWorld->ResetEventSeasonalQuests(event_id); } diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 088b6f5ca..26539ff20 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -175,7 +175,7 @@ Player* ObjectAccessor::FindPlayer(uint64 guid) Player* ObjectAccessor::FindPlayerInOrOutOfWorld(uint64 guid) { - return GetObjectInOrOutOfWorld(guid, (Player*)NULL); + return GetObjectInOrOutOfWorld(guid, (Player*)NULL); } Unit* ObjectAccessor::FindUnit(uint64 guid) @@ -235,21 +235,21 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse, bool final) { ASSERT(corpse && corpse->GetType() != CORPSE_BONES); - if (!final) - { - TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); - Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID()); - if (iter == i_player2corpse.end()) - return; - i_player2corpse.erase(iter); - AddDelayedCorpseAction(corpse, 0); - return; - } + if (!final) + { + TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID()); + if (iter == i_player2corpse.end()) + return; + i_player2corpse.erase(iter); + AddDelayedCorpseAction(corpse, 0); + return; + } //TODO: more works need to be done for corpse and other world object if (Map* map = corpse->FindMap()) { - // xinef: ok, should be called in both cases + // xinef: ok, should be called in both cases corpse->DestroyForNearbyPlayers(); if (corpse->IsInGrid()) map->RemoveFromMap(corpse, false); @@ -329,7 +329,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia // Map can be NULL Map* map = corpse->FindMap(); - bool inWorld = corpse->IsInWorld(); + bool inWorld = corpse->IsInWorld(); // remove corpse from player_guid -> corpse map and from current map RemoveCorpse(corpse); @@ -404,67 +404,67 @@ void ObjectAccessor::RemoveOldCorpses() ConvertCorpseForPlayer(itr->first); } - // pussywizard: for deleting bones - std::list::iterator next2; - TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); - for (std::list::iterator itr = i_playerBones.begin(); itr != i_playerBones.end(); itr = next2) - { - next2 = itr; - ++next2; + // pussywizard: for deleting bones + std::list::iterator next2; + TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + for (std::list::iterator itr = i_playerBones.begin(); itr != i_playerBones.end(); itr = next2) + { + next2 = itr; + ++next2; - Corpse* c = GetObjectInWorld((*itr), (Corpse*)NULL); - if (c) - { - if (!c->IsExpired(now)) - continue; + Corpse* c = GetObjectInWorld((*itr), (Corpse*)NULL); + if (c) + { + if (!c->IsExpired(now)) + continue; - if (Map* map = c->FindMap()) - { - if (c->IsInGrid()) - map->RemoveFromMap(c, false); - else - { - c->DestroyForNearbyPlayers(); - c->RemoveFromWorld(); - c->ResetMap(); - } - } - else - c->RemoveFromWorld(); - } + if (Map* map = c->FindMap()) + { + if (c->IsInGrid()) + map->RemoveFromMap(c, false); + else + { + c->DestroyForNearbyPlayers(); + c->RemoveFromWorld(); + c->ResetMap(); + } + } + else + c->RemoveFromWorld(); + } - i_playerBones.erase(itr); - } + i_playerBones.erase(itr); + } } void ObjectAccessor::AddDelayedCorpseAction(Corpse* corpse, uint8 action, uint32 mapId, uint32 instanceId) { - TRINITY_GUARD(ACE_Thread_Mutex, DelayedCorpseLock); - i_delayedCorpseActions.push_back(DelayedCorpseAction(corpse, action, mapId, instanceId)); + TRINITY_GUARD(ACE_Thread_Mutex, DelayedCorpseLock); + i_delayedCorpseActions.push_back(DelayedCorpseAction(corpse, action, mapId, instanceId)); } void ObjectAccessor::ProcessDelayedCorpseActions() { - TRINITY_GUARD(ACE_Thread_Mutex, DelayedCorpseLock); - for (std::list::iterator itr = i_delayedCorpseActions.begin(); itr != i_delayedCorpseActions.end(); ++itr) - { - DelayedCorpseAction a = (*itr); - switch (a._action) - { - case 0: // remove corpse - RemoveCorpse(a._corpse, true); - break; - case 1: // add bones - if (Map* map = sMapMgr->FindMap(a._mapId, a._instanceId)) - if (!map->IsRemovalGrid(a._corpse->GetPositionX(), a._corpse->GetPositionY())) - { - a._corpse->SetMap(map); - map->AddToMap(a._corpse); - } - break; - } - } - i_delayedCorpseActions.clear(); + TRINITY_GUARD(ACE_Thread_Mutex, DelayedCorpseLock); + for (std::list::iterator itr = i_delayedCorpseActions.begin(); itr != i_delayedCorpseActions.end(); ++itr) + { + DelayedCorpseAction a = (*itr); + switch (a._action) + { + case 0: // remove corpse + RemoveCorpse(a._corpse, true); + break; + case 1: // add bones + if (Map* map = sMapMgr->FindMap(a._mapId, a._instanceId)) + if (!map->IsRemovalGrid(a._corpse->GetPositionX(), a._corpse->GetPositionY())) + { + a._corpse->SetMap(map); + map->AddToMap(a._corpse); + } + break; + } + } + i_delayedCorpseActions.clear(); } void ObjectAccessor::Update(uint32 /*diff*/) diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index 821caf869..1352769d0 100644 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -88,11 +88,11 @@ class HashMapHolder class DelayedCorpseAction { public: - DelayedCorpseAction(Corpse* corpse, uint8 action, uint32 mapId, uint32 instanceId) : _corpse(corpse), _action(action), _mapId(mapId), _instanceId(instanceId) {} - Corpse* _corpse; - uint8 _action; - uint32 _mapId; - uint32 _instanceId; + DelayedCorpseAction(Corpse* corpse, uint8 action, uint32 mapId, uint32 instanceId) : _corpse(corpse), _action(action), _mapId(mapId), _instanceId(instanceId) {} + Corpse* _corpse; + uint8 _action; + uint32 _mapId; + uint32 _instanceId; }; class ObjectAccessor @@ -199,7 +199,7 @@ class ObjectAccessor // ACCESS LIKE THAT IS NOT THREAD SAFE static Pet* FindPet(uint64); static Player* FindPlayer(uint64); - static Player* FindPlayerInOrOutOfWorld(uint64 m_guid); + static Player* FindPlayerInOrOutOfWorld(uint64 m_guid); static Unit* FindUnit(uint64); static Player* FindPlayerByName(std::string const& name, bool checkInWorld = true); static std::map playerNameToPlayerPointer; // pussywizard: optimization diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 4104bf80b..544edecae 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -145,12 +145,12 @@ bool normalizePlayerName(std::string& name) for (size_t i = 1; i < wstr_len; ++i) wstr_buf[i] = wcharToLower(wstr_buf[i]); - // if there's "gm" at the end, uppercase it! - if (wstr_len>=2 && wstr_buf[wstr_len-2]==L'g' && wstr_buf[wstr_len-1]==L'm') - { - wstr_buf[wstr_len-2]=L'G'; - wstr_buf[wstr_len-1]=L'M'; - } + // if there's "gm" at the end, uppercase it! + if (wstr_len>=2 && wstr_buf[wstr_len-2]==L'g' && wstr_buf[wstr_len-1]==L'm') + { + wstr_buf[wstr_len-2]=L'G'; + wstr_buf[wstr_len-1]=L'M'; + } if (!WStrToUtf8(wstr_buf, wstr_len, name)) return false; @@ -518,20 +518,20 @@ void ObjectMgr::LoadCreatureTemplates() } while (result->NextRow()); - // pussywizard: - { - uint32 max = 0; - for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) - if (itr->first > max) - max = itr->first; - if (max) - { - _creatureTemplateStoreFast.clear(); - _creatureTemplateStoreFast.resize(max+1, NULL); - for (CreatureTemplateContainer::iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) - _creatureTemplateStoreFast[itr->first] = &(itr->second); - } - } + // pussywizard: + { + uint32 max = 0; + for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) + if (itr->first > max) + max = itr->first; + if (max) + { + _creatureTemplateStoreFast.clear(); + _creatureTemplateStoreFast.resize(max+1, NULL); + for (CreatureTemplateContainer::iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) + _creatureTemplateStoreFast[itr->first] = &(itr->second); + } + } // Checking needs to be done after loading because of the difficulty self referencing for (CreatureTemplateContainer::iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) @@ -730,11 +730,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) cInfo->Entry, cInfo->VehicleId, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->VehicleId); } - // Xinef: check dmg school - if (cInfo->dmgschool != difficultyInfo->dmgschool) - { - sLog->outErrorDb("Creature (Entry: %u) has different `dmgschool` in difficulty %u mode (Entry: %u)", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); - } + // Xinef: check dmg school + if (cInfo->dmgschool != difficultyInfo->dmgschool) + { + sLog->outErrorDb("Creature (Entry: %u) has different `dmgschool` in difficulty %u mode (Entry: %u)", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + } if (!difficultyInfo->AIName.empty()) { @@ -1000,7 +1000,7 @@ void ObjectMgr::LoadCreatureAddons() Tokenizer tokens(fields[6].GetString(), ' '); uint8 i = 0; creatureAddon.auras.resize(tokens.size()); - for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr) + for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr) { SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); if (!AdditionalSpellInfo) @@ -1044,7 +1044,7 @@ void ObjectMgr::LoadGameObjectAddons() if (!result) { sLog->outString(">> Loaded 0 gameobject addon definitions. DB table `gameobject_addon` is empty."); - sLog->outString(); + sLog->outString(); return; } @@ -1075,7 +1075,7 @@ void ObjectMgr::LoadGameObjectAddons() if (gameObjectAddon.invisibilityType && !gameObjectAddon.InvisibilityValue) { - sLog->outErrorDb("GameObject (GUID: %u) has InvisibilityType set but has no InvisibilityValue in `gameobject_addon`, set to 1", guid); + sLog->outErrorDb("GameObject (GUID: %u) has InvisibilityType set but has no InvisibilityValue in `gameobject_addon`, set to 1", guid); gameObjectAddon.InvisibilityValue = 1; } @@ -1084,7 +1084,7 @@ void ObjectMgr::LoadGameObjectAddons() while (result->NextRow()); sLog->outString(">> Loaded %u gameobject addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outString(); } GameObjectAddon const* ObjectMgr::GetGameObjectAddon(uint32 lowguid) @@ -1170,7 +1170,7 @@ void ObjectMgr::LoadEquipmentTemplates() uint8 id = fields[1].GetUInt8(); if (!id) { - sLog->outError("Creature equipment template with id 0 found for creature %u, skipped.", entry); + sLog->outError("Creature equipment template with id 0 found for creature %u, skipped.", entry); continue; } @@ -2152,48 +2152,48 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data uint64 ObjectMgr::GetPlayerGUIDByName(std::string const& name) const { - // Get data from global storage - if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(name)) - return MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); - return 0; + // Get data from global storage + if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(name)) + return MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); + return 0; } bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string &name) const { - // Get data from global storage - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) - { - name = playerData->name; - return true; - } + // Get data from global storage + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) + { + name = playerData->name; + return true; + } return false; } TeamId ObjectMgr::GetPlayerTeamIdByGUID(uint64 guid) const { - // xinef: Get data from global storage - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) - return Player::TeamIdForRace(playerData->race); + // xinef: Get data from global storage + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) + return Player::TeamIdForRace(playerData->race); return TEAM_NEUTRAL; } uint32 ObjectMgr::GetPlayerAccountIdByGUID(uint64 guid) const { - // xinef: Get data from global storage - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) - return playerData->accountId; + // xinef: Get data from global storage + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) + return playerData->accountId; return 0; } uint32 ObjectMgr::GetPlayerAccountIdByPlayerName(const std::string& name) const { - // Get data from global storage - if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(name)) - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow)) - return playerData->accountId; + // Get data from global storage + if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(name)) + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow)) + return playerData->accountId; return 0; } @@ -2797,48 +2797,48 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.HolidayId = 0; } - if (itemTemplate.FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME && !itemTemplate.Duration) + if (itemTemplate.FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME && !itemTemplate.Duration) { sLog->outErrorDb("Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry); itemTemplate.FlagsCu &= ~ITEM_FLAGS_CU_DURATION_REAL_TIME; } - // Fill categories map - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - if (itemTemplate.Spells[i].SpellId && itemTemplate.Spells[i].SpellCategory && itemTemplate.Spells[i].SpellCategoryCooldown) - { - SpellCategoryStore::const_iterator ct = sSpellsByCategoryStore.find(itemTemplate.Spells[i].SpellCategory); - if (ct != sSpellsByCategoryStore.end()) - { - const SpellCategorySet& ct_set = ct->second; - if (ct_set.find(itemTemplate.Spells[i].SpellId) == ct_set.end()) - sSpellsByCategoryStore[itemTemplate.Spells[i].SpellCategory].insert(itemTemplate.Spells[i].SpellId); - } - else - sSpellsByCategoryStore[itemTemplate.Spells[i].SpellCategory].insert(itemTemplate.Spells[i].SpellId); - } + // Fill categories map + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + if (itemTemplate.Spells[i].SpellId && itemTemplate.Spells[i].SpellCategory && itemTemplate.Spells[i].SpellCategoryCooldown) + { + SpellCategoryStore::const_iterator ct = sSpellsByCategoryStore.find(itemTemplate.Spells[i].SpellCategory); + if (ct != sSpellsByCategoryStore.end()) + { + const SpellCategorySet& ct_set = ct->second; + if (ct_set.find(itemTemplate.Spells[i].SpellId) == ct_set.end()) + sSpellsByCategoryStore[itemTemplate.Spells[i].SpellCategory].insert(itemTemplate.Spells[i].SpellId); + } + else + sSpellsByCategoryStore[itemTemplate.Spells[i].SpellCategory].insert(itemTemplate.Spells[i].SpellId); + } ++count; } while (result->NextRow()); - // pussywizard: - { - uint32 max = 0; - for (ItemTemplateContainer::const_iterator itr = _itemTemplateStore.begin(); itr != _itemTemplateStore.end(); ++itr) - if (itr->first > max) - max = itr->first; - if (max) - { - _itemTemplateStoreFast.clear(); - _itemTemplateStoreFast.resize(max+1, NULL); - for (ItemTemplateContainer::iterator itr = _itemTemplateStore.begin(); itr != _itemTemplateStore.end(); ++itr) - _itemTemplateStoreFast[itr->first] = &(itr->second); - } - } + // pussywizard: + { + uint32 max = 0; + for (ItemTemplateContainer::const_iterator itr = _itemTemplateStore.begin(); itr != _itemTemplateStore.end(); ++itr) + if (itr->first > max) + max = itr->first; + if (max) + { + _itemTemplateStoreFast.clear(); + _itemTemplateStoreFast.resize(max+1, NULL); + for (ItemTemplateContainer::iterator itr = _itemTemplateStore.begin(); itr != _itemTemplateStore.end(); ++itr) + _itemTemplateStoreFast[itr->first] = &(itr->second); + } + } - for (ItemTemplateContainer::iterator itr = _itemTemplateStore.begin(); itr != _itemTemplateStore.end(); ++itr) - itr->second.InitializeQueryData(); + for (ItemTemplateContainer::iterator itr = _itemTemplateStore.begin(); itr != _itemTemplateStore.end(); ++itr) + itr->second.InitializeQueryData(); // Check if item templates for DBC referenced character start outfit are present std::set notFoundOutfit; @@ -3912,23 +3912,23 @@ void ObjectMgr::LoadQuests() _questTemplates[newQuest->GetQuestId()] = newQuest; } while (result->NextRow()); - // pussywizard: - { - uint32 max = 0; - for (QuestMap::const_iterator itr = _questTemplates.begin(); itr != _questTemplates.end(); ++itr) - if (itr->first > max) - max = itr->first; - if (max) - { - _questTemplatesFast.clear(); - _questTemplatesFast.resize(max+1, NULL); - for (QuestMap::iterator itr = _questTemplates.begin(); itr != _questTemplates.end(); ++itr) - _questTemplatesFast[itr->first] = itr->second; - } - } + // pussywizard: + { + uint32 max = 0; + for (QuestMap::const_iterator itr = _questTemplates.begin(); itr != _questTemplates.end(); ++itr) + if (itr->first > max) + max = itr->first; + if (max) + { + _questTemplatesFast.clear(); + _questTemplatesFast.resize(max+1, NULL); + for (QuestMap::iterator itr = _questTemplates.begin(); itr != _questTemplates.end(); ++itr) + _questTemplatesFast[itr->first] = itr->second; + } + } - for (QuestMap::iterator itr = _questTemplates.begin(); itr != _questTemplates.end(); ++itr) - itr->second->InitializeQueryData(); + for (QuestMap::iterator itr = _questTemplates.begin(); itr != _questTemplates.end(); ++itr) + itr->second->InitializeQueryData(); std::map usedMailTemplates; @@ -4501,7 +4501,7 @@ void ObjectMgr::LoadQuests() sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have specialflag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id); // this will prevent quest completing without objective - // xinef: remove this, leave error but do not break the quest + // xinef: remove this, leave error but do not break the quest // const_cast(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT); } } @@ -4762,7 +4762,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) continue; } - uint32 entry = tmp.TempSummonCreature.CreatureEntry; + uint32 entry = tmp.TempSummonCreature.CreatureEntry; if (!GetCreatureTemplate(entry)) { sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", @@ -5099,14 +5099,14 @@ void ObjectMgr::ValidateSpellScripts() void ObjectMgr::InitializeSpellInfoPrecomputedData() { - uint32 limit = sSpellStore.GetNumRows(); - for(uint32 i=0; i<=limit; ++i) - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i)) - { - const_cast(spellInfo)->SetStackableWithRanks(spellInfo->ComputeIsStackableWithRanks()); - const_cast(spellInfo)->SetCritCapable(spellInfo->ComputeIsCritCapable()); - const_cast(spellInfo)->SetSpellValid(SpellMgr::ComputeIsSpellValid(spellInfo, false)); - } + uint32 limit = sSpellStore.GetNumRows(); + for(uint32 i=0; i<=limit; ++i) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i)) + { + const_cast(spellInfo)->SetStackableWithRanks(spellInfo->ComputeIsStackableWithRanks()); + const_cast(spellInfo)->SetCritCapable(spellInfo->ComputeIsCritCapable()); + const_cast(spellInfo)->SetSpellValid(SpellMgr::ComputeIsSpellValid(spellInfo, false)); + } } void ObjectMgr::LoadPageTexts() @@ -5500,9 +5500,9 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) CharacterDatabase.Execute(stmt); } - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID); - stmt->setUInt32(0, m->messageID); - CharacterDatabase.Execute(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID); + stmt->setUInt32(0, m->messageID); + CharacterDatabase.Execute(stmt); } else { @@ -5529,9 +5529,9 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) CharacterDatabase.Execute(stmt); } - // xinef: update global data - sWorld->UpdateGlobalPlayerMails(m->sender, 1); - sWorld->UpdateGlobalPlayerMails(m->receiver, -1); + // xinef: update global data + sWorld->UpdateGlobalPlayerMails(m->sender, 1); + sWorld->UpdateGlobalPlayerMails(m->receiver, -1); delete m; ++returnedCount; @@ -5539,8 +5539,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) } } - // xinef: update global data - sWorld->UpdateGlobalPlayerMails(m->receiver, -1); + // xinef: update global data + sWorld->UpdateGlobalPlayerMails(m->receiver, -1); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID); stmt->setUInt32(0, m->messageID); @@ -5817,7 +5817,7 @@ void ObjectMgr::LoadGraveyardZones() uint32 safeLocId = fields[0].GetUInt32(); uint32 zoneId = fields[1].GetUInt32(); uint32 team = fields[2].GetUInt16(); - TeamId teamId = team == 0 ? TEAM_NEUTRAL : (team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE); + TeamId teamId = team == 0 ? TEAM_NEUTRAL : (team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE); WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId); if (!entry) @@ -5861,7 +5861,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveyard(TeamId teamId) ALLIANCE_GRAVEYARD = 4, // Westfall }; - return sWorldSafeLocsStore.LookupEntry(teamId == TEAM_HORDE ? HORDE_GRAVEYARD : ALLIANCE_GRAVEYARD); + return sWorldSafeLocsStore.LookupEntry(teamId == TEAM_HORDE ? HORDE_GRAVEYARD : ALLIANCE_GRAVEYARD); } WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyard(float x, float y, float z, uint32 MapId, TeamId teamId) @@ -6007,7 +6007,7 @@ bool ObjectMgr::AddGraveyardLink(uint32 id, uint32 zoneId, TeamId teamId, bool p // add link to loaded data GraveyardData data; data.safeLocId = id; - data.teamId = teamId; + data.teamId = teamId; GraveyardStore.insert(GraveyardContainer::value_type(zoneId, data)); @@ -6018,7 +6018,7 @@ bool ObjectMgr::AddGraveyardLink(uint32 id, uint32 zoneId, TeamId teamId, bool p stmt->setUInt32(0, id); stmt->setUInt32(1, zoneId); - // Xinef: DB Data compatibility... + // Xinef: DB Data compatibility... stmt->setUInt16(2, uint16(teamId == TEAM_NEUTRAL ? 0 : (teamId == TEAM_ALLIANCE ? ALLIANCE : HORDE))); WorldDatabase.Execute(stmt); @@ -6070,8 +6070,8 @@ void ObjectMgr::RemoveGraveyardLink(uint32 id, uint32 zoneId, TeamId teamId, boo stmt->setUInt32(0, id); stmt->setUInt32(1, zoneId); - // Xinef: DB Data compatibility... - stmt->setUInt16(2, uint16(teamId == TEAM_NEUTRAL ? 0 : (teamId == TEAM_ALLIANCE ? ALLIANCE : HORDE))); + // Xinef: DB Data compatibility... + stmt->setUInt16(2, uint16(teamId == TEAM_NEUTRAL ? 0 : (teamId == TEAM_ALLIANCE ? ALLIANCE : HORDE))); WorldDatabase.Execute(stmt); } @@ -6277,9 +6277,9 @@ AreaTrigger const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const { for (AreaTriggerContainer::const_iterator itr = _areaTriggerStore.begin(); itr != _areaTriggerStore.end(); ++itr) { - if (itr->second.target_mapId == Map) // Id is used to determine correct Scarlet Monastery instance + if (itr->second.target_mapId == Map) // Id is used to determine correct Scarlet Monastery instance { - // xinef: no need to check, already done at loading + // xinef: no need to check, already done at loading //AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first); //if (atEntry) return &itr->second; @@ -7264,7 +7264,7 @@ void ObjectMgr::LoadQuestPOI() _questPOIStore[questId].push_back(POI); } else - sLog->outError("Table quest_poi references unknown quest points for quest %u POI id %u", questId, id); + sLog->outError("Table quest_poi references unknown quest points for quest %u POI id %u", questId, id); ++count; } while (result->NextRow()); @@ -7519,9 +7519,9 @@ void ObjectMgr::LoadReservedPlayersNames() bool ObjectMgr::IsReservedName(const std::string& name) const { - // pussywizard - if (name.size() >= 2 && (name[name.size()-2] == 'G' || name[name.size()-2] == 'g') && (name[name.size()-1] == 'M' || name[name.size()-1] == 'm')) - return true; + // pussywizard + if (name.size() >= 2 && (name[name.size()-2] == 'G' || name[name.size()-2] == 'g') && (name[name.size()-1] == 'M' || name[name.size()-1] == 'm')) + return true; std::wstring wstr; if (!Utf8toWStr (name, wstr)) @@ -7953,7 +7953,7 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial) switch (pSkill->categoryId) { case SKILL_CATEGORY_LANGUAGES: - return SKILL_RANGE_LANGUAGE; + return SKILL_RANGE_LANGUAGE; case SKILL_CATEGORY_WEAPON: if (pSkill->id != SKILL_FIST_WEAPONS) return SKILL_RANGE_LEVEL; @@ -8804,19 +8804,19 @@ void ObjectMgr::LoadCreatureClassLevelStats() stats.BaseHealth[i] = 1; } - // xinef: if no data is available, get them from lower expansions - if (stats.BaseHealth[i] <= 1) - { - for (uint8 j = i; j > 0;) - { - --j; - if (stats.BaseHealth[j] > 1) - { - stats.BaseHealth[i] = stats.BaseHealth[j]; - break; - } - } - } + // xinef: if no data is available, get them from lower expansions + if (stats.BaseHealth[i] <= 1) + { + for (uint8 j = i; j > 0;) + { + --j; + if (stats.BaseHealth[j] > 1) + { + stats.BaseHealth[i] = stats.BaseHealth[j]; + break; + } + } + } stats.BaseDamage[i] = fields[9 + i].GetFloat(); if (stats.BaseDamage[i] < 0.0f) @@ -9084,8 +9084,8 @@ GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) bool ObjectMgr::IsGameObjectStaticTransport(uint32 entry) { - GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry); - return goinfo && goinfo->type == GAMEOBJECT_TYPE_TRANSPORT; + GameObjectTemplate const* goinfo = GetGameObjectTemplate(entry); + return goinfo && goinfo->type == GAMEOBJECT_TYPE_TRANSPORT; } CreatureTemplate const* ObjectMgr::GetCreatureTemplate(uint32 entry) diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 9299594d2..c95d24ce8 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -829,7 +829,7 @@ class ObjectMgr void LoadQuests(); void LoadQuestStartersAndEnders() { - sLog->outString("Loading GO Start Quest Data..."); + sLog->outString("Loading GO Start Quest Data..."); LoadGameobjectQuestStarters(); sLog->outString("Loading GO End Quest Data..."); LoadGameobjectQuestEnders(); @@ -889,7 +889,7 @@ class ObjectMgr void LoadSpellScriptNames(); void ValidateSpellScripts(); - void InitializeSpellInfoPrecomputedData(); + void InitializeSpellInfoPrecomputedData(); bool LoadTrinityStrings(char const* table, int32 min_value, int32 max_value); bool LoadTrinityStrings() { return LoadTrinityStrings("trinity_string", MIN_TRINITY_STRING_ID, MAX_TRINITY_STRING_ID); } @@ -1003,22 +1003,22 @@ class ObjectMgr CellObjectGuids const& GetCellObjectGuids(uint16 mapid, uint8 spawnMode, uint32 cell_id) { - MapObjectGuids::const_iterator itr1 = _mapObjectGuidsStore.find(MAKE_PAIR32(mapid, spawnMode)); - if (itr1 != _mapObjectGuidsStore.end()) - { - CellObjectGuidsMap::const_iterator itr2 = itr1->second.find(cell_id); - if (itr2 != itr1->second.end()) - return itr2->second; - } + MapObjectGuids::const_iterator itr1 = _mapObjectGuidsStore.find(MAKE_PAIR32(mapid, spawnMode)); + if (itr1 != _mapObjectGuidsStore.end()) + { + CellObjectGuidsMap::const_iterator itr2 = itr1->second.find(cell_id); + if (itr2 != itr1->second.end()) + return itr2->second; + } return _emptyCellObjectGuids; } CellObjectGuidsMap const& GetMapObjectGuids(uint16 mapid, uint8 spawnMode) { - MapObjectGuids::const_iterator itr1 = _mapObjectGuidsStore.find(MAKE_PAIR32(mapid, spawnMode)); - if (itr1 != _mapObjectGuidsStore.end()) - return itr1->second; - return _emptyCellObjectGuidsMap; + MapObjectGuids::const_iterator itr1 = _mapObjectGuidsStore.find(MAKE_PAIR32(mapid, spawnMode)); + if (itr1 != _mapObjectGuidsStore.end()) + return itr1->second; + return _emptyCellObjectGuidsMap; } /** @@ -1094,7 +1094,7 @@ class ObjectMgr static uint8 CheckPlayerName(std::string const& name, bool create = false); static PetNameInvalidReason CheckPetName(std::string const& name); static bool IsValidCharterName(std::string const& name); - static bool IsValidChannelName(std::string const& name); + static bool IsValidChannelName(std::string const& name); static bool CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names); @@ -1285,8 +1285,8 @@ class ObjectMgr ItemSetNameContainer _itemSetNameStore; MapObjectGuids _mapObjectGuidsStore; - CellObjectGuidsMap _emptyCellObjectGuidsMap; - CellObjectGuids _emptyCellObjectGuids; + CellObjectGuidsMap _emptyCellObjectGuidsMap; + CellObjectGuids _emptyCellObjectGuids; CreatureDataContainer _creatureDataStore; CreatureTemplateContainer _creatureTemplateStore; std::vector _creatureTemplateStoreFast; // pussywizard diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index ebdf5c9b2..e25e527ca 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -71,11 +71,11 @@ void VisibleNotifier::SendToSelf() for (Player::ClientGUIDs::const_iterator it = vis_guids.begin();it != vis_guids.end(); ++it) { - // pussywizard: static transports are removed only in RemovePlayerFromMap and here if can no longer detect (eg. phase changed) - if (IS_TRANSPORT_GUID(*it)) - if (GameObject* staticTrans = i_player.GetMap()->GetGameObject(*it)) - if (i_player.CanSeeOrDetect(staticTrans, false, true)) - continue; + // pussywizard: static transports are removed only in RemovePlayerFromMap and here if can no longer detect (eg. phase changed) + if (IS_TRANSPORT_GUID(*it)) + if (GameObject* staticTrans = i_player.GetMap()->GetGameObject(*it)) + if (i_player.CanSeeOrDetect(staticTrans, false, true)) + continue; i_player.m_clientGUIDs.erase(*it); i_data.AddOutOfRangeGUID(*it); @@ -127,11 +127,11 @@ void VisibleChangesNotifier::Visit(CreatureMapType &m) void VisibleChangesNotifier::Visit(DynamicObjectMapType &m) { for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter) - if (IS_PLAYER_GUID(iter->GetSource()->GetCasterGUID())) - if (Unit* caster = iter->GetSource()->GetCaster()) - if (Player* player = caster->ToPlayer()) - if (player->m_seer == iter->GetSource()) - player->UpdateVisibilityOf(&i_object); + if (IS_PLAYER_GUID(iter->GetSource()->GetCasterGUID())) + if (Unit* caster = iter->GetSource()->GetCaster()) + if (Player* player = caster->ToPlayer()) + if (player->m_seer == iter->GetSource()) + player->UpdateVisibilityOf(&i_object); } inline void CreatureUnitRelocationWorker(Creature* c, Unit* u) @@ -140,7 +140,7 @@ inline void CreatureUnitRelocationWorker(Creature* c, Unit* u) return; if (c->HasReactState(REACT_AGGRESSIVE) && !c->HasUnitState(UNIT_STATE_SIGHTLESS)) - if (c->IsAIEnabled && c->CanSeeOrDetect(u, false, true)) + if (c->IsAIEnabled && c->CanSeeOrDetect(u, false, true)) c->AI()->MoveInLineOfSight_Safe(u); } @@ -161,11 +161,11 @@ void CreatureRelocationNotifier::Visit(PlayerMapType &m) { Player* player = iter->GetSource(); - // NOTIFY_VISIBILITY_CHANGED does not guarantee that player will do it himself (because distance is also checked), but screw it, it's not that important + // NOTIFY_VISIBILITY_CHANGED does not guarantee that player will do it himself (because distance is also checked), but screw it, it's not that important if (!player->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED)) player->UpdateVisibilityOf(&i_creature); - // NOTIFY_AI_RELOCATION does not guarantee that player will do it himself (because distance is also checked), but screw it, it's not that important + // NOTIFY_AI_RELOCATION does not guarantee that player will do it himself (because distance is also checked), but screw it, it's not that important if (!player->m_seer->isNeedNotify(NOTIFY_AI_RELOCATION) && !i_creature.IsMoveInLineOfSightStrictlyDisabled()) CreatureUnitRelocationWorker(&i_creature, player); } @@ -173,16 +173,16 @@ void CreatureRelocationNotifier::Visit(PlayerMapType &m) void AIRelocationNotifier::Visit(CreatureMapType &m) { - bool self = isCreature && !((Creature*)(&i_unit))->IsMoveInLineOfSightStrictlyDisabled(); + bool self = isCreature && !((Creature*)(&i_unit))->IsMoveInLineOfSightStrictlyDisabled(); for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Creature* c = iter->GetSource(); - // NOTIFY_VISIBILITY_CHANGED | NOTIFY_AI_RELOCATION does not guarantee that unit will do it itself (because distance is also checked), but screw it, it's not that important - if (!c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED | NOTIFY_AI_RELOCATION) && !c->IsMoveInLineOfSightStrictlyDisabled()) - CreatureUnitRelocationWorker(c, &i_unit); + // NOTIFY_VISIBILITY_CHANGED | NOTIFY_AI_RELOCATION does not guarantee that unit will do it itself (because distance is also checked), but screw it, it's not that important + if (!c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED | NOTIFY_AI_RELOCATION) && !c->IsMoveInLineOfSightStrictlyDisabled()) + CreatureUnitRelocationWorker(c, &i_unit); - if (self) + if (self) CreatureUnitRelocationWorker((Creature*)&i_unit, c); } } @@ -239,9 +239,9 @@ void MessageDistDeliverer::Visit(DynamicObjectMapType &m) if (!IS_PLAYER_GUID(target->GetCasterGUID()) || !target->InSamePhase(i_phaseMask)) continue; - // Xinef: Check whether the dynobject allows to see through it - if (!target->IsViewpoint()) - continue; + // Xinef: Check whether the dynobject allows to see through it + if (!target->IsViewpoint()) + continue; if (target->GetExactDist2dSq(i_source) > i_distSq) continue; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index a5cfcda35..5ef9d6b9d 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -102,7 +102,7 @@ namespace Trinity Player const* skipped_receiver; MessageDistDeliverer(WorldObject* src, WorldPacket* msg, float dist, bool own_team_only = false, Player const* skipped = NULL) : i_source(src), i_message(msg), i_phaseMask(src->GetPhaseMask()), i_distSq(dist * dist) - , teamId((own_team_only && src->GetTypeId() == TYPEID_PLAYER) ? src->ToPlayer()->GetTeamId() : TEAM_NEUTRAL) + , teamId((own_team_only && src->GetTypeId() == TYPEID_PLAYER) ? src->ToPlayer()->GetTeamId() : TEAM_NEUTRAL) , skipped_receiver(skipped) { } @@ -124,7 +124,7 @@ namespace Trinity } }; - struct MessageDistDelivererToHostile + struct MessageDistDelivererToHostile { Unit* i_source; WorldPacket* i_message; @@ -625,8 +625,8 @@ namespace Trinity if (go->GetGOInfo()->type != GAMEOBJECT_TYPE_SPELL_FOCUS) return false; - if (!go->isSpawned()) // xinef: dont allow to count deactivated objects - return false; + if (!go->isSpawned()) // xinef: dont allow to count deactivated objects + return false; if (go->GetGOInfo()->spellFocus.focusId != i_focusId) return false; @@ -785,12 +785,12 @@ namespace Trinity { public: FriendlyMissingBuffInRange(Unit const* obj, float range, uint32 spellid) : i_obj(obj), i_range(range) - { - i_spell = spellid; - if( SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellid) ) - if( SpellInfo const* newSpell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, const_cast(obj)) ) - i_spell = newSpell->Id; - } + { + i_spell = spellid; + if( SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellid) ) + if( SpellInfo const* newSpell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, const_cast(obj)) ) + i_spell = newSpell->Id; + } bool operator()(Unit* u) { if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && @@ -813,7 +813,7 @@ namespace Trinity bool operator()(Unit* u) { if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u) && - (i_funit->GetTypeId() != TYPEID_UNIT || !i_funit->ToCreature()->IsAvoidingAOE())) // pussywizard + (i_funit->GetTypeId() != TYPEID_UNIT || !i_funit->ToCreature()->IsAvoidingAOE())) // pussywizard return true; else return false; @@ -833,10 +833,10 @@ namespace Trinity if (!u->IsAlive()) return false; - if (u->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET) - return false; + if (u->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET) + return false; - if (u->GetTypeId() == TYPEID_UNIT && (u->ToCreature()->IsTotem() || u->ToCreature()->IsTrigger() || u->ToCreature()->IsAvoidingAOE())) // pussywizard: added IsAvoidingAOE() + if (u->GetTypeId() == TYPEID_UNIT && (u->ToCreature()->IsTotem() || u->ToCreature()->IsTrigger() || u->ToCreature()->IsAvoidingAOE())) // pussywizard: added IsAvoidingAOE() return false; if (!u->isTargetableForAttack(false, i_funit)) @@ -863,7 +863,7 @@ namespace Trinity && !i_funit->IsFriendlyTo(u) && i_funit->IsValidAttackTarget(u) && !u->IsCritter() - && !u->IsTotem() //xinef: dont attack totems + && !u->IsTotem() //xinef: dont attack totems /*&& i_funit->CanSeeOrDetect(u)*/; // pussywizard: already checked in IsValidAttackTarget(u) } private: @@ -1018,7 +1018,7 @@ namespace Trinity float i_range; }; - class AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck + class AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck { public: AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) @@ -1031,9 +1031,9 @@ namespace Trinity } bool operator()(Unit* u) { - if (!u->IsAlive() || u->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || (u->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && !u->IsInCombat())) + if (!u->IsAlive() || u->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || (u->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && !u->IsInCombat())) return false; - if (u->GetGUID() == i_funit->GetGUID()) + if (u->GetGUID() == i_funit->GetGUID()) return false; if (i_obj->IsWithinDistInMap(u, i_range)) @@ -1240,8 +1240,8 @@ namespace Trinity if (_reqAlive && !u->IsAlive()) return false; - if (_disallowGM && (u->IsGameMaster() || u->IsSpectator())) - return false; + if (_disallowGM && (u->IsGameMaster() || u->IsSpectator())) + return false; if (!_obj->IsWithinDistInMap(u, _range)) return false; @@ -1262,7 +1262,7 @@ namespace Trinity WorldObject const* _obj; float _range; bool _reqAlive; - bool _disallowGM; + bool _disallowGM; }; class NearestPlayerInObjectRangeCheck @@ -1411,7 +1411,7 @@ namespace Trinity private: uint64 _GUID; - bool _equals; + bool _equals; }; class UnitAuraCheck @@ -1434,61 +1434,61 @@ namespace Trinity uint64 _casterGUID; }; - class AllWorldObjectsInExactRange + class AllWorldObjectsInExactRange { - public: - AllWorldObjectsInExactRange(const WorldObject* object, float range, bool equals) : _object(object), _range(range), _equals(equals) { } - bool operator() (WorldObject const* object) - { - return (_object->GetExactDist2d(object) > _range) == _equals; - } + public: + AllWorldObjectsInExactRange(const WorldObject* object, float range, bool equals) : _object(object), _range(range), _equals(equals) { } + bool operator() (WorldObject const* object) + { + return (_object->GetExactDist2d(object) > _range) == _equals; + } - private: - const WorldObject* _object; - float _range; - bool _equals; + private: + const WorldObject* _object; + float _range; + bool _equals; }; - class RandomCheck - { - public: - explicit RandomCheck(uint8 chance) : _chance(chance) { } - bool operator()(WorldObject const* object) const - { - return roll_chance_i(_chance); - } + class RandomCheck + { + public: + explicit RandomCheck(uint8 chance) : _chance(chance) { } + bool operator()(WorldObject const* object) const + { + return roll_chance_i(_chance); + } - private: - uint8 const _chance; - }; - - class PowerCheck - { - public: - explicit PowerCheck(Powers const power, bool equals) : _power(power), _equals(equals) { } - bool operator()(WorldObject const* object) const - { - return object->ToUnit() && (object->ToUnit()->getPowerType() == _power) == _equals; - } + private: + uint8 const _chance; + }; + + class PowerCheck + { + public: + explicit PowerCheck(Powers const power, bool equals) : _power(power), _equals(equals) { } + bool operator()(WorldObject const* object) const + { + return object->ToUnit() && (object->ToUnit()->getPowerType() == _power) == _equals; + } - private: - Powers const _power; - bool const _equals; - }; + private: + Powers const _power; + bool const _equals; + }; - class RaidCheck - { - public: - explicit RaidCheck(Unit const* compare, bool equals) : _compare(compare), _equals(equals) { } - bool operator()(WorldObject const* object) const - { - return object->ToUnit() && object->ToUnit()->IsInRaidWith(_compare) == _equals; - } + class RaidCheck + { + public: + explicit RaidCheck(Unit const* compare, bool equals) : _compare(compare), _equals(equals) { } + bool operator()(WorldObject const* object) const + { + return object->ToUnit() && object->ToUnit()->IsInRaidWith(_compare) == _equals; + } - private: - Unit const* _compare; - bool const _equals; - }; + private: + Unit const* _compare; + bool const _equals; + }; // Player checks and do diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index fa599acb5..8c613a6cd 100644 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -123,8 +123,8 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManagerGetGOData(guid); - GameObject* obj = data && sObjectMgr->IsGameObjectStaticTransport(data->id) ? new StaticTransport() : new GameObject(); + GameObjectData const* data = sObjectMgr->GetGOData(guid); + GameObject* obj = data && sObjectMgr->IsGameObjectStaticTransport(data->id) ? new StaticTransport() : new GameObject(); //sLog->outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid); if (!obj->LoadFromDB(guid, map)) { diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index a284f63c9..3a3065849 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -167,9 +167,9 @@ bool Group::LoadGroupFromDB(Field* fields) // group leader not exist if (!sObjectMgr->GetPlayerNameByGUID(fields[0].GetUInt32(), m_leaderName)) - { - uint32 groupLowGuid = fields[16].GetUInt32(); - SQLTransaction trans = CharacterDatabase.BeginTransaction(); + { + uint32 groupLowGuid = fields[16].GetUInt32(); + SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP); stmt->setUInt32(0, groupLowGuid); trans->Append(stmt); @@ -181,7 +181,7 @@ bool Group::LoadGroupFromDB(Field* fields) stmt->setUInt32(0, groupLowGuid); CharacterDatabase.Execute(stmt); return false; - } + } m_lootMethod = LootMethod(fields[1].GetUInt8()); m_looterGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); @@ -211,7 +211,7 @@ bool Group::LoadGroupFromDB(Field* fields) if (m_groupType & GROUPTYPE_LFG) sLFGMgr->_LoadFromDB(fields, GetGUID()); - return true; + return true; } void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles) @@ -224,7 +224,7 @@ void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER); stmt->setUInt32(0, guidLow); - stmt->setUInt32(1, GetLowGUID()); + stmt->setUInt32(1, GetLowGUID()); CharacterDatabase.Execute(stmt); return; } @@ -234,8 +234,8 @@ void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, member.roles = roles; m_memberSlots.push_back(member); - if (!isBGGroup() && !isBFGroup()) - sWorld->UpdateGlobalPlayerGroup(guidLow, GetLowGUID()); + if (!isBGGroup() && !isBFGroup()) + sWorld->UpdateGlobalPlayerGroup(guidLow, GetLowGUID()); SubGroupCounterIncrease(subgroup); @@ -282,9 +282,9 @@ void Group::ConvertToRaid() if (Player* player = ObjectAccessor::FindPlayer(citr->guid)) player->UpdateForQuestWorldObjects(); - // pussywizard: client automatically clears df "eye" near minimap, so remove from raid browser - if (sLFGMgr->GetState(GetLeaderGUID()) == lfg::LFG_STATE_RAIDBROWSER) - sLFGMgr->LeaveLfg(GetLeaderGUID()); + // pussywizard: client automatically clears df "eye" near minimap, so remove from raid browser + if (sLFGMgr->GetState(GetLeaderGUID()) == lfg::LFG_STATE_RAIDBROWSER) + sLFGMgr->LeaveLfg(GetLeaderGUID()); } bool Group::AddInvite(Player* player) @@ -322,8 +322,8 @@ void Group::RemoveInvite(Player* player) { if (player) { - if (!m_invitees.empty()) - m_invitees.erase(player); + if (!m_invitees.empty()) + m_invitees.erase(player); player->SetGroupInvite(NULL); } } @@ -385,7 +385,7 @@ bool Group::AddMember(Player* player) member.roles = 0; m_memberSlots.push_back(member); if (!isBGGroup() && !isBFGroup()) - sWorld->UpdateGlobalPlayerGroup(player->GetGUIDLow(), GetLowGUID()); + sWorld->UpdateGlobalPlayerGroup(player->GetGUIDLow(), GetLowGUID()); SubGroupCounterIncrease(subGroup); @@ -403,7 +403,7 @@ bool Group::AddMember(Player* player) player->SetGroup(this, subGroup); // if the same group invites the player back, cancel the homebind timer - _cancelHomebindIfInstance(player); + _cancelHomebindIfInstance(player); } if (!isRaidGroup()) // reset targetIcons for non-raid-groups @@ -430,7 +430,7 @@ bool Group::AddMember(Player* player) { if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup()) { - Player::ResetInstances(player->GetGUIDLow(), INSTANCE_RESET_GROUP_JOIN, false); + Player::ResetInstances(player->GetGUIDLow(), INSTANCE_RESET_GROUP_JOIN, false); if (player->GetDungeonDifficulty() != GetDungeonDifficulty()) { @@ -443,10 +443,10 @@ bool Group::AddMember(Player* player) player->SendRaidDifficulty(true); } } - else if (IsLeader(player->GetGUID()) && isLFGGroup()) // pussywizard - { - Player::ResetInstances(player->GetGUIDLow(), INSTANCE_RESET_GROUP_JOIN, false); - } + else if (IsLeader(player->GetGUID()) && isLFGGroup()) // pussywizard + { + Player::ResetInstances(player->GetGUIDLow(), INSTANCE_RESET_GROUP_JOIN, false); + } player->SetGroupUpdateFlag(GROUP_UPDATE_FULL); UpdatePlayerOutOfRange(player); @@ -513,10 +513,10 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV // LFG group vote kick handled in scripts if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK) - { + { sLFGMgr->InitBoot(GetGUID(), kicker, guid, std::string(reason ? reason : "")); return m_memberSlots.size() > 0; - } + } // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group) if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u)) @@ -559,7 +559,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER); stmt->setUInt32(0, GUID_LOPART(guid)); - stmt->setUInt32(1, GetLowGUID()); + stmt->setUInt32(1, GetLowGUID()); CharacterDatabase.Execute(stmt); } @@ -573,10 +573,10 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV Roll* roll = *it; Roll::PlayerVote::iterator itr2 = roll->playerVote.find(guid); if (itr2 == roll->playerVote.end()) - { - ++it; + { + ++it; continue; - } + } if (itr2->second == GREED || itr2->second == DISENCHANT) --roll->totalGreed; @@ -590,12 +590,12 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV roll->playerVote.erase(itr2); - // Xinef: itr can be erased inside - // Xinef: player is removed from all vote lists so it will not pass above playerVote == playerVote.end statement during second iteration + // Xinef: itr can be erased inside + // Xinef: player is removed from all vote lists so it will not pass above playerVote == playerVote.end statement during second iteration if (CountRollVote(guid, roll->itemGUID, MAX_ROLL_TYPE)) - it = RollId.begin(); - else - ++it; + it = RollId.begin(); + else + ++it; } // Update subgroups @@ -604,46 +604,46 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV { SubGroupCounterDecrease(slot->group); m_memberSlots.erase(slot); - if (!isBGGroup() && !isBFGroup()) - sWorld->UpdateGlobalPlayerGroup(GUID_LOPART(guid), 0); + if (!isBGGroup() && !isBFGroup()) + sWorld->UpdateGlobalPlayerGroup(GUID_LOPART(guid), 0); } // Pick new leader if necessary - bool validLeader = true; + bool validLeader = true; if (m_leaderGuid == guid) { - validLeader = false; + validLeader = false; for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) { if (ObjectAccessor::FindPlayerInOrOutOfWorld(itr->guid)) { ChangeLeader(itr->guid); - validLeader = true; + validLeader = true; break; } } } - _homebindIfInstance(player); - if (!isBGGroup() && !isBFGroup()) - Player::ResetInstances(guid, INSTANCE_RESET_GROUP_LEAVE, false); + _homebindIfInstance(player); + if (!isBGGroup() && !isBFGroup()) + Player::ResetInstances(guid, INSTANCE_RESET_GROUP_LEAVE, false); - sScriptMgr->OnGroupRemoveMember(this, guid, method, kicker, reason); + sScriptMgr->OnGroupRemoveMember(this, guid, method, kicker, reason); SendUpdate(); - if (!validLeader) - { - // pussywizard: temp do nothing, something causes crashes in MakeNewGroup - //Disband(); - //return false; - } + if (!validLeader) + { + // pussywizard: temp do nothing, something causes crashes in MakeNewGroup + //Disband(); + //return false; + } if (isLFGGroup() && GetMembersCount() == 1) { Player* leader = ObjectAccessor::FindPlayerInOrOutOfWorld(GetLeaderGUID()); uint32 mapId = sLFGMgr->GetDungeonMapId(GetGUID()); - lfg::LfgState state = sLFGMgr->GetState(GetGUID()); + lfg::LfgState state = sLFGMgr->GetState(GetGUID()); if (!mapId || !leader || (leader->IsAlive() && leader->GetMapId() != mapId) || state == lfg::LFG_STATE_NONE) { Disband(); @@ -652,17 +652,17 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV } if (m_memberMgr.getSize() < ((isLFGGroup() || isBGGroup() || isBFGroup()) ? 1u : 2u)) - { + { Disband(); - return false; - } + return false; + } return true; } // If group size before player removal <= 2 then disband it else { - sScriptMgr->OnGroupRemoveMember(this, guid, method, kicker, reason); + sScriptMgr->OnGroupRemoveMember(this, guid, method, kicker, reason); Disband(); return false; } @@ -693,7 +693,7 @@ void Group::ChangeLeader(uint64 newLeaderGuid) trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); - sInstanceSaveMgr->CopyBinds(m_leaderGuid, newLeaderGuid, newLeader); + sInstanceSaveMgr->CopyBinds(m_leaderGuid, newLeaderGuid, newLeader); } if (Player* oldLeader = ObjectAccessor::FindPlayerInOrOutOfWorld(m_leaderGuid)) @@ -716,14 +716,14 @@ void Group::Disband(bool hideDestroy /* = false */) Player* player; for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { - if (!isBGGroup() && !isBFGroup()) - sWorld->UpdateGlobalPlayerGroup(GUID_LOPART(citr->guid), 0); + if (!isBGGroup() && !isBFGroup()) + sWorld->UpdateGlobalPlayerGroup(GUID_LOPART(citr->guid), 0); player = ObjectAccessor::FindPlayerInOrOutOfWorld(citr->guid); _homebindIfInstance(player); - if (!isBGGroup() && !isBFGroup()) - Player::ResetInstances(citr->guid, INSTANCE_RESET_GROUP_LEAVE, false); + if (!isBGGroup() && !isBFGroup()) + Player::ResetInstances(citr->guid, INSTANCE_RESET_GROUP_LEAVE, false); if (!player) continue; @@ -1282,8 +1282,8 @@ bool Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice) Roll::PlayerVote::iterator itr = roll->playerVote.find(playerGUID); // this condition means that player joins to the party after roll begins - // Xinef: if choice == MAX_ROLL_TYPE, player was removed from the map in removefromgroup - // Xinef: itr can be invalid as it is not used below + // Xinef: if choice == MAX_ROLL_TYPE, player was removed from the map in removefromgroup + // Xinef: itr can be invalid as it is not used below if (Choice < MAX_ROLL_TYPE && itr == roll->playerVote.end()) return false; @@ -1316,11 +1316,11 @@ bool Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint8 Choice) } if (roll->totalPass + roll->totalNeed + roll->totalGreed >= roll->totalPlayersRolling) - { + { CountTheRoll(rollI, NULL); - return true; - } - return false; + return true; + } + return false; } //called when roll timer expires @@ -1361,12 +1361,12 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) if (itr->second != NEED) continue; - player = ObjectAccessor::FindPlayer(itr->first); - if (!player || allowedMap != NULL && player->FindMap() != allowedMap) - { - --roll->totalNeed; - continue; - } + player = ObjectAccessor::FindPlayer(itr->first); + if (!player || allowedMap != NULL && player->FindMap() != allowedMap) + { + --roll->totalNeed; + continue; + } uint8 randomN = urand(1, 100); SendLootRoll(0, itr->first, randomN, ROLL_NEED, *roll); @@ -1377,37 +1377,37 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) } } - if (maxguid) // pussywizard: added condition - { - SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll); - player = ObjectAccessor::FindPlayer(maxguid); + if (maxguid) // pussywizard: added condition + { + SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll); + player = ObjectAccessor::FindPlayer(maxguid); - if (player) - { - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT, roll->itemid, maxresul); + if (player) + { + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT, roll->itemid, maxresul); - ItemPosCountVec dest; - LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]); - InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count); - if (msg == EQUIP_ERR_OK) - { - item->is_looted = true; - roll->getLoot()->NotifyItemRemoved(roll->itemSlot); - roll->getLoot()->unlootedCount--; - AllowedLooterSet looters = item->GetAllowedLooters(); - player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters); - player->UpdateLootAchievements(item, roll->getLoot()); - } - else - { - item->is_blocked = false; - item->rollWinnerGUID = player->GetGUID(); - player->SendEquipError(msg, NULL, NULL, roll->itemid); - } - } - } - else - roll->totalNeed = 0; + ItemPosCountVec dest; + LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]); + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count); + if (msg == EQUIP_ERR_OK) + { + item->is_looted = true; + roll->getLoot()->NotifyItemRemoved(roll->itemSlot); + roll->getLoot()->unlootedCount--; + AllowedLooterSet looters = item->GetAllowedLooters(); + player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters); + player->UpdateLootAchievements(item, roll->getLoot()); + } + else + { + item->is_blocked = false; + item->rollWinnerGUID = player->GetGUID(); + player->SendEquipError(msg, NULL, NULL, roll->itemid); + } + } + } + else + roll->totalNeed = 0; } } if (roll->totalNeed == 0 && roll->totalGreed > 0) // pussywizard: if (roll->totalNeed == 0 && ...), not else if, because numbers can be modified above if player is on a different map @@ -1425,12 +1425,12 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) if (itr->second != GREED && itr->second != DISENCHANT) continue; - player = ObjectAccessor::FindPlayer(itr->first); - if (!player || allowedMap != NULL && player->FindMap() != allowedMap) - { - --roll->totalGreed; - continue; - } + player = ObjectAccessor::FindPlayer(itr->first); + if (!player || allowedMap != NULL && player->FindMap() != allowedMap) + { + --roll->totalGreed; + continue; + } uint8 randomN = urand(1, 100); SendLootRoll(0, itr->first, randomN, itr->second, *roll); @@ -1442,50 +1442,50 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) } } - if (maxguid) // pussywizard: added condition - { - SendLootRollWon(0, maxguid, maxresul, rollvote, *roll); - player = ObjectAccessor::FindPlayer(maxguid); + if (maxguid) // pussywizard: added condition + { + SendLootRollWon(0, maxguid, maxresul, rollvote, *roll); + player = ObjectAccessor::FindPlayer(maxguid); - if (player) - { - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT, roll->itemid, maxresul); + if (player) + { + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT, roll->itemid, maxresul); - LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]); + LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]); - if (rollvote == GREED) - { - ItemPosCountVec dest; - InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count); - if (msg == EQUIP_ERR_OK) - { - item->is_looted = true; - roll->getLoot()->NotifyItemRemoved(roll->itemSlot); - roll->getLoot()->unlootedCount--; - AllowedLooterSet looters = item->GetAllowedLooters(); - player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters); - player->UpdateLootAchievements(item, roll->getLoot()); - } - else - { - item->is_blocked = false; - item->rollWinnerGUID = player->GetGUID(); - player->SendEquipError(msg, NULL, NULL, roll->itemid); - } - } - else if (rollvote == DISENCHANT) - { - item->is_looted = true; - roll->getLoot()->NotifyItemRemoved(roll->itemSlot); - roll->getLoot()->unlootedCount--; - ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(roll->itemid); - player->AutoStoreLoot(pProto->DisenchantID, LootTemplates_Disenchant, true); - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, 13262); // Disenchant - } - } - } - else - roll->totalGreed = 0; + if (rollvote == GREED) + { + ItemPosCountVec dest; + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count); + if (msg == EQUIP_ERR_OK) + { + item->is_looted = true; + roll->getLoot()->NotifyItemRemoved(roll->itemSlot); + roll->getLoot()->unlootedCount--; + AllowedLooterSet looters = item->GetAllowedLooters(); + player->StoreNewItem(dest, roll->itemid, true, item->randomPropertyId, looters); + player->UpdateLootAchievements(item, roll->getLoot()); + } + else + { + item->is_blocked = false; + item->rollWinnerGUID = player->GetGUID(); + player->SendEquipError(msg, NULL, NULL, roll->itemid); + } + } + else if (rollvote == DISENCHANT) + { + item->is_looted = true; + roll->getLoot()->NotifyItemRemoved(roll->itemSlot); + roll->getLoot()->unlootedCount--; + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(roll->itemid); + player->AutoStoreLoot(pProto->DisenchantID, LootTemplates_Disenchant, true); + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, 13262); // Disenchant + } + } + } + else + roll->totalGreed = 0; } } if (roll->totalNeed == 0 && roll->totalGreed == 0) // pussywizard: if, not else, because numbers can be modified above if player is on a different map @@ -1574,7 +1574,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot) data << uint8(slot->roles); if (isLFGGroup()) { - data << uint8(sLFGMgr->GetState(m_guid) == lfg::LFG_STATE_FINISHED_DUNGEON ? 2 : 0); // FIXME - Dungeon save status? 2 = done + data << uint8(sLFGMgr->GetState(m_guid) == lfg::LFG_STATE_FINISHED_DUNGEON ? 2 : 0); // FIXME - Dungeon save status? 2 = done data << uint32(sLFGMgr->GetDungeon(m_guid)); } @@ -1819,7 +1819,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const* if (!bgEntry) return ERR_GROUP_JOIN_BATTLEGROUND_FAIL; - // too many players in the group + // too many players in the group if (GetMembersCount() > bgEntry->maxGroupSize) return ERR_BATTLEGROUND_NONE; @@ -1866,13 +1866,13 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const* if (member->isUsingLfg()) return ERR_LFG_CANT_USE_BATTLEGROUND; - // pussywizard: prevent joining when any member is in bg/arena - if (member->InBattleground()) - return ERR_BATTLEGROUND_JOIN_FAILED; + // pussywizard: prevent joining when any member is in bg/arena + if (member->InBattleground()) + return ERR_BATTLEGROUND_JOIN_FAILED; - // pussywizard: check for free slot, this is actually ensured before calling this function, but just in case - if (!member->HasFreeBattlegroundQueueId()) - return ERR_BATTLEGROUND_TOO_MANY_QUEUES; + // pussywizard: check for free slot, this is actually ensured before calling this function, but just in case + if (!member->HasFreeBattlegroundQueueId()) + return ERR_BATTLEGROUND_TOO_MANY_QUEUES; } // for arenas: check party size is proper @@ -1936,62 +1936,62 @@ void Group::SetRaidDifficulty(Difficulty difficulty) void Group::ResetInstances(uint8 method, bool isRaid, Player* leader) { - if (isBGGroup() || isBFGroup() || isLFGGroup()) + if (isBGGroup() || isBFGroup() || isLFGGroup()) return; - switch (method) - { - case INSTANCE_RESET_ALL: - { - if (leader->GetDifficulty(false) != DUNGEON_DIFFICULTY_NORMAL) - break; - std::vector toUnbind; - BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUIDLow(), Difficulty(DUNGEON_DIFFICULTY_NORMAL)); - for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) - { - InstanceSave* instanceSave = itr->second.save; - const MapEntry* entry = sMapStore.LookupEntry(itr->first); - if (!entry || entry->IsRaid() || !instanceSave->CanReset()) - continue; + switch (method) + { + case INSTANCE_RESET_ALL: + { + if (leader->GetDifficulty(false) != DUNGEON_DIFFICULTY_NORMAL) + break; + std::vector toUnbind; + BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUIDLow(), Difficulty(DUNGEON_DIFFICULTY_NORMAL)); + for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) + { + InstanceSave* instanceSave = itr->second.save; + const MapEntry* entry = sMapStore.LookupEntry(itr->first); + if (!entry || entry->IsRaid() || !instanceSave->CanReset()) + continue; - Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); - if (!map || map->ToInstanceMap()->Reset(method)) - { - leader->SendResetInstanceSuccess(instanceSave->GetMapId()); - toUnbind.push_back(instanceSave); - } - else - leader->SendResetInstanceFailed(0, instanceSave->GetMapId()); - } - for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) - sInstanceSaveMgr->UnbindAllFor(*itr); - } - break; - case INSTANCE_RESET_CHANGE_DIFFICULTY: - { - std::vector toUnbind; - BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUIDLow(), leader->GetDifficulty(isRaid)); - for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) - { - InstanceSave* instanceSave = itr->second.save; - const MapEntry* entry = sMapStore.LookupEntry(itr->first); - if (!entry || entry->IsRaid() != isRaid || !instanceSave->CanReset()) - continue; + Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); + if (!map || map->ToInstanceMap()->Reset(method)) + { + leader->SendResetInstanceSuccess(instanceSave->GetMapId()); + toUnbind.push_back(instanceSave); + } + else + leader->SendResetInstanceFailed(0, instanceSave->GetMapId()); + } + for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) + sInstanceSaveMgr->UnbindAllFor(*itr); + } + break; + case INSTANCE_RESET_CHANGE_DIFFICULTY: + { + std::vector toUnbind; + BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(leader->GetGUIDLow(), leader->GetDifficulty(isRaid)); + for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) + { + InstanceSave* instanceSave = itr->second.save; + const MapEntry* entry = sMapStore.LookupEntry(itr->first); + if (!entry || entry->IsRaid() != isRaid || !instanceSave->CanReset()) + continue; - Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); - if (!map || map->ToInstanceMap()->Reset(method)) - { - leader->SendResetInstanceSuccess(instanceSave->GetMapId()); - toUnbind.push_back(instanceSave); - } - else - leader->SendResetInstanceFailed(0, instanceSave->GetMapId()); - } - for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) - sInstanceSaveMgr->UnbindAllFor(*itr); - } - break; - } + Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId()); + if (!map || map->ToInstanceMap()->Reset(method)) + { + leader->SendResetInstanceSuccess(instanceSave->GetMapId()); + toUnbind.push_back(instanceSave); + } + else + leader->SendResetInstanceFailed(0, instanceSave->GetMapId()); + } + for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) + sInstanceSaveMgr->UnbindAllFor(*itr); + } + break; + } } void Group::_homebindIfInstance(Player* player) @@ -2002,10 +2002,10 @@ void Group::_homebindIfInstance(Player* player) void Group::_cancelHomebindIfInstance(Player* player) { - // if player is reinvited to group and in the instance - cancel homebind timer - if (!player->FindMap() || !player->FindMap()->IsDungeon()) - return; - InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(player->GetGUIDLow(), player->FindMap()->GetId(), player->GetDifficulty(player->FindMap()->IsRaid())); + // if player is reinvited to group and in the instance - cancel homebind timer + if (!player->FindMap() || !player->FindMap()->IsDungeon()) + return; + InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(player->GetGUIDLow(), player->FindMap()->GetId(), player->GetDifficulty(player->FindMap()->IsRaid())); if (bind && bind->save->GetInstanceId() == player->GetInstanceId()) player->m_InstanceValid = true; } diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index ae3ced0a8..12934ef77 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -122,16 +122,16 @@ enum GroupUpdateFlags enum lfgGroupFlags { - GROUP_LFG_FLAG_APPLY_RANDOM_BUFF = 0x001, - GROUP_LFG_FLAG_IS_RANDOM_INSTANCE = 0x002, - GROUP_LFG_FLAG_IS_HEROIC = 0x004 + GROUP_LFG_FLAG_APPLY_RANDOM_BUFF = 0x001, + GROUP_LFG_FLAG_IS_RANDOM_INSTANCE = 0x002, + GROUP_LFG_FLAG_IS_HEROIC = 0x004 }; enum DifficultyPreventionChangeType { - DIFFICULTY_PREVENTION_CHANGE_NONE = 0, - DIFFICULTY_PREVENTION_CHANGE_RECENTLY_CHANGED = 1, - DIFFICULTY_PREVENTION_CHANGE_BOSS_KILLED = 2 + DIFFICULTY_PREVENTION_CHANGE_NONE = 0, + DIFFICULTY_PREVENTION_CHANGE_RECENTLY_CHANGED = 1, + DIFFICULTY_PREVENTION_CHANGE_BOSS_KILLED = 2 }; #define GROUP_UPDATE_FLAGS_COUNT 20 @@ -302,22 +302,22 @@ class Group // FG: evil hacks void BroadcastGroupUpdate(void); - // LFG - void AddLfgBuffFlag() { m_lfgGroupFlags |= GROUP_LFG_FLAG_APPLY_RANDOM_BUFF; } - void AddLfgRandomInstanceFlag() { m_lfgGroupFlags |= GROUP_LFG_FLAG_IS_RANDOM_INSTANCE; } - void AddLfgHeroicFlag() { m_lfgGroupFlags |= GROUP_LFG_FLAG_IS_HEROIC; } - bool IsLfgWithBuff() const { return isLFGGroup() && (m_lfgGroupFlags & GROUP_LFG_FLAG_APPLY_RANDOM_BUFF); } - bool IsLfgRandomInstance() const { return isLFGGroup() && (m_lfgGroupFlags & GROUP_LFG_FLAG_IS_RANDOM_INSTANCE); } - bool IsLfgHeroic() const { return isLFGGroup() && (m_lfgGroupFlags & GROUP_LFG_FLAG_IS_HEROIC); } + // LFG + void AddLfgBuffFlag() { m_lfgGroupFlags |= GROUP_LFG_FLAG_APPLY_RANDOM_BUFF; } + void AddLfgRandomInstanceFlag() { m_lfgGroupFlags |= GROUP_LFG_FLAG_IS_RANDOM_INSTANCE; } + void AddLfgHeroicFlag() { m_lfgGroupFlags |= GROUP_LFG_FLAG_IS_HEROIC; } + bool IsLfgWithBuff() const { return isLFGGroup() && (m_lfgGroupFlags & GROUP_LFG_FLAG_APPLY_RANDOM_BUFF); } + bool IsLfgRandomInstance() const { return isLFGGroup() && (m_lfgGroupFlags & GROUP_LFG_FLAG_IS_RANDOM_INSTANCE); } + bool IsLfgHeroic() const { return isLFGGroup() && (m_lfgGroupFlags & GROUP_LFG_FLAG_IS_HEROIC); } - // Difficulty Change - uint32 GetDifficultyChangePreventionTime() const { return _difficultyChangePreventionTime > time(NULL) ? _difficultyChangePreventionTime - time(NULL) : 0; } - DifficultyPreventionChangeType GetDifficultyChangePreventionReason() const { return _difficultyChangePreventionType; } - void SetDifficultyChangePrevention(DifficultyPreventionChangeType type) - { - _difficultyChangePreventionTime = time(NULL) + MINUTE; - _difficultyChangePreventionType = type; - } + // Difficulty Change + uint32 GetDifficultyChangePreventionTime() const { return _difficultyChangePreventionTime > time(NULL) ? _difficultyChangePreventionTime - time(NULL) : 0; } + DifficultyPreventionChangeType GetDifficultyChangePreventionReason() const { return _difficultyChangePreventionType; } + void SetDifficultyChangePrevention(DifficultyPreventionChangeType type) + { + _difficultyChangePreventionTime = time(NULL) + MINUTE; + _difficultyChangePreventionType = type; + } protected: void _homebindIfInstance(Player* player); @@ -352,8 +352,8 @@ class Group uint32 m_maxEnchantingLevel; uint8 m_lfgGroupFlags; - // Xinef: change difficulty prevention - uint32 _difficultyChangePreventionTime; - DifficultyPreventionChangeType _difficultyChangePreventionType; + // Xinef: change difficulty prevention + uint32 _difficultyChangePreventionTime; + DifficultyPreventionChangeType _difficultyChangePreventionType; }; #endif diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index 9de062614..e80e0c83f 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -49,10 +49,10 @@ void GroupMgr::RegisterGroupId(uint32 groupId) // Allocation was done in InitGroupIds() _groupIds[groupId] = true; - // Groups are pulled in ascending order from db and _nextGroupId is initialized with 1, + // Groups are pulled in ascending order from db and _nextGroupId is initialized with 1, // so if the instance id is used, increment - if (_nextGroupId == groupId) - ++_nextGroupId; + if (_nextGroupId == groupId) + ++_nextGroupId; } uint32 GroupMgr::GenerateGroupId() @@ -60,7 +60,7 @@ uint32 GroupMgr::GenerateGroupId() uint32 newGroupId = _nextGroupId; // find the lowest available id starting from the current _nextGroupId - while (_nextGroupId < 0xFFFFFFFF && ++_nextGroupId < _groupIds.size() && _groupIds[_nextGroupId]); + while (_nextGroupId < 0xFFFFFFFF && ++_nextGroupId < _groupIds.size() && _groupIds[_nextGroupId]); if (_nextGroupId == 0xFFFFFFFF) { @@ -99,45 +99,45 @@ void GroupMgr::LoadGroups() CharacterDatabase.DirectExecute("DELETE FROM groups WHERE leaderGuid NOT IN (SELECT guid FROM characters)"); // Delete all groups with less than 2 members (or less than 1 for lfg groups) CharacterDatabase.DirectExecute("DELETE groups FROM groups LEFT JOIN ((SELECT guid, count(*) as cnt FROM group_member GROUP BY guid) t) ON groups.guid = t.guid WHERE t.guid IS NULL OR (t.cnt<=1 AND groups.groupType <> 12)"); - // Delete invalid lfg_data - CharacterDatabase.DirectExecute("DELETE lfg_data FROM lfg_data LEFT JOIN groups ON lfg_data.guid = groups.guid WHERE groups.guid IS NULL OR groups.groupType <> 12"); - // CharacterDatabase.DirectExecute("DELETE groups FROM groups LEFT JOIN lfg_data ON groups.guid = lfg_data.guid WHERE groups.groupType=12 AND lfg_data.guid IS NULL"); // group should be left so binds are cleared when disbanded + // Delete invalid lfg_data + CharacterDatabase.DirectExecute("DELETE lfg_data FROM lfg_data LEFT JOIN groups ON lfg_data.guid = groups.guid WHERE groups.guid IS NULL OR groups.groupType <> 12"); + // CharacterDatabase.DirectExecute("DELETE groups FROM groups LEFT JOIN lfg_data ON groups.guid = lfg_data.guid WHERE groups.groupType=12 AND lfg_data.guid IS NULL"); // group should be left so binds are cleared when disbanded - InitGroupIds(); + InitGroupIds(); // 0 1 2 3 4 5 6 7 8 9 QueryResult result = CharacterDatabase.Query("SELECT g.leaderGuid, g.lootMethod, g.looterGuid, g.lootThreshold, g.icon1, g.icon2, g.icon3, g.icon4, g.icon5, g.icon6" // 10 11 12 13 14 15 16 17 18 ", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.masterLooterGuid, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC"); - if (!result) + if (!result) { sLog->outString(">> Loaded 0 group definitions. DB table `groups` is empty!"); sLog->outString(); } - else - { - uint32 count = 0; - do - { - Field* fields = result->Fetch(); - Group* group = new Group; - if (!group->LoadGroupFromDB(fields)) - { - delete group; - continue; - } - AddGroup(group); + else + { + uint32 count = 0; + do + { + Field* fields = result->Fetch(); + Group* group = new Group; + if (!group->LoadGroupFromDB(fields)) + { + delete group; + continue; + } + AddGroup(group); - RegisterGroupId(group->GetLowGUID()); + RegisterGroupId(group->GetLowGUID()); - ++count; - } - while (result->NextRow()); + ++count; + } + while (result->NextRow()); - sLog->outString(">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); - } + sLog->outString(">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(); + } } sLog->outString("Loading Group members..."); @@ -156,25 +156,25 @@ void GroupMgr::LoadGroups() sLog->outString(">> Loaded 0 group members. DB table `group_member` is empty!"); sLog->outString(); } - else - { - uint32 count = 0; - do - { - Field* fields = result->Fetch(); - Group* group = GetGroupByGUID(fields[0].GetUInt32()); + else + { + uint32 count = 0; + do + { + Field* fields = result->Fetch(); + Group* group = GetGroupByGUID(fields[0].GetUInt32()); - if (group) - group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8()); - //else - // sLog->outError("GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32()); + if (group) + group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8()); + //else + // sLog->outError("GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32()); - ++count; - } - while (result->NextRow()); + ++count; + } + while (result->NextRow()); - sLog->outString(">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); - } + sLog->outString(">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(); + } } } diff --git a/src/server/game/Groups/GroupMgr.h b/src/server/game/Groups/GroupMgr.h index 697f19e50..33a63c701 100644 --- a/src/server/game/Groups/GroupMgr.h +++ b/src/server/game/Groups/GroupMgr.h @@ -32,7 +32,7 @@ public: Group* GetGroupByGUID(uint32 guid) const; - void InitGroupIds(); + void InitGroupIds(); void RegisterGroupId(uint32 groupId); uint32 GenerateGroupId(); @@ -42,8 +42,8 @@ public: protected: - typedef std::vector GroupIds; - GroupIds _groupIds; + typedef std::vector GroupIds; + GroupIds _groupIds; uint32 _nextGroupId; GroupContainer GroupStore; }; diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 1848f9245..8c531ac6a 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -1504,7 +1504,7 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name) if (pInvitee->GetSocial()->HasIgnore(player->GetGUIDLow())) return; - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && pInvitee->GetTeamId() != player->GetTeamId()) + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && pInvitee->GetTeamId() != player->GetTeamId()) { SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_NOT_ALLIED, name); return; @@ -1546,8 +1546,8 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name) void Guild::HandleAcceptMember(WorldSession* session) { Player* player = session->GetPlayer(); - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && - player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(GetLeaderGUID())) + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && + player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(GetLeaderGUID())) return; AddMember(player->GetGUID()); @@ -1730,8 +1730,8 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) std::string aux = ByteArrayToHexStr(reinterpret_cast(&m_bankMoney), 8, true); _BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str()); - if (amount > 10*GOLD) - CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \" %s (guild id: %u, members: %u, new amount: "UI64FMTD", leader guid low: %u, char level: %u)\", NOW())", session->GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), session->GetRemoteAddress().c_str(), 0, "", amount, GetName().c_str(), GetId(), GetMemberCount(), GetTotalBankMoney(), (uint32)(GetLeaderGUID()&0xFFFFFFFF), player->getLevel()); + if (amount > 10*GOLD) + CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \" %s (guild id: %u, members: %u, new amount: "UI64FMTD", leader guid low: %u, char level: %u)\", NOW())", session->GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), session->GetRemoteAddress().c_str(), 0, "", amount, GetName().c_str(), GetId(), GetMemberCount(), GetTotalBankMoney(), (uint32)(GetLeaderGUID()&0xFFFFFFFF), player->getLevel()); } bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair) @@ -1773,8 +1773,8 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool _LogBankEvent(trans, repair ? GUILD_BANK_LOG_REPAIR_MONEY : GUILD_BANK_LOG_WITHDRAW_MONEY, uint8(0), player->GetGUIDLow(), amount); CharacterDatabase.CommitTransaction(trans); - if (amount > 10*GOLD) - CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \" %s (guild id: %u, members: %u, new amount: "UI64FMTD", leader guid low: %u, char level: %u)\", NOW())", session->GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), session->GetRemoteAddress().c_str(), 0, "", amount, GetName().c_str(), GetId(), GetMemberCount(), GetTotalBankMoney(), (uint32)(GetLeaderGUID()&0xFFFFFFFF), player->getLevel()); + if (amount > 10*GOLD) + CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \" %s (guild id: %u, members: %u, new amount: "UI64FMTD", leader guid low: %u, char level: %u)\", NOW())", session->GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), session->GetRemoteAddress().c_str(), 0, "", amount, GetName().c_str(), GetId(), GetMemberCount(), GetTotalBankMoney(), (uint32)(GetLeaderGUID()&0xFFFFFFFF), player->getLevel()); std::string aux = ByteArrayToHexStr(reinterpret_cast(&m_bankMoney), 8, true); _BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str()); @@ -1960,7 +1960,7 @@ bool Guild::LoadMemberFromDB(Field* fields) return false; } m_members[lowguid] = member; - sWorld->UpdateGlobalPlayerGuild(lowguid, GetId()); + sWorld->UpdateGlobalPlayerGuild(lowguid, GetId()); return true; } @@ -2224,7 +2224,7 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) member->ResetFlags(); bool ok = false; - // xinef: zomg! sync query + // xinef: zomg! sync query // Player must exist PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DATA_FOR_GUILD); stmt->setUInt32(0, lowguid); @@ -2247,7 +2247,7 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) return false; } m_members[lowguid] = member; - sWorld->UpdateGlobalPlayerGuild(lowguid, m_id); + sWorld->UpdateGlobalPlayerGuild(lowguid, m_id); } SQLTransaction trans(NULL); @@ -2316,8 +2316,8 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked, bool can player->SetInGuild(0); player->SetRank(0); } - else - sWorld->UpdateGlobalPlayerGuild(lowguid, 0); + else + sWorld->UpdateGlobalPlayerGuild(lowguid, 0); _DeleteMemberFromDB(lowguid); if (!isDisbanding) diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index 892acb164..5fda1d63e 100644 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -755,9 +755,9 @@ public: void SwapItems(Player* player, uint8 tabId, uint8 slotId, uint8 destTabId, uint8 destSlotId, uint32 splitedAmount); void SwapItemsWithInventory(Player* player, bool toChar, uint8 tabId, uint8 slotId, uint8 playerBag, uint8 playerSlotId, uint32 splitedAmount); - // pussywizard - uint64 GetTotalBankMoney() const { return m_bankMoney; } - uint32 GetMemberCount() const { return m_members.size(); } + // pussywizard + uint64 GetTotalBankMoney() const { return m_bankMoney; } + uint32 GetMemberCount() const { return m_members.size(); } // Bank tabs void SetBankTabText(uint8 tabId, std::string const& text); diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index 51c2a9d10..7db16a804 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -95,7 +95,7 @@ void GuildMgr::LoadGuilds() { uint32 oldMSTime = getMSTime(); - CharacterDatabase.DirectExecute("DELETE g FROM guild g LEFT JOIN guild_member gm ON g.guildid = gm.guildid WHERE gm.guildid IS NULL"); + CharacterDatabase.DirectExecute("DELETE g FROM guild g LEFT JOIN guild_member gm ON g.guildid = gm.guildid WHERE gm.guildid IS NULL"); // 0 1 2 3 4 5 6 QueryResult result = CharacterDatabase.Query("SELECT g.guildid, g.name, g.leaderguid, g.EmblemStyle, g.EmblemColor, g.BorderStyle, g.BorderColor, " diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp index 51c9e2605..8e13137c7 100644 --- a/src/server/game/Handlers/ArenaTeamHandler.cpp +++ b/src/server/game/Handlers/ArenaTeamHandler.cpp @@ -102,7 +102,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData) if (player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { - SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", invitedName, ERR_ARENA_TEAM_TARGET_TOO_LOW_S); + SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", invitedName, ERR_ARENA_TEAM_TARGET_TOO_LOW_S); return; } @@ -123,15 +123,15 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData) if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow())) return; - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeamId() != GetPlayer()->GetTeamId()) - { - SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED); - return; - } + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeamId() != GetPlayer()->GetTeamId()) + { + SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED); + return; + } if (player->GetArenaTeamId(arenaTeam->GetSlot())) { - SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", invitedName, ERR_ALREADY_IN_ARENA_TEAM_S); + SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", invitedName, ERR_ALREADY_IN_ARENA_TEAM_S); return; } @@ -174,12 +174,12 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recvData*/) return; } - // Only allow members of the other faction to join the team if cross faction interaction is enabled - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(arenaTeam->GetCaptain())) - { - SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED); - return; - } + // Only allow members of the other faction to join the team if cross faction interaction is enabled + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(arenaTeam->GetCaptain())) + { + SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED); + return; + } // Add player to team if (!arenaTeam->AddMember(_player->GetGUID())) diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index fcbf36bee..6342be719 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -121,9 +121,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData) recvData >> itemsCount; uint64 itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot - memset(itemGUIDs, 0, sizeof(itemGUIDs)); + memset(itemGUIDs, 0, sizeof(itemGUIDs)); uint32 count[MAX_AUCTION_ITEMS]; - memset(count, 0, sizeof(count)); + memset(count, 0, sizeof(count)); if (itemsCount > MAX_AUCTION_ITEMS) { @@ -190,7 +190,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData) Item* items[MAX_AUCTION_ITEMS]; uint32 finalCount = 0; - uint32 itemEntry = 0; + uint32 itemEntry = 0; for (uint32 i = 0; i < itemsCount; ++i) { @@ -266,10 +266,10 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData) AuctionEntry* AH = new AuctionEntry; AH->Id = sObjectMgr->GenerateAuctionID(); - if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) - AH->auctioneer = 23442; - else - AH->auctioneer = GUID_LOPART(auctioneer); + if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) + AH->auctioneer = 23442; + else + AH->auctioneer = GUID_LOPART(auctioneer); // Required stack size of auction matches to current item stack size, just move item to auctionhouse if (itemsCount == 1 && item->GetCount() == count[i]) @@ -635,17 +635,17 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recvData) //this void sends player info about his auctions void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recvData) { - // pussywizard: - const uint32 delay = 4500; - const uint32 now = World::GetGameTimeMS(); - if (_lastAuctionListOwnerItemsMSTime > now) // list is pending - return; - uint32 diff = getMSTimeDiff(_lastAuctionListOwnerItemsMSTime, now); - if (diff > delay) - diff = delay; + // pussywizard: + const uint32 delay = 4500; + const uint32 now = World::GetGameTimeMS(); + if (_lastAuctionListOwnerItemsMSTime > now) // list is pending + return; + uint32 diff = getMSTimeDiff(_lastAuctionListOwnerItemsMSTime, now); + if (diff > delay) + diff = delay; - _lastAuctionListOwnerItemsMSTime = now + delay; // set longest possible here, actual exectuing will change this to getMSTime of that moment - _player->m_Events.AddEvent(new AuctionListOwnerItemsDelayEvent(recvData, _player->GetGUID(), true), _player->m_Events.CalculateTime(delay-diff)); + _lastAuctionListOwnerItemsMSTime = now + delay; // set longest possible here, actual exectuing will change this to getMSTime of that moment + _player->m_Events.AddEvent(new AuctionListOwnerItemsDelayEvent(recvData, _player->GetGUID(), true), _player->m_Events.CalculateTime(delay-diff)); } void WorldSession::HandleAuctionListOwnerItemsEvent(WorldPacket & recvData) @@ -717,19 +717,19 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recvData) recvData.read_skip(); } - // remove fake death - if (_player->HasUnitState(UNIT_STATE_DIED)) - _player->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); + // remove fake death + if (_player->HasUnitState(UNIT_STATE_DIED)) + _player->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - // pussywizard: - const uint32 delay = 2000; - const uint32 now = World::GetGameTimeMS(); - uint32 diff = getMSTimeDiff(_lastAuctionListItemsMSTime, now); - if (diff > delay) - diff = delay; - _lastAuctionListItemsMSTime = now + delay - diff; - TRINITY_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetTempLock()); - AsyncAuctionListingMgr::GetTempList().push_back( AuctionListItemsDelayEvent(delay-diff, _player->GetGUID(), guid, searchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, getAll) ); + // pussywizard: + const uint32 delay = 2000; + const uint32 now = World::GetGameTimeMS(); + uint32 diff = getMSTimeDiff(_lastAuctionListItemsMSTime, now); + if (diff > delay) + diff = delay; + _lastAuctionListItemsMSTime = now + delay - diff; + TRINITY_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetTempLock()); + AsyncAuctionListingMgr::GetTempList().push_back( AuctionListItemsDelayEvent(delay-diff, _player->GetGUID(), guid, searchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, getAll) ); } void WorldSession::HandleAuctionListPendingSales(WorldPacket & recvData) diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 0b4017b0f..585763545 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -82,25 +82,25 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) recvData >> instanceId; // instance id, 0 if First Available selected recvData >> joinAsGroup; // join as group - // entry not found + // entry not found if (!sBattlemasterListStore.LookupEntry(bgTypeId_)) return; - // chosen battleground type is disabled + // chosen battleground type is disabled if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId_, NULL)) { ChatHandler(this).PSendSysMessage(LANG_BG_DISABLED); return; } - // get queue typeid and random typeid to check if already queued for them + // get queue typeid and random typeid to check if already queued for them BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_); BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, 0); BattlegroundQueueTypeId bgQueueTypeIdRandom = BattlegroundMgr::BGQueueTypeId(BATTLEGROUND_RB, 0); - // safety check - bgQueueTypeId == BATTLEGROUND_QUEUE_NONE if tried to queue for arena using this function - if (bgQueueTypeId == BATTLEGROUND_QUEUE_NONE) - return; + // safety check - bgQueueTypeId == BATTLEGROUND_QUEUE_NONE if tried to queue for arena using this function + if (bgQueueTypeId == BATTLEGROUND_QUEUE_NONE) + return; // get bg template Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId); @@ -112,62 +112,62 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) if (!bracketEntry) return; - // pussywizard: if trying to queue for already queued - // just remove from queue and it will requeue! - uint32 qSlot = _player->GetBattlegroundQueueIndex(bgQueueTypeId); - if (qSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) - { - BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); + // pussywizard: if trying to queue for already queued + // just remove from queue and it will requeue! + uint32 qSlot = _player->GetBattlegroundQueueIndex(bgQueueTypeId); + if (qSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) + { + BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); - if (bgQueue.IsPlayerInvitedToRatedArena(_player->GetGUID())) - { - WorldPacket data; - sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_JOIN_FAILED); - SendPacket(&data); - return; - } + if (bgQueue.IsPlayerInvitedToRatedArena(_player->GetGUID())) + { + WorldPacket data; + sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_JOIN_FAILED); + SendPacket(&data); + return; + } - bgQueue.RemovePlayer(_player->GetGUID(), false, qSlot); - _player->RemoveBattlegroundQueueId(bgQueueTypeId); - } + bgQueue.RemovePlayer(_player->GetGUID(), false, qSlot); + _player->RemoveBattlegroundQueueId(bgQueueTypeId); + } - // must have free queue slot - if (!_player->HasFreeBattlegroundQueueId()) - { + // must have free queue slot + if (!_player->HasFreeBattlegroundQueueId()) + { WorldPacket data; sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_TOO_MANY_QUEUES); SendPacket(&data); return; - } + } - // queue result (default ok) - GroupJoinBattlegroundResult err = GroupJoinBattlegroundResult(bgt->GetBgTypeID()); + // queue result (default ok) + GroupJoinBattlegroundResult err = GroupJoinBattlegroundResult(bgt->GetBgTypeID()); // check if player can queue: if (!joinAsGroup) { - if (GetPlayer()->InBattleground()) // currently in battleground + if (GetPlayer()->InBattleground()) // currently in battleground err = ERR_BATTLEGROUND_NOT_IN_BATTLEGROUND; - else if (GetPlayer()->isUsingLfg()) // using lfg system + else if (GetPlayer()->isUsingLfg()) // using lfg system err = ERR_LFG_CANT_USE_BATTLEGROUND; - else if (!_player->CanJoinToBattleground()) // has deserter debuff + else if (!_player->CanJoinToBattleground()) // has deserter debuff err = ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS; - else if (_player->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeIdRandom)) // queued for random bg, so can't queue for anything else + else if (_player->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeIdRandom)) // queued for random bg, so can't queue for anything else err = ERR_IN_RANDOM_BG; - else if (_player->InBattlegroundQueue() && bgTypeId == BATTLEGROUND_RB) // already in queue, so can't queue for random + else if (_player->InBattlegroundQueue() && bgTypeId == BATTLEGROUND_RB) // already in queue, so can't queue for random err = ERR_IN_NON_RANDOM_BG; - else if (_player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_2v2) || - _player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_3v3) || - _player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_5v5)) // can't be already queued for arenas - err = ERR_BATTLEGROUND_QUEUED_FOR_RATED; + else if (_player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_2v2) || + _player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_3v3) || + _player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_5v5)) // can't be already queued for arenas + err = ERR_BATTLEGROUND_QUEUED_FOR_RATED; - if (err <= 0) - { + if (err <= 0) + { WorldPacket data; sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err); SendPacket(&data); return; - } + } BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bracketEntry, false, false, 0, 0, 0); @@ -175,12 +175,12 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) uint32 queueSlot = _player->AddBattlegroundQueueId(bgQueueTypeId); - // send status packet + // send status packet WorldPacket data; sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bgt, queueSlot, STATUS_WAIT_QUEUE, avgWaitTime, 0, 0, TEAM_NEUTRAL); SendPacket(&data); } - // check if group can queue: + // check if group can queue: else { Group* grp = _player->GetGroup(); @@ -188,48 +188,48 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData) if (!grp || grp->GetLeaderGUID() != _player->GetGUID()) return; - // pussywizard: for party members - remove queues for which leader is not queued to! - std::set leaderQueueTypeIds; - for (uint32 i=0; iGetBattlegroundQueueTypeId(i)); - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) - if (Player* member = itr->GetSource()) - for (uint32 i=0; iGetBattlegroundQueueTypeId(i)) - if (leaderQueueTypeIds.count((uint32)mqtid) == 0) - { - BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(mqtid); + // pussywizard: for party members - remove queues for which leader is not queued to! + std::set leaderQueueTypeIds; + for (uint32 i=0; iGetBattlegroundQueueTypeId(i)); + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Player* member = itr->GetSource()) + for (uint32 i=0; iGetBattlegroundQueueTypeId(i)) + if (leaderQueueTypeIds.count((uint32)mqtid) == 0) + { + BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(mqtid); - if (bgQueue.IsPlayerInvitedToRatedArena(member->GetGUID())) - { - WorldPacket data; - sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_JOIN_FAILED); - SendPacket(&data); - return; - } + if (bgQueue.IsPlayerInvitedToRatedArena(member->GetGUID())) + { + WorldPacket data; + sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_JOIN_FAILED); + SendPacket(&data); + return; + } - bgQueue.RemovePlayer(member->GetGUID(), false, i); - member->RemoveBattlegroundQueueId(mqtid); - } + bgQueue.RemovePlayer(member->GetGUID(), false, i); + member->RemoveBattlegroundQueueId(mqtid); + } - if (_player->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeIdRandom)) // queued for random bg, so can't queue for anything else + if (_player->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeIdRandom)) // queued for random bg, so can't queue for anything else err = ERR_IN_RANDOM_BG; - else if (_player->InBattlegroundQueue() && bgTypeId == BATTLEGROUND_RB) // already in queue, so can't queue for random + else if (_player->InBattlegroundQueue() && bgTypeId == BATTLEGROUND_RB) // already in queue, so can't queue for random err = ERR_IN_NON_RANDOM_BG; - else if (_player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_2v2) || - _player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_3v3) || - _player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_5v5)) // can't be already queued for arenas - err = ERR_BATTLEGROUND_QUEUED_FOR_RATED; + else if (_player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_2v2) || + _player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_3v3) || + _player->InBattlegroundQueueForBattlegroundQueueType(BATTLEGROUND_QUEUE_5v5)) // can't be already queued for arenas + err = ERR_BATTLEGROUND_QUEUED_FOR_RATED; - if (err > 0) - err = grp->CanJoinBattlegroundQueue(bgt, bgQueueTypeId, 0, bgt->GetMaxPlayersPerTeam(), false, 0); + if (err > 0) + err = grp->CanJoinBattlegroundQueue(bgt, bgQueueTypeId, 0, bgt->GetMaxPlayersPerTeam(), false, 0); bool isPremade = (grp->GetMembersCount() >= bgt->GetMinPlayersPerTeam() && bgTypeId != BATTLEGROUND_RB); uint32 avgWaitTime = 0; if (err > 0) { - BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); + BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, grp, bracketEntry, false, isPremade, 0, 0, 0); avgWaitTime = bgQueue.GetAverageQueueWaitTime(ginfo); } @@ -362,11 +362,11 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) recvData >> arenaType >> unk2 >> bgTypeId_ >> unk >> action; - // bgTypeId not valid + // bgTypeId not valid if (!sBattlemasterListStore.LookupEntry(bgTypeId_)) return; - // player not in any queue, so can't really answer + // player not in any queue, so can't really answer if (!_player->InBattlegroundQueue()) return; @@ -414,49 +414,49 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) action = 0; } - // get player queue slot index for this bg (can be in up to 2 queues at the same time) + // get player queue slot index for this bg (can be in up to 2 queues at the same time) uint32 queueSlot = _player->GetBattlegroundQueueIndex(bgQueueTypeId); WorldPacket data; switch (action) { case 1: // accept - { - // set entry point if not in battleground - if (!_player->InBattleground()) - _player->SetEntryPoint(); + { + // set entry point if not in battleground + if (!_player->InBattleground()) + _player->SetEntryPoint(); - // resurrect the player - if (!_player->IsAlive()) - { - _player->ResurrectPlayer(1.0f); - _player->SpawnCorpseBones(); - } + // resurrect the player + if (!_player->IsAlive()) + { + _player->ResurrectPlayer(1.0f); + _player->SpawnCorpseBones(); + } - // remove player from all bg queues - for (uint32 qslot = 0; qslot < PLAYER_MAX_BATTLEGROUND_QUEUES; ++qslot) - if (BattlegroundQueueTypeId q = _player->GetBattlegroundQueueTypeId(qslot)) - { - BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(q); - queue.RemovePlayer(_player->GetGUID(), (bgQueueTypeId == q), qslot); - _player->RemoveBattlegroundQueueId(q); - } + // remove player from all bg queues + for (uint32 qslot = 0; qslot < PLAYER_MAX_BATTLEGROUND_QUEUES; ++qslot) + if (BattlegroundQueueTypeId q = _player->GetBattlegroundQueueTypeId(qslot)) + { + BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(q); + queue.RemovePlayer(_player->GetGUID(), (bgQueueTypeId == q), qslot); + _player->RemoveBattlegroundQueueId(q); + } - // send status packet - sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType(), ginfo.teamId); - SendPacket(&data); + // send status packet + sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType(), ginfo.teamId); + SendPacket(&data); - _player->SetBattlegroundId(bg->GetInstanceID(), bg->GetBgTypeID(), queueSlot, true, bgTypeId == BATTLEGROUND_RB, ginfo.teamId); + _player->SetBattlegroundId(bg->GetInstanceID(), bg->GetBgTypeID(), queueSlot, true, bgTypeId == BATTLEGROUND_RB, ginfo.teamId); - sBattlegroundMgr->SendToBattleground(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId); - } + sBattlegroundMgr->SendToBattleground(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId); + } break; case 0: // leave queue - { - bgQueue.RemovePlayer(_player->GetGUID(), false, queueSlot); - _player->RemoveBattlegroundQueueId(bgQueueTypeId); - } - break; + { + bgQueue.RemovePlayer(_player->GetGUID(), false, queueSlot); + _player->RemoveBattlegroundQueueId(bgQueueTypeId); + } + break; default: break; } @@ -482,63 +482,63 @@ void WorldSession::HandleBattlefieldLeaveOpcode(WorldPacket& recvData) void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/) { - // requested at login and on map change - // send status for current queues and current bg + // requested at login and on map change + // send status for current queues and current bg - WorldPacket data; + WorldPacket data; - // for current bg send STATUS_IN_PROGRESS - if (Battleground* bg = _player->GetBattleground()) - if (bg->GetPlayers().count(_player->GetGUID())) - { - sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, _player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, bg->GetEndTime(), bg->GetStartTime(), bg->GetArenaType(), _player->GetBgTeamId()); - SendPacket(&data); - } + // for current bg send STATUS_IN_PROGRESS + if (Battleground* bg = _player->GetBattleground()) + if (bg->GetPlayers().count(_player->GetGUID())) + { + sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, _player->GetCurrentBattlegroundQueueSlot(), STATUS_IN_PROGRESS, bg->GetEndTime(), bg->GetStartTime(), bg->GetArenaType(), _player->GetBgTeamId()); + SendPacket(&data); + } - // for queued bgs send STATUS_WAIT_JOIN or STATUS_WAIT_QUEUE - for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) - { - // check if in queue - BattlegroundQueueTypeId bgQueueTypeId = _player->GetBattlegroundQueueTypeId(i); - if (!bgQueueTypeId) - continue; + // for queued bgs send STATUS_WAIT_JOIN or STATUS_WAIT_QUEUE + for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) + { + // check if in queue + BattlegroundQueueTypeId bgQueueTypeId = _player->GetBattlegroundQueueTypeId(i); + if (!bgQueueTypeId) + continue; - // get group info from queue - BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); - GroupQueueInfo ginfo; - if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo)) - continue; + // get group info from queue + BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); + GroupQueueInfo ginfo; + if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo)) + continue; BattlegroundTypeId bgTypeId = BattlegroundMgr::BGTemplateId(bgQueueTypeId); - // if invited - send STATUS_WAIT_JOIN - if (ginfo.IsInvitedToBGInstanceGUID) - { - Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID); - if (!bg) - continue; + // if invited - send STATUS_WAIT_JOIN + if (ginfo.IsInvitedToBGInstanceGUID) + { + Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID); + if (!bg) + continue; - uint32 remainingTime = (World::GetGameTimeMS() < ginfo.RemoveInviteTime ? getMSTimeDiff(World::GetGameTimeMS(), ginfo.RemoveInviteTime) : 1); - sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, i, STATUS_WAIT_JOIN, remainingTime, 0, ginfo.ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo.BgTypeId); - SendPacket(&data); - } - // if not invited - send STATUS_WAIT_QUEUE - else - { - Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId); - if (!bgt) - continue; + uint32 remainingTime = (World::GetGameTimeMS() < ginfo.RemoveInviteTime ? getMSTimeDiff(World::GetGameTimeMS(), ginfo.RemoveInviteTime) : 1); + sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, i, STATUS_WAIT_JOIN, remainingTime, 0, ginfo.ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo.BgTypeId); + SendPacket(&data); + } + // if not invited - send STATUS_WAIT_QUEUE + else + { + Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId); + if (!bgt) + continue; - // expected bracket entry - PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgt->GetMapId(), _player->getLevel()); - if (!bracketEntry) - continue; + // expected bracket entry + PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgt->GetMapId(), _player->getLevel()); + if (!bracketEntry) + continue; - uint32 avgWaitTime = bgQueue.GetAverageQueueWaitTime(&ginfo); - sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bgt, i, STATUS_WAIT_QUEUE, avgWaitTime, getMSTimeDiff(ginfo.JoinTime, World::GetGameTimeMS()), ginfo.ArenaType, TEAM_NEUTRAL, ginfo.IsRated); - SendPacket(&data); - } - } + uint32 avgWaitTime = bgQueue.GetAverageQueueWaitTime(&ginfo); + sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bgt, i, STATUS_WAIT_QUEUE, avgWaitTime, getMSTimeDiff(ginfo.JoinTime, World::GetGameTimeMS()), ginfo.ArenaType, TEAM_NEUTRAL, ginfo.IsRated); + SendPacket(&data); + } + } } void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) @@ -550,16 +550,16 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) recvData >> guid >> arenaslot >> asGroup >> isRated; - // can't queue for rated without a group - if (isRated && !asGroup) - return; - - // find creature by guid - Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); - if (!unit || !unit->IsBattleMaster()) + // can't queue for rated without a group + if (isRated && !asGroup) return; - // get arena type + // find creature by guid + Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); + if (!unit || !unit->IsBattleMaster()) + return; + + // get arena type uint8 arenatype = 0; switch (arenaslot) { @@ -581,7 +581,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) if (!bgt) return; - // arenas disabled + // arenas disabled if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, BATTLEGROUND_AA, NULL)) { ChatHandler(this).PSendSysMessage(LANG_ARENA_DISABLED); @@ -591,60 +591,60 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) BattlegroundTypeId bgTypeId = bgt->GetBgTypeID(); BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, arenatype); - // expected bracket entry + // expected bracket entry PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgt->GetMapId(), _player->getLevel()); if (!bracketEntry) return; - // pussywizard: if trying to queue for already queued - // just remove from queue and it will requeue! - uint32 qSlot = _player->GetBattlegroundQueueIndex(bgQueueTypeId); - if (qSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) - { - BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); + // pussywizard: if trying to queue for already queued + // just remove from queue and it will requeue! + uint32 qSlot = _player->GetBattlegroundQueueIndex(bgQueueTypeId); + if (qSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) + { + BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); - if (bgQueue.IsPlayerInvitedToRatedArena(_player->GetGUID())) - { - WorldPacket data; - sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_JOIN_FAILED); - SendPacket(&data); - return; - } + if (bgQueue.IsPlayerInvitedToRatedArena(_player->GetGUID())) + { + WorldPacket data; + sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_JOIN_FAILED); + SendPacket(&data); + return; + } - bgQueue.RemovePlayer(_player->GetGUID(), false, qSlot); - _player->RemoveBattlegroundQueueId(bgQueueTypeId); - } + bgQueue.RemovePlayer(_player->GetGUID(), false, qSlot); + _player->RemoveBattlegroundQueueId(bgQueueTypeId); + } - // must have free queue slot - // pussywizard: allow being queued only in one arena queue, and it even cannot be together with bg queues - if (_player->InBattlegroundQueue()) - { + // must have free queue slot + // pussywizard: allow being queued only in one arena queue, and it even cannot be together with bg queues + if (_player->InBattlegroundQueue()) + { WorldPacket data; sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_CANNOT_QUEUE_FOR_RATED); SendPacket(&data); return; - } + } - // queue result (default ok) + // queue result (default ok) GroupJoinBattlegroundResult err = GroupJoinBattlegroundResult(bgt->GetBgTypeID()); - // check if player can queue: - if (!asGroup) + // check if player can queue: + if (!asGroup) { - if (GetPlayer()->InBattleground()) // currently in battleground + if (GetPlayer()->InBattleground()) // currently in battleground err = ERR_BATTLEGROUND_NOT_IN_BATTLEGROUND; - else if (GetPlayer()->isUsingLfg()) // using lfg system + else if (GetPlayer()->isUsingLfg()) // using lfg system err = ERR_LFG_CANT_USE_BATTLEGROUND; - if (err <= 0) - { + if (err <= 0) + { WorldPacket data; sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err); SendPacket(&data); return; - } + } - BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); + BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bracketEntry, false, false, 0, 0, 0); uint32 avgWaitTime = bgQueue.GetAverageQueueWaitTime(ginfo); @@ -654,73 +654,73 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bgt, queueSlot, STATUS_WAIT_QUEUE, avgWaitTime, 0, arenatype, TEAM_NEUTRAL); SendPacket(&data); } - // check if group can queue: - else + // check if group can queue: + else { - Group* grp = _player->GetGroup(); + Group* grp = _player->GetGroup(); // no group or not a leader if (!grp || grp->GetLeaderGUID() != _player->GetGUID()) return; - // pussywizard: for party members - remove queues for which leader is not queued to! - std::set leaderQueueTypeIds; - for (uint32 i=0; iGetBattlegroundQueueTypeId(i)); - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) - if (Player* member = itr->GetSource()) - for (uint32 i=0; iGetBattlegroundQueueTypeId(i)) - if (leaderQueueTypeIds.count((uint32)mqtid) == 0) - { - BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(mqtid); + // pussywizard: for party members - remove queues for which leader is not queued to! + std::set leaderQueueTypeIds; + for (uint32 i=0; iGetBattlegroundQueueTypeId(i)); + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Player* member = itr->GetSource()) + for (uint32 i=0; iGetBattlegroundQueueTypeId(i)) + if (leaderQueueTypeIds.count((uint32)mqtid) == 0) + { + BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(mqtid); - if (bgQueue.IsPlayerInvitedToRatedArena(member->GetGUID())) - { - WorldPacket data; - sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_JOIN_FAILED); - SendPacket(&data); - return; - } + if (bgQueue.IsPlayerInvitedToRatedArena(member->GetGUID())) + { + WorldPacket data; + sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_JOIN_FAILED); + SendPacket(&data); + return; + } - bgQueue.RemovePlayer(member->GetGUID(), false, i); - member->RemoveBattlegroundQueueId(mqtid); - } + bgQueue.RemovePlayer(member->GetGUID(), false, i); + member->RemoveBattlegroundQueueId(mqtid); + } - uint32 ateamId = 0; - uint32 arenaRating = 0; - uint32 matchmakerRating = 0; + uint32 ateamId = 0; + uint32 arenaRating = 0; + uint32 matchmakerRating = 0; - // additional checks for rated arenas - if (isRated) - { - // pussywizard: for rated matches check if season is in progress! - if (!sWorld->getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS)) - return; + // additional checks for rated arenas + if (isRated) + { + // pussywizard: for rated matches check if season is in progress! + if (!sWorld->getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS)) + return; - ateamId = _player->GetArenaTeamId(arenaslot); + ateamId = _player->GetArenaTeamId(arenaslot); - // check team existence - ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ateamId); - if (!at) - { - SendNotInArenaTeamPacket(arenatype); - return; - } + // check team existence + ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ateamId); + if (!at) + { + SendNotInArenaTeamPacket(arenatype); + return; + } - // get team rating for queueing - arenaRating = at->GetRating(); - matchmakerRating = at->GetAverageMMR(grp); - if (arenaRating <= 0) - arenaRating = 1; - } + // get team rating for queueing + arenaRating = at->GetRating(); + matchmakerRating = at->GetAverageMMR(grp); + if (arenaRating <= 0) + arenaRating = 1; + } err = grp->CanJoinBattlegroundQueue(bgt, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot); uint32 avgWaitTime = 0; if (err > 0) { - BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); + BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId); GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, grp, bracketEntry, isRated, false, arenaRating, matchmakerRating, ateamId); avgWaitTime = bgQueue.GetAverageQueueWaitTime(ginfo); } @@ -749,9 +749,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData) member->GetSession()->SendPacket(&data); } - // pussywizard: schedule update for rated arena - if (ateamId) - sBattlegroundMgr->ScheduleArenaQueueUpdate(ateamId, bgQueueTypeId, bracketEntry->GetBracketId()); + // pussywizard: schedule update for rated arena + if (ateamId) + sBattlegroundMgr->ScheduleArenaQueueUpdate(ateamId, bgQueueTypeId, bracketEntry->GetBracketId()); } } diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index 13637b4d5..687bab438 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -141,9 +141,9 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) sentMaps.insert(mapId); dataBuffer << int32(mapId); - time_t period = sInstanceSaveMgr->GetExtendedResetTimeFor(mapId, (Difficulty)PAIR32_HIPART(itr->first)) - itr->second; - dataBuffer << int32(period); // pussywizard: reset time period - dataBuffer << int32(0); // pussywizard: reset time offset, needed for other than 7-day periods if not aligned with relationTime + time_t period = sInstanceSaveMgr->GetExtendedResetTimeFor(mapId, (Difficulty)PAIR32_HIPART(itr->first)) - itr->second; + dataBuffer << int32(period); // pussywizard: reset time period + dataBuffer << int32(0); // pussywizard: reset time offset, needed for other than 7-day periods if not aligned with relationTime ++boundCounter; } @@ -445,15 +445,15 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) else { // xinef: Get Data From global storage - if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(name)) - { - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow)) - { - inviteeGuid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); - inviteeTeamId = Player::TeamIdForRace(playerData->race); - inviteeGuildId = playerData->guildId; - } - } + if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(name)) + { + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow)) + { + inviteeGuid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); + inviteeTeamId = Player::TeamIdForRace(playerData->race); + inviteeGuildId = playerData->guildId; + } + } } if (!inviteeGuid) @@ -468,7 +468,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) return; } - // xinef: zomg! sync query + // xinef: zomg! sync query if (QueryResult result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = " UI64FMTD " AND friend = " UI64FMTD, inviteeGuid, playerGuid)) { Field* fields = result->Fetch(); @@ -700,22 +700,22 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData) uint8 toggleExtendOn; recvData >> mapId >> difficulty>> toggleExtendOn; - const MapEntry* entry = sMapStore.LookupEntry(mapId); - if (!entry || !entry->IsRaid()) - return; - - InstancePlayerBind* instanceBind = sInstanceSaveMgr->PlayerGetBoundInstance(GetPlayer()->GetGUIDLow(), mapId, Difficulty(difficulty)); - if (!instanceBind || !instanceBind->perm || (bool)toggleExtendOn == instanceBind->extended) + const MapEntry* entry = sMapStore.LookupEntry(mapId); + if (!entry || !entry->IsRaid()) return; - instanceBind->extended = (bool)toggleExtendOn; + InstancePlayerBind* instanceBind = sInstanceSaveMgr->PlayerGetBoundInstance(GetPlayer()->GetGUIDLow(), mapId, Difficulty(difficulty)); + if (!instanceBind || !instanceBind->perm || (bool)toggleExtendOn == instanceBind->extended) + return; - // update in db - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INSTANCE_EXTENDED); - stmt->setUInt8(0, toggleExtendOn ? 1 : 0); - stmt->setUInt32(1, GetPlayer()->GetGUIDLow()); - stmt->setUInt32(2, instanceBind->save->GetInstanceId()); - CharacterDatabase.Execute(stmt); + instanceBind->extended = (bool)toggleExtendOn; + + // update in db + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INSTANCE_EXTENDED); + stmt->setUInt8(0, toggleExtendOn ? 1 : 0); + stmt->setUInt32(1, GetPlayer()->GetGUIDLow()); + stmt->setUInt32(2, instanceBind->save->GetInstanceId()); + CharacterDatabase.Execute(stmt); SendCalendarRaidLockoutUpdated(instanceBind->save, (bool)toggleExtendOn); } diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp index 6ac3d3c60..a74d22755 100644 --- a/src/server/game/Handlers/ChannelHandler.cpp +++ b/src/server/game/Handlers/ChannelHandler.cpp @@ -48,12 +48,12 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) return; if (isdigit(channelName[0])) - return; + return; - // pussywizard: restrict allowed characters in channel name to avoid |0 and possibly other exploits - //if (!ObjectMgr::IsValidChannelName(channelName)) - if (channelName.find("|") != std::string::npos || channelName.size() >= 100) - return; + // pussywizard: restrict allowed characters in channel name to avoid |0 and possibly other exploits + //if (!ObjectMgr::IsValidChannelName(channelName)) + if (channelName.find("|") != std::string::npos || channelName.size() >= 100) + return; if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeamId())) { diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 872cd7df1..6ed0a24db 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -187,13 +187,13 @@ bool LoginQueryHolder::Initialize() stmt->setUInt32(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW, stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_ASYNCH); - stmt->setUInt32(0, lowGuid); - res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL, stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_ASYNCH); + stmt->setUInt32(0, lowGuid); + res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL, stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BREW_OF_THE_MONTH); - stmt->setUInt32(0, lowGuid); - res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BREW_OF_THE_MONTH, stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BREW_OF_THE_MONTH); + stmt->setUInt32(0, lowGuid); + res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BREW_OF_THE_MONTH, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_INSTANCELOCKTIMES); stmt->setUInt32(0, m_accountId); @@ -608,16 +608,16 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk); } - // pussywizard: - if (sWorld->GetGlobalPlayerGUID(createInfo->Name)) - { + // pussywizard: + if (sWorld->GetGlobalPlayerGUID(createInfo->Name)) + { WorldPacket data(SMSG_CHAR_CREATE, 1); data << uint8(CHAR_CREATE_NAME_IN_USE); SendPacket(&data); delete createInfo; _charCreateCallback.Reset(); return; - } + } Player newChar(this); newChar.GetMotionMaster()->Initialize(); @@ -666,7 +666,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte ;//sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); - sWorld->AddGlobalPlayerData(newChar.GetGUIDLow(), GetAccountId(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel(), 0, 0); + sWorld->AddGlobalPlayerData(newChar.GetGUIDLow(), GetAccountId(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel(), 0, 0); newChar.CleanupsBeforeDelete(); delete createInfo; @@ -711,10 +711,10 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) return; } - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) - { - accountId = playerData->accountId; - name = playerData->name; + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) + { + accountId = playerData->accountId; + name = playerData->name; } // prevent deleting other players' characters using cheating tools @@ -736,7 +736,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) sCalendarMgr->RemoveAllPlayerEventsAndInvites(guid); Player::DeleteFromDB(guid, GetAccountId(), true, false); - sWorld->DeleteGlobalPlayerData(GUID_LOPART(guid), name); + sWorld->DeleteGlobalPlayerData(GUID_LOPART(guid), name); WorldPacket data(SMSG_CHAR_DELETE, 1); data << (uint8)CHAR_DELETE_SUCCESS; SendPacket(&data); @@ -760,92 +760,92 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recvData) KickPlayer(); return; } - - // pussywizard: - if (WorldSession* sess = sWorld->FindOfflineSessionForCharacterGUID(GUID_LOPART(playerGuid))) - if (sess->GetAccountId() != GetAccountId()) - { - WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); - data << (uint8)CHAR_LOGIN_DUPLICATE_CHARACTER; - SendPacket(&data); - return; - } - // pussywizard: - if (WorldSession* sess = sWorld->FindOfflineSession(GetAccountId())) - { - Player* p = sess->GetPlayer(); - if (!p || sess->IsKicked()) - { - WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); - data << (uint8)CHAR_LOGIN_DUPLICATE_CHARACTER; - SendPacket(&data); - return; - } + + // pussywizard: + if (WorldSession* sess = sWorld->FindOfflineSessionForCharacterGUID(GUID_LOPART(playerGuid))) + if (sess->GetAccountId() != GetAccountId()) + { + WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); + data << (uint8)CHAR_LOGIN_DUPLICATE_CHARACTER; + SendPacket(&data); + return; + } + // pussywizard: + if (WorldSession* sess = sWorld->FindOfflineSession(GetAccountId())) + { + Player* p = sess->GetPlayer(); + if (!p || sess->IsKicked()) + { + WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); + data << (uint8)CHAR_LOGIN_DUPLICATE_CHARACTER; + SendPacket(&data); + return; + } - if (p->GetGUID() != playerGuid) - sess->KickPlayer(); // no return, go to normal loading - else - { - // pussywizard: players stay ingame no matter what (prevent abuse), but allow to turn it off to stop crashing - if (!sWorld->getBoolConfig(CONFIG_ENABLE_LOGIN_AFTER_DC)) - { - WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); - data << (uint8)CHAR_LOGIN_DUPLICATE_CHARACTER; - SendPacket(&data); - return; - } + if (p->GetGUID() != playerGuid) + sess->KickPlayer(); // no return, go to normal loading + else + { + // pussywizard: players stay ingame no matter what (prevent abuse), but allow to turn it off to stop crashing + if (!sWorld->getBoolConfig(CONFIG_ENABLE_LOGIN_AFTER_DC)) + { + WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); + data << (uint8)CHAR_LOGIN_DUPLICATE_CHARACTER; + SendPacket(&data); + return; + } - uint8 limitA = 10, limitB = 10, limitC = 10; // pussywizard: this somehow froze (probably, ahh crash logs ...), and while (far) have never frozen in LogoutPlayer o_O maybe it's the combination of while(far); while(near); - while (sess->GetPlayer() && (sess->GetPlayer()->IsBeingTeleportedFar() || (sess->GetPlayer()->IsInWorld() && sess->GetPlayer()->IsBeingTeleportedNear()))) - { - if (limitA == 0 || --limitA == 0) - { - sLog->outMisc("HandlePlayerLoginOpcode A"); - break; - } - while (sess->GetPlayer() && sess->GetPlayer()->IsBeingTeleportedFar()) - { - if (limitB == 0 || --limitB == 0) - { - sLog->outMisc("HandlePlayerLoginOpcode B"); - break; - } - sess->HandleMoveWorldportAckOpcode(); - } - while (sess->GetPlayer() && sess->GetPlayer()->IsInWorld() && sess->GetPlayer()->IsBeingTeleportedNear()) - { - if (limitC == 0 || --limitC == 0) - { - sLog->outMisc("HandlePlayerLoginOpcode C"); - break; - } - Player* plMover = sess->GetPlayer()->m_mover->ToPlayer(); - if (!plMover) - break; - WorldPacket pkt(MSG_MOVE_TELEPORT_ACK, 20); - pkt.append(plMover->GetPackGUID()); - pkt << uint32(0); // flags - pkt << uint32(0); // time - sess->HandleMoveTeleportAck(pkt); - } - } - if (!p->FindMap() || !p->IsInWorld() || sess->IsKicked()) - { - WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); - data << (uint8)CHAR_LOGIN_DUPLICATE_CHARACTER; - SendPacket(&data); - return; - } + uint8 limitA = 10, limitB = 10, limitC = 10; // pussywizard: this somehow froze (probably, ahh crash logs ...), and while (far) have never frozen in LogoutPlayer o_O maybe it's the combination of while(far); while(near); + while (sess->GetPlayer() && (sess->GetPlayer()->IsBeingTeleportedFar() || (sess->GetPlayer()->IsInWorld() && sess->GetPlayer()->IsBeingTeleportedNear()))) + { + if (limitA == 0 || --limitA == 0) + { + sLog->outMisc("HandlePlayerLoginOpcode A"); + break; + } + while (sess->GetPlayer() && sess->GetPlayer()->IsBeingTeleportedFar()) + { + if (limitB == 0 || --limitB == 0) + { + sLog->outMisc("HandlePlayerLoginOpcode B"); + break; + } + sess->HandleMoveWorldportAckOpcode(); + } + while (sess->GetPlayer() && sess->GetPlayer()->IsInWorld() && sess->GetPlayer()->IsBeingTeleportedNear()) + { + if (limitC == 0 || --limitC == 0) + { + sLog->outMisc("HandlePlayerLoginOpcode C"); + break; + } + Player* plMover = sess->GetPlayer()->m_mover->ToPlayer(); + if (!plMover) + break; + WorldPacket pkt(MSG_MOVE_TELEPORT_ACK, 20); + pkt.append(plMover->GetPackGUID()); + pkt << uint32(0); // flags + pkt << uint32(0); // time + sess->HandleMoveTeleportAck(pkt); + } + } + if (!p->FindMap() || !p->IsInWorld() || sess->IsKicked()) + { + WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1); + data << (uint8)CHAR_LOGIN_DUPLICATE_CHARACTER; + SendPacket(&data); + return; + } - sess->SetPlayer(NULL); - SetPlayer(p); - p->SetSession(this); - delete p->PlayerTalkClass; - p->PlayerTalkClass = new PlayerMenu(p->GetSession()); - HandlePlayerLoginToCharInWorld(p); - return; - } - } + sess->SetPlayer(NULL); + SetPlayer(p); + p->SetSession(this); + delete p->PlayerTalkClass; + p->PlayerTalkClass = new PlayerMenu(p->GetSession()); + HandlePlayerLoginToCharInWorld(p); + return; + } + } m_playerLoading = true; @@ -937,22 +937,22 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) ;//sLog->outStaticDebug("WORLD: Sent server info"); } - if (uint32 guildId = Player::GetGuildIdFromStorage(pCurrChar->GetGUIDLow())) + if (uint32 guildId = Player::GetGuildIdFromStorage(pCurrChar->GetGUIDLow())) { - Guild* guild = sGuildMgr->GetGuildById(guildId); - Guild::Member const* member = guild ? guild->GetMember(pCurrChar->GetGUID()) : NULL; - if (member) - { - pCurrChar->SetInGuild(guildId); - pCurrChar->SetRank(member->GetRankId()); + Guild* guild = sGuildMgr->GetGuildById(guildId); + Guild::Member const* member = guild ? guild->GetMember(pCurrChar->GetGUID()) : NULL; + if (member) + { + pCurrChar->SetInGuild(guildId); + pCurrChar->SetRank(member->GetRankId()); guild->SendLoginInfo(this); - } - else - { - sLog->outError("Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), guildId); - pCurrChar->SetInGuild(0); - pCurrChar->SetRank(0); - } + } + else + { + sLog->outError("Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), guildId); + pCurrChar->SetInGuild(0); + pCurrChar->SetRank(0); + } } else { @@ -986,7 +986,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) } } - // Xinef: moved this from below + // Xinef: moved this from below sObjectAccessor->AddObject(pCurrChar); if (!pCurrChar->GetMap()->AddPlayerToMap(pCurrChar) || !pCurrChar->CheckInstanceLoginValid()) @@ -1035,15 +1035,15 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) pCurrChar->SendInstanceResetWarning(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty(), timeleft, true); } - // pussywizard: ensure that we end up on map with our loaded transport: - if (Transport* t = pCurrChar->GetTransport()) - if (!t->IsInMap(pCurrChar)) - { - t->RemovePassenger(pCurrChar); - pCurrChar->m_transport = NULL; - pCurrChar->m_movementInfo.transport.Reset(); - pCurrChar->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); - } + // pussywizard: ensure that we end up on map with our loaded transport: + if (Transport* t = pCurrChar->GetTransport()) + if (!t->IsInMap(pCurrChar)) + { + t->RemovePassenger(pCurrChar); + pCurrChar->m_transport = NULL; + pCurrChar->m_movementInfo.transport.Reset(); + pCurrChar->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); + } // friend status if (GetSecurity() < SEC_GAMEMASTER) // pussywizard: only for non-gms @@ -1116,29 +1116,29 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) // Handle Login-Achievements (should be handled after loading) _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ON_LOGIN, 1); - // Xinef: fix vendors falling of player vehicle, due to isBeingLoaded checks - if (pCurrChar->IsInWorld()) - { - if (pCurrChar->GetMountBlockId() && !pCurrChar->HasAuraType(SPELL_AURA_MOUNTED)) - { - pCurrChar->CastSpell(pCurrChar, pCurrChar->GetMountBlockId(), true); - pCurrChar->SetMountBlockId(0); + // Xinef: fix vendors falling of player vehicle, due to isBeingLoaded checks + if (pCurrChar->IsInWorld()) + { + if (pCurrChar->GetMountBlockId() && !pCurrChar->HasAuraType(SPELL_AURA_MOUNTED)) + { + pCurrChar->CastSpell(pCurrChar, pCurrChar->GetMountBlockId(), true); + pCurrChar->SetMountBlockId(0); - // Xinef: refresh this in case mount aura changes anything (eg no fly zone) - pCurrChar->UpdateAreaDependentAuras(pCurrChar->GetAreaId()); - pCurrChar->UpdateZoneDependentAuras(pCurrChar->GetZoneId()); - } - } + // Xinef: refresh this in case mount aura changes anything (eg no fly zone) + pCurrChar->UpdateAreaDependentAuras(pCurrChar->GetAreaId()); + pCurrChar->UpdateZoneDependentAuras(pCurrChar->GetZoneId()); + } + } - // pussywizard: pvp mode - pCurrChar->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER); - if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP)) - pCurrChar->UpdatePvP(true, true); + // pussywizard: pvp mode + pCurrChar->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER); + if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP)) + pCurrChar->UpdatePvP(true, true); - // pussywizard: on login it's not possible to go back to arena as a spectator, HandleMoveWorldportAckOpcode is not sent, so call it here - pCurrChar->SetIsSpectator(false); + // pussywizard: on login it's not possible to go back to arena as a spectator, HandleMoveWorldportAckOpcode is not sent, so call it here + pCurrChar->SetIsSpectator(false); - // xinef: do this after everything is loaded + // xinef: do this after everything is loaded pCurrChar->ContinueTaxiFlight(); // reset for all pets before pet loading @@ -1154,156 +1154,156 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar) { - ChatHandler chH = ChatHandler(this); - m_playerLoading = true; + ChatHandler chH = ChatHandler(this); + m_playerLoading = true; - pCurrChar->SendDungeonDifficulty(false); + pCurrChar->SendDungeonDifficulty(false); - WorldPacket data(SMSG_LOGIN_VERIFY_WORLD, 20); - data << pCurrChar->GetMapId(); - data << pCurrChar->GetPositionX(); - data << pCurrChar->GetPositionY(); - data << pCurrChar->GetPositionZ() + pCurrChar->GetHoverHeight(); - data << pCurrChar->GetOrientation(); - SendPacket(&data); + WorldPacket data(SMSG_LOGIN_VERIFY_WORLD, 20); + data << pCurrChar->GetMapId(); + data << pCurrChar->GetPositionX(); + data << pCurrChar->GetPositionY(); + data << pCurrChar->GetPositionZ() + pCurrChar->GetHoverHeight(); + data << pCurrChar->GetOrientation(); + SendPacket(&data); - SendAccountDataTimes(PER_CHARACTER_CACHE_MASK); + SendAccountDataTimes(PER_CHARACTER_CACHE_MASK); - data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0 - data << uint8(2); // unknown value - data << uint8(0); // enable(1)/disable(0) voice chat interface in client - SendPacket(&data); + data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0 + data << uint8(2); // unknown value + data << uint8(0); // enable(1)/disable(0) voice chat interface in client + SendPacket(&data); - // Send MOTD - { - data.Initialize(SMSG_MOTD, 50); // new in 2.0.1 - data << (uint32)0; + // Send MOTD + { + data.Initialize(SMSG_MOTD, 50); // new in 2.0.1 + data << (uint32)0; - uint32 linecount=0; - std::string str_motd = sWorld->GetMotd(); - std::string::size_type pos, nextpos; + uint32 linecount=0; + std::string str_motd = sWorld->GetMotd(); + std::string::size_type pos, nextpos; - pos = 0; - while ((nextpos= str_motd.find('@', pos)) != std::string::npos) - { - if (nextpos != pos) - { - data << str_motd.substr(pos, nextpos-pos); - ++linecount; - } - pos = nextpos+1; - } + pos = 0; + while ((nextpos= str_motd.find('@', pos)) != std::string::npos) + { + if (nextpos != pos) + { + data << str_motd.substr(pos, nextpos-pos); + ++linecount; + } + pos = nextpos+1; + } - if (posoutStaticDebug("WORLD: Sent motd (SMSG_MOTD)"); + SendPacket(&data); + ;//sLog->outStaticDebug("WORLD: Sent motd (SMSG_MOTD)"); - // send server info - if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1) - chH.PSendSysMessage(_FULLVERSION); + // send server info + if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1) + chH.PSendSysMessage(_FULLVERSION); - ;//sLog->outStaticDebug("WORLD: Sent server info"); - } + ;//sLog->outStaticDebug("WORLD: Sent server info"); + } - data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4); - data << uint32(0); - data << uint32(0); - SendPacket(&data); + data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4); + data << uint32(0); + data << uint32(0); + SendPacket(&data); - // Xinef: fix possible problem with flag UNIT_FLAG_STUNNED added during logout - if (!pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) - pCurrChar->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + // Xinef: fix possible problem with flag UNIT_FLAG_STUNNED added during logout + if (!pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) + pCurrChar->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - pCurrChar->SendInitialPacketsBeforeAddToMap(); + pCurrChar->SendInitialPacketsBeforeAddToMap(); - // necessary actions from AddPlayerToMap: - pCurrChar->GetMap()->SendInitTransports(pCurrChar); - pCurrChar->GetMap()->SendInitSelf(pCurrChar); - pCurrChar->GetMap()->SendZoneDynamicInfo(pCurrChar); - pCurrChar->m_clientGUIDs.clear(); - pCurrChar->UpdateObjectVisibility(false); + // necessary actions from AddPlayerToMap: + pCurrChar->GetMap()->SendInitTransports(pCurrChar); + pCurrChar->GetMap()->SendInitSelf(pCurrChar); + pCurrChar->GetMap()->SendZoneDynamicInfo(pCurrChar); + pCurrChar->m_clientGUIDs.clear(); + pCurrChar->UpdateObjectVisibility(false); - pCurrChar->CleanupChannels(); - pCurrChar->SendInitialPacketsAfterAddToMap(); - uint32 currZone, currArea; - pCurrChar->GetZoneAndAreaId(currZone, currArea, false); - pCurrChar->SendInitWorldStates(currZone, currArea); - pCurrChar->SetInGameTime(World::GetGameTimeMS()); + pCurrChar->CleanupChannels(); + pCurrChar->SendInitialPacketsAfterAddToMap(); + uint32 currZone, currArea; + pCurrChar->GetZoneAndAreaId(currZone, currArea, false); + pCurrChar->SendInitWorldStates(currZone, currArea); + pCurrChar->SetInGameTime(World::GetGameTimeMS()); - // Xinef: we need to resend all spell mods - for (uint16 Opcode = SMSG_SET_FLAT_SPELL_MODIFIER; Opcode <= SMSG_SET_PCT_SPELL_MODIFIER; ++Opcode) // PCT = FLAT+1 - { - uint32 modType = (Opcode == SMSG_SET_FLAT_SPELL_MODIFIER) ? SPELLMOD_FLAT : SPELLMOD_PCT; - for (uint32 opType = SPELLMOD_DAMAGE; opType < MAX_SPELLMOD; ++opType) - { - int32 i = 0; - flag96 _mask = 0; - SpellModList const& spellMods = pCurrChar->GetSpellModList(opType); - if (spellMods.empty()) - continue; + // Xinef: we need to resend all spell mods + for (uint16 Opcode = SMSG_SET_FLAT_SPELL_MODIFIER; Opcode <= SMSG_SET_PCT_SPELL_MODIFIER; ++Opcode) // PCT = FLAT+1 + { + uint32 modType = (Opcode == SMSG_SET_FLAT_SPELL_MODIFIER) ? SPELLMOD_FLAT : SPELLMOD_PCT; + for (uint32 opType = SPELLMOD_DAMAGE; opType < MAX_SPELLMOD; ++opType) + { + int32 i = 0; + flag96 _mask = 0; + SpellModList const& spellMods = pCurrChar->GetSpellModList(opType); + if (spellMods.empty()) + continue; - for (int32 eff = 0; eff < 96; ++eff) - { - if (eff != 0 && eff%32 == 0) - _mask[i++] = 0; + for (int32 eff = 0; eff < 96; ++eff) + { + if (eff != 0 && eff%32 == 0) + _mask[i++] = 0; - _mask[i] = uint32(1) << (eff-(32*i)); - int32 val = 0; - for (SpellModList::const_iterator itr = spellMods.begin(); itr != spellMods.end(); ++itr) - if ((*itr)->type == modType && (*itr)->mask & _mask) - val += (*itr)->value; + _mask[i] = uint32(1) << (eff-(32*i)); + int32 val = 0; + for (SpellModList::const_iterator itr = spellMods.begin(); itr != spellMods.end(); ++itr) + if ((*itr)->type == modType && (*itr)->mask & _mask) + val += (*itr)->value; - if (val == 0) - continue; + if (val == 0) + continue; - WorldPacket data(Opcode, (1+1+4)); - data << uint8(eff); - data << uint8(opType); - data << int32(val); - SendPacket(&data); - } - } - } - - if (Group* group = pCurrChar->GetGroup()) - group->SendUpdate(); + WorldPacket data(Opcode, (1+1+4)); + data << uint8(eff); + data << uint8(opType); + data << int32(val); + SendPacket(&data); + } + } + } + + if (Group* group = pCurrChar->GetGroup()) + group->SendUpdate(); - // pussywizard: send instance welcome message as when entering the instance through a portal - if (MapDifficulty const* mapDiff = GetMapDifficultyData(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty())) - if (mapDiff->resetTime) - if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty())) - { - uint32 timeleft = uint32(timeReset - time(NULL)); - GetPlayer()->SendInstanceResetWarning(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty(), timeleft, true); - } + // pussywizard: send instance welcome message as when entering the instance through a portal + if (MapDifficulty const* mapDiff = GetMapDifficultyData(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty())) + if (mapDiff->resetTime) + if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty())) + { + uint32 timeleft = uint32(timeReset - time(NULL)); + GetPlayer()->SendInstanceResetWarning(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty(), timeleft, true); + } - // this shouldn't do anything, becaues offline can't be on taxi, but just in case - pCurrChar->ContinueTaxiFlight(); + // this shouldn't do anything, becaues offline can't be on taxi, but just in case + pCurrChar->ContinueTaxiFlight(); - // send pet data, action bar, talents, etc. - pCurrChar->PetSpellInitialize(); - pCurrChar->SendTalentsInfoData(true); + // send pet data, action bar, talents, etc. + pCurrChar->PetSpellInitialize(); + pCurrChar->SendTalentsInfoData(true); - // show time before shutdown if shutdown planned. - if (sWorld->IsShuttingDown()) - sWorld->ShutdownMsg(true, pCurrChar); + // show time before shutdown if shutdown planned. + if (sWorld->IsShuttingDown()) + sWorld->ShutdownMsg(true, pCurrChar); - if (pCurrChar->IsGameMaster()) - SendNotification(LANG_GM_ON); + if (pCurrChar->IsGameMaster()) + SendNotification(LANG_GM_ON); - m_playerLoading = false; + m_playerLoading = false; } void WorldSession::HandlePlayerLoginToCharOutOfWorld(Player* pCurrChar) { - ASSERT(false); + ASSERT(false); } void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData) @@ -1474,14 +1474,14 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu CharacterDatabase.Execute(stmt); // Removed declined name from db - if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED)) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); + if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED)) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); - stmt->setUInt32(0, guidLow); + stmt->setUInt32(0, guidLow); - CharacterDatabase.Execute(stmt); - } + CharacterDatabase.Execute(stmt); + } sLog->outChar("Account: %d (IP: %s), Character [%s] (guid: %u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); @@ -1491,16 +1491,16 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu data << newName; SendPacket(&data); - // xinef: update global data - sWorld->UpdateGlobalNameData(guidLow, oldName, newName); - sWorld->UpdateGlobalPlayerData(guidLow, PLAYER_UPDATE_DATA_NAME, newName); + // xinef: update global data + sWorld->UpdateGlobalNameData(guidLow, oldName, newName); + sWorld->UpdateGlobalPlayerData(guidLow, PLAYER_UPDATE_DATA_NAME, newName); } void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData) { - // pussywizard: - if (!sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED)) - return; + // pussywizard: + if (!sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED)) + return; uint64 guid; @@ -1703,7 +1703,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid)); recvData.rfinish(); KickPlayer(); - return; + return; } // pussywizard: @@ -1721,7 +1721,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) uint8 gender, skin, face, hairStyle, hairColor, facialHair; recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face; - // xinef: zomg! sync query + // xinef: zomg! sync query PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN); stmt->setUInt32(0, GUID_LOPART(guid)); @@ -1736,7 +1736,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) return; } - // get the players old (at this moment current) race + // get the players old (at this moment current) race GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid)); if (!playerData) { @@ -1808,18 +1808,18 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) CharacterDatabase.Execute(stmt); - if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED)) - { - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); + if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED)) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); - stmt->setUInt32(0, GUID_LOPART(guid)); + stmt->setUInt32(0, GUID_LOPART(guid)); - CharacterDatabase.Execute(stmt); - } + CharacterDatabase.Execute(stmt); + } - // xinef: update global data - sWorld->UpdateGlobalNameData(GUID_LOPART(guid), playerData->name, newName); - sWorld->UpdateGlobalPlayerData(GUID_LOPART(guid), PLAYER_UPDATE_DATA_NAME|PLAYER_UPDATE_DATA_GENDER, newName, 0, gender); + // xinef: update global data + sWorld->UpdateGlobalNameData(GUID_LOPART(guid), playerData->name, newName); + sWorld->UpdateGlobalPlayerData(GUID_LOPART(guid), PLAYER_UPDATE_DATA_NAME|PLAYER_UPDATE_DATA_GENDER, newName, 0, gender); WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1+8+(newName.size()+1)+6); data << uint8(RESPONSE_SUCCESS); @@ -1864,12 +1864,12 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData) uint64 itemGuid; recvData.readPackGUID(itemGuid); - // xinef: if client sends 0, it means empty slot - if (itemGuid == 0) - { - eqSet.Items[i] = 0; - continue; - } + // xinef: if client sends 0, it means empty slot + if (itemGuid == 0) + { + eqSet.Items[i] = 0; + continue; + } // equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set) if (itemGuid == 1) @@ -1879,13 +1879,13 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData) continue; } - // xinef: some cheating checks + // xinef: some cheating checks Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!item || item->GetGUID() != itemGuid) - { - eqSet.Items[i] = 0; - continue; - } + { + eqSet.Items[i] = 0; + continue; + } eqSet.Items[i] = GUID_LOPART(itemGuid); } @@ -1926,8 +1926,8 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData) continue; Item* item = NULL; - if (itemGuid > 0) - item = _player->GetItemByGuid(itemGuid); + if (itemGuid > 0) + item = _player->GetItemByGuid(itemGuid); uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8); @@ -1974,7 +1974,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid)); recvData.rfinish(); KickPlayer(); - return; + return; } // pussywizard: @@ -2002,69 +2002,69 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) return; } - // xinef: add some safety checks - if (recvData.GetOpcode() == CMSG_CHAR_FACTION_CHANGE) - { - // if player is in a guild - if (playerData->guildId) - { - WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); - data << (uint8)CHAR_CREATE_CHARACTER_IN_GUILD; - SendPacket(&data); - return; - } + // xinef: add some safety checks + if (recvData.GetOpcode() == CMSG_CHAR_FACTION_CHANGE) + { + // if player is in a guild + if (playerData->guildId) + { + WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); + data << (uint8)CHAR_CREATE_CHARACTER_IN_GUILD; + SendPacket(&data); + return; + } - // is arena team captain - if (sArenaTeamMgr->GetArenaTeamByCaptain(guid)) - { - WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); - data << (uint8)CHAR_CREATE_CHARACTER_ARENA_LEADER; - SendPacket(&data); - return; - } + // is arena team captain + if (sArenaTeamMgr->GetArenaTeamByCaptain(guid)) + { + WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); + data << (uint8)CHAR_CREATE_CHARACTER_ARENA_LEADER; + SendPacket(&data); + return; + } - // check mailbox - if (playerData->mailCount) - { - WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); - data << (uint8)CHAR_CREATE_CHARACTER_DELETE_MAIL; - SendPacket(&data); - return; - } + // check mailbox + if (playerData->mailCount) + { + WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); + data << (uint8)CHAR_CREATE_CHARACTER_DELETE_MAIL; + SendPacket(&data); + return; + } - // check auctions, current packet is processed single-threaded way, so not a problem - bool has_auctions = false; - for (uint8 i=0; i<2; ++i) // check both neutral and faction-specific AH - { - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(i == 0 ? 0 : (((1<<(playerData->race-1))&RACEMASK_ALLIANCE) ? 12 : 29)); - AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin(); - AuctionHouseObject::AuctionEntryMap::const_iterator _end = auctionHouse->GetAuctionsEnd(); - for (; itr != _end; ++itr) - { - AuctionEntry* Aentry = itr->second; - if (Aentry && (Aentry->owner == lowGuid || Aentry->bidder == lowGuid)) - { - has_auctions = true; - break; - } - } - if (has_auctions) - break; - } - if (has_auctions) - { - WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); - data << (uint8)CHAR_CREATE_ERROR; - SendPacket(&data); - return; - } - } + // check auctions, current packet is processed single-threaded way, so not a problem + bool has_auctions = false; + for (uint8 i=0; i<2; ++i) // check both neutral and faction-specific AH + { + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(i == 0 ? 0 : (((1<<(playerData->race-1))&RACEMASK_ALLIANCE) ? 12 : 29)); + AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin(); + AuctionHouseObject::AuctionEntryMap::const_iterator _end = auctionHouse->GetAuctionsEnd(); + for (; itr != _end; ++itr) + { + AuctionEntry* Aentry = itr->second; + if (Aentry && (Aentry->owner == lowGuid || Aentry->bidder == lowGuid)) + { + has_auctions = true; + break; + } + } + if (has_auctions) + break; + } + if (has_auctions) + { + WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); + data << (uint8)CHAR_CREATE_ERROR; + SendPacket(&data); + return; + } + } - uint8 oldRace = playerData->race; + uint8 oldRace = playerData->race; uint8 playerClass = playerData->playerClass; uint8 level = playerData->level; - // xinef: zomg! sync query + // xinef: zomg! sync query PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_AT_LOGIN_TITLES_MONEY); stmt->setUInt32(0, lowGuid); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -2080,15 +2080,15 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) Field* fields = result->Fetch(); uint32 at_loginFlags = fields[0].GetUInt16(); char const* knownTitlesStr = fields[1].GetCString(); - uint32 money = fields[2].GetUInt32(); + uint32 money = fields[2].GetUInt32(); uint32 used_loginFlag = ((recvData.GetOpcode() == CMSG_CHAR_RACE_CHANGE) ? AT_LOGIN_CHANGE_RACE : AT_LOGIN_CHANGE_FACTION); - // xinef: check money - bool valid = Player::TeamIdForRace(oldRace) == Player::TeamIdForRace(race); - if (level < 10 && money <= 0 || level > 10 && level <= 30 && money <= 3000000 || level > 30 && level <= 50 && money <= 10000000 || - level > 50 && level <= 70 && money <= 50000000 || level > 70 && money <= 200000000) - valid = true; - if (!valid) + // xinef: check money + bool valid = Player::TeamIdForRace(oldRace) == Player::TeamIdForRace(race); + if (level < 10 && money <= 0 || level > 10 && level <= 30 && money <= 3000000 || level > 30 && level <= 50 && money <= 10000000 || + level > 50 && level <= 70 && money <= 50000000 || level > 70 && money <= 200000000) + valid = true; + if (!valid) { WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); data << uint8(CHAR_CREATE_CHARACTER_GOLD_LIMIT); @@ -2194,10 +2194,10 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) sLog->outChar("Account: %d (IP: %s), Character [%s] (guid: %u) Changed Race/Faction to: %s", GetAccountId(), GetRemoteAddress().c_str(), playerData->name.c_str(), lowGuid, newname.c_str()); - // xinef: update global data - sWorld->UpdateGlobalNameData(GUID_LOPART(guid), playerData->name, newname); - sWorld->UpdateGlobalPlayerData(GUID_LOPART(guid), - PLAYER_UPDATE_DATA_NAME|PLAYER_UPDATE_DATA_RACE|PLAYER_UPDATE_DATA_GENDER, newname, 0, gender, race); + // xinef: update global data + sWorld->UpdateGlobalNameData(GUID_LOPART(guid), playerData->name, newname); + sWorld->UpdateGlobalPlayerData(GUID_LOPART(guid), + PLAYER_UPDATE_DATA_NAME|PLAYER_UPDATE_DATA_RACE|PLAYER_UPDATE_DATA_GENDER, newname, 0, gender, race); if (oldRace != race) { @@ -2327,24 +2327,24 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) } // Reset guild - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD)) - { - if (uint32 guildId = playerData->guildId) - if (Guild* guild = sGuildMgr->GetGuildById(guildId)) - guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true); - } + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD)) + { + if (uint32 guildId = playerData->guildId) + if (Guild* guild = sGuildMgr->GetGuildById(guildId)) + guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true); + } - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND)) - { - // Delete Friend List - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID); - stmt->setUInt32(0, lowGuid); - trans->Append(stmt); + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND)) + { + // Delete Friend List + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID); + stmt->setUInt32(0, lowGuid); + trans->Append(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND); - stmt->setUInt32(0, lowGuid); - trans->Append(stmt); - } + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND); + stmt->setUInt32(0, lowGuid); + trans->Append(stmt); + } // Leave Arena Teams Player::LeaveAllArenaTeams(guid); diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index a9d628601..df7df11eb 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -60,47 +60,47 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData) //sLog->outDebug("CHAT: packet received. type %u, lang %u", type, lang); - // pussywizard: chatting on most chat types requires 2 hours played to prevent spam/abuse - if (AccountMgr::IsPlayerAccount(GetSecurity())) - switch (type) - { - case CHAT_MSG_ADDON: - case CHAT_MSG_PARTY: - case CHAT_MSG_RAID: - case CHAT_MSG_GUILD: - case CHAT_MSG_OFFICER: - case CHAT_MSG_AFK: - case CHAT_MSG_DND: - case CHAT_MSG_RAID_LEADER: - case CHAT_MSG_RAID_WARNING: - case CHAT_MSG_BATTLEGROUND: - case CHAT_MSG_BATTLEGROUND_LEADER: - case CHAT_MSG_PARTY_LEADER: - break; - default: - if (sender->GetTotalPlayedTime() < 2*HOUR) - { - SendNotification("Speaking is allowed after playing for at least 2 hours. You may use party and guild chat."); - recvData.rfinish(); - return; - } - } + // pussywizard: chatting on most chat types requires 2 hours played to prevent spam/abuse + if (AccountMgr::IsPlayerAccount(GetSecurity())) + switch (type) + { + case CHAT_MSG_ADDON: + case CHAT_MSG_PARTY: + case CHAT_MSG_RAID: + case CHAT_MSG_GUILD: + case CHAT_MSG_OFFICER: + case CHAT_MSG_AFK: + case CHAT_MSG_DND: + case CHAT_MSG_RAID_LEADER: + case CHAT_MSG_RAID_WARNING: + case CHAT_MSG_BATTLEGROUND: + case CHAT_MSG_BATTLEGROUND_LEADER: + case CHAT_MSG_PARTY_LEADER: + break; + default: + if (sender->GetTotalPlayedTime() < 2*HOUR) + { + SendNotification("Speaking is allowed after playing for at least 2 hours. You may use party and guild chat."); + recvData.rfinish(); + return; + } + } - // pussywizard: - switch (type) - { - case CHAT_MSG_SAY: - case CHAT_MSG_YELL: - case CHAT_MSG_EMOTE: - case CHAT_MSG_TEXT_EMOTE: - case CHAT_MSG_AFK: - case CHAT_MSG_DND: - if (sender->IsSpectator()) - { - recvData.rfinish(); - return; - } - } + // pussywizard: + switch (type) + { + case CHAT_MSG_SAY: + case CHAT_MSG_YELL: + case CHAT_MSG_EMOTE: + case CHAT_MSG_TEXT_EMOTE: + case CHAT_MSG_AFK: + case CHAT_MSG_DND: + if (sender->IsSpectator()) + { + recvData.rfinish(); + return; + } + } // prevent talking at unknown language (cheating) LanguageDesc const* langDesc = GetLanguageDescByID(lang); @@ -165,38 +165,38 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData) lang = LANG_UNIVERSAL; else { - // send in universal language in two side iteration allowed mode - if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT)) - lang = LANG_UNIVERSAL; - else - { - switch (type) - { - case CHAT_MSG_PARTY: - case CHAT_MSG_PARTY_LEADER: - case CHAT_MSG_RAID: - case CHAT_MSG_RAID_LEADER: - case CHAT_MSG_RAID_WARNING: - // allow two side chat at group channel if two side group allowed - if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP)) - lang = LANG_UNIVERSAL; + // send in universal language in two side iteration allowed mode + if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT)) + lang = LANG_UNIVERSAL; + else + { + switch (type) + { + case CHAT_MSG_PARTY: + case CHAT_MSG_PARTY_LEADER: + case CHAT_MSG_RAID: + case CHAT_MSG_RAID_LEADER: + case CHAT_MSG_RAID_WARNING: + // allow two side chat at group channel if two side group allowed + if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP)) + lang = LANG_UNIVERSAL; - specialMessageLimit = 35; - break; - case CHAT_MSG_GUILD: - case CHAT_MSG_OFFICER: - // allow two side chat at guild channel if two side guild allowed - if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD)) - lang = LANG_UNIVERSAL; + specialMessageLimit = 35; + break; + case CHAT_MSG_GUILD: + case CHAT_MSG_OFFICER: + // allow two side chat at guild channel if two side guild allowed + if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD)) + lang = LANG_UNIVERSAL; - specialMessageLimit = 15; - break; - case CHAT_MSG_WHISPER: - if (sender->getLevel() >= 80) - specialMessageLimit = 15; - break; - } - } + specialMessageLimit = 15; + break; + case CHAT_MSG_WHISPER: + if (sender->getLevel() >= 80) + specialMessageLimit = 15; + break; + } + } // but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used) Unit::AuraEffectList const& ModLangAuras = sender->GetAuraEffectsByType(SPELL_AURA_MOD_LANGUAGE); if (!ModLangAuras.empty()) @@ -252,9 +252,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData) if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING)) stripLineInvisibleChars(msg); - // pussywizard: - if (lang != LANG_ADDON && msg.find("|0") != std::string::npos) - return; + // pussywizard: + if (lang != LANG_ADDON && msg.find("|0") != std::string::npos) + return; if (!ignoreChecks) { @@ -264,12 +264,12 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData) if (ChatHandler(this).ParseCommands(msg.c_str())) return; - if (!_player->CanSpeak()) - { - std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); - SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str()); - return; - } + if (!_player->CanSpeak()) + { + std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); + SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str()); + return; + } if (lang != LANG_ADDON) { @@ -286,20 +286,20 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData) } } - // exploit - size_t found1 = msg.find("|Hquest"); - if (found1 != std::string::npos) - { - size_t found2 = msg.find(":", found1+8); - size_t found3 = msg.find("|", found1+8); - if (found3 != std::string::npos) - { - if (found2 == std::string::npos) - return; - if (found2 > found3) - return; - } - } + // exploit + size_t found1 = msg.find("|Hquest"); + if (found1 != std::string::npos) + { + size_t found2 = msg.find(":", found1+8); + size_t found3 = msg.find("|", found1+8); + if (found3 != std::string::npos) + { + if (found2 == std::string::npos) + return; + if (found2 > found3) + return; + } + } switch (type) @@ -348,7 +348,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData) return; } - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer) + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer) if (GetPlayer()->GetTeamId() != receiver->GetTeamId()) { SendWrongFactionNotice(); @@ -544,8 +544,8 @@ void WorldSession::HandleEmoteOpcode(WorldPacket & recvData) if (!GetPlayer()->IsAlive() || GetPlayer()->HasUnitState(UNIT_STATE_DIED)) return; - if (GetPlayer()->IsSpectator()) - return; + if (GetPlayer()->IsSpectator()) + return; uint32 emote; recvData >> emote; @@ -590,7 +590,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recvData) if (!GetPlayer()->IsAlive()) return; - GetPlayer()->UpdateSpeakTime(); + GetPlayer()->UpdateSpeakTime(); if (!GetPlayer()->CanSpeak()) { @@ -599,8 +599,8 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recvData) return; } - if (GetPlayer()->IsSpectator()) - return; + if (GetPlayer()->IsSpectator()) + return; uint32 text_emote, emoteNum; uint64 guid; diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index b0863fcf7..d12e30ef9 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -83,11 +83,11 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData) return; } - if (GetPlayer()->IsSpectator() || player->IsSpectator()) - { + if (GetPlayer()->IsSpectator() || player->IsSpectator()) + { SendPartyResult(PARTY_OP_INVITE, membername, ERR_INVITE_RESTRICTED); - return; - } + return; + } // restrict invite to GMs if (!sWorld->getBoolConfig(CONFIG_ALLOW_GM_GROUP) && !GetPlayer()->IsGameMaster() && player->IsGameMaster()) @@ -97,7 +97,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData) } // can't group with - if (!GetPlayer()->IsGameMaster() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeamId() != player->GetTeamId()) + if (!GetPlayer()->IsGameMaster() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeamId() != player->GetTeamId()) { SendPartyResult(PARTY_OP_INVITE, membername, ERR_PLAYER_WRONG_FACTION); return; @@ -219,11 +219,11 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData) // Remove player from invitees in any case group->RemoveInvite(GetPlayer()); - if (GetPlayer()->IsSpectator()) - { + if (GetPlayer()->IsSpectator()) + { SendPartyResult(PARTY_OP_INVITE, "", ERR_INVITE_RESTRICTED); - return; - } + return; + } if (group->GetLeaderGUID() == GetPlayer()->GetGUID()) { @@ -244,7 +244,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData) if (!group->IsCreated()) { // This can happen if the leader is zoning. To be removed once delayed actions for zoning are implemented - if (!leader || leader->IsSpectator()) + if (!leader || leader->IsSpectator()) { group->RemoveAllInvites(); return; @@ -303,8 +303,8 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData) return; } - // Xinef: name is properly filled in packets - sObjectMgr->GetPlayerNameByGUID(guid, name); + // Xinef: name is properly filled in packets + sObjectMgr->GetPlayerNameByGUID(guid, name); PartyResult res = GetPlayer()->CanUninviteFromGroup(); if (res != ERR_PARTY_RESULT_OK) @@ -317,12 +317,12 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData) if (!grp) return; - // Xinef: do not allow to kick with empty reason, this will resend packet with given reason - if (grp->isLFGGroup() && reason.empty()) - { + // Xinef: do not allow to kick with empty reason, this will resend packet with given reason + if (grp->isLFGGroup() && reason.empty()) + { SendPartyResult(PARTY_OP_UNINVITE, name, ERR_VOTE_KICK_REASON_NEEDED); return; - } + } if (grp->IsLeader(guid) && !grp->isLFGGroup()) { @@ -447,8 +447,8 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData) return; /** error handling **/ - // Xinef: Check if group is LFG - if (!group->IsLeader(GetPlayer()->GetGUID()) || group->isLFGGroup()) + // Xinef: Check if group is LFG + if (!group->IsLeader(GetPlayer()->GetGUID()) || group->isLFGGroup()) return; if (lootMethod > NEED_BEFORE_GREED) diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index 778824067..cb5e8fc5e 100644 --- a/src/server/game/Handlers/GuildHandler.cpp +++ b/src/server/game/Handlers/GuildHandler.cpp @@ -46,7 +46,7 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket) std::string name; recvPacket >> name; - sLog->outError("CMSG_GUILD_CREATE: Possible hacking-attempt: %s tried to create a guild [Name: %s] using cheats", GetPlayerInfo().c_str(), name.c_str()); + sLog->outError("CMSG_GUILD_CREATE: Possible hacking-attempt: %s tried to create a guild [Name: %s] using cheats", GetPlayerInfo().c_str(), name.c_str()); } void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 9fe0b5ea1..153ae3107 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -256,8 +256,8 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recvData) _player->AutoUnequipOffhandIfNeed(); - // Xinef: Call this here after all needed items are equipped - _player->RemoveItemDependentAurasAndCasts((Item*)NULL); + // Xinef: Call this here after all needed items are equipped + _player->RemoveItemDependentAurasAndCasts((Item*)NULL); } } @@ -306,131 +306,131 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recvData) void ItemTemplate::InitializeQueryData() { - queryData.Initialize(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 1); + queryData.Initialize(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 1); - queryData << ItemId; - queryData << Class; - queryData << SubClass; - queryData << SoundOverrideSubclass; - queryData << Name1; - queryData << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name... - queryData << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00); - queryData << uint8(0x00); //pProto->Name4; // blizz not send name there, just uint8(0x00); - queryData << DisplayInfoID; - queryData << Quality; - queryData << Flags; - queryData << Flags2; - queryData << BuyPrice; - queryData << SellPrice; - queryData << InventoryType; - queryData << AllowableClass; - queryData << AllowableRace; - queryData << ItemLevel; - queryData << RequiredLevel; - queryData << RequiredSkill; - queryData << RequiredSkillRank; - queryData << RequiredSpell; - queryData << RequiredHonorRank; - queryData << RequiredCityRank; - queryData << RequiredReputationFaction; - queryData << RequiredReputationRank; - queryData << int32(MaxCount); - queryData << int32(Stackable); - queryData << ContainerSlots; - queryData << StatsCount; // item stats count - for (uint32 i = 0; i < StatsCount; ++i) - { - queryData << ItemStat[i].ItemStatType; - queryData << ItemStat[i].ItemStatValue; - } - queryData << ScalingStatDistribution; // scaling stats distribution - queryData << ScalingStatValue; // some kind of flags used to determine stat values column - for (int i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) - { - queryData << Damage[i].DamageMin; - queryData << Damage[i].DamageMax; - queryData << Damage[i].DamageType; - } + queryData << ItemId; + queryData << Class; + queryData << SubClass; + queryData << SoundOverrideSubclass; + queryData << Name1; + queryData << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name... + queryData << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00); + queryData << uint8(0x00); //pProto->Name4; // blizz not send name there, just uint8(0x00); + queryData << DisplayInfoID; + queryData << Quality; + queryData << Flags; + queryData << Flags2; + queryData << BuyPrice; + queryData << SellPrice; + queryData << InventoryType; + queryData << AllowableClass; + queryData << AllowableRace; + queryData << ItemLevel; + queryData << RequiredLevel; + queryData << RequiredSkill; + queryData << RequiredSkillRank; + queryData << RequiredSpell; + queryData << RequiredHonorRank; + queryData << RequiredCityRank; + queryData << RequiredReputationFaction; + queryData << RequiredReputationRank; + queryData << int32(MaxCount); + queryData << int32(Stackable); + queryData << ContainerSlots; + queryData << StatsCount; // item stats count + for (uint32 i = 0; i < StatsCount; ++i) + { + queryData << ItemStat[i].ItemStatType; + queryData << ItemStat[i].ItemStatValue; + } + queryData << ScalingStatDistribution; // scaling stats distribution + queryData << ScalingStatValue; // some kind of flags used to determine stat values column + for (int i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) + { + queryData << Damage[i].DamageMin; + queryData << Damage[i].DamageMax; + queryData << Damage[i].DamageType; + } - // resistances (7) - queryData << Armor; - queryData << HolyRes; - queryData << FireRes; - queryData << NatureRes; - queryData << FrostRes; - queryData << ShadowRes; - queryData << ArcaneRes; + // resistances (7) + queryData << Armor; + queryData << HolyRes; + queryData << FireRes; + queryData << NatureRes; + queryData << FrostRes; + queryData << ShadowRes; + queryData << ArcaneRes; - queryData << Delay; - queryData << AmmoType; - queryData << RangedModRange; + queryData << Delay; + queryData << AmmoType; + queryData << RangedModRange; - for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) - { - // send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown - // use `item_template` or if not set then only use spell cooldowns - SpellInfo const* spell = sSpellMgr->GetSpellInfo(Spells[s].SpellId); - if (spell) - { - bool db_data = Spells[s].SpellCooldown >= 0 || Spells[s].SpellCategoryCooldown >= 0; + for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) + { + // send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown + // use `item_template` or if not set then only use spell cooldowns + SpellInfo const* spell = sSpellMgr->GetSpellInfo(Spells[s].SpellId); + if (spell) + { + bool db_data = Spells[s].SpellCooldown >= 0 || Spells[s].SpellCategoryCooldown >= 0; - queryData << Spells[s].SpellId; - queryData << Spells[s].SpellTrigger; - queryData << uint32(-abs(Spells[s].SpellCharges)); + queryData << Spells[s].SpellId; + queryData << Spells[s].SpellTrigger; + queryData << uint32(-abs(Spells[s].SpellCharges)); - if (db_data) - { - queryData << uint32(Spells[s].SpellCooldown); - queryData << uint32(Spells[s].SpellCategory); - queryData << uint32(Spells[s].SpellCategoryCooldown); - } - else - { - queryData << uint32(spell->RecoveryTime); - queryData << uint32(spell->GetCategory()); - queryData << uint32(spell->CategoryRecoveryTime); - } - } - else - { - queryData << uint32(0); - queryData << uint32(0); - queryData << uint32(0); - queryData << uint32(-1); - queryData << uint32(0); - queryData << uint32(-1); - } - } - queryData << Bonding; - queryData << Description; - queryData << PageText; - queryData << LanguageID; - queryData << PageMaterial; - queryData << StartQuest; - queryData << LockID; - queryData << int32(Material); - queryData << Sheath; - queryData << RandomProperty; - queryData << RandomSuffix; - queryData << Block; - queryData << ItemSet; - queryData << MaxDurability; - queryData << Area; - queryData << Map; // Added in 1.12.x & 2.0.1 client branch - queryData << BagFamily; - queryData << TotemCategory; - for (int s = 0; s < MAX_ITEM_PROTO_SOCKETS; ++s) - { - queryData << Socket[s].Color; - queryData << Socket[s].Content; - } - queryData << socketBonus; - queryData << GemProperties; - queryData << RequiredDisenchantSkill; - queryData << ArmorDamageModifier; - queryData << Duration; // added in 2.4.2.8209, duration (seconds) - queryData << ItemLimitCategory; // WotLK, ItemLimitCategory - queryData << HolidayId; // Holiday.dbc? + if (db_data) + { + queryData << uint32(Spells[s].SpellCooldown); + queryData << uint32(Spells[s].SpellCategory); + queryData << uint32(Spells[s].SpellCategoryCooldown); + } + else + { + queryData << uint32(spell->RecoveryTime); + queryData << uint32(spell->GetCategory()); + queryData << uint32(spell->CategoryRecoveryTime); + } + } + else + { + queryData << uint32(0); + queryData << uint32(0); + queryData << uint32(0); + queryData << uint32(-1); + queryData << uint32(0); + queryData << uint32(-1); + } + } + queryData << Bonding; + queryData << Description; + queryData << PageText; + queryData << LanguageID; + queryData << PageMaterial; + queryData << StartQuest; + queryData << LockID; + queryData << int32(Material); + queryData << Sheath; + queryData << RandomProperty; + queryData << RandomSuffix; + queryData << Block; + queryData << ItemSet; + queryData << MaxDurability; + queryData << Area; + queryData << Map; // Added in 1.12.x & 2.0.1 client branch + queryData << BagFamily; + queryData << TotemCategory; + for (int s = 0; s < MAX_ITEM_PROTO_SOCKETS; ++s) + { + queryData << Socket[s].Color; + queryData << Socket[s].Content; + } + queryData << socketBonus; + queryData << GemProperties; + queryData << RequiredDisenchantSkill; + queryData << ArmorDamageModifier; + queryData << Duration; // added in 2.4.2.8209, duration (seconds) + queryData << ItemLimitCategory; // WotLK, ItemLimitCategory + queryData << HolidayId; // Holiday.dbc? } // Only _static_ data send in this packet !!! @@ -586,7 +586,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recvData) _player->RemoveItem(pItem->GetBagSlot(), pItem->GetSlot(), true); pItem->RemoveFromUpdateQueueOf(_player); _player->AddItemToBuyBackSlot(pItem); - _player->UpdateTitansGrip(); + _player->UpdateTitansGrip(); } uint32 money = pProto->SellPrice * count; @@ -871,7 +871,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData) _player->RemoveItem(srcbag, srcslot, true); _player->StoreItem(dest, pItem, true); - _player->UpdateTitansGrip(); + _player->UpdateTitansGrip(); } void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) @@ -958,7 +958,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) _player->RemoveItem(srcbag, srcslot, true); _player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount()); _player->BankItem(dest, pItem, true); - _player->UpdateTitansGrip(); + _player->UpdateTitansGrip(); } void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) @@ -990,8 +990,8 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) } _player->RemoveItem(srcbag, srcslot, true); - if (Item const* storedItem = _player->StoreItem(dest, pItem, true)) - _player->ItemAddedQuestCheck(storedItem->GetEntry(), storedItem->GetCount()); + if (Item const* storedItem = _player->StoreItem(dest, pItem, true)) + _player->ItemAddedQuestCheck(storedItem->GetEntry(), storedItem->GetCount()); } else // moving from inventory to bank { @@ -1005,7 +1005,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) _player->RemoveItem(srcbag, srcslot, true); _player->BankItem(dest, pItem, true); - _player->UpdateTitansGrip(); + _player->UpdateTitansGrip(); } } @@ -1107,8 +1107,8 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) return; } - // xinef: do not allow to wrap removed items, just in case - if (item->GetState() == ITEM_REMOVED) + // xinef: do not allow to wrap removed items, just in case + if (item->GetState() == ITEM_REMOVED) { _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL); return; @@ -1182,7 +1182,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) item->SetState(ITEM_CHANGED, _player); // after save it will be impossible to remove the item from the queue - _player->SaveInventoryAndGoldToDB(trans); + _player->SaveInventoryAndGoldToDB(trans); CharacterDatabase.CommitTransaction(trans); diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index b94673729..96bac48da 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -45,19 +45,19 @@ void BuildPartyLockDungeonBlock(WorldPacket& data, const lfg::LfgLockPartyMap& l void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) { - if (!sLFGMgr->isOptionEnabled(lfg::LFG_OPTION_ENABLE_DUNGEON_FINDER | lfg::LFG_OPTION_ENABLE_RAID_BROWSER)) - { - recvData.rfinish(); - return; - } + if (!sLFGMgr->isOptionEnabled(lfg::LFG_OPTION_ENABLE_DUNGEON_FINDER | lfg::LFG_OPTION_ENABLE_RAID_BROWSER)) + { + recvData.rfinish(); + return; + } - // pussywizard: - if (Group* g = GetPlayer()->GetGroup()) - if (g->isLFGGroup() ? g->GetMembersCount() == MAXGROUPSIZE : g->GetLeaderGUID() != GetPlayer()->GetGUID()) - { - recvData.rfinish(); - return; - } + // pussywizard: + if (Group* g = GetPlayer()->GetGroup()) + if (g->isLFGGroup() ? g->GetMembersCount() == MAXGROUPSIZE : g->GetLeaderGUID() != GetPlayer()->GetGUID()) + { + recvData.rfinish(); + return; + } uint8 numDungeons; uint32 roles; @@ -88,7 +88,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) recvData >> comment; ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_JOIN [" UI64FMTD "] roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetGUID(), roles, uint8(newDungeons.size()), comment.c_str()); - sLFGMgr->JoinLfg(GetPlayer(), uint8(roles), newDungeons, comment); + sLFGMgr->JoinLfg(GetPlayer(), uint8(roles), newDungeons, comment); } void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/) @@ -273,16 +273,16 @@ void WorldSession::HandleLfrSearchJoinOpcode(WorldPacket& recvData) { uint32 dungeonId; recvData >> dungeonId; - dungeonId = (dungeonId & 0x00FFFFFF); // remove the type from the dungeon entry - sLFGMgr->LfrSearchAdd(GetPlayer(), dungeonId); - sLFGMgr->SendRaidBrowserCachedList(GetPlayer(), dungeonId); + dungeonId = (dungeonId & 0x00FFFFFF); // remove the type from the dungeon entry + sLFGMgr->LfrSearchAdd(GetPlayer(), dungeonId); + sLFGMgr->SendRaidBrowserCachedList(GetPlayer(), dungeonId); } void WorldSession::HandleLfrSearchLeaveOpcode(WorldPacket& recvData) { uint32 dungeonId; recvData >> dungeonId; - sLFGMgr->LfrSearchRemove(GetPlayer()); + sLFGMgr->LfrSearchRemove(GetPlayer()); } void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/) @@ -428,7 +428,7 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck) Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid); data << uint8(player ? player->getLevel() : 0); // Level - for (lfg::LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it) + for (lfg::LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it) { if (it->first == roleCheck.leader) continue; @@ -516,11 +516,11 @@ void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardDat void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot) { uint64 guid = GetPlayer()->GetGUID(); - lfg::LfgAnswer playerVote = boot.votes.find(guid)->second; + lfg::LfgAnswer playerVote = boot.votes.find(guid)->second; uint8 votesNum = 0; uint8 agreeNum = 0; uint32 secsleft = boot.cancelTime - time(NULL); - for (lfg::LfgAnswerContainer::const_iterator it = boot.votes.begin(); it != boot.votes.end(); ++it) + for (lfg::LfgAnswerContainer::const_iterator it = boot.votes.begin(); it != boot.votes.end(); ++it) { if (it->second != lfg::LFG_ANSWER_PENDING) { diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 36e2afa89..c682c2df7 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -151,7 +151,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/) case HIGHGUID_VEHICLE: { Creature* creature = player->GetMap()->GetCreature(guid); - bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING); + bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING); if (lootAllowed && creature->IsWithinDistInMap(player, INTERACTION_DISTANCE)) { loot = &creature->loot; @@ -291,18 +291,18 @@ void WorldSession::DoLootRelease(uint64 lguid) go->SetLootState(GO_READY); } else - { + { go->SetLootState(GO_JUST_DEACTIVATED); - - // Xinef: moved event execution to loot release (after everything is looted) - // Xinef: 99% sure that this worked like this on blizz - // Xinef: prevents exploits with just opening GO and spawning bilions of npcs, which can crash core if you know what you're doin ;) - if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST && go->GetGOInfo()->chest.eventId) + + // Xinef: moved event execution to loot release (after everything is looted) + // Xinef: 99% sure that this worked like this on blizz + // Xinef: prevents exploits with just opening GO and spawning bilions of npcs, which can crash core if you know what you're doin ;) + if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST && go->GetGOInfo()->chest.eventId) { ;//sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Chest ScriptStart id %u for GO %u", gameObjTarget->GetGOInfo()->chest.eventId, gameObjTarget->GetDBTableGUIDLow()); player->GetMap()->ScriptsStart(sEventScripts, go->GetGOInfo()->chest.eventId, player, go); } - } + } loot->clear(); } @@ -324,7 +324,7 @@ void WorldSession::DoLootRelease(uint64 lguid) loot = &corpse->loot; - // Xinef: Buggs client? (Opening loot after closing) + // Xinef: Buggs client? (Opening loot after closing) //if (loot->isLooted()) { loot->clear(); @@ -337,7 +337,7 @@ void WorldSession::DoLootRelease(uint64 lguid) if (!pItem) return; - loot = &pItem->loot; + loot = &pItem->loot; ItemTemplate const* proto = pItem->GetTemplate(); // destroy only 5 items from stack in case prospecting and milling @@ -355,16 +355,16 @@ void WorldSession::DoLootRelease(uint64 lguid) player->DestroyItemCount(pItem, count, true); } else if (pItem->loot.isLooted() || !(proto->Flags & ITEM_PROTO_FLAG_OPENABLE)) - { + { player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true); - return; - } + return; + } } else { Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid); - bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING); + bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING); if (!lootAllowed || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) return; @@ -415,18 +415,18 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) Player* target = ObjectAccessor::GetPlayer(*_player, MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER)); if (!target) - { + { _player->SendLootError(lootguid, LOOT_ERROR_PLAYER_NOT_FOUND); return; - } + } ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName().c_str()); if (_player->GetLootGUID() != lootguid) - { + { _player->SendLootError(lootguid, LOOT_ERROR_DIDNT_KILL); return; - } + } if (!_player->IsInRaidWith(target)) { diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 3e5e04e56..02532edf3 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -33,7 +33,7 @@ bool WorldSession::CanOpenMailBox(uint64 guid) { if (guid == _player->GetGUID()) { - sLog->outError("%s attempt open mailbox in cheating way.", _player->GetName().c_str()); + sLog->outError("%s attempt open mailbox in cheating way.", _player->GetName().c_str()); return false; } else if (IS_GAMEOBJECT_GUID(guid)) @@ -155,11 +155,11 @@ void WorldSession::HandleSendMail(WorldPacket & recvData) } else { - // xinef: get data from global storage - if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(rc))) - { - rc_teamId = Player::TeamIdForRace(playerData->race); - mails_count = playerData->mailCount; + // xinef: get data from global storage + if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(rc))) + { + rc_teamId = Player::TeamIdForRace(playerData->race); + mails_count = playerData->mailCount; } } //do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255.. @@ -169,7 +169,7 @@ void WorldSession::HandleSendMail(WorldPacket & recvData) return; } // test the receiver's Faction... or all items are account bound - // Xinef: check for boa items, not used currently + // Xinef: check for boa items, not used currently /*bool accountBound = items_count && !money && !COD ? true : false; for (uint8 i = 0; i < items_count; ++i) { @@ -189,7 +189,7 @@ void WorldSession::HandleSendMail(WorldPacket & recvData) ? receive->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(rc); - if (/*!accountBound*/ GetAccountId() != rc_account && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && player->GetTeamId() != rc_teamId && AccountMgr::IsPlayerAccount(GetSecurity())) + if (/*!accountBound*/ GetAccountId() != rc_account && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && player->GetTeamId() != rc_teamId && AccountMgr::IsPlayerAccount(GetSecurity())) { player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM); return; @@ -270,8 +270,8 @@ void WorldSession::HandleSendMail(WorldPacket & recvData) player->MoveItemFromInventory(items[i]->GetBagSlot(), item->GetSlot(), true); item->DeleteFromInventoryDB(trans); // deletes item from character's inventory - if (item->GetState() == ITEM_UNCHANGED) - item->FSetState(ITEM_CHANGED); // pussywizard: so the item will be saved and owner will be updated in database + if (item->GetState() == ITEM_UNCHANGED) + item->FSetState(ITEM_CHANGED); // pussywizard: so the item will be saved and owner will be updated in database item->SetOwnerGUID(rc); item->SaveToDB(trans); // recursive and not have transaction guard into self, item not in inventory and can be save standalone @@ -282,11 +282,11 @@ void WorldSession::HandleSendMail(WorldPacket & recvData) needItemDelay = GetAccountId() != rc_account; } - if( money >= 10*GOLD ) - { - CleanStringForMysqlQuery(subject); - CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \" %s\", NOW())", GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), player->GetSession()->GetRemoteAddress().c_str(), rc_account, receiver.c_str(), money, subject.c_str()); - } + if( money >= 10*GOLD ) + { + CleanStringForMysqlQuery(subject); + CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \" %s\", NOW())", GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), player->GetSession()->GetRemoteAddress().c_str(), rc_account, receiver.c_str(), money, subject.c_str()); + } } // If theres is an item, there is a one hour delivery delay if sent to another account's character. @@ -354,8 +354,8 @@ void WorldSession::HandleMailDelete(WorldPacket & recvData) } m->state = MAIL_STATE_DELETED; - // xinef: update global data - sWorld->UpdateGlobalPlayerMails(player->GetGUIDLow(), -1); + // xinef: update global data + sWorld->UpdateGlobalPlayerMails(player->GetGUIDLow(), -1); } player->SendMailResult(mailId, MAIL_DELETED, MAIL_OK); } @@ -418,8 +418,8 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recvData) delete m; //we can deallocate old mail player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_OK); - // xinef: update global data - sWorld->UpdateGlobalPlayerMails(player->GetGUIDLow(), -1); + // xinef: update global data + sWorld->UpdateGlobalPlayerMails(player->GetGUIDLow(), -1); } //called when player takes item attached in mail @@ -445,13 +445,13 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recvData) } // verify that the mail has the item to avoid cheaters taking COD items without paying - bool foundItem = false; - for (std::vector::const_iterator itr = m->items.begin(); itr != m->items.end(); ++itr) - if (itr->item_guid == itemId) - { - foundItem = true; - break; - } + bool foundItem = false; + for (std::vector::const_iterator itr = m->items.begin(); itr != m->items.end(); ++itr) + if (itr->item_guid == itemId) + { + foundItem = true; + break; + } if (!foundItem) { player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR); @@ -480,9 +480,9 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recvData) uint64 sender_guid = MAKE_NEW_GUID(m->sender, 0, HIGHGUID_PLAYER); uint32 sender_accId = 0; Player* sender = ObjectAccessor::FindPlayerInOrOutOfWorld(sender_guid); - if (sender) - sender_accId = sender->GetSession()->GetAccountId(); - else + if (sender) + sender_accId = sender->GetSession()->GetAccountId(); + else sender_accId = sObjectMgr->GetPlayerAccountIdByGUID(sender_guid); // check player existence @@ -492,15 +492,15 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recvData) .AddMoney(m->COD) .SendMailTo(trans, MailReceiver(sender, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT); - if( m->COD >= 10*GOLD ) - { - std::string senderName; - if (!sObjectMgr->GetPlayerNameByGUID(sender_guid, senderName)) - senderName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN); - std::string subj = m->subject; - CleanStringForMysqlQuery(subj); - CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \" %s\", NOW())", GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), player->GetSession()->GetRemoteAddress().c_str(), sender_accId, senderName.c_str(), m->COD, subj.c_str()); - } + if( m->COD >= 10*GOLD ) + { + std::string senderName; + if (!sObjectMgr->GetPlayerNameByGUID(sender_guid, senderName)) + senderName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN); + std::string subj = m->subject; + CleanStringForMysqlQuery(subj); + CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \" %s\", NOW())", GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), player->GetSession()->GetRemoteAddress().c_str(), sender_accId, senderName.c_str(), m->COD, subj.c_str()); + } } player->ModifyMoney(-int32(m->COD)); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index cd0a585d9..03ebb65c1 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -173,199 +173,199 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) void WorldSession::HandleWhoOpcode(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message"); - time_t now = time(NULL); - if (now < timeWhoCommandAllowed) - return; - timeWhoCommandAllowed = now + 3; + time_t now = time(NULL); + if (now < timeWhoCommandAllowed) + return; + timeWhoCommandAllowed = now + 3; - uint32 matchcount = 0; + uint32 matchcount = 0; - uint32 level_min, level_max, racemask, classmask, zones_count, str_count; - uint32 zoneids[10]; // 10 is client limit - std::string player_name, guild_name; + uint32 level_min, level_max, racemask, classmask, zones_count, str_count; + uint32 zoneids[10]; // 10 is client limit + std::string player_name, guild_name; - recvData >> level_min; // maximal player level, default 0 - recvData >> level_max; // minimal player level, default 100 (MAX_LEVEL) - recvData >> player_name; // player name, case sensitive... + recvData >> level_min; // maximal player level, default 0 + recvData >> level_max; // minimal player level, default 100 (MAX_LEVEL) + recvData >> player_name; // player name, case sensitive... - recvData >> guild_name; // guild name, case sensitive... + recvData >> guild_name; // guild name, case sensitive... - recvData >> racemask; // race mask - recvData >> classmask; // class mask - recvData >> zones_count; // zones count, client limit = 10 (2.0.10) + recvData >> racemask; // race mask + recvData >> classmask; // class mask + recvData >> zones_count; // zones count, client limit = 10 (2.0.10) - if (zones_count > 10) - return; // can't be received from real client or broken packet + if (zones_count > 10) + return; // can't be received from real client or broken packet - for (uint32 i = 0; i < zones_count; ++i) - { - uint32 temp; - recvData >> temp; // zone id, 0 if zone is unknown... - zoneids[i] = temp; - sLog->outDebug(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]); - } + for (uint32 i = 0; i < zones_count; ++i) + { + uint32 temp; + recvData >> temp; // zone id, 0 if zone is unknown... + zoneids[i] = temp; + sLog->outDebug(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]); + } - recvData >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10) + recvData >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10) - if (str_count > 4) - return; // can't be received from real client or broken packet + if (str_count > 4) + return; // can't be received from real client or broken packet - sLog->outDebug(LOG_FILTER_NETWORKIO, "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count); - std::wstring str[4]; // 4 is client limit - for (uint32 i = 0; i < str_count; ++i) - { - std::string temp; - recvData >> temp; // user entered string, it used as universal search pattern(guild+player name)? + std::wstring str[4]; // 4 is client limit + for (uint32 i = 0; i < str_count; ++i) + { + std::string temp; + recvData >> temp; // user entered string, it used as universal search pattern(guild+player name)? - if (!Utf8toWStr(temp, str[i])) - continue; + if (!Utf8toWStr(temp, str[i])) + continue; - wstrToLower(str[i]); + wstrToLower(str[i]); - sLog->outDebug(LOG_FILTER_NETWORKIO, "String %u: %s", i, temp.c_str()); - } + sLog->outDebug(LOG_FILTER_NETWORKIO, "String %u: %s", i, temp.c_str()); + } - std::wstring wplayer_name; - std::wstring wguild_name; - if (!(Utf8toWStr(player_name, wplayer_name) && Utf8toWStr(guild_name, wguild_name))) - return; - wstrToLower(wplayer_name); - wstrToLower(wguild_name); + std::wstring wplayer_name; + std::wstring wguild_name; + if (!(Utf8toWStr(player_name, wplayer_name) && Utf8toWStr(guild_name, wguild_name))) + return; + wstrToLower(wplayer_name); + wstrToLower(wguild_name); - // client send in case not set max level value 100 but Trinity supports 255 max level, - // update it to show GMs with characters after 100 level - if (level_max >= MAX_LEVEL) - level_max = STRONG_MAX_LEVEL; + // client send in case not set max level value 100 but Trinity supports 255 max level, + // update it to show GMs with characters after 100 level + if (level_max >= MAX_LEVEL) + level_max = STRONG_MAX_LEVEL; - uint32 team = _player->GetTeamId(); - uint32 security = GetSecurity(); - bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); - uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); - uint32 displaycount = 0; + uint32 team = _player->GetTeamId(); + uint32 security = GetSecurity(); + bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); + uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); + uint32 displaycount = 0; - WorldPacket data(SMSG_WHO, 50); // guess size - data << uint32(matchcount); // placeholder, count of players matching criteria - data << uint32(displaycount); // placeholder, count of players displayed + WorldPacket data(SMSG_WHO, 50); // guess size + data << uint32(matchcount); // placeholder, count of players matching criteria + data << uint32(displaycount); // placeholder, count of players displayed - TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); - HashMapHolder::MapType const& m = sObjectAccessor->GetPlayers(); - for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) - { - if (AccountMgr::IsPlayerAccount(security)) - { - // player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST - if (itr->second->GetTeamId() != team && !allowTwoSideWhoList) - continue; + TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + HashMapHolder::MapType const& m = sObjectAccessor->GetPlayers(); + for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) + { + if (AccountMgr::IsPlayerAccount(security)) + { + // player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST + if (itr->second->GetTeamId() != team && !allowTwoSideWhoList) + continue; - // player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST - if ((itr->second->GetSession()->GetSecurity() > AccountTypes(gmLevelInWhoList))) - continue; - } + // player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST + if ((itr->second->GetSession()->GetSecurity() > AccountTypes(gmLevelInWhoList))) + continue; + } - //do not process players which are not in world - if (!(itr->second->IsInWorld())) - continue; + //do not process players which are not in world + if (!(itr->second->IsInWorld())) + continue; - // check if target is globally visible for player - if (!(itr->second->IsVisibleGloballyFor(_player))) - continue; + // check if target is globally visible for player + if (!(itr->second->IsVisibleGloballyFor(_player))) + continue; - // check if target's level is in level range - uint8 lvl = itr->second->getLevel(); - if (lvl < level_min || lvl > level_max) - continue; + // check if target's level is in level range + uint8 lvl = itr->second->getLevel(); + if (lvl < level_min || lvl > level_max) + continue; - // check if class matches classmask - uint32 class_ = itr->second->getClass(); - if (!(classmask & (1 << class_))) - continue; + // check if class matches classmask + uint32 class_ = itr->second->getClass(); + if (!(classmask & (1 << class_))) + continue; - // check if race matches racemask - uint32 race = itr->second->getRace(); - if (!(racemask & (1 << race))) - continue; + // check if race matches racemask + uint32 race = itr->second->getRace(); + if (!(racemask & (1 << race))) + continue; - uint32 pzoneid = itr->second->GetZoneId(); - uint8 gender = itr->second->getGender(); + uint32 pzoneid = itr->second->GetZoneId(); + uint8 gender = itr->second->getGender(); - bool z_show = true; - for (uint32 i = 0; i < zones_count; ++i) - { - if (zoneids[i] == pzoneid) - { - z_show = true; - break; - } + bool z_show = true; + for (uint32 i = 0; i < zones_count; ++i) + { + if (zoneids[i] == pzoneid) + { + z_show = true; + break; + } - z_show = false; - } - if (!z_show) - continue; + z_show = false; + } + if (!z_show) + continue; - std::string pname = itr->second->GetName(); - std::wstring wpname; - if (!Utf8toWStr(pname, wpname)) - continue; - wstrToLower(wpname); + std::string pname = itr->second->GetName(); + std::wstring wpname; + if (!Utf8toWStr(pname, wpname)) + continue; + wstrToLower(wpname); - if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos)) - continue; + if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos)) + continue; - std::string gname = sGuildMgr->GetGuildNameById(itr->second->GetGuildId()); - std::wstring wgname; - if (!Utf8toWStr(gname, wgname)) - continue; - wstrToLower(wgname); + std::string gname = sGuildMgr->GetGuildNameById(itr->second->GetGuildId()); + std::wstring wgname; + if (!Utf8toWStr(gname, wgname)) + continue; + wstrToLower(wgname); - if (!(wguild_name.empty() || wgname.find(wguild_name) != std::wstring::npos)) - continue; + if (!(wguild_name.empty() || wgname.find(wguild_name) != std::wstring::npos)) + continue; - std::string aname; - if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId())) - aname = areaEntry->area_name[GetSessionDbcLocale()]; + std::string aname; + if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId())) + aname = areaEntry->area_name[GetSessionDbcLocale()]; - bool s_show = true; - for (uint32 i = 0; i < str_count; ++i) - { - if (!str[i].empty()) - { - if (wgname.find(str[i]) != std::wstring::npos || - wpname.find(str[i]) != std::wstring::npos || - Utf8FitTo(aname, str[i])) - { - s_show = true; - break; - } - s_show = false; - } - } - if (!s_show) - continue; + bool s_show = true; + for (uint32 i = 0; i < str_count; ++i) + { + if (!str[i].empty()) + { + if (wgname.find(str[i]) != std::wstring::npos || + wpname.find(str[i]) != std::wstring::npos || + Utf8FitTo(aname, str[i])) + { + s_show = true; + break; + } + s_show = false; + } + } + if (!s_show) + continue; - // 49 is maximum player count sent to client - can be overridden - // through config, but is unstable - if ((matchcount++) >= 50 /*sWorld->getIntConfig(CONFIG_MAX_WHO)*/) - continue; + // 49 is maximum player count sent to client - can be overridden + // through config, but is unstable + if ((matchcount++) >= 50 /*sWorld->getIntConfig(CONFIG_MAX_WHO)*/) + continue; - data << pname; // player name - data << gname; // guild name - data << uint32(lvl); // player level - data << uint32(class_); // player class - data << uint32(race); // player race - data << uint8(gender); // player gender - data << uint32(pzoneid); // player zone id + data << pname; // player name + data << gname; // guild name + data << uint32(lvl); // player level + data << uint32(class_); // player class + data << uint32(race); // player race + data << uint8(gender); // player gender + data << uint32(pzoneid); // player zone id - ++displaycount; - } + ++displaycount; + } - data.put(0, displaycount); // insert right count, count displayed - data.put(4, matchcount); // insert right count, count of matches + data.put(0, displaycount); // insert right count, count displayed + data.put(4, matchcount); // insert right count, count of matches - SendPacket(&data); - ;// sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message"); + SendPacket(&data); + ;// sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message"); } @@ -524,17 +524,17 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data) ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to add friend : '%s'", GetPlayer()->GetName().c_str(), friendName.c_str()); - // xinef: Get Data From global storage - uint32 guidLow = sWorld->GetGlobalPlayerGUID(friendName); - if (!guidLow) - return; + // xinef: Get Data From global storage + uint32 guidLow = sWorld->GetGlobalPlayerGUID(friendName); + if (!guidLow) + return; - GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow); - if (!playerData) - return; + GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow); + if (!playerData) + return; uint64 friendGuid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER); - uint32 friendAccountId = playerData->accountId; + uint32 friendAccountId = playerData->accountId; TeamId teamId = Player::TeamIdForRace(playerData->race); FriendsResult friendResult = FRIEND_NOT_FOUND; @@ -544,7 +544,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data) { if (friendGuid == GetPlayer()->GetGUID()) friendResult = FRIEND_SELF; - else if (GetPlayer()->GetTeamId() != teamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && AccountMgr::IsPlayerAccount(GetSecurity())) + else if (GetPlayer()->GetTeamId() != teamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && AccountMgr::IsPlayerAccount(GetSecurity())) friendResult = FRIEND_ENEMY; else if (GetPlayer()->GetSocial()->HasFriend(guidLow)) friendResult = FRIEND_ALREADY; @@ -599,9 +599,9 @@ void WorldSession::HandleAddIgnoreOpcode(WorldPacket & recv_data) ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to Ignore: '%s'", // GetPlayer()->GetName().c_str(), ignoreName.c_str()); - uint32 lowGuid = sWorld->GetGlobalPlayerGUID(ignoreName); + uint32 lowGuid = sWorld->GetGlobalPlayerGUID(ignoreName); if (!lowGuid) - return; + return; uint64 IgnoreGuid = MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER); FriendsResult ignoreResult = FRIEND_IGNORE_NOT_FOUND; @@ -640,26 +640,26 @@ void WorldSession::HandleCharacterAuraFrozen(PreparedQueryResult result) if (!GetPlayer()) return; - ChatHandler handler = ChatHandler(this); + ChatHandler handler = ChatHandler(this); - // Select - if (!result) - { - handler.SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS); - return; - } + // Select + if (!result) + { + handler.SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS); + return; + } - // Header of the names - handler.PSendSysMessage(LANG_COMMAND_LIST_FREEZE); + // Header of the names + handler.PSendSysMessage(LANG_COMMAND_LIST_FREEZE); - // Output of the results - do - { - Field* fields = result->Fetch(); - std::string player = fields[0].GetString(); - handler.PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str()); - } - while (result->NextRow()); + // Output of the results + do + { + Field* fields = result->Fetch(); + std::string player = fields[0].GetString(); + handler.PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str()); + } + while (result->NextRow()); } void WorldSession::HandleDelIgnoreOpcode(WorldPacket & recv_data) @@ -757,8 +757,8 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data) recv_data >> guid; recv_data >> status; - // Xinef: Prevent resurrect with prevent resurrection aura - if (GetPlayer()->IsAlive() || GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) + // Xinef: Prevent resurrect with prevent resurrection aura + if (GetPlayer()->IsAlive() || GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) return; if (status == 0) @@ -1379,7 +1379,7 @@ void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/) group->ResetInstances(INSTANCE_RESET_ALL, false, _player); } else - Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_ALL, false); + Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_ALL, false); } void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) @@ -1406,17 +1406,17 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) if (!groupGuy) continue; - if (!groupGuy->IsInWorld()) - { - _player->SendDungeonDifficulty(group != NULL); + if (!groupGuy->IsInWorld()) + { + _player->SendDungeonDifficulty(group != NULL); return; - } + } - if (groupGuy->GetGUID() == _player->GetGUID() ? groupGuy->GetMap()->IsDungeon() : groupGuy->GetMap()->IsNonRaidDungeon()) - { - _player->SendDungeonDifficulty(group != NULL); + if (groupGuy->GetGUID() == _player->GetGUID() ? groupGuy->GetMap()->IsDungeon() : groupGuy->GetMap()->IsNonRaidDungeon()) + { + _player->SendDungeonDifficulty(group != NULL); return; - } + } } group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player); @@ -1425,11 +1425,11 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) } else { - if (_player->FindMap() && _player->FindMap()->IsDungeon()) - { - _player->SendDungeonDifficulty(group != NULL); - return; - } + if (_player->FindMap() && _player->FindMap()->IsDungeon()) + { + _player->SendDungeonDifficulty(group != NULL); + return; + } Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_CHANGE_DIFFICULTY, false); _player->SetDungeonDifficulty(Difficulty(mode)); } @@ -1453,26 +1453,26 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) { if (group->IsLeader(_player->GetGUID())) { - std::set foundMaps; - std::set foundMapsPtr; - Map* currMap = NULL; + std::set foundMaps; + std::set foundMapsPtr; + Map* currMap = NULL; - if (uint32 preventionTime = group->GetDifficultyChangePreventionTime()) - { - switch (group->GetDifficultyChangePreventionReason()) - { - case DIFFICULTY_PREVENTION_CHANGE_BOSS_KILLED: - ChatHandler(this).PSendSysMessage("Raid was in combat recently and may not change difficulty again for %u sec.", preventionTime); - break; - case DIFFICULTY_PREVENTION_CHANGE_RECENTLY_CHANGED: - default: - ChatHandler(this).PSendSysMessage("Raid difficulty has changed recently, and may not change again for %u sec.", preventionTime); - break; - } + if (uint32 preventionTime = group->GetDifficultyChangePreventionTime()) + { + switch (group->GetDifficultyChangePreventionReason()) + { + case DIFFICULTY_PREVENTION_CHANGE_BOSS_KILLED: + ChatHandler(this).PSendSysMessage("Raid was in combat recently and may not change difficulty again for %u sec.", preventionTime); + break; + case DIFFICULTY_PREVENTION_CHANGE_RECENTLY_CHANGED: + default: + ChatHandler(this).PSendSysMessage("Raid difficulty has changed recently, and may not change again for %u sec.", preventionTime); + break; + } - _player->SendRaidDifficulty(group != NULL); - return; - } + _player->SendRaidDifficulty(group != NULL); + return; + } for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { @@ -1480,113 +1480,113 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) if (!groupGuy) continue; - if (!groupGuy->IsInWorld()) - { - _player->SendRaidDifficulty(group != NULL); + if (!groupGuy->IsInWorld()) + { + _player->SendRaidDifficulty(group != NULL); return; - } + } - if ((groupGuy->GetMap()->GetId() == 631 || groupGuy->GetMap()->GetId() == 724) && mode%2 == _player->GetRaidDifficulty()%2 && group->isRaidGroup()) - { - if (!currMap) - currMap = groupGuy->GetMap(); - foundMaps.insert(groupGuy->GetMap()->GetId()); - foundMapsPtr.insert(groupGuy->GetMap()); - if (foundMaps.size() > 1 || foundMapsPtr.size() > 1) - { - _player->SendRaidDifficulty(group != NULL); - return; - } + if ((groupGuy->GetMap()->GetId() == 631 || groupGuy->GetMap()->GetId() == 724) && mode%2 == _player->GetRaidDifficulty()%2 && group->isRaidGroup()) + { + if (!currMap) + currMap = groupGuy->GetMap(); + foundMaps.insert(groupGuy->GetMap()->GetId()); + foundMapsPtr.insert(groupGuy->GetMap()); + if (foundMaps.size() > 1 || foundMapsPtr.size() > 1) + { + _player->SendRaidDifficulty(group != NULL); + return; + } - if (!groupGuy->IsAlive() || groupGuy->IsInCombat() || groupGuy->GetVictim() || groupGuy->m_mover != groupGuy || groupGuy->IsNonMeleeSpellCast(true) || !groupGuy->GetMotionMaster()->empty() && groupGuy->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE || !groupGuy->movespline->Finalized() || !groupGuy->GetMap()->ToInstanceMap() || !groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript() || groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress() || !groupGuy->Satisfy(sObjectMgr->GetAccessRequirement(groupGuy->GetMap()->GetId(), Difficulty(mode)), groupGuy->GetMap()->GetId(), false)) - { - _player->SendRaidDifficulty(group != NULL); - return; - } - } - else if (groupGuy->GetGUID() == _player->GetGUID() ? groupGuy->GetMap()->IsDungeon() : groupGuy->GetMap()->IsRaid()) - { - _player->SendRaidDifficulty(group != NULL); + if (!groupGuy->IsAlive() || groupGuy->IsInCombat() || groupGuy->GetVictim() || groupGuy->m_mover != groupGuy || groupGuy->IsNonMeleeSpellCast(true) || !groupGuy->GetMotionMaster()->empty() && groupGuy->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE || !groupGuy->movespline->Finalized() || !groupGuy->GetMap()->ToInstanceMap() || !groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript() || groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress() || !groupGuy->Satisfy(sObjectMgr->GetAccessRequirement(groupGuy->GetMap()->GetId(), Difficulty(mode)), groupGuy->GetMap()->GetId(), false)) + { + _player->SendRaidDifficulty(group != NULL); + return; + } + } + else if (groupGuy->GetGUID() == _player->GetGUID() ? groupGuy->GetMap()->IsDungeon() : groupGuy->GetMap()->IsRaid()) + { + _player->SendRaidDifficulty(group != NULL); return; - } + } } - Map* homeMap571 = sMapMgr->CreateMap(571, NULL); - Map* homeMap0 = sMapMgr->CreateMap(0, NULL); - ASSERT(homeMap0 && homeMap571); + Map* homeMap571 = sMapMgr->CreateMap(571, NULL); + Map* homeMap0 = sMapMgr->CreateMap(0, NULL); + ASSERT(homeMap0 && homeMap571); - std::map playerTeleport; - // handle here all players in the instance that are not in the group - if (currMap) - for (Map::PlayerList::const_iterator itr = currMap->GetPlayers().begin(); itr != currMap->GetPlayers().end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->GetGroup() != group) - { - if (!p->IsInWorld() || !p->IsAlive() || p->IsInCombat() || p->GetVictim() || p->m_mover != p || p->IsNonMeleeSpellCast(true) || !p->GetMotionMaster()->empty() && p->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE || !p->movespline->Finalized() || !p->GetMap()->ToInstanceMap() || !p->GetMap()->ToInstanceMap()->GetInstanceScript() || p->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress()) - { - _player->SendRaidDifficulty(group != NULL); - return; - } - playerTeleport[p]; - } - for (std::map::iterator itr = playerTeleport.begin(); itr != playerTeleport.end(); ++itr) - { - Player* p = itr->first; - Map* oldMap = p->GetMap(); - oldMap->RemovePlayerFromMap(p, false); - p->ResetMap(); - oldMap->AfterPlayerUnlinkFromMap(); - p->SetMap(homeMap0); - p->Relocate(0.0f, 0.0f, 0.0f, 0.0f); - if (!p->TeleportTo(571, 5790.20f, 2071.36f, 636.07f, 3.60f)) - p->GetSession()->KickPlayer(); - } + std::map playerTeleport; + // handle here all players in the instance that are not in the group + if (currMap) + for (Map::PlayerList::const_iterator itr = currMap->GetPlayers().begin(); itr != currMap->GetPlayers().end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->GetGroup() != group) + { + if (!p->IsInWorld() || !p->IsAlive() || p->IsInCombat() || p->GetVictim() || p->m_mover != p || p->IsNonMeleeSpellCast(true) || !p->GetMotionMaster()->empty() && p->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE || !p->movespline->Finalized() || !p->GetMap()->ToInstanceMap() || !p->GetMap()->ToInstanceMap()->GetInstanceScript() || p->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress()) + { + _player->SendRaidDifficulty(group != NULL); + return; + } + playerTeleport[p]; + } + for (std::map::iterator itr = playerTeleport.begin(); itr != playerTeleport.end(); ++itr) + { + Player* p = itr->first; + Map* oldMap = p->GetMap(); + oldMap->RemovePlayerFromMap(p, false); + p->ResetMap(); + oldMap->AfterPlayerUnlinkFromMap(); + p->SetMap(homeMap0); + p->Relocate(0.0f, 0.0f, 0.0f, 0.0f); + if (!p->TeleportTo(571, 5790.20f, 2071.36f, 636.07f, 3.60f)) + p->GetSession()->KickPlayer(); + } - bool anyoneInside = false; - playerTeleport.clear(); - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* groupGuy = itr->GetSource(); - if (!groupGuy) - continue; + bool anyoneInside = false; + playerTeleport.clear(); + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* groupGuy = itr->GetSource(); + if (!groupGuy) + continue; - if (groupGuy->GetMap()->GetId() == 631 || groupGuy->GetMap()->GetId() == 724) - { - anyoneInside = true; + if (groupGuy->GetMap()->GetId() == 631 || groupGuy->GetMap()->GetId() == 724) + { + anyoneInside = true; - float x,y,z,o; - groupGuy->GetPosition(x,y,z,o); - Map* oldMap = groupGuy->GetMap(); - oldMap->RemovePlayerFromMap(groupGuy, false); - groupGuy->ResetMap(); - oldMap->AfterPlayerUnlinkFromMap(); - groupGuy->SetMap(homeMap571); - groupGuy->Relocate(5790.20f, 2071.36f, 636.07f, 3.60f); - Position dest = {x, y, z+0.1f, o}; - playerTeleport[groupGuy] = dest; - } - } + float x,y,z,o; + groupGuy->GetPosition(x,y,z,o); + Map* oldMap = groupGuy->GetMap(); + oldMap->RemovePlayerFromMap(groupGuy, false); + groupGuy->ResetMap(); + oldMap->AfterPlayerUnlinkFromMap(); + groupGuy->SetMap(homeMap571); + groupGuy->Relocate(5790.20f, 2071.36f, 636.07f, 3.60f); + Position dest = {x, y, z+0.1f, o}; + playerTeleport[groupGuy] = dest; + } + } - if (!anyoneInside) // pussywizard: don't reset if changing ICC/RS difficulty while inside - group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player); + if (!anyoneInside) // pussywizard: don't reset if changing ICC/RS difficulty while inside + group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player); group->SetRaidDifficulty(Difficulty(mode)); - group->SetDifficultyChangePrevention(DIFFICULTY_PREVENTION_CHANGE_RECENTLY_CHANGED); + group->SetDifficultyChangePrevention(DIFFICULTY_PREVENTION_CHANGE_RECENTLY_CHANGED); - for (std::map::iterator itr = playerTeleport.begin(); itr != playerTeleport.end(); ++itr) - { - itr->first->SetRaidDifficulty(Difficulty(mode)); // needed for teleport not to fail - if (!itr->first->TeleportTo(*(foundMaps.begin()), itr->second.GetPositionX(), itr->second.GetPositionY(), itr->second.GetPositionZ(), itr->second.GetOrientation())) - itr->first->GetSession()->KickPlayer(); - } + for (std::map::iterator itr = playerTeleport.begin(); itr != playerTeleport.end(); ++itr) + { + itr->first->SetRaidDifficulty(Difficulty(mode)); // needed for teleport not to fail + if (!itr->first->TeleportTo(*(foundMaps.begin()), itr->second.GetPositionX(), itr->second.GetPositionY(), itr->second.GetPositionZ(), itr->second.GetOrientation())) + itr->first->GetSession()->KickPlayer(); + } } } else { - if (_player->FindMap() && _player->FindMap()->IsDungeon()) - { - _player->SendRaidDifficulty(group != NULL); - return; - } + if (_player->FindMap() && _player->FindMap()->IsDungeon()) + { + _player->SendRaidDifficulty(group != NULL); + return; + } Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_CHANGE_DIFFICULTY, true); _player->SetRaidDifficulty(Difficulty(mode)); } @@ -1621,12 +1621,12 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket & recv_data) uint64 guid; // guid - unused recv_data.readPackGUID(guid); - // pussywizard: typical check for incomming movement packets - if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID()) - { - recv_data.rfinish(); // prevent warnings spam - return; - } + // pussywizard: typical check for incomming movement packets + if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID()) + { + recv_data.rfinish(); // prevent warnings spam + return; + } recv_data.read_skip(); // unk diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 775600e08..aff9539c7 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -75,12 +75,12 @@ void WorldSession::HandleMoveWorldportAckOpcode() // reset instance validity, except if going to an instance inside an instance if (GetPlayer()->m_InstanceValid == false && !mInstance) - { + { GetPlayer()->m_InstanceValid = true; - // pussywizard: m_InstanceValid can be false only by leaving a group in an instance => so remove temp binds that could not be removed because player was still on the map! - if (!sInstanceSaveMgr->PlayerIsPermBoundToInstance(GetPlayer()->GetGUIDLow(), oldMap->GetId(), oldMap->GetDifficulty())) - sInstanceSaveMgr->PlayerUnbindInstance(GetPlayer()->GetGUIDLow(), oldMap->GetId(), oldMap->GetDifficulty(), true); - } + // pussywizard: m_InstanceValid can be false only by leaving a group in an instance => so remove temp binds that could not be removed because player was still on the map! + if (!sInstanceSaveMgr->PlayerIsPermBoundToInstance(GetPlayer()->GetGUIDLow(), oldMap->GetId(), oldMap->GetDifficulty())) + sInstanceSaveMgr->PlayerUnbindInstance(GetPlayer()->GetGUIDLow(), oldMap->GetId(), oldMap->GetDifficulty(), true); + } // relocate the player to the teleport destination Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer()); @@ -108,34 +108,34 @@ void WorldSession::HandleMoveWorldportAckOpcode() return; } - oldMap->AfterPlayerUnlinkFromMap(); + oldMap->AfterPlayerUnlinkFromMap(); - // pussywizard: transport teleport couldn't teleport us to the same map (some other teleport pending, reqs not met, etc.), but we still have transport set until player moves! clear it if map differs (crashfix) - if (Transport* t = _player->GetTransport()) - if (!t->IsInMap(_player)) - { - t->RemovePassenger(_player); - _player->m_transport = NULL; - _player->m_movementInfo.transport.Reset(); - _player->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); - } + // pussywizard: transport teleport couldn't teleport us to the same map (some other teleport pending, reqs not met, etc.), but we still have transport set until player moves! clear it if map differs (crashfix) + if (Transport* t = _player->GetTransport()) + if (!t->IsInMap(_player)) + { + t->RemovePassenger(_player); + _player->m_transport = NULL; + _player->m_movementInfo.transport.Reset(); + _player->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT); + } - if (!_player->getHostileRefManager().isEmpty()) - _player->getHostileRefManager().deleteReferences(); // pussywizard: multithreading crashfix + if (!_player->getHostileRefManager().isEmpty()) + _player->getHostileRefManager().deleteReferences(); // pussywizard: multithreading crashfix - CellCoord pair(Trinity::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY())); - Cell cell(pair); - if (!GridCoord(cell.GridX(), cell.GridY()).IsCoordValid()) - { + CellCoord pair(Trinity::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY())); + Cell cell(pair); + if (!GridCoord(cell.GridX(), cell.GridY()).IsCoordValid()) + { KickPlayer(); return; } - newMap->LoadGrid(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); + newMap->LoadGrid(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); - // pussywizard: player supposed to enter bg map + // pussywizard: player supposed to enter bg map if (_player->InBattleground()) { - // but landed on another map, cleanup data + // but landed on another map, cleanup data if (!mEntry->IsBattlegroundOrArena()) _player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL); // everything ok @@ -146,39 +146,39 @@ void WorldSession::HandleMoveWorldportAckOpcode() } } - // pussywizard: arena spectator stuff - { - if (newMap->IsBattleArena() && ((BattlegroundMap*)newMap)->GetBG() && _player->HasPendingSpectatorForBG(((BattlegroundMap*)newMap)->GetInstanceId())) - { - _player->ClearReceivedSpectatorResetFor(); - _player->SetIsSpectator(true); - ArenaSpectator::SendCommand(_player, "%sENABLE", SPECTATOR_ADDON_PREFIX); - ((BattlegroundMap*)newMap)->GetBG()->AddSpectator(_player); - ArenaSpectator::HandleResetCommand(_player); - } - else - _player->SetIsSpectator(false); + // pussywizard: arena spectator stuff + { + if (newMap->IsBattleArena() && ((BattlegroundMap*)newMap)->GetBG() && _player->HasPendingSpectatorForBG(((BattlegroundMap*)newMap)->GetInstanceId())) + { + _player->ClearReceivedSpectatorResetFor(); + _player->SetIsSpectator(true); + ArenaSpectator::SendCommand(_player, "%sENABLE", SPECTATOR_ADDON_PREFIX); + ((BattlegroundMap*)newMap)->GetBG()->AddSpectator(_player); + ArenaSpectator::HandleResetCommand(_player); + } + else + _player->SetIsSpectator(false); - GetPlayer()->SetPendingSpectatorForBG(0); - timeWhoCommandAllowed = time(NULL) + sWorld->GetNextWhoListUpdateDelaySecs() + 1; // after exiting arena Subscribe will scan for a player and cached data says he is still in arena, so disallow until next update + GetPlayer()->SetPendingSpectatorForBG(0); + timeWhoCommandAllowed = time(NULL) + sWorld->GetNextWhoListUpdateDelaySecs() + 1; // after exiting arena Subscribe will scan for a player and cached data says he is still in arena, so disallow until next update - if (uint32 inviteInstanceId = _player->GetPendingSpectatorInviteInstanceId()) - { - if (Battleground* tbg = sBattlegroundMgr->GetBattleground(inviteInstanceId)) - tbg->RemoveToBeTeleported(_player->GetGUID()); - _player->SetPendingSpectatorInviteInstanceId(0); - } - } + if (uint32 inviteInstanceId = _player->GetPendingSpectatorInviteInstanceId()) + { + if (Battleground* tbg = sBattlegroundMgr->GetBattleground(inviteInstanceId)) + tbg->RemoveToBeTeleported(_player->GetGUID()); + _player->SetPendingSpectatorInviteInstanceId(0); + } + } - // xinef: do this again, player can be teleported inside bg->AddPlayer(_player)!!!! - CellCoord pair2(Trinity::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY())); - Cell cell2(pair2); - if (!GridCoord(cell2.GridX(), cell2.GridY()).IsCoordValid()) - { + // xinef: do this again, player can be teleported inside bg->AddPlayer(_player)!!!! + CellCoord pair2(Trinity::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY())); + Cell cell2(pair2); + if (!GridCoord(cell2.GridX(), cell2.GridY()).IsCoordValid()) + { KickPlayer(); return; } - newMap->LoadGrid(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); + newMap->LoadGrid(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); GetPlayer()->SendInitialPacketsAfterAddToMap(); @@ -256,35 +256,35 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData) uint32 old_zone = plMover->GetZoneId(); WorldLocation const& dest = plMover->GetTeleportDest(); - Position oldPos(*plMover); + Position oldPos(*plMover); plMover->UpdatePosition(dest, true); - // xinef: teleport pets if they are not unsummoned - if (Pet* pet = plMover->GetPet()) - { - if (!pet->IsWithinDist3d(plMover, plMover->GetMap()->GetVisibilityRange()-5.0f)) - pet->NearTeleportTo(plMover->GetPositionX(), plMover->GetPositionY(), plMover->GetPositionZ(), pet->GetOrientation()); - } + // xinef: teleport pets if they are not unsummoned + if (Pet* pet = plMover->GetPet()) + { + if (!pet->IsWithinDist3d(plMover, plMover->GetMap()->GetVisibilityRange()-5.0f)) + pet->NearTeleportTo(plMover->GetPositionX(), plMover->GetPositionY(), plMover->GetPositionZ(), pet->GetOrientation()); + } - if (oldPos.GetExactDist2d(plMover) > 100.0f) - { - uint32 newzone, newarea; - plMover->GetZoneAndAreaId(newzone, newarea, true); - plMover->UpdateZone(newzone, newarea); + if (oldPos.GetExactDist2d(plMover) > 100.0f) + { + uint32 newzone, newarea; + plMover->GetZoneAndAreaId(newzone, newarea, true); + plMover->UpdateZone(newzone, newarea); - // new zone - if (old_zone != newzone) - { - // honorless target - if (plMover->pvpInfo.IsHostile) - plMover->CastSpell(plMover, 2479, true); + // new zone + if (old_zone != newzone) + { + // honorless target + if (plMover->pvpInfo.IsHostile) + plMover->CastSpell(plMover, 2479, true); - // in friendly area - else if (plMover->IsPvP() && !plMover->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP)) - plMover->UpdatePvP(false, false); - } - } + // in friendly area + else if (plMover->IsPvP() && !plMover->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP)) + plMover->UpdatePvP(false, false); + } + } // resummon pet GetPlayer()->ResummonPetTemporaryUnSummonedIfAny(); @@ -292,11 +292,11 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData) //lets process all delayed operations on successful teleport GetPlayer()->ProcessDelayedOperations(); - plMover->GetMotionMaster()->ReinitializeMovement(); + plMover->GetMotionMaster()->ReinitializeMovement(); - // pussywizard: client forgets about losing control, resend it - if (plMover->HasUnitState(UNIT_STATE_FLEEING|UNIT_STATE_CONFUSED) || plMover->IsCharmed()) // only in such cases SetClientControl(self, false) is sent - plMover->SetClientControl(plMover, false, true); + // pussywizard: client forgets about losing control, resend it + if (plMover->HasUnitState(UNIT_STATE_FLEEING|UNIT_STATE_CONFUSED) || plMover->IsCharmed()) // only in such cases SetClientControl(self, false) is sent + plMover->SetClientControl(plMover, false, true); } void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) @@ -339,9 +339,9 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) if (movementInfo.flags & MOVEMENTFLAG_ONTRANSPORT) { - // T_POS ON VEHICLES! - if (mover->GetVehicle()) - movementInfo.transport.pos = mover->m_movementInfo.transport.pos; + // T_POS ON VEHICLES! + if (mover->GetVehicle()) + movementInfo.transport.pos = mover->m_movementInfo.transport.pos; // transports size limited // (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped) @@ -404,9 +404,9 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) // now client not include swimming flag in case jumping under water plrMover->SetInWater(!plrMover->IsInWater() || plrMover->GetBaseMap()->IsUnderWater(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY(), movementInfo.pos.GetPositionZ())); } - // Dont allow to turn on walking if charming other player - if (mover->GetGUID() != _player->GetGUID()) - movementInfo.flags &= ~MOVEMENTFLAG_WALKING; + // Dont allow to turn on walking if charming other player + if (mover->GetGUID() != _player->GetGUID()) + movementInfo.flags &= ~MOVEMENTFLAG_WALKING; uint32 mstime = World::GetGameTimeMS(); /*----------------------*/ @@ -415,19 +415,19 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE if (mover->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) - { - // Xinef: skip moving packets - if (movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING)) - return; - movementInfo.pos.Relocate(mover->GetPositionX(), mover->GetPositionY(), mover->GetPositionZ()); + { + // Xinef: skip moving packets + if (movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING)) + return; + movementInfo.pos.Relocate(mover->GetPositionX(), mover->GetPositionY(), mover->GetPositionZ()); - if (mover->GetTypeId() == TYPEID_UNIT) - { - movementInfo.transport.guid = mover->m_movementInfo.transport.guid; - movementInfo.transport.pos.Relocate(mover->m_movementInfo.transport.pos.GetPositionX(), mover->m_movementInfo.transport.pos.GetPositionY(), mover->m_movementInfo.transport.pos.GetPositionZ()); - movementInfo.transport.seat = mover->m_movementInfo.transport.seat; - } - } + if (mover->GetTypeId() == TYPEID_UNIT) + { + movementInfo.transport.guid = mover->m_movementInfo.transport.guid; + movementInfo.transport.pos.Relocate(mover->m_movementInfo.transport.pos.GetPositionX(), mover->m_movementInfo.transport.pos.GetPositionY(), mover->m_movementInfo.transport.pos.GetPositionZ()); + movementInfo.transport.seat = mover->m_movementInfo.transport.seat; + } + } /* process position-change */ WorldPacket data(opcode, recvData.size()); @@ -444,28 +444,28 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData) if (mover->GetVehicle()) { mover->SetOrientation(movementInfo.pos.GetOrientation()); - mover->UpdatePosition(movementInfo.pos); + mover->UpdatePosition(movementInfo.pos); return; } - // pussywizard: previously always mover->UpdatePosition(movementInfo.pos); - if (movementInfo.flags & MOVEMENTFLAG_ONTRANSPORT && mover->GetTransport()) - { - float x, y, z, o; - movementInfo.transport.pos.GetPosition(x, y, z, o); - mover->GetTransport()->CalculatePassengerPosition(x, y, z, &o); - mover->UpdatePosition(x, y, z, o); - } - else - mover->UpdatePosition(movementInfo.pos); + // pussywizard: previously always mover->UpdatePosition(movementInfo.pos); + if (movementInfo.flags & MOVEMENTFLAG_ONTRANSPORT && mover->GetTransport()) + { + float x, y, z, o; + movementInfo.transport.pos.GetPosition(x, y, z, o); + mover->GetTransport()->CalculatePassengerPosition(x, y, z, &o); + mover->UpdatePosition(x, y, z, o); + } + else + mover->UpdatePosition(movementInfo.pos); - // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map). - // Xinef: moved it here, previously StopMoving function called when player died relocated him to last saved coordinates (which were in air) + // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map). + // Xinef: moved it here, previously StopMoving function called when player died relocated him to last saved coordinates (which were in air) if (opcode == MSG_MOVE_FALL_LAND && plrMover && !plrMover->IsInFlight() && (!plrMover->GetTransport() || plrMover->GetTransport()->IsStaticTransport())) plrMover->HandleFall(movementInfo); - // Xinef: interrupt parachutes upon falling or landing in water - if (opcode == MSG_MOVE_FALL_LAND || opcode == MSG_MOVE_START_SWIM) - mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // Parachutes + // Xinef: interrupt parachutes upon falling or landing in water + if (opcode == MSG_MOVE_FALL_LAND || opcode == MSG_MOVE_START_SWIM) + mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // Parachutes if (plrMover) // nothing is charmed, or player charmed @@ -502,12 +502,12 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) recvData.readPackGUID(guid); - // pussywizard: special check, only player mover allowed here - if (guid != _player->m_mover->GetGUID() || guid != _player->GetGUID()) - { - recvData.rfinish(); // prevent warnings spam - return; - } + // pussywizard: special check, only player mover allowed here + if (guid != _player->m_mover->GetGUID() || guid != _player->GetGUID()) + { + recvData.rfinish(); // prevent warnings spam + return; + } // continue parse packet @@ -590,12 +590,12 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recvData) uint64 old_mover_guid; recvData.readPackGUID(old_mover_guid); - // pussywizard: typical check for incomming movement packets - if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || old_mover_guid != _player->m_mover->GetGUID()) - { - recvData.rfinish(); // prevent warnings spam - return; - } + // pussywizard: typical check for incomming movement packets + if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || old_mover_guid != _player->m_mover->GetGUID()) + { + recvData.rfinish(); // prevent warnings spam + return; + } MovementInfo mi; mi.guid = old_mover_guid; @@ -619,12 +619,12 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket & recvData) uint64 guid; recvData.readPackGUID(guid); - // pussywizard: typical check for incomming movement packets - if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID()) - { - recvData.rfinish(); // prevent warnings spam - return; - } + // pussywizard: typical check for incomming movement packets + if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID()) + { + recvData.rfinish(); // prevent warnings spam + return; + } recvData.read_skip(); // unk @@ -657,7 +657,7 @@ void WorldSession::HandleMoveHoverAck(WorldPacket& recvData) recvData.read_skip(); // unk MovementInfo movementInfo; - movementInfo.guid = guid; + movementInfo.guid = guid; ReadMovementInfo(recvData, &movementInfo); recvData.read_skip(); // unk2 @@ -673,7 +673,7 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData) recvData.read_skip(); // unk MovementInfo movementInfo; - movementInfo.guid = guid; + movementInfo.guid = guid; ReadMovementInfo(recvData, &movementInfo); recvData.read_skip(); // unk2 @@ -689,16 +689,16 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData) recvData >> summoner_guid; recvData >> agree; - if (agree && _player->IsSummonAsSpectator()) - { - ChatHandler chc(this); - if (Player* summoner = ObjectAccessor::FindPlayer(summoner_guid)) - ArenaSpectator::HandleSpectatorSpectateCommand(&chc, summoner->GetName().c_str()); - else - chc.PSendSysMessage("Requested player not found."); + if (agree && _player->IsSummonAsSpectator()) + { + ChatHandler chc(this); + if (Player* summoner = ObjectAccessor::FindPlayer(summoner_guid)) + ArenaSpectator::HandleSpectatorSpectateCommand(&chc, summoner->GetName().c_str()); + else + chc.PSendSysMessage("Requested player not found."); agree = false; - } - _player->SetSummonAsSpectator(false); + } + _player->SetSummonAsSpectator(false); _player->SummonIfPossible(agree); } diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 97c34f563..e19e96ce8 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -310,13 +310,13 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recvData) return; } - // xinef: check if we have ANY npc flags - if (unit->GetUInt32Value(UNIT_NPC_FLAGS) == UNIT_NPC_FLAG_NONE) - return; + // xinef: check if we have ANY npc flags + if (unit->GetUInt32Value(UNIT_NPC_FLAGS) == UNIT_NPC_FLAG_NONE) + return; - // xinef: do not allow to open gossip when npc is in combat - if (unit->GetUInt32Value(UNIT_NPC_FLAGS) == UNIT_NPC_FLAG_GOSSIP && unit->IsInCombat()) // should work on all flags? - return; + // xinef: do not allow to open gossip when npc is in combat + if (unit->GetUInt32Value(UNIT_NPC_FLAGS) == UNIT_NPC_FLAG_GOSSIP && unit->IsInCombat()) // should work on all flags? + return; // set faction visible if needed if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction())) @@ -327,7 +327,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recvData) //if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) // GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - // xinef: and if he has pure gossip or is banker and moves or is tabard designer? + // xinef: and if he has pure gossip or is banker and moves or is tabard designer? //if (unit->IsArmorer() || unit->IsCivilian() || unit->IsQuestGiver() || unit->IsServiceProvider() || unit->IsGuard()) { //if (!unit->GetTransport()) // pussywizard: reverted with new spline (old: without this check, npc would stay in place and the transport would continue moving, so the npc falls off. NPCs on transports don't have waypoints, so stopmoving is not needed) @@ -727,7 +727,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32 if (pet) _player->RemovePet(pet, PET_SAVE_AS_DELETED); - if (!Pet::LoadPetFromDB(_player, PET_LOAD_HANDLE_UNSTABLE_CALLBACK, petEntry, petId)) + if (!Pet::LoadPetFromDB(_player, PET_LOAD_HANDLE_UNSTABLE_CALLBACK, petEntry, petId)) { SendStableResult(STABLE_ERR_STABLE); return; @@ -854,7 +854,7 @@ void WorldSession::HandleStableSwapPetCallback(PreparedQueryResult result, uint3 _player->RemovePet(pet, pet->IsAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED); // summon unstabled pet - if (!Pet::LoadPetFromDB(_player, PET_LOAD_HANDLE_UNSTABLE_CALLBACK, petEntry, petId)) + if (!Pet::LoadPetFromDB(_player, PET_LOAD_HANDLE_UNSTABLE_CALLBACK, petEntry, petId)) { SendStableResult(STABLE_ERR_STABLE); } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 7f0758de7..cb9297c1b 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -37,23 +37,23 @@ class LoadPetFromDBQueryHolder : public SQLQueryHolder { private: - const uint32 m_petNumber; - const uint32 m_diffTime; - const bool m_current; - const uint32 m_savedHealth; - const uint32 m_savedMana; - const std::string m_actionBar; + const uint32 m_petNumber; + const uint32 m_diffTime; + const bool m_current; + const uint32 m_savedHealth; + const uint32 m_savedMana; + const std::string m_actionBar; public: - LoadPetFromDBQueryHolder(uint32 petNumber, bool current, uint32 diffTime, std::string actionBar, uint32 health, uint32 mana) + LoadPetFromDBQueryHolder(uint32 petNumber, bool current, uint32 diffTime, std::string actionBar, uint32 health, uint32 mana) : m_petNumber(petNumber), m_current(current), m_diffTime(diffTime), m_actionBar(actionBar), - m_savedHealth(health), m_savedMana(mana) { } + m_savedHealth(health), m_savedMana(mana) { } uint32 GetPetNumber() const { return m_petNumber; } - uint32 GetDiffTime() const { return m_diffTime; } - bool GetCurrent() const { return m_current; } - uint32 GetSavedHealth() const { return m_savedHealth; } - uint32 GetSavedMana() const { return m_savedMana; } - std::string GetActionBar() const { return m_actionBar; } + uint32 GetDiffTime() const { return m_diffTime; } + bool GetCurrent() const { return m_current; } + uint32 GetSavedHealth() const { return m_savedHealth; } + uint32 GetSavedMana() const { return m_savedMana; } + std::string GetActionBar() const { return m_actionBar; } bool Initialize(); }; @@ -64,17 +64,17 @@ bool LoadPetFromDBQueryHolder::Initialize() bool res = true; PreparedStatement* stmt = NULL; - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_AURA); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_AURA); stmt->setUInt32(0, m_petNumber); res &= SetPreparedQuery(PET_LOAD_QUERY_LOADAURAS, stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL); stmt->setUInt32(0, m_petNumber); - res &= SetPreparedQuery(PET_LOAD_QUERY_LOADSPELLS, stmt); + res &= SetPreparedQuery(PET_LOAD_QUERY_LOADSPELLS, stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL_COOLDOWN); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SPELL_COOLDOWN); stmt->setUInt32(0, m_petNumber); - res &= SetPreparedQuery(PET_LOAD_QUERY_LOADSPELLCOOLDOWN, stmt); + res &= SetPreparedQuery(PET_LOAD_QUERY_LOADSPELLCOOLDOWN, stmt); return res; } @@ -89,41 +89,41 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, Field* fields = result->Fetch(); - // Xinef: this can happen if fetch is called twice, impossibru. - if (!fields) - return PET_LOAD_ERROR; + // Xinef: this can happen if fetch is called twice, impossibru. + if (!fields) + return PET_LOAD_ERROR; - Player* owner = GetPlayer(); + Player* owner = GetPlayer(); // update for case of current pet "slot = 0" uint32 petentry = fields[1].GetUInt32(); if (!petentry) return PET_LOAD_NO_RESULT; - uint8 petSlot = fields[7].GetUInt8(); - bool current = petSlot == PET_SAVE_AS_CURRENT; + uint8 petSlot = fields[7].GetUInt8(); + bool current = petSlot == PET_SAVE_AS_CURRENT; uint32 summon_spell_id = fields[15].GetUInt32(); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(summon_spell_id); // CANT BE NULL bool is_temporary_summoned = spellInfo && spellInfo->GetDuration() > 0; uint32 pet_number = fields[0].GetUInt32(); - uint32 savedhealth = fields[10].GetUInt32(); + uint32 savedhealth = fields[10].GetUInt32(); uint32 savedmana = fields[11].GetUInt32(); - PetType pet_type = PetType(fields[16].GetUInt8()); + PetType pet_type = PetType(fields[16].GetUInt8()); - // xinef: BG resurrect, overwrite saved value - if (asynchLoadType == PET_LOAD_BG_RESURRECT) - savedhealth = 1; + // xinef: BG resurrect, overwrite saved value + if (asynchLoadType == PET_LOAD_BG_RESURRECT) + savedhealth = 1; - if (pet_type == HUNTER_PET && savedhealth == 0 && asynchLoadType != PET_LOAD_SUMMON_DEAD_PET) - { - WorldPacket data(SMSG_CAST_FAILED, 1+4+1+4); + if (pet_type == HUNTER_PET && savedhealth == 0 && asynchLoadType != PET_LOAD_SUMMON_DEAD_PET) + { + WorldPacket data(SMSG_CAST_FAILED, 1+4+1+4); data << uint8(0); data << uint32(883); data << uint8(SPELL_FAILED_TARGETS_DEAD); SendPacket(&data); - owner->RemoveSpellCooldown(883, false); - return PET_LOAD_ERROR; - } + owner->RemoveSpellCooldown(883, false); + return PET_LOAD_ERROR; + } // check temporary summoned pets like mage water elemental if (current && is_temporary_summoned) @@ -138,26 +138,26 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, Map* map = owner->GetMap(); uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_PET); - Pet* pet = new Pet(owner, pet_type); - LoadPetFromDBQueryHolder* holder = new LoadPetFromDBQueryHolder(pet_number, current, uint32(time(NULL) - fields[14].GetUInt32()), fields[13].GetString(), savedhealth, savedmana); + Pet* pet = new Pet(owner, pet_type); + LoadPetFromDBQueryHolder* holder = new LoadPetFromDBQueryHolder(pet_number, current, uint32(time(NULL) - fields[14].GetUInt32()), fields[13].GetString(), savedhealth, savedmana); if (!pet->Create(guid, map, owner->GetPhaseMask(), petentry, pet_number) || !holder->Initialize()) - { - delete pet; - delete holder; + { + delete pet; + delete holder; return PET_LOAD_ERROR; - } + } float px, py, pz; owner->GetClosePoint(px, py, pz, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle()); if (!pet->IsPositionValid()) { sLog->outError("Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); - delete pet; - delete holder; + delete pet; + delete holder; return PET_LOAD_ERROR; } - pet->SetLoading(true); + pet->SetLoading(true); pet->Relocate(px, py, pz, owner->GetOrientation()); pet->setPetType(pet_type); pet->setFaction(owner->getFaction()); @@ -166,8 +166,8 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, if (pet->IsCritter()) { map->AddToMap(pet->ToCreature(), true); - pet->SetLoading(false); // xinef, mine - delete holder; + pet->SetLoading(false); // xinef, mine + delete holder; return PET_LOAD_OK; } @@ -184,10 +184,10 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, case SUMMON_PET: petlevel = owner->getLevel(); - if (pet->IsPetGhoul()) - pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 0x400); // class = rogue - else - pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 0x800); // class = mage + if (pet->IsPetGhoul()) + pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 0x400); // class = rogue + else + pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 0x800); // class = mage pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); // this enables popup window (pet dismiss, cancel) @@ -211,7 +211,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped here pet->SetCreatorGUID(owner->GetGUID()); - owner->SetMinion(pet, true); + owner->SetMinion(pet, true); pet->InitStatsForLevel(petlevel); pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32()); @@ -260,10 +260,10 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, owner->SendMessageToSet(&data, true); } - // do it as early as possible! - pet->InitTalentForLevel(); // set original talents points before spell loading - if (!is_temporary_summoned) - pet->GetCharmInfo()->InitPetActionBar(); + // do it as early as possible! + pet->InitTalentForLevel(); // set original talents points before spell loading + if (!is_temporary_summoned) + pet->GetCharmInfo()->InitPetActionBar(); map->AddToMap(pet->ToCreature(), true); if (pet->getPetType() == SUMMON_PET && !current) //all (?) summon pets come with full health when called, but not when they are current @@ -274,34 +274,34 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, pet->SetPower(POWER_MANA, savedmana > pet->GetMaxPower(POWER_MANA) ? pet->GetMaxPower(POWER_MANA) : savedmana); } - pet->SetAsynchLoadType(asynchLoadType); + pet->SetAsynchLoadType(asynchLoadType); - // xinef: clear any old result - if (_loadPetFromDBSecondCallback.ready()) - { - SQLQueryHolder* param; - _loadPetFromDBSecondCallback.get(param); - delete param; - } - _loadPetFromDBSecondCallback.cancel(); + // xinef: clear any old result + if (_loadPetFromDBSecondCallback.ready()) + { + SQLQueryHolder* param; + _loadPetFromDBSecondCallback.get(param); + delete param; + } + _loadPetFromDBSecondCallback.cancel(); _loadPetFromDBSecondCallback = CharacterDatabase.DelayQueryHolder((SQLQueryHolder*)holder); - return PET_LOAD_OK; + return PET_LOAD_OK; } void WorldSession::HandleLoadPetFromDBSecondCallback(LoadPetFromDBQueryHolder* holder) { - if (!GetPlayer()) + if (!GetPlayer()) return; - Player* owner = GetPlayer(); - Pet* pet = owner->GetPet(); - if (!pet) - return; + Player* owner = GetPlayer(); + Pet* pet = owner->GetPet(); + if (!pet) + return; - pet->_LoadAuras(holder->GetPreparedResult(PET_LOAD_QUERY_LOADAURAS), holder->GetDiffTime()); - bool current = holder->GetCurrent(); - uint32 summon_spell_id = pet->GetUInt32Value(UNIT_CREATED_BY_SPELL); + pet->_LoadAuras(holder->GetPreparedResult(PET_LOAD_QUERY_LOADAURAS), holder->GetDiffTime()); + bool current = holder->GetCurrent(); + uint32 summon_spell_id = pet->GetUInt32Value(UNIT_CREATED_BY_SPELL); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(summon_spell_id); // CANT BE NULL bool is_temporary_summoned = spellInfo && spellInfo->GetDuration() > 0; @@ -315,7 +315,7 @@ void WorldSession::HandleLoadPetFromDBSecondCallback(LoadPetFromDBQueryHolder* h pet->InitLevelupSpellsForLevel(); pet->CastPetAuras(current); - pet->GetCharmInfo()->LoadPetActionBar(holder->GetActionBar()); // action bar stored in already read string + pet->GetCharmInfo()->LoadPetActionBar(holder->GetActionBar()); // action bar stored in already read string } pet->CleanupActionBar(); // remove unknown spells from action bar after load @@ -326,16 +326,16 @@ void WorldSession::HandleLoadPetFromDBSecondCallback(LoadPetFromDBQueryHolder* h //set last used pet number (for use in BG's) if (owner->GetTypeId() == TYPEID_PLAYER && pet->isControlled() && !pet->isTemporarySummoned() && (pet->getPetType() == SUMMON_PET || pet->getPetType() == HUNTER_PET)) - { + { owner->ToPlayer()->SetLastPetNumber(holder->GetPetNumber()); - owner->SetLastPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL)); - } + owner->SetLastPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL)); + } if (pet->getPetType() == SUMMON_PET && !current) //all (?) summon pets come with full health when called, but not when they are current - { + { pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA)); - pet->SetHealth(pet->GetMaxHealth()); - } + pet->SetHealth(pet->GetMaxHealth()); + } else { if (!holder->GetSavedHealth() && pet->getPetType() == HUNTER_PET && pet->GetAsynchLoadType() != PET_LOAD_SUMMON_DEAD_PET) @@ -347,18 +347,18 @@ void WorldSession::HandleLoadPetFromDBSecondCallback(LoadPetFromDBQueryHolder* h } } - pet->SetLoading(false); - owner->SetTemporaryUnsummonedPetNumber(0); // clear this only if pet is loaded successfuly + pet->SetLoading(false); + owner->SetTemporaryUnsummonedPetNumber(0); // clear this only if pet is loaded successfuly - // current - if (current && owner->IsPetNeedBeTemporaryUnsummoned()) - { + // current + if (current && owner->IsPetNeedBeTemporaryUnsummoned()) + { owner->UnsummonPetTemporaryIfAny(); - return; - } + return; + } - pet->HandleAsynchLoadSucceed(); - return; + pet->HandleAsynchLoadSucceed(); + return; } void WorldSession::HandleDismissCritter(WorldPacket &recvData) @@ -414,7 +414,7 @@ void WorldSession::HandlePetAction(WorldPacket & recvData) if (!pet->IsAlive()) { - // xinef: allow dissmis dead pets + // xinef: allow dissmis dead pets SpellInfo const* spell = (flag == ACT_ENABLED || flag == ACT_PASSIVE) ? sSpellMgr->GetSpellInfo(spellid) : NULL; if ((flag != ACT_COMMAND || spellid != COMMAND_ABANDON) && (!spell || !spell->HasAttribute(SPELL_ATTR0_CASTABLE_WHILE_DEAD))) return; @@ -422,7 +422,7 @@ void WorldSession::HandlePetAction(WorldPacket & recvData) // Xinef: allow to controll players if (pet->GetTypeId() == TYPEID_PLAYER && flag != ACT_COMMAND && flag != ACT_REACTION) - return; + return; if (GetPlayer()->m_Controlled.size() == 1) HandlePetActionHelper(pet, guid1, spellid, flag, guid2); @@ -431,16 +431,16 @@ void WorldSession::HandlePetAction(WorldPacket & recvData) //If a pet is dismissed, m_Controlled will change std::vector controlled; for (Unit::ControlSet::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr) - { - // xinef: allow to dissmis dead pets + { + // xinef: allow to dissmis dead pets if ((*itr)->GetEntry() == pet->GetEntry() && ((*itr)->IsAlive() || (flag == ACT_COMMAND && spellid == COMMAND_ABANDON))) controlled.push_back(*itr); - // xinef: mirror image blizzard crappness - else if ((*itr)->GetEntry() == NPC_MIRROR_IMAGE && flag == ACT_COMMAND && spellid == COMMAND_FOLLOW) - { - (*itr)->InterruptNonMeleeSpells(false); - } - } + // xinef: mirror image blizzard crappness + else if ((*itr)->GetEntry() == NPC_MIRROR_IMAGE && flag == ACT_COMMAND && spellid == COMMAND_FOLLOW) + { + (*itr)->InterruptNonMeleeSpells(false); + } + } for (std::vector::iterator itr = controlled.begin(); itr != controlled.end(); ++itr) HandlePetActionHelper(*itr, guid1, spellid, flag, guid2); @@ -472,7 +472,7 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recvData) return; pet->AttackStop(); - pet->ClearInPetCombat(); + pet->ClearInPetCombat(); } void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2) @@ -491,32 +491,32 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid switch (spellid) { case COMMAND_STAY: //flat=1792 //STAY - { - bool controlledMotion = pet->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) != NULL_MOTION_TYPE; - if (!controlledMotion) - { - pet->StopMovingOnCurrentPos(); - pet->GetMotionMaster()->Clear(false); - pet->GetMotionMaster()->MoveIdle(); - } + { + bool controlledMotion = pet->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) != NULL_MOTION_TYPE; + if (!controlledMotion) + { + pet->StopMovingOnCurrentPos(); + pet->GetMotionMaster()->Clear(false); + pet->GetMotionMaster()->MoveIdle(); + } charmInfo->SetCommandState(COMMAND_STAY); charmInfo->SetIsCommandAttack(false); charmInfo->SetIsCommandFollow(false); charmInfo->SetIsFollowing(false); charmInfo->SetIsReturning(false); - charmInfo->SetIsAtStay(!controlledMotion); + charmInfo->SetIsAtStay(!controlledMotion); charmInfo->SaveStayPosition(controlledMotion); - charmInfo->SetForcedSpell(0); - charmInfo->SetForcedTargetGUID(0); + charmInfo->SetForcedSpell(0); + charmInfo->SetForcedTargetGUID(0); break; - } + } case COMMAND_FOLLOW: //spellid=1792 //FOLLOW - { + { pet->AttackStop(); pet->InterruptNonMeleeSpells(false); - pet->ClearInPetCombat(); + pet->ClearInPetCombat(); pet->GetMotionMaster()->MoveFollow(_player, PET_FOLLOW_DIST, pet->GetFollowAngle()); charmInfo->SetCommandState(COMMAND_FOLLOW); @@ -526,10 +526,10 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid charmInfo->SetIsCommandFollow(true); charmInfo->SetIsFollowing(false); - charmInfo->SetForcedSpell(0); - charmInfo->SetForcedTargetGUID(0); + charmInfo->SetForcedSpell(0); + charmInfo->SetForcedTargetGUID(0); break; - } + } case COMMAND_ATTACK: //spellid=1792 //ATTACK { // Can't attack if owner is pacified @@ -549,23 +549,23 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid if (!owner->IsValidAttackTarget(TargetUnit)) return; - // pussywizard: - if (Creature* creaturePet = pet->ToCreature()) - if (!creaturePet->_CanDetectFeignDeathOf(TargetUnit) || !creaturePet->CanCreatureAttack(TargetUnit) || creaturePet->isTargetNotAcceptableByMMaps(TargetUnit->GetGUID(), sWorld->GetGameTime(), TargetUnit)) - return; + // pussywizard: + if (Creature* creaturePet = pet->ToCreature()) + if (!creaturePet->_CanDetectFeignDeathOf(TargetUnit) || !creaturePet->CanCreatureAttack(TargetUnit) || creaturePet->isTargetNotAcceptableByMMaps(TargetUnit->GetGUID(), sWorld->GetGameTime(), TargetUnit)) + return; // Not let attack through obstructions bool checkLos = !MMAP::MMapFactory::IsPathfindingEnabled(pet->GetMap()) || - (TargetUnit->GetTypeId() == TYPEID_UNIT && (TargetUnit->ToCreature()->isWorldBoss() || TargetUnit->ToCreature()->IsDungeonBoss())); + (TargetUnit->GetTypeId() == TYPEID_UNIT && (TargetUnit->ToCreature()->isWorldBoss() || TargetUnit->ToCreature()->IsDungeonBoss())); - if (checkLos && !pet->IsWithinLOSInMap(TargetUnit)) - { - WorldPacket data(SMSG_CAST_FAILED, 1+4+1); - data << uint8(0); - data << uint32(7389); - data << uint8(SPELL_FAILED_LINE_OF_SIGHT); - SendPacket(&data); - return; + if (checkLos && !pet->IsWithinLOSInMap(TargetUnit)) + { + WorldPacket data(SMSG_CAST_FAILED, 1+4+1); + data << uint8(0); + data << uint32(7389); + data << uint8(SPELL_FAILED_LINE_OF_SIGHT); + SendPacket(&data); + return; } pet->ClearUnitState(UNIT_STATE_FOLLOW); @@ -601,7 +601,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid charmInfo->SetIsCommandFollow(false); charmInfo->SetIsReturning(false); - pet->Attack(TargetUnit, true); + pet->Attack(TargetUnit, true); pet->SendPetAIReaction(guid1); } } @@ -609,12 +609,12 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid } case COMMAND_ABANDON: // abandon (hunter pet) or dismiss (summoned pet) if (pet->GetCharmerGUID() == GetPlayer()->GetGUID()) - { - if (pet->IsSummon()) - pet->ToTempSummon()->UnSummon(); - else - _player->StopCastingCharm(); - } + { + if (pet->IsSummon()) + pet->ToTempSummon()->UnSummon(); + else + _player->StopCastingCharm(); + } else if (pet->GetOwnerGUID() == GetPlayer()->GetGUID()) { ASSERT(pet->GetTypeId() == TYPEID_UNIT); @@ -641,14 +641,14 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid { case REACT_PASSIVE: //passive pet->AttackStop(); - pet->ClearInPetCombat(); + pet->ClearInPetCombat(); case REACT_DEFENSIVE: //recovery case REACT_AGGRESSIVE: //activete if (pet->GetTypeId() == TYPEID_UNIT) pet->ToCreature()->SetReactState(ReactStates(spellid)); - else - charmInfo->SetPlayerReactState(ReactStates(spellid)); + else + charmInfo->SetPlayerReactState(ReactStates(spellid)); break; } break; @@ -687,7 +687,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid charmInfo->SetIsFollowing(false); Spell* spell = new Spell(pet, spellInfo, TRIGGERED_NONE); - spell->LoadScripts(); // xinef: load for CheckPetCast + spell->LoadScripts(); // xinef: load for CheckPetCast SpellCastResult result = spell->CheckPetCast(unit_target); @@ -740,19 +740,19 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid spell->prepare(&(spell->m_targets)); - charmInfo->SetForcedSpell(0); - charmInfo->SetForcedTargetGUID(0); + charmInfo->SetForcedSpell(0); + charmInfo->SetForcedTargetGUID(0); } else { - // dont spam alerts - if (!charmInfo->GetForcedSpell()) - { - if (pet->isPossessed() || pet->IsVehicle()) - Spell::SendCastResult(GetPlayer(), spellInfo, 0, result); - else - spell->SendPetCastResult(result); - } + // dont spam alerts + if (!charmInfo->GetForcedSpell()) + { + if (pet->isPossessed() || pet->IsVehicle()) + Spell::SendCastResult(GetPlayer(), spellInfo, 0, result); + else + spell->SendPetCastResult(result); + } if (!pet->ToCreature()->HasSpellCooldown(spellid)) GetPlayer()->SendClearCooldown(spellid, pet); @@ -760,8 +760,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid spell->finish(false); delete spell; - // reset specific flags in case of spell fail. AI will reset other flags - pet->PetSpellFail(spellInfo, unit_target, result); + // reset specific flags in case of spell fail. AI will reset other flags + pet->PetSpellFail(spellInfo, unit_target, result); } break; } @@ -884,86 +884,86 @@ void WorldSession::HandlePetSetAction(WorldPacket & recvData) } } - Unit::ControlSet petsSet; - if (checkPet->GetEntry() != GUID_ENPART(petguid)) - petsSet.insert(checkPet); - else - petsSet = _player->m_Controlled; + Unit::ControlSet petsSet; + if (checkPet->GetEntry() != GUID_ENPART(petguid)) + petsSet.insert(checkPet); + else + petsSet = _player->m_Controlled; - // Xinef: loop all pets with same entry (fixes partial state change for feral spirits) - for (Unit::ControlSet::const_iterator itr = petsSet.begin(); itr != petsSet.end(); ++itr) - { - Unit* pet = *itr; - if (checkPet->GetEntry() == GUID_ENPART(petguid) && pet->GetEntry() != GUID_ENPART(petguid)) - continue; + // Xinef: loop all pets with same entry (fixes partial state change for feral spirits) + for (Unit::ControlSet::const_iterator itr = petsSet.begin(); itr != petsSet.end(); ++itr) + { + Unit* pet = *itr; + if (checkPet->GetEntry() == GUID_ENPART(petguid) && pet->GetEntry() != GUID_ENPART(petguid)) + continue; - CharmInfo* charmInfo = pet->GetCharmInfo(); - if (!charmInfo) - { - sLog->outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); - continue; - } + CharmInfo* charmInfo = pet->GetCharmInfo(); + if (!charmInfo) + { + sLog->outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + continue; + } - // check swap (at command->spell swap client remove spell first in another packet, so check only command move correctness) - if (move_command) - { - uint8 act_state_0 = UNIT_ACTION_BUTTON_TYPE(data[0]); - if (act_state_0 == ACT_COMMAND || act_state_0 == ACT_REACTION) - { - uint32 spell_id_0 = UNIT_ACTION_BUTTON_ACTION(data[0]); - UnitActionBarEntry const* actionEntry_1 = charmInfo->GetActionBarEntry(position[1]); - if (!actionEntry_1 || spell_id_0 != actionEntry_1->GetAction() || - act_state_0 != actionEntry_1->GetType()) - continue; - } + // check swap (at command->spell swap client remove spell first in another packet, so check only command move correctness) + if (move_command) + { + uint8 act_state_0 = UNIT_ACTION_BUTTON_TYPE(data[0]); + if (act_state_0 == ACT_COMMAND || act_state_0 == ACT_REACTION) + { + uint32 spell_id_0 = UNIT_ACTION_BUTTON_ACTION(data[0]); + UnitActionBarEntry const* actionEntry_1 = charmInfo->GetActionBarEntry(position[1]); + if (!actionEntry_1 || spell_id_0 != actionEntry_1->GetAction() || + act_state_0 != actionEntry_1->GetType()) + continue; + } - uint8 act_state_1 = UNIT_ACTION_BUTTON_TYPE(data[1]); - if (act_state_1 == ACT_COMMAND || act_state_1 == ACT_REACTION) - { - uint32 spell_id_1 = UNIT_ACTION_BUTTON_ACTION(data[1]); - UnitActionBarEntry const* actionEntry_0 = charmInfo->GetActionBarEntry(position[0]); - if (!actionEntry_0 || spell_id_1 != actionEntry_0->GetAction() || - act_state_1 != actionEntry_0->GetType()) - continue; - } - } + uint8 act_state_1 = UNIT_ACTION_BUTTON_TYPE(data[1]); + if (act_state_1 == ACT_COMMAND || act_state_1 == ACT_REACTION) + { + uint32 spell_id_1 = UNIT_ACTION_BUTTON_ACTION(data[1]); + UnitActionBarEntry const* actionEntry_0 = charmInfo->GetActionBarEntry(position[0]); + if (!actionEntry_0 || spell_id_1 != actionEntry_0->GetAction() || + act_state_1 != actionEntry_0->GetType()) + continue; + } + } - for (uint8 i = 0; i < count; ++i) - { - uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data[i]); - uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data[i]); + for (uint8 i = 0; i < count; ++i) + { + uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data[i]); + uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data[i]); - //if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add - if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id))) - { - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id)) - { - //sign for autocast - if (act_state == ACT_ENABLED) - { - if (pet->GetTypeId() == TYPEID_UNIT && pet->IsPet()) - ((Pet*)pet)->ToggleAutocast(spellInfo, true); - else - for (Unit::ControlSet::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr) - if ((*itr)->GetEntry() == pet->GetEntry()) - (*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, true); - } - //sign for no/turn off autocast - else if (act_state == ACT_DISABLED) - { - if (pet->GetTypeId() == TYPEID_UNIT && pet->IsPet()) - ((Pet*)pet)->ToggleAutocast(spellInfo, false); - else - for (Unit::ControlSet::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr) - if ((*itr)->GetEntry() == pet->GetEntry()) - (*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, false); - } - } + //if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add + if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id))) + { + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id)) + { + //sign for autocast + if (act_state == ACT_ENABLED) + { + if (pet->GetTypeId() == TYPEID_UNIT && pet->IsPet()) + ((Pet*)pet)->ToggleAutocast(spellInfo, true); + else + for (Unit::ControlSet::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr) + if ((*itr)->GetEntry() == pet->GetEntry()) + (*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, true); + } + //sign for no/turn off autocast + else if (act_state == ACT_DISABLED) + { + if (pet->GetTypeId() == TYPEID_UNIT && pet->IsPet()) + ((Pet*)pet)->ToggleAutocast(spellInfo, false); + else + for (Unit::ControlSet::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr) + if ((*itr)->GetEntry() == pet->GetEntry()) + (*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, false); + } + } - charmInfo->SetActionBar(position[i], spell_id, ActiveStates(act_state)); - } - } - } + charmInfo->SetActionBar(position[i], spell_id, ActiveStates(act_state)); + } + } + } } void WorldSession::HandlePetRename(WorldPacket & recvData) @@ -1027,20 +1027,20 @@ void WorldSession::HandlePetRename(WorldPacket & recvData) SQLTransaction trans = CharacterDatabase.BeginTransaction(); if (isdeclined) { - if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED)) - { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME); - stmt->setUInt32(0, pet->GetCharmInfo()->GetPetNumber()); - trans->Append(stmt); + if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED)) + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME); + stmt->setUInt32(0, pet->GetCharmInfo()->GetPetNumber()); + trans->Append(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHAR_PET_DECLINEDNAME); - stmt->setUInt32(0, _player->GetGUIDLow()); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHAR_PET_DECLINEDNAME); + stmt->setUInt32(0, _player->GetGUIDLow()); - for (uint8 i = 0; i < 5; i++) - stmt->setString(i+1, declinedname.name[i]); + for (uint8 i = 0; i < 5; i++) + stmt->setString(i+1, declinedname.name[i]); - trans->Append(stmt); - } + trans->Append(stmt); + } } PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_NAME); @@ -1065,7 +1065,7 @@ void WorldSession::HandlePetAbandon(WorldPacket & recvData) // pet/charmed Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); - if (pet && pet->ToPet() && pet->ToPet()->getPetType() == HUNTER_PET) + if (pet && pet->ToPet() && pet->ToPet()->getPetType() == HUNTER_PET) { if (pet->IsPet()) { @@ -1096,9 +1096,9 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) if (IS_PLAYER_GUID(guid)) return; - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); - if (!spellInfo) - return; + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); + if (!spellInfo) + return; Creature* checkPet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); if (!checkPet || (checkPet != _player->GetGuardianPet() && checkPet != _player->GetCharm())) @@ -1107,37 +1107,37 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) return; } - Unit::ControlSet petsSet; - if (checkPet->GetEntry() != GUID_ENPART(guid)) - petsSet.insert(checkPet); - else - petsSet = _player->m_Controlled; + Unit::ControlSet petsSet; + if (checkPet->GetEntry() != GUID_ENPART(guid)) + petsSet.insert(checkPet); + else + petsSet = _player->m_Controlled; - // Xinef: loop all pets with same entry (fixes partial state change for feral spirits) - for (Unit::ControlSet::const_iterator itr = petsSet.begin(); itr != petsSet.end(); ++itr) - { - Unit* pet = *itr; - if (checkPet->GetEntry() == GUID_ENPART(guid) && pet->GetEntry() != GUID_ENPART(guid)) - continue; + // Xinef: loop all pets with same entry (fixes partial state change for feral spirits) + for (Unit::ControlSet::const_iterator itr = petsSet.begin(); itr != petsSet.end(); ++itr) + { + Unit* pet = *itr; + if (checkPet->GetEntry() == GUID_ENPART(guid) && pet->GetEntry() != GUID_ENPART(guid)) + continue; - // do not add not learned spells/ passive spells - if (!pet->HasSpell(spellid) || !spellInfo->IsAutocastable()) - continue; + // do not add not learned spells/ passive spells + if (!pet->HasSpell(spellid) || !spellInfo->IsAutocastable()) + continue; - CharmInfo* charmInfo = pet->GetCharmInfo(); - if (!charmInfo) - { - sLog->outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); - continue; - } + CharmInfo* charmInfo = pet->GetCharmInfo(); + if (!charmInfo) + { + sLog->outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + continue; + } - if (pet->IsPet()) - ((Pet*)pet)->ToggleAutocast(spellInfo, state); - else - pet->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, state); + if (pet->IsPet()) + ((Pet*)pet)->ToggleAutocast(spellInfo, state); + else + pet->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, state); - charmInfo->SetSpellAutocast(spellInfo, state); - } + charmInfo->SetSpellAutocast(spellInfo, state); + } } void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) @@ -1180,20 +1180,20 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) targets.Read(recvPacket, caster); HandleClientCastFlags(recvPacket, castFlags, targets); - bool SetFollow = caster->HasUnitState(UNIT_STATE_FOLLOW); + bool SetFollow = caster->HasUnitState(UNIT_STATE_FOLLOW); caster->ClearUnitState(UNIT_STATE_FOLLOW); Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE); spell->m_cast_count = castCount; // probably pending spell cast spell->m_targets = targets; - spell->LoadScripts(); + spell->LoadScripts(); - // Xinef: Send default target, fixes return on NeedExplicitUnitTarget - Unit* target = targets.GetUnitTarget(); - if (!target && spell->m_spellInfo->NeedsExplicitUnitTarget()) - target = _player->GetSelectedUnit(); + // Xinef: Send default target, fixes return on NeedExplicitUnitTarget + Unit* target = targets.GetUnitTarget(); + if (!target && spell->m_spellInfo->NeedsExplicitUnitTarget()) + target = _player->GetSelectedUnit(); - SpellCastResult result = spell->CheckPetCast(target); + SpellCastResult result = spell->CheckPetCast(target); if (result == SPELL_CAST_OK) { @@ -1215,8 +1215,8 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) } else { - if (!caster->GetCharmInfo() || !caster->GetCharmInfo()->GetForcedSpell()) - spell->SendPetCastResult(result); + if (!caster->GetCharmInfo() || !caster->GetCharmInfo()->GetForcedSpell()) + spell->SendPetCastResult(result); if (caster->GetTypeId() == TYPEID_PLAYER) { @@ -1228,17 +1228,17 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) if (!caster->ToCreature()->HasSpellCooldown(spellId)) GetPlayer()->SendClearCooldown(spellId, caster); - // reset specific flags in case of spell fail. AI will reset other flags + // reset specific flags in case of spell fail. AI will reset other flags if (caster->IsPet()) - caster->PetSpellFail(spellInfo, targets.GetUnitTarget(), result); + caster->PetSpellFail(spellInfo, targets.GetUnitTarget(), result); } spell->finish(false); delete spell; } - if (SetFollow && !caster->IsInCombat()) - caster->AddUnitState(UNIT_STATE_FOLLOW); + if (SetFollow && !caster->IsInCombat()) + caster->AddUnitState(UNIT_STATE_FOLLOW); } void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName) diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index 0640d58ee..b8fb3d73d 100644 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -211,21 +211,21 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recvData) // a petition is invalid, if both the owner and the type matches // we checked above, if this player is in an arenateam, so this must be // datacorruption - Petition const* petition = sPetitionMgr->GetPetitionByOwnerWithType(_player->GetGUIDLow(), type); + Petition const* petition = sPetitionMgr->GetPetitionByOwnerWithType(_player->GetGUIDLow(), type); ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "Invalid petition GUIDs: %s", ssInvalidPetitionGUIDs.str().c_str()); CharacterDatabase.EscapeString(name); SQLTransaction trans = CharacterDatabase.BeginTransaction(); - - if (petition) - { - trans->PAppend("DELETE FROM petition WHERE petitionguid = %u", petition->petitionGuid); - trans->PAppend("DELETE FROM petition_sign WHERE petitionguid = %u", petition->petitionGuid); - // xinef: clear petition store - sPetitionMgr->RemovePetition(petition->petitionGuid); - } + + if (petition) + { + trans->PAppend("DELETE FROM petition WHERE petitionguid = %u", petition->petitionGuid); + trans->PAppend("DELETE FROM petition_sign WHERE petitionguid = %u", petition->petitionGuid); + // xinef: clear petition store + sPetitionMgr->RemovePetition(petition->petitionGuid); + } - // xinef: petition pointer is invalid from now on + // xinef: petition pointer is invalid from now on PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION); stmt->setUInt32(0, _player->GetGUIDLow()); @@ -236,8 +236,8 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recvData) CharacterDatabase.CommitTransaction(trans); - // xinef: fill petition store - sPetitionMgr->AddPetition(charter->GetGUIDLow(), _player->GetGUIDLow(), name, uint8(type)); + // xinef: fill petition store + sPetitionMgr->AddPetition(charter->GetGUIDLow(), _player->GetGUIDLow(), name, uint8(type)); } void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) @@ -250,18 +250,18 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) // solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?) uint32 petitionGuidLow = GUID_LOPART(petitionguid); - Petition const* petition = sPetitionMgr->GetPetition(petitionGuidLow); - if (!petition) - return; + Petition const* petition = sPetitionMgr->GetPetition(petitionGuidLow); + if (!petition) + return; - uint32 type = petition->petitionType; + uint32 type = petition->petitionType; // if guild petition and has guild => error, return; if (type == GUILD_CHARTER_TYPE && _player->GetGuildId()) return; - Signatures const* signatures = sPetitionMgr->GetSignature(petitionGuidLow); - uint8 signs = signatures ? signatures->signatureMap.size() : 0; + Signatures const* signatures = sPetitionMgr->GetSignature(petitionGuidLow); + uint8 signs = signatures ? signatures->signatureMap.size() : 0; ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow); @@ -271,12 +271,12 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) data << uint32(petitionGuidLow); // guild guid data << uint8(signs); // sign's count - if (signs) - for (SignatureMap::const_iterator itr = signatures->signatureMap.begin(); itr != signatures->signatureMap.begin(); ++itr) - { - data << uint64(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); // Player GUID - data << uint32(0); // there 0 ... - } + if (signs) + for (SignatureMap::const_iterator itr = signatures->signatureMap.begin(); itr != signatures->signatureMap.begin(); ++itr) + { + data << uint64(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); // Player GUID + data << uint32(0); // there 0 ... + } SendPacket(&data); } @@ -296,20 +296,20 @@ void WorldSession::HandlePetitionQueryOpcode(WorldPacket & recvData) void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) { - Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionguid)); - if (!petition) - { + Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionguid)); + if (!petition) + { ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid)); return; } - uint8 type = petition->petitionType; + uint8 type = petition->petitionType; WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4+8+petition->petitionName.size()+1+1+4*12+2+10)); data << uint32(GUID_LOPART(petitionguid)); // guild/team guid (in Trinity always same as GUID_LOPART(petition guid) data << MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER); // charter owner guid - data << petition->petitionName; // name (guild/arena team) + data << petition->petitionName; // name (guild/arena team) data << uint8(0); // some string - if (type == GUILD_CHARTER_TYPE) + if (type == GUILD_CHARTER_TYPE) { uint32 needed = sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS); data << uint32(needed); @@ -355,14 +355,14 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recvData) if (!item) return; - Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid)); - if (!petition) - { + Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid)); + if (!petition) + { ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionGuid)); return; } - if (petition->petitionType == GUILD_CHARTER_TYPE) + if (petition->petitionType == GUILD_CHARTER_TYPE) { if (sGuildMgr->GetGuildByName(newName)) { @@ -396,8 +396,8 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recvData) CharacterDatabase.Execute(stmt); - // xinef: update petition container - const_cast(petition)->petitionName = newName; + // xinef: update petition container + const_cast(petition)->petitionName = newName; ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionGuid), newName.c_str()); WorldPacket data(MSG_PETITION_RENAME, (8+newName.size()+1)); @@ -416,26 +416,26 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData) recvData >> unk; - Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid)); - if (!petition) + Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid)); + if (!petition) { sLog->outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); return; } - uint64 ownerGuid = MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER); - uint8 type = petition->petitionType; + uint64 ownerGuid = MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER); + uint8 type = petition->petitionType; uint32 playerGuid = _player->GetGUIDLow(); if (petition->ownerGuid == playerGuid) return; - Signatures const* signatures = sPetitionMgr->GetSignature(GUID_LOPART(petitionGuid)); - if (!signatures) - return; + Signatures const* signatures = sPetitionMgr->GetSignature(GUID_LOPART(petitionGuid)); + if (!signatures) + return; // not let enemies sign guild charter - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(ownerGuid)) + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(ownerGuid)) { if (type != GUILD_CHARTER_TYPE) SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED); @@ -482,7 +482,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData) } } - + uint32 signs = signatures->signatureMap.size(); if (++signs > type) // client signs maximum return; @@ -490,15 +490,15 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData) // Client doesn't allow to sign petition two times by one character, but not check sign by another character from same account // not allow sign another player from already sign player account - bool found = false; - for (SignatureMap::const_iterator itr = signatures->signatureMap.begin(); itr != signatures->signatureMap.end(); ++itr) - if (itr->second == GetAccountId()) - { - found = true; - break; - } + bool found = false; + for (SignatureMap::const_iterator itr = signatures->signatureMap.begin(); itr != signatures->signatureMap.end(); ++itr) + if (itr->second == GetAccountId()) + { + found = true; + break; + } - if (found) + if (found) { WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4)); data << uint64(petitionGuid); @@ -523,8 +523,8 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData) CharacterDatabase.Execute(stmt); - // xinef: fill petition store - sPetitionMgr->AddSignature(GUID_LOPART(petitionGuid), GetAccountId(), playerGuid); + // xinef: fill petition store + sPetitionMgr->AddSignature(GUID_LOPART(petitionGuid), GetAccountId(), playerGuid); ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId()); @@ -555,11 +555,11 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recvData) recvData >> petitionguid; // petition guid ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow()); - Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionguid)); - if (!petition) - return; + Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionguid)); + if (!petition) + return; - ownerguid = MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER); + ownerguid = MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER); if (Player* owner = ObjectAccessor::FindPlayerInOrOutOfWorld(ownerguid)) // petition owner online { WorldPacket data(MSG_PETITION_DECLINE, 8); @@ -583,13 +583,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recvData) if (!player) return; - Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionguid)); - if (!petition) - return; + Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionguid)); + if (!petition) + return; if (GetPlayer()->GetTeamId() != player->GetTeamId()) { - if (petition->petitionType != GUILD_CHARTER_TYPE) + if (petition->petitionType != GUILD_CHARTER_TYPE) SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED); else Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_NOT_ALLIED); @@ -637,8 +637,8 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recvData) } } - Signatures const* signatures = sPetitionMgr->GetSignature(GUID_LOPART(petitionguid)); - uint8 signs = signatures ? signatures->signatureMap.size() : 0; + Signatures const* signatures = sPetitionMgr->GetSignature(GUID_LOPART(petitionguid)); + uint8 signs = signatures ? signatures->signatureMap.size() : 0; WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12)); data << uint64(petitionguid); // petition guid @@ -646,12 +646,12 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recvData) data << uint32(GUID_LOPART(petitionguid)); // guild guid data << uint8(signs); // sign's count - if (signs) - for (SignatureMap::const_iterator itr = signatures->signatureMap.begin(); itr != signatures->signatureMap.end(); ++itr) - { - data << uint64(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); // Player GUID - data << uint32(0); // there 0 ... - } + if (signs) + for (SignatureMap::const_iterator itr = signatures->signatureMap.begin(); itr != signatures->signatureMap.end(); ++itr) + { + data << uint64(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); // Player GUID + data << uint32(0); // there 0 ... + } player->GetSession()->SendPacket(&data); } @@ -673,16 +673,16 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData) ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow()); - Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid)); - if (!petition) - { + Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid)); + if (!petition) + { sLog->outError("Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid)); return; } - uint32 ownerguidlo = petition->ownerGuid; - uint8 type = petition->petitionType; - std::string name = petition->petitionName; + uint32 ownerguidlo = petition->ownerGuid; + uint8 type = petition->petitionType; + std::string name = petition->petitionName; // Only the petition owner can turn in the petition if (_player->GetGUIDLow() != ownerguidlo) @@ -730,11 +730,11 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData) } // Get petition signatures from db - Signatures const* signatures = sPetitionMgr->GetSignature(GUID_LOPART(petitionGuid)); - uint8 signs = signatures ? signatures->signatureMap.size() : 0; - SignatureMap signatureCopy; - if (signs) - signatureCopy = signatures->signatureMap; + Signatures const* signatures = sPetitionMgr->GetSignature(GUID_LOPART(petitionGuid)); + uint8 signs = signatures ? signatures->signatureMap.size() : 0; + SignatureMap signatureCopy; + if (signs) + signatureCopy = signatures->signatureMap; uint32 requiredSignatures; if (type == GUILD_CHARTER_TYPE) @@ -773,9 +773,9 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData) Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_COMMAND_SUCCESS, name); // Add members from signatures - if (signs) - for (SignatureMap::const_iterator itr = signatureCopy.begin(); itr != signatureCopy.end(); ++itr) - guild->AddMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); + if (signs) + for (SignatureMap::const_iterator itr = signatureCopy.begin(); itr != signatureCopy.end(); ++itr) + guild->AddMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); } else { @@ -797,12 +797,12 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData) ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitonsHandler: Arena team (guid: %u) added to ObjectMgr", arenaTeam->GetId()); // Add members - if (signs) - for (SignatureMap::const_iterator itr = signatureCopy.begin(); itr != signatureCopy.end(); ++itr) - { - ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), memberGUID); - arenaTeam->AddMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); - } + if (signs) + for (SignatureMap::const_iterator itr = signatureCopy.begin(); itr != signatureCopy.end(); ++itr) + { + ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), memberGUID); + arenaTeam->AddMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); + } } SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -817,8 +817,8 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData) CharacterDatabase.CommitTransaction(trans); - // xinef: clear petition store (petition and signatures) - sPetitionMgr->RemovePetition(GUID_LOPART(petitionGuid)); + // xinef: clear petition store (petition and signatures) + sPetitionMgr->RemovePetition(GUID_LOPART(petitionGuid)); // created ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "TURN IN PETITION GUID %u", GUID_LOPART(petitionGuid)); diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 635c8717f..f4b20b25c 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -33,7 +33,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid) { - GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid)); + GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid)); WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10)); data.appendPackGUID(guid); @@ -324,14 +324,14 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recvData) } // Read quest ids and add the in a unordered_set so we don't send POIs for the same quest multiple times - UNORDERED_SET questIds; + UNORDERED_SET questIds; for (uint32 i = 0; i < count; ++i) questIds.insert(recvData.read()); // quest id WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4 + (4 + 4)*questIds.size()); data << uint32(questIds.size()); // count - for (UNORDERED_SET::const_iterator itr = questIds.begin(); itr != questIds.end(); ++itr) + for (UNORDERED_SET::const_iterator itr = questIds.begin(); itr != questIds.end(); ++itr) { uint32 questId = *itr; bool questOk = false; diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 27cb68d34..ffe504fe5 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -89,8 +89,8 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recvData) if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // Stop the npc if moving - //if (!creature->GetTransport()) // pussywizard: reverted with new spline (old: without this check, npc would stay in place and the transport would continue moving, so the npc falls off. NPCs on transports don't have waypoints, so stopmoving is not needed) - creature->StopMoving(); + //if (!creature->GetTransport()) // pussywizard: reverted with new spline (old: without this check, npc would stay in place and the transport would continue moving, so the npc falls off. NPCs on transports don't have waypoints, so stopmoving is not needed) + creature->StopMoving(); if (sScriptMgr->OnGossipHello(_player, creature)) return; @@ -127,12 +127,12 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recvData) if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) { - // pussywizard: exploit fix, can't share quests that give items to be sold - if (object->GetTypeId() == TYPEID_PLAYER) - if (uint32 itemId = quest->GetSrcItemId()) - if (const ItemTemplate* srcItem = sObjectMgr->GetItemTemplate(itemId)) - if (srcItem->SellPrice > 0) - return; + // pussywizard: exploit fix, can't share quests that give items to be sold + if (object->GetTypeId() == TYPEID_PLAYER) + if (uint32 itemId = quest->GetSrcItemId()) + if (const ItemTemplate* srcItem = sObjectMgr->GetItemTemplate(itemId)) + if (srcItem->SellPrice > 0) + return; // prevent cheating if (!GetPlayer()->CanTakeQuest(quest, true)) @@ -276,7 +276,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData) switch (object->GetTypeId()) { case TYPEID_UNIT: - { + { Creature* questgiver = object->ToCreature(); if (!sScriptMgr->OnQuestReward(_player, questgiver, quest, reward)) { @@ -284,17 +284,17 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData) if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) { if (_player->CanAddQuest(nextQuest, false) && _player->CanTakeQuest(nextQuest, false)) - { - if (nextQuest->IsAutoAccept()) - _player->AddQuestAndCheckCompletion(nextQuest, object); - _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); - } + { + if (nextQuest->IsAutoAccept()) + _player->AddQuestAndCheckCompletion(nextQuest, object); + _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); + } } questgiver->AI()->sQuestReward(_player, quest, reward); } break; - } + } case TYPEID_GAMEOBJECT: { GameObject* questGiver = object->ToGameObject(); @@ -304,17 +304,17 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData) if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) { if (_player->CanAddQuest(nextQuest, false) && _player->CanTakeQuest(quest, false)) - { - if (nextQuest->IsAutoAccept()) - _player->AddQuestAndCheckCompletion(nextQuest, object); - _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); - } + { + if (nextQuest->IsAutoAccept()) + _player->AddQuestAndCheckCompletion(nextQuest, object); + _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); + } } questGiver->AI()->QuestReward(_player, quest, reward); } break; - } + } default: break; } @@ -431,11 +431,11 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData) if (!_player->CanTakeQuest(quest, true) || _player->HasPendingBind()) return; - // pussywizard: exploit fix, can't share quests that give items to be sold - if (uint32 itemId = quest->GetSrcItemId()) - if (const ItemTemplate* srcItem = sObjectMgr->GetItemTemplate(itemId)) - if (srcItem->SellPrice > 0) - return; + // pussywizard: exploit fix, can't share quests that give items to be sold + if (uint32 itemId = quest->GetSrcItemId()) + if (const ItemTemplate* srcItem = sObjectMgr->GetItemTemplate(itemId)) + if (srcItem->SellPrice > 0) + return; if (_player->CanAddQuest(quest, true)) _player->AddQuestAndCheckCompletion(quest, NULL); // NULL, this prevent DB script from duplicate running @@ -550,7 +550,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) _player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_SHARING_QUEST); if (quest->IsAutoAccept() && player->CanAddQuest(quest, true) && player->CanTakeQuest(quest, true)) - player->AddQuestAndCheckCompletion(quest, _player); + player->AddQuestAndCheckCompletion(quest, _player); if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) player->PlayerTalkClass->SendQuestGiverRequestItems(quest, _player->GetGUID(), player->CanCompleteRepeatableQuest(quest), true); diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 8c788837e..87444489e 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -240,12 +240,12 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_GIFT_BY_ITEM); - stmt->setUInt32(0, item->GetGUIDLow()); + stmt->setUInt32(0, item->GetGUIDLow()); - _openWrappedItemCallback.SetFirstParam(bagIndex); - _openWrappedItemCallback.SetSecondParam(slot); - _openWrappedItemCallback.SetThirdParam(item->GetGUIDLow()); - _openWrappedItemCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt)); + _openWrappedItemCallback.SetFirstParam(bagIndex); + _openWrappedItemCallback.SetSecondParam(slot); + _openWrappedItemCallback.SetThirdParam(item->GetGUIDLow()); + _openWrappedItemCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt)); } else pUser->SendLoot(item->GetGUID(), LOOT_CORPSE); @@ -256,14 +256,14 @@ void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uin if (!GetPlayer()) return; - Item* item = GetPlayer()->GetItemByPos(bagIndex, slot); - if (!item) - return; + Item* item = GetPlayer()->GetItemByPos(bagIndex, slot); + if (!item) + return; - if (item->GetGUIDLow() != itemLowGUID || !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED)) // during getting result, gift was swapped with another item - return; + if (item->GetGUIDLow() != itemLowGUID || !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED)) // during getting result, gift was swapped with another item + return; - + if (!result) { sLog->outError("Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow()); @@ -280,16 +280,16 @@ void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uin item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, 0); item->SetEntry(entry); item->SetUInt32Value(ITEM_FIELD_FLAGS, flags); - item->SetUInt32Value(ITEM_FIELD_MAXDURABILITY, item->GetTemplate()->MaxDurability); + item->SetUInt32Value(ITEM_FIELD_MAXDURABILITY, item->GetTemplate()->MaxDurability); item->SetState(ITEM_CHANGED, GetPlayer()); - GetPlayer()->SaveInventoryAndGoldToDB(trans); + GetPlayer()->SaveInventoryAndGoldToDB(trans); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT); stmt->setUInt32(0, item->GetGUIDLow()); - trans->Append(stmt); + trans->Append(stmt); - CharacterDatabase.CommitTransaction(trans); + CharacterDatabase.CommitTransaction(trans); } void WorldSession::HandleGameObjectUseOpcode(WorldPacket & recvData) @@ -374,24 +374,24 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) } else { - // pussywizard: casting player's spells from vehicle when seat allows it - // if ANYTHING CHANGES in this function, INFORM ME BEFORE applying!!! - if (Vehicle* veh = mover->GetVehicleKit()) - if (const VehicleSeatEntry* seat = veh->GetSeatForPassenger(_player)) - if (seat->m_flags & VEHICLE_SEAT_FLAG_CAN_ATTACK || spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_OPEN_LOCK /*allow looting from vehicle, but only if player has required spell (all necessary opening spells are in playercreateinfo_spell)*/) - if ((mover->GetTypeId() == TYPEID_UNIT && !mover->ToCreature()->HasSpell(spellId)) || spellInfo->IsPassive()) // the creature can't cast that spell, check player instead - { - if( !(spellInfo->Targets & TARGET_FLAG_GAMEOBJECT_ITEM) && (!_player->HasActiveSpell (spellId) || spellInfo->IsPassive()) ) - { - //cheater? kick? ban? - recvPacket.rfinish(); // prevent spam at ignore packet - return; - } + // pussywizard: casting player's spells from vehicle when seat allows it + // if ANYTHING CHANGES in this function, INFORM ME BEFORE applying!!! + if (Vehicle* veh = mover->GetVehicleKit()) + if (const VehicleSeatEntry* seat = veh->GetSeatForPassenger(_player)) + if (seat->m_flags & VEHICLE_SEAT_FLAG_CAN_ATTACK || spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_OPEN_LOCK /*allow looting from vehicle, but only if player has required spell (all necessary opening spells are in playercreateinfo_spell)*/) + if ((mover->GetTypeId() == TYPEID_UNIT && !mover->ToCreature()->HasSpell(spellId)) || spellInfo->IsPassive()) // the creature can't cast that spell, check player instead + { + if( !(spellInfo->Targets & TARGET_FLAG_GAMEOBJECT_ITEM) && (!_player->HasActiveSpell (spellId) || spellInfo->IsPassive()) ) + { + //cheater? kick? ban? + recvPacket.rfinish(); // prevent spam at ignore packet + return; + } - // at this point, player is a valid caster - // swapping the mover will stop the check below at == TYPEID_UNIT, so everything works fine - mover = _player; - } + // at this point, player is a valid caster + // swapping the mover will stop the check below at == TYPEID_UNIT, so everything works fine + mover = _player; + } // not have spell in spellbook or spell passive and not casted by client if ((mover->GetTypeId() == TYPEID_UNIT && !mover->ToCreature()->HasSpell(spellId)) || spellInfo->IsPassive()) @@ -452,7 +452,7 @@ void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket) recvPacket.read_skip(); // counter, increments with every CANCEL packet, don't use for now recvPacket >> spellId; - _player->InterruptSpell(CURRENT_MELEE_SPELL); + _player->InterruptSpell(CURRENT_MELEE_SPELL); if (_player->IsNonMeleeSpellCast(false)) _player->InterruptNonMeleeSpells(false, spellId, false, true); } @@ -467,7 +467,7 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket) return; // not allow remove non positive spells and spells with attr SPELL_ATTR0_CANT_CANCEL - if ((!spellInfo->IsPositive() || spellInfo->HasAttribute(SPELL_ATTR0_CANT_CANCEL) || spellInfo->IsPassive()) && spellId != 605) + if ((!spellInfo->IsPositive() || spellInfo->HasAttribute(SPELL_ATTR0_CANT_CANCEL) || spellInfo->IsPassive()) && spellId != 605) return; // channeled spell case (it currently casted then) @@ -580,10 +580,10 @@ void WorldSession::HandleSelfResOpcode(WorldPacket & /*recvData*/) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)); if (spellInfo) - { + { _player->CastSpell(_player, spellInfo, true, 0); - _player->AddSpellAndCategoryCooldowns(spellInfo, 0); - } + _player->AddSpellAndCategoryCooldowns(spellInfo, 0); + } _player->SetUInt32Value(PLAYER_SELF_RES_SPELL, 0); } diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index d37e88ce4..9e74ec864 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -210,7 +210,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData) recvData.readPackGUID(guid); MovementInfo movementInfo; // used only for proper packet read - movementInfo.guid = guid; + movementInfo.guid = guid; ReadMovementInfo(recvData, &movementInfo); recvData.read_skip(); // spline id diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index f043ccfa8..62f5657f5 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -458,14 +458,14 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) // execute trade: 2. store moveItems(myItems, hisItems); - if( my_trade->GetMoney() >= 10*GOLD ) - { - CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"\", NOW())", GetAccountId(), _player->GetGUIDLow(), _player->GetName().c_str(), GetRemoteAddress().c_str(), trader->GetSession()->GetAccountId(), trader->GetName().c_str(), my_trade->GetMoney()); - } - if( his_trade->GetMoney() >= 10*GOLD ) - { - CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"\", NOW())", trader->GetSession()->GetAccountId(), trader->GetGUIDLow(), trader->GetName().c_str(), trader->GetSession()->GetRemoteAddress().c_str(), GetAccountId(), _player->GetName().c_str(), his_trade->GetMoney()); - } + if( my_trade->GetMoney() >= 10*GOLD ) + { + CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"\", NOW())", GetAccountId(), _player->GetGUIDLow(), _player->GetName().c_str(), GetRemoteAddress().c_str(), trader->GetSession()->GetAccountId(), trader->GetName().c_str(), my_trade->GetMoney()); + } + if( his_trade->GetMoney() >= 10*GOLD ) + { + CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"\", NOW())", trader->GetSession()->GetAccountId(), trader->GetGUIDLow(), trader->GetName().c_str(), trader->GetSession()->GetRemoteAddress().c_str(), GetAccountId(), _player->GetName().c_str(), his_trade->GetMoney()); + } // update money _player->ModifyMoney(-int32(my_trade->GetMoney())); @@ -571,8 +571,8 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (GetPlayer()->IsSpectator()) - return; + if (GetPlayer()->IsSpectator()) + return; Player* pOther = ObjectAccessor::FindPlayer(ID); @@ -618,11 +618,11 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeamId() != _player->GetTeamId()) - { - SendTradeStatus(TRADE_STATUS_WRONG_FACTION); - return; - } + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeamId() != _player->GetTeamId()) + { + SendTradeStatus(TRADE_STATUS_WRONG_FACTION); + return; + } if (!pOther->IsWithinDistInMap(_player, 10.0f, false)) { diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp index 7bedfa63f..d4a02a277 100644 --- a/src/server/game/Handlers/VehicleHandler.cpp +++ b/src/server/game/Handlers/VehicleHandler.cpp @@ -39,13 +39,13 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData) recvData.readPackGUID(guid); - // pussywizard: typical check for incomming movement packets - if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID()) - { - recvData.rfinish(); // prevent warnings spam - _player->ExitVehicle(); - return; - } + // pussywizard: typical check for incomming movement packets + if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID()) + { + recvData.rfinish(); // prevent warnings spam + _player->ExitVehicle(); + return; + } MovementInfo mi; mi.guid = guid; @@ -89,12 +89,12 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData) uint64 guid; // current vehicle guid recvData.readPackGUID(guid); - // pussywizard: - if (vehicle_base->GetGUID() != guid) - { - recvData.rfinish(); // prevent warnings spam - return; - } + // pussywizard: + if (vehicle_base->GetGUID() != guid) + { + recvData.rfinish(); // prevent warnings spam + return; + } MovementInfo movementInfo; movementInfo.guid = guid; @@ -152,9 +152,9 @@ void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data) return; if (!player->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) return; - // Xinef: - if (!_player->FindMap() || _player->FindMap()->IsBattleArena()) - return; + // Xinef: + if (!_player->FindMap() || _player->FindMap()->IsBattleArena()) + return; _player->EnterVehicle(player); } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index ba1681698..9f43ee72e 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -42,14 +42,14 @@ BoundInstancesMap InstanceSaveManager::emptyBoundInstancesMap; InstanceSaveManager::~InstanceSaveManager() { lock_instLists = true; - // pussywizard: crashes on calling function in destructor (PlayerUnbindInstance), completely not needed anyway + // pussywizard: crashes on calling function in destructor (PlayerUnbindInstance), completely not needed anyway /*for (InstanceSaveHashMap::iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr) { InstanceSave* save = itr->second; - InstanceSave::PlayerListType &pList = save->m_playerList; - while (!pList.empty()) - PlayerUnbindInstance(*(pList.begin()), save->GetMapId(), save->GetDifficulty(), false); + InstanceSave::PlayerListType &pList = save->m_playerList; + while (!pList.empty()) + PlayerUnbindInstance(*(pList.begin()), save->GetMapId(), save->GetDifficulty(), false); delete save; }*/ @@ -82,19 +82,19 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance } time_t resetTime, extendedResetTime; - if (entry->map_type == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL) - { + if (entry->map_type == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL) + { resetTime = GetResetTimeFor(mapId, difficulty); - extendedResetTime = GetExtendedResetTimeFor(mapId, difficulty); - } + extendedResetTime = GetExtendedResetTimeFor(mapId, difficulty); + } else - { + { resetTime = time(NULL) + 3*DAY; // normals expire after 3 days even if someone is still bound to them, cleared on startup - extendedResetTime = 0; - } + extendedResetTime = 0; + } InstanceSave* save = new InstanceSave(mapId, instanceId, difficulty, resetTime, extendedResetTime); - if (!startup) - save->InsertToDB(); + if (!startup) + save->InsertToDB(); m_instanceSaveById[instanceId] = save; return save; @@ -108,33 +108,33 @@ InstanceSave* InstanceSaveManager::GetInstanceSave(uint32 InstanceId) bool InstanceSaveManager::DeleteInstanceSaveIfNeeded(uint32 InstanceId, bool skipMapCheck) { - return DeleteInstanceSaveIfNeeded(GetInstanceSave(InstanceId), skipMapCheck); + return DeleteInstanceSaveIfNeeded(GetInstanceSave(InstanceId), skipMapCheck); } bool InstanceSaveManager::DeleteInstanceSaveIfNeeded(InstanceSave* save, bool skipMapCheck) { - // pussywizard: save is removed only when there are no more players bound AND the map doesn't exist - // pussywizard: this function is called when unbinding a player and when unloading a map - if (!lock_instLists && save && save->m_playerList.empty() && (skipMapCheck || !sMapMgr->FindMap(save->GetMapId(), save->GetInstanceId()))) - { - // delete save from storage: - InstanceSaveHashMap::iterator itr = m_instanceSaveById.find(save->GetInstanceId()); - ASSERT(itr != m_instanceSaveById.end() && itr->second == save); - m_instanceSaveById.erase(itr); + // pussywizard: save is removed only when there are no more players bound AND the map doesn't exist + // pussywizard: this function is called when unbinding a player and when unloading a map + if (!lock_instLists && save && save->m_playerList.empty() && (skipMapCheck || !sMapMgr->FindMap(save->GetMapId(), save->GetInstanceId()))) + { + // delete save from storage: + InstanceSaveHashMap::iterator itr = m_instanceSaveById.find(save->GetInstanceId()); + ASSERT(itr != m_instanceSaveById.end() && itr->second == save); + m_instanceSaveById.erase(itr); - // delete save from db: - // character_instance is deleted when unbinding a certain player - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INSTANCE_BY_INSTANCE); - stmt->setUInt32(0, save->GetInstanceId()); - CharacterDatabase.Execute(stmt); + // delete save from db: + // character_instance is deleted when unbinding a certain player + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INSTANCE_BY_INSTANCE); + stmt->setUInt32(0, save->GetInstanceId()); + CharacterDatabase.Execute(stmt); - // clear respawn times (if map is loaded do it just to be sure, if already unloaded it won't do it by itself) - Map::DeleteRespawnTimesInDB(save->GetMapId(), save->GetInstanceId()); + // clear respawn times (if map is loaded do it just to be sure, if already unloaded it won't do it by itself) + Map::DeleteRespawnTimesInDB(save->GetMapId(), save->GetInstanceId()); - delete save; - return true; - } - return false; + delete save; + return true; + } + return false; } InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, time_t extendedResetTime) @@ -161,9 +161,9 @@ void InstanceSave::InsertToDB() data = instanceScript->GetSaveData(); completedEncounters = instanceScript->GetCompletedEncounterMask(); - // pussywizard: - SetInstanceData(data); - SetCompletedEncounterMask(completedEncounters); + // pussywizard: + SetInstanceData(data); + SetCompletedEncounterMask(completedEncounters); } } @@ -200,17 +200,17 @@ MapEntry const* InstanceSave::GetMapEntry() void InstanceSave::AddPlayer(uint32 guidLow) { - TRINITY_GUARD(ACE_Thread_Mutex, _lock); - m_playerList.push_back(guidLow); + TRINITY_GUARD(ACE_Thread_Mutex, _lock); + m_playerList.push_back(guidLow); } bool InstanceSave::RemovePlayer(uint32 guidLow, InstanceSaveManager* ism) { - TRINITY_GUARD(ACE_Thread_Mutex, _lock); - m_playerList.remove(guidLow); + TRINITY_GUARD(ACE_Thread_Mutex, _lock); + m_playerList.remove(guidLow); - // ism passed as an argument to avoid calling via singleton (might result in a deadlock) - return ism->DeleteInstanceSaveIfNeeded(this->GetInstanceId(), false); + // ism passed as an argument to avoid calling via singleton (might result in a deadlock) + return ism->DeleteInstanceSaveIfNeeded(this->GetInstanceId(), false); } void InstanceSaveManager::LoadInstances() @@ -220,8 +220,8 @@ void InstanceSaveManager::LoadInstances() // Delete character_instance for non-existent character CharacterDatabase.DirectExecute("DELETE ci.* FROM character_instance AS ci LEFT JOIN characters AS c ON ci.guid = c.guid WHERE c.guid IS NULL"); - // Delete expired normal instances (normals expire after 3 days even if someone is still bound to them, cleared on startup) - CharacterDatabase.DirectExecute("DELETE FROM instance WHERE resettime > 0 AND resettime < UNIX_TIMESTAMP()"); + // Delete expired normal instances (normals expire after 3 days even if someone is still bound to them, cleared on startup) + CharacterDatabase.DirectExecute("DELETE FROM instance WHERE resettime > 0 AND resettime < UNIX_TIMESTAMP()"); // Delete instance with no binds CharacterDatabase.DirectExecute("DELETE i.* FROM instance AS i LEFT JOIN character_instance AS ci ON i.id = ci.instance WHERE ci.guid IS NULL"); @@ -241,9 +241,9 @@ void InstanceSaveManager::LoadInstances() // Load reset times and clean expired instances LoadResetTimes(); - // pussywizard - LoadInstanceSaves(); - LoadCharacterBinds(); + // pussywizard + LoadInstanceSaves(); + LoadCharacterBinds(); sLog->outString(">> Loaded instances and binds in %u ms", GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -299,10 +299,10 @@ void InstanceSaveManager::LoadResetTimes() { // initialize the reset time t = today + period + diff; - SetResetTimeFor(mapid, difficulty, t); + SetResetTimeFor(mapid, difficulty, t); CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u', '%u', '%u')", mapid, difficulty, (uint32)t); } - SetExtendedResetTimeFor(mapid, difficulty, t + period); + SetExtendedResetTimeFor(mapid, difficulty, t + period); // schedule the global reset/warning uint8 type; @@ -316,7 +316,7 @@ void InstanceSaveManager::LoadResetTimes() void InstanceSaveManager::LoadInstanceSaves() { - QueryResult result = CharacterDatabase.Query("SELECT id, map, resettime, difficulty, completedEncounters, data FROM instance ORDER BY id ASC"); + QueryResult result = CharacterDatabase.Query("SELECT id, map, resettime, difficulty, completedEncounters, data FROM instance ORDER BY id ASC"); if (result) { do @@ -324,23 +324,23 @@ void InstanceSaveManager::LoadInstanceSaves() Field* fields = result->Fetch(); uint32 instanceId = fields[0].GetUInt32(); - uint32 mapId = fields[1].GetUInt16(); - time_t resettime = time_t(fields[2].GetUInt32()); - uint8 difficulty = fields[3].GetUInt8(); - uint32 completedEncounters = fields[4].GetUInt32(); - std::string instanceData = fields[5].GetString(); + uint32 mapId = fields[1].GetUInt16(); + time_t resettime = time_t(fields[2].GetUInt32()); + uint8 difficulty = fields[3].GetUInt8(); + uint32 completedEncounters = fields[4].GetUInt32(); + std::string instanceData = fields[5].GetString(); // Mark instance id as being used sMapMgr->RegisterInstanceId(instanceId); - InstanceSave* save = AddInstanceSave(mapId, instanceId, Difficulty(difficulty), true); - if (save) - { - save->SetCompletedEncounterMask(completedEncounters); - save->SetInstanceData(instanceData); - if (resettime > 0) - save->SetResetTime(resettime); - } + InstanceSave* save = AddInstanceSave(mapId, instanceId, Difficulty(difficulty), true); + if (save) + { + save->SetCompletedEncounterMask(completedEncounters); + save->SetInstanceData(instanceData); + if (resettime > 0) + save->SetResetTime(resettime); + } } while (result->NextRow()); } @@ -348,9 +348,9 @@ void InstanceSaveManager::LoadInstanceSaves() void InstanceSaveManager::LoadCharacterBinds() { - lock_instLists = true; + lock_instLists = true; - QueryResult result = CharacterDatabase.Query("SELECT guid, instance, permanent, extended FROM character_instance"); + QueryResult result = CharacterDatabase.Query("SELECT guid, instance, permanent, extended FROM character_instance"); if (result) { do @@ -362,41 +362,41 @@ void InstanceSaveManager::LoadCharacterBinds() bool perm = fields[2].GetBool(); bool extended = fields[3].GetBool(); - if (InstanceSave* save = GetInstanceSave(instanceId)) - { - PlayerCreateBoundInstancesMaps(guid); - InstancePlayerBind& bind = playerBindStorage[guid]->m[save->GetDifficulty()][save->GetMapId()]; - if (bind.save) // pussywizard: another bind for the same map and difficulty! may happen because of mysql thread races - { - if (bind.perm) // already loaded perm -> delete currently checked one from db - { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID); - stmt->setUInt32(0, guid); - stmt->setUInt32(1, instanceId); - CharacterDatabase.Execute(stmt); - continue; - } - else // override temp bind by newest one - { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID); - stmt->setUInt32(0, guid); - stmt->setUInt32(1, bind.save->GetInstanceId()); - CharacterDatabase.Execute(stmt); - bind.save->RemovePlayer(guid, this); - } - } - bind.save = save; - bind.perm = perm; - bind.extended = extended; - save->AddPlayer(guid); - if (perm) - save->SetCanReset(false); - } + if (InstanceSave* save = GetInstanceSave(instanceId)) + { + PlayerCreateBoundInstancesMaps(guid); + InstancePlayerBind& bind = playerBindStorage[guid]->m[save->GetDifficulty()][save->GetMapId()]; + if (bind.save) // pussywizard: another bind for the same map and difficulty! may happen because of mysql thread races + { + if (bind.perm) // already loaded perm -> delete currently checked one from db + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID); + stmt->setUInt32(0, guid); + stmt->setUInt32(1, instanceId); + CharacterDatabase.Execute(stmt); + continue; + } + else // override temp bind by newest one + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID); + stmt->setUInt32(0, guid); + stmt->setUInt32(1, bind.save->GetInstanceId()); + CharacterDatabase.Execute(stmt); + bind.save->RemovePlayer(guid, this); + } + } + bind.save = save; + bind.perm = perm; + bind.extended = extended; + save->AddPlayer(guid); + if (perm) + save->SetCanReset(false); + } } while (result->NextRow()); } - lock_instLists = false; + lock_instLists = false; } void InstanceSaveManager::ScheduleReset(time_t time, InstResetEvent event) @@ -408,7 +408,7 @@ void InstanceSaveManager::Update() { time_t now = time(NULL); time_t t; - bool resetOccurred = false; + bool resetOccurred = false; while (!m_resetTimeQueue.empty()) { @@ -417,7 +417,7 @@ void InstanceSaveManager::Update() break; InstResetEvent &event = m_resetTimeQueue.begin()->second; - if (event.type) + if (event.type) { // global reset/warning for a certain map time_t resetTime = GetResetTimeFor(event.mapid, event.difficulty); @@ -429,24 +429,24 @@ void InstanceSaveManager::Update() ++event.type; ScheduleReset(resetTime - ResetTimeDelay[event.type-1], event); } - else - resetOccurred = true; + else + resetOccurred = true; } m_resetTimeQueue.erase(m_resetTimeQueue.begin()); } - // pussywizard: send updated calendar and raid info - if (resetOccurred) - { - sLog->outString("Instance ID reset occurred, sending updated calendar and raid info to all players!"); - WorldPacket dummy; - for (SessionMap::const_iterator itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr) - if (Player* plr = itr->second->GetPlayer()) - { - itr->second->HandleCalendarGetCalendar(dummy); - plr->SendRaidInfo(); - } - } + // pussywizard: send updated calendar and raid info + if (resetOccurred) + { + sLog->outString("Instance ID reset occurred, sending updated calendar and raid info to all players!"); + WorldPacket dummy; + for (SessionMap::const_iterator itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr) + if (Player* plr = itr->second->GetPlayer()) + { + itr->second->HandleCalendarGetCalendar(dummy); + plr->SendRaidInfo(); + } + } } void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr) @@ -454,46 +454,46 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr) lock_instLists = true; InstanceSave::PlayerListType &pList = itr->second->m_playerList; - for (InstanceSave::PlayerListType::iterator iter = pList.begin(), iter2; iter != pList.end(); ) - { - iter2 = iter++; - PlayerUnbindInstanceNotExtended(*iter2, itr->second->GetMapId(), itr->second->GetDifficulty(), ObjectAccessor::GetObjectInOrOutOfWorld(MAKE_NEW_GUID(*iter2, 0, HIGHGUID_PLAYER), (Player*)NULL)); - } + for (InstanceSave::PlayerListType::iterator iter = pList.begin(), iter2; iter != pList.end(); ) + { + iter2 = iter++; + PlayerUnbindInstanceNotExtended(*iter2, itr->second->GetMapId(), itr->second->GetDifficulty(), ObjectAccessor::GetObjectInOrOutOfWorld(MAKE_NEW_GUID(*iter2, 0, HIGHGUID_PLAYER), (Player*)NULL)); + } - // delete stuff if no players left (noone extended id) - if (pList.empty()) - { - // delete character_instance per id, delete instance per id - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE); - stmt->setUInt32(0, itr->second->GetInstanceId()); - CharacterDatabase.Execute(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INSTANCE_BY_INSTANCE); - stmt->setUInt32(0, itr->second->GetInstanceId()); - CharacterDatabase.Execute(stmt); + // delete stuff if no players left (noone extended id) + if (pList.empty()) + { + // delete character_instance per id, delete instance per id + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE); + stmt->setUInt32(0, itr->second->GetInstanceId()); + CharacterDatabase.Execute(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INSTANCE_BY_INSTANCE); + stmt->setUInt32(0, itr->second->GetInstanceId()); + CharacterDatabase.Execute(stmt); - // clear respawn times if the map is already unloaded and won't do it by itself - if (!sMapMgr->FindMap(itr->second->GetMapId(), itr->second->GetInstanceId())) - Map::DeleteRespawnTimesInDB(itr->second->GetMapId(), itr->second->GetInstanceId()); + // clear respawn times if the map is already unloaded and won't do it by itself + if (!sMapMgr->FindMap(itr->second->GetMapId(), itr->second->GetInstanceId())) + Map::DeleteRespawnTimesInDB(itr->second->GetMapId(), itr->second->GetInstanceId()); - delete itr->second; - m_instanceSaveById.erase(itr); - } - else - { - // delete character_instance per id where extended = 0, transtaction with set extended = 0, transaction is used to avoid mysql thread races - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_NOT_EXTENDED); - stmt->setUInt32(0, itr->second->GetInstanceId()); - trans->Append(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INSTANCE_SET_NOT_EXTENDED); - stmt->setUInt32(0, itr->second->GetInstanceId()); - trans->Append(stmt); - CharacterDatabase.CommitTransaction(trans); + delete itr->second; + m_instanceSaveById.erase(itr); + } + else + { + // delete character_instance per id where extended = 0, transtaction with set extended = 0, transaction is used to avoid mysql thread races + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_NOT_EXTENDED); + stmt->setUInt32(0, itr->second->GetInstanceId()); + trans->Append(stmt); + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INSTANCE_SET_NOT_EXTENDED); + stmt->setUInt32(0, itr->second->GetInstanceId()); + trans->Append(stmt); + CharacterDatabase.CommitTransaction(trans); - // update reset time and extended reset time for instance save - itr->second->SetResetTime(GetResetTimeFor(itr->second->GetMapId(), itr->second->GetDifficulty())); - itr->second->SetExtendedResetTime(GetExtendedResetTimeFor(itr->second->GetMapId(), itr->second->GetDifficulty())); - } + // update reset time and extended reset time for instance save + itr->second->SetResetTime(GetResetTimeFor(itr->second->GetMapId(), itr->second->GetDifficulty())); + itr->second->SetExtendedResetTime(GetExtendedResetTimeFor(itr->second->GetMapId(), itr->second->GetDifficulty())); + } lock_instLists = false; } @@ -554,7 +554,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b for (mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr) { Map* map2 = mitr->second; - if (!map2->IsDungeon() || map2->GetDifficulty() != difficulty) + if (!map2->IsDungeon() || map2->GetDifficulty() != difficulty) continue; if (warn) @@ -567,23 +567,23 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b map2->ToInstanceMap()->SendResetWarnings(timeLeft); } else - { - InstanceSave* save = GetInstanceSave(map2->GetInstanceId()); - map2->ToInstanceMap()->Reset(INSTANCE_RESET_GLOBAL, (save ? &(save->m_playerList) : NULL)); - } + { + InstanceSave* save = GetInstanceSave(map2->GetInstanceId()); + map2->ToInstanceMap()->Reset(INSTANCE_RESET_GLOBAL, (save ? &(save->m_playerList) : NULL)); + } } } InstancePlayerBind* InstanceSaveManager::PlayerBindToInstance(uint32 guidLow, InstanceSave* save, bool permanent, Player* player /*= NULL*/) { - InstancePlayerBind& bind = playerBindStorage[guidLow]->m[save->GetDifficulty()][save->GetMapId()]; - ASSERT(!bind.perm || permanent); // ensure there's no changing permanent to temporary, this can be done only by unbinding + InstancePlayerBind& bind = playerBindStorage[guidLow]->m[save->GetDifficulty()][save->GetMapId()]; + ASSERT(!bind.perm || permanent); // ensure there's no changing permanent to temporary, this can be done only by unbinding - if (bind.save) - { - if (save != bind.save || permanent != bind.perm) - { - bind.extended = false; + if (bind.save) + { + if (save != bind.save || permanent != bind.perm) + { + bind.extended = false; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INSTANCE); stmt->setUInt32(0, save->GetInstanceId()); @@ -591,34 +591,34 @@ InstancePlayerBind* InstanceSaveManager::PlayerBindToInstance(uint32 guidLow, In stmt->setUInt32(2, guidLow); stmt->setUInt32(3, bind.save->GetInstanceId()); CharacterDatabase.Execute(stmt); - } - } - else - { - // pussywizard: protect against mysql thread races! - // pussywizard: CHANGED MY MIND! DON'T SLOW DOWN THIS QUERY! HANDLE ONLY DURING LOADING FROM DB! - // example: enter instance -> bind -> update old id to new id -> exit -> delete new id - // if delete by new id is executed before update, then we end up with shit in db - /*SQLTransaction trans = CharacterDatabase.BeginTransaction(); - // ensure any shit for that map+difficulty is deleted! - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_GUID_MAP_DIFF); // DELETE ci FROM character_instance ci JOIN instance i ON ci.instance = i.id WHERE ci.guid = ? AND i.map = ? AND i.difficulty = ? - stmt->setUInt32(0, guidLow); + } + } + else + { + // pussywizard: protect against mysql thread races! + // pussywizard: CHANGED MY MIND! DON'T SLOW DOWN THIS QUERY! HANDLE ONLY DURING LOADING FROM DB! + // example: enter instance -> bind -> update old id to new id -> exit -> delete new id + // if delete by new id is executed before update, then we end up with shit in db + /*SQLTransaction trans = CharacterDatabase.BeginTransaction(); + // ensure any shit for that map+difficulty is deleted! + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_GUID_MAP_DIFF); // DELETE ci FROM character_instance ci JOIN instance i ON ci.instance = i.id WHERE ci.guid = ? AND i.map = ? AND i.difficulty = ? + stmt->setUInt32(0, guidLow); stmt->setUInt16(1, uint16(save->GetMapId())); stmt->setUInt8(2, uint8(save->GetDifficulty())); - trans->Append(stmt); + trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_INSTANCE); stmt->setUInt32(0, guidLow); stmt->setUInt32(1, save->GetInstanceId()); stmt->setBool(2, permanent); trans->Append(stmt); - CharacterDatabase.CommitTransaction(trans);*/ + CharacterDatabase.CommitTransaction(trans);*/ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_INSTANCE); stmt->setUInt32(0, guidLow); stmt->setUInt32(1, save->GetInstanceId()); stmt->setBool(2, permanent); CharacterDatabase.Execute(stmt); - } + } if (bind.save != save) { @@ -628,80 +628,80 @@ InstancePlayerBind* InstanceSaveManager::PlayerBindToInstance(uint32 guidLow, In } if (permanent) - { + { save->SetCanReset(false); - if (!bind.perm && player) // temporary changing to permanent - player->GetSession()->SendCalendarRaidLockout(save, true); - } + if (!bind.perm && player) // temporary changing to permanent + player->GetSession()->SendCalendarRaidLockout(save, true); + } bind.save = save; bind.perm = permanent; - if (player) - sScriptMgr->OnPlayerBindToInstance(player, save->GetDifficulty(), save->GetMapId(), permanent); + if (player) + sScriptMgr->OnPlayerBindToInstance(player, save->GetDifficulty(), save->GetMapId(), permanent); - return &bind; + return &bind; } void InstanceSaveManager::PlayerUnbindInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty, bool deleteFromDB, Player* player /*= NULL*/) { - BoundInstancesMapWrapper* w = playerBindStorage[guidLow]; - BoundInstancesMap::iterator itr = w->m[difficulty].find(mapid); - if (itr != w->m[difficulty].end()) - { - if (deleteFromDB) - { + BoundInstancesMapWrapper* w = playerBindStorage[guidLow]; + BoundInstancesMap::iterator itr = w->m[difficulty].find(mapid); + if (itr != w->m[difficulty].end()) + { + if (deleteFromDB) + { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID); stmt->setUInt32(0, guidLow); stmt->setUInt32(1, itr->second.save->GetInstanceId()); CharacterDatabase.Execute(stmt); - } + } if (itr->second.perm && player) player->GetSession()->SendCalendarRaidLockout(itr->second.save, false); - InstanceSave* tmp = itr->second.save; - w->m[difficulty].erase(itr); + InstanceSave* tmp = itr->second.save; + w->m[difficulty].erase(itr); tmp->RemovePlayer(guidLow, this); - } + } } void InstanceSaveManager::PlayerUnbindInstanceNotExtended(uint32 guidLow, uint32 mapid, Difficulty difficulty, Player* player /*= NULL*/) { - BoundInstancesMapWrapper* w = playerBindStorage[guidLow]; - BoundInstancesMap::iterator itr = w->m[difficulty].find(mapid); - if (itr != w->m[difficulty].end()) - { - if (itr->second.extended) - itr->second.extended = false; - else - { - if (itr->second.perm && player) - player->GetSession()->SendCalendarRaidLockout(itr->second.save, false); + BoundInstancesMapWrapper* w = playerBindStorage[guidLow]; + BoundInstancesMap::iterator itr = w->m[difficulty].find(mapid); + if (itr != w->m[difficulty].end()) + { + if (itr->second.extended) + itr->second.extended = false; + else + { + if (itr->second.perm && player) + player->GetSession()->SendCalendarRaidLockout(itr->second.save, false); - InstanceSave* tmp = itr->second.save; - w->m[difficulty].erase(itr); - tmp->RemovePlayer(guidLow, this); - } - } + InstanceSave* tmp = itr->second.save; + w->m[difficulty].erase(itr); + tmp->RemovePlayer(guidLow, this); + } + } } InstancePlayerBind* InstanceSaveManager::PlayerGetBoundInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty) { - Difficulty difficulty_fixed = (mapid == 631 || mapid == 724 ? Difficulty(difficulty%2) : difficulty); + Difficulty difficulty_fixed = (mapid == 631 || mapid == 724 ? Difficulty(difficulty%2) : difficulty); MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(mapid, difficulty_fixed); if (!mapDiff) return NULL; - BoundInstancesMapWrapper* w = NULL; - PlayerBindStorage::const_iterator itr = playerBindStorage.find(guidLow); - if (itr != playerBindStorage.end()) - w = itr->second; - else - return NULL; + BoundInstancesMapWrapper* w = NULL; + PlayerBindStorage::const_iterator itr = playerBindStorage.find(guidLow); + if (itr != playerBindStorage.end()) + w = itr->second; + else + return NULL; - BoundInstancesMap::iterator itr2 = w->m[difficulty_fixed].find(mapid); - if (itr2 != w->m[difficulty_fixed].end()) + BoundInstancesMap::iterator itr2 = w->m[difficulty_fixed].find(mapid); + if (itr2 != w->m[difficulty_fixed].end()) return &itr2->second; else return NULL; @@ -709,66 +709,66 @@ InstancePlayerBind* InstanceSaveManager::PlayerGetBoundInstance(uint32 guidLow, bool InstanceSaveManager::PlayerIsPermBoundToInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty) { - if (InstancePlayerBind* bind = PlayerGetBoundInstance(guidLow, mapid, difficulty)) - if (bind->perm) - return true; - return false; + if (InstancePlayerBind* bind = PlayerGetBoundInstance(guidLow, mapid, difficulty)) + if (bind->perm) + return true; + return false; } BoundInstancesMap const& InstanceSaveManager::PlayerGetBoundInstances(uint32 guidLow, Difficulty difficulty) { - PlayerBindStorage::iterator itr = playerBindStorage.find(guidLow); - if (itr != playerBindStorage.end()) - return itr->second->m[difficulty]; - return emptyBoundInstancesMap; + PlayerBindStorage::iterator itr = playerBindStorage.find(guidLow); + if (itr != playerBindStorage.end()) + return itr->second->m[difficulty]; + return emptyBoundInstancesMap; } void InstanceSaveManager::PlayerCreateBoundInstancesMaps(uint32 guidLow) { - if (playerBindStorage.find(guidLow) == playerBindStorage.end()) - playerBindStorage[guidLow] = new BoundInstancesMapWrapper; + if (playerBindStorage.find(guidLow) == playerBindStorage.end()) + playerBindStorage[guidLow] = new BoundInstancesMapWrapper; } InstanceSave* InstanceSaveManager::PlayerGetInstanceSave(uint32 guidLow, uint32 mapid, Difficulty difficulty) { - InstancePlayerBind* pBind = PlayerGetBoundInstance(guidLow, mapid, difficulty); + InstancePlayerBind* pBind = PlayerGetBoundInstance(guidLow, mapid, difficulty); return (pBind ? pBind->save : NULL); } uint32 InstanceSaveManager::PlayerGetDestinationInstanceId(Player* player, uint32 mapid, Difficulty difficulty) { - // returning 0 means a new instance will be created - // non-zero implicates that InstanceSave exists + // returning 0 means a new instance will be created + // non-zero implicates that InstanceSave exists - InstancePlayerBind* ipb = PlayerGetBoundInstance(player->GetGUIDLow(), mapid, difficulty); - if (ipb && ipb->perm) // 1. self perm - return ipb->save->GetInstanceId(); - if (Group* g = player->GetGroup()) - { - if (InstancePlayerBind* ilb = PlayerGetBoundInstance(GUID_LOPART(g->GetLeaderGUID()), mapid, difficulty)) // 2. leader temp/perm - return ilb->save->GetInstanceId(); - return 0; // 3. in group, no leader bind - } - return ipb ? ipb->save->GetInstanceId() : 0; // 4. self temp + InstancePlayerBind* ipb = PlayerGetBoundInstance(player->GetGUIDLow(), mapid, difficulty); + if (ipb && ipb->perm) // 1. self perm + return ipb->save->GetInstanceId(); + if (Group* g = player->GetGroup()) + { + if (InstancePlayerBind* ilb = PlayerGetBoundInstance(GUID_LOPART(g->GetLeaderGUID()), mapid, difficulty)) // 2. leader temp/perm + return ilb->save->GetInstanceId(); + return 0; // 3. in group, no leader bind + } + return ipb ? ipb->save->GetInstanceId() : 0; // 4. self temp } void InstanceSaveManager::CopyBinds(uint32 from, uint32 to, Player* toPlr) { - if (from == to) - return; + if (from == to) + return; - for (uint8 d = 0; d < MAX_DIFFICULTY; ++d) - { - BoundInstancesMap const& bi = PlayerGetBoundInstances(from, Difficulty(d)); - for (BoundInstancesMap::const_iterator itr = bi.begin(); itr != bi.end(); ++itr) - if (!PlayerGetBoundInstance(to, itr->first, Difficulty(d))) - PlayerBindToInstance(to, itr->second.save, false, toPlr); - } + for (uint8 d = 0; d < MAX_DIFFICULTY; ++d) + { + BoundInstancesMap const& bi = PlayerGetBoundInstances(from, Difficulty(d)); + for (BoundInstancesMap::const_iterator itr = bi.begin(); itr != bi.end(); ++itr) + if (!PlayerGetBoundInstance(to, itr->first, Difficulty(d))) + PlayerBindToInstance(to, itr->second.save, false, toPlr); + } } void InstanceSaveManager::UnbindAllFor(InstanceSave* save) { InstanceSave::PlayerListType &pList = save->m_playerList; while (!pList.empty()) - PlayerUnbindInstance(*(pList.begin()), save->GetMapId(), save->GetDifficulty(), true, ObjectAccessor::GetObjectInOrOutOfWorld(MAKE_NEW_GUID(*(pList.begin()), 0, HIGHGUID_PLAYER), (Player*)NULL)); + PlayerUnbindInstance(*(pList.begin()), save->GetMapId(), save->GetDifficulty(), true, ObjectAccessor::GetObjectInOrOutOfWorld(MAKE_NEW_GUID(*(pList.begin()), 0, HIGHGUID_PLAYER), (Player*)NULL)); } diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h index 8d647ba5d..f22905cbd 100644 --- a/src/server/game/Instances/InstanceSaveMgr.h +++ b/src/server/game/Instances/InstanceSaveMgr.h @@ -39,8 +39,8 @@ class InstanceSaveManager; struct InstancePlayerBind { InstanceSave* save; - bool perm : 1; - bool extended : 1; + bool perm : 1; + bool extended : 1; InstancePlayerBind() : save(NULL), perm(false), extended(false) {} }; @@ -48,7 +48,7 @@ typedef UNORDERED_MAP< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap; struct BoundInstancesMapWrapper { - BoundInstancesMap m[MAX_DIFFICULTY]; + BoundInstancesMap m[MAX_DIFFICULTY]; }; typedef UNORDERED_MAP< uint32 /*guidLow*/, BoundInstancesMapWrapper* > PlayerBindStorage; @@ -66,17 +66,17 @@ class InstanceSave /* Saved when the instance is generated for the first time */ void InsertToDB(); - // pussywizard: deleting is done internally when there are no binds left + // pussywizard: deleting is done internally when there are no binds left - std::string GetInstanceData() const { return m_instanceData; } - void SetInstanceData(std::string str) { m_instanceData = str; } - uint32 GetCompletedEncounterMask() const { return m_completedEncounterMask; } - void SetCompletedEncounterMask(uint32 mask) { m_completedEncounterMask = mask; } + std::string GetInstanceData() const { return m_instanceData; } + void SetInstanceData(std::string str) { m_instanceData = str; } + uint32 GetCompletedEncounterMask() const { return m_completedEncounterMask; } + void SetCompletedEncounterMask(uint32 mask) { m_completedEncounterMask = mask; } // pussywizard: for normal instances this corresponds to 0, for raid/heroic instances this caches the global reset time for the map time_t GetResetTime() const { return m_resetTime; } time_t GetExtendedResetTime() const { return m_extendedResetTime; } - time_t GetResetTimeForDB(); + time_t GetResetTimeForDB(); void SetResetTime(time_t resetTime) { m_resetTime = resetTime; } void SetExtendedResetTime(time_t extendedResetTime) { m_extendedResetTime = extendedResetTime; } @@ -86,7 +86,7 @@ class InstanceSave InstanceTemplate const* GetTemplate(); MapEntry const* GetMapEntry(); - void AddPlayer(uint32 guidLow); + void AddPlayer(uint32 guidLow); bool RemovePlayer(uint32 guidLow, InstanceSaveManager* ism); typedef std::list PlayerListType; @@ -94,13 +94,13 @@ class InstanceSave PlayerListType m_playerList; time_t m_resetTime; - time_t m_extendedResetTime; + time_t m_extendedResetTime; uint32 m_instanceid; uint32 m_mapid; Difficulty m_difficulty; bool m_canReset; - std::string m_instanceData; - uint32 m_completedEncounterMask; + std::string m_instanceData; + uint32 m_completedEncounterMask; ACE_Thread_Mutex _lock; }; @@ -133,8 +133,8 @@ class InstanceSaveManager void LoadInstances(); void LoadResetTimes(); - void LoadInstanceSaves(); - void LoadCharacterBinds(); + void LoadInstanceSaves(); + void LoadCharacterBinds(); time_t GetResetTimeFor(uint32 mapid, Difficulty d) const { @@ -173,22 +173,22 @@ class InstanceSaveManager InstanceSave* GetInstanceSave(uint32 InstanceId); - InstancePlayerBind* PlayerBindToInstance(uint32 guidLow, InstanceSave* save, bool permanent, Player* player = NULL); - void PlayerUnbindInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty, bool deleteFromDB, Player* player = NULL); - void PlayerUnbindInstanceNotExtended(uint32 guidLow, uint32 mapid, Difficulty difficulty, Player* player = NULL); - InstancePlayerBind* PlayerGetBoundInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty); - bool PlayerIsPermBoundToInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty); - BoundInstancesMap const& PlayerGetBoundInstances(uint32 guidLow, Difficulty difficulty); - void PlayerCreateBoundInstancesMaps(uint32 guidLow); + InstancePlayerBind* PlayerBindToInstance(uint32 guidLow, InstanceSave* save, bool permanent, Player* player = NULL); + void PlayerUnbindInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty, bool deleteFromDB, Player* player = NULL); + void PlayerUnbindInstanceNotExtended(uint32 guidLow, uint32 mapid, Difficulty difficulty, Player* player = NULL); + InstancePlayerBind* PlayerGetBoundInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty); + bool PlayerIsPermBoundToInstance(uint32 guidLow, uint32 mapid, Difficulty difficulty); + BoundInstancesMap const& PlayerGetBoundInstances(uint32 guidLow, Difficulty difficulty); + void PlayerCreateBoundInstancesMaps(uint32 guidLow); InstanceSave* PlayerGetInstanceSave(uint32 guidLow, uint32 mapid, Difficulty difficulty); - uint32 PlayerGetDestinationInstanceId(Player* player, uint32 mapid, Difficulty difficulty); - void CopyBinds(uint32 from, uint32 to, Player* toPlr = NULL); - void UnbindAllFor(InstanceSave* save); + uint32 PlayerGetDestinationInstanceId(Player* player, uint32 mapid, Difficulty difficulty); + void CopyBinds(uint32 from, uint32 to, Player* toPlr = NULL); + void UnbindAllFor(InstanceSave* save); protected: static uint16 ResetTimeDelay[]; - static PlayerBindStorage playerBindStorage; - static BoundInstancesMap emptyBoundInstancesMap; + static PlayerBindStorage playerBindStorage; + static BoundInstancesMap emptyBoundInstancesMap; private: void _ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, time_t resetTime); diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index 751ad8f7b..ff3f75622 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -37,10 +37,10 @@ void InstanceScript::SaveToDB() //if (data.empty()) // pussywizard: encounterMask can be updated and theres no reason to not save // return; - // pussywizard: - InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(instance->GetInstanceId()); - if (save) - save->SetInstanceData(data); + // pussywizard: + InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(instance->GetInstanceId()); + if (save) + save->SetInstanceData(data); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_INSTANCE_SAVE_DATA); stmt->setString(0, data); @@ -118,7 +118,7 @@ void InstanceScript::UpdateDoorState(GameObject* door) if (range.first == range.second) return; - // xinef: doors can be assigned to few bosses, if any of them demands doors closed - they should be closed (added & operator for assigment) + // xinef: doors can be assigned to few bosses, if any of them demands doors closed - they should be closed (added & operator for assigment) bool open = true; for (; range.first != range.second && open; ++range.first) { @@ -126,7 +126,7 @@ void InstanceScript::UpdateDoorState(GameObject* door) switch (info.type) { case DOOR_TYPE_ROOM: - open &= (info.bossInfo->state != IN_PROGRESS) ? true : false; + open &= (info.bossInfo->state != IN_PROGRESS) ? true : false; break; case DOOR_TYPE_PASSAGE: open &= (info.bossInfo->state == DONE) ? true : false; @@ -399,21 +399,21 @@ bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player con void InstanceScript::SetCompletedEncountersMask(uint32 newMask, bool save) { - if (completedEncounters == newMask) - return; - completedEncounters = newMask; - // pussywizard: - if (save) - { - InstanceSave* iSave = sInstanceSaveMgr->GetInstanceSave(instance->GetInstanceId()); - if (iSave) - iSave->SetCompletedEncounterMask(completedEncounters); + if (completedEncounters == newMask) + return; + completedEncounters = newMask; + // pussywizard: + if (save) + { + InstanceSave* iSave = sInstanceSaveMgr->GetInstanceSave(instance->GetInstanceId()); + if (iSave) + iSave->SetCompletedEncounterMask(completedEncounters); - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_INSTANCE_SAVE_ENCOUNTERMASK); - stmt->setUInt32(0, completedEncounters); - stmt->setUInt32(1, instance->GetInstanceId()); - CharacterDatabase.Execute(stmt); - } + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_INSTANCE_SAVE_ENCOUNTERMASK); + stmt->setUInt32(0, completedEncounters); + stmt->setUInt32(1, instance->GetInstanceId()); + CharacterDatabase.Execute(stmt); + } } void InstanceScript::SendEncounterUnit(uint32 type, Unit* unit /*= NULL*/, uint8 param1 /*= 0*/, uint8 param2 /*= 0*/) diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index f2949ec15..4fe0d52cc 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -192,13 +192,13 @@ class InstanceScript : public ZoneScript // Cast spell on all players in instance void DoCastSpellOnPlayers(uint32 spell); - // Return wether server allow two side groups or not - bool ServerAllowsTwoSideGroups() { return sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP); } + // Return wether server allow two side groups or not + bool ServerAllowsTwoSideGroups() { return sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP); } virtual bool SetBossState(uint32 id, EncounterState state); EncounterState GetBossState(uint32 id) const { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; } BossBoundaryMap const* GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : NULL; } - BossInfo const* GetBossInfo(uint32 id) const { return &bosses[id]; } + BossInfo const* GetBossInfo(uint32 id) const { return &bosses[id]; } // Achievement criteria additional requirements check // NOTE: not use this if same can be checked existed requirement types from AchievementCriteriaRequirementType diff --git a/src/server/game/Loot/LootItemStorage.cpp b/src/server/game/Loot/LootItemStorage.cpp index 5cf8f938f..65789973e 100644 --- a/src/server/game/Loot/LootItemStorage.cpp +++ b/src/server/game/Loot/LootItemStorage.cpp @@ -15,27 +15,27 @@ LootItemStorage::~LootItemStorage() void LootItemStorage::LoadStorageFromDB() { uint32 oldMSTime = getMSTime(); - lootItemStore.clear(); + lootItemStore.clear(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_ITEMS); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { sLog->outString(">> Loaded 0 stored items!"); - sLog->outString(); + sLog->outString(); return; } - uint32 count = 0; + uint32 count = 0; do { Field* fields = result->Fetch(); - - StoredLootItemList& itemList = lootItemStore[fields[0].GetUInt32()]; - itemList.push_back(StoredLootItem(fields[1].GetUInt32(), fields[2].GetUInt32(), fields[3].GetInt32(), fields[4].GetUInt32())); + + StoredLootItemList& itemList = lootItemStore[fields[0].GetUInt32()]; + itemList.push_back(StoredLootItem(fields[1].GetUInt32(), fields[2].GetUInt32(), fields[3].GetInt32(), fields[4].GetUInt32())); - ++count; - } while (result->NextRow()); + ++count; + } while (result->NextRow()); sLog->outString(">> Loaded %d stored items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -43,101 +43,101 @@ void LootItemStorage::LoadStorageFromDB() void LootItemStorage::RemoveEntryFromDB(uint32 containerId, uint32 itemid, uint32 count) { - SQLTransaction trans = CharacterDatabase.BeginTransaction(); + SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_SINGLE_ITEM); stmt->setUInt32(0, containerId); - stmt->setUInt32(1, itemid); - stmt->setUInt32(2, count); - trans->Append(stmt); + stmt->setUInt32(1, itemid); + stmt->setUInt32(2, count); + trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); } void LootItemStorage::AddNewStoredLoot(Loot* loot, Player* player) { - if (lootItemStore.find(loot->containerId) != lootItemStore.end()) - { - sLog->outMisc("LootItemStorage::AddNewStoredLoot (A1) - %u!", loot->containerId); - return; - } + if (lootItemStore.find(loot->containerId) != lootItemStore.end()) + { + sLog->outMisc("LootItemStorage::AddNewStoredLoot (A1) - %u!", loot->containerId); + return; + } - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - PreparedStatement* stmt = NULL; + SQLTransaction trans = CharacterDatabase.BeginTransaction(); + PreparedStatement* stmt = NULL; - StoredLootItemList& itemList = lootItemStore[loot->containerId]; + StoredLootItemList& itemList = lootItemStore[loot->containerId]; - // Gold at first - if (loot->gold) - { - itemList.push_back(StoredLootItem(0, loot->gold, 0, 0)); + // Gold at first + if (loot->gold) + { + itemList.push_back(StoredLootItem(0, loot->gold, 0, 0)); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_SINGLE_ITEM); - stmt->setUInt32(0, loot->containerId); - stmt->setUInt32(1, 0); - stmt->setUInt32(2, loot->gold); - stmt->setInt32(3, 0); - stmt->setUInt32(4, 0); - trans->Append(stmt); - } + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_SINGLE_ITEM); + stmt->setUInt32(0, loot->containerId); + stmt->setUInt32(1, 0); + stmt->setUInt32(2, loot->gold); + stmt->setInt32(3, 0); + stmt->setUInt32(4, 0); + trans->Append(stmt); + } - // And normal items - if (!loot->isLooted()) - for (LootItemList::const_iterator li = loot->items.begin(); li != loot->items.end(); li++) - { - if (!li->AllowedForPlayer(player)) - continue; + // And normal items + if (!loot->isLooted()) + for (LootItemList::const_iterator li = loot->items.begin(); li != loot->items.end(); li++) + { + if (!li->AllowedForPlayer(player)) + continue; - const ItemTemplate* itemTemplate = sObjectMgr->GetItemTemplate(li->itemid); - if (!itemTemplate || itemTemplate->IsCurrencyToken()) - continue; + const ItemTemplate* itemTemplate = sObjectMgr->GetItemTemplate(li->itemid); + if (!itemTemplate || itemTemplate->IsCurrencyToken()) + continue; - itemList.push_back(StoredLootItem(li->itemid, li->count, li->randomPropertyId, li->randomSuffix)); + itemList.push_back(StoredLootItem(li->itemid, li->count, li->randomPropertyId, li->randomSuffix)); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_SINGLE_ITEM); - stmt->setUInt32(0, loot->containerId); - stmt->setUInt32(1, li->itemid); - stmt->setUInt32(2, li->count); - stmt->setInt32 (3, li->randomPropertyId); - stmt->setUInt32(4, li->randomSuffix); - trans->Append(stmt); - } + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_SINGLE_ITEM); + stmt->setUInt32(0, loot->containerId); + stmt->setUInt32(1, li->itemid); + stmt->setUInt32(2, li->count); + stmt->setInt32 (3, li->randomPropertyId); + stmt->setUInt32(4, li->randomSuffix); + trans->Append(stmt); + } CharacterDatabase.CommitTransaction(trans); } bool LootItemStorage::LoadStoredLoot(Item* item) { - Loot* loot = &item->loot; - LootItemContainer::iterator itr = lootItemStore.find(loot->containerId); - if (itr == lootItemStore.end()) - return false; + Loot* loot = &item->loot; + LootItemContainer::iterator itr = lootItemStore.find(loot->containerId); + if (itr == lootItemStore.end()) + return false; - StoredLootItemList& itemList = itr->second; - for (StoredLootItemList::iterator it2 = itemList.begin(); it2 != itemList.end(); ++it2) - { - if (it2->itemid == 0) - { - loot->gold = it2->count; - continue; - } + StoredLootItemList& itemList = itr->second; + for (StoredLootItemList::iterator it2 = itemList.begin(); it2 != itemList.end(); ++it2) + { + if (it2->itemid == 0) + { + loot->gold = it2->count; + continue; + } - LootItem li; - li.itemid = it2->itemid; - li.count = it2->count; - li.follow_loot_rules = false; - li.freeforall = false; - li.is_blocked = false; - li.is_counted = false; - li.is_underthreshold = false; - li.is_looted = false; - li.needs_quest = false; - li.randomPropertyId = it2->randomPropertyId; - li.randomSuffix = it2->randomSuffix; - li.rollWinnerGUID = 0; + LootItem li; + li.itemid = it2->itemid; + li.count = it2->count; + li.follow_loot_rules = false; + li.freeforall = false; + li.is_blocked = false; + li.is_counted = false; + li.is_underthreshold = false; + li.is_looted = false; + li.needs_quest = false; + li.randomPropertyId = it2->randomPropertyId; + li.randomSuffix = it2->randomSuffix; + li.rollWinnerGUID = 0; - loot->items.push_back(li); - loot->unlootedCount++; - } + loot->items.push_back(li); + loot->unlootedCount++; + } // Mark the item if it has loot so it won't be generated again on open item->m_lootGenerated = true; @@ -146,50 +146,50 @@ bool LootItemStorage::LoadStoredLoot(Item* item) void LootItemStorage::RemoveStoredLootItem(uint32 containerId, uint32 itemid, uint32 count) { - LootItemContainer::iterator itr = lootItemStore.find(containerId); - if (itr == lootItemStore.end()) - return; + LootItemContainer::iterator itr = lootItemStore.find(containerId); + if (itr == lootItemStore.end()) + return; - StoredLootItemList& itemList = itr->second; - for (StoredLootItemList::iterator it2 = itemList.begin(); it2 != itemList.end(); ++it2) - if (it2->itemid == itemid && it2->count == count) - { - RemoveEntryFromDB(containerId, itemid, count); - itemList.erase(it2); - break; - } + StoredLootItemList& itemList = itr->second; + for (StoredLootItemList::iterator it2 = itemList.begin(); it2 != itemList.end(); ++it2) + if (it2->itemid == itemid && it2->count == count) + { + RemoveEntryFromDB(containerId, itemid, count); + itemList.erase(it2); + break; + } - if (itemList.empty()) - lootItemStore.erase(itr); + if (itemList.empty()) + lootItemStore.erase(itr); } void LootItemStorage::RemoveStoredLootMoney(uint32 containerId) { - LootItemContainer::iterator itr = lootItemStore.find(containerId); - if (itr == lootItemStore.end()) - return; + LootItemContainer::iterator itr = lootItemStore.find(containerId); + if (itr == lootItemStore.end()) + return; - StoredLootItemList& itemList = itr->second; - for (StoredLootItemList::iterator it2 = itemList.begin(); it2 != itemList.end(); ++it2) - if (it2->itemid == 0) - { - RemoveEntryFromDB(containerId, 0, it2->count); - itemList.erase(it2); - break; - } + StoredLootItemList& itemList = itr->second; + for (StoredLootItemList::iterator it2 = itemList.begin(); it2 != itemList.end(); ++it2) + if (it2->itemid == 0) + { + RemoveEntryFromDB(containerId, 0, it2->count); + itemList.erase(it2); + break; + } - if (itemList.empty()) - lootItemStore.erase(itr); + if (itemList.empty()) + lootItemStore.erase(itr); } void LootItemStorage::RemoveStoredLoot(uint32 containerId) { - lootItemStore.erase(containerId); + lootItemStore.erase(containerId); - SQLTransaction trans = CharacterDatabase.BeginTransaction(); + SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEMCONTAINER_CONTAINER); stmt->setUInt32(0, containerId); - trans->Append(stmt); + trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); } diff --git a/src/server/game/Loot/LootItemStorage.h b/src/server/game/Loot/LootItemStorage.h index 492b31661..3c6962dca 100644 --- a/src/server/game/Loot/LootItemStorage.h +++ b/src/server/game/Loot/LootItemStorage.h @@ -10,14 +10,14 @@ Xinef struct StoredLootItem { - StoredLootItem(uint32 i, uint32 c, int32 ri, uint32 rs) : - itemid(i), count(c), randomPropertyId(ri), randomSuffix(rs) { } + StoredLootItem(uint32 i, uint32 c, int32 ri, uint32 rs) : + itemid(i), count(c), randomPropertyId(ri), randomSuffix(rs) { } - // If itemid == 0 - money amount is stored in count value - uint32 itemid; - uint32 count; - int32 randomPropertyId; - uint32 randomSuffix; + // If itemid == 0 - money amount is stored in count value + uint32 itemid; + uint32 count; + int32 randomPropertyId; + uint32 randomSuffix; }; typedef std::list StoredLootItemList; @@ -27,23 +27,23 @@ class LootItemStorage { friend class ACE_Singleton; - private: - LootItemStorage(); - ~LootItemStorage(); + private: + LootItemStorage(); + ~LootItemStorage(); - public: - void LoadStorageFromDB(); - void RemoveEntryFromDB(uint32 containerId, uint32 itemid, uint32 count); + public: + void LoadStorageFromDB(); + void RemoveEntryFromDB(uint32 containerId, uint32 itemid, uint32 count); - void AddNewStoredLoot(Loot* loot, Player* player); - bool LoadStoredLoot(Item* item); + void AddNewStoredLoot(Loot* loot, Player* player); + bool LoadStoredLoot(Item* item); - void RemoveStoredLootItem(uint32 containerId, uint32 itemid, uint32 count); - void RemoveStoredLootMoney(uint32 containerId); - void RemoveStoredLoot(uint32 containerId); + void RemoveStoredLootItem(uint32 containerId, uint32 itemid, uint32 count); + void RemoveStoredLootMoney(uint32 containerId); + void RemoveStoredLoot(uint32 containerId); - private: - LootItemContainer lootItemStore; + private: + LootItemContainer lootItemStore; }; #define sLootItemStorage ACE_Singleton::instance() diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 482c9c055..0e044afe0 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -62,9 +62,9 @@ struct LootGroupInvalidSelector : public std::unary_functionlootmode & _lootMode)) return true; - ItemTemplate const* _proto = sObjectMgr->GetItemTemplate(item->itemid); - if (!_proto) - return true; + ItemTemplate const* _proto = sObjectMgr->GetItemTemplate(item->itemid); + if (!_proto) + return true; uint8 foundDuplicates = 0; for (std::vector::const_iterator itr = _loot.items.begin(); itr != _loot.items.end(); ++itr) @@ -167,11 +167,11 @@ uint32 LootStore::LoadLootTable() continue; // error already printed to log/console. } - if (lootmode == 0) - { - sLog->outError("Table '%s' entry %d item %d: lootmode is equal to 0, item will never drop - setting mode 1", GetName(), entry, item); - lootmode = 1; - } + if (lootmode == 0) + { + sLog->outError("Table '%s' entry %d item %d: lootmode is equal to 0, item will never drop - setting mode 1", GetName(), entry, item); + lootmode = 1; + } LootStoreItem* storeitem = new LootStoreItem(item, chanceOrQuestChance, lootmode, group, mincountOrRef, maxcount); @@ -384,7 +384,7 @@ LootItem::LootItem(LootStoreItem const& li) is_blocked = 0; is_underthreshold = 0; is_counted = 0; - rollWinnerGUID = 0; + rollWinnerGUID = 0; } // Basic checks for player/item compatibility - if false no chance to see the item in the loot @@ -907,13 +907,13 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) continue; } } - else if (l.items[i].rollWinnerGUID) - { - if (l.items[i].rollWinnerGUID == lv.viewer->GetGUID()) - slot_type = LOOT_SLOT_TYPE_OWNER; - else - continue; - } + else if (l.items[i].rollWinnerGUID) + { + if (l.items[i].rollWinnerGUID == lv.viewer->GetGUID()) + slot_type = LOOT_SLOT_TYPE_OWNER; + else + continue; + } else if (l.roundRobinPlayer == 0 || lv.viewer->GetGUID() == l.roundRobinPlayer || !l.items[i].is_underthreshold) { // no round robin owner or he has released the loot @@ -1028,7 +1028,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { b << uint8(fi->index); b << item; - // Xinef: Here are FFA items, so dont use owner permision + // Xinef: Here are FFA items, so dont use owner permision b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT /*slotType*/); ++itemsShown; } diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index bf757d43e..3eb97683b 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -155,7 +155,7 @@ struct LootItem int32 randomPropertyId; ConditionList conditions; // additional loot condition AllowedLooterSet allowedGUIDs; - uint64 rollWinnerGUID; // Stores the guid of person who won loot, if his bags are full only he can see the item in loot list! + uint64 rollWinnerGUID; // Stores the guid of person who won loot, if his bags are full only he can see the item in loot list! uint8 count : 8; bool is_looted : 1; bool is_blocked : 1; @@ -169,7 +169,7 @@ struct LootItem // Should be called for non-reference LootStoreItem entries only (mincountOrRef > 0) explicit LootItem(LootStoreItem const& li); - LootItem() {} + LootItem() {} // Basic checks for player/item compatibility - if false no chance to see the item in the loot bool AllowedForPlayer(Player const* player) const; diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index 967f58227..89fb4ce56 100644 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.cpp @@ -164,7 +164,7 @@ void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_guid, uint32 } } - // xinef: WowWiki: "Return mail arrives immediately." + // xinef: WowWiki: "Return mail arrives immediately." // will delete item or place to receiver mail list SendMailTo(trans, MailReceiver(receiver, receiver_guid), MailSender(MAIL_NORMAL, sender_guid), MAIL_CHECK_MASK_RETURNED, 0); @@ -193,12 +193,12 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver, expire_delay = DAY; // default case: expire time if COD 3 days, if no COD 30 days (or 90 days if sender is a game master) else - { + { if (m_COD) expire_delay = 3 * DAY; else expire_delay = pSender && pSender->GetSession()->GetSecurity() ? 90 * DAY : 30 * DAY; - } + } time_t expire_time = deliver_time + expire_delay; @@ -231,8 +231,8 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver, trans->Append(stmt); } - // xinef: update global data - sWorld->UpdateGlobalPlayerMails(receiver.GetPlayerGUIDLow(), 1); + // xinef: update global data + sWorld->UpdateGlobalPlayerMails(receiver.GetPlayerGUIDLow(), 1); // For online receiver update in game mail status and data if (pReceiver) diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 367c6deb6..0623ed9f9 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -67,8 +67,8 @@ Map::~Map() if (!m_scriptSchedule.empty()) sScriptMgr->DecreaseScheduledScriptCount(m_scriptSchedule.size()); - //MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(GetId()); - MMAP::MMapFactory::createOrGetMMapManager()->unloadMapInstance(GetId(), i_InstanceId); + //MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(GetId()); + MMAP::MMapFactory::createOrGetMMapManager()->unloadMapInstance(GetId(), i_InstanceId); } bool Map::ExistMap(uint32 mapid, int gx, int gy) @@ -237,15 +237,15 @@ void Map::InitVisibilityDistance() //init visibility for continents m_VisibleDistance = World::GetMaxVisibleDistanceOnContinents(); - switch (GetId()) - { - case 609: // Scarlet Enclave (DK starting zone) - m_VisibleDistance = 125.0f; - break; - case 25: // Scott Test (box map) - m_VisibleDistance = 200.0f; - break; - } + switch (GetId()) + { + case 609: // Scarlet Enclave (DK starting zone) + m_VisibleDistance = 125.0f; + break; + case 25: // Scott Test (box map) + m_VisibleDistance = 200.0f; + break; + } } // Template specialization of utility methods @@ -393,8 +393,8 @@ void Map::DeleteFromWorld(Player* player) void Map::EnsureGridCreated(const GridCoord &p) { - if (getNGrid(p.x_coord, p.y_coord)) // pussywizard - return; + if (getNGrid(p.x_coord, p.y_coord)) // pussywizard + return; TRINITY_GUARD(ACE_Thread_Mutex, GridLock); EnsureGridCreated_i(p); } @@ -405,9 +405,9 @@ void Map::EnsureGridCreated_i(const GridCoord &p) { if (!getNGrid(p.x_coord, p.y_coord)) { - // pussywizard: moved setNGrid to the end of the function + // pussywizard: moved setNGrid to the end of the function NGridType* ngt = new NGridType(p.x_coord*MAX_NUMBER_OF_GRIDS + p.y_coord, p.x_coord, p.y_coord); - + // build a linkage between this map and NGridType buildNGridLinkage(ngt); // pussywizard: getNGrid(x, y) changed to: ngt @@ -420,8 +420,8 @@ void Map::EnsureGridCreated_i(const GridCoord &p) LoadMapAndVMap(gx, gy); } - // pussywizard: moved here - setNGrid(ngt, p.x_coord, p.y_coord); + // pussywizard: moved here + setNGrid(ngt, p.x_coord, p.y_coord); } } @@ -478,7 +478,7 @@ bool Map::AddPlayerToMap(Player* player) SendInitTransports(player); SendInitSelf(player); - SendZoneDynamicInfo(player); + SendZoneDynamicInfo(player); player->m_clientGUIDs.clear(); player->UpdateObjectVisibility(false); @@ -538,10 +538,10 @@ bool Map::AddToMap(T* obj, bool checkTransport) //obj->SetMap(this); obj->AddToWorld(); - if (checkTransport) - if (!(obj->GetTypeId() == TYPEID_GAMEOBJECT && obj->ToGameObject()->IsTransport())) // dont add transport to transport ;d - if (Transport* transport = GetTransportForPos(obj->GetPhaseMask(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj)) - transport->AddPassenger(obj, true); + if (checkTransport) + if (!(obj->GetTypeId() == TYPEID_GAMEOBJECT && obj->ToGameObject()->IsTransport())) // dont add transport to transport ;d + if (Transport* transport = GetTransportForPos(obj->GetPhaseMask(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj)) + transport->AddPassenger(obj, true); InitializeObject(obj); @@ -552,11 +552,11 @@ bool Map::AddToMap(T* obj, bool checkTransport) //also, trigger needs to cast spell, if not update, cannot see visual obj->UpdateObjectVisibility(true); - // Xinef: little hack for vehicles, accessories have to be added after visibility update so they wont fall off the vehicle, moved from Creature::AIM_Initialize - // Initialize vehicle, this is done only for summoned npcs, DB creatures are handled by grid loaders + // Xinef: little hack for vehicles, accessories have to be added after visibility update so they wont fall off the vehicle, moved from Creature::AIM_Initialize + // Initialize vehicle, this is done only for summoned npcs, DB creatures are handled by grid loaders if (obj->GetTypeId() == TYPEID_UNIT) - if (Vehicle* vehicle = obj->ToCreature()->GetVehicleKit()) - vehicle->Reset(); + if (Vehicle* vehicle = obj->ToCreature()->GetVehicleKit()) + vehicle->Reset(); return true; } @@ -615,8 +615,8 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitorIsPositionValid()) return; - if (obj->GetGridActivationRange() <= 0.0f) // pussywizard: gameobjects for example are on active lists, but range is equal to 0 (they just prevent grid unloading) - return; + if (obj->GetGridActivationRange() <= 0.0f) // pussywizard: gameobjects for example are on active lists, but range is equal to 0 (they just prevent grid unloading) + return; // Update mobs/objects in ALL visible cells around object! CellArea area = Cell::CalculateCellArea(obj->GetPositionX(), obj->GetPositionY(), obj->GetGridActivationRange()); @@ -644,8 +644,8 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitoroutDebug(LOG_FILTER_POOLSYS, "%u", mapId); // pussywizard: for crashlogs + uint32 mapId = GetId(); // pussywizard: for crashlogs + sLog->outDebug(LOG_FILTER_POOLSYS, "%u", mapId); // pussywizard: for crashlogs if (t_diff) _dynamicTree.update(t_diff); @@ -662,22 +662,22 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool thread) } } - if (!t_diff) - { - for (m_mapRefIter = m_mapRefManager.begin(); m_mapRefIter != m_mapRefManager.end(); ++m_mapRefIter) - { - Player* player = m_mapRefIter->GetSource(); + if (!t_diff) + { + for (m_mapRefIter = m_mapRefManager.begin(); m_mapRefIter != m_mapRefManager.end(); ++m_mapRefIter) + { + Player* player = m_mapRefIter->GetSource(); - if (!player || !player->IsInWorld()) - continue; + if (!player || !player->IsInWorld()) + continue; - // update players at tick - player->Update(s_diff); - } + // update players at tick + player->Update(s_diff); + } - HandleDelayedVisibility(); - return; - } + HandleDelayedVisibility(); + return; + } /// update active cells around players and active objects resetMarkedCells(); @@ -759,22 +759,22 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool thread) MoveAllGameObjectsInMoveList(); MoveAllDynamicObjectsInMoveList(); - HandleDelayedVisibility(); + HandleDelayedVisibility(); sScriptMgr->OnMapUpdate(this, t_diff); BuildAndSendUpdateForObjects(); // pussywizard - sLog->outDebug(LOG_FILTER_POOLSYS, "%u", mapId); // pussywizard: for crashlogs + sLog->outDebug(LOG_FILTER_POOLSYS, "%u", mapId); // pussywizard: for crashlogs } void Map::HandleDelayedVisibility() { - if (i_objectsForDelayedVisibility.empty()) - return; - for (UNORDERED_SET::iterator itr = i_objectsForDelayedVisibility.begin(); itr != i_objectsForDelayedVisibility.end(); ++itr) - (*itr)->ExecuteDelayedUnitRelocationEvent(); - i_objectsForDelayedVisibility.clear(); + if (i_objectsForDelayedVisibility.empty()) + return; + for (UNORDERED_SET::iterator itr = i_objectsForDelayedVisibility.begin(); itr != i_objectsForDelayedVisibility.end(); ++itr) + (*itr)->ExecuteDelayedUnitRelocationEvent(); + i_objectsForDelayedVisibility.clear(); } struct ResetNotifier @@ -1020,13 +1020,13 @@ void Map::MoveAllCreaturesInMoveList() if (!c->IsInWorld()) continue; - Cell const& old_cell = c->GetCurrentCell(); - Cell new_cell(c->GetPositionX(), c->GetPositionY()); + Cell const& old_cell = c->GetCurrentCell(); + Cell new_cell(c->GetPositionX(), c->GetPositionY()); - c->RemoveFromGrid(); - if (old_cell.DiffGrid(new_cell)) - EnsureGridLoaded(new_cell); - AddToGrid(c, new_cell); + c->RemoveFromGrid(); + if (old_cell.DiffGrid(new_cell)) + EnsureGridLoaded(new_cell); + AddToGrid(c, new_cell); } _creaturesToMove.clear(); } @@ -1049,13 +1049,13 @@ void Map::MoveAllGameObjectsInMoveList() if (!go->IsInWorld()) continue; - Cell const& old_cell = go->GetCurrentCell(); - Cell new_cell(go->GetPositionX(), go->GetPositionY()); + Cell const& old_cell = go->GetCurrentCell(); + Cell new_cell(go->GetPositionX(), go->GetPositionY()); - go->RemoveFromGrid(); - if (old_cell.DiffGrid(new_cell)) - EnsureGridLoaded(new_cell); - AddToGrid(go, new_cell); + go->RemoveFromGrid(); + if (old_cell.DiffGrid(new_cell)) + EnsureGridLoaded(new_cell); + AddToGrid(go, new_cell); } _gameObjectsToMove.clear(); } @@ -1078,20 +1078,20 @@ void Map::MoveAllGameObjectsInMoveList() if (!dynObj->IsInWorld()) continue; - Cell const& old_cell = dynObj->GetCurrentCell(); - Cell new_cell(dynObj->GetPositionX(), dynObj->GetPositionY()); + Cell const& old_cell = dynObj->GetCurrentCell(); + Cell new_cell(dynObj->GetPositionX(), dynObj->GetPositionY()); - dynObj->RemoveFromGrid(); - if (old_cell.DiffGrid(new_cell)) - EnsureGridLoaded(new_cell); - AddToGrid(dynObj, new_cell); + dynObj->RemoveFromGrid(); + if (old_cell.DiffGrid(new_cell)) + EnsureGridLoaded(new_cell); + AddToGrid(dynObj, new_cell); } _dynamicObjectsToMove.clear(); } bool Map::UnloadGrid(NGridType& ngrid) { - // pussywizard: UnloadGrid only done when whole map is unloaded, no need to worry about moving npcs between grids, etc. + // pussywizard: UnloadGrid only done when whole map is unloaded, no need to worry about moving npcs between grids, etc. const uint32 x = ngrid.getX(); const uint32 y = ngrid.getY(); @@ -1166,9 +1166,9 @@ void Map::UnloadAll() UnloadGrid(grid); // deletes the grid and removes it from the GridRefManager } - // pussywizard: crashfix, some npc can be left on transport (not a default passenger) - if (!AllTransportsEmpty()) - AllTransportsRemovePassengers(); + // pussywizard: crashfix, some npc can be left on transport (not a default passenger) + if (!AllTransportsEmpty()) + AllTransportsRemovePassengers(); for (TransportsContainer::iterator itr = _transports.begin(); itr != _transports.end();) { @@ -1772,27 +1772,27 @@ Transport* Map::GetTransportForPos(uint32 phase, float x, float y, float z, Worl { G3D::Vector3 v(x, y, z + 2.0f); G3D::Ray r(v, G3D::Vector3(0, 0, -1)); - for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr) - if ((*itr)->IsInWorld() && (*itr)->GetExactDistSq(x, y, z) < 75.0f*75.0f && (*itr)->m_model) - { - float dist = 30.0f; - bool hit = (*itr)->m_model->intersectRay(r, dist, false, phase); - if (hit) - return *itr; - } + for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr) + if ((*itr)->IsInWorld() && (*itr)->GetExactDistSq(x, y, z) < 75.0f*75.0f && (*itr)->m_model) + { + float dist = 30.0f; + bool hit = (*itr)->m_model->intersectRay(r, dist, false, phase); + if (hit) + return *itr; + } - if (worldobject) - if (GameObject* staticTrans = worldobject->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_TRANSPORT, 75.0f)) - if (staticTrans->m_model) - { - float dist = 10.0f; - bool hit = staticTrans->m_model->intersectRay(r, dist, false, phase); - if (hit) - if (GetHeight(phase, x, y, z, true, 30.0f) < (v.z - dist + 1.0f)) - return staticTrans->ToTransport(); - } + if (worldobject) + if (GameObject* staticTrans = worldobject->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_TRANSPORT, 75.0f)) + if (staticTrans->m_model) + { + float dist = 10.0f; + bool hit = staticTrans->m_model->intersectRay(r, dist, false, phase); + if (hit) + if (GetHeight(phase, x, y, z, true, 30.0f) < (v.z - dist + 1.0f)) + return staticTrans->ToTransport(); + } - return NULL; + return NULL; } float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const @@ -2120,16 +2120,16 @@ void Map::SendInitSelf(Player* player) // attach to player data current transport data if (Transport* transport = player->GetTransport()) - transport->BuildCreateUpdateBlockForPlayer(&data, player); + transport->BuildCreateUpdateBlockForPlayer(&data, player); // build data for self presence in world at own client (one time for map) player->BuildCreateUpdateBlockForPlayer(&data, player); // build other passengers at transport also (they always visible and marked as visible and will not send at visibility update at add to map if (Transport* transport = player->GetTransport()) - for (Transport::PassengerSet::const_iterator itr = transport->GetPassengers().begin(); itr != transport->GetPassengers().end(); ++itr) - if (player != (*itr) && player->HaveAtClient(*itr)) - (*itr)->BuildCreateUpdateBlockForPlayer(&data, player); + for (Transport::PassengerSet::const_iterator itr = transport->GetPassengers().begin(); itr != transport->GetPassengers().end(); ++itr) + if (player != (*itr) && player->HaveAtClient(*itr)) + (*itr)->BuildCreateUpdateBlockForPlayer(&data, player); WorldPacket packet; data.BuildPacket(&packet); @@ -2157,17 +2157,17 @@ void Map::SendRemoveTransports(Player* player) if (*itr != player->GetTransport()) (*itr)->BuildOutOfRangeUpdateBlock(&transData); - // pussywizard: remove static transports from client - for (Player::ClientGUIDs::const_iterator it = player->m_clientGUIDs.begin();it != player->m_clientGUIDs.end(); ) - { - if (IS_TRANSPORT_GUID(*it)) - { - transData.AddOutOfRangeGUID(*it); - it = player->m_clientGUIDs.erase(it); - } - else - ++it; - } + // pussywizard: remove static transports from client + for (Player::ClientGUIDs::const_iterator it = player->m_clientGUIDs.begin();it != player->m_clientGUIDs.end(); ) + { + if (IS_TRANSPORT_GUID(*it)) + { + transData.AddOutOfRangeGUID(*it); + it = player->m_clientGUIDs.erase(it); + } + else + ++it; + } WorldPacket packet; transData.BuildPacket(&packet); @@ -2381,11 +2381,11 @@ InstanceMap::InstanceMap(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _pa // this make sure it gets unloaded if for some reason no player joins m_unloadTimer = std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY); - // pussywizard: - if (IsRaid()) - if (time_t resetTime = sInstanceSaveMgr->GetResetTimeFor(id, Difficulty(SpawnMode))) - if (time_t extendedResetTime = sInstanceSaveMgr->GetExtendedResetTimeFor(id, Difficulty(SpawnMode))) - _instanceResetPeriod = extendedResetTime - resetTime; + // pussywizard: + if (IsRaid()) + if (time_t resetTime = sInstanceSaveMgr->GetResetTimeFor(id, Difficulty(SpawnMode))) + if (time_t extendedResetTime = sInstanceSaveMgr->GetExtendedResetTimeFor(id, Difficulty(SpawnMode))) + _instanceResetPeriod = extendedResetTime - resetTime; } InstanceMap::~InstanceMap() @@ -2400,31 +2400,31 @@ void InstanceMap::InitVisibilityDistance() //init visibility distance for instances m_VisibleDistance = World::GetMaxVisibleDistanceInInstances(); - // pussywizard: this CAN NOT exceed MAX_VISIBILITY_DISTANCE - switch (GetId()) - { - case 429: // Dire Maul - m_VisibleDistance = 175.0f; - break; - case 649: // Trial of the Crusader - case 650: // Trial of the Champion - case 595: // Culling of Startholme - case 658: // Pit of Saron - m_VisibleDistance = 150.0f; - break; - case 550: // The Eye - case 578: // The Nexus: The Oculus - m_VisibleDistance = 175.0f; - break; - case 615: // Obsidian Sanctum - case 616: // Eye of Eternity - case 603: // Ulduar - case 668: // Halls of Reflection - case 631: // Icecrown Citadel - case 724: // Ruby Sanctum - m_VisibleDistance = 200.0f; - break; - } + // pussywizard: this CAN NOT exceed MAX_VISIBILITY_DISTANCE + switch (GetId()) + { + case 429: // Dire Maul + m_VisibleDistance = 175.0f; + break; + case 649: // Trial of the Crusader + case 650: // Trial of the Champion + case 595: // Culling of Startholme + case 658: // Pit of Saron + m_VisibleDistance = 150.0f; + break; + case 550: // The Eye + case 578: // The Nexus: The Oculus + m_VisibleDistance = 175.0f; + break; + case 615: // Obsidian Sanctum + case 616: // Eye of Eternity + case 603: // Ulduar + case 668: // Halls of Reflection + case 631: // Icecrown Citadel + case 724: // Ruby Sanctum + m_VisibleDistance = 200.0f; + break; + } } /* @@ -2445,7 +2445,7 @@ bool InstanceMap::CanEnter(Player* player, bool loginCheck) // cannot enter if the instance is full (player cap), GMs don't count uint32 maxPlayers = GetMaxPlayers(); - if (GetPlayersCountExceptGMs() >= (loginCheck ? maxPlayers+1 : maxPlayers)) + if (GetPlayersCountExceptGMs() >= (loginCheck ? maxPlayers+1 : maxPlayers)) { ;//sLog->outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName().c_str()); player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS); @@ -2460,14 +2460,14 @@ bool InstanceMap::CanEnter(Player* player, bool loginCheck) return false; } - // xinef: dont allow LFG Group to enter other instance that is selected - if (Group* group = player->GetGroup()) - if (group->isLFGGroup()) - if (!sLFGMgr->inLfgDungeonMap(group->GetGUID(), GetId(), GetDifficulty())) - { - player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAP_NOT_ALLOWED); - return false; - } + // xinef: dont allow LFG Group to enter other instance that is selected + if (Group* group = player->GetGroup()) + if (group->isLFGGroup()) + if (!sLFGMgr->inLfgDungeonMap(group->GetGUID(), GetId(), GetDifficulty())) + { + player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAP_NOT_ALLOWED); + return false; + } // cannot enter if instance is in use by another party/soloer that have a permanent save in the same instance id PlayerList const &playerList = GetPlayers(); @@ -2475,8 +2475,8 @@ bool InstanceMap::CanEnter(Player* player, bool loginCheck) for (PlayerList::const_iterator i = playerList.begin(); i != playerList.end(); ++i) if (Player* iPlayer = i->GetSource()) { - if (iPlayer == player) // login case, player already added to map - continue; + if (iPlayer == player) // login case, player already added to map + continue; if (iPlayer->IsGameMaster()) // bypass GMs continue; if (!player->GetGroup()) // player has not group and there is someone inside, deny entry @@ -2501,8 +2501,8 @@ bool InstanceMap::CanEnter(Player* player, bool loginCheck) */ bool InstanceMap::AddPlayerToMap(Player* player) { - if (m_resetAfterUnload) // this instance has been reset, it's not meant to be used anymore - return false; + if (m_resetAfterUnload) // this instance has been reset, it's not meant to be used anymore + return false; if (IsDungeon()) { @@ -2517,42 +2517,42 @@ bool InstanceMap::AddPlayerToMap(Player* player) } // check for existing instance binds - InstancePlayerBind* playerBind = sInstanceSaveMgr->PlayerGetBoundInstance(player->GetGUIDLow(), GetId(), Difficulty(GetSpawnMode())); + InstancePlayerBind* playerBind = sInstanceSaveMgr->PlayerGetBoundInstance(player->GetGUIDLow(), GetId(), Difficulty(GetSpawnMode())); if (playerBind && playerBind->perm) - { - if (playerBind->save != mapSave) - { - sLog->outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d", player->GetName().c_str(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->CanReset()); + { + if (playerBind->save != mapSave) + { + sLog->outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d", player->GetName().c_str(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->CanReset()); return false; - } - } - else - { + } + } + else + { playerBind = sInstanceSaveMgr->PlayerBindToInstance(player->GetGUIDLow(), mapSave, false, player); - // pussywizard: bind lider also if not yet bound - if (Group* g = player->GetGroup()) - if (g->GetLeaderGUID() != player->GetGUID()) - if (!sInstanceSaveMgr->PlayerGetBoundInstance(GUID_LOPART(g->GetLeaderGUID()), mapSave->GetMapId(), mapSave->GetDifficulty())) - { - sInstanceSaveMgr->PlayerCreateBoundInstancesMaps(GUID_LOPART(g->GetLeaderGUID())); - sInstanceSaveMgr->PlayerBindToInstance(GUID_LOPART(g->GetLeaderGUID()), mapSave, false, ObjectAccessor::FindPlayerInOrOutOfWorld(g->GetLeaderGUID())); - } - } + // pussywizard: bind lider also if not yet bound + if (Group* g = player->GetGroup()) + if (g->GetLeaderGUID() != player->GetGUID()) + if (!sInstanceSaveMgr->PlayerGetBoundInstance(GUID_LOPART(g->GetLeaderGUID()), mapSave->GetMapId(), mapSave->GetDifficulty())) + { + sInstanceSaveMgr->PlayerCreateBoundInstancesMaps(GUID_LOPART(g->GetLeaderGUID())); + sInstanceSaveMgr->PlayerBindToInstance(GUID_LOPART(g->GetLeaderGUID()), mapSave, false, ObjectAccessor::FindPlayerInOrOutOfWorld(g->GetLeaderGUID())); + } + } // increase current instances (hourly limit) - // xinef: specific instances are still limited + // xinef: specific instances are still limited if (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance()) player->AddInstanceEnterTime(GetInstanceId(), time(NULL)); - if (!playerBind->perm && !mapSave->CanReset() && (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance())) + if (!playerBind->perm && !mapSave->CanReset() && (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance())) { WorldPacket data(SMSG_INSTANCE_LOCK_WARNING_QUERY, 9); data << uint32(60000); data << uint32(instance_script ? instance_script->GetCompletedEncounterMask() : 0); data << uint8(0); player->GetSession()->SendPacket(&data); - player->SetPendingBind(mapSave->GetInstanceId(), 60000); - } + player->SetPendingBind(mapSave->GetInstanceId(), 60000); + } } // initialize unload state @@ -2623,28 +2623,28 @@ void InstanceMap::CreateInstanceScript(bool load, std::string data, uint32 compl */ bool InstanceMap::Reset(uint8 method, std::list* globalResetSkipList) { - if (method == INSTANCE_RESET_GLOBAL) - { + if (method == INSTANCE_RESET_GLOBAL) + { // pussywizard: teleport out immediately for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) - { - // teleport players that are no longer bound (can be still bound if extended id) - if (!globalResetSkipList || std::find(globalResetSkipList->begin(), globalResetSkipList->end(), itr->GetSource()->GetGUIDLow()) == globalResetSkipList->end()) - itr->GetSource()->RepopAtGraveyard(); - } + { + // teleport players that are no longer bound (can be still bound if extended id) + if (!globalResetSkipList || std::find(globalResetSkipList->begin(), globalResetSkipList->end(), itr->GetSource()->GetGUIDLow()) == globalResetSkipList->end()) + itr->GetSource()->RepopAtGraveyard(); + } - // reset map only if noone is bound - if (!globalResetSkipList || globalResetSkipList->empty()) - { - // pussywizard: setting both m_unloadWhenEmpty and m_unloadTimer intended, in case RepopAtGraveyard failed - if (HavePlayers()) - m_unloadWhenEmpty = true; - m_unloadTimer = MIN_UNLOAD_DELAY; - m_resetAfterUnload = true; - } + // reset map only if noone is bound + if (!globalResetSkipList || globalResetSkipList->empty()) + { + // pussywizard: setting both m_unloadWhenEmpty and m_unloadTimer intended, in case RepopAtGraveyard failed + if (HavePlayers()) + m_unloadWhenEmpty = true; + m_unloadTimer = MIN_UNLOAD_DELAY; + m_resetAfterUnload = true; + } - return m_mapRefManager.isEmpty(); - } + return m_mapRefManager.isEmpty(); + } if (HavePlayers()) { @@ -2675,13 +2675,13 @@ void InstanceMap::PermBindAllPlayers() return; } - Player* player; - Group* group; + Player* player; + Group* group; // group members outside the instance group don't get bound for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) { player = itr->GetSource(); - group = player->GetGroup(); + group = player->GetGroup(); // players inside an instance cannot be bound to other instances // some players may already be permanently bound, in this case nothing happens InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(player->GetGUIDLow(), save->GetMapId(), save->GetDifficulty()); @@ -2690,12 +2690,12 @@ void InstanceMap::PermBindAllPlayers() WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4); data << uint32(0); player->GetSession()->SendPacket(&data); - sInstanceSaveMgr->PlayerBindToInstance(player->GetGUIDLow(), save, true, player); + sInstanceSaveMgr->PlayerBindToInstance(player->GetGUIDLow(), save, true, player); } - // Xinef: Difficulty change prevention - if (group) - group->SetDifficultyChangePrevention(DIFFICULTY_PREVENTION_CHANGE_BOSS_KILLED); + // Xinef: Difficulty change prevention + if (group) + group->SetDifficultyChangePrevention(DIFFICULTY_PREVENTION_CHANGE_BOSS_KILLED); } } @@ -2783,21 +2783,21 @@ bool BattlegroundMap::CanEnter(Player* player, bool loginCheck) bool BattlegroundMap::AddPlayerToMap(Player* player) { player->m_InstanceValid = true; - if (IsBattleArena()) - player->CastSpell(player, 100102, true); + if (IsBattleArena()) + player->CastSpell(player, 100102, true); return Map::AddPlayerToMap(player); } void BattlegroundMap::RemovePlayerFromMap(Player* player, bool remove) { - if (Battleground* bg = GetBG()) - { - bg->RemovePlayerAtLeave(player); - if (IsBattleArena()) - bg->RemoveSpectator(player); - } - if (IsBattleArena()) - player->RemoveAura(100102); + if (Battleground* bg = GetBG()) + { + bg->RemovePlayerAtLeave(player); + if (IsBattleArena()) + bg->RemoveSpectator(player); + } + if (IsBattleArena()) + player->RemoveAura(100102); Map::RemovePlayerFromMap(player, remove); } @@ -2869,9 +2869,9 @@ void Map::SaveCreatureRespawnTime(uint32 dbGuid, time_t& respawnTime) return; } - time_t now = time(NULL); - if (GetInstanceResetPeriod() > 0 && respawnTime-now+5 >= GetInstanceResetPeriod()) - respawnTime = now+YEAR; + time_t now = time(NULL); + if (GetInstanceResetPeriod() > 0 && respawnTime-now+5 >= GetInstanceResetPeriod()) + respawnTime = now+YEAR; _creatureRespawnTimes[dbGuid] = respawnTime; @@ -2903,9 +2903,9 @@ void Map::SaveGORespawnTime(uint32 dbGuid, time_t& respawnTime) return; } - time_t now = time(NULL); - if (GetInstanceResetPeriod() > 0 && respawnTime-now+5 >= GetInstanceResetPeriod()) - respawnTime = now+YEAR; + time_t now = time(NULL); + if (GetInstanceResetPeriod() > 0 && respawnTime-now+5 >= GetInstanceResetPeriod()) + respawnTime = now+YEAR; _goRespawnTimes[dbGuid] = respawnTime; @@ -2984,7 +2984,7 @@ void Map::DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId) void Map::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* source) { - Difficulty difficulty_fixed = (GetId() == 631 || GetId() == 724 ? Difficulty(GetDifficulty()%2) : GetDifficulty()); + Difficulty difficulty_fixed = (GetId() == 631 || GetId() == 724 ? Difficulty(GetDifficulty()%2) : GetDifficulty()); DungeonEncounterList const* encounters = sObjectMgr->GetDungeonEncounterList(GetId(), difficulty_fixed); if (!encounters) return; @@ -2996,9 +2996,9 @@ void Map::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Uni DungeonEncounter const* encounter = *itr; if (encounter->creditType == type && encounter->creditEntry == creditEntry) { - if (source) - if (InstanceScript* instanceScript = source->GetInstanceScript()) - instanceScript->SetCompletedEncountersMask((1 << encounter->dbcEntry->encounterIndex)|instanceScript->GetCompletedEncounterMask(), true); + if (source) + if (InstanceScript* instanceScript = source->GetInstanceScript()) + instanceScript->SetCompletedEncountersMask((1 << encounter->dbcEntry->encounterIndex)|instanceScript->GetCompletedEncounterMask(), true); if (encounter->lastEncounterDungeon) { @@ -3008,19 +3008,19 @@ void Map::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Uni } } - // pussywizard: - LogEncounterFinished(type, creditEntry); + // pussywizard: + LogEncounterFinished(type, creditEntry); - if (dungeonId) + if (dungeonId) { - Map::PlayerList const& players = GetPlayers(); + Map::PlayerList const& players = GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { - if (Player* player = i->GetSource()) + if (Player* player = i->GetSource()) if (Group* grp = player->GetGroup()) if (grp->isLFGGroup()) { - sLFGMgr->FinishDungeon(grp->GetGUID(), dungeonId, this); + sLFGMgr->FinishDungeon(grp->GetGUID(), dungeonId, this); return; } } @@ -3029,30 +3029,30 @@ void Map::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Uni void Map::LogEncounterFinished(EncounterCreditType type, uint32 creditEntry) { - if (!IsRaid() || !GetEntry() || GetEntry()->Expansion() < 2) // only for wotlk raids, because logs take up tons of mysql memory - return; - InstanceMap* map = ToInstanceMap(); - if (!map) - return; - std::string playersInfo; - char buffer[16384], buffer2[255]; - Map::PlayerList const& pl = map->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - { - std::string auraStr; - const Unit::AuraApplicationMap& a = p->GetAppliedAuras(); - for (Unit::AuraApplicationMap::const_iterator itr = a.begin(); itr != a.end(); ++itr) - { - snprintf(buffer2, 255, "%u(%u) ", itr->first, itr->second->GetEffectMask()); - auraStr += buffer2; - } + if (!IsRaid() || !GetEntry() || GetEntry()->Expansion() < 2) // only for wotlk raids, because logs take up tons of mysql memory + return; + InstanceMap* map = ToInstanceMap(); + if (!map) + return; + std::string playersInfo; + char buffer[16384], buffer2[255]; + Map::PlayerList const& pl = map->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + { + std::string auraStr; + const Unit::AuraApplicationMap& a = p->GetAppliedAuras(); + for (Unit::AuraApplicationMap::const_iterator itr = a.begin(); itr != a.end(); ++itr) + { + snprintf(buffer2, 255, "%u(%u) ", itr->first, itr->second->GetEffectMask()); + auraStr += buffer2; + } - snprintf(buffer, 16384, "%s (guid: %u, acc: %u, ip: %s, guild: %u), xyz: (%.1f, %.1f, %.1f), auras: %s\n", p->GetName().c_str(), p->GetGUIDLow(), p->GetSession()->GetAccountId(), p->GetSession()->GetRemoteAddress().c_str(), p->GetGuildId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), auraStr.c_str()); - playersInfo += buffer; - } - CleanStringForMysqlQuery(playersInfo); - CharacterDatabase.PExecute("INSERT INTO log_encounter VALUES(NOW(), %u, %u, %u, %u, '%s')", GetId(), (uint32)GetDifficulty(), type, creditEntry, playersInfo.c_str()); + snprintf(buffer, 16384, "%s (guid: %u, acc: %u, ip: %s, guild: %u), xyz: (%.1f, %.1f, %.1f), auras: %s\n", p->GetName().c_str(), p->GetGUIDLow(), p->GetSession()->GetAccountId(), p->GetSession()->GetRemoteAddress().c_str(), p->GetGuildId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), auraStr.c_str()); + playersInfo += buffer; + } + CleanStringForMysqlQuery(playersInfo); + CharacterDatabase.PExecute("INSERT INTO log_encounter VALUES(NOW(), %u, %u, %u, %u, '%s')", GetId(), (uint32)GetDifficulty(), type, creditEntry, playersInfo.c_str()); } bool Map::AllTransportsEmpty() const @@ -3068,7 +3068,7 @@ void Map::AllTransportsRemovePassengers() { for (TransportsContainer::const_iterator itr = _transports.begin(); itr != _transports.end(); ++itr) while (!(*itr)->GetPassengers().empty()) - (*itr)->RemovePassenger(*((*itr)->GetPassengers().begin()), true); + (*itr)->RemovePassenger(*((*itr)->GetPassengers().begin()), true); } time_t Map::GetLinkedRespawnTime(uint64 guid) const diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 63daacd2b..81f53e0c1 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -287,7 +287,7 @@ class Map : public GridRefManager virtual bool AddPlayerToMap(Player*); virtual void RemovePlayerFromMap(Player*, bool); - virtual void AfterPlayerUnlinkFromMap(); + virtual void AfterPlayerUnlinkFromMap(); template bool AddToMap(T *, bool checkTransport = false); template void RemoveFromMap(T *, bool); @@ -339,7 +339,7 @@ class Map : public GridRefManager // some calls like isInWater should not use vmaps due to processor power // can return INVALID_HEIGHT if under z+2 z coord not found height float GetHeight(float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; - Transport* GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject* worldobject = NULL); + Transport* GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject* worldobject = NULL); ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0) const; @@ -449,7 +449,7 @@ class Map : public GridRefManager void UpdateIteratorBack(Player* player); TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = NULL, uint32 duration = 0, Unit* summoner = NULL, uint32 spellId = 0, uint32 vehId = 0); - GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport = true); + GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport = true); void SummonCreatureGroup(uint8 group, std::list* list = NULL); Player* GetPlayer(uint64 guid); Creature* GetCreature(uint64 guid); @@ -475,7 +475,7 @@ class Map : public GridRefManager void RemoveGameObjectModel(const GameObjectModel& model) { _dynamicTree.remove(model); } void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); } bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);} - DynamicMapTree const& GetDynamicMapTree() const { return _dynamicTree; } + DynamicMapTree const& GetDynamicMapTree() const { return _dynamicTree; } bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist); /* @@ -506,7 +506,7 @@ class Map : public GridRefManager void RemoveGORespawnTime(uint32 dbGuid); void LoadRespawnTimes(); void DeleteRespawnTimes(); - time_t GetInstanceResetPeriod() const { return _instanceResetPeriod; } + time_t GetInstanceResetPeriod() const { return _instanceResetPeriod; } static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId); @@ -521,13 +521,13 @@ class Map : public GridRefManager // Checks encounter state at kill/spellcast, originally in InstanceScript however not every map has instance script :( void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* source); - void LogEncounterFinished(EncounterCreditType type, uint32 creditEntry); + void LogEncounterFinished(EncounterCreditType type, uint32 creditEntry); GridMap* GetGrid(float x, float y); void EnsureGridCreated(const GridCoord &); - bool AllTransportsEmpty() const; // pussywizard - void AllTransportsRemovePassengers(); // pussywizard - TransportsContainer const& GetAllTransports() const { return _transports; } + bool AllTransportsEmpty() const; // pussywizard + void AllTransportsRemovePassengers(); // pussywizard + TransportsContainer const& GetAllTransports() const { return _transports; } private: void LoadMapAndVMap(int gx, int gy); @@ -560,7 +560,7 @@ class Map : public GridRefManager return i_grids[x][y]; } - bool EnsureGridLoaded(Cell const&); + bool EnsureGridLoaded(Cell const&); bool isGridObjectDataLoaded(uint32 x, uint32 y) const { return getNGrid(x, y)->isGridObjectDataLoaded(); } void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y) { getNGrid(x, y)->setGridObjectDataLoaded(pLoaded); } @@ -658,11 +658,11 @@ class Map : public GridRefManager enum InstanceResetMethod { - INSTANCE_RESET_ALL, // reset all option under portrait, resets only normal 5-mans - INSTANCE_RESET_CHANGE_DIFFICULTY, // on changing difficulty - INSTANCE_RESET_GLOBAL, // global id reset - INSTANCE_RESET_GROUP_JOIN, // on joining group - INSTANCE_RESET_GROUP_LEAVE // on leaving group + INSTANCE_RESET_ALL, // reset all option under portrait, resets only normal 5-mans + INSTANCE_RESET_CHANGE_DIFFICULTY, // on changing difficulty + INSTANCE_RESET_GLOBAL, // global id reset + INSTANCE_RESET_GROUP_JOIN, // on joining group + INSTANCE_RESET_GROUP_LEAVE // on leaving group }; class InstanceMap : public Map @@ -672,10 +672,10 @@ class InstanceMap : public Map ~InstanceMap(); bool AddPlayerToMap(Player*); void RemovePlayerFromMap(Player*, bool); - void AfterPlayerUnlinkFromMap(); + void AfterPlayerUnlinkFromMap(); void Update(const uint32, const uint32, bool thread = true); - void CreateInstanceScript(bool load, std::string data, uint32 completedEncounterMask); - bool Reset(uint8 method, std::list* globalSkipList = NULL); + void CreateInstanceScript(bool load, std::string data, uint32 completedEncounterMask); + bool Reset(uint8 method, std::list* globalSkipList = NULL); uint32 GetScriptId() { return i_script_id; } InstanceScript* GetInstanceScript() { return instance_script; } void PermBindAllPlayers(); diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index 4d56b666d..9a1eca30c 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -145,33 +145,33 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) if (destInstId) { - InstanceSave* pSave = sInstanceSaveMgr->GetInstanceSave(destInstId); - ASSERT(pSave); // pussywizard: must exist + InstanceSave* pSave = sInstanceSaveMgr->GetInstanceSave(destInstId); + ASSERT(pSave); // pussywizard: must exist map = FindInstanceMap(destInstId); if (!map) map = CreateInstance(destInstId, pSave, realdiff); - else if ((mapId == 631 || mapId == 724) && !map->HavePlayers() && map->GetDifficulty() != realdiff) - { - if (player->isBeingLoaded()) // pussywizard: crashfix (assert(passengers.empty) fail in ~transport), could be added to a transport during loading from db - return NULL; + else if ((mapId == 631 || mapId == 724) && !map->HavePlayers() && map->GetDifficulty() != realdiff) + { + if (player->isBeingLoaded()) // pussywizard: crashfix (assert(passengers.empty) fail in ~transport), could be added to a transport during loading from db + return NULL; - if (!map->AllTransportsEmpty()) - map->AllTransportsRemovePassengers(); // pussywizard: gameobjects / summons (assert(passengers.empty) fail in ~transport) + if (!map->AllTransportsEmpty()) + map->AllTransportsRemovePassengers(); // pussywizard: gameobjects / summons (assert(passengers.empty) fail in ~transport) - for (InstancedMaps::iterator i = m_InstancedMaps.begin(); i != m_InstancedMaps.end(); ++i) - if (i->first == destInstId) - { - DestroyInstance(i); - map = CreateInstance(destInstId, pSave, realdiff); - break; - } - } + for (InstancedMaps::iterator i = m_InstancedMaps.begin(); i != m_InstancedMaps.end(); ++i) + if (i->first == destInstId) + { + DestroyInstance(i); + map = CreateInstance(destInstId, pSave, realdiff); + break; + } + } } else { uint32 newInstanceId = sMapMgr->GenerateInstanceId(); - ASSERT(!FindInstanceMap(newInstanceId)); // pussywizard: instance with new id can't exist + ASSERT(!FindInstanceMap(newInstanceId)); // pussywizard: instance with new id can't exist Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(IsRaid()) : player->GetDifficulty(IsRaid()); map = CreateInstance(newInstanceId, NULL, diff); } @@ -209,13 +209,13 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, map->LoadRespawnTimes(); - if (save) - map->CreateInstanceScript(true, save->GetInstanceData(), save->GetCompletedEncounterMask()); - else - map->CreateInstanceScript(false, "", 0); + if (save) + map->CreateInstanceScript(true, save->GetInstanceData(), save->GetCompletedEncounterMask()); + else + map->CreateInstanceScript(false, "", 0); - if (!save) // this is for sure a dungeon (assert above), no need to check here - sInstanceSaveMgr->AddInstanceSave(GetId(), InstanceId, difficulty); + if (!save) // this is for sure a dungeon (assert above), no need to check here + sInstanceSaveMgr->AddInstanceSave(GetId(), InstanceId, difficulty); m_InstancedMaps[InstanceId] = map; return map; diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 706f70c89..6c5aba945 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -168,14 +168,14 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) } } - // xinef: dont allow LFG Group to enter other instance that is selected - if (group) - if (group->isLFGGroup()) - if (!sLFGMgr->inLfgDungeonMap(group->GetGUID(), mapid, targetDifficulty)) - { - player->SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); - return false; - } + // xinef: dont allow LFG Group to enter other instance that is selected + if (group) + if (group->isLFGGroup()) + if (!sLFGMgr->inLfgDungeonMap(group->GetGUID(), mapid, targetDifficulty)) + { + player->SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); + return false; + } if (!player->IsAlive()) { @@ -208,9 +208,9 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) } // if map exists - check for being full, etc. - if (!loginCheck) // for login this is done by the calling function + if (!loginCheck) // for login this is done by the calling function { - uint32 destInstId = sInstanceSaveMgr->PlayerGetDestinationInstanceId(player, mapid, targetDifficulty); + uint32 destInstId = sInstanceSaveMgr->PlayerGetDestinationInstanceId(player, mapid, targetDifficulty); if (destInstId) if (Map* boundMap = sMapMgr->FindMap(mapid, destInstId)) if (!boundMap->CanEnter(player, loginCheck)) @@ -221,7 +221,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) if (entry->IsDungeon() && (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance())) { uint32 instaceIdToCheck = 0; - if (InstanceSave* save = sInstanceSaveMgr->PlayerGetInstanceSave(player->GetGUIDLow(), mapid, player->GetDifficulty(entry->IsRaid()))) + if (InstanceSave* save = sInstanceSaveMgr->PlayerGetInstanceSave(player->GetGUIDLow(), mapid, player->GetDifficulty(entry->IsRaid()))) instaceIdToCheck = save->GetInstanceId(); // instaceIdToCheck can be 0 if save not found - means no bind so the instance is new @@ -241,19 +241,19 @@ void MapManager::Update(uint32 diff) for (uint8 i=0; i<4; ++i) i_timer[i].Update(diff); - // pussywizard: lfg compatibles update, schedule before maps so it is processed from the very beginning - //if (mapUpdateStep == 0) - { - if (m_updater.activated()) - m_updater.schedule_lfg_update(diff); - else - { - uint32 startTime = getMSTime(); - sLFGMgr->Update(diff, 1); - uint32 totalTime = getMSTimeDiff(startTime, getMSTime()); - lfgDiffTracker.Update(10000+totalTime); // +10k to mark it was NOT multithreaded - } - } + // pussywizard: lfg compatibles update, schedule before maps so it is processed from the very beginning + //if (mapUpdateStep == 0) + { + if (m_updater.activated()) + m_updater.schedule_lfg_update(diff); + else + { + uint32 startTime = getMSTime(); + sLFGMgr->Update(diff, 1); + uint32 totalTime = getMSTimeDiff(startTime, getMSTime()); + lfgDiffTracker.Update(10000+totalTime); // +10k to mark it was NOT multithreaded + } + } MapMapType::iterator iter = i_maps.begin(); for (; iter != i_maps.end(); ++iter) @@ -340,11 +340,11 @@ void MapManager::GetNumInstances(uint32& dungeons, uint32& battlegrounds, uint32 continue; MapInstanced::InstancedMaps &maps = ((MapInstanced*)map)->GetInstancedMaps(); for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr) - { + { if (mitr->second->IsDungeon()) dungeons++; - else if (mitr->second->IsBattleground()) battlegrounds++; - else if (mitr->second->IsBattleArena()) arenas++; - } + else if (mitr->second->IsBattleground()) battlegrounds++; + else if (mitr->second->IsBattleArena()) arenas++; + } } } @@ -357,20 +357,20 @@ void MapManager::GetNumPlayersInInstances(uint32& dungeons, uint32& battleground continue; MapInstanced::InstancedMaps &maps = ((MapInstanced*)map)->GetInstancedMaps(); for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr) - { + { if (mitr->second->IsDungeon()) dungeons += ((InstanceMap*)mitr->second)->GetPlayers().getSize(); - else if (mitr->second->IsBattleground()) battlegrounds += ((InstanceMap*)mitr->second)->GetPlayers().getSize(); - else if (mitr->second->IsBattleArena()) - { - uint32 spect = 0; - if (BattlegroundMap* bgmap = mitr->second->ToBattlegroundMap()) - if (Battleground* bg = bgmap->GetBG()) - spect = bg->GetSpectators().size(); + else if (mitr->second->IsBattleground()) battlegrounds += ((InstanceMap*)mitr->second)->GetPlayers().getSize(); + else if (mitr->second->IsBattleArena()) + { + uint32 spect = 0; + if (BattlegroundMap* bgmap = mitr->second->ToBattlegroundMap()) + if (Battleground* bg = bgmap->GetBG()) + spect = bg->GetSpectators().size(); - arenas += ((InstanceMap*)mitr->second)->GetPlayers().getSize() - spect; - spectators += spect; - } - } + arenas += ((InstanceMap*)mitr->second)->GetPlayers().getSize() - spect; + spectators += spect; + } + } } } @@ -391,10 +391,10 @@ void MapManager::RegisterInstanceId(uint32 instanceId) // Allocation was done in InitInstanceIds() _instanceIds[instanceId] = true; - // Instances are pulled in ascending order from db and _nextInstanceId is initialized with 1, + // Instances are pulled in ascending order from db and _nextInstanceId is initialized with 1, // so if the instance id is used, increment - if (_nextInstanceId == instanceId) - ++_nextInstanceId; + if (_nextInstanceId == instanceId) + ++_nextInstanceId; } uint32 MapManager::GenerateInstanceId() @@ -402,7 +402,7 @@ uint32 MapManager::GenerateInstanceId() uint32 newInstanceId = _nextInstanceId; // find the lowest available id starting from the current _nextInstanceId - while (_nextInstanceId < 0xFFFFFFFF && ++_nextInstanceId < _instanceIds.size() && _instanceIds[_nextInstanceId]); + while (_nextInstanceId < 0xFFFFFFFF && ++_nextInstanceId < _instanceIds.size() && _instanceIds[_nextInstanceId]); if (_nextInstanceId == 0xFFFFFFFF) { diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp index 676653c89..3377b7455 100644 --- a/src/server/game/Maps/MapUpdater.cpp +++ b/src/server/game/Maps/MapUpdater.cpp @@ -72,10 +72,10 @@ class LFGUpdateRequest : public ACE_Method_Request virtual int call() { - uint32 startTime = getMSTime(); + uint32 startTime = getMSTime(); sLFGMgr->Update(m_diff, 1); - uint32 totalTime = getMSTimeDiff(startTime, getMSTime()); - lfgDiffTracker.Update(totalTime); + uint32 totalTime = getMSTimeDiff(startTime, getMSTime()); + lfgDiffTracker.Update(totalTime); m_updater.update_finished(); return 0; } @@ -159,8 +159,8 @@ void MapUpdater::update_finished() if (pending_requests == 0) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%t)\n"), ACE_TEXT("MapUpdater::update_finished BUG, report to devs"))); - sLog->outMisc("WOOT! pending_requests == 0 before decrement!"); - m_condition.broadcast(); + sLog->outMisc("WOOT! pending_requests == 0 before decrement!"); + m_condition.broadcast(); return; } diff --git a/src/server/game/Maps/MapUpdater.h b/src/server/game/Maps/MapUpdater.h index a0cb65b93..7afbfd5cb 100644 --- a/src/server/game/Maps/MapUpdater.h +++ b/src/server/game/Maps/MapUpdater.h @@ -17,10 +17,10 @@ class MapUpdater virtual ~MapUpdater(); friend class MapUpdateRequest; - friend class LFGUpdateRequest; + friend class LFGUpdateRequest; int schedule_update(Map& map, ACE_UINT32 diff, ACE_UINT32 s_diff); - int schedule_lfg_update(ACE_UINT32 diff); + int schedule_lfg_update(ACE_UINT32 diff); int wait(); diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index a47b2b473..1086d04e6 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -62,7 +62,7 @@ void TransportMgr::LoadTransportTemplates() GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry); if (goInfo == NULL) { - sLog->outError("Transport %u has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry); + sLog->outError("Transport %u has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry); continue; } @@ -403,8 +403,8 @@ MotionTransport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/ if (map && map->IsDungeon()) trans->m_zoneScript = map->ToInstanceMap()->GetInstanceScript(); - // xinef: transports are active so passengers can be relocated (grids must be loaded) - trans->setActive(true); + // xinef: transports are active so passengers can be relocated (grids must be loaded) + trans->setActive(true); trans->GetMap()->AddToMap(trans); return trans; } @@ -435,8 +435,8 @@ void TransportMgr::SpawnContinentTransports() sLog->outString(">> Spawned %u continent motion transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - // pussywizard: preload grids for continent static transports - oldMSTime = getMSTime(); + // pussywizard: preload grids for continent static transports + oldMSTime = getMSTime(); result = WorldDatabase.Query("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11"); count = 0; if (result) @@ -449,12 +449,12 @@ void TransportMgr::SpawnContinentTransports() float y = fields[2].GetFloat(); MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); - if (mapEntry && !mapEntry->Instanceable()) - if (Map* map = sMapMgr->CreateBaseMap(mapId)) - { - map->LoadGrid(x, y); - ++count; - } + if (mapEntry && !mapEntry->Instanceable()) + if (Map* map = sMapMgr->CreateBaseMap(mapId)) + { + map->LoadGrid(x, y); + ++count; + } } while (result->NextRow()); } @@ -478,53 +478,53 @@ void TransportMgr::CreateInstanceTransports(Map* map) bool TransportAnimation::GetAnimNode(uint32 time, TransportAnimationEntry const* &curr, TransportAnimationEntry const* &next, float &percPos) const { if (Path.empty()) - return false; + return false; for (TransportPathContainer::const_reverse_iterator itr = Path.rbegin(); itr != Path.rend(); ++itr) if (time >= itr->first) - { + { curr = itr->second; - ASSERT(itr != Path.rbegin()); - --itr; - next = itr->second; - percPos = float(time - curr->TimeSeg) / float(next->TimeSeg - curr->TimeSeg); - return true; - } + ASSERT(itr != Path.rbegin()); + --itr; + next = itr->second; + percPos = float(time - curr->TimeSeg) / float(next->TimeSeg - curr->TimeSeg); + return true; + } - return false; + return false; } void TransportAnimation::GetAnimRotation(uint32 time, G3D::Quat &curr, G3D::Quat &next, float &percRot) const { if (Rotations.empty()) - { - curr = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f); - next = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f); - percRot = 0.0f; + { + curr = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f); + next = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f); + percRot = 0.0f; return; - } + } for (TransportPathRotationContainer::const_reverse_iterator itr = Rotations.rbegin(); itr != Rotations.rend(); ++itr) if (time >= itr->first) { - uint32 currSeg = itr->second->TimeSeg, nextSeg; - curr = G3D::Quat(itr->second->X, itr->second->Y, itr->second->Z, itr->second->W); - if (itr != Rotations.rbegin()) - { - --itr; - next = G3D::Quat(itr->second->X, itr->second->Y, itr->second->Z, itr->second->W); - nextSeg = itr->second->TimeSeg; - } - else - { - next = G3D::Quat(Rotations.begin()->second->X, Rotations.begin()->second->Y, Rotations.begin()->second->Z, Rotations.begin()->second->W); - nextSeg = this->TotalTime; - } - percRot = float(time - currSeg) / float(nextSeg - currSeg); + uint32 currSeg = itr->second->TimeSeg, nextSeg; + curr = G3D::Quat(itr->second->X, itr->second->Y, itr->second->Z, itr->second->W); + if (itr != Rotations.rbegin()) + { + --itr; + next = G3D::Quat(itr->second->X, itr->second->Y, itr->second->Z, itr->second->W); + nextSeg = itr->second->TimeSeg; + } + else + { + next = G3D::Quat(Rotations.begin()->second->X, Rotations.begin()->second->Y, Rotations.begin()->second->Z, Rotations.begin()->second->W); + nextSeg = this->TotalTime; + } + percRot = float(time - currSeg) / float(nextSeg - currSeg); return; } - curr = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f); - next = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f); - percRot = 0.0f; + curr = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f); + next = G3D::Quat(0.0f, 0.0f, 0.0f, 1.0f); + percRot = 0.0f; } diff --git a/src/server/game/Misc/AsyncAuctionListing.cpp b/src/server/game/Misc/AsyncAuctionListing.cpp index 78112f970..ca6deb99b 100644 --- a/src/server/game/Misc/AsyncAuctionListing.cpp +++ b/src/server/game/Misc/AsyncAuctionListing.cpp @@ -20,43 +20,43 @@ bool AuctionListOwnerItemsDelayEvent::Execute(uint64 e_time, uint32 p_time) bool AuctionListItemsDelayEvent::Execute() { - Player* plr = ObjectAccessor::FindPlayer(_playerguid); - if (!plr || !plr->IsInWorld() || plr->IsDuringRemoveFromWorld() || plr->IsBeingTeleported()) - return true; + Player* plr = ObjectAccessor::FindPlayer(_playerguid); + if (!plr || !plr->IsInWorld() || plr->IsDuringRemoveFromWorld() || plr->IsBeingTeleported()) + return true; - Creature* creature = plr->GetNPCIfCanInteractWith(_creatureguid, UNIT_NPC_FLAG_AUCTIONEER); - if (!creature) - return true; + Creature* creature = plr->GetNPCIfCanInteractWith(_creatureguid, UNIT_NPC_FLAG_AUCTIONEER); + if (!creature) + return true; - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); - //sLog->outDebug("Auctionhouse search (GUID: %u TypeId: %u)",, list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", - // GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); + //sLog->outDebug("Auctionhouse search (GUID: %u TypeId: %u)",, list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", + // GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); - WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4+4+4)+50*((16+MAX_INSPECTED_ENCHANTMENT_SLOT*3)*4)); - uint32 count = 0; - uint32 totalcount = 0; - data << (uint32) 0; + WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4+4+4)+50*((16+MAX_INSPECTED_ENCHANTMENT_SLOT*3)*4)); + uint32 count = 0; + uint32 totalcount = 0; + data << (uint32) 0; - // converting string that we try to find to lower case - std::wstring wsearchedname; - if (!Utf8toWStr(_searchedname, wsearchedname)) - return true; + // converting string that we try to find to lower case + std::wstring wsearchedname; + if (!Utf8toWStr(_searchedname, wsearchedname)) + return true; - wstrToLower(wsearchedname); + wstrToLower(wsearchedname); - bool result = auctionHouse->BuildListAuctionItems(data, plr, - wsearchedname, _listfrom, _levelmin, _levelmax, _usable, - _auctionSlotID, _auctionMainCategory, _auctionSubCategory, _quality, - count, totalcount, _getAll); + bool result = auctionHouse->BuildListAuctionItems(data, plr, + wsearchedname, _listfrom, _levelmin, _levelmax, _usable, + _auctionSlotID, _auctionMainCategory, _auctionSubCategory, _quality, + count, totalcount, _getAll); - if (!result) - return false; + if (!result) + return false; - data.put(0, count); - data << (uint32) totalcount; - data << (uint32) 300; // clientside search cooldown [ms] (gray search button) - plr->GetSession()->SendPacket(&data); + data.put(0, count); + data << (uint32) totalcount; + data << (uint32) 300; // clientside search cooldown [ms] (gray search button) + plr->GetSession()->SendPacket(&data); - return true; + return true; } diff --git a/src/server/game/Misc/AsyncAuctionListing.h b/src/server/game/Misc/AsyncAuctionListing.h index 1274bf91d..cd467c026 100644 --- a/src/server/game/Misc/AsyncAuctionListing.h +++ b/src/server/game/Misc/AsyncAuctionListing.h @@ -5,63 +5,63 @@ class AuctionListOwnerItemsDelayEvent : public BasicEvent { - public: - AuctionListOwnerItemsDelayEvent(WorldPacket& d, uint64 guid, bool o) : data(d), playerguid(guid), owner(o) {} - virtual ~AuctionListOwnerItemsDelayEvent() {} + public: + AuctionListOwnerItemsDelayEvent(WorldPacket& d, uint64 guid, bool o) : data(d), playerguid(guid), owner(o) {} + virtual ~AuctionListOwnerItemsDelayEvent() {} - virtual bool Execute(uint64 e_time, uint32 p_time); - virtual void Abort(uint64 e_time) {} + virtual bool Execute(uint64 e_time, uint32 p_time); + virtual void Abort(uint64 e_time) {} - private: - WorldPacket data; - uint64 playerguid; - bool owner; + private: + WorldPacket data; + uint64 playerguid; + bool owner; }; class AuctionListItemsDelayEvent { public: - AuctionListItemsDelayEvent(uint32 msTimer, uint64 playerguid, uint64 creatureguid, std::string searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable, uint32 auctionSlotID, uint32 auctionMainCategory, uint32 auctionSubCategory, uint32 quality, uint8 getAll) : - _msTimer(msTimer), _playerguid(playerguid), _creatureguid(creatureguid), _searchedname(searchedname), _listfrom(listfrom), _levelmin(levelmin), _levelmax(levelmax), _usable(usable), _auctionSlotID(auctionSlotID), _auctionMainCategory(auctionMainCategory), _auctionSubCategory(auctionSubCategory), _quality(quality), _getAll(getAll) { } + AuctionListItemsDelayEvent(uint32 msTimer, uint64 playerguid, uint64 creatureguid, std::string searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable, uint32 auctionSlotID, uint32 auctionMainCategory, uint32 auctionSubCategory, uint32 quality, uint8 getAll) : + _msTimer(msTimer), _playerguid(playerguid), _creatureguid(creatureguid), _searchedname(searchedname), _listfrom(listfrom), _levelmin(levelmin), _levelmax(levelmax), _usable(usable), _auctionSlotID(auctionSlotID), _auctionMainCategory(auctionMainCategory), _auctionSubCategory(auctionSubCategory), _quality(quality), _getAll(getAll) { } - bool Execute(); + bool Execute(); - uint32 _msTimer; - uint64 _playerguid; - uint64 _creatureguid; - std::string _searchedname; - uint32 _listfrom; - uint8 _levelmin; - uint8 _levelmax; - uint8 _usable; - uint32 _auctionSlotID; - uint32 _auctionMainCategory; - uint32 _auctionSubCategory; - uint32 _quality; - uint8 _getAll; + uint32 _msTimer; + uint64 _playerguid; + uint64 _creatureguid; + std::string _searchedname; + uint32 _listfrom; + uint8 _levelmin; + uint8 _levelmax; + uint8 _usable; + uint32 _auctionSlotID; + uint32 _auctionMainCategory; + uint32 _auctionSubCategory; + uint32 _quality; + uint8 _getAll; }; class AsyncAuctionListingMgr { public: - static void Update(uint32 diff) { auctionListingDiff += diff; } - static uint32 GetDiff() { return auctionListingDiff; } - static void ResetDiff() { auctionListingDiff = 0; } - static bool IsAuctionListingAllowed() { return auctionListingAllowed; } - static void SetAuctionListingAllowed(bool a) { auctionListingAllowed = a; } + static void Update(uint32 diff) { auctionListingDiff += diff; } + static uint32 GetDiff() { return auctionListingDiff; } + static void ResetDiff() { auctionListingDiff = 0; } + static bool IsAuctionListingAllowed() { return auctionListingAllowed; } + static void SetAuctionListingAllowed(bool a) { auctionListingAllowed = a; } - static std::list & GetList() { return auctionListingList; } - static std::list & GetTempList() { return auctionListingListTemp; } - static ACE_Thread_Mutex& GetLock() { return auctionListingLock; } - static ACE_Thread_Mutex& GetTempLock() { return auctionListingTempLock; } + static std::list & GetList() { return auctionListingList; } + static std::list & GetTempList() { return auctionListingListTemp; } + static ACE_Thread_Mutex& GetLock() { return auctionListingLock; } + static ACE_Thread_Mutex& GetTempLock() { return auctionListingTempLock; } private: - static uint32 auctionListingDiff; - static bool auctionListingAllowed; - static std::list auctionListingList; - static std::list auctionListingListTemp; - static ACE_Thread_Mutex auctionListingLock; - static ACE_Thread_Mutex auctionListingTempLock; + static uint32 auctionListingDiff; + static bool auctionListingAllowed; + static std::list auctionListingList; + static std::list auctionListingListTemp; + static ACE_Thread_Mutex auctionListingLock; + static ACE_Thread_Mutex auctionListingTempLock; }; #endif diff --git a/src/server/game/Misc/AvgDiffTracker.h b/src/server/game/Misc/AvgDiffTracker.h index 3698ab8bb..58119df52 100644 --- a/src/server/game/Misc/AvgDiffTracker.h +++ b/src/server/game/Misc/AvgDiffTracker.h @@ -8,62 +8,62 @@ class AvgDiffTracker { public: - AvgDiffTracker() : total(0), index(0), average(0) { memset(&tab, 0, sizeof(tab)); max[0] = 0; max[1] = 0; } + AvgDiffTracker() : total(0), index(0), average(0) { memset(&tab, 0, sizeof(tab)); max[0] = 0; max[1] = 0; } - uint32 getAverage() - { - return average; - } + uint32 getAverage() + { + return average; + } - uint32 getTimeWeightedAverage() - { - if (tab[AVG_DIFF_COUNT-1] == 0) - return 0; + uint32 getTimeWeightedAverage() + { + if (tab[AVG_DIFF_COUNT-1] == 0) + return 0; - uint32 sum = 0, weightsum = 0; - for (uint32 i=0; i max[1] ? max[0] : max[1]; - } + uint32 getMax() + { + return max[0] > max[1] ? max[0] : max[1]; + } - void Update(uint32 diff) - { - if (diff < 1) - diff = 1; - total -= tab[index]; - total += diff; - tab[index] = diff; - if (diff > max[0]) - max[0] = diff; - if (++index >= AVG_DIFF_COUNT) - { - index = 0; - max[1] = max[0]; - max[0] = 0; - } + void Update(uint32 diff) + { + if (diff < 1) + diff = 1; + total -= tab[index]; + total += diff; + tab[index] = diff; + if (diff > max[0]) + max[0] = diff; + if (++index >= AVG_DIFF_COUNT) + { + index = 0; + max[1] = max[0]; + max[0] = 0; + } - if (tab[AVG_DIFF_COUNT-1]) - average = total/AVG_DIFF_COUNT; - else if (index) - average = total/index; - else - average = 0; - } + if (tab[AVG_DIFF_COUNT-1]) + average = total/AVG_DIFF_COUNT; + else if (index) + average = total/index; + else + average = 0; + } private: - uint32 tab[AVG_DIFF_COUNT]; - uint32 total; - uint32 index; - uint32 max[2]; - uint32 average; + uint32 tab[AVG_DIFF_COUNT]; + uint32 total; + uint32 index; + uint32 max[2]; + uint32 average; }; extern AvgDiffTracker avgDiffTracker; diff --git a/src/server/game/Misc/DynamicVisibility.cpp b/src/server/game/Misc/DynamicVisibility.cpp index 12e057c99..66fe7055f 100644 --- a/src/server/game/Misc/DynamicVisibility.cpp +++ b/src/server/game/Misc/DynamicVisibility.cpp @@ -4,8 +4,8 @@ uint8 DynamicVisibilityMgr::visibilitySettingsIndex = 0; void DynamicVisibilityMgr::Update(uint32 sessionCount) { - if (sessionCount >= (visibilitySettingsIndex+1)*((uint32)VISIBILITY_SETTINGS_PLAYER_INTERVAL) && visibilitySettingsIndex < VISIBILITY_SETTINGS_MAX_INTERVAL_NUM-1) - ++visibilitySettingsIndex; - else if (visibilitySettingsIndex && sessionCount < visibilitySettingsIndex*((uint32)VISIBILITY_SETTINGS_PLAYER_INTERVAL)-100) - --visibilitySettingsIndex; + if (sessionCount >= (visibilitySettingsIndex+1)*((uint32)VISIBILITY_SETTINGS_PLAYER_INTERVAL) && visibilitySettingsIndex < VISIBILITY_SETTINGS_MAX_INTERVAL_NUM-1) + ++visibilitySettingsIndex; + else if (visibilitySettingsIndex && sessionCount < visibilitySettingsIndex*((uint32)VISIBILITY_SETTINGS_PLAYER_INTERVAL)-100) + --visibilitySettingsIndex; } diff --git a/src/server/game/Misc/DynamicVisibility.h b/src/server/game/Misc/DynamicVisibility.h index 1c4efdb22..49a895833 100644 --- a/src/server/game/Misc/DynamicVisibility.h +++ b/src/server/game/Misc/DynamicVisibility.h @@ -5,9 +5,9 @@ struct VisibilitySettingData { - uint32 visibilityNotifyDelay; - uint32 aiNotifyDelay; - float requiredMoveDistanceSq; + uint32 visibilityNotifyDelay; + uint32 aiNotifyDelay; + float requiredMoveDistanceSq; }; // pussywizard: dynamic visibility settings @@ -18,24 +18,24 @@ struct VisibilitySettingData #define VISIBILITY_SETTINGS_MAX_INTERVAL_NUM 7 const VisibilitySettingData VisibilitySettings[VISIBILITY_SETTINGS_MAX_INTERVAL_NUM][5] = { - { {300, 150, 1.0f}, {300, 150, 1.0f}, {300, 150, 1.0f}, {300, 150, 1.0f}, {300, 150, 1.0f} }, // 0-499 - { {400, 200, 2.25f}, {400, 200, 2.25f}, {400, 200, 2.25f}, {300, 150, 1.0f}, {300, 150, 1.0f} }, // 500-999 - { {500, 250, 4.0f}, {500, 250, 4.0f}, {500, 250, 4.0f}, {400, 200, 2.25f}, {300, 150, 1.0f} }, // 1000-1499 - { {700, 350, 6.25f}, {700, 350, 6.25f}, {700, 350, 6.25f}, {600, 300, 6.25f}, {300, 200, 1.0f} }, // 1500-1999 - { {1000, 500, 16.0f}, {1000, 500, 16.0f}, {1000, 500, 16.0f}, {1000, 500, 16.0f}, {300, 250, 1.0f} }, // 2000-2499 - { {1000, 500, 16.0f}, {1000, 500, 16.0f}, {1000, 500, 16.0f}, {1000, 500, 16.0f}, {300, 350, 1.0f} }, // 2500-2999 - { {1200, 550, 20.0f}, {1200, 550, 25.0f}, {1200, 550, 25.0f}, {1100, 550, 16.0f}, {300, 350, 1.0f} } // 3000+ + { {300, 150, 1.0f}, {300, 150, 1.0f}, {300, 150, 1.0f}, {300, 150, 1.0f}, {300, 150, 1.0f} }, // 0-499 + { {400, 200, 2.25f}, {400, 200, 2.25f}, {400, 200, 2.25f}, {300, 150, 1.0f}, {300, 150, 1.0f} }, // 500-999 + { {500, 250, 4.0f}, {500, 250, 4.0f}, {500, 250, 4.0f}, {400, 200, 2.25f}, {300, 150, 1.0f} }, // 1000-1499 + { {700, 350, 6.25f}, {700, 350, 6.25f}, {700, 350, 6.25f}, {600, 300, 6.25f}, {300, 200, 1.0f} }, // 1500-1999 + { {1000, 500, 16.0f}, {1000, 500, 16.0f}, {1000, 500, 16.0f}, {1000, 500, 16.0f}, {300, 250, 1.0f} }, // 2000-2499 + { {1000, 500, 16.0f}, {1000, 500, 16.0f}, {1000, 500, 16.0f}, {1000, 500, 16.0f}, {300, 350, 1.0f} }, // 2500-2999 + { {1200, 550, 20.0f}, {1200, 550, 25.0f}, {1200, 550, 25.0f}, {1100, 550, 16.0f}, {300, 350, 1.0f} } // 3000+ }; class DynamicVisibilityMgr { public: - static void Update(uint32 sessionCount); - static uint32 GetVisibilityNotifyDelay(uint32 map_type) { return VisibilitySettings[visibilitySettingsIndex][map_type].visibilityNotifyDelay; } - static uint32 GetAINotifyDelay(uint32 map_type) { return VisibilitySettings[visibilitySettingsIndex][map_type].aiNotifyDelay; } - static float GetReqMoveDistSq(uint32 map_type) { return VisibilitySettings[visibilitySettingsIndex][map_type].requiredMoveDistanceSq; } + static void Update(uint32 sessionCount); + static uint32 GetVisibilityNotifyDelay(uint32 map_type) { return VisibilitySettings[visibilitySettingsIndex][map_type].visibilityNotifyDelay; } + static uint32 GetAINotifyDelay(uint32 map_type) { return VisibilitySettings[visibilitySettingsIndex][map_type].aiNotifyDelay; } + static float GetReqMoveDistSq(uint32 map_type) { return VisibilitySettings[visibilitySettingsIndex][map_type].requiredMoveDistanceSq; } protected: - static uint8 visibilitySettingsIndex; + static uint8 visibilitySettingsIndex; }; #endif diff --git a/src/server/game/Misc/SavingSystem.cpp b/src/server/game/Misc/SavingSystem.cpp index 8a16b119d..3f35d34db 100644 --- a/src/server/game/Misc/SavingSystem.cpp +++ b/src/server/game/Misc/SavingSystem.cpp @@ -9,58 +9,58 @@ ACE_Thread_Mutex SavingSystemMgr::_savingLock; void SavingSystemMgr::Update(uint32 diff) { - if (GetSavingMaxValue() > GetSavingCurrentValue()) - { - const uint32 step = 120; + if (GetSavingMaxValue() > GetSavingCurrentValue()) + { + const uint32 step = 120; - float multiplicator; - uint32 playerCount = sWorld->GetPlayerCount(); - if (!playerCount) - { - m_savingCurrentValue = 0; - m_savingMaxValueAssigned = 0; - m_savingDiffSum = 0; - m_savingSkipList.clear(); - return; - } + float multiplicator; + uint32 playerCount = sWorld->GetPlayerCount(); + if (!playerCount) + { + m_savingCurrentValue = 0; + m_savingMaxValueAssigned = 0; + m_savingDiffSum = 0; + m_savingSkipList.clear(); + return; + } - if (GetSavingMaxValue()-GetSavingCurrentValue() > playerCount+m_savingSkipList.size()) // this should not happen, but just in case - m_savingMaxValueAssigned = m_savingCurrentValue+playerCount+m_savingSkipList.size(); + if (GetSavingMaxValue()-GetSavingCurrentValue() > playerCount+m_savingSkipList.size()) // this should not happen, but just in case + m_savingMaxValueAssigned = m_savingCurrentValue+playerCount+m_savingSkipList.size(); - if (playerCount <= 1500) // every 2min - multiplicator = 1000.0f / playerCount; - else if (playerCount <= 2500) // every 3min - multiplicator = 1500.0f / playerCount; - else if (playerCount <= 2750) // every 4min - multiplicator = 2000.0f / playerCount; - else if (playerCount <= 3000) // every 6min - multiplicator = 3000.0f / playerCount; - else if (playerCount <= 3250) // every 7min - multiplicator = 3500.0f / playerCount; - else // every 8min - multiplicator = 4000.0f / playerCount; + if (playerCount <= 1500) // every 2min + multiplicator = 1000.0f / playerCount; + else if (playerCount <= 2500) // every 3min + multiplicator = 1500.0f / playerCount; + else if (playerCount <= 2750) // every 4min + multiplicator = 2000.0f / playerCount; + else if (playerCount <= 3000) // every 6min + multiplicator = 3000.0f / playerCount; + else if (playerCount <= 3250) // every 7min + multiplicator = 3500.0f / playerCount; + else // every 8min + multiplicator = 4000.0f / playerCount; - m_savingDiffSum += diff; - while (m_savingDiffSum >= (uint32)(step*multiplicator)) - { - IncreaseSavingCurrentValue(1); + m_savingDiffSum += diff; + while (m_savingDiffSum >= (uint32)(step*multiplicator)) + { + IncreaseSavingCurrentValue(1); - while (m_savingSkipList.size() && *(m_savingSkipList.begin()) <= GetSavingCurrentValue()) - { - IncreaseSavingCurrentValue(1); - m_savingSkipList.pop_front(); - } + while (m_savingSkipList.size() && *(m_savingSkipList.begin()) <= GetSavingCurrentValue()) + { + IncreaseSavingCurrentValue(1); + m_savingSkipList.pop_front(); + } - m_savingDiffSum -= (uint32)(step*multiplicator); + m_savingDiffSum -= (uint32)(step*multiplicator); - if (GetSavingCurrentValue() > GetSavingMaxValue()) - { - m_savingDiffSum = 0; - break; - } + if (GetSavingCurrentValue() > GetSavingMaxValue()) + { + m_savingDiffSum = 0; + break; + } - if (m_savingDiffSum > 60000) - m_savingDiffSum = 60000; - } - } + if (m_savingDiffSum > 60000) + m_savingDiffSum = 60000; + } + } } diff --git a/src/server/game/Misc/SavingSystem.h b/src/server/game/Misc/SavingSystem.h index 55cb072b8..f53153f95 100644 --- a/src/server/game/Misc/SavingSystem.h +++ b/src/server/game/Misc/SavingSystem.h @@ -8,20 +8,20 @@ class SavingSystemMgr { public: - static void Update(uint32 diff); + static void Update(uint32 diff); - static uint32 GetSavingCurrentValue() { return m_savingCurrentValue; } // modified only during single thread - static uint32 GetSavingMaxValue() { return m_savingMaxValueAssigned; } // modified only during single thread - static void IncreaseSavingCurrentValue(uint32 inc) { m_savingCurrentValue += inc; } // used and modified only during single thread - static uint32 IncreaseSavingMaxValue(uint32 inc) { TRINITY_GUARD(ACE_Thread_Mutex, _savingLock); return (m_savingMaxValueAssigned += inc); } - static void InsertToSavingSkipListIfNeeded(uint32 id) { if (id > m_savingCurrentValue) { TRINITY_GUARD(ACE_Thread_Mutex, _savingLock); m_savingSkipList.push_back(id); } } + static uint32 GetSavingCurrentValue() { return m_savingCurrentValue; } // modified only during single thread + static uint32 GetSavingMaxValue() { return m_savingMaxValueAssigned; } // modified only during single thread + static void IncreaseSavingCurrentValue(uint32 inc) { m_savingCurrentValue += inc; } // used and modified only during single thread + static uint32 IncreaseSavingMaxValue(uint32 inc) { TRINITY_GUARD(ACE_Thread_Mutex, _savingLock); return (m_savingMaxValueAssigned += inc); } + static void InsertToSavingSkipListIfNeeded(uint32 id) { if (id > m_savingCurrentValue) { TRINITY_GUARD(ACE_Thread_Mutex, _savingLock); m_savingSkipList.push_back(id); } } protected: - static uint32 m_savingCurrentValue; - static uint32 m_savingMaxValueAssigned; - static uint32 m_savingDiffSum; - static std::list m_savingSkipList; - static ACE_Thread_Mutex _savingLock; + static uint32 m_savingCurrentValue; + static uint32 m_savingMaxValueAssigned; + static uint32 m_savingDiffSum; + static std::list m_savingSkipList; + static ACE_Thread_Mutex _savingLock; }; #endif diff --git a/src/server/game/Misc/WhoListCache.cpp b/src/server/game/Misc/WhoListCache.cpp index 16459eb0a..b945a61df 100644 --- a/src/server/game/Misc/WhoListCache.cpp +++ b/src/server/game/Misc/WhoListCache.cpp @@ -8,39 +8,39 @@ std::vector WhoListCacheMgr::m_whoOpcodeList; void WhoListCacheMgr::Update() { - // clear current list - m_whoOpcodeList.clear(); - m_whoOpcodeList.reserve(sWorld->GetPlayerCount()+1); + // clear current list + m_whoOpcodeList.clear(); + m_whoOpcodeList.reserve(sWorld->GetPlayerCount()+1); - TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); - HashMapHolder::MapType const& m = sObjectAccessor->GetPlayers(); - for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) - { - if (!itr->second->FindMap() || itr->second->GetSession()->PlayerLoading()) - continue; + TRINITY_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + HashMapHolder::MapType const& m = sObjectAccessor->GetPlayers(); + for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) + { + if (!itr->second->FindMap() || itr->second->GetSession()->PlayerLoading()) + continue; - if (itr->second->GetSession()->GetSecurity() > SEC_PLAYER) - continue; + if (itr->second->GetSession()->GetSecurity() > SEC_PLAYER) + continue; - std::string pname = itr->second->GetName(); - std::wstring wpname; - if (!Utf8toWStr(pname, wpname)) - continue; - wstrToLower(wpname); + std::string pname = itr->second->GetName(); + std::wstring wpname; + if (!Utf8toWStr(pname, wpname)) + continue; + wstrToLower(wpname); - std::string gname = sGuildMgr->GetGuildNameById(itr->second->GetGuildId()); - std::wstring wgname; - if (!Utf8toWStr(gname, wgname)) - continue; - wstrToLower(wgname); + std::string gname = sGuildMgr->GetGuildNameById(itr->second->GetGuildId()); + std::wstring wgname; + if (!Utf8toWStr(gname, wgname)) + continue; + wstrToLower(wgname); - std::string aname; - if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId())) - aname = areaEntry->area_name[sWorld->GetDefaultDbcLocale()]; + std::string aname; + if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId())) + aname = areaEntry->area_name[sWorld->GetDefaultDbcLocale()]; - if (itr->second->IsSpectator()) - aname = "Dalaran"; + if (itr->second->IsSpectator()) + aname = "Dalaran"; - m_whoOpcodeList.push_back( WhoListPlayerInfo(itr->second->GetTeamId(), itr->second->GetSession()->GetSecurity(), itr->second->getLevel(), itr->second->getClass(), itr->second->getRace(), (itr->second->IsSpectator() ? 4395 /*Dalaran*/ : itr->second->GetZoneId()), itr->second->getGender(), wpname, wgname, aname, pname, gname) ); - } + m_whoOpcodeList.push_back( WhoListPlayerInfo(itr->second->GetTeamId(), itr->second->GetSession()->GetSecurity(), itr->second->getLevel(), itr->second->getClass(), itr->second->getRace(), (itr->second->IsSpectator() ? 4395 /*Dalaran*/ : itr->second->GetZoneId()), itr->second->getGender(), wpname, wgname, aname, pname, gname) ); + } } \ No newline at end of file diff --git a/src/server/game/Misc/WhoListCache.h b/src/server/game/Misc/WhoListCache.h index bea160bdf..8ec43826d 100644 --- a/src/server/game/Misc/WhoListCache.h +++ b/src/server/game/Misc/WhoListCache.h @@ -5,31 +5,31 @@ struct WhoListPlayerInfo { - TeamId teamId; - AccountTypes security; - uint8 level; - uint8 clas; - uint8 race; - uint32 zoneid; - uint8 gender; - std::wstring wpname; - std::wstring wgname; - std::string aname; - std::string pname; - std::string gname; + TeamId teamId; + AccountTypes security; + uint8 level; + uint8 clas; + uint8 race; + uint32 zoneid; + uint8 gender; + std::wstring wpname; + std::wstring wgname; + std::string aname; + std::string pname; + std::string gname; - WhoListPlayerInfo(TeamId teamId, AccountTypes security, uint8 level, uint8 clas, uint8 race, uint32 zoneid, uint8 gender, std::wstring wpname, std::wstring wgname, std::string aname, std::string pname, std::string gname) : - teamId(teamId), security(security), level(level), clas(clas), race(race), zoneid(zoneid), gender(gender), wpname(wpname), wgname(wgname), aname(aname), pname(pname), gname(gname) {} + WhoListPlayerInfo(TeamId teamId, AccountTypes security, uint8 level, uint8 clas, uint8 race, uint32 zoneid, uint8 gender, std::wstring wpname, std::wstring wgname, std::string aname, std::string pname, std::string gname) : + teamId(teamId), security(security), level(level), clas(clas), race(race), zoneid(zoneid), gender(gender), wpname(wpname), wgname(wgname), aname(aname), pname(pname), gname(gname) {} }; class WhoListCacheMgr { public: - static void Update(); - static std::vector * GetWhoList() { return &m_whoOpcodeList; } + static void Update(); + static std::vector * GetWhoList() { return &m_whoOpcodeList; } protected: - static std::vector m_whoOpcodeList; + static std::vector m_whoOpcodeList; }; #endif diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 88404124c..1ee56c1db 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -521,7 +521,7 @@ enum SpellAttr6 SPELL_ATTR6_UNK26 = 0x04000000, // 26 related to player castable positive buff SPELL_ATTR6_LIMIT_PCT_HEALING_MODS = 0x08000000, // 27 xinef: complicated and guessed SPELL_ATTR6_UNK28 = 0x10000000, // 28 Death Grip - SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS = 0x20000000, // 29 xinef: complicated and guessed + SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS = 0x20000000, // 29 xinef: complicated and guessed SPELL_ATTR6_UNK30 = 0x40000000, // 30 SPELL_ATTR6_IGNORE_CATEGORY_COOLDOWN_MODS = 0x80000000 // 31 Spells with this attribute skip applying modifiers to category cooldowns }; @@ -1283,7 +1283,7 @@ enum SpellImmunity IMMUNITY_DISPEL = 4, // enum DispelType IMMUNITY_MECHANIC = 5, // enum Mechanics IMMUNITY_ID = 6, - IMMUNITY_ALLOW_ID = 7 // xinef: special type of immunity, npc is immune to everything except for those spells id + IMMUNITY_ALLOW_ID = 7 // xinef: special type of immunity, npc is immune to everything except for those spells id }; #define MAX_SPELL_IMMUNITY 8 @@ -3297,7 +3297,7 @@ enum BanReturn BAN_SUCCESS, BAN_SYNTAX_ERROR, BAN_NOTFOUND, - BAN_LONGER_EXISTS + BAN_LONGER_EXISTS }; // indexes of BattlemasterList.dbc diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 6b609a9ec..0172b4fa2 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -54,8 +54,8 @@ void MotionMaster::Initialize() // set new default movement generator void MotionMaster::InitDefault() { - // Xinef: Do not allow to initialize any motion generator for dead creatures - if (_owner->GetTypeId() == TYPEID_UNIT && _owner->IsAlive()) + // Xinef: Do not allow to initialize any motion generator for dead creatures + if (_owner->GetTypeId() == TYPEID_UNIT && _owner->IsAlive()) { MovementGenerator* movement = FactorySelector::selectMovementGenerator(_owner->ToCreature()); Mutate(movement == NULL ? &si_idleMovement : movement, MOTION_SLOT_IDLE); @@ -253,17 +253,17 @@ void MotionMaster::MoveTargetedHome() } else if (_owner->GetTypeId() == TYPEID_UNIT && _owner->ToCreature()->GetCharmerOrOwnerGUID()) { - _owner->ClearUnitState(UNIT_STATE_EVADE); - // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE - if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) - return; + _owner->ClearUnitState(UNIT_STATE_EVADE); + // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE + if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) + return; ;//sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow()); Unit* target = _owner->ToCreature()->GetCharmerOrOwner(); if (target) { ;//sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow()); - Mutate(new FollowMovementGenerator(target, PET_FOLLOW_DIST, _owner->GetFollowAngle()), MOTION_SLOT_ACTIVE); + Mutate(new FollowMovementGenerator(target, PET_FOLLOW_DIST, _owner->GetFollowAngle()), MOTION_SLOT_ACTIVE); } } else @@ -401,8 +401,8 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed) void MotionMaster::MoveLand(uint32 id, float x, float y, float z, float speed) { - Position pos = {x, y, z, 0.0f}; - MoveLand(id, pos, speed); + Position pos = {x, y, z, 0.0f}; + MoveLand(id, pos, speed); } void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed) @@ -426,8 +426,8 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed) void MotionMaster::MoveTakeoff(uint32 id, float x, float y, float z, float speed) { - Position pos = {x, y, z, 0.0f}; - MoveTakeoff(id, pos, speed); + Position pos = {x, y, z, 0.0f}; + MoveTakeoff(id, pos, speed); } void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ) @@ -490,8 +490,8 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee init.MoveTo(x, y, z); init.SetParabolic(max_height, 0); init.SetVelocity(speedXY); - if (target) - init.SetFacing(target); + if (target) + init.SetFacing(target); init.Launch(); Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); } @@ -519,16 +519,16 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC) { _owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING); _owner->m_movementInfo.SetFallTime(0); - _owner->ToPlayer()->SetFallInformation(time(NULL), _owner->GetPositionZ()); + _owner->ToPlayer()->SetFallInformation(time(NULL), _owner->GetPositionZ()); + } + else if (_owner->GetTypeId() == TYPEID_UNIT && addFlagForNPC) // pussywizard + { + _owner->RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING); + _owner->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING|MOVEMENTFLAG_CAN_FLY); + _owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING); + _owner->m_movementInfo.SetFallTime(0); + _owner->SendMovementFlagUpdate(); } - else if (_owner->GetTypeId() == TYPEID_UNIT && addFlagForNPC) // pussywizard - { - _owner->RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING); - _owner->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING|MOVEMENTFLAG_CAN_FLY); - _owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING); - _owner->m_movementInfo.SetFallTime(0); - _owner->SendMovementFlagUpdate(); - } Movement::MoveSplineInit init(_owner); init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz); @@ -574,7 +574,7 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z) ;//sLog->outStaticDebug("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)", // _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); _owner->AttackStop(); - _owner->CastStop(0, false); + _owner->CastStop(0, false); _owner->ToCreature()->SetReactState(REACT_PASSIVE); Mutate(new AssistanceMovementGenerator(x, y, z), MOTION_SLOT_ACTIVE); } diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index df1043c55..f59f83076 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -167,7 +167,7 @@ class MotionMaster //: private std::stack void MovementExpiredOnSlot(MovementSlot slot, bool reset = true) { - // xinef: cannot be used during motion update! + // xinef: cannot be used during motion update! if (!(_cleanFlag & MMCF_UPDATE)) DirectExpireSlot(slot, reset); } @@ -207,7 +207,7 @@ class MotionMaster //: private std::stack MovementGeneratorType GetCurrentMovementGeneratorType() const; MovementGeneratorType GetMotionSlotType(int slot) const; - uint32 GetCurrentSplineId() const; // Xinef: Escort system + uint32 GetCurrentSplineId() const; // Xinef: Escort system void propagateSpeedChange(); void ReinitializeMovement(); diff --git a/src/server/game/Movement/MovementGenerator.h b/src/server/game/Movement/MovementGenerator.h index 86b1759af..ff02547b9 100644 --- a/src/server/game/Movement/MovementGenerator.h +++ b/src/server/game/Movement/MovementGenerator.h @@ -42,7 +42,7 @@ class MovementGenerator virtual MovementGeneratorType GetMovementGeneratorType() = 0; - virtual uint32 GetSplineId() const { return 0; } // Xinef: Escort system + virtual uint32 GetSplineId() const { return 0; } // Xinef: Escort system virtual void unitSpeedChanged() { } diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp index 4b6672688..ffaddeb0e 100644 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp @@ -72,7 +72,7 @@ void ConfusedMovementGenerator::DoInitialize(T* unit) i_waypoints[idx][2] = idx > 0 ? i_waypoints[idx-1][2] : z; continue; } - + } else { @@ -91,10 +91,10 @@ void ConfusedMovementGenerator::DoInitialize(T* unit) i_waypoints[idx][2] = new_z; } - // Xinef: Call movement immediately to broadcast movement packet - // Xinef: Initial timer is set to 1 so update with 1 - i_nextMove = urand(1, MAX_CONF_WAYPOINTS); - DoUpdate(unit, 1); + // Xinef: Call movement immediately to broadcast movement packet + // Xinef: Initial timer is set to 1 so update with 1 + i_nextMove = urand(1, MAX_CONF_WAYPOINTS); + DoUpdate(unit, 1); unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); unit->AddUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE); @@ -117,7 +117,7 @@ void ConfusedMovementGenerator::_InitSpecific(Player* , bool &is_water_o template void ConfusedMovementGenerator::DoReset(T* unit) { - DoInitialize(unit); + DoInitialize(unit); } template diff --git a/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.cpp index 393cd6633..e3c6a1e2d 100644 --- a/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.cpp @@ -28,7 +28,7 @@ void EscortMovementGenerator::DoInitialize(T* unit) init.Launch(); - _splineId = unit->movespline->GetId(); + _splineId = unit->movespline->GetId(); } template @@ -70,8 +70,8 @@ bool EscortMovementGenerator::DoUpdate(T* unit, uint32 diff) } init.Launch(); - // Xinef: Override spline Id on recalculate launch - _splineId = unit->movespline->GetId(); + // Xinef: Override spline Id on recalculate launch + _splineId = unit->movespline->GetId(); } return !arrived; diff --git a/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h b/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h index 011d7ac31..a3495e44e 100644 --- a/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/EscortMovementGenerator.h @@ -26,13 +26,13 @@ class EscortMovementGenerator : public MovementGeneratorMedium< T, EscortMovemen MovementGeneratorType GetMovementGeneratorType() { return ESCORT_MOTION_TYPE; } - uint32 GetSplineId() const { return _splineId; } + uint32 GetSplineId() const { return _splineId; } private: bool i_recalculateSpeed; Movement::PointsArray m_precomputedPath; - uint32 _splineId; + uint32 _splineId; }; #endif diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp index e6e7aeaab..a0d7f8070 100644 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp @@ -33,7 +33,7 @@ void HomeMovementGenerator::DoFinalize(Creature* owner) owner->ClearUnitState(UNIT_STATE_EVADE); if (arrived) { - // Xinef: npc run by default + // Xinef: npc run by default //owner->SetWalk(true); owner->LoadCreaturesAddon(true); owner->AI()->JustReachedHome(); @@ -48,15 +48,15 @@ void HomeMovementGenerator::DoReset(Creature*) void HomeMovementGenerator::_setTargetLocation(Creature* owner) { - // Xinef: dont interrupt in any cast! + // Xinef: dont interrupt in any cast! //if (owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED)) // return; Movement::MoveSplineInit init(owner); float x, y, z, o; - // Xinef: if there is motion generator on controlled slot, this one is not updated - // Xinef: always get reset pos from idle slot - MovementGenerator* gen = owner->GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE); + // Xinef: if there is motion generator on controlled slot, this one is not updated + // Xinef: always get reset pos from idle slot + MovementGenerator* gen = owner->GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE); if (owner->GetMotionMaster()->empty() || !gen || !gen->GetResetPosition(x, y, z)) { owner->GetHomePosition(x, y, z, o); @@ -74,15 +74,15 @@ void HomeMovementGenerator::_setTargetLocation(Creature* owner) bool HomeMovementGenerator::DoUpdate(Creature* owner, const uint32 /*time_diff*/) { - arrived = owner->movespline->Finalized(); - if (arrived) - return false; + arrived = owner->movespline->Finalized(); + if (arrived) + return false; - if (i_recalculateTravel) - { - _setTargetLocation(owner); - i_recalculateTravel = false; - } + if (i_recalculateTravel) + { + _setTargetLocation(owner); + i_recalculateTravel = false; + } - return true; + return true; } diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp index 4df9e9971..bd05123e5 100644 --- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp @@ -62,7 +62,7 @@ bool RotateMovementGenerator::Update(Unit* owner, uint32 diff) while (angle < 0) angle += static_cast(M_PI * 2); } - owner->SetFacingTo(angle); + owner->SetFacingTo(angle); if (m_duration > diff) m_duration -= diff; diff --git a/src/server/game/Movement/MovementGenerators/PathGenerator.cpp b/src/server/game/Movement/MovementGenerators/PathGenerator.cpp index 8510c6a2d..e22abd02e 100644 --- a/src/server/game/Movement/MovementGenerators/PathGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PathGenerator.cpp @@ -26,24 +26,24 @@ ////////////////// PathGenerator ////////////////// PathGenerator::PathGenerator(const Unit* owner) : - _polyLength(0), _type(PATHFIND_BLANK), _useStraightPath(false), - _forceDestination(false), _pointPathLimit(MAX_POINT_PATH_LENGTH), - _endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(NULL), - _navMeshQuery(NULL) + _polyLength(0), _type(PATHFIND_BLANK), _useStraightPath(false), + _forceDestination(false), _pointPathLimit(MAX_POINT_PATH_LENGTH), + _endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(NULL), + _navMeshQuery(NULL) { memset(_pathPolyRefs, 0, sizeof(_pathPolyRefs)); - uint32 mapId = _sourceUnit->GetMapId(); - //if (MMAP::MMapFactory::IsPathfindingEnabled(_sourceUnit->FindMap())) // pussywizard: checked before creating new PathGenerator - { - MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager(); + uint32 mapId = _sourceUnit->GetMapId(); + //if (MMAP::MMapFactory::IsPathfindingEnabled(_sourceUnit->FindMap())) // pussywizard: checked before creating new PathGenerator + { + MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager(); - TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, mmap->GetManagerLock()); - _navMesh = mmap->GetNavMesh(mapId); - _navMeshQuery = mmap->GetNavMeshQuery(mapId, _sourceUnit->GetInstanceId()); - } + TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, mmap->GetManagerLock()); + _navMesh = mmap->GetNavMesh(mapId); + _navMeshQuery = mmap->GetNavMeshQuery(mapId, _sourceUnit->GetInstanceId()); + } - CreateFilter(); + CreateFilter(); } PathGenerator::~PathGenerator() @@ -52,959 +52,959 @@ PathGenerator::~PathGenerator() bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool forceDest) { - float x, y, z; - if (!_sourceUnit->movespline->Finalized() && _sourceUnit->movespline->Initialized()) - { - Movement::Location realpos = _sourceUnit->movespline->ComputePosition(); - x = realpos.x; y = realpos.y; z = realpos.z; - } - else - _sourceUnit->GetPosition(x, y, z); + float x, y, z; + if (!_sourceUnit->movespline->Finalized() && _sourceUnit->movespline->Initialized()) + { + Movement::Location realpos = _sourceUnit->movespline->ComputePosition(); + x = realpos.x; y = realpos.y; z = realpos.z; + } + else + _sourceUnit->GetPosition(x, y, z); - if (!Trinity::IsValidMapCoord(destX, destY, destZ) || !Trinity::IsValidMapCoord(x, y, z)) - return false; + if (!Trinity::IsValidMapCoord(destX, destY, destZ) || !Trinity::IsValidMapCoord(x, y, z)) + return false; - G3D::Vector3 dest(destX, destY, destZ); - SetEndPosition(dest); - G3D::Vector3 start(x, y, z); - SetStartPosition(start); - _forceDestination = forceDest; + G3D::Vector3 dest(destX, destY, destZ); + SetEndPosition(dest); + G3D::Vector3 start(x, y, z); + SetStartPosition(start); + _forceDestination = forceDest; - // pussywizard: EnsureGridCreated may need map mutex, and it loads mmaps (may need mmap mutex) - // pussywizard: a deadlock can occur if here the map mutex is requested after acquiring mmap lock below - // pussywizard: so call EnsureGridCreated for all possible grids before acquiring mmap lock :/ this is so shit... because the core is shit :/ - { - Cell cellS(start.x, start.y); - _sourceUnit->GetMap()->EnsureGridCreated(GridCoord(cellS.GridX(), cellS.GridY())); - Cell cellD(dest.x, dest.y); - _sourceUnit->GetMap()->EnsureGridCreated(GridCoord(cellD.GridX(), cellD.GridY())); - } + // pussywizard: EnsureGridCreated may need map mutex, and it loads mmaps (may need mmap mutex) + // pussywizard: a deadlock can occur if here the map mutex is requested after acquiring mmap lock below + // pussywizard: so call EnsureGridCreated for all possible grids before acquiring mmap lock :/ this is so shit... because the core is shit :/ + { + Cell cellS(start.x, start.y); + _sourceUnit->GetMap()->EnsureGridCreated(GridCoord(cellS.GridX(), cellS.GridY())); + Cell cellD(dest.x, dest.y); + _sourceUnit->GetMap()->EnsureGridCreated(GridCoord(cellD.GridX(), cellD.GridY())); + } - UpdateFilter(); // no mmap operations inside, no mutex needed + UpdateFilter(); // no mmap operations inside, no mutex needed - // pussywizard: mutex with new that can be release at any moment, DON'T FORGET TO RELEASE ON EVERY RETURN !!! - const Map* base = _sourceUnit->GetBaseMap(); - ACE_RW_Thread_Mutex& mmapLock = (base ? base->GetMMapLock() : MMAP::MMapFactory::createOrGetMMapManager()->GetMMapGeneralLock()); - mmapLock.acquire_read(); + // pussywizard: mutex with new that can be release at any moment, DON'T FORGET TO RELEASE ON EVERY RETURN !!! + const Map* base = _sourceUnit->GetBaseMap(); + ACE_RW_Thread_Mutex& mmapLock = (base ? base->GetMMapLock() : MMAP::MMapFactory::createOrGetMMapManager()->GetMMapGeneralLock()); + mmapLock.acquire_read(); - // make sure navMesh works - we can run on map w/o mmap - // check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?) - if (!_navMesh || !_navMeshQuery || _sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING) || - _sourceUnit->GetObjectSize() >= SIZE_OF_GRIDS/2.0f || _sourceUnit->GetExactDistSq(destX, destY, destZ) >= (SIZE_OF_GRIDS*SIZE_OF_GRIDS/4.0f) || - !HaveTile(start) || !HaveTile(dest)) - { - BuildShortcut(); - _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); - mmapLock.release(); - return true; - } + // make sure navMesh works - we can run on map w/o mmap + // check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?) + if (!_navMesh || !_navMeshQuery || _sourceUnit->HasUnitState(UNIT_STATE_IGNORE_PATHFINDING) || + _sourceUnit->GetObjectSize() >= SIZE_OF_GRIDS/2.0f || _sourceUnit->GetExactDistSq(destX, destY, destZ) >= (SIZE_OF_GRIDS*SIZE_OF_GRIDS/4.0f) || + !HaveTile(start) || !HaveTile(dest)) + { + BuildShortcut(); + _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); + mmapLock.release(); + return true; + } - BuildPolyPath(start, dest, mmapLock); - return true; + BuildPolyPath(start, dest, mmapLock); + return true; } dtPolyRef PathGenerator::GetPathPolyByPosition(dtPolyRef const* polyPath, uint32 polyPathSize, float const* point, float* distance) const { - if (!polyPath || !polyPathSize) - return INVALID_POLYREF; + if (!polyPath || !polyPathSize) + return INVALID_POLYREF; - float polyHeight, height; - for (uint32 i = 0; i < polyPathSize; ++i) - { - if (DT_SUCCESS != _navMeshQuery->getPolyHeight(polyPath[i], point, &polyHeight)) - continue; - height = point[1]-polyHeight; - if (height > 0.0f && height < ALLOWED_DIST_FROM_POLY+ADDED_Z_FOR_POLY_LOOKUP) - { - if (distance) - *distance = height; - return polyPath[i]; - } - } + float polyHeight, height; + for (uint32 i = 0; i < polyPathSize; ++i) + { + if (DT_SUCCESS != _navMeshQuery->getPolyHeight(polyPath[i], point, &polyHeight)) + continue; + height = point[1]-polyHeight; + if (height > 0.0f && height < ALLOWED_DIST_FROM_POLY+ADDED_Z_FOR_POLY_LOOKUP) + { + if (distance) + *distance = height; + return polyPath[i]; + } + } - return INVALID_POLYREF; + return INVALID_POLYREF; } dtPolyRef PathGenerator::GetPolyByLocation(float* point, float* distance) const { - // first we check the current path - // if the current path doesn't contain the current poly, - // we need to use the expensive navMesh.findNearestPoly + // first we check the current path + // if the current path doesn't contain the current poly, + // we need to use the expensive navMesh.findNearestPoly - point[1] += ADDED_Z_FOR_POLY_LOOKUP; - dtPolyRef polyRef = GetPathPolyByPosition(_pathPolyRefs, _polyLength, point, distance); - point[1] -= ADDED_Z_FOR_POLY_LOOKUP; - if (polyRef != INVALID_POLYREF) - return polyRef; + point[1] += ADDED_Z_FOR_POLY_LOOKUP; + dtPolyRef polyRef = GetPathPolyByPosition(_pathPolyRefs, _polyLength, point, distance); + point[1] -= ADDED_Z_FOR_POLY_LOOKUP; + if (polyRef != INVALID_POLYREF) + return polyRef; - // we don't have it in our old path - // try to get it by findNearestPoly() - // first try with low search box - float extents[VERTEX_SIZE] = {3.0f, 5.0f, 3.0f}; // bounds of poly search area - float closestPoint[VERTEX_SIZE] = {0.0f, 0.0f, 0.0f}; - dtStatus result = _navMeshQuery->findNearestPoly(point, extents, &_filter, &polyRef, closestPoint); - if (DT_SUCCESS == result && polyRef != INVALID_POLYREF) - { - *distance = dtVdist(closestPoint, point); - return polyRef; - } + // we don't have it in our old path + // try to get it by findNearestPoly() + // first try with low search box + float extents[VERTEX_SIZE] = {3.0f, 5.0f, 3.0f}; // bounds of poly search area + float closestPoint[VERTEX_SIZE] = {0.0f, 0.0f, 0.0f}; + dtStatus result = _navMeshQuery->findNearestPoly(point, extents, &_filter, &polyRef, closestPoint); + if (DT_SUCCESS == result && polyRef != INVALID_POLYREF) + { + *distance = dtVdist(closestPoint, point); + return polyRef; + } - // still nothing .. - // try with bigger search box - extents[1] = 80.0f; - result = _navMeshQuery->findNearestPoly(point, extents, &_filter, &polyRef, closestPoint); - if (DT_SUCCESS == result && polyRef != INVALID_POLYREF) - { - *distance = dtVdist(closestPoint, point); - return polyRef; - } + // still nothing .. + // try with bigger search box + extents[1] = 80.0f; + result = _navMeshQuery->findNearestPoly(point, extents, &_filter, &polyRef, closestPoint); + if (DT_SUCCESS == result && polyRef != INVALID_POLYREF) + { + *distance = dtVdist(closestPoint, point); + return polyRef; + } - return INVALID_POLYREF; + return INVALID_POLYREF; } G3D::Vector3 ClosestPointOnLine(const G3D::Vector3 & a, const G3D::Vector3 & b, const G3D::Vector3 & Point) { - G3D::Vector3 c = Point - a; // Vector from a to Point - G3D::Vector3 v = (b - a).unit(); // Unit Vector from a to b - float d = (b - a).length(); // Length of the line segment - float t = v.dot(c); // Intersection point Distance from a + G3D::Vector3 c = Point - a; // Vector from a to Point + G3D::Vector3 v = (b - a).unit(); // Unit Vector from a to b + float d = (b - a).length(); // Length of the line segment + float t = v.dot(c); // Intersection point Distance from a - // Check to see if the point is on the line - // if not then return the endpoint - if(t < 0) return a; - if(t > d) return b; + // Check to see if the point is on the line + // if not then return the endpoint + if(t < 0) return a; + if(t > d) return b; - // get the distance to move from point a - v *= t; + // get the distance to move from point a + v *= t; - // move from point a to the nearest point on the segment - return a + v; + // move from point a to the nearest point on the segment + return a + v; } template class MutexReleaser { public: - MutexReleaser(MUTEX_TYPE& mutex) : _mutex(mutex) {} - ~MutexReleaser() { _mutex.release(); } + MutexReleaser(MUTEX_TYPE& mutex) : _mutex(mutex) {} + ~MutexReleaser() { _mutex.release(); } private: - MUTEX_TYPE& _mutex; + MUTEX_TYPE& _mutex; }; void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 const& endPos, ACE_RW_Thread_Mutex& mmapLock) { - bool endInWaterFar = false; - bool cutToFirstHigher = false; + bool endInWaterFar = false; + bool cutToFirstHigher = false; - { - MutexReleaser mutexReleaser(mmapLock); + { + MutexReleaser mutexReleaser(mmapLock); - // *** getting start/end poly logic *** + // *** getting start/end poly logic *** - float distToStartPoly, distToEndPoly; - float startPoint[VERTEX_SIZE] = {startPos.y, startPos.z, startPos.x}; - float endPoint[VERTEX_SIZE] = {endPos.y, endPos.z, endPos.x}; + float distToStartPoly, distToEndPoly; + float startPoint[VERTEX_SIZE] = {startPos.y, startPos.z, startPos.x}; + float endPoint[VERTEX_SIZE] = {endPos.y, endPos.z, endPos.x}; - dtPolyRef startPoly = GetPolyByLocation(startPoint, &distToStartPoly); - dtPolyRef endPoly = GetPolyByLocation(endPoint, &distToEndPoly); + dtPolyRef startPoly = GetPolyByLocation(startPoint, &distToStartPoly); + dtPolyRef endPoly = GetPolyByLocation(endPoint, &distToEndPoly); - bool sourceIsFlying = (_sourceUnit->GetUnitMovementFlags() & (MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_FLYING)) || (_sourceUnit->HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY) && !_sourceUnit->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING)) || (_sourceUnit->GetTypeId() == TYPEID_UNIT && ((Creature*)_sourceUnit)->CanFly()); - bool sourceCanSwim = _sourceUnit->GetTypeId() == TYPEID_UNIT ? _sourceUnit->ToCreature()->CanSwim() : true; - bool sourceCanWalk = _sourceUnit->GetTypeId() == TYPEID_UNIT ? _sourceUnit->ToCreature()->CanWalk() : true; + bool sourceIsFlying = (_sourceUnit->GetUnitMovementFlags() & (MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_FLYING)) || (_sourceUnit->HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY) && !_sourceUnit->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING)) || (_sourceUnit->GetTypeId() == TYPEID_UNIT && ((Creature*)_sourceUnit)->CanFly()); + bool sourceCanSwim = _sourceUnit->GetTypeId() == TYPEID_UNIT ? _sourceUnit->ToCreature()->CanSwim() : true; + bool sourceCanWalk = _sourceUnit->GetTypeId() == TYPEID_UNIT ? _sourceUnit->ToCreature()->CanWalk() : true; - // we have a hole in our mesh - // make shortcut path and mark it as NOPATH ( with flying and swimming exception ) - // its up to caller how he will use this info - if (startPoly == INVALID_POLYREF || endPoly == INVALID_POLYREF) - { - BuildShortcut(); - if (sourceIsFlying) - { - _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); - return; - } - if (sourceCanSwim) - { - if (startPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL) || - endPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) - { - _type = PATHFIND_NOPATH; - return; - } - _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); - return; - } - _type = PATHFIND_NOPATH; - return; - } + // we have a hole in our mesh + // make shortcut path and mark it as NOPATH ( with flying and swimming exception ) + // its up to caller how he will use this info + if (startPoly == INVALID_POLYREF || endPoly == INVALID_POLYREF) + { + BuildShortcut(); + if (sourceIsFlying) + { + _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); + return; + } + if (sourceCanSwim) + { + if (startPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL) || + endPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) + { + _type = PATHFIND_NOPATH; + return; + } + _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); + return; + } + _type = PATHFIND_NOPATH; + return; + } - // we may need a better number here - bool farFromStartPoly = (distToStartPoly > ALLOWED_DIST_FROM_POLY); - bool farFromEndPoly = (distToEndPoly > ALLOWED_DIST_FROM_POLY); - if (farFromStartPoly) - { - if (sourceIsFlying) - { - BuildShortcut(); - _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); - return; - } - if (sourceCanSwim) - { - if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL)) - { - if (distToStartPoly > MAX_FIXABLE_Z_ERROR) - { - BuildShortcut(); - _type = PATHFIND_NOPATH; - return; - } + // we may need a better number here + bool farFromStartPoly = (distToStartPoly > ALLOWED_DIST_FROM_POLY); + bool farFromEndPoly = (distToEndPoly > ALLOWED_DIST_FROM_POLY); + if (farFromStartPoly) + { + if (sourceIsFlying) + { + BuildShortcut(); + _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); + return; + } + if (sourceCanSwim) + { + if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL)) + { + if (distToStartPoly > MAX_FIXABLE_Z_ERROR) + { + BuildShortcut(); + _type = PATHFIND_NOPATH; + return; + } - if (farFromEndPoly) - { - if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) - { - BuildShortcut(); - _type = PATHFIND_NOPATH; - return; - } - } - } - else if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) - { - if (farFromEndPoly) - { - BuildShortcut(); - _type = PATHFIND_NOPATH; - return; - } + if (farFromEndPoly) + { + if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) + { + BuildShortcut(); + _type = PATHFIND_NOPATH; + return; + } + } + } + else if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) + { + if (farFromEndPoly) + { + BuildShortcut(); + _type = PATHFIND_NOPATH; + return; + } - cutToFirstHigher = true; - } - else // starting and ending points are in water - { - BuildShortcut(); - _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); - return; - } - } - else - { - if (distToStartPoly > MAX_FIXABLE_Z_ERROR || farFromEndPoly) - { - BuildShortcut(); - _type = PATHFIND_NOPATH; - return; - } - } - } - else if (farFromEndPoly) - { - if (sourceIsFlying) - { - BuildShortcut(); - _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); - return; - } - if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) - { - if (!sourceCanWalk) - { - BuildShortcut(); - _type = PATHFIND_NOPATH; - return; - } - } - else - { - if (!sourceCanSwim) - { - BuildShortcut(); - _type = PATHFIND_NOPATH; - return; - } + cutToFirstHigher = true; + } + else // starting and ending points are in water + { + BuildShortcut(); + _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); + return; + } + } + else + { + if (distToStartPoly > MAX_FIXABLE_Z_ERROR || farFromEndPoly) + { + BuildShortcut(); + _type = PATHFIND_NOPATH; + return; + } + } + } + else if (farFromEndPoly) + { + if (sourceIsFlying) + { + BuildShortcut(); + _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); + return; + } + if (LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) + { + if (!sourceCanWalk) + { + BuildShortcut(); + _type = PATHFIND_NOPATH; + return; + } + } + else + { + if (!sourceCanSwim) + { + BuildShortcut(); + _type = PATHFIND_NOPATH; + return; + } - // if both points are in water - if (LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL)) - { - BuildShortcut(); - _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); - return; - } + // if both points are in water + if (LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL)) + { + BuildShortcut(); + _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); + return; + } - endInWaterFar = true; - } + endInWaterFar = true; + } - if (startPoly != endPoly || !endInWaterFar) - { - float closestPoint[VERTEX_SIZE]; - if (DT_SUCCESS == _navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint)) - { - dtVcopy(endPoint, closestPoint); - SetActualEndPosition(G3D::Vector3(endPoint[2], endPoint[0], endPoint[1])); - } - _type = PATHFIND_INCOMPLETE; - } - } + if (startPoly != endPoly || !endInWaterFar) + { + float closestPoint[VERTEX_SIZE]; + if (DT_SUCCESS == _navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint)) + { + dtVcopy(endPoint, closestPoint); + SetActualEndPosition(G3D::Vector3(endPoint[2], endPoint[0], endPoint[1])); + } + _type = PATHFIND_INCOMPLETE; + } + } - // *** poly path generating logic *** + // *** poly path generating logic *** - if (startPoly == endPoly) - { - BuildShortcut(); - _type = !farFromEndPoly || endInWaterFar ? PATHFIND_NORMAL : PATHFIND_INCOMPLETE; - _pathPolyRefs[0] = startPoly; - _polyLength = 1; - return; - } + if (startPoly == endPoly) + { + BuildShortcut(); + _type = !farFromEndPoly || endInWaterFar ? PATHFIND_NORMAL : PATHFIND_INCOMPLETE; + _pathPolyRefs[0] = startPoly; + _polyLength = 1; + return; + } - // look for startPoly/endPoly in current path - /// @todo we can merge it with getPathPolyByPosition() loop - bool startPolyFound = false; - bool endPolyFound = false; - uint32 pathStartIndex = 0; - uint32 pathEndIndex = 0; + // look for startPoly/endPoly in current path + /// @todo we can merge it with getPathPolyByPosition() loop + bool startPolyFound = false; + bool endPolyFound = false; + uint32 pathStartIndex = 0; + uint32 pathEndIndex = 0; - if (_polyLength) - { - for (; pathStartIndex < _polyLength; ++pathStartIndex) - { - // here to catch few bugs - ASSERT(_pathPolyRefs[pathStartIndex] != INVALID_POLYREF); + if (_polyLength) + { + for (; pathStartIndex < _polyLength; ++pathStartIndex) + { + // here to catch few bugs + ASSERT(_pathPolyRefs[pathStartIndex] != INVALID_POLYREF); - if (_pathPolyRefs[pathStartIndex] == startPoly) - { - startPolyFound = true; - break; - } - } + if (_pathPolyRefs[pathStartIndex] == startPoly) + { + startPolyFound = true; + break; + } + } - for (pathEndIndex = _polyLength-1; pathEndIndex > pathStartIndex; --pathEndIndex) - if (_pathPolyRefs[pathEndIndex] == endPoly) - { - endPolyFound = true; - break; - } - } + for (pathEndIndex = _polyLength-1; pathEndIndex > pathStartIndex; --pathEndIndex) + if (_pathPolyRefs[pathEndIndex] == endPoly) + { + endPolyFound = true; + break; + } + } - if (startPolyFound && endPolyFound) - { - _polyLength = pathEndIndex - pathStartIndex + 1; - memmove(_pathPolyRefs, _pathPolyRefs + pathStartIndex, _polyLength * sizeof(dtPolyRef)); - } - else if (startPolyFound && !endPolyFound && _polyLength-pathStartIndex >= 3 /*if (>=3) then 70% will return at least one more than just startPoly*/) - { - // we are moving on the old path but target moved out - // so we have atleast part of poly-path ready + if (startPolyFound && endPolyFound) + { + _polyLength = pathEndIndex - pathStartIndex + 1; + memmove(_pathPolyRefs, _pathPolyRefs + pathStartIndex, _polyLength * sizeof(dtPolyRef)); + } + else if (startPolyFound && !endPolyFound && _polyLength-pathStartIndex >= 3 /*if (>=3) then 70% will return at least one more than just startPoly*/) + { + // we are moving on the old path but target moved out + // so we have atleast part of poly-path ready - _polyLength -= pathStartIndex; + _polyLength -= pathStartIndex; - // try to adjust the suffix of the path instead of recalculating entire length - // at given interval the target cannot get too far from its last location - // thus we have less poly to cover - // sub-path of optimal path is optimal + // try to adjust the suffix of the path instead of recalculating entire length + // at given interval the target cannot get too far from its last location + // thus we have less poly to cover + // sub-path of optimal path is optimal - // take ~65% of the original length - /// @todo play with the values here - uint32 prefixPolyLength = uint32(_polyLength * 0.7f + 0.5f); // this should be always >= 1 - memmove(_pathPolyRefs, _pathPolyRefs+pathStartIndex, prefixPolyLength * sizeof(dtPolyRef)); + // take ~65% of the original length + /// @todo play with the values here + uint32 prefixPolyLength = uint32(_polyLength * 0.7f + 0.5f); // this should be always >= 1 + memmove(_pathPolyRefs, _pathPolyRefs+pathStartIndex, prefixPolyLength * sizeof(dtPolyRef)); - dtPolyRef suffixStartPoly = _pathPolyRefs[prefixPolyLength-1]; + dtPolyRef suffixStartPoly = _pathPolyRefs[prefixPolyLength-1]; - bool error = false; // can't use a part of old path, generate whole new + bool error = false; // can't use a part of old path, generate whole new - // we need any point on our suffix start poly to generate poly-path, so we need last poly in prefix data - float suffixEndPoint[VERTEX_SIZE]; - if (DT_SUCCESS != _navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint)) - { - // we can hit offmesh connection as last poly - closestPointOnPoly() don't like that - // try to recover by using prev polyref - --prefixPolyLength; - if (prefixPolyLength) - { - suffixStartPoly = _pathPolyRefs[prefixPolyLength-1]; - if (DT_SUCCESS != _navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint)) - error = true; - } - else - error = true; - } + // we need any point on our suffix start poly to generate poly-path, so we need last poly in prefix data + float suffixEndPoint[VERTEX_SIZE]; + if (DT_SUCCESS != _navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint)) + { + // we can hit offmesh connection as last poly - closestPointOnPoly() don't like that + // try to recover by using prev polyref + --prefixPolyLength; + if (prefixPolyLength) + { + suffixStartPoly = _pathPolyRefs[prefixPolyLength-1]; + if (DT_SUCCESS != _navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint)) + error = true; + } + else + error = true; + } - if (!error) - { - // generate suffix - uint32 suffixPolyLength = 0; - dtStatus dtResult = _navMeshQuery->findPath( - suffixStartPoly, // start polygon - endPoly, // end polygon - suffixEndPoint, // start position - endPoint, // end position - &_filter, // polygon search filter - _pathPolyRefs + prefixPolyLength - 1, // [out] path - (int*)&suffixPolyLength, - MAX_PATH_LENGTH-prefixPolyLength); // max number of polygons in output path + if (!error) + { + // generate suffix + uint32 suffixPolyLength = 0; + dtStatus dtResult = _navMeshQuery->findPath( + suffixStartPoly, // start polygon + endPoly, // end polygon + suffixEndPoint, // start position + endPoint, // end position + &_filter, // polygon search filter + _pathPolyRefs + prefixPolyLength - 1, // [out] path + (int*)&suffixPolyLength, + MAX_PATH_LENGTH-prefixPolyLength); // max number of polygons in output path - if (!suffixPolyLength || dtResult != DT_SUCCESS) - { - // this is probably an error state, but we'll leave it - // and hopefully recover on the next Update - // we still need to copy our preffix - } + if (!suffixPolyLength || dtResult != DT_SUCCESS) + { + // this is probably an error state, but we'll leave it + // and hopefully recover on the next Update + // we still need to copy our preffix + } - // new path = prefix + suffix - overlap - _polyLength = prefixPolyLength + suffixPolyLength - 1; - } - else - { - // free and invalidate old path data - Clear(); + // new path = prefix + suffix - overlap + _polyLength = prefixPolyLength + suffixPolyLength - 1; + } + else + { + // free and invalidate old path data + Clear(); - dtStatus dtResult = _navMeshQuery->findPath( - startPoly, // start polygon - endPoly, // end polygon - startPoint, // start position - endPoint, // end position - &_filter, // polygon search filter - _pathPolyRefs, // [out] path - (int*)&_polyLength, - MAX_PATH_LENGTH); // max number of polygons in output path + dtStatus dtResult = _navMeshQuery->findPath( + startPoly, // start polygon + endPoly, // end polygon + startPoint, // start position + endPoint, // end position + &_filter, // polygon search filter + _pathPolyRefs, // [out] path + (int*)&_polyLength, + MAX_PATH_LENGTH); // max number of polygons in output path - if (!_polyLength || dtResult != DT_SUCCESS) - { - // only happens if we passed bad data to findPath(), or navmesh is messed up - BuildShortcut(); - _type = PATHFIND_NOPATH; - return; - } - } - } - else - { - // either we have no path at all -> first run - // or something went really wrong -> we aren't moving along the path to the target - // pussywizard: or knocked back away from our path, nothing special - // just generate new path + if (!_polyLength || dtResult != DT_SUCCESS) + { + // only happens if we passed bad data to findPath(), or navmesh is messed up + BuildShortcut(); + _type = PATHFIND_NOPATH; + return; + } + } + } + else + { + // either we have no path at all -> first run + // or something went really wrong -> we aren't moving along the path to the target + // pussywizard: or knocked back away from our path, nothing special + // just generate new path - // free and invalidate old path data - Clear(); + // free and invalidate old path data + Clear(); - dtStatus dtResult = _navMeshQuery->findPath( - startPoly, // start polygon - endPoly, // end polygon - startPoint, // start position - endPoint, // end position - &_filter, // polygon search filter - _pathPolyRefs, // [out] path - (int*)&_polyLength, - MAX_PATH_LENGTH); // max number of polygons in output path + dtStatus dtResult = _navMeshQuery->findPath( + startPoly, // start polygon + endPoly, // end polygon + startPoint, // start position + endPoint, // end position + &_filter, // polygon search filter + _pathPolyRefs, // [out] path + (int*)&_polyLength, + MAX_PATH_LENGTH); // max number of polygons in output path - if (!_polyLength || dtResult != DT_SUCCESS) - { - // only happens if we passed bad data to findPath(), or navmesh is messed up - BuildShortcut(); - _type = PATHFIND_NOPATH; - return; - } - } + if (!_polyLength || dtResult != DT_SUCCESS) + { + // only happens if we passed bad data to findPath(), or navmesh is messed up + BuildShortcut(); + _type = PATHFIND_NOPATH; + return; + } + } - // by now we know what type of path we can get - if (_pathPolyRefs[_polyLength - 1] == endPoly && !(_type & PATHFIND_INCOMPLETE)) - _type = PATHFIND_NORMAL; - else - _type = PATHFIND_INCOMPLETE; + // by now we know what type of path we can get + if (_pathPolyRefs[_polyLength - 1] == endPoly && !(_type & PATHFIND_INCOMPLETE)) + _type = PATHFIND_NORMAL; + else + _type = PATHFIND_INCOMPLETE; - // generate the point-path out of our up-to-date poly-path - BuildPointPath(startPoint, endPoint); + // generate the point-path out of our up-to-date poly-path + BuildPointPath(startPoint, endPoint); - // pussywizard: no mmap usage below, release mutex - } // end of scope (mutex released in object destructor) + // pussywizard: no mmap usage below, release mutex + } // end of scope (mutex released in object destructor) - if (_type == PATHFIND_NORMAL && cutToFirstHigher) // starting in water, far from bottom, target is on the ground (above starting Z) -> update beginning points that are lower than starting Z - { - uint32 i = 0; - uint32 size = _pathPoints.size(); - for (; i < size; ++i) - if (_pathPoints[i].z >= _sourceUnit->GetPositionZ()+0.1f) - break; - if (i && i != size && LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(_pathPoints[i-1].x, _pathPoints[i-1].y, _pathPoints[i-1].z, MAP_ALL_LIQUIDS, NULL)) - for (uint32 j=0; jGetPositionZ(); - } + if (_type == PATHFIND_NORMAL && cutToFirstHigher) // starting in water, far from bottom, target is on the ground (above starting Z) -> update beginning points that are lower than starting Z + { + uint32 i = 0; + uint32 size = _pathPoints.size(); + for (; i < size; ++i) + if (_pathPoints[i].z >= _sourceUnit->GetPositionZ()+0.1f) + break; + if (i && i != size && LIQUID_MAP_NO_WATER != _sourceUnit->GetBaseMap()->getLiquidStatus(_pathPoints[i-1].x, _pathPoints[i-1].y, _pathPoints[i-1].z, MAP_ALL_LIQUIDS, NULL)) + for (uint32 j=0; jGetPositionZ(); + } - if (!_forceDestination) - if (uint32 lastIdx = _pathPoints.size()) - { - lastIdx = lastIdx-1; - if (endInWaterFar) - { - SetActualEndPosition(GetEndPosition()); - _pathPoints[lastIdx] = GetEndPosition(); - } - else - _sourceUnit->UpdateAllowedPositionZ(_pathPoints[lastIdx].x, _pathPoints[lastIdx].y, _pathPoints[lastIdx].z); - } + if (!_forceDestination) + if (uint32 lastIdx = _pathPoints.size()) + { + lastIdx = lastIdx-1; + if (endInWaterFar) + { + SetActualEndPosition(GetEndPosition()); + _pathPoints[lastIdx] = GetEndPosition(); + } + else + _sourceUnit->UpdateAllowedPositionZ(_pathPoints[lastIdx].x, _pathPoints[lastIdx].y, _pathPoints[lastIdx].z); + } - // pussywizard: fix for running back and forth while target moves - // pussywizard: second point (first is actual position) is forward to current server position, but when received by the client it's already behind, so the npc runs back to that point - // pussywizard: the higher speed, the more probable the situation is, so try to move second point as far forward the path as possible - // pussywizard: changed path cannot differ much from the original (by max dist), because there might be walls and holes - if (_sourceUnit->GetCreatureType() != CREATURE_TYPE_NON_COMBAT_PET) - return; - uint32 size = _pathPoints.size(); - bool ok = true; - for (uint32 i = 2; i <= size; ++i) - { - // pussywizard: line between start point and i'th point - // pussywizard: distance to that line of all points between 0 and i must be less than X and less than sourceUnit size + // pussywizard: fix for running back and forth while target moves + // pussywizard: second point (first is actual position) is forward to current server position, but when received by the client it's already behind, so the npc runs back to that point + // pussywizard: the higher speed, the more probable the situation is, so try to move second point as far forward the path as possible + // pussywizard: changed path cannot differ much from the original (by max dist), because there might be walls and holes + if (_sourceUnit->GetCreatureType() != CREATURE_TYPE_NON_COMBAT_PET) + return; + uint32 size = _pathPoints.size(); + bool ok = true; + for (uint32 i = 2; i <= size; ++i) + { + // pussywizard: line between start point and i'th point + // pussywizard: distance to that line of all points between 0 and i must be less than X and less than sourceUnit size - if (i < size) - { - ok = true; - if ((_pathPoints[i] - _pathPoints[0]).squaredLength() > 15.0f*15.0f) - ok = false; - else - for (uint32 j = 1; j < i; ++j) - { - float sqDist = (_pathPoints[j] - ClosestPointOnLine(_pathPoints[0], _pathPoints[i], _pathPoints[j])).squaredLength(); - float oSize = _sourceUnit->GetObjectSize(); - if (sqDist > 1.0f*1.0f || sqDist > oSize*oSize) - { - ok = false; - break; - } - } - } + if (i < size) + { + ok = true; + if ((_pathPoints[i] - _pathPoints[0]).squaredLength() > 15.0f*15.0f) + ok = false; + else + for (uint32 j = 1; j < i; ++j) + { + float sqDist = (_pathPoints[j] - ClosestPointOnLine(_pathPoints[0], _pathPoints[i], _pathPoints[j])).squaredLength(); + float oSize = _sourceUnit->GetObjectSize(); + if (sqDist > 1.0f*1.0f || sqDist > oSize*oSize) + { + ok = false; + break; + } + } + } - if (!ok) - { - if (i < size) - { - // pussywizard: check additional 3 quarter points after last fitting poly point + if (!ok) + { + if (i < size) + { + // pussywizard: check additional 3 quarter points after last fitting poly point - G3D::Vector3 dir = _pathPoints[i] - _pathPoints[i-1]; - G3D::Vector3 increment = (dir.length()/4.0f) * dir.unit(); - for (uint8 k = 3; k > 0; --k) - { - G3D::Vector3 newPoint = _pathPoints[i-1] + ((float)k)*increment; + G3D::Vector3 dir = _pathPoints[i] - _pathPoints[i-1]; + G3D::Vector3 increment = (dir.length()/4.0f) * dir.unit(); + for (uint8 k = 3; k > 0; --k) + { + G3D::Vector3 newPoint = _pathPoints[i-1] + ((float)k)*increment; - bool ok2 = true; - if ((newPoint - _pathPoints[0]).squaredLength() > 15.0f*15.0f) - ok2 = false; - else - for (uint32 j = 1; j < i; ++j) - { - float sqDist = (_pathPoints[j] - ClosestPointOnLine(_pathPoints[0], newPoint, _pathPoints[j])).squaredLength(); - float oSize = _sourceUnit->GetObjectSize(); - if (sqDist > 1.0f*1.0f || sqDist > oSize*oSize) - { - ok2 = false; - break; - } - } + bool ok2 = true; + if ((newPoint - _pathPoints[0]).squaredLength() > 15.0f*15.0f) + ok2 = false; + else + for (uint32 j = 1; j < i; ++j) + { + float sqDist = (_pathPoints[j] - ClosestPointOnLine(_pathPoints[0], newPoint, _pathPoints[j])).squaredLength(); + float oSize = _sourceUnit->GetObjectSize(); + if (sqDist > 1.0f*1.0f || sqDist > oSize*oSize) + { + ok2 = false; + break; + } + } - if (ok2) - { - _pathPoints[i-1] = newPoint; - break; - } - } + if (ok2) + { + _pathPoints[i-1] = newPoint; + break; + } + } - // pussywizard: memmove crashes o_O - // memmove(&_pathPoints + sizeof(G3D::Vector3), &_pathPoints + (i-1)*sizeof(G3D::Vector3), (size-i+1)*sizeof(G3D::Vector3)); - for (uint8 k = 1; k <= size-i+1; ++k) - _pathPoints[k] = _pathPoints[k+i-2]; - _pathPoints.resize(size-i+2); - } - else if (size > 2) - { - _pathPoints[1] = _pathPoints[size-1]; - _pathPoints.resize(2); - } + // pussywizard: memmove crashes o_O + // memmove(&_pathPoints + sizeof(G3D::Vector3), &_pathPoints + (i-1)*sizeof(G3D::Vector3), (size-i+1)*sizeof(G3D::Vector3)); + for (uint8 k = 1; k <= size-i+1; ++k) + _pathPoints[k] = _pathPoints[k+i-2]; + _pathPoints.resize(size-i+2); + } + else if (size > 2) + { + _pathPoints[1] = _pathPoints[size-1]; + _pathPoints.resize(2); + } - break; - } - } + break; + } + } } void PathGenerator::BuildPointPath(const float *startPoint, const float *endPoint) { - float pathPoints[MAX_POINT_PATH_LENGTH*VERTEX_SIZE]; - uint32 pointCount = 0; - dtStatus dtResult = DT_FAILURE; - if (_useStraightPath) - { - dtResult = _navMeshQuery->findStraightPath( - startPoint, // start position - endPoint, // end position - _pathPolyRefs, // current path - _polyLength, // lenth of current path - pathPoints, // [out] path corner points - NULL, // [out] flags - NULL, // [out] shortened path - (int*)&pointCount, - _pointPathLimit); // maximum number of points/polygons to use - } - else - { - dtResult = FindSmoothPath( - startPoint, // start position - endPoint, // end position - _pathPolyRefs, // current path - _polyLength, // length of current path - pathPoints, // [out] path corner points - (int*)&pointCount, - _pointPathLimit); // maximum number of points - } + float pathPoints[MAX_POINT_PATH_LENGTH*VERTEX_SIZE]; + uint32 pointCount = 0; + dtStatus dtResult = DT_FAILURE; + if (_useStraightPath) + { + dtResult = _navMeshQuery->findStraightPath( + startPoint, // start position + endPoint, // end position + _pathPolyRefs, // current path + _polyLength, // lenth of current path + pathPoints, // [out] path corner points + NULL, // [out] flags + NULL, // [out] shortened path + (int*)&pointCount, + _pointPathLimit); // maximum number of points/polygons to use + } + else + { + dtResult = FindSmoothPath( + startPoint, // start position + endPoint, // end position + _pathPolyRefs, // current path + _polyLength, // length of current path + pathPoints, // [out] path corner points + (int*)&pointCount, + _pointPathLimit); // maximum number of points + } - if (pointCount < 2 || dtResult != DT_SUCCESS) - { - // only happens if pass bad data to findStraightPath or navmesh is broken - // single point paths can be generated here - /// @todo check the exact cases - BuildShortcut(); - _type = PATHFIND_NOPATH; - return; - } - else if (pointCount == _pointPathLimit) - { - BuildShortcut(); - _type = PATHFIND_SHORT; - return; - } + if (pointCount < 2 || dtResult != DT_SUCCESS) + { + // only happens if pass bad data to findStraightPath or navmesh is broken + // single point paths can be generated here + /// @todo check the exact cases + BuildShortcut(); + _type = PATHFIND_NOPATH; + return; + } + else if (pointCount == _pointPathLimit) + { + BuildShortcut(); + _type = PATHFIND_SHORT; + return; + } - _pathPoints.resize(pointCount); - for (uint32 i = 0; i < pointCount; ++i) - _pathPoints[i] = G3D::Vector3(pathPoints[i*VERTEX_SIZE+2], pathPoints[i*VERTEX_SIZE], pathPoints[i*VERTEX_SIZE+1]); + _pathPoints.resize(pointCount); + for (uint32 i = 0; i < pointCount; ++i) + _pathPoints[i] = G3D::Vector3(pathPoints[i*VERTEX_SIZE+2], pathPoints[i*VERTEX_SIZE], pathPoints[i*VERTEX_SIZE+1]); - // first point is always our current location - we need the next one - SetActualEndPosition(_pathPoints[pointCount-1]); + // first point is always our current location - we need the next one + SetActualEndPosition(_pathPoints[pointCount-1]); - if (_forceDestination && (!(_type & PATHFIND_NORMAL) || !InRange(GetEndPosition(), GetActualEndPosition(), 0.75f, 0.75f))) - { - // we may want to keep partial subpath - if (Dist3DSqr(GetActualEndPosition(), GetEndPosition()) < 0.33f * Dist3DSqr(GetStartPosition(), GetEndPosition())) - { - SetActualEndPosition(GetEndPosition()); - _pathPoints[_pathPoints.size()-1] = GetEndPosition(); - } - else - { - SetActualEndPosition(GetEndPosition()); - BuildShortcut(); - } + if (_forceDestination && (!(_type & PATHFIND_NORMAL) || !InRange(GetEndPosition(), GetActualEndPosition(), 0.75f, 0.75f))) + { + // we may want to keep partial subpath + if (Dist3DSqr(GetActualEndPosition(), GetEndPosition()) < 0.33f * Dist3DSqr(GetStartPosition(), GetEndPosition())) + { + SetActualEndPosition(GetEndPosition()); + _pathPoints[_pathPoints.size()-1] = GetEndPosition(); + } + else + { + SetActualEndPosition(GetEndPosition()); + BuildShortcut(); + } - _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); - } + _type = PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH); + } } void PathGenerator::BuildShortcut() { - Clear(); - _pathPoints.resize(2); - _pathPoints[0] = GetStartPosition(); - _pathPoints[1] = GetActualEndPosition(); - _type = PATHFIND_SHORTCUT; + Clear(); + _pathPoints.resize(2); + _pathPoints[0] = GetStartPosition(); + _pathPoints[1] = GetActualEndPosition(); + _type = PATHFIND_SHORTCUT; } void PathGenerator::CreateFilter() { - uint16 includeFlags = 0; - uint16 excludeFlags = 0; + uint16 includeFlags = 0; + uint16 excludeFlags = 0; - if (_sourceUnit->GetTypeId() == TYPEID_UNIT) - { - Creature* creature = (Creature*)_sourceUnit; - if (creature->CanWalk()) - includeFlags |= NAV_GROUND; // walk + if (_sourceUnit->GetTypeId() == TYPEID_UNIT) + { + Creature* creature = (Creature*)_sourceUnit; + if (creature->CanWalk()) + includeFlags |= NAV_GROUND; // walk - // creatures don't take environmental damage - if (creature->CanSwim()) - includeFlags |= (NAV_WATER | NAV_MAGMA | NAV_SLIME); // swim - } - else // assume Player - { - // perfect support not possible, just stay 'safe' - includeFlags |= (NAV_GROUND | NAV_WATER | NAV_MAGMA | NAV_SLIME); - } + // creatures don't take environmental damage + if (creature->CanSwim()) + includeFlags |= (NAV_WATER | NAV_MAGMA | NAV_SLIME); // swim + } + else // assume Player + { + // perfect support not possible, just stay 'safe' + includeFlags |= (NAV_GROUND | NAV_WATER | NAV_MAGMA | NAV_SLIME); + } - _filter.setIncludeFlags(includeFlags); - _filter.setExcludeFlags(excludeFlags); + _filter.setIncludeFlags(includeFlags); + _filter.setExcludeFlags(excludeFlags); - UpdateFilter(); + UpdateFilter(); } void PathGenerator::UpdateFilter() { - // allow creatures to cheat and use different movement types if they are moved - // forcefully into terrain they can't normally move in - if (_sourceUnit->IsInWater() || _sourceUnit->IsUnderWater()) - { - uint16 includedFlags = _filter.getIncludeFlags(); - includedFlags |= GetNavTerrain(_sourceUnit->GetPositionX(), - _sourceUnit->GetPositionY(), - _sourceUnit->GetPositionZ()); + // allow creatures to cheat and use different movement types if they are moved + // forcefully into terrain they can't normally move in + if (_sourceUnit->IsInWater() || _sourceUnit->IsUnderWater()) + { + uint16 includedFlags = _filter.getIncludeFlags(); + includedFlags |= GetNavTerrain(_sourceUnit->GetPositionX(), + _sourceUnit->GetPositionY(), + _sourceUnit->GetPositionZ()); - _filter.setIncludeFlags(includedFlags); - } + _filter.setIncludeFlags(includedFlags); + } } NavTerrain PathGenerator::GetNavTerrain(float x, float y, float z) { - LiquidData data; - ZLiquidStatus liquidStatus = _sourceUnit->GetBaseMap()->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &data); - if (liquidStatus == LIQUID_MAP_NO_WATER) - return NAV_GROUND; + LiquidData data; + ZLiquidStatus liquidStatus = _sourceUnit->GetBaseMap()->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &data); + if (liquidStatus == LIQUID_MAP_NO_WATER) + return NAV_GROUND; - switch (data.type_flags) - { - case MAP_LIQUID_TYPE_WATER: - case MAP_LIQUID_TYPE_OCEAN: - return NAV_WATER; - case MAP_LIQUID_TYPE_MAGMA: - return NAV_MAGMA; - case MAP_LIQUID_TYPE_SLIME: - return NAV_SLIME; - default: - return NAV_GROUND; - } + switch (data.type_flags) + { + case MAP_LIQUID_TYPE_WATER: + case MAP_LIQUID_TYPE_OCEAN: + return NAV_WATER; + case MAP_LIQUID_TYPE_MAGMA: + return NAV_MAGMA; + case MAP_LIQUID_TYPE_SLIME: + return NAV_SLIME; + default: + return NAV_GROUND; + } } bool PathGenerator::HaveTile(const G3D::Vector3& p) const { - int tx = -1, ty = -1; - float point[VERTEX_SIZE] = {p.y, p.z, p.x}; + int tx = -1, ty = -1; + float point[VERTEX_SIZE] = {p.y, p.z, p.x}; - _navMesh->calcTileLoc(point, &tx, &ty); + _navMesh->calcTileLoc(point, &tx, &ty); - /// Workaround - /// For some reason, often the tx and ty variables wont get a valid value - /// Use this check to prevent getting negative tile coords and crashing on getTileAt - if (tx < 0 || ty < 0) - return false; + /// Workaround + /// For some reason, often the tx and ty variables wont get a valid value + /// Use this check to prevent getting negative tile coords and crashing on getTileAt + if (tx < 0 || ty < 0) + return false; - return (_navMesh->getTileAt(tx, ty) != NULL); + return (_navMesh->getTileAt(tx, ty) != NULL); } uint32 PathGenerator::FixupCorridor(dtPolyRef* path, uint32 npath, uint32 maxPath, dtPolyRef const* visited, uint32 nvisited) { - int32 furthestPath = -1; - int32 furthestVisited = -1; + int32 furthestPath = -1; + int32 furthestVisited = -1; - // Find furthest common polygon. - for (int32 i = npath-1; i >= 0; --i) - { - bool found = false; - for (int32 j = nvisited-1; j >= 0; --j) - { - if (path[i] == visited[j]) - { - furthestPath = i; - furthestVisited = j; - found = true; - } - } - if (found) - break; - } + // Find furthest common polygon. + for (int32 i = npath-1; i >= 0; --i) + { + bool found = false; + for (int32 j = nvisited-1; j >= 0; --j) + { + if (path[i] == visited[j]) + { + furthestPath = i; + furthestVisited = j; + found = true; + } + } + if (found) + break; + } - // If no intersection found just return current path. - if (furthestPath == -1 || furthestVisited == -1) - return npath; + // If no intersection found just return current path. + if (furthestPath == -1 || furthestVisited == -1) + return npath; - // Concatenate paths. + // Concatenate paths. - // Adjust beginning of the buffer to include the visited. - uint32 req = nvisited - furthestVisited; - uint32 orig = uint32(furthestPath + 1) < npath ? furthestPath + 1 : npath; - uint32 size = npath > orig ? npath - orig : 0; - if (req + size > maxPath) - size = maxPath-req; + // Adjust beginning of the buffer to include the visited. + uint32 req = nvisited - furthestVisited; + uint32 orig = uint32(furthestPath + 1) < npath ? furthestPath + 1 : npath; + uint32 size = npath > orig ? npath - orig : 0; + if (req + size > maxPath) + size = maxPath-req; - if (size) - memmove(path + req, path + orig, size * sizeof(dtPolyRef)); + if (size) + memmove(path + req, path + orig, size * sizeof(dtPolyRef)); - // Store visited - for (uint32 i = 0; i < req; ++i) - path[i] = visited[(nvisited - 1) - i]; + // Store visited + for (uint32 i = 0; i < req; ++i) + path[i] = visited[(nvisited - 1) - i]; - return req+size; + return req+size; } bool PathGenerator::GetSteerTarget(float const* startPos, float const* endPos, - float minTargetDist, dtPolyRef const* path, uint32 pathSize, - float* steerPos, unsigned char& steerPosFlag, dtPolyRef& steerPosRef) + float minTargetDist, dtPolyRef const* path, uint32 pathSize, + float* steerPos, unsigned char& steerPosFlag, dtPolyRef& steerPosRef) { - // Find steer target. - static const uint32 MAX_STEER_POINTS = 3; - float steerPath[MAX_STEER_POINTS*VERTEX_SIZE]; - unsigned char steerPathFlags[MAX_STEER_POINTS]; - dtPolyRef steerPathPolys[MAX_STEER_POINTS]; - uint32 nsteerPath = 0; - dtStatus dtResult = _navMeshQuery->findStraightPath(startPos, endPos, path, pathSize, - steerPath, steerPathFlags, steerPathPolys, (int*)&nsteerPath, MAX_STEER_POINTS); - if (!nsteerPath || DT_SUCCESS != dtResult) - return false; + // Find steer target. + static const uint32 MAX_STEER_POINTS = 3; + float steerPath[MAX_STEER_POINTS*VERTEX_SIZE]; + unsigned char steerPathFlags[MAX_STEER_POINTS]; + dtPolyRef steerPathPolys[MAX_STEER_POINTS]; + uint32 nsteerPath = 0; + dtStatus dtResult = _navMeshQuery->findStraightPath(startPos, endPos, path, pathSize, + steerPath, steerPathFlags, steerPathPolys, (int*)&nsteerPath, MAX_STEER_POINTS); + if (!nsteerPath || DT_SUCCESS != dtResult) + return false; - // Find vertex far enough to steer to. - uint32 ns = 0; - while (ns < nsteerPath) - { - // Stop at Off-Mesh link or when point is further than slop away. - if ((steerPathFlags[ns] & DT_STRAIGHTPATH_OFFMESH_CONNECTION) || - !InRangeYZX(&steerPath[ns*VERTEX_SIZE], startPos, minTargetDist, 1000.0f)) - break; - ns++; - } - // Failed to find good point to steer to. - if (ns >= nsteerPath) - return false; + // Find vertex far enough to steer to. + uint32 ns = 0; + while (ns < nsteerPath) + { + // Stop at Off-Mesh link or when point is further than slop away. + if ((steerPathFlags[ns] & DT_STRAIGHTPATH_OFFMESH_CONNECTION) || + !InRangeYZX(&steerPath[ns*VERTEX_SIZE], startPos, minTargetDist, 1000.0f)) + break; + ns++; + } + // Failed to find good point to steer to. + if (ns >= nsteerPath) + return false; - dtVcopy(steerPos, &steerPath[ns*VERTEX_SIZE]); - steerPos[1] = startPos[1]; // keep Z value - steerPosFlag = steerPathFlags[ns]; - steerPosRef = steerPathPolys[ns]; + dtVcopy(steerPos, &steerPath[ns*VERTEX_SIZE]); + steerPos[1] = startPos[1]; // keep Z value + steerPosFlag = steerPathFlags[ns]; + steerPosRef = steerPathPolys[ns]; - return true; + return true; } dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPos, - dtPolyRef const* polyPath, uint32 polyPathSize, - float* smoothPath, int* smoothPathSize, uint32 maxSmoothPathSize) + dtPolyRef const* polyPath, uint32 polyPathSize, + float* smoothPath, int* smoothPathSize, uint32 maxSmoothPathSize) { - *smoothPathSize = 0; - uint32 nsmoothPath = 0; + *smoothPathSize = 0; + uint32 nsmoothPath = 0; - dtPolyRef polys[MAX_PATH_LENGTH]; - memcpy(polys, polyPath, sizeof(dtPolyRef)*polyPathSize); - uint32 npolys = polyPathSize; + dtPolyRef polys[MAX_PATH_LENGTH]; + memcpy(polys, polyPath, sizeof(dtPolyRef)*polyPathSize); + uint32 npolys = polyPathSize; - float iterPos[VERTEX_SIZE], targetPos[VERTEX_SIZE]; - if (DT_SUCCESS != _navMeshQuery->closestPointOnPolyBoundary(polys[0], startPos, iterPos)) - return DT_FAILURE; + float iterPos[VERTEX_SIZE], targetPos[VERTEX_SIZE]; + if (DT_SUCCESS != _navMeshQuery->closestPointOnPolyBoundary(polys[0], startPos, iterPos)) + return DT_FAILURE; - if (DT_SUCCESS != _navMeshQuery->closestPointOnPolyBoundary(polys[npolys-1], endPos, targetPos)) - return DT_FAILURE; + if (DT_SUCCESS != _navMeshQuery->closestPointOnPolyBoundary(polys[npolys-1], endPos, targetPos)) + return DT_FAILURE; - dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], iterPos); - nsmoothPath++; + dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], iterPos); + nsmoothPath++; - // Move towards target a small advancement at a time until target reached or - // when ran out of memory to store the path. - while (npolys && nsmoothPath < maxSmoothPathSize) - { - // Find location to steer towards. - float steerPos[VERTEX_SIZE]; - unsigned char steerPosFlag; - dtPolyRef steerPosRef = INVALID_POLYREF; + // Move towards target a small advancement at a time until target reached or + // when ran out of memory to store the path. + while (npolys && nsmoothPath < maxSmoothPathSize) + { + // Find location to steer towards. + float steerPos[VERTEX_SIZE]; + unsigned char steerPosFlag; + dtPolyRef steerPosRef = INVALID_POLYREF; - if (!GetSteerTarget(iterPos, targetPos, SMOOTH_PATH_SLOP, polys, npolys, steerPos, steerPosFlag, steerPosRef)) - break; + if (!GetSteerTarget(iterPos, targetPos, SMOOTH_PATH_SLOP, polys, npolys, steerPos, steerPosFlag, steerPosRef)) + break; - bool endOfPath = (steerPosFlag & DT_STRAIGHTPATH_END); - bool offMeshConnection = (steerPosFlag & DT_STRAIGHTPATH_OFFMESH_CONNECTION); + bool endOfPath = (steerPosFlag & DT_STRAIGHTPATH_END); + bool offMeshConnection = (steerPosFlag & DT_STRAIGHTPATH_OFFMESH_CONNECTION); - // Find movement delta. - float delta[VERTEX_SIZE]; - dtVsub(delta, steerPos, iterPos); - float len = dtSqrt(dtVdot(delta,delta)); - // If the steer target is end of path or off-mesh link, do not move past the location. - if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE) - len = 1.0f; - else - len = SMOOTH_PATH_STEP_SIZE / len; + // Find movement delta. + float delta[VERTEX_SIZE]; + dtVsub(delta, steerPos, iterPos); + float len = dtSqrt(dtVdot(delta,delta)); + // If the steer target is end of path or off-mesh link, do not move past the location. + if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE) + len = 1.0f; + else + len = SMOOTH_PATH_STEP_SIZE / len; - float moveTgt[VERTEX_SIZE]; - dtVmad(moveTgt, iterPos, delta, len); + float moveTgt[VERTEX_SIZE]; + dtVmad(moveTgt, iterPos, delta, len); - // Move - float result[VERTEX_SIZE]; - const static uint32 MAX_VISIT_POLY = 16; - dtPolyRef visited[MAX_VISIT_POLY]; + // Move + float result[VERTEX_SIZE]; + const static uint32 MAX_VISIT_POLY = 16; + dtPolyRef visited[MAX_VISIT_POLY]; - uint32 nvisited = 0; - _navMeshQuery->moveAlongSurface(polys[0], iterPos, moveTgt, &_filter, result, visited, (int*)&nvisited, MAX_VISIT_POLY); - npolys = FixupCorridor(polys, npolys, MAX_PATH_LENGTH, visited, nvisited); + uint32 nvisited = 0; + _navMeshQuery->moveAlongSurface(polys[0], iterPos, moveTgt, &_filter, result, visited, (int*)&nvisited, MAX_VISIT_POLY); + npolys = FixupCorridor(polys, npolys, MAX_PATH_LENGTH, visited, nvisited); - _navMeshQuery->getPolyHeight(polys[0], result, &result[1]); - result[1] += 0.5f; - dtVcopy(iterPos, result); + _navMeshQuery->getPolyHeight(polys[0], result, &result[1]); + result[1] += 0.5f; + dtVcopy(iterPos, result); - // Handle end of path and off-mesh links when close enough. - if (endOfPath && InRangeYZX(iterPos, steerPos, SMOOTH_PATH_SLOP, 1.0f)) - { - // Reached end of path. - dtVcopy(iterPos, targetPos); - if (nsmoothPath < maxSmoothPathSize) - { - dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], iterPos); - nsmoothPath++; - } - break; - } - else if (offMeshConnection && InRangeYZX(iterPos, steerPos, SMOOTH_PATH_SLOP, 1.0f)) - { - // Advance the path up to and over the off-mesh connection. - dtPolyRef prevRef = INVALID_POLYREF; - dtPolyRef polyRef = polys[0]; - uint32 npos = 0; - while (npos < npolys && polyRef != steerPosRef) - { - prevRef = polyRef; - polyRef = polys[npos]; - npos++; - } + // Handle end of path and off-mesh links when close enough. + if (endOfPath && InRangeYZX(iterPos, steerPos, SMOOTH_PATH_SLOP, 1.0f)) + { + // Reached end of path. + dtVcopy(iterPos, targetPos); + if (nsmoothPath < maxSmoothPathSize) + { + dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], iterPos); + nsmoothPath++; + } + break; + } + else if (offMeshConnection && InRangeYZX(iterPos, steerPos, SMOOTH_PATH_SLOP, 1.0f)) + { + // Advance the path up to and over the off-mesh connection. + dtPolyRef prevRef = INVALID_POLYREF; + dtPolyRef polyRef = polys[0]; + uint32 npos = 0; + while (npos < npolys && polyRef != steerPosRef) + { + prevRef = polyRef; + polyRef = polys[npos]; + npos++; + } - for (uint32 i = npos; i < npolys; ++i) - polys[i-npos] = polys[i]; + for (uint32 i = npos; i < npolys; ++i) + polys[i-npos] = polys[i]; - npolys -= npos; + npolys -= npos; - // Handle the connection. - float startPos[VERTEX_SIZE], endPos[VERTEX_SIZE]; - if (DT_SUCCESS == _navMesh->getOffMeshConnectionPolyEndPoints(prevRef, polyRef, startPos, endPos)) - { - if (nsmoothPath < maxSmoothPathSize) - { - dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], startPos); - nsmoothPath++; - } - // Move position at the other side of the off-mesh link. - dtVcopy(iterPos, endPos); - _navMeshQuery->getPolyHeight(polys[0], iterPos, &iterPos[1]); - iterPos[1] += 0.5f; - } - } + // Handle the connection. + float startPos[VERTEX_SIZE], endPos[VERTEX_SIZE]; + if (DT_SUCCESS == _navMesh->getOffMeshConnectionPolyEndPoints(prevRef, polyRef, startPos, endPos)) + { + if (nsmoothPath < maxSmoothPathSize) + { + dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], startPos); + nsmoothPath++; + } + // Move position at the other side of the off-mesh link. + dtVcopy(iterPos, endPos); + _navMeshQuery->getPolyHeight(polys[0], iterPos, &iterPos[1]); + iterPos[1] += 0.5f; + } + } - // Store results. - if (nsmoothPath < maxSmoothPathSize) - { - dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], iterPos); - nsmoothPath++; - } - } + // Store results. + if (nsmoothPath < maxSmoothPathSize) + { + dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], iterPos); + nsmoothPath++; + } + } - *smoothPathSize = nsmoothPath; + *smoothPathSize = nsmoothPath; - // this is most likely a loop - return nsmoothPath < MAX_POINT_PATH_LENGTH ? DT_SUCCESS : DT_FAILURE; + // this is most likely a loop + return nsmoothPath < MAX_POINT_PATH_LENGTH ? DT_SUCCESS : DT_FAILURE; } bool PathGenerator::InRangeYZX(const float* v1, const float* v2, float r, float h) const { - const float dx = v2[0] - v1[0]; - const float dy = v2[1] - v1[1]; // elevation - const float dz = v2[2] - v1[2]; - return (dx * dx + dz * dz) < r * r && fabsf(dy) < h; + const float dx = v2[0] - v1[0]; + const float dy = v2[1] - v1[1]; // elevation + const float dz = v2[2] - v1[2]; + return (dx * dx + dz * dz) < r * r && fabsf(dy) < h; } bool PathGenerator::InRange(G3D::Vector3 const& p1, G3D::Vector3 const& p2, float r, float h) const { - G3D::Vector3 d = p1 - p2; - return (d.x * d.x + d.y * d.y) < r * r && fabsf(d.z) < h; + G3D::Vector3 d = p1 - p2; + return (d.x * d.x + d.y * d.y) < r * r && fabsf(d.z) < h; } float PathGenerator::Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) const { - return (p1 - p2).squaredLength(); + return (p1 - p2).squaredLength(); } diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index fed33f35b..390360bc5 100644 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -33,7 +33,7 @@ void PointMovementGenerator::DoInitialize(T* unit) unit->StopMoving(); unit->AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); - i_recalculateSpeed = false; + i_recalculateSpeed = false; Movement::MoveSplineInit init(unit); if (m_precomputedPath.size() > 2) // pussywizard: for charge init.MovebyPath(m_precomputedPath); @@ -48,27 +48,27 @@ void PointMovementGenerator::DoInitialize(T* unit) } else { - // Xinef: fix strange client visual bug, moving on z coordinate only switches orientation by 180 degrees (visual only) - if (G3D::fuzzyEq(unit->GetPositionX(), i_x) && G3D::fuzzyEq(unit->GetPositionY(), i_y)) - { - i_x += 0.2f*cos(unit->GetOrientation()); - i_y += 0.2f*sin(unit->GetOrientation()); - } + // Xinef: fix strange client visual bug, moving on z coordinate only switches orientation by 180 degrees (visual only) + if (G3D::fuzzyEq(unit->GetPositionX(), i_x) && G3D::fuzzyEq(unit->GetPositionY(), i_y)) + { + i_x += 0.2f*cos(unit->GetOrientation()); + i_y += 0.2f*sin(unit->GetOrientation()); + } - init.MoveTo(i_x, i_y, i_z); - } + init.MoveTo(i_x, i_y, i_z); + } } else - { - // Xinef: fix strange client visual bug, moving on z coordinate only switches orientation by 180 degrees (visual only) - if (G3D::fuzzyEq(unit->GetPositionX(), i_x) && G3D::fuzzyEq(unit->GetPositionY(), i_y)) - { - i_x += 0.2f*cos(unit->GetOrientation()); - i_y += 0.2f*sin(unit->GetOrientation()); - } + { + // Xinef: fix strange client visual bug, moving on z coordinate only switches orientation by 180 degrees (visual only) + if (G3D::fuzzyEq(unit->GetPositionX(), i_x) && G3D::fuzzyEq(unit->GetPositionY(), i_y)) + { + i_x += 0.2f*cos(unit->GetOrientation()); + i_y += 0.2f*sin(unit->GetOrientation()); + } init.MoveTo(i_x, i_y, i_z); - } + } if (speed > 0.0f) init.SetVelocity(speed); init.Launch(); @@ -175,8 +175,8 @@ void EffectMovementGenerator::Finalize(Unit* unit) if (unit->GetTypeId() != TYPEID_UNIT) return; - if (unit->GetTypeId() == TYPEID_UNIT && unit->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) && unit->movespline->isFalling()) // pussywizard - unit->RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING); + if (unit->GetTypeId() == TYPEID_UNIT && unit->HasUnitMovementFlag(MOVEMENTFLAG_FALLING) && unit->movespline->isFalling()) // pussywizard + unit->RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING); // Need restore previous movement since we have no proper states system //if (unit->IsAlive() && !unit->HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING)) diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h index 2d9702ba5..872a320f8 100644 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h @@ -49,7 +49,7 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG uint32 id; float i_x, i_y, i_z; float speed; - bool i_recalculateSpeed; + bool i_recalculateSpeed; Movement::PointsArray m_precomputedPath; bool _generatePath; bool _forceDestination; diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 11984f0b9..09649f947 100644 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -16,278 +16,278 @@ REWRITTEN BY XINEF template<> void RandomMovementGenerator::_setRandomLocation(Creature* creature) { - if (creature->_moveState != MAP_OBJECT_CELL_MOVE_NONE) - return; + if (creature->_moveState != MAP_OBJECT_CELL_MOVE_NONE) + return; - if (_validPointsVector[_currentPoint].empty()) - { - if (_currentPoint == RANDOM_POINTS_NUMBER) // cant go anywhere from initial position, lets stay - return; - // go back to initial position and will never return to this point - _currentPoint = RANDOM_POINTS_NUMBER; - _currDestPosition.Relocate(_initialPosition); - creature->AddUnitState(UNIT_STATE_ROAMING_MOVE); - Movement::MoveSplineInit init(creature); - init.MoveTo(_currDestPosition.GetPositionX(), _currDestPosition.GetPositionY(), _currDestPosition.GetPositionZ()); - init.SetWalk(true); - init.Launch(); - if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature) - creature->GetFormation()->LeaderMoveTo(_currDestPosition.GetPositionX(), _currDestPosition.GetPositionY(), _currDestPosition.GetPositionZ(), false); - return; - } + if (_validPointsVector[_currentPoint].empty()) + { + if (_currentPoint == RANDOM_POINTS_NUMBER) // cant go anywhere from initial position, lets stay + return; + // go back to initial position and will never return to this point + _currentPoint = RANDOM_POINTS_NUMBER; + _currDestPosition.Relocate(_initialPosition); + creature->AddUnitState(UNIT_STATE_ROAMING_MOVE); + Movement::MoveSplineInit init(creature); + init.MoveTo(_currDestPosition.GetPositionX(), _currDestPosition.GetPositionY(), _currDestPosition.GetPositionZ()); + init.SetWalk(true); + init.Launch(); + if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature) + creature->GetFormation()->LeaderMoveTo(_currDestPosition.GetPositionX(), _currDestPosition.GetPositionY(), _currDestPosition.GetPositionZ(), false); + return; + } - uint8 random = urand(0, _validPointsVector[_currentPoint].size()-1); - std::vector::iterator randomIter = _validPointsVector[_currentPoint].begin() + random; - uint8 newPoint = *randomIter; - uint16 pathIdx = uint16(_currentPoint*RANDOM_POINTS_NUMBER + newPoint); + uint8 random = urand(0, _validPointsVector[_currentPoint].size()-1); + std::vector::iterator randomIter = _validPointsVector[_currentPoint].begin() + random; + uint8 newPoint = *randomIter; + uint16 pathIdx = uint16(_currentPoint*RANDOM_POINTS_NUMBER + newPoint); - // cant go anywhere from new point, so dont go there to not be stuck - if (_validPointsVector[newPoint].empty()) - { - _validPointsVector[_currentPoint].erase(randomIter); - return; - } + // cant go anywhere from new point, so dont go there to not be stuck + if (_validPointsVector[newPoint].empty()) + { + _validPointsVector[_currentPoint].erase(randomIter); + return; + } - Movement::PointsArray& finalPath = _preComputedPaths[pathIdx]; - if (finalPath.empty()) - { - Map* map = creature->GetMap(); - float x = _destinationPoints[newPoint].x, y = _destinationPoints[newPoint].y, z = _destinationPoints[newPoint].z; - // invalid coordinates - if (!Trinity::IsValidMapCoord(x, y)) - { - _validPointsVector[_currentPoint].erase(randomIter); - _preComputedPaths.erase(pathIdx); - return; - } + Movement::PointsArray& finalPath = _preComputedPaths[pathIdx]; + if (finalPath.empty()) + { + Map* map = creature->GetMap(); + float x = _destinationPoints[newPoint].x, y = _destinationPoints[newPoint].y, z = _destinationPoints[newPoint].z; + // invalid coordinates + if (!Trinity::IsValidMapCoord(x, y)) + { + _validPointsVector[_currentPoint].erase(randomIter); + _preComputedPaths.erase(pathIdx); + return; + } - float ground = INVALID_HEIGHT; - float levelZ = map->GetWaterOrGroundLevel(x, y, z+4.0f, &ground); - float newZ = INVALID_HEIGHT; + float ground = INVALID_HEIGHT; + float levelZ = map->GetWaterOrGroundLevel(x, y, z+4.0f, &ground); + float newZ = INVALID_HEIGHT; - // flying creature - if (creature->CanFly()) - newZ = std::max(levelZ, z + rand_norm()*_wanderDistance/2.0f); - // point underwater - else if (ground < levelZ) - { - if (!creature->CanSwim()) - { - if (ground < levelZ - 1.5f) - { - _validPointsVector[_currentPoint].erase(randomIter); - _preComputedPaths.erase(pathIdx); - return; - } - levelZ = ground; - } - else - { - if (levelZ > INVALID_HEIGHT) - newZ = std::min(levelZ-2.0f, z + rand_norm()*_wanderDistance/2.0f); - newZ = std::max(ground, newZ); - } - } - // point on ground - else - { - if (levelZ <= INVALID_HEIGHT || !creature->CanWalk()) - { - _validPointsVector[_currentPoint].erase(randomIter); - _preComputedPaths.erase(pathIdx); - return; - } - } + // flying creature + if (creature->CanFly()) + newZ = std::max(levelZ, z + rand_norm()*_wanderDistance/2.0f); + // point underwater + else if (ground < levelZ) + { + if (!creature->CanSwim()) + { + if (ground < levelZ - 1.5f) + { + _validPointsVector[_currentPoint].erase(randomIter); + _preComputedPaths.erase(pathIdx); + return; + } + levelZ = ground; + } + else + { + if (levelZ > INVALID_HEIGHT) + newZ = std::min(levelZ-2.0f, z + rand_norm()*_wanderDistance/2.0f); + newZ = std::max(ground, newZ); + } + } + // point on ground + else + { + if (levelZ <= INVALID_HEIGHT || !creature->CanWalk()) + { + _validPointsVector[_currentPoint].erase(randomIter); + _preComputedPaths.erase(pathIdx); + return; + } + } - if (newZ > INVALID_HEIGHT) - { - // flying / swiming creature - dest not in los - if (!creature->IsWithinLOS(x, y, newZ)) - { - _validPointsVector[_currentPoint].erase(randomIter); - _preComputedPaths.erase(pathIdx); - return; - } + if (newZ > INVALID_HEIGHT) + { + // flying / swiming creature - dest not in los + if (!creature->IsWithinLOS(x, y, newZ)) + { + _validPointsVector[_currentPoint].erase(randomIter); + _preComputedPaths.erase(pathIdx); + return; + } - finalPath.push_back(G3D::Vector3(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ())); - finalPath.push_back(G3D::Vector3(x, y, newZ)); - } - else // ground - { - bool result = _pathGenerator->CalculatePath(x, y, levelZ, false); - if (result && !(_pathGenerator->GetPathType() & PATHFIND_NOPATH)) - { - // generated path is too long - float pathLen = _pathGenerator->getPathLength(); - if (pathLen*pathLen > creature->GetExactDistSq(x, y, levelZ) * MAX_PATH_LENGHT_FACTOR*MAX_PATH_LENGHT_FACTOR) - { - _validPointsVector[_currentPoint].erase(randomIter); - _preComputedPaths.erase(pathIdx); - return; - } + finalPath.push_back(G3D::Vector3(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ())); + finalPath.push_back(G3D::Vector3(x, y, newZ)); + } + else // ground + { + bool result = _pathGenerator->CalculatePath(x, y, levelZ, false); + if (result && !(_pathGenerator->GetPathType() & PATHFIND_NOPATH)) + { + // generated path is too long + float pathLen = _pathGenerator->getPathLength(); + if (pathLen*pathLen > creature->GetExactDistSq(x, y, levelZ) * MAX_PATH_LENGHT_FACTOR*MAX_PATH_LENGHT_FACTOR) + { + _validPointsVector[_currentPoint].erase(randomIter); + _preComputedPaths.erase(pathIdx); + return; + } - finalPath = _pathGenerator->GetPath(); - Movement::PointsArray::iterator itr = finalPath.begin(); - Movement::PointsArray::iterator itrNext = finalPath.begin()+1; - float zDiff, distDiff; + finalPath = _pathGenerator->GetPath(); + Movement::PointsArray::iterator itr = finalPath.begin(); + Movement::PointsArray::iterator itrNext = finalPath.begin()+1; + float zDiff, distDiff; - for (; itrNext != finalPath.end(); ++itr, ++itrNext) - { - distDiff = sqrt(((*itr).x-(*itrNext).x)*((*itr).x-(*itrNext).x) + ((*itr).y-(*itrNext).y)*((*itr).y-(*itrNext).y)); - zDiff = fabs((*itr).z - (*itrNext).z); + for (; itrNext != finalPath.end(); ++itr, ++itrNext) + { + distDiff = sqrt(((*itr).x-(*itrNext).x)*((*itr).x-(*itrNext).x) + ((*itr).y-(*itrNext).y)*((*itr).y-(*itrNext).y)); + zDiff = fabs((*itr).z - (*itrNext).z); - // Xinef: tree climbing, cut as much as we can - if (zDiff > 2.0f || G3D::fuzzyNe(zDiff, 0.0f) && distDiff / zDiff < 2.15f) // ~25° - { - _validPointsVector[_currentPoint].erase(randomIter); - _preComputedPaths.erase(pathIdx); - return; - } + // Xinef: tree climbing, cut as much as we can + if (zDiff > 2.0f || G3D::fuzzyNe(zDiff, 0.0f) && distDiff / zDiff < 2.15f) // ~25° + { + _validPointsVector[_currentPoint].erase(randomIter); + _preComputedPaths.erase(pathIdx); + return; + } - if (!map->isInLineOfSight((*itr).x, (*itr).y, (*itr).z+2.f, (*itrNext).x, (*itrNext).y, (*itrNext).z+2.f, creature->GetPhaseMask())) - { - _validPointsVector[_currentPoint].erase(randomIter); - _preComputedPaths.erase(pathIdx); - return; - } - } + if (!map->isInLineOfSight((*itr).x, (*itr).y, (*itr).z+2.f, (*itrNext).x, (*itrNext).y, (*itrNext).z+2.f, creature->GetPhaseMask())) + { + _validPointsVector[_currentPoint].erase(randomIter); + _preComputedPaths.erase(pathIdx); + return; + } + } - // no valid path - if (finalPath.size() < 2) - { - _validPointsVector[_currentPoint].erase(randomIter); - _preComputedPaths.erase(pathIdx); - return; - } - } - else - { - _validPointsVector[_currentPoint].erase(randomIter); - _preComputedPaths.erase(pathIdx); - return; - } - } - } + // no valid path + if (finalPath.size() < 2) + { + _validPointsVector[_currentPoint].erase(randomIter); + _preComputedPaths.erase(pathIdx); + return; + } + } + else + { + _validPointsVector[_currentPoint].erase(randomIter); + _preComputedPaths.erase(pathIdx); + return; + } + } + } - _currentPoint = newPoint; - G3D::Vector3& finalPoint = finalPath[finalPath.size()-1]; - _currDestPosition.Relocate(finalPoint.x, finalPoint.y, finalPoint.z); + _currentPoint = newPoint; + G3D::Vector3& finalPoint = finalPath[finalPath.size()-1]; + _currDestPosition.Relocate(finalPoint.x, finalPoint.y, finalPoint.z); - creature->AddUnitState(UNIT_STATE_ROAMING_MOVE); - ++_moveCount; - if (roll_chance_i((int32)_moveCount * 25 + 10)) - { - _moveCount = 0; - _nextMoveTime.Reset(urand(4000, 8000)); - } + creature->AddUnitState(UNIT_STATE_ROAMING_MOVE); + ++_moveCount; + if (roll_chance_i((int32)_moveCount * 25 + 10)) + { + _moveCount = 0; + _nextMoveTime.Reset(urand(4000, 8000)); + } - Movement::MoveSplineInit init(creature); - init.MovebyPath(finalPath); - init.SetWalk(true); - init.Launch(); + Movement::MoveSplineInit init(creature); + init.MovebyPath(finalPath); + init.SetWalk(true); + init.Launch(); - if (sWorld->getBoolConfig(CONFIG_DONT_CACHE_RANDOM_MOVEMENT_PATHS)) - _preComputedPaths.erase(pathIdx); + if (sWorld->getBoolConfig(CONFIG_DONT_CACHE_RANDOM_MOVEMENT_PATHS)) + _preComputedPaths.erase(pathIdx); - //Call for creature group update - if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature) - creature->GetFormation()->LeaderMoveTo(finalPoint.x, finalPoint.y, finalPoint.z, false); + //Call for creature group update + if (creature->GetFormation() && creature->GetFormation()->getLeader() == creature) + creature->GetFormation()->LeaderMoveTo(finalPoint.x, finalPoint.y, finalPoint.z, false); } template<> void RandomMovementGenerator::DoInitialize(Creature* creature) { - if (!creature->IsAlive()) - return; + if (!creature->IsAlive()) + return; - if (!_wanderDistance) - _wanderDistance = creature->GetRespawnRadius(); + if (!_wanderDistance) + _wanderDistance = creature->GetRespawnRadius(); - _nextMoveTime.Reset(creature->GetDBTableGUIDLow() && creature->GetRespawnRadius() == _wanderDistance ? urand(1, 5000) : 0); - _wanderDistance = std::max((creature->GetRespawnRadius() == _wanderDistance && creature->GetInstanceId() == 0) ? (creature->CanFly() ? MIN_WANDER_DISTANCE_AIR : MIN_WANDER_DISTANCE_GROUND) : 0.0f, _wanderDistance); + _nextMoveTime.Reset(creature->GetDBTableGUIDLow() && creature->GetRespawnRadius() == _wanderDistance ? urand(1, 5000) : 0); + _wanderDistance = std::max((creature->GetRespawnRadius() == _wanderDistance && creature->GetInstanceId() == 0) ? (creature->CanFly() ? MIN_WANDER_DISTANCE_AIR : MIN_WANDER_DISTANCE_GROUND) : 0.0f, _wanderDistance); - if (G3D::fuzzyEq(_initialPosition.GetExactDist2d(0.0f, 0.0f), 0.0f)) - { - _initialPosition.Relocate(creature); - _destinationPoints.clear(); - for (uint8 i = 0; i < RANDOM_POINTS_NUMBER; ++i) - { - float angle = (M_PI*2.0f/(float)RANDOM_POINTS_NUMBER)*i; - float factor = 0.5f + rand_norm()*0.5f; - _destinationPoints.push_back(G3D::Vector3(_initialPosition.GetPositionX() + _wanderDistance*cos(angle)*factor, _initialPosition.GetPositionY() + _wanderDistance*sin(angle)*factor, _initialPosition.GetPositionZ())); - } - } + if (G3D::fuzzyEq(_initialPosition.GetExactDist2d(0.0f, 0.0f), 0.0f)) + { + _initialPosition.Relocate(creature); + _destinationPoints.clear(); + for (uint8 i = 0; i < RANDOM_POINTS_NUMBER; ++i) + { + float angle = (M_PI*2.0f/(float)RANDOM_POINTS_NUMBER)*i; + float factor = 0.5f + rand_norm()*0.5f; + _destinationPoints.push_back(G3D::Vector3(_initialPosition.GetPositionX() + _wanderDistance*cos(angle)*factor, _initialPosition.GetPositionY() + _wanderDistance*sin(angle)*factor, _initialPosition.GetPositionZ())); + } + } - if (!_pathGenerator) - _pathGenerator = new PathGenerator(creature); - creature->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); + if (!_pathGenerator) + _pathGenerator = new PathGenerator(creature); + creature->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); } template<> void RandomMovementGenerator::DoReset(Creature* creature) { - DoInitialize(creature); + DoInitialize(creature); } template<> void RandomMovementGenerator::DoFinalize(Creature* creature) { - creature->ClearUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); - creature->SetWalk(false); + creature->ClearUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); + creature->SetWalk(false); } template<> bool RandomMovementGenerator::DoUpdate(Creature* creature, const uint32 diff) { - if (creature->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED)) - { - _nextMoveTime.Reset(0); // Expire the timer - creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); - return true; - } + if (creature->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED)) + { + _nextMoveTime.Reset(0); // Expire the timer + creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); + return true; + } - // xinef: if we got disable move flag, do not remove default generator - just prevent movement - if (creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) - { - _nextMoveTime.Reset(0); // Expire the timer - creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); - return true; - } + // xinef: if we got disable move flag, do not remove default generator - just prevent movement + if (creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) + { + _nextMoveTime.Reset(0); // Expire the timer + creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); + return true; + } // prevent movement while casting spells with cast time or channel time if (creature->HasUnitState(UNIT_STATE_CASTING)) { - bool stop = true; - if (Spell* spell = creature->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - if (!(spell->GetSpellInfo()->ChannelInterruptFlags & (AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING)) && !(spell->GetSpellInfo()->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)) - stop = false; + bool stop = true; + if (Spell* spell = creature->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + if (!(spell->GetSpellInfo()->ChannelInterruptFlags & (AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING)) && !(spell->GetSpellInfo()->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)) + stop = false; - if (stop) - { - if (!creature->IsStopped()) - creature->StopMoving(); + if (stop) + { + if (!creature->IsStopped()) + creature->StopMoving(); - return true; - } + return true; + } } - if (creature->movespline->Finalized()) - { - _nextMoveTime.Update(diff); - if (_nextMoveTime.Passed()) - _setRandomLocation(creature); - } - return true; + if (creature->movespline->Finalized()) + { + _nextMoveTime.Update(diff); + if (_nextMoveTime.Passed()) + _setRandomLocation(creature); + } + return true; } template<> bool RandomMovementGenerator::GetResetPosition(float& x, float& y, float& z) { - if (_currentPoint < RANDOM_POINTS_NUMBER) - _currDestPosition.GetPosition(x, y, z); - else if (G3D::fuzzyNe(_initialPosition.GetExactDist2d(0.0f, 0.0f), 0.0f)) // if initial position is not 0.0f, 0.0f - _initialPosition.GetPosition(x, y, z); - else - return false; - return true; + if (_currentPoint < RANDOM_POINTS_NUMBER) + _currDestPosition.GetPosition(x, y, z); + else if (G3D::fuzzyNe(_initialPosition.GetExactDist2d(0.0f, 0.0f), 0.0f)) // if initial position is not 0.0f, 0.0f + _initialPosition.GetPosition(x, y, z); + else + return false; + return true; } diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h index 5d541bd5a..f985feff5 100644 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h @@ -8,32 +8,32 @@ REWRITTEN BY XINEF #include "MovementGenerator.h" #include "PathGenerator.h" -#define RANDOM_POINTS_NUMBER 12 -#define RANDOM_LINKS_COUNT 7 -#define MIN_WANDER_DISTANCE_GROUND 6.0f -#define MIN_WANDER_DISTANCE_AIR 10.0f -#define MAX_PATH_LENGHT_FACTOR 1.85f +#define RANDOM_POINTS_NUMBER 12 +#define RANDOM_LINKS_COUNT 7 +#define MIN_WANDER_DISTANCE_GROUND 6.0f +#define MIN_WANDER_DISTANCE_AIR 10.0f +#define MAX_PATH_LENGHT_FACTOR 1.85f template class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator > { public: RandomMovementGenerator(float spawnDist = 0.0f) : _nextMoveTime(0), _moveCount(0), _wanderDistance(spawnDist), _pathGenerator(NULL), _currentPoint(RANDOM_POINTS_NUMBER) - { - _initialPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f); - _destinationPoints.reserve(RANDOM_POINTS_NUMBER); + { + _initialPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f); + _destinationPoints.reserve(RANDOM_POINTS_NUMBER); - for (uint8 i = 0; i < RANDOM_POINTS_NUMBER; ++i) - { - _validPointsVector[i].reserve(RANDOM_LINKS_COUNT); - for (uint8 j = 0; j < RANDOM_LINKS_COUNT; ++j) - _validPointsVector[i].push_back((i + j + RANDOM_POINTS_NUMBER/2 - RANDOM_LINKS_COUNT/2) % RANDOM_POINTS_NUMBER); - } + for (uint8 i = 0; i < RANDOM_POINTS_NUMBER; ++i) + { + _validPointsVector[i].reserve(RANDOM_LINKS_COUNT); + for (uint8 j = 0; j < RANDOM_LINKS_COUNT; ++j) + _validPointsVector[i].push_back((i + j + RANDOM_POINTS_NUMBER/2 - RANDOM_LINKS_COUNT/2) % RANDOM_POINTS_NUMBER); + } - _validPointsVector[RANDOM_POINTS_NUMBER].reserve(RANDOM_POINTS_NUMBER); - for (uint8 i = 0; i < RANDOM_POINTS_NUMBER; ++i) - _validPointsVector[RANDOM_POINTS_NUMBER].push_back(i); - } + _validPointsVector[RANDOM_POINTS_NUMBER].reserve(RANDOM_POINTS_NUMBER); + for (uint8 i = 0; i < RANDOM_POINTS_NUMBER; ++i) + _validPointsVector[RANDOM_POINTS_NUMBER].push_back(i); + } void _setRandomLocation(T*); void DoInitialize(T*); @@ -45,13 +45,13 @@ class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovemen private: TimeTrackerSmall _nextMoveTime; - uint8 _moveCount; + uint8 _moveCount; float _wanderDistance; PathGenerator* _pathGenerator; - std::vector _destinationPoints; - std::vector _validPointsVector[RANDOM_POINTS_NUMBER+1]; - uint8 _currentPoint; - std::map _preComputedPaths; - Position _initialPosition, _currDestPosition; + std::vector _destinationPoints; + std::vector _validPointsVector[RANDOM_POINTS_NUMBER+1]; + uint8 _currentPoint; + std::map _preComputedPaths; + Position _initialPosition, _currDestPosition; }; #endif diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index f6803938c..0406861c7 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -44,8 +44,8 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T* owner, bool ini float x, y, z; bool isPlayerPet = owner->IsPet() && IS_PLAYER_GUID(owner->GetOwnerGUID()); bool sameTransport = owner->GetTransport() && owner->GetTransport() == i_target->GetTransport(); - if (owner->GetMapId() == 631 && owner->GetTransport() && owner->GetTransport()->IsMotionTransport() && i_target->GetTransport() && i_target->GetTransport()->IsMotionTransport()) // for ICC, if both on a motion transport => don't use mmaps - sameTransport = owner->GetTypeId() == TYPEID_UNIT && i_target->isInAccessiblePlaceFor(owner->ToCreature()); + if (owner->GetMapId() == 631 && owner->GetTransport() && owner->GetTransport()->IsMotionTransport() && i_target->GetTransport() && i_target->GetTransport()->IsMotionTransport()) // for ICC, if both on a motion transport => don't use mmaps + sameTransport = owner->GetTypeId() == TYPEID_UNIT && i_target->isInAccessiblePlaceFor(owner->ToCreature()); bool useMMaps = MMAP::MMapFactory::IsPathfindingEnabled(owner->FindMap()) && !sameTransport; bool forceDest = (owner->FindMap() && owner->FindMap()->IsDungeon() && !isPlayerPet) || // force in instances to prevent exploiting (owner->GetTypeId() == TYPEID_UNIT && ((owner->IsPet() && owner->HasUnitState(UNIT_STATE_FOLLOW)) || // allow pets following their master to cheat while generating paths @@ -60,7 +60,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T* owner, bool ini if (!i_offset) { - float allowedRange = MELEE_RANGE; + float allowedRange = MELEE_RANGE; if ((!initial || (owner->movespline->Finalized() && this->GetMovementGeneratorType() == CHASE_MOTION_TYPE)) && i_target->IsWithinMeleeRange(owner, allowedRange) && i_target->IsWithinLOS(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ())) return; @@ -94,21 +94,21 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T* owner, bool ini size = owner->GetObjectSize(); } - if ((!initial || (owner->movespline->Finalized() && this->GetMovementGeneratorType() == CHASE_MOTION_TYPE)) && i_target->IsWithinDistInMap(owner, dist) && i_target->IsWithinLOS(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ())) + if ((!initial || (owner->movespline->Finalized() && this->GetMovementGeneratorType() == CHASE_MOTION_TYPE)) && i_target->IsWithinDistInMap(owner, dist) && i_target->IsWithinLOS(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ())) return; - // Xinef: Fix follow angle for hostile units - float angle = i_angle; - if (angle == 0.0f && owner->GetVictim() && owner->GetVictim()->GetGUID() == i_target->GetGUID()) - angle = MapManager::NormalizeOrientation(i_target->GetAngle(owner)-i_target->GetOrientation()); + // Xinef: Fix follow angle for hostile units + float angle = i_angle; + if (angle == 0.0f && owner->GetVictim() && owner->GetVictim()->GetGUID() == i_target->GetGUID()) + angle = MapManager::NormalizeOrientation(i_target->GetAngle(owner)-i_target->GetOrientation()); // to at i_offset distance from target and i_angle from target facing bool inRange = i_target->GetClosePoint(x, y, z, size, dist, angle, owner, forcePoint); - if (!inRange && (forceDest || !useMMaps) && owner->HasUnitState(UNIT_STATE_FOLLOW) && fabs(i_target->GetPositionZ() - z) > 25.0f) - { - x = i_target->GetPositionX(); - y = i_target->GetPositionY(); - z = i_target->GetPositionZ(); - } + if (!inRange && (forceDest || !useMMaps) && owner->HasUnitState(UNIT_STATE_FOLLOW) && fabs(i_target->GetPositionZ() - z) > 25.0f) + { + x = i_target->GetPositionX(); + y = i_target->GetPositionY(); + z = i_target->GetPositionZ(); + } } D::_addUnitStateMove(owner); @@ -122,70 +122,70 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T* owner, bool ini if (!i_path) i_path = new PathGenerator(owner); - if (!forceDest) - { - if (owner->GetMapId() == 618) // pussywizard: 618 Ring of Valor - { - if (Map* map = owner->FindMap()) - if (Battleground* bg = ((BattlegroundMap*)map)->GetBG()) - { - Position dest = {x, y, z, 0.0f}; - if (GameObject* pillar = ((BattlegroundRV*)bg)->GetPillarAtPosition(&dest)) - { - if (pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() == 0 || owner->GetPositionZ() > 31.0f || owner->GetTransGUID() == pillar->GetGUID()) - { - if (pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() == 0) - z = std::max(z, 28.28f); - else - z = i_target->GetPositionZ(); + if (!forceDest) + { + if (owner->GetMapId() == 618) // pussywizard: 618 Ring of Valor + { + if (Map* map = owner->FindMap()) + if (Battleground* bg = ((BattlegroundMap*)map)->GetBG()) + { + Position dest = {x, y, z, 0.0f}; + if (GameObject* pillar = ((BattlegroundRV*)bg)->GetPillarAtPosition(&dest)) + { + if (pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() == 0 || owner->GetPositionZ() > 31.0f || owner->GetTransGUID() == pillar->GetGUID()) + { + if (pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() == 0) + z = std::max(z, 28.28f); + else + z = i_target->GetPositionZ(); - init.MoveTo(x,y,z); - if (i_angle == 0.f) - init.SetFacing(i_target.getTarget()); - init.SetWalk(((D*)this)->EnableWalking()); - init.Launch(); - return; - } - if (pillar->GetGoState() == GO_STATE_ACTIVE || pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() > 0) - { - Position pos; - owner->GetFirstCollisionPositionForTotem(pos, owner->GetExactDist2d(i_target.getTarget()), owner->GetAngle(i_target.getTarget())-owner->GetOrientation(), false); - x = pos.GetPositionX(); - y = pos.GetPositionY(); - z = 28.28f; - } - } - } - } - } + init.MoveTo(x,y,z); + if (i_angle == 0.f) + init.SetFacing(i_target.getTarget()); + init.SetWalk(((D*)this)->EnableWalking()); + init.Launch(); + return; + } + if (pillar->GetGoState() == GO_STATE_ACTIVE || pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() > 0) + { + Position pos; + owner->GetFirstCollisionPositionForTotem(pos, owner->GetExactDist2d(i_target.getTarget()), owner->GetAngle(i_target.getTarget())-owner->GetOrientation(), false); + x = pos.GetPositionX(); + y = pos.GetPositionY(); + z = 28.28f; + } + } + } + } + } - if (!forceDest && getMSTimeDiff(lastPathingFailMSTime, World::GetGameTimeMS()) < 1000) - { - lastOwnerXYZ.Relocate(-5000.0f, -5000.0f, -5000.0f); - return; - } + if (!forceDest && getMSTimeDiff(lastPathingFailMSTime, World::GetGameTimeMS()) < 1000) + { + lastOwnerXYZ.Relocate(-5000.0f, -5000.0f, -5000.0f); + return; + } bool result = i_path->CalculatePath(x, y, z, forceDest); if (result) { - float maxDist = MELEE_RANGE + owner->GetMeleeReach() + i_target->GetMeleeReach(); - if (!forceDest && (i_path->GetPathType() & PATHFIND_NOPATH || !i_offset && !isPlayerPet && i_target->GetExactDistSq(i_path->GetActualEndPosition().x, i_path->GetActualEndPosition().y, i_path->GetActualEndPosition().z) > maxDist*maxDist)) - { - lastPathingFailMSTime = World::GetGameTimeMS(); - owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(sWorld->GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget()); - return; - } - else - { - owner->m_targetsNotAcceptable.erase(i_target->GetGUID()); + float maxDist = MELEE_RANGE + owner->GetMeleeReach() + i_target->GetMeleeReach(); + if (!forceDest && (i_path->GetPathType() & PATHFIND_NOPATH || !i_offset && !isPlayerPet && i_target->GetExactDistSq(i_path->GetActualEndPosition().x, i_path->GetActualEndPosition().y, i_path->GetActualEndPosition().z) > maxDist*maxDist)) + { + lastPathingFailMSTime = World::GetGameTimeMS(); + owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(sWorld->GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget()); + return; + } + else + { + owner->m_targetsNotAcceptable.erase(i_target->GetGUID()); - init.MovebyPath(i_path->GetPath()); - if (i_angle == 0.f) - init.SetFacing(i_target.getTarget()); - init.SetWalk(((D*)this)->EnableWalking()); - init.Launch(); - return; - } + init.MovebyPath(i_path->GetPath()); + if (i_angle == 0.f) + init.SetFacing(i_target.getTarget()); + init.SetWalk(((D*)this)->EnableWalking()); + init.Launch(); + return; + } } // if failed to generate, just use normal MoveTo @@ -219,20 +219,20 @@ bool TargetedMovementGeneratorMedium::DoUpdate(T* owner, uint32 time_diff) // prevent movement while casting spells with cast time or channel time if (owner->HasUnitState(UNIT_STATE_CASTING)) { - bool stop = true; - if (Spell* spell = owner->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - if (!(spell->GetSpellInfo()->ChannelInterruptFlags & (AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING)) && !(spell->GetSpellInfo()->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)) - stop = false; + bool stop = true; + if (Spell* spell = owner->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + if (!(spell->GetSpellInfo()->ChannelInterruptFlags & (AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING)) && !(spell->GetSpellInfo()->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)) + stop = false; - if (stop) - { - // Xinef: delay distance recheck in case of succeeding casts - i_recheckDistance.Reset(300); - if (!owner->IsStopped()) - owner->StopMoving(); + if (stop) + { + // Xinef: delay distance recheck in case of succeeding casts + i_recheckDistance.Reset(300); + if (!owner->IsStopped()) + owner->StopMoving(); - return true; - } + return true; + } } // prevent crash after creature killed pet @@ -242,12 +242,12 @@ bool TargetedMovementGeneratorMedium::DoUpdate(T* owner, uint32 time_diff) return true; } - i_recheckDistanceForced.Update(time_diff); - if (i_recheckDistanceForced.Passed()) - { - i_recheckDistanceForced.Reset(2500); - lastOwnerXYZ.Relocate(-5000.0f, -5000.0f, -5000.0f); - } + i_recheckDistanceForced.Update(time_diff); + if (i_recheckDistanceForced.Passed()) + { + i_recheckDistanceForced.Reset(2500); + lastOwnerXYZ.Relocate(-5000.0f, -5000.0f, -5000.0f); + } i_recheckDistance.Update(time_diff); if (i_recheckDistance.Passed()) @@ -256,14 +256,14 @@ bool TargetedMovementGeneratorMedium::DoUpdate(T* owner, uint32 time_diff) //More distance let have better performance, less distance let have more sensitive reaction at target move. float allowed_dist_sq = i_target->GetObjectSize() + owner->GetObjectSize() + MELEE_RANGE - 0.5f; - // xinef: if offset is negative (follow distance is smaller than just object sizes), reduce minimum allowed distance which is based purely on object sizes - if (i_offset < 0.0f) - { - allowed_dist_sq += i_offset; - allowed_dist_sq = std::max(0.0f, allowed_dist_sq); - } + // xinef: if offset is negative (follow distance is smaller than just object sizes), reduce minimum allowed distance which is based purely on object sizes + if (i_offset < 0.0f) + { + allowed_dist_sq += i_offset; + allowed_dist_sq = std::max(0.0f, allowed_dist_sq); + } - allowed_dist_sq *= allowed_dist_sq; + allowed_dist_sq *= allowed_dist_sq; G3D::Vector3 dest = owner->movespline->FinalDestination(); if (owner->movespline->onTransport) @@ -369,7 +369,7 @@ void FollowMovementGenerator::_updateSpeed(Creature* owner) { // pet only sync speed with owner /// Make sure we are not in the process of a map change (IsInWorld) - if (!IS_PLAYER_GUID(owner->GetOwnerGUID()) || !owner->IsInWorld() || !i_target.isValid() || i_target->GetGUID() != owner->GetOwnerGUID()) + if (!IS_PLAYER_GUID(owner->GetOwnerGUID()) || !owner->IsInWorld() || !i_target.isValid() || i_target->GetGUID() != owner->GetOwnerGUID()) return; owner->UpdateSpeed(MOVE_RUN, true); diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 18abb45af..410a17874 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -101,9 +101,9 @@ bool WaypointMovementGenerator::StartMove(Creature* creature) if (!i_path || i_path->empty()) return false; - // Xinef: Dont allow dead creatures to move - if (!creature->IsAlive()) - return false; + // Xinef: Dont allow dead creatures to move + if (!creature->IsAlive()) + return false; if (Stopped()) return true; @@ -112,7 +112,7 @@ bool WaypointMovementGenerator::StartMove(Creature* creature) if (m_isArrivalDone) { - // Xinef: not true... update this at every waypoint! + // Xinef: not true... update this at every waypoint! //if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint { float x = i_path->at(i_currentNode)->x; @@ -135,11 +135,11 @@ bool WaypointMovementGenerator::StartMove(Creature* creature) transportPath = false; // else if (vehicle) - this should never happen, vehicle offsets are const } - } + } - // Xinef: moved the upper IF here - if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint - { + // Xinef: moved the upper IF here + if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint + { creature->GetMotionMaster()->Initialize(); return false; } @@ -147,9 +147,9 @@ bool WaypointMovementGenerator::StartMove(Creature* creature) i_currentNode = (i_currentNode+1) % i_path->size(); } - // xinef: do not initialize motion if we got stunned in movementinform - if (creature->HasUnitState(UNIT_STATE_NOT_MOVE)) - return true; + // xinef: do not initialize motion if we got stunned in movementinform + if (creature->HasUnitState(UNIT_STATE_NOT_MOVE)) + return true; WaypointData const* node = i_path->at(i_currentNode); @@ -214,25 +214,25 @@ bool WaypointMovementGenerator::DoUpdate(Creature* creature, uint32 di if (!i_path || i_path->empty()) return false; - // Xinef: Dont allow dead creatures to move - if (!creature->IsAlive()) - return false; + // Xinef: Dont allow dead creatures to move + if (!creature->IsAlive()) + return false; // prevent movement while casting spells with cast time or channel time if (creature->HasUnitState(UNIT_STATE_CASTING)) { - bool stop = true; - if (Spell* spell = creature->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - if (!(spell->GetSpellInfo()->ChannelInterruptFlags & (AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING)) && !(spell->GetSpellInfo()->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)) - stop = false; + bool stop = true; + if (Spell* spell = creature->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + if (!(spell->GetSpellInfo()->ChannelInterruptFlags & (AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING)) && !(spell->GetSpellInfo()->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)) + stop = false; - if (stop) - { - Stop(1000); - if (!creature->IsStopped()) - creature->StopMoving(); - return true; - } + if (stop) + { + Stop(1000); + if (!creature->IsStopped()) + creature->StopMoving(); + return true; + } } if (Stopped()) @@ -246,17 +246,17 @@ bool WaypointMovementGenerator::DoUpdate(Creature* creature, uint32 di Stop(STOP_TIME_FOR_PLAYER); else { - // xinef: code to detect pre-empetively if we should start movement to next waypoint - // xinef: do not start pre-empetive movement if current node has delay or we are ending waypoint movement - bool finished = creature->movespline->Finalized(); - if (!finished && !i_path->at(i_currentNode)->delay && ((i_currentNode != i_path->size() - 1) || repeating)) - finished = (creature->movespline->_Spline().length(creature->movespline->_currentSplineIdx()+1) - creature->movespline->timePassed()) < 200; + // xinef: code to detect pre-empetively if we should start movement to next waypoint + // xinef: do not start pre-empetive movement if current node has delay or we are ending waypoint movement + bool finished = creature->movespline->Finalized(); + if (!finished && !i_path->at(i_currentNode)->delay && ((i_currentNode != i_path->size() - 1) || repeating)) + finished = (creature->movespline->_Spline().length(creature->movespline->_currentSplineIdx()+1) - creature->movespline->timePassed()) < 200; - if (finished) - { - OnArrived(creature); - return StartMove(creature); - } + if (finished) + { + OnArrived(creature); + return StartMove(creature); + } } } return true; @@ -318,7 +318,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player) // remove flag to prevent send object build movement packets for flight state and crash (movement generator already not at top of stack) player->ClearUnitState(UNIT_STATE_IN_FLIGHT); - // xinef: this should be cleaned by CleanupAfterTaxiFlight(); function! + // xinef: this should be cleaned by CleanupAfterTaxiFlight(); function! player->Dismount(); player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); @@ -329,7 +329,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player) // this prevent cheating with landing point at lags // when client side flight end early in comparison server side player->StopMoving(); - player->SetFallInformation(time(NULL), player->GetPositionZ()); + player->SetFallInformation(time(NULL), player->GetPositionZ()); } player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK); @@ -358,13 +358,13 @@ void FlightPathMovementGenerator::DoReset(Player* player) bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/) { - // xinef: map was switched - if (_mapSwitch) - { - DoInitialize(player); - _mapSwitch = false; - return true; - } + // xinef: map was switched + if (_mapSwitch) + { + DoInitialize(player); + _mapSwitch = false; + return true; + } uint32 pointId = (uint32)player->movespline->currentPathIdx(); if (pointId > i_currentNode) @@ -372,30 +372,30 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/) bool departureEvent = true; do { - if (i_currentNode >= i_path.size()) - { - sLog->outMisc("TAXI NODE WAS GREATER THAN PATH SIZE, GUID: %u, POINTID: %u, NODESIZE: %u, CURRENT: %u", player->GetGUIDLow(), pointId, i_path.size(), i_currentNode); - player->CleanupAfterTaxiFlight(); - return false; - } + if (i_currentNode >= i_path.size()) + { + sLog->outMisc("TAXI NODE WAS GREATER THAN PATH SIZE, GUID: %u, POINTID: %u, NODESIZE: %u, CURRENT: %u", player->GetGUIDLow(), pointId, i_path.size(), i_currentNode); + player->CleanupAfterTaxiFlight(); + return false; + } - if (i_path[i_currentNode]->mapid != player->GetMapId()) - { - sLog->outMisc("Player on different map, curmap: %u, pointmap: %u, nodesize: %u, currentnode: %u", player->GetMapId(), i_path[i_currentNode]->mapid, i_path.size(), i_currentNode); - player->CleanupAfterTaxiFlight(); - return false; - } + if (i_path[i_currentNode]->mapid != player->GetMapId()) + { + sLog->outMisc("Player on different map, curmap: %u, pointmap: %u, nodesize: %u, currentnode: %u", player->GetMapId(), i_path[i_currentNode]->mapid, i_path.size(), i_currentNode); + player->CleanupAfterTaxiFlight(); + return false; + } DoEventIfAny(player, i_path[i_currentNode], departureEvent); - // xinef: erase any previous points - uint32 curSize = _pointsForPathSwitch.size(); + // xinef: erase any previous points + uint32 curSize = _pointsForPathSwitch.size(); while (!_pointsForPathSwitch.empty() && _pointsForPathSwitch.front() <= i_currentNode) _pointsForPathSwitch.pop_front(); - // xinef: switch destination only once - if (curSize != _pointsForPathSwitch.size()) - player->m_taxi.NextTaxiDestination(); + // xinef: switch destination only once + if (curSize != _pointsForPathSwitch.size()) + player->m_taxi.NextTaxiDestination(); if (pointId == i_currentNode) break; @@ -405,26 +405,26 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/) i_currentNode += (uint32)departureEvent; departureEvent = !departureEvent; - // xinef: map should be switched, do not rely on client packets QQ - if (i_currentNode + 1 < i_path.size() && i_path[i_currentNode+1]->mapid != player->GetMapId()) - { - ++i_currentNode; - _mapSwitch = true; - player->TeleportTo(i_path[i_currentNode]->mapid, i_path[i_currentNode]->x, i_path[i_currentNode]->y, i_path[i_currentNode]->z, player->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI); - return true; - } + // xinef: map should be switched, do not rely on client packets QQ + if (i_currentNode + 1 < i_path.size() && i_path[i_currentNode+1]->mapid != player->GetMapId()) + { + ++i_currentNode; + _mapSwitch = true; + player->TeleportTo(i_path[i_currentNode]->mapid, i_path[i_currentNode]->x, i_path[i_currentNode]->y, i_path[i_currentNode]->z, player->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI); + return true; + } - // xinef: reached the end - if (i_currentNode >= i_path.size() - 1) - { - player->CleanupAfterTaxiFlight(); - player->SetFallInformation(time(NULL), player->GetPositionZ()); - if (player->pvpInfo.IsHostile) - player->CastSpell(player, 2479, true); + // xinef: reached the end + if (i_currentNode >= i_path.size() - 1) + { + player->CleanupAfterTaxiFlight(); + player->SetFallInformation(time(NULL), player->GetPositionZ()); + if (player->pvpInfo.IsHostile) + player->CastSpell(player, 2479, true); - return false; - } - } + return false; + } + } while (true); } @@ -463,17 +463,17 @@ void FlightPathMovementGenerator::InitEndGridInfo() uint32 nodeCount = i_path.size(); //! Number of nodes in path. _endMapId = i_path[nodeCount - 1]->mapid; //! MapId of last node - // pussywizard: - { - _preloadTargetNode = nodeCount - 1; - for (uint8 i = 3; i > 0; --i) - if (nodeCount >= i && _endMapId == i_path[nodeCount - i]->mapid) - { - _preloadTargetNode = nodeCount - i; - break; - } - //_preloadTargetNode = nodeCount - 3; // pussywizard: this can be on other map - } + // pussywizard: + { + _preloadTargetNode = nodeCount - 1; + for (uint8 i = 3; i > 0; --i) + if (nodeCount >= i && _endMapId == i_path[nodeCount - i]->mapid) + { + _preloadTargetNode = nodeCount - i; + break; + } + //_preloadTargetNode = nodeCount - 3; // pussywizard: this can be on other map + } _endGridX = i_path[nodeCount - 1]->x; _endGridY = i_path[nodeCount - 1]->y; diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index 70ec999f7..83bc1c1d0 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -113,7 +113,7 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig _endGridY = 0.0f; _endMapId = 0; _preloadTargetNode = 0; - _mapSwitch = false; + _mapSwitch = false; } void LoadPath(Player* player); void DoInitialize(Player*); @@ -137,7 +137,7 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig float _endGridY; //! Y coord of last node location uint32 _endMapId; //! map Id of last node location uint32 _preloadTargetNode; //! node index where preloading starts - bool _mapSwitch; + bool _mapSwitch; std::deque _pointsForPathSwitch; //! node indexes and costs where TaxiPath changes }; diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h index 2eb6db650..22486a667 100644 --- a/src/server/game/Movement/Spline/MoveSpline.h +++ b/src/server/game/Movement/Spline/MoveSpline.h @@ -47,7 +47,7 @@ namespace Movement Result_Arrived = 0x02, Result_NextCycle = 0x04, Result_NextSegment = 0x08, - Result_JustArrived = 0x10, + Result_JustArrived = 0x10, }; friend class PacketBuilder; protected: @@ -81,8 +81,8 @@ namespace Movement int32 segment_time_elapsed() const { return next_timestamp() - time_passed; } public: - int32 timeElapsed() const { return Duration() - time_passed; } // xinef: moved to public for waypoint movegen - int32 timePassed() const { return time_passed; } // xinef: moved to public for waypoint movegen + int32 timeElapsed() const { return Duration() - time_passed; } // xinef: moved to public for waypoint movegen + int32 timePassed() const { return time_passed; } // xinef: moved to public for waypoint movegen int32 Duration() const { return spline.length(); } MySpline const& _Spline() const { return spline; } int32 _currentSplineIdx() const { return point_Idx; } diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index dd9386cd4..8833ad1ba 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -124,15 +124,15 @@ namespace Movement data << int8(unit->GetTransSeat()); } - Movement::SplineBase::ControlArray* visualPoints = const_cast(move_spline._Spline().allocateVisualPoints()); - visualPoints->resize(move_spline._Spline().getPointCount()); - // Xinef: Apply hover in creature movement packet - if (unit->IsHovering()) - std::transform(move_spline._Spline().getPoints(false).begin(), move_spline._Spline().getPoints(false).end(), visualPoints->begin(), HoverMovementTransform(unit->GetHoverHeight())); - else - std::copy(move_spline._Spline().getPoints(false).begin(), move_spline._Spline().getPoints(false).end(), visualPoints->begin()); + Movement::SplineBase::ControlArray* visualPoints = const_cast(move_spline._Spline().allocateVisualPoints()); + visualPoints->resize(move_spline._Spline().getPointCount()); + // Xinef: Apply hover in creature movement packet + if (unit->IsHovering()) + std::transform(move_spline._Spline().getPoints(false).begin(), move_spline._Spline().getPoints(false).end(), visualPoints->begin(), HoverMovementTransform(unit->GetHoverHeight())); + else + std::copy(move_spline._Spline().getPoints(false).begin(), move_spline._Spline().getPoints(false).end(), visualPoints->begin()); - PacketBuilder::WriteMonsterMove(move_spline, data); + PacketBuilder::WriteMonsterMove(move_spline, data); unit->SendMessageToSet(&data,true); return move_spline.Duration(); @@ -178,8 +178,8 @@ namespace Movement data << int8(unit->GetTransSeat()); } - // Xinef: increase z position in packet - loc.z += unit->GetHoverHeight(); + // Xinef: increase z position in packet + loc.z += unit->GetHoverHeight(); PacketBuilder::WriteStopMovement(loc, args.splineId, data); unit->SendMessageToSet(&data, true); } diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h index 5f5828221..013ccacb8 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.h +++ b/src/server/game/Movement/Spline/MoveSplineInit.h @@ -26,8 +26,8 @@ class Unit; namespace Movement { - // xinef: moved declaration here so it can be accessed out of MoveSplineInit.cpp - UnitMoveType SelectSpeedType(uint32 moveFlags); + // xinef: moved declaration here so it can be accessed out of MoveSplineInit.cpp + UnitMoveType SelectSpeedType(uint32 moveFlags); enum AnimType { @@ -50,20 +50,20 @@ namespace Movement bool _transformForTransport; }; - // Xinef: transforms z coordinate with hover offset - class HoverMovementTransform - { - public: - HoverMovementTransform(float z_offset) : _offset(z_offset) { } - Vector3 operator()(Vector3 input) - { - input.z += _offset; - return input; - } + // Xinef: transforms z coordinate with hover offset + class HoverMovementTransform + { + public: + HoverMovementTransform(float z_offset) : _offset(z_offset) { } + Vector3 operator()(Vector3 input) + { + input.z += _offset; + return input; + } - private: - float _offset; - }; + private: + float _offset; + }; /* Initializes and launches spline movement */ diff --git a/src/server/game/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h index 05c4880d3..7f3c743d5 100644 --- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h +++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.h @@ -44,7 +44,7 @@ namespace Movement struct MoveSplineInitArgs { MoveSplineInitArgs(size_t path_capacity = 16) : path_Idx_offset(0), velocity(0.f), - parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f), + parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f), HasVelocity(false), TransformForTransport(true) { path.reserve(path_capacity); diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp index d7dc192cc..a6f9ae21e 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp @@ -70,9 +70,9 @@ namespace Movement } // add fake Enter_Cycle flag - needed for client-side cyclic movement (client will erase first spline vertex after first cycle done) - // Xinef: this flag breaks cycle for ground movement, client teleports npc between last and first point instead of using smooth movement - if (splineflags & MoveSplineFlag::Flying) - splineflags.enter_cycle = move_spline.isCyclic(); + // Xinef: this flag breaks cycle for ground movement, client teleports npc between last and first point instead of using smooth movement + if (splineflags & MoveSplineFlag::Flying) + splineflags.enter_cycle = move_spline.isCyclic(); data << uint32(splineflags & uint32(~MoveSplineFlag::Mask_No_Monster_Move)); if (splineflags.animation) @@ -129,16 +129,16 @@ namespace Movement { uint32 count = spline.getPointCount() - 3; data << uint32(count+1); - if (flying) - { - data << spline.getPoint(1, true); // fake point, client will erase it from the spline after first cycle done - data.append(&spline.getPoint(2, true), count); - } - else - { - data.append(&spline.getPoint(2, true), count); - data << Vector3::zero(); //Xinef: fake point - } + if (flying) + { + data << spline.getPoint(1, true); // fake point, client will erase it from the spline after first cycle done + data.append(&spline.getPoint(2, true), count); + } + else + { + data.append(&spline.getPoint(2, true), count); + data << Vector3::zero(); //Xinef: fake point + } } void PacketBuilder::WriteMonsterMove(const MoveSpline& move_spline, ByteBuffer& data) @@ -150,7 +150,7 @@ namespace Movement if (splineflags & MoveSplineFlag::Mask_CatmullRom) { if (splineflags.cyclic) - WriteCatmullRomCyclicPath(spline, data, splineflags & MoveSplineFlag::Flying); + WriteCatmullRomCyclicPath(spline, data, splineflags & MoveSplineFlag::Flying); else WriteCatmullRomPath(spline, data); } diff --git a/src/server/game/Movement/Spline/Spline.cpp b/src/server/game/Movement/Spline/Spline.cpp index 3ce0fa499..562825257 100644 --- a/src/server/game/Movement/Spline/Spline.cpp +++ b/src/server/game/Movement/Spline/Spline.cpp @@ -286,7 +286,7 @@ void SplineBase::clear() index_lo = 0; index_hi = 0; points.clear(); - pointsVisual.clear(); + pointsVisual.clear(); } std::string SplineBase::ToString() const diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index ad27143f1..fd11cd060 100644 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -81,7 +81,7 @@ void WaypointMgr::Load() if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX) { //TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp->id); - delete wp; + delete wp; continue; } @@ -143,7 +143,7 @@ void WaypointMgr::ReloadPath(uint32 id) if (wp->move_type >= WAYPOINT_MOVE_TYPE_MAX) { //TC_LOG_ERROR("sql.sql", "Waypoint %u in waypoint_data has invalid move_type, ignoring", wp->id); - delete wp; + delete wp; continue; } diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index b24d9b9b3..14fb0178f 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -128,8 +128,8 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl uint32 lowguid = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3); if (!lowguid) - return false; - m_capturePointGUID = MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT); + return false; + m_capturePointGUID = MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT); // get the needed values from goinfo m_maxValue = (float)goinfo->capturePoint.maxTime; diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index e49835511..bf151c31b 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -32,7 +32,7 @@ enum OutdoorPvPTypes OUTDOOR_PVP_ZM = 4, OUTDOOR_PVP_SI = 5, OUTDOOR_PVP_EP = 6, - OUTDOOR_PVP_GH = 7, + OUTDOOR_PVP_GH = 7, }; #define MAX_OUTDOORPVP_TYPES 8 diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h index 8d81ee513..c2735a39c 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h @@ -81,8 +81,8 @@ class OutdoorPvPMgr void HandleDropFlag(Player* player, uint32 spellId); - // pussywizard: lock required because different functions affect m_players - ACE_Thread_Mutex _lock; + // pussywizard: lock required because different functions affect m_players + ACE_Thread_Mutex _lock; private: typedef std::vector OutdoorPvPSet; diff --git a/src/server/game/Petitions/PetitionMgr.cpp b/src/server/game/Petitions/PetitionMgr.cpp index a37a2135d..41c53ebc4 100644 --- a/src/server/game/Petitions/PetitionMgr.cpp +++ b/src/server/game/Petitions/PetitionMgr.cpp @@ -15,23 +15,23 @@ PetitionMgr::~PetitionMgr() void PetitionMgr::LoadPetitions() { uint32 oldMSTime = getMSTime(); - PetitionStore.clear(); + PetitionStore.clear(); - QueryResult result = CharacterDatabase.Query("SELECT ownerguid, petitionguid, name, type FROM petition"); + QueryResult result = CharacterDatabase.Query("SELECT ownerguid, petitionguid, name, type FROM petition"); if (!result) { sLog->outString(">> Loaded 0 Petitions!"); - sLog->outString(); + sLog->outString(); return; } - uint32 count = 0; + uint32 count = 0; do { Field* fields = result->Fetch(); - AddPetition(fields[1].GetUInt32(), fields[0].GetUInt32(), fields[2].GetString(), fields[3].GetUInt8()); - ++count; - } while (result->NextRow()); + AddPetition(fields[1].GetUInt32(), fields[0].GetUInt32(), fields[2].GetString(), fields[3].GetUInt8()); + ++count; + } while (result->NextRow()); sLog->outString(">> Loaded %d Petitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -40,23 +40,23 @@ void PetitionMgr::LoadPetitions() void PetitionMgr::LoadSignatures() { uint32 oldMSTime = getMSTime(); - SignatureStore.clear(); + SignatureStore.clear(); - QueryResult result = CharacterDatabase.Query("SELECT petitionguid, playerguid, player_account FROM petition_sign"); + QueryResult result = CharacterDatabase.Query("SELECT petitionguid, playerguid, player_account FROM petition_sign"); if (!result) { sLog->outString(">> Loaded 0 Petition signs!"); - sLog->outString(); + sLog->outString(); return; } - uint32 count = 0; + uint32 count = 0; do { Field* fields = result->Fetch(); - AddSignature(fields[0].GetUInt32(), fields[2].GetUInt32(), fields[1].GetUInt32()); - ++count; - } while (result->NextRow()); + AddSignature(fields[0].GetUInt32(), fields[2].GetUInt32(), fields[1].GetUInt32()); + ++count; + } while (result->NextRow()); sLog->outString(">> Loaded %d Petition signs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -64,93 +64,93 @@ void PetitionMgr::LoadSignatures() void PetitionMgr::AddPetition(uint32 petitionId, uint32 ownerGuid, std::string const& name, uint8 type) { - Petition& p = PetitionStore[petitionId]; - p.petitionGuid = petitionId; - p.ownerGuid = ownerGuid; - p.petitionName = name; - p.petitionType = type; + Petition& p = PetitionStore[petitionId]; + p.petitionGuid = petitionId; + p.ownerGuid = ownerGuid; + p.petitionName = name; + p.petitionType = type; - Signatures& s = SignatureStore[petitionId]; - s.petitionGuid = petitionId; - s.signatureMap.clear(); + Signatures& s = SignatureStore[petitionId]; + s.petitionGuid = petitionId; + s.signatureMap.clear(); } void PetitionMgr::RemovePetition(uint32 petitionId) { - PetitionStore.erase(petitionId); + PetitionStore.erase(petitionId); - // remove signatures - SignatureStore.erase(petitionId); + // remove signatures + SignatureStore.erase(petitionId); } void PetitionMgr::RemovePetitionByOwnerAndType(uint32 ownerGuid, uint8 type) { - for (PetitionContainer::iterator itr = PetitionStore.begin(); itr != PetitionStore.end();) - { - if (itr->second.ownerGuid == ownerGuid && (!type || type == itr->second.petitionType)) - { - // remove signatures - SignatureStore.erase(itr->first); - PetitionStore.erase(itr++); - } - else - ++itr; - } + for (PetitionContainer::iterator itr = PetitionStore.begin(); itr != PetitionStore.end();) + { + if (itr->second.ownerGuid == ownerGuid && (!type || type == itr->second.petitionType)) + { + // remove signatures + SignatureStore.erase(itr->first); + PetitionStore.erase(itr++); + } + else + ++itr; + } } Petition const* PetitionMgr::GetPetition(uint32 petitionId) const { - PetitionContainer::const_iterator itr = PetitionStore.find(petitionId); - if (itr != PetitionStore.end()) - return &itr->second; - return NULL; + PetitionContainer::const_iterator itr = PetitionStore.find(petitionId); + if (itr != PetitionStore.end()) + return &itr->second; + return NULL; } Petition const* PetitionMgr::GetPetitionByOwnerWithType(uint32 ownerGuid, uint8 type) const { - for (PetitionContainer::const_iterator itr = PetitionStore.begin(); itr != PetitionStore.end(); ++itr) - if (itr->second.ownerGuid == ownerGuid && itr->second.petitionType == type) - return &itr->second; + for (PetitionContainer::const_iterator itr = PetitionStore.begin(); itr != PetitionStore.end(); ++itr) + if (itr->second.ownerGuid == ownerGuid && itr->second.petitionType == type) + return &itr->second; - return NULL; + return NULL; } void PetitionMgr::AddSignature(uint32 petitionId, uint32 accountId, uint32 playerGuid) { - Signatures& s = SignatureStore[petitionId]; - s.signatureMap[playerGuid] = accountId; + Signatures& s = SignatureStore[petitionId]; + s.signatureMap[playerGuid] = accountId; } Signatures const* PetitionMgr::GetSignature(uint32 petitionId) const { - SignatureContainer::const_iterator itr = SignatureStore.find(petitionId); - if (itr != SignatureStore.end()) - return &itr->second; - return NULL; + SignatureContainer::const_iterator itr = SignatureStore.find(petitionId); + if (itr != SignatureStore.end()) + return &itr->second; + return NULL; } void PetitionMgr::RemoveSignaturesByPlayer(uint32 playerGuid) { - for (SignatureContainer::iterator itr = SignatureStore.begin(); itr != SignatureStore.end(); ++itr) - { - SignatureMap::iterator signItr = itr->second.signatureMap.find(playerGuid); - if (signItr != itr->second.signatureMap.end()) - itr->second.signatureMap.erase(signItr); - } + for (SignatureContainer::iterator itr = SignatureStore.begin(); itr != SignatureStore.end(); ++itr) + { + SignatureMap::iterator signItr = itr->second.signatureMap.find(playerGuid); + if (signItr != itr->second.signatureMap.end()) + itr->second.signatureMap.erase(signItr); + } } void PetitionMgr::RemoveSignaturesByPlayerAndType(uint32 playerGuid, uint8 type) { - for (SignatureContainer::iterator itr = SignatureStore.begin(); itr != SignatureStore.end(); ++itr) - { - Petition const* petition = sPetitionMgr->GetPetition(itr->first); - if (!petition || petition->petitionType != type) - continue; + for (SignatureContainer::iterator itr = SignatureStore.begin(); itr != SignatureStore.end(); ++itr) + { + Petition const* petition = sPetitionMgr->GetPetition(itr->first); + if (!petition || petition->petitionType != type) + continue; - SignatureMap::iterator signItr = itr->second.signatureMap.find(playerGuid); - if (signItr != itr->second.signatureMap.end()) - itr->second.signatureMap.erase(signItr); - } + SignatureMap::iterator signItr = itr->second.signatureMap.find(playerGuid); + if (signItr != itr->second.signatureMap.end()) + itr->second.signatureMap.erase(signItr); + } } diff --git a/src/server/game/Petitions/PetitionMgr.h b/src/server/game/Petitions/PetitionMgr.h index aefdf33c3..40c2e3f61 100644 --- a/src/server/game/Petitions/PetitionMgr.h +++ b/src/server/game/Petitions/PetitionMgr.h @@ -9,16 +9,16 @@ typedef std::map SignatureMap; struct Petition { - uint32 petitionGuid; - uint32 ownerGuid; - uint8 petitionType; - std::string petitionName; + uint32 petitionGuid; + uint32 ownerGuid; + uint8 petitionType; + std::string petitionName; }; struct Signatures { - uint32 petitionGuid; - SignatureMap signatureMap; + uint32 petitionGuid; + SignatureMap signatureMap; }; typedef std::map SignatureContainer; @@ -28,32 +28,32 @@ class PetitionMgr { friend class ACE_Singleton; - private: - PetitionMgr(); - ~PetitionMgr(); + private: + PetitionMgr(); + ~PetitionMgr(); - public: - void LoadPetitions(); - void LoadSignatures(); - - // Petitions - void AddPetition(uint32 petitionId, uint32 ownerGuid, std::string const& name, uint8 type); - void RemovePetition(uint32 petitionId); - void RemovePetitionByOwnerAndType(uint32 ownerGuid, uint8 type); - Petition const* GetPetition(uint32 petitionId) const; - Petition const* GetPetitionByOwnerWithType(uint32 ownerGuid, uint8 type) const; - PetitionContainer* GetPetitionStore() { return &PetitionStore; } + public: + void LoadPetitions(); + void LoadSignatures(); + + // Petitions + void AddPetition(uint32 petitionId, uint32 ownerGuid, std::string const& name, uint8 type); + void RemovePetition(uint32 petitionId); + void RemovePetitionByOwnerAndType(uint32 ownerGuid, uint8 type); + Petition const* GetPetition(uint32 petitionId) const; + Petition const* GetPetitionByOwnerWithType(uint32 ownerGuid, uint8 type) const; + PetitionContainer* GetPetitionStore() { return &PetitionStore; } - // Signatures - void AddSignature(uint32 petitionId, uint32 accountId, uint32 playerGuid); - void RemoveSignaturesByPlayer(uint32 playerGuid); - void RemoveSignaturesByPlayerAndType(uint32 playerGuid, uint8 type); - Signatures const* GetSignature(uint32 petitionId) const; - SignatureContainer* GetSignatureStore() { return &SignatureStore; } + // Signatures + void AddSignature(uint32 petitionId, uint32 accountId, uint32 playerGuid); + void RemoveSignaturesByPlayer(uint32 playerGuid); + void RemoveSignaturesByPlayerAndType(uint32 playerGuid, uint8 type); + Signatures const* GetSignature(uint32 petitionId) const; + SignatureContainer* GetSignatureStore() { return &SignatureStore; } - protected: - PetitionContainer PetitionStore; - SignatureContainer SignatureStore; + protected: + PetitionContainer PetitionStore; + SignatureContainer SignatureStore; }; #define sPetitionMgr ACE_Singleton::instance() diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index d60d32617..1af4e4fce 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -964,30 +964,30 @@ void PoolMgr::SaveQuestsToDB(bool daily, bool weekly, bool other) { if (itr->isEmpty()) continue; - if (Quest const* quest = sObjectMgr->GetQuestTemplate(itr->GetFirstEqualChancedObjectId())) - { - if (!daily && quest->IsDaily()) - continue; - if (!weekly && quest->IsWeekly()) - continue; - if (!other && !quest->IsDaily() && !quest->IsWeekly()) - continue; - } + if (Quest const* quest = sObjectMgr->GetQuestTemplate(itr->GetFirstEqualChancedObjectId())) + { + if (!daily && quest->IsDaily()) + continue; + if (!weekly && quest->IsWeekly()) + continue; + if (!other && !quest->IsDaily() && !quest->IsWeekly()) + continue; + } PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_POOL_SAVE); stmt->setUInt32(0, itr->GetPoolId()); trans->Append(stmt); deletedPools.insert(itr->GetPoolId()); } - for (SearchMap::iterator itr = mQuestSearchMap.begin(); itr != mQuestSearchMap.end(); ++itr) - if (deletedPools.find(itr->second) != deletedPools.end()) - if (IsSpawnedObject(itr->first)) - { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_QUEST_POOL_SAVE); - stmt->setUInt32(0, itr->second); - stmt->setUInt32(1, itr->first); - trans->Append(stmt); - } + for (SearchMap::iterator itr = mQuestSearchMap.begin(); itr != mQuestSearchMap.end(); ++itr) + if (deletedPools.find(itr->second) != deletedPools.end()) + if (IsSpawnedObject(itr->first)) + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_QUEST_POOL_SAVE); + stmt->setUInt32(0, itr->second); + stmt->setUInt32(1, itr->first); + trans->Append(stmt); + } CharacterDatabase.CommitTransaction(trans); } diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index aaf874add..c2a12247a 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -265,8 +265,8 @@ uint32 Quest::CalculateHonorGain(uint8 level) const return 0; honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1000000014901161); - // Xinef: exactly this is calculated above, however with higher precision... - //honor += Trinity::Honor::hk_honor_at_level(level, GetRewHonorMultiplier()); + // Xinef: exactly this is calculated above, however with higher precision... + //honor += Trinity::Honor::hk_honor_at_level(level, GetRewHonorMultiplier()); honor += GetRewHonorAddition(); } @@ -275,105 +275,105 @@ uint32 Quest::CalculateHonorGain(uint8 level) const void Quest::InitializeQueryData() { - queryData.Initialize(SMSG_QUEST_QUERY_RESPONSE, 1); + queryData.Initialize(SMSG_QUEST_QUERY_RESPONSE, 1); - queryData << uint32(GetQuestId()); // quest id - queryData << uint32(GetQuestMethod()); // Accepted values: 0, 1 or 2. 0 == IsAutoComplete() (skip objectives/details) - queryData << uint32(GetQuestLevel()); // may be -1, static data, in other cases must be used dynamic level: Player::GetQuestLevel (0 is not known, but assuming this is no longer valid for quest intended for client) - queryData << uint32(GetMinLevel()); // min level - queryData << uint32(GetZoneOrSort()); // zone or sort to display in quest log + queryData << uint32(GetQuestId()); // quest id + queryData << uint32(GetQuestMethod()); // Accepted values: 0, 1 or 2. 0 == IsAutoComplete() (skip objectives/details) + queryData << uint32(GetQuestLevel()); // may be -1, static data, in other cases must be used dynamic level: Player::GetQuestLevel (0 is not known, but assuming this is no longer valid for quest intended for client) + queryData << uint32(GetMinLevel()); // min level + queryData << uint32(GetZoneOrSort()); // zone or sort to display in quest log - queryData << uint32(GetType()); // quest type - queryData << uint32(GetSuggestedPlayers()); // suggested players count + queryData << uint32(GetType()); // quest type + queryData << uint32(GetSuggestedPlayers()); // suggested players count - queryData << uint32(GetRepObjectiveFaction()); // shown in quest log as part of quest objective - queryData << uint32(GetRepObjectiveValue()); // shown in quest log as part of quest objective + queryData << uint32(GetRepObjectiveFaction()); // shown in quest log as part of quest objective + queryData << uint32(GetRepObjectiveValue()); // shown in quest log as part of quest objective - queryData << uint32(GetRepObjectiveFaction2()); // shown in quest log as part of quest objective OPPOSITE faction - queryData << uint32(GetRepObjectiveValue2()); // shown in quest log as part of quest objective OPPOSITE faction + queryData << uint32(GetRepObjectiveFaction2()); // shown in quest log as part of quest objective OPPOSITE faction + queryData << uint32(GetRepObjectiveValue2()); // shown in quest log as part of quest objective OPPOSITE faction - queryData << uint32(GetNextQuestInChain()); // client will request this quest from NPC, if not 0 - queryData << uint32(GetXPId()); // used for calculating rewarded experience + queryData << uint32(GetNextQuestInChain()); // client will request this quest from NPC, if not 0 + queryData << uint32(GetXPId()); // used for calculating rewarded experience - if (HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) - queryData << uint32(0); // Hide money rewarded - else - queryData << uint32(GetRewOrReqMoney()); // reward money (below max lvl) + if (HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) + queryData << uint32(0); // Hide money rewarded + else + queryData << uint32(GetRewOrReqMoney()); // reward money (below max lvl) - queryData << uint32(GetRewMoneyMaxLevel()); // used in XP calculation at client - queryData << uint32(GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0) - queryData << int32(GetRewSpellCast()); // casted spell + queryData << uint32(GetRewMoneyMaxLevel()); // used in XP calculation at client + queryData << uint32(GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0) + queryData << int32(GetRewSpellCast()); // casted spell - // rewarded honor points - queryData << uint32(GetRewHonorAddition()); - queryData << float(GetRewHonorMultiplier()); - queryData << uint32(GetSrcItemId()); // source item id - queryData << uint32(GetFlags() & 0xFFFF); // quest flags - queryData << uint32(GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) - queryData << uint32(GetPlayersSlain()); // players slain - queryData << uint32(GetBonusTalents()); // bonus talents - queryData << uint32(GetRewArenaPoints()); // bonus arena points - queryData << uint32(0); // review rep show mask + // rewarded honor points + queryData << uint32(GetRewHonorAddition()); + queryData << float(GetRewHonorMultiplier()); + queryData << uint32(GetSrcItemId()); // source item id + queryData << uint32(GetFlags() & 0xFFFF); // quest flags + queryData << uint32(GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) + queryData << uint32(GetPlayersSlain()); // players slain + queryData << uint32(GetBonusTalents()); // bonus talents + queryData << uint32(GetRewArenaPoints()); // bonus arena points + queryData << uint32(0); // review rep show mask - if (HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) - { - for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) - queryData << uint32(0) << uint32(0); - for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - queryData << uint32(0) << uint32(0); - } - else - { - for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) - { - queryData << uint32(RewardItemId[i]); - queryData << uint32(RewardItemIdCount[i]); - } - for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - { - queryData << uint32(RewardChoiceItemId[i]); - queryData << uint32(RewardChoiceItemCount[i]); - } - } + if (HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) + { + for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) + queryData << uint32(0) << uint32(0); + for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) + queryData << uint32(0) << uint32(0); + } + else + { + for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) + { + queryData << uint32(RewardItemId[i]); + queryData << uint32(RewardItemIdCount[i]); + } + for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) + { + queryData << uint32(RewardChoiceItemId[i]); + queryData << uint32(RewardChoiceItemCount[i]); + } + } - for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids - queryData << uint32(RewardFactionId[i]); + for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids + queryData << uint32(RewardFactionId[i]); - for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc? - queryData << int32(RewardFactionValueId[i]); + for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc? + queryData << int32(RewardFactionValueId[i]); - for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0) - queryData << int32(RewardFactionValueIdOverride[i]); + for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0) + queryData << int32(RewardFactionValueIdOverride[i]); - queryData << GetPointMapId(); - queryData << GetPointX(); - queryData << GetPointY(); - queryData << GetPointOpt(); + queryData << GetPointMapId(); + queryData << GetPointX(); + queryData << GetPointY(); + queryData << GetPointOpt(); - queryData << GetTitle(); - queryData << GetObjectives(); - queryData << GetDetails(); - queryData << GetEndText(); - queryData << GetCompletedText(); // display in quest objectives window once all objectives are completed + queryData << GetTitle(); + queryData << GetObjectives(); + queryData << GetDetails(); + queryData << GetEndText(); + queryData << GetCompletedText(); // display in quest objectives window once all objectives are completed - for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - { - if (RequiredNpcOrGo[i] < 0) - queryData << uint32((RequiredNpcOrGo[i] * (-1)) | 0x80000000); // client expects gameobject template id in form (id|0x80000000) - else - queryData << uint32(RequiredNpcOrGo[i]); + for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + { + if (RequiredNpcOrGo[i] < 0) + queryData << uint32((RequiredNpcOrGo[i] * (-1)) | 0x80000000); // client expects gameobject template id in form (id|0x80000000) + else + queryData << uint32(RequiredNpcOrGo[i]); - queryData << uint32(RequiredNpcOrGoCount[i]); - queryData << uint32(RequiredSourceItemId[i]); - queryData << uint32(0); // req source count? - } + queryData << uint32(RequiredNpcOrGoCount[i]); + queryData << uint32(RequiredSourceItemId[i]); + queryData << uint32(0); // req source count? + } - for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - { - queryData << uint32(RequiredItemId[i]); - queryData << uint32(RequiredItemCount[i]); - } + for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) + { + queryData << uint32(RequiredItemId[i]); + queryData << uint32(RequiredItemCount[i]); + } - for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - queryData << ObjectiveText[i]; + for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + queryData << ObjectiveText[i]; } diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 2df303573..c6eec667c 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -345,9 +345,9 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi FactionStateList::iterator faction = _factions.find(factionEntry->reputationListID); if (faction != _factions.end()) { - // Xinef: if we update spillover only, do not update main reputation (rank exceeds creature reward rate) - if (!spillOverOnly) - res = SetOneFactionReputation(factionEntry, standing, incremental); + // Xinef: if we update spillover only, do not update main reputation (rank exceeds creature reward rate) + if (!spillOverOnly) + res = SetOneFactionReputation(factionEntry, standing, incremental); // only this faction gets reported to client, even if it has no own visible standing SendState(&faction->second); } @@ -541,10 +541,10 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result) SetInactive(faction, true); // have internal checks for visibility requirement if (dbFactionFlags & FACTION_FLAG_AT_WAR) // DB at war - { - // Xinef: dont set at war for friendly hidden reputations - SetAtWar(faction, bool(!(dbFactionFlags & FACTION_FLAG_HIDDEN) || GetRank(factionEntry) < REP_NEUTRAL)); // have internal checks for FACTION_FLAG_PEACE_FORCED - } + { + // Xinef: dont set at war for friendly hidden reputations + SetAtWar(faction, bool(!(dbFactionFlags & FACTION_FLAG_HIDDEN) || GetRank(factionEntry) < REP_NEUTRAL)); // have internal checks for FACTION_FLAG_PEACE_FORCED + } else // DB not at war { // allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN) diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 5cfaa2b6d..bb9942416 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -651,17 +651,17 @@ void Map::ScriptsProcess() sLog->outError("%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str()); else { - uint32 entry = step.script->TempSummonCreature.CreatureEntry; + uint32 entry = step.script->TempSummonCreature.CreatureEntry; float x = step.script->TempSummonCreature.PosX; float y = step.script->TempSummonCreature.PosY; float z = step.script->TempSummonCreature.PosZ; float o = step.script->TempSummonCreature.Orientation; - if (step.script->TempSummonCreature.CheckIfExists) - if (Unit* trigger = pSummoner->SummonTrigger(x, y, z, o, 1)) - if (trigger->FindNearestCreature(entry, 60.0f)) - break; + if (step.script->TempSummonCreature.CheckIfExists) + if (Unit* trigger = pSummoner->SummonTrigger(x, y, z, o, 1)) + if (trigger->FindNearestCreature(entry, 60.0f)) + break; if (!pSummoner->SummonCreature(entry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->TempSummonCreature.DespawnDelay)) sLog->outError("%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry); diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 7ad0b2646..3b13eff92 100644 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -376,7 +376,7 @@ void AddSC_instance_oculus(); void AddSC_oculus(); void AddSC_boss_sartharion(); //Obsidian Sanctum void AddSC_instance_obsidian_sanctum(); -void AddSC_boss_malygos(); //Eye of Eternity +void AddSC_boss_malygos(); //Eye of Eternity void AddSC_instance_eye_of_eternity(); void AddSC_boss_bjarngrim(); //Ulduar Halls of Lightning void AddSC_boss_loken(); @@ -595,7 +595,7 @@ void AddScripts() AddCommandScripts(); #ifdef SCRIPTS AddWorldScripts(); - AddEventScripts(); + AddEventScripts(); AddEasternKingdomsScripts(); AddKalimdorScripts(); AddOutlandScripts(); @@ -609,36 +609,36 @@ void AddScripts() void CheckIfScriptsInDatabaseExist() { - ObjectMgr::ScriptNameContainer& sn = sObjectMgr->GetScriptNames(); - for (ObjectMgr::ScriptNameContainer::iterator itr = sn.begin(); itr != sn.end(); ++itr) - if (uint32 sid = sObjectMgr->GetScriptId((*itr).c_str())) - { - if (!ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid) && - !ScriptRegistry::GetScriptById(sid)) - sLog->outErrorDb("Script named '%s' is assigned in database, but has no code!", (*itr).c_str()); - } + ObjectMgr::ScriptNameContainer& sn = sObjectMgr->GetScriptNames(); + for (ObjectMgr::ScriptNameContainer::iterator itr = sn.begin(); itr != sn.end(); ++itr) + if (uint32 sid = sObjectMgr->GetScriptId((*itr).c_str())) + { + if (!ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid) && + !ScriptRegistry::GetScriptById(sid)) + sLog->outErrorDb("Script named '%s' is assigned in database, but has no code!", (*itr).c_str()); + } } void AddSpellScripts() @@ -660,36 +660,36 @@ void AddSpellScripts() void AddCommandScripts() { - AddSC_server_commandscript(); + AddSC_server_commandscript(); AddSC_account_commandscript(); AddSC_achievement_commandscript(); - AddSC_ban_commandscript(); - AddSC_bf_commandscript(); - AddSC_cast_commandscript(); - AddSC_character_commandscript(); + AddSC_ban_commandscript(); + AddSC_bf_commandscript(); + AddSC_cast_commandscript(); + AddSC_character_commandscript(); AddSC_debug_commandscript(); AddSC_event_commandscript(); AddSC_gm_commandscript(); AddSC_go_commandscript(); AddSC_gobject_commandscript(); - AddSC_guild_commandscript(); + AddSC_guild_commandscript(); AddSC_honor_commandscript(); - AddSC_instance_commandscript(); + AddSC_instance_commandscript(); AddSC_learn_commandscript(); AddSC_lfg_commandscript(); - AddSC_list_commandscript(); + AddSC_list_commandscript(); AddSC_lookup_commandscript(); - AddSC_message_commandscript(); + AddSC_message_commandscript(); AddSC_misc_commandscript(); AddSC_modify_commandscript(); AddSC_npc_commandscript(); AddSC_quest_commandscript(); AddSC_reload_commandscript(); - AddSC_reset_commandscript(); - AddSC_spectator_commandscript(); + AddSC_reset_commandscript(); + AddSC_spectator_commandscript(); AddSC_tele_commandscript(); - AddSC_ticket_commandscript(); + AddSC_ticket_commandscript(); AddSC_titles_commandscript(); AddSC_wp_commandscript(); } @@ -714,13 +714,13 @@ void AddWorldScripts() void AddEventScripts() { #ifdef SCRIPTS - AddSC_event_brewfest_scripts(); - AddSC_event_hallows_end_scripts(); - AddSC_event_pilgrims_end_scripts(); - AddSC_event_winter_veil_scripts(); - AddSC_event_love_in_the_air(); - AddSC_event_midsummer_scripts(); - AddSC_event_childrens_week(); + AddSC_event_brewfest_scripts(); + AddSC_event_hallows_end_scripts(); + AddSC_event_pilgrims_end_scripts(); + AddSC_event_winter_veil_scripts(); + AddSC_event_love_in_the_air(); + AddSC_event_midsummer_scripts(); + AddSC_event_childrens_week(); #endif } @@ -756,8 +756,8 @@ void AddEasternKingdomsScripts() AddSC_boss_pyroguard_emberseer(); AddSC_boss_gyth(); AddSC_boss_rend_blackhand(); - AddSC_boss_urok_doomhowl(); - AddSC_boss_gizrul_the_slavener(); + AddSC_boss_urok_doomhowl(); + AddSC_boss_gizrul_the_slavener(); AddSC_instance_blackrock_spire(); AddSC_boss_razorgore(); //Blackwing lair AddSC_boss_vaelastrasz(); @@ -767,12 +767,12 @@ void AddEasternKingdomsScripts() AddSC_boss_flamegor(); AddSC_boss_chromaggus(); AddSC_boss_nefarian(); - AddSC_instance_blackwing_lair(); + AddSC_instance_blackwing_lair(); AddSC_boss_mr_smite(); AddSC_instance_deadmines(); //Deadmines AddSC_instance_gnomeregan(); //Gnomeregan AddSC_instance_karazhan(); //Karazhan - AddSC_boss_servant_quarters(); + AddSC_boss_servant_quarters(); AddSC_boss_attumen(); AddSC_boss_curator(); AddSC_boss_maiden_of_virtue(); @@ -897,10 +897,10 @@ void AddKalimdorScripts() AddSC_culling_of_stratholme(); AddSC_instance_culling_of_stratholme(); AddSC_instance_dire_maul(); //Dire Maul - AddSC_instance_maraudon(); //Maraudon + AddSC_instance_maraudon(); //Maraudon AddSC_boss_onyxia(); //Onyxia's Lair AddSC_instance_onyxias_lair(); - AddSC_instance_ragefire_chasm(); //Ragefire Chasm + AddSC_instance_ragefire_chasm(); //Ragefire Chasm AddSC_razorfen_downs(); AddSC_instance_razorfen_downs(); //Razorfen Downs AddSC_instance_razorfen_kraul(); //Razorfen Kraul @@ -919,7 +919,7 @@ void AddKalimdorScripts() AddSC_boss_sartura(); AddSC_boss_skeram(); AddSC_boss_twinemperors(); - AddSC_boss_ouro(); + AddSC_boss_ouro(); AddSC_npc_anubisath_sentinel(); AddSC_instance_temple_of_ahnqiraj(); AddSC_instance_wailing_caverns(); //Wailing caverns @@ -957,7 +957,7 @@ void AddOutlandScripts() AddSC_boss_exarch_maladaar(); //Auchindoun Auchenai Crypts AddSC_boss_shirrak_the_dead_watcher(); AddSC_boss_nexusprince_shaffar(); //Auchindoun Mana Tombs - AddSC_boss_talon_king_ikiss(); //Auchindoun Sekketh Halls + AddSC_boss_talon_king_ikiss(); //Auchindoun Sekketh Halls AddSC_instance_sethekk_halls(); AddSC_instance_shadow_labyrinth(); //Auchindoun Shadow Labyrinth AddSC_boss_ambassador_hellmaw(); @@ -986,7 +986,7 @@ void AddOutlandScripts() AddSC_boss_warlord_kalithresh(); AddSC_instance_steam_vault(); AddSC_boss_the_black_stalker(); //CR Underbog - AddSC_boss_ahune(); + AddSC_boss_ahune(); AddSC_boss_gruul(); //Gruul's Lair AddSC_boss_high_king_maulgar(); AddSC_instance_gruuls_lair(); @@ -1006,9 +1006,9 @@ void AddOutlandScripts() AddSC_instance_ramparts(); AddSC_arcatraz(); //TK Arcatraz AddSC_boss_harbinger_skyriss(); - AddSC_boss_wrath_scryer_soccothrates(); - AddSC_boss_zereketh_the_unbound(); - AddSC_boss_dalliah_the_doomsayer(); + AddSC_boss_wrath_scryer_soccothrates(); + AddSC_boss_zereketh_the_unbound(); + AddSC_boss_dalliah_the_doomsayer(); AddSC_instance_arcatraz(); AddSC_boss_high_botanist_freywinn(); //TK Botanica AddSC_boss_laj(); @@ -1092,18 +1092,18 @@ void AddNorthrendScripts() AddSC_boss_anomalus(); AddSC_boss_ormorok(); AddSC_boss_keristrasza(); - AddSC_boss_commander_stoutbeard(); + AddSC_boss_commander_stoutbeard(); AddSC_instance_nexus(); AddSC_boss_drakos(); //The Nexus The Oculus - AddSC_boss_varos(); + AddSC_boss_varos(); AddSC_boss_urom(); - AddSC_boss_eregos(); + AddSC_boss_eregos(); AddSC_instance_oculus(); AddSC_oculus(); AddSC_boss_sartharion(); //Obsidian Sanctum AddSC_instance_obsidian_sanctum(); - AddSC_boss_malygos(); //Eye of Eternity - AddSC_instance_eye_of_eternity(); + AddSC_boss_malygos(); //Eye of Eternity + AddSC_instance_eye_of_eternity(); AddSC_boss_bjarngrim(); //Ulduar Halls of Lightning AddSC_boss_loken(); AddSC_boss_ionar(); @@ -1112,7 +1112,7 @@ void AddNorthrendScripts() AddSC_boss_maiden_of_grief(); //Ulduar Halls of Stone AddSC_boss_krystallus(); AddSC_boss_sjonnir(); - AddSC_brann_bronzebeard(); + AddSC_brann_bronzebeard(); AddSC_instance_halls_of_stone(); AddSC_boss_auriaya(); //Ulduar Ulduar AddSC_boss_flame_leviathan(); @@ -1121,12 +1121,12 @@ void AddNorthrendScripts() AddSC_boss_xt002(); AddSC_boss_assembly_of_iron(); AddSC_boss_mimiron(); - AddSC_boss_hodir(); - AddSC_boss_vezax(); + AddSC_boss_hodir(); + AddSC_boss_vezax(); AddSC_boss_kologarn(); - AddSC_boss_freya(); - AddSC_boss_thorim(); - AddSC_boss_yoggsaron(); + AddSC_boss_freya(); + AddSC_boss_thorim(); + AddSC_boss_yoggsaron(); AddSC_ulduar(); AddSC_boss_algalon_the_observer(); AddSC_instance_ulduar(); @@ -1204,7 +1204,7 @@ void AddNorthrendScripts() AddSC_zuldrak(); AddSC_crystalsong_forest(); AddSC_isle_of_conquest(); - AddSC_wintergrasp(); + AddSC_wintergrasp(); #endif } @@ -1229,7 +1229,7 @@ void AddOutdoorPvPScripts() AddSC_outdoorpvp_si(); AddSC_outdoorpvp_tf(); AddSC_outdoorpvp_zm(); - AddSC_outdoorpvp_gh(); + AddSC_outdoorpvp_gh(); #endif } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index df6f6a7f3..eff5254c6 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -453,7 +453,7 @@ class GameObjectScript : public ScriptObject, public UpdatableScript // Called when the game object is damaged (destructible buildings only). virtual void OnDamaged(GameObject* /*go*/, Player* /*player*/) { } - // Called when the game object loot state is changed. + // Called when the game object loot state is changed. virtual void OnLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { } // Called when the game object state is changed. diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 158fb267e..98d8a6c57 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -1336,5 +1336,5 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x51B*/ { "CMSG_COMMENTATOR_SKIRMISH_QUEUE_COMMAND", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL , false }, /*0x51C*/ { "SMSG_COMMENTATOR_SKIRMISH_QUEUE_RESULT1", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide , false }, /*0x51D*/ { "SMSG_COMMENTATOR_SKIRMISH_QUEUE_RESULT2", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide , false }, - /*0x51E*/ { "SMSG_COMPRESSED_UNKNOWN_1310", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide , false }, + /*0x51E*/ { "SMSG_COMPRESSED_UNKNOWN_1310", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide , false }, }; diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 760059bfc..102cba94e 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -103,12 +103,12 @@ m_sessionDbLocaleIndex(locale), m_latency(0), m_clientTimeDelay(0), m_TutorialsChanged(false), recruiterId(recruiter), isRecruiter(isARecruiter), m_currentVendorEntry(0), m_currentBankerGUID(0), timeWhoCommandAllowed(0), _lastAuctionListItemsMSTime(0), _lastAuctionListOwnerItemsMSTime(0), _skipQueue(skipQueue) { - memset(m_Tutorials, 0, sizeof(m_Tutorials)); + memset(m_Tutorials, 0, sizeof(m_Tutorials)); _warden = NULL; - _offlineTime = 0; - _kicked = false; - _shouldSetOfflineInDB = true; + _offlineTime = 0; + _kicked = false; + _shouldSetOfflineInDB = true; if (sock) { @@ -147,8 +147,8 @@ WorldSession::~WorldSession() while (_recvQueue.next(packet)) delete packet; - if (GetShouldSetOfflineInDB()) - LoginDatabase.PExecute("UPDATE account SET online = online & ~(1<<(%u-1)) WHERE id = %u;", realmID, GetAccountId()); // One-time query + if (GetShouldSetOfflineInDB()) + LoginDatabase.PExecute("UPDATE account SET online = online & ~(1<<(%u-1)) WHERE id = %u;", realmID, GetAccountId()); // One-time query } std::string const & WorldSession::GetPlayerName() const @@ -226,188 +226,188 @@ void WorldSession::QueuePacket(WorldPacket* new_packet) /// Update the WorldSession (triggered by World update) bool WorldSession::Update(uint32 diff, PacketFilter& updater) { - if (updater.ProcessLogout()) - { - UpdateTimeOutTime(diff); - if (IsConnectionIdle()) - m_Socket->CloseSocket(); - } + if (updater.ProcessLogout()) + { + UpdateTimeOutTime(diff); + if (IsConnectionIdle()) + m_Socket->CloseSocket(); + } - HandleTeleportTimeout(updater.ProcessLogout()); + HandleTeleportTimeout(updater.ProcessLogout()); - uint32 _startMSTime = getMSTime(); - WorldPacket* packet = NULL; - WorldPacket* movementPacket = NULL; - bool deletePacket = true; - WorldPacket* firstDelayedPacket = NULL; - uint32 processedPackets = 0; + uint32 _startMSTime = getMSTime(); + WorldPacket* packet = NULL; + WorldPacket* movementPacket = NULL; + bool deletePacket = true; + WorldPacket* firstDelayedPacket = NULL; + uint32 processedPackets = 0; - while (m_Socket && !m_Socket->IsClosed() && !_recvQueue.empty() && _recvQueue.peek(true) != firstDelayedPacket && _recvQueue.next(packet, updater)) - { - if (packet->GetOpcode() < NUM_MSG_TYPES) - { - OpcodeHandler &opHandle = opcodeTable[packet->GetOpcode()]; - try - { - switch (opHandle.status) - { - case STATUS_LOGGEDIN: - if (!_player) - { - // pussywizard: such packets were sent to do something for a character that has already logged out, skip them - } - else if (!_player->IsInWorld()) - { - // pussywizard: such packets may do something important and the player is just being teleported, move to the end of the queue - // pussywizard: previously such were skipped, so leave it as it is xD proper code below if we wish to change that + while (m_Socket && !m_Socket->IsClosed() && !_recvQueue.empty() && _recvQueue.peek(true) != firstDelayedPacket && _recvQueue.next(packet, updater)) + { + if (packet->GetOpcode() < NUM_MSG_TYPES) + { + OpcodeHandler &opHandle = opcodeTable[packet->GetOpcode()]; + try + { + switch (opHandle.status) + { + case STATUS_LOGGEDIN: + if (!_player) + { + // pussywizard: such packets were sent to do something for a character that has already logged out, skip them + } + else if (!_player->IsInWorld()) + { + // pussywizard: such packets may do something important and the player is just being teleported, move to the end of the queue + // pussywizard: previously such were skipped, so leave it as it is xD proper code below if we wish to change that - // pussywizard: requeue only important packets not related to maps (PROCESS_THREADUNSAFE) - /*if (opHandle.packetProcessing == PROCESS_THREADUNSAFE) - { - if (!firstDelayedPacket) - firstDelayedPacket = packet; - deletePacket = false; - QueuePacket(packet); - }*/ - } - else - { - if (opHandle.isGrouppedMovementOpcode) - { - if (movementPacket) - delete movementPacket; - movementPacket = new WorldPacket(packet->GetOpcode(), 0); - movementPacket->append(*((ByteBuffer*)packet)); - } - else - { - if (movementPacket) - { - HandleMovementOpcodes(*movementPacket); - delete movementPacket; - movementPacket = NULL; - } - (this->*opHandle.handler)(*packet); - } - } - break; - case STATUS_TRANSFER: - if (_player && !_player->IsInWorld()) - { - if (movementPacket) - { - delete movementPacket; - movementPacket = NULL; - } - (this->*opHandle.handler)(*packet); - } - break; - case STATUS_AUTHED: - if (m_inQueue) // prevent cheating - break; - (this->*opHandle.handler)(*packet); - break; - //case STATUS_NEVER: - // break; - //case STATUS_UNHANDLED: - // break; - } - } - catch(ByteBufferException &) - { - sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId()); - if (sLog->IsOutDebug()) - { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:"); - packet->hexlike(); - } - } - } + // pussywizard: requeue only important packets not related to maps (PROCESS_THREADUNSAFE) + /*if (opHandle.packetProcessing == PROCESS_THREADUNSAFE) + { + if (!firstDelayedPacket) + firstDelayedPacket = packet; + deletePacket = false; + QueuePacket(packet); + }*/ + } + else + { + if (opHandle.isGrouppedMovementOpcode) + { + if (movementPacket) + delete movementPacket; + movementPacket = new WorldPacket(packet->GetOpcode(), 0); + movementPacket->append(*((ByteBuffer*)packet)); + } + else + { + if (movementPacket) + { + HandleMovementOpcodes(*movementPacket); + delete movementPacket; + movementPacket = NULL; + } + (this->*opHandle.handler)(*packet); + } + } + break; + case STATUS_TRANSFER: + if (_player && !_player->IsInWorld()) + { + if (movementPacket) + { + delete movementPacket; + movementPacket = NULL; + } + (this->*opHandle.handler)(*packet); + } + break; + case STATUS_AUTHED: + if (m_inQueue) // prevent cheating + break; + (this->*opHandle.handler)(*packet); + break; + //case STATUS_NEVER: + // break; + //case STATUS_UNHANDLED: + // break; + } + } + catch(ByteBufferException &) + { + sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId()); + if (sLog->IsOutDebug()) + { + sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:"); + packet->hexlike(); + } + } + } - if (deletePacket) - delete packet; - else - deletePacket = true; + if (deletePacket) + delete packet; + else + deletePacket = true; - if (++processedPackets >= 150) // limit (by count) packets processed in one update, prevent DDoS - break; + if (++processedPackets >= 150) // limit (by count) packets processed in one update, prevent DDoS + break; - if (getMSTimeDiff(_startMSTime, getMSTime()) >= 3) // limit (by time) packets processed in one update, prevent DDoS - break; - } + if (getMSTimeDiff(_startMSTime, getMSTime()) >= 3) // limit (by time) packets processed in one update, prevent DDoS + break; + } - if (movementPacket) - { - if (_player && _player->IsInWorld()) - HandleMovementOpcodes(*movementPacket); - delete movementPacket; - } + if (movementPacket) + { + if (_player && _player->IsInWorld()) + HandleMovementOpcodes(*movementPacket); + delete movementPacket; + } - if (m_Socket && !m_Socket->IsClosed()) - ProcessQueryCallbacks(); + if (m_Socket && !m_Socket->IsClosed()) + ProcessQueryCallbacks(); - if (updater.ProcessLogout()) - { - time_t currTime = time(NULL); - if (ShouldLogOut(currTime) && !m_playerLoading) - LogoutPlayer(true); + if (updater.ProcessLogout()) + { + time_t currTime = time(NULL); + if (ShouldLogOut(currTime) && !m_playerLoading) + LogoutPlayer(true); - if (m_Socket && !m_Socket->IsClosed() && _warden) - _warden->Update(); + if (m_Socket && !m_Socket->IsClosed() && _warden) + _warden->Update(); - if (m_Socket && m_Socket->IsClosed()) - { - m_Socket->RemoveReference(); - m_Socket = NULL; - } + if (m_Socket && m_Socket->IsClosed()) + { + m_Socket->RemoveReference(); + m_Socket = NULL; + } - if (!m_Socket) - return false; - } + if (!m_Socket) + return false; + } - return true; + return true; } bool WorldSession::HandleSocketClosed() { - if (m_Socket && m_Socket->IsClosed() && !IsKicked() && GetPlayer() && !PlayerLogout() && GetPlayer()->m_taxi.empty() && GetPlayer()->IsInWorld() && !World::IsStopped()) - { - m_Socket->RemoveReference(); - m_Socket = NULL; - GetPlayer()->TradeCancel(false); - return true; - } - return false; + if (m_Socket && m_Socket->IsClosed() && !IsKicked() && GetPlayer() && !PlayerLogout() && GetPlayer()->m_taxi.empty() && GetPlayer()->IsInWorld() && !World::IsStopped()) + { + m_Socket->RemoveReference(); + m_Socket = NULL; + GetPlayer()->TradeCancel(false); + return true; + } + return false; } void WorldSession::HandleTeleportTimeout(bool updateInSessions) { - // pussywizard: handle teleport ack timeout - if (m_Socket && !m_Socket->IsClosed() && GetPlayer() && GetPlayer()->IsBeingTeleported()) - { - time_t currTime = time(NULL); - if (updateInSessions) // session update from World::UpdateSessions - { - if (GetPlayer()->IsBeingTeleportedFar() && GetPlayer()->GetSemaphoreTeleportFar()+sWorld->getIntConfig(CONFIG_TELEPORT_TIMEOUT_FAR) < currTime) - while (GetPlayer() && GetPlayer()->IsBeingTeleportedFar()) - HandleMoveWorldportAckOpcode(); - } - else // session update from Map::Update - { - if (GetPlayer()->IsBeingTeleportedNear() && GetPlayer()->GetSemaphoreTeleportNear()+sWorld->getIntConfig(CONFIG_TELEPORT_TIMEOUT_NEAR) < currTime) - while (GetPlayer() && GetPlayer()->IsInWorld() && GetPlayer()->IsBeingTeleportedNear()) - { - Player* plMover = GetPlayer()->m_mover->ToPlayer(); - if (!plMover) - break; - WorldPacket pkt(MSG_MOVE_TELEPORT_ACK, 20); - pkt.append(plMover->GetPackGUID()); - pkt << uint32(0); // flags - pkt << uint32(0); // time - HandleMoveTeleportAck(pkt); - } - } - } + // pussywizard: handle teleport ack timeout + if (m_Socket && !m_Socket->IsClosed() && GetPlayer() && GetPlayer()->IsBeingTeleported()) + { + time_t currTime = time(NULL); + if (updateInSessions) // session update from World::UpdateSessions + { + if (GetPlayer()->IsBeingTeleportedFar() && GetPlayer()->GetSemaphoreTeleportFar()+sWorld->getIntConfig(CONFIG_TELEPORT_TIMEOUT_FAR) < currTime) + while (GetPlayer() && GetPlayer()->IsBeingTeleportedFar()) + HandleMoveWorldportAckOpcode(); + } + else // session update from Map::Update + { + if (GetPlayer()->IsBeingTeleportedNear() && GetPlayer()->GetSemaphoreTeleportNear()+sWorld->getIntConfig(CONFIG_TELEPORT_TIMEOUT_NEAR) < currTime) + while (GetPlayer() && GetPlayer()->IsInWorld() && GetPlayer()->IsBeingTeleportedNear()) + { + Player* plMover = GetPlayer()->m_mover->ToPlayer(); + if (!plMover) + break; + WorldPacket pkt(MSG_MOVE_TELEPORT_ACK, 20); + pkt.append(plMover->GetPackGUID()); + pkt << uint32(0); // flags + pkt << uint32(0); // time + HandleMoveTeleportAck(pkt); + } + } + } } /// %Log the player out @@ -448,16 +448,16 @@ void WorldSession::LogoutPlayer(bool save) } // pussywizard: leave whole bg on logout (character stays ingame when necessary) - // pussywizard: GetBattleground() checked inside - _player->LeaveBattleground(); + // pussywizard: GetBattleground() checked inside + _player->LeaveBattleground(); - // pussywizard: checked first time - if (!_player->IsBeingTeleportedFar() && !_player->m_InstanceValid && !_player->IsGameMaster()) + // pussywizard: checked first time + if (!_player->IsBeingTeleportedFar() && !_player->m_InstanceValid && !_player->IsGameMaster()) _player->RepopAtGraveyard(); sOutdoorPvPMgr->HandlePlayerLeaveZone(_player, _player->GetZoneId()); - // pussywizard: remove from battleground queues on logout + // pussywizard: remove from battleground queues on logout for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) if (BattlegroundQueueTypeId bgQueueTypeId = _player->GetBattlegroundQueueTypeId(i)) { @@ -472,9 +472,9 @@ void WorldSession::LogoutPlayer(bool save) ///- Remove pet _player->RemovePet(NULL, PET_SAVE_AS_CURRENT); - // pussywizard: on logout remove auras that are removed at map change (before saving to db) - // there are some positive auras from boss encounters that can be kept by logging out and logging in after boss is dead, and may be used on next bosses - _player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP); + // pussywizard: on logout remove auras that are removed at map change (before saving to db) + // there are some positive auras from boss encounters that can be kept by logging out and logging in after boss is dead, and may be used on next bosses + _player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP); ///- If the player is in a group (or invited), remove him. If the group if then only 1 person, disband the group. _player->UninviteFromGroup(); @@ -484,7 +484,7 @@ void WorldSession::LogoutPlayer(bool save) if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && !_player->GetGroup()->isLFGGroup() && m_Socket) _player->RemoveFromGroup(); - // pussywizard: checked second time after being removed from a group + // pussywizard: checked second time after being removed from a group if (!_player->IsBeingTeleportedFar() && !_player->m_InstanceValid && !_player->IsGameMaster()) _player->RepopAtGraveyard(); @@ -495,7 +495,7 @@ void WorldSession::LogoutPlayer(bool save) ///- empty buyback items and save the player in the database // some save parts only correctly work in case player present in map/player_lists (pets, etc) - SavingSystemMgr::InsertToSavingSkipListIfNeeded(_player->GetNextSave()); // pussywizard + SavingSystemMgr::InsertToSavingSkipListIfNeeded(_player->GetNextSave()); // pussywizard if (save) { uint32 eslot; @@ -565,8 +565,8 @@ void WorldSession::KickPlayer(bool setKicked) if (m_Socket) m_Socket->CloseSocket(); - if (setKicked) - SetKicked(true); // pussywizard: the session won't be left ingame for 60 seconds and to also kick offline session + if (setKicked) + SetKicked(true); // pussywizard: the session won't be left ingame for 60 seconds and to also kick offline session } void WorldSession::SendNotification(const char *format, ...) @@ -753,13 +753,13 @@ void WorldSession::SaveTutorialsData(SQLTransaction &trans) if (!m_TutorialsChanged) return; - bool hasTutorials = false; - for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i) - if (m_Tutorials[i] != 0) - { - hasTutorials = true; - break; - } + bool hasTutorials = false; + for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i) + if (m_Tutorials[i] != 0) + { + hasTutorials = true; + break; + } PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(hasTutorials ? CHAR_UPD_TUTORIALS : CHAR_INS_TUTORIALS); for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i) @@ -884,8 +884,8 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi) REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_DISABLE_GRAVITY) && mi->HasMovementFlag(MOVEMENTFLAG_FALLING), MOVEMENTFLAG_FALLING); - // Xinef: Spline enabled flag should be never sent by client, its internal movementflag - REMOVE_VIOLATING_FLAGS(!GetPlayer()->m_mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_SPLINE_ENABLED), + // Xinef: Spline enabled flag should be never sent by client, its internal movementflag + REMOVE_VIOLATING_FLAGS(!GetPlayer()->m_mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_SPLINE_ENABLED), MOVEMENTFLAG_SPLINE_ENABLED); #undef REMOVE_VIOLATING_FLAGS @@ -1084,20 +1084,20 @@ void WorldSession::InitializeQueryCallbackParameters() // Callback parameters that have pointers in them should be properly // initialized to NULL here. _charCreateCallback.SetParam(NULL); - _loadPetFromDBFirstCallback.SetFirstParam(NULL); - _loadPetFromDBFirstCallback.SetSecondParam(NULL); + _loadPetFromDBFirstCallback.SetFirstParam(NULL); + _loadPetFromDBFirstCallback.SetSecondParam(NULL); } void WorldSession::ProcessQueryCallbacks() { - ProcessQueryCallbackPlayer(); - ProcessQueryCallbackPet(); - ProcessQueryCallbackLogin(); + ProcessQueryCallbackPlayer(); + ProcessQueryCallbackPet(); + ProcessQueryCallbackLogin(); } void WorldSession::ProcessQueryCallbackPlayer() { - PreparedQueryResult result; + PreparedQueryResult result; //- HandleCharRenameOpcode if (_charRenameCallback.IsReady()) @@ -1108,18 +1108,18 @@ void WorldSession::ProcessQueryCallbackPlayer() _charRenameCallback.FreeResult(); } - //- HandleOpenItemOpcode + //- HandleOpenItemOpcode if (_openWrappedItemCallback.IsReady()) { uint8 bagIndex = _openWrappedItemCallback.GetFirstParam(); - uint8 slot = _openWrappedItemCallback.GetSecondParam(); + uint8 slot = _openWrappedItemCallback.GetSecondParam(); uint32 itemLowGUID = _openWrappedItemCallback.GetThirdParam(); _openWrappedItemCallback.GetResult(result); HandleOpenWrappedItemCallback(result, bagIndex, slot, itemLowGUID); _openWrappedItemCallback.FreeResult(); } - //- Player - ActivateSpec + //- Player - ActivateSpec if (_loadActionsSwitchSpecCallback.ready()) { _loadActionsSwitchSpecCallback.get(result); @@ -1130,7 +1130,7 @@ void WorldSession::ProcessQueryCallbackPlayer() void WorldSession::ProcessQueryCallbackPet() { - PreparedQueryResult result; + PreparedQueryResult result; //- SendStabledPet if (_sendStabledPetCallback.IsReady()) @@ -1139,7 +1139,7 @@ void WorldSession::ProcessQueryCallbackPet() _sendStabledPetCallback.GetResult(result); SendStablePetCallback(result, param); _sendStabledPetCallback.FreeResult(); - return; + return; } //- HandleStablePet @@ -1148,7 +1148,7 @@ void WorldSession::ProcessQueryCallbackPet() _stablePetCallback.get(result); HandleStablePetCallback(result); _stablePetCallback.cancel(); - return; + return; } //- HandleUnstablePet @@ -1158,7 +1158,7 @@ void WorldSession::ProcessQueryCallbackPet() _unstablePetCallback.GetResult(result); HandleUnstablePetCallback(result, param); _unstablePetCallback.FreeResult(); - return; + return; } //- HandleStableSwapPet @@ -1168,65 +1168,65 @@ void WorldSession::ProcessQueryCallbackPet() _stableSwapCallback.GetResult(result); HandleStableSwapPetCallback(result, param); _stableSwapCallback.FreeResult(); - return; + return; } - //- LoadPetFromDB first part - if (_loadPetFromDBFirstCallback.IsReady()) + //- LoadPetFromDB first part + if (_loadPetFromDBFirstCallback.IsReady()) { - Player* player = GetPlayer(); - if (!player) - { - if (AsynchPetSummon* info = _loadPetFromDBFirstCallback.GetSecondParam()) - delete info; - _loadPetFromDBFirstCallback.Reset(); - return; - } - // process only if player is in world (teleport crashes?) - // otherwise wait with result till he logs in - if (player->IsInWorld()) - { - uint8 asynchLoadType = _loadPetFromDBFirstCallback.GetFirstParam(); - _loadPetFromDBFirstCallback.GetResult(result); + Player* player = GetPlayer(); + if (!player) + { + if (AsynchPetSummon* info = _loadPetFromDBFirstCallback.GetSecondParam()) + delete info; + _loadPetFromDBFirstCallback.Reset(); + return; + } + // process only if player is in world (teleport crashes?) + // otherwise wait with result till he logs in + if (player->IsInWorld()) + { + uint8 asynchLoadType = _loadPetFromDBFirstCallback.GetFirstParam(); + _loadPetFromDBFirstCallback.GetResult(result); - uint8 loadResult = HandleLoadPetFromDBFirstCallback(result, asynchLoadType); - if (loadResult != PET_LOAD_OK) - Pet::HandleAsynchLoadFailed(_loadPetFromDBFirstCallback.GetSecondParam(), player, asynchLoadType, loadResult); + uint8 loadResult = HandleLoadPetFromDBFirstCallback(result, asynchLoadType); + if (loadResult != PET_LOAD_OK) + Pet::HandleAsynchLoadFailed(_loadPetFromDBFirstCallback.GetSecondParam(), player, asynchLoadType, loadResult); - if (AsynchPetSummon* info = _loadPetFromDBFirstCallback.GetSecondParam()) - delete info; - _loadPetFromDBFirstCallback.Reset(); - } - return; + if (AsynchPetSummon* info = _loadPetFromDBFirstCallback.GetSecondParam()) + delete info; + _loadPetFromDBFirstCallback.Reset(); + } + return; } - //- LoadPetFromDB second part - if (_loadPetFromDBSecondCallback.ready()) + //- LoadPetFromDB second part + if (_loadPetFromDBSecondCallback.ready()) { - Player* player = GetPlayer(); - if (!player) - { - _loadPetFromDBSecondCallback.cancel(); - } - else if (!player->IsInWorld()) - { - // wait - } - else - { - SQLQueryHolder* param; - _loadPetFromDBSecondCallback.get(param); - HandleLoadPetFromDBSecondCallback((LoadPetFromDBQueryHolder*)param); - delete param; - _loadPetFromDBSecondCallback.cancel(); - } - return; + Player* player = GetPlayer(); + if (!player) + { + _loadPetFromDBSecondCallback.cancel(); + } + else if (!player->IsInWorld()) + { + // wait + } + else + { + SQLQueryHolder* param; + _loadPetFromDBSecondCallback.get(param); + HandleLoadPetFromDBSecondCallback((LoadPetFromDBQueryHolder*)param); + delete param; + _loadPetFromDBSecondCallback.cancel(); + } + return; } } void WorldSession::ProcessQueryCallbackLogin() { - PreparedQueryResult result; + PreparedQueryResult result; //! HandleCharEnumOpcode if (_charEnumCallback.ready()) diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 34b921f0d..5833d6400 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -228,7 +228,7 @@ class WorldSession Player* GetPlayer() const { return _player; } std::string const& GetPlayerName() const; std::string GetPlayerInfo() const; - + uint32 GetCurrentVendor() const { return m_currentVendorEntry; } void SetCurrentVendor(uint32 vendorEntry) { m_currentVendorEntry = vendorEntry; } @@ -359,10 +359,10 @@ class WorldSession void SetLatency(uint32 latency) { m_latency = latency; } void ResetClientTimeDelay() { m_clientTimeDelay = 0; } - ACE_Atomic_Op m_timeOutTime; + ACE_Atomic_Op m_timeOutTime; void UpdateTimeOutTime(uint32 diff) { - if (time_t(diff) > m_timeOutTime.value()) + if (time_t(diff) > m_timeOutTime.value()) m_timeOutTime = 0; else m_timeOutTime -= diff; @@ -394,8 +394,8 @@ class WorldSession void HandlePlayerLoginOpcode(WorldPacket& recvPacket); void HandleCharEnum(PreparedQueryResult result); void HandlePlayerLoginFromDB(LoginQueryHolder * holder); - void HandlePlayerLoginToCharInWorld(Player* pCurrChar); - void HandlePlayerLoginToCharOutOfWorld(Player* pCurrChar); + void HandlePlayerLoginToCharInWorld(Player* pCurrChar); + void HandlePlayerLoginToCharOutOfWorld(Player* pCurrChar); void HandleCharFactionOrRaceChange(WorldPacket& recvData); // played time @@ -588,11 +588,11 @@ class WorldSession void HandleStableRevivePet(WorldPacket& recvPacket); void HandleStableSwapPet(WorldPacket& recvPacket); void HandleStableSwapPetCallback(PreparedQueryResult result, uint32 petId); - void HandleOpenWrappedItemCallback(PreparedQueryResult result, uint8 bagIndex, uint8 slot, uint32 itemLowGUID); - void HandleLoadActionsSwitchSpec(PreparedQueryResult result); - void HandleCharacterAuraFrozen(PreparedQueryResult result); - uint8 HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, uint8 asynchLoadType); - void HandleLoadPetFromDBSecondCallback(LoadPetFromDBQueryHolder * holder); + void HandleOpenWrappedItemCallback(PreparedQueryResult result, uint8 bagIndex, uint8 slot, uint32 itemLowGUID); + void HandleLoadActionsSwitchSpec(PreparedQueryResult result); + void HandleCharacterAuraFrozen(PreparedQueryResult result); + uint8 HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, uint8 asynchLoadType); + void HandleLoadPetFromDBSecondCallback(LoadPetFromDBQueryHolder * holder); void HandleDuelAcceptedOpcode(WorldPacket& recvPacket); void HandleDuelCancelledOpcode(WorldPacket& recvPacket); @@ -777,7 +777,7 @@ class WorldSession void HandleResetInstancesOpcode(WorldPacket& recvData); void HandleHearthAndResurrect(WorldPacket& recvData); void HandleInstanceLockResponse(WorldPacket& recvPacket); - void HandleUpdateMissileTrajectory(WorldPacket& recvPacket); + void HandleUpdateMissileTrajectory(WorldPacket& recvPacket); // Battlefield void SendBfInvitePlayerToWar(uint32 battleId, uint32 zoneId, uint32 time); @@ -907,30 +907,30 @@ class WorldSession void HandleEnterPlayerVehicle(WorldPacket& data); void HandleUpdateProjectilePosition(WorldPacket& recvPacket); - // _loadPetFromDBFirstCallback helpers - //QueryCallback GetLoadPetFromDBFirstCallback() { return _loadPetFromDBFirstCallback; } + // _loadPetFromDBFirstCallback helpers + //QueryCallback GetLoadPetFromDBFirstCallback() { return _loadPetFromDBFirstCallback; } - uint32 _lastAuctionListItemsMSTime; - uint32 _lastAuctionListOwnerItemsMSTime; + uint32 _lastAuctionListItemsMSTime; + uint32 _lastAuctionListOwnerItemsMSTime; - void HandleTeleportTimeout(bool updateInSessions); - bool HandleSocketClosed(); - void SetOfflineTime(uint32 time) { _offlineTime = time; } - uint32 GetOfflineTime() const { return _offlineTime; } - bool IsKicked() const { return _kicked; } - void SetKicked(bool val) { _kicked = val; } - void SetShouldSetOfflineInDB(bool val) { _shouldSetOfflineInDB = val; } - bool GetShouldSetOfflineInDB() const { return _shouldSetOfflineInDB; } + void HandleTeleportTimeout(bool updateInSessions); + bool HandleSocketClosed(); + void SetOfflineTime(uint32 time) { _offlineTime = time; } + uint32 GetOfflineTime() const { return _offlineTime; } + bool IsKicked() const { return _kicked; } + void SetKicked(bool val) { _kicked = val; } + void SetShouldSetOfflineInDB(bool val) { _shouldSetOfflineInDB = val; } + bool GetShouldSetOfflineInDB() const { return _shouldSetOfflineInDB; } - /*** - CALLBACKS - ***/ + /*** + CALLBACKS + ***/ private: void InitializeQueryCallbackParameters(); void ProcessQueryCallbacks(); - void ProcessQueryCallbackPlayer(); - void ProcessQueryCallbackPet(); - void ProcessQueryCallbackLogin(); + void ProcessQueryCallbackPlayer(); + void ProcessQueryCallbackPet(); + void ProcessQueryCallbackLogin(); PreparedQueryResultFuture _charEnumCallback; PreparedQueryResultFuture _stablePetCallback; @@ -942,18 +942,18 @@ class WorldSession QueryResultHolderFuture _charLoginCallback; - QueryResultHolderFuture _loadPetFromDBSecondCallback; - QueryCallback_3 _openWrappedItemCallback; + QueryResultHolderFuture _loadPetFromDBSecondCallback; + QueryCallback_3 _openWrappedItemCallback; - public: - // xinef: those must be public, requires calls out of worldsession :( - QueryCallback_2 _loadPetFromDBFirstCallback; - PreparedQueryResultFuture _loadActionsSwitchSpecCallback; - PreparedQueryResultFuture _CharacterAuraFrozenCallback; + public: + // xinef: those must be public, requires calls out of worldsession :( + QueryCallback_2 _loadPetFromDBFirstCallback; + PreparedQueryResultFuture _loadActionsSwitchSpecCallback; + PreparedQueryResultFuture _CharacterAuraFrozenCallback; - /*** - END OF CALLBACKS - ***/ + /*** + END OF CALLBACKS + ***/ private: // private trade methods void moveItems(Item* myItems[], Item* hisItems[]); @@ -1001,12 +1001,12 @@ class WorldSession uint32 recruiterId; bool isRecruiter; ACE_Based::LockedQueue _recvQueue; - uint32 m_currentVendorEntry; + uint32 m_currentVendorEntry; uint64 m_currentBankerGUID; time_t timeWhoCommandAllowed; - uint32 _offlineTime; - bool _kicked; - bool _shouldSetOfflineInDB; + uint32 _offlineTime; + bool _kicked; + bool _shouldSetOfflineInDB; }; #endif /// @} diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index a02b24975..afb488605 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -1006,7 +1006,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) sLog->outError("WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)", m_Session->GetAccountId(), _player ? _player->GetGUIDLow() : 0, - _player ? _player->GetName().c_str() : "", + _player ? _player->GetName().c_str() : "", GetRemoteAddress().c_str()); return -1; diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index 2ac28e31f..844100cdc 100644 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -186,12 +186,12 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) continue; if (item_iter->chance > roll) - { - // Update skill, not Book of Glyph Mastery - if (spellId != 64323) - player->UpdateGatherSkill(SKILL_INSCRIPTION, player->GetPureSkillValue(SKILL_INSCRIPTION), item_iter->reqSkillValue); + { + // Update skill, not Book of Glyph Mastery + if (spellId != 64323) + player->UpdateGatherSkill(SKILL_INSCRIPTION, player->GetPureSkillValue(SKILL_INSCRIPTION), item_iter->reqSkillValue); return item_iter->spellId; - } + } roll -= item_iter->chance; } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 2b70aa492..af65286d5 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -351,7 +351,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleNoImmediateEffect, //291 SPELL_AURA_MOD_XP_QUEST_PCT implemented in Player::RewardQuest &AuraEffect::HandleAuraOpenStable, //292 SPELL_AURA_OPEN_STABLE &AuraEffect::HandleAuraOverrideSpells, //293 auras which probably add set of abilities to their target based on it's miscvalue - &AuraEffect::HandleModManaRegen, //294 SPELL_AURA_PREVENT_REGENERATE_POWER implemented in Player::Regenerate(Powers power), HandleModManaRegen to refresh regeneration clientside + &AuraEffect::HandleModManaRegen, //294 SPELL_AURA_PREVENT_REGENERATE_POWER implemented in Player::Regenerate(Powers power), HandleModManaRegen to refresh regeneration clientside &AuraEffect::HandleNULL, //295 0 spells in 3.3.5 &AuraEffect::HandleAuraSetVehicle, //296 SPELL_AURA_SET_VEHICLE_ID sets vehicle on target &AuraEffect::HandleNULL, //297 Spirit Burst spells @@ -383,25 +383,25 @@ m_spellmod(NULL), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex), m_canBeRecalculated(true), m_isPeriodic(false), m_critChance(0), m_oldAmount(0), m_isAuraEnabled(true), m_channelData(NULL) { CalculatePeriodic(caster, true, false); - CalculatePeriodicData(); + CalculatePeriodicData(); m_amount = CalculateAmount(caster); - m_casterLevel = caster ? caster->getLevel() : 0; - m_applyResilience = caster ? caster->CanApplyResilience() : false; - m_auraGroup = sSpellMgr->GetSpellGroup(GetId()); + m_casterLevel = caster ? caster->getLevel() : 0; + m_applyResilience = caster ? caster->CanApplyResilience() : false; + m_auraGroup = sSpellMgr->GetSpellGroup(GetId()); CalculateSpellMod(); - // Xinef: channel data structure - if (caster) - if (Spell* spell = caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - m_channelData = new ChannelTargetData(caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT), spell->m_targets.HasDst() ? spell->m_targets.GetDst() : NULL); + // Xinef: channel data structure + if (caster) + if (Spell* spell = caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + m_channelData = new ChannelTargetData(caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT), spell->m_targets.HasDst() ? spell->m_targets.GetDst() : NULL); } AuraEffect::~AuraEffect() { delete m_spellmod; - delete m_channelData; + delete m_channelData; } void AuraEffect::GetTargetList(std::list & targetList) const @@ -461,7 +461,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster) } // custom amount calculations go here - // xinef: normal auras + // xinef: normal auras switch (GetAuraType()) { // crowd control auras @@ -496,63 +496,63 @@ int32 AuraEffect::CalculateAmount(Unit* caster) case SPELL_AURA_MANA_SHIELD: m_canBeRecalculated = false; break; - case SPELL_AURA_MOD_BASE_RESISTANCE_PCT: - if (!caster) - break; - if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID) - { - if (GetId() == 1178 && caster->HasAura(5229) && !caster->HasAura(70726)) // Feral t10 4p - amount -= 48; // percentage - else if (GetId() == 9635 && caster->HasAura(5229) && !caster->HasAura(70726)) // Feral t10 4p - amount -= 57; // percentage - } + case SPELL_AURA_MOD_BASE_RESISTANCE_PCT: + if (!caster) + break; + if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID) + { + if (GetId() == 1178 && caster->HasAura(5229) && !caster->HasAura(70726)) // Feral t10 4p + amount -= 48; // percentage + else if (GetId() == 9635 && caster->HasAura(5229) && !caster->HasAura(70726)) // Feral t10 4p + amount -= 57; // percentage + } break; - case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE: - // Titan's Grip - if (!caster) - break; - if (GetId() == 49152 && caster->ToPlayer()) - { - Item *item1 = caster->ToPlayer()->GetWeaponForAttack(BASE_ATTACK); - Item *item2 = caster->ToPlayer()->GetWeaponForAttack(OFF_ATTACK); + case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE: + // Titan's Grip + if (!caster) + break; + if (GetId() == 49152 && caster->ToPlayer()) + { + Item *item1 = caster->ToPlayer()->GetWeaponForAttack(BASE_ATTACK); + Item *item2 = caster->ToPlayer()->GetWeaponForAttack(OFF_ATTACK); - if (item1 && item2 && (item1->GetTemplate()->InventoryType == INVTYPE_2HWEAPON || item2->GetTemplate()->InventoryType == INVTYPE_2HWEAPON)) - amount = -10; - else - amount = 0; - } + if (item1 && item2 && (item1->GetTemplate()->InventoryType == INVTYPE_2HWEAPON || item2->GetTemplate()->InventoryType == INVTYPE_2HWEAPON)) + amount = -10; + else + amount = 0; + } + break; + default: break; - default: - break; } - // xinef: save base amount, before calculating sp etc. Used for Unit::CastDelayedSpellWithPeriodicAmount - SetOldAmount(amount*GetBase()->GetStackAmount()); - GetBase()->CallScriptEffectCalcAmountHandlers(this, amount, m_canBeRecalculated); + // xinef: save base amount, before calculating sp etc. Used for Unit::CastDelayedSpellWithPeriodicAmount + SetOldAmount(amount*GetBase()->GetStackAmount()); + GetBase()->CallScriptEffectCalcAmountHandlers(this, amount, m_canBeRecalculated); - // Xinef: Periodic auras - if (caster) - switch (GetAuraType()) - { - case SPELL_AURA_PERIODIC_DAMAGE: - // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value! - if (GetBase()->GetType() == UNIT_AURA_TYPE) - amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetPctMods(), 1); - break; - case SPELL_AURA_PERIODIC_LEECH: - // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value! - if (GetBase()->GetType() == UNIT_AURA_TYPE) - amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetPctMods(), 1); - break; - case SPELL_AURA_PERIODIC_HEAL: - if (GetBase()->GetType() == UNIT_AURA_TYPE) - amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetPctMods(), 1); - break; - case SPELL_AURA_DAMAGE_SHIELD: - if (GetBase()->GetType() == UNIT_AURA_TYPE) - amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE, 0.0f, 1); - break; - } + // Xinef: Periodic auras + if (caster) + switch (GetAuraType()) + { + case SPELL_AURA_PERIODIC_DAMAGE: + // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value! + if (GetBase()->GetType() == UNIT_AURA_TYPE) + amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetPctMods(), 1); + break; + case SPELL_AURA_PERIODIC_LEECH: + // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value! + if (GetBase()->GetType() == UNIT_AURA_TYPE) + amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetPctMods(), 1); + break; + case SPELL_AURA_PERIODIC_HEAL: + if (GetBase()->GetType() == UNIT_AURA_TYPE) + amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetPctMods(), 1); + break; + case SPELL_AURA_DAMAGE_SHIELD: + if (GetBase()->GetType() == UNIT_AURA_TYPE) + amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE, 0.0f, 1); + break; + } amount *= GetBase()->GetStackAmount(); return amount; @@ -560,17 +560,17 @@ int32 AuraEffect::CalculateAmount(Unit* caster) void AuraEffect::CalculatePeriodicData() { - // xinef: save caster depending auras with pct mods - if (GetBase()->GetType() == UNIT_AURA_TYPE && GetCaster()) - { - if (m_spellInfo->HasAura(SPELL_AURA_PERIODIC_HEAL)) - m_pctMods = GetCaster()->SpellPctHealingModsDone(GetBase()->GetUnitOwner(), GetSpellInfo(), DOT); - else if (m_spellInfo->HasAura(SPELL_AURA_PERIODIC_DAMAGE) || m_spellInfo->HasAura(SPELL_AURA_PERIODIC_LEECH)) - m_pctMods = GetCaster()->SpellPctDamageModsDone(GetBase()->GetUnitOwner(), GetSpellInfo(), DOT); - } + // xinef: save caster depending auras with pct mods + if (GetBase()->GetType() == UNIT_AURA_TYPE && GetCaster()) + { + if (m_spellInfo->HasAura(SPELL_AURA_PERIODIC_HEAL)) + m_pctMods = GetCaster()->SpellPctHealingModsDone(GetBase()->GetUnitOwner(), GetSpellInfo(), DOT); + else if (m_spellInfo->HasAura(SPELL_AURA_PERIODIC_DAMAGE) || m_spellInfo->HasAura(SPELL_AURA_PERIODIC_LEECH)) + m_pctMods = GetCaster()->SpellPctDamageModsDone(GetBase()->GetUnitOwner(), GetSpellInfo(), DOT); + } - if (GetCaster()) - SetCritChance(CalcPeriodicCritChance(GetCaster(), (GetBase()->GetType() == UNIT_AURA_TYPE ? GetBase()->GetUnitOwner() : NULL))); + if (GetCaster()) + SetCritChance(CalcPeriodicCritChance(GetCaster(), (GetBase()->GetType() == UNIT_AURA_TYPE ? GetBase()->GetUnitOwner() : NULL))); } void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load) @@ -607,9 +607,9 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load) if (!m_isPeriodic) return; - // Xinef: fix broken data in dbc - if (m_amplitude <= 0) - m_amplitude = 1000; + // Xinef: fix broken data in dbc + if (m_amplitude <= 0) + m_amplitude = 1000; Player* modOwner = caster ? caster->GetSpellModOwner() : NULL; @@ -622,7 +622,7 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load) if (caster) { - if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)) + if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)) m_amplitude = int32(m_amplitude * caster->GetFloatValue(UNIT_MOD_CAST_SPEED)); } } @@ -648,16 +648,16 @@ void AuraEffect::CalculatePeriodic(Unit* caster, bool create, bool load) m_periodicTimer = 0; // Start periodic on next tick or at aura apply if (m_amplitude) - { - if (!GetSpellInfo()->HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY)) - m_periodicTimer += m_amplitude; - else if (caster && caster->IsTotem()) // for totems only ;d - { - m_periodicTimer = 100; // make it ALMOST instant - if (!GetBase()->IsPassive()) - GetBase()->SetDuration(GetBase()->GetDuration()+100); - } - } + { + if (!GetSpellInfo()->HasAttribute(SPELL_ATTR5_START_PERIODIC_AT_APPLY)) + m_periodicTimer += m_amplitude; + else if (caster && caster->IsTotem()) // for totems only ;d + { + m_periodicTimer = 100; // make it ALMOST instant + if (!GetBase()->IsPassive()) + GetBase()->SetDuration(GetBase()->GetDuration()+100); + } + } } } } @@ -736,12 +736,12 @@ void AuraEffect::HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply) if (mode & AURA_EFFECT_HANDLE_REAL) aurApp->GetTarget()->_RegisterAuraEffect(this, apply); - // xinef: stacking system, force return if effect is disabled, prevents double apply / unapply - // xinef: placed here so above line can unregister effect from the list - // xinef: this condition works under assumption that effect handlers performs ALL necessery action with CHANGE_AMOUNT mode - // xinef: as far as i've checked, all grouped spells meet this condition - if (!aurApp->IsActive(GetEffIndex())) - return; + // xinef: stacking system, force return if effect is disabled, prevents double apply / unapply + // xinef: placed here so above line can unregister effect from the list + // xinef: this condition works under assumption that effect handlers performs ALL necessery action with CHANGE_AMOUNT mode + // xinef: as far as i've checked, all grouped spells meet this condition + if (!aurApp->IsActive(GetEffIndex())) + return; // real aura apply/remove, handle modifier if (mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK) @@ -832,18 +832,18 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply) } } - Pet* pet = target->ToPlayer()->GetPet(); - if (!pet) - break; + Pet* pet = target->ToPlayer()->GetPet(); + if (!pet) + break; - uint64 petguid = pet->GetGUID(); + uint64 petguid = pet->GetGUID(); Unit::AuraApplicationMap & petauras = pet->GetAppliedAuras(); for (Unit::AuraApplicationMap::iterator iter = petauras.begin(); iter != petauras.end(); ++iter) { Aura* aura = iter->second->GetBase(); // only passive auras-active auras should have amount set on spellcast and not be affected // if aura is casted by others, it will not be affected - if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == petguid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod)) + if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == petguid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod)) { if (GetMiscValue() == SPELLMOD_ALL_EFFECTS) { @@ -880,8 +880,8 @@ void AuraEffect::Update(uint32 diff, Unit* caster) { if (m_isPeriodic && (GetBase()->GetDuration() >=0 || GetBase()->IsPassive() || GetBase()->IsPermanent())) { - m_periodicTimer -= int32(diff); - while (m_periodicTimer <= 0) + m_periodicTimer -= int32(diff); + while (m_periodicTimer <= 0) { ++m_tickNumber; @@ -990,16 +990,16 @@ void AuraEffect::UpdatePeriodic(Unit* caster) slow->ChangeAmount(newAmount); } break; - case 66020: - // Get 0 effect aura - if (AuraEffect *slow = GetBase()->GetEffect(0)) - { - int32 newAmount = slow->GetAmount() + GetAmount(); - if (newAmount > 0) - newAmount = 0; - slow->ChangeAmount(newAmount); - } - break; + case 66020: + // Get 0 effect aura + if (AuraEffect *slow = GetBase()->GetEffect(0)) + { + int32 newAmount = slow->GetAmount() + GetAmount(); + if (newAmount > 0) + newAmount = 0; + slow->ChangeAmount(newAmount); + } + break; default: break; } @@ -1015,35 +1015,35 @@ void AuraEffect::UpdatePeriodic(Unit* caster) float AuraEffect::CalcPeriodicCritChance(Unit const* caster, Unit const* target) const { - float critChance = 0.0f; - if (caster) - { - if (Player* modOwner = caster->GetSpellModOwner()) - { - Unit::AuraEffectList const& mPeriodicCritAuras = modOwner->GetAuraEffectsByType(SPELL_AURA_ABILITY_PERIODIC_CRIT); - for (Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr) - { - if ((*itr)->IsAffectedOnSpell(GetSpellInfo())) - { - critChance = modOwner->SpellDoneCritChance(NULL, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), (GetSpellInfo()->DmgClass == SPELL_DAMAGE_CLASS_RANGED ? RANGED_ATTACK : BASE_ATTACK), true); - break; - } - } + float critChance = 0.0f; + if (caster) + { + if (Player* modOwner = caster->GetSpellModOwner()) + { + Unit::AuraEffectList const& mPeriodicCritAuras = modOwner->GetAuraEffectsByType(SPELL_AURA_ABILITY_PERIODIC_CRIT); + for (Unit::AuraEffectList::const_iterator itr = mPeriodicCritAuras.begin(); itr != mPeriodicCritAuras.end(); ++itr) + { + if ((*itr)->IsAffectedOnSpell(GetSpellInfo())) + { + critChance = modOwner->SpellDoneCritChance(NULL, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), (GetSpellInfo()->DmgClass == SPELL_DAMAGE_CLASS_RANGED ? RANGED_ATTACK : BASE_ATTACK), true); + break; + } + } - switch(GetSpellInfo()->SpellFamilyName) - { - // Rupture - since 3.3.3 can crit - case SPELLFAMILY_ROGUE: - if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100000) - critChance = modOwner->SpellDoneCritChance(NULL, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), BASE_ATTACK, true); - break; - } - } - } - if (target && critChance > 0.0f) - critChance = target->SpellTakenCritChance(caster, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), critChance, BASE_ATTACK, true); + switch(GetSpellInfo()->SpellFamilyName) + { + // Rupture - since 3.3.3 can crit + case SPELLFAMILY_ROGUE: + if (GetSpellInfo()->SpellFamilyFlags[0] & 0x100000) + critChance = modOwner->SpellDoneCritChance(NULL, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), BASE_ATTACK, true); + break; + } + } + } + if (target && critChance > 0.0f) + critChance = target->SpellTakenCritChance(caster, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), critChance, BASE_ATTACK, true); - return std::max(0.0f, critChance); + return std::max(0.0f, critChance); } bool AuraEffect::IsAffectedOnSpell(SpellInfo const* spell) const @@ -1246,7 +1246,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const break; } - Player* player = target->ToPlayer(); + Player* player = target->ToPlayer(); if (apply) { // Remove cooldown of spells triggered on stance change - they may share cooldown with stance spell @@ -1269,7 +1269,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const const PlayerSpellMap& sp_list = player->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { - if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(player->GetActiveSpec())) + if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(player->GetActiveSpec())) continue; if (itr->first == spellId || itr->first == spellId2) @@ -1283,19 +1283,19 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const target->CastSpell(target, itr->first, true, NULL, this, target->GetGUID()); } - // xinef: talent stance auras are not on m_spells map, so iterate talents - const PlayerTalentMap& tl_list = player->GetTalentMap(); + // xinef: talent stance auras are not on m_spells map, so iterate talents + const PlayerTalentMap& tl_list = player->GetTalentMap(); for (PlayerTalentMap::const_iterator itr = tl_list.begin(); itr != tl_list.end(); ++itr) { - if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(player->GetActiveSpec())) + if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(player->GetActiveSpec())) continue; if (itr->first == spellId || itr->first == spellId2) continue; - // Xinef: skip talents with effect learn spell + // Xinef: skip talents with effect learn spell SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - if (!spellInfo || !spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)) || spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) + if (!spellInfo || !spellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)) || spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) continue; if (spellInfo->Stances & (1<<(GetMiscValue()-1))) @@ -1319,7 +1319,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const } // Leader of the Pack - if (player->HasTalent(17007, player->GetActiveSpec())) + if (player->HasTalent(17007, player->GetActiveSpec())) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(24932); if (spellInfo && spellInfo->Stances & (1<<(GetMiscValue()-1))) @@ -1420,7 +1420,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const // Improved Barkskin - apply/remove armor bonus due to shapeshift if (player) { - if (player->HasTalent(63410, player->GetActiveSpec()) || player->HasTalent(63411, player->GetActiveSpec())) + if (player->HasTalent(63410, player->GetActiveSpec()) || player->HasTalent(63411, player->GetActiveSpec())) { target->RemoveAurasDueToSpell(66530); target->CastSpell(target, 66530, true); @@ -1438,7 +1438,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const break; } } - + // Use the new aura to see on what stance the target will be uint32 newStance = (1<<((newAura ? newAura->GetMiscValue() : 0)-1)); @@ -1446,17 +1446,17 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();) { // If the stances are not compatible with the spell, remove it - // Xinef: Remove all passive auras, they will be added if needed - if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && (!(itr->second->GetBase()->GetSpellInfo()->Stances & newStance) || itr->second->GetBase()->IsPassive())) + // Xinef: Remove all passive auras, they will be added if needed + if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && (!(itr->second->GetBase()->GetSpellInfo()->Stances & newStance) || itr->second->GetBase()->IsPassive())) target->RemoveAura(itr); else ++itr; } - // Xinef: Remove autoattack spells - if (Spell* spell = target->GetCurrentSpell(CURRENT_MELEE_SPELL)) - if (spell->GetSpellInfo()->CheckShapeshift(newAura ? newAura->GetMiscValue() : 0) != SPELL_CAST_OK) - spell->cancel(true); + // Xinef: Remove autoattack spells + if (Spell* spell = target->GetCurrentSpell(CURRENT_MELEE_SPELL)) + if (spell->GetSpellInfo()->CheckShapeshift(newAura ? newAura->GetMiscValue() : 0) != SPELL_CAST_OK) + spell->cancel(true); } } @@ -1547,13 +1547,13 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); } - if (!apply && aurApp->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT) - { - target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID() || target->GetMap()->Instanceable()), true); - target->bRequestForcedVisibilityUpdate = false; - } - else - target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID()) || target->GetMap()->Instanceable()); + if (!apply && aurApp->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT) + { + target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID() || target->GetMap()->Instanceable()), true); + target->bRequestForcedVisibilityUpdate = false; + } + else + target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID()) || target->GetMap()->Instanceable()); } void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -1598,12 +1598,12 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo if (target->GetTypeId() == TYPEID_PLAYER) target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_STEALTH); - // interrupt autoshot - if (target->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)) - { - target->FinishSpell(CURRENT_AUTOREPEAT_SPELL); - target->ToPlayer()->SendAutoRepeatCancel(target); - } + // interrupt autoshot + if (target->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)) + { + target->FinishSpell(CURRENT_AUTOREPEAT_SPELL); + target->ToPlayer()->SendAutoRepeatCancel(target); + } } else { @@ -1626,13 +1626,13 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); } - if (!apply && aurApp->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT) - { - target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID() || target->GetMap()->Instanceable()), true); - target->bRequestForcedVisibilityUpdate = false; - } - else - target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID() || target->GetMap()->Instanceable())); + if (!apply && aurApp->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT) + { + target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID() || target->GetMap()->Instanceable()), true); + target->bRequestForcedVisibilityUpdate = false; + } + else + target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID() || target->GetMap()->Instanceable())); } void AuraEffect::HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -1677,14 +1677,14 @@ void AuraEffect::HandleSpiritOfRedemption(AuraApplication const* aurApp, uint8 m // die at aura end else if (target->IsAlive()) // call functions which may have additional effects after chainging state of unit - target->setDeathState(JUST_DIED); + target->setDeathState(JUST_DIED); - // xinef: damage immunity spell, not needed because of 93 aura (adds non_attackable state) - // xinef: probably blizzard added it just in case in wotlk (id > 46000) - if (apply) + // xinef: damage immunity spell, not needed because of 93 aura (adds non_attackable state) + // xinef: probably blizzard added it just in case in wotlk (id > 46000) + if (apply) target->CastSpell(target, 62371, true); - else - target->RemoveAurasDueToSpell(62371); + else + target->RemoveAurasDueToSpell(62371); } void AuraEffect::HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -1763,15 +1763,15 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases) if (target->IsVisible()) - { - if (!target->GetMap()->Instanceable()) - { - target->UpdateObjectVisibility(false); - target->m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f); - } - else - target->UpdateObjectVisibility(); - } + { + if (!target->GetMap()->Instanceable()) + { + target->UpdateObjectVisibility(false); + target->m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f); + } + else + target->UpdateObjectVisibility(); + } } /**********************/ @@ -1865,9 +1865,9 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo } // remove other shapeshift before applying a new one - // xinef: rogue shouldnt be wrapped by this check (shadow dance vs stealth) - if (GetSpellInfo()->SpellFamilyName != SPELLFAMILY_ROGUE) - target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, 0, GetBase()); + // xinef: rogue shouldnt be wrapped by this check (shadow dance vs stealth) + if (GetSpellInfo()->SpellFamilyName != SPELLFAMILY_ROGUE) + target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, 0, GetBase()); // stop handling the effect if it was removed by linked event if (aurApp->GetRemoveMode()) @@ -1898,18 +1898,18 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo int32 basePoints = int32(std::min(oldPower, FurorChance)); target->SetPower(POWER_ENERGY, 0); target->CastCustomSpell(target, 17099, &basePoints, NULL, NULL, true, NULL, this); - break; + break; } case FORM_BEAR: case FORM_DIREBEAR: - if (urand(0, 99) < FurorChance) - target->CastSpell(target, 17057, true); - break; + if (urand(0, 99) < FurorChance) + target->CastSpell(target, 17057, true); + break; default: { uint32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance); target->SetPower(POWER_ENERGY, newEnergy); - break; + break; } } break; @@ -1923,7 +1923,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo return; target->SetShapeshiftForm(form); - // xinef: allow shapeshift to override model id if forced transform aura is not present! + // xinef: allow shapeshift to override model id if forced transform aura is not present! if (modelid > 0) { bool allow = true; @@ -1982,11 +1982,11 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch) if (target->GetTypeId() == TYPEID_PLAYER) { - // Stance mastery - trainer spell + // Stance mastery - trainer spell PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { - if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec())) + if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec())) continue; SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); @@ -1994,11 +1994,11 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10; } - // Tactical Mastery - talent - PlayerTalentMap const& tp_list = target->ToPlayer()->GetTalentMap(); + // Tactical Mastery - talent + PlayerTalentMap const& tp_list = target->ToPlayer()->GetTalentMap(); for (PlayerTalentMap::const_iterator itr = tp_list.begin(); itr != tp_list.end(); ++itr) { - if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec())) + if (itr->second->State == PLAYERSPELL_REMOVED || !itr->second->IsInSpec(target->ToPlayer()->GetActiveSpec())) continue; SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); @@ -2070,7 +2070,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, if (apply) { // update active transform spell only when transform or shapeshift not set or not overwriting negative by positive case - if (GetSpellInfo()->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) || !target->GetModelForForm(target->GetShapeshiftForm()) || !GetSpellInfo()->IsPositive()) + if (GetSpellInfo()->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) || !target->GetModelForForm(target->GetShapeshiftForm()) || !GetSpellInfo()->IsPositive()) { // special case (spell specific functionality) if (GetMiscValue() == 0) @@ -2355,58 +2355,58 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) { - if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID()) - { - const SpellInfo* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo(); - if (si->HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE) && (*iter)->GetTypeId() == TYPEID_UNIT) - { - Creature* c = (*iter)->ToCreature(); - if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss()) - continue; - } - bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY) - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST)) - { - // at least one effect truly targets an unit, interrupt the spell - interrupt = true; - break; - } - if (interrupt) - (*iter)->InterruptSpell(CurrentSpellTypes(i), false); - } + if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID()) + { + const SpellInfo* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo(); + if (si->HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE) && (*iter)->GetTypeId() == TYPEID_UNIT) + { + Creature* c = (*iter)->ToCreature(); + if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss()) + continue; + } + bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY) + for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) + if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST)) + { + // at least one effect truly targets an unit, interrupt the spell + interrupt = true; + break; + } + if (interrupt) + (*iter)->InterruptSpell(CurrentSpellTypes(i), false); + } } } - if (target->GetInstanceScript() && target->GetInstanceScript()->IsEncounterInProgress()) - { - // Xinef: replaced with CombatStop(false) - target->AttackStop(); - target->RemoveAllAttackers(); - target->getHostileRefManager().addThreatPercent(-100); - target->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel - } - else - { - target->CombatStop(); - target->getHostileRefManager().deleteReferences(); - } + if (target->GetInstanceScript() && target->GetInstanceScript()->IsEncounterInProgress()) + { + // Xinef: replaced with CombatStop(false) + target->AttackStop(); + target->RemoveAllAttackers(); + target->getHostileRefManager().addThreatPercent(-100); + target->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel + } + else + { + target->CombatStop(); + target->getHostileRefManager().deleteReferences(); + } target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); // prevent interrupt message if (GetCasterGUID() == target->GetGUID()) - { - if (target->GetCurrentSpell(CURRENT_GENERIC_SPELL)) - target->FinishSpell(CURRENT_GENERIC_SPELL, true); + { + if (target->GetCurrentSpell(CURRENT_GENERIC_SPELL)) + target->FinishSpell(CURRENT_GENERIC_SPELL, true); - // interrupt autoshot - if (target->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)) - { - target->FinishSpell(CURRENT_AUTOREPEAT_SPELL); - target->ToPlayer()->SendAutoRepeatCancel(target); - } - } + // interrupt autoshot + if (target->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)) + { + target->FinishSpell(CURRENT_AUTOREPEAT_SPELL); + target->ToPlayer()->SendAutoRepeatCancel(target); + } + } target->InterruptNonMeleeSpells(true); @@ -2457,7 +2457,7 @@ void AuraEffect::HandleModUnattackable(AuraApplication const* aurApp, uint8 mode // call functions which may have additional effects after chainging state of unit if (apply && (mode & AURA_EFFECT_HANDLE_REAL)) { - // xinef: this aura should not stop combat (movie with sindragosa proves that) + // xinef: this aura should not stop combat (movie with sindragosa proves that) //target->CombatStop(); target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); } @@ -3162,7 +3162,7 @@ void AuraEffect::HandleAuraControlVehicle(AuraApplication const* aurApp, uint8 m caster->ToCreature()->RemoveCorpse(); } - caster->_ExitVehicle(); + caster->_ExitVehicle(); // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them caster->RemoveAurasDueToSpell(GetId()); } @@ -3421,7 +3421,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 } case 477: case 1733: - case 1632: + case 1632: { if (!GetAmount()) { @@ -3479,100 +3479,100 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 if (aura_immunity_list.empty()) { // Roots, OK - if (GetMiscValue() & (1<<0)) - { - mechanic_immunity_list = (1 << MECHANIC_SNARE); + if (GetMiscValue() & (1<<0)) + { + mechanic_immunity_list = (1 << MECHANIC_SNARE); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); - aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); - } - // Taunt, OK - if (GetMiscValue() & (1<<1)) - { - aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT); - } - // Crowd-Control auras? - if (GetMiscValue() & (1<<2)) - { - mechanic_immunity_list = (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED); + aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT); + } + // Taunt, OK + if (GetMiscValue() & (1<<1)) + { + aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT); + } + // Crowd-Control auras? + if (GetMiscValue() & (1<<2)) + { + mechanic_immunity_list = (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); - target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); - aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); - } - // Interrupt, OK - if (GetMiscValue() & (1<<3)) - { - mechanic_immunity_list = (1 << MECHANIC_INTERRUPT); + target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); + aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE); + } + // Interrupt, OK + if (GetMiscValue() & (1<<3)) + { + mechanic_immunity_list = (1 << MECHANIC_INTERRUPT); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, apply); - } - // Transform? - if (GetMiscValue() & (1<<4)) - { - aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); - } - // Stun auras breakable by damage (Incapacitate effects), OK - if (GetMiscValue() & (1<<5)) - { - mechanic_immunity_list = (1 << MECHANIC_KNOCKOUT); + } + // Transform? + if (GetMiscValue() & (1<<4)) + { + aura_immunity_list.push_back(SPELL_AURA_TRANSFORM); + } + // Stun auras breakable by damage (Incapacitate effects), OK + if (GetMiscValue() & (1<<5)) + { + mechanic_immunity_list = (1 << MECHANIC_KNOCKOUT); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_KNOCKOUT, apply); - } - // // Slowing effects - if (GetMiscValue() & (1<<6)) - { - mechanic_immunity_list = (1 << MECHANIC_SNARE); + } + // // Slowing effects + if (GetMiscValue() & (1<<6)) + { + mechanic_immunity_list = (1 << MECHANIC_SNARE); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); - aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); - } - // Charm auras?, 90% - if ((GetMiscValue() & (1<<7))) - { - mechanic_immunity_list = (1 << MECHANIC_CHARM); + aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED); + } + // Charm auras?, 90% + if ((GetMiscValue() & (1<<7))) + { + mechanic_immunity_list = (1 << MECHANIC_CHARM); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply); - aura_immunity_list.push_back(SPELL_AURA_MOD_CHARM); - aura_immunity_list.push_back(SPELL_AURA_MOD_POSSESS); - } - // UNK - if ((GetMiscValue() & (1<<8))) - { - } - // Fear, OK - if (GetMiscValue() & (1<<9)) - { - mechanic_immunity_list = (1 << MECHANIC_FEAR); + aura_immunity_list.push_back(SPELL_AURA_MOD_CHARM); + aura_immunity_list.push_back(SPELL_AURA_MOD_POSSESS); + } + // UNK + if ((GetMiscValue() & (1<<8))) + { + } + // Fear, OK + if (GetMiscValue() & (1<<9)) + { + mechanic_immunity_list = (1 << MECHANIC_FEAR); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply); - aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR); - } - // Stuns, OK - if (GetMiscValue() & (1<<10)) - { - mechanic_immunity_list = (1 << MECHANIC_STUN); + aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR); + } + // Stuns, OK + if (GetMiscValue() & (1<<10)) + { + mechanic_immunity_list = (1 << MECHANIC_STUN); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); - aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); - } + aura_immunity_list.push_back(SPELL_AURA_MOD_STUN); + } } // apply immunities for (std::list ::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter) target->ApplySpellImmune(GetId(), IMMUNITY_STATE, *iter, apply); - // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated. + // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated. if (GetId() == 46924) { - if (apply) - { - target->resetAttackTimer(); - target->resetAttackTimer(OFF_ATTACK); - } + if (apply) + { + target->resetAttackTimer(); + target->resetAttackTimer(OFF_ATTACK); + } - // Knockback and hex - target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, apply); + // Knockback and hex + target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, apply); } if (apply && GetSpellInfo()->HasAttribute(SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)) @@ -3615,16 +3615,16 @@ void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8 break; case 42292: // PvP trinket case 59752: // Every Man for Himself - case 65547: // PvP trinket for Faction Champions (ToC 25) - case 53490: // Bullheaded - case 46227: // Medalion of Immunity + case 65547: // PvP trinket for Faction Champions (ToC 25) + case 53490: // Bullheaded + case 46227: // Medalion of Immunity mechanic = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; - target->RemoveAurasByType(SPELL_AURA_PREVENTS_FLEEING); // xinef: Patch 2.3.0 PvP Trinkets: Insignia of the Alliance, Insignia of the Horde, Medallion of the Alliance, and Medallion of the Horde now clear the debuff from Judgement of Justice. + target->RemoveAurasByType(SPELL_AURA_PREVENTS_FLEEING); // xinef: Patch 2.3.0 PvP Trinkets: Insignia of the Alliance, Insignia of the Horde, Medallion of the Alliance, and Medallion of the Horde now clear the debuff from Judgement of Justice. // Actually we should apply immunities here, too, but the aura has only 100 ms duration, so there is practically no point break; case 54508: // Demonic Empowerment mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT); - target->RemoveAurasByType(SPELL_AURA_MOD_STUN); + target->RemoveAurasByType(SPELL_AURA_MOD_STUN); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply); target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply); @@ -3638,13 +3638,13 @@ void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8 } if (apply && GetSpellInfo()->HasAttribute(SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)) - { - // Xinef: exception for purely snare mechanic (eg. hands of freedom)! - if (mechanic == (1 << MECHANIC_SNARE)) - target->RemoveMovementImpairingAuras(false); + { + // Xinef: exception for purely snare mechanic (eg. hands of freedom)! + if (mechanic == (1 << MECHANIC_SNARE)) + target->RemoveMovementImpairingAuras(false); else - target->RemoveAurasWithMechanic(mechanic, AURA_REMOVE_BY_DEFAULT, GetId()); - } + target->RemoveAurasWithMechanic(mechanic, AURA_REMOVE_BY_DEFAULT, GetId()); + } } void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -4040,38 +4040,38 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 // save current health state float healthPct = target->GetHealthPct(); bool alive = target->IsAlive(); - float value = GetAmount(); + float value = GetAmount(); - if (GetId() == 67480) // xinef: hack fix for blessing of sanctuary stats stack with blessing of kings... - { - if (value) // not turned off - value = 10.0f; - for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++) - { - if (i == STAT_STRENGTH || i == STAT_STAMINA) - { - if (apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) - target->ApplyStatPercentBuffMod(Stats(i), value, apply); + if (GetId() == 67480) // xinef: hack fix for blessing of sanctuary stats stack with blessing of kings... + { + if (value) // not turned off + value = 10.0f; + for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++) + { + if (i == STAT_STRENGTH || i == STAT_STAMINA) + { + if (apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) + target->ApplyStatPercentBuffMod(Stats(i), value, apply); - target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply); + target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply); - if (!apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) - target->ApplyStatPercentBuffMod(Stats(i), value, apply); - } - } - return; - } + if (!apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) + target->ApplyStatPercentBuffMod(Stats(i), value, apply); + } + } + return; + } for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++) { if (GetMiscValue() == i || GetMiscValue() == -1) { - if (apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) + if (apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) target->ApplyStatPercentBuffMod(Stats(i), value, apply); target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, value, apply); - if (!apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) + if (!apply && (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())) target->ApplyStatPercentBuffMod(Stats(i), value, apply); } } @@ -4264,10 +4264,10 @@ void AuraEffect::HandleAuraModIncreaseHealthPercent(AuraApplication const* aurAp float percent = target->GetHealthPct(); target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(GetAmount()), apply); - // Xinef: idiots, pct was rounded down and could "kill" creature by setting its health to 0 making npc zombie + // Xinef: idiots, pct was rounded down and could "kill" creature by setting its health to 0 making npc zombie if (target->IsAlive()) - if (uint32 healthAmount = CalculatePct(target->GetMaxHealth(), percent)) - target->SetHealth(healthAmount); + if (uint32 healthAmount = CalculatePct(target->GetMaxHealth(), percent)) + target->SetHealth(healthAmount); } void AuraEffect::HandleAuraIncreaseBaseHealthPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -4450,12 +4450,12 @@ void AuraEffect::HandleModCastingSpeed(AuraApplication const* aurApp, uint8 mode Unit* target = aurApp->GetTarget(); - // Xinef: Do not apply such auras in normal way - if (GetAmount() >= 1000) - { - target->SetInstantCast(apply); - return; - } + // Xinef: Do not apply such auras in normal way + if (GetAmount() >= 1000) + { + target->SetInstantCast(apply); + return; + } target->ApplyCastTimePercentMod((float)GetAmount(), apply); } @@ -4928,7 +4928,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool Aura* pet_aura = pet->GetAura(58914, GetCasterGUID()); if (owner_aura) { - owner_aura->SetCharges(0); + owner_aura->SetCharges(0); owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount); if (pet_aura) { @@ -4993,11 +4993,11 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use break; case 71563: - { + { if (Aura* newAura = target->AddAura(71564, target)) newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount); - return; - } + return; + } } } // AT REMOVE @@ -5060,41 +5060,41 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool case 60244: // Blood Parrot Despawn Aura target->CastSpell((Unit*)NULL, GetAmount(), true, NULL, this); break; - // Halls of Lightning, Arc Lightning - case 52921: - { - if( aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE ) - return; + // Halls of Lightning, Arc Lightning + case 52921: + { + if( aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE ) + return; - Player* player = NULL; - Trinity::AnyPlayerInObjectRangeCheck checker(target, 10.0f); - Trinity::PlayerSearcher searcher(target, player, checker); - target->VisitNearbyWorldObject(10.0f, searcher); + Player* player = NULL; + Trinity::AnyPlayerInObjectRangeCheck checker(target, 10.0f); + Trinity::PlayerSearcher searcher(target, player, checker); + target->VisitNearbyWorldObject(10.0f, searcher); - if( player && player->GetGUID() != target->GetGUID() ) - target->CastSpell(player, 52921, true); + if( player && player->GetGUID() != target->GetGUID() ) + target->CastSpell(player, 52921, true); - return; - } + return; + } case 58600: // Restricted Flight Area - case 58730: // Restricted Flight Area + case 58730: // Restricted Flight Area if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) target->CastSpell(target, 58601, true); break; - case 46374: // quest The Power of the Elements (11893) - { - if (target->isDead() && GetBase() && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == 24601) - { - Unit* caster = GetBase()->GetCaster(); - if (caster && caster->GetTypeId() == TYPEID_PLAYER) - caster->ToPlayer()->KilledMonsterCredit(25987, 0); - } - return; - } + case 46374: // quest The Power of the Elements (11893) + { + if (target->isDead() && GetBase() && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == 24601) + { + Unit* caster = GetBase()->GetCaster(); + if (caster && caster->GetTypeId() == TYPEID_PLAYER) + caster->ToPlayer()->KilledMonsterCredit(25987, 0); + } + return; + } } break; - default: - break; + default: + break; } } } @@ -5456,7 +5456,7 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo { if (apply) { - Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCaster() : target; + Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCaster() : target; if (!caster) return; @@ -5726,8 +5726,8 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) // Thaumaturgy Channel case 9712: triggerSpellId = 21029; - if (caster) - caster->CastSpell(caster, triggerSpellId, true); + if (caster) + caster->CastSpell(caster, triggerSpellId, true); return; // Brood Affliction: Bronze case 23170: @@ -5762,12 +5762,12 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) return; // Frost Blast case 27808: - if (caster) - { - caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, NULL, this); - if (GetTickNumber() == 1) - caster->CastSpell(target, 27808, true); - } + if (caster) + { + caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, NULL, this); + if (GetTickNumber() == 1) + caster->CastSpell(target, 27808, true); + } return; // Inoculate Nestlewood Owlkin case 29528: @@ -5852,14 +5852,14 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) // Ball of Flames Visual case 71706: return; - // Oculus, Mage-Lord Urom, Time Bomb - case 51121: - case 59376: - { - const int32 dmg = target->GetMaxHealth()-target->GetHealth(); - target->CastCustomSpell(target, 51132, &dmg, 0, 0, true); - return; - } + // Oculus, Mage-Lord Urom, Time Bomb + case 51121: + case 59376: + { + const int32 dmg = target->GetMaxHealth()-target->GetHealth(); + target->CastCustomSpell(target, 51132, &dmg, 0, 0, true); + return; + } } break; } @@ -5900,12 +5900,12 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) return; // Eye of Eternity, Malygos, Arcane Overload case 56432: - if (triggerSpellId==56438) - { - target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)(10000*(1.0f-0.02f*(m_tickNumber+1))), NULL, true, NULL, this); - return; - } - break; + if (triggerSpellId==56438) + { + target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)(10000*(1.0f-0.02f*(m_tickNumber+1))), NULL, true, NULL, this); + return; + } + break; // Beacon of Light case 53563: { @@ -5921,36 +5921,36 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) caster->CastSpell(target, triggerSpellId, true, NULL, NULL, caster->GetGUID()); return; } - // Trial of the Crusader, Jaraxxus, Spinning Pain Spike - case 66283: - { - const int32 dmg = target->GetMaxHealth()/2; - target->CastCustomSpell(target, 66316, &dmg, NULL, NULL, true); - return; - } - // Violet Hold, Moragg, Ray of Suffering, Ray of Pain - case 54442: - case 59524: - case 54438: - case 59523: - { + // Trial of the Crusader, Jaraxxus, Spinning Pain Spike + case 66283: + { + const int32 dmg = target->GetMaxHealth()/2; + target->CastCustomSpell(target, 66316, &dmg, NULL, NULL, true); + return; + } + // Violet Hold, Moragg, Ray of Suffering, Ray of Pain + case 54442: + case 59524: + case 54438: + case 59523: + { if (caster) - if (Unit* victim = caster->GetVictim()) - if(victim->GetDistance(caster)<45.0f) - { - target = victim; - break; - } - return; - } - // quest A Tangled Skein (12555) - case 51165: - { - if( caster && caster->GetTypeId() == TYPEID_PLAYER ) - caster->ToPlayer()->KilledMonsterCredit(28289, 0); + if (Unit* victim = caster->GetVictim()) + if(victim->GetDistance(caster)<45.0f) + { + target = victim; + break; + } + return; + } + // quest A Tangled Skein (12555) + case 51165: + { + if( caster && caster->GetTypeId() == TYPEID_PLAYER ) + caster->ToPlayer()->KilledMonsterCredit(28289, 0); - break; - } + break; + } case 24745: // Summon Templar, Trigger case 24747: // Summon Templar Fire, Trigger case 24757: // Summon Templar Air, Trigger @@ -5973,12 +5973,12 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) caster->CastSpell(target, triggerSpellId, false); return; } - // Hunter - Rapid Recuperation - case 56654: - case 58882: - int32 amount = int32(target->GetMaxPower(POWER_MANA) * GetAmount() / 100.0f); - target->CastCustomSpell(target, triggerSpellId, &amount, NULL, NULL, true); - return; + // Hunter - Rapid Recuperation + case 56654: + case 58882: + int32 amount = int32(target->GetMaxPower(POWER_MANA) * GetAmount() / 100.0f); + target->CastCustomSpell(target, triggerSpellId, &amount, NULL, NULL, true); + return; } } @@ -5989,20 +5989,20 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) { if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target) { - SpellCastTargets targets; - targets.SetUnitTarget(target); - if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData) - { - targets.SetDstChannel(m_channelData->spellDst); - targets.SetObjectTargetChannel(m_channelData->channelGUID); - } + SpellCastTargets targets; + targets.SetUnitTarget(target); + if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData) + { + targets.SetDstChannel(m_channelData->spellDst); + targets.SetObjectTargetChannel(m_channelData->channelGUID); + } - // Xinef: do not skip reagent cost for entry casts - TriggerCastFlags triggerFlags = TRIGGERED_FULL_MASK; - if (GetSpellInfo()->Effects[GetEffIndex()].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || GetSpellInfo()->Effects[GetEffIndex()].TargetB.GetCheckType() == TARGET_CHECK_ENTRY) - triggerFlags = TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST); + // Xinef: do not skip reagent cost for entry casts + TriggerCastFlags triggerFlags = TRIGGERED_FULL_MASK; + if (GetSpellInfo()->Effects[GetEffIndex()].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || GetSpellInfo()->Effects[GetEffIndex()].TargetB.GetCheckType() == TARGET_CHECK_ENTRY) + triggerFlags = TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST); - triggerCaster->CastSpell(targets, triggeredSpellInfo, NULL, triggerFlags, NULL, this); + triggerCaster->CastSpell(targets, triggeredSpellInfo, NULL, triggerFlags, NULL, this); ;//sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); } } @@ -6015,18 +6015,18 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* { if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? caster : target) { - SpellCastTargets targets; - targets.SetUnitTarget(target); - if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData) - { - targets.SetDstChannel(m_channelData->spellDst); - targets.SetObjectTargetChannel(m_channelData->channelGUID); - } - - CustomSpellValues values; - values.AddSpellMod(SPELLVALUE_BASE_POINT0, GetAmount()); + SpellCastTargets targets; + targets.SetUnitTarget(target); + if (triggeredSpellInfo->IsChannelCategorySpell() && m_channelData) + { + targets.SetDstChannel(m_channelData->spellDst); + targets.SetObjectTargetChannel(m_channelData->channelGUID); + } + + CustomSpellValues values; + values.AddSpellMod(SPELLVALUE_BASE_POINT0, GetAmount()); - triggerCaster->CastSpell(targets, triggeredSpellInfo, &values, TRIGGERED_FULL_MASK, NULL, this); + triggerCaster->CastSpell(targets, triggeredSpellInfo, &values, TRIGGERED_FULL_MASK, NULL, this); ;//sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); } } @@ -6039,7 +6039,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const if (!target->IsAlive()) return; - if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamageOrSchool(GetSpellInfo()) || target->IsTotem()) + if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamageOrSchool(GetSpellInfo()) || target->IsTotem()) { SendTickImmune(target, caster); return; @@ -6085,15 +6085,15 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const if (GetAuraType() == SPELL_AURA_PERIODIC_DAMAGE) { - // xinef: leave only target depending bonuses, rest is handled in calculate amount - if (GetBase()->GetType() == DYNOBJ_AURA_TYPE) - damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, 0.0f, GetBase()->GetStackAmount()); + // xinef: leave only target depending bonuses, rest is handled in calculate amount + if (GetBase()->GetType() == DYNOBJ_AURA_TYPE) + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, 0.0f, GetBase()->GetStackAmount()); damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); // Calculate armor mitigation if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex())) { - uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel()); + uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel()); cleanDamage.mitigated_damage += damage - damageReductedArmor; damage = damageReductedArmor; } @@ -6129,35 +6129,35 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const else // xinef: ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner damage = uint32(ceil(CalculatePct(target->GetMaxHealth(), damage))); - // calculate crit chance - bool crit = false; + // calculate crit chance + bool crit = false; if (crit = roll_chance_f(GetCritChance())) - damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target); + damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target); int32 dmg = damage; - if (CanApplyResilience()) - Unit::ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL); + if (CanApplyResilience()) + Unit::ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL); damage = dmg; - Unit::CalcAbsorbResist(caster, target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo()); + Unit::CalcAbsorbResist(caster, target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo()); ;//sLog->outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", // GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); - Unit::DealDamageMods(target, damage, &absorb); + Unit::DealDamageMods(target, damage, &absorb); - // Auras reducing damage from AOE spells - if (GetSpellInfo()->Effects[GetEffIndex()].IsAreaAuraEffect() || GetSpellInfo()->Effects[GetEffIndex()].IsTargetingArea() || GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA) // some persistent area auras have targets like A=53 B=28 - { - damage = target->CalculateAOEDamageReduction(damage, GetSpellInfo()->SchoolMask, caster); - } + // Auras reducing damage from AOE spells + if (GetSpellInfo()->Effects[GetEffIndex()].IsAreaAuraEffect() || GetSpellInfo()->Effects[GetEffIndex()].IsTargetingArea() || GetSpellInfo()->Effects[GetEffIndex()].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA) // some persistent area auras have targets like A=53 B=28 + { + damage = target->CalculateAOEDamageReduction(damage, GetSpellInfo()->SchoolMask, caster); + } // Set trigger flag uint32 procAttacker = PROC_FLAG_DONE_PERIODIC; uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC; uint32 procEx = (crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT) | PROC_EX_INTERNAL_DOT; - if (absorb > 0) - procEx |= PROC_EX_ABSORB; + if (absorb > 0) + procEx |= PROC_EX_ABSORB; damage = (damage <= absorb+resist) ? 0 : (damage-absorb-resist); if (damage) @@ -6170,9 +6170,9 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit); target->SendPeriodicAuraLog(&pInfo); - Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); - // allow null caster to call this function - caster->ProcDamageAndSpell(target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo()); + Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); + // allow null caster to call this function + caster->ProcDamageAndSpell(target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo()); } void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const @@ -6195,58 +6195,58 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); uint32 damage = std::max(GetAmount(), 0); - if (GetBase()->GetType() == DYNOBJ_AURA_TYPE) - damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, 0.0f, GetBase()->GetStackAmount()); + if (GetBase()->GetType() == DYNOBJ_AURA_TYPE) + damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, 0.0f, GetBase()->GetStackAmount()); damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); bool crit = false; - if (crit = roll_chance_f(GetCritChance())) - damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target); + if (crit = roll_chance_f(GetCritChance())) + damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target); // Calculate armor mitigation if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), m_effIndex)) { - uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel()); + uint32 damageReductedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetCasterLevel()); cleanDamage.mitigated_damage += damage - damageReductedArmor; damage = damageReductedArmor; } int32 dmg = damage; - if (CanApplyResilience()) - Unit::ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL); + if (CanApplyResilience()) + Unit::ApplyResilience(target, NULL, &dmg, crit, CR_CRIT_TAKEN_SPELL); damage = dmg; - Unit::CalcAbsorbResist(caster, target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, m_spellInfo); + Unit::CalcAbsorbResist(caster, target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, m_spellInfo); // Set trigger flag uint32 procAttacker = PROC_FLAG_DONE_PERIODIC; uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC; uint32 procEx = (crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT) | PROC_EX_INTERNAL_DOT; - if (absorb > 0) - procEx |= PROC_EX_ABSORB; + if (absorb > 0) + procEx |= PROC_EX_ABSORB; damage = (damage <= absorb+resist) ? 0 : (damage-absorb-resist); if (damage) procVictim |= PROC_FLAG_TAKEN_DAMAGE; - if (target->GetHealth() < damage) + if (target->GetHealth() < damage) damage = target->GetHealth(); ;//sLog->outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", // GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); - if (caster) - caster->SendSpellNonMeleeDamageLog(target, GetId(), damage+absorb+resist, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit); + if (caster) + caster->SendSpellNonMeleeDamageLog(target, GetId(), damage+absorb+resist, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit); int32 new_damage; - new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false); - // allow null caster to call this function - caster->ProcDamageAndSpell(target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo()); + new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false); + // allow null caster to call this function + caster->ProcDamageAndSpell(target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo()); - if (!caster || !caster->IsAlive()) - return; + if (!caster || !caster->IsAlive()) + return; float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster); @@ -6307,118 +6307,118 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const // ignore negative values (can be result apply spellmods to aura damage int32 damage = std::max(m_amount, 0); - if (GetAuraType() == SPELL_AURA_OBS_MOD_HEALTH) - { - // Taken mods - float TakenTotalMod = 1.0f; + if (GetAuraType() == SPELL_AURA_OBS_MOD_HEALTH) + { + // Taken mods + float TakenTotalMod = 1.0f; - // Tenacity increase healing % taken - if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0)) - AddPct(TakenTotalMod, Tenacity->GetAmount()); + // Tenacity increase healing % taken + if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0)) + AddPct(TakenTotalMod, Tenacity->GetAmount()); - // Healing taken percent - float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); - if (minval) - AddPct(TakenTotalMod, minval); + // Healing taken percent + float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + if (minval) + AddPct(TakenTotalMod, minval); - float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); - if (maxval) - AddPct(TakenTotalMod, maxval); + float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); + if (maxval) + AddPct(TakenTotalMod, maxval); - // Healing over time taken percent - float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); - if (minval_hot) - AddPct(TakenTotalMod, minval_hot); + // Healing over time taken percent + float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT); + if (minval_hot) + AddPct(TakenTotalMod, minval_hot); - float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); - if (maxval_hot) - AddPct(TakenTotalMod, maxval_hot); + float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT); + if (maxval_hot) + AddPct(TakenTotalMod, maxval_hot); - // Arena / BG Dampening - float minval_pct = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT); - if (minval_pct) - AddPct(TakenTotalMod, minval_pct); + // Arena / BG Dampening + float minval_pct = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT); + if (minval_pct) + AddPct(TakenTotalMod, minval_pct); - TakenTotalMod = std::max(TakenTotalMod, 0.0f); + TakenTotalMod = std::max(TakenTotalMod, 0.0f); - // the most ugly hack i made :P the other option is to change all spellvalues to float... - // demonic aegis - if (caster && GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[1] & 0x20000000)) - if (AuraEffect *aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_WARLOCK, 89, 0)) - AddPct(TakenTotalMod, aurEff->GetAmount()); + // the most ugly hack i made :P the other option is to change all spellvalues to float... + // demonic aegis + if (caster && GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[1] & 0x20000000)) + if (AuraEffect *aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_WARLOCK, 89, 0)) + AddPct(TakenTotalMod, aurEff->GetAmount()); - damage = uint32(target->CountPctFromMaxHealth(damage)); - damage = uint32(damage * TakenTotalMod); - } - else - { - // Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100 - if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellInfo()->SpellIconID == 2864) - { - uint32 tickNumber = GetTickNumber()-1; - int32 tempAmount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, NULL); + damage = uint32(target->CountPctFromMaxHealth(damage)); + damage = uint32(damage * TakenTotalMod); + } + else + { + // Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100 + if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellInfo()->SpellIconID == 2864) + { + uint32 tickNumber = GetTickNumber()-1; + int32 tempAmount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, NULL); - float drop = 2.0f; + float drop = 2.0f; - // Item - Druid T10 Restoration 2P Bonus - if (caster) - if (AuraEffect* aurEff = caster->GetAuraEffect(70658, 0)) - AddPct(drop, -aurEff->GetAmount()); + // Item - Druid T10 Restoration 2P Bonus + if (caster) + if (AuraEffect* aurEff = caster->GetAuraEffect(70658, 0)) + AddPct(drop, -aurEff->GetAmount()); - damage += GetTotalTicks() * tempAmount * (6-(drop*tickNumber)) * 0.01f; - } + damage += GetTotalTicks() * tempAmount * (6-(drop*tickNumber)) * 0.01f; + } - if (GetBase()->GetType() == DYNOBJ_AURA_TYPE) - damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, 0.0f, GetBase()->GetStackAmount()); + if (GetBase()->GetType() == DYNOBJ_AURA_TYPE) + damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, 0.0f, GetBase()->GetStackAmount()); damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); } - bool crit = false; - if (crit = roll_chance_f(GetCritChance())) - damage = Unit::SpellCriticalHealingBonus(caster, GetSpellInfo(), damage, target); + bool crit = false; + if (crit = roll_chance_f(GetCritChance())) + damage = Unit::SpellCriticalHealingBonus(caster, GetSpellInfo(), damage, target); - ;//sLog->outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", - // GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId()); + ;//sLog->outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", + // GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId()); - uint32 absorb = 0; - uint32 heal = uint32(damage); - Unit::CalcHealAbsorb(target, GetSpellInfo(), heal, absorb); - int32 gain = Unit::DealHeal(caster, target, heal); + uint32 absorb = 0; + uint32 heal = uint32(damage); + Unit::CalcHealAbsorb(target, GetSpellInfo(), heal, absorb); + int32 gain = Unit::DealHeal(caster, target, heal); - SpellPeriodicAuraLogInfo pInfo(this, heal, heal - gain, absorb, 0, 0.0f, crit); - target->SendPeriodicAuraLog(&pInfo); + SpellPeriodicAuraLogInfo pInfo(this, heal, heal - gain, absorb, 0, 0.0f, crit); + target->SendPeriodicAuraLog(&pInfo); - if (caster) - target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo()); + if (caster) + target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo()); - bool haveCastItem = GetBase()->GetCastItemGUID() != 0; + bool haveCastItem = GetBase()->GetCastItemGUID() != 0; - // Health Funnel - // damage caster for heal amount - // xinef: caster is available, checked earlier - if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_HEALTH_FUNNEL)) - { - uint32 damage = GetSpellInfo()->ManaPerSecond; - if ((int32)damage > gain && gain > 0) - damage = gain; + // Health Funnel + // damage caster for heal amount + // xinef: caster is available, checked earlier + if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_HEALTH_FUNNEL)) + { + uint32 damage = GetSpellInfo()->ManaPerSecond; + if ((int32)damage > gain && gain > 0) + damage = gain; - uint32 absorb = 0; - Unit::DealDamageMods(caster, damage, &absorb); + uint32 absorb = 0; + Unit::DealDamageMods(caster, damage, &absorb); - CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); - Unit::DealDamage(caster, caster, damage, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); - } + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); + Unit::DealDamage(caster, caster, damage, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); + } - uint32 procAttacker = PROC_FLAG_DONE_PERIODIC; - uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC; - uint32 procEx = (crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT) | PROC_EX_INTERNAL_HOT; - if (absorb > 0) - procEx |= PROC_EX_ABSORB; + uint32 procAttacker = PROC_FLAG_DONE_PERIODIC; + uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC; + uint32 procEx = (crit ? PROC_EX_CRITICAL_HIT : PROC_EX_NORMAL_HIT) | PROC_EX_INTERNAL_HOT; + if (absorb > 0) + procEx |= PROC_EX_ABSORB; - // ignore item heals - if (!haveCastItem && GetAuraType() != SPELL_AURA_OBS_MOD_HEALTH) // xinef: dont allow obs_mod_health to proc spells, this is passive regeneration and not hot - // xinef: allow null caster to proc - caster->ProcDamageAndSpell(target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo()); + // ignore item heals + if (!haveCastItem && GetAuraType() != SPELL_AURA_OBS_MOD_HEALTH) // xinef: dont allow obs_mod_health to proc spells, this is passive regeneration and not hot + // xinef: allow null caster to proc + caster->ProcDamageAndSpell(target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo()); } void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) const @@ -6475,9 +6475,9 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con } target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo()); - - // remove CC auras - target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TAKE_DAMAGE); + + // remove CC auras + target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TAKE_DAMAGE); // Drain Mana if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK @@ -6595,7 +6595,7 @@ void AuraEffect::HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) con // no SpellDamageBonus for burn mana caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto); - Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); + Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); caster->SendSpellNonMeleeDamageLog(&damageInfo); @@ -6606,8 +6606,8 @@ void AuraEffect::HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) con if (damageInfo.damage) procVictim |= PROC_FLAG_TAKEN_DAMAGE; - caster->DealSpellDamage(&damageInfo, true); - caster->ProcDamageAndSpell(damageInfo.target, procAttacker, procVictim, procEx, damageInfo.damage, BASE_ATTACK, spellProto); + caster->DealSpellDamage(&damageInfo, true); + caster->ProcDamageAndSpell(damageInfo.target, procAttacker, procVictim, procEx, damageInfo.damage, BASE_ATTACK, spellProto); } void AuraEffect::HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) @@ -6649,7 +6649,7 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE); damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo()); - Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); + Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); target->SendSpellNonMeleeDamageLog(&damageInfo); ;//sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering %u spell damage from aura %u proc", damage, GetId()); target->DealSpellDamage(&damageInfo, true); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 8a5806917..92d66b843 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -53,8 +53,8 @@ class AuraEffect int32 GetMiscValueB() const { return m_spellInfo->Effects[m_effIndex].MiscValueB; } int32 GetMiscValue() const { return m_spellInfo->Effects[m_effIndex].MiscValue; } AuraType GetAuraType() const { return (AuraType)m_spellInfo->Effects[m_effIndex].ApplyAuraName; } - int32 GetAmount() const { return m_isAuraEnabled ? m_amount : 0; } - int32 GetForcedAmount() const { return m_amount; } + int32 GetAmount() const { return m_isAuraEnabled ? m_amount : 0; } + int32 GetForcedAmount() const { return m_amount; } void SetAmount(int32 amount) { m_amount = amount; m_canBeRecalculated = false;} int32 GetPeriodicTimer() const { return m_periodicTimer; } @@ -62,7 +62,7 @@ class AuraEffect int32 CalculateAmount(Unit* caster); void CalculatePeriodic(Unit* caster, bool create = false, bool load = false); - void CalculatePeriodicData(); + void CalculatePeriodicData(); void CalculateSpellMod(); void ChangeAmount(int32 newAmount, bool mark = true, bool onStackOrReapply = false); void RecalculateAmount() { if (!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(GetCaster()), false); } @@ -95,18 +95,18 @@ class AuraEffect // add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras void HandleShapeshiftBoosts(Unit* target, bool apply) const; - // xinef: storing initial crit chance - float GetCritChance() const { return m_critChance; } - void SetCritChance(float crit) { m_critChance = crit; } - uint8 GetCasterLevel() const { return m_casterLevel; } - bool CanApplyResilience() const { return m_applyResilience; } - float GetPctMods() const { return m_pctMods; } + // xinef: storing initial crit chance + float GetCritChance() const { return m_critChance; } + void SetCritChance(float crit) { m_critChance = crit; } + uint8 GetCasterLevel() const { return m_casterLevel; } + bool CanApplyResilience() const { return m_applyResilience; } + float GetPctMods() const { return m_pctMods; } - // xinef: stacking - uint32 GetAuraGroup() const { return m_auraGroup; } - int32 GetOldAmount() const { return m_oldAmount; } - void SetOldAmount(int32 amount) { m_oldAmount = amount; } - void SetEnabled(bool enabled) { m_isAuraEnabled = enabled; } + // xinef: stacking + uint32 GetAuraGroup() const { return m_auraGroup; } + int32 GetOldAmount() const { return m_oldAmount; } + void SetOldAmount(int32 amount) { m_oldAmount = amount; } + void SetEnabled(bool enabled) { m_isAuraEnabled = enabled; } private: Aura* const m_base; @@ -114,18 +114,18 @@ class AuraEffect SpellInfo const* const m_spellInfo; int32 const m_baseAmount; - bool m_applyResilience; - uint8 m_casterLevel; + bool m_applyResilience; + uint8 m_casterLevel; int32 m_amount; - float m_critChance; - float m_pctMods; + float m_critChance; + float m_pctMods; - // xinef: stacking - uint32 m_auraGroup; - int32 m_oldAmount; - bool m_isAuraEnabled; - // xinef: channel information for channel triggering - ChannelTargetData* m_channelData; + // xinef: stacking + uint32 m_auraGroup; + int32 m_oldAmount; + bool m_isAuraEnabled; + // xinef: channel information for channel triggering + ChannelTargetData* m_channelData; SpellModifier* m_spellmod; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 231767cdb..d12ab7071 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -174,66 +174,66 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply) aurEff->CleanupTriggeredSpells(GetTarget()); } - // Stacking! - if (uint32 groupId = aurEff->GetAuraGroup()) - { - SpellGroupStackFlags sFlag = sSpellMgr->GetGroupStackFlags(groupId); - if (!aurEff->IsPeriodic() && (sFlag & SPELL_GROUP_STACK_FLAG_EFFECT_EXCLUSIVE)) - { - AuraApplication* strongestApp = apply ? this : NULL; - AuraEffect* strongestEff = apply ? aurEff : NULL; - int32 amount = apply ? abs(aurEff->GetAmount()) : 0; - Unit* target = GetTarget(); - Unit::AuraEffectList const& auraList = target->GetAuraEffectsByType(aurEff->GetAuraType()); - for (Unit::AuraEffectList::const_iterator iter = auraList.begin(); iter != auraList.end(); ++iter) - { - if ((*iter)->GetAuraGroup() != groupId || (*iter) == strongestEff || (*iter)->GetBase()->IsRemoved()) - continue; + // Stacking! + if (uint32 groupId = aurEff->GetAuraGroup()) + { + SpellGroupStackFlags sFlag = sSpellMgr->GetGroupStackFlags(groupId); + if (!aurEff->IsPeriodic() && (sFlag & SPELL_GROUP_STACK_FLAG_EFFECT_EXCLUSIVE)) + { + AuraApplication* strongestApp = apply ? this : NULL; + AuraEffect* strongestEff = apply ? aurEff : NULL; + int32 amount = apply ? abs(aurEff->GetAmount()) : 0; + Unit* target = GetTarget(); + Unit::AuraEffectList const& auraList = target->GetAuraEffectsByType(aurEff->GetAuraType()); + for (Unit::AuraEffectList::const_iterator iter = auraList.begin(); iter != auraList.end(); ++iter) + { + if ((*iter)->GetAuraGroup() != groupId || (*iter) == strongestEff || (*iter)->GetBase()->IsRemoved()) + continue; - // xinef: skip different misc values - if (aurEff->GetAuraType() != SPELL_AURA_230 /*SPELL_AURA_MOD_INCREASE_HEALTH_2*/ && aurEff->GetAuraType() != SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK && - aurEff->GetMiscValue() != (*iter)->GetMiscValue()) - continue; + // xinef: skip different misc values + if (aurEff->GetAuraType() != SPELL_AURA_230 /*SPELL_AURA_MOD_INCREASE_HEALTH_2*/ && aurEff->GetAuraType() != SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK && + aurEff->GetMiscValue() != (*iter)->GetMiscValue()) + continue; - // xinef: should not happen - AuraApplication* aurApp = (*iter)->GetBase()->GetApplicationOfTarget(target->GetGUID()); - if (!aurApp) - continue; + // xinef: should not happen + AuraApplication* aurApp = (*iter)->GetBase()->GetApplicationOfTarget(target->GetGUID()); + if (!aurApp) + continue; - if (amount < abs((*iter)->GetForcedAmount())) - { - // xinef: if we have strongest aura and it is active, turn it off - // xinef: otherwise just save new aura; - if (strongestApp && strongestEff && strongestApp->IsActive(strongestEff->GetEffIndex())) - { - strongestEff->HandleEffect(strongestApp, AURA_EFFECT_HANDLE_CHANGE_AMOUNT, false); - if (!strongestEff->GetSpellInfo()->HasAreaAuraEffect()) - strongestEff->SetEnabled(false); - strongestApp->SetDisableMask(strongestEff->GetEffIndex()); - } - strongestApp = aurApp; - strongestEff = (*iter); - amount = abs((*iter)->GetAmount()); - } - // xinef: itered aura is weaker, deactivate if active - else if (aurApp->IsActive((*iter)->GetEffIndex())) - { - (*iter)->HandleEffect(aurApp, AURA_EFFECT_HANDLE_CHANGE_AMOUNT, false); - if (!(*iter)->GetSpellInfo()->HasAreaAuraEffect()) - (*iter)->SetEnabled(false); - aurApp->SetDisableMask((*iter)->GetEffIndex()); - } - } + if (amount < abs((*iter)->GetForcedAmount())) + { + // xinef: if we have strongest aura and it is active, turn it off + // xinef: otherwise just save new aura; + if (strongestApp && strongestEff && strongestApp->IsActive(strongestEff->GetEffIndex())) + { + strongestEff->HandleEffect(strongestApp, AURA_EFFECT_HANDLE_CHANGE_AMOUNT, false); + if (!strongestEff->GetSpellInfo()->HasAreaAuraEffect()) + strongestEff->SetEnabled(false); + strongestApp->SetDisableMask(strongestEff->GetEffIndex()); + } + strongestApp = aurApp; + strongestEff = (*iter); + amount = abs((*iter)->GetAmount()); + } + // xinef: itered aura is weaker, deactivate if active + else if (aurApp->IsActive((*iter)->GetEffIndex())) + { + (*iter)->HandleEffect(aurApp, AURA_EFFECT_HANDLE_CHANGE_AMOUNT, false); + if (!(*iter)->GetSpellInfo()->HasAreaAuraEffect()) + (*iter)->SetEnabled(false); + aurApp->SetDisableMask((*iter)->GetEffIndex()); + } + } - // xinef: if we have new strongest aura, and it is not active - if (strongestApp && strongestEff && !strongestApp->IsActive(strongestEff->GetEffIndex())) - { - strongestApp->RemoveDisableMask(strongestEff->GetEffIndex()); - strongestEff->SetEnabled(true); - strongestEff->HandleEffect(strongestApp, AURA_EFFECT_HANDLE_CHANGE_AMOUNT, true); - } - } - } + // xinef: if we have new strongest aura, and it is not active + if (strongestApp && strongestEff && !strongestApp->IsActive(strongestEff->GetEffIndex())) + { + strongestApp->RemoveDisableMask(strongestEff->GetEffIndex()); + strongestEff->SetEnabled(true); + strongestEff->HandleEffect(strongestApp, AURA_EFFECT_HANDLE_CHANGE_AMOUNT, true); + } + } + } SetNeedClientUpdate(); } @@ -278,11 +278,11 @@ void AuraApplication::ClientUpdate(bool remove) data.append(GetTarget()->GetPackGUID()); BuildUpdatePacket(data, remove); - if (GetSlot() < MAX_AURAS) - if (const Player* plr = GetTarget()->ToPlayer()) - if (Aura* aura = GetBase()) - if (plr->NeedSendSpectatorData() && ArenaSpectator::ShouldSendAura(aura, GetEffectMask(), GetTarget()->GetGUID(), remove)) - ArenaSpectator::SendCommand_Aura(plr->FindMap(), plr->GetGUID(), "AUR", aura->GetCasterGUID(), aura->GetSpellInfo()->Id, aura->GetSpellInfo()->IsPositive(), aura->GetSpellInfo()->Dispel, aura->GetDuration(), aura->GetMaxDuration(), (aura->GetCharges() > 1 ? aura->GetCharges() : aura->GetStackAmount()), remove); + if (GetSlot() < MAX_AURAS) + if (const Player* plr = GetTarget()->ToPlayer()) + if (Aura* aura = GetBase()) + if (plr->NeedSendSpectatorData() && ArenaSpectator::ShouldSendAura(aura, GetEffectMask(), GetTarget()->GetGUID(), remove)) + ArenaSpectator::SendCommand_Aura(plr->FindMap(), plr->GetGUID(), "AUR", aura->GetCasterGUID(), aura->GetSpellInfo()->Id, aura->GetSpellInfo()->IsPositive(), aura->GetSpellInfo()->Dispel, aura->GetDuration(), aura->GetMaxDuration(), (aura->GetCharges() > 1 ? aura->GetCharges() : aura->GetStackAmount()), remove); _target->SendMessageToSet(&data, true); } @@ -561,13 +561,13 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) targetsToRemove.push_back(appIter->second->GetTarget()); else { - // xinef: check immunities here, so aura wont get removed on every tick and then reapplied - if (IsArea()) - for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) - { - if ((existing->second & (1 << effIndex)) && existing->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex)) - existing->second &= ~(1 << effIndex); - } + // xinef: check immunities here, so aura wont get removed on every tick and then reapplied + if (IsArea()) + for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + { + if ((existing->second & (1 << effIndex)) && existing->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex)) + existing->second &= ~(1 << effIndex); + } // needs readding - remove now, will be applied in next update cycle // (dbcs do not have auras which apply on same type of targets but have different radius, so this is not really needed) @@ -623,18 +623,18 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) if (itr->first->IsInFlight()) addUnit = false; - switch( GetId() ) - { - case 62821: // Ulduar, Hodir, Toasty Fire - case 62807: // Ulduar, Hodir, Starlight - case 51103: // Oculus, Mage-Lord Urom, Frostbomb - case 69146: case 70823: case 70824: case 70825: // Icecrown Citadel, Lord Marrowgar, Coldflame - { - if( itr->first->HasAura(GetId()) ) - addUnit = false; - } - break; - } + switch( GetId() ) + { + case 62821: // Ulduar, Hodir, Toasty Fire + case 62807: // Ulduar, Hodir, Starlight + case 51103: // Oculus, Mage-Lord Urom, Frostbomb + case 69146: case 70823: case 70824: case 70825: // Icecrown Citadel, Lord Marrowgar, Coldflame + { + if( itr->first->HasAura(GetId()) ) + addUnit = false; + } + break; + } } // unit auras can not stack with each other else // (GetType() == UNIT_AURA_TYPE) @@ -719,9 +719,9 @@ void Aura::_ApplyEffectForTargets(uint8 effIndex) void Aura::UpdateOwner(uint32 diff, WorldObject* owner) { if (owner != m_owner) - { - ASSERT(false); - } + { + ASSERT(false); + } Unit* caster = GetCaster(); // Apply spellmods for channeled auras @@ -853,22 +853,22 @@ void Aura::RefreshTimers(bool periodicReset /*= false*/) Unit* caster = GetCaster(); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (HasEffect(i)) - { + { GetEffect(i)->CalculatePeriodic(caster, periodicReset, false); - GetEffect(i)->CalculatePeriodicData(); - } + GetEffect(i)->CalculatePeriodicData(); + } } // xinef: dot's rolling function void Aura::RefreshTimersWithMods() { - Unit* caster = GetCaster(); + Unit* caster = GetCaster(); m_maxDuration = CalcMaxDuration(); - if (caster && caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)) + if (caster && caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)) m_maxDuration = int32(m_maxDuration * caster->GetFloatValue(UNIT_MOD_CAST_SPEED)); - // xinef: we should take ModSpellDuration into account, but none of the spells using this function is affected by contents of ModSpellDuration - RefreshDuration(); + // xinef: we should take ModSpellDuration into account, but none of the spells using this function is affected by contents of ModSpellDuration + RefreshDuration(); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (HasEffect(i)) GetEffect(i)->CalculatePeriodic(caster, false, false); @@ -978,7 +978,7 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode, bool periodicRes mod->charges = GetCharges(); } - SetStackAmount(stackAmount); + SetStackAmount(stackAmount); SetNeedClientUpdateForTargets(); return false; @@ -1013,21 +1013,21 @@ bool Aura::IsDeathPersistent() const bool Aura::CanBeSaved() const { - if (IsPassive() || (GetSpellInfo()->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE) && GetSpellInfo()->Stances)) + if (IsPassive() || (GetSpellInfo()->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE) && GetSpellInfo()->Stances)) return false; - // Xinef: do not save channel auras - if (GetSpellInfo()->IsChanneled()) - return false; + // Xinef: do not save channel auras + if (GetSpellInfo()->IsChanneled()) + return false; - // Xinef: Check if aura is single target, not only spell info + // Xinef: Check if aura is single target, not only spell info if (GetCasterGUID() != GetOwner()->GetGUID()) - if (GetSpellInfo()->IsSingleTarget() || IsSingleTarget()) + if (GetSpellInfo()->IsSingleTarget() || IsSingleTarget()) return false; - // Xinef: Dont save control vehicle auras - caster may not exist - if (HasEffectType(SPELL_AURA_CONTROL_VEHICLE)) - return false; + // Xinef: Dont save control vehicle auras - caster may not exist + if (HasEffectType(SPELL_AURA_CONTROL_VEHICLE)) + return false; // Can't be saved - aura handler relies on calculated amount and changes it if (HasEffectType(SPELL_AURA_CONVERT_RUNE)) @@ -1037,21 +1037,21 @@ bool Aura::CanBeSaved() const if (HasEffectType(SPELL_AURA_OPEN_STABLE)) return false; - // xinef: do not save bind sight auras! - if (HasEffectType(SPELL_AURA_BIND_SIGHT)) - return false; + // xinef: do not save bind sight auras! + if (HasEffectType(SPELL_AURA_BIND_SIGHT)) + return false; - // xinef: no charming auras (taking direct control) - if (HasEffectType(SPELL_AURA_MOD_POSSESS) || HasEffectType(SPELL_AURA_MOD_POSSESS_PET)) - return false; + // xinef: no charming auras (taking direct control) + if (HasEffectType(SPELL_AURA_MOD_POSSESS) || HasEffectType(SPELL_AURA_MOD_POSSESS_PET)) + return false; - // xinef: no charming auras can be saved - if (HasEffectType(SPELL_AURA_MOD_CHARM) || HasEffectType(SPELL_AURA_AOE_CHARM)) - return false; + // xinef: no charming auras can be saved + if (HasEffectType(SPELL_AURA_MOD_CHARM) || HasEffectType(SPELL_AURA_AOE_CHARM)) + return false; - // Xinef: Raise Ally control aura - if (GetId() == 46619) - return false; + // Xinef: Raise Ally control aura + if (GetId() == 46619) + return false; // don't save auras removed by proc system if (IsUsingCharges() && !GetCharges()) @@ -1097,13 +1097,13 @@ void Aura::UnregisterSingleTarget() // TODO: find a better way to do this. if (!caster) caster = ObjectAccessor::GetObjectInOrOutOfWorld(GetCasterGUID(), (Unit*)NULL); - if (!caster) - { - sLog->outMisc("Aura::UnregisterSingleTarget (A1) - %u, %u, %u, %s", GetId(), GetOwner()->GetTypeId(), GetOwner()->GetEntry(), GetOwner()->GetName().c_str()); - //ASSERT(caster); - } - else - caster->GetSingleCastAuras().remove(this); + if (!caster) + { + sLog->outMisc("Aura::UnregisterSingleTarget (A1) - %u, %u, %u, %s", GetId(), GetOwner()->GetTypeId(), GetOwner()->GetEntry(), GetOwner()->GetName().c_str()); + //ASSERT(caster); + } + else + caster->GetSingleCastAuras().remove(this); SetIsSingleTarget(false); } @@ -1360,23 +1360,23 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b break; } break; - case SPELLFAMILY_DRUID: - if (!caster) + case SPELLFAMILY_DRUID: + if (!caster) break; - // Rejuvenation + // Rejuvenation if (GetSpellInfo()->SpellFamilyFlags[0] & 0x10 && GetEffect(0)) { // Druid T8 Restoration 4P Bonus if (AuraEffect const * aurEff = caster->GetAuraEffectDummy(64760)) { - uint32 damage = GetEffect(0)->GetAmount(); + uint32 damage = GetEffect(0)->GetAmount(); damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT); int32 basepoints0 = damage; caster->CastCustomSpell(target, 64801, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); } } - break; + break; case SPELLFAMILY_PRIEST: if (!caster) break; @@ -1391,7 +1391,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100; int32 heal = int32(CalculatePct(basepoints0, 15)); - caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); + caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0)); caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0)); } } @@ -1456,41 +1456,41 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b caster->CastSpell(target, spellId, true, 0, GetEffect(0)); } } - // Unholy blight - if (GetId() == 50536) - { - if (caster->IsFriendlyTo(target)) - SetDuration(0); - } + // Unholy blight + if (GetId() == 50536) + { + if (caster->IsFriendlyTo(target)) + SetDuration(0); + } break; - case SPELLFAMILY_POTION: - // Alchemy: Mixology - if (caster && caster->HasAura(53042) && caster->GetTypeId() == TYPEID_PLAYER && !caster->ToPlayer()->GetSession()->PlayerLoading()) - { - if (sSpellMgr->GetSpellGroup(GetId()) == 1) /*Elixirs*/ - { - if (caster->HasSpell(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell)) - { - for (int i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (GetEffect(i)) - GetEffect(i)->SetAmount(CalculatePct(GetEffect(i)->GetAmount(), 100+sSpellMgr->GetSpellMixologyBonus(GetId()))); + case SPELLFAMILY_POTION: + // Alchemy: Mixology + if (caster && caster->HasAura(53042) && caster->GetTypeId() == TYPEID_PLAYER && !caster->ToPlayer()->GetSession()->PlayerLoading()) + { + if (sSpellMgr->GetSpellGroup(GetId()) == 1) /*Elixirs*/ + { + if (caster->HasSpell(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell)) + { + for (int i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (GetEffect(i)) + GetEffect(i)->SetAmount(CalculatePct(GetEffect(i)->GetAmount(), 100+sSpellMgr->GetSpellMixologyBonus(GetId()))); - SetMaxDuration(caster->CalcSpellDuration(GetSpellInfo())*2); - SetDuration(GetMaxDuration()); - } - } - } - break; - } + SetMaxDuration(caster->CalcSpellDuration(GetSpellInfo())*2); + SetDuration(GetMaxDuration()); + } + } + } + break; + } } // mods at aura remove else { switch (GetSpellInfo()->SpellFamilyName) - { + { case SPELLFAMILY_GENERIC: - if (!caster) + if (!caster) break; switch(GetId()) { @@ -1507,7 +1507,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (remainingDamage > 0) caster->CastCustomSpell(caster, 72373, NULL, &remainingDamage, NULL, true); } - break; + break; } break; case SPELLFAMILY_MAGE: @@ -1540,11 +1540,11 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[1] & 0x1) { // Shattered Barrier - if (AuraEffect* absorb = GetEffect(EFFECT_0)) - if (absorb->GetAmount() <= 0) // removed by damage, not dispel - if (AuraEffect* dummy = caster->GetDummyAuraEffect(SPELLFAMILY_MAGE, 2945, 0)) - if (roll_chance_i(dummy->GetSpellInfo()->ProcChance)) - caster->CastSpell(target, 55080, true, NULL, GetEffect(0)); + if (AuraEffect* absorb = GetEffect(EFFECT_0)) + if (absorb->GetAmount() <= 0) // removed by damage, not dispel + if (AuraEffect* dummy = caster->GetDummyAuraEffect(SPELLFAMILY_MAGE, 2945, 0)) + if (roll_chance_i(dummy->GetSpellInfo()->ProcChance)) + caster->CastSpell(target, 55080, true, NULL, GetEffect(0)); } break; case SPELLFAMILY_WARRIOR: @@ -1667,22 +1667,22 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b break; } break; - case SPELLFAMILY_ROGUE: - { - // Overkill, Master of Subtlety - if (caster && GetSpellInfo()->SpellIconID == 250) - { - if (caster->GetDummyAuraEffect(SPELLFAMILY_ROGUE, 2114, 0)) - caster->CastSpell(caster, 31666, true); + case SPELLFAMILY_ROGUE: + { + // Overkill, Master of Subtlety + if (caster && GetSpellInfo()->SpellIconID == 250) + { + if (caster->GetDummyAuraEffect(SPELLFAMILY_ROGUE, 2114, 0)) + caster->CastSpell(caster, 31666, true); - if (caster->GetAuraEffectDummy(58426)) - caster->CastSpell(caster, 58428, true); - } - // Remove Vanish on stealth remove - if (GetId() == 1784) - target->RemoveAurasWithFamily(SPELLFAMILY_ROGUE, 0x800, 0, 0, 0); - break; - } + if (caster->GetAuraEffectDummy(58426)) + caster->CastSpell(caster, 58428, true); + } + // Remove Vanish on stealth remove + if (GetId() == 1784) + target->RemoveAurasWithFamily(SPELLFAMILY_ROGUE, 0x800, 0, 0, 0); + break; + } case SPELLFAMILY_DEATHKNIGHT: // Blood of the North @@ -1701,13 +1701,13 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b target->ToPlayer()->RemoveRunesByAuraEffect(GetEffect(0)); } break; - case SPELLFAMILY_PALADIN: + case SPELLFAMILY_PALADIN: // Remove the immunity shield marker on Forbearance removal if AW marker is not present if (GetId() == 25771 && target->HasAura(61988) && !target->HasAura(61987)) target->RemoveAura(61988); - break; - } - } + break; + } + } // mods at aura apply or remove switch (GetSpellInfo()->SpellFamilyName) @@ -1751,7 +1751,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b else target->RemoveAurasDueToSpell(64364, GetCasterGUID()); break; - case 31842: + case 31842: if (caster && caster->HasAura(70755)) { if (apply) @@ -1762,39 +1762,39 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b break; } - // Sanctified Retribution, Improved Devotion Aura, Swift Retribution, Improved Concentration Aura - if (caster == target && GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_AURA) + // Sanctified Retribution, Improved Devotion Aura, Swift Retribution, Improved Concentration Aura + if (caster == target && GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_AURA) { - if (apply) - { - target->CastSpell(target, 63510, true); - target->CastSpell(target, 63514, true); - target->CastSpell(target, 63531, true); - } - else - { - target->RemoveAura(63510); - target->RemoveAura(63514); - target->RemoveAura(63531); - } - } + if (apply) + { + target->CastSpell(target, 63510, true); + target->CastSpell(target, 63514, true); + target->CastSpell(target, 63531, true); + } + else + { + target->RemoveAura(63510); + target->RemoveAura(63514); + target->RemoveAura(63531); + } + } break; - case SPELLFAMILY_DRUID: - if (!caster) - break; - // Reduce base armor of bear form and dire bear form - if (GetId() == 5229) - { - if (target->HasAura(70726)) // Item - Druid T10 Feral 4P Bonus - { - if (apply) - target->CastSpell(target, 70725, true); - } - else if (AuraEffect *aurEff = caster->GetAuraEffect(SPELL_AURA_MOD_BASE_RESISTANCE_PCT, SPELLFAMILY_DRUID, 107, 0)) - aurEff->RecalculateAmount(); - } - break; + case SPELLFAMILY_DRUID: + if (!caster) + break; + // Reduce base armor of bear form and dire bear form + if (GetId() == 5229) + { + if (target->HasAura(70726)) // Item - Druid T10 Feral 4P Bonus + { + if (apply) + target->CastSpell(target, 70725, true); + } + else if (AuraEffect *aurEff = caster->GetAuraEffect(SPELL_AURA_MOD_BASE_RESISTANCE_PCT, SPELLFAMILY_DRUID, 107, 0)) + aurEff->RecalculateAmount(); + } + break; } } @@ -1822,31 +1822,31 @@ bool Aura::CheckAreaTarget(Unit* target) bool Aura::IsAuraStronger(Aura const* newAura) const { - for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) - { - AuraEffect* thisEffect = GetEffect(i); - if (!thisEffect) - continue; + for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) + { + AuraEffect* thisEffect = GetEffect(i); + if (!thisEffect) + continue; - AuraEffect* newEffect = NULL; - for (uint8 j = EFFECT_0; j < MAX_SPELL_EFFECTS; ++j) - { - newEffect = newAura->GetEffect(j); - if (!newEffect || thisEffect->GetAuraType() != newEffect->GetAuraType() || thisEffect->GetMiscValue() != newEffect->GetMiscValue()) - continue; + AuraEffect* newEffect = NULL; + for (uint8 j = EFFECT_0; j < MAX_SPELL_EFFECTS; ++j) + { + newEffect = newAura->GetEffect(j); + if (!newEffect || thisEffect->GetAuraType() != newEffect->GetAuraType() || thisEffect->GetMiscValue() != newEffect->GetMiscValue()) + continue; - // xinef: assume that all spells are either positive or negative, otherwise they should not be in one group - int32 curValue = abs(thisEffect->GetAmount()); - if (curValue < abs(newEffect->GetAmount())) - return true; + // xinef: assume that all spells are either positive or negative, otherwise they should not be in one group + int32 curValue = abs(thisEffect->GetAmount()); + if (curValue < abs(newEffect->GetAmount())) + return true; - if (curValue == abs(newEffect->GetAmount())) - if(!IsPassive() && !IsPermanent() && GetDuration() < newAura->GetDuration()) - return true; - } - } + if (curValue == abs(newEffect->GetAmount())) + if(!IsPassive() && !IsPermanent() && GetDuration() < newAura->GetDuration()) + return true; + } + } - return false; + return false; } bool Aura::CanStackWith(Aura const* existingAura, bool remove) const @@ -1858,15 +1858,15 @@ bool Aura::CanStackWith(Aura const* existingAura, bool remove) const SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo(); bool sameCaster = GetCasterGUID() == existingAura->GetCasterGUID(); - // Dynobj auras always stack - // xinef: dont allow different ranks (or the same rank) of same spell to stack (many flamestrikes for example) + // Dynobj auras always stack + // xinef: dont allow different ranks (or the same rank) of same spell to stack (many flamestrikes for example) if (existingAura->GetType() == DYNOBJ_AURA_TYPE) - { - // xinef: desecration lag fix - bound this condition to periodics - if (sameCaster && GetSpellInfo()->Id == existingSpellInfo->Id && GetSpellInfo()->HasAura(SPELL_AURA_PERIODIC_DAMAGE)) - return false; + { + // xinef: desecration lag fix - bound this condition to periodics + if (sameCaster && GetSpellInfo()->Id == existingSpellInfo->Id && GetSpellInfo()->HasAura(SPELL_AURA_PERIODIC_DAMAGE)) + return false; return true; - } + } // passive auras don't stack with another rank of the spell cast by same caster if (IsPassive() && sameCaster && m_spellInfo->IsDifferentRankOf(existingSpellInfo)) @@ -1887,42 +1887,42 @@ bool Aura::CanStackWith(Aura const* existingAura, bool remove) const return false; // check spell group stack rules - // xinef: this assures us that both spells are in same group! - SpellGroupStackFlags stackFlags = sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo, remove, IsArea()); + // xinef: this assures us that both spells are in same group! + SpellGroupStackFlags stackFlags = sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo, remove, IsArea()); if (stackFlags) { - // xinef: same caster rule is bounded by spellfamily - if (sameCaster && m_spellInfo->SpellFamilyName == existingSpellInfo->SpellFamilyName && - (stackFlags & SPELL_GROUP_STACK_FLAG_NOT_SAME_CASTER)) - return false; + // xinef: same caster rule is bounded by spellfamily + if (sameCaster && m_spellInfo->SpellFamilyName == existingSpellInfo->SpellFamilyName && + (stackFlags & SPELL_GROUP_STACK_FLAG_NOT_SAME_CASTER)) + return false; - // xinef: normal exclusive stacking, remove if auras are equal by effects + // xinef: normal exclusive stacking, remove if auras are equal by effects if (stackFlags & SPELL_GROUP_STACK_FLAG_EXCLUSIVE) - { - if (GetSpellInfo()->IsAuraEffectEqual(existingSpellInfo) || GetSpellInfo()->IsRankOf(existingSpellInfo)) - { - if (remove) - return IsAuraStronger(existingAura); - else - return existingAura->IsAuraStronger(this); - } - } + { + if (GetSpellInfo()->IsAuraEffectEqual(existingSpellInfo) || GetSpellInfo()->IsRankOf(existingSpellInfo)) + { + if (remove) + return IsAuraStronger(existingAura); + else + return existingAura->IsAuraStronger(this); + } + } - // xinef: check priority before effect mask - SpellGroupSpecialFlags thisAuraFlag = sSpellMgr->GetSpellGroupSpecialFlags(GetId()); - SpellGroupSpecialFlags existingAuraFlag = sSpellMgr->GetSpellGroupSpecialFlags(existingSpellInfo->Id); - if (thisAuraFlag >= SPELL_GROUP_SPECIAL_FLAG_PRIORITY1 && existingAuraFlag >= SPELL_GROUP_SPECIAL_FLAG_PRIORITY1) - if (thisAuraFlag < existingAuraFlag) - return false; + // xinef: check priority before effect mask + SpellGroupSpecialFlags thisAuraFlag = sSpellMgr->GetSpellGroupSpecialFlags(GetId()); + SpellGroupSpecialFlags existingAuraFlag = sSpellMgr->GetSpellGroupSpecialFlags(existingSpellInfo->Id); + if (thisAuraFlag >= SPELL_GROUP_SPECIAL_FLAG_PRIORITY1 && existingAuraFlag >= SPELL_GROUP_SPECIAL_FLAG_PRIORITY1) + if (thisAuraFlag < existingAuraFlag) + return false; - // xinef: forced strongest aura in group by flag - if (stackFlags & SPELL_GROUP_STACK_FLAG_FORCED_STRONGEST) - return !remove; - if (stackFlags & SPELL_GROUP_STACK_FLAG_FORCED_WEAKEST) - return remove; + // xinef: forced strongest aura in group by flag + if (stackFlags & SPELL_GROUP_STACK_FLAG_FORCED_STRONGEST) + return !remove; + if (stackFlags & SPELL_GROUP_STACK_FLAG_FORCED_WEAKEST) + return remove; - // xinef: forced return, handle all cases using available flags! - return !(stackFlags & SPELL_GROUP_STACK_FLAG_NEVER_STACK); + // xinef: forced return, handle all cases using available flags! + return !(stackFlags & SPELL_GROUP_STACK_FLAG_NEVER_STACK); } if (m_spellInfo->SpellFamilyName != existingSpellInfo->SpellFamilyName) @@ -1986,11 +1986,11 @@ bool Aura::CanStackWith(Aura const* existingAura, bool remove) const if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later return true; - // xinef: allow direct auras to stack if there is no passenger in this slot - if (AuraEffect* aurEff = GetEffect(VehicleAura1-1)) - if (aurEff->GetAmount() > 0) - if (!veh->GetPassenger(aurEff->GetAmount()-1)) - return true; + // xinef: allow direct auras to stack if there is no passenger in this slot + if (AuraEffect* aurEff = GetEffect(VehicleAura1-1)) + if (aurEff->GetAmount() > 0) + if (!veh->GetPassenger(aurEff->GetAmount()-1)) + return true; if (!veh->GetAvailableSeatCount()) return false; // No empty seat available @@ -2683,14 +2683,14 @@ void DynObjAura::FillTargetMap(std::map & targets, Unit* /*caster* Trinity::UnitListSearcher searcher(GetDynobjOwner(), targetList, u_check); GetDynobjOwner()->VisitNearbyObject(radius, searcher); } - // pussywizard: TARGET_DEST_DYNOBJ_NONE is supposed to search for both friendly and unfriendly targets, so for any unit - // what about EffectImplicitTargetA? - else if (GetSpellInfo()->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DYNOBJ_NONE) - { - Trinity::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius); + // pussywizard: TARGET_DEST_DYNOBJ_NONE is supposed to search for both friendly and unfriendly targets, so for any unit + // what about EffectImplicitTargetA? + else if (GetSpellInfo()->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DYNOBJ_NONE) + { + Trinity::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius); Trinity::UnitListSearcher searcher(GetDynobjOwner(), targetList, u_check); GetDynobjOwner()->VisitNearbyObject(radius, searcher); - } + } else { Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius); @@ -2700,12 +2700,12 @@ void DynObjAura::FillTargetMap(std::map & targets, Unit* /*caster* for (UnitList::iterator itr = targetList.begin(); itr!= targetList.end();++itr) { - // xinef: check z level and los dependence - Unit* target = *itr; - float zLevel = GetDynobjOwner()->GetPositionZ(); - if (target->GetPositionZ()+3.0f < zLevel || target->GetPositionZ()-5.0f > zLevel) - if (!target->IsWithinLOSInMap(GetDynobjOwner())) - continue; + // xinef: check z level and los dependence + Unit* target = *itr; + float zLevel = GetDynobjOwner()->GetPositionZ(); + if (target->GetPositionZ()+3.0f < zLevel || target->GetPositionZ()-5.0f > zLevel) + if (!target->IsWithinLOSInMap(GetDynobjOwner())) + continue; std::map::iterator existing = targets.find(*itr); if (existing != targets.end()) diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 9b5e16ae3..a62d1590c 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -55,8 +55,8 @@ class AuraApplication uint8 _effectsToApply; // Used only at spell hit to determine which effect should be applied bool _needClientUpdate:1; - // xinef: stacking - uint8 _disableMask; + // xinef: stacking + uint8 _disableMask; explicit AuraApplication(Unit* target, Unit* caster, Aura* base, uint8 effMask); void _Remove(); @@ -84,10 +84,10 @@ class AuraApplication void BuildUpdatePacket(ByteBuffer& data, bool remove) const; void ClientUpdate(bool remove = false); - // xinef: stacking - bool IsActive(uint8 effIdx) { return ((1 << effIdx) & _disableMask) == 0; } - void SetDisableMask(uint8 effIdx) { _disableMask |= 1 << effIdx; } - void RemoveDisableMask(uint8 effIdx) { _disableMask &= ~(1 << effIdx); } + // xinef: stacking + bool IsActive(uint8 effIdx) { return ((1 << effIdx) & _disableMask) == 0; } + void SetDisableMask(uint8 effIdx) { _disableMask |= 1 << effIdx; } + void RemoveDisableMask(uint8 effIdx) { _disableMask &= ~(1 << effIdx); } }; class Aura @@ -140,7 +140,7 @@ class Aura void SetDuration(int32 duration, bool withMods = false); void RefreshDuration(); void RefreshTimers(bool periodicReset = false); - void RefreshTimersWithMods(); + void RefreshTimersWithMods(); bool IsExpired() const { return !GetDuration();} bool IsPermanent() const { return GetMaxDuration() == -1; } @@ -195,7 +195,7 @@ class Aura bool CanBeAppliedOn(Unit* target); bool CheckAreaTarget(Unit* target); bool CanStackWith(Aura const* checkAura, bool remove) const; - bool IsAuraStronger(Aura const* newAura) const; + bool IsAuraStronger(Aura const* newAura) const; // Proc system // this subsystem is not yet in use - the core of it is functional, but still some research has to be done diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index ad09aca58..feecb53e5 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -121,8 +121,8 @@ SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget() m_targetMask = 0; - // Xinef: Channel data - m_objectTargetGUIDChannel = 0; + // Xinef: Channel data + m_objectTargetGUIDChannel = 0; } SpellCastTargets::~SpellCastTargets() @@ -454,17 +454,17 @@ void SpellCastTargets::SetDstChannel(SpellDestination const& spellDest) WorldObject* SpellCastTargets::GetObjectTargetChannel(Unit* caster) const { - return m_objectTargetGUIDChannel ? ((m_objectTargetGUIDChannel == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUIDChannel)) : NULL; + return m_objectTargetGUIDChannel ? ((m_objectTargetGUIDChannel == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUIDChannel)) : NULL; } bool SpellCastTargets::HasDstChannel() const { - return m_dstChannel._position.GetExactDist(0, 0, 0) > 0.001f; + return m_dstChannel._position.GetExactDist(0, 0, 0) > 0.001f; } SpellDestination const* SpellCastTargets::GetDstChannel() const { - return &m_dstChannel; + return &m_dstChannel; } void SpellCastTargets::Update(Unit* caster) @@ -535,7 +535,7 @@ SpellValue::SpellValue(SpellInfo const* proto) MaxAffectedTargets = proto->MaxAffectedTargets; RadiusMod = 1.0f; AuraStackAmount = 1; - ForcedCritResult = false; + ForcedCritResult = false; } Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID, bool skipCheck) : @@ -627,7 +627,7 @@ m_caster((info->HasAttribute(SPELL_ATTR6_CAST_BY_CHARMER) && caster->GetCharmerO m_triggeredByAuraSpell = NULL; m_spellAura = NULL; m_pathFinder = NULL; // pussywizard - _scriptsLoaded = false; + _scriptsLoaded = false; //Auto Shot & Shoot (wand) m_autoRepeat = m_spellInfo->IsAutoRepeatRangedSpell(); @@ -653,8 +653,8 @@ m_caster((info->HasAttribute(SPELL_ATTR6_CAST_BY_CHARMER) && caster->GetCharmerO for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) m_destTargets[i] = SpellDestination(*m_caster); - // xinef: - _spellTargetsSelected = false; + // xinef: + _spellTargetsSelected = false; } Spell::~Spell() @@ -759,7 +759,7 @@ void Spell::SelectExplicitTargets() // check for explicit target redirection, for Grounding Totem for example if (m_spellInfo->GetExplicitTargetMask() & TARGET_FLAG_UNIT_ENEMY || (m_spellInfo->GetExplicitTargetMask() & TARGET_FLAG_UNIT - && (!m_spellInfo->IsPositive() || (!m_caster->IsFriendlyTo(target) && m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))))) + && (!m_spellInfo->IsPositive() || (!m_caster->IsFriendlyTo(target) && m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))))) { Unit* redirect; switch (m_spellInfo->DmgClass) @@ -916,13 +916,13 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar case TARGET_SELECT_CATEGORY_AREA: SelectImplicitAreaTargets(effIndex, targetType, effectMask); break; - case TARGET_SELECT_CATEGORY_TRAJ: - // xinef: just in case there is no dest, explanation in SelectImplicitDestDestTargets - if (!m_targets.HasDst()) - m_targets.SetDst(*m_caster); + case TARGET_SELECT_CATEGORY_TRAJ: + // xinef: just in case there is no dest, explanation in SelectImplicitDestDestTargets + if (!m_targets.HasDst()) + m_targets.SetDst(*m_caster); SelectImplicitTrajTargets(effIndex, targetType); - break; + break; case TARGET_SELECT_CATEGORY_DEFAULT: switch (targetType.GetObjectType()) { @@ -991,34 +991,34 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa { case TARGET_UNIT_CHANNEL_TARGET: { - // Xinef: All channel selectors have needed data passed in m_targets structure - WorldObject* target = m_targets.GetObjectTargetChannel(m_caster); - if (target) - { - CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); - // unit target may be no longer avalible - teleported out of map for example - if (target && target->ToUnit()) - AddUnitTarget(target->ToUnit(), 1 << effIndex); - } - else + // Xinef: All channel selectors have needed data passed in m_targets structure + WorldObject* target = m_targets.GetObjectTargetChannel(m_caster); + if (target) + { + CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); + // unit target may be no longer avalible - teleported out of map for example + if (target && target->ToUnit()) + AddUnitTarget(target->ToUnit(), 1 << effIndex); + } + else ;//sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); break; } case TARGET_DEST_CHANNEL_TARGET: if (m_targets.HasDstChannel()) - m_targets.SetDst(*m_targets.GetDstChannel()); - else if (WorldObject* target = m_targets.GetObjectTargetChannel(m_caster)) - { - CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); - if (target) - m_targets.SetDst(*target); - } - else //if (!m_targets.HasDst()) + m_targets.SetDst(*m_targets.GetDstChannel()); + else if (WorldObject* target = m_targets.GetObjectTargetChannel(m_caster)) + { + CallScriptObjectTargetSelectHandlers(target, effIndex, targetType); + if (target) + m_targets.SetDst(*target); + } + else //if (!m_targets.HasDst()) ;//sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex); break; case TARGET_DEST_CHANNEL_CASTER: - if (GetOriginalCaster()) - m_targets.SetDst(*GetOriginalCaster()); + if (GetOriginalCaster()) + m_targets.SetDst(*GetOriginalCaster()); break; default: ASSERT(false && "Spell::SelectImplicitChannelTargets: received not implemented target type"); @@ -1101,23 +1101,23 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar switch (targetType.GetObjectType()) { case TARGET_OBJECT_TYPE_UNIT: - { + { if (Unit* unitTarget = target->ToUnit()) - { + { AddUnitTarget(unitTarget, effMask, true, false); - // xinef: important! if channeling spell have nearby entry, it has no unitTarget by default - // and if channeled spell has target 77, it requires unitTarget, set it here! - // xinef: if we have NO unit target - if (!m_targets.GetUnitTarget()) - m_targets.SetUnitTarget(unitTarget); - } + // xinef: important! if channeling spell have nearby entry, it has no unitTarget by default + // and if channeled spell has target 77, it requires unitTarget, set it here! + // xinef: if we have NO unit target + if (!m_targets.GetUnitTarget()) + m_targets.SetUnitTarget(unitTarget); + } else { //TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected unit, got %s, effect %u", m_spellInfo->Id, GetLogNameForGuid(target->GetGUID()), effMask); return; } break; - } + } case TARGET_OBJECT_TYPE_GOBJ: if (GameObject* gobjTarget = target->ToGameObject()) AddGOTarget(gobjTarget, effMask); @@ -1236,12 +1236,12 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge return; } - // Xinef: the distance should be increased by caster size, it is neglected in latter calculations + // Xinef: the distance should be increased by caster size, it is neglected in latter calculations std::list targets; float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster) * m_spellValue->RadiusMod; - SearchAreaTargets(targets, radius, center, referer, targetType.GetObjectType(), targetType.GetCheckType(), m_spellInfo->Effects[effIndex].ImplicitTargetConditions); + SearchAreaTargets(targets, radius, center, referer, targetType.GetObjectType(), targetType.GetCheckType(), m_spellInfo->Effects[effIndex].ImplicitTargetConditions); - CallScriptObjectAreaTargetSelectHandlers(targets, effIndex, targetType); + CallScriptObjectAreaTargetSelectHandlers(targets, effIndex, targetType); if (!targets.empty()) { @@ -1310,7 +1310,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici if (m_caster->GetMap()->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquidData)) liquidLevel = liquidData.level; - if (liquidLevel <= ground) // When there is no liquid Map::GetWaterOrGroundLevel returns ground level + if (liquidLevel <= ground) // When there is no liquid Map::GetWaterOrGroundLevel returns ground level { SendCastResult(SPELL_FAILED_NOT_HERE); SendChannelUpdate(0); @@ -1331,51 +1331,51 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici } default: { - float dist; - float angle = targetType.CalcDirectionAngle(); - float objSize = m_caster->GetObjectSize(); - if (targetType.GetTarget() == TARGET_DEST_CASTER_SUMMON) - dist = PET_FOLLOW_DIST; - else - dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); + float dist; + float angle = targetType.CalcDirectionAngle(); + float objSize = m_caster->GetObjectSize(); + if (targetType.GetTarget() == TARGET_DEST_CASTER_SUMMON) + dist = PET_FOLLOW_DIST; + else + dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); - if (dist < objSize) - { - dist = objSize; - // xinef: give the summon some space (eg. totems) - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Effects[effIndex].IsEffect(SPELL_EFFECT_SUMMON)) - dist += objSize; - } - else if (targetType.GetTarget() == TARGET_DEST_CASTER_RANDOM) - dist = objSize + (dist - objSize) * (float)rand_norm(); + if (dist < objSize) + { + dist = objSize; + // xinef: give the summon some space (eg. totems) + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Effects[effIndex].IsEffect(SPELL_EFFECT_SUMMON)) + dist += objSize; + } + else if (targetType.GetTarget() == TARGET_DEST_CASTER_RANDOM) + dist = objSize + (dist - objSize) * (float)rand_norm(); - Position pos; - bool totemCollision = false; - if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SUMMON) - { - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB); - if (properties && (properties->Type == SUMMON_TYPE_TOTEM || properties->Type == SUMMON_TYPE_LIGHTWELL)) - { - totemCollision = true; - m_caster->GetFirstCollisionPositionForTotem(pos, dist, angle, false); - } - } - else if (m_spellInfo->Effects[effIndex].Effect >= SPELL_EFFECT_SUMMON_OBJECT_SLOT1 && m_spellInfo->Effects[effIndex].Effect <= SPELL_EFFECT_SUMMON_OBJECT_SLOT4) - { - totemCollision = true; - m_caster->GetFirstCollisionPositionForTotem(pos, dist, angle, true); - } + Position pos; + bool totemCollision = false; + if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SUMMON) + { + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB); + if (properties && (properties->Type == SUMMON_TYPE_TOTEM || properties->Type == SUMMON_TYPE_LIGHTWELL)) + { + totemCollision = true; + m_caster->GetFirstCollisionPositionForTotem(pos, dist, angle, false); + } + } + else if (m_spellInfo->Effects[effIndex].Effect >= SPELL_EFFECT_SUMMON_OBJECT_SLOT1 && m_spellInfo->Effects[effIndex].Effect <= SPELL_EFFECT_SUMMON_OBJECT_SLOT4) + { + totemCollision = true; + m_caster->GetFirstCollisionPositionForTotem(pos, dist, angle, true); + } - if (!totemCollision) - { - if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_LEAP || m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TELEPORT_UNITS || m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_JUMP_DEST || (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SUMMON)) - m_caster->GetFirstCollisionPosition(pos, dist, angle); - else - m_caster->GetNearPosition(pos, dist, angle); - } - dest.Relocate(pos); - break; - } + if (!totemCollision) + { + if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_LEAP || m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TELEPORT_UNITS || m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_JUMP_DEST || (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SUMMON)) + m_caster->GetFirstCollisionPosition(pos, dist, angle); + else + m_caster->GetNearPosition(pos, dist, angle); + } + dest.Relocate(pos); + break; + } } CallScriptDestinationTargetSelectHandlers(dest, effIndex, targetType); @@ -1394,24 +1394,24 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplici case TARGET_DEST_TARGET_ANY: break; default: - { + { float angle = targetType.CalcDirectionAngle(); - float objSize = target->GetObjectSize(); - float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); - if (dist < objSize) - dist = objSize; - else if (targetType.GetTarget() == TARGET_DEST_TARGET_RANDOM) - dist = objSize + (dist - objSize) * (float)rand_norm(); + float objSize = target->GetObjectSize(); + float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); + if (dist < objSize) + dist = objSize; + else if (targetType.GetTarget() == TARGET_DEST_TARGET_RANDOM) + dist = objSize + (dist - objSize) * (float)rand_norm(); - Position pos; - if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_LEAP || m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TELEPORT_UNITS || m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_JUMP_DEST || (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SUMMON)) - target->GetFirstCollisionPosition(pos, dist, angle); - else - target->GetNearPosition(pos, dist, angle); + Position pos; + if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_LEAP || m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TELEPORT_UNITS || m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_JUMP_DEST || (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SUMMON)) + target->GetFirstCollisionPosition(pos, dist, angle); + else + target->GetNearPosition(pos, dist, angle); - dest.Relocate(pos); + dest.Relocate(pos); break;; - } + } } CallScriptDestinationTargetSelectHandlers(dest, effIndex, targetType); @@ -1473,8 +1473,8 @@ void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImpli break; case TARGET_UNIT_PET: target = m_caster->GetGuardianPet(); - if (!target) - target = m_caster->GetCharm(); + if (!target) + target = m_caster->GetCharm(); break; case TARGET_UNIT_SUMMONER: if (m_caster->IsSummon()) @@ -1596,10 +1596,10 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge a = 0; DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: a %f b %f", a, b);) - // Xinef: hack for distance, many trajectory spells have RangeEntry 1 (self) + // Xinef: hack for distance, many trajectory spells have RangeEntry 1 (self) float bestDist = m_spellInfo->GetMaxRange(false)*2; - if (bestDist < 1.0f) - bestDist = 300.0f; + if (bestDist < 1.0f) + bestDist = 300.0f; std::list::const_iterator itr = targets.begin(); for (; itr != targets.end(); ++itr) @@ -1635,29 +1635,29 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge }\ } - // RP-GG only, search in straight line, as item have no trajectory - if (m_CastItem) - { - if (dist < bestDist && fabs(dz) < 6.0f) // closes target, also check Z difference) - { - bestDist = dist; - break; - } + // RP-GG only, search in straight line, as item have no trajectory + if (m_CastItem) + { + if (dist < bestDist && fabs(dz) < 6.0f) // closes target, also check Z difference) + { + bestDist = dist; + break; + } - continue; - } + continue; + } if (!a) { - // Xinef: everything remade - dist = m_targets.GetSrcPos()->GetExactDist(*itr); - height = m_targets.GetSrcPos()->GetExactDist2d(*itr)*b; + // Xinef: everything remade + dist = m_targets.GetSrcPos()->GetExactDist(*itr); + height = m_targets.GetSrcPos()->GetExactDist2d(*itr)*b; - if (height < dz + size*(b+1) && height > dz - size*(b+1) && dist < bestDist) - { - bestDist = dist; - break; - } + if (height < dz + size*(b+1) && height > dz - size*(b+1) && dist < bestDist) + { + bestDist = dist; + break; + } continue; } @@ -1933,36 +1933,36 @@ void Spell::SearchChainTargets(std::list& targets, uint32 chainTar if (isBouncingFar && !isChainHeal) searchRadius *= chainTargets; - // Xinef: the distance should be increased by caster size, it is neglected in latter calculations - std::list tempTargets; - SearchAreaTargets(tempTargets, searchRadius, (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE ? m_caster : target), m_caster, objectType, selectType, condList); + // Xinef: the distance should be increased by caster size, it is neglected in latter calculations + std::list tempTargets; + SearchAreaTargets(tempTargets, searchRadius, (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE ? m_caster : target), m_caster, objectType, selectType, condList); tempTargets.remove(target); - // xinef: if we have select category nearby and checktype entry, select random of what we have, not by distance - if (selectCategory == TARGET_SELECT_CATEGORY_NEARBY && selectType == TARGET_CHECK_ENTRY) - { - Trinity::Containers::RandomResizeList(tempTargets, chainTargets); - targets = tempTargets; - return; - } + // xinef: if we have select category nearby and checktype entry, select random of what we have, not by distance + if (selectCategory == TARGET_SELECT_CATEGORY_NEARBY && selectType == TARGET_CHECK_ENTRY) + { + Trinity::Containers::RandomResizeList(tempTargets, chainTargets); + targets = tempTargets; + return; + } // remove targets which are always invalid for chain spells // for some spells allow only chain targets in front of caster (swipe for example) if (!isBouncingFar) { - float allowedArc = 0.0f; - if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE) - allowedArc = (M_PI*7.0f) / 18.0f; // 70 degrees - else if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED) - allowedArc = M_PI*0.5f; // 90 degrees + float allowedArc = 0.0f; + if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE) + allowedArc = (M_PI*7.0f) / 18.0f; // 70 degrees + else if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED) + allowedArc = M_PI*0.5f; // 90 degrees for (std::list::iterator itr = tempTargets.begin(); itr != tempTargets.end();) { std::list::iterator checkItr = itr++; if (!m_caster->HasInArc(static_cast(M_PI), *checkItr)) tempTargets.erase(checkItr); - else if (allowedArc > 0.0f && !m_caster->HasInArc(allowedArc, *checkItr, (*checkItr)->GetObjectSize())) - tempTargets.erase(checkItr); + else if (allowedArc > 0.0f && !m_caster->HasInArc(allowedArc, *checkItr, (*checkItr)->GetObjectSize())) + tempTargets.erase(checkItr); } } @@ -1979,9 +1979,9 @@ void Spell::SearchChainTargets(std::list& targets, uint32 chainTar if (Unit* itrTarget = (*itr)->ToUnit()) { uint32 deficit = itrTarget->GetMaxHealth() - itrTarget->GetHealth(); - // xinef: chain should not heal targets with max health - if (deficit == 0) - continue; + // xinef: chain should not heal targets with max health + if (deficit == 0) + continue; if ((deficit > maxHPDeficit || foundItr == tempTargets.end()) && target->IsWithinDist(itrTarget, jumpRadius) && target->IsWithinLOSInMap(itrTarget)) { @@ -2066,9 +2066,9 @@ void Spell::prepareDataForTriggerSystem(AuraEffect const* /*triggeredByAura*/) (m_spellInfo->SpellFamilyFlags[0] & 0x18 || // Freezing and Frost Trap, Freezing Arrow m_spellInfo->Id == 57879 || m_spellInfo->Id == 45145 || // Snake Trap - done this way to avoid double proc m_spellInfo->SpellFamilyFlags[2] & 0x00064000)) // Explosive and Immolation Trap - { + { m_procAttacker |= PROC_FLAG_DONE_TRAP_ACTIVATION; - } + } /* Effects which are result of aura proc from triggered spell cannot proc to prevent chain proc of these spells */ @@ -2101,7 +2101,7 @@ void Spell::CleanupTargetList() m_UniqueGOTargetInfo.clear(); m_UniqueItemInfo.clear(); m_delayMoment = 0; - m_delayTrajectory = 0; + m_delayTrajectory = 0; } void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/, bool implicit /*= true*/) @@ -2115,11 +2115,11 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= return; if (checkIfValid) - { - SpellCastResult res = m_spellInfo->CheckTarget(m_caster, target, implicit); + { + SpellCastResult res = m_spellInfo->CheckTarget(m_caster, target, implicit); if (res != SPELL_CAST_OK) return; - } + } // Check for effect immune skip if immuned for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) @@ -2201,8 +2201,8 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= if (targetInfo.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell targetInfo.reflectResult = SPELL_MISS_PARRY; - // Increase time interval for reflected spells by 1.5 - m_caster->m_Events.AddEvent(new ReflectEvent(m_caster->GetGUID(), targetInfo.targetGUID, m_spellInfo), m_caster->m_Events.CalculateTime(targetInfo.timeDelay)); + // Increase time interval for reflected spells by 1.5 + m_caster->m_Events.AddEvent(new ReflectEvent(m_caster->GetGUID(), targetInfo.targetGUID, m_spellInfo), m_caster->m_Events.CalculateTime(targetInfo.timeDelay)); targetInfo.timeDelay += targetInfo.timeDelay >> 1; } else @@ -2331,7 +2331,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) if (!farMask) return; // find unit in world - // Xinef: FindUnit Access without Map check!!! Intended + // Xinef: FindUnit Access without Map check!!! Intended effectUnit = ObjectAccessor::FindUnit(target->targetGUID); if (!effectUnit) return; @@ -2347,11 +2347,11 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) if (effectUnit->IsAlive() != target->alive) return; - // Xinef: absorb delayed projectiles for 500ms - if (getState() == SPELL_STATE_DELAYED && !m_spellInfo->IsTargetingArea() && !m_spellInfo->IsPositive() && - (World::GetGameTimeMS() - target->timeDelay) <= effectUnit->m_lastSanctuaryTime && World::GetGameTimeMS() < (effectUnit->m_lastSanctuaryTime + 500) && - effectUnit->FindMap() && !effectUnit->FindMap()->IsDungeon() - ) + // Xinef: absorb delayed projectiles for 500ms + if (getState() == SPELL_STATE_DELAYED && !m_spellInfo->IsTargetingArea() && !m_spellInfo->IsPositive() && + (World::GetGameTimeMS() - target->timeDelay) <= effectUnit->m_lastSanctuaryTime && World::GetGameTimeMS() < (effectUnit->m_lastSanctuaryTime + 500) && + effectUnit->FindMap() && !effectUnit->FindMap()->IsDungeon() + ) return; // No missinfo in that case // Get original caster (if exist) and calculate damage/healing from him data @@ -2375,18 +2375,18 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) //Spells with this flag cannot trigger if effect is casted on self bool canEffectTrigger = !m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_PROC) && unitTarget->CanProc() && (CanExecuteTriggersOnHit(mask) || missInfo == SPELL_MISS_IMMUNE2); - bool reflectedSpell = missInfo == SPELL_MISS_REFLECT; + bool reflectedSpell = missInfo == SPELL_MISS_REFLECT; Unit* spellHitTarget = NULL; if (missInfo == SPELL_MISS_NONE) // In case spell hit target, do all effect on that target spellHitTarget = unitTarget; else if (missInfo == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit) { - missInfo = target->reflectResult; + missInfo = target->reflectResult; if (missInfo == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him { spellHitTarget = m_caster; - unitTarget = m_caster; + unitTarget = m_caster; if (m_caster->GetTypeId() == TYPEID_UNIT) m_caster->ToCreature()->LowerPlayerDamageReq(target->damage); } @@ -2402,9 +2402,9 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) m_damage = 0; spellHitTarget = NULL; - // Xinef: if missInfo2 is MISS_EVADE, override base missinfo data - if (missInfo2 == SPELL_MISS_EVADE) - missInfo = SPELL_MISS_EVADE; + // Xinef: if missInfo2 is MISS_EVADE, override base missinfo data + if (missInfo2 == SPELL_MISS_EVADE) + missInfo = SPELL_MISS_EVADE; } } @@ -2433,7 +2433,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) { for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i) // If at least one effect negative spell is negative hit - // Xinef: if missInfo is immune state check all effects to properly determine positiveness of spell + // Xinef: if missInfo is immune state check all effects to properly determine positiveness of spell if ((missInfo == SPELL_MISS_IMMUNE2 || (mask & (1<IsPositiveEffect(i)) { positive = false; @@ -2474,31 +2474,31 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) // Do healing and triggers if (m_healing > 0) { - bool crit = target->crit; + bool crit = target->crit; uint32 addhealth = m_healing; if (crit) { procEx |= PROC_EX_CRITICAL_HIT; - addhealth = Unit::SpellCriticalHealingBonus(caster, m_spellInfo, addhealth, NULL); + addhealth = Unit::SpellCriticalHealingBonus(caster, m_spellInfo, addhealth, NULL); } else procEx |= PROC_EX_NORMAL_HIT; - // Xinef: override with forced crit, only visual result - if (GetSpellValue()->ForcedCritResult) - { - crit = true; + // Xinef: override with forced crit, only visual result + if (GetSpellValue()->ForcedCritResult) + { + crit = true; procEx |= PROC_EX_CRITICAL_HIT; - } + } int32 gain = caster->HealBySpell(unitTarget, m_spellInfo, addhealth, crit); unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo); m_healing = gain; - // Xinef: if heal acutally healed something, add no overheal flag - if (m_healing) - procEx |= PROC_EX_NO_OVERHEAL; + // Xinef: if heal acutally healed something, add no overheal flag + if (m_healing) + procEx |= PROC_EX_NO_OVERHEAL; // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) if (canEffectTrigger) @@ -2511,76 +2511,76 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask); // Add bonuses and fill damageInfo struct - // Dancing Rune Weapon... + // Dancing Rune Weapon... if (m_caster->GetEntry() == 27893) { if (Unit* owner = m_caster->GetOwner()) owner->CalculateSpellDamageTaken(&damageInfo, m_damage, m_spellInfo, m_attackType, target->crit); } - else - caster->CalculateSpellDamageTaken(&damageInfo, m_damage, m_spellInfo, m_attackType, target->crit); + else + caster->CalculateSpellDamageTaken(&damageInfo, m_damage, m_spellInfo, m_attackType, target->crit); - // xinef: override miss info after absorb / block calculations - if (missInfo == SPELL_MISS_NONE && damageInfo.damage == 0) - { - //if (damageInfo.absorb > 0) - // missInfo = SPELL_MISS_ABSORB; - if (damageInfo.blocked) - missInfo = SPELL_MISS_BLOCK; - } + // xinef: override miss info after absorb / block calculations + if (missInfo == SPELL_MISS_NONE && damageInfo.damage == 0) + { + //if (damageInfo.absorb > 0) + // missInfo = SPELL_MISS_ABSORB; + if (damageInfo.blocked) + missInfo = SPELL_MISS_BLOCK; + } - // Xinef: override with forced crit, only visual result - if (GetSpellValue()->ForcedCritResult) - { - damageInfo.HitInfo |= SPELL_HIT_TYPE_CRIT; - } + // Xinef: override with forced crit, only visual result + if (GetSpellValue()->ForcedCritResult) + { + damageInfo.HitInfo |= SPELL_HIT_TYPE_CRIT; + } - Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); + Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); - // xinef: health leech handling - if (m_spellInfo->HasEffect(SPELL_EFFECT_HEALTH_LEECH)) - { - uint8 effIndex = EFFECT_0; - for (; effIndex < MAX_SPELL_EFFECTS; ++effIndex) - if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_HEALTH_LEECH) - break; + // xinef: health leech handling + if (m_spellInfo->HasEffect(SPELL_EFFECT_HEALTH_LEECH)) + { + uint8 effIndex = EFFECT_0; + for (; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_HEALTH_LEECH) + break; - float healMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this); + float healMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this); - // get max possible damage, don't count overkill for heal - uint32 healthGain = uint32(-unitTarget->GetHealthGain(-int32(damageInfo.damage)) * healMultiplier); + // get max possible damage, don't count overkill for heal + uint32 healthGain = uint32(-unitTarget->GetHealthGain(-int32(damageInfo.damage)) * healMultiplier); - if (m_caster->IsAlive()) - { - healthGain = m_caster->SpellHealingBonusDone(m_caster, m_spellInfo, healthGain, HEAL); - healthGain = m_caster->SpellHealingBonusTaken(m_caster, m_spellInfo, healthGain, HEAL); + if (m_caster->IsAlive()) + { + healthGain = m_caster->SpellHealingBonusDone(m_caster, m_spellInfo, healthGain, HEAL); + healthGain = m_caster->SpellHealingBonusTaken(m_caster, m_spellInfo, healthGain, HEAL); - m_caster->HealBySpell(m_caster, m_spellInfo, uint32(healthGain)); - } - } + m_caster->HealBySpell(m_caster, m_spellInfo, uint32(healthGain)); + } + } // Send log damage message to client caster->SendSpellNonMeleeDamageLog(&damageInfo); - // Xinef: send info to target about reflect - if (reflectedSpell) - effectUnit->SendSpellNonMeleeReflectLog(&damageInfo, effectUnit); + // Xinef: send info to target about reflect + if (reflectedSpell) + effectUnit->SendSpellNonMeleeReflectLog(&damageInfo, effectUnit); procEx |= createProcExtendMask(&damageInfo, missInfo); procVictim |= PROC_FLAG_TAKEN_DAMAGE; - caster->DealSpellDamage(&damageInfo, true); + caster->DealSpellDamage(&damageInfo, true); - // do procs after damage, eg healing effects - // no need to check if target is alive, done in procdamageandspell + // do procs after damage, eg healing effects + // no need to check if target is alive, done in procdamageandspell - // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) - if (canEffectTrigger) - { - caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_triggeredByAuraSpell); - if (caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR0_STOP_ATTACK_TARGET) == 0 && - m_spellInfo->HasAttribute(SPELL_ATTR4_CANT_TRIGGER_ITEM_SPELLS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) - caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); - } + // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) + if (canEffectTrigger) + { + caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_triggeredByAuraSpell); + if (caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR0_STOP_ATTACK_TARGET) == 0 && + m_spellInfo->HasAttribute(SPELL_ATTR4_CANT_TRIGGER_ITEM_SPELLS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) + caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); + } m_damage = damageInfo.damage; } @@ -2592,14 +2592,14 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) procEx |= createProcExtendMask(&damageInfo, missInfo); // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) if (canEffectTrigger) - { + { caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo, m_triggeredByAuraSpell); - // Xinef: eg. rogue poisions can proc off cheap shot, etc. so this block should be here also - // Xinef: ofc count only spells that HIT the target, little hack used to fool the system - if ((procEx & PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT) && caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR0_STOP_ATTACK_TARGET) == 0 && - m_spellInfo->HasAttribute(SPELL_ATTR4_CANT_TRIGGER_ITEM_SPELLS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) - caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim|PROC_FLAG_TAKEN_DAMAGE, procEx); - } + // Xinef: eg. rogue poisions can proc off cheap shot, etc. so this block should be here also + // Xinef: ofc count only spells that HIT the target, little hack used to fool the system + if ((procEx & PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT) && caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR0_STOP_ATTACK_TARGET) == 0 && + m_spellInfo->HasAttribute(SPELL_ATTR4_CANT_TRIGGER_ITEM_SPELLS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) + caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim|PROC_FLAG_TAKEN_DAMAGE, procEx); + } // Failed Pickpocket, reveal rogue if (missInfo == SPELL_MISS_RESIST && m_spellInfo->HasAttribute(SPELL_ATTR0_CU_PICKPOCKET) && unitTarget->GetTypeId() == TYPEID_UNIT) @@ -2610,7 +2610,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) } } - if (missInfo != SPELL_MISS_EVADE && !m_caster->IsFriendlyTo(effectUnit) && !m_spellInfo->HasAura(SPELL_AURA_BIND_SIGHT) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) + if (missInfo != SPELL_MISS_EVADE && !m_caster->IsFriendlyTo(effectUnit) && !m_spellInfo->HasAura(SPELL_AURA_BIND_SIGHT) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) { m_caster->CombatStart(effectUnit, !m_spellInfo->HasAttribute(SPELL_ATTR3_NO_INITIAL_AGGRO)); @@ -2635,7 +2635,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) DoTriggersOnSpellHit(spellHitTarget, mask); // if target is fallged for pvp also flag caster if a player - // xinef: do not flag spells with aura bind sight (no special attribute) + // xinef: do not flag spells with aura bind sight (no special attribute) if (effectUnit->IsPvP() && effectUnit != m_caster && m_caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasAura(SPELL_AURA_BIND_SIGHT)) m_caster->ToPlayer()->UpdatePvP(true); @@ -2649,7 +2649,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA return SPELL_MISS_EVADE; // For delayed spells immunity may be applied between missile launch and hit - check immunity for that case - if (m_spellInfo->Speed && ((m_damage > 0 && unit->IsImmunedToDamage(m_spellInfo)) || unit->IsImmunedToSchool(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo))) + if (m_spellInfo->Speed && ((m_damage > 0 && unit->IsImmunedToDamage(m_spellInfo)) || unit->IsImmunedToSchool(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo))) return SPELL_MISS_IMMUNE; // disable effects to which unit is immune @@ -2657,12 +2657,12 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) { if (effectMask & (1 << effectNumber)) - { + { if (unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber)) effectMask &= ~(1 << effectNumber); - // Xinef: What retarded added this shit? Buggs out polymorph - // Xinef: And this is checked in MagicSpellHitResult, why we check resistance twice? - // Xinef: And why we check every spell effect basing on rand and generic dispel info? some effects will be appliend and some wont? WTF? + // Xinef: What retarded added this shit? Buggs out polymorph + // Xinef: And this is checked in MagicSpellHitResult, why we check resistance twice? + // Xinef: And why we check every spell effect basing on rand and generic dispel info? some effects will be appliend and some wont? WTF? /*else if (m_spellInfo->Effects[effectNumber].IsAura() && !m_spellInfo->IsPositiveEffect(effectNumber)) { int32 debuff_resist_chance = unit->GetMaxPositiveAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(m_spellInfo->Dispel)); @@ -2675,7 +2675,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA returnVal = SPELL_MISS_RESIST; } }*/ - } + } } if (!effectMask) return returnVal; @@ -2699,15 +2699,15 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA if (m_caster != unit) { // Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells - // Xinef: Also check evade state + // Xinef: Also check evade state if (m_spellInfo->Speed > 0.0f) - { - if (unit->GetTypeId() == TYPEID_UNIT && unit->ToCreature()->IsInEvadeMode()) - return SPELL_MISS_EVADE; + { + if (unit->GetTypeId() == TYPEID_UNIT && unit->ToCreature()->IsInEvadeMode()) + return SPELL_MISS_EVADE; - if (unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) - return SPELL_MISS_EVADE; - } + if (unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) + return SPELL_MISS_EVADE; + } if (m_caster->_IsValidAttackTarget(unit, m_spellInfo)) { @@ -2717,7 +2717,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA { // for delayed spells ignore negative spells (after duel end) for friendly targets // TODO: this cause soul transfer bugged - if(!IsTriggered() && m_spellInfo->Speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->IsPositive()) + if(!IsTriggered() && m_spellInfo->Speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->IsPositive()) return SPELL_MISS_EVADE; // assisting case, healing and resurrection @@ -2728,12 +2728,12 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA m_caster->ToPlayer()->UpdatePvP(true); } - // xinef: triggered spells should not prolong combat - if (unit->IsInCombat() && !m_spellInfo->HasAttribute(SPELL_ATTR3_NO_INITIAL_AGGRO) && !m_triggeredByAuraSpell) + // xinef: triggered spells should not prolong combat + if (unit->IsInCombat() && !m_spellInfo->HasAttribute(SPELL_ATTR3_NO_INITIAL_AGGRO) && !m_triggeredByAuraSpell) { - // xinef: start combat with hostile unit... - if (Unit* hostile = unit->getAttackerForHelper()) - m_caster->CombatStart(hostile, true); + // xinef: start combat with hostile unit... + if (Unit* hostile = unit->getAttackerForHelper()) + m_caster->CombatStart(hostile, true); //m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit); unit->getHostileRefManager().threatAssist(m_caster, 0.0f); } @@ -2746,10 +2746,10 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA aura_effmask |= 1 << i; // Get Data Needed for Diminishing Returns, some effects may have multiple auras, so this must be done on spell hit, not aura add - // Xinef: Do not increase diminishing level for self cast + // Xinef: Do not increase diminishing level for self cast m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo, m_triggeredByAuraSpell); - // xinef: do not increase diminish level for bosses (eg. Void Reaver silence is never diminished) - if (aura_effmask && m_diminishGroup && unit != m_caster && (m_caster->GetTypeId() != TYPEID_UNIT || !m_caster->ToCreature()->isWorldBoss())) + // xinef: do not increase diminish level for bosses (eg. Void Reaver silence is never diminished) + if (aura_effmask && m_diminishGroup && unit != m_caster && (m_caster->GetTypeId() != TYPEID_UNIT || !m_caster->ToCreature()->isWorldBoss())) { m_diminishLevel = unit->GetDiminishing(m_diminishGroup); DiminishingReturnsType type = GetDiminishingReturnsGroupType(m_diminishGroup); @@ -2763,9 +2763,9 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA unit->IncrDiminishing(m_diminishGroup); } - // Xinef: Stealth remove, added UGLY hack for mass dispel... cant find any other solution, ugly hack for Storm, Earth and Fire talent - if (m_caster != unit && m_caster->IsHostileTo(unit) && !m_spellInfo->IsPositive() && !m_triggeredByAuraSpell && m_spellInfo->SpellIconID != 2267 && unit->IsControlledByPlayer() && (!m_caster->IsTotem() || m_spellInfo->Id == 64695)) - unit->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); + // Xinef: Stealth remove, added UGLY hack for mass dispel... cant find any other solution, ugly hack for Storm, Earth and Fire talent + if (m_caster != unit && m_caster->IsHostileTo(unit) && !m_spellInfo->IsPositive() && !m_triggeredByAuraSpell && m_spellInfo->SpellIconID != 2267 && unit->IsControlledByPlayer() && (!m_caster->IsTotem() || m_spellInfo->Id == 64695)) + unit->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); if (aura_effmask) { @@ -2791,12 +2791,12 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA if (m_originalCaster) { bool refresh = false; - m_spellAura = Aura::TryRefreshStackOrCreate(aurSpellInfo, effectMask, unit, m_originalCaster, - (aurSpellInfo == m_spellInfo)? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, 0, &refresh, !(_triggeredCastFlags & TRIGGERED_NO_PERIODIC_RESET)); + m_spellAura = Aura::TryRefreshStackOrCreate(aurSpellInfo, effectMask, unit, m_originalCaster, + (aurSpellInfo == m_spellInfo)? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, 0, &refresh, !(_triggeredCastFlags & TRIGGERED_NO_PERIODIC_RESET)); - // xinef: if aura was not refreshed, add proc ex - if (!refresh) - m_procEx |= PROC_EX_NO_AURA_REFRESH; + // xinef: if aura was not refreshed, add proc ex + if (!refresh) + m_procEx |= PROC_EX_NO_AURA_REFRESH; if (m_spellAura) { @@ -2813,12 +2813,12 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA int32 duration = m_spellAura->GetMaxDuration(); int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup, aurSpellInfo); - // Xinef: if unit == caster - test versus original unit if available + // Xinef: if unit == caster - test versus original unit if available float diminishMod = 1.0f; - if (unit == m_caster && m_targets.GetUnitTarget()) - diminishMod = m_targets.GetUnitTarget()->ApplyDiminishingToDuration(m_diminishGroup, duration, m_originalCaster, m_diminishLevel, limitduration); - else - diminishMod = unit->ApplyDiminishingToDuration(m_diminishGroup, duration, m_originalCaster, m_diminishLevel, limitduration); + if (unit == m_caster && m_targets.GetUnitTarget()) + diminishMod = m_targets.GetUnitTarget()->ApplyDiminishingToDuration(m_diminishGroup, duration, m_originalCaster, m_diminishLevel, limitduration); + else + diminishMod = unit->ApplyDiminishingToDuration(m_diminishGroup, duration, m_originalCaster, m_diminishLevel, limitduration); // unit is immune to aura if it was diminished to 0 duration if (diminishMod == 0.0f) @@ -2841,8 +2841,8 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive, effectMask); - // xinef: haste affects duration of those spells twice - if (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, aurSpellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)) + // xinef: haste affects duration of those spells twice + if (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, aurSpellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)) duration = int32(duration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED)); if (duration != m_spellAura->GetMaxDuration()) @@ -2861,23 +2861,23 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA } } - int8 sanct_effect = -1; + int8 sanct_effect = -1; for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) { - // handle sanctuary effects after aura apply! - if (m_spellInfo->Effects[effectNumber].Effect == SPELL_EFFECT_SANCTUARY) - { - sanct_effect = effectNumber; - continue; - } + // handle sanctuary effects after aura apply! + if (m_spellInfo->Effects[effectNumber].Effect == SPELL_EFFECT_SANCTUARY) + { + sanct_effect = effectNumber; + continue; + } if (effectMask & (1 << effectNumber)) HandleEffects(unit, NULL, NULL, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); - } + } - if( sanct_effect >= 0 && (effectMask & (1<= 0 && (effectMask & (1<CastSpell(unit, 61988, true); - // Fearie Fire (Feral) - damage - if( m_preCastSpell == 60089 ) - m_caster->CastSpell(unit, m_preCastSpell, true); + // Fearie Fire (Feral) - damage + if( m_preCastSpell == 60089 ) + m_caster->CastSpell(unit, m_preCastSpell, true); else if (sSpellMgr->GetSpellInfo(m_preCastSpell)) // Blizz seems to just apply aura without bothering to cast m_caster->AddAura(m_preCastSpell, unit); @@ -2974,8 +2974,8 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo* target) if (effectMask & (1 << effectNumber)) HandleEffects(NULL, NULL, go, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); - // xinef: inform ai about spellhit - go->AI()->SpellHit(m_caster, m_spellInfo); + // xinef: inform ai about spellhit + go->AI()->SpellHit(m_caster, m_spellInfo); CallScriptOnHitHandlers(); @@ -3018,19 +3018,19 @@ bool Spell::UpdateChanneledTargetList() if (channelAuraMask) { range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive()); - if (range == 0) - for(int i = EFFECT_0; i <= EFFECT_2; ++i) - if (channelAuraMask & (1<Effects[i].RadiusEntry) - { - range = m_spellInfo->Effects[i].CalcRadius(NULL, NULL); - break; - } + if (range == 0) + for(int i = EFFECT_0; i <= EFFECT_2; ++i) + if (channelAuraMask & (1<Effects[i].RadiusEntry) + { + range = m_spellInfo->Effects[i].CalcRadius(NULL, NULL); + break; + } if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); - // xinef: add little tolerance level - range += std::min(3.0f, range*0.1f); // 10% but no more than 3yd + // xinef: add little tolerance level + range += std::min(3.0f, range*0.1f); // 10% but no more than 3yd } for (std::list::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) @@ -3049,17 +3049,17 @@ bool Spell::UpdateChanneledTargetList() if (AuraApplication * aurApp = unit->GetAuraApplication(m_spellInfo->Id, m_originalCasterGUID)) { if (m_caster != unit) - { - if (!m_caster->IsWithinDistInMap(unit, range)) - { - ihit->effectMask &= ~aurApp->GetEffectMask(); - unit->RemoveAura(aurApp); - continue; - } - // Xinef: Update Orientation server side (non players wont sent appropriate packets) - else if (m_spellInfo->HasAttribute(SPELL_ATTR1_CHANNEL_TRACK_TARGET)) - m_caster->UpdateOrientation(m_caster->GetAngle(unit)); - } + { + if (!m_caster->IsWithinDistInMap(unit, range)) + { + ihit->effectMask &= ~aurApp->GetEffectMask(); + unit->RemoveAura(aurApp); + continue; + } + // Xinef: Update Orientation server side (non players wont sent appropriate packets) + else if (m_spellInfo->HasAttribute(SPELL_ATTR1_CHANNEL_TRACK_TARGET)) + m_caster->UpdateOrientation(m_caster->GetAngle(unit)); + } } else // aura is dispelled continue; @@ -3070,19 +3070,19 @@ bool Spell::UpdateChanneledTargetList() } } - // Xinef: not all effects are covered, remove applications from all targets - if (channelTargetEffectMask != 0) - { - for (std::list::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) - if (ihit->missCondition == SPELL_MISS_NONE && (channelAuraMask & ihit->effectMask)) - if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID)) - if (IsValidDeadOrAliveTarget(unit)) - if (AuraApplication * aurApp = unit->GetAuraApplication(m_spellInfo->Id, m_originalCasterGUID)) - { - ihit->effectMask &= ~aurApp->GetEffectMask(); + // Xinef: not all effects are covered, remove applications from all targets + if (channelTargetEffectMask != 0) + { + for (std::list::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + if (ihit->missCondition == SPELL_MISS_NONE && (channelAuraMask & ihit->effectMask)) + if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID)) + if (IsValidDeadOrAliveTarget(unit)) + if (AuraApplication * aurApp = unit->GetAuraApplication(m_spellInfo->Id, m_originalCasterGUID)) + { + ihit->effectMask &= ~aurApp->GetEffectMask(); unit->RemoveAura(aurApp); - } - } + } + } // is all effects from m_needAliveTargetMask have alive targets return channelTargetEffectMask == 0; @@ -3184,38 +3184,38 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered return; } - // xinef: if spell have nearby target entry only, do not allow to cast if no targets are found - if (m_CastItem) - { - bool selectTargets = false; - for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) - { - if (!m_spellInfo->Effects[i].IsEffect()) - continue; - - if (m_spellInfo->Effects[i].TargetA.GetSelectionCategory() != TARGET_SELECT_CATEGORY_NEARBY || m_spellInfo->Effects[i].TargetA.GetCheckType() != TARGET_CHECK_ENTRY) - { - selectTargets = false; - break; - } + // xinef: if spell have nearby target entry only, do not allow to cast if no targets are found + if (m_CastItem) + { + bool selectTargets = false; + for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) + { + if (!m_spellInfo->Effects[i].IsEffect()) + continue; + + if (m_spellInfo->Effects[i].TargetA.GetSelectionCategory() != TARGET_SELECT_CATEGORY_NEARBY || m_spellInfo->Effects[i].TargetA.GetCheckType() != TARGET_CHECK_ENTRY) + { + selectTargets = false; + break; + } - // xinef: by default set it to false, and to true if any valid target is found - selectTargets = true; - } + // xinef: by default set it to false, and to true if any valid target is found + selectTargets = true; + } - if (selectTargets) - { - SelectSpellTargets(); - _spellTargetsSelected = true; + if (selectTargets) + { + SelectSpellTargets(); + _spellTargetsSelected = true; - if (m_UniqueTargetInfo.empty() && m_UniqueGOTargetInfo.empty()) - { - SendCastResult(SPELL_FAILED_CASTER_AURASTATE); - finish(false); - return; - } - } - } + if (m_UniqueTargetInfo.empty() && m_UniqueGOTargetInfo.empty()) + { + SendCastResult(SPELL_FAILED_CASTER_AURASTATE); + finish(false); + return; + } + } + } // set timer base at cast time ReSetTimer(); @@ -3242,24 +3242,24 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered // set target for proper facing if ((m_casttime || m_spellInfo->IsChanneled()) && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING)) - { - if (m_caster->GetTypeId() == TYPEID_UNIT && !m_caster->ToCreature()->IsInEvadeMode() && - ((m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget()) || m_spellInfo->IsPositive())) - { - // Xinef: Creature should focus to cast target if there is explicit target or self if casting positive spell - // Xinef: Creature should not rotate like a retard when casting spell... based on halion behavior - m_caster->ToCreature()->FocusTarget(this, m_targets.GetObjectTarget() != NULL ? m_targets.GetObjectTarget() : m_caster); - } - } + { + if (m_caster->GetTypeId() == TYPEID_UNIT && !m_caster->ToCreature()->IsInEvadeMode() && + ((m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget()) || m_spellInfo->IsPositive())) + { + // Xinef: Creature should focus to cast target if there is explicit target or self if casting positive spell + // Xinef: Creature should not rotate like a retard when casting spell... based on halion behavior + m_caster->ToCreature()->FocusTarget(this, m_targets.GetObjectTarget() != NULL ? m_targets.GetObjectTarget() : m_caster); + } + } //item: first cast may destroy item and second cast causes crash - // xinef: removed !m_spellInfo->StartRecoveryTime because of TC retardiness - // second los check failed in events - // xinef: removed itemguid check, currently there is no such item in database + // xinef: removed !m_spellInfo->StartRecoveryTime because of TC retardiness + // second los check failed in events + // xinef: removed itemguid check, currently there is no such item in database if (!m_casttime && /*!m_castItemGUID &&*/ GetCurrentContainer() == CURRENT_GENERIC_SPELL) cast(true); - if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD)) + if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD)) TriggerGlobalCooldown(); } } @@ -3279,10 +3279,10 @@ void Spell::cancel(bool bySelf) case SPELL_STATE_PREPARING: CancelGlobalCooldown(); if (m_caster->GetTypeId() == TYPEID_PLAYER) - { - if (m_caster->ToPlayer()->NeedSendSpectatorData()) - ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999); - } + { + if (m_caster->ToPlayer()->NeedSendSpectatorData()) + ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999); + } case SPELL_STATE_DELAYED: SendInterrupted(0); // xinef: fixes bugged gcd reset in some cases @@ -3300,8 +3300,8 @@ void Spell::cancel(bool bySelf) SendInterrupted(0); SendCastResult(SPELL_FAILED_INTERRUPTED); - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) - ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999); + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) + ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999); // spell is canceled-take mods and clear list if (Player* player = m_caster->GetSpellModOwner()) @@ -3330,19 +3330,19 @@ void Spell::cancel(bool bySelf) void Spell::cast(bool skipCheck) { - Player* modOwner = m_caster->GetSpellModOwner(); - Spell* lastMod = NULL; - if (modOwner) - { - lastMod = modOwner->m_spellModTakingSpell; - if (lastMod) - modOwner->SetSpellModTakingSpell(lastMod, false); - } + Player* modOwner = m_caster->GetSpellModOwner(); + Spell* lastMod = NULL; + if (modOwner) + { + lastMod = modOwner->m_spellModTakingSpell; + if (lastMod) + modOwner->SetSpellModTakingSpell(lastMod, false); + } - _cast(skipCheck); + _cast(skipCheck); - if (lastMod) - modOwner->SetSpellModTakingSpell(lastMod, true); + if (lastMod) + modOwner->SetSpellModTakingSpell(lastMod, true); } void Spell::_cast(bool skipCheck) @@ -3362,16 +3362,16 @@ void Spell::_cast(bool skipCheck) return; } - // Xinef: implement attribute SPELL_ATTR1_DISMISS_PET, on spell cast current pet is dismissed and charms are removed - if (m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET)) - { - if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasEffect(SPELL_EFFECT_SUMMON_PET)) - if (Pet* pet = m_caster->ToPlayer()->GetPet()) - m_caster->ToPlayer()->RemovePet(pet, PET_SAVE_AS_CURRENT); + // Xinef: implement attribute SPELL_ATTR1_DISMISS_PET, on spell cast current pet is dismissed and charms are removed + if (m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET)) + { + if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasEffect(SPELL_EFFECT_SUMMON_PET)) + if (Pet* pet = m_caster->ToPlayer()->GetPet()) + m_caster->ToPlayer()->RemovePet(pet, PET_SAVE_AS_CURRENT); - if (Unit* charm = m_caster->GetCharm()) - charm->RemoveAurasByType(SPELL_AURA_MOD_CHARM, m_caster->GetGUID()); - } + if (Unit* charm = m_caster->GetCharm()) + charm->RemoveAurasByType(SPELL_AURA_MOD_CHARM, m_caster->GetGUID()); + } if (Player* playerCaster = m_caster->ToPlayer()) { @@ -3399,7 +3399,7 @@ void Spell::_cast(bool skipCheck) CallScriptBeforeCastHandlers(); - Player* modOwner = m_caster->GetSpellModOwner(); + Player* modOwner = m_caster->GetSpellModOwner(); // skip check if done already (for instant cast spells for example) if (!skipCheck) { @@ -3438,14 +3438,14 @@ void Spell::_cast(bool skipCheck) } } - if (modOwner) - modOwner->SetSpellModTakingSpell(this, true); + if (modOwner) + modOwner->SetSpellModTakingSpell(this, true); - if (!_spellTargetsSelected) - SelectSpellTargets(); + if (!_spellTargetsSelected) + SelectSpellTargets(); - if (modOwner) - modOwner->SetSpellModTakingSpell(this, false); + if (modOwner) + modOwner->SetSpellModTakingSpell(this, false); // Spell may be finished after target map check if (m_spellState == SPELL_STATE_FINISHED) @@ -3456,15 +3456,15 @@ void Spell::_cast(bool skipCheck) return; } - if (modOwner) - modOwner->SetSpellModTakingSpell(this, true); + if (modOwner) + modOwner->SetSpellModTakingSpell(this, true); PrepareTriggersExecutedOnHit(); CallScriptOnCastHandlers(); - if (modOwner) - modOwner->SetSpellModTakingSpell(this, false); + if (modOwner) + modOwner->SetSpellModTakingSpell(this, false); // traded items have trade slot instead of guid in m_itemTargetGUID // set to real guid to be sent later to the client @@ -3478,7 +3478,7 @@ void Spell::_cast(bool skipCheck) m_caster->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, m_CastItem->GetEntry()); } - m_caster->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, m_spellInfo->Id, 0, (m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : m_caster)); + m_caster->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, m_spellInfo->Id, 0, (m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : m_caster)); } if (!(_triggeredCastFlags & TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)) @@ -3497,7 +3497,7 @@ void Spell::_cast(bool skipCheck) SendSpellCooldown(); // CAST SPELL - if (modOwner) + if (modOwner) modOwner->SetSpellModTakingSpell(this, true); PrepareScriptHitHandlers(); @@ -3522,16 +3522,16 @@ void Spell::_cast(bool skipCheck) if (m_caster->HasUnitState(UNIT_STATE_CASTING) && !m_caster->IsNonMeleeSpellCast(false, false, true)) m_caster->ClearUnitState(UNIT_STATE_CASTING); - // remove all applied mods at this point - // dont allow user to use them twice in case spell did not reach current target + // remove all applied mods at this point + // dont allow user to use them twice in case spell did not reach current target if (modOwner) modOwner->RemoveSpellMods(this); - // Xinef: Fucking retarded idiots, why do we keep focus after spell is sent to air? - // Xinef: Because of this, in the middle of some animation after setting targetguid to 0 etc - // Xinef: we get focused to it out of nowhere, idiots... - if (Creature* creatureCaster = m_caster->ToCreature()) - creatureCaster->ReleaseFocus(this); + // Xinef: Fucking retarded idiots, why do we keep focus after spell is sent to air? + // Xinef: Because of this, in the middle of some animation after setting targetguid to 0 etc + // Xinef: we get focused to it out of nowhere, idiots... + if (Creature* creatureCaster = m_caster->ToCreature()) + creatureCaster->ReleaseFocus(this); } else { @@ -3541,7 +3541,7 @@ void Spell::_cast(bool skipCheck) CallScriptAfterCastHandlers(); - if (modOwner) + if (modOwner) modOwner->SetSpellModTakingSpell(this, false); if (const std::vector *spell_triggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id)) @@ -3560,11 +3560,11 @@ void Spell::_cast(bool skipCheck) if (target->GetTypeId() == TYPEID_UNIT) m_caster->CastSpell(target, 32747, true); - // xinef: start combat at cast for delayed spells, only for explicit target - if (Unit* target = m_targets.GetUnitTarget()) - if (m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->IsPet() && m_caster->IsControlledByPlayer())) - if (GetDelayMoment() > 0 && !m_caster->IsFriendlyTo(target) && !m_spellInfo->HasAura(SPELL_AURA_BIND_SIGHT) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) - m_caster->CombatStartOnCast(target, !m_spellInfo->HasAttribute(SPELL_ATTR3_NO_INITIAL_AGGRO), GetDelayMoment() + 500); // xinef: increase this time so we dont leave and enter combat in a moment + // xinef: start combat at cast for delayed spells, only for explicit target + if (Unit* target = m_targets.GetUnitTarget()) + if (m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->IsPet() && m_caster->IsControlledByPlayer())) + if (GetDelayMoment() > 0 && !m_caster->IsFriendlyTo(target) && !m_spellInfo->HasAura(SPELL_AURA_BIND_SIGHT) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) + m_caster->CombatStartOnCast(target, !m_spellInfo->HasAttribute(SPELL_ATTR3_NO_INITIAL_AGGRO), GetDelayMoment() + 500); // xinef: increase this time so we dont leave and enter combat in a moment SetExecutedCurrently(false); } @@ -3582,7 +3582,7 @@ void Spell::handle_immediate() if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration); // Apply haste mods - if (m_caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)) + if (m_caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)) duration = int32(duration * m_caster->GetFloatValue(UNIT_MOD_CAST_SPEED)); m_spellState = SPELL_STATE_CASTING; @@ -3634,7 +3634,7 @@ uint64 Spell::handle_delayed(uint64 t_offset) return 0; } - Player* modOwner = m_caster->GetSpellModOwner(); + Player* modOwner = m_caster->GetSpellModOwner(); if (modOwner) modOwner->SetSpellModTakingSpell(this, true); @@ -3646,8 +3646,8 @@ uint64 Spell::handle_delayed(uint64 t_offset) { _handle_immediate_phase(); m_immediateHandled = true; - m_delayTrajectory = 0; - next_time = 0; + m_delayTrajectory = 0; + next_time = 0; } bool single_missile = (m_targets.HasDst()); @@ -3732,7 +3732,7 @@ void Spell::_handle_immediate_phase() void Spell::_handle_finish_phase() { - if (m_caster->m_movedByPlayer && m_needComboPoints) + if (m_caster->m_movedByPlayer && m_needComboPoints) { // Take for real after all targets are processed m_caster->m_movedByPlayer->ToPlayer()->ClearComboPoints(); @@ -3751,7 +3751,7 @@ void Spell::_handle_finish_phase() if (Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) for (std::list::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { - // Xinef: Properly clear infinite cooldowns in some cases + // Xinef: Properly clear infinite cooldowns in some cases if (ihit->targetGUID == m_caster->GetGUID() && ihit->missCondition != SPELL_MISS_NONE) if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->IsCooldownStartedOnEvent()) m_caster->ToPlayer()->SendCooldownEvent(m_spellInfo); @@ -3760,28 +3760,28 @@ void Spell::_handle_finish_phase() void Spell::SendSpellCooldown() { - // xinef: properly add creature cooldowns + // xinef: properly add creature cooldowns if (m_caster->GetTypeId() != TYPEID_PLAYER) - { - if (!(_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD)) - { - // xinef: this should be added here - //m_caster->AddSpellCooldown(m_spellInfo->Id, 0, 0); + { + if (!(_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD)) + { + // xinef: this should be added here + //m_caster->AddSpellCooldown(m_spellInfo->Id, 0, 0); - // xinef: this adds cooldowns to vehicle spells which misses them client-side (when we overwrote dbc info in eg.) - if (m_spellInfo->RequireCooldownInfo()) - if (Player* player = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - WorldPacket data(SMSG_SPELL_COOLDOWN, 8 + 1 + 4 + 4); - data << uint64(m_caster->GetGUID()); - data << uint8(SPELL_COOLDOWN_FLAG_INCLUDE_GCD); - data << uint32(m_spellInfo->Id); - data << uint32(m_spellInfo->RecoveryTime); - player->SendDirectMessage(&data); - } - } + // xinef: this adds cooldowns to vehicle spells which misses them client-side (when we overwrote dbc info in eg.) + if (m_spellInfo->RequireCooldownInfo()) + if (Player* player = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + WorldPacket data(SMSG_SPELL_COOLDOWN, 8 + 1 + 4 + 4); + data << uint64(m_caster->GetGUID()); + data << uint8(SPELL_COOLDOWN_FLAG_INCLUDE_GCD); + data << uint32(m_spellInfo->Id); + data << uint32(m_spellInfo->RecoveryTime); + player->SendDirectMessage(&data); + } + } return; - } + } Player* _player = m_caster->ToPlayer(); @@ -3789,7 +3789,7 @@ void Spell::SendSpellCooldown() if (m_CastItem && (m_CastItem->IsPotion() || m_spellInfo->IsCooldownStartedOnEvent())) { // need in some way provided data for Spell::finish SendCooldownEvent - _player->SetLastPotionId(m_CastItem->GetEntry()); + _player->SetLastPotionId(m_CastItem->GetEntry()); return; } @@ -3818,7 +3818,7 @@ void Spell::update(uint32 difftime) } // check if the player caster has moved before the spell finished - // xinef: added preparing state (real cast, skip channels as they have other flags for this) + // xinef: added preparing state (real cast, skip channels as they have other flags for this) if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) && m_caster->isMoving() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT) && m_spellState == SPELL_STATE_PREPARING && (m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR))) @@ -3864,11 +3864,11 @@ void Spell::update(uint32 difftime) finish(); } - // Xinef: Dont update channeled target list on last tick, allow auras to update duration properly - // Xinef: Added this strange check because of diffrent update routines for players / creatures - // Xinef: If creature gets new aura in 800ms and in 840ms its updated with diff 270, not 40 is removed from duration but 270 - // Xinef: so the aura can be removed in different updates for all units - else if ((m_timer < 0 || m_timer > 300) && !UpdateChanneledTargetList()) + // Xinef: Dont update channeled target list on last tick, allow auras to update duration properly + // Xinef: Added this strange check because of diffrent update routines for players / creatures + // Xinef: If creature gets new aura in 800ms and in 840ms its updated with diff 270, not 40 is removed from duration but 270 + // Xinef: so the aura can be removed in different updates for all units + else if ((m_timer < 0 || m_timer > 300) && !UpdateChanneledTargetList()) { ;//sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Channeled spell %d is removed due to lack of targets", m_spellInfo->Id); SendChannelUpdate(0); @@ -3910,22 +3910,22 @@ void Spell::finish(bool ok) creatureCaster->ReleaseFocus(this); if (!ok) - { - if (m_caster->GetTypeId() == TYPEID_PLAYER) - { - // Xinef: Restore spell mods in case of fail cast - m_caster->ToPlayer()->RestoreSpellMods(this); + { + if (m_caster->GetTypeId() == TYPEID_PLAYER) + { + // Xinef: Restore spell mods in case of fail cast + m_caster->ToPlayer()->RestoreSpellMods(this); - // Xinef: Reset cooldown event in case of fail cast - if (m_spellInfo->IsCooldownStartedOnEvent()) - m_caster->ToPlayer()->SendCooldownEvent(m_spellInfo, 0, 0, false); - } - return; - } + // Xinef: Reset cooldown event in case of fail cast + if (m_spellInfo->IsCooldownStartedOnEvent()) + m_caster->ToPlayer()->SendCooldownEvent(m_spellInfo, 0, 0, false); + } + return; + } - // pussywizard: - if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_ENCOUNTER_REWARD) && m_caster->FindMap()) - m_caster->FindMap()->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, m_spellInfo->Id, m_caster); + // pussywizard: + if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_ENCOUNTER_REWARD) && m_caster->FindMap()) + m_caster->FindMap()->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, m_spellInfo->Id, m_caster); if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsSummon()) { @@ -3954,17 +3954,17 @@ void Spell::finish(bool ok) } if (!found && !m_spellInfo->HasAttribute(SPELL_ATTR2_NOT_RESET_AUTO_ACTIONS)) { - bool allow = true; - if (m_casttime == 0 && m_spellInfo->CalcCastTime()) - allow = false; + bool allow = true; + if (m_casttime == 0 && m_spellInfo->CalcCastTime()) + allow = false; - if (allow) - { - m_caster->resetAttackTimer(BASE_ATTACK); - if (m_caster->haveOffhandWeapon()) - m_caster->resetAttackTimer(OFF_ATTACK); - m_caster->resetAttackTimer(RANGED_ATTACK); - } + if (allow) + { + m_caster->resetAttackTimer(BASE_ATTACK); + if (m_caster->haveOffhandWeapon()) + m_caster->resetAttackTimer(OFF_ATTACK); + m_caster->resetAttackTimer(RANGED_ATTACK); + } } } @@ -3972,14 +3972,14 @@ void Spell::finish(bool ok) if (m_caster->GetTypeId() == TYPEID_PLAYER && !IsTriggered()) m_caster->ToPlayer()->UpdatePotionCooldown(); - // Take mods after trigger spell (needed for 14177 to affect 48664) + // Take mods after trigger spell (needed for 14177 to affect 48664) // mods are taken only on succesfull cast and independantly from targets of the spell - if (Player* player = m_caster->GetSpellModOwner()) + if (Player* player = m_caster->GetSpellModOwner()) player->RemoveSpellMods(this); - // xinef: clear reactive auras states after spell cast - if (m_spellInfo->CasterAuraState == AURA_STATE_DEFENSE || m_spellInfo->CasterAuraState == AURA_STATE_HUNTER_PARRY) - m_caster->ModifyAuraState(AuraStateType(m_spellInfo->CasterAuraState), false); + // xinef: clear reactive auras states after spell cast + if (m_spellInfo->CasterAuraState == AURA_STATE_DEFENSE || m_spellInfo->CasterAuraState == AURA_STATE_HUNTER_PARRY) + m_caster->ModifyAuraState(AuraStateType(m_spellInfo->CasterAuraState), false); // Stop Attack for some spells if (m_spellInfo->HasAttribute(SPELL_ATTR0_STOP_ATTACK_TARGET)) @@ -4113,9 +4113,9 @@ void Spell::SendCastResult(SpellCastResult result) if (m_caster->ToPlayer()->GetSession()->PlayerLoading()) // don't send cast results at loading time return; - // Xinef: override every possible result, except for gm fail result... breaks many things and goes unnoticed because of this and makes me rage when i find this out - if ((_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) && result != SPELL_FAILED_BM_OR_INVISGOD) - result = SPELL_FAILED_DONT_REPORT; + // Xinef: override every possible result, except for gm fail result... breaks many things and goes unnoticed because of this and makes me rage when i find this out + if ((_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) && result != SPELL_FAILED_BM_OR_INVISGOD) + result = SPELL_FAILED_DONT_REPORT; SendCastResult(m_caster->ToPlayer(), m_spellInfo, m_cast_count, result, m_customError); } @@ -4189,8 +4189,8 @@ void Spell::SendSpellStart() m_caster->SendMessageToSet(&data, true); - if (!m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) - ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, m_timer); + if (!m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) + ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, m_timer); } void Spell::SendSpellGo() @@ -4396,7 +4396,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits { *data << uint64(ihit->targetGUID); - // Xinef: WTF is this? No channeled spell checked, no anything + // Xinef: WTF is this? No channeled spell checked, no anything //m_channelTargetEffectMask |=ihit->effectMask; ++hit; } @@ -4423,7 +4423,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) } } // Reset m_needAliveTargetMask for non channeled spell - // Xinef: Why do we reset something that is not set?????? + // Xinef: Why do we reset something that is not set?????? //if (!m_spellInfo->IsChanneled()) // m_channelTargetEffectMask = 0; @@ -4578,8 +4578,8 @@ void Spell::SendChannelStart(uint32 duration) m_caster->SendMessageToSet(&data, true); - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) - ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, -((int32)duration)); + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData()) + ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, -((int32)duration)); m_timer = duration; if (channelTarget) @@ -4687,7 +4687,7 @@ void Spell::TakePower() for (std::list::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) if (ihit->targetGUID == targetGUID) { - if (ihit->missCondition != SPELL_MISS_NONE && ihit->missCondition != SPELL_MISS_BLOCK && ihit->missCondition != SPELL_MISS_ABSORB && ihit->missCondition != SPELL_MISS_REFLECT) + if (ihit->missCondition != SPELL_MISS_NONE && ihit->missCondition != SPELL_MISS_BLOCK && ihit->missCondition != SPELL_MISS_ABSORB && ihit->missCondition != SPELL_MISS_REFLECT) { hit = false; //lower spell cost on fail (by talent aura) @@ -4840,36 +4840,36 @@ void Spell::TakeRunePower(bool didHit) player->SetLastUsedRune(rune); runeCost[rune]--; } - } + } - // Xinef: firstly consume death runes of base type - // Xinef: in second loop consume all available - for (uint8 loop = 0; loop < 2; ++loop) - { - runeCost[RUNE_DEATH] = runeCost[RUNE_BLOOD] + runeCost[RUNE_UNHOLY] + runeCost[RUNE_FROST]; - if (runeCost[RUNE_DEATH] > 0) - { - for (uint8 i = 0; i < MAX_RUNES; ++i) - { - RuneType rune = player->GetCurrentRune(i); - if (!player->GetRuneCooldown(i) && rune == RUNE_DEATH && (loop ? true : (runeCost[player->GetBaseRune(i)] > 0))) - { - player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown(i, false) : uint32(RUNE_MISS_COOLDOWN)); - player->SetLastUsedRune(rune); - runeCost[rune]--; - if (!loop) - runeCost[player->GetBaseRune(i)]--; + // Xinef: firstly consume death runes of base type + // Xinef: in second loop consume all available + for (uint8 loop = 0; loop < 2; ++loop) + { + runeCost[RUNE_DEATH] = runeCost[RUNE_BLOOD] + runeCost[RUNE_UNHOLY] + runeCost[RUNE_FROST]; + if (runeCost[RUNE_DEATH] > 0) + { + for (uint8 i = 0; i < MAX_RUNES; ++i) + { + RuneType rune = player->GetCurrentRune(i); + if (!player->GetRuneCooldown(i) && rune == RUNE_DEATH && (loop ? true : (runeCost[player->GetBaseRune(i)] > 0))) + { + player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown(i, false) : uint32(RUNE_MISS_COOLDOWN)); + player->SetLastUsedRune(rune); + runeCost[rune]--; + if (!loop) + runeCost[player->GetBaseRune(i)]--; - // keep Death Rune type if missed - if (didHit) - player->RestoreBaseRune(i); + // keep Death Rune type if missed + if (didHit) + player->RestoreBaseRune(i); - if (runeCost[RUNE_DEATH] == 0) - break; - } - } - } - } + if (runeCost[RUNE_DEATH] == 0) + break; + } + } + } + } // you can gain some runic power when use runes if (didHit) @@ -4959,10 +4959,10 @@ void Spell::HandleThreatSpells() threatToAdd = 0.0f; Unit* target = ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); - if (!target) + if (!target) continue; - bool IsFriendly = m_caster->IsFriendlyTo(target); + bool IsFriendly = m_caster->IsFriendlyTo(target); // positive spells distribute threat among all units that are in combat with target, like healing if (m_spellInfo->_IsPositiveSpell() && IsFriendly) target->getHostileRefManager().threatAssist(m_caster, threatToAdd, m_spellInfo); @@ -5002,34 +5002,34 @@ SpellCastResult Spell::CheckCast(bool strict) if (!m_caster->IsAlive() && !m_spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !(m_spellInfo->HasAttribute(SPELL_ATTR0_CASTABLE_WHILE_DEAD) || (IsTriggered() && !m_triggeredByAuraSpell))) return SPELL_FAILED_CASTER_DEAD; - // Spectator check - if (m_caster->GetTypeId() == TYPEID_PLAYER) - if (((const Player*)m_caster)->IsSpectator() && m_spellInfo->Id != SPECTATOR_SPELL_BINDSIGHT) - return SPELL_FAILED_NOT_HERE; + // Spectator check + if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (((const Player*)m_caster)->IsSpectator() && m_spellInfo->Id != SPECTATOR_SPELL_BINDSIGHT) + return SPELL_FAILED_NOT_HERE; // check cooldowns to prevent cheating if (!m_spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE)) { - if (m_caster->GetTypeId() == TYPEID_PLAYER) - { - //can cast triggered (by aura only?) spells while have this flag + if (m_caster->GetTypeId() == TYPEID_PLAYER) + { + //can cast triggered (by aura only?) spells while have this flag if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY)) return SPELL_FAILED_SPELL_IN_PROGRESS; - if (!(_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) && m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id)) - { - if (m_triggeredByAuraSpell) - return SPELL_FAILED_DONT_REPORT; - else - return SPELL_FAILED_NOT_READY; - } + if (!(_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) && m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id)) + { + if (m_triggeredByAuraSpell) + return SPELL_FAILED_DONT_REPORT; + else + return SPELL_FAILED_NOT_READY; + } - // check if we are using a potion in combat for the 2nd+ time. Cooldown is added only after caster gets out of combat - if (m_caster->ToPlayer()->GetLastPotionId() && m_CastItem && (m_CastItem->IsPotion() || m_spellInfo->IsCooldownStartedOnEvent())) - return SPELL_FAILED_NOT_READY; - } - else if (!IsTriggered() && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsSpellProhibited(m_spellInfo->GetSchoolMask())) - return SPELL_FAILED_NOT_READY; + // check if we are using a potion in combat for the 2nd+ time. Cooldown is added only after caster gets out of combat + if (m_caster->ToPlayer()->GetLastPotionId() && m_CastItem && (m_CastItem->IsPotion() || m_spellInfo->IsCooldownStartedOnEvent())) + return SPELL_FAILED_NOT_READY; + } + else if (!IsTriggered() && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsSpellProhibited(m_spellInfo->GetSchoolMask())) + return SPELL_FAILED_NOT_READY; } @@ -5125,27 +5125,27 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_AFFECTING_COMBAT; } - // Xinef: exploit protection + // Xinef: exploit protection if (reqCombat && !m_spellInfo->CanBeUsedInCombat() && (m_spellInfo->HasEffect(SPELL_EFFECT_RESURRECT) || m_spellInfo->HasEffect(SPELL_EFFECT_RESURRECT_NEW))) - { - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->GetMap()->IsDungeon()) - if (InstanceScript* instanceScript = m_caster->GetInstanceScript()) - if (instanceScript->IsEncounterInProgress()) - { - if (Group* group = m_caster->ToPlayer()->GetGroup()) - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - if (Player* member = itr->GetSource()) - if (member->IsInMap(m_caster)) - if (Unit* victim = member->GetVictim()) - if (victim->IsInCombat() && m_caster->GetDistance(victim) < m_caster->GetVisibilityRange()) - { - m_caster->CombatStart(victim); - victim->AddThreat(m_caster, 1.0f); - break; - } - return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED; - } - } + { + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->GetMap()->IsDungeon()) + if (InstanceScript* instanceScript = m_caster->GetInstanceScript()) + if (instanceScript->IsEncounterInProgress()) + { + if (Group* group = m_caster->ToPlayer()->GetGroup()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Player* member = itr->GetSource()) + if (member->IsInMap(m_caster)) + if (Unit* victim = member->GetVictim()) + if (victim->IsInCombat() && m_caster->GetDistance(victim) < m_caster->GetVisibilityRange()) + { + m_caster->CombatStart(victim); + victim->AddThreat(m_caster, 1.0f); + break; + } + return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED; + } + } // cancel autorepeat spells if cast start when moving // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code) @@ -5211,17 +5211,17 @@ SpellCastResult Spell::CheckCast(bool strict) // those spells may have incorrect target entries or not filled at all (for example 15332) // such spells when learned are not targeting anyone using targeting system, they should apply directly to caster instead // also, such casts shouldn't be sent to client - // Xinef: do not check explicit casts for self cast of triggered spells (eg. reflect case) - if (!(m_spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && (!m_targets.GetUnitTarget() || m_targets.GetUnitTarget() == m_caster))) + // Xinef: do not check explicit casts for self cast of triggered spells (eg. reflect case) + if (!(m_spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && (!m_targets.GetUnitTarget() || m_targets.GetUnitTarget() == m_caster))) { // Check explicit target for m_originalCaster - todo: get rid of such workarounds - // Xinef: do not check explicit target for triggered spell casted on self with targetflag enemy - if (!m_triggeredByAuraSpell || m_targets.GetUnitTarget() != m_caster || !(m_spellInfo->GetExplicitTargetMask() & TARGET_FLAG_UNIT_ENEMY)) - { - SpellCastResult castResult = m_spellInfo->CheckExplicitTarget((m_originalCaster && m_caster->GetEntry() != WORLD_TRIGGER) ? m_originalCaster : m_caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget()); - if (castResult != SPELL_CAST_OK) - return castResult; - } + // Xinef: do not check explicit target for triggered spell casted on self with targetflag enemy + if (!m_triggeredByAuraSpell || m_targets.GetUnitTarget() != m_caster || !(m_spellInfo->GetExplicitTargetMask() & TARGET_FLAG_UNIT_ENEMY)) + { + SpellCastResult castResult = m_spellInfo->CheckExplicitTarget((m_originalCaster && m_caster->GetEntry() != WORLD_TRIGGER) ? m_originalCaster : m_caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget()); + if (castResult != SPELL_CAST_OK) + return castResult; + } } if (Unit* target = m_targets.GetUnitTarget()) @@ -5240,9 +5240,9 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER) && !target->HasInArc(static_cast(M_PI), m_caster)) return SPELL_FAILED_NOT_INFRONT; - if (m_caster->GetEntry() != WORLD_TRIGGER) // Ignore LOS for gameobjects casts (wrongly casted by a trigger) - if ((!m_caster->IsTotem() || !m_spellInfo->IsPositive()) && !m_spellInfo->HasAttribute(SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && !m_spellInfo->HasAttribute(SPELL_ATTR5_SKIP_CHECKCAST_LOS_CHECK) && !m_caster->IsWithinLOSInMap(target)) - return SPELL_FAILED_LINE_OF_SIGHT; + if (m_caster->GetEntry() != WORLD_TRIGGER) // Ignore LOS for gameobjects casts (wrongly casted by a trigger) + if ((!m_caster->IsTotem() || !m_spellInfo->IsPositive()) && !m_spellInfo->HasAttribute(SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && !m_spellInfo->HasAttribute(SPELL_ATTR5_SKIP_CHECKCAST_LOS_CHECK) && !m_caster->IsWithinLOSInMap(target)) + return SPELL_FAILED_LINE_OF_SIGHT; } } @@ -5271,7 +5271,7 @@ SpellCastResult Spell::CheckCast(bool strict) break; } - } + } // Spell casted only on battleground if (m_spellInfo->HasAttribute(SPELL_ATTR3_BATTLEGROUND) && m_caster->GetTypeId() == TYPEID_PLAYER) if (!m_caster->ToPlayer()->InBattleground()) @@ -5313,10 +5313,10 @@ SpellCastResult Spell::CheckCast(bool strict) // always (except passive spells) check items (focus object can be required for any type casts) if (!m_spellInfo->IsPassive()) { - // spell focus needs to be checked not only for players! there are vehicle spells that require spell focus - castResult = CheckSpellFocus(); - if (castResult != SPELL_CAST_OK) - return castResult; + // spell focus needs to be checked not only for players! there are vehicle spells that require spell focus + castResult = CheckSpellFocus(); + if (castResult != SPELL_CAST_OK) + return castResult; castResult = CheckItems(); if (castResult != SPELL_CAST_OK) @@ -5336,21 +5336,21 @@ SpellCastResult Spell::CheckCast(bool strict) return castResult; } - // xinef: do not skip triggered spells if they posses prevention type (eg. Bladestorm vs Hand of Protection) + // xinef: do not skip triggered spells if they posses prevention type (eg. Bladestorm vs Hand of Protection) if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURAS) || (m_spellInfo->PreventionType > SPELL_PREVENTION_TYPE_NONE && m_triggeredByAuraSpell && m_triggeredByAuraSpell->IsPositive())) { castResult = CheckCasterAuras(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURAS); if (castResult != SPELL_CAST_OK) return castResult; - // xinef: Enraged Regeneration: While this is active, the warrior is blocked from using abilities that trigger being enraged (which would do nothing and waste the cooldowns). - if (m_spellInfo->Mechanic && m_spellInfo->IsSelfCast()) - { - SpellImmuneList const& mechanicList = m_caster->m_spellImmune[IMMUNITY_MECHANIC]; - for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) - if (itr->type == m_spellInfo->Mechanic) - return SPELL_FAILED_DAMAGE_IMMUNE; - } + // xinef: Enraged Regeneration: While this is active, the warrior is blocked from using abilities that trigger being enraged (which would do nothing and waste the cooldowns). + if (m_spellInfo->Mechanic && m_spellInfo->IsSelfCast()) + { + SpellImmuneList const& mechanicList = m_caster->m_spellImmune[IMMUNITY_MECHANIC]; + for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) + if (itr->type == m_spellInfo->Mechanic) + return SPELL_FAILED_DAMAGE_IMMUNE; + } } // script hook @@ -5382,17 +5382,17 @@ SpellCastResult Spell::CheckCast(bool strict) { if (Unit* target = m_targets.GetUnitTarget()) { - // Xinef: do not allow to cast on hostile targets in sanctuary - if (!m_caster->IsFriendlyTo(target)) - { - if (m_caster->IsInSanctuary() || target->IsInSanctuary()) - { - // Xinef: fix for duels - Player* player = m_caster->ToPlayer(); - if (!player || !player->duel || target != player->duel->opponent) - return SPELL_FAILED_NOTHING_TO_DISPEL; - } - } + // Xinef: do not allow to cast on hostile targets in sanctuary + if (!m_caster->IsFriendlyTo(target)) + { + if (m_caster->IsInSanctuary() || target->IsInSanctuary()) + { + // Xinef: fix for duels + Player* player = m_caster->ToPlayer(); + if (!player || !player->duel || target != player->duel->opponent) + return SPELL_FAILED_NOTHING_TO_DISPEL; + } + } DispelChargesList dispelList; target->GetDispellableAuraList(m_caster, dispelMask, dispelList); @@ -5421,19 +5421,19 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_TARGET_NOT_DEAD; } } - else if (m_spellInfo->Id == 53271) // Master's Call - { - if (!m_caster->ToPlayer()) - return SPELL_FAILED_BAD_TARGETS; + else if (m_spellInfo->Id == 53271) // Master's Call + { + if (!m_caster->ToPlayer()) + return SPELL_FAILED_BAD_TARGETS; - Unit* target = m_targets.GetUnitTarget(); - Pet *pet = m_caster->ToPlayer()->GetPet(); - if (!target || !pet || pet->isDead() || target->isDead()) - return SPELL_FAILED_BAD_TARGETS; - - if (!pet->IsWithinLOSInMap(target)) - return SPELL_FAILED_LINE_OF_SIGHT; - } + Unit* target = m_targets.GetUnitTarget(); + Pet *pet = m_caster->ToPlayer()->GetPet(); + if (!target || !pet || pet->isDead() || target->isDead()) + return SPELL_FAILED_BAD_TARGETS; + + if (!pet->IsWithinLOSInMap(target)) + return SPELL_FAILED_LINE_OF_SIGHT; + } break; } case SPELL_EFFECT_LEARN_SPELL: @@ -5538,7 +5538,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (Unit* target = m_targets.GetUnitTarget()) if (!target->IsAlive()) return SPELL_FAILED_BAD_TARGETS; - // Xinef: Pass only explicit unit target spells + // Xinef: Pass only explicit unit target spells // pussywizard: if (MMAP::MMapFactory::IsPathfindingEnabled(m_caster->FindMap(), true) && m_spellInfo->NeedsExplicitUnitTarget()) { @@ -5549,29 +5549,29 @@ SpellCastResult Spell::CheckCast(bool strict) Position pos; target->GetChargeContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ); - if (m_caster->GetMapId() == 618) // pussywizard: 618 Ring of Valor - pos.m_positionZ = std::max(pos.m_positionZ, 28.28f); + if (m_caster->GetMapId() == 618) // pussywizard: 618 Ring of Valor + pos.m_positionZ = std::max(pos.m_positionZ, 28.28f); float maxdist = MELEE_RANGE + m_caster->GetMeleeReach() + target->GetMeleeReach(); if (target->GetExactDistSq(&pos) > maxdist*maxdist) return SPELL_FAILED_NOPATH; - if (m_caster->GetMapId() == 618) // pussywizard: 618 Ring of Valor - { - if (!((target->GetPositionZ() > 32.0f) ^ (m_caster->GetPositionZ() > 32.0f))) - break; - return SPELL_FAILED_NOPATH; - } - else if (m_caster->GetMapId() == 572) // pussywizard: 572 Ruins of Lordaeron - { - if (pos.GetPositionX() < 1275.0f || m_caster->GetPositionX() < 1275.0f) // special case (acid) - break; // can't force path because the way is around and the path is too long - } + if (m_caster->GetMapId() == 618) // pussywizard: 618 Ring of Valor + { + if (!((target->GetPositionZ() > 32.0f) ^ (m_caster->GetPositionZ() > 32.0f))) + break; + return SPELL_FAILED_NOPATH; + } + else if (m_caster->GetMapId() == 572) // pussywizard: 572 Ruins of Lordaeron + { + if (pos.GetPositionX() < 1275.0f || m_caster->GetPositionX() < 1275.0f) // special case (acid) + break; // can't force path because the way is around and the path is too long + } - if (m_caster->GetTransport() != target->GetTransport()) - return SPELL_FAILED_NOPATH; - if (m_caster->GetTransport()) - break; + if (m_caster->GetTransport() != target->GetTransport()) + return SPELL_FAILED_NOPATH; + if (m_caster->GetTransport()) + break; m_pathFinder = new PathGenerator(m_caster); m_pathFinder->CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ+0.15f, false); @@ -5637,16 +5637,16 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_spellInfo->Id != 1842 || (m_targets.GetGOTarget() && m_targets.GetGOTarget()->GetGOInfo()->type != GAMEOBJECT_TYPE_TRAP)) - { - if (m_targets.GetGOTarget() && m_targets.GetGOTarget()->GetEntry() == 179697) - { - if (!m_caster->ToPlayer()->CanUseBattlegroundObject(NULL)) - return SPELL_FAILED_TRY_AGAIN; - } + { + if (m_targets.GetGOTarget() && m_targets.GetGOTarget()->GetEntry() == 179697) + { + if (!m_caster->ToPlayer()->CanUseBattlegroundObject(NULL)) + return SPELL_FAILED_TRY_AGAIN; + } else if (m_caster->ToPlayer()->InBattleground() && // In Battleground players can use only flags and banners, or Gurubashi chest !m_caster->ToPlayer()->CanUseBattlegroundObject(m_targets.GetGOTarget())) return SPELL_FAILED_TRY_AGAIN; - } + } // get the lock entry uint32 lockId = 0; @@ -5721,14 +5721,14 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_EFFECT_SUMMON_PET: { if (!m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET)) - { - if (m_caster->GetPetGUID()) + { + if (m_caster->GetPetGUID()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; - if (m_caster->GetCharmGUID()) - return SPELL_FAILED_ALREADY_HAVE_CHARM; + if (m_caster->GetCharmGUID()) + return SPELL_FAILED_ALREADY_HAVE_CHARM; } - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass() == CLASS_WARLOCK && strict) + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass() == CLASS_WARLOCK && strict) if (Pet* pet = m_caster->ToPlayer()->GetPet()) pet->CastSpell(pet, 32752, true, NULL, NULL, pet->GetGUID()); //starting cast, trigger pet stun (cast by pet so it doesn't attack player) break; @@ -5744,9 +5744,9 @@ SpellCastResult Spell::CheckCast(bool strict) if (!target || m_caster->ToPlayer() == target || (!target->IsInSameRaidWith(m_caster->ToPlayer()) && m_spellInfo->Id != 48955)) // refer-a-friend spell return SPELL_FAILED_BAD_TARGETS; - // Xinef: Implement summon pending error - if (target->GetSummonExpireTimer() > time(NULL)) - return SPELL_FAILED_SUMMON_PENDING; + // Xinef: Implement summon pending error + if (target->GetSummonExpireTimer() > time(NULL)) + return SPELL_FAILED_SUMMON_PENDING; // check if our map is dungeon MapEntry const* map = sMapStore.LookupEntry(m_caster->GetMapId()); @@ -5784,9 +5784,9 @@ SpellCastResult Spell::CheckCast(bool strict) !(target->GetSession()->GetRecruiterId() == playerCaster->GetSession()->GetAccountId() || target->GetSession()->GetAccountId() == playerCaster->GetSession()->GetRecruiterId())) return SPELL_FAILED_BAD_TARGETS; - // Xinef: Implement summon pending error - if (target->GetSummonExpireTimer() > time(NULL)) - return SPELL_FAILED_SUMMON_PENDING; + // Xinef: Implement summon pending error + if (target->GetSummonExpireTimer() > time(NULL)) + return SPELL_FAILED_SUMMON_PENDING; break; } @@ -5835,9 +5835,9 @@ SpellCastResult Spell::CheckCast(bool strict) } break; } - // xinef: do not allow to use leaps while rooted - case SPELL_EFFECT_JUMP: - case SPELL_EFFECT_JUMP_DEST: + // xinef: do not allow to use leaps while rooted + case SPELL_EFFECT_JUMP: + case SPELL_EFFECT_JUMP_DEST: { if (m_caster->HasUnitState(UNIT_STATE_ROOT)) return SPELL_FAILED_ROOTED; @@ -5864,17 +5864,17 @@ SpellCastResult Spell::CheckCast(bool strict) //custom check switch (m_spellInfo->Id) { - // Living Bomb - case 44457: - case 55359: - case 55360: - { - if( Unit *target = m_targets.GetUnitTarget() ) - if( target->HasAura(m_spellInfo->Id, m_caster->GetGUID()) ) - return SPELL_FAILED_AURA_BOUNCED; + // Living Bomb + case 44457: + case 55359: + case 55360: + { + if( Unit *target = m_targets.GetUnitTarget() ) + if( target->HasAura(m_spellInfo->Id, m_caster->GetGUID()) ) + return SPELL_FAILED_AURA_BOUNCED; - break; - } + break; + } default: break; } @@ -5900,7 +5900,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetCharmerGUID()) return SPELL_FAILED_CHARMED; - // Xinef: allow SPELL_AURA_MOD_POSSESS to posses target if caster has some pet + // Xinef: allow SPELL_AURA_MOD_POSSESS to posses target if caster has some pet if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_CHARM && !m_spellInfo->HasAttribute(SPELL_ATTR1_DISMISS_PET)) { if (m_caster->GetPetGUID()) @@ -5909,11 +5909,11 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetCharmGUID()) return SPELL_FAILED_ALREADY_HAVE_CHARM; } - else if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_POSSESS) - { - if (m_caster->GetCharmGUID()) + else if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_POSSESS) + { + if (m_caster->GetCharmGUID()) return SPELL_FAILED_ALREADY_HAVE_CHARM; - } + } if (Unit* target = m_targets.GetUnitTarget()) { @@ -5929,8 +5929,8 @@ SpellCastResult Spell::CheckCast(bool strict) if (target->GetOwnerGUID() && IS_PLAYER_GUID(target->GetOwnerGUID())) return SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED; - if (target->IsPet() && (!target->GetOwner() || target->GetOwner()->ToPlayer())) - return SPELL_FAILED_CANT_BE_CHARMED; + if (target->IsPet() && (!target->GetOwner() || target->GetOwner()->ToPlayer())) + return SPELL_FAILED_CANT_BE_CHARMED; int32 damage = CalculateSpellDamage(i, target); if (damage && int32(target->getLevel()) > damage) @@ -5941,7 +5941,7 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_AURA_MOUNTED: { - // Xinef: disallow casting in water for mounts not increasing water movement speed + // Xinef: disallow casting in water for mounts not increasing water movement speed if (m_caster->IsInWater() && !m_spellInfo->HasAura(SPELL_AURA_MOD_INCREASE_SWIM_SPEED)) return SPELL_FAILED_ONLY_ABOVEWATER; @@ -5956,12 +5956,12 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->IsInDisallowedMountForm()) return SPELL_FAILED_NOT_SHAPESHIFT; - // xinef: dont allow to cast mounts in specific transforms - if (m_caster->getTransForm()) - if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(m_caster->getTransForm())) - if (transformSpellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) && - !transformSpellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_CASTABLE_WHILE_MOUNTED|SPELL_ATTR0_NEGATIVE_1))) - return SPELL_FAILED_NOT_SHAPESHIFT; + // xinef: dont allow to cast mounts in specific transforms + if (m_caster->getTransForm()) + if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(m_caster->getTransForm())) + if (transformSpellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) && + !transformSpellInfo->HasAttribute(SpellAttr0(SPELL_ATTR0_CASTABLE_WHILE_MOUNTED|SPELL_ATTR0_NEGATIVE_1))) + return SPELL_FAILED_NOT_SHAPESHIFT; break; } @@ -5979,13 +5979,13 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_AURA_FLY: case SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED: { - // Xinef: added water check + // Xinef: added water check if (m_caster->IsInWater()) return SPELL_FAILED_ONLY_ABOVEWATER; // not allow cast fly spells if not have req. skills (all spells is self target) // allow always ghost flight spells - if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->IsAlive()) + if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->IsAlive()) { Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId()); if (AreaTableEntry const* pArea = GetAreaEntryByAreaID(m_originalCaster->GetAreaId())) @@ -6002,7 +6002,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() != TYPEID_PLAYER || m_CastItem) break; - if (!m_targets.GetUnitTarget()) + if (!m_targets.GetUnitTarget()) return SPELL_FAILED_BAD_IMPLICIT_TARGETS; if (m_targets.GetUnitTarget()->getPowerType() != POWER_MANA) @@ -6073,8 +6073,8 @@ SpellCastResult Spell::CheckPetCast(Unit* target) m_targets.SetUnitTarget(target); } - // xinef: Calculate power cost here, so funciton checking power can work properly and dont return shit results - m_powerCost = m_spellInfo->CalcPowerCost(m_caster, m_spellSchoolMask, this); + // xinef: Calculate power cost here, so funciton checking power can work properly and dont return shit results + m_powerCost = m_spellInfo->CalcPowerCost(m_caster, m_spellSchoolMask, this); // cooldown if (Creature const* creatureCaster = m_caster->ToCreature()) @@ -6113,8 +6113,8 @@ SpellCastResult Spell::CheckCasterAuras(bool preventionOnly) const dispel_immune |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue)); } // immune movement impairment and loss of control - // PVP trinket EMFH TOC PVP trinket Bullheaded Bestial Wrath // Beath Within // Medalion of Immunity - if (m_spellInfo->Id == 42292 || m_spellInfo->Id == 59752 || m_spellInfo->Id == 65547 || m_spellInfo->Id == 53490 || m_spellInfo->Id == 19574 || m_spellInfo->Id == 34471 || m_spellInfo->Id == 46227) + // PVP trinket EMFH TOC PVP trinket Bullheaded Bestial Wrath // Beath Within // Medalion of Immunity + if (m_spellInfo->Id == 42292 || m_spellInfo->Id == 59752 || m_spellInfo->Id == 65547 || m_spellInfo->Id == 53490 || m_spellInfo->Id == 19574 || m_spellInfo->Id == 34471 || m_spellInfo->Id == 46227) mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; } @@ -6130,51 +6130,51 @@ SpellCastResult Spell::CheckCasterAuras(bool preventionOnly) const // Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state - // Xinef: if spell is triggered check preventionType only - if (!preventionOnly) - { - if (unitflag & UNIT_FLAG_STUNNED) - { - // spell is usable while stunned, check if caster has only mechanic stun auras, another stun types must prevent cast spell - if (usableInStun) - { - bool foundNotStun = false; - uint32 mask = (1 << MECHANIC_STUN) | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_HORROR); - // Barkskin should skip sleep effects, sap and fears - if (m_spellInfo->Id == 22812) - mask |= 1<Id == 1044) - mask |= 1<GetAuraEffectsByType(SPELL_AURA_MOD_STUN); - for (Unit::AuraEffectList::const_iterator i = stunAuras.begin(); i != stunAuras.end(); ++i) - { - if ((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() && !((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() & mask)) - { - foundNotStun = true; - break; - } - } - if (foundNotStun) - prevented_reason = SPELL_FAILED_STUNNED; - } - else - prevented_reason = SPELL_FAILED_STUNNED; - } - else if (unitflag & UNIT_FLAG_CONFUSED && !m_spellInfo->HasAttribute(SPELL_ATTR5_USABLE_WHILE_CONFUSED)) - prevented_reason = SPELL_FAILED_CONFUSED; - else if (unitflag & UNIT_FLAG_FLEEING && !m_spellInfo->HasAttribute(SPELL_ATTR5_USABLE_WHILE_FEARED)) - prevented_reason = SPELL_FAILED_FLEEING; - } + // Xinef: if spell is triggered check preventionType only + if (!preventionOnly) + { + if (unitflag & UNIT_FLAG_STUNNED) + { + // spell is usable while stunned, check if caster has only mechanic stun auras, another stun types must prevent cast spell + if (usableInStun) + { + bool foundNotStun = false; + uint32 mask = (1 << MECHANIC_STUN) | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_HORROR); + // Barkskin should skip sleep effects, sap and fears + if (m_spellInfo->Id == 22812) + mask |= 1<Id == 1044) + mask |= 1<GetAuraEffectsByType(SPELL_AURA_MOD_STUN); + for (Unit::AuraEffectList::const_iterator i = stunAuras.begin(); i != stunAuras.end(); ++i) + { + if ((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() && !((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() & mask)) + { + foundNotStun = true; + break; + } + } + if (foundNotStun) + prevented_reason = SPELL_FAILED_STUNNED; + } + else + prevented_reason = SPELL_FAILED_STUNNED; + } + else if (unitflag & UNIT_FLAG_CONFUSED && !m_spellInfo->HasAttribute(SPELL_ATTR5_USABLE_WHILE_CONFUSED)) + prevented_reason = SPELL_FAILED_CONFUSED; + else if (unitflag & UNIT_FLAG_FLEEING && !m_spellInfo->HasAttribute(SPELL_ATTR5_USABLE_WHILE_FEARED)) + prevented_reason = SPELL_FAILED_FLEEING; + } - // Xinef: if there is no prevented_reason, check prevention types - if (prevented_reason == SPELL_CAST_OK) - { - if (unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) - prevented_reason = SPELL_FAILED_SILENCED; - else if (unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY) - prevented_reason = SPELL_FAILED_PACIFIED; - } + // Xinef: if there is no prevented_reason, check prevention types + if (prevented_reason == SPELL_CAST_OK) + { + if (unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) + prevented_reason = SPELL_FAILED_SILENCED; + else if (unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY) + prevented_reason = SPELL_FAILED_PACIFIED; + } // Attr must make flag drop spell totally immune from all effects if (prevented_reason != SPELL_CAST_OK) @@ -6307,45 +6307,45 @@ SpellCastResult Spell::CheckRange(bool strict) float max_range = m_caster->GetSpellMaxRangeForTarget(target, m_spellInfo); float min_range = m_caster->GetSpellMinRangeForTarget(target, m_spellInfo); - // xinef: hack for npc shooters - if (min_range && GetCaster()->GetTypeId() == TYPEID_UNIT && !IS_PLAYER_GUID(GetCaster()->GetOwnerGUID()) && min_range <= 6.0f) - range_type = SPELL_RANGE_RANGED; + // xinef: hack for npc shooters + if (min_range && GetCaster()->GetTypeId() == TYPEID_UNIT && !IS_PLAYER_GUID(GetCaster()->GetOwnerGUID()) && min_range <= 6.0f) + range_type = SPELL_RANGE_RANGED; if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, max_range, this); - // xinef: dont check max_range to strictly after cast - if (range_type != SPELL_RANGE_MELEE && !strict) - max_range += std::min(3.0f, max_range*0.1f); // 10% but no more than 3yd + // xinef: dont check max_range to strictly after cast + if (range_type != SPELL_RANGE_MELEE && !strict) + max_range += std::min(3.0f, max_range*0.1f); // 10% but no more than 3yd if (target) { - if (target != m_caster) - { - // Xinef: WHAT DA FUCK IS THIS SHIT? Spells with 5yd range can hit target 9yd away? >.> - if (range_type == SPELL_RANGE_MELEE) - { - // Because of lag, we can not check too strictly here. - float real_max_range = m_caster->GetTypeId() == TYPEID_UNIT ? max_range - 2*MIN_MELEE_REACH : max_range - MIN_MELEE_REACH; - if (!m_caster->IsWithinMeleeRange(target, std::max(real_max_range, 0.0f))) - return SPELL_FAILED_OUT_OF_RANGE; - } - else if (!m_caster->IsWithinCombatRange(target, max_range)) - return SPELL_FAILED_OUT_OF_RANGE; //0x5A; + if (target != m_caster) + { + // Xinef: WHAT DA FUCK IS THIS SHIT? Spells with 5yd range can hit target 9yd away? >.> + if (range_type == SPELL_RANGE_MELEE) + { + // Because of lag, we can not check too strictly here. + float real_max_range = m_caster->GetTypeId() == TYPEID_UNIT ? max_range - 2*MIN_MELEE_REACH : max_range - MIN_MELEE_REACH; + if (!m_caster->IsWithinMeleeRange(target, std::max(real_max_range, 0.0f))) + return SPELL_FAILED_OUT_OF_RANGE; + } + else if (!m_caster->IsWithinCombatRange(target, max_range)) + return SPELL_FAILED_OUT_OF_RANGE; //0x5A; - if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED && range_type == SPELL_RANGE_RANGED) - { - if (m_caster->IsWithinMeleeRange(target)) - return SPELL_FAILED_TOO_CLOSE; - } + if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED && range_type == SPELL_RANGE_RANGED) + { + if (m_caster->IsWithinMeleeRange(target)) + return SPELL_FAILED_TOO_CLOSE; + } - if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast(M_PI), target)) - return SPELL_FAILED_UNIT_NOT_INFRONT; - } + if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast(M_PI), target)) + return SPELL_FAILED_UNIT_NOT_INFRONT; + } - // Xinef: check min range for self casts - if (min_range && range_type != SPELL_RANGE_RANGED && m_caster->IsWithinCombatRange(target, min_range)) // skip this check if min_range = 0 - return SPELL_FAILED_TOO_CLOSE; + // Xinef: check min range for self casts + if (min_range && range_type != SPELL_RANGE_RANGED && m_caster->IsWithinCombatRange(target, min_range)) // skip this check if min_range = 0 + return SPELL_FAILED_TOO_CLOSE; } if (m_targets.HasDst() && !m_targets.HasTraj()) @@ -6489,7 +6489,7 @@ SpellCastResult Spell::CheckItems() // if not item target then required item must be equipped else { - // Xinef: this is not true in my opinion, in eg bladestorm will not be canceled after disarm + // Xinef: this is not true in my opinion, in eg bladestorm will not be canceled after disarm //if (!(_triggeredCastFlags & TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT)) if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellRequirements(m_spellInfo)) return SPELL_FAILED_EQUIPPED_ITEM_CLASS; @@ -6582,13 +6582,13 @@ SpellCastResult Spell::CheckItems() case SPELL_EFFECT_CREATE_ITEM: case SPELL_EFFECT_CREATE_ITEM_2: { - // xinef: m_targets.GetUnitTarget() means explicit cast, otherwise we dont check for possible equip error - Unit* target = m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : m_caster; + // xinef: m_targets.GetUnitTarget() means explicit cast, otherwise we dont check for possible equip error + Unit* target = m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : m_caster; if (target && target->GetTypeId() == TYPEID_PLAYER && !IsTriggered() && m_spellInfo->Effects[i].ItemType) { ItemPosCountVec dest; - // xinef: why do we check p_caster? retards p_caster->CanStoreNewItem(...) + // xinef: why do we check p_caster? retards p_caster->CanStoreNewItem(...) InventoryResult msg = target->ToPlayer()->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->Effects[i].ItemType, 1); if (msg != EQUIP_ERR_OK) { @@ -6604,10 +6604,10 @@ SpellCastResult Spell::CheckItems() if (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellInfo->SpellFamilyFlags[0] & 0x40000000))) return SPELL_FAILED_TOO_MANY_OF_ITEM; else if (!(target->ToPlayer()->HasItemCount(m_spellInfo->Effects[i].ItemType))) - { - p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->Effects[i].ItemType); + { + p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->Effects[i].ItemType); return SPELL_FAILED_DONT_REPORT; - } + } else p_caster->CastSpell(m_caster, m_spellInfo->Effects[EFFECT_1].CalcValue(), false); // move this to anywhere return SPELL_FAILED_DONT_REPORT; @@ -6640,7 +6640,7 @@ SpellCastResult Spell::CheckItems() if (!targetItem) return SPELL_FAILED_ITEM_NOT_FOUND; - // xinef: required level has to be checked also! Exploit fix + // xinef: required level has to be checked also! Exploit fix if (targetItem->GetTemplate()->ItemLevel < m_spellInfo->BaseLevel || (targetItem->GetTemplate()->RequiredLevel && targetItem->GetTemplate()->RequiredLevel < m_spellInfo->BaseLevel)) return SPELL_FAILED_LOWLEVEL; @@ -6710,14 +6710,14 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_NOT_TRADEABLE; } - // Xinef: Apply item level restriction if the enchanting spell has max level restrition set - if (m_CastItem && m_spellInfo->MaxLevel > 0) - { - if (item->GetTemplate()->ItemLevel < m_CastItem->GetTemplate()->RequiredLevel) - return SPELL_FAILED_LOWLEVEL; - if (item->GetTemplate()->ItemLevel > m_spellInfo->MaxLevel) - return SPELL_FAILED_HIGHLEVEL; - } + // Xinef: Apply item level restriction if the enchanting spell has max level restrition set + if (m_CastItem && m_spellInfo->MaxLevel > 0) + { + if (item->GetTemplate()->ItemLevel < m_CastItem->GetTemplate()->RequiredLevel) + return SPELL_FAILED_LOWLEVEL; + if (item->GetTemplate()->ItemLevel > m_spellInfo->MaxLevel) + return SPELL_FAILED_HIGHLEVEL; + } break; } @@ -6928,7 +6928,7 @@ SpellCastResult Spell::CheckItems() SpellCastResult Spell::CheckSpellFocus() { - // check spell focus object + // check spell focus object if (m_spellInfo->RequiresSpellFocus) { CellCoord p(Trinity::ComputeCellCoord(m_caster->GetPositionX(), m_caster->GetPositionY())); @@ -6947,7 +6947,7 @@ SpellCastResult Spell::CheckSpellFocus() focusObject = ok; // game object found in range } - return SPELL_CAST_OK; + return SPELL_CAST_OK; } void Spell::Delayed() // only called in DealDamage() @@ -7053,8 +7053,8 @@ bool Spell::UpdatePointers() if (!m_CastItem) return false; } - else - m_CastItem = NULL; + else + m_CastItem = NULL; m_targets.Update(m_caster); @@ -7119,29 +7119,29 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const break; } - // xinef: skip los checking if spell has appropriate attribute, or target requires specific entry - // this is only for target addition and target has to have unselectable flag, this is valid for FLAG_EXTRA_TRIGGER and quest triggers however there are some without this flag, used not_selectable - if (m_spellInfo->HasAttribute(SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) || (target->GetTypeId() == TYPEID_UNIT && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && (m_spellInfo->Effects[eff].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || m_spellInfo->Effects[eff].TargetB.GetCheckType() == TARGET_CHECK_ENTRY))) - return true; + // xinef: skip los checking if spell has appropriate attribute, or target requires specific entry + // this is only for target addition and target has to have unselectable flag, this is valid for FLAG_EXTRA_TRIGGER and quest triggers however there are some without this flag, used not_selectable + if (m_spellInfo->HasAttribute(SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) || (target->GetTypeId() == TYPEID_UNIT && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && (m_spellInfo->Effects[eff].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || m_spellInfo->Effects[eff].TargetB.GetCheckType() == TARGET_CHECK_ENTRY))) + return true; if (IsTriggered()) - { - if (!m_caster->IsInMap(target)) // pussywizard: crashfix, avoid IsWithinLOS on another map! >_> - return true; + { + if (!m_caster->IsInMap(target)) // pussywizard: crashfix, avoid IsWithinLOS on another map! >_> + return true; - float x = m_caster->GetPositionX(), y = m_caster->GetPositionY(), z = m_caster->GetPositionZ(); - if (m_targets.HasDst()) - { - x = m_targets.GetDstPos()->GetPositionX(); - y = m_targets.GetDstPos()->GetPositionY(); - z = m_targets.GetDstPos()->GetPositionZ(); - } + float x = m_caster->GetPositionX(), y = m_caster->GetPositionY(), z = m_caster->GetPositionZ(); + if (m_targets.HasDst()) + { + x = m_targets.GetDstPos()->GetPositionX(); + y = m_targets.GetDstPos()->GetPositionY(); + z = m_targets.GetDstPos()->GetPositionZ(); + } - if ((!m_caster->IsTotem() || !m_spellInfo->IsPositive()) && !target->IsWithinLOS(x, y, z)) + if ((!m_caster->IsTotem() || !m_spellInfo->IsPositive()) && !target->IsWithinLOS(x, y, z)) return false; return true; - } + } // todo: shit below shouldn't be here, but it's temporary //Check targets for LOS visibility (except spells without range limitations) @@ -7165,15 +7165,15 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const return false; } break; - case SPELL_EFFECT_SKIN_PLAYER_CORPSE: - { + case SPELL_EFFECT_SKIN_PLAYER_CORPSE: + { if (!m_targets.GetCorpseTargetGUID()) - { - if (target->IsWithinLOSInMap(m_caster) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE)) - return true; + { + if (target->IsWithinLOSInMap(m_caster) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE)) + return true; return false; - } + } Corpse* corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.GetCorpseTargetGUID()); if (!corpse) @@ -7182,13 +7182,13 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const if (target->GetGUID() != corpse->GetOwnerGUID()) return false; - if (!corpse->HasFlag(CORPSE_FIELD_FLAGS, CORPSE_FLAG_LOOTABLE)) - return false; + if (!corpse->HasFlag(CORPSE_FIELD_FLAGS, CORPSE_FLAG_LOOTABLE)) + return false; if (!corpse->IsWithinLOSInMap(m_caster)) return false; } - break; + break; /*case SPELL_EFFECT_CHARGE: if (MMAP::MMapFactory::IsPathfindingEnabled(m_caster->FindMap())) break;*/ @@ -7201,18 +7201,18 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const if (!caster) caster = m_caster; if(target != caster) - { - float x = caster->GetPositionX(), y = caster->GetPositionY(), z = caster->GetPositionZ(); - if (m_targets.HasDst()) - { - x = m_targets.GetDstPos()->GetPositionX(); - y = m_targets.GetDstPos()->GetPositionY(); - z = m_targets.GetDstPos()->GetPositionZ(); - } + { + float x = caster->GetPositionX(), y = caster->GetPositionY(), z = caster->GetPositionZ(); + if (m_targets.HasDst()) + { + x = m_targets.GetDstPos()->GetPositionX(); + y = m_targets.GetDstPos()->GetPositionY(); + z = m_targets.GetDstPos()->GetPositionZ(); + } - if (!target->IsInMap(caster) || !target->IsWithinLOS(x, y, z)) - return false; - } + if (!target->IsInMap(caster) || !target->IsWithinLOS(x, y, z)) + return false; + } break; } @@ -7350,11 +7350,11 @@ bool SpellEvent::IsDeletable() const bool ReflectEvent::Execute(uint64 e_time, uint32 p_time) { - Unit* caster = ObjectAccessor::FindUnit(_casterGUID); - Unit* target = ObjectAccessor::FindUnit(_targetGUID); - if (caster && target && caster->IsInMap(target)) - caster->ProcDamageAndSpell(target, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, _spellInfo); - return true; + Unit* caster = ObjectAccessor::FindUnit(_casterGUID); + Unit* target = ObjectAccessor::FindUnit(_targetGUID); + if (caster && target && caster->IsInMap(target)) + caster->ProcDamageAndSpell(target, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, _spellInfo); + return true; } bool Spell::IsValidDeadOrAliveTarget(Unit const* target) const @@ -7390,7 +7390,7 @@ void Spell::HandleLaunchPhase() usesAmmo=false; } - bool firstTarget = true; + bool firstTarget = true; for (std::list::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { TargetInfo& target = *ihit; @@ -7425,7 +7425,7 @@ void Spell::HandleLaunchPhase() } } DoAllEffectOnLaunchTarget(target, multiplier, firstTarget); - firstTarget = false; + firstTarget = false; } } @@ -7441,7 +7441,7 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier, if (!unit) return; - uint8 ssEffect = MAX_SPELL_EFFECTS; + uint8 ssEffect = MAX_SPELL_EFFECTS; for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (targetInfo.effectMask & (1< 0) { - // Xinef: Area Auras, AoE Targetting spells AND Chain Target spells (cleave etc.) - if (m_spellInfo->Effects[i].IsAreaAuraEffect() || m_spellInfo->Effects[i].IsTargetingArea() || (m_spellInfo->Effects[i].ChainTarget > 1 && m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MAGIC)) + // Xinef: Area Auras, AoE Targetting spells AND Chain Target spells (cleave etc.) + if (m_spellInfo->Effects[i].IsAreaAuraEffect() || m_spellInfo->Effects[i].IsTargetingArea() || (m_spellInfo->Effects[i].ChainTarget > 1 && m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MAGIC)) { - m_damage = unit->CalculateAOEDamageReduction(m_damage, m_spellInfo->SchoolMask, m_caster); + m_damage = unit->CalculateAOEDamageReduction(m_damage, m_spellInfo->SchoolMask, m_caster); if (m_caster->GetTypeId() == TYPEID_PLAYER) { uint32 targetAmount = m_UniqueTargetInfo.size(); @@ -7473,58 +7473,58 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier, } targetInfo.damage += m_damage; - // Sweeping Strikes - switch (m_spellInfo->Effects[i].Effect) - { - case SPELL_EFFECT_SCHOOL_DAMAGE: - case SPELL_EFFECT_WEAPON_DAMAGE: - case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: - case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: - case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: - ssEffect = i; - break; - } + // Sweeping Strikes + switch (m_spellInfo->Effects[i].Effect) + { + case SPELL_EFFECT_SCHOOL_DAMAGE: + case SPELL_EFFECT_WEAPON_DAMAGE: + case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: + case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: + case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: + ssEffect = i; + break; + } } } - // xinef: totem's inherit owner crit chance and dancing rune weapon - Unit* caster = m_caster; - if (m_caster->IsTotem() || m_caster->GetEntry() == 27893) - { - if (Unit* owner = m_caster->GetOwner()) - caster = owner; - } - else if (m_originalCaster) - caster = m_originalCaster; - - float critChance = caster->SpellDoneCritChance(unit, m_spellInfo, m_spellSchoolMask, m_attackType, false); - critChance = unit->SpellTakenCritChance(caster, m_spellInfo, m_spellSchoolMask, critChance, m_attackType, false); - targetInfo.crit = roll_chance_f(std::max(0.0f, critChance)); + // xinef: totem's inherit owner crit chance and dancing rune weapon + Unit* caster = m_caster; + if (m_caster->IsTotem() || m_caster->GetEntry() == 27893) + { + if (Unit* owner = m_caster->GetOwner()) + caster = owner; + } + else if (m_originalCaster) + caster = m_originalCaster; + + float critChance = caster->SpellDoneCritChance(unit, m_spellInfo, m_spellSchoolMask, m_attackType, false); + critChance = unit->SpellTakenCritChance(caster, m_spellInfo, m_spellSchoolMask, critChance, m_attackType, false); + targetInfo.crit = roll_chance_f(std::max(0.0f, critChance)); - // Sweeping strikes wtf shit ;d - if (m_caster->getClass() == CLASS_WARRIOR && ssEffect < MAX_SPELL_EFFECTS && m_spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && - ((m_spellInfo->Id != 50622 && m_spellInfo->Id != 44949) || firstTarget)) - { - if (Aura* aur = m_caster->GetAura(12328)) - { - Unit* target = m_caster->SelectNearbyNoTotemTarget(unit); - if (!target || target == unit) - return; // finish + // Sweeping strikes wtf shit ;d + if (m_caster->getClass() == CLASS_WARRIOR && ssEffect < MAX_SPELL_EFFECTS && m_spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && + ((m_spellInfo->Id != 50622 && m_spellInfo->Id != 44949) || firstTarget)) + { + if (Aura* aur = m_caster->GetAura(12328)) + { + Unit* target = m_caster->SelectNearbyNoTotemTarget(unit); + if (!target || target == unit) + return; // finish - int32 mdmg = m_damage; - int32 basepoints = 0; - m_damage = 0; + int32 mdmg = m_damage; + int32 basepoints = 0; + m_damage = 0; - HandleEffects(target, NULL, NULL, ssEffect, SPELL_EFFECT_HANDLE_LAUNCH_TARGET); + HandleEffects(target, NULL, NULL, ssEffect, SPELL_EFFECT_HANDLE_LAUNCH_TARGET); - basepoints = (targetInfo.crit ? Unit::SpellCriticalDamageBonus(m_caster, m_spellInfo, m_damage, target) : m_damage); - m_damage = mdmg; - m_caster->CastCustomSpell(target, 26654, &basepoints, NULL, NULL, true); + basepoints = (targetInfo.crit ? Unit::SpellCriticalDamageBonus(m_caster, m_spellInfo, m_damage, target) : m_damage); + m_damage = mdmg; + m_caster->CastCustomSpell(target, 26654, &basepoints, NULL, NULL, true); - if (m_spellInfo->Id != 44949) - aur->DropCharge(); - } - } + if (m_spellInfo->Id != 44949) + aur->DropCharge(); + } + } } SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& skillId, int32& reqSkillValue, int32& skillValue) @@ -7611,9 +7611,9 @@ void Spell::SetSpellValue(SpellValueMod mod, int32 value) case SPELLVALUE_AURA_STACK: m_spellValue->AuraStackAmount = uint8(value); break; - case SPELLVALUE_FORCED_CRIT_RESULT: - m_spellValue->ForcedCritResult = (bool)value; - break; + case SPELLVALUE_FORCED_CRIT_RESULT: + m_spellValue->ForcedCritResult = (bool)value; + break; } } @@ -7652,9 +7652,9 @@ void Spell::CheckEffectExecuteData() void Spell::LoadScripts() { - if (_scriptsLoaded) - return; - _scriptsLoaded = true; + if (_scriptsLoaded) + return; + _scriptsLoaded = true; sScriptMgr->CreateSpellScripts(m_spellInfo->Id, m_loadedScripts); for (std::list::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();) { @@ -7890,9 +7890,9 @@ bool Spell::CheckScriptEffectImplicitTargets(uint32 effIndex, uint32 effIndexToC bool Spell::CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* triggeredByAura) const { - // Relentless strikes, proc only from first effect - if (triggeredByAura && triggeredByAura->SpellIconID == 559) - return effMask & (1 << EFFECT_0); + // Relentless strikes, proc only from first effect + if (triggeredByAura && triggeredByAura->SpellIconID == 559) + return effMask & (1 << EFFECT_0); bool only_on_caster = (triggeredByAura && triggeredByAura->HasAttribute(SPELL_ATTR4_PROC_ONLY_ON_CASTER)); // If triggeredByAura has SPELL_ATTR4_PROC_ONLY_ON_CASTER then it can only proc on a casted spell with TARGET_UNIT_CASTER @@ -7938,21 +7938,21 @@ void Spell::PrepareTriggersExecutedOnHit() } break; } - case SPELLFAMILY_DRUID: - { - // Faerie Fire (Feral) - if( m_spellInfo->Id == 16857 && (m_caster->GetShapeshiftForm() == FORM_BEAR || m_caster->GetShapeshiftForm() == FORM_DIREBEAR) ) - m_preCastSpell = 60089; + case SPELLFAMILY_DRUID: + { + // Faerie Fire (Feral) + if( m_spellInfo->Id == 16857 && (m_caster->GetShapeshiftForm() == FORM_BEAR || m_caster->GetShapeshiftForm() == FORM_DIREBEAR) ) + m_preCastSpell = 60089; - break; - } - case SPELLFAMILY_MAGE: - { - // Permafrost - if (m_spellInfo->SpellFamilyFlags[1] & 0x00001000 || m_spellInfo->SpellFamilyFlags[0] & 0x00100220) - m_preCastSpell = 68391; - break; - } + break; + } + case SPELLFAMILY_MAGE: + { + // Permafrost + if (m_spellInfo->SpellFamilyFlags[1] & 0x00001000 || m_spellInfo->SpellFamilyFlags[0] & 0x00100220) + m_preCastSpell = 68391; + break; + } } // handle SPELL_AURA_ADD_TARGET_TRIGGER auras: @@ -8004,13 +8004,13 @@ void Spell::TriggerGlobalCooldown() { int32 gcd = m_spellInfo->StartRecoveryTime; if (!gcd) - { - // Xinef: fix for charmed pet spells with no cooldown info - if (m_spellInfo->RecoveryTime == 0 && m_spellInfo->CategoryRecoveryTime == 0 && m_caster->GetCharmInfo()) - gcd = MIN_GCD; - else - return; - } + { + // Xinef: fix for charmed pet spells with no cooldown info + if (m_spellInfo->RecoveryTime == 0 && m_spellInfo->CategoryRecoveryTime == 0 && m_caster->GetCharmInfo()) + gcd = MIN_GCD; + else + return; + } // Global cooldown can't leave range 1..1.5 secs // There are some spells (mostly not casted directly by player) that have < 1 sec and > 1.5 sec global cooldowns @@ -8121,10 +8121,10 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target) if (!_referer->IsInRaidWith(unitTarget)) return false; break; - case TARGET_CHECK_CORPSE: - if (_caster->IsFriendlyTo(unitTarget)) - return false; - break; + case TARGET_CHECK_CORPSE: + if (_caster->IsFriendlyTo(unitTarget)) + return false; + break; default: break; } @@ -8160,15 +8160,15 @@ WorldObjectSpellAreaTargetCheck::WorldObjectSpellAreaTargetCheck(float range, Po bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target) { - if (target->GetTypeId() == TYPEID_GAMEOBJECT) - { - if (!target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range)) - return false; - } + if (target->GetTypeId() == TYPEID_GAMEOBJECT) + { + if (!target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range)) + return false; + } else if (!target->IsWithinDist3d(_position, _range)) return false; - else if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsAvoidingAOE()) // pussywizard - return false; + else if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsAvoidingAOE()) // pussywizard + return false; return WorldObjectSpellTargetCheck::operator ()(target); } @@ -8199,7 +8199,7 @@ bool WorldObjectSpellConeTargetCheck::operator()(WorldObject* target) } WorldObjectSpellTrajTargetCheck::WorldObjectSpellTrajTargetCheck(float range, Position const* position, Unit* caster, - SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList) + SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList) : WorldObjectSpellAreaTargetCheck(range, position, caster, caster, spellInfo, selectionType, condList) { } diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 575afd19f..1fb93b0c6 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -166,12 +166,12 @@ class SpellCastTargets void Update(Unit* caster); void OutDebug() const; - // Xinef: Channel data - void SetObjectTargetChannel(uint64 targetGUID); - void SetDstChannel(SpellDestination const& spellDest); - WorldObject* GetObjectTargetChannel(Unit* caster) const; - bool HasDstChannel() const; - SpellDestination const* GetDstChannel() const; + // Xinef: Channel data + void SetObjectTargetChannel(uint64 targetGUID); + void SetDstChannel(SpellDestination const& spellDest); + WorldObject* GetObjectTargetChannel(Unit* caster) const; + bool HasDstChannel() const; + SpellDestination const* GetDstChannel() const; private: uint32 m_targetMask; @@ -191,9 +191,9 @@ class SpellCastTargets float m_elevation, m_speed; std::string m_strTarget; - // Xinef: Save channel data - SpellDestination m_dstChannel; - uint64 m_objectTargetGUIDChannel; + // Xinef: Save channel data + SpellDestination m_dstChannel; + uint64 m_objectTargetGUIDChannel; }; struct SpellValue @@ -203,7 +203,7 @@ struct SpellValue uint32 MaxAffectedTargets; float RadiusMod; uint8 AuraStackAmount; - bool ForcedCritResult; + bool ForcedCritResult; }; enum SpellState @@ -227,14 +227,14 @@ enum SpellEffectHandleMode // Xinef: special structure containing data for channel target spells struct ChannelTargetData { - ChannelTargetData(uint64 cguid, const SpellDestination* dst) : channelGUID(cguid) - { - if (dst) - spellDst = *dst; - } + ChannelTargetData(uint64 cguid, const SpellDestination* dst) : channelGUID(cguid) + { + if (dst) + spellDst = *dst; + } - uint64 channelGUID; - SpellDestination spellDst; + uint64 channelGUID; + SpellDestination spellDst; }; class Spell @@ -404,7 +404,7 @@ class Spell void cancel(bool bySelf = false); void update(uint32 difftime); void cast(bool skipCheck = false); - void _cast(bool skipCheck); + void _cast(bool skipCheck); void finish(bool ok = true); void TakePower(); void TakeAmmo(); @@ -424,7 +424,7 @@ class Spell void _handle_finish_phase(); SpellCastResult CheckItems(); - SpellCastResult CheckSpellFocus(); + SpellCastResult CheckSpellFocus(); SpellCastResult CheckRange(bool strict); SpellCastResult CheckPower(); SpellCastResult CheckRuneCost(uint32 runeCostID); @@ -502,7 +502,7 @@ class Spell uint64 GetDelayStart() const { return m_delayStart; } void SetDelayStart(uint64 m_time) { m_delayStart = m_time; } uint64 GetDelayMoment() const { return m_delayMoment; } - uint64 GetDelayTrajectory() const { return m_delayTrajectory; } + uint64 GetDelayTrajectory() const { return m_delayTrajectory; } bool IsNeedSendToClient(bool go) const; @@ -518,12 +518,12 @@ class Spell void CleanupTargetList(); void SetSpellValue(SpellValueMod mod, int32 value); - SpellValue const* const GetSpellValue() { return m_spellValue; } + SpellValue const* const GetSpellValue() { return m_spellValue; } - // xinef: moved to public + // xinef: moved to public void LoadScripts(); - // Targets store structures and data + // Targets store structures and data struct TargetInfo { uint64 targetGUID; @@ -537,7 +537,7 @@ class Spell bool scaleAura:1; int32 damage; }; - std::list* GetUniqueTargetInfo() { return &m_UniqueTargetInfo; } + std::list* GetUniqueTargetInfo() { return &m_UniqueTargetInfo; } protected: bool HasGlobalCooldown() const; void TriggerGlobalCooldown(); @@ -578,7 +578,7 @@ class Spell // Delayed spells system uint64 m_delayStart; // time of spell delay start, filled by event handler, zero = just started uint64 m_delayMoment; // moment of next delay call, used internally - uint64 m_delayTrajectory; // Xinef: Trajectory delay + uint64 m_delayTrajectory; // Xinef: Trajectory delay bool m_immediateHandled; // were immediate actions handled? (used by delayed spells only) // These vars are used in both delayed spell system and modified immediate spell system @@ -664,7 +664,7 @@ class Spell void CheckEffectExecuteData(); // Scripting system - bool _scriptsLoaded; + bool _scriptsLoaded; //void LoadScripts(); void CallScriptBeforeCastHandlers(); void CallScriptOnCastHandlers(); @@ -714,8 +714,8 @@ class Spell bool m_skipCheck; uint8 m_auraScaleMask; - // xinef: - bool _spellTargetsSelected; + // xinef: + bool _spellTargetsSelected; ByteBuffer * m_effectExecuteData[MAX_SPELL_EFFECTS]; @@ -774,7 +774,7 @@ namespace Trinity struct WorldObjectSpellTrajTargetCheck : public WorldObjectSpellAreaTargetCheck { WorldObjectSpellTrajTargetCheck(float range, Position const* position, Unit* caster, - SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList); + SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList); bool operator()(WorldObject* target); }; } @@ -796,14 +796,14 @@ class SpellEvent : public BasicEvent class ReflectEvent : public BasicEvent { - public: - ReflectEvent(uint64 casterGUID, uint64 targetGUID, const SpellInfo* spellInfo) : _casterGUID(casterGUID), _targetGUID(targetGUID), _spellInfo(spellInfo) { } - virtual bool Execute(uint64 e_time, uint32 p_time); + public: + ReflectEvent(uint64 casterGUID, uint64 targetGUID, const SpellInfo* spellInfo) : _casterGUID(casterGUID), _targetGUID(targetGUID), _spellInfo(spellInfo) { } + virtual bool Execute(uint64 e_time, uint32 p_time); - protected: - uint64 _casterGUID; - uint64 _targetGUID; - const SpellInfo* _spellInfo; + protected: + uint64 _casterGUID; + uint64 _targetGUID; + const SpellInfo* _spellInfo; }; #endif diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index a6808eaf3..917e7b787 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -306,7 +306,7 @@ void Spell::EffectEnvironmentalDMG(SpellEffIndex /*effIndex*/) uint32 absorb = 0; uint32 resist = 0; - Unit::CalcAbsorbResist(m_caster, unitTarget, m_spellInfo->GetSchoolMask(), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, m_spellInfo); + Unit::CalcAbsorbResist(m_caster, unitTarget, m_spellInfo->GetSchoolMask(), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, m_spellInfo); m_caster->SendSpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, damage+absorb+resist, m_spellInfo->GetSchoolMask(), absorb, resist, false, 0, false); if (unitTarget->GetTypeId() == TYPEID_PLAYER) @@ -374,8 +374,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->GetCategory() == 1209) { uint8 level = m_caster->getLevel(); - // xinef: shield block should increase the limit - float limit = m_caster->HasAura(2565) ? 2.0f : 1.0f; + // xinef: shield block should increase the limit + float limit = m_caster->HasAura(2565) ? 2.0f : 1.0f; uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 24.5f * limit), uint32(float(level) * 34.5f * limit)); damage += int32(m_caster->ApplyEffectModifiers(m_spellInfo, effIndex, float(block_value))); @@ -406,10 +406,10 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) damage += damage/4; } } - // Immolate - hidden delay for conflagrate - else if (m_spellInfo->SpellFamilyFlags[0] & 0x4) - { - } + // Immolate - hidden delay for conflagrate + else if (m_spellInfo->SpellFamilyFlags[0] & 0x4) + { + } // Conflagrate - consumes Immolate or Shadowflame else if (m_spellInfo->TargetAuraState == AURA_STATE_CONFLAGRATE) { @@ -443,7 +443,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1)); uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude); - damage += int32(CalculatePct(pdamage * baseTotalTicks, pct_dir)); + damage += int32(CalculatePct(pdamage * baseTotalTicks, pct_dir)); uint32 pct_dot = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 2)) / 3; m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePct(pdamage * baseTotalTicks, pct_dot))); @@ -635,14 +635,14 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (m_spellInfo->SpellFamilyFlags[1]&0x00040000) { // Add main hand dps * effect[2] amount - if (Player* player = m_caster->ToPlayer()) - { - float mindamage, maxdamage; - player->CalculateMinMaxDamage(BASE_ATTACK, false, false, mindamage, maxdamage); - float average = (mindamage + maxdamage) / 2; - int32 count = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, EFFECT_2); - damage += count * int32(average * IN_MILLISECONDS) / m_caster->GetAttackTime(BASE_ATTACK); - } + if (Player* player = m_caster->ToPlayer()) + { + float mindamage, maxdamage; + player->CalculateMinMaxDamage(BASE_ATTACK, false, false, mindamage, maxdamage); + float average = (mindamage + maxdamage) / 2; + int32 count = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, EFFECT_2); + damage += count * int32(average * IN_MILLISECONDS) / m_caster->GetAttackTime(BASE_ATTACK); + } break; } // Shield of Righteousness @@ -651,7 +651,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) uint8 level = m_caster->getLevel(); uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 34.5f)); if (AuraEffect *aurEff = m_caster->GetAuraEffect(64882, EFFECT_0)) - block_value += 225; + block_value += 225; damage += CalculatePct(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue()); break; } @@ -661,9 +661,9 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) if (m_originalCaster /*&& damage > 0 Xinef: this can be increased from 0*/ && apply_direct_bonus) { - // Xinef: protection - if (damage < 0) - damage = 0; + // Xinef: protection + if (damage < 0) + damage = 0; damage = m_originalCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); damage = unitTarget->SpellDamageBonusTaken(m_originalCaster, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE); @@ -688,55 +688,55 @@ void Spell::EffectDummy(SpellEffIndex effIndex) { switch (m_spellInfo->Id) { - // Trial of the Champion, Trample - case 67866: - { - if( unitTarget && !unitTarget->IsVehicle() && !unitTarget->GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID) ) - unitTarget->CastSpell(unitTarget, 67867, false); - return; - } - // Trial of the Champion, Hammer of the Righteous - case 66867: - { - if( !unitTarget ) - return; - if( unitTarget->HasAura(66940) ) - m_caster->CastSpell(unitTarget, 66903, true); - else - m_caster->CastSpell(unitTarget, 66904, true); - return; - } - case 17731: - case 69294: - { - if( !gameObjTarget || gameObjTarget->GetRespawnTime() > time(NULL) ) - return; + // Trial of the Champion, Trample + case 67866: + { + if( unitTarget && !unitTarget->IsVehicle() && !unitTarget->GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID) ) + unitTarget->CastSpell(unitTarget, 67867, false); + return; + } + // Trial of the Champion, Hammer of the Righteous + case 66867: + { + if( !unitTarget ) + return; + if( unitTarget->HasAura(66940) ) + m_caster->CastSpell(unitTarget, 66903, true); + else + m_caster->CastSpell(unitTarget, 66904, true); + return; + } + case 17731: + case 69294: + { + if( !gameObjTarget || gameObjTarget->GetRespawnTime() > time(NULL) ) + return; - gameObjTarget->SetRespawnTime(10); - gameObjTarget->SendCustomAnim(gameObjTarget->GetGoAnimProgress()); - if( Creature* trigger = gameObjTarget->SummonCreature(12758, *gameObjTarget, TEMPSUMMON_TIMED_DESPAWN, 1000) ) - trigger->CastSpell(trigger, 17731, false); + gameObjTarget->SetRespawnTime(10); + gameObjTarget->SendCustomAnim(gameObjTarget->GetGoAnimProgress()); + if( Creature* trigger = gameObjTarget->SummonCreature(12758, *gameObjTarget, TEMPSUMMON_TIMED_DESPAWN, 1000) ) + trigger->CastSpell(trigger, 17731, false); - return; - } - // HoL, Arc Weld - case 59086: - { - if( m_caster && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() ) - m_caster->CastSpell(m_caster, 59097, true); + return; + } + // HoL, Arc Weld + case 59086: + { + if( m_caster && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() ) + m_caster->CastSpell(m_caster, 59097, true); - return; - } + return; + } } break; - } + } case SPELLFAMILY_PALADIN: switch (m_spellInfo->Id) { case 31789: // Righteous Defense (step 1) { - if (!unitTarget) - return; + if (!unitTarget) + return; // not empty (checked), copy Unit::AttackerSet attackers = unitTarget->getAttackers(); @@ -761,14 +761,14 @@ void Spell::EffectDummy(SpellEffIndex effIndex) } } break; - case SPELLFAMILY_ROGUE: - // Hunger for Blood - if( m_spellInfo->Id == 51662 ) - { - m_caster->CastSpell(m_caster, 63848, true); - return; - } - break; + case SPELLFAMILY_ROGUE: + // Hunger for Blood + if( m_spellInfo->Id == 51662 ) + { + m_caster->CastSpell(m_caster, 63848, true); + return; + } + break; } // pet auras @@ -873,26 +873,26 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) // remove all harmful spells on you... SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo(); - bool dmgClassNone = false; - if (spell->DmgClass == SPELL_DAMAGE_CLASS_NONE && spell->SpellFamilyName == SPELLFAMILY_GENERIC) - for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) - { - if ((iter->second->GetEffectMask() & (1<Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE && - spell->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_TRIGGER_SPELL && - spell->Effects[i].ApplyAuraName != SPELL_AURA_DUMMY) - { - dmgClassNone = false; - break; - } - dmgClassNone = true; - } + bool dmgClassNone = false; + if (spell->DmgClass == SPELL_DAMAGE_CLASS_NONE && spell->SpellFamilyName == SPELLFAMILY_GENERIC) + for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) + { + if ((iter->second->GetEffectMask() & (1<Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE && + spell->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_TRIGGER_SPELL && + spell->Effects[i].ApplyAuraName != SPELL_AURA_DUMMY) + { + dmgClassNone = false; + break; + } + dmgClassNone = true; + } if ((spell->DmgClass == SPELL_DAMAGE_CLASS_MAGIC || (spell->GetDispelMask() & dispelMask) || dmgClassNone) && // ignore positive and passive auras !iter->second->IsPositive() && !iter->second->GetBase()->IsPassive() && - // Xinef: Ignore NPC spells having INVULNERABILITY attribute - (!spell->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) || spell->SpellFamilyName != SPELLFAMILY_GENERIC)) + // Xinef: Ignore NPC spells having INVULNERABILITY attribute + (!spell->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) || spell->SpellFamilyName != SPELLFAMILY_GENERIC)) { m_caster->RemoveAura(iter); } @@ -901,11 +901,11 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) } return; } - // Spell Lock, handled in interrupt effect - // launch is handled before hit triggers, thus silence removes current casted spell - // and interrupt is unable to detect any cast and doesnt work - case 24259: - return; + // Spell Lock, handled in interrupt effect + // launch is handled before hit triggers, thus silence removes current casted spell + // and interrupt is unable to detect any cast and doesnt work + case 24259: + return; } } @@ -1116,30 +1116,30 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex) // Init dest coordinates float x, y, z; destTarget->GetPosition(x, y, z); - // xinef: this can happen if MovePositionToFirstCollision detects that X, Y cords are invalid and returns prematurely - if (!Trinity::IsValidMapCoord(x, y, z) || z <= INVALID_HEIGHT) - return; + // xinef: this can happen if MovePositionToFirstCollision detects that X, Y cords are invalid and returns prematurely + if (!Trinity::IsValidMapCoord(x, y, z) || z <= INVALID_HEIGHT) + return; float speedXY, speedZ; float dist = m_caster->GetExactDist2d(x, y); CalculateJumpSpeeds(effIndex, dist, speedXY, speedZ); - // Override, calculations are incorrect - if (m_spellInfo->Id == 49376) // feral charge - { - speedXY = pow(speedZ*10, 2); - m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ, 0, ObjectAccessor::GetUnit(*m_caster, m_caster->GetUInt64Value(UNIT_FIELD_TARGET))); - return; - } - else if (m_spellInfo->Id == 57604) // death grip - { - speedZ = 3.0f; - speedXY = 50.0f; - } + // Override, calculations are incorrect + if (m_spellInfo->Id == 49376) // feral charge + { + speedXY = pow(speedZ*10, 2); + m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ, 0, ObjectAccessor::GetUnit(*m_caster, m_caster->GetUInt64Value(UNIT_FIELD_TARGET))); + return; + } + else if (m_spellInfo->Id == 57604) // death grip + { + speedZ = 3.0f; + speedXY = 50.0f; + } - // crash fix? - if (speedXY < 1.0f) - speedXY = 1.0f; + // crash fix? + if (speedXY < 1.0f) + speedXY = 1.0f; m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ); } @@ -1166,15 +1166,15 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) // Pre effects switch (m_spellInfo->Id) { - case 70746: // Teleport Into Sunwell (for Battered Hilt) - if (Player* target = unitTarget->ToPlayer()) - { - uint32 mapid = destTarget->GetMapId(); - float x, y, z, orientation; - destTarget->GetPosition(x, y, z, orientation); - target->TeleportTo(mapid, x, y, z, orientation, TELE_TO_GM_MODE); // skip CanPlayerEnter check - } - return; + case 70746: // Teleport Into Sunwell (for Battered Hilt) + if (Player* target = unitTarget->ToPlayer()) + { + uint32 mapid = destTarget->GetMapId(); + float x, y, z, orientation; + destTarget->GetPosition(x, y, z, orientation); + target->TeleportTo(mapid, x, y, z, orientation, TELE_TO_GM_MODE); // skip CanPlayerEnter check + } + return; } // If not exist data for dest location - return @@ -1194,23 +1194,23 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) orientation = m_targets.GetUnitTarget()->GetOrientation(); ;//sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation); - if (mapid == unitTarget->GetMapId()) - { - if (unitTarget->GetVehicleKit()) // we are vehicle! - unitTarget->GetVehicleKit()->TeleportVehicle(x, y, z, orientation); - else - { - bool withPet = unitTarget->GetTypeId() == TYPEID_PLAYER && m_spellInfo->SpellFamilyName == SPELLFAMILY_GENERIC && unitTarget->GetMap()->IsDungeon() && unitTarget->GetExactDist(x, y, z) > 50.0f; - unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster, false, withPet, true); - if (unitTarget->GetTypeId() == TYPEID_PLAYER) // pussywizard: for units it's done inside NearTeleportTo - unitTarget->UpdateObjectVisibility(true); - } - } - else if (unitTarget->GetTypeId() == TYPEID_PLAYER) + if (mapid == unitTarget->GetMapId()) + { + if (unitTarget->GetVehicleKit()) // we are vehicle! + unitTarget->GetVehicleKit()->TeleportVehicle(x, y, z, orientation); + else + { + bool withPet = unitTarget->GetTypeId() == TYPEID_PLAYER && m_spellInfo->SpellFamilyName == SPELLFAMILY_GENERIC && unitTarget->GetMap()->IsDungeon() && unitTarget->GetExactDist(x, y, z) > 50.0f; + unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster, false, withPet, true); + if (unitTarget->GetTypeId() == TYPEID_PLAYER) // pussywizard: for units it's done inside NearTeleportTo + unitTarget->UpdateObjectVisibility(true); + } + } + else if (unitTarget->GetTypeId() == TYPEID_PLAYER) unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0); else { - sLog->outError("Spell::EffectTeleportUnits - spellId %u attempted to teleport creature to a different map.", m_spellInfo->Id); + sLog->outError("Spell::EffectTeleportUnits - spellId %u attempted to teleport creature to a different map.", m_spellInfo->Id); return; } @@ -1511,24 +1511,24 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) Unit::AuraEffectList const& RejorRegr = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL); // find most short by duration AuraEffect* forcedTargetAura = NULL; - AuraEffect* targetAura = NULL; + AuraEffect* targetAura = NULL; for (Unit::AuraEffectList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) { if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID && (*i)->GetSpellInfo()->SpellFamilyFlags[0] & 0x50) { - if (m_caster->GetGUID() == (*i)->GetCasterGUID()) - { - if (!forcedTargetAura || (*i)->GetBase()->GetDuration() < forcedTargetAura->GetBase()->GetDuration()) - forcedTargetAura = *i; - } + if (m_caster->GetGUID() == (*i)->GetCasterGUID()) + { + if (!forcedTargetAura || (*i)->GetBase()->GetDuration() < forcedTargetAura->GetBase()->GetDuration()) + forcedTargetAura = *i; + } else if (!targetAura || (*i)->GetBase()->GetDuration() < targetAura->GetBase()->GetDuration()) targetAura = *i; } } - if (forcedTargetAura) - targetAura = forcedTargetAura; + if (forcedTargetAura) + targetAura = forcedTargetAura; if (!targetAura) { @@ -1538,7 +1538,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) int32 tickheal = targetAura->GetAmount(); if (Unit* auraCaster = targetAura->GetCaster()) - tickheal = unitTarget->SpellHealingBonusTaken(auraCaster, targetAura->GetSpellInfo(), tickheal, DOT); + tickheal = unitTarget->SpellHealingBonusTaken(auraCaster, targetAura->GetSpellInfo(), tickheal, DOT); //int32 tickheal = targetAura->GetSpellInfo()->EffectBasePoints[idx] + 1; //It is said that talent bonus should not be included @@ -1562,15 +1562,15 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) } // Death Pact - return pct of max health to caster else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] & 0x00080000) - { + { addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, int32(caster->CountPctFromMaxHealth(damage)), HEAL); - addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); - } + addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); + } else if (m_spellInfo->Id != 33778) // not lifebloom - { + { addhealth = caster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL); - addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); - } + addhealth = unitTarget->SpellHealingBonusTaken(caster, m_spellInfo, addhealth, HEAL); + } m_damage -= addhealth; } @@ -1624,7 +1624,7 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) ;//sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "HealthLeech :%i", damage); - // xinef: handled in spell.cpp + // xinef: handled in spell.cpp //float healMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this); m_damage += damage; @@ -1654,7 +1654,7 @@ void Spell::DoCreateItem(uint8 /*effIndex*/, uint32 itemId) return; } - uint32 addNumber = damage; + uint32 addNumber = damage; // bg reward have some special in code work bool SelfCast = true; @@ -1668,15 +1668,15 @@ void Spell::DoCreateItem(uint8 /*effIndex*/, uint32 itemId) case SPELL_AB_MARK_LOSER: SelfCast = true; break; - case SPELL_WG_MARK_WINNER: - if (player->HasAura(55629 /*SPELL_LIEUTENANT*/)) - addNumber = 3; - else if (player->HasAura(33280 /*SPELL_CORPORAL*/)) - addNumber = 2; - else - addNumber = 1; - SelfCast = true; - break; + case SPELL_WG_MARK_WINNER: + if (player->HasAura(55629 /*SPELL_LIEUTENANT*/)) + addNumber = 3; + else if (player->HasAura(33280 /*SPELL_CORPORAL*/)) + addNumber = 2; + else + addNumber = 1; + SelfCast = true; + break; } if (addNumber < 1) @@ -1691,13 +1691,13 @@ void Spell::DoCreateItem(uint8 /*effIndex*/, uint32 itemId) // get the chance and maximum number for creating extra items if (canCreateExtraItems(player, m_spellInfo->Id, additionalCreateChance, newMaxOrEntry)) { - if (newMaxOrEntry > 0) - { - // roll with this chance till we roll not to create or we create the max num - while (roll_chance_f(additionalCreateChance) && itemsCount <= newMaxOrEntry) - ++itemsCount; - } - else if (roll_chance_f(additionalCreateChance)) // if the roll succeeds... + if (newMaxOrEntry > 0) + { + // roll with this chance till we roll not to create or we create the max num + while (roll_chance_f(additionalCreateChance) && itemsCount <= newMaxOrEntry) + ++itemsCount; + } + else if (roll_chance_f(additionalCreateChance)) // if the roll succeeds... itemId = uint32(-newMaxOrEntry); // the perfect item replaces the regular one } @@ -1915,9 +1915,9 @@ void Spell::EffectEnergize(SpellEffIndex effIndex) Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras(); for (Unit::AuraApplicationMap::iterator itr = Auras.begin(); itr != Auras.end(); ++itr) { - SpellGroupSpecialFlags sFlag = sSpellMgr->GetSpellGroupSpecialFlags(itr->second->GetBase()->GetId()); + SpellGroupSpecialFlags sFlag = sSpellMgr->GetSpellGroupSpecialFlags(itr->second->GetBase()->GetId()); if (!guardianFound) - if (sFlag & SPELL_GROUP_SPECIAL_FLAG_ELIXIR_GUARDIAN) + if (sFlag & SPELL_GROUP_SPECIAL_FLAG_ELIXIR_GUARDIAN) guardianFound = true; if (!battleFound) if (sFlag & SPELL_GROUP_SPECIAL_FLAG_ELIXIR_BATTLE) @@ -1946,7 +1946,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex) // cast random elixir on target m_caster->CastSpell(unitTarget, Trinity::Containers::SelectRandomContainerElement(availableElixirs), true, m_CastItem); } - } + } } void Spell::EffectEnergizePct(SpellEffIndex effIndex) @@ -2011,10 +2011,10 @@ void Spell::SendLoot(uint64 guid, LootType loottype) case GAMEOBJECT_TYPE_BUTTON: gameObjTarget->UseDoorOrButton(0, false, player); - // Xinef: properly link possible traps - if (uint32 trapEntry = gameObjTarget->GetGOInfo()->button.linkedTrap) - gameObjTarget->TriggeringLinkedGameObject(trapEntry, player); - return; + // Xinef: properly link possible traps + if (uint32 trapEntry = gameObjTarget->GetGOInfo()->button.linkedTrap) + gameObjTarget->TriggeringLinkedGameObject(trapEntry, player); + return; case GAMEOBJECT_TYPE_QUESTGIVER: player->PrepareGossipMenu(gameObjTarget, gameObjTarget->GetGOInfo()->questgiver.gossipID, true); player->SendPreparedGossip(gameObjTarget); @@ -2084,11 +2084,11 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) return; } } - else if (m_spellInfo->Id == 1842 && gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP) + else if (m_spellInfo->Id == 1842 && gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP) { gameObjTarget->SetLootState(GO_JUST_DEACTIVATED); - if (!gameObjTarget->GetOwner()) // pussywizard - gameObjTarget->SetRespawnTime(gameObjTarget->GetGOInfo()->GetAutoCloseTime()/IN_MILLISECONDS/*xinef*/); + if (!gameObjTarget->GetOwner()) // pussywizard + gameObjTarget->SetRespawnTime(gameObjTarget->GetGOInfo()->GetAutoCloseTime()/IN_MILLISECONDS/*xinef*/); return; } // TODO: Add script for spell 41920 - Filling, becouse server it freze when use this spell @@ -2124,11 +2124,11 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) if (gameObjTarget) SendLoot(guid, LOOT_SKINNING); else if (itemTarget) - { + { itemTarget->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED); - if (Player* itemOwner = itemTarget->GetOwner()) - itemTarget->SetState(ITEM_CHANGED, itemOwner); - } + if (Player* itemOwner = itemTarget->GetOwner()) + itemTarget->SetState(ITEM_CHANGED, itemOwner); + } // not allow use skill grow at item base open if (!m_CastItem && skillId != SKILL_NONE) @@ -2207,7 +2207,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) m_castItemGUID = 0; player->StoreItem(dest, pNewItem, true); - player->ItemAddedQuestCheck(pNewItem->GetEntry(), 1); + player->ItemAddedQuestCheck(pNewItem->GetEntry(), 1); return; } } @@ -2329,7 +2329,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) case 1562: case 833: case 1161: - case 713: // xinef, bloodworms + case 713: // xinef, bloodworms numSummons = (damage > 0) ? damage : 1; break; default: @@ -2363,7 +2363,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) case SUMMON_TYPE_LIGHTWELL: case SUMMON_TYPE_TOTEM: { - // protection code + // protection code summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id); if (!summon || !summon->IsTotem()) return; @@ -2379,7 +2379,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) } break; } - case SUMMON_TYPE_JEEVES: + case SUMMON_TYPE_JEEVES: case SUMMON_TYPE_MINIPET: { summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id); @@ -2390,15 +2390,15 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) summon->SetUInt32Value(UNIT_NPC_FLAGS, summon->GetCreatureTemplate()->npcflag); summon->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - summon->SetReactState(REACT_PASSIVE); + summon->SetReactState(REACT_PASSIVE); - // Xinef: Pet can have some auras in creature_addon or in scripts, do not remove them instantly + // Xinef: Pet can have some auras in creature_addon or in scripts, do not remove them instantly //summon->AI()->EnterEvadeMode(); - if (properties->Type != SUMMON_TYPE_JEEVES) - { - summon->GetMotionMaster()->Clear(false); - summon->GetMotionMaster()->MoveFollow(m_originalCaster, PET_FOLLOW_DIST, summon->GetFollowAngle(), MOTION_SLOT_ACTIVE); - } + if (properties->Type != SUMMON_TYPE_JEEVES) + { + summon->GetMotionMaster()->Clear(false); + summon->GetMotionMaster()->MoveFollow(m_originalCaster, PET_FOLLOW_DIST, summon->GetFollowAngle(), MOTION_SLOT_ACTIVE); + } break; } default: @@ -2420,7 +2420,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) if (!summon) continue; - summon->SetTempSummonType(summonType); + summon->SetTempSummonType(summonType); if (properties->Category == SUMMON_CATEGORY_ALLY) { @@ -2435,9 +2435,9 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) }//switch break; case SUMMON_CATEGORY_PET: - // Xinef: SummonGuardian function can summon a few npcs of same type, remove old summons with same entry here - if (m_originalCaster) - m_originalCaster->RemoveAllMinionsByEntry(entry); + // Xinef: SummonGuardian function can summon a few npcs of same type, remove old summons with same entry here + if (m_originalCaster) + m_originalCaster->RemoveAllMinionsByEntry(entry); SummonGuardian(effIndex, entry, properties, numSummons); break; case SUMMON_CATEGORY_PUPPET: @@ -2448,9 +2448,9 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) // to cast a ride vehicle spell on the summoned unit. //float x, y, z; //m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); - // xinef: vehicles summoned in air, eg. Cold Hearted quest - if (fabs(m_caster->GetPositionZ()-destTarget->GetPositionZ()) > 6.0f) - destTarget->m_positionZ = m_caster->GetPositionZ(); + // xinef: vehicles summoned in air, eg. Cold Hearted quest + if (fabs(m_caster->GetPositionZ()-destTarget->GetPositionZ()) > 6.0f) + destTarget->m_positionZ = m_caster->GetPositionZ(); summon = m_originalCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_caster, m_spellInfo->Id); if (!summon || !summon->IsVehicle()) @@ -2458,21 +2458,21 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) // The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE uint32 spellId = VEHICLE_SPELL_RIDE_HARDCODED; - int32 basePoints = m_spellInfo->Effects[effIndex].CalcValue(); - if (basePoints > 1) // xinef: some summoning spells have value 1 - indicates vehicle seat - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(basePoints); + int32 basePoints = m_spellInfo->Effects[effIndex].CalcValue(); + if (basePoints > 1) // xinef: some summoning spells have value 1 - indicates vehicle seat + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(basePoints); if (spellInfo && spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE)) spellId = spellInfo->Id; - } + } // xinef: if we have small value, it indicates seat position - if (basePoints > 0 && basePoints < MAX_VEHICLE_SEATS) - m_originalCaster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, basePoints, summon, true); - else - m_originalCaster->CastSpell(summon, spellId, true); + if (basePoints > 0 && basePoints < MAX_VEHICLE_SEATS) + m_originalCaster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, basePoints, summon, true); + else + m_originalCaster->CastSpell(summon, spellId, true); - // xinef: i think this is wrong, found only 2 vehicles with faction override and one of them should inherit caster faction... + // xinef: i think this is wrong, found only 2 vehicles with faction override and one of them should inherit caster faction... //uint32 faction = properties->Faction; //if (!faction) uint32 faction = m_originalCaster->getFaction(); @@ -2585,9 +2585,9 @@ void Spell::EffectDispel(SpellEffIndex effIndex) if (failCount) m_caster->SendMessageToSet(&dataFail, true); - // put in combat - if (unitTarget->IsFriendlyTo(m_caster)) - unitTarget->getHostileRefManager().threatAssist(m_caster, 0.0f, m_spellInfo); + // put in combat + if (unitTarget->IsFriendlyTo(m_caster)) + unitTarget->getHostileRefManager().threatAssist(m_caster, 0.0f, m_spellInfo); if (success_list.empty()) return; @@ -2725,7 +2725,7 @@ void Spell::EffectTeleUnitsFaceCaster(SpellEffIndex effIndex) float x, y, z; destTarget->GetPosition(x, y, z); - unitTarget->NearTeleportTo(x, y, z, unitTarget->GetAngle(m_caster)); + unitTarget->NearTeleportTo(x, y, z, unitTarget->GetAngle(m_caster)); } void Spell::EffectLearnSkill(SpellEffIndex effIndex) @@ -3100,12 +3100,12 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex) { SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(67); if (properties && m_originalCaster) - { - // Xinef: unsummon old guardian - if (Guardian* oldPet = m_originalCaster->GetGuardianPet()) - oldPet->UnSummon(); + { + // Xinef: unsummon old guardian + if (Guardian* oldPet = m_originalCaster->GetGuardianPet()) + oldPet->UnSummon(); SummonGuardian(effIndex, petentry, properties, 1); - } + } return; } @@ -3128,11 +3128,11 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex) owner->GetClosePoint(px, py, pz, OldSummon->GetObjectSize()); OldSummon->NearTeleportTo(px, py, pz, OldSummon->GetOrientation()); - OldSummon->UpdateObjectVisibility(); + OldSummon->UpdateObjectVisibility(); - OldSummon->SetHealth(OldSummon->GetMaxHealth()); - OldSummon->SetPower(OldSummon->getPowerType(), OldSummon->GetMaxPower(OldSummon->getPowerType())); - // notify player + OldSummon->SetHealth(OldSummon->GetMaxHealth()); + OldSummon->SetPower(OldSummon->getPowerType(), OldSummon->GetMaxPower(OldSummon->getPowerType())); + // notify player for (CreatureSpellCooldowns::const_iterator itr = OldSummon->m_CreatureSpellCooldowns.begin(); itr != OldSummon->m_CreatureSpellCooldowns.end(); ++itr) owner->SendClearCooldown(itr->first, OldSummon); @@ -3158,11 +3158,11 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex) float x, y, z; owner->GetClosePoint(x, y, z, owner->GetObjectSize()); - owner->SummonPet(petentry, x, y, z, owner->GetOrientation(), SUMMON_PET, 0, m_spellInfo->Id, m_caster->GetGUID(), PET_LOAD_SUMMON_PET); + owner->SummonPet(petentry, x, y, z, owner->GetOrientation(), SUMMON_PET, 0, m_spellInfo->Id, m_caster->GetGUID(), PET_LOAD_SUMMON_PET); //if (!pet) // return; - // xinef: cant execute this... :( hope nothing relevant gets bugged + // xinef: cant execute this... :( hope nothing relevant gets bugged //ExecuteLogEffectSummonObject(effIndex, pet); } @@ -3200,9 +3200,9 @@ void Spell::EffectTaunt(SpellEffIndex /*effIndex*/) if (!unitTarget) return; - // xinef: Hand of Reckoning, cast before checing canhavethreatlist. fixes damage against pets - if (m_spellInfo->Id == 62124 && unitTarget->GetVictim() != m_caster && !unitTarget->IsTotem()) - m_caster->CastSpell(unitTarget, 67485, true); + // xinef: Hand of Reckoning, cast before checing canhavethreatlist. fixes damage against pets + if (m_spellInfo->Id == 62124 && unitTarget->GetVictim() != m_caster && !unitTarget->IsTotem()) + m_caster->CastSpell(unitTarget, 67485, true); // this effect use before aura Taunt apply for prevent taunt already attacking target // for spell as marked "non effective at already attacking target" @@ -3263,20 +3263,20 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) { switch (m_spellInfo->Id) { - // Trial of the Champion, Black Knight, Obliterate - case 67725: - case 67883: - { - AddPct(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), 1)*30.0f); - break; - } - // sweeping strikes - case 26654: - { - this->damage = 0; - m_damage = m_spellValue->EffectBasePoints[effIndex]; - return; - } + // Trial of the Champion, Black Knight, Obliterate + case 67725: + case 67883: + { + AddPct(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), 1)*30.0f); + break; + } + // sweeping strikes + case 26654: + { + this->damage = 0; + m_damage = m_spellValue->EffectBasePoints[effIndex]; + return; + } } break; } @@ -3286,7 +3286,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) if (m_spellInfo->SpellFamilyFlags[1] & 0x40) { // Player can apply only 58567 Sunder Armor effect. - // Xinef: 7386 triggers 58567 + // Xinef: 7386 triggers 58567 bool needCast = !unitTarget->HasAura(58567); if (needCast) m_caster->CastSpell(unitTarget, 7386, true); @@ -3299,7 +3299,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) spell_bonus += (aur->GetStackAmount() - 1) * CalculateSpellDamage(2, unitTarget); } } - break; + break; } case SPELLFAMILY_ROGUE: { @@ -3361,9 +3361,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Stormstrike if (AuraEffect* aurEff = m_caster->IsScriptOverriden(m_spellInfo, 5634)) m_caster->CastSpell(m_caster, 38430, true, NULL, aurEff); - // Lava lash damage increased by Flametongue weapon - if (m_caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 688, EFFECT_0)) - AddPct(totalDamagePercentMod, 25.0f); + // Lava lash damage increased by Flametongue weapon + if (m_caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 688, EFFECT_0)) + AddPct(totalDamagePercentMod, 25.0f); break; } case SPELLFAMILY_DRUID: @@ -3404,10 +3404,10 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Blood Strike if (m_spellInfo->SpellFamilyFlags[0] & 0x400000) { - float disease_amt = m_spellInfo->Effects[EFFECT_2].CalcValue(); - //Death Knight T8 Melee 4P Bonus - if (AuraEffect *aurEff = m_caster->GetAuraEffectDummy(64736) ) - AddPct(disease_amt, aurEff->GetAmount()); + float disease_amt = m_spellInfo->Effects[EFFECT_2].CalcValue(); + //Death Knight T8 Melee 4P Bonus + if (AuraEffect *aurEff = m_caster->GetAuraEffectDummy(64736) ) + AddPct(disease_amt, aurEff->GetAmount()); AddPct(totalDamagePercentMod, disease_amt * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f); @@ -3436,10 +3436,10 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) if (roll_chance_i(aurEff->GetAmount())) consumeDiseases = false; - float disease_amt = m_spellInfo->Effects[EFFECT_2].CalcValue(); - //Death Knight T8 Melee 4P Bonus - if (AuraEffect *aurEff = m_caster->GetAuraEffectDummy(64736) ) - AddPct(disease_amt, aurEff->GetAmount()); + float disease_amt = m_spellInfo->Effects[EFFECT_2].CalcValue(); + //Death Knight T8 Melee 4P Bonus + if (AuraEffect *aurEff = m_caster->GetAuraEffectDummy(64736) ) + AddPct(disease_amt, aurEff->GetAmount()); AddPct(totalDamagePercentMod, disease_amt * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f); break; @@ -3447,27 +3447,27 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Blood-Caked Strike - Blood-Caked Blade if (m_spellInfo->SpellIconID == 1736) { - int32 weaponDamage = m_caster->CalculateDamage(m_attackType, false, true); - ApplyPct(weaponDamage, std::min(uint32(3), unitTarget->GetDiseasesByCaster(m_caster->GetGUID())) * 12.5f); - spell_bonus = weaponDamage; + int32 weaponDamage = m_caster->CalculateDamage(m_attackType, false, true); + ApplyPct(weaponDamage, std::min(uint32(3), unitTarget->GetDiseasesByCaster(m_caster->GetGUID())) * 12.5f); + spell_bonus = weaponDamage; break; } // Heart Strike if (m_spellInfo->SpellFamilyFlags[0] & 0x1000000) { - float disease_amt = m_spellInfo->Effects[EFFECT_2].CalcValue(); - //Death Knight T8 Melee 4P Bonus - if (AuraEffect *aurEff = m_caster->GetAuraEffectDummy(64736) ) - AddPct(disease_amt, aurEff->GetAmount()); + float disease_amt = m_spellInfo->Effects[EFFECT_2].CalcValue(); + //Death Knight T8 Melee 4P Bonus + if (AuraEffect *aurEff = m_caster->GetAuraEffectDummy(64736) ) + AddPct(disease_amt, aurEff->GetAmount()); AddPct(totalDamagePercentMod, disease_amt * unitTarget->GetDiseasesByCaster(m_caster->GetGUID())); break; - } - // Rune Strike - if (m_spellInfo->SpellFamilyFlags[1] & 0x20000000) - { + } + // Rune Strike + if (m_spellInfo->SpellFamilyFlags[1] & 0x20000000) + { spell_bonus += int32(0.15f * m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); - } + } break; } @@ -3475,11 +3475,11 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) bool normalized = false; float weaponDamagePercentMod = 100.0f; - int32 fixed_bonus = 0; + int32 fixed_bonus = 0; - // xinef: Divine Storm deals normalized damage - if (m_spellInfo->Id == 53385) - normalized = true; + // xinef: Divine Storm deals normalized damage + if (m_spellInfo->Id == 53385) + normalized = true; for (int j = 0; j < MAX_SPELL_EFFECTS; ++j) { @@ -3514,22 +3514,22 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) } if (m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL) - { + { float weapon_total_pct = m_caster->GetModifierValue(unitMod, TOTAL_PCT); - fixed_bonus = int32(fixed_bonus * weapon_total_pct); + fixed_bonus = int32(fixed_bonus * weapon_total_pct); spell_bonus = int32(spell_bonus * weapon_total_pct); - } + } } int32 weaponDamage = 0; - // Dancing Rune Weapon - if (m_caster->GetEntry() == 27893) + // Dancing Rune Weapon + if (m_caster->GetEntry() == 27893) { if (Unit* owner = m_caster->GetOwner()) - weaponDamage = owner->CalculateDamage(m_attackType, normalized, true); - } - else - weaponDamage = m_caster->CalculateDamage(m_attackType, normalized, true); + weaponDamage = owner->CalculateDamage(m_attackType, normalized, true); + } + else + weaponDamage = m_caster->CalculateDamage(m_attackType, normalized, true); // Sequence is important for (int j = 0; j < MAX_SPELL_EFFECTS; ++j) @@ -3550,7 +3550,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) } } - weaponDamage += spell_bonus; + weaponDamage += spell_bonus; ApplyPct(weaponDamage, totalDamagePercentMod); // prevent negative damage @@ -3560,7 +3560,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) eff_damage = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo); eff_damage = unitTarget->MeleeDamageBonusTaken(m_caster, eff_damage, m_attackType, m_spellInfo); - // Meteor like spells (divided damage to targets) + // Meteor like spells (divided damage to targets) if (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_SHARE_DAMAGE)) { uint32 count = 0; @@ -3582,7 +3582,7 @@ void Spell::EffectThreat(SpellEffIndex /*effIndex*/) if (!unitTarget || !unitTarget->IsAlive() || !m_caster->IsAlive()) return; - // xinef: skip if target cannot have threat list or caster is friendly (ghoul leap) + // xinef: skip if target cannot have threat list or caster is friendly (ghoul leap) if (!unitTarget->CanHaveThreatList() || m_caster->IsFriendlyTo(unitTarget)) return; @@ -3642,9 +3642,9 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex) } } - // Spell Lock - if (m_spellInfo->Id == 19647) - m_caster->CastSpell(unitTarget, m_spellInfo->Effects[EFFECT_1].TriggerSpell, true); + // Spell Lock + if (m_spellInfo->Id == 19647) + m_caster->CastSpell(unitTarget, m_spellInfo->Effects[EFFECT_1].TriggerSpell, true); } void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) @@ -3785,11 +3785,11 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) case 1: case 2: itemId = 23584; - break; // Loch Modan Lager + break; // Loch Modan Lager case 3: case 4: itemId = 23585; - break; // Stouthammer Lite + break; // Stouthammer Lite } DoCreateItem(effIndex, itemId); break; @@ -3813,20 +3813,20 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } } break; - // SOTA defender teleport - case 54640: - { - if (Player* player = unitTarget->ToPlayer()) - if (player->GetBattleground() && player->GetBattleground()->GetBgTypeID() == BATTLEGROUND_SA) - { - if (GameObject* dportal = player->FindNearestGameObject(192819, 10.0f)) - { - BattlegroundSA* bg = ((BattlegroundSA*)player->GetBattleground()); - bg->DefendersPortalTeleport(dportal, player); - } - } - return; - } + // SOTA defender teleport + case 54640: + { + if (Player* player = unitTarget->ToPlayer()) + if (player->GetBattleground() && player->GetBattleground()->GetBgTypeID() == BATTLEGROUND_SA) + { + if (GameObject* dportal = player->FindNearestGameObject(192819, 10.0f)) + { + BattlegroundSA* bg = ((BattlegroundSA*)player->GetBattleground()); + bg->DefendersPortalTeleport(dportal, player); + } + } + return; + } /*// Mug Transformation case 41931: { @@ -3982,7 +3982,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) return; } case 59317: // Teleporting - { + { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -3994,7 +3994,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) unitTarget->CastSpell(unitTarget, 59314, true); return; - } + } case 60123: // Lightwell { if (m_caster->GetTypeId() != TYPEID_UNIT || !m_caster->ToCreature()->IsSummon()) @@ -4058,19 +4058,19 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } break; } - case 61263: // for item Intravenous Healing Potion (44698) - { - if( !m_caster || !unitTarget ) - return; + case 61263: // for item Intravenous Healing Potion (44698) + { + if( !m_caster || !unitTarget ) + return; - m_caster->CastSpell(m_caster, 61267, true); - m_caster->CastSpell(m_caster, 61268, true); - return; - } + m_caster->CastSpell(m_caster, 61267, true); + m_caster->CastSpell(m_caster, 61268, true); + return; + } } break; } - case SPELLFAMILY_ROGUE: + case SPELLFAMILY_ROGUE: { switch( m_spellInfo->Id ) { @@ -4097,7 +4097,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) Aura *overkill = unitTarget->GetAura(58427); if( overkill ) - { + { overkill->SetMaxDuration(20000); overkill->SetDuration(20000, true); } @@ -4122,27 +4122,27 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/) if (!unitTarget) return; - if (unitTarget->GetInstanceScript() && unitTarget->GetInstanceScript()->IsEncounterInProgress()) - { - unitTarget->getHostileRefManager().UpdateVisibility(true); - // Xinef: replaced with CombatStop(false) - unitTarget->AttackStop(); - unitTarget->RemoveAllAttackers(); + if (unitTarget->GetInstanceScript() && unitTarget->GetInstanceScript()->IsEncounterInProgress()) + { + unitTarget->getHostileRefManager().UpdateVisibility(true); + // Xinef: replaced with CombatStop(false) + unitTarget->AttackStop(); + unitTarget->RemoveAllAttackers(); - // Night Elf: Shadowmeld only resets threat temporarily - if (m_spellInfo->Id != 59646) - unitTarget->getHostileRefManager().addThreatPercent(-100); + // Night Elf: Shadowmeld only resets threat temporarily + if (m_spellInfo->Id != 59646) + unitTarget->getHostileRefManager().addThreatPercent(-100); - if (unitTarget->GetTypeId() == TYPEID_PLAYER) - unitTarget->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel - } - else - { - unitTarget->getHostileRefManager().UpdateVisibility(m_spellInfo->Id == 59646); // Night Elf: Shadowmeld - unitTarget->CombatStop(false); - } + if (unitTarget->GetTypeId() == TYPEID_PLAYER) + unitTarget->ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel + } + else + { + unitTarget->getHostileRefManager().UpdateVisibility(m_spellInfo->Id == 59646); // Night Elf: Shadowmeld + unitTarget->CombatStop(false); + } - UnitList targets; + UnitList targets; Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(unitTarget, unitTarget, unitTarget->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough Trinity::UnitListSearcher searcher(unitTarget, targets, u_check); unitTarget->VisitNearbyObject(unitTarget->GetVisibilityRange(), searcher); // no VISIBILITY_COMPENSATION, distance is enough @@ -4153,31 +4153,31 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/) for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) { - if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == unitTarget->GetGUID()) + if ((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == unitTarget->GetGUID()) { - const SpellInfo* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo(); - if (si->HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE) && (*iter)->GetTypeId() == TYPEID_UNIT) - { - Creature* c = (*iter)->ToCreature(); - if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss()) - continue; - } - bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY) - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST)) - { - // at least one effect truly targets an unit, interrupt the spell - interrupt = true; - break; - } - if (interrupt) - (*iter)->InterruptSpell(CurrentSpellTypes(i), false); + const SpellInfo* si = (*iter)->GetCurrentSpell(i)->GetSpellInfo(); + if (si->HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE) && (*iter)->GetTypeId() == TYPEID_UNIT) + { + Creature* c = (*iter)->ToCreature(); + if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss()) + continue; + } + bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY) + for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) + if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST)) + { + // at least one effect truly targets an unit, interrupt the spell + interrupt = true; + break; + } + if (interrupt) + (*iter)->InterruptSpell(CurrentSpellTypes(i), false); } } } - // Xinef: Set last sanctuary time - unitTarget->m_lastSanctuaryTime = World::GetGameTimeMS(); + // Xinef: Set last sanctuary time + unitTarget->m_lastSanctuaryTime = World::GetGameTimeMS(); // Vanish allows to remove all threat and cast regular stealth so other spells can be used if (m_caster->GetTypeId() == TYPEID_PLAYER @@ -4196,14 +4196,14 @@ void Spell::EffectAddComboPoints(SpellEffIndex /*effIndex*/) if (!m_caster->m_movedByPlayer || !unitTarget || damage <= 0) return; - if (m_spellInfo->Id == 14157 || // Ruthlessness and Netherblade set - m_spellInfo->Id == 70802) // xinef: mayhem, rogue t10p4 + if (m_spellInfo->Id == 14157 || // Ruthlessness and Netherblade set + m_spellInfo->Id == 70802) // xinef: mayhem, rogue t10p4 { m_caster->m_movedByPlayer->ToPlayer()->SetComboPointGain(m_caster->m_movedByPlayer->ToPlayer()->GetComboPointGain()+damage); return; } - m_caster->m_movedByPlayer->ToPlayer()->AddComboPoints(unitTarget, damage); + m_caster->m_movedByPlayer->ToPlayer()->AddComboPoints(unitTarget, damage); } void Spell::EffectDuel(SpellEffIndex effIndex) @@ -4306,32 +4306,32 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/) if (target->IsInFlight()) return; - // xinef: if player is dead - teleport to graveyard - if (!target->IsAlive()) - { - if (target->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) - return; + // xinef: if player is dead - teleport to graveyard + if (!target->IsAlive()) + { + if (target->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) + return; - // xinef: player is in corpse - if (!target->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) - target->BuildPlayerRepop(); + // xinef: player is in corpse + if (!target->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + target->BuildPlayerRepop(); target->RepopAtGraveyard(); - return; - } + return; + } - // xinef: no hearthstone in bag or on cooldown - Item* hearthStone = target->GetItemByEntry(6948); - if (!hearthStone || target->HasSpellCooldown(8690)) - { - float o = rand_norm()*2*M_PI; - Position pos = *target; - target->MovePositionToFirstCollision(pos, 5.0f, o); - target->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), target->GetOrientation()); - return; - } + // xinef: no hearthstone in bag or on cooldown + Item* hearthStone = target->GetItemByEntry(6948); + if (!hearthStone || target->HasSpellCooldown(8690)) + { + float o = rand_norm()*2*M_PI; + Position pos = *target; + target->MovePositionToFirstCollision(pos, 5.0f, o); + target->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), target->GetOrientation()); + return; + } - // xinef: we have hearthstone not on cooldown, just use it - target->CastSpell(target, 8690, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD)); + // xinef: we have hearthstone not on cooldown, just use it + target->CastSpell(target, 8690, TriggerCastFlags(TRIGGERED_FULL_MASK&~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD)); } void Spell::EffectSummonPlayer(SpellEffIndex /*effIndex*/) @@ -4344,7 +4344,7 @@ void Spell::EffectSummonPlayer(SpellEffIndex /*effIndex*/) return; // Evil Twin (ignore player summon, but hide this for summoner) - // Xinef: Unit Target may be on other map!!!, Need workaround + // Xinef: Unit Target may be on other map!!!, Need workaround if (unitTarget->HasAura(23445)) return; @@ -4368,17 +4368,17 @@ void Spell::EffectActivateObject(SpellEffIndex /*effIndex*/) if (!gameObjTarget) return; - Player* player = m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : m_caster->GetCharmerOrOwnerPlayerOrPlayerItself(); - gameObjTarget->Use(player ? player : m_caster); + Player* player = m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : m_caster->GetCharmerOrOwnerPlayerOrPlayerItself(); + gameObjTarget->Use(player ? player : m_caster); //ScriptInfo activateCommand; //activateCommand.command = SCRIPT_COMMAND_ACTIVATE_OBJECT; // int32 unk = m_spellInfo->Effects[effIndex].MiscValue; // This is set for EffectActivateObject spells; needs research - // xinef: pass player to allow gossip scripts to work - // - //gameObjTarget->GetMap()->ScriptCommandStart(activateCommand, 0, player ? player : m_caster, gameObjTarget); + // xinef: pass player to allow gossip scripts to work + // + //gameObjTarget->GetMap()->ScriptCommandStart(activateCommand, 0, player ? player : m_caster, gameObjTarget); } void Spell::EffectApplyGlyph(SpellEffIndex effIndex) @@ -4462,9 +4462,9 @@ void Spell::EffectEnchantHeldItem(SpellEffIndex effIndex) if (!duration) duration = 10*IN_MILLISECONDS; //10 seconds for enchants which don't have listed duration - // Xinef: Venomhide poison, no other spell uses this effect... - if (m_spellInfo->Id == 14792) - duration = 5*MINUTE*IN_MILLISECONDS; + // Xinef: Venomhide poison, no other spell uses this effect... + if (m_spellInfo->Id == 14792) + duration = 5*MINUTE*IN_MILLISECONDS; SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) @@ -4761,72 +4761,72 @@ void Spell::EffectForceDeselect(SpellEffIndex /*effIndex*/) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - // xinef: clear focus - m_caster->SendClearTarget(); + // xinef: clear focus + m_caster->SendClearTarget(); WorldPacket data(SMSG_CLEAR_TARGET, 8); data << uint64(m_caster->GetGUID()); - float dist = m_caster->GetVisibilityRange()+VISIBILITY_COMPENSATION; - Trinity::MessageDistDelivererToHostile notifier(m_caster, &data, dist); + float dist = m_caster->GetVisibilityRange()+VISIBILITY_COMPENSATION; + Trinity::MessageDistDelivererToHostile notifier(m_caster, &data, dist); m_caster->VisitNearbyWorldObject(dist, notifier); - // xinef: we should also force pets to remove us from current target - Unit::AttackerSet attackerSet; + // xinef: we should also force pets to remove us from current target + Unit::AttackerSet attackerSet; for (Unit::AttackerSet::const_iterator itr = m_caster->getAttackers().begin(); itr != m_caster->getAttackers().end(); ++itr) - if ((*itr)->GetTypeId() == TYPEID_UNIT && !(*itr)->CanHaveThreatList()) - attackerSet.insert(*itr); + if ((*itr)->GetTypeId() == TYPEID_UNIT && !(*itr)->CanHaveThreatList()) + attackerSet.insert(*itr); for (Unit::AttackerSet::const_iterator itr = attackerSet.begin(); itr != attackerSet.end(); ++itr) - (*itr)->AttackStop(); + (*itr)->AttackStop(); - // Xinef: Mirror images code Initialize Images - if (m_spellInfo->Id == 58836) - { - std::vector images; - for (Unit::ControlSet::const_iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr) - if ((*itr)->GetEntry() == 31216 /*NPC_MIRROR_IMAGE*/) - images.push_back(*itr); + // Xinef: Mirror images code Initialize Images + if (m_spellInfo->Id == 58836) + { + std::vector images; + for (Unit::ControlSet::const_iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr) + if ((*itr)->GetEntry() == 31216 /*NPC_MIRROR_IMAGE*/) + images.push_back(*itr); - if (images.empty()) - return; + if (images.empty()) + return; - UnitList targets; - Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, m_caster->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough - Trinity::UnitListSearcher searcher(m_caster, targets, u_check); - m_caster->VisitNearbyObject(m_caster->GetVisibilityRange(), searcher); // no VISIBILITY_COMPENSATION, distance is enough - for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter) - { - if (!(*iter)->HasUnitState(UNIT_STATE_CASTING)) - continue; + UnitList targets; + Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, m_caster->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough + Trinity::UnitListSearcher searcher(m_caster, targets, u_check); + m_caster->VisitNearbyObject(m_caster->GetVisibilityRange(), searcher); // no VISIBILITY_COMPENSATION, distance is enough + for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter) + { + if (!(*iter)->HasUnitState(UNIT_STATE_CASTING)) + continue; - if (Spell* spell = (*iter)->GetCurrentSpell(CURRENT_GENERIC_SPELL)) - { - if (spell->m_targets.GetUnitTargetGUID() == m_caster->GetGUID()) - { - const SpellInfo* si = spell->GetSpellInfo(); - if (si->HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE) && (*iter)->GetTypeId() == TYPEID_UNIT) - { - Creature* c = (*iter)->ToCreature(); - if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss()) - continue; - } + if (Spell* spell = (*iter)->GetCurrentSpell(CURRENT_GENERIC_SPELL)) + { + if (spell->m_targets.GetUnitTargetGUID() == m_caster->GetGUID()) + { + const SpellInfo* si = spell->GetSpellInfo(); + if (si->HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE) && (*iter)->GetTypeId() == TYPEID_UNIT) + { + Creature* c = (*iter)->ToCreature(); + if ((!c->IsPet() && c->GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS) || c->isWorldBoss() || c->IsDungeonBoss()) + continue; + } - bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY) - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST)) - { - // at least one effect truly targets an unit, interrupt the spell - interrupt = true; - break; - } + bool interrupt = false; // pussywizard: skip spells that don't target units, but casted on unit (eg. TARGET_DEST_TARGET_ENEMY) + for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) + if (si->Effects[j].Effect && (si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT || si->Effects[j].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT_AND_DEST)) + { + // at least one effect truly targets an unit, interrupt the spell + interrupt = true; + break; + } - if (interrupt) - spell->m_targets.SetUnitTarget(images.at(urand(0, images.size()-1))); - } - } - } - } + if (interrupt) + spell->m_targets.SetUnitTarget(images.at(urand(0, images.size()-1))); + } + } + } + } } void Spell::EffectSelfResurrect(SpellEffIndex effIndex) @@ -4947,13 +4947,13 @@ void Spell::EffectChargeDest(SpellEffIndex /*effIndex*/) { Position pos; destTarget->GetPosition(&pos); - - if (!m_caster->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ())) - { - float angle = m_caster->GetRelativeAngle(pos.GetPositionX(), pos.GetPositionY()); - float dist = m_caster->GetDistance(pos); - m_caster->GetFirstCollisionPosition(pos, dist, angle); - } + + if (!m_caster->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ())) + { + float angle = m_caster->GetRelativeAngle(pos.GetPositionX(), pos.GetPositionY()); + float dist = m_caster->GetDistance(pos); + m_caster->GetFirstCollisionPosition(pos, dist, angle); + } m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ); } @@ -4965,23 +4965,23 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex) return; if (!unitTarget) - return; - - // Xinef: allow entry specific spells to skip those checks - if (m_spellInfo->Effects[effIndex].TargetA.GetCheckType() != TARGET_CHECK_ENTRY && m_spellInfo->Effects[effIndex].TargetB.GetCheckType() != TARGET_CHECK_ENTRY) - { - if (unitTarget->IsVehicle() && unitTarget->GetCreatureType() != CREATURE_TYPE_BEAST) - return; + return; + + // Xinef: allow entry specific spells to skip those checks + if (m_spellInfo->Effects[effIndex].TargetA.GetCheckType() != TARGET_CHECK_ENTRY && m_spellInfo->Effects[effIndex].TargetB.GetCheckType() != TARGET_CHECK_ENTRY) + { + if (unitTarget->IsVehicle() && unitTarget->GetCreatureType() != CREATURE_TYPE_BEAST) + return; - if (unitTarget->GetVehicle()) - return; + if (unitTarget->GetVehicle()) + return; - if (Creature* creatureTarget = unitTarget->ToCreature()) - if (creatureTarget->isWorldBoss() || creatureTarget->IsDungeonBoss() || creatureTarget->IsImmuneToKnockback() || unitTarget->ToCreature()->GetCreatureType() == CREATURE_TYPE_GIANT) - return; - } + if (Creature* creatureTarget = unitTarget->ToCreature()) + if (creatureTarget->isWorldBoss() || creatureTarget->IsDungeonBoss() || creatureTarget->IsImmuneToKnockback() || unitTarget->ToCreature()->GetCreatureType() == CREATURE_TYPE_GIANT) + return; + } - // Spells with SPELL_EFFECT_KNOCK_BACK(like Thunderstorm) can't knoback target if target has ROOT + // Spells with SPELL_EFFECT_KNOCK_BACK(like Thunderstorm) can't knoback target if target has ROOT if (unitTarget->HasUnitState(UNIT_STATE_ROOT)) return; @@ -5024,7 +5024,7 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex) //1891: Disengage m_caster->JumpTo(speedxy, speedz, m_spellInfo->SpellFamilyName != SPELLFAMILY_HUNTER); - // xinef: changes fall time + // xinef: changes fall time if (m_caster->GetTypeId() == TYPEID_PLAYER) m_caster->ToPlayer()->SetFallInformation(time(NULL), m_caster->GetPositionZ()); } @@ -5101,7 +5101,7 @@ void Spell::EffectPullTowards(SpellEffIndex effIndex) } else //if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_PULL_TOWARDS) { - // Xinef: Increase Z position a little bit, should protect from falling through textures + // Xinef: Increase Z position a little bit, should protect from falling through textures pos.Relocate(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ()+1.0f, m_caster->GetOrientation()); } @@ -5139,9 +5139,9 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex) unitTarget->RemoveAura(dispel_list.front().first, dispel_list.front().second, 0, AURA_REMOVE_BY_ENEMY_SPELL); } - // put in combat - if (unitTarget->IsFriendlyTo(m_caster)) - unitTarget->getHostileRefManager().threatAssist(m_caster, 0.0f, m_spellInfo); + // put in combat + if (unitTarget->IsFriendlyTo(m_caster)) + unitTarget->getHostileRefManager().threatAssist(m_caster, 0.0f, m_spellInfo); } void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/) @@ -5165,7 +5165,7 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/) if (!pet) { player->SummonPet(0, x, y, z, player->GetOrientation(), SUMMON_PET, 0, 0, (uint64)damage, PET_LOAD_SUMMON_DEAD_PET); - return; + return; } pet->SetPosition(x, y, z, player->GetOrientation()); @@ -5176,12 +5176,12 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/) pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_POSSESSED))); // xinef: just in case pet->SetHealth(pet->CountPctFromMaxHealth(damage)); - // xinef: restore movement - if (pet->GetCharmInfo()) - { - pet->GetCharmInfo()->SetIsAtStay(false); - pet->GetCharmInfo()->SetIsFollowing(false); - } + // xinef: restore movement + if (pet->GetCharmInfo()) + { + pet->GetCharmInfo()->SetIsAtStay(false); + pet->GetCharmInfo()->SetIsFollowing(false); + } pet->SavePetToDB(PET_SAVE_AS_CURRENT, false); } @@ -5319,13 +5319,13 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } - // Seaforium charge - if (m_spellInfo->Id == 52410 || m_spellInfo->Id == 66268 || m_spellInfo->Id == 66674) // SotA / IoC / IoC Huge - { - fx = m_caster->GetPositionX(); - fy = m_caster->GetPositionY(); - fz = m_caster->GetPositionZ(); - } + // Seaforium charge + if (m_spellInfo->Id == 52410 || m_spellInfo->Id == 66268 || m_spellInfo->Id == 66674) // SotA / IoC / IoC Huge + { + fx = m_caster->GetPositionX(); + fy = m_caster->GetPositionY(); + fz = m_caster->GetPositionZ(); + } Map *cMap = m_caster->GetMap(); // if gameobject is summoning object, it should be spawned right on caster's position @@ -5750,9 +5750,9 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex) } } - // is needed to push through to the client that the rune is active + // is needed to push through to the client that the rune is active //player->ResyncRunes(MAX_RUNES); - m_caster->CastSpell(m_caster, 47804, true); + m_caster->CastSpell(m_caster, 47804, true); } void Spell::EffectCreateTamedPet(SpellEffIndex effIndex) @@ -5801,14 +5801,14 @@ void Spell::EffectTitanGrip(SpellEffIndex /*effIndex*/) return; if (m_caster->GetTypeId() == TYPEID_PLAYER) - { - if (Aura* aur = m_caster->GetAura(49152)) - aur->RecalculateAmountOfEffects(); - else - m_caster->CastSpell(unitTarget, 49152, true); // damage reduction + { + if (Aura* aur = m_caster->GetAura(49152)) + aur->RecalculateAmountOfEffects(); + else + m_caster->CastSpell(unitTarget, 49152, true); // damage reduction m_caster->ToPlayer()->SetCanTitanGrip(true); - } + } } void Spell::EffectRedirectThreat(SpellEffIndex /*effIndex*/) @@ -5877,24 +5877,24 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* // level of pet summoned using engineering item based at engineering skill level if (m_CastItem && caster->GetTypeId() == TYPEID_PLAYER) if (ItemTemplate const* proto = m_CastItem->GetTemplate()) - { - // xinef: few special cases - if (proto->RequiredSkill == SKILL_ENGINEERING) - { + { + // xinef: few special cases + if (proto->RequiredSkill == SKILL_ENGINEERING) + { if (uint16 skill202 = caster->ToPlayer()->GetSkillValue(SKILL_ENGINEERING)) summonLevel = skill202 / 5; - } + } - switch (m_spellInfo->Id) - { - // Dragon's Call - case 13049: - summonLevel = 55; - break; - } - } + switch (m_spellInfo->Id) + { + // Dragon's Call + case 13049: + summonLevel = 55; + break; + } + } - summonLevel = std::min(sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF), std::max(1U, summonLevel)); + summonLevel = std::min(sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) + sWorld->getIntConfig(CONFIG_WORLD_BOSS_LEVEL_DIFF), std::max(1U, summonLevel)); float radius = 5.0f; int32 duration = m_spellInfo->GetDuration(); @@ -5904,14 +5904,14 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* //TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN; Map* map = caster->GetMap(); - TempSummon* summon = NULL; + TempSummon* summon = NULL; for (uint32 count = 0; count < numGuardians; ++count) { Position pos; - // xinef: do not use precalculated position for effect summon pet in this function, it means it was cast by NPC and should have its position overridden - if (count == 0 && GetSpellInfo()->Effects[i].Effect != SPELL_EFFECT_SUMMON_PET) + // xinef: do not use precalculated position for effect summon pet in this function, it means it was cast by NPC and should have its position overridden + if (count == 0 && GetSpellInfo()->Effects[i].Effect != SPELL_EFFECT_SUMMON_PET) pos = *destTarget; else // randomize position for multiple summons @@ -5921,22 +5921,22 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* if (!summon) return; - // xinef: set calculated level - summon->SetLevel(summonLevel); + // xinef: set calculated level + summon->SetLevel(summonLevel); - // xinef: if we have more than one guardian, change follow angle - if (summon->HasUnitTypeMask(UNIT_MASK_MINION) && numGuardians > 1) - ((Minion*)summon)->SetFollowAngle(PET_FOLLOW_ANGLE + (count * M_PI / (numGuardians-1))); - //else if (summon->HasUnitTypeMask(UNIT_MASK_MINION) && m_targets.HasDst()) + // xinef: if we have more than one guardian, change follow angle + if (summon->HasUnitTypeMask(UNIT_MASK_MINION) && numGuardians > 1) + ((Minion*)summon)->SetFollowAngle(PET_FOLLOW_ANGLE + (count * M_PI / (numGuardians-1))); + //else if (summon->HasUnitTypeMask(UNIT_MASK_MINION) && m_targets.HasDst()) // ((Minion*)summon)->SetFollowAngle(m_caster->GetAngle(summon)); - // xinef: move this here, some auras are added in initstatsforlevel! - if (!summon->IsInCombat() && !summon->IsTrigger()) - { - // summon->AI()->EnterEvadeMode(); - summon->GetMotionMaster()->Clear(false); - summon->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, summon->GetFollowAngle(), MOTION_SLOT_ACTIVE); - } + // xinef: move this here, some auras are added in initstatsforlevel! + if (!summon->IsInCombat() && !summon->IsTrigger()) + { + // summon->AI()->EnterEvadeMode(); + summon->GetMotionMaster()->Clear(false); + summon->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, summon->GetFollowAngle(), MOTION_SLOT_ACTIVE); + } if (properties && properties->Category == SUMMON_CATEGORY_ALLY) summon->setFaction(caster->getFaction()); @@ -5944,22 +5944,22 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* ExecuteLogEffectSummonObject(i, summon); } - // Summon infernal, cast enslave demon - // xinef: have to do it here because in Pet init stats infernal is not in world, imo this should be changed... - if (summon) - { - switch (m_spellInfo->Id) - { - // Inferno, Warlock summon spell - case 1122: - caster->AddAura(61191, summon); - break; - // Ritual of Doom, Warlock summon spell - case 60478: - caster->AddAura(SPELL_RITUAL_ENSLAVEMENT, summon); - break; - } - } + // Summon infernal, cast enslave demon + // xinef: have to do it here because in Pet init stats infernal is not in world, imo this should be changed... + if (summon) + { + switch (m_spellInfo->Id) + { + // Inferno, Warlock summon spell + case 1122: + caster->AddAura(61191, summon); + break; + // Ritual of Doom, Warlock summon spell + case 60478: + caster->AddAura(SPELL_RITUAL_ENSLAVEMENT, summon); + break; + } + } } void Spell::EffectRenamePet(SpellEffIndex /*effIndex*/) @@ -6185,6 +6185,6 @@ void Spell::EffectSummonRaFFriend(SpellEffIndex effIndex) if (m_caster->GetTypeId() != TYPEID_PLAYER || !unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - // Xinef: Unit Target can be on other map, thank god we dont use RaF... + // Xinef: Unit Target can be on other map, thank god we dont use RaF... m_caster->CastSpell(unitTarget, m_spellInfo->Effects[effIndex].TriggerSpell, true); } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index fd4b08b00..ea02c5e6f 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -411,7 +411,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const int32 randomPoints = int32(DieSides); // base amount modification based on spell lvl vs caster lvl - // xinef: added basePointsPerLevel check + // xinef: added basePointsPerLevel check if (caster && basePointsPerLevel != 0.0f) { int32 level = int32(caster->getLevel()); @@ -420,8 +420,8 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const else if (level < int32(_spellInfo->BaseLevel)) level = int32(_spellInfo->BaseLevel); - // xinef: if base level is greater than spell level, reduce by base level (eg. pilgrims foods) - level -= int32(std::max(_spellInfo->BaseLevel, _spellInfo->SpellLevel)); + // xinef: if base level is greater than spell level, reduce by base level (eg. pilgrims foods) + level -= int32(std::max(_spellInfo->BaseLevel, _spellInfo->SpellLevel)); basePoints += int32(level * basePointsPerLevel); } @@ -850,11 +850,11 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry) ExplicitTargetMask = _GetExplicitTargetMask(); ChainEntry = NULL; - // Mine - _isStackableWithRanks = false; - _isSpellValid = true; - _isCritCapable = false; - _requireCooldownInfo = false; + // Mine + _isStackableWithRanks = false; + _isSpellValid = true; + _isCritCapable = false; + _requireCooldownInfo = false; } SpellInfo::~SpellInfo() @@ -1025,17 +1025,17 @@ bool SpellInfo::NeedsToBeTriggeredByCaster(SpellInfo const* triggeringSpell, uin if (NeedsExplicitUnitTarget()) return true; - // pussywizard: - if (effIndex < MAX_SPELL_EFFECTS && (triggeringSpell->Effects[effIndex].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || triggeringSpell->Effects[effIndex].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)) - { - // xinef: - if (Id == 60563) - return true; + // pussywizard: + if (effIndex < MAX_SPELL_EFFECTS && (triggeringSpell->Effects[effIndex].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || triggeringSpell->Effects[effIndex].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)) + { + // xinef: + if (Id == 60563) + return true; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (Effects[i].IsEffect() && (Effects[i].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || Effects[i].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)) - return true; - } + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (Effects[i].IsEffect() && (Effects[i].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || Effects[i].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)) + return true; + } /* for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) @@ -1067,17 +1067,17 @@ bool SpellInfo::NeedsToBeTriggeredByCaster(SpellInfo const* triggeringSpell, uin bool SpellInfo::IsChannelCategorySpell() const { - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (Effects[i].TargetA.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CHANNEL || Effects[i].TargetB.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CHANNEL) - return true; - return false; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (Effects[i].TargetA.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CHANNEL || Effects[i].TargetB.GetSelectionCategory() == TARGET_SELECT_CATEGORY_CHANNEL) + return true; + return false; } bool SpellInfo::IsSelfCast() const { - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (Effects[i].Effect && Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER) - return false; - return true; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (Effects[i].Effect && Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER) + return false; + return true; } bool SpellInfo::IsPassive() const @@ -1129,59 +1129,59 @@ bool SpellInfo::ComputeIsStackableWithRanks() const bool SpellInfo::IsStackableWithRanks() const { - return _isStackableWithRanks; + return _isStackableWithRanks; } void SpellInfo::SetStackableWithRanks(bool val) { - _isStackableWithRanks = val; + _isStackableWithRanks = val; } bool SpellInfo::ComputeIsCritCapable() const { - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - { - switch (Effects[i].Effect) - { - case SPELL_EFFECT_SCHOOL_DAMAGE: - case SPELL_EFFECT_HEALTH_LEECH: - case SPELL_EFFECT_HEAL: - case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: - case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: - case SPELL_EFFECT_WEAPON_DAMAGE: - case SPELL_EFFECT_POWER_BURN: - case SPELL_EFFECT_HEAL_MECHANICAL: - case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: - case SPELL_EFFECT_HEAL_PCT: - return true; - } - } - return false; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + switch (Effects[i].Effect) + { + case SPELL_EFFECT_SCHOOL_DAMAGE: + case SPELL_EFFECT_HEALTH_LEECH: + case SPELL_EFFECT_HEAL: + case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: + case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: + case SPELL_EFFECT_WEAPON_DAMAGE: + case SPELL_EFFECT_POWER_BURN: + case SPELL_EFFECT_HEAL_MECHANICAL: + case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: + case SPELL_EFFECT_HEAL_PCT: + return true; + } + } + return false; } bool SpellInfo::IsCritCapable() const { - return _isCritCapable; + return _isCritCapable; } bool SpellInfo::RequireCooldownInfo() const { - return _requireCooldownInfo; + return _requireCooldownInfo; } void SpellInfo::SetCritCapable(bool val) { - _isCritCapable = val; + _isCritCapable = val; } bool SpellInfo::IsSpellValid() const { - return _isSpellValid; + return _isSpellValid; } void SpellInfo::SetSpellValid(bool val) { - _isSpellValid = val; + _isSpellValid = val; } bool SpellInfo::IsPassiveStackableWithRanks() const @@ -1257,7 +1257,7 @@ bool SpellInfo::IsRangedWeaponSpell() const { return (SpellFamilyName == SPELLFAMILY_HUNTER && !(SpellFamilyFlags[1] & 0x10000000)) // for 53352, cannot find better way || (EquippedItemSubClassMask & ITEM_SUBCLASS_MASK_WEAPON_RANGED) - || (Attributes & SPELL_ATTR0_REQ_AMMO); // Xinef: added + || (Attributes & SPELL_ATTR0_REQ_AMMO); // Xinef: added } bool SpellInfo::IsAutoRepeatRangedSpell() const @@ -1297,8 +1297,8 @@ bool SpellInfo::CanPierceImmuneAura(SpellInfo const* aura) const // these spells (Cyclone for example) can pierce all... if ((AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) - // ...but not these (Divine shield for example) // xinef: banish exception, banish can override banish to cancel itself - && !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY || (aura->Mechanic == MECHANIC_BANISH && (Mechanic != MECHANIC_BANISH || !(AttributesEx2 & SPELL_ATTR2_CANT_TARGET_TAPPED)))))) + // ...but not these (Divine shield for example) // xinef: banish exception, banish can override banish to cancel itself + && !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY || (aura->Mechanic == MECHANIC_BANISH && (Mechanic != MECHANIC_BANISH || !(AttributesEx2 & SPELL_ATTR2_CANT_TARGET_TAPPED)))))) return true; return false; @@ -1306,9 +1306,9 @@ bool SpellInfo::CanPierceImmuneAura(SpellInfo const* aura) const bool SpellInfo::CanDispelAura(SpellInfo const* aura) const { - // Xinef: Passive auras cannot be dispelled - if (aura->IsPassive()) - return false; + // Xinef: Passive auras cannot be dispelled + if (aura->IsPassive()) + return false; // Xinef: At frist we check non-player auras, that should be never dispellable // Xinef: Eg. Mark of the Fallen Champion @@ -1564,171 +1564,171 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a bool SpellInfo::IsStrongerAuraActive(Unit const* caster, Unit const* target) const { - if (!target) - return false; + if (!target) + return false; - // xinef: check spell group - uint32 groupId = sSpellMgr->GetSpellGroup(Id); - if (!groupId) - return false; + // xinef: check spell group + uint32 groupId = sSpellMgr->GetSpellGroup(Id); + if (!groupId) + return false; - SpellGroupSpecialFlags sFlag = sSpellMgr->GetSpellGroupSpecialFlags(Id); - if (sFlag & SPELL_GROUP_SPECIAL_FLAG_SKIP_STRONGER_CHECK) - return false; + SpellGroupSpecialFlags sFlag = sSpellMgr->GetSpellGroupSpecialFlags(Id); + if (sFlag & SPELL_GROUP_SPECIAL_FLAG_SKIP_STRONGER_CHECK) + return false; - for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) - { - // xinef: Skip Empty effects - if (!Effects[i].IsEffect()) - continue; + for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) + { + // xinef: Skip Empty effects + if (!Effects[i].IsEffect()) + continue; - // xinef: if non-aura effect is preset - return false - if (!Effects[i].IsAura()) - return false; + // xinef: if non-aura effect is preset - return false + if (!Effects[i].IsAura()) + return false; - // xinef: aura is periodic - return false - if (Effects[i].Amplitude) - return false; + // xinef: aura is periodic - return false + if (Effects[i].Amplitude) + return false; - // xinef: exclude dummy auras - if (Effects[i].ApplyAuraName == SPELL_AURA_DUMMY) - return false; - } + // xinef: exclude dummy auras + if (Effects[i].ApplyAuraName == SPELL_AURA_DUMMY) + return false; + } - for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) - { - // xinef: skip non-aura efects - if (!Effects[i].IsAura()) - return false; + for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) + { + // xinef: skip non-aura efects + if (!Effects[i].IsAura()) + return false; - Unit::AuraEffectList const& auraList = target->GetAuraEffectsByType((AuraType)Effects[i].ApplyAuraName); - for (Unit::AuraEffectList::const_iterator iter = auraList.begin(); iter != auraList.end(); ++iter) - { - // xinef: aura is not groupped or in different group - uint32 auraGroup = (*iter)->GetAuraGroup(); - if (!auraGroup || auraGroup != groupId) - continue; + Unit::AuraEffectList const& auraList = target->GetAuraEffectsByType((AuraType)Effects[i].ApplyAuraName); + for (Unit::AuraEffectList::const_iterator iter = auraList.begin(); iter != auraList.end(); ++iter) + { + // xinef: aura is not groupped or in different group + uint32 auraGroup = (*iter)->GetAuraGroup(); + if (!auraGroup || auraGroup != groupId) + continue; - // xinef: check priority before effect mask - if (sFlag >= SPELL_GROUP_SPECIAL_FLAG_PRIORITY1) - { - SpellGroupSpecialFlags sFlagCurr = sSpellMgr->GetSpellGroupSpecialFlags((*iter)->GetId()); - if (sFlagCurr >= SPELL_GROUP_SPECIAL_FLAG_PRIORITY1 && sFlagCurr < sFlag) - return true; - } + // xinef: check priority before effect mask + if (sFlag >= SPELL_GROUP_SPECIAL_FLAG_PRIORITY1) + { + SpellGroupSpecialFlags sFlagCurr = sSpellMgr->GetSpellGroupSpecialFlags((*iter)->GetId()); + if (sFlagCurr >= SPELL_GROUP_SPECIAL_FLAG_PRIORITY1 && sFlagCurr < sFlag) + return true; + } - // xinef: check aura effect equal auras only, some auras have different effects on different ranks - check rank also - if (!IsAuraEffectEqual((*iter)->GetSpellInfo()) && !IsRankOf((*iter)->GetSpellInfo())) - continue; + // xinef: check aura effect equal auras only, some auras have different effects on different ranks - check rank also + if (!IsAuraEffectEqual((*iter)->GetSpellInfo()) && !IsRankOf((*iter)->GetSpellInfo())) + continue; - // xinef: misc value mismatches - // xinef: commented, checked above - //if (Effects[i].MiscValue != (*iter)->GetMiscValue()) - // continue; + // xinef: misc value mismatches + // xinef: commented, checked above + //if (Effects[i].MiscValue != (*iter)->GetMiscValue()) + // continue; - // xinef: should not happen, or effect is not active - stronger one is present - AuraApplication* aurApp = (*iter)->GetBase()->GetApplicationOfTarget(target->GetGUID()); - if (!aurApp || !aurApp->IsActive((*iter)->GetEffIndex())) - continue; + // xinef: should not happen, or effect is not active - stronger one is present + AuraApplication* aurApp = (*iter)->GetBase()->GetApplicationOfTarget(target->GetGUID()); + if (!aurApp || !aurApp->IsActive((*iter)->GetEffIndex())) + continue; - // xinef: assume that all spells are either positive or negative, otherwise they should not be in one group - // xinef: take custom values into account + // xinef: assume that all spells are either positive or negative, otherwise they should not be in one group + // xinef: take custom values into account - int32 basePoints = Effects[i].BasePoints; - int32 duration = GetMaxDuration(); + int32 basePoints = Effects[i].BasePoints; + int32 duration = GetMaxDuration(); - // xinef: should have the same id, can be different if spell is triggered - // xinef: have to fix spell mods for triggered spell, turn off current spellmodtakingspell for preparing and restore after - if (Player const* player = caster->GetSpellModOwner()) - if (player->m_spellModTakingSpell && player->m_spellModTakingSpell->m_spellInfo->Id == Id) - basePoints = player->m_spellModTakingSpell->GetSpellValue()->EffectBasePoints[i]; + // xinef: should have the same id, can be different if spell is triggered + // xinef: have to fix spell mods for triggered spell, turn off current spellmodtakingspell for preparing and restore after + if (Player const* player = caster->GetSpellModOwner()) + if (player->m_spellModTakingSpell && player->m_spellModTakingSpell->m_spellInfo->Id == Id) + basePoints = player->m_spellModTakingSpell->GetSpellValue()->EffectBasePoints[i]; - int32 curValue = abs(Effects[i].CalcValue(caster, &basePoints)); - int32 auraValue = (sFlag & SPELL_GROUP_SPECIAL_FLAG_BASE_AMOUNT_CHECK) ? - abs((*iter)->GetSpellInfo()->Effects[(*iter)->GetEffIndex()].CalcValue((*iter)->GetCaster())) : - abs((*iter)->GetAmount()); + int32 curValue = abs(Effects[i].CalcValue(caster, &basePoints)); + int32 auraValue = (sFlag & SPELL_GROUP_SPECIAL_FLAG_BASE_AMOUNT_CHECK) ? + abs((*iter)->GetSpellInfo()->Effects[(*iter)->GetEffIndex()].CalcValue((*iter)->GetCaster())) : + abs((*iter)->GetAmount()); - // xinef: for same spells, divide amount by stack amount - if (Id == (*iter)->GetId()) - auraValue /= (*iter)->GetBase()->GetStackAmount(); + // xinef: for same spells, divide amount by stack amount + if (Id == (*iter)->GetId()) + auraValue /= (*iter)->GetBase()->GetStackAmount(); - if (curValue < auraValue) - return true; + if (curValue < auraValue) + return true; - // xinef: little hack, if current spell is the same as aura spell, asume it is not stronger - // xinef: if values are the same, duration mods should be taken into account but they are almost always passive - if (curValue == auraValue) - { - if (Id == (*iter)->GetId()) - continue; - if (!(*iter)->GetBase()->IsPassive() && duration < (*iter)->GetBase()->GetDuration()) - return true; - } - } - } + // xinef: little hack, if current spell is the same as aura spell, asume it is not stronger + // xinef: if values are the same, duration mods should be taken into account but they are almost always passive + if (curValue == auraValue) + { + if (Id == (*iter)->GetId()) + continue; + if (!(*iter)->GetBase()->IsPassive() && duration < (*iter)->GetBase()->GetDuration()) + return true; + } + } + } - return false; + return false; } bool SpellInfo::IsAuraEffectEqual(SpellInfo const* otherSpellInfo) const { - uint8 matchCount = 0; - uint8 auraCount = 0; - for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) - { - // xinef: skip non-aura efects - if (!Effects[i].IsAura()) - continue; + uint8 matchCount = 0; + uint8 auraCount = 0; + for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) + { + // xinef: skip non-aura efects + if (!Effects[i].IsAura()) + continue; - bool effectFound = false; - for (uint8 j = EFFECT_0; j < MAX_SPELL_EFFECTS; ++j) - { - if (!otherSpellInfo->Effects[j].IsAura()) - continue; - - if (Effects[i].ApplyAuraName != otherSpellInfo->Effects[j].ApplyAuraName || Effects[i].MiscValue != otherSpellInfo->Effects[j].MiscValue) - continue; + bool effectFound = false; + for (uint8 j = EFFECT_0; j < MAX_SPELL_EFFECTS; ++j) + { + if (!otherSpellInfo->Effects[j].IsAura()) + continue; + + if (Effects[i].ApplyAuraName != otherSpellInfo->Effects[j].ApplyAuraName || Effects[i].MiscValue != otherSpellInfo->Effects[j].MiscValue) + continue; - effectFound = true; - break; - } + effectFound = true; + break; + } - if (!effectFound) - return false; - ++matchCount; - } + if (!effectFound) + return false; + ++matchCount; + } - for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) - { - if (Effects[i].IsAura()) - ++auraCount; - if (otherSpellInfo->Effects[i].IsAura()) - ++auraCount; - } + for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i) + { + if (Effects[i].IsAura()) + ++auraCount; + if (otherSpellInfo->Effects[i].IsAura()) + ++auraCount; + } - return matchCount*2 == auraCount; + return matchCount*2 == auraCount; } - + bool SpellInfo::ValidateAttribute6SpellDamageMods(const Unit* caster, const AuraEffect* auraEffect, bool isDot) const { - // Xinef: no attribute - if (!(AttributesEx6 & SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS)) - return true; + // Xinef: no attribute + if (!(AttributesEx6 & SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS)) + return true; - // Xinef we have a hook to decide which auras should profit to the spell, by default no profits - // Xinef: Scourge Strike - Trigger - if (Id == 70890 && auraEffect) - { - const SpellInfo* auraInfo = auraEffect->GetSpellInfo(); - return auraInfo->SpellIconID == 3086 || - (auraInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && (auraInfo->SpellFamilyFlags & flag96(8388608, 64, 16) || auraInfo->SpellIconID == 235 || auraInfo->SpellIconID == 154)); - } - // Xinef: Necrosis, no profits for done and taken - else if (Id == 51460) - return false; + // Xinef we have a hook to decide which auras should profit to the spell, by default no profits + // Xinef: Scourge Strike - Trigger + if (Id == 70890 && auraEffect) + { + const SpellInfo* auraInfo = auraEffect->GetSpellInfo(); + return auraInfo->SpellIconID == 3086 || + (auraInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && (auraInfo->SpellFamilyFlags & flag96(8388608, 64, 16) || auraInfo->SpellIconID == 235 || auraInfo->SpellIconID == 154)); + } + // Xinef: Necrosis, no profits for done and taken + else if (Id == 51460) + return false; - // Xinef: Do not affect dots and auras obtained from items, only affected by self casted auras - return !isDot && auraEffect && (auraEffect->GetAmount() < 0 || (auraEffect->GetCasterGUID() == caster->GetGUID() && auraEffect->GetSpellInfo()->SpellFamilyName == SpellFamilyName)) && !auraEffect->GetBase()->GetCastItemGUID(); + // Xinef: Do not affect dots and auras obtained from items, only affected by self casted auras + return !isDot && auraEffect && (auraEffect->GetAmount() < 0 || (auraEffect->GetCasterGUID() == caster->GetGUID() && auraEffect->GetSpellInfo()->SpellFamilyName == SpellFamilyName)) && !auraEffect->GetBase()->GetCastItemGUID(); } SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* target, bool implicit) const @@ -1745,7 +1745,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta // creature/player specific target checks if (unitTarget) { - // xinef: spells cannot be cast if player is in fake combat also + // xinef: spells cannot be cast if player is in fake combat also if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT && (unitTarget->IsInCombat() || unitTarget->IsPetInCombat())) return SPELL_FAILED_TARGET_AFFECTING_COMBAT; @@ -1872,9 +1872,9 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta if (HasEffect(SPELL_EFFECT_SELF_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT_NEW)) return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED; - // xinef: check if stronger aura is active - if (IsStrongerAuraActive(caster, unitTarget)) - return SPELL_FAILED_AURA_BOUNCED; + // xinef: check if stronger aura is active + if (IsStrongerAuraActive(caster, unitTarget)) + return SPELL_FAILED_AURA_BOUNCED; return SPELL_CAST_OK; } @@ -2004,7 +2004,7 @@ uint32 SpellInfo::GetExplicitTargetMask() const AuraStateType SpellInfo::GetAuraState() const { - return _auraState; + return _auraState; } AuraStateType SpellInfo::LoadAuraState() const @@ -2058,7 +2058,7 @@ AuraStateType SpellInfo::LoadAuraState() const switch (Id) { case 71465: // Divine Surge - case 50241: // Oculus, Drake spell Evasive Maneuvers + case 50241: // Oculus, Drake spell Evasive Maneuvers return AURA_STATE_UNKNOWN22; default: break; @@ -2069,7 +2069,7 @@ AuraStateType SpellInfo::LoadAuraState() const SpellSpecificType SpellInfo::GetSpellSpecific() const { - return _spellSpecific; + return _spellSpecific; } SpellSpecificType SpellInfo::LoadSpellSpecific() const @@ -2196,9 +2196,9 @@ SpellSpecificType SpellInfo::LoadSpellSpecific() const if (SpellFamilyFlags[2] & 0x00000020) return SPELL_SPECIFIC_AURA; - // Illidari Council Paladin (Gathios the Shatterer) - if (Id == 41459 || Id == 41469) - return SPELL_SPECIFIC_SEAL; + // Illidari Council Paladin (Gathios the Shatterer) + if (Id == 41459 || Id == 41469) + return SPELL_SPECIFIC_SEAL; break; } @@ -2288,7 +2288,7 @@ uint32 SpellInfo::CalcCastTime(Unit* caster, Spell* spell) const return 0; int32 castTime = CastTimeEntry->CastTime; - if (Attributes & SPELL_ATTR0_REQ_AMMO && (!IsAutoRepeatRangedSpell())) + if (Attributes & SPELL_ATTR0_REQ_AMMO && (!IsAutoRepeatRangedSpell())) castTime += 500; if (caster) @@ -2552,17 +2552,17 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const case SPELLFAMILY_GENERIC: switch (Id) { - case 11196: // Recently bandaged + case 11196: // Recently bandaged case 29214: // Wrath of the Plaguebringer case 34700: // Allergic Reaction - case 34709: // Shadow Sight (arena stealth detection) + case 34709: // Shadow Sight (arena stealth detection) case 54836: // Wrath of the Plaguebringer - case 58867: // Shaman's Spirit Wolf leap + case 58867: // Shaman's Spirit Wolf leap case 61987: // Avenging Wrath Marker case 61988: // Divine Shield exclude aura - case 72998: // Shadow Prison (Blood Prince Council, ICC Encounter) + case 72998: // Shadow Prison (Blood Prince Council, ICC Encounter) return false; - case 30877: // Tag Murloc + case 30877: // Tag Murloc case 61716: // Rabbit Costume case 61734: // Noblegarden Bunny case 62344: // Fists of Stone @@ -2579,7 +2579,7 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const return true; if (SpellIconID == 242) return true; - // Ignite + // Ignite if (SpellIconID == 45) return true; break; @@ -2593,9 +2593,9 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const default: break; } - // Mind Flay - if (SpellFamilyFlags[0] & 0x800000) - return false; + // Mind Flay + if (SpellFamilyFlags[0] & 0x800000) + return false; break; case SPELLFAMILY_HUNTER: // Aspect of the Viper @@ -2603,30 +2603,30 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const return true; break; case SPELLFAMILY_ROGUE: - // Envenom + // Envenom if (SpellIconID == 2237) - return true; - // Slice and Dice + return true; + // Slice and Dice else if (SpellFamilyFlags[0] & 0x40000) return true; - // Distract - else if (Id == 1725) - return true; + // Distract + else if (Id == 1725) + return true; break; case SPELLFAMILY_SHAMAN: if (Id == 30708) return false; break; - case SPELLFAMILY_PALADIN: - // Forberance - if (Id == 25771) - return false; - break; - case SPELLFAMILY_WARRIOR: - // Intervene, Warrior, considered negative due to triggered spell with threat - if (Id == 3411) - return true; - break; + case SPELLFAMILY_PALADIN: + // Forberance + if (Id == 25771) + return false; + break; + case SPELLFAMILY_WARRIOR: + // Intervene, Warrior, considered negative due to triggered spell with threat + if (Id == 3411) + return true; + break; default: break; } @@ -2668,32 +2668,32 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY: return false; - case SPELL_EFFECT_GAMEOBJECT_DAMAGE: - return false; + case SPELL_EFFECT_GAMEOBJECT_DAMAGE: + return false; - case SPELL_EFFECT_SCHOOL_DAMAGE: - { - bool only = true; - for (int i = EFFECT_0; i <= EFFECT_2; ++i) - { - if (Effects[effIndex].Effect > 0 && Effects[effIndex].Effect != SPELL_EFFECT_SCHOOL_DAMAGE) - only = false; - if (Effects[effIndex].Effect == SPELL_EFFECT_GAMEOBJECT_DAMAGE) - return false; - } - // effects with school damage only cannot be positive... - if (only) - return false; - break; - } - case SPELL_EFFECT_KNOCK_BACK: - case SPELL_EFFECT_KNOCK_BACK_DEST: - { - for (int i = EFFECT_0; i <= EFFECT_2; ++i) - if (Effects[effIndex].Effect == SPELL_EFFECT_GAMEOBJECT_DAMAGE) - return false; - break; - } + case SPELL_EFFECT_SCHOOL_DAMAGE: + { + bool only = true; + for (int i = EFFECT_0; i <= EFFECT_2; ++i) + { + if (Effects[effIndex].Effect > 0 && Effects[effIndex].Effect != SPELL_EFFECT_SCHOOL_DAMAGE) + only = false; + if (Effects[effIndex].Effect == SPELL_EFFECT_GAMEOBJECT_DAMAGE) + return false; + } + // effects with school damage only cannot be positive... + if (only) + return false; + break; + } + case SPELL_EFFECT_KNOCK_BACK: + case SPELL_EFFECT_KNOCK_BACK_DEST: + { + for (int i = EFFECT_0; i <= EFFECT_2; ++i) + if (Effects[effIndex].Effect == SPELL_EFFECT_GAMEOBJECT_DAMAGE) + return false; + break; + } // non-positive aura use case SPELL_EFFECT_APPLY_AURA: diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 98f9216b9..81f6a020b 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -78,7 +78,7 @@ enum SpellTargetSelectionCategories TARGET_SELECT_CATEGORY_NEARBY, TARGET_SELECT_CATEGORY_CONE, TARGET_SELECT_CATEGORY_AREA, - TARGET_SELECT_CATEGORY_TRAJ, + TARGET_SELECT_CATEGORY_TRAJ, }; enum SpellTargetReferenceTypes @@ -117,7 +117,7 @@ enum SpellTargetCheckTypes TARGET_CHECK_RAID, TARGET_CHECK_RAID_CLASS, TARGET_CHECK_PASSENGER, - TARGET_CHECK_CORPSE, + TARGET_CHECK_CORPSE, }; enum SpellTargetDirectionTypes @@ -191,8 +191,8 @@ enum SpellCustomAttributes SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET = 0x00020000, SPELL_ATTR0_CU_ALLOW_INFLIGHT_TARGET = 0x00040000, SPELL_ATTR0_CU_NONE6 = 0x00080000, // UNUSED - SPELL_ATTR0_CU_BINARY_SPELL = 0x00100000, - SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS = 0x00200000, + SPELL_ATTR0_CU_BINARY_SPELL = 0x00100000, + SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS = 0x00200000, SPELL_ATTR0_CU_SINGLE_AURA_STACK = 0x00400000, // pussywizard SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC = 0x00800000, SPELL_ATTR0_CU_ENCOUNTER_REWARD = 0x01000000, // pussywizard @@ -378,13 +378,13 @@ public: uint32 ExplicitTargetMask; SpellChainNode const* ChainEntry; - // Mine - AuraStateType _auraState; - SpellSpecificType _spellSpecific; - bool _isStackableWithRanks; - bool _isSpellValid; - bool _isCritCapable; - bool _requireCooldownInfo; + // Mine + AuraStateType _auraState; + SpellSpecificType _spellSpecific; + bool _isStackableWithRanks; + bool _isSpellValid; + bool _isCritCapable; + bool _requireCooldownInfo; SpellInfo(SpellEntry const* spellEntry); ~SpellInfo(); @@ -419,20 +419,20 @@ public: bool IsTargetingArea() const; bool NeedsExplicitUnitTarget() const; bool NeedsToBeTriggeredByCaster(SpellInfo const* triggeringSpell, uint8 effIndex = MAX_SPELL_EFFECTS) const; - bool IsChannelCategorySpell() const; - bool IsSelfCast() const; + bool IsChannelCategorySpell() const; + bool IsSelfCast() const; bool IsPassive() const; bool IsAutocastable() const; - bool ComputeIsCritCapable() const; - bool IsCritCapable() const; - bool RequireCooldownInfo() const; - void SetCritCapable(bool val); + bool ComputeIsCritCapable() const; + bool IsCritCapable() const; + bool RequireCooldownInfo() const; + void SetCritCapable(bool val); bool ComputeIsStackableWithRanks() const; - bool IsStackableWithRanks() const; - void SetStackableWithRanks(bool val); - bool IsSpellValid() const; - void SetSpellValid(bool val); + bool IsStackableWithRanks() const; + void SetStackableWithRanks(bool val); + bool IsSpellValid() const; + void SetSpellValid(bool val); bool IsPassiveStackableWithRanks() const; bool IsMultiSlotAura() const; bool IsCooldownStartedOnEvent() const; @@ -464,10 +464,10 @@ public: SpellCastResult CheckExplicitTarget(Unit const* caster, WorldObject const* target, Item const* itemTarget = NULL) const; bool CheckTargetCreatureType(Unit const* target) const; - // xinef: aura stacking - bool IsStrongerAuraActive(Unit const* caster, Unit const* target) const; - bool IsAuraEffectEqual(SpellInfo const* otherSpellInfo) const; - bool ValidateAttribute6SpellDamageMods(const Unit* caster, const AuraEffect* auraEffect, bool isDot) const; + // xinef: aura stacking + bool IsStrongerAuraActive(Unit const* caster, Unit const* target) const; + bool IsAuraEffectEqual(SpellInfo const* otherSpellInfo) const; + bool ValidateAttribute6SpellDamageMods(const Unit* caster, const AuraEffect* auraEffect, bool isDot) const; SpellSchoolMask GetSchoolMask() const; uint32 GetAllEffectsMechanicMask() const; @@ -488,7 +488,7 @@ public: int32 GetDuration() const; int32 GetMaxDuration() const; - uint32 GetMaxTicks() const; + uint32 GetMaxTicks() const; uint32 CalcCastTime(Unit* caster = NULL, Spell* spell = NULL) const; uint32 GetRecoveryTime() const; @@ -511,8 +511,8 @@ public: bool _IsPositiveEffect(uint8 effIndex, bool deep) const; bool _IsPositiveSpell() const; static bool _IsPositiveTarget(uint32 targetA, uint32 targetB); - AuraStateType LoadAuraState() const; - SpellSpecificType LoadSpellSpecific() const; + AuraStateType LoadAuraState() const; + SpellSpecificType LoadSpellSpecific() const; // unloading helpers void _UnloadImplicitTargetConditionLists(); }; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 952aebf50..f81799db3 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -79,9 +79,9 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto, // Gnaw else if (spellproto->Id == 47481) return DIMINISHING_CONTROLLED_STUN; - // Screams of the Past - else if (spellproto->Id == 7074) - return DIMINISHING_NONE; + // Screams of the Past + else if (spellproto->Id == 7074) + return DIMINISHING_NONE; break; } // Event spells @@ -112,7 +112,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto, if (spellproto->SpellFamilyFlags[0] & 0x2) return DIMINISHING_LIMITONLY; // Improved Hamstring - else if (spellproto->Id == 23694) + else if (spellproto->Id == 23694) return DIMINISHING_ROOT; // Charge Stun (own diminishing) else if (spellproto->SpellFamilyFlags[0] & 0x01000000) @@ -235,8 +235,8 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto, return DIMINISHING_BANISH; if (mechanic & (1 << MECHANIC_ROOT)) return triggered ? DIMINISHING_ROOT : DIMINISHING_CONTROLLED_ROOT; - if (mechanic & (1 << MECHANIC_HORROR)) - return DIMINISHING_HORROR; + if (mechanic & (1 << MECHANIC_HORROR)) + return DIMINISHING_HORROR; return DIMINISHING_NONE; } @@ -314,7 +314,7 @@ int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellInfo const // Curse of Elements - limit to 120 seconds in PvP else if (spellproto->SpellFamilyFlags[1] & 0x200) return 120 * IN_MILLISECONDS; - // Curse of Exhaustion + // Curse of Exhaustion else if (spellproto->SpellFamilyFlags[0] & 0x400000) return 12 * IN_MILLISECONDS; break; @@ -434,9 +434,9 @@ bool SpellMgr::ComputeIsSpellValid(SpellInfo const *spellInfo, bool msg) bool SpellMgr::IsSpellValid(SpellInfo const *spellInfo) { - if (!spellInfo) - return false; - return spellInfo->IsSpellValid(); + if (!spellInfo) + return false; + return spellInfo->IsSpellValid(); } void DeleteSpellFromAllPlayers(uint32 spellId) @@ -455,7 +455,7 @@ bool SpellMgr::CheckSpellValid(SpellInfo const* spellInfo, uint32 spellId, bool if (!spellInfo) { DeleteSpellFromAllPlayers(spellId); - sLog->outError("Player::%s: Non-existed in SpellStore spell #%u request.", (isTalent ? "AddTalent" : "addSpell"), spellId); + sLog->outError("Player::%s: Non-existed in SpellStore spell #%u request.", (isTalent ? "AddTalent" : "addSpell"), spellId); return false; } @@ -466,7 +466,7 @@ bool SpellMgr::CheckSpellValid(SpellInfo const* spellInfo, uint32 spellId, bool return false; } - return true; + return true; } uint32 SpellMgr::GetSpellDifficultyId(uint32 spellId) const @@ -622,7 +622,7 @@ bool SpellMgr::IsSpellRequiringSpell(uint32 spellid, uint32 req_spellid) const bool SpellMgr::IsAdditionalTalentSpell(uint32 spellId) const { - return mTalentSpellAdditionalSet.find(spellId) != mTalentSpellAdditionalSet.end(); + return mTalentSpellAdditionalSet.find(spellId) != mTalentSpellAdditionalSet.end(); } SpellLearnSkillNode const* SpellMgr::GetSpellLearnSkill(uint32 spell_id) const @@ -644,70 +644,70 @@ SpellTargetPosition const* SpellMgr::GetSpellTargetPosition(uint32 spell_id, Spe SpellGroupStackFlags SpellMgr::GetGroupStackFlags(uint32 groupid) const { - SpellGroupStackMap::const_iterator itr = mSpellGroupStackMap.find(groupid); - if (itr != mSpellGroupStackMap.end()) - return itr->second; + SpellGroupStackMap::const_iterator itr = mSpellGroupStackMap.find(groupid); + if (itr != mSpellGroupStackMap.end()) + return itr->second; - return SPELL_GROUP_STACK_FLAG_NONE; + return SPELL_GROUP_STACK_FLAG_NONE; } uint32 SpellMgr::GetSpellGroup(uint32 spell_id) const { - uint32 first_rank = GetFirstSpellInChain(spell_id); - SpellGroupMap::const_iterator itr = mSpellGroupMap.find(first_rank); - if (itr != mSpellGroupMap.end()) - return itr->second.groupId; + uint32 first_rank = GetFirstSpellInChain(spell_id); + SpellGroupMap::const_iterator itr = mSpellGroupMap.find(first_rank); + if (itr != mSpellGroupMap.end()) + return itr->second.groupId; - return 0; + return 0; } SpellGroupSpecialFlags SpellMgr::GetSpellGroupSpecialFlags(uint32 spell_id) const { - uint32 first_rank = GetFirstSpellInChain(spell_id); - SpellGroupMap::const_iterator itr = mSpellGroupMap.find(first_rank); - if (itr != mSpellGroupMap.end()) - return itr->second.specialFlags; + uint32 first_rank = GetFirstSpellInChain(spell_id); + SpellGroupMap::const_iterator itr = mSpellGroupMap.find(first_rank); + if (itr != mSpellGroupMap.end()) + return itr->second.specialFlags; - return SPELL_GROUP_SPECIAL_FLAG_NONE; + return SPELL_GROUP_SPECIAL_FLAG_NONE; } SpellGroupStackFlags SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2, bool remove, bool areaAura) const { uint32 spellid_1 = spellInfo1->GetFirstRankSpell()->Id; uint32 spellid_2 = spellInfo2->GetFirstRankSpell()->Id; - // xinef: dunno why i added this + // xinef: dunno why i added this if (spellid_1 == spellid_2 && remove && !areaAura) return SPELL_GROUP_STACK_FLAG_NONE; - uint32 groupId = GetSpellGroup(spellid_1); - if (groupId > 0 && groupId == GetSpellGroup(spellid_2)) - { - SpellGroupSpecialFlags flag1 = GetSpellGroupSpecialFlags(spellid_1); - SpellGroupSpecialFlags flag2 = GetSpellGroupSpecialFlags(spellid_2); - SpellGroupStackFlags additionFlag = SPELL_GROUP_STACK_FLAG_NONE; - // xinef: first flags are used for elixir stacking rules - if (flag1 & SPELL_GROUP_SPECIAL_FLAG_STACK_EXCLUSIVE_MAX && flag2 & SPELL_GROUP_SPECIAL_FLAG_STACK_EXCLUSIVE_MAX) - { - if (flag1 & flag2) - return SPELL_GROUP_STACK_FLAG_NEVER_STACK; - } - // xinef: check only flag1 (new spell) - else if (flag1 & SPELL_GROUP_SPECIAL_FLAG_FORCED_STRONGEST) - additionFlag = SPELL_GROUP_STACK_FLAG_FORCED_STRONGEST; - else if (flag2 & SPELL_GROUP_SPECIAL_FLAG_FORCED_STRONGEST) - additionFlag = SPELL_GROUP_STACK_FLAG_FORCED_WEAKEST; + uint32 groupId = GetSpellGroup(spellid_1); + if (groupId > 0 && groupId == GetSpellGroup(spellid_2)) + { + SpellGroupSpecialFlags flag1 = GetSpellGroupSpecialFlags(spellid_1); + SpellGroupSpecialFlags flag2 = GetSpellGroupSpecialFlags(spellid_2); + SpellGroupStackFlags additionFlag = SPELL_GROUP_STACK_FLAG_NONE; + // xinef: first flags are used for elixir stacking rules + if (flag1 & SPELL_GROUP_SPECIAL_FLAG_STACK_EXCLUSIVE_MAX && flag2 & SPELL_GROUP_SPECIAL_FLAG_STACK_EXCLUSIVE_MAX) + { + if (flag1 & flag2) + return SPELL_GROUP_STACK_FLAG_NEVER_STACK; + } + // xinef: check only flag1 (new spell) + else if (flag1 & SPELL_GROUP_SPECIAL_FLAG_FORCED_STRONGEST) + additionFlag = SPELL_GROUP_STACK_FLAG_FORCED_STRONGEST; + else if (flag2 & SPELL_GROUP_SPECIAL_FLAG_FORCED_STRONGEST) + additionFlag = SPELL_GROUP_STACK_FLAG_FORCED_WEAKEST; - return SpellGroupStackFlags(GetGroupStackFlags(groupId) | additionFlag); - } + return SpellGroupStackFlags(GetGroupStackFlags(groupId) | additionFlag); + } - return SPELL_GROUP_STACK_FLAG_NONE; + return SPELL_GROUP_STACK_FLAG_NONE; } void SpellMgr::GetSetOfSpellsInSpellGroupWithFlag(uint32 group_id, SpellGroupSpecialFlags flag, std::set& availableElixirs) const { - for (SpellGroupMap::const_iterator itr = mSpellGroupMap.begin(); itr != mSpellGroupMap.end(); ++itr) - if (itr->second.groupId == group_id && itr->second.specialFlags == flag) - availableElixirs.insert(itr->first); // insert spell id + for (SpellGroupMap::const_iterator itr = mSpellGroupMap.begin(); itr != mSpellGroupMap.end(); ++itr) + if (itr->second.groupId == group_id && itr->second.specialFlags == flag) + availableElixirs.insert(itr->first); // insert spell id } SpellProcEventEntry const* SpellMgr::GetSpellProcEvent(uint32 spellId) const @@ -952,11 +952,11 @@ SpellThreatEntry const* SpellMgr::GetSpellThreatEntry(uint32 spellID) const float SpellMgr::GetSpellMixologyBonus(uint32 spellId) const { - SpellMixologyMap::const_iterator itr = mSpellMixologyMap.find(spellId); - if (itr == mSpellMixologyMap.end()) - return 30.0f; + SpellMixologyMap::const_iterator itr = mSpellMixologyMap.find(spellId); + if (itr == mSpellMixologyMap.end()) + return 30.0f; - return itr->second; + return itr->second; } SkillLineAbilityMapBounds SpellMgr::GetSkillLineAbilityMapBounds(uint32 spell_id) const @@ -1073,12 +1073,12 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return false; if (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY)) return false; - // Xinef: Underbelly elixir - if (player->GetPositionZ() < 637.0f && player->HasAuraType(SPELL_AURA_TRANSFORM)) - return false; + // Xinef: Underbelly elixir + if (player->GetPositionZ() < 637.0f && player->HasAuraType(SPELL_AURA_TRANSFORM)) + return false; break; } - case 58730: // No fly Zone - Wintergrasp + case 58730: // No fly Zone - Wintergrasp { if (!player) return false; @@ -1088,16 +1088,16 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return false; break; } - // xinef: northrend flying mounts - // xinef: NE wisp and spectral gryphon - case 55164: - case 55173: - { - Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()); - return !Bf || Bf->CanFlyIn(); - } - case 57940: // Essence of Wintergrasp OUTSIDE - case 58045: // Essence of Wintergrasp INSIDE + // xinef: northrend flying mounts + // xinef: NE wisp and spectral gryphon + case 55164: + case 55173: + { + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()); + return !Bf || Bf->CanFlyIn(); + } + case 57940: // Essence of Wintergrasp OUTSIDE + case 58045: // Essence of Wintergrasp INSIDE { if (!player) return false; @@ -1122,16 +1122,16 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 if (!player) return false; - Battleground* bg = player->GetBattleground(); - if (!bg || bg->GetBgTypeID() != BATTLEGROUND_IC) - return false; + Battleground* bg = player->GetBattleground(); + if (!bg || bg->GetBgTypeID() != BATTLEGROUND_IC) + return false; uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY; uint8 nodeState = player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H; return bg->ToBattlegroundIC()->GetNodeState(nodeType) == nodeState; } - case 56618: // Horde Controls Factory Phase Shift + case 56618: // Horde Controls Factory Phase Shift case 56617: // Alliance Controls Factory Phase Shift { if (!player) @@ -1149,27 +1149,27 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return spellId == 56618; else if (team == TEAM_ALLIANCE) return spellId == 56617; - break; + break; } - // Hellscream's Warsong - case 73816: - case 73818: - case 73819: - case 73820: - case 73821: - case 73822: - // Strength of Wrynn - case 73762: - case 73824: - case 73825: - case 73826: - case 73827: - case 73828: - if (player) - if (InstanceScript* s = const_cast(player)->GetInstanceScript()) - return s->GetData(251 /*DATA_BUFF_AVAILABLE*/) != 0; - return false; - break; + // Hellscream's Warsong + case 73816: + case 73818: + case 73819: + case 73820: + case 73821: + case 73822: + // Strength of Wrynn + case 73762: + case 73824: + case 73825: + case 73826: + case 73827: + case 73828: + if (player) + if (InstanceScript* s = const_cast(player)->GetInstanceScript()) + return s->GetData(251 /*DATA_BUFF_AVAILABLE*/) != 0; + return false; + break; } return true; @@ -1412,9 +1412,9 @@ void SpellMgr::LoadSpellRequired() mSpellsReqSpell.insert (std::pair(spellReq, spellId)); ++count; - // xinef: fill additionalTalentInfo data, currently Blessing of Sanctuary only - if (GetTalentSpellCost(spellReq) > 0) - mTalentSpellAdditionalSet.insert(spellId); + // xinef: fill additionalTalentInfo data, currently Blessing of Sanctuary only + if (GetTalentSpellCost(spellReq) > 0) + mTalentSpellAdditionalSet.insert(spellId); } while (result->NextRow()); @@ -1587,8 +1587,8 @@ void SpellMgr::LoadSpellGroups() uint32 group_id = fields[0].GetUInt32(); int32 spell_id = fields[1].GetUInt32(); - SpellGroupSpecialFlags specialFlag = (SpellGroupSpecialFlags)fields[2].GetUInt32(); - SpellInfo const* spellInfo = GetSpellInfo(spell_id); + SpellGroupSpecialFlags specialFlag = (SpellGroupSpecialFlags)fields[2].GetUInt32(); + SpellInfo const* spellInfo = GetSpellInfo(spell_id); if (!spellInfo) { @@ -1601,24 +1601,24 @@ void SpellMgr::LoadSpellGroups() continue; } - if (mSpellGroupMap.find(spell_id) != mSpellGroupMap.end()) - { + if (mSpellGroupMap.find(spell_id) != mSpellGroupMap.end()) + { sLog->outErrorDb("Spell %u listed in `spell_group` has more than one group", spell_id); continue; } - if (specialFlag >= SPELL_GROUP_SPECIAL_FLAG_MAX) - { + if (specialFlag >= SPELL_GROUP_SPECIAL_FLAG_MAX) + { sLog->outErrorDb("Spell %u listed in `spell_group` has invalid special flag!", spell_id); continue; } - SpellStackInfo ssi; - ssi.groupId = group_id; - ssi.specialFlags = specialFlag; - mSpellGroupMap[spell_id] = ssi; + SpellStackInfo ssi; + ssi.groupId = group_id; + ssi.specialFlags = specialFlag; + mSpellGroupMap[spell_id] = ssi; - ++count; + ++count; } while (result->NextRow()); @@ -1654,13 +1654,13 @@ void SpellMgr::LoadSpellGroupStackRules() continue; } - bool present = false; - for (SpellGroupMap::const_iterator itr = mSpellGroupMap.begin(); itr != mSpellGroupMap.end(); ++itr) - if (itr->second.groupId == group_id) - { - present = true; - break; - } + bool present = false; + for (SpellGroupMap::const_iterator itr = mSpellGroupMap.begin(); itr != mSpellGroupMap.end(); ++itr) + if (itr->second.groupId == group_id) + { + present = true; + break; + } if (!present) @@ -1710,7 +1710,7 @@ void SpellMgr::LoadSpellProcEvents() SpellInfo const* spellInfo = GetSpellInfo(spellId); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_proc_event` does not exist", spellId); + sLog->outErrorDb("Spell %u listed in `spell_proc_event` does not exist", spellId); continue; } @@ -2125,7 +2125,7 @@ void SpellMgr::LoadEnchantCustomAttr() continue; // TODO: find a better check - // Xinef: commented second part, fixes warlock enchants like firestone, spellstone + // Xinef: commented second part, fixes warlock enchants like firestone, spellstone if (!spellInfo->HasAttribute(SPELL_ATTR2_PRESERVE_ENCHANT_IN_ARENA)/* || !spellInfo->HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT)*/) continue; @@ -2666,8 +2666,8 @@ void SpellMgr::LoadSpellSpecificAndAuraState() spellInfo = mSpellInfoMap[i]; if (!spellInfo) continue; - spellInfo->_spellSpecific = spellInfo->LoadSpellSpecific(); - spellInfo->_auraState = spellInfo->LoadAuraState(); + spellInfo->_spellSpecific = spellInfo->LoadSpellSpecific(); + spellInfo->_auraState = spellInfo->LoadAuraState(); } sLog->outString(">> Loaded spell specific and aura state in %u ms", GetMSTimeDiffToNow(oldMSTime)); @@ -2678,7 +2678,7 @@ void SpellMgr::LoadSpellCustomAttr() { uint32 oldMSTime = getMSTime(); - // xinef: create talent spells set + // xinef: create talent spells set for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); @@ -2687,12 +2687,12 @@ void SpellMgr::LoadSpellCustomAttr() for (uint8 j = 0; j < MAX_TALENT_RANK; j++) if (uint32 spellId = talentInfo->RankID[j]) - if (const SpellInfo* spellInfo = GetSpellInfo(spellId)) - for (uint8 k = 0; k < MAX_SPELL_EFFECTS; ++k) - if (spellInfo->Effects[k].Effect == SPELL_EFFECT_LEARN_SPELL) - if (const SpellInfo* learnSpell = GetSpellInfo(spellInfo->Effects[k].TriggerSpell)) - if (learnSpell->IsRanked() && !learnSpell->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE|SPELL_ATTR0_HIDDEN_CLIENTSIDE))) - mTalentSpellAdditionalSet.insert(learnSpell->Id); + if (const SpellInfo* spellInfo = GetSpellInfo(spellId)) + for (uint8 k = 0; k < MAX_SPELL_EFFECTS; ++k) + if (spellInfo->Effects[k].Effect == SPELL_EFFECT_LEARN_SPELL) + if (const SpellInfo* learnSpell = GetSpellInfo(spellInfo->Effects[k].TriggerSpell)) + if (learnSpell->IsRanked() && !learnSpell->HasAttribute(SpellAttr0(SPELL_ATTR0_PASSIVE|SPELL_ATTR0_HIDDEN_CLIENTSIDE))) + mTalentSpellAdditionalSet.insert(learnSpell->Id); } SpellInfo* spellInfo = NULL; @@ -2791,60 +2791,60 @@ void SpellMgr::LoadSpellCustomAttr() } } - // Xinef: spells ignoring hit result should not be binary - if (!spellInfo->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT)) - { - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (spellInfo->Effects[j].Effect) - { - switch(spellInfo->Effects[j].Effect) - { - case SPELL_EFFECT_SCHOOL_DAMAGE: - case SPELL_EFFECT_WEAPON_DAMAGE: - case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: - case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: - case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: - case SPELL_EFFECT_TRIGGER_SPELL: - case SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE: - continue; - case SPELL_EFFECT_PERSISTENT_AREA_AURA: - case SPELL_EFFECT_APPLY_AURA: - case SPELL_EFFECT_APPLY_AREA_AURA_PARTY: - case SPELL_EFFECT_APPLY_AREA_AURA_RAID: - case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND: - case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY: - case SPELL_EFFECT_APPLY_AREA_AURA_PET: - case SPELL_EFFECT_APPLY_AREA_AURA_OWNER: - if (spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || - spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE_PERCENT || - spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_DUMMY || - spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH || - spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_HEALTH_FUNNEL || - spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DUMMY) - continue; - default: - if (spellInfo->Effects[j].CalcValue() || ((spellInfo->Effects[j].Effect == SPELL_EFFECT_INTERRUPT_CAST || spellInfo->HasAttribute(SPELL_ATTR0_CU_AURA_CC)) && !spellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))) - if (spellInfo->Id != 69649 && spellInfo->Id != 71056 && spellInfo->Id != 71057 && spellInfo->Id != 71058 && spellInfo->Id != 73061 && spellInfo->Id != 73062 && spellInfo->Id != 73063 && spellInfo->Id != 73064) // Sindragosa Frost Breath - if (spellInfo->SpellFamilyName != SPELLFAMILY_MAGE || !(spellInfo->SpellFamilyFlags[0] & 0x20)) // frostbolt - if (spellInfo->Id != 55095) // frost fever - if (spellInfo->SpellFamilyName != SPELLFAMILY_WARLOCK || !(spellInfo->SpellFamilyFlags[1] & 0x40000)) // Haunt - { - spellInfo->AttributesCu |= SPELL_ATTR0_CU_BINARY_SPELL; - break; - } - continue; - } - } - } - } + // Xinef: spells ignoring hit result should not be binary + if (!spellInfo->HasAttribute(SPELL_ATTR3_IGNORE_HIT_RESULT)) + { + for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) + { + if (spellInfo->Effects[j].Effect) + { + switch(spellInfo->Effects[j].Effect) + { + case SPELL_EFFECT_SCHOOL_DAMAGE: + case SPELL_EFFECT_WEAPON_DAMAGE: + case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: + case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: + case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: + case SPELL_EFFECT_TRIGGER_SPELL: + case SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE: + continue; + case SPELL_EFFECT_PERSISTENT_AREA_AURA: + case SPELL_EFFECT_APPLY_AURA: + case SPELL_EFFECT_APPLY_AREA_AURA_PARTY: + case SPELL_EFFECT_APPLY_AREA_AURA_RAID: + case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND: + case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY: + case SPELL_EFFECT_APPLY_AREA_AURA_PET: + case SPELL_EFFECT_APPLY_AREA_AURA_OWNER: + if (spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || + spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE_PERCENT || + spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_DUMMY || + spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH || + spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_HEALTH_FUNNEL || + spellInfo->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_DUMMY) + continue; + default: + if (spellInfo->Effects[j].CalcValue() || ((spellInfo->Effects[j].Effect == SPELL_EFFECT_INTERRUPT_CAST || spellInfo->HasAttribute(SPELL_ATTR0_CU_AURA_CC)) && !spellInfo->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))) + if (spellInfo->Id != 69649 && spellInfo->Id != 71056 && spellInfo->Id != 71057 && spellInfo->Id != 71058 && spellInfo->Id != 73061 && spellInfo->Id != 73062 && spellInfo->Id != 73063 && spellInfo->Id != 73064) // Sindragosa Frost Breath + if (spellInfo->SpellFamilyName != SPELLFAMILY_MAGE || !(spellInfo->SpellFamilyFlags[0] & 0x20)) // frostbolt + if (spellInfo->Id != 55095) // frost fever + if (spellInfo->SpellFamilyName != SPELLFAMILY_WARLOCK || !(spellInfo->SpellFamilyFlags[1] & 0x40000)) // Haunt + { + spellInfo->AttributesCu |= SPELL_ATTR0_CU_BINARY_SPELL; + break; + } + continue; + } + } + } + } - // pussywizard: - if ((spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL) && (spellInfo->SchoolMask & SPELL_SCHOOL_MASK_MAGIC)) - { - spellInfo->SchoolMask &= ~SPELL_SCHOOL_MASK_NORMAL; - spellInfo->AttributesCu |= SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC; - } + // pussywizard: + if ((spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL) && (spellInfo->SchoolMask & SPELL_SCHOOL_MASK_MAGIC)) + { + spellInfo->SchoolMask &= ~SPELL_SCHOOL_MASK_NORMAL; + spellInfo->AttributesCu |= SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC; + } if (!spellInfo->_IsPositiveEffect(EFFECT_0, false)) spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF0; @@ -2860,10 +2860,10 @@ void SpellMgr::LoadSpellCustomAttr() switch (spellInfo->Id) { - // Xinef: additional spells which should be binary - case 45145: // Snake Trap Effect - spellInfo->AttributesCu |= SPELL_ATTR0_CU_BINARY_SPELL; - break; + // Xinef: additional spells which should be binary + case 45145: // Snake Trap Effect + spellInfo->AttributesCu |= SPELL_ATTR0_CU_BINARY_SPELL; + break; case 1776: // Gouge case 1777: case 8629: @@ -2939,7 +2939,7 @@ void SpellMgr::LoadSpellCustomAttr() case 23959: // Test Stab R50 case 24825: // Test Backstab case 58563: // Assassinate Restless Lookout - case 63124: // quest There's Something About the Squire (13654) + case 63124: // quest There's Something About the Squire (13654) spellInfo->AttributesCu |= SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET; break; case 26029: // Dark Glare @@ -2951,14 +2951,14 @@ void SpellMgr::LoadSpellCustomAttr() case 73789: // Pain and Suffering case 73790: // Pain and Suffering case 63293: // Mimiron - spinning damage - case 68873: // Wailing Souls - case 70324: // Wailing Souls - case 64619: // Ulduar, Mimiron, Emergency Fire Bot, Water Spray + case 68873: // Wailing Souls + case 70324: // Wailing Souls + case 64619: // Ulduar, Mimiron, Emergency Fire Bot, Water Spray spellInfo->AttributesCu |= SPELL_ATTR0_CU_CONE_LINE; break; - case 58690: // Cyanigosa, Tail Sweep - case 59283: // Cyanigosa, Tail Sweep - spellInfo->AttributesCu |= SPELL_ATTR0_CU_CONE_BACK; + case 58690: // Cyanigosa, Tail Sweep + case 59283: // Cyanigosa, Tail Sweep + spellInfo->AttributesCu |= SPELL_ATTR0_CU_CONE_BACK; break; case 24340: // Meteor case 26558: // Meteor @@ -2983,10 +2983,10 @@ void SpellMgr::LoadSpellCustomAttr() case 72624: // Ooze Eruption case 72625: // Ooze Eruption // ONLY SPELLS WITH SPELLFAMILY_GENERIC and EFFECT_SCHOOL_DAMAGE, OR WEAPON_DMG_X - case 66809: // Meteor Fists - case 67331: // Meteor Fists - case 66765: // Meteor Fists - case 67333: // Meteor Fists + case 66809: // Meteor Fists + case 67331: // Meteor Fists + case 66765: // Meteor Fists + case 67333: // Meteor Fists spellInfo->AttributesCu |= SPELL_ATTR0_CU_SHARE_DAMAGE; break; case 18500: // Wing Buffet @@ -3000,16 +3000,16 @@ void SpellMgr::LoadSpellCustomAttr() case 65239: // Machine Gun case 69293: // Wing Buffet case 74439: // Machine Gun - // Trial of the Crusader, Jaraxxus, Shivan Slash - case 66378: - case 67097: - case 67098: - case 67099: - // Trial of the Crusader, Anub'arak, Impale - case 65919: - case 67858: - case 67859: - case 67860: + // Trial of the Crusader, Jaraxxus, Shivan Slash + case 66378: + case 67097: + case 67098: + case 67099: + // Trial of the Crusader, Anub'arak, Impale + case 65919: + case 67858: + case 67859: + case 67860: case 63278: // Mark of the Faceless (General Vezax) case 64125: // Ulduar, Yogg-Saron, Squeeze case 64126: // Ulduar, Yogg-Saron, Squeeze @@ -3034,12 +3034,12 @@ void SpellMgr::LoadSpellCustomAttr() case 72444: // Mark of the Fallen Champion (Deathbringer Saurfang) case 72445: // Mark of the Fallen Champion (Deathbringer Saurfang) case 72446: // Mark of the Fallen Champion (Deathbringer Saurfang) - case 72409: // Rune of Blood (Deathbringer Saurfang) - case 72447: // Rune of Blood (Deathbringer Saurfang) - case 72448: // Rune of Blood (Deathbringer Saurfang) - case 72449: // Rune of Blood (Deathbringer Saurfang) - case 49882: // Leviroth Self-Impale - case 62775: // Ulduar: XT-002 Tympanic Tamparum + case 72409: // Rune of Blood (Deathbringer Saurfang) + case 72447: // Rune of Blood (Deathbringer Saurfang) + case 72448: // Rune of Blood (Deathbringer Saurfang) + case 72449: // Rune of Blood (Deathbringer Saurfang) + case 49882: // Leviroth Self-Impale + case 62775: // Ulduar: XT-002 Tympanic Tamparum spellInfo->AttributesCu |= SPELL_ATTR0_CU_IGNORE_ARMOR; break; case 64422: // Sonic Screech (Auriaya) @@ -3047,92 +3047,92 @@ void SpellMgr::LoadSpellCustomAttr() spellInfo->AttributesCu |= SPELL_ATTR0_CU_IGNORE_ARMOR; break; case 72293: // Mark of the Fallen Champion (Deathbringer Saurfang) - case 72347: // Lock Players and Tap Chest (Gunship Battle) + case 72347: // Lock Players and Tap Chest (Gunship Battle) spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF0; break; default: break; - case 63675: // Improved Devouring Plague - case 17962: // Conflagrate - case 32593: // Earth Shield aura - case 32594: // Earth Shield aura - case 49283: // Earth Shield aura - case 49284: // Earth Shield aura - case 50526: // Wandering Plague - case 53353: // Chimera Shot - Serpent trigger - case 52752: // Ancestral Awakening Heal - spellInfo->AttributesCu |= SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS; - break; - case 65280: // Ulduar, Hodir, Singed - case 65775: // Anub'arak, Swarm Scarab, Acid-Drenched Mandibles - case 67861: - case 67862: - case 67863: - case 67721: // Anub'arak, Nerubian Burrower, Expose Weakness - case 64638: // Ulduar, Winter Jormungar, Acidic Bite - case 71157: // Icecrown Citadel, Plagued Zombie, Infected Wound - case 72963: // Icecrown Citadel, Valithria Dreamwalker, Flesh Rot (Rot Worm) - case 72964: - case 72965: - case 72966: - case 72465: // Icecrown Citadel, Sindragosa, Respite for a Tormented Soul (weekly quest) - case 45271: // Sunwell, Eredar Twins encounter, Dark Strike - case 45347: // Sunwell, Eredar Twins encounter, Dark Touched - case 45348: // Sunwell, Eredar Twins encounter, Flame Touched - case 35859: // The Eye, Nether Vapor - case 40520: // Black Temple, Shade Soul Channel - case 40327: // Black Temple, Atrophy - case 38449: // Serpentshrine Cavern, Blessing of the Tides - case 38044: // Serpentshrine Cavern, Surge - case 74507: // Ruby Sanctum, Siphoned Might - case 49381: // Drak'tharon Keep, Consume - case 59805: // Drak'tharon Keep, Consume - case 55093: // Gundrak, Grip of Slad'ran - case 30659: // Hellfire Ramparts, Fel Infusion - case 54314: // Azjol'Nerub Drain Power - case 59354: // Azjol'Nerub Drain Power - case 34655: // Snake Trap, Deadly Poison - case 11971: // Sunder Armor - case 58567: // Player Sunder Armor - spellInfo->AttributesCu |= SPELL_ATTR0_CU_SINGLE_AURA_STACK; - break; - case 43138: // North Fleet Reservist Kill Credit - spellInfo->AttributesCu |= SPELL_ATTR0_CU_ALLOW_INFLIGHT_TARGET; - break; + case 63675: // Improved Devouring Plague + case 17962: // Conflagrate + case 32593: // Earth Shield aura + case 32594: // Earth Shield aura + case 49283: // Earth Shield aura + case 49284: // Earth Shield aura + case 50526: // Wandering Plague + case 53353: // Chimera Shot - Serpent trigger + case 52752: // Ancestral Awakening Heal + spellInfo->AttributesCu |= SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS; + break; + case 65280: // Ulduar, Hodir, Singed + case 65775: // Anub'arak, Swarm Scarab, Acid-Drenched Mandibles + case 67861: + case 67862: + case 67863: + case 67721: // Anub'arak, Nerubian Burrower, Expose Weakness + case 64638: // Ulduar, Winter Jormungar, Acidic Bite + case 71157: // Icecrown Citadel, Plagued Zombie, Infected Wound + case 72963: // Icecrown Citadel, Valithria Dreamwalker, Flesh Rot (Rot Worm) + case 72964: + case 72965: + case 72966: + case 72465: // Icecrown Citadel, Sindragosa, Respite for a Tormented Soul (weekly quest) + case 45271: // Sunwell, Eredar Twins encounter, Dark Strike + case 45347: // Sunwell, Eredar Twins encounter, Dark Touched + case 45348: // Sunwell, Eredar Twins encounter, Flame Touched + case 35859: // The Eye, Nether Vapor + case 40520: // Black Temple, Shade Soul Channel + case 40327: // Black Temple, Atrophy + case 38449: // Serpentshrine Cavern, Blessing of the Tides + case 38044: // Serpentshrine Cavern, Surge + case 74507: // Ruby Sanctum, Siphoned Might + case 49381: // Drak'tharon Keep, Consume + case 59805: // Drak'tharon Keep, Consume + case 55093: // Gundrak, Grip of Slad'ran + case 30659: // Hellfire Ramparts, Fel Infusion + case 54314: // Azjol'Nerub Drain Power + case 59354: // Azjol'Nerub Drain Power + case 34655: // Snake Trap, Deadly Poison + case 11971: // Sunder Armor + case 58567: // Player Sunder Armor + spellInfo->AttributesCu |= SPELL_ATTR0_CU_SINGLE_AURA_STACK; + break; + case 43138: // North Fleet Reservist Kill Credit + spellInfo->AttributesCu |= SPELL_ATTR0_CU_ALLOW_INFLIGHT_TARGET; + break; - // Xinef: NOT CUSTOM, cant add in DBC CORRECTION because i need to swap effects, too much work to do there - // Envenom - case 32645: - case 32684: - case 57992: - case 57993: - { - SpellEffectInfo info = spellInfo->Effects[EFFECT_0]; - spellInfo->Effects[EFFECT_0] = spellInfo->Effects[EFFECT_2]; - spellInfo->Effects[EFFECT_2] = info; - break; - } + // Xinef: NOT CUSTOM, cant add in DBC CORRECTION because i need to swap effects, too much work to do there + // Envenom + case 32645: + case 32684: + case 57992: + case 57993: + { + SpellEffectInfo info = spellInfo->Effects[EFFECT_0]; + spellInfo->Effects[EFFECT_0] = spellInfo->Effects[EFFECT_2]; + spellInfo->Effects[EFFECT_2] = info; + break; + } - // Xinef: Cooldown overwrites - // Jotunheim Rapid-Fire Harpoon: Energy Reserve - case 56585: - spellInfo->RecoveryTime = 30000; - spellInfo->_requireCooldownInfo = true; - break; - // Jotunheim Rapid-Fire Harpoon: Rapid-Fire Harpoon - case 56570: - spellInfo->RecoveryTime = 200; - break; - // Burst of Speed - case 57493: - spellInfo->RecoveryTime = 60000; - spellInfo->_requireCooldownInfo = true; - break; - // Strafe Jotunheim Building - case 7769: - spellInfo->RecoveryTime = 1500; - spellInfo->_requireCooldownInfo = true; - break; + // Xinef: Cooldown overwrites + // Jotunheim Rapid-Fire Harpoon: Energy Reserve + case 56585: + spellInfo->RecoveryTime = 30000; + spellInfo->_requireCooldownInfo = true; + break; + // Jotunheim Rapid-Fire Harpoon: Rapid-Fire Harpoon + case 56570: + spellInfo->RecoveryTime = 200; + break; + // Burst of Speed + case 57493: + spellInfo->RecoveryTime = 60000; + spellInfo->_requireCooldownInfo = true; + break; + // Strafe Jotunheim Building + case 7769: + spellInfo->RecoveryTime = 1500; + spellInfo->_requireCooldownInfo = true; + break; } switch (spellInfo->SpellFamilyName) @@ -3147,49 +3147,49 @@ void SpellMgr::LoadSpellCustomAttr() if (spellInfo->SpellFamilyFlags[0] & 0x8) spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC; break; - case SPELLFAMILY_GENERIC: - // Stoneclaw Totem effect - if(spellInfo->Id == 5729) - spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC; - break; + case SPELLFAMILY_GENERIC: + // Stoneclaw Totem effect + if(spellInfo->Id == 5729) + spellInfo->AttributesCu |= SPELL_ATTR0_CU_AURA_CC; + break; default: break; } } - // Xinef: addition for binary spells, ommit spells triggering other spells - for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) + // Xinef: addition for binary spells, ommit spells triggering other spells + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { spellInfo = mSpellInfoMap[i]; if (!spellInfo) continue; - if (!(spellInfo->AttributesCu & SPELL_ATTR0_CU_BINARY_SPELL)) - continue; + if (!(spellInfo->AttributesCu & SPELL_ATTR0_CU_BINARY_SPELL)) + continue; - bool allNonBinary = true; - bool overrideAttr = false; - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) + bool allNonBinary = true; + bool overrideAttr = false; + for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) { - if (spellInfo->Effects[j].ApplyAuraName && spellInfo->Effects[j].TriggerSpell) - { - switch(spellInfo->Effects[j].ApplyAuraName) - { - case SPELL_AURA_PERIODIC_TRIGGER_SPELL: - case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: - if (SpellInfo const* triggerSpell = sSpellMgr->GetSpellInfo(spellInfo->Effects[j].TriggerSpell)) - { - overrideAttr = true; - if (triggerSpell->AttributesCu & SPELL_ATTR0_CU_BINARY_SPELL) - allNonBinary = false; - } - } - } - } + if (spellInfo->Effects[j].ApplyAuraName && spellInfo->Effects[j].TriggerSpell) + { + switch(spellInfo->Effects[j].ApplyAuraName) + { + case SPELL_AURA_PERIODIC_TRIGGER_SPELL: + case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: + if (SpellInfo const* triggerSpell = sSpellMgr->GetSpellInfo(spellInfo->Effects[j].TriggerSpell)) + { + overrideAttr = true; + if (triggerSpell->AttributesCu & SPELL_ATTR0_CU_BINARY_SPELL) + allNonBinary = false; + } + } + } + } - if (overrideAttr && allNonBinary) - spellInfo->AttributesCu &= ~SPELL_ATTR0_CU_BINARY_SPELL; - } + if (overrideAttr && allNonBinary) + spellInfo->AttributesCu &= ~SPELL_ATTR0_CU_BINARY_SPELL; + } CreatureAI::FillAISpellInfo(); @@ -3222,16 +3222,16 @@ void SpellMgr::LoadDbcDataCorrections() break; } - // Xinef: i hope this will fix the problem with not working resurrection - if (spellInfo->Effect[j] == SPELL_EFFECT_SELF_RESURRECT) - spellInfo->EffectImplicitTargetA[j] = TARGET_UNIT_CASTER; + // Xinef: i hope this will fix the problem with not working resurrection + if (spellInfo->Effect[j] == SPELL_EFFECT_SELF_RESURRECT) + spellInfo->EffectImplicitTargetA[j] = TARGET_UNIT_CASTER; } - // Xinef: Fix range for trajectories and triggered spells - for (uint8 j = 0; j < 3; ++j) - if (spellInfo->rangeIndex == 1 && (spellInfo->EffectImplicitTargetA[j] == TARGET_DEST_TRAJ || spellInfo->EffectImplicitTargetB[j] == TARGET_DEST_TRAJ)) - if (SpellEntry* spellInfo2 = (SpellEntry*)sSpellStore.LookupEntry(spellInfo->EffectTriggerSpell[j])) - spellInfo2->rangeIndex = 187; // 300yd + // Xinef: Fix range for trajectories and triggered spells + for (uint8 j = 0; j < 3; ++j) + if (spellInfo->rangeIndex == 1 && (spellInfo->EffectImplicitTargetA[j] == TARGET_DEST_TRAJ || spellInfo->EffectImplicitTargetB[j] == TARGET_DEST_TRAJ)) + if (SpellEntry* spellInfo2 = (SpellEntry*)sSpellStore.LookupEntry(spellInfo->EffectTriggerSpell[j])) + spellInfo2->rangeIndex = 187; // 300yd if (spellInfo->activeIconID == 2158) // flight spellInfo->Attributes |= SPELL_ATTR0_PASSIVE; @@ -3239,11 +3239,11 @@ void SpellMgr::LoadDbcDataCorrections() switch (spellInfo->Id) { case 63026: // Force Cast (HACK: Target shouldn't be changed) - case 63137: // Force Cast (HACK: Target shouldn't be changed; summon position should be untied from spell destination) - spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_DEST_DB; + case 63137: // Force Cast (HACK: Target shouldn't be changed; summon position should be untied from spell destination) + spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_DEST_DB; break; - case 53096: // Quetz'lun's Judgment - case 70743: // AoD Special + case 53096: // Quetz'lun's Judgment + case 70743: // AoD Special case 70614: // AoD Special - Vegard spellInfo->MaxAffectedTargets = 1; break; @@ -3303,7 +3303,7 @@ void SpellMgr::LoadDbcDataCorrections() case 36327: // Shoot Arcane Explosion Arrow spellInfo->MaxAffectedTargets = 1; break; - case 36384: // Skartax Purple Beam + case 36384: // Skartax Purple Beam spellInfo->MaxAffectedTargets = 2; break; case 37790: // Spread Shot @@ -3343,9 +3343,9 @@ void SpellMgr::LoadDbcDataCorrections() case 18820: // Insight spellInfo->procCharges = 1; break; - case 53390: // Tidal Wave - spellInfo->procCharges = 2; - break; + case 53390: // Tidal Wave + spellInfo->procCharges = 2; + break; case 37408: // Oscillation Field spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; break; @@ -3355,7 +3355,7 @@ void SpellMgr::LoadDbcDataCorrections() case 51852: // The Eye of Acherus (no spawn in phase 2 in db) spellInfo->EffectMiscValue[0] |= 1; break; - case 51912: // Crafty's Ultra-Advanced Proto-Typical Shortening Blaster + case 51912: // Crafty's Ultra-Advanced Proto-Typical Shortening Blaster spellInfo->EffectAmplitude[0] = 3000; break; case 29809: // Desecration Arm - 36 instead of 37 - typo? :/ @@ -3372,7 +3372,7 @@ void SpellMgr::LoadDbcDataCorrections() case 48422: spellInfo->Stances = 1 << (FORM_TREE - 1); break; - case 51466: // Elemental Oath (Rank 1) + case 51466: // Elemental Oath (Rank 1) case 51470: // Elemental Oath (Rank 2) spellInfo->Effect[EFFECT_1] = SPELL_EFFECT_APPLY_AURA; spellInfo->EffectApplyAuraName[EFFECT_1] = SPELL_AURA_ADD_FLAT_MODIFIER; @@ -3395,7 +3395,7 @@ void SpellMgr::LoadDbcDataCorrections() case 51726: spellInfo->SpellFamilyFlags[2] = 0x10; spellInfo->EffectApplyAuraName[1] = SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN; - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; break; case 41013: // Parasitic Shadowfiend Passive spellInfo->EffectApplyAuraName[0] = SPELL_AURA_DUMMY; // proc debuff, and summon infinite fiends @@ -3420,7 +3420,7 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectBasePoints[EFFECT_1] = -6; // -5% break; case 63675: // Improved Devouring Plague - spellInfo->EffectBonusMultiplier[0] = 0; + spellInfo->EffectBonusMultiplier[0] = 0; spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; break; case 8145: // Tremor Totem (instant pulse) @@ -3468,18 +3468,18 @@ void SpellMgr::LoadDbcDataCorrections() case 45602: // Ride Carpet spellInfo->EffectBasePoints[EFFECT_0] = 0; // force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)" break; - case 64745: // Item - Death Knight T8 Tank 4P Bonus + case 64745: // Item - Death Knight T8 Tank 4P Bonus case 64936: // Item - Warrior T8 Protection 4P Bonus - spellInfo->EffectBasePoints[EFFECT_0] = 100; // 100% chance of procc'ing, not -10% (chance calculated in PrepareTriggersExecutedOnHit) + spellInfo->EffectBasePoints[EFFECT_0] = 100; // 100% chance of procc'ing, not -10% (chance calculated in PrepareTriggersExecutedOnHit) break; case 61719: // Easter Lay Noblegarden Egg Aura - Interrupt flags copied from aura which this aura is linked with spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE; break; - case 51640: // spell for item The Flag of Ownership (38578) - spellInfo->AttributesEx3 |= SPELL_ATTR3_ONLY_TARGET_PLAYERS; - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_DEAD; - spellInfo->MaxAffectedTargets = 1; - break; + case 51640: // spell for item The Flag of Ownership (38578) + spellInfo->AttributesEx3 |= SPELL_ATTR3_ONLY_TARGET_PLAYERS; + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_DEAD; + spellInfo->MaxAffectedTargets = 1; + break; case 34471: // The Beast Within spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_CONFUSED | SPELL_ATTR5_USABLE_WHILE_FEARED | SPELL_ATTR5_USABLE_WHILE_STUNNED; break; @@ -3495,29 +3495,29 @@ void SpellMgr::LoadDbcDataCorrections() break; case 24314: // Threatening Gaze spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CAST | AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_JUMP; - break; + break; - ///////////////////////////////////////////// - /////////////////CLASS SPELLS//////////////// - ///////////////////////////////////////////// + ///////////////////////////////////////////// + /////////////////CLASS SPELLS//////////////// + ///////////////////////////////////////////// - ///////////////////////////////// - ///// PALADIN - ///////////////////////////////// - // Heart of the Crusader - case 20335: - case 20336: - case 20337: - if (spellInfo->Id == 20335) - spellInfo->EffectTriggerSpell[0] = 21183; - else if (spellInfo->Id == 20336) - spellInfo->EffectTriggerSpell[0] = 54498; - else - spellInfo->EffectTriggerSpell[0] = 54499; + ///////////////////////////////// + ///// PALADIN + ///////////////////////////////// + // Heart of the Crusader + case 20335: + case 20336: + case 20337: + if (spellInfo->Id == 20335) + spellInfo->EffectTriggerSpell[0] = 21183; + else if (spellInfo->Id == 20336) + spellInfo->EffectTriggerSpell[0] = 54498; + else + spellInfo->EffectTriggerSpell[0] = 54499; spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PROC_TRIGGER_SPELL; break; - // Bleh, need to change FamilyFlags :/ (have the same as original aura - bad!) + // Bleh, need to change FamilyFlags :/ (have the same as original aura - bad!) case 63510: spellInfo->SpellFamilyFlags[0] = 0; spellInfo->SpellFamilyFlags[2] = 0x4000000; @@ -3529,7 +3529,7 @@ void SpellMgr::LoadDbcDataCorrections() case 63531: spellInfo->SpellFamilyFlags[0] = 0; spellInfo->SpellFamilyFlags[2] = 0x8000000; - break; + break; // And affecting spells case 20138: case 20139: @@ -3552,234 +3552,234 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectSpellClassMask[0][2] = 0x8000000; break; case 31869:// Sanctified Retribution - spellInfo->EffectSpellClassMask[0][0] = 0; + spellInfo->EffectSpellClassMask[0][0] = 0; spellInfo->EffectSpellClassMask[0][2] = 0x8000000; break; - // Judgements Facing - case 20271: - case 53407: - case 53408: - spellInfo->FacingCasterFlags |= SPELL_FACING_FLAG_INFRONT; - break; - // Seal of Light trigger - case 20167: - spellInfo->spellLevel = 0; - spellInfo->baseLevel = 0; - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - break; - // Light's Beacon, Beacon of Light - case 53651: - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; - break; - // Hand of Reckoning - case 62124: - spellInfo->AttributesEx |= SPELL_ATTR1_CANT_BE_REDIRECTED; - break; - // Redemption - case 7328: - case 10322: - case 10324: - case 20772: - case 20773: - case 48949: - case 48950: - spellInfo->SpellFamilyName = SPELLFAMILY_PALADIN; - break; - // hack for seal of light and few spells, judgement consists of few single casts and each of them can proc - // some spell, base one has disabled proc flag but those dont have this flag - case 20184: - case 20185: - case 20186: - case 68055: - spellInfo->AttributesEx3 |= SPELL_ATTR3_CANT_TRIGGER_PROC; - break; - // Blessing of sanctuary stats - case 67480: - spellInfo->EffectMiscValue[0] = -1; - spellInfo->SpellFamilyName = SPELLFAMILY_UNK1; // allows stacking - spellInfo->EffectApplyAuraName[1] = SPELL_AURA_DUMMY; // just a marker - break; - // Seal of Command trigger - case 20424: - spellInfo->AttributesEx3 &= ~SPELL_ATTR3_CANT_TRIGGER_PROC; - break; - // Glyph of Holy Light, Damage Class should be magic - case 54968: - // Beacon of Light heal, Damage Class should be magic - case 53652: - case 53654: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - break; + // Judgements Facing + case 20271: + case 53407: + case 53408: + spellInfo->FacingCasterFlags |= SPELL_FACING_FLAG_INFRONT; + break; + // Seal of Light trigger + case 20167: + spellInfo->spellLevel = 0; + spellInfo->baseLevel = 0; + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + break; + // Light's Beacon, Beacon of Light + case 53651: + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; + // Hand of Reckoning + case 62124: + spellInfo->AttributesEx |= SPELL_ATTR1_CANT_BE_REDIRECTED; + break; + // Redemption + case 7328: + case 10322: + case 10324: + case 20772: + case 20773: + case 48949: + case 48950: + spellInfo->SpellFamilyName = SPELLFAMILY_PALADIN; + break; + // hack for seal of light and few spells, judgement consists of few single casts and each of them can proc + // some spell, base one has disabled proc flag but those dont have this flag + case 20184: + case 20185: + case 20186: + case 68055: + spellInfo->AttributesEx3 |= SPELL_ATTR3_CANT_TRIGGER_PROC; + break; + // Blessing of sanctuary stats + case 67480: + spellInfo->EffectMiscValue[0] = -1; + spellInfo->SpellFamilyName = SPELLFAMILY_UNK1; // allows stacking + spellInfo->EffectApplyAuraName[1] = SPELL_AURA_DUMMY; // just a marker + break; + // Seal of Command trigger + case 20424: + spellInfo->AttributesEx3 &= ~SPELL_ATTR3_CANT_TRIGGER_PROC; + break; + // Glyph of Holy Light, Damage Class should be magic + case 54968: + // Beacon of Light heal, Damage Class should be magic + case 53652: + case 53654: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + break; - ///////////////////////////////// - ///// HUNTER - ///////////////////////////////// - // Furious Howl - case 64491: - case 64492: - case 64493: - case 64494: - case 64495: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_MASTER; - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_CASTER; - spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_MASTER; - break; - // Call of the Wild - case 53434: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_MASTER; - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_MASTER; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_CASTER; - spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_CASTER; - break; - // Wild Hunt - case 62758: - case 62762: - spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA; - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_DUMMY; - spellInfo->Effect[1] = SPELL_EFFECT_APPLY_AURA; - spellInfo->EffectApplyAuraName[1] = SPELL_AURA_DUMMY; - break; - // Intervene + ///////////////////////////////// + ///// HUNTER + ///////////////////////////////// + // Furious Howl + case 64491: + case 64492: + case 64493: + case 64494: + case 64495: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_MASTER; + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_CASTER; + spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_MASTER; + break; + // Call of the Wild + case 53434: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_MASTER; + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_MASTER; + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_CASTER; + spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_CASTER; + break; + // Wild Hunt + case 62758: + case 62762: + spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA; + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_DUMMY; + spellInfo->Effect[1] = SPELL_EFFECT_APPLY_AURA; + spellInfo->EffectApplyAuraName[1] = SPELL_AURA_DUMMY; + break; + // Intervene case 3411: spellInfo->Attributes |= SPELL_ATTR0_STOP_ATTACK_TARGET; - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; break; - // Roar of Sacrifice - case 53480: - spellInfo->Effect[1] = SPELL_EFFECT_APPLY_AURA; - spellInfo->EffectApplyAuraName[1] = SPELL_AURA_SPLIT_DAMAGE_PCT; - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ALLY; - spellInfo->EffectDieSides[1] = 1; - spellInfo->EffectBasePoints[1] = 19; - spellInfo->EffectMiscValue[1] = 127; // all schools - break; - // Silencing Shot - case 34490: - case 41084: - case 42671: - spellInfo->speed = 0.0f; - break; - // Monstrous Bite - case 54680: - case 55495: - case 55496: - case 55497: - case 55498: - case 55499: - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_CASTER; - break; - // Hunter's Mark - case 1130: - case 14323: - case 14324: - case 14325: - case 53338: - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; - break; - // Cobra Strikes - case 53257: - spellInfo->procCharges = 2; - spellInfo->StackAmount = 0; - break; - // Kill Command - case 34027: - spellInfo->procCharges = 0; - break; - // Kindred Spirits, damage aura - case 57458: - spellInfo->AttributesEx4 |= SPELL_ATTR4_UNK21; - break; - // Chimera Shot - Serpent trigger - case 53353: + // Roar of Sacrifice + case 53480: + spellInfo->Effect[1] = SPELL_EFFECT_APPLY_AURA; + spellInfo->EffectApplyAuraName[1] = SPELL_AURA_SPLIT_DAMAGE_PCT; + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ALLY; + spellInfo->EffectDieSides[1] = 1; + spellInfo->EffectBasePoints[1] = 19; + spellInfo->EffectMiscValue[1] = 127; // all schools + break; + // Silencing Shot + case 34490: + case 41084: + case 42671: + spellInfo->speed = 0.0f; + break; + // Monstrous Bite + case 54680: + case 55495: + case 55496: + case 55497: + case 55498: + case 55499: + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_CASTER; + break; + // Hunter's Mark + case 1130: + case 14323: + case 14324: + case 14325: + case 53338: + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; + break; + // Cobra Strikes + case 53257: + spellInfo->procCharges = 2; + spellInfo->StackAmount = 0; + break; + // Kill Command + case 34027: + spellInfo->procCharges = 0; + break; + // Kindred Spirits, damage aura + case 57458: + spellInfo->AttributesEx4 |= SPELL_ATTR4_UNK21; + break; + // Chimera Shot - Serpent trigger + case 53353: spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; - break; - // Entrapment trigger - case 19185: - case 64803: - case 64804: - spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_DEST_TARGET_ENEMY; - spellInfo->EffectImplicitTargetB[EFFECT_0] = TARGET_UNIT_DEST_AREA_ENEMY; - spellInfo->AttributesEx5 |= SPELL_ATTR5_SKIP_CHECKCAST_LOS_CHECK; - break; - // Improved Stings (Rank 2) - case 19465: - spellInfo->EffectImplicitTargetA[EFFECT_2] = TARGET_UNIT_CASTER; break; - // Explosive Shot (trigger) - case 53352: - spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; - break; - // Heart of the Phoenix (triggered) - case 54114: - spellInfo->AttributesEx &= ~SPELL_ATTR1_DISMISS_PET; - spellInfo->RecoveryTime = 8*60*IN_MILLISECONDS; // prev 600000 - break; + // Entrapment trigger + case 19185: + case 64803: + case 64804: + spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_DEST_TARGET_ENEMY; + spellInfo->EffectImplicitTargetB[EFFECT_0] = TARGET_UNIT_DEST_AREA_ENEMY; + spellInfo->AttributesEx5 |= SPELL_ATTR5_SKIP_CHECKCAST_LOS_CHECK; + break; + // Improved Stings (Rank 2) + case 19465: + spellInfo->EffectImplicitTargetA[EFFECT_2] = TARGET_UNIT_CASTER; + break; + // Explosive Shot (trigger) + case 53352: + spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; + break; + // Heart of the Phoenix (triggered) + case 54114: + spellInfo->AttributesEx &= ~SPELL_ATTR1_DISMISS_PET; + spellInfo->RecoveryTime = 8*60*IN_MILLISECONDS; // prev 600000 + break; - ///////////////////////////////// - ///// ROGUE - ///////////////////////////////// - // Master of Subtlety - case 31221: - case 31222: - case 31223: - spellInfo->SpellFamilyName = SPELLFAMILY_ROGUE; - break; - // Master of Subtlety triggers - case 31666: - // Overkill - case 58428: - spellInfo->Effect[0] = SPELL_EFFECT_SCRIPT_EFFECT; - break; - // Honor Among Thieves + ///////////////////////////////// + ///// ROGUE + ///////////////////////////////// + // Master of Subtlety + case 31221: + case 31222: + case 31223: + spellInfo->SpellFamilyName = SPELLFAMILY_ROGUE; + break; + // Master of Subtlety triggers + case 31666: + // Overkill + case 58428: + spellInfo->Effect[0] = SPELL_EFFECT_SCRIPT_EFFECT; + break; + // Honor Among Thieves case 51698: case 51700: case 51701: spellInfo->EffectTriggerSpell[0] = 51699; break; - // Slice and Dice - case 5171: - case 6774: - // Distract - case 1725: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - break; - // Envenom - case 32645: - case 32684: - case 57992: - case 57993: - spellInfo->Dispel = DISPEL_NONE; - break; - // Killing Spree (teleport) - case 57840: - spellInfo->rangeIndex = 6; // 100 yards - break; - // Killing Spree - case 51690: - spellInfo->AttributesEx |= SPELL_ATTR1_NOT_BREAK_STEALTH; - break; + // Slice and Dice + case 5171: + case 6774: + // Distract + case 1725: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + break; + // Envenom + case 32645: + case 32684: + case 57992: + case 57993: + spellInfo->Dispel = DISPEL_NONE; + break; + // Killing Spree (teleport) + case 57840: + spellInfo->rangeIndex = 6; // 100 yards + break; + // Killing Spree + case 51690: + spellInfo->AttributesEx |= SPELL_ATTR1_NOT_BREAK_STEALTH; + break; - ///////////////////////////////// - ///// DEATH KNIGHT - ///////////////////////////////// - // Blood Tap visual cd reset - case 47804: - spellInfo->Effect[2] = 0; - spellInfo->Effect[1] = 0; - spellInfo->runeCostID = 442; - break; - // Chains of Ice - case 45524: - spellInfo->Effect[EFFECT_2] = 0; - break; - // Impurity + ///////////////////////////////// + ///// DEATH KNIGHT + ///////////////////////////////// + // Blood Tap visual cd reset + case 47804: + spellInfo->Effect[2] = 0; + spellInfo->Effect[1] = 0; + spellInfo->runeCostID = 442; + break; + // Chains of Ice + case 45524: + spellInfo->Effect[EFFECT_2] = 0; + break; + // Impurity case 49220: case 49633: case 49635: @@ -3788,1620 +3788,1620 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA; spellInfo->EffectApplyAuraName[0] = SPELL_AURA_DUMMY; spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; - spellInfo->SpellFamilyName = SPELLFAMILY_DEATHKNIGHT; + spellInfo->SpellFamilyName = SPELLFAMILY_DEATHKNIGHT; break; - // Deadly Aggression (Deadly Gladiator's Death Knight Relic, item: 42620) - case 60549: - spellInfo->Effect[1] = 0; - break; - // Magic Suppression - case 49224: - case 49610: - case 49611: - spellInfo->procCharges = 0; - break; - // Wandering Plague - case 50526: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - break; - // Dancing Rune Weapon - case 49028: - spellInfo->Effect[2] = 0; - spellInfo->procFlags |= PROC_FLAG_DONE_MELEE_AUTO_ATTACK; - break; - // Death and Decay - case 52212: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - spellInfo->AttributesEx6 |= SPELL_ATTR6_CAN_TARGET_INVISIBLE; - break; - // T9 blood plague crit bonus - case 67118: - spellInfo->Effect[1] = 0; - break; - // Pestilence - case 50842: - spellInfo->EffectImplicitTargetA[2] = TARGET_DEST_TARGET_ENEMY; - break; - // Horn of Winter, stacking issues - case 57330: - case 57623: - spellInfo->EffectImplicitTargetA[1] = 0; - break; - // Scourge Strike trigger - case 70890: - spellInfo->AttributesEx3 |= SPELL_ATTR3_CANT_TRIGGER_PROC; - break; - // Blood-caked Blade - Blood-caked Strike trigger - case 50463: - spellInfo->AttributesEx3 |= SPELL_ATTR3_CANT_TRIGGER_PROC; - break; - // Blood Gorged - ARP affect Death Strike and Rune Strike - case 61274: - case 61275: - case 61276: - case 61277: - case 61278: - spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x1400011, 0x20000000, 0x0); - break; - // Death Grip, remove main grip mechanic, leave only effect one - // Death Grip, should fix taunt on bosses and not break the pull protection at the same time (no aura provides immunity to grip mechanic) - case 49576: - case 49560: - spellInfo->Mechanic = 0; - break; - // Death Grip Jump Dest - case 57604: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - // Death Pact - case 48743: + // Deadly Aggression (Deadly Gladiator's Death Knight Relic, item: 42620) + case 60549: + spellInfo->Effect[1] = 0; + break; + // Magic Suppression + case 49224: + case 49610: + case 49611: + spellInfo->procCharges = 0; + break; + // Wandering Plague + case 50526: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + break; + // Dancing Rune Weapon + case 49028: + spellInfo->Effect[2] = 0; + spellInfo->procFlags |= PROC_FLAG_DONE_MELEE_AUTO_ATTACK; + break; + // Death and Decay + case 52212: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + spellInfo->AttributesEx6 |= SPELL_ATTR6_CAN_TARGET_INVISIBLE; + break; + // T9 blood plague crit bonus + case 67118: + spellInfo->Effect[1] = 0; + break; + // Pestilence + case 50842: + spellInfo->EffectImplicitTargetA[2] = TARGET_DEST_TARGET_ENEMY; + break; + // Horn of Winter, stacking issues + case 57330: + case 57623: + spellInfo->EffectImplicitTargetA[1] = 0; + break; + // Scourge Strike trigger + case 70890: + spellInfo->AttributesEx3 |= SPELL_ATTR3_CANT_TRIGGER_PROC; + break; + // Blood-caked Blade - Blood-caked Strike trigger + case 50463: + spellInfo->AttributesEx3 |= SPELL_ATTR3_CANT_TRIGGER_PROC; + break; + // Blood Gorged - ARP affect Death Strike and Rune Strike + case 61274: + case 61275: + case 61276: + case 61277: + case 61278: + spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x1400011, 0x20000000, 0x0); + break; + // Death Grip, remove main grip mechanic, leave only effect one + // Death Grip, should fix taunt on bosses and not break the pull protection at the same time (no aura provides immunity to grip mechanic) + case 49576: + case 49560: + spellInfo->Mechanic = 0; + break; + // Death Grip Jump Dest + case 57604: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + // Death Pact + case 48743: spellInfo->AttributesEx &= ~SPELL_ATTR1_CANT_TARGET_SELF; break; - // Raise Ally (trigger) - case 46619: - spellInfo->Attributes &= ~SPELL_ATTR0_CANT_CANCEL; - break; - // Frost Strike - case 49143: - case 51416: - case 51417: - case 51418: - case 51419: - case 55268: - spellInfo->AttributesEx3 |= SPELL_ATTR3_BLOCKABLE_SPELL; - break; + // Raise Ally (trigger) + case 46619: + spellInfo->Attributes &= ~SPELL_ATTR0_CANT_CANCEL; + break; + // Frost Strike + case 49143: + case 51416: + case 51417: + case 51418: + case 51419: + case 55268: + spellInfo->AttributesEx3 |= SPELL_ATTR3_BLOCKABLE_SPELL; + break; - ///////////////////////////////// - ///// SHAMAN - ///////////////////////////////// - // Lightning overload + ///////////////////////////////// + ///// SHAMAN + ///////////////////////////////// + // Lightning overload case 45297: - case 45284: + case 45284: spellInfo->CategoryRecoveryTime = 0; spellInfo->RecoveryTime = 0; - spellInfo->AttributesEx6 |= SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS; + spellInfo->AttributesEx6 |= SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS; + break; + // Improved Earth Shield + case 51560: + case 51561: + spellInfo->EffectMiscValue[1] = SPELLMOD_DAMAGE; + break; + // Tidal Force + case 55166: + case 55198: + spellInfo->DurationIndex = 18; + spellInfo->procCharges = 0; + break; + // Healing Stream Totem + case 52042: + spellInfo->spellLevel = 0; + spellInfo->baseLevel = 0; + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + break; + // Earth Shield + case 379: + spellInfo->spellLevel = 0; + spellInfo->baseLevel = 0; + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; + break; + // Stormstrike + case 17364: + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; + // Strength of Earth totem effect + case 8076: + case 8162: + case 8163: + case 10441: + case 25362: + case 25527: + case 57621: + case 58646: + spellInfo->EffectRadiusIndex[1] = spellInfo->EffectRadiusIndex[0]; + spellInfo->EffectRadiusIndex[2] = spellInfo->EffectRadiusIndex[0]; + break; + // Flametongue Totem effect + case 52109: + case 52110: + case 52111: + case 52112: + case 52113: + case 58651: + case 58654: + case 58655: + spellInfo->EffectImplicitTargetB[2] = spellInfo->EffectImplicitTargetB[1] = spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->EffectImplicitTargetA[2] = spellInfo->EffectImplicitTargetA[1] = spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; + break; + // Sentry Totem + case 6495: + spellInfo->EffectRadiusIndex[0] = 0; + break; + // Bind Sight (PT) + case 6277: + spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_1; + spellInfo->Attributes |= SPELL_ATTR0_PASSIVE; + spellInfo->AttributesEx7 |= SPELL_ATTR7_REACTIVATE_AT_RESURRECT; // because it is passive, needs this to be properly removed at death in RemoveAllAurasOnDeath() + break; + // Ancestral Awakening Heal + case 52752: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; break; - // Improved Earth Shield - case 51560: - case 51561: - spellInfo->EffectMiscValue[1] = SPELLMOD_DAMAGE; - break; - // Tidal Force - case 55166: - case 55198: - spellInfo->DurationIndex = 18; - spellInfo->procCharges = 0; - break; - // Healing Stream Totem - case 52042: - spellInfo->spellLevel = 0; - spellInfo->baseLevel = 0; - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - break; - // Earth Shield - case 379: - spellInfo->spellLevel = 0; - spellInfo->baseLevel = 0; - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; - break; - // Stormstrike - case 17364: - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; - break; - // Strength of Earth totem effect - case 8076: - case 8162: - case 8163: - case 10441: - case 25362: - case 25527: - case 57621: - case 58646: - spellInfo->EffectRadiusIndex[1] = spellInfo->EffectRadiusIndex[0]; - spellInfo->EffectRadiusIndex[2] = spellInfo->EffectRadiusIndex[0]; - break; - // Flametongue Totem effect - case 52109: - case 52110: - case 52111: - case 52112: - case 52113: - case 58651: - case 58654: - case 58655: - spellInfo->EffectImplicitTargetB[2] = spellInfo->EffectImplicitTargetB[1] = spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->EffectImplicitTargetA[2] = spellInfo->EffectImplicitTargetA[1] = spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; - break; - // Sentry Totem - case 6495: - spellInfo->EffectRadiusIndex[0] = 0; - break; - // Bind Sight (PT) - case 6277: - spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_1; - spellInfo->Attributes |= SPELL_ATTR0_PASSIVE; - spellInfo->AttributesEx7 |= SPELL_ATTR7_REACTIVATE_AT_RESURRECT; // because it is passive, needs this to be properly removed at death in RemoveAllAurasOnDeath() - break; - // Ancestral Awakening Heal - case 52752: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; - break; case 32182: // Heroism spellInfo->excludeTargetAuraSpell = 57723; // Exhaustion - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; break; case 2825: // Bloodlust spellInfo->excludeTargetAuraSpell = 57724; // Sated - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; break; - ///////////////////////////////// - ///// WARLOCK - ///////////////////////////////// - // Improved Succubus + ///////////////////////////////// + ///// WARLOCK + ///////////////////////////////// + // Improved Succubus case 18754: case 18755: case 18756: spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; break; - // Unstable Affliction - case 31117: - spellInfo->PreventionType = SPELL_PREVENTION_TYPE_NONE; - break; - // Shadowflame - trigger - case 47960: // r1 - case 61291: // r2 - spellInfo->AttributesEx |= SPELL_ATTR1_CANT_BE_REDIRECTED; - break; - // Curse of Doom - summoned doomguard duration fix - case 18662: - spellInfo->DurationIndex = 6; - break; - // Glyph of Voidwalker - case 56247: - spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER; - spellInfo->EffectMiscValue[EFFECT_0] = SPELLMOD_EFFECT1; - spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x8000000, 0, 0); - break; - // Everlasting Affliction - case 47201: + // Unstable Affliction + case 31117: + spellInfo->PreventionType = SPELL_PREVENTION_TYPE_NONE; + break; + // Shadowflame - trigger + case 47960: // r1 + case 61291: // r2 + spellInfo->AttributesEx |= SPELL_ATTR1_CANT_BE_REDIRECTED; + break; + // Curse of Doom - summoned doomguard duration fix + case 18662: + spellInfo->DurationIndex = 6; + break; + // Glyph of Voidwalker + case 56247: + spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER; + spellInfo->EffectMiscValue[EFFECT_0] = SPELLMOD_EFFECT1; + spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x8000000, 0, 0); + break; + // Everlasting Affliction + case 47201: case 47202: case 47203: case 47204: case 47205: spellInfo->EffectSpellClassMask[1][0] |= 2; // add corruption to affected spells break; - // Death's Embrace + // Death's Embrace case 47198: case 47199: case 47200: - spellInfo->EffectSpellClassMask[1][0] |= 0x4000; // include Drain Soul - break; - // Improved Demonic Tactics - case 54347: - case 54348: - case 54349: - spellInfo->Effect[EFFECT_1] = spellInfo->Effect[EFFECT_0]; - spellInfo->EffectApplyAuraName[EFFECT_1] = spellInfo->EffectApplyAuraName[EFFECT_0]; - spellInfo->EffectImplicitTargetA[EFFECT_1] = spellInfo->EffectImplicitTargetA[EFFECT_0]; - spellInfo->EffectMiscValue[EFFECT_0] = SPELLMOD_EFFECT1; - spellInfo->EffectMiscValue[EFFECT_1] = SPELLMOD_EFFECT2; - break; - // Rain of Fire (Doomguard) - case 42227: - spellInfo->speed = 0.0f; - break; - // Ritual Enslavement - case 22987: - spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_MOD_CHARM; - break; + spellInfo->EffectSpellClassMask[1][0] |= 0x4000; // include Drain Soul + break; + // Improved Demonic Tactics + case 54347: + case 54348: + case 54349: + spellInfo->Effect[EFFECT_1] = spellInfo->Effect[EFFECT_0]; + spellInfo->EffectApplyAuraName[EFFECT_1] = spellInfo->EffectApplyAuraName[EFFECT_0]; + spellInfo->EffectImplicitTargetA[EFFECT_1] = spellInfo->EffectImplicitTargetA[EFFECT_0]; + spellInfo->EffectMiscValue[EFFECT_0] = SPELLMOD_EFFECT1; + spellInfo->EffectMiscValue[EFFECT_1] = SPELLMOD_EFFECT2; + break; + // Rain of Fire (Doomguard) + case 42227: + spellInfo->speed = 0.0f; + break; + // Ritual Enslavement + case 22987: + spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_MOD_CHARM; + break; - ///////////////////////////////// - ///// MAGE - ///////////////////////////////// - // Combustion, make this passive - case 11129: - spellInfo->Dispel = DISPEL_NONE; - break; - // Magic Absorption (nigga stole my code) + ///////////////////////////////// + ///// MAGE + ///////////////////////////////// + // Combustion, make this passive + case 11129: + spellInfo->Dispel = DISPEL_NONE; + break; + // Magic Absorption (nigga stole my code) case 29441: case 29444: spellInfo->spellLevel = 0; break; - // Living Bomb - case 44461: - case 55361: - case 55362: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - spellInfo->AttributesEx4 |= SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS; - break; - // Evocation - case 12051: - spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; - break; - // MI Fireblast, WE Frostbolt, MI Frostbolt - case 59637: - case 31707: - case 72898: - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - break; - // Blazing Speed + // Living Bomb + case 44461: + case 55361: + case 55362: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + spellInfo->AttributesEx4 |= SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS; + break; + // Evocation + case 12051: + spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; + break; + // MI Fireblast, WE Frostbolt, MI Frostbolt + case 59637: + case 31707: + case 72898: + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + break; + // Blazing Speed case 31641: case 31642: spellInfo->EffectTriggerSpell[0] = 31643; break; - // Summon Water Elemental (permanent), treat it as pet - case 70908: - spellInfo->Effect[0] = SPELL_EFFECT_SUMMON_PET; - break; - // Burnout, trigger - case 44450: - spellInfo->Effect[0] = SPELL_EFFECT_POWER_BURN; - break; - // Mirror Image - Summon Spells - case 58831: - case 58833: - case 58834: - case 65047: - spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_DEST_CASTER; - spellInfo->EffectRadiusIndex[EFFECT_0] = 0; - break; - // Initialize Images (Mirror Image) - case 58836: - spellInfo->EffectImplicitTargetA[EFFECT_1] = TARGET_UNIT_CASTER; - break; - // Arcane Blast, can't be dispelled - case 36032: - spellInfo->Attributes |= SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY; - break; - // Chilled (frost armor, ice armor proc) - case 6136: - case 7321: - spellInfo->PreventionType = SPELL_PREVENTION_TYPE_NONE; - break; - // Mirror Image Frostbolt - case 59638: - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - spellInfo->SpellFamilyName = SPELLFAMILY_MAGE; - spellInfo->SpellFamilyFlags = flag96(0x20, 0x0, 0x0); - break; - // Fingers of Frost + // Summon Water Elemental (permanent), treat it as pet + case 70908: + spellInfo->Effect[0] = SPELL_EFFECT_SUMMON_PET; + break; + // Burnout, trigger + case 44450: + spellInfo->Effect[0] = SPELL_EFFECT_POWER_BURN; + break; + // Mirror Image - Summon Spells + case 58831: + case 58833: + case 58834: + case 65047: + spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_DEST_CASTER; + spellInfo->EffectRadiusIndex[EFFECT_0] = 0; + break; + // Initialize Images (Mirror Image) + case 58836: + spellInfo->EffectImplicitTargetA[EFFECT_1] = TARGET_UNIT_CASTER; + break; + // Arcane Blast, can't be dispelled + case 36032: + spellInfo->Attributes |= SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY; + break; + // Chilled (frost armor, ice armor proc) + case 6136: + case 7321: + spellInfo->PreventionType = SPELL_PREVENTION_TYPE_NONE; + break; + // Mirror Image Frostbolt + case 59638: + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + spellInfo->SpellFamilyName = SPELLFAMILY_MAGE; + spellInfo->SpellFamilyFlags = flag96(0x20, 0x0, 0x0); + break; + // Fingers of Frost case 44544: - spellInfo->Dispel = DISPEL_NONE; - spellInfo->AttributesEx4 |= SPELL_ATTR4_NOT_STEALABLE; + spellInfo->Dispel = DISPEL_NONE; + spellInfo->AttributesEx4 |= SPELL_ATTR4_NOT_STEALABLE; spellInfo->EffectSpellClassMask[0] = flag96(685904631, 1151040, 32); // xinef: removed molten armor break; - // Fingers of Frost visual buff + // Fingers of Frost visual buff case 74396: spellInfo->procCharges = 2; spellInfo->StackAmount = 0; break; - ///////////////////////////////// - ///// WARRIOR - ///////////////////////////////// - // Glyph of blocking - case 58375: - spellInfo->EffectTriggerSpell[0] = 58374; - break; - // Sweeping Strikes stance change - case 12328: - spellInfo->Attributes |= SPELL_ATTR0_NOT_SHAPESHIFT; - break; - // Damage Shield - case 59653: - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - spellInfo->spellLevel = 0; - break; - // Strange shared cooldown - case 20230: // Retaliation - case 871: // Shield Wall - case 1719: // Recklessness - spellInfo->AttributesEx6 |= SPELL_ATTR6_IGNORE_CATEGORY_COOLDOWN_MODS; - break; - // Vigilance, fixes bug with empowered renew, single target aura - case 50720: - spellInfo->SpellFamilyName = SPELLFAMILY_WARRIOR; - break; - // Sunder Armor - trigger, remove spellfamilyflags because of glyph of sunder armor - case 58567: - spellInfo->SpellFamilyFlags = flag96(0x0, 0x0, 0x0); - break; - // Sunder Armor - Old Ranks - case 7405: - case 8380: - case 11596: - case 11597: - case 25225: - case 47467: - spellInfo->EffectTriggerSpell[EFFECT_0] = 11971; - spellInfo->Effect[EFFECT_0] = SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE; - break; - // Improved Spell Reflection - case 59725: - spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_UNIT_CASTER_AREA_PARTY; - break; + ///////////////////////////////// + ///// WARRIOR + ///////////////////////////////// + // Glyph of blocking + case 58375: + spellInfo->EffectTriggerSpell[0] = 58374; + break; + // Sweeping Strikes stance change + case 12328: + spellInfo->Attributes |= SPELL_ATTR0_NOT_SHAPESHIFT; + break; + // Damage Shield + case 59653: + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + spellInfo->spellLevel = 0; + break; + // Strange shared cooldown + case 20230: // Retaliation + case 871: // Shield Wall + case 1719: // Recklessness + spellInfo->AttributesEx6 |= SPELL_ATTR6_IGNORE_CATEGORY_COOLDOWN_MODS; + break; + // Vigilance, fixes bug with empowered renew, single target aura + case 50720: + spellInfo->SpellFamilyName = SPELLFAMILY_WARRIOR; + break; + // Sunder Armor - trigger, remove spellfamilyflags because of glyph of sunder armor + case 58567: + spellInfo->SpellFamilyFlags = flag96(0x0, 0x0, 0x0); + break; + // Sunder Armor - Old Ranks + case 7405: + case 8380: + case 11596: + case 11597: + case 25225: + case 47467: + spellInfo->EffectTriggerSpell[EFFECT_0] = 11971; + spellInfo->Effect[EFFECT_0] = SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE; + break; + // Improved Spell Reflection + case 59725: + spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_UNIT_CASTER_AREA_PARTY; + break; - ///////////////////////////////// - ///// PRIEST - ///////////////////////////////// - // Shadow Weaving - case 15257: - case 15331: - case 15332: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PROC_TRIGGER_SPELL; - break; - // Hymn of Hope - rewrite part of aura system or swap effects... - case 64904: - spellInfo->EffectApplyAuraName[1] = SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT; - spellInfo->Effect[2] = spellInfo->Effect[0]; - spellInfo->Effect[0] = 0; - spellInfo->EffectDieSides[2] = spellInfo->EffectDieSides[0]; - spellInfo->EffectImplicitTargetA[2] = spellInfo->EffectImplicitTargetB[0]; - spellInfo->EffectRadiusIndex[2] = spellInfo->EffectRadiusIndex[0]; - spellInfo->EffectBasePoints[2] = spellInfo->EffectBasePoints[0]; - break; - // Divine Hymn - case 64844: - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - spellInfo->spellLevel = 0; - break; - // Spiritual Healing affects prayer of mending - case 14898: case 15349: case 15354: case 15355: case 15356: - // Divine Providence affects prayer of mending - case 47562: case 47564: case 47565: case 47566: case 47567: - // Twin Disciplines affects prayer of mending - case 47586: case 47587: case 47588: case 52802: case 52803: - spellInfo->EffectSpellClassMask[0][1] |= 0x20; // prayer of mending - break; - // Power Infusion, hack to fix stacking with arcane power - case 10060: - spellInfo->Effect[EFFECT_2] = SPELL_EFFECT_APPLY_AURA; - spellInfo->EffectApplyAuraName[EFFECT_2] = SPELL_AURA_ADD_PCT_MODIFIER; - spellInfo->EffectImplicitTargetA[EFFECT_2] = TARGET_UNIT_TARGET_ALLY; - break; + ///////////////////////////////// + ///// PRIEST + ///////////////////////////////// + // Shadow Weaving + case 15257: + case 15331: + case 15332: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PROC_TRIGGER_SPELL; + break; + // Hymn of Hope - rewrite part of aura system or swap effects... + case 64904: + spellInfo->EffectApplyAuraName[1] = SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT; + spellInfo->Effect[2] = spellInfo->Effect[0]; + spellInfo->Effect[0] = 0; + spellInfo->EffectDieSides[2] = spellInfo->EffectDieSides[0]; + spellInfo->EffectImplicitTargetA[2] = spellInfo->EffectImplicitTargetB[0]; + spellInfo->EffectRadiusIndex[2] = spellInfo->EffectRadiusIndex[0]; + spellInfo->EffectBasePoints[2] = spellInfo->EffectBasePoints[0]; + break; + // Divine Hymn + case 64844: + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + spellInfo->spellLevel = 0; + break; + // Spiritual Healing affects prayer of mending + case 14898: case 15349: case 15354: case 15355: case 15356: + // Divine Providence affects prayer of mending + case 47562: case 47564: case 47565: case 47566: case 47567: + // Twin Disciplines affects prayer of mending + case 47586: case 47587: case 47588: case 52802: case 52803: + spellInfo->EffectSpellClassMask[0][1] |= 0x20; // prayer of mending + break; + // Power Infusion, hack to fix stacking with arcane power + case 10060: + spellInfo->Effect[EFFECT_2] = SPELL_EFFECT_APPLY_AURA; + spellInfo->EffectApplyAuraName[EFFECT_2] = SPELL_AURA_ADD_PCT_MODIFIER; + spellInfo->EffectImplicitTargetA[EFFECT_2] = TARGET_UNIT_TARGET_ALLY; + break; - ///////////////////////////////// - ///// DRUID - ///////////////////////////////// - // Lifebloom final bloom - case 33778: - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - spellInfo->spellLevel = 0; - spellInfo->SpellFamilyFlags = flag96(0, 0x10, 0); - break; - // Clearcasting - case 16870: - spellInfo->DurationIndex = 31; // 8 secs - break; - // Owlkin Frenzy - case 48391: - spellInfo->Attributes |= SPELL_ATTR0_NOT_SHAPESHIFT; - break; - // Item T10 Restoration 4P Bonus - case 70691: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; - break; - // Faerie Fire, Faerie Fire (Feral) - case 770: - case 16857: - spellInfo->AttributesEx &= ~SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE; - break; - // Feral Charge - Cat - case 49376: - case 61138: - case 61132: - case 50259: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - break; - // Glyph of Barkskin - case 63058: - spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE; - break; + ///////////////////////////////// + ///// DRUID + ///////////////////////////////// + // Lifebloom final bloom + case 33778: + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + spellInfo->spellLevel = 0; + spellInfo->SpellFamilyFlags = flag96(0, 0x10, 0); + break; + // Clearcasting + case 16870: + spellInfo->DurationIndex = 31; // 8 secs + break; + // Owlkin Frenzy + case 48391: + spellInfo->Attributes |= SPELL_ATTR0_NOT_SHAPESHIFT; + break; + // Item T10 Restoration 4P Bonus + case 70691: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; + break; + // Faerie Fire, Faerie Fire (Feral) + case 770: + case 16857: + spellInfo->AttributesEx &= ~SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE; + break; + // Feral Charge - Cat + case 49376: + case 61138: + case 61132: + case 50259: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + break; + // Glyph of Barkskin + case 63058: + spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE; + break; - ///////////////////////////////// - ///// MISC - ///////////////////////////////// - // Resurrection Sickness - case 15007: - spellInfo->SpellFamilyName = SPELLFAMILY_GENERIC; - break; - // Luck of the Draw - case 72221: - spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CHANGE_MAP; - break; - case 3286: // Bind - spellInfo->Targets = 0; // neutral innkeepers not friendly? + ///////////////////////////////// + ///// MISC + ///////////////////////////////// + // Resurrection Sickness + case 15007: + spellInfo->SpellFamilyName = SPELLFAMILY_GENERIC; + break; + // Luck of the Draw + case 72221: + spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CHANGE_MAP; + break; + case 3286: // Bind + spellInfo->Targets = 0; // neutral innkeepers not friendly? spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ANY; break; // remove creaturetargettype - case 2641: - case 23356: + case 2641: + case 23356: spellInfo->TargetCreatureType = 0; break; - case 34074: // Aspect of the Viper - spellInfo->Effect[2] = SPELL_EFFECT_APPLY_AURA; - spellInfo->EffectImplicitTargetA[2] = 1; - spellInfo->EffectApplyAuraName[2] = SPELL_AURA_DUMMY; - break; + case 34074: // Aspect of the Viper + spellInfo->Effect[2] = SPELL_EFFECT_APPLY_AURA; + spellInfo->EffectImplicitTargetA[2] = 1; + spellInfo->EffectApplyAuraName[2] = SPELL_AURA_DUMMY; + break; // Strength of Wrynn case 60509: spellInfo->EffectBasePoints[2] = 1500; spellInfo->EffectBasePoints[1] = 150; spellInfo->EffectApplyAuraName[1] = SPELL_AURA_PERIODIC_HEAL; break; - // Playback Speech - case 74209: - spellInfo->DurationIndex = 1; - break; - // Winterfin First Responder - case 48739: - spellInfo->EffectBasePoints[0] = 1; - spellInfo->EffectRealPointsPerLevel[0] = 0; - spellInfo->EffectDieSides[0] = 0; - spellInfo->EffectDamageMultiplier[0] = 0; - spellInfo->EffectBonusMultiplier[0] = 0; - break; - // Army of the Dead (trigger npc aura) - case 49099: - spellInfo->EffectAmplitude[0] = 15000; - break; - // Isle of Conquest - Teleport in, missing range - case 66551: - spellInfo->rangeIndex = 13; // 50000yd - break; - // A'dal's Song of Battle - case 39953: + // Playback Speech + case 74209: + spellInfo->DurationIndex = 1; + break; + // Winterfin First Responder + case 48739: + spellInfo->EffectBasePoints[0] = 1; + spellInfo->EffectRealPointsPerLevel[0] = 0; + spellInfo->EffectDieSides[0] = 0; + spellInfo->EffectDamageMultiplier[0] = 0; + spellInfo->EffectBonusMultiplier[0] = 0; + break; + // Army of the Dead (trigger npc aura) + case 49099: + spellInfo->EffectAmplitude[0] = 15000; + break; + // Isle of Conquest - Teleport in, missing range + case 66551: + spellInfo->rangeIndex = 13; // 50000yd + break; + // A'dal's Song of Battle + case 39953: spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_SRC_CASTER; spellInfo->EffectImplicitTargetA[EFFECT_1] = TARGET_SRC_CASTER; spellInfo->EffectImplicitTargetA[EFFECT_2] = TARGET_SRC_CASTER; spellInfo->EffectImplicitTargetB[EFFECT_0] = TARGET_UNIT_SRC_AREA_ALLY; spellInfo->EffectImplicitTargetB[EFFECT_1] = TARGET_UNIT_SRC_AREA_ALLY; spellInfo->EffectImplicitTargetB[EFFECT_2] = TARGET_UNIT_SRC_AREA_ALLY; - spellInfo->DurationIndex = 367; // 2 Hours - break; - // Wintergrasp spells - case 51422: // Cannon (Tower Cannon) - spellInfo->EffectRadiusIndex[EFFECT_0] = 13; // 10yd - break; - case 57610: // Cannon (Siege Turret) - spellInfo->EffectRadiusIndex[EFFECT_0] = 13; // 10yd - break; - case 50999: // Boulder (Demolisher) - spellInfo->EffectRadiusIndex[EFFECT_0] = 13; // 10yd - break; - case 50990: // Flame Breath (Catapult) - spellInfo->EffectRadiusIndex[EFFECT_0] = 19; // 18yd - break; + spellInfo->DurationIndex = 367; // 2 Hours + break; + // Wintergrasp spells + case 51422: // Cannon (Tower Cannon) + spellInfo->EffectRadiusIndex[EFFECT_0] = 13; // 10yd + break; + case 57610: // Cannon (Siege Turret) + spellInfo->EffectRadiusIndex[EFFECT_0] = 13; // 10yd + break; + case 50999: // Boulder (Demolisher) + spellInfo->EffectRadiusIndex[EFFECT_0] = 13; // 10yd + break; + case 50990: // Flame Breath (Catapult) + spellInfo->EffectRadiusIndex[EFFECT_0] = 19; // 18yd + break; - ///////////////////////////////// - ///// Generic NPC Spells - ///////////////////////////////// + ///////////////////////////////// + ///// Generic NPC Spells + ///////////////////////////////// - // Throw Proximity Bomb - case 34095: - spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_DEST_TARGET_ENEMY; - spellInfo->EffectImplicitTargetB[EFFECT_0] = 0; - break; - // DEATH KNIGHT SCARLET FIRE ARROW - case 53348: - // BALISTA - case 53117: - spellInfo->RecoveryTime = 5000; - spellInfo->CategoryRecoveryTime = 5000; - break; - // Teleport To Molten Core - case 25139: - spellInfo->AttributesEx3 |= SPELL_ATTR3_DEATH_PERSISTENT; - break; + // Throw Proximity Bomb + case 34095: + spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_DEST_TARGET_ENEMY; + spellInfo->EffectImplicitTargetB[EFFECT_0] = 0; + break; + // DEATH KNIGHT SCARLET FIRE ARROW + case 53348: + // BALISTA + case 53117: + spellInfo->RecoveryTime = 5000; + spellInfo->CategoryRecoveryTime = 5000; + break; + // Teleport To Molten Core + case 25139: + spellInfo->AttributesEx3 |= SPELL_ATTR3_DEATH_PERSISTENT; + break; // /////////////////////////////////////////// - // ////////////////BOSS SPELLS//////////////// - // /////////////////////////////////////////// - ////////////////////////////////////////// - ////////// Vanilla Instances - ////////////////////////////////////////// + // ////////////////BOSS SPELLS//////////////// + // /////////////////////////////////////////// + ////////////////////////////////////////// + ////////// Vanilla Instances + ////////////////////////////////////////// - // Shadowfang Keep - // Landen Stilwell Transform - case 31310: - spellInfo->Attributes |= SPELL_ATTR0_PASSIVE; - break; + // Shadowfang Keep + // Landen Stilwell Transform + case 31310: + spellInfo->Attributes |= SPELL_ATTR0_PASSIVE; + break; - // Blackfathom Deeps - // Shadowstalker Stealth - case 5916: - spellInfo->EffectRealPointsPerLevel[EFFECT_0] = 5.0f; - break; + // Blackfathom Deeps + // Shadowstalker Stealth + case 5916: + spellInfo->EffectRealPointsPerLevel[EFFECT_0] = 5.0f; + break; - // Maraudon - // Sneak - case 22766: - spellInfo->EffectRealPointsPerLevel[EFFECT_0] = 5.0f; - break; + // Maraudon + // Sneak + case 22766: + spellInfo->EffectRealPointsPerLevel[EFFECT_0] = 5.0f; + break; - ////////////////////////////////////////// - ////////// TBC Instances - ////////////////////////////////////////// + ////////////////////////////////////////// + ////////// TBC Instances + ////////////////////////////////////////// - // Shadow Labirynth - // Murmur's Touch - case 38794: - case 33711: + // Shadow Labirynth + // Murmur's Touch + case 38794: + case 33711: spellInfo->MaxAffectedTargets = 1; spellInfo->EffectTriggerSpell[0] = 33760; break; - // The Arcatraz - // Negaton Field - case 36729: // Normal - case 38834: // Heroic - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; - break; - // Curse of the Doomsayer NORMAL - case 36173: - spellInfo->EffectTriggerSpell[0] = 36174; // Currently triggers heroic version... - break; + // The Arcatraz + // Negaton Field + case 36729: // Normal + case 38834: // Heroic + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; + // Curse of the Doomsayer NORMAL + case 36173: + spellInfo->EffectTriggerSpell[0] = 36174; // Currently triggers heroic version... + break; - // The Botanica - // Crystal Channel - case 34156: - spellInfo->rangeIndex = 35; // 35yd; - spellInfo->ChannelInterruptFlags |= AURA_INTERRUPT_FLAG_MOVE; - break; + // The Botanica + // Crystal Channel + case 34156: + spellInfo->rangeIndex = 35; // 35yd; + spellInfo->ChannelInterruptFlags |= AURA_INTERRUPT_FLAG_MOVE; + break; - // Magtheridon's Lair - // Debris - case 36449: - spellInfo->Attributes |= SPELL_ATTR0_NEGATIVE_1; - break; - // Soul Channel - case 30531: - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; - break; - // Debris Visual - case 30632: - spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_DYNOBJ_ALLY; - break; + // Magtheridon's Lair + // Debris + case 36449: + spellInfo->Attributes |= SPELL_ATTR0_NEGATIVE_1; + break; + // Soul Channel + case 30531: + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; + // Debris Visual + case 30632: + spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_DYNOBJ_ALLY; + break; - // Sunwell Plateu - // Activate Sunblade Protecto - case 46475: - case 46476: - spellInfo->rangeIndex = 14; // 60yd - break; - // Break Ice - case 46638: - spellInfo->AttributesEx3 &= ~SPELL_ATTR3_ONLY_TARGET_PLAYERS; // Obvious fail, it targets gameobject... - break; - // Sinister Reflection Clone - case 45785: - spellInfo->speed = 0.0f; - break; - // Armageddon - case 45909: - spellInfo->speed = 8.0f; - break; + // Sunwell Plateu + // Activate Sunblade Protecto + case 46475: + case 46476: + spellInfo->rangeIndex = 14; // 60yd + break; + // Break Ice + case 46638: + spellInfo->AttributesEx3 &= ~SPELL_ATTR3_ONLY_TARGET_PLAYERS; // Obvious fail, it targets gameobject... + break; + // Sinister Reflection Clone + case 45785: + spellInfo->speed = 0.0f; + break; + // Armageddon + case 45909: + spellInfo->speed = 8.0f; + break; - // Black Temple - // Spell Absorption - case 41034: - spellInfo->Effect[EFFECT_2] = SPELL_EFFECT_APPLY_AURA; - spellInfo->EffectApplyAuraName[EFFECT_2] = SPELL_AURA_SCHOOL_ABSORB; - spellInfo->EffectImplicitTargetA[EFFECT_2] = TARGET_UNIT_CASTER; - spellInfo->EffectMiscValue[EFFECT_2] = SPELL_SCHOOL_MASK_MAGIC; - break; - // Shared Bonds - case 41363: - spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_1; - break; - // Deadly Poison - case 41485: - // Envenom - case 41487: - spellInfo->AttributesEx6 |= SPELL_ATTR6_CAN_TARGET_INVISIBLE; - break; - // Parasitic Shadowfiend - case 41914: - spellInfo->Attributes |= SPELL_ATTR0_NEGATIVE_1; - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; - break; - // Teleport Maiev - case 41221: - spellInfo->rangeIndex = 13; // 0-50000yd - break; + // Black Temple + // Spell Absorption + case 41034: + spellInfo->Effect[EFFECT_2] = SPELL_EFFECT_APPLY_AURA; + spellInfo->EffectApplyAuraName[EFFECT_2] = SPELL_AURA_SCHOOL_ABSORB; + spellInfo->EffectImplicitTargetA[EFFECT_2] = TARGET_UNIT_CASTER; + spellInfo->EffectMiscValue[EFFECT_2] = SPELL_SCHOOL_MASK_MAGIC; + break; + // Shared Bonds + case 41363: + spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_1; + break; + // Deadly Poison + case 41485: + // Envenom + case 41487: + spellInfo->AttributesEx6 |= SPELL_ATTR6_CAN_TARGET_INVISIBLE; + break; + // Parasitic Shadowfiend + case 41914: + spellInfo->Attributes |= SPELL_ATTR0_NEGATIVE_1; + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; + // Teleport Maiev + case 41221: + spellInfo->rangeIndex = 13; // 0-50000yd + break; - // Serpentshrine Cavern - // Watery Grave Explosion - case 37852: - spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_STUNNED; - break; + // Serpentshrine Cavern + // Watery Grave Explosion + case 37852: + spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_STUNNED; + break; - // Magisters' Terrace - // Energy Feedback - case 44335: - spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CHANGE_MAP; - break; + // Magisters' Terrace + // Energy Feedback + case 44335: + spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CHANGE_MAP; + break; - ////////////////////////////////////////// - ////////// Vault of Archavon (VOA) - ////////////////////////////////////////// - // Flame Breath, catapult spell - case 50989: - spellInfo->Attributes &= ~SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION; - break; - // Koralon, Flaming Cinder missing radius index - case 66690: - spellInfo->EffectRadiusIndex[0] = 12; //100yd - spellInfo->MaxAffectedTargets = 1; - break; + ////////////////////////////////////////// + ////////// Vault of Archavon (VOA) + ////////////////////////////////////////// + // Flame Breath, catapult spell + case 50989: + spellInfo->Attributes &= ~SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION; + break; + // Koralon, Flaming Cinder missing radius index + case 66690: + spellInfo->EffectRadiusIndex[0] = 12; //100yd + spellInfo->MaxAffectedTargets = 1; + break; - ////////////////////////////////////////// - ////////// Naxxramas - ////////////////////////////////////////// - // Acid Volley - case 54714: - case 29325: - spellInfo->MaxAffectedTargets = 1; - break; - // Summon Plagued Warrior - case 29237: - spellInfo->Effect[0] = SPELL_EFFECT_DUMMY; - spellInfo->Effect[1] = spellInfo->Effect[2] = 0; - break; - // Icebolt - case 28526: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; - break; - // Infected Wound - case 29306: - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; - break; - // Hopeless - case 29125: - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENTRY; - break; + ////////////////////////////////////////// + ////////// Naxxramas + ////////////////////////////////////////// + // Acid Volley + case 54714: + case 29325: + spellInfo->MaxAffectedTargets = 1; + break; + // Summon Plagued Warrior + case 29237: + spellInfo->Effect[0] = SPELL_EFFECT_DUMMY; + spellInfo->Effect[1] = spellInfo->Effect[2] = 0; + break; + // Icebolt + case 28526: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; + break; + // Infected Wound + case 29306: + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; + // Hopeless + case 29125: + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENTRY; + break; - ////////////////////////////////////////// - ////////// Gundrak - ////////////////////////////////////////// - // Moorabi - Transformation - case 55098: - spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; - break; + ////////////////////////////////////////// + ////////// Gundrak + ////////////////////////////////////////// + // Moorabi - Transformation + case 55098: + spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; + break; - ////////////////////////////////////////// - ////////// The Nexus: Nexus - ////////////////////////////////////////// - // Charged Chaotic rift aura, trigger - case 47737: - spellInfo->rangeIndex = 37; // 50yd - break; + ////////////////////////////////////////// + ////////// The Nexus: Nexus + ////////////////////////////////////////// + // Charged Chaotic rift aura, trigger + case 47737: + spellInfo->rangeIndex = 37; // 50yd + break; - ////////////////////////////////////////// - ////////// AHN'KAHET: THE OLD KINGDOM - ////////////////////////////////////////// - // Vanish - case 55964: - spellInfo->Effect[1] = 0; - spellInfo->Effect[2] = 0; - break; + ////////////////////////////////////////// + ////////// AHN'KAHET: THE OLD KINGDOM + ////////////////////////////////////////// + // Vanish + case 55964: + spellInfo->Effect[1] = 0; + spellInfo->Effect[2] = 0; + break; - ////////////////////////////////////////// - ////////// DRAK'THARON KEEP - ////////////////////////////////////////// - // Trollgore - Summon Drakkari Invader - case 49456: - case 49457: - case 49458: - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DB; - break; + ////////////////////////////////////////// + ////////// DRAK'THARON KEEP + ////////////////////////////////////////// + // Trollgore - Summon Drakkari Invader + case 49456: + case 49457: + case 49458: + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DB; + break; - ////////////////////////////////////////// - ////////// UTGARDE PINNACLE - ////////////////////////////////////////// - // Paralyse - case 48278: - // Awaken subboss - case 47669: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; - spellInfo->EffectImplicitTargetB[0] = 0; - break; - // Flame Breath - case 47592: - spellInfo->EffectAmplitude[0] = 200; - break; + ////////////////////////////////////////// + ////////// UTGARDE PINNACLE + ////////////////////////////////////////// + // Paralyse + case 48278: + // Awaken subboss + case 47669: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; + spellInfo->EffectImplicitTargetB[0] = 0; + break; + // Flame Breath + case 47592: + spellInfo->EffectAmplitude[0] = 200; + break; - ////////////////////////////////////////// - ////////// UTGARDE KEEP - ////////////////////////////////////////// - // Skarvald, Charge - case 43651: - spellInfo->rangeIndex = 13; // 0-50000yd - break; - // Ingvar the Plunderer, Woe Strike - case 42730: - spellInfo->EffectTriggerSpell[1] = 42739; - break; - case 59735: - spellInfo->EffectTriggerSpell[1] = 59736; - break; - // Ingvar the Plunderer, Ingvar transform - case 42796: - spellInfo->AttributesEx3 |= SPELL_ATTR3_DEATH_PERSISTENT; - break; + ////////////////////////////////////////// + ////////// UTGARDE KEEP + ////////////////////////////////////////// + // Skarvald, Charge + case 43651: + spellInfo->rangeIndex = 13; // 0-50000yd + break; + // Ingvar the Plunderer, Woe Strike + case 42730: + spellInfo->EffectTriggerSpell[1] = 42739; + break; + case 59735: + spellInfo->EffectTriggerSpell[1] = 59736; + break; + // Ingvar the Plunderer, Ingvar transform + case 42796: + spellInfo->AttributesEx3 |= SPELL_ATTR3_DEATH_PERSISTENT; + break; - ////////////////////////////////////////// - ////////// VIOLET HOLD - ////////////////////////////////////////// - // Control Crystal Activation - case 57804: - spellInfo->EffectImplicitTargetA[0] = 1; - spellInfo->EffectImplicitTargetB[0] = 0; - break; - // Destroy Door Seal - case 58040: - spellInfo->ChannelInterruptFlags &= ~(AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE); - break; - // Ichoron, Water Blast - case 54237: - case 59520: - spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; - break; + ////////////////////////////////////////// + ////////// VIOLET HOLD + ////////////////////////////////////////// + // Control Crystal Activation + case 57804: + spellInfo->EffectImplicitTargetA[0] = 1; + spellInfo->EffectImplicitTargetB[0] = 0; + break; + // Destroy Door Seal + case 58040: + spellInfo->ChannelInterruptFlags &= ~(AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE); + break; + // Ichoron, Water Blast + case 54237: + case 59520: + spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; + break; - ////////////////////////////////////////// - ////////// AZJOL'NERUB - ////////////////////////////////////////// + ////////////////////////////////////////// + ////////// AZJOL'NERUB + ////////////////////////////////////////// - // Krik'thir - Mind Flay - case 52586: - case 59367: - spellInfo->ChannelInterruptFlags |= AURA_INTERRUPT_FLAG_MOVE; - break; + // Krik'thir - Mind Flay + case 52586: + case 59367: + spellInfo->ChannelInterruptFlags |= AURA_INTERRUPT_FLAG_MOVE; + break; - ////////////////////////////////////////// - ////////// HALLS OF STONE - ////////////////////////////////////////// - // Glare of the Tribunal + ////////////////////////////////////////// + ////////// HALLS OF STONE + ////////////////////////////////////////// + // Glare of the Tribunal case 50988: case 59870: spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; - spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->EffectImplicitTargetB[0] = 0; + break; + // Static Charge + case 50835: + case 59847: + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ALLY; break; - // Static Charge - case 50835: - case 59847: - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ALLY; - break; - ////////////////////////////////////////// - ////////// OBSIDIAN SANCTUM - ////////////////////////////////////////// - // Lava Strike damage - case 57697: - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - break; - // Lava Strike trigger - case 57578: - spellInfo->MaxAffectedTargets = 1; - break; - // Gift of Twilight Shadow/Fire - case 57835: - case 58766: - spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_1; - break; - // Pyrobuffet - case 57557: - spellInfo->excludeTargetAuraSpell = 56911; - break; + ////////////////////////////////////////// + ////////// OBSIDIAN SANCTUM + ////////////////////////////////////////// + // Lava Strike damage + case 57697: + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + break; + // Lava Strike trigger + case 57578: + spellInfo->MaxAffectedTargets = 1; + break; + // Gift of Twilight Shadow/Fire + case 57835: + case 58766: + spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_1; + break; + // Pyrobuffet + case 57557: + spellInfo->excludeTargetAuraSpell = 56911; + break; - ////////////////////////////////////////// - ////////// EYE OF ETERNITY - ////////////////////////////////////////// - // Arcane Barrage - case 56397: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ENEMY; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ENEMY; - spellInfo->EffectImplicitTargetB[1] = 0; - spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_TARGET_ENEMY; - spellInfo->EffectImplicitTargetB[2] = 0; - break; - // Power Spark (ground +50% dmg aura) - case 55849: - // Arcane Overload (-50% dmg taken) - this is to prevent apply -> unapply -> apply ... dunno whether it's correct - case 56438: - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; - break; - // Vortex (Control Vehicle) - case 56263: - spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; - break; - // Haste (Nexus Lord, increase run speed of the disk) - case 57060: - spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_VEHICLE; - break; - // Arcane Overload - case 56430: - spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; - spellInfo->EffectTriggerSpell[0] = 56429; - // no break intended - case 56429: - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->EffectImplicitTargetA[1] = 0; - spellInfo->EffectImplicitTargetB[1] = 0; - spellInfo->EffectImplicitTargetA[2] = 0; - spellInfo->EffectImplicitTargetB[2] = 0; - break; - // Destroy Platform Event - case 59099: - spellInfo->EffectImplicitTargetA[1] = 22; - spellInfo->EffectImplicitTargetB[1] = 15; - spellInfo->EffectImplicitTargetA[2] = 22; - spellInfo->EffectImplicitTargetB[2] = 15; - break; - // Surge of Power (Phase 3) - case 57407: // N - case 60936: // H - spellInfo->MaxAffectedTargets = (i == 60936 ? 3 : 1); - spellInfo->InterruptFlags = 0; - spellInfo->EffectRadiusIndex[0] = 28; - spellInfo->AttributesEx4 |= SPELL_ATTR4_CAN_CAST_WHILE_CASTING; - spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENEMY; - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - // Wyrmrest Drake - Life Burst - case 57143: - spellInfo->Effect[0] = 0; - spellInfo->EffectImplicitTargetA[0] = 0; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->EffectImplicitTargetA[1] = TARGET_SRC_CASTER; - spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_SRC_AREA_ALLY; - spellInfo->EffectPointsPerComboPoint[1] = 2500; - spellInfo->EffectBasePoints[1] = 2499; - spellInfo->rangeIndex = 1; - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - //Alexstrasza - Gift - case 61028: - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - break; - // Vortex (freeze anim) - case 55883: - spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CHANGE_MAP; - break; + ////////////////////////////////////////// + ////////// EYE OF ETERNITY + ////////////////////////////////////////// + // Arcane Barrage + case 56397: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ENEMY; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ENEMY; + spellInfo->EffectImplicitTargetB[1] = 0; + spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_TARGET_ENEMY; + spellInfo->EffectImplicitTargetB[2] = 0; + break; + // Power Spark (ground +50% dmg aura) + case 55849: + // Arcane Overload (-50% dmg taken) - this is to prevent apply -> unapply -> apply ... dunno whether it's correct + case 56438: + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; + // Vortex (Control Vehicle) + case 56263: + spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; + break; + // Haste (Nexus Lord, increase run speed of the disk) + case 57060: + spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_VEHICLE; + break; + // Arcane Overload + case 56430: + spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; + spellInfo->EffectTriggerSpell[0] = 56429; + // no break intended + case 56429: + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->EffectImplicitTargetA[1] = 0; + spellInfo->EffectImplicitTargetB[1] = 0; + spellInfo->EffectImplicitTargetA[2] = 0; + spellInfo->EffectImplicitTargetB[2] = 0; + break; + // Destroy Platform Event + case 59099: + spellInfo->EffectImplicitTargetA[1] = 22; + spellInfo->EffectImplicitTargetB[1] = 15; + spellInfo->EffectImplicitTargetA[2] = 22; + spellInfo->EffectImplicitTargetB[2] = 15; + break; + // Surge of Power (Phase 3) + case 57407: // N + case 60936: // H + spellInfo->MaxAffectedTargets = (i == 60936 ? 3 : 1); + spellInfo->InterruptFlags = 0; + spellInfo->EffectRadiusIndex[0] = 28; + spellInfo->AttributesEx4 |= SPELL_ATTR4_CAN_CAST_WHILE_CASTING; + spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENEMY; + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + // Wyrmrest Drake - Life Burst + case 57143: + spellInfo->Effect[0] = 0; + spellInfo->EffectImplicitTargetA[0] = 0; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->EffectImplicitTargetA[1] = TARGET_SRC_CASTER; + spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_SRC_AREA_ALLY; + spellInfo->EffectPointsPerComboPoint[1] = 2500; + spellInfo->EffectBasePoints[1] = 2499; + spellInfo->rangeIndex = 1; + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + //Alexstrasza - Gift + case 61028: + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + break; + // Vortex (freeze anim) + case 55883: + spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CHANGE_MAP; + break; - ////////////////////////////////////////// - ////////// ULDUAR - ////////////////////////////////////////// - // Flame Leviathan - // Hurl Pyrite - case 62490: - spellInfo->Effect[EFFECT_1] = 0; - break; - - // Ulduar, Mimiron, Magnetic Core (summon) - case 64444: - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_CASTER; - break; - // Ulduar, Mimiron, bomb bot explosion - case 63801: - spellInfo->EffectMiscValue[1] = 17286; - break; - // Ulduar, Mimiron, Summon Flames Initial - case 64563: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - spellInfo->EffectImplicitTargetB[0] = 0; - break; - // Ulduar, Mimiron, Flames (damage) - case 64566: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - spellInfo->AttributesEx4 &= ~SPELL_ATTR4_IGNORE_RESISTANCES; - break; - - // Ulduar, Hodir, Starlight - case 62807: - spellInfo->EffectRadiusIndex[0] = 16; // 1yd - break; - - // Ulduar, General Vezax, Mark of the Faceless - case 63278: - spellInfo->Effect[0] = 0; - break; - - // XT-002 DECONSTRUCTOR - case 62834: // Boom (XT-002) + ////////////////////////////////////////// + ////////// ULDUAR + ////////////////////////////////////////// + // Flame Leviathan + // Hurl Pyrite + case 62490: spellInfo->Effect[EFFECT_1] = 0; break; - // ASSEMBLY OF IRON - // Supercharge - case 61920: - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; - break; - // Lightning Whirl - case 61916: - spellInfo->MaxAffectedTargets = 3; - break; - case 63482: - spellInfo->MaxAffectedTargets = 8; - break; + // Ulduar, Mimiron, Magnetic Core (summon) + case 64444: + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_CASTER; + break; + // Ulduar, Mimiron, bomb bot explosion + case 63801: + spellInfo->EffectMiscValue[1] = 17286; + break; + // Ulduar, Mimiron, Summon Flames Initial + case 64563: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + spellInfo->EffectImplicitTargetB[0] = 0; + break; + // Ulduar, Mimiron, Flames (damage) + case 64566: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + spellInfo->AttributesEx4 &= ~SPELL_ATTR4_IGNORE_RESISTANCES; + break; - // KOLOGARN - // Stone Grip, remove absorb aura - case 62056: - case 63985: - spellInfo->Effect[1] = 0; - break; + // Ulduar, Hodir, Starlight + case 62807: + spellInfo->EffectRadiusIndex[0] = 16; // 1yd + break; - // AURIAYA - // Sentinel Blast - case 64389: - case 64678: - spellInfo->Dispel = DISPEL_MAGIC; - break; + // Ulduar, General Vezax, Mark of the Faceless + case 63278: + spellInfo->Effect[0] = 0; + break; - // FREYA - // Potent Pheromones - case 62619: - spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY; - break; - // Healthy spore summon periodic - case 62566: - spellInfo->EffectAmplitude[0] = 2000; - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_TRIGGER_SPELL; - break; - // Brightleaf Essence trigger - case 62968: - spellInfo->Effect[1] = 0; // duplicate - break; - // Potent Pheromones - case 64321: - spellInfo->AttributesEx3 |= SPELL_ATTR3_ONLY_TARGET_PLAYERS; - spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY; - break; + // XT-002 DECONSTRUCTOR + case 62834: // Boom (XT-002) + spellInfo->Effect[EFFECT_1] = 0; + break; - // THORIM - // charge obr stuff - case 62186: - spellInfo->EffectAmplitude[0] = 5000; // Duration 5 secs, amplitude 8 secs... - break; - // Charge Orb P2 - case 62976: - spellInfo->rangeIndex = 6; - spellInfo->DurationIndex = 28; - break; - // Sif's Blizzard - case 62576: - case 62602: - spellInfo->EffectRadiusIndex[0] = 14; // 8yd - spellInfo->EffectRadiusIndex[1] = 14; // 8yd - break; + // ASSEMBLY OF IRON + // Supercharge + case 61920: + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; + // Lightning Whirl + case 61916: + spellInfo->MaxAffectedTargets = 3; + break; + case 63482: + spellInfo->MaxAffectedTargets = 8; + break; - // YOGG-SARON - // Protective Gaze - case 64175: - spellInfo->RecoveryTime = 25000; - break; - // Shadow Beacon - case 64465: - spellInfo->EffectTriggerSpell[0] = 64467; // why do they need two script effects :/ (this one has visual effect) - break; - // Sanity - case 63050: - spellInfo->AttributesEx6 |= SPELL_ATTR6_CAN_TARGET_INVISIBLE; - break; - // Shadow Nova - case 62714: - case 65209: - spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; - break; + // KOLOGARN + // Stone Grip, remove absorb aura + case 62056: + case 63985: + spellInfo->Effect[1] = 0; + break; - // ALGALON - // Cosmic Smash (Algalon the Observer) + // AURIAYA + // Sentinel Blast + case 64389: + case 64678: + spellInfo->Dispel = DISPEL_MAGIC; + break; + + // FREYA + // Potent Pheromones + case 62619: + spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY; + break; + // Healthy spore summon periodic + case 62566: + spellInfo->EffectAmplitude[0] = 2000; + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_TRIGGER_SPELL; + break; + // Brightleaf Essence trigger + case 62968: + spellInfo->Effect[1] = 0; // duplicate + break; + // Potent Pheromones + case 64321: + spellInfo->AttributesEx3 |= SPELL_ATTR3_ONLY_TARGET_PLAYERS; + spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY; + break; + + // THORIM + // charge obr stuff + case 62186: + spellInfo->EffectAmplitude[0] = 5000; // Duration 5 secs, amplitude 8 secs... + break; + // Charge Orb P2 + case 62976: + spellInfo->rangeIndex = 6; + spellInfo->DurationIndex = 28; + break; + // Sif's Blizzard + case 62576: + case 62602: + spellInfo->EffectRadiusIndex[0] = 14; // 8yd + spellInfo->EffectRadiusIndex[1] = 14; // 8yd + break; + + // YOGG-SARON + // Protective Gaze + case 64175: + spellInfo->RecoveryTime = 25000; + break; + // Shadow Beacon + case 64465: + spellInfo->EffectTriggerSpell[0] = 64467; // why do they need two script effects :/ (this one has visual effect) + break; + // Sanity + case 63050: + spellInfo->AttributesEx6 |= SPELL_ATTR6_CAN_TARGET_INVISIBLE; + break; + // Shadow Nova + case 62714: + case 65209: + spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; + break; + + // ALGALON + // Cosmic Smash (Algalon the Observer) case 62293: spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_CASTER; break; - // Cosmic Smash (Algalon the Observer) + // Cosmic Smash (Algalon the Observer) case 62311: case 64596: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - spellInfo->EffectRadiusIndex[0] = 12; // 100yd + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + spellInfo->EffectRadiusIndex[0] = 12; // 100yd spellInfo->rangeIndex = 13; // 50000yd break; - // Constellation Phase Effect - case 65509: - spellInfo->MaxAffectedTargets = 1; - break; - // Black Hole - case 62168: - case 65250: - case 62169: - spellInfo->Attributes |= SPELL_ATTR0_NEGATIVE_1; - break; + // Constellation Phase Effect + case 65509: + spellInfo->MaxAffectedTargets = 1; + break; + // Black Hole + case 62168: + case 65250: + case 62169: + spellInfo->Attributes |= SPELL_ATTR0_NEGATIVE_1; + break; - // TRASH - // Ground Slam - case 62625: - spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; - break; + // TRASH + // Ground Slam + case 62625: + spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; + break; - ////////////////////////////////////////// - ////////// ONYXIA'S LAIR - ////////////////////////////////////////// - // Onyxia's Lair, Onyxia, Flame Breath (TriggerSpell = 0 and spamming errors in console) - case 18435: - spellInfo->Effect[1] = 0; - break; - // Onyxia's Lair, Onyxia, Create Onyxia Spawner - case 17647: - spellInfo->DurationIndex = 37; - break; - // Onyxia's Lair, Onyxia, Summon Onyxia Whelp - case 17646: - // Onyxia's Lair, Onyxia, Summon Lair Guard - case 68968: - spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - spellInfo->rangeIndex = 13; - spellInfo->DurationIndex = 5; - break; - // Onyxia's Lair, Onyxia, Eruption: - case 17731: - case 69294: - spellInfo->Effect[1] = SPELL_EFFECT_DUMMY; - spellInfo->CastingTimeIndex = 3; - spellInfo->EffectRadiusIndex[1] = 19; // 18yd instead of 13yd to make sure all cracks erupt - break; - // Onyxia's Lair, Onyxia, Breath: - // TODO: fix it by IconId / SpellVisual - case 18576: case 18578: case 18579: case 18580: - case 18581: case 18582: case 18583: case 18609: case 18611: case 18612: case 18613: case 18614: - case 18615: case 18616: case 18584: case 18585: case 18586: case 18587: case 18588: case 18589: - case 18590: case 18591: case 18592: case 18593: case 18594: case 18595: case 18564: case 18565: - case 18566: case 18567: case 18568: case 18569: case 18570: case 18571: case 18572: case 18573: - case 18574: case 18575: case 18596: case 18597: case 18598: case 18599: case 18600: case 18601: - case 18602: case 18603: case 18604: case 18605: case 18606: case 18607: case 18617: case 18619: - case 18620: case 18621: case 18622: case 18623: case 18624: case 18625: case 18626: case 18627: - case 18628: case 18618: case 18351: case 18352: case 18353: case 18354: case 18355: case 18356: - case 18357: case 18358: case 18359: case 18360: case 18361: case 17086: case 17087: case 17088: - case 17089: case 17090: case 17091: case 17092: case 17093: case 17094: case 17095: case 17097: - case 22267: case 22268: case 21132: case 21133: case 21135: case 21136: case 21137: case 21138: - case 21139: - spellInfo->DurationIndex = 328; // 250ms - spellInfo->EffectImplicitTargetA[1] = 1; - if( spellInfo->Effect[1] ) - { - spellInfo->Effect[1] = SPELL_EFFECT_APPLY_AURA; - spellInfo->EffectApplyAuraName[1] = SPELL_AURA_PERIODIC_TRIGGER_SPELL; - spellInfo->EffectAmplitude[1] = ((spellInfo->CastingTimeIndex == 170) ? 50 : 215); - } - break; + ////////////////////////////////////////// + ////////// ONYXIA'S LAIR + ////////////////////////////////////////// + // Onyxia's Lair, Onyxia, Flame Breath (TriggerSpell = 0 and spamming errors in console) + case 18435: + spellInfo->Effect[1] = 0; + break; + // Onyxia's Lair, Onyxia, Create Onyxia Spawner + case 17647: + spellInfo->DurationIndex = 37; + break; + // Onyxia's Lair, Onyxia, Summon Onyxia Whelp + case 17646: + // Onyxia's Lair, Onyxia, Summon Lair Guard + case 68968: + spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + spellInfo->rangeIndex = 13; + spellInfo->DurationIndex = 5; + break; + // Onyxia's Lair, Onyxia, Eruption: + case 17731: + case 69294: + spellInfo->Effect[1] = SPELL_EFFECT_DUMMY; + spellInfo->CastingTimeIndex = 3; + spellInfo->EffectRadiusIndex[1] = 19; // 18yd instead of 13yd to make sure all cracks erupt + break; + // Onyxia's Lair, Onyxia, Breath: + // TODO: fix it by IconId / SpellVisual + case 18576: case 18578: case 18579: case 18580: + case 18581: case 18582: case 18583: case 18609: case 18611: case 18612: case 18613: case 18614: + case 18615: case 18616: case 18584: case 18585: case 18586: case 18587: case 18588: case 18589: + case 18590: case 18591: case 18592: case 18593: case 18594: case 18595: case 18564: case 18565: + case 18566: case 18567: case 18568: case 18569: case 18570: case 18571: case 18572: case 18573: + case 18574: case 18575: case 18596: case 18597: case 18598: case 18599: case 18600: case 18601: + case 18602: case 18603: case 18604: case 18605: case 18606: case 18607: case 18617: case 18619: + case 18620: case 18621: case 18622: case 18623: case 18624: case 18625: case 18626: case 18627: + case 18628: case 18618: case 18351: case 18352: case 18353: case 18354: case 18355: case 18356: + case 18357: case 18358: case 18359: case 18360: case 18361: case 17086: case 17087: case 17088: + case 17089: case 17090: case 17091: case 17092: case 17093: case 17094: case 17095: case 17097: + case 22267: case 22268: case 21132: case 21133: case 21135: case 21136: case 21137: case 21138: + case 21139: + spellInfo->DurationIndex = 328; // 250ms + spellInfo->EffectImplicitTargetA[1] = 1; + if( spellInfo->Effect[1] ) + { + spellInfo->Effect[1] = SPELL_EFFECT_APPLY_AURA; + spellInfo->EffectApplyAuraName[1] = SPELL_AURA_PERIODIC_TRIGGER_SPELL; + spellInfo->EffectAmplitude[1] = ((spellInfo->CastingTimeIndex == 170) ? 50 : 215); + } + break; - ////////////////////////////////////////// - ////////// THE NEXUS: OCULUS - ////////////////////////////////////////// - // Oculus, Teleport to Coldarra DND - case 48760: - // Oculus, Teleport to Boss 1 DND - case 49305: - spellInfo->EffectImplicitTargetA[0] = 25; - spellInfo->EffectImplicitTargetB[0] = 17; - break; - // Oculus, Drake spell Stop Time - case 49838: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - spellInfo->excludeTargetAuraSpell = 51162; // exclude planar shift - spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_150_YARDS; - break; - // Oculus, Varos Cloudstrider, Energize Cores - case 61407: - case 62136: - case 56251: - case 54069: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CONE_ENTRY; - spellInfo->EffectImplicitTargetB[0] = 0; - break; + ////////////////////////////////////////// + ////////// THE NEXUS: OCULUS + ////////////////////////////////////////// + // Oculus, Teleport to Coldarra DND + case 48760: + // Oculus, Teleport to Boss 1 DND + case 49305: + spellInfo->EffectImplicitTargetA[0] = 25; + spellInfo->EffectImplicitTargetB[0] = 17; + break; + // Oculus, Drake spell Stop Time + case 49838: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + spellInfo->excludeTargetAuraSpell = 51162; // exclude planar shift + spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_150_YARDS; + break; + // Oculus, Varos Cloudstrider, Energize Cores + case 61407: + case 62136: + case 56251: + case 54069: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CONE_ENTRY; + spellInfo->EffectImplicitTargetB[0] = 0; + break; - ////////////////////////////////////////// - ////////// HALLS OF LIGHTNING - ////////////////////////////////////////// - // Halls of Lightning, Arc Weld - case 59086: - spellInfo->EffectImplicitTargetA[0] = 1; - break; - // Halls of Lightning, Arcing Burn - case 52671: - case 59834: - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; - break; + ////////////////////////////////////////// + ////////// HALLS OF LIGHTNING + ////////////////////////////////////////// + // Halls of Lightning, Arc Weld + case 59086: + spellInfo->EffectImplicitTargetA[0] = 1; + break; + // Halls of Lightning, Arcing Burn + case 52671: + case 59834: + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; - ////////////////////////////////////////// - ////////// TRIAL OF THE CHAMPION - ////////////////////////////////////////// - // Trial of the Champion, Death's Respite - case 68306: - spellInfo->EffectImplicitTargetA[0] = 25; - spellInfo->EffectImplicitTargetA[1] = 25; - break; - // Trial of the Champion, Eadric Achievement (The Faceroller) - case 68197: - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ALLY; - spellInfo->Attributes |= SPELL_ATTR0_CASTABLE_WHILE_DEAD; - break; - // Trial of the Champion, Earth Shield - case 67530: - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PROC_TRIGGER_SPELL; // will trigger 67537 - break; - // Trial of the Champion, Hammer of the Righteous - case 66867: - spellInfo->Effect[0] = SPELL_EFFECT_DUMMY; - break; - // Trial of the Champion, Summon Risen Jaeren/Arelas - case 67705: - case 67715: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_DEAD; - break; - // Trial of the Champion, Ghoul Explode - case 67751: - spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENTRY; - spellInfo->EffectRadiusIndex[0] = 12; - spellInfo->EffectImplicitTargetA[1] = TARGET_SRC_CASTER; - spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_SRC_AREA_ENTRY; - spellInfo->EffectRadiusIndex[1] = 12; - spellInfo->EffectImplicitTargetA[2] = TARGET_SRC_CASTER; - spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_SRC_AREA_ENTRY; - spellInfo->EffectRadiusIndex[3] = 12; - break; - // Trial of the Champion, Desecration - case 67778: - case 67877: - spellInfo->EffectTriggerSpell[0] = 68766; - break; + ////////////////////////////////////////// + ////////// TRIAL OF THE CHAMPION + ////////////////////////////////////////// + // Trial of the Champion, Death's Respite + case 68306: + spellInfo->EffectImplicitTargetA[0] = 25; + spellInfo->EffectImplicitTargetA[1] = 25; + break; + // Trial of the Champion, Eadric Achievement (The Faceroller) + case 68197: + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ALLY; + spellInfo->Attributes |= SPELL_ATTR0_CASTABLE_WHILE_DEAD; + break; + // Trial of the Champion, Earth Shield + case 67530: + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PROC_TRIGGER_SPELL; // will trigger 67537 + break; + // Trial of the Champion, Hammer of the Righteous + case 66867: + spellInfo->Effect[0] = SPELL_EFFECT_DUMMY; + break; + // Trial of the Champion, Summon Risen Jaeren/Arelas + case 67705: + case 67715: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_DEAD; + break; + // Trial of the Champion, Ghoul Explode + case 67751: + spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENTRY; + spellInfo->EffectRadiusIndex[0] = 12; + spellInfo->EffectImplicitTargetA[1] = TARGET_SRC_CASTER; + spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_SRC_AREA_ENTRY; + spellInfo->EffectRadiusIndex[1] = 12; + spellInfo->EffectImplicitTargetA[2] = TARGET_SRC_CASTER; + spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_SRC_AREA_ENTRY; + spellInfo->EffectRadiusIndex[3] = 12; + break; + // Trial of the Champion, Desecration + case 67778: + case 67877: + spellInfo->EffectTriggerSpell[0] = 68766; + break; - ////////////////////////////////////////// - ////////// TRIAL OF THE CRUSADER - ////////////////////////////////////////// - // Trial of the Crusader, Jaraxxus Intro spell - case 67888: - spellInfo->Attributes |= SPELL_ATTR0_STOP_ATTACK_TARGET; - spellInfo->AttributesEx |= SPELL_ATTR1_NO_THREAT; - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - break; - // Trial of the Crusader, Lich King Intro spell - case 68193: - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENEMY; - break; - // Trial of the Crusader, Gormok, player vehicle spell, CUSTOM! (default jump to hand, not used) - case 66342: - spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA; - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_SET_VEHICLE_ID; - spellInfo->EffectMiscValue[0] = 496; - spellInfo->DurationIndex = 21; - spellInfo->rangeIndex = 13; - spellInfo->EffectImplicitTargetA[0] = 25; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_CHANGE_MAP; - break; - // Trial of the Crusader, Gormok, Fire Bomb - case 66313: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; - spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_TARGET_ANY; - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ANY; - spellInfo->EffectImplicitTargetB[1] = TARGET_DEST_TARGET_ANY; - spellInfo->Effect[1] = 0; - // no break intended - case 66317: - spellInfo->Attributes |= SPELL_ATTR0_STOP_ATTACK_TARGET; - spellInfo->AttributesEx |= SPELL_ATTR1_NO_THREAT; - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - break; - case 66318: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->speed = 14.0f; - spellInfo->Attributes |= SPELL_ATTR0_STOP_ATTACK_TARGET; - spellInfo->AttributesEx |= SPELL_ATTR1_NO_THREAT; - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - break; - case 66320: - case 67472: - case 67473: - case 67475: - spellInfo->EffectRadiusIndex[0] = 7; - spellInfo->EffectRadiusIndex[1] = 7; - break; - // Trial of the Crusader, Acidmaw & Dreadscale, Emerge - case 66947: - spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_STUNNED; - break; - // Trial of the Crusader, Jaraxxus, Curse of the Nether - case 66211: - spellInfo->excludeTargetAuraSpell = 66209; // exclude Touch of Jaraxxus - break; - // Trial of the Crusader, Jaraxxus, Summon Volcano - case 66258: - case 67901: - spellInfo->DurationIndex = 85; // summon for 18 seconds, 15 not enough - break; - // Trial of the Crusader, Jaraxxus, Spinning Pain Spike - case 66281: - spellInfo->EffectRadiusIndex[0] = 26; - break; - case 66287: - spellInfo->Effect[1] = SPELL_EFFECT_APPLY_AURA; - spellInfo->EffectApplyAuraName[1] = SPELL_AURA_MOD_TAUNT; - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_NEARBY_ENTRY; - spellInfo->Effect[2] = SPELL_EFFECT_APPLY_AURA; - spellInfo->EffectApplyAuraName[2] = SPELL_AURA_MOD_STUN; - spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_CASTER; - spellInfo->DurationIndex = 35; // 4 secs - break; - // Trial of the Crusader, Jaraxxus, Fel Fireball - case 66532: - case 66963: - case 66964: - case 66965: - spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; - break; - // tempfix, make Nether Power not stealable - case 66228: - case 67106: - case 67107: - case 67108: - spellInfo->AttributesEx4 |= SPELL_ATTR4_NOT_STEALABLE; - break; - // Trial of the Crusader, Faction Champions, Druid - Tranquality - case 66086: - case 67974: - case 67975: - case 67976: - spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AREA_AURA_FRIEND; - break; - // Trial of the Crusader, Faction Champions, Shaman - Earth Shield - case 66063: - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PROC_TRIGGER_SPELL; - spellInfo->EffectTriggerSpell[0] = 66064; - break; - // Trial of the Crusader, Faction Champions, Priest - Mana Burn - case 66100: - spellInfo->EffectBasePoints[0] = 5; - spellInfo->EffectDieSides[0] = 0; - break; - case 68026: - spellInfo->EffectBasePoints[0] = 8; - spellInfo->EffectDieSides[0] = 0; - break; - case 68027: - spellInfo->EffectBasePoints[0] = 6; - spellInfo->EffectDieSides[0] = 0; - break; - case 68028: - spellInfo->EffectBasePoints[0] = 10; - spellInfo->EffectDieSides[0] = 0; - break; + ////////////////////////////////////////// + ////////// TRIAL OF THE CRUSADER + ////////////////////////////////////////// + // Trial of the Crusader, Jaraxxus Intro spell + case 67888: + spellInfo->Attributes |= SPELL_ATTR0_STOP_ATTACK_TARGET; + spellInfo->AttributesEx |= SPELL_ATTR1_NO_THREAT; + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + break; + // Trial of the Crusader, Lich King Intro spell + case 68193: + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENEMY; + break; + // Trial of the Crusader, Gormok, player vehicle spell, CUSTOM! (default jump to hand, not used) + case 66342: + spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA; + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_SET_VEHICLE_ID; + spellInfo->EffectMiscValue[0] = 496; + spellInfo->DurationIndex = 21; + spellInfo->rangeIndex = 13; + spellInfo->EffectImplicitTargetA[0] = 25; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_CHANGE_MAP; + break; + // Trial of the Crusader, Gormok, Fire Bomb + case 66313: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; + spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_TARGET_ANY; + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ANY; + spellInfo->EffectImplicitTargetB[1] = TARGET_DEST_TARGET_ANY; + spellInfo->Effect[1] = 0; + // no break intended + case 66317: + spellInfo->Attributes |= SPELL_ATTR0_STOP_ATTACK_TARGET; + spellInfo->AttributesEx |= SPELL_ATTR1_NO_THREAT; + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + break; + case 66318: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->speed = 14.0f; + spellInfo->Attributes |= SPELL_ATTR0_STOP_ATTACK_TARGET; + spellInfo->AttributesEx |= SPELL_ATTR1_NO_THREAT; + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + break; + case 66320: + case 67472: + case 67473: + case 67475: + spellInfo->EffectRadiusIndex[0] = 7; + spellInfo->EffectRadiusIndex[1] = 7; + break; + // Trial of the Crusader, Acidmaw & Dreadscale, Emerge + case 66947: + spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_STUNNED; + break; + // Trial of the Crusader, Jaraxxus, Curse of the Nether + case 66211: + spellInfo->excludeTargetAuraSpell = 66209; // exclude Touch of Jaraxxus + break; + // Trial of the Crusader, Jaraxxus, Summon Volcano + case 66258: + case 67901: + spellInfo->DurationIndex = 85; // summon for 18 seconds, 15 not enough + break; + // Trial of the Crusader, Jaraxxus, Spinning Pain Spike + case 66281: + spellInfo->EffectRadiusIndex[0] = 26; + break; + case 66287: + spellInfo->Effect[1] = SPELL_EFFECT_APPLY_AURA; + spellInfo->EffectApplyAuraName[1] = SPELL_AURA_MOD_TAUNT; + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_NEARBY_ENTRY; + spellInfo->Effect[2] = SPELL_EFFECT_APPLY_AURA; + spellInfo->EffectApplyAuraName[2] = SPELL_AURA_MOD_STUN; + spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_CASTER; + spellInfo->DurationIndex = 35; // 4 secs + break; + // Trial of the Crusader, Jaraxxus, Fel Fireball + case 66532: + case 66963: + case 66964: + case 66965: + spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; + break; + // tempfix, make Nether Power not stealable + case 66228: + case 67106: + case 67107: + case 67108: + spellInfo->AttributesEx4 |= SPELL_ATTR4_NOT_STEALABLE; + break; + // Trial of the Crusader, Faction Champions, Druid - Tranquality + case 66086: + case 67974: + case 67975: + case 67976: + spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AREA_AURA_FRIEND; + break; + // Trial of the Crusader, Faction Champions, Shaman - Earth Shield + case 66063: + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PROC_TRIGGER_SPELL; + spellInfo->EffectTriggerSpell[0] = 66064; + break; + // Trial of the Crusader, Faction Champions, Priest - Mana Burn + case 66100: + spellInfo->EffectBasePoints[0] = 5; + spellInfo->EffectDieSides[0] = 0; + break; + case 68026: + spellInfo->EffectBasePoints[0] = 8; + spellInfo->EffectDieSides[0] = 0; + break; + case 68027: + spellInfo->EffectBasePoints[0] = 6; + spellInfo->EffectDieSides[0] = 0; + break; + case 68028: + spellInfo->EffectBasePoints[0] = 10; + spellInfo->EffectDieSides[0] = 0; + break; - // Trial of the Crusader, Twin Valkyr, Touch of Light/Darkness, Light/Dark Surge - case 65950: // light 0 - //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; - spellInfo->EffectImplicitTargetA[0] = 6; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; - case 65767: // light surge 0 - spellInfo->excludeTargetAuraSpell = 65686; - break; - case 67296: // light 1 - //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; - spellInfo->EffectImplicitTargetA[0] = 6; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; - case 67274: // light surge 1 - spellInfo->excludeTargetAuraSpell = 67222; - break; - case 67297: // light 2 - //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; - spellInfo->EffectImplicitTargetA[0] = 6; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; - case 67275: // light surge 2 - spellInfo->excludeTargetAuraSpell = 67223; - break; - case 67298: // light 3 - //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; - spellInfo->EffectImplicitTargetA[0] = 6; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; - case 67276: // light surge 3 - spellInfo->excludeTargetAuraSpell = 67224; - break; - case 66001: // dark 0 - //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; - spellInfo->EffectImplicitTargetA[0] = 6; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; - case 65769: // dark surge 0 - spellInfo->excludeTargetAuraSpell = 65684; - break; - case 67281: // dark 1 - //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; - spellInfo->EffectImplicitTargetA[0] = 6; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; - case 67265: // dark surge 1 - spellInfo->excludeTargetAuraSpell = 67176; - break; - case 67282: // dark 2 - //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; - spellInfo->EffectImplicitTargetA[0] = 6; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; - case 67266: // dark surge 2 - spellInfo->excludeTargetAuraSpell = 67177; - break; - case 67283: // dark 3 - //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; - spellInfo->EffectImplicitTargetA[0] = 6; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; - case 67267: // dark surge 3 - spellInfo->excludeTargetAuraSpell = 67178; - break; + // Trial of the Crusader, Twin Valkyr, Touch of Light/Darkness, Light/Dark Surge + case 65950: // light 0 + //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; + spellInfo->EffectImplicitTargetA[0] = 6; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; + case 65767: // light surge 0 + spellInfo->excludeTargetAuraSpell = 65686; + break; + case 67296: // light 1 + //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; + spellInfo->EffectImplicitTargetA[0] = 6; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; + case 67274: // light surge 1 + spellInfo->excludeTargetAuraSpell = 67222; + break; + case 67297: // light 2 + //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; + spellInfo->EffectImplicitTargetA[0] = 6; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; + case 67275: // light surge 2 + spellInfo->excludeTargetAuraSpell = 67223; + break; + case 67298: // light 3 + //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; + spellInfo->EffectImplicitTargetA[0] = 6; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; + case 67276: // light surge 3 + spellInfo->excludeTargetAuraSpell = 67224; + break; + case 66001: // dark 0 + //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; + spellInfo->EffectImplicitTargetA[0] = 6; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; + case 65769: // dark surge 0 + spellInfo->excludeTargetAuraSpell = 65684; + break; + case 67281: // dark 1 + //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; + spellInfo->EffectImplicitTargetA[0] = 6; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; + case 67265: // dark surge 1 + spellInfo->excludeTargetAuraSpell = 67176; + break; + case 67282: // dark 2 + //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; + spellInfo->EffectImplicitTargetA[0] = 6; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; + case 67266: // dark surge 2 + spellInfo->excludeTargetAuraSpell = 67177; + break; + case 67283: // dark 3 + //spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; + spellInfo->EffectImplicitTargetA[0] = 6; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; + case 67267: // dark surge 3 + spellInfo->excludeTargetAuraSpell = 67178; + break; - // Trial of the Crusader, Twin Valkyr, Twin's Pact - case 65875: case 67303: case 67304: case 67305: case 65876: case 67306: case 67307: case 67308: - spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; - break; - // Trial of the Crusader, Anub'arak, Emerge - case 65982: - spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_STUNNED; - break; - // Trial of the Crusader, Anub'arak, Penetrating Cold - case 66013: - case 67700: - case 68509: - case 68510: - spellInfo->EffectRadiusIndex[0] = 12; // 100yd - break; - // Trial of the Crusader, Anub'arak, Shadow Strike - case 66134: - spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; - spellInfo->Effect[0] = 0; - break; - // Trial of the Crusader, Anub'arak, Pursuing Spikes - case 65920: - case 65922: - case 65923: - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; - //spellInfo->EffectTriggerSpell[0] = 0; - break; - // Trial of the Crusader, Anub'arak, Summon Scarab - case 66339: - spellInfo->DurationIndex = 35; - spellInfo->EffectImplicitTargetA[0] = 25; - spellInfo->EffectImplicitTargetB[0] = 0; - break; - // Trial of the Crusader, Anub'arak, Achievements: The Traitor King - case 68186: // Anub'arak Scarab Achievement 10 - case 68515: // Anub'arak Scarab Achievement 25 - spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENEMY; - spellInfo->Attributes |= SPELL_ATTR0_CASTABLE_WHILE_DEAD; - break; - // Trial of the Crusader, Anub'arak, Spider Frenzy - case 66129: - spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; - break; + // Trial of the Crusader, Twin Valkyr, Twin's Pact + case 65875: case 67303: case 67304: case 67305: case 65876: case 67306: case 67307: case 67308: + spellInfo->Effect[1] = 0; spellInfo->Effect[2] = 0; + break; + // Trial of the Crusader, Anub'arak, Emerge + case 65982: + spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_STUNNED; + break; + // Trial of the Crusader, Anub'arak, Penetrating Cold + case 66013: + case 67700: + case 68509: + case 68510: + spellInfo->EffectRadiusIndex[0] = 12; // 100yd + break; + // Trial of the Crusader, Anub'arak, Shadow Strike + case 66134: + spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; + spellInfo->Effect[0] = 0; + break; + // Trial of the Crusader, Anub'arak, Pursuing Spikes + case 65920: + case 65922: + case 65923: + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DUMMY; + //spellInfo->EffectTriggerSpell[0] = 0; + break; + // Trial of the Crusader, Anub'arak, Summon Scarab + case 66339: + spellInfo->DurationIndex = 35; + spellInfo->EffectImplicitTargetA[0] = 25; + spellInfo->EffectImplicitTargetB[0] = 0; + break; + // Trial of the Crusader, Anub'arak, Achievements: The Traitor King + case 68186: // Anub'arak Scarab Achievement 10 + case 68515: // Anub'arak Scarab Achievement 25 + spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENEMY; + spellInfo->Attributes |= SPELL_ATTR0_CASTABLE_WHILE_DEAD; + break; + // Trial of the Crusader, Anub'arak, Spider Frenzy + case 66129: + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; - ////////////////////////////////////////// - ////////// THE FORGE OF SOULS - ////////////////////////////////////////// - // Soul Sickness (69131) - case 69131: - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_TRIGGER_SPELL; - spellInfo->EffectAmplitude[0] = 8000; - spellInfo->EffectTriggerSpell[0] = 69133; - break; - // Phantom Blast (68982,70322) - case 68982: - case 70322: - spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; - break; + ////////////////////////////////////////// + ////////// THE FORGE OF SOULS + ////////////////////////////////////////// + // Soul Sickness (69131) + case 69131: + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_TRIGGER_SPELL; + spellInfo->EffectAmplitude[0] = 8000; + spellInfo->EffectTriggerSpell[0] = 69133; + break; + // Phantom Blast (68982,70322) + case 68982: + case 70322: + spellInfo->InterruptFlags |= SPELL_INTERRUPT_FLAG_INTERRUPT; + break; - ////////////////////////////////////////// - ////////// PIT OF SARON - ////////////////////////////////////////// - // Empowered Blizzard - case 70131: - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - break; - // Ice Lance Volley - case 70464: - spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENTRY; - spellInfo->EffectRadiusIndex[0] = 25; - break; - // Multi-Shot - case 70513: - // Shriek of the Highborne - case 59514: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CONE_ENTRY; - spellInfo->EffectImplicitTargetB[0] = 0; - break; - // Icicle - case 69428: - case 69426: - spellInfo->InterruptFlags = 0; - spellInfo->AuraInterruptFlags = 0; - spellInfo->ChannelInterruptFlags = 0; - break; - // Jaina's Call - case 70525: - // Call of Sylvanas - case 70639: - spellInfo->Effect[0] = 0; - spellInfo->Effect[1] = 0; - spellInfo->EffectImplicitTargetA[2] = TARGET_SRC_CASTER; - spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_SRC_AREA_ENTRY; - spellInfo->EffectRadiusIndex[2] = 30; // 500yd - break; - // Frost Nova - case 68198: - spellInfo->rangeIndex = 13; - spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; - break; - // Blight - case 69604: - case 70286: - spellInfo->MaxAffectedTargets = 1; - spellInfo->AttributesEx3 |= (SPELL_ATTR3_IGNORE_HIT_RESULT | SPELL_ATTR3_ONLY_TARGET_PLAYERS); - break; - // Chilling Wave - case 68778: - case 70333: - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_TARGET_ENEMY; - spellInfo->EffectImplicitTargetB[0] = 0; - break; - // Permafrost - case 68786: - case 70336: - spellInfo->AttributesEx3 |= (SPELL_ATTR3_IGNORE_HIT_RESULT | SPELL_ATTR3_ONLY_TARGET_PLAYERS); - spellInfo->Effect[2] = SPELL_EFFECT_DUMMY; - break; - // Pursuit: - case 68987: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ANY; - spellInfo->EffectImplicitTargetB[1] = 0; - spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_CASTER; - spellInfo->EffectImplicitTargetB[2] = 0; - spellInfo->rangeIndex = 6; // 100yd - spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; - break; - case 69029: - case 70850: - spellInfo->Effect[2] = 0; - break; - // Explosive Barrage: - case 69263: - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_MOD_STUN; - break; - // Overlord's Brand: - case 69172: - spellInfo->procFlags = DONE_HIT_PROC_FLAG_MASK & ~PROC_FLAG_DONE_PERIODIC; - spellInfo->procChance = 100; - break; - // Icy Blast: - case 69232: - spellInfo->EffectTriggerSpell[1] = 69238; - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - case 69233: - case 69646: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - case 69238: - case 69628: - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_DYNOBJ_NONE; - spellInfo->EffectImplicitTargetA[1] = TARGET_DEST_DEST; - spellInfo->EffectImplicitTargetB[1] = TARGET_DEST_DYNOBJ_NONE; - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - // Hoarfrost: - case 69246: - case 69245: - case 69645: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - // Devour Humanoid: - case 69503: - spellInfo->ChannelInterruptFlags |= 0; - spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING; - break; + ////////////////////////////////////////// + ////////// PIT OF SARON + ////////////////////////////////////////// + // Empowered Blizzard + case 70131: + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + break; + // Ice Lance Volley + case 70464: + spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENTRY; + spellInfo->EffectRadiusIndex[0] = 25; + break; + // Multi-Shot + case 70513: + // Shriek of the Highborne + case 59514: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CONE_ENTRY; + spellInfo->EffectImplicitTargetB[0] = 0; + break; + // Icicle + case 69428: + case 69426: + spellInfo->InterruptFlags = 0; + spellInfo->AuraInterruptFlags = 0; + spellInfo->ChannelInterruptFlags = 0; + break; + // Jaina's Call + case 70525: + // Call of Sylvanas + case 70639: + spellInfo->Effect[0] = 0; + spellInfo->Effect[1] = 0; + spellInfo->EffectImplicitTargetA[2] = TARGET_SRC_CASTER; + spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_SRC_AREA_ENTRY; + spellInfo->EffectRadiusIndex[2] = 30; // 500yd + break; + // Frost Nova + case 68198: + spellInfo->rangeIndex = 13; + spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; + break; + // Blight + case 69604: + case 70286: + spellInfo->MaxAffectedTargets = 1; + spellInfo->AttributesEx3 |= (SPELL_ATTR3_IGNORE_HIT_RESULT | SPELL_ATTR3_ONLY_TARGET_PLAYERS); + break; + // Chilling Wave + case 68778: + case 70333: + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_TARGET_ENEMY; + spellInfo->EffectImplicitTargetB[0] = 0; + break; + // Permafrost + case 68786: + case 70336: + spellInfo->AttributesEx3 |= (SPELL_ATTR3_IGNORE_HIT_RESULT | SPELL_ATTR3_ONLY_TARGET_PLAYERS); + spellInfo->Effect[2] = SPELL_EFFECT_DUMMY; + break; + // Pursuit: + case 68987: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_TARGET_ANY; + spellInfo->EffectImplicitTargetB[1] = 0; + spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_CASTER; + spellInfo->EffectImplicitTargetB[2] = 0; + spellInfo->rangeIndex = 6; // 100yd + spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; + break; + case 69029: + case 70850: + spellInfo->Effect[2] = 0; + break; + // Explosive Barrage: + case 69263: + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_MOD_STUN; + break; + // Overlord's Brand: + case 69172: + spellInfo->procFlags = DONE_HIT_PROC_FLAG_MASK & ~PROC_FLAG_DONE_PERIODIC; + spellInfo->procChance = 100; + break; + // Icy Blast: + case 69232: + spellInfo->EffectTriggerSpell[1] = 69238; + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + case 69233: + case 69646: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + case 69238: + case 69628: + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_DYNOBJ_NONE; + spellInfo->EffectImplicitTargetA[1] = TARGET_DEST_DEST; + spellInfo->EffectImplicitTargetB[1] = TARGET_DEST_DYNOBJ_NONE; + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + // Hoarfrost: + case 69246: + case 69245: + case 69645: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + // Devour Humanoid: + case 69503: + spellInfo->ChannelInterruptFlags |= 0; + spellInfo->AuraInterruptFlags = AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING; + break; - ////////////////////////////////////////// - ////////// HALLS OF REFLECTION - ////////////////////////////////////////// - // Falric: Defiling Horror - case 72435: - case 72452: - spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; - spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; - break; - // Frostsworn General - Throw Shield - case 69222: - case 73076: - spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_TARGET_ENEMY; - break; - // Halls of Reflection Clone - case 69828: - spellInfo->Effect[1] = 0; - spellInfo->Effect[2] = 0; - break; - // Summon Ice Wall - case 69768: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; - break; - case 69767: - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_TARGET_ANY; - spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_TARGET_ANY; - break; - // Essence of the Captured - case 73035: - case 70719: - spellInfo->rangeIndex = 13; - break; - // Achievement Check - case 72830: - spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; - break; + ////////////////////////////////////////// + ////////// HALLS OF REFLECTION + ////////////////////////////////////////// + // Falric: Defiling Horror + case 72435: + case 72452: + spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; + spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; + break; + // Frostsworn General - Throw Shield + case 69222: + case 73076: + spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_TARGET_ENEMY; + break; + // Halls of Reflection Clone + case 69828: + spellInfo->Effect[1] = 0; + spellInfo->Effect[2] = 0; + break; + // Summon Ice Wall + case 69768: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; + break; + case 69767: + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_TARGET_ANY; + spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_TARGET_ANY; + break; + // Essence of the Captured + case 73035: + case 70719: + spellInfo->rangeIndex = 13; + break; + // Achievement Check + case 72830: + spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; + break; - ////////////////////////////////////////// - ////////// ICECROWN CITADEL - ////////////////////////////////////////// + ////////////////////////////////////////// + ////////// ICECROWN CITADEL + ////////////////////////////////////////// case 70781: // Light's Hammer Teleport case 70856: // Oratory of the Damned Teleport case 70857: // Rampart of Skulls Teleport @@ -5409,60 +5409,60 @@ void SpellMgr::LoadDbcDataCorrections() case 70859: // Upper Spire Teleport case 70860: // Frozen Throne Teleport case 70861: // Sindragosa's Lair Teleport - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; - spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; + spellInfo->EffectImplicitTargetB[0] = 0; spellInfo->EffectImplicitTargetA[1] = TARGET_DEST_DB; // this target is for SPELL_EFFECT_TELEPORT_UNITS - spellInfo->EffectImplicitTargetB[1] = 0; - spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_TARGET_ANY; - spellInfo->EffectImplicitTargetB[2] = 0; + spellInfo->EffectImplicitTargetB[1] = 0; + spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_TARGET_ANY; + spellInfo->EffectImplicitTargetB[2] = 0; + break; + case 70960: // Bone Flurry + case 71258: // Adrenaline Rush (Ymirjar Battle-Maiden) + spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_2; break; - case 70960: // Bone Flurry - case 71258: // Adrenaline Rush (Ymirjar Battle-Maiden) - spellInfo->AttributesEx &= ~SPELL_ATTR1_CHANNELED_2; - break; case 69055: // Saber Lash (Lord Marrowgar) case 70814: // Saber Lash (Lord Marrowgar) spellInfo->EffectRadiusIndex[0] = 8; // 5yd break; - case 69065: // Impaled (Lord Marrowgar) - spellInfo->Effect[0] = 0; // remove stun so Dispersion can be used - break; - case 72701: // Cold Flame (Lord Marrowgar) - case 72702: // Cold Flame (Lord Marrowgar) - case 72703: // Cold Flame (Lord Marrowgar) - case 72704: // Cold Flame (Lord Marrowgar) - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; - spellInfo->EffectImplicitTargetA[1] = TARGET_DEST_DEST; - spellInfo->EffectImplicitTargetB[1] = 0; - spellInfo->DurationIndex = 9; // 30 secs instead of 12, need him for longer, but will stop his actions after 12 secs - break; - case 69138: // Coldflame (Lord Marrowgar) - spellInfo->Effect[0] = 0; - spellInfo->EffectImplicitTargetA[1] = TARGET_DEST_DEST; - spellInfo->DurationIndex = 9; // 30 secs instead of 12, need him for longer, but will stop his actions after 12 secs - break; - case 69146: case 70823: case 70824: case 70825: // Coldflame (Lord Marrowgar) - spellInfo->EffectRadiusIndex[0] = 15; // 3yd instead of 5yd - spellInfo->AttributesEx4 &= ~SPELL_ATTR4_IGNORE_RESISTANCES; - break; - case 70897: // Dark Martyrdom (Lady Deathwhisper) - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_DEAD; - break; + case 69065: // Impaled (Lord Marrowgar) + spellInfo->Effect[0] = 0; // remove stun so Dispersion can be used + break; + case 72701: // Cold Flame (Lord Marrowgar) + case 72702: // Cold Flame (Lord Marrowgar) + case 72703: // Cold Flame (Lord Marrowgar) + case 72704: // Cold Flame (Lord Marrowgar) + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; + spellInfo->EffectImplicitTargetA[1] = TARGET_DEST_DEST; + spellInfo->EffectImplicitTargetB[1] = 0; + spellInfo->DurationIndex = 9; // 30 secs instead of 12, need him for longer, but will stop his actions after 12 secs + break; + case 69138: // Coldflame (Lord Marrowgar) + spellInfo->Effect[0] = 0; + spellInfo->EffectImplicitTargetA[1] = TARGET_DEST_DEST; + spellInfo->DurationIndex = 9; // 30 secs instead of 12, need him for longer, but will stop his actions after 12 secs + break; + case 69146: case 70823: case 70824: case 70825: // Coldflame (Lord Marrowgar) + spellInfo->EffectRadiusIndex[0] = 15; // 3yd instead of 5yd + spellInfo->AttributesEx4 &= ~SPELL_ATTR4_IGNORE_RESISTANCES; + break; + case 70897: // Dark Martyrdom (Lady Deathwhisper) + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_DEAD; + break; case 69075: // Bone Storm (Lord Marrowgar) case 70834: // Bone Storm (Lord Marrowgar) case 70835: // Bone Storm (Lord Marrowgar) case 70836: // Bone Storm (Lord Marrowgar) case 72378: // Blood Nova (Deathbringer Saurfang) case 73058: // Blood Nova (Deathbringer Saurfang) - case 72769: // Scent of Blood (Deathbringer Saurfang) - case 72385: // Boiling Blood (Deathbringer Saurfang) - case 72441: // Boiling Blood (Deathbringer Saurfang) - case 72442: // Boiling Blood (Deathbringer Saurfang) - case 72443: // Boiling Blood (Deathbringer Saurfang) + case 72769: // Scent of Blood (Deathbringer Saurfang) + case 72385: // Boiling Blood (Deathbringer Saurfang) + case 72441: // Boiling Blood (Deathbringer Saurfang) + case 72442: // Boiling Blood (Deathbringer Saurfang) + case 72443: // Boiling Blood (Deathbringer Saurfang) case 71160: // Plague Stench (Stinky) case 71161: // Plague Stench (Stinky) case 71123: // Decimate (Stinky & Precious) - case 71464: // Divine Surge (Sister Svalna) + case 71464: // Divine Surge (Sister Svalna) spellInfo->EffectRadiusIndex[0] = 12; // 100yd break; case 71169: // Shadow's Fate @@ -5475,70 +5475,70 @@ void SpellMgr::LoadDbcDataCorrections() case 73844: // Award Reputation - Boss Kill case 73845: // Award Reputation - Boss Kill case 73846: // Award Reputation - Boss Kill - spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_50000_YARDS; + spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_50000_YARDS; + break; + case 72864: // Death Plague (Rotting Frost Giant) + spellInfo->excludeTargetAuraSpell = 0; + break; + case 69705: // Gunship Battle, spell Below Zero + spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; break; - case 72864: // Death Plague (Rotting Frost Giant) - spellInfo->excludeTargetAuraSpell = 0; - break; - case 69705: // Gunship Battle, spell Below Zero - spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; - break; case 72723: // Resistant Skin (Deathbringer Saurfang adds) // this spell initially granted Shadow damage immunity, however it was removed but the data was left in client spellInfo->Effect[2] = 0; break; - case 72255: // Mark of the Fallen Champion (Deathbringer Saurfang) // Patch 3.3.2 (2010-01-02): Deathbringer Saurfang will no longer gain blood power from Mark of the Fallen Champion. - case 72444: // Mark of the Fallen Champion (Deathbringer Saurfang) // Xinef: prevented in script, effect needed for Prayer of Mending - case 72445: // Mark of the Fallen Champion (Deathbringer Saurfang) - case 72446: // Mark of the Fallen Champion (Deathbringer Saurfang) - spellInfo->AttributesEx3 &= ~SPELL_ATTR3_CANT_TRIGGER_PROC; - break; + case 72255: // Mark of the Fallen Champion (Deathbringer Saurfang) // Patch 3.3.2 (2010-01-02): Deathbringer Saurfang will no longer gain blood power from Mark of the Fallen Champion. + case 72444: // Mark of the Fallen Champion (Deathbringer Saurfang) // Xinef: prevented in script, effect needed for Prayer of Mending + case 72445: // Mark of the Fallen Champion (Deathbringer Saurfang) + case 72446: // Mark of the Fallen Champion (Deathbringer Saurfang) + spellInfo->AttributesEx3 &= ~SPELL_ATTR3_CANT_TRIGGER_PROC; + break; case 70460: // Coldflame Jets (Traps after Saurfang) spellInfo->DurationIndex = 1; // 10 seconds - break; - case 70461: // Coldflame Jets (Traps after Saurfang) - case 71289: // Dominate Mind (Lady Deathwhisper) - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; break; - case 71906: // Severed Essence (Val'kyr Herald) - case 71942: // Severed Essence (Val'kyr Herald) - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ENEMY; - spellInfo->EffectImplicitTargetB[0] = 0; - spellInfo->Effect[1] = 0; - break; + case 70461: // Coldflame Jets (Traps after Saurfang) + case 71289: // Dominate Mind (Lady Deathwhisper) + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + case 71906: // Severed Essence (Val'kyr Herald) + case 71942: // Severed Essence (Val'kyr Herald) + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ENEMY; + spellInfo->EffectImplicitTargetB[0] = 0; + spellInfo->Effect[1] = 0; + break; case 71159: // Awaken Plagued Zombies (Precious) - case 71302: // Awaken Ymirjar Fallen (Ymirjar Deathbringer) + case 71302: // Awaken Ymirjar Fallen (Ymirjar Deathbringer) spellInfo->DurationIndex = 21; break; - case 70981: // Blood Prince Council, Invocation of Blood - case 70982: // Blood Prince Council, Invocation of Blood - case 70952: // Blood Prince Council, Invocation of Blood - spellInfo->Effect[0] = 0; // clear share health aura - break; - case 71274: // Ymirjar Frostbinder, Frozen Orb - spellInfo->EffectImplicitTargetA[0] = 6; - break; - case 69783: // Ooze Flood (Rotface) - case 69797: - case 69799: - case 69802: - spellInfo->AttributesEx |= SPELL_ATTR1_CANT_TARGET_SELF; - break; - case 70530: // Volatile Ooze Beam Protection - spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA; // blizzard typo, 65 instead of 6, aura itself is defined (dummy) - break; - case 70672: case 72455: case 72832: case 72833: // Professor Putricide, Gaseous Bloat (Orange Ooze Channel) -- copied attributes from Green Ooze Channel - spellInfo->Attributes |= SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY; - spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; - break; + case 70981: // Blood Prince Council, Invocation of Blood + case 70982: // Blood Prince Council, Invocation of Blood + case 70952: // Blood Prince Council, Invocation of Blood + spellInfo->Effect[0] = 0; // clear share health aura + break; + case 71274: // Ymirjar Frostbinder, Frozen Orb + spellInfo->EffectImplicitTargetA[0] = 6; + break; + case 69783: // Ooze Flood (Rotface) + case 69797: + case 69799: + case 69802: + spellInfo->AttributesEx |= SPELL_ATTR1_CANT_TARGET_SELF; + break; + case 70530: // Volatile Ooze Beam Protection + spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA; // blizzard typo, 65 instead of 6, aura itself is defined (dummy) + break; + case 70672: case 72455: case 72832: case 72833: // Professor Putricide, Gaseous Bloat (Orange Ooze Channel) -- copied attributes from Green Ooze Channel + spellInfo->Attributes |= SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY; + spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; + break; case 71412: // Green Ooze Summon (Professor Putricide) case 71415: // Orange Ooze Summon (Professor Putricide) spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; break; - case 71621: case 72850: case 72851: case 72852: // Create Concoction (Professor Putricide) - case 71893: case 73120: case 73121: case 73122: // Guzzle Potions (Professor Putricide) - spellInfo->CastingTimeIndex = 15; // 4 sec - break; + case 71621: case 72850: case 72851: case 72852: // Create Concoction (Professor Putricide) + case 71893: case 73120: case 73121: case 73122: // Guzzle Potions (Professor Putricide) + spellInfo->CastingTimeIndex = 15; // 4 sec + break; case 72454: // Mutated Plague (Professor Putricide) case 72464: // Mutated Plague (Professor Putricide) case 72506: // Mutated Plague (Professor Putricide) @@ -5552,12 +5552,12 @@ void SpellMgr::LoadDbcDataCorrections() case 72856: // Unbound Plague (Professor Putricide) (needs target selection script) spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ENEMY; break; - case 70402: // Mutated Transformation (Professor Putricide) - case 72511: // Mutated Transformation (Professor Putricide) - case 72512: // Mutated Transformation (Professor Putricide) - case 72513: // Mutated Transformation (Professor Putricide) - spellInfo->AttributesEx2 |= SPELL_ATTR2_CANT_CRIT; - break; + case 70402: // Mutated Transformation (Professor Putricide) + case 72511: // Mutated Transformation (Professor Putricide) + case 72512: // Mutated Transformation (Professor Putricide) + case 72513: // Mutated Transformation (Professor Putricide) + spellInfo->AttributesEx2 |= SPELL_ATTR2_CANT_CRIT; + break; case 71708: // Empowered Flare (Blood Prince Council) case 72785: // Empowered Flare (Blood Prince Council) case 72786: // Empowered Flare (Blood Prince Council) @@ -5573,11 +5573,11 @@ void SpellMgr::LoadDbcDataCorrections() case 72890: // Swarming Shadows spellInfo->AreaGroupId = 0; // originally, these require area 4522, which is... outside of Icecrown Citadel break; - case 71301: // Summon Dream Portal (Valithria Dreamwalker) - case 71977: // Summon Nightmare Portal (Valithria Dreamwalker) - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - spellInfo->EffectImplicitTargetB[0] = 0; - break; + case 71301: // Summon Dream Portal (Valithria Dreamwalker) + case 71977: // Summon Nightmare Portal (Valithria Dreamwalker) + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + spellInfo->EffectImplicitTargetB[0] = 0; + break; case 70715: // Column of Frost (visual marker) spellInfo->DurationIndex = 32; // 6 seconds (missing) break; @@ -5598,54 +5598,54 @@ void SpellMgr::LoadDbcDataCorrections() case 70598: // Sindragosa's Fury spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; break; - case 71077: // Tail Smash (Sindragosa) - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_CASTER_BACK; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_DEST_AREA_ENEMY; - spellInfo->EffectImplicitTargetA[1] = TARGET_DEST_CASTER_BACK; - spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_DEST_AREA_ENEMY; - break; + case 71077: // Tail Smash (Sindragosa) + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_CASTER_BACK; + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_DEST_AREA_ENEMY; + spellInfo->EffectImplicitTargetA[1] = TARGET_DEST_CASTER_BACK; + spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_DEST_AREA_ENEMY; + break; case 69846: // Frost Bomb spellInfo->speed = 0.0f; // This spell's summon happens instantly break; - case 70127: // Mystic Buffet (Sindragosa) - remove obsolete spell effect with no targets - case 72528: - case 72529: - case 72530: - spellInfo->Effect[1] = 0; - break; - case 70084: // Sindragosa, Frost Aura - case 71050: - case 71051: - case 71052: - spellInfo->Attributes &= ~SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY; - break; + case 70127: // Mystic Buffet (Sindragosa) - remove obsolete spell effect with no targets + case 72528: + case 72529: + case 72530: + spellInfo->Effect[1] = 0; + break; + case 70084: // Sindragosa, Frost Aura + case 71050: + case 71051: + case 71052: + spellInfo->Attributes &= ~SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY; + break; case 71614: // Ice Lock spellInfo->Mechanic = MECHANIC_STUN; break; - case 70541: // Lich King, Infest - case 73779: - case 73780: - case 73781: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - case 70337: // Lich King, Necrotic Plague - case 73912: - case 73913: - case 73914: - case 70338: - case 73785: - case 73786: - case 73787: - spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; - break; - case 69099: // Ice Pulse 10n - case 73776: // Ice Pulse 25n - case 73777: // Ice Pulse 10h - case 73778: // Ice Pulse 25h - spellInfo->AttributesEx2 |= SPELL_ATTR2_CANT_CRIT; - spellInfo->AttributesEx4 &= ~SPELL_ATTR4_IGNORE_RESISTANCES; - break; + case 70541: // Lich King, Infest + case 73779: + case 73780: + case 73781: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + case 70337: // Lich King, Necrotic Plague + case 73912: + case 73913: + case 73914: + case 70338: + case 73785: + case 73786: + case 73787: + spellInfo->AttributesEx3 |= SPELL_ATTR3_IGNORE_HIT_RESULT; + break; + case 69099: // Ice Pulse 10n + case 73776: // Ice Pulse 25n + case 73777: // Ice Pulse 10h + case 73778: // Ice Pulse 25h + spellInfo->AttributesEx2 |= SPELL_ATTR2_CANT_CRIT; + spellInfo->AttributesEx4 &= ~SPELL_ATTR4_IGNORE_RESISTANCES; + break; case 72350: // Fury of Frostmourne spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_50000_YARDS; // 50000yd @@ -5688,8 +5688,8 @@ void SpellMgr::LoadDbcDataCorrections() case 72762: // Defile spellInfo->DurationIndex = 559; // 53 seconds spellInfo->excludeCasterAuraSpell = 0; - spellInfo->Attributes |= SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY; - spellInfo->AttributesEx6 |= (SPELL_ATTR6_CAN_TARGET_INVISIBLE | SPELL_ATTR6_CAN_TARGET_UNTARGETABLE); + spellInfo->Attributes |= SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY; + spellInfo->AttributesEx6 |= (SPELL_ATTR6_CAN_TARGET_INVISIBLE | SPELL_ATTR6_CAN_TARGET_UNTARGETABLE); break; case 72743: // Defile spellInfo->DurationIndex = 22; // 45 seconds @@ -5742,285 +5742,285 @@ void SpellMgr::LoadDbcDataCorrections() case 73582: // Trigger Vile Spirit (Inside, Heroic) spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd break; - // Scale Aura (used during Dominate Mind from Lady Deathwhisper) - case 73261: - spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CHANGE_MAP; - break; - // Leap to a Random Location - case 70485: - spellInfo->rangeIndex = 6; // 100yd - spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_10_YARDS; - spellInfo->EffectMiscValue[0] = 100; - break; - // Empowered Blood - case 70227: - case 70232: - spellInfo->AreaGroupId = 2452; // Whole icc instead of Crimson Halls only, remove when area calculation is fixed - break; - - ////////////////////////////////////////// - ////////// RUBY SANCTUN - ////////////////////////////////////////// - // Repelling Wave - case 74509: - spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_20_YARDS; - spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_20_YARDS; - break; - // Rallying Shout - case 75414: - spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_20_YARDS; - break; - // Barrier Channel - case 76221: - spellInfo->ChannelInterruptFlags &= ~(AURA_INTERRUPT_FLAG_TURNING|AURA_INTERRUPT_FLAG_MOVE); - spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_UNIT_NEARBY_ENTRY; - break; - // Intimidating Roar - case 74384: - spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_100_YARDS; - spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_100_YARDS; - break; - // Fiery Combustion - case 74562: - // Soul Consumption - case 74792: - spellInfo->AttributesEx |= SPELL_ATTR1_CANT_BE_REDIRECTED; - break; - // Combustion - case 75883: - case 75884: - spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_6_YARDS; - spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_6_YARDS; - break; - // Consumption - case 75875: - case 75876: - spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_6_YARDS; - spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_6_YARDS; - spellInfo->EffectMechanic[EFFECT_0] = 0; - spellInfo->EffectMechanic[EFFECT_1] = MECHANIC_SNARE; - break; - // Soul Consumption - case 74799: - spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_12_YARDS; + // Scale Aura (used during Dominate Mind from Lady Deathwhisper) + case 73261: + spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CHANGE_MAP; break; - // Twilight Cutter + // Leap to a Random Location + case 70485: + spellInfo->rangeIndex = 6; // 100yd + spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_10_YARDS; + spellInfo->EffectMiscValue[0] = 100; + break; + // Empowered Blood + case 70227: + case 70232: + spellInfo->AreaGroupId = 2452; // Whole icc instead of Crimson Halls only, remove when area calculation is fixed + break; + + ////////////////////////////////////////// + ////////// RUBY SANCTUN + ////////////////////////////////////////// + // Repelling Wave + case 74509: + spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_20_YARDS; + spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_20_YARDS; + break; + // Rallying Shout + case 75414: + spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_20_YARDS; + break; + // Barrier Channel + case 76221: + spellInfo->ChannelInterruptFlags &= ~(AURA_INTERRUPT_FLAG_TURNING|AURA_INTERRUPT_FLAG_MOVE); + spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_UNIT_NEARBY_ENTRY; + break; + // Intimidating Roar + case 74384: + spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_100_YARDS; + spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_100_YARDS; + break; + // Fiery Combustion + case 74562: + // Soul Consumption + case 74792: + spellInfo->AttributesEx |= SPELL_ATTR1_CANT_BE_REDIRECTED; + break; + // Combustion + case 75883: + case 75884: + spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_6_YARDS; + spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_6_YARDS; + break; + // Consumption + case 75875: + case 75876: + spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_6_YARDS; + spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_6_YARDS; + spellInfo->EffectMechanic[EFFECT_0] = 0; + spellInfo->EffectMechanic[EFFECT_1] = MECHANIC_SNARE; + break; + // Soul Consumption + case 74799: + spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_12_YARDS; + break; + // Twilight Cutter case 74769: case 77844: case 77845: case 77846: - spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_100_YARDS; + spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_100_YARDS; break; - // Twilight Mending + // Twilight Mending case 75509: spellInfo->AttributesEx6 |= SPELL_ATTR6_CAN_TARGET_INVISIBLE; spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_100_YARDS; - spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_100_YARDS; + spellInfo->EffectRadiusIndex[EFFECT_0] = EFFECT_RADIUS_100_YARDS; + spellInfo->EffectRadiusIndex[EFFECT_1] = EFFECT_RADIUS_100_YARDS; + break; + // Meteor Strike + case 74637: + spellInfo->speed = 0; break; - // Meteor Strike - case 74637: - spellInfo->speed = 0; - break; - // /////////////////////////////////////////// - // ////////////////QUESTS///////////////////// - // /////////////////////////////////////////// - // Going Bearback (12851) - case 54897: - spellInfo->Effect[1] = SPELL_EFFECT_DUMMY; - spellInfo->EffectRadiusIndex[1] = spellInfo->EffectRadiusIndex[0]; - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_DEST_AREA_ENTRY; - break; - // Still At It (12644) - case 51931: - case 51932: - case 51933: - spellInfo->EffectImplicitTargetA[0] = 38; - spellInfo->EffectImplicitTargetB[0] = 0; - break; - // Rallying the Troops (12070) - case 47394: - spellInfo->excludeTargetAuraSpell = 47394; - break; - // A Tangled Skein (12555) - case 51165: - case 51173: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - break; - // A Cloudlet of Classy Cologne (24635) - case 69563: - // A Perfect Puff of Perfume (24629) - case 69445: - // Bonbon Blitz (24636) - case 69489: - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_CASTER; - break; - // Control (9595) - case 30790: - spellInfo->EffectMiscValue[1] = 0; - break; - // Reclusive Runemaster (12150) - case 48028: - spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENEMY; - break; - // Mastery of - case 65147: - spellInfo->Category = 1244; - spellInfo->CategoryRecoveryTime = 1500; - break; - // Weakness to Lightning (11896) - case 46432: - spellInfo->AttributesEx3 &= ~SPELL_ATTR3_DEATH_PERSISTENT; - break; - // Wrangle Some Aether Rays! (11065) - case 40856: - spellInfo->DurationIndex = 27; // 3000ms - break; - // The Black Knight's Orders (13663) - case 63163: - spellInfo->EffectBasePoints[0] = 52390; - break; - // The Warp Rifts (10278) - case 34888: - spellInfo->DurationIndex = 5; // 300 secs - break; - // The Smallest Creatures (10720) - case 38544: - spellInfo->EffectMiscValueB[0] = 427; - spellInfo->EffectImplicitTargetA[0] = 1; - spellInfo->Effect[1] = 0; - break; - // Ridding the red rocket - case 49177: - spellInfo->EffectBasePoints[0] = 1; // corrects seat id (points - 1 = seatId) - break; - // The Iron Colossus (13007) - case 56513: - case 56524: - spellInfo->RecoveryTime = (spellInfo->Id == 56524 ? 6000 : 2000); - break; - // Kaw the Mammoth Destroyer (11879) - case 46260: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - // That's Abominable (13264)(13276)(13288)(13289) - case 59565: - spellInfo->EffectMiscValueB[0] = 1721; // controlable guardian - break; - // Investigate the Blue Recluse (1920) - // Investigate the Alchemist Shop (1960) - case 9095: - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_DUMMY; - spellInfo->EffectRadiusIndex[0] = 13; - break; - // Dragonmaw Race: All parts - case 40890: // Oldie's Rotten Pumpkin - spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; - spellInfo->EffectTriggerSpell[0] = 40905; - spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - break; - case 40909: // Trope's Slime Cannon - spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; - spellInfo->EffectTriggerSpell[0] = 40905; - spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - break; - case 40894: // Corlok's Skull Barrage - spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; - spellInfo->EffectTriggerSpell[0] = 40900; - spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - break; - case 40928: // Ichman's Blazing Fireball - spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; - spellInfo->EffectTriggerSpell[0] = 40929; - spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - break; - case 40930: // Mulverick's Great Balls of Lightning - spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; - spellInfo->EffectTriggerSpell[0] = 40931; - spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - break; - case 40945: // Sky Shatter - spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; - spellInfo->EffectTriggerSpell[0] = 41064; - spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - break; - // Gauging the Resonant Frequency (10594) - case 37390: - spellInfo->EffectMiscValueB[0] = 181; - break; - // Where in the World is Hemet Nesingwary? (12521) - case 50860: - spellInfo->EffectBasePoints[0] = 50860; - break; - case 50861: - spellInfo->EffectBasePoints[0] = 0; - break; - // Krolmir, Hammer of Storms (13010) - case 56606: - case 56541: - spellInfo->EffectBasePoints[0] = 1; - break; - // Blightbeasts be Damned! (12072) - case 47424: - spellInfo->AuraInterruptFlags &= ~AURA_INTERRUPT_FLAG_NOT_ABOVEWATER; - break; - // Leading the Charge (13380), All Infra-Green bomber quests - case 59059: - spellInfo->AttributesEx4 &= ~SPELL_ATTR4_CAN_CAST_WHILE_CASTING; - break; - // Dark Horizon (12664), Reunited (12663) - case 52190: - spellInfo->EffectBasePoints[EFFECT_0] = 52391-1; - break; - // The Sum is Greater than the Parts (13043) - Chained Grip - case 60540: - spellInfo->EffectMiscValue[EFFECT_0] = 300; - break; - // Not a Bug (13342) - case 60531: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_DEAD; - break; - // Frankly, It Makes No Sense... (10672) - case 37851: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - break; - // Honor Challenge (12939) - case 21855: - spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; - break; + // /////////////////////////////////////////// + // ////////////////QUESTS///////////////////// + // /////////////////////////////////////////// + // Going Bearback (12851) + case 54897: + spellInfo->Effect[1] = SPELL_EFFECT_DUMMY; + spellInfo->EffectRadiusIndex[1] = spellInfo->EffectRadiusIndex[0]; + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_DEST_AREA_ENTRY; + break; + // Still At It (12644) + case 51931: + case 51932: + case 51933: + spellInfo->EffectImplicitTargetA[0] = 38; + spellInfo->EffectImplicitTargetB[0] = 0; + break; + // Rallying the Troops (12070) + case 47394: + spellInfo->excludeTargetAuraSpell = 47394; + break; + // A Tangled Skein (12555) + case 51165: + case 51173: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + break; + // A Cloudlet of Classy Cologne (24635) + case 69563: + // A Perfect Puff of Perfume (24629) + case 69445: + // Bonbon Blitz (24636) + case 69489: + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_CASTER; + break; + // Control (9595) + case 30790: + spellInfo->EffectMiscValue[1] = 0; + break; + // Reclusive Runemaster (12150) + case 48028: + spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENEMY; + break; + // Mastery of + case 65147: + spellInfo->Category = 1244; + spellInfo->CategoryRecoveryTime = 1500; + break; + // Weakness to Lightning (11896) + case 46432: + spellInfo->AttributesEx3 &= ~SPELL_ATTR3_DEATH_PERSISTENT; + break; + // Wrangle Some Aether Rays! (11065) + case 40856: + spellInfo->DurationIndex = 27; // 3000ms + break; + // The Black Knight's Orders (13663) + case 63163: + spellInfo->EffectBasePoints[0] = 52390; + break; + // The Warp Rifts (10278) + case 34888: + spellInfo->DurationIndex = 5; // 300 secs + break; + // The Smallest Creatures (10720) + case 38544: + spellInfo->EffectMiscValueB[0] = 427; + spellInfo->EffectImplicitTargetA[0] = 1; + spellInfo->Effect[1] = 0; + break; + // Ridding the red rocket + case 49177: + spellInfo->EffectBasePoints[0] = 1; // corrects seat id (points - 1 = seatId) + break; + // The Iron Colossus (13007) + case 56513: + case 56524: + spellInfo->RecoveryTime = (spellInfo->Id == 56524 ? 6000 : 2000); + break; + // Kaw the Mammoth Destroyer (11879) + case 46260: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + // That's Abominable (13264)(13276)(13288)(13289) + case 59565: + spellInfo->EffectMiscValueB[0] = 1721; // controlable guardian + break; + // Investigate the Blue Recluse (1920) + // Investigate the Alchemist Shop (1960) + case 9095: + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_DUMMY; + spellInfo->EffectRadiusIndex[0] = 13; + break; + // Dragonmaw Race: All parts + case 40890: // Oldie's Rotten Pumpkin + spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; + spellInfo->EffectTriggerSpell[0] = 40905; + spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + break; + case 40909: // Trope's Slime Cannon + spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; + spellInfo->EffectTriggerSpell[0] = 40905; + spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + break; + case 40894: // Corlok's Skull Barrage + spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; + spellInfo->EffectTriggerSpell[0] = 40900; + spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + break; + case 40928: // Ichman's Blazing Fireball + spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; + spellInfo->EffectTriggerSpell[0] = 40929; + spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + break; + case 40930: // Mulverick's Great Balls of Lightning + spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; + spellInfo->EffectTriggerSpell[0] = 40931; + spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + break; + case 40945: // Sky Shatter + spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION; + spellInfo->EffectTriggerSpell[0] = 41064; + spellInfo->Effect[0] = SPELL_EFFECT_TRIGGER_MISSILE; + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + break; + // Gauging the Resonant Frequency (10594) + case 37390: + spellInfo->EffectMiscValueB[0] = 181; + break; + // Where in the World is Hemet Nesingwary? (12521) + case 50860: + spellInfo->EffectBasePoints[0] = 50860; + break; + case 50861: + spellInfo->EffectBasePoints[0] = 0; + break; + // Krolmir, Hammer of Storms (13010) + case 56606: + case 56541: + spellInfo->EffectBasePoints[0] = 1; + break; + // Blightbeasts be Damned! (12072) + case 47424: + spellInfo->AuraInterruptFlags &= ~AURA_INTERRUPT_FLAG_NOT_ABOVEWATER; + break; + // Leading the Charge (13380), All Infra-Green bomber quests + case 59059: + spellInfo->AttributesEx4 &= ~SPELL_ATTR4_CAN_CAST_WHILE_CASTING; + break; + // Dark Horizon (12664), Reunited (12663) + case 52190: + spellInfo->EffectBasePoints[EFFECT_0] = 52391-1; + break; + // The Sum is Greater than the Parts (13043) - Chained Grip + case 60540: + spellInfo->EffectMiscValue[EFFECT_0] = 300; + break; + // Not a Bug (13342) + case 60531: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_DEAD; + break; + // Frankly, It Makes No Sense... (10672) + case 37851: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + break; + // Honor Challenge (12939) + case 21855: + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; + break; // /////////////////////////////////////////// - // ////////////////ITEMS////////////////////// - // /////////////////////////////////////////// + // ////////////////ITEMS////////////////////// + // /////////////////////////////////////////// // enchant Lightweave Embroidery case 55637: spellInfo->EffectMiscValue[1] = 126; break; - // Magic Broom - case 47977: - spellInfo->Effect[0] = 0; - spellInfo->Effect[1] = 0; - break; - // Titanium Seal of Dalaran, Toss your luck - case 60476: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; - break; - // Mind Amplification Dish, change charm aura - case 26740: - spellInfo->EffectApplyAuraName[0] = SPELL_AURA_MOD_CHARM; - break; - // Persistent Shield (fixes idiocity) + // Magic Broom + case 47977: + spellInfo->Effect[0] = 0; + spellInfo->Effect[1] = 0; + break; + // Titanium Seal of Dalaran, Toss your luck + case 60476: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; + break; + // Mind Amplification Dish, change charm aura + case 26740: + spellInfo->EffectApplyAuraName[0] = SPELL_AURA_MOD_CHARM; + break; + // Persistent Shield (fixes idiocity) case 26467: spellInfo->EffectApplyAuraName[0] = SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE; spellInfo->EffectTriggerSpell[0] = 26470; @@ -6029,186 +6029,186 @@ void SpellMgr::LoadDbcDataCorrections() case 31255: spellInfo->EffectTriggerSpell[0] = 22588; break; - // Black Magic enchant - case 59630: - spellInfo->Attributes |= SPELL_ATTR0_PASSIVE; - break; - // Precious's Ribbon - case 72968: - spellInfo->AttributesEx3 |= SPELL_ATTR3_DEATH_PERSISTENT; - break; - // Item - Bauble of True Blood 10m - // Item - Bauble of True Blood 25m + // Black Magic enchant + case 59630: + spellInfo->Attributes |= SPELL_ATTR0_PASSIVE; + break; + // Precious's Ribbon + case 72968: + spellInfo->AttributesEx3 |= SPELL_ATTR3_DEATH_PERSISTENT; + break; + // Item - Bauble of True Blood 10m + // Item - Bauble of True Blood 25m case 71646: - case 71607: - // Item - Althor's Abacus trigger 10m - // Item - Althor's Abacus trigger 25m - case 71610: - case 71641: - spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; - spellInfo->spellLevel = 0; - break; - // Drain Life - Bryntroll Normal / Heroic + case 71607: + // Item - Althor's Abacus trigger 10m + // Item - Althor's Abacus trigger 25m + case 71610: + case 71641: + spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; + spellInfo->spellLevel = 0; + break; + // Drain Life - Bryntroll Normal / Heroic case 71838: case 71839: spellInfo->AttributesEx2 |= SPELL_ATTR2_CANT_CRIT; - spellInfo->AttributesEx4 |= SPELL_ATTR4_IGNORE_RESISTANCES; + spellInfo->AttributesEx4 |= SPELL_ATTR4_IGNORE_RESISTANCES; + break; + // Alchemist's Stone + case 17619: + spellInfo->AttributesEx3 |= SPELL_ATTR3_DEATH_PERSISTENT; + break; + // Gnomish Death Ray + case 13278: + case 13280: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ENEMY; + break; + // Stormchops + case 43730: + spellInfo->EffectImplicitTargetA[1] = 1; + spellInfo->EffectImplicitTargetB[1] = 0; + break; + // Savory Deviate Delight (transformations), allow to mount while transformed + case 8219: + case 8220: + case 8221: + case 8222: + spellInfo->Attributes &= ~SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY; + break; + // Clamlette Magnifique + case 72623: // drink triggered spell + spellInfo->EffectBasePoints[EFFECT_0] = spellInfo->EffectBasePoints[EFFECT_1]; + break; + // Compact Harvest Reaper + case 4078: + spellInfo->DurationIndex = 6; // 10 minutes + break; + // Dragon Kite, Tuskarr Kite - Kite String + case 45192: + spellInfo->rangeIndex = 6; // 100yd + break; + // Frigid Frostling, Infrigidate + case 74960: + spellInfo->EffectRadiusIndex[EFFECT_0] = 9; // 20yd break; - // Alchemist's Stone - case 17619: - spellInfo->AttributesEx3 |= SPELL_ATTR3_DEATH_PERSISTENT; - break; - // Gnomish Death Ray - case 13278: - case 13280: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ENEMY; - break; - // Stormchops - case 43730: - spellInfo->EffectImplicitTargetA[1] = 1; - spellInfo->EffectImplicitTargetB[1] = 0; - break; - // Savory Deviate Delight (transformations), allow to mount while transformed - case 8219: - case 8220: - case 8221: - case 8222: - spellInfo->Attributes &= ~SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY; - break; - // Clamlette Magnifique - case 72623: // drink triggered spell - spellInfo->EffectBasePoints[EFFECT_0] = spellInfo->EffectBasePoints[EFFECT_1]; - break; - // Compact Harvest Reaper - case 4078: - spellInfo->DurationIndex = 6; // 10 minutes - break; - // Dragon Kite, Tuskarr Kite - Kite String - case 45192: - spellInfo->rangeIndex = 6; // 100yd - break; - // Frigid Frostling, Infrigidate - case 74960: - spellInfo->EffectRadiusIndex[EFFECT_0] = 9; // 20yd - break; - // /////////////////////////////////////////// - // ////////////////EVENTS///////////////////// - // /////////////////////////////////////////// + // /////////////////////////////////////////// + // ////////////////EVENTS///////////////////// + // /////////////////////////////////////////// - ////////////////////////////////////////// - ////////// BREWFEST - ////////////////////////////////////////// - // Apple Trap - case 43450: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_SRC_AREA_ENEMY; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_CASTER; - spellInfo->Effect[0] = SPELL_EFFECT_DUMMY; - break; - // Dark Iron Attack - spawn mole machine - case 43563: - spellInfo->Effect[2] = 0; // summon GO's manually - break; - // Throw Mug visual - case 42300: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; - break; - // Dark Iron knockback Aura - case 42299: - spellInfo->EffectApplyAuraName[1] = SPELL_AURA_DUMMY; - spellInfo->EffectMiscValue[0] = 100; - spellInfo->EffectBasePoints[0] = 79; - break; - // Chug and Chuck! - case 42436: - spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; - spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENTRY; - spellInfo->MaxAffectedTargets = 0; - spellInfo->excludeCasterAuraSpell = 42299; - break; - // Catch the Wild Wolpertinger! - case 41621: - spellInfo->Effect[0] = SPELL_EFFECT_DUMMY; - break; - // Brewfest quests - case 47134: - case 51798: - spellInfo->Effect[0] = 0; - break; - // The Heart of The Storms (12998) - case 43528: - spellInfo->DurationIndex = 18; - spellInfo->EffectImplicitTargetA[0] = 25; - break; + ////////////////////////////////////////// + ////////// BREWFEST + ////////////////////////////////////////// + // Apple Trap + case 43450: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_SRC_AREA_ENEMY; + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_CASTER; + spellInfo->Effect[0] = SPELL_EFFECT_DUMMY; + break; + // Dark Iron Attack - spawn mole machine + case 43563: + spellInfo->Effect[2] = 0; // summon GO's manually + break; + // Throw Mug visual + case 42300: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY; + break; + // Dark Iron knockback Aura + case 42299: + spellInfo->EffectApplyAuraName[1] = SPELL_AURA_DUMMY; + spellInfo->EffectMiscValue[0] = 100; + spellInfo->EffectBasePoints[0] = 79; + break; + // Chug and Chuck! + case 42436: + spellInfo->EffectImplicitTargetA[0] = TARGET_SRC_CASTER; + spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_SRC_AREA_ENTRY; + spellInfo->MaxAffectedTargets = 0; + spellInfo->excludeCasterAuraSpell = 42299; + break; + // Catch the Wild Wolpertinger! + case 41621: + spellInfo->Effect[0] = SPELL_EFFECT_DUMMY; + break; + // Brewfest quests + case 47134: + case 51798: + spellInfo->Effect[0] = 0; + break; + // The Heart of The Storms (12998) + case 43528: + spellInfo->DurationIndex = 18; + spellInfo->EffectImplicitTargetA[0] = 25; + break; - ////////////////////////////////////////// - ////////// Hallow's End - ////////////////////////////////////////// - // Water splash - case 42348: - spellInfo->Effect[0] = 0; - break; - // Summon Lantersn - case 44255: - case 44231: - spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; - spellInfo->EffectImplicitTargetB[0] = 0; - break; - // Throw Head Back - case 42401: - spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_NEARBY_ENTRY; - break; + ////////////////////////////////////////// + ////////// Hallow's End + ////////////////////////////////////////// + // Water splash + case 42348: + spellInfo->Effect[0] = 0; + break; + // Summon Lantersn + case 44255: + case 44231: + spellInfo->EffectImplicitTargetA[0] = TARGET_DEST_DEST; + spellInfo->EffectImplicitTargetB[0] = 0; + break; + // Throw Head Back + case 42401: + spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_NEARBY_ENTRY; + break; - ////////////////////////////////////////// - ////////// Pilgrim's Bounty - ////////////////////////////////////////// - // Various food - case 65418: - spellInfo->EffectTriggerSpell[2] = 65410; - break; - case 65422: - spellInfo->EffectTriggerSpell[2] = 65414; - break; - case 65419: - spellInfo->EffectTriggerSpell[2] = 65416; - break; - case 65420: - spellInfo->EffectTriggerSpell[2] = 65412; - break; - case 65421: - spellInfo->EffectTriggerSpell[2] = 65415; - break; + ////////////////////////////////////////// + ////////// Pilgrim's Bounty + ////////////////////////////////////////// + // Various food + case 65418: + spellInfo->EffectTriggerSpell[2] = 65410; + break; + case 65422: + spellInfo->EffectTriggerSpell[2] = 65414; + break; + case 65419: + spellInfo->EffectTriggerSpell[2] = 65416; + break; + case 65420: + spellInfo->EffectTriggerSpell[2] = 65412; + break; + case 65421: + spellInfo->EffectTriggerSpell[2] = 65415; + break; - ////////////////////////////////////////// - ////////// Midsummer - ////////////////////////////////////////// - // Stamp Out Bonfire - case 45437: - spellInfo->Effect[1] = SPELL_EFFECT_DUMMY; - spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_NEARBY_ENTRY; - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - // Light Bonfire (DND) - case 29831: - spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; - break; - ////////////////////////////////////////// - ////////// Misc Events - ////////////////////////////////////////// - // Infernal - case 33240: - spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_DEST_TARGET_ANY; - spellInfo->EffectImplicitTargetA[EFFECT_1] = TARGET_UNIT_TARGET_ANY; - spellInfo->EffectImplicitTargetA[EFFECT_2] = TARGET_UNIT_TARGET_ANY; - break; + ////////////////////////////////////////// + ////////// Midsummer + ////////////////////////////////////////// + // Stamp Out Bonfire + case 45437: + spellInfo->Effect[1] = SPELL_EFFECT_DUMMY; + spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_NEARBY_ENTRY; + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + // Light Bonfire (DND) + case 29831: + spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; + break; + ////////////////////////////////////////// + ////////// Misc Events + ////////////////////////////////////////// + // Infernal + case 33240: + spellInfo->EffectImplicitTargetA[EFFECT_0] = TARGET_DEST_TARGET_ANY; + spellInfo->EffectImplicitTargetA[EFFECT_1] = TARGET_UNIT_TARGET_ANY; + spellInfo->EffectImplicitTargetA[EFFECT_2] = TARGET_UNIT_TARGET_ANY; + break; } switch (spellInfo->SpellFamilyName) { case SPELLFAMILY_PALADIN: // Seals of the Pure should affect Seal of Righteousness - if (spellInfo->SpellIconID == 25 && (spellInfo->Attributes & SPELL_ATTR0_PASSIVE)) + if (spellInfo->SpellIconID == 25 && (spellInfo->Attributes & SPELL_ATTR0_PASSIVE)) spellInfo->EffectSpellClassMask[0][1] |= 0x20000000; break; case SPELLFAMILY_DEATHKNIGHT: @@ -6219,98 +6219,98 @@ void SpellMgr::LoadDbcDataCorrections() } } - // Xinef: The Veiled Sea area in outlands (Draenei zone), client blocks casting flying mounts - for (uint32 i = 0; i < sAreaStore.GetNumRows(); ++i) - if (AreaTableEntry* areaEntry = const_cast(sAreaStore.LookupEntry(i))) - { - if (areaEntry->ID == 3479) - areaEntry->flags |= AREA_FLAG_NO_FLY_ZONE; - // Xinef: Dun Morogh, Kharanos tavern, missing resting flag - else if (areaEntry->ID == 2102) - areaEntry->flags |= AREA_FLAG_REST_ZONE_ALLIANCE; - } + // Xinef: The Veiled Sea area in outlands (Draenei zone), client blocks casting flying mounts + for (uint32 i = 0; i < sAreaStore.GetNumRows(); ++i) + if (AreaTableEntry* areaEntry = const_cast(sAreaStore.LookupEntry(i))) + { + if (areaEntry->ID == 3479) + areaEntry->flags |= AREA_FLAG_NO_FLY_ZONE; + // Xinef: Dun Morogh, Kharanos tavern, missing resting flag + else if (areaEntry->ID == 2102) + areaEntry->flags |= AREA_FLAG_REST_ZONE_ALLIANCE; + } - // Xinef: fix for something? + // Xinef: fix for something? SummonPropertiesEntry* properties = const_cast(sSummonPropertiesStore.LookupEntry(121)); properties->Type = SUMMON_TYPE_TOTEM; properties = const_cast(sSummonPropertiesStore.LookupEntry(647)); // 52893 properties->Type = SUMMON_TYPE_TOTEM; - // Correct Pet Size - CreatureDisplayInfoEntry* displayEntry = const_cast(sCreatureDisplayInfoStore.LookupEntry(17028)); // Kurken - displayEntry->scale = 2.5f; + // Correct Pet Size + CreatureDisplayInfoEntry* displayEntry = const_cast(sCreatureDisplayInfoStore.LookupEntry(17028)); // Kurken + displayEntry->scale = 2.5f; - // Oracles and Frenzyheart faction - FactionEntry* factionEntry = const_cast(sFactionStore.LookupEntry(1104)); - factionEntry->ReputationFlags[0] = 0; - factionEntry = const_cast(sFactionStore.LookupEntry(1105)); - factionEntry->ReputationFlags[0] = 0; + // Oracles and Frenzyheart faction + FactionEntry* factionEntry = const_cast(sFactionStore.LookupEntry(1104)); + factionEntry->ReputationFlags[0] = 0; + factionEntry = const_cast(sFactionStore.LookupEntry(1105)); + factionEntry->ReputationFlags[0] = 0; - // Various factions, added 14, 16 to hostile mask - FactionTemplateEntry* factionTemplateEntry = const_cast(sFactionTemplateStore.LookupEntry(1978)); // Warsong Offensive - factionTemplateEntry->hostileMask |= 8; - factionTemplateEntry = const_cast(sFactionTemplateStore.LookupEntry(1921)); // The Taunka - factionTemplateEntry->hostileMask |= 8; + // Various factions, added 14, 16 to hostile mask + FactionTemplateEntry* factionTemplateEntry = const_cast(sFactionTemplateStore.LookupEntry(1978)); // Warsong Offensive + factionTemplateEntry->hostileMask |= 8; + factionTemplateEntry = const_cast(sFactionTemplateStore.LookupEntry(1921)); // The Taunka + factionTemplateEntry->hostileMask |= 8; - // Remove vehicles attr, making accessories selectable - VehicleSeatEntry* vse = const_cast(sVehicleSeatStore.LookupEntry(4689)); // Siege Engine, Accessory - vse->m_flags &= ~VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE; - vse = const_cast(sVehicleSeatStore.LookupEntry(4692)); // Siege Engine, Accessory - vse->m_flags &= ~VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE; - vse = const_cast(sVehicleSeatStore.LookupEntry(4693)); // Siege Engine, Accessory - vse->m_flags &= ~VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE; - vse = const_cast(sVehicleSeatStore.LookupEntry(3011)); // Salvaged Demolisher, Ulduar - not allow to change seats - vse->m_flags &= ~VEHICLE_SEAT_FLAG_CAN_SWITCH; - vse = const_cast(sVehicleSeatStore.LookupEntry(3077)); // Salvaged Demolisher Seat, Ulduar - not allow to change seats - vse->m_flags &= ~VEHICLE_SEAT_FLAG_CAN_SWITCH; + // Remove vehicles attr, making accessories selectable + VehicleSeatEntry* vse = const_cast(sVehicleSeatStore.LookupEntry(4689)); // Siege Engine, Accessory + vse->m_flags &= ~VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE; + vse = const_cast(sVehicleSeatStore.LookupEntry(4692)); // Siege Engine, Accessory + vse->m_flags &= ~VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE; + vse = const_cast(sVehicleSeatStore.LookupEntry(4693)); // Siege Engine, Accessory + vse->m_flags &= ~VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE; + vse = const_cast(sVehicleSeatStore.LookupEntry(3011)); // Salvaged Demolisher, Ulduar - not allow to change seats + vse->m_flags &= ~VEHICLE_SEAT_FLAG_CAN_SWITCH; + vse = const_cast(sVehicleSeatStore.LookupEntry(3077)); // Salvaged Demolisher Seat, Ulduar - not allow to change seats + vse->m_flags &= ~VEHICLE_SEAT_FLAG_CAN_SWITCH; - // pussywizard: fix z offset for some vehicles: - vse = const_cast(sVehicleSeatStore.LookupEntry(6206)); // Marrowgar - Bone Spike - vse->m_attachmentOffsetZ = 4.0f; - vse = const_cast(sVehicleSeatStore.LookupEntry(3806)); // Mimiron - seat on VX-001 for ACU during last phase - vse->m_attachmentOffsetZ = 15.0f; - vse = const_cast(sVehicleSeatStore.LookupEntry(3566)); // Mimiron - Working seat - vse->m_attachmentOffsetX = -3.5f; - vse->m_attachmentOffsetY = 0.0f; - vse = const_cast(sVehicleSeatStore.LookupEntry(3567)); // Mimiron - Working seat - vse->m_attachmentOffsetX = 2.3f; - vse->m_attachmentOffsetY = -2.3f; + // pussywizard: fix z offset for some vehicles: + vse = const_cast(sVehicleSeatStore.LookupEntry(6206)); // Marrowgar - Bone Spike + vse->m_attachmentOffsetZ = 4.0f; + vse = const_cast(sVehicleSeatStore.LookupEntry(3806)); // Mimiron - seat on VX-001 for ACU during last phase + vse->m_attachmentOffsetZ = 15.0f; + vse = const_cast(sVehicleSeatStore.LookupEntry(3566)); // Mimiron - Working seat + vse->m_attachmentOffsetX = -3.5f; + vse->m_attachmentOffsetY = 0.0f; + vse = const_cast(sVehicleSeatStore.LookupEntry(3567)); // Mimiron - Working seat + vse->m_attachmentOffsetX = 2.3f; + vse->m_attachmentOffsetY = -2.3f; - // Pilgrim's Bounty offsets - vse = const_cast(sVehicleSeatStore.LookupEntry(2841)); - vse->m_attachmentOffsetX += 1.65f; - vse->m_attachmentOffsetY += 0.75f; - vse = const_cast(sVehicleSeatStore.LookupEntry(2842)); - vse->m_attachmentOffsetX += 1.6f; - vse->m_attachmentOffsetY += -1.0f; - vse = const_cast(sVehicleSeatStore.LookupEntry(2843)); - vse->m_attachmentOffsetX += -1.2f; - vse->m_attachmentOffsetY += 0.2f; - vse = const_cast(sVehicleSeatStore.LookupEntry(2844)); - vse->m_attachmentOffsetX += -0.1f; - vse->m_attachmentOffsetY += -1.6f; - vse = const_cast(sVehicleSeatStore.LookupEntry(2845)); - vse->m_attachmentOffsetX += 0.0f; - vse->m_attachmentOffsetY += 1.6f; + // Pilgrim's Bounty offsets + vse = const_cast(sVehicleSeatStore.LookupEntry(2841)); + vse->m_attachmentOffsetX += 1.65f; + vse->m_attachmentOffsetY += 0.75f; + vse = const_cast(sVehicleSeatStore.LookupEntry(2842)); + vse->m_attachmentOffsetX += 1.6f; + vse->m_attachmentOffsetY += -1.0f; + vse = const_cast(sVehicleSeatStore.LookupEntry(2843)); + vse->m_attachmentOffsetX += -1.2f; + vse->m_attachmentOffsetY += 0.2f; + vse = const_cast(sVehicleSeatStore.LookupEntry(2844)); + vse->m_attachmentOffsetX += -0.1f; + vse->m_attachmentOffsetY += -1.6f; + vse = const_cast(sVehicleSeatStore.LookupEntry(2845)); + vse->m_attachmentOffsetX += 0.0f; + vse->m_attachmentOffsetY += 1.6f; - // Once Bitten, Twice Shy (10 player) - Icecrown Citadel + // Once Bitten, Twice Shy (10 player) - Icecrown Citadel AchievementEntry* achievement = const_cast(sAchievementStore.LookupEntry(4539)); achievement->mapID = 631; // Correct map requirement (currently has Ulduar) - // Ring of Valor starting Locations - WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(1364); - const_cast(entry)->z += 6.0f; - entry = sWorldSafeLocsStore.LookupEntry(1365); - const_cast(entry)->z += 6.0f; + // Ring of Valor starting Locations + WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(1364); + const_cast(entry)->z += 6.0f; + entry = sWorldSafeLocsStore.LookupEntry(1365); + const_cast(entry)->z += 6.0f; sLog->outString(">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 9b63b0f32..52775cd89 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -213,8 +213,8 @@ enum ProcFlagsExLegacy PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always no matter of hit result PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // If set trigger always but only one time (not implemented yet) PROC_EX_ONLY_ACTIVE_SPELL = 0x0040000, // Spell has to do damage/heal to proc - PROC_EX_NO_OVERHEAL = 0x0080000, // Proc if heal did some work - PROC_EX_NO_AURA_REFRESH = 0x0100000, // Proc if aura was not refreshed + PROC_EX_NO_OVERHEAL = 0x0080000, // Proc if heal did some work + PROC_EX_NO_AURA_REFRESH = 0x0100000, // Proc if aura was not refreshed // Flags for internal use - do not use these in db! PROC_EX_INTERNAL_CANT_PROC = 0x0800000, @@ -326,41 +326,41 @@ typedef UNORDERED_MAP SpellBonusMap; enum SpellGroupSpecialFlags { - SPELL_GROUP_SPECIAL_FLAG_NONE = 0x000, - SPELL_GROUP_SPECIAL_FLAG_ELIXIR_BATTLE = 0x001, - SPELL_GROUP_SPECIAL_FLAG_ELIXIR_GUARDIAN = 0x002, - SPELL_GROUP_SPECIAL_FLAG_ELIXIR_UNSTABLE = 0x004, - SPELL_GROUP_SPECIAL_FLAG_ELIXIR_SHATTRATH = 0x008, - SPELL_GROUP_SPECIAL_FLAG_STACK_EXCLUSIVE_MAX= 0x00F, - SPELL_GROUP_SPECIAL_FLAG_FORCED_STRONGEST = 0x010, // xinef: specially helpful flag if some spells have different auras, but only one should be present - SPELL_GROUP_SPECIAL_FLAG_SKIP_STRONGER_CHECK= 0x020, - SPELL_GROUP_SPECIAL_FLAG_BASE_AMOUNT_CHECK = 0x040, - SPELL_GROUP_SPECIAL_FLAG_PRIORITY1 = 0x100, - SPELL_GROUP_SPECIAL_FLAG_PRIORITY2 = 0x200, - SPELL_GROUP_SPECIAL_FLAG_PRIORITY3 = 0x400, - SPELL_GROUP_SPECIAL_FLAG_PRIORITY4 = 0x800, - SPELL_GROUP_SPECIAL_FLAG_MAX = 0x1000, + SPELL_GROUP_SPECIAL_FLAG_NONE = 0x000, + SPELL_GROUP_SPECIAL_FLAG_ELIXIR_BATTLE = 0x001, + SPELL_GROUP_SPECIAL_FLAG_ELIXIR_GUARDIAN = 0x002, + SPELL_GROUP_SPECIAL_FLAG_ELIXIR_UNSTABLE = 0x004, + SPELL_GROUP_SPECIAL_FLAG_ELIXIR_SHATTRATH = 0x008, + SPELL_GROUP_SPECIAL_FLAG_STACK_EXCLUSIVE_MAX= 0x00F, + SPELL_GROUP_SPECIAL_FLAG_FORCED_STRONGEST = 0x010, // xinef: specially helpful flag if some spells have different auras, but only one should be present + SPELL_GROUP_SPECIAL_FLAG_SKIP_STRONGER_CHECK= 0x020, + SPELL_GROUP_SPECIAL_FLAG_BASE_AMOUNT_CHECK = 0x040, + SPELL_GROUP_SPECIAL_FLAG_PRIORITY1 = 0x100, + SPELL_GROUP_SPECIAL_FLAG_PRIORITY2 = 0x200, + SPELL_GROUP_SPECIAL_FLAG_PRIORITY3 = 0x400, + SPELL_GROUP_SPECIAL_FLAG_PRIORITY4 = 0x800, + SPELL_GROUP_SPECIAL_FLAG_MAX = 0x1000, }; enum SpellGroupStackFlags { - SPELL_GROUP_STACK_FLAG_NONE = 0x00, - SPELL_GROUP_STACK_FLAG_EXCLUSIVE = 0x01, - SPELL_GROUP_STACK_FLAG_NOT_SAME_CASTER = 0x02, - SPELL_GROUP_STACK_FLAG_FLAGGED = 0x04, // xinef: just a marker - SPELL_GROUP_STACK_FLAG_NEVER_STACK = 0x08, - SPELL_GROUP_STACK_FLAG_EFFECT_EXCLUSIVE = 0x10, - SPELL_GROUP_STACK_FLAG_MAX = 0x20, + SPELL_GROUP_STACK_FLAG_NONE = 0x00, + SPELL_GROUP_STACK_FLAG_EXCLUSIVE = 0x01, + SPELL_GROUP_STACK_FLAG_NOT_SAME_CASTER = 0x02, + SPELL_GROUP_STACK_FLAG_FLAGGED = 0x04, // xinef: just a marker + SPELL_GROUP_STACK_FLAG_NEVER_STACK = 0x08, + SPELL_GROUP_STACK_FLAG_EFFECT_EXCLUSIVE = 0x10, + SPELL_GROUP_STACK_FLAG_MAX = 0x20, - // Internal use - SPELL_GROUP_STACK_FLAG_FORCED_STRONGEST = 0x100, - SPELL_GROUP_STACK_FLAG_FORCED_WEAKEST = 0x200, + // Internal use + SPELL_GROUP_STACK_FLAG_FORCED_STRONGEST = 0x100, + SPELL_GROUP_STACK_FLAG_FORCED_WEAKEST = 0x200, }; struct SpellStackInfo { - uint32 groupId; - SpellGroupSpecialFlags specialFlags; + uint32 groupId; + SpellGroupSpecialFlags specialFlags; }; // spell_id, group_id typedef std::map SpellGroupMap; @@ -619,7 +619,7 @@ class SpellMgr // Spell correctness for client using static bool ComputeIsSpellValid(SpellInfo const* spellInfo, bool msg = true); static bool IsSpellValid(SpellInfo const* spellInfo); - static bool CheckSpellValid(SpellInfo const* spellInfo, uint32 spellId, bool isTalent); + static bool CheckSpellValid(SpellInfo const* spellInfo, uint32 spellId, bool isTalent); // Spell difficulty uint32 GetSpellDifficultyId(uint32 spellId) const; @@ -650,10 +650,10 @@ class SpellMgr // Spell Groups uint32 GetSpellGroup(uint32 spellid) const; - SpellGroupSpecialFlags GetSpellGroupSpecialFlags(uint32 spell_id) const; - SpellGroupStackFlags GetGroupStackFlags(uint32 groupid) const; + SpellGroupSpecialFlags GetSpellGroupSpecialFlags(uint32 spell_id) const; + SpellGroupStackFlags GetGroupStackFlags(uint32 groupid) const; SpellGroupStackFlags CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2, bool remove, bool areaAura) const; - void GetSetOfSpellsInSpellGroupWithFlag(uint32 group_id, SpellGroupSpecialFlags flag, std::set& availableElixirs) const; + void GetSetOfSpellsInSpellGroupWithFlag(uint32 group_id, SpellGroupSpecialFlags flag, std::set& availableElixirs) const; // Spell proc event table SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const; @@ -669,8 +669,8 @@ class SpellMgr // Spell threat table SpellThreatEntry const* GetSpellThreatEntry(uint32 spellID) const; - // Spell mixology table - float GetSpellMixologyBonus(uint32 spellId) const; + // Spell mixology table + float GetSpellMixologyBonus(uint32 spellId) const; SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const; @@ -695,8 +695,8 @@ class SpellMgr SpellInfo const* GetSpellInfo(uint32 spellId) const { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : NULL; } uint32 GetSpellInfoStoreSize() const { return mSpellInfoMap.size(); } - // Talent Additional Set - bool IsAdditionalTalentSpell(uint32 spellId) const; + // Talent Additional Set + bool IsAdditionalTalentSpell(uint32 spellId) const; // Modifiers public: @@ -714,7 +714,7 @@ class SpellMgr void LoadSpellProcs(); void LoadSpellBonusess(); void LoadSpellThreats(); - void LoadSpellMixology(); + void LoadSpellMixology(); void LoadSkillLineAbilityMap(); void LoadSpellPetAuras(); void LoadEnchantCustomAttr(); @@ -728,7 +728,7 @@ class SpellMgr void UnloadSpellInfoImplicitTargetConditionLists(); void LoadSpellCustomAttr(); void LoadDbcDataCorrections(); - void LoadSpellSpecificAndAuraState(); + void LoadSpellSpecificAndAuraState(); private: SpellDifficultySearcherMap mSpellDifficultySearcherMap; @@ -743,7 +743,7 @@ class SpellMgr SpellProcMap mSpellProcMap; SpellBonusMap mSpellBonusMap; SpellThreatMap mSpellThreatMap; - SpellMixologyMap mSpellMixologyMap; + SpellMixologyMap mSpellMixologyMap; SpellPetAuraMap mSpellPetAuraMap; SpellLinkedMap mSpellLinkedMap; SpellEnchantProcEventMap mSpellEnchantProcEventMap; @@ -757,7 +757,7 @@ class SpellMgr PetLevelupSpellMap mPetLevelupSpellMap; PetDefaultSpellsMap mPetDefaultSpellsMap; // only spells not listed in related mPetLevelupSpellMap entry SpellInfoMap mSpellInfoMap; - TalentAdditionalSet mTalentSpellAdditionalSet; + TalentAdditionalSet mTalentSpellAdditionalSet; }; #define sSpellMgr ACE_Singleton::instance() diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index a0e692b98..f54e78870 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -619,7 +619,7 @@ void SpellScript::FinishCast(SpellCastResult result) void SpellScript::Cancel() { - m_spell->cancel(); + m_spell->cancel(); } void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result) @@ -642,7 +642,7 @@ bool AuraScript::_Validate(SpellInfo const* entry) { for (std::list::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr) if (!entry->HasAreaAuraEffect() && !entry->HasEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA)) - sLog->outError("TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + sLog->outError("TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = OnDispel.begin(); itr != OnDispel.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index d07affbf3..004116629 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -208,7 +208,7 @@ class SpellScript : public _SpellScript TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area, bool _dest); bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex); std::string ToString(); - uint16 GetTarget() const { return targetType; } + uint16 GetTarget() const { return targetType; } protected: uint16 targetType; bool area; @@ -427,7 +427,7 @@ class SpellScript : public _SpellScript // finishes spellcast prematurely with selected error message void FinishCast(SpellCastResult result); - void Cancel(); // pussywizard + void Cancel(); // pussywizard void SetCustomCastResultMessage(SpellCustomErrors result); }; diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index 00ab36e0c..976907e21 100644 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -244,9 +244,9 @@ void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder } float dist = GetRangeForChatType(msgType); - // xinef: hack for boss emote - if (msgType == CHAT_MSG_RAID_BOSS_EMOTE && source->GetMap()->IsDungeon()) - dist = 250.0f; + // xinef: hack for boss emote + if (msgType == CHAT_MSG_RAID_BOSS_EMOTE && source->GetMap()->IsDungeon()) + dist = 250.0f; Trinity::PlayerDistWorker > worker(source, dist, localizer); source->VisitNearbyWorldObject(dist, worker); diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 34b74d1d2..bae1251a8 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -676,7 +676,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s CharacterDatabase.CommitTransaction(trans); // in case of name conflict player has to rename at login anyway - sWorld->AddGlobalPlayerData(guid, account, name, gender, race, playerClass, level, mails.size(), 0); + sWorld->AddGlobalPlayerData(guid, account, name, gender, race, playerClass, level, mails.size(), 0); sObjectMgr->_hiItemGuid += items.size(); sObjectMgr->_mailId += mails.size(); diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index e8211e121..e32ab254d 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -182,39 +182,39 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/, uint16 checkFailed /* else action = WardenActions(sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_FAIL_ACTION)); - std::string banReason = "Anticheat violation"; - bool longBan = false; // 14d = 1209600s - if (checkFailed) - switch (checkFailed) - { - case 47: banReason += " (FrameXML Signature Check)"; break; - case 51: banReason += " (Lua DoString)"; break; - case 59: banReason += " (Lua Protection Patch)"; break; - case 72: banReason += " (Movement State related)"; break; - case 118: banReason += " (Wall Climb)"; break; - case 121: banReason += " (No Fall Damage Patch)"; break; - case 193: banReason += " (Follow Unit Check)"; break; - case 209: banReason += " (WoWEmuHacker Injection)"; longBan = true; break; - case 237: banReason += " (AddChatMessage)"; break; - case 246: banReason += " (Language Patch)"; break; - case 260: banReason += " (Jump Momentum)"; break; - case 288: banReason += " (Language Patch)"; break; - case 308: banReason += " (SendChatMessage)"; break; - case 312: banReason += " (Jump Physics)"; break; - case 314: banReason += " (GetCharacterInfo)"; break; - case 329: banReason += " (Wall Climb)"; break; - case 343: banReason += " (Login Password Pointer)"; break; - case 349: banReason += " (Language Patch)"; break; - case 712: banReason += " (WS2_32.Send)"; break; - case 780: banReason += " (Lua Protection Remover)"; break; - case 781: banReason += " (Walk on Water Patch)"; break; - case 782: banReason += " (Collision M2 Special)"; longBan = true; break; - case 783: banReason += " (Collision M2 Regular)"; longBan = true; break; - case 784: banReason += " (Collision WMD)"; longBan = true; break; - case 785: banReason += " (Multi-Jump Patch)"; break; - case 786: banReason += " (WPE PRO)"; longBan = true; break; - case 787: banReason += " (rEdoX Packet Editor)"; break; - } + std::string banReason = "Anticheat violation"; + bool longBan = false; // 14d = 1209600s + if (checkFailed) + switch (checkFailed) + { + case 47: banReason += " (FrameXML Signature Check)"; break; + case 51: banReason += " (Lua DoString)"; break; + case 59: banReason += " (Lua Protection Patch)"; break; + case 72: banReason += " (Movement State related)"; break; + case 118: banReason += " (Wall Climb)"; break; + case 121: banReason += " (No Fall Damage Patch)"; break; + case 193: banReason += " (Follow Unit Check)"; break; + case 209: banReason += " (WoWEmuHacker Injection)"; longBan = true; break; + case 237: banReason += " (AddChatMessage)"; break; + case 246: banReason += " (Language Patch)"; break; + case 260: banReason += " (Jump Momentum)"; break; + case 288: banReason += " (Language Patch)"; break; + case 308: banReason += " (SendChatMessage)"; break; + case 312: banReason += " (Jump Physics)"; break; + case 314: banReason += " (GetCharacterInfo)"; break; + case 329: banReason += " (Wall Climb)"; break; + case 343: banReason += " (Login Password Pointer)"; break; + case 349: banReason += " (Language Patch)"; break; + case 712: banReason += " (WS2_32.Send)"; break; + case 780: banReason += " (Lua Protection Remover)"; break; + case 781: banReason += " (Walk on Water Patch)"; break; + case 782: banReason += " (Collision M2 Special)"; longBan = true; break; + case 783: banReason += " (Collision M2 Regular)"; longBan = true; break; + case 784: banReason += " (Collision WMD)"; longBan = true; break; + case 785: banReason += " (Multi-Jump Patch)"; break; + case 786: banReason += " (WPE PRO)"; longBan = true; break; + case 787: banReason += " (rEdoX Packet Editor)"; break; + } switch (action) { diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index d8295c898..032ee3932 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -151,13 +151,13 @@ void WardenCheckMgr::LoadWardenChecks() void WardenCheckMgr::LoadWardenOverrides() { - // Check if Warden is enabled by config before loading anything - if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) - { - sLog->outString(">> Warden disabled, loading check overrides skipped."); - sLog->outString(); - return; - } + // Check if Warden is enabled by config before loading anything + if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) + { + sLog->outString(">> Warden disabled, loading check overrides skipped."); + sLog->outString(); + return; + } // 0 1 QueryResult result = CharacterDatabase.Query("SELECT wardenId, action FROM warden_action"); diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index d359f229b..202b99289 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -38,19 +38,19 @@ WardenWin::WardenWin() : Warden(), _serverTicks(0) { } WardenWin::~WardenWin() { - // Xinef: ZOMG! CRASH DEBUG INFO - uint32 otherSize = _otherChecksTodo.size(); - uint32 memSize = _memChecksTodo.size(); - uint32 curSize = _currentChecks.size(); - bool otherClear = _otherChecksTodo.empty(); - bool memClear = _memChecksTodo.empty(); - bool curClear = _currentChecks.empty(); + // Xinef: ZOMG! CRASH DEBUG INFO + uint32 otherSize = _otherChecksTodo.size(); + uint32 memSize = _memChecksTodo.size(); + uint32 curSize = _currentChecks.size(); + bool otherClear = _otherChecksTodo.empty(); + bool memClear = _memChecksTodo.empty(); + bool curClear = _currentChecks.empty(); - sLog->outDebug(LOG_FILTER_POOLSYS, "IM DESTRUCTING MYSELF QQ, OTHERSIZE: %u, OTHEREM: %u, MEMSIZE: %u, MEMEM: %u, CURSIZE: %u, CUREM: %u!\n", otherSize, otherClear, memSize, memClear, curSize, curClear); + sLog->outDebug(LOG_FILTER_POOLSYS, "IM DESTRUCTING MYSELF QQ, OTHERSIZE: %u, OTHEREM: %u, MEMSIZE: %u, MEMEM: %u, CURSIZE: %u, CUREM: %u!\n", otherSize, otherClear, memSize, memClear, curSize, curClear); _otherChecksTodo.clear(); _memChecksTodo.clear(); _currentChecks.clear(); - sLog->outDebug(LOG_FILTER_POOLSYS, "IM DESTRUCTING MYSELF QQ, OTHERSIZE: %u, OTHEREM: %u, MEMSIZE: %u, MEMEM: %u, CURSIZE: %u, CUREM: %u!\n", otherSize, otherClear, memSize, memClear, curSize, curClear); + sLog->outDebug(LOG_FILTER_POOLSYS, "IM DESTRUCTING MYSELF QQ, OTHERSIZE: %u, OTHEREM: %u, MEMSIZE: %u, MEMEM: %u, CURSIZE: %u, CUREM: %u!\n", otherSize, otherClear, memSize, memClear, curSize, curClear); } void WardenWin::Init(WorldSession* session, BigNumber *k) @@ -216,10 +216,10 @@ void WardenWin::RequestData() _memChecksTodo.pop_back(); // Add the id to the list sent in this cycle - if (id != 786 /*WPE PRO*/ && id != 209 /*WoWEmuHacker*/) - _currentChecks.push_back(id); + if (id != 786 /*WPE PRO*/ && id != 209 /*WoWEmuHacker*/) + _currentChecks.push_back(id); } - _currentChecks.push_back(786); _currentChecks.push_back(209); + _currentChecks.push_back(786); _currentChecks.push_back(209); ByteBuffer buff; buff << uint8(WARDEN_SMSG_CHEAT_CHECKS_REQUEST); @@ -357,7 +357,7 @@ void WardenWin::HandleData(ByteBuffer &buff) { buff.rpos(buff.wpos()); ;//sLog->outDebug(LOG_FILTER_WARDEN, "CHECKSUM FAIL"); - Penalty(); + Penalty(); return; } diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 6b5781249..b85d5662c 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -106,7 +106,7 @@ World::World() m_ShutdownMask = 0; m_ShutdownTimer = 0; m_gameTime = time(NULL); - m_gameMSTime = getMSTime(); + m_gameMSTime = getMSTime(); m_startTime = m_gameTime; m_maxActiveSessionCount = 0; m_maxQueuedSessionCount = 0; @@ -145,11 +145,11 @@ World::~World() m_sessions.erase(m_sessions.begin()); } - while (!m_offlineSessions.empty()) - { - delete m_offlineSessions.begin()->second; - m_offlineSessions.erase(m_offlineSessions.begin()); - } + while (!m_offlineSessions.empty()) + { + delete m_offlineSessions.begin()->second; + m_offlineSessions.erase(m_offlineSessions.begin()); + } CliCommandHolder* command = NULL; while (cliCmdQueue.next(command)) @@ -228,12 +228,12 @@ WorldSession* World::FindOfflineSession(uint32 id) const WorldSession* World::FindOfflineSessionForCharacterGUID(uint32 guidLow) const { - if (m_offlineSessions.empty()) - return NULL; - for (SessionMap::const_iterator itr = m_offlineSessions.begin(); itr != m_offlineSessions.end(); ++itr) - if (itr->second->GetGuidLow() == guidLow) - return itr->second; - return NULL; + if (m_offlineSessions.empty()) + return NULL; + for (SessionMap::const_iterator itr = m_offlineSessions.begin(); itr != m_offlineSessions.end(); ++itr) + if (itr->second->GetGuidLow() == guidLow) + return itr->second; + return NULL; } /// Remove a given session @@ -279,26 +279,26 @@ void World::AddSession_(WorldSession* s) if (!RemoveQueuedPlayer(oldSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE)) m_disconnects[s->GetAccountId()] = time(NULL); - // pussywizard: - if (oldSession->HandleSocketClosed()) - { - // there should be no offline session if current one is logged onto a character - SessionMap::iterator iter; - if ((iter = m_offlineSessions.find(oldSession->GetAccountId())) != m_offlineSessions.end()) - { - WorldSession* tmp = iter->second; - m_offlineSessions.erase(iter); - tmp->SetShouldSetOfflineInDB(false); - delete tmp; - } - oldSession->SetOfflineTime(time(NULL)); - m_offlineSessions[oldSession->GetAccountId()] = oldSession; - } - else - { - oldSession->SetShouldSetOfflineInDB(false); // pussywizard: don't set offline in db because new session for that acc is already created - delete oldSession; - } + // pussywizard: + if (oldSession->HandleSocketClosed()) + { + // there should be no offline session if current one is logged onto a character + SessionMap::iterator iter; + if ((iter = m_offlineSessions.find(oldSession->GetAccountId())) != m_offlineSessions.end()) + { + WorldSession* tmp = iter->second; + m_offlineSessions.erase(iter); + tmp->SetShouldSetOfflineInDB(false); + delete tmp; + } + oldSession->SetOfflineTime(time(NULL)); + m_offlineSessions[oldSession->GetAccountId()] = oldSession; + } + else + { + oldSession->SetShouldSetOfflineInDB(false); // pussywizard: don't set offline in db because new session for that acc is already created + delete oldSession; + } } m_sessions[s->GetAccountId()] = s; @@ -427,7 +427,7 @@ void World::LoadConfigSettings(bool reload) { if (reload) { - if (!sConfigMgr->Reload()) + if (!sConfigMgr->Reload()) { sLog->outError("World settings reload fail: can't read settings from %s.", sConfigMgr->GetFilename().c_str()); return; @@ -437,8 +437,8 @@ void World::LoadConfigSettings(bool reload) } ///- Read the player limit and the Message of the day from the config file - if (!reload) - SetPlayerAmountLimit(sConfigMgr->GetIntDefault("PlayerLimit", 100)); + if (!reload) + SetPlayerAmountLimit(sConfigMgr->GetIntDefault("PlayerLimit", 100)); SetMotd(sConfigMgr->GetStringDefault("Motd", "Welcome to a Sunwell Core Server.")); ///- Read ticket system setting from the config file @@ -680,8 +680,8 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_STRICT_CHARTER_NAMES] = sConfigMgr->GetIntDefault ("StrictCharterNames", 0); m_int_configs[CONFIG_STRICT_CHANNEL_NAMES] = sConfigMgr->GetIntDefault ("StrictChannelNames", 0); m_int_configs[CONFIG_STRICT_PET_NAMES] = sConfigMgr->GetIntDefault ("StrictPetNames", 0); - - m_bool_configs[CONFIG_ALLOW_TWO_SIDE_ACCOUNTS] = sConfigMgr->GetBoolDefault("AllowTwoSide.Accounts", true); + + m_bool_configs[CONFIG_ALLOW_TWO_SIDE_ACCOUNTS] = sConfigMgr->GetBoolDefault("AllowTwoSide.Accounts", true); m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR]= sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Calendar", false); m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Chat", false); m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Channel", false); @@ -863,7 +863,7 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_INSTANCE_IGNORE_RAID] = sConfigMgr->GetBoolDefault("Instance.IgnoreRaid", false); m_int_configs[CONFIG_INSTANCE_RESET_TIME_HOUR] = sConfigMgr->GetIntDefault("Instance.ResetTimeHour", 4); - m_int_configs[CONFIG_INSTANCE_RESET_TIME_RELATIVE_TIMESTAMP] = sConfigMgr->GetIntDefault("Instance.ResetTimeRelativeTimestamp", 1135814400); + m_int_configs[CONFIG_INSTANCE_RESET_TIME_RELATIVE_TIMESTAMP] = sConfigMgr->GetIntDefault("Instance.ResetTimeRelativeTimestamp", 1135814400); m_int_configs[CONFIG_INSTANCE_UNLOAD_DELAY] = sConfigMgr->GetIntDefault("Instance.UnloadDelay", 30 * MINUTE * IN_MILLISECONDS); m_int_configs[CONFIG_MAX_PRIMARY_TRADE_SKILL] = sConfigMgr->GetIntDefault("MaxPrimaryTradeSkill", 2); @@ -923,12 +923,12 @@ void World::LoadConfigSettings(bool reload) m_timers[WUPDATE_CLEANDB].Reset(); } - m_int_configs[CONFIG_TELEPORT_TIMEOUT_NEAR] = sConfigMgr->GetIntDefault("TeleportTimeoutNear", 25); // pussywizard - m_int_configs[CONFIG_TELEPORT_TIMEOUT_FAR] = sConfigMgr->GetIntDefault("TeleportTimeoutFar", 45); // pussywizard - m_int_configs[CONFIG_MAX_ALLOWED_MMR_DROP] = sConfigMgr->GetIntDefault("MaxAllowedMMRDrop", 500); // pussywizard - m_bool_configs[CONFIG_ENABLE_LOGIN_AFTER_DC] = sConfigMgr->GetBoolDefault("EnableLoginAfterDC", true); // pussywizard - m_bool_configs[CONFIG_DONT_CACHE_RANDOM_MOVEMENT_PATHS] = sConfigMgr->GetBoolDefault("DontCacheRandomMovementPaths", true); // pussywizard - SetRealmName(sConfigMgr->GetStringDefault("RealmName", "X")); + m_int_configs[CONFIG_TELEPORT_TIMEOUT_NEAR] = sConfigMgr->GetIntDefault("TeleportTimeoutNear", 25); // pussywizard + m_int_configs[CONFIG_TELEPORT_TIMEOUT_FAR] = sConfigMgr->GetIntDefault("TeleportTimeoutFar", 45); // pussywizard + m_int_configs[CONFIG_MAX_ALLOWED_MMR_DROP] = sConfigMgr->GetIntDefault("MaxAllowedMMRDrop", 500); // pussywizard + m_bool_configs[CONFIG_ENABLE_LOGIN_AFTER_DC] = sConfigMgr->GetBoolDefault("EnableLoginAfterDC", true); // pussywizard + m_bool_configs[CONFIG_DONT_CACHE_RANDOM_MOVEMENT_PATHS] = sConfigMgr->GetBoolDefault("DontCacheRandomMovementPaths", true); // pussywizard + SetRealmName(sConfigMgr->GetStringDefault("RealmName", "X")); m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = sConfigMgr->GetIntDefault("SkillChance.Orange", 100); m_int_configs[CONFIG_SKILL_CHANCE_YELLOW] = sConfigMgr->GetIntDefault("SkillChance.Yellow", 75); @@ -1249,8 +1249,8 @@ void World::SetInitialWorldSettings() ///- Initialize the random number generator srand((unsigned int)time(NULL)); - ///- Initialize detour memory management - dtAllocSetCustom(dtCustomAlloc, dtCustomFree); + ///- Initialize detour memory management + dtAllocSetCustom(dtCustomAlloc, dtCustomFree); ///- Initialize config settings LoadConfigSettings(); @@ -1317,10 +1317,10 @@ void World::SetInitialWorldSettings() sLog->outString("Loading SpellInfo store..."); sSpellMgr->LoadSpellInfoStore(); - sLog->outString("Loading Spell Rank Data..."); + sLog->outString("Loading Spell Rank Data..."); sSpellMgr->LoadSpellRanks(); - sLog->outString("Loading Spell Specific And Aura State..."); + sLog->outString("Loading Spell Specific And Aura State..."); sSpellMgr->LoadSpellSpecificAndAuraState(); sLog->outString("Loading SkillLineAbilityMultiMap Data..."); @@ -1338,8 +1338,8 @@ void World::SetInitialWorldSettings() sLog->outString("Loading Instance Template..."); sObjectMgr->LoadInstanceTemplate(); - // xinef: Global Storage, should be loaded asap - sLog->outString("Load Global Player Data..."); + // xinef: Global Storage, should be loaded asap + sLog->outString("Load Global Player Data..."); sWorld->LoadGlobalPlayerDataStore(); // Must be called before `creature_respawn`/`gameobject_respawn` tables @@ -1667,18 +1667,18 @@ void World::SetInitialWorldSettings() sLog->outString("Loading client addons..."); AddonMgr::LoadFromDB(); - // pussywizard: - sLog->outString("Deleting invalid mail items...\n"); - CharacterDatabase.Query("DELETE mi FROM mail_items mi LEFT JOIN item_instance ii ON mi.item_guid = ii.guid WHERE ii.guid IS NULL"); - CharacterDatabase.Query("DELETE mi FROM mail_items mi LEFT JOIN mail m ON mi.mail_id = m.id WHERE m.id IS NULL"); - CharacterDatabase.Query("UPDATE mail m LEFT JOIN mail_items mi ON m.id = mi.mail_id SET m.has_items=0 WHERE m.has_items<>0 AND mi.mail_id IS NULL"); + // pussywizard: + sLog->outString("Deleting invalid mail items...\n"); + CharacterDatabase.Query("DELETE mi FROM mail_items mi LEFT JOIN item_instance ii ON mi.item_guid = ii.guid WHERE ii.guid IS NULL"); + CharacterDatabase.Query("DELETE mi FROM mail_items mi LEFT JOIN mail m ON mi.mail_id = m.id WHERE m.id IS NULL"); + CharacterDatabase.Query("UPDATE mail m LEFT JOIN mail_items mi ON m.id = mi.mail_id SET m.has_items=0 WHERE m.has_items<>0 AND mi.mail_id IS NULL"); ///- Handle outdated emails (delete/return) sLog->outString("Returning old mails..."); sObjectMgr->ReturnOrDeleteOldMails(false); - - ///- Load AutoBroadCast - sLog->outString("Loading Autobroadcasts..."); + + ///- Load AutoBroadCast + sLog->outString("Loading Autobroadcasts..."); LoadAutobroadcasts(); ///- Load and initialize scripts @@ -1711,8 +1711,8 @@ void World::SetInitialWorldSettings() sLog->outString("Loading Calendar data..."); sCalendarMgr->LoadFromDB(); - sLog->outString("Initializing SpellInfo precomputed data..."); // must be called after loading items, professions, spells and pretty much anything - sObjectMgr->InitializeSpellInfoPrecomputedData(); + sLog->outString("Initializing SpellInfo precomputed data..."); // must be called after loading items, professions, spells and pretty much anything + sObjectMgr->InitializeSpellInfoPrecomputedData(); ///- Initialize game time and timers sLog->outString("Initialize game time and timers"); @@ -1733,10 +1733,10 @@ void World::SetInitialWorldSettings() m_timers[WUPDATE_PINGDB].SetInterval(getIntConfig(CONFIG_DB_PING_INTERVAL)*MINUTE*IN_MILLISECONDS); // Mysql ping time in minutes - // our speed up - m_timers[WUPDATE_5_SECS].SetInterval(5*IN_MILLISECONDS); + // our speed up + m_timers[WUPDATE_5_SECS].SetInterval(5*IN_MILLISECONDS); - mail_expire_check_timer = time(NULL) + 6*3600; + mail_expire_check_timer = time(NULL) + 6*3600; ///- Initilize static helper structures AIRegistry::Initialize(); @@ -1801,30 +1801,30 @@ void World::SetInitialWorldSettings() sLog->outString("Calculate Guild cap reset time..."); InitGuildResetTime(); - sLog->outString("Load Petitions..."); - sPetitionMgr->LoadPetitions(); + sLog->outString("Load Petitions..."); + sPetitionMgr->LoadPetitions(); - sLog->outString("Load Petition Signs..."); - sPetitionMgr->LoadSignatures(); + sLog->outString("Load Petition Signs..."); + sPetitionMgr->LoadSignatures(); - sLog->outString("Load Stored Loot Items..."); - sLootItemStorage->LoadStorageFromDB(); + sLog->outString("Load Stored Loot Items..."); + sLootItemStorage->LoadStorageFromDB(); - sLog->outString("Load Channel Rights..."); - ChannelMgr::LoadChannelRights(); + sLog->outString("Load Channel Rights..."); + ChannelMgr::LoadChannelRights(); - sLog->outString("Load Channels..."); - ChannelMgr* mgr = ChannelMgr::forTeam(TEAM_ALLIANCE); - mgr->LoadChannels(); - mgr = ChannelMgr::forTeam(TEAM_HORDE); - mgr->LoadChannels(); + sLog->outString("Load Channels..."); + ChannelMgr* mgr = ChannelMgr::forTeam(TEAM_ALLIANCE); + mgr->LoadChannels(); + mgr = ChannelMgr::forTeam(TEAM_HORDE); + mgr->LoadChannels(); uint32 startupDuration = GetMSTimeDiffToNow(startupBegin); sLog->outString(); sLog->outError("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); sLog->outString(); - // possibly enable db logging; avoid massive startup spam by doing it here. + // possibly enable db logging; avoid massive startup spam by doing it here. if (sConfigMgr->GetBoolDefault("EnableLogDB", false)) { sLog->outString("Enabling database logging..."); @@ -1895,7 +1895,7 @@ void World::LoadAutobroadcasts() /// Update the World ! void World::Update(uint32 diff) { - m_updateTime = diff; + m_updateTime = diff; if (m_int_configs[CONFIG_INTERVAL_LOG_UPDATE]) { @@ -1907,7 +1907,7 @@ void World::Update(uint32 diff) } } - DynamicVisibilityMgr::Update(GetActiveSessionCount()); + DynamicVisibilityMgr::Update(GetActiveSessionCount()); ///- Update the different timers for (int i = 0; i < WUPDATE_COUNT; ++i) @@ -1918,18 +1918,18 @@ void World::Update(uint32 diff) m_timers[i].SetCurrent(0); } - // pussywizard: our speed up and functionality - if (m_timers[WUPDATE_5_SECS].Passed()) - { - m_timers[WUPDATE_5_SECS].Reset(); + // pussywizard: our speed up and functionality + if (m_timers[WUPDATE_5_SECS].Passed()) + { + m_timers[WUPDATE_5_SECS].Reset(); - // moved here from HandleCharEnumOpcode - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS); - CharacterDatabase.Execute(stmt); + // moved here from HandleCharEnumOpcode + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS); + CharacterDatabase.Execute(stmt); - // copy players hashmapholder to avoid mutex - WhoListCacheMgr::Update(); - } + // copy players hashmapholder to avoid mutex + WhoListCacheMgr::Update(); + } ///- Update the game time and check for shutdown time _UpdateGameTime(); @@ -1952,34 +1952,34 @@ void World::Update(uint32 diff) if (m_gameTime > m_NextGuildReset) ResetGuildCap(); - // pussywizard: - // acquire mutex now, this is kind of waiting for listing thread to finish it's work (since it can't process next packet) - // so we don't have to do it in every packet that modifies auctions - AsyncAuctionListingMgr::SetAuctionListingAllowed(false); - { - TRINITY_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetLock()); + // pussywizard: + // acquire mutex now, this is kind of waiting for listing thread to finish it's work (since it can't process next packet) + // so we don't have to do it in every packet that modifies auctions + AsyncAuctionListingMgr::SetAuctionListingAllowed(false); + { + TRINITY_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetLock()); - // pussywizard: handle auctions when the timer has passed - if (m_timers[WUPDATE_AUCTIONS].Passed()) - { - m_timers[WUPDATE_AUCTIONS].Reset(); + // pussywizard: handle auctions when the timer has passed + if (m_timers[WUPDATE_AUCTIONS].Passed()) + { + m_timers[WUPDATE_AUCTIONS].Reset(); - // pussywizard: handle expired auctions, auctions expired when realm was offline are also handled here (not during loading when many required things aren't loaded yet) - sAuctionMgr->Update(); - } + // pussywizard: handle expired auctions, auctions expired when realm was offline are also handled here (not during loading when many required things aren't loaded yet) + sAuctionMgr->Update(); + } - AsyncAuctionListingMgr::Update(diff); + AsyncAuctionListingMgr::Update(diff); - if (m_gameTime > mail_expire_check_timer) - { - sObjectMgr->ReturnOrDeleteOldMails(true); - mail_expire_check_timer = m_gameTime + 6*3600; - } + if (m_gameTime > mail_expire_check_timer) + { + sObjectMgr->ReturnOrDeleteOldMails(true); + mail_expire_check_timer = m_gameTime + 6*3600; + } - UpdateSessions(diff); - } - // end of section with mutex - AsyncAuctionListingMgr::SetAuctionListingAllowed(true); + UpdateSessions(diff); + } + // end of section with mutex + AsyncAuctionListingMgr::SetAuctionListingAllowed(true); ///
  • Handle weather updates when the timer has passed if (m_timers[WUPDATE_WEATHERS].Passed()) @@ -1988,7 +1988,7 @@ void World::Update(uint32 diff) WeatherMgr::Update(uint32(m_timers[WUPDATE_WEATHERS].GetInterval())); } - sLFGMgr->Update(diff, 0); // pussywizard: remove obsolete stuff before finding compatibility during map update + sLFGMgr->Update(diff, 0); // pussywizard: remove obsolete stuff before finding compatibility during map update sMapMgr->Update(diff); @@ -2046,7 +2046,7 @@ void World::Update(uint32 diff) sScriptMgr->OnWorldUpdate(diff); - SavingSystemMgr::Update(diff); + SavingSystemMgr::Update(diff); } void World::ForceGameEventUpdate() @@ -2305,12 +2305,12 @@ BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, std::stri if (mode != BAN_IP) { - // pussywizard: check existing ban to prevent overriding by a shorter one! >_> - PreparedStatement* stmtx = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED); - stmtx->setUInt32(0, account); - PreparedQueryResult banresultx = LoginDatabase.Query(stmtx); - if (banresultx && ((*banresultx)[0].GetUInt32() == (*banresultx)[1].GetUInt32() || ((*banresultx)[1].GetUInt32() > time(NULL)+duration_secs && duration_secs))) - return BAN_LONGER_EXISTS; + // pussywizard: check existing ban to prevent overriding by a shorter one! >_> + PreparedStatement* stmtx = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED); + stmtx->setUInt32(0, account); + PreparedQueryResult banresultx = LoginDatabase.Query(stmtx); + if (banresultx && ((*banresultx)[0].GetUInt32() == (*banresultx)[1].GetUInt32() || ((*banresultx)[1].GetUInt32() > time(NULL)+duration_secs && duration_secs))) + return BAN_LONGER_EXISTS; // make sure there is only one active ban stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_NOT_BANNED); @@ -2378,9 +2378,9 @@ BanReturn World::BanCharacter(std::string const& name, std::string const& durati /// Pick a player to ban if not online if (!pBanned) { - guid = sWorld->GetGlobalPlayerGUID(name); - if (!guid) - return BAN_NOTFOUND; + guid = sWorld->GetGlobalPlayerGUID(name); + if (!guid) + return BAN_NOTFOUND; } else guid = pBanned->GetGUIDLow(); @@ -2411,7 +2411,7 @@ bool World::RemoveBanCharacter(std::string const& name) /// Pick a player to ban if not online if (!pBanned) - guid = sWorld->GetGlobalPlayerGUID(name); + guid = sWorld->GetGlobalPlayerGUID(name); else guid = pBanned->GetGUIDLow(); @@ -2431,7 +2431,7 @@ void World::_UpdateGameTime() time_t thisTime = time(NULL); uint32 elapsed = uint32(thisTime - m_gameTime); m_gameTime = thisTime; - m_gameMSTime = getMSTime(); + m_gameMSTime = getMSTime(); ///- if there is a shutdown timer if (!IsStopped() && m_ShutdownTimer > 0 && elapsed > 0) @@ -2556,54 +2556,54 @@ void World::UpdateSessions(uint32 diff) WorldSession* pSession = itr->second; WorldSessionFilter updater(pSession); - // pussywizard: - if (pSession->HandleSocketClosed()) - { + // pussywizard: + if (pSession->HandleSocketClosed()) + { if (!RemoveQueuedPlayer(pSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE)) m_disconnects[pSession->GetAccountId()] = time(NULL); m_sessions.erase(itr); - // there should be no offline session if current one is logged onto a character - SessionMap::iterator iter; - if ((iter = m_offlineSessions.find(pSession->GetAccountId())) != m_offlineSessions.end()) - { - WorldSession* tmp = iter->second; - m_offlineSessions.erase(iter); - tmp->SetShouldSetOfflineInDB(false); - delete tmp; - } - pSession->SetOfflineTime(time(NULL)); - m_offlineSessions[pSession->GetAccountId()] = pSession; - continue; - } + // there should be no offline session if current one is logged onto a character + SessionMap::iterator iter; + if ((iter = m_offlineSessions.find(pSession->GetAccountId())) != m_offlineSessions.end()) + { + WorldSession* tmp = iter->second; + m_offlineSessions.erase(iter); + tmp->SetShouldSetOfflineInDB(false); + delete tmp; + } + pSession->SetOfflineTime(time(NULL)); + m_offlineSessions[pSession->GetAccountId()] = pSession; + continue; + } if (!pSession->Update(diff, updater)) { if (!RemoveQueuedPlayer(pSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE)) m_disconnects[pSession->GetAccountId()] = time(NULL); m_sessions.erase(itr); - if (m_offlineSessions.find(pSession->GetAccountId()) != m_offlineSessions.end()) // pussywizard: don't set offline in db because offline session for that acc is present (character is in world) - pSession->SetShouldSetOfflineInDB(false); + if (m_offlineSessions.find(pSession->GetAccountId()) != m_offlineSessions.end()) // pussywizard: don't set offline in db because offline session for that acc is present (character is in world) + pSession->SetShouldSetOfflineInDB(false); delete pSession; } } - // pussywizard: - if (m_offlineSessions.empty()) - return; - uint32 currTime = time(NULL); - for (SessionMap::iterator itr = m_offlineSessions.begin(), next; itr != m_offlineSessions.end(); itr = next) - { + // pussywizard: + if (m_offlineSessions.empty()) + return; + uint32 currTime = time(NULL); + for (SessionMap::iterator itr = m_offlineSessions.begin(), next; itr != m_offlineSessions.end(); itr = next) + { next = itr; ++next; - WorldSession* pSession = itr->second; - if (!pSession->GetPlayer() || pSession->GetOfflineTime()+60 < currTime || pSession->IsKicked()) - { - m_offlineSessions.erase(itr); - if (m_sessions.find(pSession->GetAccountId()) != m_sessions.end()) - pSession->SetShouldSetOfflineInDB(false); // pussywizard: don't set offline in db because new session for that acc is already created - delete pSession; - } - } + WorldSession* pSession = itr->second; + if (!pSession->GetPlayer() || pSession->GetOfflineTime()+60 < currTime || pSession->IsKicked()) + { + m_offlineSessions.erase(itr); + if (m_sessions.find(pSession->GetAccountId()) != m_sessions.end()) + pSession->SetShouldSetOfflineInDB(false); // pussywizard: don't set offline in db because new session for that acc is already created + delete pSession; + } + } } // This handles the issued and queued CLI commands @@ -2629,8 +2629,8 @@ void World::SendAutoBroadcast() { if (m_Autobroadcasts.empty()) return; - - uint32 weight = 0; + + uint32 weight = 0; AutobroadcastsWeightMap selectionWeights; std::string msg; @@ -2721,46 +2721,46 @@ void World::_UpdateRealmCharCount(PreparedQueryResult resultCharCount) // int8 dayOfWeek: 0 (sunday) to 6 (saturday) time_t World::GetNextTimeWithDayAndHour(int8 dayOfWeek, int8 hour) { - if (hour < 0 || hour > 23) - hour = 0; - time_t curr = time(NULL); - tm localTm; - ACE_OS::localtime_r(&curr, &localTm); - localTm.tm_hour = hour; - localTm.tm_min = 0; - localTm.tm_sec = 0; - uint32 add; - if (dayOfWeek < 0 || dayOfWeek > 6) - dayOfWeek = (localTm.tm_wday+1)%7; - if (localTm.tm_wday >= dayOfWeek) - add = (7 - (localTm.tm_wday - dayOfWeek)) * DAY; - else - add = (dayOfWeek - localTm.tm_wday) * DAY; - return mktime(&localTm) + add; + if (hour < 0 || hour > 23) + hour = 0; + time_t curr = time(NULL); + tm localTm; + ACE_OS::localtime_r(&curr, &localTm); + localTm.tm_hour = hour; + localTm.tm_min = 0; + localTm.tm_sec = 0; + uint32 add; + if (dayOfWeek < 0 || dayOfWeek > 6) + dayOfWeek = (localTm.tm_wday+1)%7; + if (localTm.tm_wday >= dayOfWeek) + add = (7 - (localTm.tm_wday - dayOfWeek)) * DAY; + else + add = (dayOfWeek - localTm.tm_wday) * DAY; + return mktime(&localTm) + add; } // int8 month: 0 (january) to 11 (december) time_t World::GetNextTimeWithMonthAndHour(int8 month, int8 hour) { - if (hour < 0 || hour > 23) - hour = 0; - time_t curr = time(NULL); - tm localTm; - ACE_OS::localtime_r(&curr, &localTm); - localTm.tm_mday = 1; - localTm.tm_hour = hour; - localTm.tm_min = 0; - localTm.tm_sec = 0; - if (month < 0 || month > 11) - { - month = (localTm.tm_mon+1)%12; - if (month == 0) - localTm.tm_year += 1; - } - else if (localTm.tm_mon >= month) - localTm.tm_year += 1; - localTm.tm_mon = month; - return mktime(&localTm); + if (hour < 0 || hour > 23) + hour = 0; + time_t curr = time(NULL); + tm localTm; + ACE_OS::localtime_r(&curr, &localTm); + localTm.tm_mday = 1; + localTm.tm_hour = hour; + localTm.tm_min = 0; + localTm.tm_sec = 0; + if (month < 0 || month > 11) + { + month = (localTm.tm_mon+1)%12; + if (month == 0) + localTm.tm_year += 1; + } + else if (localTm.tm_mon >= month) + localTm.tm_year += 1; + localTm.tm_mon = month; + return mktime(&localTm); } void World::InitWeeklyQuestResetTime() @@ -3031,40 +3031,40 @@ void World::LoadGlobalPlayerDataStore() uint32 count = 0; - // query to load number of mails by receiver - std::map _mailCountMap; - QueryResult mailCountResult = CharacterDatabase.Query("SELECT receiver, COUNT(receiver) FROM mail GROUP BY receiver"); - if (mailCountResult) - { - do - { - Field* fields = mailCountResult->Fetch(); - _mailCountMap[fields[0].GetUInt32()] = uint16(fields[1].GetUInt64()); - } - while (mailCountResult->NextRow()); - } + // query to load number of mails by receiver + std::map _mailCountMap; + QueryResult mailCountResult = CharacterDatabase.Query("SELECT receiver, COUNT(receiver) FROM mail GROUP BY receiver"); + if (mailCountResult) + { + do + { + Field* fields = mailCountResult->Fetch(); + _mailCountMap[fields[0].GetUInt32()] = uint16(fields[1].GetUInt64()); + } + while (mailCountResult->NextRow()); + } do { Field* fields = result->Fetch(); - uint32 guidLow = fields[0].GetUInt32(); + uint32 guidLow = fields[0].GetUInt32(); - // count mails - uint16 mailCount = 0; - std::map::const_iterator itr = _mailCountMap.find(guidLow); - if (itr != _mailCountMap.end()) - mailCount = itr->second; + // count mails + uint16 mailCount = 0; + std::map::const_iterator itr = _mailCountMap.find(guidLow); + if (itr != _mailCountMap.end()) + mailCount = itr->second; - AddGlobalPlayerData( - guidLow, /*guid*/ - fields[1].GetUInt32(), /*accountId*/ - fields[2].GetString(), /*name*/ + AddGlobalPlayerData( + guidLow, /*guid*/ + fields[1].GetUInt32(), /*accountId*/ + fields[2].GetString(), /*name*/ fields[3].GetUInt8(), /*gender*/ - fields[4].GetUInt8(), /*race*/ - fields[5].GetUInt8(), /*class*/ - fields[6].GetUInt8(), /*level*/ - mailCount, /*mail count*/ - 0 /*guild id*/); + fields[4].GetUInt8(), /*race*/ + fields[5].GetUInt8(), /*class*/ + fields[6].GetUInt8(), /*level*/ + mailCount, /*mail count*/ + 0 /*guild id*/); ++count; } @@ -3076,42 +3076,42 @@ void World::LoadGlobalPlayerDataStore() void World::AddGlobalPlayerData(uint32 guid, uint32 accountId, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level, uint16 mailCount, uint32 guildId) { - GlobalPlayerData data; + GlobalPlayerData data; - data.guidLow = guid; - data.accountId = accountId; - data.name = name; - data.level = level; + data.guidLow = guid; + data.accountId = accountId; + data.name = name; + data.level = level; data.race = race; - data.playerClass = playerClass; - data.gender = gender; - data.mailCount = mailCount; - data.guildId = guildId; - data.groupId = 0; - data.arenaTeamId[0] = 0; - data.arenaTeamId[1] = 0; - data.arenaTeamId[2] = 0; + data.playerClass = playerClass; + data.gender = gender; + data.mailCount = mailCount; + data.guildId = guildId; + data.groupId = 0; + data.arenaTeamId[0] = 0; + data.arenaTeamId[1] = 0; + data.arenaTeamId[2] = 0; - _globalPlayerDataStore[guid] = data; - _globalPlayerNameStore[name] = guid; + _globalPlayerDataStore[guid] = data; + _globalPlayerNameStore[name] = guid; } void World::UpdateGlobalPlayerData(uint32 guid, uint8 mask, std::string const& name, uint8 level, uint8 gender, uint8 race, uint8 playerClass) { - GlobalPlayerDataMap::iterator itr = _globalPlayerDataStore.find(guid); + GlobalPlayerDataMap::iterator itr = _globalPlayerDataStore.find(guid); if (itr == _globalPlayerDataStore.end()) return; - if (mask & PLAYER_UPDATE_DATA_LEVEL) - itr->second.level = level; - if (mask & PLAYER_UPDATE_DATA_RACE) - itr->second.race = race; - if (mask & PLAYER_UPDATE_DATA_CLASS) - itr->second.playerClass = playerClass; - if (mask & PLAYER_UPDATE_DATA_GENDER) - itr->second.gender = gender; - if (mask & PLAYER_UPDATE_DATA_NAME) - itr->second.name = name; + if (mask & PLAYER_UPDATE_DATA_LEVEL) + itr->second.level = level; + if (mask & PLAYER_UPDATE_DATA_RACE) + itr->second.race = race; + if (mask & PLAYER_UPDATE_DATA_CLASS) + itr->second.playerClass = playerClass; + if (mask & PLAYER_UPDATE_DATA_GENDER) + itr->second.gender = gender; + if (mask & PLAYER_UPDATE_DATA_NAME) + itr->second.name = name; WorldPacket data(SMSG_INVALIDATE_PLAYER, 8); data << MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER); @@ -3120,74 +3120,74 @@ void World::UpdateGlobalPlayerData(uint32 guid, uint8 mask, std::string const& n void World::UpdateGlobalPlayerMails(uint32 guid, int16 count, bool add) { - GlobalPlayerDataMap::iterator itr = _globalPlayerDataStore.find(guid); + GlobalPlayerDataMap::iterator itr = _globalPlayerDataStore.find(guid); if (itr == _globalPlayerDataStore.end()) return; - if (!add) - { - itr->second.mailCount = count; - return; - } + if (!add) + { + itr->second.mailCount = count; + return; + } - int16 icount = (int16)itr->second.mailCount; - if (count < 0 && abs(count) > icount) - count = -icount; - itr->second.mailCount = uint16(icount + count); // addition or subtraction + int16 icount = (int16)itr->second.mailCount; + if (count < 0 && abs(count) > icount) + count = -icount; + itr->second.mailCount = uint16(icount + count); // addition or subtraction } void World::UpdateGlobalPlayerGuild(uint32 guid, uint32 guildId) { - GlobalPlayerDataMap::iterator itr = _globalPlayerDataStore.find(guid); + GlobalPlayerDataMap::iterator itr = _globalPlayerDataStore.find(guid); if (itr == _globalPlayerDataStore.end()) return; - itr->second.guildId = guildId; + itr->second.guildId = guildId; } void World::UpdateGlobalPlayerGroup(uint32 guid, uint32 groupId) { - GlobalPlayerDataMap::iterator itr = _globalPlayerDataStore.find(guid); + GlobalPlayerDataMap::iterator itr = _globalPlayerDataStore.find(guid); if (itr == _globalPlayerDataStore.end()) return; - itr->second.groupId = groupId; + itr->second.groupId = groupId; } void World::UpdateGlobalPlayerArenaTeam(uint32 guid, uint8 slot, uint32 arenaTeamId) { - GlobalPlayerDataMap::iterator itr = _globalPlayerDataStore.find(guid); + GlobalPlayerDataMap::iterator itr = _globalPlayerDataStore.find(guid); if (itr == _globalPlayerDataStore.end()) return; - itr->second.arenaTeamId[slot] = arenaTeamId; + itr->second.arenaTeamId[slot] = arenaTeamId; } void World::UpdateGlobalNameData(uint32 guidLow, std::string const& oldName, std::string const& newName) { - _globalPlayerNameStore.erase(oldName); - _globalPlayerNameStore[newName] = guidLow; + _globalPlayerNameStore.erase(oldName); + _globalPlayerNameStore[newName] = guidLow; } void World::DeleteGlobalPlayerData(uint32 guid, std::string const& name) { - if (guid) - _globalPlayerDataStore.erase(guid); - if (!name.empty()) - _globalPlayerNameStore.erase(name); + if (guid) + _globalPlayerDataStore.erase(guid); + if (!name.empty()) + _globalPlayerNameStore.erase(name); } GlobalPlayerData const* World::GetGlobalPlayerData(uint32 guid) const { - GlobalPlayerDataMap::const_iterator itr = _globalPlayerDataStore.find(guid); - if (itr != _globalPlayerDataStore.end()) - return &itr->second; - return NULL; + GlobalPlayerDataMap::const_iterator itr = _globalPlayerDataStore.find(guid); + if (itr != _globalPlayerDataStore.end()) + return &itr->second; + return NULL; } uint32 World::GetGlobalPlayerGUID(std::string const& name) const { - GlobalPlayerNameMap::const_iterator itr = _globalPlayerNameStore.find(name); - if (itr != _globalPlayerNameStore.end()) - return itr->second; - return 0; + GlobalPlayerNameMap::const_iterator itr = _globalPlayerNameStore.find(name); + if (itr != _globalPlayerNameStore.end()) + return itr->second; + return 0; } diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index d5a052fe4..dfb5f7102 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -78,7 +78,7 @@ enum WorldTimers WUPDATE_AUTOBROADCAST, WUPDATE_MAILBOXQUEUE, WUPDATE_PINGDB, - WUPDATE_5_SECS, + WUPDATE_5_SECS, WUPDATE_COUNT }; @@ -151,7 +151,7 @@ enum WorldBoolConfigs CONFIG_FREE_DUAL_SPEC, // pussywizard CONFIG_ENABLE_MMAPS, // pussywizard CONFIG_ENABLE_LOGIN_AFTER_DC, // pussywizard - CONFIG_DONT_CACHE_RANDOM_MOVEMENT_PATHS, // pussywizard + CONFIG_DONT_CACHE_RANDOM_MOVEMENT_PATHS, // pussywizard CONFIG_QUEST_IGNORE_AUTO_ACCEPT, CONFIG_QUEST_IGNORE_AUTO_COMPLETE, CONFIG_WARDEN_ENABLED, @@ -211,7 +211,7 @@ enum WorldIntConfigs CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL, CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE, CONFIG_INSTANCE_RESET_TIME_HOUR, - CONFIG_INSTANCE_RESET_TIME_RELATIVE_TIMESTAMP, + CONFIG_INSTANCE_RESET_TIME_RELATIVE_TIMESTAMP, CONFIG_INSTANCE_UNLOAD_DELAY, CONFIG_MAX_PRIMARY_TRADE_SKILL, CONFIG_MIN_PETITION_SIGNS, @@ -283,9 +283,9 @@ enum WorldIntConfigs CONFIG_PLAYER_ALLOW_COMMANDS, CONFIG_NUMTHREADS, CONFIG_LOGDB_CLEARINTERVAL, - CONFIG_TELEPORT_TIMEOUT_NEAR, // pussywizard - CONFIG_TELEPORT_TIMEOUT_FAR, // pussywizard - CONFIG_MAX_ALLOWED_MMR_DROP, // pussywizard + CONFIG_TELEPORT_TIMEOUT_NEAR, // pussywizard + CONFIG_TELEPORT_TIMEOUT_FAR, // pussywizard + CONFIG_MAX_ALLOWED_MMR_DROP, // pussywizard CONFIG_CLIENTCACHE_VERSION, CONFIG_GUILD_EVENT_LOG_COUNT, CONFIG_GUILD_BANK_EVENT_LOG_COUNT, @@ -494,26 +494,26 @@ typedef UNORDERED_MAP SessionMap; // xinef: global storage struct GlobalPlayerData { - uint32 guidLow; - uint32 accountId; - std::string name; - uint8 race; - uint8 playerClass; - uint8 gender; - uint8 level; - uint16 mailCount; - uint32 guildId; - uint32 groupId; - uint32 arenaTeamId[3]; + uint32 guidLow; + uint32 accountId; + std::string name; + uint8 race; + uint8 playerClass; + uint8 gender; + uint8 level; + uint16 mailCount; + uint32 guildId; + uint32 groupId; + uint32 arenaTeamId[3]; }; enum GlobalPlayerUpdateMask { - PLAYER_UPDATE_DATA_LEVEL = 0x01, - PLAYER_UPDATE_DATA_RACE = 0x02, - PLAYER_UPDATE_DATA_CLASS = 0x04, - PLAYER_UPDATE_DATA_GENDER = 0x08, - PLAYER_UPDATE_DATA_NAME = 0x10, + PLAYER_UPDATE_DATA_LEVEL = 0x01, + PLAYER_UPDATE_DATA_RACE = 0x02, + PLAYER_UPDATE_DATA_CLASS = 0x04, + PLAYER_UPDATE_DATA_GENDER = 0x08, + PLAYER_UPDATE_DATA_NAME = 0x10, }; typedef UNORDERED_MAP GlobalPlayerDataMap; @@ -609,8 +609,8 @@ class World time_t const& GetStartTime() const { return m_startTime; } /// What time is it? time_t const& GetGameTime() const { return m_gameTime; } - /// What time is it? in ms - static uint32 GetGameTimeMS() { return m_gameMSTime; } + /// What time is it? in ms + static uint32 GetGameTimeMS() { return m_gameMSTime; } /// Uptime (in secs) uint32 GetUptime() const { return uint32(m_gameTime - m_startTime); } /// Update time @@ -718,27 +718,27 @@ class World static float GetMaxVisibleDistanceInInstances() { return m_MaxVisibleDistanceInInstances; } static float GetMaxVisibleDistanceInBGArenas() { return m_MaxVisibleDistanceInBGArenas; } - // our: needed for arena spectator subscriptions - uint32 GetNextWhoListUpdateDelaySecs() - { - if (m_timers[WUPDATE_5_SECS].Passed()) - return 1; - uint32 t = m_timers[WUPDATE_5_SECS].GetInterval() - m_timers[WUPDATE_5_SECS].GetCurrent(); - t = std::min(t, (uint32)m_timers[WUPDATE_5_SECS].GetInterval()); - return uint32(ceil(t/1000.0f)); - } + // our: needed for arena spectator subscriptions + uint32 GetNextWhoListUpdateDelaySecs() + { + if (m_timers[WUPDATE_5_SECS].Passed()) + return 1; + uint32 t = m_timers[WUPDATE_5_SECS].GetInterval() - m_timers[WUPDATE_5_SECS].GetCurrent(); + t = std::min(t, (uint32)m_timers[WUPDATE_5_SECS].GetInterval()); + return uint32(ceil(t/1000.0f)); + } - // xinef: Global Player Data Storage system - void LoadGlobalPlayerDataStore(); - uint32 GetGlobalPlayerGUID(std::string const& name) const; - GlobalPlayerData const* GetGlobalPlayerData(uint32 guid) const; + // xinef: Global Player Data Storage system + void LoadGlobalPlayerDataStore(); + uint32 GetGlobalPlayerGUID(std::string const& name) const; + GlobalPlayerData const* GetGlobalPlayerData(uint32 guid) const; void AddGlobalPlayerData(uint32 guid, uint32 accountId, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level, uint16 mailCount, uint32 guildId); void UpdateGlobalPlayerData(uint32 guid, uint8 mask, std::string const& name, uint8 level = 0, uint8 gender = 0, uint8 race = 0, uint8 playerClass = 0); - void UpdateGlobalPlayerMails(uint32 guid, int16 count, bool add = true); - void UpdateGlobalPlayerGuild(uint32 guid, uint32 guildId); - void UpdateGlobalPlayerGroup(uint32 guid, uint32 groupId); - void UpdateGlobalPlayerArenaTeam(uint32 guid, uint8 slot, uint32 arenaTeamId); - void UpdateGlobalNameData(uint32 guidLow, std::string const& oldName, std::string const& newName); + void UpdateGlobalPlayerMails(uint32 guid, int16 count, bool add = true); + void UpdateGlobalPlayerGuild(uint32 guid, uint32 guildId); + void UpdateGlobalPlayerGroup(uint32 guid, uint32 groupId); + void UpdateGlobalPlayerArenaTeam(uint32 guid, uint8 slot, uint32 arenaTeamId); + void UpdateGlobalNameData(uint32 guidLow, std::string const& oldName, std::string const& newName); void DeleteGlobalPlayerData(uint32 guid, std::string const& name); void ProcessCliCommands(); @@ -752,19 +752,19 @@ class World void LoadDBVersion(); char const* GetDBVersion() const { return m_DBVersion.c_str(); } - void LoadAutobroadcasts(); - + void LoadAutobroadcasts(); + void UpdateAreaDependentAuras(); uint32 GetCleaningFlags() const { return m_CleaningFlags; } void SetCleaningFlags(uint32 flags) { m_CleaningFlags = flags; } void ResetEventSeasonalQuests(uint16 event_id); - time_t GetNextTimeWithDayAndHour(int8 dayOfWeek, int8 hour); // pussywizard - time_t GetNextTimeWithMonthAndHour(int8 month, int8 hour); // pussywizard + time_t GetNextTimeWithDayAndHour(int8 dayOfWeek, int8 hour); // pussywizard + time_t GetNextTimeWithMonthAndHour(int8 month, int8 hour); // pussywizard - std::string const& GetRealmName() const { return _realmName; } // pussywizard - void SetRealmName(std::string name) { _realmName = name; } // pussywizard + std::string const& GetRealmName() const { return _realmName; } // pussywizard + void SetRealmName(std::string name) { _realmName = name; } // pussywizard protected: void _UpdateGameTime(); @@ -796,7 +796,7 @@ class World IntervalTimer m_timers[WUPDATE_COUNT]; time_t mail_expire_check_timer; uint32 m_updateTime, m_updateTimeSum; - static uint32 m_gameMSTime; + static uint32 m_gameMSTime; SessionMap m_sessions; SessionMap m_offlineSessions; @@ -828,11 +828,11 @@ class World static float m_MaxVisibleDistanceInInstances; static float m_MaxVisibleDistanceInBGArenas; - // our speed ups - GlobalPlayerDataMap _globalPlayerDataStore; // xinef - GlobalPlayerNameMap _globalPlayerNameStore; // xinef + // our speed ups + GlobalPlayerDataMap _globalPlayerDataStore; // xinef + GlobalPlayerNameMap _globalPlayerNameStore; // xinef - std::string _realmName; + std::string _realmName; // CLI command holder to be thread safe ACE_Based::LockedQueue cliCmdQueue; diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 0fd076021..b999c3e05 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -30,573 +30,573 @@ EndScriptData */ class account_commandscript : public CommandScript { public: - account_commandscript() : CommandScript("account_commandscript") { } - - ChatCommand* GetCommands() const - { - static ChatCommand accountSetCommandTable[] = - { - { "addon", SEC_ADMINISTRATOR, true, &HandleAccountSetAddonCommand, "", NULL }, - { "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "", NULL }, - { "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "", NULL }, - { NULL, SEC_PLAYER, false, NULL, "", NULL } - }; - static ChatCommand accountCommandTable[] = - { - { "addon", SEC_MODERATOR, false, &HandleAccountAddonCommand, "", NULL }, - { "create", SEC_CONSOLE, true, &HandleAccountCreateCommand, "", NULL }, - { "delete", SEC_CONSOLE, true, &HandleAccountDeleteCommand, "", NULL }, - { "onlinelist", SEC_CONSOLE, true, &HandleAccountOnlineListCommand, "", NULL }, - { "lock", SEC_PLAYER, false, &HandleAccountLockCommand, "", NULL }, - { "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable }, - { "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "", NULL }, - { "", SEC_PLAYER, false, &HandleAccountCommand, "", NULL }, - { NULL, SEC_PLAYER, false, NULL, "", NULL } - }; - static ChatCommand commandTable[] = - { - { "account", SEC_PLAYER, true, NULL, "", accountCommandTable }, - { NULL, SEC_PLAYER, false, NULL, "", NULL } - }; - return commandTable; - } - - static bool HandleAccountAddonCommand(ChatHandler* handler, char const* args) - { - if (!*args) - { - handler->SendSysMessage(LANG_CMD_SYNTAX); - handler->SetSentErrorMessage(true); - return false; - } - - char* exp = strtok((char*)args, " "); - - uint32 accountId = handler->GetSession()->GetAccountId(); - - int expansion = atoi(exp); //get int anyway (0 if error) - if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION)) - { - handler->SendSysMessage(LANG_IMPROPER_VALUE); - handler->SetSentErrorMessage(true); - return false; - } - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION); - - stmt->setUInt8(0, uint8(expansion)); - stmt->setUInt32(1, accountId); - - LoginDatabase.Execute(stmt); - - handler->PSendSysMessage(LANG_ACCOUNT_ADDON, expansion); - return true; - } - - /// Create an account - static bool HandleAccountCreateCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - ///- %Parse the command line arguments - char* accountName = strtok((char*)args, " "); - char* password = strtok(NULL, " "); - if (!accountName || !password) - return false; - - AccountOpResult result = AccountMgr::CreateAccount(std::string(accountName), std::string(password)); - switch (result) - { - case AOR_OK: - handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); - if (handler->GetSession()) - { - sLog->outDebug(LOG_FILTER_WARDEN, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.", - handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), - handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); - } - break; - case AOR_NAME_TOO_LONG: - handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG); - handler->SetSentErrorMessage(true); - return false; - case AOR_NAME_ALREDY_EXIST: - handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST); - handler->SetSentErrorMessage(true); - return false; - case AOR_DB_INTERNAL_ERROR: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, accountName); - handler->SetSentErrorMessage(true); - return false; - default: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED, accountName); - handler->SetSentErrorMessage(true); - return false; - } - - return true; - } - - /// Delete a user account and all associated characters in this realm - /// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm then delete account) - static bool HandleAccountDeleteCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - ///- Get the account name from the command line - char* account = strtok((char*)args, " "); - if (!account) - return false; - - std::string accountName = account; - if (!AccountMgr::normalizeString(accountName)) - { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 accountId = AccountMgr::GetId(accountName); - if (!accountId) - { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - /// Commands not recommended call from chat, but support anyway - /// can delete only for account with less security - /// This is also reject self apply in fact - if (handler->HasLowerSecurityAccount(NULL, accountId, true)) - return false; - - AccountOpResult result = AccountMgr::DeleteAccount(accountId); - switch (result) - { - case AOR_OK: - handler->PSendSysMessage(LANG_ACCOUNT_DELETED, accountName.c_str()); - break; - case AOR_NAME_NOT_EXIST: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - case AOR_DB_INTERNAL_ERROR: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, accountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - default: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED, accountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - return true; - } - - /// Display info on users currently in the realm - static bool HandleAccountOnlineListCommand(ChatHandler* handler, char const* /*args*/) - { - ///- Get the list of accounts ID logged to the realm - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ONLINE); - - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (!result) - { - handler->SendSysMessage(LANG_ACCOUNT_LIST_EMPTY); - return true; - } - - ///- Display the list of account/characters online - handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR_HEADER); - handler->SendSysMessage(LANG_ACCOUNT_LIST_HEADER); - handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR); - - ///- Cycle through accounts - do - { - Field* fieldsDB = result->Fetch(); - std::string name = fieldsDB[0].GetString(); - uint32 account = fieldsDB[1].GetUInt32(); - - ///- Get the username, last IP and GM level of each account - // No SQL injection. account is uint32. - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO); - stmt->setUInt32(0, account); - PreparedQueryResult resultLogin = LoginDatabase.Query(stmt); - - if (resultLogin) - { - Field* fieldsLogin = resultLogin->Fetch(); - handler->PSendSysMessage(LANG_ACCOUNT_LIST_LINE, - fieldsLogin[0].GetCString(), name.c_str(), fieldsLogin[1].GetCString(), - fieldsDB[2].GetUInt16(), fieldsDB[3].GetUInt16(), fieldsLogin[3].GetUInt8(), - fieldsLogin[2].GetUInt8()); - } - else - handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str()); - } while (result->NextRow()); - - handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR); - return true; - } - - static bool HandleAccountLockCommand(ChatHandler* handler, char const* args) - { - if (!*args) - { - handler->SendSysMessage(LANG_USE_BOL); - handler->SetSentErrorMessage(true); - return false; - } - - std::string param = (char*)args; - - if (!param.empty()) - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK); - - if (param == "on") - { - stmt->setBool(0, true); // locked - handler->PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED); - } - else if (param == "off") - { - stmt->setBool(0, false); // unlocked - handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED); - } - - stmt->setUInt32(1, handler->GetSession()->GetAccountId()); - - LoginDatabase.Execute(stmt); - return true; - } - - handler->SendSysMessage(LANG_USE_BOL); - handler->SetSentErrorMessage(true); - return false; - } - - static bool HandleAccountPasswordCommand(ChatHandler* handler, char const* args) - { - if (!*args) - { - handler->SendSysMessage(LANG_CMD_SYNTAX); - handler->SetSentErrorMessage(true); - return false; - } - - char* oldPassword = strtok((char*)args, " "); - char* newPassword = strtok(NULL, " "); - char* passwordConfirmation = strtok(NULL, " "); - - if (!oldPassword || !newPassword || !passwordConfirmation) - { - handler->SendSysMessage(LANG_CMD_SYNTAX); - handler->SetSentErrorMessage(true); - return false; - } - - if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(oldPassword))) - { - handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); - handler->SetSentErrorMessage(true); - return false; - } - - if (strcmp(newPassword, passwordConfirmation) != 0) - { - handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH); - handler->SetSentErrorMessage(true); - return false; - } - - AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(newPassword)); - switch (result) - { - case AOR_OK: - handler->SendSysMessage(LANG_COMMAND_PASSWORD); - break; - case AOR_PASS_TOO_LONG: - handler->SendSysMessage(LANG_PASSWORD_TOO_LONG); - handler->SetSentErrorMessage(true); - return false; - default: - handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); - handler->SetSentErrorMessage(true); - return false; - } - - return true; - } - - static bool HandleAccountCommand(ChatHandler* handler, char const* /*args*/) - { - AccountTypes gmLevel = handler->GetSession()->GetSecurity(); - handler->PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmLevel)); - return true; - } - - /// Set/Unset the expansion level for an account - static bool HandleAccountSetAddonCommand(ChatHandler* handler, char const* args) - { - ///- Get the command line arguments - char* account = strtok((char*)args, " "); - char* exp = strtok(NULL, " "); - - if (!account) - return false; - - std::string accountName; - uint32 accountId; - - if (!exp) - { - Player* player = handler->getSelectedPlayer(); - if (!player) - return false; - - accountId = player->GetSession()->GetAccountId(); - AccountMgr::GetName(accountId, accountName); - exp = account; - } - else - { - ///- Convert Account name to Upper Format - accountName = account; - if (!AccountMgr::normalizeString(accountName)) - { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - accountId = AccountMgr::GetId(accountName); - if (!accountId) - { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - } - - // Let set addon state only for lesser (strong) security level - // or to self account - if (handler->GetSession() && handler->GetSession()->GetAccountId() != accountId && - handler->HasLowerSecurityAccount(NULL, accountId, true)) - return false; - - int expansion = atoi(exp); //get int anyway (0 if error) - if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION)) - return false; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION); - - stmt->setUInt8(0, expansion); - stmt->setUInt32(1, accountId); - - LoginDatabase.Execute(stmt); - - handler->PSendSysMessage(LANG_ACCOUNT_SETADDON, accountName.c_str(), accountId, expansion); - return true; - } - - static bool HandleAccountSetGmLevelCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - std::string targetAccountName; - uint32 targetAccountId = 0; - uint32 targetSecurity = 0; - uint32 gm = 0; - char* arg1 = strtok((char*)args, " "); - char* arg2 = strtok(NULL, " "); - char* arg3 = strtok(NULL, " "); - bool isAccountNameGiven = true; - - if (arg1 && !arg3) - { - if (!handler->getSelectedPlayer()) - return false; - isAccountNameGiven = false; - } - - // Check for second parameter - if (!isAccountNameGiven && !arg2) - return false; - - // Check for account - if (isAccountNameGiven) - { - targetAccountName = arg1; - if (!AccountMgr::normalizeString(targetAccountName)) - { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, targetAccountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - } - - // Check for invalid specified GM level. - gm = (isAccountNameGiven) ? atoi(arg2) : atoi(arg1); - if (gm > SEC_CONSOLE) - { - handler->SendSysMessage(LANG_BAD_VALUE); - handler->SetSentErrorMessage(true); - return false; - } - - // handler->getSession() == NULL only for console - targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId(); - int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2); - uint32 playerSecurity; - if (handler->GetSession()) - playerSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID); - else - playerSecurity = SEC_CONSOLE; - - // can set security level only for target with less security and to less security that we have - // This is also reject self apply in fact - targetSecurity = AccountMgr::GetSecurity(targetAccountId, gmRealmID); - if (targetSecurity >= playerSecurity || gm >= playerSecurity) - { - handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); - handler->SetSentErrorMessage(true); - return false; - } - - // Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1 - if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(playerSecurity)) - { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST); - - stmt->setUInt32(0, targetAccountId); - stmt->setUInt8(1, uint8(gm)); - - PreparedQueryResult result = LoginDatabase.Query(stmt); - - if (result) - { - handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); - handler->SetSentErrorMessage(true); - return false; - } - } - - // Check if provided realmID has a negative value other than -1 - if (gmRealmID < -1) - { - handler->SendSysMessage(LANG_INVALID_REALMID); - handler->SetSentErrorMessage(true); - return false; - } - - // If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realmID - PreparedStatement* stmt; - - if (gmRealmID == -1) - { - stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS); - - stmt->setUInt32(0, targetAccountId); - } - else - { - stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM); - - stmt->setUInt32(0, targetAccountId); - stmt->setUInt32(1, realmID); - } - - LoginDatabase.Execute(stmt); - - if (gm != 0) - { - stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS); - - stmt->setUInt32(0, targetAccountId); - stmt->setUInt8(1, uint8(gm)); - stmt->setInt32(2, gmRealmID); - - LoginDatabase.Execute(stmt); - } - - - handler->PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm); - return true; - } - - /// Set password for account - static bool HandleAccountSetPasswordCommand(ChatHandler* handler, char const* args) - { - if (!*args) - return false; - - ///- Get the command line arguments - char* account = strtok((char*)args, " "); - char* password = strtok(NULL, " "); - char* passwordConfirmation = strtok(NULL, " "); - - if (!account || !password || !passwordConfirmation) - return false; - - std::string accountName = account; - if (!AccountMgr::normalizeString(accountName)) - { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - uint32 targetAccountId = AccountMgr::GetId(accountName); - if (!targetAccountId) - { - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - } - - /// can set password only for target with less security - /// This is also reject self apply in fact - if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true)) - return false; - - if (strcmp(password, passwordConfirmation)) - { - handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH); - handler->SetSentErrorMessage(true); - return false; - } - - AccountOpResult result = AccountMgr::ChangePassword(targetAccountId, password); - - switch (result) - { - case AOR_OK: - handler->SendSysMessage(LANG_COMMAND_PASSWORD); - break; - case AOR_NAME_NOT_EXIST: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); - handler->SetSentErrorMessage(true); - return false; - case AOR_PASS_TOO_LONG: - handler->SendSysMessage(LANG_PASSWORD_TOO_LONG); - handler->SetSentErrorMessage(true); - return false; - default: - handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); - handler->SetSentErrorMessage(true); - return false; - } - return true; - } + account_commandscript() : CommandScript("account_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand accountSetCommandTable[] = + { + { "addon", SEC_ADMINISTRATOR, true, &HandleAccountSetAddonCommand, "", NULL }, + { "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "", NULL }, + { "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "", NULL }, + { NULL, SEC_PLAYER, false, NULL, "", NULL } + }; + static ChatCommand accountCommandTable[] = + { + { "addon", SEC_MODERATOR, false, &HandleAccountAddonCommand, "", NULL }, + { "create", SEC_CONSOLE, true, &HandleAccountCreateCommand, "", NULL }, + { "delete", SEC_CONSOLE, true, &HandleAccountDeleteCommand, "", NULL }, + { "onlinelist", SEC_CONSOLE, true, &HandleAccountOnlineListCommand, "", NULL }, + { "lock", SEC_PLAYER, false, &HandleAccountLockCommand, "", NULL }, + { "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable }, + { "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "", NULL }, + { "", SEC_PLAYER, false, &HandleAccountCommand, "", NULL }, + { NULL, SEC_PLAYER, false, NULL, "", NULL } + }; + static ChatCommand commandTable[] = + { + { "account", SEC_PLAYER, true, NULL, "", accountCommandTable }, + { NULL, SEC_PLAYER, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleAccountAddonCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + handler->SendSysMessage(LANG_CMD_SYNTAX); + handler->SetSentErrorMessage(true); + return false; + } + + char* exp = strtok((char*)args, " "); + + uint32 accountId = handler->GetSession()->GetAccountId(); + + int expansion = atoi(exp); //get int anyway (0 if error) + if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION)) + { + handler->SendSysMessage(LANG_IMPROPER_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION); + + stmt->setUInt8(0, uint8(expansion)); + stmt->setUInt32(1, accountId); + + LoginDatabase.Execute(stmt); + + handler->PSendSysMessage(LANG_ACCOUNT_ADDON, expansion); + return true; + } + + /// Create an account + static bool HandleAccountCreateCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + ///- %Parse the command line arguments + char* accountName = strtok((char*)args, " "); + char* password = strtok(NULL, " "); + if (!accountName || !password) + return false; + + AccountOpResult result = AccountMgr::CreateAccount(std::string(accountName), std::string(password)); + switch (result) + { + case AOR_OK: + handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); + if (handler->GetSession()) + { + sLog->outDebug(LOG_FILTER_WARDEN, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.", + handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), + handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); + } + break; + case AOR_NAME_TOO_LONG: + handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG); + handler->SetSentErrorMessage(true); + return false; + case AOR_NAME_ALREDY_EXIST: + handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST); + handler->SetSentErrorMessage(true); + return false; + case AOR_DB_INTERNAL_ERROR: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, accountName); + handler->SetSentErrorMessage(true); + return false; + default: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED, accountName); + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } + + /// Delete a user account and all associated characters in this realm + /// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm then delete account) + static bool HandleAccountDeleteCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + ///- Get the account name from the command line + char* account = strtok((char*)args, " "); + if (!account) + return false; + + std::string accountName = account; + if (!AccountMgr::normalizeString(accountName)) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 accountId = AccountMgr::GetId(accountName); + if (!accountId) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + /// Commands not recommended call from chat, but support anyway + /// can delete only for account with less security + /// This is also reject self apply in fact + if (handler->HasLowerSecurityAccount(NULL, accountId, true)) + return false; + + AccountOpResult result = AccountMgr::DeleteAccount(accountId); + switch (result) + { + case AOR_OK: + handler->PSendSysMessage(LANG_ACCOUNT_DELETED, accountName.c_str()); + break; + case AOR_NAME_NOT_EXIST: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + case AOR_DB_INTERNAL_ERROR: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + default: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } + + /// Display info on users currently in the realm + static bool HandleAccountOnlineListCommand(ChatHandler* handler, char const* /*args*/) + { + ///- Get the list of accounts ID logged to the realm + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ONLINE); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (!result) + { + handler->SendSysMessage(LANG_ACCOUNT_LIST_EMPTY); + return true; + } + + ///- Display the list of account/characters online + handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR_HEADER); + handler->SendSysMessage(LANG_ACCOUNT_LIST_HEADER); + handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR); + + ///- Cycle through accounts + do + { + Field* fieldsDB = result->Fetch(); + std::string name = fieldsDB[0].GetString(); + uint32 account = fieldsDB[1].GetUInt32(); + + ///- Get the username, last IP and GM level of each account + // No SQL injection. account is uint32. + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO); + stmt->setUInt32(0, account); + PreparedQueryResult resultLogin = LoginDatabase.Query(stmt); + + if (resultLogin) + { + Field* fieldsLogin = resultLogin->Fetch(); + handler->PSendSysMessage(LANG_ACCOUNT_LIST_LINE, + fieldsLogin[0].GetCString(), name.c_str(), fieldsLogin[1].GetCString(), + fieldsDB[2].GetUInt16(), fieldsDB[3].GetUInt16(), fieldsLogin[3].GetUInt8(), + fieldsLogin[2].GetUInt8()); + } + else + handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str()); + } while (result->NextRow()); + + handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR); + return true; + } + + static bool HandleAccountLockCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } + + std::string param = (char*)args; + + if (!param.empty()) + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK); + + if (param == "on") + { + stmt->setBool(0, true); // locked + handler->PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED); + } + else if (param == "off") + { + stmt->setBool(0, false); // unlocked + handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED); + } + + stmt->setUInt32(1, handler->GetSession()->GetAccountId()); + + LoginDatabase.Execute(stmt); + return true; + } + + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } + + static bool HandleAccountPasswordCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + handler->SendSysMessage(LANG_CMD_SYNTAX); + handler->SetSentErrorMessage(true); + return false; + } + + char* oldPassword = strtok((char*)args, " "); + char* newPassword = strtok(NULL, " "); + char* passwordConfirmation = strtok(NULL, " "); + + if (!oldPassword || !newPassword || !passwordConfirmation) + { + handler->SendSysMessage(LANG_CMD_SYNTAX); + handler->SetSentErrorMessage(true); + return false; + } + + if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(oldPassword))) + { + handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); + handler->SetSentErrorMessage(true); + return false; + } + + if (strcmp(newPassword, passwordConfirmation) != 0) + { + handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH); + handler->SetSentErrorMessage(true); + return false; + } + + AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(newPassword)); + switch (result) + { + case AOR_OK: + handler->SendSysMessage(LANG_COMMAND_PASSWORD); + break; + case AOR_PASS_TOO_LONG: + handler->SendSysMessage(LANG_PASSWORD_TOO_LONG); + handler->SetSentErrorMessage(true); + return false; + default: + handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); + handler->SetSentErrorMessage(true); + return false; + } + + return true; + } + + static bool HandleAccountCommand(ChatHandler* handler, char const* /*args*/) + { + AccountTypes gmLevel = handler->GetSession()->GetSecurity(); + handler->PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmLevel)); + return true; + } + + /// Set/Unset the expansion level for an account + static bool HandleAccountSetAddonCommand(ChatHandler* handler, char const* args) + { + ///- Get the command line arguments + char* account = strtok((char*)args, " "); + char* exp = strtok(NULL, " "); + + if (!account) + return false; + + std::string accountName; + uint32 accountId; + + if (!exp) + { + Player* player = handler->getSelectedPlayer(); + if (!player) + return false; + + accountId = player->GetSession()->GetAccountId(); + AccountMgr::GetName(accountId, accountName); + exp = account; + } + else + { + ///- Convert Account name to Upper Format + accountName = account; + if (!AccountMgr::normalizeString(accountName)) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + accountId = AccountMgr::GetId(accountName); + if (!accountId) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + // Let set addon state only for lesser (strong) security level + // or to self account + if (handler->GetSession() && handler->GetSession()->GetAccountId() != accountId && + handler->HasLowerSecurityAccount(NULL, accountId, true)) + return false; + + int expansion = atoi(exp); //get int anyway (0 if error) + if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION)) + return false; + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION); + + stmt->setUInt8(0, expansion); + stmt->setUInt32(1, accountId); + + LoginDatabase.Execute(stmt); + + handler->PSendSysMessage(LANG_ACCOUNT_SETADDON, accountName.c_str(), accountId, expansion); + return true; + } + + static bool HandleAccountSetGmLevelCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + std::string targetAccountName; + uint32 targetAccountId = 0; + uint32 targetSecurity = 0; + uint32 gm = 0; + char* arg1 = strtok((char*)args, " "); + char* arg2 = strtok(NULL, " "); + char* arg3 = strtok(NULL, " "); + bool isAccountNameGiven = true; + + if (arg1 && !arg3) + { + if (!handler->getSelectedPlayer()) + return false; + isAccountNameGiven = false; + } + + // Check for second parameter + if (!isAccountNameGiven && !arg2) + return false; + + // Check for account + if (isAccountNameGiven) + { + targetAccountName = arg1; + if (!AccountMgr::normalizeString(targetAccountName)) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, targetAccountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + } + + // Check for invalid specified GM level. + gm = (isAccountNameGiven) ? atoi(arg2) : atoi(arg1); + if (gm > SEC_CONSOLE) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + // handler->getSession() == NULL only for console + targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId(); + int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2); + uint32 playerSecurity; + if (handler->GetSession()) + playerSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID); + else + playerSecurity = SEC_CONSOLE; + + // can set security level only for target with less security and to less security that we have + // This is also reject self apply in fact + targetSecurity = AccountMgr::GetSecurity(targetAccountId, gmRealmID); + if (targetSecurity >= playerSecurity || gm >= playerSecurity) + { + handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); + handler->SetSentErrorMessage(true); + return false; + } + + // Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1 + if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(playerSecurity)) + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST); + + stmt->setUInt32(0, targetAccountId); + stmt->setUInt8(1, uint8(gm)); + + PreparedQueryResult result = LoginDatabase.Query(stmt); + + if (result) + { + handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); + handler->SetSentErrorMessage(true); + return false; + } + } + + // Check if provided realmID has a negative value other than -1 + if (gmRealmID < -1) + { + handler->SendSysMessage(LANG_INVALID_REALMID); + handler->SetSentErrorMessage(true); + return false; + } + + // If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realmID + PreparedStatement* stmt; + + if (gmRealmID == -1) + { + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS); + + stmt->setUInt32(0, targetAccountId); + } + else + { + stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM); + + stmt->setUInt32(0, targetAccountId); + stmt->setUInt32(1, realmID); + } + + LoginDatabase.Execute(stmt); + + if (gm != 0) + { + stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS); + + stmt->setUInt32(0, targetAccountId); + stmt->setUInt8(1, uint8(gm)); + stmt->setInt32(2, gmRealmID); + + LoginDatabase.Execute(stmt); + } + + + handler->PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm); + return true; + } + + /// Set password for account + static bool HandleAccountSetPasswordCommand(ChatHandler* handler, char const* args) + { + if (!*args) + return false; + + ///- Get the command line arguments + char* account = strtok((char*)args, " "); + char* password = strtok(NULL, " "); + char* passwordConfirmation = strtok(NULL, " "); + + if (!account || !password || !passwordConfirmation) + return false; + + std::string accountName = account; + if (!AccountMgr::normalizeString(accountName)) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 targetAccountId = AccountMgr::GetId(accountName); + if (!targetAccountId) + { + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + } + + /// can set password only for target with less security + /// This is also reject self apply in fact + if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true)) + return false; + + if (strcmp(password, passwordConfirmation)) + { + handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH); + handler->SetSentErrorMessage(true); + return false; + } + + AccountOpResult result = AccountMgr::ChangePassword(targetAccountId, password); + + switch (result) + { + case AOR_OK: + handler->SendSysMessage(LANG_COMMAND_PASSWORD); + break; + case AOR_NAME_NOT_EXIST: + handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str()); + handler->SetSentErrorMessage(true); + return false; + case AOR_PASS_TOO_LONG: + handler->SendSysMessage(LANG_PASSWORD_TOO_LONG); + handler->SetSentErrorMessage(true); + return false; + default: + handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); + handler->SetSentErrorMessage(true); + return false; + } + return true; + } }; void AddSC_account_commandscript() { - new account_commandscript(); + new account_commandscript(); } diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp index a4b20a48f..0600dd24c 100644 --- a/src/server/scripts/Commands/cs_ban.cpp +++ b/src/server/scripts/Commands/cs_ban.cpp @@ -284,7 +284,7 @@ public: if (!target) { - targetGuid = sWorld->GetGlobalPlayerGUID(name); + targetGuid = sWorld->GetGlobalPlayerGUID(name); if (!targetGuid) { handler->PSendSysMessage(LANG_BANINFO_NOCHARACTER); diff --git a/src/server/scripts/Commands/cs_cast.cpp b/src/server/scripts/Commands/cs_cast.cpp index 6414e733d..1e7e28f7e 100644 --- a/src/server/scripts/Commands/cs_cast.cpp +++ b/src/server/scripts/Commands/cs_cast.cpp @@ -88,7 +88,7 @@ public: SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId); uint32 spellDifficultyId = sSpellMgr->GetSpellDifficultyId(spellId); - if (handler->GetSession()->GetSecurity() < SEC_CONSOLE && (bounds.first != bounds.second || spellDifficultyId || spellInfo->HasEffect(SPELL_EFFECT_SKILL_STEP) || spellInfo->HasEffect(SPELL_EFFECT_TRADE_SKILL))) + if (handler->GetSession()->GetSecurity() < SEC_CONSOLE && (bounds.first != bounds.second || spellDifficultyId || spellInfo->HasEffect(SPELL_EFFECT_SKILL_STEP) || spellInfo->HasEffect(SPELL_EFFECT_TRADE_SKILL))) { handler->PSendSysMessage("Spell %u cannot be casted using a command!", spellId); handler->SetSentErrorMessage(true); diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 6a680b7ad..99738ab4c 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -102,8 +102,8 @@ public: stmt->setUInt32(1, GUID_LOPART(playerGuid)); CharacterDatabase.Execute(stmt); - // xinef: update global storage - sWorld->UpdateGlobalPlayerData(GUID_LOPART(playerGuid), PLAYER_UPDATE_DATA_LEVEL, "", newLevel); + // xinef: update global storage + sWorld->UpdateGlobalPlayerData(GUID_LOPART(playerGuid), PLAYER_UPDATE_DATA_LEVEL, "", newLevel); } } @@ -117,7 +117,7 @@ public: return false; LocaleConstant loc = handler->GetSessionDbcLocale(); - char const* targetName = target->GetName().c_str(); + char const* targetName = target->GetName().c_str(); char const* knownStr = handler->GetTrinityString(LANG_KNOWN); // Search in CharTitles.dbc @@ -512,35 +512,35 @@ public: char* fileStr = strtok((char*)args, " "); char* playerStr = strtok(NULL, " "); - if (!fileStr && !playerStr) - { - QueryResult result = CharacterDatabase.PQuery("SELECT guid FROM characters"); - if (!result) - return true; - do{ - uint64 _guid = result->Fetch()[0].GetUInt64(); - char buff[20]; - sprintf(buff,"%u.dump", _guid); - switch(PlayerDumpWriter().WriteDump(buff, uint32(_guid))) - { - case DUMP_SUCCESS: - handler->PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS); - break; - case DUMP_FILE_OPEN_ERROR: - handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, buff); - handler->SetSentErrorMessage(true); - return false; - case DUMP_CHARACTER_DELETED: - handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR); - handler->SetSentErrorMessage(true); - return false; - default: - handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED); - handler->SetSentErrorMessage(true); - return false; - } - }while(result->NextRow()); - } + if (!fileStr && !playerStr) + { + QueryResult result = CharacterDatabase.PQuery("SELECT guid FROM characters"); + if (!result) + return true; + do{ + uint64 _guid = result->Fetch()[0].GetUInt64(); + char buff[20]; + sprintf(buff,"%u.dump", _guid); + switch(PlayerDumpWriter().WriteDump(buff, uint32(_guid))) + { + case DUMP_SUCCESS: + handler->PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS); + break; + case DUMP_FILE_OPEN_ERROR: + handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, buff); + handler->SetSentErrorMessage(true); + return false; + case DUMP_CHARACTER_DELETED: + handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR); + handler->SetSentErrorMessage(true); + return false; + default: + handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED); + handler->SetSentErrorMessage(true); + return false; + } + }while(result->NextRow()); + } if (!fileStr || !playerStr) return false; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index caaeb2b4f..ddecaa205 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -91,13 +91,13 @@ public: { "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "", NULL }, { "los", SEC_GAMEMASTER, false, &HandleDebugLoSCommand, "", NULL }, { "moveflags", SEC_ADMINISTRATOR, false, &HandleDebugMoveflagsCommand, "", NULL }, - { "unitstate", SEC_ADMINISTRATOR, false, &HandleDebugUnitStateCommand, "", NULL }, + { "unitstate", SEC_ADMINISTRATOR, false, &HandleDebugUnitStateCommand, "", NULL }, { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { { "debug", SEC_GAMEMASTER, true, NULL, "", debugCommandTable }, - { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL }, + { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", NULL }, { NULL, SEC_PLAYER, false, NULL, "", NULL } }; return commandTable; @@ -839,7 +839,7 @@ public: while (ref) { if (Unit* unit = ref->GetSource()->GetOwner()) - handler->PSendSysMessage(" %u. %s %s (guid %u) - threat %f", ++count, (ref->isOnline() ? "" : "[offline]"), unit->GetName().c_str(), unit->GetGUIDLow(), ref->getThreat()); + handler->PSendSysMessage(" %u. %s %s (guid %u) - threat %f", ++count, (ref->isOnline() ? "" : "[offline]"), unit->GetName().c_str(), unit->GetGUIDLow(), ref->getThreat()); else handler->PSendSysMessage(" %u. No Owner - threat %f", ++count, ref->getThreat()); ref = ref->next(); @@ -1344,19 +1344,19 @@ public: if (!*args) { - handler->PSendSysMessage("Unit States: %u, React State: %u", target->GetUnitState(), target->ToCreature() ? target->ToCreature()->GetReactState() : 10); + handler->PSendSysMessage("Unit States: %u, React State: %u", target->GetUnitState(), target->ToCreature() ? target->ToCreature()->GetReactState() : 10); } else { uint32 unitState = atoi((char*)args); - target->ClearUnitState(target->GetUnitState()); - target->AddUnitState(unitState); + target->ClearUnitState(target->GetUnitState()); + target->AddUnitState(unitState); } return true; } - static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/) + static bool HandleWPGPSCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index 412de7b82..a6efb4f3a 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -113,7 +113,7 @@ public: data << uint32(0); // unknown target->SendMessageToSet(&data, true); handler->PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, handler->GetNameLink(target).c_str(), args); - handler->SetSentErrorMessage(true); + handler->SetSentErrorMessage(true); return false; } @@ -200,7 +200,7 @@ public: if (!*args) { handler->PSendSysMessage(LANG_YOU_ARE, _player->isGMVisible() ? handler->GetTrinityString(LANG_VISIBLE) : handler->GetTrinityString(LANG_INVISIBLE)); - handler->SetSentErrorMessage(true); + handler->SetSentErrorMessage(true); return false; } @@ -215,7 +215,7 @@ public: _player->SetGMVisible(true); //_player->UpdateObjectVisibility(); handler->GetSession()->SendNotification(LANG_INVISIBLE_VISIBLE); - handler->SetSentErrorMessage(true); + handler->SetSentErrorMessage(true); return false; } @@ -225,7 +225,7 @@ public: _player->SetGMVisible(false); //_player->UpdateObjectVisibility(); handler->GetSession()->SendNotification(LANG_INVISIBLE_INVISIBLE); - handler->SetSentErrorMessage(true); + handler->SetSentErrorMessage(true); return false; } @@ -242,7 +242,7 @@ public: if (!*args) { handler->GetSession()->SendNotification(_player->IsGameMaster() ? LANG_GM_ON : LANG_GM_OFF); - handler->SetSentErrorMessage(true); + handler->SetSentErrorMessage(true); return false; } @@ -253,7 +253,7 @@ public: _player->SetGameMaster(true); handler->GetSession()->SendNotification(LANG_GM_ON); _player->UpdateTriggerVisibility(); - handler->SetSentErrorMessage(true); + handler->SetSentErrorMessage(true); return false; } @@ -262,7 +262,7 @@ public: _player->SetGameMaster(false); handler->GetSession()->SendNotification(LANG_GM_OFF); _player->UpdateTriggerVisibility(); - handler->SetSentErrorMessage(true); + handler->SetSentErrorMessage(true); return false; } diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 9daaf82b7..3df1d291d 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -600,17 +600,17 @@ public: uint32 displayId = 0; std::string name; uint32 lootId = 0; - GameObject* gameObject = NULL; + GameObject* gameObject = NULL; if (!*args) { if (WorldObject* object = handler->getSelectedObject()) - { + { entry = object->GetEntry(); - if (object->GetTypeId() == TYPEID_GAMEOBJECT) - gameObject = object->ToGameObject(); - } - } + if (object->GetTypeId() == TYPEID_GAMEOBJECT) + gameObject = object->ToGameObject(); + } + } else entry = atoi((char*)args); @@ -631,15 +631,15 @@ public: handler->PSendSysMessage(LANG_GOINFO_TYPE, type); handler->PSendSysMessage(LANG_GOINFO_LOOTID, lootId); handler->PSendSysMessage(LANG_GOINFO_DISPLAYID, displayId); - if (gameObject) - { - handler->PSendSysMessage("LootMode: %u", gameObject->GetLootMode()); - handler->PSendSysMessage("LootState: %u", gameObject->getLootState()); - handler->PSendSysMessage("GOState: %u", gameObject->GetGoState()); - handler->PSendSysMessage("PhaseMask: %u", gameObject->GetPhaseMask()); - handler->PSendSysMessage("IsLootEmpty: %u", gameObject->loot.empty()); - handler->PSendSysMessage("IsLootLooted: %u", gameObject->loot.isLooted()); - } + if (gameObject) + { + handler->PSendSysMessage("LootMode: %u", gameObject->GetLootMode()); + handler->PSendSysMessage("LootState: %u", gameObject->getLootState()); + handler->PSendSysMessage("GOState: %u", gameObject->GetGoState()); + handler->PSendSysMessage("PhaseMask: %u", gameObject->GetPhaseMask()); + handler->PSendSysMessage("IsLootEmpty: %u", gameObject->loot.empty()); + handler->PSendSysMessage("IsLootLooted: %u", gameObject->loot.isLooted()); + } handler->PSendSysMessage(LANG_GOINFO_NAME, name.c_str()); @@ -659,20 +659,20 @@ public: GameObject* object = NULL; - if (guidLow > 0) - { - if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) - object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id); - } - else - object = handler->GetSession()->GetPlayer()->FindNearestGameObject(-guidLow, 30.0f); + if (guidLow > 0) + { + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) + object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id); + } + else + object = handler->GetSession()->GetPlayer()->FindNearestGameObject(-guidLow, 30.0f); if (!object) { - - handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, abs(guidLow)); - handler->SetSentErrorMessage(true); - return false; + + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, abs(guidLow)); + handler->SetSentErrorMessage(true); + return false; } char* type = strtok(NULL, " "); @@ -704,10 +704,10 @@ public: data << (uint32)(objectState); object->SendMessageToSet(&data, true); } - else if (objectType == 5) - object->SetUInt32Value(GAMEOBJECT_FLAGS, (uint32)(objectState)); - else if (objectType == 6) - object->SetGoArtKit((uint32)(objectState)); + else if (objectType == 5) + object->SetUInt32Value(GAMEOBJECT_FLAGS, (uint32)(objectState)); + else if (objectType == 6) + object->SetGoArtKit((uint32)(objectState)); handler->PSendSysMessage("Set gobject type %d state %d", objectType, objectState); return true; diff --git a/src/server/scripts/Commands/cs_honor.cpp b/src/server/scripts/Commands/cs_honor.cpp index da30f23a4..c525778c7 100644 --- a/src/server/scripts/Commands/cs_honor.cpp +++ b/src/server/scripts/Commands/cs_honor.cpp @@ -90,7 +90,7 @@ public: } // check online security - if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) + if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) return false; handler->GetSession()->GetPlayer()->RewardHonor(target, 1); diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp index e33ca797d..9c36e5bfb 100644 --- a/src/server/scripts/Commands/cs_instance.cpp +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -76,14 +76,14 @@ public: uint32 counter = 0; for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) { - BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(player->GetGUIDLow(), Difficulty(i)); + BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(player->GetGUIDLow(), Difficulty(i)); for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr) { InstanceSave* save = itr->second.save; - uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime(); - uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0); + uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime(); + uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0); std::string timeleft = GetTimeString(ttr); - handler->PSendSysMessage("map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : "")); + handler->PSendSysMessage("map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : "")); counter++; } } @@ -124,12 +124,12 @@ public: InstanceSave* save = itr->second.save; if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty())) { - uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime(); - uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0); + uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime(); + uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0); std::string timeleft = GetTimeString(ttr); handler->PSendSysMessage("unbinding map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : "")); - sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUIDLow(), itr->first, Difficulty(i), true, player); - itr = m_boundInstances.begin(); + sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUIDLow(), itr->first, Difficulty(i), true, player); + itr = m_boundInstances.begin(); counter++; } else @@ -143,14 +143,14 @@ public: static bool HandleInstanceStatsCommand(ChatHandler* handler, char const* /*args*/) { - uint32 dungeon = 0, battleground = 0, arena = 0, spectators = 0; - sMapMgr->GetNumInstances(dungeon, battleground, arena); + uint32 dungeon = 0, battleground = 0, arena = 0, spectators = 0; + sMapMgr->GetNumInstances(dungeon, battleground, arena); handler->PSendSysMessage("instances loaded: dungeons (%d), battlegrounds (%d), arenas (%d)", dungeon, battleground, arena); - dungeon = 0; battleground = 0; arena = 0; spectators = 0; - sMapMgr->GetNumPlayersInInstances(dungeon, battleground, arena, spectators); + dungeon = 0; battleground = 0; arena = 0; spectators = 0; + sMapMgr->GetNumPlayersInInstances(dungeon, battleground, arena, spectators); handler->PSendSysMessage("players in instances: dungeons (%d), battlegrounds (%d), arenas (%d + %d spect)", dungeon, battleground, arena, spectators); - handler->SetSentErrorMessage(true); + handler->SetSentErrorMessage(true); return false; } diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index 27856b99a..5fd16c6f1 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -229,18 +229,18 @@ public: // xinef: search highest talent rank uint32 spellId = 0; - uint8 rankId = MAX_TALENT_RANK; + uint8 rankId = MAX_TALENT_RANK; for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank) { if (talentInfo->RankID[rank] != 0) { - rankId = rank; + rankId = rank; spellId = talentInfo->RankID[rank]; break; } } - // xinef: some errors? + // xinef: some errors? if (!spellId || rankId == MAX_TALENT_RANK) continue; @@ -248,7 +248,7 @@ public: if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo)) continue; - player->LearnTalent(talentInfo->TalentID, rankId); + player->LearnTalent(talentInfo->TalentID, rankId); } handler->SendSysMessage(LANG_COMMAND_LEARN_CLASS_TALENTS); diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp index f17c97c5b..755ed7397 100644 --- a/src/server/scripts/Commands/cs_lfg.cpp +++ b/src/server/scripts/Commands/cs_lfg.cpp @@ -85,7 +85,7 @@ public: handler->PSendSysMessage(LANG_LFG_NOT_IN_GROUP, playerName.c_str()); return true; } - /* + /* uint64 guid = grp->GetGUID(); std::string const& state = lfg::GetStateString(sLFGMgr->GetState(guid)); handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(), @@ -93,7 +93,7 @@ public: for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) GetPlayerInfo(handler, itr->GetSource()); - */ + */ return true; } diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index e64ea3a34..2abeda4fc 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -449,8 +449,8 @@ public: GUID_LOPART(aura->GetCasterGUID())); } - if (!args || std::string(args) != "all") - return true; + if (!args || std::string(args) != "all") + return true; for (uint16 i = 0; i < TOTAL_AURAS; ++i) { diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 51da7931b..56f597fc0 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -1263,8 +1263,8 @@ public: uint32 count = 0; uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - const char* name_races[RACE_DRAENEI] = {"Human", "Orc", "Dwarf", "Night Elf", "Undead", "Tauren", "Gnome", "Troll", "", "Blood Elf", "Draenei"}; - const char* name_classes[CLASS_DRUID] = {"Warrior", "Paladin", "Hunter", "Rogue", "Priest", "Death Knight", "Shaman", "Mage", "Warlock", "", "Druid"}; + const char* name_races[RACE_DRAENEI] = {"Human", "Orc", "Dwarf", "Night Elf", "Undead", "Tauren", "Gnome", "Troll", "", "Blood Elf", "Draenei"}; + const char* name_classes[CLASS_DRUID] = {"Warrior", "Paladin", "Hunter", "Rogue", "Priest", "Death Knight", "Shaman", "Mage", "Warlock", "", "Druid"}; do { @@ -1291,20 +1291,20 @@ public: Field* characterFields = result2->Fetch(); uint32 guid = characterFields[0].GetUInt32(); std::string name = characterFields[1].GetString(); - uint8 plevel = 0, prace = 0, pclass = 0; - bool online = (ObjectAccessor::FindPlayerInOrOutOfWorld(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)) != NULL); + uint8 plevel = 0, prace = 0, pclass = 0; + bool online = (ObjectAccessor::FindPlayerInOrOutOfWorld(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)) != NULL); - if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(guid)) - { - plevel = gpd->level; - prace = gpd->race; - pclass = gpd->playerClass; - } + if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(guid)) + { + plevel = gpd->level; + prace = gpd->race; + pclass = gpd->playerClass; + } - if (plevel > 0 && prace > 0 && prace <= RACE_DRAENEI && pclass > 0 && pclass <= CLASS_DRUID) - handler->PSendSysMessage(" %s (GUID %u) - %s - %s - %u%s", name.c_str(), guid, name_races[prace-1], name_classes[pclass-1], plevel, (online ? " - online" : "")); - else - handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid); + if (plevel > 0 && prace > 0 && prace <= RACE_DRAENEI && pclass > 0 && pclass <= CLASS_DRUID) + handler->PSendSysMessage(" %s (GUID %u) - %s - %s - %u%s", name.c_str(), guid, name_races[prace-1], name_classes[pclass-1], plevel, (online ? " - online" : "")); + else + handler->PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER, name.c_str(), guid); ++counter; } while (result2->NextRow() && (limit == -1 || counter < limit)); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index b136ad1e8..478802ae7 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -133,220 +133,220 @@ public: return commandTable; } - static bool HandleSkirmishCommand(ChatHandler* handler, char const* args) - { - Tokenizer tokens(args, ' '); + static bool HandleSkirmishCommand(ChatHandler* handler, char const* args) + { + Tokenizer tokens(args, ' '); - if (!*args || !tokens.size()) - { - handler->PSendSysMessage("Usage: .skirmish [arena] [XvX] [Nick1] [Nick2] ... [NickN]"); - handler->PSendSysMessage("[arena] can be \"all\" or comma-separated list of possible arenas (NA,BE,RL,DS,RV)."); - handler->PSendSysMessage("[XvX] can be 1v1, 2v2, 3v3, 5v5. After [XvX] specify enough nicknames for that mode."); - handler->SetSentErrorMessage(true); - return false; - } - - Tokenizer::const_iterator i = tokens.begin(); - - std::set allowedArenas; - std::string arenasStr = *(i++); - std::string tmpStr; - Tokenizer arenaTokens(arenasStr, ','); - for (Tokenizer::const_iterator itr = arenaTokens.begin(); itr != arenaTokens.end(); ++itr) - { - tmpStr = std::string(*itr); - if (tmpStr == "all") - { - if (arenaTokens.size() > 1) - { - handler->PSendSysMessage("Invalid [arena] specified."); - handler->SetSentErrorMessage(true); - return false; - } - allowedArenas.insert(BATTLEGROUND_NA); - allowedArenas.insert(BATTLEGROUND_BE); - allowedArenas.insert(BATTLEGROUND_RL); - allowedArenas.insert(BATTLEGROUND_DS); - allowedArenas.insert(BATTLEGROUND_RV); - } - else if (tmpStr == "NA") - allowedArenas.insert(BATTLEGROUND_NA); - else if (tmpStr == "BE") - allowedArenas.insert(BATTLEGROUND_BE); - else if (tmpStr == "RL") - allowedArenas.insert(BATTLEGROUND_RL); - else if (tmpStr == "DS") - allowedArenas.insert(BATTLEGROUND_DS); - else if (tmpStr == "RV") - allowedArenas.insert(BATTLEGROUND_RV); - else - { - handler->PSendSysMessage("Invalid [arena] specified."); - handler->SetSentErrorMessage(true); - return false; - } - } - ASSERT(!allowedArenas.empty()); - BattlegroundTypeId randomizedArenaBgTypeId = Trinity::Containers::SelectRandomContainerElement(allowedArenas); - - uint8 count = 0; - if (i != tokens.end()) - { - std::string mode = *(i++); - if (mode == "1v1") count = 2; - else if (mode == "2v2") count = 4; - else if (mode == "3v3") count = 6; - else if (mode == "5v5") count = 10; - } - - if (!count) - { - handler->PSendSysMessage("Invalid bracket. Can be 1v1, 2v2, 3v3, 5v5"); - handler->SetSentErrorMessage(true); - return false; - } - - if (tokens.size() != count+2) - { - handler->PSendSysMessage("Invalid number of nicknames for this bracket."); - handler->SetSentErrorMessage(true); - return false; - } - - uint8 hcnt = count / 2; - uint8 error = 0; - std::string last_name; - Player* plr = NULL; - Player* players[10] = {NULL}; - uint8 cnt = 0; - for (; i != tokens.end(); ++i) + if (!*args || !tokens.size()) { - last_name = std::string(*i); - plr = ObjectAccessor::FindPlayerByName(last_name, false); - if (!plr) { error = 1; break; } - if (!plr->IsInWorld() || !plr->FindMap() || plr->IsBeingTeleported()) { error = 2; break; } - if (plr->GetMap()->GetEntry()->Instanceable()) { error = 3; break; } - if (plr->isUsingLfg()) { error = 4; break; } - if (plr->InBattlegroundQueue()) { error = 5; break; } - if (plr->IsInFlight()) { error = 10; break; } - if (!plr->IsAlive()) { error = 11; break; } - const Group* g = plr->GetGroup(); - if (hcnt > 1) - { - if (!g) { error = 6; break; } - if (g->isRaidGroup() || g->isBGGroup() || g->isBFGroup() || g->isLFGGroup()) { error = 7; break; } - if (g->GetMembersCount() != hcnt) { error = 8; break; } - - uint8 sti = (cnt < hcnt ? 0 : hcnt); - if (sti != cnt) - if (players[sti]->GetGroup() != plr->GetGroup()) { error = 9; last_name += " and " + players[sti]->GetName(); break; } - } - else // 1v1 - { - if (g) { error = 12; break; } - } - players[cnt++] = plr; + handler->PSendSysMessage("Usage: .skirmish [arena] [XvX] [Nick1] [Nick2] ... [NickN]"); + handler->PSendSysMessage("[arena] can be \"all\" or comma-separated list of possible arenas (NA,BE,RL,DS,RV)."); + handler->PSendSysMessage("[XvX] can be 1v1, 2v2, 3v3, 5v5. After [XvX] specify enough nicknames for that mode."); + handler->SetSentErrorMessage(true); + return false; } - for (uint8 i=0; iGetGUID() == players[j]->GetGUID()) - { - last_name = players[i]->GetName(); - error = 13; - break; - } + Tokenizer::const_iterator i = tokens.begin(); - switch (error) - { - case 1: - handler->PSendSysMessage("Player %s not found.", last_name.c_str()); - break; - case 2: - handler->PSendSysMessage("Player %s is being teleported.", last_name.c_str()); - break; - case 3: - handler->PSendSysMessage("Player %s is in instance/battleground/arena.", last_name.c_str()); - break; - case 4: - handler->PSendSysMessage("Player %s is in LFG system.", last_name.c_str()); - break; - case 5: - handler->PSendSysMessage("Player %s is queued for battleground/arena.", last_name.c_str()); - break; - case 6: - handler->PSendSysMessage("Player %s is not in group.", last_name.c_str()); - break; - case 7: - handler->PSendSysMessage("Player %s is not in normal group.", last_name.c_str()); - break; - case 8: - handler->PSendSysMessage("Group of player %s has invalid member count.", last_name.c_str()); - break; - case 9: - handler->PSendSysMessage("Players %s are not in the same group.", last_name.c_str()); - break; - case 10: - handler->PSendSysMessage("Player %s is in flight.", last_name.c_str()); - break; - case 11: - handler->PSendSysMessage("Player %s is dead.", last_name.c_str()); - break; - case 12: - handler->PSendSysMessage("Player %s is in a group.", last_name.c_str()); - break; - case 13: - handler->PSendSysMessage("Player %s occurs more than once.", last_name.c_str()); - break; - } + std::set allowedArenas; + std::string arenasStr = *(i++); + std::string tmpStr; + Tokenizer arenaTokens(arenasStr, ','); + for (Tokenizer::const_iterator itr = arenaTokens.begin(); itr != arenaTokens.end(); ++itr) + { + tmpStr = std::string(*itr); + if (tmpStr == "all") + { + if (arenaTokens.size() > 1) + { + handler->PSendSysMessage("Invalid [arena] specified."); + handler->SetSentErrorMessage(true); + return false; + } + allowedArenas.insert(BATTLEGROUND_NA); + allowedArenas.insert(BATTLEGROUND_BE); + allowedArenas.insert(BATTLEGROUND_RL); + allowedArenas.insert(BATTLEGROUND_DS); + allowedArenas.insert(BATTLEGROUND_RV); + } + else if (tmpStr == "NA") + allowedArenas.insert(BATTLEGROUND_NA); + else if (tmpStr == "BE") + allowedArenas.insert(BATTLEGROUND_BE); + else if (tmpStr == "RL") + allowedArenas.insert(BATTLEGROUND_RL); + else if (tmpStr == "DS") + allowedArenas.insert(BATTLEGROUND_DS); + else if (tmpStr == "RV") + allowedArenas.insert(BATTLEGROUND_RV); + else + { + handler->PSendSysMessage("Invalid [arena] specified."); + handler->SetSentErrorMessage(true); + return false; + } + } + ASSERT(!allowedArenas.empty()); + BattlegroundTypeId randomizedArenaBgTypeId = Trinity::Containers::SelectRandomContainerElement(allowedArenas); - if (error) - { - handler->SetSentErrorMessage(true); - return false; - } + uint8 count = 0; + if (i != tokens.end()) + { + std::string mode = *(i++); + if (mode == "1v1") count = 2; + else if (mode == "2v2") count = 4; + else if (mode == "3v3") count = 6; + else if (mode == "5v5") count = 10; + } - Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA); - if (!bgt) - { - handler->PSendSysMessage("Couldn't create arena map!"); - handler->SetSentErrorMessage(true); - return false; - } + if (!count) + { + handler->PSendSysMessage("Invalid bracket. Can be 1v1, 2v2, 3v3, 5v5"); + handler->SetSentErrorMessage(true); + return false; + } - Battleground* bg = sBattlegroundMgr->CreateNewBattleground(randomizedArenaBgTypeId, 80, 80, ArenaType(hcnt >= 2 ? hcnt : 2), false); - if (!bg) - { - handler->PSendSysMessage("Couldn't create arena map!"); - handler->SetSentErrorMessage(true); - return false; - } + if (tokens.size() != count+2) + { + handler->PSendSysMessage("Invalid number of nicknames for this bracket."); + handler->SetSentErrorMessage(true); + return false; + } - bg->StartBattleground(); + uint8 hcnt = count / 2; + uint8 error = 0; + std::string last_name; + Player* plr = NULL; + Player* players[10] = {NULL}; + uint8 cnt = 0; + for (; i != tokens.end(); ++i) + { + last_name = std::string(*i); + plr = ObjectAccessor::FindPlayerByName(last_name, false); + if (!plr) { error = 1; break; } + if (!plr->IsInWorld() || !plr->FindMap() || plr->IsBeingTeleported()) { error = 2; break; } + if (plr->GetMap()->GetEntry()->Instanceable()) { error = 3; break; } + if (plr->isUsingLfg()) { error = 4; break; } + if (plr->InBattlegroundQueue()) { error = 5; break; } + if (plr->IsInFlight()) { error = 10; break; } + if (!plr->IsAlive()) { error = 11; break; } + const Group* g = plr->GetGroup(); + if (hcnt > 1) + { + if (!g) { error = 6; break; } + if (g->isRaidGroup() || g->isBGGroup() || g->isBFGroup() || g->isLFGGroup()) { error = 7; break; } + if (g->GetMembersCount() != hcnt) { error = 8; break; } - BattlegroundTypeId bgTypeId = bg->GetBgTypeID(); + uint8 sti = (cnt < hcnt ? 0 : hcnt); + if (sti != cnt) + if (players[sti]->GetGroup() != plr->GetGroup()) { error = 9; last_name += " and " + players[sti]->GetName(); break; } + } + else // 1v1 + { + if (g) { error = 12; break; } + } + players[cnt++] = plr; + } - TeamId teamId1 = Player::TeamIdForRace(players[0]->getRace()); - TeamId teamId2 = (teamId1 == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE); - for (uint8 i=0; iGetGUID() == players[j]->GetGUID()) + { + last_name = players[i]->GetName(); + error = 13; + break; + } - TeamId teamId = (i < hcnt ? teamId1 : teamId2); - player->SetEntryPoint(); + switch (error) + { + case 1: + handler->PSendSysMessage("Player %s not found.", last_name.c_str()); + break; + case 2: + handler->PSendSysMessage("Player %s is being teleported.", last_name.c_str()); + break; + case 3: + handler->PSendSysMessage("Player %s is in instance/battleground/arena.", last_name.c_str()); + break; + case 4: + handler->PSendSysMessage("Player %s is in LFG system.", last_name.c_str()); + break; + case 5: + handler->PSendSysMessage("Player %s is queued for battleground/arena.", last_name.c_str()); + break; + case 6: + handler->PSendSysMessage("Player %s is not in group.", last_name.c_str()); + break; + case 7: + handler->PSendSysMessage("Player %s is not in normal group.", last_name.c_str()); + break; + case 8: + handler->PSendSysMessage("Group of player %s has invalid member count.", last_name.c_str()); + break; + case 9: + handler->PSendSysMessage("Players %s are not in the same group.", last_name.c_str()); + break; + case 10: + handler->PSendSysMessage("Player %s is in flight.", last_name.c_str()); + break; + case 11: + handler->PSendSysMessage("Player %s is dead.", last_name.c_str()); + break; + case 12: + handler->PSendSysMessage("Player %s is in a group.", last_name.c_str()); + break; + case 13: + handler->PSendSysMessage("Player %s occurs more than once.", last_name.c_str()); + break; + } - uint32 queueSlot = 0; - WorldPacket data; - sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType(), teamId); - player->GetSession()->SendPacket(&data); + if (error) + { + handler->SetSentErrorMessage(true); + return false; + } - player->SetBattlegroundId(bg->GetInstanceID(), bgTypeId, queueSlot, true, false, teamId); - sBattlegroundMgr->SendToBattleground(player, bg->GetInstanceID(), bgTypeId); - } + Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA); + if (!bgt) + { + handler->PSendSysMessage("Couldn't create arena map!"); + handler->SetSentErrorMessage(true); + return false; + } - handler->PSendSysMessage("Success! Players are now being teleported to the arena."); - return true; - } + Battleground* bg = sBattlegroundMgr->CreateNewBattleground(randomizedArenaBgTypeId, 80, 80, ArenaType(hcnt >= 2 ? hcnt : 2), false); + if (!bg) + { + handler->PSendSysMessage("Couldn't create arena map!"); + handler->SetSentErrorMessage(true); + return false; + } + + bg->StartBattleground(); + + BattlegroundTypeId bgTypeId = bg->GetBgTypeID(); + + TeamId teamId1 = Player::TeamIdForRace(players[0]->getRace()); + TeamId teamId2 = (teamId1 == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE); + for (uint8 i=0; iSetEntryPoint(); + + uint32 queueSlot = 0; + WorldPacket data; + sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType(), teamId); + player->GetSession()->SendPacket(&data); + + player->SetBattlegroundId(bg->GetInstanceID(), bgTypeId, queueSlot, true, false, teamId); + sBattlegroundMgr->SendToBattleground(player, bg->GetInstanceID(), bgTypeId); + } + + handler->PSendSysMessage("Success! Players are now being teleported to the arena."); + return true; + } static bool HandleDevCommand(ChatHandler* handler, char const* args) { @@ -363,9 +363,9 @@ public: if (argstr == "on") { - handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); - handler->GetSession()->SendNotification(LANG_DEV_ON); - return true; + handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); + handler->GetSession()->SendNotification(LANG_DEV_ON); + return true; } if (argstr == "off") @@ -380,7 +380,7 @@ public: return false; } - static bool HandleGPSCommand(ChatHandler* handler, char const* args) + static bool HandleGPSCommand(ChatHandler* handler, char const* args) { WorldObject* object = NULL; if (*args) @@ -460,8 +460,8 @@ public: if (status) handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status); - if (Transport* t = object->GetTransport()) - handler->PSendSysMessage("Transport offset: %.2f, %.2f, %.2f, %.2f", object->m_movementInfo.transport.pos.GetPositionX(), object->m_movementInfo.transport.pos.GetPositionY(), object->m_movementInfo.transport.pos.GetPositionZ(), object->m_movementInfo.transport.pos.GetOrientation()); + if (Transport* t = object->GetTransport()) + handler->PSendSysMessage("Transport offset: %.2f, %.2f, %.2f, %.2f", object->m_movementInfo.transport.pos.GetPositionX(), object->m_movementInfo.transport.pos.GetPositionY(), object->m_movementInfo.transport.pos.GetPositionZ(), object->m_movementInfo.transport.pos.GetOrientation()); return true; } @@ -607,7 +607,7 @@ public: InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(_player->GetGUIDLow(), target->GetMapId(), target->GetDifficulty(map->IsRaid())); if (!bind) if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId())) - sInstanceSaveMgr->PlayerBindToInstance(_player->GetGUIDLow(), save, !save->CanReset(), _player); + sInstanceSaveMgr->PlayerBindToInstance(_player->GetGUIDLow(), save, !save->CanReset(), _player); if (map->IsRaid()) _player->SetRaidDifficulty(target->GetRaidDifficulty()); @@ -703,9 +703,9 @@ public: } else if (map->IsDungeon()) { - // pussywizard: prevent unbinding normal player's perm bind by just summoning him >_> - if (!target->GetSession()->GetSecurity()) - { + // pussywizard: prevent unbinding normal player's perm bind by just summoning him >_> + if (!target->GetSession()->GetSecurity()) + { handler->PSendSysMessage("Only GMs can be summoned to an instance!"); handler->SetSentErrorMessage(true); return false; @@ -888,11 +888,11 @@ public: if (target->IsAlive()) { if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE)) - { - if (target->GetTypeId() == TYPEID_UNIT && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard - target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth()); + { + if (target->GetTypeId() == TYPEID_UNIT && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard + target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth()); Unit::Kill(handler->GetSession()->GetPlayer(), target); - } + } else Unit::DealDamage(handler->GetSession()->GetPlayer(), target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false, true); } @@ -1341,11 +1341,11 @@ public: std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM); - if (data->teamId == TEAM_NEUTRAL) + if (data->teamId == TEAM_NEUTRAL) team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); - else if (data->teamId == TEAM_HORDE) + else if (data->teamId == TEAM_HORDE) team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); - else if (data->teamId == TEAM_ALLIANCE) + else if (data->teamId == TEAM_ALLIANCE) team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id); @@ -1543,11 +1543,11 @@ public: return true; } - if (handler->GetSession()->GetSecurity() < SEC_ADMINISTRATOR) - { - handler->PSendSysMessage("You may only remove items. Adding items is available for higher GMLevel."); - return false; - } + if (handler->GetSession()->GetSecurity() < SEC_ADMINISTRATOR) + { + handler->PSendSysMessage("You may only remove items. Adding items is available for higher GMLevel."); + return false; + } // Adding items uint32 noSpaceForCount = 0; @@ -1801,21 +1801,21 @@ public: uint32 areaId; uint32 phase = 0; - // pussywizard: guild info - std::string guildName = ""; - bool guildIsLeader = false; - uint64 guildMoney = 0; - uint32 guildMemberCount = 0; - if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(targetGuid)) - if (gpd->guildId) - if (Guild* targetGuild = sGuildMgr->GetGuildById(gpd->guildId)) - { - guildName = targetGuild->GetName(); - guildMoney = targetGuild->GetTotalBankMoney(); - guildMemberCount = targetGuild->GetMemberCount(); - if (targetGuild->GetLeaderGUID() == targetGuid) - guildIsLeader = true; - } + // pussywizard: guild info + std::string guildName = ""; + bool guildIsLeader = false; + uint64 guildMoney = 0; + uint32 guildMemberCount = 0; + if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(targetGuid)) + if (gpd->guildId) + if (Guild* targetGuild = sGuildMgr->GetGuildById(gpd->guildId)) + { + guildName = targetGuild->GetName(); + guildMoney = targetGuild->GetTotalBankMoney(); + guildMemberCount = targetGuild->GetMemberCount(); + if (targetGuild->GetLeaderGUID() == targetGuid) + guildIsLeader = true; + } // get additional information from Player object if (target) @@ -2038,13 +2038,13 @@ public: else handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str()); - if (!guildName.empty()) - { - uint32 gold = guildMoney /GOLD; - uint32 silv = (guildMoney % GOLD) / SILVER; - uint32 copp = (guildMoney % GOLD) % SILVER; - handler->PSendSysMessage("Guild: %s, members: %u, gb money: %ug %us %uc, is guild leader: %s", guildName.c_str(), guildMemberCount, gold, silv, copp, guildIsLeader ? "yes" : "no"); - } + if (!guildName.empty()) + { + uint32 gold = guildMoney /GOLD; + uint32 silv = (guildMoney % GOLD) / SILVER; + uint32 copp = (guildMoney % GOLD) % SILVER; + handler->PSendSysMessage("Guild: %s, members: %u, gb money: %ug %us %uc, is guild leader: %s", guildName.c_str(), guildMemberCount, gold, silv, copp, guildIsLeader ? "yes" : "no"); + } return true; } @@ -2362,8 +2362,8 @@ public: uint32 damage = damage_int; - if (target->GetTypeId() == TYPEID_UNIT && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard - target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth()); + if (target->GetTypeId() == TYPEID_UNIT && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard + target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth()); Unit::DealDamage(handler->GetSession()->GetPlayer(), target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false, true); if (target != handler->GetSession()->GetPlayer()) handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0); @@ -2670,8 +2670,8 @@ public: if (!handler->extractPlayerTarget((char*)args, &player)) return false; - if (!player) - return false; + if (!player) + return false; char* msgStr = strtok(NULL, ""); if (!msgStr) @@ -2908,18 +2908,18 @@ public: { handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); player->RemoveAurasDueToSpell(9454); - return true; + return true; } else if (targetName) { - if (uint64 playerGUID = sWorld->GetGlobalPlayerGUID(name)) - { - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); - stmt->setUInt32(0, GUID_LOPART(playerGUID)); - CharacterDatabase.Execute(stmt); - handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); - return true; - } + if (uint64 playerGUID = sWorld->GetGlobalPlayerGUID(name)) + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); + stmt->setUInt32(0, GUID_LOPART(playerGUID)); + CharacterDatabase.Execute(stmt); + handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); + return true; + } } handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); @@ -3046,9 +3046,9 @@ public: if (playerTarget) groupTarget = playerTarget->GetGroup(); - if (!groupTarget && guidTarget) - if (uint32 groupId = Player::GetGroupIdFromStorage(GUID_LOPART(guidTarget))) - groupTarget = sGroupMgr->GetGroupByGUID(groupId); + if (!groupTarget && guidTarget) + if (uint32 groupId = Player::GetGroupIdFromStorage(GUID_LOPART(guidTarget))) + groupTarget = sGroupMgr->GetGroupByGUID(groupId); if (groupTarget) { diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 35a2ee850..0ff10eea9 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -37,7 +37,7 @@ public: ChatCommand* GetCommands() const { - static ChatCommand modifyspeedCommandTable[] = + static ChatCommand modifyspeedCommandTable[] = { { "fly", SEC_GAMEMASTER, false, &HandleModifyFlyCommand, "", NULL }, { "all", SEC_GAMEMASTER, false, &HandleModifyASpeedCommand, "", NULL }, @@ -69,12 +69,12 @@ public: { "standstate", SEC_GAMEMASTER, false, &HandleModifyStandStateCommand, "", NULL }, { "phase", SEC_ADMINISTRATOR, false, &HandleModifyPhaseCommand, "", NULL }, { "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "", NULL }, - { "speed", SEC_GAMEMASTER, false, NULL, "", modifyspeedCommandTable }, + { "speed", SEC_GAMEMASTER, false, NULL, "", modifyspeedCommandTable }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { - { "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL }, + { "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "", NULL }, { "demorph", SEC_GAMEMASTER, false, &HandleDeMorphCommand, "", NULL }, { "modify", SEC_GAMEMASTER, false, NULL, "", modifyCommandTable }, { NULL, 0, false, NULL, "", NULL } @@ -487,8 +487,8 @@ public: } Player* target = handler->getSelectedPlayerOrSelf(); - if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) - target = handler->GetSession()->GetPlayer(); + if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) + target = handler->GetSession()->GetPlayer(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -537,8 +537,8 @@ public: } Player* target = handler->getSelectedPlayerOrSelf(); - if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) - target = handler->GetSession()->GetPlayer(); + if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) + target = handler->GetSession()->GetPlayer(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -584,8 +584,8 @@ public: } Player* target = handler->getSelectedPlayerOrSelf(); - if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) - target = handler->GetSession()->GetPlayer(); + if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) + target = handler->GetSession()->GetPlayer(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -631,8 +631,8 @@ public: } Player* target = handler->getSelectedPlayerOrSelf(); - if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) - target = handler->GetSession()->GetPlayer(); + if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) + target = handler->GetSession()->GetPlayer(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -678,8 +678,8 @@ public: } Player* target = handler->getSelectedPlayerOrSelf(); - if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) - target = handler->GetSession()->GetPlayer(); + if (handler->GetSession()->GetSecurity() < SEC_GAMEMASTER) + target = handler->GetSession()->GetPlayer(); if (!target) { handler->SendSysMessage(LANG_NO_CHAR_SELECTED); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index ed4e0c040..e565063a6 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -175,24 +175,24 @@ public: Map* map = chr->GetMap(); if (Transport* tt = chr->GetTransport()) - if (MotionTransport* trans = tt->ToMotionTransport()) - { - uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT); - CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid); - data.id = id; - data.phaseMask = chr->GetPhaseMaskForSpawn(); - data.posX = chr->GetTransOffsetX(); - data.posY = chr->GetTransOffsetY(); - data.posZ = chr->GetTransOffsetZ(); - data.orientation = chr->GetTransOffsetO(); + if (MotionTransport* trans = tt->ToMotionTransport()) + { + uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT); + CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid); + data.id = id; + data.phaseMask = chr->GetPhaseMaskForSpawn(); + data.posX = chr->GetTransOffsetX(); + data.posY = chr->GetTransOffsetY(); + data.posZ = chr->GetTransOffsetZ(); + data.orientation = chr->GetTransOffsetO(); - Creature* creature = trans->CreateNPCPassenger(guid, &data); + Creature* creature = trans->CreateNPCPassenger(guid, &data); - creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMaskForSpawn()); + creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMaskForSpawn()); - sObjectMgr->AddCreatureToGrid(guid, &data); - return true; - } + sObjectMgr->AddCreatureToGrid(guid, &data); + return true; + } Creature* creature = new Creature(); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, x, y, z, o)) @@ -260,7 +260,7 @@ public: return false; } - char* addMulti = strtok(NULL, " "); + char* addMulti = strtok(NULL, " "); uint32 vendor_entry = addMulti ? handler->GetSession()->GetCurrentVendor() : vendor ? vendor->GetEntry() : 0; if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer())) @@ -484,7 +484,7 @@ public: } uint32 itemId = atol(pitem); - char* addMulti = strtok(NULL, " "); + char* addMulti = strtok(NULL, " "); if (!sObjectMgr->RemoveVendorItem(addMulti ? handler->GetSession()->GetCurrentVendor() : vendor->GetEntry(), itemId)) { handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId); @@ -574,7 +574,7 @@ public: return true; } - //set data of creature for testing scripting + //set data of creature for testing scripting static bool HandleNpcSetDataCommand(ChatHandler* handler, const char* args) { if (!*args) @@ -603,7 +603,7 @@ public: creature->AI()->SetData(data_1, data_2); std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set"); - handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str()); + handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str()); return true; } diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index e0ceab608..cdcbd9a0e 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -117,20 +117,20 @@ public: uint32 updateTime = sWorld->GetUpdateTime(); uint32 avgUpdateTime = avgDiffTracker.getAverage(); - handler->PSendSysMessage("%s Realm, revision: %s.", realmName.c_str(), _REVISION); - handler->PSendSysMessage("This server runs on SunwellCore."); - if (!queuedSessionCount) - handler->PSendSysMessage("Connected players: %u. Characters in world: %u.", activeSessionCount, playerCount); - else - handler->PSendSysMessage("Connected players: %u. Characters in world: %u. Queue: %u.", activeSessionCount, playerCount, queuedSessionCount); - //handler->PSendSysMessage("Connection peak: %u.", connPeak); + handler->PSendSysMessage("%s Realm, revision: %s.", realmName.c_str(), _REVISION); + handler->PSendSysMessage("This server runs on SunwellCore."); + if (!queuedSessionCount) + handler->PSendSysMessage("Connected players: %u. Characters in world: %u.", activeSessionCount, playerCount); + else + handler->PSendSysMessage("Connected players: %u. Characters in world: %u. Queue: %u.", activeSessionCount, playerCount, queuedSessionCount); + //handler->PSendSysMessage("Connection peak: %u.", connPeak); handler->PSendSysMessage(LANG_UPTIME, uptime.c_str()); - handler->PSendSysMessage("Update time diff: %ums, average: %ums.", updateTime, avgUpdateTime); + handler->PSendSysMessage("Update time diff: %ums, average: %ums.", updateTime, avgUpdateTime); - if (handler->GetSession()) - if (Player* p = handler->GetSession()->GetPlayer()) - if (p->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER)) - handler->PSendSysMessage("DEV wavg: %ums, nsmax: %ums, nsavg: %ums. LFG avg: %ums, max: %ums.", avgDiffTracker.getTimeWeightedAverage(), devDiffTracker.getMax(), devDiffTracker.getAverage(), lfgDiffTracker.getAverage(), lfgDiffTracker.getMax()); + if (handler->GetSession()) + if (Player* p = handler->GetSession()->GetPlayer()) + if (p->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER)) + handler->PSendSysMessage("DEV wavg: %ums, nsmax: %ums, nsavg: %ums. LFG avg: %ums, max: %ums.", avgDiffTracker.getTimeWeightedAverage(), devDiffTracker.getMax(), devDiffTracker.getAverage(), lfgDiffTracker.getAverage(), lfgDiffTracker.getMax()); //! Can't use sWorld->ShutdownMsg here in case of console command if (sWorld->IsShuttingDown()) diff --git a/src/server/scripts/Commands/cs_spectator.cpp b/src/server/scripts/Commands/cs_spectator.cpp index 28cb8f827..07a1e75e7 100644 --- a/src/server/scripts/Commands/cs_spectator.cpp +++ b/src/server/scripts/Commands/cs_spectator.cpp @@ -36,219 +36,219 @@ public: return commandTable; } - static bool HandleSpectatorCommand(ChatHandler* handler, char const* args) + static bool HandleSpectatorCommand(ChatHandler* handler, char const* args) { - handler->PSendSysMessage("Incorrect syntax."); - handler->PSendSysMessage("Command has subcommands:"); - handler->PSendSysMessage(" spectate"); - handler->PSendSysMessage(" leave"); - return true; + handler->PSendSysMessage("Incorrect syntax."); + handler->PSendSysMessage("Command has subcommands:"); + handler->PSendSysMessage(" spectate"); + handler->PSendSysMessage(" leave"); + return true; } - static bool HandleSpectatorVersionCommand(ChatHandler* handler, char const* args) + static bool HandleSpectatorVersionCommand(ChatHandler* handler, char const* args) { if (atoi(args) < SPECTATOR_ADDON_VERSION) - ArenaSpectator::SendCommand(handler->GetSession()->GetPlayer(), "%sOUTDATED", SPECTATOR_ADDON_PREFIX); - return true; + ArenaSpectator::SendCommand(handler->GetSession()->GetPlayer(), "%sOUTDATED", SPECTATOR_ADDON_PREFIX); + return true; } - static bool HandleSpectatorResetCommand(ChatHandler* handler, char const* args) + static bool HandleSpectatorResetCommand(ChatHandler* handler, char const* args) { Player* p = handler->GetSession()->GetPlayer(); - if (!p->IsSpectator()) - return true; - ArenaSpectator::HandleResetCommand(p); - return true; + if (!p->IsSpectator()) + return true; + ArenaSpectator::HandleResetCommand(p); + return true; } - static bool HandleSpectatorLeaveCommand(ChatHandler* handler, char const* args) + static bool HandleSpectatorLeaveCommand(ChatHandler* handler, char const* args) { - Player* player = handler->GetSession()->GetPlayer(); - if (!player->IsSpectator() || !player->FindMap() || !player->FindMap()->IsBattleArena()) - { - handler->SendSysMessage("You are not a spectator."); - return true; - } + Player* player = handler->GetSession()->GetPlayer(); + if (!player->IsSpectator() || !player->FindMap() || !player->FindMap()->IsBattleArena()) + { + handler->SendSysMessage("You are not a spectator."); + return true; + } - //player->SetIsSpectator(false); - player->TeleportToEntryPoint(); - return true; + //player->SetIsSpectator(false); + player->TeleportToEntryPoint(); + return true; } }; bool ArenaSpectator::HandleSpectatorSpectateCommand(ChatHandler* handler, char const* args) { - Player* player = handler->GetSession()->GetPlayer(); - std::list errors; - if (!*args) - { - handler->SendSysMessage("Missing player name."); - return true; - } - if (player->IsSpectator()) - { - if (player->FindMap() && player->FindMap()->IsBattleArena()) - { - HandleSpectatorWatchCommand(handler, args); - return true; - } - handler->PSendSysMessage("You are already spectacting arena."); - return true; - } - if (player->getClass() == CLASS_DEATH_KNIGHT && player->GetMapId() == 609) - { - handler->PSendSysMessage("Death Knights can't spectate before finishing questline."); - return true; - } + Player* player = handler->GetSession()->GetPlayer(); + std::list errors; + if (!*args) + { + handler->SendSysMessage("Missing player name."); + return true; + } + if (player->IsSpectator()) + { + if (player->FindMap() && player->FindMap()->IsBattleArena()) + { + HandleSpectatorWatchCommand(handler, args); + return true; + } + handler->PSendSysMessage("You are already spectacting arena."); + return true; + } + if (player->getClass() == CLASS_DEATH_KNIGHT && player->GetMapId() == 609) + { + handler->PSendSysMessage("Death Knights can't spectate before finishing questline."); + return true; + } - std::string name = std::string(args); - Player* spectate = ObjectAccessor::FindPlayerByName(name); - if (!spectate) - { - handler->SendSysMessage("Requested player not found."); - return true; - } - if (spectate->IsSpectator()) - { - handler->SendSysMessage("Requested player is a spectator."); - return true; - } - if (!spectate->FindMap() || !spectate->FindMap()->IsBattleArena()) - { - handler->SendSysMessage("Requested player is not in arena."); - return true; - } - BattlegroundMap* bgmap = ((BattlegroundMap*)spectate->FindMap()); - if (!bgmap->GetBG() || bgmap->GetBG()->GetStatus() == STATUS_WAIT_LEAVE) - { - handler->SendSysMessage("This arena battle has finished."); - return true; - } + std::string name = std::string(args); + Player* spectate = ObjectAccessor::FindPlayerByName(name); + if (!spectate) + { + handler->SendSysMessage("Requested player not found."); + return true; + } + if (spectate->IsSpectator()) + { + handler->SendSysMessage("Requested player is a spectator."); + return true; + } + if (!spectate->FindMap() || !spectate->FindMap()->IsBattleArena()) + { + handler->SendSysMessage("Requested player is not in arena."); + return true; + } + BattlegroundMap* bgmap = ((BattlegroundMap*)spectate->FindMap()); + if (!bgmap->GetBG() || bgmap->GetBG()->GetStatus() == STATUS_WAIT_LEAVE) + { + handler->SendSysMessage("This arena battle has finished."); + return true; + } - if (player->IsBeingTeleported() || !player->IsInWorld()) - errors.push_back("Can't use while being teleported."); - if (!player->FindMap() || player->FindMap()->Instanceable()) - errors.push_back("Can't use while in instance, bg or arena."); - if (player->GetVehicle()) - errors.push_back("Can't be on a vehicle."); - if (player->IsInCombat()) - errors.push_back("Can't be in combat."); - if (player->isUsingLfg()) - errors.push_back("Can't spectate while using LFG system."); - if (player->InBattlegroundQueue()) - errors.push_back("Can't be queued for arena or bg."); - if (player->GetGroup()) - errors.push_back("Can't be in a group."); - if (player->HasUnitState(UNIT_STATE_ISOLATED)) - errors.push_back("Can't be isolated."); - if (player->m_mover != player) - errors.push_back("You must control yourself."); - if (player->IsInFlight()) - errors.push_back("Can't be in flight."); - if (player->IsMounted()) - errors.push_back("Dismount before spectating."); - if (!player->IsAlive()) - errors.push_back("Must be alive."); - if (!player->m_Controlled.empty()) - errors.push_back("Can't be controlling creatures."); + if (player->IsBeingTeleported() || !player->IsInWorld()) + errors.push_back("Can't use while being teleported."); + if (!player->FindMap() || player->FindMap()->Instanceable()) + errors.push_back("Can't use while in instance, bg or arena."); + if (player->GetVehicle()) + errors.push_back("Can't be on a vehicle."); + if (player->IsInCombat()) + errors.push_back("Can't be in combat."); + if (player->isUsingLfg()) + errors.push_back("Can't spectate while using LFG system."); + if (player->InBattlegroundQueue()) + errors.push_back("Can't be queued for arena or bg."); + if (player->GetGroup()) + errors.push_back("Can't be in a group."); + if (player->HasUnitState(UNIT_STATE_ISOLATED)) + errors.push_back("Can't be isolated."); + if (player->m_mover != player) + errors.push_back("You must control yourself."); + if (player->IsInFlight()) + errors.push_back("Can't be in flight."); + if (player->IsMounted()) + errors.push_back("Dismount before spectating."); + if (!player->IsAlive()) + errors.push_back("Must be alive."); + if (!player->m_Controlled.empty()) + errors.push_back("Can't be controlling creatures."); - const Unit::VisibleAuraMap* va = player->GetVisibleAuras(); - for (Unit::VisibleAuraMap::const_iterator itr = va->begin(); itr != va->end(); ++itr) - if (Aura* aura = itr->second->GetBase()) - if (!itr->second->IsPositive() && !aura->IsPermanent() && aura->GetDuration() < HOUR*IN_MILLISECONDS) - { - switch (aura->GetSpellInfo()->Id) - { - case lfg::LFG_SPELL_DUNGEON_DESERTER: - case lfg::LFG_SPELL_DUNGEON_COOLDOWN: - case 26013: // bg deserter - case 57724: // sated - case 57723: // exhaustion - case 25771: // forbearance - case 15007: // resurrection sickness - case 24755: // Tricked or Treated (z eventu) - continue; - } + const Unit::VisibleAuraMap* va = player->GetVisibleAuras(); + for (Unit::VisibleAuraMap::const_iterator itr = va->begin(); itr != va->end(); ++itr) + if (Aura* aura = itr->second->GetBase()) + if (!itr->second->IsPositive() && !aura->IsPermanent() && aura->GetDuration() < HOUR*IN_MILLISECONDS) + { + switch (aura->GetSpellInfo()->Id) + { + case lfg::LFG_SPELL_DUNGEON_DESERTER: + case lfg::LFG_SPELL_DUNGEON_COOLDOWN: + case 26013: // bg deserter + case 57724: // sated + case 57723: // exhaustion + case 25771: // forbearance + case 15007: // resurrection sickness + case 24755: // Tricked or Treated (z eventu) + continue; + } - errors.push_back("Can't have negative auras."); - break; - } + errors.push_back("Can't have negative auras."); + break; + } - if (uint32 inviteInstanceId = player->GetPendingSpectatorInviteInstanceId()) - { - if (Battleground* tbg = sBattlegroundMgr->GetBattleground(inviteInstanceId)) - tbg->RemoveToBeTeleported(player->GetGUID()); - player->SetPendingSpectatorInviteInstanceId(0); - } + if (uint32 inviteInstanceId = player->GetPendingSpectatorInviteInstanceId()) + { + if (Battleground* tbg = sBattlegroundMgr->GetBattleground(inviteInstanceId)) + tbg->RemoveToBeTeleported(player->GetGUID()); + player->SetPendingSpectatorInviteInstanceId(0); + } - bool bgPreparation = false; - if (!handler->GetSession()->GetSecurity() && bgmap->GetBG()->GetStatus() != STATUS_IN_PROGRESS || - handler->GetSession()->GetSecurity() && bgmap->GetBG()->GetStatus() != STATUS_WAIT_JOIN && bgmap->GetBG()->GetStatus() != STATUS_IN_PROGRESS) - { - bgPreparation = true; - handler->SendSysMessage("Arena is not in progress yet. You will be invited as soon as it starts."); - bgmap->GetBG()->AddToBeTeleported(player->GetGUID(), spectate->GetGUID()); - player->SetPendingSpectatorInviteInstanceId(spectate->GetBattlegroundId()); - } + bool bgPreparation = false; + if (!handler->GetSession()->GetSecurity() && bgmap->GetBG()->GetStatus() != STATUS_IN_PROGRESS || + handler->GetSession()->GetSecurity() && bgmap->GetBG()->GetStatus() != STATUS_WAIT_JOIN && bgmap->GetBG()->GetStatus() != STATUS_IN_PROGRESS) + { + bgPreparation = true; + handler->SendSysMessage("Arena is not in progress yet. You will be invited as soon as it starts."); + bgmap->GetBG()->AddToBeTeleported(player->GetGUID(), spectate->GetGUID()); + player->SetPendingSpectatorInviteInstanceId(spectate->GetBattlegroundId()); + } - if (!errors.empty()) - { - handler->PSendSysMessage("To spectate, please fix the following:"); - for (std::list::const_iterator itr = errors.begin(); itr != errors.end(); ++itr) - handler->PSendSysMessage(("- "+(*itr)).c_str()); + if (!errors.empty()) + { + handler->PSendSysMessage("To spectate, please fix the following:"); + for (std::list::const_iterator itr = errors.begin(); itr != errors.end(); ++itr) + handler->PSendSysMessage(("- "+(*itr)).c_str()); - return true; - } + return true; + } - if (bgPreparation) - return true; + if (bgPreparation) + return true; - player->SetPendingSpectatorForBG(spectate->GetBattlegroundId()); - player->SetBattlegroundId(spectate->GetBattlegroundId(), spectate->GetBattlegroundTypeId(), PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL); - player->SetEntryPoint(); - float z = spectate->GetMapId() == 618 ? std::max(28.27f, spectate->GetPositionZ()+0.25f) : spectate->GetPositionZ()+0.25f; - player->TeleportTo(spectate->GetMapId(), spectate->GetPositionX(), spectate->GetPositionY(), z, spectate->GetOrientation(), TELE_TO_GM_MODE); - return true; + player->SetPendingSpectatorForBG(spectate->GetBattlegroundId()); + player->SetBattlegroundId(spectate->GetBattlegroundId(), spectate->GetBattlegroundTypeId(), PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL); + player->SetEntryPoint(); + float z = spectate->GetMapId() == 618 ? std::max(28.27f, spectate->GetPositionZ()+0.25f) : spectate->GetPositionZ()+0.25f; + player->TeleportTo(spectate->GetMapId(), spectate->GetPositionX(), spectate->GetPositionY(), z, spectate->GetOrientation(), TELE_TO_GM_MODE); + return true; } bool ArenaSpectator::HandleSpectatorWatchCommand(ChatHandler* handler, char const* args) { - if (!*args) + if (!*args) return true; - Player* player = handler->GetSession()->GetPlayer(); - if (!player->IsSpectator()) - return true; + Player* player = handler->GetSession()->GetPlayer(); + if (!player->IsSpectator()) + return true; - if (!player->FindMap() || !player->FindMap()->IsBattleArena()) - return true; + if (!player->FindMap() || !player->FindMap()->IsBattleArena()) + return true; - Battleground* bg = ((BattlegroundMap*)player->FindMap())->GetBG(); - if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS) - return true; + Battleground* bg = ((BattlegroundMap*)player->FindMap())->GetBG(); + if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS) + return true; - std::string name = std::string(args); - Player* spectate = ObjectAccessor::FindPlayerByName(name); - if (!spectate || !spectate->IsAlive() || spectate->IsSpectator() || spectate->GetGUID() == player->GetGUID() || !spectate->IsInWorld() || !spectate->FindMap() || spectate->IsBeingTeleported() || spectate->FindMap() != player->FindMap() || !bg->IsPlayerInBattleground(spectate->GetGUID())) - return true; + std::string name = std::string(args); + Player* spectate = ObjectAccessor::FindPlayerByName(name); + if (!spectate || !spectate->IsAlive() || spectate->IsSpectator() || spectate->GetGUID() == player->GetGUID() || !spectate->IsInWorld() || !spectate->FindMap() || spectate->IsBeingTeleported() || spectate->FindMap() != player->FindMap() || !bg->IsPlayerInBattleground(spectate->GetGUID())) + return true; - if (WorldObject* o = player->GetViewpoint()) - if (Unit* u = o->ToUnit()) - { - u->RemoveAurasByType(SPELL_AURA_BIND_SIGHT, player->GetGUID()); - player->RemoveAurasDueToSpell(SPECTATOR_SPELL_BINDSIGHT, player->GetGUID(), (1 << EFFECT_1)); + if (WorldObject* o = player->GetViewpoint()) + if (Unit* u = o->ToUnit()) + { + u->RemoveAurasByType(SPELL_AURA_BIND_SIGHT, player->GetGUID()); + player->RemoveAurasDueToSpell(SPECTATOR_SPELL_BINDSIGHT, player->GetGUID(), (1 << EFFECT_1)); - if (u->GetGUID() == spectate->GetGUID()) - return true; - } + if (u->GetGUID() == spectate->GetGUID()) + return true; + } - if (player->GetUInt64Value(PLAYER_FARSIGHT) || player->m_seer != player) // pussywizard: below this point we must not have a viewpoint! - return true; + if (player->GetUInt64Value(PLAYER_FARSIGHT) || player->m_seer != player) // pussywizard: below this point we must not have a viewpoint! + return true; - if (player->HaveAtClient(spectate)) - player->CastSpell(spectate, SPECTATOR_SPELL_BINDSIGHT, true); + if (player->HaveAtClient(spectate)) + player->CastSpell(spectate, SPECTATOR_SPELL_BINDSIGHT, true); - return true; + return true; } void AddSC_spectator_commandscript() diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index db2e7b973..558994d0f 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -133,7 +133,7 @@ public: if (target) target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation()); /* xinef: optimization, not needed function - else + else { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND); stmt->setUInt32(0, target_guid); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp index 8910dadf3..fb96a7367 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp @@ -49,17 +49,17 @@ public: enum eChallenge { - QUEST_THE_CHALLENGE = 9015, - GO_BANNER_OF_PROVOCATION = 181058, - GO_ARENA_SPOILS = 181074, + QUEST_THE_CHALLENGE = 9015, + GO_BANNER_OF_PROVOCATION = 181058, + GO_ARENA_SPOILS = 181074, - NPC_GRIMSTONE = 10096, - NPC_THELDREN = 16059, + NPC_GRIMSTONE = 10096, + NPC_THELDREN = 16059, }; uint32 theldrenTeam[] = { - 16053, 16055, 16050, 16051, 16049, 16052, 16054, 16058 + 16053, 16055, 16050, 16051, 16049, 16052, 16054, 16058 }; uint32 RingMob[]= @@ -130,39 +130,39 @@ public: { instance = creature->GetInstanceScript(); MobSpawnId = rand()%6; - eventPhase = 0; - eventTimer = 1000; - theldrenEvent = false; - summons.DespawnAll(); + eventPhase = 0; + eventTimer = 1000; + theldrenEvent = false; + summons.DespawnAll(); } InstanceScript* instance; - SummonList summons; + SummonList summons; uint8 eventPhase; uint32 eventTimer; uint8 MobSpawnId; - bool theldrenEvent; + bool theldrenEvent; void Reset() { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (Unit* target = SelectTargetFromPlayerList(100.0f)) - summon->AI()->AttackStart(target); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (Unit* target = SelectTargetFromPlayerList(100.0f)) + summon->AI()->AttackStart(target); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - // All Summons killed, next phase - if (summons.empty()) - eventTimer = 5000; - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + // All Summons killed, next phase + if (summons.empty()) + eventTimer = 5000; + } void WaypointReached(uint32 waypointId) { @@ -204,19 +204,19 @@ public: instance->HandleGameObject(instance->GetData64(id), open); } - void SummonBoss() - { - if (me->FindNearestGameObject(GO_BANNER_OF_PROVOCATION, 100.0f)) - { - theldrenEvent = true; - me->SummonCreature(NPC_THELDREN, 644.300f, -175.989f, -53.739f, 3.418f, TEMPSUMMON_DEAD_DESPAWN, 0); - uint8 rand = urand(0, 4); - for (uint8 i = rand; i < rand+4; ++i) - me->SummonCreature(theldrenTeam[i], 644.300f, -175.989f, -53.739f, 3.418f, TEMPSUMMON_DEAD_DESPAWN, 0); - } - else - me->SummonCreature(RingBoss[rand()%6], 644.300f, -175.989f, -53.739f, 3.418f, TEMPSUMMON_DEAD_DESPAWN, 0); - } + void SummonBoss() + { + if (me->FindNearestGameObject(GO_BANNER_OF_PROVOCATION, 100.0f)) + { + theldrenEvent = true; + me->SummonCreature(NPC_THELDREN, 644.300f, -175.989f, -53.739f, 3.418f, TEMPSUMMON_DEAD_DESPAWN, 0); + uint8 rand = urand(0, 4); + for (uint8 i = rand; i < rand+4; ++i) + me->SummonCreature(theldrenTeam[i], 644.300f, -175.989f, -53.739f, 3.418f, TEMPSUMMON_DEAD_DESPAWN, 0); + } + else + me->SummonCreature(RingBoss[rand()%6], 644.300f, -175.989f, -53.739f, 3.418f, TEMPSUMMON_DEAD_DESPAWN, 0); + } void UpdateEscortAI(uint32 diff) { @@ -229,77 +229,77 @@ public: { switch (eventPhase) { - case 0: - Talk(SAY_TEXT5); - HandleGameObject(DATA_ARENA4, false); - Start(false, false); - eventTimer = 0; - break; - case 1: - SetEscortPaused(false); - eventTimer = 0; - break; - case 2: - eventTimer = 2000; - break; - case 3: - HandleGameObject(DATA_ARENA1, true); - eventTimer = 3000; - break; - case 4: - SetEscortPaused(false); - me->SetVisible(false); - me->SummonCreature(RingMob[MobSpawnId], 608.960f, -235.322f, -53.907f, 1.857f, TEMPSUMMON_DEAD_DESPAWN, 0); - eventTimer = 8000; - break; - case 5: - me->SummonCreature(RingMob[MobSpawnId], 608.960f, -235.322f, -53.907f, 1.857f, TEMPSUMMON_DEAD_DESPAWN, 0); - me->SummonCreature(RingMob[MobSpawnId], 608.960f, -235.322f, -53.907f, 1.857f, TEMPSUMMON_DEAD_DESPAWN, 0); - eventTimer = 8000; - break; - case 6: - me->SummonCreature(RingMob[MobSpawnId], 608.960f, -235.322f, -53.907f, 1.857f, TEMPSUMMON_DEAD_DESPAWN, 0); - eventTimer = 0; - break; - case 7: - me->SetVisible(true); - HandleGameObject(DATA_ARENA1, false); - Talk(SAY_TEXT6); - SetEscortPaused(false); - eventTimer = 0; - break; - case 8: - HandleGameObject(DATA_ARENA2, true); - eventTimer = 5000; - break; - case 9: - me->SetVisible(false); - SummonBoss(); - eventTimer = 0; - break; - case 10: - if (theldrenEvent) - { - if (GameObject* go = me->SummonGameObject(GO_ARENA_SPOILS, 596.48f, -187.91f, -54.14f, 4.9f, 0.0f, 0.0f, 0.0f, 0.0f, 300)) - go->SetOwnerGUID(0); + case 0: + Talk(SAY_TEXT5); + HandleGameObject(DATA_ARENA4, false); + Start(false, false); + eventTimer = 0; + break; + case 1: + SetEscortPaused(false); + eventTimer = 0; + break; + case 2: + eventTimer = 2000; + break; + case 3: + HandleGameObject(DATA_ARENA1, true); + eventTimer = 3000; + break; + case 4: + SetEscortPaused(false); + me->SetVisible(false); + me->SummonCreature(RingMob[MobSpawnId], 608.960f, -235.322f, -53.907f, 1.857f, TEMPSUMMON_DEAD_DESPAWN, 0); + eventTimer = 8000; + break; + case 5: + me->SummonCreature(RingMob[MobSpawnId], 608.960f, -235.322f, -53.907f, 1.857f, TEMPSUMMON_DEAD_DESPAWN, 0); + me->SummonCreature(RingMob[MobSpawnId], 608.960f, -235.322f, -53.907f, 1.857f, TEMPSUMMON_DEAD_DESPAWN, 0); + eventTimer = 8000; + break; + case 6: + me->SummonCreature(RingMob[MobSpawnId], 608.960f, -235.322f, -53.907f, 1.857f, TEMPSUMMON_DEAD_DESPAWN, 0); + eventTimer = 0; + break; + case 7: + me->SetVisible(true); + HandleGameObject(DATA_ARENA1, false); + Talk(SAY_TEXT6); + SetEscortPaused(false); + eventTimer = 0; + break; + case 8: + HandleGameObject(DATA_ARENA2, true); + eventTimer = 5000; + break; + case 9: + me->SetVisible(false); + SummonBoss(); + eventTimer = 0; + break; + case 10: + if (theldrenEvent) + { + if (GameObject* go = me->SummonGameObject(GO_ARENA_SPOILS, 596.48f, -187.91f, -54.14f, 4.9f, 0.0f, 0.0f, 0.0f, 0.0f, 300)) + go->SetOwnerGUID(0); - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - itr->GetSource()->KilledMonsterCredit(16166, 0); - } + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + itr->GetSource()->KilledMonsterCredit(16166, 0); + } - HandleGameObject(DATA_ARENA2, false); - HandleGameObject(DATA_ARENA3, true); - HandleGameObject(DATA_ARENA4, true); - SetEscortPaused(false); - break; + HandleGameObject(DATA_ARENA2, false); + HandleGameObject(DATA_ARENA3, true); + HandleGameObject(DATA_ARENA4, true); + SetEscortPaused(false); + break; } ++eventPhase; } - else - eventTimer -= diff; + else + eventTimer -= diff; } - } + } }; }; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h index ccf7b1adf..e3de1510e 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.h @@ -60,7 +60,7 @@ enum DataTypes DATA_SF_BRAZIER_S = 26, DATA_MOIRA = 27, - DATA_OPEN_COFFER_DOORS = 30, + DATA_OPEN_COFFER_DOORS = 30, }; #endif diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index 5dd3b2e3d..ffa802ee4 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -38,7 +38,7 @@ enum Creatures NPC_MAGMUS = 9938, NPC_MOIRA = 8929, - NPC_WATCHMAN_DOOMGRIP = 9476, + NPC_WATCHMAN_DOOMGRIP = 9476, }; enum GameObjects @@ -116,7 +116,7 @@ public: uint64 TombEventStarterGUID; uint32 TombTimer; uint32 TombEventCounter; - uint32 OpenedCoofers; + uint32 OpenedCoofers; void Initialize() { @@ -154,7 +154,7 @@ public: TombEventStarterGUID = 0; TombTimer = TIMER_TOMBOFTHESEVEN; TombEventCounter = 0; - OpenedCoofers = 0; + OpenedCoofers = 0; for (uint8 i = 0; i < 7; ++i) TombBossGUIDs[i] = 0; @@ -262,15 +262,15 @@ public: case DATA_GHOSTKILL: GhostKillCount += data; break; - case DATA_OPEN_COFFER_DOORS: - OpenedCoofers += 1; - if (OpenedCoofers == 12) - { - Position pos = {812.15f, -348.91f, -50.579f, 0.7f}; - if (TempSummon* summon = instance->SummonCreature(NPC_WATCHMAN_DOOMGRIP, pos)) - summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); - } - break; + case DATA_OPEN_COFFER_DOORS: + OpenedCoofers += 1; + if (OpenedCoofers == 12) + { + Position pos = {812.15f, -348.91f, -50.579f, 0.7f}; + if (TempSummon* summon = instance->SummonCreature(NPC_WATCHMAN_DOOMGRIP, pos)) + summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); + } + break; } if (data == DONE || GhostKillCount >= 7) diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h index f7d455793..992ccebc4 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/blackrock_spire.h @@ -115,8 +115,8 @@ enum GameObjectsIds GO_DR_PORTCULLIS = 175185, GO_PORTCULLIS_ACTIVE = 164726, GO_PORTCULLIS_TOBOSSROOMS = 175186, - // Urok Doomhowl - GO_UROK_PILE = 175621, + // Urok Doomhowl + GO_UROK_PILE = 175621, }; #endif diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_urok_doomhowl.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_urok_doomhowl.cpp index 4f99874d4..062ec7a3c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_urok_doomhowl.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_urok_doomhowl.cpp @@ -24,7 +24,7 @@ enum Spells SPELL_REND = 16509, SPELL_STRIKE = 15580, SPELL_INTIMIDATING_ROAR = 16508, - SPELL_UROK_SPAWN = 16473, + SPELL_UROK_SPAWN = 16473, }; enum Says @@ -54,11 +54,11 @@ public: _Reset(); } - void InitializeAI() - { - me->CastSpell(me, SPELL_UROK_SPAWN, true); - BossAI::InitializeAI(); - } + void InitializeAI() + { + me->CastSpell(me, SPELL_UROK_SPAWN, true); + BossAI::InitializeAI(); + } void EnterCombat(Unit* /*who*/) { diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp index 4268715d4..65a0de14f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp @@ -73,7 +73,7 @@ public: go_blackrockaltar = 0; go_portcullis_active = 0; go_portcullis_tobossrooms = 0; - go_urok_pile = 0; + go_urok_pile = 0; memset(go_roomrunes, 0, sizeof(go_roomrunes)); memset(go_emberseerrunes, 0, sizeof(go_emberseerrunes)); } @@ -238,9 +238,9 @@ public: if (GetBossState(DATA_GYTH) == DONE) HandleGameObject(0, true, go); break; - case GO_UROK_PILE: - go_urok_pile = go->GetGUID(); - break; + case GO_UROK_PILE: + go_urok_pile = go->GetGUID(); + break; default: break; } @@ -290,8 +290,8 @@ public: case EVENT_UROK_DOOMHOWL: if (GetBossState(DATA_UROK_DOOMHOWL) == NOT_STARTED) { - if (GameObject* pile = instance->GetGameObject(go_urok_pile)) - pile->SetLootState(GO_JUST_DEACTIVATED); + if (GameObject* pile = instance->GetGameObject(go_urok_pile)) + pile->SetLootState(GO_JUST_DEACTIVATED); } break; default: @@ -577,7 +577,7 @@ public: uint64 runecreaturelist[7][5]; uint64 go_portcullis_active; uint64 go_portcullis_tobossrooms; - uint64 go_urok_pile; + uint64 go_urok_pile; }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index 0ca337979..e6555a090 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -174,19 +174,19 @@ public: if (me->GetMapId() == 469) { - // pussywizard: - bool reset = true; - if (instance) - if (Creature* nefarian = instance->instance->GetCreature(instance->GetData64(DATA_NEFARIAN))) - reset = false; - if (reset) + // pussywizard: + bool reset = true; + if (instance) + if (Creature* nefarian = instance->instance->GetCreature(instance->GetData64(DATA_NEFARIAN))) + reset = false; + if (reset) _Reset(); - // pussywizard: - if (!instance || instance->GetBossState(BOSS_NEFARIAN) == DONE || instance->GetBossState(BOSS_NEFARIAN) == IN_PROGRESS) - me->SetVisible(false); - else - me->SetVisible(true); + // pussywizard: + if (!instance || instance->GetBossState(BOSS_NEFARIAN) == DONE || instance->GetBossState(BOSS_NEFARIAN) == IN_PROGRESS) + me->SetVisible(false); + else + me->SetVisible(true); me->SetPhaseMask(1, true); me->SetUInt32Value(UNIT_NPC_FLAGS, 1); @@ -196,7 +196,7 @@ public: } } - bool CanAIAttack(const Unit* target) const { return me->IsVisible(); } + bool CanAIAttack(const Unit* target) const { return me->IsVisible(); } void JustReachedHome() { @@ -351,12 +351,12 @@ public: { if (Creature* nefarian = me->SummonCreature(NPC_NEFARIAN, NefarianLoc[0])) { - nefarian->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - nefarian->SetCanFly(true); - nefarian->SetHover(false); - nefarian->setActive(true); - nefarian->SetHomePosition(NefarianLoc[1]); - nefarian->GetMotionMaster()->MoveCharge(NefarianLoc[1].GetPositionX(), NefarianLoc[1].GetPositionY(), NefarianLoc[1].GetPositionZ(), 15.0f); + nefarian->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + nefarian->SetCanFly(true); + nefarian->SetHover(false); + nefarian->setActive(true); + nefarian->SetHomePosition(NefarianLoc[1]); + nefarian->GetMotionMaster()->MoveCharge(NefarianLoc[1].GetPositionX(), NefarianLoc[1].GetPositionY(), NefarianLoc[1].GetPositionZ(), 15.0f); nefarian->AI()->DoCastAOE(SPELL_SHADOWFLAME_INITIAL); } @@ -364,7 +364,7 @@ public: events.CancelEvent(EVENT_FEAR); events.CancelEvent(EVENT_SHADOW_BOLT); me->SetVisible(false); - EnterEvadeMode(); + EnterEvadeMode(); return; } } @@ -379,10 +379,10 @@ public: { if (sender == GOSSIP_ID && action == GOSSIP_OPTION_ID) { - // pussywizard: - InstanceScript* instance = player->GetInstanceScript(); - if (!instance || instance->GetBossState(BOSS_NEFARIAN) == DONE) - return; + // pussywizard: + InstanceScript* instance = player->GetInstanceScript(); + if (!instance || instance->GetBossState(BOSS_NEFARIAN) == DONE) + return; player->CLOSE_GOSSIP_MENU(); Talk(SAY_GAMESBEGIN_1); @@ -451,9 +451,9 @@ public: if (type != POINT_MOTION_TYPE) return; - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetWalk(false); + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetWalk(false); me->SetInCombatWithZone(); if (me->GetVictim()) AttackStart(me->GetVictim()); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp index fd5360b8f..073957d27 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp @@ -168,9 +168,9 @@ public: bool SetBossState(uint32 type, EncounterState state) { - // pussywizard: - if (GetBossState(type) == DONE && state != DONE) // prevent undoneing a boss xd - return false; + // pussywizard: + if (GetBossState(type) == DONE && state != DONE) // prevent undoneing a boss xd + return false; if (!InstanceScript::SetBossState(type, state)) return false; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp index 3e3e31d9c..1257d37a5 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp @@ -105,7 +105,7 @@ class boss_majordomo : public CreatureScript if (!me->FindNearestCreature(NPC_FLAMEWAKER_HEALER, 100.0f) && !me->FindNearestCreature(NPC_FLAMEWAKER_ELITE, 100.0f)) { - me->GetMap()->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, me->GetEntry(), me); + me->GetMap()->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, me->GetEntry(), me); me->setFaction(35); EnterEvadeMode(); Talk(SAY_DEFEAT); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp index d89f2cbbe..ccbbe4873 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp @@ -115,11 +115,11 @@ class boss_ragnaros : public CreatureScript Talk(SAY_KILL); } - void AttackStart(Unit* target) - { - if (target && me->Attack(target, true)) - DoStartNoMovement(target); - } + void AttackStart(Unit* target) + { + if (target && me->Attack(target, true)) + DoStartNoMovement(target); + } void UpdateAI(uint32 diff) { @@ -154,7 +154,7 @@ class boss_ragnaros : public CreatureScript case EVENT_INTRO_4: Talk(SAY_ARRIVAL5_RAG); if (Creature* executus = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MAJORDOMO_EXECUTUS))) - Unit::Kill(me, executus); + Unit::Kill(me, executus); break; case EVENT_INTRO_5: me->SetReactState(REACT_AGGRESSIVE); diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp index 527219eb3..aac98fa1e 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp @@ -11,135 +11,135 @@ enum Spels SPELL_SMITE_SLAM = 6435, EQUIP_SWORD = 1, - EQUIP_TWO_SWORDS = 2, + EQUIP_TWO_SWORDS = 2, EQUIP_MACE = 3, - EVENT_CHECK_HEALTH1 = 1, - EVENT_CHECK_HEALTH2 = 2, - EVENT_SMITE_SLAM = 3, - EVENT_SWAP_WEAPON1 = 4, - EVENT_SWAP_WEAPON2 = 5, - EVENT_RESTORE_COMBAT = 6, - EVENT_KNEEL = 7, + EVENT_CHECK_HEALTH1 = 1, + EVENT_CHECK_HEALTH2 = 2, + EVENT_SMITE_SLAM = 3, + EVENT_SWAP_WEAPON1 = 4, + EVENT_SWAP_WEAPON2 = 5, + EVENT_RESTORE_COMBAT = 6, + EVENT_KNEEL = 7, - SAY_SWAP1 = 2, - SAY_SWAP2 = 3 + SAY_SWAP1 = 2, + SAY_SWAP2 = 3 }; class boss_mr_smite : public CreatureScript { - public: - boss_mr_smite() : CreatureScript("boss_mr_smite") { } + public: + boss_mr_smite() : CreatureScript("boss_mr_smite") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_mr_smiteAI : public ScriptedAI - { - boss_mr_smiteAI(Creature* creature) : ScriptedAI(creature) - { - } + struct boss_mr_smiteAI : public ScriptedAI + { + boss_mr_smiteAI(Creature* creature) : ScriptedAI(creature) + { + } - EventMap events; + EventMap events; - void Reset() - { - me->LoadEquipment(EQUIP_SWORD); - me->SetCanDualWield(false); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - me->SetReactState(REACT_AGGRESSIVE); - } + void Reset() + { + me->LoadEquipment(EQUIP_SWORD); + me->SetCanDualWield(false); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + me->SetReactState(REACT_AGGRESSIVE); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_CHECK_HEALTH1, 500); - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 500); - events.ScheduleEvent(EVENT_SMITE_SLAM, 3000); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_CHECK_HEALTH1, 500); + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 500); + events.ScheduleEvent(EVENT_SMITE_SLAM, 3000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_SMITE_SLAM: - me->CastSpell(me->GetVictim(), SPELL_SMITE_SLAM, false); - events.ScheduleEvent(EVENT_SMITE_SLAM, 15000); - break; - case EVENT_CHECK_HEALTH1: - if (me->HealthBelowPct(67)) - { - me->CastSpell(me, SPELL_SMITE_STOMP, false); - events.DelayEvents(10000); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(EQUIP_TWO_SWORDS, 1.859f, -780.72f, 9.831f); - Talk(SAY_SWAP1); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - me->SetReactState(REACT_PASSIVE); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH1, 500); - break; - case EVENT_CHECK_HEALTH2: - if (me->HealthBelowPct(34)) - { - me->CastSpell(me, SPELL_SMITE_STOMP, false); - events.DelayEvents(10000); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(EQUIP_MACE, 1.859f, -780.72f, 9.831f); - Talk(SAY_SWAP2); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - me->SetReactState(REACT_PASSIVE); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 500); - break; - case EVENT_SWAP_WEAPON1: - me->LoadEquipment(EQUIP_TWO_SWORDS); - me->SetCanDualWield(true); - break; - case EVENT_SWAP_WEAPON2: - me->LoadEquipment(EQUIP_MACE); - me->SetCanDualWield(false); - break; - case EVENT_RESTORE_COMBAT: - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - me->SetStandState(UNIT_STAND_STATE_STAND); - if (me->GetVictim()) - { - me->GetMotionMaster()->MoveChase(me->GetVictim()); - me->SetTarget(me->GetVictim()->GetGUID()); - } - break; - case EVENT_KNEEL: - me->SendMeleeAttackStop(me->GetVictim()); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - break; - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_SMITE_SLAM: + me->CastSpell(me->GetVictim(), SPELL_SMITE_SLAM, false); + events.ScheduleEvent(EVENT_SMITE_SLAM, 15000); + break; + case EVENT_CHECK_HEALTH1: + if (me->HealthBelowPct(67)) + { + me->CastSpell(me, SPELL_SMITE_STOMP, false); + events.DelayEvents(10000); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(EQUIP_TWO_SWORDS, 1.859f, -780.72f, 9.831f); + Talk(SAY_SWAP1); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + me->SetReactState(REACT_PASSIVE); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH1, 500); + break; + case EVENT_CHECK_HEALTH2: + if (me->HealthBelowPct(34)) + { + me->CastSpell(me, SPELL_SMITE_STOMP, false); + events.DelayEvents(10000); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(EQUIP_MACE, 1.859f, -780.72f, 9.831f); + Talk(SAY_SWAP2); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + me->SetReactState(REACT_PASSIVE); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 500); + break; + case EVENT_SWAP_WEAPON1: + me->LoadEquipment(EQUIP_TWO_SWORDS); + me->SetCanDualWield(true); + break; + case EVENT_SWAP_WEAPON2: + me->LoadEquipment(EQUIP_MACE); + me->SetCanDualWield(false); + break; + case EVENT_RESTORE_COMBAT: + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + me->SetStandState(UNIT_STAND_STATE_STAND); + if (me->GetVictim()) + { + me->GetMotionMaster()->MoveChase(me->GetVictim()); + me->SetTarget(me->GetVictim()->GetGUID()); + } + break; + case EVENT_KNEEL: + me->SendMeleeAttackStop(me->GetVictim()); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void MovementInform(uint32 type, uint32 point) - { - if (type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 point) + { + if (type != POINT_MOTION_TYPE) + return; - me->SetTarget(0); - me->SetFacingTo(5.558f); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - events.ScheduleEvent(point == EQUIP_TWO_SWORDS ? EVENT_SWAP_WEAPON1 : EVENT_SWAP_WEAPON2, 1500); - events.ScheduleEvent(EVENT_RESTORE_COMBAT, 3000); - events.ScheduleEvent(EVENT_KNEEL, 0); - } - }; + me->SetTarget(0); + me->SetFacingTo(5.558f); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + events.ScheduleEvent(point == EQUIP_TWO_SWORDS ? EVENT_SWAP_WEAPON1 : EVENT_SWAP_WEAPON2, 1500); + events.ScheduleEvent(EVENT_RESTORE_COMBAT, 3000); + events.ScheduleEvent(EVENT_KNEEL, 0); + } + }; }; void AddSC_boss_mr_smite() diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h index 164afa38d..00d89eb9e 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h +++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h @@ -7,15 +7,15 @@ REWRITTEN BY XINEF enum DataTypes { - TYPE_RHAHK_ZOR = 0, - TYPE_CANNON = 1, - MAX_ENCOUNTERS = 2 + TYPE_RHAHK_ZOR = 0, + TYPE_CANNON = 1, + MAX_ENCOUNTERS = 2 }; enum GameObjects { - GO_FACTORY_DOOR = 13965, - GO_IRON_CLAD_DOOR = 16397 + GO_FACTORY_DOOR = 13965, + GO_IRON_CLAD_DOOR = 16397 }; #endif diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp index f671cb4f1..00f8d54f5 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp @@ -13,72 +13,72 @@ class instance_deadmines : public InstanceMapScript struct instance_deadmines_InstanceMapScript : public InstanceScript { - instance_deadmines_InstanceMapScript(Map* map) : InstanceScript(map) - { - } + instance_deadmines_InstanceMapScript(Map* map) : InstanceScript(map) + { + } - void Initialize() - { - memset(&_encounters, 0, sizeof(_encounters)); - } + void Initialize() + { + memset(&_encounters, 0, sizeof(_encounters)); + } - void OnGameObjectCreate(GameObject* gameobject) - { - switch (gameobject->GetEntry()) - { - case GO_FACTORY_DOOR: - if (_encounters[TYPE_RHAHK_ZOR] == DONE) - HandleGameObject(0, true, gameobject); - break; - case GO_IRON_CLAD_DOOR: - if (_encounters[TYPE_CANNON] == DONE) - HandleGameObject(0, true, gameobject); - break; - } - } + void OnGameObjectCreate(GameObject* gameobject) + { + switch (gameobject->GetEntry()) + { + case GO_FACTORY_DOOR: + if (_encounters[TYPE_RHAHK_ZOR] == DONE) + HandleGameObject(0, true, gameobject); + break; + case GO_IRON_CLAD_DOOR: + if (_encounters[TYPE_CANNON] == DONE) + HandleGameObject(0, true, gameobject); + break; + } + } - void SetData(uint32 type, uint32 data) - { - switch (type) - { - case TYPE_RHAHK_ZOR: - case TYPE_CANNON: - _encounters[type] = data; - break; - } + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case TYPE_RHAHK_ZOR: + case TYPE_CANNON: + _encounters[type] = data; + break; + } - if (data == DONE) - SaveToDB(); - } + if (data == DONE) + SaveToDB(); + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "D E " << _encounters[0] << ' ' << _encounters[1]; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "D E " << _encounters[0] << ' ' << _encounters[1]; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - return; + void Load(const char* in) + { + if (!in) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'D' && dataHead2 == 'E') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - loadStream >> _encounters[i]; - if (_encounters[i] == IN_PROGRESS) - _encounters[i] = NOT_STARTED; - } - } - } + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'D' && dataHead2 == 'E') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + loadStream >> _encounters[i]; + if (_encounters[i] == IN_PROGRESS) + _encounters[i] = NOT_STARTED; + } + } + } - private: - uint32 _encounters[MAX_ENCOUNTERS]; + private: + uint32 _encounters[MAX_ENCOUNTERS]; }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp index d341ff2d1..68eadf5a3 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp @@ -7,79 +7,79 @@ REWRITTEN BY XINEF class instance_gnomeregan : public InstanceMapScript { - public: - instance_gnomeregan() : InstanceMapScript("instance_gnomeregan", 90) { } + public: + instance_gnomeregan() : InstanceMapScript("instance_gnomeregan", 90) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_gnomeregan_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_gnomeregan_InstanceMapScript(map); + } - struct instance_gnomeregan_InstanceMapScript : public InstanceScript - { - instance_gnomeregan_InstanceMapScript(Map* map) : InstanceScript(map) - { - } - }; + struct instance_gnomeregan_InstanceMapScript : public InstanceScript + { + instance_gnomeregan_InstanceMapScript(Map* map) : InstanceScript(map) + { + } + }; }; enum eKernobee { - QUEST_A_FINE_MESS = 2904, + QUEST_A_FINE_MESS = 2904, }; class npc_kernobee : public CreatureScript { - public: - npc_kernobee() : CreatureScript("npc_kernobee") { } + public: + npc_kernobee() : CreatureScript("npc_kernobee") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_kernobeeAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_kernobeeAI(creature); + } - bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) - { - if (quest->GetQuestId() == QUEST_A_FINE_MESS) - { - creature->SetStandState(UNIT_STAND_STATE_STAND); - creature->AI()->SetGUID(player->GetGUID(), 0); - creature->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, M_PI, MOTION_SLOT_CONTROLLED); - } - return true; - } + bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) + { + if (quest->GetQuestId() == QUEST_A_FINE_MESS) + { + creature->SetStandState(UNIT_STAND_STATE_STAND); + creature->AI()->SetGUID(player->GetGUID(), 0); + creature->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, M_PI, MOTION_SLOT_CONTROLLED); + } + return true; + } - struct npc_kernobeeAI : public PassiveAI - { - npc_kernobeeAI(Creature* creature) : PassiveAI(creature) - { - playerGUID = 0; - checkTimer = 0; - } + struct npc_kernobeeAI : public PassiveAI + { + npc_kernobeeAI(Creature* creature) : PassiveAI(creature) + { + playerGUID = 0; + checkTimer = 0; + } - uint32 checkTimer; - uint64 playerGUID; + uint32 checkTimer; + uint64 playerGUID; - void SetGUID(uint64 guid, int32) - { - playerGUID = guid; - } + void SetGUID(uint64 guid, int32) + { + playerGUID = guid; + } - void UpdateAI(uint32 diff) - { - checkTimer += diff; - if (checkTimer >= 2000) - { - checkTimer = 0; - if (me->GetDistance(-332.2f, -2.8f, -152.8f) < 5.0f) - { - if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) - player->GroupEventHappens(QUEST_A_FINE_MESS, me); - me->DespawnOrUnsummon(1000); - } - } - } - }; + void UpdateAI(uint32 diff) + { + checkTimer += diff; + if (checkTimer >= 2000) + { + checkTimer = 0; + if (me->GetDistance(-332.2f, -2.8f, -152.8f) < 5.0f) + { + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) + player->GroupEventHappens(QUEST_A_FINE_MESS, me); + me->DespawnOrUnsummon(1000); + } + } + } + }; }; class spell_gnomeregan_radiation_bolt : public SpellScriptLoader @@ -93,8 +93,8 @@ class spell_gnomeregan_radiation_bolt : public SpellScriptLoader void HandleTriggerSpell(SpellEffIndex effIndex) { - if (roll_chance_i(80)) - PreventHitDefaultEffect(effIndex); + if (roll_chance_i(80)) + PreventHitDefaultEffect(effIndex); } void Register() @@ -112,6 +112,6 @@ class spell_gnomeregan_radiation_bolt : public SpellScriptLoader void AddSC_instance_gnomeregan() { new instance_gnomeregan(); - new npc_kernobee(); - new spell_gnomeregan_radiation_bolt(); + new npc_kernobee(); + new spell_gnomeregan_radiation_bolt(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index 019704a65..95f97749f 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -20,139 +20,139 @@ enum Curator SPELL_ARCANE_INFUSION = 30403, SPELL_ASTRAL_DECONSTRUCTION = 30407, - SPELL_SUMMON_ASTRAL_FLARE1 = 30236, - SPELL_SUMMON_ASTRAL_FLARE2 = 30239, - SPELL_SUMMON_ASTRAL_FLARE3 = 30240, - SPELL_SUMMON_ASTRAL_FLARE4 = 30241, + SPELL_SUMMON_ASTRAL_FLARE1 = 30236, + SPELL_SUMMON_ASTRAL_FLARE2 = 30239, + SPELL_SUMMON_ASTRAL_FLARE3 = 30240, + SPELL_SUMMON_ASTRAL_FLARE4 = 30241, - EVENT_KILL_TALK = 1, - EVENT_SPELL_HATEFUL_BOLT = 2, - EVENT_SPELL_EVOCATION = 3, - EVENT_SPELL_ASTRAL_FLARE = 4, - EVENT_SPELL_BERSERK = 5, - EVENT_CHECK_HEALTH = 6 + EVENT_KILL_TALK = 1, + EVENT_SPELL_HATEFUL_BOLT = 2, + EVENT_SPELL_EVOCATION = 3, + EVENT_SPELL_ASTRAL_FLARE = 4, + EVENT_SPELL_BERSERK = 5, + EVENT_CHECK_HEALTH = 6 }; class boss_curator : public CreatureScript { - public: - boss_curator() : CreatureScript("boss_curator") { } + public: + boss_curator() : CreatureScript("boss_curator") { } - struct boss_curatorAI : public BossAI - { - boss_curatorAI(Creature* creature) : BossAI(creature, TYPE_CURATOR) { } + struct boss_curatorAI : public BossAI + { + boss_curatorAI(Creature* creature) : BossAI(creature, TYPE_CURATOR) { } - void Reset() - { - BossAI::Reset(); - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_PERIODIC_MANA_LEECH, true); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_POWER_BURN, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_POWER_BURN, true); - } + void Reset() + { + BossAI::Reset(); + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_PERIODIC_MANA_LEECH, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_POWER_BURN, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_POWER_BURN, true); + } - void KilledUnit(Unit* victim) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 5000); - } - } + void KilledUnit(Unit* victim) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 5000); + } + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - Talk(SAY_DEATH); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + Talk(SAY_DEATH); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_HATEFUL_BOLT, 10000); - events.ScheduleEvent(EVENT_SPELL_ASTRAL_FLARE, 6000); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - } + events.ScheduleEvent(EVENT_SPELL_HATEFUL_BOLT, 10000); + events.ScheduleEvent(EVENT_SPELL_ASTRAL_FLARE, 6000); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (Unit* target = summon->SelectNearbyTarget(NULL, 40.0f)) - { - summon->AI()->AttackStart(target); - summon->AddThreat(target, 1000.0f); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (Unit* target = summon->SelectNearbyTarget(NULL, 40.0f)) + { + summon->AI()->AttackStart(target); + summon->AddThreat(target, 1000.0f); + } - summon->SetInCombatWithZone(); - } + summon->SetInCombatWithZone(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(16)) - { - events.CancelEvent(EVENT_SPELL_ASTRAL_FLARE); - me->CastSpell(me, SPELL_ARCANE_INFUSION, true); - Talk(SAY_ENRAGE); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_SPELL_BERSERK: - Talk(SAY_ENRAGE); - me->InterruptNonMeleeSpells(true); - me->CastSpell(me, SPELL_ASTRAL_DECONSTRUCTION, true); - break; - case EVENT_SPELL_HATEFUL_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, urand(1, 2), 40.0f)) - me->CastSpell(target, SPELL_HATEFUL_BOLT, false); - events.ScheduleEvent(EVENT_SPELL_HATEFUL_BOLT, urand(5000, 7500) * (events.GetNextEventTime(EVENT_SPELL_BERSERK) == 0 ? 1 : 2)); - break; - case EVENT_SPELL_ASTRAL_FLARE: - { - me->CastSpell(me, RAND(SPELL_SUMMON_ASTRAL_FLARE1, SPELL_SUMMON_ASTRAL_FLARE2, SPELL_SUMMON_ASTRAL_FLARE3, SPELL_SUMMON_ASTRAL_FLARE4), false); - int32 mana = CalculatePct(me->GetMaxPower(POWER_MANA), 10); - me->ModifyPower(POWER_MANA, -mana); - if (me->GetPowerPct(POWER_MANA) < 10.0f) - { - Talk(SAY_EVOCATE); - me->CastSpell(me, SPELL_EVOCATION, false); + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(16)) + { + events.CancelEvent(EVENT_SPELL_ASTRAL_FLARE); + me->CastSpell(me, SPELL_ARCANE_INFUSION, true); + Talk(SAY_ENRAGE); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_SPELL_BERSERK: + Talk(SAY_ENRAGE); + me->InterruptNonMeleeSpells(true); + me->CastSpell(me, SPELL_ASTRAL_DECONSTRUCTION, true); + break; + case EVENT_SPELL_HATEFUL_BOLT: + if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, urand(1, 2), 40.0f)) + me->CastSpell(target, SPELL_HATEFUL_BOLT, false); + events.ScheduleEvent(EVENT_SPELL_HATEFUL_BOLT, urand(5000, 7500) * (events.GetNextEventTime(EVENT_SPELL_BERSERK) == 0 ? 1 : 2)); + break; + case EVENT_SPELL_ASTRAL_FLARE: + { + me->CastSpell(me, RAND(SPELL_SUMMON_ASTRAL_FLARE1, SPELL_SUMMON_ASTRAL_FLARE2, SPELL_SUMMON_ASTRAL_FLARE3, SPELL_SUMMON_ASTRAL_FLARE4), false); + int32 mana = CalculatePct(me->GetMaxPower(POWER_MANA), 10); + me->ModifyPower(POWER_MANA, -mana); + if (me->GetPowerPct(POWER_MANA) < 10.0f) + { + Talk(SAY_EVOCATE); + me->CastSpell(me, SPELL_EVOCATION, false); - events.DelayEvents(20000); - events.ScheduleEvent(EVENT_SPELL_ASTRAL_FLARE, 20000); - } - else - { - if (roll_chance_i(50)) - Talk(SAY_SUMMON); + events.DelayEvents(20000); + events.ScheduleEvent(EVENT_SPELL_ASTRAL_FLARE, 20000); + } + else + { + if (roll_chance_i(50)) + Talk(SAY_SUMMON); - events.ScheduleEvent(EVENT_SPELL_ASTRAL_FLARE, 10000); - } + events.ScheduleEvent(EVENT_SPELL_ASTRAL_FLARE, 10000); + } - break; - } - } + break; + } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; void AddSC_boss_curator() diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index df4897146..4af0e1be9 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -8,103 +8,103 @@ REWRITTEN BY XINEF enum MaidenOfVirtue { - SAY_AGGRO = 0, - SAY_SLAY = 1, - SAY_REPENTANCE = 2, - SAY_DEATH = 3, + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_REPENTANCE = 2, + SAY_DEATH = 3, - SPELL_REPENTANCE = 29511, - SPELL_HOLY_FIRE = 29522, - SPELL_HOLY_WRATH = 32445, - SPELL_HOLY_GROUND = 29523, - SPELL_BERSERK = 26662, + SPELL_REPENTANCE = 29511, + SPELL_HOLY_FIRE = 29522, + SPELL_HOLY_WRATH = 32445, + SPELL_HOLY_GROUND = 29523, + SPELL_BERSERK = 26662, - EVENT_SPELL_REPENTANCE = 1, - EVENT_SPELL_HOLY_FIRE = 2, - EVENT_SPELL_HOLY_WRATH = 3, - EVENT_SPELL_ENRAGE = 4, - EVENT_KILL_TALK = 5 + EVENT_SPELL_REPENTANCE = 1, + EVENT_SPELL_HOLY_FIRE = 2, + EVENT_SPELL_HOLY_WRATH = 3, + EVENT_SPELL_ENRAGE = 4, + EVENT_KILL_TALK = 5 }; class boss_maiden_of_virtue : public CreatureScript { - public: - boss_maiden_of_virtue() : CreatureScript("boss_maiden_of_virtue") { } + public: + boss_maiden_of_virtue() : CreatureScript("boss_maiden_of_virtue") { } - struct boss_maiden_of_virtueAI : public BossAI - { - boss_maiden_of_virtueAI(Creature* creature) : BossAI(creature, TYPE_MAIDEN) { } + struct boss_maiden_of_virtueAI : public BossAI + { + boss_maiden_of_virtueAI(Creature* creature) : BossAI(creature, TYPE_MAIDEN) { } - void Reset() - { - BossAI::Reset(); - } + void Reset() + { + BossAI::Reset(); + } - void KilledUnit(Unit* /*victim*/) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 5000); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 5000); + } + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - Talk(SAY_DEATH); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + Talk(SAY_DEATH); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); - me->CastSpell(me, SPELL_HOLY_GROUND, true); - events.ScheduleEvent(EVENT_SPELL_REPENTANCE, 25000); - events.ScheduleEvent(EVENT_SPELL_HOLY_FIRE, 8000); - events.ScheduleEvent(EVENT_SPELL_HOLY_WRATH, 15000); - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); - } + me->CastSpell(me, SPELL_HOLY_GROUND, true); + events.ScheduleEvent(EVENT_SPELL_REPENTANCE, 25000); + events.ScheduleEvent(EVENT_SPELL_HOLY_FIRE, 8000); + events.ScheduleEvent(EVENT_SPELL_HOLY_WRATH, 15000); + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_REPENTANCE: - me->CastSpell(me, SPELL_REPENTANCE, true); - events.ScheduleEvent(EVENT_SPELL_REPENTANCE, urand(25000, 35000)); - break; - case EVENT_SPELL_HOLY_FIRE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) - me->CastSpell(target, SPELL_HOLY_FIRE, true); - events.ScheduleEvent(EVENT_SPELL_HOLY_FIRE, urand(8000, 18000)); - break; - case EVENT_SPELL_HOLY_WRATH: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) - me->CastSpell(target, SPELL_HOLY_WRATH, true); - events.ScheduleEvent(EVENT_SPELL_HOLY_WRATH, urand(20000, 25000)); - break; - case EVENT_SPELL_ENRAGE: - me->CastSpell(me, SPELL_BERSERK, true); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_REPENTANCE: + me->CastSpell(me, SPELL_REPENTANCE, true); + events.ScheduleEvent(EVENT_SPELL_REPENTANCE, urand(25000, 35000)); + break; + case EVENT_SPELL_HOLY_FIRE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + me->CastSpell(target, SPELL_HOLY_FIRE, true); + events.ScheduleEvent(EVENT_SPELL_HOLY_FIRE, urand(8000, 18000)); + break; + case EVENT_SPELL_HOLY_WRATH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + me->CastSpell(target, SPELL_HOLY_WRATH, true); + events.ScheduleEvent(EVENT_SPELL_HOLY_WRATH, urand(20000, 25000)); + break; + case EVENT_SPELL_ENRAGE: + me->CastSpell(me, SPELL_BERSERK, true); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; void AddSC_boss_maiden_of_virtue() diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 10c0df86f..de7baa027 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -9,401 +9,401 @@ REWRITTEN BY XINEF enum eSay { - SAY_ATTUMEN1_APPEAR = 0, - SAY_ATTUMEN1_MOUNT = 2, + SAY_ATTUMEN1_APPEAR = 0, + SAY_ATTUMEN1_MOUNT = 2, - SAY_ATTUMEN2_DEATH = 0, + SAY_ATTUMEN2_DEATH = 0, - SAY_ATTUMEN_KILL = 1, - SAY_ATTUMEN_DISARM = 3, - SAY_ATTUMEN_RANDOM = 4, - SAY_ATTUMEN_MIDNIGHT_KILL = 5, + SAY_ATTUMEN_KILL = 1, + SAY_ATTUMEN_DISARM = 3, + SAY_ATTUMEN_RANDOM = 4, + SAY_ATTUMEN_MIDNIGHT_KILL = 5, - SAY_MIDNIGHT_EMOTE = 0 + SAY_MIDNIGHT_EMOTE = 0 }; enum eSpells { - // Midnight - SPELL_KNOCKDOWN = 29711, - SPELL_SUMMON_ATTUMEN = 29714, - SPELL_SUMMON_ATTUMEN_MOUNTED = 29799, + // Midnight + SPELL_KNOCKDOWN = 29711, + SPELL_SUMMON_ATTUMEN = 29714, + SPELL_SUMMON_ATTUMEN_MOUNTED = 29799, - // Attumen - SPELL_SHADOW_CLEAVE = 29832, - SPELL_INTANGIBLE_PRESENCE = 29833, - SPELL_SPAWN_SMOKE1 = 29802, + // Attumen + SPELL_SHADOW_CLEAVE = 29832, + SPELL_INTANGIBLE_PRESENCE = 29833, + SPELL_SPAWN_SMOKE1 = 29802, - // Attumen 2 - SPELL_CHARGE_MIDNIGHT = 29847, - SPELL_SPAWN_SMOKE2 = 10389, + // Attumen 2 + SPELL_CHARGE_MIDNIGHT = 29847, + SPELL_SPAWN_SMOKE2 = 10389, - // Generic - SPELL_MOUNT_TARGET_ATTUMEN = 29769, - SPELL_MOUNT_TARGET_MIDNIGHT = 29770 + // Generic + SPELL_MOUNT_TARGET_ATTUMEN = 29769, + SPELL_MOUNT_TARGET_MIDNIGHT = 29770 }; enum eEvents { - EVENT_CHECK_HEALTH_95 = 1, - EVENT_CHECK_HEALTH_25 = 2, - EVENT_SPELL_KNOCKDOWN = 3, - EVENT_SUMMON_ATTUMEN_MOUNTED = 4, + EVENT_CHECK_HEALTH_95 = 1, + EVENT_CHECK_HEALTH_25 = 2, + EVENT_SPELL_KNOCKDOWN = 3, + EVENT_SUMMON_ATTUMEN_MOUNTED = 4, - EVENT_SPELL_SHADOW_CLEAVE = 10, - EVENT_SPELL_INTANGIBLE_PRESENCE = 11, - EVENT_RANDOM_YELL = 12, + EVENT_SPELL_SHADOW_CLEAVE = 10, + EVENT_SPELL_INTANGIBLE_PRESENCE = 11, + EVENT_RANDOM_YELL = 12, - EVENT_SPELL_CHARGE = 20, + EVENT_SPELL_CHARGE = 20, - EVENT_KILL_TALK = 30 + EVENT_KILL_TALK = 30 }; enum eMisc { - POINT_MOVE_TO_MIDNIGHT = 1, - DATA_ATTUMEN_READY = 1 + POINT_MOVE_TO_MIDNIGHT = 1, + DATA_ATTUMEN_READY = 1 }; class boss_midnight : public CreatureScript { - public: - boss_midnight() : CreatureScript("boss_midnight") { } + public: + boss_midnight() : CreatureScript("boss_midnight") { } - struct boss_midnightAI : public BossAI - { - boss_midnightAI(Creature* creature) : BossAI(creature, TYPE_ATTUMEN) { } + struct boss_midnightAI : public BossAI + { + boss_midnightAI(Creature* creature) : BossAI(creature, TYPE_ATTUMEN) { } - void Reset() - { - BossAI::Reset(); - me->SetVisible(true); - _healthPct = 100.0f; - } + void Reset() + { + BossAI::Reset(); + me->SetVisible(true); + _healthPct = 100.0f; + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_CHECK_HEALTH_95, 0); - events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 6000); - } + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + events.ScheduleEvent(EVENT_CHECK_HEALTH_95, 0); + events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 6000); + } - void KilledUnit(Unit* /*victim*/) - { - if (Creature* attumen = summons.GetCreatureWithEntry(NPC_ATTUMEN_THE_HUNTSMAN)) - attumen->AI()->Talk(SAY_ATTUMEN_MIDNIGHT_KILL); - } + void KilledUnit(Unit* /*victim*/) + { + if (Creature* attumen = summons.GetCreatureWithEntry(NPC_ATTUMEN_THE_HUNTSMAN)) + attumen->AI()->Talk(SAY_ATTUMEN_MIDNIGHT_KILL); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->SetInCombatWithZone(); + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->SetInCombatWithZone(); - if (summon->GetEntry() == NPC_ATTUMEN_THE_HUNTSMAN_MOUNTED) - { - summon->SetHealth(summon->CountPctFromMaxHealth(_healthPct)); - summon->CastSpell(summon, SPELL_SPAWN_SMOKE2, true); - } - else - summon->CastSpell(summon, SPELL_SPAWN_SMOKE1, true); - } + if (summon->GetEntry() == NPC_ATTUMEN_THE_HUNTSMAN_MOUNTED) + { + summon->SetHealth(summon->CountPctFromMaxHealth(_healthPct)); + summon->CastSpell(summon, SPELL_SPAWN_SMOKE2, true); + } + else + summon->CastSpell(summon, SPELL_SPAWN_SMOKE1, true); + } - void SetData(uint32 type, uint32 /*data*/) - { - if (type == DATA_ATTUMEN_READY) - events.ScheduleEvent(EVENT_SUMMON_ATTUMEN_MOUNTED, 0); - } + void SetData(uint32 type, uint32 /*data*/) + { + if (type == DATA_ATTUMEN_READY) + events.ScheduleEvent(EVENT_SUMMON_ATTUMEN_MOUNTED, 0); + } - void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) - { - if (summon->GetEntry() == NPC_ATTUMEN_THE_HUNTSMAN_MOUNTED) - { - summons.clear(); - Unit::Kill(me, me); - } - } + void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) + { + if (summon->GetEntry() == NPC_ATTUMEN_THE_HUNTSMAN_MOUNTED) + { + summons.clear(); + Unit::Kill(me, me); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_HEALTH_95: - if (me->HealthBelowPct(96)) - { - me->CastSpell(me, SPELL_SUMMON_ATTUMEN, true); - events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 0); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH_95, 500); - break; - case EVENT_CHECK_HEALTH_25: - if (me->HealthBelowPct(25)) - { - Talk(SAY_MIDNIGHT_EMOTE); - me->CastSpell(me, SPELL_MOUNT_TARGET_ATTUMEN, true); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 500); - break; - case EVENT_SPELL_KNOCKDOWN: - me->CastSpell(me->GetVictim(), SPELL_KNOCKDOWN, false); - events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 20000); - break; - case EVENT_SUMMON_ATTUMEN_MOUNTED: - if (Creature* attumen = summons.GetCreatureWithEntry(NPC_ATTUMEN_THE_HUNTSMAN)) - { - _healthPct = std::max(me->GetHealthPct(), attumen->GetHealthPct()); - attumen->DespawnOrUnsummon(); - } + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_HEALTH_95: + if (me->HealthBelowPct(96)) + { + me->CastSpell(me, SPELL_SUMMON_ATTUMEN, true); + events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 0); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH_95, 500); + break; + case EVENT_CHECK_HEALTH_25: + if (me->HealthBelowPct(25)) + { + Talk(SAY_MIDNIGHT_EMOTE); + me->CastSpell(me, SPELL_MOUNT_TARGET_ATTUMEN, true); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 500); + break; + case EVENT_SPELL_KNOCKDOWN: + me->CastSpell(me->GetVictim(), SPELL_KNOCKDOWN, false); + events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 20000); + break; + case EVENT_SUMMON_ATTUMEN_MOUNTED: + if (Creature* attumen = summons.GetCreatureWithEntry(NPC_ATTUMEN_THE_HUNTSMAN)) + { + _healthPct = std::max(me->GetHealthPct(), attumen->GetHealthPct()); + attumen->DespawnOrUnsummon(); + } - me->CastSpell(me, SPELL_SUMMON_ATTUMEN_MOUNTED, true); - me->SetVisible(false); - break; - } + me->CastSpell(me, SPELL_SUMMON_ATTUMEN_MOUNTED, true); + me->SetVisible(false); + break; + } - if (me->IsVisible()) - DoMeleeAttackIfReady(); + if (me->IsVisible()) + DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(); } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetHomePosition().GetExactDist2d(me) > 50.0f || me->GetPositionZ() > 60.0f; - } + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetHomePosition().GetExactDist2d(me) > 50.0f || me->GetPositionZ() > 60.0f; + } - private: - float _healthPct; - }; + private: + float _healthPct; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; class boss_attumen : public CreatureScript { - public: - boss_attumen() : CreatureScript("boss_attumen") { } + public: + boss_attumen() : CreatureScript("boss_attumen") { } - struct boss_attumenAI : public ScriptedAI - { - boss_attumenAI(Creature* creature) : ScriptedAI(creature) - { - } + struct boss_attumenAI : public ScriptedAI + { + boss_attumenAI(Creature* creature) : ScriptedAI(creature) + { + } - void Reset() - { - _events.Reset(); - } + void Reset() + { + _events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - Talk(SAY_ATTUMEN1_APPEAR); - _events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 0); - _events.ScheduleEvent(EVENT_SPELL_SHADOW_CLEAVE, 6000); - _events.ScheduleEvent(EVENT_SPELL_INTANGIBLE_PRESENCE, 15000); - _events.ScheduleEvent(EVENT_RANDOM_YELL, urand(25000, 45000)); - } + void EnterCombat(Unit* /*who*/) + { + Talk(SAY_ATTUMEN1_APPEAR); + _events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 0); + _events.ScheduleEvent(EVENT_SPELL_SHADOW_CLEAVE, 6000); + _events.ScheduleEvent(EVENT_SPELL_INTANGIBLE_PRESENCE, 15000); + _events.ScheduleEvent(EVENT_RANDOM_YELL, urand(25000, 45000)); + } - void KilledUnit(Unit* /*victim*/) - { - if (_events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - _events.ScheduleEvent(EVENT_KILL_TALK, 5000); - Talk(SAY_ATTUMEN_KILL); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (_events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + _events.ScheduleEvent(EVENT_KILL_TALK, 5000); + Talk(SAY_ATTUMEN_KILL); + } + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Mechanic == MECHANIC_DISARM && _events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - _events.ScheduleEvent(EVENT_KILL_TALK, 5000); - Talk(SAY_ATTUMEN_DISARM); - } - else if (spellInfo->Id == SPELL_MOUNT_TARGET_ATTUMEN) - { - me->CastSpell(me, SPELL_MOUNT_TARGET_MIDNIGHT, true); - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Mechanic == MECHANIC_DISARM && _events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + _events.ScheduleEvent(EVENT_KILL_TALK, 5000); + Talk(SAY_ATTUMEN_DISARM); + } + else if (spellInfo->Id == SPELL_MOUNT_TARGET_ATTUMEN) + { + me->CastSpell(me, SPELL_MOUNT_TARGET_MIDNIGHT, true); + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_MOUNT_TARGET_MIDNIGHT) - { - Talk(SAY_ATTUMEN1_MOUNT); - _events.Reset(); - me->GetMotionMaster()->MovePoint(POINT_MOVE_TO_MIDNIGHT, target->GetPositionX() + 2.0f*cos(target->GetAngle(me)), target->GetPositionY() + 2.0f*sin(target->GetAngle(me)), target->GetPositionZ()+0.2f, true, true, MOTION_SLOT_CONTROLLED); - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_MOUNT_TARGET_MIDNIGHT) + { + Talk(SAY_ATTUMEN1_MOUNT); + _events.Reset(); + me->GetMotionMaster()->MovePoint(POINT_MOVE_TO_MIDNIGHT, target->GetPositionX() + 2.0f*cos(target->GetAngle(me)), target->GetPositionY() + 2.0f*sin(target->GetAngle(me)), target->GetPositionZ()+0.2f, true, true, MOTION_SLOT_CONTROLLED); + } + } - void MovementInform(uint32 type, uint32 point) - { - if (type == POINT_MOTION_TYPE && point == POINT_MOVE_TO_MIDNIGHT) - { - if (TempSummon* summon = me->ToTempSummon()) - if (Unit* midnight = summon->GetSummoner()) - midnight->GetAI()->SetData(DATA_ATTUMEN_READY, 0); - } - } + void MovementInform(uint32 type, uint32 point) + { + if (type == POINT_MOTION_TYPE && point == POINT_MOVE_TO_MIDNIGHT) + { + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* midnight = summon->GetSummoner()) + midnight->GetAI()->SetData(DATA_ATTUMEN_READY, 0); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + _events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (_events.ExecuteEvent()) - { - case EVENT_SPELL_SHADOW_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_SHADOW_CLEAVE, false); - _events.ScheduleEvent(EVENT_SPELL_SHADOW_CLEAVE, urand(9000, 14000)); - break; - case EVENT_SPELL_INTANGIBLE_PRESENCE: - me->CastSpell(me->GetVictim(), SPELL_INTANGIBLE_PRESENCE, false); - _events.ScheduleEvent(EVENT_SPELL_INTANGIBLE_PRESENCE, 30000); - break; - case EVENT_RANDOM_YELL: - Talk(SAY_ATTUMEN_RANDOM); - _events.ScheduleEvent(EVENT_RANDOM_YELL, urand(30000, 70000)); - break; - case EVENT_CHECK_HEALTH_25: - if (me->HealthBelowPct(25)) - { - me->CastSpell(me, SPELL_MOUNT_TARGET_MIDNIGHT, true); - break; - } - _events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 500); - break; - } + switch (_events.ExecuteEvent()) + { + case EVENT_SPELL_SHADOW_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_SHADOW_CLEAVE, false); + _events.ScheduleEvent(EVENT_SPELL_SHADOW_CLEAVE, urand(9000, 14000)); + break; + case EVENT_SPELL_INTANGIBLE_PRESENCE: + me->CastSpell(me->GetVictim(), SPELL_INTANGIBLE_PRESENCE, false); + _events.ScheduleEvent(EVENT_SPELL_INTANGIBLE_PRESENCE, 30000); + break; + case EVENT_RANDOM_YELL: + Talk(SAY_ATTUMEN_RANDOM); + _events.ScheduleEvent(EVENT_RANDOM_YELL, urand(30000, 70000)); + break; + case EVENT_CHECK_HEALTH_25: + if (me->HealthBelowPct(25)) + { + me->CastSpell(me, SPELL_MOUNT_TARGET_MIDNIGHT, true); + break; + } + _events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 500); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap _events; - }; + private: + EventMap _events; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; class boss_attumen_midnight : public CreatureScript { - public: - boss_attumen_midnight() : CreatureScript("boss_attumen_midnight") { } + public: + boss_attumen_midnight() : CreatureScript("boss_attumen_midnight") { } - struct boss_attumen_midnightAI : public ScriptedAI - { - boss_attumen_midnightAI(Creature* creature) : ScriptedAI(creature) - { - } + struct boss_attumen_midnightAI : public ScriptedAI + { + boss_attumen_midnightAI(Creature* creature) : ScriptedAI(creature) + { + } - void Reset() - { - _events.Reset(); - } + void Reset() + { + _events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - _events.ScheduleEvent(EVENT_SPELL_SHADOW_CLEAVE, 6000); - _events.ScheduleEvent(EVENT_SPELL_INTANGIBLE_PRESENCE, 15000); - _events.ScheduleEvent(EVENT_RANDOM_YELL, urand(25000, 45000)); - _events.ScheduleEvent(EVENT_SPELL_CHARGE, 20000); - _events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 11000); - } + void EnterCombat(Unit* /*who*/) + { + _events.ScheduleEvent(EVENT_SPELL_SHADOW_CLEAVE, 6000); + _events.ScheduleEvent(EVENT_SPELL_INTANGIBLE_PRESENCE, 15000); + _events.ScheduleEvent(EVENT_RANDOM_YELL, urand(25000, 45000)); + _events.ScheduleEvent(EVENT_SPELL_CHARGE, 20000); + _events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 11000); + } - void KilledUnit(Unit* /*victim*/) - { - if (_events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - _events.ScheduleEvent(EVENT_KILL_TALK, 5000); - Talk(SAY_ATTUMEN_KILL); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (_events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + _events.ScheduleEvent(EVENT_KILL_TALK, 5000); + Talk(SAY_ATTUMEN_KILL); + } + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_ATTUMEN2_DEATH); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_ATTUMEN2_DEATH); + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Mechanic == MECHANIC_DISARM && _events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - _events.ScheduleEvent(EVENT_KILL_TALK, 5000); - Talk(SAY_ATTUMEN_DISARM); - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Mechanic == MECHANIC_DISARM && _events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + _events.ScheduleEvent(EVENT_KILL_TALK, 5000); + Talk(SAY_ATTUMEN_DISARM); + } + } - void MovementInform(uint32 type, uint32 point) - { - if (type == POINT_MOTION_TYPE && point == POINT_MOVE_TO_MIDNIGHT) - { - if (TempSummon* summon = me->ToTempSummon()) - if (Unit* midnight = summon->GetSummoner()) - midnight->GetAI()->SetData(DATA_ATTUMEN_READY, 0); - } - } + void MovementInform(uint32 type, uint32 point) + { + if (type == POINT_MOTION_TYPE && point == POINT_MOVE_TO_MIDNIGHT) + { + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* midnight = summon->GetSummoner()) + midnight->GetAI()->SetData(DATA_ATTUMEN_READY, 0); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + _events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (_events.ExecuteEvent()) - { - case EVENT_SPELL_SHADOW_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_SHADOW_CLEAVE, false); - _events.ScheduleEvent(EVENT_SPELL_SHADOW_CLEAVE, urand(9000, 14000)); - break; - case EVENT_SPELL_INTANGIBLE_PRESENCE: - me->CastSpell(me->GetVictim(), SPELL_INTANGIBLE_PRESENCE, false); - _events.ScheduleEvent(EVENT_SPELL_INTANGIBLE_PRESENCE, 30000); - break; - case EVENT_RANDOM_YELL: - Talk(SAY_ATTUMEN_RANDOM); - _events.ScheduleEvent(EVENT_RANDOM_YELL, urand(30000, 70000)); - break; - case EVENT_SPELL_CHARGE: - if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 24.0f, true)) - me->CastSpell(target, SPELL_CHARGE_MIDNIGHT, false); - _events.ScheduleEvent(EVENT_SPELL_CHARGE, 20000); - break; - case EVENT_SPELL_KNOCKDOWN: - me->CastSpell(me->GetVictim(), SPELL_KNOCKDOWN, false); - _events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 20000); - break; - } + switch (_events.ExecuteEvent()) + { + case EVENT_SPELL_SHADOW_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_SHADOW_CLEAVE, false); + _events.ScheduleEvent(EVENT_SPELL_SHADOW_CLEAVE, urand(9000, 14000)); + break; + case EVENT_SPELL_INTANGIBLE_PRESENCE: + me->CastSpell(me->GetVictim(), SPELL_INTANGIBLE_PRESENCE, false); + _events.ScheduleEvent(EVENT_SPELL_INTANGIBLE_PRESENCE, 30000); + break; + case EVENT_RANDOM_YELL: + Talk(SAY_ATTUMEN_RANDOM); + _events.ScheduleEvent(EVENT_RANDOM_YELL, urand(30000, 70000)); + break; + case EVENT_SPELL_CHARGE: + if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 24.0f, true)) + me->CastSpell(target, SPELL_CHARGE_MIDNIGHT, false); + _events.ScheduleEvent(EVENT_SPELL_CHARGE, 20000); + break; + case EVENT_SPELL_KNOCKDOWN: + me->CastSpell(me->GetVictim(), SPELL_KNOCKDOWN, false); + _events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 20000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap _events; - }; + private: + EventMap _events; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; class spell_midnight_fixate : public SpellScriptLoader @@ -418,15 +418,15 @@ class spell_midnight_fixate : public SpellScriptLoader void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - if (Unit* caster = GetCaster()) - caster->TauntApply(target); + if (Unit* caster = GetCaster()) + caster->TauntApply(target); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - if (Unit* caster = GetCaster()) - caster->TauntFadeOut(target); + if (Unit* caster = GetCaster()) + caster->TauntFadeOut(target); } void Register() @@ -447,5 +447,5 @@ void AddSC_boss_attumen() { new boss_midnight(); new boss_attumen(); - new boss_attumen_midnight(); + new boss_attumen_midnight(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 57213a4bd..a01a2fa26 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -8,42 +8,42 @@ REWRITTEN BY XINEF enum Yells { - SAY_AGGRO = 0, - SAY_SPECIAL = 1, - SAY_KILL = 2, - SAY_DEATH = 3, - SAY_OUT_OF_COMBAT = 4, + SAY_AGGRO = 0, + SAY_SPECIAL = 1, + SAY_KILL = 2, + SAY_DEATH = 3, + SAY_OUT_OF_COMBAT = 4, - SAY_GUEST = 0 + SAY_GUEST = 0 }; enum Spells { SPELL_VANISH = 29448, SPELL_GARROTE_DUMMY = 29433, - SPELL_GARROTE = 37066, + SPELL_GARROTE = 37066, SPELL_BLIND = 34694, SPELL_GOUGE = 29425, SPELL_FRENZY = 37023, - SPELL_DUAL_WIELD = 29651, - SPELL_BERSERK = 26662, - SPELL_VANISH_TELEPORT = 29431, + SPELL_DUAL_WIELD = 29651, + SPELL_BERSERK = 26662, + SPELL_VANISH_TELEPORT = 29431, }; enum Misc { - EVENT_GUEST_TALK = 1, - EVENT_GUEST_TALK2 = 2, - EVENT_SPELL_VANISH = 3, - EVENT_SPELL_GARROTE = 4, - EVENT_SPELL_BLIND = 5, - EVENT_SPELL_GOUGE = 6, - EVENT_CHECK_HEALTH = 7, - EVENT_SPELL_ENRAGE = 8, - EVENT_KILL_TALK = 9, + EVENT_GUEST_TALK = 1, + EVENT_GUEST_TALK2 = 2, + EVENT_SPELL_VANISH = 3, + EVENT_SPELL_GARROTE = 4, + EVENT_SPELL_BLIND = 5, + EVENT_SPELL_GOUGE = 6, + EVENT_CHECK_HEALTH = 7, + EVENT_SPELL_ENRAGE = 8, + EVENT_KILL_TALK = 9, - ACTIVE_GUEST_COUNT = 4, - MAX_GUEST_COUNT = 6 + ACTIVE_GUEST_COUNT = 4, + MAX_GUEST_COUNT = 6 }; const Position GuestsPosition[4] = @@ -66,174 +66,174 @@ const uint32 GuestEntries[6]= class boss_moroes : public CreatureScript { - public: - boss_moroes() : CreatureScript("boss_moroes") { } + public: + boss_moroes() : CreatureScript("boss_moroes") { } - struct boss_moroesAI : public BossAI - { - boss_moroesAI(Creature* creature) : BossAI(creature, TYPE_MOROES) - { - _activeGuests = 0; - } + struct boss_moroesAI : public BossAI + { + boss_moroesAI(Creature* creature) : BossAI(creature, TYPE_MOROES) + { + _activeGuests = 0; + } - void InitializeAI() - { - BossAI::InitializeAI(); - InitializeGuests(); - } + void InitializeAI() + { + BossAI::InitializeAI(); + InitializeGuests(); + } - void JustReachedHome() - { - BossAI::JustReachedHome(); - InitializeGuests(); - } + void JustReachedHome() + { + BossAI::JustReachedHome(); + InitializeGuests(); + } - void InitializeGuests() - { - if (!me->IsAlive()) - return; + void InitializeGuests() + { + if (!me->IsAlive()) + return; - if (_activeGuests == 0) - { - _activeGuests |= 0x3F; - uint8 rand1 = RAND(0x01, 0x02, 0x04); - uint8 rand2 = RAND(0x08, 0x10, 0x20); - _activeGuests &= ~(rand1|rand2); - } + if (_activeGuests == 0) + { + _activeGuests |= 0x3F; + uint8 rand1 = RAND(0x01, 0x02, 0x04); + uint8 rand2 = RAND(0x08, 0x10, 0x20); + _activeGuests &= ~(rand1|rand2); + } - for (uint8 i = 0; i < MAX_GUEST_COUNT; ++i) - if ((1 << i) & _activeGuests) - me->SummonCreature(GuestEntries[i], GuestsPosition[summons.size()], TEMPSUMMON_MANUAL_DESPAWN); + for (uint8 i = 0; i < MAX_GUEST_COUNT; ++i) + if ((1 << i) & _activeGuests) + me->SummonCreature(GuestEntries[i], GuestsPosition[summons.size()], TEMPSUMMON_MANUAL_DESPAWN); - _events2.Reset(); - _events2.ScheduleEvent(EVENT_GUEST_TALK, 10000); - } + _events2.Reset(); + _events2.ScheduleEvent(EVENT_GUEST_TALK, 10000); + } - void Reset() - { - BossAI::Reset(); - me->CastSpell(me, SPELL_DUAL_WIELD, true); - } + void Reset() + { + BossAI::Reset(); + me->CastSpell(me, SPELL_DUAL_WIELD, true); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_VANISH, 30000); - events.ScheduleEvent(EVENT_SPELL_BLIND, 20000); - events.ScheduleEvent(EVENT_SPELL_GOUGE, 13000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 5000); - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); + events.ScheduleEvent(EVENT_SPELL_VANISH, 30000); + events.ScheduleEvent(EVENT_SPELL_BLIND, 20000); + events.ScheduleEvent(EVENT_SPELL_GOUGE, 13000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 5000); + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); - _events2.Reset(); - me->CallForHelp(20.0f); - } + _events2.Reset(); + me->CallForHelp(20.0f); + } - void KilledUnit(Unit* /*victim*/) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 5000); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 5000); + } + } - void JustDied(Unit* killer) - { - summons.clear(); - BossAI::JustDied(killer); - Talk(SAY_DEATH); + void JustDied(Unit* killer) + { + summons.clear(); + BossAI::JustDied(killer); + Talk(SAY_DEATH); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GARROTE); - } + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GARROTE); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - Creature* GetRandomGuest() - { - std::list guestList; - for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) - guestList.push_back(summon); + Creature* GetRandomGuest() + { + std::list guestList; + for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) + guestList.push_back(summon); - return Trinity::Containers::SelectRandomContainerElement(guestList); - } + return Trinity::Containers::SelectRandomContainerElement(guestList); + } - void UpdateAI(uint32 diff) - { - _events2.Update(diff); - switch (_events2.ExecuteEvent()) - { - case EVENT_GUEST_TALK: - if (Creature* guest = GetRandomGuest()) - guest->AI()->Talk(SAY_GUEST); - _events2.ScheduleEvent(EVENT_GUEST_TALK2, 5000); - break; - case EVENT_GUEST_TALK2: - Talk(SAY_OUT_OF_COMBAT); - _events2.ScheduleEvent(EVENT_GUEST_TALK, urand(60000, 120000)); - break; - } + void UpdateAI(uint32 diff) + { + _events2.Update(diff); + switch (_events2.ExecuteEvent()) + { + case EVENT_GUEST_TALK: + if (Creature* guest = GetRandomGuest()) + guest->AI()->Talk(SAY_GUEST); + _events2.ScheduleEvent(EVENT_GUEST_TALK2, 5000); + break; + case EVENT_GUEST_TALK2: + Talk(SAY_OUT_OF_COMBAT); + _events2.ScheduleEvent(EVENT_GUEST_TALK, urand(60000, 120000)); + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(31)) - { - me->CastSpell(me, SPELL_FRENZY, true); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_SPELL_ENRAGE: - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_SPELL_BLIND: - if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 10.0f, true)) - me->CastSpell(target, SPELL_BLIND, false); - events.ScheduleEvent(EVENT_SPELL_BLIND, urand(25000, 40000)); - break; - case EVENT_SPELL_GOUGE: - me->CastSpell(me->GetVictim(), SPELL_GOUGE, false); - events.ScheduleEvent(EVENT_SPELL_GOUGE, urand(25000, 40000)); - return; - case EVENT_SPELL_VANISH: - events.DelayEvents(9000); - events.SetPhase(1); - me->CastSpell(me, SPELL_VANISH, false); - events.ScheduleEvent(EVENT_SPELL_VANISH, 30000); - events.ScheduleEvent(EVENT_SPELL_GARROTE, urand(5000, 7000)); - return; - case EVENT_SPELL_GARROTE: - me->CastSpell(me, SPELL_VANISH_TELEPORT, false); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(31)) + { + me->CastSpell(me, SPELL_FRENZY, true); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_SPELL_ENRAGE: + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_SPELL_BLIND: + if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 10.0f, true)) + me->CastSpell(target, SPELL_BLIND, false); + events.ScheduleEvent(EVENT_SPELL_BLIND, urand(25000, 40000)); + break; + case EVENT_SPELL_GOUGE: + me->CastSpell(me->GetVictim(), SPELL_GOUGE, false); + events.ScheduleEvent(EVENT_SPELL_GOUGE, urand(25000, 40000)); + return; + case EVENT_SPELL_VANISH: + events.DelayEvents(9000); + events.SetPhase(1); + me->CastSpell(me, SPELL_VANISH, false); + events.ScheduleEvent(EVENT_SPELL_VANISH, 30000); + events.ScheduleEvent(EVENT_SPELL_GARROTE, urand(5000, 7000)); + return; + case EVENT_SPELL_GARROTE: + me->CastSpell(me, SPELL_VANISH_TELEPORT, false); + break; + } - // Xinef: not in vanish - if (events.GetPhaseMask() == 0) - DoMeleeAttackIfReady(); - } + // Xinef: not in vanish + if (events.GetPhaseMask() == 0) + DoMeleeAttackIfReady(); + } - private: - EventMap _events2; - uint8 _activeGuests; - }; + private: + EventMap _events2; + uint8 _activeGuests; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; class spell_moroes_vanish : public SpellScriptLoader @@ -247,15 +247,15 @@ class spell_moroes_vanish : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - { - Position pos; - target->GetFirstCollisionPosition(pos, 5.0f, M_PI); - GetCaster()->CastSpell(target, SPELL_GARROTE_DUMMY, true); - GetCaster()->RemoveAurasDueToSpell(SPELL_VANISH); - GetCaster()->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), target->GetOrientation()); - } + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + { + Position pos; + target->GetFirstCollisionPosition(pos, 5.0f, M_PI); + GetCaster()->CastSpell(target, SPELL_GARROTE_DUMMY, true); + GetCaster()->RemoveAurasDueToSpell(SPELL_VANISH); + GetCaster()->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), target->GetOrientation()); + } } @@ -274,5 +274,5 @@ class spell_moroes_vanish : public SpellScriptLoader void AddSC_boss_moroes() { new boss_moroes(); - new spell_moroes_vanish(); + new spell_moroes_vanish(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index 21c6df7bd..0d1621295 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -201,8 +201,8 @@ public: return; } - MovePhase = id+1; - return; + MovePhase = id+1; + return; } if (Flying) @@ -216,10 +216,10 @@ public: } if (id < 8) - MovePhase = id+1; - else + MovePhase = id+1; + else { - Phase = 1; + Phase = 1; Flying = false; Movement = true; return; @@ -255,25 +255,25 @@ public: void UpdateAI(uint32 diff) { if (Intro) - { - if (MovePhase) - { - if (MovePhase >= 7) - { - me->SetDisableGravity(false); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]); - } - else - { - me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]); - } - MovePhase = 0; - } - return; - } + { + if (MovePhase) + { + if (MovePhase >= 7) + { + me->SetDisableGravity(false); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]); + } + else + { + me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]); + } + MovePhase = 0; + } + return; + } - if (Flying && MovePhase) + if (Flying && MovePhase) { if (MovePhase >= 7) { @@ -284,7 +284,7 @@ public: else me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]); - MovePhase = 0; + MovePhase = 0; } if (!UpdateVictim()) @@ -417,18 +417,18 @@ public: bool OnGossipHello(Player* pPlayer, GameObject *pGo) { - if (InstanceScript* pInstance = pGo->GetInstanceScript()) - { - if (pInstance->GetData(TYPE_NIGHTBANE) != DONE && !pGo->FindNearestCreature(17225, 40.0f)) - if (Creature *cr = ObjectAccessor::GetCreature(*pPlayer, pInstance->GetData64(DATA_NIGHTBANE))) - cr->GetMotionMaster()->MovePoint(0, IntroWay[0][0], IntroWay[0][1], IntroWay[0][2]); - } - return false; + if (InstanceScript* pInstance = pGo->GetInstanceScript()) + { + if (pInstance->GetData(TYPE_NIGHTBANE) != DONE && !pGo->FindNearestCreature(17225, 40.0f)) + if (Creature *cr = ObjectAccessor::GetCreature(*pPlayer, pInstance->GetData64(DATA_NIGHTBANE))) + cr->GetMotionMaster()->MovePoint(0, IntroWay[0][0], IntroWay[0][1], IntroWay[0][2]); + } + return false; } }; void AddSC_boss_nightbane() { new boss_nightbane(); - new go_blackened_urn(); + new go_blackened_urn(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_servant_quarters.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_servant_quarters.cpp index 029ab0cb2..a7ba48e74 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_servant_quarters.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_servant_quarters.cpp @@ -8,155 +8,155 @@ REWRITTEN BY XINEF enum ServantQuartersSpells { - SPELL_SNEAK = 22766, - SPELL_ACIDIC_FANG = 29901, - SPELL_HYAKISS_WEB = 29896, + SPELL_SNEAK = 22766, + SPELL_ACIDIC_FANG = 29901, + SPELL_HYAKISS_WEB = 29896, - SPELL_DIVE = 29903, - SPELL_SONIC_BURST = 29904, - SPELL_WING_BUFFET = 29905, - SPELL_FEAR = 29321, + SPELL_DIVE = 29903, + SPELL_SONIC_BURST = 29904, + SPELL_WING_BUFFET = 29905, + SPELL_FEAR = 29321, - SPELL_RAVAGE = 29906 + SPELL_RAVAGE = 29906 }; enum ServantQuertersMisc { - EVENT_SPELL_ACIDIC_FANG = 1, - EVENT_SPELL_HYAKISS_WEB = 2, + EVENT_SPELL_ACIDIC_FANG = 1, + EVENT_SPELL_HYAKISS_WEB = 2, - EVENT_SPELL_DIVE = 10, - EVENT_SPELL_SONIC_BURST = 11, - EVENT_SPELL_WING_BUFFET = 12, - EVENT_SPELL_FEAR = 13, + EVENT_SPELL_DIVE = 10, + EVENT_SPELL_SONIC_BURST = 11, + EVENT_SPELL_WING_BUFFET = 12, + EVENT_SPELL_FEAR = 13, - EVENT_SPELL_RAVAGE = 20, + EVENT_SPELL_RAVAGE = 20, - EVENT_CHECK_VISIBILITY = 30 + EVENT_CHECK_VISIBILITY = 30 }; class boss_servant_quarters : public CreatureScript { - public: - boss_servant_quarters() : CreatureScript("boss_servant_quarters") { } + public: + boss_servant_quarters() : CreatureScript("boss_servant_quarters") { } - struct boss_servant_quartersAI : public BossAI - { - boss_servant_quartersAI(Creature* creature) : BossAI(creature, TYPE_SERVANT_QUARTERS) { } + struct boss_servant_quartersAI : public BossAI + { + boss_servant_quartersAI(Creature* creature) : BossAI(creature, TYPE_SERVANT_QUARTERS) { } - void Reset() - { - events.Reset(); - me->SetVisible(false); - me->SetReactState(REACT_PASSIVE); - me->setFaction(35); - _events2.Reset(); - _events2.ScheduleEvent(EVENT_CHECK_VISIBILITY, 5000); - if (me->GetEntry() == NPC_HYAKISS_THE_LURKER) - me->CastSpell(me, SPELL_SNEAK, true); + void Reset() + { + events.Reset(); + me->SetVisible(false); + me->SetReactState(REACT_PASSIVE); + me->setFaction(35); + _events2.Reset(); + _events2.ScheduleEvent(EVENT_CHECK_VISIBILITY, 5000); + if (me->GetEntry() == NPC_HYAKISS_THE_LURKER) + me->CastSpell(me, SPELL_SNEAK, true); - if (instance->GetData(DATA_SELECTED_RARE) != me->GetEntry()) - me->DespawnOrUnsummon(1); - } + if (instance->GetData(DATA_SELECTED_RARE) != me->GetEntry()) + me->DespawnOrUnsummon(1); + } - void EnterCombat(Unit* who) - { - me->setActive(true); - if (me->GetEntry() == NPC_HYAKISS_THE_LURKER) - { - events.ScheduleEvent(EVENT_SPELL_ACIDIC_FANG, 5000); - events.ScheduleEvent(EVENT_SPELL_HYAKISS_WEB, 9000); - } - else if (me->GetEntry() == NPC_SHADIKITH_THE_GLIDER) - { - events.ScheduleEvent(EVENT_SPELL_SONIC_BURST, 4000); - events.ScheduleEvent(EVENT_SPELL_WING_BUFFET, 7000); - events.ScheduleEvent(EVENT_SPELL_DIVE, 10000); - } - else // if (me->GetEntry() == NPC_ROKAD_THE_RAVAGER) - { - events.ScheduleEvent(EVENT_SPELL_RAVAGE, 3000); - } - } + void EnterCombat(Unit* who) + { + me->setActive(true); + if (me->GetEntry() == NPC_HYAKISS_THE_LURKER) + { + events.ScheduleEvent(EVENT_SPELL_ACIDIC_FANG, 5000); + events.ScheduleEvent(EVENT_SPELL_HYAKISS_WEB, 9000); + } + else if (me->GetEntry() == NPC_SHADIKITH_THE_GLIDER) + { + events.ScheduleEvent(EVENT_SPELL_SONIC_BURST, 4000); + events.ScheduleEvent(EVENT_SPELL_WING_BUFFET, 7000); + events.ScheduleEvent(EVENT_SPELL_DIVE, 10000); + } + else // if (me->GetEntry() == NPC_ROKAD_THE_RAVAGER) + { + events.ScheduleEvent(EVENT_SPELL_RAVAGE, 3000); + } + } - void JustDied(Unit* /*who*/) - { - } + void JustDied(Unit* /*who*/) + { + } - void MovementInform(uint32 type, uint32 point) - { - if (type == POINT_MOTION_TYPE && point == EVENT_CHARGE) - events.ScheduleEvent(EVENT_SPELL_FEAR, 0); - } + void MovementInform(uint32 type, uint32 point) + { + if (type == POINT_MOTION_TYPE && point == EVENT_CHARGE) + events.ScheduleEvent(EVENT_SPELL_FEAR, 0); + } - void UpdateAI(uint32 diff) - { - _events2.Update(diff); - switch (_events2.ExecuteEvent()) - { - case EVENT_CHECK_VISIBILITY: - if (instance->GetBossState(TYPE_SERVANT_QUARTERS) == DONE) - { - me->SetVisible(true); - me->SetReactState(REACT_AGGRESSIVE); - me->RestoreFaction(); - } - else - _events2.ScheduleEvent(EVENT_CHECK_VISIBILITY, 5000); - break; - } + void UpdateAI(uint32 diff) + { + _events2.Update(diff); + switch (_events2.ExecuteEvent()) + { + case EVENT_CHECK_VISIBILITY: + if (instance->GetBossState(TYPE_SERVANT_QUARTERS) == DONE) + { + me->SetVisible(true); + me->SetReactState(REACT_AGGRESSIVE); + me->RestoreFaction(); + } + else + _events2.ScheduleEvent(EVENT_CHECK_VISIBILITY, 5000); + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_ACIDIC_FANG: - me->CastSpell(me->GetVictim(), SPELL_ACIDIC_FANG, false); - events.ScheduleEvent(EVENT_SPELL_ACIDIC_FANG, urand(12000, 18000)); - break; - case EVENT_SPELL_HYAKISS_WEB: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) - me->CastSpell(target, SPELL_HYAKISS_WEB, false); - events.ScheduleEvent(EVENT_SPELL_HYAKISS_WEB, 15000); - break; - case EVENT_SPELL_SONIC_BURST: - me->CastSpell(me, SPELL_SONIC_BURST, false); - events.ScheduleEvent(EVENT_SPELL_SONIC_BURST, urand(12000, 18000)); - break; - case EVENT_SPELL_WING_BUFFET: - me->CastSpell(me, SPELL_WING_BUFFET, false); - events.ScheduleEvent(EVENT_SPELL_WING_BUFFET, urand(12000, 18000)); - break; - case EVENT_SPELL_DIVE: - if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, FarthestTargetSelector(me, 40.0f, false, true))) - me->CastSpell(target, SPELL_DIVE, false); - events.ScheduleEvent(EVENT_SPELL_DIVE, 20000); - break; - case EVENT_SPELL_FEAR: - me->CastSpell(me->GetVictim(), SPELL_FEAR, false); - break; - case EVENT_SPELL_RAVAGE: - me->CastSpell(me->GetVictim(), SPELL_RAVAGE, false); - events.ScheduleEvent(EVENT_SPELL_RAVAGE, 10500); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_ACIDIC_FANG: + me->CastSpell(me->GetVictim(), SPELL_ACIDIC_FANG, false); + events.ScheduleEvent(EVENT_SPELL_ACIDIC_FANG, urand(12000, 18000)); + break; + case EVENT_SPELL_HYAKISS_WEB: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) + me->CastSpell(target, SPELL_HYAKISS_WEB, false); + events.ScheduleEvent(EVENT_SPELL_HYAKISS_WEB, 15000); + break; + case EVENT_SPELL_SONIC_BURST: + me->CastSpell(me, SPELL_SONIC_BURST, false); + events.ScheduleEvent(EVENT_SPELL_SONIC_BURST, urand(12000, 18000)); + break; + case EVENT_SPELL_WING_BUFFET: + me->CastSpell(me, SPELL_WING_BUFFET, false); + events.ScheduleEvent(EVENT_SPELL_WING_BUFFET, urand(12000, 18000)); + break; + case EVENT_SPELL_DIVE: + if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, FarthestTargetSelector(me, 40.0f, false, true))) + me->CastSpell(target, SPELL_DIVE, false); + events.ScheduleEvent(EVENT_SPELL_DIVE, 20000); + break; + case EVENT_SPELL_FEAR: + me->CastSpell(me->GetVictim(), SPELL_FEAR, false); + break; + case EVENT_SPELL_RAVAGE: + me->CastSpell(me->GetVictim(), SPELL_RAVAGE, false); + events.ScheduleEvent(EVENT_SPELL_RAVAGE, 10500); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap _events2; - }; + private: + EventMap _events2; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; void AddSC_boss_servant_quarters() diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 54156e87f..cc5f17929 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -9,158 +9,158 @@ REWRITTEN BY XINEF class instance_karazhan : public InstanceMapScript { - public: - instance_karazhan() : InstanceMapScript("instance_karazhan", 532) { } + public: + instance_karazhan() : InstanceMapScript("instance_karazhan", 532) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_karazhan_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_karazhan_InstanceMapScript(map); + } - struct instance_karazhan_InstanceMapScript : public InstanceScript - { - instance_karazhan_InstanceMapScript(Map* map) : InstanceScript(map) { } + struct instance_karazhan_InstanceMapScript : public InstanceScript + { + instance_karazhan_InstanceMapScript(Map* map) : InstanceScript(map) { } - void Initialize() - { - SetBossNumber(MAX_ENCOUNTERS); - _servantQuartersKills = 0; - _selectedRare = RAND(NPC_HYAKISS_THE_LURKER, NPC_SHADIKITH_THE_GLIDER, NPC_ROKAD_THE_RAVAGER); - } + void Initialize() + { + SetBossNumber(MAX_ENCOUNTERS); + _servantQuartersKills = 0; + _selectedRare = RAND(NPC_HYAKISS_THE_LURKER, NPC_SHADIKITH_THE_GLIDER, NPC_ROKAD_THE_RAVAGER); + } - void OnCreatureCreate(Creature* creature) - { + void OnCreatureCreate(Creature* creature) + { - } + } - void SetData(uint32 type, uint32 uiData) - { - switch (type) - { - case DATA_COUNT_SERVANT_QUARTERS_KILLS: - if (++_servantQuartersKills > 52) // 56 in total, not all have to be killed, almost all - { - SetBossState(TYPE_SERVANT_QUARTERS, NOT_STARTED); - SetBossState(TYPE_SERVANT_QUARTERS, DONE); - } - SaveToDB(); - break; + void SetData(uint32 type, uint32 uiData) + { + switch (type) + { + case DATA_COUNT_SERVANT_QUARTERS_KILLS: + if (++_servantQuartersKills > 52) // 56 in total, not all have to be killed, almost all + { + SetBossState(TYPE_SERVANT_QUARTERS, NOT_STARTED); + SetBossState(TYPE_SERVANT_QUARTERS, DONE); + } + SaveToDB(); + break; - /* - case TYPE_ATTUMEN: m_auiEncounter[0] = uiData; break; - case TYPE_MOROES: - if (m_auiEncounter[1] == DONE) - break; - m_auiEncounter[1] = uiData; - break; - case TYPE_MAIDEN: m_auiEncounter[2] = uiData; break; - case TYPE_OPTIONAL_BOSS: m_auiEncounter[3] = uiData; break; - case TYPE_OPERA: - m_auiEncounter[4] = uiData; - if (uiData == DONE) - instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, 16812, NULL); - break; - case TYPE_CURATOR: m_auiEncounter[5] = uiData; break; - case TYPE_ARAN: m_auiEncounter[6] = uiData; break; - case TYPE_TERESTIAN: m_auiEncounter[7] = uiData; break; - case TYPE_NETHERSPITE: m_auiEncounter[8] = uiData; break; - case TYPE_CHESS: - if (uiData == DONE) - DoRespawnGameObject(DustCoveredChest, DAY); - m_auiEncounter[9] = uiData; - break; - case TYPE_MALCHEZZAR: m_auiEncounter[10] = uiData; break; - case TYPE_NIGHTBANE: - if (m_auiEncounter[11] != DONE) - m_auiEncounter[11] = uiData; - break; - case DATA_OPERA_OZ_DEATHCOUNT: - if (uiData == SPECIAL) - ++m_uiOzDeathCount; - else if (uiData == IN_PROGRESS) - m_uiOzDeathCount = 0; - break; + /* + case TYPE_ATTUMEN: m_auiEncounter[0] = uiData; break; + case TYPE_MOROES: + if (m_auiEncounter[1] == DONE) + break; + m_auiEncounter[1] = uiData; + break; + case TYPE_MAIDEN: m_auiEncounter[2] = uiData; break; + case TYPE_OPTIONAL_BOSS: m_auiEncounter[3] = uiData; break; + case TYPE_OPERA: + m_auiEncounter[4] = uiData; + if (uiData == DONE) + instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, 16812, NULL); + break; + case TYPE_CURATOR: m_auiEncounter[5] = uiData; break; + case TYPE_ARAN: m_auiEncounter[6] = uiData; break; + case TYPE_TERESTIAN: m_auiEncounter[7] = uiData; break; + case TYPE_NETHERSPITE: m_auiEncounter[8] = uiData; break; + case TYPE_CHESS: + if (uiData == DONE) + DoRespawnGameObject(DustCoveredChest, DAY); + m_auiEncounter[9] = uiData; + break; + case TYPE_MALCHEZZAR: m_auiEncounter[10] = uiData; break; + case TYPE_NIGHTBANE: + if (m_auiEncounter[11] != DONE) + m_auiEncounter[11] = uiData; + break; + case DATA_OPERA_OZ_DEATHCOUNT: + if (uiData == SPECIAL) + ++m_uiOzDeathCount; + else if (uiData == IN_PROGRESS) + m_uiOzDeathCount = 0; + break; */ - } - } + } + } - void SetData64(uint32 identifier, uint64 data) - { - // switch (identifier) - // { - //case DATA_IMAGE_OF_MEDIVH: ImageGUID = data; - // } - } + void SetData64(uint32 identifier, uint64 data) + { + // switch (identifier) + // { + //case DATA_IMAGE_OF_MEDIVH: ImageGUID = data; + // } + } - void OnGameObjectCreate(GameObject* go) - { - /*switch (go->GetEntry()) - { - case 183932: m_uiCurtainGUID = go->GetGUID(); break; - case 184278: - m_uiStageDoorLeftGUID = go->GetGUID(); - if (m_auiEncounter[4] == DONE) - go->SetGoState(GO_STATE_ACTIVE); - break; - case 184279: - m_uiStageDoorRightGUID = go->GetGUID(); - if (m_auiEncounter[4] == DONE) - go->SetGoState(GO_STATE_ACTIVE); - break; - case 184517: m_uiLibraryDoor = go->GetGUID(); break; - case 185521: m_uiMassiveDoor = go->GetGUID(); break; - case 184276: m_uiGamesmansDoor = go->GetGUID(); break; - case 184277: m_uiGamesmansExitDoor = go->GetGUID(); break; - case 185134: m_uiNetherspaceDoor = go->GetGUID(); break; - case 184274: MastersTerraceDoor[0] = go->GetGUID(); break; - case 184280: MastersTerraceDoor[1] = go->GetGUID(); break; - case 184275: - m_uiSideEntranceDoor = go->GetGUID(); - if (m_auiEncounter[4] == DONE) - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); - else - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); - break; - case 185119: DustCoveredChest = go->GetGUID(); break; - }*/ - } + void OnGameObjectCreate(GameObject* go) + { + /*switch (go->GetEntry()) + { + case 183932: m_uiCurtainGUID = go->GetGUID(); break; + case 184278: + m_uiStageDoorLeftGUID = go->GetGUID(); + if (m_auiEncounter[4] == DONE) + go->SetGoState(GO_STATE_ACTIVE); + break; + case 184279: + m_uiStageDoorRightGUID = go->GetGUID(); + if (m_auiEncounter[4] == DONE) + go->SetGoState(GO_STATE_ACTIVE); + break; + case 184517: m_uiLibraryDoor = go->GetGUID(); break; + case 185521: m_uiMassiveDoor = go->GetGUID(); break; + case 184276: m_uiGamesmansDoor = go->GetGUID(); break; + case 184277: m_uiGamesmansExitDoor = go->GetGUID(); break; + case 185134: m_uiNetherspaceDoor = go->GetGUID(); break; + case 184274: MastersTerraceDoor[0] = go->GetGUID(); break; + case 184280: MastersTerraceDoor[1] = go->GetGUID(); break; + case 184275: + m_uiSideEntranceDoor = go->GetGUID(); + if (m_auiEncounter[4] == DONE) + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + else + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + break; + case 185119: DustCoveredChest = go->GetGUID(); break; + }*/ + } - uint32 GetData(uint32 data) const - { - switch (data) - { - case DATA_SELECTED_RARE: - return _selectedRare; - } + uint32 GetData(uint32 data) const + { + switch (data) + { + case DATA_SELECTED_RARE: + return _selectedRare; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 data) const - { - /*switch (uiData) - { - case DATA_KILREK: return m_uiKilrekGUID; - case DATA_TERESTIAN: return m_uiTerestianGUID; - case DATA_MOROES: return m_uiMoroesGUID; - case DATA_GO_STAGEDOORLEFT: return m_uiStageDoorLeftGUID; - case DATA_GO_STAGEDOORRIGHT: return m_uiStageDoorRightGUID; - case DATA_GO_CURTAINS: return m_uiCurtainGUID; - case DATA_GO_LIBRARY_DOOR: return m_uiLibraryDoor; - case DATA_GO_MASSIVE_DOOR: return m_uiMassiveDoor; - case DATA_GO_SIDE_ENTRANCE_DOOR: return m_uiSideEntranceDoor; - case DATA_GO_GAME_DOOR: return m_uiGamesmansDoor; - case DATA_GO_GAME_EXIT_DOOR: return m_uiGamesmansExitDoor; - case DATA_GO_NETHER_DOOR: return m_uiNetherspaceDoor; - case DATA_MASTERS_TERRACE_DOOR_1: return MastersTerraceDoor[0]; - case DATA_MASTERS_TERRACE_DOOR_2: return MastersTerraceDoor[1]; - case DATA_IMAGE_OF_MEDIVH: return ImageGUID; - case DATA_NIGHTBANE: return m_uiNightbaneGUID; - } + uint64 GetData64(uint32 data) const + { + /*switch (uiData) + { + case DATA_KILREK: return m_uiKilrekGUID; + case DATA_TERESTIAN: return m_uiTerestianGUID; + case DATA_MOROES: return m_uiMoroesGUID; + case DATA_GO_STAGEDOORLEFT: return m_uiStageDoorLeftGUID; + case DATA_GO_STAGEDOORRIGHT: return m_uiStageDoorRightGUID; + case DATA_GO_CURTAINS: return m_uiCurtainGUID; + case DATA_GO_LIBRARY_DOOR: return m_uiLibraryDoor; + case DATA_GO_MASSIVE_DOOR: return m_uiMassiveDoor; + case DATA_GO_SIDE_ENTRANCE_DOOR: return m_uiSideEntranceDoor; + case DATA_GO_GAME_DOOR: return m_uiGamesmansDoor; + case DATA_GO_GAME_EXIT_DOOR: return m_uiGamesmansExitDoor; + case DATA_GO_NETHER_DOOR: return m_uiNetherspaceDoor; + case DATA_MASTERS_TERRACE_DOOR_1: return MastersTerraceDoor[0]; + case DATA_MASTERS_TERRACE_DOOR_2: return MastersTerraceDoor[1]; + case DATA_IMAGE_OF_MEDIVH: return ImageGUID; + case DATA_NIGHTBANE: return m_uiNightbaneGUID; + } */ - return 0; - } + return 0; + } std::string GetSaveData() { @@ -190,77 +190,77 @@ class instance_karazhan : public InstanceMapScript SetBossState(i, EncounterState(tmpState)); } - loadStream >> _servantQuartersKills; - loadStream >> _selectedRare; + loadStream >> _servantQuartersKills; + loadStream >> _selectedRare; } } - private: - uint32 _servantQuartersKills; - uint32 _selectedRare; - }; + private: + uint32 _servantQuartersKills; + uint32 _selectedRare; + }; }; class spell_karazhan_brittle_bones : public SpellScriptLoader { - public: - spell_karazhan_brittle_bones() : SpellScriptLoader("spell_karazhan_brittle_bones") { } + public: + spell_karazhan_brittle_bones() : SpellScriptLoader("spell_karazhan_brittle_bones") { } - class spell_karazhan_brittle_bones_AuraScript : public AuraScript - { - PrepareAuraScript(spell_karazhan_brittle_bones_AuraScript); + class spell_karazhan_brittle_bones_AuraScript : public AuraScript + { + PrepareAuraScript(spell_karazhan_brittle_bones_AuraScript); - void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) - { - isPeriodic = true; - amplitude = 5000; - } + void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) + { + isPeriodic = true; + amplitude = 5000; + } - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - if (roll_chance_i(35)) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_RATTLED, true); - } + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + if (roll_chance_i(35)) + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_RATTLED, true); + } - void Register() - { - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_karazhan_brittle_bones_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_brittle_bones_AuraScript::Update, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + void Register() + { + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_karazhan_brittle_bones_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_brittle_bones_AuraScript::Update, EFFECT_0, SPELL_AURA_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_karazhan_brittle_bones_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_karazhan_brittle_bones_AuraScript(); + } }; class spell_karazhan_overload : public SpellScriptLoader { - public: - spell_karazhan_overload() : SpellScriptLoader("spell_karazhan_overload") { } + public: + spell_karazhan_overload() : SpellScriptLoader("spell_karazhan_overload") { } - class spell_karazhan_overload_AuraScript : public AuraScript - { - PrepareAuraScript(spell_karazhan_overload_AuraScript); + class spell_karazhan_overload_AuraScript : public AuraScript + { + PrepareAuraScript(spell_karazhan_overload_AuraScript); - void PeriodicTick(AuraEffect const* auraEffect) - { - PreventDefaultAction(); - GetUnitOwner()->CastCustomSpell(SPELL_OVERLOAD, SPELLVALUE_BASE_POINT0, int32(auraEffect->GetAmount() * (2.0, auraEffect->GetTickNumber())), GetUnitOwner(), true); - } + void PeriodicTick(AuraEffect const* auraEffect) + { + PreventDefaultAction(); + GetUnitOwner()->CastCustomSpell(SPELL_OVERLOAD, SPELLVALUE_BASE_POINT0, int32(auraEffect->GetAmount() * (2.0, auraEffect->GetTickNumber())), GetUnitOwner(), true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_overload_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_karazhan_overload_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_karazhan_overload_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_karazhan_overload_AuraScript(); + } }; class spell_karazhan_blink : public SpellScriptLoader @@ -274,10 +274,10 @@ class spell_karazhan_blink : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - GetCaster()->getThreatManager().resetAllAggro(); - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, SPELL_BLINK, true); + PreventHitDefaultEffect(effIndex); + GetCaster()->getThreatManager().resetAllAggro(); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_BLINK, true); } void Register() @@ -295,7 +295,7 @@ class spell_karazhan_blink : public SpellScriptLoader void AddSC_instance_karazhan() { new instance_karazhan(); - new spell_karazhan_brittle_bones(); - new spell_karazhan_overload(); - new spell_karazhan_blink(); + new spell_karazhan_brittle_bones(); + new spell_karazhan_overload(); + new spell_karazhan_blink(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 0e65772fc..ad832e1a2 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -439,8 +439,8 @@ public: npc_image_of_medivhAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); - Step = 1; - YellTimer = 5000; + Step = 1; + YellTimer = 5000; } InstanceScript* instance; @@ -457,28 +457,28 @@ public: void Reset() { ArcanagosGUID = 0; - MTimer = 0; - ATimer = 0; + MTimer = 0; + ATimer = 0; if (instance && instance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0) { - Creature* Arcanagos = me->SummonCreature(NPC_ARCANAGOS, ArcanagosPos[0], ArcanagosPos[1], ArcanagosPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); - if (!Arcanagos) - { - me->DespawnOrUnsummon(); - return; - } + Creature* Arcanagos = me->SummonCreature(NPC_ARCANAGOS, ArcanagosPos[0], ArcanagosPos[1], ArcanagosPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); + if (!Arcanagos) + { + me->DespawnOrUnsummon(); + return; + } - instance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID()); - EventStarted = true; - ArcanagosGUID = Arcanagos->GetGUID(); + instance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID()); + EventStarted = true; + ArcanagosGUID = Arcanagos->GetGUID(); - Arcanagos->SetFacingToObject(me); - me->SetFacingToObject(Arcanagos); + Arcanagos->SetFacingToObject(me); + me->SetFacingToObject(Arcanagos); - Arcanagos->SetCanFly(true); + Arcanagos->SetCanFly(true); } - else + else me->DespawnOrUnsummon(); } @@ -509,8 +509,8 @@ public: if (Creature* arca = ObjectAccessor::GetCreature((*me), ArcanagosGUID)) arca->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, 0); - ATimer = 5500; - MTimer = 6600; + ATimer = 5500; + MTimer = 6600; return 10000; case 7: return 1000; @@ -519,10 +519,10 @@ public: return 5500; case 9: me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false); - me->CastSpell(me, 30972, true); + me->CastSpell(me, 30972, true); return 10000; case 10: - me->RemoveAurasDueToSpell(30972); + me->RemoveAurasDueToSpell(30972); if (Creature* arca = ObjectAccessor::GetCreature((*me), ArcanagosGUID)) me->CastSpell(arca, SPELL_CONFLAGRATION_BLAST, false); return 1000; @@ -531,12 +531,12 @@ public: arca->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, 0); return 5000; case 12: - if (Creature* arca = ObjectAccessor::GetCreature((*me), ArcanagosGUID)) - { - arca->SetSpeed(MOVE_RUN, 2.0f); - arca->GetMotionMaster()->MovePoint(0, -11010.82f, -1761.18f, 156.47f); - arca->InterruptNonMeleeSpells(true); - } + if (Creature* arca = ObjectAccessor::GetCreature((*me), ArcanagosGUID)) + { + arca->SetSpeed(MOVE_RUN, 2.0f); + arca->GetMotionMaster()->MovePoint(0, -11010.82f, -1761.18f, 156.47f); + arca->InterruptNonMeleeSpells(true); + } return 10000; case 13: me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, 0); @@ -548,20 +548,20 @@ public: for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->GetSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) - { + { i->GetSource()->GroupEventHappens(9645, me); - break; - } + break; + } } } - me->DespawnOrUnsummon(100); - if (Creature* arca = ObjectAccessor::GetCreature((*me), ArcanagosGUID)) - arca->DespawnOrUnsummon(100); + me->DespawnOrUnsummon(100); + if (Creature* arca = ObjectAccessor::GetCreature((*me), ArcanagosGUID)) + arca->DespawnOrUnsummon(100); return 5000; default: - return 2000; + return 2000; } } @@ -577,8 +577,8 @@ public: if (Step >= 7 && Step <= 8) { - ATimer += diff; - MTimer += diff; + ATimer += diff; + MTimer += diff; if (ATimer >= 6000) { if (Unit* arca = ObjectAccessor::GetUnit((*me), ArcanagosGUID)) @@ -588,7 +588,7 @@ public: if (MTimer >= 6000) { if (Unit* arca = ObjectAccessor::GetUnit((*me), ArcanagosGUID)) - me->CastSpell(arca, SPELL_FIRE_BALL, false); + me->CastSpell(arca, SPELL_FIRE_BALL, false); MTimer = 0; } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h index 93547b4c0..d2c914f37 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h @@ -7,7 +7,7 @@ REWRITTEN BY XINEF enum DataTypes { - TYPE_SERVANT_QUARTERS = 0, + TYPE_SERVANT_QUARTERS = 0, TYPE_ATTUMEN = 1, TYPE_MOROES = 2, TYPE_MAIDEN = 3, @@ -20,7 +20,7 @@ enum DataTypes TYPE_CHESS = 10, TYPE_MALCHEZZAR = 11, TYPE_NIGHTBANE = 12, - MAX_ENCOUNTERS = 13, + MAX_ENCOUNTERS = 13, DATA_OPERA_PERFORMANCE = 13, DATA_OPERA_OZ_DEATHCOUNT = 14, @@ -42,10 +42,10 @@ enum DataTypes DATA_MASTERS_TERRACE_DOOR_2 = 28, DATA_GO_SIDE_ENTRANCE_DOOR = 29, - DATA_NIGHTBANE = 30, + DATA_NIGHTBANE = 30, - DATA_COUNT_SERVANT_QUARTERS_KILLS = 100, - DATA_SELECTED_RARE = 101, + DATA_COUNT_SERVANT_QUARTERS_KILLS = 100, + DATA_SELECTED_RARE = 101, }; enum OperaEvents @@ -57,19 +57,19 @@ enum OperaEvents enum KarazhanNPCs { - NPC_HYAKISS_THE_LURKER = 16179, - NPC_SHADIKITH_THE_GLIDER = 16180, - NPC_ROKAD_THE_RAVAGER = 16181, + NPC_HYAKISS_THE_LURKER = 16179, + NPC_SHADIKITH_THE_GLIDER = 16180, + NPC_ROKAD_THE_RAVAGER = 16181, - NPC_ATTUMEN_THE_HUNTSMAN = 15550, - NPC_ATTUMEN_THE_HUNTSMAN_MOUNTED = 16152 + NPC_ATTUMEN_THE_HUNTSMAN = 15550, + NPC_ATTUMEN_THE_HUNTSMAN_MOUNTED = 16152 }; enum KarazhanSpells { - SPELL_RATTLED = 32437, - SPELL_OVERLOAD = 29766, - SPELL_BLINK = 29884 + SPELL_RATTLED = 32437, + SPELL_OVERLOAD = 29766, + SPELL_BLINK = 29884 }; #endif diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 22ed2db0d..51905233b 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -22,46 +22,46 @@ enum Says enum Spells { // Phase 1 - SPELL_FIREBALL_N = 44189, - SPELL_FIREBALL_H = 46164, - SPELL_FLAMESTRIKE_SUMMON = 44192, - SPELL_PHOENIX = 44194, - SPELL_SHOCK_BARRIER = 46165, - SPELL_PYROBLAST = 36819, + SPELL_FIREBALL_N = 44189, + SPELL_FIREBALL_H = 46164, + SPELL_FLAMESTRIKE_SUMMON = 44192, + SPELL_PHOENIX = 44194, + SPELL_SHOCK_BARRIER = 46165, + SPELL_PYROBLAST = 36819, - // Phase 2 - SPELL_SUMMON_ARCANE_SPHERE = 44265, - SPELL_TELEPORT_CENTER = 44218, - SPELL_GRAVITY_LAPSE_INITIAL = 44224, - SPELL_GRAVITY_LAPSE_PLAYER = 44219, // Till 44223, 5 players - SPELL_GRAVITY_LAPSE_FLY = 44227, - SPELL_GRAVITY_LAPSE_DOT = 44226, - SPELL_GRAVITY_LAPSE_CHANNEL = 44251, - SPELL_POWER_FEEDBACK = 44233 + // Phase 2 + SPELL_SUMMON_ARCANE_SPHERE = 44265, + SPELL_TELEPORT_CENTER = 44218, + SPELL_GRAVITY_LAPSE_INITIAL = 44224, + SPELL_GRAVITY_LAPSE_PLAYER = 44219, // Till 44223, 5 players + SPELL_GRAVITY_LAPSE_FLY = 44227, + SPELL_GRAVITY_LAPSE_DOT = 44226, + SPELL_GRAVITY_LAPSE_CHANNEL = 44251, + SPELL_POWER_FEEDBACK = 44233 }; enum Misc { - EVENT_INIT_COMBAT = 1, - EVENT_SPELL_FIREBALL = 2, - EVENT_SPELL_PHOENIX = 3, - EVENT_SPELL_FLAMESTRIKE = 4, - EVENT_SPELL_SHOCK_BARRIER = 5, - EVENT_CHECK_HEALTH = 6, - EVENT_GRAVITY_LAPSE_1_1 = 7, - EVENT_GRAVITY_LAPSE_1_2 = 8, - EVENT_GRAVITY_LAPSE_2 = 9, - EVENT_GRAVITY_LAPSE_3 = 10, - EVENT_GRAVITY_LAPSE_4 = 11, - EVENT_GRAVITY_LAPSE_5 = 12, - EVENT_FINISH_TALK = 13, + EVENT_INIT_COMBAT = 1, + EVENT_SPELL_FIREBALL = 2, + EVENT_SPELL_PHOENIX = 3, + EVENT_SPELL_FLAMESTRIKE = 4, + EVENT_SPELL_SHOCK_BARRIER = 5, + EVENT_CHECK_HEALTH = 6, + EVENT_GRAVITY_LAPSE_1_1 = 7, + EVENT_GRAVITY_LAPSE_1_2 = 8, + EVENT_GRAVITY_LAPSE_2 = 9, + EVENT_GRAVITY_LAPSE_3 = 10, + EVENT_GRAVITY_LAPSE_4 = 11, + EVENT_GRAVITY_LAPSE_5 = 12, + EVENT_FINISH_TALK = 13, - ACTION_TELEPORT_PLAYERS = 1, - ACTION_KNOCKUP = 2, - ACTION_ALLOW_FLY = 3, - ACTION_REMOVE_FLY = 4, + ACTION_TELEPORT_PLAYERS = 1, + ACTION_KNOCKUP = 2, + ACTION_ALLOW_FLY = 3, + ACTION_REMOVE_FLY = 4, - CREATURE_ARCANE_SPHERE = 24708 + CREATURE_ARCANE_SPHERE = 24708 }; class boss_felblood_kaelthas : public CreatureScript @@ -79,64 +79,64 @@ public: boss_felblood_kaelthasAI(Creature* creature) : ScriptedAI(creature), summons(me) { instance = creature->GetInstanceScript(); - introSpeak = false; + introSpeak = false; } InstanceScript* instance; - EventMap events; - EventMap events2; - SummonList summons; - bool introSpeak; + EventMap events; + EventMap events2; + SummonList summons; + bool introSpeak; void Reset() { - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); instance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); } - void JustSummoned(Creature* summon) - { - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (*itr == summon->GetGUID()) - return; - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (*itr == summon->GetGUID()) + return; + summons.Summon(summon); + } - void InitializeAI() - { - ScriptedAI::InitializeAI(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - } + void InitializeAI() + { + ScriptedAI::InitializeAI(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + } - void JustDied(Unit*) - { - instance->SetData(DATA_KAELTHAS_EVENT, DONE); - } + void JustDied(Unit*) + { + instance->SetData(DATA_KAELTHAS_EVENT, DONE); + } void EnterCombat(Unit* /*who*/) { instance->SetData(DATA_KAELTHAS_EVENT, IN_PROGRESS); - me->SetInCombatWithZone(); + me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_SPELL_FIREBALL, 0); - events.ScheduleEvent(EVENT_SPELL_PHOENIX, 15000); - events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 22000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_SPELL_FIREBALL, 0); + events.ScheduleEvent(EVENT_SPELL_PHOENIX, 15000); + events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 22000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_SHOCK_BARRIER, 50000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_SHOCK_BARRIER, 50000); } void MoveInLineOfSight(Unit* who) { - if (!introSpeak && me->IsWithinDistInMap(who, 40.0f) && who->GetTypeId() == TYPEID_PLAYER) + if (!introSpeak && me->IsWithinDistInMap(who, 40.0f) && who->GetTypeId() == TYPEID_PLAYER) { Talk(SAY_AGGRO); introSpeak = true; - events2.ScheduleEvent(EVENT_INIT_COMBAT, 35000); + events2.ScheduleEvent(EVENT_INIT_COMBAT, 35000); } ScriptedAI::MoveInLineOfSight(who); @@ -145,140 +145,140 @@ public: void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) { if (damage >= me->GetHealth()) - { - damage = me->GetHealth()-1; - if (me->isRegeneratingHealth()) - { - me->SetRegeneratingHealth(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->CombatStop(); - me->SetReactState(REACT_PASSIVE); - LapseAction(ACTION_REMOVE_FLY); - events.Reset(); - events2.ScheduleEvent(EVENT_FINISH_TALK, 6000); - Talk(SAY_DEATH); - } - } + { + damage = me->GetHealth()-1; + if (me->isRegeneratingHealth()) + { + me->SetRegeneratingHealth(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->CombatStop(); + me->SetReactState(REACT_PASSIVE); + LapseAction(ACTION_REMOVE_FLY); + events.Reset(); + events2.ScheduleEvent(EVENT_FINISH_TALK, 6000); + Talk(SAY_DEATH); + } + } + } + + void LapseAction(uint8 action) + { + uint8 counter = 0; + Map::PlayerList const& playerList = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr, ++counter) + if (Player* player = itr->GetSource()) + { + if (action == ACTION_TELEPORT_PLAYERS) + me->CastSpell(player, SPELL_GRAVITY_LAPSE_PLAYER+counter, true); + else if (action == ACTION_KNOCKUP) + player->CastSpell(player, SPELL_GRAVITY_LAPSE_DOT, true, NULL, NULL, me->GetGUID()); + else if (action == ACTION_ALLOW_FLY) + player->CastSpell(player, SPELL_GRAVITY_LAPSE_FLY, true, NULL, NULL, me->GetGUID()); + else if (action == ACTION_REMOVE_FLY) + { + player->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); + player->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); + } + } } - - void LapseAction(uint8 action) - { - uint8 counter = 0; - Map::PlayerList const& playerList = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr, ++counter) - if (Player* player = itr->GetSource()) - { - if (action == ACTION_TELEPORT_PLAYERS) - me->CastSpell(player, SPELL_GRAVITY_LAPSE_PLAYER+counter, true); - else if (action == ACTION_KNOCKUP) - player->CastSpell(player, SPELL_GRAVITY_LAPSE_DOT, true, NULL, NULL, me->GetGUID()); - else if (action == ACTION_ALLOW_FLY) - player->CastSpell(player, SPELL_GRAVITY_LAPSE_FLY, true, NULL, NULL, me->GetGUID()); - else if (action == ACTION_REMOVE_FLY) - { - player->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); - player->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); - } - } - } void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_INIT_COMBAT: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - if (Unit* target = SelectTargetFromPlayerList(50.0f)) - AttackStart(target); - return; - case EVENT_FINISH_TALK: - Unit::Kill(me, me); - return; - } + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_INIT_COMBAT: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + if (Unit* target = SelectTargetFromPlayerList(50.0f)) + AttackStart(target); + return; + case EVENT_FINISH_TALK: + Unit::Kill(me, me); + return; + } if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (uint32 eventId = events.ExecuteEvent()) - { - case EVENT_SPELL_FIREBALL: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_FIREBALL_N, SPELL_FIREBALL_H), false); - events.ScheduleEvent(EVENT_SPELL_FIREBALL, urand(3000, 4500)); - break; - case EVENT_SPELL_FLAMESTRIKE: + switch (uint32 eventId = events.ExecuteEvent()) + { + case EVENT_SPELL_FIREBALL: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_FIREBALL_N, SPELL_FIREBALL_H), false); + events.ScheduleEvent(EVENT_SPELL_FIREBALL, urand(3000, 4500)); + break; + case EVENT_SPELL_FLAMESTRIKE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - me->CastSpell(target, SPELL_FLAMESTRIKE_SUMMON, true); + { + me->CastSpell(target, SPELL_FLAMESTRIKE_SUMMON, true); Talk(SAY_FLAMESTRIKE); } - events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 25000); - break; - case EVENT_SPELL_SHOCK_BARRIER: - me->CastSpell(me, SPELL_SHOCK_BARRIER, true); - me->CastCustomSpell(SPELL_PYROBLAST, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, false); - events.ScheduleEvent(EVENT_SPELL_SHOCK_BARRIER, 50000); - break; - case EVENT_SPELL_PHOENIX: + events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 25000); + break; + case EVENT_SPELL_SHOCK_BARRIER: + me->CastSpell(me, SPELL_SHOCK_BARRIER, true); + me->CastCustomSpell(SPELL_PYROBLAST, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, false); + events.ScheduleEvent(EVENT_SPELL_SHOCK_BARRIER, 50000); + break; + case EVENT_SPELL_PHOENIX: Talk(SAY_PHOENIX); - me->CastSpell(me, SPELL_PHOENIX, false); - events.ScheduleEvent(EVENT_SPELL_PHOENIX, 60000); - break; - case EVENT_CHECK_HEALTH: + me->CastSpell(me, SPELL_PHOENIX, false); + events.ScheduleEvent(EVENT_SPELL_PHOENIX, 60000); + break; + case EVENT_CHECK_HEALTH: if (HealthBelowPct(50)) { me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); - me->CastSpell(me, SPELL_TELEPORT_CENTER, true); - events.Reset(); + me->CastSpell(me, SPELL_TELEPORT_CENTER, true); + events.Reset(); me->StopMoving(); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); - events.SetPhase(1); - events.ScheduleEvent(EVENT_GRAVITY_LAPSE_1_1, 0); - break; + events.SetPhase(1); + events.ScheduleEvent(EVENT_GRAVITY_LAPSE_1_1, 0); + break; } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); - break; - case EVENT_GRAVITY_LAPSE_1_1: - case EVENT_GRAVITY_LAPSE_1_2: - Talk(eventId == EVENT_GRAVITY_LAPSE_1_1 ? SAY_GRAVITY_LAPSE : SAY_RECAST_GRAVITY); - me->CastSpell(me, SPELL_GRAVITY_LAPSE_INITIAL, false); - events.ScheduleEvent(EVENT_GRAVITY_LAPSE_2, 2000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); break; - case EVENT_GRAVITY_LAPSE_2: - LapseAction(ACTION_TELEPORT_PLAYERS); - events.ScheduleEvent(EVENT_GRAVITY_LAPSE_3, 1000); - break; - case EVENT_GRAVITY_LAPSE_3: - LapseAction(ACTION_KNOCKUP); - events.ScheduleEvent(EVENT_GRAVITY_LAPSE_4, 1000); - break; - case EVENT_GRAVITY_LAPSE_4: + case EVENT_GRAVITY_LAPSE_1_1: + case EVENT_GRAVITY_LAPSE_1_2: + Talk(eventId == EVENT_GRAVITY_LAPSE_1_1 ? SAY_GRAVITY_LAPSE : SAY_RECAST_GRAVITY); + me->CastSpell(me, SPELL_GRAVITY_LAPSE_INITIAL, false); + events.ScheduleEvent(EVENT_GRAVITY_LAPSE_2, 2000); + break; + case EVENT_GRAVITY_LAPSE_2: + LapseAction(ACTION_TELEPORT_PLAYERS); + events.ScheduleEvent(EVENT_GRAVITY_LAPSE_3, 1000); + break; + case EVENT_GRAVITY_LAPSE_3: + LapseAction(ACTION_KNOCKUP); + events.ScheduleEvent(EVENT_GRAVITY_LAPSE_4, 1000); + break; + case EVENT_GRAVITY_LAPSE_4: LapseAction(ACTION_ALLOW_FLY); for (uint8 i = 0; i < 3; ++i) - me->CastSpell(me, SPELL_SUMMON_ARCANE_SPHERE, true); + me->CastSpell(me, SPELL_SUMMON_ARCANE_SPHERE, true); - me->CastSpell(me, SPELL_GRAVITY_LAPSE_CHANNEL, false); - events.ScheduleEvent(EVENT_GRAVITY_LAPSE_5, 30000); - break; - case EVENT_GRAVITY_LAPSE_5: - LapseAction(ACTION_REMOVE_FLY); + me->CastSpell(me, SPELL_GRAVITY_LAPSE_CHANNEL, false); + events.ScheduleEvent(EVENT_GRAVITY_LAPSE_5, 30000); + break; + case EVENT_GRAVITY_LAPSE_5: + LapseAction(ACTION_REMOVE_FLY); me->InterruptNonMeleeSpells(false); Talk(SAY_TIRED); - me->CastSpell(me, SPELL_POWER_FEEDBACK, false); - events.ScheduleEvent(EVENT_GRAVITY_LAPSE_1_2, 10000); - break; - } + me->CastSpell(me, SPELL_POWER_FEEDBACK, false); + events.ScheduleEvent(EVENT_GRAVITY_LAPSE_1_2, 10000); + break; + } - if (events.GetPhaseMask() == 0) - DoMeleeAttackIfReady(); + if (events.GetPhaseMask() == 0) + DoMeleeAttackIfReady(); } }; }; @@ -294,8 +294,8 @@ class spell_mt_phoenix_burn : public SpellScriptLoader void HandleAfterCast() { - uint32 damage = CalculatePct(GetCaster()->GetMaxHealth(), 5); - Unit::DealDamage(GetCaster(), GetCaster(), damage); + uint32 damage = CalculatePct(GetCaster()->GetMaxHealth(), 5); + Unit::DealDamage(GetCaster(), GetCaster(), damage); } void Register() @@ -313,5 +313,5 @@ class spell_mt_phoenix_burn : public SpellScriptLoader void AddSC_boss_felblood_kaelthas() { new boss_felblood_kaelthas(); - new spell_mt_phoenix_burn(); + new spell_mt_phoenix_burn(); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index 329428c8c..7e62939bb 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -9,28 +9,28 @@ REWRITTEN BY XINEF enum Yells { SAY_AGGRO = 0, - SAY_HELPER_DIED = 1, - SAY_PLAYER_KILLED = 5, + SAY_HELPER_DIED = 1, + SAY_PLAYER_KILLED = 5, SAY_DEATH = 10, }; enum Spells { - SPELL_MEDALION_OF_IMMUNITY = 46227, + SPELL_MEDALION_OF_IMMUNITY = 46227, SPELL_DISPEL_MAGIC = 27609, SPELL_FLASH_HEAL = 17843, SPELL_SHADOW_WORD_PAIN_N = 14032, SPELL_SHADOW_WORD_PAIN_H = 15654, SPELL_POWER_WORD_SHIELD_N = 44291, - SPELL_POWER_WORD_SHIELD_H = 46193, - SPELL_RENEW_N = 44174, - SPELL_RENEW_H = 46192, + SPELL_POWER_WORD_SHIELD_H = 46193, + SPELL_RENEW_N = 44174, + SPELL_RENEW_H = 46192, }; enum Misc { MAX_ACTIVE_HELPERS = 4, - MAX_HELPERS_COUNT = 8 + MAX_HELPERS_COUNT = 8 }; const Position helpersLocations[MAX_ACTIVE_HELPERS]= @@ -55,13 +55,13 @@ const uint32 helpersEntries[MAX_HELPERS_COUNT] = enum Events { - EVENT_SPELL_FLASH_HEAL = 1, - EVENT_SPELL_RENEW = 2, - EVENT_SPELL_PW_SHIELD = 3, - EVENT_SPELL_SW_PAIN = 4, - EVENT_SPELL_DISPEL = 5, - EVENT_CHECK_DIST = 6, - EVENT_SPELL_IMMUNITY = 7, + EVENT_SPELL_FLASH_HEAL = 1, + EVENT_SPELL_RENEW = 2, + EVENT_SPELL_PW_SHIELD = 3, + EVENT_SPELL_SW_PAIN = 4, + EVENT_SPELL_DISPEL = 5, + EVENT_CHECK_DIST = 6, + EVENT_SPELL_IMMUNITY = 7, }; class boss_priestess_delrissa : public CreatureScript @@ -82,72 +82,72 @@ public: } InstanceScript* instance; - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; uint8 PlayersKilled; - uint8 HelpersKilled; + uint8 HelpersKilled; void Reset() { PlayersKilled = SAY_PLAYER_KILLED; - HelpersKilled = SAY_HELPER_DIED; - instance->SetData(DATA_DELRISSA_EVENT, NOT_STARTED); - summons.Respawn(); + HelpersKilled = SAY_HELPER_DIED; + instance->SetData(DATA_DELRISSA_EVENT, NOT_STARTED); + summons.Respawn(); - me->SetLootMode(0); + me->SetLootMode(0); } void InitializeAI() - { - ScriptedAI::InitializeAI(); - std::list helpersList; - for (uint8 i = 0; i < MAX_HELPERS_COUNT; ++i) - helpersList.push_back(helpersEntries[i]); - Trinity::Containers::RandomResizeList(helpersList, MAX_ACTIVE_HELPERS); + { + ScriptedAI::InitializeAI(); + std::list helpersList; + for (uint8 i = 0; i < MAX_HELPERS_COUNT; ++i) + helpersList.push_back(helpersEntries[i]); + Trinity::Containers::RandomResizeList(helpersList, MAX_ACTIVE_HELPERS); - uint8 j = 0; - for (std::list::const_iterator itr = helpersList.begin(); itr != helpersList.end(); ++itr, ++j) - me->SummonCreature(*itr, helpersLocations[j], TEMPSUMMON_MANUAL_DESPAWN, 0); - } + uint8 j = 0; + for (std::list::const_iterator itr = helpersList.begin(); itr != helpersList.end(); ++itr, ++j) + me->SummonCreature(*itr, helpersLocations[j], TEMPSUMMON_MANUAL_DESPAWN, 0); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - if (me->IsAlive() && HelpersKilled < SAY_PLAYER_KILLED) - { - if (HelpersKilled == MAX_ACTIVE_HELPERS) - me->SetLootMode(1); - Talk(HelpersKilled); - } - else if (HelpersKilled == MAX_ACTIVE_HELPERS) - { - me->loot.clear(); - me->loot.FillLoot(me->GetCreatureTemplate()->lootid, LootTemplates_Creature, me->GetLootRecipient(), false, false, 1); - instance->SetData(DATA_DELRISSA_EVENT, DONE); - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - ++HelpersKilled; - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + if (me->IsAlive() && HelpersKilled < SAY_PLAYER_KILLED) + { + if (HelpersKilled == MAX_ACTIVE_HELPERS) + me->SetLootMode(1); + Talk(HelpersKilled); + } + else if (HelpersKilled == MAX_ACTIVE_HELPERS) + { + me->loot.clear(); + me->loot.FillLoot(me->GetCreatureTemplate()->lootid, LootTemplates_Creature, me->GetLootRecipient(), false, false, 1); + instance->SetData(DATA_DELRISSA_EVENT, DONE); + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } + ++HelpersKilled; + } void EnterCombat(Unit* who) { Talk(SAY_AGGRO); - summons.DoZoneInCombat(); + summons.DoZoneInCombat(); instance->SetData(DATA_DELRISSA_EVENT, IN_PROGRESS); - events.ScheduleEvent(EVENT_SPELL_FLASH_HEAL, 15000); - events.ScheduleEvent(EVENT_SPELL_RENEW, 10000); - events.ScheduleEvent(EVENT_SPELL_PW_SHIELD, 2000); - events.ScheduleEvent(EVENT_SPELL_SW_PAIN, 5000); - events.ScheduleEvent(EVENT_SPELL_DISPEL, 7500); - events.ScheduleEvent(EVENT_CHECK_DIST, 5000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_IMMUNITY, 4000); + events.ScheduleEvent(EVENT_SPELL_FLASH_HEAL, 15000); + events.ScheduleEvent(EVENT_SPELL_RENEW, 10000); + events.ScheduleEvent(EVENT_SPELL_PW_SHIELD, 2000); + events.ScheduleEvent(EVENT_SPELL_SW_PAIN, 5000); + events.ScheduleEvent(EVENT_SPELL_DISPEL, 7500); + events.ScheduleEvent(EVENT_CHECK_DIST, 5000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_IMMUNITY, 4000); } void KilledUnit(Unit* victim) @@ -156,7 +156,7 @@ public: return; if (PlayersKilled < SAY_DEATH) - Talk(PlayersKilled++); + Talk(PlayersKilled++); } void JustDied(Unit* /*killer*/) @@ -172,68 +172,68 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_DIST: - if (me->GetDistance(me->GetHomePosition()) > 75.0f) - { - EnterEvadeMode(); - return; - } - events.ScheduleEvent(EVENT_CHECK_DIST, 5000); - break; - case EVENT_SPELL_FLASH_HEAL: - if (Unit* target = DoSelectLowestHpFriendly(40.0f, 1000)) - me->CastSpell(target, SPELL_FLASH_HEAL, false); - events.ScheduleEvent(EVENT_SPELL_FLASH_HEAL, 15000); - break; - case EVENT_SPELL_RENEW: - if (Unit* target = DoSelectLowestHpFriendly(40.0f, 1000)) - me->CastSpell(target, DUNGEON_MODE(SPELL_RENEW_N, SPELL_RENEW_H), false); - events.ScheduleEvent(EVENT_SPELL_RENEW, 7000); - break; - case EVENT_SPELL_PW_SHIELD: - { - std::list cList = DoFindFriendlyMissingBuff(40.0f, DUNGEON_MODE(SPELL_POWER_WORD_SHIELD_N, SPELL_POWER_WORD_SHIELD_H)); - if (Unit* target = Trinity::Containers::SelectRandomContainerElement(cList)) - me->CastSpell(target, DUNGEON_MODE(SPELL_POWER_WORD_SHIELD_N, SPELL_POWER_WORD_SHIELD_H), false); - events.ScheduleEvent(EVENT_SPELL_PW_SHIELD, 10000); - break; - } - case EVENT_SPELL_DISPEL: - { - Unit* target = NULL; - switch (urand(0, 2)) - { - case 0: target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true); break; - case 1: target = me; break; - case 2: target = ObjectAccessor::GetCreature(*me, Trinity::Containers::SelectRandomContainerElement(summons)); break; - } + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_DIST: + if (me->GetDistance(me->GetHomePosition()) > 75.0f) + { + EnterEvadeMode(); + return; + } + events.ScheduleEvent(EVENT_CHECK_DIST, 5000); + break; + case EVENT_SPELL_FLASH_HEAL: + if (Unit* target = DoSelectLowestHpFriendly(40.0f, 1000)) + me->CastSpell(target, SPELL_FLASH_HEAL, false); + events.ScheduleEvent(EVENT_SPELL_FLASH_HEAL, 15000); + break; + case EVENT_SPELL_RENEW: + if (Unit* target = DoSelectLowestHpFriendly(40.0f, 1000)) + me->CastSpell(target, DUNGEON_MODE(SPELL_RENEW_N, SPELL_RENEW_H), false); + events.ScheduleEvent(EVENT_SPELL_RENEW, 7000); + break; + case EVENT_SPELL_PW_SHIELD: + { + std::list cList = DoFindFriendlyMissingBuff(40.0f, DUNGEON_MODE(SPELL_POWER_WORD_SHIELD_N, SPELL_POWER_WORD_SHIELD_H)); + if (Unit* target = Trinity::Containers::SelectRandomContainerElement(cList)) + me->CastSpell(target, DUNGEON_MODE(SPELL_POWER_WORD_SHIELD_N, SPELL_POWER_WORD_SHIELD_H), false); + events.ScheduleEvent(EVENT_SPELL_PW_SHIELD, 10000); + break; + } + case EVENT_SPELL_DISPEL: + { + Unit* target = NULL; + switch (urand(0, 2)) + { + case 0: target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true); break; + case 1: target = me; break; + case 2: target = ObjectAccessor::GetCreature(*me, Trinity::Containers::SelectRandomContainerElement(summons)); break; + } - if (target) - me->CastSpell(target, SPELL_DISPEL_MAGIC, false); - events.ScheduleEvent(EVENT_SPELL_DISPEL, 12000); - break; - } - case EVENT_SPELL_IMMUNITY: - if (me->HasUnitState(UNIT_STATE_LOST_CONTROL)) - { - me->CastSpell(me, SPELL_MEDALION_OF_IMMUNITY, false); - events.ScheduleEvent(EVENT_SPELL_IMMUNITY, 60000); - } - else - events.ScheduleEvent(EVENT_SPELL_IMMUNITY, 1000); - break; - case EVENT_SPELL_SW_PAIN: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) - me->CastSpell(target, DUNGEON_MODE(SPELL_SHADOW_WORD_PAIN_N, SPELL_SHADOW_WORD_PAIN_H), false); - events.ScheduleEvent(EVENT_SPELL_SW_PAIN, 10000); - break; - } + if (target) + me->CastSpell(target, SPELL_DISPEL_MAGIC, false); + events.ScheduleEvent(EVENT_SPELL_DISPEL, 12000); + break; + } + case EVENT_SPELL_IMMUNITY: + if (me->HasUnitState(UNIT_STATE_LOST_CONTROL)) + { + me->CastSpell(me, SPELL_MEDALION_OF_IMMUNITY, false); + events.ScheduleEvent(EVENT_SPELL_IMMUNITY, 60000); + } + else + events.ScheduleEvent(EVENT_SPELL_IMMUNITY, 1000); + break; + case EVENT_SPELL_SW_PAIN: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) + me->CastSpell(target, DUNGEON_MODE(SPELL_SHADOW_WORD_PAIN_N, SPELL_SHADOW_WORD_PAIN_H), false); + events.ScheduleEvent(EVENT_SPELL_SW_PAIN, 10000); + break; + } DoMeleeAttackIfReady(); } @@ -242,14 +242,14 @@ public: enum helpersShared { - SPELL_HEALING_POTION = 15503, + SPELL_HEALING_POTION = 15503, - EVENT_SPELL_HELPER_HEALING_POTION = 20, - EVENT_SPELL_HELPER_IMMUNITY = 21, - EVENT_HELPER_RESET_THREAT = 22, + EVENT_SPELL_HELPER_HEALING_POTION = 20, + EVENT_SPELL_HELPER_IMMUNITY = 21, + EVENT_HELPER_RESET_THREAT = 22, - AI_TYPE_MELEE = 1, - AI_TYPE_RANGED = 2 + AI_TYPE_MELEE = 1, + AI_TYPE_RANGED = 2 }; struct boss_priestess_lackey_commonAI : public ScriptedAI @@ -257,82 +257,82 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI boss_priestess_lackey_commonAI(Creature* creature, uint32 type) : ScriptedAI(creature), summons(me) { instance = creature->GetInstanceScript(); - aiType = type; + aiType = type; } InstanceScript* instance; - EventMap events; - SummonList summons; - uint32 actualEventId; - uint8 aiType; + EventMap events; + SummonList summons; + uint32 actualEventId; + uint8 aiType; - float GetThreatMod(float dist, float armor, uint32 health, uint32 /*maxhealth*/, Unit* target) - { - float unimportant_dist = (aiType == AI_TYPE_MELEE ? 5.0f : 25.0f); - if (dist > unimportant_dist) dist -= unimportant_dist; else dist = 0.0f; - const float dist_factor = (aiType == AI_TYPE_MELEE ? 15.0f : 25.0f); - float mod_dist = dist_factor/(dist_factor + dist); // 0.2 .. 1.0 - float mod_health = health > 20000 ? 2.0f : (40000-health)/10000.0f; // 2.0 .. 4.0 - float mod_armor = aiType == AI_TYPE_MELEE ? Unit::CalcArmorReducedDamage(me, target, 10000, NULL)/10000.0f : 1.0f; - return mod_dist * mod_health * mod_armor; - } + float GetThreatMod(float dist, float armor, uint32 health, uint32 /*maxhealth*/, Unit* target) + { + float unimportant_dist = (aiType == AI_TYPE_MELEE ? 5.0f : 25.0f); + if (dist > unimportant_dist) dist -= unimportant_dist; else dist = 0.0f; + const float dist_factor = (aiType == AI_TYPE_MELEE ? 15.0f : 25.0f); + float mod_dist = dist_factor/(dist_factor + dist); // 0.2 .. 1.0 + float mod_health = health > 20000 ? 2.0f : (40000-health)/10000.0f; // 2.0 .. 4.0 + float mod_armor = aiType == AI_TYPE_MELEE ? Unit::CalcArmorReducedDamage(me, target, 10000, NULL)/10000.0f : 1.0f; + return mod_dist * mod_health * mod_armor; + } - void RecalculateThreat() - { - ThreatContainer::StorageType const& tList = me->getThreatManager().getThreatList(); - for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr ) - { - Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); - if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->getThreatManager().getThreat(pUnit) ) - { - float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit); - me->getThreatManager().modifyThreatPercent(pUnit, -100); - if (HostileReference* ref = me->getThreatManager().getOnlineContainer().getReferenceByTarget(pUnit)) - ref->addThreat(10000000.0f * threatMod); - } - } - } + void RecalculateThreat() + { + ThreatContainer::StorageType const& tList = me->getThreatManager().getThreatList(); + for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr ) + { + Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); + if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->getThreatManager().getThreat(pUnit) ) + { + float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit); + me->getThreatManager().modifyThreatPercent(pUnit, -100); + if (HostileReference* ref = me->getThreatManager().getOnlineContainer().getReferenceByTarget(pUnit)) + ref->addThreat(10000000.0f * threatMod); + } + } + } void Reset() { - events.Reset(); - summons.DespawnAll(); - actualEventId = 0; + events.Reset(); + summons.DespawnAll(); + actualEventId = 0; + } + + void JustSummoned(Creature* summon) + { + summons.Summon(summon); } - - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } - void EnterEvadeMode() - { - if (Creature* delrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_DELRISSA))) - if (!delrissa->IsAlive()) - { - delrissa->Respawn(); - return; - } - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + if (Creature* delrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_DELRISSA))) + if (!delrissa->IsAlive()) + { + delrissa->Respawn(); + return; + } + ScriptedAI::EnterEvadeMode(); + } void EnterCombat(Unit* who) { if (Creature* delrissa = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_DELRISSA))) - if (delrissa->IsAlive() && !delrissa->IsInCombat()) - delrissa->AI()->AttackStart(who); + if (delrissa->IsAlive() && !delrissa->IsInCombat()) + delrissa->AI()->AttackStart(who); - events.ScheduleEvent(EVENT_SPELL_HELPER_HEALING_POTION, 1000); - events.ScheduleEvent(EVENT_HELPER_RESET_THREAT, urand(8000, 10000)); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_HELPER_IMMUNITY, 2000, 1); + events.ScheduleEvent(EVENT_SPELL_HELPER_HEALING_POTION, 1000); + events.ScheduleEvent(EVENT_HELPER_RESET_THREAT, urand(8000, 10000)); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_HELPER_IMMUNITY, 2000, 1); - RecalculateThreat(); + RecalculateThreat(); } void JustDied(Unit* /*killer*/) { - summons.DespawnAll(); + summons.DespawnAll(); } void KilledUnit(Unit* victim) @@ -341,45 +341,45 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI delrissa->AI()->KilledUnit(victim); } - void AttackStart(Unit* victim) - { - if (victim && me->Attack(victim, true)) - me->GetMotionMaster()->MoveChase(victim, aiType == AI_TYPE_MELEE ? 0.0f : 20.0f); - } - - void UpdateAI(uint32 diff) + void AttackStart(Unit* victim) { - actualEventId = 0; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (victim && me->Attack(victim, true)) + me->GetMotionMaster()->MoveChase(victim, aiType == AI_TYPE_MELEE ? 0.0f : 20.0f); + } - actualEventId = events.ExecuteEvent(); - switch (actualEventId) - { - case EVENT_SPELL_HELPER_IMMUNITY: - if (me->HasUnitState(UNIT_STATE_LOST_CONTROL)) - { - me->CastSpell(me, SPELL_MEDALION_OF_IMMUNITY, false); - events.ScheduleEvent(EVENT_SPELL_HELPER_IMMUNITY, 60000); - } - else - events.ScheduleEvent(EVENT_SPELL_HELPER_IMMUNITY, 1000); - break; - case EVENT_SPELL_HELPER_HEALING_POTION: - if (me->HealthBelowPct(25)) - { - me->CastSpell(me, SPELL_HEALING_POTION, false); - break; - } - events.ScheduleEvent(EVENT_SPELL_HELPER_HEALING_POTION, 1000); - break; - case EVENT_HELPER_RESET_THREAT: - RecalculateThreat(); - events.ScheduleEvent(EVENT_HELPER_RESET_THREAT, urand(8000, 10000)); - break; + void UpdateAI(uint32 diff) + { + actualEventId = 0; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - } + actualEventId = events.ExecuteEvent(); + switch (actualEventId) + { + case EVENT_SPELL_HELPER_IMMUNITY: + if (me->HasUnitState(UNIT_STATE_LOST_CONTROL)) + { + me->CastSpell(me, SPELL_MEDALION_OF_IMMUNITY, false); + events.ScheduleEvent(EVENT_SPELL_HELPER_IMMUNITY, 60000); + } + else + events.ScheduleEvent(EVENT_SPELL_HELPER_IMMUNITY, 1000); + break; + case EVENT_SPELL_HELPER_HEALING_POTION: + if (me->HealthBelowPct(25)) + { + me->CastSpell(me, SPELL_HEALING_POTION, false); + break; + } + events.ScheduleEvent(EVENT_SPELL_HELPER_HEALING_POTION, 1000); + break; + case EVENT_HELPER_RESET_THREAT: + RecalculateThreat(); + events.ScheduleEvent(EVENT_HELPER_RESET_THREAT, urand(8000, 10000)); + break; + + } } }; @@ -390,15 +390,15 @@ enum RogueEnum SPELL_GOUGE = 12540, SPELL_KICK = 27613, SPELL_BACKSTAB_N = 15657, - SPELL_BACKSTAB_H = 15582, + SPELL_BACKSTAB_H = 15582, SPELL_EVISCERATE_N = 27611, - SPELL_EVISCERATE_H = 46189, + SPELL_EVISCERATE_H = 46189, - EVENT_SPELL_GOUGE = 1, - EVENT_SPELL_KICK = 2, - EVENT_SPELL_VANISH = 3, - EVENT_SPELL_EVISCERATE = 4, - EVENT_SPELL_BACKSTAB = 5, + EVENT_SPELL_GOUGE = 1, + EVENT_SPELL_KICK = 2, + EVENT_SPELL_VANISH = 3, + EVENT_SPELL_EVISCERATE = 4, + EVENT_SPELL_BACKSTAB = 5, }; class boss_kagani_nightstrike : public CreatureScript @@ -415,22 +415,22 @@ public: { boss_kagani_nightstrikeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature, AI_TYPE_MELEE) { } - void EnterCombat(Unit* who) - { - boss_priestess_lackey_commonAI::EnterCombat(who); + void EnterCombat(Unit* who) + { + boss_priestess_lackey_commonAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_GOUGE, 5500); - events.ScheduleEvent(EVENT_SPELL_KICK, 9000); - events.ScheduleEvent(EVENT_SPELL_VANISH, 200); - events.ScheduleEvent(EVENT_SPELL_EVISCERATE, 6000); - events.ScheduleEvent(EVENT_SPELL_BACKSTAB, 4000); - } + events.ScheduleEvent(EVENT_SPELL_GOUGE, 5500); + events.ScheduleEvent(EVENT_SPELL_KICK, 9000); + events.ScheduleEvent(EVENT_SPELL_VANISH, 200); + events.ScheduleEvent(EVENT_SPELL_EVISCERATE, 6000); + events.ScheduleEvent(EVENT_SPELL_BACKSTAB, 4000); + } - void MovementInform(uint32 type, uint32 point) - { - if (type == CHASE_MOTION_TYPE && me->HasAura(SPELL_VANISH) && me->GetVictim()) - me->CastSpell(me->GetVictim(), SPELL_KIDNEY_SHOT, false); - } + void MovementInform(uint32 type, uint32 point) + { + if (type == CHASE_MOTION_TYPE && me->HasAura(SPELL_VANISH) && me->GetVictim()) + me->CastSpell(me->GetVictim(), SPELL_KIDNEY_SHOT, false); + } void UpdateAI(uint32 diff) { @@ -439,43 +439,43 @@ public: boss_priestess_lackey_commonAI::UpdateAI(diff); - switch (actualEventId) - { - case EVENT_SPELL_VANISH: - me->CastSpell(me, SPELL_VANISH, false); - DoResetThreat(); - if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->AddThreat(unit, 1000.0f); + switch (actualEventId) + { + case EVENT_SPELL_VANISH: + me->CastSpell(me, SPELL_VANISH, false); + DoResetThreat(); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->AddThreat(unit, 1000.0f); - events.ScheduleEvent(EVENT_SPELL_VANISH, 30000); - break; - case EVENT_SPELL_GOUGE: - me->CastSpell(me->GetVictim(), SPELL_GOUGE, false); - events.ScheduleEvent(EVENT_SPELL_GOUGE, 15000); - break; - case EVENT_SPELL_KICK: - if (me->GetVictim()->HasUnitState(UNIT_STATE_CASTING)) - { - me->CastSpell(me->GetVictim(), SPELL_KICK, false); - events.ScheduleEvent(EVENT_SPELL_KICK, 15000); - } - else - events.ScheduleEvent(EVENT_SPELL_KICK, 1000); - break; - case EVENT_SPELL_EVISCERATE: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_EVISCERATE_N, SPELL_EVISCERATE_H), false); - events.ScheduleEvent(EVENT_SPELL_EVISCERATE, 10000); - break; - case EVENT_SPELL_BACKSTAB: - if (!me->GetVictim()->HasInArc(static_cast(M_PI), me)) - { - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_BACKSTAB_N, SPELL_BACKSTAB_H), false); - events.ScheduleEvent(EVENT_SPELL_BACKSTAB, 5000); - } - else - events.ScheduleEvent(EVENT_SPELL_BACKSTAB, 1000); - break; - } + events.ScheduleEvent(EVENT_SPELL_VANISH, 30000); + break; + case EVENT_SPELL_GOUGE: + me->CastSpell(me->GetVictim(), SPELL_GOUGE, false); + events.ScheduleEvent(EVENT_SPELL_GOUGE, 15000); + break; + case EVENT_SPELL_KICK: + if (me->GetVictim()->HasUnitState(UNIT_STATE_CASTING)) + { + me->CastSpell(me->GetVictim(), SPELL_KICK, false); + events.ScheduleEvent(EVENT_SPELL_KICK, 15000); + } + else + events.ScheduleEvent(EVENT_SPELL_KICK, 1000); + break; + case EVENT_SPELL_EVISCERATE: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_EVISCERATE_N, SPELL_EVISCERATE_H), false); + events.ScheduleEvent(EVENT_SPELL_EVISCERATE, 10000); + break; + case EVENT_SPELL_BACKSTAB: + if (!me->GetVictim()->HasInArc(static_cast(M_PI), me)) + { + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_BACKSTAB_N, SPELL_BACKSTAB_H), false); + events.ScheduleEvent(EVENT_SPELL_BACKSTAB, 5000); + } + else + events.ScheduleEvent(EVENT_SPELL_BACKSTAB, 1000); + break; + } DoMeleeAttackIfReady(); } @@ -484,21 +484,21 @@ public: enum WarlockEnum { - SPELL_IMMOLATE_N = 44267, - SPELL_IMMOLATE_H = 46191, - SPELL_SHADOW_BOLT_N = 12471, - SPELL_SHADOW_BOLT_H = 15232, - SPELL_CURSE_OF_AGONY_N = 14875, - SPELL_CURSE_OF_AGONY_H = 46190, + SPELL_IMMOLATE_N = 44267, + SPELL_IMMOLATE_H = 46191, + SPELL_SHADOW_BOLT_N = 12471, + SPELL_SHADOW_BOLT_H = 15232, + SPELL_CURSE_OF_AGONY_N = 14875, + SPELL_CURSE_OF_AGONY_H = 46190, SPELL_SEED_OF_CORRUPTION = 44141, SPELL_FEAR = 38595, SPELL_SUMMON_IMP = 44163, - EVENT_SPELL_IMMOLATE = 1, - EVENT_SPELL_SHADOW_BOLT = 2, - EVENT_SPELL_SEED_OF_CORRUPTION= 3, - EVENT_SPELL_CURSE_OF_AGONY = 4, - EVENT_SPELL_FEAR = 5, + EVENT_SPELL_IMMOLATE = 1, + EVENT_SPELL_SHADOW_BOLT = 2, + EVENT_SPELL_SEED_OF_CORRUPTION= 3, + EVENT_SPELL_CURSE_OF_AGONY = 4, + EVENT_SPELL_FEAR = 5, }; class boss_ellris_duskhallow : public CreatureScript @@ -519,13 +519,13 @@ public: void EnterCombat(Unit* who) { me->CastSpell(me, SPELL_SUMMON_IMP, false); - boss_priestess_lackey_commonAI::EnterCombat(who); + boss_priestess_lackey_commonAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_IMMOLATE, 3000); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 1000); - events.ScheduleEvent(EVENT_SPELL_SEED_OF_CORRUPTION, 10000); - events.ScheduleEvent(EVENT_SPELL_CURSE_OF_AGONY, 6000); - events.ScheduleEvent(EVENT_SPELL_FEAR, 15000); + events.ScheduleEvent(EVENT_SPELL_IMMOLATE, 3000); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 1000); + events.ScheduleEvent(EVENT_SPELL_SEED_OF_CORRUPTION, 10000); + events.ScheduleEvent(EVENT_SPELL_CURSE_OF_AGONY, 6000); + events.ScheduleEvent(EVENT_SPELL_FEAR, 15000); } void UpdateAI(uint32 diff) @@ -535,33 +535,33 @@ public: boss_priestess_lackey_commonAI::UpdateAI(diff); - switch (actualEventId) - { - case EVENT_SPELL_IMMOLATE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) - me->CastSpell(target, DUNGEON_MODE(SPELL_IMMOLATE_N, SPELL_IMMOLATE_H), false); - events.ScheduleEvent(EVENT_SPELL_IMMOLATE, 12000); - break; - case EVENT_SPELL_SHADOW_BOLT: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_SHADOW_BOLT_N, SPELL_SHADOW_BOLT_H), false); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 5000); - break; - case EVENT_SPELL_SEED_OF_CORRUPTION: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) - me->CastSpell(target, SPELL_SEED_OF_CORRUPTION, false); - events.ScheduleEvent(EVENT_SPELL_SEED_OF_CORRUPTION, 18000); - break; - case EVENT_SPELL_CURSE_OF_AGONY: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) - me->CastSpell(target, DUNGEON_MODE(SPELL_CURSE_OF_AGONY_N, SPELL_CURSE_OF_AGONY_H), false); - events.ScheduleEvent(EVENT_SPELL_CURSE_OF_AGONY, 13000); - break; - case EVENT_SPELL_FEAR: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f)) - me->CastSpell(target, SPELL_FEAR, false); - events.ScheduleEvent(EVENT_SPELL_FEAR, 15000); - break; - } + switch (actualEventId) + { + case EVENT_SPELL_IMMOLATE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) + me->CastSpell(target, DUNGEON_MODE(SPELL_IMMOLATE_N, SPELL_IMMOLATE_H), false); + events.ScheduleEvent(EVENT_SPELL_IMMOLATE, 12000); + break; + case EVENT_SPELL_SHADOW_BOLT: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_SHADOW_BOLT_N, SPELL_SHADOW_BOLT_H), false); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 5000); + break; + case EVENT_SPELL_SEED_OF_CORRUPTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) + me->CastSpell(target, SPELL_SEED_OF_CORRUPTION, false); + events.ScheduleEvent(EVENT_SPELL_SEED_OF_CORRUPTION, 18000); + break; + case EVENT_SPELL_CURSE_OF_AGONY: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) + me->CastSpell(target, DUNGEON_MODE(SPELL_CURSE_OF_AGONY_N, SPELL_CURSE_OF_AGONY_H), false); + events.ScheduleEvent(EVENT_SPELL_CURSE_OF_AGONY, 13000); + break; + case EVENT_SPELL_FEAR: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f)) + me->CastSpell(target, SPELL_FEAR, false); + events.ScheduleEvent(EVENT_SPELL_FEAR, 15000); + break; + } DoMeleeAttackIfReady(); } @@ -570,14 +570,14 @@ public: enum MonkEnum { - SPELL_KNOCKDOWN_N = 11428, - SPELL_KNOCKDOWN_H = 46183, - SPELL_SNAP_KICK = 46182, - SPELL_FISTS_OF_ARCANE = 44120, + SPELL_KNOCKDOWN_N = 11428, + SPELL_KNOCKDOWN_H = 46183, + SPELL_SNAP_KICK = 46182, + SPELL_FISTS_OF_ARCANE = 44120, - EVENT_SPELL_KNOCKDOWN = 1, - EVENT_SPELL_SNAP_KICK = 2, - EVENT_SPELL_FISTS = 3, + EVENT_SPELL_KNOCKDOWN = 1, + EVENT_SPELL_SNAP_KICK = 2, + EVENT_SPELL_FISTS = 3, }; class boss_eramas_brightblaze : public CreatureScript @@ -594,14 +594,14 @@ public: { boss_eramas_brightblazeAI(Creature* creature) : boss_priestess_lackey_commonAI(creature, AI_TYPE_MELEE) { } - void EnterCombat(Unit* who) - { - boss_priestess_lackey_commonAI::EnterCombat(who); + void EnterCombat(Unit* who) + { + boss_priestess_lackey_commonAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 6000); - events.ScheduleEvent(EVENT_SPELL_SNAP_KICK, 3000); - events.ScheduleEvent(EVENT_SPELL_FISTS, 0); - } + events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 6000); + events.ScheduleEvent(EVENT_SPELL_SNAP_KICK, 3000); + events.ScheduleEvent(EVENT_SPELL_FISTS, 0); + } void UpdateAI(uint32 diff) { @@ -610,21 +610,21 @@ public: boss_priestess_lackey_commonAI::UpdateAI(diff); - switch (actualEventId) - { - case EVENT_SPELL_KNOCKDOWN: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_KNOCKDOWN_N, SPELL_KNOCKDOWN_H), false); - events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 10000); - break; - case EVENT_SPELL_SNAP_KICK: - me->CastSpell(me->GetVictim(), SPELL_SNAP_KICK, false); - events.ScheduleEvent(EVENT_SPELL_SNAP_KICK, 10000); - break; - case EVENT_SPELL_FISTS: - me->CastSpell(me->GetVictim(), SPELL_FISTS_OF_ARCANE, false); - events.ScheduleEvent(EVENT_SPELL_FISTS, 10000); - break; - } + switch (actualEventId) + { + case EVENT_SPELL_KNOCKDOWN: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_KNOCKDOWN_N, SPELL_KNOCKDOWN_H), false); + events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 10000); + break; + case EVENT_SPELL_SNAP_KICK: + me->CastSpell(me->GetVictim(), SPELL_SNAP_KICK, false); + events.ScheduleEvent(EVENT_SPELL_SNAP_KICK, 10000); + break; + case EVENT_SPELL_FISTS: + me->CastSpell(me->GetVictim(), SPELL_FISTS_OF_ARCANE, false); + events.ScheduleEvent(EVENT_SPELL_FISTS, 10000); + break; + } DoMeleeAttackIfReady(); } @@ -635,23 +635,23 @@ enum MageEnum { SPELL_POLYMORPH = 13323, SPELL_ICE_BLOCK = 27619, - SPELL_BLIZZARD_N = 44178, - SPELL_BLIZZARD_H = 46195, - SPELL_ICE_LANCE_N = 44176, - SPELL_ICE_LANCE_H = 46194, - SPELL_CONE_OF_COLD_N = 38384, - SPELL_CONE_OF_COLD_H = 12611, - SPELL_FROSTBOLT_N = 15043, - SPELL_FROSTBOLT_H = 15530, + SPELL_BLIZZARD_N = 44178, + SPELL_BLIZZARD_H = 46195, + SPELL_ICE_LANCE_N = 44176, + SPELL_ICE_LANCE_H = 46194, + SPELL_CONE_OF_COLD_N = 38384, + SPELL_CONE_OF_COLD_H = 12611, + SPELL_FROSTBOLT_N = 15043, + SPELL_FROSTBOLT_H = 15530, SPELL_BLINK = 14514, - EVENT_SPELL_POLYMORPH = 1, - EVENT_SPELL_ICE_BLOCK = 2, - EVENT_SPELL_BLIZZARD = 3, - EVENT_SPELL_ICE_LANCE = 4, - EVENT_SPELL_COC = 5, - EVENT_SPELL_FROSTBOLT = 6, - EVENT_SPELL_BLINK = 7 + EVENT_SPELL_POLYMORPH = 1, + EVENT_SPELL_ICE_BLOCK = 2, + EVENT_SPELL_BLIZZARD = 3, + EVENT_SPELL_ICE_LANCE = 4, + EVENT_SPELL_COC = 5, + EVENT_SPELL_FROSTBOLT = 6, + EVENT_SPELL_BLINK = 7 }; class boss_yazzai : public CreatureScript @@ -668,17 +668,17 @@ public: { boss_yazzaiAI(Creature* creature) : boss_priestess_lackey_commonAI(creature, AI_TYPE_RANGED) { } - void EnterCombat(Unit* who) - { + void EnterCombat(Unit* who) + { boss_priestess_lackey_commonAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_POLYMORPH, 1000); - events.ScheduleEvent(EVENT_SPELL_ICE_BLOCK, 1000); - events.ScheduleEvent(EVENT_SPELL_BLIZZARD, 8000); - events.ScheduleEvent(EVENT_SPELL_ICE_LANCE, 12000); - events.ScheduleEvent(EVENT_SPELL_COC, 10000); - events.ScheduleEvent(EVENT_SPELL_FROSTBOLT, 3000); - events.ScheduleEvent(EVENT_SPELL_BLINK, 5000); + events.ScheduleEvent(EVENT_SPELL_POLYMORPH, 1000); + events.ScheduleEvent(EVENT_SPELL_ICE_BLOCK, 1000); + events.ScheduleEvent(EVENT_SPELL_BLIZZARD, 8000); + events.ScheduleEvent(EVENT_SPELL_ICE_LANCE, 12000); + events.ScheduleEvent(EVENT_SPELL_COC, 10000); + events.ScheduleEvent(EVENT_SPELL_FROSTBOLT, 3000); + events.ScheduleEvent(EVENT_SPELL_BLINK, 5000); } void UpdateAI(uint32 diff) @@ -688,56 +688,56 @@ public: boss_priestess_lackey_commonAI::UpdateAI(diff); - switch (actualEventId) - { - case EVENT_SPELL_POLYMORPH: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_POLYMORPH, false); - events.ScheduleEvent(EVENT_SPELL_POLYMORPH, 20000); - break; - case EVENT_SPELL_ICE_BLOCK: - if (HealthBelowPct(35)) - { - me->CastSpell(me, SPELL_ICE_BLOCK, false); - return; - } - events.ScheduleEvent(EVENT_SPELL_ICE_BLOCK, 1000); - break; - case EVENT_SPELL_BLIZZARD: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, DUNGEON_MODE(SPELL_BLIZZARD_N, SPELL_BLIZZARD_H), false); - events.ScheduleEvent(EVENT_SPELL_BLIZZARD, 20000); - break; - case EVENT_SPELL_ICE_LANCE: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_ICE_LANCE_N, SPELL_ICE_LANCE_H), false); - events.ScheduleEvent(EVENT_SPELL_ICE_LANCE, 12000); - break; - case EVENT_SPELL_COC: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_CONE_OF_COLD_N, SPELL_CONE_OF_COLD_H), false); - events.ScheduleEvent(EVENT_SPELL_COC, 10000); - break; - case EVENT_SPELL_FROSTBOLT: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_FROSTBOLT_N, SPELL_FROSTBOLT_H), false); - events.ScheduleEvent(EVENT_SPELL_FROSTBOLT, 8000); - break; - case EVENT_SPELL_BLINK: - { - bool InMeleeRange = false; - ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList(); - for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) - if (target->IsWithinMeleeRange(me)) - { - InMeleeRange = true; - break; - } + switch (actualEventId) + { + case EVENT_SPELL_POLYMORPH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_POLYMORPH, false); + events.ScheduleEvent(EVENT_SPELL_POLYMORPH, 20000); + break; + case EVENT_SPELL_ICE_BLOCK: + if (HealthBelowPct(35)) + { + me->CastSpell(me, SPELL_ICE_BLOCK, false); + return; + } + events.ScheduleEvent(EVENT_SPELL_ICE_BLOCK, 1000); + break; + case EVENT_SPELL_BLIZZARD: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, DUNGEON_MODE(SPELL_BLIZZARD_N, SPELL_BLIZZARD_H), false); + events.ScheduleEvent(EVENT_SPELL_BLIZZARD, 20000); + break; + case EVENT_SPELL_ICE_LANCE: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_ICE_LANCE_N, SPELL_ICE_LANCE_H), false); + events.ScheduleEvent(EVENT_SPELL_ICE_LANCE, 12000); + break; + case EVENT_SPELL_COC: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_CONE_OF_COLD_N, SPELL_CONE_OF_COLD_H), false); + events.ScheduleEvent(EVENT_SPELL_COC, 10000); + break; + case EVENT_SPELL_FROSTBOLT: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_FROSTBOLT_N, SPELL_FROSTBOLT_H), false); + events.ScheduleEvent(EVENT_SPELL_FROSTBOLT, 8000); + break; + case EVENT_SPELL_BLINK: + { + bool InMeleeRange = false; + ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList(); + for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) + if (target->IsWithinMeleeRange(me)) + { + InMeleeRange = true; + break; + } - if (InMeleeRange) - me->CastSpell(me, SPELL_BLINK, false); - events.ScheduleEvent(EVENT_SPELL_BLINK, 15000); - break; - } - } + if (InMeleeRange) + me->CastSpell(me, SPELL_BLINK, false); + events.ScheduleEvent(EVENT_SPELL_BLINK, 15000); + break; + } + } DoMeleeAttackIfReady(); } @@ -746,7 +746,7 @@ public: enum WarriorEnum { - SPELL_INTERCEPT = 27577, + SPELL_INTERCEPT = 27577, SPELL_DISARM = 27581, SPELL_PIERCING_HOWL = 23600, SPELL_FRIGHTENING_SHOUT = 19134, @@ -754,12 +754,12 @@ enum WarriorEnum SPELL_BATTLE_SHOUT = 27578, SPELL_MORTAL_STRIKE = 44268, - EVENT_SPELL_DISARM = 1, - EVENT_SPELL_PIERCING_HOWL = 2, - EVENT_SPELL_SHOUT = 3, - EVENT_SPELL_HAMSTRING = 4, - EVENT_SPELL_MORTAL_STRIKE = 5, - EVENT_SPELL_INTERCEPT = 6, + EVENT_SPELL_DISARM = 1, + EVENT_SPELL_PIERCING_HOWL = 2, + EVENT_SPELL_SHOUT = 3, + EVENT_SPELL_HAMSTRING = 4, + EVENT_SPELL_MORTAL_STRIKE = 5, + EVENT_SPELL_INTERCEPT = 6, }; class boss_warlord_salaris : public CreatureScript @@ -781,12 +781,12 @@ public: boss_priestess_lackey_commonAI::EnterCombat(who); me->CastSpell(me, SPELL_BATTLE_SHOUT, false); - events.ScheduleEvent(EVENT_SPELL_DISARM, 6000); - events.ScheduleEvent(EVENT_SPELL_PIERCING_HOWL, 10000); - events.ScheduleEvent(EVENT_SPELL_SHOUT, 18000); - events.ScheduleEvent(EVENT_SPELL_HAMSTRING, 4000); - events.ScheduleEvent(EVENT_SPELL_MORTAL_STRIKE, 8000); - events.ScheduleEvent(EVENT_SPELL_INTERCEPT, 1000); + events.ScheduleEvent(EVENT_SPELL_DISARM, 6000); + events.ScheduleEvent(EVENT_SPELL_PIERCING_HOWL, 10000); + events.ScheduleEvent(EVENT_SPELL_SHOUT, 18000); + events.ScheduleEvent(EVENT_SPELL_HAMSTRING, 4000); + events.ScheduleEvent(EVENT_SPELL_MORTAL_STRIKE, 8000); + events.ScheduleEvent(EVENT_SPELL_INTERCEPT, 1000); } void UpdateAI(uint32 diff) @@ -796,33 +796,33 @@ public: boss_priestess_lackey_commonAI::UpdateAI(diff); - switch (actualEventId) - { - case EVENT_SPELL_INTERCEPT: - me->CastSpell(me->GetVictim(), SPELL_INTERCEPT, false); - events.ScheduleEvent(EVENT_SPELL_INTERCEPT, 10000); - break; - case EVENT_SPELL_DISARM: - me->CastSpell(me->GetVictim(), SPELL_DISARM, false); - events.ScheduleEvent(EVENT_SPELL_DISARM, 16000); - break; - case EVENT_SPELL_HAMSTRING: - me->CastSpell(me->GetVictim(), SPELL_HAMSTRING, false); - events.ScheduleEvent(EVENT_SPELL_HAMSTRING, 15000); - break; - case EVENT_SPELL_MORTAL_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); - events.ScheduleEvent(EVENT_SPELL_MORTAL_STRIKE, 10000); - break; - case EVENT_SPELL_PIERCING_HOWL: - me->CastSpell(me, SPELL_PIERCING_HOWL, false); - events.ScheduleEvent(EVENT_SPELL_PIERCING_HOWL, 15000); - break; - case EVENT_SPELL_SHOUT: - me->CastSpell(me, SPELL_FRIGHTENING_SHOUT, false); - events.ScheduleEvent(EVENT_SPELL_SHOUT, 18000); - break; - } + switch (actualEventId) + { + case EVENT_SPELL_INTERCEPT: + me->CastSpell(me->GetVictim(), SPELL_INTERCEPT, false); + events.ScheduleEvent(EVENT_SPELL_INTERCEPT, 10000); + break; + case EVENT_SPELL_DISARM: + me->CastSpell(me->GetVictim(), SPELL_DISARM, false); + events.ScheduleEvent(EVENT_SPELL_DISARM, 16000); + break; + case EVENT_SPELL_HAMSTRING: + me->CastSpell(me->GetVictim(), SPELL_HAMSTRING, false); + events.ScheduleEvent(EVENT_SPELL_HAMSTRING, 15000); + break; + case EVENT_SPELL_MORTAL_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); + events.ScheduleEvent(EVENT_SPELL_MORTAL_STRIKE, 10000); + break; + case EVENT_SPELL_PIERCING_HOWL: + me->CastSpell(me, SPELL_PIERCING_HOWL, false); + events.ScheduleEvent(EVENT_SPELL_PIERCING_HOWL, 15000); + break; + case EVENT_SPELL_SHOUT: + me->CastSpell(me, SPELL_FRIGHTENING_SHOUT, false); + events.ScheduleEvent(EVENT_SPELL_SHOUT, 18000); + break; + } DoMeleeAttackIfReady(); } @@ -832,8 +832,8 @@ public: enum HunterEnum { SPELL_AIMED_SHOT = 44271, - SPELL_SHOOT_N = 15620, - SPELL_SHOOT_H = 22907, + SPELL_SHOOT_N = 15620, + SPELL_SHOOT_H = 22907, SPELL_CONCUSSIVE_SHOT = 27634, SPELL_MULTI_SHOT = 31942, SPELL_WING_CLIP = 44286, @@ -841,11 +841,11 @@ enum HunterEnum NPC_SLIVER = 24552, - EVENT_SPELL_AIMED_SHOT = 1, - EVENT_SPELL_SHOOT = 2, - EVENT_SPELL_CONCUSSIVE_SHOT = 3, - EVENT_SPELL_MULTI_SHOT = 4, - EVENT_SPELL_WING_CLIP = 5 + EVENT_SPELL_AIMED_SHOT = 1, + EVENT_SPELL_SHOOT = 2, + EVENT_SPELL_CONCUSSIVE_SHOT = 3, + EVENT_SPELL_MULTI_SHOT = 4, + EVENT_SPELL_WING_CLIP = 5 }; class boss_garaxxas : public CreatureScript @@ -868,17 +868,17 @@ public: me->SummonCreature(NPC_SLIVER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); } - void EnterCombat(Unit* who) - { - boss_priestess_lackey_commonAI::EnterCombat(who); - me->CastSpell(me, SPELL_FREEZING_TRAP, true); + void EnterCombat(Unit* who) + { + boss_priestess_lackey_commonAI::EnterCombat(who); + me->CastSpell(me, SPELL_FREEZING_TRAP, true); - events.ScheduleEvent(EVENT_SPELL_AIMED_SHOT, 8000); - events.ScheduleEvent(EVENT_SPELL_SHOOT, 0); - events.ScheduleEvent(EVENT_SPELL_CONCUSSIVE_SHOT, 6000); - events.ScheduleEvent(EVENT_SPELL_MULTI_SHOT, 10000); - events.ScheduleEvent(EVENT_SPELL_WING_CLIP, 4000); - } + events.ScheduleEvent(EVENT_SPELL_AIMED_SHOT, 8000); + events.ScheduleEvent(EVENT_SPELL_SHOOT, 0); + events.ScheduleEvent(EVENT_SPELL_CONCUSSIVE_SHOT, 6000); + events.ScheduleEvent(EVENT_SPELL_MULTI_SHOT, 10000); + events.ScheduleEvent(EVENT_SPELL_WING_CLIP, 4000); + } void UpdateAI(uint32 diff) { @@ -887,31 +887,31 @@ public: boss_priestess_lackey_commonAI::UpdateAI(diff); - switch (actualEventId) - { - case EVENT_SPELL_WING_CLIP: - me->CastSpell(me->GetVictim(), SPELL_WING_CLIP, false); - events.ScheduleEvent(EVENT_SPELL_WING_CLIP, 4000); - break; - case EVENT_SPELL_AIMED_SHOT: - me->CastSpell(me->GetVictim(), SPELL_AIMED_SHOT, false); - events.ScheduleEvent(EVENT_SPELL_AIMED_SHOT, 15000); - break; - case EVENT_SPELL_CONCUSSIVE_SHOT: - me->CastSpell(me->GetVictim(), SPELL_CONCUSSIVE_SHOT, false); - events.ScheduleEvent(EVENT_SPELL_CONCUSSIVE_SHOT, 15000); - break; - case EVENT_SPELL_MULTI_SHOT: - me->CastSpell(me->GetVictim(), SPELL_MULTI_SHOT, false); - events.ScheduleEvent(EVENT_SPELL_MULTI_SHOT, 10000); - break; - case EVENT_SPELL_SHOOT: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_SHOOT_N, SPELL_SHOOT_H), false); - events.ScheduleEvent(EVENT_SPELL_SHOOT, 2500); - break; - } + switch (actualEventId) + { + case EVENT_SPELL_WING_CLIP: + me->CastSpell(me->GetVictim(), SPELL_WING_CLIP, false); + events.ScheduleEvent(EVENT_SPELL_WING_CLIP, 4000); + break; + case EVENT_SPELL_AIMED_SHOT: + me->CastSpell(me->GetVictim(), SPELL_AIMED_SHOT, false); + events.ScheduleEvent(EVENT_SPELL_AIMED_SHOT, 15000); + break; + case EVENT_SPELL_CONCUSSIVE_SHOT: + me->CastSpell(me->GetVictim(), SPELL_CONCUSSIVE_SHOT, false); + events.ScheduleEvent(EVENT_SPELL_CONCUSSIVE_SHOT, 15000); + break; + case EVENT_SPELL_MULTI_SHOT: + me->CastSpell(me->GetVictim(), SPELL_MULTI_SHOT, false); + events.ScheduleEvent(EVENT_SPELL_MULTI_SHOT, 10000); + break; + case EVENT_SPELL_SHOOT: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_SHOOT_N, SPELL_SHOOT_H), false); + events.ScheduleEvent(EVENT_SPELL_SHOOT, 2500); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; }; @@ -923,18 +923,18 @@ enum ShamanEnum SPELL_EARTHBIND_TOTEM = 15786, SPELL_WAR_STOMP = 46026, SPELL_PURGE = 27626, - SPELL_LESSER_HEALING_WAVE_N = 44256, - SPELL_LESSER_HEALING_WAVE_H = 46181, - SPELL_FROST_SHOCK_N = 21401, - SPELL_FROST_SHOCK_H = 46180, + SPELL_LESSER_HEALING_WAVE_N = 44256, + SPELL_LESSER_HEALING_WAVE_H = 46181, + SPELL_FROST_SHOCK_N = 21401, + SPELL_FROST_SHOCK_H = 46180, - EVENT_SPELL_TOTEM1 = 1, - EVENT_SPELL_TOTEM2 = 2, - EVENT_SPELL_TOTEM3 = 3, - EVENT_SPELL_WAR_STOMP = 4, - EVENT_SPELL_PURGE = 5, - EVENT_SPELL_HEALING_WAVE = 6, - EVENT_SPELL_FROST_SHOCK = 7 + EVENT_SPELL_TOTEM1 = 1, + EVENT_SPELL_TOTEM2 = 2, + EVENT_SPELL_TOTEM3 = 3, + EVENT_SPELL_WAR_STOMP = 4, + EVENT_SPELL_PURGE = 5, + EVENT_SPELL_HEALING_WAVE = 6, + EVENT_SPELL_FROST_SHOCK = 7 }; class boss_apoko : public CreatureScript @@ -962,13 +962,13 @@ public: { boss_priestess_lackey_commonAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_TOTEM1, 2000); - events.ScheduleEvent(EVENT_SPELL_TOTEM2, 4000); - events.ScheduleEvent(EVENT_SPELL_TOTEM3, 6000); - events.ScheduleEvent(EVENT_SPELL_WAR_STOMP, 10000); - events.ScheduleEvent(EVENT_SPELL_PURGE, 14000); - events.ScheduleEvent(EVENT_SPELL_HEALING_WAVE, 12000); - events.ScheduleEvent(EVENT_SPELL_FROST_SHOCK, 8000); + events.ScheduleEvent(EVENT_SPELL_TOTEM1, 2000); + events.ScheduleEvent(EVENT_SPELL_TOTEM2, 4000); + events.ScheduleEvent(EVENT_SPELL_TOTEM3, 6000); + events.ScheduleEvent(EVENT_SPELL_WAR_STOMP, 10000); + events.ScheduleEvent(EVENT_SPELL_PURGE, 14000); + events.ScheduleEvent(EVENT_SPELL_HEALING_WAVE, 12000); + events.ScheduleEvent(EVENT_SPELL_FROST_SHOCK, 8000); } void UpdateAI(uint32 diff) @@ -978,39 +978,39 @@ public: boss_priestess_lackey_commonAI::UpdateAI(diff); - switch (actualEventId) - { - case EVENT_SPELL_TOTEM1: - me->CastSpell(me, SPELL_WINDFURY_TOTEM, false); - events.ScheduleEvent(EVENT_SPELL_TOTEM1, 20000); - break; - case EVENT_SPELL_TOTEM2: - me->CastSpell(me, SPELL_FIRE_NOVA_TOTEM, false); - events.ScheduleEvent(EVENT_SPELL_TOTEM2, 20000); - break; - case EVENT_SPELL_TOTEM3: - me->CastSpell(me, SPELL_EARTHBIND_TOTEM, false); - events.ScheduleEvent(EVENT_SPELL_TOTEM3, 20000); - break; - case EVENT_SPELL_WAR_STOMP: - me->CastSpell(me, SPELL_WAR_STOMP, false); - events.ScheduleEvent(EVENT_SPELL_WAR_STOMP, 120000); - break; - case EVENT_SPELL_PURGE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) - me->CastSpell(target, SPELL_PURGE, false); - events.ScheduleEvent(EVENT_SPELL_PURGE, 15000); - break; - case EVENT_SPELL_FROST_SHOCK: - me->CastSpell(me, DUNGEON_MODE(SPELL_FROST_SHOCK_N, SPELL_FROST_SHOCK_H), false); - events.ScheduleEvent(EVENT_SPELL_FROST_SHOCK, 12000); - break; - case EVENT_SPELL_HEALING_WAVE: - if (Unit* target = DoSelectLowestHpFriendly(40.0f, 1000)) - me->CastSpell(target, DUNGEON_MODE(SPELL_LESSER_HEALING_WAVE_N, SPELL_LESSER_HEALING_WAVE_H), false); - events.ScheduleEvent(EVENT_SPELL_HEALING_WAVE, 12000); - break; - } + switch (actualEventId) + { + case EVENT_SPELL_TOTEM1: + me->CastSpell(me, SPELL_WINDFURY_TOTEM, false); + events.ScheduleEvent(EVENT_SPELL_TOTEM1, 20000); + break; + case EVENT_SPELL_TOTEM2: + me->CastSpell(me, SPELL_FIRE_NOVA_TOTEM, false); + events.ScheduleEvent(EVENT_SPELL_TOTEM2, 20000); + break; + case EVENT_SPELL_TOTEM3: + me->CastSpell(me, SPELL_EARTHBIND_TOTEM, false); + events.ScheduleEvent(EVENT_SPELL_TOTEM3, 20000); + break; + case EVENT_SPELL_WAR_STOMP: + me->CastSpell(me, SPELL_WAR_STOMP, false); + events.ScheduleEvent(EVENT_SPELL_WAR_STOMP, 120000); + break; + case EVENT_SPELL_PURGE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) + me->CastSpell(target, SPELL_PURGE, false); + events.ScheduleEvent(EVENT_SPELL_PURGE, 15000); + break; + case EVENT_SPELL_FROST_SHOCK: + me->CastSpell(me, DUNGEON_MODE(SPELL_FROST_SHOCK_N, SPELL_FROST_SHOCK_H), false); + events.ScheduleEvent(EVENT_SPELL_FROST_SHOCK, 12000); + break; + case EVENT_SPELL_HEALING_WAVE: + if (Unit* target = DoSelectLowestHpFriendly(40.0f, 1000)) + me->CastSpell(target, DUNGEON_MODE(SPELL_LESSER_HEALING_WAVE_N, SPELL_LESSER_HEALING_WAVE_H), false); + events.ScheduleEvent(EVENT_SPELL_HEALING_WAVE, 12000); + break; + } DoMeleeAttackIfReady(); } @@ -1019,20 +1019,20 @@ public: enum EngineerEnum { - SPELL_GOBLIN_DRAGON_GUN_N = 44272, - SPELL_GOBLIN_DRAGON_GUN_H = 46186, - SPELL_ROCKET_LAUNCH_N = 44137, - SPELL_ROCKET_LAUNCH_H = 46187, - SPELL_FEL_IRON_BOMB_N = 46024, - SPELL_FEL_IRON_BOMB_H = 46184, + SPELL_GOBLIN_DRAGON_GUN_N = 44272, + SPELL_GOBLIN_DRAGON_GUN_H = 46186, + SPELL_ROCKET_LAUNCH_N = 44137, + SPELL_ROCKET_LAUNCH_H = 46187, + SPELL_FEL_IRON_BOMB_N = 46024, + SPELL_FEL_IRON_BOMB_H = 46184, SPELL_RECOMBOBULATE = 44274, SPELL_HIGH_EXPLOSIVE_SHEEP = 44276, - EVENT_SPELL_DRAGON_GUN = 1, - EVENT_SPELL_ROCKET_LAUNCH = 2, - EVENT_SPELL_RECOMBOBULATE = 3, - EVENT_SPELL_EXPLOSIVE_SHEEP = 4, - EVENT_SPELL_IRON_BOMB = 5 + EVENT_SPELL_DRAGON_GUN = 1, + EVENT_SPELL_ROCKET_LAUNCH = 2, + EVENT_SPELL_RECOMBOBULATE = 3, + EVENT_SPELL_EXPLOSIVE_SHEEP = 4, + EVENT_SPELL_IRON_BOMB = 5 }; class boss_zelfan : public CreatureScript @@ -1049,15 +1049,15 @@ public: { boss_zelfanAI(Creature* creature) : boss_priestess_lackey_commonAI(creature, AI_TYPE_RANGED) { } - void EnterCombat(Unit* who) - { + void EnterCombat(Unit* who) + { boss_priestess_lackey_commonAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_DRAGON_GUN, 20000); - events.ScheduleEvent(EVENT_SPELL_ROCKET_LAUNCH, 7000); - events.ScheduleEvent(EVENT_SPELL_RECOMBOBULATE, 14000); - events.ScheduleEvent(EVENT_SPELL_EXPLOSIVE_SHEEP, 10000); - events.ScheduleEvent(EVENT_SPELL_IRON_BOMB, 5000); + events.ScheduleEvent(EVENT_SPELL_DRAGON_GUN, 20000); + events.ScheduleEvent(EVENT_SPELL_ROCKET_LAUNCH, 7000); + events.ScheduleEvent(EVENT_SPELL_RECOMBOBULATE, 14000); + events.ScheduleEvent(EVENT_SPELL_EXPLOSIVE_SHEEP, 10000); + events.ScheduleEvent(EVENT_SPELL_IRON_BOMB, 5000); } void UpdateAI(uint32 diff) @@ -1067,38 +1067,38 @@ public: boss_priestess_lackey_commonAI::UpdateAI(diff); - switch (actualEventId) - { - case EVENT_SPELL_DRAGON_GUN: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_GOBLIN_DRAGON_GUN_N, SPELL_GOBLIN_DRAGON_GUN_H), false); - events.ScheduleEvent(EVENT_SPELL_DRAGON_GUN, 20000); - break; - case EVENT_SPELL_ROCKET_LAUNCH: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_ROCKET_LAUNCH_N, SPELL_ROCKET_LAUNCH_H), false); - events.ScheduleEvent(EVENT_SPELL_ROCKET_LAUNCH, 20000); - break; - case EVENT_SPELL_IRON_BOMB: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 15.0f)) - me->CastSpell(target, DUNGEON_MODE(SPELL_FEL_IRON_BOMB_N, SPELL_FEL_IRON_BOMB_H), false); - events.ScheduleEvent(EVENT_SPELL_IRON_BOMB, 20000); - break; - case EVENT_SPELL_RECOMBOBULATE: - { - std::list cList = DoFindFriendlyMissingBuff(30.0f, SPELL_RECOMBOBULATE); - for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr) - if ((*itr)->IsPolymorphed()) - { - me->CastSpell(*itr, SPELL_RECOMBOBULATE, false); - break; - } - events.ScheduleEvent(EVENT_SPELL_RECOMBOBULATE, 10000); - break; - } - case EVENT_SPELL_EXPLOSIVE_SHEEP: - me->CastSpell(me, SPELL_HIGH_EXPLOSIVE_SHEEP, false); - events.ScheduleEvent(EVENT_SPELL_EXPLOSIVE_SHEEP, 60000); - break; - } + switch (actualEventId) + { + case EVENT_SPELL_DRAGON_GUN: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_GOBLIN_DRAGON_GUN_N, SPELL_GOBLIN_DRAGON_GUN_H), false); + events.ScheduleEvent(EVENT_SPELL_DRAGON_GUN, 20000); + break; + case EVENT_SPELL_ROCKET_LAUNCH: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_ROCKET_LAUNCH_N, SPELL_ROCKET_LAUNCH_H), false); + events.ScheduleEvent(EVENT_SPELL_ROCKET_LAUNCH, 20000); + break; + case EVENT_SPELL_IRON_BOMB: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 15.0f)) + me->CastSpell(target, DUNGEON_MODE(SPELL_FEL_IRON_BOMB_N, SPELL_FEL_IRON_BOMB_H), false); + events.ScheduleEvent(EVENT_SPELL_IRON_BOMB, 20000); + break; + case EVENT_SPELL_RECOMBOBULATE: + { + std::list cList = DoFindFriendlyMissingBuff(30.0f, SPELL_RECOMBOBULATE); + for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr) + if ((*itr)->IsPolymorphed()) + { + me->CastSpell(*itr, SPELL_RECOMBOBULATE, false); + break; + } + events.ScheduleEvent(EVENT_SPELL_RECOMBOBULATE, 10000); + break; + } + case EVENT_SPELL_EXPLOSIVE_SHEEP: + me->CastSpell(me, SPELL_HIGH_EXPLOSIVE_SHEEP, false); + events.ScheduleEvent(EVENT_SPELL_EXPLOSIVE_SHEEP, 60000); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index 1e5244cfc..5b5ae179d 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -20,23 +20,23 @@ enum Spells { SPELL_FEL_CRYSTAL_COSMETIC = 44374, SPELL_MANA_RAGE = 44320, - SPELL_MANA_RAGE_TRIGGER = 44321, + SPELL_MANA_RAGE_TRIGGER = 44321, //Selin's spells - SPELL_DRAIN_LIFE_N = 44294, - SPELL_DRAIN_LIFE_H = 46155, - SPELL_FEL_EXPLOSION = 44314, - SPELL_DRAIN_MANA = 46153 + SPELL_DRAIN_LIFE_N = 44294, + SPELL_DRAIN_LIFE_H = 46155, + SPELL_FEL_EXPLOSION = 44314, + SPELL_DRAIN_MANA = 46153 }; enum Events { - EVENT_SPELL_DRAIN_LIFE = 1, - EVENT_SPELL_FEL_EXPLOSION = 2, - EVENT_SPELL_DRAIN_MANA = 3, - EVENT_DRAIN_CRYSTAL = 4, - EVENT_EMPOWER = 5, - EVENT_RESTORE_COMBAT = 6 + EVENT_SPELL_DRAIN_LIFE = 1, + EVENT_SPELL_FEL_EXPLOSION = 2, + EVENT_SPELL_DRAIN_MANA = 3, + EVENT_DRAIN_CRYSTAL = 4, + EVENT_EMPOWER = 5, + EVENT_RESTORE_COMBAT = 6 }; class boss_selin_fireheart : public CreatureScript @@ -57,64 +57,64 @@ public: } InstanceScript* instance; - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; uint64 CrystalGUID; - bool CanAIAttack(const Unit* who) const - { - return who->GetPositionX() > 216.0f; - } + bool CanAIAttack(const Unit* who) const + { + return who->GetPositionX() > 216.0f; + } - void SpawnCrystals() - { - me->SummonCreature(NPC_FEL_CRYSTAL, 248.053f, 14.592f, 3.74882f, 3.94444f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_FEL_CRYSTAL, 225.969f, -20.0775f, -2.9731f, 0.942478f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_FEL_CRYSTAL, 226.314f, 20.2183f, -2.98127f, 5.32325f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_FEL_CRYSTAL, 247.888f, -14.6252f, 3.80777f, 2.33874f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_FEL_CRYSTAL, 263.149f, 0.309245f, 1.32057f, 3.15905f, TEMPSUMMON_CORPSE_DESPAWN); - } + void SpawnCrystals() + { + me->SummonCreature(NPC_FEL_CRYSTAL, 248.053f, 14.592f, 3.74882f, 3.94444f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_FEL_CRYSTAL, 225.969f, -20.0775f, -2.9731f, 0.942478f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_FEL_CRYSTAL, 226.314f, 20.2183f, -2.98127f, 5.32325f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_FEL_CRYSTAL, 247.888f, -14.6252f, 3.80777f, 2.33874f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_FEL_CRYSTAL, 263.149f, 0.309245f, 1.32057f, 3.15905f, TEMPSUMMON_CORPSE_DESPAWN); + } - void JustSummoned(Creature* summon) - { - summon->SetReactState(REACT_PASSIVE); - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summon->SetReactState(REACT_PASSIVE); + summons.Summon(summon); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - if (events.GetPhaseMask() & 0x01) - events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + if (events.GetPhaseMask() & 0x01) + events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0); + } void Reset() { events.Reset(); - summons.DespawnAll(); - SpawnCrystals(); + summons.DespawnAll(); + SpawnCrystals(); instance->SetData(DATA_SELIN_EVENT, NOT_STARTED); CrystalGUID = 0; - me->SetPower(POWER_MANA, 0); + me->SetPower(POWER_MANA, 0); } - void EnterCombat(Unit* /*who*/) + void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); instance->SetData(DATA_SELIN_EVENT, IN_PROGRESS); - events.ScheduleEvent(EVENT_SPELL_DRAIN_LIFE, 2500, 1); - events.ScheduleEvent(EVENT_SPELL_FEL_EXPLOSION, 2000); + events.ScheduleEvent(EVENT_SPELL_DRAIN_LIFE, 2500, 1); + events.ScheduleEvent(EVENT_SPELL_FEL_EXPLOSION, 2000); events.ScheduleEvent(EVENT_DRAIN_CRYSTAL, 14000); - - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_DRAIN_MANA, 7500, 1); + + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_DRAIN_MANA, 7500, 1); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) @@ -127,22 +127,22 @@ public: void SelectNearestCrystal() { - if (summons.empty()) - return; + if (summons.empty()) + return; CrystalGUID = 0; Unit* crystal = NULL; - for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *i++)) + for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *i++)) if (!crystal || me->GetDistanceOrder(summon, crystal, false)) - crystal = summon; + crystal = summon; if (crystal) { Talk(SAY_ENERGY); float x, y, z; crystal->GetClosePoint(x, y, z, me->GetObjectSize(), CONTACT_DISTANCE); - CrystalGUID = crystal->GetGUID(); + CrystalGUID = crystal->GetGUID(); me->GetMotionMaster()->MovePoint(2, x, y, z); } } @@ -153,15 +153,15 @@ public: { if (Unit* crystal = ObjectAccessor::GetUnit(*me, CrystalGUID)) { - Talk(EMOTE_CRYSTAL); + Talk(EMOTE_CRYSTAL); crystal->SetUInt32Value(UNIT_FIELD_FLAGS, 0); crystal->CastSpell(me, SPELL_MANA_RAGE, true); me->CastSpell(crystal, SPELL_FEL_CRYSTAL_COSMETIC, true); - events.SetPhase(1); - events.ScheduleEvent(EVENT_EMPOWER, 0, 0, 1); + events.SetPhase(1); + events.ScheduleEvent(EVENT_EMPOWER, 0, 0, 1); } - else - events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0); + else + events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0); } } @@ -170,50 +170,50 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_DRAIN_LIFE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, DUNGEON_MODE(SPELL_DRAIN_LIFE_N, SPELL_DRAIN_LIFE_H), false); - events.ScheduleEvent(EVENT_SPELL_DRAIN_LIFE, 10000, 1); - return; - case EVENT_SPELL_DRAIN_MANA: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, PowerUsersSelector(me, POWER_MANA, 40.0f, false))) - me->CastSpell(target, SPELL_DRAIN_MANA, false); - events.ScheduleEvent(EVENT_SPELL_DRAIN_MANA, 10000, 1); - return; - case EVENT_SPELL_FEL_EXPLOSION: - me->RemoveAuraFromStack(SPELL_MANA_RAGE_TRIGGER); - me->CastSpell(me, SPELL_FEL_EXPLOSION, false); - events.ScheduleEvent(EVENT_SPELL_FEL_EXPLOSION, 2000); - break; - case EVENT_DRAIN_CRYSTAL: - events.DelayEvents(10001); - events.ScheduleEvent(EVENT_EMPOWER, 10000); - events.ScheduleEvent(EVENT_DRAIN_CRYSTAL, 30000); - SelectNearestCrystal(); - break; - case EVENT_EMPOWER: - if (me->GetPower(POWER_MANA) == me->GetMaxPower(POWER_MANA)) - { - Talk(SAY_EMPOWERED); - if (Unit* crystal = ObjectAccessor::GetUnit(*me, CrystalGUID)) - Unit::Kill(crystal, crystal); - events.DelayEvents(10000, 1); - events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0); - } - else - events.ScheduleEvent(EVENT_EMPOWER, 0, 0, 1); - break; - case EVENT_RESTORE_COMBAT: - events.SetPhase(0); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_DRAIN_LIFE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, DUNGEON_MODE(SPELL_DRAIN_LIFE_N, SPELL_DRAIN_LIFE_H), false); + events.ScheduleEvent(EVENT_SPELL_DRAIN_LIFE, 10000, 1); + return; + case EVENT_SPELL_DRAIN_MANA: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, PowerUsersSelector(me, POWER_MANA, 40.0f, false))) + me->CastSpell(target, SPELL_DRAIN_MANA, false); + events.ScheduleEvent(EVENT_SPELL_DRAIN_MANA, 10000, 1); + return; + case EVENT_SPELL_FEL_EXPLOSION: + me->RemoveAuraFromStack(SPELL_MANA_RAGE_TRIGGER); + me->CastSpell(me, SPELL_FEL_EXPLOSION, false); + events.ScheduleEvent(EVENT_SPELL_FEL_EXPLOSION, 2000); + break; + case EVENT_DRAIN_CRYSTAL: + events.DelayEvents(10001); + events.ScheduleEvent(EVENT_EMPOWER, 10000); + events.ScheduleEvent(EVENT_DRAIN_CRYSTAL, 30000); + SelectNearestCrystal(); + break; + case EVENT_EMPOWER: + if (me->GetPower(POWER_MANA) == me->GetMaxPower(POWER_MANA)) + { + Talk(SAY_EMPOWERED); + if (Unit* crystal = ObjectAccessor::GetUnit(*me, CrystalGUID)) + Unit::Kill(crystal, crystal); + events.DelayEvents(10000, 1); + events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0); + } + else + events.ScheduleEvent(EVENT_EMPOWER, 0, 0, 1); + break; + case EVENT_RESTORE_COMBAT: + events.SetPhase(0); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp index eb8eaa7fb..f640155a2 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp @@ -18,19 +18,19 @@ enum Yells enum Spells { // Pure energy spell info - SPELL_ENERGY_FEEDBACK_CHANNEL = 44328, + SPELL_ENERGY_FEEDBACK_CHANNEL = 44328, SPELL_ENERGY_FEEDBACK = 44335, // Vexallus spell info - SPELL_CHAIN_LIGHTNING_N = 44318, - SPELL_CHAIN_LIGHTNING_H = 46380, + SPELL_CHAIN_LIGHTNING_N = 44318, + SPELL_CHAIN_LIGHTNING_H = 46380, SPELL_OVERLOAD = 44352, - SPELL_ARCANE_SHOCK_N = 44319, - SPELL_ARCANE_SHOCK_H = 46381, + SPELL_ARCANE_SHOCK_N = 44319, + SPELL_ARCANE_SHOCK_H = 46381, - SPELL_SUMMON_PURE_ENERGY_N = 44322, - SPELL_SUMMON_PURE_ENERGY_H1 = 46154, - SPELL_SUMMON_PURE_ENERGY_H2 = 46159 + SPELL_SUMMON_PURE_ENERGY_N = 44322, + SPELL_SUMMON_PURE_ENERGY_H1 = 46154, + SPELL_SUMMON_PURE_ENERGY_H2 = 46159 }; enum Misc @@ -40,9 +40,9 @@ enum Misc INTERVAL_MODIFIER = 15, INTERVAL_SWITCH = 6, - EVENT_SPELL_CHAIN_LIGHTNING = 1, - EVENT_SPELL_ARCANE_SHOCK = 2, - EVENT_HEALTH_CHECK = 3, + EVENT_SPELL_CHAIN_LIGHTNING = 1, + EVENT_SPELL_ARCANE_SHOCK = 2, + EVENT_HEALTH_CHECK = 3, }; class boss_vexallus : public CreatureScript @@ -63,8 +63,8 @@ public: } InstanceScript* instance; - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; uint8 IntervalHealthAmount; bool Enraged; @@ -75,20 +75,20 @@ public: IntervalHealthAmount = 1; instance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ENERGY_FEEDBACK); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ENERGY_FEEDBACK); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) { summons.DespawnAll(); instance->SetData(DATA_VEXALLUS_EVENT, DONE); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ENERGY_FEEDBACK); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ENERGY_FEEDBACK); } void EnterCombat(Unit* /*who*/) @@ -96,75 +96,75 @@ public: Talk(SAY_AGGRO); instance->SetData(DATA_VEXALLUS_EVENT, IN_PROGRESS); - events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, 8000); - events.ScheduleEvent(EVENT_SPELL_ARCANE_SHOCK, 5000); - events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); + events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, 8000); + events.ScheduleEvent(EVENT_SPELL_ARCANE_SHOCK, 5000); + events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); } void JustSummoned(Creature* summon) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { + { summon->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f); - summon->CastSpell(target, SPELL_ENERGY_FEEDBACK_CHANNEL, false); - } - summons.Summon(summon); + summon->CastSpell(target, SPELL_ENERGY_FEEDBACK_CHANNEL, false); + } + summons.Summon(summon); } - void SummonedCreatureDies(Creature* summon, Unit* killer) - { - summons.Despawn(summon); - summon->DespawnOrUnsummon(1); - if (killer) - killer->CastSpell(killer, SPELL_ENERGY_FEEDBACK, true, 0, 0, summon->GetGUID()); - } + void SummonedCreatureDies(Creature* summon, Unit* killer) + { + summons.Despawn(summon); + summon->DespawnOrUnsummon(1); + if (killer) + killer->CastSpell(killer, SPELL_ENERGY_FEEDBACK, true, 0, 0, summon->GetGUID()); + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_HEALTH_CHECK: - //used for check, when Vexallus cast adds 85%, 70%, 55%, 40% - if (!HealthAbovePct(100 - INTERVAL_MODIFIER * IntervalHealthAmount)) - { - if (IntervalHealthAmount++ == INTERVAL_SWITCH) - { - events.Reset(); - me->CastSpell(me, SPELL_OVERLOAD, true); - return; - } - - Talk(SAY_ENERGY); - Talk(EMOTE_DISCHARGE_ENERGY); + switch (events.ExecuteEvent()) + { + case EVENT_HEALTH_CHECK: + //used for check, when Vexallus cast adds 85%, 70%, 55%, 40% + if (!HealthAbovePct(100 - INTERVAL_MODIFIER * IntervalHealthAmount)) + { + if (IntervalHealthAmount++ == INTERVAL_SWITCH) + { + events.Reset(); + me->CastSpell(me, SPELL_OVERLOAD, true); + return; + } + + Talk(SAY_ENERGY); + Talk(EMOTE_DISCHARGE_ENERGY); - if (IsHeroic()) - { - me->CastSpell(me, SPELL_SUMMON_PURE_ENERGY_H1, false); - me->CastSpell(me, SPELL_SUMMON_PURE_ENERGY_H2, false); - } - else - me->CastSpell(me, SPELL_SUMMON_PURE_ENERGY_N, false); - } - events.ScheduleEvent(EVENT_HEALTH_CHECK, 0); - break; - case EVENT_SPELL_CHAIN_LIGHTNING: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, DUNGEON_MODE(SPELL_CHAIN_LIGHTNING_N, SPELL_CHAIN_LIGHTNING_H), false); - events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, 8000); - break; - case EVENT_SPELL_ARCANE_SHOCK: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f)) - me->CastSpell(target, DUNGEON_MODE(SPELL_ARCANE_SHOCK_N, SPELL_ARCANE_SHOCK_H), false); - events.ScheduleEvent(EVENT_SPELL_ARCANE_SHOCK, 8000); - break; - } + if (IsHeroic()) + { + me->CastSpell(me, SPELL_SUMMON_PURE_ENERGY_H1, false); + me->CastSpell(me, SPELL_SUMMON_PURE_ENERGY_H2, false); + } + else + me->CastSpell(me, SPELL_SUMMON_PURE_ENERGY_N, false); + } + events.ScheduleEvent(EVENT_HEALTH_CHECK, 0); + break; + case EVENT_SPELL_CHAIN_LIGHTNING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, DUNGEON_MODE(SPELL_CHAIN_LIGHTNING_N, SPELL_CHAIN_LIGHTNING_H), false); + events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, 8000); + break; + case EVENT_SPELL_ARCANE_SHOCK: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f)) + me->CastSpell(target, DUNGEON_MODE(SPELL_ARCANE_SHOCK_N, SPELL_ARCANE_SHOCK_H), false); + events.ScheduleEvent(EVENT_SPELL_ARCANE_SHOCK, 8000); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index 7683260c6..90366cbea 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -30,7 +30,7 @@ public: void Initialize() { memset(&Encounter, 0, sizeof(Encounter)); - + VexallusDoorGUID = 0; SelinDoorGUID = 0; SelinEncounterDoorGUID = 0; @@ -39,7 +39,7 @@ public: EscapeOrbGUID = 0; DelrissaGUID = 0; - KaelGUID = 0; + KaelGUID = 0; } bool IsEncounterInProgress() const @@ -84,9 +84,9 @@ public: break; case DATA_KAELTHAS_EVENT: HandleGameObject(KaelDoorGUID, data != IN_PROGRESS); - if (data == DONE) - if (GameObject* escapeOrb = instance->GetGameObject(EscapeOrbGUID)) - escapeOrb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + if (data == DONE) + if (GameObject* escapeOrb = instance->GetGameObject(EscapeOrbGUID)) + escapeOrb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); Encounter[identifier] = data; break; } @@ -101,14 +101,14 @@ public: case NPC_DELRISSA: DelrissaGUID = creature->GetGUID(); break; - case NPC_KAEL_THAS: - KaelGUID = creature->GetGUID(); - break; - case NPC_PHOENIX: - case NPC_PHOENIX_EGG: - if (Creature* kael = instance->GetCreature(KaelGUID)) - kael->AI()->JustSummoned(creature); - break; + case NPC_KAEL_THAS: + KaelGUID = creature->GetGUID(); + break; + case NPC_PHOENIX: + case NPC_PHOENIX_EGG: + if (Creature* kael = instance->GetCreature(KaelGUID)) + kael->AI()->JustSummoned(creature); + break; } } @@ -116,9 +116,9 @@ public: { switch (go->GetEntry()) { - case GO_SELIN_DOOR: - if (GetData(DATA_SELIN_EVENT) == DONE) - HandleGameObject(0, true, go); + case GO_SELIN_DOOR: + if (GetData(DATA_SELIN_EVENT) == DONE) + HandleGameObject(0, true, go); SelinDoorGUID = go->GetGUID(); break; case GO_SELIN_ENCOUNTER_DOOR: @@ -126,22 +126,22 @@ public: break; case GO_VEXALLUS_DOOR: - if (GetData(DATA_VEXALLUS_EVENT) == DONE) + if (GetData(DATA_VEXALLUS_EVENT) == DONE) HandleGameObject(0, true, go); VexallusDoorGUID = go->GetGUID(); break; case GO_DELRISSA_DOOR: - if (GetData(DATA_DELRISSA_EVENT) == DONE) - HandleGameObject(0, true, go); + if (GetData(DATA_DELRISSA_EVENT) == DONE) + HandleGameObject(0, true, go); DelrissaDoorGUID = go->GetGUID(); break; case GO_KAEL_DOOR: KaelDoorGUID = go->GetGUID(); break; case GO_ESCAPE_ORB: - if (GetData(DATA_KAELTHAS_EVENT) == DONE) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + if (GetData(DATA_KAELTHAS_EVENT) == DONE) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); EscapeOrbGUID = go->GetGUID(); break; } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h index 64852d56c..edea0f9f6 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h @@ -7,31 +7,31 @@ REWRITTEN BY XINEF enum MTData { - DATA_SELIN_EVENT = 0, - DATA_VEXALLUS_EVENT = 1, - DATA_DELRISSA_EVENT = 2, - DATA_KAELTHAS_EVENT = 3, - MAX_ENCOUNTER = 4 + DATA_SELIN_EVENT = 0, + DATA_VEXALLUS_EVENT = 1, + DATA_DELRISSA_EVENT = 2, + DATA_KAELTHAS_EVENT = 3, + MAX_ENCOUNTER = 4 }; enum MTCreatures { - NPC_DELRISSA = 24560, - NPC_FEL_CRYSTAL = 24722, - NPC_KAEL_THAS = 24664, - NPC_PHOENIX = 21362, - NPC_PHOENIX_EGG = 21364 + NPC_DELRISSA = 24560, + NPC_FEL_CRYSTAL = 24722, + NPC_KAEL_THAS = 24664, + NPC_PHOENIX = 21362, + NPC_PHOENIX_EGG = 21364 }; enum MTGameObjects { - GO_VEXALLUS_DOOR = 187896, - GO_SELIN_DOOR = 187979, - GO_SELIN_ENCOUNTER_DOOR = 188065, - GO_DELRISSA_DOOR = 187770, - GO_KAEL_DOOR = 188064, - GO_ESCAPE_ORB = 188173 + GO_VEXALLUS_DOOR = 187896, + GO_SELIN_DOOR = 187979, + GO_SELIN_ENCOUNTER_DOOR = 188065, + GO_DELRISSA_DOOR = 187770, + GO_KAEL_DOOR = 188064, + GO_ESCAPE_ORB = 188173 }; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 82443d3e3..6a096e793 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -31,15 +31,15 @@ // Ours enum eyeOfAcherus { - EVENT_REMOVE_CONTROL = 1, - EVENT_SPEAK_1 = 2, - EVENT_LAUNCH = 3, - EVENT_REGAIN_CONTROL = 4, + EVENT_REMOVE_CONTROL = 1, + EVENT_SPEAK_1 = 2, + EVENT_LAUNCH = 3, + EVENT_REGAIN_CONTROL = 4, - EYE_TEXT_LAUNCH = 0, - EYE_TEXT_CONTROL = 1, + EYE_TEXT_LAUNCH = 0, + EYE_TEXT_CONTROL = 1, - SPELL_EYE_OF_ACHERUS_VISUAL = 51892, + SPELL_EYE_OF_ACHERUS_VISUAL = 51892, }; class npc_eye_of_acherus : public CreatureScript @@ -56,68 +56,68 @@ public: { npc_eye_of_acherusAI(Creature* creature) : NullCreatureAI(creature) { } - EventMap events; + EventMap events; - void InitializeAI() - { - events.Reset(); - events.ScheduleEvent(EVENT_REMOVE_CONTROL, 500); - events.ScheduleEvent(EVENT_SPEAK_1, 4000); - events.ScheduleEvent(EVENT_LAUNCH, 7000); + void InitializeAI() + { + events.Reset(); + events.ScheduleEvent(EVENT_REMOVE_CONTROL, 500); + events.ScheduleEvent(EVENT_SPEAK_1, 4000); + events.ScheduleEvent(EVENT_LAUNCH, 7000); - me->CastSpell(me, SPELL_EYE_OF_ACHERUS_VISUAL, true); - } + me->CastSpell(me, SPELL_EYE_OF_ACHERUS_VISUAL, true); + } - void MovementInform(uint32 type, uint32 point) - { - if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized()) - events.ScheduleEvent(EVENT_REGAIN_CONTROL, 1000); - } + void MovementInform(uint32 type, uint32 point) + { + if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized()) + events.ScheduleEvent(EVENT_REGAIN_CONTROL, 1000); + } - void SetControl(Player* player, bool on) - { - WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, me->GetPackGUID().size()+1); - data.append(me->GetPackGUID()); - data << uint8(on ? 1 : 0); - player->GetSession()->SendPacket(&data); - } + void SetControl(Player* player, bool on) + { + WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, me->GetPackGUID().size()+1); + data.append(me->GetPackGUID()); + data << uint8(on ? 1 : 0); + player->GetSession()->SendPacket(&data); + } - void JustSummoned(Creature* creature) - { - if (Unit* target = creature->SelectNearbyTarget()) - creature->AI()->AttackStart(target); - } + void JustSummoned(Creature* creature) + { + if (Unit* target = creature->SelectNearbyTarget()) + creature->AI()->AttackStart(target); + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_REMOVE_CONTROL: - if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - SetControl(player, false); - break; - case EVENT_SPEAK_1: - Talk(EYE_TEXT_LAUNCH, me->GetCharmerOrOwnerPlayerOrPlayerItself()); - break; - case EVENT_LAUNCH: - { - Movement::PointsArray path; - path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - path.push_back(G3D::Vector3(me->GetPositionX()-40.0f, me->GetPositionY(), me->GetPositionZ()+10.0f)); - path.push_back(G3D::Vector3(1768.0f, -5876.0f, 153.0f)); - me->GetMotionMaster()->MoveSplinePath(&path); - break; - } - case EVENT_REGAIN_CONTROL: - if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - SetControl(player, true); - Talk(EYE_TEXT_CONTROL, player); - } - break; - } - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_REMOVE_CONTROL: + if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself()) + SetControl(player, false); + break; + case EVENT_SPEAK_1: + Talk(EYE_TEXT_LAUNCH, me->GetCharmerOrOwnerPlayerOrPlayerItself()); + break; + case EVENT_LAUNCH: + { + Movement::PointsArray path; + path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + path.push_back(G3D::Vector3(me->GetPositionX()-40.0f, me->GetPositionY(), me->GetPositionZ()+10.0f)); + path.push_back(G3D::Vector3(1768.0f, -5876.0f, 153.0f)); + me->GetMotionMaster()->MoveSplinePath(&path); + break; + } + case EVENT_REGAIN_CONTROL: + if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + SetControl(player, true); + Talk(EYE_TEXT_CONTROL, player); + } + break; + } + } }; }; @@ -132,9 +132,9 @@ class spell_q12641_death_comes_from_on_high_summon_ghouls : public SpellScriptLo void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitEffect(effIndex); - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 54522, true); + PreventHitEffect(effIndex); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 54522, true); } void Register() @@ -163,10 +163,10 @@ enum deathsChallenge QUEST_DEATH_CHALLENGE = 12733, FACTION_HOSTILE = 2068, - DATA_IN_PROGRESS = 0, + DATA_IN_PROGRESS = 0, - EVENT_SPEAK = 1, // 1 - 6 - EVENT_DUEL_LOST = 7, // 7 - 8 + EVENT_SPEAK = 1, // 1 - 6 + EVENT_DUEL_LOST = 7, // 7 - 8 }; class npc_death_knight_initiate : public CreatureScript @@ -184,8 +184,8 @@ public: if (player->IsInCombat() || creature->IsInCombat()) return true; - if (creature->AI()->GetData(DATA_IN_PROGRESS)) - return true; + if (creature->AI()->GetData(DATA_IN_PROGRESS)) + return true; creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); @@ -206,8 +206,8 @@ public: if (player->IsInCombat() || creature->IsInCombat()) return true; - if (!creature->AI()->GetData(player->GetGUIDLow())) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + if (!creature->AI()->GetData(player->GetGUIDLow())) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); } @@ -223,23 +223,23 @@ public: { npc_death_knight_initiateAI(Creature* creature) : CombatAI(creature) { } - bool _duelInProgress; - uint64 _duelGUID; - EventMap events; - std::set playerGUIDs; + bool _duelInProgress; + uint64 _duelGUID; + EventMap events; + std::set playerGUIDs; - uint32 GetData(uint32 data) const - { - if (data == DATA_IN_PROGRESS) - return _duelInProgress; + uint32 GetData(uint32 data) const + { + if (data == DATA_IN_PROGRESS) + return _duelInProgress; - return playerGUIDs.find(data) != playerGUIDs.end(); - } + return playerGUIDs.find(data) != playerGUIDs.end(); + } void Reset() { - _duelInProgress = false; - _duelGUID = 0; + _duelInProgress = false; + _duelGUID = 0; me->RestoreFaction(); CombatAI::Reset(); @@ -250,37 +250,37 @@ public: { if (!_duelInProgress && pSpell->Id == SPELL_DUEL) { - playerGUIDs.insert(caster->GetGUIDLow()); + playerGUIDs.insert(caster->GetGUIDLow()); _duelGUID = caster->GetGUID(); _duelInProgress = true; - events.ScheduleEvent(EVENT_SPEAK, 3000); - events.ScheduleEvent(EVENT_SPEAK+1, 7000); - events.ScheduleEvent(EVENT_SPEAK+2, 8000); - events.ScheduleEvent(EVENT_SPEAK+3, 9000); - events.ScheduleEvent(EVENT_SPEAK+4, 10000); - events.ScheduleEvent(EVENT_SPEAK+5, 11000); + events.ScheduleEvent(EVENT_SPEAK, 3000); + events.ScheduleEvent(EVENT_SPEAK+1, 7000); + events.ScheduleEvent(EVENT_SPEAK+2, 8000); + events.ScheduleEvent(EVENT_SPEAK+3, 9000); + events.ScheduleEvent(EVENT_SPEAK+4, 10000); + events.ScheduleEvent(EVENT_SPEAK+5, 11000); } } void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) { - if (attacker && _duelInProgress && attacker->IsControlledByPlayer()) + if (attacker && _duelInProgress && attacker->IsControlledByPlayer()) { - if (attacker->GetCharmerOrOwnerOrOwnGUID() != _duelGUID) - damage = 0; - else if (damage >= me->GetHealth()) - { - damage = 0; - events.ScheduleEvent(EVENT_DUEL_LOST, 2000); - events.ScheduleEvent(EVENT_DUEL_LOST+1, 6000); - _duelGUID = 0; - _duelInProgress = 0; + if (attacker->GetCharmerOrOwnerOrOwnGUID() != _duelGUID) + damage = 0; + else if (damage >= me->GetHealth()) + { + damage = 0; + events.ScheduleEvent(EVENT_DUEL_LOST, 2000); + events.ScheduleEvent(EVENT_DUEL_LOST+1, 6000); + _duelGUID = 0; + _duelInProgress = 0; attacker->RemoveGameObject(SPELL_DUEL_FLAG, true); attacker->AttackStop(); - me->CombatStop(false); - me->RemoveAllAuras(); + me->CombatStop(false); + me->RemoveAllAuras(); me->CastSpell(attacker, SPELL_DUEL_VICTORY, true); me->RestoreFaction(); } @@ -289,43 +289,43 @@ public: void UpdateAI(uint32 diff) { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_SPEAK: - Talk(SAY_DUEL, ObjectAccessor::GetPlayer(*me, _duelGUID)); - break; - case EVENT_SPEAK+1: - Talk(SAY_DUEL+1, ObjectAccessor::GetPlayer(*me, _duelGUID)); - break; - case EVENT_SPEAK+2: - Talk(SAY_DUEL+2, ObjectAccessor::GetPlayer(*me, _duelGUID)); - break; - case EVENT_SPEAK+3: - Talk(SAY_DUEL+3, ObjectAccessor::GetPlayer(*me, _duelGUID)); - break; - case EVENT_SPEAK+4: - Talk(SAY_DUEL+4, ObjectAccessor::GetPlayer(*me, _duelGUID)); - break; - case EVENT_SPEAK+5: - me->setFaction(FACTION_HOSTILE); + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_SPEAK: + Talk(SAY_DUEL, ObjectAccessor::GetPlayer(*me, _duelGUID)); + break; + case EVENT_SPEAK+1: + Talk(SAY_DUEL+1, ObjectAccessor::GetPlayer(*me, _duelGUID)); + break; + case EVENT_SPEAK+2: + Talk(SAY_DUEL+2, ObjectAccessor::GetPlayer(*me, _duelGUID)); + break; + case EVENT_SPEAK+3: + Talk(SAY_DUEL+3, ObjectAccessor::GetPlayer(*me, _duelGUID)); + break; + case EVENT_SPEAK+4: + Talk(SAY_DUEL+4, ObjectAccessor::GetPlayer(*me, _duelGUID)); + break; + case EVENT_SPEAK+5: + me->setFaction(FACTION_HOSTILE); if (Player* player = ObjectAccessor::GetPlayer(*me, _duelGUID)) AttackStart(player); - return; - case EVENT_DUEL_LOST: - me->CastSpell(me, 7267, true); - break; - case EVENT_DUEL_LOST+1: - EnterEvadeMode(); - return; - } + return; + case EVENT_DUEL_LOST: + me->CastSpell(me, 7267, true); + break; + case EVENT_DUEL_LOST+1: + EnterEvadeMode(); + return; + } - if (!events.Empty() || !UpdateVictim()) - return; + if (!events.Empty() || !UpdateVictim()) + return; if (_duelInProgress) { - if (me->GetVictim()->GetGUID() == _duelGUID && me->GetVictim()->HealthBelowPct(10)) + if (me->GetVictim()->GetGUID() == _duelGUID && me->GetVictim()->HealthBelowPct(10)) { me->GetVictim()->CastSpell(me->GetVictim(), 7267, true); // beg me->GetVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true); @@ -341,19 +341,19 @@ public: enum GiftOfTheHarvester { - NPC_GHOUL = 28845, - MAX_GHOULS = 5, + NPC_GHOUL = 28845, + MAX_GHOULS = 5, - SPELL_GHOUL_EMERGE = 50142, - SPELL_SUMMON_SCARLET_GHOST = 52505, - SPELL_GHOUL_SUBMERGE = 26234, + SPELL_GHOUL_EMERGE = 50142, + SPELL_SUMMON_SCARLET_GHOST = 52505, + SPELL_GHOUL_SUBMERGE = 26234, - EVENT_GHOUL_RESTORE_STATE = 1, - EVENT_GHOUL_CHECK_COMBAT = 2, - EVENT_GHOUL_EMOTE = 3, - EVENT_GHOUL_MOVE_TO_PIT = 4, + EVENT_GHOUL_RESTORE_STATE = 1, + EVENT_GHOUL_CHECK_COMBAT = 2, + EVENT_GHOUL_EMOTE = 3, + EVENT_GHOUL_MOVE_TO_PIT = 4, - SAY_GOTHIK_PIT = 0 + SAY_GOTHIK_PIT = 0 }; class spell_item_gift_of_the_harvester : public SpellScriptLoader @@ -399,15 +399,15 @@ class spell_q12698_the_gift_that_keeps_on_giving : public SpellScriptLoader { PrepareSpellScript(spell_q12698_the_gift_that_keeps_on_giving_SpellScript); - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (GetOriginalCaster() && GetHitUnit()) + if (GetOriginalCaster() && GetHitUnit()) GetOriginalCaster()->CastSpell(GetHitUnit(), urand(0, 1) ? GetEffectValue() : SPELL_SUMMON_SCARLET_GHOST, true); - } + } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_q12698_the_gift_that_keeps_on_giving_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_q12698_the_gift_that_keeps_on_giving_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -433,79 +433,79 @@ public: { } - EventMap events; - uint64 gothikGUID; + EventMap events; + uint64 gothikGUID; - void InitializeAI() - { - gothikGUID = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - ScriptedAI::InitializeAI(); - me->SetReactState(REACT_PASSIVE); + void InitializeAI() + { + gothikGUID = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + ScriptedAI::InitializeAI(); + me->SetReactState(REACT_PASSIVE); - events.ScheduleEvent(EVENT_GHOUL_EMOTE, 1); - events.ScheduleEvent(EVENT_GHOUL_RESTORE_STATE, 3500); - } + events.ScheduleEvent(EVENT_GHOUL_EMOTE, 1); + events.ScheduleEvent(EVENT_GHOUL_RESTORE_STATE, 3500); + } - void OwnerAttackedBy(Unit* attacker) - { - if (!me->IsInCombat() && me->GetReactState() == REACT_DEFENSIVE) - AttackStart(attacker); - } + void OwnerAttackedBy(Unit* attacker) + { + if (!me->IsInCombat() && me->GetReactState() == REACT_DEFENSIVE) + AttackStart(attacker); + } - void SetGUID(uint64 guid, int32) - { - gothikGUID = guid; - events.ScheduleEvent(EVENT_GHOUL_MOVE_TO_PIT, 3000); - me->GetMotionMaster()->Clear(false); - } + void SetGUID(uint64 guid, int32) + { + gothikGUID = guid; + events.ScheduleEvent(EVENT_GHOUL_MOVE_TO_PIT, 3000); + me->GetMotionMaster()->Clear(false); + } - void MovementInform(uint32 type, uint32 point) - { - if (type == POINT_MOTION_TYPE && point == 1) - { - me->DespawnOrUnsummon(1500); - me->CastSpell(me, SPELL_GHOUL_SUBMERGE, true); - } - } + void MovementInform(uint32 type, uint32 point) + { + if (type == POINT_MOTION_TYPE && point == 1) + { + me->DespawnOrUnsummon(1500); + me->CastSpell(me, SPELL_GHOUL_SUBMERGE, true); + } + } void UpdateAI(uint32 diff) { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_GHOUL_MOVE_TO_PIT: - me->GetMotionMaster()->MovePoint(1, 2364.77f, -5776.14f, 151.36f); - if (Creature* gothik = ObjectAccessor::GetCreature(*me, gothikGUID)) - gothik->AI()->DoAction(SAY_GOTHIK_PIT); - events.PopEvent(); - break; - case EVENT_GHOUL_EMOTE: - me->CastSpell(me, SPELL_GHOUL_EMERGE, true); - events.PopEvent(); - break; - case EVENT_GHOUL_RESTORE_STATE: - me->SetReactState(REACT_DEFENSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, frand(0.0f, 2*M_PI)); - events.PopEvent(); - events.ScheduleEvent(EVENT_GHOUL_CHECK_COMBAT, 1000); - return; - case EVENT_GHOUL_CHECK_COMBAT: - if (!me->IsInCombat()) - if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - if (owner->GetVictim()) - AttackStart(owner->GetVictim()); + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_GHOUL_MOVE_TO_PIT: + me->GetMotionMaster()->MovePoint(1, 2364.77f, -5776.14f, 151.36f); + if (Creature* gothik = ObjectAccessor::GetCreature(*me, gothikGUID)) + gothik->AI()->DoAction(SAY_GOTHIK_PIT); + events.PopEvent(); + break; + case EVENT_GHOUL_EMOTE: + me->CastSpell(me, SPELL_GHOUL_EMERGE, true); + events.PopEvent(); + break; + case EVENT_GHOUL_RESTORE_STATE: + me->SetReactState(REACT_DEFENSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, frand(0.0f, 2*M_PI)); + events.PopEvent(); + events.ScheduleEvent(EVENT_GHOUL_CHECK_COMBAT, 1000); + return; + case EVENT_GHOUL_CHECK_COMBAT: + if (!me->IsInCombat()) + if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (owner->GetVictim()) + AttackStart(owner->GetVictim()); - events.RepeatEvent(1000); - return; - } - - if (!UpdateVictim()) - return; + events.RepeatEvent(1000); + return; + } + + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; }; @@ -524,22 +524,22 @@ public: { npc_dkc1_gothikAI(Creature* creature) : ScriptedAI(creature) { spoken = 0; } - int32 spoken; + int32 spoken; - void DoAction(int32 action) - { - if (action == SAY_GOTHIK_PIT && spoken <= 0) - { - spoken = 5000; - Talk(SAY_GOTHIK_PIT); - } - } + void DoAction(int32 action) + { + if (action == SAY_GOTHIK_PIT && spoken <= 0) + { + spoken = 5000; + Talk(SAY_GOTHIK_PIT); + } + } void MoveInLineOfSight(Unit* who) { ScriptedAI::MoveInLineOfSight(who); - if (!who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetEntry() == NPC_GHOUL && me->IsWithinDistInMap(who, 10.0f)) + if (!who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetEntry() == NPC_GHOUL && me->IsWithinDistInMap(who, 10.0f)) if (Unit* owner = who->GetOwner()) if (Player* player = owner->ToPlayer()) { @@ -547,18 +547,18 @@ public: if (player->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) creature->CastSpell(owner, 52517, true); - creature->AI()->SetGUID(me->GetGUID()); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + creature->AI()->SetGUID(me->GetGUID()); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); } } - void UpdateAI(uint32 diff) - { - if (spoken > 0) - spoken -= diff; + void UpdateAI(uint32 diff) + { + if (spoken > 0) + spoken -= diff; - ScriptedAI::UpdateAI(diff); - } + ScriptedAI::UpdateAI(diff); + } }; }; @@ -574,34 +574,34 @@ public: struct npc_scarlet_cannonAI : public VehicleAI { - npc_scarlet_cannonAI(Creature* creature) : VehicleAI(creature) { summonAttackers = 0; } + npc_scarlet_cannonAI(Creature* creature) : VehicleAI(creature) { summonAttackers = 0; } - uint32 summonAttackers; - void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool apply) - { - summonAttackers = apply ? 8000 : 0; - } + uint32 summonAttackers; + void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool apply) + { + summonAttackers = apply ? 8000 : 0; + } - void UpdateAI(uint32 diff) - { - VehicleAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + VehicleAI::UpdateAI(diff); - if (summonAttackers) - { - summonAttackers += diff; - if (summonAttackers >= 15000) - { - for (uint8 i = 0; i < 15; ++i) - if (Creature* summon = me->SummonCreature(28834 /*NPC_SCARLET_FLEET_DEFENDER*/, 2192.56f+irand(-10, 10), -6147.90f+irand(-10, 10), 5.2f, 4.7f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 45000)) - { - summon->SetHomePosition(me->GetHomePosition()); - summon->AI()->AttackStart(me); - } + if (summonAttackers) + { + summonAttackers += diff; + if (summonAttackers >= 15000) + { + for (uint8 i = 0; i < 15; ++i) + if (Creature* summon = me->SummonCreature(28834 /*NPC_SCARLET_FLEET_DEFENDER*/, 2192.56f+irand(-10, 10), -6147.90f+irand(-10, 10), 5.2f, 4.7f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 45000)) + { + summon->SetHomePosition(me->GetHomePosition()); + summon->AI()->AttackStart(me); + } - summonAttackers = 1; - } - } - } + summonAttackers = 1; + } + } + } }; }; @@ -924,7 +924,7 @@ public: npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), minerGUID(0) { me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->setFaction(35); + me->setFaction(35); me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse. } @@ -946,14 +946,14 @@ public: me->SetSpeed(MOVE_RUN, 1.25f); me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); - me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); me->setFaction(35); } } void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) { - who->SetVisible(!apply); + who->SetVisible(!apply); if (!apply) if (Creature* miner = ObjectAccessor::GetCreature(*me, minerGUID)) miner->DisappearAndDie(); @@ -1129,8 +1129,8 @@ public: car->AI()->SetGUID(miner->GetGUID()); CAST_AI(npc_scarlet_miner::npc_scarlet_minerAI, miner->AI())->InitCartQuest(player); } - } - } + } + } } return true; } @@ -1139,17 +1139,17 @@ public: void AddSC_the_scarlet_enclave_c1() { - // Ours - new npc_eye_of_acherus(); - new spell_q12641_death_comes_from_on_high_summon_ghouls(); - new npc_death_knight_initiate(); + // Ours + new npc_eye_of_acherus(); + new spell_q12641_death_comes_from_on_high_summon_ghouls(); + new npc_death_knight_initiate(); new spell_item_gift_of_the_harvester(); - new spell_q12698_the_gift_that_keeps_on_giving(); + new spell_q12698_the_gift_that_keeps_on_giving(); new npc_scarlet_ghoul(); - new npc_dkc1_gothik(); - new npc_scarlet_cannon(); + new npc_dkc1_gothik(); + new npc_scarlet_cannon(); - // Theirs + // Theirs new npc_unworthy_initiate(); new npc_unworthy_initiate_anchor(); new go_acherus_soul_prison(); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index ccc5a218c..e233b0689 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -26,7 +26,7 @@ // texts signed for creature 28939 but used for 28939, 28940, 28610 enum win_friends { - SAY_AGGRO = 0, + SAY_AGGRO = 0, SAY_CRUSADER = 1, SAY_PERSUADED1 = 2, SAY_PERSUADED2 = 3, @@ -67,11 +67,11 @@ public: me->RestoreFaction(); } - void EnterCombat(Unit*) - { - if (roll_chance_i(33)) - Talk(SAY_AGGRO); - } + void EnterCombat(Unit*) + { + if (roll_chance_i(33)) + Talk(SAY_AGGRO); + } void SpellHit(Unit* caster, const SpellInfo* spell) { @@ -154,7 +154,7 @@ public: return; } - CombatAI::UpdateAI(diff); + CombatAI::UpdateAI(diff); } }; @@ -200,7 +200,7 @@ public: if (quest->GetQuestId() == QUEST_BREAKOUT) { creature->SetStandState(UNIT_STAND_STATE_STAND); - creature->setActive(true); + creature->setActive(true); if (npc_escortAI* pEscortAI = CAST_AI(npc_koltira_deathweaver::npc_koltira_deathweaverAI, creature->AI())) pEscortAI->Start(false, false, player->GetGUID()); @@ -223,7 +223,7 @@ public: uint32 m_uiWave; uint32 m_uiWave_Timer; uint64 m_uiValrothGUID; - SummonList summons; + SummonList summons; void Reset() { @@ -235,38 +235,38 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->LoadEquipment(0, true); me->RemoveAllAuras(); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_ALL, true); - summons.DespawnAll(); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_ALL, true); + summons.DespawnAll(); } } - void EnterEvadeMode() - { - me->DeleteThreatList(); - me->CombatStop(false); - me->SetLootRecipient(NULL); + void EnterEvadeMode() + { + me->DeleteThreatList(); + me->CombatStop(false); + me->SetLootRecipient(NULL); - if (HasEscortState(STATE_ESCORT_ESCORTING)) - { - AddEscortState(STATE_ESCORT_RETURNING); - ReturnToLastPoint(); - ;//sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has left combat and is now returning to last point"); - } - else - { - me->GetMotionMaster()->MoveTargetedHome(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - Reset(); - } - } + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + AddEscortState(STATE_ESCORT_RETURNING); + ReturnToLastPoint(); + ;//sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has left combat and is now returning to last point"); + } + else + { + me->GetMotionMaster()->MoveTargetedHome(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + Reset(); + } + } - void AttackStart(Unit* who) - { - if (HasEscortState(STATE_ESCORT_PAUSED)) - return; + void AttackStart(Unit* who) + { + if (HasEscortState(STATE_ESCORT_PAUSED)) + return; - npc_escortAI::AttackStart(who); - } + npc_escortAI::AttackStart(who); + } void WaypointReached(uint32 waypointId) { @@ -292,7 +292,7 @@ public: DoCast(me, SPELL_ANTI_MAGIC_ZONE); // cast again that makes bubble up break; case 4: - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, false); + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, false); SetRun(true); break; case 9: @@ -314,7 +314,7 @@ public: summoned->AddThreat(me, 0.0f); summoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - summons.Summon(summoned); + summons.Summon(summoned); } void SummonAcolyte(uint32 uiAmount) @@ -1066,15 +1066,15 @@ class spell_q12779_an_end_to_all_things : public SpellScriptLoader { PrepareSpellScript(spell_q12779_an_end_to_all_things_SpellScript); - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (GetHitUnit()) + if (GetHitUnit()) GetHitUnit()->CastSpell(GetCaster(), GetEffectValue(), true); - } + } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_q12779_an_end_to_all_things_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_q12779_an_end_to_all_things_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -1092,6 +1092,6 @@ void AddSC_the_scarlet_enclave_c2() new npc_high_inquisitor_valroth(); new npc_a_special_surprise(); - // Xinef: Should be in chapter III - new spell_q12779_an_end_to_all_things(); + // Xinef: Should be in chapter III + new spell_q12779_an_end_to_all_things(); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index b0a830d55..704c3e308 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -99,232 +99,232 @@ enum LightOfDawnSays enum LightOfDawnEncounter { - // Intro Events - EVENT_START_COUNTDOWN_1 = 1, - EVENT_START_COUNTDOWN_2, - EVENT_START_COUNTDOWN_3, - EVENT_START_COUNTDOWN_4, - EVENT_START_COUNTDOWN_5, - EVENT_START_COUNTDOWN_6, - EVENT_START_COUNTDOWN_7, - EVENT_START_COUNTDOWN_8, - EVENT_START_COUNTDOWN_9, - EVENT_START_COUNTDOWN_10, - EVENT_START_COUNTDOWN_11, - EVENT_START_COUNTDOWN_12, - EVENT_START_COUNTDOWN_13, - EVENT_START_COUNTDOWN_14, - // Fight Events - EVENT_SPELL_ANTI_MAGIC_ZONE, - EVENT_SPELL_DEATH_STRIKE, - EVENT_SPELL_DEATH_EMBRACE, - EVENT_SPELL_UNHOLY_BLIGHT, - EVENT_SPELL_TALK, - // Positioning - EVENT_FINISH_FIGHT_1, - EVENT_FINISH_FIGHT_2, - EVENT_FINISH_FIGHT_3, - EVENT_FINISH_FIGHT_4, - EVENT_FINISH_FIGHT_5, - // Outro - EVENT_OUTRO_SCENE_1, - EVENT_OUTRO_SCENE_2, - EVENT_OUTRO_SCENE_3, - EVENT_OUTRO_SCENE_4, - EVENT_OUTRO_SCENE_5, - EVENT_OUTRO_SCENE_6, - EVENT_OUTRO_SCENE_7, - EVENT_OUTRO_SCENE_8, - EVENT_OUTRO_SCENE_9, - EVENT_OUTRO_SCENE_10, - EVENT_OUTRO_SCENE_11, - EVENT_OUTRO_SCENE_12, - EVENT_OUTRO_SCENE_13, - EVENT_OUTRO_SCENE_14, - EVENT_OUTRO_SCENE_15, - EVENT_OUTRO_SCENE_16, - EVENT_OUTRO_SCENE_17, - EVENT_OUTRO_SCENE_18, - EVENT_OUTRO_SCENE_19, - EVENT_OUTRO_SCENE_20, - EVENT_OUTRO_SCENE_21, - EVENT_OUTRO_SCENE_22, - EVENT_OUTRO_SCENE_23, - EVENT_OUTRO_SCENE_24, - EVENT_OUTRO_SCENE_25, - EVENT_OUTRO_SCENE_26, - EVENT_OUTRO_SCENE_27, - EVENT_OUTRO_SCENE_28, - EVENT_OUTRO_SCENE_29, - EVENT_OUTRO_SCENE_30, - EVENT_OUTRO_SCENE_31, - EVENT_OUTRO_SCENE_32, - EVENT_OUTRO_SCENE_33, - EVENT_OUTRO_SCENE_34, - EVENT_OUTRO_SCENE_35, - EVENT_OUTRO_SCENE_36, - EVENT_OUTRO_SCENE_37, - EVENT_OUTRO_SCENE_38, - EVENT_OUTRO_SCENE_39, - EVENT_OUTRO_SCENE_40, - EVENT_OUTRO_SCENE_41, - EVENT_OUTRO_SCENE_42, - EVENT_OUTRO_SCENE_43, - EVENT_OUTRO_SCENE_44, - EVENT_OUTRO_SCENE_45, - EVENT_OUTRO_SCENE_46, - EVENT_OUTRO_SCENE_47, - EVENT_OUTRO_SCENE_48, - EVENT_OUTRO_SCENE_49, - EVENT_OUTRO_SCENE_50, - EVENT_OUTRO_SCENE_51, - EVENT_OUTRO_SCENE_52, - EVENT_OUTRO_SCENE_53, - EVENT_OUTRO_SCENE_54, - EVENT_OUTRO_SCENE_55, - EVENT_OUTRO_SCENE_56, - EVENT_OUTRO_SCENE_57, - EVENT_OUTRO_SCENE_58, - EVENT_OUTRO_SCENE_59, - EVENT_OUTRO_SCENE_60, - EVENT_OUTRO_SCENE_61, + // Intro Events + EVENT_START_COUNTDOWN_1 = 1, + EVENT_START_COUNTDOWN_2, + EVENT_START_COUNTDOWN_3, + EVENT_START_COUNTDOWN_4, + EVENT_START_COUNTDOWN_5, + EVENT_START_COUNTDOWN_6, + EVENT_START_COUNTDOWN_7, + EVENT_START_COUNTDOWN_8, + EVENT_START_COUNTDOWN_9, + EVENT_START_COUNTDOWN_10, + EVENT_START_COUNTDOWN_11, + EVENT_START_COUNTDOWN_12, + EVENT_START_COUNTDOWN_13, + EVENT_START_COUNTDOWN_14, + // Fight Events + EVENT_SPELL_ANTI_MAGIC_ZONE, + EVENT_SPELL_DEATH_STRIKE, + EVENT_SPELL_DEATH_EMBRACE, + EVENT_SPELL_UNHOLY_BLIGHT, + EVENT_SPELL_TALK, + // Positioning + EVENT_FINISH_FIGHT_1, + EVENT_FINISH_FIGHT_2, + EVENT_FINISH_FIGHT_3, + EVENT_FINISH_FIGHT_4, + EVENT_FINISH_FIGHT_5, + // Outro + EVENT_OUTRO_SCENE_1, + EVENT_OUTRO_SCENE_2, + EVENT_OUTRO_SCENE_3, + EVENT_OUTRO_SCENE_4, + EVENT_OUTRO_SCENE_5, + EVENT_OUTRO_SCENE_6, + EVENT_OUTRO_SCENE_7, + EVENT_OUTRO_SCENE_8, + EVENT_OUTRO_SCENE_9, + EVENT_OUTRO_SCENE_10, + EVENT_OUTRO_SCENE_11, + EVENT_OUTRO_SCENE_12, + EVENT_OUTRO_SCENE_13, + EVENT_OUTRO_SCENE_14, + EVENT_OUTRO_SCENE_15, + EVENT_OUTRO_SCENE_16, + EVENT_OUTRO_SCENE_17, + EVENT_OUTRO_SCENE_18, + EVENT_OUTRO_SCENE_19, + EVENT_OUTRO_SCENE_20, + EVENT_OUTRO_SCENE_21, + EVENT_OUTRO_SCENE_22, + EVENT_OUTRO_SCENE_23, + EVENT_OUTRO_SCENE_24, + EVENT_OUTRO_SCENE_25, + EVENT_OUTRO_SCENE_26, + EVENT_OUTRO_SCENE_27, + EVENT_OUTRO_SCENE_28, + EVENT_OUTRO_SCENE_29, + EVENT_OUTRO_SCENE_30, + EVENT_OUTRO_SCENE_31, + EVENT_OUTRO_SCENE_32, + EVENT_OUTRO_SCENE_33, + EVENT_OUTRO_SCENE_34, + EVENT_OUTRO_SCENE_35, + EVENT_OUTRO_SCENE_36, + EVENT_OUTRO_SCENE_37, + EVENT_OUTRO_SCENE_38, + EVENT_OUTRO_SCENE_39, + EVENT_OUTRO_SCENE_40, + EVENT_OUTRO_SCENE_41, + EVENT_OUTRO_SCENE_42, + EVENT_OUTRO_SCENE_43, + EVENT_OUTRO_SCENE_44, + EVENT_OUTRO_SCENE_45, + EVENT_OUTRO_SCENE_46, + EVENT_OUTRO_SCENE_47, + EVENT_OUTRO_SCENE_48, + EVENT_OUTRO_SCENE_49, + EVENT_OUTRO_SCENE_50, + EVENT_OUTRO_SCENE_51, + EVENT_OUTRO_SCENE_52, + EVENT_OUTRO_SCENE_53, + EVENT_OUTRO_SCENE_54, + EVENT_OUTRO_SCENE_55, + EVENT_OUTRO_SCENE_56, + EVENT_OUTRO_SCENE_57, + EVENT_OUTRO_SCENE_58, + EVENT_OUTRO_SCENE_59, + EVENT_OUTRO_SCENE_60, + EVENT_OUTRO_SCENE_61, - ACTION_START_EVENT = 1, - ACTION_PLAY_EMOTE = 1, - ACTION_POSITION_NPCS = 2, + ACTION_START_EVENT = 1, + ACTION_PLAY_EMOTE = 1, + ACTION_POSITION_NPCS = 2, - ENCOUNTER_START_TIME = 5, - ENCOUNTER_TOTAL_DEFENDERS = 300, - ENCOUNTER_TOTAL_SCOURGE = 10000, + ENCOUNTER_START_TIME = 5, + ENCOUNTER_TOTAL_DEFENDERS = 300, + ENCOUNTER_TOTAL_SCOURGE = 10000, - WORLD_STATE_DEFENDERS_COUNT = 3590, - WORLD_STATE_SCOURGE_COUNT = 3591, - WORLD_STATE_SOLDIERS_ENABLE = 3592, - WORLD_STATE_COUNTDOWN_ENABLE = 3603, - WORLD_STATE_COUNTDOWN_TIME = 3604, - WORLD_STATE_EVENT_BEGIN_ENABLE = 3605, + WORLD_STATE_DEFENDERS_COUNT = 3590, + WORLD_STATE_SCOURGE_COUNT = 3591, + WORLD_STATE_SOLDIERS_ENABLE = 3592, + WORLD_STATE_COUNTDOWN_ENABLE = 3603, + WORLD_STATE_COUNTDOWN_TIME = 3604, + WORLD_STATE_EVENT_BEGIN_ENABLE = 3605, - ENCOUNTER_STATE_NONE = 0, - ENCOUNTER_STATE_FIGHT = 1, - ENCOUNTER_STATE_OUTRO = 2, + ENCOUNTER_STATE_NONE = 0, + ENCOUNTER_STATE_FIGHT = 1, + ENCOUNTER_STATE_OUTRO = 2, }; enum LightOfDawnNPCs { - // Defenders - NPC_DEFENDER_OF_THE_LIGHT = 29174, - NPC_KORFAX_CHAMPION_OF_THE_LIGHT = 29176, - NPC_COMMANDER_ELIGOR_DAWNBRINGER = 29177, - NPC_LORD_MAXWELL_TYROSUS = 29178, - NPC_LEONID_BARTHALOMEW_THE_REVERED = 29179, - NPC_DUKE_NICHOLAS_ZVERENHOFF = 29180, - NPC_RAYNE = 29181, - NPC_RIMBLAT_EARTHSHATTER = 29182, + // Defenders + NPC_DEFENDER_OF_THE_LIGHT = 29174, + NPC_KORFAX_CHAMPION_OF_THE_LIGHT = 29176, + NPC_COMMANDER_ELIGOR_DAWNBRINGER = 29177, + NPC_LORD_MAXWELL_TYROSUS = 29178, + NPC_LEONID_BARTHALOMEW_THE_REVERED = 29179, + NPC_DUKE_NICHOLAS_ZVERENHOFF = 29180, + NPC_RAYNE = 29181, + NPC_RIMBLAT_EARTHSHATTER = 29182, - // Scourge - NPC_RAMPAGING_ABOMINATION = 29186, - NPC_ACHERUS_GHOUL = 29219, - NPC_WARRIOR_OF_THE_FROZEN_WASTES = 29206, - NPC_FLESH_BEHEMOTH = 29190, + // Scourge + NPC_RAMPAGING_ABOMINATION = 29186, + NPC_ACHERUS_GHOUL = 29219, + NPC_WARRIOR_OF_THE_FROZEN_WASTES = 29206, + NPC_FLESH_BEHEMOTH = 29190, - NPC_HIGHLORD_DARION_MOGRAINE = 29173, - NPC_KOLTIRA_DEATHWEAVER = 29199, - NPC_ORBAZ_BLOODBANE = 29204, - NPC_THASSARIAN = 29200, + NPC_HIGHLORD_DARION_MOGRAINE = 29173, + NPC_KOLTIRA_DEATHWEAVER = 29199, + NPC_ORBAZ_BLOODBANE = 29204, + NPC_THASSARIAN = 29200, - // Outro - NPC_HIGHLORD_TIRION_FORDRING = 29175, - NPC_HIGHLORD_ALEXANDROS_MOGRAINE = 29227, // ghost - NPC_DARION_MOGRAINE = 29228, // ghost - NPC_THE_LICH_KING = 29183, + // Outro + NPC_HIGHLORD_TIRION_FORDRING = 29175, + NPC_HIGHLORD_ALEXANDROS_MOGRAINE = 29227, // ghost + NPC_DARION_MOGRAINE = 29228, // ghost + NPC_THE_LICH_KING = 29183, }; enum LightOfDawnGOs { - GO_HOLY_LIGHTNING = 191301, - GO_LIGHT_OF_DAWN = 191330 + GO_HOLY_LIGHTNING = 191301, + GO_LIGHT_OF_DAWN = 191330 }; enum LightOfDawnSpells { - // Intro Spells - SPELL_CAMERA_SHAKE_INIT = 36455, - SPELL_CAMERA_SHAKE = 39983, - SPELL_THE_MIGHT_OF_MOGRAINE = 53642, + // Intro Spells + SPELL_CAMERA_SHAKE_INIT = 36455, + SPELL_CAMERA_SHAKE = 39983, + SPELL_THE_MIGHT_OF_MOGRAINE = 53642, - // Mograine Fight - SPELL_ANTI_MAGIC_ZONE1 = 52893, - SPELL_DEATH_STRIKE = 53639, - SPELL_DEATH_EMBRACE = 53635, - SPELL_ICY_TOUCH1 = 49723, - SPELL_UNHOLY_BLIGHT = 53640, + // Mograine Fight + SPELL_ANTI_MAGIC_ZONE1 = 52893, + SPELL_DEATH_STRIKE = 53639, + SPELL_DEATH_EMBRACE = 53635, + SPELL_ICY_TOUCH1 = 49723, + SPELL_UNHOLY_BLIGHT = 53640, - // Outro - SPELL_THE_LIGHT_OF_DAWN = 53658, - SPELL_ALEXANDROS_MOGRAINE_SPAWN = 53667, - SPELL_ICEBOUND_VISAGE = 53274, - SPELL_SOUL_FEAST_ALEX = 53677, - SPELL_MOGRAINE_CHARGE = 53679, - SPELL_REBUKE = 53680, - SPELL_SOUL_FEAST_TIRION = 53685, - SPELL_APOCALYPSE = 53210, - SPELL_THROW_ASHBRINGER = 53701, - SPELL_REBIRTH_OF_THE_ASHBRINGER = 53702, - SPELL_TIRION_CHARGE = 53705, - SPELL_EXIT_TELEPORT_VISUAL = 61456, - SPELL_LAY_ON_HANDS = 53778, - SPELL_THE_LIGHT_OF_DAWN_Q = 53606 + // Outro + SPELL_THE_LIGHT_OF_DAWN = 53658, + SPELL_ALEXANDROS_MOGRAINE_SPAWN = 53667, + SPELL_ICEBOUND_VISAGE = 53274, + SPELL_SOUL_FEAST_ALEX = 53677, + SPELL_MOGRAINE_CHARGE = 53679, + SPELL_REBUKE = 53680, + SPELL_SOUL_FEAST_TIRION = 53685, + SPELL_APOCALYPSE = 53210, + SPELL_THROW_ASHBRINGER = 53701, + SPELL_REBIRTH_OF_THE_ASHBRINGER = 53702, + SPELL_TIRION_CHARGE = 53705, + SPELL_EXIT_TELEPORT_VISUAL = 61456, + SPELL_LAY_ON_HANDS = 53778, + SPELL_THE_LIGHT_OF_DAWN_Q = 53606 }; const Position LightOfDawnPos[] = { - {2304.2f, -5290.7f, 82.01f, 4.56f}, // 0 First Home Pos - {2253.5f, -5310.6f, 82.17f, 5.28f}, // 1 Second Home Pos - {2169.1f, -5227.1f, 82.59f, 5.7f}, // 2 Orbaz Flee Pos - {2289.259f, -5280.355f, 86.112f, 4.41f}, // 3 Koltira Loc1 - {2273.289f, -5273.675f, 86.701f, 5.01f}, // 4 Thassarian Loc1 - {2280.81f, -5284.09f, 86.608f, 4.76f}, // 5 Morgraine Loc1 - {2281.335f, -5300.409f, 85.170f, 1.528f}, // 6 Tirion Summon loc - {2281.198f, -5257.397f, 80.224f, 4.66f}, // 7 Alexandros loc1 - {2281.156f, -5259.934f, 80.647f, 0}, // 8 Alexandros loc2 - {2281.294f, -5281.895f, 82.445f, 1.35f}, // 9 Darion loc1 - {2281.093f, -5263.013f, 81.125f, 0}, // 10 Darion loc2 - {2283.896f, -5287.914f, 83.066f, 1.55f}, // 11 Tirion Fordring loc2 - {2281.313f, -5250.282f, 79.322f, 4.69f}, // 12 Lich King spawns - {2281.523f, -5261.058f, 80.877f, 0}, // 13 Lich king moves forward - {2264.27f, -5267.29f, 80.16f, 0}, // 14 Tirion Fordring loc3 - {2270.99f, -5278.00f, 81.89f, 0} // 15 Tirion Fordring loc4 + {2304.2f, -5290.7f, 82.01f, 4.56f}, // 0 First Home Pos + {2253.5f, -5310.6f, 82.17f, 5.28f}, // 1 Second Home Pos + {2169.1f, -5227.1f, 82.59f, 5.7f}, // 2 Orbaz Flee Pos + {2289.259f, -5280.355f, 86.112f, 4.41f}, // 3 Koltira Loc1 + {2273.289f, -5273.675f, 86.701f, 5.01f}, // 4 Thassarian Loc1 + {2280.81f, -5284.09f, 86.608f, 4.76f}, // 5 Morgraine Loc1 + {2281.335f, -5300.409f, 85.170f, 1.528f}, // 6 Tirion Summon loc + {2281.198f, -5257.397f, 80.224f, 4.66f}, // 7 Alexandros loc1 + {2281.156f, -5259.934f, 80.647f, 0}, // 8 Alexandros loc2 + {2281.294f, -5281.895f, 82.445f, 1.35f}, // 9 Darion loc1 + {2281.093f, -5263.013f, 81.125f, 0}, // 10 Darion loc2 + {2283.896f, -5287.914f, 83.066f, 1.55f}, // 11 Tirion Fordring loc2 + {2281.313f, -5250.282f, 79.322f, 4.69f}, // 12 Lich King spawns + {2281.523f, -5261.058f, 80.877f, 0}, // 13 Lich king moves forward + {2264.27f, -5267.29f, 80.16f, 0}, // 14 Tirion Fordring loc3 + {2270.99f, -5278.00f, 81.89f, 0} // 15 Tirion Fordring loc4 }; const Position LightOfDawnFightPos[] = { - {2279.68f, -5256.75f, 79.79f, 4.8f}, - {2280.40f, -5276.56f, 82.11f, 4.8f}, - {2256.43f, -5281.3f, 82.29f, 5.0f}, - {2251.87f, -5304.08f, 82.17f, 4.8f}, - {2244.88f, -5256.03f, 74.88f, 5.8f}, - {2294.29f, -5281.35f, 81.91f, 4.8f}, - {2314.2f, -5268.1f, 82.43f, 3.6f}, - {2289.72f, -5299.65f, 83.49f, 3.2f}, - {2274.02f, -5303.58f, 85.05f, 1.4f}, - {2258.42f, -5307.72f, 81.98f, 0.1f} + {2279.68f, -5256.75f, 79.79f, 4.8f}, + {2280.40f, -5276.56f, 82.11f, 4.8f}, + {2256.43f, -5281.3f, 82.29f, 5.0f}, + {2251.87f, -5304.08f, 82.17f, 4.8f}, + {2244.88f, -5256.03f, 74.88f, 5.8f}, + {2294.29f, -5281.35f, 81.91f, 4.8f}, + {2314.2f, -5268.1f, 82.43f, 3.6f}, + {2289.72f, -5299.65f, 83.49f, 3.2f}, + {2274.02f, -5303.58f, 85.05f, 1.4f}, + {2258.42f, -5307.72f, 81.98f, 0.1f} }; class DelayedSummonEvent : public BasicEvent { - public: - DelayedSummonEvent(Unit* owner, uint32 entry, Position pos) : _owner(owner), _entry(entry), _pos(pos) { } + public: + DelayedSummonEvent(Unit* owner, uint32 entry, Position pos) : _owner(owner), _entry(entry), _pos(pos) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - _owner->SummonCreature(_entry, _pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + _owner->SummonCreature(_entry, _pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); + return true; + } - private: - Unit* _owner; - uint32 _entry; - Position _pos; + private: + Unit* _owner; + uint32 _entry; + Position _pos; }; class npc_highlord_darion_mograine : public CreatureScript @@ -342,7 +342,7 @@ public: if (creature->IsQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - if (player->GetQuestStatus(12801) == QUEST_STATUS_INCOMPLETE && !creature->AI()->GetData(WORLD_STATE_SOLDIERS_ENABLE)) + if (player->GetQuestStatus(12801) == QUEST_STATUS_INCOMPLETE && !creature->AI()->GetData(WORLD_STATE_SOLDIERS_ENABLE)) player->ADD_GOSSIP_ITEM(0, "I am ready, Highlord. Let the siege of Light's Hope begin!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); @@ -352,12 +352,12 @@ public: bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { - if (action == GOSSIP_ACTION_INFO_DEF+1) - { - player->PlayerTalkClass->ClearMenus(); - player->CLOSE_GOSSIP_MENU(); - creature->AI()->DoAction(ACTION_START_EVENT); - } + if (action == GOSSIP_ACTION_INFO_DEF+1) + { + player->PlayerTalkClass->ClearMenus(); + player->CLOSE_GOSSIP_MENU(); + creature->AI()->DoAction(ACTION_START_EVENT); + } return true; } @@ -365,421 +365,421 @@ public: { npc_highlord_darion_mograineAI(Creature* creature) : ScriptedAI(creature), summons(me) { - battleStarted = ENCOUNTER_STATE_NONE; - me->SetCorpseDelay(3*60); - me->SetRespawnTime(3*60); - resetExecuted = false; + battleStarted = ENCOUNTER_STATE_NONE; + me->SetCorpseDelay(3*60); + me->SetRespawnTime(3*60); + resetExecuted = false; } - EventMap events; - SummonList summons; - uint32 startTimeRemaining; - uint32 defendersRemaining; - uint32 scourgeRemaining; - uint8 battleStarted; - bool resetExecuted; + EventMap events; + SummonList summons; + uint32 startTimeRemaining; + uint32 defendersRemaining; + uint32 scourgeRemaining; + uint8 battleStarted; + bool resetExecuted; - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT && !startTimeRemaining && events.Empty()) - { - Talk(SAY_LIGHT_OF_DAWN01); - - startTimeRemaining = ENCOUNTER_START_TIME; - defendersRemaining = ENCOUNTER_TOTAL_DEFENDERS; - scourgeRemaining = ENCOUNTER_TOTAL_SCOURGE; - - SendInitialWorldStates(); - - events.Reset(); - events.ScheduleEvent(EVENT_START_COUNTDOWN_1, 60000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_2, 120000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_3, 180000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_4, 240000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_5, 300000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_6, 308000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_7, 312000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_8, 316000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_9, 320000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_10, 324000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_11, 332000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_12, 335000); - events.ScheduleEvent(EVENT_START_COUNTDOWN_13, 337500); - events.ScheduleEvent(EVENT_START_COUNTDOWN_14, 345000); - } - } - - uint32 GetData(uint32 type) const - { - switch (type) - { - case WORLD_STATE_DEFENDERS_COUNT: return defendersRemaining; - case WORLD_STATE_SCOURGE_COUNT: return scourgeRemaining; - case WORLD_STATE_SOLDIERS_ENABLE: return me->IsAlive() && (startTimeRemaining || battleStarted); - case WORLD_STATE_COUNTDOWN_ENABLE: return me->IsAlive() && startTimeRemaining; - case WORLD_STATE_COUNTDOWN_TIME: return startTimeRemaining; - case WORLD_STATE_EVENT_BEGIN_ENABLE: return me->IsAlive() && !startTimeRemaining && battleStarted; - } - return 0; - } - - void SendUpdateWorldState(uint32 id, uint32 state) - { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (!players.isEmpty()) - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player* player = itr->GetSource()) - if (player->GetPhaseMask() & 128) // Xinef: client skips players without chapter 5 aura anyway, speedup - player->SendUpdateWorldState(id, state); - } - - void SendInitialWorldStates() - { - SendUpdateWorldState(WORLD_STATE_DEFENDERS_COUNT, GetData(WORLD_STATE_DEFENDERS_COUNT)); - SendUpdateWorldState(WORLD_STATE_SCOURGE_COUNT, GetData(WORLD_STATE_SCOURGE_COUNT)); - SendUpdateWorldState(WORLD_STATE_SOLDIERS_ENABLE, GetData(WORLD_STATE_SOLDIERS_ENABLE)); - SendUpdateWorldState(WORLD_STATE_COUNTDOWN_ENABLE, GetData(WORLD_STATE_COUNTDOWN_ENABLE)); - SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, GetData(WORLD_STATE_COUNTDOWN_TIME)); - SendUpdateWorldState(WORLD_STATE_EVENT_BEGIN_ENABLE, GetData(WORLD_STATE_EVENT_BEGIN_ENABLE)); - } - - void JustSummoned(Creature* cr) - { - summons.Summon(cr); - - if (me->IsInCombat() && cr->GetEntry() != NPC_HIGHLORD_TIRION_FORDRING && battleStarted == ENCOUNTER_STATE_FIGHT) - { - Position pos = LightOfDawnFightPos[urand(0, 9)]; - if (Unit* target = cr->SelectNearbyTarget(NULL, 10.0f)) - if (target->GetTypeId() == TYPEID_UNIT) - target->GetMotionMaster()->MoveCharge(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), me->GetSpeed(MOVE_RUN)); - cr->GetMotionMaster()->MoveCharge(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), me->GetSpeed(MOVE_RUN)); - } - - if (battleStarted == ENCOUNTER_STATE_OUTRO && cr->GetEntry() == NPC_DEFENDER_OF_THE_LIGHT) - { - cr->SetReactState(REACT_PASSIVE); - cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - cr->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); - cr->HandleEmoteCommand(EMOTE_STATE_READY1H); - } - } - - void SummonedCreatureDies(Creature* creature, Unit*) - { - // Refill Armies and update counters - if (battleStarted != ENCOUNTER_STATE_FIGHT) - return; - - me->m_Events.AddEvent(new DelayedSummonEvent(me, creature->GetEntry(), *creature), me->m_Events.CalculateTime(3000)); - if (creature->GetEntry() >= NPC_RAMPAGING_ABOMINATION) - { - --scourgeRemaining; - SendUpdateWorldState(WORLD_STATE_SCOURGE_COUNT, GetData(WORLD_STATE_SCOURGE_COUNT)); - } - else - { - --defendersRemaining; - SendUpdateWorldState(WORLD_STATE_DEFENDERS_COUNT, GetData(WORLD_STATE_DEFENDERS_COUNT)); - - if (defendersRemaining == 200) - FinishFight(); - } - } - - void JustDied(Unit*) - { - summons.DespawnAll(); - me->SetCorpseDelay(3*60); - me->SetRespawnTime(3*60); - } - - void FinishFight() - { - if (Creature* tirion = me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING, LightOfDawnPos[6], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000)) + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT && !startTimeRemaining && events.Empty()) { - tirion->LoadEquipment(0, true); - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN25); - events.Reset(); - events.ScheduleEvent(EVENT_FINISH_FIGHT_1, 10000); - events.ScheduleEvent(EVENT_FINISH_FIGHT_2, 20000); - events.ScheduleEvent(EVENT_FINISH_FIGHT_3, 22000); - events.ScheduleEvent(EVENT_FINISH_FIGHT_4, 23000); - events.ScheduleEvent(EVENT_FINISH_FIGHT_5, 24000); + Talk(SAY_LIGHT_OF_DAWN01); - tirion->SummonGameObject(GO_HOLY_LIGHTNING, 2254.84f, -5298.75f, 82.168f, 1.134f, 0, 0, 0.537102f, 0.843517f, 20); - tirion->SummonGameObject(GO_HOLY_LIGHTNING, 2296.24f, -5296.44f, 81.9964f, 5.3398f, 0, 0, 0.454395f, -0.8908f, 20); - tirion->SummonGameObject(GO_HOLY_LIGHTNING, 2314.29f, -5261.78f, 83.1349f, 3.05822f, 0, 0, 0.999131f, 0.0416735f, 20); - tirion->SummonGameObject(GO_HOLY_LIGHTNING, 2278.43f, -5270.14f, 81.7247f, 0.70988f, 0, 0, 0.347534f, 0.937667f, 20); + startTimeRemaining = ENCOUNTER_START_TIME; + defendersRemaining = ENCOUNTER_TOTAL_DEFENDERS; + scourgeRemaining = ENCOUNTER_TOTAL_SCOURGE; + + SendInitialWorldStates(); + + events.Reset(); + events.ScheduleEvent(EVENT_START_COUNTDOWN_1, 60000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_2, 120000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_3, 180000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_4, 240000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_5, 300000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_6, 308000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_7, 312000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_8, 316000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_9, 320000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_10, 324000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_11, 332000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_12, 335000); + events.ScheduleEvent(EVENT_START_COUNTDOWN_13, 337500); + events.ScheduleEvent(EVENT_START_COUNTDOWN_14, 345000); } - } + } - void EnterCombat(Unit*) - { - if (battleStarted != ENCOUNTER_STATE_FIGHT) - return; - - events.RescheduleEvent(EVENT_SPELL_ANTI_MAGIC_ZONE, 15000); - events.RescheduleEvent(EVENT_SPELL_DEATH_STRIKE, 8000); - events.RescheduleEvent(EVENT_SPELL_DEATH_EMBRACE, 5000); - events.RescheduleEvent(EVENT_SPELL_UNHOLY_BLIGHT, 10000); - events.RescheduleEvent(EVENT_SPELL_TALK, 10000); - } - - void Reset() - { - if (resetExecuted) - return; - - resetExecuted = true; - JustRespawned(); - } - - void JustRespawned() + uint32 GetData(uint32 type) const { - events.Reset(); - summons.DespawnAll(); + switch (type) + { + case WORLD_STATE_DEFENDERS_COUNT: return defendersRemaining; + case WORLD_STATE_SCOURGE_COUNT: return scourgeRemaining; + case WORLD_STATE_SOLDIERS_ENABLE: return me->IsAlive() && (startTimeRemaining || battleStarted); + case WORLD_STATE_COUNTDOWN_ENABLE: return me->IsAlive() && startTimeRemaining; + case WORLD_STATE_COUNTDOWN_TIME: return startTimeRemaining; + case WORLD_STATE_EVENT_BEGIN_ENABLE: return me->IsAlive() && !startTimeRemaining && battleStarted; + } + return 0; + } - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); - me->SetStandState(UNIT_STAND_STATE_STAND); + void SendUpdateWorldState(uint32 id, uint32 state) + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (!players.isEmpty()) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->GetSource()) + if (player->GetPhaseMask() & 128) // Xinef: client skips players without chapter 5 aura anyway, speedup + player->SendUpdateWorldState(id, state); + } + + void SendInitialWorldStates() + { + SendUpdateWorldState(WORLD_STATE_DEFENDERS_COUNT, GetData(WORLD_STATE_DEFENDERS_COUNT)); + SendUpdateWorldState(WORLD_STATE_SCOURGE_COUNT, GetData(WORLD_STATE_SCOURGE_COUNT)); + SendUpdateWorldState(WORLD_STATE_SOLDIERS_ENABLE, GetData(WORLD_STATE_SOLDIERS_ENABLE)); + SendUpdateWorldState(WORLD_STATE_COUNTDOWN_ENABLE, GetData(WORLD_STATE_COUNTDOWN_ENABLE)); + SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, GetData(WORLD_STATE_COUNTDOWN_TIME)); + SendUpdateWorldState(WORLD_STATE_EVENT_BEGIN_ENABLE, GetData(WORLD_STATE_EVENT_BEGIN_ENABLE)); + } + + void JustSummoned(Creature* cr) + { + summons.Summon(cr); + + if (me->IsInCombat() && cr->GetEntry() != NPC_HIGHLORD_TIRION_FORDRING && battleStarted == ENCOUNTER_STATE_FIGHT) + { + Position pos = LightOfDawnFightPos[urand(0, 9)]; + if (Unit* target = cr->SelectNearbyTarget(NULL, 10.0f)) + if (target->GetTypeId() == TYPEID_UNIT) + target->GetMotionMaster()->MoveCharge(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), me->GetSpeed(MOVE_RUN)); + cr->GetMotionMaster()->MoveCharge(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), me->GetSpeed(MOVE_RUN)); + } + + if (battleStarted == ENCOUNTER_STATE_OUTRO && cr->GetEntry() == NPC_DEFENDER_OF_THE_LIGHT) + { + cr->SetReactState(REACT_PASSIVE); + cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + cr->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); + cr->HandleEmoteCommand(EMOTE_STATE_READY1H); + } + } + + void SummonedCreatureDies(Creature* creature, Unit*) + { + // Refill Armies and update counters + if (battleStarted != ENCOUNTER_STATE_FIGHT) + return; + + me->m_Events.AddEvent(new DelayedSummonEvent(me, creature->GetEntry(), *creature), me->m_Events.CalculateTime(3000)); + if (creature->GetEntry() >= NPC_RAMPAGING_ABOMINATION) + { + --scourgeRemaining; + SendUpdateWorldState(WORLD_STATE_SCOURGE_COUNT, GetData(WORLD_STATE_SCOURGE_COUNT)); + } + else + { + --defendersRemaining; + SendUpdateWorldState(WORLD_STATE_DEFENDERS_COUNT, GetData(WORLD_STATE_DEFENDERS_COUNT)); + + if (defendersRemaining == 200) + FinishFight(); + } + } + + void JustDied(Unit*) + { + summons.DespawnAll(); + me->SetCorpseDelay(3*60); + me->SetRespawnTime(3*60); + } + + void FinishFight() + { + if (Creature* tirion = me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING, LightOfDawnPos[6], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000)) + { + tirion->LoadEquipment(0, true); + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN25); + events.Reset(); + events.ScheduleEvent(EVENT_FINISH_FIGHT_1, 10000); + events.ScheduleEvent(EVENT_FINISH_FIGHT_2, 20000); + events.ScheduleEvent(EVENT_FINISH_FIGHT_3, 22000); + events.ScheduleEvent(EVENT_FINISH_FIGHT_4, 23000); + events.ScheduleEvent(EVENT_FINISH_FIGHT_5, 24000); + + tirion->SummonGameObject(GO_HOLY_LIGHTNING, 2254.84f, -5298.75f, 82.168f, 1.134f, 0, 0, 0.537102f, 0.843517f, 20); + tirion->SummonGameObject(GO_HOLY_LIGHTNING, 2296.24f, -5296.44f, 81.9964f, 5.3398f, 0, 0, 0.454395f, -0.8908f, 20); + tirion->SummonGameObject(GO_HOLY_LIGHTNING, 2314.29f, -5261.78f, 83.1349f, 3.05822f, 0, 0, 0.999131f, 0.0416735f, 20); + tirion->SummonGameObject(GO_HOLY_LIGHTNING, 2278.43f, -5270.14f, 81.7247f, 0.70988f, 0, 0, 0.347534f, 0.937667f, 20); + } + } + + void EnterCombat(Unit*) + { + if (battleStarted != ENCOUNTER_STATE_FIGHT) + return; + + events.RescheduleEvent(EVENT_SPELL_ANTI_MAGIC_ZONE, 15000); + events.RescheduleEvent(EVENT_SPELL_DEATH_STRIKE, 8000); + events.RescheduleEvent(EVENT_SPELL_DEATH_EMBRACE, 5000); + events.RescheduleEvent(EVENT_SPELL_UNHOLY_BLIGHT, 10000); + events.RescheduleEvent(EVENT_SPELL_TALK, 10000); + } + + void Reset() + { + if (resetExecuted) + return; + + resetExecuted = true; + JustRespawned(); + } + + void JustRespawned() + { + events.Reset(); + summons.DespawnAll(); + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); + me->SetStandState(UNIT_STAND_STATE_STAND); me->SetVisible(true); - me->setActive(true); - me->SetWalk(false); + me->setActive(true); + me->SetWalk(false); - battleStarted = ENCOUNTER_STATE_NONE; - startTimeRemaining = 0; - defendersRemaining = 0; - scourgeRemaining = 0; + battleStarted = ENCOUNTER_STATE_NONE; + startTimeRemaining = 0; + defendersRemaining = 0; + scourgeRemaining = 0; - SendInitialWorldStates(); - me->SummonCreatureGroup(30); - } + SendInitialWorldStates(); + me->SummonCreatureGroup(30); + } - Creature* GetEntryFromSummons(uint32 entry) - { - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetEntry() == entry) - return summon; - return NULL; - } - - void MovementInform(uint32 type, uint32 point) - { - if (type == POINT_MOTION_TYPE && point == 2) - { - me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); - Talk(EMOTE_LIGHT_OF_DAWN05); - events.Reset(); - - events.ScheduleEvent(EVENT_OUTRO_SCENE_1, 2000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_2, 19000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_3, 38000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_4, 50000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_5, 62000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_6, 68000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_7, 71000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_8, 72000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_9, 74000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_10, 77000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_11, 79000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_12, 82000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_13, 85000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_14, 92000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_15, 98000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_16, 105000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_17, 120000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_18, 131000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_19, 158000); - } - } - - void UpdateAI(uint32 diff) + Creature* GetEntryFromSummons(uint32 entry) { - events.Update(diff); - uint32 eventId = events.ExecuteEvent(); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetEntry() == entry) + return summon; + return NULL; + } - switch (eventId) - { - case EVENT_START_COUNTDOWN_1: - SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, 4); - break; - case EVENT_START_COUNTDOWN_2: - SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, 3); - break; - case EVENT_START_COUNTDOWN_3: - SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, 2); - break; - case EVENT_START_COUNTDOWN_4: - Talk(SAY_LIGHT_OF_DAWN02); - SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, 1); - break; - case EVENT_START_COUNTDOWN_5: - battleStarted = ENCOUNTER_STATE_FIGHT; - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - Talk(SAY_LIGHT_OF_DAWN04); // Wrong order in DB! - SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, 0); - SendUpdateWorldState(WORLD_STATE_COUNTDOWN_ENABLE, 0); - SendUpdateWorldState(WORLD_STATE_EVENT_BEGIN_ENABLE, 1); - break; - case EVENT_START_COUNTDOWN_6: - case EVENT_START_COUNTDOWN_7: - case EVENT_START_COUNTDOWN_8: - case EVENT_START_COUNTDOWN_9: - case EVENT_START_COUNTDOWN_10: - if (eventId == EVENT_START_COUNTDOWN_6) - { - Talk(SAY_LIGHT_OF_DAWN05); - me->CastSpell(me, SPELL_CAMERA_SHAKE_INIT, true); - } - else - me->CastSpell(me, SPELL_CAMERA_SHAKE, true); - me->SummonCreatureGroup(eventId - EVENT_START_COUNTDOWN_6); - break; - case EVENT_START_COUNTDOWN_11: - Talk(SAY_LIGHT_OF_DAWN06); - break; - case EVENT_START_COUNTDOWN_12: - summons.DoAction(ACTION_PLAY_EMOTE); - break; - case EVENT_START_COUNTDOWN_13: - { - uint8 first = 1; - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - { - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - { - Position pos = LightOfDawnPos[first]; - summon->SetHomePosition(pos); - summon->GetMotionMaster()->MovePoint(1, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, false); - } - first = first == 0 ? 1 : 0; - } - Position pos = LightOfDawnPos[first]; - me->SetHomePosition(pos); - me->SetWalk(false); - me->GetMotionMaster()->MovePoint(1, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, true); - me->CastSpell(me, SPELL_THE_MIGHT_OF_MOGRAINE, true); - break; - } - case EVENT_START_COUNTDOWN_14: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->SummonCreatureGroup(5); - return; - case EVENT_FINISH_FIGHT_1: - summons.DespawnEntry(NPC_DEFENDER_OF_THE_LIGHT); - battleStarted = ENCOUNTER_STATE_OUTRO; - break; - case EVENT_FINISH_FIGHT_2: - { - summons.DespawnEntry(NPC_RAMPAGING_ABOMINATION); - summons.DespawnEntry(NPC_ACHERUS_GHOUL); - summons.DespawnEntry(NPC_WARRIOR_OF_THE_FROZEN_WASTES); - summons.DespawnEntry(NPC_FLESH_BEHEMOTH); - summons.DespawnEntry(NPC_DEFENDER_OF_THE_LIGHT); + void MovementInform(uint32 type, uint32 point) + { + if (type == POINT_MOTION_TYPE && point == 2) + { + me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); + Talk(EMOTE_LIGHT_OF_DAWN05); + events.Reset(); - if (Creature* orbaz = GetEntryFromSummons(NPC_ORBAZ_BLOODBANE)) - { - orbaz->SetReactState(REACT_PASSIVE); - orbaz->AI()->Talk(EMOTE_LIGHT_OF_DAWN04); - orbaz->GetMotionMaster()->MovePoint(2, LightOfDawnPos[2], true, true); - orbaz->DespawnOrUnsummon(7000); - } + events.ScheduleEvent(EVENT_OUTRO_SCENE_1, 2000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_2, 19000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_3, 38000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_4, 50000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_5, 62000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_6, 68000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_7, 71000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_8, 72000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_9, 74000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_10, 77000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_11, 79000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_12, 82000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_13, 85000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_14, 92000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_15, 98000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_16, 105000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_17, 120000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_18, 131000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_19, 158000); + } + } - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - { - summon->CombatStop(true); - summon->DeleteThreatList(); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - summon->SetReactState(REACT_PASSIVE); - summon->GetMotionMaster()->Clear(false); - } - me->CombatStop(true); - me->DeleteThreatList(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->Clear(false); + void UpdateAI(uint32 diff) + { + events.Update(diff); + uint32 eventId = events.ExecuteEvent(); - // Position main stars - summons.DoAction(ACTION_POSITION_NPCS); + switch (eventId) + { + case EVENT_START_COUNTDOWN_1: + SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, 4); + break; + case EVENT_START_COUNTDOWN_2: + SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, 3); + break; + case EVENT_START_COUNTDOWN_3: + SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, 2); + break; + case EVENT_START_COUNTDOWN_4: + Talk(SAY_LIGHT_OF_DAWN02); + SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, 1); + break; + case EVENT_START_COUNTDOWN_5: + battleStarted = ENCOUNTER_STATE_FIGHT; + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + Talk(SAY_LIGHT_OF_DAWN04); // Wrong order in DB! + SendUpdateWorldState(WORLD_STATE_COUNTDOWN_TIME, 0); + SendUpdateWorldState(WORLD_STATE_COUNTDOWN_ENABLE, 0); + SendUpdateWorldState(WORLD_STATE_EVENT_BEGIN_ENABLE, 1); + break; + case EVENT_START_COUNTDOWN_6: + case EVENT_START_COUNTDOWN_7: + case EVENT_START_COUNTDOWN_8: + case EVENT_START_COUNTDOWN_9: + case EVENT_START_COUNTDOWN_10: + if (eventId == EVENT_START_COUNTDOWN_6) + { + Talk(SAY_LIGHT_OF_DAWN05); + me->CastSpell(me, SPELL_CAMERA_SHAKE_INIT, true); + } + else + me->CastSpell(me, SPELL_CAMERA_SHAKE, true); + me->SummonCreatureGroup(eventId - EVENT_START_COUNTDOWN_6); + break; + case EVENT_START_COUNTDOWN_11: + Talk(SAY_LIGHT_OF_DAWN06); + break; + case EVENT_START_COUNTDOWN_12: + summons.DoAction(ACTION_PLAY_EMOTE); + break; + case EVENT_START_COUNTDOWN_13: + { + uint8 first = 1; + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + { + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + { + Position pos = LightOfDawnPos[first]; + summon->SetHomePosition(pos); + summon->GetMotionMaster()->MovePoint(1, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, false); + } + first = first == 0 ? 1 : 0; + } + Position pos = LightOfDawnPos[first]; + me->SetHomePosition(pos); + me->SetWalk(false); + me->GetMotionMaster()->MovePoint(1, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, true); + me->CastSpell(me, SPELL_THE_MIGHT_OF_MOGRAINE, true); + break; + } + case EVENT_START_COUNTDOWN_14: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SummonCreatureGroup(5); + return; + case EVENT_FINISH_FIGHT_1: + summons.DespawnEntry(NPC_DEFENDER_OF_THE_LIGHT); + battleStarted = ENCOUNTER_STATE_OUTRO; + break; + case EVENT_FINISH_FIGHT_2: + { + summons.DespawnEntry(NPC_RAMPAGING_ABOMINATION); + summons.DespawnEntry(NPC_ACHERUS_GHOUL); + summons.DespawnEntry(NPC_WARRIOR_OF_THE_FROZEN_WASTES); + summons.DespawnEntry(NPC_FLESH_BEHEMOTH); + summons.DespawnEntry(NPC_DEFENDER_OF_THE_LIGHT); - me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, 2276.66f, -5273.60f, 81.86f, 5.14f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, 2272.11f, -5279.08f, 82.01f, 5.69f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, 2285.11f, -5276.73f, 82.08f, 4.23f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, 2290.06f, -5286.41f, 82.51f, 3.16f, TEMPSUMMON_CORPSE_DESPAWN); - break; - } - case EVENT_FINISH_FIGHT_3: - if (Creature* koltira = GetEntryFromSummons(NPC_KOLTIRA_DEATHWEAVER)) - { - koltira->SetWalk(true); - koltira->SetHomePosition(*koltira); - koltira->CastSpell(koltira, SPELL_THE_LIGHT_OF_DAWN, false); - koltira->GetMotionMaster()->MoveCharge(LightOfDawnPos[3].GetPositionX(), LightOfDawnPos[3].GetPositionY(), LightOfDawnPos[3].GetPositionZ(), 4.0f, 2); - } - break; - case EVENT_FINISH_FIGHT_4: - if (Creature* thassarin = GetEntryFromSummons(NPC_THASSARIAN)) - { - thassarin->SetWalk(true); - thassarin->SetHomePosition(*thassarin); - thassarin->CastSpell(thassarin, SPELL_THE_LIGHT_OF_DAWN, false); - thassarin->GetMotionMaster()->MoveCharge(LightOfDawnPos[4].GetPositionX(), LightOfDawnPos[4].GetPositionY(), LightOfDawnPos[4].GetPositionZ(), 4.0f, 2); - } - break; - case EVENT_FINISH_FIGHT_5: - me->SetWalk(true); - me->SetHomePosition(*me); - me->RemoveAllAuras(); - me->CastSpell(me, SPELL_THE_LIGHT_OF_DAWN, false); - me->GetMotionMaster()->MoveCharge(LightOfDawnPos[5].GetPositionX(), LightOfDawnPos[5].GetPositionY(), LightOfDawnPos[5].GetPositionZ(), 4.0f, 2); + if (Creature* orbaz = GetEntryFromSummons(NPC_ORBAZ_BLOODBANE)) + { + orbaz->SetReactState(REACT_PASSIVE); + orbaz->AI()->Talk(EMOTE_LIGHT_OF_DAWN04); + orbaz->GetMotionMaster()->MovePoint(2, LightOfDawnPos[2], true, true); + orbaz->DespawnOrUnsummon(7000); + } - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN26); - break; - case EVENT_OUTRO_SCENE_1: - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->SetFacingTo(4.8f); - Talk(SAY_LIGHT_OF_DAWN27); - break; - case EVENT_OUTRO_SCENE_2: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN28); - break; - case EVENT_OUTRO_SCENE_3: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN29); - break; - case EVENT_OUTRO_SCENE_4: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN30); - break; - case EVENT_OUTRO_SCENE_5: - me->SetStandState(UNIT_STAND_STATE_STAND); - Talk(SAY_LIGHT_OF_DAWN31); - break; - case EVENT_OUTRO_SCENE_6: - if (Creature* alex = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightOfDawnPos[7].GetPositionX(), LightOfDawnPos[7].GetPositionY(), LightOfDawnPos[7].GetPositionZ(), LightOfDawnPos[7].GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + { + summon->CombatStop(true); + summon->DeleteThreatList(); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetReactState(REACT_PASSIVE); + summon->GetMotionMaster()->Clear(false); + } + me->CombatStop(true); + me->DeleteThreatList(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->Clear(false); + + // Position main stars + summons.DoAction(ACTION_POSITION_NPCS); + + me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, 2276.66f, -5273.60f, 81.86f, 5.14f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, 2272.11f, -5279.08f, 82.01f, 5.69f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, 2285.11f, -5276.73f, 82.08f, 4.23f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, 2290.06f, -5286.41f, 82.51f, 3.16f, TEMPSUMMON_CORPSE_DESPAWN); + break; + } + case EVENT_FINISH_FIGHT_3: + if (Creature* koltira = GetEntryFromSummons(NPC_KOLTIRA_DEATHWEAVER)) + { + koltira->SetWalk(true); + koltira->SetHomePosition(*koltira); + koltira->CastSpell(koltira, SPELL_THE_LIGHT_OF_DAWN, false); + koltira->GetMotionMaster()->MoveCharge(LightOfDawnPos[3].GetPositionX(), LightOfDawnPos[3].GetPositionY(), LightOfDawnPos[3].GetPositionZ(), 4.0f, 2); + } + break; + case EVENT_FINISH_FIGHT_4: + if (Creature* thassarin = GetEntryFromSummons(NPC_THASSARIAN)) + { + thassarin->SetWalk(true); + thassarin->SetHomePosition(*thassarin); + thassarin->CastSpell(thassarin, SPELL_THE_LIGHT_OF_DAWN, false); + thassarin->GetMotionMaster()->MoveCharge(LightOfDawnPos[4].GetPositionX(), LightOfDawnPos[4].GetPositionY(), LightOfDawnPos[4].GetPositionZ(), 4.0f, 2); + } + break; + case EVENT_FINISH_FIGHT_5: + me->SetWalk(true); + me->SetHomePosition(*me); + me->RemoveAllAuras(); + me->CastSpell(me, SPELL_THE_LIGHT_OF_DAWN, false); + me->GetMotionMaster()->MoveCharge(LightOfDawnPos[5].GetPositionX(), LightOfDawnPos[5].GetPositionY(), LightOfDawnPos[5].GetPositionZ(), 4.0f, 2); + + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN26); + break; + case EVENT_OUTRO_SCENE_1: + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->SetFacingTo(4.8f); + Talk(SAY_LIGHT_OF_DAWN27); + break; + case EVENT_OUTRO_SCENE_2: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN28); + break; + case EVENT_OUTRO_SCENE_3: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN29); + break; + case EVENT_OUTRO_SCENE_4: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN30); + break; + case EVENT_OUTRO_SCENE_5: + me->SetStandState(UNIT_STAND_STATE_STAND); + Talk(SAY_LIGHT_OF_DAWN31); + break; + case EVENT_OUTRO_SCENE_6: + if (Creature* alex = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightOfDawnPos[7].GetPositionX(), LightOfDawnPos[7].GetPositionY(), LightOfDawnPos[7].GetPositionZ(), LightOfDawnPos[7].GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) { alex->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - alex->GetMotionMaster()->MovePoint(0, LightOfDawnPos[8].GetPositionX(), LightOfDawnPos[8].GetPositionY(), LightOfDawnPos[8].GetPositionZ()); + alex->GetMotionMaster()->MovePoint(0, LightOfDawnPos[8].GetPositionX(), LightOfDawnPos[8].GetPositionY(), LightOfDawnPos[8].GetPositionZ()); alex->CastSpell(alex, SPELL_ALEXANDROS_MOGRAINE_SPAWN, true); //alex->AI()->Talk(EMOTE_LIGHT_OF_DAWN06); } break; - case EVENT_OUTRO_SCENE_7: + case EVENT_OUTRO_SCENE_7: if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE)) { alex->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); alex->AI()->Talk(SAY_LIGHT_OF_DAWN32); - me->SetFacingToObject(alex); + me->SetFacingToObject(alex); } break; - case EVENT_OUTRO_SCENE_8: - Talk(SAY_LIGHT_OF_DAWN33); - break; + case EVENT_OUTRO_SCENE_8: + Talk(SAY_LIGHT_OF_DAWN33); + break; case EVENT_OUTRO_SCENE_9: me->SetStandState(UNIT_STAND_STATE_KNEEL); Talk(SAY_LIGHT_OF_DAWN34); @@ -802,7 +802,7 @@ public: if (Creature* darion = GetEntryFromSummons(NPC_DARION_MOGRAINE)) darion->AI()->Talk(EMOTE_LIGHT_OF_DAWN08); break; - case EVENT_OUTRO_SCENE_13: + case EVENT_OUTRO_SCENE_13: if (Creature* darion = GetEntryFromSummons(NPC_DARION_MOGRAINE)) darion->AI()->Talk(SAY_LIGHT_OF_DAWN36); break; @@ -810,7 +810,7 @@ public: if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE)) alex->AI()->Talk(SAY_LIGHT_OF_DAWN37); break; - case EVENT_OUTRO_SCENE_15: + case EVENT_OUTRO_SCENE_15: if (Creature* darion = GetEntryFromSummons(NPC_DARION_MOGRAINE)) darion->AI()->Talk(SAY_LIGHT_OF_DAWN38); break; @@ -818,10 +818,10 @@ public: if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE)) alex->AI()->Talk(SAY_LIGHT_OF_DAWN39); - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) tirion->GetMotionMaster()->MovePoint(0, LightOfDawnPos[11].GetPositionX(), LightOfDawnPos[11].GetPositionY(), LightOfDawnPos[11].GetPositionZ()); break; - case EVENT_OUTRO_SCENE_17: + case EVENT_OUTRO_SCENE_17: if (Creature* darion = GetEntryFromSummons(NPC_DARION_MOGRAINE)) darion->AI()->Talk(SAY_LIGHT_OF_DAWN40); break; @@ -829,38 +829,38 @@ public: if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE)) alex->AI()->Talk(SAY_LIGHT_OF_DAWN41); - if (Creature* darion = GetEntryFromSummons(NPC_DARION_MOGRAINE)) - darion->DespawnOrUnsummon(3000); + if (Creature* darion = GetEntryFromSummons(NPC_DARION_MOGRAINE)) + darion->DespawnOrUnsummon(3000); break; case EVENT_OUTRO_SCENE_19: if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE)) alex->AI()->Talk(SAY_LIGHT_OF_DAWN42); - events.Reset(); - events.ScheduleEvent(EVENT_OUTRO_SCENE_20, 4000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_21, 4500); - events.ScheduleEvent(EVENT_OUTRO_SCENE_22, 7000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_23, 9000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_24, 14000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_25, 21200); - events.ScheduleEvent(EVENT_OUTRO_SCENE_26, 22500); - events.ScheduleEvent(EVENT_OUTRO_SCENE_27, 24000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_28, 28000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_29, 34000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_30, 36000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_31, 51000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_32, 68000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_33, 73000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_34, 76000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_35, 77000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_36, 81000); + events.Reset(); + events.ScheduleEvent(EVENT_OUTRO_SCENE_20, 4000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_21, 4500); + events.ScheduleEvent(EVENT_OUTRO_SCENE_22, 7000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_23, 9000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_24, 14000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_25, 21200); + events.ScheduleEvent(EVENT_OUTRO_SCENE_26, 22500); + events.ScheduleEvent(EVENT_OUTRO_SCENE_27, 24000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_28, 28000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_29, 34000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_30, 36000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_31, 51000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_32, 68000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_33, 73000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_34, 76000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_35, 77000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_36, 81000); break; - case EVENT_OUTRO_SCENE_20: - if (Creature* lk = me->SummonCreature(NPC_THE_LICH_KING, LightOfDawnPos[12].GetPositionX(), LightOfDawnPos[12].GetPositionY(), LightOfDawnPos[12].GetPositionZ(), LightOfDawnPos[12].GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + case EVENT_OUTRO_SCENE_20: + if (Creature* lk = me->SummonCreature(NPC_THE_LICH_KING, LightOfDawnPos[12].GetPositionX(), LightOfDawnPos[12].GetPositionY(), LightOfDawnPos[12].GetPositionZ(), LightOfDawnPos[12].GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) lk->AI()->Talk(SAY_LIGHT_OF_DAWN43); break; - case EVENT_OUTRO_SCENE_21: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + case EVENT_OUTRO_SCENE_21: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) lk->CastSpell(lk, SPELL_ICEBOUND_VISAGE, true); break; case EVENT_OUTRO_SCENE_22: @@ -868,20 +868,20 @@ public: { lk->AI()->Talk(SAY_LIGHT_OF_DAWN45); if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE)) - { - alex->RemoveAllAuras(); + { + alex->RemoveAllAuras(); lk->CastSpell(alex, SPELL_SOUL_FEAST_ALEX, false); - } + } } break; - case EVENT_OUTRO_SCENE_23: + case EVENT_OUTRO_SCENE_23: if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE)) { - alex->DespawnOrUnsummon(5000); + alex->DespawnOrUnsummon(5000); alex->SetVisible(false); } break; - case EVENT_OUTRO_SCENE_24: + case EVENT_OUTRO_SCENE_24: me->SetStandState(UNIT_STAND_STATE_STAND); Talk(SAY_LIGHT_OF_DAWN44); break; @@ -889,40 +889,40 @@ public: if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) lk->GetMotionMaster()->MovePoint(0, LightOfDawnPos[13].GetPositionX(), LightOfDawnPos[13].GetPositionY(), LightOfDawnPos[13].GetPositionZ()); break; - case EVENT_OUTRO_SCENE_26: - me->CastSpell(me, SPELL_MOGRAINE_CHARGE, false); + case EVENT_OUTRO_SCENE_26: + me->CastSpell(me, SPELL_MOGRAINE_CHARGE, false); break; - case EVENT_OUTRO_SCENE_27: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - { - lk->AI()->Talk(SAY_LIGHT_OF_DAWN46); - lk->CastSpell(me, SPELL_REBUKE, false); - } - break; - case EVENT_OUTRO_SCENE_28: + case EVENT_OUTRO_SCENE_27: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + { + lk->AI()->Talk(SAY_LIGHT_OF_DAWN46); + lk->CastSpell(me, SPELL_REBUKE, false); + } + break; + case EVENT_OUTRO_SCENE_28: me->SetStandState(UNIT_STAND_STATE_KNEEL); if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - { + { tirion->AI()->Talk(SAY_LIGHT_OF_DAWN47); - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - tirion->SetFacingToObject(lk); - } + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + tirion->SetFacingToObject(lk); + } + break; + case EVENT_OUTRO_SCENE_29: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + { + lk->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); + lk->PlayDirectSound(14820); + } + break; + case EVENT_OUTRO_SCENE_30: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + lk->AI()->Talk(SAY_LIGHT_OF_DAWN48); + break; + case EVENT_OUTRO_SCENE_31: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + lk->AI()->Talk(SAY_LIGHT_OF_DAWN49); break; - case EVENT_OUTRO_SCENE_29: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - { - lk->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - lk->PlayDirectSound(14820); - } - break; - case EVENT_OUTRO_SCENE_30: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - lk->AI()->Talk(SAY_LIGHT_OF_DAWN48); - break; - case EVENT_OUTRO_SCENE_31: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - lk->AI()->Talk(SAY_LIGHT_OF_DAWN49); - break; case EVENT_OUTRO_SCENE_32: if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) { @@ -932,192 +932,192 @@ public: tirion->AI()->Talk(EMOTE_LIGHT_OF_DAWN12); } - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetEntry() <= NPC_RIMBLAT_EARTHSHATTER && summon->GetEntry() != NPC_HIGHLORD_TIRION_FORDRING) - { - float o = lk->GetAngle(summon); - summon->GetMotionMaster()->MovePoint(3, lk->GetPositionX() + 2.0f*cos(o), lk->GetPositionY() + 2.0f*sin(o), lk->GetPositionZ()); - summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); - } - } + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetEntry() <= NPC_RIMBLAT_EARTHSHATTER && summon->GetEntry() != NPC_HIGHLORD_TIRION_FORDRING) + { + float o = lk->GetAngle(summon); + summon->GetMotionMaster()->MovePoint(3, lk->GetPositionX() + 2.0f*cos(o), lk->GetPositionY() + 2.0f*sin(o), lk->GetPositionZ()); + summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); + } + } break; - case EVENT_OUTRO_SCENE_33: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - { - lk->AI()->Talk(SAY_LIGHT_OF_DAWN51); - lk->CastSpell(lk, SPELL_APOCALYPSE, true); - } - break; - case EVENT_OUTRO_SCENE_34: - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetEntry() <= NPC_RIMBLAT_EARTHSHATTER && summon->GetEntry() != NPC_HIGHLORD_TIRION_FORDRING) - Unit::Kill(summon, summon); - break; - case EVENT_OUTRO_SCENE_35: - Talk(SAY_LIGHT_OF_DAWN52); - break; - case EVENT_OUTRO_SCENE_36: - me->SetStandState(UNIT_STAND_STATE_STAND); - Talk(SAY_LIGHT_OF_DAWN53); - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - me->SetFacingToObject(tirion); + case EVENT_OUTRO_SCENE_33: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + { + lk->AI()->Talk(SAY_LIGHT_OF_DAWN51); + lk->CastSpell(lk, SPELL_APOCALYPSE, true); + } + break; + case EVENT_OUTRO_SCENE_34: + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetEntry() <= NPC_RIMBLAT_EARTHSHATTER && summon->GetEntry() != NPC_HIGHLORD_TIRION_FORDRING) + Unit::Kill(summon, summon); + break; + case EVENT_OUTRO_SCENE_35: + Talk(SAY_LIGHT_OF_DAWN52); + break; + case EVENT_OUTRO_SCENE_36: + me->SetStandState(UNIT_STAND_STATE_STAND); + Talk(SAY_LIGHT_OF_DAWN53); + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + me->SetFacingToObject(tirion); - events.Reset(); - events.ScheduleEvent(EVENT_OUTRO_SCENE_37, 1000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_38, 5000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_39, 7000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_40, 9000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_41, 13000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_42, 16000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_43, 17000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_44, 19000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_45, 25000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_46, 32000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_47, 42000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_48, 52000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_49, 54000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_50, 58000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_51, 65000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_52, 70000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_53, 84000); - break; - case EVENT_OUTRO_SCENE_37: - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); - me->CastSpell(me, SPELL_THROW_ASHBRINGER, true); - break; - case EVENT_OUTRO_SCENE_38: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - { - tirion->RemoveAllAuras(); - tirion->CastSpell(me, SPELL_REBIRTH_OF_THE_ASHBRINGER, true); - tirion->SummonGameObject(GO_LIGHT_OF_DAWN, tirion->GetPositionX(), tirion->GetPositionY(), tirion->GetPositionZ(), tirion->GetOrientation(), 0, 0, 0, 0, 180); - tirion->LoadEquipment(1, true); - } - me->SetStandState(UNIT_STAND_STATE_DEAD); - break; - case EVENT_OUTRO_SCENE_39: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - { - tirion->RemoveAllAuras(); - tirion->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - } - break; - case EVENT_OUTRO_SCENE_40: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN54); - break; - case EVENT_OUTRO_SCENE_41: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - lk->AI()->Talk(SAY_LIGHT_OF_DAWN55); - break; - case EVENT_OUTRO_SCENE_42: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN56); - break; - case EVENT_OUTRO_SCENE_43: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - { - tirion->CastSpell(tirion, SPELL_TIRION_CHARGE, true); - tirion->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - tirion->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - } - break; - case EVENT_OUTRO_SCENE_44: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - lk->AI()->Talk(SAY_LIGHT_OF_DAWN57); - break; - case EVENT_OUTRO_SCENE_45: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - lk->AI()->Talk(SAY_LIGHT_OF_DAWN58); - break; - case EVENT_OUTRO_SCENE_46: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - lk->AI()->Talk(SAY_LIGHT_OF_DAWN59); - break; - case EVENT_OUTRO_SCENE_47: - if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) - { - lk->CastSpell(lk, SPELL_EXIT_TELEPORT_VISUAL, true); - lk->DespawnOrUnsummon(1500); - } + events.Reset(); + events.ScheduleEvent(EVENT_OUTRO_SCENE_37, 1000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_38, 5000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_39, 7000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_40, 9000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_41, 13000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_42, 16000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_43, 17000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_44, 19000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_45, 25000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_46, 32000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_47, 42000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_48, 52000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_49, 54000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_50, 58000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_51, 65000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_52, 70000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_53, 84000); + break; + case EVENT_OUTRO_SCENE_37: + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); + me->CastSpell(me, SPELL_THROW_ASHBRINGER, true); + break; + case EVENT_OUTRO_SCENE_38: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + { + tirion->RemoveAllAuras(); + tirion->CastSpell(me, SPELL_REBIRTH_OF_THE_ASHBRINGER, true); + tirion->SummonGameObject(GO_LIGHT_OF_DAWN, tirion->GetPositionX(), tirion->GetPositionY(), tirion->GetPositionZ(), tirion->GetOrientation(), 0, 0, 0, 0, 180); + tirion->LoadEquipment(1, true); + } + me->SetStandState(UNIT_STAND_STATE_DEAD); + break; + case EVENT_OUTRO_SCENE_39: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + { + tirion->RemoveAllAuras(); + tirion->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + } + break; + case EVENT_OUTRO_SCENE_40: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN54); + break; + case EVENT_OUTRO_SCENE_41: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + lk->AI()->Talk(SAY_LIGHT_OF_DAWN55); + break; + case EVENT_OUTRO_SCENE_42: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN56); + break; + case EVENT_OUTRO_SCENE_43: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + { + tirion->CastSpell(tirion, SPELL_TIRION_CHARGE, true); + tirion->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + tirion->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + } + break; + case EVENT_OUTRO_SCENE_44: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + lk->AI()->Talk(SAY_LIGHT_OF_DAWN57); + break; + case EVENT_OUTRO_SCENE_45: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + lk->AI()->Talk(SAY_LIGHT_OF_DAWN58); + break; + case EVENT_OUTRO_SCENE_46: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + lk->AI()->Talk(SAY_LIGHT_OF_DAWN59); + break; + case EVENT_OUTRO_SCENE_47: + if (Creature* lk = GetEntryFromSummons(NPC_THE_LICH_KING)) + { + lk->CastSpell(lk, SPELL_EXIT_TELEPORT_VISUAL, true); + lk->DespawnOrUnsummon(1500); + } - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - { - float o = me->GetAngle(tirion); - tirion->GetMotionMaster()->MovePoint(4, me->GetPositionX() + 2.0f*cos(o), me->GetPositionY() + 2.0f*sin(o), me->GetPositionZ(), false); - tirion->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - tirion->setFaction(35); - } - break; - case EVENT_OUTRO_SCENE_48: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->CastSpell(me, SPELL_LAY_ON_HANDS, false); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - break; - case EVENT_OUTRO_SCENE_49: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - { - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN60); - tirion->SetWalk(true); - } - break; - case EVENT_OUTRO_SCENE_50: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->GetMotionMaster()->MovePoint(4, LightOfDawnPos[14].GetPositionX(), LightOfDawnPos[14].GetPositionY(), LightOfDawnPos[14].GetPositionZ()); - break; - case EVENT_OUTRO_SCENE_51: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->GetMotionMaster()->MovePoint(4, LightOfDawnPos[15].GetPositionX(), LightOfDawnPos[15].GetPositionY(), LightOfDawnPos[15].GetPositionZ()); - break; - case EVENT_OUTRO_SCENE_52: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - { - tirion->SetFacingToObject(me); - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN61); - } - break; - case EVENT_OUTRO_SCENE_53: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN62); + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + { + float o = me->GetAngle(tirion); + tirion->GetMotionMaster()->MovePoint(4, me->GetPositionX() + 2.0f*cos(o), me->GetPositionY() + 2.0f*sin(o), me->GetPositionZ(), false); + tirion->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + tirion->setFaction(35); + } + break; + case EVENT_OUTRO_SCENE_48: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->CastSpell(me, SPELL_LAY_ON_HANDS, false); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + break; + case EVENT_OUTRO_SCENE_49: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + { + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN60); + tirion->SetWalk(true); + } + break; + case EVENT_OUTRO_SCENE_50: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->GetMotionMaster()->MovePoint(4, LightOfDawnPos[14].GetPositionX(), LightOfDawnPos[14].GetPositionY(), LightOfDawnPos[14].GetPositionZ()); + break; + case EVENT_OUTRO_SCENE_51: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->GetMotionMaster()->MovePoint(4, LightOfDawnPos[15].GetPositionX(), LightOfDawnPos[15].GetPositionY(), LightOfDawnPos[15].GetPositionZ()); + break; + case EVENT_OUTRO_SCENE_52: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + { + tirion->SetFacingToObject(me); + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN61); + } + break; + case EVENT_OUTRO_SCENE_53: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN62); - events.Reset(); - events.ScheduleEvent(EVENT_OUTRO_SCENE_54, 6000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_55, 14000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_56, 27000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_57, 37000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_58, 44000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_59, 50000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_60, 63000); - events.ScheduleEvent(EVENT_OUTRO_SCENE_61, 150000); - break; - case EVENT_OUTRO_SCENE_54: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN63); - break; - case EVENT_OUTRO_SCENE_55: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN64); - break; - case EVENT_OUTRO_SCENE_56: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN65); - break; - case EVENT_OUTRO_SCENE_57: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN66); - break; - case EVENT_OUTRO_SCENE_58: - if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) - tirion->AI()->Talk(SAY_LIGHT_OF_DAWN67); - break; - case EVENT_OUTRO_SCENE_59: - Talk(SAY_LIGHT_OF_DAWN68); - me->SetStandState(UNIT_STAND_STATE_STAND); - break; - case EVENT_OUTRO_SCENE_60: - { + events.Reset(); + events.ScheduleEvent(EVENT_OUTRO_SCENE_54, 6000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_55, 14000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_56, 27000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_57, 37000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_58, 44000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_59, 50000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_60, 63000); + events.ScheduleEvent(EVENT_OUTRO_SCENE_61, 150000); + break; + case EVENT_OUTRO_SCENE_54: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN63); + break; + case EVENT_OUTRO_SCENE_55: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN64); + break; + case EVENT_OUTRO_SCENE_56: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN65); + break; + case EVENT_OUTRO_SCENE_57: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN66); + break; + case EVENT_OUTRO_SCENE_58: + if (Creature* tirion = GetEntryFromSummons(NPC_HIGHLORD_TIRION_FORDRING)) + tirion->AI()->Talk(SAY_LIGHT_OF_DAWN67); + break; + case EVENT_OUTRO_SCENE_59: + Talk(SAY_LIGHT_OF_DAWN68); + me->SetStandState(UNIT_STAND_STATE_STAND); + break; + case EVENT_OUTRO_SCENE_60: + { Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); if (!PlayerList.isEmpty()) { @@ -1125,48 +1125,48 @@ public: if (i->GetSource()->IsAlive() && me->IsWithinDistInMap(i->GetSource(), 100)) i->GetSource()->CastSpell(i->GetSource(), SPELL_THE_LIGHT_OF_DAWN_Q, false); } - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); - break; - } - case EVENT_OUTRO_SCENE_61: - summons.DespawnAll(); - me->DespawnOrUnsummon(1); - events.Reset(); - return; - } + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); + break; + } + case EVENT_OUTRO_SCENE_61: + summons.DespawnAll(); + me->DespawnOrUnsummon(1); + events.Reset(); + return; + } - if (battleStarted != ENCOUNTER_STATE_FIGHT) - return; + if (battleStarted != ENCOUNTER_STATE_FIGHT) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - switch (eventId) - { - case EVENT_SPELL_ANTI_MAGIC_ZONE: - DoCast(me, SPELL_ANTI_MAGIC_ZONE1); - events.RescheduleEvent(eventId, urand(25000, 30000)); - break; - case EVENT_SPELL_DEATH_STRIKE: - DoCastVictim(SPELL_DEATH_STRIKE); - events.RescheduleEvent(eventId, urand(5000, 10000)); - break; - case EVENT_SPELL_DEATH_EMBRACE: - DoCastVictim(SPELL_DEATH_EMBRACE); - events.RescheduleEvent(eventId, urand(15000, 20000)); - break; - case EVENT_SPELL_UNHOLY_BLIGHT: - DoCast(me, SPELL_UNHOLY_BLIGHT); - events.RescheduleEvent(eventId, 60000); - break; - case EVENT_SPELL_TALK: - Talk(SAY_LIGHT_OF_DAWN09); - events.RescheduleEvent(eventId, urand(15000, 20000)); - break; - } + switch (eventId) + { + case EVENT_SPELL_ANTI_MAGIC_ZONE: + DoCast(me, SPELL_ANTI_MAGIC_ZONE1); + events.RescheduleEvent(eventId, urand(25000, 30000)); + break; + case EVENT_SPELL_DEATH_STRIKE: + DoCastVictim(SPELL_DEATH_STRIKE); + events.RescheduleEvent(eventId, urand(5000, 10000)); + break; + case EVENT_SPELL_DEATH_EMBRACE: + DoCastVictim(SPELL_DEATH_EMBRACE); + events.RescheduleEvent(eventId, urand(15000, 20000)); + break; + case EVENT_SPELL_UNHOLY_BLIGHT: + DoCast(me, SPELL_UNHOLY_BLIGHT); + events.RescheduleEvent(eventId, 60000); + break; + case EVENT_SPELL_TALK: + Talk(SAY_LIGHT_OF_DAWN09); + events.RescheduleEvent(eventId, urand(15000, 20000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; }; @@ -1181,18 +1181,18 @@ class spell_chapter5_light_of_dawn_aura : public SpellScriptLoader void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->Dismount(); - GetUnitOwner()->SetCanFly(true); - GetUnitOwner()->SetDisableGravity(true); - GetUnitOwner()->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); + GetUnitOwner()->Dismount(); + GetUnitOwner()->SetCanFly(true); + GetUnitOwner()->SetDisableGravity(true); + GetUnitOwner()->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->SetCanFly(false); - GetUnitOwner()->SetDisableGravity(false); - GetUnitOwner()->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING); - GetUnitOwner()->GetMotionMaster()->MoveFall(); + GetUnitOwner()->SetCanFly(false); + GetUnitOwner()->SetDisableGravity(false); + GetUnitOwner()->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING); + GetUnitOwner()->GetMotionMaster()->MoveFall(); } void Register() @@ -1219,9 +1219,9 @@ class spell_chapter5_rebuke : public SpellScriptLoader void HandleLeapBack(SpellEffIndex effIndex) { - PreventHitEffect(effIndex); + PreventHitEffect(effIndex); if (Unit* unitTarget = GetHitUnit()) - unitTarget->KnockbackFrom(2282.86f, -5263.45f, 40.0f, 8.0f); + unitTarget->KnockbackFrom(2282.86f, -5263.45f, 40.0f, 8.0f); } void Register() @@ -1239,6 +1239,6 @@ class spell_chapter5_rebuke : public SpellScriptLoader void AddSC_the_scarlet_enclave_c5() { new npc_highlord_darion_mograine(); - new spell_chapter5_light_of_dawn_aura(); - new spell_chapter5_rebuke(); + new spell_chapter5_light_of_dawn_aura(); + new spell_chapter5_rebuke(); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp index aae57efa9..d46b18564 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp @@ -7,18 +7,18 @@ REWRITTEN BY XINEF class instance_scarlet_monastery : public InstanceMapScript { - public: - instance_scarlet_monastery() : InstanceMapScript("instance_scarlet_monastery", 189) { } + public: + instance_scarlet_monastery() : InstanceMapScript("instance_scarlet_monastery", 189) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_scarlet_monastery_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_scarlet_monastery_InstanceMapScript(map); + } - struct instance_scarlet_monastery_InstanceMapScript : public InstanceScript - { - instance_scarlet_monastery_InstanceMapScript(Map* map) : InstanceScript(map) {} - }; + struct instance_scarlet_monastery_InstanceMapScript : public InstanceScript + { + instance_scarlet_monastery_InstanceMapScript(Map* map) : InstanceScript(map) {} + }; }; void AddSC_instance_scarlet_monastery() diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp index 84d7a15ca..05d224adc 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp @@ -44,8 +44,8 @@ enum Misc WEAPON_KIRTONOS_STAFF = 11365, POINT_KIRTONOS_LAND = 13, KIRTONOS_PATH = 105061, - - EMOTE_SUMMONED = 0 + + EMOTE_SUMMONED = 0 }; Position const PosMove[2] = @@ -61,20 +61,20 @@ class boss_kirtonos_the_herald : public CreatureScript struct boss_kirtonos_the_heraldAI : public ScriptedAI { boss_kirtonos_the_heraldAI(Creature* creature) : ScriptedAI(creature) - { - instance = me->GetInstanceScript(); - } + { + instance = me->GetInstanceScript(); + } - EventMap events; - EventMap events2; - InstanceScript* instance; + EventMap events; + EventMap events2; + InstanceScript* instance; void EnterCombat(Unit* /*who*/) { - events.Reset(); - events.ScheduleEvent(EVENT_SHADOW_BOLT_VOLLEY, 2000); - events.ScheduleEvent(EVENT_CURSE_OF_TONGUES, 6000); - events.ScheduleEvent(EVENT_DOMINATE_MIND, 20000); + events.Reset(); + events.ScheduleEvent(EVENT_SHADOW_BOLT_VOLLEY, 2000); + events.ScheduleEvent(EVENT_CURSE_OF_TONGUES, 6000); + events.ScheduleEvent(EVENT_DOMINATE_MIND, 20000); events.ScheduleEvent(EVENT_KIRTONOS_TRANSFORM, 5000); } @@ -83,7 +83,7 @@ class boss_kirtonos_the_herald : public CreatureScript if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS))) gate->SetGoState(GO_STATE_ACTIVE); - instance->SetData(DATA_KIRTONOS_THE_HERALD, DONE); + instance->SetData(DATA_KIRTONOS_THE_HERALD, DONE); } void EnterEvadeMode() @@ -91,13 +91,13 @@ class boss_kirtonos_the_herald : public CreatureScript if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetData64(GO_GATE_KIRTONOS))) gate->SetGoState(GO_STATE_ACTIVE); - instance->SetData(DATA_KIRTONOS_THE_HERALD, NOT_STARTED); + instance->SetData(DATA_KIRTONOS_THE_HERALD, NOT_STARTED); me->DespawnOrUnsummon(1); } void IsSummonedBy(Unit* /*summoner*/) { - events2.Reset(); + events2.Reset(); events2.ScheduleEvent(INTRO_1, 500); me->SetDisableGravity(true); me->SetReactState(REACT_PASSIVE); @@ -108,13 +108,13 @@ class boss_kirtonos_the_herald : public CreatureScript void MovementInform(uint32 type, uint32 id) { if (type == WAYPOINT_MOTION_TYPE && id == POINT_KIRTONOS_LAND) - { + { events2.ScheduleEvent(INTRO_2, 1500); events2.ScheduleEvent(INTRO_3, 2500); events2.ScheduleEvent(INTRO_4, 5500); events2.ScheduleEvent(INTRO_5, 6500); events2.ScheduleEvent(INTRO_6, 11500); - } + } } void UpdateAI(uint32 diff) @@ -153,18 +153,18 @@ class boss_kirtonos_the_herald : public CreatureScript if (!UpdateVictim()) return; - events.Update(diff); + events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; switch (events.ExecuteEvent()) { case EVENT_SWOOP: - me->CastSpell(me->GetVictim(), SPELL_SWOOP, false); + me->CastSpell(me->GetVictim(), SPELL_SWOOP, false); events.ScheduleEvent(EVENT_SWOOP, 15000); break; case EVENT_WING_FLAP: - me->CastSpell(me, SPELL_WING_FLAP, false); + me->CastSpell(me, SPELL_WING_FLAP, false); events.ScheduleEvent(EVENT_WING_FLAP, 13000); break; case EVENT_PIERCE_ARMOR: @@ -180,28 +180,28 @@ class boss_kirtonos_the_herald : public CreatureScript events.ScheduleEvent(EVENT_SHADOW_BOLT_VOLLEY, 10000); break; case EVENT_CURSE_OF_TONGUES: - me->CastSpell(me, SPELL_CURSE_OF_TONGUES, false); + me->CastSpell(me, SPELL_CURSE_OF_TONGUES, false); events.ScheduleEvent(EVENT_CURSE_OF_TONGUES, 20000); break; case EVENT_DOMINATE_MIND: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 20.0f, true)) - me->CastSpell(target, SPELL_DOMINATE_MIND, false); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 20.0f, true)) + me->CastSpell(target, SPELL_DOMINATE_MIND, false); events.ScheduleEvent(EVENT_DOMINATE_MIND, urand(44000, 48000)); break; case EVENT_KIRTONOS_TRANSFORM: - if (me->HealthBelowPct(50)) - { - events.Reset(); - events.ScheduleEvent(EVENT_SWOOP, 4000); - events.ScheduleEvent(EVENT_WING_FLAP, 7000); - events.ScheduleEvent(EVENT_PIERCE_ARMOR, 11000); - events.ScheduleEvent(EVENT_DISARM, 15000); + if (me->HealthBelowPct(50)) + { + events.Reset(); + events.ScheduleEvent(EVENT_SWOOP, 4000); + events.ScheduleEvent(EVENT_WING_FLAP, 7000); + events.ScheduleEvent(EVENT_PIERCE_ARMOR, 11000); + events.ScheduleEvent(EVENT_DISARM, 15000); me->RemoveAura(SPELL_KIRTONOS_TRANSFORM); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(0)); - break; + break; } - - events.ScheduleEvent(EVENT_KIRTONOS_TRANSFORM, 2000); + + events.ScheduleEvent(EVENT_KIRTONOS_TRANSFORM, 2000); break; } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index b79f34f89..bdcf0c99f 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -29,8 +29,8 @@ class instance_scholomance : public InstanceMapScript GateRavenianGUID = 0; GateBarovGUID = 0; GateIlluciaGUID = 0; - _kirtonosState = 0; - _miniBosses = 0; + _kirtonosState = 0; + _miniBosses = 0; } void OnGameObjectCreate(GameObject* go) @@ -84,32 +84,32 @@ class instance_scholomance : public InstanceMapScript return 0; } - void SetData(uint32 type, uint32 data) - { - switch (type) - { - case DATA_KIRTONOS_THE_HERALD: - _kirtonosState = data; - break; - case DATA_MINI_BOSSES: - ++_miniBosses; - break; - } + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case DATA_KIRTONOS_THE_HERALD: + _kirtonosState = data; + break; + case DATA_MINI_BOSSES: + ++_miniBosses; + break; + } - SaveToDB(); - } + SaveToDB(); + } - uint32 GetData(uint32 type) const - { - switch (type) - { - case DATA_KIRTONOS_THE_HERALD: - return _kirtonosState; - case DATA_MINI_BOSSES: - return _miniBosses; - } - return 0; - } + uint32 GetData(uint32 type) const + { + switch (type) + { + case DATA_KIRTONOS_THE_HERALD: + return _kirtonosState; + case DATA_MINI_BOSSES: + return _miniBosses; + } + return 0; + } std::string GetSaveData() { @@ -130,10 +130,10 @@ class instance_scholomance : public InstanceMapScript if (dataHead1 == 'S' && dataHead2 == 'O') { loadStream >> _kirtonosState; - loadStream >> _miniBosses; + loadStream >> _miniBosses; - if (_kirtonosState == IN_PROGRESS) - _kirtonosState = NOT_STARTED; + if (_kirtonosState == IN_PROGRESS) + _kirtonosState = NOT_STARTED; } } @@ -146,8 +146,8 @@ class instance_scholomance : public InstanceMapScript uint64 GateBarovGUID; uint64 GateIlluciaGUID; - uint32 _kirtonosState; - uint32 _miniBosses; + uint32 _kirtonosState; + uint32 _miniBosses; }; }; @@ -163,15 +163,15 @@ class spell_scholomance_fixate : public SpellScriptLoader void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - if (Unit* caster = GetCaster()) - caster->TauntApply(target); + if (Unit* caster = GetCaster()) + caster->TauntApply(target); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - if (Unit* caster = GetCaster()) - caster->TauntFadeOut(target); + if (Unit* caster = GetCaster()) + caster->TauntFadeOut(target); } void Register() @@ -221,28 +221,28 @@ class spell_kormok_summon_bone_minions : SpellScriptLoader public: spell_kormok_summon_bone_minions() : SpellScriptLoader("spell_kormok_summon_bone_minions") { } - class spell_kormok_summon_bone_minionsSpellScript : public SpellScript - { - PrepareSpellScript(spell_kormok_summon_bone_minionsSpellScript); + class spell_kormok_summon_bone_minionsSpellScript : public SpellScript + { + PrepareSpellScript(spell_kormok_summon_bone_minionsSpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); - for (uint32 i = 0; i < 4; ++i) - GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_BONE_MINION1+i, true); - } + for (uint32 i = 0; i < 4; ++i) + GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_BONE_MINION1+i, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_kormok_summon_bone_minionsSpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_kormok_summon_bone_minionsSpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_kormok_summon_bone_minionsSpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_kormok_summon_bone_minionsSpellScript(); + } }; enum Rooms @@ -253,7 +253,7 @@ enum Rooms ROOM_THE_SHADOW_VAULT = 3, ROOM_BAROV_FAMILY_VAULT = 4, ROOM_VAULT_OF_THE_RAVENIAN = 5, - ROOM_MAX = 6 + ROOM_MAX = 6 }; class spell_scholomance_shadow_portal : public SpellScriptLoader @@ -265,15 +265,15 @@ class spell_scholomance_shadow_portal : public SpellScriptLoader { PrepareSpellScript(spell_scholomance_shadow_portal_SpellScript); - bool Load() - { - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } void HandleDummy(SpellEffIndex /*effIndex*/) { Creature* caster = GetCaster()->ToCreature(); - uint8 attempts = 0; + uint8 attempts = 0; uint8 room = urand(ROOM_HALL_OF_SECRETS, ROOM_VAULT_OF_THE_RAVENIAN); uint32 spellId = 0; @@ -284,51 +284,51 @@ class spell_scholomance_shadow_portal : public SpellScriptLoader case ROOM_HALL_OF_SECRETS: if (InstanceScript* instance = caster->GetInstanceScript()) if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, instance->GetData64(GO_GATE_RAVENIAN))) - if (gate->GetGoState() == GO_STATE_ACTIVE) - spellId = SPELL_SHADOW_PORTAL_HALLOFSECRETS; + if (gate->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_HALLOFSECRETS; break; case ROOM_HALL_OF_THE_DAMNED: if (InstanceScript* instance = caster->GetInstanceScript()) if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, instance->GetData64(GO_GATE_THEOLEN))) - if (gate->GetGoState() == GO_STATE_ACTIVE) - spellId = SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED; + if (gate->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED; break; case ROOM_THE_COVEN: if (InstanceScript* instance = caster->GetInstanceScript()) if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, instance->GetData64(GO_GATE_MALICIA))) - if (gate->GetGoState() == GO_STATE_ACTIVE) - spellId = SPELL_SHADOW_PORTAL_THECOVEN; + if (gate->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_THECOVEN; break; case ROOM_THE_SHADOW_VAULT: if (InstanceScript* instance = caster->GetInstanceScript()) if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, instance->GetData64(GO_GATE_ILLUCIA))) - if (gate->GetGoState() == GO_STATE_ACTIVE) - spellId = SPELL_SHADOW_PORTAL_THESHADOWVAULT; + if (gate->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_THESHADOWVAULT; break; case ROOM_BAROV_FAMILY_VAULT: if (InstanceScript* instance = caster->GetInstanceScript()) if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, instance->GetData64(GO_GATE_BAROV))) - if (gate->GetGoState() == GO_STATE_ACTIVE) - spellId = SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT; + if (gate->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT; break; case ROOM_VAULT_OF_THE_RAVENIAN: if (InstanceScript* instance = caster->GetInstanceScript()) if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, instance->GetData64(GO_GATE_POLKELT))) - if (gate->GetGoState() == GO_STATE_ACTIVE) - spellId = SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN; + if (gate->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN; break; } if (spellId) - { + { caster->CastSpell(GetHitUnit(), spellId, true); - break; - } - else - { - room = (++room)%ROOM_MAX; - ++attempts; - } + break; + } + else + { + room = (++room)%ROOM_MAX; + ++attempts; + } } } @@ -381,14 +381,14 @@ class spell_scholomance_shadow_portal_rooms : public SpellScriptLoader { PrepareSpellScript(spell_scholomance_shadow_portal_rooms_SpellScript); - bool Load() - { - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } void HandleSendEvent(SpellEffIndex effIndex) { - PreventHitEffect(effIndex); + PreventHitEffect(effIndex); Creature* caster = GetCaster()->ToCreature(); uint8 summonPos = 0; @@ -435,10 +435,10 @@ class spell_scholomance_shadow_portal_rooms : public SpellScriptLoader if (InstanceScript* instance = GetCaster()->GetInstanceScript()) if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, instance->GetData64(gateId))) - { + { gate->SetGoState(GO_STATE_READY); - gate->AI()->SetData(1, 1); - } + gate->AI()->SetData(1, 1); + } } } @@ -457,9 +457,9 @@ class spell_scholomance_shadow_portal_rooms : public SpellScriptLoader void AddSC_instance_scholomance() { new instance_scholomance(); - new spell_scholomance_fixate(); - new spell_kormok_summon_bone_mages(); - new spell_kormok_summon_bone_minions(); - new spell_scholomance_shadow_portal(); - new spell_scholomance_shadow_portal_rooms(); + new spell_scholomance_fixate(); + new spell_kormok_summon_bone_mages(); + new spell_kormok_summon_bone_minions(); + new spell_scholomance_shadow_portal(); + new spell_scholomance_shadow_portal_rooms(); } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h index 6e2cdc8d9..4a010006b 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h +++ b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h @@ -8,7 +8,7 @@ REWRITTEN BY XINEF enum DataTypes { DATA_KIRTONOS_THE_HERALD = 0, - DATA_MINI_BOSSES = 1 + DATA_MINI_BOSSES = 1 }; enum CreatureIds @@ -29,22 +29,22 @@ enum GameobjectIds enum SpellIds { - SPELL_SUMMON_BONE_MAGE_FRONT_LEFT = 27696, - SPELL_SUMMON_BONE_MAGE_FRONT_RIGHT = 27697, - SPELL_SUMMON_BONE_MAGE_BACK_RIGHT = 27698, - SPELL_SUMMON_BONE_MAGE_BACK_LEFT = 27699, + SPELL_SUMMON_BONE_MAGE_FRONT_LEFT = 27696, + SPELL_SUMMON_BONE_MAGE_FRONT_RIGHT = 27697, + SPELL_SUMMON_BONE_MAGE_BACK_RIGHT = 27698, + SPELL_SUMMON_BONE_MAGE_BACK_LEFT = 27699, - SPELL_SUMMON_BONE_MINION1 = 27690, - SPELL_SUMMON_BONE_MINION2 = 27691, - SPELL_SUMMON_BONE_MINION3 = 27692, - SPELL_SUMMON_BONE_MINION4 = 27693, + SPELL_SUMMON_BONE_MINION1 = 27690, + SPELL_SUMMON_BONE_MINION2 = 27691, + SPELL_SUMMON_BONE_MINION3 = 27692, + SPELL_SUMMON_BONE_MINION4 = 27693, - SPELL_SHADOW_PORTAL_HALLOFSECRETS = 17863, - SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED = 17939, - SPELL_SHADOW_PORTAL_THECOVEN = 17943, - SPELL_SHADOW_PORTAL_THESHADOWVAULT = 17944, - SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT = 17946, - SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN = 17948 + SPELL_SHADOW_PORTAL_HALLOFSECRETS = 17863, + SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED = 17939, + SPELL_SHADOW_PORTAL_THECOVEN = 17943, + SPELL_SHADOW_PORTAL_THESHADOWVAULT = 17944, + SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT = 17946, + SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN = 17948 }; #endif diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index 6ab098aa0..31f5109ac 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -20,86 +20,86 @@ enum Creatures class instance_shadowfang_keep : public InstanceMapScript { - public: - instance_shadowfang_keep() : InstanceMapScript("instance_shadowfang_keep", 33) { } + public: + instance_shadowfang_keep() : InstanceMapScript("instance_shadowfang_keep", 33) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_shadowfang_keep_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_shadowfang_keep_InstanceMapScript(map); + } - struct instance_shadowfang_keep_InstanceMapScript : public InstanceScript - { - instance_shadowfang_keep_InstanceMapScript(Map* map) : InstanceScript(map) { } + struct instance_shadowfang_keep_InstanceMapScript : public InstanceScript + { + instance_shadowfang_keep_InstanceMapScript(Map* map) : InstanceScript(map) { } - void Initialize() - { - memset(&_encounters, 0, sizeof(_encounters)); - } + void Initialize() + { + memset(&_encounters, 0, sizeof(_encounters)); + } - void OnGameObjectCreate(GameObject* gameobject) - { - switch (gameobject->GetEntry()) - { - case GO_COURTYARD_DOOR: - if (_encounters[TYPE_COURTYARD] == DONE) - HandleGameObject(0, true, gameobject); - break; - case GO_SORCERER_DOOR: - if (_encounters[TYPE_FENRUS_THE_DEVOURER] == DONE) - HandleGameObject(0, true, gameobject); - break; - case GO_ARUGAL_DOOR: - if (_encounters[TYPE_WOLF_MASTER_NANDOS] == DONE) - HandleGameObject(0, true, gameobject); - break; - } - } + void OnGameObjectCreate(GameObject* gameobject) + { + switch (gameobject->GetEntry()) + { + case GO_COURTYARD_DOOR: + if (_encounters[TYPE_COURTYARD] == DONE) + HandleGameObject(0, true, gameobject); + break; + case GO_SORCERER_DOOR: + if (_encounters[TYPE_FENRUS_THE_DEVOURER] == DONE) + HandleGameObject(0, true, gameobject); + break; + case GO_ARUGAL_DOOR: + if (_encounters[TYPE_WOLF_MASTER_NANDOS] == DONE) + HandleGameObject(0, true, gameobject); + break; + } + } - void SetData(uint32 type, uint32 data) - { - switch (type) - { - case TYPE_COURTYARD: - case TYPE_FENRUS_THE_DEVOURER: - case TYPE_WOLF_MASTER_NANDOS: - _encounters[type] = data; - break; - } + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case TYPE_COURTYARD: + case TYPE_FENRUS_THE_DEVOURER: + case TYPE_WOLF_MASTER_NANDOS: + _encounters[type] = data; + break; + } - if (data == DONE) - SaveToDB(); - } + if (data == DONE) + SaveToDB(); + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "S K " << _encounters[0] << ' ' << _encounters[1] << ' ' << _encounters[2]; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "S K " << _encounters[0] << ' ' << _encounters[1] << ' ' << _encounters[2]; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - return; + void Load(const char* in) + { + if (!in) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'S' && dataHead2 == 'K') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - loadStream >> _encounters[i]; - if (_encounters[i] == IN_PROGRESS) - _encounters[i] = NOT_STARTED; - } - } - } + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'S' && dataHead2 == 'K') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + loadStream >> _encounters[i]; + if (_encounters[i] == IN_PROGRESS) + _encounters[i] = NOT_STARTED; + } + } + } - private: - uint32 _encounters[MAX_ENCOUNTERS]; - }; + private: + uint32 _encounters[MAX_ENCOUNTERS]; + }; }; @@ -144,8 +144,8 @@ class spell_shadowfang_keep_haunting_spirits : public SpellScriptLoader enum ForsakenSpells { - SPELL_FORSAKEN_SKILL_SWORD = 7038, - SPELL_FORSAKEN_SKILL_SHADOW = 7053 + SPELL_FORSAKEN_SKILL_SWORD = 7038, + SPELL_FORSAKEN_SKILL_SHADOW = 7053 }; class spell_shadowfang_keep_forsaken_skills : public SpellScriptLoader @@ -157,38 +157,38 @@ class spell_shadowfang_keep_forsaken_skills : public SpellScriptLoader { PrepareAuraScript(spell_shadowfang_keep_forsaken_skills_AuraScript); - bool Load() - { - _forsakenSpell = 0; - return true; - } + bool Load() + { + _forsakenSpell = 0; + return true; + } void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - _forsakenSpell = urand(SPELL_FORSAKEN_SKILL_SWORD, SPELL_FORSAKEN_SKILL_SHADOW); - if (_forsakenSpell == SPELL_FORSAKEN_SKILL_SHADOW - 1) - ++_forsakenSpell; - GetUnitOwner()->CastSpell(GetUnitOwner(), _forsakenSpell, true); - } + { + _forsakenSpell = urand(SPELL_FORSAKEN_SKILL_SWORD, SPELL_FORSAKEN_SKILL_SHADOW); + if (_forsakenSpell == SPELL_FORSAKEN_SKILL_SHADOW - 1) + ++_forsakenSpell; + GetUnitOwner()->CastSpell(GetUnitOwner(), _forsakenSpell, true); + } void HandleDummyTick(AuraEffect const* aurEff) { - PreventDefaultAction(); - GetUnitOwner()->RemoveAurasDueToSpell(_forsakenSpell); - _forsakenSpell = urand(SPELL_FORSAKEN_SKILL_SWORD, SPELL_FORSAKEN_SKILL_SHADOW); - if (_forsakenSpell == SPELL_FORSAKEN_SKILL_SHADOW - 1) - ++_forsakenSpell; - GetUnitOwner()->CastSpell(GetUnitOwner(), _forsakenSpell, true); + PreventDefaultAction(); + GetUnitOwner()->RemoveAurasDueToSpell(_forsakenSpell); + _forsakenSpell = urand(SPELL_FORSAKEN_SKILL_SWORD, SPELL_FORSAKEN_SKILL_SHADOW); + if (_forsakenSpell == SPELL_FORSAKEN_SKILL_SHADOW - 1) + ++_forsakenSpell; + GetUnitOwner()->CastSpell(GetUnitOwner(), _forsakenSpell, true); } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_shadowfang_keep_forsaken_skills_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_shadowfang_keep_forsaken_skills_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); OnEffectPeriodic += AuraEffectPeriodicFn(spell_shadowfang_keep_forsaken_skills_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } - private: - uint32 _forsakenSpell; + private: + uint32 _forsakenSpell; }; AuraScript* GetAuraScript() const @@ -201,5 +201,5 @@ void AddSC_instance_shadowfang_keep() { new instance_shadowfang_keep(); new spell_shadowfang_keep_haunting_spirits(); - new spell_shadowfang_keep_forsaken_skills(); + new spell_shadowfang_keep_forsaken_skills(); } diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h index 534045712..fdf315f72 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h @@ -7,17 +7,17 @@ REWRITTEN BY XINEF enum DataTypes { - TYPE_COURTYARD = 0, - TYPE_FENRUS_THE_DEVOURER = 1, - TYPE_WOLF_MASTER_NANDOS = 2, - MAX_ENCOUNTERS = 3 + TYPE_COURTYARD = 0, + TYPE_FENRUS_THE_DEVOURER = 1, + TYPE_WOLF_MASTER_NANDOS = 2, + MAX_ENCOUNTERS = 3 }; enum GameObjects { - GO_COURTYARD_DOOR = 18895, - GO_SORCERER_DOOR = 18972, - GO_ARUGAL_DOOR = 18971 + GO_COURTYARD_DOOR = 18895, + GO_SORCERER_DOOR = 18972, + GO_ARUGAL_DOOR = 18971 }; #endif diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 816c91a5c..c3830bd8d 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -10,17 +10,17 @@ REWRITTEN BY XINEF const Position BlackGuardPos[10] = { - {4032.73f+0.0f, -3378.26f+0.0f, 119.76f, 4.67f}, - {4032.73f+2.0f, -3378.26f+2.0f, 119.76f, 4.67f}, - {4032.73f+2.0f, -3378.26f-2.0f, 119.76f, 4.67f}, - {4032.73f-2.0f, -3378.26f+2.0f, 119.76f, 4.67f}, - {4032.73f-2.0f, -3378.26f-2.0f, 119.76f, 4.67f}, - - {4032.73f+0.0f, -3407.38f+0.0f, 115.56f, 0.0f}, - {4032.73f+2.0f, -3407.38f+2.0f, 115.56f, 0.0f}, - {4032.73f+2.0f, -3407.38f-2.0f, 115.56f, 0.0f}, - {4032.73f-2.0f, -3407.38f+2.0f, 115.56f, 0.0f}, - {4032.73f-2.0f, -3407.38f-2.0f, 115.56f, 0.0f} + {4032.73f+0.0f, -3378.26f+0.0f, 119.76f, 4.67f}, + {4032.73f+2.0f, -3378.26f+2.0f, 119.76f, 4.67f}, + {4032.73f+2.0f, -3378.26f-2.0f, 119.76f, 4.67f}, + {4032.73f-2.0f, -3378.26f+2.0f, 119.76f, 4.67f}, + {4032.73f-2.0f, -3378.26f-2.0f, 119.76f, 4.67f}, + + {4032.73f+0.0f, -3407.38f+0.0f, 115.56f, 0.0f}, + {4032.73f+2.0f, -3407.38f+2.0f, 115.56f, 0.0f}, + {4032.73f+2.0f, -3407.38f-2.0f, 115.56f, 0.0f}, + {4032.73f-2.0f, -3407.38f+2.0f, 115.56f, 0.0f}, + {4032.73f-2.0f, -3407.38f-2.0f, 115.56f, 0.0f} }; class instance_stratholme : public InstanceMapScript @@ -36,33 +36,33 @@ class instance_stratholme : public InstanceMapScript void Initialize() { - _baronRunProgress = 0; - _baronRunTime = 0; - _zigguratState1 = 0; - _zigguratState2 = 0; - _zigguratState3 = 0; - _slaughterProgress = 0; - _slaughterNPCs = 0; - _postboxesOpened = 0; + _baronRunProgress = 0; + _baronRunTime = 0; + _zigguratState1 = 0; + _zigguratState2 = 0; + _zigguratState3 = 0; + _slaughterProgress = 0; + _slaughterNPCs = 0; + _postboxesOpened = 0; - _zigguratDoorsGUID1 = 0; - _zigguratDoorsGUID2 = 0; - _zigguratDoorsGUID3 = 0; - _zigguratDoorsGUID4 = 0; - _zigguratDoorsGUID5 = 0; - _gauntletGateGUID = 0; - _slaughterGateGUID = 0; - _baronRivendareGUID = 0; + _zigguratDoorsGUID1 = 0; + _zigguratDoorsGUID2 = 0; + _zigguratDoorsGUID3 = 0; + _zigguratDoorsGUID4 = 0; + _zigguratDoorsGUID5 = 0; + _gauntletGateGUID = 0; + _slaughterGateGUID = 0; + _baronRivendareGUID = 0; - events.Reset(); + events.Reset(); } - void OnPlayerEnter(Player* player) - { - if (_baronRunTime > 0) - if (Aura* aura = player->AddAura(SPELL_BARON_ULTIMATUM, player)) - aura->SetDuration(_baronRunTime*MINUTE*IN_MILLISECONDS); - } + void OnPlayerEnter(Player* player) + { + if (_baronRunTime > 0) + if (Aura* aura = player->AddAura(SPELL_BARON_ULTIMATUM, player)) + aura->SetDuration(_baronRunTime*MINUTE*IN_MILLISECONDS); + } void OnCreatureCreate(Creature* creature) { @@ -71,76 +71,76 @@ class instance_stratholme : public InstanceMapScript case NPC_BARON_RIVENDARE: _baronRivendareGUID = creature->GetGUID(); break; - case NPC_VENOM_BELCHER: - case NPC_BILE_SPEWER: - if (_slaughterProgress == 0) - ++_slaughterNPCs; - break; - case NPC_RAMSTEIN_THE_GORGER: - if (_slaughterProgress == 1) - ++_slaughterNPCs; - break; - case NPC_MINDLESS_UNDEAD: - if (_slaughterProgress == 2) - ++_slaughterNPCs; - break; - case NPC_BLACK_GUARD: - if (_slaughterProgress == 3) - ++_slaughterNPCs; - break; + case NPC_VENOM_BELCHER: + case NPC_BILE_SPEWER: + if (_slaughterProgress == 0) + ++_slaughterNPCs; + break; + case NPC_RAMSTEIN_THE_GORGER: + if (_slaughterProgress == 1) + ++_slaughterNPCs; + break; + case NPC_MINDLESS_UNDEAD: + if (_slaughterProgress == 2) + ++_slaughterNPCs; + break; + case NPC_BLACK_GUARD: + if (_slaughterProgress == 3) + ++_slaughterNPCs; + break; } } - void ProcessSlaughterEvent() - { - if (_slaughterProgress == 1) - { - if (Creature* baron = instance->GetCreature(_baronRivendareGUID)) - baron->AI()->Talk(SAY_BRAON_SUMMON_RAMSTEIN); + void ProcessSlaughterEvent() + { + if (_slaughterProgress == 1) + { + if (Creature* baron = instance->GetCreature(_baronRivendareGUID)) + baron->AI()->Talk(SAY_BRAON_SUMMON_RAMSTEIN); - Position pos = {4032.20f, -3378.06f, 119.75f, 4.67f}; - instance->SummonCreature(NPC_RAMSTEIN_THE_GORGER, pos); - } - if (_slaughterProgress == 2) - { - for (uint32 i = 0; i < 33; ++i) - events.ScheduleEvent(EVENT_SPAWN_MINDLESS, 5000 + i*210); - if (Creature* baron = instance->GetCreature(_baronRivendareGUID)) - if (GameObject* gate = baron->FindNearestGameObject(GO_SLAUGHTER_GATE_SIDE, 200.0f)) - gate->SetGoState(GO_STATE_ACTIVE); - } - if (_slaughterProgress == 3) - { - events.ScheduleEvent(EVENT_SPAWN_BLACK_GUARD, 20000); - } - if (_slaughterProgress == 4) - { - if (Creature* baron = instance->GetCreature(_baronRivendareGUID)) - baron->AI()->Talk(SAY_BARON_GUARD_DEAD); - if (GameObject* gate = instance->GetGameObject(_zigguratDoorsGUID5)) - gate->SetGoState(GO_STATE_ACTIVE); + Position pos = {4032.20f, -3378.06f, 119.75f, 4.67f}; + instance->SummonCreature(NPC_RAMSTEIN_THE_GORGER, pos); + } + if (_slaughterProgress == 2) + { + for (uint32 i = 0; i < 33; ++i) + events.ScheduleEvent(EVENT_SPAWN_MINDLESS, 5000 + i*210); + if (Creature* baron = instance->GetCreature(_baronRivendareGUID)) + if (GameObject* gate = baron->FindNearestGameObject(GO_SLAUGHTER_GATE_SIDE, 200.0f)) + gate->SetGoState(GO_STATE_ACTIVE); + } + if (_slaughterProgress == 3) + { + events.ScheduleEvent(EVENT_SPAWN_BLACK_GUARD, 20000); + } + if (_slaughterProgress == 4) + { + if (Creature* baron = instance->GetCreature(_baronRivendareGUID)) + baron->AI()->Talk(SAY_BARON_GUARD_DEAD); + if (GameObject* gate = instance->GetGameObject(_zigguratDoorsGUID5)) + gate->SetGoState(GO_STATE_ACTIVE); - } - } + } + } - void OnUnitDeath(Unit* unit) - { - switch (unit->GetEntry()) - { - case NPC_VENOM_BELCHER: - case NPC_BILE_SPEWER: - case NPC_RAMSTEIN_THE_GORGER: - case NPC_MINDLESS_UNDEAD: - case NPC_BLACK_GUARD: - if (--_slaughterNPCs == 0) - { - ++_slaughterProgress; - ProcessSlaughterEvent(); - SaveToDB(); - } - break; - } - } + void OnUnitDeath(Unit* unit) + { + switch (unit->GetEntry()) + { + case NPC_VENOM_BELCHER: + case NPC_BILE_SPEWER: + case NPC_RAMSTEIN_THE_GORGER: + case NPC_MINDLESS_UNDEAD: + case NPC_BLACK_GUARD: + if (--_slaughterNPCs == 0) + { + ++_slaughterProgress; + ProcessSlaughterEvent(); + SaveToDB(); + } + break; + } + } void OnGameObjectCreate(GameObject* go) { @@ -181,93 +181,93 @@ class instance_stratholme : public InstanceMapScript if (_slaughterProgress == 4) go->SetGoState(GO_STATE_ACTIVE); break; - case GO_SLAUGHTER_GATE_SIDE: - if (_slaughterProgress >= 2) + case GO_SLAUGHTER_GATE_SIDE: + if (_slaughterProgress >= 2) go->SetGoState(GO_STATE_ACTIVE); - break; + break; } } - void CheckZiggurats() - { - if (_zigguratState1 == 2 && _zigguratState2 == 2 && _zigguratState3 == 2) - { - instance->LoadGrid(4035.83f, -3336.31f); - if (Creature* baron = instance->GetCreature(_baronRivendareGUID)) - baron->AI()->Talk(SAY_BRAON_ZIGGURAT_FALL_YELL); + void CheckZiggurats() + { + if (_zigguratState1 == 2 && _zigguratState2 == 2 && _zigguratState3 == 2) + { + instance->LoadGrid(4035.83f, -3336.31f); + if (Creature* baron = instance->GetCreature(_baronRivendareGUID)) + baron->AI()->Talk(SAY_BRAON_ZIGGURAT_FALL_YELL); - if (GameObject* gate = instance->GetGameObject(_gauntletGateGUID)) - gate->SetGoState(GO_STATE_ACTIVE); - if (GameObject* gate = instance->GetGameObject(_slaughterGateGUID)) - gate->SetGoState(GO_STATE_ACTIVE); - } - } + if (GameObject* gate = instance->GetGameObject(_gauntletGateGUID)) + gate->SetGoState(GO_STATE_ACTIVE); + if (GameObject* gate = instance->GetGameObject(_slaughterGateGUID)) + gate->SetGoState(GO_STATE_ACTIVE); + } + } void SetData(uint32 type, uint32 data) { - switch (type) - { - case TYPE_BARON_RUN: - { - if (_baronRunProgress == DATA_BARON_RUN_NONE) - { - _baronRunProgress = DATA_BARON_RUN_GATE; - _baronRunTime = 45; - DoCastSpellOnPlayers(SPELL_BARON_ULTIMATUM); - events.ScheduleEvent(EVENT_BARON_TIME, 60000); + switch (type) + { + case TYPE_BARON_RUN: + { + if (_baronRunProgress == DATA_BARON_RUN_NONE) + { + _baronRunProgress = DATA_BARON_RUN_GATE; + _baronRunTime = 45; + DoCastSpellOnPlayers(SPELL_BARON_ULTIMATUM); + events.ScheduleEvent(EVENT_BARON_TIME, 60000); - instance->LoadGrid(4035.83f, -3336.31f); - if (Creature* baron = instance->GetCreature(_baronRivendareGUID)) - baron->AI()->Talk(SAY_BARON_INIT_YELL); - } - break; - } - case TYPE_ZIGGURAT1: - { - if (data == _zigguratState1+1) - ++_zigguratState1; + instance->LoadGrid(4035.83f, -3336.31f); + if (Creature* baron = instance->GetCreature(_baronRivendareGUID)) + baron->AI()->Talk(SAY_BARON_INIT_YELL); + } + break; + } + case TYPE_ZIGGURAT1: + { + if (data == _zigguratState1+1) + ++_zigguratState1; - if (_zigguratState1 == 1) - if (GameObject* ziggurat = instance->GetGameObject(_zigguratDoorsGUID1)) - ziggurat->SetGoState(GO_STATE_ACTIVE); + if (_zigguratState1 == 1) + if (GameObject* ziggurat = instance->GetGameObject(_zigguratDoorsGUID1)) + ziggurat->SetGoState(GO_STATE_ACTIVE); - CheckZiggurats(); - break; - } - case TYPE_ZIGGURAT2: - { - if (data == _zigguratState2+1) - ++_zigguratState2; + CheckZiggurats(); + break; + } + case TYPE_ZIGGURAT2: + { + if (data == _zigguratState2+1) + ++_zigguratState2; - if (_zigguratState2 == 1) - if (GameObject* ziggurat = instance->GetGameObject(_zigguratDoorsGUID2)) - ziggurat->SetGoState(GO_STATE_ACTIVE); + if (_zigguratState2 == 1) + if (GameObject* ziggurat = instance->GetGameObject(_zigguratDoorsGUID2)) + ziggurat->SetGoState(GO_STATE_ACTIVE); - CheckZiggurats(); - break; - } - case TYPE_ZIGGURAT3: - { - if (data == _zigguratState3+1) - ++_zigguratState3; + CheckZiggurats(); + break; + } + case TYPE_ZIGGURAT3: + { + if (data == _zigguratState3+1) + ++_zigguratState3; - if (_zigguratState3 == 1) - if (GameObject* ziggurat = instance->GetGameObject(_zigguratDoorsGUID3)) - ziggurat->SetGoState(GO_STATE_ACTIVE); + if (_zigguratState3 == 1) + if (GameObject* ziggurat = instance->GetGameObject(_zigguratDoorsGUID3)) + ziggurat->SetGoState(GO_STATE_ACTIVE); - CheckZiggurats(); - break; - } - case TYPE_BARON_FIGHT: - { - if (GameObject* gate = instance->GetGameObject(_zigguratDoorsGUID5)) - gate->SetGoState(data == IN_PROGRESS ? GO_STATE_READY : GO_STATE_ACTIVE); - return; - } - case TYPE_MALLOW: - ++_postboxesOpened; - break; - } + CheckZiggurats(); + break; + } + case TYPE_BARON_FIGHT: + { + if (GameObject* gate = instance->GetGameObject(_zigguratDoorsGUID5)) + gate->SetGoState(data == IN_PROGRESS ? GO_STATE_READY : GO_STATE_ACTIVE); + return; + } + case TYPE_MALLOW: + ++_postboxesOpened; + break; + } SaveToDB(); } @@ -275,48 +275,48 @@ class instance_stratholme : public InstanceMapScript std::string GetSaveData() { std::ostringstream saveStream; - saveStream << "S T " << _baronRunProgress << ' ' << _baronRunTime << ' ' << _zigguratState1 << ' ' << _zigguratState2 << ' ' << _zigguratState3 << ' ' << _slaughterProgress << ' ' << _postboxesOpened; + saveStream << "S T " << _baronRunProgress << ' ' << _baronRunTime << ' ' << _zigguratState1 << ' ' << _zigguratState2 << ' ' << _zigguratState3 << ' ' << _slaughterProgress << ' ' << _postboxesOpened; return saveStream.str(); } void Load(const char* in) { - if (!in) - return; + if (!in) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'S' && dataHead2 == 'T') - { - loadStream >> _baronRunProgress; - loadStream >> _baronRunTime; - loadStream >> _zigguratState1; - loadStream >> _zigguratState2; - loadStream >> _zigguratState3; - loadStream >> _slaughterProgress; - loadStream >> _postboxesOpened; - } + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'S' && dataHead2 == 'T') + { + loadStream >> _baronRunProgress; + loadStream >> _baronRunTime; + loadStream >> _zigguratState1; + loadStream >> _zigguratState2; + loadStream >> _zigguratState3; + loadStream >> _slaughterProgress; + loadStream >> _postboxesOpened; + } - if (_baronRunTime > 0) - events.ScheduleEvent(EVENT_BARON_TIME, 60000); + if (_baronRunTime > 0) + events.ScheduleEvent(EVENT_BARON_TIME, 60000); - if (_slaughterProgress > 0 && _slaughterProgress < 4) - events.ScheduleEvent(EVENT_FORCE_SLAUGHTER_EVENT, 5000); + if (_slaughterProgress > 0 && _slaughterProgress < 4) + events.ScheduleEvent(EVENT_FORCE_SLAUGHTER_EVENT, 5000); } uint32 GetData(uint32 type) const { - switch (type) + switch (type) { - case TYPE_ZIGGURAT1: - return _zigguratState1; - case TYPE_ZIGGURAT2: - return _zigguratState2; - case TYPE_ZIGGURAT3: - return _zigguratState3; - case TYPE_MALLOW: - return _postboxesOpened; + case TYPE_ZIGGURAT1: + return _zigguratState1; + case TYPE_ZIGGURAT2: + return _zigguratState2; + case TYPE_ZIGGURAT3: + return _zigguratState3; + case TYPE_MALLOW: + return _postboxesOpened; } return 0; } @@ -324,116 +324,116 @@ class instance_stratholme : public InstanceMapScript void Update(uint32 diff) { events.Update(diff); - switch (events.ExecuteEvent()) + switch (events.ExecuteEvent()) { case EVENT_BARON_TIME: - { - --_baronRunTime; - instance->LoadGrid(4035.83f, -3336.31f); - Creature* baron = instance->GetCreature(_baronRivendareGUID); - if (baron && !baron->IsInCombat()) - { - switch (_baronRunTime) - { - case 10: - baron->AI()->Talk(SAY_BARON_10M); - break; - case 5: - baron->AI()->Talk(SAY_BARON_5M); - if (Creature* ysida = baron->FindNearestCreature(NPC_YSIDA, 50.0f)) - ysida->AI()->SetData(1, 1); - break; - case 0: - baron->AI()->Talk(SAY_BARON_0M); - DoRemoveAurasDueToSpellOnPlayers(SPELL_BARON_ULTIMATUM); - break; - } - } + { + --_baronRunTime; + instance->LoadGrid(4035.83f, -3336.31f); + Creature* baron = instance->GetCreature(_baronRivendareGUID); + if (baron && !baron->IsInCombat()) + { + switch (_baronRunTime) + { + case 10: + baron->AI()->Talk(SAY_BARON_10M); + break; + case 5: + baron->AI()->Talk(SAY_BARON_5M); + if (Creature* ysida = baron->FindNearestCreature(NPC_YSIDA, 50.0f)) + ysida->AI()->SetData(1, 1); + break; + case 0: + baron->AI()->Talk(SAY_BARON_0M); + DoRemoveAurasDueToSpellOnPlayers(SPELL_BARON_ULTIMATUM); + break; + } + } - if (_baronRunTime > 0) - events.ScheduleEvent(EVENT_BARON_TIME, 60000); - else - events.ScheduleEvent(EVENT_EXECUTE_PRISONER, 0); + if (_baronRunTime > 0) + events.ScheduleEvent(EVENT_BARON_TIME, 60000); + else + events.ScheduleEvent(EVENT_EXECUTE_PRISONER, 0); - SaveToDB(); - break; - } - case EVENT_EXECUTE_PRISONER: - { - instance->LoadGrid(4035.83f, -3336.31f); - Creature* baron = instance->GetCreature(_baronRivendareGUID); - if (baron && baron->IsAlive()) - { - if (!baron->IsInCombat()) - { - baron->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK1H); - if (Creature* ysida = baron->FindNearestCreature(NPC_YSIDA, 50.0f)) - Unit::Kill(baron, ysida); - } - else - events.ScheduleEvent(EVENT_EXECUTE_PRISONER, 1000); - } - break; - } + SaveToDB(); + break; + } + case EVENT_EXECUTE_PRISONER: + { + instance->LoadGrid(4035.83f, -3336.31f); + Creature* baron = instance->GetCreature(_baronRivendareGUID); + if (baron && baron->IsAlive()) + { + if (!baron->IsInCombat()) + { + baron->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK1H); + if (Creature* ysida = baron->FindNearestCreature(NPC_YSIDA, 50.0f)) + Unit::Kill(baron, ysida); + } + else + events.ScheduleEvent(EVENT_EXECUTE_PRISONER, 1000); + } + break; + } case EVENT_SPAWN_MINDLESS: - { - Position pos = {3941.75f, -3393.06f, 119.70f, 0.0f}; - instance->SummonCreature(NPC_MINDLESS_UNDEAD, pos); - break; - } - case EVENT_FORCE_SLAUGHTER_EVENT: - { - Map::PlayerList const& PlayerList = instance->GetPlayers(); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* player = i->GetSource()) - if (player->GetDistance2d(4034.97f, -3402.13f) < 50.0f) - { - ProcessSlaughterEvent(); - return; - } - - events.ScheduleEvent(EVENT_FORCE_SLAUGHTER_EVENT, 3000); - break; - } - case EVENT_SPAWN_BLACK_GUARD: - { - for (uint8 i = 0; i < 5; ++i) - if (Creature* guard = instance->SummonCreature(NPC_BLACK_GUARD, BlackGuardPos[i])) - { - guard->SetWalk(true); - guard->GetMotionMaster()->MovePoint(0, BlackGuardPos[i+5]); - guard->SetHomePosition(BlackGuardPos[i+5]); - if (i == 0 && guard->AI()) - guard->AI()->Talk(SAY_BLACK_GUARD_INIT); - } + { + Position pos = {3941.75f, -3393.06f, 119.70f, 0.0f}; + instance->SummonCreature(NPC_MINDLESS_UNDEAD, pos); + break; + } + case EVENT_FORCE_SLAUGHTER_EVENT: + { + Map::PlayerList const& PlayerList = instance->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* player = i->GetSource()) + if (player->GetDistance2d(4034.97f, -3402.13f) < 50.0f) + { + ProcessSlaughterEvent(); + return; + } + + events.ScheduleEvent(EVENT_FORCE_SLAUGHTER_EVENT, 3000); + break; + } + case EVENT_SPAWN_BLACK_GUARD: + { + for (uint8 i = 0; i < 5; ++i) + if (Creature* guard = instance->SummonCreature(NPC_BLACK_GUARD, BlackGuardPos[i])) + { + guard->SetWalk(true); + guard->GetMotionMaster()->MovePoint(0, BlackGuardPos[i+5]); + guard->SetHomePosition(BlackGuardPos[i+5]); + if (i == 0 && guard->AI()) + guard->AI()->Talk(SAY_BLACK_GUARD_INIT); + } - if (GameObject* gate = instance->GetGameObject(_zigguratDoorsGUID4)) - gate->SetGoState(GO_STATE_ACTIVE); - break; - } + if (GameObject* gate = instance->GetGameObject(_zigguratDoorsGUID4)) + gate->SetGoState(GO_STATE_ACTIVE); + break; + } } } - private: - uint32 _baronRunProgress; - uint32 _baronRunTime; - uint32 _zigguratState1; - uint32 _zigguratState2; - uint32 _zigguratState3; - uint32 _slaughterProgress; - uint32 _slaughterNPCs; - uint32 _postboxesOpened; - EventMap events; + private: + uint32 _baronRunProgress; + uint32 _baronRunTime; + uint32 _zigguratState1; + uint32 _zigguratState2; + uint32 _zigguratState3; + uint32 _slaughterProgress; + uint32 _slaughterNPCs; + uint32 _postboxesOpened; + EventMap events; - uint64 _zigguratDoorsGUID1; - uint64 _zigguratDoorsGUID2; - uint64 _zigguratDoorsGUID3; - uint64 _zigguratDoorsGUID4; - uint64 _zigguratDoorsGUID5; - uint64 _slaughterGateGUID; - uint64 _gauntletGateGUID; - uint64 _baronRivendareGUID; + uint64 _zigguratDoorsGUID1; + uint64 _zigguratDoorsGUID2; + uint64 _zigguratDoorsGUID3; + uint64 _zigguratDoorsGUID4; + uint64 _zigguratDoorsGUID5; + uint64 _slaughterGateGUID; + uint64 _gauntletGateGUID; + uint64 _baronRivendareGUID; }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h index 1715c5338..b27fde684 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h @@ -8,14 +8,14 @@ REWRITTEN BY XINEF enum DataTypes { TYPE_BARON_RUN = 0, - TYPE_ZIGGURAT1 = 1, - TYPE_ZIGGURAT2 = 2, - TYPE_ZIGGURAT3 = 3, - TYPE_BARON_FIGHT = 4, - TYPE_MALLOW = 5, + TYPE_ZIGGURAT1 = 1, + TYPE_ZIGGURAT2 = 2, + TYPE_ZIGGURAT3 = 3, + TYPE_BARON_FIGHT = 4, + TYPE_MALLOW = 5, - DATA_BARON_RUN_NONE = 0, - DATA_BARON_RUN_GATE = 1, + DATA_BARON_RUN_NONE = 0, + DATA_BARON_RUN_GATE = 1, }; enum CreatureIds @@ -24,7 +24,7 @@ enum CreatureIds NPC_BILE_SPEWER = 10416, NPC_VENOM_BELCHER = 10417, NPC_RAMSTEIN_THE_GORGER = 10439, - NPC_MINDLESS_UNDEAD = 11030, + NPC_MINDLESS_UNDEAD = 11030, NPC_BLACK_GUARD = 10394, NPC_YSIDA = 16031 }; @@ -38,26 +38,26 @@ enum GameobjectIds GO_ZIGGURAT_DOORS5 = 175796, // baron GO_GAUNTLET_GATE = 175374, GO_SLAUGTHER_GATE = 175373, - GO_SLAUGHTER_GATE_SIDE = 175358, - GO_EXIT_GATE = 176424 + GO_SLAUGHTER_GATE_SIDE = 175358, + GO_EXIT_GATE = 176424 }; enum MiscIds { - SAY_BLACK_GUARD_INIT = 0, - SAY_BARON_INIT_YELL = 0, - SAY_BRAON_ZIGGURAT_FALL_YELL = 1, - SAY_BARON_10M = 2, - SAY_BARON_5M = 3, - SAY_BARON_0M = 4, - SAY_BRAON_SUMMON_RAMSTEIN = 5, - SAY_BARON_GUARD_DEAD = 6, + SAY_BLACK_GUARD_INIT = 0, + SAY_BARON_INIT_YELL = 0, + SAY_BRAON_ZIGGURAT_FALL_YELL = 1, + SAY_BARON_10M = 2, + SAY_BARON_5M = 3, + SAY_BARON_0M = 4, + SAY_BRAON_SUMMON_RAMSTEIN = 5, + SAY_BARON_GUARD_DEAD = 6, - EVENT_BARON_TIME = 1, - EVENT_SPAWN_MINDLESS = 2, - EVENT_FORCE_SLAUGHTER_EVENT = 3, - EVENT_SPAWN_BLACK_GUARD = 4, - EVENT_EXECUTE_PRISONER = 5, + EVENT_BARON_TIME = 1, + EVENT_SPAWN_MINDLESS = 2, + EVENT_FORCE_SLAUGHTER_EVENT = 3, + EVENT_SPAWN_BLACK_GUARD = 4, + EVENT_EXECUTE_PRISONER = 5, SPELL_BARON_ULTIMATUM = 27861 }; diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp index 27c110ef1..6cadcfa17 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp @@ -8,185 +8,185 @@ REWRITTEN BY XINEF class instance_sunken_temple : public InstanceMapScript { - public: - instance_sunken_temple() : InstanceMapScript("instance_sunken_temple", 109) { } + public: + instance_sunken_temple() : InstanceMapScript("instance_sunken_temple", 109) { } - struct instance_sunken_temple_InstanceMapScript : public InstanceScript - { - instance_sunken_temple_InstanceMapScript(Map* map) : InstanceScript(map) - { - } + struct instance_sunken_temple_InstanceMapScript : public InstanceScript + { + instance_sunken_temple_InstanceMapScript(Map* map) : InstanceScript(map) + { + } - void Initialize() - { - _statuePhase = 0; - _defendersKilled = 0; - memset(&_encounters, 0, sizeof(_encounters)); + void Initialize() + { + _statuePhase = 0; + _defendersKilled = 0; + memset(&_encounters, 0, sizeof(_encounters)); - _forcefieldGUID = 0; - _jammalanGUID = 0; - } + _forcefieldGUID = 0; + _jammalanGUID = 0; + } - void OnCreatureCreate(Creature* creature) - { - switch (creature->GetEntry()) - { - case NPC_JAMMAL_AN_THE_PROPHET: - _jammalanGUID = creature->GetGUID(); - break; - } + void OnCreatureCreate(Creature* creature) + { + switch (creature->GetEntry()) + { + case NPC_JAMMAL_AN_THE_PROPHET: + _jammalanGUID = creature->GetGUID(); + break; + } - if (creature->IsAlive() && creature->GetDBTableGUIDLow() && creature->GetCreatureType() == CREATURE_TYPE_DRAGONKIN && creature->GetEntry() != NPC_SHADE_OF_ERANIKUS) - _dragonkinList.push_back(creature->GetGUID()); - } + if (creature->IsAlive() && creature->GetDBTableGUIDLow() && creature->GetCreatureType() == CREATURE_TYPE_DRAGONKIN && creature->GetEntry() != NPC_SHADE_OF_ERANIKUS) + _dragonkinList.push_back(creature->GetGUID()); + } - void OnUnitDeath(Unit* unit) - { - if (unit->GetTypeId() == TYPEID_UNIT && unit->GetCreatureType() == CREATURE_TYPE_DRAGONKIN && unit->GetEntry() != NPC_SHADE_OF_ERANIKUS) - _dragonkinList.remove(unit->GetGUID()); - } + void OnUnitDeath(Unit* unit) + { + if (unit->GetTypeId() == TYPEID_UNIT && unit->GetCreatureType() == CREATURE_TYPE_DRAGONKIN && unit->GetEntry() != NPC_SHADE_OF_ERANIKUS) + _dragonkinList.remove(unit->GetGUID()); + } - void OnGameObjectCreate(GameObject* gameobject) - { - switch (gameobject->GetEntry()) - { - case GO_ATALAI_STATUE1: - case GO_ATALAI_STATUE2: - case GO_ATALAI_STATUE3: - case GO_ATALAI_STATUE4: - case GO_ATALAI_STATUE5: - case GO_ATALAI_STATUE6: - if (gameobject->GetEntry() < GO_ATALAI_STATUE1+_statuePhase) - { - instance->SummonGameObject(GO_ATALAI_LIGHT2, gameobject->GetPositionX(), gameobject->GetPositionY(), gameobject->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - gameobject->SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } - break; - case GO_ATALAI_IDOL: - if (_statuePhase == MAX_STATUE_PHASE) - gameobject->SummonGameObject(GO_IDOL_OF_HAKKAR, -480.08f, 94.29f, -189.72f, 1.571f, 0.0f, 0.0f, 0.0f, 0.0f, 0); - break; - case GO_IDOL_OF_HAKKAR: - if (_encounters[TYPE_ATAL_ALARION] == DONE) - gameobject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case GO_FORCEFIELD: - _forcefieldGUID = gameobject->GetGUID(); - if (_defendersKilled == DEFENDERS_COUNT) - gameobject->SetGoState(GO_STATE_ACTIVE); - } - } + void OnGameObjectCreate(GameObject* gameobject) + { + switch (gameobject->GetEntry()) + { + case GO_ATALAI_STATUE1: + case GO_ATALAI_STATUE2: + case GO_ATALAI_STATUE3: + case GO_ATALAI_STATUE4: + case GO_ATALAI_STATUE5: + case GO_ATALAI_STATUE6: + if (gameobject->GetEntry() < GO_ATALAI_STATUE1+_statuePhase) + { + instance->SummonGameObject(GO_ATALAI_LIGHT2, gameobject->GetPositionX(), gameobject->GetPositionY(), gameobject->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + gameobject->SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + break; + case GO_ATALAI_IDOL: + if (_statuePhase == MAX_STATUE_PHASE) + gameobject->SummonGameObject(GO_IDOL_OF_HAKKAR, -480.08f, 94.29f, -189.72f, 1.571f, 0.0f, 0.0f, 0.0f, 0.0f, 0); + break; + case GO_IDOL_OF_HAKKAR: + if (_encounters[TYPE_ATAL_ALARION] == DONE) + gameobject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case GO_FORCEFIELD: + _forcefieldGUID = gameobject->GetGUID(); + if (_defendersKilled == DEFENDERS_COUNT) + gameobject->SetGoState(GO_STATE_ACTIVE); + } + } - void SetData(uint32 type, uint32 data) - { - switch (type) - { - case DATA_STATUES: - _events.ScheduleEvent(DATA_STATUES, 0); - break; - case DATA_DEFENDER_KILLED: - ++_defendersKilled; - if (_defendersKilled == DEFENDERS_COUNT) - { - instance->LoadGrid(-425.89f, -86.07f); - if (Creature* jammal = instance->GetCreature(_jammalanGUID)) - jammal->AI()->Talk(0); - if (GameObject* forcefield = instance->GetGameObject(_forcefieldGUID)) - forcefield->SetGoState(GO_STATE_ACTIVE); - } - break; - case DATA_ERANIKUS_FIGHT: - for (std::list::const_iterator itr = _dragonkinList.begin(); itr != _dragonkinList.end(); ++itr) - { - if (Creature* creature = instance->GetCreature(*itr)) - if (instance->IsGridLoaded(creature->GetPositionX(), creature->GetPositionY())) - creature->SetInCombatWithZone(); - } - break; - case TYPE_ATAL_ALARION: - case TYPE_JAMMAL_AN: - case TYPE_HAKKAR_EVENT: - _encounters[type] = data; - break; - } + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case DATA_STATUES: + _events.ScheduleEvent(DATA_STATUES, 0); + break; + case DATA_DEFENDER_KILLED: + ++_defendersKilled; + if (_defendersKilled == DEFENDERS_COUNT) + { + instance->LoadGrid(-425.89f, -86.07f); + if (Creature* jammal = instance->GetCreature(_jammalanGUID)) + jammal->AI()->Talk(0); + if (GameObject* forcefield = instance->GetGameObject(_forcefieldGUID)) + forcefield->SetGoState(GO_STATE_ACTIVE); + } + break; + case DATA_ERANIKUS_FIGHT: + for (std::list::const_iterator itr = _dragonkinList.begin(); itr != _dragonkinList.end(); ++itr) + { + if (Creature* creature = instance->GetCreature(*itr)) + if (instance->IsGridLoaded(creature->GetPositionX(), creature->GetPositionY())) + creature->SetInCombatWithZone(); + } + break; + case TYPE_ATAL_ALARION: + case TYPE_JAMMAL_AN: + case TYPE_HAKKAR_EVENT: + _encounters[type] = data; + break; + } - SaveToDB(); - } + SaveToDB(); + } - uint32 GetData(uint32 type) const - { - switch (type) - { - case DATA_STATUES: - return _statuePhase; - case DATA_DEFENDER_KILLED: - return _defendersKilled; - case TYPE_ATAL_ALARION: - case TYPE_JAMMAL_AN: - case TYPE_HAKKAR_EVENT: - return _encounters[type]; - } + uint32 GetData(uint32 type) const + { + switch (type) + { + case DATA_STATUES: + return _statuePhase; + case DATA_DEFENDER_KILLED: + return _defendersKilled; + case TYPE_ATAL_ALARION: + case TYPE_JAMMAL_AN: + case TYPE_HAKKAR_EVENT: + return _encounters[type]; + } - return 0; - } + return 0; + } - void Update(uint32 diff) - { - _events.Update(diff); - switch (_events.ExecuteEvent()) - { - case DATA_STATUES: - ++_statuePhase; - if (_statuePhase == MAX_STATUE_PHASE) - instance->SummonGameObject(GO_IDOL_OF_HAKKAR, -480.08f, 94.29f, -189.72f, 1.571f, 0.0f, 0.0f, 0.0f, 0.0f, 0); - break; - } - } + void Update(uint32 diff) + { + _events.Update(diff); + switch (_events.ExecuteEvent()) + { + case DATA_STATUES: + ++_statuePhase; + if (_statuePhase == MAX_STATUE_PHASE) + instance->SummonGameObject(GO_IDOL_OF_HAKKAR, -480.08f, 94.29f, -189.72f, 1.571f, 0.0f, 0.0f, 0.0f, 0.0f, 0); + break; + } + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "T A " << _encounters[0] << ' ' << _encounters[1] << ' ' << _encounters[2] << ' ' << _statuePhase << ' ' << _defendersKilled; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "T A " << _encounters[0] << ' ' << _encounters[1] << ' ' << _encounters[2] << ' ' << _statuePhase << ' ' << _defendersKilled; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - return; + void Load(const char* in) + { + if (!in) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'T' && dataHead2 == 'A') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - loadStream >> _encounters[i]; - if (_encounters[i] == IN_PROGRESS) - _encounters[i] = NOT_STARTED; - } + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'T' && dataHead2 == 'A') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + loadStream >> _encounters[i]; + if (_encounters[i] == IN_PROGRESS) + _encounters[i] = NOT_STARTED; + } - loadStream >> _statuePhase; - loadStream >> _defendersKilled; - } - } + loadStream >> _statuePhase; + loadStream >> _defendersKilled; + } + } - private: - uint32 _statuePhase; - uint32 _defendersKilled; - uint32 _encounters[MAX_ENCOUNTERS]; + private: + uint32 _statuePhase; + uint32 _defendersKilled; + uint32 _encounters[MAX_ENCOUNTERS]; - uint64 _forcefieldGUID; - uint64 _jammalanGUID; - std::list _dragonkinList; - EventMap _events; - }; + uint64 _forcefieldGUID; + uint64 _jammalanGUID; + std::list _dragonkinList; + EventMap _events; + }; - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_sunken_temple_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_sunken_temple_InstanceMapScript(map); + } }; enum MalfurionMisc @@ -220,12 +220,12 @@ class spell_temple_of_atal_hakkar_hex_of_jammal_an : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Unit* caster = GetCaster()) - if (caster->IsAlive() && caster->IsInCombat()) - { - caster->CastSpell(GetTarget(), HEX_OF_JAMMAL_AN, true); - caster->CastSpell(GetTarget(), HEX_OF_JAMMAL_AN_CHARM, true); - } + if (Unit* caster = GetCaster()) + if (caster->IsAlive() && caster->IsInCombat()) + { + caster->CastSpell(GetTarget(), HEX_OF_JAMMAL_AN, true); + caster->CastSpell(GetTarget(), HEX_OF_JAMMAL_AN_CHARM, true); + } } void Register() @@ -242,45 +242,45 @@ class spell_temple_of_atal_hakkar_hex_of_jammal_an : public SpellScriptLoader class spell_temple_of_atal_hakkar_awaken_the_soulflayer : public SpellScriptLoader { - public: - spell_temple_of_atal_hakkar_awaken_the_soulflayer() : SpellScriptLoader("spell_temple_of_atal_hakkar_awaken_the_soulflayer") { } + public: + spell_temple_of_atal_hakkar_awaken_the_soulflayer() : SpellScriptLoader("spell_temple_of_atal_hakkar_awaken_the_soulflayer") { } - class spell_temple_of_atal_hakkar_awaken_the_soulflayer_SpellScript : public SpellScript - { - PrepareSpellScript(spell_temple_of_atal_hakkar_awaken_the_soulflayer_SpellScript); + class spell_temple_of_atal_hakkar_awaken_the_soulflayer_SpellScript : public SpellScript + { + PrepareSpellScript(spell_temple_of_atal_hakkar_awaken_the_soulflayer_SpellScript); - void HandleSendEvent(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - InstanceScript* instanceScript = GetCaster()->GetInstanceScript(); - Map* map = GetCaster()->FindMap(); - if (!map || !instanceScript || instanceScript->GetData(TYPE_HAKKAR_EVENT) != NOT_STARTED) - return; + void HandleSendEvent(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + InstanceScript* instanceScript = GetCaster()->GetInstanceScript(); + Map* map = GetCaster()->FindMap(); + if (!map || !instanceScript || instanceScript->GetData(TYPE_HAKKAR_EVENT) != NOT_STARTED) + return; - Position pos = {-466.795f, 272.863f, -90.447f, 1.57f}; - if (TempSummon* summon = map->SummonCreature(NPC_SHADE_OF_HAKKAR, pos)) - { - summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); - instanceScript->SetData(TYPE_HAKKAR_EVENT, IN_PROGRESS); - } - } + Position pos = {-466.795f, 272.863f, -90.447f, 1.57f}; + if (TempSummon* summon = map->SummonCreature(NPC_SHADE_OF_HAKKAR, pos)) + { + summon->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); + instanceScript->SetData(TYPE_HAKKAR_EVENT, IN_PROGRESS); + } + } - void Register() - { - OnEffectHit += SpellEffectFn(spell_temple_of_atal_hakkar_awaken_the_soulflayer_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); - } - }; + void Register() + { + OnEffectHit += SpellEffectFn(spell_temple_of_atal_hakkar_awaken_the_soulflayer_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_temple_of_atal_hakkar_awaken_the_soulflayer_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_temple_of_atal_hakkar_awaken_the_soulflayer_SpellScript(); + } }; void AddSC_instance_sunken_temple() { new instance_sunken_temple(); new at_malfurion_stormrage(); - new spell_temple_of_atal_hakkar_hex_of_jammal_an(); - new spell_temple_of_atal_hakkar_awaken_the_soulflayer(); + new spell_temple_of_atal_hakkar_hex_of_jammal_an(); + new spell_temple_of_atal_hakkar_awaken_the_soulflayer(); } diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h index 10ef20c9f..744cf4d86 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h @@ -7,16 +7,16 @@ REWRITTEN BY XINEF enum DataTypes { - DATA_STATUES = 10, - DATA_DEFENDER_KILLED = 11, - DATA_ERANIKUS_FIGHT = 12, - MAX_STATUE_PHASE = 6, - DEFENDERS_COUNT = 6, + DATA_STATUES = 10, + DATA_DEFENDER_KILLED = 11, + DATA_ERANIKUS_FIGHT = 12, + MAX_STATUE_PHASE = 6, + DEFENDERS_COUNT = 6, - TYPE_ATAL_ALARION = 0, - TYPE_JAMMAL_AN = 1, - TYPE_HAKKAR_EVENT = 2, - MAX_ENCOUNTERS = 3 + TYPE_ATAL_ALARION = 0, + TYPE_JAMMAL_AN = 1, + TYPE_HAKKAR_EVENT = 2, + MAX_ENCOUNTERS = 3 }; enum GoIds @@ -28,23 +28,23 @@ enum GoIds GO_ATALAI_STATUE5 = 148834, GO_ATALAI_STATUE6 = 148835, GO_ATALAI_IDOL = 148836, - GO_IDOL_OF_HAKKAR = 148838, + GO_IDOL_OF_HAKKAR = 148838, GO_ATALAI_LIGHT2 = 148937, - GO_FORCEFIELD = 149431 + GO_FORCEFIELD = 149431 }; enum CreatureIds { NPC_MALFURION_STORMRAGE = 15362, - NPC_JAMMAL_AN_THE_PROPHET = 5710, - NPC_SHADE_OF_ERANIKUS = 5709, - NPC_SHADE_OF_HAKKAR = 8440, + NPC_JAMMAL_AN_THE_PROPHET = 5710, + NPC_SHADE_OF_ERANIKUS = 5709, + NPC_SHADE_OF_HAKKAR = 8440, }; enum SpellIds { - HEX_OF_JAMMAL_AN = 12480, - HEX_OF_JAMMAL_AN_CHARM = 12483 + HEX_OF_JAMMAL_AN = 12480, + HEX_OF_JAMMAL_AN_CHARM = 12483 }; #endif diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index c11c3e7b8..14930066e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -8,39 +8,39 @@ REWRITTEN BY XINEF enum Quotes { - YELL_INTRO = 0, - YELL_INTRO_BREAK_ICE = 1, - YELL_INTRO_CHARGE = 2, - YELL_INTRO_KILL_MADRIGOSA = 3, - YELL_INTRO_TAUNT = 4, + YELL_INTRO = 0, + YELL_INTRO_BREAK_ICE = 1, + YELL_INTRO_CHARGE = 2, + YELL_INTRO_KILL_MADRIGOSA = 3, + YELL_INTRO_TAUNT = 4, - YELL_AGGRO = 5, - YELL_KILL = 6, - YELL_LOVE = 7, - YELL_BERSERK = 8, - YELL_DEATH = 9, + YELL_AGGRO = 5, + YELL_KILL = 6, + YELL_LOVE = 7, + YELL_BERSERK = 8, + YELL_DEATH = 9, }; enum Spells { - SPELL_METEOR_SLASH = 45150, - SPELL_BURN_DAMAGE = 46394, - SPELL_BURN = 45141, - SPELL_STOMP = 45185, - SPELL_BERSERK = 26662, - SPELL_DUAL_WIELD = 42459, - SPELL_SUMMON_BRUTALLUS_DEATH_CLOUD = 45884 + SPELL_METEOR_SLASH = 45150, + SPELL_BURN_DAMAGE = 46394, + SPELL_BURN = 45141, + SPELL_STOMP = 45185, + SPELL_BERSERK = 26662, + SPELL_DUAL_WIELD = 42459, + SPELL_SUMMON_BRUTALLUS_DEATH_CLOUD = 45884 }; enum Misc { - EVENT_SPELL_SLASH = 1, - EVENT_SPELL_STOMP = 2, - EVENT_SPELL_BURN = 3, - EVENT_SPELL_BERSERK = 4, + EVENT_SPELL_SLASH = 1, + EVENT_SPELL_STOMP = 2, + EVENT_SPELL_BURN = 3, + EVENT_SPELL_BERSERK = 4, - ACTION_START_EVENT = 1, - ACTION_SPAWN_FELMYST = 2 + ACTION_START_EVENT = 1, + ACTION_SPAWN_FELMYST = 2 }; class boss_brutallus : public CreatureScript @@ -54,48 +54,48 @@ public: void Reset() { - BossAI::Reset(); - me->CastSpell(me, SPELL_DUAL_WIELD, true); + BossAI::Reset(); + me->CastSpell(me, SPELL_DUAL_WIELD, true); } - void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (me->GetReactState() == REACT_PASSIVE && (!who || who->GetEntry() != NPC_MADRIGOSA)) - { - if (who) - Unit::Kill(me, who); - damage = 0; - } - } + void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (me->GetReactState() == REACT_PASSIVE && (!who || who->GetEntry() != NPC_MADRIGOSA)) + { + if (who) + Unit::Kill(me, who); + damage = 0; + } + } void EnterCombat(Unit* who) { - if (who->GetEntry() == NPC_MADRIGOSA) - return; + if (who->GetEntry() == NPC_MADRIGOSA) + return; Talk(YELL_AGGRO); - BossAI::EnterCombat(who); - - events.ScheduleEvent(EVENT_SPELL_SLASH, 11000); - events.ScheduleEvent(EVENT_SPELL_STOMP, 30000); - events.ScheduleEvent(EVENT_SPELL_BURN, 45000); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 360000); + BossAI::EnterCombat(who); + + events.ScheduleEvent(EVENT_SPELL_SLASH, 11000); + events.ScheduleEvent(EVENT_SPELL_STOMP, 30000); + events.ScheduleEvent(EVENT_SPELL_BURN, 45000); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 360000); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) - Talk(YELL_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) + Talk(YELL_KILL); } void JustDied(Unit* killer) { - BossAI::JustDied(killer); + BossAI::JustDied(killer); Talk(YELL_DEATH); - me->CastSpell(me, SPELL_SUMMON_BRUTALLUS_DEATH_CLOUD, true); - if (Creature* madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_MADRIGOSA))) - madrigosa->AI()->DoAction(ACTION_SPAWN_FELMYST); + me->CastSpell(me, SPELL_SUMMON_BRUTALLUS_DEATH_CLOUD, true); + if (Creature* madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_MADRIGOSA))) + madrigosa->AI()->DoAction(ACTION_SPAWN_FELMYST); } void AttackStart(Unit* who) @@ -110,31 +110,31 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_SLASH: - me->CastSpell(me->GetVictim(), SPELL_METEOR_SLASH, false); - events.ScheduleEvent(EVENT_SPELL_SLASH, 10000); - break; - case EVENT_SPELL_STOMP: - me->CastSpell(me->GetVictim(), SPELL_STOMP, false); - Talk(YELL_LOVE); - events.ScheduleEvent(EVENT_SPELL_STOMP, 30000); - break; - case EVENT_SPELL_BURN: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true, -SPELL_BURN_DAMAGE)) - me->CastSpell(target, SPELL_BURN, false); - events.ScheduleEvent(EVENT_SPELL_BURN, 60000); - break; - case EVENT_SPELL_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - Talk(YELL_BERSERK); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_SLASH: + me->CastSpell(me->GetVictim(), SPELL_METEOR_SLASH, false); + events.ScheduleEvent(EVENT_SPELL_SLASH, 10000); + break; + case EVENT_SPELL_STOMP: + me->CastSpell(me->GetVictim(), SPELL_STOMP, false); + Talk(YELL_LOVE); + events.ScheduleEvent(EVENT_SPELL_STOMP, 30000); + break; + case EVENT_SPELL_BURN: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true, -SPELL_BURN_DAMAGE)) + me->CastSpell(target, SPELL_BURN, false); + events.ScheduleEvent(EVENT_SPELL_BURN, 60000); + break; + case EVENT_SPELL_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + Talk(YELL_BERSERK); + break; + } DoMeleeAttackIfReady(); } @@ -148,46 +148,46 @@ public: enum eMadrigosa { - EVENT_MAD_1 = 1, - EVENT_MAD_2 = 2, - EVENT_MAD_2_1 = 200, - EVENT_MAD_3 = 3, - EVENT_MAD_4 = 4, - EVENT_MAD_5 = 5, - EVENT_MAD_6 = 6, - EVENT_MAD_7 = 7, - EVENT_MAD_8 = 8, - EVENT_MAD_9 = 9, - EVENT_MAD_10 = 10, - EVENT_MAD_11 = 11, - EVENT_MAD_12 = 12, - EVENT_MAD_13 = 13, - EVENT_MAD_14 = 14, - EVENT_MAD_15 = 15, - EVENT_MAD_16 = 16, - EVENT_MAD_17 = 17, - EVENT_MAD_18 = 18, - EVENT_MAD_19 = 19, - EVENT_MAD_20 = 20, - EVENT_MAD_21 = 21, - EVENT_SPAWN_FELMYST = 30, + EVENT_MAD_1 = 1, + EVENT_MAD_2 = 2, + EVENT_MAD_2_1 = 200, + EVENT_MAD_3 = 3, + EVENT_MAD_4 = 4, + EVENT_MAD_5 = 5, + EVENT_MAD_6 = 6, + EVENT_MAD_7 = 7, + EVENT_MAD_8 = 8, + EVENT_MAD_9 = 9, + EVENT_MAD_10 = 10, + EVENT_MAD_11 = 11, + EVENT_MAD_12 = 12, + EVENT_MAD_13 = 13, + EVENT_MAD_14 = 14, + EVENT_MAD_15 = 15, + EVENT_MAD_16 = 16, + EVENT_MAD_17 = 17, + EVENT_MAD_18 = 18, + EVENT_MAD_19 = 19, + EVENT_MAD_20 = 20, + EVENT_MAD_21 = 21, + EVENT_SPAWN_FELMYST = 30, - SAY_MAD_1 = 0, - SAY_MAD_2 = 1, - SAY_MAD_3 = 2, - SAY_MAD_4 = 3, - SAY_MAD_5 = 4, + SAY_MAD_1 = 0, + SAY_MAD_2 = 1, + SAY_MAD_3 = 2, + SAY_MAD_4 = 3, + SAY_MAD_5 = 4, - SPELL_MADRIGOSA_FREEZE = 46609, - SPELL_MADRIGOSA_FROST_BREATH = 45065, - SPELL_MADRIGOSA_FROST_BLAST = 44872, - SPELL_MADRIGOSA_FROSTBOLT = 44843, - SPELL_MADRIGOSA_ENCAPSULATE = 44883, + SPELL_MADRIGOSA_FREEZE = 46609, + SPELL_MADRIGOSA_FROST_BREATH = 45065, + SPELL_MADRIGOSA_FROST_BLAST = 44872, + SPELL_MADRIGOSA_FROSTBOLT = 44843, + SPELL_MADRIGOSA_ENCAPSULATE = 44883, - SPELL_BRUTALLUS_CHARGE = 44884, - SPELL_BRUTALLUS_FEL_FIREBALL = 44844, - SPELL_BRUTALLUS_FLAME_RING = 44874, - SPELL_BRUTALLUS_BREAK_ICE = 46637, + SPELL_BRUTALLUS_CHARGE = 44884, + SPELL_BRUTALLUS_FEL_FIREBALL = 44844, + SPELL_BRUTALLUS_FLAME_RING = 44874, + SPELL_BRUTALLUS_BREAK_ICE = 46637, }; class npc_madrigosa : public CreatureScript @@ -199,188 +199,188 @@ public: { npc_madrigosaAI(Creature* creature) : NullCreatureAI(creature) { - instance = creature->GetInstanceScript(); - bool appear = instance->GetBossState(DATA_BRUTALLUS) != DONE && instance->GetBossState(DATA_MADRIGOSA) == DONE; - creature->SetVisible(appear); - creature->SetStandState(UNIT_STAND_STATE_DEAD); - creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + instance = creature->GetInstanceScript(); + bool appear = instance->GetBossState(DATA_BRUTALLUS) != DONE && instance->GetBossState(DATA_MADRIGOSA) == DONE; + creature->SetVisible(appear); + creature->SetStandState(UNIT_STAND_STATE_DEAD); + creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); } - EventMap events; - InstanceScript* instance; + EventMap events; + InstanceScript* instance; - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT) - { - me->SetDisableGravity(true); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->NearTeleportTo(1570.97f, 725.51f, 79.77f, 3.82f); - events.ScheduleEvent(EVENT_MAD_1, 2000); - } - else if (param == ACTION_SPAWN_FELMYST) - events.ScheduleEvent(EVENT_SPAWN_FELMYST, 60000); - } + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT) + { + me->SetDisableGravity(true); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->NearTeleportTo(1570.97f, 725.51f, 79.77f, 3.82f); + events.ScheduleEvent(EVENT_MAD_1, 2000); + } + else if (param == ACTION_SPAWN_FELMYST) + events.ScheduleEvent(EVENT_SPAWN_FELMYST, 60000); + } void UpdateAI(uint32 diff) { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_MAD_1: - me->SetVisible(true); - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - { - me->SetTarget(brutallus->GetGUID()); - brutallus->SetReactState(REACT_PASSIVE); - brutallus->setActive(true); - } - me->GetMotionMaster()->MovePoint(1, 1477.94f, 643.22f, 21.21f); - me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - events.ScheduleEvent(EVENT_MAD_2, 6000); - break; - case EVENT_MAD_2: - Talk(SAY_MAD_1); - me->CastSpell(me, SPELL_MADRIGOSA_FREEZE, false); - events.ScheduleEvent(EVENT_MAD_2_1, 1000); - break; - case EVENT_MAD_2_1: - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->SetDisableGravity(false); - me->CastSpell(me, SPELL_MADRIGOSA_FROST_BREATH, false); - events.ScheduleEvent(EVENT_MAD_3, 7000); - break; - case EVENT_MAD_3: - Talk(SAY_MAD_2); - events.ScheduleEvent(EVENT_MAD_4, 7000); - break; - case EVENT_MAD_4: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - brutallus->AI()->Talk(YELL_INTRO); - events.ScheduleEvent(EVENT_MAD_5, 5000); - break; - case EVENT_MAD_5: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - { - brutallus->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK1H); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK1H); - } - events.ScheduleEvent(EVENT_MAD_6, 10000); - break; - case EVENT_MAD_6: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - { - brutallus->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - } - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->SetDisableGravity(true); - events.ScheduleEvent(EVENT_MAD_7, 4000); - break; - case EVENT_MAD_7: - Talk(SAY_MAD_3); - me->CastSpell(me, SPELL_MADRIGOSA_FROST_BLAST, false); - events.ScheduleEvent(EVENT_MAD_8, 3000); - events.ScheduleEvent(EVENT_MAD_8, 5000); - events.ScheduleEvent(EVENT_MAD_8, 6500); - events.ScheduleEvent(EVENT_MAD_8, 7500); - events.ScheduleEvent(EVENT_MAD_8, 8500); - events.ScheduleEvent(EVENT_MAD_8, 9500); - events.ScheduleEvent(EVENT_MAD_9, 11000); - events.ScheduleEvent(EVENT_MAD_8, 12000); - events.ScheduleEvent(EVENT_MAD_8, 14000); - break; - case EVENT_MAD_8: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - me->CastSpell(brutallus, SPELL_MADRIGOSA_FROSTBOLT, false); - break; - case EVENT_MAD_9: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - { - brutallus->CastSpell(brutallus, SPELL_BRUTALLUS_FLAME_RING, true); - brutallus->RemoveAllAuras(); - brutallus->CastSpell(brutallus, SPELL_BRUTALLUS_FEL_FIREBALL, false); - brutallus->AI()->Talk(YELL_INTRO_BREAK_ICE); - } - events.ScheduleEvent(EVENT_MAD_11, 6000); - break; - //case EVENT_MAD_10: - case EVENT_MAD_11: - me->SetDisableGravity(false); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - events.ScheduleEvent(EVENT_MAD_13, 2500); - break; - case EVENT_MAD_13: - Talk(SAY_MAD_4); - me->RemoveAllAuras(); - me->CastSpell(me, SPELL_MADRIGOSA_ENCAPSULATE, false); - events.ScheduleEvent(EVENT_MAD_14, 2000); - break; - case EVENT_MAD_14: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - { - brutallus->SetDisableGravity(true); - brutallus->GetMotionMaster()->MovePoint(0, brutallus->GetPositionX(), brutallus->GetPositionY()-30.0f, brutallus->GetPositionZ()+15.0f, false, true); - } - events.ScheduleEvent(EVENT_MAD_15, 10000); - break; - case EVENT_MAD_15: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - { - brutallus->RemoveAllAuras(); - brutallus->SetDisableGravity(false); - brutallus->GetMotionMaster()->MoveFall(); - brutallus->AI()->Talk(YELL_INTRO_CHARGE); - } - events.ScheduleEvent(EVENT_MAD_16, 1400); - break; - case EVENT_MAD_16: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - brutallus->CastSpell(me, SPELL_BRUTALLUS_CHARGE, true); - events.ScheduleEvent(EVENT_MAD_17, 1200); - break; - case EVENT_MAD_17: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - brutallus->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK1H); - events.ScheduleEvent(EVENT_MAD_18, 500); - break; - case EVENT_MAD_18: - Talk(SAY_MAD_5); - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetStandState(UNIT_STAND_STATE_DEAD); - events.ScheduleEvent(EVENT_MAD_19, 6000); - break; - case EVENT_MAD_19: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - brutallus->AI()->Talk(YELL_INTRO_KILL_MADRIGOSA); - events.ScheduleEvent(EVENT_MAD_20, 7000); - break; - case EVENT_MAD_20: - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setFaction(35); - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - { - brutallus->AI()->Talk(YELL_INTRO_TAUNT); - brutallus->CastSpell(brutallus, SPELL_BRUTALLUS_BREAK_ICE, false); - } - events.ScheduleEvent(EVENT_MAD_21, 4000); - break; - case EVENT_MAD_21: - if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) - { - brutallus->SetReactState(REACT_AGGRESSIVE); - brutallus->SetHealth(brutallus->GetMaxHealth()); - brutallus->AI()->EnterEvadeMode(); - brutallus->setActive(false); - } - break; - case EVENT_SPAWN_FELMYST: - me->DespawnOrUnsummon(1); - if (Creature* felmyst = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_FELMYST))) - felmyst->AI()->DoAction(ACTION_START_EVENT); - break; - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_MAD_1: + me->SetVisible(true); + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + { + me->SetTarget(brutallus->GetGUID()); + brutallus->SetReactState(REACT_PASSIVE); + brutallus->setActive(true); + } + me->GetMotionMaster()->MovePoint(1, 1477.94f, 643.22f, 21.21f); + me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + events.ScheduleEvent(EVENT_MAD_2, 6000); + break; + case EVENT_MAD_2: + Talk(SAY_MAD_1); + me->CastSpell(me, SPELL_MADRIGOSA_FREEZE, false); + events.ScheduleEvent(EVENT_MAD_2_1, 1000); + break; + case EVENT_MAD_2_1: + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->SetDisableGravity(false); + me->CastSpell(me, SPELL_MADRIGOSA_FROST_BREATH, false); + events.ScheduleEvent(EVENT_MAD_3, 7000); + break; + case EVENT_MAD_3: + Talk(SAY_MAD_2); + events.ScheduleEvent(EVENT_MAD_4, 7000); + break; + case EVENT_MAD_4: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + brutallus->AI()->Talk(YELL_INTRO); + events.ScheduleEvent(EVENT_MAD_5, 5000); + break; + case EVENT_MAD_5: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + { + brutallus->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK1H); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK1H); + } + events.ScheduleEvent(EVENT_MAD_6, 10000); + break; + case EVENT_MAD_6: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + { + brutallus->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + } + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->SetDisableGravity(true); + events.ScheduleEvent(EVENT_MAD_7, 4000); + break; + case EVENT_MAD_7: + Talk(SAY_MAD_3); + me->CastSpell(me, SPELL_MADRIGOSA_FROST_BLAST, false); + events.ScheduleEvent(EVENT_MAD_8, 3000); + events.ScheduleEvent(EVENT_MAD_8, 5000); + events.ScheduleEvent(EVENT_MAD_8, 6500); + events.ScheduleEvent(EVENT_MAD_8, 7500); + events.ScheduleEvent(EVENT_MAD_8, 8500); + events.ScheduleEvent(EVENT_MAD_8, 9500); + events.ScheduleEvent(EVENT_MAD_9, 11000); + events.ScheduleEvent(EVENT_MAD_8, 12000); + events.ScheduleEvent(EVENT_MAD_8, 14000); + break; + case EVENT_MAD_8: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + me->CastSpell(brutallus, SPELL_MADRIGOSA_FROSTBOLT, false); + break; + case EVENT_MAD_9: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + { + brutallus->CastSpell(brutallus, SPELL_BRUTALLUS_FLAME_RING, true); + brutallus->RemoveAllAuras(); + brutallus->CastSpell(brutallus, SPELL_BRUTALLUS_FEL_FIREBALL, false); + brutallus->AI()->Talk(YELL_INTRO_BREAK_ICE); + } + events.ScheduleEvent(EVENT_MAD_11, 6000); + break; + //case EVENT_MAD_10: + case EVENT_MAD_11: + me->SetDisableGravity(false); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + events.ScheduleEvent(EVENT_MAD_13, 2500); + break; + case EVENT_MAD_13: + Talk(SAY_MAD_4); + me->RemoveAllAuras(); + me->CastSpell(me, SPELL_MADRIGOSA_ENCAPSULATE, false); + events.ScheduleEvent(EVENT_MAD_14, 2000); + break; + case EVENT_MAD_14: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + { + brutallus->SetDisableGravity(true); + brutallus->GetMotionMaster()->MovePoint(0, brutallus->GetPositionX(), brutallus->GetPositionY()-30.0f, brutallus->GetPositionZ()+15.0f, false, true); + } + events.ScheduleEvent(EVENT_MAD_15, 10000); + break; + case EVENT_MAD_15: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + { + brutallus->RemoveAllAuras(); + brutallus->SetDisableGravity(false); + brutallus->GetMotionMaster()->MoveFall(); + brutallus->AI()->Talk(YELL_INTRO_CHARGE); + } + events.ScheduleEvent(EVENT_MAD_16, 1400); + break; + case EVENT_MAD_16: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + brutallus->CastSpell(me, SPELL_BRUTALLUS_CHARGE, true); + events.ScheduleEvent(EVENT_MAD_17, 1200); + break; + case EVENT_MAD_17: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + brutallus->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK1H); + events.ScheduleEvent(EVENT_MAD_18, 500); + break; + case EVENT_MAD_18: + Talk(SAY_MAD_5); + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetStandState(UNIT_STAND_STATE_DEAD); + events.ScheduleEvent(EVENT_MAD_19, 6000); + break; + case EVENT_MAD_19: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + brutallus->AI()->Talk(YELL_INTRO_KILL_MADRIGOSA); + events.ScheduleEvent(EVENT_MAD_20, 7000); + break; + case EVENT_MAD_20: + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->setFaction(35); + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + { + brutallus->AI()->Talk(YELL_INTRO_TAUNT); + brutallus->CastSpell(brutallus, SPELL_BRUTALLUS_BREAK_ICE, false); + } + events.ScheduleEvent(EVENT_MAD_21, 4000); + break; + case EVENT_MAD_21: + if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_BRUTALLUS))) + { + brutallus->SetReactState(REACT_AGGRESSIVE); + brutallus->SetHealth(brutallus->GetMaxHealth()); + brutallus->AI()->EnterEvadeMode(); + brutallus->setActive(false); + } + break; + case EVENT_SPAWN_FELMYST: + me->DespawnOrUnsummon(1); + if (Creature* felmyst = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_FELMYST))) + felmyst->AI()->DoAction(ACTION_START_EVENT); + break; + } } }; @@ -401,14 +401,14 @@ class spell_madrigosa_activate_barrier : public SpellScriptLoader void HandleActivateObject(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (GameObject* go = GetHitGObj()) - { - go->SetGoState(GO_STATE_READY); - if (Map* map = go->GetMap()) - { + PreventHitDefaultEffect(effIndex); + if (GameObject* go = GetHitGObj()) + { + go->SetGoState(GO_STATE_READY); + if (Map* map = go->GetMap()) + { Map::PlayerList const &PlayerList = map->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (i->GetSource()) { UpdateData data; @@ -418,7 +418,7 @@ class spell_madrigosa_activate_barrier : public SpellScriptLoader i->GetSource()->GetSession()->SendPacket(&pkt); } } - } + } } void Register() @@ -444,14 +444,14 @@ class spell_madrigosa_deactivate_barrier : public SpellScriptLoader void HandleActivateObject(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (GameObject* go = GetHitGObj()) - { - go->SetGoState(GO_STATE_ACTIVE); - if (Map* map = go->GetMap()) - { + PreventHitDefaultEffect(effIndex); + if (GameObject* go = GetHitGObj()) + { + go->SetGoState(GO_STATE_ACTIVE); + if (Map* map = go->GetMap()) + { Map::PlayerList const &PlayerList = map->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (i->GetSource()) { UpdateData data; @@ -461,7 +461,7 @@ class spell_madrigosa_deactivate_barrier : public SpellScriptLoader i->GetSource()->GetSession()->SendPacket(&pkt); } } - } + } } void Register() @@ -487,10 +487,10 @@ class spell_brutallus_burn : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - if (!target->HasAura(SPELL_BURN_DAMAGE)) - target->CastSpell(target, SPELL_BURN_DAMAGE, true); + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + if (!target->HasAura(SPELL_BURN_DAMAGE)) + target->CastSpell(target, SPELL_BURN_DAMAGE, true); } void Register() @@ -513,14 +513,14 @@ class AreaTrigger_at_sunwell_madrigosa : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) { - if (InstanceScript* instance = player->GetInstanceScript()) - if (instance->GetBossState(DATA_MADRIGOSA) != DONE) - { - instance->SetBossState(DATA_MADRIGOSA, NOT_STARTED); - instance->SetBossState(DATA_MADRIGOSA, DONE); - if (Creature* creature = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_MADRIGOSA))) - creature->AI()->DoAction(ACTION_START_EVENT); - } + if (InstanceScript* instance = player->GetInstanceScript()) + if (instance->GetBossState(DATA_MADRIGOSA) != DONE) + { + instance->SetBossState(DATA_MADRIGOSA, NOT_STARTED); + instance->SetBossState(DATA_MADRIGOSA, DONE); + if (Creature* creature = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_MADRIGOSA))) + creature->AI()->DoAction(ACTION_START_EVENT); + } return true; } @@ -529,9 +529,9 @@ class AreaTrigger_at_sunwell_madrigosa : public AreaTriggerScript void AddSC_boss_brutallus() { new boss_brutallus(); - new npc_madrigosa(); - new spell_madrigosa_activate_barrier(); - new spell_madrigosa_deactivate_barrier(); - new spell_brutallus_burn(); - new AreaTrigger_at_sunwell_madrigosa(); + new npc_madrigosa(); + new spell_madrigosa_activate_barrier(); + new spell_madrigosa_deactivate_barrier(); + new spell_brutallus_burn(); + new AreaTrigger_at_sunwell_madrigosa(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index e50aaa62e..92e3e76e5 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -9,21 +9,21 @@ REWRITTEN BY XINEF enum Quotes { - YELL_INTRO_SAC = 0, - YELL_SAC_DEAD = 4, - EMOTE_SHADOW_NOVA = 5, - YELL_ENRAGE = 6, - YELL_SISTER_ALYTHESS_DEAD = 7, - YELL_SAC_KILL = 8, - YELL_SHADOW_NOVA = 9, + YELL_INTRO_SAC = 0, + YELL_SAC_DEAD = 4, + EMOTE_SHADOW_NOVA = 5, + YELL_ENRAGE = 6, + YELL_SISTER_ALYTHESS_DEAD = 7, + YELL_SAC_KILL = 8, + YELL_SHADOW_NOVA = 9, - YELL_INTRO_ALY = 0, - EMOTE_CONFLAGRATION = 4, - YELL_ALY_KILL = 5, - YELL_ALY_DEAD = 6, - YELL_SISTER_SACROLASH_DEAD = 7, - YELL_CANFLAGRATION = 8, - YELL_BERSERK = 9 + YELL_INTRO_ALY = 0, + EMOTE_CONFLAGRATION = 4, + YELL_ALY_KILL = 5, + YELL_ALY_DEAD = 6, + YELL_SISTER_SACROLASH_DEAD = 7, + YELL_CANFLAGRATION = 8, + YELL_BERSERK = 9 }; enum Spells @@ -34,14 +34,14 @@ enum Spells SPELL_DARK_FLAME = 45345, //Lady Sacrolash spells - SPELL_SHADOWFORM = 45455, + SPELL_SHADOWFORM = 45455, SPELL_DARK_TOUCHED = 45347, SPELL_SHADOW_BLADES = 45248, SPELL_SHADOW_NOVA = 45329, SPELL_CONFOUNDING_BLOW = 45256, //Grand Warlock Alythess spells - SPELL_FIREFORM = 45457, + SPELL_FIREFORM = 45457, SPELL_FLAME_TOUCHED = 45348, SPELL_PYROGENICS = 45230, SPELL_CONFLAGRATION = 45342, @@ -52,17 +52,17 @@ enum Spells enum Misc { - ACTION_SISTER_DIED = 1, + ACTION_SISTER_DIED = 1, - EVENT_SPELL_SHADOW_BLADES = 1, - EVENT_SPELL_SHADOW_NOVA = 2, - EVENT_SPELL_CONFOUNDING_BLOW= 3, - EVENT_SHADOW_IMAGE = 4, - EVENT_SPELL_ENRAGE = 5, - EVENT_SPELL_CONFLAGRATION = 6, - EVENT_SPELL_BLAZE = 7, - EVENT_SPELL_PYROGENICS = 8, - EVENT_SPELL_FLAME_SEAR = 9 + EVENT_SPELL_SHADOW_BLADES = 1, + EVENT_SPELL_SHADOW_NOVA = 2, + EVENT_SPELL_CONFOUNDING_BLOW= 3, + EVENT_SHADOW_IMAGE = 4, + EVENT_SPELL_ENRAGE = 5, + EVENT_SPELL_CONFLAGRATION = 6, + EVENT_SPELL_BLAZE = 7, + EVENT_SPELL_PYROGENICS = 8, + EVENT_SPELL_FLAME_SEAR = 9 }; class boss_sacrolash : public CreatureScript @@ -74,54 +74,54 @@ public: { boss_sacrolashAI(Creature* creature) : BossAI(creature, DATA_EREDAR_TWINS) {} - bool sisterDied; + bool sisterDied; void Reset() { - me->CastSpell(me, SPELL_SHADOWFORM, true); - sisterDied = false; - BossAI::Reset(); - me->SetLootMode(0); + me->CastSpell(me, SPELL_SHADOWFORM, true); + sisterDied = false; + BossAI::Reset(); + me->SetLootMode(0); } - void DoAction(int32 param) - { - if (param == ACTION_SISTER_DIED) - { - me->ResetLootMode(); - sisterDied = true; - Talk(YELL_SISTER_ALYTHESS_DEAD); - me->CastSpell(me, SPELL_EMPOWER, true); + void DoAction(int32 param) + { + if (param == ACTION_SISTER_DIED) + { + me->ResetLootMode(); + sisterDied = true; + Talk(YELL_SISTER_ALYTHESS_DEAD); + me->CastSpell(me, SPELL_EMPOWER, true); - uint32 timer = events.GetNextEventTime(EVENT_SPELL_SHADOW_NOVA); - events.CancelEvent(EVENT_SPELL_SHADOW_NOVA); - events.ScheduleEvent(EVENT_SPELL_CONFLAGRATION, timer-events.GetTimer()); - } - } + uint32 timer = events.GetNextEventTime(EVENT_SPELL_SHADOW_NOVA); + events.CancelEvent(EVENT_SPELL_SHADOW_NOVA); + events.ScheduleEvent(EVENT_SPELL_CONFLAGRATION, timer-events.GetTimer()); + } + } - void EnterEvadeMode() - { - BossAI::EnterEvadeMode(); - if (Creature* alythess = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_ALYTHESS))) - { - if (!alythess->IsAlive()) - alythess->Respawn(true); - else if (!alythess->IsInEvadeMode()) - alythess->AI()->EnterEvadeMode(); - } - } + void EnterEvadeMode() + { + BossAI::EnterEvadeMode(); + if (Creature* alythess = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_ALYTHESS))) + { + if (!alythess->IsAlive()) + alythess->Respawn(true); + else if (!alythess->IsInEvadeMode()) + alythess->AI()->EnterEvadeMode(); + } + } void EnterCombat(Unit* who) { - BossAI::EnterCombat(who); + BossAI::EnterCombat(who); if (Creature* alythess = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_ALYTHESS))) - if (alythess->IsAlive() && !alythess->IsInCombat()) - alythess->AI()->AttackStart(who); + if (alythess->IsAlive() && !alythess->IsInCombat()) + alythess->AI()->AttackStart(who); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BLADES, 10000); - events.ScheduleEvent(EVENT_SPELL_SHADOW_NOVA, 36000); - events.ScheduleEvent(EVENT_SPELL_CONFOUNDING_BLOW, 25000); - events.ScheduleEvent(EVENT_SHADOW_IMAGE, 20000); - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 360000); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BLADES, 10000); + events.ScheduleEvent(EVENT_SPELL_SHADOW_NOVA, 36000); + events.ScheduleEvent(EVENT_SPELL_CONFOUNDING_BLOW, 25000); + events.ScheduleEvent(EVENT_SHADOW_IMAGE, 20000); + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 360000); } void KilledUnit(Unit* victim) @@ -132,76 +132,76 @@ public: void JustDied(Unit* /*killer*/) { - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); if (sisterDied) { Talk(YELL_SAC_DEAD); instance->SetBossState(DATA_EREDAR_TWINS, DONE); } - else if (Creature* alythess = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_ALYTHESS))) - alythess->AI()->DoAction(ACTION_SISTER_DIED); + else if (Creature* alythess = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_ALYTHESS))) + alythess->AI()->DoAction(ACTION_SISTER_DIED); } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - { - summon->AI()->AttackStart(target); - summon->AddThreat(target, 10000000); - } - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + { + summon->AI()->AttackStart(target); + summon->AddThreat(target, 10000000); + } + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_ENRAGE: - Talk(YELL_ENRAGE); - me->CastSpell(me, SPELL_ENRAGE, true); - break; - case EVENT_SPELL_CONFOUNDING_BLOW: - me->CastSpell(me->GetVictim(), SPELL_CONFOUNDING_BLOW, false); - events.ScheduleEvent(EVENT_SPELL_CONFOUNDING_BLOW, urand(20000, 25000)); - break; - case EVENT_SPELL_SHADOW_BLADES: - me->CastSpell(me, SPELL_SHADOW_BLADES, false); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BLADES, 10000); - break; - case EVENT_SPELL_SHADOW_NOVA: - { - Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 100.0f); - if (!target) - target = me->GetVictim(); - Talk(EMOTE_SHADOW_NOVA, target); - Talk(YELL_SHADOW_NOVA); - me->CastSpell(target, SPELL_SHADOW_NOVA, false); - events.ScheduleEvent(EVENT_SPELL_SHADOW_NOVA, urand(30000, 35000)); - break; - } - case EVENT_SHADOW_IMAGE: - me->SummonCreature(NPC_SHADOW_IMAGE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 12000); - events.ScheduleEvent(EVENT_SHADOW_IMAGE, 6000); - break; - case EVENT_SPELL_CONFLAGRATION: - { - Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 100.0f); - if (!target) - target = me->GetVictim(); - me->CastSpell(target, SPELL_CONFLAGRATION, false); - events.ScheduleEvent(EVENT_SPELL_CONFLAGRATION, urand(30000, 35000)); - break; - } - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_ENRAGE: + Talk(YELL_ENRAGE); + me->CastSpell(me, SPELL_ENRAGE, true); + break; + case EVENT_SPELL_CONFOUNDING_BLOW: + me->CastSpell(me->GetVictim(), SPELL_CONFOUNDING_BLOW, false); + events.ScheduleEvent(EVENT_SPELL_CONFOUNDING_BLOW, urand(20000, 25000)); + break; + case EVENT_SPELL_SHADOW_BLADES: + me->CastSpell(me, SPELL_SHADOW_BLADES, false); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BLADES, 10000); + break; + case EVENT_SPELL_SHADOW_NOVA: + { + Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 100.0f); + if (!target) + target = me->GetVictim(); + Talk(EMOTE_SHADOW_NOVA, target); + Talk(YELL_SHADOW_NOVA); + me->CastSpell(target, SPELL_SHADOW_NOVA, false); + events.ScheduleEvent(EVENT_SPELL_SHADOW_NOVA, urand(30000, 35000)); + break; + } + case EVENT_SHADOW_IMAGE: + me->SummonCreature(NPC_SHADOW_IMAGE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 12000); + events.ScheduleEvent(EVENT_SHADOW_IMAGE, 6000); + break; + case EVENT_SPELL_CONFLAGRATION: + { + Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 100.0f); + if (!target) + target = me->GetVictim(); + me->CastSpell(target, SPELL_CONFLAGRATION, false); + events.ScheduleEvent(EVENT_SPELL_CONFLAGRATION, urand(30000, 35000)); + break; + } + } DoMeleeAttackIfReady(); } @@ -222,54 +222,54 @@ public: { boss_alythessAI(Creature* creature) : BossAI(creature, DATA_EREDAR_TWINS) { } - bool sisterDied; + bool sisterDied; void Reset() { - me->CastSpell(me, SPELL_FIREFORM, true); - sisterDied = false; - BossAI::Reset(); - me->SetLootMode(0); + me->CastSpell(me, SPELL_FIREFORM, true); + sisterDied = false; + BossAI::Reset(); + me->SetLootMode(0); } - void DoAction(int32 param) - { - if (param == ACTION_SISTER_DIED) - { - me->ResetLootMode(); - sisterDied = true; - Talk(YELL_SISTER_SACROLASH_DEAD); - me->CastSpell(me, SPELL_EMPOWER, true); + void DoAction(int32 param) + { + if (param == ACTION_SISTER_DIED) + { + me->ResetLootMode(); + sisterDied = true; + Talk(YELL_SISTER_SACROLASH_DEAD); + me->CastSpell(me, SPELL_EMPOWER, true); - uint32 timer = events.GetNextEventTime(EVENT_SPELL_CONFLAGRATION); - events.CancelEvent(EVENT_SPELL_CONFLAGRATION); - events.ScheduleEvent(EVENT_SPELL_SHADOW_NOVA, timer-events.GetTimer()); - } - } + uint32 timer = events.GetNextEventTime(EVENT_SPELL_CONFLAGRATION); + events.CancelEvent(EVENT_SPELL_CONFLAGRATION); + events.ScheduleEvent(EVENT_SPELL_SHADOW_NOVA, timer-events.GetTimer()); + } + } - void EnterEvadeMode() - { - BossAI::EnterEvadeMode(); - if (Creature* scorlash = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_LADY_SACROLASH))) - { - if (!scorlash->IsAlive()) - scorlash->Respawn(true); - else if (!scorlash->IsInEvadeMode()) - scorlash->AI()->EnterEvadeMode(); - } - } + void EnterEvadeMode() + { + BossAI::EnterEvadeMode(); + if (Creature* scorlash = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_LADY_SACROLASH))) + { + if (!scorlash->IsAlive()) + scorlash->Respawn(true); + else if (!scorlash->IsInEvadeMode()) + scorlash->AI()->EnterEvadeMode(); + } + } void EnterCombat(Unit* who) { - BossAI::EnterCombat(who); + BossAI::EnterCombat(who); if (Creature* scorlash = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_LADY_SACROLASH))) - if (scorlash->IsAlive() && !scorlash->IsInCombat()) - scorlash->AI()->AttackStart(who); + if (scorlash->IsAlive() && !scorlash->IsInCombat()) + scorlash->AI()->AttackStart(who); - events.ScheduleEvent(EVENT_SPELL_BLAZE, 100); - events.ScheduleEvent(EVENT_SPELL_PYROGENICS, 15000); - events.ScheduleEvent(EVENT_SPELL_FLAME_SEAR, 20000); - events.ScheduleEvent(EVENT_SPELL_CONFLAGRATION, 30000); - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 360000); + events.ScheduleEvent(EVENT_SPELL_BLAZE, 100); + events.ScheduleEvent(EVENT_SPELL_PYROGENICS, 15000); + events.ScheduleEvent(EVENT_SPELL_FLAME_SEAR, 20000); + events.ScheduleEvent(EVENT_SPELL_CONFLAGRATION, 30000); + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 360000); } void KilledUnit(Unit* victim) @@ -280,16 +280,16 @@ public: void JustDied(Unit* /*killer*/) { - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); if (sisterDied) { Talk(YELL_SAC_DEAD); instance->SetBossState(DATA_EREDAR_TWINS, DONE); } - else if (Creature* scorlash = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_LADY_SACROLASH))) - scorlash->AI()->DoAction(ACTION_SISTER_DIED); + else if (Creature* scorlash = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_LADY_SACROLASH))) + scorlash->AI()->DoAction(ACTION_SISTER_DIED); } void UpdateAI(uint32 diff) @@ -297,51 +297,51 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_ENRAGE: - Talk(YELL_BERSERK); - me->CastSpell(me, SPELL_ENRAGE, true); - break; - case EVENT_SPELL_PYROGENICS: - me->CastSpell(me, SPELL_PYROGENICS, false); - events.ScheduleEvent(EVENT_SPELL_PYROGENICS, 15000); - break; - case EVENT_SPELL_FLAME_SEAR: - me->CastCustomSpell(SPELL_FLAME_SEAR, SPELLVALUE_MAX_TARGETS, 5, me, TRIGGERED_NONE); - events.ScheduleEvent(EVENT_SPELL_FLAME_SEAR, 15000); - break; - case EVENT_SPELL_BLAZE: - me->CastSpell(me->GetVictim(), SPELL_BLAZE, false); - events.ScheduleEvent(EVENT_SPELL_BLAZE, 3800); - break; - case EVENT_SPELL_SHADOW_NOVA: - { - Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 100.0f); - if (!target) - target = me->GetVictim(); - me->CastSpell(target, SPELL_SHADOW_NOVA, false); - events.ScheduleEvent(EVENT_SPELL_SHADOW_NOVA, urand(30000, 35000)); - break; - } - case EVENT_SPELL_CONFLAGRATION: - { - Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 100.0f); - if (!target) - target = me->GetVictim(); - Talk(EMOTE_CONFLAGRATION, target); - Talk(YELL_CANFLAGRATION); - me->CastSpell(target, SPELL_CONFLAGRATION, false); - events.ScheduleEvent(EVENT_SPELL_CONFLAGRATION, urand(30000, 35000)); - break; - } - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_ENRAGE: + Talk(YELL_BERSERK); + me->CastSpell(me, SPELL_ENRAGE, true); + break; + case EVENT_SPELL_PYROGENICS: + me->CastSpell(me, SPELL_PYROGENICS, false); + events.ScheduleEvent(EVENT_SPELL_PYROGENICS, 15000); + break; + case EVENT_SPELL_FLAME_SEAR: + me->CastCustomSpell(SPELL_FLAME_SEAR, SPELLVALUE_MAX_TARGETS, 5, me, TRIGGERED_NONE); + events.ScheduleEvent(EVENT_SPELL_FLAME_SEAR, 15000); + break; + case EVENT_SPELL_BLAZE: + me->CastSpell(me->GetVictim(), SPELL_BLAZE, false); + events.ScheduleEvent(EVENT_SPELL_BLAZE, 3800); + break; + case EVENT_SPELL_SHADOW_NOVA: + { + Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 100.0f); + if (!target) + target = me->GetVictim(); + me->CastSpell(target, SPELL_SHADOW_NOVA, false); + events.ScheduleEvent(EVENT_SPELL_SHADOW_NOVA, urand(30000, 35000)); + break; + } + case EVENT_SPELL_CONFLAGRATION: + { + Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 100.0f); + if (!target) + target = me->GetVictim(); + Talk(EMOTE_CONFLAGRATION, target); + Talk(YELL_CANFLAGRATION); + me->CastSpell(target, SPELL_CONFLAGRATION, false); + events.ScheduleEvent(EVENT_SPELL_CONFLAGRATION, urand(30000, 35000)); + break; + } + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; @@ -353,131 +353,131 @@ public: class spell_eredar_twins_apply_dark_touched : public SpellScriptLoader { - public: - spell_eredar_twins_apply_dark_touched() : SpellScriptLoader("spell_eredar_twins_apply_dark_touched") { } + public: + spell_eredar_twins_apply_dark_touched() : SpellScriptLoader("spell_eredar_twins_apply_dark_touched") { } - class spell_eredar_twins_apply_dark_touched_SpellScript : public SpellScript - { - PrepareSpellScript(spell_eredar_twins_apply_dark_touched_SpellScript); + class spell_eredar_twins_apply_dark_touched_SpellScript : public SpellScript + { + PrepareSpellScript(spell_eredar_twins_apply_dark_touched_SpellScript); - void HandleApplyTouch() - { - if (Player* target = GetHitPlayer()) - target->CastSpell(target, SPELL_DARK_TOUCHED, true); - } + void HandleApplyTouch() + { + if (Player* target = GetHitPlayer()) + target->CastSpell(target, SPELL_DARK_TOUCHED, true); + } - void Register() - { - AfterHit += SpellHitFn(spell_eredar_twins_apply_dark_touched_SpellScript::HandleApplyTouch); - } - }; + void Register() + { + AfterHit += SpellHitFn(spell_eredar_twins_apply_dark_touched_SpellScript::HandleApplyTouch); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_eredar_twins_apply_dark_touched_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_eredar_twins_apply_dark_touched_SpellScript(); + } }; class spell_eredar_twins_apply_flame_touched : public SpellScriptLoader { - public: - spell_eredar_twins_apply_flame_touched() : SpellScriptLoader("spell_eredar_twins_apply_flame_touched") { } + public: + spell_eredar_twins_apply_flame_touched() : SpellScriptLoader("spell_eredar_twins_apply_flame_touched") { } - class spell_eredar_twins_apply_flame_touched_SpellScript : public SpellScript - { - PrepareSpellScript(spell_eredar_twins_apply_flame_touched_SpellScript); + class spell_eredar_twins_apply_flame_touched_SpellScript : public SpellScript + { + PrepareSpellScript(spell_eredar_twins_apply_flame_touched_SpellScript); - void HandleApplyTouch() - { - if (Player* target = GetHitPlayer()) - target->CastSpell(target, SPELL_FLAME_TOUCHED, true); - } + void HandleApplyTouch() + { + if (Player* target = GetHitPlayer()) + target->CastSpell(target, SPELL_FLAME_TOUCHED, true); + } - void Register() - { - AfterHit += SpellHitFn(spell_eredar_twins_apply_flame_touched_SpellScript::HandleApplyTouch); - } - }; + void Register() + { + AfterHit += SpellHitFn(spell_eredar_twins_apply_flame_touched_SpellScript::HandleApplyTouch); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_eredar_twins_apply_flame_touched_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_eredar_twins_apply_flame_touched_SpellScript(); + } }; class spell_eredar_twins_handle_touch : public SpellScriptLoader { - public: - spell_eredar_twins_handle_touch() : SpellScriptLoader("spell_eredar_twins_handle_touch") { } + public: + spell_eredar_twins_handle_touch() : SpellScriptLoader("spell_eredar_twins_handle_touch") { } - class spell_eredar_twins_handle_touch_SpellScript : public SpellScript - { - PrepareSpellScript(spell_eredar_twins_handle_touch_SpellScript); + class spell_eredar_twins_handle_touch_SpellScript : public SpellScript + { + PrepareSpellScript(spell_eredar_twins_handle_touch_SpellScript); - SpellCastResult CheckCast() + SpellCastResult CheckCast() { - if (GetCaster()->HasAura(SPELL_DARK_FLAME)) - return SPELL_FAILED_DONT_REPORT; + if (GetCaster()->HasAura(SPELL_DARK_FLAME)) + return SPELL_FAILED_DONT_REPORT; - if (GetSpellInfo()->Id == SPELL_DARK_TOUCHED) - { - if (GetCaster()->HasAura(SPELL_FLAME_TOUCHED)) + if (GetSpellInfo()->Id == SPELL_DARK_TOUCHED) + { + if (GetCaster()->HasAura(SPELL_FLAME_TOUCHED)) { - GetCaster()->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - GetCaster()->CastSpell(GetCaster(), SPELL_DARK_FLAME, true); - return SPELL_FAILED_DONT_REPORT; + GetCaster()->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + GetCaster()->CastSpell(GetCaster(), SPELL_DARK_FLAME, true); + return SPELL_FAILED_DONT_REPORT; } - } - else // if (m_spellInfo->Id == SPELL_FLAME_TOUCHED) - { - if (GetCaster()->HasAura(SPELL_DARK_TOUCHED)) + } + else // if (m_spellInfo->Id == SPELL_FLAME_TOUCHED) + { + if (GetCaster()->HasAura(SPELL_DARK_TOUCHED)) { - GetCaster()->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); - GetCaster()->CastSpell(GetCaster(), SPELL_DARK_FLAME, true); - return SPELL_FAILED_DONT_REPORT; + GetCaster()->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); + GetCaster()->CastSpell(GetCaster(), SPELL_DARK_FLAME, true); + return SPELL_FAILED_DONT_REPORT; } - } - return SPELL_CAST_OK; - } + } + return SPELL_CAST_OK; + } - void Register() - { + void Register() + { OnCheckCast += SpellCheckCastFn(spell_eredar_twins_handle_touch_SpellScript::CheckCast); - } - }; + } + }; - SpellScript* GetSpellScript() const - { - return new spell_eredar_twins_handle_touch_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_eredar_twins_handle_touch_SpellScript(); + } }; class spell_eredar_twins_blaze : public SpellScriptLoader { - public: - spell_eredar_twins_blaze() : SpellScriptLoader("spell_eredar_twins_blaze") { } + public: + spell_eredar_twins_blaze() : SpellScriptLoader("spell_eredar_twins_blaze") { } - class spell_eredar_twins_blaze_SpellScript : public SpellScript - { - PrepareSpellScript(spell_eredar_twins_blaze_SpellScript); + class spell_eredar_twins_blaze_SpellScript : public SpellScript + { + PrepareSpellScript(spell_eredar_twins_blaze_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(target, SPELL_BLAZE_SUMMON, true); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, SPELL_BLAZE_SUMMON, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_eredar_twins_blaze_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_eredar_twins_blaze_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_eredar_twins_blaze_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_eredar_twins_blaze_SpellScript(); + } }; class AreaTrigger_at_sunwell_eredar_twins : public AreaTriggerScript @@ -488,15 +488,15 @@ class AreaTrigger_at_sunwell_eredar_twins : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) { - if (InstanceScript* instance = player->GetInstanceScript()) - if (instance->GetBossState(DATA_EREDAR_TWINS_INTRO) != DONE) - { - instance->SetBossState(DATA_EREDAR_TWINS_INTRO, DONE); - if (Creature* creature = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_LADY_SACROLASH))) - creature->AI()->Talk(YELL_INTRO_SAC); - if (Creature* creature = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_GRAND_WARLOCK_ALYTHESS))) - creature->AI()->Talk(YELL_INTRO_ALY); - } + if (InstanceScript* instance = player->GetInstanceScript()) + if (instance->GetBossState(DATA_EREDAR_TWINS_INTRO) != DONE) + { + instance->SetBossState(DATA_EREDAR_TWINS_INTRO, DONE); + if (Creature* creature = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_LADY_SACROLASH))) + creature->AI()->Talk(YELL_INTRO_SAC); + if (Creature* creature = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_GRAND_WARLOCK_ALYTHESS))) + creature->AI()->Talk(YELL_INTRO_ALY); + } return true; } @@ -506,9 +506,9 @@ void AddSC_boss_eredar_twins() { new boss_sacrolash(); new boss_alythess(); - new spell_eredar_twins_apply_dark_touched(); - new spell_eredar_twins_apply_flame_touched(); - new spell_eredar_twins_handle_touch(); - new spell_eredar_twins_blaze(); - new AreaTrigger_at_sunwell_eredar_twins(); + new spell_eredar_twins_apply_dark_touched(); + new spell_eredar_twins_apply_flame_touched(); + new spell_eredar_twins_handle_touch(); + new spell_eredar_twins_blaze(); + new AreaTrigger_at_sunwell_eredar_twins(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 4eedc1752..d282e3553 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -12,82 +12,82 @@ REWRITTEN BY XINEF enum Yells { - YELL_BIRTH = 0, - YELL_KILL = 1, - YELL_BREATH = 2, - YELL_TAKEOFF = 3, - YELL_BERSERK = 4, - YELL_DEATH = 5, - EMOTE_BREATH = 6 + YELL_BIRTH = 0, + YELL_KILL = 1, + YELL_BREATH = 2, + YELL_TAKEOFF = 3, + YELL_BERSERK = 4, + YELL_DEATH = 5, + EMOTE_BREATH = 6 }; enum Spells { //Aura - SPELL_NOXIOUS_FUMES = 47002, + SPELL_NOXIOUS_FUMES = 47002, //Land phase - SPELL_BERSERK = 45078, - SPELL_CLEAVE = 19983, - SPELL_CORROSION = 45866, - SPELL_GAS_NOVA = 45855, - SPELL_ENCAPSULATE_CHANNEL = 45661, + SPELL_BERSERK = 45078, + SPELL_CLEAVE = 19983, + SPELL_CORROSION = 45866, + SPELL_GAS_NOVA = 45855, + SPELL_ENCAPSULATE_CHANNEL = 45661, //Flight phase - SPELL_SUMMON_DEMONIC_VAPOR = 45391, - SPELL_DEMONIC_VAPOR_SPAWN_TRIGGER = 45388, // Triggers visual beam - SPELL_DEMONIC_VAPOR_PERIODIC = 45411, // Spawns cloud and deals damage - SPELL_DEMONIC_VAPOR_TRAIL_PERIODIC = 45399, // periodic of cloud - SPELL_DEMONIC_VAPOR = 45402, // cloud dot - SPELL_SUMMON_BLAZING_DEAD = 45400, // spawns skeletons - SPELL_FELMYST_SPEED_BURST = 45495, // speed burst and breath animation - SPELL_FOG_OF_CORRUPTION = 45582, // trigger cast - SPELL_FOG_OF_CORRUPTION_CHARM = 45717, // charm 1 - SPELL_FOG_OF_CORRUPTION_CHARM2 = 45726, // charm 2 + SPELL_SUMMON_DEMONIC_VAPOR = 45391, + SPELL_DEMONIC_VAPOR_SPAWN_TRIGGER = 45388, // Triggers visual beam + SPELL_DEMONIC_VAPOR_PERIODIC = 45411, // Spawns cloud and deals damage + SPELL_DEMONIC_VAPOR_TRAIL_PERIODIC = 45399, // periodic of cloud + SPELL_DEMONIC_VAPOR = 45402, // cloud dot + SPELL_SUMMON_BLAZING_DEAD = 45400, // spawns skeletons + SPELL_FELMYST_SPEED_BURST = 45495, // speed burst and breath animation + SPELL_FOG_OF_CORRUPTION = 45582, // trigger cast + SPELL_FOG_OF_CORRUPTION_CHARM = 45717, // charm 1 + SPELL_FOG_OF_CORRUPTION_CHARM2 = 45726, // charm 2 }; enum Misc { - // Land - EVENT_SPELL_BERSERK = 1, - EVENT_SPELL_CLEAVE = 2, - EVENT_SPELL_CORROSION = 3, - EVENT_SPELL_GAS_NOVA = 4, - EVENT_SPELL_ENCAPSULATE = 5, - EVENT_FLIGHT = 6, - EVENT_LAND = 7, - EVENT_RESTORE_COMBAT = 8, - EVENT_RESTORE_COMBAT2 = 9, + // Land + EVENT_SPELL_BERSERK = 1, + EVENT_SPELL_CLEAVE = 2, + EVENT_SPELL_CORROSION = 3, + EVENT_SPELL_GAS_NOVA = 4, + EVENT_SPELL_ENCAPSULATE = 5, + EVENT_FLIGHT = 6, + EVENT_LAND = 7, + EVENT_RESTORE_COMBAT = 8, + EVENT_RESTORE_COMBAT2 = 9, - // Air - EVENT_FLIGHT_SEQ = 100, - EVENT_FLIGHT_VAPOR = 101, - EVENT_FLIGHT_MOVE_UP = 102, - EVENT_LAND_FIGHT = 103, - EVENT_FLIGHT_EMOTE = 104, - EVENT_FLIGHT_BREATH1 = 105, - EVENT_FLIGHT_BREATH2 = 106, - EVENT_FLIGHT_FLYOVER1 = 107, - EVENT_FLIGHT_FLYOVER2 = 108, - EVENT_CORRUPT_TRIGGERS = 109, + // Air + EVENT_FLIGHT_SEQ = 100, + EVENT_FLIGHT_VAPOR = 101, + EVENT_FLIGHT_MOVE_UP = 102, + EVENT_LAND_FIGHT = 103, + EVENT_FLIGHT_EMOTE = 104, + EVENT_FLIGHT_BREATH1 = 105, + EVENT_FLIGHT_BREATH2 = 106, + EVENT_FLIGHT_FLYOVER1 = 107, + EVENT_FLIGHT_FLYOVER2 = 108, + EVENT_CORRUPT_TRIGGERS = 109, - // Intro - EVENT_INTRO_1 = 20, - EVENT_INTRO_2 = 21, - EVENT_INTRO_3 = 22, - EVENT_INTRO_4 = 23, + // Intro + EVENT_INTRO_1 = 20, + EVENT_INTRO_2 = 21, + EVENT_INTRO_3 = 22, + EVENT_INTRO_4 = 23, - // Misc - ACTION_START_EVENT = 1, - POINT_GROUND = 1, - POINT_AIR = 2, - POINT_AIR_BREATH_START1 = 3, - POINT_AIR_BREATH_END1 = 4, - POINT_AIR_BREATH_START2 = 5, - POINT_AIR_BREATH_END2 = 6, - POINT_MISC = 7, + // Misc + ACTION_START_EVENT = 1, + POINT_GROUND = 1, + POINT_AIR = 2, + POINT_AIR_BREATH_START1 = 3, + POINT_AIR_BREATH_END1 = 4, + POINT_AIR_BREATH_START2 = 5, + POINT_AIR_BREATH_END2 = 6, + POINT_MISC = 7, - NPC_FOG_TRIGGER = 23472 + NPC_FOG_TRIGGER = 23472 }; class CorruptTriggers : public BasicEvent @@ -99,11 +99,11 @@ class CorruptTriggers : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - std::list cList; - _caster->GetCreaturesWithEntryInRange(cList, 70.0f, NPC_FOG_TRIGGER); - for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr) - if (_caster->GetExactDist2d(*itr) <= 11.0f) - (*itr)->CastSpell(*itr, SPELL_FOG_OF_CORRUPTION, true); + std::list cList; + _caster->GetCreaturesWithEntryInRange(cList, 70.0f, NPC_FOG_TRIGGER); + for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr) + if (_caster->GetExactDist2d(*itr) <= 11.0f) + (*itr)->CastSpell(*itr, SPELL_FOG_OF_CORRUPTION, true); return true; } @@ -121,144 +121,144 @@ public: boss_felmystAI(Creature* creature) : BossAI(creature, DATA_FELMYST) { bool appear = instance->GetBossState(DATA_BRUTALLUS) == DONE; - creature->SetVisible(appear); - creature->SetStandState(UNIT_STAND_STATE_SLEEP); - creature->SetReactState(REACT_PASSIVE); + creature->SetVisible(appear); + creature->SetStandState(UNIT_STAND_STATE_SLEEP); + creature->SetReactState(REACT_PASSIVE); } EventMap events2; - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT) - { - me->SetVisible(true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - events2.ScheduleEvent(EVENT_INTRO_1, 3000); - } - } + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT) + { + me->SetVisible(true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + events2.ScheduleEvent(EVENT_INTRO_1, 3000); + } + } void Reset() { - BossAI::Reset(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - me->SetDisableGravity(false); - events2.Reset(); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_FOG_OF_CORRUPTION_CHARM); + BossAI::Reset(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + me->SetDisableGravity(false); + events2.Reset(); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_FOG_OF_CORRUPTION_CHARM); } void EnterCombat(Unit* who) { - BossAI::EnterCombat(who); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (events.Empty() && events2.Empty()) - events2.ScheduleEvent(EVENT_INTRO_2, 3000); + BossAI::EnterCombat(who); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (events.Empty() && events2.Empty()) + events2.ScheduleEvent(EVENT_INTRO_2, 3000); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) - Talk(YELL_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) + Talk(YELL_KILL); } void JustDied(Unit* killer) { - BossAI::JustDied(killer); + BossAI::JustDied(killer); Talk(YELL_DEATH); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_FOG_OF_CORRUPTION_CHARM); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_FOG_OF_CORRUPTION_CHARM); - // Summon Kalecgos (human form of kalecgos fight) - me->SummonCreature(NPC_KALEC, 1526.28f, 700.10f, 60.0f, 4.33f); + // Summon Kalecgos (human form of kalecgos fight) + me->SummonCreature(NPC_KALEC, 1526.28f, 700.10f, 60.0f, 4.33f); } void MovementInform(uint32 type, uint32 point) { - if (type != POINT_MOTION_TYPE) - return; + if (type != POINT_MOTION_TYPE) + return; - if (point == POINT_GROUND) - { - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->SetDisableGravity(false); - me->SendMovementFlagUpdate(); + if (point == POINT_GROUND) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->SetDisableGravity(false); + me->SendMovementFlagUpdate(); - events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0); - events.ScheduleEvent(EVENT_RESTORE_COMBAT2, 1); - events.ScheduleEvent(EVENT_SPELL_CLEAVE, 7500, 1); + events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0); + events.ScheduleEvent(EVENT_RESTORE_COMBAT2, 1); + events.ScheduleEvent(EVENT_SPELL_CLEAVE, 7500, 1); events.ScheduleEvent(EVENT_SPELL_CORROSION, 12000, 1); events.ScheduleEvent(EVENT_SPELL_GAS_NOVA, 18000, 1); events.ScheduleEvent(EVENT_SPELL_ENCAPSULATE, 25000, 1); events.ScheduleEvent(EVENT_FLIGHT, 60000, 1); - } - else if (point == POINT_AIR_BREATH_START1) - { - me->SetTarget(0); - me->SetFacingTo(4.71f); - events.ScheduleEvent(EVENT_FLIGHT_EMOTE, 2000); - events.ScheduleEvent(EVENT_CORRUPT_TRIGGERS, 5000); - events.ScheduleEvent(EVENT_FLIGHT_FLYOVER1, 5000); - } - else if (point == POINT_AIR_BREATH_END1) - { - me->RemoveAurasDueToSpell(SPELL_FELMYST_SPEED_BURST); - me->SetFacingTo(1.57f); - if (events.GetNextEventTime(EVENT_FLIGHT_BREATH1) != 0) - events.ScheduleEvent(EVENT_FLIGHT_BREATH2, 2000); - } - else if (point == POINT_AIR_BREATH_START2) - { - me->SetTarget(0); - me->SetFacingTo(1.57f); - events.ScheduleEvent(EVENT_FLIGHT_EMOTE, 2000); - events.ScheduleEvent(EVENT_CORRUPT_TRIGGERS, 5000); - events.ScheduleEvent(EVENT_FLIGHT_FLYOVER2, 5000); - } - else if (point == POINT_AIR_BREATH_END2) - { - me->RemoveAurasDueToSpell(SPELL_FELMYST_SPEED_BURST); - me->SetFacingTo(4.71f); - } + } + else if (point == POINT_AIR_BREATH_START1) + { + me->SetTarget(0); + me->SetFacingTo(4.71f); + events.ScheduleEvent(EVENT_FLIGHT_EMOTE, 2000); + events.ScheduleEvent(EVENT_CORRUPT_TRIGGERS, 5000); + events.ScheduleEvent(EVENT_FLIGHT_FLYOVER1, 5000); + } + else if (point == POINT_AIR_BREATH_END1) + { + me->RemoveAurasDueToSpell(SPELL_FELMYST_SPEED_BURST); + me->SetFacingTo(1.57f); + if (events.GetNextEventTime(EVENT_FLIGHT_BREATH1) != 0) + events.ScheduleEvent(EVENT_FLIGHT_BREATH2, 2000); + } + else if (point == POINT_AIR_BREATH_START2) + { + me->SetTarget(0); + me->SetFacingTo(1.57f); + events.ScheduleEvent(EVENT_FLIGHT_EMOTE, 2000); + events.ScheduleEvent(EVENT_CORRUPT_TRIGGERS, 5000); + events.ScheduleEvent(EVENT_FLIGHT_FLYOVER2, 5000); + } + else if (point == POINT_AIR_BREATH_END2) + { + me->RemoveAurasDueToSpell(SPELL_FELMYST_SPEED_BURST); + me->SetFacingTo(4.71f); + } } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_INTRO_1: - me->SetStandState(UNIT_STAND_STATE_STAND); - events2.ScheduleEvent(EVENT_INTRO_2, 4000); - break; - case EVENT_INTRO_2: - Talk(YELL_BIRTH); - me->SetDisableGravity(true); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->SendMovementFlagUpdate(); - events2.ScheduleEvent(EVENT_INTRO_3, 1500); - break; - case EVENT_INTRO_3: - me->GetMotionMaster()->MovePoint(POINT_AIR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10.0f, false, true); - events2.ScheduleEvent(EVENT_INTRO_4, 2000); - break; - case EVENT_INTRO_4: - events.ScheduleEvent(EVENT_LAND, 3000, 1); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); - me->SetInCombatWithZone(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->CastSpell(me, SPELL_NOXIOUS_FUMES, true); - me->GetMotionMaster()->MovePoint(POINT_MISC, 1472.18f, 603.38f, 34.0f, false, true); - break; - } + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_INTRO_1: + me->SetStandState(UNIT_STAND_STATE_STAND); + events2.ScheduleEvent(EVENT_INTRO_2, 4000); + break; + case EVENT_INTRO_2: + Talk(YELL_BIRTH); + me->SetDisableGravity(true); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->SendMovementFlagUpdate(); + events2.ScheduleEvent(EVENT_INTRO_3, 1500); + break; + case EVENT_INTRO_3: + me->GetMotionMaster()->MovePoint(POINT_AIR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10.0f, false, true); + events2.ScheduleEvent(EVENT_INTRO_4, 2000); + break; + case EVENT_INTRO_4: + events.ScheduleEvent(EVENT_LAND, 3000, 1); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); + me->SetInCombatWithZone(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->CastSpell(me, SPELL_NOXIOUS_FUMES, true); + me->GetMotionMaster()->MovePoint(POINT_MISC, 1472.18f, 603.38f, 34.0f, false, true); + break; + } - if (!events2.Empty()) - return; + if (!events2.Empty()) + return; if (!UpdateVictim()) return; @@ -267,108 +267,108 @@ public: if (me->HasUnitState(UNIT_STATE_CASTING)) return; - switch(events.ExecuteEvent()) - { - case EVENT_RESTORE_COMBAT: - me->SetReactState(REACT_AGGRESSIVE); - break; - case EVENT_RESTORE_COMBAT2: - me->SetTarget(me->GetVictim()->GetGUID()); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - break; - case EVENT_LAND: - me->GetMotionMaster()->MovePoint(POINT_GROUND, me->GetPositionX(), me->GetPositionY(), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()), false, true); - break; - case EVENT_SPELL_BERSERK: - Talk(YELL_BERSERK); - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_SPELL_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - events.ScheduleEvent(EVENT_SPELL_CLEAVE, 7500, 1); - break; - case EVENT_SPELL_CORROSION: - me->CastSpell(me->GetVictim(), SPELL_CORROSION, false); - events.ScheduleEvent(EVENT_SPELL_CORROSION, 20000, 1); - break; - case EVENT_SPELL_GAS_NOVA: - DoCast(me, SPELL_GAS_NOVA, false); - events.ScheduleEvent(EVENT_SPELL_GAS_NOVA, 20000, 1); - break; - case EVENT_SPELL_ENCAPSULATE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, SPELL_ENCAPSULATE_CHANNEL, false); - events.ScheduleEvent(EVENT_SPELL_ENCAPSULATE, 25000, 1); - break; - case EVENT_FLIGHT: - events.CancelEventGroup(1); - events.ScheduleEvent(EVENT_FLIGHT_SEQ, 1000); - me->SetReactState(REACT_PASSIVE); - me->StopMoving(); - me->GetMotionMaster()->Clear(); - break; - case EVENT_FLIGHT_SEQ: + switch(events.ExecuteEvent()) + { + case EVENT_RESTORE_COMBAT: + me->SetReactState(REACT_AGGRESSIVE); + break; + case EVENT_RESTORE_COMBAT2: + me->SetTarget(me->GetVictim()->GetGUID()); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + break; + case EVENT_LAND: + me->GetMotionMaster()->MovePoint(POINT_GROUND, me->GetPositionX(), me->GetPositionY(), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()), false, true); + break; + case EVENT_SPELL_BERSERK: + Talk(YELL_BERSERK); + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_SPELL_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + events.ScheduleEvent(EVENT_SPELL_CLEAVE, 7500, 1); + break; + case EVENT_SPELL_CORROSION: + me->CastSpell(me->GetVictim(), SPELL_CORROSION, false); + events.ScheduleEvent(EVENT_SPELL_CORROSION, 20000, 1); + break; + case EVENT_SPELL_GAS_NOVA: + DoCast(me, SPELL_GAS_NOVA, false); + events.ScheduleEvent(EVENT_SPELL_GAS_NOVA, 20000, 1); + break; + case EVENT_SPELL_ENCAPSULATE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, SPELL_ENCAPSULATE_CHANNEL, false); + events.ScheduleEvent(EVENT_SPELL_ENCAPSULATE, 25000, 1); + break; + case EVENT_FLIGHT: + events.CancelEventGroup(1); + events.ScheduleEvent(EVENT_FLIGHT_SEQ, 1000); + me->SetReactState(REACT_PASSIVE); + me->StopMoving(); + me->GetMotionMaster()->Clear(); + break; + case EVENT_FLIGHT_SEQ: Talk(YELL_TAKEOFF); - me->SetTarget(0); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->SetDisableGravity(true); - me->SendMovementFlagUpdate(); + me->SetTarget(0); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->SetDisableGravity(true); + me->SendMovementFlagUpdate(); - events.ScheduleEvent(EVENT_FLIGHT_MOVE_UP, 2000); - events.ScheduleEvent(EVENT_FLIGHT_VAPOR, 8000); - events.ScheduleEvent(EVENT_FLIGHT_VAPOR, 21000); - events.ScheduleEvent(EVENT_FLIGHT_BREATH1, 35000); - events.ScheduleEvent(EVENT_FLIGHT_BREATH1, 72000); - events.ScheduleEvent(EVENT_LAND_FIGHT, 86000); - break; - case EVENT_FLIGHT_MOVE_UP: - me->GetMotionMaster()->MovePoint(POINT_AIR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+15.0f, false, true); - break; - case EVENT_FLIGHT_VAPOR: - me->CastSpell(me, SPELL_SUMMON_DEMONIC_VAPOR, true); - break; - case EVENT_FLIGHT_BREATH1: - { - Position pos = {1447.0f + urand(0, 2)*25.0f, 705.0f, 50.0f, 4.71f}; - me->GetMotionMaster()->MovePoint(POINT_AIR_BREATH_START1, pos, false, true); - break; - } - case EVENT_FLIGHT_BREATH2: - { - Position pos = {1447.0f + urand(0, 2)*25.0f, 515.0f, 50.0f, 1.57f}; - me->GetMotionMaster()->MovePoint(POINT_AIR_BREATH_START2, pos, false, true); - break; - } - case EVENT_FLIGHT_EMOTE: - Talk(EMOTE_BREATH); - break; - case EVENT_CORRUPT_TRIGGERS: + events.ScheduleEvent(EVENT_FLIGHT_MOVE_UP, 2000); + events.ScheduleEvent(EVENT_FLIGHT_VAPOR, 8000); + events.ScheduleEvent(EVENT_FLIGHT_VAPOR, 21000); + events.ScheduleEvent(EVENT_FLIGHT_BREATH1, 35000); + events.ScheduleEvent(EVENT_FLIGHT_BREATH1, 72000); + events.ScheduleEvent(EVENT_LAND_FIGHT, 86000); + break; + case EVENT_FLIGHT_MOVE_UP: + me->GetMotionMaster()->MovePoint(POINT_AIR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+15.0f, false, true); + break; + case EVENT_FLIGHT_VAPOR: + me->CastSpell(me, SPELL_SUMMON_DEMONIC_VAPOR, true); + break; + case EVENT_FLIGHT_BREATH1: + { + Position pos = {1447.0f + urand(0, 2)*25.0f, 705.0f, 50.0f, 4.71f}; + me->GetMotionMaster()->MovePoint(POINT_AIR_BREATH_START1, pos, false, true); + break; + } + case EVENT_FLIGHT_BREATH2: + { + Position pos = {1447.0f + urand(0, 2)*25.0f, 515.0f, 50.0f, 1.57f}; + me->GetMotionMaster()->MovePoint(POINT_AIR_BREATH_START2, pos, false, true); + break; + } + case EVENT_FLIGHT_EMOTE: + Talk(EMOTE_BREATH); + break; + case EVENT_CORRUPT_TRIGGERS: me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(0)); - me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(500)); - me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(1000)); - me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(1500)); - me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(2000)); - me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(2500)); - me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(3000)); - me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(3500)); - me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(4000)); - break; - case EVENT_FLIGHT_FLYOVER1: - me->CastSpell(me, SPELL_FELMYST_SPEED_BURST, true); - me->GetMotionMaster()->MovePoint(POINT_AIR_BREATH_END1, me->GetPositionX(), me->GetPositionY()-200.0f, me->GetPositionZ()+5.0f, false, true); - break; - case EVENT_FLIGHT_FLYOVER2: - me->CastSpell(me, SPELL_FELMYST_SPEED_BURST, true); - me->GetMotionMaster()->MovePoint(POINT_AIR_BREATH_END2, me->GetPositionX(), me->GetPositionY()+200.0f, me->GetPositionZ()+5.0f, false, true); - break; - case EVENT_LAND_FIGHT: - me->GetMotionMaster()->MovePoint(POINT_GROUND, 1500.0f, 552.8f, 26.52f, false, true); - break; + me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(500)); + me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(1000)); + me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(1500)); + me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(2000)); + me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(2500)); + me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(3000)); + me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(3500)); + me->m_Events.AddEvent(new CorruptTriggers(me), me->m_Events.CalculateTime(4000)); + break; + case EVENT_FLIGHT_FLYOVER1: + me->CastSpell(me, SPELL_FELMYST_SPEED_BURST, true); + me->GetMotionMaster()->MovePoint(POINT_AIR_BREATH_END1, me->GetPositionX(), me->GetPositionY()-200.0f, me->GetPositionZ()+5.0f, false, true); + break; + case EVENT_FLIGHT_FLYOVER2: + me->CastSpell(me, SPELL_FELMYST_SPEED_BURST, true); + me->GetMotionMaster()->MovePoint(POINT_AIR_BREATH_END2, me->GetPositionX(), me->GetPositionY()+200.0f, me->GetPositionZ()+5.0f, false, true); + break; + case EVENT_LAND_FIGHT: + me->GetMotionMaster()->MovePoint(POINT_GROUND, 1500.0f, 552.8f, 26.52f, false, true); + break; - } + } - if (!me->HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY)) - DoMeleeAttackIfReady(); + if (!me->HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY)) + DoMeleeAttackIfReady(); } }; @@ -393,24 +393,24 @@ public: npc_demonic_vaporAI(Creature* creature) : NullCreatureAI(creature) { } void Reset() - { - me->CastSpell(me, SPELL_DEMONIC_VAPOR_SPAWN_TRIGGER, true); - me->CastSpell(me, SPELL_DEMONIC_VAPOR_PERIODIC, true); - } + { + me->CastSpell(me, SPELL_DEMONIC_VAPOR_SPAWN_TRIGGER, true); + me->CastSpell(me, SPELL_DEMONIC_VAPOR_PERIODIC, true); + } - void UpdateAI(uint32 diff) - { - if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE) - { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (me->GetDistance2d(itr->GetSource()) < 20.0f && itr->GetSource()->IsAlive()) - { - me->GetMotionMaster()->MoveFollow(itr->GetSource(), 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); - break; - } - } - } + void UpdateAI(uint32 diff) + { + if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE) + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (me->GetDistance2d(itr->GetSource()) < 20.0f && itr->GetSource()->IsAlive()) + { + me->GetMotionMaster()->MoveFollow(itr->GetSource(), 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); + break; + } + } + } }; }; @@ -427,40 +427,40 @@ public: struct npc_demonic_vapor_trailAI : public NullCreatureAI { npc_demonic_vapor_trailAI(Creature* creature) : NullCreatureAI(creature) - { - timer = 1; - } + { + timer = 1; + } - uint32 timer; + uint32 timer; void Reset() - { - me->CastSpell(me, SPELL_DEMONIC_VAPOR_TRAIL_PERIODIC, true); - } + { + me->CastSpell(me, SPELL_DEMONIC_VAPOR_TRAIL_PERIODIC, true); + } - void SpellHitTarget(Unit* , const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_DEMONIC_VAPOR) - me->CastSpell(me, SPELL_SUMMON_BLAZING_DEAD, true); - } + void SpellHitTarget(Unit* , const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_DEMONIC_VAPOR) + me->CastSpell(me, SPELL_SUMMON_BLAZING_DEAD, true); + } - void UpdateAI(uint32 diff) - { - if (timer) - { - timer += diff; - if (timer >= 6000) - { - timer = 0; - me->CastSpell(me, SPELL_SUMMON_BLAZING_DEAD, true); - } - } - } + void UpdateAI(uint32 diff) + { + if (timer) + { + timer += diff; + if (timer >= 6000) + { + timer = 0; + me->CastSpell(me, SPELL_SUMMON_BLAZING_DEAD, true); + } + } + } - void JustSummoned(Creature* summon) - { - summon->SetInCombatWithZone(); - summon->AI()->AttackStart(summon->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f)); - } + void JustSummoned(Creature* summon) + { + summon->SetInCombatWithZone(); + summon->AI()->AttackStart(summon->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f)); + } }; }; @@ -475,9 +475,9 @@ class spell_felmyst_fog_of_corruption : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(GetCaster(), SPELL_FOG_OF_CORRUPTION_CHARM, true); + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + target->CastSpell(GetCaster(), SPELL_FOG_OF_CORRUPTION_CHARM, true); } void Register() @@ -503,13 +503,13 @@ class spell_felmyst_fog_of_corruption_charm : public SpellScriptLoader void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - GetTarget()->CastSpell(GetTarget(), SPELL_FOG_OF_CORRUPTION_CHARM2, true); + GetTarget()->CastSpell(GetTarget(), SPELL_FOG_OF_CORRUPTION_CHARM2, true); } void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - GetTarget()->RemoveAurasDueToSpell(SPELL_FOG_OF_CORRUPTION_CHARM2); - Unit::Kill(GetCaster(), GetTarget(), false); + GetTarget()->RemoveAurasDueToSpell(SPELL_FOG_OF_CORRUPTION_CHARM2); + Unit::Kill(GetCaster(), GetTarget(), false); } void Register() @@ -530,11 +530,11 @@ class DoorsGuidCheck public: bool operator()(WorldObject* object) const { - if (object->GetTypeId() != TYPEID_UNIT) - return true; + if (object->GetTypeId() != TYPEID_UNIT) + return true; - Creature* cr = object->ToCreature(); - return cr->GetDBTableGUIDLow() != 54780 && cr->GetDBTableGUIDLow() != 54787 && cr->GetDBTableGUIDLow() != 54801; + Creature* cr = object->ToCreature(); + return cr->GetDBTableGUIDLow() != 54780 && cr->GetDBTableGUIDLow() != 54787 && cr->GetDBTableGUIDLow() != 54801; } }; @@ -568,8 +568,8 @@ void AddSC_boss_felmyst() { new boss_felmyst(); new npc_demonic_vapor(); - new npc_demonic_vapor_trail(); - new spell_felmyst_fog_of_corruption(); - new spell_felmyst_fog_of_corruption_charm(); - new spell_felmyst_open_brutallus_back_doors(); + new npc_demonic_vapor_trail(); + new spell_felmyst_fog_of_corruption(); + new spell_felmyst_fog_of_corruption_charm(); + new spell_felmyst_open_brutallus_back_doors(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index d15a155fc..8220fb202 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -21,80 +21,80 @@ enum Yells SAY_EVIL_SLAY = 1, SAY_GOOD_PLRWIN = 2, SAY_EVIL_ENRAGE = 3, - SAY_SATH_ENRAGE_ME = 4, - SAY_KALEC_ENRAGE_SATH = 5, + SAY_SATH_ENRAGE_ME = 4, + SAY_KALEC_ENRAGE_SATH = 5, SAY_GOOD_AGGRO = 0, SAY_GOOD_NEAR_DEATH = 1, SAY_GOOD_NEAR_DEATH2 = 2, - SAY_GOOD_MADRIGOSA = 3 + SAY_GOOD_MADRIGOSA = 3 }; enum Spells { - SPELL_SPECTRAL_EXHAUSTION = 44867, - SPELL_SPECTRAL_BLAST = 44869, - SPELL_SPECTRAL_BLAST_PORTAL = 44866, - SPELL_SPECTRAL_BLAST_AA = 46648, - SPELL_TELEPORT_SPECTRAL = 46019, + SPELL_SPECTRAL_EXHAUSTION = 44867, + SPELL_SPECTRAL_BLAST = 44869, + SPELL_SPECTRAL_BLAST_PORTAL = 44866, + SPELL_SPECTRAL_BLAST_AA = 46648, + SPELL_TELEPORT_SPECTRAL = 46019, - SPELL_TELEPORT_NORMAL_REALM = 46020, - SPELL_SPECTRAL_REALM = 46021, - SPELL_SPECTRAL_INVISIBILITY = 44801, - SPELL_DEMONIC_VISUAL = 44800, + SPELL_TELEPORT_NORMAL_REALM = 46020, + SPELL_SPECTRAL_REALM = 46021, + SPELL_SPECTRAL_INVISIBILITY = 44801, + SPELL_DEMONIC_VISUAL = 44800, - SPELL_ARCANE_BUFFET = 45018, - SPELL_FROST_BREATH = 44799, - SPELL_TAIL_LASH = 45122, + SPELL_ARCANE_BUFFET = 45018, + SPELL_FROST_BREATH = 44799, + SPELL_TAIL_LASH = 45122, - SPELL_BANISH = 44836, - SPELL_TRANSFORM_KALEC = 44670, - SPELL_CRAZED_RAGE = 44807, + SPELL_BANISH = 44836, + SPELL_TRANSFORM_KALEC = 44670, + SPELL_CRAZED_RAGE = 44807, - SPELL_CORRUPTION_STRIKE = 45029, - SPELL_CURSE_OF_BOUNDLESS_AGONY = 45032, - SPELL_CURSE_OF_BOUNDLESS_AGONY_PLR = 45034, - SPELL_SHADOW_BOLT = 45031, + SPELL_CORRUPTION_STRIKE = 45029, + SPELL_CURSE_OF_BOUNDLESS_AGONY = 45032, + SPELL_CURSE_OF_BOUNDLESS_AGONY_PLR = 45034, + SPELL_SHADOW_BOLT = 45031, - SPELL_HEROIC_STRIKE = 45026, - SPELL_REVITALIZE = 45027 + SPELL_HEROIC_STRIKE = 45026, + SPELL_REVITALIZE = 45027 }; enum SWPActions { - ACTION_ENRAGE = 1, - ACTION_BANISH = 2, - ACTION_SATH_BANISH = 3, - ACTION_KALEC_DIED = 4, - ACTION_ENRAGE_OTHER = 5, + ACTION_ENRAGE = 1, + ACTION_BANISH = 2, + ACTION_SATH_BANISH = 3, + ACTION_KALEC_DIED = 4, + ACTION_ENRAGE_OTHER = 5, }; enum kalEvents { - EVENT_ARCANE_BUFFET = 1, - EVENT_FROST_BREATH = 2, - EVENT_WILD_MAGIC = 3, - EVENT_TAIL_LASH = 4, - EVENT_SPECTRAL_BLAST = 5, - EVENT_CHECK_HEALTH = 6, - EVENT_CHECK_HEALTH2 = 7, - EVENT_CHECK_POS = 8, - EVENT_SPAWN_SPECTRALS = 9, + EVENT_ARCANE_BUFFET = 1, + EVENT_FROST_BREATH = 2, + EVENT_WILD_MAGIC = 3, + EVENT_TAIL_LASH = 4, + EVENT_SPECTRAL_BLAST = 5, + EVENT_CHECK_HEALTH = 6, + EVENT_CHECK_HEALTH2 = 7, + EVENT_CHECK_POS = 8, + EVENT_SPAWN_SPECTRALS = 9, - EVENT_SPELL_REVITALIZE = 10, - EVENT_SPELL_HEROIC_STRIKE = 11, - EVENT_SHADOW_BOLT = 12, - EVENT_AGONY_CURSE = 13, - EVENT_CORRUPTION_STRIKE = 14, + EVENT_SPELL_REVITALIZE = 10, + EVENT_SPELL_HEROIC_STRIKE = 11, + EVENT_SHADOW_BOLT = 12, + EVENT_AGONY_CURSE = 13, + EVENT_CORRUPTION_STRIKE = 14, - EVENT_TALK_GOOD_1 = 20, - EVENT_TALK_GOOD_2 = 21, - EVENT_TALK_GOOD_3 = 22, - EVENT_TALK_GOOD_4 = 23, - EVENT_TALK_GOOD_5 = 24, - EVENT_TALK_BAD_1 = 25, - EVENT_TALK_BAD_2 = 26, - EVENT_TALK_BAD_3 = 27 + EVENT_TALK_GOOD_1 = 20, + EVENT_TALK_GOOD_2 = 21, + EVENT_TALK_GOOD_3 = 22, + EVENT_TALK_GOOD_4 = 23, + EVENT_TALK_GOOD_5 = 24, + EVENT_TALK_BAD_1 = 25, + EVENT_TALK_BAD_2 = 26, + EVENT_TALK_BAD_3 = 27 }; #define DRAGON_REALM_Z 53.079f @@ -110,101 +110,101 @@ public: { } - bool sathBanished; - EventMap events2; + bool sathBanished; + EventMap events2; - bool CanAIAttack(Unit const* target) const - { - return target->GetPositionZ() > 50.0f; - } + bool CanAIAttack(Unit const* target) const + { + return target->GetPositionZ() > 50.0f; + } - void JustReachedHome() - { - BossAI::JustReachedHome(); - me->SetVisible(true); - } + void JustReachedHome() + { + BossAI::JustReachedHome(); + me->SetVisible(true); + } void Reset() { - BossAI::Reset(); - me->SetHealth(me->GetMaxHealth()); + BossAI::Reset(); + me->SetHealth(me->GetMaxHealth()); me->SetStandState(UNIT_STAND_STATE_SLEEP); - me->SetDisableGravity(false); - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - events2.Reset(); + me->SetDisableGravity(false); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + events2.Reset(); - sathBanished = false; - ClearPlayerAuras(); + sathBanished = false; + ClearPlayerAuras(); } - void ClearPlayerAuras() const - { - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_CURSE_OF_BOUNDLESS_AGONY); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_CURSE_OF_BOUNDLESS_AGONY_PLR); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_SPECTRAL_REALM); - } + void ClearPlayerAuras() const + { + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_CURSE_OF_BOUNDLESS_AGONY); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_CURSE_OF_BOUNDLESS_AGONY_PLR); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_SPECTRAL_REALM); + } void DoAction(int32 param) { if (param == ACTION_ENRAGE || param == ACTION_ENRAGE_OTHER) - { - Talk(param == ACTION_ENRAGE ? SAY_KALEC_ENRAGE_SATH : SAY_SATH_ENRAGE_ME); - me->CastSpell(me, SPELL_CRAZED_RAGE, true); - events.CancelEvent(EVENT_CHECK_HEALTH); - return; - } - else if (param == ACTION_BANISH) - { + { + Talk(param == ACTION_ENRAGE ? SAY_KALEC_ENRAGE_SATH : SAY_SATH_ENRAGE_ME); + me->CastSpell(me, SPELL_CRAZED_RAGE, true); + events.CancelEvent(EVENT_CHECK_HEALTH); + return; + } + else if (param == ACTION_BANISH) + { me->CastSpell(me, SPELL_BANISH, true); - events.Reset(); - } - else if (param == ACTION_SATH_BANISH) - sathBanished = true; - else if (param == ACTION_KALEC_DIED) - { - events.Reset(); - events2.ScheduleEvent(EVENT_TALK_BAD_1, 0); - ClearPlayerAuras(); - return; - } + events.Reset(); + } + else if (param == ACTION_SATH_BANISH) + sathBanished = true; + else if (param == ACTION_KALEC_DIED) + { + events.Reset(); + events2.ScheduleEvent(EVENT_TALK_BAD_1, 0); + ClearPlayerAuras(); + return; + } - if (me->HasAura(SPELL_BANISH) && sathBanished) - { - events.Reset(); - events2.ScheduleEvent(EVENT_TALK_GOOD_1, 1000); - ClearPlayerAuras(); - if (Creature* Sath = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SATHROVARR))) - { - Sath->RemoveAllAuras(); - Sath->GetMotionMaster()->MovementExpired(); - Sath->SetReactState(REACT_PASSIVE); - Sath->NearTeleportTo(1696.20f, 915.0f, DRAGON_REALM_Z, Sath->GetOrientation()); - } - } + if (me->HasAura(SPELL_BANISH) && sathBanished) + { + events.Reset(); + events2.ScheduleEvent(EVENT_TALK_GOOD_1, 1000); + ClearPlayerAuras(); + if (Creature* Sath = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SATHROVARR))) + { + Sath->RemoveAllAuras(); + Sath->GetMotionMaster()->MovementExpired(); + Sath->SetReactState(REACT_PASSIVE); + Sath->NearTeleportTo(1696.20f, 915.0f, DRAGON_REALM_Z, Sath->GetOrientation()); + } + } } - void JustDied(Unit* who) - { - BossAI::JustDied(who); - } + void JustDied(Unit* who) + { + BossAI::JustDied(who); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_ARCANE_BUFFET, 6000); - events.ScheduleEvent(EVENT_FROST_BREATH, 15000); - events.ScheduleEvent(EVENT_WILD_MAGIC, 10000); - events.ScheduleEvent(EVENT_TAIL_LASH, 25000); - events.ScheduleEvent(EVENT_SPECTRAL_BLAST, 20000); - events.ScheduleEvent(EVENT_CHECK_POS, 5000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - events.ScheduleEvent(EVENT_SPAWN_SPECTRALS, 16000); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + events.ScheduleEvent(EVENT_ARCANE_BUFFET, 6000); + events.ScheduleEvent(EVENT_FROST_BREATH, 15000); + events.ScheduleEvent(EVENT_WILD_MAGIC, 10000); + events.ScheduleEvent(EVENT_TAIL_LASH, 25000); + events.ScheduleEvent(EVENT_SPECTRAL_BLAST, 20000); + events.ScheduleEvent(EVENT_CHECK_POS, 5000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + events.ScheduleEvent(EVENT_SPAWN_SPECTRALS, 16000); me->SetStandState(UNIT_STAND_STATE_STAND); Talk(SAY_EVIL_AGGRO); - } + } void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) { @@ -214,130 +214,130 @@ public: void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) - Talk(SAY_EVIL_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) + Talk(SAY_EVIL_SLAY); } void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_TALK_GOOD_1: - me->SetRegeneratingHealth(false); - me->RemoveAllAuras(); - me->SetReactState(REACT_PASSIVE); - me->CombatStop(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setFaction(35); - events2.ScheduleEvent(EVENT_TALK_GOOD_2, 1000); - break; - case EVENT_TALK_GOOD_2: - if (Creature* Sath = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SATHROVARR))) - { - summons.Despawn(Sath); - Unit::Kill(me, Sath); - } - events2.ScheduleEvent(EVENT_TALK_GOOD_3, 8000); - break; - case EVENT_TALK_GOOD_3: - Talk(SAY_GOOD_PLRWIN); - events2.ScheduleEvent(EVENT_TALK_GOOD_4, 10000); - break; - case EVENT_TALK_GOOD_4: - me->SetDisableGravity(true); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - events2.ScheduleEvent(EVENT_TALK_GOOD_5, 10000); - break; - case EVENT_TALK_GOOD_5: - me->SetVisible(false); - Unit::Kill(me, me); - break; - case EVENT_TALK_BAD_1: - me->SetReactState(REACT_PASSIVE); - me->CombatStop(); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - Talk(SAY_EVIL_ENRAGE); - events2.ScheduleEvent(EVENT_TALK_BAD_2, 3000); - break; - case EVENT_TALK_BAD_2: - me->SetDisableGravity(true); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - events2.ScheduleEvent(EVENT_TALK_BAD_3, 15000); - break; - case EVENT_TALK_BAD_3: - me->SetVisible(false); - EnterEvadeMode(); - break; - } + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_TALK_GOOD_1: + me->SetRegeneratingHealth(false); + me->RemoveAllAuras(); + me->SetReactState(REACT_PASSIVE); + me->CombatStop(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->setFaction(35); + events2.ScheduleEvent(EVENT_TALK_GOOD_2, 1000); + break; + case EVENT_TALK_GOOD_2: + if (Creature* Sath = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SATHROVARR))) + { + summons.Despawn(Sath); + Unit::Kill(me, Sath); + } + events2.ScheduleEvent(EVENT_TALK_GOOD_3, 8000); + break; + case EVENT_TALK_GOOD_3: + Talk(SAY_GOOD_PLRWIN); + events2.ScheduleEvent(EVENT_TALK_GOOD_4, 10000); + break; + case EVENT_TALK_GOOD_4: + me->SetDisableGravity(true); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + events2.ScheduleEvent(EVENT_TALK_GOOD_5, 10000); + break; + case EVENT_TALK_GOOD_5: + me->SetVisible(false); + Unit::Kill(me, me); + break; + case EVENT_TALK_BAD_1: + me->SetReactState(REACT_PASSIVE); + me->CombatStop(); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + Talk(SAY_EVIL_ENRAGE); + events2.ScheduleEvent(EVENT_TALK_BAD_2, 3000); + break; + case EVENT_TALK_BAD_2: + me->SetDisableGravity(true); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + events2.ScheduleEvent(EVENT_TALK_BAD_3, 15000); + break; + case EVENT_TALK_BAD_3: + me->SetVisible(false); + EnterEvadeMode(); + break; + } - if (!events2.Empty()) - return; + if (!events2.Empty()) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPAWN_SPECTRALS: - me->SummonCreature(NPC_KALEC, 1702.21f, 931.7f, -74.56f, 5.07f, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_SATHROVARR, 1704.62f, 927.78f, -73.9f, 2.0f, TEMPSUMMON_MANUAL_DESPAWN); - break; - case EVENT_ARCANE_BUFFET: - me->CastSpell(me, SPELL_ARCANE_BUFFET, false); - events.ScheduleEvent(EVENT_ARCANE_BUFFET, 8000); - break; - case EVENT_FROST_BREATH: - me->CastSpell(me->GetVictim(), SPELL_FROST_BREATH, false); - events.ScheduleEvent(EVENT_FROST_BREATH, 15000); - break; - case EVENT_TAIL_LASH: - me->CastSpell(me->GetVictim(), SPELL_TAIL_LASH, false); - events.ScheduleEvent(EVENT_TAIL_LASH, 15000); - break; - case EVENT_WILD_MAGIC: - me->CastCustomSpell(RAND(44978, 45001, 45002, 45004, 45006, 45010), SPELLVALUE_MAX_TARGETS, 1, me, false); - events.ScheduleEvent(EVENT_WILD_MAGIC, 20000); - break; - case EVENT_SPECTRAL_BLAST: - me->CastSpell(me, SPELL_SPECTRAL_BLAST, false); - events.ScheduleEvent(EVENT_SPECTRAL_BLAST, urand(15000, 25000)); - break; - case EVENT_CHECK_POS: - if (me->GetDistance(me->GetHomePosition()) > 50.0f) - { - EnterEvadeMode(); - return; - } - events.ScheduleEvent(EVENT_CHECK_POS, 5000); - break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(10)) - { - if (Creature* Sath = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SATHROVARR))) + switch (events.ExecuteEvent()) + { + case EVENT_SPAWN_SPECTRALS: + me->SummonCreature(NPC_KALEC, 1702.21f, 931.7f, -74.56f, 5.07f, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_SATHROVARR, 1704.62f, 927.78f, -73.9f, 2.0f, TEMPSUMMON_MANUAL_DESPAWN); + break; + case EVENT_ARCANE_BUFFET: + me->CastSpell(me, SPELL_ARCANE_BUFFET, false); + events.ScheduleEvent(EVENT_ARCANE_BUFFET, 8000); + break; + case EVENT_FROST_BREATH: + me->CastSpell(me->GetVictim(), SPELL_FROST_BREATH, false); + events.ScheduleEvent(EVENT_FROST_BREATH, 15000); + break; + case EVENT_TAIL_LASH: + me->CastSpell(me->GetVictim(), SPELL_TAIL_LASH, false); + events.ScheduleEvent(EVENT_TAIL_LASH, 15000); + break; + case EVENT_WILD_MAGIC: + me->CastCustomSpell(RAND(44978, 45001, 45002, 45004, 45006, 45010), SPELLVALUE_MAX_TARGETS, 1, me, false); + events.ScheduleEvent(EVENT_WILD_MAGIC, 20000); + break; + case EVENT_SPECTRAL_BLAST: + me->CastSpell(me, SPELL_SPECTRAL_BLAST, false); + events.ScheduleEvent(EVENT_SPECTRAL_BLAST, urand(15000, 25000)); + break; + case EVENT_CHECK_POS: + if (me->GetDistance(me->GetHomePosition()) > 50.0f) + { + EnterEvadeMode(); + return; + } + events.ScheduleEvent(EVENT_CHECK_POS, 5000); + break; + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(10)) + { + if (Creature* Sath = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SATHROVARR))) Sath->AI()->DoAction(ACTION_ENRAGE_OTHER); DoAction(ACTION_ENRAGE); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_CHECK_HEALTH2: - if (me->HealthBelowPct(1)) - { + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_CHECK_HEALTH2: + if (me->HealthBelowPct(1)) + { DoAction(ACTION_BANISH); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - break; - } + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -348,12 +348,12 @@ public: enum Kalec { - SPELL_OPEN_BRUTALLUS_BACK_DOOR = 46650, - MODEL_KALECGOS_DRAGON = 23487, + SPELL_OPEN_BRUTALLUS_BACK_DOOR = 46650, + MODEL_KALECGOS_DRAGON = 23487, - EVENT_KALEC_SCENE_1 = 101, - EVENT_KALEC_SCENE_2 = 102, - EVENT_KALEC_SCENE_3 = 103 + EVENT_KALEC_SCENE_1 = 101, + EVENT_KALEC_SCENE_2 = 102, + EVENT_KALEC_SCENE_3 = 103 }; class boss_kalec : public CreatureScript @@ -370,103 +370,103 @@ public: { boss_kalecAI(Creature* creature) : ScriptedAI(creature) { } - EventMap events; - EventMap events2; + EventMap events; + EventMap events2; void Reset() { - events.Reset(); - events2.Reset(); - if (me->GetPositionY() < 750.0f) - { - me->SetSpeed(MOVE_RUN, 2.4f); - me->SetDisplayId(MODEL_KALECGOS_DRAGON); - me->SetDisableGravity(true); - me->GetMotionMaster()->MovePoint(0, 1483.30f, 657.99f, 28.0f, false, true); - events2.ScheduleEvent(EVENT_KALEC_SCENE_1, 9000); - events2.ScheduleEvent(EVENT_KALEC_SCENE_2, 16000); - events2.ScheduleEvent(EVENT_KALEC_SCENE_3, 22000); - } - else - me->CastSpell(me, SPELL_SPECTRAL_INVISIBILITY, true); + events.Reset(); + events2.Reset(); + if (me->GetPositionY() < 750.0f) + { + me->SetSpeed(MOVE_RUN, 2.4f); + me->SetDisplayId(MODEL_KALECGOS_DRAGON); + me->SetDisableGravity(true); + me->GetMotionMaster()->MovePoint(0, 1483.30f, 657.99f, 28.0f, false, true); + events2.ScheduleEvent(EVENT_KALEC_SCENE_1, 9000); + events2.ScheduleEvent(EVENT_KALEC_SCENE_2, 16000); + events2.ScheduleEvent(EVENT_KALEC_SCENE_3, 22000); + } + else + me->CastSpell(me, SPELL_SPECTRAL_INVISIBILITY, true); } void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) { - if (!who || who->GetEntry() != NPC_SATHROVARR) + if (!who || who->GetEntry() != NPC_SATHROVARR) damage = 0; } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - events.ScheduleEvent(EVENT_SPELL_REVITALIZE, 5000); - events.ScheduleEvent(EVENT_SPELL_HEROIC_STRIKE, 3000); + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + events.ScheduleEvent(EVENT_SPELL_REVITALIZE, 5000); + events.ScheduleEvent(EVENT_SPELL_HEROIC_STRIKE, 3000); Talk(SAY_GOOD_AGGRO); - } + } - void JustDied(Unit*) - { - if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* kalecgos = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS))) - kalecgos->AI()->DoAction(ACTION_KALEC_DIED); - } + void JustDied(Unit*) + { + if (InstanceScript* instance = me->GetInstanceScript()) + if (Creature* kalecgos = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS))) + kalecgos->AI()->DoAction(ACTION_KALEC_DIED); + } void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_KALEC_SCENE_1: - Talk(SAY_GOOD_MADRIGOSA); - me->GetMotionMaster()->MovePoint(0, 1509.0f, 560.0f, 30.0f, false, true); - break; - case EVENT_KALEC_SCENE_2: - me->CastSpell(me, SPELL_OPEN_BRUTALLUS_BACK_DOOR, true); - me->GetInstanceScript()->SetBossState(DATA_FELMYST_DOORS, NOT_STARTED); - me->GetInstanceScript()->SetBossState(DATA_FELMYST_DOORS, DONE); - break; - case EVENT_KALEC_SCENE_3: - me->GetMotionMaster()->MovePoint(0, 1400.0f, 630.0f, 90.0f, false, true); - me->DespawnOrUnsummon(6000); - break; - } + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_KALEC_SCENE_1: + Talk(SAY_GOOD_MADRIGOSA); + me->GetMotionMaster()->MovePoint(0, 1509.0f, 560.0f, 30.0f, false, true); + break; + case EVENT_KALEC_SCENE_2: + me->CastSpell(me, SPELL_OPEN_BRUTALLUS_BACK_DOOR, true); + me->GetInstanceScript()->SetBossState(DATA_FELMYST_DOORS, NOT_STARTED); + me->GetInstanceScript()->SetBossState(DATA_FELMYST_DOORS, DONE); + break; + case EVENT_KALEC_SCENE_3: + me->GetMotionMaster()->MovePoint(0, 1400.0f, 630.0f, 90.0f, false, true); + me->DespawnOrUnsummon(6000); + break; + } if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(50)) - { - Talk(SAY_GOOD_NEAR_DEATH); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_CHECK_HEALTH2: - if (me->HealthBelowPct(10)) - { - Talk(SAY_GOOD_NEAR_DEATH2); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - break; - case EVENT_SPELL_REVITALIZE: - me->CastSpell(me, SPELL_REVITALIZE, false); - events.ScheduleEvent(EVENT_SPELL_REVITALIZE, 10000); - break; - case EVENT_SPELL_HEROIC_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_HEROIC_STRIKE, false); - events.ScheduleEvent(EVENT_SPELL_HEROIC_STRIKE, 5000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(50)) + { + Talk(SAY_GOOD_NEAR_DEATH); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_CHECK_HEALTH2: + if (me->HealthBelowPct(10)) + { + Talk(SAY_GOOD_NEAR_DEATH2); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + break; + case EVENT_SPELL_REVITALIZE: + me->CastSpell(me, SPELL_REVITALIZE, false); + events.ScheduleEvent(EVENT_SPELL_REVITALIZE, 10000); + break; + case EVENT_SPELL_HEROIC_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_HEROIC_STRIKE, false); + events.ScheduleEvent(EVENT_SPELL_HEROIC_STRIKE, 5000); + break; + } DoMeleeAttackIfReady(); } @@ -491,24 +491,24 @@ public: } InstanceScript* instance; - EventMap events; + EventMap events; - bool CanAIAttack(Unit const* target) const - { - return target->GetPositionZ() < 50.0f; - } + bool CanAIAttack(Unit const* target) const + { + return target->GetPositionZ() < 50.0f; + } void Reset() { - events.Reset(); + events.Reset(); me->CastSpell(me, SPELL_DEMONIC_VISUAL, true); - me->CastSpell(me, SPELL_SPECTRAL_INVISIBILITY, true); + me->CastSpell(me, SPELL_SPECTRAL_INVISIBILITY, true); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 7000); - events.ScheduleEvent(EVENT_AGONY_CURSE, 20000); - events.ScheduleEvent(EVENT_CORRUPTION_STRIKE, 13000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + events.ScheduleEvent(EVENT_SHADOW_BOLT, 7000); + events.ScheduleEvent(EVENT_AGONY_CURSE, 20000); + events.ScheduleEvent(EVENT_CORRUPTION_STRIKE, 13000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); } void EnterCombat(Unit* /*who*/) @@ -524,8 +524,8 @@ public: void KilledUnit(Unit* target) { - if (target->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SATH_SLAY); + if (target->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SATH_SLAY); } void JustDied(Unit* /*killer*/) @@ -536,15 +536,15 @@ public: void DoAction(int32 param) { if (param == ACTION_ENRAGE || param == ACTION_ENRAGE_OTHER) - { - me->CastSpell(me, SPELL_CRAZED_RAGE, true); - events.CancelEvent(EVENT_CHECK_HEALTH); - } + { + me->CastSpell(me, SPELL_CRAZED_RAGE, true); + events.CancelEvent(EVENT_CHECK_HEALTH); + } else if (param == ACTION_BANISH) - { - me->CastSpell(me, SPELL_BANISH, true); - events.Reset(); - } + { + me->CastSpell(me, SPELL_BANISH, true); + events.Reset(); + } } void UpdateAI(uint32 diff) @@ -552,50 +552,50 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SHADOW_BOLT: - if (roll_chance_i(20)) - Talk(SAY_SATH_SPELL1); - me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 9000); - break; - case EVENT_AGONY_CURSE: - me->CastCustomSpell(SPELL_CURSE_OF_BOUNDLESS_AGONY, SPELLVALUE_MAX_TARGETS, 1, me, false); - events.ScheduleEvent(EVENT_AGONY_CURSE, 30000); - break; - case EVENT_CORRUPTION_STRIKE: - if (roll_chance_i(20)) - Talk(SAY_SATH_SPELL2); - me->CastSpell(me->GetVictim(), SPELL_CORRUPTION_STRIKE, false); - events.ScheduleEvent(EVENT_CORRUPTION_STRIKE, 9000); - break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(10)) - { - if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* kalecgos = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS))) - kalecgos->AI()->DoAction(ACTION_ENRAGE_OTHER); + switch (events.ExecuteEvent()) + { + case EVENT_SHADOW_BOLT: + if (roll_chance_i(20)) + Talk(SAY_SATH_SPELL1); + me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); + events.ScheduleEvent(EVENT_SHADOW_BOLT, 9000); + break; + case EVENT_AGONY_CURSE: + me->CastCustomSpell(SPELL_CURSE_OF_BOUNDLESS_AGONY, SPELLVALUE_MAX_TARGETS, 1, me, false); + events.ScheduleEvent(EVENT_AGONY_CURSE, 30000); + break; + case EVENT_CORRUPTION_STRIKE: + if (roll_chance_i(20)) + Talk(SAY_SATH_SPELL2); + me->CastSpell(me->GetVictim(), SPELL_CORRUPTION_STRIKE, false); + events.ScheduleEvent(EVENT_CORRUPTION_STRIKE, 9000); + break; + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(10)) + { + if (InstanceScript* instance = me->GetInstanceScript()) + if (Creature* kalecgos = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS))) + kalecgos->AI()->DoAction(ACTION_ENRAGE_OTHER); DoAction(ACTION_ENRAGE); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_CHECK_HEALTH2: - if (me->HealthBelowPct(1)) - { - if (Creature* kalecgos = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS))) + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_CHECK_HEALTH2: + if (me->HealthBelowPct(1)) + { + if (Creature* kalecgos = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS))) kalecgos->AI()->DoAction(ACTION_SATH_BANISH); - DoAction(ACTION_BANISH); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - break; - } + DoAction(ACTION_BANISH); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + break; + } DoMeleeAttackIfReady(); } @@ -604,54 +604,54 @@ public: class SpectralBlastCheck { - public: - SpectralBlastCheck(Unit* victim) : _victim(victim) { } + public: + SpectralBlastCheck(Unit* victim) : _victim(victim) { } - bool operator()(WorldObject* unit) - { - return unit->GetPositionZ() < 50.0f || unit->ToUnit()->HasAura(SPELL_SPECTRAL_EXHAUSTION) || unit->GetGUID() == _victim->GetGUID(); - } - private: - Unit* _victim; + bool operator()(WorldObject* unit) + { + return unit->GetPositionZ() < 50.0f || unit->ToUnit()->HasAura(SPELL_SPECTRAL_EXHAUSTION) || unit->GetGUID() == _victim->GetGUID(); + } + private: + Unit* _victim; }; class spell_kalecgos_spectral_blast_dummy : public SpellScriptLoader { public: - spell_kalecgos_spectral_blast_dummy() : SpellScriptLoader("spell_kalecgos_spectral_blast_dummy") { } + spell_kalecgos_spectral_blast_dummy() : SpellScriptLoader("spell_kalecgos_spectral_blast_dummy") { } - class spell_kalecgos_spectral_blast_dummy_SpellScript : public SpellScript - { - PrepareSpellScript(spell_kalecgos_spectral_blast_dummy_SpellScript); + class spell_kalecgos_spectral_blast_dummy_SpellScript : public SpellScript + { + PrepareSpellScript(spell_kalecgos_spectral_blast_dummy_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove_if(SpectralBlastCheck(GetCaster()->GetVictim())); - Trinity::Containers::RandomResizeList(targets, 1); - } - - void HandleDummy(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - { - target->CastSpell(target, SPELL_SPECTRAL_BLAST_PORTAL, true); - target->CastSpell(target, SPELL_SPECTRAL_BLAST_AA, true); - target->CastSpell(target, SPELL_TELEPORT_SPECTRAL, true); - } - } + void FilterTargets(std::list& targets) + { + targets.remove_if(SpectralBlastCheck(GetCaster()->GetVictim())); + Trinity::Containers::RandomResizeList(targets, 1); + } + + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + { + target->CastSpell(target, SPELL_SPECTRAL_BLAST_PORTAL, true); + target->CastSpell(target, SPELL_SPECTRAL_BLAST_AA, true); + target->CastSpell(target, SPELL_TELEPORT_SPECTRAL, true); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kalecgos_spectral_blast_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_kalecgos_spectral_blast_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kalecgos_spectral_blast_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_kalecgos_spectral_blast_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_kalecgos_spectral_blast_dummy_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_kalecgos_spectral_blast_dummy_SpellScript(); + } }; class spell_kalecgos_curse_of_boundless_agony : public SpellScriptLoader @@ -665,21 +665,21 @@ class spell_kalecgos_curse_of_boundless_agony : public SpellScriptLoader void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript()) - if (instance->IsEncounterInProgress()) - GetUnitOwner()->CastCustomSpell(SPELL_CURSE_OF_BOUNDLESS_AGONY_PLR, SPELLVALUE_MAX_TARGETS, 1, GetUnitOwner(), true); + if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript()) + if (instance->IsEncounterInProgress()) + GetUnitOwner()->CastCustomSpell(SPELL_CURSE_OF_BOUNDLESS_AGONY_PLR, SPELLVALUE_MAX_TARGETS, 1, GetUnitOwner(), true); } void OnPeriodic(AuraEffect const* aurEff) { - if (aurEff->GetTickNumber() > 1 && aurEff->GetTickNumber()%5 == 1) - GetAura()->GetEffect(aurEff->GetEffIndex())->SetAmount(aurEff->GetAmount()*2); + if (aurEff->GetTickNumber() > 1 && aurEff->GetTickNumber()%5 == 1) + GetAura()->GetEffect(aurEff->GetEffIndex())->SetAmount(aurEff->GetAmount()*2); } void Register() { - AfterEffectRemove += AuraEffectRemoveFn(spell_kalecgos_curse_of_boundless_agony_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_kalecgos_curse_of_boundless_agony_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + AfterEffectRemove += AuraEffectRemoveFn(spell_kalecgos_curse_of_boundless_agony_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_kalecgos_curse_of_boundless_agony_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); } }; @@ -700,16 +700,16 @@ class spell_kalecgos_spectral_realm_dummy : public SpellScriptLoader SpellCastResult CheckCast() { - if (GetCaster()->HasAura(SPELL_SPECTRAL_EXHAUSTION)) - return SPELL_FAILED_CASTER_AURASTATE; + if (GetCaster()->HasAura(SPELL_SPECTRAL_EXHAUSTION)) + return SPELL_FAILED_CASTER_AURASTATE; return SPELL_CAST_OK; } void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - GetCaster()->CastSpell(GetCaster(), SPELL_TELEPORT_SPECTRAL, true); + PreventHitDefaultEffect(effIndex); + GetCaster()->CastSpell(GetCaster(), SPELL_TELEPORT_SPECTRAL, true); } void Register() @@ -736,13 +736,13 @@ class spell_kalecgos_spectral_realm : public SpellScriptLoader void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SPECTRAL_EXHAUSTION, true); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_TELEPORT_NORMAL_REALM, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SPECTRAL_EXHAUSTION, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_TELEPORT_NORMAL_REALM, true); } void Register() { - OnEffectRemove += AuraEffectRemoveFn(spell_kalecgos_spectral_realm_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_kalecgos_spectral_realm_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL); } }; @@ -757,8 +757,8 @@ void AddSC_boss_kalecgos() new boss_kalecgos(); new boss_sathrovarr(); new boss_kalec(); - new spell_kalecgos_spectral_blast_dummy(); - new spell_kalecgos_curse_of_boundless_agony(); - new spell_kalecgos_spectral_realm_dummy(); - new spell_kalecgos_spectral_realm(); + new spell_kalecgos_spectral_blast_dummy(); + new spell_kalecgos_curse_of_boundless_agony(); + new spell_kalecgos_spectral_realm_dummy(); + new spell_kalecgos_spectral_realm(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 67a838303..bdf5e7270 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -41,91 +41,91 @@ enum Yells enum Spells { - // Kil'jaeden spells - SPELL_REBIRTH = 44200, - SPELL_SOUL_FLAY = 45442, - SPELL_LEGION_LIGHTNING = 45664, - SPELL_FIRE_BLOOM = 45641, - SPELL_SHADOW_SPIKE = 46680, - SPELL_SINISTER_REFLECTION = 45892, - SPELL_FLAME_DART = 45737, - SPELL_FLAME_DART_EXPLOSION = 45746, - SPELL_DARKNESS_OF_A_THOUSAND_SOULS = 46605, - SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE = 45657, - SPELL_ARMAGEDDON_PERIODIC = 45921, - SPELL_ARMAGEDDON_VISUAL = 45911, - SPELL_ARMAGEDDON_MISSILE = 45909, - SPELL_CUSTOM_08_STATE = 45800, - SPELL_DESTROY_ALL_DRAKES = 46707, + // Kil'jaeden spells + SPELL_REBIRTH = 44200, + SPELL_SOUL_FLAY = 45442, + SPELL_LEGION_LIGHTNING = 45664, + SPELL_FIRE_BLOOM = 45641, + SPELL_SHADOW_SPIKE = 46680, + SPELL_SINISTER_REFLECTION = 45892, + SPELL_FLAME_DART = 45737, + SPELL_FLAME_DART_EXPLOSION = 45746, + SPELL_DARKNESS_OF_A_THOUSAND_SOULS = 46605, + SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE = 45657, + SPELL_ARMAGEDDON_PERIODIC = 45921, + SPELL_ARMAGEDDON_VISUAL = 45911, + SPELL_ARMAGEDDON_MISSILE = 45909, + SPELL_CUSTOM_08_STATE = 45800, + SPELL_DESTROY_ALL_DRAKES = 46707, - // Sinister Reflections - SPELL_SINISTER_REFLECTION_SUMMON = 45891, - SPELL_SINISTER_REFLECTION_CLASS = 45893, - SPELL_SINISTER_REFLECTION_CLONE = 45785, + // Sinister Reflections + SPELL_SINISTER_REFLECTION_SUMMON = 45891, + SPELL_SINISTER_REFLECTION_CLASS = 45893, + SPELL_SINISTER_REFLECTION_CLONE = 45785, - // Misc - SPELL_ANVEENA_ENERGY_DRAIN = 46410, - SPELL_RING_OF_BLUE_FLAMES = 45825, - SPELL_SUMMON_BLUE_DRAKE = 45836, - SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT = 45839, - SPELL_POSSESS_DRAKE_IMMUNITY = 45838, - SPELL_SACRIFICE_OF_ANVEENA = 46474, + // Misc + SPELL_ANVEENA_ENERGY_DRAIN = 46410, + SPELL_RING_OF_BLUE_FLAMES = 45825, + SPELL_SUMMON_BLUE_DRAKE = 45836, + SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT = 45839, + SPELL_POSSESS_DRAKE_IMMUNITY = 45838, + SPELL_SACRIFICE_OF_ANVEENA = 46474, }; enum Misc { - PHASE_DECEIVERS = 1, - PHASE_NORMAL = 2, - PHASE_DARKNESS = 3, - PHASE_ARMAGEDDON = 4, - PHASE_SACRIFICE = 5, + PHASE_DECEIVERS = 1, + PHASE_NORMAL = 2, + PHASE_DARKNESS = 3, + PHASE_ARMAGEDDON = 4, + PHASE_SACRIFICE = 5, - EVENT_GROUP_SPEACH = 1, - ACTION_START_POST_EVENT = 1, - ACTION_NO_KILL_TALK = 2, + EVENT_GROUP_SPEACH = 1, + ACTION_START_POST_EVENT = 1, + ACTION_NO_KILL_TALK = 2, - // Text events - EVENT_TEXT_SPEACH11 = 1, - EVENT_TEXT_SPEACH21 = 2, - EVENT_TEXT_SPEACH22 = 3, - EVENT_TEXT_SPEACH23 = 4, - EVENT_TEXT_SPEACH31 = 5, - EVENT_TEXT_SPEACH32 = 6, - EVENT_TEXT_SPEACH33 = 7, - EVENT_TEXT_SPEACH41 = 8, - EVENT_TEXT_SPEACH42 = 9, - EVENT_TEXT_SPEACH43 = 10, - EVENT_TEXT_SPEACH44 = 11, - EVENT_TEXT_SPEACH45 = 12, - EVENT_TEXT_SPEACH46 = 13, + // Text events + EVENT_TEXT_SPEACH11 = 1, + EVENT_TEXT_SPEACH21 = 2, + EVENT_TEXT_SPEACH22 = 3, + EVENT_TEXT_SPEACH23 = 4, + EVENT_TEXT_SPEACH31 = 5, + EVENT_TEXT_SPEACH32 = 6, + EVENT_TEXT_SPEACH33 = 7, + EVENT_TEXT_SPEACH41 = 8, + EVENT_TEXT_SPEACH42 = 9, + EVENT_TEXT_SPEACH43 = 10, + EVENT_TEXT_SPEACH44 = 11, + EVENT_TEXT_SPEACH45 = 12, + EVENT_TEXT_SPEACH46 = 13, - // Controller events - EVENT_RANDOM_TALK = 40, - EVENT_CHECK_PLAYERS = 41, + // Controller events + EVENT_RANDOM_TALK = 40, + EVENT_CHECK_PLAYERS = 41, - // Misc fight events - EVENT_REBIRTH = 50, - EVENT_INIT_FIGHT = 51, - EVENT_CHECK_HEALTH85 = 52, - EVENT_CHECK_HEALTH55 = 53, - EVENT_CHECK_HEALTH25 = 54, - EVENT_EMPOWER_ORBS1 = 55, - EVENT_EMPOWER_ORBS2 = 56, - EVENT_EMPOWER_ORBS3 = 57, - EVENT_RESTORE_MELEE = 58, - EVENT_KILL_SELF = 59, - EVENT_NO_KILL_TALK = 60, + // Misc fight events + EVENT_REBIRTH = 50, + EVENT_INIT_FIGHT = 51, + EVENT_CHECK_HEALTH85 = 52, + EVENT_CHECK_HEALTH55 = 53, + EVENT_CHECK_HEALTH25 = 54, + EVENT_EMPOWER_ORBS1 = 55, + EVENT_EMPOWER_ORBS2 = 56, + EVENT_EMPOWER_ORBS3 = 57, + EVENT_RESTORE_MELEE = 58, + EVENT_KILL_SELF = 59, + EVENT_NO_KILL_TALK = 60, - // Abilities events - EVENT_SPELL_SOUL_FLAY = 100, - EVENT_SPELL_LEGION_LIGHTNING = 101, - EVENT_SPELL_FIRE_BLOOM = 102, - EVENT_SUMMON_ORBS = 103, - EVENT_SPELL_SHADOW_SPIKE = 104, - EVENT_SPELL_SINISTER_REFLECTION = 105, - EVENT_SPELL_FLAME_DART = 106, - EVENT_SPELL_DARKNESS = 107, - EVENT_SPELL_ARMAGEDDON = 108, + // Abilities events + EVENT_SPELL_SOUL_FLAY = 100, + EVENT_SPELL_LEGION_LIGHTNING = 101, + EVENT_SPELL_FIRE_BLOOM = 102, + EVENT_SUMMON_ORBS = 103, + EVENT_SPELL_SHADOW_SPIKE = 104, + EVENT_SPELL_SINISTER_REFLECTION = 105, + EVENT_SPELL_FLAME_DART = 106, + EVENT_SPELL_DARKNESS = 107, + EVENT_SPELL_ARMAGEDDON = 108, }; class CastArmageddon : public BasicEvent @@ -137,8 +137,8 @@ class CastArmageddon : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - _caster->CastSpell(_caster, SPELL_ARMAGEDDON_MISSILE, true); - _caster->SetPosition(_caster->GetPositionX(), _caster->GetPositionY(), _caster->GetPositionZ()-20.0f, 0.0f); + _caster->CastSpell(_caster, SPELL_ARMAGEDDON_MISSILE, true); + _caster->SetPosition(_caster->GetPositionX(), _caster->GetPositionY(), _caster->GetPositionZ()-20.0f, 0.0f); return true; } @@ -163,98 +163,98 @@ public: instance = creature->GetInstanceScript(); } - EventMap events; + EventMap events; InstanceScript* instance; SummonList summons; - void ResetOrbs() - { - for (uint8 i = 0; i < 4; ++i) - if (GameObject* orb = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1+i))) - orb->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } + void ResetOrbs() + { + for (uint8 i = 0; i < 4; ++i) + if (GameObject* orb = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1+i))) + orb->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } void Reset() { - instance->SetBossState(DATA_KILJAEDEN, NOT_STARTED); - events.Reset(); - summons.DespawnAll(); - ResetOrbs(); + instance->SetBossState(DATA_KILJAEDEN, NOT_STARTED); + events.Reset(); + summons.DespawnAll(); + ResetOrbs(); - me->SummonCreature(NPC_HAND_OF_THE_DECEIVER, 1702.62f, 611.19f, 27.66f, 1.81f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_HAND_OF_THE_DECEIVER, 1684.099f, 618.848f, 27.67f, 0.589f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_HAND_OF_THE_DECEIVER, 1688.38f, 641.10f, 27.50f, 5.43f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_ANVEENA, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+40.0f, 0.0f); + me->SummonCreature(NPC_HAND_OF_THE_DECEIVER, 1702.62f, 611.19f, 27.66f, 1.81f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_HAND_OF_THE_DECEIVER, 1684.099f, 618.848f, 27.67f, 0.589f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_HAND_OF_THE_DECEIVER, 1688.38f, 641.10f, 27.50f, 5.43f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_ANVEENA, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+40.0f, 0.0f); - me->CastSpell(me, SPELL_DESTROY_ALL_DRAKES, true); - me->CastSpell(me, SPELL_ANVEENA_ENERGY_DRAIN, true); - events.ScheduleEvent(EVENT_RANDOM_TALK, 60000); + me->CastSpell(me, SPELL_DESTROY_ALL_DRAKES, true); + me->CastSpell(me, SPELL_ANVEENA_ENERGY_DRAIN, true); + events.ScheduleEvent(EVENT_RANDOM_TALK, 60000); } - void JustDied(Unit*) - { - EntryCheckPredicate kilCheck(NPC_KILJAEDEN); - EntryCheckPredicate kalCheck(NPC_KALECGOS_KJ); - summons.DespawnIf(kilCheck); - summons.DoAction(ACTION_START_POST_EVENT, kalCheck); - summons.DespawnIf(kalCheck); + void JustDied(Unit*) + { + EntryCheckPredicate kilCheck(NPC_KILJAEDEN); + EntryCheckPredicate kalCheck(NPC_KALECGOS_KJ); + summons.DespawnIf(kilCheck); + summons.DoAction(ACTION_START_POST_EVENT, kalCheck); + summons.DespawnIf(kalCheck); - me->CastSpell(me, SPELL_DESTROY_ALL_DRAKES, true); - summons.DespawnAll(); - } + me->CastSpell(me, SPELL_DESTROY_ALL_DRAKES, true); + summons.DespawnAll(); + } void JustSummoned(Creature* summon) { summons.Summon(summon); - if (summon->GetEntry() == NPC_SINISTER_REFLECTION) - summon->SetInCombatWithZone(); - else if (summon->GetEntry() == NPC_KALECGOS_KJ) - summon->setActive(true); + if (summon->GetEntry() == NPC_SINISTER_REFLECTION) + summon->SetInCombatWithZone(); + else if (summon->GetEntry() == NPC_KALECGOS_KJ) + summon->setActive(true); } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); - if (summon->GetEntry() == NPC_HAND_OF_THE_DECEIVER) - { - instance->SetBossState(DATA_KILJAEDEN, IN_PROGRESS); - events.ScheduleEvent(EVENT_CHECK_PLAYERS, 1000); + if (summon->GetEntry() == NPC_HAND_OF_THE_DECEIVER) + { + instance->SetBossState(DATA_KILJAEDEN, IN_PROGRESS); + events.ScheduleEvent(EVENT_CHECK_PLAYERS, 1000); - if (!summons.HasEntry(NPC_HAND_OF_THE_DECEIVER)) - { - me->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN); - me->SummonCreature(NPC_KILJAEDEN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+1.5f, 4.3f, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_KALECGOS_KJ, 1726.80f, 661.43f, 138.65f, 3.95f, TEMPSUMMON_MANUAL_DESPAWN); - } - } - } + if (!summons.HasEntry(NPC_HAND_OF_THE_DECEIVER)) + { + me->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN); + me->SummonCreature(NPC_KILJAEDEN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+1.5f, 4.3f, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_KALECGOS_KJ, 1726.80f, 661.43f, 138.65f, 3.95f, TEMPSUMMON_MANUAL_DESPAWN); + } + } + } void UpdateAI(uint32 diff) { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_RANDOM_TALK: - if (instance->GetBossState(DATA_KILJAEDEN) == NOT_STARTED) - Talk(SAY_KJ_OFFCOMBAT); - events.ScheduleEvent(EVENT_RANDOM_TALK, urand(90000, 180000)); - break; - case EVENT_CHECK_PLAYERS: - { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player* player = itr->GetSource()) - if (!player->IsGameMaster() && me->GetDistance2d(player) < 60.0f && player->IsAlive()) - { - events.ScheduleEvent(EVENT_CHECK_PLAYERS, 1000); - return; - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_RANDOM_TALK: + if (instance->GetBossState(DATA_KILJAEDEN) == NOT_STARTED) + Talk(SAY_KJ_OFFCOMBAT); + events.ScheduleEvent(EVENT_RANDOM_TALK, urand(90000, 180000)); + break; + case EVENT_CHECK_PLAYERS: + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->GetSource()) + if (!player->IsGameMaster() && me->GetDistance2d(player) < 60.0f && player->IsAlive()) + { + events.ScheduleEvent(EVENT_CHECK_PLAYERS, 1000); + return; + } - CreatureAI::EnterEvadeMode(); - break; - } - } + CreatureAI::EnterEvadeMode(); + break; + } + } } }; }; @@ -269,384 +269,384 @@ public: boss_kiljaedenAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); - me->SetReactState(REACT_PASSIVE); + me->SetReactState(REACT_PASSIVE); } InstanceScript* instance; - EventMap events; - EventMap events2; - uint8 phase; + EventMap events; + EventMap events2; + uint8 phase; void InitializeAI() { - ScriptedAI::InitializeAI(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + ScriptedAI::InitializeAI(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - phase = PHASE_NORMAL; - events.Reset(); - events2.Reset(); - events2.ScheduleEvent(EVENT_INIT_FIGHT, 11000); - events2.ScheduleEvent(EVENT_REBIRTH, 0); - me->SetVisible(false); + phase = PHASE_NORMAL; + events.Reset(); + events2.Reset(); + events2.ScheduleEvent(EVENT_INIT_FIGHT, 11000); + events2.ScheduleEvent(EVENT_REBIRTH, 0); + me->SetVisible(false); } void Reset() { - events.Reset(); + events.Reset(); } - void EnterEvadeMode() - { - if (me->GetReactState() == REACT_PASSIVE) - return; - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + if (me->GetReactState() == REACT_PASSIVE) + return; + ScriptedAI::EnterEvadeMode(); + } - void AttackStart(Unit* who) - { - if (me->GetReactState() == REACT_PASSIVE) - return; - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (me->GetReactState() == REACT_PASSIVE) + return; + ScriptedAI::AttackStart(who); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - { - me->SetTarget(0); - me->SetReactState(REACT_PASSIVE); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->SetRegeneratingHealth(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->HandleEmoteCommand(EMOTE_ONESHOT_DROWN); - me->resetAttackTimer(); - events.Reset(); - events2.Reset(); - events2.ScheduleEvent(EVENT_KILL_SELF, 500); - damage = 0; - } - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + { + me->SetTarget(0); + me->SetReactState(REACT_PASSIVE); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->SetRegeneratingHealth(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->HandleEmoteCommand(EMOTE_ONESHOT_DROWN); + me->resetAttackTimer(); + events.Reset(); + events2.Reset(); + events2.ScheduleEvent(EVENT_KILL_SELF, 500); + damage = 0; + } + } void JustDied(Unit* /*killer*/) { - Talk(SAY_KJ_DEATH); + Talk(SAY_KJ_DEATH); instance->SetBossState(DATA_KILJAEDEN, DONE); - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KILJAEDEN_CONTROLLER))) - Unit::Kill(controller, controller); + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KILJAEDEN_CONTROLLER))) + Unit::Kill(controller, controller); } - void DoAction(int32 param) - { - if (param == ACTION_NO_KILL_TALK) - { - events.ScheduleEvent(EVENT_NO_KILL_TALK, 0); - Talk(SAY_KJ_DARKNESS); - } - } + void DoAction(int32 param) + { + if (param == ACTION_NO_KILL_TALK) + { + events.ScheduleEvent(EVENT_NO_KILL_TALK, 0); + Talk(SAY_KJ_DARKNESS); + } + } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && events.GetNextEventTime(EVENT_NO_KILL_TALK) == 0) - Talk(SAY_KJ_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER && events.GetNextEventTime(EVENT_NO_KILL_TALK) == 0) + Talk(SAY_KJ_SLAY); } void EnterCombat(Unit* /*who*/) { - events2.ScheduleEvent(EVENT_TEXT_SPEACH11, 26000, EVENT_GROUP_SPEACH); - Talk(SAY_KJ_EMERGE); + events2.ScheduleEvent(EVENT_TEXT_SPEACH11, 26000, EVENT_GROUP_SPEACH); + Talk(SAY_KJ_EMERGE); - events.SetTimer(200000); - events.ScheduleEvent(EVENT_CHECK_HEALTH85, 1000); - events.ScheduleEvent(EVENT_CHECK_HEALTH55, 1000); - events.ScheduleEvent(EVENT_CHECK_HEALTH25, 1000); - events.ScheduleEvent(EVENT_SPELL_SOUL_FLAY, 0); - events.ScheduleEvent(EVENT_SPELL_LEGION_LIGHTNING, 7000); - events.ScheduleEvent(EVENT_SPELL_FIRE_BLOOM, 9000); - events.ScheduleEvent(EVENT_SUMMON_ORBS, 10000); + events.SetTimer(200000); + events.ScheduleEvent(EVENT_CHECK_HEALTH85, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH55, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH25, 1000); + events.ScheduleEvent(EVENT_SPELL_SOUL_FLAY, 0); + events.ScheduleEvent(EVENT_SPELL_LEGION_LIGHTNING, 7000); + events.ScheduleEvent(EVENT_SPELL_FIRE_BLOOM, 9000); + events.ScheduleEvent(EVENT_SUMMON_ORBS, 10000); } - void JustSummoned(Creature* summon) - { - if (summon->GetEntry() == NPC_ARMAGEDDON_TARGET) - { - summon->SetDisableGravity(true); - summon->SetCanFly(true); - summon->CastSpell(summon, SPELL_ARMAGEDDON_VISUAL, true); - summon->SetPosition(summon->GetPositionX(), summon->GetPositionY(), summon->GetPositionZ()+20.0f, 0.0f); - summon->m_Events.AddEvent(new CastArmageddon(summon), summon->m_Events.CalculateTime(6000)); - summon->DespawnOrUnsummon(10000); - } - } + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() == NPC_ARMAGEDDON_TARGET) + { + summon->SetDisableGravity(true); + summon->SetCanFly(true); + summon->CastSpell(summon, SPELL_ARMAGEDDON_VISUAL, true); + summon->SetPosition(summon->GetPositionX(), summon->GetPositionY(), summon->GetPositionZ()+20.0f, 0.0f); + summon->m_Events.AddEvent(new CastArmageddon(summon), summon->m_Events.CalculateTime(6000)); + summon->DespawnOrUnsummon(10000); + } + } void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_KILL_SELF: - Unit::Kill(me, me); - break; - case EVENT_REBIRTH: - me->SetVisible(true); - me->CastSpell(me, SPELL_REBIRTH, false); - break; - case EVENT_EMPOWER_ORBS1: - if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_KILL_SELF: + Unit::Kill(me, me); + break; + case EVENT_REBIRTH: + me->SetVisible(true); + me->CastSpell(me, SPELL_REBIRTH, false); + break; + case EVENT_EMPOWER_ORBS1: + if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) kalec->AI()->Talk(SAY_KALECGOS_READY1); - EmpowerOrb(false); - break; - case EVENT_EMPOWER_ORBS2: - if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) + EmpowerOrb(false); + break; + case EVENT_EMPOWER_ORBS2: + if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) kalec->AI()->Talk(SAY_KALECGOS_READY2); - EmpowerOrb(false); - break; - case EVENT_EMPOWER_ORBS3: - if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) + EmpowerOrb(false); + break; + case EVENT_EMPOWER_ORBS3: + if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) kalec->AI()->Talk(SAY_KALECGOS_READY_ALL); - EmpowerOrb(true); - break; - case EVENT_INIT_FIGHT: - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetInCombatWithZone(); - return; - case EVENT_TEXT_SPEACH11: - if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) - kalec->AI()->Talk(SAY_KALECGOS_JOIN); - break; - case EVENT_TEXT_SPEACH21: - if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) - kalec->AI()->Talk(SAY_KALECGOS_AWAKEN); - break; - case EVENT_TEXT_SPEACH22: - if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) - sCreatureTextMgr->SendChat(anveena, SAY_ANVEENA_IMPRISONED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); - break; - case EVENT_TEXT_SPEACH23: - Talk(SAY_KJ_PHASE3); - break; - case EVENT_TEXT_SPEACH31: - if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) - kalec->AI()->Talk(SAY_KALECGOS_LETGO); - break; - case EVENT_TEXT_SPEACH32: - if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) - sCreatureTextMgr->SendChat(anveena, SAY_ANVEENA_LOST, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); - break; - case EVENT_TEXT_SPEACH33: - Talk(SAY_KJ_PHASE4); - break; - case EVENT_TEXT_SPEACH41: - if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) - kalec->AI()->Talk(SAY_KALECGOS_FOCUS); - break; - case EVENT_TEXT_SPEACH42: - if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) - sCreatureTextMgr->SendChat(anveena, SAY_ANVEENA_KALEC, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); - break; - case EVENT_TEXT_SPEACH43: - if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) - kalec->AI()->Talk(SAY_KALECGOS_FATE); - break; - case EVENT_TEXT_SPEACH44: - if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) - sCreatureTextMgr->SendChat(anveena, SAY_ANVEENA_GOODBYE, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); - break; - case EVENT_TEXT_SPEACH45: - if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) - { - anveena->RemoveAllAuras(); - anveena->DespawnOrUnsummon(3500); - } - break; - case EVENT_TEXT_SPEACH46: - if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) - { - anveena->CastSpell(anveena, SPELL_SACRIFICE_OF_ANVEENA, true); - me->CastSpell(me, SPELL_CUSTOM_08_STATE, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - events.DelayEvents(7001); - events2.ScheduleEvent(EVENT_RESTORE_MELEE, 7000); - } - Talk(SAY_KJ_PHASE5); - break; - case EVENT_RESTORE_MELEE: - me->RemoveAurasDueToSpell(SPELL_CUSTOM_08_STATE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - break; - } + EmpowerOrb(true); + break; + case EVENT_INIT_FIGHT: + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetInCombatWithZone(); + return; + case EVENT_TEXT_SPEACH11: + if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) + kalec->AI()->Talk(SAY_KALECGOS_JOIN); + break; + case EVENT_TEXT_SPEACH21: + if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) + kalec->AI()->Talk(SAY_KALECGOS_AWAKEN); + break; + case EVENT_TEXT_SPEACH22: + if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) + sCreatureTextMgr->SendChat(anveena, SAY_ANVEENA_IMPRISONED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); + break; + case EVENT_TEXT_SPEACH23: + Talk(SAY_KJ_PHASE3); + break; + case EVENT_TEXT_SPEACH31: + if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) + kalec->AI()->Talk(SAY_KALECGOS_LETGO); + break; + case EVENT_TEXT_SPEACH32: + if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) + sCreatureTextMgr->SendChat(anveena, SAY_ANVEENA_LOST, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); + break; + case EVENT_TEXT_SPEACH33: + Talk(SAY_KJ_PHASE4); + break; + case EVENT_TEXT_SPEACH41: + if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) + kalec->AI()->Talk(SAY_KALECGOS_FOCUS); + break; + case EVENT_TEXT_SPEACH42: + if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) + sCreatureTextMgr->SendChat(anveena, SAY_ANVEENA_KALEC, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); + break; + case EVENT_TEXT_SPEACH43: + if (Creature* kalec = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KALECGOS_KJ))) + kalec->AI()->Talk(SAY_KALECGOS_FATE); + break; + case EVENT_TEXT_SPEACH44: + if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) + sCreatureTextMgr->SendChat(anveena, SAY_ANVEENA_GOODBYE, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE); + break; + case EVENT_TEXT_SPEACH45: + if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) + { + anveena->RemoveAllAuras(); + anveena->DespawnOrUnsummon(3500); + } + break; + case EVENT_TEXT_SPEACH46: + if (Creature* anveena = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ANVEENA))) + { + anveena->CastSpell(anveena, SPELL_SACRIFICE_OF_ANVEENA, true); + me->CastSpell(me, SPELL_CUSTOM_08_STATE, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + events.DelayEvents(7001); + events2.ScheduleEvent(EVENT_RESTORE_MELEE, 7000); + } + Talk(SAY_KJ_PHASE5); + break; + case EVENT_RESTORE_MELEE: + me->RemoveAurasDueToSpell(SPELL_CUSTOM_08_STATE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + break; + } - if (me->GetReactState() != REACT_AGGRESSIVE) - return; + if (me->GetReactState() != REACT_AGGRESSIVE) + return; if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_HEALTH85: - if (me->HealthBelowPct(85)) - { - phase = PHASE_DARKNESS; - events2.CancelEvent(EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH21, 16000, EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH22, 22000, EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH23, 28000, EVENT_GROUP_SPEACH); - events2.RescheduleEvent(EVENT_EMPOWER_ORBS1, 35000); - - events.DelayEvents(2000); - events.ScheduleEvent(EVENT_SPELL_SINISTER_REFLECTION, 500); - events.ScheduleEvent(EVENT_SPELL_SHADOW_SPIKE, 1200); - events.ScheduleEvent(EVENT_SPELL_FLAME_DART, 3000); - events.RescheduleEvent(EVENT_SPELL_DARKNESS, 16000); // will be delayed by 29 secs - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH85, 0); - break; - - case EVENT_CHECK_HEALTH55: - if (me->HealthBelowPct(55)) - { - phase = PHASE_ARMAGEDDON; - events2.CancelEventGroup(EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH31, 16000, EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH32, 22000, EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH33, 28000, EVENT_GROUP_SPEACH); - events2.RescheduleEvent(EVENT_EMPOWER_ORBS2, 35000); - - events.DelayEvents(2000); - events.ScheduleEvent(EVENT_SPELL_SINISTER_REFLECTION, 500); - events.ScheduleEvent(EVENT_SPELL_SHADOW_SPIKE, 1200); - events.RescheduleEvent(EVENT_SPELL_DARKNESS, 15000); // will be delayed by 29 secs - events.ScheduleEvent(EVENT_SPELL_ARMAGEDDON, 10000); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH55, 0); - break; - - case EVENT_CHECK_HEALTH25: - if (me->HealthBelowPct(25)) - { - phase = PHASE_SACRIFICE; - events2.CancelEventGroup(EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH41, 8000, EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH42, 18000, EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH43, 20200, EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH44, 25000, EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH45, 28000, EVENT_GROUP_SPEACH); - events2.ScheduleEvent(EVENT_TEXT_SPEACH46, 30000, EVENT_GROUP_SPEACH); - events2.RescheduleEvent(EVENT_EMPOWER_ORBS3, 61000); + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_HEALTH85: + if (me->HealthBelowPct(85)) + { + phase = PHASE_DARKNESS; + events2.CancelEvent(EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH21, 16000, EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH22, 22000, EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH23, 28000, EVENT_GROUP_SPEACH); + events2.RescheduleEvent(EVENT_EMPOWER_ORBS1, 35000); + + events.DelayEvents(2000); + events.ScheduleEvent(EVENT_SPELL_SINISTER_REFLECTION, 500); + events.ScheduleEvent(EVENT_SPELL_SHADOW_SPIKE, 1200); + events.ScheduleEvent(EVENT_SPELL_FLAME_DART, 3000); + events.RescheduleEvent(EVENT_SPELL_DARKNESS, 16000); // will be delayed by 29 secs + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH85, 0); + break; + + case EVENT_CHECK_HEALTH55: + if (me->HealthBelowPct(55)) + { + phase = PHASE_ARMAGEDDON; + events2.CancelEventGroup(EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH31, 16000, EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH32, 22000, EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH33, 28000, EVENT_GROUP_SPEACH); + events2.RescheduleEvent(EVENT_EMPOWER_ORBS2, 35000); + + events.DelayEvents(2000); + events.ScheduleEvent(EVENT_SPELL_SINISTER_REFLECTION, 500); + events.ScheduleEvent(EVENT_SPELL_SHADOW_SPIKE, 1200); + events.RescheduleEvent(EVENT_SPELL_DARKNESS, 15000); // will be delayed by 29 secs + events.ScheduleEvent(EVENT_SPELL_ARMAGEDDON, 10000); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH55, 0); + break; + + case EVENT_CHECK_HEALTH25: + if (me->HealthBelowPct(25)) + { + phase = PHASE_SACRIFICE; + events2.CancelEventGroup(EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH41, 8000, EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH42, 18000, EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH43, 20200, EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH44, 25000, EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH45, 28000, EVENT_GROUP_SPEACH); + events2.ScheduleEvent(EVENT_TEXT_SPEACH46, 30000, EVENT_GROUP_SPEACH); + events2.RescheduleEvent(EVENT_EMPOWER_ORBS3, 61000); - events.CancelEvent(EVENT_SUMMON_ORBS); - events.DelayEvents(4000); - events.ScheduleEvent(EVENT_SPELL_SINISTER_REFLECTION, 500); - events.ScheduleEvent(EVENT_SPELL_SHADOW_SPIKE, 1200); - events.RescheduleEvent(EVENT_SPELL_DARKNESS, 15000); // will be delayed by 29 secs - events.ScheduleEvent(EVENT_SPELL_ARMAGEDDON, 1500); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH25, 0); - break; - case EVENT_SPELL_SOUL_FLAY: - me->CastSpell(me->GetVictim(), SPELL_SOUL_FLAY, false); - events.ScheduleEvent(EVENT_SPELL_SOUL_FLAY, urand(4000, 5000)); - break; - case EVENT_SPELL_LEGION_LIGHTNING: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) - me->CastSpell(target, SPELL_LEGION_LIGHTNING, false); - events.ScheduleEvent(EVENT_SPELL_LEGION_LIGHTNING, phase == PHASE_SACRIFICE ? 15000 : 30000); - events.RescheduleEvent(EVENT_SPELL_SOUL_FLAY, 2000); + events.CancelEvent(EVENT_SUMMON_ORBS); + events.DelayEvents(4000); + events.ScheduleEvent(EVENT_SPELL_SINISTER_REFLECTION, 500); + events.ScheduleEvent(EVENT_SPELL_SHADOW_SPIKE, 1200); + events.RescheduleEvent(EVENT_SPELL_DARKNESS, 15000); // will be delayed by 29 secs + events.ScheduleEvent(EVENT_SPELL_ARMAGEDDON, 1500); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH25, 0); + break; + case EVENT_SPELL_SOUL_FLAY: + me->CastSpell(me->GetVictim(), SPELL_SOUL_FLAY, false); + events.ScheduleEvent(EVENT_SPELL_SOUL_FLAY, urand(4000, 5000)); + break; + case EVENT_SPELL_LEGION_LIGHTNING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + me->CastSpell(target, SPELL_LEGION_LIGHTNING, false); + events.ScheduleEvent(EVENT_SPELL_LEGION_LIGHTNING, phase == PHASE_SACRIFICE ? 15000 : 30000); + events.RescheduleEvent(EVENT_SPELL_SOUL_FLAY, 2000); break; case EVENT_SPELL_FIRE_BLOOM: - me->CastCustomSpell(SPELL_FIRE_BLOOM, SPELLVALUE_MAX_TARGETS, 5, me, TRIGGERED_NONE); - me->SetTarget(me->GetVictim()->GetGUID()); - events.ScheduleEvent(EVENT_SPELL_FIRE_BLOOM, phase == PHASE_SACRIFICE ? 20000 : 40000); - events.RescheduleEvent(EVENT_SPELL_SOUL_FLAY, 1500); + me->CastCustomSpell(SPELL_FIRE_BLOOM, SPELLVALUE_MAX_TARGETS, 5, me, TRIGGERED_NONE); + me->SetTarget(me->GetVictim()->GetGUID()); + events.ScheduleEvent(EVENT_SPELL_FIRE_BLOOM, phase == PHASE_SACRIFICE ? 20000 : 40000); + events.RescheduleEvent(EVENT_SPELL_SOUL_FLAY, 1500); break; - case EVENT_SUMMON_ORBS: + case EVENT_SUMMON_ORBS: for (uint8 i = 1; i < phase; ++i) { - float x = me->GetPositionX() + 18.0f*cos((i*2.0f-1.0f)*M_PI/3.0f); + float x = me->GetPositionX() + 18.0f*cos((i*2.0f-1.0f)*M_PI/3.0f); float y = me->GetPositionY() + 18.0f*sin((i*2.0f-1.0f)*M_PI/3.0f); if (Creature* orb = me->SummonCreature(NPC_SHIELD_ORB, x, y, 40.0f, 0, TEMPSUMMON_CORPSE_DESPAWN)) - { - Movement::PointsArray movementArray; - movementArray.push_back(G3D::Vector3(x, y, 40.0f)); + { + Movement::PointsArray movementArray; + movementArray.push_back(G3D::Vector3(x, y, 40.0f)); - // generate movement array - for (uint8 j = 1; j < 20; ++j) - { - x = me->GetPositionX() + 18.0f*cos(((i*2.0f-1.0f)*M_PI/3.0f) + (j/20.0f*2*M_PI)); - y = me->GetPositionY() + 18.0f*sin(((i*2.0f-1.0f)*M_PI/3.0f) + (j/20.0f*2*M_PI)); - movementArray.push_back(G3D::Vector3(x, y, 40.0f)); - } - - Movement::MoveSplineInit init(orb); - init.MovebyPath(movementArray); - init.SetCyclic(); - init.Launch(); - } + // generate movement array + for (uint8 j = 1; j < 20; ++j) + { + x = me->GetPositionX() + 18.0f*cos(((i*2.0f-1.0f)*M_PI/3.0f) + (j/20.0f*2*M_PI)); + y = me->GetPositionY() + 18.0f*sin(((i*2.0f-1.0f)*M_PI/3.0f) + (j/20.0f*2*M_PI)); + movementArray.push_back(G3D::Vector3(x, y, 40.0f)); + } + + Movement::MoveSplineInit init(orb); + init.MovebyPath(movementArray); + init.SetCyclic(); + init.Launch(); + } } - events.ScheduleEvent(EVENT_SUMMON_ORBS, 40000); + events.ScheduleEvent(EVENT_SUMMON_ORBS, 40000); break; - case EVENT_SPELL_SHADOW_SPIKE: - events.DelayEvents(27000); - me->CastSpell(me, SPELL_SHADOW_SPIKE, false); + case EVENT_SPELL_SHADOW_SPIKE: + events.DelayEvents(27000); + me->CastSpell(me, SPELL_SHADOW_SPIKE, false); + break; + case EVENT_SPELL_SINISTER_REFLECTION: + Talk(SAY_KJ_REFLECTION); + me->CastCustomSpell(SPELL_SINISTER_REFLECTION, SPELLVALUE_MAX_TARGETS, 1, me, TRIGGERED_NONE); + me->CastCustomSpell(SPELL_SINISTER_REFLECTION, SPELLVALUE_MAX_TARGETS, 1, me, TRIGGERED_NONE); + me->CastCustomSpell(SPELL_SINISTER_REFLECTION, SPELLVALUE_MAX_TARGETS, 1, me, TRIGGERED_NONE); + me->CastCustomSpell(SPELL_SINISTER_REFLECTION, SPELLVALUE_MAX_TARGETS, 1, me, TRIGGERED_NONE); + break; + case EVENT_SPELL_FLAME_DART: + me->CastSpell(me, SPELL_FLAME_DART, false); + events.ScheduleEvent(EVENT_SPELL_FLAME_DART, 10000); + break; + case EVENT_SPELL_DARKNESS: + Talk(EMOTE_KJ_DARKNESS); + me->CastSpell(me, SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false); + events.ScheduleEvent(EVENT_SPELL_DARKNESS, phase == PHASE_SACRIFICE ? 20000 : 45000); + events.DelayEvents(8000); + break; + case EVENT_SPELL_ARMAGEDDON: + me->CastSpell(me, SPELL_ARMAGEDDON_PERIODIC, true); + events.ScheduleEvent(EVENT_SPELL_ARMAGEDDON, phase == PHASE_SACRIFICE ? 20000 : 40000); break; - case EVENT_SPELL_SINISTER_REFLECTION: - Talk(SAY_KJ_REFLECTION); - me->CastCustomSpell(SPELL_SINISTER_REFLECTION, SPELLVALUE_MAX_TARGETS, 1, me, TRIGGERED_NONE); - me->CastCustomSpell(SPELL_SINISTER_REFLECTION, SPELLVALUE_MAX_TARGETS, 1, me, TRIGGERED_NONE); - me->CastCustomSpell(SPELL_SINISTER_REFLECTION, SPELLVALUE_MAX_TARGETS, 1, me, TRIGGERED_NONE); - me->CastCustomSpell(SPELL_SINISTER_REFLECTION, SPELLVALUE_MAX_TARGETS, 1, me, TRIGGERED_NONE); - break; - case EVENT_SPELL_FLAME_DART: - me->CastSpell(me, SPELL_FLAME_DART, false); - events.ScheduleEvent(EVENT_SPELL_FLAME_DART, 10000); - break; - case EVENT_SPELL_DARKNESS: - Talk(EMOTE_KJ_DARKNESS); - me->CastSpell(me, SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false); - events.ScheduleEvent(EVENT_SPELL_DARKNESS, phase == PHASE_SACRIFICE ? 20000 : 45000); - events.DelayEvents(8000); - break; - case EVENT_SPELL_ARMAGEDDON: - me->CastSpell(me, SPELL_ARMAGEDDON_PERIODIC, true); - events.ScheduleEvent(EVENT_SPELL_ARMAGEDDON, phase == PHASE_SACRIFICE ? 20000 : 40000); - break; - } + } DoMeleeAttackIfReady(); } - void EmpowerOrb(bool empowerAll) - { - for (uint8 i = 0; i < 4; ++i) - { - if (GameObject* orb = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1+i))) - { - if (orb->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE)) - { - orb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - if (Creature* trigger = me->SummonTrigger(orb->GetPositionX(), orb->GetPositionY(), orb->GetPositionZ(), 0, 10*MINUTE*IN_MILLISECONDS)) - { - trigger->CastSpell(trigger, SPELL_RING_OF_BLUE_FLAMES, true, NULL, NULL, trigger->GetGUID()); - if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KILJAEDEN_CONTROLLER))) - controller->AI()->JustSummoned(trigger); - } + void EmpowerOrb(bool empowerAll) + { + for (uint8 i = 0; i < 4; ++i) + { + if (GameObject* orb = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1+i))) + { + if (orb->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE)) + { + orb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + if (Creature* trigger = me->SummonTrigger(orb->GetPositionX(), orb->GetPositionY(), orb->GetPositionZ(), 0, 10*MINUTE*IN_MILLISECONDS)) + { + trigger->CastSpell(trigger, SPELL_RING_OF_BLUE_FLAMES, true, NULL, NULL, trigger->GetGUID()); + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_KILJAEDEN_CONTROLLER))) + controller->AI()->JustSummoned(trigger); + } - if (!empowerAll) - break; - } - } - } - } + if (!empowerAll) + break; + } + } + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -657,62 +657,62 @@ public: enum postEvent { - SAY_VELEN_01 = 0, - SAY_VELEN_02 = 1, - SAY_VELEN_03 = 2, - SAY_VELEN_04 = 3, - SAY_VELEN_05 = 4, - SAY_VELEN_06 = 5, - SAY_VELEN_07 = 6, - SAY_VELEN_08 = 7, - SAY_VELEN_09 = 8, - SAY_LIADRIN_01 = 0, - SAY_LIADRIN_02 = 1, - SAY_LIADRIN_03 = 2, + SAY_VELEN_01 = 0, + SAY_VELEN_02 = 1, + SAY_VELEN_03 = 2, + SAY_VELEN_04 = 3, + SAY_VELEN_05 = 4, + SAY_VELEN_06 = 5, + SAY_VELEN_07 = 6, + SAY_VELEN_08 = 7, + SAY_VELEN_09 = 8, + SAY_LIADRIN_01 = 0, + SAY_LIADRIN_02 = 1, + SAY_LIADRIN_03 = 2, - NPC_SHATTERED_SUN_RIFTWAKER = 26289, - NPC_SHATTRATH_PORTAL_DUMMY = 26251, - NPC_INERT_PORTAL = 26254, - NPC_SHATTERED_SUN_SOLDIER = 26259, - NPC_LADY_LIADRIN = 26247, - NPC_PROPHET_VELEN = 26246, - NPC_THE_CORE_OF_ENTROPIUS = 26262, + NPC_SHATTERED_SUN_RIFTWAKER = 26289, + NPC_SHATTRATH_PORTAL_DUMMY = 26251, + NPC_INERT_PORTAL = 26254, + NPC_SHATTERED_SUN_SOLDIER = 26259, + NPC_LADY_LIADRIN = 26247, + NPC_PROPHET_VELEN = 26246, + NPC_THE_CORE_OF_ENTROPIUS = 26262, - SPELL_TELEPORT_AND_TRANSFORM = 46473, - SPELL_OPEN_PORTAL_FROM_SHATTRATH = 46801, - SPELL_TELEPORT_VISUAL = 35517, - SPELL_BOSS_ARCANE_PORTAL_STATE = 42047, - SPELL_CALL_ENTROPIUS = 46818, - SPELL_BLAZE_TO_LIGHT = 46821, - SPELL_SUNWELL_IGNITION = 46822, + SPELL_TELEPORT_AND_TRANSFORM = 46473, + SPELL_OPEN_PORTAL_FROM_SHATTRATH = 46801, + SPELL_TELEPORT_VISUAL = 35517, + SPELL_BOSS_ARCANE_PORTAL_STATE = 42047, + SPELL_CALL_ENTROPIUS = 46818, + SPELL_BLAZE_TO_LIGHT = 46821, + SPELL_SUNWELL_IGNITION = 46822, - EVENT_SCENE_01 = 1, - EVENT_SCENE_02, - EVENT_SCENE_03, - EVENT_SCENE_04, - EVENT_SCENE_05, - EVENT_SCENE_06, - EVENT_SCENE_07, - EVENT_SCENE_08, - EVENT_SCENE_09, - EVENT_SCENE_10, - EVENT_SCENE_11, - EVENT_SCENE_12, - EVENT_SCENE_13, - EVENT_SCENE_14, - EVENT_SCENE_15, - EVENT_SCENE_16, - EVENT_SCENE_17, - EVENT_SCENE_18, - EVENT_SCENE_19, - EVENT_SCENE_20, - EVENT_SCENE_21, - EVENT_SCENE_22, - EVENT_SCENE_23, - EVENT_SCENE_24, - EVENT_SCENE_25, - EVENT_SCENE_26, - EVENT_SCENE_27 + EVENT_SCENE_01 = 1, + EVENT_SCENE_02, + EVENT_SCENE_03, + EVENT_SCENE_04, + EVENT_SCENE_05, + EVENT_SCENE_06, + EVENT_SCENE_07, + EVENT_SCENE_08, + EVENT_SCENE_09, + EVENT_SCENE_10, + EVENT_SCENE_11, + EVENT_SCENE_12, + EVENT_SCENE_13, + EVENT_SCENE_14, + EVENT_SCENE_15, + EVENT_SCENE_16, + EVENT_SCENE_17, + EVENT_SCENE_18, + EVENT_SCENE_19, + EVENT_SCENE_20, + EVENT_SCENE_21, + EVENT_SCENE_22, + EVENT_SCENE_23, + EVENT_SCENE_24, + EVENT_SCENE_25, + EVENT_SCENE_26, + EVENT_SCENE_27 }; class MoveDelayed : public BasicEvent @@ -724,16 +724,16 @@ class MoveDelayed : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - Movement::MoveSplineInit init(_owner); - init.MoveTo(_x, _y, _z, false, true); - init.SetFacing(_o); - init.Launch(); + Movement::MoveSplineInit init(_owner); + init.MoveTo(_x, _y, _z, false, true); + init.SetFacing(_o); + init.Launch(); return true; } private: Creature* _owner; - float _x, _y, _z, _o; + float _x, _y, _z, _o; }; class FixOrientation : public BasicEvent @@ -745,10 +745,10 @@ class FixOrientation : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - std::list cList; - _owner->GetCreaturesWithEntryInRange(cList, 20.0f, NPC_SHATTERED_SUN_SOLDIER); - for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr) - (*itr)->SetFacingTo(_owner->GetOrientation()); + std::list cList; + _owner->GetCreaturesWithEntryInRange(cList, 20.0f, NPC_SHATTERED_SUN_SOLDIER); + for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr) + (*itr)->SetFacingTo(_owner->GetOrientation()); return true; } @@ -773,243 +773,243 @@ public: instance = creature->GetInstanceScript(); } - EventMap events; + EventMap events; InstanceScript* instance; SummonList summons; void Reset() { - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); } - void DoAction(int32 param) - { - if (param == ACTION_START_POST_EVENT) - { - me->SetDisableGravity(false); - me->SetCanFly(false); - me->CastSpell(me, SPELL_TELEPORT_AND_TRANSFORM, true); - events.ScheduleEvent(EVENT_SCENE_01, 35000); - } - } + void DoAction(int32 param) + { + if (param == ACTION_START_POST_EVENT) + { + me->SetDisableGravity(false); + me->SetCanFly(false); + me->CastSpell(me, SPELL_TELEPORT_AND_TRANSFORM, true); + events.ScheduleEvent(EVENT_SCENE_01, 35000); + } + } void JustSummoned(Creature* summon) { summons.Summon(summon); - if (summon->GetEntry() == NPC_SHATTERED_SUN_RIFTWAKER) - { - summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); - Movement::MoveSplineInit init(summon); - if (summons.size() == 1) - { - init.MoveTo(1727.08f, 656.82f, 28.37f, false, true); - init.SetFacing(5.14f); - } - else - { - init.MoveTo(1738.84f, 627.32f, 28.26f, false, true); - init.SetFacing(2.0f); - } - init.Launch(); - } - else if (summon->GetEntry() == NPC_SHATTRATH_PORTAL_DUMMY) - { - if (Creature* riftwaker = summon->FindNearestCreature(NPC_SHATTERED_SUN_RIFTWAKER, 10.0f)) - riftwaker->CastSpell(summon, SPELL_OPEN_PORTAL_FROM_SHATTRATH, false); - summon->SetWalk(true); - summon->GetMotionMaster()->MovePoint(0, summon->GetPositionX(), summon->GetPositionY(), summon->GetPositionZ()+30.0f, false, true); - } - else if (summon->GetEntry() == NPC_INERT_PORTAL) - summon->CastSpell(summon, SPELL_BOSS_ARCANE_PORTAL_STATE, true); - else if (summon->GetEntry() == NPC_SHATTERED_SUN_SOLDIER) - summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); - else if (summon->GetEntry() == NPC_LADY_LIADRIN) - { - summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); - summon->SetWalk(true); - } - else if (summon->GetEntry() == NPC_PROPHET_VELEN) - { - summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); - summon->SetWalk(true); - summon->GetMotionMaster()->MovePoint(0, 1710.15f, 639.23f, 27.311f, false, true); - } - else if (summon->GetEntry() == NPC_THE_CORE_OF_ENTROPIUS) - summon->GetMotionMaster()->MovePoint(0, summon->GetPositionX(), summon->GetPositionY(), 30.0f); + if (summon->GetEntry() == NPC_SHATTERED_SUN_RIFTWAKER) + { + summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); + Movement::MoveSplineInit init(summon); + if (summons.size() == 1) + { + init.MoveTo(1727.08f, 656.82f, 28.37f, false, true); + init.SetFacing(5.14f); + } + else + { + init.MoveTo(1738.84f, 627.32f, 28.26f, false, true); + init.SetFacing(2.0f); + } + init.Launch(); + } + else if (summon->GetEntry() == NPC_SHATTRATH_PORTAL_DUMMY) + { + if (Creature* riftwaker = summon->FindNearestCreature(NPC_SHATTERED_SUN_RIFTWAKER, 10.0f)) + riftwaker->CastSpell(summon, SPELL_OPEN_PORTAL_FROM_SHATTRATH, false); + summon->SetWalk(true); + summon->GetMotionMaster()->MovePoint(0, summon->GetPositionX(), summon->GetPositionY(), summon->GetPositionZ()+30.0f, false, true); + } + else if (summon->GetEntry() == NPC_INERT_PORTAL) + summon->CastSpell(summon, SPELL_BOSS_ARCANE_PORTAL_STATE, true); + else if (summon->GetEntry() == NPC_SHATTERED_SUN_SOLDIER) + summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); + else if (summon->GetEntry() == NPC_LADY_LIADRIN) + { + summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); + summon->SetWalk(true); + } + else if (summon->GetEntry() == NPC_PROPHET_VELEN) + { + summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); + summon->SetWalk(true); + summon->GetMotionMaster()->MovePoint(0, 1710.15f, 639.23f, 27.311f, false, true); + } + else if (summon->GetEntry() == NPC_THE_CORE_OF_ENTROPIUS) + summon->GetMotionMaster()->MovePoint(0, summon->GetPositionX(), summon->GetPositionY(), 30.0f); } void UpdateAI(uint32 diff) { - events.Update(diff); - switch (uint32 eventId = events.ExecuteEvent()) - { - case EVENT_SCENE_01: - Talk(SAY_KALECGOS_GOODBYE); - events.ScheduleEvent(eventId+1, 15000); - break; - case EVENT_SCENE_02: - me->SummonCreature(NPC_SHATTERED_SUN_RIFTWAKER, 1688.42f, 641.82f, 27.60f, 0.67f); - me->SummonCreature(NPC_SHATTERED_SUN_RIFTWAKER, 1712.58f, 616.29f, 27.78f, 0.76f); - events.ScheduleEvent(eventId+1, 6000); - break; - case EVENT_SCENE_03: - me->SummonCreature(NPC_SHATTRATH_PORTAL_DUMMY, 1727.08f+cos(5.14f), 656.82f+sin(5.14f), 28.37f+2.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_SHATTRATH_PORTAL_DUMMY, 1738.84f+cos(2.0f), 627.32f+sin(2.0f), 28.26f+2.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 10000); - events.ScheduleEvent(eventId+1, 11000); - break; - case EVENT_SCENE_04: - me->SummonCreature(NPC_INERT_PORTAL, 1734.96f, 642.43f, 28.06f, 3.49f); - events.ScheduleEvent(eventId+1, 4000); - break; - case EVENT_SCENE_05: - if (Creature* first = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f, 640.49f, 28.06f, 3.49f)) - { - first->m_Events.AddEvent(new MoveDelayed(first, 1718.70f, 607.78f, 28.06f, 2.323f), first->m_Events.CalculateTime(5000)); - first->m_Events.AddEvent(new FixOrientation(first), first->m_Events.CalculateTime(12000)); - for (uint8 i = 0; i < 9; ++i) - if (Creature* follower = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f+5*cos(i*2.0f*M_PI/9), 640.49f+5*sin(i*2.0f*M_PI/9), 28.06f, 3.49f)) - follower->GetMotionMaster()->MoveFollow(first, 3.0f, follower->GetAngle(first)); - } - events.ScheduleEvent(eventId+1, 10000); - break; - case EVENT_SCENE_06: - if (Creature* first = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f, 640.49f, 28.06f, 3.49f)) - { - first->m_Events.AddEvent(new MoveDelayed(first, 1678.69f, 649.27f, 28.06f, 5.46f), first->m_Events.CalculateTime(5000)); - first->m_Events.AddEvent(new FixOrientation(first), first->m_Events.CalculateTime(14500)); - for (uint8 i = 0; i < 9; ++i) - if (Creature* follower = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f+5*cos(i*2.0f*M_PI/9), 640.49f+5*sin(i*2.0f*M_PI/9), 28.06f, 3.49f)) - follower->GetMotionMaster()->MoveFollow(first, 3.0f, follower->GetAngle(first)); - } - events.ScheduleEvent(eventId+1, 12000); - break; - case EVENT_SCENE_07: - me->SummonCreature(NPC_LADY_LIADRIN, 1719.87f, 644.265f, 28.06f, 3.83f); - me->SummonCreature(NPC_PROPHET_VELEN, 1717.97f, 646.44f, 28.06f, 3.94f); - events.ScheduleEvent(eventId+1, 7000); - break; - case EVENT_SCENE_08: - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - velen->AI()->Talk(SAY_VELEN_01); - events.ScheduleEvent(eventId+1, 25000); - break; - case EVENT_SCENE_09: - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - velen->AI()->Talk(SAY_VELEN_02); - events.ScheduleEvent(eventId+1, 14500); - break; - case EVENT_SCENE_10: - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - velen->AI()->Talk(SAY_VELEN_03); - events.ScheduleEvent(eventId+1, 12500); - break; - case EVENT_SCENE_11: - me->SummonCreature(NPC_THE_CORE_OF_ENTROPIUS, 1698.86f, 628.73f, 92.83f, 0.0f); - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - velen->CastSpell(velen, SPELL_CALL_ENTROPIUS, false); - events.ScheduleEvent(eventId+1, 8000); - break; - case EVENT_SCENE_12: - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - { - velen->InterruptNonMeleeSpells(false); - velen->AI()->Talk(SAY_VELEN_04); - } - events.ScheduleEvent(eventId+1, 20000); - break; - case EVENT_SCENE_13: - if (Creature* liadrin = summons.GetCreatureWithEntry(NPC_LADY_LIADRIN)) - liadrin->GetMotionMaster()->MovePoint(0, 1711.28f, 637.29f, 27.29f); - events.ScheduleEvent(eventId+1, 6000); - break; - case EVENT_SCENE_14: - if (Creature* liadrin = summons.GetCreatureWithEntry(NPC_LADY_LIADRIN)) - liadrin->AI()->Talk(SAY_LIADRIN_01); - events.ScheduleEvent(eventId+1, 10000); - break; - case EVENT_SCENE_15: - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - velen->AI()->Talk(SAY_VELEN_05); - events.ScheduleEvent(eventId+1, 14000); - break; - case EVENT_SCENE_16: - if (Creature* liadrin = summons.GetCreatureWithEntry(NPC_LADY_LIADRIN)) - liadrin->AI()->Talk(SAY_LIADRIN_02); - events.ScheduleEvent(eventId+1, 2000); - break; - case EVENT_SCENE_17: - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - velen->AI()->Talk(SAY_VELEN_06); - events.ScheduleEvent(eventId+1, 3000); - break; - case EVENT_SCENE_18: - if (Creature* core = summons.GetCreatureWithEntry(NPC_THE_CORE_OF_ENTROPIUS)) - { - core->RemoveAllAuras(); - core->CastSpell(core, SPELL_BLAZE_TO_LIGHT, true); - } - events.ScheduleEvent(eventId+1, 8000); - break; - case EVENT_SCENE_19: - if (Creature* core = summons.GetCreatureWithEntry(NPC_THE_CORE_OF_ENTROPIUS)) - { - core->SetObjectScale(0.75f); - core->GetMotionMaster()->MovePoint(0, core->GetPositionX(), core->GetPositionY(), 28.0f); - } - events.ScheduleEvent(eventId+1, 2000); - break; - case EVENT_SCENE_20: - if (Creature* core = summons.GetCreatureWithEntry(NPC_THE_CORE_OF_ENTROPIUS)) - core->CastSpell(core, SPELL_SUNWELL_IGNITION, true); - events.ScheduleEvent(eventId+1, 3000); - break; - case EVENT_SCENE_21: - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - velen->AI()->Talk(SAY_VELEN_07); - events.ScheduleEvent(eventId+1, 15000); - break; - case EVENT_SCENE_22: - if (Creature* liadrin = summons.GetCreatureWithEntry(NPC_LADY_LIADRIN)) - liadrin->AI()->Talk(SAY_LIADRIN_03); - events.ScheduleEvent(eventId+1, 20000); - break; - case EVENT_SCENE_23: - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - velen->AI()->Talk(SAY_VELEN_08); - if (Creature* liadrin = summons.GetCreatureWithEntry(NPC_LADY_LIADRIN)) - liadrin->SetStandState(UNIT_STAND_STATE_KNEEL); - events.ScheduleEvent(eventId+1, 8000); - break; - case EVENT_SCENE_24: - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - velen->AI()->Talk(SAY_VELEN_09); - events.ScheduleEvent(eventId+1, 5000); - break; - case EVENT_SCENE_25: - if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) - { - velen->GetMotionMaster()->MovePoint(0, 1739.38f, 643.79f, 28.06f); - velen->DespawnOrUnsummon(5000); - } - events.ScheduleEvent(eventId+1, 3000); - break; - case EVENT_SCENE_26: - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetEntry() == NPC_SHATTERED_SUN_SOLDIER) - { - summon->GetMotionMaster()->MovePoint(0, 1739.38f, 643.79f, 28.06f); - summon->DespawnOrUnsummon(summon->GetExactDist2d(1734.96f, 642.43f)*100); - } - events.ScheduleEvent(eventId+1, 7000); - break; - case EVENT_SCENE_27: - me->setActive(false); - summons.DespawnEntry(NPC_INERT_PORTAL); - summons.DespawnEntry(NPC_SHATTERED_SUN_RIFTWAKER); - break; - } + events.Update(diff); + switch (uint32 eventId = events.ExecuteEvent()) + { + case EVENT_SCENE_01: + Talk(SAY_KALECGOS_GOODBYE); + events.ScheduleEvent(eventId+1, 15000); + break; + case EVENT_SCENE_02: + me->SummonCreature(NPC_SHATTERED_SUN_RIFTWAKER, 1688.42f, 641.82f, 27.60f, 0.67f); + me->SummonCreature(NPC_SHATTERED_SUN_RIFTWAKER, 1712.58f, 616.29f, 27.78f, 0.76f); + events.ScheduleEvent(eventId+1, 6000); + break; + case EVENT_SCENE_03: + me->SummonCreature(NPC_SHATTRATH_PORTAL_DUMMY, 1727.08f+cos(5.14f), 656.82f+sin(5.14f), 28.37f+2.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_SHATTRATH_PORTAL_DUMMY, 1738.84f+cos(2.0f), 627.32f+sin(2.0f), 28.26f+2.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 10000); + events.ScheduleEvent(eventId+1, 11000); + break; + case EVENT_SCENE_04: + me->SummonCreature(NPC_INERT_PORTAL, 1734.96f, 642.43f, 28.06f, 3.49f); + events.ScheduleEvent(eventId+1, 4000); + break; + case EVENT_SCENE_05: + if (Creature* first = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f, 640.49f, 28.06f, 3.49f)) + { + first->m_Events.AddEvent(new MoveDelayed(first, 1718.70f, 607.78f, 28.06f, 2.323f), first->m_Events.CalculateTime(5000)); + first->m_Events.AddEvent(new FixOrientation(first), first->m_Events.CalculateTime(12000)); + for (uint8 i = 0; i < 9; ++i) + if (Creature* follower = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f+5*cos(i*2.0f*M_PI/9), 640.49f+5*sin(i*2.0f*M_PI/9), 28.06f, 3.49f)) + follower->GetMotionMaster()->MoveFollow(first, 3.0f, follower->GetAngle(first)); + } + events.ScheduleEvent(eventId+1, 10000); + break; + case EVENT_SCENE_06: + if (Creature* first = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f, 640.49f, 28.06f, 3.49f)) + { + first->m_Events.AddEvent(new MoveDelayed(first, 1678.69f, 649.27f, 28.06f, 5.46f), first->m_Events.CalculateTime(5000)); + first->m_Events.AddEvent(new FixOrientation(first), first->m_Events.CalculateTime(14500)); + for (uint8 i = 0; i < 9; ++i) + if (Creature* follower = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f+5*cos(i*2.0f*M_PI/9), 640.49f+5*sin(i*2.0f*M_PI/9), 28.06f, 3.49f)) + follower->GetMotionMaster()->MoveFollow(first, 3.0f, follower->GetAngle(first)); + } + events.ScheduleEvent(eventId+1, 12000); + break; + case EVENT_SCENE_07: + me->SummonCreature(NPC_LADY_LIADRIN, 1719.87f, 644.265f, 28.06f, 3.83f); + me->SummonCreature(NPC_PROPHET_VELEN, 1717.97f, 646.44f, 28.06f, 3.94f); + events.ScheduleEvent(eventId+1, 7000); + break; + case EVENT_SCENE_08: + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + velen->AI()->Talk(SAY_VELEN_01); + events.ScheduleEvent(eventId+1, 25000); + break; + case EVENT_SCENE_09: + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + velen->AI()->Talk(SAY_VELEN_02); + events.ScheduleEvent(eventId+1, 14500); + break; + case EVENT_SCENE_10: + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + velen->AI()->Talk(SAY_VELEN_03); + events.ScheduleEvent(eventId+1, 12500); + break; + case EVENT_SCENE_11: + me->SummonCreature(NPC_THE_CORE_OF_ENTROPIUS, 1698.86f, 628.73f, 92.83f, 0.0f); + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + velen->CastSpell(velen, SPELL_CALL_ENTROPIUS, false); + events.ScheduleEvent(eventId+1, 8000); + break; + case EVENT_SCENE_12: + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + { + velen->InterruptNonMeleeSpells(false); + velen->AI()->Talk(SAY_VELEN_04); + } + events.ScheduleEvent(eventId+1, 20000); + break; + case EVENT_SCENE_13: + if (Creature* liadrin = summons.GetCreatureWithEntry(NPC_LADY_LIADRIN)) + liadrin->GetMotionMaster()->MovePoint(0, 1711.28f, 637.29f, 27.29f); + events.ScheduleEvent(eventId+1, 6000); + break; + case EVENT_SCENE_14: + if (Creature* liadrin = summons.GetCreatureWithEntry(NPC_LADY_LIADRIN)) + liadrin->AI()->Talk(SAY_LIADRIN_01); + events.ScheduleEvent(eventId+1, 10000); + break; + case EVENT_SCENE_15: + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + velen->AI()->Talk(SAY_VELEN_05); + events.ScheduleEvent(eventId+1, 14000); + break; + case EVENT_SCENE_16: + if (Creature* liadrin = summons.GetCreatureWithEntry(NPC_LADY_LIADRIN)) + liadrin->AI()->Talk(SAY_LIADRIN_02); + events.ScheduleEvent(eventId+1, 2000); + break; + case EVENT_SCENE_17: + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + velen->AI()->Talk(SAY_VELEN_06); + events.ScheduleEvent(eventId+1, 3000); + break; + case EVENT_SCENE_18: + if (Creature* core = summons.GetCreatureWithEntry(NPC_THE_CORE_OF_ENTROPIUS)) + { + core->RemoveAllAuras(); + core->CastSpell(core, SPELL_BLAZE_TO_LIGHT, true); + } + events.ScheduleEvent(eventId+1, 8000); + break; + case EVENT_SCENE_19: + if (Creature* core = summons.GetCreatureWithEntry(NPC_THE_CORE_OF_ENTROPIUS)) + { + core->SetObjectScale(0.75f); + core->GetMotionMaster()->MovePoint(0, core->GetPositionX(), core->GetPositionY(), 28.0f); + } + events.ScheduleEvent(eventId+1, 2000); + break; + case EVENT_SCENE_20: + if (Creature* core = summons.GetCreatureWithEntry(NPC_THE_CORE_OF_ENTROPIUS)) + core->CastSpell(core, SPELL_SUNWELL_IGNITION, true); + events.ScheduleEvent(eventId+1, 3000); + break; + case EVENT_SCENE_21: + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + velen->AI()->Talk(SAY_VELEN_07); + events.ScheduleEvent(eventId+1, 15000); + break; + case EVENT_SCENE_22: + if (Creature* liadrin = summons.GetCreatureWithEntry(NPC_LADY_LIADRIN)) + liadrin->AI()->Talk(SAY_LIADRIN_03); + events.ScheduleEvent(eventId+1, 20000); + break; + case EVENT_SCENE_23: + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + velen->AI()->Talk(SAY_VELEN_08); + if (Creature* liadrin = summons.GetCreatureWithEntry(NPC_LADY_LIADRIN)) + liadrin->SetStandState(UNIT_STAND_STATE_KNEEL); + events.ScheduleEvent(eventId+1, 8000); + break; + case EVENT_SCENE_24: + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + velen->AI()->Talk(SAY_VELEN_09); + events.ScheduleEvent(eventId+1, 5000); + break; + case EVENT_SCENE_25: + if (Creature* velen = summons.GetCreatureWithEntry(NPC_PROPHET_VELEN)) + { + velen->GetMotionMaster()->MovePoint(0, 1739.38f, 643.79f, 28.06f); + velen->DespawnOrUnsummon(5000); + } + events.ScheduleEvent(eventId+1, 3000); + break; + case EVENT_SCENE_26: + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetEntry() == NPC_SHATTERED_SUN_SOLDIER) + { + summon->GetMotionMaster()->MovePoint(0, 1739.38f, 643.79f, 28.06f); + summon->DespawnOrUnsummon(summon->GetExactDist2d(1734.96f, 642.43f)*100); + } + events.ScheduleEvent(eventId+1, 7000); + break; + case EVENT_SCENE_27: + me->setActive(false); + summons.DespawnEntry(NPC_INERT_PORTAL); + summons.DespawnEntry(NPC_SHATTERED_SUN_RIFTWAKER); + break; + } } }; }; @@ -1026,8 +1026,8 @@ class spell_kiljaeden_shadow_spike : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) - GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) + GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); } void Register() @@ -1044,100 +1044,100 @@ class spell_kiljaeden_shadow_spike : public SpellScriptLoader class spell_kiljaeden_sinister_reflection : public SpellScriptLoader { - public: - spell_kiljaeden_sinister_reflection() : SpellScriptLoader("spell_kiljaeden_sinister_reflection") { } + public: + spell_kiljaeden_sinister_reflection() : SpellScriptLoader("spell_kiljaeden_sinister_reflection") { } - class spell_kiljaeden_sinister_reflection_SpellScript : public SpellScript - { - PrepareSpellScript(spell_kiljaeden_sinister_reflection_SpellScript); + class spell_kiljaeden_sinister_reflection_SpellScript : public SpellScript + { + PrepareSpellScript(spell_kiljaeden_sinister_reflection_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT)); - } + void FilterTargets(std::list& targets) + { + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT)); + } - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - { - target->CastSpell(target, SPELL_SINISTER_REFLECTION_SUMMON, true); - //target->CastSpell(target, SPELL_SINISTER_REFLECTION_CLONE, true); - } - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + { + target->CastSpell(target, SPELL_SINISTER_REFLECTION_SUMMON, true); + //target->CastSpell(target, SPELL_SINISTER_REFLECTION_CLONE, true); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kiljaeden_sinister_reflection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_kiljaeden_sinister_reflection_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kiljaeden_sinister_reflection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_kiljaeden_sinister_reflection_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_kiljaeden_sinister_reflection_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_kiljaeden_sinister_reflection_SpellScript(); + } }; class spell_kiljaeden_sinister_reflection_clone : public SpellScriptLoader { - public: - spell_kiljaeden_sinister_reflection_clone() : SpellScriptLoader("spell_kiljaeden_sinister_reflection_clone") { } + public: + spell_kiljaeden_sinister_reflection_clone() : SpellScriptLoader("spell_kiljaeden_sinister_reflection_clone") { } - class spell_kiljaeden_sinister_reflection_clone_SpellScript : public SpellScript - { - PrepareSpellScript(spell_kiljaeden_sinister_reflection_clone_SpellScript); + class spell_kiljaeden_sinister_reflection_clone_SpellScript : public SpellScript + { + PrepareSpellScript(spell_kiljaeden_sinister_reflection_clone_SpellScript); - void FilterTargets(std::list& targets) - { - targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); - WorldObject* target = targets.front(); - - targets.clear(); - if (target && target->GetTypeId() == TYPEID_UNIT) - { - target->ToCreature()->AI()->SetData(1, GetCaster()->getClass()); - targets.push_back(target); - } - } + void FilterTargets(std::list& targets) + { + targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); + WorldObject* target = targets.front(); + + targets.clear(); + if (target && target->GetTypeId() == TYPEID_UNIT) + { + target->ToCreature()->AI()->SetData(1, GetCaster()->getClass()); + targets.push_back(target); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kiljaeden_sinister_reflection_clone_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kiljaeden_sinister_reflection_clone_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_kiljaeden_sinister_reflection_clone_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_kiljaeden_sinister_reflection_clone_SpellScript(); + } }; class spell_kiljaeden_flame_dart : public SpellScriptLoader { - public: - spell_kiljaeden_flame_dart() : SpellScriptLoader("spell_kiljaeden_flame_dart") { } + public: + spell_kiljaeden_flame_dart() : SpellScriptLoader("spell_kiljaeden_flame_dart") { } - class spell_kiljaeden_flame_dart_SpellScript : public SpellScript - { - PrepareSpellScript(spell_kiljaeden_flame_dart_SpellScript); + class spell_kiljaeden_flame_dart_SpellScript : public SpellScript + { + PrepareSpellScript(spell_kiljaeden_flame_dart_SpellScript); - void HandleSchoolDamage(SpellEffIndex effIndex) - { - if (Unit* target = GetHitUnit()) - target->CastSpell(target, SPELL_FLAME_DART_EXPLOSION, true); - } + void HandleSchoolDamage(SpellEffIndex effIndex) + { + if (Unit* target = GetHitUnit()) + target->CastSpell(target, SPELL_FLAME_DART_EXPLOSION, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_kiljaeden_flame_dart_SpellScript::HandleSchoolDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_kiljaeden_flame_dart_SpellScript::HandleSchoolDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_kiljaeden_flame_dart_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_kiljaeden_flame_dart_SpellScript(); + } }; class spell_kiljaeden_darkness : public SpellScriptLoader @@ -1149,12 +1149,12 @@ class spell_kiljaeden_darkness : public SpellScriptLoader { PrepareAuraScript(spell_kiljaeden_darkness_AuraScript); - void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (GetUnitOwner()->GetTypeId() == TYPEID_UNIT) - GetUnitOwner()->ToCreature()->AI()->DoAction(ACTION_NO_KILL_TALK); + if (GetUnitOwner()->GetTypeId() == TYPEID_UNIT) + GetUnitOwner()->ToCreature()->AI()->DoAction(ACTION_NO_KILL_TALK); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE, true); } void Register() @@ -1171,33 +1171,33 @@ class spell_kiljaeden_darkness : public SpellScriptLoader class spell_kiljaeden_power_of_the_blue_flight : public SpellScriptLoader { - public: - spell_kiljaeden_power_of_the_blue_flight() : SpellScriptLoader("spell_kiljaeden_power_of_the_blue_flight") { } + public: + spell_kiljaeden_power_of_the_blue_flight() : SpellScriptLoader("spell_kiljaeden_power_of_the_blue_flight") { } - class spell_kiljaeden_power_of_the_blue_flight_SpellScript : public SpellScript - { - PrepareSpellScript(spell_kiljaeden_power_of_the_blue_flight_SpellScript); + class spell_kiljaeden_power_of_the_blue_flight_SpellScript : public SpellScript + { + PrepareSpellScript(spell_kiljaeden_power_of_the_blue_flight_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Player* player = GetHitPlayer()) - { - player->CastSpell(player, SPELL_SUMMON_BLUE_DRAKE, true); - player->CastSpell(player, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, true); - } - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Player* player = GetHitPlayer()) + { + player->CastSpell(player, SPELL_SUMMON_BLUE_DRAKE, true); + player->CastSpell(player, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, true); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_kiljaeden_power_of_the_blue_flight_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_kiljaeden_power_of_the_blue_flight_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_kiljaeden_power_of_the_blue_flight_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_kiljaeden_power_of_the_blue_flight_SpellScript(); + } }; class spell_kiljaeden_vengeance_of_the_blue_flight : public SpellScriptLoader @@ -1209,14 +1209,14 @@ class spell_kiljaeden_vengeance_of_the_blue_flight : public SpellScriptLoader { PrepareAuraScript(spell_kiljaeden_vengeance_of_the_blue_flight_AuraScript); - void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_POSSESS_DRAKE_IMMUNITY, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_POSSESS_DRAKE_IMMUNITY, true); } - void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->RemoveAurasDueToSpell(SPELL_POSSESS_DRAKE_IMMUNITY); + GetUnitOwner()->RemoveAurasDueToSpell(SPELL_POSSESS_DRAKE_IMMUNITY); } void Register() @@ -1246,8 +1246,8 @@ class spell_kiljaeden_armageddon_periodic : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) - GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) + GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); } void Register() @@ -1291,43 +1291,43 @@ class spell_kiljaeden_armageddon_missile : public SpellScriptLoader class spell_kiljaeden_dragon_breath : public SpellScriptLoader { - public: - spell_kiljaeden_dragon_breath() : SpellScriptLoader("spell_kiljaeden_dragon_breath") { } + public: + spell_kiljaeden_dragon_breath() : SpellScriptLoader("spell_kiljaeden_dragon_breath") { } - class spell_kiljaeden_dragon_breath_SpellScript : public SpellScript - { - PrepareSpellScript(spell_kiljaeden_dragon_breath_SpellScript); + class spell_kiljaeden_dragon_breath_SpellScript : public SpellScript + { + PrepareSpellScript(spell_kiljaeden_dragon_breath_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT)); - } + void FilterTargets(std::list& targets) + { + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT)); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kiljaeden_dragon_breath_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_CONE_ALLY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kiljaeden_dragon_breath_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_CONE_ALLY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_kiljaeden_dragon_breath_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_kiljaeden_dragon_breath_SpellScript(); + } }; void AddSC_boss_kiljaeden() { - new npc_kiljaeden_controller(); - new boss_kiljaeden(); - new npc_kalecgos_kj(); - new spell_kiljaeden_shadow_spike(); - new spell_kiljaeden_sinister_reflection(); - new spell_kiljaeden_sinister_reflection_clone(); - new spell_kiljaeden_flame_dart(); - new spell_kiljaeden_darkness(); - new spell_kiljaeden_power_of_the_blue_flight(); - new spell_kiljaeden_vengeance_of_the_blue_flight(); - new spell_kiljaeden_armageddon_periodic(); - new spell_kiljaeden_armageddon_missile(); - new spell_kiljaeden_dragon_breath(); + new npc_kiljaeden_controller(); + new boss_kiljaeden(); + new npc_kalecgos_kj(); + new spell_kiljaeden_shadow_spike(); + new spell_kiljaeden_sinister_reflection(); + new spell_kiljaeden_sinister_reflection_clone(); + new spell_kiljaeden_flame_dart(); + new spell_kiljaeden_darkness(); + new spell_kiljaeden_power_of_the_blue_flight(); + new spell_kiljaeden_vengeance_of_the_blue_flight(); + new spell_kiljaeden_armageddon_periodic(); + new spell_kiljaeden_armageddon_missile(); + new spell_kiljaeden_dragon_breath(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 12f212445..b40a54fc6 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -10,50 +10,50 @@ REWRITTEN BY XINEF enum Spells { - SPELL_ENRAGE = 26662, - SPELL_NEGATIVE_ENERGY = 46009, - SPELL_SUMMON_BLOOD_ELVES_PERIODIC = 46041, - SPELL_OPEN_PORTAL_PERIODIC = 45994, - SPELL_DARKNESS_PERIODIC = 45998, - SPELL_SUMMON_BERSERKER1 = 46037, - SPELL_SUMMON_FURY_MAGE1 = 46038, - SPELL_SUMMON_FURY_MAGE2 = 46039, - SPELL_SUMMON_BERSERKER2 = 46040, - SPELL_SUMMON_DARK_FIEND = 46000, // till 46007 - SPELL_OPEN_ALL_PORTALS = 46177, - SPELL_SUMMON_ENTROPIUS = 46217, + SPELL_ENRAGE = 26662, + SPELL_NEGATIVE_ENERGY = 46009, + SPELL_SUMMON_BLOOD_ELVES_PERIODIC = 46041, + SPELL_OPEN_PORTAL_PERIODIC = 45994, + SPELL_DARKNESS_PERIODIC = 45998, + SPELL_SUMMON_BERSERKER1 = 46037, + SPELL_SUMMON_FURY_MAGE1 = 46038, + SPELL_SUMMON_FURY_MAGE2 = 46039, + SPELL_SUMMON_BERSERKER2 = 46040, + SPELL_SUMMON_DARK_FIEND = 46000, // till 46007 + SPELL_OPEN_ALL_PORTALS = 46177, + SPELL_SUMMON_ENTROPIUS = 46217, // Entropius's spells - SPELL_ENTROPIUS_COSMETIC_SPAWN = 46223, - SPELL_NEGATIVE_ENERGY_PERIODIC = 46284, - SPELL_NEGATIVE_ENERGY_CHAIN = 46285, - SPELL_BLACK_HOLE = 46282, - SPELL_DARKNESS = 46268, - SPELL_SUMMON_DARK_FIEND_ENTROPIUS = 46263, + SPELL_ENTROPIUS_COSMETIC_SPAWN = 46223, + SPELL_NEGATIVE_ENERGY_PERIODIC = 46284, + SPELL_NEGATIVE_ENERGY_CHAIN = 46285, + SPELL_BLACK_HOLE = 46282, + SPELL_DARKNESS = 46268, + SPELL_SUMMON_DARK_FIEND_ENTROPIUS = 46263, //Black Hole Spells - SPELL_BLACK_HOLE_SUMMON_VISUAL = 46242, - SPELL_BLACK_HOLE_SUMMON_VISUAL2 = 46248, - SPELL_BLACK_HOLE_VISUAL2 = 46235, - SPELL_BLACK_HOLE_PASSIVE = 46228, - SPELL_BLACK_HOLE_EFFECT = 46230 + SPELL_BLACK_HOLE_SUMMON_VISUAL = 46242, + SPELL_BLACK_HOLE_SUMMON_VISUAL2 = 46248, + SPELL_BLACK_HOLE_VISUAL2 = 46235, + SPELL_BLACK_HOLE_PASSIVE = 46228, + SPELL_BLACK_HOLE_EFFECT = 46230 }; enum Misc { - EVENT_SPELL_ENRAGE = 1, - EVENT_SUMMON_ENTROPIUS = 2, - EVENT_SET_INVISIBLE = 3, - EVENT_SPAWN_BLACK_HOLE = 4, - EVENT_SPAWN_DARKNESS = 5, - EVENT_START_BLACK_HOLE = 6, - EVENT_SWITCH_BLACK_HOLE_TARGET = 7, - EVENT_ENTROPIUS_AURAS = 8, - EVENT_ENTROPIUS_COMBAT = 9, - EVENT_SINGULARITY_DEATH = 10, + EVENT_SPELL_ENRAGE = 1, + EVENT_SUMMON_ENTROPIUS = 2, + EVENT_SET_INVISIBLE = 3, + EVENT_SPAWN_BLACK_HOLE = 4, + EVENT_SPAWN_DARKNESS = 5, + EVENT_START_BLACK_HOLE = 6, + EVENT_SWITCH_BLACK_HOLE_TARGET = 7, + EVENT_ENTROPIUS_AURAS = 8, + EVENT_ENTROPIUS_COMBAT = 9, + EVENT_SINGULARITY_DEATH = 10, - DATA_ENRAGE_TIMER = 1, - DATA_NEGATIVE_ENERGY_TARGETS = 2 + DATA_ENRAGE_TIMER = 1, + DATA_NEGATIVE_ENERGY_TARGETS = 2 }; class boss_muru : public CreatureScript @@ -67,21 +67,21 @@ public: void Reset() { - BossAI::Reset(); - me->SetReactState(REACT_AGGRESSIVE); + BossAI::Reset(); + me->SetReactState(REACT_AGGRESSIVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetVisible(true); } void EnterCombat(Unit* who) { - BossAI::EnterCombat(who); + BossAI::EnterCombat(who); me->CastSpell(me, SPELL_NEGATIVE_ENERGY, true); - me->CastSpell(me, SPELL_SUMMON_BLOOD_ELVES_PERIODIC, true); - me->CastSpell(me, SPELL_OPEN_PORTAL_PERIODIC, true); - me->CastSpell(me, SPELL_DARKNESS_PERIODIC, true); + me->CastSpell(me, SPELL_SUMMON_BLOOD_ELVES_PERIODIC, true); + me->CastSpell(me, SPELL_OPEN_PORTAL_PERIODIC, true); + me->CastSpell(me, SPELL_DARKNESS_PERIODIC, true); - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); } void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) @@ -89,26 +89,26 @@ public: if (damage >= me->GetHealth()) { damage = 0; - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveAllAuras(); - me->CastSpell(me, SPELL_OPEN_ALL_PORTALS, true); - events.ScheduleEvent(EVENT_SUMMON_ENTROPIUS, 7000); - } - } + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveAllAuras(); + me->CastSpell(me, SPELL_OPEN_ALL_PORTALS, true); + events.ScheduleEvent(EVENT_SUMMON_ENTROPIUS, 7000); + } + } } void JustSummoned(Creature* summon) { - if (summon->GetEntry() == NPC_ENTROPIUS) - summon->AI()->SetData(DATA_ENRAGE_TIMER, events.GetNextEventTime(EVENT_SPELL_ENRAGE)); - else - { - if (!summon->IsTrigger()) - summon->SetInCombatWithZone(); - summons.Summon(summon); - } + if (summon->GetEntry() == NPC_ENTROPIUS) + summon->AI()->SetData(DATA_ENRAGE_TIMER, events.GetNextEventTime(EVENT_SPELL_ENRAGE)); + else + { + if (!summon->IsTrigger()) + summon->SetInCombatWithZone(); + summons.Summon(summon); + } } void UpdateAI(uint32 diff) @@ -116,23 +116,23 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_ENRAGE: - me->CastSpell(me, SPELL_ENRAGE, true); - break; - case EVENT_SUMMON_ENTROPIUS: - me->CastSpell(me, SPELL_SUMMON_ENTROPIUS, false); - events.ScheduleEvent(EVENT_SET_INVISIBLE, 1000); - break; - case EVENT_SET_INVISIBLE: - me->SetVisible(false); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_ENRAGE: + me->CastSpell(me, SPELL_ENRAGE, true); + break; + case EVENT_SUMMON_ENTROPIUS: + me->CastSpell(me, SPELL_SUMMON_ENTROPIUS, false); + events.ScheduleEvent(EVENT_SET_INVISIBLE, 1000); + break; + case EVENT_SET_INVISIBLE: + me->SetVisible(false); + break; + } } }; @@ -151,27 +151,27 @@ public: { boss_entropiusAI(Creature* creature) : ScriptedAI(creature) { } - EventMap events; - EventMap events2; + EventMap events; + EventMap events2; void Reset() { - events.Reset(); - events2.Reset(); - events2.ScheduleEvent(EVENT_ENTROPIUS_AURAS, 0); - events2.ScheduleEvent(EVENT_ENTROPIUS_COMBAT, 3000); - me->SetReactState(REACT_PASSIVE); + events.Reset(); + events2.Reset(); + events2.ScheduleEvent(EVENT_ENTROPIUS_AURAS, 0); + events2.ScheduleEvent(EVENT_ENTROPIUS_COMBAT, 3000); + me->SetReactState(REACT_PASSIVE); } - void EnterEvadeMode() - { + void EnterEvadeMode() + { if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* muru = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_MURU))) - if (!muru->IsInEvadeMode()) - muru->AI()->EnterEvadeMode(); + if (Creature* muru = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_MURU))) + if (!muru->IsInEvadeMode()) + muru->AI()->EnterEvadeMode(); - me->DespawnOrUnsummon(); - } + me->DespawnOrUnsummon(); + } void EnterCombat(Unit* /*who*/) { @@ -179,68 +179,68 @@ public: events.ScheduleEvent(EVENT_SPAWN_DARKNESS, 10000); } - void SetData(uint32 type, uint32 data) - { - if (type == DATA_ENRAGE_TIMER) - events.ScheduleEvent(EVENT_SPELL_ENRAGE, data); - } + void SetData(uint32 type, uint32 data) + { + if (type == DATA_ENRAGE_TIMER) + events.ScheduleEvent(EVENT_SPELL_ENRAGE, data); + } - uint32 GetData(uint32 type) const - { - if (type == DATA_NEGATIVE_ENERGY_TARGETS) - return 1 + uint32(events.GetTimer() / 12000); - return 0; - } + uint32 GetData(uint32 type) const + { + if (type == DATA_NEGATIVE_ENERGY_TARGETS) + return 1 + uint32(events.GetTimer() / 12000); + return 0; + } void JustDied(Unit* /*killer*/) { if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* muru = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_MURU))) - Unit::Kill(muru, muru); + if (Creature* muru = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_MURU))) + Unit::Kill(muru, muru); } void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_ENTROPIUS_AURAS: - me->CastSpell(me, SPELL_ENTROPIUS_COSMETIC_SPAWN, false); - me->CastSpell(me, SPELL_NEGATIVE_ENERGY_PERIODIC, true); - break; - case EVENT_ENTROPIUS_COMBAT: - me->SetReactState(REACT_AGGRESSIVE); - me->SetInCombatWithZone(); - AttackStart(SelectTargetFromPlayerList(50.0f)); - break; - } + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_ENTROPIUS_AURAS: + me->CastSpell(me, SPELL_ENTROPIUS_COSMETIC_SPAWN, false); + me->CastSpell(me, SPELL_NEGATIVE_ENERGY_PERIODIC, true); + break; + case EVENT_ENTROPIUS_COMBAT: + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + AttackStart(SelectTargetFromPlayerList(50.0f)); + break; + } - if (!events2.Empty()) - return; + if (!events2.Empty()) + return; if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_ENRAGE: - me->CastSpell(me, SPELL_ENRAGE, true); - break; - case EVENT_SPAWN_DARKNESS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, SPELL_DARKNESS, true); - events.ScheduleEvent(EVENT_SPAWN_DARKNESS, 15000); - break; - case EVENT_SPAWN_BLACK_HOLE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, SPELL_BLACK_HOLE, true); - events.ScheduleEvent(EVENT_SPAWN_BLACK_HOLE, 15000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_ENRAGE: + me->CastSpell(me, SPELL_ENRAGE, true); + break; + case EVENT_SPAWN_DARKNESS: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, SPELL_DARKNESS, true); + events.ScheduleEvent(EVENT_SPAWN_DARKNESS, 15000); + break; + case EVENT_SPAWN_BLACK_HOLE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, SPELL_BLACK_HOLE, true); + events.ScheduleEvent(EVENT_SPAWN_BLACK_HOLE, 15000); + break; + } DoMeleeAttackIfReady(); } @@ -268,46 +268,46 @@ public: { } - EventMap events; + EventMap events; void Reset() { me->DespawnOrUnsummon(18000); - me->CastSpell(me, SPELL_BLACK_HOLE_SUMMON_VISUAL, true); - me->CastSpell(me, SPELL_BLACK_HOLE_SUMMON_VISUAL2, true); - events.ScheduleEvent(EVENT_START_BLACK_HOLE, 3500); - events.ScheduleEvent(EVENT_SWITCH_BLACK_HOLE_TARGET, 5000); - events.ScheduleEvent(EVENT_SINGULARITY_DEATH, 17000); + me->CastSpell(me, SPELL_BLACK_HOLE_SUMMON_VISUAL, true); + me->CastSpell(me, SPELL_BLACK_HOLE_SUMMON_VISUAL2, true); + events.ScheduleEvent(EVENT_START_BLACK_HOLE, 3500); + events.ScheduleEvent(EVENT_SWITCH_BLACK_HOLE_TARGET, 5000); + events.ScheduleEvent(EVENT_SINGULARITY_DEATH, 17000); } void UpdateAI(uint32 diff) { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_SINGULARITY_DEATH: - Unit::Kill(me, me); - break; - case EVENT_START_BLACK_HOLE: - me->RemoveAurasDueToSpell(SPELL_BLACK_HOLE_SUMMON_VISUAL2); - me->CastSpell(me, SPELL_BLACK_HOLE_VISUAL2, true); - me->CastSpell(me, SPELL_BLACK_HOLE_PASSIVE, true); - break; - case EVENT_SWITCH_BLACK_HOLE_TARGET: - { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player* player = itr->GetSource()) - if (me->GetDistance2d(player) < 15.0f && player->GetPositionZ() < 72.0f && player->IsAlive() && !player->HasAura(SPELL_BLACK_HOLE_EFFECT)) - { - me->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), false, true); - events.ScheduleEvent(EVENT_SWITCH_BLACK_HOLE_TARGET, 5000); - return; - } - events.ScheduleEvent(EVENT_SWITCH_BLACK_HOLE_TARGET, 500); - break; - } - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_SINGULARITY_DEATH: + Unit::Kill(me, me); + break; + case EVENT_START_BLACK_HOLE: + me->RemoveAurasDueToSpell(SPELL_BLACK_HOLE_SUMMON_VISUAL2); + me->CastSpell(me, SPELL_BLACK_HOLE_VISUAL2, true); + me->CastSpell(me, SPELL_BLACK_HOLE_PASSIVE, true); + break; + case EVENT_SWITCH_BLACK_HOLE_TARGET: + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->GetSource()) + if (me->GetDistance2d(player) < 15.0f && player->GetPositionZ() < 72.0f && player->IsAlive() && !player->HasAura(SPELL_BLACK_HOLE_EFFECT)) + { + me->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), false, true); + events.ScheduleEvent(EVENT_SWITCH_BLACK_HOLE_TARGET, 5000); + return; + } + events.ScheduleEvent(EVENT_SWITCH_BLACK_HOLE_TARGET, 500); + break; + } + } } }; }; @@ -323,24 +323,24 @@ class spell_muru_summon_blood_elves_periodic : public SpellScriptLoader void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - // first tick after 10 seconds - GetAura()->GetEffect(aurEff->GetEffIndex())->SetPeriodicTimer(10000); + // first tick after 10 seconds + GetAura()->GetEffect(aurEff->GetEffIndex())->SetPeriodicTimer(10000); } void OnPeriodic(AuraEffect const* aurEff) { - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_FURY_MAGE1, true); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_FURY_MAGE2, true); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_BERSERKER1, true); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_BERSERKER2, true); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_BERSERKER1, true); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_BERSERKER2, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_FURY_MAGE1, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_FURY_MAGE2, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_BERSERKER1, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_BERSERKER2, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_BERSERKER1, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_BERSERKER2, true); } void Register() { OnEffectApply += AuraEffectApplyFn(spell_muru_summon_blood_elves_periodic_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_muru_summon_blood_elves_periodic_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_muru_summon_blood_elves_periodic_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -361,14 +361,14 @@ class spell_muru_darkness : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - if (aurEff->GetTickNumber() == 3) - for (uint8 i = 0; i < 8; ++i) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_DARK_FIEND+i, true); + if (aurEff->GetTickNumber() == 3) + for (uint8 i = 0; i < 8; ++i) + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_DARK_FIEND+i, true); } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_muru_darkness_AuraScript::OnPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_muru_darkness_AuraScript::OnPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -380,41 +380,41 @@ class spell_muru_darkness : public SpellScriptLoader class spell_entropius_negative_energy : public SpellScriptLoader { - public: - spell_entropius_negative_energy() : SpellScriptLoader("spell_entropius_negative_energy") { } + public: + spell_entropius_negative_energy() : SpellScriptLoader("spell_entropius_negative_energy") { } - class spell_entropius_negative_energy_SpellScript : public SpellScript - { - PrepareSpellScript(spell_entropius_negative_energy_SpellScript); + class spell_entropius_negative_energy_SpellScript : public SpellScript + { + PrepareSpellScript(spell_entropius_negative_energy_SpellScript); - bool Load() - { - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } - void FilterTargets(std::list& targets) - { - Trinity::Containers::RandomResizeList(targets, GetCaster()->GetAI()->GetData(DATA_NEGATIVE_ENERGY_TARGETS)); - } + void FilterTargets(std::list& targets) + { + Trinity::Containers::RandomResizeList(targets, GetCaster()->GetAI()->GetData(DATA_NEGATIVE_ENERGY_TARGETS)); + } - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, SPELL_NEGATIVE_ENERGY_CHAIN, true); - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_NEGATIVE_ENERGY_CHAIN, true); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_entropius_negative_energy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_entropius_negative_energy_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_entropius_negative_energy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_entropius_negative_energy_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_entropius_negative_energy_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_entropius_negative_energy_SpellScript(); + } }; class spell_entropius_void_zone_visual : public SpellScriptLoader @@ -428,12 +428,12 @@ class spell_entropius_void_zone_visual : public SpellScriptLoader void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - SetDuration(3000); + SetDuration(3000); } - void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_DARK_FIEND_ENTROPIUS, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_DARK_FIEND_ENTROPIUS, true); } void Register() @@ -460,29 +460,29 @@ class spell_entropius_black_hole_effect : public SpellScriptLoader void HandlePull(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - Unit* target = GetHitUnit(); - if (!target) - return; + PreventHitDefaultEffect(effIndex); + Unit* target = GetHitUnit(); + if (!target) + return; - Position pos; - if (target->GetDistance(GetCaster()) < 5.0f) - { - float o = frand(0, 2*M_PI); - pos.Relocate(GetCaster()->GetPositionX() + 4.0f*cos(o), GetCaster()->GetPositionY() + 4.0f*sin(o), GetCaster()->GetPositionZ()+frand(10.0f, 15.0f)); - } - else - pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ()+1.0f); + Position pos; + if (target->GetDistance(GetCaster()) < 5.0f) + { + float o = frand(0, 2*M_PI); + pos.Relocate(GetCaster()->GetPositionX() + 4.0f*cos(o), GetCaster()->GetPositionY() + 4.0f*sin(o), GetCaster()->GetPositionZ()+frand(10.0f, 15.0f)); + } + else + pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ()+1.0f); - float speedXY = float(GetSpellInfo()->Effects[effIndex].MiscValue) * 0.1f; - float speedZ = target->GetDistance(pos) / speedXY * 0.5f * Movement::gravity; + float speedXY = float(GetSpellInfo()->Effects[effIndex].MiscValue) * 0.1f; + float speedZ = target->GetDistance(pos) / speedXY * 0.5f * Movement::gravity; - target->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ); + target->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_entropius_black_hole_effect_SpellScript::HandlePull, EFFECT_0, SPELL_EFFECT_PULL_TOWARDS_DEST); + OnEffectHitTarget += SpellEffectFn(spell_entropius_black_hole_effect_SpellScript::HandlePull, EFFECT_0, SPELL_EFFECT_PULL_TOWARDS_DEST); } }; @@ -498,9 +498,9 @@ void AddSC_boss_muru() new boss_entropius(); new npc_singularity(); - new spell_muru_summon_blood_elves_periodic(); - new spell_muru_darkness(); - new spell_entropius_negative_energy(); - new spell_entropius_void_zone_visual(); - new spell_entropius_black_hole_effect(); + new spell_muru_summon_blood_elves_periodic(); + new spell_muru_darkness(); + new spell_entropius_negative_energy(); + new spell_entropius_void_zone_visual(); + new spell_entropius_black_hole_effect(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 1d55c02e6..7b603381e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -43,17 +43,17 @@ class instance_sunwell_plateau : public InstanceMapScript AnveenaGUID = 0; KalecgosKjGUID = 0; - IceBarrierGUID = 0; - memset(&blueFlightOrbGUID, 0, sizeof(blueFlightOrbGUID)); + IceBarrierGUID = 0; + memset(&blueFlightOrbGUID, 0, sizeof(blueFlightOrbGUID)); } - void OnPlayerEnter(Player* player) - { - instance->LoadGrid(1477.94f, 643.22f); - instance->LoadGrid(1641.45f, 988.08f); - if (GameObject* gobj = instance->GetGameObject(IceBarrierGUID)) - gobj->SendUpdateToPlayer(player); - } + void OnPlayerEnter(Player* player) + { + instance->LoadGrid(1477.94f, 643.22f); + instance->LoadGrid(1641.45f, 988.08f); + if (GameObject* gobj = instance->GetGameObject(IceBarrierGUID)) + gobj->SendUpdateToPlayer(player); + } Player const* GetPlayerInMap() const { @@ -76,8 +76,8 @@ class instance_sunwell_plateau : public InstanceMapScript void OnCreatureCreate(Creature* creature) { - if (creature->GetDBTableGUIDLow() > 0 || !IS_PLAYER_GUID(creature->GetOwnerGUID())) - creature->CastSpell(creature, SPELL_SUNWELL_RADIANCE, true); + if (creature->GetDBTableGUIDLow() > 0 || !IS_PLAYER_GUID(creature->GetOwnerGUID())) + creature->CastSpell(creature, SPELL_SUNWELL_RADIANCE, true); switch (creature->GetEntry()) { @@ -118,29 +118,29 @@ class instance_sunwell_plateau : public InstanceMapScript KalecgosKjGUID = creature->GetGUID(); break; - // Xinef: Felmyst encounter - case NPC_DEMONIC_VAPOR_TRAIL: - case NPC_UNYIELDING_DEAD: - if (Creature* felmyst = instance->GetCreature(FelmystGUID)) - felmyst->AI()->JustSummoned(creature); - break; + // Xinef: Felmyst encounter + case NPC_DEMONIC_VAPOR_TRAIL: + case NPC_UNYIELDING_DEAD: + if (Creature* felmyst = instance->GetCreature(FelmystGUID)) + felmyst->AI()->JustSummoned(creature); + break; - // Xinef: M'uru encounter - case NPC_DARKNESS: - case NPC_VOID_SENTINEL: - case NPC_VOID_SPAWN: - if (Creature* muru = instance->GetCreature(MuruGUID)) - muru->AI()->JustSummoned(creature); - break; + // Xinef: M'uru encounter + case NPC_DARKNESS: + case NPC_VOID_SENTINEL: + case NPC_VOID_SPAWN: + if (Creature* muru = instance->GetCreature(MuruGUID)) + muru->AI()->JustSummoned(creature); + break; - // Xinef: Kil'jaeden encounter - case NPC_FELFIRE_PORTAL: - case NPC_VOLATILE_FELFIRE_FIEND: - case NPC_SHIELD_ORB: - case NPC_SINISTER_REFLECTION: - if (Creature* kiljaedenC = instance->GetCreature(KilJaedenControllerGUID)) - kiljaedenC->AI()->JustSummoned(creature); - break; + // Xinef: Kil'jaeden encounter + case NPC_FELFIRE_PORTAL: + case NPC_VOLATILE_FELFIRE_FIEND: + case NPC_SHIELD_ORB: + case NPC_SINISTER_REFLECTION: + if (Creature* kiljaedenC = instance->GetCreature(KilJaedenControllerGUID)) + kiljaedenC->AI()->JustSummoned(creature); + break; default: break; } @@ -158,22 +158,22 @@ class instance_sunwell_plateau : public InstanceMapScript case GO_MURUS_GATE_2: AddDoor(go, true); break; - case GO_ICE_BARRIER: - IceBarrierGUID = go->GetGUID(); - go->setActive(true); - break; - case GO_ORB_OF_THE_BLUE_DRAGONFLIGHT1: - blueFlightOrbGUID[0] = go->GetGUID(); - break; - case GO_ORB_OF_THE_BLUE_DRAGONFLIGHT2: - blueFlightOrbGUID[1] = go->GetGUID(); - break; - case GO_ORB_OF_THE_BLUE_DRAGONFLIGHT3: - blueFlightOrbGUID[2] = go->GetGUID(); - break; - case GO_ORB_OF_THE_BLUE_DRAGONFLIGHT4: - blueFlightOrbGUID[3] = go->GetGUID(); - break; + case GO_ICE_BARRIER: + IceBarrierGUID = go->GetGUID(); + go->setActive(true); + break; + case GO_ORB_OF_THE_BLUE_DRAGONFLIGHT1: + blueFlightOrbGUID[0] = go->GetGUID(); + break; + case GO_ORB_OF_THE_BLUE_DRAGONFLIGHT2: + blueFlightOrbGUID[1] = go->GetGUID(); + break; + case GO_ORB_OF_THE_BLUE_DRAGONFLIGHT3: + blueFlightOrbGUID[2] = go->GetGUID(); + break; + case GO_ORB_OF_THE_BLUE_DRAGONFLIGHT4: + blueFlightOrbGUID[3] = go->GetGUID(); + break; default: break; } @@ -225,12 +225,12 @@ class instance_sunwell_plateau : public InstanceMapScript case NPC_KILJAEDEN: return KilJaedenGUID; - // Orbs - case DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1: - case DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2: - case DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3: - case DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4: - return blueFlightOrbGUID[id-DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1]; + // Orbs + case DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1: + case DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2: + case DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3: + case DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4: + return blueFlightOrbGUID[id-DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1]; } return 0; } @@ -292,8 +292,8 @@ class instance_sunwell_plateau : public InstanceMapScript uint64 AnveenaGUID; uint64 KalecgosKjGUID; - uint64 IceBarrierGUID; - uint64 blueFlightOrbGUID[4]; + uint64 IceBarrierGUID; + uint64 blueFlightOrbGUID[4]; }; InstanceScript* GetInstanceScript(InstanceMap* map) const @@ -304,14 +304,14 @@ class instance_sunwell_plateau : public InstanceMapScript enum cataclysmBreath { - SPELL_CORROSIVE_POISON = 46293, - SPELL_FEVERED_FATIGUE = 46294, - SPELL_HEX = 46295, - SPELL_NECROTIC_POISON = 46296, - SPELL_PIERCING_SHADOW = 46297, - SPELL_SHRINK = 46298, - SPELL_WAVERING_WILL = 46299, - SPELL_WITHERED_TOUCH = 46300 + SPELL_CORROSIVE_POISON = 46293, + SPELL_FEVERED_FATIGUE = 46294, + SPELL_HEX = 46295, + SPELL_NECROTIC_POISON = 46296, + SPELL_PIERCING_SHADOW = 46297, + SPELL_SHRINK = 46298, + SPELL_WAVERING_WILL = 46299, + SPELL_WITHERED_TOUCH = 46300 }; class spell_cataclysm_breath : public SpellScriptLoader @@ -325,9 +325,9 @@ class spell_cataclysm_breath : public SpellScriptLoader void HandleAfterCast() { - if (Unit* target = GetExplTargetUnit()) - for (uint8 i = 0; i < 4; ++i) - GetCaster()->CastSpell(target, RAND(SPELL_CORROSIVE_POISON, SPELL_FEVERED_FATIGUE, SPELL_HEX, SPELL_NECROTIC_POISON, SPELL_PIERCING_SHADOW, SPELL_SHRINK, SPELL_WAVERING_WILL, SPELL_WITHERED_TOUCH), true); + if (Unit* target = GetExplTargetUnit()) + for (uint8 i = 0; i < 4; ++i) + GetCaster()->CastSpell(target, RAND(SPELL_CORROSIVE_POISON, SPELL_FEVERED_FATIGUE, SPELL_HEX, SPELL_NECROTIC_POISON, SPELL_PIERCING_SHADOW, SPELL_SHRINK, SPELL_WAVERING_WILL, SPELL_WITHERED_TOUCH), true); } void Register() @@ -345,5 +345,5 @@ class spell_cataclysm_breath : public SpellScriptLoader void AddSC_instance_sunwell_plateau() { new instance_sunwell_plateau(); - new spell_cataclysm_breath(); + new spell_cataclysm_breath(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h index 43a94af90..01875f268 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h @@ -7,78 +7,78 @@ REWRITTEN BY XINEF enum DataTypes { - DATA_KALECGOS = 0, - DATA_MADRIGOSA = 1, - DATA_BRUTALLUS = 2, - DATA_FELMYST = 3, - DATA_FELMYST_DOORS = 4, - DATA_EREDAR_TWINS_INTRO = 5, - DATA_EREDAR_TWINS = 6, - DATA_MURU = 7, - DATA_KILJAEDEN = 8, - MAX_ENCOUNTERS = 9, + DATA_KALECGOS = 0, + DATA_MADRIGOSA = 1, + DATA_BRUTALLUS = 2, + DATA_FELMYST = 3, + DATA_FELMYST_DOORS = 4, + DATA_EREDAR_TWINS_INTRO = 5, + DATA_EREDAR_TWINS = 6, + DATA_MURU = 7, + DATA_KILJAEDEN = 8, + MAX_ENCOUNTERS = 9, - // GameObject GUIDs - DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1 = 10, - DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2 = 11, - DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3 = 12, - DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4 = 13 + // GameObject GUIDs + DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1 = 10, + DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2 = 11, + DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3 = 12, + DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4 = 13 }; enum CreatureIds { - NPC_KALECGOS = 24850, - NPC_KALEC = 24891, - NPC_SATHROVARR = 24892, + NPC_KALECGOS = 24850, + NPC_KALEC = 24891, + NPC_SATHROVARR = 24892, - NPC_BRUTALLUS = 24882, - NPC_MADRIGOSA = 24895, - NPC_FELMYST = 25038, - NPC_DEMONIC_VAPOR_TRAIL = 25267, - NPC_UNYIELDING_DEAD = 25268, + NPC_BRUTALLUS = 24882, + NPC_MADRIGOSA = 24895, + NPC_FELMYST = 25038, + NPC_DEMONIC_VAPOR_TRAIL = 25267, + NPC_UNYIELDING_DEAD = 25268, - NPC_GRAND_WARLOCK_ALYTHESS = 25166, - NPC_LADY_SACROLASH = 25165, - NPC_SHADOW_IMAGE = 25214, + NPC_GRAND_WARLOCK_ALYTHESS = 25166, + NPC_LADY_SACROLASH = 25165, + NPC_SHADOW_IMAGE = 25214, - NPC_MURU = 25741, - NPC_ENTROPIUS = 25840, - NPC_DARKNESS = 25879, - NPC_VOID_SENTINEL = 25772, - NPC_VOID_SPAWN = 25824, + NPC_MURU = 25741, + NPC_ENTROPIUS = 25840, + NPC_DARKNESS = 25879, + NPC_VOID_SENTINEL = 25772, + NPC_VOID_SPAWN = 25824, - - NPC_KILJAEDEN_CONTROLLER = 25608, - NPC_KILJAEDEN = 25315, - NPC_ANVEENA = 26046, - NPC_KALECGOS_KJ = 25319, - NPC_HAND_OF_THE_DECEIVER = 25588, - NPC_FELFIRE_PORTAL = 25603, - NPC_VOLATILE_FELFIRE_FIEND = 25598, - NPC_SHIELD_ORB = 25502, - NPC_SINISTER_REFLECTION = 25708, - NPC_ARMAGEDDON_TARGET = 25735, + + NPC_KILJAEDEN_CONTROLLER = 25608, + NPC_KILJAEDEN = 25315, + NPC_ANVEENA = 26046, + NPC_KALECGOS_KJ = 25319, + NPC_HAND_OF_THE_DECEIVER = 25588, + NPC_FELFIRE_PORTAL = 25603, + NPC_VOLATILE_FELFIRE_FIEND = 25598, + NPC_SHIELD_ORB = 25502, + NPC_SINISTER_REFLECTION = 25708, + NPC_ARMAGEDDON_TARGET = 25735, }; enum GameObjectIds { - GO_FORCE_FIELD = 188421, - GO_BOSS_COLLISION_1 = 188523, - GO_BOSS_COLLISION_2 = 188524, - GO_FIRE_BARRIER = 188075, - GO_MURUS_GATE_1 = 187990, - GO_MURUS_GATE_2 = 188118, - GO_ICE_BARRIER = 188119, + GO_FORCE_FIELD = 188421, + GO_BOSS_COLLISION_1 = 188523, + GO_BOSS_COLLISION_2 = 188524, + GO_FIRE_BARRIER = 188075, + GO_MURUS_GATE_1 = 187990, + GO_MURUS_GATE_2 = 188118, + GO_ICE_BARRIER = 188119, - GO_ORB_OF_THE_BLUE_DRAGONFLIGHT1 = 187869, - GO_ORB_OF_THE_BLUE_DRAGONFLIGHT2 = 188114, - GO_ORB_OF_THE_BLUE_DRAGONFLIGHT3 = 188115, - GO_ORB_OF_THE_BLUE_DRAGONFLIGHT4 = 188116 + GO_ORB_OF_THE_BLUE_DRAGONFLIGHT1 = 187869, + GO_ORB_OF_THE_BLUE_DRAGONFLIGHT2 = 188114, + GO_ORB_OF_THE_BLUE_DRAGONFLIGHT3 = 188115, + GO_ORB_OF_THE_BLUE_DRAGONFLIGHT4 = 188116 }; enum SpellIds { - SPELL_SUNWELL_RADIANCE = 45769, + SPELL_SUNWELL_RADIANCE = 45769, }; #endif // SUNWELL_PLATEAU_H diff --git a/src/server/scripts/EasternKingdoms/TheStockade/instance_the_stockade.cpp b/src/server/scripts/EasternKingdoms/TheStockade/instance_the_stockade.cpp index 2b670f44e..49283d325 100644 --- a/src/server/scripts/EasternKingdoms/TheStockade/instance_the_stockade.cpp +++ b/src/server/scripts/EasternKingdoms/TheStockade/instance_the_stockade.cpp @@ -7,18 +7,18 @@ REWRITTEN BY XINEF class instance_the_stockade : public InstanceMapScript { - public: - instance_the_stockade() : InstanceMapScript("instance_the_stockade", 34) { } + public: + instance_the_stockade() : InstanceMapScript("instance_the_stockade", 34) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_the_stockade_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_the_stockade_InstanceMapScript(map); + } - struct instance_the_stockade_InstanceMapScript : public InstanceScript - { - instance_the_stockade_InstanceMapScript(Map* map) : InstanceScript(map) { } - }; + struct instance_the_stockade_InstanceMapScript : public InstanceScript + { + instance_the_stockade_InstanceMapScript(Map* map) : InstanceScript(map) { } + }; }; void AddSC_instance_the_stockade() diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index 3c3bab9f2..659e050ee 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -50,13 +50,13 @@ class instance_uldaman : public InstanceMapScript HandleGameObject(0, true, gameobject); break; case GO_ANCIENT_VAULT_DOOR: - ancientVaultDoorGUID = gameobject->GetGUID(); + ancientVaultDoorGUID = gameobject->GetGUID(); if (_encounters[DATA_ARCHAEDAS] == DONE) HandleGameObject(0, true, gameobject); break; - case GO_ARCHAEDAS_TEMPLE_DOOR: - archaedasTempleDoorGUID = gameobject->GetGUID(); - break; + case GO_ARCHAEDAS_TEMPLE_DOOR: + archaedasTempleDoorGUID = gameobject->GetGUID(); + break; } } @@ -64,15 +64,15 @@ class instance_uldaman : public InstanceMapScript { switch (type) { - case DATA_IRONAYA_DOORS: + case DATA_IRONAYA_DOORS: case DATA_STONE_KEEPERS: - _encounters[type] = data; - break; - case DATA_ARCHAEDAS: - _encounters[type] = data; - HandleGameObject(ancientVaultDoorGUID, data == DONE, NULL); - HandleGameObject(archaedasTempleDoorGUID, data != IN_PROGRESS, NULL); - break; + _encounters[type] = data; + break; + case DATA_ARCHAEDAS: + _encounters[type] = data; + HandleGameObject(ancientVaultDoorGUID, data == DONE, NULL); + HandleGameObject(archaedasTempleDoorGUID, data != IN_PROGRESS, NULL); + break; } if (data == DONE) @@ -83,7 +83,7 @@ class instance_uldaman : public InstanceMapScript { std::ostringstream saveStream; saveStream << "U D " << _encounters[DATA_IRONAYA_DOORS] << ' ' << _encounters[DATA_STONE_KEEPERS] << ' ' << _encounters[DATA_ARCHAEDAS]; - return saveStream.str(); + return saveStream.str(); } void Load(const char* in) @@ -91,19 +91,19 @@ class instance_uldaman : public InstanceMapScript if (!in) return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'U' && dataHead2 == 'D') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - loadStream >> _encounters[i]; - if (_encounters[i] == IN_PROGRESS) - _encounters[i] = NOT_STARTED; - } - } + if (dataHead1 == 'U' && dataHead2 == 'D') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + loadStream >> _encounters[i]; + if (_encounters[i] == IN_PROGRESS) + _encounters[i] = NOT_STARTED; + } + } } void OnCreatureCreate(Creature* creature) @@ -111,13 +111,13 @@ class instance_uldaman : public InstanceMapScript switch (creature->GetEntry()) { case NPC_STONE_KEEPER: - if (_encounters[DATA_STONE_KEEPERS] != DONE && !creature->IsAlive()) - creature->Respawn(); + if (_encounters[DATA_STONE_KEEPERS] != DONE && !creature->IsAlive()) + creature->Respawn(); break; - } + } } - private: + private: uint32 _encounters[MAX_ENCOUNTERS]; uint64 archaedasTempleDoorGUID; uint64 ancientVaultDoorGUID; @@ -131,29 +131,29 @@ class instance_uldaman : public InstanceMapScript class spell_uldaman_sub_boss_agro_keepers : public SpellScriptLoader { - public: - spell_uldaman_sub_boss_agro_keepers() : SpellScriptLoader("spell_uldaman_sub_boss_agro_keepers") { } + public: + spell_uldaman_sub_boss_agro_keepers() : SpellScriptLoader("spell_uldaman_sub_boss_agro_keepers") { } - class spell_uldaman_sub_boss_agro_keepers_SpellScript : public SpellScript - { - PrepareSpellScript(spell_uldaman_sub_boss_agro_keepers_SpellScript); + class spell_uldaman_sub_boss_agro_keepers_SpellScript : public SpellScript + { + PrepareSpellScript(spell_uldaman_sub_boss_agro_keepers_SpellScript); - void HandleSendEvent(SpellEffIndex effIndex) - { - if (Creature* keeper = GetCaster()->FindNearestCreature(NPC_STONE_KEEPER, 100.0f, true)) - keeper->AI()->SetData(1, 1); - } + void HandleSendEvent(SpellEffIndex effIndex) + { + if (Creature* keeper = GetCaster()->FindNearestCreature(NPC_STONE_KEEPER, 100.0f, true)) + keeper->AI()->SetData(1, 1); + } - void Register() - { - OnEffectLaunch += SpellEffectFn(spell_uldaman_sub_boss_agro_keepers_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); - } - }; + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_uldaman_sub_boss_agro_keepers_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_uldaman_sub_boss_agro_keepers_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_uldaman_sub_boss_agro_keepers_SpellScript(); + } }; class spell_uldaman_stoned : public SpellScriptLoader @@ -165,23 +165,23 @@ class spell_uldaman_stoned : public SpellScriptLoader { PrepareAuraScript(spell_uldaman_stoned_AuraScript); - bool Load() - { - return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; + } void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Creature* target = GetUnitOwner()->ToCreature(); - target->SetReactState(REACT_PASSIVE); - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + target->SetReactState(REACT_PASSIVE); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Creature* target = GetUnitOwner()->ToCreature(); - target->SetReactState(REACT_AGGRESSIVE); - target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + target->SetReactState(REACT_AGGRESSIVE); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); } void Register() @@ -199,40 +199,40 @@ class spell_uldaman_stoned : public SpellScriptLoader class spell_uldaman_boss_agro_archaedas : public SpellScriptLoader { - public: - spell_uldaman_boss_agro_archaedas() : SpellScriptLoader("spell_uldaman_boss_agro_archaedas") { } + public: + spell_uldaman_boss_agro_archaedas() : SpellScriptLoader("spell_uldaman_boss_agro_archaedas") { } - class spell_uldaman_boss_agro_archaedas_SpellScript : public SpellScript - { - PrepareSpellScript(spell_uldaman_boss_agro_archaedas_SpellScript); + class spell_uldaman_boss_agro_archaedas_SpellScript : public SpellScript + { + PrepareSpellScript(spell_uldaman_boss_agro_archaedas_SpellScript); - void HandleSendEvent(SpellEffIndex effIndex) - { - InstanceScript* instance = GetCaster()->GetInstanceScript(); - if (!instance || instance->GetData(DATA_ARCHAEDAS) == IN_PROGRESS) - return; + void HandleSendEvent(SpellEffIndex effIndex) + { + InstanceScript* instance = GetCaster()->GetInstanceScript(); + if (!instance || instance->GetData(DATA_ARCHAEDAS) == IN_PROGRESS) + return; - instance->SetData(DATA_ARCHAEDAS, IN_PROGRESS); - if (Creature* archaedas = GetCaster()->FindNearestCreature(NPC_ARCHAEDAS, 100.0f, true)) - archaedas->AI()->SetData(1, 1); - } + instance->SetData(DATA_ARCHAEDAS, IN_PROGRESS); + if (Creature* archaedas = GetCaster()->FindNearestCreature(NPC_ARCHAEDAS, 100.0f, true)) + archaedas->AI()->SetData(1, 1); + } - void Register() - { - OnEffectLaunch += SpellEffectFn(spell_uldaman_boss_agro_archaedas_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); - } - }; + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_uldaman_boss_agro_archaedas_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_uldaman_boss_agro_archaedas_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_uldaman_boss_agro_archaedas_SpellScript(); + } }; void AddSC_instance_uldaman() { new instance_uldaman(); - new spell_uldaman_sub_boss_agro_keepers(); - new spell_uldaman_stoned(); - new spell_uldaman_boss_agro_archaedas(); + new spell_uldaman_sub_boss_agro_keepers(); + new spell_uldaman_stoned(); + new spell_uldaman_boss_agro_archaedas(); } diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h index 9ebbbf8f4..8685c7ea9 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h +++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h @@ -7,16 +7,16 @@ REWRITTEN BY XINEF enum DataTypes { - DATA_IRONAYA_DOORS = 0, - DATA_STONE_KEEPERS = 1, - DATA_ARCHAEDAS = 2, - MAX_ENCOUNTERS = 3 + DATA_IRONAYA_DOORS = 0, + DATA_STONE_KEEPERS = 1, + DATA_ARCHAEDAS = 2, + MAX_ENCOUNTERS = 3 }; enum GameObjectIds { GO_ARCHAEDAS_TEMPLE_DOOR = 141869, - GO_TEMPLE_DOOR = 124367, + GO_TEMPLE_DOOR = 124367, GO_ANCIENT_VAULT_DOOR = 124369, GO_IRONAYA_SEAL_DOOR = 124372, GO_KEYSTONE = 124371, @@ -24,8 +24,8 @@ enum GameObjectIds enum NpcIds { - NPC_STONE_KEEPER = 4857, - NPC_ARCHAEDAS = 2748 + NPC_STONE_KEEPER = 4857, + NPC_ARCHAEDAS = 2748 }; #endif diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 35504c2fd..ae233783e 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -340,7 +340,7 @@ class boss_hexlord_malacrass : public CreatureScript { Unit* Temp = ObjectAccessor::GetUnit(*me, AddGUID[i]); if (Temp && Temp->IsAlive()) - Unit::DealDamage(Temp, Temp, Temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + Unit::DealDamage(Temp, Temp, Temp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index acea42180..78b669586 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -435,11 +435,11 @@ class boss_janalai : public CreatureScript FireBreathTimer = 8000; } else FireBreathTimer -= diff; } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetPositionZ() <= 12.0f; - } + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetPositionZ() <= 12.0f; + } }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index 4995f449b..3b782fcb4 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -87,18 +87,18 @@ class npc_forest_frog : public CreatureScript } if (!instance->GetData(TYPE_RAND_VENDOR_1) && roll_chance_i(10)) - { + { cEntry = 24408; //Gunter - instance->SetData(TYPE_RAND_VENDOR_1, DONE); - } + instance->SetData(TYPE_RAND_VENDOR_1, DONE); + } else if (!instance->GetData(TYPE_RAND_VENDOR_2) && roll_chance_i(10)) - { + { cEntry = 24409; //Kyren - instance->SetData(TYPE_RAND_VENDOR_2, DONE); - } + instance->SetData(TYPE_RAND_VENDOR_2, DONE); + } me->UpdateEntry(cEntry); - me->DespawnOrUnsummon(2*MINUTE*IN_MILLISECONDS); + me->DespawnOrUnsummon(2*MINUTE*IN_MILLISECONDS); } void SpellHit(Unit* caster, const SpellInfo* spell) @@ -106,9 +106,9 @@ class npc_forest_frog : public CreatureScript if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == NPC_FOREST_FROG) { if (roll_chance_i(2)) - DoCast(caster, SPELL_PUSH_MOJO, true); + DoCast(caster, SPELL_PUSH_MOJO, true); else - DoSpawnRandom(); + DoSpawnRandom(); } } }; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index 318b4d013..45d153e37 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -130,7 +130,7 @@ class boss_hakkar : public CreatureScript // events.ScheduleEvent(EVENT_CAUSE_INSANITY, urand(35000, 45000)); break; case EVENT_WILL_OF_HAKKAR: - // Xinef: Skip Tank + // Xinef: Skip Tank DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true), SPELL_WILL_OF_HAKKAR); events.ScheduleEvent(EVENT_WILL_OF_HAKKAR, urand(25000, 35000)); break; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index 88ad3fd01..445b42fd3 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -152,11 +152,11 @@ class boss_jeklik : public CreatureScript case EVENT_SONIC_BURST: DoCastVictim(SPELL_SONICBURST); events.ScheduleEvent(EVENT_SONIC_BURST, urand(8000, 13000), 0, PHASE_ONE); - break; + break; case EVENT_SCREECH: DoCastVictim(SPELL_SCREECH); events.ScheduleEvent(EVENT_SCREECH, urand(18000, 26000), 0, PHASE_ONE); - break; + break; case EVENT_SPAWN_BATS: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) for (uint8 i = 0; i < 6; ++i) diff --git a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp index c1d233ac0..4d8b7b176 100644 --- a/src/server/scripts/EasternKingdoms/zone_duskwood.cpp +++ b/src/server/scripts/EasternKingdoms/zone_duskwood.cpp @@ -61,38 +61,38 @@ public: KillCount = 0; } - void InitializeAI() - { - // Xinef: check if copy is summoned - std::list cList; - me->GetCreatureListWithEntryInGrid(cList, me->GetEntry(), 50.0f); - if (!cList.empty()) - for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr) - if ((*itr)->IsAlive() && me->GetGUID() != (*itr)->GetGUID()) - { - me->DespawnOrUnsummon(1); - break; - } + void InitializeAI() + { + // Xinef: check if copy is summoned + std::list cList; + me->GetCreatureListWithEntryInGrid(cList, me->GetEntry(), 50.0f); + if (!cList.empty()) + for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr) + if ((*itr)->IsAlive() && me->GetGUID() != (*itr)->GetGUID()) + { + me->DespawnOrUnsummon(1); + break; + } - _introSpoken = false; - ScriptedAI::InitializeAI(); - } + _introSpoken = false; + ScriptedAI::InitializeAI(); + } - void MoveInLineOfSight(Unit* who) - { - if (!_introSpoken && who->GetTypeId() == TYPEID_PLAYER) - { - _introSpoken = true; - Talk(YELL_TWILIGHTCORRUPTOR_RESPAWN, who); - me->setFaction(FACTION_HOSTILE); - } - ScriptedAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit* who) + { + if (!_introSpoken && who->GetTypeId() == TYPEID_PLAYER) + { + _introSpoken = true; + Talk(YELL_TWILIGHTCORRUPTOR_RESPAWN, who); + me->setFaction(FACTION_HOSTILE); + } + ScriptedAI::MoveInLineOfSight(who); + } void EnterCombat(Unit* /*who*/) { Talk(YELL_TWILIGHTCORRUPTOR_AGGRO); - _events.Reset(); + _events.Reset(); _events.ScheduleEvent(EVENT_SOUL_CORRUPTION, 15000); _events.ScheduleEvent(EVENT_CREATURE_OF_NIGHTMARE, 30000); } @@ -128,8 +128,8 @@ public: _events.ScheduleEvent(EVENT_SOUL_CORRUPTION, rand()%4000+15000); break; case EVENT_CREATURE_OF_NIGHTMARE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) - DoCast(target, SPELL_CREATURE_OF_NIGHTMARE); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) + DoCast(target, SPELL_CREATURE_OF_NIGHTMARE); _events.ScheduleEvent(EVENT_CREATURE_OF_NIGHTMARE, 45000); break; default: @@ -142,7 +142,7 @@ public: private: EventMap _events; uint8 KillCount; - bool _introSpoken; + bool _introSpoken; }; CreatureAI* GetAI(Creature* creature) const @@ -162,7 +162,7 @@ public: bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) { - if (player->HasQuestForItem(ITEM_FRAGMENT) && !player->HasItemCount(ITEM_FRAGMENT)) + if (player->HasQuestForItem(ITEM_FRAGMENT) && !player->HasItemCount(ITEM_FRAGMENT)) player->SummonCreature(NPC_TWILIGHT_CORRUPTER, -10328.16f, -489.57f, 49.95f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 240000); return false; diff --git a/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp index ae723b48f..bab3c99cc 100644 --- a/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp @@ -40,21 +40,21 @@ EndContentData */ enum eEris { - QUEST_BALANCE_OF_LIGHT_AND_SHADOW = 7622, - ITEM_EYE_OF_DIVINITY = 18646, + QUEST_BALANCE_OF_LIGHT_AND_SHADOW = 7622, + ITEM_EYE_OF_DIVINITY = 18646, - NPC_INJURED_PEASANT = 14484, - NPC_PLAGUED_PEASANT = 14485, - NPC_SCOURGE_ARCHER = 14489, + NPC_INJURED_PEASANT = 14484, + NPC_PLAGUED_PEASANT = 14485, + NPC_SCOURGE_ARCHER = 14489, - EVENT_SUMMON_PEASANTS = 1, - EVENT_CHECK_PLAYER = 2, - EVENT_SUMMON_ARCHERS = 3, + EVENT_SUMMON_PEASANTS = 1, + EVENT_CHECK_PLAYER = 2, + EVENT_SUMMON_ARCHERS = 3, - SPELL_SHOOT = 23073, - SPELL_DEATHS_DOOR = 23127, - SPELL_SEETHING_PLAGUE = 23072, - SPELL_ERIS_BLESSING = 23108, + SPELL_SHOOT = 23073, + SPELL_DEATHS_DOOR = 23127, + SPELL_SEETHING_PLAGUE = 23072, + SPELL_ERIS_BLESSING = 23108, }; class npc_eris_hevenfire : public CreatureScript @@ -64,16 +64,16 @@ public: CreatureAI* GetAI(Creature* creature) const { - return new npc_eris_hevenfireAI(creature); + return new npc_eris_hevenfireAI(creature); } bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == QUEST_BALANCE_OF_LIGHT_AND_SHADOW) - { - creature->AI()->SetData(player->getFaction(), 0); + { + creature->AI()->SetData(player->getFaction(), 0); creature->AI()->SetGUID(player->GetGUID()); - } + } return true; } @@ -82,163 +82,163 @@ public: { npc_eris_hevenfireAI(Creature* c) : ScriptedAI(c), summons(me) {} - SummonList summons; - EventMap events; - uint64 _playerGUID; - uint8 _counter; - uint8 _savedCount; - uint8 _deathCount; - bool _spoken; - uint32 _faction; + SummonList summons; + EventMap events; + uint64 _playerGUID; + uint8 _counter; + uint8 _savedCount; + uint8 _deathCount; + bool _spoken; + uint32 _faction; - void Reset() - { - _faction = 0; - _spoken = false; - _savedCount = 0; - _deathCount = 0; - _counter = 0; - _playerGUID = 0; - events.Reset(); - summons.DespawnAll(); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); - } + void Reset() + { + _faction = 0; + _spoken = false; + _savedCount = 0; + _deathCount = 0; + _counter = 0; + _playerGUID = 0; + events.Reset(); + summons.DespawnAll(); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); + } - void SetData(uint32 faction, uint32) - { - _faction = faction; - } + void SetData(uint32 faction, uint32) + { + _faction = faction; + } - void SetGUID(uint64 guid, int32) - { - _playerGUID = guid; - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - events.Reset(); - summons.DespawnAll(); + void SetGUID(uint64 guid, int32) + { + _playerGUID = guid; + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + events.Reset(); + summons.DespawnAll(); - events.ScheduleEvent(EVENT_CHECK_PLAYER, 1000); - events.ScheduleEvent(EVENT_SUMMON_ARCHERS, 4000); - events.ScheduleEvent(EVENT_SUMMON_PEASANTS, 8000); - } + events.ScheduleEvent(EVENT_CHECK_PLAYER, 1000); + events.ScheduleEvent(EVENT_SUMMON_ARCHERS, 4000); + events.ScheduleEvent(EVENT_SUMMON_PEASANTS, 8000); + } - bool CanBeSeen(Player const* player) - { - // requires this trinket to be seen - return player->HasItemOrGemWithIdEquipped(ITEM_EYE_OF_DIVINITY, 1); - } + bool CanBeSeen(Player const* player) + { + // requires this trinket to be seen + return player->HasItemOrGemWithIdEquipped(ITEM_EYE_OF_DIVINITY, 1); + } - void SummonArchers() - { - me->SummonCreature(NPC_SCOURGE_ARCHER, 3330.18f, -3078.97f, 171.814f, 0.799463f); - me->SummonCreature(NPC_SCOURGE_ARCHER, 3328.34f, -3017.88f, 171.544f, 6.26976f); - me->SummonCreature(NPC_SCOURGE_ARCHER, 3333.71f, -3052.4f, 174.171f, 0.391055f); - me->SummonCreature(NPC_SCOURGE_ARCHER, 3316.22f, -3035.49f, 166.428f, 0.163288f); - me->SummonCreature(NPC_SCOURGE_ARCHER, 3371.54f, -3067.75f, 174.942f, 1.96578f); - me->SummonCreature(NPC_SCOURGE_ARCHER, 3379.39f, -3060.11f, 181.617f, 2.82186f); - me->SummonCreature(NPC_SCOURGE_ARCHER, 3352.44f, -3079.01f, 179.07f, 1.32175f); - me->SummonCreature(NPC_SCOURGE_ARCHER, 3363.07f, -3077.43f, 183.0f, 1.78121f); - me->SummonCreature(NPC_SCOURGE_ARCHER, 3348.11f, -2991.02f, 172.304f, 4.07064f); - me->SummonCreature(NPC_SCOURGE_ARCHER, 3377.42f, -3039.77f, 172.594f, 3.20671f); - me->SummonCreature(NPC_SCOURGE_ARCHER, 3363.87f, -3010.4f, 185.387f, 3.81932f); - } + void SummonArchers() + { + me->SummonCreature(NPC_SCOURGE_ARCHER, 3330.18f, -3078.97f, 171.814f, 0.799463f); + me->SummonCreature(NPC_SCOURGE_ARCHER, 3328.34f, -3017.88f, 171.544f, 6.26976f); + me->SummonCreature(NPC_SCOURGE_ARCHER, 3333.71f, -3052.4f, 174.171f, 0.391055f); + me->SummonCreature(NPC_SCOURGE_ARCHER, 3316.22f, -3035.49f, 166.428f, 0.163288f); + me->SummonCreature(NPC_SCOURGE_ARCHER, 3371.54f, -3067.75f, 174.942f, 1.96578f); + me->SummonCreature(NPC_SCOURGE_ARCHER, 3379.39f, -3060.11f, 181.617f, 2.82186f); + me->SummonCreature(NPC_SCOURGE_ARCHER, 3352.44f, -3079.01f, 179.07f, 1.32175f); + me->SummonCreature(NPC_SCOURGE_ARCHER, 3363.07f, -3077.43f, 183.0f, 1.78121f); + me->SummonCreature(NPC_SCOURGE_ARCHER, 3348.11f, -2991.02f, 172.304f, 4.07064f); + me->SummonCreature(NPC_SCOURGE_ARCHER, 3377.42f, -3039.77f, 172.594f, 3.20671f); + me->SummonCreature(NPC_SCOURGE_ARCHER, 3363.87f, -3010.4f, 185.387f, 3.81932f); + } - void SummonPeasants() - { - for (uint8 i = 0; i < 12; ++i) - { - float x = 3358 + frand(-6.0f, 6.0f); - float y = -3049 + frand(-6.0f, 6.0f); - float z = 165.25; - float o = 2.0; - me->SummonCreature(roll_chance_i(5) ? NPC_PLAGUED_PEASANT : NPC_INJURED_PEASANT, x, y, z, o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 2*MINUTE*IN_MILLISECONDS); - } - } + void SummonPeasants() + { + for (uint8 i = 0; i < 12; ++i) + { + float x = 3358 + frand(-6.0f, 6.0f); + float y = -3049 + frand(-6.0f, 6.0f); + float z = 165.25; + float o = 2.0; + me->SummonCreature(roll_chance_i(5) ? NPC_PLAGUED_PEASANT : NPC_INJURED_PEASANT, x, y, z, o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 2*MINUTE*IN_MILLISECONDS); + } + } - void JustSummoned(Creature* creature) - { - summons.Summon(creature); - if (creature->GetEntry() == NPC_INJURED_PEASANT || creature->GetEntry() == NPC_PLAGUED_PEASANT) - { - creature->setFaction(_faction); - if (!_spoken) - { - _spoken = true; - creature->AI()->Talk(0); - } + void JustSummoned(Creature* creature) + { + summons.Summon(creature); + if (creature->GetEntry() == NPC_INJURED_PEASANT || creature->GetEntry() == NPC_PLAGUED_PEASANT) + { + creature->setFaction(_faction); + if (!_spoken) + { + _spoken = true; + creature->AI()->Talk(0); + } - if (creature->GetEntry() == NPC_PLAGUED_PEASANT) - creature->CastSpell(creature, SPELL_SEETHING_PLAGUE, true); + if (creature->GetEntry() == NPC_PLAGUED_PEASANT) + creature->CastSpell(creature, SPELL_SEETHING_PLAGUE, true); - float x = 3324+frand(-3.0f, 3.0f); - float y = -2966+frand(-3.0f, 3.0f); - float z = 159.65f; - creature->SetWalk(true); - creature->GetMotionMaster()->MovePoint(0, x, y, z); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - } - } + float x = 3324+frand(-3.0f, 3.0f); + float y = -2966+frand(-3.0f, 3.0f); + float z = 159.65f; + creature->SetWalk(true); + creature->GetMotionMaster()->MovePoint(0, x, y, z); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + } + } - void DoAction(int32 action) - { - if (action == 1) - _savedCount++; - else - _deathCount++; + void DoAction(int32 action) + { + if (action == 1) + _savedCount++; + else + _deathCount++; - if (_savedCount > 49) - { - Talk(1); - if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) - player->AreaExploredOrEventHappens(QUEST_BALANCE_OF_LIGHT_AND_SHADOW); - EnterEvadeMode(); - return; - } - else if (_deathCount > 14) - { - Talk(2); - if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) - player->FailQuest(QUEST_BALANCE_OF_LIGHT_AND_SHADOW); - EnterEvadeMode(); - return; - } + if (_savedCount > 49) + { + Talk(1); + if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) + player->AreaExploredOrEventHappens(QUEST_BALANCE_OF_LIGHT_AND_SHADOW); + EnterEvadeMode(); + return; + } + else if (_deathCount > 14) + { + Talk(2); + if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) + player->FailQuest(QUEST_BALANCE_OF_LIGHT_AND_SHADOW); + EnterEvadeMode(); + return; + } - if (action == 1 && !_spoken) - { - _spoken = true; - Talk(0); - me->CastSpell(me, SPELL_ERIS_BLESSING, false); - } - } + if (action == 1 && !_spoken) + { + _spoken = true; + Talk(0); + me->CastSpell(me, SPELL_ERIS_BLESSING, false); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_CHECK_PLAYER: - { - Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID); - if (!player || me->GetDistance2d(player) > 100.0f) - { - EnterEvadeMode(); - return; - } - events.RepeatEvent(2000); - break; - } - case EVENT_SUMMON_ARCHERS: - SummonArchers(); - events.PopEvent(); - break; - case EVENT_SUMMON_PEASANTS: - _spoken = false; - SummonPeasants(); - _spoken = false; - events.RepeatEvent(60*IN_MILLISECONDS); - break; - } - } - }; + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_CHECK_PLAYER: + { + Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID); + if (!player || me->GetDistance2d(player) > 100.0f) + { + EnterEvadeMode(); + return; + } + events.RepeatEvent(2000); + break; + } + case EVENT_SUMMON_ARCHERS: + SummonArchers(); + events.PopEvent(); + break; + case EVENT_SUMMON_PEASANTS: + _spoken = false; + SummonPeasants(); + _spoken = false; + events.RepeatEvent(60*IN_MILLISECONDS); + break; + } + } + }; }; class npc_balance_of_light_and_shadow : public CreatureScript @@ -255,61 +255,61 @@ public: { npc_balance_of_light_and_shadowAI(Creature* creature) : NullCreatureAI(creature) { timer = 0; _targetGUID = 0; } - bool CanBeSeen(Player const* player) - { - // requires this trinket to be seen - return player->HasItemOrGemWithIdEquipped(ITEM_EYE_OF_DIVINITY, 1); - } + bool CanBeSeen(Player const* player) + { + // requires this trinket to be seen + return player->HasItemOrGemWithIdEquipped(ITEM_EYE_OF_DIVINITY, 1); + } - uint32 timer; - uint64 _targetGUID; + uint32 timer; + uint64 _targetGUID; - void SpellHit(Unit*, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_SHOOT && roll_chance_i(7)) - me->CastSpell(me, SPELL_DEATHS_DOOR, true); - } + void SpellHit(Unit*, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_SHOOT && roll_chance_i(7)) + me->CastSpell(me, SPELL_DEATHS_DOOR, true); + } - void MovementInform(uint32 type, uint32 pointId) - { - if (type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 pointId) + { + if (type != POINT_MOTION_TYPE) + return; - if (TempSummon* summon = me->ToTempSummon()) - if (Unit* creature = summon->GetSummoner()) - creature->GetAI()->DoAction(1); + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* creature = summon->GetSummoner()) + creature->GetAI()->DoAction(1); - me->DespawnOrUnsummon(1); - } + me->DespawnOrUnsummon(1); + } - void JustDied(Unit*) - { - if (TempSummon* summon = me->ToTempSummon()) - if (Unit* creature = summon->GetSummoner()) - creature->GetAI()->DoAction(2); - } + void JustDied(Unit*) + { + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* creature = summon->GetSummoner()) + creature->GetAI()->DoAction(2); + } - void UpdateAI(uint32 diff) - { - if (me->GetEntry() != NPC_SCOURGE_ARCHER) - return; + void UpdateAI(uint32 diff) + { + if (me->GetEntry() != NPC_SCOURGE_ARCHER) + return; - timer += diff; - if (timer >= 4000) - { - Unit* target = _targetGUID ? ObjectAccessor::GetUnit(*me, _targetGUID) : NULL; - if (!target) - target = me->FindNearestCreature(NPC_INJURED_PEASANT, 60.0f); + timer += diff; + if (timer >= 4000) + { + Unit* target = _targetGUID ? ObjectAccessor::GetUnit(*me, _targetGUID) : NULL; + if (!target) + target = me->FindNearestCreature(NPC_INJURED_PEASANT, 60.0f); - if (target) - { - _targetGUID = target->GetGUID(); - me->CastSpell(target, SPELL_SHOOT, true); - } + if (target) + { + _targetGUID = target->GetGUID(); + me->CastSpell(target, SPELL_SHOOT, true); + } - timer = urand(0,3000); - } - } + timer = urand(0,3000); + } + } }; }; @@ -467,11 +467,11 @@ public: void AddSC_eastern_plaguelands() { - // Ours - new npc_eris_hevenfire(); - new npc_balance_of_light_and_shadow(); + // Ours + new npc_eris_hevenfire(); + new npc_balance_of_light_and_shadow(); - // Theirs + // Theirs new npc_ghoul_flayer(); new npc_augustus_the_touched(); new npc_darrowshire_spirit(); diff --git a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp index ef8f72ec6..827e4bac5 100644 --- a/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/zone_isle_of_queldanas.cpp @@ -38,617 +38,617 @@ EndContentData */ enum ThalorienNpcs { - NPC_THALORIEN_REMAINS = 37552, - NPC_SUNWELL_DEFENDER = 37211, - NPC_THALORIEN_KILL_CREDIT = 37601, - NPC_MORLEN_COLDGRIP = 37542, - NPC_SCOURGE_ZOMBIE = 37538, - NPC_GHOUL_INVADER = 37539, - NPC_CRYPT_RAIDER = 37541, + NPC_THALORIEN_REMAINS = 37552, + NPC_SUNWELL_DEFENDER = 37211, + NPC_THALORIEN_KILL_CREDIT = 37601, + NPC_MORLEN_COLDGRIP = 37542, + NPC_SCOURGE_ZOMBIE = 37538, + NPC_GHOUL_INVADER = 37539, + NPC_CRYPT_RAIDER = 37541, }; enum ThalorienEvents { - EVENT_NONE = 0, - EVENT_CHECK_PLAYER, - EVENT_SUMMON_SOLDIERS, - EVENT_TALK_INTRO_0, - EVENT_TALK_INTRO_1, - EVENT_TALK_INTRO_2, - EVENT_TALK_INTRO_3, - EVENT_SALUTE, - EVENT_SOLDIERS_RUN_AWAY, - EVENT_GO_FIGHTPOINT, - EVENT_TALK_SPAWN_0, - EVENT_TALK_SPAWN_1, - EVENT_SUMMON_MORLEN, - EVENT_TALK_MORLEN_0, - EVENT_TALK_MORLEN_1, - EVENT_SPAWN_WAVE_1, - EVENT_SPAWN_WAVE_2, - EVENT_SPAWN_WAVE_3, - EVENT_SUMMONS_ATTACK, - EVENT_OUTRO_0, - EVENT_OUTRO_1, - EVENT_OUTRO_2, - EVENT_OUTRO_3, - EVENT_OUTRO_KNEEL, - EVENT_DISAPPEAR, - EVENT_SET_FACING, - EVENT_SPELL_BLADESTORM, - EVENT_SPELL_MORTAL_STRIKE, - EVENT_SPELL_HEROIC_STRIKE, + EVENT_NONE = 0, + EVENT_CHECK_PLAYER, + EVENT_SUMMON_SOLDIERS, + EVENT_TALK_INTRO_0, + EVENT_TALK_INTRO_1, + EVENT_TALK_INTRO_2, + EVENT_TALK_INTRO_3, + EVENT_SALUTE, + EVENT_SOLDIERS_RUN_AWAY, + EVENT_GO_FIGHTPOINT, + EVENT_TALK_SPAWN_0, + EVENT_TALK_SPAWN_1, + EVENT_SUMMON_MORLEN, + EVENT_TALK_MORLEN_0, + EVENT_TALK_MORLEN_1, + EVENT_SPAWN_WAVE_1, + EVENT_SPAWN_WAVE_2, + EVENT_SPAWN_WAVE_3, + EVENT_SUMMONS_ATTACK, + EVENT_OUTRO_0, + EVENT_OUTRO_1, + EVENT_OUTRO_2, + EVENT_OUTRO_3, + EVENT_OUTRO_KNEEL, + EVENT_DISAPPEAR, + EVENT_SET_FACING, + EVENT_SPELL_BLADESTORM, + EVENT_SPELL_MORTAL_STRIKE, + EVENT_SPELL_HEROIC_STRIKE, }; enum ThalorienTexts { - SAY_INTRO_0 = 0, - SAY_INTRO_1 = 1, - SAY_INTRO_2 = 2, - SAY_INTRO_3 = 3, - SAY_SPAWN_0 = 4, - SAY_SPAWN_1 = 5, - SAY_MORLEN_0 = 0, - SAY_MORLEN_1 = 1, - SAY_MORLEN_2 = 2, - SAY_MORLEN_3 = 3, - SAY_MORLEN_4 = 4, - SAY_OUTRO_0 = 6, - SAY_OUTRO_1 = 7, - SAY_OUTRO_2 = 8, - SAY_OUTRO_3 = 9, + SAY_INTRO_0 = 0, + SAY_INTRO_1 = 1, + SAY_INTRO_2 = 2, + SAY_INTRO_3 = 3, + SAY_SPAWN_0 = 4, + SAY_SPAWN_1 = 5, + SAY_MORLEN_0 = 0, + SAY_MORLEN_1 = 1, + SAY_MORLEN_2 = 2, + SAY_MORLEN_3 = 3, + SAY_MORLEN_4 = 4, + SAY_OUTRO_0 = 6, + SAY_OUTRO_1 = 7, + SAY_OUTRO_2 = 8, + SAY_OUTRO_3 = 9, }; #define SUNWELL_DEFENDER_NUM 10 const Position SunwellDefenderPos[SUNWELL_DEFENDER_NUM] = { - {11801.6f, -7070.91f, 25.5347f, 2.7428f}, - {11800.8f, -7073.11f, 25.7903f, 2.78207f}, - {11799.9f, -7075.29f, 26.1329f, 2.78207f}, - {11799.1f, -7077.46f, 26.3211f, 2.78207f}, - {11798.1f, -7080.09f, 26.1556f, 2.78207f}, - {11795.1f, -7078.93f, 26.1822f, 2.77814f}, - {11796.0f, -7076.32f, 26.4659f, 2.79778f}, - {11797.0f, -7073.71f, 26.3534f, 2.79778f}, - {11797.8f, -7071.5f, 26.0573f, 2.79778f}, - {11798.7f, -7068.83f, 25.6424f, 2.79778f} + {11801.6f, -7070.91f, 25.5347f, 2.7428f}, + {11800.8f, -7073.11f, 25.7903f, 2.78207f}, + {11799.9f, -7075.29f, 26.1329f, 2.78207f}, + {11799.1f, -7077.46f, 26.3211f, 2.78207f}, + {11798.1f, -7080.09f, 26.1556f, 2.78207f}, + {11795.1f, -7078.93f, 26.1822f, 2.77814f}, + {11796.0f, -7076.32f, 26.4659f, 2.79778f}, + {11797.0f, -7073.71f, 26.3534f, 2.79778f}, + {11797.8f, -7071.5f, 26.0573f, 2.79778f}, + {11798.7f, -7068.83f, 25.6424f, 2.79778f} }; class npc_bh_thalorien_dawnseeker : public CreatureScript { public: - npc_bh_thalorien_dawnseeker() : CreatureScript("npc_bh_thalorien_dawnseeker") { } + npc_bh_thalorien_dawnseeker() : CreatureScript("npc_bh_thalorien_dawnseeker") { } - CreatureAI *GetAI(Creature *creature) const - { - return new npc_bh_thalorien_dawnseekerAI(creature); - } + CreatureAI *GetAI(Creature *creature) const + { + return new npc_bh_thalorien_dawnseekerAI(creature); + } - struct npc_bh_thalorien_dawnseekerAI : public ScriptedAI - { - npc_bh_thalorien_dawnseekerAI(Creature *c) : ScriptedAI(c), summons(me) - { - } + struct npc_bh_thalorien_dawnseekerAI : public ScriptedAI + { + npc_bh_thalorien_dawnseekerAI(Creature *c) : ScriptedAI(c), summons(me) + { + } - EventMap events; - SummonList summons; - uint64 playerGUID; - uint64 morlenGUID; + EventMap events; + SummonList summons; + uint64 playerGUID; + uint64 morlenGUID; - void Reset() - { - me->SetVisible(false); - me->SetRegeneratingHealth(true); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->SetStandState(UNIT_STAND_STATE_STAND); - playerGUID = 0; - morlenGUID = 0; - summons.DespawnAll(); - if (Creature* c = me->FindNearestCreature(NPC_THALORIEN_REMAINS, 100.0f, true)) - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - events.Reset(); - events.ScheduleEvent(EVENT_CHECK_PLAYER, 5000); - events.ScheduleEvent(EVENT_SUMMON_SOLDIERS, 0); - events.ScheduleEvent(EVENT_TALK_INTRO_0, 3000); - events.ScheduleEvent(EVENT_TALK_INTRO_1, 8000); - events.ScheduleEvent(EVENT_TALK_INTRO_2, 15000); - events.ScheduleEvent(EVENT_TALK_INTRO_3, 22000); - events.ScheduleEvent(EVENT_SALUTE, 24000); - events.ScheduleEvent(EVENT_SOLDIERS_RUN_AWAY, 30000); - events.ScheduleEvent(EVENT_GO_FIGHTPOINT, 31000); - events.ScheduleEvent(EVENT_TALK_SPAWN_0, 38000); - events.ScheduleEvent(EVENT_SUMMON_MORLEN, 44000); - events.ScheduleEvent(EVENT_TALK_SPAWN_1, 47000); - events.ScheduleEvent(EVENT_TALK_MORLEN_0, 52000); - events.ScheduleEvent(EVENT_TALK_MORLEN_1, 58000); - events.ScheduleEvent(EVENT_SPAWN_WAVE_1, 61000); + void Reset() + { + me->SetVisible(false); + me->SetRegeneratingHealth(true); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->SetStandState(UNIT_STAND_STATE_STAND); + playerGUID = 0; + morlenGUID = 0; + summons.DespawnAll(); + if (Creature* c = me->FindNearestCreature(NPC_THALORIEN_REMAINS, 100.0f, true)) + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + events.Reset(); + events.ScheduleEvent(EVENT_CHECK_PLAYER, 5000); + events.ScheduleEvent(EVENT_SUMMON_SOLDIERS, 0); + events.ScheduleEvent(EVENT_TALK_INTRO_0, 3000); + events.ScheduleEvent(EVENT_TALK_INTRO_1, 8000); + events.ScheduleEvent(EVENT_TALK_INTRO_2, 15000); + events.ScheduleEvent(EVENT_TALK_INTRO_3, 22000); + events.ScheduleEvent(EVENT_SALUTE, 24000); + events.ScheduleEvent(EVENT_SOLDIERS_RUN_AWAY, 30000); + events.ScheduleEvent(EVENT_GO_FIGHTPOINT, 31000); + events.ScheduleEvent(EVENT_TALK_SPAWN_0, 38000); + events.ScheduleEvent(EVENT_SUMMON_MORLEN, 44000); + events.ScheduleEvent(EVENT_TALK_SPAWN_1, 47000); + events.ScheduleEvent(EVENT_TALK_MORLEN_0, 52000); + events.ScheduleEvent(EVENT_TALK_MORLEN_1, 58000); + events.ScheduleEvent(EVENT_SPAWN_WAVE_1, 61000); - events.ScheduleEvent(EVENT_SPELL_BLADESTORM, urand(6000, 15000)); - events.ScheduleEvent(EVENT_SPELL_MORTAL_STRIKE, urand(3000, 7000)); - events.ScheduleEvent(EVENT_SPELL_HEROIC_STRIKE, urand(4000, 10000)); - } + events.ScheduleEvent(EVENT_SPELL_BLADESTORM, urand(6000, 15000)); + events.ScheduleEvent(EVENT_SPELL_MORTAL_STRIKE, urand(3000, 7000)); + events.ScheduleEvent(EVENT_SPELL_HEROIC_STRIKE, urand(4000, 10000)); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - if (summon->GetEntry() != NPC_SUNWELL_DEFENDER && me->isActiveObject()) - { - if (summon->GetEntry() == NPC_MORLEN_COLDGRIP) - { - me->RemoveAurasDueToSpell(67541); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->GetMotionMaster()->MoveCharge(11779.30f, -7065.43f, 24.92f, me->GetSpeed(MOVE_RUN), EVENT_CHARGE); - events.ScheduleEvent(EVENT_OUTRO_0, 0); - events.ScheduleEvent(EVENT_OUTRO_1, 5000); - events.ScheduleEvent(EVENT_OUTRO_2, 12000); - events.ScheduleEvent(EVENT_OUTRO_3, 19000); - } - else if (summons.size() == 1) - { - me->RemoveAurasDueToSpell(67541); - me->GetMotionMaster()->MoveCharge(11779.30f, -7065.43f, 24.92f, me->GetSpeed(MOVE_RUN), EVENT_CHARGE); - switch(summon->GetEntry()) - { - case NPC_SCOURGE_ZOMBIE: - events.ScheduleEvent(EVENT_SPAWN_WAVE_2, 3000); - break; - case NPC_GHOUL_INVADER: - events.ScheduleEvent(EVENT_SPAWN_WAVE_3, 3000); - break; - case NPC_CRYPT_RAIDER: - events.ScheduleEvent(EVENT_SUMMONS_ATTACK, 3000); - break; - } - } - } - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + if (summon->GetEntry() != NPC_SUNWELL_DEFENDER && me->isActiveObject()) + { + if (summon->GetEntry() == NPC_MORLEN_COLDGRIP) + { + me->RemoveAurasDueToSpell(67541); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->GetMotionMaster()->MoveCharge(11779.30f, -7065.43f, 24.92f, me->GetSpeed(MOVE_RUN), EVENT_CHARGE); + events.ScheduleEvent(EVENT_OUTRO_0, 0); + events.ScheduleEvent(EVENT_OUTRO_1, 5000); + events.ScheduleEvent(EVENT_OUTRO_2, 12000); + events.ScheduleEvent(EVENT_OUTRO_3, 19000); + } + else if (summons.size() == 1) + { + me->RemoveAurasDueToSpell(67541); + me->GetMotionMaster()->MoveCharge(11779.30f, -7065.43f, 24.92f, me->GetSpeed(MOVE_RUN), EVENT_CHARGE); + switch(summon->GetEntry()) + { + case NPC_SCOURGE_ZOMBIE: + events.ScheduleEvent(EVENT_SPAWN_WAVE_2, 3000); + break; + case NPC_GHOUL_INVADER: + events.ScheduleEvent(EVENT_SPAWN_WAVE_3, 3000); + break; + case NPC_CRYPT_RAIDER: + events.ScheduleEvent(EVENT_SUMMONS_ATTACK, 3000); + break; + } + } + } + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - { - damage = 0; - me->setActive(false); - EnterEvadeMode(); - } - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + { + damage = 0; + me->setActive(false); + EnterEvadeMode(); + } + } - void UpdateAI(uint32 diff) - { - if (!me->isActiveObject()) - return; + void UpdateAI(uint32 diff) + { + if (!me->isActiveObject()) + return; - UpdateVictim(); + UpdateVictim(); - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (uint32 evId = events.GetEvent()) - { - case 0: - break; - case EVENT_CHECK_PLAYER: - if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) - if (p->GetExactDist(me) <= 50.0f) - { - events.RepeatEvent(5000); - break; - } - events.PopEvent(); - me->setActive(false); - EnterEvadeMode(); - return; - case EVENT_SUMMON_SOLDIERS: - for (uint8 i=0; iSummonCreature(NPC_SUNWELL_DEFENDER, SunwellDefenderPos[i], TEMPSUMMON_TIMED_DESPAWN, 33000+(i/5)*5000); - events.PopEvent(); - break; - case EVENT_TALK_INTRO_0: - case EVENT_TALK_INTRO_1: - case EVENT_TALK_INTRO_2: - case EVENT_TALK_INTRO_3: - Talk(SAY_INTRO_0 + (evId-EVENT_TALK_INTRO_0)); - events.PopEvent(); - break; - case EVENT_SALUTE: - me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = ObjectAccessor::GetCreature(*me, *itr)) - c->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); - events.PopEvent(); - break; - case EVENT_SOLDIERS_RUN_AWAY: - { - uint8 count = 0; - for (SummonList::iterator itr = summons.begin(); itr != summons.end();) - { - ++count; - if (Creature* c = ObjectAccessor::GetCreature(*me, *itr)) - { - c->SetWalk(false); - c->GetMotionMaster()->MovePoint(0, 11863.35f, -7073.44f, 27.40f); - } - SummonList::iterator itr2 = itr++; - summons.erase(itr2); - if (count >= 5) - { - if (!summons.empty()) - { - events.RepeatEvent(5000); - return; - } - else - { - events.PopEvent(); - return; - } - } - } - } - events.PopEvent(); - break; - case EVENT_GO_FIGHTPOINT: - me->SetWalk(true); - me->GetMotionMaster()->MovePoint(0, 11779.30f, -7065.43f, 24.92f); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - events.PopEvent(); - break; - case EVENT_TALK_SPAWN_0: - case EVENT_TALK_SPAWN_1: - Talk(SAY_SPAWN_0 + (evId-EVENT_TALK_SPAWN_0)); - events.PopEvent(); - break; - case EVENT_SUMMON_MORLEN: - if (Creature* c = me->SummonCreature(NPC_MORLEN_COLDGRIP, 11766.70f, -7050.57f, 25.17f, 5.56f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) - morlenGUID = c->GetGUID(); - events.PopEvent(); - break; - case EVENT_TALK_MORLEN_0: - case EVENT_TALK_MORLEN_1: - if (Creature* c = ObjectAccessor::GetCreature(*me, morlenGUID)) - c->AI()->Talk(SAY_MORLEN_0 + (evId-EVENT_TALK_MORLEN_0)); - events.PopEvent(); - break; - case EVENT_SPAWN_WAVE_1: - case EVENT_SPAWN_WAVE_2: - case EVENT_SPAWN_WAVE_3: - if (Creature* c = ObjectAccessor::GetCreature(*me, morlenGUID)) - { - c->AI()->Talk(SAY_MORLEN_1 + (evId-EVENT_SPAWN_WAVE_1)); - switch (evId) - { - // emerge cast tr false 66947 - case EVENT_SPAWN_WAVE_1: - { - Position spawnPos; - c->GetPosition(&spawnPos); - spawnPos.m_orientation = 5.80f; - spawnPos.m_positionX += 5.0f*cos(4.5f); - spawnPos.m_positionY += 5.0f*sin(4.5f); - for (uint8 i=0; i<5; ++i) - if (Creature* s = me->SummonCreature(NPC_SCOURGE_ZOMBIE, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000)) - { - spawnPos.m_positionX += 2.5f*cos(4.5f); - spawnPos.m_positionY += 2.5f*sin(4.5f); - } - } - break; - case EVENT_SPAWN_WAVE_2: - { - Position spawnPos; - c->GetPosition(&spawnPos); - spawnPos.m_orientation = 5.80f; - spawnPos.m_positionX += 7.0f*cos(4.0f); - spawnPos.m_positionY += 7.0f*sin(4.0f); - for (uint8 i=0; i<3; ++i) - if (Creature* s = me->SummonCreature(NPC_GHOUL_INVADER, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000)) - { - s->CastSpell(s, 66947, false); // emerge effect - spawnPos.m_positionX += 4.0f*cos(4.5f); - spawnPos.m_positionY += 4.0f*sin(4.5f); - } - } - break; - case EVENT_SPAWN_WAVE_3: - { - Position spawnPos; - c->GetPosition(&spawnPos); - spawnPos.m_orientation = 5.80f; - spawnPos.m_positionX += 8.0f*cos(4.0f); - spawnPos.m_positionY += 8.0f*sin(4.0f); - for (uint8 i=0; i<3; ++i) - if (Creature* s = me->SummonCreature(NPC_CRYPT_RAIDER, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000)) - { - s->CastSpell(s, 66947, false); // emerge effect - spawnPos.m_positionX += 4.0f*cos(4.5f); - spawnPos.m_positionY += 4.0f*sin(4.5f); - } - } - break; - } - } - events.PopEvent(); - events.ScheduleEvent(EVENT_SUMMONS_ATTACK, 3000); - break; - case EVENT_SUMMONS_ATTACK: - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = ObjectAccessor::GetCreature(*me, *itr)) - { - if (c->GetEntry() == NPC_MORLEN_COLDGRIP && summons.size() != 1) - continue; - else - c->AI()->Talk(SAY_MORLEN_4); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - c->AI()->AttackStart(me); - } - events.PopEvent(); - break; - case EVENT_OUTRO_0: - case EVENT_OUTRO_1: - case EVENT_OUTRO_2: - case EVENT_OUTRO_3: - Talk(SAY_OUTRO_0 + (evId-EVENT_OUTRO_0)); - events.PopEvent(); - if (evId == EVENT_OUTRO_3) - events.ScheduleEvent(EVENT_OUTRO_KNEEL, 6000); - break; - case EVENT_OUTRO_KNEEL: - if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) - p->KilledMonsterCredit(NPC_THALORIEN_KILL_CREDIT, 0); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - events.PopEvent(); - events.ScheduleEvent(EVENT_DISAPPEAR, 6000); - break; - case EVENT_DISAPPEAR: - events.PopEvent(); - me->SetVisible(false); - me->setActive(false); - EnterEvadeMode(); - break; - case EVENT_SET_FACING: - me->SetFacingTo(2.45f); - events.PopEvent(); - break; + switch (uint32 evId = events.GetEvent()) + { + case 0: + break; + case EVENT_CHECK_PLAYER: + if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) + if (p->GetExactDist(me) <= 50.0f) + { + events.RepeatEvent(5000); + break; + } + events.PopEvent(); + me->setActive(false); + EnterEvadeMode(); + return; + case EVENT_SUMMON_SOLDIERS: + for (uint8 i=0; iSummonCreature(NPC_SUNWELL_DEFENDER, SunwellDefenderPos[i], TEMPSUMMON_TIMED_DESPAWN, 33000+(i/5)*5000); + events.PopEvent(); + break; + case EVENT_TALK_INTRO_0: + case EVENT_TALK_INTRO_1: + case EVENT_TALK_INTRO_2: + case EVENT_TALK_INTRO_3: + Talk(SAY_INTRO_0 + (evId-EVENT_TALK_INTRO_0)); + events.PopEvent(); + break; + case EVENT_SALUTE: + me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = ObjectAccessor::GetCreature(*me, *itr)) + c->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); + events.PopEvent(); + break; + case EVENT_SOLDIERS_RUN_AWAY: + { + uint8 count = 0; + for (SummonList::iterator itr = summons.begin(); itr != summons.end();) + { + ++count; + if (Creature* c = ObjectAccessor::GetCreature(*me, *itr)) + { + c->SetWalk(false); + c->GetMotionMaster()->MovePoint(0, 11863.35f, -7073.44f, 27.40f); + } + SummonList::iterator itr2 = itr++; + summons.erase(itr2); + if (count >= 5) + { + if (!summons.empty()) + { + events.RepeatEvent(5000); + return; + } + else + { + events.PopEvent(); + return; + } + } + } + } + events.PopEvent(); + break; + case EVENT_GO_FIGHTPOINT: + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(0, 11779.30f, -7065.43f, 24.92f); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + events.PopEvent(); + break; + case EVENT_TALK_SPAWN_0: + case EVENT_TALK_SPAWN_1: + Talk(SAY_SPAWN_0 + (evId-EVENT_TALK_SPAWN_0)); + events.PopEvent(); + break; + case EVENT_SUMMON_MORLEN: + if (Creature* c = me->SummonCreature(NPC_MORLEN_COLDGRIP, 11766.70f, -7050.57f, 25.17f, 5.56f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) + morlenGUID = c->GetGUID(); + events.PopEvent(); + break; + case EVENT_TALK_MORLEN_0: + case EVENT_TALK_MORLEN_1: + if (Creature* c = ObjectAccessor::GetCreature(*me, morlenGUID)) + c->AI()->Talk(SAY_MORLEN_0 + (evId-EVENT_TALK_MORLEN_0)); + events.PopEvent(); + break; + case EVENT_SPAWN_WAVE_1: + case EVENT_SPAWN_WAVE_2: + case EVENT_SPAWN_WAVE_3: + if (Creature* c = ObjectAccessor::GetCreature(*me, morlenGUID)) + { + c->AI()->Talk(SAY_MORLEN_1 + (evId-EVENT_SPAWN_WAVE_1)); + switch (evId) + { + // emerge cast tr false 66947 + case EVENT_SPAWN_WAVE_1: + { + Position spawnPos; + c->GetPosition(&spawnPos); + spawnPos.m_orientation = 5.80f; + spawnPos.m_positionX += 5.0f*cos(4.5f); + spawnPos.m_positionY += 5.0f*sin(4.5f); + for (uint8 i=0; i<5; ++i) + if (Creature* s = me->SummonCreature(NPC_SCOURGE_ZOMBIE, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000)) + { + spawnPos.m_positionX += 2.5f*cos(4.5f); + spawnPos.m_positionY += 2.5f*sin(4.5f); + } + } + break; + case EVENT_SPAWN_WAVE_2: + { + Position spawnPos; + c->GetPosition(&spawnPos); + spawnPos.m_orientation = 5.80f; + spawnPos.m_positionX += 7.0f*cos(4.0f); + spawnPos.m_positionY += 7.0f*sin(4.0f); + for (uint8 i=0; i<3; ++i) + if (Creature* s = me->SummonCreature(NPC_GHOUL_INVADER, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000)) + { + s->CastSpell(s, 66947, false); // emerge effect + spawnPos.m_positionX += 4.0f*cos(4.5f); + spawnPos.m_positionY += 4.0f*sin(4.5f); + } + } + break; + case EVENT_SPAWN_WAVE_3: + { + Position spawnPos; + c->GetPosition(&spawnPos); + spawnPos.m_orientation = 5.80f; + spawnPos.m_positionX += 8.0f*cos(4.0f); + spawnPos.m_positionY += 8.0f*sin(4.0f); + for (uint8 i=0; i<3; ++i) + if (Creature* s = me->SummonCreature(NPC_CRYPT_RAIDER, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000)) + { + s->CastSpell(s, 66947, false); // emerge effect + spawnPos.m_positionX += 4.0f*cos(4.5f); + spawnPos.m_positionY += 4.0f*sin(4.5f); + } + } + break; + } + } + events.PopEvent(); + events.ScheduleEvent(EVENT_SUMMONS_ATTACK, 3000); + break; + case EVENT_SUMMONS_ATTACK: + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = ObjectAccessor::GetCreature(*me, *itr)) + { + if (c->GetEntry() == NPC_MORLEN_COLDGRIP && summons.size() != 1) + continue; + else + c->AI()->Talk(SAY_MORLEN_4); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + c->AI()->AttackStart(me); + } + events.PopEvent(); + break; + case EVENT_OUTRO_0: + case EVENT_OUTRO_1: + case EVENT_OUTRO_2: + case EVENT_OUTRO_3: + Talk(SAY_OUTRO_0 + (evId-EVENT_OUTRO_0)); + events.PopEvent(); + if (evId == EVENT_OUTRO_3) + events.ScheduleEvent(EVENT_OUTRO_KNEEL, 6000); + break; + case EVENT_OUTRO_KNEEL: + if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) + p->KilledMonsterCredit(NPC_THALORIEN_KILL_CREDIT, 0); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + events.PopEvent(); + events.ScheduleEvent(EVENT_DISAPPEAR, 6000); + break; + case EVENT_DISAPPEAR: + events.PopEvent(); + me->SetVisible(false); + me->setActive(false); + EnterEvadeMode(); + break; + case EVENT_SET_FACING: + me->SetFacingTo(2.45f); + events.PopEvent(); + break; - case EVENT_SPELL_BLADESTORM: - if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) - me->CastSpell(me->GetVictim(), 67541, false); - events.RepeatEvent(urand(25000, 35000)); - break; - case EVENT_SPELL_MORTAL_STRIKE: - if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) - me->CastSpell(me->GetVictim(), 67542, false); - events.RepeatEvent(urand(7000, 12000)); - break; - case EVENT_SPELL_HEROIC_STRIKE: - if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) - me->CastSpell(me->GetVictim(), 57846, false); - events.RepeatEvent(urand(5000, 10000)); - break; - } + case EVENT_SPELL_BLADESTORM: + if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) + me->CastSpell(me->GetVictim(), 67541, false); + events.RepeatEvent(urand(25000, 35000)); + break; + case EVENT_SPELL_MORTAL_STRIKE: + if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) + me->CastSpell(me->GetVictim(), 67542, false); + events.RepeatEvent(urand(7000, 12000)); + break; + case EVENT_SPELL_HEROIC_STRIKE: + if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) + me->CastSpell(me->GetVictim(), 57846, false); + events.RepeatEvent(urand(5000, 10000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == EVENT_CHARGE) - events.ScheduleEvent(EVENT_SET_FACING, 0); - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == EVENT_CHARGE) + events.ScheduleEvent(EVENT_SET_FACING, 0); + } - void EnterEvadeMode() - { - if (me->isActiveObject()) - return; - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + if (me->isActiveObject()) + return; + ScriptedAI::EnterEvadeMode(); + } - void SetData(uint32 type, uint32 id) - { - if (type == 1 && id == 1 && !me->isActiveObject()) - if (Player* p = me->SelectNearestPlayer(50.0f)) - { - me->SetVisible(true); - me->SetRegeneratingHealth(false); - me->setActive(true); - playerGUID = p->GetGUID(); - } - } - }; + void SetData(uint32 type, uint32 id) + { + if (type == 1 && id == 1 && !me->isActiveObject()) + if (Player* p = me->SelectNearestPlayer(50.0f)) + { + me->SetVisible(true); + me->SetRegeneratingHealth(false); + me->setActive(true); + playerGUID = p->GetGUID(); + } + } + }; }; enum PurificationIds { - GO_QUEL_DELAR = 201794, - NPC_SUNWELL_VISUAL_BUNNY = 37000, - NPC_SUNWELL_HONOR_GUARD = 37781, - NPC_ROMMATH = 37763, - NPC_GALIROS = 38056, - NPC_THERON = 37764, - NPC_AURIC = 37765, + GO_QUEL_DELAR = 201794, + NPC_SUNWELL_VISUAL_BUNNY = 37000, + NPC_SUNWELL_HONOR_GUARD = 37781, + NPC_ROMMATH = 37763, + NPC_GALIROS = 38056, + NPC_THERON = 37764, + NPC_AURIC = 37765, }; class spell_bh_cleanse_quel_delar : public SpellScriptLoader { public: - spell_bh_cleanse_quel_delar() : SpellScriptLoader("spell_bh_cleanse_quel_delar") { } + spell_bh_cleanse_quel_delar() : SpellScriptLoader("spell_bh_cleanse_quel_delar") { } - class spell_bh_cleanse_quel_delar_SpellScript : public SpellScript - { - PrepareSpellScript(spell_bh_cleanse_quel_delar_SpellScript); + class spell_bh_cleanse_quel_delar_SpellScript : public SpellScript + { + PrepareSpellScript(spell_bh_cleanse_quel_delar_SpellScript); - void OnEffect(SpellEffIndex effIndex) - { - if (Unit* caster = GetCaster()) - if (Creature* c = caster->FindNearestCreature(NPC_ROMMATH, 50.0f, true)) - c->AI()->DoAction(-1); - } + void OnEffect(SpellEffIndex effIndex) + { + if (Unit* caster = GetCaster()) + if (Creature* c = caster->FindNearestCreature(NPC_ROMMATH, 50.0f, true)) + c->AI()->DoAction(-1); + } - void Register() - { - OnEffectLaunch += SpellEffectFn(spell_bh_cleanse_quel_delar_SpellScript::OnEffect, EFFECT_0, SPELL_EFFECT_SEND_EVENT); - } - }; + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_bh_cleanse_quel_delar_SpellScript::OnEffect, EFFECT_0, SPELL_EFFECT_SEND_EVENT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_bh_cleanse_quel_delar_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_bh_cleanse_quel_delar_SpellScript(); + } }; class npc_grand_magister_rommath : public CreatureScript { public: - npc_grand_magister_rommath() : CreatureScript("npc_grand_magister_rommath") { } + npc_grand_magister_rommath() : CreatureScript("npc_grand_magister_rommath") { } - CreatureAI *GetAI(Creature *creature) const - { - return new npc_grand_magister_rommathAI(creature); - } + CreatureAI *GetAI(Creature *creature) const + { + return new npc_grand_magister_rommathAI(creature); + } - struct npc_grand_magister_rommathAI : public NullCreatureAI - { - npc_grand_magister_rommathAI(Creature *c) : NullCreatureAI(c) - { - announced = false; - playerGUID = 0; - me->SetReactState(REACT_AGGRESSIVE); - } + struct npc_grand_magister_rommathAI : public NullCreatureAI + { + npc_grand_magister_rommathAI(Creature *c) : NullCreatureAI(c) + { + announced = false; + playerGUID = 0; + me->SetReactState(REACT_AGGRESSIVE); + } - EventMap events; - bool announced; - uint64 playerGUID; + EventMap events; + bool announced; + uint64 playerGUID; - void MoveInLineOfSight(Unit* who) - { - if (!announced && who->GetTypeId() == TYPEID_PLAYER && who->GetPositionZ() < 30.0f) - { - announced = true; - playerGUID = who->GetGUID(); - if (Creature* c = me->FindNearestCreature(NPC_GALIROS, 100.0f, true)) - c->AI()->Talk(0, who); - } - } + void MoveInLineOfSight(Unit* who) + { + if (!announced && who->GetTypeId() == TYPEID_PLAYER && who->GetPositionZ() < 30.0f) + { + announced = true; + playerGUID = who->GetGUID(); + if (Creature* c = me->FindNearestCreature(NPC_GALIROS, 100.0f, true)) + c->AI()->Talk(0, who); + } + } - void DoAction(int32 a) - { - if (a == -1 && !me->isActiveObject()) - { - me->SummonGameObject(GO_QUEL_DELAR, 1688.24f, 621.769f, 29.1745f, 0.523177f, 0.0f, 0.0f, 0.0f, 0.0f, 86400); - me->SummonCreature(NPC_SUNWELL_VISUAL_BUNNY, 1688.24f, 621.769f, 29.1745f, 0.523177f, TEMPSUMMON_MANUAL_DESPAWN); - me->setActive(true); - events.Reset(); - events.ScheduleEvent(1, 1000); // guard talk - events.ScheduleEvent(2, 4000); // theron talk - events.ScheduleEvent(3, 10000); // npcs walk - events.ScheduleEvent(4, 17000); // rommath talk - events.ScheduleEvent(5, 20000); // theron talk - events.ScheduleEvent(6, 28000); // theron talk - events.ScheduleEvent(7, 37000); // rommath talk - events.ScheduleEvent(8, 44000); // rommath talk - events.ScheduleEvent(9, 52000); // rommath talk - events.ScheduleEvent(10, 60000); // auric talk - events.ScheduleEvent(11, 66000); // auric talk - events.ScheduleEvent(12, 76000); // rommath talk - events.ScheduleEvent(13, 80000); // move home - } - } + void DoAction(int32 a) + { + if (a == -1 && !me->isActiveObject()) + { + me->SummonGameObject(GO_QUEL_DELAR, 1688.24f, 621.769f, 29.1745f, 0.523177f, 0.0f, 0.0f, 0.0f, 0.0f, 86400); + me->SummonCreature(NPC_SUNWELL_VISUAL_BUNNY, 1688.24f, 621.769f, 29.1745f, 0.523177f, TEMPSUMMON_MANUAL_DESPAWN); + me->setActive(true); + events.Reset(); + events.ScheduleEvent(1, 1000); // guard talk + events.ScheduleEvent(2, 4000); // theron talk + events.ScheduleEvent(3, 10000); // npcs walk + events.ScheduleEvent(4, 17000); // rommath talk + events.ScheduleEvent(5, 20000); // theron talk + events.ScheduleEvent(6, 28000); // theron talk + events.ScheduleEvent(7, 37000); // rommath talk + events.ScheduleEvent(8, 44000); // rommath talk + events.ScheduleEvent(9, 52000); // rommath talk + events.ScheduleEvent(10, 60000); // auric talk + events.ScheduleEvent(11, 66000); // auric talk + events.ScheduleEvent(12, 76000); // rommath talk + events.ScheduleEvent(13, 80000); // move home + } + } - void UpdateAI(uint32 diff) - { - if (!me->isActiveObject()) - return; + void UpdateAI(uint32 diff) + { + if (!me->isActiveObject()) + return; - events.Update(diff); + events.Update(diff); - switch (events.ExecuteEvent()) - { - case 1: - if (Creature* c = me->FindNearestCreature(NPC_SUNWELL_HONOR_GUARD, 60.0f, true)) - c->AI()->Talk(0); - break; - case 2: - if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) - c->AI()->Talk(0); - break; - case 3: - me->SetWalk(true); - me->GetMotionMaster()->MovePath(me->GetEntry()*100, false); - if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) - { - c->SetWalk(true); - c->GetMotionMaster()->MovePath(c->GetEntry()*100, false); - } - if (Creature* c = me->FindNearestCreature(NPC_AURIC, 60.0f, true)) - { - c->SetWalk(true); - c->GetMotionMaster()->MovePath(c->GetEntry()*100, false); - } - break; - case 4: - Talk(0); - break; - case 5: - if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) - c->AI()->Talk(1); - break; - case 6: - if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) - c->AI()->Talk(2, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case 7: - Talk(1, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case 8: - Talk(2); - break; - case 9: - Talk(3); - break; - case 10: - if (Creature* c = me->FindNearestCreature(NPC_AURIC, 60.0f, true)) - c->AI()->Talk(0); - break; - case 11: - if (Creature* c = me->FindNearestCreature(NPC_AURIC, 60.0f, true)) - c->AI()->Talk(1); - break; - case 12: - if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) - Talk(p->GetTeamId() == TEAM_ALLIANCE ? 5 : 4, p); - break; - case 13: - me->setActive(false); - if (Creature* c = me->FindNearestCreature(NPC_SUNWELL_VISUAL_BUNNY, 60.0f, true)) - c->DespawnOrUnsummon(1); - if (GameObject* go = me->FindNearestGameObject(GO_QUEL_DELAR, 60.0f)) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - me->SetWalk(true); - if (me->GetCreatureData()) - me->GetMotionMaster()->MovePoint(0, me->GetCreatureData()->posX, me->GetCreatureData()->posY, me->GetCreatureData()->posZ); - if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) - { - c->SetWalk(true); - if (c->GetCreatureData()) - c->GetMotionMaster()->MovePoint(0, c->GetCreatureData()->posX, c->GetCreatureData()->posY, c->GetCreatureData()->posZ); - } - if (Creature* c = me->FindNearestCreature(NPC_AURIC, 60.0f, true)) - { - c->SetWalk(true); - if (c->GetCreatureData()) - c->GetMotionMaster()->MovePoint(0, c->GetCreatureData()->posX, c->GetCreatureData()->posY, c->GetCreatureData()->posZ); - } - break; - } - } - }; + switch (events.ExecuteEvent()) + { + case 1: + if (Creature* c = me->FindNearestCreature(NPC_SUNWELL_HONOR_GUARD, 60.0f, true)) + c->AI()->Talk(0); + break; + case 2: + if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) + c->AI()->Talk(0); + break; + case 3: + me->SetWalk(true); + me->GetMotionMaster()->MovePath(me->GetEntry()*100, false); + if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) + { + c->SetWalk(true); + c->GetMotionMaster()->MovePath(c->GetEntry()*100, false); + } + if (Creature* c = me->FindNearestCreature(NPC_AURIC, 60.0f, true)) + { + c->SetWalk(true); + c->GetMotionMaster()->MovePath(c->GetEntry()*100, false); + } + break; + case 4: + Talk(0); + break; + case 5: + if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) + c->AI()->Talk(1); + break; + case 6: + if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) + c->AI()->Talk(2, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case 7: + Talk(1, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case 8: + Talk(2); + break; + case 9: + Talk(3); + break; + case 10: + if (Creature* c = me->FindNearestCreature(NPC_AURIC, 60.0f, true)) + c->AI()->Talk(0); + break; + case 11: + if (Creature* c = me->FindNearestCreature(NPC_AURIC, 60.0f, true)) + c->AI()->Talk(1); + break; + case 12: + if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) + Talk(p->GetTeamId() == TEAM_ALLIANCE ? 5 : 4, p); + break; + case 13: + me->setActive(false); + if (Creature* c = me->FindNearestCreature(NPC_SUNWELL_VISUAL_BUNNY, 60.0f, true)) + c->DespawnOrUnsummon(1); + if (GameObject* go = me->FindNearestGameObject(GO_QUEL_DELAR, 60.0f)) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + me->SetWalk(true); + if (me->GetCreatureData()) + me->GetMotionMaster()->MovePoint(0, me->GetCreatureData()->posX, me->GetCreatureData()->posY, me->GetCreatureData()->posZ); + if (Creature* c = me->FindNearestCreature(NPC_THERON, 60.0f, true)) + { + c->SetWalk(true); + if (c->GetCreatureData()) + c->GetMotionMaster()->MovePoint(0, c->GetCreatureData()->posX, c->GetCreatureData()->posY, c->GetCreatureData()->posZ); + } + if (Creature* c = me->FindNearestCreature(NPC_AURIC, 60.0f, true)) + { + c->SetWalk(true); + if (c->GetCreatureData()) + c->GetMotionMaster()->MovePoint(0, c->GetCreatureData()->posX, c->GetCreatureData()->posY, c->GetCreatureData()->posZ); + } + break; + } + } + }; }; @@ -710,11 +710,11 @@ public: void AddSC_isle_of_queldanas() { - // OUR: - new npc_bh_thalorien_dawnseeker(); - new spell_bh_cleanse_quel_delar(); - new npc_grand_magister_rommath(); + // OUR: + new npc_bh_thalorien_dawnseeker(); + new spell_bh_cleanse_quel_delar(); + new npc_grand_magister_rommath(); - // THEIR: + // THEIR: new npc_greengill_slave(); } diff --git a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp index ca1076777..ac5f9a30b 100644 --- a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp @@ -53,7 +53,7 @@ public: phase = 0; mockingBlowTimer = 5000; shieldBashTimer = 8000; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); } void sQuestAccept(Player* player, Quest const* quest) @@ -62,8 +62,8 @@ public: { Talk(SAY_CORPORAL_1, player); npc_escortAI::Start(true, false, player->GetGUID(), quest); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->setFaction(250); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->setFaction(250); } } diff --git a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp index b20dbcd2d..bfbaa16b5 100644 --- a/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp @@ -343,7 +343,7 @@ public: case 6: Talk(SAY_LESCOVAR_4); if (Player* player = GetPlayerForEscort()) - player->GroupEventHappens(QUEST_THE_ATTACK, me); + player->GroupEventHappens(QUEST_THE_ATTACK, me); uiTimer = 2000; uiPhase = 7; break; diff --git a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp index 0376e1f1a..e23e40599 100644 --- a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp @@ -98,8 +98,8 @@ public: void DamageTaken(Unit* pDoneBy, uint32 &uiDamage, DamageEffectType, SpellSchoolMask) { - if (!pDoneBy) - return; + if (!pDoneBy) + return; if (uiDamage >= me->GetHealth() || me->HealthBelowPctDamaged(15, uiDamage)) { diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index 7b245569a..a082ccb80 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -149,9 +149,9 @@ public: { if (summoned->GetEntry() == NPC_HIGHBORNE_BUNNY) { - summoned->SetDisableGravity(true); - float speed = summoned->GetDistance(summoned->GetPositionX(), summoned->GetPositionY(), me->GetPositionZ()+15.0f) / (1000.0f * 0.001f); - summoned->MonsterMoveWithSpeed(summoned->GetPositionX(), summoned->GetPositionY(), me->GetPositionZ()+15.0f, speed); + summoned->SetDisableGravity(true); + float speed = summoned->GetDistance(summoned->GetPositionX(), summoned->GetPositionY(), me->GetPositionZ()+15.0f) / (1000.0f * 0.001f); + summoned->MonsterMoveWithSpeed(summoned->GetPositionX(), summoned->GetPositionY(), me->GetPositionZ()+15.0f, speed); summoned->CastSpell(summoned, SPELL_RIBBON_OF_SOULS, false); } } diff --git a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp index 4a0e719db..d9d53cc14 100644 --- a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp @@ -114,7 +114,7 @@ public: enum Myranda { - QUEST_FIND_MYRANDA = 5861, + QUEST_FIND_MYRANDA = 5861, QUEST_SUBTERFUGE = 5862, QUEST_IN_DREAMS = 5944, SPELL_SCARLET_ILLUSION = 17961 diff --git a/src/server/scripts/EasternKingdoms/zone_westfall.cpp b/src/server/scripts/EasternKingdoms/zone_westfall.cpp index 9563721cb..86f9ba964 100644 --- a/src/server/scripts/EasternKingdoms/zone_westfall.cpp +++ b/src/server/scripts/EasternKingdoms/zone_westfall.cpp @@ -85,23 +85,23 @@ public: { npc_daphne_stilwellAI(Creature* creature) : npc_escortAI(creature), summons(me) { } - SummonList summons; - uint8 textCounter; + SummonList summons; + uint8 textCounter; void Reset() { - summons.DespawnAll(); - textCounter = SAY_DS_DOWN_1; + summons.DespawnAll(); + textCounter = SAY_DS_DOWN_1; } void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); if (!player) - { - me->DespawnOrUnsummon(1); + { + me->DespawnOrUnsummon(1); return; - } + } switch (waypointId) { @@ -128,7 +128,7 @@ public: me->SummonCreature(NPC_DEFIAS_RAIDER, -11440.96f, 1599.69f, 66.35f, 4.09f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); me->SummonCreature(NPC_DEFIAS_RAIDER, -11433.44f, 1594.24f, 66.99f, 4.05f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); me->SummonCreature(NPC_DEFIAS_RAIDER, -11428.29f, 1598.37f, 70.90f, 3.9f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11438.14f, 1607.6f, 70.94f, 4.38f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11438.14f, 1607.6f, 70.94f, 4.38f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; case 10: SetRun(false); @@ -142,10 +142,10 @@ public: me->HandleEmoteCommand(EMOTE_STATE_USE_STANDING_NO_SHEATHE); break; case 17: - SetEscortPaused(true); + SetEscortPaused(true); player->GroupEventHappens(QUEST_TOME_VALOR, me); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - me->DespawnOrUnsummon(60000); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + me->DespawnOrUnsummon(60000); break; } } @@ -161,20 +161,20 @@ public: void JustSummoned(Creature* creature) { - creature->SetHomePosition(me->GetHomePosition()); - creature->GetMotionMaster()->MoveChase(me); - creature->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - creature->AI()->AttackStart(me); - creature->AddThreat(me, 0.0f); - summons.Summon(creature); + creature->SetHomePosition(me->GetHomePosition()); + creature->GetMotionMaster()->MoveChase(me); + creature->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + creature->AI()->AttackStart(me); + creature->AddThreat(me, 0.0f); + summons.Summon(creature); } - void SummonedCreatureDies(Creature* creature, Unit*) - { - summons.Despawn(creature); - if (summons.empty()) - Talk(textCounter++, GetPlayerForEscort()); - } + void SummonedCreatureDies(Creature* creature, Unit*) + { + summons.Despawn(creature); + if (summons.empty()) + Talk(textCounter++, GetPlayerForEscort()); + } void Update(const uint32 diff) { @@ -183,17 +183,17 @@ public: if (!UpdateVictim()) return; - if (me->isAttackReady(BASE_ATTACK)) - { + if (me->isAttackReady(BASE_ATTACK)) + { if (!me->IsWithinDist(me->GetVictim(), ATTACK_DISTANCE)) DoCastVictim(SPELL_SHOOT, true); - else - { - me->SetSheath(SHEATH_STATE_MELEE); - me->AttackerStateUpdate(me->GetVictim()); - } + else + { + me->SetSheath(SHEATH_STATE_MELEE); + me->AttackerStateUpdate(me->GetVictim()); + } - me->resetAttackTimer(); + me->resetAttackTimer(); } } }; diff --git a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp index 2a8272d7f..55a802bd0 100644 --- a/src/server/scripts/EasternKingdoms/zone_wetlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_wetlands.cpp @@ -86,7 +86,7 @@ public: { if (HasEscortState(STATE_ESCORT_ESCORTING) && !IsFriendSummoned && GetPlayerForEscort()) { - me->CastSpell(me, SPELL_CALL_FRIENDS, true); + me->CastSpell(me, SPELL_CALL_FRIENDS, true); IsFriendSummoned = true; } } diff --git a/src/server/scripts/Events/brewfest.cpp b/src/server/scripts/Events/brewfest.cpp index fd04d8125..1489df864 100644 --- a/src/server/scripts/Events/brewfest.cpp +++ b/src/server/scripts/Events/brewfest.cpp @@ -45,38 +45,38 @@ public: enum corenDirebrew { - FACTION_HOSTILE = 754, - FACTION_FRIEND = 35, - ITEM_DARK_BREW = 36748, - ITEM_TREASURE_CHEST = 54535, - QUEST_COREN_DIREBREW = 25483, - ACTION_START_FIGHT = 1, - ACTION_RELEASE_LOOT = 2, + FACTION_HOSTILE = 754, + FACTION_FRIEND = 35, + ITEM_DARK_BREW = 36748, + ITEM_TREASURE_CHEST = 54535, + QUEST_COREN_DIREBREW = 25483, + ACTION_START_FIGHT = 1, + ACTION_RELEASE_LOOT = 2, - NPC_ILSA_DIREBREW = 26764, - NPC_URSULA_DIREBREW = 26822, - NPC_ANTAGONIST = 23795, + NPC_ILSA_DIREBREW = 26764, + NPC_URSULA_DIREBREW = 26822, + NPC_ANTAGONIST = 23795, - // COREN - SPELL_DIREBREW_DISARM = 47310, - SPELL_DISARM_VISUAL = 47407, + // COREN + SPELL_DIREBREW_DISARM = 47310, + SPELL_DISARM_VISUAL = 47407, - // SISTERS - SPELL_BARRELED = 51413, - SPELL_CHUCK_MUG = 50276, - SPELL_DARK_STUN = 47340, - SPELL_PURPLE_VISUAL = 47651, + // SISTERS + SPELL_BARRELED = 51413, + SPELL_CHUCK_MUG = 50276, + SPELL_DARK_STUN = 47340, + SPELL_PURPLE_VISUAL = 47651, - EVENT_DIREBREW_DISARM = 1, - EVENT_DIREBREW_HEALTH = 2, - EVENT_SISTERS_BARREL = 3, - EVENT_SISTERS_CHUCK_MUG = 4, - EVENT_DIREBREW_RESPAWN1 = 5, - EVENT_DIREBREW_RESPAWN2 = 6, + EVENT_DIREBREW_DISARM = 1, + EVENT_DIREBREW_HEALTH = 2, + EVENT_SISTERS_BARREL = 3, + EVENT_SISTERS_CHUCK_MUG = 4, + EVENT_DIREBREW_RESPAWN1 = 5, + EVENT_DIREBREW_RESPAWN2 = 6, }; -#define GOSSIP_ITEM_COREN1 "Insult Coren Direbrew's Brew." -#define GOSSIP_ITEM_COREN2 "Insult." +#define GOSSIP_ITEM_COREN1 "Insult Coren Direbrew's Brew." +#define GOSSIP_ITEM_COREN2 "Insult." class npc_coren_direbrew : public CreatureScript { @@ -88,7 +88,7 @@ public: return new npc_coren_direbrewAI (creature); } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) { player->PlayerTalkClass->ClearMenus(); switch (uiAction) @@ -97,22 +97,22 @@ public: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_COREN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(15859, creature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+2: - player->CLOSE_GOSSIP_MENU(); - creature->AI()->DoAction(ACTION_START_FIGHT); - creature->MonsterSay("You'll pay for this insult, $C.", LANG_UNIVERSAL, player); - break; - } + case GOSSIP_ACTION_INFO_DEF+2: + player->CLOSE_GOSSIP_MENU(); + creature->AI()->DoAction(ACTION_START_FIGHT); + creature->MonsterSay("You'll pay for this insult, $C.", LANG_UNIVERSAL, player); + break; + } return true; } bool OnGossipHello(Player* player, Creature* creature) { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + if (creature->IsQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_COREN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(15858, creature->GetGUID()); + player->SEND_GOSSIP_MENU(15858, creature->GetGUID()); return true; } @@ -120,126 +120,126 @@ public: struct npc_coren_direbrewAI : public ScriptedAI { npc_coren_direbrewAI(Creature* c) : ScriptedAI(c), summons(me) - { - } + { + } - EventMap events; - SummonList summons; - uint8 phase; + EventMap events; + SummonList summons; + uint8 phase; void Reset() { - events.Reset(); - summons.DespawnAll(); - me->setFaction(FACTION_FRIEND); - phase = 0; + events.Reset(); + summons.DespawnAll(); + me->setFaction(FACTION_FRIEND); + phase = 0; } - void DoAction(int32 param) - { - if (param == ACTION_START_FIGHT) - { - Creature* cr = NULL; - - for (int i = 0; i < 3; ++i) - { - float o = rand_norm()*2*M_PI; - if (cr = me->SummonCreature(NPC_ANTAGONIST, me->GetPositionX()+3*cos(o), me->GetPositionY()+3*sin(o), me->GetPositionZ(), me->GetOrientation())) - { - if (i == 0) - cr->MonsterSay("Time to die.", LANG_UNIVERSAL, 0); + void DoAction(int32 param) + { + if (param == ACTION_START_FIGHT) + { + Creature* cr = NULL; + + for (int i = 0; i < 3; ++i) + { + float o = rand_norm()*2*M_PI; + if (cr = me->SummonCreature(NPC_ANTAGONIST, me->GetPositionX()+3*cos(o), me->GetPositionY()+3*sin(o), me->GetPositionZ(), me->GetOrientation())) + { + if (i == 0) + cr->MonsterSay("Time to die.", LANG_UNIVERSAL, 0); - summons.Summon(cr); - cr->SetInCombatWithZone(); - } - } + summons.Summon(cr); + cr->SetInCombatWithZone(); + } + } - me->CastSpell(me, SPELL_PURPLE_VISUAL , true); - me->setFaction(FACTION_HOSTILE); - me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_DIREBREW_DISARM, 10000); - events.ScheduleEvent(EVENT_DIREBREW_HEALTH, 1000); - } - else if (param == NPC_ILSA_DIREBREW) - events.ScheduleEvent(EVENT_DIREBREW_RESPAWN1, 10000); - else if (param == NPC_URSULA_DIREBREW) - events.ScheduleEvent(EVENT_DIREBREW_RESPAWN2, 10000); - } + me->CastSpell(me, SPELL_PURPLE_VISUAL , true); + me->setFaction(FACTION_HOSTILE); + me->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_DIREBREW_DISARM, 10000); + events.ScheduleEvent(EVENT_DIREBREW_HEALTH, 1000); + } + else if (param == NPC_ILSA_DIREBREW) + events.ScheduleEvent(EVENT_DIREBREW_RESPAWN1, 10000); + else if (param == NPC_URSULA_DIREBREW) + events.ScheduleEvent(EVENT_DIREBREW_RESPAWN2, 10000); + } - void JustDied(Unit* killer) - { - summons.DespawnAll(); - summons.DoAction(ACTION_RELEASE_LOOT); + void JustDied(Unit* killer) + { + summons.DespawnAll(); + summons.DoAction(ACTION_RELEASE_LOOT); - // HACK FIX FOR TREASURE CHEST - Quest const* qReward = sObjectMgr->GetQuestTemplate(QUEST_COREN_DIREBREW); - if (!qReward) - return; + // HACK FIX FOR TREASURE CHEST + Quest const* qReward = sObjectMgr->GetQuestTemplate(QUEST_COREN_DIREBREW); + if (!qReward) + return; - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (Player* player = itr->GetSource()) - { - if (player->CanRewardQuest(qReward, false)) - player->RewardQuest(qReward, 0, NULL, false); - } + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if (Player* player = itr->GetSource()) + { + if (player->CanRewardQuest(qReward, false)) + player->RewardQuest(qReward, 0, NULL, false); + } - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (!players.isEmpty() && players.begin()->GetSource()->GetGroup()) - sLFGMgr->FinishDungeon(players.begin()->GetSource()->GetGroup()->GetGUID(), 287, me->FindMap()); - } + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (!players.isEmpty() && players.begin()->GetSource()->GetGroup()) + sLFGMgr->FinishDungeon(players.begin()->GetSource()->GetGroup()->GetGUID(), 287, me->FindMap()); + } - void SummonSister(uint32 entry) - { - summons.DespawnEntry(entry); - float o = rand_norm()*2*M_PI; - if (Creature* cr = me->SummonCreature(entry, me->GetPositionX()+3*cos(o), me->GetPositionY()+3*sin(o), me->GetPositionZ(), me->GetOrientation())) - { - cr->CastSpell(cr, SPELL_PURPLE_VISUAL , true); - cr->SetInCombatWithZone(); - summons.Summon(cr); - } - } + void SummonSister(uint32 entry) + { + summons.DespawnEntry(entry); + float o = rand_norm()*2*M_PI; + if (Creature* cr = me->SummonCreature(entry, me->GetPositionX()+3*cos(o), me->GetPositionY()+3*sin(o), me->GetPositionZ(), me->GetOrientation())) + { + cr->CastSpell(cr, SPELL_PURPLE_VISUAL , true); + cr->SetInCombatWithZone(); + summons.Summon(cr); + } + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_DIREBREW_RESPAWN1: - SummonSister(NPC_ILSA_DIREBREW); - events.PopEvent(); - break; - case EVENT_DIREBREW_RESPAWN2: - SummonSister(NPC_URSULA_DIREBREW); - events.PopEvent(); - break; - case EVENT_DIREBREW_DISARM: - me->CastSpell(me->GetVictim(), SPELL_DIREBREW_DISARM, false); - me->CastSpell(me, SPELL_DISARM_VISUAL, true); - events.RepeatEvent(20000); - break; - case EVENT_DIREBREW_HEALTH: - if (me->GetHealthPct() < 66 && phase == 0) - { - phase++; - SummonSister(NPC_ILSA_DIREBREW); - } - if (me->GetHealthPct() < 35 && phase == 1) - { - events.PopEvent(); - SummonSister(NPC_URSULA_DIREBREW); - return; - } + switch (events.GetEvent()) + { + case EVENT_DIREBREW_RESPAWN1: + SummonSister(NPC_ILSA_DIREBREW); + events.PopEvent(); + break; + case EVENT_DIREBREW_RESPAWN2: + SummonSister(NPC_URSULA_DIREBREW); + events.PopEvent(); + break; + case EVENT_DIREBREW_DISARM: + me->CastSpell(me->GetVictim(), SPELL_DIREBREW_DISARM, false); + me->CastSpell(me, SPELL_DISARM_VISUAL, true); + events.RepeatEvent(20000); + break; + case EVENT_DIREBREW_HEALTH: + if (me->GetHealthPct() < 66 && phase == 0) + { + phase++; + SummonSister(NPC_ILSA_DIREBREW); + } + if (me->GetHealthPct() < 35 && phase == 1) + { + events.PopEvent(); + SummonSister(NPC_URSULA_DIREBREW); + return; + } - events.RepeatEvent(1000); - break; - } + events.RepeatEvent(1000); + break; + } DoMeleeAttackIfReady(); } @@ -259,93 +259,93 @@ public: struct npc_coren_direbrew_sistersAI : public ScriptedAI { npc_coren_direbrew_sistersAI(Creature* c) : ScriptedAI(c) - { - } + { + } - EventMap events; + EventMap events; void Reset() { - events.Reset(); - me->setFaction(FACTION_HOSTILE); + events.Reset(); + me->setFaction(FACTION_HOSTILE); } - void DoAction(int32 param) - { - if (param == ACTION_RELEASE_LOOT && me->GetEntry() == NPC_ILSA_DIREBREW) - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } + void DoAction(int32 param) + { + if (param == ACTION_RELEASE_LOOT && me->GetEntry() == NPC_ILSA_DIREBREW) + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } - Creature* GetSummoner() - { - if (me->IsSummon()) - if (Unit* coren = me->ToTempSummon()->GetSummoner()) - return coren->ToCreature(); + Creature* GetSummoner() + { + if (me->IsSummon()) + if (Unit* coren = me->ToTempSummon()->GetSummoner()) + return coren->ToCreature(); - return NULL; - } + return NULL; + } - void JustDied(Unit*) - { - if (Creature* coren = GetSummoner()) - { - if (coren->IsAlive()) - { - coren->AI()->DoAction(me->GetEntry()); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - } - } - + void JustDied(Unit*) + { + if (Creature* coren = GetSummoner()) + { + if (coren->IsAlive()) + { + coren->AI()->DoAction(me->GetEntry()); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } + } + } + - void EnterCombat(Unit* who) - { - if (me->GetEntry() == NPC_URSULA_DIREBREW) - events.ScheduleEvent(EVENT_SISTERS_BARREL, 18000); + void EnterCombat(Unit* who) + { + if (me->GetEntry() == NPC_URSULA_DIREBREW) + events.ScheduleEvent(EVENT_SISTERS_BARREL, 18000); - events.ScheduleEvent(EVENT_SISTERS_CHUCK_MUG, 12000); - } + events.ScheduleEvent(EVENT_SISTERS_CHUCK_MUG, 12000); + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_CHUCK_MUG) - if (target->ToPlayer()) - target->ToPlayer()->AddItem(ITEM_DARK_BREW, 1); - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_CHUCK_MUG) + if (target->ToPlayer()) + target->ToPlayer()->AddItem(ITEM_DARK_BREW, 1); + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SISTERS_BARREL: - me->CastSpell(me->GetVictim(), SPELL_BARRELED, false); - events.RepeatEvent(15000); - break; - case EVENT_SISTERS_CHUCK_MUG: - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - if (Player* player = itr->GetSource()) - if (player->HasItemCount(ITEM_DARK_BREW)) - { - me->CastSpell(player, SPELL_DARK_STUN, true); - player->DestroyItemCount(ITEM_DARK_BREW, 1, true); - } - } + switch (events.GetEvent()) + { + case EVENT_SISTERS_BARREL: + me->CastSpell(me->GetVictim(), SPELL_BARRELED, false); + events.RepeatEvent(15000); + break; + case EVENT_SISTERS_CHUCK_MUG: + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + if (Player* player = itr->GetSource()) + if (player->HasItemCount(ITEM_DARK_BREW)) + { + me->CastSpell(player, SPELL_DARK_STUN, true); + player->DestroyItemCount(ITEM_DARK_BREW, 1, true); + } + } - if (Player* player = SelectTargetFromPlayerList(50.0f, SPELL_DARK_STUN)) - me->CastSpell(player, SPELL_CHUCK_MUG, false); + if (Player* player = SelectTargetFromPlayerList(50.0f, SPELL_DARK_STUN)) + me->CastSpell(player, SPELL_CHUCK_MUG, false); - events.RepeatEvent(18000); - break; - } + events.RepeatEvent(18000); + break; + } DoMeleeAttackIfReady(); } @@ -355,19 +355,19 @@ public: enum kegThrowers { - QUEST_THERE_AND_BACK_AGAIN_A = 11122, - QUEST_THERE_AND_BACK_AGAIN_H = 11412, - RAM_DISPLAY_ID = 22630, - NPC_FLYNN_FIREBREW = 24364, - NPC_BOK_DROPCERTAIN = 24527, - ITEM_PORTABLE_BREWFEST_KEG = 33797, - SPELL_THROW_KEG = 43660, - SPELL_RAM_AURA = 43883, - SPELL_ADD_TOKENS = 44501, - SPELL_COOLDOWN_CHECKER = 43755, - NPC_RAM_MASTER_RAY = 24497, - NPC_NEILL_RAMSTEIN = 23558, - KEG_KILL_CREDIT = 24337, + QUEST_THERE_AND_BACK_AGAIN_A = 11122, + QUEST_THERE_AND_BACK_AGAIN_H = 11412, + RAM_DISPLAY_ID = 22630, + NPC_FLYNN_FIREBREW = 24364, + NPC_BOK_DROPCERTAIN = 24527, + ITEM_PORTABLE_BREWFEST_KEG = 33797, + SPELL_THROW_KEG = 43660, + SPELL_RAM_AURA = 43883, + SPELL_ADD_TOKENS = 44501, + SPELL_COOLDOWN_CHECKER = 43755, + NPC_RAM_MASTER_RAY = 24497, + NPC_NEILL_RAMSTEIN = 23558, + KEG_KILL_CREDIT = 24337, }; class npc_brewfest_keg_thrower : public CreatureScript @@ -382,21 +382,21 @@ class npc_brewfest_keg_thrower : public CreatureScript } void MoveInLineOfSight(Unit* who) - { - if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID) - { - if (!who->ToPlayer()->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg - me->CastSpell(who, SPELL_THROW_KEG, true); // throw keg - } - } + { + if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID) + { + if (!who->ToPlayer()->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg + me->CastSpell(who, SPELL_THROW_KEG, true); // throw keg + } + } - bool CanBeSeen(const Player* player) - { - if (player->GetMountID() == RAM_DISPLAY_ID) - return true; + bool CanBeSeen(const Player* player) + { + if (player->GetMountID() == RAM_DISPLAY_ID) + return true; - return false; - } + return false; + } }; CreatureAI* GetAI(Creature* creature) const @@ -417,33 +417,33 @@ class npc_brewfest_keg_reciver : public CreatureScript } void MoveInLineOfSight(Unit* who) - { - if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID) - { - Player* player = who->ToPlayer(); - if (player->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg - { - player->KilledMonsterCredit(KEG_KILL_CREDIT, 0); - player->CastSpell(me, SPELL_THROW_KEG, true); // throw keg - player->DestroyItemCount(ITEM_PORTABLE_BREWFEST_KEG, 1, true); + { + if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID) + { + Player* player = who->ToPlayer(); + if (player->HasItemCount(ITEM_PORTABLE_BREWFEST_KEG)) // portable brewfest keg + { + player->KilledMonsterCredit(KEG_KILL_CREDIT, 0); + player->CastSpell(me, SPELL_THROW_KEG, true); // throw keg + player->DestroyItemCount(ITEM_PORTABLE_BREWFEST_KEG, 1, true); - // Additional Work - uint32 spellCooldown = player->GetSpellCooldownDelay(SPELL_COOLDOWN_CHECKER)/IN_MILLISECONDS; - if (spellCooldown > (HOUR*18 - 900)) // max aproximated time - 12 minutes - { - if (Aura* aur = player->GetAura(SPELL_RAM_AURA)) - { - int32 diff = aur->GetApplyTime() - (time(NULL)-(HOUR*18)+spellCooldown); - if (diff > 10) // aura applied later - return; + // Additional Work + uint32 spellCooldown = player->GetSpellCooldownDelay(SPELL_COOLDOWN_CHECKER)/IN_MILLISECONDS; + if (spellCooldown > (HOUR*18 - 900)) // max aproximated time - 12 minutes + { + if (Aura* aur = player->GetAura(SPELL_RAM_AURA)) + { + int32 diff = aur->GetApplyTime() - (time(NULL)-(HOUR*18)+spellCooldown); + if (diff > 10) // aura applied later + return; - aur->SetDuration(aur->GetDuration()+30000); - player->CastSpell(player, SPELL_ADD_TOKENS, true); - } - } - } - } - } + aur->SetDuration(aur->GetDuration()+30000); + player->CastSpell(player, SPELL_ADD_TOKENS, true); + } + } + } + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -451,39 +451,39 @@ class npc_brewfest_keg_reciver : public CreatureScript return new npc_brewfest_keg_reciverAI(creature); } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) { switch (uiAction) { case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); - player->AddSpellCooldown(SPELL_COOLDOWN_CHECKER, 0, 18*HOUR*IN_MILLISECONDS); - player->CastSpell(player, 43883, true); - player->CastSpell(player, 44262, true); + player->AddSpellCooldown(SPELL_COOLDOWN_CHECKER, 0, 18*HOUR*IN_MILLISECONDS); + player->CastSpell(player, 43883, true); + player->CastSpell(player, 44262, true); break; - } + } return true; } bool OnGossipHello(Player* player, Creature* creature) { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + if (creature->IsQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); - if (!player->HasSpellCooldown(SPELL_COOLDOWN_CHECKER) && player->GetQuestRewardStatus(player->GetTeamId() == TEAM_ALLIANCE ? QUEST_THERE_AND_BACK_AGAIN_A : QUEST_THERE_AND_BACK_AGAIN_H)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Do you have additional work?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - player->SEND_GOSSIP_MENU((creature->GetEntry() == NPC_NEILL_RAMSTEIN ? 8934 : 8976), creature->GetGUID()); + if (!player->HasSpellCooldown(SPELL_COOLDOWN_CHECKER) && player->GetQuestRewardStatus(player->GetTeamId() == TEAM_ALLIANCE ? QUEST_THERE_AND_BACK_AGAIN_A : QUEST_THERE_AND_BACK_AGAIN_H)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Do you have additional work?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + player->SEND_GOSSIP_MENU((creature->GetEntry() == NPC_NEILL_RAMSTEIN ? 8934 : 8976), creature->GetGUID()); return true; } }; enum barkTrigger { - QUEST_BARK_FOR_DROHN = 11407, - QUEST_BARK_FOR_VOODOO = 11408, - QUEST_BARK_FOR_BARLEY = 11293, - QUEST_BARK_FOR_THUNDERBREW = 11294, + QUEST_BARK_FOR_DROHN = 11407, + QUEST_BARK_FOR_VOODOO = 11408, + QUEST_BARK_FOR_BARLEY = 11293, + QUEST_BARK_FOR_THUNDERBREW = 11294, }; class npc_brewfest_bark_trigger : public CreatureScript @@ -498,105 +498,105 @@ class npc_brewfest_bark_trigger : public CreatureScript } void MoveInLineOfSight(Unit* who) - { - if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID) - { - bool allow = false; - uint32 quest = 0; - Player* player = who->ToPlayer(); - // Kalimdor - if (me->GetMapId() == 1) - { - if (player->GetQuestStatus(QUEST_BARK_FOR_DROHN) == QUEST_STATUS_INCOMPLETE) - { - allow = true; - quest = QUEST_BARK_FOR_DROHN; - } - else if (player->GetQuestStatus(QUEST_BARK_FOR_VOODOO) == QUEST_STATUS_INCOMPLETE) - { - allow = true; - quest = QUEST_BARK_FOR_VOODOO; - } - } - else if (me->GetMapId() == 0) - { - if (player->GetQuestStatus(QUEST_BARK_FOR_BARLEY) == QUEST_STATUS_INCOMPLETE) - { - allow = true; - quest = QUEST_BARK_FOR_BARLEY; - } - else if (player->GetQuestStatus(QUEST_BARK_FOR_THUNDERBREW) == QUEST_STATUS_INCOMPLETE) - { - allow = true; - quest = QUEST_BARK_FOR_THUNDERBREW; - } - } + { + if (me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->GetMountID() == RAM_DISPLAY_ID) + { + bool allow = false; + uint32 quest = 0; + Player* player = who->ToPlayer(); + // Kalimdor + if (me->GetMapId() == 1) + { + if (player->GetQuestStatus(QUEST_BARK_FOR_DROHN) == QUEST_STATUS_INCOMPLETE) + { + allow = true; + quest = QUEST_BARK_FOR_DROHN; + } + else if (player->GetQuestStatus(QUEST_BARK_FOR_VOODOO) == QUEST_STATUS_INCOMPLETE) + { + allow = true; + quest = QUEST_BARK_FOR_VOODOO; + } + } + else if (me->GetMapId() == 0) + { + if (player->GetQuestStatus(QUEST_BARK_FOR_BARLEY) == QUEST_STATUS_INCOMPLETE) + { + allow = true; + quest = QUEST_BARK_FOR_BARLEY; + } + else if (player->GetQuestStatus(QUEST_BARK_FOR_THUNDERBREW) == QUEST_STATUS_INCOMPLETE) + { + allow = true; + quest = QUEST_BARK_FOR_THUNDERBREW; + } + } - if (allow) - { - QuestStatusMap::iterator itr = player->getQuestStatusMap().find(quest); - if (itr == player->getQuestStatusMap().end()) - return; + if (allow) + { + QuestStatusMap::iterator itr = player->getQuestStatusMap().find(quest); + if (itr == player->getQuestStatusMap().end()) + return; - QuestStatusData &q_status = itr->second; - if (q_status.CreatureOrGOCount[me->GetEntry()-24202] == 0) - { - player->KilledMonsterCredit(me->GetEntry(), 0); - player->MonsterSay(GetTextFor(me->GetEntry(), quest).c_str(), LANG_UNIVERSAL, player); - } - } - } - } + QuestStatusData &q_status = itr->second; + if (q_status.CreatureOrGOCount[me->GetEntry()-24202] == 0) + { + player->KilledMonsterCredit(me->GetEntry(), 0); + player->MonsterSay(GetTextFor(me->GetEntry(), quest).c_str(), LANG_UNIVERSAL, player); + } + } + } + } - std::string GetTextFor(uint32 entry, uint32 questId) - { - std::string str = ""; - switch (questId) - { - case QUEST_BARK_FOR_DROHN: - case QUEST_BARK_FOR_VOODOO: - { - switch (urand(0,3)) - { - case 0: - str = "Join with your brothers and sisters at "+ std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +" and drink for the horde!"; - break; - case 1: - str = "If you think an orc can hit hard, check out their brew, it hits even harder! See for yourself at "+ std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +", only at Brewfest!"; - break; - case 2: - str = "Celebrate Brewfest with orcs that know what a good drink really is! Check out "+ std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +" at Brewfest!"; - break; - case 3: - str = std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +" knows how to party hard! Check them out at Brewfest!"; - break; - } - break; - } - case QUEST_BARK_FOR_BARLEY: - case QUEST_BARK_FOR_THUNDERBREW: - { - switch (urand(0,3)) - { - case 0: - str = "Join with your brothers and sisters at "+ std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +" and drink for the alliance!"; - break; - case 1: - str = "If you think an dwarf can hit hard, check out their brew, it hits even harder! See for yourself at "+ std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +", only at Brewfest!"; - break; - case 2: - str = "Celebrate Brewfest with dwarves that know what a good drink really is! Check out "+ std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +" at Brewfest!"; - break; - case 3: - str = std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +" knows how to party hard! Check them out at Brewfest!"; - break; - } - break; - } - } + std::string GetTextFor(uint32 entry, uint32 questId) + { + std::string str = ""; + switch (questId) + { + case QUEST_BARK_FOR_DROHN: + case QUEST_BARK_FOR_VOODOO: + { + switch (urand(0,3)) + { + case 0: + str = "Join with your brothers and sisters at "+ std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +" and drink for the horde!"; + break; + case 1: + str = "If you think an orc can hit hard, check out their brew, it hits even harder! See for yourself at "+ std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +", only at Brewfest!"; + break; + case 2: + str = "Celebrate Brewfest with orcs that know what a good drink really is! Check out "+ std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +" at Brewfest!"; + break; + case 3: + str = std::string(questId == QUEST_BARK_FOR_DROHN ? "Drohn's Distillery" : "T'chali's Voodoo Brewery") +" knows how to party hard! Check them out at Brewfest!"; + break; + } + break; + } + case QUEST_BARK_FOR_BARLEY: + case QUEST_BARK_FOR_THUNDERBREW: + { + switch (urand(0,3)) + { + case 0: + str = "Join with your brothers and sisters at "+ std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +" and drink for the alliance!"; + break; + case 1: + str = "If you think an dwarf can hit hard, check out their brew, it hits even harder! See for yourself at "+ std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +", only at Brewfest!"; + break; + case 2: + str = "Celebrate Brewfest with dwarves that know what a good drink really is! Check out "+ std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +" at Brewfest!"; + break; + case 3: + str = std::string(questId == QUEST_BARK_FOR_BARLEY ? "Barleybrews" : "Thunderbrews") +" knows how to party hard! Check them out at Brewfest!"; + break; + } + break; + } + } - return str; - } + return str; + } }; CreatureAI* GetAI(Creature* creature) const @@ -607,49 +607,49 @@ class npc_brewfest_bark_trigger : public CreatureScript enum darkIronAttack { - // Gos - GO_MOLE_MACHINE = 195305, + // Gos + GO_MOLE_MACHINE = 195305, - // Npcs - NPC_BARLEYBREW_KEG = 23700, - NPC_THUNDERBREW_KEG = 23702, - NPC_GORDOK_KEG = 23706, - NPC_VOODOO_KEG = 24373, - NPC_DROHN_KEG = 24372, - NPC_MOLE_MACHINE_TRIGGER = 23894, - NPC_DARK_IRON_GUZZLER = 23709, - NPC_NORMAL_DROHN = 24492, - NPC_NORMAL_VOODOO = 21349, - NPC_NORMAL_BARLEYBREW = 23683, - NPC_NORMAL_THUNDERBREW = 23684, - NPC_NORMAL_GORDOK = 23685, - NPC_EVENT_GENERATOR = 23703, - NPC_SUPER_BREW_TRIGGER = 23808, - NPC_DARK_IRON_HERALD = 24536, + // Npcs + NPC_BARLEYBREW_KEG = 23700, + NPC_THUNDERBREW_KEG = 23702, + NPC_GORDOK_KEG = 23706, + NPC_VOODOO_KEG = 24373, + NPC_DROHN_KEG = 24372, + NPC_MOLE_MACHINE_TRIGGER = 23894, + NPC_DARK_IRON_GUZZLER = 23709, + NPC_NORMAL_DROHN = 24492, + NPC_NORMAL_VOODOO = 21349, + NPC_NORMAL_BARLEYBREW = 23683, + NPC_NORMAL_THUNDERBREW = 23684, + NPC_NORMAL_GORDOK = 23685, + NPC_EVENT_GENERATOR = 23703, + NPC_SUPER_BREW_TRIGGER = 23808, + NPC_DARK_IRON_HERALD = 24536, - // Events - EVENT_CHECK_HOUR = 1, - EVENT_SPAWN_MOLE_MACHINE = 2, - EVENT_PRE_FINISH_ATTACK = 3, - EVENT_FINISH_ATTACK = 4, - EVENT_BARTENDER_SAY = 5, + // Events + EVENT_CHECK_HOUR = 1, + EVENT_SPAWN_MOLE_MACHINE = 2, + EVENT_PRE_FINISH_ATTACK = 3, + EVENT_FINISH_ATTACK = 4, + EVENT_BARTENDER_SAY = 5, - // Spells - SPELL_THROW_MUG_TO_PLAYER = 42300, - SPELL_ADD_MUG = 42518, - SPELL_SPAWN_MOLE_MACHINE = 43563, - SPELL_KEG_MARKER = 42761, - SPELL_PLAYER_MUG = 42436, - SPELL_REPORT_DEATH = 42655, - SPELL_CREATE_SUPER_BREW = 42715, - SPELL_DRUNKEN_MASTER = 42696, - SPELL_SUMMON_PLANS_A = 48145, - SPELL_SUMMON_PLANS_H = 49318, + // Spells + SPELL_THROW_MUG_TO_PLAYER = 42300, + SPELL_ADD_MUG = 42518, + SPELL_SPAWN_MOLE_MACHINE = 43563, + SPELL_KEG_MARKER = 42761, + SPELL_PLAYER_MUG = 42436, + SPELL_REPORT_DEATH = 42655, + SPELL_CREATE_SUPER_BREW = 42715, + SPELL_DRUNKEN_MASTER = 42696, + SPELL_SUMMON_PLANS_A = 48145, + SPELL_SUMMON_PLANS_H = 49318, - // Dark Irons - SPELL_ATTACK_KEG = 42393, - SPELL_KNOCKBACK_AURA = 42676, - SPELL_MUG_BOUNCE_BACK = 42522, + // Dark Irons + SPELL_ATTACK_KEG = 42393, + SPELL_KNOCKBACK_AURA = 42676, + SPELL_MUG_BOUNCE_BACK = 42522, }; class npc_dark_iron_attack_generator : public CreatureScript @@ -663,212 +663,212 @@ class npc_dark_iron_attack_generator : public CreatureScript { } - EventMap events; - SummonList summons; - uint32 kegCounter, guzzlerCounter; - uint8 thrown; + EventMap events; + SummonList summons; + uint32 kegCounter, guzzlerCounter; + uint8 thrown; - void Reset() - { - summons.DespawnAll(); - events.Reset(); - events.ScheduleEvent(EVENT_CHECK_HOUR, 2000); - kegCounter = 0; - guzzlerCounter = 0; - thrown = 0; - } + void Reset() + { + summons.DespawnAll(); + events.Reset(); + events.ScheduleEvent(EVENT_CHECK_HOUR, 2000); + kegCounter = 0; + guzzlerCounter = 0; + thrown = 0; + } - // DARK IRON ATTACK EVENT + // DARK IRON ATTACK EVENT void MoveInLineOfSight(Unit* who) {} - void EnterCombat(Unit*) {} + void EnterCombat(Unit*) {} - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_REPORT_DEATH) - { - if (caster->GetEntry() == NPC_DARK_IRON_GUZZLER) - guzzlerCounter++; - else - { - kegCounter++; - if (kegCounter == 3) - FinishEventDueToLoss(); - } - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_REPORT_DEATH) + { + if (caster->GetEntry() == NPC_DARK_IRON_GUZZLER) + guzzlerCounter++; + else + { + kegCounter++; + if (kegCounter == 3) + FinishEventDueToLoss(); + } + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_CHECK_HOUR: - { - // determine hour - if (AllowStart()) - { - PrepareEvent(); - events.RepeatEvent(300000); - return; - } - events.RepeatEvent(2000); - break; - } - case EVENT_SPAWN_MOLE_MACHINE: - { - if (me->GetMapId() == 1) // Kalimdor - { - float rand = 8+rand_norm()*12; - float angle = rand_norm()*2*M_PI; - float x = 1201.8f+rand*cos(angle); - float y = -4299.6f+rand*sin(angle); - if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 21.3f, 0.0f)) - cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true); - } - else if (me->GetMapId() == 0) // EK - { - float rand = rand_norm()*20; - float angle = rand_norm()*2*M_PI; - float x = -5157.1f+rand*cos(angle); - float y = -598.98f+rand*sin(angle); - if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 398.11f, 0.0f)) - cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true); - } - events.RepeatEvent(3000); - break; - } - case EVENT_PRE_FINISH_ATTACK: - { - events.CancelEvent(EVENT_SPAWN_MOLE_MACHINE); - events.ScheduleEvent(EVENT_FINISH_ATTACK, 20000); - events.PopEvent(); - break; - } - case EVENT_FINISH_ATTACK: - { - FinishAttackDueToWin(); - events.RescheduleEvent(EVENT_CHECK_HOUR, 60000); - break; - } - case EVENT_BARTENDER_SAY: - { - events.RepeatEvent(12000); - Creature* sayer = GetRandomBartender(); - if (!sayer) - return; + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_CHECK_HOUR: + { + // determine hour + if (AllowStart()) + { + PrepareEvent(); + events.RepeatEvent(300000); + return; + } + events.RepeatEvent(2000); + break; + } + case EVENT_SPAWN_MOLE_MACHINE: + { + if (me->GetMapId() == 1) // Kalimdor + { + float rand = 8+rand_norm()*12; + float angle = rand_norm()*2*M_PI; + float x = 1201.8f+rand*cos(angle); + float y = -4299.6f+rand*sin(angle); + if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 21.3f, 0.0f)) + cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true); + } + else if (me->GetMapId() == 0) // EK + { + float rand = rand_norm()*20; + float angle = rand_norm()*2*M_PI; + float x = -5157.1f+rand*cos(angle); + float y = -598.98f+rand*sin(angle); + if (Creature* cr = me->SummonCreature(NPC_MOLE_MACHINE_TRIGGER, x, y, 398.11f, 0.0f)) + cr->CastSpell(cr, SPELL_SPAWN_MOLE_MACHINE, true); + } + events.RepeatEvent(3000); + break; + } + case EVENT_PRE_FINISH_ATTACK: + { + events.CancelEvent(EVENT_SPAWN_MOLE_MACHINE); + events.ScheduleEvent(EVENT_FINISH_ATTACK, 20000); + events.PopEvent(); + break; + } + case EVENT_FINISH_ATTACK: + { + FinishAttackDueToWin(); + events.RescheduleEvent(EVENT_CHECK_HOUR, 60000); + break; + } + case EVENT_BARTENDER_SAY: + { + events.RepeatEvent(12000); + Creature* sayer = GetRandomBartender(); + if (!sayer) + return; - thrown++; - if (thrown == 3) - { - thrown = 0; - sayer->MonsterSay("SOMEONE TRY THIS SUPER BREW!", LANG_UNIVERSAL, 0); - //sayer->CastSpell(sayer, SPELL_CREATE_SUPER_BREW, true); - sayer->SummonCreature(NPC_SUPER_BREW_TRIGGER, sayer->GetPositionX()+15*cos(sayer->GetOrientation()), sayer->GetPositionY()+15*sin(sayer->GetOrientation()), sayer->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); - - } - else - { - if (urand(0,1)) - sayer->MonsterSay("Chug and chuck! Chug and chuck!", LANG_UNIVERSAL, 0); - else - sayer->MonsterSay("Down the free brew and pelt the Guzzlers with your mug!", LANG_UNIVERSAL, 0); - } - - break; - } - } - } + thrown++; + if (thrown == 3) + { + thrown = 0; + sayer->MonsterSay("SOMEONE TRY THIS SUPER BREW!", LANG_UNIVERSAL, 0); + //sayer->CastSpell(sayer, SPELL_CREATE_SUPER_BREW, true); + sayer->SummonCreature(NPC_SUPER_BREW_TRIGGER, sayer->GetPositionX()+15*cos(sayer->GetOrientation()), sayer->GetPositionY()+15*sin(sayer->GetOrientation()), sayer->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); + + } + else + { + if (urand(0,1)) + sayer->MonsterSay("Chug and chuck! Chug and chuck!", LANG_UNIVERSAL, 0); + else + sayer->MonsterSay("Down the free brew and pelt the Guzzlers with your mug!", LANG_UNIVERSAL, 0); + } + + break; + } + } + } - void FinishEventDueToLoss() - { - if (Creature* herald = me->FindNearestCreature(NPC_DARK_IRON_HERALD, 100.0f)) - { - char amount[500]; - sprintf(amount, "We did it boys! Now back to the Grim Guzzler and we'll drink to the %u that were injured!", guzzlerCounter); - herald->MonsterYell(amount, LANG_UNIVERSAL, 0); - } + void FinishEventDueToLoss() + { + if (Creature* herald = me->FindNearestCreature(NPC_DARK_IRON_HERALD, 100.0f)) + { + char amount[500]; + sprintf(amount, "We did it boys! Now back to the Grim Guzzler and we'll drink to the %u that were injured!", guzzlerCounter); + herald->MonsterYell(amount, LANG_UNIVERSAL, 0); + } - Reset(); - events.RescheduleEvent(EVENT_CHECK_HOUR, 60000); - } + Reset(); + events.RescheduleEvent(EVENT_CHECK_HOUR, 60000); + } - void FinishAttackDueToWin() - { - if (Creature* herald = me->FindNearestCreature(NPC_DARK_IRON_HERALD, 100.0f)) - { - char amount[500]; - sprintf(amount, "RETREAT!! We've already lost %u and we can't afford to lose any more!!", guzzlerCounter); - herald->MonsterYell(amount, LANG_UNIVERSAL, 0); - } + void FinishAttackDueToWin() + { + if (Creature* herald = me->FindNearestCreature(NPC_DARK_IRON_HERALD, 100.0f)) + { + char amount[500]; + sprintf(amount, "RETREAT!! We've already lost %u and we can't afford to lose any more!!", guzzlerCounter); + herald->MonsterYell(amount, LANG_UNIVERSAL, 0); + } - me->CastSpell(me, (me->GetMapId() == 1 ? SPELL_SUMMON_PLANS_H : SPELL_SUMMON_PLANS_A), true); - Reset(); - } + me->CastSpell(me, (me->GetMapId() == 1 ? SPELL_SUMMON_PLANS_H : SPELL_SUMMON_PLANS_A), true); + Reset(); + } - void PrepareEvent() - { - Creature* cr; - if (me->GetMapId() == 1) // Kalimdor - { - if (cr = me->SummonCreature(NPC_DROHN_KEG, 1183.69f, -4315.15f, 21.1875f, 0.750492f)) - summons.Summon(cr); - if (cr = me->SummonCreature(NPC_VOODOO_KEG, 1182.42f, -4272.45f, 21.1182f, -1.02974f)) - summons.Summon(cr); - if (cr = me->SummonCreature(NPC_GORDOK_KEG, 1223.78f, -4296.48f, 21.1707f, -2.86234f)) - summons.Summon(cr); - } - else if (me->GetMapId() == 0) // Eastern Kingdom - { - if (cr = me->SummonCreature(NPC_BARLEYBREW_KEG, -5187.23f, -599.779f, 397.176f, 0.017453f)) - summons.Summon(cr); - if (cr = me->SummonCreature(NPC_THUNDERBREW_KEG, -5160.05f, -632.632f, 397.178f, 1.39626f)) - summons.Summon(cr); - if (cr = me->SummonCreature(NPC_GORDOK_KEG, -5145.75f, -575.667f, 397.176f, -2.28638f)) - summons.Summon(cr); - } + void PrepareEvent() + { + Creature* cr; + if (me->GetMapId() == 1) // Kalimdor + { + if (cr = me->SummonCreature(NPC_DROHN_KEG, 1183.69f, -4315.15f, 21.1875f, 0.750492f)) + summons.Summon(cr); + if (cr = me->SummonCreature(NPC_VOODOO_KEG, 1182.42f, -4272.45f, 21.1182f, -1.02974f)) + summons.Summon(cr); + if (cr = me->SummonCreature(NPC_GORDOK_KEG, 1223.78f, -4296.48f, 21.1707f, -2.86234f)) + summons.Summon(cr); + } + else if (me->GetMapId() == 0) // Eastern Kingdom + { + if (cr = me->SummonCreature(NPC_BARLEYBREW_KEG, -5187.23f, -599.779f, 397.176f, 0.017453f)) + summons.Summon(cr); + if (cr = me->SummonCreature(NPC_THUNDERBREW_KEG, -5160.05f, -632.632f, 397.178f, 1.39626f)) + summons.Summon(cr); + if (cr = me->SummonCreature(NPC_GORDOK_KEG, -5145.75f, -575.667f, 397.176f, -2.28638f)) + summons.Summon(cr); + } - if (cr = me->SummonCreature(NPC_DARK_IRON_HERALD, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000)) - summons.Summon(cr); + if (cr = me->SummonCreature(NPC_DARK_IRON_HERALD, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000)) + summons.Summon(cr); - kegCounter = 0; - guzzlerCounter = 0; - thrown = 0; + kegCounter = 0; + guzzlerCounter = 0; + thrown = 0; - events.ScheduleEvent(EVENT_SPAWN_MOLE_MACHINE, 1500); - events.ScheduleEvent(EVENT_PRE_FINISH_ATTACK, 280000); - events.ScheduleEvent(EVENT_BARTENDER_SAY, 5000); - } + events.ScheduleEvent(EVENT_SPAWN_MOLE_MACHINE, 1500); + events.ScheduleEvent(EVENT_PRE_FINISH_ATTACK, 280000); + events.ScheduleEvent(EVENT_BARTENDER_SAY, 5000); + } - bool AllowStart() - { - time_t curtime = time(NULL); - tm strDate; - ACE_OS::localtime_r(&curtime, &strDate); + bool AllowStart() + { + time_t curtime = time(NULL); + tm strDate; + ACE_OS::localtime_r(&curtime, &strDate); - if (strDate.tm_min == 0 || strDate.tm_min == 30) - return true; + if (strDate.tm_min == 0 || strDate.tm_min == 30) + return true; - return false; - } + return false; + } - Creature* GetRandomBartender() - { - uint32 entry = 0; - switch (urand(0,2)) - { - case 0: - entry = (me->GetMapId() == 1 ? NPC_NORMAL_DROHN : NPC_NORMAL_THUNDERBREW); - break; - case 1: - entry = (me->GetMapId() == 1 ? NPC_NORMAL_VOODOO : NPC_NORMAL_BARLEYBREW); - break; - case 2: - entry = NPC_NORMAL_GORDOK; - break; - } + Creature* GetRandomBartender() + { + uint32 entry = 0; + switch (urand(0,2)) + { + case 0: + entry = (me->GetMapId() == 1 ? NPC_NORMAL_DROHN : NPC_NORMAL_THUNDERBREW); + break; + case 1: + entry = (me->GetMapId() == 1 ? NPC_NORMAL_VOODOO : NPC_NORMAL_BARLEYBREW); + break; + case 2: + entry = NPC_NORMAL_GORDOK; + break; + } - return me->FindNearestCreature(entry, 100.0f); - } + return me->FindNearestCreature(entry, 100.0f); + } }; CreatureAI* GetAI(Creature* creature) const @@ -888,50 +888,50 @@ class npc_dark_iron_attack_mole_machine : public CreatureScript { } - void EnterCombat(Unit*) {} - void MoveInLineOfSight(Unit*) {} - void AttackStart(Unit*) {} + void EnterCombat(Unit*) {} + void MoveInLineOfSight(Unit*) {} + void AttackStart(Unit*) {} - uint32 goTimer, summonTimer; - void Reset() - { - goTimer = 1; - summonTimer = 0; - } + uint32 goTimer, summonTimer; + void Reset() + { + goTimer = 1; + summonTimer = 0; + } - void UpdateAI(uint32 diff) - { - if (goTimer) - { - goTimer += diff; - if (goTimer >= 3000) - { - goTimer = 0; - summonTimer++; - if (GameObject* drill = me->SummonGameObject(GO_MOLE_MACHINE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), M_PI/4, 0.0f, 0.0f, 0.0f, 0.0f, 8)) - { - //drill->SetGoAnimProgress(0); - drill->SetLootState(GO_READY); - drill->UseDoorOrButton(8); - } - } - } - if (summonTimer) - { - summonTimer += diff; - if (summonTimer >= 2000 && summonTimer < 10000) - { - me->SummonCreature(NPC_DARK_IRON_GUZZLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); - summonTimer = 10000; - } - if (summonTimer >= 13000 && summonTimer < 20000) - { - me->SummonCreature(NPC_DARK_IRON_GUZZLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); - summonTimer = 0; - me->DespawnOrUnsummon(3000); - } - } - } + void UpdateAI(uint32 diff) + { + if (goTimer) + { + goTimer += diff; + if (goTimer >= 3000) + { + goTimer = 0; + summonTimer++; + if (GameObject* drill = me->SummonGameObject(GO_MOLE_MACHINE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), M_PI/4, 0.0f, 0.0f, 0.0f, 0.0f, 8)) + { + //drill->SetGoAnimProgress(0); + drill->SetLootState(GO_READY); + drill->UseDoorOrButton(8); + } + } + } + if (summonTimer) + { + summonTimer += diff; + if (summonTimer >= 2000 && summonTimer < 10000) + { + me->SummonCreature(NPC_DARK_IRON_GUZZLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); + summonTimer = 10000; + } + if (summonTimer >= 13000 && summonTimer < 20000) + { + me->SummonCreature(NPC_DARK_IRON_GUZZLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); + summonTimer = 0; + me->DespawnOrUnsummon(3000); + } + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -949,128 +949,128 @@ class npc_dark_iron_guzzler : public CreatureScript { npc_dark_iron_guzzlerAI(Creature* creature) : ScriptedAI(creature) { - me->SetReactState(REACT_PASSIVE); + me->SetReactState(REACT_PASSIVE); } - uint32 timer; - uint64 targetGUID; - void EnterCombat(Unit*) {} - void MoveInLineOfSight(Unit*) {} - void AttackStart(Unit*) {} + uint32 timer; + uint64 targetGUID; + void EnterCombat(Unit*) {} + void MoveInLineOfSight(Unit*) {} + void AttackStart(Unit*) {} - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - damage = 0; - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + damage = 0; + } - void FindNextKeg() - { - uint32 entry[3] = {0, 0, 0}; - uint32 shuffled[3] = {0, 0, 0}; + void FindNextKeg() + { + uint32 entry[3] = {0, 0, 0}; + uint32 shuffled[3] = {0, 0, 0}; - if (me->GetMapId() == 1) // Kalimdor - { - entry[0] = NPC_DROHN_KEG; - entry[1] = NPC_VOODOO_KEG; - entry[2] = NPC_GORDOK_KEG; - } - else// if (me->GetMapId() == 0) // EK - { - entry[0] = NPC_THUNDERBREW_KEG; - entry[1] = NPC_BARLEYBREW_KEG; - entry[2] = NPC_GORDOK_KEG; - } - - for (uint8 i = 0; i < 3; ++i) - { - uint8 index=0; - do - index = urand(0,2); - while (shuffled[index]); + if (me->GetMapId() == 1) // Kalimdor + { + entry[0] = NPC_DROHN_KEG; + entry[1] = NPC_VOODOO_KEG; + entry[2] = NPC_GORDOK_KEG; + } + else// if (me->GetMapId() == 0) // EK + { + entry[0] = NPC_THUNDERBREW_KEG; + entry[1] = NPC_BARLEYBREW_KEG; + entry[2] = NPC_GORDOK_KEG; + } + + for (uint8 i = 0; i < 3; ++i) + { + uint8 index=0; + do + index = urand(0,2); + while (shuffled[index]); - shuffled[index] = entry[i]; - } + shuffled[index] = entry[i]; + } - for (uint8 i = 0; i < 3; ++i) - if (Creature* cr = me->FindNearestCreature(shuffled[i], 100.0f)) - { - me->GetMotionMaster()->MoveFollow(cr, 1.0f, cr->GetAngle(me)); - targetGUID = cr->GetGUID(); - return; - } + for (uint8 i = 0; i < 3; ++i) + if (Creature* cr = me->FindNearestCreature(shuffled[i], 100.0f)) + { + me->GetMotionMaster()->MoveFollow(cr, 1.0f, cr->GetAngle(me)); + targetGUID = cr->GetGUID(); + return; + } - // no kegs found - me->DisappearAndDie(); - } + // no kegs found + me->DisappearAndDie(); + } - Unit* GetTarget() { return ObjectAccessor::GetUnit(*me, targetGUID); } + Unit* GetTarget() { return ObjectAccessor::GetUnit(*me, targetGUID); } - void Reset() - { - timer = 0; - targetGUID = 0; - me->SetWalk(true); - FindNextKeg(); - me->ApplySpellImmune(SPELL_ATTACK_KEG, IMMUNITY_ID, SPELL_ATTACK_KEG, true); - SayText(); - me->CastSpell(me, SPELL_KNOCKBACK_AURA, true); - } + void Reset() + { + timer = 0; + targetGUID = 0; + me->SetWalk(true); + FindNextKeg(); + me->ApplySpellImmune(SPELL_ATTACK_KEG, IMMUNITY_ID, SPELL_ATTACK_KEG, true); + SayText(); + me->CastSpell(me, SPELL_KNOCKBACK_AURA, true); + } - void SayText() - { - if (!urand(0,20)) - { - switch (urand(0,4)) - { - case 0: - me->MonsterSay("Drink it all boys!", LANG_UNIVERSAL, 0); - break; - case 1: - me->MonsterSay("DRINK! BRAWL! DRINK! BRAWL!", LANG_UNIVERSAL, 0); - break; - case 2: - me->MonsterSay("Did someone say, \"Free Brew\"?", LANG_UNIVERSAL, 0); - break; - case 3: - me->MonsterSay("No one expects the Dark Iron dwarves!", LANG_UNIVERSAL, 0); - break; - case 4: - me->MonsterSay("It's not a party without some crashers!", LANG_UNIVERSAL, 0); - break; - } - } - } + void SayText() + { + if (!urand(0,20)) + { + switch (urand(0,4)) + { + case 0: + me->MonsterSay("Drink it all boys!", LANG_UNIVERSAL, 0); + break; + case 1: + me->MonsterSay("DRINK! BRAWL! DRINK! BRAWL!", LANG_UNIVERSAL, 0); + break; + case 2: + me->MonsterSay("Did someone say, \"Free Brew\"?", LANG_UNIVERSAL, 0); + break; + case 3: + me->MonsterSay("No one expects the Dark Iron dwarves!", LANG_UNIVERSAL, 0); + break; + case 4: + me->MonsterSay("It's not a party without some crashers!", LANG_UNIVERSAL, 0); + break; + } + } + } - void KilledUnit(Unit* who) - { - who->CastSpell(who, SPELL_REPORT_DEATH, true); - } + void KilledUnit(Unit* who) + { + who->CastSpell(who, SPELL_REPORT_DEATH, true); + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (me->IsAlive() && spellInfo->Id == SPELL_PLAYER_MUG) - { - me->CastSpell(me, SPELL_MUG_BOUNCE_BACK, true); - Unit::Kill(me, me); - me->CastSpell(me, SPELL_REPORT_DEATH, true); - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (me->IsAlive() && spellInfo->Id == SPELL_PLAYER_MUG) + { + me->CastSpell(me, SPELL_MUG_BOUNCE_BACK, true); + Unit::Kill(me, me); + me->CastSpell(me, SPELL_REPORT_DEATH, true); + } + } - void UpdateAI(uint32 diff) - { - timer += diff; - if (timer < 2000) - return; + void UpdateAI(uint32 diff) + { + timer += diff; + if (timer < 2000) + return; - timer = 0; - if (targetGUID) - { - if (Unit* target = GetTarget()) - me->CastSpell(target, SPELL_ATTACK_KEG, false); - else - FindNextKeg(); - } - } + timer = 0; + if (targetGUID) + { + if (Unit* target = GetTarget()) + me->CastSpell(target, SPELL_ATTACK_KEG, false); + else + FindNextKeg(); + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -1090,38 +1090,38 @@ class npc_brewfest_super_brew_trigger : public CreatureScript { } - uint32 timer; - void EnterCombat(Unit*) {} - void MoveInLineOfSight(Unit* who) - { - } + uint32 timer; + void EnterCombat(Unit*) {} + void MoveInLineOfSight(Unit* who) + { + } - void AttackStart(Unit*) {} + void AttackStart(Unit*) {} - void Reset() - { - timer = 0; - me->SummonGameObject(186478, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 30000); - } + void Reset() + { + timer = 0; + me->SummonGameObject(186478, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 30000); + } - void UpdateAI(uint32 diff) - { - timer += diff; - if (timer >= 500) - { - timer = 0; - Player* player = NULL; + void UpdateAI(uint32 diff) + { + timer += diff; + if (timer >= 500) + { + timer = 0; + Player* player = NULL; Trinity::AnyPlayerInObjectRangeCheck checker(me, 2.0f); Trinity::PlayerSearcher searcher(me, player, checker); me->VisitNearbyWorldObject(2.0f, searcher); if (player) - { - player->CastSpell(player, SPELL_DRUNKEN_MASTER, true); - me->RemoveAllGameObjects(); - Unit::Kill(me, me); - } - } - } + { + player->CastSpell(player, SPELL_DRUNKEN_MASTER, true); + me->RemoveAllGameObjects(); + Unit::Kill(me, me); + } + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -1137,17 +1137,17 @@ class npc_brewfest_super_brew_trigger : public CreatureScript enum ramRacing { - SPELL_TROT = 42992, - SPELL_CANTER = 42993, - SPELL_GALLOP = 42994, - SPELL_RAM_FATIGUE = 43052, - SPELL_RAM_EXHAUSTED = 43332, + SPELL_TROT = 42992, + SPELL_CANTER = 42993, + SPELL_GALLOP = 42994, + SPELL_RAM_FATIGUE = 43052, + SPELL_RAM_EXHAUSTED = 43332, - CREDIT_TROT = 24263, - CREDIT_CANTER = 24264, - CREDIT_GALLOP = 24265, + CREDIT_TROT = 24263, + CREDIT_CANTER = 24264, + CREDIT_GALLOP = 24265, - RACING_RAM_MODEL = 22630, + RACING_RAM_MODEL = 22630, }; class spell_brewfest_main_ram_buff : public SpellScriptLoader @@ -1159,132 +1159,132 @@ public: { PrepareAuraScript(spell_brewfest_main_ram_buff_AuraScript) - uint8 privateLevel; - uint32 questTick; - bool Load() - { - questTick = 0; - privateLevel = 0; - return true; - } - - void HandleEffectPeriodic(AuraEffect const* aurEff) - { - Unit* caster = GetCaster(); - if (!caster || !caster->IsMounted() || !caster->ToPlayer()) - return; - - if (caster->GetMountID() != RACING_RAM_MODEL) - return; - - Aura* aur = caster->GetAura(42924); - if (!aur) - { - caster->CastSpell(caster, 42924, true); - return; - } - - // Check if exhausted - if (Aura* exh = caster->GetAura(SPELL_RAM_EXHAUSTED)) - { - if (privateLevel) - { - caster->RemoveAurasDueToSpell(SPELL_CANTER); - caster->RemoveAurasDueToSpell(SPELL_GALLOP); - } - - aur->SetStackAmount(1); - return; - } - - uint32 stack = aur->GetStackAmount(); - uint8 mode = 0; - switch (privateLevel) - { - case 0: - if (stack > 1) - { - questTick = 0; - caster->CastSpell(caster, SPELL_TROT, true); - privateLevel++; - mode = 1; // unapply - break; - } - // just walking, fatiuge handling - if (Aura* aur = caster->GetAura(SPELL_RAM_FATIGUE)) - aur->ModStackAmount(-4); - break; - case 1: - // One click to maintain speed, more to increase - if (stack < 2) - { - caster->RemoveAurasDueToSpell(SPELL_TROT); - questTick = 0; - privateLevel--; - mode = 2; // apply - } - else if (stack > 2) - { - questTick = 0; - caster->CastSpell(caster, SPELL_CANTER, true); - privateLevel++; - } - else if (questTick++ > 3) - caster->ToPlayer()->KilledMonsterCredit(CREDIT_TROT, 0); - break; - case 2: - // Two - three clicks to maintains speed, less to decrease, more to increase - if (stack < 3) - { - caster->CastSpell(caster, SPELL_TROT, true); - privateLevel--; - questTick = 0; - } - else if (stack > 4) - { - caster->CastSpell(caster, SPELL_GALLOP, true); - privateLevel++; - questTick = 0; - } - else if (questTick++ > 3) - caster->ToPlayer()->KilledMonsterCredit(CREDIT_CANTER, 0); - break; - case 3: - // Four or more clicks to maintains speed, less to decrease - if (stack < 5) - { - caster->CastSpell(caster, SPELL_CANTER, true); - privateLevel--; - questTick = 0; - } - else if (questTick++ > 3) - caster->ToPlayer()->KilledMonsterCredit(CREDIT_GALLOP, 0); - break; - } - - // Set to base amount - aur->SetStackAmount(1); - - // apply/unapply effect 1 - if (mode) - if (Aura* base = aurEff->GetBase()) - if (AuraEffect* aEff = base->GetEffect(EFFECT_0)) - { - aEff->SetAmount(mode == 1 ? 0 : -50); - caster->UpdateSpeed(MOVE_RUN, true); - } - } - - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + uint8 privateLevel; + uint32 questTick; + bool Load() { - if (Unit* target = GetTarget()) - target->RemoveAurasDueToSpell(SPELL_RAM_FATIGUE); + questTick = 0; + privateLevel = 0; + return true; + } + + void HandleEffectPeriodic(AuraEffect const* aurEff) + { + Unit* caster = GetCaster(); + if (!caster || !caster->IsMounted() || !caster->ToPlayer()) + return; + + if (caster->GetMountID() != RACING_RAM_MODEL) + return; + + Aura* aur = caster->GetAura(42924); + if (!aur) + { + caster->CastSpell(caster, 42924, true); + return; + } + + // Check if exhausted + if (Aura* exh = caster->GetAura(SPELL_RAM_EXHAUSTED)) + { + if (privateLevel) + { + caster->RemoveAurasDueToSpell(SPELL_CANTER); + caster->RemoveAurasDueToSpell(SPELL_GALLOP); + } + + aur->SetStackAmount(1); + return; + } + + uint32 stack = aur->GetStackAmount(); + uint8 mode = 0; + switch (privateLevel) + { + case 0: + if (stack > 1) + { + questTick = 0; + caster->CastSpell(caster, SPELL_TROT, true); + privateLevel++; + mode = 1; // unapply + break; + } + // just walking, fatiuge handling + if (Aura* aur = caster->GetAura(SPELL_RAM_FATIGUE)) + aur->ModStackAmount(-4); + break; + case 1: + // One click to maintain speed, more to increase + if (stack < 2) + { + caster->RemoveAurasDueToSpell(SPELL_TROT); + questTick = 0; + privateLevel--; + mode = 2; // apply + } + else if (stack > 2) + { + questTick = 0; + caster->CastSpell(caster, SPELL_CANTER, true); + privateLevel++; + } + else if (questTick++ > 3) + caster->ToPlayer()->KilledMonsterCredit(CREDIT_TROT, 0); + break; + case 2: + // Two - three clicks to maintains speed, less to decrease, more to increase + if (stack < 3) + { + caster->CastSpell(caster, SPELL_TROT, true); + privateLevel--; + questTick = 0; + } + else if (stack > 4) + { + caster->CastSpell(caster, SPELL_GALLOP, true); + privateLevel++; + questTick = 0; + } + else if (questTick++ > 3) + caster->ToPlayer()->KilledMonsterCredit(CREDIT_CANTER, 0); + break; + case 3: + // Four or more clicks to maintains speed, less to decrease + if (stack < 5) + { + caster->CastSpell(caster, SPELL_CANTER, true); + privateLevel--; + questTick = 0; + } + else if (questTick++ > 3) + caster->ToPlayer()->KilledMonsterCredit(CREDIT_GALLOP, 0); + break; + } + + // Set to base amount + aur->SetStackAmount(1); + + // apply/unapply effect 1 + if (mode) + if (Aura* base = aurEff->GetBase()) + if (AuraEffect* aEff = base->GetEffect(EFFECT_0)) + { + aEff->SetAmount(mode == 1 ? 0 : -50); + caster->UpdateSpeed(MOVE_RUN, true); + } + } + + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + target->RemoveAurasDueToSpell(SPELL_RAM_FATIGUE); } void Register() { OnEffectPeriodic += AuraEffectPeriodicFn(spell_brewfest_main_ram_buff_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); - OnEffectRemove += AuraEffectRemoveFn(spell_brewfest_main_ram_buff_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_brewfest_main_ram_buff_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -1303,50 +1303,50 @@ public: { PrepareAuraScript(spell_brewfest_ram_fatigue_AuraScript) - void HandleEffectPeriodic(AuraEffect const* aurEff) - { - int8 fatigue = 0; - switch (aurEff->GetId()) - { - case SPELL_TROT: - fatigue = -2; - break; - case SPELL_CANTER: - fatigue = 1; - break; - case SPELL_GALLOP: - fatigue = 5; - break; - } - if (Unit* target = GetTarget()) - { - if (Aura* aur = target->GetAura(SPELL_RAM_FATIGUE)) - { - aur->ModStackAmount(fatigue); - if (aur->GetStackAmount() >= 100) - target->CastSpell(target, SPELL_RAM_EXHAUSTED, true); - } - else - target->CastSpell(target, SPELL_RAM_FATIGUE, true); - } - - } - - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectPeriodic(AuraEffect const* aurEff) { - if (Unit* target = GetTarget()) - { - if (Aura* aur = target->GetAura(SPELL_RAM_FATIGUE)) - aur->ModStackAmount(-15); - } + int8 fatigue = 0; + switch (aurEff->GetId()) + { + case SPELL_TROT: + fatigue = -2; + break; + case SPELL_CANTER: + fatigue = 1; + break; + case SPELL_GALLOP: + fatigue = 5; + break; + } + if (Unit* target = GetTarget()) + { + if (Aura* aur = target->GetAura(SPELL_RAM_FATIGUE)) + { + aur->ModStackAmount(fatigue); + if (aur->GetStackAmount() >= 100) + target->CastSpell(target, SPELL_RAM_EXHAUSTED, true); + } + else + target->CastSpell(target, SPELL_RAM_FATIGUE, true); + } + + } + + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + { + if (Aura* aur = target->GetAura(SPELL_RAM_FATIGUE)) + aur->ModStackAmount(-15); + } } void Register() { - if (m_scriptSpellId != 43332) - OnEffectPeriodic += AuraEffectPeriodicFn(spell_brewfest_ram_fatigue_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); - else - OnEffectRemove += AuraEffectRemoveFn(spell_brewfest_ram_fatigue_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_DECREASE_SPEED, AURA_EFFECT_HANDLE_REAL); + if (m_scriptSpellId != 43332) + OnEffectPeriodic += AuraEffectPeriodicFn(spell_brewfest_ram_fatigue_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + else + OnEffectRemove += AuraEffectRemoveFn(spell_brewfest_ram_fatigue_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_DECREASE_SPEED, AURA_EFFECT_HANDLE_REAL); } }; @@ -1361,24 +1361,24 @@ class spell_brewfest_apple_trap : public SpellScriptLoader public: spell_brewfest_apple_trap() : SpellScriptLoader("spell_brewfest_apple_trap") { } - class spell_brewfest_apple_trap_SpellScript : public SpellScript + class spell_brewfest_apple_trap_SpellScript : public SpellScript { PrepareSpellScript(spell_brewfest_apple_trap_SpellScript); - void HandleDummyEffect(SpellEffIndex /*effIndex*/) + void HandleDummyEffect(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - if (Aura* aur = target->GetAura(SPELL_RAM_FATIGUE)) - aur->Remove(); + if (Aura* aur = target->GetAura(SPELL_RAM_FATIGUE)) + aur->Remove(); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_brewfest_apple_trap_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_brewfest_apple_trap_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_brewfest_apple_trap_SpellScript(); }; @@ -1389,39 +1389,39 @@ class spell_q11117_catch_the_wild_wolpertinger : public SpellScriptLoader public: spell_q11117_catch_the_wild_wolpertinger() : SpellScriptLoader("spell_q11117_catch_the_wild_wolpertinger") { } - class spell_q11117_catch_the_wild_wolpertinger_SpellScript : public SpellScript + class spell_q11117_catch_the_wild_wolpertinger_SpellScript : public SpellScript { PrepareSpellScript(spell_q11117_catch_the_wild_wolpertinger_SpellScript); - SpellCastResult CheckTarget() + SpellCastResult CheckTarget() { - if (Unit* caster = GetCaster()) - if (Player* pCaster = caster->ToPlayer()) - if (Unit* target = caster->ToPlayer()->GetSelectedUnit()) - if (target->GetEntry() == 23487 && target->IsAlive()) - return SPELL_CAST_OK; + if (Unit* caster = GetCaster()) + if (Player* pCaster = caster->ToPlayer()) + if (Unit* target = caster->ToPlayer()->GetSelectedUnit()) + if (target->GetEntry() == 23487 && target->IsAlive()) + return SPELL_CAST_OK; return SPELL_FAILED_BAD_TARGETS; } - void HandleDummyEffect(SpellEffIndex /*effIndex*/) + void HandleDummyEffect(SpellEffIndex /*effIndex*/) { if (GetCaster() && GetCaster()->ToPlayer()) - { - GetCaster()->ToPlayer()->AddItem(32906, 1); - if (Unit* target = GetCaster()->ToPlayer()->GetSelectedUnit()) - target->ToCreature()->DespawnOrUnsummon(500); - } + { + GetCaster()->ToPlayer()->AddItem(32906, 1); + if (Unit* target = GetCaster()->ToPlayer()->GetSelectedUnit()) + target->ToCreature()->DespawnOrUnsummon(500); + } } void Register() { - OnCheckCast += SpellCheckCastFn(spell_q11117_catch_the_wild_wolpertinger_SpellScript::CheckTarget); - OnEffectHitTarget += SpellEffectFn(spell_q11117_catch_the_wild_wolpertinger_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_q11117_catch_the_wild_wolpertinger_SpellScript::CheckTarget); + OnEffectHitTarget += SpellEffectFn(spell_q11117_catch_the_wild_wolpertinger_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_q11117_catch_the_wild_wolpertinger_SpellScript(); }; @@ -1429,9 +1429,9 @@ public: enum fillKeg { - GREEN_EMPTY_KEG = 37892, - BLUE_EMPTY_KEG = 33016, - YELLOW_EMPTY_KEG = 32912, + GREEN_EMPTY_KEG = 37892, + BLUE_EMPTY_KEG = 33016, + YELLOW_EMPTY_KEG = 32912, }; class spell_brewfest_fill_keg : public SpellScriptLoader @@ -1439,49 +1439,49 @@ class spell_brewfest_fill_keg : public SpellScriptLoader public: spell_brewfest_fill_keg() : SpellScriptLoader("spell_brewfest_fill_keg") { } - class spell_brewfest_fill_keg_SpellScript : public SpellScript + class spell_brewfest_fill_keg_SpellScript : public SpellScript { PrepareSpellScript(spell_brewfest_fill_keg_SpellScript); - void HandleAfterHit() + void HandleAfterHit() { if (GetCaster() && GetCaster()->ToPlayer()) - { - if (Item* itemCaster = GetCastItem()) - { - Player* player = GetCaster()->ToPlayer(); - uint32 item = 0; - switch (itemCaster->GetEntry()) - { - case GREEN_EMPTY_KEG: - case BLUE_EMPTY_KEG: - item = itemCaster->GetEntry()+urand(1,5); // 5 items, id in range empty+1-5 - break; - case YELLOW_EMPTY_KEG: - if (uint8 num = urand(0,4)) - item = 32916+num; - else - item = 32915; - break; - } + { + if (Item* itemCaster = GetCastItem()) + { + Player* player = GetCaster()->ToPlayer(); + uint32 item = 0; + switch (itemCaster->GetEntry()) + { + case GREEN_EMPTY_KEG: + case BLUE_EMPTY_KEG: + item = itemCaster->GetEntry()+urand(1,5); // 5 items, id in range empty+1-5 + break; + case YELLOW_EMPTY_KEG: + if (uint8 num = urand(0,4)) + item = 32916+num; + else + item = 32915; + break; + } - if (item && player->AddItem(item, 1)) // ensure filled keg is stored - { - player->DestroyItemCount(itemCaster->GetEntry(), 1, true); - GetSpell()->m_CastItem = NULL; - GetSpell()->m_castItemGUID = 0; - } - } - } + if (item && player->AddItem(item, 1)) // ensure filled keg is stored + { + player->DestroyItemCount(itemCaster->GetEntry(), 1, true); + GetSpell()->m_CastItem = NULL; + GetSpell()->m_castItemGUID = 0; + } + } + } } void Register() { - AfterHit += SpellHitFn(spell_brewfest_fill_keg_SpellScript::HandleAfterHit); + AfterHit += SpellHitFn(spell_brewfest_fill_keg_SpellScript::HandleAfterHit); } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_brewfest_fill_keg_SpellScript(); }; @@ -1492,63 +1492,63 @@ class spell_brewfest_unfill_keg : public SpellScriptLoader public: spell_brewfest_unfill_keg() : SpellScriptLoader("spell_brewfest_unfill_keg") { } - class spell_brewfest_unfill_keg_SpellScript : public SpellScript + class spell_brewfest_unfill_keg_SpellScript : public SpellScript { PrepareSpellScript(spell_brewfest_unfill_keg_SpellScript); - uint32 GetEmptyEntry(uint32 baseEntry) - { - switch (baseEntry) - { - case 37893: - case 37894: - case 37895: - case 37896: - case 37897: - return GREEN_EMPTY_KEG; - case 33017: - case 33018: - case 33019: - case 33020: - case 33021: - return BLUE_EMPTY_KEG; - case 32915: - case 32917: - case 32918: - case 32919: - case 32920: - return YELLOW_EMPTY_KEG; - } - - return 0; - } + uint32 GetEmptyEntry(uint32 baseEntry) + { + switch (baseEntry) + { + case 37893: + case 37894: + case 37895: + case 37896: + case 37897: + return GREEN_EMPTY_KEG; + case 33017: + case 33018: + case 33019: + case 33020: + case 33021: + return BLUE_EMPTY_KEG; + case 32915: + case 32917: + case 32918: + case 32919: + case 32920: + return YELLOW_EMPTY_KEG; + } + + return 0; + } - void HandleAfterHit() + void HandleAfterHit() { if (GetCaster() && GetCaster()->ToPlayer()) - { - if (Item* itemCaster = GetCastItem()) - { - uint32 item = GetEmptyEntry(itemCaster->GetEntry()); - Player* player = GetCaster()->ToPlayer(); + { + if (Item* itemCaster = GetCastItem()) + { + uint32 item = GetEmptyEntry(itemCaster->GetEntry()); + Player* player = GetCaster()->ToPlayer(); - if (item && player->AddItem(item, 1)) // ensure filled keg is stored - { - player->DestroyItemCount(itemCaster->GetEntry(), 1, true); - GetSpell()->m_CastItem = NULL; - GetSpell()->m_castItemGUID = 0; - } - } - } + if (item && player->AddItem(item, 1)) // ensure filled keg is stored + { + player->DestroyItemCount(itemCaster->GetEntry(), 1, true); + GetSpell()->m_CastItem = NULL; + GetSpell()->m_castItemGUID = 0; + } + } + } } void Register() { - AfterHit += SpellHitFn(spell_brewfest_unfill_keg_SpellScript::HandleAfterHit); + AfterHit += SpellHitFn(spell_brewfest_unfill_keg_SpellScript::HandleAfterHit); } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_brewfest_unfill_keg_SpellScript(); }; @@ -1559,96 +1559,96 @@ class spell_brewfest_toss_mug : public SpellScriptLoader public: spell_brewfest_toss_mug() : SpellScriptLoader("spell_brewfest_toss_mug") { } - class spell_brewfest_toss_mug_SpellScript : public SpellScript + class spell_brewfest_toss_mug_SpellScript : public SpellScript { PrepareSpellScript(spell_brewfest_toss_mug_SpellScript); - SpellCastResult CheckCast() + SpellCastResult CheckCast() { - if (Unit* caster = GetCaster()) - { - float z = caster->GetMap()->GetHeight(caster->GetPositionX()+14*cos(caster->GetOrientation()), caster->GetPositionY()+14*sin(caster->GetOrientation()), MAX_HEIGHT); - WorldLocation pPosition = WorldLocation(caster->GetMapId(), caster->GetPositionX()+14*cos(caster->GetOrientation()), caster->GetPositionY()+14*sin(caster->GetOrientation()), z, caster->GetOrientation()); - SetExplTargetDest(pPosition); - } + if (Unit* caster = GetCaster()) + { + float z = caster->GetMap()->GetHeight(caster->GetPositionX()+14*cos(caster->GetOrientation()), caster->GetPositionY()+14*sin(caster->GetOrientation()), MAX_HEIGHT); + WorldLocation pPosition = WorldLocation(caster->GetMapId(), caster->GetPositionX()+14*cos(caster->GetOrientation()), caster->GetPositionY()+14*sin(caster->GetOrientation()), z, caster->GetOrientation()); + SetExplTargetDest(pPosition); + } return SPELL_CAST_OK; } - void FilterTargets(std::list& targets) + void FilterTargets(std::list& targets) { - Unit* caster = GetCaster(); - if (!caster) - return; + Unit* caster = GetCaster(); + if (!caster) + return; - WorldObject* target = NULL; - for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) - if (caster->HasInLine((*itr), 2.0f)) - { - target = (*itr); - break; - } + WorldObject* target = NULL; + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + if (caster->HasInLine((*itr), 2.0f)) + { + target = (*itr); + break; + } - targets.clear(); - if (target) - targets.push_back(target); + targets.clear(); + if (target) + targets.push_back(target); - targets.push_back(caster); + targets.push_back(caster); } - void HandleBeforeHit() - { - if (Unit* target = GetHitUnit()) - { - if (!GetCaster() || target->GetGUID() == GetCaster()->GetGUID()) - return; + void HandleBeforeHit() + { + if (Unit* target = GetHitUnit()) + { + if (!GetCaster() || target->GetGUID() == GetCaster()->GetGUID()) + return; - WorldLocation pPosition = WorldLocation(target->GetMapId(), target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+4.0f, target->GetOrientation()); - SetExplTargetDest(pPosition); - } - } + WorldLocation pPosition = WorldLocation(target->GetMapId(), target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+4.0f, target->GetOrientation()); + SetExplTargetDest(pPosition); + } + } - void HandleScriptEffect(SpellEffIndex /*effIndex*/) - { - Creature* cr = NULL; - Unit* caster = GetCaster(); - if (!caster) - return; + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Creature* cr = NULL; + Unit* caster = GetCaster(); + if (!caster) + return; - if (!GetHitUnit() || GetHitUnit()->GetGUID() != caster->GetGUID()) - return; + if (!GetHitUnit() || GetHitUnit()->GetGUID() != caster->GetGUID()) + return; - if (caster->GetMapId() == 1) // Kalimdor - { - if (cr = caster->FindNearestCreature(NPC_NORMAL_VOODOO, 40.0f)) - cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); - else if (cr = caster->FindNearestCreature(NPC_NORMAL_DROHN, 40.0f)) - cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); - else if (cr = caster->FindNearestCreature(NPC_NORMAL_GORDOK, 40.0f)) - cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); - } - else // EK - { - if (cr = caster->FindNearestCreature(NPC_NORMAL_THUNDERBREW, 40.0f)) - cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); - else if (cr = caster->FindNearestCreature(NPC_NORMAL_BARLEYBREW, 40.0f)) - cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); - else if (cr = caster->FindNearestCreature(NPC_NORMAL_GORDOK, 40.0f)) - cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); - } - - } + if (caster->GetMapId() == 1) // Kalimdor + { + if (cr = caster->FindNearestCreature(NPC_NORMAL_VOODOO, 40.0f)) + cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); + else if (cr = caster->FindNearestCreature(NPC_NORMAL_DROHN, 40.0f)) + cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); + else if (cr = caster->FindNearestCreature(NPC_NORMAL_GORDOK, 40.0f)) + cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); + } + else // EK + { + if (cr = caster->FindNearestCreature(NPC_NORMAL_THUNDERBREW, 40.0f)) + cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); + else if (cr = caster->FindNearestCreature(NPC_NORMAL_BARLEYBREW, 40.0f)) + cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); + else if (cr = caster->FindNearestCreature(NPC_NORMAL_GORDOK, 40.0f)) + cr->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); + } + + } void Register() { - OnCheckCast += SpellCheckCastFn(spell_brewfest_toss_mug_SpellScript::CheckCast); + OnCheckCast += SpellCheckCastFn(spell_brewfest_toss_mug_SpellScript::CheckCast); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_brewfest_toss_mug_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - BeforeHit += SpellHitFn(spell_brewfest_toss_mug_SpellScript::HandleBeforeHit); - OnEffectHitTarget += SpellEffectFn(spell_brewfest_toss_mug_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + BeforeHit += SpellHitFn(spell_brewfest_toss_mug_SpellScript::HandleBeforeHit); + OnEffectHitTarget += SpellEffectFn(spell_brewfest_toss_mug_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_brewfest_toss_mug_SpellScript(); }; @@ -1659,15 +1659,15 @@ class spell_brewfest_add_mug : public SpellScriptLoader public: spell_brewfest_add_mug() : SpellScriptLoader("spell_brewfest_add_mug") { } - class spell_brewfest_add_mug_SpellScript : public SpellScript + class spell_brewfest_add_mug_SpellScript : public SpellScript { PrepareSpellScript(spell_brewfest_add_mug_SpellScript); - void HandleDummyEffect(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetHitUnit()) - target->CastSpell(target, SPELL_ADD_MUG, true); - } + void HandleDummyEffect(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + target->CastSpell(target, SPELL_ADD_MUG, true); + } void Register() { @@ -1675,7 +1675,7 @@ public: } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_brewfest_add_mug_SpellScript(); }; @@ -1684,7 +1684,7 @@ public: // enum brewBubble { - SPELL_BUBBLE_BUILD_UP = 49828, + SPELL_BUBBLE_BUILD_UP = 49828, }; class npc_brew_bubble : public CreatureScript @@ -1698,56 +1698,56 @@ class npc_brew_bubble : public CreatureScript { } - uint32 timer; + uint32 timer; - void Reset() - { - me->SetReactState(REACT_AGGRESSIVE); - me->GetMotionMaster()->MoveRandom(15.0f); - timer = 0; - } + void Reset() + { + me->SetReactState(REACT_AGGRESSIVE); + me->GetMotionMaster()->MoveRandom(15.0f); + timer = 0; + } - void DoAction(int32) - { - timer = 0; - } + void DoAction(int32) + { + timer = 0; + } - void MoveInLineOfSight(Unit* target) - { - if (target->GetEntry() == me->GetEntry()) - if (me->IsWithinDist(target, 1.0f)) - { - uint8 stacksMe = me->GetAuraCount(SPELL_BUBBLE_BUILD_UP); - uint8 stacksTarget = target->GetAuraCount(SPELL_BUBBLE_BUILD_UP); - if (stacksMe >= stacksTarget) - { - if (Aura* aura = me->GetAura(SPELL_BUBBLE_BUILD_UP)) - aura->ModStackAmount(stacksTarget+1); - else - me->AddAura(SPELL_BUBBLE_BUILD_UP, me); - - target->ToCreature()->DespawnOrUnsummon(); - DoAction(0); - } - else if (Aura* aura = target->GetAura(SPELL_BUBBLE_BUILD_UP)) - { - aura->ModStackAmount(stacksMe); - - target->ToCreature()->AI()->DoAction(0); - me->DespawnOrUnsummon(); - } - } - } + void MoveInLineOfSight(Unit* target) + { + if (target->GetEntry() == me->GetEntry()) + if (me->IsWithinDist(target, 1.0f)) + { + uint8 stacksMe = me->GetAuraCount(SPELL_BUBBLE_BUILD_UP); + uint8 stacksTarget = target->GetAuraCount(SPELL_BUBBLE_BUILD_UP); + if (stacksMe >= stacksTarget) + { + if (Aura* aura = me->GetAura(SPELL_BUBBLE_BUILD_UP)) + aura->ModStackAmount(stacksTarget+1); + else + me->AddAura(SPELL_BUBBLE_BUILD_UP, me); + + target->ToCreature()->DespawnOrUnsummon(); + DoAction(0); + } + else if (Aura* aura = target->GetAura(SPELL_BUBBLE_BUILD_UP)) + { + aura->ModStackAmount(stacksMe); + + target->ToCreature()->AI()->DoAction(0); + me->DespawnOrUnsummon(); + } + } + } - void UpdateAI(uint32 diff) - { - timer += diff; - if (timer >= 25000) - { - timer = 0; - me->DespawnOrUnsummon(); - } - } + void UpdateAI(uint32 diff) + { + timer += diff; + if (timer >= 25000) + { + timer = 0; + me->DespawnOrUnsummon(); + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -1758,30 +1758,30 @@ class npc_brew_bubble : public CreatureScript void AddSC_event_brewfest_scripts() { - // Npcs - new npc_brewfest_reveler(); - new npc_coren_direbrew(); - new npc_coren_direbrew_sisters(); - new npc_brewfest_keg_thrower(); - new npc_brewfest_keg_reciver(); - new npc_brewfest_bark_trigger(); - new npc_dark_iron_attack_generator(); - new npc_dark_iron_attack_mole_machine(); - new npc_dark_iron_guzzler(); - new npc_brewfest_super_brew_trigger(); + // Npcs + new npc_brewfest_reveler(); + new npc_coren_direbrew(); + new npc_coren_direbrew_sisters(); + new npc_brewfest_keg_thrower(); + new npc_brewfest_keg_reciver(); + new npc_brewfest_bark_trigger(); + new npc_dark_iron_attack_generator(); + new npc_dark_iron_attack_mole_machine(); + new npc_dark_iron_guzzler(); + new npc_brewfest_super_brew_trigger(); - // Spells - // ram - new spell_brewfest_main_ram_buff(); - new spell_brewfest_ram_fatigue(); - new spell_brewfest_apple_trap(); - // other - new spell_q11117_catch_the_wild_wolpertinger(); - new spell_brewfest_fill_keg(); - new spell_brewfest_unfill_keg(); - new spell_brewfest_toss_mug(); - new spell_brewfest_add_mug(); + // Spells + // ram + new spell_brewfest_main_ram_buff(); + new spell_brewfest_ram_fatigue(); + new spell_brewfest_apple_trap(); + // other + new spell_q11117_catch_the_wild_wolpertinger(); + new spell_brewfest_fill_keg(); + new spell_brewfest_unfill_keg(); + new spell_brewfest_toss_mug(); + new spell_brewfest_add_mug(); - // beer effect - new npc_brew_bubble(); + // beer effect + new npc_brew_bubble(); } \ No newline at end of file diff --git a/src/server/scripts/Events/hallows_end.cpp b/src/server/scripts/Events/hallows_end.cpp index 0f4f58f6f..a8b46363c 100644 --- a/src/server/scripts/Events/hallows_end.cpp +++ b/src/server/scripts/Events/hallows_end.cpp @@ -23,10 +23,10 @@ enum eTrickSpells SPELL_LEPER_GNOME_COSTUME_MALE = 24712, SPELL_LEPER_GNOME_COSTUME_FEMALE = 24713, SPELL_SKELETON_COSTUME = 24723, - SPELL_BAT_COSTUME = 24732, + SPELL_BAT_COSTUME = 24732, SPELL_GHOST_COSTUME_MALE = 24735, SPELL_GHOST_COSTUME_FEMALE = 24736, - SPELL_WHISP_COSTUME = 24740, + SPELL_WHISP_COSTUME = 24740, SPELL_TRICK_BUFF = 24753, }; @@ -62,12 +62,12 @@ class spell_hallows_end_trick : public SpellScriptLoader case 5: spellId = SPELL_SKELETON_COSTUME; break; - case 6: - spellId = SPELL_BAT_COSTUME; - break; - case 7: - spellId = SPELL_WHISP_COSTUME; - break; + case 6: + spellId = SPELL_BAT_COSTUME; + break; + case 7: + spellId = SPELL_WHISP_COSTUME; + break; default: break; } @@ -95,8 +95,8 @@ class spell_hallows_end_put_costume : public SpellScriptLoader class spell_hallows_end_put_costume_SpellScript : public SpellScript { - public: - spell_hallows_end_put_costume_SpellScript(uint32 maleSpell, uint32 femaleSpell) : _maleSpell(maleSpell), _femaleSpell(femaleSpell) { } + public: + spell_hallows_end_put_costume_SpellScript(uint32 maleSpell, uint32 femaleSpell) : _maleSpell(maleSpell), _femaleSpell(femaleSpell) { } PrepareSpellScript(spell_hallows_end_put_costume_SpellScript); @@ -111,9 +111,9 @@ class spell_hallows_end_put_costume : public SpellScriptLoader OnEffectHitTarget += SpellEffectFn(spell_hallows_end_put_costume_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } - private: - uint32 _maleSpell; - uint32 _femaleSpell; + private: + uint32 _maleSpell; + uint32 _femaleSpell; }; SpellScript* GetSpellScript() const @@ -121,9 +121,9 @@ class spell_hallows_end_put_costume : public SpellScriptLoader return new spell_hallows_end_put_costume_SpellScript(_maleSpell, _femaleSpell); } - private: - uint32 _maleSpell; - uint32 _femaleSpell; + private: + uint32 _maleSpell; + uint32 _femaleSpell; }; // 24751 Trick or Treat @@ -166,10 +166,10 @@ class spell_hallows_end_trick_or_treat : public SpellScriptLoader enum eHallowsEndCandy { - SPELL_HALLOWS_END_CANDY_1 = 24924, - SPELL_HALLOWS_END_CANDY_2 = 24925, - SPELL_HALLOWS_END_CANDY_3 = 24926, - SPELL_HALLOWS_END_CANDY_4 = 24927, + SPELL_HALLOWS_END_CANDY_1 = 24924, + SPELL_HALLOWS_END_CANDY_2 = 24925, + SPELL_HALLOWS_END_CANDY_3 = 24926, + SPELL_HALLOWS_END_CANDY_4 = 24927, }; class spell_hallows_end_candy : public SpellScriptLoader @@ -204,7 +204,7 @@ class spell_hallows_end_candy : public SpellScriptLoader enum trickyTreat { - SPELL_UPSET_TUMMY = 42966, + SPELL_UPSET_TUMMY = 42966, }; class spell_hallows_end_tricky_treat : public SpellScriptLoader @@ -221,7 +221,7 @@ class spell_hallows_end_tricky_treat : public SpellScriptLoader if (Player* target = GetHitPlayer()) { if (roll_chance_i(20)) - target->CastSpell(target, SPELL_UPSET_TUMMY, true); + target->CastSpell(target, SPELL_UPSET_TUMMY, true); } } @@ -243,30 +243,30 @@ class spell_hallows_end_tricky_treat : public SpellScriptLoader enum costumedOrphan { - // Quests - QUEST_LET_THE_FIRES_COME_A = 12135, - QUEST_LET_THE_FIRES_COME_H = 12139, - QUEST_STOP_THE_FIRES_A = 11131, - QUEST_STOP_THE_FIRES_H = 11219, + // Quests + QUEST_LET_THE_FIRES_COME_A = 12135, + QUEST_LET_THE_FIRES_COME_H = 12139, + QUEST_STOP_THE_FIRES_A = 11131, + QUEST_STOP_THE_FIRES_H = 11219, - // Spells - SPELL_HORSEMAN_MOUNT = 48025, - SPELL_FIRE_AURA_BASE = 42074, - SPELL_START_FIRE = 42132, - SPELL_SPREAD_FIRE = 42079, - SPELL_CREATE_BUCKET = 42349, - SPELL_WATER_SPLASH = 42348, - SPELL_SUMMON_LANTERN = 44255, + // Spells + SPELL_HORSEMAN_MOUNT = 48025, + SPELL_FIRE_AURA_BASE = 42074, + SPELL_START_FIRE = 42132, + SPELL_SPREAD_FIRE = 42079, + SPELL_CREATE_BUCKET = 42349, + SPELL_WATER_SPLASH = 42348, + SPELL_SUMMON_LANTERN = 44255, - // NPCs - NPC_SHADE_OF_HORSEMAN = 23543, - NPC_FIRE_TRIGGER = 23686, - NPC_ALLIANCE_MATRON = 24519, + // NPCs + NPC_SHADE_OF_HORSEMAN = 23543, + NPC_FIRE_TRIGGER = 23686, + NPC_ALLIANCE_MATRON = 24519, - // Actions - ACTION_START_EVENT = 1, - DATA_EVENT = 1, - DATA_ALLOW_START = 2, + // Actions + ACTION_START_EVENT = 1, + DATA_EVENT = 1, + DATA_ALLOW_START = 2, }; class spell_hallows_end_bucket_lands : public SpellScriptLoader @@ -278,18 +278,18 @@ class spell_hallows_end_bucket_lands : public SpellScriptLoader { PrepareSpellScript(spell_hallows_end_bucket_lands_SpellScript); - bool handled; - bool Load() { handled = false; return true; } + bool handled; + bool Load() { handled = false; return true; } void HandleDummy(SpellEffIndex /*effIndex*/) { - if (handled || !GetCaster()) - return; + if (handled || !GetCaster()) + return; - handled = true; + handled = true; if (Player* target = GetHitPlayer()) - GetCaster()->CastSpell(target, SPELL_CREATE_BUCKET, true); - else if (Unit* tgt = GetHitUnit()) - GetCaster()->CastSpell(tgt, SPELL_WATER_SPLASH, true); + GetCaster()->CastSpell(target, SPELL_CREATE_BUCKET, true); + else if (Unit* tgt = GetHitUnit()) + GetCaster()->CastSpell(tgt, SPELL_WATER_SPLASH, true); } void Register() @@ -315,36 +315,36 @@ class spell_hallows_end_base_fire : public SpellScriptLoader void HandleEffectPeriodicUpdate(AuraEffect* aurEff) { - // can start from 0 + // can start from 0 int32 amount = aurEff->GetAmount(); - if (amount < 3) - amount++; - else if (aurEff->GetTickNumber()%3 != 2) - return; + if (amount < 3) + amount++; + else if (aurEff->GetTickNumber()%3 != 2) + return; - aurEff->SetAmount(amount); - if (Unit* owner = GetUnitOwner()) - { - if (amount <= 3) - owner->SetObjectScale(amount/2.0f); - if (amount >=3) - owner->CastSpell(owner, SPELL_SPREAD_FIRE, true); - } + aurEff->SetAmount(amount); + if (Unit* owner = GetUnitOwner()) + { + if (amount <= 3) + owner->SetObjectScale(amount/2.0f); + if (amount >=3) + owner->CastSpell(owner, SPELL_SPREAD_FIRE, true); + } } - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); target->SetObjectScale(0.5f); if (AuraEffect* aEff = GetEffect(EFFECT_0)) - aEff->SetAmount(1); + aEff->SetAmount(1); } void Register() { OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hallows_end_base_fire_AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - OnEffectApply += AuraEffectApplyFn(spell_hallows_end_base_fire_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_hallows_end_base_fire_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -359,141 +359,141 @@ class npc_costumed_orphan_matron : public CreatureScript public: npc_costumed_orphan_matron() : CreatureScript("npc_costumed_orphan_matron") { } - struct npc_costumed_orphan_matronAI : public ScriptedAI - { - npc_costumed_orphan_matronAI(Creature *c) : ScriptedAI(c) - { - } + struct npc_costumed_orphan_matronAI : public ScriptedAI + { + npc_costumed_orphan_matronAI(Creature *c) : ScriptedAI(c) + { + } - uint32 eventStarted; - bool allowQuest; - uint64 horseGUID; + uint32 eventStarted; + bool allowQuest; + uint64 horseGUID; - void Reset() - { - eventStarted = 0; - allowQuest = false; - horseGUID = 0; - } + void Reset() + { + eventStarted = 0; + allowQuest = false; + horseGUID = 0; + } - void GetInitXYZ(float &x, float &y, float &z, float &o, uint32 &path) - { - switch (me->GetAreaId()) - { - case 87: // Goldshire - x = -9494.4f; y = 48.53f; z = 70.5f; o = 0.5f; path = 235431; - break; - case 131: // Kharanos - x = -5558.34f; y = -499.46f; z = 414.12f; o = 2.08f; path = 235432; - break; - case 3576: // Azure Watch - x = -4163.58f; y = -12460.30f; z = 63.02f; o = 4.31f; path = 235433; - break; - case 362: // Razor Hill - x = 373.2f; y = -4723.4f; z = 31.2f; o = 3.2f; path = 235434; - break; - case 159: // Brill - x = 2195.2f; y = 264.0f; z = 55.62f; o = 0.15f; path = 235435; - break; - case 3665: // Falcon Wing Square - x = 9547.91f; y = -6809.9f; z = 27.96f; o = 3.4f; path = 235436; - break; - } - } + void GetInitXYZ(float &x, float &y, float &z, float &o, uint32 &path) + { + switch (me->GetAreaId()) + { + case 87: // Goldshire + x = -9494.4f; y = 48.53f; z = 70.5f; o = 0.5f; path = 235431; + break; + case 131: // Kharanos + x = -5558.34f; y = -499.46f; z = 414.12f; o = 2.08f; path = 235432; + break; + case 3576: // Azure Watch + x = -4163.58f; y = -12460.30f; z = 63.02f; o = 4.31f; path = 235433; + break; + case 362: // Razor Hill + x = 373.2f; y = -4723.4f; z = 31.2f; o = 3.2f; path = 235434; + break; + case 159: // Brill + x = 2195.2f; y = 264.0f; z = 55.62f; o = 0.15f; path = 235435; + break; + case 3665: // Falcon Wing Square + x = 9547.91f; y = -6809.9f; z = 27.96f; o = 3.4f; path = 235436; + break; + } + } - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT) - { - allowQuest = true; - eventStarted = 1; - float x, y, z, o; - uint32 path; - GetInitXYZ(x, y, z, o, path); - if (Creature* cr = me->SummonCreature(NPC_SHADE_OF_HORSEMAN, x, y, z, o, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000)) - { - cr->GetMotionMaster()->MovePath(path, false); - cr->AI()->DoAction(path); - horseGUID = cr->GetGUID(); - } - } - } + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT) + { + allowQuest = true; + eventStarted = 1; + float x, y, z, o; + uint32 path; + GetInitXYZ(x, y, z, o, path); + if (Creature* cr = me->SummonCreature(NPC_SHADE_OF_HORSEMAN, x, y, z, o, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000)) + { + cr->GetMotionMaster()->MovePath(path, false); + cr->AI()->DoAction(path); + horseGUID = cr->GetGUID(); + } + } + } - uint32 GetData(uint32 param) const - { - if (param == DATA_ALLOW_START) - return allowQuest; + uint32 GetData(uint32 param) const + { + if (param == DATA_ALLOW_START) + return allowQuest; - return 0; - } + return 0; + } - void UpdateAI(uint32 diff) - { - if (eventStarted) - { - eventStarted += diff; - if (eventStarted >= 5*MINUTE*IN_MILLISECONDS) - { - allowQuest = false; - eventStarted = 0; - } - } - } - }; + void UpdateAI(uint32 diff) + { + if (eventStarted) + { + eventStarted += diff; + if (eventStarted >= 5*MINUTE*IN_MILLISECONDS) + { + allowQuest = false; + eventStarted = 0; + } + } + } + }; - bool OnGossipHello(Player* player, Creature* creature) - { - QuestRelationBounds pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); - QuestRelationBounds pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); + bool OnGossipHello(Player* player, Creature* creature) + { + QuestRelationBounds pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); + QuestRelationBounds pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); - QuestMenu &qm = player->PlayerTalkClass->GetQuestMenu(); - qm.ClearMenu(); + QuestMenu &qm = player->PlayerTalkClass->GetQuestMenu(); + qm.ClearMenu(); - for (QuestRelations::const_iterator i = pObjectQIR.first; i != pObjectQIR.second; ++i) - { - uint32 quest_id = i->second; - QuestStatus status = player->GetQuestStatus(quest_id); - if (status == QUEST_STATUS_COMPLETE) - qm.AddMenuItem(quest_id, 4); - else if (status == QUEST_STATUS_INCOMPLETE) - qm.AddMenuItem(quest_id, 4); - } + for (QuestRelations::const_iterator i = pObjectQIR.first; i != pObjectQIR.second; ++i) + { + uint32 quest_id = i->second; + QuestStatus status = player->GetQuestStatus(quest_id); + if (status == QUEST_STATUS_COMPLETE) + qm.AddMenuItem(quest_id, 4); + else if (status == QUEST_STATUS_INCOMPLETE) + qm.AddMenuItem(quest_id, 4); + } - for (QuestRelations::const_iterator i = pObjectQR.first; i != pObjectQR.second; ++i) - { - uint32 quest_id = i->second; - Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); - if (!pQuest) - continue; + for (QuestRelations::const_iterator i = pObjectQR.first; i != pObjectQR.second; ++i) + { + uint32 quest_id = i->second; + Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); + if (!pQuest) + continue; - if (!player->CanTakeQuest(pQuest, false)) - continue; - else if (player->GetQuestStatus(quest_id) == QUEST_STATUS_NONE) - { - switch (quest_id) - { - case QUEST_LET_THE_FIRES_COME_A: - case QUEST_LET_THE_FIRES_COME_H: - if (!creature->AI()->GetData(DATA_ALLOW_START)) - qm.AddMenuItem(quest_id, 2); - break; - case QUEST_STOP_THE_FIRES_A: - case QUEST_STOP_THE_FIRES_H: - if (creature->AI()->GetData(DATA_ALLOW_START)) - qm.AddMenuItem(quest_id, 2); - break; - default: - qm.AddMenuItem(quest_id, 2); - break; - } - } - } + if (!player->CanTakeQuest(pQuest, false)) + continue; + else if (player->GetQuestStatus(quest_id) == QUEST_STATUS_NONE) + { + switch (quest_id) + { + case QUEST_LET_THE_FIRES_COME_A: + case QUEST_LET_THE_FIRES_COME_H: + if (!creature->AI()->GetData(DATA_ALLOW_START)) + qm.AddMenuItem(quest_id, 2); + break; + case QUEST_STOP_THE_FIRES_A: + case QUEST_STOP_THE_FIRES_H: + if (creature->AI()->GetData(DATA_ALLOW_START)) + qm.AddMenuItem(quest_id, 2); + break; + default: + qm.AddMenuItem(quest_id, 2); + break; + } + } + } - player->SendPreparedQuest(creature->GetGUID()); - return true; - } + player->SendPreparedQuest(creature->GetGUID()); + return true; + } - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if ((quest->GetQuestId() == QUEST_LET_THE_FIRES_COME_A || quest->GetQuestId() == QUEST_LET_THE_FIRES_COME_H) && !creature->AI()->GetData(DATA_ALLOW_START)) creature->AI()->DoAction(ACTION_START_EVENT); @@ -501,10 +501,10 @@ public: return true; } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_costumed_orphan_matronAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_costumed_orphan_matronAI (pCreature); + } }; class npc_soh_fire_trigger : public CreatureScript @@ -518,41 +518,41 @@ class npc_soh_fire_trigger : public CreatureScript { } - void Reset() - { - me->SetDisableGravity(true); - } + void Reset() + { + me->SetDisableGravity(true); + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_START_FIRE) - { - me->CastSpell(me, SPELL_FIRE_AURA_BASE, true); - if (AuraEffect* aurEff = me->GetAuraEffect(SPELL_FIRE_AURA_BASE, EFFECT_0)) - { - me->SetObjectScale(1.5f); - aurEff->SetAmount(2); - } - } - else if (spellInfo->Id == SPELL_SPREAD_FIRE) - { - me->CastSpell(me, SPELL_FIRE_AURA_BASE, true); - } - else if (spellInfo->Id == SPELL_WATER_SPLASH) - { - if (AuraEffect* aurEff = me->GetAuraEffect(SPELL_FIRE_AURA_BASE, EFFECT_0)) - { - int32 amt = aurEff->GetAmount(); - if (amt > 2) - { - aurEff->ResetPeriodic(true); - aurEff->SetAmount(amt-2); - } - else - me->RemoveAllAuras(); - } - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_START_FIRE) + { + me->CastSpell(me, SPELL_FIRE_AURA_BASE, true); + if (AuraEffect* aurEff = me->GetAuraEffect(SPELL_FIRE_AURA_BASE, EFFECT_0)) + { + me->SetObjectScale(1.5f); + aurEff->SetAmount(2); + } + } + else if (spellInfo->Id == SPELL_SPREAD_FIRE) + { + me->CastSpell(me, SPELL_FIRE_AURA_BASE, true); + } + else if (spellInfo->Id == SPELL_WATER_SPLASH) + { + if (AuraEffect* aurEff = me->GetAuraEffect(SPELL_FIRE_AURA_BASE, EFFECT_0)) + { + int32 amt = aurEff->GetAmount(); + if (amt > 2) + { + aurEff->ResetPeriodic(true); + aurEff->SetAmount(amt-2); + } + else + me->RemoveAllAuras(); + } + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -570,201 +570,201 @@ class npc_hallows_end_soh : public CreatureScript { npc_hallows_end_sohAI(Creature* creature) : ScriptedAI(creature) { - pos = 0; - counter = 0; - unitList.clear(); - me->CastSpell(me, SPELL_HORSEMAN_MOUNT, true); - me->SetSpeed(MOVE_WALK, 3.0f, true); - Unmount = false; + pos = 0; + counter = 0; + unitList.clear(); + me->CastSpell(me, SPELL_HORSEMAN_MOUNT, true); + me->SetSpeed(MOVE_WALK, 3.0f, true); + Unmount = false; } - bool Unmount; - EventMap events; - uint32 counter; - std::list unitList; - int32 pos; - void EnterCombat(Unit*) {} - void MoveInLineOfSight(Unit* who){} + bool Unmount; + EventMap events; + uint32 counter; + std::list unitList; + int32 pos; + void EnterCombat(Unit*) {} + void MoveInLineOfSight(Unit* who){} - void DoAction(int32 param) - { - pos = param; - } + void DoAction(int32 param) + { + pos = param; + } - void GetPosToLand(float &x, float &y, float &z) - { - switch (pos) - { - case 235431: x = -9445.1f; y = 63.27f; z = 58.16f; break; - case 235432: x = -5616.30f; y = -481.89f; z = 398.99f; break; - case 235433: x = -4198.1f; y = -12509.13f; z = 46.6f; break; - case 235434: x = 360.9f; y = -4735.5f; z = 11.773f; break; - case 235435: x = 2229.4f; y = 263.1f; z = 36.13f; break; - case 235436: x = 9532.9f; y = -6833.8f; z = 18.5f; break; - } - } + void GetPosToLand(float &x, float &y, float &z) + { + switch (pos) + { + case 235431: x = -9445.1f; y = 63.27f; z = 58.16f; break; + case 235432: x = -5616.30f; y = -481.89f; z = 398.99f; break; + case 235433: x = -4198.1f; y = -12509.13f; z = 46.6f; break; + case 235434: x = 360.9f; y = -4735.5f; z = 11.773f; break; + case 235435: x = 2229.4f; y = 263.1f; z = 36.13f; break; + case 235436: x = 9532.9f; y = -6833.8f; z = 18.5f; break; + } + } - void Reset() - { - unitList.clear(); - std::list temp; - me->GetCreaturesWithEntryInRange(temp, 100.0f, NPC_FIRE_TRIGGER); - for (std::list::const_iterator itr = temp.begin(); itr != temp.end(); ++itr) - unitList.push_back((*itr)->GetGUID()); + void Reset() + { + unitList.clear(); + std::list temp; + me->GetCreaturesWithEntryInRange(temp, 100.0f, NPC_FIRE_TRIGGER); + for (std::list::const_iterator itr = temp.begin(); itr != temp.end(); ++itr) + unitList.push_back((*itr)->GetGUID()); - events.ScheduleEvent(1, 3000); - events.ScheduleEvent(2, 5000); - events.ScheduleEvent(2, 7000); - events.ScheduleEvent(2, 10000); - events.ScheduleEvent(3, 15000); - } + events.ScheduleEvent(1, 3000); + events.ScheduleEvent(2, 5000); + events.ScheduleEvent(2, 7000); + events.ScheduleEvent(2, 10000); + events.ScheduleEvent(3, 15000); + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + void UpdateAI(uint32 diff) + { + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 1: - me->MonsterYell("Prepare yourselves, the bells have tolled! Shelter your weak, your young and your old! Each of you shall pay the final sum! Cry for mercy; the reckoning has come!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(11966); - events.PopEvent(); - break; - case 2: - { - if (Unit* trigger = getTrigger()) - me->CastSpell(trigger, SPELL_START_FIRE, true); - events.PopEvent(); - break; - } - case 3: - { - counter++; - if (counter > 10) - { - if (counter > 12) - { - bool failed = false; - for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - if (Unit* c = ObjectAccessor::GetUnit(*me, *itr)) - if (c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY)) - { - failed = true; - break; - } + switch (events.GetEvent()) + { + case 1: + me->MonsterYell("Prepare yourselves, the bells have tolled! Shelter your weak, your young and your old! Each of you shall pay the final sum! Cry for mercy; the reckoning has come!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(11966); + events.PopEvent(); + break; + case 2: + { + if (Unit* trigger = getTrigger()) + me->CastSpell(trigger, SPELL_START_FIRE, true); + events.PopEvent(); + break; + } + case 3: + { + counter++; + if (counter > 10) + { + if (counter > 12) + { + bool failed = false; + for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + if (Unit* c = ObjectAccessor::GetUnit(*me, *itr)) + if (c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY)) + { + failed = true; + break; + } - FinishEvent(failed); - events.PopEvent(); - } - return; - } - if (counter == 5) - me->MonsterYell("The sky is dark. The fire burns. You strive in vain as Fate's wheel turns.", LANG_UNIVERSAL, 0); - else if (counter == 10) - me->MonsterYell("The town still burns. A cleansing fire! Time is short, I'll soon retire!", LANG_UNIVERSAL, 0); + FinishEvent(failed); + events.PopEvent(); + } + return; + } + if (counter == 5) + me->MonsterYell("The sky is dark. The fire burns. You strive in vain as Fate's wheel turns.", LANG_UNIVERSAL, 0); + else if (counter == 10) + me->MonsterYell("The town still burns. A cleansing fire! Time is short, I'll soon retire!", LANG_UNIVERSAL, 0); - if (Unit* trigger = getTrigger()) - me->CastSpell(trigger, SPELL_START_FIRE, true); - events.RepeatEvent(12000); - break; - } - } + if (Unit* trigger = getTrigger()) + me->CastSpell(trigger, SPELL_START_FIRE, true); + events.RepeatEvent(12000); + break; + } + } - if (Unmount) - { - me->SetUInt32Value(UNIT_FIELD_FLAGS, 0); - me->RemoveAllAuras(); - me->Dismount(); - if (Unit* target = me->SelectNearestPlayer(30.0f)) - AttackStart(target); - } - if (me->IsMounted()) - return; + if (Unmount) + { + me->SetUInt32Value(UNIT_FIELD_FLAGS, 0); + me->RemoveAllAuras(); + me->Dismount(); + if (Unit* target = me->SelectNearestPlayer(30.0f)) + AttackStart(target); + } + if (me->IsMounted()) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - // cleave - if (!urand(0,29)) - me->CastSpell(me->GetVictim(), 15496, false); + // cleave + if (!urand(0,29)) + me->CastSpell(me->GetVictim(), 15496, false); - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - Unit* getTrigger() - { - std::list tmpList; - for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - if (Unit* c = ObjectAccessor::GetUnit(*me, *itr)) - if (!c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY)) - tmpList.push_back(c); + Unit* getTrigger() + { + std::list tmpList; + for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + if (Unit* c = ObjectAccessor::GetUnit(*me, *itr)) + if (!c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY)) + tmpList.push_back(c); - if (tmpList.empty()) - return NULL; + if (tmpList.empty()) + return NULL; - std::list::const_iterator it2 = tmpList.begin(); - std::advance(it2, urand(0, tmpList.size() - 1)); - return (*it2); - } + std::list::const_iterator it2 = tmpList.begin(); + std::advance(it2, urand(0, tmpList.size() - 1)); + return (*it2); + } - void FinishEvent(bool failed) - { - if (failed) - { - me->MonsterYell("Fire consumes! You've tried and failed. Let there be no doubt, justice prevailed!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(11967); - for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - if (Unit* c = ObjectAccessor::GetUnit(*me, *itr)) - c->RemoveAllAuras(); + void FinishEvent(bool failed) + { + if (failed) + { + me->MonsterYell("Fire consumes! You've tried and failed. Let there be no doubt, justice prevailed!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(11967); + for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + if (Unit* c = ObjectAccessor::GetUnit(*me, *itr)) + c->RemoveAllAuras(); - me->DespawnOrUnsummon(1); - } - else - { - me->MonsterYell("My flames have died, left not a spark! I shall send you now to the lifeless dark!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(11968); - float x, y, z; - GetPosToLand(x, y, z); - me->GetMotionMaster()->MovePoint(8, x, y, z); - } - } + me->DespawnOrUnsummon(1); + } + else + { + me->MonsterYell("My flames have died, left not a spark! I shall send you now to the lifeless dark!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(11968); + float x, y, z; + GetPosToLand(x, y, z); + me->GetMotionMaster()->MovePoint(8, x, y, z); + } + } - void MovementInform(uint32 type, uint32 point) - { - if (type == POINT_MOTION_TYPE && point == 8) - { - Unmount = true; - } - } + void MovementInform(uint32 type, uint32 point) + { + if (type == POINT_MOTION_TYPE && point == 8) + { + Unmount = true; + } + } - void JustDied(Unit* killer) - { - me->MonsterYell("So eager you are, for my blood to spill. Yet to vanquish me, 'tis my head you must kill!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(11969); - float x, y, z; - GetPosToLand(x, y, z); - me->CastSpell(x, y, z, SPELL_SUMMON_LANTERN, true); - CompleteQuest(); - } + void JustDied(Unit* killer) + { + me->MonsterYell("So eager you are, for my blood to spill. Yet to vanquish me, 'tis my head you must kill!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(11969); + float x, y, z; + GetPosToLand(x, y, z); + me->CastSpell(x, y, z, SPELL_SUMMON_LANTERN, true); + CompleteQuest(); + } - void CompleteQuest() - { - float radius = 100.0f; - std::list players; - Trinity::AnyPlayerInObjectRangeCheck checker(me, radius); - Trinity::PlayerListSearcher searcher(me, players, checker); - me->VisitNearbyWorldObject(radius, searcher); + void CompleteQuest() + { + float radius = 100.0f; + std::list players; + Trinity::AnyPlayerInObjectRangeCheck checker(me, radius); + Trinity::PlayerListSearcher searcher(me, players, checker); + me->VisitNearbyWorldObject(radius, searcher); - for (std::list::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - (*itr)->AreaExploredOrEventHappens(QUEST_STOP_THE_FIRES_H); - (*itr)->AreaExploredOrEventHappens(QUEST_STOP_THE_FIRES_A); - (*itr)->AreaExploredOrEventHappens(QUEST_LET_THE_FIRES_COME_H); - (*itr)->AreaExploredOrEventHappens(QUEST_LET_THE_FIRES_COME_A); - } - } + for (std::list::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + (*itr)->AreaExploredOrEventHappens(QUEST_STOP_THE_FIRES_H); + (*itr)->AreaExploredOrEventHappens(QUEST_STOP_THE_FIRES_A); + (*itr)->AreaExploredOrEventHappens(QUEST_LET_THE_FIRES_COME_H); + (*itr)->AreaExploredOrEventHappens(QUEST_LET_THE_FIRES_COME_A); + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -784,36 +784,36 @@ class npc_hallows_end_train_fire : public CreatureScript { } - uint32 timer; - void Reset() - { - timer = 0; - } + uint32 timer; + void Reset() + { + timer = 0; + } - void UpdateAI(uint32 diff) - { - timer += diff; - if (timer >= 5000) - if (!me->GetAuraEffect(SPELL_FIRE_AURA_BASE, EFFECT_0)) - me->CastSpell(me, SPELL_FIRE_AURA_BASE, true); - } + void UpdateAI(uint32 diff) + { + timer += diff; + if (timer >= 5000) + if (!me->GetAuraEffect(SPELL_FIRE_AURA_BASE, EFFECT_0)) + me->CastSpell(me, SPELL_FIRE_AURA_BASE, true); + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_WATER_SPLASH && caster->ToPlayer()) - { - if (AuraEffect* aurEff = me->GetAuraEffect(SPELL_FIRE_AURA_BASE, EFFECT_0)) - { - int32 amt = aurEff->GetAmount(); - if (amt > 1) - aurEff->SetAmount(amt-1); - else - me->RemoveAllAuras(); + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_WATER_SPLASH && caster->ToPlayer()) + { + if (AuraEffect* aurEff = me->GetAuraEffect(SPELL_FIRE_AURA_BASE, EFFECT_0)) + { + int32 amt = aurEff->GetAmount(); + if (amt > 1) + aurEff->SetAmount(amt-1); + else + me->RemoveAllAuras(); - caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(), 0); - } - } - } + caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(), 0); + } + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -828,61 +828,61 @@ class npc_hallows_end_train_fire : public CreatureScript enum headlessHorseman { - // NPCs - NPC_HEADLESS_HORSEMAN_MOUNTED = 23682, - NPC_HORSEMAN_HEAD = 23775, - NPC_PUMPKIN_FIEND = 23545, - NPC_PUMPKIN = 23694, + // NPCs + NPC_HEADLESS_HORSEMAN_MOUNTED = 23682, + NPC_HORSEMAN_HEAD = 23775, + NPC_PUMPKIN_FIEND = 23545, + NPC_PUMPKIN = 23694, - // Spells - SPELL_SHAKE_CAMERA_MEDIUM = 42909, - SPELL_SHAKE_CAMERA_SMALL = 42910, - SPELL_HORSEMAN_VISUAL = 42575, - SPELL_SUMMONING_RHYME_TARGET = 42878, - SPELL_HEAD_VISUAL = 42413, - SPELL_EARTH_EXPLOSION = 42427, - SPELL_HORSEMAN_CLEAVE = 42587, - SPELL_HORSEMAN_BODY_REGEN = 42403, - SPELL_HORSEMAN_BODY_REGEN_CONFUSE = 43105, - SPELL_HORSEMAN_IMMUNITY = 42556, - SPELL_HEAD_DAMAGED_INFO = 43101, - SPELL_BODY_RESTORED_INFO = 42405, - SPELL_HEAD_VISUAL_LAND = 44241, - SPELL_THROW_HEAD = 42399, - SPELL_THROW_HEAD_BACK = 42401, - SPELL_HORSEMAN_BODY_PHASE = 42547, - SPELL_HORSEMAN_SPEAKS = 43129, - SPELL_HORSEMAN_WHIRLWIND = 43116, - SPELL_HORSEMAN_CONFLAGRATION = 42380, - SPELL_SUMMON_PUMPKIN = 42552, - SPELL_PUMPKIN_VISUAL = 42280, - SPELL_SQUASH_SOUL = 42514, - SPELL_SPROUTING = 42281, - SPELL_PUMPKIN_AURA = 42294, - SPELL_BURNING_BODY = 43184, + // Spells + SPELL_SHAKE_CAMERA_MEDIUM = 42909, + SPELL_SHAKE_CAMERA_SMALL = 42910, + SPELL_HORSEMAN_VISUAL = 42575, + SPELL_SUMMONING_RHYME_TARGET = 42878, + SPELL_HEAD_VISUAL = 42413, + SPELL_EARTH_EXPLOSION = 42427, + SPELL_HORSEMAN_CLEAVE = 42587, + SPELL_HORSEMAN_BODY_REGEN = 42403, + SPELL_HORSEMAN_BODY_REGEN_CONFUSE = 43105, + SPELL_HORSEMAN_IMMUNITY = 42556, + SPELL_HEAD_DAMAGED_INFO = 43101, + SPELL_BODY_RESTORED_INFO = 42405, + SPELL_HEAD_VISUAL_LAND = 44241, + SPELL_THROW_HEAD = 42399, + SPELL_THROW_HEAD_BACK = 42401, + SPELL_HORSEMAN_BODY_PHASE = 42547, + SPELL_HORSEMAN_SPEAKS = 43129, + SPELL_HORSEMAN_WHIRLWIND = 43116, + SPELL_HORSEMAN_CONFLAGRATION = 42380, + SPELL_SUMMON_PUMPKIN = 42552, + SPELL_PUMPKIN_VISUAL = 42280, + SPELL_SQUASH_SOUL = 42514, + SPELL_SPROUTING = 42281, + SPELL_PUMPKIN_AURA = 42294, + SPELL_BURNING_BODY = 43184, - // NP - SPELL_HORSEMAN_SMOKE = 42355, - SPELL_SPIRIT_PARTICLES_GREEN_CHEST = 43161, - SPELL_SPIRIT_PARTICLES_GREEN = 43167, + // NP + SPELL_HORSEMAN_SMOKE = 42355, + SPELL_SPIRIT_PARTICLES_GREEN_CHEST = 43161, + SPELL_SPIRIT_PARTICLES_GREEN = 43167, - // Events - EVENT_HH_PLAYER_TALK = 1, - EVENT_HORSEMAN_CLEAVE = 2, - EVENT_HORSEMAN_WHIRLWIND = 3, - EVENT_HORSEMAN_CHECK_HEALTH = 4, - EVENT_HORSEMAN_CONFLAGRATION = 5, - EVENT_SUMMON_PUMPKIN = 6, - EVENT_HORSEMAN_FOLLOW = 7, + // Events + EVENT_HH_PLAYER_TALK = 1, + EVENT_HORSEMAN_CLEAVE = 2, + EVENT_HORSEMAN_WHIRLWIND = 3, + EVENT_HORSEMAN_CHECK_HEALTH = 4, + EVENT_HORSEMAN_CONFLAGRATION = 5, + EVENT_SUMMON_PUMPKIN = 6, + EVENT_HORSEMAN_FOLLOW = 7, }; enum hhSounds { - SOUND_AGGRO = 11961, - SOUND_SLAY = 11962, - SOUND_SPROUT = 11963, - SOUND_DEATH = 11964, + SOUND_AGGRO = 11961, + SOUND_SLAY = 11962, + SOUND_SPROUT = 11963, + SOUND_DEATH = 11964, }; class boss_headless_horseman : public CreatureScript @@ -896,261 +896,261 @@ class boss_headless_horseman : public CreatureScript { } - EventMap events; - SummonList summons; - uint64 playerGUID; - uint8 talkCount; - bool inFight; - uint8 phase; - uint32 health; + EventMap events; + SummonList summons; + uint64 playerGUID; + uint8 talkCount; + bool inFight; + uint8 phase; + uint32 health; - void JustDied(Unit* killer) - { - summons.DespawnAll(); - me->MonsterSay("This end have I reached before. What new adventure lies in store?", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_DEATH); - std::list unitList; - me->GetCreaturesWithEntryInRange(unitList, 100.0f, NPC_PUMPKIN_FIEND); - for (std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - (*itr)->ToCreature()->DespawnOrUnsummon(500); + void JustDied(Unit* killer) + { + summons.DespawnAll(); + me->MonsterSay("This end have I reached before. What new adventure lies in store?", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_DEATH); + std::list unitList; + me->GetCreaturesWithEntryInRange(unitList, 100.0f, NPC_PUMPKIN_FIEND); + for (std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + (*itr)->ToCreature()->DespawnOrUnsummon(500); - - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (!players.isEmpty() && players.begin()->GetSource() && players.begin()->GetSource()->GetGroup()) - sLFGMgr->FinishDungeon(players.begin()->GetSource()->GetGroup()->GetGUID(), 285, me->FindMap()); - } + + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (!players.isEmpty() && players.begin()->GetSource() && players.begin()->GetSource()->GetGroup()) + sLFGMgr->FinishDungeon(players.begin()->GetSource()->GetGroup()->GetGUID(), 285, me->FindMap()); + } - void KilledUnit(Unit* who) - { - me->MonsterYell("Your body lies beaten, battered and broken. Let my curse be your own, fate has spoken.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SLAY); - } + void KilledUnit(Unit* who) + { + me->MonsterYell("Your body lies beaten, battered and broken. Let my curse be your own, fate has spoken.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SLAY); + } - void DoAction(int32 param) - { - health = param; - } + void DoAction(int32 param) + { + health = param; + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_SUMMONING_RHYME_TARGET) - { - playerGUID = target->GetGUID(); - events.ScheduleEvent(EVENT_HH_PLAYER_TALK, 2000); - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_SUMMONING_RHYME_TARGET) + { + playerGUID = target->GetGUID(); + events.ScheduleEvent(EVENT_HH_PLAYER_TALK, 2000); + } + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_THROW_HEAD_BACK) - { - me->SetHealth(me->GetMaxHealth()); - me->CastSpell(me, SPELL_HEAD_VISUAL, true); - me->RemoveAura(SPELL_HORSEMAN_IMMUNITY); - me->RemoveAura(SPELL_HORSEMAN_BODY_REGEN); - me->RemoveAura(SPELL_HORSEMAN_BODY_REGEN_CONFUSE); - me->RemoveAura(SPELL_HORSEMAN_WHIRLWIND); - events.CancelEvent(EVENT_HORSEMAN_CHECK_HEALTH); - events.CancelEvent(EVENT_HORSEMAN_WHIRLWIND); - events.CancelEvent(EVENT_HORSEMAN_CONFLAGRATION); - events.CancelEvent(EVENT_SUMMON_PUMPKIN); - me->MonsterYell("Here's my body, fit and pure! Now, your blackened souls I'll cure!", LANG_UNIVERSAL, 0); - - if (phase == 1) - events.ScheduleEvent(EVENT_HORSEMAN_CONFLAGRATION, 6000); - else if (phase == 2) - events.ScheduleEvent(EVENT_SUMMON_PUMPKIN, 6000); - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_THROW_HEAD_BACK) + { + me->SetHealth(me->GetMaxHealth()); + me->CastSpell(me, SPELL_HEAD_VISUAL, true); + me->RemoveAura(SPELL_HORSEMAN_IMMUNITY); + me->RemoveAura(SPELL_HORSEMAN_BODY_REGEN); + me->RemoveAura(SPELL_HORSEMAN_BODY_REGEN_CONFUSE); + me->RemoveAura(SPELL_HORSEMAN_WHIRLWIND); + events.CancelEvent(EVENT_HORSEMAN_CHECK_HEALTH); + events.CancelEvent(EVENT_HORSEMAN_WHIRLWIND); + events.CancelEvent(EVENT_HORSEMAN_CONFLAGRATION); + events.CancelEvent(EVENT_SUMMON_PUMPKIN); + me->MonsterYell("Here's my body, fit and pure! Now, your blackened souls I'll cure!", LANG_UNIVERSAL, 0); + + if (phase == 1) + events.ScheduleEvent(EVENT_HORSEMAN_CONFLAGRATION, 6000); + else if (phase == 2) + events.ScheduleEvent(EVENT_SUMMON_PUMPKIN, 6000); + } + } - void MovementInform(uint32 type, uint32 point) - { - if (type == WAYPOINT_MOTION_TYPE) - { - if (point == 0) - me->CastSpell(me, SPELL_HEAD_VISUAL, true); - else if (point == 11) - { - me->SetUInt32Value(UNIT_FIELD_FLAGS, 0); - me->StopMoving(); - - me->SetInCombatWithZone(); - inFight = true; - events.ScheduleEvent(EVENT_HORSEMAN_FOLLOW, 500); - events.ScheduleEvent(EVENT_HORSEMAN_CLEAVE, 7000); - } - } - } + void MovementInform(uint32 type, uint32 point) + { + if (type == WAYPOINT_MOTION_TYPE) + { + if (point == 0) + me->CastSpell(me, SPELL_HEAD_VISUAL, true); + else if (point == 11) + { + me->SetUInt32Value(UNIT_FIELD_FLAGS, 0); + me->StopMoving(); + + me->SetInCombatWithZone(); + inFight = true; + events.ScheduleEvent(EVENT_HORSEMAN_FOLLOW, 500); + events.ScheduleEvent(EVENT_HORSEMAN_CLEAVE, 7000); + } + } + } - Player* GetRhymePlayer() { return playerGUID ? ObjectAccessor::GetPlayer(*me, playerGUID) : NULL; } + Player* GetRhymePlayer() { return playerGUID ? ObjectAccessor::GetPlayer(*me, playerGUID) : NULL; } - void EnterCombat(Unit*) { me->SetInCombatWithZone(); } - void MoveInLineOfSight(Unit* who) {} + void EnterCombat(Unit*) { me->SetInCombatWithZone(); } + void MoveInLineOfSight(Unit* who) {} - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - // We die... :( - if (damage >= me->GetHealth()) - { - damage = 0; - me->RemoveAura(SPELL_HEAD_VISUAL); - me->CastSpell(me, SPELL_HORSEMAN_IMMUNITY, true); - me->CastSpell(me, SPELL_HORSEMAN_BODY_REGEN, true); - me->CastSpell(me, SPELL_HORSEMAN_BODY_REGEN_CONFUSE, true); - events.CancelEvent(EVENT_HORSEMAN_CLEAVE); + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + // We die... :( + if (damage >= me->GetHealth()) + { + damage = 0; + me->RemoveAura(SPELL_HEAD_VISUAL); + me->CastSpell(me, SPELL_HORSEMAN_IMMUNITY, true); + me->CastSpell(me, SPELL_HORSEMAN_BODY_REGEN, true); + me->CastSpell(me, SPELL_HORSEMAN_BODY_REGEN_CONFUSE, true); + events.CancelEvent(EVENT_HORSEMAN_CLEAVE); - // Summon Head - Position pos; - me->GetNearPosition(pos, 15.0f, rand_norm()*2*M_PI); - if (Creature* cr = me->SummonCreature(NPC_HORSEMAN_HEAD, pos)) - { - if (health) - cr->SetHealth(health); + // Summon Head + Position pos; + me->GetNearPosition(pos, 15.0f, rand_norm()*2*M_PI); + if (Creature* cr = me->SummonCreature(NPC_HORSEMAN_HEAD, pos)) + { + if (health) + cr->SetHealth(health); - me->CastSpell(cr, SPELL_THROW_HEAD, true); - cr->CastSpell(cr, SPELL_HORSEMAN_BODY_PHASE+phase, true); - if (phase < 2) - phase++; + me->CastSpell(cr, SPELL_THROW_HEAD, true); + cr->CastSpell(cr, SPELL_HORSEMAN_BODY_PHASE+phase, true); + if (phase < 2) + phase++; - events.ScheduleEvent(EVENT_HORSEMAN_WHIRLWIND, 6000); - events.ScheduleEvent(EVENT_HORSEMAN_CHECK_HEALTH, 1000); - } - } - } + events.ScheduleEvent(EVENT_HORSEMAN_WHIRLWIND, 6000); + events.ScheduleEvent(EVENT_HORSEMAN_CHECK_HEALTH, 1000); + } + } + } - void JustSummoned(Creature* cr) { summons.Summon(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - playerGUID = 0; - talkCount = 0; - phase = 0; - inFight = false; - health = 0; - - me->SetDisableGravity(true); - me->SetSpeed(MOVE_WALK, 5.0f, true); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + playerGUID = 0; + talkCount = 0; + phase = 0; + inFight = false; + health = 0; + + me->SetDisableGravity(true); + me->SetSpeed(MOVE_WALK, 5.0f, true); + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + void UpdateAI(uint32 diff) + { + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (inFight && !UpdateVictim()) - return; + if (inFight && !UpdateVictim()) + return; - switch (events.GetEvent()) - { - case EVENT_HH_PLAYER_TALK: - { - talkCount++; - Player* player = GetRhymePlayer(); - if (!player) - return; + switch (events.GetEvent()) + { + case EVENT_HH_PLAYER_TALK: + { + talkCount++; + Player* player = GetRhymePlayer(); + if (!player) + return; - switch (talkCount) - { - case 1: - player->MonsterSay("Horseman rise...", LANG_UNIVERSAL, 0); - break; - case 2: - player->MonsterSay("Your time is nigh...", LANG_UNIVERSAL, 0); - if (Creature* trigger = me->SummonTrigger(1765.28f, 1347.46f, 17.5514f, 0.0f, 15*IN_MILLISECONDS)) - trigger->CastSpell(trigger, SPELL_EARTH_EXPLOSION, true); - break; - case 3: - me->GetMotionMaster()->MovePath(236820, false); - me->CastSpell(me, SPELL_SHAKE_CAMERA_SMALL, true); - player->MonsterSay("You felt death once...", LANG_UNIVERSAL, 0); - me->MonsterSay("It is over, your search is done. Let fate choose now, the righteous one.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_AGGRO); - break; - case 4: - me->CastSpell(me, SPELL_SHAKE_CAMERA_MEDIUM, true); - player->MonsterSay("Now, know demise!", LANG_UNIVERSAL, 0); - events.PopEvent(); - talkCount = 0; - return; // pop and return, skip repeat - } - events.RepeatEvent(2000); - break; - } - case EVENT_HORSEMAN_FOLLOW: - { - if (Player* player = GetRhymePlayer()) - { - me->GetMotionMaster()->MoveIdle(); - AttackStart(player); - me->GetMotionMaster()->MoveChase(player); - } - events.PopEvent(); - break; - } - case EVENT_HORSEMAN_CLEAVE: - { - me->CastSpell(me->GetVictim(), SPELL_HORSEMAN_CLEAVE, false); - events.RepeatEvent(8000); - break; - } - case EVENT_HORSEMAN_WHIRLWIND: - { - if (me->HasAuraEffect(SPELL_HORSEMAN_WHIRLWIND, EFFECT_0)) - { - me->RemoveAura(SPELL_HORSEMAN_WHIRLWIND); - events.RepeatEvent(15000); - break; - } - me->CastSpell(me, SPELL_HORSEMAN_WHIRLWIND, true); - events.RepeatEvent(6000); - break; - } - case EVENT_HORSEMAN_CHECK_HEALTH: - { - if (me->GetHealth() == me->GetMaxHealth()) - { - me->CastSpell(me, SPELL_BODY_RESTORED_INFO, true); - events.PopEvent(); - return; - } + switch (talkCount) + { + case 1: + player->MonsterSay("Horseman rise...", LANG_UNIVERSAL, 0); + break; + case 2: + player->MonsterSay("Your time is nigh...", LANG_UNIVERSAL, 0); + if (Creature* trigger = me->SummonTrigger(1765.28f, 1347.46f, 17.5514f, 0.0f, 15*IN_MILLISECONDS)) + trigger->CastSpell(trigger, SPELL_EARTH_EXPLOSION, true); + break; + case 3: + me->GetMotionMaster()->MovePath(236820, false); + me->CastSpell(me, SPELL_SHAKE_CAMERA_SMALL, true); + player->MonsterSay("You felt death once...", LANG_UNIVERSAL, 0); + me->MonsterSay("It is over, your search is done. Let fate choose now, the righteous one.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_AGGRO); + break; + case 4: + me->CastSpell(me, SPELL_SHAKE_CAMERA_MEDIUM, true); + player->MonsterSay("Now, know demise!", LANG_UNIVERSAL, 0); + events.PopEvent(); + talkCount = 0; + return; // pop and return, skip repeat + } + events.RepeatEvent(2000); + break; + } + case EVENT_HORSEMAN_FOLLOW: + { + if (Player* player = GetRhymePlayer()) + { + me->GetMotionMaster()->MoveIdle(); + AttackStart(player); + me->GetMotionMaster()->MoveChase(player); + } + events.PopEvent(); + break; + } + case EVENT_HORSEMAN_CLEAVE: + { + me->CastSpell(me->GetVictim(), SPELL_HORSEMAN_CLEAVE, false); + events.RepeatEvent(8000); + break; + } + case EVENT_HORSEMAN_WHIRLWIND: + { + if (me->HasAuraEffect(SPELL_HORSEMAN_WHIRLWIND, EFFECT_0)) + { + me->RemoveAura(SPELL_HORSEMAN_WHIRLWIND); + events.RepeatEvent(15000); + break; + } + me->CastSpell(me, SPELL_HORSEMAN_WHIRLWIND, true); + events.RepeatEvent(6000); + break; + } + case EVENT_HORSEMAN_CHECK_HEALTH: + { + if (me->GetHealth() == me->GetMaxHealth()) + { + me->CastSpell(me, SPELL_BODY_RESTORED_INFO, true); + events.PopEvent(); + return; + } - events.RepeatEvent(1000); - break; - } - case EVENT_HORSEMAN_CONFLAGRATION: - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_HORSEMAN_CONFLAGRATION, false); + events.RepeatEvent(1000); + break; + } + case EVENT_HORSEMAN_CONFLAGRATION: + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_HORSEMAN_CONFLAGRATION, false); - events.RepeatEvent(12500); - break; - } - case EVENT_SUMMON_PUMPKIN: - { - if (talkCount < 4) - { - events.RepeatEvent(1); - talkCount++; - me->CastSpell(me, SPELL_SUMMON_PUMPKIN, false); - } - else - { - me->MonsterSay("Soldiers arise, stand and fight! Bring victory at last to this fallen knight!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SPROUT); - events.RepeatEvent(15000); - talkCount = 0; - } + events.RepeatEvent(12500); + break; + } + case EVENT_SUMMON_PUMPKIN: + { + if (talkCount < 4) + { + events.RepeatEvent(1); + talkCount++; + me->CastSpell(me, SPELL_SUMMON_PUMPKIN, false); + } + else + { + me->MonsterSay("Soldiers arise, stand and fight! Bring victory at last to this fallen knight!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SPROUT); + events.RepeatEvent(15000); + talkCount = 0; + } - break; - } - } + break; + } + } - if (inFight) - DoMeleeAttackIfReady(); - } + if (inFight) + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -1170,114 +1170,114 @@ class boss_headless_horseman_head : public CreatureScript { } - uint8 pct; - uint32 timer; - bool handled; + uint8 pct; + uint32 timer; + bool handled; - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_THROW_HEAD_BACK) - { - if (Unit* owner = GetOwner()) - owner->ToCreature()->AI()->DoAction(me->GetHealth()); + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_THROW_HEAD_BACK) + { + if (Unit* owner = GetOwner()) + owner->ToCreature()->AI()->DoAction(me->GetHealth()); - me->DespawnOrUnsummon(); - } - } + me->DespawnOrUnsummon(); + } + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - switch (spellInfo->Id) - { - case SPELL_BODY_RESTORED_INFO: - me->RemoveAllAuras(); - if (Unit* owner = GetOwner()) - owner->RemoveAura(SPELL_HORSEMAN_IMMUNITY); - me->CastSpell(caster, SPELL_THROW_HEAD_BACK, true); - break; - case SPELL_THROW_HEAD: - { - me->CastSpell(me, SPELL_HEAD_VISUAL_LAND, true); - if (Player* player = me->SelectNearestPlayer(50.0f)) - me->GetMotionMaster()->MoveFleeing(player); + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + switch (spellInfo->Id) + { + case SPELL_BODY_RESTORED_INFO: + me->RemoveAllAuras(); + if (Unit* owner = GetOwner()) + owner->RemoveAura(SPELL_HORSEMAN_IMMUNITY); + me->CastSpell(caster, SPELL_THROW_HEAD_BACK, true); + break; + case SPELL_THROW_HEAD: + { + me->CastSpell(me, SPELL_HEAD_VISUAL_LAND, true); + if (Player* player = me->SelectNearestPlayer(50.0f)) + me->GetMotionMaster()->MoveFleeing(player); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - timer = 26000; - break; - } - case SPELL_HORSEMAN_BODY_PHASE: - pct = 67; - break; - case SPELL_HORSEMAN_BODY_PHASE+1: - pct = 34; - break; - case SPELL_HORSEMAN_BODY_PHASE+2: - pct = 0; - break; - } - } + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + timer = 26000; + break; + } + case SPELL_HORSEMAN_BODY_PHASE: + pct = 67; + break; + case SPELL_HORSEMAN_BODY_PHASE+1: + pct = 34; + break; + case SPELL_HORSEMAN_BODY_PHASE+2: + pct = 0; + break; + } + } - Unit* GetOwner() - { - if (me->ToTempSummon()) - return me->ToTempSummon()->GetSummoner(); + Unit* GetOwner() + { + if (me->ToTempSummon()) + return me->ToTempSummon()->GetSummoner(); - return NULL; - } + return NULL; + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - // We die... :( - if (damage >= me->GetHealth()) - { - if (Unit* owner = GetOwner()) - { - owner->CastSpell(owner, SPELL_BURNING_BODY, true); - Unit::Kill(me, owner); - } - damage = 0; - me->DespawnOrUnsummon(); - return; - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + // We die... :( + if (damage >= me->GetHealth()) + { + if (Unit* owner = GetOwner()) + { + owner->CastSpell(owner, SPELL_BURNING_BODY, true); + Unit::Kill(me, owner); + } + damage = 0; + me->DespawnOrUnsummon(); + return; + } - if (me->HealthBelowPctDamaged(pct, damage) && !handled) - { - handled = true; - damage = 0; - me->RemoveAllAuras(); - me->CastSpell(me, SPELL_HEAD_DAMAGED_INFO, true); - me->CastSpell(me, SPELL_THROW_HEAD_BACK, true); - if (Unit* owner = GetOwner()) - owner->RemoveAura(SPELL_HORSEMAN_IMMUNITY); - } - } + if (me->HealthBelowPctDamaged(pct, damage) && !handled) + { + handled = true; + damage = 0; + me->RemoveAllAuras(); + me->CastSpell(me, SPELL_HEAD_DAMAGED_INFO, true); + me->CastSpell(me, SPELL_THROW_HEAD_BACK, true); + if (Unit* owner = GetOwner()) + owner->RemoveAura(SPELL_HORSEMAN_IMMUNITY); + } + } - void Reset() - { - pct = 0; - timer = 0; - handled = false; - me->SetInCombatWithZone(); - } + void Reset() + { + pct = 0; + timer = 0; + handled = false; + me->SetInCombatWithZone(); + } - void UpdateAI(uint32 diff) - { - timer += diff; - if (timer >= 30000) - { - timer = urand(0, 15000); - uint32 sound = 11965; - switch (urand(0,2)) - { - case 1: sound = 11975; break; - case 2: sound = 11976; break; - } + void UpdateAI(uint32 diff) + { + timer += diff; + if (timer >= 30000) + { + timer = urand(0, 15000); + uint32 sound = 11965; + switch (urand(0,2)) + { + case 1: sound = 11975; break; + case 2: sound = 11976; break; + } me->CastSpell(me, SPELL_HORSEMAN_SPEAKS, true); me->MonsterTextEmote("Headless Horseman laughs", 0); - me->PlayDirectSound(sound); - } - } + me->PlayDirectSound(sound); + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -1297,43 +1297,43 @@ class boss_headless_horseman_pumpkin : public CreatureScript { } - uint32 timer; + uint32 timer; - void AttackStart(Unit* ) { } - void MoveInLineOfSight(Unit* ) { } + void AttackStart(Unit* ) { } + void MoveInLineOfSight(Unit* ) { } - void Reset() - { - if (Player* player = me->SelectNearestPlayer(3.0f)) - me->CastSpell(player, SPELL_SQUASH_SOUL, true); - timer = 1; - me->CastSpell(me, SPELL_PUMPKIN_AURA, true); - me->CastSpell(me, SPELL_PUMPKIN_VISUAL, true); - } + void Reset() + { + if (Player* player = me->SelectNearestPlayer(3.0f)) + me->CastSpell(player, SPELL_SQUASH_SOUL, true); + timer = 1; + me->CastSpell(me, SPELL_PUMPKIN_AURA, true); + me->CastSpell(me, SPELL_PUMPKIN_VISUAL, true); + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_SPROUTING) - { - if (Creature* cr = me->SummonCreature(NPC_PUMPKIN_FIEND, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - cr->SetInCombatWithZone(); + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_SPROUTING) + { + if (Creature* cr = me->SummonCreature(NPC_PUMPKIN_FIEND, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + cr->SetInCombatWithZone(); - me->DespawnOrUnsummon(); - } - } + me->DespawnOrUnsummon(); + } + } - void UpdateAI(uint32 diff) - { - if (timer) - { - timer += diff; - if (timer >= 3000) - { - me->CastSpell(me, SPELL_SPROUTING, false); - timer = 0; - } - } - } + void UpdateAI(uint32 diff) + { + if (timer) + { + timer += diff; + if (timer >= 3000) + { + me->CastSpell(me, SPELL_SPROUTING, false); + timer = 0; + } + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -1350,7 +1350,7 @@ public: bool OnQuestReward(Player* player, GameObject* go, Quest const* /*quest*/, uint32 /*opt*/) { if (player->FindNearestCreature(NPC_HEADLESS_HORSEMAN_MOUNTED, 100.0f)) - return true; + return true; if (Creature* horseman = go->SummonCreature(NPC_HEADLESS_HORSEMAN_MOUNTED, 1754.00f, 1346.00f, 17.50f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0)) horseman->CastSpell(player, SPELL_SUMMONING_RHYME_TARGET, true); @@ -1361,29 +1361,29 @@ public: void AddSC_event_hallows_end_scripts() { - // Spells + // Spells new spell_hallows_end_trick(); new spell_hallows_end_trick_or_treat(); - new spell_hallows_end_candy(); - new spell_hallows_end_tricky_treat(); - new spell_hallows_end_put_costume("spell_hallows_end_pirate_costume", SPELL_PIRATE_COSTUME_MALE, SPELL_PIRATE_COSTUME_FEMALE); - new spell_hallows_end_put_costume("spell_hallows_end_leper_costume", SPELL_LEPER_GNOME_COSTUME_MALE, SPELL_LEPER_GNOME_COSTUME_FEMALE); - new spell_hallows_end_put_costume("spell_hallows_end_ghost_costume", SPELL_GHOST_COSTUME_MALE, SPELL_GHOST_COSTUME_FEMALE); - new spell_hallows_end_put_costume("spell_hallows_end_ninja_costume", SPELL_NINJA_COSTUME_MALE, SPELL_NINJA_COSTUME_FEMALE); - - // Quests - new npc_hallows_end_train_fire(); + new spell_hallows_end_candy(); + new spell_hallows_end_tricky_treat(); + new spell_hallows_end_put_costume("spell_hallows_end_pirate_costume", SPELL_PIRATE_COSTUME_MALE, SPELL_PIRATE_COSTUME_FEMALE); + new spell_hallows_end_put_costume("spell_hallows_end_leper_costume", SPELL_LEPER_GNOME_COSTUME_MALE, SPELL_LEPER_GNOME_COSTUME_FEMALE); + new spell_hallows_end_put_costume("spell_hallows_end_ghost_costume", SPELL_GHOST_COSTUME_MALE, SPELL_GHOST_COSTUME_FEMALE); + new spell_hallows_end_put_costume("spell_hallows_end_ninja_costume", SPELL_NINJA_COSTUME_MALE, SPELL_NINJA_COSTUME_FEMALE); + + // Quests + new npc_hallows_end_train_fire(); - // Event - new npc_costumed_orphan_matron(); - new npc_soh_fire_trigger(); - new npc_hallows_end_soh(); - new spell_hallows_end_base_fire(); - new spell_hallows_end_bucket_lands(); + // Event + new npc_costumed_orphan_matron(); + new npc_soh_fire_trigger(); + new npc_hallows_end_soh(); + new spell_hallows_end_base_fire(); + new spell_hallows_end_bucket_lands(); - // Headless Horseman - new go_loosely_turned_soil(); - new boss_headless_horseman(); - new boss_headless_horseman_head(); - new boss_headless_horseman_pumpkin(); + // Headless Horseman + new go_loosely_turned_soil(); + new boss_headless_horseman(); + new boss_headless_horseman_head(); + new boss_headless_horseman_pumpkin(); } diff --git a/src/server/scripts/Events/love_in_air.cpp b/src/server/scripts/Events/love_in_air.cpp index 6908527f2..fa7a01671 100644 --- a/src/server/scripts/Events/love_in_air.cpp +++ b/src/server/scripts/Events/love_in_air.cpp @@ -20,12 +20,12 @@ enum Spells { - SPELL_GOBLIN_DISGUISE = 71450, - SPELL_GOBLIN_ALLY_COMPLETE = 71522, - SPELL_GOBLIN_HORDE_COMPLETE = 71539, - SPELL_GOBLIN_CARRY_CRATE = 71459, + SPELL_GOBLIN_DISGUISE = 71450, + SPELL_GOBLIN_ALLY_COMPLETE = 71522, + SPELL_GOBLIN_HORDE_COMPLETE = 71539, + SPELL_GOBLIN_CARRY_CRATE = 71459, - NPC_SOMETHING_STINKS_CREDIT = 37558, + NPC_SOMETHING_STINKS_CREDIT = 37558, }; class npc_love_in_air_supply_sentry : public CreatureScript @@ -39,31 +39,31 @@ class npc_love_in_air_supply_sentry : public CreatureScript { } - uint32 lock; + uint32 lock; void MoveInLineOfSight(Unit* who) - { - if (lock > 1000 && me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->HasAura(SPELL_GOBLIN_DISGUISE) && !who->HasAura(SPELL_GOBLIN_CARRY_CRATE)) - { - lock = 0; - if (urand(0,1)) - me->MonsterSay("Time is money, friend. Go go go!", LANG_UNIVERSAL, who->ToPlayer()); - else - me->MonsterSay("That crate won't deliver itself, friend. Get a move on!", LANG_UNIVERSAL, who->ToPlayer()); + { + if (lock > 1000 && me->GetDistance(who) < 10.0f && who->GetTypeId() == TYPEID_PLAYER && who->HasAura(SPELL_GOBLIN_DISGUISE) && !who->HasAura(SPELL_GOBLIN_CARRY_CRATE)) + { + lock = 0; + if (urand(0,1)) + me->MonsterSay("Time is money, friend. Go go go!", LANG_UNIVERSAL, who->ToPlayer()); + else + me->MonsterSay("That crate won't deliver itself, friend. Get a move on!", LANG_UNIVERSAL, who->ToPlayer()); - if (who->ToPlayer()->GetTeamId() == TEAM_ALLIANCE) - who->CastSpell(who, SPELL_GOBLIN_ALLY_COMPLETE, true); - else - who->CastSpell(who, SPELL_GOBLIN_HORDE_COMPLETE, true); + if (who->ToPlayer()->GetTeamId() == TEAM_ALLIANCE) + who->CastSpell(who, SPELL_GOBLIN_ALLY_COMPLETE, true); + else + who->CastSpell(who, SPELL_GOBLIN_HORDE_COMPLETE, true); - me->CastSpell(who, SPELL_GOBLIN_CARRY_CRATE, true); - } - } + me->CastSpell(who, SPELL_GOBLIN_CARRY_CRATE, true); + } + } - void UpdateAI(uint32 diff) - { - lock += diff; - } + void UpdateAI(uint32 diff) + { + lock += diff; + } }; CreatureAI* GetAI(Creature* creature) const @@ -74,15 +74,15 @@ class npc_love_in_air_supply_sentry : public CreatureScript enum hotOnTrail { - QUEST_HOT_ON_TRAIL_ALLY = 24849, - QUEST_HOT_ON_TRAIL_HORDE = 24851, + QUEST_HOT_ON_TRAIL_ALLY = 24849, + QUEST_HOT_ON_TRAIL_HORDE = 24851, - NPC_SNIVEL_ALLY = 38334, - NPC_SNIVEL_COUNTER = 38340, + NPC_SNIVEL_ALLY = 38334, + NPC_SNIVEL_COUNTER = 38340, - NPC_SNIVEL_HORDE = 38337, + NPC_SNIVEL_HORDE = 38337, - SPELL_SNIVEL_GUN = 71715, + SPELL_SNIVEL_GUN = 71715, }; const uint32 spellTable[6] = {71713, 71745, 71752, 71759, 71760, 71758}; @@ -98,46 +98,46 @@ class npc_love_in_air_snivel : public CreatureScript { } - int32 delay; + int32 delay; - void Reset() - { - delay = 0; - me->SetReactState(REACT_AGGRESSIVE); - } + void Reset() + { + delay = 0; + me->SetReactState(REACT_AGGRESSIVE); + } - bool AllowAction(Player* player) - { - uint16 slot = player->FindQuestSlot(player->GetTeamId() == TEAM_ALLIANCE ? QUEST_HOT_ON_TRAIL_ALLY : QUEST_HOT_ON_TRAIL_HORDE); - if (slot >= MAX_QUEST_LOG_SIZE) - return false; + bool AllowAction(Player* player) + { + uint16 slot = player->FindQuestSlot(player->GetTeamId() == TEAM_ALLIANCE ? QUEST_HOT_ON_TRAIL_ALLY : QUEST_HOT_ON_TRAIL_HORDE); + if (slot >= MAX_QUEST_LOG_SIZE) + return false; - QuestStatusData& qData = player->getQuestStatusMap()[(player->GetTeamId() == TEAM_ALLIANCE ? QUEST_HOT_ON_TRAIL_ALLY : QUEST_HOT_ON_TRAIL_HORDE)]; - if (qData.CreatureOrGOCount[me->GetEntry() - NPC_SNIVEL_COUNTER] == 0) - return true; + QuestStatusData& qData = player->getQuestStatusMap()[(player->GetTeamId() == TEAM_ALLIANCE ? QUEST_HOT_ON_TRAIL_ALLY : QUEST_HOT_ON_TRAIL_HORDE)]; + if (qData.CreatureOrGOCount[me->GetEntry() - NPC_SNIVEL_COUNTER] == 0) + return true; - return false; - } + return false; + } void MoveInLineOfSight(Unit* who) - { - if (delay == 0 && me->GetDistance(who) < 7.0f && who->GetTypeId() == TYPEID_PLAYER) - { - Player* plr = who->ToPlayer(); - if (AllowAction(plr)) - { - delay = 25000; - uint8 index = plr->GetTeamId()*3 + (me->GetEntry() - NPC_SNIVEL_COUNTER); - plr->CastSpell(plr, spellTable[index], true); - } - } - } + { + if (delay == 0 && me->GetDistance(who) < 7.0f && who->GetTypeId() == TYPEID_PLAYER) + { + Player* plr = who->ToPlayer(); + if (AllowAction(plr)) + { + delay = 25000; + uint8 index = plr->GetTeamId()*3 + (me->GetEntry() - NPC_SNIVEL_COUNTER); + plr->CastSpell(plr, spellTable[index], true); + } + } + } - void UpdateAI(uint32 diff) - { - if (delay > 0) - delay -= std::min(delay, diff); - } + void UpdateAI(uint32 diff) + { + if (delay > 0) + delay -= std::min(delay, diff); + } }; CreatureAI* GetAI(Creature* creature) const @@ -155,73 +155,73 @@ class npc_love_in_air_snivel_real : public CreatureScript { npc_love_in_air_snivel_realAI(Creature* creature) : ScriptedAI(creature) { - actionTimer = 7000; - actionCounter = 0; + actionTimer = 7000; + actionCounter = 0; } - uint32 actionTimer; - uint32 actionCounter; + uint32 actionTimer; + uint32 actionCounter; - bool Talk(uint32 time) - { - switch (me->GetEntry()) - { - case NPC_SNIVEL_ALLY: - case NPC_SNIVEL_HORDE: - { - switch (time) - { - case 1: me->MonsterSay("What are you staring at? Haven't you ever seen a genius before?", LANG_UNIVERSAL, 0); return false; - case 2: me->MonsterSay("This'll teach you to mind your own business!", LANG_UNIVERSAL, 0); return true; - } - break; - } - case NPC_SNIVEL_ALLY+1: - case NPC_SNIVEL_HORDE+1: - { - switch (time) - { - case 1: me->MonsterSay("That's right. I'd like to list some of these 'fireworks'.", LANG_UNIVERSAL, 0); return false; - case 2: me->MonsterSay("Those'll net me a nice profit when I return from the South Seas.", LANG_UNIVERSAL, 0); return false; - case 3: me->MonsterSay("You... Don't think I don't see you. Leave me alone!", LANG_UNIVERSAL, 0); return true; - } - break; - } + bool Talk(uint32 time) + { + switch (me->GetEntry()) + { + case NPC_SNIVEL_ALLY: + case NPC_SNIVEL_HORDE: + { + switch (time) + { + case 1: me->MonsterSay("What are you staring at? Haven't you ever seen a genius before?", LANG_UNIVERSAL, 0); return false; + case 2: me->MonsterSay("This'll teach you to mind your own business!", LANG_UNIVERSAL, 0); return true; + } + break; + } + case NPC_SNIVEL_ALLY+1: + case NPC_SNIVEL_HORDE+1: + { + switch (time) + { + case 1: me->MonsterSay("That's right. I'd like to list some of these 'fireworks'.", LANG_UNIVERSAL, 0); return false; + case 2: me->MonsterSay("Those'll net me a nice profit when I return from the South Seas.", LANG_UNIVERSAL, 0); return false; + case 3: me->MonsterSay("You... Don't think I don't see you. Leave me alone!", LANG_UNIVERSAL, 0); return true; + } + break; + } - case NPC_SNIVEL_ALLY+2: - case NPC_SNIVEL_HORDE+2: - { - switch (time) - { - case 1: me->MonsterSay("Thanks for the great cut and shave, buddy.", LANG_UNIVERSAL, 0); return false; - case 2: me->MonsterSay("Here's a little something extra since I'll be away.", LANG_UNIVERSAL, 0); return false; - case 3: me->MonsterSay("On second thought, keep the whole bag. I have to, uh, get going.", LANG_UNIVERSAL, 0); return false; - case 4: me->MonsterSay("Did you really think you could corner me this easily?", LANG_UNIVERSAL, 0); return true; - } - break; - } - } + case NPC_SNIVEL_ALLY+2: + case NPC_SNIVEL_HORDE+2: + { + switch (time) + { + case 1: me->MonsterSay("Thanks for the great cut and shave, buddy.", LANG_UNIVERSAL, 0); return false; + case 2: me->MonsterSay("Here's a little something extra since I'll be away.", LANG_UNIVERSAL, 0); return false; + case 3: me->MonsterSay("On second thought, keep the whole bag. I have to, uh, get going.", LANG_UNIVERSAL, 0); return false; + case 4: me->MonsterSay("Did you really think you could corner me this easily?", LANG_UNIVERSAL, 0); return true; + } + break; + } + } - return true; - } + return true; + } - void UpdateAI(uint32 diff) - { - actionTimer += diff; - if (actionTimer >= 7000) - { - actionTimer = 0; - actionCounter++; - if (Talk(actionCounter)) - { - if (me->ToTempSummon()) - if (Unit* owner = me->ToTempSummon()->GetSummoner()) - me->CastSpell(owner, SPELL_SNIVEL_GUN, true); + void UpdateAI(uint32 diff) + { + actionTimer += diff; + if (actionTimer >= 7000) + { + actionTimer = 0; + actionCounter++; + if (Talk(actionCounter)) + { + if (me->ToTempSummon()) + if (Unit* owner = me->ToTempSummon()->GetSummoner()) + me->CastSpell(owner, SPELL_SNIVEL_GUN, true); - me->DespawnOrUnsummon(1000); - } - } - } + me->DespawnOrUnsummon(1000); + } + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -236,31 +236,31 @@ class npc_love_in_air_snivel_real : public CreatureScript enum hummel { - QUEST_YOUVE_BEEN_SERVED = 14488, - NPC_APOTHECARY_HUMMEL = 36296, - NPC_APOTHECARY_FRYE = 36272, - NPC_APOTHECARY_BAXTER = 36565, + QUEST_YOUVE_BEEN_SERVED = 14488, + NPC_APOTHECARY_HUMMEL = 36296, + NPC_APOTHECARY_FRYE = 36272, + NPC_APOTHECARY_BAXTER = 36565, - SPELL_COLOGNE_IMMUNE = 68530, - SPELL_COLOGNE_PASSIVE_DAMAGE = 68947, - SPELL_PERFUME_PASSIVE_DAMAGE = 68641, + SPELL_COLOGNE_IMMUNE = 68530, + SPELL_COLOGNE_PASSIVE_DAMAGE = 68947, + SPELL_PERFUME_PASSIVE_DAMAGE = 68641, - SPELL_THROW_COLOGNE = 68614, - SPELL_THROW_PERFUME = 68798, + SPELL_THROW_COLOGNE = 68614, + SPELL_THROW_PERFUME = 68798, - // Real fight - SPELL_COLOGNE_SPRAY = 68948, - SPELL_ALLURING_PERFUME_SPRAY = 68607, - SPELL_CHAIN_REACTION = 68821, + // Real fight + SPELL_COLOGNE_SPRAY = 68948, + SPELL_ALLURING_PERFUME_SPRAY = 68607, + SPELL_CHAIN_REACTION = 68821, - ACTION_START_EVENT = 1, - ACTION_RELEASE_HELPER = 2, + ACTION_START_EVENT = 1, + ACTION_RELEASE_HELPER = 2, - EVENT_CALL_BAXTER = 1, - EVENT_CALL_FRYE = 2, - EVENT_SPELL_PERFUME_SPRAY = 3, - EVENT_SPELL_CHAIN_REACTION = 4, - EVENT_SPELL_THROW = 5, + EVENT_CALL_BAXTER = 1, + EVENT_CALL_FRYE = 2, + EVENT_SPELL_PERFUME_SPRAY = 3, + EVENT_SPELL_CHAIN_REACTION = 4, + EVENT_SPELL_THROW = 5, }; class npc_love_in_air_hummel : public CreatureScript @@ -274,112 +274,112 @@ class npc_love_in_air_hummel : public CreatureScript { } - SummonList summons; - EventMap events; - uint32 speachTimer; + SummonList summons; + EventMap events; + uint32 speachTimer; - void Reset() - { - speachTimer = 0; - me->setFaction(35); - summons.DespawnAll(); - events.Reset(); - me->SummonCreature(NPC_APOTHECARY_FRYE, -205.449f, 2219.56f, 79.7633f, 0.7f); - me->SummonCreature(NPC_APOTHECARY_BAXTER, -209.602f, 2215.42f, 79.7633f, 0.723503f); - } + void Reset() + { + speachTimer = 0; + me->setFaction(35); + summons.DespawnAll(); + events.Reset(); + me->SummonCreature(NPC_APOTHECARY_FRYE, -205.449f, 2219.56f, 79.7633f, 0.7f); + me->SummonCreature(NPC_APOTHECARY_BAXTER, -209.602f, 2215.42f, 79.7633f, 0.723503f); + } - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT) - speachTimer = 1; - } + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT) + speachTimer = 1; + } - void JustDied(Unit* ) - { - me->MonsterSay("...please don't think less of me.", LANG_UNIVERSAL, 0); - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (!players.isEmpty() && players.begin()->GetSource() && players.begin()->GetSource()->GetGroup()) - sLFGMgr->FinishDungeon(players.begin()->GetSource()->GetGroup()->GetGUID(), 288, me->FindMap()); - } + void JustDied(Unit* ) + { + me->MonsterSay("...please don't think less of me.", LANG_UNIVERSAL, 0); + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (!players.isEmpty() && players.begin()->GetSource() && players.begin()->GetSource()->GetGroup()) + sLFGMgr->FinishDungeon(players.begin()->GetSource()->GetGroup()->GetGUID(), 288, me->FindMap()); + } - void JustSummoned(Creature* cr) - { - summons.Summon(cr); - cr->setFaction(35); - cr->SetControlled(true, UNIT_STATE_STUNNED); - cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + void JustSummoned(Creature* cr) + { + summons.Summon(cr); + cr->setFaction(35); + cr->SetControlled(true, UNIT_STATE_STUNNED); + cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - void UpdateAI(uint32 diff) - { - if (speachTimer) - { - speachTimer += diff; - if (speachTimer < 10000) - { - me->MonsterSay("Did they bother to tell you who I am and why I am doing this?", LANG_UNIVERSAL, 0); - speachTimer = 10000; - } - else if (speachTimer >= 16000 && speachTimer < 20000) - { - me->MonsterSay("...or are they just using you like they do everybody else?", LANG_UNIVERSAL, 0); - speachTimer = 20000; - } - else if (speachTimer >= 26000 && speachTimer < 30000) - { - me->MonsterSay("But what does it matter. It is time for this to end.", LANG_UNIVERSAL, 0); - speachTimer = 0; - me->setFaction(16); - me->SetInCombatWithZone(); - if (Unit* target = SelectTargetFromPlayerList(40.0f)) - { - AttackStart(target); - events.ScheduleEvent(EVENT_CALL_BAXTER, 10000); - events.ScheduleEvent(EVENT_CALL_FRYE, 20000); - events.ScheduleEvent(EVENT_SPELL_PERFUME_SPRAY, 7000); - events.ScheduleEvent(EVENT_SPELL_CHAIN_REACTION, 12000); - } - else - EnterEvadeMode(); - } - return; - } + void UpdateAI(uint32 diff) + { + if (speachTimer) + { + speachTimer += diff; + if (speachTimer < 10000) + { + me->MonsterSay("Did they bother to tell you who I am and why I am doing this?", LANG_UNIVERSAL, 0); + speachTimer = 10000; + } + else if (speachTimer >= 16000 && speachTimer < 20000) + { + me->MonsterSay("...or are they just using you like they do everybody else?", LANG_UNIVERSAL, 0); + speachTimer = 20000; + } + else if (speachTimer >= 26000 && speachTimer < 30000) + { + me->MonsterSay("But what does it matter. It is time for this to end.", LANG_UNIVERSAL, 0); + speachTimer = 0; + me->setFaction(16); + me->SetInCombatWithZone(); + if (Unit* target = SelectTargetFromPlayerList(40.0f)) + { + AttackStart(target); + events.ScheduleEvent(EVENT_CALL_BAXTER, 10000); + events.ScheduleEvent(EVENT_CALL_FRYE, 20000); + events.ScheduleEvent(EVENT_SPELL_PERFUME_SPRAY, 7000); + events.ScheduleEvent(EVENT_SPELL_CHAIN_REACTION, 12000); + } + else + EnterEvadeMode(); + } + return; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_CALL_BAXTER: - { - EntryCheckPredicate pred(NPC_APOTHECARY_BAXTER); - summons.DoAction(ACTION_RELEASE_HELPER, pred); - events.PopEvent(); - break; - } - case EVENT_CALL_FRYE: - { - EntryCheckPredicate pred(NPC_APOTHECARY_FRYE); - summons.DoAction(ACTION_RELEASE_HELPER, pred); - events.PopEvent(); - break; - } - case EVENT_SPELL_PERFUME_SPRAY: - me->CastSpell(me->GetVictim(), SPELL_ALLURING_PERFUME_SPRAY, false); - events.RepeatEvent(6000); - break; - case EVENT_SPELL_CHAIN_REACTION: - me->CastSpell(me->GetVictim(), SPELL_CHAIN_REACTION, false); - events.RepeatEvent(12000); - break; - } + switch (events.GetEvent()) + { + case EVENT_CALL_BAXTER: + { + EntryCheckPredicate pred(NPC_APOTHECARY_BAXTER); + summons.DoAction(ACTION_RELEASE_HELPER, pred); + events.PopEvent(); + break; + } + case EVENT_CALL_FRYE: + { + EntryCheckPredicate pred(NPC_APOTHECARY_FRYE); + summons.DoAction(ACTION_RELEASE_HELPER, pred); + events.PopEvent(); + break; + } + case EVENT_SPELL_PERFUME_SPRAY: + me->CastSpell(me->GetVictim(), SPELL_ALLURING_PERFUME_SPRAY, false); + events.RepeatEvent(6000); + break; + case EVENT_SPELL_CHAIN_REACTION: + me->CastSpell(me->GetVictim(), SPELL_CHAIN_REACTION, false); + events.RepeatEvent(12000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -387,13 +387,13 @@ class npc_love_in_air_hummel : public CreatureScript return new npc_love_in_air_hummelAI(creature); } - bool OnQuestReward(Player* /*player*/, Creature* creature, const Quest *_Quest, uint32 /*slot*/) - { - if (_Quest->GetQuestId() == QUEST_YOUVE_BEEN_SERVED) - creature->AI()->DoAction(ACTION_START_EVENT); + bool OnQuestReward(Player* /*player*/, Creature* creature, const Quest *_Quest, uint32 /*slot*/) + { + if (_Quest->GetQuestId() == QUEST_YOUVE_BEEN_SERVED) + creature->AI()->DoAction(ACTION_START_EVENT); - return true; - } + return true; + } }; class npc_love_in_air_hummel_helper : public CreatureScript @@ -407,69 +407,69 @@ class npc_love_in_air_hummel_helper : public CreatureScript { } - EventMap events; + EventMap events; - void Reset() - { - } + void Reset() + { + } - void DoAction(int32 param) - { - if (param == ACTION_RELEASE_HELPER) - { - me->SetControlled(false, UNIT_STATE_STUNNED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setFaction(16); - me->SetInCombatWithZone(); - if (Unit* target = SelectTargetFromPlayerList(40.0f)) - AttackStart(target); + void DoAction(int32 param) + { + if (param == ACTION_RELEASE_HELPER) + { + me->SetControlled(false, UNIT_STATE_STUNNED); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->setFaction(16); + me->SetInCombatWithZone(); + if (Unit* target = SelectTargetFromPlayerList(40.0f)) + AttackStart(target); - if (me->GetEntry() == NPC_APOTHECARY_BAXTER) - { - events.ScheduleEvent(EVENT_SPELL_PERFUME_SPRAY, 7000); - events.ScheduleEvent(EVENT_SPELL_CHAIN_REACTION, 12000); - } - else - events.ScheduleEvent(EVENT_SPELL_THROW, 5000); - } - } + if (me->GetEntry() == NPC_APOTHECARY_BAXTER) + { + events.ScheduleEvent(EVENT_SPELL_PERFUME_SPRAY, 7000); + events.ScheduleEvent(EVENT_SPELL_CHAIN_REACTION, 12000); + } + else + events.ScheduleEvent(EVENT_SPELL_THROW, 5000); + } + } - void JustDied(Unit* ) { me->MonsterSay("...please don't think less of me.", LANG_UNIVERSAL, 0); } + void JustDied(Unit* ) { me->MonsterSay("...please don't think less of me.", LANG_UNIVERSAL, 0); } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_PERFUME_SPRAY: - me->CastSpell(me->GetVictim(), SPELL_COLOGNE_SPRAY, false); - events.RepeatEvent(6000); - break; - case EVENT_SPELL_CHAIN_REACTION: - me->CastSpell(me->GetVictim(), SPELL_CHAIN_REACTION, false); - events.RepeatEvent(12000); - break; - case EVENT_SPELL_THROW: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - { - Position pos(*me); - me->Relocate(target); - me->CastSpell(me, RAND(SPELL_THROW_COLOGNE, SPELL_THROW_PERFUME), true, NULL, NULL, me->GetGUID()); - me->Relocate(pos); - } - events.RepeatEvent(10000); - break; - } + switch (events.GetEvent()) + { + case EVENT_SPELL_PERFUME_SPRAY: + me->CastSpell(me->GetVictim(), SPELL_COLOGNE_SPRAY, false); + events.RepeatEvent(6000); + break; + case EVENT_SPELL_CHAIN_REACTION: + me->CastSpell(me->GetVictim(), SPELL_CHAIN_REACTION, false); + events.RepeatEvent(12000); + break; + case EVENT_SPELL_THROW: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + { + Position pos(*me); + me->Relocate(target); + me->CastSpell(me, RAND(SPELL_THROW_COLOGNE, SPELL_THROW_PERFUME), true, NULL, NULL, me->GetGUID()); + me->Relocate(pos); + } + events.RepeatEvent(10000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -483,55 +483,55 @@ class spell_love_in_air_perfume_immune : public SpellScriptLoader public: spell_love_in_air_perfume_immune() : SpellScriptLoader("spell_love_in_air_perfume_immune") { } - class spell_love_in_air_perfume_immune_AuraScript : public AuraScript - { - PrepareAuraScript(spell_love_in_air_perfume_immune_AuraScript); + class spell_love_in_air_perfume_immune_AuraScript : public AuraScript + { + PrepareAuraScript(spell_love_in_air_perfume_immune_AuraScript); - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (GetId() == SPELL_COLOGNE_IMMUNE) - { - target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_PASSIVE_DAMAGE, true); - target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_SPRAY, true); - target->ApplySpellImmune(68934, IMMUNITY_ID, 68934, true); - } - else - { - target->ApplySpellImmune(SPELL_PERFUME_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_PERFUME_PASSIVE_DAMAGE, true); - target->ApplySpellImmune(SPELL_ALLURING_PERFUME_SPRAY, IMMUNITY_ID, SPELL_ALLURING_PERFUME_SPRAY, true); - target->ApplySpellImmune(68927, IMMUNITY_ID, 68927, true); - } - } + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (GetId() == SPELL_COLOGNE_IMMUNE) + { + target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_PASSIVE_DAMAGE, true); + target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_SPRAY, true); + target->ApplySpellImmune(68934, IMMUNITY_ID, 68934, true); + } + else + { + target->ApplySpellImmune(SPELL_PERFUME_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_PERFUME_PASSIVE_DAMAGE, true); + target->ApplySpellImmune(SPELL_ALLURING_PERFUME_SPRAY, IMMUNITY_ID, SPELL_ALLURING_PERFUME_SPRAY, true); + target->ApplySpellImmune(68927, IMMUNITY_ID, 68927, true); + } + } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (GetId() == SPELL_COLOGNE_IMMUNE) - { - target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_PASSIVE_DAMAGE, false); - target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_SPRAY, false); - target->ApplySpellImmune(68934, IMMUNITY_ID, 68934, false); - } - else - { - target->ApplySpellImmune(SPELL_PERFUME_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_PERFUME_PASSIVE_DAMAGE, false); - target->ApplySpellImmune(SPELL_PERFUME_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_ALLURING_PERFUME_SPRAY, false); - target->ApplySpellImmune(68927, IMMUNITY_ID, 68927, false); - } - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (GetId() == SPELL_COLOGNE_IMMUNE) + { + target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_PASSIVE_DAMAGE, false); + target->ApplySpellImmune(SPELL_COLOGNE_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_COLOGNE_SPRAY, false); + target->ApplySpellImmune(68934, IMMUNITY_ID, 68934, false); + } + else + { + target->ApplySpellImmune(SPELL_PERFUME_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_PERFUME_PASSIVE_DAMAGE, false); + target->ApplySpellImmune(SPELL_PERFUME_PASSIVE_DAMAGE, IMMUNITY_ID, SPELL_ALLURING_PERFUME_SPRAY, false); + target->ApplySpellImmune(68927, IMMUNITY_ID, 68927, false); + } + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_love_in_air_perfume_immune_AuraScript::HandleEffectApply, EFFECT_2, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_love_in_air_perfume_immune_AuraScript::HandleEffectRemove, EFFECT_2, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_love_in_air_perfume_immune_AuraScript::HandleEffectApply, EFFECT_2, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_love_in_air_perfume_immune_AuraScript::HandleEffectRemove, EFFECT_2, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_love_in_air_perfume_immune_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_love_in_air_perfume_immune_AuraScript(); + } }; class spell_love_in_air_periodic_perfumes : public SpellScriptLoader @@ -539,33 +539,33 @@ class spell_love_in_air_periodic_perfumes : public SpellScriptLoader public: spell_love_in_air_periodic_perfumes() : SpellScriptLoader("spell_love_in_air_periodic_perfumes") { } - class spell_love_in_air_periodic_perfumes_AuraScript : public AuraScript - { - PrepareAuraScript(spell_love_in_air_periodic_perfumes_AuraScript); + class spell_love_in_air_periodic_perfumes_AuraScript : public AuraScript + { + PrepareAuraScript(spell_love_in_air_periodic_perfumes_AuraScript); - void PeriodicTick(AuraEffect const* /*aurEff*/) + void PeriodicTick(AuraEffect const* /*aurEff*/) { - uint64 guid = (GetCaster() ? GetCaster()->GetGUID() : 0); + uint64 guid = (GetCaster() ? GetCaster()->GetGUID() : 0); if (Unit* target = GetTarget()) - { - uint32 spellId = (GetId() == SPELL_THROW_COLOGNE ? 68934 : 68927); - if (target->IsImmunedToSpell(sSpellMgr->GetSpellInfo(spellId))) - return; + { + uint32 spellId = (GetId() == SPELL_THROW_COLOGNE ? 68934 : 68927); + if (target->IsImmunedToSpell(sSpellMgr->GetSpellInfo(spellId))) + return; - target->CastSpell(target, spellId, true, NULL, NULL, guid); - } + target->CastSpell(target, spellId, true, NULL, NULL, guid); + } } void Register() { OnEffectPeriodic += AuraEffectPeriodicFn(spell_love_in_air_periodic_perfumes_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } - }; + }; - AuraScript* GetAuraScript() const - { - return new spell_love_in_air_periodic_perfumes_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_love_in_air_periodic_perfumes_AuraScript(); + } }; /////////////////////////////////////// @@ -759,19 +759,19 @@ class spell_gen_aura_service_uniform : public SpellScriptLoader void AddSC_event_love_in_the_air() { - // Npcs - new npc_love_in_air_supply_sentry(); - new npc_love_in_air_snivel(); - new npc_love_in_air_snivel_real(); + // Npcs + new npc_love_in_air_supply_sentry(); + new npc_love_in_air_snivel(); + new npc_love_in_air_snivel_real(); - // Boss - new npc_love_in_air_hummel(); - new npc_love_in_air_hummel_helper(); - new spell_love_in_air_perfume_immune(); - new spell_love_in_air_periodic_perfumes(); + // Boss + new npc_love_in_air_hummel(); + new npc_love_in_air_hummel_helper(); + new spell_love_in_air_perfume_immune(); + new spell_love_in_air_periodic_perfumes(); - // Spells - new spell_item_create_heart_candy(); - new spell_love_is_in_the_air_romantic_picnic(); - new spell_gen_aura_service_uniform(); + // Spells + new spell_item_create_heart_candy(); + new spell_love_is_in_the_air_romantic_picnic(); + new spell_gen_aura_service_uniform(); } \ No newline at end of file diff --git a/src/server/scripts/Events/midsummer.cpp b/src/server/scripts/Events/midsummer.cpp index 4e701b10d..8fce374e7 100644 --- a/src/server/scripts/Events/midsummer.cpp +++ b/src/server/scripts/Events/midsummer.cpp @@ -10,10 +10,10 @@ enum eBonfire { - GO_MIDSUMMER_BONFIRE = 181288, + GO_MIDSUMMER_BONFIRE = 181288, - SPELL_STAMP_OUT_BONFIRE = 45437, - SPELL_LIGHT_BONFIRE = 29831, + SPELL_STAMP_OUT_BONFIRE = 45437, + SPELL_LIGHT_BONFIRE = 29831, }; class go_midsummer_bonfire : public GameObjectScript @@ -24,8 +24,8 @@ public: bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 action) { player->CLOSE_GOSSIP_MENU(); - // we know that there is only one gossip. - player->CastSpell(player, SPELL_STAMP_OUT_BONFIRE, true); + // we know that there is only one gossip. + player->CastSpell(player, SPELL_STAMP_OUT_BONFIRE, true); return true; } }; @@ -38,39 +38,39 @@ class npc_midsummer_bonfire : public CreatureScript struct npc_midsummer_bonfireAI : public ScriptedAI { npc_midsummer_bonfireAI(Creature* c) : ScriptedAI(c) - { - me->IsAIEnabled = true; - goGUID = 0; - if (GameObject* go = me->SummonGameObject(GO_MIDSUMMER_BONFIRE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0)) - { - goGUID = go->GetGUID(); - me->RemoveGameObject(go, false); - } - } - - uint64 goGUID; + { + me->IsAIEnabled = true; + goGUID = 0; + if (GameObject* go = me->SummonGameObject(GO_MIDSUMMER_BONFIRE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0)) + { + goGUID = go->GetGUID(); + me->RemoveGameObject(go, false); + } + } + + uint64 goGUID; - void SpellHit(Unit*, SpellInfo const* spellInfo) - { - if (!goGUID) - return; + void SpellHit(Unit*, SpellInfo const* spellInfo) + { + if (!goGUID) + return; - // Extinguish fire - if (spellInfo->Id == SPELL_STAMP_OUT_BONFIRE) - { - if (GameObject* go = ObjectAccessor::GetGameObject(*me, goGUID)) - go->SetPhaseMask(2, true); - } - else if (spellInfo->Id == SPELL_LIGHT_BONFIRE) - { - if (GameObject* go = ObjectAccessor::GetGameObject(*me, goGUID)) - { - go->SetPhaseMask(1, true); - go->SendCustomAnim(1); - } - } + // Extinguish fire + if (spellInfo->Id == SPELL_STAMP_OUT_BONFIRE) + { + if (GameObject* go = ObjectAccessor::GetGameObject(*me, goGUID)) + go->SetPhaseMask(2, true); + } + else if (spellInfo->Id == SPELL_LIGHT_BONFIRE) + { + if (GameObject* go = ObjectAccessor::GetGameObject(*me, goGUID)) + { + go->SetPhaseMask(1, true); + go->SendCustomAnim(1); + } + } - } + } }; CreatureAI* GetAI(Creature* creature) const @@ -87,107 +87,107 @@ class npc_midsummer_torch_target : public CreatureScript struct npc_midsummer_torch_targetAI : public ScriptedAI { npc_midsummer_torch_targetAI(Creature* c) : ScriptedAI(c) - { - teleTimer = 0; - startTimer = 1; - posVec.clear(); - playerGUID = 0; - me->CastSpell(me, 43313, true); - counter = 0; - maxCount = 0; - } + { + teleTimer = 0; + startTimer = 1; + posVec.clear(); + playerGUID = 0; + me->CastSpell(me, 43313, true); + counter = 0; + maxCount = 0; + } - uint64 playerGUID; - uint32 startTimer; - uint32 teleTimer; - std::vector posVec; - uint8 counter; - uint8 maxCount; + uint64 playerGUID; + uint32 startTimer; + uint32 teleTimer; + std::vector posVec; + uint8 counter; + uint8 maxCount; - void SetPlayerGUID(uint64 guid, uint8 cnt) - { - playerGUID = guid; - maxCount = cnt; - } + void SetPlayerGUID(uint64 guid, uint8 cnt) + { + playerGUID = guid; + maxCount = cnt; + } - bool CanBeSeen(Player const* seer) - { - return seer->GetGUID() == playerGUID; - } - - void SpellHit(Unit* caster, SpellInfo const* spellInfo) - { - if (posVec.empty()) - return; - // Triggered spell from torch - if (spellInfo->Id == 46054 && caster->GetTypeId() == TYPEID_PLAYER) - { - me->CastSpell(me, 45724, true); // hit visual anim - if (++counter >= maxCount) - { - caster->CastSpell(caster, (caster->ToPlayer()->GetTeamId() ? 46651 : 45719), true); // quest complete spell - me->DespawnOrUnsummon(1); - return; - } + bool CanBeSeen(Player const* seer) + { + return seer->GetGUID() == playerGUID; + } + + void SpellHit(Unit* caster, SpellInfo const* spellInfo) + { + if (posVec.empty()) + return; + // Triggered spell from torch + if (spellInfo->Id == 46054 && caster->GetTypeId() == TYPEID_PLAYER) + { + me->CastSpell(me, 45724, true); // hit visual anim + if (++counter >= maxCount) + { + caster->CastSpell(caster, (caster->ToPlayer()->GetTeamId() ? 46651 : 45719), true); // quest complete spell + me->DespawnOrUnsummon(1); + return; + } - teleTimer = 1; - } - } + teleTimer = 1; + } + } - void UpdateAI(uint32 diff) - { - if (startTimer) - { - startTimer += diff; - if (startTimer >= 200) - { - startTimer = 0; - FillPositions(); - SelectPosition(); - } - } - if (teleTimer) - { - teleTimer += diff; - if (teleTimer >= 750 && teleTimer < 10000) - { - teleTimer = 10000; - SelectPosition(); - } - else if (teleTimer >= 10500) - { - if (Player* plr = ObjectAccessor::GetPlayer(*me, playerGUID)) - plr->UpdateTriggerVisibility(); + void UpdateAI(uint32 diff) + { + if (startTimer) + { + startTimer += diff; + if (startTimer >= 200) + { + startTimer = 0; + FillPositions(); + SelectPosition(); + } + } + if (teleTimer) + { + teleTimer += diff; + if (teleTimer >= 750 && teleTimer < 10000) + { + teleTimer = 10000; + SelectPosition(); + } + else if (teleTimer >= 10500) + { + if (Player* plr = ObjectAccessor::GetPlayer(*me, playerGUID)) + plr->UpdateTriggerVisibility(); - teleTimer = 0; - } - } - } + teleTimer = 0; + } + } + } - void FillPositions() - { - std::list gobjList; - me->GetGameObjectListWithEntryInGrid(gobjList, 187708 /*TORCH_GO*/, 30.0f); - for (std::list::const_iterator itr = gobjList.begin(); itr != gobjList.end(); ++itr) - { - Position pos; - pos.Relocate(*itr); - posVec.push_back(pos); - } - } + void FillPositions() + { + std::list gobjList; + me->GetGameObjectListWithEntryInGrid(gobjList, 187708 /*TORCH_GO*/, 30.0f); + for (std::list::const_iterator itr = gobjList.begin(); itr != gobjList.end(); ++itr) + { + Position pos; + pos.Relocate(*itr); + posVec.push_back(pos); + } + } - void SelectPosition() - { - if (posVec.empty()) - return; - int8 num = urand(0, posVec.size()-1); - Position pos; - pos.Relocate(posVec.at(num)); - me->m_last_notify_position.Relocate(0.0f, 0.0f, 0.0f); - me->m_last_notify_mstime = World::GetGameTimeMS() + 10000; + void SelectPosition() + { + if (posVec.empty()) + return; + int8 num = urand(0, posVec.size()-1); + Position pos; + pos.Relocate(posVec.at(num)); + me->m_last_notify_position.Relocate(0.0f, 0.0f, 0.0f); + me->m_last_notify_mstime = World::GetGameTimeMS() + 10000; - me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); - } + me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); + } }; CreatureAI* GetAI(Creature* creature) const @@ -203,11 +203,11 @@ class npc_midsummer_torch_target : public CreatureScript enum RibbonPole { - SPELL_RIBBON_POLE_CHANNEL_VISUAL = 29172, - SPELL_RIBBON_POLE_XP = 29175, - SPELL_RIBBON_POLE_FIREWORKS = 46971, + SPELL_RIBBON_POLE_CHANNEL_VISUAL = 29172, + SPELL_RIBBON_POLE_XP = 29175, + SPELL_RIBBON_POLE_FIREWORKS = 46971, - NPC_RIBBON_POLE_DEBUG_TARGET = 17066, + NPC_RIBBON_POLE_DEBUG_TARGET = 17066, }; class spell_midsummer_ribbon_pole : public SpellScriptLoader @@ -219,47 +219,47 @@ public: { PrepareAuraScript(spell_midsummer_ribbon_pole_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) + void HandleEffectPeriodic(AuraEffect const * aurEff) { - PreventDefaultAction(); - if (Unit *target = GetTarget()) - { - Creature* cr = target->FindNearestCreature(NPC_RIBBON_POLE_DEBUG_TARGET, 10.0f); - if (!cr) - { - target->RemoveAura(SPELL_RIBBON_POLE_CHANNEL_VISUAL); - SetDuration(1); - return; - } + PreventDefaultAction(); + if (Unit *target = GetTarget()) + { + Creature* cr = target->FindNearestCreature(NPC_RIBBON_POLE_DEBUG_TARGET, 10.0f); + if (!cr) + { + target->RemoveAura(SPELL_RIBBON_POLE_CHANNEL_VISUAL); + SetDuration(1); + return; + } - if (Aura* aur = target->GetAura(SPELL_RIBBON_POLE_XP)) - aur->SetDuration(std::min(aur->GetDuration()+3*MINUTE*IN_MILLISECONDS, 60*MINUTE*IN_MILLISECONDS)); - else - target->CastSpell(target, SPELL_RIBBON_POLE_XP, true); + if (Aura* aur = target->GetAura(SPELL_RIBBON_POLE_XP)) + aur->SetDuration(std::min(aur->GetDuration()+3*MINUTE*IN_MILLISECONDS, 60*MINUTE*IN_MILLISECONDS)); + else + target->CastSpell(target, SPELL_RIBBON_POLE_XP, true); - if (roll_chance_i(5)) - { - cr->Relocate(cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ()-6.5f); - cr->CastSpell(cr, SPELL_RIBBON_POLE_FIREWORKS, true); - cr->Relocate(cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ()+6.5f); - } + if (roll_chance_i(5)) + { + cr->Relocate(cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ()-6.5f); + cr->CastSpell(cr, SPELL_RIBBON_POLE_FIREWORKS, true); + cr->Relocate(cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ()+6.5f); + } - // Achievement - if ((time(NULL) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER) - target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target); - } + // Achievement + if ((time(NULL) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER) + target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target); + } } - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* ar = GetTarget(); - ar->CastSpell(ar, SPELL_RIBBON_POLE_CHANNEL_VISUAL, true); + Unit* ar = GetTarget(); + ar->CastSpell(ar, SPELL_RIBBON_POLE_CHANNEL_VISUAL, true); } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_midsummer_ribbon_pole_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_midsummer_ribbon_pole_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectApply += AuraEffectApplyFn(spell_midsummer_ribbon_pole_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_midsummer_ribbon_pole_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -278,34 +278,34 @@ public: { PrepareAuraScript(spell_midsummer_torch_quest_AuraScript) - bool Load() - { - torchGUID = 0; - return true; - } - - uint64 torchGUID; - - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + bool Load() { - Unit* ar = GetTarget(); - if (Creature* cr = ar->SummonCreature(25535, ar->GetPositionX(), ar->GetPositionY(), ar->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000)) - { - torchGUID = cr->GetGUID(); - CAST_AI(npc_midsummer_torch_target::npc_midsummer_torch_targetAI, cr->AI())->SetPlayerGUID(ar->GetGUID(), (GetId() == 45716 ? 8 : 20)); - } + torchGUID = 0; + return true; } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + uint64 torchGUID; + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Creature* cr = ObjectAccessor::GetCreature(*GetTarget(), torchGUID)) - cr->DespawnOrUnsummon(1); + Unit* ar = GetTarget(); + if (Creature* cr = ar->SummonCreature(25535, ar->GetPositionX(), ar->GetPositionY(), ar->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000)) + { + torchGUID = cr->GetGUID(); + CAST_AI(npc_midsummer_torch_target::npc_midsummer_torch_targetAI, cr->AI())->SetPlayerGUID(ar->GetGUID(), (GetId() == 45716 ? 8 : 20)); + } + } + + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Creature* cr = ObjectAccessor::GetCreature(*GetTarget(), torchGUID)) + cr->DespawnOrUnsummon(1); } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_midsummer_torch_quest_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DETECT_AMORE, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_midsummer_torch_quest_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DETECT_AMORE, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_midsummer_torch_quest_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DETECT_AMORE, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_midsummer_torch_quest_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DETECT_AMORE, AURA_EFFECT_HANDLE_REAL); } }; @@ -317,12 +317,12 @@ public: enum flingTorch { - NPC_TORCH_TARGET = 26188, + NPC_TORCH_TARGET = 26188, - SPELL_FLING_TORCH = 45669, - SPELL_FLING_TORCH_DUMMY = 46747, - SPELL_MISSED_TORCH = 45676, - SPELL_TORCH_COUNTER = 45693, + SPELL_FLING_TORCH = 45669, + SPELL_FLING_TORCH_DUMMY = 46747, + SPELL_MISSED_TORCH = 45676, + SPELL_TORCH_COUNTER = 45693, }; class spell_midsummer_fling_torch : public SpellScriptLoader @@ -334,95 +334,95 @@ class spell_midsummer_fling_torch : public SpellScriptLoader { PrepareSpellScript(spell_midsummer_fling_torch_SpellScript); - bool handled; - bool Load() { handled = false; return true; } + bool handled; + bool Load() { handled = false; return true; } - void ThrowNextTorch(Unit* caster) - { - std::list crList; - caster->GetCreaturesWithEntryInRange(crList, 100.0f, NPC_TORCH_TARGET); - - uint8 rand = urand(0, crList.size()-1); - Position pos; - pos.Relocate(0.0f, 0.0f, 0.0f); - for (std::list::const_iterator itr = crList.begin(); itr != crList.end(); ++itr, --rand) - { - if (caster->GetDistance(*itr) < 5) - { - if (!rand) - rand++; - continue; - } - - if (!rand) - { - pos.Relocate(*itr); - break; - } - } - - // we have any pos - if (pos.GetPositionX()) - caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_FLING_TORCH, true); - } - - void HandleFinish() - { - Unit* caster = GetCaster(); - if (!caster || !caster->ToPlayer()) // caster cant be null, but meh :p - return; - - if (GetSpellInfo()->Id != SPELL_FLING_TORCH_DUMMY) - { - if (!handled) - if (const WorldLocation* loc = GetExplTargetDest()) - { - caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_MISSED_TORCH, true); - caster->RemoveAurasDueToSpell(SPELL_TORCH_COUNTER); - } - return; - } - - ThrowNextTorch(caster); - } - - void HandleScript(SpellEffIndex effIndex) + void ThrowNextTorch(Unit* caster) { - PreventHitDefaultEffect(effIndex); - if (Player* target = GetHitPlayer()) - { - if (target->GetGUID() != GetCaster()->GetGUID()) - return; + std::list crList; + caster->GetCreaturesWithEntryInRange(crList, 100.0f, NPC_TORCH_TARGET); - handled = true; - if (Aura* aur = target->GetAura(SPELL_TORCH_COUNTER)) - { - aur->ModStackAmount(1); - uint8 count = 4; - if (target->GetQuestStatus(target->GetTeamId() ? 11925 : 11924) == QUEST_STATUS_INCOMPLETE) // More Torch Catching quests - count = 10; + uint8 rand = urand(0, crList.size()-1); + Position pos; + pos.Relocate(0.0f, 0.0f, 0.0f); + for (std::list::const_iterator itr = crList.begin(); itr != crList.end(); ++itr, --rand) + { + if (caster->GetDistance(*itr) < 5) + { + if (!rand) + rand++; + continue; + } - if (aur->GetStackAmount() >= count) - { - //target->CastSpell(target, 46711, true); // Set Flag: all torch returning quests are complete - target->CastSpell(target, (target->GetTeamId() ? 46654 : 46081), true); // Quest completion - aur->SetDuration(1); - return; - } - } - else - target->CastSpell(target, SPELL_TORCH_COUNTER, true); + if (!rand) + { + pos.Relocate(*itr); + break; + } + } - ThrowNextTorch(GetCaster()); - } + // we have any pos + if (pos.GetPositionX()) + caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_FLING_TORCH, true); } - void Register() - { - AfterCast += SpellCastFn(spell_midsummer_fling_torch_SpellScript::HandleFinish); - if (m_scriptSpellId == 45671) - OnEffectHitTarget += SpellEffectFn(spell_midsummer_fling_torch_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } + void HandleFinish() + { + Unit* caster = GetCaster(); + if (!caster || !caster->ToPlayer()) // caster cant be null, but meh :p + return; + + if (GetSpellInfo()->Id != SPELL_FLING_TORCH_DUMMY) + { + if (!handled) + if (const WorldLocation* loc = GetExplTargetDest()) + { + caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_MISSED_TORCH, true); + caster->RemoveAurasDueToSpell(SPELL_TORCH_COUNTER); + } + return; + } + + ThrowNextTorch(caster); + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Player* target = GetHitPlayer()) + { + if (target->GetGUID() != GetCaster()->GetGUID()) + return; + + handled = true; + if (Aura* aur = target->GetAura(SPELL_TORCH_COUNTER)) + { + aur->ModStackAmount(1); + uint8 count = 4; + if (target->GetQuestStatus(target->GetTeamId() ? 11925 : 11924) == QUEST_STATUS_INCOMPLETE) // More Torch Catching quests + count = 10; + + if (aur->GetStackAmount() >= count) + { + //target->CastSpell(target, 46711, true); // Set Flag: all torch returning quests are complete + target->CastSpell(target, (target->GetTeamId() ? 46654 : 46081), true); // Quest completion + aur->SetDuration(1); + return; + } + } + else + target->CastSpell(target, SPELL_TORCH_COUNTER, true); + + ThrowNextTorch(GetCaster()); + } + } + + void Register() + { + AfterCast += SpellCastFn(spell_midsummer_fling_torch_SpellScript::HandleFinish); + if (m_scriptSpellId == 45671) + OnEffectHitTarget += SpellEffectFn(spell_midsummer_fling_torch_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } }; SpellScript* GetSpellScript() const @@ -433,14 +433,14 @@ class spell_midsummer_fling_torch : public SpellScriptLoader enum eJuggle { - SPELL_JUGGLE_SELF = 45638, - SPELL_JUGGLE_SLOW = 45792, - SPELL_JUGGLE_MED = 45806, - SPELL_JUGGLE_FAST = 45816, + SPELL_JUGGLE_SELF = 45638, + SPELL_JUGGLE_SLOW = 45792, + SPELL_JUGGLE_MED = 45806, + SPELL_JUGGLE_FAST = 45816, - SPELL_TORCH_CHECK = 45644, - SPELL_GIVE_TORCH = 45280, - QUEST_CHECK = 11937, + SPELL_TORCH_CHECK = 45644, + SPELL_GIVE_TORCH = 45280, + QUEST_CHECK = 11937, }; class spell_midsummer_juggling_torch : public SpellScriptLoader @@ -452,51 +452,51 @@ class spell_midsummer_juggling_torch : public SpellScriptLoader { PrepareSpellScript(spell_midsummer_juggling_torch_SpellScript); - bool handled; - bool Load() { handled = false; return true; } - void HandleFinish() + bool handled; + bool Load() { handled = false; return true; } + void HandleFinish() { - Unit* caster = GetCaster(); - if (!caster || caster->GetTypeId() != TYPEID_PLAYER) - return; + Unit* caster = GetCaster(); + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) + return; - if (const WorldLocation* loc = GetExplTargetDest()) - { - if (loc->GetExactDist(caster) < 3.0f) - caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_SELF, true); - else if (loc->GetExactDist(caster) < 10.0f) - caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_SLOW, true); - else if (loc->GetExactDist(caster) < 25.0f) - caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_MED, true); - else - caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_FAST, true); - } - else - caster->CastSpell(caster, SPELL_JUGGLE_SELF, true); + if (const WorldLocation* loc = GetExplTargetDest()) + { + if (loc->GetExactDist(caster) < 3.0f) + caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_SELF, true); + else if (loc->GetExactDist(caster) < 10.0f) + caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_SLOW, true); + else if (loc->GetExactDist(caster) < 25.0f) + caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_MED, true); + else + caster->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), SPELL_JUGGLE_FAST, true); + } + else + caster->CastSpell(caster, SPELL_JUGGLE_SELF, true); } - void HandleDummy(SpellEffIndex effIndex) + void HandleDummy(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - Unit* caster = GetCaster(); - if (!caster || caster->GetTypeId() != TYPEID_PLAYER) - return; + Unit* caster = GetCaster(); + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) + return; - if (Player* target = GetHitPlayer()) - if (!handled && target->GetQuestRewardStatus(target->GetTeamId() == TEAM_ALLIANCE ? 11657 : 11923)) - { - handled = true; - caster->CastSpell(target, SPELL_GIVE_TORCH, true); - } + if (Player* target = GetHitPlayer()) + if (!handled && target->GetQuestRewardStatus(target->GetTeamId() == TEAM_ALLIANCE ? 11657 : 11923)) + { + handled = true; + caster->CastSpell(target, SPELL_GIVE_TORCH, true); + } } - void Register() - { - if (m_scriptSpellId == SPELL_TORCH_CHECK) - OnEffectHitTarget += SpellEffectFn(spell_midsummer_juggling_torch_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - else - AfterCast += SpellCastFn(spell_midsummer_juggling_torch_SpellScript::HandleFinish); - } + void Register() + { + if (m_scriptSpellId == SPELL_TORCH_CHECK) + OnEffectHitTarget += SpellEffectFn(spell_midsummer_juggling_torch_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + else + AfterCast += SpellCastFn(spell_midsummer_juggling_torch_SpellScript::HandleFinish); + } }; SpellScript* GetSpellScript() const @@ -507,14 +507,14 @@ class spell_midsummer_juggling_torch : public SpellScriptLoader void AddSC_event_midsummer_scripts() { - // NPCs - new go_midsummer_bonfire(); - new npc_midsummer_bonfire(); - new npc_midsummer_torch_target(); + // NPCs + new go_midsummer_bonfire(); + new npc_midsummer_bonfire(); + new npc_midsummer_torch_target(); - // Spells - new spell_midsummer_ribbon_pole(); - new spell_midsummer_torch_quest(); - new spell_midsummer_fling_torch(); - new spell_midsummer_juggling_torch(); + // Spells + new spell_midsummer_ribbon_pole(); + new spell_midsummer_torch_quest(); + new spell_midsummer_fling_torch(); + new spell_midsummer_juggling_torch(); } \ No newline at end of file diff --git a/src/server/scripts/Events/pilgrims_bounty.cpp b/src/server/scripts/Events/pilgrims_bounty.cpp index 652583a6b..6d8f20ccb 100644 --- a/src/server/scripts/Events/pilgrims_bounty.cpp +++ b/src/server/scripts/Events/pilgrims_bounty.cpp @@ -14,72 +14,72 @@ enum tableEvent { - // Spells - SPELL_PASS_TURKEY = 66250, - SPELL_PASS_STUFFING = 66259, - SPELL_PASS_PIE = 66260, - SPELL_PASS_CRANBERRY = 66261, - SPELL_PASS_SWEET_POTATO = 66262, + // Spells + SPELL_PASS_TURKEY = 66250, + SPELL_PASS_STUFFING = 66259, + SPELL_PASS_PIE = 66260, + SPELL_PASS_CRANBERRY = 66261, + SPELL_PASS_SWEET_POTATO = 66262, - SPELL_VISUAL_THROW_TURKEY = 61822, - SPELL_VISUAL_THROW_STUFFING = 61823, - SPELL_VISUAL_THROW_PIE = 61825, - SPELL_VISUAL_THROW_CRANBERRY = 61821, - SPELL_VISUAL_THROW_SWEET_POTATO = 61824, + SPELL_VISUAL_THROW_TURKEY = 61822, + SPELL_VISUAL_THROW_STUFFING = 61823, + SPELL_VISUAL_THROW_PIE = 61825, + SPELL_VISUAL_THROW_CRANBERRY = 61821, + SPELL_VISUAL_THROW_SWEET_POTATO = 61824, - SPELL_VISUAL_BOUNCE_TURKEY = 61928, - SPELL_VISUAL_BOUNCE_STUFFING = 61927, - SPELL_VISUAL_BOUNCE_PIE = 61926, - SPELL_VISUAL_BOUNCE_CRANBERRY = 61925, - SPELL_VISUAL_BOUNCE_SWEET_POTATO= 61929, + SPELL_VISUAL_BOUNCE_TURKEY = 61928, + SPELL_VISUAL_BOUNCE_STUFFING = 61927, + SPELL_VISUAL_BOUNCE_PIE = 61926, + SPELL_VISUAL_BOUNCE_CRANBERRY = 61925, + SPELL_VISUAL_BOUNCE_SWEET_POTATO= 61929, - SPELL_PLATE_TURKEY = 61835, - SPELL_PLATE_STUFFING = 61836, - SPELL_PLATE_PIE = 61838, - SPELL_PLATE_CRANBERRY = 61833, - SPELL_PLATE_SWEET_POTATO = 61837, + SPELL_PLATE_TURKEY = 61835, + SPELL_PLATE_STUFFING = 61836, + SPELL_PLATE_PIE = 61838, + SPELL_PLATE_CRANBERRY = 61833, + SPELL_PLATE_SWEET_POTATO = 61837, - SPELL_STORE_TURKEY = 61807, - SPELL_STORE_STUFFING = 61806, - SPELL_STORE_PIE = 61805, - SPELL_STORE_CRANBERRY = 61804, - SPELL_STORE_SWEET_POTATO = 61808, + SPELL_STORE_TURKEY = 61807, + SPELL_STORE_STUFFING = 61806, + SPELL_STORE_PIE = 61805, + SPELL_STORE_CRANBERRY = 61804, + SPELL_STORE_SWEET_POTATO = 61808, - SPELL_CAN_EAT_TURKEY = 61801, - SPELL_CAN_EAT_STUFFING = 61800, - SPELL_CAN_EAT_PIE = 61799, - SPELL_CAN_EAT_CRANBERRY = 61798, - SPELL_CAN_EAT_SWEET_POTATO = 61802, + SPELL_CAN_EAT_TURKEY = 61801, + SPELL_CAN_EAT_STUFFING = 61800, + SPELL_CAN_EAT_PIE = 61799, + SPELL_CAN_EAT_CRANBERRY = 61798, + SPELL_CAN_EAT_SWEET_POTATO = 61802, - SPELL_FEAST_ON_TURKEY = 61784, - SPELL_FEAST_ON_STUFFING = 61788, - SPELL_FEAST_ON_PIE = 61787, - SPELL_FEAST_ON_CRANBERRY = 61785, - SPELL_FEAST_ON_SWEET_POTATOES = 61786, + SPELL_FEAST_ON_TURKEY = 61784, + SPELL_FEAST_ON_STUFFING = 61788, + SPELL_FEAST_ON_PIE = 61787, + SPELL_FEAST_ON_CRANBERRY = 61785, + SPELL_FEAST_ON_SWEET_POTATOES = 61786, - SPELL_PLAYER_TURKEY = 61842, - SPELL_PLAYER_STUFFING = 61843, - SPELL_PLAYER_PIE = 61845, - SPELL_PLAYER_CRANBERRY = 61841, - SPELL_PLAYER_SWEET_POTATOES = 61844, + SPELL_PLAYER_TURKEY = 61842, + SPELL_PLAYER_STUFFING = 61843, + SPELL_PLAYER_PIE = 61845, + SPELL_PLAYER_CRANBERRY = 61841, + SPELL_PLAYER_SWEET_POTATOES = 61844, - SPELL_WELL_FED_TURKEY = 65414, - SPELL_WELL_FED_STUFFING = 65416, - SPELL_WELL_FED_PIE = 65415, - SPELL_WELL_FED_CRANBERRY = 65412, - SPELL_WELL_FED_SWEET_POTATOES = 65410, + SPELL_WELL_FED_TURKEY = 65414, + SPELL_WELL_FED_STUFFING = 65416, + SPELL_WELL_FED_PIE = 65415, + SPELL_WELL_FED_CRANBERRY = 65412, + SPELL_WELL_FED_SWEET_POTATOES = 65410, - SPELL_ACHI_PASS_TURKEY = 66373, - SPELL_ACHI_PASS_STUFFING = 66375, - SPELL_ACHI_PASS_PIE = 66374, - SPELL_ACHI_PASS_CRANBERRY = 66372, - SPELL_ACHI_PASS_SWEET_POTATOES = 66376, + SPELL_ACHI_PASS_TURKEY = 66373, + SPELL_ACHI_PASS_STUFFING = 66375, + SPELL_ACHI_PASS_PIE = 66374, + SPELL_ACHI_PASS_CRANBERRY = 66372, + SPELL_ACHI_PASS_SWEET_POTATOES = 66376, - SPELL_SPIRIT_OF_SHARING = 61849, + SPELL_SPIRIT_OF_SHARING = 61849, - // NPCs - NPC_STRUDY_PLATE = 32839, - NPC_BOUNTIFUL_TABLE = 32823, + // NPCs + NPC_STRUDY_PLATE = 32839, + NPC_BOUNTIFUL_TABLE = 32823, }; ///////////////////////////// @@ -95,175 +95,175 @@ class npc_pilgrims_bounty_chair : public CreatureScript { npc_pilgrims_bounty_chairAI(Creature* creature) : VehicleAI(creature) { - plateGUID = 0; - timerSpawnPlate = 1; - timerRotateChair = 0; - me->SetReactState(REACT_PASSIVE); + plateGUID = 0; + timerSpawnPlate = 1; + timerRotateChair = 0; + me->SetReactState(REACT_PASSIVE); } - void MoveInLineOfSight(Unit* who) {} - void AttackStart(Unit*) {} + void MoveInLineOfSight(Unit* who) {} + void AttackStart(Unit*) {} - void PassengerBoarded(Unit* who, int8 seatId, bool apply) - { - if (apply && who->GetTypeId() == TYPEID_PLAYER) - who->ToPlayer()->SetClientControl(me, 0, true); - } + void PassengerBoarded(Unit* who, int8 seatId, bool apply) + { + if (apply && who->GetTypeId() == TYPEID_PLAYER) + who->ToPlayer()->SetClientControl(me, 0, true); + } - uint64 plateGUID; - uint32 timerSpawnPlate; - uint32 timerRotateChair; + uint64 plateGUID; + uint32 timerSpawnPlate; + uint32 timerRotateChair; - Creature* GetPlate() { return plateGUID ? ObjectAccessor::GetCreature(*me, plateGUID) : NULL; } + Creature* GetPlate() { return plateGUID ? ObjectAccessor::GetCreature(*me, plateGUID) : NULL; } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - damage = 0; - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + damage = 0; + } - void DoAction(int32 param) - { - switch (param) - { - case SPELL_VISUAL_THROW_TURKEY: - case SPELL_VISUAL_BOUNCE_TURKEY: - me->CastSpell(me, SPELL_STORE_TURKEY, true); - me->CastSpell(me, SPELL_CAN_EAT_TURKEY, true); - if (Unit* plate = GetPlate()) - plate->CastSpell(plate, SPELL_PLATE_TURKEY, true); - break; - case SPELL_VISUAL_THROW_STUFFING: - case SPELL_VISUAL_BOUNCE_STUFFING: - me->CastSpell(me, SPELL_STORE_STUFFING, true); - me->CastSpell(me, SPELL_CAN_EAT_STUFFING, true); - if (Unit* plate = GetPlate()) - plate->CastSpell(plate, SPELL_PLATE_STUFFING, true); - break; - case SPELL_VISUAL_THROW_PIE: - case SPELL_VISUAL_BOUNCE_PIE: - me->CastSpell(me, SPELL_STORE_PIE, true); - me->CastSpell(me, SPELL_CAN_EAT_PIE, true); - if (Unit* plate = GetPlate()) - plate->CastSpell(plate, SPELL_PLATE_PIE, true); - break; - case SPELL_VISUAL_THROW_CRANBERRY: - case SPELL_VISUAL_BOUNCE_CRANBERRY: - me->CastSpell(me, SPELL_STORE_CRANBERRY, true); - me->CastSpell(me, SPELL_CAN_EAT_CRANBERRY, true); - if (Unit* plate = GetPlate()) - plate->CastSpell(plate, SPELL_PLATE_CRANBERRY, true); - break; - case SPELL_VISUAL_THROW_SWEET_POTATO: - case SPELL_VISUAL_BOUNCE_SWEET_POTATO: - me->CastSpell(me, SPELL_STORE_SWEET_POTATO, true); - me->CastSpell(me, SPELL_CAN_EAT_SWEET_POTATO, true); - if (Unit* plate = GetPlate()) - plate->CastSpell(plate, SPELL_PLATE_SWEET_POTATO, true); - break; + void DoAction(int32 param) + { + switch (param) + { + case SPELL_VISUAL_THROW_TURKEY: + case SPELL_VISUAL_BOUNCE_TURKEY: + me->CastSpell(me, SPELL_STORE_TURKEY, true); + me->CastSpell(me, SPELL_CAN_EAT_TURKEY, true); + if (Unit* plate = GetPlate()) + plate->CastSpell(plate, SPELL_PLATE_TURKEY, true); + break; + case SPELL_VISUAL_THROW_STUFFING: + case SPELL_VISUAL_BOUNCE_STUFFING: + me->CastSpell(me, SPELL_STORE_STUFFING, true); + me->CastSpell(me, SPELL_CAN_EAT_STUFFING, true); + if (Unit* plate = GetPlate()) + plate->CastSpell(plate, SPELL_PLATE_STUFFING, true); + break; + case SPELL_VISUAL_THROW_PIE: + case SPELL_VISUAL_BOUNCE_PIE: + me->CastSpell(me, SPELL_STORE_PIE, true); + me->CastSpell(me, SPELL_CAN_EAT_PIE, true); + if (Unit* plate = GetPlate()) + plate->CastSpell(plate, SPELL_PLATE_PIE, true); + break; + case SPELL_VISUAL_THROW_CRANBERRY: + case SPELL_VISUAL_BOUNCE_CRANBERRY: + me->CastSpell(me, SPELL_STORE_CRANBERRY, true); + me->CastSpell(me, SPELL_CAN_EAT_CRANBERRY, true); + if (Unit* plate = GetPlate()) + plate->CastSpell(plate, SPELL_PLATE_CRANBERRY, true); + break; + case SPELL_VISUAL_THROW_SWEET_POTATO: + case SPELL_VISUAL_BOUNCE_SWEET_POTATO: + me->CastSpell(me, SPELL_STORE_SWEET_POTATO, true); + me->CastSpell(me, SPELL_CAN_EAT_SWEET_POTATO, true); + if (Unit* plate = GetPlate()) + plate->CastSpell(plate, SPELL_PLATE_SWEET_POTATO, true); + break; - // AURA REMOVAL - case SPELL_STORE_SWEET_POTATO: - me->RemoveAura(SPELL_CAN_EAT_SWEET_POTATO); - if (Unit* plate = GetPlate()) - plate->RemoveAura(SPELL_PLATE_SWEET_POTATO); - break; - case SPELL_STORE_TURKEY: - me->RemoveAura(SPELL_CAN_EAT_TURKEY); - if (Unit* plate = GetPlate()) - plate->RemoveAura(SPELL_PLATE_TURKEY); - break; - case SPELL_STORE_PIE: - me->RemoveAura(SPELL_CAN_EAT_PIE); - if (Unit* plate = GetPlate()) - plate->RemoveAura(SPELL_PLATE_PIE); - break; - case SPELL_STORE_STUFFING: - me->RemoveAura(SPELL_CAN_EAT_STUFFING); - if (Unit* plate = GetPlate()) - plate->RemoveAura(SPELL_PLATE_STUFFING); - break; - case SPELL_STORE_CRANBERRY: - me->RemoveAura(SPELL_CAN_EAT_CRANBERRY); - if (Unit* plate = GetPlate()) - plate->RemoveAura(SPELL_PLATE_CRANBERRY); - break; - } - } + // AURA REMOVAL + case SPELL_STORE_SWEET_POTATO: + me->RemoveAura(SPELL_CAN_EAT_SWEET_POTATO); + if (Unit* plate = GetPlate()) + plate->RemoveAura(SPELL_PLATE_SWEET_POTATO); + break; + case SPELL_STORE_TURKEY: + me->RemoveAura(SPELL_CAN_EAT_TURKEY); + if (Unit* plate = GetPlate()) + plate->RemoveAura(SPELL_PLATE_TURKEY); + break; + case SPELL_STORE_PIE: + me->RemoveAura(SPELL_CAN_EAT_PIE); + if (Unit* plate = GetPlate()) + plate->RemoveAura(SPELL_PLATE_PIE); + break; + case SPELL_STORE_STUFFING: + me->RemoveAura(SPELL_CAN_EAT_STUFFING); + if (Unit* plate = GetPlate()) + plate->RemoveAura(SPELL_PLATE_STUFFING); + break; + case SPELL_STORE_CRANBERRY: + me->RemoveAura(SPELL_CAN_EAT_CRANBERRY); + if (Unit* plate = GetPlate()) + plate->RemoveAura(SPELL_PLATE_CRANBERRY); + break; + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - Unit* charm = target->GetCharm(); - if (!charm || !charm->ToCreature()) - return; + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + Unit* charm = target->GetCharm(); + if (!charm || !charm->ToCreature()) + return; - charm->ToCreature()->AI()->DoAction(spellInfo->Id); - } + charm->ToCreature()->AI()->DoAction(spellInfo->Id); + } - void SpellHit(Unit* target, const SpellInfo* spellInfo) - { - switch (spellInfo->Id) - { - case SPELL_FEAST_ON_SWEET_POTATOES: - if (Aura* aur = me->GetAura(SPELL_STORE_SWEET_POTATO)) - aur->ModStackAmount(-1); - break; - case SPELL_FEAST_ON_TURKEY: - if (Aura* aur = me->GetAura(SPELL_STORE_TURKEY)) - aur->ModStackAmount(-1); - break; - case SPELL_FEAST_ON_PIE: - if (Aura* aur = me->GetAura(SPELL_STORE_PIE)) - aur->ModStackAmount(-1); - break; - case SPELL_FEAST_ON_STUFFING: - if (Aura* aur = me->GetAura(SPELL_STORE_STUFFING)) - aur->ModStackAmount(-1); - break; - case SPELL_FEAST_ON_CRANBERRY: - if (Aura* aur = me->GetAura(SPELL_STORE_CRANBERRY)) - aur->ModStackAmount(-1); - break; - } - } + void SpellHit(Unit* target, const SpellInfo* spellInfo) + { + switch (spellInfo->Id) + { + case SPELL_FEAST_ON_SWEET_POTATOES: + if (Aura* aur = me->GetAura(SPELL_STORE_SWEET_POTATO)) + aur->ModStackAmount(-1); + break; + case SPELL_FEAST_ON_TURKEY: + if (Aura* aur = me->GetAura(SPELL_STORE_TURKEY)) + aur->ModStackAmount(-1); + break; + case SPELL_FEAST_ON_PIE: + if (Aura* aur = me->GetAura(SPELL_STORE_PIE)) + aur->ModStackAmount(-1); + break; + case SPELL_FEAST_ON_STUFFING: + if (Aura* aur = me->GetAura(SPELL_STORE_STUFFING)) + aur->ModStackAmount(-1); + break; + case SPELL_FEAST_ON_CRANBERRY: + if (Aura* aur = me->GetAura(SPELL_STORE_CRANBERRY)) + aur->ModStackAmount(-1); + break; + } + } - void UpdateAI(uint32 diff) - { - if (timerSpawnPlate) - { - timerSpawnPlate += diff; - if (timerSpawnPlate >= 1000) - { - if (Vehicle* table = me->GetVehicle()) - if (Unit* plateHolder = table->GetPassenger(6)) - { - SeatMap::const_iterator itr = table->GetSeatIteratorForPassenger(me); - if (itr == table->Seats.end()) - return; + void UpdateAI(uint32 diff) + { + if (timerSpawnPlate) + { + timerSpawnPlate += diff; + if (timerSpawnPlate >= 1000) + { + if (Vehicle* table = me->GetVehicle()) + if (Unit* plateHolder = table->GetPassenger(6)) + { + SeatMap::const_iterator itr = table->GetSeatIteratorForPassenger(me); + if (itr == table->Seats.end()) + return; - uint8 vehicleSeatId = itr->first; - Creature* plate = me->SummonCreature(NPC_STRUDY_PLATE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f); - if (!plate) - return; + uint8 vehicleSeatId = itr->first; + Creature* plate = me->SummonCreature(NPC_STRUDY_PLATE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f); + if (!plate) + return; - plateGUID = plate->GetGUID(); - plate->EnterVehicle(plateHolder, vehicleSeatId); - timerSpawnPlate = 0; - timerRotateChair = 1; - } - } - } - if (timerRotateChair) - { - timerRotateChair += diff; - if (timerRotateChair >= 1000) - { - if (Creature* plate = GetPlate()) - me->SetFacingToObject(plate); + plateGUID = plate->GetGUID(); + plate->EnterVehicle(plateHolder, vehicleSeatId); + timerSpawnPlate = 0; + timerRotateChair = 1; + } + } + } + if (timerRotateChair) + { + timerRotateChair += diff; + if (timerRotateChair >= 1000) + { + if (Creature* plate = GetPlate()) + me->SetFacingToObject(plate); - timerRotateChair = 0; - } - } - } + timerRotateChair = 0; + } + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -283,21 +283,21 @@ class npc_pilgrims_bounty_plate : public CreatureScript { } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - switch (spellInfo->Id) - { - case SPELL_VISUAL_THROW_TURKEY: - case SPELL_VISUAL_THROW_STUFFING: - case SPELL_VISUAL_THROW_PIE: - case SPELL_VISUAL_THROW_CRANBERRY: - case SPELL_VISUAL_THROW_SWEET_POTATO: - if (TempSummon* ts = me->ToTempSummon()) - if (Unit* owner = ts->GetSummoner()) - owner->ToCreature()->AI()->DoAction(spellInfo->Id); - break; - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + switch (spellInfo->Id) + { + case SPELL_VISUAL_THROW_TURKEY: + case SPELL_VISUAL_THROW_STUFFING: + case SPELL_VISUAL_THROW_PIE: + case SPELL_VISUAL_THROW_CRANBERRY: + case SPELL_VISUAL_THROW_SWEET_POTATO: + if (TempSummon* ts = me->ToTempSummon()) + if (Unit* owner = ts->GetSummoner()) + owner->ToCreature()->AI()->DoAction(spellInfo->Id); + break; + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -312,105 +312,105 @@ class npc_pilgrims_bounty_plate : public CreatureScript class spell_pilgrims_bounty_pass_generic : public SpellScriptLoader { public: - spell_pilgrims_bounty_pass_generic() : SpellScriptLoader("spell_pilgrims_bounty_pass_generic") {} + spell_pilgrims_bounty_pass_generic() : SpellScriptLoader("spell_pilgrims_bounty_pass_generic") {} - class spell_pilgrims_bounty_pass_generic_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pilgrims_bounty_pass_generic_SpellScript); + class spell_pilgrims_bounty_pass_generic_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pilgrims_bounty_pass_generic_SpellScript); - uint32 GetVisualThrow(uint32 passSpell, bool isPlayer) - { - if (isPlayer) - { - switch (passSpell) - { - - case SPELL_PASS_TURKEY: return SPELL_VISUAL_BOUNCE_TURKEY; - case SPELL_PASS_STUFFING: return SPELL_VISUAL_BOUNCE_STUFFING; - case SPELL_PASS_PIE: return SPELL_VISUAL_BOUNCE_PIE; - case SPELL_PASS_CRANBERRY: return SPELL_VISUAL_BOUNCE_CRANBERRY; - case SPELL_PASS_SWEET_POTATO: return SPELL_VISUAL_BOUNCE_SWEET_POTATO; - } - } - else - { - switch (passSpell) - { - - case SPELL_PASS_TURKEY: return SPELL_VISUAL_THROW_TURKEY; - case SPELL_PASS_STUFFING: return SPELL_VISUAL_THROW_STUFFING; - case SPELL_PASS_PIE: return SPELL_VISUAL_THROW_PIE; - case SPELL_PASS_CRANBERRY: return SPELL_VISUAL_THROW_CRANBERRY; - case SPELL_PASS_SWEET_POTATO: return SPELL_VISUAL_THROW_SWEET_POTATO; - } - } + uint32 GetVisualThrow(uint32 passSpell, bool isPlayer) + { + if (isPlayer) + { + switch (passSpell) + { + + case SPELL_PASS_TURKEY: return SPELL_VISUAL_BOUNCE_TURKEY; + case SPELL_PASS_STUFFING: return SPELL_VISUAL_BOUNCE_STUFFING; + case SPELL_PASS_PIE: return SPELL_VISUAL_BOUNCE_PIE; + case SPELL_PASS_CRANBERRY: return SPELL_VISUAL_BOUNCE_CRANBERRY; + case SPELL_PASS_SWEET_POTATO: return SPELL_VISUAL_BOUNCE_SWEET_POTATO; + } + } + else + { + switch (passSpell) + { + + case SPELL_PASS_TURKEY: return SPELL_VISUAL_THROW_TURKEY; + case SPELL_PASS_STUFFING: return SPELL_VISUAL_THROW_STUFFING; + case SPELL_PASS_PIE: return SPELL_VISUAL_THROW_PIE; + case SPELL_PASS_CRANBERRY: return SPELL_VISUAL_THROW_CRANBERRY; + case SPELL_PASS_SWEET_POTATO: return SPELL_VISUAL_THROW_SWEET_POTATO; + } + } - return 0; - } + return 0; + } - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetHitUnit()) - { - // player case - if (target->IsVehicle() && target->ToCreature()) - { - if (Player* player = target->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - GetCaster()->CastSpell(player, GetVisualThrow(GetSpellInfo()->Id, true), true); - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, GetVisualThrow(GetSpellInfo()->Id, true)); - } - } - // normal case - else - { - if (TempSummon* ts = target->ToTempSummon()) - if (Unit* owner = ts->GetSummoner()) - if (owner->GetEntry() == GetCaster()->GetEntry()) - return; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + // player case + if (target->IsVehicle() && target->ToCreature()) + { + if (Player* player = target->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + GetCaster()->CastSpell(player, GetVisualThrow(GetSpellInfo()->Id, true), true); + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, GetVisualThrow(GetSpellInfo()->Id, true)); + } + } + // normal case + else + { + if (TempSummon* ts = target->ToTempSummon()) + if (Unit* owner = ts->GetSummoner()) + if (owner->GetEntry() == GetCaster()->GetEntry()) + return; - GetCaster()->CastSpell(target, GetVisualThrow(GetSpellInfo()->Id, false), true); - } - } + GetCaster()->CastSpell(target, GetVisualThrow(GetSpellInfo()->Id, false), true); + } + } - // Get chair charmer, passing achievement - if (Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - uint32 spellId = 0; - switch (GetSpellInfo()->Id) - { - case SPELL_PASS_TURKEY: - spellId = SPELL_ACHI_PASS_TURKEY; - break; - case SPELL_PASS_STUFFING: - spellId = SPELL_ACHI_PASS_STUFFING; - break; - case SPELL_PASS_PIE: - spellId = SPELL_ACHI_PASS_PIE; - break; - case SPELL_PASS_CRANBERRY: - spellId = SPELL_ACHI_PASS_CRANBERRY; - break; - case SPELL_PASS_SWEET_POTATO: - spellId = SPELL_ACHI_PASS_SWEET_POTATOES; - break; - } + // Get chair charmer, passing achievement + if (Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + uint32 spellId = 0; + switch (GetSpellInfo()->Id) + { + case SPELL_PASS_TURKEY: + spellId = SPELL_ACHI_PASS_TURKEY; + break; + case SPELL_PASS_STUFFING: + spellId = SPELL_ACHI_PASS_STUFFING; + break; + case SPELL_PASS_PIE: + spellId = SPELL_ACHI_PASS_PIE; + break; + case SPELL_PASS_CRANBERRY: + spellId = SPELL_ACHI_PASS_CRANBERRY; + break; + case SPELL_PASS_SWEET_POTATO: + spellId = SPELL_ACHI_PASS_SWEET_POTATOES; + break; + } - if (spellId) - player->CastSpell(player, spellId, true); - } - } + if (spellId) + player->CastSpell(player, spellId, true); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_pass_generic_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_pass_generic_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_pilgrims_bounty_pass_generic_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_pilgrims_bounty_pass_generic_SpellScript(); + } }; class spell_pilgrims_bounty_feast_on_generic : public SpellScriptLoader @@ -424,71 +424,71 @@ class spell_pilgrims_bounty_feast_on_generic : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself(); - if (!player) - return; + Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (!player) + return; - uint32 spellId = 0; - switch (GetSpellInfo()->Id) - { - case SPELL_FEAST_ON_TURKEY: - spellId = SPELL_PLAYER_TURKEY; - break; - case SPELL_FEAST_ON_STUFFING: - spellId = SPELL_PLAYER_STUFFING; - break; - case SPELL_FEAST_ON_PIE: - spellId = SPELL_PLAYER_PIE; - break; - case SPELL_FEAST_ON_CRANBERRY: - spellId = SPELL_PLAYER_CRANBERRY; - break; - case SPELL_FEAST_ON_SWEET_POTATOES: - spellId = SPELL_PLAYER_SWEET_POTATOES; - break; - } + uint32 spellId = 0; + switch (GetSpellInfo()->Id) + { + case SPELL_FEAST_ON_TURKEY: + spellId = SPELL_PLAYER_TURKEY; + break; + case SPELL_FEAST_ON_STUFFING: + spellId = SPELL_PLAYER_STUFFING; + break; + case SPELL_FEAST_ON_PIE: + spellId = SPELL_PLAYER_PIE; + break; + case SPELL_FEAST_ON_CRANBERRY: + spellId = SPELL_PLAYER_CRANBERRY; + break; + case SPELL_FEAST_ON_SWEET_POTATOES: + spellId = SPELL_PLAYER_SWEET_POTATOES; + break; + } - if (spellId) - { - player->CastSpell(player, spellId, true); - if (AuraEffect* aur = player->GetAuraEffectDummy(spellId)) - { - if (aur->GetBase()->GetStackAmount() >= 5) - { - switch (spellId) - { - case SPELL_PLAYER_TURKEY: - player->CastSpell(player, SPELL_WELL_FED_TURKEY, true); - break; - case SPELL_PLAYER_STUFFING: - player->CastSpell(player, SPELL_WELL_FED_STUFFING, true); - break; - case SPELL_PLAYER_PIE: - player->CastSpell(player, SPELL_WELL_FED_PIE, true); - break; - case SPELL_PLAYER_CRANBERRY: - player->CastSpell(player, SPELL_WELL_FED_CRANBERRY, true); - break; - case SPELL_PLAYER_SWEET_POTATOES: - player->CastSpell(player, SPELL_WELL_FED_SWEET_POTATOES, true); - break; - } + if (spellId) + { + player->CastSpell(player, spellId, true); + if (AuraEffect* aur = player->GetAuraEffectDummy(spellId)) + { + if (aur->GetBase()->GetStackAmount() >= 5) + { + switch (spellId) + { + case SPELL_PLAYER_TURKEY: + player->CastSpell(player, SPELL_WELL_FED_TURKEY, true); + break; + case SPELL_PLAYER_STUFFING: + player->CastSpell(player, SPELL_WELL_FED_STUFFING, true); + break; + case SPELL_PLAYER_PIE: + player->CastSpell(player, SPELL_WELL_FED_PIE, true); + break; + case SPELL_PLAYER_CRANBERRY: + player->CastSpell(player, SPELL_WELL_FED_CRANBERRY, true); + break; + case SPELL_PLAYER_SWEET_POTATOES: + player->CastSpell(player, SPELL_WELL_FED_SWEET_POTATOES, true); + break; + } - uint8 count = 0; - Unit::AuraEffectList const& dummyAuras = player->GetAuraEffectsByType(SPELL_AURA_DUMMY); - for (Unit::AuraEffectList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i) - { - if ((*i)->GetId() >= SPELL_PLAYER_CRANBERRY && (*i)->GetId() <= SPELL_PLAYER_PIE) - if ((*i)->GetBase()->GetStackAmount() >= 5) - ++count; - } + uint8 count = 0; + Unit::AuraEffectList const& dummyAuras = player->GetAuraEffectsByType(SPELL_AURA_DUMMY); + for (Unit::AuraEffectList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i) + { + if ((*i)->GetId() >= SPELL_PLAYER_CRANBERRY && (*i)->GetId() <= SPELL_PLAYER_PIE) + if ((*i)->GetBase()->GetStackAmount() >= 5) + ++count; + } - // Cast spirit of sharing - if (count >= 5) - player->CastSpell(player, SPELL_SPIRIT_OF_SHARING, true); - } - } - } + // Cast spirit of sharing + if (count >= 5) + player->CastSpell(player, SPELL_SPIRIT_OF_SHARING, true); + } + } + } } void Register() @@ -505,8 +505,8 @@ class spell_pilgrims_bounty_feast_on_generic : public SpellScriptLoader enum tTracker { - SPELL_TURKEY_TRACKER = 62014, - SPELL_ACHI_TURKINATOR_CREDIT = 62021, + SPELL_TURKEY_TRACKER = 62014, + SPELL_ACHI_TURKINATOR_CREDIT = 62021, }; class spell_pilgrims_bounty_turkey_tracker : public SpellScriptLoader @@ -520,28 +520,28 @@ class spell_pilgrims_bounty_turkey_tracker : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (Player* target = GetHitPlayer()) - if (AuraEffect* aurEff = target->GetAuraEffectDummy(SPELL_TURKEY_TRACKER)) - { - uint32 stackAmount = aurEff->GetBase()->GetStackAmount(); - switch (stackAmount) - { - case 10: - target->MonsterTextEmote("Turkey Hunter!", target, true); - break; - case 20: - target->MonsterTextEmote("Turkey Domination!", target, true); - break; - case 30: - target->MonsterTextEmote("Turkey Slaughter!", target, true); - break; - case 40: - target->MonsterTextEmote("TURKEY TRIUMPH!", target, true); - target->CastSpell(target, SPELL_ACHI_TURKINATOR_CREDIT, true); - aurEff->GetBase()->Remove(); - break; - } - } + if (Player* target = GetHitPlayer()) + if (AuraEffect* aurEff = target->GetAuraEffectDummy(SPELL_TURKEY_TRACKER)) + { + uint32 stackAmount = aurEff->GetBase()->GetStackAmount(); + switch (stackAmount) + { + case 10: + target->MonsterTextEmote("Turkey Hunter!", target, true); + break; + case 20: + target->MonsterTextEmote("Turkey Domination!", target, true); + break; + case 30: + target->MonsterTextEmote("Turkey Slaughter!", target, true); + break; + case 40: + target->MonsterTextEmote("TURKEY TRIUMPH!", target, true); + target->CastSpell(target, SPELL_ACHI_TURKINATOR_CREDIT, true); + aurEff->GetBase()->Remove(); + break; + } + } } void Register() @@ -568,8 +568,8 @@ class spell_pilgrims_bounty_serve_generic : public SpellScriptLoader void OnAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - if (target->GetTypeId() == TYPEID_UNIT) - target->ToCreature()->AI()->DoAction(GetSpellInfo()->Id); + if (target->GetTypeId() == TYPEID_UNIT) + target->ToCreature()->AI()->DoAction(GetSpellInfo()->Id); } void Register() @@ -595,22 +595,22 @@ class spell_pilgrims_bounty_food : public SpellScriptLoader void RecalculateHook(AuraEffect const* /*aurEffect*/, int32& amount, bool& canBeRecalculated) { - if (GetCaster()) - { - if (GetId() == 66041) - amount = CalculatePct(GetCaster()->GetMaxPower(POWER_MANA), 20); - else - amount = CalculatePct(GetCaster()->GetMaxHealth(), 15); - } + if (GetCaster()) + { + if (GetId() == 66041) + amount = CalculatePct(GetCaster()->GetMaxPower(POWER_MANA), 20); + else + amount = CalculatePct(GetCaster()->GetMaxHealth(), 15); + } canBeRecalculated = true; } void Register() { - if (m_scriptSpellId == 66041) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pilgrims_bounty_food_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_POWER_REGEN); - else if (m_scriptSpellId != 66477) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pilgrims_bounty_food_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_REGEN); + if (m_scriptSpellId == 66041) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pilgrims_bounty_food_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_POWER_REGEN); + else if (m_scriptSpellId != 66477) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pilgrims_bounty_food_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_REGEN); } }; @@ -619,31 +619,31 @@ class spell_pilgrims_bounty_food : public SpellScriptLoader return new spell_pilgrims_bounty_food_AuraScript(); } - class spell_pilgrims_bounty_food_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pilgrims_bounty_food_SpellScript); + class spell_pilgrims_bounty_food_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pilgrims_bounty_food_SpellScript); - void HandleScriptEffect(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetHitUnit()) - { - target->AddAura(sSpellMgr->GetSpellInfo(65422), 1, target); - target->CastSpell(target, 66041, true); - target->CastSpell(target, 66622, true); - } - } + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + target->AddAura(sSpellMgr->GetSpellInfo(65422), 1, target); + target->CastSpell(target, 66041, true); + target->CastSpell(target, 66622, true); + } + } - void Register() - { - if (m_scriptSpellId == 66477) - OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_food_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + if (m_scriptSpellId == 66477) + OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_food_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_pilgrims_bounty_food_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_pilgrims_bounty_food_SpellScript(); + } }; ///////////////////////////// @@ -651,10 +651,10 @@ class spell_pilgrims_bounty_food : public SpellScriptLoader ///////////////////////////// enum pilgrimsPeril { - ITEM_PILGRIMS_ROBE = 46824, - ITEM_PILGRIMS_ATTIRE = 46800, - ITEM_PILGRIMS_DRESS = 44785, - ITEM_PILGRIMS_HAT = 46723, + ITEM_PILGRIMS_ROBE = 46824, + ITEM_PILGRIMS_ATTIRE = 46800, + ITEM_PILGRIMS_DRESS = 44785, + ITEM_PILGRIMS_HAT = 46723, }; class achievement_pb_pilgrims_peril : public AchievementCriteriaScript @@ -665,7 +665,7 @@ class achievement_pb_pilgrims_peril : public AchievementCriteriaScript bool OnCheck(Player* source, Unit* /*target*/) { if (source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_DRESS, 1) || source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_ROBE, 1) || source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_ATTIRE, 1)) - return true; + return true; return false; } @@ -678,8 +678,8 @@ class achievement_pb_terokkar_turkey_time : public AchievementCriteriaScript bool OnCheck(Player* source, Unit* /*target*/) { - if (source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_HAT, 1) && (source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_DRESS, 1) || source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_ROBE, 1) || source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_ATTIRE, 1))) - return true; + if (source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_HAT, 1) && (source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_DRESS, 1) || source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_ROBE, 1) || source->HasItemOrGemWithIdEquipped(ITEM_PILGRIMS_ATTIRE, 1))) + return true; return false; } @@ -687,18 +687,18 @@ class achievement_pb_terokkar_turkey_time : public AchievementCriteriaScript void AddSC_event_pilgrims_end_scripts() { - // Spells - new spell_pilgrims_bounty_pass_generic(); - new spell_pilgrims_bounty_feast_on_generic(); - new spell_pilgrims_bounty_turkey_tracker(); - new spell_pilgrims_bounty_serve_generic(); - new spell_pilgrims_bounty_food(); - - // Npcs - new npc_pilgrims_bounty_chair(); - new npc_pilgrims_bounty_plate(); + // Spells + new spell_pilgrims_bounty_pass_generic(); + new spell_pilgrims_bounty_feast_on_generic(); + new spell_pilgrims_bounty_turkey_tracker(); + new spell_pilgrims_bounty_serve_generic(); + new spell_pilgrims_bounty_food(); + + // Npcs + new npc_pilgrims_bounty_chair(); + new npc_pilgrims_bounty_plate(); - // Achievements - new achievement_pb_pilgrims_peril(); - new achievement_pb_terokkar_turkey_time(); + // Achievements + new achievement_pb_pilgrims_peril(); + new achievement_pb_terokkar_turkey_time(); } diff --git a/src/server/scripts/Events/winter_veil.cpp b/src/server/scripts/Events/winter_veil.cpp index 16b594bea..84f53a63f 100644 --- a/src/server/scripts/Events/winter_veil.cpp +++ b/src/server/scripts/Events/winter_veil.cpp @@ -60,10 +60,10 @@ class spell_winter_veil_mistletoe : public SpellScriptLoader enum winterWondervoltTrap { - SPELL_WINTER_WONDERVOLT_GREEN_WOMEN = 26272, - SPELL_WINTER_WONDERVOLT_GREEN_MAN = 26157, - SPELL_WINTER_WONDERVOLT_RED_WOMEN = 26274, - SPELL_WINTER_WONDERVOLT_RED_MAN = 26273, + SPELL_WINTER_WONDERVOLT_GREEN_WOMEN = 26272, + SPELL_WINTER_WONDERVOLT_GREEN_MAN = 26157, + SPELL_WINTER_WONDERVOLT_RED_WOMEN = 26274, + SPELL_WINTER_WONDERVOLT_RED_MAN = 26273, }; class spell_winter_wondervolt_trap : public SpellScriptLoader @@ -83,11 +83,11 @@ class spell_winter_wondervolt_trap : public SpellScriptLoader if (target->HasAuraType(SPELL_AURA_TRANSFORM)) return; - uint32 spellId = 0; - if (target->getGender() == GENDER_MALE) - spellId = RAND(SPELL_WINTER_WONDERVOLT_RED_MAN, SPELL_WINTER_WONDERVOLT_GREEN_MAN); - else - spellId = RAND(SPELL_WINTER_WONDERVOLT_RED_WOMEN, SPELL_WINTER_WONDERVOLT_GREEN_WOMEN); + uint32 spellId = 0; + if (target->getGender() == GENDER_MALE) + spellId = RAND(SPELL_WINTER_WONDERVOLT_RED_MAN, SPELL_WINTER_WONDERVOLT_GREEN_MAN); + else + spellId = RAND(SPELL_WINTER_WONDERVOLT_RED_WOMEN, SPELL_WINTER_WONDERVOLT_GREEN_WOMEN); // cast target->CastSpell(target, spellId, true); @@ -109,18 +109,18 @@ class spell_winter_wondervolt_trap : public SpellScriptLoader enum crashinTrashin { - SPELL_BLUE_CAR_VISUAL = 75110, - SPELL_RED_CAR_VISUAL = 49384, - NPC_RED_RACER = 27664, - NPC_BLUE_RACER = 40281, + SPELL_BLUE_CAR_VISUAL = 75110, + SPELL_RED_CAR_VISUAL = 49384, + NPC_RED_RACER = 27664, + NPC_BLUE_RACER = 40281, - SPELL_RACER_DEATH_VISUAL = 49337, - SPELL_RACER_CHARGE_TO_OBJECT = 49302, - SPELL_RACER_KILL_COUNTER = 49444, - SPELL_RACER_SLAM_HIT = 49324, - SPELL_RACER_FLAMES = 49328, + SPELL_RACER_DEATH_VISUAL = 49337, + SPELL_RACER_CHARGE_TO_OBJECT = 49302, + SPELL_RACER_KILL_COUNTER = 49444, + SPELL_RACER_SLAM_HIT = 49324, + SPELL_RACER_FLAMES = 49328, - RACER_ACHI_CRITERIA = 4090, + RACER_ACHI_CRITERIA = 4090, }; class spell_winter_veil_racer_rocket_slam : public SpellScriptLoader @@ -135,46 +135,46 @@ class spell_winter_veil_racer_rocket_slam : public SpellScriptLoader void HandleTriggerSpell(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); - PreventHitEffect(EFFECT_0); - PreventHitEffect(EFFECT_1); + PreventHitEffect(EFFECT_0); + PreventHitEffect(EFFECT_1); - std::list unitList; - Unit* target = NULL; - caster->GetCreaturesWithEntryInRange(unitList, 30.0f, NPC_BLUE_RACER); - if (!unitList.empty()) - for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - if (caster->HasInLine((*itr), 1.0f) && (*itr)->GetGUID() != caster->GetGUID()) - { - target = (*itr); - break; - } - if (!target) - { - unitList.clear(); - caster->GetCreaturesWithEntryInRange(unitList, 30.0f, NPC_RED_RACER); - if (!unitList.empty()) - for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - if (caster->HasInLine((*itr), 1.0f) && (*itr)->GetGUID() != caster->GetGUID()) - { - target = (*itr); - break; - } - } + std::list unitList; + Unit* target = NULL; + caster->GetCreaturesWithEntryInRange(unitList, 30.0f, NPC_BLUE_RACER); + if (!unitList.empty()) + for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + if (caster->HasInLine((*itr), 1.0f) && (*itr)->GetGUID() != caster->GetGUID()) + { + target = (*itr); + break; + } + if (!target) + { + unitList.clear(); + caster->GetCreaturesWithEntryInRange(unitList, 30.0f, NPC_RED_RACER); + if (!unitList.empty()) + for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + if (caster->HasInLine((*itr), 1.0f) && (*itr)->GetGUID() != caster->GetGUID()) + { + target = (*itr); + break; + } + } - if (target) - { - caster->CastSpell(target, SPELL_RACER_CHARGE_TO_OBJECT, true); - caster->CastSpell(target, SPELL_RACER_SLAM_HIT, true); - } - else - { - Position pos; - float x = caster->GetPositionX()+30*cos(caster->GetOrientation()); - float y = caster->GetPositionY()+30*sin(caster->GetOrientation()); - pos.Relocate(x, y, caster->GetMap()->GetHeight(x, y, MAX_HEIGHT)+0.5f); - //caster->GetFirstCollisionPosition(pos, 30.0f, caster->GetOrientation()); - caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_RACER_CHARGE_TO_OBJECT, true); - } + if (target) + { + caster->CastSpell(target, SPELL_RACER_CHARGE_TO_OBJECT, true); + caster->CastSpell(target, SPELL_RACER_SLAM_HIT, true); + } + else + { + Position pos; + float x = caster->GetPositionX()+30*cos(caster->GetOrientation()); + float y = caster->GetPositionY()+30*sin(caster->GetOrientation()); + pos.Relocate(x, y, caster->GetMap()->GetHeight(x, y, MAX_HEIGHT)+0.5f); + //caster->GetFirstCollisionPosition(pos, 30.0f, caster->GetOrientation()); + caster->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_RACER_CHARGE_TO_OBJECT, true); + } } void Register() @@ -201,20 +201,20 @@ class spell_winter_veil_racer_slam_hit : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); - Creature* target = GetHitCreature(); - if (!target || caster == target) - return; + Creature* target = GetHitCreature(); + if (!target || caster == target) + return; - target->CastSpell(target->GetPositionX()+irand(-10, 10), target->GetPositionY()+irand(-10, 10), target->GetPositionZ() , SPELL_RACER_DEATH_VISUAL, true); - target->DespawnOrUnsummon(3000); - target->CastSpell(target, SPELL_RACER_FLAMES, true); - caster->CastSpell(caster, SPELL_RACER_KILL_COUNTER, true); + target->CastSpell(target->GetPositionX()+irand(-10, 10), target->GetPositionY()+irand(-10, 10), target->GetPositionZ() , SPELL_RACER_DEATH_VISUAL, true); + target->DespawnOrUnsummon(3000); + target->CastSpell(target, SPELL_RACER_FLAMES, true); + caster->CastSpell(caster, SPELL_RACER_KILL_COUNTER, true); - if (Player* targetSummoner = target->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - //targetSummoner->RemoveCriteriaProgress(sAchievementCriteriaStore.LookupEntry(RACER_ACHI_CRITERIA)); !ZOMG, ADD ACCESSOR - targetSummoner->RemoveAurasDueToSpell(SPELL_RACER_KILL_COUNTER); - } + if (Player* targetSummoner = target->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + //targetSummoner->RemoveCriteriaProgress(sAchievementCriteriaStore.LookupEntry(RACER_ACHI_CRITERIA)); !ZOMG, ADD ACCESSOR + targetSummoner->RemoveAurasDueToSpell(SPELL_RACER_KILL_COUNTER); + } } void Register() @@ -231,11 +231,11 @@ class spell_winter_veil_racer_slam_hit : public SpellScriptLoader enum airRifle { - SPELL_AIR_RIFLE_RIGHT_IN_THE_EYE = 65577, - SPELL_AIR_RIFLE_STARLED = 61862, - SPELL_AIR_RIFLE_HIT = 61866, - SPELL_AIR_RIFLE_HIT_TRIGGER = 65576, - SPELL_AIR_RIFLE_PELTED_DAMAGE = 67531, + SPELL_AIR_RIFLE_RIGHT_IN_THE_EYE = 65577, + SPELL_AIR_RIFLE_STARLED = 61862, + SPELL_AIR_RIFLE_HIT = 61866, + SPELL_AIR_RIFLE_HIT_TRIGGER = 65576, + SPELL_AIR_RIFLE_PELTED_DAMAGE = 67531, }; class spell_winter_veil_shoot_air_rifle : public SpellScriptLoader @@ -249,34 +249,34 @@ class spell_winter_veil_shoot_air_rifle : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - Unit* caster = GetOriginalCaster(); - Unit* target = GetHitUnit(); - if (!target) - return; + Unit* caster = GetOriginalCaster(); + Unit* target = GetHitUnit(); + if (!target) + return; - if (GetSpellInfo()->Id == SPELL_AIR_RIFLE_HIT_TRIGGER) - { - if (!caster->IsFriendlyTo(target)) - caster->CastSpell(target, SPELL_AIR_RIFLE_PELTED_DAMAGE, true, NULL, NULL, caster->GetGUID()); - } - else - { - uint8 rand = urand(0, 99); - if (rand < 15) - caster->CastSpell(caster, SPELL_AIR_RIFLE_RIGHT_IN_THE_EYE, true, NULL, NULL, caster->GetGUID()); - else if (rand < 35) - caster->CastSpell(target, SPELL_AIR_RIFLE_STARLED, true, NULL, NULL, caster->GetGUID()); - else - caster->CastSpell(target, SPELL_AIR_RIFLE_HIT, true, NULL, NULL, caster->GetGUID()); - } + if (GetSpellInfo()->Id == SPELL_AIR_RIFLE_HIT_TRIGGER) + { + if (!caster->IsFriendlyTo(target)) + caster->CastSpell(target, SPELL_AIR_RIFLE_PELTED_DAMAGE, true, NULL, NULL, caster->GetGUID()); + } + else + { + uint8 rand = urand(0, 99); + if (rand < 15) + caster->CastSpell(caster, SPELL_AIR_RIFLE_RIGHT_IN_THE_EYE, true, NULL, NULL, caster->GetGUID()); + else if (rand < 35) + caster->CastSpell(target, SPELL_AIR_RIFLE_STARLED, true, NULL, NULL, caster->GetGUID()); + else + caster->CastSpell(target, SPELL_AIR_RIFLE_HIT, true, NULL, NULL, caster->GetGUID()); + } } void Register() { - if (m_scriptSpellId == SPELL_AIR_RIFLE_HIT_TRIGGER) - OnEffectHitTarget += SpellEffectFn(spell_winter_veil_shoot_air_rifle_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); - else - OnEffectHitTarget += SpellEffectFn(spell_winter_veil_shoot_air_rifle_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + if (m_scriptSpellId == SPELL_AIR_RIFLE_HIT_TRIGGER) + OnEffectHitTarget += SpellEffectFn(spell_winter_veil_shoot_air_rifle_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + else + OnEffectHitTarget += SpellEffectFn(spell_winter_veil_shoot_air_rifle_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -288,10 +288,10 @@ class spell_winter_veil_shoot_air_rifle : public SpellScriptLoader void AddSC_event_winter_veil_scripts() { - // Spells - new spell_winter_veil_mistletoe(); - new spell_winter_wondervolt_trap(); - new spell_winter_veil_racer_rocket_slam(); - new spell_winter_veil_racer_slam_hit(); - new spell_winter_veil_shoot_air_rifle(); + // Spells + new spell_winter_veil_mistletoe(); + new spell_winter_wondervolt_trap(); + new spell_winter_veil_racer_rocket_slam(); + new spell_winter_veil_racer_slam_hit(); + new spell_winter_veil_shoot_air_rifle(); } \ No newline at end of file diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h index eb7785406..836dca339 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h @@ -7,13 +7,13 @@ REWRITTEN BY XINEF enum Data { - TYPE_GELIHAST = 0, - TYPE_FIRE1 = 1, - TYPE_FIRE2 = 2, - TYPE_FIRE3 = 3, - TYPE_FIRE4 = 4, - TYPE_AKU_MAI = 5, - MAX_ENCOUNTERS = 6 + TYPE_GELIHAST = 0, + TYPE_FIRE1 = 1, + TYPE_FIRE2 = 2, + TYPE_FIRE3 = 3, + TYPE_FIRE4 = 4, + TYPE_AKU_MAI = 5, + MAX_ENCOUNTERS = 6 }; enum CreatureIds diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp index dd231148f..e6f374e0d 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp @@ -8,122 +8,122 @@ REWRITTEN BY XINEF class instance_blackfathom_deeps : public InstanceMapScript { - public: - instance_blackfathom_deeps() : InstanceMapScript("instance_blackfathom_deeps", 48) { } + public: + instance_blackfathom_deeps() : InstanceMapScript("instance_blackfathom_deeps", 48) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_blackfathom_deeps_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_blackfathom_deeps_InstanceMapScript(map); + } - struct instance_blackfathom_deeps_InstanceMapScript : public InstanceScript - { - instance_blackfathom_deeps_InstanceMapScript(Map* map) : InstanceScript(map) { } + struct instance_blackfathom_deeps_InstanceMapScript : public InstanceScript + { + instance_blackfathom_deeps_InstanceMapScript(Map* map) : InstanceScript(map) { } - void Initialize() - { - memset(&_encounters, 0, sizeof(_encounters)); - _akumaiPortalGUID = 0; - _requiredDeaths = 0; - } + void Initialize() + { + memset(&_encounters, 0, sizeof(_encounters)); + _akumaiPortalGUID = 0; + _requiredDeaths = 0; + } - void OnCreatureCreate(Creature* creature) - { - if (creature->IsSummon() && (creature->GetEntry() == NPC_BARBED_CRUSTACEAN || creature->GetEntry() == NPC_AKU_MAI_SERVANT || - creature->GetEntry() == NPC_MURKSHALLOW_SOFTSHELL || creature->GetEntry() == NPC_AKU_MAI_SNAPJAW)) - ++_requiredDeaths; - } + void OnCreatureCreate(Creature* creature) + { + if (creature->IsSummon() && (creature->GetEntry() == NPC_BARBED_CRUSTACEAN || creature->GetEntry() == NPC_AKU_MAI_SERVANT || + creature->GetEntry() == NPC_MURKSHALLOW_SOFTSHELL || creature->GetEntry() == NPC_AKU_MAI_SNAPJAW)) + ++_requiredDeaths; + } - void OnUnitDeath(Unit* unit) - { - if (unit->IsSummon() && (unit->GetEntry() == NPC_BARBED_CRUSTACEAN || unit->GetEntry() == NPC_AKU_MAI_SERVANT || - unit->GetEntry() == NPC_MURKSHALLOW_SOFTSHELL || unit->GetEntry() == NPC_AKU_MAI_SNAPJAW)) - { - if (--_requiredDeaths == 0) - if (_encounters[TYPE_FIRE1] == DONE && _encounters[TYPE_FIRE2] == DONE && _encounters[TYPE_FIRE3] == DONE && _encounters[TYPE_FIRE4] == DONE) - HandleGameObject(_akumaiPortalGUID, true); - } - } + void OnUnitDeath(Unit* unit) + { + if (unit->IsSummon() && (unit->GetEntry() == NPC_BARBED_CRUSTACEAN || unit->GetEntry() == NPC_AKU_MAI_SERVANT || + unit->GetEntry() == NPC_MURKSHALLOW_SOFTSHELL || unit->GetEntry() == NPC_AKU_MAI_SNAPJAW)) + { + if (--_requiredDeaths == 0) + if (_encounters[TYPE_FIRE1] == DONE && _encounters[TYPE_FIRE2] == DONE && _encounters[TYPE_FIRE3] == DONE && _encounters[TYPE_FIRE4] == DONE) + HandleGameObject(_akumaiPortalGUID, true); + } + } - void OnGameObjectCreate(GameObject* gameobject) - { - switch (gameobject->GetEntry()) - { - case GO_FIRE_OF_AKU_MAI_1: - case GO_FIRE_OF_AKU_MAI_2: - case GO_FIRE_OF_AKU_MAI_3: - case GO_FIRE_OF_AKU_MAI_4: - if (_encounters[gameobject->GetEntry() - GO_FIRE_OF_AKU_MAI_1 + 1] == DONE) - { - gameobject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); - gameobject->SetGoState(GO_STATE_ACTIVE); - } - break; - case GO_SHRINE_OF_GELIHAST: - if (_encounters[TYPE_GELIHAST] == DONE) - gameobject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case GO_ALTAR_OF_THE_DEEPS: - if (_encounters[TYPE_AKU_MAI] == DONE) - gameobject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case GO_AKU_MAI_DOOR: - if (_encounters[TYPE_FIRE1] == DONE && _encounters[TYPE_FIRE2] == DONE && _encounters[TYPE_FIRE3] == DONE && _encounters[TYPE_FIRE4] == DONE) - HandleGameObject(0, true, gameobject); - _akumaiPortalGUID = gameobject->GetGUID(); - break; - } - } + void OnGameObjectCreate(GameObject* gameobject) + { + switch (gameobject->GetEntry()) + { + case GO_FIRE_OF_AKU_MAI_1: + case GO_FIRE_OF_AKU_MAI_2: + case GO_FIRE_OF_AKU_MAI_3: + case GO_FIRE_OF_AKU_MAI_4: + if (_encounters[gameobject->GetEntry() - GO_FIRE_OF_AKU_MAI_1 + 1] == DONE) + { + gameobject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + gameobject->SetGoState(GO_STATE_ACTIVE); + } + break; + case GO_SHRINE_OF_GELIHAST: + if (_encounters[TYPE_GELIHAST] == DONE) + gameobject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case GO_ALTAR_OF_THE_DEEPS: + if (_encounters[TYPE_AKU_MAI] == DONE) + gameobject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case GO_AKU_MAI_DOOR: + if (_encounters[TYPE_FIRE1] == DONE && _encounters[TYPE_FIRE2] == DONE && _encounters[TYPE_FIRE3] == DONE && _encounters[TYPE_FIRE4] == DONE) + HandleGameObject(0, true, gameobject); + _akumaiPortalGUID = gameobject->GetGUID(); + break; + } + } - void SetData(uint32 type, uint32 data) - { - switch (type) - { - case TYPE_GELIHAST: - case TYPE_FIRE1: - case TYPE_FIRE2: - case TYPE_FIRE3: - case TYPE_FIRE4: - case TYPE_AKU_MAI: - _encounters[type] = data; - break; - } + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case TYPE_GELIHAST: + case TYPE_FIRE1: + case TYPE_FIRE2: + case TYPE_FIRE3: + case TYPE_FIRE4: + case TYPE_AKU_MAI: + _encounters[type] = data; + break; + } - if (data == DONE) - SaveToDB(); - } + if (data == DONE) + SaveToDB(); + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "B L " << _encounters[0] << ' ' << _encounters[1] << ' ' << _encounters[2] << ' ' << _encounters[3] << ' ' << _encounters[4] << ' ' << _encounters[5]; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "B L " << _encounters[0] << ' ' << _encounters[1] << ' ' << _encounters[2] << ' ' << _encounters[3] << ' ' << _encounters[4] << ' ' << _encounters[5]; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - return; + void Load(const char* in) + { + if (!in) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'B' && dataHead2 == 'L') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - loadStream >> _encounters[i]; - if (_encounters[i] == IN_PROGRESS) - _encounters[i] = NOT_STARTED; - } - } - } + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'B' && dataHead2 == 'L') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + loadStream >> _encounters[i]; + if (_encounters[i] == IN_PROGRESS) + _encounters[i] = NOT_STARTED; + } + } + } - private: - uint32 _encounters[MAX_ENCOUNTERS]; - uint64 _akumaiPortalGUID; - uint8 _requiredDeaths; - }; + private: + uint32 _encounters[MAX_ENCOUNTERS]; + uint64 _akumaiPortalGUID; + uint8 _requiredDeaths; + }; }; void AddSC_instance_blackfathom_deeps() diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index 2d5df2419..4007d8563 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -174,7 +174,7 @@ class spell_mark_of_kazrogal : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if(Trinity::PowerCheck(POWER_MANA, false)); + targets.remove_if(Trinity::PowerCheck(POWER_MANA, false)); } void Register() diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp index e555f54a2..4e800b812 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp @@ -8,22 +8,22 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! #include "SpellInfo.h" enum Spells { - SPELL_CURSE_OF_EXERTION = 52772, - SPELL_WOUNDING_STRIKE_N = 52771, - SPELL_WOUNDING_STRIKE_H = 58830, - SPELL_TIME_STOP = 58848, - SPELL_TIME_WARP = 52766, - SPELL_TIME_STEP_N = 52737, - SPELL_TIME_STEP_H = 58829, + SPELL_CURSE_OF_EXERTION = 52772, + SPELL_WOUNDING_STRIKE_N = 52771, + SPELL_WOUNDING_STRIKE_H = 58830, + SPELL_TIME_STOP = 58848, + SPELL_TIME_WARP = 52766, + SPELL_TIME_STEP_N = 52737, + SPELL_TIME_STEP_H = 58829, }; enum Events { - EVENT_SPELL_CURSE_OF_EXERTION = 1, - EVENT_SPELL_WOUNDING_STRIKE = 2, - EVENT_SPELL_TIME_STOP = 3, - EVENT_SPELL_TIME_WARP = 4, - EVENT_TIME_WARP = 5, + EVENT_SPELL_CURSE_OF_EXERTION = 1, + EVENT_SPELL_WOUNDING_STRIKE = 2, + EVENT_SPELL_TIME_STOP = 3, + EVENT_SPELL_TIME_WARP = 4, + EVENT_TIME_WARP = 5, }; enum Yells @@ -52,75 +52,75 @@ public: } EventMap events; - uint8 warps; - void Reset() - { - events.Reset(); - warps = 0; - } + uint8 warps; + void Reset() + { + events.Reset(); + warps = 0; + } void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_CURSE_OF_EXERTION, 9000); - events.ScheduleEvent(EVENT_SPELL_WOUNDING_STRIKE, 3000); - events.ScheduleEvent(EVENT_SPELL_TIME_WARP, 25000); + events.ScheduleEvent(EVENT_SPELL_CURSE_OF_EXERTION, 9000); + events.ScheduleEvent(EVENT_SPELL_WOUNDING_STRIKE, 3000); + events.ScheduleEvent(EVENT_SPELL_TIME_WARP, 25000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_TIME_STOP, 20000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_TIME_STOP, 20000); } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_TIME_STEP_H || spellInfo->Id == SPELL_TIME_STEP_N) - { - if (target == me) - return; + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_TIME_STEP_H || spellInfo->Id == SPELL_TIME_STEP_N) + { + if (target == me) + return; - if (warps >= 2) - { - warps = 0; - return; - } - warps++; - me->CastSpell(target, DUNGEON_MODE(SPELL_TIME_STEP_N, SPELL_TIME_STEP_H), true); - } - } + if (warps >= 2) + { + warps = 0; + return; + } + warps++; + me->CastSpell(target, DUNGEON_MODE(SPELL_TIME_STEP_N, SPELL_TIME_STEP_H), true); + } + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_CURSE_OF_EXERTION: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, SPELL_CURSE_OF_EXERTION, false); - events.RepeatEvent(9000); - break; - case EVENT_SPELL_WOUNDING_STRIKE: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_WOUNDING_STRIKE_N, SPELL_WOUNDING_STRIKE_H), false); - events.RepeatEvent(6000); - break; - case EVENT_SPELL_TIME_STOP: - me->CastSpell(me, SPELL_TIME_STOP, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_TIME_WARP: - Talk(SAY_TIME_WARP); - me->CastSpell(me, SPELL_TIME_WARP, false); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, DUNGEON_MODE(SPELL_TIME_STEP_N, SPELL_TIME_STEP_H), true); + switch (events.GetEvent()) + { + case EVENT_SPELL_CURSE_OF_EXERTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, SPELL_CURSE_OF_EXERTION, false); + events.RepeatEvent(9000); + break; + case EVENT_SPELL_WOUNDING_STRIKE: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_WOUNDING_STRIKE_N, SPELL_WOUNDING_STRIKE_H), false); + events.RepeatEvent(6000); + break; + case EVENT_SPELL_TIME_STOP: + me->CastSpell(me, SPELL_TIME_STOP, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_TIME_WARP: + Talk(SAY_TIME_WARP); + me->CastSpell(me, SPELL_TIME_WARP, false); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, DUNGEON_MODE(SPELL_TIME_STEP_N, SPELL_TIME_STEP_H), true); - events.RepeatEvent(25000); - break; - } + events.RepeatEvent(25000); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp index 0d2f3038d..8bc97d879 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp @@ -8,16 +8,16 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_CORRUPTING_BLIGHT = 60588, - SPELL_VOID_STRIKE = 60590, - SPELL_CORRUPTION_OF_TIME_AURA = 60451, - SPELL_CORRUPTION_OF_TIME_CHANNEL = 60422, + SPELL_CORRUPTING_BLIGHT = 60588, + SPELL_VOID_STRIKE = 60590, + SPELL_CORRUPTION_OF_TIME_AURA = 60451, + SPELL_CORRUPTION_OF_TIME_CHANNEL = 60422, }; enum Events { - EVENT_SPELL_CORRUPTING_BLIGHT = 1, - EVENT_SPELL_VOID_STRIKE = 2, + EVENT_SPELL_CORRUPTING_BLIGHT = 1, + EVENT_SPELL_VOID_STRIKE = 2, }; enum Yells @@ -44,96 +44,96 @@ public: } EventMap events; - SummonList summons; - uint32 beamTimer; + SummonList summons; + uint32 beamTimer; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (pInstance->GetData(DATA_GUARDIANTIME_EVENT) == 0) - me->DespawnOrUnsummon(500); + void Reset() + { + events.Reset(); + summons.DespawnAll(); + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (pInstance->GetData(DATA_GUARDIANTIME_EVENT) == 0) + me->DespawnOrUnsummon(500); - me->SummonCreature(NPC_TIME_RIFT, 2337.6f, 1270.0f, 132.95f, 2.79f); - me->SummonCreature(NPC_GUARDIAN_OF_TIME, 2319.3f, 1267.7f, 132.8f, 1.0f); - beamTimer = 1; - } + me->SummonCreature(NPC_TIME_RIFT, 2337.6f, 1270.0f, 132.95f, 2.79f); + me->SummonCreature(NPC_GUARDIAN_OF_TIME, 2319.3f, 1267.7f, 132.8f, 1.0f); + beamTimer = 1; + } - void JustSummoned(Creature* cr) { summons.Summon(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } void EnterCombat(Unit* /*who*/) { - me->InterruptNonMeleeSpells(false); - events.ScheduleEvent(EVENT_SPELL_VOID_STRIKE, 8000); - events.ScheduleEvent(EVENT_SPELL_CORRUPTING_BLIGHT, 12000); - Talk(SAY_AGGRO); + me->InterruptNonMeleeSpells(false); + events.ScheduleEvent(EVENT_SPELL_VOID_STRIKE, 8000); + events.ScheduleEvent(EVENT_SPELL_CORRUPTING_BLIGHT, 12000); + Talk(SAY_AGGRO); } - void JustDied(Unit* /*killer*/) + void JustDied(Unit* /*killer*/) { - Talk(SAY_DEATH); - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* cr = ObjectAccessor::GetCreature(*me, (*itr))) - { - if (cr->GetEntry() == NPC_TIME_RIFT) - cr->DespawnOrUnsummon(1000); - else - { - cr->DespawnOrUnsummon(5000); - cr->RemoveAllAuras(); - cr->MonsterSay("You have my thanks for saving my existence in this timeline. Now i must report back to my superiors. They must know immediately of what i just experienced.", LANG_UNIVERSAL, 0); - } - } + Talk(SAY_DEATH); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* cr = ObjectAccessor::GetCreature(*me, (*itr))) + { + if (cr->GetEntry() == NPC_TIME_RIFT) + cr->DespawnOrUnsummon(1000); + else + { + cr->DespawnOrUnsummon(5000); + cr->RemoveAllAuras(); + cr->MonsterSay("You have my thanks for saving my existence in this timeline. Now i must report back to my superiors. They must know immediately of what i just experienced.", LANG_UNIVERSAL, 0); + } + } - if (InstanceScript* pInstance = me->GetInstanceScript()) - pInstance->SetData(DATA_SHOW_INFINITE_TIMER, 0); + if (InstanceScript* pInstance = me->GetInstanceScript()) + pInstance->SetData(DATA_SHOW_INFINITE_TIMER, 0); } - void DoAction(int32 param) - { - if (!me->IsAlive()) - return; + void DoAction(int32 param) + { + if (!me->IsAlive()) + return; - if (param == ACTION_RUN_OUT_OF_TIME) - { - Talk(SAY_FAIL); - summons.DespawnAll(); - me->DespawnOrUnsummon(500); - } - } + if (param == ACTION_RUN_OUT_OF_TIME) + { + Talk(SAY_FAIL); + summons.DespawnAll(); + me->DespawnOrUnsummon(500); + } + } void UpdateAI(uint32 diff) { - if (beamTimer) - { - beamTimer += diff; - if (beamTimer >= 2000) - { - me->CastSpell(me, SPELL_CORRUPTION_OF_TIME_CHANNEL, true); - beamTimer = 0; - } - } + if (beamTimer) + { + beamTimer += diff; + if (beamTimer >= 2000) + { + me->CastSpell(me, SPELL_CORRUPTION_OF_TIME_CHANNEL, true); + beamTimer = 0; + } + } if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_VOID_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_VOID_STRIKE, false); - events.RepeatEvent(8000); - break; - case EVENT_SPELL_CORRUPTING_BLIGHT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, SPELL_CORRUPTING_BLIGHT, false); - events.RepeatEvent(12000); - break; - } + switch (events.GetEvent()) + { + case EVENT_SPELL_VOID_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_VOID_STRIKE, false); + events.RepeatEvent(8000); + break; + case EVENT_SPELL_CORRUPTING_BLIGHT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, SPELL_CORRUPTING_BLIGHT, false); + events.RepeatEvent(12000); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index 5eda52bd2..182ec74e0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -9,21 +9,21 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_CARRION_SWARM_N = 52720, - SPELL_CARRION_SWARM_H = 58852, - SPELL_MIND_BLAST_N = 52722, - SPELL_MIND_BLAST_H = 58850, - SPELL_SLEEP_N = 52721, - SPELL_SLEEP_H = 58849, - SPELL_VAMPIRIC_TOUCH = 52723, + SPELL_CARRION_SWARM_N = 52720, + SPELL_CARRION_SWARM_H = 58852, + SPELL_MIND_BLAST_N = 52722, + SPELL_MIND_BLAST_H = 58850, + SPELL_SLEEP_N = 52721, + SPELL_SLEEP_H = 58849, + SPELL_VAMPIRIC_TOUCH = 52723, }; enum Events { - EVENT_SPELL_CARRION_SWARM = 1, - EVENT_SPELL_MIND_BLAST = 2, - EVENT_SPELL_SLEEP = 3, - EVENT_SPELL_VAMPIRIC_TOUCH = 4, + EVENT_SPELL_CARRION_SWARM = 1, + EVENT_SPELL_MIND_BLAST = 2, + EVENT_SPELL_SLEEP = 3, + EVENT_SPELL_VAMPIRIC_TOUCH = 4, }; enum Yells @@ -53,31 +53,31 @@ public: { boss_mal_ganisAI(Creature* c) : ScriptedAI(c) { - finished = false; + finished = false; } EventMap events; - bool finished; + bool finished; - void Reset() - { - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true); - events.Reset(); - if (finished) - { - Talk(SAY_OUTRO); - me->DespawnOrUnsummon(20000); - } - } + void Reset() + { + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true); + events.Reset(); + if (finished) + { + Talk(SAY_OUTRO); + me->DespawnOrUnsummon(20000); + } + } void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_CARRION_SWARM, 6000); - events.ScheduleEvent(EVENT_SPELL_MIND_BLAST, 11000); - events.ScheduleEvent(EVENT_SPELL_SLEEP, 20000); - events.ScheduleEvent(EVENT_SPELL_VAMPIRIC_TOUCH, 15000); + events.ScheduleEvent(EVENT_SPELL_CARRION_SWARM, 6000); + events.ScheduleEvent(EVENT_SPELL_MIND_BLAST, 11000); + events.ScheduleEvent(EVENT_SPELL_SLEEP, 20000); + events.ScheduleEvent(EVENT_SPELL_VAMPIRIC_TOUCH, 15000); } void JustDied(Unit* /*killer*/) @@ -92,67 +92,67 @@ public: Talk(SAY_SLAY); } - void DamageTaken(Unit* who, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (!finished && damage >= me->GetHealth()) - { - damage = 0; - finished = true; - me->SetRegeneratingHealth(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - if (InstanceScript* pInstance = me->GetInstanceScript()) - { - if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_ARTHAS))) - cr->AI()->DoAction(ACTION_KILLED_MALGANIS); - - // give credit to players - me->CastSpell(me, 58630, true); - } - - // quest completion - if (who) - if (Player* player = who->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->RewardPlayerAndGroupAtEvent(31006, player); // Royal Escort quest, Mal'ganis bunny - - EnterEvadeMode(); - } - } - - void UpdateAI(uint32 diff) + void DamageTaken(Unit* who, uint32 &damage, DamageEffectType, SpellSchoolMask) { - if (!UpdateVictim()) - return; + if (!finished && damage >= me->GetHealth()) + { + damage = 0; + finished = true; + me->SetRegeneratingHealth(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + if (InstanceScript* pInstance = me->GetInstanceScript()) + { + if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_ARTHAS))) + cr->AI()->DoAction(ACTION_KILLED_MALGANIS); - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + // give credit to players + me->CastSpell(me, 58630, true); + } - switch (events.GetEvent()) - { - case EVENT_SPELL_CARRION_SWARM: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_CARRION_SWARM_N, SPELL_CARRION_SWARM_H), false); - events.RepeatEvent(7000); - break; - case EVENT_SPELL_MIND_BLAST: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, DUNGEON_MODE(SPELL_MIND_BLAST_N, SPELL_MIND_BLAST_H), false); - events.RepeatEvent(6000); - break; - case EVENT_SPELL_SLEEP: - Talk(SAY_SLEEP); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, DUNGEON_MODE(SPELL_SLEEP_N, SPELL_SLEEP_H), false); - events.RepeatEvent(17000); - break; - case EVENT_SPELL_VAMPIRIC_TOUCH: - me->CastSpell(me, SPELL_VAMPIRIC_TOUCH, true); - events.RepeatEvent(30000); - break; - } + // quest completion + if (who) + if (Player* player = who->GetCharmerOrOwnerPlayerOrPlayerItself()) + player->RewardPlayerAndGroupAtEvent(31006, player); // Royal Escort quest, Mal'ganis bunny - DoMeleeAttackIfReady(); + EnterEvadeMode(); + } + } + + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + switch (events.GetEvent()) + { + case EVENT_SPELL_CARRION_SWARM: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_CARRION_SWARM_N, SPELL_CARRION_SWARM_H), false); + events.RepeatEvent(7000); + break; + case EVENT_SPELL_MIND_BLAST: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, DUNGEON_MODE(SPELL_MIND_BLAST_N, SPELL_MIND_BLAST_H), false); + events.RepeatEvent(6000); + break; + case EVENT_SPELL_SLEEP: + Talk(SAY_SLEEP); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, DUNGEON_MODE(SPELL_SLEEP_N, SPELL_SLEEP_H), false); + events.RepeatEvent(17000); + break; + case EVENT_SPELL_VAMPIRIC_TOUCH: + me->CastSpell(me, SPELL_VAMPIRIC_TOUCH, true); + events.RepeatEvent(30000); + break; + } + + DoMeleeAttackIfReady(); } }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp index a5ce8715a..edbcad9b8 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp @@ -8,18 +8,18 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_CONSTRICTING_CHAINS_N = 52696, - SPELL_CONSTRICTING_CHAINS_H = 58823, - SPELL_DISEASE_EXPULSION_N = 52666, - SPELL_DISEASE_EXPULSION_H = 58824, - SPELL_FRENZY = 58841, + SPELL_CONSTRICTING_CHAINS_N = 52696, + SPELL_CONSTRICTING_CHAINS_H = 58823, + SPELL_DISEASE_EXPULSION_N = 52666, + SPELL_DISEASE_EXPULSION_H = 58824, + SPELL_FRENZY = 58841, }; enum Events { - EVENT_SPELL_CONSTRICTING_CHAINS = 1, - EVENT_SPELL_DISEASE_EXPULSION = 2, - EVENT_SPELL_FRENZY = 3, + EVENT_SPELL_CONSTRICTING_CHAINS = 1, + EVENT_SPELL_DISEASE_EXPULSION = 2, + EVENT_SPELL_FRENZY = 3, }; enum Yells @@ -47,15 +47,15 @@ public: Talk(SAY_SPAWN); } - EventMap events; - void Reset() { events.Reset(); } + EventMap events; + void Reset() { events.Reset(); } void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - events.RescheduleEvent(EVENT_SPELL_CONSTRICTING_CHAINS, 15000); - events.RescheduleEvent(EVENT_SPELL_DISEASE_EXPULSION, 4000); - events.RescheduleEvent(EVENT_SPELL_FRENZY, 20000); + events.RescheduleEvent(EVENT_SPELL_CONSTRICTING_CHAINS, 15000); + events.RescheduleEvent(EVENT_SPELL_DISEASE_EXPULSION, 4000); + events.RescheduleEvent(EVENT_SPELL_FRENZY, 20000); } void JustDied(Unit* /*killer*/) @@ -71,35 +71,35 @@ public: Talk(SAY_SLAY); } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_DISEASE_EXPULSION: - me->CastSpell(me, DUNGEON_MODE(SPELL_DISEASE_EXPULSION_N, SPELL_DISEASE_EXPULSION_H), false); - events.RepeatEvent(6000); - break; - case EVENT_SPELL_FRENZY: - me->CastSpell(me, SPELL_FRENZY, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_CONSTRICTING_CHAINS: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, 50.0f, true)) - me->CastSpell(pTarget, DUNGEON_MODE(SPELL_CONSTRICTING_CHAINS_N, SPELL_CONSTRICTING_CHAINS_H), false); - events.RepeatEvent(14000); - break; - } + switch (events.GetEvent()) + { + case EVENT_SPELL_DISEASE_EXPULSION: + me->CastSpell(me, DUNGEON_MODE(SPELL_DISEASE_EXPULSION_N, SPELL_DISEASE_EXPULSION_H), false); + events.RepeatEvent(6000); + break; + case EVENT_SPELL_FRENZY: + me->CastSpell(me, SPELL_FRENZY, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_CONSTRICTING_CHAINS: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, 50.0f, true)) + me->CastSpell(pTarget, DUNGEON_MODE(SPELL_CONSTRICTING_CHAINS_N, SPELL_CONSTRICTING_CHAINS_H), false); + events.RepeatEvent(14000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp index 33c8329e6..0c2f3f587 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp @@ -9,24 +9,24 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_SHADOW_BOLT_N = 57725, - SPELL_SHADOW_BOLT_H = 58827, - SPELL_STEAL_FLESH_CHANNEL = 52708, - SPELL_STEAL_FLESH_TARGET = 52711, - SPELL_STEAL_FLESH_CASTER = 52712, - SPELL_SUMMON_GHOULS = 52451, - SPELL_EXPLODE_GHOUL_N = 52480, - SPELL_EXPLODE_GHOUL_H = 58825, - SPELL_CURSE_OF_TWISTED_FAITH = 58845, + SPELL_SHADOW_BOLT_N = 57725, + SPELL_SHADOW_BOLT_H = 58827, + SPELL_STEAL_FLESH_CHANNEL = 52708, + SPELL_STEAL_FLESH_TARGET = 52711, + SPELL_STEAL_FLESH_CASTER = 52712, + SPELL_SUMMON_GHOULS = 52451, + SPELL_EXPLODE_GHOUL_N = 52480, + SPELL_EXPLODE_GHOUL_H = 58825, + SPELL_CURSE_OF_TWISTED_FAITH = 58845, }; enum Events { - EVENT_SPELL_SHADOW_BOLT = 1, - EVENT_SPELL_STEAL_FLESH = 2, - EVENT_SPELL_SUMMON_GHOULS = 3, - EVENT_EXPLODE_GHOUL = 4, - EVENT_SPELL_CURSE = 5, + EVENT_SPELL_SHADOW_BOLT = 1, + EVENT_SPELL_STEAL_FLESH = 2, + EVENT_SPELL_SUMMON_GHOULS = 3, + EVENT_EXPLODE_GHOUL = 4, + EVENT_SPELL_CURSE = 5, }; enum Yells @@ -58,29 +58,29 @@ public: } EventMap events; - SummonList summons; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - } + SummonList summons; + void Reset() + { + events.Reset(); + summons.DespawnAll(); + } - void JustSummoned(Creature* cr) { summons.Summon(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 7000); - events.ScheduleEvent(EVENT_SPELL_STEAL_FLESH, 11000); - events.ScheduleEvent(EVENT_SPELL_SUMMON_GHOULS, 16000); - events.ScheduleEvent(EVENT_EXPLODE_GHOUL, 22000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_CURSE, 25000); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 7000); + events.ScheduleEvent(EVENT_SPELL_STEAL_FLESH, 11000); + events.ScheduleEvent(EVENT_SPELL_SUMMON_GHOULS, 16000); + events.ScheduleEvent(EVENT_EXPLODE_GHOUL, 22000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_CURSE, 25000); } void JustDied(Unit* /*killer*/) { - summons.DespawnAll(); + summons.DespawnAll(); Talk(SAY_DEATH); } @@ -92,55 +92,55 @@ public: Talk(SAY_SLAY); } - void ExplodeGhoul() - { - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* cr = ObjectAccessor::GetCreature(*me, (*itr))) - if (cr->IsAlive()) - { - me->CastSpell(cr, DUNGEON_MODE(SPELL_EXPLODE_GHOUL_N, SPELL_EXPLODE_GHOUL_H), false); - return; - } - } + void ExplodeGhoul() + { + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* cr = ObjectAccessor::GetCreature(*me, (*itr))) + if (cr->IsAlive()) + { + me->CastSpell(cr, DUNGEON_MODE(SPELL_EXPLODE_GHOUL_N, SPELL_EXPLODE_GHOUL_H), false); + return; + } + } - void UpdateAI(uint32 diff) + void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_SHADOW_BOLT: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_SHADOW_BOLT_N, SPELL_SHADOW_BOLT_H), false); - events.RepeatEvent(10000); - break; - case EVENT_SPELL_STEAL_FLESH: - if (!urand(0,2)) - Talk(SAY_STEAL_FLESH); - me->CastSpell(me->GetVictim(), SPELL_STEAL_FLESH_CHANNEL, false); - events.RepeatEvent(12000); - break; - case EVENT_SPELL_SUMMON_GHOULS: - if (!urand(0,2)) - Talk(SAY_SUMMON_GHOULS); - me->CastSpell(me, SPELL_SUMMON_GHOULS, false); - events.RepeatEvent(10000); - break; - case EVENT_EXPLODE_GHOUL: - if (!urand(0,2)) - Talk(SAY_EXPLODE_GHOUL); - ExplodeGhoul(); - events.RepeatEvent(15000); - break; - case EVENT_SPELL_CURSE: - me->CastSpell(me->GetVictim(), SPELL_CURSE_OF_TWISTED_FAITH, false); - events.RepeatEvent(30000); - break; - } + switch (events.GetEvent()) + { + case EVENT_SPELL_SHADOW_BOLT: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_SHADOW_BOLT_N, SPELL_SHADOW_BOLT_H), false); + events.RepeatEvent(10000); + break; + case EVENT_SPELL_STEAL_FLESH: + if (!urand(0,2)) + Talk(SAY_STEAL_FLESH); + me->CastSpell(me->GetVictim(), SPELL_STEAL_FLESH_CHANNEL, false); + events.RepeatEvent(12000); + break; + case EVENT_SPELL_SUMMON_GHOULS: + if (!urand(0,2)) + Talk(SAY_SUMMON_GHOULS); + me->CastSpell(me, SPELL_SUMMON_GHOULS, false); + events.RepeatEvent(10000); + break; + case EVENT_EXPLODE_GHOUL: + if (!urand(0,2)) + Talk(SAY_EXPLODE_GHOUL); + ExplodeGhoul(); + events.RepeatEvent(15000); + break; + case EVENT_SPELL_CURSE: + me->CastSpell(me->GetVictim(), SPELL_CURSE_OF_TWISTED_FAITH, false); + events.RepeatEvent(30000); + break; + } DoMeleeAttackIfReady(); } @@ -159,13 +159,13 @@ class spell_boss_salramm_steal_flesh : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* caster = GetCaster(); - Unit* target = GetUnitOwner(); - if (caster) - { - caster->CastSpell(caster, SPELL_STEAL_FLESH_CASTER, true); - caster->CastSpell(target, SPELL_STEAL_FLESH_TARGET, true); - } + Unit* caster = GetCaster(); + Unit* target = GetUnitOwner(); + if (caster) + { + caster->CastSpell(caster, SPELL_STEAL_FLESH_CASTER, true); + caster->CastSpell(target, SPELL_STEAL_FLESH_TARGET, true); + } } void Register() @@ -183,5 +183,5 @@ class spell_boss_salramm_steal_flesh : public SpellScriptLoader void AddSC_boss_salramm() { new boss_salramm(); - new spell_boss_salramm_steal_flesh(); + new spell_boss_salramm_steal_flesh(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 265d3c7b9..4d43f3b4a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -96,43 +96,43 @@ enum Says enum NPCs { // City part - NPC_RISEN_ZOMBIE = 27737, - NPC_DEVOURING_GHOUL = 28249, - NPC_DARK_NECROMANCER = 28200, - NPC_TOMB_STALKER = 28199, - NPC_CRYPT_FIEND = 27734, - NPC_BILE_GOLEM = 28201, - NPC_ENRAGING_GHOUL = 27729, - NPC_PATCHWORK_CONSTRUCT = 27736, + NPC_RISEN_ZOMBIE = 27737, + NPC_DEVOURING_GHOUL = 28249, + NPC_DARK_NECROMANCER = 28200, + NPC_TOMB_STALKER = 28199, + NPC_CRYPT_FIEND = 27734, + NPC_BILE_GOLEM = 28201, + NPC_ENRAGING_GHOUL = 27729, + NPC_PATCHWORK_CONSTRUCT = 27736, - // Town hall part - NPC_INFINITE_ADVERSARY = 27742, - NPC_INFINITE_HUNTER = 27743, - NPC_INFINITE_AGENT = 27744, + // Town hall part + NPC_INFINITE_ADVERSARY = 27742, + NPC_INFINITE_HUNTER = 27743, + NPC_INFINITE_AGENT = 27744, - // Generic - NPC_INVIS_TARGET = 20562, - NPC_KNIGHT_ESCORT = 27745, - NPC_HORSE_ESCORT = 27746, - NPC_PRIEST_ESCORT = 27747, - NPC_CITY_MAN = 28167, - NPC_CITY_MAN2 = 28169, - NPC_CITY_MAN3 = 31126, - NPC_CITY_MAN4 = 31127, + // Generic + NPC_INVIS_TARGET = 20562, + NPC_KNIGHT_ESCORT = 27745, + NPC_HORSE_ESCORT = 27746, + NPC_PRIEST_ESCORT = 27747, + NPC_CITY_MAN = 28167, + NPC_CITY_MAN2 = 28169, + NPC_CITY_MAN3 = 31126, + NPC_CITY_MAN4 = 31127, }; enum Spells { - // Combat spells - SPELL_ARTHAS_AURA = 52442, - SPELL_ARTHAS_EXORCISM_N = 52445, - SPELL_ARTHAS_EXORCISM_H = 58822, - SPELL_ARTHAS_HOLY_LIGHT = 52444, + // Combat spells + SPELL_ARTHAS_AURA = 52442, + SPELL_ARTHAS_EXORCISM_N = 52445, + SPELL_ARTHAS_EXORCISM_H = 58822, + SPELL_ARTHAS_HOLY_LIGHT = 52444, - // Visuals - SPELL_MALGANIS_APPEAR = 51908, - SPELL_GREEN_VISUAL_AURA = 25039, - SPELL_ARTHAS_CRUSADER_STRIKE = 50773, + // Visuals + SPELL_MALGANIS_APPEAR = 51908, + SPELL_GREEN_VISUAL_AURA = 25039, + SPELL_ARTHAS_CRUSADER_STRIKE = 50773, }; @@ -145,39 +145,39 @@ enum Spells enum GossipMenuArthas { - GOSSIP_MENU_ARTHAS_1 = 13076, - GOSSIP_MENU_ARTHAS_2 = 13125, - GOSSIP_MENU_ARTHAS_3 = 13126, - GOSSIP_MENU_ARTHAS_4 = 13177, - GOSSIP_MENU_ARTHAS_5 = 13179, - GOSSIP_MENU_ARTHAS_6 = 13287, + GOSSIP_MENU_ARTHAS_1 = 13076, + GOSSIP_MENU_ARTHAS_2 = 13125, + GOSSIP_MENU_ARTHAS_3 = 13126, + GOSSIP_MENU_ARTHAS_4 = 13177, + GOSSIP_MENU_ARTHAS_5 = 13179, + GOSSIP_MENU_ARTHAS_6 = 13287, }; enum Misc { - // City waves - ENCOUNTER_WAVES_NUMBER = 8, - ENCOUNTER_WAVES_MAX_SPAWNS = 4, + // City waves + ENCOUNTER_WAVES_NUMBER = 8, + ENCOUNTER_WAVES_MAX_SPAWNS = 4, - // Town Hall waves - ENCOUNTER_CHRONO_NUMBER = 5, - ENCOUNTER_CHRONO_MAX_SPAWNS_FIRST = 5, - ENCOUNTER_CHRONO_MAX_SPAWNS_SECOND = 3, + // Town Hall waves + ENCOUNTER_CHRONO_NUMBER = 5, + ENCOUNTER_CHRONO_MAX_SPAWNS_FIRST = 5, + ENCOUNTER_CHRONO_MAX_SPAWNS_SECOND = 3, - ACTION_INFECT_CITIZIEN = 1, - ACTION_FORCE_CHANGE_LOCK = 2, + ACTION_INFECT_CITIZIEN = 1, + ACTION_FORCE_CHANGE_LOCK = 2, - POINT_CHRONOS = 1, + POINT_CHRONOS = 1, }; enum Events { - EVENT_COMBAT_EXORCISM = 1, - EVENT_COMBAT_HEALTH_CHECK = 2, - EVENT_ACTION_PHASE1 = 100, - EVENT_ACTION_PHASE2 = 200, - EVENT_ACTION_PHASE3 = 300, - EVENT_ACTION_PHASE5 = 500, + EVENT_COMBAT_EXORCISM = 1, + EVENT_COMBAT_HEALTH_CHECK = 2, + EVENT_ACTION_PHASE1 = 100, + EVENT_ACTION_PHASE2 = 200, + EVENT_ACTION_PHASE3 = 300, + EVENT_ACTION_PHASE5 = 500, }; // Locations for necromancers and add to spawn @@ -236,41 +236,41 @@ float WavesLocations[ENCOUNTER_WAVES_NUMBER][ENCOUNTER_WAVES_MAX_SPAWNS][5]= // Locations for rifts to spawn and draconians to go float RiftAndSpawnsLocations[ENCOUNTER_CHRONO_NUMBER][ENCOUNTER_CHRONO_MAX_SPAWNS_FIRST][5]= { - { - {NPC_TIME_RIFT, 2431.790039f, 1190.670044f, 148.076004f, 0.187923f}, - {NPC_INFINITE_ADVERSARY, 2433.857910f, 1185.612061f, 148.075974f, 4.566168f}, - {NPC_INFINITE_ADVERSARY, 2437.577881f, 1188.241089f, 148.075974f, 0.196999f}, - {NPC_INFINITE_AGENT, 2437.165527f, 1192.294922f, 148.075974f, 0.169247f}, - {NPC_INFINITE_HUNTER, 2434.989990f, 1197.679565f, 148.075974f, 0.715971f} - }, - { - {NPC_TIME_RIFT, 2403.954834f, 1178.815430f, 148.075943f, 4.966126f}, - {NPC_INFINITE_AGENT, 2403.676758f, 1171.495850f, 148.075607f, 4.902797f}, - {NPC_INFINITE_HUNTER, 2407.691162f, 1172.162720f, 148.075607f, 4.963010f}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0} - }, - { - {NPC_TIME_RIFT, 2414.217041f, 1133.446167f, 148.076050f, 1.706972f}, - {NPC_INFINITE_ADVERSARY, 2416.024658f, 1139.456177f, 148.076431f, 1.752129f}, - {NPC_INFINITE_HUNTER, 2410.866699f, 1139.680542f, 148.076431f, 1.752129f}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0} - }, - { - {NPC_TIME_RIFT, 2433.081543f, 1099.869751f, 148.076157f, 1.809509f}, - {NPC_INFINITE_ADVERSARY, 2426.947998f, 1107.471680f, 148.076019f, 1.877580f}, - {NPC_INFINITE_HUNTER, 2432.944580f, 1108.896362f, 148.208160f, 2.199241f}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0} - }, - { - {NPC_TIME_RIFT, 2444.077637f, 1114.366089f, 148.076157f, 3.049565f}, - {NPC_INFINITE_ADVERSARY, 2438.190674f, 1118.368164f, 148.076172f, 3.139232f}, - {NPC_INFINITE_AGENT, 2435.861328f, 1113.402954f, 148.169327f, 2.390271f}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0} - } + { + {NPC_TIME_RIFT, 2431.790039f, 1190.670044f, 148.076004f, 0.187923f}, + {NPC_INFINITE_ADVERSARY, 2433.857910f, 1185.612061f, 148.075974f, 4.566168f}, + {NPC_INFINITE_ADVERSARY, 2437.577881f, 1188.241089f, 148.075974f, 0.196999f}, + {NPC_INFINITE_AGENT, 2437.165527f, 1192.294922f, 148.075974f, 0.169247f}, + {NPC_INFINITE_HUNTER, 2434.989990f, 1197.679565f, 148.075974f, 0.715971f} + }, + { + {NPC_TIME_RIFT, 2403.954834f, 1178.815430f, 148.075943f, 4.966126f}, + {NPC_INFINITE_AGENT, 2403.676758f, 1171.495850f, 148.075607f, 4.902797f}, + {NPC_INFINITE_HUNTER, 2407.691162f, 1172.162720f, 148.075607f, 4.963010f}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0} + }, + { + {NPC_TIME_RIFT, 2414.217041f, 1133.446167f, 148.076050f, 1.706972f}, + {NPC_INFINITE_ADVERSARY, 2416.024658f, 1139.456177f, 148.076431f, 1.752129f}, + {NPC_INFINITE_HUNTER, 2410.866699f, 1139.680542f, 148.076431f, 1.752129f}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0} + }, + { + {NPC_TIME_RIFT, 2433.081543f, 1099.869751f, 148.076157f, 1.809509f}, + {NPC_INFINITE_ADVERSARY, 2426.947998f, 1107.471680f, 148.076019f, 1.877580f}, + {NPC_INFINITE_HUNTER, 2432.944580f, 1108.896362f, 148.208160f, 2.199241f}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0} + }, + { + {NPC_TIME_RIFT, 2444.077637f, 1114.366089f, 148.076157f, 3.049565f}, + {NPC_INFINITE_ADVERSARY, 2438.190674f, 1118.368164f, 148.076172f, 3.139232f}, + {NPC_INFINITE_AGENT, 2435.861328f, 1113.402954f, 148.169327f, 2.390271f}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0} + } }; class npc_arthas : public CreatureScript @@ -280,58 +280,58 @@ public: bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { - if (creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - { - switch (action) - { - case GOSSIP_ACTION_INFO_DEF+1: - creature->AI()->DoAction(ACTION_START_CITY); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - player->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->PlayerTalkClass->ClearMenus(); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - player->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_3, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - // Start Town Hall part - creature->AI()->DoAction(ACTION_START_TOWN_HALL); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - player->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF+4: - // After killing epoch - creature->AI()->DoAction(ACTION_START_SECRET_PASSAGE); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - creature->SetTarget(0); - player->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF+5: - creature->AI()->DoAction(ACTION_START_LAST_CITY); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - player->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF+6: - creature->AI()->DoAction(ACTION_START_MALGANIS); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - player->CLOSE_GOSSIP_MENU(); - break; - } - } + if (creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + { + switch (action) + { + case GOSSIP_ACTION_INFO_DEF+1: + creature->AI()->DoAction(ACTION_START_CITY); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + player->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF+2: + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + player->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_3, creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + // Start Town Hall part + creature->AI()->DoAction(ACTION_START_TOWN_HALL); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + player->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF+4: + // After killing epoch + creature->AI()->DoAction(ACTION_START_SECRET_PASSAGE); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + creature->SetTarget(0); + player->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF+5: + creature->AI()->DoAction(ACTION_START_LAST_CITY); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + player->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF+6: + creature->AI()->DoAction(ACTION_START_MALGANIS); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + player->CLOSE_GOSSIP_MENU(); + break; + } + } return true; } bool OnGossipHello(Player* player, Creature* creature) { - InstanceScript* pInstance = creature->GetInstanceScript(); - if (!pInstance) - return false; + InstanceScript* pInstance = creature->GetInstanceScript(); + if (!pInstance) + return false; switch (pInstance->GetData(DATA_ARTHAS_EVENT)) - { - case COS_PROGRESS_FINISHED_INTRO: + { + case COS_PROGRESS_FINISHED_INTRO: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_1, creature->GetGUID()); break; @@ -339,16 +339,16 @@ public: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); player->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_2, creature->GetGUID()); break; - case COS_PROGRESS_KILLED_EPOCH: + case COS_PROGRESS_KILLED_EPOCH: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); player->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_4, creature->GetGUID()); break; - case COS_PROGRESS_LAST_CITY: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + case COS_PROGRESS_LAST_CITY: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); player->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_5, creature->GetGUID()); break; - case COS_PROGRESS_BEFORE_MALGANIS: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + case COS_PROGRESS_BEFORE_MALGANIS: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); player->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_6, creature->GetGUID()); break; } @@ -368,225 +368,225 @@ public: } InstanceScript* pInstance; - SummonList summons; + SummonList summons; bool eventInRun; - EventMap actionEvents; - EventMap combatEvents; - uint8 waveGroupId; - uint8 waveKillCount; - uint8 timeRiftId; + EventMap actionEvents; + EventMap combatEvents; + uint8 waveGroupId; + uint8 waveKillCount; + uint8 timeRiftId; - Creature* GetEventNpc(uint32 entry); - void ScheduleNextEvent(uint32 currentEvent, uint32 time); - void SummonNextWave(); - void ReorderInstance(uint32 data); - void EnterCombat(Unit* /*who*/); - void SendNextWave(uint32 entry); - void SpawnTimeRift(); + Creature* GetEventNpc(uint32 entry); + void ScheduleNextEvent(uint32 currentEvent, uint32 time); + void SummonNextWave(); + void ReorderInstance(uint32 data); + void EnterCombat(Unit* /*who*/); + void SendNextWave(uint32 entry); + void SpawnTimeRift(); - void JustDied(Unit*) - { - RemoveEscortState(STATE_ESCORT_ESCORTING); - if (pInstance) - pInstance->SetData(DATA_ARTHAS_REPOSITION, 2); - } + void JustDied(Unit*) + { + RemoveEscortState(STATE_ESCORT_ESCORTING); + if (pInstance) + pInstance->SetData(DATA_ARTHAS_REPOSITION, 2); + } - void JustSummoned(Creature* cr) - { - summons.Summon(cr); - } + void JustSummoned(Creature* cr) + { + summons.Summon(cr); + } - void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } + void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } - void SummonedCreatureDies(Creature* cr, Unit*) - { - if (pInstance && pInstance->GetData(DATA_ARTHAS_EVENT) > COS_PROGRESS_FINISHED_INTRO && pInstance->GetData(DATA_ARTHAS_EVENT) < COS_PROGRESS_REACHED_TOWN_HALL) - SendNextWave(cr->GetEntry()); - } + void SummonedCreatureDies(Creature* cr, Unit*) + { + if (pInstance && pInstance->GetData(DATA_ARTHAS_EVENT) > COS_PROGRESS_FINISHED_INTRO && pInstance->GetData(DATA_ARTHAS_EVENT) < COS_PROGRESS_REACHED_TOWN_HALL) + SendNextWave(cr->GetEntry()); + } - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT) - { - // Event - eventInRun = true; - actionEvents.ScheduleEvent(EVENT_ACTION_PHASE1, 0); - } - else if (param == ACTION_START_CITY) - { - Talk(SAY_PHASE201); - actionEvents.ScheduleEvent(EVENT_ACTION_PHASE2, 12000); - SetRun(false); - eventInRun = true; + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT) + { + // Event + eventInRun = true; + actionEvents.ScheduleEvent(EVENT_ACTION_PHASE1, 0); + } + else if (param == ACTION_START_CITY) + { + Talk(SAY_PHASE201); + actionEvents.ScheduleEvent(EVENT_ACTION_PHASE2, 12000); + SetRun(false); + eventInRun = true; - me->SummonCreature(NPC_CITY_MAN, EventPos[EVENT_SRC_TOWN_CITYMAN1]); + me->SummonCreature(NPC_CITY_MAN, EventPos[EVENT_SRC_TOWN_CITYMAN1]); me->SummonCreature(NPC_CITY_MAN2, EventPos[EVENT_SRC_TOWN_CITYMAN2]); - } - else if (param == ACTION_KILLED_SALRAMM) - { - waveGroupId = 10; - eventInRun = true; - SetRun(true); - actionEvents.ScheduleEvent(EVENT_ACTION_PHASE2+9, 10000); - } - else if (param == ACTION_START_TOWN_HALL) - { - Talk(SAY_PHASE301); - SetEscortPaused(false); - SetRun(false); + } + else if (param == ACTION_KILLED_SALRAMM) + { + waveGroupId = 10; + eventInRun = true; + SetRun(true); + actionEvents.ScheduleEvent(EVENT_ACTION_PHASE2+9, 10000); + } + else if (param == ACTION_START_TOWN_HALL) + { + Talk(SAY_PHASE301); + SetEscortPaused(false); + SetRun(false); - Creature* cr = NULL; - if (cr = me->SummonCreature(NPC_CITY_MAN3, EventPos[EVENT_SRC_HALL_CITYMAN1])) - cr->AI()->DoAction(ACTION_FORCE_CHANGE_LOCK); - if (cr = me->SummonCreature(NPC_CITY_MAN4, EventPos[EVENT_SRC_HALL_CITYMAN2])) - cr->AI()->DoAction(ACTION_FORCE_CHANGE_LOCK); - if (cr = me->SummonCreature(NPC_CITY_MAN, EventPos[EVENT_SRC_HALL_CITYMAN3])) - cr->AI()->DoAction(ACTION_FORCE_CHANGE_LOCK); - } - else if (param == ACTION_START_SECRET_PASSAGE) - { - Talk(SAY_PHASE401); - SetEscortPaused(false); - SetRun(false); - } - else if (param == ACTION_START_LAST_CITY) - { - Talk(SAY_PHASE404); - SetEscortPaused(false); - SetRun(true); - } - else if (param == ACTION_START_MALGANIS) - { - summons.DespawnAll(); - if (Creature* cr = me->SummonCreature(NPC_MAL_GANIS, EventPos[EVENT_SRC_MALGANIS_FINAL])) - { - summons.Despawn(cr); - summons.Summon(cr); - cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + Creature* cr = NULL; + if (cr = me->SummonCreature(NPC_CITY_MAN3, EventPos[EVENT_SRC_HALL_CITYMAN1])) + cr->AI()->DoAction(ACTION_FORCE_CHANGE_LOCK); + if (cr = me->SummonCreature(NPC_CITY_MAN4, EventPos[EVENT_SRC_HALL_CITYMAN2])) + cr->AI()->DoAction(ACTION_FORCE_CHANGE_LOCK); + if (cr = me->SummonCreature(NPC_CITY_MAN, EventPos[EVENT_SRC_HALL_CITYMAN3])) + cr->AI()->DoAction(ACTION_FORCE_CHANGE_LOCK); + } + else if (param == ACTION_START_SECRET_PASSAGE) + { + Talk(SAY_PHASE401); + SetEscortPaused(false); + SetRun(false); + } + else if (param == ACTION_START_LAST_CITY) + { + Talk(SAY_PHASE404); + SetEscortPaused(false); + SetRun(true); + } + else if (param == ACTION_START_MALGANIS) + { + summons.DespawnAll(); + if (Creature* cr = me->SummonCreature(NPC_MAL_GANIS, EventPos[EVENT_SRC_MALGANIS_FINAL])) + { + summons.Despawn(cr); + summons.Summon(cr); + cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - Talk(SAY_PHASE501); - SetEscortPaused(false); - SetRun(true); - } - else if (param == ACTION_KILLED_MALGANIS) - { - EnterEvadeMode(); - eventInRun = true; - actionEvents.ScheduleEvent(EVENT_ACTION_PHASE5+1, 22000); - me->SetFacingTo(1.84f); + } + Talk(SAY_PHASE501); + SetEscortPaused(false); + SetRun(true); + } + else if (param == ACTION_KILLED_MALGANIS) + { + EnterEvadeMode(); + eventInRun = true; + actionEvents.ScheduleEvent(EVENT_ACTION_PHASE5+1, 22000); + me->SetFacingTo(1.84f); - if (!me->GetMap()->GetPlayers().isEmpty()) - if (Player* player = me->GetMap()->GetPlayers().getFirst()->GetSource()) - player->RewardPlayerAndGroupAtEvent(31006, player); // Malganis quest entry required - } - } + if (!me->GetMap()->GetPlayers().isEmpty()) + if (Player* player = me->GetMap()->GetPlayers().getFirst()->GetSource()) + player->RewardPlayerAndGroupAtEvent(31006, player); // Malganis quest entry required + } + } void Reset() { actionEvents.Reset(); - combatEvents.Reset(); - summons.DespawnAll(); - eventInRun = false; - waveGroupId = 0; - waveKillCount = 0; - timeRiftId = 0; + combatEvents.Reset(); + summons.DespawnAll(); + eventInRun = false; + waveGroupId = 0; + waveKillCount = 0; + timeRiftId = 0; - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - if (pInstance) - { - pInstance->SetData(DATA_ARTHAS_REPOSITION, 1); - uint32 data = pInstance->GetData(DATA_ARTHAS_EVENT); - if (data >= COS_PROGRESS_FINISHED_INTRO) - ReorderInstance(data); - } + if (pInstance) + { + pInstance->SetData(DATA_ARTHAS_REPOSITION, 1); + uint32 data = pInstance->GetData(DATA_ARTHAS_EVENT); + if (data >= COS_PROGRESS_FINISHED_INTRO) + ReorderInstance(data); + } } void WaypointReached(uint32 uiPointId) { switch(uiPointId) { - // Starting waypoint, After reaching uther and jaina + // Starting waypoint, After reaching uther and jaina case 0: - // On the mountain with uther and jaina - case 1: - // Reaching city man in city - case 9: - // Reaching city man in town hall - case 23: - SetEscortPaused(true); + // On the mountain with uther and jaina + case 1: + // Reaching city man in city + case 9: + // Reaching city man in town hall + case 23: + SetEscortPaused(true); eventInRun = true; break; - // After intro, in front of bridge - case 3: - SetRun(true); - Talk(SAY_PHASE118); - summons.DespawnAll(); // uther, jaina and horses - break; - // Reached City + // After intro, in front of bridge + case 3: + SetRun(true); + Talk(SAY_PHASE118); + summons.DespawnAll(); // uther, jaina and horses + break; + // Reached City case 8: me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); SetEscortPaused(true); - if (pInstance) - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_FINISHED_INTRO); + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_FINISHED_INTRO); - if (Creature* stalker = me->SummonCreature(NPC_INVIS_TARGET, 2026.469f, 1287.088f, 143.596f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 14000)) + if (Creature* stalker = me->SummonCreature(NPC_INVIS_TARGET, 2026.469f, 1287.088f, 143.596f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 14000)) { me->SetFacingToObject(stalker); - stalker->DespawnOrUnsummon(500); + stalker->DespawnOrUnsummon(500); } break; - // Reached first cityman - case 10: - if (Creature* cityman = GetEventNpc(NPC_CITY_MAN)) - { - cityman->AI()->Talk(SAY_PHASE204); - me->CastSpell(cityman, SPELL_ARTHAS_CRUSADER_STRIKE, true); - } - break; - // Reached second cityman - case 11: - if (Creature* cityman = GetEventNpc(NPC_CITY_MAN2)) - { - cityman->MonsterSay("Oh no...", LANG_UNIVERSAL, 0); // missing script_text - me->CastSpell(cityman, SPELL_ARTHAS_CRUSADER_STRIKE, true); - } - me->SetReactState(REACT_DEFENSIVE); - SetEscortPaused(true); - eventInRun = true; - break; - // Reached Town Hall - case 20: - if (pInstance) - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_REACHED_TOWN_HALL); + // Reached first cityman + case 10: + if (Creature* cityman = GetEventNpc(NPC_CITY_MAN)) + { + cityman->AI()->Talk(SAY_PHASE204); + me->CastSpell(cityman, SPELL_ARTHAS_CRUSADER_STRIKE, true); + } + break; + // Reached second cityman + case 11: + if (Creature* cityman = GetEventNpc(NPC_CITY_MAN2)) + { + cityman->MonsterSay("Oh no...", LANG_UNIVERSAL, 0); // missing script_text + me->CastSpell(cityman, SPELL_ARTHAS_CRUSADER_STRIKE, true); + } + me->SetReactState(REACT_DEFENSIVE); + SetEscortPaused(true); + eventInRun = true; + break; + // Reached Town Hall + case 20: + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_REACHED_TOWN_HALL); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); SetRun(false); SetEscortPaused(true); break; - // Inside Town Hall first scene pos - case 22: - actionEvents.ScheduleEvent(EVENT_ACTION_PHASE3, 0); - eventInRun = true; - SetEscortPaused(true); - break; - // Town Hall, upper floor first fight - case 26: - SetEscortPaused(true); + // Inside Town Hall first scene pos + case 22: + actionEvents.ScheduleEvent(EVENT_ACTION_PHASE3, 0); + eventInRun = true; + SetEscortPaused(true); + break; + // Town Hall, upper floor first fight + case 26: + SetEscortPaused(true); eventInRun = true; SpawnTimeRift(); Talk(SAY_PHASE307); break; - // Town Hall, upper floor second fight - case 29: + // Town Hall, upper floor second fight + case 29: SpawnTimeRift(); SpawnTimeRift(); Talk(SAY_PHASE309); SetEscortPaused(true); eventInRun = true; break; - // Town Hall, upper floor third fight - case 31: + // Town Hall, upper floor third fight + case 31: SetRun(false); SpawnTimeRift(); SpawnTimeRift(); @@ -594,30 +594,30 @@ public: SetEscortPaused(true); eventInRun = true; break; - // Book Shelf - case 34: + // Book Shelf + case 34: Talk(SAY_PHASE402); break; case 35: Talk(SAY_PHASE403); break; - // Reached book shelf - case 36: - SetRun(true); + // Reached book shelf + case 36: + SetRun(true); if (pInstance) if (GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SHKAF_GATE))) pGate->SetGoState(GO_STATE_ACTIVE); - break; - // Behind secred passage - case 45: + break; + // Behind secred passage + case 45: SetRun(true); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); SetEscortPaused(true); - if (pInstance) - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_LAST_CITY); + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_LAST_CITY); break; - // Some walk talk - case 47: + // Some walk talk + case 47: SetRun(false); Talk(SAY_PHASE405); break; @@ -628,25 +628,25 @@ public: case 53: Talk(SAY_PHASE407); break; - // Before Malganis event + // Before Malganis event case 54: - if (pInstance) - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_BEFORE_MALGANIS); + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_BEFORE_MALGANIS); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); SetEscortPaused(true); break; - // Infront of malganis - case 55: - Talk(SAY_PHASE502); - actionEvents.ScheduleEvent(EVENT_ACTION_PHASE5, 7000); - SetEscortPaused(true); - eventInRun = true; - break; - // After malganis defeat - case 56: + // Infront of malganis + case 55: + Talk(SAY_PHASE502); + actionEvents.ScheduleEvent(EVENT_ACTION_PHASE5, 7000); SetEscortPaused(true); - eventInRun = true; + eventInRun = true; + break; + // After malganis defeat + case 56: + SetEscortPaused(true); + eventInRun = true; break; } @@ -658,697 +658,697 @@ public: if (eventInRun) { - actionEvents.Update(diff); - switch (uint32 currentEvent = actionEvents.GetEvent()) - { - case EVENT_ACTION_PHASE1: - SetRun(false); - me->SummonCreature(NPC_JAINA, EventPos[EVENT_SRC_JAINA], TEMPSUMMON_DEAD_DESPAWN, 180000); + actionEvents.Update(diff); + switch (uint32 currentEvent = actionEvents.GetEvent()) + { + case EVENT_ACTION_PHASE1: + SetRun(false); + me->SummonCreature(NPC_JAINA, EventPos[EVENT_SRC_JAINA], TEMPSUMMON_DEAD_DESPAWN, 180000); if (Creature* uther = me->SummonCreature(NPC_UTHER, EventPos[EVENT_SRC_UTHER], TEMPSUMMON_DEAD_DESPAWN, 180000)) { uther->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_UTHER], false); uther->SetTarget(me->GetGUID()); me->SetTarget(uther->GetGUID()); } - for (int i = 0; i < 3; ++i) - if (Creature *horse = me->SummonCreature(NPC_HORSE_ESCORT, EventPos[EVENT_SRC_HORSE1+i], TEMPSUMMON_DEAD_DESPAWN, 180000)) - horse->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_HORSE1+i], false); - - ScheduleNextEvent(currentEvent, 4000); - break; - case EVENT_ACTION_PHASE1+1: - // Start Event - Start(true, false); - SetDespawnAtEnd(false); - - ScheduleNextEvent(currentEvent, 9000); + for (int i = 0; i < 3; ++i) + if (Creature *horse = me->SummonCreature(NPC_HORSE_ESCORT, EventPos[EVENT_SRC_HORSE1+i], TEMPSUMMON_DEAD_DESPAWN, 180000)) + horse->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_HORSE1+i], false); + + ScheduleNextEvent(currentEvent, 4000); break; - // After waypoint 0 - case EVENT_ACTION_PHASE1+2: - Talk(SAY_PHASE101); - ScheduleNextEvent(currentEvent, 2000); - break; - case EVENT_ACTION_PHASE1+3: - if (Creature* uther = GetEventNpc(NPC_UTHER)) + case EVENT_ACTION_PHASE1+1: + // Start Event + Start(true, false); + SetDespawnAtEnd(false); + + ScheduleNextEvent(currentEvent, 9000); + break; + // After waypoint 0 + case EVENT_ACTION_PHASE1+2: + Talk(SAY_PHASE101); + ScheduleNextEvent(currentEvent, 2000); + break; + case EVENT_ACTION_PHASE1+3: + if (Creature* uther = GetEventNpc(NPC_UTHER)) uther->AI()->Talk(SAY_PHASE102); - ScheduleNextEvent(currentEvent, 8000); - break; - case EVENT_ACTION_PHASE1+4: - SetEscortPaused(false); + ScheduleNextEvent(currentEvent, 8000); + break; + case EVENT_ACTION_PHASE1+4: + SetEscortPaused(false); eventInRun = false; Talk(SAY_PHASE103); - ScheduleNextEvent(currentEvent, 2000); - break; - // After waypoint 1 - case EVENT_ACTION_PHASE1+5: - if (Creature* jaina = GetEventNpc(NPC_JAINA)) + ScheduleNextEvent(currentEvent, 2000); + break; + // After waypoint 1 + case EVENT_ACTION_PHASE1+5: + if (Creature* jaina = GetEventNpc(NPC_JAINA)) jaina->SetTarget(me->GetGUID()); Talk(SAY_PHASE104); ScheduleNextEvent(currentEvent, 10000); - break; - case EVENT_ACTION_PHASE1+6: - if (Creature* uther = GetEventNpc(NPC_UTHER)) + break; + case EVENT_ACTION_PHASE1+6: + if (Creature* uther = GetEventNpc(NPC_UTHER)) uther->AI()->Talk(SAY_PHASE105); - ScheduleNextEvent(currentEvent, 1000); - break; - case EVENT_ACTION_PHASE1+7: - Talk(SAY_PHASE106); + ScheduleNextEvent(currentEvent, 1000); + break; + case EVENT_ACTION_PHASE1+7: + Talk(SAY_PHASE106); ScheduleNextEvent(currentEvent, 4000); - break; - case EVENT_ACTION_PHASE1+8: - if (Creature* uther = GetEventNpc(NPC_UTHER)) + break; + case EVENT_ACTION_PHASE1+8: + if (Creature* uther = GetEventNpc(NPC_UTHER)) uther->AI()->Talk(SAY_PHASE107); - ScheduleNextEvent(currentEvent, 6000); - break; - case EVENT_ACTION_PHASE1+9: - Talk(SAY_PHASE108); + ScheduleNextEvent(currentEvent, 6000); + break; + case EVENT_ACTION_PHASE1+9: + Talk(SAY_PHASE108); ScheduleNextEvent(currentEvent, 4000); - break; - case EVENT_ACTION_PHASE1+10: - if (Creature* uther = GetEventNpc(NPC_UTHER)) + break; + case EVENT_ACTION_PHASE1+10: + if (Creature* uther = GetEventNpc(NPC_UTHER)) uther->AI()->Talk(SAY_PHASE109); - ScheduleNextEvent(currentEvent, 8000); - break; - case EVENT_ACTION_PHASE1+11: - Talk(SAY_PHASE110); + ScheduleNextEvent(currentEvent, 8000); + break; + case EVENT_ACTION_PHASE1+11: + Talk(SAY_PHASE110); ScheduleNextEvent(currentEvent, 4000); - break; - case EVENT_ACTION_PHASE1+12: - if (Creature* uther = GetEventNpc(NPC_UTHER)) + break; + case EVENT_ACTION_PHASE1+12: + if (Creature* uther = GetEventNpc(NPC_UTHER)) uther->AI()->Talk(SAY_PHASE111); - ScheduleNextEvent(currentEvent, 4000); - break; - case EVENT_ACTION_PHASE1+13: - Talk(SAY_PHASE112); + ScheduleNextEvent(currentEvent, 4000); + break; + case EVENT_ACTION_PHASE1+13: + Talk(SAY_PHASE112); ScheduleNextEvent(currentEvent, 11000); - break; - case EVENT_ACTION_PHASE1+14: - if (Creature* jaina = GetEventNpc(NPC_JAINA)) + break; + case EVENT_ACTION_PHASE1+14: + if (Creature* jaina = GetEventNpc(NPC_JAINA)) jaina->AI()->Talk(SAY_PHASE113); - ScheduleNextEvent(currentEvent, 2500); - break; - case EVENT_ACTION_PHASE1+15: - Talk(SAY_PHASE114); + ScheduleNextEvent(currentEvent, 2500); + break; + case EVENT_ACTION_PHASE1+15: + Talk(SAY_PHASE114); ScheduleNextEvent(currentEvent, 9000); - break; - case EVENT_ACTION_PHASE1+16: - if (Creature* uther = GetEventNpc(NPC_UTHER)) + break; + case EVENT_ACTION_PHASE1+16: + if (Creature* uther = GetEventNpc(NPC_UTHER)) uther->AI()->Talk(SAY_PHASE115); - ScheduleNextEvent(currentEvent, 4000); - break; - case EVENT_ACTION_PHASE1+17: - for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) - { - Creature* summon = ObjectAccessor::GetCreature(*me, *i); - if (summon && summon->GetEntry() == NPC_HORSE_ESCORT) - summon->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false); - } - - ScheduleNextEvent(currentEvent, 1000); - break; - case EVENT_ACTION_PHASE1+18: - if (Creature* uther = GetEventNpc(NPC_UTHER)) - { - uther->SetTarget(0); - uther->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - uther->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false); - } - ScheduleNextEvent(currentEvent, 1000); - break; - case EVENT_ACTION_PHASE1+19: - if (Creature* jaina = GetEventNpc(NPC_JAINA)) - { - jaina->SetTarget(0); - jaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - jaina->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false); - } - Talk(SAY_PHASE116); - ScheduleNextEvent(currentEvent, 2000); - break; - case EVENT_ACTION_PHASE1+20: - if (Creature* jaina = GetEventNpc(NPC_JAINA)) - { - jaina->GetMotionMaster()->MoveIdle(); - jaina->AI()->Talk(SAY_PHASE117); - } - - ScheduleNextEvent(currentEvent, 2000); - break; - case EVENT_ACTION_PHASE1+21: - if (Creature* jaina = GetEventNpc(NPC_JAINA)) - { - jaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - jaina->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false); - } - summons.DespawnEntry(NPC_HORSE_ESCORT); ScheduleNextEvent(currentEvent, 4000); - break; - case EVENT_ACTION_PHASE1+22: - SetEscortPaused(false); - eventInRun = false; - me->SetTarget(0); - actionEvents.PopEvent(); // dont schedule next, do it in gossip select! - break; - //After Gossip 1 (waypoint 8) - case EVENT_ACTION_PHASE2: - summons.DespawnEntry(NPC_INVIS_TARGET); // remove trigger - me->SetTarget(0); + break; + case EVENT_ACTION_PHASE1+17: + for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) + { + Creature* summon = ObjectAccessor::GetCreature(*me, *i); + if (summon && summon->GetEntry() == NPC_HORSE_ESCORT) + summon->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false); + } + + ScheduleNextEvent(currentEvent, 1000); + break; + case EVENT_ACTION_PHASE1+18: + if (Creature* uther = GetEventNpc(NPC_UTHER)) + { + uther->SetTarget(0); + uther->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + uther->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false); + } + ScheduleNextEvent(currentEvent, 1000); + break; + case EVENT_ACTION_PHASE1+19: + if (Creature* jaina = GetEventNpc(NPC_JAINA)) + { + jaina->SetTarget(0); + jaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + jaina->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false); + } + Talk(SAY_PHASE116); + ScheduleNextEvent(currentEvent, 2000); + break; + case EVENT_ACTION_PHASE1+20: + if (Creature* jaina = GetEventNpc(NPC_JAINA)) + { + jaina->GetMotionMaster()->MoveIdle(); + jaina->AI()->Talk(SAY_PHASE117); + } + + ScheduleNextEvent(currentEvent, 2000); + break; + case EVENT_ACTION_PHASE1+21: + if (Creature* jaina = GetEventNpc(NPC_JAINA)) + { + jaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + jaina->GetMotionMaster()->MovePoint(0, EventPos[EVENT_POS_RETREAT], false); + } + summons.DespawnEntry(NPC_HORSE_ESCORT); + ScheduleNextEvent(currentEvent, 4000); + break; + case EVENT_ACTION_PHASE1+22: SetEscortPaused(false); eventInRun = false; - ScheduleNextEvent(currentEvent, 1000); - break; - // After waypoint 9 - case EVENT_ACTION_PHASE2+1: + me->SetTarget(0); + actionEvents.PopEvent(); // dont schedule next, do it in gossip select! + break; + //After Gossip 1 (waypoint 8) + case EVENT_ACTION_PHASE2: + summons.DespawnEntry(NPC_INVIS_TARGET); // remove trigger + me->SetTarget(0); + SetEscortPaused(false); + eventInRun = false; + ScheduleNextEvent(currentEvent, 1000); + break; + // After waypoint 9 + case EVENT_ACTION_PHASE2+1: if (Creature* cityman = GetEventNpc(NPC_CITY_MAN)) - { - cityman->AI()->Talk(SAY_PHASE202); - cityman->SetTarget(me->GetGUID()); + { + cityman->AI()->Talk(SAY_PHASE202); + cityman->SetTarget(me->GetGUID()); cityman->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - cityman->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_CITYMAN]); - } + cityman->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_CITYMAN]); + } ScheduleNextEvent(currentEvent, 9000); - break; - case EVENT_ACTION_PHASE2+2: - Talk(SAY_PHASE203); - SetEscortPaused(false); - eventInRun = false; + break; + case EVENT_ACTION_PHASE2+2: + Talk(SAY_PHASE203); + SetEscortPaused(false); + eventInRun = false; ScheduleNextEvent(currentEvent, 1500); - break; - // After waypoint 11 - case EVENT_ACTION_PHASE2+3: - if (Creature* stalker = me->SummonCreature(NPC_INVIS_TARGET, 2081.447f, 1287.770f, 141.3241f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 10000)) + break; + // After waypoint 11 + case EVENT_ACTION_PHASE2+3: + if (Creature* stalker = me->SummonCreature(NPC_INVIS_TARGET, 2081.447f, 1287.770f, 141.3241f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 10000)) { me->SetFacingToObject(stalker); - stalker->DespawnOrUnsummon(500); + stalker->DespawnOrUnsummon(500); } Talk(SAY_PHASE205); ScheduleNextEvent(currentEvent, 4000); - break; - case EVENT_ACTION_PHASE2+4: - if (Creature* malganis = me->SummonCreature(NPC_MAL_GANIS, EventPos[EVENT_SRC_MALGANIS], TEMPSUMMON_TIMED_DESPAWN, 60000)) + break; + case EVENT_ACTION_PHASE2+4: + if (Creature* malganis = me->SummonCreature(NPC_MAL_GANIS, EventPos[EVENT_SRC_MALGANIS], TEMPSUMMON_TIMED_DESPAWN, 60000)) { malganis->CastSpell(malganis, SPELL_MALGANIS_APPEAR, true); malganis->AI()->Talk(SAY_PHASE206); malganis->SetTarget(me->GetGUID()); - me->SetTarget(malganis->GetGUID()); + me->SetTarget(malganis->GetGUID()); malganis->SetReactState(REACT_PASSIVE); - std::list unitList; - malganis->GetCreaturesWithEntryInRange(unitList, 20.0f, NPC_CITY_MAN); - malganis->GetCreaturesWithEntryInRange(unitList, 20.0f, NPC_CITY_MAN2); + std::list unitList; + malganis->GetCreaturesWithEntryInRange(unitList, 20.0f, NPC_CITY_MAN); + malganis->GetCreaturesWithEntryInRange(unitList, 20.0f, NPC_CITY_MAN2); - for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - if ((*itr)->ToCreature()) - { - (*itr)->ToCreature()->AI()->DoAction(ACTION_INFECT_CITIZIEN); - (*itr)->GetMotionMaster()->MoveFleeing(malganis, 2000); - } + for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + if ((*itr)->ToCreature()) + { + (*itr)->ToCreature()->AI()->DoAction(ACTION_INFECT_CITIZIEN); + (*itr)->GetMotionMaster()->MoveFleeing(malganis, 2000); + } - unitList.clear(); + unitList.clear(); } ScheduleNextEvent(currentEvent, 12000); - break; - case EVENT_ACTION_PHASE2+5: - if (Creature* malganis = GetEventNpc(NPC_MAL_GANIS)) + break; + case EVENT_ACTION_PHASE2+5: + if (Creature* malganis = GetEventNpc(NPC_MAL_GANIS)) malganis->AI()->Talk(SAY_PHASE207); - ScheduleNextEvent(currentEvent, 15000); - break; - case EVENT_ACTION_PHASE2+6: - if (Creature* malganis = GetEventNpc(NPC_MAL_GANIS)) - { - me->SetTarget(0); - me->SetFacingToObject(malganis); + ScheduleNextEvent(currentEvent, 15000); + break; + case EVENT_ACTION_PHASE2+6: + if (Creature* malganis = GetEventNpc(NPC_MAL_GANIS)) + { + me->SetTarget(0); + me->SetFacingToObject(malganis); malganis->SetVisible(false); - } + } Talk(SAY_PHASE208); - ScheduleNextEvent(currentEvent, 11000); - break; - case EVENT_ACTION_PHASE2+7: - summons.DespawnEntry(NPC_MAL_GANIS); - summons.DespawnEntry(NPC_CITY_MAN); - summons.DespawnEntry(NPC_CITY_MAN2); + ScheduleNextEvent(currentEvent, 11000); + break; + case EVENT_ACTION_PHASE2+7: + summons.DespawnEntry(NPC_MAL_GANIS); + summons.DespawnEntry(NPC_CITY_MAN); + summons.DespawnEntry(NPC_CITY_MAN2); Talk(SAY_PHASE209); - me->SetReactState(REACT_DEFENSIVE); - ScheduleNextEvent(currentEvent, 20000); - if (pInstance) - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_FINISHED_CITY_INTRO); - break; - case EVENT_ACTION_PHASE2+8: - if (pInstance) - pInstance->SetData(DATA_START_WAVES, 1); - - SummonNextWave(); + me->SetReactState(REACT_DEFENSIVE); + ScheduleNextEvent(currentEvent, 20000); + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_FINISHED_CITY_INTRO); + break; + case EVENT_ACTION_PHASE2+8: + if (pInstance) + pInstance->SetData(DATA_START_WAVES, 1); + + SummonNextWave(); actionEvents.PopEvent(); - break; - case EVENT_ACTION_PHASE2+9: - if (pInstance) - pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 0); + break; + case EVENT_ACTION_PHASE2+9: + if (pInstance) + pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 0); - Talk(SAY_PHASE210); - eventInRun = false; - SetEscortPaused(false); - actionEvents.PopEvent(); - break; - // After waypoint 22 - case EVENT_ACTION_PHASE3: - me->SetReactState(REACT_AGGRESSIVE); - if (Creature* cr = GetEventNpc(NPC_CITY_MAN3)) - cr->SetTarget(me->GetGUID()); + Talk(SAY_PHASE210); + eventInRun = false; + SetEscortPaused(false); + actionEvents.PopEvent(); + break; + // After waypoint 22 + case EVENT_ACTION_PHASE3: + me->SetReactState(REACT_AGGRESSIVE); + if (Creature* cr = GetEventNpc(NPC_CITY_MAN3)) + cr->SetTarget(me->GetGUID()); if (Creature* cr = GetEventNpc(NPC_CITY_MAN4)) - cr->SetTarget(me->GetGUID()); + cr->SetTarget(me->GetGUID()); if (Creature* cr = GetEventNpc(NPC_CITY_MAN)) - cr->SetTarget(me->GetGUID()); - ScheduleNextEvent(currentEvent, 1000); - break; - case EVENT_ACTION_PHASE3+1: - me->SetReactState(REACT_AGGRESSIVE); - if (Creature* cr = GetEventNpc(NPC_CITY_MAN3)) - cr->AI()->Talk(SAY_PHASE302); + cr->SetTarget(me->GetGUID()); + ScheduleNextEvent(currentEvent, 1000); + break; + case EVENT_ACTION_PHASE3+1: + me->SetReactState(REACT_AGGRESSIVE); + if (Creature* cr = GetEventNpc(NPC_CITY_MAN3)) + cr->AI()->Talk(SAY_PHASE302); - ScheduleNextEvent(currentEvent, 7000); - break; - case EVENT_ACTION_PHASE3+2: - Talk(SAY_PHASE303); + ScheduleNextEvent(currentEvent, 7000); + break; + case EVENT_ACTION_PHASE3+2: + Talk(SAY_PHASE303); SetEscortPaused(false); eventInRun = false; - ScheduleNextEvent(currentEvent, 0); - break; - //After waypoint 23 - case EVENT_ACTION_PHASE3+3: - SetRun(true); - if (Creature* cr = GetEventNpc(NPC_CITY_MAN3)) - me->CastSpell(cr, SPELL_ARTHAS_CRUSADER_STRIKE, true); - ScheduleNextEvent(currentEvent, 2000); - break; - case EVENT_ACTION_PHASE3+4: - Talk(SAY_PHASE304); - ScheduleNextEvent(currentEvent, 2000); - break; - case EVENT_ACTION_PHASE3+5: - if (Creature* cr = GetEventNpc(NPC_CITY_MAN3)) - cr->AI()->Talk(SAY_PHASE305); - ScheduleNextEvent(currentEvent, 1000); - break; - case EVENT_ACTION_PHASE3+6: - if (Creature* cr = GetEventNpc(NPC_CITY_MAN)) - { - cr->UpdateEntry(NPC_INFINITE_HUNTER, NULL, false); + ScheduleNextEvent(currentEvent, 0); + break; + //After waypoint 23 + case EVENT_ACTION_PHASE3+3: + SetRun(true); + if (Creature* cr = GetEventNpc(NPC_CITY_MAN3)) + me->CastSpell(cr, SPELL_ARTHAS_CRUSADER_STRIKE, true); + ScheduleNextEvent(currentEvent, 2000); + break; + case EVENT_ACTION_PHASE3+4: + Talk(SAY_PHASE304); + ScheduleNextEvent(currentEvent, 2000); + break; + case EVENT_ACTION_PHASE3+5: + if (Creature* cr = GetEventNpc(NPC_CITY_MAN3)) + cr->AI()->Talk(SAY_PHASE305); + ScheduleNextEvent(currentEvent, 1000); + break; + case EVENT_ACTION_PHASE3+6: + if (Creature* cr = GetEventNpc(NPC_CITY_MAN)) + { + cr->UpdateEntry(NPC_INFINITE_HUNTER, NULL, false); cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); cr->SetReactState(REACT_PASSIVE); - } - ScheduleNextEvent(currentEvent, 2000); - break; - case EVENT_ACTION_PHASE3+7: - if (Creature* cr = GetEventNpc(NPC_CITY_MAN4)) - { - cr->UpdateEntry(NPC_INFINITE_AGENT, NULL, false); + } + ScheduleNextEvent(currentEvent, 2000); + break; + case EVENT_ACTION_PHASE3+7: + if (Creature* cr = GetEventNpc(NPC_CITY_MAN4)) + { + cr->UpdateEntry(NPC_INFINITE_AGENT, NULL, false); cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); cr->SetReactState(REACT_PASSIVE); - } - ScheduleNextEvent(currentEvent, 2000); - break; - case EVENT_ACTION_PHASE3+8: - if (Creature* cr = GetEventNpc(NPC_CITY_MAN3)) - { - cr->UpdateEntry(NPC_INFINITE_ADVERSARY, NULL, false); + } + ScheduleNextEvent(currentEvent, 2000); + break; + case EVENT_ACTION_PHASE3+8: + if (Creature* cr = GetEventNpc(NPC_CITY_MAN3)) + { + cr->UpdateEntry(NPC_INFINITE_ADVERSARY, NULL, false); cr->SetReactState(REACT_AGGRESSIVE); - cr->SetInCombatWithZone(); - cr->AddThreat(me, 0.0f); - } - if (Creature* cr = GetEventNpc(NPC_INFINITE_AGENT)) // it is infinite agent now :) - { + cr->SetInCombatWithZone(); + cr->AddThreat(me, 0.0f); + } + if (Creature* cr = GetEventNpc(NPC_INFINITE_AGENT)) // it is infinite agent now :) + { cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); cr->SetReactState(REACT_AGGRESSIVE); - cr->SetInCombatWithZone(); - cr->AddThreat(me, 0.0f); - } - if (Creature* cr = GetEventNpc(NPC_INFINITE_HUNTER)) // it is infinite hunter now :) - { + cr->SetInCombatWithZone(); + cr->AddThreat(me, 0.0f); + } + if (Creature* cr = GetEventNpc(NPC_INFINITE_HUNTER)) // it is infinite hunter now :) + { cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); cr->SetReactState(REACT_AGGRESSIVE); - cr->SetInCombatWithZone(); - cr->AddThreat(me, 0.0f); - } - ScheduleNextEvent(currentEvent, 2000); - break; - case EVENT_ACTION_PHASE3+9: - // Arthas is fighting infinites in town hall - if (me->IsInCombat()) - { - actionEvents.RepeatEvent(1000); - return; - } + cr->SetInCombatWithZone(); + cr->AddThreat(me, 0.0f); + } + ScheduleNextEvent(currentEvent, 2000); + break; + case EVENT_ACTION_PHASE3+9: + // Arthas is fighting infinites in town hall + if (me->IsInCombat()) + { + actionEvents.RepeatEvent(1000); + return; + } - summons.DespawnAll(); - me->MonsterSay("I can't afford to spare you.", LANG_UNIVERSAL, 0); - me->SetFacingTo(0.0f); - ScheduleNextEvent(currentEvent, 5000); - break; - case EVENT_ACTION_PHASE3+10: - Talk(SAY_PHASE306); - ScheduleNextEvent(currentEvent, 5000); - break; - case EVENT_ACTION_PHASE3+11: - SetEscortPaused(false); - eventInRun = false; - ScheduleNextEvent(currentEvent, 1000); - break; - case EVENT_ACTION_PHASE3+12: - // Arthas is fighting first chronos - if (me->IsInCombat()) - { - actionEvents.RepeatEvent(1000); - return; - } + summons.DespawnAll(); + me->MonsterSay("I can't afford to spare you.", LANG_UNIVERSAL, 0); + me->SetFacingTo(0.0f); + ScheduleNextEvent(currentEvent, 5000); + break; + case EVENT_ACTION_PHASE3+10: + Talk(SAY_PHASE306); + ScheduleNextEvent(currentEvent, 5000); + break; + case EVENT_ACTION_PHASE3+11: + SetEscortPaused(false); + eventInRun = false; + ScheduleNextEvent(currentEvent, 1000); + break; + case EVENT_ACTION_PHASE3+12: + // Arthas is fighting first chronos + if (me->IsInCombat()) + { + actionEvents.RepeatEvent(1000); + return; + } - eventInRun = false; - SetEscortPaused(false); - Talk(SAY_PHASE308); - me->SetFacingTo(M_PI); - ScheduleNextEvent(currentEvent, 0); - break; - case EVENT_ACTION_PHASE3+13: - // Arthas is fighting second chronos - if (me->IsInCombat()) - { - actionEvents.RepeatEvent(1000); - return; - } + eventInRun = false; + SetEscortPaused(false); + Talk(SAY_PHASE308); + me->SetFacingTo(M_PI); + ScheduleNextEvent(currentEvent, 0); + break; + case EVENT_ACTION_PHASE3+13: + // Arthas is fighting second chronos + if (me->IsInCombat()) + { + actionEvents.RepeatEvent(1000); + return; + } - eventInRun = false; - SetEscortPaused(false); - Talk(SAY_PHASE311); - me->SetFacingTo(M_PI*3/2); - ScheduleNextEvent(currentEvent, 0); - break; - case EVENT_ACTION_PHASE3+14: - // Arthas is fighting third chronos - if (me->IsInCombat()) - { - actionEvents.RepeatEvent(1000); - return; - } + eventInRun = false; + SetEscortPaused(false); + Talk(SAY_PHASE311); + me->SetFacingTo(M_PI*3/2); + ScheduleNextEvent(currentEvent, 0); + break; + case EVENT_ACTION_PHASE3+14: + // Arthas is fighting third chronos + if (me->IsInCombat()) + { + actionEvents.RepeatEvent(1000); + return; + } - me->SetFacingTo(M_PI/2); - ScheduleNextEvent(currentEvent, 8000); - break; - case EVENT_ACTION_PHASE3+15: - Talk(SAY_PHASE313); - me->SummonCreature(NPC_TIME_RIFT, EventPos[EVENT_SRC_EPOCH], TEMPSUMMON_TIMED_DESPAWN, 20000); - if (Creature* cr = me->SummonCreature(NPC_EPOCH, EventPos[EVENT_SRC_EPOCH])) - { - cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFacingTo(M_PI/2); + ScheduleNextEvent(currentEvent, 8000); + break; + case EVENT_ACTION_PHASE3+15: + Talk(SAY_PHASE313); + me->SummonCreature(NPC_TIME_RIFT, EventPos[EVENT_SRC_EPOCH], TEMPSUMMON_TIMED_DESPAWN, 20000); + if (Creature* cr = me->SummonCreature(NPC_EPOCH, EventPos[EVENT_SRC_EPOCH])) + { + cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetTarget(cr->GetGUID()); - cr->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_EPOCH]); - } + me->SetTarget(cr->GetGUID()); + cr->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_EPOCH]); + } - ScheduleNextEvent(currentEvent, 3000); - break; - case EVENT_ACTION_PHASE3+16: - if (Creature* cr = GetEventNpc(NPC_EPOCH)) - cr->AI()->Talk(SAY_PHASE314); + ScheduleNextEvent(currentEvent, 3000); + break; + case EVENT_ACTION_PHASE3+16: + if (Creature* cr = GetEventNpc(NPC_EPOCH)) + cr->AI()->Talk(SAY_PHASE314); - ScheduleNextEvent(currentEvent, 14000); - break; - case EVENT_ACTION_PHASE3+17: - Talk(SAY_PHASE315); - ScheduleNextEvent(currentEvent, 7000); - break; - case EVENT_ACTION_PHASE3+18: - if (Creature* cr = GetEventNpc(NPC_EPOCH)) - { - cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + ScheduleNextEvent(currentEvent, 14000); + break; + case EVENT_ACTION_PHASE3+17: + Talk(SAY_PHASE315); + ScheduleNextEvent(currentEvent, 7000); + break; + case EVENT_ACTION_PHASE3+18: + if (Creature* cr = GetEventNpc(NPC_EPOCH)) + { + cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - cr->SetReactState(REACT_AGGRESSIVE); - cr->AddThreat(me, 0.0f); - cr->SetInCombatWithZone(); - } - ScheduleNextEvent(currentEvent, 1000); - break; - case EVENT_ACTION_PHASE3+19: - // Arthas is fighting epoch chronos - if (me->IsInCombat()) - { - actionEvents.RepeatEvent(1000); - return; - } + cr->SetReactState(REACT_AGGRESSIVE); + cr->AddThreat(me, 0.0f); + cr->SetInCombatWithZone(); + } + ScheduleNextEvent(currentEvent, 1000); + break; + case EVENT_ACTION_PHASE3+19: + // Arthas is fighting epoch chronos + if (me->IsInCombat()) + { + actionEvents.RepeatEvent(1000); + return; + } - if (pInstance) - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_KILLED_EPOCH); + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_KILLED_EPOCH); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - actionEvents.PopEvent(); - eventInRun = false; - break; - case EVENT_ACTION_PHASE5: - if (Creature* cr = GetEventNpc(NPC_MAL_GANIS)) - { - cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + actionEvents.PopEvent(); + eventInRun = false; + break; + case EVENT_ACTION_PHASE5: + if (Creature* cr = GetEventNpc(NPC_MAL_GANIS)) + { + cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - cr->SetInCombatWithZone(); - cr->AddThreat(me, 0.0f); - AttackStart(cr); - } - actionEvents.PopEvent(); - eventInRun = false; - SetEscortPaused(true); - break; - case EVENT_ACTION_PHASE5+1: - Talk(SAY_PHASE503); - SetEscortPaused(false); - eventInRun = false; - ScheduleNextEvent(currentEvent, 5000); - break; - case EVENT_ACTION_PHASE5+2: - me->SetFacingTo(5.28f); - Talk(SAY_PHASE504); - if (pInstance) - { - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_FINISHED); - if (GameObject* go = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_EXIT_GATE))) - go->SetGoState(GO_STATE_ACTIVE); - - if (!me->GetMap()->GetPlayers().isEmpty()) - if (Player* player = me->GetMap()->GetPlayers().getFirst()->GetSource()) - player->SummonGameObject(DUNGEON_MODE(GO_MALGANIS_CHEST_N, GO_MALGANIS_CHEST_H), 2288.35f, 1498.73f, 128.414f, -0.994837f, 0, 0, 0, 0, 0); - } - ScheduleNextEvent(currentEvent, 10000); - break; - case EVENT_ACTION_PHASE5+3: - eventInRun = false; - me->SetVisible(false); - actionEvents.PopEvent(); - break; - } - } + cr->SetInCombatWithZone(); + cr->AddThreat(me, 0.0f); + AttackStart(cr); + } + actionEvents.PopEvent(); + eventInRun = false; + SetEscortPaused(true); + break; + case EVENT_ACTION_PHASE5+1: + Talk(SAY_PHASE503); + SetEscortPaused(false); + eventInRun = false; + ScheduleNextEvent(currentEvent, 5000); + break; + case EVENT_ACTION_PHASE5+2: + me->SetFacingTo(5.28f); + Talk(SAY_PHASE504); + if (pInstance) + { + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_FINISHED); + if (GameObject* go = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_EXIT_GATE))) + go->SetGoState(GO_STATE_ACTIVE); + + if (!me->GetMap()->GetPlayers().isEmpty()) + if (Player* player = me->GetMap()->GetPlayers().getFirst()->GetSource()) + player->SummonGameObject(DUNGEON_MODE(GO_MALGANIS_CHEST_N, GO_MALGANIS_CHEST_H), 2288.35f, 1498.73f, 128.414f, -0.994837f, 0, 0, 0, 0, 0); + } + ScheduleNextEvent(currentEvent, 10000); + break; + case EVENT_ACTION_PHASE5+3: + eventInRun = false; + me->SetVisible(false); + actionEvents.PopEvent(); + break; + } + } //Battling skills if (!me->GetVictim()) return; - combatEvents.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + combatEvents.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (combatEvents.GetEvent()) - { - case EVENT_COMBAT_EXORCISM: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, DUNGEON_MODE(SPELL_ARTHAS_EXORCISM_N, SPELL_ARTHAS_EXORCISM_H), false); + switch (combatEvents.GetEvent()) + { + case EVENT_COMBAT_EXORCISM: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, DUNGEON_MODE(SPELL_ARTHAS_EXORCISM_N, SPELL_ARTHAS_EXORCISM_H), false); - combatEvents.RepeatEvent(7300); - break; - case EVENT_COMBAT_HEALTH_CHECK: - if (HealthBelowPct(40)) - me->CastSpell(me, SPELL_ARTHAS_HOLY_LIGHT, false); - - combatEvents.RepeatEvent(1000); - break; - } + combatEvents.RepeatEvent(7300); + break; + case EVENT_COMBAT_HEALTH_CHECK: + if (HealthBelowPct(40)) + me->CastSpell(me, SPELL_ARTHAS_HOLY_LIGHT, false); + + combatEvents.RepeatEvent(1000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; }; Creature* npc_arthas::npc_arthasAI::GetEventNpc(uint32 entry) { - for (SummonList::iterator i = summons.begin(); i != summons.end();) - { - Creature* summon = ObjectAccessor::GetCreature(*me, *i); - if (!summon) - summons.erase(i++); - else if (summon->GetEntry() == entry) - return summon; - else - ++i; - } + for (SummonList::iterator i = summons.begin(); i != summons.end();) + { + Creature* summon = ObjectAccessor::GetCreature(*me, *i); + if (!summon) + summons.erase(i++); + else if (summon->GetEntry() == entry) + return summon; + else + ++i; + } - return NULL; + return NULL; } void npc_arthas::npc_arthasAI::ScheduleNextEvent(uint32 currentEvent, uint32 time) { - actionEvents.PopEvent(); - actionEvents.ScheduleEvent(currentEvent+1, time); + actionEvents.PopEvent(); + actionEvents.ScheduleEvent(currentEvent+1, time); } void npc_arthas::npc_arthasAI::SummonNextWave() { - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - i->GetSource()->PlayerTalkClass->SendPointOfInterest(1000+waveGroupId); + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + i->GetSource()->PlayerTalkClass->SendPointOfInterest(1000+waveGroupId); - waveKillCount = 0; // this is forced condition! - uint32 tableId = waveGroupId; - if (tableId > 4) - tableId--; + waveKillCount = 0; // this is forced condition! + uint32 tableId = waveGroupId; + if (tableId > 4) + tableId--; - for (uint32 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) - me->SummonCreature(/*entry*/(uint32)WavesLocations[tableId][i][0], WavesLocations[tableId][i][1], WavesLocations[tableId][i][2], WavesLocations[tableId][i][3], WavesLocations[tableId][i][4]); + for (uint32 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + me->SummonCreature(/*entry*/(uint32)WavesLocations[tableId][i][0], WavesLocations[tableId][i][1], WavesLocations[tableId][i][2], WavesLocations[tableId][i][3], WavesLocations[tableId][i][4]); } void npc_arthas::npc_arthasAI::EnterCombat(Unit* /*who*/) { DoCast(me, SPELL_ARTHAS_AURA); - // Fight - combatEvents.ScheduleEvent(EVENT_COMBAT_EXORCISM, 2000); - combatEvents.ScheduleEvent(EVENT_COMBAT_HEALTH_CHECK, 2000); + // Fight + combatEvents.ScheduleEvent(EVENT_COMBAT_EXORCISM, 2000); + combatEvents.ScheduleEvent(EVENT_COMBAT_HEALTH_CHECK, 2000); } void npc_arthas::npc_arthasAI::ReorderInstance(uint32 data) { - Start(true, true); - SetEscortPaused(true); - SetDespawnAtEnd(false); + Start(true, true); + SetEscortPaused(true); + SetDespawnAtEnd(false); - switch (data) - { - case COS_PROGRESS_FINISHED_INTRO: - SetNextWaypoint(9, false); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - case COS_PROGRESS_FINISHED_CITY_INTRO: - case COS_PROGRESS_KILLED_MEATHOOK: - case COS_PROGRESS_KILLED_SALRAMM: - SetNextWaypoint(12, false); - me->SetReactState(REACT_DEFENSIVE); - - if (data == COS_PROGRESS_FINISHED_CITY_INTRO) - { - eventInRun = true; - actionEvents.RescheduleEvent(EVENT_ACTION_PHASE2+8, 10000); - } - else if (data == COS_PROGRESS_KILLED_MEATHOOK) - { - waveGroupId = 4; - SendNextWave(NPC_MEATHOOK); - } - else if (data == COS_PROGRESS_KILLED_SALRAMM) - { - pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 10); - DoAction(ACTION_KILLED_SALRAMM); - } - break; - case COS_PROGRESS_REACHED_TOWN_HALL: - SetNextWaypoint(21, false); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - case COS_PROGRESS_KILLED_EPOCH: - SetNextWaypoint(32, false); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - case COS_PROGRESS_LAST_CITY: - SetNextWaypoint(46, false); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - case COS_PROGRESS_BEFORE_MALGANIS: - SetNextWaypoint(55, false); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - } + switch (data) + { + case COS_PROGRESS_FINISHED_INTRO: + SetNextWaypoint(9, false); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case COS_PROGRESS_FINISHED_CITY_INTRO: + case COS_PROGRESS_KILLED_MEATHOOK: + case COS_PROGRESS_KILLED_SALRAMM: + SetNextWaypoint(12, false); + me->SetReactState(REACT_DEFENSIVE); + + if (data == COS_PROGRESS_FINISHED_CITY_INTRO) + { + eventInRun = true; + actionEvents.RescheduleEvent(EVENT_ACTION_PHASE2+8, 10000); + } + else if (data == COS_PROGRESS_KILLED_MEATHOOK) + { + waveGroupId = 4; + SendNextWave(NPC_MEATHOOK); + } + else if (data == COS_PROGRESS_KILLED_SALRAMM) + { + pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 10); + DoAction(ACTION_KILLED_SALRAMM); + } + break; + case COS_PROGRESS_REACHED_TOWN_HALL: + SetNextWaypoint(21, false); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case COS_PROGRESS_KILLED_EPOCH: + SetNextWaypoint(32, false); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case COS_PROGRESS_LAST_CITY: + SetNextWaypoint(46, false); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case COS_PROGRESS_BEFORE_MALGANIS: + SetNextWaypoint(55, false); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + } - if (data >= COS_PROGRESS_KILLED_EPOCH) - if (pInstance) + if (data >= COS_PROGRESS_KILLED_EPOCH) + if (pInstance) if (GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SHKAF_GATE))) pGate->SetGoState(GO_STATE_READY); - pInstance->SetData(DATA_SHOW_INFINITE_TIMER, 1); + pInstance->SetData(DATA_SHOW_INFINITE_TIMER, 1); } void npc_arthas::npc_arthasAI::SendNextWave(uint32 entry) { - if (!pInstance) - return; + if (!pInstance) + return; - if (entry == NPC_MEATHOOK) - { - waveKillCount = 4; - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_KILLED_MEATHOOK); - } - else if (entry == NPC_SALRAMM) - { - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_KILLED_SALRAMM); - return; - } + if (entry == NPC_MEATHOOK) + { + waveKillCount = 4; + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_KILLED_MEATHOOK); + } + else if (entry == NPC_SALRAMM) + { + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_KILLED_SALRAMM); + return; + } - // Group is killed - if (++waveKillCount >= 4) - { - waveGroupId++; - if (waveGroupId == 4) // Meathook - me->SummonCreature(NPC_MEATHOOK, EventPos[EVENT_SRC_MEATHOOK]); - else if (waveGroupId == 9) // Salramm - me->SummonCreature(NPC_SALRAMM, EventPos[EVENT_SRC_SALRAMM]); - else - SummonNextWave(); + // Group is killed + if (++waveKillCount >= 4) + { + waveGroupId++; + if (waveGroupId == 4) // Meathook + me->SummonCreature(NPC_MEATHOOK, EventPos[EVENT_SRC_MEATHOOK]); + else if (waveGroupId == 9) // Salramm + me->SummonCreature(NPC_SALRAMM, EventPos[EVENT_SRC_SALRAMM]); + else + SummonNextWave(); - pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, waveGroupId+1); - } + pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, waveGroupId+1); + } } void npc_arthas::npc_arthasAI::SpawnTimeRift() { - if (timeRiftId >= 5) - return; + if (timeRiftId >= 5) + return; - for (uint8 i = 0; i < uint8(timeRiftId == 0 ? ENCOUNTER_CHRONO_MAX_SPAWNS_FIRST : ENCOUNTER_CHRONO_MAX_SPAWNS_SECOND); ++i) - { - // Spawn everyone at time rift pos - if (Creature* cr = me->SummonCreature(/*entry*/(uint32)RiftAndSpawnsLocations[timeRiftId][i][0], RiftAndSpawnsLocations[timeRiftId][0][1], RiftAndSpawnsLocations[timeRiftId][0][2], RiftAndSpawnsLocations[timeRiftId][0][3], RiftAndSpawnsLocations[timeRiftId][0][4])) - { - if (cr->GetEntry() == NPC_TIME_RIFT) - cr->DespawnOrUnsummon(10000); - else // x, y, z (0 is entry) - { - // first infinite - if (i == 1) - AttackStart(cr); + for (uint8 i = 0; i < uint8(timeRiftId == 0 ? ENCOUNTER_CHRONO_MAX_SPAWNS_FIRST : ENCOUNTER_CHRONO_MAX_SPAWNS_SECOND); ++i) + { + // Spawn everyone at time rift pos + if (Creature* cr = me->SummonCreature(/*entry*/(uint32)RiftAndSpawnsLocations[timeRiftId][i][0], RiftAndSpawnsLocations[timeRiftId][0][1], RiftAndSpawnsLocations[timeRiftId][0][2], RiftAndSpawnsLocations[timeRiftId][0][3], RiftAndSpawnsLocations[timeRiftId][0][4])) + { + if (cr->GetEntry() == NPC_TIME_RIFT) + cr->DespawnOrUnsummon(10000); + else // x, y, z (0 is entry) + { + // first infinite + if (i == 1) + AttackStart(cr); - cr->SetInCombatWithZone(); - cr->AddThreat(me, 0.0f); - cr->SetReactState(REACT_AGGRESSIVE); - cr->GetMotionMaster()->MovePoint(POINT_CHRONOS, RiftAndSpawnsLocations[timeRiftId][i][1], RiftAndSpawnsLocations[timeRiftId][i][2], RiftAndSpawnsLocations[timeRiftId][i][3]); - } - } - } + cr->SetInCombatWithZone(); + cr->AddThreat(me, 0.0f); + cr->SetReactState(REACT_AGGRESSIVE); + cr->GetMotionMaster()->MovePoint(POINT_CHRONOS, RiftAndSpawnsLocations[timeRiftId][i][1], RiftAndSpawnsLocations[timeRiftId][i][2], RiftAndSpawnsLocations[timeRiftId][i][3]); + } + } + } - timeRiftId++; + timeRiftId++; } class npc_crate_helper : public CreatureScript @@ -1390,9 +1390,9 @@ class npc_crate_helper : public CreatureScript enum chromie { - ITEM_ARCANE_DISRUPTOR = 37888, - QUEST_DISPELLING_ILLUSIONS = 13149, - QUEST_A_ROYAL_ESCORT = 13151, + ITEM_ARCANE_DISRUPTOR = 37888, + QUEST_DISPELLING_ILLUSIONS = 13149, + QUEST_A_ROYAL_ESCORT = 13151, }; class npc_cos_chromie_start : public CreatureScript @@ -1400,46 +1400,46 @@ class npc_cos_chromie_start : public CreatureScript public: npc_cos_chromie_start() : CreatureScript("npc_cos_chromie_start") { } - bool OnQuestAccept(Player* , Creature* creature, const Quest* pQuest) - { - if (pQuest->GetQuestId() == QUEST_DISPELLING_ILLUSIONS) - if (InstanceScript* pInstance = creature->GetInstanceScript()) - pInstance->SetData(DATA_SHOW_CRATES, 1); + bool OnQuestAccept(Player* , Creature* creature, const Quest* pQuest) + { + if (pQuest->GetQuestId() == QUEST_DISPELLING_ILLUSIONS) + if (InstanceScript* pInstance = creature->GetInstanceScript()) + pInstance->SetData(DATA_SHOW_CRATES, 1); - return true; - } + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - // final menu id, show crates if hidden and add item if missing - if (player->PlayerTalkClass->GetGossipMenu().GetMenuId() == 9595) - { - if (InstanceScript* pInstance = creature->GetInstanceScript()) - if (pInstance->GetData(DATA_ARTHAS_EVENT) == COS_PROGRESS_NOT_STARTED) - pInstance->SetData(DATA_SHOW_CRATES, 1); + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) + { + // final menu id, show crates if hidden and add item if missing + if (player->PlayerTalkClass->GetGossipMenu().GetMenuId() == 9595) + { + if (InstanceScript* pInstance = creature->GetInstanceScript()) + if (pInstance->GetData(DATA_ARTHAS_EVENT) == COS_PROGRESS_NOT_STARTED) + pInstance->SetData(DATA_SHOW_CRATES, 1); - if (!player->HasItemCount(ITEM_ARCANE_DISRUPTOR)) - player->AddItem(ITEM_ARCANE_DISRUPTOR, 1); - } - // Skip Event - else if (player->PlayerTalkClass->GetGossipMenu().GetMenuId() == 11277) - { - if (InstanceScript* pInstance = creature->GetInstanceScript()) - { - if (pInstance->GetData(DATA_ARTHAS_EVENT) == COS_PROGRESS_NOT_STARTED) - { - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_FINISHED_INTRO); - if (Creature* arthas = ObjectAccessor::GetCreature(*creature, pInstance->GetData64(DATA_ARTHAS))) - arthas->AI()->Reset(); - } - player->NearTeleportTo(LeaderIntroPos2.GetPositionX(), LeaderIntroPos2.GetPositionY(), LeaderIntroPos2.GetPositionZ(), LeaderIntroPos2.GetOrientation()); + if (!player->HasItemCount(ITEM_ARCANE_DISRUPTOR)) + player->AddItem(ITEM_ARCANE_DISRUPTOR, 1); + } + // Skip Event + else if (player->PlayerTalkClass->GetGossipMenu().GetMenuId() == 11277) + { + if (InstanceScript* pInstance = creature->GetInstanceScript()) + { + if (pInstance->GetData(DATA_ARTHAS_EVENT) == COS_PROGRESS_NOT_STARTED) + { + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_FINISHED_INTRO); + if (Creature* arthas = ObjectAccessor::GetCreature(*creature, pInstance->GetData64(DATA_ARTHAS))) + arthas->AI()->Reset(); + } + player->NearTeleportTo(LeaderIntroPos2.GetPositionX(), LeaderIntroPos2.GetPositionY(), LeaderIntroPos2.GetPositionZ(), LeaderIntroPos2.GetOrientation()); - } - } + } + } - // return false to display last windows - return false; - } + // return false to display last windows + return false; + } }; class npc_cos_chromie_middle : public CreatureScript @@ -1447,41 +1447,41 @@ class npc_cos_chromie_middle : public CreatureScript public: npc_cos_chromie_middle() : CreatureScript("npc_cos_chromie_middle") { } - bool OnQuestAccept(Player* , Creature* creature, const Quest* pQuest) - { - if (pQuest->GetQuestId() == QUEST_A_ROYAL_ESCORT) - if (InstanceScript* pInstance = creature->GetInstanceScript()) - if (pInstance->GetData(DATA_ARTHAS_EVENT) == COS_PROGRESS_CRATES_FOUND) - pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_START_INTRO); + bool OnQuestAccept(Player* , Creature* creature, const Quest* pQuest) + { + if (pQuest->GetQuestId() == QUEST_A_ROYAL_ESCORT) + if (InstanceScript* pInstance = creature->GetInstanceScript()) + if (pInstance->GetData(DATA_ARTHAS_EVENT) == COS_PROGRESS_CRATES_FOUND) + pInstance->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_START_INTRO); - return true; - } + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - if (!creature->GetInstanceScript() || creature->GetInstanceScript()->GetData(DATA_ARTHAS_EVENT) != COS_PROGRESS_CRATES_FOUND) - return true; + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) + { + if (!creature->GetInstanceScript() || creature->GetInstanceScript()->GetData(DATA_ARTHAS_EVENT) != COS_PROGRESS_CRATES_FOUND) + return true; - // We can start event:) - if (player->PlayerTalkClass->GetGossipMenu().GetMenuId() == 9612) - creature->GetInstanceScript()->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_START_INTRO); + // We can start event:) + if (player->PlayerTalkClass->GetGossipMenu().GetMenuId() == 9612) + creature->GetInstanceScript()->SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_START_INTRO); - return false; - } + return false; + } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->IsQuestGiver()) - { - player->PrepareQuestMenu(creature->GetGUID()); - player->SendPreparedQuest(creature->GetGUID()); - } + bool OnGossipHello(Player* player, Creature* creature) + { + if (creature->IsQuestGiver()) + { + player->PrepareQuestMenu(creature->GetGUID()); + player->SendPreparedQuest(creature->GetGUID()); + } - if (!creature->GetInstanceScript() || creature->GetInstanceScript()->GetData(DATA_ARTHAS_EVENT) != COS_PROGRESS_CRATES_FOUND) - return true; - - return false; - } + if (!creature->GetInstanceScript() || creature->GetInstanceScript()->GetData(DATA_ARTHAS_EVENT) != COS_PROGRESS_CRATES_FOUND) + return true; + + return false; + } }; class npc_cos_stratholme_citizien : public CreatureScript @@ -1493,105 +1493,105 @@ class npc_cos_stratholme_citizien : public CreatureScript { npc_cos_stratholme_citizienAI(Creature* creature) : ScriptedAI(creature) { - allowTimer = 0; - pInstance = me->GetInstanceScript(); - if (!pInstance || pInstance->GetData(DATA_ARTHAS_EVENT) < COS_PROGRESS_FINISHED_CITY_INTRO) - allowTimer++; + allowTimer = 0; + pInstance = me->GetInstanceScript(); + if (!pInstance || pInstance->GetData(DATA_ARTHAS_EVENT) < COS_PROGRESS_FINISHED_CITY_INTRO) + allowTimer++; } - bool locked; - uint32 changeTimer; - InstanceScript* pInstance; - uint32 allowTimer; + bool locked; + uint32 changeTimer; + InstanceScript* pInstance; + uint32 allowTimer; - void Reset() - { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - locked = false; - changeTimer = 0; + void Reset() + { + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + locked = false; + changeTimer = 0; - if (pInstance) - { - uint32 data = pInstance->GetData(DATA_ARTHAS_EVENT); - if (me->GetDistance(2400, 1200, 135) > 20.0f && data >= COS_PROGRESS_FINISHED_CITY_INTRO) - { - if (data >= COS_PROGRESS_KILLED_SALRAMM) - me->DespawnOrUnsummon(500); - else - InfectMe(3000); - } - } - } + if (pInstance) + { + uint32 data = pInstance->GetData(DATA_ARTHAS_EVENT); + if (me->GetDistance(2400, 1200, 135) > 20.0f && data >= COS_PROGRESS_FINISHED_CITY_INTRO) + { + if (data >= COS_PROGRESS_KILLED_SALRAMM) + me->DespawnOrUnsummon(500); + else + InfectMe(3000); + } + } + } - void MoveInLineOfSight(Unit* who) - { - if (!allowTimer && !locked && (who->GetTypeId() == TYPEID_PLAYER || who->IsPet()) && me->GetDistance(who) < 15.0f) - InfectMe(2000); + void MoveInLineOfSight(Unit* who) + { + if (!allowTimer && !locked && (who->GetTypeId() == TYPEID_PLAYER || who->IsPet()) && me->GetDistance(who) < 15.0f) + InfectMe(2000); - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void DoAction(int32 param) - { - if (param == ACTION_INFECT_CITIZIEN) - InfectMe(1); - else if (param == ACTION_FORCE_CHANGE_LOCK) - locked = true; - } + void DoAction(int32 param) + { + if (param == ACTION_INFECT_CITIZIEN) + InfectMe(1); + else if (param == ACTION_FORCE_CHANGE_LOCK) + locked = true; + } - void InfectMe(uint32 time) - { - locked = true; - changeTimer = time; - } + void InfectMe(uint32 time) + { + locked = true; + changeTimer = time; + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_ARTHAS_CRUSADER_STRIKE) - { - if (me->GetEntry() == NPC_CITY_MAN3) - { - me->StopMoving(); - me->HandleEmoteCommand(54); // laugh - } - else - Unit::Kill(caster, me); - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_ARTHAS_CRUSADER_STRIKE) + { + if (me->GetEntry() == NPC_CITY_MAN3) + { + me->StopMoving(); + me->HandleEmoteCommand(54); // laugh + } + else + Unit::Kill(caster, me); + } + } - void UpdateAI(uint32 diff) - { - ScriptedAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + ScriptedAI::UpdateAI(diff); - if (allowTimer) - { - allowTimer += diff; - if (allowTimer >= 8000 && pInstance && pInstance->GetData(DATA_ARTHAS_EVENT) >= COS_PROGRESS_FINISHED_CITY_INTRO) - allowTimer = 0; - } + if (allowTimer) + { + allowTimer += diff; + if (allowTimer >= 8000 && pInstance && pInstance->GetData(DATA_ARTHAS_EVENT) >= COS_PROGRESS_FINISHED_CITY_INTRO) + allowTimer = 0; + } - if (changeTimer) - { - changeTimer += diff; - if (changeTimer >= 2500 && changeTimer < 10000) - { - me->CastSpell(me, SPELL_GREEN_VISUAL_AURA, true); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_COWER); - changeTimer = 10000; - } - else if (changeTimer >= 14500 && changeTimer < 20000) - { - me->UpdateEntry(NPC_RISEN_ZOMBIE, NULL, false); - me->SetReactState(REACT_AGGRESSIVE); - changeTimer = 20000; - } - else if (changeTimer >= 23000) - { - me->RemoveAura(SPELL_GREEN_VISUAL_AURA); - changeTimer = 0; - } - } - } + if (changeTimer) + { + changeTimer += diff; + if (changeTimer >= 2500 && changeTimer < 10000) + { + me->CastSpell(me, SPELL_GREEN_VISUAL_AURA, true); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_COWER); + changeTimer = 10000; + } + else if (changeTimer >= 14500 && changeTimer < 20000) + { + me->UpdateEntry(NPC_RISEN_ZOMBIE, NULL, false); + me->SetReactState(REACT_AGGRESSIVE); + changeTimer = 20000; + } + else if (changeTimer >= 23000) + { + me->RemoveAura(SPELL_GREEN_VISUAL_AURA); + changeTimer = 0; + } + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -1604,7 +1604,7 @@ void AddSC_culling_of_stratholme() { new npc_arthas(); new npc_crate_helper(); - new npc_cos_chromie_start(); - new npc_cos_chromie_middle(); - new npc_cos_stratholme_citizien(); + new npc_cos_chromie_start(); + new npc_cos_chromie_middle(); + new npc_cos_stratholme_citizien(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h index 5026c5670..761388c16 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h @@ -7,15 +7,15 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Data { - DATA_ARTHAS_EVENT, - DATA_GUARDIANTIME_EVENT, + DATA_ARTHAS_EVENT, + DATA_GUARDIANTIME_EVENT, - // Communication - DATA_SHOW_CRATES, + // Communication + DATA_SHOW_CRATES, DATA_CRATE_COUNT, - DATA_START_WAVES, - DATA_SHOW_INFINITE_TIMER, - DATA_ARTHAS_REPOSITION, + DATA_START_WAVES, + DATA_SHOW_INFINITE_TIMER, + DATA_ARTHAS_REPOSITION, }; enum Data64 @@ -28,107 +28,107 @@ enum Data64 enum Creatures { - NPC_MEATHOOK = 26529, - NPC_SALRAMM = 26530, - NPC_EPOCH = 26532, - NPC_MAL_GANIS = 26533, - NPC_INFINITE = 32273, - NPC_ARTHAS = 26499, - NPC_JAINA = 26497, - NPC_UTHER = 26528, + NPC_MEATHOOK = 26529, + NPC_SALRAMM = 26530, + NPC_EPOCH = 26532, + NPC_MAL_GANIS = 26533, + NPC_INFINITE = 32273, + NPC_ARTHAS = 26499, + NPC_JAINA = 26497, + NPC_UTHER = 26528, - NPC_GUARDIAN_OF_TIME = 32281, - NPC_TIME_RIFT = 28409, + NPC_GUARDIAN_OF_TIME = 32281, + NPC_TIME_RIFT = 28409, - NPC_CHROMIE_MIDDLE = 27915, - NPC_GRAIN_CREATE_TRIGGER = 30996, - NPC_HOURGLASS = 28656, + NPC_CHROMIE_MIDDLE = 27915, + NPC_GRAIN_CREATE_TRIGGER = 30996, + NPC_HOURGLASS = 28656, }; enum GameObjects { - GO_SHKAF_GATE = 188686, - GO_EXIT_GATE = 191788, - GO_MALGANIS_CHEST_N = 190663, - GO_MALGANIS_CHEST_H = 193597, - GO_SUSPICIOUS_CRATE = 190094, - GO_PLAGUED_CRATE = 190095, + GO_SHKAF_GATE = 188686, + GO_EXIT_GATE = 191788, + GO_MALGANIS_CHEST_N = 190663, + GO_MALGANIS_CHEST_H = 193597, + GO_SUSPICIOUS_CRATE = 190094, + GO_PLAGUED_CRATE = 190095, }; enum WorldStatesCoT { - WORLDSTATE_SHOW_CRATES = 3479, - WORLDSTATE_CRATES_REVEALED = 3480, - WORLDSTATE_WAVE_COUNT = 3504, - WORLDSTATE_TIME_GUARDIAN = 3931, - WORLDSTATE_TIME_GUARDIAN_SHOW = 3932, + WORLDSTATE_SHOW_CRATES = 3479, + WORLDSTATE_CRATES_REVEALED = 3480, + WORLDSTATE_WAVE_COUNT = 3504, + WORLDSTATE_TIME_GUARDIAN = 3931, + WORLDSTATE_TIME_GUARDIAN_SHOW = 3932, }; enum CrateSpells { - SPELL_CRATES_CREDIT = 58109, - SPELL_ARCANE_DISRUPTION = 49590, + SPELL_CRATES_CREDIT = 58109, + SPELL_ARCANE_DISRUPTION = 49590, - SPELL_HUMAN_FEMALE = 35483, - SPELL_HUMAN_MALE = 35482, + SPELL_HUMAN_FEMALE = 35483, + SPELL_HUMAN_MALE = 35482, }; enum EventPositions { - EVENT_POS_CHROMIE = 0, - EVENT_POS_HOURGLASS = 1, - EVENT_SRC_UTHER, - EVENT_SRC_JAINA, - EVENT_SRC_HORSE1, - EVENT_SRC_HORSE2, - EVENT_SRC_HORSE3, - EVENT_DST_UTHER, - EVENT_DST_HORSE1, - EVENT_DST_HORSE2, - EVENT_DST_HORSE3, - EVENT_POS_RETREAT, - EVENT_SRC_TOWN_CITYMAN1, - EVENT_SRC_TOWN_CITYMAN2, - EVENT_DST_CITYMAN, - EVENT_SRC_MALGANIS, - EVENT_SRC_MEATHOOK, - EVENT_SRC_SALRAMM, - EVENT_SRC_HALL_CITYMAN1, - EVENT_SRC_HALL_CITYMAN2, - EVENT_SRC_HALL_CITYMAN3, - EVENT_SRC_EPOCH, - EVENT_DST_EPOCH, - EVENT_SRC_CORRUPTOR, - EVENT_SRC_MALGANIS_FINAL, + EVENT_POS_CHROMIE = 0, + EVENT_POS_HOURGLASS = 1, + EVENT_SRC_UTHER, + EVENT_SRC_JAINA, + EVENT_SRC_HORSE1, + EVENT_SRC_HORSE2, + EVENT_SRC_HORSE3, + EVENT_DST_UTHER, + EVENT_DST_HORSE1, + EVENT_DST_HORSE2, + EVENT_DST_HORSE3, + EVENT_POS_RETREAT, + EVENT_SRC_TOWN_CITYMAN1, + EVENT_SRC_TOWN_CITYMAN2, + EVENT_DST_CITYMAN, + EVENT_SRC_MALGANIS, + EVENT_SRC_MEATHOOK, + EVENT_SRC_SALRAMM, + EVENT_SRC_HALL_CITYMAN1, + EVENT_SRC_HALL_CITYMAN2, + EVENT_SRC_HALL_CITYMAN3, + EVENT_SRC_EPOCH, + EVENT_DST_EPOCH, + EVENT_SRC_CORRUPTOR, + EVENT_SRC_MALGANIS_FINAL, }; enum ArthasPhase { - COS_PROGRESS_NOT_STARTED = 0, - COS_PROGRESS_CRATES_FOUND = 1, - COS_PROGRESS_START_INTRO = 2, - COS_PROGRESS_FINISHED_INTRO = 3, - COS_PROGRESS_FINISHED_CITY_INTRO = 4, - COS_PROGRESS_KILLED_MEATHOOK = 5, - COS_PROGRESS_KILLED_SALRAMM = 6, - COS_PROGRESS_REACHED_TOWN_HALL = 7, - COS_PROGRESS_KILLED_EPOCH = 8, - COS_PROGRESS_LAST_CITY = 9, - COS_PROGRESS_BEFORE_MALGANIS = 10, - COS_PROGRESS_FINISHED = 11, + COS_PROGRESS_NOT_STARTED = 0, + COS_PROGRESS_CRATES_FOUND = 1, + COS_PROGRESS_START_INTRO = 2, + COS_PROGRESS_FINISHED_INTRO = 3, + COS_PROGRESS_FINISHED_CITY_INTRO = 4, + COS_PROGRESS_KILLED_MEATHOOK = 5, + COS_PROGRESS_KILLED_SALRAMM = 6, + COS_PROGRESS_REACHED_TOWN_HALL = 7, + COS_PROGRESS_KILLED_EPOCH = 8, + COS_PROGRESS_LAST_CITY = 9, + COS_PROGRESS_BEFORE_MALGANIS = 10, + COS_PROGRESS_FINISHED = 11, }; enum Actions { - ACTION_START_EVENT = 1, - ACTION_START_CITY = 2, - ACTION_KILLED_SALRAMM = 3, - ACTION_START_TOWN_HALL = 4, - ACTION_START_SECRET_PASSAGE = 5, - ACTION_START_LAST_CITY = 6, - ACTION_RUN_OUT_OF_TIME = 7, - ACTION_START_MALGANIS = 8, - ACTION_KILLED_MALGANIS = 9, + ACTION_START_EVENT = 1, + ACTION_START_CITY = 2, + ACTION_KILLED_SALRAMM = 3, + ACTION_START_TOWN_HALL = 4, + ACTION_START_SECRET_PASSAGE = 5, + ACTION_START_LAST_CITY = 6, + ACTION_RUN_OUT_OF_TIME = 7, + ACTION_START_MALGANIS = 8, + ACTION_KILLED_MALGANIS = 9, }; const Position LeaderIntroPos1 = {1938.05f, 1289.79f, 145.38f, 3.18f}; @@ -141,31 +141,31 @@ const Position LeaderIntroPos6 = {2327.39f, 1412.47f, 127.69f, 0.0f}; const Position EventPos[] = { - {1813.298f, 1283.578f, 142.326f, 3.878161f}, // chromie - {1809.46f, 1286.05f, 142.62f, 4.8f}, // hourglass - {1795.76f, 1271.54f, 140.61f, 0.21f}, // source for uther - {1895.48f, 1292.66f, 143.706f, 0.023475f}, // source for jaina - {1788.38f, 1273.7f, 140.15f, 0.2f}, // source for horses - {1788.76f, 1271.54f, 140.62f, 0.21f}, - {1788.74f, 1267.38f, 140.18f, 0.11f}, - {1897.6f, 1285.5f, 143.44f, 0.32f}, // dest for uther - {1888.56f, 1289.95f, 143.8f, 0.01f}, // dest for horses - {1888.94f, 1285.41f, 143.69f, 0.08f}, - {1889.55f, 1279.95f, 143.62f, 0.1f}, - {1751.9f, 1262.45f, 137.62f, 3.35f}, // retreat position after intro (uther + horses) - {2091.977f, 1275.021f, 140.757f, 0.558f}, // source for town city man 1 - {2093.514f, 1275.842f, 140.408f, 3.801f}, // 2 - {2089.04f, 1277.98f, 140.85f, 2.35f}, // cityman dest pos - {2117.349f, 1288.624f, 136.271f, 1.37f}, // malganis city intro - {2351.45f, 1197.81f, 130.45f, 3.83f}, // meathook spawn position - {2351.45f, 1197.81f, 130.45f, 3.83f}, // salramm spawn position - {2398.14f, 1207.81f, 134.04f, 5.15f}, // source for hall city man 1 - {2403.22f, 1205.54f, 134.04f, 3.31f}, // 2 - {2400.82f, 1201.69f, 134.01f, 1.53f}, // 3 - {2463.131f, 1115.391f, 152.473f, 3.41f}, // epoch spawn position - {2451.809f, 1112.901f, 149.220f, 3.36f}, // epoch move pos - {2329.07f, 1276.98f, 132.68f, 4.0f}, // infinite corruptor pos - {2298.25f, 1500.56f, 128.37f, 4.95f} // malganis final pos + {1813.298f, 1283.578f, 142.326f, 3.878161f}, // chromie + {1809.46f, 1286.05f, 142.62f, 4.8f}, // hourglass + {1795.76f, 1271.54f, 140.61f, 0.21f}, // source for uther + {1895.48f, 1292.66f, 143.706f, 0.023475f}, // source for jaina + {1788.38f, 1273.7f, 140.15f, 0.2f}, // source for horses + {1788.76f, 1271.54f, 140.62f, 0.21f}, + {1788.74f, 1267.38f, 140.18f, 0.11f}, + {1897.6f, 1285.5f, 143.44f, 0.32f}, // dest for uther + {1888.56f, 1289.95f, 143.8f, 0.01f}, // dest for horses + {1888.94f, 1285.41f, 143.69f, 0.08f}, + {1889.55f, 1279.95f, 143.62f, 0.1f}, + {1751.9f, 1262.45f, 137.62f, 3.35f}, // retreat position after intro (uther + horses) + {2091.977f, 1275.021f, 140.757f, 0.558f}, // source for town city man 1 + {2093.514f, 1275.842f, 140.408f, 3.801f}, // 2 + {2089.04f, 1277.98f, 140.85f, 2.35f}, // cityman dest pos + {2117.349f, 1288.624f, 136.271f, 1.37f}, // malganis city intro + {2351.45f, 1197.81f, 130.45f, 3.83f}, // meathook spawn position + {2351.45f, 1197.81f, 130.45f, 3.83f}, // salramm spawn position + {2398.14f, 1207.81f, 134.04f, 5.15f}, // source for hall city man 1 + {2403.22f, 1205.54f, 134.04f, 3.31f}, // 2 + {2400.82f, 1201.69f, 134.01f, 1.53f}, // 3 + {2463.131f, 1115.391f, 152.473f, 3.41f}, // epoch spawn position + {2451.809f, 1112.901f, 149.220f, 3.36f}, // epoch move pos + {2329.07f, 1276.98f, 132.68f, 4.0f}, // infinite corruptor pos + {2298.25f, 1500.56f, 128.37f, 4.95f} // malganis final pos }; #endif diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index 4300888a3..89a97d944 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -24,21 +24,21 @@ class instance_culling_of_stratholme : public InstanceMapScript { instance_culling_of_stratholme_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { - // NPCs + // NPCs _arthasGUID = 0; - _infiniteGUID = 0; + _infiniteGUID = 0; - // GOs + // GOs _shkafGateGUID = 0; _exitGateGUID = 0; - // Instance + // Instance _crateCount = 0; - _showCrateTimer = 0; - _guardianTimer = 0; - _respawnAndReposition = false; - _encounterState = COS_PROGRESS_NOT_STARTED; - _loadTimer = 0; + _showCrateTimer = 0; + _guardianTimer = 0; + _respawnAndReposition = false; + _encounterState = COS_PROGRESS_NOT_STARTED; + _loadTimer = 0; } bool IsEncounterInProgress() const @@ -55,16 +55,16 @@ class instance_culling_of_stratholme : public InstanceMapScript data << uint32(WORLDSTATE_TIME_GUARDIAN_SHOW) << uint32(0); } - void OnPlayerEnter(Player* plr) - { - if (instance->GetPlayersCountExceptGMs() == 1) - SetData(DATA_ARTHAS_REPOSITION, 2); + void OnPlayerEnter(Player* plr) + { + if (instance->GetPlayersCountExceptGMs() == 1) + SetData(DATA_ARTHAS_REPOSITION, 2); - EnsureGridLoaded(); + EnsureGridLoaded(); - if (plr->getRace() != RACE_HUMAN && plr->getRace() != RACE_DWARF && plr->getRace() != RACE_GNOME) - plr->CastSpell(plr, ((plr->getGender() == GENDER_MALE) ? SPELL_HUMAN_MALE : SPELL_HUMAN_FEMALE), true); - } + if (plr->getRace() != RACE_HUMAN && plr->getRace() != RACE_DWARF && plr->getRace() != RACE_GNOME) + plr->CastSpell(plr, ((plr->getGender() == GENDER_MALE) ? SPELL_HUMAN_MALE : SPELL_HUMAN_FEMALE), true); + } void OnCreatureCreate(Creature* creature) { @@ -72,14 +72,14 @@ class instance_culling_of_stratholme : public InstanceMapScript { case NPC_ARTHAS: _arthasGUID = creature->GetGUID(); - if (_encounterState == COS_PROGRESS_FINISHED) - creature->SetVisible(false); - else - Reposition(creature); + if (_encounterState == COS_PROGRESS_FINISHED) + creature->SetVisible(false); + else + Reposition(creature); + break; + case NPC_INFINITE: + _infiniteGUID = creature->GetGUID(); break; - case NPC_INFINITE: - _infiniteGUID = creature->GetGUID(); - break; } } @@ -89,8 +89,8 @@ class instance_culling_of_stratholme : public InstanceMapScript { case GO_SHKAF_GATE: _shkafGateGUID = go->GetGUID(); - if (_encounterState >= COS_PROGRESS_KILLED_EPOCH) - go->SetGoState(GO_STATE_ACTIVE); + if (_encounterState >= COS_PROGRESS_KILLED_EPOCH) + go->SetGoState(GO_STATE_ACTIVE); break; case GO_EXIT_GATE: _exitGateGUID = go->GetGUID(); @@ -104,68 +104,68 @@ class instance_culling_of_stratholme : public InstanceMapScript { switch (type) { - case DATA_SHOW_CRATES: - DoUpdateWorldState(WORLDSTATE_SHOW_CRATES, data); - return; - case DATA_SHOW_INFINITE_TIMER: - if (!instance->IsHeroic() || !_guardianTimer) - return; - DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, data); - DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN, uint32(_guardianTimer / (MINUTE*IN_MILLISECONDS))); - if (data == 0) - { - _guardianTimer = 0; - SaveToDB(); - } - else if (!_infiniteGUID) - instance->SummonCreature(NPC_INFINITE, EventPos[EVENT_SRC_CORRUPTOR]); - return; - case DATA_START_WAVES: - DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 1); - if (instance->IsHeroic()) - { - DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, true); - _guardianTimer = 26*MINUTE*IN_MILLISECONDS; - if (!_infiniteGUID) - instance->SummonCreature(NPC_INFINITE, EventPos[EVENT_SRC_CORRUPTOR]); - } - return; - case DATA_CRATE_COUNT: + case DATA_SHOW_CRATES: + DoUpdateWorldState(WORLDSTATE_SHOW_CRATES, data); + return; + case DATA_SHOW_INFINITE_TIMER: + if (!instance->IsHeroic() || !_guardianTimer) + return; + DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, data); + DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN, uint32(_guardianTimer / (MINUTE*IN_MILLISECONDS))); + if (data == 0) + { + _guardianTimer = 0; + SaveToDB(); + } + else if (!_infiniteGUID) + instance->SummonCreature(NPC_INFINITE, EventPos[EVENT_SRC_CORRUPTOR]); + return; + case DATA_START_WAVES: + DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 1); + if (instance->IsHeroic()) + { + DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, true); + _guardianTimer = 26*MINUTE*IN_MILLISECONDS; + if (!_infiniteGUID) + instance->SummonCreature(NPC_INFINITE, EventPos[EVENT_SRC_CORRUPTOR]); + } + return; + case DATA_CRATE_COUNT: _crateCount++; if (_crateCount == 5) { - Map::PlayerList const &PlayerList = instance->GetPlayers(); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - i->GetSource()->KilledMonsterCredit(NPC_GRAIN_CREATE_TRIGGER, 0); + Map::PlayerList const &PlayerList = instance->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + i->GetSource()->KilledMonsterCredit(NPC_GRAIN_CREATE_TRIGGER, 0); - _showCrateTimer++; - if (GetData(DATA_ARTHAS_EVENT) < COS_PROGRESS_CRATES_FOUND) - SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_CRATES_FOUND); + _showCrateTimer++; + if (GetData(DATA_ARTHAS_EVENT) < COS_PROGRESS_CRATES_FOUND) + SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_CRATES_FOUND); } DoUpdateWorldState(WORLDSTATE_CRATES_REVEALED, _crateCount); return; - case DATA_ARTHAS_EVENT: - // Start Event - _encounterState = data; - if (data == COS_PROGRESS_START_INTRO) - { - if (Creature *arthas = instance->GetCreature(_arthasGUID)) - arthas->AI()->DoAction(ACTION_START_EVENT); - } - else if (data == COS_PROGRESS_KILLED_SALRAMM) - { - if (Creature *arthas = instance->GetCreature(_arthasGUID)) - arthas->AI()->DoAction(ACTION_KILLED_SALRAMM); - } - break; - case DATA_ARTHAS_REPOSITION: - if (data == 2) - _respawnAndReposition = true; - else if (Creature *arthas = instance->GetCreature(_arthasGUID)) - Reposition(arthas); - return; + case DATA_ARTHAS_EVENT: + // Start Event + _encounterState = data; + if (data == COS_PROGRESS_START_INTRO) + { + if (Creature *arthas = instance->GetCreature(_arthasGUID)) + arthas->AI()->DoAction(ACTION_START_EVENT); + } + else if (data == COS_PROGRESS_KILLED_SALRAMM) + { + if (Creature *arthas = instance->GetCreature(_arthasGUID)) + arthas->AI()->DoAction(ACTION_KILLED_SALRAMM); + } + break; + case DATA_ARTHAS_REPOSITION: + if (data == 2) + _respawnAndReposition = true; + else if (Creature *arthas = instance->GetCreature(_arthasGUID)) + Reposition(arthas); + return; } @@ -177,10 +177,10 @@ class instance_culling_of_stratholme : public InstanceMapScript { switch (type) { - case DATA_ARTHAS_EVENT: - return _encounterState; - case DATA_GUARDIANTIME_EVENT: - return _guardianTimer; + case DATA_ARTHAS_EVENT: + return _encounterState; + case DATA_GUARDIANTIME_EVENT: + return _guardianTimer; } return 0; } @@ -189,175 +189,175 @@ class instance_culling_of_stratholme : public InstanceMapScript { switch (identifier) { - case DATA_SHKAF_GATE: - return _shkafGateGUID; - case DATA_ARTHAS: - return _arthasGUID; - case DATA_EXIT_GATE: - return _exitGateGUID; + case DATA_SHKAF_GATE: + return _shkafGateGUID; + case DATA_ARTHAS: + return _arthasGUID; + case DATA_EXIT_GATE: + return _exitGateGUID; } return 0; } - void Update(uint32 diff) - { - if (_loadTimer) - { - _loadTimer += diff; - if (_loadTimer > 3000) - { - UpdateEventState(); - _loadTimer = 0; - } - } - // Used when arthas dies - if (_respawnAndReposition) - { - if (Creature *arthas = instance->GetCreature(_arthasGUID)) - { - if (!arthas->IsAlive()) - { - EnsureGridLoaded(); - arthas->setDeathState(DEAD); - arthas->Respawn(); - } - else - { - arthas->AI()->Reset(); - _respawnAndReposition = false; - } - } - } + void Update(uint32 diff) + { + if (_loadTimer) + { + _loadTimer += diff; + if (_loadTimer > 3000) + { + UpdateEventState(); + _loadTimer = 0; + } + } + // Used when arthas dies + if (_respawnAndReposition) + { + if (Creature *arthas = instance->GetCreature(_arthasGUID)) + { + if (!arthas->IsAlive()) + { + EnsureGridLoaded(); + arthas->setDeathState(DEAD); + arthas->Respawn(); + } + else + { + arthas->AI()->Reset(); + _respawnAndReposition = false; + } + } + } - // Used after 5-th crates is revealed - if (_showCrateTimer) - { - _showCrateTimer += diff; - if (_showCrateTimer >= 20000) - { - UpdateEventState(); - _showCrateTimer = 0; // just to be sure - } - } + // Used after 5-th crates is revealed + if (_showCrateTimer) + { + _showCrateTimer += diff; + if (_showCrateTimer >= 20000) + { + UpdateEventState(); + _showCrateTimer = 0; // just to be sure + } + } - // Used to display how much time players have - if (_guardianTimer) - { - uint32 div = uint32(_guardianTimer / (MINUTE*IN_MILLISECONDS)); - _guardianTimer -= diff; - uint32 divAfter = uint32(_guardianTimer / (MINUTE*IN_MILLISECONDS)); - - if (divAfter == 0) - { - _guardianTimer = 0; - DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, 0); + // Used to display how much time players have + if (_guardianTimer) + { + uint32 div = uint32(_guardianTimer / (MINUTE*IN_MILLISECONDS)); + _guardianTimer -= diff; + uint32 divAfter = uint32(_guardianTimer / (MINUTE*IN_MILLISECONDS)); + + if (divAfter == 0) + { + _guardianTimer = 0; + DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, 0); - // Inform infinite we run out of time - if (instance->IsHeroic() && _infiniteGUID) - if (Creature* cr = instance->GetCreature(_infiniteGUID)) - cr->AI()->DoAction(ACTION_RUN_OUT_OF_TIME); + // Inform infinite we run out of time + if (instance->IsHeroic() && _infiniteGUID) + if (Creature* cr = instance->GetCreature(_infiniteGUID)) + cr->AI()->DoAction(ACTION_RUN_OUT_OF_TIME); - } - else if (div > divAfter) - { - if (divAfter == 5) - ChromieWhisper(1); - else if (divAfter == 1) - ChromieWhisper(2); + } + else if (div > divAfter) + { + if (divAfter == 5) + ChromieWhisper(1); + else if (divAfter == 1) + ChromieWhisper(2); - DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN, divAfter); - SaveToDB(); - } - } - } + DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN, divAfter); + SaveToDB(); + } + } + } - void UpdateEventState() - { - if (_encounterState > COS_PROGRESS_NOT_STARTED) - { - // Summon Chromie and global whisper + void UpdateEventState() + { + if (_encounterState > COS_PROGRESS_NOT_STARTED) + { + // Summon Chromie and global whisper instance->SummonCreature(NPC_CHROMIE_MIDDLE, EventPos[EVENT_POS_CHROMIE]); - instance->SummonCreature(NPC_HOURGLASS, EventPos[EVENT_POS_HOURGLASS]); + instance->SummonCreature(NPC_HOURGLASS, EventPos[EVENT_POS_HOURGLASS]); - if (_encounterState == COS_PROGRESS_CRATES_FOUND || - _encounterState == COS_PROGRESS_START_INTRO) - { - ChromieWhisper(0); + if (_encounterState == COS_PROGRESS_CRATES_FOUND || + _encounterState == COS_PROGRESS_START_INTRO) + { + ChromieWhisper(0); - // hide crates count - DoUpdateWorldState(WORLDSTATE_SHOW_CRATES, 0); - _showCrateTimer = 0; - _encounterState = COS_PROGRESS_CRATES_FOUND; - } - } - } + // hide crates count + DoUpdateWorldState(WORLDSTATE_SHOW_CRATES, 0); + _showCrateTimer = 0; + _encounterState = COS_PROGRESS_CRATES_FOUND; + } + } + } - void ChromieWhisper(uint8 textId) - { - if (!instance->GetPlayers().isEmpty()) - if (Player* player = instance->GetPlayers().getFirst()->GetSource()) - { - Position pos; - player->GetPosition(&pos); - if (Creature* cr = instance->SummonCreature(NPC_CHROMIE_MIDDLE, pos)) - { - cr->SetVisible(false); - cr->DespawnOrUnsummon(1000); - sCreatureTextMgr->SendChat(cr, textId, player, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); - } - } - } + void ChromieWhisper(uint8 textId) + { + if (!instance->GetPlayers().isEmpty()) + if (Player* player = instance->GetPlayers().getFirst()->GetSource()) + { + Position pos; + player->GetPosition(&pos); + if (Creature* cr = instance->SummonCreature(NPC_CHROMIE_MIDDLE, pos)) + { + cr->SetVisible(false); + cr->DespawnOrUnsummon(1000); + sCreatureTextMgr->SendChat(cr, textId, player, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); + } + } + } - void Reposition(Creature* arthas) - { - switch (GetData(DATA_ARTHAS_EVENT)) - { - case COS_PROGRESS_FINISHED_INTRO: - arthas->UpdatePosition(LeaderIntroPos2, true); - arthas->SetHomePosition(LeaderIntroPos2); - arthas->SetFacingTo(LeaderIntroPos2.GetOrientation()); - break; - case COS_PROGRESS_FINISHED_CITY_INTRO: - case COS_PROGRESS_KILLED_MEATHOOK: - case COS_PROGRESS_KILLED_SALRAMM: - arthas->UpdatePosition(LeaderIntroPos2special, true); - arthas->SetHomePosition(LeaderIntroPos2special); - arthas->SetFacingTo(LeaderIntroPos2special.GetOrientation()); - break; - case COS_PROGRESS_REACHED_TOWN_HALL: - arthas->UpdatePosition(LeaderIntroPos3, true); - arthas->SetHomePosition(LeaderIntroPos3); - arthas->SetFacingTo(LeaderIntroPos3.GetOrientation()); - break; - case COS_PROGRESS_KILLED_EPOCH: - arthas->UpdatePosition(LeaderIntroPos4, true); - arthas->SetHomePosition(LeaderIntroPos4); - arthas->SetFacingTo(LeaderIntroPos4.GetOrientation()); - break; - case COS_PROGRESS_LAST_CITY: - arthas->UpdatePosition(LeaderIntroPos5, true); - arthas->SetHomePosition(LeaderIntroPos5); - arthas->SetFacingTo(LeaderIntroPos5.GetOrientation()); - break; - case COS_PROGRESS_BEFORE_MALGANIS: - arthas->UpdatePosition(LeaderIntroPos6, true); - arthas->SetHomePosition(LeaderIntroPos6); - arthas->SetFacingTo(LeaderIntroPos6.GetOrientation()); - break; - } - } + void Reposition(Creature* arthas) + { + switch (GetData(DATA_ARTHAS_EVENT)) + { + case COS_PROGRESS_FINISHED_INTRO: + arthas->UpdatePosition(LeaderIntroPos2, true); + arthas->SetHomePosition(LeaderIntroPos2); + arthas->SetFacingTo(LeaderIntroPos2.GetOrientation()); + break; + case COS_PROGRESS_FINISHED_CITY_INTRO: + case COS_PROGRESS_KILLED_MEATHOOK: + case COS_PROGRESS_KILLED_SALRAMM: + arthas->UpdatePosition(LeaderIntroPos2special, true); + arthas->SetHomePosition(LeaderIntroPos2special); + arthas->SetFacingTo(LeaderIntroPos2special.GetOrientation()); + break; + case COS_PROGRESS_REACHED_TOWN_HALL: + arthas->UpdatePosition(LeaderIntroPos3, true); + arthas->SetHomePosition(LeaderIntroPos3); + arthas->SetFacingTo(LeaderIntroPos3.GetOrientation()); + break; + case COS_PROGRESS_KILLED_EPOCH: + arthas->UpdatePosition(LeaderIntroPos4, true); + arthas->SetHomePosition(LeaderIntroPos4); + arthas->SetFacingTo(LeaderIntroPos4.GetOrientation()); + break; + case COS_PROGRESS_LAST_CITY: + arthas->UpdatePosition(LeaderIntroPos5, true); + arthas->SetHomePosition(LeaderIntroPos5); + arthas->SetFacingTo(LeaderIntroPos5.GetOrientation()); + break; + case COS_PROGRESS_BEFORE_MALGANIS: + arthas->UpdatePosition(LeaderIntroPos6, true); + arthas->SetHomePosition(LeaderIntroPos6); + arthas->SetFacingTo(LeaderIntroPos6.GetOrientation()); + break; + } + } - void EnsureGridLoaded() - { - instance->LoadGrid(LeaderIntroPos1.GetPositionX(), LeaderIntroPos1.GetPositionY()); - instance->LoadGrid(LeaderIntroPos2.GetPositionX(), LeaderIntroPos2.GetPositionY()); - instance->LoadGrid(LeaderIntroPos3.GetPositionX(), LeaderIntroPos3.GetPositionY()); - instance->LoadGrid(LeaderIntroPos4.GetPositionX(), LeaderIntroPos4.GetPositionY()); - instance->LoadGrid(LeaderIntroPos5.GetPositionX(), LeaderIntroPos5.GetPositionY()); - instance->LoadGrid(LeaderIntroPos6.GetPositionX(), LeaderIntroPos6.GetPositionY()); - } + void EnsureGridLoaded() + { + instance->LoadGrid(LeaderIntroPos1.GetPositionX(), LeaderIntroPos1.GetPositionY()); + instance->LoadGrid(LeaderIntroPos2.GetPositionX(), LeaderIntroPos2.GetPositionY()); + instance->LoadGrid(LeaderIntroPos3.GetPositionX(), LeaderIntroPos3.GetPositionY()); + instance->LoadGrid(LeaderIntroPos4.GetPositionX(), LeaderIntroPos4.GetPositionY()); + instance->LoadGrid(LeaderIntroPos5.GetPositionX(), LeaderIntroPos5.GetPositionY()); + instance->LoadGrid(LeaderIntroPos6.GetPositionX(), LeaderIntroPos6.GetPositionY()); + } - std::string GetSaveData() + std::string GetSaveData() { OUT_SAVE_INST_DATA; @@ -387,10 +387,10 @@ class instance_culling_of_stratholme : public InstanceMapScript if (dataHead1 == 'C' && dataHead2 == 'S') { _encounterState = data0; - _guardianTimer = data1; + _guardianTimer = data1; - //UpdateEventState(); - _loadTimer++; + //UpdateEventState(); + _loadTimer++; } else OUT_LOAD_INST_DATA_FAIL; @@ -399,20 +399,20 @@ class instance_culling_of_stratholme : public InstanceMapScript } private: - // NPCs + // NPCs uint64 _arthasGUID; - uint64 _infiniteGUID; + uint64 _infiniteGUID; - // GOs + // GOs uint64 _shkafGateGUID; uint64 _exitGateGUID; uint32 _encounterState; uint32 _crateCount; - uint32 _showCrateTimer; - uint32 _guardianTimer; + uint32 _showCrateTimer; + uint32 _guardianTimer; - bool _respawnAndReposition; - uint32 _loadTimer; + bool _respawnAndReposition; + uint32 _loadTimer; }; }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp index 438b4ad64..0e5300427 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp @@ -8,35 +8,35 @@ REWRITTEN BY XINEF enum CaptainSkarloc { - SAY_ENTER = 0, - SAY_TAUNT = 1, - SAY_SLAY = 2, - SAY_DEATH = 3, + SAY_ENTER = 0, + SAY_TAUNT = 1, + SAY_SLAY = 2, + SAY_DEATH = 3, - SPELL_HOLY_LIGHT = 29427, - SPELL_CLEANSE = 29380, - SPELL_HAMMER_OF_JUSTICE = 13005, - SPELL_HOLY_SHIELD = 31904, - SPELL_DEVOTION_AURA = 8258, - SPELL_CONSECRATION = 38385, + SPELL_HOLY_LIGHT = 29427, + SPELL_CLEANSE = 29380, + SPELL_HAMMER_OF_JUSTICE = 13005, + SPELL_HOLY_SHIELD = 31904, + SPELL_DEVOTION_AURA = 8258, + SPELL_CONSECRATION = 38385, - WAYPOINTS_COUNT = 4, + WAYPOINTS_COUNT = 4, - EVENT_INITIAL_TALK = 1, - EVENT_START_FIGHT = 2, - EVENT_SPELL_CLEANSE = 10, - EVENT_SPELL_HAMMER = 11, - EVENT_SPELL_HOLY_LIGHT = 12, - EVENT_SPELL_HOLY_SHIELD = 13, - EVENT_SPELL_CONSECRATION = 14 + EVENT_INITIAL_TALK = 1, + EVENT_START_FIGHT = 2, + EVENT_SPELL_CLEANSE = 10, + EVENT_SPELL_HAMMER = 11, + EVENT_SPELL_HOLY_LIGHT = 12, + EVENT_SPELL_HOLY_SHIELD = 13, + EVENT_SPELL_CONSECRATION = 14 }; const Position startPath[WAYPOINTS_COUNT] = { - {2008.38f, 281.57f, 65.70f, 0.0f}, - {2035.71f, 271.38f, 63.495f, 0.0f}, - {2049.12f, 252.31f, 62.855f, 0.0f}, - {2058.77f, 236.04f, 63.92f, 0.0f} + {2008.38f, 281.57f, 65.70f, 0.0f}, + {2035.71f, 271.38f, 63.495f, 0.0f}, + {2049.12f, 252.31f, 62.855f, 0.0f}, + {2058.77f, 236.04f, 63.92f, 0.0f} }; class boss_captain_skarloc : public CreatureScript @@ -54,84 +54,84 @@ public: boss_captain_skarlocAI(Creature* creature) : ScriptedAI(creature), summons(me) { } EventMap events; - EventMap events2; - SummonList summons; + EventMap events2; + SummonList summons; void Reset() { - events.Reset(); - events2.Reset(); - summons.DespawnAll(); + events.Reset(); + events2.Reset(); + summons.DespawnAll(); } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (Creature* thrall = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(DATA_THRALL_GUID))) - thrall->AI()->JustSummoned(summon); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (Creature* thrall = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(DATA_THRALL_GUID))) + thrall->AI()->JustSummoned(summon); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - if (summon->GetEntry() == NPC_SKARLOC_MOUNT) - return; + if (summon->GetEntry() == NPC_SKARLOC_MOUNT) + return; - if (summons.size() == 1) - summon->GetMotionMaster()->MovePoint(0, 2060.788f, 237.301f, 63.999f); - else - summon->GetMotionMaster()->MovePoint(0, 2056.870f, 234.853f, 63.839f); - } + if (summons.size() == 1) + summon->GetMotionMaster()->MovePoint(0, 2060.788f, 237.301f, 63.999f); + else + summon->GetMotionMaster()->MovePoint(0, 2056.870f, 234.853f, 63.839f); + } - void InitializeAI() - { - ScriptedAI::InitializeAI(); + void InitializeAI() + { + ScriptedAI::InitializeAI(); - Movement::PointsArray path; - path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - for (uint8 i = 0; i < WAYPOINTS_COUNT; ++i) - path.push_back(G3D::Vector3(startPath[i].GetPositionX(), startPath[i].GetPositionY(), startPath[i].GetPositionZ())); + Movement::PointsArray path; + path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + for (uint8 i = 0; i < WAYPOINTS_COUNT; ++i) + path.push_back(G3D::Vector3(startPath[i].GetPositionX(), startPath[i].GetPositionY(), startPath[i].GetPositionZ())); - me->GetMotionMaster()->MoveSplinePath(&path); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->Mount(SKARLOC_MOUNT_MODEL); - } + me->GetMotionMaster()->MoveSplinePath(&path); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->Mount(SKARLOC_MOUNT_MODEL); + } - void MovementInform(uint32 type, uint32 id) - { - if (type != ESCORT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != ESCORT_MOTION_TYPE) + return; - // Xinef: we can rely here on internal counting - if (id == 1) - { - me->SummonCreature(NPC_DURNHOLDE_MAGE, 2038.549f, 273.303f, 63.420f, 5.30f, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_DURNHOLDE_VETERAN, 2032.810f, 269.416f, 63.561f, 5.30f, TEMPSUMMON_MANUAL_DESPAWN); - } - else if (id == 2) - { - me->SummonCreature(NPC_SKARLOC_MOUNT, 2049.12f, 252.31f, 62.855f, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN); - me->Dismount(); - me->SetWalk(true); - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - summon->SetWalk(true); - } + // Xinef: we can rely here on internal counting + if (id == 1) + { + me->SummonCreature(NPC_DURNHOLDE_MAGE, 2038.549f, 273.303f, 63.420f, 5.30f, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_DURNHOLDE_VETERAN, 2032.810f, 269.416f, 63.561f, 5.30f, TEMPSUMMON_MANUAL_DESPAWN); + } + else if (id == 2) + { + me->SummonCreature(NPC_SKARLOC_MOUNT, 2049.12f, 252.31f, 62.855f, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN); + me->Dismount(); + me->SetWalk(true); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + summon->SetWalk(true); + } - if (me->movespline->Finalized()) - { - events2.ScheduleEvent(EVENT_INITIAL_TALK, 500); - events2.ScheduleEvent(EVENT_START_FIGHT, 8000); - } - } + if (me->movespline->Finalized()) + { + events2.ScheduleEvent(EVENT_INITIAL_TALK, 500); + events2.ScheduleEvent(EVENT_START_FIGHT, 8000); + } + } void EnterCombat(Unit* /*who*/) { - me->CastSpell(me, SPELL_DEVOTION_AURA, true); + me->CastSpell(me, SPELL_DEVOTION_AURA, true); - events.ScheduleEvent(EVENT_SPELL_HOLY_LIGHT, 15000); - events.ScheduleEvent(EVENT_SPELL_CLEANSE, 6000); - events.ScheduleEvent(EVENT_SPELL_HAMMER, 20000); - events.ScheduleEvent(EVENT_SPELL_HOLY_SHIELD, 10000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_CONSECRATION, 1000); + events.ScheduleEvent(EVENT_SPELL_HOLY_LIGHT, 15000); + events.ScheduleEvent(EVENT_SPELL_CLEANSE, 6000); + events.ScheduleEvent(EVENT_SPELL_HAMMER, 20000); + events.ScheduleEvent(EVENT_SPELL_HOLY_SHIELD, 10000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_CONSECRATION, 1000); } void KilledUnit(Unit* victim) @@ -143,63 +143,63 @@ public: { Talk(SAY_DEATH); me->GetInstanceScript()->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_SKARLOC_KILLED); - me->GetInstanceScript()->SetData(DATA_THRALL_ADD_FLAG, 0); + me->GetInstanceScript()->SetData(DATA_THRALL_ADD_FLAG, 0); } void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_INITIAL_TALK: - Talk(SAY_ENTER); - break; - case EVENT_START_FIGHT: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->SetInCombatWithZone(); - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetEntry() != NPC_SKARLOC_MOUNT) - { - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - summon->SetInCombatWithZone(); - } - break; - } + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_INITIAL_TALK: + Talk(SAY_ENTER); + break; + case EVENT_START_FIGHT: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetInCombatWithZone(); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetEntry() != NPC_SKARLOC_MOUNT) + { + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetInCombatWithZone(); + } + break; + } if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_HOLY_LIGHT: - me->CastSpell(me, SPELL_HOLY_LIGHT, false); - events.ScheduleEvent(EVENT_SPELL_HOLY_LIGHT, 20000); - break; - case EVENT_SPELL_CLEANSE: - if (roll_chance_i(33)) - Talk(SAY_TAUNT); - me->CastSpell(me, SPELL_CLEANSE, false); - events.ScheduleEvent(EVENT_SPELL_CLEANSE, 10000); - break; - case EVENT_SPELL_HAMMER: - me->CastSpell(me->GetVictim(), SPELL_HAMMER_OF_JUSTICE, false); - events.ScheduleEvent(EVENT_SPELL_HAMMER, 30000); - break; - case EVENT_SPELL_HOLY_SHIELD: - me->CastSpell(me, SPELL_CLEANSE, false); - events.ScheduleEvent(SPELL_HOLY_SHIELD, 30000); - break; - case EVENT_SPELL_CONSECRATION: - me->CastSpell(me, SPELL_CONSECRATION, false); - events.ScheduleEvent(EVENT_SPELL_CONSECRATION, 20000); - break; + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_HOLY_LIGHT: + me->CastSpell(me, SPELL_HOLY_LIGHT, false); + events.ScheduleEvent(EVENT_SPELL_HOLY_LIGHT, 20000); + break; + case EVENT_SPELL_CLEANSE: + if (roll_chance_i(33)) + Talk(SAY_TAUNT); + me->CastSpell(me, SPELL_CLEANSE, false); + events.ScheduleEvent(EVENT_SPELL_CLEANSE, 10000); + break; + case EVENT_SPELL_HAMMER: + me->CastSpell(me->GetVictim(), SPELL_HAMMER_OF_JUSTICE, false); + events.ScheduleEvent(EVENT_SPELL_HAMMER, 30000); + break; + case EVENT_SPELL_HOLY_SHIELD: + me->CastSpell(me, SPELL_CLEANSE, false); + events.ScheduleEvent(SPELL_HOLY_SHIELD, 30000); + break; + case EVENT_SPELL_CONSECRATION: + me->CastSpell(me, SPELL_CONSECRATION, false); + events.ScheduleEvent(EVENT_SPELL_CONSECRATION, 20000); + break; - } + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp index 13002396a..0cf2f7e4b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp @@ -9,20 +9,20 @@ REWRITTEN BY XINEF enum EpochHunter { - SAY_AGGRO = 3, - SAY_SLAY = 4, - SAY_BREATH = 5, - SAY_DEATH = 6, + SAY_AGGRO = 3, + SAY_SLAY = 4, + SAY_BREATH = 5, + SAY_DEATH = 6, SPELL_SAND_BREATH = 31914, SPELL_IMPENDING_DEATH = 31916, SPELL_MAGIC_DISRUPTION_AURA = 33834, SPELL_WING_BUFFET = 31475, - EVENT_SPELL_SAND_BREATH = 1, - EVENT_SPELL_IMPENDING_DEATH = 2, - EVENT_SPELL_DISRUPTION = 3, - EVENT_SPELL_WING_BUFFET = 4 + EVENT_SPELL_SAND_BREATH = 1, + EVENT_SPELL_IMPENDING_DEATH = 2, + EVENT_SPELL_DISRUPTION = 3, + EVENT_SPELL_WING_BUFFET = 4 }; class boss_epoch_hunter : public CreatureScript @@ -49,26 +49,26 @@ public: { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_SAND_BREATH, 8000); - events.ScheduleEvent(EVENT_SPELL_IMPENDING_DEATH, 2000); - events.ScheduleEvent(EVENT_SPELL_DISRUPTION, 20000); - events.ScheduleEvent(EVENT_SPELL_WING_BUFFET, 14000); + events.ScheduleEvent(EVENT_SPELL_SAND_BREATH, 8000); + events.ScheduleEvent(EVENT_SPELL_IMPENDING_DEATH, 2000); + events.ScheduleEvent(EVENT_SPELL_DISRUPTION, 20000); + events.ScheduleEvent(EVENT_SPELL_WING_BUFFET, 14000); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void JustDied(Unit* killer) { - if (killer == me) - return; + if (killer == me) + return; Talk(SAY_DEATH); - me->GetInstanceScript()->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_EPOCH_KILLED); - if (Creature* taretha = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(DATA_TARETHA_GUID))) - taretha->AI()->DoAction(me->GetEntry()); + me->GetInstanceScript()->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_EPOCH_KILLED); + if (Creature* taretha = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(DATA_TARETHA_GUID))) + taretha->AI()->DoAction(me->GetEntry()); } void UpdateAI(uint32 diff) @@ -76,31 +76,31 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_SAND_BREATH: - if (roll_chance_i(50)) - Talk(SAY_BREATH); - me->CastSpell(me->GetVictim(), SPELL_SAND_BREATH, false); - events.ScheduleEvent(EVENT_SPELL_SAND_BREATH, 20000); - break; - case EVENT_SPELL_IMPENDING_DEATH: - me->CastSpell(me->GetVictim(), SPELL_IMPENDING_DEATH, false); - events.ScheduleEvent(EVENT_SPELL_IMPENDING_DEATH, 30000); - break; - case EVENT_SPELL_WING_BUFFET: - me->CastSpell(me, SPELL_WING_BUFFET, false); - events.ScheduleEvent(EVENT_SPELL_WING_BUFFET, 30000); - break; - case EVENT_SPELL_DISRUPTION: - me->CastSpell(me, SPELL_MAGIC_DISRUPTION_AURA, false); - events.ScheduleEvent(EVENT_SPELL_DISRUPTION, 30000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_SAND_BREATH: + if (roll_chance_i(50)) + Talk(SAY_BREATH); + me->CastSpell(me->GetVictim(), SPELL_SAND_BREATH, false); + events.ScheduleEvent(EVENT_SPELL_SAND_BREATH, 20000); + break; + case EVENT_SPELL_IMPENDING_DEATH: + me->CastSpell(me->GetVictim(), SPELL_IMPENDING_DEATH, false); + events.ScheduleEvent(EVENT_SPELL_IMPENDING_DEATH, 30000); + break; + case EVENT_SPELL_WING_BUFFET: + me->CastSpell(me, SPELL_WING_BUFFET, false); + events.ScheduleEvent(EVENT_SPELL_WING_BUFFET, 30000); + break; + case EVENT_SPELL_DISRUPTION: + me->CastSpell(me, SPELL_MAGIC_DISRUPTION_AURA, false); + events.ScheduleEvent(EVENT_SPELL_DISRUPTION, 30000); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp index 902dc9657..b8563bfa6 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_lieutenant_drake.cpp @@ -10,24 +10,24 @@ REWRITTEN BY XINEF enum LieutenantDrake { - SAY_ENTER = 0, - SAY_AGGRO = 1, - SAY_SLAY = 2, - SAY_MORTAL = 3, - SAY_SHOUT = 4, - SAY_DEATH = 5, + SAY_ENTER = 0, + SAY_AGGRO = 1, + SAY_SLAY = 2, + SAY_MORTAL = 3, + SAY_SHOUT = 4, + SAY_DEATH = 5, - SPELL_WHIRLWIND = 31909, - SPELL_EXPLODING_SHOT = 33792, - SPELL_HAMSTRING = 9080, - SPELL_MORTAL_STRIKE = 31911, - SPELL_FRIGHTENING_SHOUT = 33789, + SPELL_WHIRLWIND = 31909, + SPELL_EXPLODING_SHOT = 33792, + SPELL_HAMSTRING = 9080, + SPELL_MORTAL_STRIKE = 31911, + SPELL_FRIGHTENING_SHOUT = 33789, - EVENT_WHIRLWIND = 1, - EVENT_FRIGHTENING_SHOUT = 2, - EVENT_MORTAL_STRIKE = 3, - EVENT_HAMSTRING = 4, - EVENT_EXPLODING_SHOT = 5 + EVENT_WHIRLWIND = 1, + EVENT_FRIGHTENING_SHOUT = 2, + EVENT_MORTAL_STRIKE = 3, + EVENT_HAMSTRING = 4, + EVENT_EXPLODING_SHOT = 5 }; class boss_lieutenant_drake : public CreatureScript @@ -43,38 +43,38 @@ public: struct boss_lieutenant_drakeAI : public ScriptedAI { boss_lieutenant_drakeAI(Creature* creature) : ScriptedAI(creature) - { - pathPoints.clear(); - WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry()); - if (!path || path->empty()) - return; + { + pathPoints.clear(); + WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry()); + if (!path || path->empty()) + return; - pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - uint32 wpCounter = 1; - WPPath::const_iterator itr; - while ((itr = path->find(wpCounter++)) != path->end()) - { - WayPoint* wp = itr->second; - pathPoints.push_back(G3D::Vector3(wp->x, wp->y, wp->z)); - } - } + uint32 wpCounter = 1; + WPPath::const_iterator itr; + while ((itr = path->find(wpCounter++)) != path->end()) + { + WayPoint* wp = itr->second; + pathPoints.push_back(G3D::Vector3(wp->x, wp->y, wp->z)); + } + } - void InitializeAI() - { - ScriptedAI::InitializeAI(); - //Talk(SAY_ENTER); - JustReachedHome(); - } + void InitializeAI() + { + ScriptedAI::InitializeAI(); + //Talk(SAY_ENTER); + JustReachedHome(); + } - void JustReachedHome() - { - me->SetWalk(true); - Movement::MoveSplineInit init(me); - init.MovebyPath(pathPoints); - init.SetCyclic(); - init.Launch(); - } + void JustReachedHome() + { + me->SetWalk(true); + Movement::MoveSplineInit init(me); + init.MovebyPath(pathPoints); + init.SetCyclic(); + init.Launch(); + } void Reset() { @@ -85,24 +85,24 @@ public: { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_WHIRLWIND, 4000); - events.ScheduleEvent(EVENT_FRIGHTENING_SHOUT, 14000); - events.ScheduleEvent(EVENT_MORTAL_STRIKE, 9000); - events.ScheduleEvent(EVENT_HAMSTRING, 18000); - events.ScheduleEvent(EVENT_EXPLODING_SHOT, 1000); + events.ScheduleEvent(EVENT_WHIRLWIND, 4000); + events.ScheduleEvent(EVENT_FRIGHTENING_SHOUT, 14000); + events.ScheduleEvent(EVENT_MORTAL_STRIKE, 9000); + events.ScheduleEvent(EVENT_HAMSTRING, 18000); + events.ScheduleEvent(EVENT_EXPLODING_SHOT, 1000); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { Talk(SAY_DEATH); - if (InstanceScript* instance = me->GetInstanceScript()) - instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_DRAKE_KILLED); + if (InstanceScript* instance = me->GetInstanceScript()) + instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_DRAKE_KILLED); } void UpdateAI(uint32 diff) @@ -110,45 +110,45 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_WHIRLWIND: - me->CastSpell(me, SPELL_WHIRLWIND, false); - events.ScheduleEvent(EVENT_WHIRLWIND, 25000); - break; - case EVENT_EXPLODING_SHOT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 40.0f)) - me->CastSpell(target, SPELL_EXPLODING_SHOT, false); - events.ScheduleEvent(EVENT_EXPLODING_SHOT, 25000); - break; - case EVENT_MORTAL_STRIKE: - if (roll_chance_i(40)) - Talk(SAY_MORTAL); - me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); - events.ScheduleEvent(EVENT_MORTAL_STRIKE, 10000); - break; - case EVENT_FRIGHTENING_SHOUT: - if (roll_chance_i(40)) - Talk(SAY_SHOUT); - me->CastSpell(me, SPELL_FRIGHTENING_SHOUT, false); - events.ScheduleEvent(EVENT_FRIGHTENING_SHOUT, 25000); - break; - case EVENT_HAMSTRING: - me->CastSpell(me->GetVictim(), SPELL_HAMSTRING, false); - events.ScheduleEvent(EVENT_HAMSTRING, 25000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_WHIRLWIND: + me->CastSpell(me, SPELL_WHIRLWIND, false); + events.ScheduleEvent(EVENT_WHIRLWIND, 25000); + break; + case EVENT_EXPLODING_SHOT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 40.0f)) + me->CastSpell(target, SPELL_EXPLODING_SHOT, false); + events.ScheduleEvent(EVENT_EXPLODING_SHOT, 25000); + break; + case EVENT_MORTAL_STRIKE: + if (roll_chance_i(40)) + Talk(SAY_MORTAL); + me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); + events.ScheduleEvent(EVENT_MORTAL_STRIKE, 10000); + break; + case EVENT_FRIGHTENING_SHOUT: + if (roll_chance_i(40)) + Talk(SAY_SHOUT); + me->CastSpell(me, SPELL_FRIGHTENING_SHOUT, false); + events.ScheduleEvent(EVENT_FRIGHTENING_SHOUT, 25000); + break; + case EVENT_HAMSTRING: + me->CastSpell(me->GetVictim(), SPELL_HAMSTRING, false); + events.ScheduleEvent(EVENT_HAMSTRING, 25000); + break; + } DoMeleeAttackIfReady(); } - private: - EventMap events; - Movement::PointsArray pathPoints; + private: + EventMap events; + Movement::PointsArray pathPoints; }; }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp index bdfb0511c..abac9a596 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -10,18 +10,18 @@ REWRITTEN BY XINEF const Position instancePositions[INSTANCE_POSITIONS_COUNT] = { - {2188.18f, 228.90f, 53.025f, 1.77f}, // Orcs Gather Point 1 - {2103.23f, 93.55f, 53.096f, 3.78f}, // Orcs Gather Point 2 - {2128.43f, 71.01f, 64.42f, 1.74f} // Lieutenant Drake Summon Position + {2188.18f, 228.90f, 53.025f, 1.77f}, // Orcs Gather Point 1 + {2103.23f, 93.55f, 53.096f, 3.78f}, // Orcs Gather Point 2 + {2128.43f, 71.01f, 64.42f, 1.74f} // Lieutenant Drake Summon Position }; const Position thrallPositions[THRALL_POSITIONS_COUNT] = { - {2181.37f, 119.15f, 89.45f, 5.75f}, // After wearing armor - {2096.09f, 195.91f, 65.22f, 2.45f}, // After Fourth Ambush - {2062.9f, 229.93f, 64.454f, 2.45f}, // After Captain Skarloc death - {2486.91f, 626.356f, 58.0761f, 0.0f}, // Arrived at Tarren Mill - {2660.47f, 659.223f, 62.0f, 5.78f} // Taretha Met + {2181.37f, 119.15f, 89.45f, 5.75f}, // After wearing armor + {2096.09f, 195.91f, 65.22f, 2.45f}, // After Fourth Ambush + {2062.9f, 229.93f, 64.454f, 2.45f}, // After Captain Skarloc death + {2486.91f, 626.356f, 58.0761f, 0.0f}, // Arrived at Tarren Mill + {2660.47f, 659.223f, 62.0f, 5.78f} // Taretha Met }; @@ -42,42 +42,42 @@ public: void Initialize() { _encounterProgress = 0; - _barrelCount = 0; - _attemptsCount = 0; + _barrelCount = 0; + _attemptsCount = 0; - _thrallGUID = 0; - _tarethaGUID = 0; + _thrallGUID = 0; + _tarethaGUID = 0; - _initalFlamesSet.clear(); - _finalFlamesSet.clear(); - _prisonersSet.clear(); - _events.Reset(); + _initalFlamesSet.clear(); + _finalFlamesSet.clear(); + _prisonersSet.clear(); + _events.Reset(); } - void OnPlayerEnter(Player* player) - { - if (instance->GetPlayersCountExceptGMs() == 1) - CleanupInstance(); + void OnPlayerEnter(Player* player) + { + if (instance->GetPlayersCountExceptGMs() == 1) + CleanupInstance(); - EnsureGridLoaded(); + EnsureGridLoaded(); - if (_encounterProgress < ENCOUNTER_PROGRESS_BARRELS) - player->SendUpdateWorldState(WORLD_STATE_BARRELS_PLANTED, _barrelCount); - } + if (_encounterProgress < ENCOUNTER_PROGRESS_BARRELS) + player->SendUpdateWorldState(WORLD_STATE_BARRELS_PLANTED, _barrelCount); + } - void CleanupInstance() - { - if (_encounterProgress == ENCOUNTER_PROGRESS_NONE) - return; + void CleanupInstance() + { + if (_encounterProgress == ENCOUNTER_PROGRESS_NONE) + return; - _events.ScheduleEvent(EVENT_INITIAL_BARRELS_FLAME, 0); - _events.ScheduleEvent(EVENT_FINAL_BARRELS_FLAME, 0); + _events.ScheduleEvent(EVENT_INITIAL_BARRELS_FLAME, 0); + _events.ScheduleEvent(EVENT_FINAL_BARRELS_FLAME, 0); - if (_encounterProgress == ENCOUNTER_PROGRESS_BARRELS) - _events.ScheduleEvent(EVENT_SUMMON_LIEUTENANT, 0); - else - SetData(DATA_THRALL_REPOSITION, 2); - } + if (_encounterProgress == ENCOUNTER_PROGRESS_BARRELS) + _events.ScheduleEvent(EVENT_SUMMON_LIEUTENANT, 0); + else + SetData(DATA_THRALL_REPOSITION, 2); + } void OnCreatureCreate(Creature* creature) { @@ -85,207 +85,207 @@ public: { case NPC_THRALL: _thrallGUID = creature->GetGUID(); - if (_encounterProgress == ENCOUNTER_PROGRESS_FINISHED) - creature->SetVisible(false); - else - Reposition(creature); + if (_encounterProgress == ENCOUNTER_PROGRESS_FINISHED) + creature->SetVisible(false); + else + Reposition(creature); + break; + case NPC_ORC_PRISONER: + _prisonersSet.insert(creature->GetGUID()); + break; + case NPC_TARETHA: + if (_encounterProgress == ENCOUNTER_PROGRESS_FINISHED) + creature->SetVisible(false); + _tarethaGUID = creature->GetGUID(); break; - case NPC_ORC_PRISONER: - _prisonersSet.insert(creature->GetGUID()); - break; - case NPC_TARETHA: - if (_encounterProgress == ENCOUNTER_PROGRESS_FINISHED) - creature->SetVisible(false); - _tarethaGUID = creature->GetGUID(); - break; } } - void OnGameObjectCreate(GameObject* gameobject) - { - switch (gameobject->GetEntry()) - { - case GO_BARREL: - if (_encounterProgress >= ENCOUNTER_PROGRESS_BARRELS) - gameobject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case GO_PRISON_DOOR: - if (_encounterProgress >= ENCOUNTER_PROGRESS_THRALL_ARMORED) - gameobject->SetGoState(GO_STATE_ACTIVE); - break; - case GO_ROARING_FLAME: - // Xinef: hack in DB to distinguish final / initial flames - if (gameobject->GetPhaseMask() & 0x2) - _finalFlamesSet.insert(gameobject->GetGUID()); - else - _initalFlamesSet.insert(gameobject->GetGUID()); - break; - } - } + void OnGameObjectCreate(GameObject* gameobject) + { + switch (gameobject->GetEntry()) + { + case GO_BARREL: + if (_encounterProgress >= ENCOUNTER_PROGRESS_BARRELS) + gameobject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case GO_PRISON_DOOR: + if (_encounterProgress >= ENCOUNTER_PROGRESS_THRALL_ARMORED) + gameobject->SetGoState(GO_STATE_ACTIVE); + break; + case GO_ROARING_FLAME: + // Xinef: hack in DB to distinguish final / initial flames + if (gameobject->GetPhaseMask() & 0x2) + _finalFlamesSet.insert(gameobject->GetGUID()); + else + _initalFlamesSet.insert(gameobject->GetGUID()); + break; + } + } void SetData(uint32 type, uint32 data) { switch (type) { - case DATA_THRALL_REPOSITION: - if (data > 1) - _events.ScheduleEvent(EVENT_THRALL_REPOSITION, data == 2 ? 0 : 10000); - else if (Creature* thrall = instance->GetCreature(_thrallGUID)) - Reposition(thrall); - return; - case DATA_ESCORT_PROGRESS: - _encounterProgress = data; - SaveToDB(); - break; + case DATA_THRALL_REPOSITION: + if (data > 1) + _events.ScheduleEvent(EVENT_THRALL_REPOSITION, data == 2 ? 0 : 10000); + else if (Creature* thrall = instance->GetCreature(_thrallGUID)) + Reposition(thrall); + return; + case DATA_ESCORT_PROGRESS: + _encounterProgress = data; + SaveToDB(); + break; case DATA_BOMBS_PLACED: { - if (_barrelCount >= 5 || _encounterProgress > ENCOUNTER_PROGRESS_NONE) - return; + if (_barrelCount >= 5 || _encounterProgress > ENCOUNTER_PROGRESS_NONE) + return; DoUpdateWorldState(WORLD_STATE_BARRELS_PLANTED, ++_barrelCount); if (_barrelCount == 5) { - _events.ScheduleEvent(EVENT_INITIAL_BARRELS_FLAME, 4000); - _events.ScheduleEvent(EVENT_FINAL_BARRELS_FLAME, 12000); - _events.ScheduleEvent(EVENT_SUMMON_LIEUTENANT, 18000); + _events.ScheduleEvent(EVENT_INITIAL_BARRELS_FLAME, 4000); + _events.ScheduleEvent(EVENT_FINAL_BARRELS_FLAME, 12000); + _events.ScheduleEvent(EVENT_SUMMON_LIEUTENANT, 18000); } break; } - case DATA_THRALL_ADD_FLAG: - if (Creature* thrall = instance->GetCreature(_thrallGUID)) - thrall->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; + case DATA_THRALL_ADD_FLAG: + if (Creature* thrall = instance->GetCreature(_thrallGUID)) + thrall->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; } } uint32 GetData(uint32 data) const { - if (data == DATA_ESCORT_PROGRESS) - return _encounterProgress; - else if (data == DATA_ATTEMPTS_COUNT) - return _attemptsCount; + if (data == DATA_ESCORT_PROGRESS) + return _encounterProgress; + else if (data == DATA_ATTEMPTS_COUNT) + return _attemptsCount; return 0; } uint64 GetData64(uint32 data) const { - if (data == DATA_THRALL_GUID) - return _thrallGUID; - else if (data == DATA_TARETHA_GUID) - return _tarethaGUID; + if (data == DATA_THRALL_GUID) + return _thrallGUID; + else if (data == DATA_TARETHA_GUID) + return _tarethaGUID; return 0; } - void Update(uint32 diff) - { - _events.Update(diff); - switch (_events.ExecuteEvent()) - { - case EVENT_INITIAL_BARRELS_FLAME: - { - instance->LoadGrid(instancePositions[0].GetPositionX(), instancePositions[0].GetPositionY()); - instance->LoadGrid(instancePositions[1].GetPositionX(), instancePositions[1].GetPositionY()); + void Update(uint32 diff) + { + _events.Update(diff); + switch (_events.ExecuteEvent()) + { + case EVENT_INITIAL_BARRELS_FLAME: + { + instance->LoadGrid(instancePositions[0].GetPositionX(), instancePositions[0].GetPositionY()); + instance->LoadGrid(instancePositions[1].GetPositionX(), instancePositions[1].GetPositionY()); - for (std::set::const_iterator itr = _prisonersSet.begin(); itr != _prisonersSet.end(); ++itr) - if (Creature* orc = instance->GetCreature(*itr)) - { - uint8 index = orc->GetDistance(instancePositions[0]) < 80.0f ? 0 : 1; - Position pos(instancePositions[index]); - orc->MovePosition(pos, frand(1.0f, 3.0f) + 15.0f * (float)rand_norm(), (float)rand_norm() * static_cast(2 * M_PI)); - orc->GetMotionMaster()->MovePoint(1, pos); - orc->SetStandState(UNIT_STAND_STATE_STAND); - } + for (std::set::const_iterator itr = _prisonersSet.begin(); itr != _prisonersSet.end(); ++itr) + if (Creature* orc = instance->GetCreature(*itr)) + { + uint8 index = orc->GetDistance(instancePositions[0]) < 80.0f ? 0 : 1; + Position pos(instancePositions[index]); + orc->MovePosition(pos, frand(1.0f, 3.0f) + 15.0f * (float)rand_norm(), (float)rand_norm() * static_cast(2 * M_PI)); + orc->GetMotionMaster()->MovePoint(1, pos); + orc->SetStandState(UNIT_STAND_STATE_STAND); + } - for (std::set::const_iterator itr = _initalFlamesSet.begin(); itr != _initalFlamesSet.end(); ++itr) - if (GameObject* gobject = instance->GetGameObject(*itr)) - { - gobject->SetRespawnTime(0); - gobject->UpdateObjectVisibility(true); - } - break; - } - case EVENT_FINAL_BARRELS_FLAME: - { - instance->LoadGrid(instancePositions[0].GetPositionX(), instancePositions[0].GetPositionY()); - instance->LoadGrid(instancePositions[1].GetPositionX(), instancePositions[1].GetPositionY()); + for (std::set::const_iterator itr = _initalFlamesSet.begin(); itr != _initalFlamesSet.end(); ++itr) + if (GameObject* gobject = instance->GetGameObject(*itr)) + { + gobject->SetRespawnTime(0); + gobject->UpdateObjectVisibility(true); + } + break; + } + case EVENT_FINAL_BARRELS_FLAME: + { + instance->LoadGrid(instancePositions[0].GetPositionX(), instancePositions[0].GetPositionY()); + instance->LoadGrid(instancePositions[1].GetPositionX(), instancePositions[1].GetPositionY()); - if (_encounterProgress == ENCOUNTER_PROGRESS_NONE) - { - Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player* player = itr->GetSource()) - player->KilledMonsterCredit(NPC_LODGE_QUEST_TRIGGER, 0); - } + if (_encounterProgress == ENCOUNTER_PROGRESS_NONE) + { + Map::PlayerList const& players = instance->GetPlayers(); + if (!players.isEmpty()) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->GetSource()) + player->KilledMonsterCredit(NPC_LODGE_QUEST_TRIGGER, 0); + } - for (std::set::const_iterator itr = _finalFlamesSet.begin(); itr != _finalFlamesSet.end(); ++itr) - if (GameObject* gobject = instance->GetGameObject(*itr)) - { - gobject->SetRespawnTime(0); - gobject->UpdateObjectVisibility(true); - } + for (std::set::const_iterator itr = _finalFlamesSet.begin(); itr != _finalFlamesSet.end(); ++itr) + if (GameObject* gobject = instance->GetGameObject(*itr)) + { + gobject->SetRespawnTime(0); + gobject->UpdateObjectVisibility(true); + } - for (std::set::const_iterator itr = _prisonersSet.begin(); itr != _prisonersSet.end(); ++itr) - if (Creature* orc = instance->GetCreature(*itr)) - if (roll_chance_i(25)) - orc->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); - - SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_BARRELS); + for (std::set::const_iterator itr = _prisonersSet.begin(); itr != _prisonersSet.end(); ++itr) + if (Creature* orc = instance->GetCreature(*itr)) + if (roll_chance_i(25)) + orc->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); + + SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_BARRELS); DoUpdateWorldState(WORLD_STATE_BARRELS_PLANTED, 0); - break; - } - case EVENT_SUMMON_LIEUTENANT: - { - instance->LoadGrid(instancePositions[2].GetPositionX(), instancePositions[2].GetPositionY()); - if (Creature* drake = instance->SummonCreature(NPC_LIEUTENANT_DRAKE, instancePositions[2])) - drake->AI()->Talk(0); - } - case EVENT_THRALL_REPOSITION: - { - if (Creature* thrall = instance->GetCreature(_thrallGUID)) - { - if (!thrall->IsAlive()) - { - ++_attemptsCount; - EnsureGridLoaded(); - thrall->SetVisible(false); - Reposition(thrall); - thrall->setDeathState(DEAD); - thrall->Respawn(); - thrall->SetVisible(true); - SaveToDB(); - } - else - thrall->AI()->Reset(); - } - break; - } - } - } + break; + } + case EVENT_SUMMON_LIEUTENANT: + { + instance->LoadGrid(instancePositions[2].GetPositionX(), instancePositions[2].GetPositionY()); + if (Creature* drake = instance->SummonCreature(NPC_LIEUTENANT_DRAKE, instancePositions[2])) + drake->AI()->Talk(0); + } + case EVENT_THRALL_REPOSITION: + { + if (Creature* thrall = instance->GetCreature(_thrallGUID)) + { + if (!thrall->IsAlive()) + { + ++_attemptsCount; + EnsureGridLoaded(); + thrall->SetVisible(false); + Reposition(thrall); + thrall->setDeathState(DEAD); + thrall->Respawn(); + thrall->SetVisible(true); + SaveToDB(); + } + else + thrall->AI()->Reset(); + } + break; + } + } + } - void Reposition(Creature* thrall) - { - switch (uint32 data = GetData(DATA_ESCORT_PROGRESS)) - { - case ENCOUNTER_PROGRESS_THRALL_ARMORED: - case ENCOUNTER_PROGRESS_AMBUSHES_1: - case ENCOUNTER_PROGRESS_SKARLOC_KILLED: - case ENCOUNTER_PROGRESS_TARREN_MILL: - case ENCOUNTER_PROGRESS_TARETHA_MEET: - thrall->UpdatePosition(thrallPositions[data - ENCOUNTER_PROGRESS_THRALL_ARMORED], true); - thrall->SetHomePosition(thrallPositions[data - ENCOUNTER_PROGRESS_THRALL_ARMORED]); - thrall->SetFacingTo(thrallPositions[data - ENCOUNTER_PROGRESS_THRALL_ARMORED].GetOrientation()); - break; - } - } + void Reposition(Creature* thrall) + { + switch (uint32 data = GetData(DATA_ESCORT_PROGRESS)) + { + case ENCOUNTER_PROGRESS_THRALL_ARMORED: + case ENCOUNTER_PROGRESS_AMBUSHES_1: + case ENCOUNTER_PROGRESS_SKARLOC_KILLED: + case ENCOUNTER_PROGRESS_TARREN_MILL: + case ENCOUNTER_PROGRESS_TARETHA_MEET: + thrall->UpdatePosition(thrallPositions[data - ENCOUNTER_PROGRESS_THRALL_ARMORED], true); + thrall->SetHomePosition(thrallPositions[data - ENCOUNTER_PROGRESS_THRALL_ARMORED]); + thrall->SetFacingTo(thrallPositions[data - ENCOUNTER_PROGRESS_THRALL_ARMORED].GetOrientation()); + break; + } + } - void EnsureGridLoaded() - { - for (uint8 i = 0; i < THRALL_POSITIONS_COUNT; ++i) - instance->LoadGrid(thrallPositions[i].GetPositionX(), thrallPositions[i].GetPositionY()); - } + void EnsureGridLoaded() + { + for (uint8 i = 0; i < THRALL_POSITIONS_COUNT; ++i) + instance->LoadGrid(thrallPositions[i].GetPositionX(), thrallPositions[i].GetPositionY()); + } - std::string GetSaveData() + std::string GetSaveData() { OUT_SAVE_INST_DATA; @@ -323,18 +323,18 @@ public: OUT_LOAD_INST_DATA_COMPLETE; } - private: - uint32 _encounterProgress; - uint32 _barrelCount; - uint32 _attemptsCount; + private: + uint32 _encounterProgress; + uint32 _barrelCount; + uint32 _attemptsCount; - uint64 _thrallGUID; - uint64 _tarethaGUID; - std::set _initalFlamesSet; - std::set _finalFlamesSet; - std::set _prisonersSet; + uint64 _thrallGUID; + uint64 _tarethaGUID; + std::set _initalFlamesSet; + std::set _finalFlamesSet; + std::set _prisonersSet; - EventMap _events; + EventMap _events; }; }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index 61850bd9c..5f9ebd8a1 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -20,76 +20,76 @@ REWRITTEN BY XINEF */ enum Says { - SAY_START_EVENT_PART1 = 0, - SAY_ARMORY = 1, - SAY_SKARLOC_MEET = 2, - SAY_SKARLOC_TAUNT = 3, - SAY_START_EVENT_PART2 = 4, - SAY_MOUNTS_UP = 5, - SAY_CHURCH_END = 6, - SAY_MEET_TARETHA = 7, - SAY_EPOCH_WONDER = 8, - SAY_EPOCH_KILL_TARETHA = 9, - SAY_EVENT_COMPLETE = 10, - SAY_RANDOM_LOW_HP = 11, - SAY_RANDOM_DIE = 12, - SAY_RANDOM_AGGRO = 13, - SAY_RANDOM_KILL = 14, - SAY_LEAVE_COMBAT = 15, - SAY_KILL_ARMORER = 16, - SAY_GO_ARMORED = 17, - SAY_ENTER_CHURCH = 18, - SAY_GREET_TARETHA = 19, - SAY_CHAT_TARETHA1 = 20, + SAY_START_EVENT_PART1 = 0, + SAY_ARMORY = 1, + SAY_SKARLOC_MEET = 2, + SAY_SKARLOC_TAUNT = 3, + SAY_START_EVENT_PART2 = 4, + SAY_MOUNTS_UP = 5, + SAY_CHURCH_END = 6, + SAY_MEET_TARETHA = 7, + SAY_EPOCH_WONDER = 8, + SAY_EPOCH_KILL_TARETHA = 9, + SAY_EVENT_COMPLETE = 10, + SAY_RANDOM_LOW_HP = 11, + SAY_RANDOM_DIE = 12, + SAY_RANDOM_AGGRO = 13, + SAY_RANDOM_KILL = 14, + SAY_LEAVE_COMBAT = 15, + SAY_KILL_ARMORER = 16, + SAY_GO_ARMORED = 17, + SAY_ENTER_CHURCH = 18, + SAY_GREET_TARETHA = 19, + SAY_CHAT_TARETHA1 = 20, - SAY_TARETHA_FREE = 0, - SAY_TARETHA_ESCAPED = 1, - SAY_TARETHA_TALK1 = 2, - SAY_TARETHA_TALK2 = 3, + SAY_TARETHA_FREE = 0, + SAY_TARETHA_ESCAPED = 1, + SAY_TARETHA_TALK1 = 2, + SAY_TARETHA_TALK2 = 3, - SAY_ARMORER_THRALL = 0, + SAY_ARMORER_THRALL = 0, - SAY_LOOKOUT_SAW = 0, - SAY_LOOKOUT_GO = 1, - SAY_LOOKOUT_CHURCH = 2, - SAY_LOOKOUT_INN = 3, + SAY_LOOKOUT_SAW = 0, + SAY_LOOKOUT_GO = 1, + SAY_LOOKOUT_CHURCH = 2, + SAY_LOOKOUT_INN = 3, - SAY_EPOCH_ENTER1 = 0, - SAY_EPOCH_ENTER2 = 1, - SAY_EPOCH_ENTER3 = 2, + SAY_EPOCH_ENTER1 = 0, + SAY_EPOCH_ENTER2 = 1, + SAY_EPOCH_ENTER3 = 2, - SAY_EROZION_1 = 0, - SAY_EROZION_2 = 1, - SAY_EROZION_3 = 2, + SAY_EROZION_1 = 0, + SAY_EROZION_2 = 1, + SAY_EROZION_3 = 2, }; enum Spells { SPELL_STRIKE = 14516, SPELL_SHIELD_BLOCK = 12169, - SPELL_SUMMON_EROZION_IMAGE = 33954, + SPELL_SUMMON_EROZION_IMAGE = 33954, - SPELL_SHADOW_PRISON = 33071, - SPELL_SHADOW_SPIKE = 33125, + SPELL_SHADOW_PRISON = 33071, + SPELL_SHADOW_SPIKE = 33125, - SPELL_TELEPORT = 34776, - SPELL_MEMORY_WIPE = 33336, - SPELL_MEMORY_WIPE_RESUME = 33337 + SPELL_TELEPORT = 34776, + SPELL_MEMORY_WIPE = 33336, + SPELL_MEMORY_WIPE_RESUME = 33337 }; enum Npcs { - NPC_TM_GUARDSMAN = 18092, - NPC_TM_PROTECTOR = 18093, - NPC_TM_LOOKOUT = 18094, + NPC_TM_GUARDSMAN = 18092, + NPC_TM_PROTECTOR = 18093, + NPC_TM_LOOKOUT = 18094, - NPC_EPOCH_GUARDSMAN = 23175, - NPC_EPOCH_PROTECTOR = 23179, - NPC_EPOCH_LOOKOUT = 23177, + NPC_EPOCH_GUARDSMAN = 23175, + NPC_EPOCH_PROTECTOR = 23179, + NPC_EPOCH_LOOKOUT = 23177, - NPC_INFINITE_DEFILER = 18171, - NPC_INFINITE_SABOTEUR = 18172, - NPC_INFINITE_SLAYER = 18170 + NPC_INFINITE_DEFILER = 18171, + NPC_INFINITE_SABOTEUR = 18172, + NPC_INFINITE_SLAYER = 18170 }; enum Misc @@ -99,81 +99,81 @@ enum Misc THRALL_MODEL_UNEQUIPPED = 17292, THRALL_MODEL_EQUIPPED = 18165, - ACTION_SET_IMMUNE_FLAG = 1, - ACTION_REMOVE_IMMUNE_FLAG = 2, - ACTION_TRANSFORM = 3, - ACTION_MOVE = 4, - ACTION_START_COMBAT = 5 + ACTION_SET_IMMUNE_FLAG = 1, + ACTION_REMOVE_IMMUNE_FLAG = 2, + ACTION_TRANSFORM = 3, + ACTION_MOVE = 4, + ACTION_START_COMBAT = 5 }; -#define SPEED_RUNNING 1.0f -#define SPEED_MOUNTED 1.6f +#define SPEED_RUNNING 1.0f +#define SPEED_MOUNTED 1.6f enum Events { - // Combat - EVENT_CHECK_HEALTH = 1, - EVENT_SPELL_STRIKE = 2, - EVENT_SPELL_SHIELD_BLOCK = 3, + // Combat + EVENT_CHECK_HEALTH = 1, + EVENT_SPELL_STRIKE = 2, + EVENT_SPELL_SHIELD_BLOCK = 3, - EVENT_OPEN_DOORS = 6, - EVENT_START_WP = 7, + EVENT_OPEN_DOORS = 6, + EVENT_START_WP = 7, - EVENT_SET_FACING = 9, - EVENT_KILL_ARMORER = 10, - EVENT_TALK_KILL_ARMORER = 11, - - EVENT_DRESSING_KNEEL = 20, - EVENT_DRESSING_ARMOR = 21, - EVENT_DRESSING_STAND = 22, - EVENT_DRESSING_AXE = 23, - EVENT_DRESSING_SHIELD = 24, - EVENT_DRESSING_TALK = 25, + EVENT_SET_FACING = 9, + EVENT_KILL_ARMORER = 10, + EVENT_TALK_KILL_ARMORER = 11, + + EVENT_DRESSING_KNEEL = 20, + EVENT_DRESSING_ARMOR = 21, + EVENT_DRESSING_STAND = 22, + EVENT_DRESSING_AXE = 23, + EVENT_DRESSING_SHIELD = 24, + EVENT_DRESSING_TALK = 25, - EVENT_ENTER_MOUNT = 30, - EVENT_TALK_START_RIDE = 31, + EVENT_ENTER_MOUNT = 30, + EVENT_TALK_START_RIDE = 31, - EVENT_LOOK_1 = 40, - EVENT_MOVE_AROUND = 41, - EVENT_LOOK_2 = 42, - EVENT_LOOK_3 = 43, - EVENT_SUMMON_GUARDS = 44, - EVENT_SUMMON_TALK1 = 45, - EVENT_SUMMON_TALK2 = 46, + EVENT_LOOK_1 = 40, + EVENT_MOVE_AROUND = 41, + EVENT_LOOK_2 = 42, + EVENT_LOOK_3 = 43, + EVENT_SUMMON_GUARDS = 44, + EVENT_SUMMON_TALK1 = 45, + EVENT_SUMMON_TALK2 = 46, - EVENT_LOOK_4 = 50, - EVENT_SUMMON_GUARDS_2 = 51, - EVENT_SUMMON_TALK3 = 52, + EVENT_LOOK_4 = 50, + EVENT_SUMMON_GUARDS_2 = 51, + EVENT_SUMMON_TALK3 = 52, - EVENT_THRALL_TALK = 60, - EVENT_SUMMON_CHRONO = 61, - EVENT_THRALL_TALK_2 = 62, - EVENT_TARETHA_FALL = 63, - EVENT_THRALL_TALK_3 = 64, - EVENT_THRALL_MOVE_DOWN = 65, + EVENT_THRALL_TALK = 60, + EVENT_SUMMON_CHRONO = 61, + EVENT_THRALL_TALK_2 = 62, + EVENT_TARETHA_FALL = 63, + EVENT_THRALL_TALK_3 = 64, + EVENT_THRALL_MOVE_DOWN = 65, - EVENT_EPOCH_INTRO = 70, - EVENT_SUMMON_INFINITES = 71, - EVENT_TRANSFORM = 72, - EVENT_START_WAVE_1 = 73, - EVENT_CHECK_WAVE_1 = 74, - EVENT_CHECK_WAVE_2 = 75, - EVENT_CHECK_WAVE_3 = 76, - EVENT_CALL_EPOCH = 77, + EVENT_EPOCH_INTRO = 70, + EVENT_SUMMON_INFINITES = 71, + EVENT_TRANSFORM = 72, + EVENT_START_WAVE_1 = 73, + EVENT_CHECK_WAVE_1 = 74, + EVENT_CHECK_WAVE_2 = 75, + EVENT_CHECK_WAVE_3 = 76, + EVENT_CALL_EPOCH = 77, - EVENT_THRALL_FACE_TARETHA = 80, - EVENT_THRALL_TALK_4 = 81, - EVENT_TARETHA_TALK_1 = 82, - EVENT_THRALL_TALK_5 = 83, - EVENT_SUMMON_EROZION = 84, - EVENT_EROZION_TALK_1 = 85, - EVENT_EROZION_ACTION_1 = 86, - EVENT_EROZION_TALK_2 = 87, - EVENT_EROZION_ACTION_2 = 88, - EVENT_EROZION_TALK_3 = 89, - EVENT_THRALL_TALK_6 = 90, - EVENT_THRALL_RUN_AWAY = 91, - EVENT_TARETHA_TALK_2 = 92 + EVENT_THRALL_FACE_TARETHA = 80, + EVENT_THRALL_TALK_4 = 81, + EVENT_TARETHA_TALK_1 = 82, + EVENT_THRALL_TALK_5 = 83, + EVENT_SUMMON_EROZION = 84, + EVENT_EROZION_TALK_1 = 85, + EVENT_EROZION_ACTION_1 = 86, + EVENT_EROZION_TALK_2 = 87, + EVENT_EROZION_ACTION_2 = 88, + EVENT_EROZION_TALK_3 = 89, + EVENT_THRALL_TALK_6 = 90, + EVENT_THRALL_RUN_AWAY = 91, + EVENT_TARETHA_TALK_2 = 92 }; @@ -187,37 +187,37 @@ public: return GetInstanceAI(creature); } - bool OnGossipHello(Player* player, Creature* creature) - { - InstanceScript* instance = creature->GetInstanceScript(); - if (!instance) - return true; + bool OnGossipHello(Player* player, Creature* creature) + { + InstanceScript* instance = creature->GetInstanceScript(); + if (!instance) + return true; - uint32 menuId = creature->GetCreatureTemplate()->GossipMenuId; - if (instance->GetData(DATA_ESCORT_PROGRESS) == ENCOUNTER_PROGRESS_SKARLOC_KILLED) - menuId = 7830; - else if (instance->GetData(DATA_ESCORT_PROGRESS) == ENCOUNTER_PROGRESS_TARREN_MILL) - menuId = 7840; - else if (instance->GetData(DATA_ESCORT_PROGRESS) == ENCOUNTER_PROGRESS_TARETHA_MEET) - menuId = 7853; + uint32 menuId = creature->GetCreatureTemplate()->GossipMenuId; + if (instance->GetData(DATA_ESCORT_PROGRESS) == ENCOUNTER_PROGRESS_SKARLOC_KILLED) + menuId = 7830; + else if (instance->GetData(DATA_ESCORT_PROGRESS) == ENCOUNTER_PROGRESS_TARREN_MILL) + menuId = 7840; + else if (instance->GetData(DATA_ESCORT_PROGRESS) == ENCOUNTER_PROGRESS_TARETHA_MEET) + menuId = 7853; - player->PrepareGossipMenu(creature, menuId, true); + player->PrepareGossipMenu(creature, menuId, true); player->SendPreparedGossip(creature); - return true; - } + return true; + } bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { - GossipMenuItemData const* gossipMenuItemData = player->PlayerTalkClass->GetGossipMenu().GetItemData(0); + GossipMenuItemData const* gossipMenuItemData = player->PlayerTalkClass->GetGossipMenu().GetItemData(0); InstanceScript* instance = creature->GetInstanceScript(); - if (!instance || (gossipMenuItemData && gossipMenuItemData->GossipActionMenuId != 0)) - return false; + if (!instance || (gossipMenuItemData && gossipMenuItemData->GossipActionMenuId != 0)) + return false; player->PlayerTalkClass->ClearMenus(); - player->CLOSE_GOSSIP_MENU(); + player->CLOSE_GOSSIP_MENU(); - creature->AI()->DoAction(instance->GetData(DATA_ESCORT_PROGRESS)); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); + creature->AI()->DoAction(instance->GetData(DATA_ESCORT_PROGRESS)); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); return true; } @@ -228,78 +228,78 @@ public: instance = creature->GetInstanceScript(); } - void DoAction(int32 param) - { - switch (param) - { - case ENCOUNTER_PROGRESS_DRAKE_KILLED: - events.ScheduleEvent(EVENT_OPEN_DOORS, 0); - events.ScheduleEvent(EVENT_START_WP, 3000); - break; - case ENCOUNTER_PROGRESS_THRALL_ARMORED: - case ENCOUNTER_PROGRESS_AMBUSHES_1: - case ENCOUNTER_PROGRESS_SKARLOC_KILLED: - case ENCOUNTER_PROGRESS_TARREN_MILL: - SetEscortPaused(false); - break; - case ENCOUNTER_PROGRESS_TARETHA_MEET: - events.ScheduleEvent(EVENT_SUMMON_CHRONO, 0); - events.ScheduleEvent(EVENT_THRALL_TALK_2, 6000); - events.ScheduleEvent(EVENT_TARETHA_FALL, 11000); - events.ScheduleEvent(EVENT_THRALL_TALK_3, 14000); - events.ScheduleEvent(EVENT_THRALL_MOVE_DOWN, 17000); - break; - case NPC_TARETHA: - events.ScheduleEvent(EVENT_THRALL_FACE_TARETHA, 0); - events.ScheduleEvent(EVENT_THRALL_TALK_4, 4000); - events.ScheduleEvent(EVENT_TARETHA_TALK_1, 13000); - events.ScheduleEvent(EVENT_THRALL_TALK_5, 17000); - events.ScheduleEvent(EVENT_SUMMON_EROZION, 17500); - events.ScheduleEvent(EVENT_EROZION_TALK_1, 18000); - events.ScheduleEvent(EVENT_EROZION_ACTION_1, 26000); - events.ScheduleEvent(EVENT_EROZION_TALK_2, 29000); - events.ScheduleEvent(EVENT_EROZION_TALK_3, 42000); - events.ScheduleEvent(EVENT_EROZION_ACTION_2, 47000); - events.ScheduleEvent(EVENT_THRALL_TALK_6, 48000); - events.ScheduleEvent(EVENT_THRALL_RUN_AWAY, 51000); - events.ScheduleEvent(EVENT_TARETHA_TALK_2, 53000); - break; - } - } + void DoAction(int32 param) + { + switch (param) + { + case ENCOUNTER_PROGRESS_DRAKE_KILLED: + events.ScheduleEvent(EVENT_OPEN_DOORS, 0); + events.ScheduleEvent(EVENT_START_WP, 3000); + break; + case ENCOUNTER_PROGRESS_THRALL_ARMORED: + case ENCOUNTER_PROGRESS_AMBUSHES_1: + case ENCOUNTER_PROGRESS_SKARLOC_KILLED: + case ENCOUNTER_PROGRESS_TARREN_MILL: + SetEscortPaused(false); + break; + case ENCOUNTER_PROGRESS_TARETHA_MEET: + events.ScheduleEvent(EVENT_SUMMON_CHRONO, 0); + events.ScheduleEvent(EVENT_THRALL_TALK_2, 6000); + events.ScheduleEvent(EVENT_TARETHA_FALL, 11000); + events.ScheduleEvent(EVENT_THRALL_TALK_3, 14000); + events.ScheduleEvent(EVENT_THRALL_MOVE_DOWN, 17000); + break; + case NPC_TARETHA: + events.ScheduleEvent(EVENT_THRALL_FACE_TARETHA, 0); + events.ScheduleEvent(EVENT_THRALL_TALK_4, 4000); + events.ScheduleEvent(EVENT_TARETHA_TALK_1, 13000); + events.ScheduleEvent(EVENT_THRALL_TALK_5, 17000); + events.ScheduleEvent(EVENT_SUMMON_EROZION, 17500); + events.ScheduleEvent(EVENT_EROZION_TALK_1, 18000); + events.ScheduleEvent(EVENT_EROZION_ACTION_1, 26000); + events.ScheduleEvent(EVENT_EROZION_TALK_2, 29000); + events.ScheduleEvent(EVENT_EROZION_TALK_3, 42000); + events.ScheduleEvent(EVENT_EROZION_ACTION_2, 47000); + events.ScheduleEvent(EVENT_THRALL_TALK_6, 48000); + events.ScheduleEvent(EVENT_THRALL_RUN_AWAY, 51000); + events.ScheduleEvent(EVENT_TARETHA_TALK_2, 53000); + break; + } + } - void WaypointStart(uint32 waypointId) - { - switch (waypointId) - { - case 30: - Talk(SAY_START_EVENT_PART2); - break; - } - } + void WaypointStart(uint32 waypointId) + { + switch (waypointId) + { + case 30: + Talk(SAY_START_EVENT_PART2); + break; + } + } void WaypointReached(uint32 waypointId) { switch (waypointId) { - case 0: - Talk(SAY_START_EVENT_PART1); - break; + case 0: + Talk(SAY_START_EVENT_PART1); + break; case 8: - events.ScheduleEvent(EVENT_SET_FACING, 500); + events.ScheduleEvent(EVENT_SET_FACING, 500); break; case 9: - SetRun(false); - events.ScheduleEvent(EVENT_KILL_ARMORER, 500); - events.ScheduleEvent(EVENT_TALK_KILL_ARMORER, 4000); + SetRun(false); + events.ScheduleEvent(EVENT_KILL_ARMORER, 500); + events.ScheduleEvent(EVENT_TALK_KILL_ARMORER, 4000); break; case 10: - SetRun(true); - events.ScheduleEvent(EVENT_DRESSING_KNEEL, 500); - events.ScheduleEvent(EVENT_DRESSING_ARMOR, 3000); - events.ScheduleEvent(EVENT_DRESSING_STAND, 4000); - events.ScheduleEvent(EVENT_DRESSING_AXE, 7000); - events.ScheduleEvent(EVENT_DRESSING_SHIELD, 9000); - events.ScheduleEvent(EVENT_DRESSING_TALK, 12000); + SetRun(true); + events.ScheduleEvent(EVENT_DRESSING_KNEEL, 500); + events.ScheduleEvent(EVENT_DRESSING_ARMOR, 3000); + events.ScheduleEvent(EVENT_DRESSING_STAND, 4000); + events.ScheduleEvent(EVENT_DRESSING_AXE, 7000); + events.ScheduleEvent(EVENT_DRESSING_SHIELD, 9000); + events.ScheduleEvent(EVENT_DRESSING_TALK, 12000); break; case 13: me->SummonCreature(NPC_DURNHOLDE_SENTRY, 2200.28f, 137.37f, 87.93f, 5.07f, TEMPSUMMON_MANUAL_DESPAWN); @@ -325,22 +325,22 @@ public: me->SummonCreature(NPC_DURNHOLDE_MAGE, 2107.74f, 192.59f, 66.23f, 5.56f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_DURNHOLDE_SENTRY, 2112.26f, 195.13f, 66.23f, 5.56f, TEMPSUMMON_MANUAL_DESPAWN); break; - case 27: - instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_AMBUSHES_1); - break; - case 28: + case 27: + instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_AMBUSHES_1); + break; + case 28: me->SummonCreature(NPC_CAPTAIN_SKARLOC, 1995.78f, 277.46f, 66.64f, 0.74f, TEMPSUMMON_MANUAL_DESPAWN); - break; - case 29: - SetEscortPaused(true); + break; + case 29: + SetEscortPaused(true); Talk(SAY_SKARLOC_MEET); break; case 30: - events.ScheduleEvent(EVENT_ENTER_MOUNT, 3000); - events.ScheduleEvent(EVENT_TALK_START_RIDE, 7000); + events.ScheduleEvent(EVENT_ENTER_MOUNT, 3000); + events.ScheduleEvent(EVENT_TALK_START_RIDE, 7000); break; case 59: - instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_TARREN_MILL); + instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_TARREN_MILL); me->SummonCreature(NPC_SKARLOC_MOUNT, 2488.64f, 625.77f, 58.26f, 4.71f, TEMPSUMMON_TIMED_DESPAWN, 7000); UnMountSelf(); _mounted = false; @@ -348,61 +348,61 @@ public: break; case 60: me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - if (Creature* horse = me->FindNearestCreature(NPC_SKARLOC_MOUNT, 10.0f)) - horse->GetMotionMaster()->MovePoint(0, 2501.15f, 572.14f, 54.13f); + if (Creature* horse = me->FindNearestCreature(NPC_SKARLOC_MOUNT, 10.0f)) + horse->GetMotionMaster()->MovePoint(0, 2501.15f, 572.14f, 54.13f); SetEscortPaused(true); - SetRun(true); + SetRun(true); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); break; case 64: SetRun(false); break; - case 67: - events.ScheduleEvent(EVENT_LOOK_1, 500); - events.ScheduleEvent(EVENT_MOVE_AROUND, 3500); - events.ScheduleEvent(EVENT_LOOK_2, 5000); - events.ScheduleEvent(EVENT_LOOK_3, 6700); - events.ScheduleEvent(EVENT_SUMMON_GUARDS, 6000); - events.ScheduleEvent(EVENT_SUMMON_TALK1, 6500); - events.ScheduleEvent(EVENT_SUMMON_TALK2, 12000); - break; - case 82: - events.ScheduleEvent(EVENT_LOOK_4, 500); - events.ScheduleEvent(EVENT_SUMMON_GUARDS_2, 1000); - events.ScheduleEvent(EVENT_SUMMON_TALK3, 1500); - break; + case 67: + events.ScheduleEvent(EVENT_LOOK_1, 500); + events.ScheduleEvent(EVENT_MOVE_AROUND, 3500); + events.ScheduleEvent(EVENT_LOOK_2, 5000); + events.ScheduleEvent(EVENT_LOOK_3, 6700); + events.ScheduleEvent(EVENT_SUMMON_GUARDS, 6000); + events.ScheduleEvent(EVENT_SUMMON_TALK1, 6500); + events.ScheduleEvent(EVENT_SUMMON_TALK2, 12000); + break; + case 82: + events.ScheduleEvent(EVENT_LOOK_4, 500); + events.ScheduleEvent(EVENT_SUMMON_GUARDS_2, 1000); + events.ScheduleEvent(EVENT_SUMMON_TALK3, 1500); + break; case 91: me->SummonCreature(NPC_TM_PROTECTOR, 2652.71f, 660.31f, 61.93f, 1.67f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_TM_LOOKOUT, 2648.96f, 662.59f, 61.93f, 0.79f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_TM_GUARDSMAN, 2657.36f, 662.34f, 61.93f, 2.68f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_TM_GUARDSMAN, 2656.39f, 659.77f, 61.93f, 2.61f, TEMPSUMMON_MANUAL_DESPAWN); - if (Creature* summon = summons.GetCreatureWithEntry(NPC_TM_LOOKOUT)) - summon->AI()->Talk(SAY_LOOKOUT_INN); + if (Creature* summon = summons.GetCreatureWithEntry(NPC_TM_LOOKOUT)) + summon->AI()->Talk(SAY_LOOKOUT_INN); + break; + case 92: + SetRun(false); break; - case 92: - SetRun(false); - break; case 94: - summons.DespawnAll(); - SetEscortPaused(true); - SetRun(true); - instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_TARETHA_MEET); + summons.DespawnAll(); + SetEscortPaused(true); + SetRun(true); + instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_TARETHA_MEET); if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA_GUID))) Taretha->AI()->Talk(SAY_TARETHA_ESCAPED); - events.ScheduleEvent(EVENT_THRALL_TALK, 2000); + events.ScheduleEvent(EVENT_THRALL_TALK, 2000); + break; + case 101: + SetEscortPaused(true); + events.ScheduleEvent(EVENT_EPOCH_INTRO, 500); + events.ScheduleEvent(EVENT_SUMMON_INFINITES, 1500); + events.ScheduleEvent(EVENT_TRANSFORM, 8000); + events.ScheduleEvent(EVENT_START_WAVE_1, 25000); break; - case 101: - SetEscortPaused(true); - events.ScheduleEvent(EVENT_EPOCH_INTRO, 500); - events.ScheduleEvent(EVENT_SUMMON_INFINITES, 1500); - events.ScheduleEvent(EVENT_TRANSFORM, 8000); - events.ScheduleEvent(EVENT_START_WAVE_1, 25000); - break; case 103: - if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) - erozion->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_FINISHED); + if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) + erozion->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_FINISHED); me->SetVisible(false); break; } @@ -420,48 +420,48 @@ public: me->SetSpeed(MOVE_RUN, SPEED_RUNNING); } - void MovementInform(uint32 type, uint32 point) - { - npc_escortAI::MovementInform(type, point); - if (type == POINT_MOTION_TYPE && point == 0xFFFFFF /*POINT_LAST_POINT*/) - { - if (roll_chance_i(30)) - Talk(SAY_LEAVE_COMBAT); - if (_mounted) - MountSelf(); - } - } + void MovementInform(uint32 type, uint32 point) + { + npc_escortAI::MovementInform(type, point); + if (type == POINT_MOTION_TYPE && point == 0xFFFFFF /*POINT_LAST_POINT*/) + { + if (roll_chance_i(30)) + Talk(SAY_LEAVE_COMBAT); + if (_mounted) + MountSelf(); + } + } - void EnterCombat(Unit*) - { - combatEvents.Reset(); - combatEvents.ScheduleEvent(EVENT_CHECK_HEALTH, 500); - combatEvents.ScheduleEvent(EVENT_SPELL_SHIELD_BLOCK, 8000); - combatEvents.ScheduleEvent(EVENT_SPELL_STRIKE, 2000); + void EnterCombat(Unit*) + { + combatEvents.Reset(); + combatEvents.ScheduleEvent(EVENT_CHECK_HEALTH, 500); + combatEvents.ScheduleEvent(EVENT_SPELL_SHIELD_BLOCK, 8000); + combatEvents.ScheduleEvent(EVENT_SPELL_STRIKE, 2000); - if (roll_chance_i(50)) - Talk(SAY_RANDOM_AGGRO); + if (roll_chance_i(50)) + Talk(SAY_RANDOM_AGGRO); - if (me->IsMounted()) - { - _mounted = true; - UnMountSelf(); - } - } + if (me->IsMounted()) + { + _mounted = true; + UnMountSelf(); + } + } - void Reset() + void Reset() { _mounted = false; events.Reset(); - combatEvents.Reset(); - summons.DespawnAll(); + combatEvents.Reset(); + summons.DespawnAll(); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); - instance->SetData(DATA_THRALL_REPOSITION, 1); - - uint32 data = instance->GetData(DATA_ESCORT_PROGRESS); - if (data >= ENCOUNTER_PROGRESS_THRALL_ARMORED) - ReorderInstance(data); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); + instance->SetData(DATA_THRALL_REPOSITION, 1); + + uint32 data = instance->GetData(DATA_ESCORT_PROGRESS); + if (data >= ENCOUNTER_PROGRESS_THRALL_ARMORED) + ReorderInstance(data); } void KilledUnit(Unit*) @@ -469,377 +469,377 @@ public: Talk(SAY_RANDOM_KILL); } - void JustSummoned(Creature* summon) - { - if (summon->GetEntry() == NPC_INFINITE_SLAYER || summon->GetEntry() == NPC_INFINITE_SABOTEUR || summon->GetEntry() == NPC_INFINITE_DEFILER) - summon->GetMotionMaster()->MovePoint(10, 2634.25f, 672.01f, 54.445f); + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() == NPC_INFINITE_SLAYER || summon->GetEntry() == NPC_INFINITE_SABOTEUR || summon->GetEntry() == NPC_INFINITE_DEFILER) + summon->GetMotionMaster()->MovePoint(10, 2634.25f, 672.01f, 54.445f); - summons.Summon(summon); - } - void SummonedCreatureDespawn(Creature* summon) { summons.Despawn(summon); } - void SummonedCreatureDies(Creature* summon, Unit*) { summons.Despawn(summon); } + summons.Summon(summon); + } + void SummonedCreatureDespawn(Creature* summon) { summons.Despawn(summon); } + void SummonedCreatureDies(Creature* summon, Unit*) { summons.Despawn(summon); } void JustDied(Unit* killer) { if (killer == me) return; - summons.DespawnAll(); + summons.DespawnAll(); Talk(SAY_RANDOM_DIE); - RemoveEscortState(STATE_ESCORT_ESCORTING); - instance->SetData(DATA_THRALL_REPOSITION, 3); - if (instance->GetData(DATA_ATTEMPTS_COUNT) < 20) - me->CastSpell(me, SPELL_SUMMON_EROZION_IMAGE, true); - else - me->SetRespawnTime(DAY); + RemoveEscortState(STATE_ESCORT_ESCORTING); + instance->SetData(DATA_THRALL_REPOSITION, 3); + if (instance->GetData(DATA_ATTEMPTS_COUNT) < 20) + me->CastSpell(me, SPELL_SUMMON_EROZION_IMAGE, true); + else + me->SetRespawnTime(DAY); } - void UpdateAI(uint32 diff) - { - npc_escortAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + npc_escortAI::UpdateAI(diff); - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_OPEN_DOORS: - if (GameObject* doors = me->FindNearestGameObject(GO_PRISON_DOOR, 10.0f)) - doors->SetGoState(GO_STATE_ACTIVE); - break; - case EVENT_START_WP: - Start(true, true); - SetDespawnAtEnd(false); - break; - case EVENT_SET_FACING: - if (Creature* armorer = me->FindNearestCreature(NPC_DURNHOLDE_ARMORER, 30.0f)) - { - armorer->AI()->Talk(SAY_ARMORER_THRALL); - armorer->SetFacingToObject(me); - me->SetFacingToObject(armorer); - } - break; - case EVENT_KILL_ARMORER: - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK_UNARMED); - if (Creature* armorer = me->FindNearestCreature(NPC_DURNHOLDE_ARMORER, 30.0f)) - armorer->SetStandState(UNIT_STAND_STATE_DEAD); - break; - case EVENT_TALK_KILL_ARMORER: - Talk(SAY_KILL_ARMORER); - break; - case EVENT_DRESSING_KNEEL: - me->SetFacingTo(2.61f); - Talk(SAY_ARMORY); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - break; - case EVENT_DRESSING_ARMOR: - me->SetDisplayId(THRALL_MODEL_EQUIPPED); - break; - case EVENT_DRESSING_STAND: - me->SetStandState(UNIT_STAND_STATE_STAND); - break; - case EVENT_DRESSING_AXE: - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_ITEM); - break; - case EVENT_DRESSING_SHIELD: + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_OPEN_DOORS: + if (GameObject* doors = me->FindNearestGameObject(GO_PRISON_DOOR, 10.0f)) + doors->SetGoState(GO_STATE_ACTIVE); + break; + case EVENT_START_WP: + Start(true, true); + SetDespawnAtEnd(false); + break; + case EVENT_SET_FACING: + if (Creature* armorer = me->FindNearestCreature(NPC_DURNHOLDE_ARMORER, 30.0f)) + { + armorer->AI()->Talk(SAY_ARMORER_THRALL); + armorer->SetFacingToObject(me); + me->SetFacingToObject(armorer); + } + break; + case EVENT_KILL_ARMORER: + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK_UNARMED); + if (Creature* armorer = me->FindNearestCreature(NPC_DURNHOLDE_ARMORER, 30.0f)) + armorer->SetStandState(UNIT_STAND_STATE_DEAD); + break; + case EVENT_TALK_KILL_ARMORER: + Talk(SAY_KILL_ARMORER); + break; + case EVENT_DRESSING_KNEEL: + me->SetFacingTo(2.61f); + Talk(SAY_ARMORY); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + break; + case EVENT_DRESSING_ARMOR: + me->SetDisplayId(THRALL_MODEL_EQUIPPED); + break; + case EVENT_DRESSING_STAND: + me->SetStandState(UNIT_STAND_STATE_STAND); + break; + case EVENT_DRESSING_AXE: + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_ITEM); + break; + case EVENT_DRESSING_SHIELD: me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, THRALL_SHIELD_ITEM); - break; - case EVENT_DRESSING_TALK: - instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_THRALL_ARMORED); - Talk(SAY_GO_ARMORED); - break; - case EVENT_ENTER_MOUNT: - MountSelf(); - if (Creature* mount = me->FindNearestCreature(NPC_SKARLOC_MOUNT, 10.0f)) - { - me->SetFacingTo(mount->GetOrientation()); - mount->DespawnOrUnsummon(); - } - break; - case EVENT_TALK_START_RIDE: - Talk(SAY_MOUNTS_UP); - break; - case EVENT_LOOK_1: - me->SetFacingTo(5.058f); - break; - case EVENT_MOVE_AROUND: - me->GetMotionMaster()->MovePoint(0, 2477.146f, 695.041f, 55.801f); - break; - case EVENT_LOOK_2: - me->SetFacingTo(2.297f); - break; - case EVENT_LOOK_3: - me->SetFacingTo(0.64f); - break; - case EVENT_SUMMON_GUARDS: - SetRun(true); + break; + case EVENT_DRESSING_TALK: + instance->SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_THRALL_ARMORED); + Talk(SAY_GO_ARMORED); + break; + case EVENT_ENTER_MOUNT: + MountSelf(); + if (Creature* mount = me->FindNearestCreature(NPC_SKARLOC_MOUNT, 10.0f)) + { + me->SetFacingTo(mount->GetOrientation()); + mount->DespawnOrUnsummon(); + } + break; + case EVENT_TALK_START_RIDE: + Talk(SAY_MOUNTS_UP); + break; + case EVENT_LOOK_1: + me->SetFacingTo(5.058f); + break; + case EVENT_MOVE_AROUND: + me->GetMotionMaster()->MovePoint(0, 2477.146f, 695.041f, 55.801f); + break; + case EVENT_LOOK_2: + me->SetFacingTo(2.297f); + break; + case EVENT_LOOK_3: + me->SetFacingTo(0.64f); + break; + case EVENT_SUMMON_GUARDS: + SetRun(true); me->SummonCreature(NPC_TM_PROTECTOR, 2501.34f, 700.80f, 55.573f, 3.92f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_TM_LOOKOUT, 2503.02f, 699.11f, 55.57f, 3.92f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_TM_GUARDSMAN, 2503.04f, 702.495f, 50.63f, 3.92f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_TM_GUARDSMAN, 2504.72f, 700.806f, 55.62f, 3.92f, TEMPSUMMON_MANUAL_DESPAWN); - summons.DoAction(ACTION_SET_IMMUNE_FLAG); - break; - case EVENT_SUMMON_TALK1: - if (Creature* summon = summons.GetCreatureWithEntry(NPC_TM_LOOKOUT)) - summon->AI()->Talk(SAY_LOOKOUT_SAW); - break; - case EVENT_SUMMON_TALK2: - if (Creature* summon = summons.GetCreatureWithEntry(NPC_TM_LOOKOUT)) - summon->AI()->Talk(SAY_LOOKOUT_GO); - summons.DoAction(ACTION_REMOVE_IMMUNE_FLAG); - break; - case EVENT_LOOK_4: - me->SetFacingTo(0.41f); - Talk(SAY_ENTER_CHURCH); - break; - case EVENT_SUMMON_GUARDS_2: + summons.DoAction(ACTION_SET_IMMUNE_FLAG); + break; + case EVENT_SUMMON_TALK1: + if (Creature* summon = summons.GetCreatureWithEntry(NPC_TM_LOOKOUT)) + summon->AI()->Talk(SAY_LOOKOUT_SAW); + break; + case EVENT_SUMMON_TALK2: + if (Creature* summon = summons.GetCreatureWithEntry(NPC_TM_LOOKOUT)) + summon->AI()->Talk(SAY_LOOKOUT_GO); + summons.DoAction(ACTION_REMOVE_IMMUNE_FLAG); + break; + case EVENT_LOOK_4: + me->SetFacingTo(0.41f); + Talk(SAY_ENTER_CHURCH); + break; + case EVENT_SUMMON_GUARDS_2: me->SummonCreature(NPC_TM_PROTECTOR, 2630.75f, 664.80f, 54.28f, 4.37f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_TM_LOOKOUT, 2632.20f, 661.98f, 54.30f, 4.37f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_TM_GUARDSMAN, 2630.02f, 662.75f, 54.28f, 4.37f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_TM_GUARDSMAN, 2632.86f, 664.05f, 54.31f, 4.37f, TEMPSUMMON_MANUAL_DESPAWN); - break; - case EVENT_SUMMON_TALK3: - if (Creature* summon = summons.GetCreatureWithEntry(NPC_TM_LOOKOUT)) - summon->AI()->Talk(SAY_LOOKOUT_CHURCH); - break; - case EVENT_THRALL_TALK: - Talk(SAY_MEET_TARETHA); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - case EVENT_SUMMON_CHRONO: - if (Creature* epoch = me->SummonCreature(NPC_EPOCH_HUNTER, 2640.49f, 696.15f, 64.31f, 4.51f, TEMPSUMMON_MANUAL_DESPAWN)) - { - epoch->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - epoch->AI()->Talk(SAY_EPOCH_ENTER1); - } - break; - case EVENT_THRALL_TALK_2: - me->SetFacingTo(2.67f); - Talk(SAY_EPOCH_WONDER); - break; - case EVENT_TARETHA_FALL: - if (Creature* epoch = summons.GetCreatureWithEntry(NPC_EPOCH_HUNTER)) - epoch->AI()->Talk(SAY_EPOCH_ENTER2); - if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA_GUID))) - { - Taretha->CastSpell(Taretha, SPELL_SHADOW_SPIKE); + break; + case EVENT_SUMMON_TALK3: + if (Creature* summon = summons.GetCreatureWithEntry(NPC_TM_LOOKOUT)) + summon->AI()->Talk(SAY_LOOKOUT_CHURCH); + break; + case EVENT_THRALL_TALK: + Talk(SAY_MEET_TARETHA); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case EVENT_SUMMON_CHRONO: + if (Creature* epoch = me->SummonCreature(NPC_EPOCH_HUNTER, 2640.49f, 696.15f, 64.31f, 4.51f, TEMPSUMMON_MANUAL_DESPAWN)) + { + epoch->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + epoch->AI()->Talk(SAY_EPOCH_ENTER1); + } + break; + case EVENT_THRALL_TALK_2: + me->SetFacingTo(2.67f); + Talk(SAY_EPOCH_WONDER); + break; + case EVENT_TARETHA_FALL: + if (Creature* epoch = summons.GetCreatureWithEntry(NPC_EPOCH_HUNTER)) + epoch->AI()->Talk(SAY_EPOCH_ENTER2); + if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA_GUID))) + { + Taretha->CastSpell(Taretha, SPELL_SHADOW_SPIKE); Taretha->SetStandState(UNIT_STAND_STATE_DEAD); - } - break; - case EVENT_THRALL_TALK_3: - me->SetFacingTo(5.78f); - Talk(SAY_EPOCH_KILL_TARETHA); - break; - case EVENT_THRALL_MOVE_DOWN: - SetEscortPaused(false); - break; - case EVENT_EPOCH_INTRO: - me->SetFacingTo(1.33f); - if (Creature* epoch = summons.GetCreatureWithEntry(NPC_EPOCH_HUNTER)) - epoch->AI()->Talk(SAY_EPOCH_ENTER3); - break; - case EVENT_SUMMON_INFINITES: + } + break; + case EVENT_THRALL_TALK_3: + me->SetFacingTo(5.78f); + Talk(SAY_EPOCH_KILL_TARETHA); + break; + case EVENT_THRALL_MOVE_DOWN: + SetEscortPaused(false); + break; + case EVENT_EPOCH_INTRO: + me->SetFacingTo(1.33f); + if (Creature* epoch = summons.GetCreatureWithEntry(NPC_EPOCH_HUNTER)) + epoch->AI()->Talk(SAY_EPOCH_ENTER3); + break; + case EVENT_SUMMON_INFINITES: me->SummonCreature(NPC_EPOCH_LOOKOUT, 2647.57f, 701.17f, 56.215f, 4.3f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_EPOCH_GUARDSMAN, 2629.46f, 704.76f, 56.286f, 4.98f, TEMPSUMMON_MANUAL_DESPAWN); me->SummonCreature(NPC_EPOCH_PROTECTOR, 2640.14f, 709.44f, 56.135f, 4.70f, TEMPSUMMON_MANUAL_DESPAWN); - summons.DoAction(ACTION_SET_IMMUNE_FLAG); - summons.DoAction(ACTION_MOVE); - break; - case EVENT_TRANSFORM: - summons.DoAction(ACTION_TRANSFORM); - summons.DoAction(ACTION_SET_IMMUNE_FLAG); - break; - case EVENT_START_WAVE_1: - events.ScheduleEvent(EVENT_CHECK_WAVE_1, 500); - summons.DoAction(ACTION_REMOVE_IMMUNE_FLAG); - summons.DoAction(ACTION_START_COMBAT); - break; - case EVENT_CHECK_WAVE_1: - if (summons.size() == 1) - { - me->SummonCreature(NPC_INFINITE_SABOTEUR, 2599.57f, 683.72f, 55.975f, 0.05f, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_INFINITE_SLAYER, 2599.57f, 677.0f, 55.975f, 0.05f, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_INFINITE_DEFILER, 2592.57f, 680.0f, 55.975f, 0.05f, TEMPSUMMON_MANUAL_DESPAWN); - summons.DoAction(ACTION_START_COMBAT); - events.ScheduleEvent(EVENT_CHECK_WAVE_2, 500); - break; - } - events.ScheduleEvent(EVENT_CHECK_WAVE_1, 500); - break; - case EVENT_CHECK_WAVE_2: - if (summons.size() == 1) - { - me->SummonCreature(NPC_INFINITE_SLAYER, 2642.62f, 701.43f, 55.965f, 4.46f, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_INFINITE_SLAYER, 2638.62f, 701.43f, 55.965f, 4.46f, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_INFINITE_SABOTEUR, 2638.62f, 705.43f, 55.965f, 4.46f, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_INFINITE_DEFILER, 2642.62f, 705.43f, 55.965f, 4.46f, TEMPSUMMON_MANUAL_DESPAWN); - summons.DoAction(ACTION_START_COMBAT); - events.ScheduleEvent(EVENT_CHECK_WAVE_3, 500); - break; - } - events.ScheduleEvent(EVENT_CHECK_WAVE_2, 500); - break; - case EVENT_CHECK_WAVE_3: - if (summons.size() == 1) - { - me->SetHomePosition(2634.79f, 672.964f, 54.8577f, 1.33f); - me->GetMotionMaster()->MoveTargetedHome(); - events.ScheduleEvent(EVENT_CALL_EPOCH, 8000); - break; - } - events.ScheduleEvent(EVENT_CHECK_WAVE_3, 500); - break; - case EVENT_CALL_EPOCH: - if (Creature* epoch = summons.GetCreatureWithEntry(NPC_EPOCH_HUNTER)) - { - epoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - epoch->GetMotionMaster()->MovePoint(0, *me, false, true); - } - break; - case EVENT_THRALL_FACE_TARETHA: - { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); + summons.DoAction(ACTION_SET_IMMUNE_FLAG); + summons.DoAction(ACTION_MOVE); + break; + case EVENT_TRANSFORM: + summons.DoAction(ACTION_TRANSFORM); + summons.DoAction(ACTION_SET_IMMUNE_FLAG); + break; + case EVENT_START_WAVE_1: + events.ScheduleEvent(EVENT_CHECK_WAVE_1, 500); + summons.DoAction(ACTION_REMOVE_IMMUNE_FLAG); + summons.DoAction(ACTION_START_COMBAT); + break; + case EVENT_CHECK_WAVE_1: + if (summons.size() == 1) + { + me->SummonCreature(NPC_INFINITE_SABOTEUR, 2599.57f, 683.72f, 55.975f, 0.05f, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_INFINITE_SLAYER, 2599.57f, 677.0f, 55.975f, 0.05f, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_INFINITE_DEFILER, 2592.57f, 680.0f, 55.975f, 0.05f, TEMPSUMMON_MANUAL_DESPAWN); + summons.DoAction(ACTION_START_COMBAT); + events.ScheduleEvent(EVENT_CHECK_WAVE_2, 500); + break; + } + events.ScheduleEvent(EVENT_CHECK_WAVE_1, 500); + break; + case EVENT_CHECK_WAVE_2: + if (summons.size() == 1) + { + me->SummonCreature(NPC_INFINITE_SLAYER, 2642.62f, 701.43f, 55.965f, 4.46f, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_INFINITE_SLAYER, 2638.62f, 701.43f, 55.965f, 4.46f, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_INFINITE_SABOTEUR, 2638.62f, 705.43f, 55.965f, 4.46f, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_INFINITE_DEFILER, 2642.62f, 705.43f, 55.965f, 4.46f, TEMPSUMMON_MANUAL_DESPAWN); + summons.DoAction(ACTION_START_COMBAT); + events.ScheduleEvent(EVENT_CHECK_WAVE_3, 500); + break; + } + events.ScheduleEvent(EVENT_CHECK_WAVE_2, 500); + break; + case EVENT_CHECK_WAVE_3: + if (summons.size() == 1) + { + me->SetHomePosition(2634.79f, 672.964f, 54.8577f, 1.33f); + me->GetMotionMaster()->MoveTargetedHome(); + events.ScheduleEvent(EVENT_CALL_EPOCH, 8000); + break; + } + events.ScheduleEvent(EVENT_CHECK_WAVE_3, 500); + break; + case EVENT_CALL_EPOCH: + if (Creature* epoch = summons.GetCreatureWithEntry(NPC_EPOCH_HUNTER)) + { + epoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + epoch->GetMotionMaster()->MovePoint(0, *me, false, true); + } + break; + case EVENT_THRALL_FACE_TARETHA: + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); if (!players.isEmpty()) for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) if (Player* player = itr->GetSource()) player->KilledMonsterCredit(20156, 0); - me->SetFacingTo(5.76f); - break; - } - case EVENT_THRALL_TALK_4: - Talk(SAY_GREET_TARETHA); - break; - case EVENT_TARETHA_TALK_1: - if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA_GUID))) - Taretha->AI()->Talk(SAY_TARETHA_TALK1); - break; - case EVENT_THRALL_TALK_5: - Talk(SAY_CHAT_TARETHA1); - break; - case EVENT_SUMMON_EROZION: - if (Creature* erozion = me->SummonCreature(NPC_EROZION, 2646.31f, 680.01f, 55.36f, 3.76f, TEMPSUMMON_MANUAL_DESPAWN)) - erozion->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - break; - case EVENT_EROZION_TALK_1: - if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) - { - erozion->CastSpell(erozion, SPELL_TELEPORT, true); - erozion->AI()->Talk(SAY_EROZION_1); - } - break; - case EVENT_EROZION_ACTION_1: - if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) - erozion->CastSpell(erozion, SPELL_MEMORY_WIPE, false); - break; - case EVENT_EROZION_TALK_2: - if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) - erozion->AI()->Talk(SAY_EROZION_2); - break; - case EVENT_EROZION_TALK_3: - if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) - erozion->AI()->Talk(SAY_EROZION_3); - break; - case EVENT_EROZION_ACTION_2: - if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) - erozion->CastSpell(erozion, SPELL_MEMORY_WIPE_RESUME, false); - break; - case EVENT_THRALL_TALK_6: - Talk(SAY_EVENT_COMPLETE); - break; - case EVENT_THRALL_RUN_AWAY: - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->SetReactState(REACT_PASSIVE); - SetEscortPaused(false); - break; - case EVENT_TARETHA_TALK_2: - if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA_GUID))) - { - Taretha->SetFacingTo(4.233f); - Taretha->AI()->Talk(SAY_TARETHA_TALK2); - } - break; - } - } + me->SetFacingTo(5.76f); + break; + } + case EVENT_THRALL_TALK_4: + Talk(SAY_GREET_TARETHA); + break; + case EVENT_TARETHA_TALK_1: + if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA_GUID))) + Taretha->AI()->Talk(SAY_TARETHA_TALK1); + break; + case EVENT_THRALL_TALK_5: + Talk(SAY_CHAT_TARETHA1); + break; + case EVENT_SUMMON_EROZION: + if (Creature* erozion = me->SummonCreature(NPC_EROZION, 2646.31f, 680.01f, 55.36f, 3.76f, TEMPSUMMON_MANUAL_DESPAWN)) + erozion->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + break; + case EVENT_EROZION_TALK_1: + if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) + { + erozion->CastSpell(erozion, SPELL_TELEPORT, true); + erozion->AI()->Talk(SAY_EROZION_1); + } + break; + case EVENT_EROZION_ACTION_1: + if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) + erozion->CastSpell(erozion, SPELL_MEMORY_WIPE, false); + break; + case EVENT_EROZION_TALK_2: + if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) + erozion->AI()->Talk(SAY_EROZION_2); + break; + case EVENT_EROZION_TALK_3: + if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) + erozion->AI()->Talk(SAY_EROZION_3); + break; + case EVENT_EROZION_ACTION_2: + if (Creature* erozion = summons.GetCreatureWithEntry(NPC_EROZION)) + erozion->CastSpell(erozion, SPELL_MEMORY_WIPE_RESUME, false); + break; + case EVENT_THRALL_TALK_6: + Talk(SAY_EVENT_COMPLETE); + break; + case EVENT_THRALL_RUN_AWAY: + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetReactState(REACT_PASSIVE); + SetEscortPaused(false); + break; + case EVENT_TARETHA_TALK_2: + if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA_GUID))) + { + Taretha->SetFacingTo(4.233f); + Taretha->AI()->Talk(SAY_TARETHA_TALK2); + } + break; + } + } void UpdateEscortAI(uint32 diff) { - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - combatEvents.Update(diff); - switch (combatEvents.ExecuteEvent()) - { - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(20)) - { - Talk(SAY_RANDOM_LOW_HP); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); - break; - case EVENT_SPELL_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_STRIKE, false); - events.ScheduleEvent(EVENT_SPELL_STRIKE, 6000); - break; - case EVENT_SPELL_SHIELD_BLOCK: - me->CastSpell(me, SPELL_SHIELD_BLOCK, false); - events.ScheduleEvent(EVENT_SPELL_SHIELD_BLOCK, 6000); - break; - } + combatEvents.Update(diff); + switch (combatEvents.ExecuteEvent()) + { + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(20)) + { + Talk(SAY_RANDOM_LOW_HP); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); + break; + case EVENT_SPELL_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_STRIKE, false); + events.ScheduleEvent(EVENT_SPELL_STRIKE, 6000); + break; + case EVENT_SPELL_SHIELD_BLOCK: + me->CastSpell(me, SPELL_SHIELD_BLOCK, false); + events.ScheduleEvent(EVENT_SPELL_SHIELD_BLOCK, 6000); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } - void ReorderInstance(uint32 data) - { - Start(true, true); - SetEscortPaused(true); - SetDespawnAtEnd(false); - - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); + void ReorderInstance(uint32 data) + { + Start(true, true); + SetEscortPaused(true); + SetDespawnAtEnd(false); + + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); - if (data < ENCOUNTER_PROGRESS_THRALL_ARMORED) - { - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); - me->SetDisplayId(THRALL_MODEL_UNEQUIPPED); - } - else - { - me->SetDisplayId(THRALL_MODEL_EQUIPPED); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_ITEM); + if (data < ENCOUNTER_PROGRESS_THRALL_ARMORED) + { + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); + me->SetDisplayId(THRALL_MODEL_UNEQUIPPED); + } + else + { + me->SetDisplayId(THRALL_MODEL_EQUIPPED); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_ITEM); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, THRALL_SHIELD_ITEM); - } + } - switch (data) - { - case ENCOUNTER_PROGRESS_THRALL_ARMORED: - SetNextWaypoint(11, false); - break; - case ENCOUNTER_PROGRESS_AMBUSHES_1: - SetNextWaypoint(27, false); - break; - case ENCOUNTER_PROGRESS_SKARLOC_KILLED: - me->SummonCreature(NPC_SKARLOC_MOUNT, 2049.12f, 252.31f, 62.855f, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN); - SetNextWaypoint(30, false); - break; - case ENCOUNTER_PROGRESS_TARREN_MILL: - SetNextWaypoint(61, false); - break; - case ENCOUNTER_PROGRESS_TARETHA_MEET: - SetNextWaypoint(95, false); - if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA_GUID))) + switch (data) + { + case ENCOUNTER_PROGRESS_THRALL_ARMORED: + SetNextWaypoint(11, false); + break; + case ENCOUNTER_PROGRESS_AMBUSHES_1: + SetNextWaypoint(27, false); + break; + case ENCOUNTER_PROGRESS_SKARLOC_KILLED: + me->SummonCreature(NPC_SKARLOC_MOUNT, 2049.12f, 252.31f, 62.855f, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN); + SetNextWaypoint(30, false); + break; + case ENCOUNTER_PROGRESS_TARREN_MILL: + SetNextWaypoint(61, false); + break; + case ENCOUNTER_PROGRESS_TARETHA_MEET: + SetNextWaypoint(95, false); + if (Creature* Taretha = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TARETHA_GUID))) Taretha->SetStandState(UNIT_STAND_STATE_STAND); - break; - } - } + break; + } + } - private: - InstanceScript* instance; - EventMap events; - EventMap combatEvents; - SummonList summons; + private: + InstanceScript* instance; + EventMap events; + EventMap combatEvents; + SummonList summons; - bool _mounted; + bool _mounted; }; }; @@ -867,35 +867,35 @@ public: InstanceScript* instance; - void DoAction(int32 param) - { - me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveAllAuras(); - Start(false, true); - } + void DoAction(int32 param) + { + me->SetStandState(UNIT_STAND_STATE_STAND); + me->RemoveAllAuras(); + Start(false, true); + } void WaypointReached(uint32 waypointId) { if (waypointId == 7) - { - SetRun(false); + { + SetRun(false); Talk(SAY_TARETHA_FREE); me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); - if (Creature* thrall = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THRALL_GUID))) - thrall->AI()->DoAction(me->GetEntry()); + if (Creature* thrall = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_THRALL_GUID))) + thrall->AI()->DoAction(me->GetEntry()); } - else if (waypointId == 9) - me->SetVisible(false); + else if (waypointId == 9) + me->SetVisible(false); } void Reset() - { - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - me->CastSpell(me, SPELL_SHADOW_PRISON, true); - } + { + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + me->CastSpell(me, SPELL_SHADOW_PRISON, true); + } - void AttackStart(Unit*) { } - void MoveInLineOfSight(Unit*) { } + void AttackStart(Unit*) { } + void MoveInLineOfSight(Unit*) { } }; }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h index df9eb5a99..09500d605 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h @@ -7,71 +7,71 @@ REWRITTEN BY XINEF enum DataIds { - DATA_ESCORT_PROGRESS = 0, + DATA_ESCORT_PROGRESS = 0, - DATA_BOMBS_PLACED = 10, - DATA_THRALL_REPOSITION = 11, - DATA_THRALL_ADD_FLAG = 12, - DATA_THRALL_GUID = 13, - DATA_TARETHA_GUID = 14, - DATA_ATTEMPTS_COUNT = 15 + DATA_BOMBS_PLACED = 10, + DATA_THRALL_REPOSITION = 11, + DATA_THRALL_ADD_FLAG = 12, + DATA_THRALL_GUID = 13, + DATA_TARETHA_GUID = 14, + DATA_ATTEMPTS_COUNT = 15 }; enum NpcIds { - NPC_EROZION = 18723, - NPC_THRALL = 17876, - NPC_TARETHA = 18887, - NPC_EPOCH_HUNTER = 18096, - NPC_LIEUTENANT_DRAKE = 17848, + NPC_EROZION = 18723, + NPC_THRALL = 17876, + NPC_TARETHA = 18887, + NPC_EPOCH_HUNTER = 18096, + NPC_LIEUTENANT_DRAKE = 17848, - NPC_LODGE_QUEST_TRIGGER = 20155, - NPC_ORC_PRISONER = 18598, + NPC_LODGE_QUEST_TRIGGER = 20155, + NPC_ORC_PRISONER = 18598, - NPC_DURNHOLDE_ARMORER = 18764, - NPC_DURNHOLDE_WARDEN = 17833, - NPC_DURNHOLDE_VETERAN = 17860, - NPC_DURNHOLDE_MAGE = 17860, - NPC_DURNHOLDE_SENTRY = 17860, + NPC_DURNHOLDE_ARMORER = 18764, + NPC_DURNHOLDE_WARDEN = 17833, + NPC_DURNHOLDE_VETERAN = 17860, + NPC_DURNHOLDE_MAGE = 17860, + NPC_DURNHOLDE_SENTRY = 17860, - NPC_CAPTAIN_SKARLOC = 17862, - NPC_SKARLOC_MOUNT = 18798, + NPC_CAPTAIN_SKARLOC = 17862, + NPC_SKARLOC_MOUNT = 18798, - NPC_LORDAERON_SENTRY = 17815, - NPC_LORDAERON_WATCHMAN = 17814, + NPC_LORDAERON_SENTRY = 17815, + NPC_LORDAERON_WATCHMAN = 17814, }; enum GobjectIds { - GO_BARREL = 182589, - GO_ROARING_FLAME = 182592, - GO_PRISON_DOOR = 184393 + GO_BARREL = 182589, + GO_ROARING_FLAME = 182592, + GO_PRISON_DOOR = 184393 }; enum MiscIds { - QUEST_DIVERSION = 10283, - WORLD_STATE_BARRELS_PLANTED = 2436, - SKARLOC_MOUNT_MODEL = 18223, + QUEST_DIVERSION = 10283, + WORLD_STATE_BARRELS_PLANTED = 2436, + SKARLOC_MOUNT_MODEL = 18223, - ENCOUNTER_PROGRESS_NONE = 0, - ENCOUNTER_PROGRESS_BARRELS = 1, - ENCOUNTER_PROGRESS_DRAKE_KILLED = 2, - ENCOUNTER_PROGRESS_THRALL_ARMORED = 3, - ENCOUNTER_PROGRESS_AMBUSHES_1 = 4, - ENCOUNTER_PROGRESS_SKARLOC_KILLED = 5, - ENCOUNTER_PROGRESS_TARREN_MILL = 6, - ENCOUNTER_PROGRESS_TARETHA_MEET = 7, - ENCOUNTER_PROGRESS_EPOCH_KILLED = 8, - ENCOUNTER_PROGRESS_FINISHED = 9, + ENCOUNTER_PROGRESS_NONE = 0, + ENCOUNTER_PROGRESS_BARRELS = 1, + ENCOUNTER_PROGRESS_DRAKE_KILLED = 2, + ENCOUNTER_PROGRESS_THRALL_ARMORED = 3, + ENCOUNTER_PROGRESS_AMBUSHES_1 = 4, + ENCOUNTER_PROGRESS_SKARLOC_KILLED = 5, + ENCOUNTER_PROGRESS_TARREN_MILL = 6, + ENCOUNTER_PROGRESS_TARETHA_MEET = 7, + ENCOUNTER_PROGRESS_EPOCH_KILLED = 8, + ENCOUNTER_PROGRESS_FINISHED = 9, - EVENT_INITIAL_BARRELS_FLAME = 1, - EVENT_FINAL_BARRELS_FLAME = 2, - EVENT_SUMMON_LIEUTENANT = 3, - EVENT_THRALL_REPOSITION = 4, + EVENT_INITIAL_BARRELS_FLAME = 1, + EVENT_FINAL_BARRELS_FLAME = 2, + EVENT_SUMMON_LIEUTENANT = 3, + EVENT_THRALL_REPOSITION = 4, - INSTANCE_POSITIONS_COUNT = 3, - THRALL_POSITIONS_COUNT = 5 + INSTANCE_POSITIONS_COUNT = 3, + THRALL_POSITIONS_COUNT = 5 }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_aeonus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_aeonus.cpp index 8fb94a348..55a806deb 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_aeonus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_aeonus.cpp @@ -8,27 +8,27 @@ REWRITTEN BY XINEF enum Enums { - SAY_ENTER = 0, - SAY_AGGRO = 1, - SAY_BANISH = 2, - SAY_SLAY = 3, - SAY_DEATH = 4, - EMOTE_FRENZY = 5, + SAY_ENTER = 0, + SAY_AGGRO = 1, + SAY_BANISH = 2, + SAY_SLAY = 3, + SAY_DEATH = 4, + EMOTE_FRENZY = 5, - SPELL_CLEAVE = 40504, - SPELL_TIME_STOP = 31422, - SPELL_ENRAGE = 37605, - SPELL_SAND_BREATH = 31473, - SPELL_CORRUPT_MEDIVH = 37853, - SPELL_BANISH_DRAGON_HELPER = 31550 + SPELL_CLEAVE = 40504, + SPELL_TIME_STOP = 31422, + SPELL_ENRAGE = 37605, + SPELL_SAND_BREATH = 31473, + SPELL_CORRUPT_MEDIVH = 37853, + SPELL_BANISH_DRAGON_HELPER = 31550 }; enum Events { - EVENT_SANDBREATH = 1, - EVENT_TIMESTOP = 2, - EVENT_FRENZY = 3, - EVENT_CLEAVE = 4 + EVENT_SANDBREATH = 1, + EVENT_TIMESTOP = 2, + EVENT_FRENZY = 3, + EVENT_CLEAVE = 4 }; class boss_aeonus : public CreatureScript @@ -39,36 +39,36 @@ public: struct boss_aeonusAI : public ScriptedAI { boss_aeonusAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } + { + instance = creature->GetInstanceScript(); + } - EventMap events; - InstanceScript* instance; + EventMap events; + InstanceScript* instance; void Reset() - { - events.Reset(); - } + { + events.Reset(); + } - void JustReachedHome() - { - if (Unit* medivh = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MEDIVH))) - if (me->GetDistance2d(medivh) < 20.0f) - me->CastSpell(me, SPELL_CORRUPT_MEDIVH, false); - } + void JustReachedHome() + { + if (Unit* medivh = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MEDIVH))) + if (me->GetDistance2d(medivh) < 20.0f) + me->CastSpell(me, SPELL_CORRUPT_MEDIVH, false); + } - void InitializeAI() - { - Talk(SAY_ENTER); - ScriptedAI::InitializeAI(); + void InitializeAI() + { + Talk(SAY_ENTER); + ScriptedAI::InitializeAI(); - if (Unit* medivh = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MEDIVH))) - { - me->SetHomePosition(medivh->GetPositionX() + 14.0f*cos(medivh->GetAngle(me)), medivh->GetPositionY() + 14.0f*sin(medivh->GetAngle(me)), medivh->GetPositionZ(), me->GetAngle(medivh)); - me->GetMotionMaster()->MoveTargetedHome(); - } - } + if (Unit* medivh = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MEDIVH))) + { + me->SetHomePosition(medivh->GetPositionX() + 14.0f*cos(medivh->GetAngle(me)), medivh->GetPositionY() + 14.0f*sin(medivh->GetAngle(me)), medivh->GetPositionZ(), me->GetAngle(medivh)); + me->GetMotionMaster()->MoveTargetedHome(); + } + } void EnterCombat(Unit* /*who*/) { @@ -87,8 +87,8 @@ public: if (me->IsWithinDistInMap(who, 20.0f)) { Talk(SAY_BANISH); - me->CastSpell(me, SPELL_BANISH_DRAGON_HELPER, true); - return; + me->CastSpell(me, SPELL_BANISH_DRAGON_HELPER, true); + return; } } @@ -118,21 +118,21 @@ public: switch (events.ExecuteEvent()) { - case EVENT_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - events.ScheduleEvent(EVENT_CLEAVE, 10000); - break; + case EVENT_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + events.ScheduleEvent(EVENT_CLEAVE, 10000); + break; case EVENT_SANDBREATH: me->CastSpell(me->GetVictim(), SPELL_SAND_BREATH, false); events.ScheduleEvent(EVENT_SANDBREATH, 20000); break; case EVENT_TIMESTOP: - me->CastSpell(me, SPELL_TIME_STOP, false); + me->CastSpell(me, SPELL_TIME_STOP, false); events.ScheduleEvent(EVENT_TIMESTOP, 25000); break; case EVENT_FRENZY: Talk(EMOTE_FRENZY); - me->CastSpell(me, SPELL_ENRAGE, false); + me->CastSpell(me, SPELL_ENRAGE, false); events.ScheduleEvent(EVENT_FRENZY, 30000); break; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_chrono_lord_deja.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_chrono_lord_deja.cpp index a992534ed..5261403ee 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_chrono_lord_deja.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_chrono_lord_deja.cpp @@ -8,26 +8,26 @@ REWRITTEN BY XINEF enum Enums { - SAY_ENTER = 0, - SAY_AGGRO = 1, - SAY_BANISH = 2, - SAY_SLAY = 3, - SAY_DEATH = 4, + SAY_ENTER = 0, + SAY_AGGRO = 1, + SAY_BANISH = 2, + SAY_SLAY = 3, + SAY_DEATH = 4, - SPELL_ARCANE_BLAST = 31457, - SPELL_ARCANE_DISCHARGE = 31472, - SPELL_TIME_LAPSE = 31467, - SPELL_ATTRACTION = 38540, + SPELL_ARCANE_BLAST = 31457, + SPELL_ARCANE_DISCHARGE = 31472, + SPELL_TIME_LAPSE = 31467, + SPELL_ATTRACTION = 38540, - SPELL_BANISH_DRAGON_HELPER = 31550, + SPELL_BANISH_DRAGON_HELPER = 31550, }; enum Events { - EVENT_ARCANE_BLAST = 1, - EVENT_TIME_LAPSE = 2, - EVENT_ARCANE_DISCHARGE = 3, - EVENT_ATTRACTION = 4 + EVENT_ARCANE_BLAST = 1, + EVENT_TIME_LAPSE = 2, + EVENT_ARCANE_DISCHARGE = 3, + EVENT_ATTRACTION = 4 }; class boss_chrono_lord_deja : public CreatureScript @@ -37,26 +37,26 @@ public: struct boss_chrono_lord_dejaAI : public ScriptedAI { - boss_chrono_lord_dejaAI(Creature* creature) : ScriptedAI(creature) { } + boss_chrono_lord_dejaAI(Creature* creature) : ScriptedAI(creature) { } - EventMap events; + EventMap events; void Reset() - { - events.Reset(); - } + { + events.Reset(); + } - void OwnTalk(uint32 id) - { - if (me->GetEntry() == NPC_CHRONO_LORD_DEJA) - Talk(id); - } + void OwnTalk(uint32 id) + { + if (me->GetEntry() == NPC_CHRONO_LORD_DEJA) + Talk(id); + } - void InitializeAI() - { - OwnTalk(SAY_ENTER); - ScriptedAI::InitializeAI(); - } + void InitializeAI() + { + OwnTalk(SAY_ENTER); + ScriptedAI::InitializeAI(); + } void EnterCombat(Unit* /*who*/) { @@ -76,8 +76,8 @@ public: if (me->IsWithinDistInMap(who, 20.0f)) { OwnTalk(SAY_BANISH); - me->CastSpell(me, SPELL_BANISH_DRAGON_HELPER, true); - return; + me->CastSpell(me, SPELL_BANISH_DRAGON_HELPER, true); + return; } } @@ -86,15 +86,15 @@ public: void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - OwnTalk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + OwnTalk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { OwnTalk(SAY_DEATH); - if (InstanceScript* instance = me->GetInstanceScript()) - instance->SetData(TYPE_CHRONO_LORD_DEJA, DONE); + if (InstanceScript* instance = me->GetInstanceScript()) + instance->SetData(TYPE_CHRONO_LORD_DEJA, DONE); } void UpdateAI(uint32 diff) @@ -109,19 +109,19 @@ public: switch (events.ExecuteEvent()) { case EVENT_ARCANE_BLAST: - me->CastSpell(me->GetVictim(), SPELL_ARCANE_BLAST, false); + me->CastSpell(me->GetVictim(), SPELL_ARCANE_BLAST, false); events.ScheduleEvent(EVENT_ARCANE_BLAST, 20000); break; case EVENT_TIME_LAPSE: - me->CastSpell(me, SPELL_TIME_LAPSE, false); + me->CastSpell(me, SPELL_TIME_LAPSE, false); events.ScheduleEvent(EVENT_TIME_LAPSE, 20000); break; case EVENT_ARCANE_DISCHARGE: - me->CastSpell(me, SPELL_ARCANE_DISCHARGE, false); + me->CastSpell(me, SPELL_ARCANE_DISCHARGE, false); events.ScheduleEvent(EVENT_ARCANE_DISCHARGE, 25000); break; case EVENT_ATTRACTION: - me->CastSpell(me, SPELL_ATTRACTION, false); + me->CastSpell(me, SPELL_ATTRACTION, false); events.ScheduleEvent(EVENT_ATTRACTION, 30000); break; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_temporus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_temporus.cpp index 8762ec4d7..528017d3c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_temporus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/boss_temporus.cpp @@ -8,25 +8,25 @@ REWRITTEN BY XINEF enum Enums { - SAY_ENTER = 0, - SAY_AGGRO = 1, - SAY_BANISH = 2, - SAY_SLAY = 3, - SAY_DEATH = 4, + SAY_ENTER = 0, + SAY_AGGRO = 1, + SAY_BANISH = 2, + SAY_SLAY = 3, + SAY_DEATH = 4, - SPELL_HASTEN = 31458, - SPELL_MORTAL_WOUND = 31464, - SPELL_WING_BUFFET = 31475, - SPELL_REFLECT = 38592, - SPELL_BANISH_DRAGON_HELPER = 31550 + SPELL_HASTEN = 31458, + SPELL_MORTAL_WOUND = 31464, + SPELL_WING_BUFFET = 31475, + SPELL_REFLECT = 38592, + SPELL_BANISH_DRAGON_HELPER = 31550 }; enum Events { - EVENT_HASTEN = 1, - EVENT_MORTAL_WOUND = 2, - EVENT_WING_BUFFET = 3, - EVENT_SPELL_REFLECTION = 4 + EVENT_HASTEN = 1, + EVENT_MORTAL_WOUND = 2, + EVENT_WING_BUFFET = 3, + EVENT_SPELL_REFLECTION = 4 }; class boss_temporus : public CreatureScript @@ -38,24 +38,24 @@ public: { boss_temporusAI(Creature* creature) : ScriptedAI(creature) { } - EventMap events; + EventMap events; - void OwnTalk(uint32 id) - { - if (me->GetEntry() == NPC_TEMPORUS) - Talk(id); - } + void OwnTalk(uint32 id) + { + if (me->GetEntry() == NPC_TEMPORUS) + Talk(id); + } void Reset() - { - events.Reset(); - } + { + events.Reset(); + } - void InitializeAI() - { - OwnTalk(SAY_ENTER); - ScriptedAI::InitializeAI(); - } + void InitializeAI() + { + OwnTalk(SAY_ENTER); + ScriptedAI::InitializeAI(); + } void EnterCombat(Unit* /*who*/) { @@ -70,15 +70,15 @@ public: void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - OwnTalk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + OwnTalk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { OwnTalk(SAY_DEATH); if (InstanceScript* instance = me->GetInstanceScript()) - instance->SetData(TYPE_TEMPORUS, DONE); + instance->SetData(TYPE_TEMPORUS, DONE); } void MoveInLineOfSight(Unit* who) @@ -88,8 +88,8 @@ public: if (me->IsWithinDistInMap(who, 20.0f)) { OwnTalk(SAY_BANISH); - me->CastSpell(me, SPELL_BANISH_DRAGON_HELPER, true); - return; + me->CastSpell(me, SPELL_BANISH_DRAGON_HELPER, true); + return; } } @@ -108,11 +108,11 @@ public: switch (events.ExecuteEvent()) { case EVENT_HASTEN: - me->CastSpell(me, SPELL_HASTEN, false); + me->CastSpell(me, SPELL_HASTEN, false); events.ScheduleEvent(EVENT_HASTEN, 20000); break; case EVENT_MORTAL_WOUND: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); + me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); events.ScheduleEvent(EVENT_MORTAL_WOUND, 10000); break; case EVENT_WING_BUFFET: @@ -120,7 +120,7 @@ public: events.ScheduleEvent(EVENT_WING_BUFFET, 20000); break; case EVENT_SPELL_REFLECTION: - me->CastSpell(me, SPELL_REFLECT, false); + me->CastSpell(me, SPELL_REFLECT, false); events.ScheduleEvent(EVENT_SPELL_REFLECTION, 30000); break; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp index 64a28f715..68b491441 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp @@ -33,39 +33,39 @@ public: { instance_the_black_morass_InstanceMapScript(Map* map) : InstanceScript(map) { } - std::set encounterNPCs; - uint32 encounters[MAX_ENCOUNTER]; + std::set encounterNPCs; + uint32 encounters[MAX_ENCOUNTER]; uint64 _medivhGUID; uint8 _currentRift; - uint8 _shieldPercent; + uint8 _shieldPercent; void Initialize() { - memset(&encounters, 0, sizeof(encounters)); + memset(&encounters, 0, sizeof(encounters)); _medivhGUID = 0; _currentRift = 0; - _shieldPercent = 100; - encounterNPCs.clear(); + _shieldPercent = 100; + encounterNPCs.clear(); } - void CleanupInstance() - { - Events.Reset(); + void CleanupInstance() + { + Events.Reset(); _currentRift = 0; - _shieldPercent = 100; + _shieldPercent = 100; - instance->LoadGrid(-2023.0f, 7121.0f); - if (Creature* medivh = instance->GetCreature(_medivhGUID)) - { - medivh->DespawnOrUnsummon(); - medivh->SetRespawnTime(3); - } + instance->LoadGrid(-2023.0f, 7121.0f); + if (Creature* medivh = instance->GetCreature(_medivhGUID)) + { + medivh->DespawnOrUnsummon(); + medivh->SetRespawnTime(3); + } - std::set eCopy = encounterNPCs; - for (std::set::const_iterator itr = eCopy.begin(); itr != eCopy.end(); ++itr) - if (Creature* creature = instance->GetCreature(*itr)) - creature->DespawnOrUnsummon(); - } + std::set eCopy = encounterNPCs; + for (std::set::const_iterator itr = eCopy.begin(); itr != eCopy.end(); ++itr) + if (Creature* creature = instance->GetCreature(*itr)) + creature->DespawnOrUnsummon(); + } bool IsEncounterInProgress() const { @@ -74,10 +74,10 @@ public: void OnPlayerEnter(Player* player) { - if (instance->GetPlayersCountExceptGMs() <= 1 && GetData(TYPE_AEONUS) != DONE) - CleanupInstance(); + if (instance->GetPlayersCountExceptGMs() <= 1 && GetData(TYPE_AEONUS) != DONE) + CleanupInstance(); - player->SendUpdateWorldState(WORLD_STATE_BM, _currentRift > 0 ? 1 : 0); + player->SendUpdateWorldState(WORLD_STATE_BM, _currentRift > 0 ? 1 : 0); player->SendUpdateWorldState(WORLD_STATE_BM_SHIELD, _shieldPercent); player->SendUpdateWorldState(WORLD_STATE_BM_RIFT, _currentRift); } @@ -85,65 +85,65 @@ public: void OnCreatureCreate(Creature* creature) { switch (creature->GetEntry()) - { - case NPC_MEDIVH: - _medivhGUID = creature->GetGUID(); - break; - case NPC_TIME_RIFT: - case NPC_CHRONO_LORD_DEJA: - case NPC_INFINITE_CHRONO_LORD: - case NPC_TEMPORUS: - case NPC_INFINITE_TIMEREAVER: - case NPC_AEONUS: - case NPC_RIFT_KEEPER_WARLOCK: - case NPC_RIFT_KEEPER_MAGE: - case NPC_RIFT_LORD: - case NPC_RIFT_LORD_2: - case NPC_INFINITE_ASSASIN: - case NPC_INFINITE_WHELP: - case NPC_INFINITE_CRONOMANCER: - case NPC_INFINITE_EXECUTIONER: - case NPC_INFINITE_VANQUISHER: - encounterNPCs.insert(creature->GetGUID()); - break; - } + { + case NPC_MEDIVH: + _medivhGUID = creature->GetGUID(); + break; + case NPC_TIME_RIFT: + case NPC_CHRONO_LORD_DEJA: + case NPC_INFINITE_CHRONO_LORD: + case NPC_TEMPORUS: + case NPC_INFINITE_TIMEREAVER: + case NPC_AEONUS: + case NPC_RIFT_KEEPER_WARLOCK: + case NPC_RIFT_KEEPER_MAGE: + case NPC_RIFT_LORD: + case NPC_RIFT_LORD_2: + case NPC_INFINITE_ASSASIN: + case NPC_INFINITE_WHELP: + case NPC_INFINITE_CRONOMANCER: + case NPC_INFINITE_EXECUTIONER: + case NPC_INFINITE_VANQUISHER: + encounterNPCs.insert(creature->GetGUID()); + break; + } } - void OnCreatureRemove(Creature* creature) - { + void OnCreatureRemove(Creature* creature) + { switch (creature->GetEntry()) - { - case NPC_TIME_RIFT: - case NPC_CHRONO_LORD_DEJA: - case NPC_INFINITE_CHRONO_LORD: - case NPC_TEMPORUS: - case NPC_INFINITE_TIMEREAVER: - case NPC_AEONUS: - case NPC_RIFT_KEEPER_WARLOCK: - case NPC_RIFT_KEEPER_MAGE: - case NPC_RIFT_LORD: - case NPC_RIFT_LORD_2: - case NPC_INFINITE_ASSASIN: - case NPC_INFINITE_WHELP: - case NPC_INFINITE_CRONOMANCER: - case NPC_INFINITE_EXECUTIONER: - case NPC_INFINITE_VANQUISHER: - encounterNPCs.erase(creature->GetGUID()); - break; - } + { + case NPC_TIME_RIFT: + case NPC_CHRONO_LORD_DEJA: + case NPC_INFINITE_CHRONO_LORD: + case NPC_TEMPORUS: + case NPC_INFINITE_TIMEREAVER: + case NPC_AEONUS: + case NPC_RIFT_KEEPER_WARLOCK: + case NPC_RIFT_KEEPER_MAGE: + case NPC_RIFT_LORD: + case NPC_RIFT_LORD_2: + case NPC_INFINITE_ASSASIN: + case NPC_INFINITE_WHELP: + case NPC_INFINITE_CRONOMANCER: + case NPC_INFINITE_EXECUTIONER: + case NPC_INFINITE_VANQUISHER: + encounterNPCs.erase(creature->GetGUID()); + break; + } } void SetData(uint32 type, uint32 data) { switch (type) { - case TYPE_AEONUS: - { - encounters[type] = DONE; - SaveToDB(); + case TYPE_AEONUS: + { + encounters[type] = DONE; + SaveToDB(); - if (Creature* medivh = instance->GetCreature(_medivhGUID)) - medivh->AI()->DoAction(ACTION_OUTRO); + if (Creature* medivh = instance->GetCreature(_medivhGUID)) + medivh->AI()->DoAction(ACTION_OUTRO); Map::PlayerList const& players = instance->GetPlayers(); if (!players.isEmpty()) @@ -155,68 +155,68 @@ public: if (player->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE) player->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH); - } - break; + } + break; } - case TYPE_CHRONO_LORD_DEJA: - case TYPE_TEMPORUS: - encounters[type] = DONE; - Events.RescheduleEvent(EVENT_NEXT_PORTAL, 60000); - Events.SetPhase(1); - SaveToDB(); - break; - case DATA_RIFT_KILLED: - if (!Events.IsInPhase(1)) - Events.RescheduleEvent(EVENT_NEXT_PORTAL, 4000); - break; - case DATA_MEDIVH: - DoUpdateWorldState(WORLD_STATE_BM, 1); - DoUpdateWorldState(WORLD_STATE_BM_SHIELD, _shieldPercent); - DoUpdateWorldState(WORLD_STATE_BM_RIFT, _currentRift); - Events.RescheduleEvent(EVENT_NEXT_PORTAL, 3000); - break; - case DATA_DAMAGE_SHIELD: - --_shieldPercent; - DoUpdateWorldState(WORLD_STATE_BM_SHIELD, _shieldPercent); - if (!_shieldPercent) - if (Creature* medivh = instance->GetCreature(_medivhGUID)) - if (medivh->IsAlive()) - { - Unit::Kill(medivh, medivh); + case TYPE_CHRONO_LORD_DEJA: + case TYPE_TEMPORUS: + encounters[type] = DONE; + Events.RescheduleEvent(EVENT_NEXT_PORTAL, 60000); + Events.SetPhase(1); + SaveToDB(); + break; + case DATA_RIFT_KILLED: + if (!Events.IsInPhase(1)) + Events.RescheduleEvent(EVENT_NEXT_PORTAL, 4000); + break; + case DATA_MEDIVH: + DoUpdateWorldState(WORLD_STATE_BM, 1); + DoUpdateWorldState(WORLD_STATE_BM_SHIELD, _shieldPercent); + DoUpdateWorldState(WORLD_STATE_BM_RIFT, _currentRift); + Events.RescheduleEvent(EVENT_NEXT_PORTAL, 3000); + break; + case DATA_DAMAGE_SHIELD: + --_shieldPercent; + DoUpdateWorldState(WORLD_STATE_BM_SHIELD, _shieldPercent); + if (!_shieldPercent) + if (Creature* medivh = instance->GetCreature(_medivhGUID)) + if (medivh->IsAlive()) + { + Unit::Kill(medivh, medivh); - // Xinef: delete all spawns - std::set eCopy = encounterNPCs; - for (std::set::iterator itr = eCopy.begin(); itr != eCopy.end(); ++itr) - if (Creature* creature = instance->GetCreature(*itr)) - creature->DespawnOrUnsummon(); - } - break; + // Xinef: delete all spawns + std::set eCopy = encounterNPCs; + for (std::set::iterator itr = eCopy.begin(); itr != eCopy.end(); ++itr) + if (Creature* creature = instance->GetCreature(*itr)) + creature->DespawnOrUnsummon(); + } + break; } } uint32 GetData(uint32 type) const { - switch (type) - { - case TYPE_CHRONO_LORD_DEJA: - case TYPE_TEMPORUS: - case TYPE_AEONUS: - return encounters[type]; - case DATA_SHIELD_PERCENT: - return _shieldPercent; - case DATA_RIFT_NUMBER: - return _currentRift; - } + switch (type) + { + case TYPE_CHRONO_LORD_DEJA: + case TYPE_TEMPORUS: + case TYPE_AEONUS: + return encounters[type]; + case DATA_SHIELD_PERCENT: + return _shieldPercent; + case DATA_RIFT_NUMBER: + return _currentRift; + } return 0; } - void SetData64(uint32 type, uint64 data) - { - if (type == DATA_SUMMONED_NPC) - encounterNPCs.insert(data); - else if (type == DATA_DELETED_NPC) - encounterNPCs.erase(data); - } + void SetData64(uint32 type, uint64 data) + { + if (type == DATA_SUMMONED_NPC) + encounterNPCs.insert(data); + else if (type == DATA_DELETED_NPC) + encounterNPCs.erase(data); + } uint64 GetData64(uint32 data) const { @@ -228,46 +228,46 @@ public: void SummonPortalKeeper() { - Creature* rift = NULL; - for (std::set::const_iterator itr = encounterNPCs.begin(); itr != encounterNPCs.end(); ++itr) - if (Creature* summon = instance->GetCreature(*itr)) - if (summon->GetEntry() == NPC_TIME_RIFT) - { - rift = summon; - break; - } + Creature* rift = NULL; + for (std::set::const_iterator itr = encounterNPCs.begin(); itr != encounterNPCs.end(); ++itr) + if (Creature* summon = instance->GetCreature(*itr)) + if (summon->GetEntry() == NPC_TIME_RIFT) + { + rift = summon; + break; + } - if (!rift) - return; + if (!rift) + return; - int32 entry = 0; - switch (_currentRift) - { - case 6: entry = GetData(TYPE_CHRONO_LORD_DEJA) == DONE ? (instance->IsHeroic() ? NPC_INFINITE_CHRONO_LORD : -NPC_CHRONO_LORD_DEJA) : NPC_CHRONO_LORD_DEJA; break; - case 12: entry = GetData(TYPE_TEMPORUS) == DONE ? (instance->IsHeroic() ? NPC_INFINITE_TIMEREAVER : -NPC_TEMPORUS) : NPC_TEMPORUS; break; - case 18: entry = NPC_AEONUS; break; - default: entry = RAND(NPC_RIFT_KEEPER_WARLOCK, NPC_RIFT_KEEPER_MAGE, NPC_RIFT_LORD, NPC_RIFT_LORD_2); break; - } + int32 entry = 0; + switch (_currentRift) + { + case 6: entry = GetData(TYPE_CHRONO_LORD_DEJA) == DONE ? (instance->IsHeroic() ? NPC_INFINITE_CHRONO_LORD : -NPC_CHRONO_LORD_DEJA) : NPC_CHRONO_LORD_DEJA; break; + case 12: entry = GetData(TYPE_TEMPORUS) == DONE ? (instance->IsHeroic() ? NPC_INFINITE_TIMEREAVER : -NPC_TEMPORUS) : NPC_TEMPORUS; break; + case 18: entry = NPC_AEONUS; break; + default: entry = RAND(NPC_RIFT_KEEPER_WARLOCK, NPC_RIFT_KEEPER_MAGE, NPC_RIFT_LORD, NPC_RIFT_LORD_2); break; + } Position pos; rift->GetNearPosition(pos, 10.0f, 2*M_PI*rand_norm()); if (TempSummon* summon = instance->SummonCreature(abs(entry), pos)) - { - summon->SetTempSummonType(TEMPSUMMON_CORPSE_TIMED_DESPAWN); - summon->SetTimer(3*MINUTE*IN_MILLISECONDS); + { + summon->SetTempSummonType(TEMPSUMMON_CORPSE_TIMED_DESPAWN); + summon->SetTimer(3*MINUTE*IN_MILLISECONDS); - if (entry < 0) - summon->SetLootMode(0); + if (entry < 0) + summon->SetLootMode(0); - if (summon->GetEntry() != NPC_AEONUS) - { - rift->AI()->SetGUID(summon->GetGUID()); - rift->CastSpell(summon, SPELL_RIFT_CHANNEL, false); - } - else - summon->SetReactState(REACT_DEFENSIVE); - } + if (summon->GetEntry() != NPC_AEONUS) + { + rift->AI()->SetGUID(summon->GetGUID()); + rift->CastSpell(summon, SPELL_RIFT_CHANNEL, false); + } + else + summon->SetReactState(REACT_DEFENSIVE); + } } void Update(uint32 diff) @@ -275,59 +275,59 @@ public: Events.Update(diff); switch (Events.ExecuteEvent()) { - case EVENT_NEXT_PORTAL: - ++_currentRift; - DoUpdateWorldState(WORLD_STATE_BM_RIFT, _currentRift); - Events.ScheduleEvent(EVENT_SUMMON_KEEPER, 6000); - Events.SetPhase(0); + case EVENT_NEXT_PORTAL: + ++_currentRift; + DoUpdateWorldState(WORLD_STATE_BM_RIFT, _currentRift); + Events.ScheduleEvent(EVENT_SUMMON_KEEPER, 6000); + Events.SetPhase(0); - if (Creature* medivh = instance->GetCreature(_medivhGUID)) - { - uint8 position = (_currentRift-1)%4; - instance->SummonCreature(NPC_TIME_RIFT, PortalLocation[position]); - } - break; - case EVENT_SUMMON_KEEPER: - SummonPortalKeeper(); - break; + if (Creature* medivh = instance->GetCreature(_medivhGUID)) + { + uint8 position = (_currentRift-1)%4; + instance->SummonCreature(NPC_TIME_RIFT, PortalLocation[position]); + } + break; + case EVENT_SUMMON_KEEPER: + SummonPortalKeeper(); + break; } } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "B M " << encounters[0] << ' ' << encounters[1] << ' ' << encounters[2]; + std::ostringstream saveStream; + saveStream << "B M " << encounters[0] << ' ' << encounters[1] << ' ' << encounters[2]; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; + char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'B' && dataHead2 == 'M') - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - loadStream >> encounters[i]; - } - else - OUT_LOAD_INST_DATA_FAIL; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'B' && dataHead2 == 'M') + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + loadStream >> encounters[i]; + } + else + OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } protected: EventMap Events; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp index 227bcdbcc..c5af9c9ab 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp @@ -10,67 +10,67 @@ REWRITTEN BY XINEF enum medivhSays { - SAY_WEAK75 = 0, - SAY_WEAK50 = 1, - SAY_WEAK25 = 2, - SAY_ENTER = 3, - SAY_INTRO = 4, - SAY_DEATH = 5, - SAY_WIN = 6, - SAY_ORCS_ENTER = 7, + SAY_WEAK75 = 0, + SAY_WEAK50 = 1, + SAY_WEAK25 = 2, + SAY_ENTER = 3, + SAY_INTRO = 4, + SAY_DEATH = 5, + SAY_WIN = 6, + SAY_ORCS_ENTER = 7, - SAY_ORCS_ANSWER = 0 + SAY_ORCS_ANSWER = 0 }; enum medivhSpells { - SPELL_MANA_SHIELD = 31635, - SPELL_MEDIVH_CHANNEL = 31556, - SPELL_BLACK_CRYSTAL = 32563, - SPELL_PORTAL_CRYSTALS = 32564, - SPELL_BANISH_PURPLE = 32566, - SPELL_BANISH_GREEN = 32567, + SPELL_MANA_SHIELD = 31635, + SPELL_MEDIVH_CHANNEL = 31556, + SPELL_BLACK_CRYSTAL = 32563, + SPELL_PORTAL_CRYSTALS = 32564, + SPELL_BANISH_PURPLE = 32566, + SPELL_BANISH_GREEN = 32567, - SPELL_CORRUPT = 31326, - SPELL_CORRUPT_AEONUS = 37853, + SPELL_CORRUPT = 31326, + SPELL_CORRUPT_AEONUS = 37853, }; enum medivhMisc { - NPC_DP_EMITTER_STALKER = 18582, - NPC_DP_CRYSTAL_STALKER = 18553, - NPC_SHADOW_COUNCIL_ENFORCER = 17023, - GO_DARK_PORTAL = 185103, + NPC_DP_EMITTER_STALKER = 18582, + NPC_DP_CRYSTAL_STALKER = 18553, + NPC_SHADOW_COUNCIL_ENFORCER = 17023, + GO_DARK_PORTAL = 185103, - EVENT_CHECK_HEALTH_25 = 1, - EVENT_CHECK_HEALTH_50 = 2, - EVENT_CHECK_HEALTH_75 = 3, - EVENT_SUMMON_CRYSTAL = 4, - EVENT_SUMMON_FLYING_CRYSTAL = 5, + EVENT_CHECK_HEALTH_25 = 1, + EVENT_CHECK_HEALTH_50 = 2, + EVENT_CHECK_HEALTH_75 = 3, + EVENT_SUMMON_CRYSTAL = 4, + EVENT_SUMMON_FLYING_CRYSTAL = 5, - EVENT_OUTRO_1 = 10, - EVENT_OUTRO_2 = 11, - EVENT_OUTRO_3 = 12, - EVENT_OUTRO_4 = 13, - EVENT_OUTRO_5 = 14, - EVENT_OUTRO_6 = 15, - EVENT_OUTRO_7 = 16, - EVENT_OUTRO_8 = 17 + EVENT_OUTRO_1 = 10, + EVENT_OUTRO_2 = 11, + EVENT_OUTRO_3 = 12, + EVENT_OUTRO_4 = 13, + EVENT_OUTRO_5 = 14, + EVENT_OUTRO_6 = 15, + EVENT_OUTRO_7 = 16, + EVENT_OUTRO_8 = 17 }; class NpcRunToHome : public BasicEvent { public: - NpcRunToHome(Creature& owner) : _owner(owner) { } + NpcRunToHome(Creature& owner) : _owner(owner) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - _owner.GetMotionMaster()->MoveTargetedHome(); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + _owner.GetMotionMaster()->MoveTargetedHome(); + return true; + } private: - Creature& _owner; + Creature& _owner; }; class npc_medivh_bm : public CreatureScript @@ -89,184 +89,184 @@ public: { instance = creature->GetInstanceScript(); - groundArray.clear(); - airArray.clear(); + groundArray.clear(); + airArray.clear(); - groundArray.push_back(G3D::Vector3(creature->GetPositionX() + 8.0f, creature->GetPositionY(), creature->GetPositionZ())); - airArray.push_back(G3D::Vector3(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ())); - for (uint8 i = 0; i < 10; ++i) - groundArray.push_back(G3D::Vector3(creature->GetPositionX() + 8.0f*cos(2.0f*M_PI*i/10.0f), creature->GetPositionY() + 8.0f*sin(2.0f*M_PI*i/10.0f), creature->GetPositionZ())); + groundArray.push_back(G3D::Vector3(creature->GetPositionX() + 8.0f, creature->GetPositionY(), creature->GetPositionZ())); + airArray.push_back(G3D::Vector3(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ())); + for (uint8 i = 0; i < 10; ++i) + groundArray.push_back(G3D::Vector3(creature->GetPositionX() + 8.0f*cos(2.0f*M_PI*i/10.0f), creature->GetPositionY() + 8.0f*sin(2.0f*M_PI*i/10.0f), creature->GetPositionZ())); - for (uint8 i = 0; i < 40; ++i) - airArray.push_back(G3D::Vector3(creature->GetPositionX() + i*0.25f*cos(2.0f*M_PI*i/10.0f), creature->GetPositionY() + i*0.25f*sin(2.0f*M_PI*i/10.0f), creature->GetPositionZ() + i/4.0f)); - for (uint8 i = 40; i < 80; ++i) - airArray.push_back(G3D::Vector3(creature->GetPositionX() + 10.0f*cos(2.0f*M_PI*i/10.0f), creature->GetPositionY() + 10.0f*sin(2.0f*M_PI*i/10.0f), creature->GetPositionZ() + i/4.0f)); + for (uint8 i = 0; i < 40; ++i) + airArray.push_back(G3D::Vector3(creature->GetPositionX() + i*0.25f*cos(2.0f*M_PI*i/10.0f), creature->GetPositionY() + i*0.25f*sin(2.0f*M_PI*i/10.0f), creature->GetPositionZ() + i/4.0f)); + for (uint8 i = 40; i < 80; ++i) + airArray.push_back(G3D::Vector3(creature->GetPositionX() + 10.0f*cos(2.0f*M_PI*i/10.0f), creature->GetPositionY() + 10.0f*sin(2.0f*M_PI*i/10.0f), creature->GetPositionZ() + i/4.0f)); } InstanceScript* instance; - EventMap events; - Movement::PointsArray groundArray; - Movement::PointsArray airArray; + EventMap events; + Movement::PointsArray groundArray; + Movement::PointsArray airArray; void Reset() { - events.Reset(); - me->CastSpell(me, SPELL_MANA_SHIELD, true); + events.Reset(); + me->CastSpell(me, SPELL_MANA_SHIELD, true); - if (instance->GetData(TYPE_AEONUS) != DONE) - me->CastSpell(me, SPELL_MEDIVH_CHANNEL, false); + if (instance->GetData(TYPE_AEONUS) != DONE) + me->CastSpell(me, SPELL_MEDIVH_CHANNEL, false); } - void JustSummoned(Creature* summon) - { - instance->SetData64(DATA_SUMMONED_NPC, summon->GetGUID()); - if (summon->GetEntry() == NPC_DP_CRYSTAL_STALKER) - { - summon->DespawnOrUnsummon(25000); - summon->CastSpell(summon, RAND(SPELL_BANISH_PURPLE, SPELL_BANISH_GREEN), true); - summon->GetMotionMaster()->MoveSplinePath(&airArray); - } - else if (summon->GetEntry() == NPC_DP_EMITTER_STALKER) - { - summon->CastSpell(summon, SPELL_BLACK_CRYSTAL, true); - Movement::MoveSplineInit init(summon); - init.MovebyPath(groundArray); - init.SetCyclic(); - init.Launch(); - } - } + void JustSummoned(Creature* summon) + { + instance->SetData64(DATA_SUMMONED_NPC, summon->GetGUID()); + if (summon->GetEntry() == NPC_DP_CRYSTAL_STALKER) + { + summon->DespawnOrUnsummon(25000); + summon->CastSpell(summon, RAND(SPELL_BANISH_PURPLE, SPELL_BANISH_GREEN), true); + summon->GetMotionMaster()->MoveSplinePath(&airArray); + } + else if (summon->GetEntry() == NPC_DP_EMITTER_STALKER) + { + summon->CastSpell(summon, SPELL_BLACK_CRYSTAL, true); + Movement::MoveSplineInit init(summon); + init.MovebyPath(groundArray); + init.SetCyclic(); + init.Launch(); + } + } - void SummonedCreatureDespawn(Creature* summon) - { - instance->SetData64(DATA_DELETED_NPC, summon->GetGUID()); - } + void SummonedCreatureDespawn(Creature* summon) + { + instance->SetData64(DATA_DELETED_NPC, summon->GetGUID()); + } void MoveInLineOfSight(Unit* who) { - if (!events.Empty() || instance->GetData(TYPE_AEONUS) == DONE) - return; + if (!events.Empty() || instance->GetData(TYPE_AEONUS) == DONE) + return; if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 20.0f)) { Talk(SAY_ENTER); - instance->SetData(DATA_MEDIVH, 1); - me->CastSpell(me, SPELL_MEDIVH_CHANNEL, false); + instance->SetData(DATA_MEDIVH, 1); + me->CastSpell(me, SPELL_MEDIVH_CHANNEL, false); - events.ScheduleEvent(EVENT_CHECK_HEALTH_75, 500); - events.ScheduleEvent(EVENT_CHECK_HEALTH_50, 500); - events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 500); - events.ScheduleEvent(EVENT_SUMMON_CRYSTAL, 2000); - events.ScheduleEvent(EVENT_SUMMON_CRYSTAL, 4000); - events.ScheduleEvent(EVENT_SUMMON_CRYSTAL, 6000); - events.ScheduleEvent(EVENT_SUMMON_FLYING_CRYSTAL, 8000); + events.ScheduleEvent(EVENT_CHECK_HEALTH_75, 500); + events.ScheduleEvent(EVENT_CHECK_HEALTH_50, 500); + events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 500); + events.ScheduleEvent(EVENT_SUMMON_CRYSTAL, 2000); + events.ScheduleEvent(EVENT_SUMMON_CRYSTAL, 4000); + events.ScheduleEvent(EVENT_SUMMON_CRYSTAL, 6000); + events.ScheduleEvent(EVENT_SUMMON_FLYING_CRYSTAL, 8000); } } void AttackStart(Unit* ) { } - void DoAction(int32 param) - { - if (param == ACTION_OUTRO) - { - events.Reset(); - events.ScheduleEvent(EVENT_OUTRO_1, 4000); - me->InterruptNonMeleeSpells(true); + void DoAction(int32 param) + { + if (param == ACTION_OUTRO) + { + events.Reset(); + events.ScheduleEvent(EVENT_OUTRO_1, 4000); + me->InterruptNonMeleeSpells(true); - me->SummonGameObject(GO_DARK_PORTAL, -2086.0f, 7125.6215f, 30.5f, 6.148f, 0.0f, 0.0f, 0.0f, 0.0f, 0); - } - } + me->SummonGameObject(GO_DARK_PORTAL, -2086.0f, 7125.6215f, 30.5f, 6.148f, 0.0f, 0.0f, 0.0f, 0.0f, 0); + } + } void JustDied(Unit* ) { - me->SetRespawnTime(DAY); - events.Reset(); - Talk(SAY_DEATH); + me->SetRespawnTime(DAY); + events.Reset(); + Talk(SAY_DEATH); } void UpdateAI(uint32 diff) { - events.Update(diff); - switch (uint32 eventId = events.ExecuteEvent()) - { - case EVENT_CHECK_HEALTH_25: - case EVENT_CHECK_HEALTH_50: - case EVENT_CHECK_HEALTH_75: - if (instance->GetData(DATA_SHIELD_PERCENT) <= eventId*25) - { - Talk(eventId-1); - break; - } - events.ScheduleEvent(eventId, 500); - break; - case EVENT_SUMMON_CRYSTAL: - me->SummonCreature(NPC_DP_EMITTER_STALKER, me->GetPositionX() + 8.0f, me->GetPositionY(), me->GetPositionZ()); - break; - case EVENT_SUMMON_FLYING_CRYSTAL: - me->CastSpell(me, SPELL_PORTAL_CRYSTALS, true); - events.ScheduleEvent(EVENT_SUMMON_FLYING_CRYSTAL, 1000); - break; - case EVENT_OUTRO_1: - me->SetFacingTo(6.21f); - Talk(SAY_WIN); - events.ScheduleEvent(EVENT_OUTRO_2, 17000); - break; - case EVENT_OUTRO_2: - me->SetFacingTo(3.07f); - events.ScheduleEvent(EVENT_OUTRO_3, 2000); - break; - case EVENT_OUTRO_3: - SummonOrcs(-2046.158f, -3.0f, 37000, 30000, true); - events.ScheduleEvent(EVENT_OUTRO_4, 2000); - break; - case EVENT_OUTRO_4: - SummonOrcs(-2055.97f, -2.0f, 33000, 28000, false); - events.ScheduleEvent(EVENT_OUTRO_5, 2000); - break; - case EVENT_OUTRO_5: - SummonOrcs(-2064.0f, -1.5f, 29000, 26000, false); - events.ScheduleEvent(EVENT_OUTRO_6, 2000); - break; - case EVENT_OUTRO_6: - SummonOrcs(-2074.35f, -0.1f, 26000, 24000, false); - events.ScheduleEvent(EVENT_OUTRO_7, 7000); - break; - case EVENT_OUTRO_7: - Talk(SAY_ORCS_ENTER); - events.ScheduleEvent(EVENT_OUTRO_8, 7000); - break; - case EVENT_OUTRO_8: - if (Creature* cr = me->FindNearestCreature(NPC_SHADOW_COUNCIL_ENFORCER, 20.0f)) - { - cr->SetFacingTo(3.07f); - cr->AI()->Talk(SAY_ORCS_ANSWER); - } - break; + events.Update(diff); + switch (uint32 eventId = events.ExecuteEvent()) + { + case EVENT_CHECK_HEALTH_25: + case EVENT_CHECK_HEALTH_50: + case EVENT_CHECK_HEALTH_75: + if (instance->GetData(DATA_SHIELD_PERCENT) <= eventId*25) + { + Talk(eventId-1); + break; + } + events.ScheduleEvent(eventId, 500); + break; + case EVENT_SUMMON_CRYSTAL: + me->SummonCreature(NPC_DP_EMITTER_STALKER, me->GetPositionX() + 8.0f, me->GetPositionY(), me->GetPositionZ()); + break; + case EVENT_SUMMON_FLYING_CRYSTAL: + me->CastSpell(me, SPELL_PORTAL_CRYSTALS, true); + events.ScheduleEvent(EVENT_SUMMON_FLYING_CRYSTAL, 1000); + break; + case EVENT_OUTRO_1: + me->SetFacingTo(6.21f); + Talk(SAY_WIN); + events.ScheduleEvent(EVENT_OUTRO_2, 17000); + break; + case EVENT_OUTRO_2: + me->SetFacingTo(3.07f); + events.ScheduleEvent(EVENT_OUTRO_3, 2000); + break; + case EVENT_OUTRO_3: + SummonOrcs(-2046.158f, -3.0f, 37000, 30000, true); + events.ScheduleEvent(EVENT_OUTRO_4, 2000); + break; + case EVENT_OUTRO_4: + SummonOrcs(-2055.97f, -2.0f, 33000, 28000, false); + events.ScheduleEvent(EVENT_OUTRO_5, 2000); + break; + case EVENT_OUTRO_5: + SummonOrcs(-2064.0f, -1.5f, 29000, 26000, false); + events.ScheduleEvent(EVENT_OUTRO_6, 2000); + break; + case EVENT_OUTRO_6: + SummonOrcs(-2074.35f, -0.1f, 26000, 24000, false); + events.ScheduleEvent(EVENT_OUTRO_7, 7000); + break; + case EVENT_OUTRO_7: + Talk(SAY_ORCS_ENTER); + events.ScheduleEvent(EVENT_OUTRO_8, 7000); + break; + case EVENT_OUTRO_8: + if (Creature* cr = me->FindNearestCreature(NPC_SHADOW_COUNCIL_ENFORCER, 20.0f)) + { + cr->SetFacingTo(3.07f); + cr->AI()->Talk(SAY_ORCS_ANSWER); + } + break; - + - } + } } - void SummonOrcs(float x, float y, uint32 duration, uint32 homeTime, bool first) - { - for (uint8 i = 0; i < 6; ++i) - { - if (Creature* cr = me->SummonCreature(NPC_SHADOW_COUNCIL_ENFORCER, -2091.731f, 7133.083f - 3.0f*i, 34.589f, 0.0f)) - { - cr->GetMotionMaster()->MovePoint(0, (first && i == 3) ? x+2.0f : x, cr->GetPositionY()+y, cr->GetMap()->GetHeight(x, cr->GetPositionY()+y, MAX_HEIGHT, true)); - cr->m_Events.AddEvent(new NpcRunToHome(*cr), cr->m_Events.CalculateTime(homeTime+urand(0, 2000))); - cr->DespawnOrUnsummon(duration+urand(0, 2000)); - } - } - } + void SummonOrcs(float x, float y, uint32 duration, uint32 homeTime, bool first) + { + for (uint8 i = 0; i < 6; ++i) + { + if (Creature* cr = me->SummonCreature(NPC_SHADOW_COUNCIL_ENFORCER, -2091.731f, 7133.083f - 3.0f*i, 34.589f, 0.0f)) + { + cr->GetMotionMaster()->MovePoint(0, (first && i == 3) ? x+2.0f : x, cr->GetPositionY()+y, cr->GetMap()->GetHeight(x, cr->GetPositionY()+y, MAX_HEIGHT, true)); + cr->m_Events.AddEvent(new NpcRunToHome(*cr), cr->m_Events.CalculateTime(homeTime+urand(0, 2000))); + cr->DespawnOrUnsummon(duration+urand(0, 2000)); + } + } + } }; }; enum timeRift { - EVENT_SUMMON_AT_RIFT = 1, - EVENT_CHECK_DEATH = 2 + EVENT_SUMMON_AT_RIFT = 1, + EVENT_CHECK_DEATH = 2 }; class npc_time_rift : public CreatureScript @@ -282,45 +282,45 @@ public: struct npc_time_riftAI : public NullCreatureAI { npc_time_riftAI(Creature* creature) : NullCreatureAI(creature) - { - instance = creature->GetInstanceScript(); - riftKeeperGUID = 0; - } + { + instance = creature->GetInstanceScript(); + riftKeeperGUID = 0; + } - EventMap events; - InstanceScript* instance; - uint64 riftKeeperGUID; + EventMap events; + InstanceScript* instance; + uint64 riftKeeperGUID; void Reset() { - if (instance->GetData(DATA_RIFT_NUMBER) >= 18) - { - me->DespawnOrUnsummon(30000); - return; - } + if (instance->GetData(DATA_RIFT_NUMBER) >= 18) + { + me->DespawnOrUnsummon(30000); + return; + } - events.ScheduleEvent(EVENT_SUMMON_AT_RIFT, 16000); - events.ScheduleEvent(EVENT_CHECK_DEATH, 8000); + events.ScheduleEvent(EVENT_SUMMON_AT_RIFT, 16000); + events.ScheduleEvent(EVENT_CHECK_DEATH, 8000); } - void SetGUID(uint64 guid, int32) - { - riftKeeperGUID = guid; - } + void SetGUID(uint64 guid, int32) + { + riftKeeperGUID = guid; + } void DoSummonAtRift(uint32 entry) { Position pos; me->GetNearPosition(pos, 10.0f, 2*M_PI*rand_norm()); - if (Creature* summon = me->SummonCreature(entry, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000)) + if (Creature* summon = me->SummonCreature(entry, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000)) if (Unit* medivh = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MEDIVH))) - { - float o = medivh->GetAngle(summon)+frand(-1.0f, 1.0f); - summon->SetHomePosition(medivh->GetPositionX() + 14.0f*cos(o), medivh->GetPositionY() + 14.0f*sin(o), medivh->GetPositionZ(), summon->GetAngle(medivh)); - summon->GetMotionMaster()->MoveTargetedHome(); - summon->SetReactState(REACT_DEFENSIVE); - } + { + float o = medivh->GetAngle(summon)+frand(-1.0f, 1.0f); + summon->SetHomePosition(medivh->GetPositionX() + 14.0f*cos(o), medivh->GetPositionY() + 14.0f*sin(o), medivh->GetPositionZ(), summon->GetAngle(medivh)); + summon->GetMotionMaster()->MoveTargetedHome(); + summon->SetReactState(REACT_DEFENSIVE); + } } void DoSelectSummon() @@ -328,75 +328,75 @@ public: uint32 entry = RAND(NPC_INFINITE_ASSASIN, NPC_INFINITE_WHELP, NPC_INFINITE_CRONOMANCER, NPC_INFINITE_EXECUTIONER, NPC_INFINITE_VANQUISHER); if (entry == NPC_INFINITE_WHELP) { - DoSummonAtRift(entry); - DoSummonAtRift(entry); - DoSummonAtRift(entry); + DoSummonAtRift(entry); + DoSummonAtRift(entry); + DoSummonAtRift(entry); } - else - DoSummonAtRift(entry); + else + DoSummonAtRift(entry); } void UpdateAI(uint32 diff) { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_SUMMON_AT_RIFT: - DoSelectSummon(); - events.ScheduleEvent(EVENT_SUMMON_AT_RIFT, 15000); - break; - case EVENT_CHECK_DEATH: - if (!me->HasUnitState(UNIT_STATE_CASTING)) - { - Creature* riftKeeper = ObjectAccessor::GetCreature(*me, riftKeeperGUID); - if (!riftKeeper || !riftKeeper->IsAlive()) - { - instance->SetData(DATA_RIFT_KILLED, 1); - me->DespawnOrUnsummon(0); - break; - } - else - me->CastSpell(riftKeeper, SPELL_RIFT_CHANNEL, false); - } - events.ScheduleEvent(EVENT_CHECK_DEATH, 500); - break; - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_SUMMON_AT_RIFT: + DoSelectSummon(); + events.ScheduleEvent(EVENT_SUMMON_AT_RIFT, 15000); + break; + case EVENT_CHECK_DEATH: + if (!me->HasUnitState(UNIT_STATE_CASTING)) + { + Creature* riftKeeper = ObjectAccessor::GetCreature(*me, riftKeeperGUID); + if (!riftKeeper || !riftKeeper->IsAlive()) + { + instance->SetData(DATA_RIFT_KILLED, 1); + me->DespawnOrUnsummon(0); + break; + } + else + me->CastSpell(riftKeeper, SPELL_RIFT_CHANNEL, false); + } + events.ScheduleEvent(EVENT_CHECK_DEATH, 500); + break; + } } }; }; class spell_black_morass_corrupt_medivh : public SpellScriptLoader { - public: - spell_black_morass_corrupt_medivh() : SpellScriptLoader("spell_black_morass_corrupt_medivh") { } + public: + spell_black_morass_corrupt_medivh() : SpellScriptLoader("spell_black_morass_corrupt_medivh") { } - class spell_black_morass_corrupt_medivh_AuraScript : public AuraScript - { - PrepareAuraScript(spell_black_morass_corrupt_medivh_AuraScript); + class spell_black_morass_corrupt_medivh_AuraScript : public AuraScript + { + PrepareAuraScript(spell_black_morass_corrupt_medivh_AuraScript); - void PeriodicTick(AuraEffect const* /*aurEff*/) - { - if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript()) - instance->SetData(DATA_DAMAGE_SHIELD, 1); - } + void PeriodicTick(AuraEffect const* /*aurEff*/) + { + if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript()) + instance->SetData(DATA_DAMAGE_SHIELD, 1); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_morass_corrupt_medivh_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_morass_corrupt_medivh_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } - InstanceScript* _instance; - }; + InstanceScript* _instance; + }; - AuraScript* GetAuraScript() const - { - return new spell_black_morass_corrupt_medivh_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_black_morass_corrupt_medivh_AuraScript(); + } }; void AddSC_the_black_morass() { new npc_medivh_bm(); new npc_time_rift(); - new spell_black_morass_corrupt_medivh(); + new spell_black_morass_corrupt_medivh(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h index 9faa1778f..0923449e4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h @@ -7,19 +7,19 @@ REWRITTEN BY XINEF enum DataTypes { - TYPE_CHRONO_LORD_DEJA = 0, - TYPE_TEMPORUS = 1, - TYPE_AEONUS = 2, - MAX_ENCOUNTER = 3, + TYPE_CHRONO_LORD_DEJA = 0, + TYPE_TEMPORUS = 1, + TYPE_AEONUS = 2, + MAX_ENCOUNTER = 3, - DATA_MEDIVH = 10, - DATA_RIFT_KILLED = 11, - DATA_DAMAGE_SHIELD = 12, - DATA_SHIELD_PERCENT = 13, - DATA_RIFT_NUMBER = 14, + DATA_MEDIVH = 10, + DATA_RIFT_KILLED = 11, + DATA_DAMAGE_SHIELD = 12, + DATA_SHIELD_PERCENT = 13, + DATA_RIFT_NUMBER = 14, - DATA_SUMMONED_NPC = 20, - DATA_DELETED_NPC = 21, + DATA_SUMMONED_NPC = 20, + DATA_DELETED_NPC = 21, }; enum WorldStateIds @@ -37,36 +37,36 @@ enum QuestIds enum CreatureIds { - NPC_MEDIVH = 15608, - NPC_TIME_RIFT = 17838, - NPC_TIME_KEEPER = 17918, + NPC_MEDIVH = 15608, + NPC_TIME_RIFT = 17838, + NPC_TIME_KEEPER = 17918, - NPC_RIFT_KEEPER_WARLOCK = 21104, - NPC_RIFT_KEEPER_MAGE = 21148, - NPC_RIFT_LORD = 17839, - NPC_RIFT_LORD_2 = 21140, + NPC_RIFT_KEEPER_WARLOCK = 21104, + NPC_RIFT_KEEPER_MAGE = 21148, + NPC_RIFT_LORD = 17839, + NPC_RIFT_LORD_2 = 21140, - NPC_CHRONO_LORD_DEJA = 17879, - NPC_INFINITE_CHRONO_LORD = 21697, - NPC_TEMPORUS = 17880, - NPC_INFINITE_TIMEREAVER = 21698, - NPC_AEONUS = 17881, + NPC_CHRONO_LORD_DEJA = 17879, + NPC_INFINITE_CHRONO_LORD = 21697, + NPC_TEMPORUS = 17880, + NPC_INFINITE_TIMEREAVER = 21698, + NPC_AEONUS = 17881, - NPC_INFINITE_ASSASIN = 17835, - NPC_INFINITE_WHELP = 21818, - NPC_INFINITE_CRONOMANCER = 17892, - NPC_INFINITE_EXECUTIONER = 18994, - NPC_INFINITE_VANQUISHER = 18995 + NPC_INFINITE_ASSASIN = 17835, + NPC_INFINITE_WHELP = 21818, + NPC_INFINITE_CRONOMANCER = 17892, + NPC_INFINITE_EXECUTIONER = 18994, + NPC_INFINITE_VANQUISHER = 18995 }; enum Misc -{ - SPELL_RIFT_CHANNEL = 31387, +{ + SPELL_RIFT_CHANNEL = 31387, - EVENT_NEXT_PORTAL = 1, - EVENT_SUMMON_KEEPER = 2, + EVENT_NEXT_PORTAL = 1, + EVENT_SUMMON_KEEPER = 2, - ACTION_OUTRO = 1 + ACTION_OUTRO = 1 }; #endif diff --git a/src/server/scripts/Kalimdor/DireMaul/dire_maul.h b/src/server/scripts/Kalimdor/DireMaul/dire_maul.h index dd99d207f..b3d4bef39 100644 --- a/src/server/scripts/Kalimdor/DireMaul/dire_maul.h +++ b/src/server/scripts/Kalimdor/DireMaul/dire_maul.h @@ -7,25 +7,25 @@ REWRITTEN BY XINEF enum DataTypes { - TYPE_EAST_WING_PROGRESS = 0, - TYPE_WEST_WING_PROGRESS = 1, - TYPE_PYLONS_STATE = 2, - TYPE_NORTH_WING_PROGRESS = 3, - TYPE_NORTH_WING_BOSSES = 4, + TYPE_EAST_WING_PROGRESS = 0, + TYPE_WEST_WING_PROGRESS = 1, + TYPE_PYLONS_STATE = 2, + TYPE_NORTH_WING_PROGRESS = 3, + TYPE_NORTH_WING_BOSSES = 4, - ALL_PYLONS_OFF = 0x1F + ALL_PYLONS_OFF = 0x1F }; enum GoIds { - GO_DIRE_MAUL_FORCE_FIELD = 179503, - GO_GORDOK_TRIBUTE = 179564 + GO_DIRE_MAUL_FORCE_FIELD = 179503, + GO_GORDOK_TRIBUTE = 179564 }; enum NpcIds { - NPC_IMMOL_THAR = 11496, - NPC_HIGHBORNE_SUMMONER = 11466 + NPC_IMMOL_THAR = 11496, + NPC_HIGHBORNE_SUMMONER = 11466 }; #endif diff --git a/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp b/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp index 1e3078c44..0c6e9d0e4 100644 --- a/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp +++ b/src/server/scripts/Kalimdor/DireMaul/instance_dire_maul.cpp @@ -8,146 +8,146 @@ REWRITTEN BY XINEF class instance_dire_maul : public InstanceMapScript { - public: - instance_dire_maul() : InstanceMapScript("instance_dire_maul", 429) { } + public: + instance_dire_maul() : InstanceMapScript("instance_dire_maul", 429) { } - struct instance_dire_maul_InstanceMapScript : public InstanceScript - { - instance_dire_maul_InstanceMapScript(Map* map) : InstanceScript(map) { } + struct instance_dire_maul_InstanceMapScript : public InstanceScript + { + instance_dire_maul_InstanceMapScript(Map* map) : InstanceScript(map) { } - void Initialize() - { - _eastWingProgress = 0; - _westWingProgress = 0; - _pylonsState = 0; - _northWingProgress = 0; - _northWingBosses = 0; - _immoltharGUID = 0; - } + void Initialize() + { + _eastWingProgress = 0; + _westWingProgress = 0; + _pylonsState = 0; + _northWingProgress = 0; + _northWingBosses = 0; + _immoltharGUID = 0; + } - void OnCreatureCreate(Creature* creature) - { - switch (creature->GetEntry()) - { - case NPC_IMMOL_THAR: - _immoltharGUID = creature->GetGUID(); - break; - case NPC_HIGHBORNE_SUMMONER: - if (_pylonsState == ALL_PYLONS_OFF) - creature->DespawnOrUnsummon(5000); - break; - } - } + void OnCreatureCreate(Creature* creature) + { + switch (creature->GetEntry()) + { + case NPC_IMMOL_THAR: + _immoltharGUID = creature->GetGUID(); + break; + case NPC_HIGHBORNE_SUMMONER: + if (_pylonsState == ALL_PYLONS_OFF) + creature->DespawnOrUnsummon(5000); + break; + } + } - void OnGameObjectCreate(GameObject* gameobject) - { - switch (gameobject->GetEntry()) - { - case GO_DIRE_MAUL_FORCE_FIELD: - if (_pylonsState == ALL_PYLONS_OFF) - gameobject->SetGoState(GO_STATE_ACTIVE); - break; - case GO_GORDOK_TRIBUTE: - { - uint32 fullLootMode = 0x3F; - for (uint32 i = 0; i < _northWingBosses; ++i) - fullLootMode >>= 1; + void OnGameObjectCreate(GameObject* gameobject) + { + switch (gameobject->GetEntry()) + { + case GO_DIRE_MAUL_FORCE_FIELD: + if (_pylonsState == ALL_PYLONS_OFF) + gameobject->SetGoState(GO_STATE_ACTIVE); + break; + case GO_GORDOK_TRIBUTE: + { + uint32 fullLootMode = 0x3F; + for (uint32 i = 0; i < _northWingBosses; ++i) + fullLootMode >>= 1; - gameobject->SetLootMode(fullLootMode); - break; - } - } - } + gameobject->SetLootMode(fullLootMode); + break; + } + } + } - void SetData(uint32 type, uint32 data) - { - switch (type) - { - case TYPE_EAST_WING_PROGRESS: - _eastWingProgress = data; - instance->LoadGrid(-56.59f, -269.12f); - break; - case TYPE_WEST_WING_PROGRESS: - _westWingProgress = data; - instance->LoadGrid(132.626f, 625.913f); - break; - case TYPE_NORTH_WING_PROGRESS: - _northWingProgress = data; - break; - case TYPE_NORTH_WING_BOSSES: - _northWingBosses |= (1 << _northWingBosses); - break; - case TYPE_PYLONS_STATE: - if (_pylonsState & data) - return; - _pylonsState |= data; - if (_pylonsState == ALL_PYLONS_OFF) // all five active, 31 - { - instance->LoadGrid(-38.08f, 812.44f); - if (Creature* immol = instance->GetCreature(_immoltharGUID)) - { - immol->setActive(true); - immol->GetAI()->SetData(1, 1); - } - } - break; + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case TYPE_EAST_WING_PROGRESS: + _eastWingProgress = data; + instance->LoadGrid(-56.59f, -269.12f); + break; + case TYPE_WEST_WING_PROGRESS: + _westWingProgress = data; + instance->LoadGrid(132.626f, 625.913f); + break; + case TYPE_NORTH_WING_PROGRESS: + _northWingProgress = data; + break; + case TYPE_NORTH_WING_BOSSES: + _northWingBosses |= (1 << _northWingBosses); + break; + case TYPE_PYLONS_STATE: + if (_pylonsState & data) + return; + _pylonsState |= data; + if (_pylonsState == ALL_PYLONS_OFF) // all five active, 31 + { + instance->LoadGrid(-38.08f, 812.44f); + if (Creature* immol = instance->GetCreature(_immoltharGUID)) + { + immol->setActive(true); + immol->GetAI()->SetData(1, 1); + } + } + break; - } + } - SaveToDB(); - } + SaveToDB(); + } - uint32 GetData(uint32 type) const - { - if (type == TYPE_EAST_WING_PROGRESS) - return _eastWingProgress; - else if (type == TYPE_WEST_WING_PROGRESS) - return _westWingProgress; - else if (type == TYPE_NORTH_WING_PROGRESS) - return _northWingProgress; + uint32 GetData(uint32 type) const + { + if (type == TYPE_EAST_WING_PROGRESS) + return _eastWingProgress; + else if (type == TYPE_WEST_WING_PROGRESS) + return _westWingProgress; + else if (type == TYPE_NORTH_WING_PROGRESS) + return _northWingProgress; - return 0; - } + return 0; + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "D M " << _eastWingProgress << ' ' << _westWingProgress << ' ' << _pylonsState << ' ' << _northWingProgress << ' ' << _northWingBosses; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "D M " << _eastWingProgress << ' ' << _westWingProgress << ' ' << _pylonsState << ' ' << _northWingProgress << ' ' << _northWingBosses; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - return; + void Load(const char* in) + { + if (!in) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'D' && dataHead2 == 'M') - { - loadStream >> _eastWingProgress; - loadStream >> _westWingProgress; - loadStream >> _pylonsState; - loadStream >> _northWingProgress; - loadStream >> _northWingBosses; - } - } + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'D' && dataHead2 == 'M') + { + loadStream >> _eastWingProgress; + loadStream >> _westWingProgress; + loadStream >> _pylonsState; + loadStream >> _northWingProgress; + loadStream >> _northWingBosses; + } + } - private: - uint32 _eastWingProgress; - uint32 _westWingProgress; - uint32 _pylonsState; - uint32 _northWingProgress; - uint32 _northWingBosses; + private: + uint32 _eastWingProgress; + uint32 _westWingProgress; + uint32 _pylonsState; + uint32 _northWingProgress; + uint32 _northWingBosses; - uint64 _immoltharGUID; - }; + uint64 _immoltharGUID; + }; - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_dire_maul_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_dire_maul_InstanceMapScript(map); + } }; void AddSC_instance_dire_maul() diff --git a/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp b/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp index be4a1a5b5..b8eae70bb 100644 --- a/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp @@ -8,78 +8,78 @@ REWRITTEN BY XINEF class instance_maraudon : public InstanceMapScript { - public: - instance_maraudon() : InstanceMapScript("instance_maraudon", 349) { } + public: + instance_maraudon() : InstanceMapScript("instance_maraudon", 349) { } - struct instance_maraudon_InstanceMapScript : public InstanceScript - { - instance_maraudon_InstanceMapScript(Map* map) : InstanceScript(map) - { - } + struct instance_maraudon_InstanceMapScript : public InstanceScript + { + instance_maraudon_InstanceMapScript(Map* map) : InstanceScript(map) + { + } - void Initialize() - { - memset(&_encounters, 0, sizeof(_encounters)); - } + void Initialize() + { + memset(&_encounters, 0, sizeof(_encounters)); + } - void OnGameObjectCreate(GameObject* gameobject) - { - switch (gameobject->GetEntry()) - { - case GO_CORRUPTION_SPEWER: - if (_encounters[TYPE_NOXXION] == DONE) - HandleGameObject(0, true, gameobject); - break; - } - } + void OnGameObjectCreate(GameObject* gameobject) + { + switch (gameobject->GetEntry()) + { + case GO_CORRUPTION_SPEWER: + if (_encounters[TYPE_NOXXION] == DONE) + HandleGameObject(0, true, gameobject); + break; + } + } - void SetData(uint32 type, uint32 data) - { - switch (type) - { - case TYPE_NOXXION: - _encounters[type] = data; - break; - } + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case TYPE_NOXXION: + _encounters[type] = data; + break; + } - if (data == DONE) - SaveToDB(); - } + if (data == DONE) + SaveToDB(); + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "M A " << _encounters[0]; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "M A " << _encounters[0]; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - return; + void Load(const char* in) + { + if (!in) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'M' && dataHead2 == 'A') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - loadStream >> _encounters[i]; - if (_encounters[i] == IN_PROGRESS) - _encounters[i] = NOT_STARTED; - } - } - } + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'M' && dataHead2 == 'A') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + loadStream >> _encounters[i]; + if (_encounters[i] == IN_PROGRESS) + _encounters[i] = NOT_STARTED; + } + } + } - private: - uint32 _encounters[MAX_ENCOUNTERS]; - }; + private: + uint32 _encounters[MAX_ENCOUNTERS]; + }; - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_maraudon_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_maraudon_InstanceMapScript(map); + } }; void AddSC_instance_maraudon() diff --git a/src/server/scripts/Kalimdor/Maraudon/maraudon.h b/src/server/scripts/Kalimdor/Maraudon/maraudon.h index dfba1ae3c..1f3c29ace 100644 --- a/src/server/scripts/Kalimdor/Maraudon/maraudon.h +++ b/src/server/scripts/Kalimdor/Maraudon/maraudon.h @@ -7,13 +7,13 @@ REWRITTEN BY XINEF enum DataTypes { - TYPE_NOXXION = 0, - MAX_ENCOUNTERS = 1, + TYPE_NOXXION = 0, + MAX_ENCOUNTERS = 1, }; enum GoIds { - GO_CORRUPTION_SPEWER = 178570 + GO_CORRUPTION_SPEWER = 178570 }; #endif diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index 7b7ae5ecf..4535c88f1 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -10,77 +10,77 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum // Spells { - SPELL_WINGBUFFET = 18500, - SPELL_FLAMEBREATH = 18435, - SPELL_CLEAVE = 68868, - SPELL_TAILSWEEP = 68867, - SPELL_FIREBALL = 18392, - SPELL_BELLOWINGROAR = 18431, + SPELL_WINGBUFFET = 18500, + SPELL_FLAMEBREATH = 18435, + SPELL_CLEAVE = 68868, + SPELL_TAILSWEEP = 68867, + SPELL_FIREBALL = 18392, + SPELL_BELLOWINGROAR = 18431, - SPELL_SUMMON_WHELP = 17646, - SPELL_SUMMON_LAIR_GUARD = 68968, - SPELL_ERUPTION = 17731, + SPELL_SUMMON_WHELP = 17646, + SPELL_SUMMON_LAIR_GUARD = 68968, + SPELL_ERUPTION = 17731, - SPELL_OLG_BLASTNOVA = 68958, - SPELL_OLG_IGNITEWEAPON = 68959, + SPELL_OLG_BLASTNOVA = 68958, + SPELL_OLG_IGNITEWEAPON = 68959, - SPELL_BREATH_N_TO_S = 17086, - SPELL_BREATH_S_TO_N = 18351, - SPELL_BREATH_E_TO_W = 18576, - SPELL_BREATH_W_TO_E = 18609, - SPELL_BREATH_SE_TO_NW = 18564, - SPELL_BREATH_NW_TO_SE = 18584, - SPELL_BREATH_SW_TO_NE = 18596, - SPELL_BREATH_NE_TO_SW = 18617, + SPELL_BREATH_N_TO_S = 17086, + SPELL_BREATH_S_TO_N = 18351, + SPELL_BREATH_E_TO_W = 18576, + SPELL_BREATH_W_TO_E = 18609, + SPELL_BREATH_SE_TO_NW = 18564, + SPELL_BREATH_NW_TO_SE = 18584, + SPELL_BREATH_SW_TO_NE = 18596, + SPELL_BREATH_NE_TO_SW = 18617, }; enum // Events { - EVENT_SPELL_WINGBUFFET = 1, - EVENT_SPELL_FLAMEBREATH = 2, - EVENT_SPELL_TAILSWEEP = 3, - EVENT_SPELL_CLEAVE = 4, - EVENT_START_PHASE_2 = 5, - EVENT_SPELL_FIREBALL_FIRST = 6, - EVENT_SPELL_FIREBALL_SECOND = 7, - EVENT_PHASE_2_STEP_CW = 8, - EVENT_PHASE_2_STEP_ACW = 9, - EVENT_PHASE_2_STEP_ACROSS = 10, - EVENT_SPELL_BREATH = 11, - EVENT_START_PHASE_3 = 12, - EVENT_PHASE_3_ATTACK = 13, - EVENT_SPELL_BELLOWINGROAR = 14, - EVENT_WHELP_SPAM = 15, - EVENT_SUMMON_LAIR_GUARD = 16, - EVENT_SUMMON_WHELP = 17, - EVENT_OLG_SPELL_BLASTNOVA = 18, - EVENT_OLG_SPELL_IGNITEWEAPON = 19, - EVENT_ERUPTION = 20, + EVENT_SPELL_WINGBUFFET = 1, + EVENT_SPELL_FLAMEBREATH = 2, + EVENT_SPELL_TAILSWEEP = 3, + EVENT_SPELL_CLEAVE = 4, + EVENT_START_PHASE_2 = 5, + EVENT_SPELL_FIREBALL_FIRST = 6, + EVENT_SPELL_FIREBALL_SECOND = 7, + EVENT_PHASE_2_STEP_CW = 8, + EVENT_PHASE_2_STEP_ACW = 9, + EVENT_PHASE_2_STEP_ACROSS = 10, + EVENT_SPELL_BREATH = 11, + EVENT_START_PHASE_3 = 12, + EVENT_PHASE_3_ATTACK = 13, + EVENT_SPELL_BELLOWINGROAR = 14, + EVENT_WHELP_SPAM = 15, + EVENT_SUMMON_LAIR_GUARD = 16, + EVENT_SUMMON_WHELP = 17, + EVENT_OLG_SPELL_BLASTNOVA = 18, + EVENT_OLG_SPELL_IGNITEWEAPON = 19, + EVENT_ERUPTION = 20, - EVENT_LIFTOFF = 31, - EVENT_FLY_S_TO_N = 32, - EVENT_LAND = 33, - EVENT_END_MANY_WHELPS_TIME, + EVENT_LIFTOFF = 31, + EVENT_FLY_S_TO_N = 32, + EVENT_LAND = 33, + EVENT_END_MANY_WHELPS_TIME, }; struct sOnyxMove { - uint8 CurrId, DestId; - uint32 spellId; - float x, y, z, o; + uint8 CurrId, DestId; + uint32 spellId; + float x, y, z, o; }; static sOnyxMove OnyxiaMoveData[] = { - {0, 0, 0, -64.496f, -214.906f, -84.4f, 0.0f}, // south ground - {1, 5, SPELL_BREATH_S_TO_N, -64.496f, -214.906f, -60.0f, 0.0f}, // south - {2, 6, SPELL_BREATH_SW_TO_NE, -59.809f, -190.758f, -60.0f, 7*M_PI/4}, // south-west - {3, 7, SPELL_BREATH_W_TO_E, -29.450f, -180.600f, -60.0f, M_PI+M_PI/2}, // west - {4, 8, SPELL_BREATH_NW_TO_SE, 6.895f, -180.246f, -60.0f, M_PI+M_PI/4}, // north-west - {5, 1, SPELL_BREATH_N_TO_S, 22.876f, -217.152f, -60.0f, M_PI}, // north - {6, 2, SPELL_BREATH_NE_TO_SW, 10.2191f, -247.912f, -60.0f, 3*M_PI/4}, // north-east - {7, 3, SPELL_BREATH_E_TO_W, -31.496f, -250.123f, -60.0f, M_PI/2}, // east - {8, 4, SPELL_BREATH_SE_TO_NW, -63.5156f, -240.096f, -60.0f, M_PI/4}, // south-east + {0, 0, 0, -64.496f, -214.906f, -84.4f, 0.0f}, // south ground + {1, 5, SPELL_BREATH_S_TO_N, -64.496f, -214.906f, -60.0f, 0.0f}, // south + {2, 6, SPELL_BREATH_SW_TO_NE, -59.809f, -190.758f, -60.0f, 7*M_PI/4}, // south-west + {3, 7, SPELL_BREATH_W_TO_E, -29.450f, -180.600f, -60.0f, M_PI+M_PI/2}, // west + {4, 8, SPELL_BREATH_NW_TO_SE, 6.895f, -180.246f, -60.0f, M_PI+M_PI/4}, // north-west + {5, 1, SPELL_BREATH_N_TO_S, 22.876f, -217.152f, -60.0f, M_PI}, // north + {6, 2, SPELL_BREATH_NE_TO_SW, 10.2191f, -247.912f, -60.0f, 3*M_PI/4}, // north-east + {7, 3, SPELL_BREATH_E_TO_W, -31.496f, -250.123f, -60.0f, M_PI/2}, // east + {8, 4, SPELL_BREATH_SE_TO_NW, -63.5156f, -240.096f, -60.0f, M_PI/4}, // south-east }; enum Yells @@ -105,436 +105,436 @@ public: return new boss_onyxiaAI (pCreature); } - struct boss_onyxiaAI : public ScriptedAI - { - boss_onyxiaAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = me->GetInstanceScript(); - } + struct boss_onyxiaAI : public ScriptedAI + { + boss_onyxiaAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = me->GetInstanceScript(); + } - EventMap events; + EventMap events; - InstanceScript* m_pInstance; - uint8 Phase; - int8 CurrentWP; + InstanceScript* m_pInstance; + uint8 Phase; + int8 CurrentWP; - bool whelpSpam; - uint8 whelpCount; - int32 whelpSpamTimer; - bool bManyWhelpsAvailable; + bool whelpSpam; + uint8 whelpCount; + int32 whelpSpamTimer; + bool bManyWhelpsAvailable; - void SetPhase(uint8 ph) - { - events.Reset(); - Phase = ph; - switch( ph ) - { - case 0: - break; - case 1: - events.ScheduleEvent(EVENT_SPELL_WINGBUFFET, urand(10000, 20000)); - events.ScheduleEvent(EVENT_SPELL_FLAMEBREATH, urand(10000, 20000)); - events.ScheduleEvent(EVENT_SPELL_TAILSWEEP, urand(15000, 20000)); - events.ScheduleEvent(EVENT_SPELL_CLEAVE, urand(2000, 5000)); - break; - case 2: - events.ScheduleEvent(EVENT_START_PHASE_2, 0); - break; - case 3: - events.ScheduleEvent(EVENT_START_PHASE_3, 5000); - break; - } - } + void SetPhase(uint8 ph) + { + events.Reset(); + Phase = ph; + switch( ph ) + { + case 0: + break; + case 1: + events.ScheduleEvent(EVENT_SPELL_WINGBUFFET, urand(10000, 20000)); + events.ScheduleEvent(EVENT_SPELL_FLAMEBREATH, urand(10000, 20000)); + events.ScheduleEvent(EVENT_SPELL_TAILSWEEP, urand(15000, 20000)); + events.ScheduleEvent(EVENT_SPELL_CLEAVE, urand(2000, 5000)); + break; + case 2: + events.ScheduleEvent(EVENT_START_PHASE_2, 0); + break; + case 3: + events.ScheduleEvent(EVENT_START_PHASE_3, 5000); + break; + } + } - void Reset() - { - CurrentWP = 0; - SetPhase(0); - me->SetReactState(REACT_AGGRESSIVE); - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetHover(false); - me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run, false); + void Reset() + { + CurrentWP = 0; + SetPhase(0); + me->SetReactState(REACT_AGGRESSIVE); + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); + me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run, false); - whelpSpam = false; - whelpCount = 0; - whelpSpamTimer = 0; - bManyWhelpsAvailable = false; + whelpSpam = false; + whelpCount = 0; + whelpSpamTimer = 0; + bManyWhelpsAvailable = false; - if( m_pInstance ) - { - m_pInstance->SetData(DATA_ONYXIA, NOT_STARTED); - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } - } + if( m_pInstance ) + { + m_pInstance->SetData(DATA_ONYXIA, NOT_STARTED); + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } + } - void MoveInLineOfSight(Unit *who) - { - if( me->GetVictim() || me->GetDistance(who) > 30.0f ) - return; + void MoveInLineOfSight(Unit *who) + { + if( me->GetVictim() || me->GetDistance(who) > 30.0f ) + return; - if( who->GetTypeId() == TYPEID_PLAYER ) - AttackStart(who); - } + if( who->GetTypeId() == TYPEID_PLAYER ) + AttackStart(who); + } - void DoAction(int32 param) - { - switch( param ) - { - case -1: - if( bManyWhelpsAvailable && m_pInstance ) - m_pInstance->SetData(DATA_WHELP_SUMMONED, 1); - break; - } - } + void DoAction(int32 param) + { + switch( param ) + { + case -1: + if( bManyWhelpsAvailable && m_pInstance ) + m_pInstance->SetData(DATA_WHELP_SUMMONED, 1); + break; + } + } - void BindPlayers() - { - me->GetMap()->ToInstanceMap()->PermBindAllPlayers(); - } + void BindPlayers() + { + me->GetMap()->ToInstanceMap()->PermBindAllPlayers(); + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - DoZoneInCombat(); - SetPhase(1); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + DoZoneInCombat(); + SetPhase(1); - if( m_pInstance ) - { - m_pInstance->SetData(DATA_ONYXIA, IN_PROGRESS); - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); // just in case at reset some players already left the instance - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } - BindPlayers(); - } + if( m_pInstance ) + { + m_pInstance->SetData(DATA_ONYXIA, IN_PROGRESS); + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); // just in case at reset some players already left the instance + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } + BindPlayers(); + } - void JustDied(Unit* killer) - { - if( m_pInstance ) - m_pInstance->SetData(DATA_ONYXIA, DONE); - } + void JustDied(Unit* killer) + { + if( m_pInstance ) + m_pInstance->SetData(DATA_ONYXIA, DONE); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - switch( Phase ) - { - case 1: - if( me->GetHealth()*100 / me->GetMaxHealth() <= 65 ) - SetPhase(2); - break; - case 2: - if( me->GetHealth()*100 / me->GetMaxHealth() <= 40 ) - { - me->InterruptNonMeleeSpells(false); - SetPhase(3); - } - break; - } - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + switch( Phase ) + { + case 1: + if( me->GetHealth()*100 / me->GetMaxHealth() <= 65 ) + SetPhase(2); + break; + case 2: + if( me->GetHealth()*100 / me->GetMaxHealth() <= 40 ) + { + me->InterruptNonMeleeSpells(false); + SetPhase(3); + } + break; + } + } - void JustSummoned(Creature *pSummoned) - { - if( !pSummoned ) - return; - if( pSummoned->GetEntry() != NPC_ONYXIAN_WHELP && pSummoned->GetEntry() != NPC_ONYXIAN_LAIR_GUARD ) - return; - if( Unit* target = pSummoned->SelectNearestTarget(300.0f) ) - { - pSummoned->AI()->AttackStart(target); - DoZoneInCombat(pSummoned); - } - } + void JustSummoned(Creature *pSummoned) + { + if( !pSummoned ) + return; + if( pSummoned->GetEntry() != NPC_ONYXIAN_WHELP && pSummoned->GetEntry() != NPC_ONYXIAN_LAIR_GUARD ) + return; + if( Unit* target = pSummoned->SelectNearestTarget(300.0f) ) + { + pSummoned->AI()->AttackStart(target); + DoZoneInCombat(pSummoned); + } + } - void MovementInform(uint32 type, uint32 id) - { - if( type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE ) - return; + void MovementInform(uint32 type, uint32 id) + { + if( type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE ) + return; - if( id < 9 ) - { - if( id > 0 && Phase == 2 ) - { - me->SetFacingTo(OnyxiaMoveData[id].o); - me->SetSpeed(MOVE_RUN, 1.6f, false); - CurrentWP = id; - events.ScheduleEvent(EVENT_SPELL_FIREBALL_FIRST, 1000); - } - } - else switch( id ) - { - case 10: - me->SetFacingTo(OnyxiaMoveData[0].o); - events.ScheduleEvent(EVENT_LIFTOFF, 0); - break; - case 11: - me->SetFacingTo(OnyxiaMoveData[1].o); - events.ScheduleEvent(EVENT_FLY_S_TO_N, 0); - break; - case 12: - me->SetFacingTo(OnyxiaMoveData[1].o); - events.ScheduleEvent(EVENT_LAND, 0); - break; - case 13: - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetHover(false); - me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run, false); - events.ScheduleEvent(EVENT_PHASE_3_ATTACK, 0); - break; - } - } + if( id < 9 ) + { + if( id > 0 && Phase == 2 ) + { + me->SetFacingTo(OnyxiaMoveData[id].o); + me->SetSpeed(MOVE_RUN, 1.6f, false); + CurrentWP = id; + events.ScheduleEvent(EVENT_SPELL_FIREBALL_FIRST, 1000); + } + } + else switch( id ) + { + case 10: + me->SetFacingTo(OnyxiaMoveData[0].o); + events.ScheduleEvent(EVENT_LIFTOFF, 0); + break; + case 11: + me->SetFacingTo(OnyxiaMoveData[1].o); + events.ScheduleEvent(EVENT_FLY_S_TO_N, 0); + break; + case 12: + me->SetFacingTo(OnyxiaMoveData[1].o); + events.ScheduleEvent(EVENT_LAND, 0); + break; + case 13: + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); + me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run, false); + events.ScheduleEvent(EVENT_PHASE_3_ATTACK, 0); + break; + } + } - void HandleWhelpSpam(const uint32 diff) - { - if( whelpSpam ) - { - if( whelpCount < 40 ) - { - whelpSpamTimer -= diff; - if( whelpSpamTimer <= 0 ) - { - float angle = rand_norm()*2*M_PI; - float dist = rand_norm()*4.0f; - me->CastSpell(-33.18f + cos(angle)*dist, -258.80f + sin(angle)*dist, -89.0f, 17646, true); - me->CastSpell(-32.535f + cos(angle)*dist, -170.190f + sin(angle)*dist, -89.0f, 17646, true); - whelpCount += 2; - whelpSpamTimer += 600; - } - } - else - { - whelpSpam = false; - whelpCount = 0; - whelpSpamTimer = 0; - } - } - } + void HandleWhelpSpam(const uint32 diff) + { + if( whelpSpam ) + { + if( whelpCount < 40 ) + { + whelpSpamTimer -= diff; + if( whelpSpamTimer <= 0 ) + { + float angle = rand_norm()*2*M_PI; + float dist = rand_norm()*4.0f; + me->CastSpell(-33.18f + cos(angle)*dist, -258.80f + sin(angle)*dist, -89.0f, 17646, true); + me->CastSpell(-32.535f + cos(angle)*dist, -170.190f + sin(angle)*dist, -89.0f, 17646, true); + whelpCount += 2; + whelpSpamTimer += 600; + } + } + else + { + whelpSpam = false; + whelpCount = 0; + whelpSpamTimer = 0; + } + } + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); - HandleWhelpSpam(diff); + events.Update(diff); + HandleWhelpSpam(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_WINGBUFFET: - { - me->CastSpell(me, SPELL_WINGBUFFET, false); - events.RepeatEvent(urand(15000, 30000)); - } - break; - case EVENT_SPELL_FLAMEBREATH: - { - me->CastSpell(me, SPELL_FLAMEBREATH, false); - events.RepeatEvent(urand(10000, 20000)); - } - break; - case EVENT_SPELL_TAILSWEEP: - { - me->CastSpell(me, SPELL_TAILSWEEP, false); - events.RepeatEvent(urand(15000, 20000)); - } - break; - case EVENT_SPELL_CLEAVE: - { - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - events.RepeatEvent(urand(2000, 5000)); - } - break; - case EVENT_START_PHASE_2: - { - me->AttackStop(); - me->SetReactState(REACT_PASSIVE); - me->StopMoving(); - DoResetThreat(); - me->GetMotionMaster()->MovePoint(10, OnyxiaMoveData[0].x, OnyxiaMoveData[0].y, OnyxiaMoveData[0].z); - events.PopEvent(); - } - break; - case EVENT_LIFTOFF: - { - Talk(SAY_PHASE_2_TRANS); - me->SendMeleeAttackStop(me->GetVictim()); - me->GetMotionMaster()->MoveIdle(); - me->DisableSpline(); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - me->SetOrientation(OnyxiaMoveData[0].o); - me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MoveTakeoff(11, OnyxiaMoveData[1].x+1.0f, OnyxiaMoveData[1].y, OnyxiaMoveData[1].z, 12.0f); - bManyWhelpsAvailable = true; - events.PopEvent(); - events.RescheduleEvent(EVENT_END_MANY_WHELPS_TIME, 10000); - } - break; - case EVENT_END_MANY_WHELPS_TIME: - bManyWhelpsAvailable = false; - events.PopEvent(); - break; - case EVENT_FLY_S_TO_N: - { - me->SetSpeed(MOVE_RUN, 2.95f, false); - me->GetMotionMaster()->MovePoint(5, OnyxiaMoveData[5].x, OnyxiaMoveData[5].y, OnyxiaMoveData[5].z); - events.PopEvent(); - whelpSpam = true; - events.ScheduleEvent(EVENT_WHELP_SPAM, 90000); - events.ScheduleEvent(EVENT_SUMMON_LAIR_GUARD, 30000); - } - break; - case EVENT_SUMMON_LAIR_GUARD: - { - me->CastSpell(-101.654f, -214.491f, -80.70f, SPELL_SUMMON_LAIR_GUARD, true); - events.RepeatEvent(30000); - } - break; - case EVENT_WHELP_SPAM: - { - whelpSpam = true; - events.RepeatEvent(90000); - } - break; - case EVENT_LAND: - { - Talk(SAY_PHASE_3_TRANS); - me->SendMeleeAttackStop(me->GetVictim()); - me->GetMotionMaster()->MoveLand(13, OnyxiaMoveData[0].x+1.0f, OnyxiaMoveData[0].y, OnyxiaMoveData[0].z, 12.0f); - events.PopEvent(); - DoResetThreat(); - } - break; - case EVENT_SPELL_FIREBALL_FIRST: - { - if( Unit* v = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true) ) - { - me->SetFacingToObject(v); - me->CastSpell(v, SPELL_FIREBALL, false); - } - events.PopEvent(); - events.ScheduleEvent(EVENT_SPELL_FIREBALL_SECOND, 4000); - } - break; - case EVENT_SPELL_FIREBALL_SECOND: - { - if( Unit* v = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true) ) - { - me->SetFacingToObject(v); - me->CastSpell(v, SPELL_FIREBALL, false); - } - events.PopEvent(); + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_WINGBUFFET: + { + me->CastSpell(me, SPELL_WINGBUFFET, false); + events.RepeatEvent(urand(15000, 30000)); + } + break; + case EVENT_SPELL_FLAMEBREATH: + { + me->CastSpell(me, SPELL_FLAMEBREATH, false); + events.RepeatEvent(urand(10000, 20000)); + } + break; + case EVENT_SPELL_TAILSWEEP: + { + me->CastSpell(me, SPELL_TAILSWEEP, false); + events.RepeatEvent(urand(15000, 20000)); + } + break; + case EVENT_SPELL_CLEAVE: + { + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + events.RepeatEvent(urand(2000, 5000)); + } + break; + case EVENT_START_PHASE_2: + { + me->AttackStop(); + me->SetReactState(REACT_PASSIVE); + me->StopMoving(); + DoResetThreat(); + me->GetMotionMaster()->MovePoint(10, OnyxiaMoveData[0].x, OnyxiaMoveData[0].y, OnyxiaMoveData[0].z); + events.PopEvent(); + } + break; + case EVENT_LIFTOFF: + { + Talk(SAY_PHASE_2_TRANS); + me->SendMeleeAttackStop(me->GetVictim()); + me->GetMotionMaster()->MoveIdle(); + me->DisableSpline(); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + me->SetOrientation(OnyxiaMoveData[0].o); + me->SendMovementFlagUpdate(); + me->GetMotionMaster()->MoveTakeoff(11, OnyxiaMoveData[1].x+1.0f, OnyxiaMoveData[1].y, OnyxiaMoveData[1].z, 12.0f); + bManyWhelpsAvailable = true; + events.PopEvent(); + events.RescheduleEvent(EVENT_END_MANY_WHELPS_TIME, 10000); + } + break; + case EVENT_END_MANY_WHELPS_TIME: + bManyWhelpsAvailable = false; + events.PopEvent(); + break; + case EVENT_FLY_S_TO_N: + { + me->SetSpeed(MOVE_RUN, 2.95f, false); + me->GetMotionMaster()->MovePoint(5, OnyxiaMoveData[5].x, OnyxiaMoveData[5].y, OnyxiaMoveData[5].z); + events.PopEvent(); + whelpSpam = true; + events.ScheduleEvent(EVENT_WHELP_SPAM, 90000); + events.ScheduleEvent(EVENT_SUMMON_LAIR_GUARD, 30000); + } + break; + case EVENT_SUMMON_LAIR_GUARD: + { + me->CastSpell(-101.654f, -214.491f, -80.70f, SPELL_SUMMON_LAIR_GUARD, true); + events.RepeatEvent(30000); + } + break; + case EVENT_WHELP_SPAM: + { + whelpSpam = true; + events.RepeatEvent(90000); + } + break; + case EVENT_LAND: + { + Talk(SAY_PHASE_3_TRANS); + me->SendMeleeAttackStop(me->GetVictim()); + me->GetMotionMaster()->MoveLand(13, OnyxiaMoveData[0].x+1.0f, OnyxiaMoveData[0].y, OnyxiaMoveData[0].z, 12.0f); + events.PopEvent(); + DoResetThreat(); + } + break; + case EVENT_SPELL_FIREBALL_FIRST: + { + if( Unit* v = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true) ) + { + me->SetFacingToObject(v); + me->CastSpell(v, SPELL_FIREBALL, false); + } + events.PopEvent(); + events.ScheduleEvent(EVENT_SPELL_FIREBALL_SECOND, 4000); + } + break; + case EVENT_SPELL_FIREBALL_SECOND: + { + if( Unit* v = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true) ) + { + me->SetFacingToObject(v); + me->CastSpell(v, SPELL_FIREBALL, false); + } + events.PopEvent(); - uint8 rand = urand(0, 99); - if( rand < 33 ) - events.ScheduleEvent(EVENT_PHASE_2_STEP_CW, 4000); - else if( rand < 66 ) - events.ScheduleEvent(EVENT_PHASE_2_STEP_ACW, 4000); - else - events.ScheduleEvent(EVENT_PHASE_2_STEP_ACROSS, 4000); - } - break; - case EVENT_PHASE_2_STEP_CW: - { - uint8 newWP = CurrentWP + 1; - if( newWP > 8 ) - newWP = 1; - me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z); - events.PopEvent(); - } - break; - case EVENT_PHASE_2_STEP_ACW: - { - uint8 newWP = CurrentWP - 1; - if( newWP < 1 ) - newWP = 8; - me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z); - events.PopEvent(); - } - break; - case EVENT_PHASE_2_STEP_ACROSS: - { - me->SetFacingTo(OnyxiaMoveData[CurrentWP].o); - me->MonsterTextEmote("Onyxia takes in a deep breath...", 0, true); - me->CastSpell(me, OnyxiaMoveData[CurrentWP].spellId, false); - events.PopEvent(); - events.ScheduleEvent(EVENT_SPELL_BREATH, 8250); - } - break; - case EVENT_SPELL_BREATH: - { - uint8 newWP = OnyxiaMoveData[CurrentWP].DestId; - me->SetSpeed(MOVE_RUN, 2.95f, false); - me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z); - events.PopEvent(); - } - break; - case EVENT_START_PHASE_3: - { - me->SetSpeed(MOVE_RUN, 2.95f, false); - me->GetMotionMaster()->MovePoint(12, OnyxiaMoveData[1].x, OnyxiaMoveData[1].y, OnyxiaMoveData[1].z); - events.PopEvent(); - } - break; - case EVENT_PHASE_3_ATTACK: - { - events.PopEvent(); + uint8 rand = urand(0, 99); + if( rand < 33 ) + events.ScheduleEvent(EVENT_PHASE_2_STEP_CW, 4000); + else if( rand < 66 ) + events.ScheduleEvent(EVENT_PHASE_2_STEP_ACW, 4000); + else + events.ScheduleEvent(EVENT_PHASE_2_STEP_ACROSS, 4000); + } + break; + case EVENT_PHASE_2_STEP_CW: + { + uint8 newWP = CurrentWP + 1; + if( newWP > 8 ) + newWP = 1; + me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z); + events.PopEvent(); + } + break; + case EVENT_PHASE_2_STEP_ACW: + { + uint8 newWP = CurrentWP - 1; + if( newWP < 1 ) + newWP = 8; + me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z); + events.PopEvent(); + } + break; + case EVENT_PHASE_2_STEP_ACROSS: + { + me->SetFacingTo(OnyxiaMoveData[CurrentWP].o); + me->MonsterTextEmote("Onyxia takes in a deep breath...", 0, true); + me->CastSpell(me, OnyxiaMoveData[CurrentWP].spellId, false); + events.PopEvent(); + events.ScheduleEvent(EVENT_SPELL_BREATH, 8250); + } + break; + case EVENT_SPELL_BREATH: + { + uint8 newWP = OnyxiaMoveData[CurrentWP].DestId; + me->SetSpeed(MOVE_RUN, 2.95f, false); + me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z); + events.PopEvent(); + } + break; + case EVENT_START_PHASE_3: + { + me->SetSpeed(MOVE_RUN, 2.95f, false); + me->GetMotionMaster()->MovePoint(12, OnyxiaMoveData[1].x, OnyxiaMoveData[1].y, OnyxiaMoveData[1].z); + events.PopEvent(); + } + break; + case EVENT_PHASE_3_ATTACK: + { + events.PopEvent(); - me->SetReactState(REACT_AGGRESSIVE); - AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 0, false)); - me->CastSpell(me, SPELL_BELLOWINGROAR, false); + me->SetReactState(REACT_AGGRESSIVE); + AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 0, false)); + me->CastSpell(me, SPELL_BELLOWINGROAR, false); - events.ScheduleEvent(EVENT_ERUPTION, 0); - events.ScheduleEvent(EVENT_SPELL_WINGBUFFET, urand(10000, 20000)); - events.ScheduleEvent(EVENT_SPELL_FLAMEBREATH, urand(10000, 20000)); - events.ScheduleEvent(EVENT_SPELL_TAILSWEEP, urand(15000, 20000)); - events.ScheduleEvent(EVENT_SPELL_CLEAVE, urand(2000, 5000)); - events.ScheduleEvent(EVENT_SPELL_BELLOWINGROAR, 15000); - events.ScheduleEvent(EVENT_SUMMON_WHELP, 10000); - } - break; - case EVENT_SPELL_BELLOWINGROAR: - { - me->CastSpell(me, SPELL_BELLOWINGROAR, false); - events.RepeatEvent(22000); - events.ScheduleEvent(EVENT_ERUPTION, 0); - } - break; - case EVENT_ERUPTION: - { - if( Creature* trigger = me->SummonCreature(12758, *me, TEMPSUMMON_TIMED_DESPAWN, 1000) ) - trigger->CastSpell(trigger, 17731, false); + events.ScheduleEvent(EVENT_ERUPTION, 0); + events.ScheduleEvent(EVENT_SPELL_WINGBUFFET, urand(10000, 20000)); + events.ScheduleEvent(EVENT_SPELL_FLAMEBREATH, urand(10000, 20000)); + events.ScheduleEvent(EVENT_SPELL_TAILSWEEP, urand(15000, 20000)); + events.ScheduleEvent(EVENT_SPELL_CLEAVE, urand(2000, 5000)); + events.ScheduleEvent(EVENT_SPELL_BELLOWINGROAR, 15000); + events.ScheduleEvent(EVENT_SUMMON_WHELP, 10000); + } + break; + case EVENT_SPELL_BELLOWINGROAR: + { + me->CastSpell(me, SPELL_BELLOWINGROAR, false); + events.RepeatEvent(22000); + events.ScheduleEvent(EVENT_ERUPTION, 0); + } + break; + case EVENT_ERUPTION: + { + if( Creature* trigger = me->SummonCreature(12758, *me, TEMPSUMMON_TIMED_DESPAWN, 1000) ) + trigger->CastSpell(trigger, 17731, false); - events.PopEvent(); - } - break; - case EVENT_SUMMON_WHELP: - { - float angle = rand_norm()*2*M_PI; - float dist = rand_norm()*4.0f; - me->CastSpell(-33.18f + cos(angle)*dist, -258.80f + sin(angle)*dist, -89.0f, 17646, true); - me->CastSpell(-32.535f + cos(angle)*dist, -170.190f + sin(angle)*dist, -89.0f, 17646, true); - events.RepeatEvent(30000); - } - break; - } - } + events.PopEvent(); + } + break; + case EVENT_SUMMON_WHELP: + { + float angle = rand_norm()*2*M_PI; + float dist = rand_norm()*4.0f; + me->CastSpell(-33.18f + cos(angle)*dist, -258.80f + sin(angle)*dist, -89.0f, 17646, true); + me->CastSpell(-32.535f + cos(angle)*dist, -170.190f + sin(angle)*dist, -89.0f, 17646, true); + events.RepeatEvent(30000); + } + break; + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (target->GetTypeId() == TYPEID_PLAYER && spell->DurationEntry && spell->DurationEntry->ID == 328 && spell->Effects[EFFECT_1].TargetA.GetTarget() == 1 && (spell->Effects[EFFECT_1].Amplitude == 50 || spell->Effects[EFFECT_1].Amplitude == 215)) // Deep Breath - if (m_pInstance) - m_pInstance->SetData(DATA_DEEP_BREATH_FAILED, 1); - } - }; + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (target->GetTypeId() == TYPEID_PLAYER && spell->DurationEntry && spell->DurationEntry->ID == 328 && spell->Effects[EFFECT_1].TargetA.GetTarget() == 1 && (spell->Effects[EFFECT_1].Amplitude == 50 || spell->Effects[EFFECT_1].Amplitude == 215)) // Deep Breath + if (m_pInstance) + m_pInstance->SetData(DATA_DEEP_BREATH_FAILED, 1); + } + }; }; class npc_onyxian_lair_guard : public CreatureScript @@ -547,63 +547,63 @@ public: return new npc_onyxian_lair_guardAI (pCreature); } - struct npc_onyxian_lair_guardAI : public ScriptedAI - { - npc_onyxian_lair_guardAI(Creature* pCreature) : ScriptedAI(pCreature) - { - events.Reset(); - events.ScheduleEvent(EVENT_OLG_SPELL_BLASTNOVA, 15000); - events.ScheduleEvent(EVENT_OLG_SPELL_IGNITEWEAPON, 10000); - } + struct npc_onyxian_lair_guardAI : public ScriptedAI + { + npc_onyxian_lair_guardAI(Creature* pCreature) : ScriptedAI(pCreature) + { + events.Reset(); + events.ScheduleEvent(EVENT_OLG_SPELL_BLASTNOVA, 15000); + events.ScheduleEvent(EVENT_OLG_SPELL_IGNITEWEAPON, 10000); + } - EventMap events; + EventMap events; - void MoveInLineOfSight(Unit *who) - { - if( me->GetVictim() || me->GetDistance(who) > 20.0f ) - return; + void MoveInLineOfSight(Unit *who) + { + if( me->GetVictim() || me->GetDistance(who) > 20.0f ) + return; - if( who->GetTypeId() == TYPEID_PLAYER ) - AttackStart(who); - } + if( who->GetTypeId() == TYPEID_PLAYER ) + AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_OLG_SPELL_BLASTNOVA: - me->CastSpell(me, SPELL_OLG_BLASTNOVA, false); - events.RepeatEvent(15000); - break; - case EVENT_OLG_SPELL_IGNITEWEAPON: - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED)) - events.RepeatEvent(5000); - else - { - me->CastSpell(me, SPELL_OLG_IGNITEWEAPON, false); - events.RepeatEvent(urand(18000, 21000)); - } - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_OLG_SPELL_BLASTNOVA: + me->CastSpell(me, SPELL_OLG_BLASTNOVA, false); + events.RepeatEvent(15000); + break; + case EVENT_OLG_SPELL_IGNITEWEAPON: + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED)) + events.RepeatEvent(5000); + else + { + me->CastSpell(me, SPELL_OLG_IGNITEWEAPON, false); + events.RepeatEvent(urand(18000, 21000)); + } + break; + } - if (!me->HasUnitState(UNIT_STATE_CASTING) && me->isAttackReady()) - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED)) - if (me->HasAura(SPELL_OLG_IGNITEWEAPON)) - me->RemoveAura(SPELL_OLG_IGNITEWEAPON); + if (!me->HasUnitState(UNIT_STATE_CASTING) && me->isAttackReady()) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED)) + if (me->HasAura(SPELL_OLG_IGNITEWEAPON)) + me->RemoveAura(SPELL_OLG_IGNITEWEAPON); - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_onyxia_whelp : public CreatureScript @@ -616,19 +616,19 @@ public: return new npc_onyxia_whelpAI (pCreature); } - struct npc_onyxia_whelpAI : public ScriptedAI - { - npc_onyxia_whelpAI(Creature* pCreature) : ScriptedAI(pCreature) {} + struct npc_onyxia_whelpAI : public ScriptedAI + { + npc_onyxia_whelpAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void MoveInLineOfSight(Unit *who) - { - if( me->GetVictim() || me->GetDistance(who) > 20.0f ) - return; + void MoveInLineOfSight(Unit *who) + { + if( me->GetVictim() || me->GetDistance(who) > 20.0f ) + return; - if( who->GetTypeId() == TYPEID_PLAYER ) - AttackStart(who); - } - }; + if( who->GetTypeId() == TYPEID_PLAYER ) + AttackStart(who); + } + }; }; class npc_onyxia_trigger : public CreatureScript @@ -641,19 +641,19 @@ public: return new npc_onyxia_triggerAI (pCreature); } - struct npc_onyxia_triggerAI : public ScriptedAI - { - npc_onyxia_triggerAI(Creature* pCreature) : ScriptedAI(pCreature) {} + struct npc_onyxia_triggerAI : public ScriptedAI + { + npc_onyxia_triggerAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(uint32 diff) {} - }; + void MoveInLineOfSight(Unit* who) {} + void UpdateAI(uint32 diff) {} + }; }; void AddSC_boss_onyxia() { - new boss_onyxia(); - new npc_onyxian_lair_guard(); - new npc_onyxia_whelp(); - new npc_onyxia_trigger(); + new boss_onyxia(); + new npc_onyxian_lair_guard(); + new npc_onyxia_whelp(); + new npc_onyxia_trigger(); } diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 2b491efeb..bb559566a 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -16,166 +16,166 @@ public: return new instance_onyxias_lair_InstanceMapScript(pMap); } - struct instance_onyxias_lair_InstanceMapScript : public InstanceScript - { - instance_onyxias_lair_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + struct instance_onyxias_lair_InstanceMapScript : public InstanceScript + { + instance_onyxias_lair_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint64 m_uiOnyxiasGUID; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - uint16 ManyWhelpsCounter; - std::vector minions; - bool bDeepBreath; + uint64 m_uiOnyxiasGUID; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; + uint16 ManyWhelpsCounter; + std::vector minions; + bool bDeepBreath; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiOnyxiasGUID = 0; - ManyWhelpsCounter = 0; - bDeepBreath = true; - } + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + m_uiOnyxiasGUID = 0; + ManyWhelpsCounter = 0; + bDeepBreath = true; + } - bool IsEncounterInProgress() const - { - for( uint8 i=0; iGetEntry() ) - { - case NPC_ONYXIA: - m_uiOnyxiasGUID = pCreature->GetGUID(); - break; - case NPC_ONYXIAN_WHELP: - case NPC_ONYXIAN_LAIR_GUARD: - minions.push_back(pCreature->GetGUID()); - break; - } - } + void OnCreatureCreate(Creature* pCreature) + { + switch( pCreature->GetEntry() ) + { + case NPC_ONYXIA: + m_uiOnyxiasGUID = pCreature->GetGUID(); + break; + case NPC_ONYXIAN_WHELP: + case NPC_ONYXIAN_LAIR_GUARD: + minions.push_back(pCreature->GetGUID()); + break; + } + } - void OnGameObjectCreate(GameObject* go) - { - switch( go->GetEntry() ) - { - case GO_WHELP_SPAWNER: - go->CastSpell((Unit*)NULL, 17646); - if( Creature* onyxia = instance->GetCreature(m_uiOnyxiasGUID) ) - onyxia->AI()->DoAction(-1); - break; - } - } + void OnGameObjectCreate(GameObject* go) + { + switch( go->GetEntry() ) + { + case GO_WHELP_SPAWNER: + go->CastSpell((Unit*)NULL, 17646); + if( Creature* onyxia = instance->GetCreature(m_uiOnyxiasGUID) ) + onyxia->AI()->DoAction(-1); + break; + } + } - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) - { - case DATA_ONYXIA: - m_auiEncounter[0] = uiData; - ManyWhelpsCounter = 0; - bDeepBreath = true; - if( uiData == NOT_STARTED ) - { - for( std::vector::iterator itr = minions.begin(); itr != minions.end(); ++itr ) - if( Creature* c = instance->GetCreature(*itr) ) - c->DespawnOrUnsummon(); - minions.clear(); - } - break; - case DATA_WHELP_SUMMONED: - ++ManyWhelpsCounter; - break; - case DATA_DEEP_BREATH_FAILED: - bDeepBreath = false; - break; - } + void SetData(uint32 uiType, uint32 uiData) + { + switch(uiType) + { + case DATA_ONYXIA: + m_auiEncounter[0] = uiData; + ManyWhelpsCounter = 0; + bDeepBreath = true; + if( uiData == NOT_STARTED ) + { + for( std::vector::iterator itr = minions.begin(); itr != minions.end(); ++itr ) + if( Creature* c = instance->GetCreature(*itr) ) + c->DespawnOrUnsummon(); + minions.clear(); + } + break; + case DATA_WHELP_SUMMONED: + ++ManyWhelpsCounter; + break; + case DATA_DEEP_BREATH_FAILED: + bDeepBreath = false; + break; + } - if (uiType < MAX_ENCOUNTER && uiData == DONE) - SaveToDB(); - } + if (uiType < MAX_ENCOUNTER && uiData == DONE) + SaveToDB(); + } - uint32 GetData(uint32 uiType) const - { - switch(uiType) - { - case DATA_ONYXIA: - return m_auiEncounter[0]; - } + uint32 GetData(uint32 uiType) const + { + switch(uiType) + { + case DATA_ONYXIA: + return m_auiEncounter[0]; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 uiData) const - { - switch(uiData) - { - case DATA_ONYXIA: - return m_uiOnyxiasGUID; - } + uint64 GetData64(uint32 uiData) const + { + switch(uiData) + { + case DATA_ONYXIA: + return m_uiOnyxiasGUID; + } - return 0; - } + return 0; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "O L " << m_auiEncounter[0]; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + std::ostringstream saveStream; + saveStream << "O L " << m_auiEncounter[0]; + str_data = saveStream.str(); + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if( !in ) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if( !in ) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint16 data0; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0; + char dataHead1, dataHead2; + uint16 data0; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0; - if( dataHead1 == 'O' && dataHead2 == 'L' ) - { - m_auiEncounter[0] = data0; + if( dataHead1 == 'O' && dataHead2 == 'L' ) + { + m_auiEncounter[0] = data0; - for( uint8 i = 0; i < MAX_ENCOUNTER; ++i ) - if( m_auiEncounter[i] == IN_PROGRESS ) - m_auiEncounter[i] = NOT_STARTED; - } - else - OUT_LOAD_INST_DATA_FAIL; + for( uint8 i = 0; i < MAX_ENCOUNTER; ++i ) + if( m_auiEncounter[i] == IN_PROGRESS ) + m_auiEncounter[i] = NOT_STARTED; + } + else + OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER: - case ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER: - return ManyWhelpsCounter>=50; - case ACHIEV_CRITERIA_DEEP_BREATH_10_PLAYER: - case ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER: - return bDeepBreath; - } - return false; - } - }; + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER: + case ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER: + return ManyWhelpsCounter>=50; + case ACHIEV_CRITERIA_DEEP_BREATH_10_PLAYER: + case ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER: + return bDeepBreath; + } + return false; + } + }; }; void AddSC_instance_onyxias_lair() { - new instance_onyxias_lair(); + new instance_onyxias_lair(); } \ No newline at end of file diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h index 87024ca45..8a119c2a6 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h +++ b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h @@ -7,23 +7,23 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum eInstanceData { - DATA_ONYXIA = 0, - MAX_ENCOUNTER = 1, - DATA_WHELP_SUMMONED, - DATA_DEEP_BREATH_FAILED, + DATA_ONYXIA = 0, + MAX_ENCOUNTER = 1, + DATA_WHELP_SUMMONED, + DATA_DEEP_BREATH_FAILED, }; enum eCreatures { - NPC_ONYXIA = 10184, - NPC_ONYXIAN_WHELP = 11262, - NPC_ONYXIAN_LAIR_GUARD = 36561, + NPC_ONYXIA = 10184, + NPC_ONYXIAN_WHELP = 11262, + NPC_ONYXIAN_LAIR_GUARD = 36561, }; enum eGameObjects { - GO_WHELP_SPAWNER = 176510, - GO_WHELP_EGG = 176511 + GO_WHELP_SPAWNER = 176510, + GO_WHELP_EGG = 176511 }; enum eAchievementData diff --git a/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp b/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp index 7087f9e37..1feafa82d 100644 --- a/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp +++ b/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp @@ -7,18 +7,18 @@ REWRITTEN BY XINEF class instance_ragefire_chasm : public InstanceMapScript { - public: - instance_ragefire_chasm() : InstanceMapScript("instance_ragefire_chasm", 389) { } + public: + instance_ragefire_chasm() : InstanceMapScript("instance_ragefire_chasm", 389) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_ragefire_chasm_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_ragefire_chasm_InstanceMapScript(map); + } - struct instance_ragefire_chasm_InstanceMapScript : public InstanceScript - { - instance_ragefire_chasm_InstanceMapScript(Map* map) : InstanceScript(map) { } - }; + struct instance_ragefire_chasm_InstanceMapScript : public InstanceScript + { + instance_ragefire_chasm_InstanceMapScript(Map* map) : InstanceScript(map) { } + }; }; void AddSC_instance_ragefire_chasm() diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp index a0cc4bf30..5fbf83d7d 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp @@ -9,86 +9,86 @@ REWRITTEN BY XINEF class instance_razorfen_downs : public InstanceMapScript { - public: - instance_razorfen_downs() : InstanceMapScript("instance_razorfen_downs", 129) { } + public: + instance_razorfen_downs() : InstanceMapScript("instance_razorfen_downs", 129) { } - struct instance_razorfen_downs_InstanceMapScript : public InstanceScript - { - instance_razorfen_downs_InstanceMapScript(Map* map) : InstanceScript(map) - { - } + struct instance_razorfen_downs_InstanceMapScript : public InstanceScript + { + instance_razorfen_downs_InstanceMapScript(Map* map) : InstanceScript(map) + { + } - void Initialize() - { - _gongPhase = 0; - _firesState = 0; - } + void Initialize() + { + _gongPhase = 0; + _firesState = 0; + } - void OnGameObjectCreate(GameObject* gameobject) - { - switch (gameobject->GetEntry()) - { - case GO_IDOL_OVEN_FIRE: - case GO_IDOL_CUP_FIRE: - case GO_IDOL_MOUTH_FIRE: - if (_firesState == DONE) - gameobject->Delete(); - break; - case GO_GONG: - if (_gongPhase == DONE) - gameobject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - } - } + void OnGameObjectCreate(GameObject* gameobject) + { + switch (gameobject->GetEntry()) + { + case GO_IDOL_OVEN_FIRE: + case GO_IDOL_CUP_FIRE: + case GO_IDOL_MOUTH_FIRE: + if (_firesState == DONE) + gameobject->Delete(); + break; + case GO_GONG: + if (_gongPhase == DONE) + gameobject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + } + } - uint32 GetData(uint32 type) const - { - if (type == GO_GONG) - return _gongPhase; - return 0; - } + uint32 GetData(uint32 type) const + { + if (type == GO_GONG) + return _gongPhase; + return 0; + } - void SetData(uint32 type, uint32 data) - { - if (type == GO_GONG) - _gongPhase = data; - else if (type == GO_BELNISTRASZS_BRAZIER) - _firesState = DONE; - SaveToDB(); - } + void SetData(uint32 type, uint32 data) + { + if (type == GO_GONG) + _gongPhase = data; + else if (type == GO_BELNISTRASZS_BRAZIER) + _firesState = DONE; + SaveToDB(); + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "R D " << _gongPhase << ' ' << _firesState; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "R D " << _gongPhase << ' ' << _firesState; + return saveStream.str(); + } - void Load(const char* str) - { - if (!str) - return; + void Load(const char* str) + { + if (!str) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(str); - loadStream >> dataHead1 >> dataHead2; + char dataHead1, dataHead2; + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'R' && dataHead2 == 'D') - { - loadStream >> _gongPhase; - loadStream >> _firesState; - } - } + if (dataHead1 == 'R' && dataHead2 == 'D') + { + loadStream >> _gongPhase; + loadStream >> _firesState; + } + } - private: - uint32 _gongPhase; - uint32 _firesState; - }; + private: + uint32 _gongPhase; + uint32 _firesState; + }; - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_razorfen_downs_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_razorfen_downs_InstanceMapScript(map); + } }; void AddSC_instance_razorfen_downs() diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index 8632e450a..712030a8a 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -57,212 +57,212 @@ enum Belnistrasz class npc_belnistrasz : public CreatureScript { - public: - npc_belnistrasz() : CreatureScript("npc_belnistrasz") { } + public: + npc_belnistrasz() : CreatureScript("npc_belnistrasz") { } - struct npc_belnistraszAI : public ScriptedAI - { - npc_belnistraszAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - eventInProgress = false; - spawnerCount = 0; - } + struct npc_belnistraszAI : public ScriptedAI + { + npc_belnistraszAI(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); + eventInProgress = false; + spawnerCount = 0; + } - void Reset() - { - if (!eventInProgress) - { - if (!me->HasAura(SPELL_ARCANE_INTELLECT)) - DoCast(me, SPELL_ARCANE_INTELLECT); + void Reset() + { + if (!eventInProgress) + { + if (!me->HasAura(SPELL_ARCANE_INTELLECT)) + DoCast(me, SPELL_ARCANE_INTELLECT); - channeling = false; - eventProgress = 0; - spawnerCount = 0; - me->SetFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); - me->SetReactState(REACT_AGGRESSIVE); - } - } + channeling = false; + eventProgress = 0; + spawnerCount = 0; + me->SetFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); + me->SetReactState(REACT_AGGRESSIVE); + } + } - void EnterCombat(Unit* who) - { - if (channeling) - Talk(SAY_WATCH_OUT, who); - else - { - events.ScheduleEvent(EVENT_FIREBALL, 1000); - events.ScheduleEvent(EVENT_FROST_NOVA, urand(8000, 12000)); - if (urand(0, 100) > 40) - Talk(SAY_AGGRO, who); - } - } + void EnterCombat(Unit* who) + { + if (channeling) + Talk(SAY_WATCH_OUT, who); + else + { + events.ScheduleEvent(EVENT_FIREBALL, 1000); + events.ScheduleEvent(EVENT_FROST_NOVA, urand(8000, 12000)); + if (urand(0, 100) > 40) + Talk(SAY_AGGRO, who); + } + } - void JustDied(Unit* /*killer*/) - { - me->DespawnOrUnsummon(5000); - } + void JustDied(Unit* /*killer*/) + { + me->DespawnOrUnsummon(5000); + } - void sQuestAccept(Player* /*player*/, Quest const* quest) - { - if (quest->GetQuestId() == QUEST_EXTINGUISHING_THE_IDOL) - { - eventInProgress = true; - Talk(SAY_QUEST_ACCEPTED); - me->RemoveFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); - me->setFaction(FACTION_ESCORT); - me->GetMotionMaster()->MovePath(PATH_ESCORT, false); - } - } + void sQuestAccept(Player* /*player*/, Quest const* quest) + { + if (quest->GetQuestId() == QUEST_EXTINGUISHING_THE_IDOL) + { + eventInProgress = true; + Talk(SAY_QUEST_ACCEPTED); + me->RemoveFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); + me->setFaction(FACTION_ESCORT); + me->GetMotionMaster()->MovePath(PATH_ESCORT, false); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type == WAYPOINT_MOTION_TYPE && id == POINT_REACH_IDOL) - { - channeling = true; - events.ScheduleEvent(EVENT_CHANNEL, 2000); - } - } + void MovementInform(uint32 type, uint32 id) + { + if (type == WAYPOINT_MOTION_TYPE && id == POINT_REACH_IDOL) + { + channeling = true; + events.ScheduleEvent(EVENT_CHANNEL, 2000); + } + } - void UpdateAI(uint32 diff) - { - if (!eventInProgress) - return; + void UpdateAI(uint32 diff) + { + if (!eventInProgress) + return; - events.Update(diff); + events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_CHANNEL: - Talk(SAY_EVENT_START); - DoCast(me, SPELL_IDOL_SHUTDOWN_VISUAL); - events.ScheduleEvent(EVENT_IDOL_ROOM_SPAWNER, 100); - events.ScheduleEvent(EVENT_PROGRESS, 120000); - me->SetReactState(REACT_PASSIVE); - break; - case EVENT_IDOL_ROOM_SPAWNER: - if (Creature* creature = me->SummonCreature(NPC_IDOL_ROOM_SPAWNER, PosSummonSpawner[urand(0,2)], TEMPSUMMON_TIMED_DESPAWN, 4000)) - creature->AI()->SetData(0,spawnerCount); - if (++spawnerCount < 8) - events.ScheduleEvent(EVENT_IDOL_ROOM_SPAWNER, 35000); - break; - case EVENT_PROGRESS: - { - switch (eventProgress) - { - case 0: - Talk(SAY_EVENT_THREE_MIN_LEFT); - ++eventProgress; - events.ScheduleEvent(EVENT_PROGRESS, 60000); - break; - case 1: - Talk(SAY_EVENT_TWO_MIN_LEFT); - ++eventProgress; - events.ScheduleEvent(EVENT_PROGRESS, 60000); - break; - case 2: - Talk(SAY_EVENT_ONE_MIN_LEFT); - ++eventProgress; - events.ScheduleEvent(EVENT_PROGRESS, 60000); - break; - case 3: - events.CancelEvent(EVENT_IDOL_ROOM_SPAWNER); - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - Talk(SAY_EVENT_END); - events.ScheduleEvent(EVENT_COMPLETE, 3000); - break; - } - break; - } - case EVENT_COMPLETE: - { - DoCast(me, SPELL_IDOM_ROOM_CAMERA_SHAKE); - me->SummonGameObject(GO_BELNISTRASZS_BRAZIER, 2577.196f, 947.0781f, 53.16757f, 2.356195f, 0, 0, 0.9238796f, 0.3826832f, 3600); - std::list ClusterList; - Trinity::AllWorldObjectsInRange objects(me, 50.0f); - Trinity::WorldObjectListSearcher searcher(me, ClusterList, objects); - me->VisitNearbyObject(50.0f, searcher); - for (std::list::const_iterator itr = ClusterList.begin(); itr != ClusterList.end(); ++itr) - { - if (Player* player = (*itr)->ToPlayer()) - { - if (player->GetQuestStatus(QUEST_EXTINGUISHING_THE_IDOL) == QUEST_STATUS_INCOMPLETE) - player->CompleteQuest(QUEST_EXTINGUISHING_THE_IDOL); - } - else if (GameObject* go = (*itr)->ToGameObject()) - { - if (go->GetEntry() == GO_IDOL_OVEN_FIRE || go->GetEntry() == GO_IDOL_CUP_FIRE || go->GetEntry() == GO_IDOL_MOUTH_FIRE) - go->Delete(); - } - } - instance->SetData(GO_BELNISTRASZS_BRAZIER, DONE); - me->DespawnOrUnsummon(); - break; - } - case EVENT_FIREBALL: - if (me->HasUnitState(UNIT_STATE_CASTING) || !UpdateVictim()) - return; - DoCastVictim(SPELL_FIREBALL); - events.ScheduleEvent(EVENT_FIREBALL, 8000); - break; - case EVENT_FROST_NOVA: - if (me->HasUnitState(UNIT_STATE_CASTING) || !UpdateVictim()) - return; - DoCast(me, SPELL_FROST_NOVA); - events.ScheduleEvent(EVENT_FROST_NOVA, 15000); - break; - } - } - if (!channeling) - DoMeleeAttackIfReady(); - } + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CHANNEL: + Talk(SAY_EVENT_START); + DoCast(me, SPELL_IDOL_SHUTDOWN_VISUAL); + events.ScheduleEvent(EVENT_IDOL_ROOM_SPAWNER, 100); + events.ScheduleEvent(EVENT_PROGRESS, 120000); + me->SetReactState(REACT_PASSIVE); + break; + case EVENT_IDOL_ROOM_SPAWNER: + if (Creature* creature = me->SummonCreature(NPC_IDOL_ROOM_SPAWNER, PosSummonSpawner[urand(0,2)], TEMPSUMMON_TIMED_DESPAWN, 4000)) + creature->AI()->SetData(0,spawnerCount); + if (++spawnerCount < 8) + events.ScheduleEvent(EVENT_IDOL_ROOM_SPAWNER, 35000); + break; + case EVENT_PROGRESS: + { + switch (eventProgress) + { + case 0: + Talk(SAY_EVENT_THREE_MIN_LEFT); + ++eventProgress; + events.ScheduleEvent(EVENT_PROGRESS, 60000); + break; + case 1: + Talk(SAY_EVENT_TWO_MIN_LEFT); + ++eventProgress; + events.ScheduleEvent(EVENT_PROGRESS, 60000); + break; + case 2: + Talk(SAY_EVENT_ONE_MIN_LEFT); + ++eventProgress; + events.ScheduleEvent(EVENT_PROGRESS, 60000); + break; + case 3: + events.CancelEvent(EVENT_IDOL_ROOM_SPAWNER); + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + Talk(SAY_EVENT_END); + events.ScheduleEvent(EVENT_COMPLETE, 3000); + break; + } + break; + } + case EVENT_COMPLETE: + { + DoCast(me, SPELL_IDOM_ROOM_CAMERA_SHAKE); + me->SummonGameObject(GO_BELNISTRASZS_BRAZIER, 2577.196f, 947.0781f, 53.16757f, 2.356195f, 0, 0, 0.9238796f, 0.3826832f, 3600); + std::list ClusterList; + Trinity::AllWorldObjectsInRange objects(me, 50.0f); + Trinity::WorldObjectListSearcher searcher(me, ClusterList, objects); + me->VisitNearbyObject(50.0f, searcher); + for (std::list::const_iterator itr = ClusterList.begin(); itr != ClusterList.end(); ++itr) + { + if (Player* player = (*itr)->ToPlayer()) + { + if (player->GetQuestStatus(QUEST_EXTINGUISHING_THE_IDOL) == QUEST_STATUS_INCOMPLETE) + player->CompleteQuest(QUEST_EXTINGUISHING_THE_IDOL); + } + else if (GameObject* go = (*itr)->ToGameObject()) + { + if (go->GetEntry() == GO_IDOL_OVEN_FIRE || go->GetEntry() == GO_IDOL_CUP_FIRE || go->GetEntry() == GO_IDOL_MOUTH_FIRE) + go->Delete(); + } + } + instance->SetData(GO_BELNISTRASZS_BRAZIER, DONE); + me->DespawnOrUnsummon(); + break; + } + case EVENT_FIREBALL: + if (me->HasUnitState(UNIT_STATE_CASTING) || !UpdateVictim()) + return; + DoCastVictim(SPELL_FIREBALL); + events.ScheduleEvent(EVENT_FIREBALL, 8000); + break; + case EVENT_FROST_NOVA: + if (me->HasUnitState(UNIT_STATE_CASTING) || !UpdateVictim()) + return; + DoCast(me, SPELL_FROST_NOVA); + events.ScheduleEvent(EVENT_FROST_NOVA, 15000); + break; + } + } + if (!channeling) + DoMeleeAttackIfReady(); + } - private: - InstanceScript* instance; - EventMap events; - bool eventInProgress; - bool channeling; - uint8 eventProgress; - uint8 spawnerCount; - }; + private: + InstanceScript* instance; + EventMap events; + bool eventInProgress; + bool channeling; + uint8 eventProgress; + uint8 spawnerCount; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; class npc_idol_room_spawner : public CreatureScript { - public: - npc_idol_room_spawner() : CreatureScript("npc_idol_room_spawner") { } + public: + npc_idol_room_spawner() : CreatureScript("npc_idol_room_spawner") { } - struct npc_idol_room_spawnerAI : public NullCreatureAI - { - npc_idol_room_spawnerAI(Creature* creature) : NullCreatureAI(creature) - { - } + struct npc_idol_room_spawnerAI : public NullCreatureAI + { + npc_idol_room_spawnerAI(Creature* creature) : NullCreatureAI(creature) + { + } - void SetData(uint32 /*type*/, uint32 data) - { - if (data < 7) - { - me->SummonCreature(NPC_WITHERED_BATTLE_BOAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - if (data > 0 && me->GetOrientation() < 4.0f) - me->SummonCreature(NPC_WITHERED_BATTLE_BOAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->SummonCreature(NPC_DEATHS_HEAD_GEOMANCER, me->GetPositionX() + (cos(me->GetOrientation() - (M_PI/2)) * 2), me->GetPositionY() + (sin(me->GetOrientation() - (M_PI/2)) * 2), me->GetPositionZ(), me->GetOrientation()); - me->SummonCreature(NPC_WITHERED_QUILGUARD, me->GetPositionX() + (cos(me->GetOrientation() + (M_PI/2)) * 2), me->GetPositionY() + (sin(me->GetOrientation() + (M_PI/2)) * 2), me->GetPositionZ(), me->GetOrientation()); - } - else if (data == 7) - me->SummonCreature(NPC_PLAGUEMAW_THE_ROTTING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - } - }; + void SetData(uint32 /*type*/, uint32 data) + { + if (data < 7) + { + me->SummonCreature(NPC_WITHERED_BATTLE_BOAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + if (data > 0 && me->GetOrientation() < 4.0f) + me->SummonCreature(NPC_WITHERED_BATTLE_BOAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + me->SummonCreature(NPC_DEATHS_HEAD_GEOMANCER, me->GetPositionX() + (cos(me->GetOrientation() - (M_PI/2)) * 2), me->GetPositionY() + (sin(me->GetOrientation() - (M_PI/2)) * 2), me->GetPositionZ(), me->GetOrientation()); + me->SummonCreature(NPC_WITHERED_QUILGUARD, me->GetPositionX() + (cos(me->GetOrientation() + (M_PI/2)) * 2), me->GetPositionY() + (sin(me->GetOrientation() + (M_PI/2)) * 2), me->GetPositionZ(), me->GetOrientation()); + } + else if (data == 7) + me->SummonCreature(NPC_PLAGUEMAW_THE_ROTTING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; void AddSC_razorfen_downs() diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index bb70c66f9..60d8a141b 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -7,18 +7,18 @@ REWRITTEN BY XINEF class instance_razorfen_kraul : public InstanceMapScript { - public: - instance_razorfen_kraul() : InstanceMapScript("instance_razorfen_kraul", 47) { } + public: + instance_razorfen_kraul() : InstanceMapScript("instance_razorfen_kraul", 47) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_razorfen_kraul_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_razorfen_kraul_InstanceMapScript(map); + } - struct instance_razorfen_kraul_InstanceMapScript : public InstanceScript - { - instance_razorfen_kraul_InstanceMapScript(Map* map) : InstanceScript(map) { } - }; + struct instance_razorfen_kraul_InstanceMapScript : public InstanceScript + { + instance_razorfen_kraul_InstanceMapScript(Map* map) : InstanceScript(map) { } + }; }; void AddSC_instance_razorfen_kraul() diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp index 6a50b5589..b901e4a0c 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp @@ -99,7 +99,7 @@ class boss_buru : public CreatureScript { if (action == ACTION_EXPLODE) if (_phase == PHASE_EGG) - Unit::DealDamage(me, me, 45000); + Unit::DealDamage(me, me, 45000); } void KilledUnit(Unit* victim) @@ -258,7 +258,7 @@ class spell_egg_explosion : public SpellScriptLoader void HandleDummyHitTarget(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - Unit::DealDamage(GetCaster(), target, -16 * GetCaster()->GetDistance(target) + 500); + Unit::DealDamage(GetCaster(), target, -16 * GetCaster()->GetDistance(target) + 500); } void Register() diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 43c0da450..5ab39034e 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -319,7 +319,7 @@ public: //Freeze animation DoCast(me, SPELL_FREEZE_ANIM); me->StopMoving(); - me->SetFacingTo(DarkGlareAngle); + me->SetFacingTo(DarkGlareAngle); me->SetOrientation(DarkGlareAngle); //Darkbeam for 35 seconds @@ -337,15 +337,15 @@ public: //Set angle and cast if (ClockWise) - { - me->SetFacingTo(DarkGlareAngle + DarkGlareTick * M_PI / 35); + { + me->SetFacingTo(DarkGlareAngle + DarkGlareTick * M_PI / 35); me->SetOrientation(DarkGlareAngle + DarkGlareTick * M_PI / 35); - } + } else - { - me->SetFacingTo(DarkGlareAngle - DarkGlareTick * M_PI / 35); + { + me->SetFacingTo(DarkGlareAngle - DarkGlareTick * M_PI / 35); me->SetOrientation(DarkGlareAngle - DarkGlareTick * M_PI / 35); - } + } //Actual dark glare cast, maybe something missing here? DoCast(me, SPELL_DARK_GLARE, false); @@ -922,7 +922,7 @@ public: void JustDied(Unit* /*killer*/) { if (Unit* p = ObjectAccessor::GetUnit(*me, Portal)) - Unit::Kill(p, p); + Unit::Kill(p, p); } void Reset() @@ -948,7 +948,7 @@ public: //KillSelfTimer if (KillSelfTimer <= diff) { - Unit::Kill(me, me); + Unit::Kill(me, me); return; } else KillSelfTimer -= diff; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp index ff6930855..92f4aea8c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp @@ -272,7 +272,7 @@ class npc_glob_of_viscidus : public CreatureScript if (Viscidus->IsAlive() && Viscidus->GetHealthPct() < 5.0f) { Viscidus->SetVisible(true); - Unit::Kill(Viscidus->GetVictim(), Viscidus); + Unit::Kill(Viscidus->GetVictim(), Viscidus); } else { diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp index dc00f3204..77da1560a 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp @@ -8,110 +8,110 @@ REWRITTEN BY XINEF class instance_wailing_caverns : public InstanceMapScript { - public: - instance_wailing_caverns() : InstanceMapScript("instance_wailing_caverns", 43) { } + public: + instance_wailing_caverns() : InstanceMapScript("instance_wailing_caverns", 43) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_wailing_caverns_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_wailing_caverns_InstanceMapScript(map); + } - struct instance_wailing_caverns_InstanceMapScript : public InstanceScript - { - instance_wailing_caverns_InstanceMapScript(Map* map) : InstanceScript(map) { } + struct instance_wailing_caverns_InstanceMapScript : public InstanceScript + { + instance_wailing_caverns_InstanceMapScript(Map* map) : InstanceScript(map) { } - void Initialize() - { - memset(&_encounters, 0, sizeof(_encounters)); + void Initialize() + { + memset(&_encounters, 0, sizeof(_encounters)); - DiscipleOfNaralexGUID = 0; - SerpentisGUID = 0; - } + DiscipleOfNaralexGUID = 0; + SerpentisGUID = 0; + } - void OnCreatureCreate(Creature* creature) - { - if (creature->GetEntry() == NPC_DISCIPLE_OF_NARALEX) - DiscipleOfNaralexGUID = creature->GetGUID(); - else if (creature->GetEntry() == NPC_LORD_SERPENTIS) - SerpentisGUID = creature->GetGUID(); - } + void OnCreatureCreate(Creature* creature) + { + if (creature->GetEntry() == NPC_DISCIPLE_OF_NARALEX) + DiscipleOfNaralexGUID = creature->GetGUID(); + else if (creature->GetEntry() == NPC_LORD_SERPENTIS) + SerpentisGUID = creature->GetGUID(); + } - void SetData(uint32 type, uint32 data) - { - switch (type) - { - case TYPE_LORD_COBRAHN: - case TYPE_LORD_PYTHAS: - case TYPE_LADY_ANACONDRA: - case TYPE_LORD_SERPENTIS: - case TYPE_MUTANUS: - _encounters[type] = data; - break; - } + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case TYPE_LORD_COBRAHN: + case TYPE_LORD_PYTHAS: + case TYPE_LADY_ANACONDRA: + case TYPE_LORD_SERPENTIS: + case TYPE_MUTANUS: + _encounters[type] = data; + break; + } - if (data == DONE) - SaveToDB(); + if (data == DONE) + SaveToDB(); - if (type == TYPE_LORD_COBRAHN && _encounters[TYPE_LORD_SERPENTIS] != DONE) - { - instance->LoadGrid(-120.163f, -24.624f); - if (Creature* serpentis = instance->GetCreature(SerpentisGUID)) - serpentis->AI()->Talk(SAY_SERPENTIS); - } + if (type == TYPE_LORD_COBRAHN && _encounters[TYPE_LORD_SERPENTIS] != DONE) + { + instance->LoadGrid(-120.163f, -24.624f); + if (Creature* serpentis = instance->GetCreature(SerpentisGUID)) + serpentis->AI()->Talk(SAY_SERPENTIS); + } - if (type != TYPE_MUTANUS && _encounters[TYPE_LORD_COBRAHN] == DONE && _encounters[TYPE_LORD_PYTHAS] == DONE && - _encounters[TYPE_LADY_ANACONDRA] == DONE && _encounters[TYPE_LORD_SERPENTIS] == DONE) - { - instance->LoadGrid(-134.97f, 125.402f); - if (Creature* disciple = instance->GetCreature(DiscipleOfNaralexGUID)) - disciple->AI()->Talk(SAY_DISCIPLE); - } - } + if (type != TYPE_MUTANUS && _encounters[TYPE_LORD_COBRAHN] == DONE && _encounters[TYPE_LORD_PYTHAS] == DONE && + _encounters[TYPE_LADY_ANACONDRA] == DONE && _encounters[TYPE_LORD_SERPENTIS] == DONE) + { + instance->LoadGrid(-134.97f, 125.402f); + if (Creature* disciple = instance->GetCreature(DiscipleOfNaralexGUID)) + disciple->AI()->Talk(SAY_DISCIPLE); + } + } - uint32 GetData(uint32 type) const - { - switch (type) - { - case TYPE_LORD_COBRAHN: - case TYPE_LORD_PYTHAS: - case TYPE_LADY_ANACONDRA: - case TYPE_LORD_SERPENTIS: - return _encounters[type]; - } - return 0; - } + uint32 GetData(uint32 type) const + { + switch (type) + { + case TYPE_LORD_COBRAHN: + case TYPE_LORD_PYTHAS: + case TYPE_LADY_ANACONDRA: + case TYPE_LORD_SERPENTIS: + return _encounters[type]; + } + return 0; + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "W C " << _encounters[0] << ' ' << _encounters[1] << ' ' << _encounters[2] << ' ' << _encounters[3] << ' ' << _encounters[4]; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "W C " << _encounters[0] << ' ' << _encounters[1] << ' ' << _encounters[2] << ' ' << _encounters[3] << ' ' << _encounters[4]; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - return; + void Load(const char* in) + { + if (!in) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'W' && dataHead2 == 'C') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - loadStream >> _encounters[i]; - if (_encounters[i] == IN_PROGRESS) - _encounters[i] = NOT_STARTED; - } - } - } + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'W' && dataHead2 == 'C') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + loadStream >> _encounters[i]; + if (_encounters[i] == IN_PROGRESS) + _encounters[i] = NOT_STARTED; + } + } + } - private: - uint32 _encounters[MAX_ENCOUNTERS]; - uint64 DiscipleOfNaralexGUID; - uint64 SerpentisGUID; - }; + private: + uint32 _encounters[MAX_ENCOUNTERS]; + uint64 DiscipleOfNaralexGUID; + uint64 SerpentisGUID; + }; }; void AddSC_instance_wailing_caverns() diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h index 669fb1009..301453cff 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h @@ -7,18 +7,18 @@ REWRITTEN BY XINEF enum DataTypes { - TYPE_LORD_COBRAHN = 0, - TYPE_LORD_PYTHAS = 1, - TYPE_LADY_ANACONDRA = 2, - TYPE_LORD_SERPENTIS = 3, - TYPE_MUTANUS = 4, - MAX_ENCOUNTERS = 5, + TYPE_LORD_COBRAHN = 0, + TYPE_LORD_PYTHAS = 1, + TYPE_LADY_ANACONDRA = 2, + TYPE_LORD_SERPENTIS = 3, + TYPE_MUTANUS = 4, + MAX_ENCOUNTERS = 5, - NPC_DISCIPLE_OF_NARALEX = 3678, - NPC_LORD_SERPENTIS = 3673, + NPC_DISCIPLE_OF_NARALEX = 3678, + NPC_LORD_SERPENTIS = 3673, - SAY_DISCIPLE = 0, - SAY_SERPENTIS = 0, + SAY_DISCIPLE = 0, + SAY_SERPENTIS = 0, }; #endif diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 50532215b..6ba2b5343 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -10,79 +10,79 @@ REWRITTEN BY XINEF class instance_zulfarrak : public InstanceMapScript { - public: - instance_zulfarrak() : InstanceMapScript("instance_zulfarrak", 209) { } + public: + instance_zulfarrak() : InstanceMapScript("instance_zulfarrak", 209) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_zulfarrak_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_zulfarrak_InstanceMapScript(map); + } - struct instance_zulfarrak_InstanceMapScript : public InstanceScript - { - instance_zulfarrak_InstanceMapScript(Map* map) : InstanceScript(map) { } + struct instance_zulfarrak_InstanceMapScript : public InstanceScript + { + instance_zulfarrak_InstanceMapScript(Map* map) : InstanceScript(map) { } - void Initialize() - { - _pyramidEventProgress = NOT_STARTED; - _gahzrillaSummoned = NOT_STARTED; - } + void Initialize() + { + _pyramidEventProgress = NOT_STARTED; + _gahzrillaSummoned = NOT_STARTED; + } - void OnGameObjectCreate(GameObject* gameobject) - { - if (gameobject->GetEntry() == GO_END_DOOR && _pyramidEventProgress == DONE) - gameobject->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - } + void OnGameObjectCreate(GameObject* gameobject) + { + if (gameobject->GetEntry() == GO_END_DOOR && _pyramidEventProgress == DONE) + gameobject->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + } - uint32 GetData(uint32 type) const - { - if (type == TYPE_PYRAMID_EVENT) - return _pyramidEventProgress; - return 0; - } + uint32 GetData(uint32 type) const + { + if (type == TYPE_PYRAMID_EVENT) + return _pyramidEventProgress; + return 0; + } - void SetData(uint32 type, uint32 data) - { - switch (type) - { - case TYPE_PYRAMID_EVENT: - _pyramidEventProgress = data; - break; - case TYPE_GAHZRILLA: - _gahzrillaSummoned = data; - break; - } + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case TYPE_PYRAMID_EVENT: + _pyramidEventProgress = data; + break; + case TYPE_GAHZRILLA: + _gahzrillaSummoned = data; + break; + } - SaveToDB(); - } + SaveToDB(); + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "Z F " << _pyramidEventProgress << ' ' << _gahzrillaSummoned; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "Z F " << _pyramidEventProgress << ' ' << _gahzrillaSummoned; + return saveStream.str(); + } - void Load(const char* str) - { - if (!str) - return; + void Load(const char* str) + { + if (!str) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(str); - loadStream >> dataHead1 >> dataHead2; + char dataHead1, dataHead2; + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'Z' && dataHead2 == 'F') - { - loadStream >> _pyramidEventProgress; - loadStream >> _gahzrillaSummoned; - } - } + if (dataHead1 == 'Z' && dataHead2 == 'F') + { + loadStream >> _pyramidEventProgress; + loadStream >> _gahzrillaSummoned; + } + } - private: - uint32 _pyramidEventProgress; - uint32 _gahzrillaSummoned; - }; + private: + uint32 _pyramidEventProgress; + uint32 _gahzrillaSummoned; + }; }; class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScriptLoader @@ -96,19 +96,19 @@ class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScriptLoader void HandleSummon(SpellEffIndex effIndex) { - if (effIndex == EFFECT_0) - { - if (roll_chance_i(30)) - { - PreventHitDefaultEffect(effIndex); - return; - } - } - else if (roll_chance_i(40)) - { - PreventHitDefaultEffect(effIndex); - return; - } + if (effIndex == EFFECT_0) + { + if (roll_chance_i(30)) + { + PreventHitDefaultEffect(effIndex); + return; + } + } + else if (roll_chance_i(40)) + { + PreventHitDefaultEffect(effIndex); + return; + } } void Register() @@ -126,43 +126,43 @@ class spell_zulfarrak_summon_zulfarrak_zombies : public SpellScriptLoader class spell_zulfarrak_unlocking : public SpellScriptLoader { - public: - spell_zulfarrak_unlocking() : SpellScriptLoader("spell_zulfarrak_unlocking") { } + public: + spell_zulfarrak_unlocking() : SpellScriptLoader("spell_zulfarrak_unlocking") { } - class spell_zulfarrak_unlocking_SpellScript : public SpellScript - { - PrepareSpellScript(spell_zulfarrak_unlocking_SpellScript); + class spell_zulfarrak_unlocking_SpellScript : public SpellScript + { + PrepareSpellScript(spell_zulfarrak_unlocking_SpellScript); - void HandleOpenLock(SpellEffIndex effIndex) - { - GameObject* cage = GetHitGObj(); - std::list cagesList; - Trinity::AllWorldObjectsInRange objects(GetCaster(), 15.0f); - Trinity::WorldObjectListSearcher searcher(GetCaster(), cagesList, objects); - GetCaster()->VisitNearbyObject(15.0f, searcher); - for (std::list::const_iterator itr = cagesList.begin(); itr != cagesList.end(); ++itr) - { - if (GameObject* go = (*itr)->ToGameObject()) - if (go->GetDisplayId() == cage->GetDisplayId()) - go->UseDoorOrButton(0, false, GetCaster()); - } - } + void HandleOpenLock(SpellEffIndex effIndex) + { + GameObject* cage = GetHitGObj(); + std::list cagesList; + Trinity::AllWorldObjectsInRange objects(GetCaster(), 15.0f); + Trinity::WorldObjectListSearcher searcher(GetCaster(), cagesList, objects); + GetCaster()->VisitNearbyObject(15.0f, searcher); + for (std::list::const_iterator itr = cagesList.begin(); itr != cagesList.end(); ++itr) + { + if (GameObject* go = (*itr)->ToGameObject()) + if (go->GetDisplayId() == cage->GetDisplayId()) + go->UseDoorOrButton(0, false, GetCaster()); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking_SpellScript::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_zulfarrak_unlocking_SpellScript::HandleOpenLock, EFFECT_0, SPELL_EFFECT_OPEN_LOCK); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_zulfarrak_unlocking_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_zulfarrak_unlocking_SpellScript(); + } }; void AddSC_instance_zulfarrak() { new instance_zulfarrak(); - new spell_zulfarrak_summon_zulfarrak_zombies(); - new spell_zulfarrak_unlocking(); + new spell_zulfarrak_summon_zulfarrak_zombies(); + new spell_zulfarrak_unlocking(); } diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h index a07b95073..aea47c9bb 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h @@ -7,10 +7,10 @@ REWRITTEN BY XINEF enum ZulFarrakData { - TYPE_PYRAMID_EVENT = 0, - TYPE_GAHZRILLA = 1, + TYPE_PYRAMID_EVENT = 0, + TYPE_GAHZRILLA = 1, - GO_END_DOOR = 146084 + GO_END_DOOR = 146084 }; #endif diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index 4941f2471..e58f882dc 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -445,10 +445,10 @@ public: { Creature* Spark = ObjectAccessor::GetCreature(*me, SparkGUID); if (!Spark) - { - me->DespawnOrUnsummon(1); + { + me->DespawnOrUnsummon(1); return 5000; - } + } switch (Step) { @@ -489,10 +489,10 @@ public: CompleteQuest(); return 9000; case 10: - Spark->DespawnOrUnsummon(1); + Spark->DespawnOrUnsummon(1); DespawnNagaFlag(false); - me->DespawnOrUnsummon(1); - return 5000; + me->DespawnOrUnsummon(1); + return 5000; default: return 99999999; } } @@ -683,7 +683,7 @@ class npc_stillpine_capitive : public CreatureScript if (type != POINT_MOTION_TYPE || id != POINT_INIT) return; - if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) + if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) player->KilledMonsterCredit(me->GetEntry(), me->GetGUID()); _movementComplete = true; diff --git a/src/server/scripts/Kalimdor/zone_darkshore.cpp b/src/server/scripts/Kalimdor/zone_darkshore.cpp index e4bc55ec0..f08585fdb 100644 --- a/src/server/scripts/Kalimdor/zone_darkshore.cpp +++ b/src/server/scripts/Kalimdor/zone_darkshore.cpp @@ -40,15 +40,15 @@ EndContentData */ // Ours enum murkdeep { - NPC_GREYMIST_HUNTER = 2206, - NPC_GREYMIST_WARRIOR = 2205, - NPC_GREYMIST_COASTRUNNER = 2202, + NPC_GREYMIST_HUNTER = 2206, + NPC_GREYMIST_WARRIOR = 2205, + NPC_GREYMIST_COASTRUNNER = 2202, - SPELL_SUNDER_ARMOR = 11971, - SPELL_NET = 6533, + SPELL_SUNDER_ARMOR = 11971, + SPELL_NET = 6533, - EVENT_SPELL_SUNDER_ARMOR = 2, - EVENT_SPELL_NET = 3, + EVENT_SPELL_SUNDER_ARMOR = 2, + EVENT_SPELL_NET = 3, }; class npc_murkdeep : public CreatureScript @@ -58,107 +58,107 @@ public: CreatureAI* GetAI(Creature* creature) const { - return new npc_murkdeepAI(creature); + return new npc_murkdeepAI(creature); } struct npc_murkdeepAI : public ScriptedAI { npc_murkdeepAI(Creature* c) : ScriptedAI(c) {} - uint8 phase; - uint32 spawnTimer; - EventMap events; + uint8 phase; + uint32 spawnTimer; + EventMap events; - void Reset() - { - spawnTimer = 0; - phase = 0; - me->SetVisible(false); - me->SetReactState(REACT_PASSIVE); - } + void Reset() + { + spawnTimer = 0; + phase = 0; + me->SetVisible(false); + me->SetReactState(REACT_PASSIVE); + } - void EnterCombat(Unit*) - { - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_SUNDER_ARMOR, 5000); - events.ScheduleEvent(EVENT_SPELL_NET, 10000); - } + void EnterCombat(Unit*) + { + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_SUNDER_ARMOR, 5000); + events.ScheduleEvent(EVENT_SPELL_NET, 10000); + } - void UpdateAI(uint32 diff) - { - spawnTimer += diff; - if (spawnTimer >= 5000) - { - spawnTimer = 0; - switch (phase) - { - case 0: - if (!me->FindNearestCreature(NPC_GREYMIST_WARRIOR, 80.0f, true) && !me->FindNearestCreature(NPC_GREYMIST_HUNTER, 80.0f, true)) - { - Player *player = me->SelectNearestPlayer(100.0f); - if (!player) - return; + void UpdateAI(uint32 diff) + { + spawnTimer += diff; + if (spawnTimer >= 5000) + { + spawnTimer = 0; + switch (phase) + { + case 0: + if (!me->FindNearestCreature(NPC_GREYMIST_WARRIOR, 80.0f, true) && !me->FindNearestCreature(NPC_GREYMIST_HUNTER, 80.0f, true)) + { + Player *player = me->SelectNearestPlayer(100.0f); + if (!player) + return; - phase++; - for (int i = 0; i < 3; ++i) - if (Creature* cr = me->SummonCreature(NPC_GREYMIST_COASTRUNNER, me->GetPositionX()+irand(-5, 5), me->GetPositionY()+irand(-5, 5), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - cr->AI()->AttackStart(player); - } - return; - case 1: - if (!me->FindNearestCreature(NPC_GREYMIST_COASTRUNNER, 80.0f)) - { - Player *player = me->SelectNearestPlayer(100.0f); - if (!player) - return; + phase++; + for (int i = 0; i < 3; ++i) + if (Creature* cr = me->SummonCreature(NPC_GREYMIST_COASTRUNNER, me->GetPositionX()+irand(-5, 5), me->GetPositionY()+irand(-5, 5), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + cr->AI()->AttackStart(player); + } + return; + case 1: + if (!me->FindNearestCreature(NPC_GREYMIST_COASTRUNNER, 80.0f)) + { + Player *player = me->SelectNearestPlayer(100.0f); + if (!player) + return; - phase++; - for (int i = 0; i < 2; ++i) - if (Creature* cr = me->SummonCreature(NPC_GREYMIST_WARRIOR, me->GetPositionX()+irand(-5, 5), me->GetPositionY()+irand(-5, 5), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - cr->AI()->AttackStart(player); - } - return; - case 2: - if (!me->FindNearestCreature(NPC_GREYMIST_WARRIOR, 80.0f)) - { - Player *player = me->SelectNearestPlayer(100.0f); - if (!player) - return; + phase++; + for (int i = 0; i < 2; ++i) + if (Creature* cr = me->SummonCreature(NPC_GREYMIST_WARRIOR, me->GetPositionX()+irand(-5, 5), me->GetPositionY()+irand(-5, 5), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + cr->AI()->AttackStart(player); + } + return; + case 2: + if (!me->FindNearestCreature(NPC_GREYMIST_WARRIOR, 80.0f)) + { + Player *player = me->SelectNearestPlayer(100.0f); + if (!player) + return; - phase++; - if (Creature* cr = me->SummonCreature(NPC_GREYMIST_HUNTER, me->GetPositionX()+irand(-5, 5), me->GetPositionY()+irand(-5, 5), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - cr->AI()->AttackStart(player); + phase++; + if (Creature* cr = me->SummonCreature(NPC_GREYMIST_HUNTER, me->GetPositionX()+irand(-5, 5), me->GetPositionY()+irand(-5, 5), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + cr->AI()->AttackStart(player); - me->SetReactState(REACT_AGGRESSIVE); - me->SetVisible(true); - AttackStart(player); - } - return; - } - } + me->SetReactState(REACT_AGGRESSIVE); + me->SetVisible(true); + AttackStart(player); + } + return; + } + } - if (!me->IsVisible()) - return; + if (!me->IsVisible()) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_SUNDER_ARMOR: - me->CastSpell(me->GetVictim(), SPELL_SUNDER_ARMOR, false); - events.ScheduleEvent(EVENT_SPELL_SUNDER_ARMOR, 15000); - break; - case EVENT_SPELL_NET: - me->CastSpell(me->GetVictim(), SPELL_NET, false); - events.ScheduleEvent(EVENT_SPELL_NET, 25000); - break; - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_SUNDER_ARMOR: + me->CastSpell(me->GetVictim(), SPELL_SUNDER_ARMOR, false); + events.ScheduleEvent(EVENT_SPELL_SUNDER_ARMOR, 15000); + break; + case EVENT_SPELL_NET: + me->CastSpell(me->GetVictim(), SPELL_NET, false); + events.ScheduleEvent(EVENT_SPELL_NET, 25000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; @@ -513,10 +513,10 @@ public: void AddSC_darkshore() { - // Ours - new npc_murkdeep(); + // Ours + new npc_murkdeep(); - // Theirs + // Theirs new npc_kerlonian(); new npc_prospector_remtravel(); new npc_threshwackonator(); diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp index 601e0a205..dce8b86ce 100644 --- a/src/server/scripts/Kalimdor/zone_desolace.cpp +++ b/src/server/scripts/Kalimdor/zone_desolace.cpp @@ -39,389 +39,389 @@ EndContentData */ // Ours enum Caravan { - QUEST_BODYGUARD_FOR_HIRE = 5821, - QUEST_GIZELTON_CARAVAN = 5943, + QUEST_BODYGUARD_FOR_HIRE = 5821, + QUEST_GIZELTON_CARAVAN = 5943, - EVENT_RESUME_PATH = 1, - EVENT_WAIT_FOR_ASSIST = 2, - EVENT_RESTART_ESCORT = 3, + EVENT_RESUME_PATH = 1, + EVENT_WAIT_FOR_ASSIST = 2, + EVENT_RESTART_ESCORT = 3, - NPC_CORK_GIZELTON = 11625, - NPC_RIGGER_GIZELTON = 11626, - NPC_CARAVAN_KODO = 11564, - NPC_VENDOR_TRON = 12245, - NPC_SUPER_SELLER = 12246, + NPC_CORK_GIZELTON = 11625, + NPC_RIGGER_GIZELTON = 11626, + NPC_CARAVAN_KODO = 11564, + NPC_VENDOR_TRON = 12245, + NPC_SUPER_SELLER = 12246, - SAY_CARAVAN_LEAVE = 0, - SAY_CARAVAN_HIRE = 1, + SAY_CARAVAN_LEAVE = 0, + SAY_CARAVAN_HIRE = 1, - MAX_CARAVAN_SUMMONS = 3, + MAX_CARAVAN_SUMMONS = 3, - TIME_SHOP_STOP = 10*MINUTE*IN_MILLISECONDS, - TIME_HIRE_STOP = 4*MINUTE*IN_MILLISECONDS, + TIME_SHOP_STOP = 10*MINUTE*IN_MILLISECONDS, + TIME_HIRE_STOP = 4*MINUTE*IN_MILLISECONDS, - // Ambush - NPC_KOLKAR_WAYLAYER = 12976, - NPC_KOLKAR_AMBUSHER = 12977, - NPC_LESSER_INFERNAL = 4676, - NPC_DOOMWARDER = 4677, - NPC_NETHER = 4684, + // Ambush + NPC_KOLKAR_WAYLAYER = 12976, + NPC_KOLKAR_AMBUSHER = 12977, + NPC_LESSER_INFERNAL = 4676, + NPC_DOOMWARDER = 4677, + NPC_NETHER = 4684, }; class npc_cork_gizelton : public CreatureScript { - public: - npc_cork_gizelton() : CreatureScript("npc_cork_gizelton") { } + public: + npc_cork_gizelton() : CreatureScript("npc_cork_gizelton") { } - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) - { - if (quest->GetQuestId() == QUEST_BODYGUARD_FOR_HIRE) - creature->AI()->SetGUID(player->GetGUID(), player->getFaction()); + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) + { + if (quest->GetQuestId() == QUEST_BODYGUARD_FOR_HIRE) + creature->AI()->SetGUID(player->GetGUID(), player->getFaction()); - return true; - } + return true; + } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_cork_gizeltonAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_cork_gizeltonAI(creature); + } - struct npc_cork_gizeltonAI : public npc_escortAI - { - npc_cork_gizeltonAI(Creature* creature) : npc_escortAI(creature) - { - memset(&summons, 0, sizeof(summons)); - } + struct npc_cork_gizeltonAI : public npc_escortAI + { + npc_cork_gizeltonAI(Creature* creature) : npc_escortAI(creature) + { + memset(&summons, 0, sizeof(summons)); + } - EventMap events; - uint64 summons[MAX_CARAVAN_SUMMONS]; - bool headNorth; + EventMap events; + uint64 summons[MAX_CARAVAN_SUMMONS]; + bool headNorth; - uint64 _playerGUID; - uint32 _faction; + uint64 _playerGUID; + uint32 _faction; - void Initialize() - { - _playerGUID = 0; - _faction = 35; - headNorth = true; - me->setActive(true); - events.ScheduleEvent(EVENT_RESTART_ESCORT, 0); - } + void Initialize() + { + _playerGUID = 0; + _faction = 35; + headNorth = true; + me->setActive(true); + events.ScheduleEvent(EVENT_RESTART_ESCORT, 0); + } - void JustRespawned() - { - npc_escortAI::JustRespawned(); - Initialize(); - } + void JustRespawned() + { + npc_escortAI::JustRespawned(); + Initialize(); + } - void InitializeAI() - { - npc_escortAI::InitializeAI(); - Initialize(); - } + void InitializeAI() + { + npc_escortAI::InitializeAI(); + Initialize(); + } - void JustDied(Unit* killer) - { - RemoveSummons(); - npc_escortAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + RemoveSummons(); + npc_escortAI::JustDied(killer); + } - void EnterEvadeMode() - { - SummonsFollow(); - ImmuneFlagSet(false, 35); - npc_escortAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + SummonsFollow(); + ImmuneFlagSet(false, 35); + npc_escortAI::EnterEvadeMode(); + } - void CheckPlayer() - { - if (_playerGUID) - if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) - if (me->IsWithinDist(player, 60.0f)) - return; + void CheckPlayer() + { + if (_playerGUID) + if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) + if (me->IsWithinDist(player, 60.0f)) + return; - _playerGUID = 0; - _faction = 35; - ImmuneFlagSet(false, _faction); - } + _playerGUID = 0; + _faction = 35; + ImmuneFlagSet(false, _faction); + } - void SetGUID(uint64 playerGUID, int32 faction) - { - _playerGUID = playerGUID; - _faction = faction; - SetEscortPaused(false); - if (Creature* active = !headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0])) - active->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - events.CancelEvent(EVENT_WAIT_FOR_ASSIST); - } + void SetGUID(uint64 playerGUID, int32 faction) + { + _playerGUID = playerGUID; + _faction = faction; + SetEscortPaused(false); + if (Creature* active = !headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0])) + active->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + events.CancelEvent(EVENT_WAIT_FOR_ASSIST); + } - void SetData(uint32 field, uint32 data) - { - if (field == 1 && data == 1) - if (Player* player = me->SelectNearestPlayer(50.0f)) - SetGUID(player->GetGUID(), player->getFaction()); - } + void SetData(uint32 field, uint32 data) + { + if (field == 1 && data == 1) + if (Player* player = me->SelectNearestPlayer(50.0f)) + SetGUID(player->GetGUID(), player->getFaction()); + } - bool CheckCaravan() - { - for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i) - { - if (summons[i] == 0) - { - SummonHelpers(); - return false; - } + bool CheckCaravan() + { + for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i) + { + if (summons[i] == 0) + { + SummonHelpers(); + return false; + } - Creature* summon = ObjectAccessor::GetCreature(*me, summons[i]); - if (!summon || me->GetDistance2d(summon) > 25.0f) - { - SummonHelpers(); - return false; - } - } - return true; - } + Creature* summon = ObjectAccessor::GetCreature(*me, summons[i]); + if (!summon || me->GetDistance2d(summon) > 25.0f) + { + SummonHelpers(); + return false; + } + } + return true; + } - void RemoveSummons() - { - for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i) - { - if (Creature* summon = ObjectAccessor::GetCreature(*me, summons[i])) - summon->DespawnOrUnsummon(); - - summons[i] = 0; - } - } + void RemoveSummons() + { + for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i) + { + if (Creature* summon = ObjectAccessor::GetCreature(*me, summons[i])) + summon->DespawnOrUnsummon(); + + summons[i] = 0; + } + } - void SummonHelpers() - { - RemoveSummons(); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + void SummonHelpers() + { + RemoveSummons(); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - Creature* cr = NULL; - if (cr = me->SummonCreature(NPC_RIGGER_GIZELTON, *me)) - { - cr->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - summons[0] = cr->GetGUID(); - } - if (cr = me->SummonCreature(NPC_CARAVAN_KODO, *me)) - summons[1] = cr->GetGUID(); - if (cr = me->SummonCreature(NPC_CARAVAN_KODO, *me)) - summons[2] = cr->GetGUID(); - - SummonsFollow(); - } + Creature* cr = NULL; + if (cr = me->SummonCreature(NPC_RIGGER_GIZELTON, *me)) + { + cr->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + summons[0] = cr->GetGUID(); + } + if (cr = me->SummonCreature(NPC_CARAVAN_KODO, *me)) + summons[1] = cr->GetGUID(); + if (cr = me->SummonCreature(NPC_CARAVAN_KODO, *me)) + summons[2] = cr->GetGUID(); + + SummonsFollow(); + } - void SummonedCreatureDies(Creature* creature, Unit*) - { - if (creature->GetGUID() == summons[0]) - summons[0] = 0; - else if (creature->GetGUID() == summons[1]) - summons[1] = 0; - else if (creature->GetGUID() == summons[2]) - summons[2] = 0; - } + void SummonedCreatureDies(Creature* creature, Unit*) + { + if (creature->GetGUID() == summons[0]) + summons[0] = 0; + else if (creature->GetGUID() == summons[1]) + summons[1] = 0; + else if (creature->GetGUID() == summons[2]) + summons[2] = 0; + } - void SummonedCreatureDespawn(Creature* creature) - { - if (creature->GetGUID() == summons[0]) - summons[0] = 0; - else if (creature->GetGUID() == summons[1]) - summons[1] = 0; - else if (creature->GetGUID() == summons[2]) - summons[2] = 0; - } + void SummonedCreatureDespawn(Creature* creature) + { + if (creature->GetGUID() == summons[0]) + summons[0] = 0; + else if (creature->GetGUID() == summons[1]) + summons[1] = 0; + else if (creature->GetGUID() == summons[2]) + summons[2] = 0; + } - void SummonsFollow() - { - float dist = 1.0f; - for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, summons[i])) - { - summon->GetMotionMaster()->Clear(false); - summon->StopMoving(); - summon->GetMotionMaster()->MoveFollow(me, dist, M_PI, MOTION_SLOT_ACTIVE); - dist += (i == 1 ? 9.5f : 3.0f); - } - } + void SummonsFollow() + { + float dist = 1.0f; + for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, summons[i])) + { + summon->GetMotionMaster()->Clear(false); + summon->StopMoving(); + summon->GetMotionMaster()->MoveFollow(me, dist, M_PI, MOTION_SLOT_ACTIVE); + dist += (i == 1 ? 9.5f : 3.0f); + } + } - void RelocateSummons() - { - for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, summons[i])) - summon->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - } + void RelocateSummons() + { + for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, summons[i])) + summon->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + } - void ImmuneFlagSet(bool remove, uint32 faction) - { - for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, summons[i])) - { - summon->setFaction(faction); - if (remove) - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - else - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - } - if (remove) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - else - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->setFaction(faction); - } + void ImmuneFlagSet(bool remove, uint32 faction) + { + for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, summons[i])) + { + summon->setFaction(faction); + if (remove) + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + else + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + } + if (remove) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + else + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->setFaction(faction); + } - void WaypointReached(uint32 waypointId) - { - RelocateSummons(); - switch (waypointId) - { - // Finished north path - case 52: - me->SummonCreature(NPC_VENDOR_TRON, -694.61f, 1460.7f, 90.794f, 2.4f, TEMPSUMMON_TIMED_DESPAWN, TIME_SHOP_STOP+15*IN_MILLISECONDS); - SetEscortPaused(true); - events.ScheduleEvent(EVENT_RESUME_PATH, TIME_SHOP_STOP); - CheckCaravan(); - break; - // Finished south path - case 193: - me->SummonCreature(NPC_SUPER_SELLER, -1905.5f, 2463.3f, 61.52f, 5.87f, TEMPSUMMON_TIMED_DESPAWN, TIME_SHOP_STOP+15*IN_MILLISECONDS); - SetEscortPaused(true); - events.ScheduleEvent(EVENT_RESUME_PATH, TIME_SHOP_STOP); - CheckCaravan(); - break; - // North -> South - hire - case 77: - SetEscortPaused(true); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - Talk(SAY_CARAVAN_HIRE); - events.ScheduleEvent(EVENT_WAIT_FOR_ASSIST, TIME_HIRE_STOP); - break; - // Sout -> North - hire - case 208: - SetEscortPaused(true); - if (Creature* rigger = ObjectAccessor::GetCreature(*me, summons[0])) - { - rigger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - rigger->AI()->Talk(SAY_CARAVAN_HIRE); - } - events.ScheduleEvent(EVENT_WAIT_FOR_ASSIST, TIME_HIRE_STOP); - break; - // North -> South - complete - case 103: - if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) - { - if (CheckCaravan()) - player->GroupEventHappens(QUEST_BODYGUARD_FOR_HIRE, player); - else - player->FailQuest(QUEST_BODYGUARD_FOR_HIRE); - } - _playerGUID = 0; - CheckPlayer(); - break; - // South -> North - complete - case 235: - if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) - { - if (CheckCaravan()) - player->GroupEventHappens(QUEST_GIZELTON_CARAVAN, player); - else - player->FailQuest(QUEST_GIZELTON_CARAVAN); - } - _playerGUID = 0; - CheckPlayer(); - break; - // North -> South - spawn attackers - case 83: - case 93: - case 100: - { - if (!_playerGUID) - return; - ImmuneFlagSet(true, _faction); - Creature* cr = NULL; - for (uint8 i = 0; i < 4; ++i) - { - float o = (i*M_PI/2)+(M_PI/4); - float x = me->GetPositionX()+cos(o)*15.0f; - float y = me->GetPositionY()+sin(o)*15.0f; - if (cr = me->SummonCreature((i%2 == 0 ? NPC_KOLKAR_WAYLAYER : NPC_KOLKAR_AMBUSHER), - x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - cr->AI()->AttackStart(me); - } - if (cr) - { - AttackStart(cr); - me->CallForHelp(50.0f); - } - break; - } - // South -> North - spawn attackers - case 221: - case 228: - case 233: - { - if (!_playerGUID) - return; - ImmuneFlagSet(true, _faction); - Creature* cr = NULL; - for (uint8 i = 0; i < 3; ++i) - { - float o = i*2*M_PI/3; - float x = me->GetPositionX()+cos(o)*10.0f; - float y = me->GetPositionY()+sin(o)*10.0f; - uint32 entry = NPC_LESSER_INFERNAL; - if (i) - entry = i == 1 ? NPC_DOOMWARDER : NPC_NETHER; + void WaypointReached(uint32 waypointId) + { + RelocateSummons(); + switch (waypointId) + { + // Finished north path + case 52: + me->SummonCreature(NPC_VENDOR_TRON, -694.61f, 1460.7f, 90.794f, 2.4f, TEMPSUMMON_TIMED_DESPAWN, TIME_SHOP_STOP+15*IN_MILLISECONDS); + SetEscortPaused(true); + events.ScheduleEvent(EVENT_RESUME_PATH, TIME_SHOP_STOP); + CheckCaravan(); + break; + // Finished south path + case 193: + me->SummonCreature(NPC_SUPER_SELLER, -1905.5f, 2463.3f, 61.52f, 5.87f, TEMPSUMMON_TIMED_DESPAWN, TIME_SHOP_STOP+15*IN_MILLISECONDS); + SetEscortPaused(true); + events.ScheduleEvent(EVENT_RESUME_PATH, TIME_SHOP_STOP); + CheckCaravan(); + break; + // North -> South - hire + case 77: + SetEscortPaused(true); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + Talk(SAY_CARAVAN_HIRE); + events.ScheduleEvent(EVENT_WAIT_FOR_ASSIST, TIME_HIRE_STOP); + break; + // Sout -> North - hire + case 208: + SetEscortPaused(true); + if (Creature* rigger = ObjectAccessor::GetCreature(*me, summons[0])) + { + rigger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + rigger->AI()->Talk(SAY_CARAVAN_HIRE); + } + events.ScheduleEvent(EVENT_WAIT_FOR_ASSIST, TIME_HIRE_STOP); + break; + // North -> South - complete + case 103: + if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) + { + if (CheckCaravan()) + player->GroupEventHappens(QUEST_BODYGUARD_FOR_HIRE, player); + else + player->FailQuest(QUEST_BODYGUARD_FOR_HIRE); + } + _playerGUID = 0; + CheckPlayer(); + break; + // South -> North - complete + case 235: + if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) + { + if (CheckCaravan()) + player->GroupEventHappens(QUEST_GIZELTON_CARAVAN, player); + else + player->FailQuest(QUEST_GIZELTON_CARAVAN); + } + _playerGUID = 0; + CheckPlayer(); + break; + // North -> South - spawn attackers + case 83: + case 93: + case 100: + { + if (!_playerGUID) + return; + ImmuneFlagSet(true, _faction); + Creature* cr = NULL; + for (uint8 i = 0; i < 4; ++i) + { + float o = (i*M_PI/2)+(M_PI/4); + float x = me->GetPositionX()+cos(o)*15.0f; + float y = me->GetPositionY()+sin(o)*15.0f; + if (cr = me->SummonCreature((i%2 == 0 ? NPC_KOLKAR_WAYLAYER : NPC_KOLKAR_AMBUSHER), + x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + cr->AI()->AttackStart(me); + } + if (cr) + { + AttackStart(cr); + me->CallForHelp(50.0f); + } + break; + } + // South -> North - spawn attackers + case 221: + case 228: + case 233: + { + if (!_playerGUID) + return; + ImmuneFlagSet(true, _faction); + Creature* cr = NULL; + for (uint8 i = 0; i < 3; ++i) + { + float o = i*2*M_PI/3; + float x = me->GetPositionX()+cos(o)*10.0f; + float y = me->GetPositionY()+sin(o)*10.0f; + uint32 entry = NPC_LESSER_INFERNAL; + if (i) + entry = i == 1 ? NPC_DOOMWARDER : NPC_NETHER; - if (cr = me->SummonCreature(entry, x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - cr->AI()->AttackStart(me); - } - if (cr) - { - AttackStart(cr); - me->CallForHelp(50.0f); - } - break; - } - case 282: - events.ScheduleEvent(EVENT_RESTART_ESCORT, 1000); - break; + if (cr = me->SummonCreature(entry, x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + cr->AI()->AttackStart(me); + } + if (cr) + { + AttackStart(cr); + me->CallForHelp(50.0f); + } + break; + } + case 282: + events.ScheduleEvent(EVENT_RESTART_ESCORT, 1000); + break; - } - } + } + } - void UpdateEscortAI(uint32 diff) - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_RESUME_PATH: - SetEscortPaused(false); - if (Creature* talker = headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0])) - talker->AI()->Talk(SAY_CARAVAN_LEAVE); + void UpdateEscortAI(uint32 diff) + { + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_RESUME_PATH: + SetEscortPaused(false); + if (Creature* talker = headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0])) + talker->AI()->Talk(SAY_CARAVAN_LEAVE); - headNorth = !headNorth; - break; - case EVENT_WAIT_FOR_ASSIST: - SetEscortPaused(false); - if (Creature* active = !headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0])) - active->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - break; - case EVENT_RESTART_ESCORT: - CheckCaravan(); - SetDespawnAtEnd(false); - Start(true, true, 0, 0, false, false, true); - break; - } + headNorth = !headNorth; + break; + case EVENT_WAIT_FOR_ASSIST: + SetEscortPaused(false); + if (Creature* active = !headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0])) + active->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + break; + case EVENT_RESTART_ESCORT: + CheckCaravan(); + SetDespawnAtEnd(false); + Start(true, true, 0, 0, false, false, true); + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; @@ -454,16 +454,16 @@ public: { npc_aged_dying_ancient_kodoAI(Creature* creature) : ScriptedAI(creature) {} - void JustRespawned() - { - me->UpdateEntry(RAND(NPC_AGED_KODO, NPC_DYING_KODO, NPC_ANCIENT_KODO), NULL, false); - } + void JustRespawned() + { + me->UpdateEntry(RAND(NPC_AGED_KODO, NPC_DYING_KODO, NPC_ANCIENT_KODO), NULL, false); + } void MoveInLineOfSight(Unit* who) { if (who->GetEntry() == NPC_SMEED && me->IsWithinDistInMap(who, 10.0f) && !me->HasAura(SPELL_KODO_KOMBO_GOSSIP)) { - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); me->GetMotionMaster()->Clear(); DoCast(me, SPELL_KODO_KOMBO_GOSSIP, true); @@ -480,10 +480,10 @@ public: && (me->GetEntry() == NPC_AGED_KODO || me->GetEntry() == NPC_DYING_KODO || me->GetEntry() == NPC_ANCIENT_KODO)) { me->UpdateEntry(NPC_TAMED_KODO, NULL, false); - EnterEvadeMode(); + EnterEvadeMode(); me->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, me->GetFollowAngle()); - caster->CastSpell(caster, SPELL_KODO_KOMBO_PLAYER_BUFF, true); + caster->CastSpell(caster, SPELL_KODO_KOMBO_PLAYER_BUFF, true); DoCast(me, SPELL_KODO_KOMBO_DESPAWN_BUFF, true); } } @@ -618,10 +618,10 @@ class go_demon_portal : public GameObjectScript void AddSC_desolace() { - // Ours - new npc_cork_gizelton(); + // Ours + new npc_cork_gizelton(); - // Theirs + // Theirs new npc_aged_dying_ancient_kodo(); new npc_dalinda(); new go_demon_portal(); diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp index 8a3f50625..9b65b6c47 100644 --- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp @@ -187,9 +187,9 @@ public: { Damage = 0; - if (pDoneBy) - if (Player* player = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me); + if (pDoneBy) + if (Player* player = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself()) + player->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me); Talk(EMOTE_SURRENDER); EnterEvadeMode(); @@ -352,7 +352,7 @@ class spell_ooze_zap_channel_end : public SpellScriptLoader PreventHitDefaultEffect(effIndex); if (Player* player = GetCaster()->ToPlayer()) player->CastSpell(player, SPELL_OOZE_CHANNEL_CREDIT, true); - Unit::Kill(GetHitUnit(), GetHitUnit()); + Unit::Kill(GetHitUnit(), GetHitUnit()); } void Register() diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index d28ff449d..14e131e23 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -1258,26 +1258,26 @@ class go_wind_stone : public GameObjectScript void SummonNPC(GameObject* go, Player* player, uint32 npc, uint32 spellId) { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (!spellInfo) - return; - SpellInfo const* spellInfoTrigger = sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell); - if (!spellInfoTrigger) - return; - Spell* spell = new Spell(player, spellInfoTrigger, TRIGGERED_NONE); - SpellCastResult result = spell->CheckCast(true); - delete spell; - if (result != SPELL_CAST_OK) - { - if (result == SPELL_FAILED_REAGENTS) - { - std::string accountName; - AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName); - sWorld->BanAccount(BAN_ACCOUNT, accountName, "0s", "Wind Stone exploit", "Server"); - } - return; - } - player->CastSpell(player, spellInfoTrigger->Id, false); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + if (!spellInfo) + return; + SpellInfo const* spellInfoTrigger = sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].TriggerSpell); + if (!spellInfoTrigger) + return; + Spell* spell = new Spell(player, spellInfoTrigger, TRIGGERED_NONE); + SpellCastResult result = spell->CheckCast(true); + delete spell; + if (result != SPELL_CAST_OK) + { + if (result == SPELL_FAILED_REAGENTS) + { + std::string accountName; + AccountMgr::GetName(player->GetSession()->GetAccountId(), accountName); + sWorld->BanAccount(BAN_ACCOUNT, accountName, "0s", "Wind Stone exploit", "Server"); + } + return; + } + player->CastSpell(player, spellInfoTrigger->Id, false); TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - M_PI, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10 * 60 * 1000); summons->CastSpell(summons, SPELL_SPAWN_IN, false); switch (summons->GetEntry()) diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp index 3270430a9..0f2e87cb3 100644 --- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp +++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp @@ -347,15 +347,15 @@ public: void EnterCombat(Unit* /*who*/) { } - void EnterEvadeMode() - { - CleanUp(); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + CleanUp(); + ScriptedAI::EnterEvadeMode(); + } - void CleanUp() - { - for (uint8 i = 0; i < 6; ++i) // unsummon challengers + void CleanUp() + { + for (uint8 i = 0; i < 6; ++i) // unsummon challengers if (AffrayChallenger[i]) if (Creature* creature = ObjectAccessor::GetCreature((*me), AffrayChallenger[i])) creature->DespawnOrUnsummon(1); @@ -363,7 +363,7 @@ public: if (BigWill) // unsummon bigWill if (Creature* creature = ObjectAccessor::GetCreature((*me), BigWill)) creature->DespawnOrUnsummon(1); - } + } void MoveInLineOfSight(Unit* who) { @@ -380,19 +380,19 @@ public: void UpdateAI(uint32 diff) { if (EventInProgress) - { + { Player* pWarrior = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (!pWarrior || me->GetDistance2d(pWarrior) >= 200.0f) - { - EnterEvadeMode(); + { + EnterEvadeMode(); return; - } + } if (!pWarrior->IsAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) - { + { Talk(SAY_TWIGGY_FLATHEAD_DOWN); pWarrior->FailQuest(1719); - EnterEvadeMode(); + EnterEvadeMode(); return; } @@ -402,7 +402,7 @@ public: pWarrior->GetPosition(x, y, z); if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) - { + { pWarrior->AreaExploredOrEventHappens(1719); Talk(SAY_TWIGGY_FLATHEAD_BEGIN, pWarrior); @@ -455,11 +455,11 @@ public: creature->setFaction(14); creature->AI()->AttackStart(pWarrior); } - ++Wave; + ++Wave; WaveTimer = 20000; } else if (Wave >= 6 && !EventBigWill) - { + { if (Creature* creature = me->SummonCreature(NPC_BIG_WILL, -1722, -4341, 6.12f, 6.26f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 480000)) { BigWill = creature->GetGUID(); @@ -476,7 +476,7 @@ public: { Talk(SAY_TWIGGY_FLATHEAD_OVER); EnterEvadeMode(); - return; + return; } else if (creature) // Makes BIG WILL attackable. { @@ -486,11 +486,11 @@ public: creature->setFaction(14); creature->AI()->AttackStart(pWarrior); } - WaveTimer = 2000; + WaveTimer = 2000; } } - else - WaveTimer -= diff; + else + WaveTimer -= diff; } } } diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index c90ce0a04..0e6553ef4 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -39,31 +39,31 @@ EndContentData */ // Ours enum eStaveQuest { - QUEST_STAVE_OF_THE_ANCIENTS = 7636, + QUEST_STAVE_OF_THE_ANCIENTS = 7636, - NPC_SIMONE_NORMAL = 14527, - NPC_FRANKLIN_NORMAL = 14529, - NPC_ARTORIUS_NORMAL = 14531, - NPC_NELSON_NORMAL = 14536, - NPC_PRECIOUS = 14528, + NPC_SIMONE_NORMAL = 14527, + NPC_FRANKLIN_NORMAL = 14529, + NPC_ARTORIUS_NORMAL = 14531, + NPC_NELSON_NORMAL = 14536, + NPC_PRECIOUS = 14528, - NPC_SIMONE_EVIL = 14533, - NPC_FRANKLIN_EVIL = 14534, - NPC_ARTORIUS_EVIL = 14535, - NPC_NELSON_EVIL = 14530, - NPC_PRECIOUS_EVIL = 14538, + NPC_SIMONE_EVIL = 14533, + NPC_FRANKLIN_EVIL = 14534, + NPC_ARTORIUS_EVIL = 14535, + NPC_NELSON_EVIL = 14530, + NPC_PRECIOUS_EVIL = 14538, - EVENT_CHECK_PLAYER = 1, - EVENT_SPELL_CHAIN_LIGHTNING = 23206, - EVENT_SPELL_TEMPTRESS_KISS = 23205, - EVENT_SPELL_DEMONIC_ENRAGE = 23257, - EVENT_SPELL_ENTROPIC_STING = 23260, - EVENT_SPELL_DEMONIC_DOOM = 23298, - EVENT_SPELL_STINGING_TRAUMA = 23299, - EVENT_SPELL_DREADFUL_FRIGHT = 23275, + EVENT_CHECK_PLAYER = 1, + EVENT_SPELL_CHAIN_LIGHTNING = 23206, + EVENT_SPELL_TEMPTRESS_KISS = 23205, + EVENT_SPELL_DEMONIC_ENRAGE = 23257, + EVENT_SPELL_ENTROPIC_STING = 23260, + EVENT_SPELL_DEMONIC_DOOM = 23298, + EVENT_SPELL_STINGING_TRAUMA = 23299, + EVENT_SPELL_DREADFUL_FRIGHT = 23275, - SPELL_FOOLS_PLIGHT = 23504, - SPELL_SOUL_FLAME = 23272, + SPELL_FOOLS_PLIGHT = 23504, + SPELL_SOUL_FLAME = 23272, }; class npc_stave_of_the_ancients : public CreatureScript @@ -79,135 +79,135 @@ public: struct npc_stave_of_the_ancientsAI : public ScriptedAI { npc_stave_of_the_ancientsAI(Creature* creature) : ScriptedAI(creature) - { - changeEntry = me->GetEntry(); - switch (me->GetEntry()) - { - case NPC_SIMONE_NORMAL: changeEntry = NPC_SIMONE_EVIL; break; - case NPC_FRANKLIN_NORMAL: changeEntry = NPC_FRANKLIN_EVIL; break; - case NPC_ARTORIUS_NORMAL: changeEntry = NPC_ARTORIUS_EVIL; break; - case NPC_NELSON_NORMAL: changeEntry = NPC_NELSON_EVIL; break; - case NPC_PRECIOUS: changeEntry = NPC_PRECIOUS_EVIL; break; - } - } + { + changeEntry = me->GetEntry(); + switch (me->GetEntry()) + { + case NPC_SIMONE_NORMAL: changeEntry = NPC_SIMONE_EVIL; break; + case NPC_FRANKLIN_NORMAL: changeEntry = NPC_FRANKLIN_EVIL; break; + case NPC_ARTORIUS_NORMAL: changeEntry = NPC_ARTORIUS_EVIL; break; + case NPC_NELSON_NORMAL: changeEntry = NPC_NELSON_EVIL; break; + case NPC_PRECIOUS: changeEntry = NPC_PRECIOUS_EVIL; break; + } + } - uint64 playerGUID; - EventMap events; - uint32 changeEntry; - bool damaged; + uint64 playerGUID; + EventMap events; + uint32 changeEntry; + bool damaged; - void Reset() - { - if (me->GetOriginalEntry() != me->GetEntry()) - me->UpdateEntry(me->GetOriginalEntry()); + void Reset() + { + if (me->GetOriginalEntry() != me->GetEntry()) + me->UpdateEntry(me->GetOriginalEntry()); - events.Reset(); - playerGUID = 0; - damaged = false; - } + events.Reset(); + playerGUID = 0; + damaged = false; + } - void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) - { - if (!damaged) - { - if (who && who->GetGUID() != playerGUID && (who->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(who->GetOwnerGUID()))) - { - damaged = true; - me->CastSpell(who, SPELL_FOOLS_PLIGHT, true); - } - } - else - damaged = false; - } + void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) + { + if (!damaged) + { + if (who && who->GetGUID() != playerGUID && (who->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(who->GetOwnerGUID()))) + { + damaged = true; + me->CastSpell(who, SPELL_FOOLS_PLIGHT, true); + } + } + else + damaged = false; + } - void EnterCombat(Unit*) - { - switch (changeEntry) - { - case NPC_SIMONE_EVIL: - events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, 3000); - events.ScheduleEvent(EVENT_SPELL_TEMPTRESS_KISS, 1000); - break; - case NPC_FRANKLIN_EVIL: - events.ScheduleEvent(EVENT_SPELL_DEMONIC_ENRAGE, 3000); - events.ScheduleEvent(EVENT_SPELL_ENTROPIC_STING, 5000); - break; - case NPC_ARTORIUS_EVIL: - events.ScheduleEvent(EVENT_SPELL_DEMONIC_DOOM, 3000); - events.ScheduleEvent(EVENT_SPELL_STINGING_TRAUMA, 5000); - break; - case NPC_NELSON_EVIL: - me->CastSpell(me, SPELL_SOUL_FLAME, true); - events.ScheduleEvent(EVENT_SPELL_DREADFUL_FRIGHT, 5000); - break; - } - } + void EnterCombat(Unit*) + { + switch (changeEntry) + { + case NPC_SIMONE_EVIL: + events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, 3000); + events.ScheduleEvent(EVENT_SPELL_TEMPTRESS_KISS, 1000); + break; + case NPC_FRANKLIN_EVIL: + events.ScheduleEvent(EVENT_SPELL_DEMONIC_ENRAGE, 3000); + events.ScheduleEvent(EVENT_SPELL_ENTROPIC_STING, 5000); + break; + case NPC_ARTORIUS_EVIL: + events.ScheduleEvent(EVENT_SPELL_DEMONIC_DOOM, 3000); + events.ScheduleEvent(EVENT_SPELL_STINGING_TRAUMA, 5000); + break; + case NPC_NELSON_EVIL: + me->CastSpell(me, SPELL_SOUL_FLAME, true); + events.ScheduleEvent(EVENT_SPELL_DREADFUL_FRIGHT, 5000); + break; + } + } - void MoveInLineOfSight(Unit* who) - { - if (me->GetEntry() != changeEntry && who->GetTypeId() == TYPEID_PLAYER && who->ToPlayer()->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE) - { - playerGUID = who->GetGUID(); - me->UpdateEntry(changeEntry); - events.ScheduleEvent(EVENT_CHECK_PLAYER, 5000); - return; - } - ScriptedAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit* who) + { + if (me->GetEntry() != changeEntry && who->GetTypeId() == TYPEID_PLAYER && who->ToPlayer()->GetQuestStatus(QUEST_STAVE_OF_THE_ANCIENTS) == QUEST_STATUS_INCOMPLETE) + { + playerGUID = who->GetGUID(); + me->UpdateEntry(changeEntry); + events.ScheduleEvent(EVENT_CHECK_PLAYER, 5000); + return; + } + ScriptedAI::MoveInLineOfSight(who); + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - uint32 eventId = events.GetEvent(); - if (eventId == EVENT_CHECK_PLAYER) - { - Player* player = ObjectAccessor::GetPlayer(*me, playerGUID); - if (!player || !player->IsWithinDist2d(me, 60.0f)) - EnterEvadeMode(); - else - events.RepeatEvent(5000); - return; - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + uint32 eventId = events.GetEvent(); + if (eventId == EVENT_CHECK_PLAYER) + { + Player* player = ObjectAccessor::GetPlayer(*me, playerGUID); + if (!player || !player->IsWithinDist2d(me, 60.0f)) + EnterEvadeMode(); + else + events.RepeatEvent(5000); + return; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (eventId) - { - case EVENT_SPELL_CHAIN_LIGHTNING: - me->CastSpell(me->GetVictim(), eventId, false); - events.RepeatEvent(7000); - break; - case EVENT_SPELL_TEMPTRESS_KISS: - me->CastSpell(me->GetVictim(), eventId, false); - events.RepeatEvent(45000); - break; - case EVENT_SPELL_DEMONIC_ENRAGE: - me->CastSpell(me, eventId, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_ENTROPIC_STING: - me->CastSpell(me->GetVictim(), eventId, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_DEMONIC_DOOM: - me->CastSpell(me->GetVictim(), eventId, false); - events.RepeatEvent(50000); - break; - case EVENT_SPELL_STINGING_TRAUMA: - me->CastSpell(me->GetVictim(), eventId, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_DREADFUL_FRIGHT: - me->CastSpell(me->GetVictim(), eventId, false); - events.RepeatEvent(15000); - break; - } + switch (eventId) + { + case EVENT_SPELL_CHAIN_LIGHTNING: + me->CastSpell(me->GetVictim(), eventId, false); + events.RepeatEvent(7000); + break; + case EVENT_SPELL_TEMPTRESS_KISS: + me->CastSpell(me->GetVictim(), eventId, false); + events.RepeatEvent(45000); + break; + case EVENT_SPELL_DEMONIC_ENRAGE: + me->CastSpell(me, eventId, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_ENTROPIC_STING: + me->CastSpell(me->GetVictim(), eventId, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_DEMONIC_DOOM: + me->CastSpell(me->GetVictim(), eventId, false); + events.RepeatEvent(50000); + break; + case EVENT_SPELL_STINGING_TRAUMA: + me->CastSpell(me->GetVictim(), eventId, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_DREADFUL_FRIGHT: + me->CastSpell(me->GetVictim(), eventId, false); + events.RepeatEvent(15000); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; }; @@ -795,10 +795,10 @@ public: void AddSC_winterspring() { - // Ours - new npc_stave_of_the_ancients(); + // Ours + new npc_stave_of_the_ancients(); - // Theirs + // Theirs new npc_rivern_frostwind(); new npc_ranshalla(); new go_elune_fire(); diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h index ff32b4e23..6fcb6a635 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h @@ -7,28 +7,28 @@ REWRITTEN BY XINEF enum ANData { - DATA_KRIKTHIR_THE_GATEWATCHER_EVENT = 0, - DATA_HADRONOX_EVENT = 1, - DATA_ANUBARAK_EVENT = 2, - MAX_ENCOUNTERS = 3 + DATA_KRIKTHIR_THE_GATEWATCHER_EVENT = 0, + DATA_HADRONOX_EVENT = 1, + DATA_ANUBARAK_EVENT = 2, + MAX_ENCOUNTERS = 3 }; enum ANIds { NPC_SKITTERING_SWARMER = 28735, NPC_SKITTERING_INFECTIOR = 28736, - NPC_KRIKTHIR_THE_GATEWATCHER = 28684, - NPC_HADRONOX = 28921, - NPC_ANUB_AR_CHAMPION = 29062, - NPC_ANUB_AR_NECROMANCER = 29063, - NPC_ANUB_AR_CRYPTFIEND = 29064, + NPC_KRIKTHIR_THE_GATEWATCHER = 28684, + NPC_HADRONOX = 28921, + NPC_ANUB_AR_CHAMPION = 29062, + NPC_ANUB_AR_NECROMANCER = 29063, + NPC_ANUB_AR_CRYPTFIEND = 29064, - GO_KRIKTHIR_DOORS = 192395, - GO_ANUBARAK_DOORS1 = 192396, - GO_ANUBARAK_DOORS2 = 192397, - GO_ANUBARAK_DOORS3 = 192398, + GO_KRIKTHIR_DOORS = 192395, + GO_ANUBARAK_DOORS1 = 192396, + GO_ANUBARAK_DOORS2 = 192397, + GO_ANUBARAK_DOORS3 = 192398, - SPELL_WEB_WRAP_TRIGGER = 52087 + SPELL_WEB_WRAP_TRIGGER = 52087 }; #endif diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index b18e4e658..4f321a03f 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -8,252 +8,252 @@ REWRITTEN BY XINEF enum Spells { - SPELL_CARRION_BEETLES = 53520, - SPELL_SUMMON_CARRION_BEETLES = 53521, - SPELL_LEECHING_SWARM = 53467, - SPELL_POUND = 53472, - SPELL_POUND_DAMAGE = 53509, - SPELL_IMPALE_PERIODIC = 53456, - SPELL_EMERGE = 53500, - SPELL_SUBMERGE = 53421, - SPELL_SELF_ROOT = 42716, + SPELL_CARRION_BEETLES = 53520, + SPELL_SUMMON_CARRION_BEETLES = 53521, + SPELL_LEECHING_SWARM = 53467, + SPELL_POUND = 53472, + SPELL_POUND_DAMAGE = 53509, + SPELL_IMPALE_PERIODIC = 53456, + SPELL_EMERGE = 53500, + SPELL_SUBMERGE = 53421, + SPELL_SELF_ROOT = 42716, - SPELL_SUMMON_DARTER = 53599, - SPELL_SUMMON_ASSASSIN = 53610, - SPELL_SUMMON_GUARDIAN = 53614, - SPELL_SUMMON_VENOMANCER = 53615, + SPELL_SUMMON_DARTER = 53599, + SPELL_SUMMON_ASSASSIN = 53610, + SPELL_SUMMON_GUARDIAN = 53614, + SPELL_SUMMON_VENOMANCER = 53615, }; enum Yells { - SAY_AGGRO = 0, - SAY_SLAY = 1, - SAY_DEATH = 2, - SAY_LOCUST = 3, - SAY_SUBMERGE = 4, - SAY_INTRO = 5 + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_DEATH = 2, + SAY_LOCUST = 3, + SAY_SUBMERGE = 4, + SAY_INTRO = 5 }; enum Misc { - ACHIEV_TIMED_START_EVENT = 20381, + ACHIEV_TIMED_START_EVENT = 20381, - EVENT_CHECK_HEALTH_25 = 1, - EVENT_CHECK_HEALTH_50 = 2, - EVENT_CHECK_HEALTH_75 = 3, - EVENT_CARRION_BEETELS = 4, - EVENT_LEECHING_SWARM = 5, - EVENT_IMPALE = 6, - EVENT_POUND = 7, - EVENT_CLOSE_DOORS = 8, - EVENT_EMERGE = 9, - EVENT_SUMMON_VENOMANCER = 10, - EVENT_SUMMON_DARTER = 11, - EVENT_SUMMON_GUARDIAN = 12, - EVENT_SUMMON_ASSASSINS = 13, - EVENT_ENABLE_ROTATE = 14, - EVENT_KILL_TALK = 15 + EVENT_CHECK_HEALTH_25 = 1, + EVENT_CHECK_HEALTH_50 = 2, + EVENT_CHECK_HEALTH_75 = 3, + EVENT_CARRION_BEETELS = 4, + EVENT_LEECHING_SWARM = 5, + EVENT_IMPALE = 6, + EVENT_POUND = 7, + EVENT_CLOSE_DOORS = 8, + EVENT_EMERGE = 9, + EVENT_SUMMON_VENOMANCER = 10, + EVENT_SUMMON_DARTER = 11, + EVENT_SUMMON_GUARDIAN = 12, + EVENT_SUMMON_ASSASSINS = 13, + EVENT_ENABLE_ROTATE = 14, + EVENT_KILL_TALK = 15 }; class boss_anub_arak : public CreatureScript { - public: - boss_anub_arak() : CreatureScript("boss_anub_arak") { } + public: + boss_anub_arak() : CreatureScript("boss_anub_arak") { } - struct boss_anub_arakAI : public BossAI - { - boss_anub_arakAI(Creature* creature) : BossAI(creature, DATA_ANUBARAK_EVENT) - { - me->m_SightDistance = 120.0f; - intro = false; - } + struct boss_anub_arakAI : public BossAI + { + boss_anub_arakAI(Creature* creature) : BossAI(creature, DATA_ANUBARAK_EVENT) + { + me->m_SightDistance = 120.0f; + intro = false; + } - bool intro; + bool intro; - void EnterEvadeMode() - { - me->DisableRotate(false); - BossAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->DisableRotate(false); + BossAI::EnterEvadeMode(); + } - void MoveInLineOfSight(Unit* who) - { - if (!intro && who->GetTypeId() == TYPEID_PLAYER) - { - intro = true; - Talk(SAY_INTRO); - } - BossAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit* who) + { + if (!intro && who->GetTypeId() == TYPEID_PLAYER) + { + intro = true; + Talk(SAY_INTRO); + } + BossAI::MoveInLineOfSight(who); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + } - void KilledUnit(Unit* victim) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* victim) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (!summon->IsTrigger()) - summon->SetInCombatWithZone(); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (!summon->IsTrigger()) + summon->SetInCombatWithZone(); + } - void Reset() - { - BossAI::Reset(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } + void Reset() + { + BossAI::Reset(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } - void EnterCombat(Unit* ) - { - Talk(SAY_AGGRO); - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + void EnterCombat(Unit* ) + { + Talk(SAY_AGGRO); + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - events.ScheduleEvent(EVENT_CARRION_BEETELS, 6500); - events.ScheduleEvent(EVENT_LEECHING_SWARM, 20000); - events.ScheduleEvent(EVENT_POUND, 15000); - events.ScheduleEvent(EVENT_CHECK_HEALTH_75, 1000); - events.ScheduleEvent(EVENT_CHECK_HEALTH_50, 1000); - events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 1000); - events.ScheduleEvent(EVENT_CLOSE_DOORS, 5000); - } + events.ScheduleEvent(EVENT_CARRION_BEETELS, 6500); + events.ScheduleEvent(EVENT_LEECHING_SWARM, 20000); + events.ScheduleEvent(EVENT_POUND, 15000); + events.ScheduleEvent(EVENT_CHECK_HEALTH_75, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH_50, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH_25, 1000); + events.ScheduleEvent(EVENT_CLOSE_DOORS, 5000); + } - void SummonHelpers(float x, float y, float z, uint32 spellId) - { - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId); - me->SummonCreature(spellInfo->Effects[EFFECT_0].MiscValue, x, y, z); - } + void SummonHelpers(float x, float y, float z, uint32 spellId) + { + const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId); + me->SummonCreature(spellInfo->Effects[EFFECT_0].MiscValue, x, y, z); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (uint32 eventId = events.ExecuteEvent()) - { - case EVENT_CLOSE_DOORS: - _EnterCombat(); - break; - case EVENT_CARRION_BEETELS: - me->CastSpell(me, SPELL_CARRION_BEETLES, false); - events.ScheduleEvent(EVENT_CARRION_BEETELS, 25000); - break; - case EVENT_LEECHING_SWARM: - Talk(SAY_LOCUST); - me->CastSpell(me, SPELL_LEECHING_SWARM, false); - events.ScheduleEvent(EVENT_LEECHING_SWARM, 20000); - break; - case EVENT_POUND: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f)) - { - me->CastSpell(me, SPELL_SELF_ROOT, true); - me->DisableRotate(true); - me->SendMovementFlagUpdate(); - events.ScheduleEvent(EVENT_ENABLE_ROTATE, 3300); - me->CastSpell(target, SPELL_POUND, false); - } - events.ScheduleEvent(EVENT_POUND, 18000); - break; - case EVENT_ENABLE_ROTATE: - me->RemoveAurasDueToSpell(SPELL_SELF_ROOT); - me->DisableRotate(false); - break; - case EVENT_CHECK_HEALTH_25: - case EVENT_CHECK_HEALTH_50: - case EVENT_CHECK_HEALTH_75: - if (me->HealthBelowPct(eventId*25)) - { - Talk(SAY_SUBMERGE); - me->CastSpell(me, SPELL_IMPALE_PERIODIC, true); - me->CastSpell(me, SPELL_SUBMERGE, false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + switch (uint32 eventId = events.ExecuteEvent()) + { + case EVENT_CLOSE_DOORS: + _EnterCombat(); + break; + case EVENT_CARRION_BEETELS: + me->CastSpell(me, SPELL_CARRION_BEETLES, false); + events.ScheduleEvent(EVENT_CARRION_BEETELS, 25000); + break; + case EVENT_LEECHING_SWARM: + Talk(SAY_LOCUST); + me->CastSpell(me, SPELL_LEECHING_SWARM, false); + events.ScheduleEvent(EVENT_LEECHING_SWARM, 20000); + break; + case EVENT_POUND: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f)) + { + me->CastSpell(me, SPELL_SELF_ROOT, true); + me->DisableRotate(true); + me->SendMovementFlagUpdate(); + events.ScheduleEvent(EVENT_ENABLE_ROTATE, 3300); + me->CastSpell(target, SPELL_POUND, false); + } + events.ScheduleEvent(EVENT_POUND, 18000); + break; + case EVENT_ENABLE_ROTATE: + me->RemoveAurasDueToSpell(SPELL_SELF_ROOT); + me->DisableRotate(false); + break; + case EVENT_CHECK_HEALTH_25: + case EVENT_CHECK_HEALTH_50: + case EVENT_CHECK_HEALTH_75: + if (me->HealthBelowPct(eventId*25)) + { + Talk(SAY_SUBMERGE); + me->CastSpell(me, SPELL_IMPALE_PERIODIC, true); + me->CastSpell(me, SPELL_SUBMERGE, false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - events.DelayEvents(46000, 0); - events.ScheduleEvent(EVENT_EMERGE, 45000); - events.ScheduleEvent(EVENT_SUMMON_ASSASSINS, 2000); - events.ScheduleEvent(EVENT_SUMMON_GUARDIAN, 4000); - events.ScheduleEvent(EVENT_SUMMON_ASSASSINS, 15000); - events.ScheduleEvent(EVENT_SUMMON_VENOMANCER, 20000); - events.ScheduleEvent(EVENT_SUMMON_DARTER, 30000); - events.ScheduleEvent(EVENT_SUMMON_ASSASSINS, 35000); - break; - } - events.ScheduleEvent(eventId, 500); - break; - case EVENT_EMERGE: - me->CastSpell(me, SPELL_EMERGE, true); - me->RemoveAura(SPELL_SUBMERGE); - me->RemoveAura(SPELL_IMPALE_PERIODIC); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - break; - case EVENT_SUMMON_ASSASSINS: - SummonHelpers(509.32f, 247.42f, 239.48f, SPELL_SUMMON_ASSASSIN); - SummonHelpers(589.51f, 240.19f, 236.0f, SPELL_SUMMON_ASSASSIN); - break; - case EVENT_SUMMON_DARTER: - SummonHelpers(509.32f, 247.42f, 239.48f, SPELL_SUMMON_DARTER); - SummonHelpers(589.51f, 240.19f, 236.0f, SPELL_SUMMON_DARTER); - break; - case EVENT_SUMMON_GUARDIAN: - SummonHelpers(550.34f, 316.00f, 234.30f, SPELL_SUMMON_GUARDIAN); - break; - case EVENT_SUMMON_VENOMANCER: - SummonHelpers(550.34f, 316.00f, 234.30f, SPELL_SUMMON_VENOMANCER); - break; - } + events.DelayEvents(46000, 0); + events.ScheduleEvent(EVENT_EMERGE, 45000); + events.ScheduleEvent(EVENT_SUMMON_ASSASSINS, 2000); + events.ScheduleEvent(EVENT_SUMMON_GUARDIAN, 4000); + events.ScheduleEvent(EVENT_SUMMON_ASSASSINS, 15000); + events.ScheduleEvent(EVENT_SUMMON_VENOMANCER, 20000); + events.ScheduleEvent(EVENT_SUMMON_DARTER, 30000); + events.ScheduleEvent(EVENT_SUMMON_ASSASSINS, 35000); + break; + } + events.ScheduleEvent(eventId, 500); + break; + case EVENT_EMERGE: + me->CastSpell(me, SPELL_EMERGE, true); + me->RemoveAura(SPELL_SUBMERGE); + me->RemoveAura(SPELL_IMPALE_PERIODIC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + break; + case EVENT_SUMMON_ASSASSINS: + SummonHelpers(509.32f, 247.42f, 239.48f, SPELL_SUMMON_ASSASSIN); + SummonHelpers(589.51f, 240.19f, 236.0f, SPELL_SUMMON_ASSASSIN); + break; + case EVENT_SUMMON_DARTER: + SummonHelpers(509.32f, 247.42f, 239.48f, SPELL_SUMMON_DARTER); + SummonHelpers(589.51f, 240.19f, 236.0f, SPELL_SUMMON_DARTER); + break; + case EVENT_SUMMON_GUARDIAN: + SummonHelpers(550.34f, 316.00f, 234.30f, SPELL_SUMMON_GUARDIAN); + break; + case EVENT_SUMMON_VENOMANCER: + SummonHelpers(550.34f, 316.00f, 234.30f, SPELL_SUMMON_VENOMANCER); + break; + } - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - DoMeleeAttackIfReady(); - } - }; + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_anub_arakAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_anub_arakAI(creature); + } }; class spell_azjol_nerub_carrion_beetels : public SpellScriptLoader { - public: - spell_azjol_nerub_carrion_beetels() : SpellScriptLoader("spell_azjol_nerub_carrion_beetels") { } + public: + spell_azjol_nerub_carrion_beetels() : SpellScriptLoader("spell_azjol_nerub_carrion_beetels") { } - class spell_azjol_nerub_carrion_beetelsAuraScript : public AuraScript - { - PrepareAuraScript(spell_azjol_nerub_carrion_beetelsAuraScript) + class spell_azjol_nerub_carrion_beetelsAuraScript : public AuraScript + { + PrepareAuraScript(spell_azjol_nerub_carrion_beetelsAuraScript) - void HandleEffectPeriodic(AuraEffect const* aurEff) - { - // Xinef: 2 each second - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_CARRION_BEETLES, true); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_CARRION_BEETLES, true); - } + void HandleEffectPeriodic(AuraEffect const* aurEff) + { + // Xinef: 2 each second + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_CARRION_BEETLES, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_CARRION_BEETLES, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_azjol_nerub_carrion_beetelsAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_azjol_nerub_carrion_beetelsAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_azjol_nerub_carrion_beetelsAuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_azjol_nerub_carrion_beetelsAuraScript(); + } }; class spell_azjol_nerub_pound : public SpellScriptLoader @@ -268,7 +268,7 @@ class spell_azjol_nerub_pound : public SpellScriptLoader void HandleApplyAura(SpellEffIndex effIndex) { if (Unit* unitTarget = GetHitUnit()) - GetCaster()->CastSpell(unitTarget, SPELL_POUND_DAMAGE, true); + GetCaster()->CastSpell(unitTarget, SPELL_POUND_DAMAGE, true); } void Register() @@ -295,9 +295,9 @@ class spell_azjol_nerub_impale_summon : public SpellScriptLoader void SetDest(SpellDestination& dest) { // Adjust effect summon position - float floorZ = GetCaster()->GetMap()->GetHeight(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ(), true); - if (floorZ > INVALID_HEIGHT) - dest._position.m_positionZ = floorZ; + float floorZ = GetCaster()->GetMap()->GetHeight(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ(), true); + if (floorZ > INVALID_HEIGHT) + dest._position.m_positionZ = floorZ; } void Register() @@ -315,7 +315,7 @@ class spell_azjol_nerub_impale_summon : public SpellScriptLoader void AddSC_boss_anub_arak() { new boss_anub_arak(); - new spell_azjol_nerub_carrion_beetels(); - new spell_azjol_nerub_pound(); - new spell_azjol_nerub_impale_summon(); + new spell_azjol_nerub_carrion_beetels(); + new spell_azjol_nerub_pound(); + new spell_azjol_nerub_impale_summon(); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index 93e2fa218..9857b335c 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -10,289 +10,289 @@ REWRITTEN BY XINEF enum Spells { - SPELL_SUMMON_ANUBAR_CHAMPION = 53064, - SPELL_SUMMON_ANUBAR_CRYPT_FIEND = 53065, - SPELL_SUMMON_ANUBAR_NECROMANCER = 53066, - SPELL_WEB_FRONT_DOORS = 53177, - SPELL_WEB_SIDE_DOORS = 53185, - SPELL_ACID_CLOUD = 53400, - SPELL_LEECH_POISON = 53030, - SPELL_LEECH_POISON_HEAL = 53800, - SPELL_WEB_GRAB = 57731, - SPELL_PIERCE_ARMOR = 53418, + SPELL_SUMMON_ANUBAR_CHAMPION = 53064, + SPELL_SUMMON_ANUBAR_CRYPT_FIEND = 53065, + SPELL_SUMMON_ANUBAR_NECROMANCER = 53066, + SPELL_WEB_FRONT_DOORS = 53177, + SPELL_WEB_SIDE_DOORS = 53185, + SPELL_ACID_CLOUD = 53400, + SPELL_LEECH_POISON = 53030, + SPELL_LEECH_POISON_HEAL = 53800, + SPELL_WEB_GRAB = 57731, + SPELL_PIERCE_ARMOR = 53418, - SPELL_SMASH = 53318, - SPELL_FRENZY = 53801 + SPELL_SMASH = 53318, + SPELL_FRENZY = 53801 }; enum Events { - EVENT_HADRONOX_MOVE1 = 1, - EVENT_HADRONOX_MOVE2 = 2, - EVENT_HADRONOX_MOVE3 = 3, - EVENT_HADRONOX_MOVE4 = 4, - EVENT_HADRONOX_ACID = 5, - EVENT_HADRONOX_LEECH = 6, - EVENT_HADRONOX_PIERCE = 7, - EVENT_HADRONOX_GRAB = 8, - EVENT_HADRONOX_SUMMON = 9, + EVENT_HADRONOX_MOVE1 = 1, + EVENT_HADRONOX_MOVE2 = 2, + EVENT_HADRONOX_MOVE3 = 3, + EVENT_HADRONOX_MOVE4 = 4, + EVENT_HADRONOX_ACID = 5, + EVENT_HADRONOX_LEECH = 6, + EVENT_HADRONOX_PIERCE = 7, + EVENT_HADRONOX_GRAB = 8, + EVENT_HADRONOX_SUMMON = 9, - EVENT_CRUSHER_SMASH = 20, - EVENT_CHECK_HEALTH = 21 + EVENT_CRUSHER_SMASH = 20, + EVENT_CHECK_HEALTH = 21 }; enum Misc { - NPC_ANUB_AR_CRUSHER = 28922, + NPC_ANUB_AR_CRUSHER = 28922, - SAY_CRUSHER_AGGRO = 0, - SAY_CRUSHER_EMOTE = 1, - SAY_HADRONOX_EMOTE = 0, + SAY_CRUSHER_AGGRO = 0, + SAY_CRUSHER_EMOTE = 1, + SAY_HADRONOX_EMOTE = 0, - ACTION_DESPAWN_ADDS = 1, - ACTION_START_EVENT = 2 + ACTION_DESPAWN_ADDS = 1, + ACTION_START_EVENT = 2 }; const Position hadronoxSteps[4] = { - {607.9f, 512.8f, 695.3f, 0.0f}, - {611.67f, 564.11f, 720.0f, 0.0f}, - {576.1f, 580.0f, 727.5f, 0.0f}, - {534.87f, 554.0f, 733.0f, 0.0f} + {607.9f, 512.8f, 695.3f, 0.0f}, + {611.67f, 564.11f, 720.0f, 0.0f}, + {576.1f, 580.0f, 727.5f, 0.0f}, + {534.87f, 554.0f, 733.0f, 0.0f} }; class boss_hadronox : public CreatureScript { - public: - boss_hadronox() : CreatureScript("boss_hadronox") { } + public: + boss_hadronox() : CreatureScript("boss_hadronox") { } - struct boss_hadronoxAI : public BossAI - { - boss_hadronoxAI(Creature* creature) : BossAI(creature, DATA_HADRONOX_EVENT) - { - } + struct boss_hadronoxAI : public BossAI + { + boss_hadronoxAI(Creature* creature) : BossAI(creature, DATA_HADRONOX_EVENT) + { + } - void Reset() - { - summons.DoAction(ACTION_DESPAWN_ADDS); - BossAI::Reset(); - me->SummonCreature(NPC_ANUB_AR_CRUSHER, 542.9f, 519.5f, 741.24f, 2.14f); - } + void Reset() + { + summons.DoAction(ACTION_DESPAWN_ADDS); + BossAI::Reset(); + me->SummonCreature(NPC_ANUB_AR_CRUSHER, 542.9f, 519.5f, 741.24f, 2.14f); + } - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT) - { - instance->SetBossState(DATA_HADRONOX_EVENT, IN_PROGRESS); - me->setActive(true); - events.ScheduleEvent(EVENT_HADRONOX_MOVE1, 20000); - events.ScheduleEvent(EVENT_HADRONOX_MOVE2, 40000); - events.ScheduleEvent(EVENT_HADRONOX_MOVE3, 60000); - events.ScheduleEvent(EVENT_HADRONOX_MOVE4, 80000); - } - } + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT) + { + instance->SetBossState(DATA_HADRONOX_EVENT, IN_PROGRESS); + me->setActive(true); + events.ScheduleEvent(EVENT_HADRONOX_MOVE1, 20000); + events.ScheduleEvent(EVENT_HADRONOX_MOVE2, 40000); + events.ScheduleEvent(EVENT_HADRONOX_MOVE3, 60000); + events.ScheduleEvent(EVENT_HADRONOX_MOVE4, 80000); + } + } - uint32 GetData(uint32 data) const - { - if (data == me->GetEntry()) - return !me->isActiveObject() || events.GetNextEventTime(EVENT_HADRONOX_MOVE4) != 0; - return 0; - } + uint32 GetData(uint32 data) const + { + if (data == me->GetEntry()) + return !me->isActiveObject() || events.GetNextEventTime(EVENT_HADRONOX_MOVE4) != 0; + return 0; + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); + void JustSummoned(Creature* summon) + { + summons.Summon(summon); - // Xinef: cannot use pathfinding... - if (summon->GetDistance(477.0f, 618.0f, 771.0f) < 5.0f) - summon->GetMotionMaster()->MovePath(3000012, false); - else if (summon->GetDistance(583.0f, 617.0f, 771.0f) < 5.0f) - summon->GetMotionMaster()->MovePath(3000013, false); - else if (summon->GetDistance(581.0f, 608.5f, 739.0f) < 5.0f) - summon->GetMotionMaster()->MovePath(3000014, false); - } + // Xinef: cannot use pathfinding... + if (summon->GetDistance(477.0f, 618.0f, 771.0f) < 5.0f) + summon->GetMotionMaster()->MovePath(3000012, false); + else if (summon->GetDistance(583.0f, 617.0f, 771.0f) < 5.0f) + summon->GetMotionMaster()->MovePath(3000013, false); + else if (summon->GetDistance(581.0f, 608.5f, 739.0f) < 5.0f) + summon->GetMotionMaster()->MovePath(3000014, false); + } - void KilledUnit(Unit* victim) - { - if (!me->IsAlive() || !victim->HasAura(SPELL_LEECH_POISON)) - return; + void KilledUnit(Unit* victim) + { + if (!me->IsAlive() || !victim->HasAura(SPELL_LEECH_POISON)) + return; - me->ModifyHealth(int32(me->CountPctFromMaxHealth(10))); - } + me->ModifyHealth(int32(me->CountPctFromMaxHealth(10))); + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + } - void EnterCombat(Unit*) - { - events.RescheduleEvent(EVENT_HADRONOX_ACID, 10000); - events.RescheduleEvent(EVENT_HADRONOX_LEECH, 4000); - events.RescheduleEvent(EVENT_HADRONOX_PIERCE, 1000); - events.RescheduleEvent(EVENT_HADRONOX_GRAB, 15000); - } + void EnterCombat(Unit*) + { + events.RescheduleEvent(EVENT_HADRONOX_ACID, 10000); + events.RescheduleEvent(EVENT_HADRONOX_LEECH, 4000); + events.RescheduleEvent(EVENT_HADRONOX_PIERCE, 1000); + events.RescheduleEvent(EVENT_HADRONOX_GRAB, 15000); + } - bool AnyPlayerValid() const - { - Map::PlayerList const& playerList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) - if (me->GetDistance(itr->GetSource()) < 130.0f && itr->GetSource()->IsAlive() && !itr->GetSource()->IsGameMaster() && me->CanCreatureAttack(itr->GetSource()) && me->_CanDetectFeignDeathOf(itr->GetSource())) - return true; + bool AnyPlayerValid() const + { + Map::PlayerList const& playerList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) + if (me->GetDistance(itr->GetSource()) < 130.0f && itr->GetSource()->IsAlive() && !itr->GetSource()->IsGameMaster() && me->CanCreatureAttack(itr->GetSource()) && me->_CanDetectFeignDeathOf(itr->GetSource())) + return true; - return false; - } + return false; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (uint32 eventId = events.ExecuteEvent()) - { - case EVENT_HADRONOX_PIERCE: - me->CastSpell(me->GetVictim(), SPELL_PIERCE_ARMOR, false); - events.ScheduleEvent(EVENT_HADRONOX_PIERCE, 8000); - break; - case EVENT_HADRONOX_ACID: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, false)) - me->CastSpell(target, SPELL_ACID_CLOUD, false); - events.ScheduleEvent(EVENT_HADRONOX_ACID, 25000); - break; - case EVENT_HADRONOX_LEECH: - me->CastSpell(me, SPELL_LEECH_POISON, false); - events.ScheduleEvent(EVENT_HADRONOX_LEECH, 12000); - break; - case EVENT_HADRONOX_GRAB: - me->CastSpell(me, SPELL_WEB_GRAB, false); - events.ScheduleEvent(EVENT_HADRONOX_GRAB, 25000); - break; - case EVENT_HADRONOX_MOVE4: - me->CastSpell(me, SPELL_WEB_FRONT_DOORS, true); - case EVENT_HADRONOX_MOVE1: - case EVENT_HADRONOX_MOVE2: - case EVENT_HADRONOX_MOVE3: - Talk(SAY_HADRONOX_EMOTE); - me->GetMotionMaster()->MoveCharge(hadronoxSteps[eventId-1].GetPositionX(), hadronoxSteps[eventId-1].GetPositionY(), hadronoxSteps[eventId-1].GetPositionZ(), 10.0f, 0, NULL, true); - break; + switch (uint32 eventId = events.ExecuteEvent()) + { + case EVENT_HADRONOX_PIERCE: + me->CastSpell(me->GetVictim(), SPELL_PIERCE_ARMOR, false); + events.ScheduleEvent(EVENT_HADRONOX_PIERCE, 8000); + break; + case EVENT_HADRONOX_ACID: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, false)) + me->CastSpell(target, SPELL_ACID_CLOUD, false); + events.ScheduleEvent(EVENT_HADRONOX_ACID, 25000); + break; + case EVENT_HADRONOX_LEECH: + me->CastSpell(me, SPELL_LEECH_POISON, false); + events.ScheduleEvent(EVENT_HADRONOX_LEECH, 12000); + break; + case EVENT_HADRONOX_GRAB: + me->CastSpell(me, SPELL_WEB_GRAB, false); + events.ScheduleEvent(EVENT_HADRONOX_GRAB, 25000); + break; + case EVENT_HADRONOX_MOVE4: + me->CastSpell(me, SPELL_WEB_FRONT_DOORS, true); + case EVENT_HADRONOX_MOVE1: + case EVENT_HADRONOX_MOVE2: + case EVENT_HADRONOX_MOVE3: + Talk(SAY_HADRONOX_EMOTE); + me->GetMotionMaster()->MoveCharge(hadronoxSteps[eventId-1].GetPositionX(), hadronoxSteps[eventId-1].GetPositionY(), hadronoxSteps[eventId-1].GetPositionZ(), 10.0f, 0, NULL, true); + break; - } + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(); } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->isActiveObject() && !AnyPlayerValid(); - } - }; + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->isActiveObject() && !AnyPlayerValid(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_hadronoxAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_hadronoxAI(creature); + } }; class npc_anub_ar_crusher : public CreatureScript { - public: - npc_anub_ar_crusher() : CreatureScript("npc_anub_ar_crusher") { } + public: + npc_anub_ar_crusher() : CreatureScript("npc_anub_ar_crusher") { } - struct npc_anub_ar_crusherAI : public ScriptedAI - { - npc_anub_ar_crusherAI(Creature *c) : ScriptedAI(c), summons(me) {} + struct npc_anub_ar_crusherAI : public ScriptedAI + { + npc_anub_ar_crusherAI(Creature *c) : ScriptedAI(c), summons(me) {} - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; - void Reset() - { - summons.DespawnAll(); - events.Reset(); + void Reset() + { + summons.DespawnAll(); + events.Reset(); - if (me->ToTempSummon()) - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - if (summoner->GetEntry() == me->GetEntry()) - { - me->CastSpell(me, RAND(SPELL_SUMMON_ANUBAR_CHAMPION, SPELL_SUMMON_ANUBAR_CRYPT_FIEND, SPELL_SUMMON_ANUBAR_NECROMANCER), true); - me->CastSpell(me, RAND(SPELL_SUMMON_ANUBAR_CHAMPION, SPELL_SUMMON_ANUBAR_CRYPT_FIEND, SPELL_SUMMON_ANUBAR_NECROMANCER), true); - } - } + if (me->ToTempSummon()) + if (Unit* summoner = me->ToTempSummon()->GetSummoner()) + if (summoner->GetEntry() == me->GetEntry()) + { + me->CastSpell(me, RAND(SPELL_SUMMON_ANUBAR_CHAMPION, SPELL_SUMMON_ANUBAR_CRYPT_FIEND, SPELL_SUMMON_ANUBAR_NECROMANCER), true); + me->CastSpell(me, RAND(SPELL_SUMMON_ANUBAR_CHAMPION, SPELL_SUMMON_ANUBAR_CRYPT_FIEND, SPELL_SUMMON_ANUBAR_NECROMANCER), true); + } + } - void JustSummoned(Creature* summon) - { - if(summon->GetEntry() != me->GetEntry()) - { - summon->GetMotionMaster()->MovePoint(0, *me, false); - summon->GetMotionMaster()->MoveFollow(me, 0.1f, 0.0f + M_PI*0.3f*summons.size()); - } - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + if(summon->GetEntry() != me->GetEntry()) + { + summon->GetMotionMaster()->MovePoint(0, *me, false); + summon->GetMotionMaster()->MoveFollow(me, 0.1f, 0.0f + M_PI*0.3f*summons.size()); + } + summons.Summon(summon); + } - void DoAction(int32 param) - { - if (param == ACTION_DESPAWN_ADDS) - { - summons.DoAction(ACTION_DESPAWN_ADDS); - summons.DespawnAll(); - } - } + void DoAction(int32 param) + { + if (param == ACTION_DESPAWN_ADDS) + { + summons.DoAction(ACTION_DESPAWN_ADDS); + summons.DespawnAll(); + } + } - void EnterCombat(Unit*) - { - if (me->ToTempSummon()) - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - if (summoner->GetEntry() != me->GetEntry()) - { - summoner->GetAI()->DoAction(ACTION_START_EVENT); - me->SummonCreature(NPC_ANUB_AR_CRUSHER, 519.58f, 573.73f, 734.30f, 4.50f); - me->SummonCreature(NPC_ANUB_AR_CRUSHER, 539.38f, 573.25f, 732.20f, 4.738f); - Talk(SAY_CRUSHER_AGGRO); - } + void EnterCombat(Unit*) + { + if (me->ToTempSummon()) + if (Unit* summoner = me->ToTempSummon()->GetSummoner()) + if (summoner->GetEntry() != me->GetEntry()) + { + summoner->GetAI()->DoAction(ACTION_START_EVENT); + me->SummonCreature(NPC_ANUB_AR_CRUSHER, 519.58f, 573.73f, 734.30f, 4.50f); + me->SummonCreature(NPC_ANUB_AR_CRUSHER, 539.38f, 573.25f, 732.20f, 4.738f); + Talk(SAY_CRUSHER_AGGRO); + } - events.ScheduleEvent(EVENT_CRUSHER_SMASH, 8000, 0, 0); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - } + events.ScheduleEvent(EVENT_CRUSHER_SMASH, 8000, 0, 0); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CRUSHER_SMASH: - me->CastSpell(me->GetVictim(), SPELL_SMASH, false); - events.ScheduleEvent(EVENT_CRUSHER_SMASH, 15000); - break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(30)) - { - Talk(SAY_CRUSHER_EMOTE); - me->CastSpell(me, SPELL_FRENZY, false); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_CRUSHER_SMASH: + me->CastSpell(me->GetVictim(), SPELL_SMASH, false); + events.ScheduleEvent(EVENT_CRUSHER_SMASH, 15000); + break; + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(30)) + { + Talk(SAY_CRUSHER_EMOTE); + me->CastSpell(me, SPELL_FRENZY, false); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_anub_ar_crusherAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_anub_ar_crusherAI(creature); + } }; class spell_hadronox_summon_periodic : public SpellScriptLoader @@ -302,22 +302,22 @@ class spell_hadronox_summon_periodic : public SpellScriptLoader class spell_hadronox_summon_periodic_AuraScript : public AuraScript { - public: - spell_hadronox_summon_periodic_AuraScript(uint32 delay, uint32 spellEntry) : _delay(delay), _spellEntry(spellEntry) { } + public: + spell_hadronox_summon_periodic_AuraScript(uint32 delay, uint32 spellEntry) : _delay(delay), _spellEntry(spellEntry) { } PrepareAuraScript(spell_hadronox_summon_periodic_AuraScript); void HandlePeriodic(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); - Unit* owner = GetUnitOwner(); - if (InstanceScript* instance = owner->GetInstanceScript()) - if (instance->GetBossState(DATA_HADRONOX_EVENT) != DONE) - { - if (!owner->HasAura(SPELL_WEB_FRONT_DOORS)) - owner->CastSpell(owner, _spellEntry, true); - else if (!instance->IsEncounterInProgress()) - owner->RemoveAurasDueToSpell(SPELL_WEB_FRONT_DOORS); - } + Unit* owner = GetUnitOwner(); + if (InstanceScript* instance = owner->GetInstanceScript()) + if (instance->GetBossState(DATA_HADRONOX_EVENT) != DONE) + { + if (!owner->HasAura(SPELL_WEB_FRONT_DOORS)) + owner->CastSpell(owner, _spellEntry, true); + else if (!instance->IsEncounterInProgress()) + owner->RemoveAurasDueToSpell(SPELL_WEB_FRONT_DOORS); + } } void OnApply(AuraEffect const* auraEffect, AuraEffectHandleModes) @@ -331,9 +331,9 @@ class spell_hadronox_summon_periodic : public SpellScriptLoader OnEffectApply += AuraEffectApplyFn(spell_hadronox_summon_periodic_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); } - private: - uint32 _spellEntry; - uint32 _delay; + private: + uint32 _spellEntry; + uint32 _delay; }; AuraScript* GetAuraScript() const @@ -341,37 +341,37 @@ class spell_hadronox_summon_periodic : public SpellScriptLoader return new spell_hadronox_summon_periodic_AuraScript(_delay, _spellEntry); } - private: - uint32 _spellEntry; - uint32 _delay; + private: + uint32 _spellEntry; + uint32 _delay; }; class spell_hadronox_leech_poison : public SpellScriptLoader { - public: - spell_hadronox_leech_poison() : SpellScriptLoader("spell_hadronox_leech_poison") { } + public: + spell_hadronox_leech_poison() : SpellScriptLoader("spell_hadronox_leech_poison") { } - class spell_hadronox_leech_poison_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hadronox_leech_poison_AuraScript) + class spell_hadronox_leech_poison_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hadronox_leech_poison_AuraScript) - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) - if (Unit* caster = GetCaster()) - caster->CastSpell(caster, SPELL_LEECH_POISON_HEAL, true); - } + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, SPELL_LEECH_POISON_HEAL, true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_hadronox_leech_poison_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_LEECH, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_hadronox_leech_poison_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_LEECH, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_hadronox_leech_poison_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_hadronox_leech_poison_AuraScript(); + } }; class achievement_hadronox_denied : public AchievementCriteriaScript @@ -386,17 +386,17 @@ class achievement_hadronox_denied : public AchievementCriteriaScript if (!target) return false; - return target->GetAI()->GetData(target->GetEntry()); + return target->GetAI()->GetData(target->GetEntry()); } }; void AddSC_boss_hadronox() { new boss_hadronox(); - new npc_anub_ar_crusher(); - new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_champion", 15000, SPELL_SUMMON_ANUBAR_CHAMPION); - new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_necromancer", 10000, SPELL_SUMMON_ANUBAR_NECROMANCER); - new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_crypt_fiend", 5000, SPELL_SUMMON_ANUBAR_CRYPT_FIEND); - new spell_hadronox_leech_poison(); - new achievement_hadronox_denied(); + new npc_anub_ar_crusher(); + new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_champion", 15000, SPELL_SUMMON_ANUBAR_CHAMPION); + new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_necromancer", 10000, SPELL_SUMMON_ANUBAR_NECROMANCER); + new spell_hadronox_summon_periodic("spell_hadronox_summon_periodic_crypt_fiend", 5000, SPELL_SUMMON_ANUBAR_CRYPT_FIEND); + new spell_hadronox_leech_poison(); + new achievement_hadronox_denied(); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp index 43821fac8..f49f96740 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp @@ -8,212 +8,212 @@ REWRITTEN BY XINEF enum Spells { - SPELL_SUBBOSS_AGGRO_TRIGGER = 52343, - SPELL_SWARM = 52440, - SPELL_MIND_FLAY = 52586, - SPELL_CURSE_OF_FATIGUE = 52592, - SPELL_FRENZY = 28747 + SPELL_SUBBOSS_AGGRO_TRIGGER = 52343, + SPELL_SWARM = 52440, + SPELL_MIND_FLAY = 52586, + SPELL_CURSE_OF_FATIGUE = 52592, + SPELL_FRENZY = 28747 }; enum Events { - EVENT_KRIK_START_WAVE = 1, - EVENT_KRIK_SUMMON = 2, - EVENT_KRIK_MIND_FLAY = 3, - EVENT_KRIK_CURSE = 4, - EVENT_KRIK_HEALTH_CHECK = 5, - EVENT_KRIK_ENTER_COMBAT = 6, - EVENT_KILL_TALK = 7, - EVENT_CALL_ADDS = 8, - EVENT_KRIK_CHECK_EVADE = 9 + EVENT_KRIK_START_WAVE = 1, + EVENT_KRIK_SUMMON = 2, + EVENT_KRIK_MIND_FLAY = 3, + EVENT_KRIK_CURSE = 4, + EVENT_KRIK_HEALTH_CHECK = 5, + EVENT_KRIK_ENTER_COMBAT = 6, + EVENT_KILL_TALK = 7, + EVENT_CALL_ADDS = 8, + EVENT_KRIK_CHECK_EVADE = 9 }; enum Npcs { - NPC_WATCHER_NARJIL = 28729, - NPC_WATCHER_GASHRA = 28730, - NPC_WATCHER_SILTHIK = 28731, - NPC_WARRIOR = 28732, - NPC_SKIRMISHER = 28734, - NPC_SHADOWCASTER = 28733 + NPC_WATCHER_NARJIL = 28729, + NPC_WATCHER_GASHRA = 28730, + NPC_WATCHER_SILTHIK = 28731, + NPC_WARRIOR = 28732, + NPC_SKIRMISHER = 28734, + NPC_SHADOWCASTER = 28733 }; enum Yells { - SAY_AGGRO = 0, - SAY_SLAY = 1, - SAY_DEATH = 2, - SAY_SWARM = 3, - SAY_PREFIGHT = 4, - SAY_SEND_GROUP = 5 + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_DEATH = 2, + SAY_SWARM = 3, + SAY_PREFIGHT = 4, + SAY_SEND_GROUP = 5 }; class boss_krik_thir : public CreatureScript { - public: - boss_krik_thir() : CreatureScript("boss_krik_thir") { } + public: + boss_krik_thir() : CreatureScript("boss_krik_thir") { } - struct boss_krik_thirAI : public BossAI - { - boss_krik_thirAI(Creature* creature) : BossAI(creature, DATA_KRIKTHIR_THE_GATEWATCHER_EVENT) - { - _initTalk = false; - } + struct boss_krik_thirAI : public BossAI + { + boss_krik_thirAI(Creature* creature) : BossAI(creature, DATA_KRIKTHIR_THE_GATEWATCHER_EVENT) + { + _initTalk = false; + } - EventMap events2; - bool _initTalk; + EventMap events2; + bool _initTalk; - void Reset() - { - BossAI::Reset(); - events2.Reset(); + void Reset() + { + BossAI::Reset(); + events2.Reset(); - me->SummonCreature(NPC_WATCHER_NARJIL, 511.8f, 666.493f, 776.278f, 0.977f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_SHADOWCASTER, 518.13f, 667.0f, 775.74f, 1.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_WARRIOR, 506.75f, 670.7f, 776.24f, 0.92f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_WATCHER_GASHRA, 526.66f, 663.605f, 775.805f, 1.23f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_SKIRMISHER, 522.23f, 668.97f, 775.66f, 1.18f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_WARRIOR, 532.4f, 666.47f, 775.67f, 1.45f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_WATCHER_SILTHIK, 543.826f, 665.123f, 776.245f, 1.55f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_SKIRMISHER, 547.5f, 669.96f, 776.1f, 2.3f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(NPC_SHADOWCASTER, 536.96f, 667.28f, 775.6f, 1.72f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - } + me->SummonCreature(NPC_WATCHER_NARJIL, 511.8f, 666.493f, 776.278f, 0.977f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_SHADOWCASTER, 518.13f, 667.0f, 775.74f, 1.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_WARRIOR, 506.75f, 670.7f, 776.24f, 0.92f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_WATCHER_GASHRA, 526.66f, 663.605f, 775.805f, 1.23f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_SKIRMISHER, 522.23f, 668.97f, 775.66f, 1.18f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_WARRIOR, 532.4f, 666.47f, 775.67f, 1.45f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_WATCHER_SILTHIK, 543.826f, 665.123f, 776.245f, 1.55f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_SKIRMISHER, 547.5f, 669.96f, 776.1f, 2.3f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(NPC_SHADOWCASTER, 536.96f, 667.28f, 775.6f, 1.72f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + } - void MoveInLineOfSight(Unit *who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void MoveInLineOfSight(Unit *who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (!_initTalk) - { - _initTalk = true; - Talk(SAY_PREFIGHT); - } + if (!_initTalk) + { + _initTalk = true; + Talk(SAY_PREFIGHT); + } - if (events.Empty() && who->GetPositionZ() < 785.0f) - { - events2.ScheduleEvent(EVENT_KRIK_START_WAVE, 10000); - events2.ScheduleEvent(EVENT_KRIK_START_WAVE, 40000); - events2.ScheduleEvent(EVENT_KRIK_START_WAVE, 70000); - events2.ScheduleEvent(EVENT_KRIK_ENTER_COMBAT, 100000); - events2.ScheduleEvent(EVENT_KRIK_CHECK_EVADE, 5000); + if (events.Empty() && who->GetPositionZ() < 785.0f) + { + events2.ScheduleEvent(EVENT_KRIK_START_WAVE, 10000); + events2.ScheduleEvent(EVENT_KRIK_START_WAVE, 40000); + events2.ScheduleEvent(EVENT_KRIK_START_WAVE, 70000); + events2.ScheduleEvent(EVENT_KRIK_ENTER_COMBAT, 100000); + events2.ScheduleEvent(EVENT_KRIK_CHECK_EVADE, 5000); - events.ScheduleEvent(EVENT_KRIK_HEALTH_CHECK, 1000); - events.ScheduleEvent(EVENT_KRIK_MIND_FLAY, 13000); - events.ScheduleEvent(EVENT_KRIK_SUMMON, 17000); - events.ScheduleEvent(EVENT_KRIK_CURSE, 8000); - events.ScheduleEvent(EVENT_CALL_ADDS, 1000); - me->setActive(true); - } - } + events.ScheduleEvent(EVENT_KRIK_HEALTH_CHECK, 1000); + events.ScheduleEvent(EVENT_KRIK_MIND_FLAY, 13000); + events.ScheduleEvent(EVENT_KRIK_SUMMON, 17000); + events.ScheduleEvent(EVENT_KRIK_CURSE, 8000); + events.ScheduleEvent(EVENT_CALL_ADDS, 1000); + me->setActive(true); + } + } - uint32 GetData(uint32 data) const - { - if (data == me->GetEntry()) - return summons.HasEntry(NPC_WATCHER_NARJIL) && summons.HasEntry(NPC_WATCHER_GASHRA) && summons.HasEntry(NPC_WATCHER_SILTHIK); - return 0; - } + uint32 GetData(uint32 data) const + { + if (data == me->GetEntry()) + return summons.HasEntry(NPC_WATCHER_NARJIL) && summons.HasEntry(NPC_WATCHER_GASHRA) && summons.HasEntry(NPC_WATCHER_SILTHIK); + return 0; + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); - events2.Reset(); - } + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); + events2.Reset(); + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - Talk(SAY_DEATH); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + Talk(SAY_DEATH); + } - void KilledUnit(Unit* ) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* ) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - summon->SetNoCallAssistance(true); - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summon->SetNoCallAssistance(true); + summons.Summon(summon); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + } - void UpdateAI(uint32 diff) - { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_KRIK_START_WAVE: - me->CastCustomSpell(SPELL_SUBBOSS_AGGRO_TRIGGER, SPELLVALUE_MAX_TARGETS, 1, me, true); - Talk(SAY_SEND_GROUP); - break; - case EVENT_KRIK_ENTER_COMBAT: - me->SetInCombatWithZone(); - break; - case EVENT_KRIK_CHECK_EVADE: - if (!SelectTargetFromPlayerList(100.0f)) - { - EnterEvadeMode(); - return; - } - events2.ScheduleEvent(EVENT_KRIK_CHECK_EVADE, 5000); - break; - } + void UpdateAI(uint32 diff) + { + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_KRIK_START_WAVE: + me->CastCustomSpell(SPELL_SUBBOSS_AGGRO_TRIGGER, SPELLVALUE_MAX_TARGETS, 1, me, true); + Talk(SAY_SEND_GROUP); + break; + case EVENT_KRIK_ENTER_COMBAT: + me->SetInCombatWithZone(); + break; + case EVENT_KRIK_CHECK_EVADE: + if (!SelectTargetFromPlayerList(100.0f)) + { + EnterEvadeMode(); + return; + } + events2.ScheduleEvent(EVENT_KRIK_CHECK_EVADE, 5000); + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_KRIK_HEALTH_CHECK: - if (HealthBelowPct(10)) - { - events.PopEvent(); - me->CastSpell(me, SPELL_FRENZY, true); - break; - } - events.ScheduleEvent(EVENT_KRIK_HEALTH_CHECK, 1000); - break; - case EVENT_KRIK_SUMMON: - Talk(SAY_SWARM); - me->CastSpell(me, SPELL_SWARM, false); - events.ScheduleEvent(EVENT_KRIK_SUMMON, 20000); - break; - case EVENT_KRIK_MIND_FLAY: - me->CastSpell(me->GetVictim(), SPELL_MIND_FLAY, false); - events.ScheduleEvent(EVENT_KRIK_MIND_FLAY, 15000); - break; - case EVENT_KRIK_CURSE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - me->CastSpell(target, SPELL_CURSE_OF_FATIGUE, true); - events.ScheduleEvent(EVENT_KRIK_CURSE, 10000); - break; - case EVENT_CALL_ADDS: - summons.DoZoneInCombat(); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_KRIK_HEALTH_CHECK: + if (HealthBelowPct(10)) + { + events.PopEvent(); + me->CastSpell(me, SPELL_FRENZY, true); + break; + } + events.ScheduleEvent(EVENT_KRIK_HEALTH_CHECK, 1000); + break; + case EVENT_KRIK_SUMMON: + Talk(SAY_SWARM); + me->CastSpell(me, SPELL_SWARM, false); + events.ScheduleEvent(EVENT_KRIK_SUMMON, 20000); + break; + case EVENT_KRIK_MIND_FLAY: + me->CastSpell(me->GetVictim(), SPELL_MIND_FLAY, false); + events.ScheduleEvent(EVENT_KRIK_MIND_FLAY, 15000); + break; + case EVENT_KRIK_CURSE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + me->CastSpell(target, SPELL_CURSE_OF_FATIGUE, true); + events.ScheduleEvent(EVENT_KRIK_CURSE, 10000); + break; + case EVENT_CALL_ADDS: + summons.DoZoneInCombat(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI *GetAI(Creature *creature) const - { - return new boss_krik_thirAI(creature); - } + CreatureAI *GetAI(Creature *creature) const + { + return new boss_krik_thirAI(creature); + } }; class achievement_watch_him_die : public AchievementCriteriaScript @@ -228,12 +228,12 @@ class achievement_watch_him_die : public AchievementCriteriaScript if (!target) return false; - return target->GetAI()->GetData(target->GetEntry()); + return target->GetAI()->GetData(target->GetEntry()); } }; void AddSC_boss_krik_thir() { new boss_krik_thir(); - new achievement_watch_him_die(); + new achievement_watch_him_die(); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp index 893901e4b..fe9f7e4bc 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp @@ -8,121 +8,121 @@ REWRITTEN BY XINEF DoorData const doorData[] = { - { GO_KRIKTHIR_DOORS, DATA_KRIKTHIR_THE_GATEWATCHER_EVENT, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { GO_ANUBARAK_DOORS1, DATA_ANUBARAK_EVENT, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - { GO_ANUBARAK_DOORS2, DATA_ANUBARAK_EVENT, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - { GO_ANUBARAK_DOORS3, DATA_ANUBARAK_EVENT, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } + { GO_KRIKTHIR_DOORS, DATA_KRIKTHIR_THE_GATEWATCHER_EVENT, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_ANUBARAK_DOORS1, DATA_ANUBARAK_EVENT, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_ANUBARAK_DOORS2, DATA_ANUBARAK_EVENT, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_ANUBARAK_DOORS3, DATA_ANUBARAK_EVENT, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } }; class instance_azjol_nerub : public InstanceMapScript { - public: - instance_azjol_nerub() : InstanceMapScript("instance_azjol_nerub", 601) { } + public: + instance_azjol_nerub() : InstanceMapScript("instance_azjol_nerub", 601) { } - struct instance_azjol_nerub_InstanceScript : public InstanceScript - { - instance_azjol_nerub_InstanceScript(Map* map) : InstanceScript(map) - { - SetBossNumber(MAX_ENCOUNTERS); - LoadDoorData(doorData); - _krikthirGUID = 0; - _hadronoxGUID = 0; - }; + struct instance_azjol_nerub_InstanceScript : public InstanceScript + { + instance_azjol_nerub_InstanceScript(Map* map) : InstanceScript(map) + { + SetBossNumber(MAX_ENCOUNTERS); + LoadDoorData(doorData); + _krikthirGUID = 0; + _hadronoxGUID = 0; + }; - void OnCreatureCreate(Creature* creature) - { - switch (creature->GetEntry()) - { - case NPC_KRIKTHIR_THE_GATEWATCHER: - _krikthirGUID = creature->GetGUID(); - break; - case NPC_HADRONOX: - _hadronoxGUID = creature->GetGUID(); - break; - case NPC_SKITTERING_SWARMER: - case NPC_SKITTERING_INFECTIOR: - if (Creature* krikthir = instance->GetCreature(_krikthirGUID)) - krikthir->AI()->JustSummoned(creature); - break; - case NPC_ANUB_AR_CHAMPION: - case NPC_ANUB_AR_NECROMANCER: - case NPC_ANUB_AR_CRYPTFIEND: - if (Creature* hadronox = instance->GetCreature(_hadronoxGUID)) - hadronox->AI()->JustSummoned(creature); - break; + void OnCreatureCreate(Creature* creature) + { + switch (creature->GetEntry()) + { + case NPC_KRIKTHIR_THE_GATEWATCHER: + _krikthirGUID = creature->GetGUID(); + break; + case NPC_HADRONOX: + _hadronoxGUID = creature->GetGUID(); + break; + case NPC_SKITTERING_SWARMER: + case NPC_SKITTERING_INFECTIOR: + if (Creature* krikthir = instance->GetCreature(_krikthirGUID)) + krikthir->AI()->JustSummoned(creature); + break; + case NPC_ANUB_AR_CHAMPION: + case NPC_ANUB_AR_NECROMANCER: + case NPC_ANUB_AR_CRYPTFIEND: + if (Creature* hadronox = instance->GetCreature(_hadronoxGUID)) + hadronox->AI()->JustSummoned(creature); + break; - } - } + } + } - void OnGameObjectCreate(GameObject* go) - { - switch (go->GetEntry()) - { - case GO_KRIKTHIR_DOORS: - case GO_ANUBARAK_DOORS1: - case GO_ANUBARAK_DOORS2: - case GO_ANUBARAK_DOORS3: + void OnGameObjectCreate(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_KRIKTHIR_DOORS: + case GO_ANUBARAK_DOORS1: + case GO_ANUBARAK_DOORS2: + case GO_ANUBARAK_DOORS3: AddDoor(go, true); - break; - } - } - - void OnGameObjectRemove(GameObject* go) - { - switch (go->GetEntry()) - { - case GO_KRIKTHIR_DOORS: - case GO_ANUBARAK_DOORS1: - case GO_ANUBARAK_DOORS2: - case GO_ANUBARAK_DOORS3: + break; + } + } + + void OnGameObjectRemove(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_KRIKTHIR_DOORS: + case GO_ANUBARAK_DOORS1: + case GO_ANUBARAK_DOORS2: + case GO_ANUBARAK_DOORS3: AddDoor(go, false); - break; - } - } + break; + } + } - bool SetBossState(uint32 id, EncounterState state) - { - return InstanceScript::SetBossState(id, state); - } + bool SetBossState(uint32 id, EncounterState state) + { + return InstanceScript::SetBossState(id, state); + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "A N " << GetBossSaveData(); - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "A N " << GetBossSaveData(); + return saveStream.str(); + } - void Load(const char* in) - { - if( !in ) - return; + void Load(const char* in) + { + if( !in ) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'A' && dataHead2 == 'N') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); - } - } - } + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'A' && dataHead2 == 'N') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } + } + } - private: - uint64 _krikthirGUID; - uint64 _hadronoxGUID; - }; + private: + uint64 _krikthirGUID; + uint64 _hadronoxGUID; + }; - InstanceScript* GetInstanceScript(InstanceMap *map) const - { - return new instance_azjol_nerub_InstanceScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap *map) const + { + return new instance_azjol_nerub_InstanceScript(map); + } }; class spell_azjol_nerub_fixate : public SpellScriptLoader @@ -136,9 +136,9 @@ class spell_azjol_nerub_fixate : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(GetCaster(), GetEffectValue(), true); + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + target->CastSpell(GetCaster(), GetEffectValue(), true); } void Register() @@ -155,30 +155,30 @@ class spell_azjol_nerub_fixate : public SpellScriptLoader class spell_azjol_nerub_web_wrap : public SpellScriptLoader { - public: - spell_azjol_nerub_web_wrap() : SpellScriptLoader("spell_azjol_nerub_web_wrap") { } + public: + spell_azjol_nerub_web_wrap() : SpellScriptLoader("spell_azjol_nerub_web_wrap") { } - class spell_azjol_nerub_web_wrap_AuraScript : public AuraScript - { - PrepareAuraScript(spell_azjol_nerub_web_wrap_AuraScript); + class spell_azjol_nerub_web_wrap_AuraScript : public AuraScript + { + PrepareAuraScript(spell_azjol_nerub_web_wrap_AuraScript); - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (!target->HasAura(SPELL_WEB_WRAP_TRIGGER)) - target->CastSpell(target, SPELL_WEB_WRAP_TRIGGER, true); - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (!target->HasAura(SPELL_WEB_WRAP_TRIGGER)) + target->CastSpell(target, SPELL_WEB_WRAP_TRIGGER, true); + } - void Register() - { - OnEffectRemove += AuraEffectRemoveFn(spell_azjol_nerub_web_wrap_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_ROOT, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_azjol_nerub_web_wrap_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_ROOT, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_azjol_nerub_web_wrap_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_azjol_nerub_web_wrap_AuraScript(); + } }; void AddSC_instance_azjol_nerub() diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h index 539690fa5..4b473c42d 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h @@ -22,17 +22,17 @@ enum Data DATA_AMANITAR_EVENT, DATA_SPHERE_EVENT, - DATA_NADOX_ACHIEVEMENT, - DATA_JEDOGA_ACHIEVEMENT, + DATA_NADOX_ACHIEVEMENT, + DATA_JEDOGA_ACHIEVEMENT, }; enum Npc { - NPC_ELDER_NADOX = 29309, - NPC_PRINCE_TALDARAM = 29308, - NPC_JEDOGA_SHADOWSEEKER = 29310, - NPC_HERALD_JOLAZJ = 29311, - NPC_AMANITAR = 30258, + NPC_ELDER_NADOX = 29309, + NPC_PRINCE_TALDARAM = 29308, + NPC_JEDOGA_SHADOWSEEKER = 29310, + NPC_HERALD_JOLAZJ = 29311, + NPC_AMANITAR = 30258, }; #endif diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp index 40e0ac7fb..17036be18 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp @@ -8,28 +8,28 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_BASH = 57094, - SPELL_ENTANGLING_ROOTS = 57095, - SPELL_MINI = 57055, - SPELL_VENOM_BOLT_VOLLEY = 57088, - SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS = 56648, - SPELL_POISONOUS_MUSHROOM_POISON_CLOUD = 57061, - SPELL_POISONOUS_MUSHROOM_VISUAL_AURA = 56741, - SPELL_HEALTHY_MUSHROOM_VISUAL_AURA = 56740, + SPELL_BASH = 57094, + SPELL_ENTANGLING_ROOTS = 57095, + SPELL_MINI = 57055, + SPELL_VENOM_BOLT_VOLLEY = 57088, + SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS = 56648, + SPELL_POISONOUS_MUSHROOM_POISON_CLOUD = 57061, + SPELL_POISONOUS_MUSHROOM_VISUAL_AURA = 56741, + SPELL_HEALTHY_MUSHROOM_VISUAL_AURA = 56740, }; enum Creatures { - NPC_HEALTHY_MUSHROOM = 30391, - NPC_POISONOUS_MUSHROOM = 30435 + NPC_HEALTHY_MUSHROOM = 30391, + NPC_POISONOUS_MUSHROOM = 30435 }; enum Events { - EVENT_AMANITAR_SPAWN = 1, - EVENT_AMANITAR_ROOTS = 2, - EVENT_AMANITAR_BASH = 3, - EVENT_AMANITAR_BOLT = 4, + EVENT_AMANITAR_SPAWN = 1, + EVENT_AMANITAR_ROOTS = 2, + EVENT_AMANITAR_BASH = 3, + EVENT_AMANITAR_BOLT = 4, }; class boss_amanitar : public CreatureScript @@ -46,25 +46,25 @@ public: } InstanceScript* pInstance; - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; void Reset() { - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE); if (pInstance) - { + { pInstance->SetData(DATA_AMANITAR_EVENT, NOT_STARTED); - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI); - } + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI); + } } void JustDied(Unit* /*Killer*/) { - summons.DespawnAll(); + summons.DespawnAll(); if (pInstance) { pInstance->SetData(DATA_AMANITAR_EVENT, DONE); @@ -79,33 +79,33 @@ public: me->CastSpell(me, SPELL_MINI, false); - events.ScheduleEvent(EVENT_AMANITAR_ROOTS, urand(5000, 9000)); + events.ScheduleEvent(EVENT_AMANITAR_ROOTS, urand(5000, 9000)); events.ScheduleEvent(EVENT_AMANITAR_BASH, urand(10000, 14000)); events.ScheduleEvent(EVENT_AMANITAR_BOLT, urand(15000, 20000)); events.ScheduleEvent(EVENT_AMANITAR_SPAWN, 0); } - void JustSummoned(Creature *cr) { summons.Summon(cr); } + void JustSummoned(Creature *cr) { summons.Summon(cr); } void SpawnAdds() { - summons.DespawnAll(); - Position center; - center.Relocate(362.6f, -870, -75); + summons.DespawnAll(); + Position center; + center.Relocate(362.6f, -870, -75); for (uint8 i = 0; i < 25; ++i) { - float orientation = 2*rand_norm()*M_PI; - float x = center.GetPositionX() + i*2*cos(orientation); - float y = center.GetPositionY() + i*2*sin(orientation); + float orientation = 2*rand_norm()*M_PI; + float x = center.GetPositionX() + i*2*cos(orientation); + float y = center.GetPositionY() + i*2*sin(orientation); me->SummonCreature(NPC_POISONOUS_MUSHROOM, x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT)); } - for (uint8 i = 0; i < 25; ++i) + for (uint8 i = 0; i < 25; ++i) { - float orientation = 2*rand_norm()*M_PI; - float x = center.GetPositionX() + i*2*cos(orientation); - float y = center.GetPositionY() + i*2*sin(orientation); + float orientation = 2*rand_norm()*M_PI; + float x = center.GetPositionX() + i*2*cos(orientation); + float y = center.GetPositionY() + i*2*sin(orientation); me->SummonCreature(NPC_HEALTHY_MUSHROOM, x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT)); } } @@ -116,41 +116,41 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_AMANITAR_SPAWN: - { - SpawnAdds(); - events.RepeatEvent(urand(35000, 40000)); - break; - } - case EVENT_AMANITAR_ROOTS: - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - me->CastSpell(pTarget, SPELL_ENTANGLING_ROOTS, false); + switch (events.GetEvent()) + { + case EVENT_AMANITAR_SPAWN: + { + SpawnAdds(); + events.RepeatEvent(urand(35000, 40000)); + break; + } + case EVENT_AMANITAR_ROOTS: + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + me->CastSpell(pTarget, SPELL_ENTANGLING_ROOTS, false); - events.RepeatEvent(urand(15000, 20000)); - break; - } - case EVENT_AMANITAR_BASH: - { - me->CastSpell(me->GetVictim(), SPELL_BASH, false); - events.RepeatEvent(urand(15000, 20000)); - break; - } - case EVENT_AMANITAR_BOLT: - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - me->CastSpell(pTarget, SPELL_VENOM_BOLT_VOLLEY, false); - - events.RepeatEvent(urand(15000, 20000)); - break; - } - } + events.RepeatEvent(urand(15000, 20000)); + break; + } + case EVENT_AMANITAR_BASH: + { + me->CastSpell(me->GetVictim(), SPELL_BASH, false); + events.RepeatEvent(urand(15000, 20000)); + break; + } + case EVENT_AMANITAR_BOLT: + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + me->CastSpell(pTarget, SPELL_VENOM_BOLT_VOLLEY, false); + + events.RepeatEvent(urand(15000, 20000)); + break; + } + } DoMeleeAttackIfReady(); } @@ -170,23 +170,23 @@ public: struct npc_amanitar_mushroomsAI : public ScriptedAI { npc_amanitar_mushroomsAI(Creature* c) : ScriptedAI(c) - { + { SetCombatMovement(false); } - uint32 Timer; + uint32 Timer; void Reset() { - me->CastSpell(me, 31690, true); + me->CastSpell(me, 31690, true); - Timer = 0; + Timer = 0; if (me->GetEntry() == NPC_POISONOUS_MUSHROOM) - { + { me->CastSpell(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AURA, true); - me->CastSpell(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD, false); - } - else - me->CastSpell(me, SPELL_HEALTHY_MUSHROOM_VISUAL_AURA, true); + me->CastSpell(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD, false); + } + else + me->CastSpell(me, SPELL_HEALTHY_MUSHROOM_VISUAL_AURA, true); } void JustDied(Unit* killer) @@ -205,7 +205,7 @@ public: { if (me->GetEntry() == NPC_POISONOUS_MUSHROOM) { - Timer += diff; + Timer += diff; if (Timer >= 7000) { me->CastSpell(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD, false); diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp index ae59923a2..f8b739575 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp @@ -10,54 +10,54 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum misc { - // ACTIONS - ACTION_GUARDIAN_DIED = 1, + // ACTIONS + ACTION_GUARDIAN_DIED = 1, }; enum spells { - // NADOX - SPELL_BROOD_PLAGUE = 56130, - SPELL_BROOD_PLAGUE_H = 59467, - SPELL_BROOD_RAGE_H = 59465, - SPELL_ENRAGE = 26662, // Enraged if too far away from home - //SPELL_SUMMON_SWARMERS = 56119, //2x 30178 -- 2x every 10secs, spell works fine but i need specific coords - //SPELL_SUMMON_SWARM_GUARD = 56120, //1x 30176 -- at 50%hp, spell works fine but i need specific coords + // NADOX + SPELL_BROOD_PLAGUE = 56130, + SPELL_BROOD_PLAGUE_H = 59467, + SPELL_BROOD_RAGE_H = 59465, + SPELL_ENRAGE = 26662, // Enraged if too far away from home + //SPELL_SUMMON_SWARMERS = 56119, //2x 30178 -- 2x every 10secs, spell works fine but i need specific coords + //SPELL_SUMMON_SWARM_GUARD = 56120, //1x 30176 -- at 50%hp, spell works fine but i need specific coords - // ADDS - SPELL_SPRINT = 56354, - SPELL_GUARDIAN_AURA = 56151, - SPELL_SWARMER_AURA = 56158, + // ADDS + SPELL_SPRINT = 56354, + SPELL_GUARDIAN_AURA = 56151, + SPELL_SWARMER_AURA = 56158, }; enum creatures { - NPC_AHNKAHAR_SWARMER = 30178, - NPC_AHNKAHAR_GUARDIAN_ENTRY = 30176, + NPC_AHNKAHAR_SWARMER = 30178, + NPC_AHNKAHAR_GUARDIAN_ENTRY = 30176, }; enum events { - EVENT_CHECK_HEALTH = 1, - EVENT_CHECK_HOME = 2, - EVENT_PLAGUE = 3, - EVENT_BROOD_RAGE = 4, - EVENT_SWARMER = 5, - EVENT_SUMMON_GUARD = 6, + EVENT_CHECK_HEALTH = 1, + EVENT_CHECK_HOME = 2, + EVENT_PLAGUE = 3, + EVENT_BROOD_RAGE = 4, + EVENT_SWARMER = 5, + EVENT_SUMMON_GUARD = 6, }; enum sounds { - SOUND_AGGRO = 14033, - SOUND_SUMMON1 = 14034, - SOUND_SUMMON2 = 14035, - SOUND_SLAY1 = 14036, - SOUND_SLAY2 = 14037, - SOUND_SLAY3 = 14038, - SOUND_DEATH = 14039, + SOUND_AGGRO = 14033, + SOUND_SUMMON1 = 14034, + SOUND_SUMMON2 = 14035, + SOUND_SLAY1 = 14036, + SOUND_SLAY2 = 14037, + SOUND_SLAY3 = 14038, + SOUND_DEATH = 14039, }; -#define EMOTE_HATCHES "An Ahn'kahar Guardian hatches!" +#define EMOTE_HATCHES "An Ahn'kahar Guardian hatches!" class boss_elder_nadox : public CreatureScript { @@ -71,185 +71,185 @@ public: pInstance = c->GetInstanceScript(); } - EventMap events; + EventMap events; InstanceScript *pInstance; - SummonList summons; + SummonList summons; - void SummonHelpers(bool swarm) - { - Creature *cr; - if (swarm) - { - if (cr = me->SummonCreature(NPC_AHNKAHAR_SWARMER, 640.425f, -919.544f, 25.8701f, 2.56563f)) - summons.Summon(cr); - if (cr = me->SummonCreature(NPC_AHNKAHAR_SWARMER, 655.891f, -930.445f, 25.6978f, 3.64774f)) - summons.Summon(cr); - } - else - { - if (cr = me->SummonCreature(NPC_AHNKAHAR_GUARDIAN_ENTRY, 658.677f, -934.332f, 25.6978f, 3.03687f)) - summons.Summon(cr); - } - } + void SummonHelpers(bool swarm) + { + Creature *cr; + if (swarm) + { + if (cr = me->SummonCreature(NPC_AHNKAHAR_SWARMER, 640.425f, -919.544f, 25.8701f, 2.56563f)) + summons.Summon(cr); + if (cr = me->SummonCreature(NPC_AHNKAHAR_SWARMER, 655.891f, -930.445f, 25.6978f, 3.64774f)) + summons.Summon(cr); + } + else + { + if (cr = me->SummonCreature(NPC_AHNKAHAR_GUARDIAN_ENTRY, 658.677f, -934.332f, 25.6978f, 3.03687f)) + summons.Summon(cr); + } + } void Reset() { - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); if (pInstance) - { + { pInstance->SetData(DATA_ELDER_NADOX_EVENT, NOT_STARTED); - pInstance->SetData(DATA_NADOX_ACHIEVEMENT, true); - } + pInstance->SetData(DATA_NADOX_ACHIEVEMENT, true); + } } void EnterCombat(Unit * /*who*/) { - me->MonsterYell("The secrets of the deep shall remain hidden.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_AGGRO); + me->MonsterYell("The secrets of the deep shall remain hidden.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_AGGRO); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - events.ScheduleEvent(EVENT_SWARMER, 10000); - events.ScheduleEvent(EVENT_CHECK_HOME, 2000); - events.ScheduleEvent(EVENT_PLAGUE, 5000+rand()%3000); - events.ScheduleEvent(EVENT_BROOD_RAGE, 5000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_SWARMER, 10000); + events.ScheduleEvent(EVENT_CHECK_HOME, 2000); + events.ScheduleEvent(EVENT_PLAGUE, 5000+rand()%3000); + events.ScheduleEvent(EVENT_BROOD_RAGE, 5000); if (pInstance) pInstance->SetData(DATA_ELDER_NADOX_EVENT, IN_PROGRESS); } - void DoAction(int32 param) - { - if (param == ACTION_GUARDIAN_DIED) - { - if (pInstance) - pInstance->SetData(DATA_NADOX_ACHIEVEMENT, false); - } - } + void DoAction(int32 param) + { + if (param == ACTION_GUARDIAN_DIED) + { + if (pInstance) + pInstance->SetData(DATA_NADOX_ACHIEVEMENT, false); + } + } void KilledUnit(Unit * /*victim*/) { - if (urand(0,1)) - return; + if (urand(0,1)) + return; - switch (rand()%3) - { - case 0: - me->MonsterYell("Sleep now, in the cold dark.", LANG_UNIVERSAL,0); - me->PlayDirectSound(SOUND_SLAY1); - break; - case 1: - me->MonsterYell("For the Lich King!", LANG_UNIVERSAL,0); - me->PlayDirectSound(SOUND_SLAY2); - break; - case 2: - me->MonsterYell("Perhaps we will be allies soon.", LANG_UNIVERSAL,0); - me->PlayDirectSound(SOUND_SLAY3); - break; - } + switch (rand()%3) + { + case 0: + me->MonsterYell("Sleep now, in the cold dark.", LANG_UNIVERSAL,0); + me->PlayDirectSound(SOUND_SLAY1); + break; + case 1: + me->MonsterYell("For the Lich King!", LANG_UNIVERSAL,0); + me->PlayDirectSound(SOUND_SLAY2); + break; + case 2: + me->MonsterYell("Perhaps we will be allies soon.", LANG_UNIVERSAL,0); + me->PlayDirectSound(SOUND_SLAY3); + break; + } } void JustDied(Unit* /*killer*/) { - events.Reset(); - summons.DespawnAll(); - - me->MonsterYell("Master, is my service complete?", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_DEATH); + events.Reset(); + summons.DespawnAll(); + + me->MonsterYell("Master, is my service complete?", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_DEATH); if (pInstance) pInstance->SetData(DATA_ELDER_NADOX_EVENT, DONE); } - void JustSummoned(Creature* cr) - { - if (cr) - { - if (cr->GetEntry() == NPC_AHNKAHAR_GUARDIAN_ENTRY ) - { - switch (rand()%2) - { - case 0: - me->MonsterYell("The young must not grow hungry...", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SUMMON1); - break; - case 1: - me->MonsterYell("Shhhad ak kereeesshh chak-k-k!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SUMMON2); - break; - } - } - - summons.Summon(cr); - } - } + void JustSummoned(Creature* cr) + { + if (cr) + { + if (cr->GetEntry() == NPC_AHNKAHAR_GUARDIAN_ENTRY ) + { + switch (rand()%2) + { + case 0: + me->MonsterYell("The young must not grow hungry...", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SUMMON1); + break; + case 1: + me->MonsterYell("Shhhad ak kereeesshh chak-k-k!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SUMMON2); + break; + } + } + + summons.Summon(cr); + } + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch ( events.GetEvent() ) - { - case EVENT_CHECK_HEALTH: - { - events.RepeatEvent(1000); - if (HealthBelowPct(50)) - { - events.CancelEvent(EVENT_CHECK_HEALTH); - events.ScheduleEvent(EVENT_SUMMON_GUARD, 100); - } - break; - } - case EVENT_SUMMON_GUARD: - { - me->MonsterTextEmote(EMOTE_HATCHES, me, true); - SummonHelpers(false); - events.PopEvent(); - break; - } - case EVENT_BROOD_RAGE: - { - if (Creature *pSwarmer = me->FindNearestCreature(NPC_AHNKAHAR_SWARMER, 40, true)) - me->CastSpell(pSwarmer, SPELL_BROOD_RAGE_H, true); - - events.RepeatEvent(10000); - break; - } - case EVENT_PLAGUE: - { - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_BROOD_PLAGUE, SPELL_BROOD_PLAGUE_H), false); - events.RepeatEvent(12000+rand()%5000); - break; - } - case EVENT_SWARMER: - { - SummonHelpers(true); - events.RepeatEvent(10000); - break; - } - case EVENT_CHECK_HOME: - { - if (me->HasAura(SPELL_ENRAGE)) - break; + switch ( events.GetEvent() ) + { + case EVENT_CHECK_HEALTH: + { + events.RepeatEvent(1000); + if (HealthBelowPct(50)) + { + events.CancelEvent(EVENT_CHECK_HEALTH); + events.ScheduleEvent(EVENT_SUMMON_GUARD, 100); + } + break; + } + case EVENT_SUMMON_GUARD: + { + me->MonsterTextEmote(EMOTE_HATCHES, me, true); + SummonHelpers(false); + events.PopEvent(); + break; + } + case EVENT_BROOD_RAGE: + { + if (Creature *pSwarmer = me->FindNearestCreature(NPC_AHNKAHAR_SWARMER, 40, true)) + me->CastSpell(pSwarmer, SPELL_BROOD_RAGE_H, true); + + events.RepeatEvent(10000); + break; + } + case EVENT_PLAGUE: + { + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_BROOD_PLAGUE, SPELL_BROOD_PLAGUE_H), false); + events.RepeatEvent(12000+rand()%5000); + break; + } + case EVENT_SWARMER: + { + SummonHelpers(true); + events.RepeatEvent(10000); + break; + } + case EVENT_CHECK_HOME: + { + if (me->HasAura(SPELL_ENRAGE)) + break; - if (me->GetPositionZ() < 24) - { - me->CastSpell(me, SPELL_ENRAGE, true); - events.PopEvent(); - break; - } + if (me->GetPositionZ() < 24) + { + me->CastSpell(me, SPELL_ENRAGE, true); + events.PopEvent(); + break; + } - events.RepeatEvent(2000); - break; - } - } + events.RepeatEvent(2000); + break; + } + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; @@ -273,26 +273,26 @@ public: void Reset() { if (me->GetEntry() == NPC_AHNKAHAR_GUARDIAN_ENTRY) - me->CastSpell(me, SPELL_GUARDIAN_AURA, true); - else // Swarmers - me->CastSpell(me, SPELL_SWARMER_AURA, true); + me->CastSpell(me, SPELL_GUARDIAN_AURA, true); + else // Swarmers + me->CastSpell(me, SPELL_SWARMER_AURA, true); - if (me->GetEntry() == NPC_AHNKAHAR_SWARMER || me->GetEntry() == NPC_AHNKAHAR_GUARDIAN_ENTRY) - me->SetInCombatWithZone(); + if (me->GetEntry() == NPC_AHNKAHAR_SWARMER || me->GetEntry() == NPC_AHNKAHAR_GUARDIAN_ENTRY) + me->SetInCombatWithZone(); - uiSprintTimer = 10000; + uiSprintTimer = 10000; } void JustDied(Unit * /*killer*/) { if (me->GetEntry() == NPC_AHNKAHAR_GUARDIAN_ENTRY) - { + { if (InstanceScript *pInstance = me->GetInstanceScript()) - if (Creature *nadox = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_ELDER_NADOX))) - nadox->AI()->DoAction(ACTION_GUARDIAN_DIED); + if (Creature *nadox = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_ELDER_NADOX))) + nadox->AI()->DoAction(ACTION_GUARDIAN_DIED); - me->RemoveAllAuras(); - } + me->RemoveAllAuras(); + } } void UpdateAI(uint32 diff) @@ -305,8 +305,8 @@ public: me->CastSpell(me, SPELL_SPRINT, false); uiSprintTimer = 15000; } - else - uiSprintTimer -= diff; + else + uiSprintTimer -= diff; DoMeleeAttackIfReady(); } @@ -320,59 +320,59 @@ public: class spell_ahn_kahet_swarmer_aura : public SpellScriptLoader { - public: - spell_ahn_kahet_swarmer_aura() : SpellScriptLoader("spell_ahn_kahet_swarmer_aura") { } + public: + spell_ahn_kahet_swarmer_aura() : SpellScriptLoader("spell_ahn_kahet_swarmer_aura") { } - class spell_ahn_kahet_swarmer_aura_SpellScript : public SpellScript - { - PrepareSpellScript(spell_ahn_kahet_swarmer_aura_SpellScript) + class spell_ahn_kahet_swarmer_aura_SpellScript : public SpellScript + { + PrepareSpellScript(spell_ahn_kahet_swarmer_aura_SpellScript) - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - std::list swarm, swarm2; - caster->GetCreaturesWithEntryInRange(swarm, 40.0f, 30338); - caster->GetCreaturesWithEntryInRange(swarm2, 40.0f, 30178); - int32 aliveCount = -1; // minus self + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + std::list swarm, swarm2; + caster->GetCreaturesWithEntryInRange(swarm, 40.0f, 30338); + caster->GetCreaturesWithEntryInRange(swarm2, 40.0f, 30178); + int32 aliveCount = -1; // minus self - std::list::const_iterator itr; - for (itr = swarm.begin(); itr != swarm.end(); ++itr) - if ((*itr)->IsAlive()) - aliveCount++; - for (itr = swarm2.begin(); itr != swarm2.end(); ++itr) - if ((*itr)->IsAlive()) - aliveCount++; + std::list::const_iterator itr; + for (itr = swarm.begin(); itr != swarm.end(); ++itr) + if ((*itr)->IsAlive()) + aliveCount++; + for (itr = swarm2.begin(); itr != swarm2.end(); ++itr) + if ((*itr)->IsAlive()) + aliveCount++; - if (Aura *aur = caster->GetAura(56281)) - { - if (aliveCount > 0) - aur->SetStackAmount(aliveCount); - else - aur->Remove(); - } - else if (aliveCount > 0) - { - caster->CastCustomSpell(caster, 56281, &aliveCount, &aliveCount, &aliveCount, true); - if (Aura *aur = caster->GetAura(56281)) - aur->SetStackAmount(aliveCount); - } - } + if (Aura *aur = caster->GetAura(56281)) + { + if (aliveCount > 0) + aur->SetStackAmount(aliveCount); + else + aur->Remove(); + } + else if (aliveCount > 0) + { + caster->CastCustomSpell(caster, 56281, &aliveCount, &aliveCount, &aliveCount, true); + if (Aura *aur = caster->GetAura(56281)) + aur->SetStackAmount(aliveCount); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_ahn_kahet_swarmer_aura_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_ahn_kahet_swarmer_aura_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_ahn_kahet_swarmer_aura_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_ahn_kahet_swarmer_aura_SpellScript(); + } }; void AddSC_boss_elder_nadox() { new boss_elder_nadox(); new npc_ahnkahar_nerubian(); - new spell_ahn_kahet_swarmer_aura(); + new spell_ahn_kahet_swarmer_aura(); } diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp index 2090d1533..4cdf8e229 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp @@ -10,24 +10,24 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - // BASIC FIGHT - SPELL_MIND_FLAY = 57941, - SPELL_MIND_FLAY_H = 59974, - SPELL_SHADOW_BOLT_VOLLEY = 57942, - SPELL_SHADOW_BOLT_VOLLEY_H = 59975, - SPELL_SHIVER = 57949, - SPELL_SHIVER_H = 59978, + // BASIC FIGHT + SPELL_MIND_FLAY = 57941, + SPELL_MIND_FLAY_H = 59974, + SPELL_SHADOW_BOLT_VOLLEY = 57942, + SPELL_SHADOW_BOLT_VOLLEY_H = 59975, + SPELL_SHIVER = 57949, + SPELL_SHIVER_H = 59978, - // INSANITY - SPELL_INSANITY = 57496, //Dummy - INSANITY_VISUAL = 57561, - SPELL_INSANITY_TARGET = 57508, - SPELL_CLONE_PLAYER = 57507, //casted on player during insanity - SPELL_INSANITY_PHASING_1 = 57508, - SPELL_INSANITY_PHASING_2 = 57509, - SPELL_INSANITY_PHASING_3 = 57510, - SPELL_INSANITY_PHASING_4 = 57511, - SPELL_INSANITY_PHASING_5 = 57512 + // INSANITY + SPELL_INSANITY = 57496, //Dummy + INSANITY_VISUAL = 57561, + SPELL_INSANITY_TARGET = 57508, + SPELL_CLONE_PLAYER = 57507, //casted on player during insanity + SPELL_INSANITY_PHASING_1 = 57508, + SPELL_INSANITY_PHASING_2 = 57509, + SPELL_INSANITY_PHASING_3 = 57510, + SPELL_INSANITY_PHASING_4 = 57511, + SPELL_INSANITY_PHASING_5 = 57512 }; enum Yells @@ -40,16 +40,16 @@ enum Yells enum Misc { - NPC_TWISTED_VISAGE = 30625, - ACHIEV_QUICK_DEMISE_START_EVENT = 20382, + NPC_TWISTED_VISAGE = 30625, + ACHIEV_QUICK_DEMISE_START_EVENT = 20382, }; enum Events { - EVENT_HERALD_MIND_FLAY = 1, - EVENT_HERALD_SHADOW = 2, - EVENT_HERALD_SHIVER = 3, - EVENT_HERALD_HEALTH = 4, + EVENT_HERALD_MIND_FLAY = 1, + EVENT_HERALD_SHADOW = 2, + EVENT_HERALD_SHIVER = 3, + EVENT_HERALD_HEALTH = 4, }; class boss_volazj : public CreatureScript @@ -65,22 +65,22 @@ public: } InstanceScript *pInstance; - EventMap events; - SummonList summons; - uint8 insanityTimes; - uint8 insanityHandled; + EventMap events; + SummonList summons; + uint8 insanityTimes; + uint8 insanityHandled; - void Reset() + void Reset() { - events.Reset(); - summons.DespawnAll(); - insanityTimes = insanityHandled = 0; + events.Reset(); + summons.DespawnAll(); + insanityTimes = insanityHandled = 0; - // Visible for all players in insanity + // Visible for all players in insanity me->SetPhaseMask((1|16|32|64|128|256), true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(false, UNIT_STATE_STUNNED); - ResetPlayersPhaseMask(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetControlled(false, UNIT_STATE_STUNNED); + ResetPlayersPhaseMask(); if (pInstance) { @@ -100,8 +100,8 @@ public: // First target - start channel visual and set self as unnattackable if (!insanityHandled) { - me->RemoveAllAuras(); - me->CastSpell(me, INSANITY_VISUAL, true); + me->RemoveAllAuras(); + me->CastSpell(me, INSANITY_VISUAL, true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetControlled(true, UNIT_STATE_STUNNED); } @@ -109,7 +109,7 @@ public: // phase mask pTarget->CastSpell(pTarget, SPELL_INSANITY_TARGET+insanityHandled, true); - // summon twisted party members for this target + // summon twisted party members for this target Map::PlayerList const &players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { @@ -120,14 +120,14 @@ public: // Summon clone if (Unit* summon = me->SummonCreature(NPC_TWISTED_VISAGE, plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0)) { - summon->AddThreat(pTarget, 0.0f); - summon->SetInCombatWith(pTarget); - pTarget->SetInCombatWith(summon); + summon->AddThreat(pTarget, 0.0f); + summon->SetInCombatWith(pTarget); + pTarget->SetInCombatWith(summon); plr->CastSpell(summon, SPELL_CLONE_PLAYER, true); summon->SetPhaseMask(1|(1<<(4+insanityHandled)), true); - summon->SetUInt32Value(UNIT_FIELD_MINDAMAGE, plr->GetUInt32Value(UNIT_FIELD_MINDAMAGE)); - summon->SetUInt32Value(UNIT_FIELD_MAXDAMAGE, plr->GetUInt32Value(UNIT_FIELD_MAXDAMAGE)); + summon->SetUInt32Value(UNIT_FIELD_MINDAMAGE, plr->GetUInt32Value(UNIT_FIELD_MINDAMAGE)); + summon->SetUInt32Value(UNIT_FIELD_MAXDAMAGE, plr->GetUInt32Value(UNIT_FIELD_MAXDAMAGE)); } } @@ -141,17 +141,17 @@ public: for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { if (Player* pPlayer = i->GetSource()) - if (uint32 spellId = GetSpellForPhaseMask(pPlayer->GetPhaseMask())) - pPlayer->RemoveAurasDueToSpell(spellId); + if (uint32 spellId = GetSpellForPhaseMask(pPlayer->GetPhaseMask())) + pPlayer->RemoveAurasDueToSpell(spellId); } } void EnterCombat(Unit* /*who*/) { - events.ScheduleEvent(EVENT_HERALD_MIND_FLAY, 8000); - events.ScheduleEvent(EVENT_HERALD_SHADOW, 5000); - events.ScheduleEvent(EVENT_HERALD_SHIVER, 15000); - events.ScheduleEvent(EVENT_HERALD_HEALTH, 1000); + events.ScheduleEvent(EVENT_HERALD_MIND_FLAY, 8000); + events.ScheduleEvent(EVENT_HERALD_SHADOW, 5000); + events.ScheduleEvent(EVENT_HERALD_SHIVER, 15000); + events.ScheduleEvent(EVENT_HERALD_HEALTH, 1000); Talk(SAY_AGGRO); @@ -161,7 +161,7 @@ public: pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_QUICK_DEMISE_START_EVENT); } - me->SetInCombatWithZone(); + me->SetInCombatWithZone(); } void JustSummoned(Creature *summon) { summons.Summon(summon); } @@ -190,32 +190,32 @@ public: return spell; } - bool CheckPhaseMinions() - { - summons.RemoveNotExisting(); - if (summons.empty()) - { - ResetPlayersPhaseMask(); + bool CheckPhaseMinions() + { + summons.RemoveNotExisting(); + if (summons.empty()) + { + ResetPlayersPhaseMask(); return true; - } + } - uint16 phase = 1; - for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) - { - if (Creature *summon = ObjectAccessor::GetCreature(*me, *itr)) - phase |= summon->GetPhaseMask(); - } + uint16 phase = 1; + for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) + { + if (Creature *summon = ObjectAccessor::GetCreature(*me, *itr)) + phase |= summon->GetPhaseMask(); + } - Map::PlayerList const &players = me->GetMap()->GetPlayers(); + Map::PlayerList const &players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { if (Player* pPlayer = i->GetSource()) - if ((pPlayer->GetPhaseMask() & phase) == 0) - pPlayer->RemoveAurasDueToSpell(GetSpellForPhaseMask(pPlayer->GetPhaseMask())); + if ((pPlayer->GetPhaseMask() & phase) == 0) + pPlayer->RemoveAurasDueToSpell(GetSpellForPhaseMask(pPlayer->GetPhaseMask())); } - return false; - } + return false; + } void UpdateAI(uint32 diff) { @@ -225,8 +225,8 @@ public: if (insanityHandled) { - if (!CheckPhaseMinions()) - return; + if (!CheckPhaseMinions()) + return; insanityHandled = 0; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -234,49 +234,49 @@ public: me->RemoveAurasDueToSpell(INSANITY_VISUAL); } - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_HERALD_HEALTH: - { - if (insanityTimes == 0 && me->GetHealthPct() <= 66) - { - me->CastSpell(me, SPELL_INSANITY, false); - insanityTimes++; - } - else if (insanityTimes == 1 && me->GetHealthPct() <= 33) - { - me->CastSpell(me, SPELL_INSANITY, false); - insanityTimes++; - } + switch (events.GetEvent()) + { + case EVENT_HERALD_HEALTH: + { + if (insanityTimes == 0 && me->GetHealthPct() <= 66) + { + me->CastSpell(me, SPELL_INSANITY, false); + insanityTimes++; + } + else if (insanityTimes == 1 && me->GetHealthPct() <= 33) + { + me->CastSpell(me, SPELL_INSANITY, false); + insanityTimes++; + } - events.RepeatEvent(1000); - break; - } - case EVENT_HERALD_MIND_FLAY: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_MIND_FLAY_H : SPELL_MIND_FLAY, false); - events.RepeatEvent(20000); - break; - } - case EVENT_HERALD_SHADOW: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SHADOW_BOLT_VOLLEY_H : SPELL_SHADOW_BOLT_VOLLEY, false); - events.RepeatEvent(5000); - break; - } - case EVENT_HERALD_SHIVER: - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(pTarget, IsHeroic() ? SPELL_SHIVER_H : SPELL_SHIVER, false); + events.RepeatEvent(1000); + break; + } + case EVENT_HERALD_MIND_FLAY: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_MIND_FLAY_H : SPELL_MIND_FLAY, false); + events.RepeatEvent(20000); + break; + } + case EVENT_HERALD_SHADOW: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SHADOW_BOLT_VOLLEY_H : SPELL_SHADOW_BOLT_VOLLEY, false); + events.RepeatEvent(5000); + break; + } + case EVENT_HERALD_SHIVER: + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(pTarget, IsHeroic() ? SPELL_SHIVER_H : SPELL_SHIVER, false); - events.RepeatEvent(15000); - break; - } - } + events.RepeatEvent(15000); + break; + } + } DoMeleeAttackIfReady(); } @@ -288,7 +288,7 @@ public: if (pInstance) pInstance->SetData(DATA_HERALD_VOLAZJ, DONE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetControlled(false, UNIT_STATE_STUNNED); summons.DespawnAll(); ResetPlayersPhaseMask(); diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp index 273b70193..b4c2b2607 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp @@ -19,47 +19,47 @@ enum Yells enum Spells { - // VISUALS - SPELL_PINK_SPHERE = 56075, - SPELL_WHITE_SPHERE = 56102, - SPELL_LIGHTNING_BOLTS = 56327, - SPELL_ACTIVATE_INITIATE = 56868, - SPELL_FREEZE_ANIM = 55591, - SPELL_SACRIFICE_VISUAL = 56133, + // VISUALS + SPELL_PINK_SPHERE = 56075, + SPELL_WHITE_SPHERE = 56102, + SPELL_LIGHTNING_BOLTS = 56327, + SPELL_ACTIVATE_INITIATE = 56868, + SPELL_FREEZE_ANIM = 55591, + SPELL_SACRIFICE_VISUAL = 56133, - // FIGHT - SPELL_GIFT_OF_THE_HERALD = 56219, - SPELL_CYCLONE_STRIKE = 56855, // Self - SPELL_CYCLONE_STRIKE_H = 60030, - SPELL_LIGHTNING_BOLT = 56891, // 40Y - SPELL_LIGHTNING_BOLT_H = 60032, // 40Y - SPELL_THUNDERSHOCK = 56926, // 30Y - SPELL_THUNDERSHOCK_H = 60029 // 30Y + // FIGHT + SPELL_GIFT_OF_THE_HERALD = 56219, + SPELL_CYCLONE_STRIKE = 56855, // Self + SPELL_CYCLONE_STRIKE_H = 60030, + SPELL_LIGHTNING_BOLT = 56891, // 40Y + SPELL_LIGHTNING_BOLT_H = 60032, // 40Y + SPELL_THUNDERSHOCK = 56926, // 30Y + SPELL_THUNDERSHOCK_H = 60029 // 30Y }; enum Events { - EVENT_JEDOGA_CYCLONE = 1, - EVENT_JEDOGA_LIGHTNING_BOLT = 2, - EVENT_JEDOGA_THUNDERSHOCK = 3, - EVENT_JEDOGA_MOVE_UP = 4, - EVENT_JEDOGA_MOVE_DOWN = 5, + EVENT_JEDOGA_CYCLONE = 1, + EVENT_JEDOGA_LIGHTNING_BOLT = 2, + EVENT_JEDOGA_THUNDERSHOCK = 3, + EVENT_JEDOGA_MOVE_UP = 4, + EVENT_JEDOGA_MOVE_DOWN = 5, }; enum Misc { - NPC_JEDOGA_CONTROLLER = 30181, - NPC_INITIATE = 30114, + NPC_JEDOGA_CONTROLLER = 30181, + NPC_INITIATE = 30114, - ACTION_INITIATE_DIED = 1, - ACTION_ACTIVATE = 2, - ACTION_HERALD = 3, - ACTION_SACRIFICE_FAILED = 4, + ACTION_INITIATE_DIED = 1, + ACTION_ACTIVATE = 2, + ACTION_HERALD = 3, + ACTION_SACRIFICE_FAILED = 4, - POINT_DOWN = 1, - POINT_UP = 2, - POINT_UP_START = 3, - POINT_RITUAL = 4, + POINT_DOWN = 1, + POINT_UP = 2, + POINT_UP_START = 3, + POINT_RITUAL = 4, }; const Position JedogaPosition[2] = @@ -81,149 +81,149 @@ public: } InstanceScript* pInstance; - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; - uint8 initiates; - uint32 introCheck; - bool isFlying; - bool startFly; + uint8 initiates; + uint32 introCheck; + bool isFlying; + bool startFly; - void JustSummoned(Creature *cr) { summons.Summon(cr); } - void MoveInLineOfSight(Unit *) { } + void JustSummoned(Creature *cr) { summons.Summon(cr); } + void MoveInLineOfSight(Unit *) { } - void SpawnInitiate(bool start) - { - summons.DespawnAll(); - if (start) - { - me->SummonCreature(NPC_INITIATE, 362.458f, -714.166f, -16.0964f, 0.977384f); - me->SummonCreature(NPC_INITIATE, 368.781f, -713.932f, -16.0964f, 1.46608f); - me->SummonCreature(NPC_INITIATE, 364.937f, -716.11f, -16.0964f, 1.25664f); - me->SummonCreature(NPC_INITIATE, 362.02f, -719.828f, -16.0964f, 1.20428f); - me->SummonCreature(NPC_INITIATE, 368.151f, -719.763f, -16.0964f, 1.53589f); - me->SummonCreature(NPC_INITIATE, 392.276f, -695.895f, -16.0964f, 3.40339f); - me->SummonCreature(NPC_INITIATE, 387.224f, -698.006f, -16.0964f, 3.36848f); - me->SummonCreature(NPC_INITIATE, 389.626f, -702.3f, -16.0964f, 3.07178f); - me->SummonCreature(NPC_INITIATE, 383.812f, -700.41f, -16.0964f, 3.15905f); - me->SummonCreature(NPC_INITIATE, 385.693f, -694.376f, -16.0964f, 3.59538f); - me->SummonCreature(NPC_INITIATE, 379.204f, -716.697f, -16.0964f, 2.1293f); - me->SummonCreature(NPC_INITIATE, 375.4f, -711.434f, -16.0964f, 2.09439f); - me->SummonCreature(NPC_INITIATE, 382.583f, -711.713f, -16.0964f, 2.53073f); - me->SummonCreature(NPC_INITIATE, 379.049f, -712.899f, -16.0964f, 2.28638f); - me->SummonCreature(NPC_INITIATE, 378.424f, -708.388f, -16.0964f, 2.58309f); - } - else - { - me->SummonCreature(NPC_INITIATE, 394.197f, -701.164f, -16.1797f, 4.09901f); - me->SummonCreature(NPC_INITIATE, 391.003f, -697.814f, -16.1797f, 4.11079f); - me->SummonCreature(NPC_INITIATE, 386.5f, -694.973f, -16.1797f, 4.12649f); - me->SummonCreature(NPC_INITIATE, 381.762f, -692.405f, -16.1797f, 4.12257f); - me->SummonCreature(NPC_INITIATE, 377.411f, -691.198f, -16.1797f, 4.6095f); - me->SummonCreature(NPC_INITIATE, 395.122f, -686.975f, -16.1797f, 2.72063f); - me->SummonCreature(NPC_INITIATE, 398.823f, -692.51f, -16.1797f, 2.72063f); - me->SummonCreature(NPC_INITIATE, 399.819f, -698.815f, -16.1797f, 2.72455f); - me->SummonCreature(NPC_INITIATE, 395.996f, -705.291f, -16.1309f, 0.376213f); - me->SummonCreature(NPC_INITIATE, 391.505f, -710.883f, -16.0589f, 0.376213f); - me->SummonCreature(NPC_INITIATE, 387.872f, -716.186f, -16.1797f, 0.376213f); - me->SummonCreature(NPC_INITIATE, 383.276f, -722.431f, -16.1797f, 0.376213f); - me->SummonCreature(NPC_INITIATE, 377.175f, -730.652f, -16.1797f, 0.376213f); - me->SummonCreature(NPC_INITIATE, 371.625f, -735.5f, -16.1797f, 0.376213f); - me->SummonCreature(NPC_INITIATE, 364.932f, -735.808f, -16.1797f, 0.376213f); - me->SummonCreature(NPC_INITIATE, 358.966f, -733.199f, -16.1797f, 0.376213f); - me->SummonCreature(NPC_INITIATE, 376.348f, -725.037f, -16.1797f, 5.65409f); - me->SummonCreature(NPC_INITIATE, 371.435f, -723.892f, -16.1797f, 5.65409f); - me->SummonCreature(NPC_INITIATE, 366.861f, -721.702f, -16.1797f, 5.65409f); - me->SummonCreature(NPC_INITIATE, 362.343f, -718.019f, -16.1797f, 5.51665f); - me->SummonCreature(NPC_INITIATE, 358.906f, -714.357f, -16.1797f, 5.35957f); + void SpawnInitiate(bool start) + { + summons.DespawnAll(); + if (start) + { + me->SummonCreature(NPC_INITIATE, 362.458f, -714.166f, -16.0964f, 0.977384f); + me->SummonCreature(NPC_INITIATE, 368.781f, -713.932f, -16.0964f, 1.46608f); + me->SummonCreature(NPC_INITIATE, 364.937f, -716.11f, -16.0964f, 1.25664f); + me->SummonCreature(NPC_INITIATE, 362.02f, -719.828f, -16.0964f, 1.20428f); + me->SummonCreature(NPC_INITIATE, 368.151f, -719.763f, -16.0964f, 1.53589f); + me->SummonCreature(NPC_INITIATE, 392.276f, -695.895f, -16.0964f, 3.40339f); + me->SummonCreature(NPC_INITIATE, 387.224f, -698.006f, -16.0964f, 3.36848f); + me->SummonCreature(NPC_INITIATE, 389.626f, -702.3f, -16.0964f, 3.07178f); + me->SummonCreature(NPC_INITIATE, 383.812f, -700.41f, -16.0964f, 3.15905f); + me->SummonCreature(NPC_INITIATE, 385.693f, -694.376f, -16.0964f, 3.59538f); + me->SummonCreature(NPC_INITIATE, 379.204f, -716.697f, -16.0964f, 2.1293f); + me->SummonCreature(NPC_INITIATE, 375.4f, -711.434f, -16.0964f, 2.09439f); + me->SummonCreature(NPC_INITIATE, 382.583f, -711.713f, -16.0964f, 2.53073f); + me->SummonCreature(NPC_INITIATE, 379.049f, -712.899f, -16.0964f, 2.28638f); + me->SummonCreature(NPC_INITIATE, 378.424f, -708.388f, -16.0964f, 2.58309f); + } + else + { + me->SummonCreature(NPC_INITIATE, 394.197f, -701.164f, -16.1797f, 4.09901f); + me->SummonCreature(NPC_INITIATE, 391.003f, -697.814f, -16.1797f, 4.11079f); + me->SummonCreature(NPC_INITIATE, 386.5f, -694.973f, -16.1797f, 4.12649f); + me->SummonCreature(NPC_INITIATE, 381.762f, -692.405f, -16.1797f, 4.12257f); + me->SummonCreature(NPC_INITIATE, 377.411f, -691.198f, -16.1797f, 4.6095f); + me->SummonCreature(NPC_INITIATE, 395.122f, -686.975f, -16.1797f, 2.72063f); + me->SummonCreature(NPC_INITIATE, 398.823f, -692.51f, -16.1797f, 2.72063f); + me->SummonCreature(NPC_INITIATE, 399.819f, -698.815f, -16.1797f, 2.72455f); + me->SummonCreature(NPC_INITIATE, 395.996f, -705.291f, -16.1309f, 0.376213f); + me->SummonCreature(NPC_INITIATE, 391.505f, -710.883f, -16.0589f, 0.376213f); + me->SummonCreature(NPC_INITIATE, 387.872f, -716.186f, -16.1797f, 0.376213f); + me->SummonCreature(NPC_INITIATE, 383.276f, -722.431f, -16.1797f, 0.376213f); + me->SummonCreature(NPC_INITIATE, 377.175f, -730.652f, -16.1797f, 0.376213f); + me->SummonCreature(NPC_INITIATE, 371.625f, -735.5f, -16.1797f, 0.376213f); + me->SummonCreature(NPC_INITIATE, 364.932f, -735.808f, -16.1797f, 0.376213f); + me->SummonCreature(NPC_INITIATE, 358.966f, -733.199f, -16.1797f, 0.376213f); + me->SummonCreature(NPC_INITIATE, 376.348f, -725.037f, -16.1797f, 5.65409f); + me->SummonCreature(NPC_INITIATE, 371.435f, -723.892f, -16.1797f, 5.65409f); + me->SummonCreature(NPC_INITIATE, 366.861f, -721.702f, -16.1797f, 5.65409f); + me->SummonCreature(NPC_INITIATE, 362.343f, -718.019f, -16.1797f, 5.51665f); + me->SummonCreature(NPC_INITIATE, 358.906f, -714.357f, -16.1797f, 5.35957f); - } - } + } + } - void ActivateInitiate() - { - if (!summons.size()) - return; + void ActivateInitiate() + { + if (!summons.size()) + return; - uint8 rnd = urand(0, summons.size()-1); - uint8 loop = 0; - for (std::list::iterator i = summons.begin(); i != summons.end();) - { - Creature *summon = ObjectAccessor::GetCreature(*me, *i); - if (summon && summon->GetEntry() == NPC_INITIATE && loop >= rnd) - { - summon->AI()->DoAction(ACTION_ACTIVATE); - break; - } + uint8 rnd = urand(0, summons.size()-1); + uint8 loop = 0; + for (std::list::iterator i = summons.begin(); i != summons.end();) + { + Creature *summon = ObjectAccessor::GetCreature(*me, *i); + if (summon && summon->GetEntry() == NPC_INITIATE && loop >= rnd) + { + summon->AI()->DoAction(ACTION_ACTIVATE); + break; + } - ++i; - ++loop; - } + ++i; + ++loop; + } - return; - } + return; + } - void ScheduleEvents() - { - events.RescheduleEvent(EVENT_JEDOGA_CYCLONE, 3000); - events.RescheduleEvent(EVENT_JEDOGA_LIGHTNING_BOLT, 7000); - events.RescheduleEvent(EVENT_JEDOGA_THUNDERSHOCK, 12000); - events.RescheduleEvent(EVENT_JEDOGA_MOVE_UP, urand(20000, 25000)); - } + void ScheduleEvents() + { + events.RescheduleEvent(EVENT_JEDOGA_CYCLONE, 3000); + events.RescheduleEvent(EVENT_JEDOGA_LIGHTNING_BOLT, 7000); + events.RescheduleEvent(EVENT_JEDOGA_THUNDERSHOCK, 12000); + events.RescheduleEvent(EVENT_JEDOGA_MOVE_UP, urand(20000, 25000)); + } - void DoAction(int32 param) - { - if (param == ACTION_INITIATE_DIED) - { - // all killed - if (initiates++ > 13) - { - summons.DespawnAll(); - MoveDown(); - initiates = 0; - } - } - else if (param == ACTION_HERALD) - { - me->CastSpell(me, SPELL_GIFT_OF_THE_HERALD, true); - events.DelayEvents(1001); - events.ScheduleEvent(EVENT_JEDOGA_MOVE_DOWN, 1000); - isFlying = false; - } - else if (param == ACTION_SACRIFICE_FAILED) - { - events.DelayEvents(1001); - events.ScheduleEvent(EVENT_JEDOGA_MOVE_DOWN, 1000); - isFlying = false; - if (pInstance) - pInstance->SetData(DATA_JEDOGA_ACHIEVEMENT, false); - } - } + void DoAction(int32 param) + { + if (param == ACTION_INITIATE_DIED) + { + // all killed + if (initiates++ > 13) + { + summons.DespawnAll(); + MoveDown(); + initiates = 0; + } + } + else if (param == ACTION_HERALD) + { + me->CastSpell(me, SPELL_GIFT_OF_THE_HERALD, true); + events.DelayEvents(1001); + events.ScheduleEvent(EVENT_JEDOGA_MOVE_DOWN, 1000); + isFlying = false; + } + else if (param == ACTION_SACRIFICE_FAILED) + { + events.DelayEvents(1001); + events.ScheduleEvent(EVENT_JEDOGA_MOVE_DOWN, 1000); + isFlying = false; + if (pInstance) + pInstance->SetData(DATA_JEDOGA_ACHIEVEMENT, false); + } + } void Reset() { - if (pInstance) - { + if (pInstance) + { pInstance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, NOT_STARTED); - pInstance->SetData(DATA_JEDOGA_ACHIEVEMENT, true); - } + pInstance->SetData(DATA_JEDOGA_ACHIEVEMENT, true); + } - events.Reset(); - SpawnInitiate(true); - initiates = 0; - introCheck = 1; // leave 1 - isFlying = false; - startFly = false; + events.Reset(); + SpawnInitiate(true); + initiates = 0; + introCheck = 1; // leave 1 + isFlying = false; + startFly = false; MoveUp(true); - me->CastSpell(me, SPELL_PINK_SPHERE, true); - me->CastSpell(me, SPELL_LIGHTNING_BOLTS, true); - me->CastSpell(me, SPELL_FREEZE_ANIM, true); + me->CastSpell(me, SPELL_PINK_SPHERE, true); + me->CastSpell(me, SPELL_LIGHTNING_BOLTS, true); + me->CastSpell(me, SPELL_FREEZE_ANIM, true); } void EnterCombat(Unit* who) { - if (pInstance) + if (pInstance) pInstance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, IN_PROGRESS); Talk(TEXT_AGGRO); @@ -243,153 +243,153 @@ public: if (pInstance) pInstance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, DONE); - summons.DespawnAll(); + summons.DespawnAll(); } void MoveDown() { - me->GetMotionMaster()->MoveIdle(); + me->GetMotionMaster()->MoveIdle(); me->GetMotionMaster()->MovePoint(POINT_DOWN, JedogaPosition[1]); } void MoveUp(bool start) { - isFlying = true; + isFlying = true; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); me->AttackStop(); - me->GetMotionMaster()->Clear(true); - me->SetFacingTo(5.66f); - me->GetMotionMaster()->MovePoint((start ? POINT_UP_START : POINT_UP), JedogaPosition[0]); + me->GetMotionMaster()->Clear(true); + me->SetFacingTo(5.66f); + me->GetMotionMaster()->MovePoint((start ? POINT_UP_START : POINT_UP), JedogaPosition[0]); - me->SetDisableGravity(true); - me->CastSpell(me, SPELL_FREEZE_ANIM, true); + me->SetDisableGravity(true); + me->CastSpell(me, SPELL_FREEZE_ANIM, true); } - void MovementInform(uint32 Type, uint32 PointId) + void MovementInform(uint32 Type, uint32 PointId) { if (Type != POINT_MOTION_TYPE) - return; + return; - if (PointId == POINT_DOWN) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - me->RemoveAurasDueToSpell(SPELL_PINK_SPHERE); - me->RemoveAurasDueToSpell(SPELL_LIGHTNING_BOLTS); - me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); + if (PointId == POINT_DOWN) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + me->RemoveAurasDueToSpell(SPELL_PINK_SPHERE); + me->RemoveAurasDueToSpell(SPELL_LIGHTNING_BOLTS); + me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); - isFlying = false; - me->SetInCombatWithZone(); - me->SetDisableGravity(false); - if (!summons.HasEntry(NPC_INITIATE)) - SpawnInitiate(false); + isFlying = false; + me->SetInCombatWithZone(); + me->SetDisableGravity(false); + if (!summons.HasEntry(NPC_INITIATE)) + SpawnInitiate(false); - if (UpdateVictim()) - { - me->StopMoving(); - ScheduleEvents(); - AttackStart(me->GetVictim()); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - } - } - else if (PointId == POINT_UP) - ActivateInitiate(); - else if (PointId == POINT_RITUAL) - startFly = true; - } + if (UpdateVictim()) + { + me->StopMoving(); + ScheduleEvents(); + AttackStart(me->GetVictim()); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + } + } + else if (PointId == POINT_UP) + ActivateInitiate(); + else if (PointId == POINT_RITUAL) + startFly = true; + } void UpdateAI(uint32 diff) { - // Start text - if (introCheck) - { - introCheck += diff; - if (introCheck >= 2000) - { - if (SelectTargetFromPlayerList(80.0f)) - { - introCheck = 0; - Talk(TEXT_PREACHING); - } - else - introCheck = 1; - } - - return; - } - - if (startFly) - { - startFly = false; - MoveUp(false); - } - - if (isFlying && !SelectTargetFromPlayerList(80.0f)) - { - EnterEvadeMode(); - return; - } - - if (!isFlying) + // Start text + if (introCheck) { - if (!UpdateVictim()) - return; + introCheck += diff; + if (introCheck >= 2000) + { + if (SelectTargetFromPlayerList(80.0f)) + { + introCheck = 0; + Talk(TEXT_PREACHING); + } + else + introCheck = 1; + } - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + return; + } - switch (events.GetEvent()) - { - case EVENT_JEDOGA_CYCLONE: - { - me->CastSpell(me, IsHeroic() ? SPELL_CYCLONE_STRIKE_H : SPELL_CYCLONE_STRIKE, false); - events.RepeatEvent(urand(10000, 14000)); - break; - } - case EVENT_JEDOGA_LIGHTNING_BOLT: - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - me->CastSpell(pTarget, IsHeroic() ? SPELL_LIGHTNING_BOLT_H : SPELL_LIGHTNING_BOLT, false); + if (startFly) + { + startFly = false; + MoveUp(false); + } - events.RepeatEvent(urand(11000, 15000)); - break; - } - case EVENT_JEDOGA_THUNDERSHOCK: - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - me->CastSpell(pTarget, IsHeroic() ? SPELL_THUNDERSHOCK_H : SPELL_THUNDERSHOCK, false); + if (isFlying && !SelectTargetFromPlayerList(80.0f)) + { + EnterEvadeMode(); + return; + } - events.RepeatEvent(urand(16000, 22000)); - break; - } - case EVENT_JEDOGA_MOVE_UP: - { - events.PopEvent(); - if (!summons.HasEntry(NPC_INITIATE)) - break; + if (!isFlying) + { + if (!UpdateVictim()) + return; - if (Creature *cr = me->SummonCreature(NPC_JEDOGA_CONTROLLER, 373.48f, -706.00f, -16.18f)) - { - cr->CastSpell(cr, SPELL_SACRIFICE_VISUAL, true); - summons.Summon(cr); - } + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - Talk(TEXT_SACRIFICE_1); + switch (events.GetEvent()) + { + case EVENT_JEDOGA_CYCLONE: + { + me->CastSpell(me, IsHeroic() ? SPELL_CYCLONE_STRIKE_H : SPELL_CYCLONE_STRIKE, false); + events.RepeatEvent(urand(10000, 14000)); + break; + } + case EVENT_JEDOGA_LIGHTNING_BOLT: + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + me->CastSpell(pTarget, IsHeroic() ? SPELL_LIGHTNING_BOLT_H : SPELL_LIGHTNING_BOLT, false); - isFlying = true; - me->GetMotionMaster()->Clear(true); - me->GetMotionMaster()->MovePoint(POINT_RITUAL, JedogaPosition[1]); - break; - } - case EVENT_JEDOGA_MOVE_DOWN: - { - Talk(TEXT_SACRIFICE_2); - summons.DespawnEntry(NPC_JEDOGA_CONTROLLER); - MoveDown(); - events.PopEvent(); - break; - } - } + events.RepeatEvent(urand(11000, 15000)); + break; + } + case EVENT_JEDOGA_THUNDERSHOCK: + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + me->CastSpell(pTarget, IsHeroic() ? SPELL_THUNDERSHOCK_H : SPELL_THUNDERSHOCK, false); + + events.RepeatEvent(urand(16000, 22000)); + break; + } + case EVENT_JEDOGA_MOVE_UP: + { + events.PopEvent(); + if (!summons.HasEntry(NPC_INITIATE)) + break; + + if (Creature *cr = me->SummonCreature(NPC_JEDOGA_CONTROLLER, 373.48f, -706.00f, -16.18f)) + { + cr->CastSpell(cr, SPELL_SACRIFICE_VISUAL, true); + summons.Summon(cr); + } + + Talk(TEXT_SACRIFICE_1); + + isFlying = true; + me->GetMotionMaster()->Clear(true); + me->GetMotionMaster()->MovePoint(POINT_RITUAL, JedogaPosition[1]); + break; + } + case EVENT_JEDOGA_MOVE_DOWN: + { + Talk(TEXT_SACRIFICE_2); + summons.DespawnEntry(NPC_JEDOGA_CONTROLLER); + MoveDown(); + events.PopEvent(); + break; + } + } DoMeleeAttackIfReady(); } @@ -415,39 +415,39 @@ public: } InstanceScript* pInstance; - int32 Timer; + int32 Timer; - void AttackStart(Unit* who) - { - if (!Timer) - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (!Timer) + ScriptedAI::AttackStart(who); + } - void MoveInLineOfSight(Unit *who) - { - if (!Timer) - ScriptedAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit *who) + { + if (!Timer) + ScriptedAI::MoveInLineOfSight(who); + } void Reset() { - Timer = 0; + Timer = 0; if (!pInstance) return; if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) != IN_PROGRESS) { - me->SetControlled(false, UNIT_STATE_STUNNED); + me->SetControlled(false, UNIT_STATE_STUNNED); me->RemoveAurasDueToSpell(SPELL_WHITE_SPHERE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); } else { - me->SetOrientation(me->GetAngle(372.6f, -705.12f)); - me->SendMovementFlagUpdate(); + me->SetOrientation(me->GetAngle(372.6f, -705.12f)); + me->SendMovementFlagUpdate(); me->CastSpell(me, SPELL_WHITE_SPHERE, false); - me->SetControlled(true, UNIT_STATE_STUNNED); + me->SetControlled(true, UNIT_STATE_STUNNED); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); } } @@ -455,52 +455,52 @@ public: void JustDied(Unit* Killer) { if (!pInstance || Killer == me) - return; + return; Creature* boss = me->GetMap()->GetCreature(pInstance->GetData64(DATA_JEDOGA_SHADOWSEEKER)); if (boss) - { - if (Timer) - boss->AI()->DoAction(ACTION_SACRIFICE_FAILED); - else - boss->AI()->DoAction(ACTION_INITIATE_DIED); - } + { + if (Timer) + boss->AI()->DoAction(ACTION_SACRIFICE_FAILED); + else + boss->AI()->DoAction(ACTION_INITIATE_DIED); + } } - void DoAction(int32 param) - { - if (param == ACTION_ACTIVATE) - { - Timer = 1500; - me->CastSpell(me, SPELL_ACTIVATE_INITIATE, true); - } - } + void DoAction(int32 param) + { + if (param == ACTION_ACTIVATE) + { + Timer = 1500; + me->CastSpell(me, SPELL_ACTIVATE_INITIATE, true); + } + } void MovementInform(uint32 Type, uint32 PointId) { - if (Type == POINT_MOTION_TYPE && PointId == POINT_RITUAL) - { - Unit::Kill(me, me); - me->DespawnOrUnsummon(5000); - Creature* boss = me->GetMap()->GetCreature(pInstance->GetData64(DATA_JEDOGA_SHADOWSEEKER)); - if (boss) - boss->AI()->DoAction(ACTION_HERALD); - } + if (Type == POINT_MOTION_TYPE && PointId == POINT_RITUAL) + { + Unit::Kill(me, me); + me->DespawnOrUnsummon(5000); + Creature* boss = me->GetMap()->GetCreature(pInstance->GetData64(DATA_JEDOGA_SHADOWSEEKER)); + if (boss) + boss->AI()->DoAction(ACTION_HERALD); + } } void UpdateAI(uint32 diff) { - if (Timer) - { - Timer -= diff; - if (Timer <= 0) - { - me->CombatStop(); - me->SetControlled(false, UNIT_STATE_STUNNED); - me->RemoveAurasDueToSpell(SPELL_WHITE_SPHERE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + if (Timer) + { + Timer -= diff; + if (Timer <= 0) + { + me->CombatStop(); + me->SetControlled(false, UNIT_STATE_STUNNED); + me->RemoveAurasDueToSpell(SPELL_WHITE_SPHERE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - float distance = me->GetDistance(373.48f, -706.00f, -16.18f); + float distance = me->GetDistance(373.48f, -706.00f, -16.18f); if (distance < 9.0f) me->SetSpeed(MOVE_RUN, 0.5f, true); @@ -512,11 +512,11 @@ public: me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MovePoint(POINT_RITUAL, 373.48f, -706.00f, -16.18f); - Timer = 10000000; - } + Timer = 10000000; + } - return; - } + return; + } if (!UpdateVictim()) return; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp index fe933d576..f5ee97730 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp @@ -9,37 +9,37 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_BLOODTHIRST = 55968, //Trigger Spell + add aura - SPELL_CONJURE_FLAME_SPHERE = 55931, - SPELL_FLAME_SPHERE_SPAWN_EFFECT = 55891, - SPELL_FLAME_SPHERE_VISUAL = 55928, - SPELL_FLAME_SPHERE_PERIODIC = 55926, - SPELL_FLAME_SPHERE_PERIODIC_H = 59508, - SPELL_FLAME_SPHERE_DEATH_EFFECT = 55947, - SPELL_BEAM_VISUAL = 60342, - SPELL_EMBRACE_OF_THE_VAMPYR = 55959, - SPELL_EMBRACE_OF_THE_VAMPYR_H = 59513, - SPELL_VANISH = 55964, - CREATURE_FLAME_SPHERE = 30106, - CREATURE_FLAME_SPHERE_1 = 31686, - CREATURE_FLAME_SPHERE_2 = 31687, + SPELL_BLOODTHIRST = 55968, //Trigger Spell + add aura + SPELL_CONJURE_FLAME_SPHERE = 55931, + SPELL_FLAME_SPHERE_SPAWN_EFFECT = 55891, + SPELL_FLAME_SPHERE_VISUAL = 55928, + SPELL_FLAME_SPHERE_PERIODIC = 55926, + SPELL_FLAME_SPHERE_PERIODIC_H = 59508, + SPELL_FLAME_SPHERE_DEATH_EFFECT = 55947, + SPELL_BEAM_VISUAL = 60342, + SPELL_EMBRACE_OF_THE_VAMPYR = 55959, + SPELL_EMBRACE_OF_THE_VAMPYR_H = 59513, + SPELL_VANISH = 55964, + CREATURE_FLAME_SPHERE = 30106, + CREATURE_FLAME_SPHERE_1 = 31686, + CREATURE_FLAME_SPHERE_2 = 31687, }; enum Misc { - DATA_EMBRACE_DMG = 20000, - DATA_EMBRACE_DMG_H = 40000, - DATA_SPHERE_DISTANCE = 30, - ACTION_FREE = 1, - ACTION_SPHERE = 2, + DATA_EMBRACE_DMG = 20000, + DATA_EMBRACE_DMG_H = 40000, + DATA_SPHERE_DISTANCE = 30, + ACTION_FREE = 1, + ACTION_SPHERE = 2, }; enum Event { - EVENT_PRINCE_FLAME_SPHERES = 1, - EVENT_PRINCE_VANISH = 2, - EVENT_PRINCE_BLOODTHIRST = 3, - EVENT_PRINCE_VANISH_RUN = 4, - EVENT_PRINCE_RESCHEDULE = 5, + EVENT_PRINCE_FLAME_SPHERES = 1, + EVENT_PRINCE_VANISH = 2, + EVENT_PRINCE_BLOODTHIRST = 3, + EVENT_PRINCE_VANISH_RUN = 4, + EVENT_PRINCE_RESCHEDULE = 5, }; #define DATA_GROUND_POSITION_Z 11.4f @@ -68,116 +68,116 @@ public: } InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint64 vanishTarget; - uint32 vanishDamage; + EventMap events; + SummonList summons; + uint64 vanishTarget; + uint32 vanishDamage; void Reset() { - if (me->GetPositionZ() > 15.0f) - me->CastSpell(me, SPELL_BEAM_VISUAL, true); + if (me->GetPositionZ() > 15.0f) + me->CastSpell(me, SPELL_BEAM_VISUAL, true); - events.Reset(); - summons.DespawnAll(); - vanishDamage = 0; + events.Reset(); + summons.DespawnAll(); + vanishDamage = 0; vanishTarget = 0; - if (pInstance) - { + if (pInstance) + { pInstance->SetData(DATA_PRINCE_TALDARAM_EVENT, NOT_STARTED); - // Event not started - if (pInstance->GetData(DATA_SPHERE_EVENT) == DONE) - DoAction(ACTION_FREE); - } + // Event not started + if (pInstance->GetData(DATA_SPHERE_EVENT) == DONE) + DoAction(ACTION_FREE); + } } - void DoAction(int32 param) - { - if (param == ACTION_FREE) - { - me->RemoveAllAuras(); - me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + void DoAction(int32 param) + { + if (param == ACTION_FREE) + { + me->RemoveAllAuras(); + me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), DATA_GROUND_POSITION_Z, me->GetOrientation()); - me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), DATA_GROUND_POSITION_Z, me->GetOrientation(), true); + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), DATA_GROUND_POSITION_Z, me->GetOrientation()); + me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), DATA_GROUND_POSITION_Z, me->GetOrientation(), true); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_PRINCE_TALDARAM_PLATFORM), true); - } - } + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_PRINCE_TALDARAM_PLATFORM), true); + } + } void EnterCombat(Unit* /*who*/) { if (pInstance) pInstance->SetData(DATA_PRINCE_TALDARAM_EVENT, IN_PROGRESS); - Talk(SAY_AGGRO); - ScheduleEvents(); + Talk(SAY_AGGRO); + ScheduleEvents(); - me->RemoveAllAuras(); - me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->InterruptNonMeleeSpells(true); } - void ScheduleEvents() - { - events.Reset(); - events.ScheduleEvent(EVENT_PRINCE_FLAME_SPHERES, 10000); - events.ScheduleEvent(EVENT_PRINCE_BLOODTHIRST, 10000); - vanishTarget = 0; - vanishDamage = 0; - } + void ScheduleEvents() + { + events.Reset(); + events.ScheduleEvent(EVENT_PRINCE_FLAME_SPHERES, 10000); + events.ScheduleEvent(EVENT_PRINCE_BLOODTHIRST, 10000); + vanishTarget = 0; + vanishDamage = 0; + } - void SpellHitTarget(Unit *, const SpellInfo *spellInfo) - { - if (spellInfo->Id == SPELL_CONJURE_FLAME_SPHERE) - summons.DoAction(ACTION_SPHERE); - } + void SpellHitTarget(Unit *, const SpellInfo *spellInfo) + { + if (spellInfo->Id == SPELL_CONJURE_FLAME_SPHERE) + summons.DoAction(ACTION_SPHERE); + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_PRINCE_BLOODTHIRST: - { - me->CastSpell(me->GetVictim(), SPELL_BLOODTHIRST, false); - events.RepeatEvent(10000); - break; - } - case EVENT_PRINCE_FLAME_SPHERES: - { - me->CastSpell(me->GetVictim(), SPELL_CONJURE_FLAME_SPHERE, false); - events.RescheduleEvent(EVENT_PRINCE_VANISH, 14000); - Creature *cr; - if (cr = me->SummonCreature(CREATURE_FLAME_SPHERE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+5.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS)) - summons.Summon(cr); + switch (events.GetEvent()) + { + case EVENT_PRINCE_BLOODTHIRST: + { + me->CastSpell(me->GetVictim(), SPELL_BLOODTHIRST, false); + events.RepeatEvent(10000); + break; + } + case EVENT_PRINCE_FLAME_SPHERES: + { + me->CastSpell(me->GetVictim(), SPELL_CONJURE_FLAME_SPHERE, false); + events.RescheduleEvent(EVENT_PRINCE_VANISH, 14000); + Creature *cr; + if (cr = me->SummonCreature(CREATURE_FLAME_SPHERE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+5.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS)) + summons.Summon(cr); - if (me->GetMap()->IsHeroic()) - { - if (cr = me->SummonCreature(CREATURE_FLAME_SPHERE_1, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+5.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS)) - summons.Summon(cr); + if (me->GetMap()->IsHeroic()) + { + if (cr = me->SummonCreature(CREATURE_FLAME_SPHERE_1, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+5.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS)) + summons.Summon(cr); - if (cr = me->SummonCreature(CREATURE_FLAME_SPHERE_2, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+5.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS)) - summons.Summon(cr); - } - events.RepeatEvent(15000); - break; - } - case EVENT_PRINCE_VANISH: - { - events.PopEvent(); - //Count alive players - uint8 count = 0; - Unit *pTarget; + if (cr = me->SummonCreature(CREATURE_FLAME_SPHERE_2, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+5.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS)) + summons.Summon(cr); + } + events.RepeatEvent(15000); + break; + } + case EVENT_PRINCE_VANISH: + { + events.PopEvent(); + //Count alive players + uint8 count = 0; + Unit *pTarget; std::list t_list = me->getThreatManager().getThreatList(); for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { @@ -191,55 +191,55 @@ public: Talk(SAY_VANISH); me->CastSpell(me, SPELL_VANISH, false); - events.CancelEvent(EVENT_PRINCE_FLAME_SPHERES); - events.CancelEvent(EVENT_PRINCE_BLOODTHIRST); + events.CancelEvent(EVENT_PRINCE_FLAME_SPHERES); + events.CancelEvent(EVENT_PRINCE_BLOODTHIRST); events.ScheduleEvent(EVENT_PRINCE_VANISH_RUN, 2499); if (Unit* pEmbraceTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) vanishTarget = pEmbraceTarget->GetGUID(); } - break; - } - case EVENT_PRINCE_VANISH_RUN: - { - if (Unit *vT = ObjectAccessor::GetUnit(*me, vanishTarget)) - { - me->UpdatePosition(vT->GetPositionX(), vT->GetPositionY(), vT->GetPositionZ(), me->GetAngle(vT), true); - me->CastSpell(vT, SPELL_EMBRACE_OF_THE_VAMPYR, false); - me->RemoveAura(SPELL_VANISH); - } + break; + } + case EVENT_PRINCE_VANISH_RUN: + { + if (Unit *vT = ObjectAccessor::GetUnit(*me, vanishTarget)) + { + me->UpdatePosition(vT->GetPositionX(), vT->GetPositionY(), vT->GetPositionZ(), me->GetAngle(vT), true); + me->CastSpell(vT, SPELL_EMBRACE_OF_THE_VAMPYR, false); + me->RemoveAura(SPELL_VANISH); + } - events.PopEvent(); - events.ScheduleEvent(EVENT_PRINCE_RESCHEDULE, 20000); - break; - } - case EVENT_PRINCE_RESCHEDULE: - { - events.PopEvent(); - ScheduleEvents(); - break; - } - } + events.PopEvent(); + events.ScheduleEvent(EVENT_PRINCE_RESCHEDULE, 20000); + break; + } + case EVENT_PRINCE_RESCHEDULE: + { + events.PopEvent(); + ScheduleEvents(); + break; + } + } - if (me->IsVisible()) - DoMeleeAttackIfReady(); + if (me->IsVisible()) + DoMeleeAttackIfReady(); } void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) { if (vanishTarget) { - vanishDamage += damage; - if (vanishDamage > (uint32) DUNGEON_MODE(DATA_EMBRACE_DMG, DATA_EMBRACE_DMG_H)) - { - ScheduleEvents(); - me->CastStop(); - } - } + vanishDamage += damage; + if (vanishDamage > (uint32) DUNGEON_MODE(DATA_EMBRACE_DMG, DATA_EMBRACE_DMG_H)) + { + ScheduleEvents(); + me->CastStop(); + } + } } void JustDied(Unit* /*killer*/) { - summons.DespawnAll(); + summons.DespawnAll(); Talk(SAY_DEATH); if (pInstance) @@ -248,13 +248,13 @@ public: void KilledUnit(Unit * victim) { - if (urand(0,1)) - return; + if (urand(0,1)) + return; - if (vanishTarget && victim->GetGUID() == vanishTarget) - ScheduleEvents(); + if (vanishTarget && victim->GetGUID() == vanishTarget) + ScheduleEvents(); - Talk(SAY_SLAY); + Talk(SAY_SLAY); } }; @@ -277,29 +277,29 @@ public: uint32 uiDespawnTimer; - void DoAction(int32 param) - { - if (param == ACTION_SPHERE) - { - me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_FLAME_SPHERE_PERIODIC_H : SPELL_FLAME_SPHERE_PERIODIC, true); + void DoAction(int32 param) + { + if (param == ACTION_SPHERE) + { + me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_FLAME_SPHERE_PERIODIC_H : SPELL_FLAME_SPHERE_PERIODIC, true); - float angle = rand_norm()*2*M_PI; - float x = me->GetPositionX() + DATA_SPHERE_DISTANCE * cos(angle); - float y = me->GetPositionY() + DATA_SPHERE_DISTANCE * sin(angle); - me->GetMotionMaster()->MovePoint(0, x, y, me->GetPositionZ()); - } - } + float angle = rand_norm()*2*M_PI; + float x = me->GetPositionX() + DATA_SPHERE_DISTANCE * cos(angle); + float y = me->GetPositionY() + DATA_SPHERE_DISTANCE * sin(angle); + me->GetMotionMaster()->MovePoint(0, x, y, me->GetPositionZ()); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (id == 0) - me->DisappearAndDie(); - } + void MovementInform(uint32 type, uint32 id) + { + if (id == 0) + me->DisappearAndDie(); + } void Reset() { - me->CastSpell(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT, true); - me->CastSpell(me, SPELL_FLAME_SPHERE_VISUAL, true); + me->CastSpell(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT, true); + me->CastSpell(me, SPELL_FLAME_SPHERE_VISUAL, true); uiDespawnTimer = 13*IN_MILLISECONDS; } @@ -308,7 +308,7 @@ public: void JustDied(Unit* /*who*/) { - me->CastSpell(me, SPELL_FLAME_SPHERE_DEATH_EFFECT, true); + me->CastSpell(me, SPELL_FLAME_SPHERE_DEATH_EFFECT, true); } void UpdateAI(uint32 diff) @@ -334,8 +334,8 @@ public: bool OnGossipHello(Player * /*pPlayer*/, GameObject *pGO) { InstanceScript *pInstance = pGO->GetInstanceScript(); - if (!pInstance) - return false; + if (!pInstance) + return false; Creature *pPrinceTaldaram = ObjectAccessor::GetCreature(*pGO, pInstance->GetData64(DATA_PRINCE_TALDARAM)); if (pPrinceTaldaram && pPrinceTaldaram->IsAlive()) @@ -343,14 +343,14 @@ public: pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); pGO->SetGoState(GO_STATE_ACTIVE); - if (pInstance->GetData(DATA_SPHERE_EVENT) == NOT_STARTED) - { - pInstance->SetData(DATA_SPHERE_EVENT, DONE); - return true; - } + if (pInstance->GetData(DATA_SPHERE_EVENT) == NOT_STARTED) + { + pInstance->SetData(DATA_SPHERE_EVENT, DONE); + return true; + } pPrinceTaldaram->AI()->DoAction(ACTION_FREE); - } + } return true; } diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/def_ahnkahet.h b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/def_ahnkahet.h index 0d933a62f..7c4a55124 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/def_ahnkahet.h +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/def_ahnkahet.h @@ -19,22 +19,22 @@ #ifndef DEF_AHNKAHET_H #define DEF_AHNKAHET_H -#define DATA_ELDER_NADOX 1 -#define DATA_PRINCE_TALDARAM 2 -#define DATA_JEDOGA_SHADOWSEEKER 3 -#define DATA_HERALD_VOLAZJ 4 -#define DATA_AMANITAR 5 +#define DATA_ELDER_NADOX 1 +#define DATA_PRINCE_TALDARAM 2 +#define DATA_JEDOGA_SHADOWSEEKER 3 +#define DATA_HERALD_VOLAZJ 4 +#define DATA_AMANITAR 5 -#define DATA_ELDER_NADOX_EVENT 6 -#define DATA_PRINCE_TALDARAM_EVENT 7 +#define DATA_ELDER_NADOX_EVENT 6 +#define DATA_PRINCE_TALDARAM_EVENT 7 #define DATA_JEDOGA_SHADOWSEEKER_EVENT 8 -#define DATA_HERALD_VOLAZJ_EVENT 9 -#define DATA_AMANITAR_EVENT 10 +#define DATA_HERALD_VOLAZJ_EVENT 9 +#define DATA_AMANITAR_EVENT 10 -#define DATA_SPHERE1 11 -#define DATA_SPHERE2 12 -#define DATA_SPHERE1_EVENT 13 -#define DATA_SPHERE2_EVENT 14 +#define DATA_SPHERE1 11 +#define DATA_SPHERE2 12 +#define DATA_SPHERE1_EVENT 13 +#define DATA_SPHERE2_EVENT 14 #define DATA_PRINCE_TALDARAM_PLATFORM 15 #endif diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp index ff94d6c73..93137958b 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp @@ -27,8 +27,8 @@ public: uint32 m_auiEncounter[MAX_ENCOUNTER]; uint32 spheres; - bool nadoxAchievement; - bool jedogaAchievement; + bool nadoxAchievement; + bool jedogaAchievement; void Initialize() { @@ -40,12 +40,12 @@ public: Herald_Volazj = 0; Amanitar = 0; - Prince_TaldaramPlatform = 0; - Prince_TaldaramGate = 0; + Prince_TaldaramPlatform = 0; + Prince_TaldaramGate = 0; spheres = NOT_STARTED; - nadoxAchievement = false; - jedogaAchievement = false; + nadoxAchievement = false; + jedogaAchievement = false; } bool IsEncounterInProgress() const @@ -61,20 +61,20 @@ public: switch(pCreature->GetEntry()) { case NPC_ELDER_NADOX: - Elder_Nadox = pCreature->GetGUID(); - break; + Elder_Nadox = pCreature->GetGUID(); + break; case NPC_PRINCE_TALDARAM: - Prince_Taldaram = pCreature->GetGUID(); - break; + Prince_Taldaram = pCreature->GetGUID(); + break; case NPC_JEDOGA_SHADOWSEEKER: - Jedoga_Shadowseeker = pCreature->GetGUID(); - break; + Jedoga_Shadowseeker = pCreature->GetGUID(); + break; case NPC_HERALD_JOLAZJ: - Herald_Volazj = pCreature->GetGUID(); - break; + Herald_Volazj = pCreature->GetGUID(); + break; case NPC_AMANITAR: - Amanitar = pCreature->GetGUID(); - break; + Amanitar = pCreature->GetGUID(); + break; } } @@ -83,11 +83,11 @@ public: switch(pGo->GetEntry()) { case 193564: - Prince_TaldaramPlatform = pGo->GetGUID(); + Prince_TaldaramPlatform = pGo->GetGUID(); if (m_auiEncounter[1] == DONE) - HandleGameObject(0,true,pGo); - - break; + HandleGameObject(0,true,pGo); + + break; case 193093: if (spheres == DONE) { @@ -95,9 +95,9 @@ public: pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } else - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; + break; case 193094: if (spheres == DONE) { @@ -105,15 +105,15 @@ public: pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } else - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; + break; case 192236: - Prince_TaldaramGate = pGo->GetGUID(); // Web gate past Prince Taldaram + Prince_TaldaramGate = pGo->GetGUID(); // Web gate past Prince Taldaram if (m_auiEncounter[1] == DONE) - HandleGameObject(0,true,pGo); - - break; + HandleGameObject(0,true,pGo); + + break; } } @@ -132,43 +132,43 @@ public: return 0; } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case 7317: // Respect Your Elders (2038) - return nadoxAchievement; - case 7359: // Volunteer Work (2056) - return jedogaAchievement; - } - return false; - } + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case 7317: // Respect Your Elders (2038) + return nadoxAchievement; + case 7359: // Volunteer Work (2056) + return jedogaAchievement; + } + return false; + } void SetData(uint32 type, uint32 data) { switch(type) { - case DATA_HERALD_VOLAZJ_EVENT: + case DATA_HERALD_VOLAZJ_EVENT: case DATA_AMANITAR_EVENT: case DATA_ELDER_NADOX_EVENT: - case DATA_JEDOGA_SHADOWSEEKER_EVENT: - m_auiEncounter[type] = data; - break; + case DATA_JEDOGA_SHADOWSEEKER_EVENT: + m_auiEncounter[type] = data; + break; case DATA_PRINCE_TALDARAM_EVENT: if (data == DONE) HandleGameObject(Prince_TaldaramGate, true); - m_auiEncounter[type] = data; + m_auiEncounter[type] = data; break; case DATA_SPHERE_EVENT: - spheres = data; - break; - case DATA_NADOX_ACHIEVEMENT: - nadoxAchievement = (bool)data; - return; - case DATA_JEDOGA_ACHIEVEMENT: - jedogaAchievement = (bool)data; - return; + spheres = data; + break; + case DATA_NADOX_ACHIEVEMENT: + nadoxAchievement = (bool)data; + return; + case DATA_JEDOGA_ACHIEVEMENT: + jedogaAchievement = (bool)data; + return; } if (data == DONE) @@ -181,13 +181,13 @@ public: { case DATA_ELDER_NADOX_EVENT: case DATA_PRINCE_TALDARAM_EVENT: - case DATA_JEDOGA_SHADOWSEEKER_EVENT: + case DATA_JEDOGA_SHADOWSEEKER_EVENT: case DATA_HERALD_VOLAZJ: case DATA_AMANITAR_EVENT: - return m_auiEncounter[type]; + return m_auiEncounter[type]; case DATA_SPHERE_EVENT: - return spheres; + return spheres; } return 0; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 42aae4cf0..644cb882f 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -10,168 +10,168 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Says { - // SARTHARION - SAY_SARTHARION_AGGRO = 0, - SAY_SARTHARION_BERSERK = 1, - SAY_SARTHARION_BREATH = 2, - SAY_SARTHARION_CALL_SHADRON = 3, - SAY_SARTHARION_CALL_TENEBRON = 4, - SAY_SARTHARION_CALL_VESPERON = 5, - SAY_SARTHARION_DEATH = 6, - SAY_SARTHARION_SPECIAL = 7, - SAY_SARTHARION_SLAY = 8, - SAY_SARTHARION_SPECIAL_4 = 10, // 9 is whisper + // SARTHARION + SAY_SARTHARION_AGGRO = 0, + SAY_SARTHARION_BERSERK = 1, + SAY_SARTHARION_BREATH = 2, + SAY_SARTHARION_CALL_SHADRON = 3, + SAY_SARTHARION_CALL_TENEBRON = 4, + SAY_SARTHARION_CALL_VESPERON = 5, + SAY_SARTHARION_DEATH = 6, + SAY_SARTHARION_SPECIAL = 7, + SAY_SARTHARION_SLAY = 8, + SAY_SARTHARION_SPECIAL_4 = 10, // 9 is whisper - // TENEBRON - SAY_TENEBRON_AGGRO = 0, - SAY_TENEBRON_SLAY = 1, - SAY_TENEBRON_DEATH = 2, - SAY_TENEBRON_BREATH = 3, - SAY_TENEBRON_RESPOND = 4, - SAY_TENEBRON_SPECIAL = 5, + // TENEBRON + SAY_TENEBRON_AGGRO = 0, + SAY_TENEBRON_SLAY = 1, + SAY_TENEBRON_DEATH = 2, + SAY_TENEBRON_BREATH = 3, + SAY_TENEBRON_RESPOND = 4, + SAY_TENEBRON_SPECIAL = 5, - // SHADRON - SAY_SHADRON_AGGRO = 0, - SAY_SHADRON_SLAY = 1, - SAY_SHADRON_DEATH = 2, - SAY_SHADRON_BREATH = 3, - SAY_SHADRON_RESPOND = 4, - SAY_SHADRON_SPECIAL = 5, + // SHADRON + SAY_SHADRON_AGGRO = 0, + SAY_SHADRON_SLAY = 1, + SAY_SHADRON_DEATH = 2, + SAY_SHADRON_BREATH = 3, + SAY_SHADRON_RESPOND = 4, + SAY_SHADRON_SPECIAL = 5, - // VESPERON - SAY_VESPERON_AGGRO = 0, - SAY_VESPERON_SLAY = 1, - SAY_VESPERON_DEATH = 2, - SAY_VESPERON_BREATH = 3, - SAY_VESPERON_RESPOND = 4, - SAY_VESPERON_SPECIAL = 5, + // VESPERON + SAY_VESPERON_AGGRO = 0, + SAY_VESPERON_SLAY = 1, + SAY_VESPERON_DEATH = 2, + SAY_VESPERON_BREATH = 3, + SAY_VESPERON_RESPOND = 4, + SAY_VESPERON_SPECIAL = 5, - // MISC - WHISPER_LAVA_CHURN = 9, - WHISPER_OPEN_PORTAL = 6, - WHISPER_HATCH_EGGS = 6, - WHISPER_SUMMON_DICIPLE = 7, + // MISC + WHISPER_LAVA_CHURN = 9, + WHISPER_OPEN_PORTAL = 6, + WHISPER_HATCH_EGGS = 6, + WHISPER_SUMMON_DICIPLE = 7, }; // Uses spelldifficulty_dbc enum Spells { - // Mini-boss shared - SPELL_SHADOW_BREATH = 57570, - SPELL_SHADOW_FISSURE = 57579, - SPELL_SUMMON_TWILIGHT_WHELP = 58035, - SPELL_GIFT_OF_TWILIGHT_SHADOW = 57835, - SPELL_TWILIGHT_TORMENT_VESPERON = 57935, + // Mini-boss shared + SPELL_SHADOW_BREATH = 57570, + SPELL_SHADOW_FISSURE = 57579, + SPELL_SUMMON_TWILIGHT_WHELP = 58035, + SPELL_GIFT_OF_TWILIGHT_SHADOW = 57835, + SPELL_TWILIGHT_TORMENT_VESPERON = 57935, - // Sartharion - SPELL_SARTHARION_CLEAVE = 56909, - SPELL_SARTHARION_FLAME_BREATH = 56908, - SPELL_SARTHARION_TAIL_LASH = 56910, - SPELL_CYCLONE_AURA_PERIODIC = 57598, - SPELL_LAVA_STRIKE_DUMMY_TRIGGER = 57697, - SPELL_LAVA_STRIKE_SUMMON = 57572, - SPELL_SARTHARION_PYROBUFFET = 56916, - SPELL_SARTHARION_BERSERK = 61632, - SPELL_SARTHARION_TWILIGHT_REVENGE = 60639, - - // Sartharion with drakes - SPELL_WILL_OF_SARTHARION = 61254, - SPELL_POWER_OF_TENEBRON = 61248, - SPELL_POWER_OF_VESPERON = 61251, - SPELL_POWER_OF_SHADRON = 58105, - SPELL_GIFT_OF_TWILIGHT_FIRE = 58766, + // Sartharion + SPELL_SARTHARION_CLEAVE = 56909, + SPELL_SARTHARION_FLAME_BREATH = 56908, + SPELL_SARTHARION_TAIL_LASH = 56910, + SPELL_CYCLONE_AURA_PERIODIC = 57598, + SPELL_LAVA_STRIKE_DUMMY_TRIGGER = 57697, + SPELL_LAVA_STRIKE_SUMMON = 57572, + SPELL_SARTHARION_PYROBUFFET = 56916, + SPELL_SARTHARION_BERSERK = 61632, + SPELL_SARTHARION_TWILIGHT_REVENGE = 60639, + + // Sartharion with drakes + SPELL_WILL_OF_SARTHARION = 61254, + SPELL_POWER_OF_TENEBRON = 61248, + SPELL_POWER_OF_VESPERON = 61251, + SPELL_POWER_OF_SHADRON = 58105, + SPELL_GIFT_OF_TWILIGHT_FIRE = 58766, - // Visuals - SPELL_EGG_MARKER_VISUAL = 58547, - SPELL_FLAME_TSUNAMI_VISUAL = 57494, + // Visuals + SPELL_EGG_MARKER_VISUAL = 58547, + SPELL_FLAME_TSUNAMI_VISUAL = 57494, - // Misc - SPELL_FADE_ARMOR = 60708, - SPELL_FLAME_TSUNAMI_DAMAGE_AURA = 57492, - SPELL_SARTHARION_PYROBUFFET_TRIGGER = 57557, + // Misc + SPELL_FADE_ARMOR = 60708, + SPELL_FLAME_TSUNAMI_DAMAGE_AURA = 57492, + SPELL_SARTHARION_PYROBUFFET_TRIGGER = 57557, }; enum NPCs { - NPC_TWILIGHT_EGG = 30882, - NPC_TWILIGHT_WHELP = 30890, - NPC_DISCIPLE_OF_SHADRON = 30688, - NPC_DISCIPLE_OF_VESPERON = 30858, - NPC_ACOLYTE_OF_SHADRON = 31218, - NPC_ACOLYTE_OF_VESPERON = 31219, + NPC_TWILIGHT_EGG = 30882, + NPC_TWILIGHT_WHELP = 30890, + NPC_DISCIPLE_OF_SHADRON = 30688, + NPC_DISCIPLE_OF_VESPERON = 30858, + NPC_ACOLYTE_OF_SHADRON = 31218, + NPC_ACOLYTE_OF_VESPERON = 31219, - // Sartharion fight - NPC_LAVA_BLAZE = 30643, - NPC_FLAME_TSUNAMI = 30616, - NPC_SAFE_AREA_TRIGGER = 30494, + // Sartharion fight + NPC_LAVA_BLAZE = 30643, + NPC_FLAME_TSUNAMI = 30616, + NPC_SAFE_AREA_TRIGGER = 30494, }; enum Misc { - ACTION_SWITCH_PHASE = 1, - ACTION_CALL_DRAGON = 2, - ACTION_DRAKE_DIED = 3, + ACTION_SWITCH_PHASE = 1, + ACTION_CALL_DRAGON = 2, + ACTION_DRAKE_DIED = 3, - DRAGON_TENEBRON = 0, - DRAGON_SHADRON = 1, - DRAGON_VESPERON = 2, + DRAGON_TENEBRON = 0, + DRAGON_SHADRON = 1, + DRAGON_VESPERON = 2, - POINT_FINAL_TENEBRON = 8, - POINT_FINAL_SHADRON = 4, - POINT_FINAL_VESPERON = 4, + POINT_FINAL_TENEBRON = 8, + POINT_FINAL_SHADRON = 4, + POINT_FINAL_VESPERON = 4, }; enum Events { - // Solo drake abilities - EVENT_MINIBOSS_SHADOW_FISSURE = 1, - EVENT_MINIBOSS_SHADOW_BREATH = 2, - EVENT_MINIBOSS_HATCH_EGGS = 3, - EVENT_MINIBOSS_OPEN_PORTAL = 4, - EVENT_MINIBOSS_SPAWN_HELPERS = 5, - EVENT_MINIBOSS_RESPOND = 6, + // Solo drake abilities + EVENT_MINIBOSS_SHADOW_FISSURE = 1, + EVENT_MINIBOSS_SHADOW_BREATH = 2, + EVENT_MINIBOSS_HATCH_EGGS = 3, + EVENT_MINIBOSS_OPEN_PORTAL = 4, + EVENT_MINIBOSS_SPAWN_HELPERS = 5, + EVENT_MINIBOSS_RESPOND = 6, - // Sartharion abilities - EVENT_SARTHARION_CAST_CLEAVE = 10, - EVENT_SARTHARION_CAST_FLAME_BREATH = 11, - EVENT_SARTHARION_CAST_TAIL_LASH = 12, - EVENT_SARTHARION_SUMMON_LAVA = 13, - EVENT_SARTHARION_START_LAVA = 14, - EVENT_SARTHARION_FINISH_LAVA = 15, - EVENT_SARTHARION_LAVA_STRIKE = 16, - EVENT_SARTHARION_HEALTH_CHECK = 17, - EVENT_SARTHARION_BERSERK = 18, - - // Drake abilities called by sartharion - EVENT_SARTHARION_CALL_TENEBRON = 30, - EVENT_SARTHARION_CALL_SHADRON = 31, - EVENT_SARTHARION_CALL_VESPERON = 32, + // Sartharion abilities + EVENT_SARTHARION_CAST_CLEAVE = 10, + EVENT_SARTHARION_CAST_FLAME_BREATH = 11, + EVENT_SARTHARION_CAST_TAIL_LASH = 12, + EVENT_SARTHARION_SUMMON_LAVA = 13, + EVENT_SARTHARION_START_LAVA = 14, + EVENT_SARTHARION_FINISH_LAVA = 15, + EVENT_SARTHARION_LAVA_STRIKE = 16, + EVENT_SARTHARION_HEALTH_CHECK = 17, + EVENT_SARTHARION_BERSERK = 18, + + // Drake abilities called by sartharion + EVENT_SARTHARION_CALL_TENEBRON = 30, + EVENT_SARTHARION_CALL_SHADRON = 31, + EVENT_SARTHARION_CALL_VESPERON = 32, }; const Position portalPos[4] = { - {3247.29f, 529.804f, 58.9595f}, - {3248.62f, 646.739f, 85.2939f}, - {3151.20f, 517.862f, 90.3389f}, - {3351.78f, 517.138f, 99.1620f}, + {3247.29f, 529.804f, 58.9595f}, + {3248.62f, 646.739f, 85.2939f}, + {3151.20f, 517.862f, 90.3389f}, + {3351.78f, 517.138f, 99.1620f}, }; const Position EggsPos[12] = { - // Tenebron - {3253.09f, 657.439f, 86.9921f, 3.16334f}, - {3247.76f, 662.413f, 87.7281f, 4.12938f}, - {3246.01f, 656.606f, 86.8737f, 4.12938f}, - {3246.7f, 649.558f, 85.8179f, 4.12938f}, - {3238.72f, 650.386f, 85.9625f, 0.897469f}, - {3257.89f, 651.323f, 85.9177f, 0.897469f}, - // Sartharion - {3237.24f, 524.20f, 58.95f, 0.0f}, - {3238.95f, 513.96f, 58.662f, 0.7f}, - {3245.66f, 519.685f, 58.78f, 0.7f}, - {3254.64f, 524.6f, 58.811f, 1.966f}, - {3258.9f, 534.41f, 58.811f, 2.08f}, - {3248.23f, 541.93f, 58.718f, 3.29f} + // Tenebron + {3253.09f, 657.439f, 86.9921f, 3.16334f}, + {3247.76f, 662.413f, 87.7281f, 4.12938f}, + {3246.01f, 656.606f, 86.8737f, 4.12938f}, + {3246.7f, 649.558f, 85.8179f, 4.12938f}, + {3238.72f, 650.386f, 85.9625f, 0.897469f}, + {3257.89f, 651.323f, 85.9177f, 0.897469f}, + // Sartharion + {3237.24f, 524.20f, 58.95f, 0.0f}, + {3238.95f, 513.96f, 58.662f, 0.7f}, + {3245.66f, 519.685f, 58.78f, 0.7f}, + {3254.64f, 524.6f, 58.811f, 1.966f}, + {3258.9f, 534.41f, 58.811f, 2.08f}, + {3248.23f, 541.93f, 58.718f, 3.29f} }; ///////////////////////////// @@ -188,368 +188,368 @@ public: return new boss_sartharionAI (pCreature); } - struct boss_sartharionAI : public ScriptedAI - { - boss_sartharionAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) - { - pInstance = me->GetInstanceScript(); - dragons[0] = dragons[1] = dragons[2] = 0; - } + struct boss_sartharionAI : public ScriptedAI + { + boss_sartharionAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) + { + pInstance = me->GetInstanceScript(); + dragons[0] = dragons[1] = dragons[2] = 0; + } - InstanceScript* pInstance; - SummonList summons; - EventMap events; - uint64 dragons[3]; - uint8 dragonsCount; - bool usedBerserk; - std::list volcanoBlows; + InstanceScript* pInstance; + SummonList summons; + EventMap events; + uint64 dragons[3]; + uint8 dragonsCount; + bool usedBerserk; + std::list volcanoBlows; - void HandleSartharionAbilities(); - void HandleDrakeAbilities(); + void HandleSartharionAbilities(); + void HandleDrakeAbilities(); - void SummonStartingTriggers() - { - me->SummonCreature(NPC_FIRE_CYCLONE, 3235.28f, 591.180f, 57.0833f, 0.59037f); - me->SummonCreature(NPC_FIRE_CYCLONE, 3200.97f, 480.929f, 57.0833f, 5.86197f); - me->SummonCreature(NPC_FIRE_CYCLONE, 3281.57f, 507.984f, 57.0833f, 5.54346f); - me->SummonCreature(NPC_FIRE_CYCLONE, 3210.11f, 531.957f, 57.0833f, 3.76777f); - me->SummonCreature(NPC_FIRE_CYCLONE, 3286.42f, 585.010f, 57.0833f, 4.10307f); - - me->SummonCreature(NPC_SAFE_AREA_TRIGGER, 3244.14f, 512.597f, 58.6534f, 0.0f); - me->SummonCreature(NPC_SAFE_AREA_TRIGGER, 3242.84f, 553.979f, 58.8272f, 0.0f); - } + void SummonStartingTriggers() + { + me->SummonCreature(NPC_FIRE_CYCLONE, 3235.28f, 591.180f, 57.0833f, 0.59037f); + me->SummonCreature(NPC_FIRE_CYCLONE, 3200.97f, 480.929f, 57.0833f, 5.86197f); + me->SummonCreature(NPC_FIRE_CYCLONE, 3281.57f, 507.984f, 57.0833f, 5.54346f); + me->SummonCreature(NPC_FIRE_CYCLONE, 3210.11f, 531.957f, 57.0833f, 3.76777f); + me->SummonCreature(NPC_FIRE_CYCLONE, 3286.42f, 585.010f, 57.0833f, 4.10307f); + + me->SummonCreature(NPC_SAFE_AREA_TRIGGER, 3244.14f, 512.597f, 58.6534f, 0.0f); + me->SummonCreature(NPC_SAFE_AREA_TRIGGER, 3242.84f, 553.979f, 58.8272f, 0.0f); + } - void SummonLavaWaves() - { - summons.RemoveNotExisting(); - Talk(WHISPER_LAVA_CHURN); - events.ScheduleEvent(EVENT_SARTHARION_START_LAVA, 2000); - events.ScheduleEvent(EVENT_SARTHARION_FINISH_LAVA, 9000); + void SummonLavaWaves() + { + summons.RemoveNotExisting(); + Talk(WHISPER_LAVA_CHURN); + events.ScheduleEvent(EVENT_SARTHARION_START_LAVA, 2000); + events.ScheduleEvent(EVENT_SARTHARION_FINISH_LAVA, 9000); - // Send wave from left - if (urand(0,1)) - { - for (uint8 i = 0; i < 3; ++i) - me->SummonCreature(NPC_FLAME_TSUNAMI, 3208.44f, 580.0f-(i*50.0f), 55.8f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 12000); - } - // from right - else - { - for (uint8 i = 0; i < 2; ++i) - me->SummonCreature(NPC_FLAME_TSUNAMI, 3283.44f, 555.0f-(i*50.0f), 55.8f, 3.14f, TEMPSUMMON_TIMED_DESPAWN, 12000); - } - } + // Send wave from left + if (urand(0,1)) + { + for (uint8 i = 0; i < 3; ++i) + me->SummonCreature(NPC_FLAME_TSUNAMI, 3208.44f, 580.0f-(i*50.0f), 55.8f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 12000); + } + // from right + else + { + for (uint8 i = 0; i < 2; ++i) + me->SummonCreature(NPC_FLAME_TSUNAMI, 3283.44f, 555.0f-(i*50.0f), 55.8f, 3.14f, TEMPSUMMON_TIMED_DESPAWN, 12000); + } + } - void SendLavaWaves(bool start) - { - Unit* cr = NULL; - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - { - cr = ObjectAccessor::GetUnit(*me, *itr); - if (!cr || cr->GetEntry() != NPC_FLAME_TSUNAMI) - continue; + void SendLavaWaves(bool start) + { + Unit* cr = NULL; + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + { + cr = ObjectAccessor::GetUnit(*me, *itr); + if (!cr || cr->GetEntry() != NPC_FLAME_TSUNAMI) + continue; - if (start) - cr->GetMotionMaster()->MovePoint(0, ((cr->GetPositionX() < 3250.0f) ? 3283.44f : 3208.44f), cr->GetPositionY(), cr->GetPositionZ()); - else - cr->SetObjectScale(0.1f); - } - } + if (start) + cr->GetMotionMaster()->MovePoint(0, ((cr->GetPositionX() < 3250.0f) ? 3283.44f : 3208.44f), cr->GetPositionY(), cr->GetPositionZ()); + else + cr->SetObjectScale(0.1f); + } + } - void StoreDragons() - { - if (pInstance) - { - Unit* cr = NULL; - for (uint8 i = 0; i < 3; ++i) - if (cr = ObjectAccessor::GetUnit(*me, pInstance->GetData64(DATA_TENEBRON+i))) - { - if (!cr->IsAlive()) - continue; + void StoreDragons() + { + if (pInstance) + { + Unit* cr = NULL; + for (uint8 i = 0; i < 3; ++i) + if (cr = ObjectAccessor::GetUnit(*me, pInstance->GetData64(DATA_TENEBRON+i))) + { + if (!cr->IsAlive()) + continue; - cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - dragons[i] = cr->GetGUID(); - dragonsCount++; - me->AddLootMode(1 << dragonsCount); + cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + dragons[i] = cr->GetGUID(); + dragonsCount++; + me->AddLootMode(1 << dragonsCount); - switch(DATA_TENEBRON+i) - { - case DATA_TENEBRON: - cr->CastSpell(cr, SPELL_POWER_OF_TENEBRON, true); - events.ScheduleEvent(EVENT_SARTHARION_CALL_TENEBRON, 10000); - break; - case DATA_SHADRON: - cr->CastSpell(cr, SPELL_POWER_OF_SHADRON, true); - events.ScheduleEvent(EVENT_SARTHARION_CALL_SHADRON, 65000); - break; - case DATA_VESPERON: - cr->CastSpell(cr, SPELL_POWER_OF_VESPERON, true); - events.ScheduleEvent(EVENT_SARTHARION_CALL_VESPERON, 115000); - break; - } - } + switch(DATA_TENEBRON+i) + { + case DATA_TENEBRON: + cr->CastSpell(cr, SPELL_POWER_OF_TENEBRON, true); + events.ScheduleEvent(EVENT_SARTHARION_CALL_TENEBRON, 10000); + break; + case DATA_SHADRON: + cr->CastSpell(cr, SPELL_POWER_OF_SHADRON, true); + events.ScheduleEvent(EVENT_SARTHARION_CALL_SHADRON, 65000); + break; + case DATA_VESPERON: + cr->CastSpell(cr, SPELL_POWER_OF_VESPERON, true); + events.ScheduleEvent(EVENT_SARTHARION_CALL_VESPERON, 115000); + break; + } + } - if (dragonsCount) - me->CastSpell(me, SPELL_WILL_OF_SARTHARION, true); - } - } + if (dragonsCount) + me->CastSpell(me, SPELL_WILL_OF_SARTHARION, true); + } + } - void RespawnDragons(bool combat) - { - if (pInstance) - { - Creature* cr = NULL; - for (uint8 i = 0; i < 3; ++i) - if (dragons[i]) - if (cr = ObjectAccessor::GetCreature(*me, dragons[i])) - { - if (combat && cr->IsInCombat()) - continue; + void RespawnDragons(bool combat) + { + if (pInstance) + { + Creature* cr = NULL; + for (uint8 i = 0; i < 3; ++i) + if (dragons[i]) + if (cr = ObjectAccessor::GetCreature(*me, dragons[i])) + { + if (combat && cr->IsInCombat()) + continue; - cr->DespawnOrUnsummon(); - cr->SetRespawnTime(10); - } + cr->DespawnOrUnsummon(); + cr->SetRespawnTime(10); + } - dragons[0] = dragons[1] = dragons[2] = 0; - dragonsCount = 0; - } - } + dragons[0] = dragons[1] = dragons[2] = 0; + dragonsCount = 0; + } + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - me->ResetLootMode(); - RespawnDragons(false); - SummonStartingTriggers(); - usedBerserk = false; - volcanoBlows.clear(); + void Reset() + { + events.Reset(); + summons.DespawnAll(); + me->ResetLootMode(); + RespawnDragons(false); + SummonStartingTriggers(); + usedBerserk = false; + volcanoBlows.clear(); - if (pInstance) - { - pInstance->SetData(BOSS_SARTHARION_EVENT, NOT_STARTED); - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); - } - } + if (pInstance) + { + pInstance->SetData(BOSS_SARTHARION_EVENT, NOT_STARTED); + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); + } + } - void DoAction(int32 param) - { - if (param == ACTION_DRAKE_DIED) - me->CastSpell(me, SPELL_SARTHARION_TWILIGHT_REVENGE, true); - } + void DoAction(int32 param) + { + if (param == ACTION_DRAKE_DIED) + me->CastSpell(me, SPELL_SARTHARION_TWILIGHT_REVENGE, true); + } - void EnterCombat(Unit* pWho) - { - me->CastSpell(me, SPELL_SARTHARION_PYROBUFFET, true); - me->SetInCombatWithZone(); - Talk(SAY_SARTHARION_AGGRO); - if (pInstance) - pInstance->SetData(BOSS_SARTHARION_EVENT, IN_PROGRESS); + void EnterCombat(Unit* pWho) + { + me->CastSpell(me, SPELL_SARTHARION_PYROBUFFET, true); + me->SetInCombatWithZone(); + Talk(SAY_SARTHARION_AGGRO); + if (pInstance) + pInstance->SetData(BOSS_SARTHARION_EVENT, IN_PROGRESS); - events.ScheduleEvent(EVENT_SARTHARION_CAST_CLEAVE, 7000); - events.ScheduleEvent(EVENT_SARTHARION_CAST_FLAME_BREATH, 15000); - events.ScheduleEvent(EVENT_SARTHARION_CAST_TAIL_LASH, 11000); - events.ScheduleEvent(EVENT_SARTHARION_SUMMON_LAVA, 20000); - events.ScheduleEvent(EVENT_SARTHARION_LAVA_STRIKE, 5000); - events.ScheduleEvent(EVENT_SARTHARION_HEALTH_CHECK, 10000); - events.ScheduleEvent(EVENT_SARTHARION_BERSERK, 900000); + events.ScheduleEvent(EVENT_SARTHARION_CAST_CLEAVE, 7000); + events.ScheduleEvent(EVENT_SARTHARION_CAST_FLAME_BREATH, 15000); + events.ScheduleEvent(EVENT_SARTHARION_CAST_TAIL_LASH, 11000); + events.ScheduleEvent(EVENT_SARTHARION_SUMMON_LAVA, 20000); + events.ScheduleEvent(EVENT_SARTHARION_LAVA_STRIKE, 5000); + events.ScheduleEvent(EVENT_SARTHARION_HEALTH_CHECK, 10000); + events.ScheduleEvent(EVENT_SARTHARION_BERSERK, 900000); - StoreDragons(); - me->CallForHelp(500.0f); - } + StoreDragons(); + me->CallForHelp(500.0f); + } - void JustDied(Unit* pKiller) - { - RespawnDragons(true); - summons.DespawnEntry(NPC_FLAME_TSUNAMI); - Talk(SAY_SARTHARION_DEATH); + void JustDied(Unit* pKiller) + { + RespawnDragons(true); + summons.DespawnEntry(NPC_FLAME_TSUNAMI); + Talk(SAY_SARTHARION_DEATH); - if (pInstance) - pInstance->SetData(BOSS_SARTHARION_EVENT, DONE); - } + if (pInstance) + pInstance->SetData(BOSS_SARTHARION_EVENT, DONE); + } - void KilledUnit(Unit* pVictim) - { - if (!urand(0, 2) && pVictim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SARTHARION_SLAY); - } + void KilledUnit(Unit* pVictim) + { + if (!urand(0, 2) && pVictim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SARTHARION_SLAY); + } - void JustSummoned(Creature* cr) - { - if (cr->GetEntry() == NPC_FLAME_TSUNAMI) - cr->SetSpeed(MOVE_FLIGHT, 1.5f); - else if (cr->GetEntry() == NPC_FIRE_CYCLONE) - cr->GetMotionMaster()->MoveRandom(5.0f); + void JustSummoned(Creature* cr) + { + if (cr->GetEntry() == NPC_FLAME_TSUNAMI) + cr->SetSpeed(MOVE_FLIGHT, 1.5f); + else if (cr->GetEntry() == NPC_FIRE_CYCLONE) + cr->GetMotionMaster()->MoveRandom(5.0f); - summons.Summon(cr); - } + summons.Summon(cr); + } - void SetData(uint32 type, uint32 data) - { - if (type != DATA_VOLCANO_BLOWS) - return; + void SetData(uint32 type, uint32 data) + { + if (type != DATA_VOLCANO_BLOWS) + return; - if (!volcanoBlows.empty()) - for (std::list::const_iterator itr = volcanoBlows.begin(); itr != volcanoBlows.end(); ++itr) - if (data == (*itr)) - return; + if (!volcanoBlows.empty()) + for (std::list::const_iterator itr = volcanoBlows.begin(); itr != volcanoBlows.end(); ++itr) + if (data == (*itr)) + return; - volcanoBlows.push_back(data); - } + volcanoBlows.push_back(data); + } - uint32 GetData(uint32 dataOrGuid) const - { - // it means we want dragons count - if (dataOrGuid == DATA_ACHIEVEMENT_DRAGONS_COUNT) - return dragonsCount; + uint32 GetData(uint32 dataOrGuid) const + { + // it means we want dragons count + if (dataOrGuid == DATA_ACHIEVEMENT_DRAGONS_COUNT) + return dragonsCount; - // otherwise it is guid to check if player was hit by lava strike :) - if (!volcanoBlows.empty()) - for (std::list::const_iterator itr = volcanoBlows.begin(); itr != volcanoBlows.end(); ++itr) - if (dataOrGuid == (*itr)) - return true; + // otherwise it is guid to check if player was hit by lava strike :) + if (!volcanoBlows.empty()) + for (std::list::const_iterator itr = volcanoBlows.begin(); itr != volcanoBlows.end(); ++itr) + if (dataOrGuid == (*itr)) + return true; - return false; - } + return false; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - // Special events which needs to be fired immidiately - switch(events.GetEvent()) - { - case EVENT_SARTHARION_SUMMON_LAVA: - if (!urand(0,3)) - Talk(SAY_SARTHARION_SPECIAL); + // Special events which needs to be fired immidiately + switch(events.GetEvent()) + { + case EVENT_SARTHARION_SUMMON_LAVA: + if (!urand(0,3)) + Talk(SAY_SARTHARION_SPECIAL); - SummonLavaWaves(); - events.RepeatEvent(25000); - return; - case EVENT_SARTHARION_START_LAVA: - SendLavaWaves(true); - events.PopEvent(); - return; - case EVENT_SARTHARION_FINISH_LAVA: - SendLavaWaves(false); - events.PopEvent(); - return; - } + SummonLavaWaves(); + events.RepeatEvent(25000); + return; + case EVENT_SARTHARION_START_LAVA: + SendLavaWaves(true); + events.PopEvent(); + return; + case EVENT_SARTHARION_FINISH_LAVA: + SendLavaWaves(false); + events.PopEvent(); + return; + } - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - HandleSartharionAbilities(); - HandleDrakeAbilities(); + HandleSartharionAbilities(); + HandleDrakeAbilities(); - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; void boss_sartharion::boss_sartharionAI::HandleSartharionAbilities() { - // Handling of Sartharion Events - switch (events.GetEvent()) - { - case EVENT_SARTHARION_CAST_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_SARTHARION_CLEAVE, false); - events.RepeatEvent(10000); - break; - case EVENT_SARTHARION_CAST_FLAME_BREATH: - me->CastSpell(me->GetVictim(), SPELL_SARTHARION_FLAME_BREATH, false); - events.RepeatEvent(20000); - break; - case EVENT_SARTHARION_CAST_TAIL_LASH: - me->CastSpell(me, SPELL_SARTHARION_TAIL_LASH, false); - events.RepeatEvent(18000); - break; - case EVENT_SARTHARION_LAVA_STRIKE: - { - if (!urand(0,2)) - Talk(SAY_SARTHARION_SPECIAL_4); + // Handling of Sartharion Events + switch (events.GetEvent()) + { + case EVENT_SARTHARION_CAST_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_SARTHARION_CLEAVE, false); + events.RepeatEvent(10000); + break; + case EVENT_SARTHARION_CAST_FLAME_BREATH: + me->CastSpell(me->GetVictim(), SPELL_SARTHARION_FLAME_BREATH, false); + events.RepeatEvent(20000); + break; + case EVENT_SARTHARION_CAST_TAIL_LASH: + me->CastSpell(me, SPELL_SARTHARION_TAIL_LASH, false); + events.RepeatEvent(18000); + break; + case EVENT_SARTHARION_LAVA_STRIKE: + { + if (!urand(0,2)) + Talk(SAY_SARTHARION_SPECIAL_4); - Creature* cr = NULL; - summons.RemoveNotExisting(); - uint8 rand = urand(0,4); // 5 - numer of cyclones - uint8 iter = 0; - for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) - { - if (cr = ObjectAccessor::GetCreature(*me, *i)) - if (cr->GetEntry() == NPC_FIRE_CYCLONE) - { - if (iter == rand) - { - cr->CastSpell(cr, SPELL_CYCLONE_AURA_PERIODIC, true); - break; - } - ++iter; - } - } + Creature* cr = NULL; + summons.RemoveNotExisting(); + uint8 rand = urand(0,4); // 5 - numer of cyclones + uint8 iter = 0; + for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) + { + if (cr = ObjectAccessor::GetCreature(*me, *i)) + if (cr->GetEntry() == NPC_FIRE_CYCLONE) + { + if (iter == rand) + { + cr->CastSpell(cr, SPELL_CYCLONE_AURA_PERIODIC, true); + break; + } + ++iter; + } + } - events.RepeatEvent(20000); - break; - } - case EVENT_SARTHARION_HEALTH_CHECK: - if (dragonsCount && !usedBerserk && me->HealthBelowPct(36)) - { - me->CastSpell(me, SPELL_SARTHARION_BERSERK, true); - usedBerserk = true; - events.RepeatEvent(2000); - break; - } + events.RepeatEvent(20000); + break; + } + case EVENT_SARTHARION_HEALTH_CHECK: + if (dragonsCount && !usedBerserk && me->HealthBelowPct(36)) + { + me->CastSpell(me, SPELL_SARTHARION_BERSERK, true); + usedBerserk = true; + events.RepeatEvent(2000); + break; + } - if (me->HealthBelowPct(11)) - { - Creature* cr = NULL; - summons.RemoveNotExisting(); - for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) - { - if (cr = ObjectAccessor::GetCreature(*me, *i)) - if (cr->GetEntry() == NPC_FIRE_CYCLONE) - cr->CastSpell(cr, SPELL_CYCLONE_AURA_PERIODIC, true); - } - Talk(SAY_SARTHARION_BERSERK); - events.PopEvent(); - break; - } - events.RepeatEvent(2000); - break; - case EVENT_SARTHARION_BERSERK: - summons.DespawnEntry(NPC_SAFE_AREA_TRIGGER); - events.PopEvent(); - break; - } + if (me->HealthBelowPct(11)) + { + Creature* cr = NULL; + summons.RemoveNotExisting(); + for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) + { + if (cr = ObjectAccessor::GetCreature(*me, *i)) + if (cr->GetEntry() == NPC_FIRE_CYCLONE) + cr->CastSpell(cr, SPELL_CYCLONE_AURA_PERIODIC, true); + } + Talk(SAY_SARTHARION_BERSERK); + events.PopEvent(); + break; + } + events.RepeatEvent(2000); + break; + case EVENT_SARTHARION_BERSERK: + summons.DespawnEntry(NPC_SAFE_AREA_TRIGGER); + events.PopEvent(); + break; + } } void boss_sartharion::boss_sartharionAI::HandleDrakeAbilities() { - // Handling of Drakes Events - switch (events.GetEvent()) - { - // Dragon Calls - case EVENT_SARTHARION_CALL_TENEBRON: - Talk(SAY_SARTHARION_CALL_TENEBRON); - if (Creature* tenebron = ObjectAccessor::GetCreature(*me, dragons[DRAGON_TENEBRON])) - tenebron->AI()->DoAction(ACTION_CALL_DRAGON); - events.PopEvent(); - break; - case EVENT_SARTHARION_CALL_SHADRON: - Talk(SAY_SARTHARION_CALL_SHADRON); - if (Creature* shadron = ObjectAccessor::GetCreature(*me, dragons[DRAGON_SHADRON])) - shadron->AI()->DoAction(ACTION_CALL_DRAGON); - events.PopEvent(); - break; - case EVENT_SARTHARION_CALL_VESPERON: - Talk(SAY_SARTHARION_CALL_VESPERON); - if (Creature* vesperon = ObjectAccessor::GetCreature(*me, dragons[DRAGON_VESPERON])) - vesperon->AI()->DoAction(ACTION_CALL_DRAGON); - events.PopEvent(); - break; - } + // Handling of Drakes Events + switch (events.GetEvent()) + { + // Dragon Calls + case EVENT_SARTHARION_CALL_TENEBRON: + Talk(SAY_SARTHARION_CALL_TENEBRON); + if (Creature* tenebron = ObjectAccessor::GetCreature(*me, dragons[DRAGON_TENEBRON])) + tenebron->AI()->DoAction(ACTION_CALL_DRAGON); + events.PopEvent(); + break; + case EVENT_SARTHARION_CALL_SHADRON: + Talk(SAY_SARTHARION_CALL_SHADRON); + if (Creature* shadron = ObjectAccessor::GetCreature(*me, dragons[DRAGON_SHADRON])) + shadron->AI()->DoAction(ACTION_CALL_DRAGON); + events.PopEvent(); + break; + case EVENT_SARTHARION_CALL_VESPERON: + Talk(SAY_SARTHARION_CALL_VESPERON); + if (Creature* vesperon = ObjectAccessor::GetCreature(*me, dragons[DRAGON_VESPERON])) + vesperon->AI()->DoAction(ACTION_CALL_DRAGON); + events.PopEvent(); + break; + } } ///////////////////////////// @@ -566,249 +566,249 @@ public: return new boss_sartharion_tenebronAI (pCreature); } - struct boss_sartharion_tenebronAI : public ScriptedAI - { - boss_sartharion_tenebronAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me), summons2(me) - { - portalGUID = 0; - pInstance = me->GetInstanceScript(); - } + struct boss_sartharion_tenebronAI : public ScriptedAI + { + boss_sartharion_tenebronAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me), summons2(me) + { + portalGUID = 0; + pInstance = me->GetInstanceScript(); + } - EventMap events; - SummonList summons; - SummonList summons2; - uint64 portalGUID; - InstanceScript* pInstance; - bool isSartharion; - uint32 timer; + EventMap events; + SummonList summons; + SummonList summons2; + uint64 portalGUID; + InstanceScript* pInstance; + bool isSartharion; + uint32 timer; - void ClearInstance() - { - events.Reset(); - summons.DespawnAll(); - // Remove phase shift - if (pInstance) - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); + void ClearInstance() + { + events.Reset(); + summons.DespawnAll(); + // Remove phase shift + if (pInstance) + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); - RemoveTwilightPortal(); - } + RemoveTwilightPortal(); + } - void RemoveTwilightPortal() - { - if (portalGUID) - if (GameObject* gobj = me->GetMap()->GetGameObject(portalGUID)) - gobj->Delete(); + void RemoveTwilightPortal() + { + if (portalGUID) + if (GameObject* gobj = me->GetMap()->GetGameObject(portalGUID)) + gobj->Delete(); - portalGUID = 0; - } + portalGUID = 0; + } - void DoAction(int32 param) - { - if (param == ACTION_CALL_DRAGON) - { - isSartharion = true; - timer++; - } - } + void DoAction(int32 param) + { + if (param == ACTION_CALL_DRAGON) + { + isSartharion = true; + timer++; + } + } - void MoveInLineOfSight(Unit* who) - { - if (isSartharion) - return; + void MoveInLineOfSight(Unit* who) + { + if (isSartharion) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void Reset() - { - summons2.DespawnAll(); - ClearInstance(); - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->SetDisableGravity(false); - me->SetSpeed(MOVE_FLIGHT, 1.0f); - me->SetCanFly(false); - me->ResetLootMode(); - isSartharion = false; - timer = 0; + void Reset() + { + summons2.DespawnAll(); + ClearInstance(); + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetDisableGravity(false); + me->SetSpeed(MOVE_FLIGHT, 1.0f); + me->SetCanFly(false); + me->ResetLootMode(); + isSartharion = false; + timer = 0; - if (pInstance) - { - pInstance->SetData(BOSS_TENEBRON_EVENT, NOT_STARTED); - pInstance->SetData(DATA_CLEAR_PORTAL, 0); - } - } + if (pInstance) + { + pInstance->SetData(BOSS_TENEBRON_EVENT, NOT_STARTED); + pInstance->SetData(DATA_CLEAR_PORTAL, 0); + } + } - void EnterCombat(Unit* ) - { - Talk(SAY_TENEBRON_AGGRO); - me->SetInCombatWithZone(); + void EnterCombat(Unit* ) + { + Talk(SAY_TENEBRON_AGGRO); + me->SetInCombatWithZone(); - if (me->IsFlying()) - { - me->SetSpeed(MOVE_FLIGHT, 1.0f); - me->SetCanFly(false); - } + if (me->IsFlying()) + { + me->SetSpeed(MOVE_FLIGHT, 1.0f); + me->SetCanFly(false); + } - events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_FISSURE, 20000); - events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_BREATH, 10000); - events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 15000); + events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_FISSURE, 20000); + events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_BREATH, 10000); + events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 15000); - if (pInstance && !isSartharion) - pInstance->SetData(BOSS_TENEBRON_EVENT, IN_PROGRESS); + if (pInstance && !isSartharion) + pInstance->SetData(BOSS_TENEBRON_EVENT, IN_PROGRESS); - if (isSartharion || (pInstance && pInstance->GetData(BOSS_SARTHARION_EVENT) == DONE)) - me->SetLootMode(0); - } + if (isSartharion || (pInstance && pInstance->GetData(BOSS_SARTHARION_EVENT) == DONE)) + me->SetLootMode(0); + } - void JustDied(Unit* ) - { - Talk(SAY_TENEBRON_DEATH); + void JustDied(Unit* ) + { + Talk(SAY_TENEBRON_DEATH); - if (!isSartharion) - { - ClearInstance(); - if (pInstance) - pInstance->SetData(BOSS_TENEBRON_EVENT, DONE); - } - else if (pInstance) - { - pInstance->SetData(DATA_CLEAR_PORTAL, 0); - if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_SARTHARION))) - cr->AI()->DoAction(ACTION_DRAKE_DIED); - } - } + if (!isSartharion) + { + ClearInstance(); + if (pInstance) + pInstance->SetData(BOSS_TENEBRON_EVENT, DONE); + } + else if (pInstance) + { + pInstance->SetData(DATA_CLEAR_PORTAL, 0); + if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_SARTHARION))) + cr->AI()->DoAction(ACTION_DRAKE_DIED); + } + } - void JustKilled(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER || urand(0,2)) - return; + void JustKilled(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER || urand(0,2)) + return; - Talk(SAY_TENEBRON_SLAY); - } + Talk(SAY_TENEBRON_SLAY); + } - void MovementInform(uint32 type, uint32 pointId) - { - if (type == WAYPOINT_MOTION_TYPE && pointId == POINT_FINAL_TENEBRON) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->SetInCombatWithZone(); - } - } + void MovementInform(uint32 type, uint32 pointId) + { + if (type == WAYPOINT_MOTION_TYPE && pointId == POINT_FINAL_TENEBRON) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetInCombatWithZone(); + } + } - void UpdateAI(uint32 diff) - { - // Call speach - if (timer) - { - timer += diff; - if (timer >= 4000) - { - Talk(SAY_TENEBRON_RESPOND); - me->SetCanFly(true); - me->SetSpeed(MOVE_FLIGHT, 3.0f); - me->GetMotionMaster()->MovePath(me->GetEntry()*10, false); - timer = 0; - } - } + void UpdateAI(uint32 diff) + { + // Call speach + if (timer) + { + timer += diff; + if (timer >= 4000) + { + Talk(SAY_TENEBRON_RESPOND); + me->SetCanFly(true); + me->SetSpeed(MOVE_FLIGHT, 3.0f); + me->GetMotionMaster()->MovePath(me->GetEntry()*10, false); + timer = 0; + } + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_MINIBOSS_SHADOW_BREATH: - if (!urand(0,10)) - Talk(SAY_TENEBRON_BREATH); - me->CastSpell(me->GetVictim(), SPELL_SHADOW_BREATH, false); - events.RepeatEvent(17500); - break; - case EVENT_MINIBOSS_SHADOW_FISSURE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(target, SPELL_SHADOW_FISSURE, false); - events.RepeatEvent(22500); - break; - case EVENT_MINIBOSS_OPEN_PORTAL: - Talk(WHISPER_OPEN_PORTAL); - Talk(SAY_TENEBRON_SPECIAL); - - if (!isSartharion) - { - if (GameObject* Portal = me->GetVictim()->SummonGameObject(GO_TWILIGHT_PORTAL, portalPos[BOSS_TENEBRON_EVENT].GetPositionX(), portalPos[BOSS_TENEBRON_EVENT].GetPositionY(), portalPos[BOSS_TENEBRON_EVENT].GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) - portalGUID = Portal->GetGUID(); - } - else if (pInstance) - pInstance->SetData(DATA_ADD_PORTAL, 0); + switch (events.GetEvent()) + { + case EVENT_MINIBOSS_SHADOW_BREATH: + if (!urand(0,10)) + Talk(SAY_TENEBRON_BREATH); + me->CastSpell(me->GetVictim(), SPELL_SHADOW_BREATH, false); + events.RepeatEvent(17500); + break; + case EVENT_MINIBOSS_SHADOW_FISSURE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(target, SPELL_SHADOW_FISSURE, false); + events.RepeatEvent(22500); + break; + case EVENT_MINIBOSS_OPEN_PORTAL: + Talk(WHISPER_OPEN_PORTAL); + Talk(SAY_TENEBRON_SPECIAL); + + if (!isSartharion) + { + if (GameObject* Portal = me->GetVictim()->SummonGameObject(GO_TWILIGHT_PORTAL, portalPos[BOSS_TENEBRON_EVENT].GetPositionX(), portalPos[BOSS_TENEBRON_EVENT].GetPositionY(), portalPos[BOSS_TENEBRON_EVENT].GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) + portalGUID = Portal->GetGUID(); + } + else if (pInstance) + pInstance->SetData(DATA_ADD_PORTAL, 0); - - events.ScheduleEvent(EVENT_MINIBOSS_SPAWN_HELPERS, 2000); - events.RepeatEvent(60000); - break; - case EVENT_MINIBOSS_SPAWN_HELPERS: - { - Talk(WHISPER_HATCH_EGGS); - Creature* cr = NULL; - for (uint8 i = 0; i < 6; ++i) - { - if (cr = me->SummonCreature(NPC_TWILIGHT_EGG, EggsPos[isSartharion ? i+6 : i].GetPositionX(), EggsPos[isSartharion ? i+6 : i].GetPositionY(), EggsPos[isSartharion ? i+6 : i].GetPositionZ(), EggsPos[isSartharion ? i+6 : i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000)) - { - summons.Summon(cr); - cr->SetPhaseMask(16, true); - } - if (cr = me->SummonCreature(NPC_TWILIGHT_WHELP, EggsPos[isSartharion ? i+6 : i].GetPositionX(), EggsPos[isSartharion ? i+6 : i].GetPositionY(), EggsPos[isSartharion ? i+6 : i].GetPositionZ(), EggsPos[isSartharion ? i+6 : i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000)) - { - summons.Summon(cr); - cr->SetPhaseMask(16, true); - } - } + + events.ScheduleEvent(EVENT_MINIBOSS_SPAWN_HELPERS, 2000); + events.RepeatEvent(60000); + break; + case EVENT_MINIBOSS_SPAWN_HELPERS: + { + Talk(WHISPER_HATCH_EGGS); + Creature* cr = NULL; + for (uint8 i = 0; i < 6; ++i) + { + if (cr = me->SummonCreature(NPC_TWILIGHT_EGG, EggsPos[isSartharion ? i+6 : i].GetPositionX(), EggsPos[isSartharion ? i+6 : i].GetPositionY(), EggsPos[isSartharion ? i+6 : i].GetPositionZ(), EggsPos[isSartharion ? i+6 : i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000)) + { + summons.Summon(cr); + cr->SetPhaseMask(16, true); + } + if (cr = me->SummonCreature(NPC_TWILIGHT_WHELP, EggsPos[isSartharion ? i+6 : i].GetPositionX(), EggsPos[isSartharion ? i+6 : i].GetPositionY(), EggsPos[isSartharion ? i+6 : i].GetPositionZ(), EggsPos[isSartharion ? i+6 : i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000)) + { + summons.Summon(cr); + cr->SetPhaseMask(16, true); + } + } - events.ScheduleEvent(EVENT_MINIBOSS_HATCH_EGGS, 25000); - events.PopEvent(); - break; - } - case EVENT_MINIBOSS_HATCH_EGGS: - { - Creature* cr = NULL; - summons.RemoveNotExisting(); - summons.DespawnEntry(NPC_TWILIGHT_WHELP); - for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) - { - if (cr = ObjectAccessor::GetCreature(*me, *i)) - { - if (!cr->IsAlive()) - continue; + events.ScheduleEvent(EVENT_MINIBOSS_HATCH_EGGS, 25000); + events.PopEvent(); + break; + } + case EVENT_MINIBOSS_HATCH_EGGS: + { + Creature* cr = NULL; + summons.RemoveNotExisting(); + summons.DespawnEntry(NPC_TWILIGHT_WHELP); + for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) + { + if (cr = ObjectAccessor::GetCreature(*me, *i)) + { + if (!cr->IsAlive()) + continue; - if (cr->GetEntry() == NPC_TWILIGHT_EGG) - if (cr = me->SummonCreature(NPC_TWILIGHT_WHELP, cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ(), cr->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000)) - summons2.Summon(cr); - } - } + if (cr->GetEntry() == NPC_TWILIGHT_EGG) + if (cr = me->SummonCreature(NPC_TWILIGHT_WHELP, cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ(), cr->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000)) + summons2.Summon(cr); + } + } - if (!isSartharion) - { - // Remove phase shift - if (InstanceScript* instance = me->GetInstanceScript()) - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); + if (!isSartharion) + { + // Remove phase shift + if (InstanceScript* instance = me->GetInstanceScript()) + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); - RemoveTwilightPortal(); - } - else if (pInstance) - pInstance->SetData(DATA_CLEAR_PORTAL, 0); + RemoveTwilightPortal(); + } + else if (pInstance) + pInstance->SetData(DATA_CLEAR_PORTAL, 0); - EntryCheckPredicate pred(NPC_TWILIGHT_EGG); - summons.DoAction(ACTION_SWITCH_PHASE, pred); - events.PopEvent(); - break; - } - } + EntryCheckPredicate pred(NPC_TWILIGHT_EGG); + summons.DoAction(ACTION_SWITCH_PHASE, pred); + events.PopEvent(); + break; + } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; ///////////////////////////// @@ -825,216 +825,216 @@ public: return new boss_sartharion_shadronAI (pCreature); } - struct boss_sartharion_shadronAI : public ScriptedAI - { - boss_sartharion_shadronAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) - { - portalGUID = 0; - pInstance = me->GetInstanceScript(); - } + struct boss_sartharion_shadronAI : public ScriptedAI + { + boss_sartharion_shadronAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) + { + portalGUID = 0; + pInstance = me->GetInstanceScript(); + } - EventMap events; - SummonList summons; - uint64 portalGUID; - InstanceScript* pInstance; - bool isSartharion; - uint32 timer; + EventMap events; + SummonList summons; + uint64 portalGUID; + InstanceScript* pInstance; + bool isSartharion; + uint32 timer; - void ClearInstance() - { - summons.DespawnAll(); - // Remove phase shift - if (pInstance) - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); + void ClearInstance() + { + summons.DespawnAll(); + // Remove phase shift + if (pInstance) + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); - RemoveTwilightPortal(); - } + RemoveTwilightPortal(); + } - void RemoveTwilightPortal() - { - if (portalGUID) - if (GameObject* gobj = me->GetMap()->GetGameObject(portalGUID)) - gobj->Delete(); + void RemoveTwilightPortal() + { + if (portalGUID) + if (GameObject* gobj = me->GetMap()->GetGameObject(portalGUID)) + gobj->Delete(); - portalGUID = 0; - } + portalGUID = 0; + } - void DoAction(int32 param) - { - if (param == ACTION_CALL_DRAGON) - { - isSartharion = true; - timer++; - } - } + void DoAction(int32 param) + { + if (param == ACTION_CALL_DRAGON) + { + isSartharion = true; + timer++; + } + } - void MoveInLineOfSight(Unit* who) - { - if (isSartharion) - return; + void MoveInLineOfSight(Unit* who) + { + if (isSartharion) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void Reset() - { - events.Reset(); - ClearInstance(); + void Reset() + { + events.Reset(); + ClearInstance(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->SetSpeed(MOVE_FLIGHT, 1.0f); - me->SetCanFly(false); - me->ResetLootMode(); - isSartharion = false; - timer = 0; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetSpeed(MOVE_FLIGHT, 1.0f); + me->SetCanFly(false); + me->ResetLootMode(); + isSartharion = false; + timer = 0; - if (pInstance) - { - pInstance->SetData(BOSS_SHADRON_EVENT, NOT_STARTED); - pInstance->SetData(DATA_CLEAR_PORTAL, 0); - } - } + if (pInstance) + { + pInstance->SetData(BOSS_SHADRON_EVENT, NOT_STARTED); + pInstance->SetData(DATA_CLEAR_PORTAL, 0); + } + } - void EnterCombat(Unit* ) - { - Talk(SAY_SHADRON_AGGRO); - me->SetInCombatWithZone(); - me->SetDisableGravity(false); - if (me->IsFlying()) - { - me->SetSpeed(MOVE_FLIGHT, 1.0f); - me->SetCanFly(false); - } + void EnterCombat(Unit* ) + { + Talk(SAY_SHADRON_AGGRO); + me->SetInCombatWithZone(); + me->SetDisableGravity(false); + if (me->IsFlying()) + { + me->SetSpeed(MOVE_FLIGHT, 1.0f); + me->SetCanFly(false); + } - events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_FISSURE, 20000); - events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_BREATH, 10000); - events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 15000); - - if (pInstance && !isSartharion) - pInstance->SetData(BOSS_SHADRON_EVENT, IN_PROGRESS); + events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_FISSURE, 20000); + events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_BREATH, 10000); + events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 15000); + + if (pInstance && !isSartharion) + pInstance->SetData(BOSS_SHADRON_EVENT, IN_PROGRESS); - if (isSartharion || (pInstance && pInstance->GetData(BOSS_SARTHARION_EVENT) == DONE)) - me->SetLootMode(0); - } + if (isSartharion || (pInstance && pInstance->GetData(BOSS_SARTHARION_EVENT) == DONE)) + me->SetLootMode(0); + } - void JustDied(Unit* ) - { - Talk(SAY_SHADRON_DEATH); + void JustDied(Unit* ) + { + Talk(SAY_SHADRON_DEATH); - if (!isSartharion) - { - ClearInstance(); - if (pInstance) - pInstance->SetData(BOSS_SHADRON_EVENT, DONE); - } - else if (pInstance) - { - if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_SARTHARION))) - cr->AI()->DoAction(ACTION_DRAKE_DIED); - } - } + if (!isSartharion) + { + ClearInstance(); + if (pInstance) + pInstance->SetData(BOSS_SHADRON_EVENT, DONE); + } + else if (pInstance) + { + if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_SARTHARION))) + cr->AI()->DoAction(ACTION_DRAKE_DIED); + } + } - void JustKilled(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER || urand(0,2)) - return; + void JustKilled(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER || urand(0,2)) + return; - Talk(SAY_SHADRON_SLAY); - } + Talk(SAY_SHADRON_SLAY); + } - void SummonedCreatureDies(Creature *summon, Unit*) - { - if (isSartharion && pInstance) - { - if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_SARTHARION))) - cr->RemoveAura(SPELL_GIFT_OF_TWILIGHT_FIRE); + void SummonedCreatureDies(Creature *summon, Unit*) + { + if (isSartharion && pInstance) + { + if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_SARTHARION))) + cr->RemoveAura(SPELL_GIFT_OF_TWILIGHT_FIRE); - pInstance->SetData(DATA_CLEAR_PORTAL, 0); - } - else - { - ClearInstance(); - me->RemoveAura(SPELL_GIFT_OF_TWILIGHT_SHADOW); - } + pInstance->SetData(DATA_CLEAR_PORTAL, 0); + } + else + { + ClearInstance(); + me->RemoveAura(SPELL_GIFT_OF_TWILIGHT_SHADOW); + } - events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 30000); - } + events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 30000); + } - void MovementInform(uint32 type, uint32 pointId) - { - if (type == WAYPOINT_MOTION_TYPE && pointId == POINT_FINAL_SHADRON) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->SetInCombatWithZone(); - } - } + void MovementInform(uint32 type, uint32 pointId) + { + if (type == WAYPOINT_MOTION_TYPE && pointId == POINT_FINAL_SHADRON) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetInCombatWithZone(); + } + } - void UpdateAI(uint32 diff) - { - // Call speach - if (timer) - { - timer += diff; - if (timer >= 4000) - { - Talk(SAY_SHADRON_RESPOND); - me->SetCanFly(true); - me->SetSpeed(MOVE_FLIGHT, 3.0f); - me->GetMotionMaster()->MovePath(me->GetEntry()*10, false); - timer = 0; - } - } + void UpdateAI(uint32 diff) + { + // Call speach + if (timer) + { + timer += diff; + if (timer >= 4000) + { + Talk(SAY_SHADRON_RESPOND); + me->SetCanFly(true); + me->SetSpeed(MOVE_FLIGHT, 3.0f); + me->GetMotionMaster()->MovePath(me->GetEntry()*10, false); + timer = 0; + } + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_MINIBOSS_SHADOW_BREATH: - if (!urand(0,10)) - Talk(SAY_SHADRON_BREATH); - me->CastSpell(me->GetVictim(), SPELL_SHADOW_BREATH, false); - events.RepeatEvent(17500); - break; - case EVENT_MINIBOSS_SHADOW_FISSURE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(target, SPELL_SHADOW_FISSURE, false); - events.RepeatEvent(22500); - break; - case EVENT_MINIBOSS_OPEN_PORTAL: - Talk(WHISPER_OPEN_PORTAL); - Talk(SAY_SHADRON_SPECIAL); - if (!isSartharion) - { - if (GameObject* Portal = me->GetVictim()->SummonGameObject(GO_TWILIGHT_PORTAL, portalPos[BOSS_SHADRON_EVENT].GetPositionX(), portalPos[BOSS_SHADRON_EVENT].GetPositionY(), portalPos[BOSS_SHADRON_EVENT].GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) - portalGUID = Portal->GetGUID(); - } - else if (pInstance) - pInstance->SetData(DATA_ADD_PORTAL, 0); - - events.ScheduleEvent(EVENT_MINIBOSS_SPAWN_HELPERS, 2000); - events.PopEvent(); - break; - case EVENT_MINIBOSS_SPAWN_HELPERS: - Talk(WHISPER_SUMMON_DICIPLE); - me->CastSpell(me, (isSartharion ? SPELL_GIFT_OF_TWILIGHT_FIRE : SPELL_GIFT_OF_TWILIGHT_SHADOW), true); - if (Creature* cr = me->SummonCreature((isSartharion ? NPC_ACOLYTE_OF_SHADRON : NPC_DISCIPLE_OF_SHADRON), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation())) - { - summons.Summon(cr); - cr->SetPhaseMask(16, true); - } + switch (events.GetEvent()) + { + case EVENT_MINIBOSS_SHADOW_BREATH: + if (!urand(0,10)) + Talk(SAY_SHADRON_BREATH); + me->CastSpell(me->GetVictim(), SPELL_SHADOW_BREATH, false); + events.RepeatEvent(17500); + break; + case EVENT_MINIBOSS_SHADOW_FISSURE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(target, SPELL_SHADOW_FISSURE, false); + events.RepeatEvent(22500); + break; + case EVENT_MINIBOSS_OPEN_PORTAL: + Talk(WHISPER_OPEN_PORTAL); + Talk(SAY_SHADRON_SPECIAL); + if (!isSartharion) + { + if (GameObject* Portal = me->GetVictim()->SummonGameObject(GO_TWILIGHT_PORTAL, portalPos[BOSS_SHADRON_EVENT].GetPositionX(), portalPos[BOSS_SHADRON_EVENT].GetPositionY(), portalPos[BOSS_SHADRON_EVENT].GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) + portalGUID = Portal->GetGUID(); + } + else if (pInstance) + pInstance->SetData(DATA_ADD_PORTAL, 0); + + events.ScheduleEvent(EVENT_MINIBOSS_SPAWN_HELPERS, 2000); + events.PopEvent(); + break; + case EVENT_MINIBOSS_SPAWN_HELPERS: + Talk(WHISPER_SUMMON_DICIPLE); + me->CastSpell(me, (isSartharion ? SPELL_GIFT_OF_TWILIGHT_FIRE : SPELL_GIFT_OF_TWILIGHT_SHADOW), true); + if (Creature* cr = me->SummonCreature((isSartharion ? NPC_ACOLYTE_OF_SHADRON : NPC_DISCIPLE_OF_SHADRON), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation())) + { + summons.Summon(cr); + cr->SetPhaseMask(16, true); + } - events.PopEvent(); - break; - } + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; ///////////////////////////// @@ -1051,216 +1051,216 @@ public: return new boss_sartharion_vesperonAI (pCreature); } - struct boss_sartharion_vesperonAI : public ScriptedAI - { - boss_sartharion_vesperonAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) - { - portalGUID = 0; - pInstance = me->GetInstanceScript(); - } + struct boss_sartharion_vesperonAI : public ScriptedAI + { + boss_sartharion_vesperonAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) + { + portalGUID = 0; + pInstance = me->GetInstanceScript(); + } - EventMap events; - SummonList summons; - uint64 portalGUID; - InstanceScript* pInstance; - bool isSartharion; - uint32 timer; + EventMap events; + SummonList summons; + uint64 portalGUID; + InstanceScript* pInstance; + bool isSartharion; + uint32 timer; - void ClearInstance() - { - // Remove phase shift - if (pInstance) - { - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESPERON); - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_SARTHARION); - } + void ClearInstance() + { + // Remove phase shift + if (pInstance) + { + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESPERON); + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_SARTHARION); + } - summons.DespawnAll(); - RemoveTwilightPortal(); - } + summons.DespawnAll(); + RemoveTwilightPortal(); + } - void RemoveTwilightPortal() - { - if (portalGUID) - if (GameObject* gobj = me->GetMap()->GetGameObject(portalGUID)) - gobj->Delete(); + void RemoveTwilightPortal() + { + if (portalGUID) + if (GameObject* gobj = me->GetMap()->GetGameObject(portalGUID)) + gobj->Delete(); - portalGUID = 0; - } + portalGUID = 0; + } - void DoAction(int32 param) - { - if (param == ACTION_CALL_DRAGON) - { - isSartharion = true; - timer++; - } - } + void DoAction(int32 param) + { + if (param == ACTION_CALL_DRAGON) + { + isSartharion = true; + timer++; + } + } - void MoveInLineOfSight(Unit* who) - { - if (isSartharion) - return; + void MoveInLineOfSight(Unit* who) + { + if (isSartharion) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void Reset() - { - events.Reset(); - ClearInstance(); + void Reset() + { + events.Reset(); + ClearInstance(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->SetSpeed(MOVE_FLIGHT, 1.0f); - me->SetCanFly(false); - me->ResetLootMode(); - isSartharion = false; - timer = 0; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetSpeed(MOVE_FLIGHT, 1.0f); + me->SetCanFly(false); + me->ResetLootMode(); + isSartharion = false; + timer = 0; - if (pInstance) - { - pInstance->SetData(BOSS_VESPERON_EVENT, NOT_STARTED); - pInstance->SetData(DATA_CLEAR_PORTAL, 1); - } - } + if (pInstance) + { + pInstance->SetData(BOSS_VESPERON_EVENT, NOT_STARTED); + pInstance->SetData(DATA_CLEAR_PORTAL, 1); + } + } - void EnterCombat(Unit* ) - { - Talk(SAY_VESPERON_AGGRO); - me->SetInCombatWithZone(); + void EnterCombat(Unit* ) + { + Talk(SAY_VESPERON_AGGRO); + me->SetInCombatWithZone(); - if (me->IsFlying()) - { - me->SetSpeed(MOVE_FLIGHT, 1.0f); - me->SetCanFly(false); - } + if (me->IsFlying()) + { + me->SetSpeed(MOVE_FLIGHT, 1.0f); + me->SetCanFly(false); + } - events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_FISSURE, 20000); - events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_BREATH, 10000); - events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 30000); + events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_FISSURE, 20000); + events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_BREATH, 10000); + events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 30000); - if (pInstance && !isSartharion) - pInstance->SetData(BOSS_VESPERON_EVENT, IN_PROGRESS); + if (pInstance && !isSartharion) + pInstance->SetData(BOSS_VESPERON_EVENT, IN_PROGRESS); - if (isSartharion || (pInstance && pInstance->GetData(BOSS_SARTHARION_EVENT) == DONE)) - me->SetLootMode(0); - } + if (isSartharion || (pInstance && pInstance->GetData(BOSS_SARTHARION_EVENT) == DONE)) + me->SetLootMode(0); + } - void JustDied(Unit* ) - { - Talk(SAY_VESPERON_DEATH); + void JustDied(Unit* ) + { + Talk(SAY_VESPERON_DEATH); - if (!isSartharion) - { - ClearInstance(); - if (pInstance) - pInstance->SetData(BOSS_VESPERON_EVENT, DONE); - } - else if (pInstance) - { - if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_SARTHARION))) - cr->AI()->DoAction(ACTION_DRAKE_DIED); - } - } + if (!isSartharion) + { + ClearInstance(); + if (pInstance) + pInstance->SetData(BOSS_VESPERON_EVENT, DONE); + } + else if (pInstance) + { + if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_SARTHARION))) + cr->AI()->DoAction(ACTION_DRAKE_DIED); + } + } - void JustKilled(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER || urand(0,2)) - return; + void JustKilled(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER || urand(0,2)) + return; - Talk(SAY_VESPERON_SLAY); - } + Talk(SAY_VESPERON_SLAY); + } - void SummonedCreatureDies(Creature *summon, Unit*) - { - if (!isSartharion) - ClearInstance(); - else if (pInstance) - { - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_SARTHARION); - pInstance->SetData(DATA_CLEAR_PORTAL, 1); - } + void SummonedCreatureDies(Creature *summon, Unit*) + { + if (!isSartharion) + ClearInstance(); + else if (pInstance) + { + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_SARTHARION); + pInstance->SetData(DATA_CLEAR_PORTAL, 1); + } - events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 30000); - } + events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 30000); + } - void MovementInform(uint32 type, uint32 pointId) - { - if (type == WAYPOINT_MOTION_TYPE && pointId == POINT_FINAL_VESPERON) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->SetInCombatWithZone(); - } - } + void MovementInform(uint32 type, uint32 pointId) + { + if (type == WAYPOINT_MOTION_TYPE && pointId == POINT_FINAL_VESPERON) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetInCombatWithZone(); + } + } - void UpdateAI(uint32 diff) - { - // Call speach - if (timer) - { - timer += diff; - if (timer >= 4000) - { - Talk(SAY_VESPERON_RESPOND); - me->SetCanFly(true); - me->SetSpeed(MOVE_FLIGHT, 3.0f); - me->GetMotionMaster()->MovePath(me->GetEntry()*10, false); - timer = 0; - } - return; - } + void UpdateAI(uint32 diff) + { + // Call speach + if (timer) + { + timer += diff; + if (timer >= 4000) + { + Talk(SAY_VESPERON_RESPOND); + me->SetCanFly(true); + me->SetSpeed(MOVE_FLIGHT, 3.0f); + me->GetMotionMaster()->MovePath(me->GetEntry()*10, false); + timer = 0; + } + return; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_MINIBOSS_SHADOW_BREATH: - if (!urand(0,10)) - Talk(SAY_SHADRON_BREATH); - me->CastSpell(me->GetVictim(), SPELL_SHADOW_BREATH, false); - events.RepeatEvent(17500); - break; - case EVENT_MINIBOSS_SHADOW_FISSURE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(target, SPELL_SHADOW_FISSURE, false); - events.RepeatEvent(22500); - break; - case EVENT_MINIBOSS_OPEN_PORTAL: - Talk(WHISPER_OPEN_PORTAL); - Talk(SAY_VESPERON_SPECIAL); - if (!isSartharion) - { - if (GameObject* Portal = me->GetVictim()->SummonGameObject(GO_TWILIGHT_PORTAL, portalPos[BOSS_VESPERON_EVENT].GetPositionX(), portalPos[BOSS_VESPERON_EVENT].GetPositionY(), portalPos[BOSS_VESPERON_EVENT].GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) - portalGUID = Portal->GetGUID(); - } - else if (pInstance) - pInstance->SetData(DATA_ADD_PORTAL, 0); - - events.ScheduleEvent(EVENT_MINIBOSS_SPAWN_HELPERS, 2000); - events.PopEvent(); - break; - case EVENT_MINIBOSS_SPAWN_HELPERS: - Talk(WHISPER_SUMMON_DICIPLE); - me->CastSpell(me, (isSartharion ? (uint32)SPELL_TWILIGHT_TORMENT_SARTHARION : (uint32)SPELL_TWILIGHT_TORMENT_VESPERON), true); - if (Creature* cr = me->SummonCreature((isSartharion ? NPC_ACOLYTE_OF_VESPERON : NPC_DISCIPLE_OF_VESPERON), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation())) - { - summons.Summon(cr); - cr->SetPhaseMask(16, true); - } + switch (events.GetEvent()) + { + case EVENT_MINIBOSS_SHADOW_BREATH: + if (!urand(0,10)) + Talk(SAY_SHADRON_BREATH); + me->CastSpell(me->GetVictim(), SPELL_SHADOW_BREATH, false); + events.RepeatEvent(17500); + break; + case EVENT_MINIBOSS_SHADOW_FISSURE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(target, SPELL_SHADOW_FISSURE, false); + events.RepeatEvent(22500); + break; + case EVENT_MINIBOSS_OPEN_PORTAL: + Talk(WHISPER_OPEN_PORTAL); + Talk(SAY_VESPERON_SPECIAL); + if (!isSartharion) + { + if (GameObject* Portal = me->GetVictim()->SummonGameObject(GO_TWILIGHT_PORTAL, portalPos[BOSS_VESPERON_EVENT].GetPositionX(), portalPos[BOSS_VESPERON_EVENT].GetPositionY(), portalPos[BOSS_VESPERON_EVENT].GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) + portalGUID = Portal->GetGUID(); + } + else if (pInstance) + pInstance->SetData(DATA_ADD_PORTAL, 0); + + events.ScheduleEvent(EVENT_MINIBOSS_SPAWN_HELPERS, 2000); + events.PopEvent(); + break; + case EVENT_MINIBOSS_SPAWN_HELPERS: + Talk(WHISPER_SUMMON_DICIPLE); + me->CastSpell(me, (isSartharion ? (uint32)SPELL_TWILIGHT_TORMENT_SARTHARION : (uint32)SPELL_TWILIGHT_TORMENT_VESPERON), true); + if (Creature* cr = me->SummonCreature((isSartharion ? NPC_ACOLYTE_OF_VESPERON : NPC_DISCIPLE_OF_VESPERON), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation())) + { + summons.Summon(cr); + cr->SetPhaseMask(16, true); + } - events.PopEvent(); - break; - } + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; // other @@ -1274,49 +1274,49 @@ public: return new npc_twilight_summonAI (pCreature); } - struct npc_twilight_summonAI : public ScriptedAI - { - npc_twilight_summonAI(Creature* pCreature) : ScriptedAI(pCreature) - { - } + struct npc_twilight_summonAI : public ScriptedAI + { + npc_twilight_summonAI(Creature* pCreature) : ScriptedAI(pCreature) + { + } - uint32 timer; - void Reset() - { - timer = urand(0, 15000); - if (me->GetEntry() == NPC_TWILIGHT_EGG) - me->SetControlled(true, UNIT_STATE_STUNNED); - else - me->SetInCombatWithZone(); - } + uint32 timer; + void Reset() + { + timer = urand(0, 15000); + if (me->GetEntry() == NPC_TWILIGHT_EGG) + me->SetControlled(true, UNIT_STATE_STUNNED); + else + me->SetInCombatWithZone(); + } - void DoAction(int32 param) - { - if (param == ACTION_SWITCH_PHASE) - { - me->DespawnOrUnsummon(1); - } - } + void DoAction(int32 param) + { + if (param == ACTION_SWITCH_PHASE) + { + me->DespawnOrUnsummon(1); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() || me->GetEntry() == NPC_TWILIGHT_EGG) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() || me->GetEntry() == NPC_TWILIGHT_EGG) + return; - timer += diff; - if (timer >= 15000) - { - if (Aura* aur = me->GetVictim()->GetAura(SPELL_FADE_ARMOR)) - aur->ModStackAmount(1); - else - me->CastSpell(me->GetVictim(), SPELL_FADE_ARMOR, false); + timer += diff; + if (timer >= 15000) + { + if (Aura* aur = me->GetVictim()->GetAura(SPELL_FADE_ARMOR)) + aur->ModStackAmount(1); + else + me->CastSpell(me->GetVictim(), SPELL_FADE_ARMOR, false); - timer = 0; - } + timer = 0; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_sartharion_lava_strike : public SpellScriptLoader @@ -1328,38 +1328,38 @@ class spell_sartharion_lava_strike : public SpellScriptLoader { PrepareSpellScript(spell_sartharion_lava_strike_SpellScript); - bool spawned; + bool spawned; - bool Load() { spawned = false; return true; } + bool Load() { spawned = false; return true; } void HandleDummy(SpellEffIndex /*effIndex*/) { - if (!GetCaster() || !GetHitUnit()) - return; + if (!GetCaster() || !GetHitUnit()) + return; - GetCaster()->CastSpell(GetHitUnit()->GetPositionX(), GetHitUnit()->GetPositionY(), GetHitUnit()->GetPositionZ(), SPELL_LAVA_STRIKE_DUMMY_TRIGGER, true); + GetCaster()->CastSpell(GetHitUnit()->GetPositionX(), GetHitUnit()->GetPositionY(), GetHitUnit()->GetPositionZ(), SPELL_LAVA_STRIKE_DUMMY_TRIGGER, true); } - void HandleSchoolDamage(SpellEffIndex /*effIndex*/) + void HandleSchoolDamage(SpellEffIndex /*effIndex*/) { - if (!GetCaster() || !GetHitUnit() || spawned) - return; + if (!GetCaster() || !GetHitUnit() || spawned) + return; - if (InstanceScript* pInstance = GetCaster()->GetInstanceScript()) - if (Creature* sarth = ObjectAccessor::GetCreature(*GetHitUnit(), pInstance->GetData64(DATA_SARTHARION))) - { - sarth->AI()->SetData(DATA_VOLCANO_BLOWS, GetHitUnit()->GetGUIDLow()); - sarth->CastSpell(GetHitUnit(), SPELL_LAVA_STRIKE_SUMMON, true); - spawned = true; - } + if (InstanceScript* pInstance = GetCaster()->GetInstanceScript()) + if (Creature* sarth = ObjectAccessor::GetCreature(*GetHitUnit(), pInstance->GetData64(DATA_SARTHARION))) + { + sarth->AI()->SetData(DATA_VOLCANO_BLOWS, GetHitUnit()->GetGUIDLow()); + sarth->CastSpell(GetHitUnit(), SPELL_LAVA_STRIKE_SUMMON, true); + spawned = true; + } } void Register() { - if (m_scriptSpellId == 57578) // Dummy lava strike - OnEffectHitTarget += SpellEffectFn(spell_sartharion_lava_strike_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - else - OnEffectHitTarget += SpellEffectFn(spell_sartharion_lava_strike_SpellScript::HandleSchoolDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + if (m_scriptSpellId == 57578) // Dummy lava strike + OnEffectHitTarget += SpellEffectFn(spell_sartharion_lava_strike_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + else + OnEffectHitTarget += SpellEffectFn(spell_sartharion_lava_strike_SpellScript::HandleSchoolDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } }; @@ -1375,7 +1375,7 @@ void AddSC_boss_sartharion() new boss_sartharion_shadron(); new boss_sartharion_tenebron(); new boss_sartharion_vesperon(); - new npc_twilight_summon(); + new npc_twilight_summon(); - new spell_sartharion_lava_strike(); + new spell_sartharion_lava_strike(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp index d0a9d534a..13660f150 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp @@ -17,178 +17,178 @@ public: return new instance_obsidian_sanctum_InstanceMapScript(pMap); } - struct instance_obsidian_sanctum_InstanceMapScript : public InstanceScript - { - instance_obsidian_sanctum_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {} + struct instance_obsidian_sanctum_InstanceMapScript : public InstanceScript + { + instance_obsidian_sanctum_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {} - uint64 m_uiSartharionGUID; - uint64 m_uiTenebronGUID; - uint64 m_uiShadronGUID; - uint64 m_uiVesperonGUID; - uint32 Encounters[MAX_ENCOUNTERS]; - uint64 m_uiPortalGUID; - uint8 portalCount; + uint64 m_uiSartharionGUID; + uint64 m_uiTenebronGUID; + uint64 m_uiShadronGUID; + uint64 m_uiVesperonGUID; + uint32 Encounters[MAX_ENCOUNTERS]; + uint64 m_uiPortalGUID; + uint8 portalCount; - void Initialize() - { - m_uiSartharionGUID = 0; - m_uiTenebronGUID = 0; - m_uiShadronGUID = 0; - m_uiVesperonGUID = 0; - m_uiPortalGUID = 0; - portalCount = 0; - memset(&Encounters, 0, sizeof(Encounters)); - }; + void Initialize() + { + m_uiSartharionGUID = 0; + m_uiTenebronGUID = 0; + m_uiShadronGUID = 0; + m_uiVesperonGUID = 0; + m_uiPortalGUID = 0; + portalCount = 0; + memset(&Encounters, 0, sizeof(Encounters)); + }; - void OnCreatureCreate(Creature* pCreature) - { - switch(pCreature->GetEntry()) - { - case NPC_SARTHARION: - m_uiSartharionGUID = pCreature->GetGUID(); - break; - case NPC_TENEBRON: - m_uiTenebronGUID = pCreature->GetGUID(); - break; - case NPC_SHADRON: - m_uiShadronGUID = pCreature->GetGUID(); - break; - case NPC_VESPERON: - m_uiVesperonGUID = pCreature->GetGUID(); - break; - } - } + void OnCreatureCreate(Creature* pCreature) + { + switch(pCreature->GetEntry()) + { + case NPC_SARTHARION: + m_uiSartharionGUID = pCreature->GetGUID(); + break; + case NPC_TENEBRON: + m_uiTenebronGUID = pCreature->GetGUID(); + break; + case NPC_SHADRON: + m_uiShadronGUID = pCreature->GetGUID(); + break; + case NPC_VESPERON: + m_uiVesperonGUID = pCreature->GetGUID(); + break; + } + } - uint32 GetData(uint32 id) const - { - switch (id) - { - case BOSS_SARTHARION_EVENT: - case BOSS_TENEBRON_EVENT: - case BOSS_SHADRON_EVENT: - case BOSS_VESPERON_EVENT: - return Encounters[id]; - } + uint32 GetData(uint32 id) const + { + switch (id) + { + case BOSS_SARTHARION_EVENT: + case BOSS_TENEBRON_EVENT: + case BOSS_SHADRON_EVENT: + case BOSS_VESPERON_EVENT: + return Encounters[id]; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 uiData) const - { - switch(uiData) - { - case DATA_SARTHARION: - return m_uiSartharionGUID; - case DATA_TENEBRON: - return m_uiTenebronGUID; - case DATA_SHADRON: - return m_uiShadronGUID; - case DATA_VESPERON: - return m_uiVesperonGUID; - } - return 0; - } + uint64 GetData64(uint32 uiData) const + { + switch(uiData) + { + case DATA_SARTHARION: + return m_uiSartharionGUID; + case DATA_TENEBRON: + return m_uiTenebronGUID; + case DATA_SHADRON: + return m_uiShadronGUID; + case DATA_VESPERON: + return m_uiVesperonGUID; + } + return 0; + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - // Gonna Go When the Volcano Blows (10 player) (2047) - case 7326: - // Gonna Go When the Volcano Blows (25 player) (2048) - case 7327: - if (Creature* cr = instance->GetCreature(m_uiSartharionGUID)) - if (!cr->AI()->GetData(source->GetGUIDLow())) - return true; - break; - // Less Is More (10 player) (624) - case 7189: - case 7190: - case 7191: - case 522: - if (instance->GetPlayersCountExceptGMs() < 9) - return true; - break; - // Less Is More (25 player) (1877) - case 7185: - case 7186: - case 7187: - case 7188: - if (instance->GetPlayersCountExceptGMs() < 21) - return true; - break; - // Twilight Assist (10 player) (2049) - case 7328: - // Twilight Assist (25 player) (2052) - case 7331: - if (Creature* cr = instance->GetCreature(m_uiSartharionGUID)) - if (cr->AI()->GetData(DATA_ACHIEVEMENT_DRAGONS_COUNT) >= 1) - return true; - break; - // Twilight Duo (10 player) (2050) - case 7329: - // Twilight Duo (25 player) (2053) - case 7332: - if (Creature* cr = instance->GetCreature(m_uiSartharionGUID)) - if (cr->AI()->GetData(DATA_ACHIEVEMENT_DRAGONS_COUNT) >= 2) - return true; - break; - // Twilight Zone (10 player) (2051) - case 7330: - // Twilight Zone (25 player) (2054) - case 7333: - if (Creature* cr = instance->GetCreature(m_uiSartharionGUID)) - if (cr->AI()->GetData(DATA_ACHIEVEMENT_DRAGONS_COUNT) >= 3) - return true; - break; - - } - return false; - } + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + // Gonna Go When the Volcano Blows (10 player) (2047) + case 7326: + // Gonna Go When the Volcano Blows (25 player) (2048) + case 7327: + if (Creature* cr = instance->GetCreature(m_uiSartharionGUID)) + if (!cr->AI()->GetData(source->GetGUIDLow())) + return true; + break; + // Less Is More (10 player) (624) + case 7189: + case 7190: + case 7191: + case 522: + if (instance->GetPlayersCountExceptGMs() < 9) + return true; + break; + // Less Is More (25 player) (1877) + case 7185: + case 7186: + case 7187: + case 7188: + if (instance->GetPlayersCountExceptGMs() < 21) + return true; + break; + // Twilight Assist (10 player) (2049) + case 7328: + // Twilight Assist (25 player) (2052) + case 7331: + if (Creature* cr = instance->GetCreature(m_uiSartharionGUID)) + if (cr->AI()->GetData(DATA_ACHIEVEMENT_DRAGONS_COUNT) >= 1) + return true; + break; + // Twilight Duo (10 player) (2050) + case 7329: + // Twilight Duo (25 player) (2053) + case 7332: + if (Creature* cr = instance->GetCreature(m_uiSartharionGUID)) + if (cr->AI()->GetData(DATA_ACHIEVEMENT_DRAGONS_COUNT) >= 2) + return true; + break; + // Twilight Zone (10 player) (2051) + case 7330: + // Twilight Zone (25 player) (2054) + case 7333: + if (Creature* cr = instance->GetCreature(m_uiSartharionGUID)) + if (cr->AI()->GetData(DATA_ACHIEVEMENT_DRAGONS_COUNT) >= 3) + return true; + break; + + } + return false; + } - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case BOSS_SARTHARION_EVENT: - case BOSS_TENEBRON_EVENT: - case BOSS_SHADRON_EVENT: - case BOSS_VESPERON_EVENT: - Encounters[type] = data; - break; - case DATA_ADD_PORTAL: - if (!m_uiPortalGUID) - { - if (Creature* cr = instance->GetCreature(m_uiSartharionGUID)) - if (GameObject* go = cr->SummonGameObject(GO_TWILIGHT_PORTAL, 3247.29f, 529.804f, 58.9595f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) - { - cr->RemoveGameObject(go, false); - m_uiPortalGUID = go->GetGUID(); - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case BOSS_SARTHARION_EVENT: + case BOSS_TENEBRON_EVENT: + case BOSS_SHADRON_EVENT: + case BOSS_VESPERON_EVENT: + Encounters[type] = data; + break; + case DATA_ADD_PORTAL: + if (!m_uiPortalGUID) + { + if (Creature* cr = instance->GetCreature(m_uiSartharionGUID)) + if (GameObject* go = cr->SummonGameObject(GO_TWILIGHT_PORTAL, 3247.29f, 529.804f, 58.9595f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) + { + cr->RemoveGameObject(go, false); + m_uiPortalGUID = go->GetGUID(); + } - portalCount = 0; - } + portalCount = 0; + } - portalCount++; - break; - case DATA_CLEAR_PORTAL: - portalCount--; - if (!portalCount || data == 2) - { - if (GameObject* go = instance->GetGameObject(m_uiPortalGUID)) - go->Delete(); + portalCount++; + break; + case DATA_CLEAR_PORTAL: + portalCount--; + if (!portalCount || data == 2) + { + if (GameObject* go = instance->GetGameObject(m_uiPortalGUID)) + go->Delete(); - DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); - m_uiPortalGUID = 0; - } - break; - } + DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT); + m_uiPortalGUID = 0; + } + break; + } - if (data == DONE) - SaveToDB(); - } + if (data == DONE) + SaveToDB(); + } - std::string GetSaveData() + std::string GetSaveData() { OUT_SAVE_INST_DATA; @@ -198,35 +198,35 @@ public: OUT_SAVE_INST_DATA_COMPLETE; return saveStream.str(); } - - void Load(const char* strIn) - { - if (!strIn) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + + void Load(const char* strIn) + { + if (!strIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(strIn); + OUT_LOAD_INST_DATA(strIn); - char dataHead1, dataHead2; + char dataHead1, dataHead2; - std::istringstream loadStream(strIn); - loadStream >> dataHead1 >> dataHead2; + std::istringstream loadStream(strIn); + loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'O' && dataHead2 == 'S') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - loadStream >> Encounters[i]; - if (Encounters[i] == IN_PROGRESS) - Encounters[i] = NOT_STARTED; - } - } + if (dataHead1 == 'O' && dataHead2 == 'S') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + loadStream >> Encounters[i]; + if (Encounters[i] == IN_PROGRESS) + Encounters[i] = NOT_STARTED; + } + } - OUT_LOAD_INST_DATA_COMPLETE; - } - }; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; }; void AddSC_instance_obsidian_sanctum() diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h index fd9c80390..12764a108 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h @@ -7,41 +7,41 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Data { - // Encounter - BOSS_SARTHARION_EVENT = 0, - BOSS_TENEBRON_EVENT = 1, - BOSS_VESPERON_EVENT = 2, - BOSS_SHADRON_EVENT = 3, - MAX_ENCOUNTERS = 4, + // Encounter + BOSS_SARTHARION_EVENT = 0, + BOSS_TENEBRON_EVENT = 1, + BOSS_VESPERON_EVENT = 2, + BOSS_SHADRON_EVENT = 3, + MAX_ENCOUNTERS = 4, - // GUIDs - DATA_SARTHARION = 10, - DATA_TENEBRON = 11, - DATA_SHADRON = 12, - DATA_VESPERON = 13, + // GUIDs + DATA_SARTHARION = 10, + DATA_TENEBRON = 11, + DATA_SHADRON = 12, + DATA_VESPERON = 13, - // Portal - DATA_CLEAR_PORTAL = 20, - DATA_ADD_PORTAL = 21, + // Portal + DATA_CLEAR_PORTAL = 20, + DATA_ADD_PORTAL = 21, - // Achievements - DATA_ACHIEVEMENT_DRAGONS_COUNT = 30, - DATA_VOLCANO_BLOWS = 31, + // Achievements + DATA_ACHIEVEMENT_DRAGONS_COUNT = 30, + DATA_VOLCANO_BLOWS = 31, - // NPCs - NPC_SARTHARION = 28860, - NPC_TENEBRON = 30452, - NPC_SHADRON = 30451, - NPC_VESPERON = 30449, - NPC_FIRE_CYCLONE = 30648, + // NPCs + NPC_SARTHARION = 28860, + NPC_TENEBRON = 30452, + NPC_SHADRON = 30451, + NPC_VESPERON = 30449, + NPC_FIRE_CYCLONE = 30648, - // GOs - GO_TWILIGHT_PORTAL = 193988, - GO_NORMAL_PORTAL = 193989, + // GOs + GO_TWILIGHT_PORTAL = 193988, + GO_NORMAL_PORTAL = 193989, - // Spells - SPELL_TWILIGHT_SHIFT = 57620, - SPELL_TWILIGHT_TORMENT_SARTHARION = 58853, + // Spells + SPELL_TWILIGHT_SHIFT = 57620, + SPELL_TWILIGHT_TORMENT_SARTHARION = 58853, }; #endif diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp index cc166628f..86877fe1b 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp @@ -10,11 +10,11 @@ REWRITTEN BY XINEF enum Texts { - SAY_BALTHARUS_INTRO = 0, - SAY_AGGRO = 1, - SAY_KILL = 2, - SAY_CLONE = 3, - SAY_DEATH = 4, + SAY_BALTHARUS_INTRO = 0, + SAY_AGGRO = 1, + SAY_KILL = 2, + SAY_CLONE = 3, + SAY_DEATH = 4, SAY_XERESTRASZA_EVENT = 0, SAY_XERESTRASZA_EVENT_1 = 1, @@ -29,9 +29,9 @@ enum Texts enum Spells { - SPELL_BARRIER_CHANNEL = 76221, + SPELL_BARRIER_CHANNEL = 76221, - SPELL_ENERVATING_BRAND = 74502, + SPELL_ENERVATING_BRAND = 74502, SPELL_SIPHONED_MIGHT = 74507, SPELL_CLEAVE = 40504, SPELL_BLADE_TEMPEST = 75125, @@ -43,14 +43,14 @@ enum Spells enum Events { - EVENT_BLADE_TEMPEST = 1, - EVENT_CLEAVE = 2, - EVENT_ENERVATING_BRAND = 3, - EVENT_CHECK_HEALTH1 = 4, - EVENT_CHECK_HEALTH2 = 5, - EVENT_CHECK_HEALTH3 = 6, - EVENT_KILL_TALK = 7, - EVENT_SUMMON_CLONE = 8, + EVENT_BLADE_TEMPEST = 1, + EVENT_CLEAVE = 2, + EVENT_ENERVATING_BRAND = 3, + EVENT_CHECK_HEALTH1 = 4, + EVENT_CHECK_HEALTH2 = 5, + EVENT_CHECK_HEALTH3 = 6, + EVENT_KILL_TALK = 7, + EVENT_SUMMON_CLONE = 8, EVENT_XERESTRASZA_EVENT_0 = 1, EVENT_XERESTRASZA_EVENT_1 = 2, @@ -64,9 +64,9 @@ enum Events enum Actions { - ACTION_INTRO_BALTHARUS = -3975101, - ACTION_BALTHARUS_DEATH = -3975102, - ACTION_CLONE = 1 + ACTION_INTRO_BALTHARUS = -3975101, + ACTION_BALTHARUS_DEATH = -3975102, + ACTION_CLONE = 1 }; class DelayedTalk : public BasicEvent @@ -76,13 +76,13 @@ class DelayedTalk : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - _owner->AI()->Talk(_talkId); + _owner->AI()->Talk(_talkId); return true; } private: Creature* _owner; - uint32 _talkId; + uint32 _talkId; }; class RestoreFight : public BasicEvent @@ -92,8 +92,8 @@ class RestoreFight : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - _owner->SetReactState(REACT_AGGRESSIVE); - _owner->SetInCombatWithZone(); + _owner->SetReactState(REACT_AGGRESSIVE); + _owner->SetInCombatWithZone(); return true; } @@ -115,58 +115,58 @@ class boss_baltharus_the_warborn : public CreatureScript void Reset() { - BossAI::Reset(); + BossAI::Reset(); } - void InitializeAI() - { - BossAI::InitializeAI(); - me->CastSpell(me, SPELL_BARRIER_CHANNEL, false); - } + void InitializeAI() + { + BossAI::InitializeAI(); + me->CastSpell(me, SPELL_BARRIER_CHANNEL, false); + } - void JustReachedHome() - { - BossAI::JustReachedHome(); - me->CastSpell(me, SPELL_BARRIER_CHANNEL, false); - } + void JustReachedHome() + { + BossAI::JustReachedHome(); + me->CastSpell(me, SPELL_BARRIER_CHANNEL, false); + } void DoAction(int32 action) { if (action == ACTION_INTRO_BALTHARUS && !_introDone) - { + { _introDone = true; me->m_Events.AddEvent(new DelayedTalk(me, SAY_BALTHARUS_INTRO), me->m_Events.CalculateTime(6000)); - } - else if (action == ACTION_CLONE) - { - me->CastSpell(me, SPELL_REPELLING_WAVE, false); + } + else if (action == ACTION_CLONE) + { + me->CastSpell(me, SPELL_REPELLING_WAVE, false); me->CastSpell(me, SPELL_CLEAR_DEBUFFS, false); - events.ScheduleEvent(EVENT_SUMMON_CLONE, 1000); + events.ScheduleEvent(EVENT_SUMMON_CLONE, 1000); } } void EnterCombat(Unit* who) { Talk(SAY_AGGRO); - BossAI::EnterCombat(who); + BossAI::EnterCombat(who); me->InterruptNonMeleeSpells(false); events.ScheduleEvent(EVENT_CLEAVE, 11000); events.ScheduleEvent(EVENT_ENERVATING_BRAND, 13000); events.ScheduleEvent(EVENT_BLADE_TEMPEST, 15000); - if (!Is25ManRaid()) - events.ScheduleEvent(EVENT_CHECK_HEALTH1, 1000); - else - { - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - events.ScheduleEvent(EVENT_CHECK_HEALTH3, 1000); - } + if (!Is25ManRaid()) + events.ScheduleEvent(EVENT_CHECK_HEALTH1, 1000); + else + { + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH3, 1000); + } } void JustDied(Unit* killer) { Talk(SAY_DEATH); - BossAI::JustDied(killer); + BossAI::JustDied(killer); if (Creature* xerestrasza = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_XERESTRASZA))) xerestrasza->AI()->DoAction(ACTION_BALTHARUS_DEATH); @@ -175,10 +175,10 @@ class boss_baltharus_the_warborn : public CreatureScript void KilledUnit(Unit* victim) { if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { + { Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } } void JustSummoned(Creature* summon) @@ -186,8 +186,8 @@ class boss_baltharus_the_warborn : public CreatureScript summons.Summon(summon); summon->SetHealth(me->GetHealth()); summon->CastSpell(summon, SPELL_SPAWN_EFFECT, true); - summon->SetReactState(REACT_PASSIVE); - summon->m_Events.AddEvent(new RestoreFight(summon), summon->m_Events.CalculateTime(2000)); + summon->SetReactState(REACT_PASSIVE); + summon->m_Events.AddEvent(new RestoreFight(summon), summon->m_Events.CalculateTime(2000)); } void UpdateAI(uint32 diff) @@ -202,11 +202,11 @@ class boss_baltharus_the_warborn : public CreatureScript switch (events.ExecuteEvent()) { case EVENT_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); events.ScheduleEvent(EVENT_CLEAVE, 24000); break; case EVENT_BLADE_TEMPEST: - me->CastSpell(me, SPELL_BLADE_TEMPEST, false); + me->CastSpell(me, SPELL_BLADE_TEMPEST, false); events.ScheduleEvent(EVENT_BLADE_TEMPEST, 24000); break; case EVENT_ENERVATING_BRAND: @@ -215,34 +215,34 @@ class boss_baltharus_the_warborn : public CreatureScript me->CastSpell(target, SPELL_ENERVATING_BRAND, true); events.ScheduleEvent(EVENT_ENERVATING_BRAND, 26000); break; - case EVENT_CHECK_HEALTH1: - if (me->HealthBelowPct(50)) - { - DoAction(ACTION_CLONE); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH1, 1000); - break; - case EVENT_CHECK_HEALTH2: - if (me->HealthBelowPct(66)) - { - DoAction(ACTION_CLONE); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - break; - case EVENT_CHECK_HEALTH3: - if (me->HealthBelowPct(33)) - { - DoAction(ACTION_CLONE); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH3, 1000); - break; - case EVENT_SUMMON_CLONE: - me->CastSpell(me, SPELL_CLONE, false); - Talk(SAY_CLONE); - break; + case EVENT_CHECK_HEALTH1: + if (me->HealthBelowPct(50)) + { + DoAction(ACTION_CLONE); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH1, 1000); + break; + case EVENT_CHECK_HEALTH2: + if (me->HealthBelowPct(66)) + { + DoAction(ACTION_CLONE); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + break; + case EVENT_CHECK_HEALTH3: + if (me->HealthBelowPct(33)) + { + DoAction(ACTION_CLONE); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH3, 1000); + break; + case EVENT_SUMMON_CLONE: + me->CastSpell(me, SPELL_CLONE, false); + Talk(SAY_CLONE); + break; } DoMeleeAttackIfReady(); @@ -289,11 +289,11 @@ class npc_baltharus_the_warborn_clone : public CreatureScript switch (_events.ExecuteEvent()) { case EVENT_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); _events.ScheduleEvent(EVENT_CLEAVE, 24000); break; case EVENT_BLADE_TEMPEST: - me->CastSpell(me, SPELL_BLADE_TEMPEST, false); + me->CastSpell(me, SPELL_BLADE_TEMPEST, false); _events.ScheduleEvent(EVENT_BLADE_TEMPEST, 24000); break; case EVENT_ENERVATING_BRAND: @@ -330,8 +330,8 @@ class spell_baltharus_enervating_brand_trigger : public SpellScriptLoader { if (Unit* caster = GetOriginalCaster()) if (Unit* target = GetHitUnit()) - if (target == GetCaster()) - target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true); + if (target == GetCaster()) + target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true); } void Register() @@ -364,9 +364,9 @@ class npc_xerestrasza : public CreatureScript _events.Reset(); me->RemoveFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); - // Xinef: after soft reset npc is no longer present - if (me->GetInstanceScript()->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) - me->DespawnOrUnsummon(1); + // Xinef: after soft reset npc is no longer present + if (me->GetInstanceScript()->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) + me->DespawnOrUnsummon(1); } void DoAction(int32 action) @@ -376,7 +376,7 @@ class npc_xerestrasza : public CreatureScript me->setActive(true); _isIntro = false; - _events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_0, 6000); + _events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_0, 6000); _events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_1, 22000); _events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_2, 31000); _events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_3, 38000); @@ -400,11 +400,11 @@ class npc_xerestrasza : public CreatureScript _events.Update(diff); switch (_events.ExecuteEvent()) { - case EVENT_XERESTRASZA_EVENT_0: - Talk(SAY_XERESTRASZA_EVENT); - me->SetWalk(true); - me->GetMotionMaster()->MovePoint(0, 3151.236f, 379.8733f, 86.31996f); - break; + case EVENT_XERESTRASZA_EVENT_0: + Talk(SAY_XERESTRASZA_EVENT); + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(0, 3151.236f, 379.8733f, 86.31996f); + break; case EVENT_XERESTRASZA_EVENT_1: Talk(SAY_XERESTRASZA_EVENT_1); break; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp index b5de2f244..5df6762a0 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp @@ -34,13 +34,13 @@ enum Misc EVENT_INTIDMDATING_ROAR = 2, EVENT_SUMMON_ADDS1 = 3, EVENT_SUMMON_ADDS2 = 4, - EVENT_KILL_TALK = 5, + EVENT_KILL_TALK = 5, // Onyx Flamecaller EVENT_BLAST_NOVA = 6, EVENT_LAVA_GOUT = 7, - MAX_PATH_FLAMECALLER_WAYPOINTS = 12 + MAX_PATH_FLAMECALLER_WAYPOINTS = 12 }; // East @@ -90,21 +90,21 @@ class boss_general_zarithrian : public CreatureScript void Reset() { - BossAI::Reset(); + BossAI::Reset(); if (instance->GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && instance->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NOT_SELECTABLE); } void EnterCombat(Unit* who) { - BossAI::EnterCombat(who); + BossAI::EnterCombat(who); Talk(SAY_AGGRO); events.ScheduleEvent(EVENT_CLEAVE, 9000); events.ScheduleEvent(EVENT_INTIDMDATING_ROAR, 14000); events.ScheduleEvent(EVENT_SUMMON_ADDS1, 18000); - if (Is25ManRaid()) - events.ScheduleEvent(EVENT_SUMMON_ADDS2, 20000); + if (Is25ManRaid()) + events.ScheduleEvent(EVENT_SUMMON_ADDS2, 20000); } void JustSummoned(Creature* summon) @@ -114,17 +114,17 @@ class boss_general_zarithrian : public CreatureScript void JustDied(Unit* killer) { - BossAI::JustDied(killer); + BossAI::JustDied(killer); Talk(SAY_DEATH); } void KilledUnit(Unit* victim) { if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { + { Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } } void UpdateAI(uint32 diff) @@ -145,20 +145,20 @@ class boss_general_zarithrian : public CreatureScript if (Creature* stalker2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHRIAN_SPAWN_STALKER_2))) stalker2->CastSpell(stalker2, SPELL_SUMMON_FLAMECALLER, false); events.ScheduleEvent(EVENT_SUMMON_ADDS1, 40000); - break; + break; case EVENT_SUMMON_ADDS2: if (Creature* stalker1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHRIAN_SPAWN_STALKER_1))) stalker1->CastSpell(stalker1, SPELL_SUMMON_FLAMECALLER, false); if (Creature* stalker2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHRIAN_SPAWN_STALKER_2))) stalker2->CastSpell(stalker2, SPELL_SUMMON_FLAMECALLER, false); - events.ScheduleEvent(EVENT_SUMMON_ADDS2, 40000); + events.ScheduleEvent(EVENT_SUMMON_ADDS2, 40000); break; case EVENT_INTIDMDATING_ROAR: - me->CastSpell(me, SPELL_INTIMIDATING_ROAR, false); + me->CastSpell(me, SPELL_INTIMIDATING_ROAR, false); events.ScheduleEvent(EVENT_INTIDMDATING_ROAR, 30000); - break; + break; case EVENT_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE_ARMOR, false); + me->CastSpell(me->GetVictim(), SPELL_CLEAVE_ARMOR, false); events.ScheduleEvent(EVENT_CLEAVE, 15000); break; } @@ -166,11 +166,11 @@ class boss_general_zarithrian : public CreatureScript DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(); } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetPositionX() > 3060.0f; - } + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetPositionX() > 3060.0f; + } }; CreatureAI* GetAI(Creature* creature) const @@ -220,7 +220,7 @@ class npc_onyx_flamecaller : public CreatureScript void WaypointReached(uint32 waypointId) { if (waypointId == MAX_PATH_FLAMECALLER_WAYPOINTS) - me->SetInCombatWithZone(); + me->SetInCombatWithZone(); } void AddWaypoints() diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 68a8828d8..cdeb03bc1 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -46,7 +46,7 @@ enum Spells SPELL_METEOR_STRIKE_TARGETING = 74638, SPELL_TAIL_LASH = 74531, - // Combustion / Consumption + // Combustion / Consumption SPELL_SCALE_AURA = 70507, SPELL_FIERY_COMBUSTION = 74562, SPELL_MARK_OF_COMBUSTION = 74567, @@ -61,14 +61,14 @@ enum Spells // Meteor Strike SPELL_METEOR_STRIKE = 74637, - SPELL_SUMMON_METEOR_STRIKE1 = 74680, - SPELL_SUMMON_METEOR_STRIKE2 = 74681, - SPELL_SUMMON_METEOR_STRIKE3 = 74682, - SPELL_SUMMON_METEOR_STRIKE4 = 74683, - SPELL_SUMMON_METEOR_FLAME1 = 74687, - SPELL_SUMMON_METEOR_FLAME2 = 74688, - SPELL_SUMMON_METEOR_FLAME3 = 74689, - SPELL_METEOR_STRIKE_SPREAD = 74696, + SPELL_SUMMON_METEOR_STRIKE1 = 74680, + SPELL_SUMMON_METEOR_STRIKE2 = 74681, + SPELL_SUMMON_METEOR_STRIKE3 = 74682, + SPELL_SUMMON_METEOR_STRIKE4 = 74683, + SPELL_SUMMON_METEOR_FLAME1 = 74687, + SPELL_SUMMON_METEOR_FLAME2 = 74688, + SPELL_SUMMON_METEOR_FLAME3 = 74689, + SPELL_METEOR_STRIKE_SPREAD = 74696, SPELL_METEOR_STRIKE_COUNTDOWN = 74641, SPELL_METEOR_STRIKE_AOE_DAMAGE = 74648, SPELL_METEOR_STRIKE_FIRE_AURA_1 = 74713, @@ -111,14 +111,14 @@ enum Events EVENT_METEOR_STRIKE = 4, EVENT_FIERY_COMBUSTION = 5, EVENT_TAIL_LASH = 6, - EVENT_CHECK_HEALTH = 7, - EVENT_KILL_TALK = 8, + EVENT_CHECK_HEALTH = 7, + EVENT_KILL_TALK = 8, EVENT_TRIGGER_BERSERK = 9, - EVENT_HALION_VISIBILITY = 10, + EVENT_HALION_VISIBILITY = 10, // Twilight Halion EVENT_SOUL_CONSUMPTION = 20, - EVENT_SHADOW_PULSARS = 21, + EVENT_SHADOW_PULSARS = 21, EVENT_SHADOW_PULSARS_SHOOT = 22, EVENT_CHECK_CORPOREALITY = 23, EVENT_TWILIGHT_MENDING = 24, @@ -134,17 +134,17 @@ enum Events enum Misc { - ACTION_SHOOT = 1, - ACTION_CHECK_CORPOREALITY = 2, - ACTION_RESET_ENCOUNTER = 3, + ACTION_SHOOT = 1, + ACTION_CHECK_CORPOREALITY = 2, + ACTION_RESET_ENCOUNTER = 3, - DATA_TWILIGHT_DAMAGE_TAKEN = 1, - DATA_MATERIAL_DAMAGE_TAKEN = 2, + DATA_TWILIGHT_DAMAGE_TAKEN = 1, + DATA_MATERIAL_DAMAGE_TAKEN = 2, - SEAT_NORTH = 0, - SEAT_SOUTH = 1, - SEAT_EAST = 2, - SEAT_WEST = 3 + SEAT_NORTH = 0, + SEAT_SOUTH = 1, + SEAT_EAST = 2, + SEAT_WEST = 3 }; enum CorporealityEvent @@ -153,7 +153,7 @@ enum CorporealityEvent CORPOREALITY_TWILIGHT_MENDING = 1, CORPOREALITY_INCREASE = 2, CORPOREALITY_DECREASE = 3, - MAX_CORPOREALITY_STATE = 11 + MAX_CORPOREALITY_STATE = 11 }; uint32 const _corporealityReference[MAX_CORPOREALITY_STATE] = @@ -168,19 +168,19 @@ class SendEncounterUnit : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - InstanceScript* instance = _owner->GetInstanceScript(); - if (!instance || _owner->GetMapId() != 724) - return true; + InstanceScript* instance = _owner->GetInstanceScript(); + if (!instance || _owner->GetMapId() != 724) + return true; - if (instance->GetBossState(DATA_HALION) != IN_PROGRESS) - { - _owner->RemoveAurasDueToSpell(SPELL_TWILIGHT_REALM); - return true; - } + if (instance->GetBossState(DATA_HALION) != IN_PROGRESS) + { + _owner->RemoveAurasDueToSpell(SPELL_TWILIGHT_REALM); + return true; + } - WorldPacket data(SMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT, 4); - data << uint32(ENCOUNTER_FRAME_REFRESH_FRAMES); - _owner->GetSession()->SendPacket(&data); + WorldPacket data(SMSG_UPDATE_INSTANCE_ENCOUNTER_UNIT, 4); + data << uint32(ENCOUNTER_FRAME_REFRESH_FRAMES); + _owner->GetSession()->SendPacket(&data); return true; } @@ -201,112 +201,112 @@ class boss_halion : public CreatureScript void Reset() { - _livingEmberCount = 0; + _livingEmberCount = 0; BossAI::Reset(); me->RemoveAurasDueToSpell(SPELL_TWILIGHT_PHASING); - me->CastSpell(me, SPELL_CLEAR_DEBUFFS, false); + me->CastSpell(me, SPELL_CLEAR_DEBUFFS, false); - me->SetVisible(false); - me->SetReactState(REACT_PASSIVE); - _events2.Reset(); - _events2.RescheduleEvent(EVENT_HALION_VISIBILITY, 30000); + me->SetVisible(false); + me->SetReactState(REACT_PASSIVE); + _events2.Reset(); + _events2.RescheduleEvent(EVENT_HALION_VISIBILITY, 30000); } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - switch (summon->GetEntry()) - { - case NPC_METEOR_STRIKE_MARK: - summon->CastSpell(summon, SPELL_METEOR_STRIKE_COUNTDOWN, false); - summon->CastSpell(summon, SPELL_BIRTH_NO_VISUAL, false); - break; - case NPC_METEOR_STRIKE_FLAME: - if (Is25ManRaid() && IsHeroic() && roll_chance_i(90) && summons.GetEntryCount(NPC_LIVING_EMBER) < _livingEmberCount + 12) - if (Creature* ember = me->SummonCreature(NPC_LIVING_EMBER, *summon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000)) - ember->SetVisible(false); - // no break - case NPC_METEOR_STRIKE_NORTH: - case NPC_METEOR_STRIKE_SOUTH: - case NPC_METEOR_STRIKE_WEST: - case NPC_METEOR_STRIKE_EAST: - summon->CastSpell(summon, SPELL_METEOR_STRIKE_FIRE_AURA_2, true); - if (summons.GetEntryCount(NPC_METEOR_STRIKE_FLAME) <= 16) - summon->CastSpell(summon, SPELL_METEOR_STRIKE_SPREAD, true); - if (Unit* summoner = summon->ToTempSummon()->GetSummoner()) - summon->SetOrientation(summoner->GetAngle(summon)); - break; - } - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + switch (summon->GetEntry()) + { + case NPC_METEOR_STRIKE_MARK: + summon->CastSpell(summon, SPELL_METEOR_STRIKE_COUNTDOWN, false); + summon->CastSpell(summon, SPELL_BIRTH_NO_VISUAL, false); + break; + case NPC_METEOR_STRIKE_FLAME: + if (Is25ManRaid() && IsHeroic() && roll_chance_i(90) && summons.GetEntryCount(NPC_LIVING_EMBER) < _livingEmberCount + 12) + if (Creature* ember = me->SummonCreature(NPC_LIVING_EMBER, *summon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000)) + ember->SetVisible(false); + // no break + case NPC_METEOR_STRIKE_NORTH: + case NPC_METEOR_STRIKE_SOUTH: + case NPC_METEOR_STRIKE_WEST: + case NPC_METEOR_STRIKE_EAST: + summon->CastSpell(summon, SPELL_METEOR_STRIKE_FIRE_AURA_2, true); + if (summons.GetEntryCount(NPC_METEOR_STRIKE_FLAME) <= 16) + summon->CastSpell(summon, SPELL_METEOR_STRIKE_SPREAD, true); + if (Unit* summoner = summon->ToTempSummon()->GetSummoner()) + summon->SetOrientation(summoner->GetAngle(summon)); + break; + } + } - bool CanAIAttack(const Unit* who) const - { - return me->GetHomePosition().GetExactDist2d(who) < 52.0f; - } + bool CanAIAttack(const Unit* who) const + { + return me->GetHomePosition().GetExactDist2d(who) < 52.0f; + } - bool IsAnyPlayerValid() - { - Map::PlayerList const& playerList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) - if (Player* player = itr->GetSource()) - if (!player->IsGameMaster() && player->IsAlive() && me->GetHomePosition().GetExactDist2d(player) < 52.0f && me->IsWithinLOSInMap(player) && !player->HasAuraType(SPELL_AURA_MOD_INVISIBILITY) && !player->HasAuraType(SPELL_AURA_MOD_STEALTH) && !player->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE)) - return true; - return false; - } + bool IsAnyPlayerValid() + { + Map::PlayerList const& playerList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) + if (Player* player = itr->GetSource()) + if (!player->IsGameMaster() && player->IsAlive() && me->GetHomePosition().GetExactDist2d(player) < 52.0f && me->IsWithinLOSInMap(player) && !player->HasAuraType(SPELL_AURA_MOD_INVISIBILITY) && !player->HasAuraType(SPELL_AURA_MOD_STEALTH) && !player->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE)) + return true; + return false; + } void EnterEvadeMode() { - if (IsAnyPlayerValid()) - return; + if (IsAnyPlayerValid()) + return; BossAI::EnterEvadeMode(); } - void AttackStart(Unit* who) - { - me->SetReactState(REACT_AGGRESSIVE); - BossAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + me->SetReactState(REACT_AGGRESSIVE); + BossAI::AttackStart(who); + } - void JustReachedHome() - { - instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + void JustReachedHome() + { + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_HALION_CONTROLLER))) controller->AI()->DoAction(ACTION_RESET_ENCOUNTER); - BossAI::JustReachedHome(); - } + BossAI::JustReachedHome(); + } void EnterCombat(Unit* who) { - BossAI::EnterCombat(who); + BossAI::EnterCombat(who); Talk(SAY_AGGRO); instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1); - events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); - events.ScheduleEvent(EVENT_TAIL_LASH, 10000); - events.ScheduleEvent(EVENT_BREATH, urand(10000, 15000)); + events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); + events.ScheduleEvent(EVENT_TAIL_LASH, 10000); + events.ScheduleEvent(EVENT_BREATH, urand(10000, 15000)); events.ScheduleEvent(EVENT_ACTIVATE_FIREWALL, 5000); events.ScheduleEvent(EVENT_METEOR_STRIKE, urand(20000, 25000)); events.ScheduleEvent(EVENT_FIERY_COMBUSTION, urand(15000, 18000)); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - _events2.ScheduleEvent(EVENT_TRIGGER_BERSERK, 8*MINUTE*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + _events2.ScheduleEvent(EVENT_TRIGGER_BERSERK, 8*MINUTE*IN_MILLISECONDS); } void KilledUnit(Unit* victim) { if (victim->GetTypeId() == TYPEID_PLAYER && events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { + { Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } } void JustDied(Unit* killer) { - BossAI::JustDied(killer); + BossAI::JustDied(killer); Talk(SAY_DEATH); instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - me->CastSpell(me, SPELL_CLEAR_DEBUFFS, false); + me->CastSpell(me, SPELL_CLEAR_DEBUFFS, false); if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_TWILIGHT_HALION))) if (twilightHalion->IsAlive()) @@ -320,89 +320,89 @@ class boss_halion : public CreatureScript void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) { if (events.GetNextEventTime(EVENT_CHECK_HEALTH) != 0) - return; + return; if (!attacker || !me->InSamePhase(attacker)) return; if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_HALION_CONTROLLER))) - controller->AI()->SetData(DATA_MATERIAL_DAMAGE_TAKEN, damage); + controller->AI()->SetData(DATA_MATERIAL_DAMAGE_TAKEN, damage); } void UpdateAI(uint32 diff) { - _events2.Update(diff); - switch (_events2.ExecuteEvent()) - { - case EVENT_HALION_VISIBILITY: - me->SetVisible(instance->GetBossState(DATA_HALION_INTRO_DONE) == DONE); - me->SetReactState(instance->GetBossState(DATA_HALION_INTRO_DONE) == DONE ? REACT_AGGRESSIVE : REACT_PASSIVE); - break; - case EVENT_TRIGGER_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); + _events2.Update(diff); + switch (_events2.ExecuteEvent()) + { + case EVENT_HALION_VISIBILITY: + me->SetVisible(instance->GetBossState(DATA_HALION_INTRO_DONE) == DONE); + me->SetReactState(instance->GetBossState(DATA_HALION_INTRO_DONE) == DONE ? REACT_AGGRESSIVE : REACT_PASSIVE); + break; + case EVENT_TRIGGER_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_TWILIGHT_HALION))) twilightHalion->CastSpell(twilightHalion, SPELL_BERSERK, true); - break; - } + break; + } if (!UpdateVictim()) return; - // Xinef: halion is invisible (second phase) - if (me->GetDisplayId() != me->GetNativeDisplayId()) - return; + // Xinef: halion is invisible (second phase) + if (me->GetDisplayId() != me->GetNativeDisplayId()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); - break; - case EVENT_TAIL_LASH: - me->CastSpell(me, SPELL_TAIL_LASH, false); - events.ScheduleEvent(EVENT_TAIL_LASH, 10000); - break; - case EVENT_BREATH: - me->CastSpell(me->GetVictim(), SPELL_FLAME_BREATH, false); - events.ScheduleEvent(EVENT_BREATH, urand(10000, 12000)); - break; + switch (events.ExecuteEvent()) + { + case EVENT_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); + break; + case EVENT_TAIL_LASH: + me->CastSpell(me, SPELL_TAIL_LASH, false); + events.ScheduleEvent(EVENT_TAIL_LASH, 10000); + break; + case EVENT_BREATH: + me->CastSpell(me->GetVictim(), SPELL_FLAME_BREATH, false); + events.ScheduleEvent(EVENT_BREATH, urand(10000, 12000)); + break; case EVENT_ACTIVATE_FIREWALL: instance->HandleGameObject(instance->GetData64(GO_FLAME_RING), false, NULL); instance->HandleGameObject(instance->GetData64(GO_TWILIGHT_FLAME_RING), false, NULL); break; case EVENT_METEOR_STRIKE: - _livingEmberCount = summons.GetEntryCount(NPC_LIVING_EMBER); + _livingEmberCount = summons.GetEntryCount(NPC_LIVING_EMBER); me->CastCustomSpell(SPELL_METEOR_STRIKE_TARGETING, SPELLVALUE_MAX_TARGETS, 1, me, false); Talk(SAY_METEOR_STRIKE); events.ScheduleEvent(EVENT_METEOR_STRIKE, 40000); break; case EVENT_FIERY_COMBUSTION: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true, -SPELL_TWILIGHT_REALM)) - me->CastSpell(target, SPELL_FIERY_COMBUSTION, false); + me->CastSpell(target, SPELL_FIERY_COMBUSTION, false); events.ScheduleEvent(EVENT_FIERY_COMBUSTION, 25000); break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(75)) - { - Talk(SAY_PHASE_TWO); - me->CastSpell(me, SPELL_TWILIGHT_PHASING, false); - events.DelayEvents(10000); - return; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - } + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(75)) + { + Talk(SAY_PHASE_TWO); + me->CastSpell(me, SPELL_TWILIGHT_PHASING, false); + events.DelayEvents(10000); + return; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } - private: - EventMap _events2; - uint32 _livingEmberCount; + private: + EventMap _events2; + uint32 _livingEmberCount; }; CreatureAI* GetAI(Creature* creature) const @@ -418,7 +418,7 @@ class boss_twilight_halion : public CreatureScript struct boss_twilight_halionAI : public ScriptedAI { - boss_twilight_halionAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) + boss_twilight_halionAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_HALION)); if (!halion) @@ -429,14 +429,14 @@ class boss_twilight_halion : public CreatureScript me->AddAura(SPELL_DUSK_SHROUD, me); me->SetHealth(halion->GetHealth()); - me->setActive(true); + me->setActive(true); } void Reset() { _events.Reset(); me->SetPhaseMask(0x21, true); - me->SetInCombatWithZone(); + me->SetInCombatWithZone(); me->SetPhaseMask(0x20, true); me->SetReactState(REACT_DEFENSIVE); } @@ -444,28 +444,28 @@ class boss_twilight_halion : public CreatureScript void EnterCombat(Unit* who) { _events.Reset(); - _events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); - _events.ScheduleEvent(EVENT_TAIL_LASH, 10000); - _events.ScheduleEvent(EVENT_BREATH, urand(10000, 15000)); + _events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); + _events.ScheduleEvent(EVENT_TAIL_LASH, 10000); + _events.ScheduleEvent(EVENT_BREATH, urand(10000, 15000)); _events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, 20000); _events.ScheduleEvent(EVENT_SHADOW_PULSARS, 16000); - _events.ScheduleEvent(EVENT_SEND_ENCOUNTER_UNIT, 2000); - _events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + _events.ScheduleEvent(EVENT_SEND_ENCOUNTER_UNIT, 2000); + _events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - me->SetInCombatWithZone(); + me->SetInCombatWithZone(); } void EnterEvadeMode() - { - } + { + } void KilledUnit(Unit* victim) { if (victim->GetTypeId() == TYPEID_PLAYER && _events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { + { Talk(SAY_KILL); - _events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } + _events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } } void JustDied(Unit* killer) @@ -477,7 +477,7 @@ class boss_twilight_halion : public CreatureScript halion->LowerPlayerDamageReq(halion->GetMaxHealth()); if (halion->IsAlive()) - Unit::Kill(killer, halion); + Unit::Kill(killer, halion); } if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_HALION_CONTROLLER))) @@ -485,7 +485,7 @@ class boss_twilight_halion : public CreatureScript Unit::Kill(controller, controller); _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - me->CastSpell(me, SPELL_CLEAR_DEBUFFS, false); + me->CastSpell(me, SPELL_CLEAR_DEBUFFS, false); } void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) @@ -493,69 +493,69 @@ class boss_twilight_halion : public CreatureScript if (!attacker || !me->InSamePhase(attacker)) return; - if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_HALION_CONTROLLER))) - controller->AI()->SetData(DATA_TWILIGHT_DAMAGE_TAKEN, damage); + if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_HALION_CONTROLLER))) + controller->AI()->SetData(DATA_TWILIGHT_DAMAGE_TAKEN, damage); } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + _events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (_events.ExecuteEvent()) - { - case EVENT_SEND_ENCOUNTER_UNIT: - _instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 2); - break; - case EVENT_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - _events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); - break; - case EVENT_TAIL_LASH: - me->CastSpell(me, SPELL_TAIL_LASH, false); - _events.ScheduleEvent(EVENT_TAIL_LASH, 10000); - break; - case EVENT_BREATH: - me->CastSpell(me->GetVictim(), SPELL_DARK_BREATH, false); - _events.ScheduleEvent(EVENT_BREATH, urand(10000, 12000)); - break; + switch (_events.ExecuteEvent()) + { + case EVENT_SEND_ENCOUNTER_UNIT: + _instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 2); + break; + case EVENT_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + _events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); + break; + case EVENT_TAIL_LASH: + me->CastSpell(me, SPELL_TAIL_LASH, false); + _events.ScheduleEvent(EVENT_TAIL_LASH, 10000); + break; + case EVENT_BREATH: + me->CastSpell(me->GetVictim(), SPELL_DARK_BREATH, false); + _events.ScheduleEvent(EVENT_BREATH, urand(10000, 12000)); + break; case EVENT_SOUL_CONSUMPTION: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true, SPELL_TWILIGHT_REALM)) - me->CastSpell(target, SPELL_SOUL_CONSUMPTION, false); + me->CastSpell(target, SPELL_SOUL_CONSUMPTION, false); _events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, 20000); break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(50)) - { - me->CastStop(); - me->CastSpell(me, SPELL_TWILIGHT_DIVISION, false); - Talk(SAY_PHASE_THREE); - return; - } - _events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_SHADOW_PULSARS: + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(50)) + { + me->CastStop(); + me->CastSpell(me, SPELL_TWILIGHT_DIVISION, false); + Talk(SAY_PHASE_THREE); + return; + } + _events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_SHADOW_PULSARS: Talk(SAY_SPHERE_PULSE); - Talk(EMOTE_WARN_LASER); + Talk(EMOTE_WARN_LASER); _events.ScheduleEvent(EVENT_SHADOW_PULSARS, 29000); _events.ScheduleEvent(EVENT_SHADOW_PULSARS_SHOOT, 5000); break; - case EVENT_SHADOW_PULSARS_SHOOT: + case EVENT_SHADOW_PULSARS_SHOOT: if (Creature* orbCarrier = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ORB_CARRIER))) orbCarrier->AI()->DoAction(ACTION_SHOOT); break; - } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } private: EventMap _events; - InstanceScript* _instance; + InstanceScript* _instance; }; CreatureAI* GetAI(Creature* creature) const @@ -582,33 +582,33 @@ class npc_halion_controller : public CreatureScript void SetData(uint32 id, uint32 value) { - if (_events.GetNextEventTime(EVENT_CHECK_CORPOREALITY) == 0) - return; + if (_events.GetNextEventTime(EVENT_CHECK_CORPOREALITY) == 0) + return; if (id == DATA_MATERIAL_DAMAGE_TAKEN) - _materialDamage += value; + _materialDamage += value; else - _twilightDamage += value; + _twilightDamage += value; } void DoAction(int32 action) { if (action == ACTION_INTRO_HALION) _events.ScheduleEvent(EVENT_START_INTRO, 2000); - else if (action == ACTION_CHECK_CORPOREALITY) - { - _materialDamage = 1; - _twilightDamage = 1; - _corporeality = 5; - _events.ScheduleEvent(EVENT_CHECK_CORPOREALITY, 7000); - } - else if (action == ACTION_RESET_ENCOUNTER) - { - _events.Reset(); - _materialDamage = 1; - _twilightDamage = 1; - _corporeality = 5; - } + else if (action == ACTION_CHECK_CORPOREALITY) + { + _materialDamage = 1; + _twilightDamage = 1; + _corporeality = 5; + _events.ScheduleEvent(EVENT_CHECK_CORPOREALITY, 7000); + } + else if (action == ACTION_RESET_ENCOUNTER) + { + _events.Reset(); + _materialDamage = 1; + _twilightDamage = 1; + _corporeality = 5; + } } void UpdateAI(uint32 diff) @@ -616,53 +616,53 @@ class npc_halion_controller : public CreatureScript _events.Update(diff); switch (_events.ExecuteEvent()) { - // Intro + // Intro case EVENT_START_INTRO: me->CastSpell(me, SPELL_COSMETIC_FIRE_PILLAR, false); _events.ScheduleEvent(EVENT_INTRO_PROGRESS_1, 5000); break; case EVENT_INTRO_PROGRESS_1: - _instance->SetBossState(DATA_HALION_INTRO1, NOT_STARTED); - _instance->SetBossState(DATA_HALION_INTRO1, DONE); + _instance->SetBossState(DATA_HALION_INTRO1, NOT_STARTED); + _instance->SetBossState(DATA_HALION_INTRO1, DONE); _events.ScheduleEvent(EVENT_INTRO_PROGRESS_2, 5000); break; case EVENT_INTRO_PROGRESS_2: - _instance->SetBossState(DATA_HALION_INTRO2, NOT_STARTED); - _instance->SetBossState(DATA_HALION_INTRO2, DONE); + _instance->SetBossState(DATA_HALION_INTRO2, NOT_STARTED); + _instance->SetBossState(DATA_HALION_INTRO2, DONE); _events.ScheduleEvent(EVENT_INTRO_PROGRESS_3, 4000); break; case EVENT_INTRO_PROGRESS_3: - _instance->SetBossState(DATA_HALION_INTRO_DONE, NOT_STARTED); - _instance->SetBossState(DATA_HALION_INTRO_DONE, DONE); - me->CastSpell(me, SPELL_FIERY_EXPLOSION, false); + _instance->SetBossState(DATA_HALION_INTRO_DONE, NOT_STARTED); + _instance->SetBossState(DATA_HALION_INTRO_DONE, DONE); + me->CastSpell(me, SPELL_FIERY_EXPLOSION, false); _events.ScheduleEvent(EVENT_INTRO_PROGRESS_4, 500); break; case EVENT_INTRO_PROGRESS_4: if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_HALION))) - { - halion->SetVisible(true); - halion->SetReactState(REACT_AGGRESSIVE); + { + halion->SetVisible(true); + halion->SetReactState(REACT_AGGRESSIVE); halion->AI()->Talk(SAY_INTRO); - } + } break; - case EVENT_TWILIGHT_MENDING: + case EVENT_TWILIGHT_MENDING: me->CastSpell((Unit*)NULL, SPELL_TWILIGHT_MENDING, true); break; case EVENT_CHECK_CORPOREALITY: UpdateCorporeality(); _events.ScheduleEvent(EVENT_CHECK_CORPOREALITY, 10000); - break; + break; } } - private: - void UpdateCorporeality() + private: + void UpdateCorporeality() { - if (!_instance->IsEncounterInProgress()) - { - DoAction(ACTION_RESET_ENCOUNTER); - return; - } + if (!_instance->IsEncounterInProgress()) + { + DoAction(ACTION_RESET_ENCOUNTER); + return; + } uint8 oldValue = _corporeality; float damageRatio = float(_materialDamage) / float(_twilightDamage); @@ -670,7 +670,7 @@ class npc_halion_controller : public CreatureScript if (_twilightDamage == 1 || _materialDamage == 1) _events.ScheduleEvent(EVENT_TWILIGHT_MENDING, 4000); - _twilightDamage = 1; + _twilightDamage = 1; _materialDamage = 1; CorporealityEvent action = CORPOREALITY_NONE; @@ -678,8 +678,8 @@ class npc_halion_controller : public CreatureScript action = CORPOREALITY_INCREASE; else if (1.02f < damageRatio) action = CORPOREALITY_DECREASE; - else - return; + else + return; switch (action) { @@ -702,26 +702,26 @@ class npc_halion_controller : public CreatureScript _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_MATERIAL, _corporeality * 10); _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TWILIGHT, 100 - _corporeality * 10); - if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_TWILIGHT_HALION))) - { - twilightHalion->RemoveAurasDueToSpell(_corporealityReference[MAX_CORPOREALITY_STATE - 1 - oldValue]); - twilightHalion->CastSpell(twilightHalion, _corporealityReference[MAX_CORPOREALITY_STATE - 1 - _corporeality], true); - twilightHalion->AI()->Talk(oldValue < _corporeality ? EMOTE_CORPOREALITY_TOT : EMOTE_CORPOREALITY_TIT); - } + if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_TWILIGHT_HALION))) + { + twilightHalion->RemoveAurasDueToSpell(_corporealityReference[MAX_CORPOREALITY_STATE - 1 - oldValue]); + twilightHalion->CastSpell(twilightHalion, _corporealityReference[MAX_CORPOREALITY_STATE - 1 - _corporeality], true); + twilightHalion->AI()->Talk(oldValue < _corporeality ? EMOTE_CORPOREALITY_TOT : EMOTE_CORPOREALITY_TIT); + } - if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_HALION))) - { - halion->RemoveAurasDueToSpell(_corporealityReference[oldValue]); - halion->CastSpell(halion, _corporealityReference[_corporeality], true); - halion->AI()->Talk(oldValue > _corporeality ? EMOTE_CORPOREALITY_POT : EMOTE_CORPOREALITY_PIP); - } + if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_HALION))) + { + halion->RemoveAurasDueToSpell(_corporealityReference[oldValue]); + halion->CastSpell(halion, _corporealityReference[_corporeality], true); + halion->AI()->Talk(oldValue > _corporeality ? EMOTE_CORPOREALITY_POT : EMOTE_CORPOREALITY_PIP); + } } EventMap _events; InstanceScript* _instance; - uint8 _corporeality; - uint32 _materialDamage; - uint32 _twilightDamage; + uint8 _corporeality; + uint32 _materialDamage; + uint32 _twilightDamage; }; CreatureAI* GetAI(Creature* creature) const @@ -794,7 +794,7 @@ class spell_halion_meteor_strike_targeting : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, SPELL_METEOR_STRIKE, true); + GetCaster()->CastSpell(target, SPELL_METEOR_STRIKE, true); } void Register() @@ -818,23 +818,23 @@ class spell_halion_meteor_strike_marker : public SpellScriptLoader { PrepareAuraScript(spell_halion_meteor_strike_marker_AuraScript); - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - SetDuration(6500); - } + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + SetDuration(6500); + } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) - { - if (!caster->GetInstanceScript() || !caster->GetInstanceScript()->IsEncounterInProgress()) - return; + { + if (!caster->GetInstanceScript() || !caster->GetInstanceScript()->IsEncounterInProgress()) + return; caster->CastSpell(caster, SPELL_METEOR_STRIKE_AOE_DAMAGE, true); caster->CastSpell(caster, SPELL_METEOR_STRIKE_FIRE_AURA_1, true); - for (uint32 spellId = SPELL_SUMMON_METEOR_STRIKE1; spellId <= SPELL_SUMMON_METEOR_STRIKE4; ++spellId) - caster->CastSpell(caster, spellId, true); - } + for (uint32 spellId = SPELL_SUMMON_METEOR_STRIKE1; spellId <= SPELL_SUMMON_METEOR_STRIKE4; ++spellId) + caster->CastSpell(caster, spellId, true); + } } void Register() @@ -862,10 +862,10 @@ class spell_halion_meteor_strike_spread : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); // xinef: 3/5 straight, 2/5 turn - if (!GetUnitOwner()->GetInstanceScript() || !GetUnitOwner()->GetInstanceScript()->IsEncounterInProgress()) - return; + if (!GetUnitOwner()->GetInstanceScript() || !GetUnitOwner()->GetInstanceScript()->IsEncounterInProgress()) + return; - GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_METEOR_FLAME1, SPELL_SUMMON_METEOR_FLAME2, SPELL_SUMMON_METEOR_FLAME2, SPELL_SUMMON_METEOR_FLAME2, SPELL_SUMMON_METEOR_FLAME3), true); + GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_METEOR_FLAME1, SPELL_SUMMON_METEOR_FLAME2, SPELL_SUMMON_METEOR_FLAME2, SPELL_SUMMON_METEOR_FLAME2, SPELL_SUMMON_METEOR_FLAME3), true); } void Register() @@ -891,9 +891,9 @@ class spell_halion_blazing_aura : public SpellScriptLoader void HandleForceCast(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); + PreventHitDefaultEffect(effIndex); if (Unit* target = GetHitUnit()) - target->CastSpell(target, GetSpellInfo()->Effects[effIndex].TriggerSpell, true); + target->CastSpell(target, GetSpellInfo()->Effects[effIndex].TriggerSpell, true); } void Register() @@ -922,7 +922,7 @@ class spell_halion_combustion_consumption : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetTarget()->RemoveAurasDueToSpell(_markSpell, 0, 0, AURA_REMOVE_BY_EXPIRE); + GetTarget()->RemoveAurasDueToSpell(_markSpell, 0, 0, AURA_REMOVE_BY_EXPIRE); } void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -963,7 +963,7 @@ class spell_halion_marks : public SpellScriptLoader { PrepareAuraScript(spell_halion_marks_AuraScript); - public: + public: spell_halion_marks_AuraScript(uint32 summonSpell, uint32 removeSpell) : AuraScript(), _summonSpellId(summonSpell), _removeSpellId(removeSpell) { } void BeforeDispel(DispelInfo* dispelData) @@ -980,8 +980,8 @@ class spell_halion_marks : public SpellScriptLoader if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) return; - if (!GetTarget()->GetInstanceScript() || !GetTarget()->GetInstanceScript()->IsEncounterInProgress() || GetTarget()->GetMapId() != 724) - return; + if (!GetTarget()->GetInstanceScript() || !GetTarget()->GetInstanceScript()->IsEncounterInProgress() || GetTarget()->GetMapId() != 724) + return; GetTarget()->CastCustomSpell(_summonSpellId, SPELLVALUE_BASE_POINT1, GetAura()->GetStackAmount(), GetTarget(), TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); } @@ -1015,7 +1015,7 @@ class spell_halion_damage_aoe_summon : public SpellScriptLoader { PrepareSpellScript(spell_halion_damage_aoe_summon_SpellScript); - public: + public: spell_halion_damage_aoe_summon_SpellScript(uint32 explosionSpell, uint32 auraSpell) : SpellScript(), _explosionSpell(explosionSpell), _auraSpell(auraSpell) { } void HandleSummon(SpellEffIndex effIndex) @@ -1029,23 +1029,23 @@ class spell_halion_damage_aoe_summon : public SpellScriptLoader Position pos; caster->GetPosition(&pos); if (Creature* summon = caster->GetMap()->SummonCreature(entry, pos, properties, duration, caster, GetSpellInfo()->Id)) - { - bool heroic = summon->GetMap()->IsHeroic(); - bool raid = summon->GetMap()->Is25ManRaid(); + { + bool heroic = summon->GetMap()->IsHeroic(); + bool raid = summon->GetMap()->Is25ManRaid(); - if (heroic) - summon->SetPhaseMask(0x01|0x20, true); - else if (summon->GetEntry() == NPC_COMBUSTION) - summon->SetPhaseMask(0x01, true); - else - summon->SetPhaseMask(0x20, true); + if (heroic) + summon->SetPhaseMask(0x01|0x20, true); + else if (summon->GetEntry() == NPC_COMBUSTION) + summon->SetPhaseMask(0x01, true); + else + summon->SetPhaseMask(0x20, true); - summon->CastCustomSpell(SPELL_SCALE_AURA, SPELLVALUE_AURA_STACK, GetSpellValue()->EffectBasePoints[EFFECT_1], summon); - summon->CastSpell(summon, _auraSpell, true); + summon->CastCustomSpell(SPELL_SCALE_AURA, SPELLVALUE_AURA_STACK, GetSpellValue()->EffectBasePoints[EFFECT_1], summon); + summon->CastSpell(summon, _auraSpell, true); - int32 damage = int32((1500 + (GetSpellValue()->EffectBasePoints[EFFECT_1] * 1250)) * (heroic ? 1.25f : 1.0f) * (raid ? 1.5f : 1.0f)); - caster->CastCustomSpell(_explosionSpell, SPELLVALUE_BASE_POINT0, damage, caster); - } + int32 damage = int32((1500 + (GetSpellValue()->EffectBasePoints[EFFECT_1] * 1250)) * (heroic ? 1.25f : 1.0f) * (raid ? 1.5f : 1.0f)); + caster->CastCustomSpell(_explosionSpell, SPELLVALUE_BASE_POINT0, damage, caster); + } } void Register() @@ -1078,12 +1078,12 @@ class spell_halion_clear_debuffs : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - if (Unit* target = GetHitUnit()) - { - GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); - GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Effects[EFFECT_1].CalcValue()); - GetHitUnit()->RemoveAurasDueToSpell(SPELL_FIERY_COMBUSTION); - } + if (Unit* target = GetHitUnit()) + { + GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); + GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Effects[EFFECT_1].CalcValue()); + GetHitUnit()->RemoveAurasDueToSpell(SPELL_FIERY_COMBUSTION); + } } void Register() @@ -1107,10 +1107,10 @@ class spell_halion_twilight_phasing : public SpellScriptLoader { PrepareSpellScript(spell_halion_twilight_phasing_SpellScript); - bool Load() - { - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } void Phase() { @@ -1134,30 +1134,30 @@ class spell_halion_twilight_phasing : public SpellScriptLoader { PrepareAuraScript(spell_halion_twilight_phasing_AuraScript); - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/) + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/) { GetTarget()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - GetTarget()->ToCreature()->SetReactState(REACT_DEFENSIVE); - GetTarget()->GetMotionMaster()->Clear(); - GetTarget()->getThreatManager().clearReferences(); - GetTarget()->RemoveAllAttackers(); - GetTarget()->AttackStop(); + GetTarget()->ToCreature()->SetReactState(REACT_DEFENSIVE); + GetTarget()->GetMotionMaster()->Clear(); + GetTarget()->getThreatManager().clearReferences(); + GetTarget()->RemoveAllAttackers(); + GetTarget()->AttackStop(); } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/) { GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - GetTarget()->ToCreature()->SetReactState(REACT_DEFENSIVE); - GetTarget()->GetMotionMaster()->Clear(); - GetTarget()->getThreatManager().clearReferences(); - GetTarget()->RemoveAllAttackers(); - GetTarget()->AttackStop(); + GetTarget()->ToCreature()->SetReactState(REACT_DEFENSIVE); + GetTarget()->GetMotionMaster()->Clear(); + GetTarget()->getThreatManager().clearReferences(); + GetTarget()->RemoveAllAttackers(); + GetTarget()->AttackStop(); } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_halion_twilight_phasing_AuraScript::OnApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_halion_twilight_phasing_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_halion_twilight_phasing_AuraScript::OnApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_halion_twilight_phasing_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); } }; @@ -1176,21 +1176,21 @@ class spell_halion_twilight_realm : public SpellScriptLoader { PrepareAuraScript(spell_halion_twilight_realm_AuraScript); - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/) + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/) { Unit* target = GetTarget(); if (!target) return; - target->RemoveAurasDueToSpell(SPELL_FIERY_COMBUSTION, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); - if (GetTarget()->GetTypeId() != TYPEID_PLAYER) - return; - GetTarget()->m_Events.AddEvent(new SendEncounterUnit(GetTarget()->ToPlayer()), GetTarget()->m_Events.CalculateTime(500)); + target->RemoveAurasDueToSpell(SPELL_FIERY_COMBUSTION, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) + return; + GetTarget()->m_Events.AddEvent(new SendEncounterUnit(GetTarget()->ToPlayer()), GetTarget()->m_Events.CalculateTime(500)); } void Register() { - AfterEffectApply += AuraEffectApplyFn(spell_halion_twilight_realm_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PHASE, AURA_EFFECT_HANDLE_REAL); + AfterEffectApply += AuraEffectApplyFn(spell_halion_twilight_realm_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PHASE, AURA_EFFECT_HANDLE_REAL); } }; @@ -1209,7 +1209,7 @@ class spell_halion_leave_twilight_realm : public SpellScriptLoader { PrepareAuraScript(spell_halion_leave_twilight_realm_AuraScript); - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/) + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/) { Unit* target = GetTarget(); if (!target) @@ -1222,9 +1222,9 @@ class spell_halion_leave_twilight_realm : public SpellScriptLoader { GetTarget()->RemoveAurasDueToSpell(SPELL_TWILIGHT_REALM); - if (GetTarget()->GetTypeId() != TYPEID_PLAYER) - return; - GetTarget()->m_Events.AddEvent(new SendEncounterUnit(GetTarget()->ToPlayer()), GetTarget()->m_Events.CalculateTime(500)); + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) + return; + GetTarget()->m_Events.AddEvent(new SendEncounterUnit(GetTarget()->ToPlayer()), GetTarget()->m_Events.CalculateTime(500)); } void Register() @@ -1252,7 +1252,7 @@ class spell_halion_twilight_cutter_periodic : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - GetUnitOwner()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + GetUnitOwner()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); } void Register() @@ -1296,12 +1296,12 @@ class spell_halion_twilight_cutter : public SpellScriptLoader if (unitList.empty()) return; - if (Aura* cutter = GetCaster()->GetAura(SPELL_TWILIGHT_CUTTER)) - if (Unit* cutterCaster = cutter->GetCaster()) - { - unitList.remove_if(TwilightCutterSelector(GetCaster(), cutterCaster)); - return; - } + if (Aura* cutter = GetCaster()->GetAura(SPELL_TWILIGHT_CUTTER)) + if (Unit* cutterCaster = cutter->GetCaster()) + { + unitList.remove_if(TwilightCutterSelector(GetCaster(), cutterCaster)); + return; + } unitList.clear(); } @@ -1330,11 +1330,11 @@ class spell_halion_summon_exit_portals : public SpellScriptLoader void OnSummon(SpellEffIndex effIndex) { WorldLocation summonPos = *GetExplTargetDest(); - Position offset = {0.0f, 0.0f, 0.0f, 0.0f}; - if (GetSpellInfo()->Id == SPELL_SUMMON_EXIT_PORTALS) - offset.m_positionY = effIndex == EFFECT_1 ? -35.0f : 35.0f; - else - offset.m_positionX = effIndex == EFFECT_1 ? -35.0f : 35.0f; + Position offset = {0.0f, 0.0f, 0.0f, 0.0f}; + if (GetSpellInfo()->Id == SPELL_SUMMON_EXIT_PORTALS) + offset.m_positionY = effIndex == EFFECT_1 ? -35.0f : 35.0f; + else + offset.m_positionX = effIndex == EFFECT_1 ? -35.0f : 35.0f; summonPos.RelocateOffset(offset); @@ -1366,24 +1366,24 @@ class spell_halion_twilight_division : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - InstanceScript* instance = GetCaster()->GetInstanceScript(); - Creature* controller = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_HALION_CONTROLLER)); - Creature* halion = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_HALION)); + InstanceScript* instance = GetCaster()->GetInstanceScript(); + Creature* controller = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_HALION_CONTROLLER)); + Creature* halion = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_HALION)); - if (!controller || !halion) - return; + if (!controller || !halion) + return; GetCaster()->CastSpell(GetCaster(), _corporealityReference[5], true); - halion->CastSpell(halion, _corporealityReference[5], true); + halion->CastSpell(halion, _corporealityReference[5], true); - controller->CastSpell(controller, SPELL_SUMMON_EXIT_PORTALS_NORMAL, true); - controller->CastSpell(controller, SPELL_SUMMON_EXIT_PORTALS, true); - controller->AI()->DoAction(ACTION_CHECK_CORPOREALITY); + controller->CastSpell(controller, SPELL_SUMMON_EXIT_PORTALS_NORMAL, true); + controller->CastSpell(controller, SPELL_SUMMON_EXIT_PORTALS, true); + controller->AI()->DoAction(ACTION_CHECK_CORPOREALITY); halion->RemoveAurasDueToSpell(SPELL_TWILIGHT_PHASING); - if (GameObject* gobject = halion->FindNearestGameObject(GO_HALION_PORTAL_1, 100.0f)) - gobject->Delete(); - + if (GameObject* gobject = halion->FindNearestGameObject(GO_HALION_PORTAL_1, 100.0f)) + gobject->Delete(); + instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TOGGLE, 1); instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_MATERIAL, 50); instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TWILIGHT, 50); @@ -1412,8 +1412,8 @@ class spell_halion_twilight_mending : public SpellScriptLoader void HandleHealPct(SpellEffIndex effIndex) { - if (Creature* target = GetHitCreature()) - target->AI()->Talk(SAY_REGENERATE); + if (Creature* target = GetHitCreature()) + target->AI()->Talk(SAY_REGENERATE); } void Register() @@ -1435,10 +1435,10 @@ void AddSC_boss_halion() new npc_halion_controller(); new npc_orb_carrier(); - new spell_halion_meteor_strike_targeting(); + new spell_halion_meteor_strike_targeting(); new spell_halion_meteor_strike_marker(); - new spell_halion_meteor_strike_spread(); - new spell_halion_blazing_aura(); + new spell_halion_meteor_strike_spread(); + new spell_halion_blazing_aura(); new spell_halion_combustion_consumption("spell_halion_soul_consumption", SPELL_MARK_OF_CONSUMPTION); new spell_halion_combustion_consumption("spell_halion_fiery_combustion", SPELL_MARK_OF_COMBUSTION); new spell_halion_marks("spell_halion_mark_of_combustion", SPELL_FIERY_COMBUSTION_SUMMON, SPELL_FIERY_COMBUSTION); @@ -1447,11 +1447,11 @@ void AddSC_boss_halion() new spell_halion_damage_aoe_summon("spell_halion_consumption_summon", SPELL_SOUL_CONSUMPTION_EXPLOSION, SPELL_CONSUMPTION_DAMAGE_AURA); new spell_halion_clear_debuffs(); new spell_halion_twilight_phasing(); - new spell_halion_twilight_realm(); - new spell_halion_leave_twilight_realm(); - new spell_halion_twilight_cutter_periodic(); + new spell_halion_twilight_realm(); + new spell_halion_leave_twilight_realm(); + new spell_halion_twilight_cutter_periodic(); new spell_halion_twilight_cutter(); new spell_halion_summon_exit_portals(); - new spell_halion_twilight_division(); - new spell_halion_twilight_mending(); + new spell_halion_twilight_division(); + new spell_halion_twilight_mending(); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp index 43d6d471b..e13751cc4 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp @@ -8,19 +8,19 @@ REWRITTEN BY XINEF enum Texts { - SAY_AGGRO = 0, - SAY_CONFLAGRATION = 1, - EMOTE_ENRAGED = 2, - SAY_KILL = 3 + SAY_AGGRO = 0, + SAY_CONFLAGRATION = 1, + EMOTE_ENRAGED = 2, + SAY_KILL = 3 }; enum Spells { - SPELL_CONFLAGRATION = 74452, - SPELL_FLAME_BEACON = 74453, - SPELL_CONFLAGRATION_MISSLE = 74454, - SPELL_ENRAGE = 78722, - SPELL_FLAME_BREATH = 74403, + SPELL_CONFLAGRATION = 74452, + SPELL_FLAME_BEACON = 74453, + SPELL_CONFLAGRATION_MISSLE = 74454, + SPELL_ENRAGE = 78722, + SPELL_FLAME_BREATH = 74403, }; enum Events @@ -31,8 +31,8 @@ enum Events EVENT_CONFLAGRATION = 4, EVENT_LAND_GROUND = 5, EVENT_AIR_MOVEMENT = 6, - EVENT_LAND_BACK = 7, - EVENT_KILL_TALK = 8 + EVENT_LAND_BACK = 7, + EVENT_KILL_TALK = 8 }; enum Misc @@ -57,13 +57,13 @@ class boss_saviana_ragefire : public CreatureScript void Reset() { - BossAI::Reset(); + BossAI::Reset(); me->SetReactState(REACT_AGGRESSIVE); } void EnterCombat(Unit* who) { - BossAI::EnterCombat(who); + BossAI::EnterCombat(who); Talk(SAY_AGGRO); events.ScheduleEvent(EVENT_ENRAGE, 15000); @@ -73,7 +73,7 @@ class boss_saviana_ragefire : public CreatureScript void JustDied(Unit* killer) { - BossAI::JustDied(killer); + BossAI::JustDied(killer); me->PlayDirectSound(SOUND_ID_DEATH); } @@ -85,13 +85,13 @@ class boss_saviana_ragefire : public CreatureScript switch (point) { case POINT_FLIGHT: - me->SetFacingTo(4.69f); + me->SetFacingTo(4.69f); events.ScheduleEvent(EVENT_CONFLAGRATION, 1000); - events.ScheduleEvent(EVENT_LAND_BACK, 7000); + events.ScheduleEvent(EVENT_LAND_BACK, 7000); Talk(SAY_CONFLAGRATION); break; case POINT_LAND: - me->SetDisableGravity(false); + me->SetDisableGravity(false); events.ScheduleEvent(EVENT_LAND_GROUND, 500); break; } @@ -99,18 +99,18 @@ class boss_saviana_ragefire : public CreatureScript void JustReachedHome() { - BossAI::JustReachedHome(); + BossAI::JustReachedHome(); me->SetDisableGravity(false); - me->SetHover(false); + me->SetHover(false); } void KilledUnit(Unit* victim) { if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { + { Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } } void UpdateAI(uint32 diff) @@ -128,15 +128,15 @@ class boss_saviana_ragefire : public CreatureScript { me->SetReactState(REACT_PASSIVE); me->AttackStop(); - me->SetDisableGravity(true); - me->GetMotionMaster()->MovePoint(POINT_TAKEOFF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+6.0f, false); + me->SetDisableGravity(true); + me->GetMotionMaster()->MovePoint(POINT_TAKEOFF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+6.0f, false); events.ScheduleEvent(EVENT_FLIGHT, 50000); events.DelayEvents(15000); events.ScheduleEvent(EVENT_AIR_MOVEMENT, 2000); break; } case EVENT_CONFLAGRATION: - me->CastCustomSpell(SPELL_CONFLAGRATION, SPELLVALUE_MAX_TARGETS, RAID_MODE(3, 6, 3, 6), me, true); + me->CastCustomSpell(SPELL_CONFLAGRATION, SPELLVALUE_MAX_TARGETS, RAID_MODE(3, 6, 3, 6), me, true); break; case EVENT_ENRAGE: me->CastSpell(me, SPELL_ENRAGE, false); @@ -150,13 +150,13 @@ class boss_saviana_ragefire : public CreatureScript case EVENT_AIR_MOVEMENT: me->GetMotionMaster()->MovePoint(POINT_FLIGHT, 3155.51f, 683.844f, 95.0f, false); break; - case EVENT_LAND_BACK: - me->GetMotionMaster()->MovePoint(POINT_LAND, 3151.07f, 636.443f, 80.0f, false); - break; + case EVENT_LAND_BACK: + me->GetMotionMaster()->MovePoint(POINT_LAND, 3151.07f, 636.443f, 80.0f, false); + break; case EVENT_LAND_GROUND: me->SetReactState(REACT_AGGRESSIVE); - if (me->GetVictim()) - me->GetMotionMaster()->MoveChase(me->GetVictim()); + if (me->GetVictim()) + me->GetMotionMaster()->MoveChase(me->GetVictim()); break; } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index 5da488d9c..c3e03e940 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -12,14 +12,14 @@ REWRITTEN BY XINEF DoorData const doorData[] = { {GO_FIRE_FIELD, DATA_BALTHARUS_THE_WARBORN, DOOR_TYPE_PASSAGE, BOUNDARY_E }, - {GO_FLAME_WALLS, DATA_SAVIANA_RAGEFIRE, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, - {GO_FLAME_WALLS, DATA_BALTHARUS_THE_WARBORN, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, - {GO_FLAME_WALLS, DATA_GENERAL_ZARITHRIAN, DOOR_TYPE_ROOM, BOUNDARY_NONE}, - {GO_BURNING_TREE_4, DATA_HALION_INTRO1, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, - {GO_BURNING_TREE_3, DATA_HALION_INTRO1, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, - {GO_BURNING_TREE_2, DATA_HALION_INTRO2, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, - {GO_BURNING_TREE_1, DATA_HALION_INTRO2, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, - {GO_TWILIGHT_FLAME_RING, DATA_HALION, DOOR_TYPE_ROOM, BOUNDARY_NONE}, + {GO_FLAME_WALLS, DATA_SAVIANA_RAGEFIRE, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_FLAME_WALLS, DATA_BALTHARUS_THE_WARBORN, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_FLAME_WALLS, DATA_GENERAL_ZARITHRIAN, DOOR_TYPE_ROOM, BOUNDARY_NONE}, + {GO_BURNING_TREE_4, DATA_HALION_INTRO1, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_BURNING_TREE_3, DATA_HALION_INTRO1, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_BURNING_TREE_2, DATA_HALION_INTRO2, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_BURNING_TREE_1, DATA_HALION_INTRO2, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, + {GO_TWILIGHT_FLAME_RING, DATA_HALION, DOOR_TYPE_ROOM, BOUNDARY_NONE}, {0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE}, }; @@ -89,18 +89,18 @@ class instance_ruby_sanctum : public InstanceMapScript OrbCarrierGUID = creature->GetGUID(); break; - case NPC_LIVING_INFERNO: - case NPC_LIVING_EMBER: - case NPC_METEOR_STRIKE_NORTH: - case NPC_METEOR_STRIKE_SOUTH: - case NPC_METEOR_STRIKE_EAST: - case NPC_METEOR_STRIKE_WEST: - case NPC_METEOR_STRIKE_FLAME: - case NPC_COMBUSTION: - case NPC_CONSUMPTION: - if (Creature* halion = instance->GetCreature(HalionGUID)) - halion->AI()->JustSummoned(creature); - break; + case NPC_LIVING_INFERNO: + case NPC_LIVING_EMBER: + case NPC_METEOR_STRIKE_NORTH: + case NPC_METEOR_STRIKE_SOUTH: + case NPC_METEOR_STRIKE_EAST: + case NPC_METEOR_STRIKE_WEST: + case NPC_METEOR_STRIKE_FLAME: + case NPC_COMBUSTION: + case NPC_CONSUMPTION: + if (Creature* halion = instance->GetCreature(HalionGUID)) + halion->AI()->JustSummoned(creature); + break; } } @@ -115,7 +115,7 @@ class instance_ruby_sanctum : public InstanceMapScript case GO_BURNING_TREE_2: case GO_BURNING_TREE_3: case GO_BURNING_TREE_4: - case GO_TWILIGHT_FLAME_RING: + case GO_TWILIGHT_FLAME_RING: AddDoor(go, true); break; case GO_FLAME_RING: @@ -147,8 +147,8 @@ class instance_ruby_sanctum : public InstanceMapScript return BaltharusTheWarbornGUID; case NPC_XERESTRASZA: return XerestraszaGUID; - case NPC_GENERAL_ZARITHRIAN: - return GeneralZarithrianGUID; + case NPC_GENERAL_ZARITHRIAN: + return GeneralZarithrianGUID; case DATA_ZARITHRIAN_SPAWN_STALKER_1: case DATA_ZARITHRIAN_SPAWN_STALKER_2: return ZarithrianSpawnStalkerGUID[type - DATA_ZARITHRIAN_SPAWN_STALKER_1]; @@ -160,7 +160,7 @@ class instance_ruby_sanctum : public InstanceMapScript return TwilightHalionGUID; case NPC_ORB_CARRIER: return OrbCarrierGUID; - + case GO_FLAME_RING: return FlameRingGUID; } @@ -181,11 +181,11 @@ class instance_ruby_sanctum : public InstanceMapScript if (Creature* zarithrian = instance->GetCreature(GeneralZarithrianGUID)) zarithrian->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); break; - case DATA_GENERAL_ZARITHRIAN: - if (state == DONE) - if (Creature* halionController = instance->GetCreature(HalionControllerGUID)) - halionController->AI()->DoAction(ACTION_INTRO_HALION); - break; + case DATA_GENERAL_ZARITHRIAN: + if (state == DONE) + if (Creature* halionController = instance->GetCreature(HalionControllerGUID)) + halionController->AI()->DoAction(ACTION_INTRO_HALION); + break; case DATA_HALION: DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TOGGLE, 0); DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TWILIGHT, 0); @@ -242,12 +242,12 @@ class instance_ruby_sanctum : public InstanceMapScript SetBossState(i, EncounterState(tmpState)); } - // Xinef: additional check - if (GetBossState(DATA_HALION_INTRO_DONE) != DONE) - { - SetBossState(DATA_HALION_INTRO1, NOT_STARTED); - SetBossState(DATA_HALION_INTRO2, NOT_STARTED); - } + // Xinef: additional check + if (GetBossState(DATA_HALION_INTRO_DONE) != DONE) + { + SetBossState(DATA_HALION_INTRO1, NOT_STARTED); + SetBossState(DATA_HALION_INTRO2, NOT_STARTED); + } } else OUT_LOAD_INST_DATA_FAIL; @@ -285,13 +285,13 @@ class spell_ruby_sanctum_rallying_shout : public SpellScriptLoader void CountAllies() { - uint32 count = GetSpell()->GetUniqueTargetInfo()->size(); - if (count == GetCaster()->GetAuraCount(SPELL_RALLY)) - return; + uint32 count = GetSpell()->GetUniqueTargetInfo()->size(); + if (count == GetCaster()->GetAuraCount(SPELL_RALLY)) + return; - GetCaster()->RemoveAurasDueToSpell(SPELL_RALLY); - if (count > 0) - GetCaster()->CastCustomSpell(SPELL_RALLY, SPELLVALUE_AURA_STACK, count, GetCaster(), true); + GetCaster()->RemoveAurasDueToSpell(SPELL_RALLY); + if (count > 0) + GetCaster()->CastCustomSpell(SPELL_RALLY, SPELLVALUE_AURA_STACK, count, GetCaster(), true); } void Register() @@ -309,5 +309,5 @@ class spell_ruby_sanctum_rallying_shout : public SpellScriptLoader void AddSC_instance_ruby_sanctum() { new instance_ruby_sanctum(); - new spell_ruby_sanctum_rallying_shout(); + new spell_ruby_sanctum_rallying_shout(); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h index 9f972f279..be7006015 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h @@ -17,12 +17,12 @@ enum DataTypes DATA_BALTHARUS_THE_WARBORN = 0, DATA_GENERAL_ZARITHRIAN = 1, DATA_SAVIANA_RAGEFIRE = 2, - DATA_HALION_INTRO1 = 3, - DATA_HALION_INTRO2 = 4, - DATA_HALION_INTRO_DONE = 5, + DATA_HALION_INTRO1 = 3, + DATA_HALION_INTRO2 = 4, + DATA_HALION_INTRO_DONE = 5, DATA_HALION = 6, - - MAX_ENCOUNTERS = 7, + + MAX_ENCOUNTERS = 7, // Etc DATA_ZARITHRIAN_SPAWN_STALKER_1 = 8, @@ -92,7 +92,7 @@ enum WorldStatesRS enum InstanceSpell { SPELL_BERSERK = 26662, - SPELL_RALLY = 75416 + SPELL_RALLY = 75416 }; #endif // RUBY_SANCTUM_H_ diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index b10bce8c2..6cd687e8c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -10,792 +10,792 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum EadricSpells { - //Eadric - SPELL_EADRIC_ACHIEVEMENT = 68197, - ACHIEV_FACEROLLER = 3803, + //Eadric + SPELL_EADRIC_ACHIEVEMENT = 68197, + ACHIEV_FACEROLLER = 3803, - SPELL_RADIANCE = 66935, - SPELL_VENGEANCE = 66865, - SPELL_HAMMER_JUSTICE = 66863, - SPELL_HAMMER_RIGHTEOUS = 66867, - SPELL_HAMMER_RIGHTEOUS_DAMAGE = 66903, - SPELL_HAMMER_RIGHTEOUS_ACTION_BAR = 66904, - SPELL_HAMMER_RIGHTEOUS_THROW_BACK = 66905, + SPELL_RADIANCE = 66935, + SPELL_VENGEANCE = 66865, + SPELL_HAMMER_JUSTICE = 66863, + SPELL_HAMMER_RIGHTEOUS = 66867, + SPELL_HAMMER_RIGHTEOUS_DAMAGE = 66903, + SPELL_HAMMER_RIGHTEOUS_ACTION_BAR = 66904, + SPELL_HAMMER_RIGHTEOUS_THROW_BACK = 66905, }; enum EadricEvents { - EVENT_SPELL_RADIANCE = 1, - EVENT_SPELL_HAMMER_RIGHTEOUS, + EVENT_SPELL_RADIANCE = 1, + EVENT_SPELL_HAMMER_RIGHTEOUS, }; enum PaletressSpells { - SPELL_SMITE_N = 66536, - SPELL_SMITE_H = 67674, - SPELL_HOLY_FIRE_N = 66538, - SPELL_HOLY_FIRE_H = 67676, - SPELL_RENEW_N = 66537, - SPELL_RENEW_H = 67675, + SPELL_SMITE_N = 66536, + SPELL_SMITE_H = 67674, + SPELL_HOLY_FIRE_N = 66538, + SPELL_HOLY_FIRE_H = 67676, + SPELL_RENEW_N = 66537, + SPELL_RENEW_H = 67675, - SPELL_HOLY_NOVA = 66546, - SPELL_SHIELD = 66515, - SPELL_CONFESS = 66680, - SPELL_SUMMON_MEMORY = 66545, + SPELL_HOLY_NOVA = 66546, + SPELL_SHIELD = 66515, + SPELL_CONFESS = 66680, + SPELL_SUMMON_MEMORY = 66545, - //Memory - SPELL_OLD_WOUNDS_N = 66620, - SPELL_OLD_WOUNDS_H = 67679, - SPELL_SHADOWS_PAST_N = 66619, - SPELL_SHADOWS_PAST_H = 67678, - SPELL_WAKING_NIGHTMARE_N = 66552, - SPELL_WAKING_NIGHTMARE_H = 67677, + //Memory + SPELL_OLD_WOUNDS_N = 66620, + SPELL_OLD_WOUNDS_H = 67679, + SPELL_SHADOWS_PAST_N = 66619, + SPELL_SHADOWS_PAST_H = 67678, + SPELL_WAKING_NIGHTMARE_N = 66552, + SPELL_WAKING_NIGHTMARE_H = 67677, }; -#define SPELL_SMITE DUNGEON_MODE(SPELL_SMITE_N, SPELL_SMITE_H) -#define SPELL_HOLY_FIRE DUNGEON_MODE(SPELL_HOLY_FIRE_N, SPELL_HOLY_FIRE_H) -#define SPELL_RENEW DUNGEON_MODE(SPELL_RENEW_N, SPELL_RENEW_H) -#define SPELL_OLD_WOUNDS DUNGEON_MODE(SPELL_OLD_WOUNDS_N, SPELL_OLD_WOUNDS_H) -#define SPELL_SHADOWS_PAST DUNGEON_MODE(SPELL_SHADOWS_PAST_N, SPELL_SHADOWS_PAST_H) -#define SPELL_WAKING_NIGHTMARE DUNGEON_MODE(SPELL_WAKING_NIGHTMARE_N, SPELL_WAKING_NIGHTMARE_H) +#define SPELL_SMITE DUNGEON_MODE(SPELL_SMITE_N, SPELL_SMITE_H) +#define SPELL_HOLY_FIRE DUNGEON_MODE(SPELL_HOLY_FIRE_N, SPELL_HOLY_FIRE_H) +#define SPELL_RENEW DUNGEON_MODE(SPELL_RENEW_N, SPELL_RENEW_H) +#define SPELL_OLD_WOUNDS DUNGEON_MODE(SPELL_OLD_WOUNDS_N, SPELL_OLD_WOUNDS_H) +#define SPELL_SHADOWS_PAST DUNGEON_MODE(SPELL_SHADOWS_PAST_N, SPELL_SHADOWS_PAST_H) +#define SPELL_WAKING_NIGHTMARE DUNGEON_MODE(SPELL_WAKING_NIGHTMARE_N, SPELL_WAKING_NIGHTMARE_H) enum PaletressEvents { - EVENT_SPELL_SMITE = 1, - EVENT_SPELL_HOLY_FIRE, - EVENT_SPELL_RENEW, + EVENT_SPELL_SMITE = 1, + EVENT_SPELL_HOLY_FIRE, + EVENT_SPELL_RENEW, - EVENT_MEMORY_SCALE, - EVENT_MEMORY_START_ATTACK, - EVENT_SPELL_OLD_WOUNDS, - EVENT_SPELL_SHADOWS_PAST, - EVENT_SPELL_WAKING_NIGHTMARE, + EVENT_MEMORY_SCALE, + EVENT_MEMORY_START_ATTACK, + EVENT_SPELL_OLD_WOUNDS, + EVENT_SPELL_SHADOWS_PAST, + EVENT_SPELL_WAKING_NIGHTMARE, }; -#define TEXT_RADIATE "Eadric the Pure begins to radiate light. Shield your eyes!" +#define TEXT_RADIATE "Eadric the Pure begins to radiate light. Shield your eyes!" class boss_eadric : public CreatureScript { public: - boss_eadric() : CreatureScript("boss_eadric") { } - struct boss_eadricAI : public ScriptedAI - { - boss_eadricAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - } + boss_eadric() : CreatureScript("boss_eadric") { } + struct boss_eadricAI : public ScriptedAI + { + boss_eadricAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - me->SetReactState(REACT_PASSIVE); - if( pInstance ) - pInstance->SetData(BOSS_ARGENT_CHALLENGE, NOT_STARTED); - } - - void MovementInform(uint32 type, uint32 id) - { - if( type == POINT_MOTION_TYPE && id == 1 ) - me->SetFacingTo(3*M_PI/2); - } + void Reset() + { + events.Reset(); + me->SetReactState(REACT_PASSIVE); + if( pInstance ) + pInstance->SetData(BOSS_ARGENT_CHALLENGE, NOT_STARTED); + } + + void MovementInform(uint32 type, uint32 id) + { + if( type == POINT_MOTION_TYPE && id == 1 ) + me->SetFacingTo(3*M_PI/2); + } - void KilledUnit(Unit* who) - { - if( who->GetTypeId() == TYPEID_PLAYER ) - { - if( urand(0,1) ) - Talk(TEXT_EADRIC_SLAIN_1); - else - Talk(TEXT_EADRIC_SLAIN_2); - } - } + void KilledUnit(Unit* who) + { + if( who->GetTypeId() == TYPEID_PLAYER ) + { + if( urand(0,1) ) + Talk(TEXT_EADRIC_SLAIN_1); + else + Talk(TEXT_EADRIC_SLAIN_2); + } + } - void EnterCombat(Unit* who) - { - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_RADIANCE, 16000); - events.ScheduleEvent(EVENT_SPELL_HAMMER_RIGHTEOUS, 25000); - Talk(TEXT_EADRIC_AGGRO); - me->CastSpell(me, SPELL_VENGEANCE, false); - if( pInstance ) - pInstance->SetData(BOSS_ARGENT_CHALLENGE, IN_PROGRESS); - } + void EnterCombat(Unit* who) + { + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_RADIANCE, 16000); + events.ScheduleEvent(EVENT_SPELL_HAMMER_RIGHTEOUS, 25000); + Talk(TEXT_EADRIC_AGGRO); + me->CastSpell(me, SPELL_VENGEANCE, false); + if( pInstance ) + pInstance->SetData(BOSS_ARGENT_CHALLENGE, IN_PROGRESS); + } - void SpellHit(Unit* caster, const SpellInfo* spell) - { - if (spell->Id == 66905 && me->GetHealth() == 1) // hammer throw back damage (15k) - me->CastSpell(me, 68197, true); - } + void SpellHit(Unit* caster, const SpellInfo* spell) + { + if (spell->Id == 66905 && me->GetHealth() == 1) // hammer throw back damage (15k) + me->CastSpell(me, 68197, true); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if( damage >= me->GetHealth() ) - { - damage = me->GetHealth() - 1; - if( me->getFaction() != 35 ) - { - me->CastSpell((Unit*)NULL, 68575, true); // achievements - me->GetMap()->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, 68574, me); // paletress' spell credits encounter, but shouldn't credit achievements - me->setFaction(35); - events.Reset(); - Talk(TEXT_EADRIC_DEATH); - me->getThreatManager().clearReferences(); - me->SetRegeneratingHealth(false); - _EnterEvadeMode(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( pInstance ) - pInstance->SetData(BOSS_ARGENT_CHALLENGE, DONE); - } - } - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if( damage >= me->GetHealth() ) + { + damage = me->GetHealth() - 1; + if( me->getFaction() != 35 ) + { + me->CastSpell((Unit*)NULL, 68575, true); // achievements + me->GetMap()->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, 68574, me); // paletress' spell credits encounter, but shouldn't credit achievements + me->setFaction(35); + events.Reset(); + Talk(TEXT_EADRIC_DEATH); + me->getThreatManager().clearReferences(); + me->SetRegeneratingHealth(false); + _EnterEvadeMode(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( pInstance ) + pInstance->SetData(BOSS_ARGENT_CHALLENGE, DONE); + } + } + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_RADIANCE: - me->CastSpell((Unit*)NULL, SPELL_RADIANCE, false); - me->MonsterTextEmote(TEXT_RADIATE, 0, true); - events.RepeatEvent(16000); - break; - case EVENT_SPELL_HAMMER_RIGHTEOUS: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 55.0f, true) ) - { - char buffer[100]; - sprintf(buffer, "Eadric the Pure targets %s with the Hammer of the Righteous!", target->GetName().c_str()); - me->MonsterTextEmote(buffer, 0, true); - Talk(TEXT_EADRIC_HAMMER); - me->CastSpell(target, SPELL_HAMMER_JUSTICE, true); - me->CastSpell(target, SPELL_HAMMER_RIGHTEOUS, false); - } - events.RepeatEvent(25000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_RADIANCE: + me->CastSpell((Unit*)NULL, SPELL_RADIANCE, false); + me->MonsterTextEmote(TEXT_RADIATE, 0, true); + events.RepeatEvent(16000); + break; + case EVENT_SPELL_HAMMER_RIGHTEOUS: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 55.0f, true) ) + { + char buffer[100]; + sprintf(buffer, "Eadric the Pure targets %s with the Hammer of the Righteous!", target->GetName().c_str()); + me->MonsterTextEmote(buffer, 0, true); + Talk(TEXT_EADRIC_HAMMER); + me->CastSpell(target, SPELL_HAMMER_JUSTICE, true); + me->CastSpell(target, SPELL_HAMMER_RIGHTEOUS, false); + } + events.RepeatEvent(25000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_eadricAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_eadricAI(pCreature); + } }; class boss_paletress : public CreatureScript { public: - boss_paletress() : CreatureScript("boss_paletress") { } + boss_paletress() : CreatureScript("boss_paletress") { } - struct boss_paletressAI : public ScriptedAI - { - boss_paletressAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - } + struct boss_paletressAI : public ScriptedAI + { + boss_paletressAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - bool summoned; - uint64 MemoryGUID; + InstanceScript* pInstance; + EventMap events; + bool summoned; + uint64 MemoryGUID; - void Reset() - { - events.Reset(); - summoned = false; - if( MemoryGUID ) - { - if( Creature* memory = ObjectAccessor::GetCreature(*me, MemoryGUID) ) - memory->DespawnOrUnsummon(); - MemoryGUID = 0; - } - me->SetReactState(REACT_PASSIVE); - if( pInstance ) - pInstance->SetData(BOSS_ARGENT_CHALLENGE, NOT_STARTED); - } - - void MovementInform(uint32 type, uint32 id) - { - if( type == POINT_MOTION_TYPE && id == 1 ) - me->SetFacingTo(3*M_PI/2); - } + void Reset() + { + events.Reset(); + summoned = false; + if( MemoryGUID ) + { + if( Creature* memory = ObjectAccessor::GetCreature(*me, MemoryGUID) ) + memory->DespawnOrUnsummon(); + MemoryGUID = 0; + } + me->SetReactState(REACT_PASSIVE); + if( pInstance ) + pInstance->SetData(BOSS_ARGENT_CHALLENGE, NOT_STARTED); + } + + void MovementInform(uint32 type, uint32 id) + { + if( type == POINT_MOTION_TYPE && id == 1 ) + me->SetFacingTo(3*M_PI/2); + } - void KilledUnit(Unit* who) - { - if( who->GetTypeId() == TYPEID_PLAYER ) - { - if( urand(0,1) ) - Talk(TEXT_PALETRESS_SLAIN_1); - else - Talk(TEXT_PALETRESS_SLAIN_2); - } - } + void KilledUnit(Unit* who) + { + if( who->GetTypeId() == TYPEID_PLAYER ) + { + if( urand(0,1) ) + Talk(TEXT_PALETRESS_SLAIN_1); + else + Talk(TEXT_PALETRESS_SLAIN_2); + } + } - void EnterCombat(Unit* who) - { - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_HOLY_FIRE, urand(9000,12000)); - events.ScheduleEvent(EVENT_SPELL_SMITE, urand(2000,3000)); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - Talk(TEXT_PALETRESS_AGGRO); - if( pInstance ) - pInstance->SetData(BOSS_ARGENT_CHALLENGE, IN_PROGRESS); - } + void EnterCombat(Unit* who) + { + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_HOLY_FIRE, urand(9000,12000)); + events.ScheduleEvent(EVENT_SPELL_SMITE, urand(2000,3000)); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Talk(TEXT_PALETRESS_AGGRO); + if( pInstance ) + pInstance->SetData(BOSS_ARGENT_CHALLENGE, IN_PROGRESS); + } - void DoAction(int32 param) - { - if( param == 1 ) - { - MemoryGUID = 0; - me->RemoveAura(SPELL_SHIELD); - Talk(TEXT_PALETRESS_MEMORY_DEFEATED); - } - else if( param == (-1) ) - { - if( MemoryGUID ) - if( Creature* memory = ObjectAccessor::GetCreature(*me, MemoryGUID) ) - { - memory->DespawnOrUnsummon(); - MemoryGUID = 0; - } - } - } + void DoAction(int32 param) + { + if( param == 1 ) + { + MemoryGUID = 0; + me->RemoveAura(SPELL_SHIELD); + Talk(TEXT_PALETRESS_MEMORY_DEFEATED); + } + else if( param == (-1) ) + { + if( MemoryGUID ) + if( Creature* memory = ObjectAccessor::GetCreature(*me, MemoryGUID) ) + { + memory->DespawnOrUnsummon(); + MemoryGUID = 0; + } + } + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - //if( me->HasAura(SPELL_SHIELD) ) - // return; + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + //if( me->HasAura(SPELL_SHIELD) ) + // return; - if( damage >= me->GetHealth() ) - { - damage = me->GetHealth() - 1; + if( damage >= me->GetHealth() ) + { + damage = me->GetHealth() - 1; - if( me->getFaction() != 35 ) - { - me->CastSpell((Unit*)NULL, 68574, true); // achievements - me->setFaction(35); - events.Reset(); - Talk(TEXT_PALETRESS_DEATH); - me->getThreatManager().clearReferences(); - me->SetRegeneratingHealth(false); - _EnterEvadeMode(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( pInstance ) - { - pInstance->SetData(BOSS_ARGENT_CHALLENGE, DONE); - pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 68206); - } - } - } - } + if( me->getFaction() != 35 ) + { + me->CastSpell((Unit*)NULL, 68574, true); // achievements + me->setFaction(35); + events.Reset(); + Talk(TEXT_PALETRESS_DEATH); + me->getThreatManager().clearReferences(); + me->SetRegeneratingHealth(false); + _EnterEvadeMode(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( pInstance ) + { + pInstance->SetData(BOSS_ARGENT_CHALLENGE, DONE); + pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 68206); + } + } + } + } - void JustSummoned(Creature* summon) - { - if( pInstance ) - pInstance->SetData(DATA_MEMORY_ENTRY, summon->GetEntry()); - MemoryGUID = summon->GetGUID(); - } + void JustSummoned(Creature* summon) + { + if( pInstance ) + pInstance->SetData(DATA_MEMORY_ENTRY, summon->GetEntry()); + MemoryGUID = summon->GetGUID(); + } - void SummonMemory() - { - uint8 uiRandom = urand(0,25); - uint32 uiSpells[26] = {66704,66705,66706,66707,66709,66710,66711,66712,66713,66714,66715,66708,66708,66691,66692,66694,66695,66696,66697,66698,66699,66700,66701,66702,66703,66543}; - me->CastSpell(me, uiSpells[uiRandom], true); - } + void SummonMemory() + { + uint8 uiRandom = urand(0,25); + uint32 uiSpells[26] = {66704,66705,66706,66707,66709,66710,66711,66712,66713,66714,66715,66708,66708,66691,66692,66694,66695,66696,66697,66698,66699,66700,66701,66702,66703,66543}; + me->CastSpell(me, uiSpells[uiRandom], true); + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !summoned && HealthBelowPct(25) ) - { - me->InterruptNonMeleeSpells(true); - Talk(TEXT_PALETRESS_MEMORY_SUMMON); - me->CastSpell((Unit*)NULL, SPELL_HOLY_NOVA, false); - me->CastSpell(me, SPELL_SHIELD, false); - me->CastSpell((Unit*)NULL, SPELL_SUMMON_MEMORY, false); - SummonMemory(); - me->CastSpell((Unit*)NULL, SPELL_CONFESS, false); - events.ScheduleEvent(EVENT_SPELL_RENEW, urand(6000,8000)); - summoned = true; - return; - } + if( !summoned && HealthBelowPct(25) ) + { + me->InterruptNonMeleeSpells(true); + Talk(TEXT_PALETRESS_MEMORY_SUMMON); + me->CastSpell((Unit*)NULL, SPELL_HOLY_NOVA, false); + me->CastSpell(me, SPELL_SHIELD, false); + me->CastSpell((Unit*)NULL, SPELL_SUMMON_MEMORY, false); + SummonMemory(); + me->CastSpell((Unit*)NULL, SPELL_CONFESS, false); + events.ScheduleEvent(EVENT_SPELL_RENEW, urand(6000,8000)); + summoned = true; + return; + } - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_SMITE: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true) ) - me->CastSpell(target, SPELL_SMITE, false); - events.RepeatEvent(urand(3000,4000)); - break; - case EVENT_SPELL_HOLY_FIRE: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) - me->CastSpell(target, SPELL_HOLY_FIRE, false); - events.RepeatEvent(urand(9000,12000)); - break; - case EVENT_SPELL_RENEW: - if( !MemoryGUID ) - { - events.PopEvent(); - break; - } - if( urand(0,1) ) - me->CastSpell(me, SPELL_RENEW, false); - else if( Creature* memory = ObjectAccessor::GetCreature(*me, MemoryGUID) ) - if( memory->IsAlive() ) - me->CastSpell(memory, SPELL_RENEW, false); - events.RepeatEvent(urand(15000,17000)); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_SMITE: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true) ) + me->CastSpell(target, SPELL_SMITE, false); + events.RepeatEvent(urand(3000,4000)); + break; + case EVENT_SPELL_HOLY_FIRE: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) + me->CastSpell(target, SPELL_HOLY_FIRE, false); + events.RepeatEvent(urand(9000,12000)); + break; + case EVENT_SPELL_RENEW: + if( !MemoryGUID ) + { + events.PopEvent(); + break; + } + if( urand(0,1) ) + me->CastSpell(me, SPELL_RENEW, false); + else if( Creature* memory = ObjectAccessor::GetCreature(*me, MemoryGUID) ) + if( memory->IsAlive() ) + me->CastSpell(memory, SPELL_RENEW, false); + events.RepeatEvent(urand(15000,17000)); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_paletressAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_paletressAI(pCreature); + } }; class npc_memory : public CreatureScript { public: - npc_memory() : CreatureScript("npc_memory") { } + npc_memory() : CreatureScript("npc_memory") { } - struct npc_memoryAI : public ScriptedAI - { - npc_memoryAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - events.Reset(); - me->SetReactState(REACT_PASSIVE); - me->SetObjectScale(0.01f); - events.ScheduleEvent(EVENT_MEMORY_SCALE, 500); - } + struct npc_memoryAI : public ScriptedAI + { + npc_memoryAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + events.Reset(); + me->SetReactState(REACT_PASSIVE); + me->SetObjectScale(0.01f); + events.ScheduleEvent(EVENT_MEMORY_SCALE, 500); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() {} + void Reset() {} - void JustDied(Unit* /*killer*/) - { - me->DespawnOrUnsummon(20000); - if( pInstance ) - if( Creature* paletress = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_PALETRESS)) ) - paletress->AI()->DoAction(1); - } + void JustDied(Unit* /*killer*/) + { + me->DespawnOrUnsummon(20000); + if( pInstance ) + if( Creature* paletress = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_PALETRESS)) ) + paletress->AI()->DoAction(1); + } - void UpdateAI(uint32 diff) - { - UpdateVictim(); + void UpdateAI(uint32 diff) + { + UpdateVictim(); - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_MEMORY_SCALE: - me->SetObjectScale(1.0f); - events.ScheduleEvent(EVENT_MEMORY_START_ATTACK, 5000); - events.PopEvent(); - break; - case EVENT_MEMORY_START_ATTACK: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( Unit* target = me->SelectNearestTarget(200.0f) ) - { - AttackStart(target); - DoZoneInCombat(); - } - me->SetReactState(REACT_AGGRESSIVE); - events.ScheduleEvent(EVENT_SPELL_OLD_WOUNDS, 8000); - events.ScheduleEvent(EVENT_SPELL_SHADOWS_PAST, 4000); - events.ScheduleEvent(EVENT_SPELL_WAKING_NIGHTMARE, urand(20000,30000)); - events.PopEvent(); - break; - case EVENT_SPELL_OLD_WOUNDS: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true) ) - me->CastSpell(target, SPELL_OLD_WOUNDS, true); - events.RepeatEvent(12000); - break; - case EVENT_SPELL_SHADOWS_PAST: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true) ) - me->CastSpell(target, SPELL_SHADOWS_PAST, false); - events.RepeatEvent(urand(15000,20000)); - break; - case EVENT_SPELL_WAKING_NIGHTMARE: - me->CastSpell(me, SPELL_WAKING_NIGHTMARE, false); - events.RepeatEvent(35000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_MEMORY_SCALE: + me->SetObjectScale(1.0f); + events.ScheduleEvent(EVENT_MEMORY_START_ATTACK, 5000); + events.PopEvent(); + break; + case EVENT_MEMORY_START_ATTACK: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( Unit* target = me->SelectNearestTarget(200.0f) ) + { + AttackStart(target); + DoZoneInCombat(); + } + me->SetReactState(REACT_AGGRESSIVE); + events.ScheduleEvent(EVENT_SPELL_OLD_WOUNDS, 8000); + events.ScheduleEvent(EVENT_SPELL_SHADOWS_PAST, 4000); + events.ScheduleEvent(EVENT_SPELL_WAKING_NIGHTMARE, urand(20000,30000)); + events.PopEvent(); + break; + case EVENT_SPELL_OLD_WOUNDS: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true) ) + me->CastSpell(target, SPELL_OLD_WOUNDS, true); + events.RepeatEvent(12000); + break; + case EVENT_SPELL_SHADOWS_PAST: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true) ) + me->CastSpell(target, SPELL_SHADOWS_PAST, false); + events.RepeatEvent(urand(15000,20000)); + break; + case EVENT_SPELL_WAKING_NIGHTMARE: + me->CastSpell(me, SPELL_WAKING_NIGHTMARE, false); + events.RepeatEvent(35000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_memoryAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_memoryAI(pCreature); + } }; enum ArgentSoldierSpells { - // monk - SPELL_FLURRY_OF_BLOWS = 67233, - SPELL_PUMMEL = 67235, - SPELL_DIVINE_SHIELD_H = 67251, - SPELL_FINAL_MEDITATION_H = 67255, + // monk + SPELL_FLURRY_OF_BLOWS = 67233, + SPELL_PUMMEL = 67235, + SPELL_DIVINE_SHIELD_H = 67251, + SPELL_FINAL_MEDITATION_H = 67255, - // priestess - SPELL_HOLY_SMITE_N = 36176, - SPELL_HOLY_SMITE_H = 67289, - SPELL_FOUNTAIN_OF_LIGHT = 67194, - NPC_FOUNTAIN_OF_LIGHT = 35311, - SPELL_SHADOW_WORD_PAIN_N = 34941, - SPELL_SHADOW_WORD_PAIN_H = 34942, - SPELL_MIND_CONTROL_H = 67229, + // priestess + SPELL_HOLY_SMITE_N = 36176, + SPELL_HOLY_SMITE_H = 67289, + SPELL_FOUNTAIN_OF_LIGHT = 67194, + NPC_FOUNTAIN_OF_LIGHT = 35311, + SPELL_SHADOW_WORD_PAIN_N = 34941, + SPELL_SHADOW_WORD_PAIN_H = 34942, + SPELL_MIND_CONTROL_H = 67229, - // lightwielder - SPELL_BLAZING_LIGHT_N = 67247, - SPELL_BLAZING_LIGHT_H = 67290, - SPELL_CLEAVE = 15284, - SPELL_UNBALANCING_STRIKE_H = 67237, + // lightwielder + SPELL_BLAZING_LIGHT_N = 67247, + SPELL_BLAZING_LIGHT_H = 67290, + SPELL_CLEAVE = 15284, + SPELL_UNBALANCING_STRIKE_H = 67237, }; -#define SPELL_HOLY_SMITE DUNGEON_MODE(SPELL_HOLY_SMITE_N, SPELL_HOLY_SMITE_H) -#define SPELL_SHADOW_WORD_PAIN DUNGEON_MODE(SPELL_SHADOW_WORD_PAIN_N, SPELL_SHADOW_WORD_PAIN_H) -#define SPELL_BLAZING_LIGHT DUNGEON_MODE(SPELL_BLAZING_LIGHT_N, SPELL_BLAZING_LIGHT_H) +#define SPELL_HOLY_SMITE DUNGEON_MODE(SPELL_HOLY_SMITE_N, SPELL_HOLY_SMITE_H) +#define SPELL_SHADOW_WORD_PAIN DUNGEON_MODE(SPELL_SHADOW_WORD_PAIN_N, SPELL_SHADOW_WORD_PAIN_H) +#define SPELL_BLAZING_LIGHT DUNGEON_MODE(SPELL_BLAZING_LIGHT_N, SPELL_BLAZING_LIGHT_H) enum ArgentSoldierEvents { - EVENT_MONK_SPELL_FLURRY_OF_BLOWS = 1, - EVENT_MONK_SPELL_PUMMEL, - EVENT_PRIESTESS_SPELL_HOLY_SMITE, - EVENT_PRIESTESS_SPELL_SHADOW_WORD_PAIN, - EVENT_PRIESTESS_SPELL_FOUNTAIN_OF_LIGHT, - EVENT_PRIESTESS_SPELL_MIND_CONTROL_H, - EVENT_LIGHTWIELDER_SPELL_BLAZING_LIGHT, - EVENT_LIGHTWIELDER_SPELL_CLEAVE, - EVENT_LIGHTWIELDER_SPELL_UNBALANCING_STRIKE_H, + EVENT_MONK_SPELL_FLURRY_OF_BLOWS = 1, + EVENT_MONK_SPELL_PUMMEL, + EVENT_PRIESTESS_SPELL_HOLY_SMITE, + EVENT_PRIESTESS_SPELL_SHADOW_WORD_PAIN, + EVENT_PRIESTESS_SPELL_FOUNTAIN_OF_LIGHT, + EVENT_PRIESTESS_SPELL_MIND_CONTROL_H, + EVENT_LIGHTWIELDER_SPELL_BLAZING_LIGHT, + EVENT_LIGHTWIELDER_SPELL_CLEAVE, + EVENT_LIGHTWIELDER_SPELL_UNBALANCING_STRIKE_H, }; class npc_argent_soldier : public CreatureScript { public: - npc_argent_soldier() : CreatureScript("npc_argent_soldier") { } + npc_argent_soldier() : CreatureScript("npc_argent_soldier") { } - struct npc_argent_soldierAI : public npc_escortAI - { - npc_argent_soldierAI(Creature* pCreature) : npc_escortAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - me->SetReactState(REACT_PASSIVE); - SetDespawnAtEnd(false); - uiWaypoint = 0; - } + struct npc_argent_soldierAI : public npc_escortAI + { + npc_argent_soldierAI(Creature* pCreature) : npc_escortAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + me->SetReactState(REACT_PASSIVE); + SetDespawnAtEnd(false); + uiWaypoint = 0; + } - InstanceScript* pInstance; - EventMap events; - uint8 uiWaypoint; - bool bCheck; + InstanceScript* pInstance; + EventMap events; + uint8 uiWaypoint; + bool bCheck; - void Reset() - { - events.Reset(); - bCheck = false; - } + void Reset() + { + events.Reset(); + bCheck = false; + } - void WaypointReached(uint32 uiPoint) - { - if( uiPoint == 1 ) - { - switch( uiWaypoint ) - { - case 0: - me->SetFacingTo(5.4f); - break; - case 1: - me->SetFacingTo(4.6f); - break; - case 2: - me->SetFacingTo(4.0f); - break; - } - } - } + void WaypointReached(uint32 uiPoint) + { + if( uiPoint == 1 ) + { + switch( uiWaypoint ) + { + case 0: + me->SetFacingTo(5.4f); + break; + case 1: + me->SetFacingTo(4.6f); + break; + case 2: + me->SetFacingTo(4.0f); + break; + } + } + } - void SetData(uint32 uiType, uint32 /*uiData*/) - { - AddWaypoint(0, me->GetPositionX(), 660.0f, 411.80f); - switch( me->GetEntry() ) - { - case NPC_ARGENT_LIGHTWIELDER: - switch( uiType ) - { - case 0: - AddWaypoint(1,716.321f,647.047f,411.93f); - break; - case 1: - AddWaypoint(1,742.44f,650.29f,411.79f); - break; - case 2: - AddWaypoint(1,772.6314f,651.7f,411.93f); - break; - } - break; - case NPC_ARGENT_MONK: - switch( uiType ) - { - case 0: - AddWaypoint(1,717.86f,649.0f,411.923f); - break; - case 1: - AddWaypoint(1,746.73f,650.24f,411.56f); - break; - case 2: - AddWaypoint(1,775.567f,648.26f,411.93f); - break; - } - break; - case NPC_PRIESTESS: - switch( uiType ) - { - case 0: - AddWaypoint(1,719.872f,650.94f,411.93f); - break; - case 1: - AddWaypoint(1,750.72f,650.20f,411.77f); - break; - case 2: - AddWaypoint(1,777.78f,645.70f,411.93f); - break; - } - break; - } + void SetData(uint32 uiType, uint32 /*uiData*/) + { + AddWaypoint(0, me->GetPositionX(), 660.0f, 411.80f); + switch( me->GetEntry() ) + { + case NPC_ARGENT_LIGHTWIELDER: + switch( uiType ) + { + case 0: + AddWaypoint(1,716.321f,647.047f,411.93f); + break; + case 1: + AddWaypoint(1,742.44f,650.29f,411.79f); + break; + case 2: + AddWaypoint(1,772.6314f,651.7f,411.93f); + break; + } + break; + case NPC_ARGENT_MONK: + switch( uiType ) + { + case 0: + AddWaypoint(1,717.86f,649.0f,411.923f); + break; + case 1: + AddWaypoint(1,746.73f,650.24f,411.56f); + break; + case 2: + AddWaypoint(1,775.567f,648.26f,411.93f); + break; + } + break; + case NPC_PRIESTESS: + switch( uiType ) + { + case 0: + AddWaypoint(1,719.872f,650.94f,411.93f); + break; + case 1: + AddWaypoint(1,750.72f,650.20f,411.77f); + break; + case 2: + AddWaypoint(1,777.78f,645.70f,411.93f); + break; + } + break; + } - Start(false,true,0); - uiWaypoint = uiType; - } + Start(false,true,0); + uiWaypoint = uiType; + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if( bCheck && damage >= me->GetHealth() ) - { - bCheck = false; - damage = me->GetHealth()-1; - events.DelayEvents(10000); - me->CastSpell(me, SPELL_DIVINE_SHIELD_H, true); - me->CastSpell((Unit*)NULL, SPELL_FINAL_MEDITATION_H, true); - } - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if( bCheck && damage >= me->GetHealth() ) + { + bCheck = false; + damage = me->GetHealth()-1; + events.DelayEvents(10000); + me->CastSpell(me, SPELL_DIVINE_SHIELD_H, true); + me->CastSpell((Unit*)NULL, SPELL_FINAL_MEDITATION_H, true); + } + } - void EnterCombat(Unit* /*who*/) - { - switch( me->GetEntry() ) - { - case NPC_ARGENT_MONK: - events.RescheduleEvent(EVENT_MONK_SPELL_FLURRY_OF_BLOWS, 5000); - events.RescheduleEvent(EVENT_MONK_SPELL_PUMMEL, 7000); - if( IsHeroic() ) - bCheck = true; - break; - case NPC_PRIESTESS: - events.RescheduleEvent(EVENT_PRIESTESS_SPELL_HOLY_SMITE, urand(5000,8000)); - events.RescheduleEvent(EVENT_PRIESTESS_SPELL_SHADOW_WORD_PAIN, urand(3000,6000)); - events.RescheduleEvent(EVENT_PRIESTESS_SPELL_FOUNTAIN_OF_LIGHT, urand(8000,15000)); - if( IsHeroic() ) - events.RescheduleEvent(EVENT_PRIESTESS_SPELL_MIND_CONTROL_H, 12000); - break; - case NPC_ARGENT_LIGHTWIELDER: - events.RescheduleEvent(EVENT_LIGHTWIELDER_SPELL_BLAZING_LIGHT, urand(12000,15000)); - events.RescheduleEvent(EVENT_LIGHTWIELDER_SPELL_CLEAVE, urand(3000,5000)); - if( IsHeroic() ) - events.RescheduleEvent(EVENT_LIGHTWIELDER_SPELL_UNBALANCING_STRIKE_H, urand(8000,12000)); - break; - } - } + void EnterCombat(Unit* /*who*/) + { + switch( me->GetEntry() ) + { + case NPC_ARGENT_MONK: + events.RescheduleEvent(EVENT_MONK_SPELL_FLURRY_OF_BLOWS, 5000); + events.RescheduleEvent(EVENT_MONK_SPELL_PUMMEL, 7000); + if( IsHeroic() ) + bCheck = true; + break; + case NPC_PRIESTESS: + events.RescheduleEvent(EVENT_PRIESTESS_SPELL_HOLY_SMITE, urand(5000,8000)); + events.RescheduleEvent(EVENT_PRIESTESS_SPELL_SHADOW_WORD_PAIN, urand(3000,6000)); + events.RescheduleEvent(EVENT_PRIESTESS_SPELL_FOUNTAIN_OF_LIGHT, urand(8000,15000)); + if( IsHeroic() ) + events.RescheduleEvent(EVENT_PRIESTESS_SPELL_MIND_CONTROL_H, 12000); + break; + case NPC_ARGENT_LIGHTWIELDER: + events.RescheduleEvent(EVENT_LIGHTWIELDER_SPELL_BLAZING_LIGHT, urand(12000,15000)); + events.RescheduleEvent(EVENT_LIGHTWIELDER_SPELL_CLEAVE, urand(3000,5000)); + if( IsHeroic() ) + events.RescheduleEvent(EVENT_LIGHTWIELDER_SPELL_UNBALANCING_STRIKE_H, urand(8000,12000)); + break; + } + } - void UpdateAI(uint32 diff) - { - npc_escortAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + npc_escortAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; + switch( events.GetEvent() ) + { + case 0: + break; - case EVENT_MONK_SPELL_FLURRY_OF_BLOWS: - me->CastSpell(me, SPELL_FLURRY_OF_BLOWS, false); - events.RepeatEvent(urand(12000,18000)); - break; - case EVENT_MONK_SPELL_PUMMEL: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_PUMMEL, false); - events.RepeatEvent(urand(8000,11000)); - break; + case EVENT_MONK_SPELL_FLURRY_OF_BLOWS: + me->CastSpell(me, SPELL_FLURRY_OF_BLOWS, false); + events.RepeatEvent(urand(12000,18000)); + break; + case EVENT_MONK_SPELL_PUMMEL: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_PUMMEL, false); + events.RepeatEvent(urand(8000,11000)); + break; - case EVENT_PRIESTESS_SPELL_HOLY_SMITE: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_HOLY_SMITE, false); - events.RepeatEvent(urand(6000,8000)); - break; - case EVENT_PRIESTESS_SPELL_SHADOW_WORD_PAIN: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_SHADOW_WORD_PAIN, false); - events.RepeatEvent(urand(12000,15000)); - break; - case EVENT_PRIESTESS_SPELL_FOUNTAIN_OF_LIGHT: - me->CastSpell((Unit*)NULL, SPELL_FOUNTAIN_OF_LIGHT, false); - events.RepeatEvent(urand(35000,45000)); - break; - case EVENT_PRIESTESS_SPELL_MIND_CONTROL_H: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) - me->CastSpell(target, SPELL_MIND_CONTROL_H, false); - events.RepeatEvent(urand(22000,30000)); - break; + case EVENT_PRIESTESS_SPELL_HOLY_SMITE: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_HOLY_SMITE, false); + events.RepeatEvent(urand(6000,8000)); + break; + case EVENT_PRIESTESS_SPELL_SHADOW_WORD_PAIN: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_SHADOW_WORD_PAIN, false); + events.RepeatEvent(urand(12000,15000)); + break; + case EVENT_PRIESTESS_SPELL_FOUNTAIN_OF_LIGHT: + me->CastSpell((Unit*)NULL, SPELL_FOUNTAIN_OF_LIGHT, false); + events.RepeatEvent(urand(35000,45000)); + break; + case EVENT_PRIESTESS_SPELL_MIND_CONTROL_H: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) + me->CastSpell(target, SPELL_MIND_CONTROL_H, false); + events.RepeatEvent(urand(22000,30000)); + break; - case EVENT_LIGHTWIELDER_SPELL_BLAZING_LIGHT: - { - Unit* target = DoSelectLowestHpFriendly(40.0f); - if( !target ) - target = me; - me->CastSpell(target, SPELL_BLAZING_LIGHT, false); - events.RepeatEvent(urand(8000,12000)); - } - break; - case EVENT_LIGHTWIELDER_SPELL_CLEAVE: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - events.RepeatEvent(urand(6000,8000)); - break; - case EVENT_LIGHTWIELDER_SPELL_UNBALANCING_STRIKE_H: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_UNBALANCING_STRIKE_H, false); - events.RepeatEvent(urand(12000,15000)); - break; - } + case EVENT_LIGHTWIELDER_SPELL_BLAZING_LIGHT: + { + Unit* target = DoSelectLowestHpFriendly(40.0f); + if( !target ) + target = me; + me->CastSpell(target, SPELL_BLAZING_LIGHT, false); + events.RepeatEvent(urand(8000,12000)); + } + break; + case EVENT_LIGHTWIELDER_SPELL_CLEAVE: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + events.RepeatEvent(urand(6000,8000)); + break; + case EVENT_LIGHTWIELDER_SPELL_UNBALANCING_STRIKE_H: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_UNBALANCING_STRIKE_H, false); + events.RepeatEvent(urand(12000,15000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*pKiller*/) - { - me->DespawnOrUnsummon(10000); - if( pInstance ) - pInstance->SetData(DATA_ARGENT_SOLDIER_DEFEATED, 0); - } - }; + void JustDied(Unit* /*pKiller*/) + { + me->DespawnOrUnsummon(10000); + if( pInstance ) + pInstance->SetData(DATA_ARGENT_SOLDIER_DEFEATED, 0); + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_argent_soldierAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_argent_soldierAI(pCreature); + } }; class spell_eadric_radiance : public SpellScriptLoader { - public: - spell_eadric_radiance() : SpellScriptLoader("spell_eadric_radiance") { } + public: + spell_eadric_radiance() : SpellScriptLoader("spell_eadric_radiance") { } - class spell_eadric_radiance_SpellScript : public SpellScript - { - PrepareSpellScript(spell_eadric_radiance_SpellScript); + class spell_eadric_radiance_SpellScript : public SpellScript + { + PrepareSpellScript(spell_eadric_radiance_SpellScript); - void FilterTargets(std::list& targets) - { - std::list tmplist; - for( std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) - if( (*itr)->ToUnit()->HasInArc(M_PI, GetCaster()) ) - tmplist.push_back(*itr); + void FilterTargets(std::list& targets) + { + std::list tmplist; + for( std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + if( (*itr)->ToUnit()->HasInArc(M_PI, GetCaster()) ) + tmplist.push_back(*itr); - targets.clear(); - for( std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr ) - targets.push_back(*itr); - } + targets.clear(); + for( std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr ) + targets.push_back(*itr); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_eadric_radiance_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_eadric_radiance_SpellScript(); + } }; class spell_toc5_light_rain : public SpellScriptLoader { - public: - spell_toc5_light_rain() : SpellScriptLoader("spell_toc5_light_rain") { } + public: + spell_toc5_light_rain() : SpellScriptLoader("spell_toc5_light_rain") { } - class spell_toc5_light_rain_SpellScript : public SpellScript - { - PrepareSpellScript(spell_toc5_light_rain_SpellScript); + class spell_toc5_light_rain_SpellScript : public SpellScript + { + PrepareSpellScript(spell_toc5_light_rain_SpellScript); - void FilterTargets(std::list& targets) - { - for( std::list::iterator itr = targets.begin(); itr != targets.end(); ) - { - if ((*itr)->GetTypeId() == TYPEID_UNIT) - if ((*itr)->ToCreature()->GetEntry() == NPC_FOUNTAIN_OF_LIGHT) - { - targets.erase(itr); - itr = targets.begin(); - continue; - } - ++itr; - } - } + void FilterTargets(std::list& targets) + { + for( std::list::iterator itr = targets.begin(); itr != targets.end(); ) + { + if ((*itr)->GetTypeId() == TYPEID_UNIT) + if ((*itr)->ToCreature()->GetEntry() == NPC_FOUNTAIN_OF_LIGHT) + { + targets.erase(itr); + itr = targets.begin(); + continue; + } + ++itr; + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc5_light_rain_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc5_light_rain_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_toc5_light_rain_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_toc5_light_rain_SpellScript(); + } }; class spell_reflective_shield : public SpellScriptLoader @@ -809,12 +809,12 @@ class spell_reflective_shield : public SpellScriptLoader void HandleAfterEffectAbsorb(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) { - if( Unit* attacker = dmgInfo.GetAttacker() ) - if( GetOwner() && attacker->GetGUID() != GetOwner()->GetGUID() ) - { - int32 damage = (int32)(absorbAmount*0.25f); - GetOwner()->ToUnit()->CastCustomSpell(attacker, 33619, &damage, NULL, NULL, true); - } + if( Unit* attacker = dmgInfo.GetAttacker() ) + if( GetOwner() && attacker->GetGUID() != GetOwner()->GetGUID() ) + { + int32 damage = (int32)(absorbAmount*0.25f); + GetOwner()->ToUnit()->CastCustomSpell(attacker, 33619, &damage, NULL, NULL, true); + } } void Register() @@ -831,11 +831,11 @@ class spell_reflective_shield : public SpellScriptLoader void AddSC_boss_argent_challenge() { - new boss_eadric(); - new boss_paletress(); - new npc_memory(); - new npc_argent_soldier(); - new spell_eadric_radiance(); - new spell_toc5_light_rain(); - new spell_reflective_shield(); + new boss_eadric(); + new boss_paletress(); + new npc_memory(); + new npc_argent_soldier(); + new spell_eadric_radiance(); + new spell_toc5_light_rain(); + new spell_reflective_shield(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index 85a4c3861..2485f3e8a 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -10,470 +10,470 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Spells { - SPELL_RAISE_DEAD_JAEREN = 67715, - SPELL_RAISE_DEAD_ARELAS = 67705, - SPELL_BK_FEIGN_DEATH = 67691, - SPELL_BLACK_KNIGHT_RES = 67693, - SPELL_BK_KILL_CREDIT = 68663, + SPELL_RAISE_DEAD_JAEREN = 67715, + SPELL_RAISE_DEAD_ARELAS = 67705, + SPELL_BK_FEIGN_DEATH = 67691, + SPELL_BLACK_KNIGHT_RES = 67693, + SPELL_BK_KILL_CREDIT = 68663, - // phase 1 - SPELL_PLAGUE_STRIKE_N = 67724, - SPELL_PLAGUE_STRIKE_H = 67884, - SPELL_ICY_TOUCH_N = 67718, - SPELL_ICY_TOUCH_H = 67881, - SPELL_DEATH_RESPITE_N = 67745, - SPELL_DEATH_RESPITE_H = 68306, - SPELL_DEATH_RESPITE_DUMMY = 66798, - SPELL_OBLITERATE_N = 67725, - SPELL_OBLITERATE_H = 67883, + // phase 1 + SPELL_PLAGUE_STRIKE_N = 67724, + SPELL_PLAGUE_STRIKE_H = 67884, + SPELL_ICY_TOUCH_N = 67718, + SPELL_ICY_TOUCH_H = 67881, + SPELL_DEATH_RESPITE_N = 67745, + SPELL_DEATH_RESPITE_H = 68306, + SPELL_DEATH_RESPITE_DUMMY = 66798, + SPELL_OBLITERATE_N = 67725, + SPELL_OBLITERATE_H = 67883, - // phase 2 (+ abilities from phase 1 without death respite) - SPELL_ARMY_DEAD_N = 67761, - SPELL_ARMY_DEAD_H = 67874, - SPELL_DESECRATION_N = 67778, - SPELL_DESECRATION_H = 67877, - SPELL_DESECRATION_SUMMON = 67779, - SPELL_BK_GHOUL_EXPLODE = 67751, + // phase 2 (+ abilities from phase 1 without death respite) + SPELL_ARMY_DEAD_N = 67761, + SPELL_ARMY_DEAD_H = 67874, + SPELL_DESECRATION_N = 67778, + SPELL_DESECRATION_H = 67877, + SPELL_DESECRATION_SUMMON = 67779, + SPELL_BK_GHOUL_EXPLODE = 67751, - // phase 3 - SPELL_DEATH_BITE_N = 67808, - SPELL_DEATH_BITE_H = 67875, - SPELL_MARKED_DEATH_N = 67823, - SPELL_MARKED_DEATH_H = 67882, + // phase 3 + SPELL_DEATH_BITE_N = 67808, + SPELL_DEATH_BITE_H = 67875, + SPELL_MARKED_DEATH_N = 67823, + SPELL_MARKED_DEATH_H = 67882, - // ghouls - SPELL_CLAW_N = 67774, - SPELL_CLAW_H = 67879, - SPELL_EXPLODE_N = 67729, - SPELL_EXPLODE_H = 67886, - SPELL_LEAP_N = 67749, - SPELL_LEAP_H = 67880, + // ghouls + SPELL_CLAW_N = 67774, + SPELL_CLAW_H = 67879, + SPELL_EXPLODE_N = 67729, + SPELL_EXPLODE_H = 67886, + SPELL_LEAP_N = 67749, + SPELL_LEAP_H = 67880, }; -#define SPELL_LEAP DUNGEON_MODE(SPELL_LEAP_N, SPELL_LEAP_H) -#define SPELL_EXPLODE DUNGEON_MODE(SPELL_EXPLODE_N, SPELL_EXPLODE_H) +#define SPELL_LEAP DUNGEON_MODE(SPELL_LEAP_N, SPELL_LEAP_H) +#define SPELL_EXPLODE DUNGEON_MODE(SPELL_EXPLODE_N, SPELL_EXPLODE_H) -#define SPELL_PLAGUE_STRIKE DUNGEON_MODE(SPELL_PLAGUE_STRIKE_N, SPELL_PLAGUE_STRIKE_H) -#define SPELL_ICY_TOUCH DUNGEON_MODE(SPELL_ICY_TOUCH_N, SPELL_ICY_TOUCH_H) -#define SPELL_DEATH_RESPITE DUNGEON_MODE(SPELL_DEATH_RESPITE_N, SPELL_DEATH_RESPITE_H) -#define SPELL_OBLITERATE DUNGEON_MODE(SPELL_OBLITERATE_N, SPELL_OBLITERATE_H) -#define SPELL_ARMY_DEAD DUNGEON_MODE(SPELL_ARMY_DEAD_N, SPELL_ARMY_DEAD_H) -#define SPELL_DESECRATION DUNGEON_MODE(SPELL_DESECRATION_N, SPELL_DESECRATION_H) -#define SPELL_DEATH_BITE DUNGEON_MODE(SPELL_DEATH_BITE_N, SPELL_DEATH_BITE_H) -#define SPELL_MARKED_DEATH DUNGEON_MODE(SPELL_MARKED_DEATH_N, SPELL_MARKED_DEATH_H) +#define SPELL_PLAGUE_STRIKE DUNGEON_MODE(SPELL_PLAGUE_STRIKE_N, SPELL_PLAGUE_STRIKE_H) +#define SPELL_ICY_TOUCH DUNGEON_MODE(SPELL_ICY_TOUCH_N, SPELL_ICY_TOUCH_H) +#define SPELL_DEATH_RESPITE DUNGEON_MODE(SPELL_DEATH_RESPITE_N, SPELL_DEATH_RESPITE_H) +#define SPELL_OBLITERATE DUNGEON_MODE(SPELL_OBLITERATE_N, SPELL_OBLITERATE_H) +#define SPELL_ARMY_DEAD DUNGEON_MODE(SPELL_ARMY_DEAD_N, SPELL_ARMY_DEAD_H) +#define SPELL_DESECRATION DUNGEON_MODE(SPELL_DESECRATION_N, SPELL_DESECRATION_H) +#define SPELL_DEATH_BITE DUNGEON_MODE(SPELL_DEATH_BITE_N, SPELL_DEATH_BITE_H) +#define SPELL_MARKED_DEATH DUNGEON_MODE(SPELL_MARKED_DEATH_N, SPELL_MARKED_DEATH_H) enum Events { - EVENT_ANNOUNCER_SAY_ZOMBIE = 1, - EVENT_SPELL_PLAGUE_STRIKE, - EVENT_SPELL_ICY_TOUCH, - EVENT_SPELL_DEATH_RESPITE, - EVENT_SPELL_OBLITERATE, - EVENT_SPELL_DESECRATION, - EVENT_SPELL_DEATH_BITE, - EVENT_SPELL_MARKED_DEATH, + EVENT_ANNOUNCER_SAY_ZOMBIE = 1, + EVENT_SPELL_PLAGUE_STRIKE, + EVENT_SPELL_ICY_TOUCH, + EVENT_SPELL_DEATH_RESPITE, + EVENT_SPELL_OBLITERATE, + EVENT_SPELL_DESECRATION, + EVENT_SPELL_DEATH_BITE, + EVENT_SPELL_MARKED_DEATH, }; enum NPCs { - NPC_RISEN_CHAMPION = 35590, + NPC_RISEN_CHAMPION = 35590, }; enum Models { - MODEL_SKELETON = 29846, - MODEL_GHOST = 21300 + MODEL_SKELETON = 29846, + MODEL_GHOST = 21300 }; class boss_black_knight : public CreatureScript { public: - boss_black_knight() : CreatureScript("boss_black_knight") { } + boss_black_knight() : CreatureScript("boss_black_knight") { } - struct boss_black_knightAI : public ScriptedAI - { - boss_black_knightAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) - { - pInstance = pCreature->GetInstanceScript(); - } + struct boss_black_knightAI : public ScriptedAI + { + boss_black_knightAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) + { + pInstance = pCreature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint8 Phase; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint8 Phase; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - Phase = 1; - me->SetDisplayId(me->GetNativeDisplayId()); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - if( pInstance ) - pInstance->SetData(BOSS_BLACK_KNIGHT, NOT_STARTED); + void Reset() + { + events.Reset(); + summons.DespawnAll(); + Phase = 1; + me->SetDisplayId(me->GetNativeDisplayId()); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + if( pInstance ) + pInstance->SetData(BOSS_BLACK_KNIGHT, NOT_STARTED); - //me->SetLootMode(0); // [LOOT] - } + //me->SetLootMode(0); // [LOOT] + } - void EnterEvadeMode() - { - me->DespawnOrUnsummon(1); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->DespawnOrUnsummon(1); + ScriptedAI::EnterEvadeMode(); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - { - damage = 0; - return; - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + damage = 0; + return; + } - if( Phase < 3 && damage >= me->GetHealth() ) - { - damage = 0; - me->SetHealth(me->GetMaxHealth()); - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveAllAuras(); - me->SetControlled(true, UNIT_STATE_STUNNED); - me->CastSpell(me, SPELL_BK_GHOUL_EXPLODE, true); - summons.clear(); + if( Phase < 3 && damage >= me->GetHealth() ) + { + damage = 0; + me->SetHealth(me->GetMaxHealth()); + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveAllAuras(); + me->SetControlled(true, UNIT_STATE_STUNNED); + me->CastSpell(me, SPELL_BK_GHOUL_EXPLODE, true); + summons.clear(); - me->CastSpell(me, SPELL_BK_FEIGN_DEATH, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); - me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->AddUnitState(UNIT_STATE_DIED); + me->CastSpell(me, SPELL_BK_FEIGN_DEATH, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->AddUnitState(UNIT_STATE_DIED); - } - } + } + } - void DoAction(int32 param) - { - if( param == -1 ) - { - summons.DespawnAll(); - } - else if( param == 1 ) - { - if( !pInstance ) - return; + void DoAction(int32 param) + { + if( param == -1 ) + { + summons.DespawnAll(); + } + else if( param == 1 ) + { + if( !pInstance ) + return; - pInstance->SetData(BOSS_BLACK_KNIGHT, IN_PROGRESS); - Talk(TEXT_BK_AGGRO); - me->CastSpell((Unit*)NULL, (pInstance->GetData(DATA_TEAMID_IN_INSTANCE)==TEAM_HORDE ? SPELL_RAISE_DEAD_JAEREN : SPELL_RAISE_DEAD_ARELAS), false); - if( Creature* announcer = pInstance->instance->GetCreature(pInstance->GetData64(DATA_ANNOUNCER)) ) - announcer->DespawnOrUnsummon(); + pInstance->SetData(BOSS_BLACK_KNIGHT, IN_PROGRESS); + Talk(TEXT_BK_AGGRO); + me->CastSpell((Unit*)NULL, (pInstance->GetData(DATA_TEAMID_IN_INSTANCE)==TEAM_HORDE ? SPELL_RAISE_DEAD_JAEREN : SPELL_RAISE_DEAD_ARELAS), false); + if( Creature* announcer = pInstance->instance->GetCreature(pInstance->GetData64(DATA_ANNOUNCER)) ) + announcer->DespawnOrUnsummon(); - events.Reset(); - events.ScheduleEvent(EVENT_ANNOUNCER_SAY_ZOMBIE, 2500); - events.ScheduleEvent(EVENT_SPELL_PLAGUE_STRIKE, urand(7000,9000)); - events.ScheduleEvent(EVENT_SPELL_ICY_TOUCH, urand(3500,7000)); - events.ScheduleEvent(EVENT_SPELL_DEATH_RESPITE, urand(13000,15000)); - events.ScheduleEvent(EVENT_SPELL_OBLITERATE, urand(11000,19000)); - } - } + events.Reset(); + events.ScheduleEvent(EVENT_ANNOUNCER_SAY_ZOMBIE, 2500); + events.ScheduleEvent(EVENT_SPELL_PLAGUE_STRIKE, urand(7000,9000)); + events.ScheduleEvent(EVENT_SPELL_ICY_TOUCH, urand(3500,7000)); + events.ScheduleEvent(EVENT_SPELL_DEATH_RESPITE, urand(13000,15000)); + events.ScheduleEvent(EVENT_SPELL_OBLITERATE, urand(11000,19000)); + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - switch( spell->Id ) - { - case SPELL_BLACK_KNIGHT_RES: - me->SetHealth(me->GetMaxHealth()); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetControlled(false, UNIT_STATE_STUNNED); - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); - me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->ClearUnitState(UNIT_STATE_DIED); + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + switch( spell->Id ) + { + case SPELL_BLACK_KNIGHT_RES: + me->SetHealth(me->GetMaxHealth()); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetControlled(false, UNIT_STATE_STUNNED); + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->ClearUnitState(UNIT_STATE_DIED); - ++Phase; + ++Phase; - switch( Phase ) - { - case 2: - me->SetDisplayId(MODEL_SKELETON); - Talk(TEXT_BK_SKELETON_RES); - me->CastSpell(me, SPELL_ARMY_DEAD, false); + switch( Phase ) + { + case 2: + me->SetDisplayId(MODEL_SKELETON); + Talk(TEXT_BK_SKELETON_RES); + me->CastSpell(me, SPELL_ARMY_DEAD, false); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_PLAGUE_STRIKE, urand(7000,9000)); - events.ScheduleEvent(EVENT_SPELL_ICY_TOUCH, urand(3500,7000)); - events.ScheduleEvent(EVENT_SPELL_OBLITERATE, urand(11000,19000)); - events.ScheduleEvent(EVENT_SPELL_DESECRATION, urand(2000,3000)); - break; - case 3: - me->SetDisplayId(MODEL_GHOST); - Talk(TEXT_BK_GHOST_RES); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_PLAGUE_STRIKE, urand(7000,9000)); + events.ScheduleEvent(EVENT_SPELL_ICY_TOUCH, urand(3500,7000)); + events.ScheduleEvent(EVENT_SPELL_OBLITERATE, urand(11000,19000)); + events.ScheduleEvent(EVENT_SPELL_DESECRATION, urand(2000,3000)); + break; + case 3: + me->SetDisplayId(MODEL_GHOST); + Talk(TEXT_BK_GHOST_RES); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_DEATH_BITE, 2000); - events.ScheduleEvent(EVENT_SPELL_MARKED_DEATH, 1000); - break; - default: - EnterEvadeMode(); - break; - } - break; - } - } + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_DEATH_BITE, 2000); + events.ScheduleEvent(EVENT_SPELL_MARKED_DEATH, 1000); + break; + default: + EnterEvadeMode(); + break; + } + break; + } + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_ANNOUNCER_SAY_ZOMBIE: - if( pInstance && !summons.empty() ) - if( Creature* ghoul = pInstance->instance->GetCreature(*summons.begin()) ) - ghoul->MonsterYell("[Zombie] .... . Brains ....", LANG_UNIVERSAL, 0); - events.PopEvent(); - break; - case EVENT_SPELL_PLAGUE_STRIKE: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_PLAGUE_STRIKE, false); - events.RepeatEvent(urand(10000,12000)); - break; - case EVENT_SPELL_ICY_TOUCH: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_ICY_TOUCH, false); - events.RepeatEvent(urand(5000,6000)); - break; - case EVENT_SPELL_DEATH_RESPITE: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true) ) - me->CastSpell(target, SPELL_DEATH_RESPITE, false); - events.RepeatEvent(urand(13000,15000)); - break; - case EVENT_SPELL_OBLITERATE: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_OBLITERATE, false); - events.RepeatEvent(urand(15000,17000)); - break; - case EVENT_SPELL_DESECRATION: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true) ) - me->CastSpell(target, SPELL_DESECRATION, false); - events.RepeatEvent(urand(14000,17000)); - break; - case EVENT_SPELL_DEATH_BITE: - me->CastSpell((Unit*)NULL, SPELL_DEATH_BITE, false); - events.RepeatEvent(urand(2000,4000)); - break; - case EVENT_SPELL_MARKED_DEATH: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.000000f, true) ) - me->CastSpell(target, SPELL_MARKED_DEATH, false); - events.RepeatEvent(9000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_ANNOUNCER_SAY_ZOMBIE: + if( pInstance && !summons.empty() ) + if( Creature* ghoul = pInstance->instance->GetCreature(*summons.begin()) ) + ghoul->MonsterYell("[Zombie] .... . Brains ....", LANG_UNIVERSAL, 0); + events.PopEvent(); + break; + case EVENT_SPELL_PLAGUE_STRIKE: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_PLAGUE_STRIKE, false); + events.RepeatEvent(urand(10000,12000)); + break; + case EVENT_SPELL_ICY_TOUCH: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_ICY_TOUCH, false); + events.RepeatEvent(urand(5000,6000)); + break; + case EVENT_SPELL_DEATH_RESPITE: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true) ) + me->CastSpell(target, SPELL_DEATH_RESPITE, false); + events.RepeatEvent(urand(13000,15000)); + break; + case EVENT_SPELL_OBLITERATE: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_OBLITERATE, false); + events.RepeatEvent(urand(15000,17000)); + break; + case EVENT_SPELL_DESECRATION: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true) ) + me->CastSpell(target, SPELL_DESECRATION, false); + events.RepeatEvent(urand(14000,17000)); + break; + case EVENT_SPELL_DEATH_BITE: + me->CastSpell((Unit*)NULL, SPELL_DEATH_BITE, false); + events.RepeatEvent(urand(2000,4000)); + break; + case EVENT_SPELL_MARKED_DEATH: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.000000f, true) ) + me->CastSpell(target, SPELL_MARKED_DEATH, false); + events.RepeatEvent(9000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if( Unit* target = summon->SelectNearestTarget(200.0f) ) - { - summon->AI()->AttackStart(target); - DoZoneInCombat(summon); - } - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if( Unit* target = summon->SelectNearestTarget(200.0f) ) + { + summon->AI()->AttackStart(target); + DoZoneInCombat(summon); + } + } - void KilledUnit(Unit* victim) - { - if( victim->GetTypeId() == TYPEID_PLAYER ) - { - if( urand(0,1) ) - Talk(TEXT_BK_SLAIN_1); - else - Talk(TEXT_BK_SLAIN_2); - } - } + void KilledUnit(Unit* victim) + { + if( victim->GetTypeId() == TYPEID_PLAYER ) + { + if( urand(0,1) ) + Talk(TEXT_BK_SLAIN_1); + else + Talk(TEXT_BK_SLAIN_2); + } + } - void JustDied(Unit* /*killer*/) - { - me->CastSpell((Unit*)NULL, SPELL_BK_KILL_CREDIT, true); - Talk(TEXT_BK_DEATH); - if( pInstance ) - pInstance->SetData(BOSS_BLACK_KNIGHT, DONE); - if( me->ToTempSummon() ) - me->ToTempSummon()->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); - } - }; + void JustDied(Unit* /*killer*/) + { + me->CastSpell((Unit*)NULL, SPELL_BK_KILL_CREDIT, true); + Talk(TEXT_BK_DEATH); + if( pInstance ) + pInstance->SetData(BOSS_BLACK_KNIGHT, DONE); + if( me->ToTempSummon() ) + me->ToTempSummon()->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); + } + }; - CreatureAI* GetAI(Creature *pCreature) const - { - return new boss_black_knightAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new boss_black_knightAI (pCreature); + } }; class npc_black_knight_skeletal_gryphon : public CreatureScript { public: - npc_black_knight_skeletal_gryphon() : CreatureScript("npc_black_knight_skeletal_gryphon") {} + npc_black_knight_skeletal_gryphon() : CreatureScript("npc_black_knight_skeletal_gryphon") {} - struct npc_black_knight_skeletal_gryphonAI : public npc_escortAI - { - npc_black_knight_skeletal_gryphonAI(Creature* pCreature) : npc_escortAI(pCreature) {} + struct npc_black_knight_skeletal_gryphonAI : public npc_escortAI + { + npc_black_knight_skeletal_gryphonAI(Creature* pCreature) : npc_escortAI(pCreature) {} - void Reset() - { - Start(false,true,0,NULL); - SetDespawnAtEnd(true); - } + void Reset() + { + Start(false,true,0,NULL); + SetDespawnAtEnd(true); + } - void DoAction(int32 param) - { - if( param == 1 ) - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - SetEscortPaused(false); - } - } + void DoAction(int32 param) + { + if( param == 1 ) + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + SetEscortPaused(false); + } + } - void WaypointReached(uint32 i) - { - if( i == 12 ) - { - SetEscortPaused(true); - me->SetOrientation(3.62f); - me->SetControlled(true, UNIT_STATE_ROOT); - me->DisableRotate(true); - me->SetFacingTo(3.62f); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_MOUNT_SPECIAL); - if( InstanceScript* pInstance = me->GetInstanceScript() ) - pInstance->SetData(DATA_SKELETAL_GRYPHON_LANDED, 0); - } - } + void WaypointReached(uint32 i) + { + if( i == 12 ) + { + SetEscortPaused(true); + me->SetOrientation(3.62f); + me->SetControlled(true, UNIT_STATE_ROOT); + me->DisableRotate(true); + me->SetFacingTo(3.62f); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_MOUNT_SPECIAL); + if( InstanceScript* pInstance = me->GetInstanceScript() ) + pInstance->SetData(DATA_SKELETAL_GRYPHON_LANDED, 0); + } + } - void UpdateAI(uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - } + void UpdateAI(uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + } - }; + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_black_knight_skeletal_gryphonAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_black_knight_skeletal_gryphonAI(pCreature); + } }; class npc_black_knight_ghoul : public CreatureScript { public: - npc_black_knight_ghoul() : CreatureScript("npc_black_knight_ghoul") { } + npc_black_knight_ghoul() : CreatureScript("npc_black_knight_ghoul") { } - struct npc_black_knight_ghoulAI : public ScriptedAI - { - npc_black_knight_ghoulAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - } + struct npc_black_knight_ghoulAI : public ScriptedAI + { + npc_black_knight_ghoulAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* who) - { - events.Reset(); - if (me->GetEntry() == NPC_RISEN_JAEREN || me->GetEntry() == NPC_RISEN_ARELAS) - events.RescheduleEvent(1, 1000); // leap - events.RescheduleEvent(2, urand(3000,4000)); // claw - } + void EnterCombat(Unit* who) + { + events.Reset(); + if (me->GetEntry() == NPC_RISEN_JAEREN || me->GetEntry() == NPC_RISEN_ARELAS) + events.RescheduleEvent(1, 1000); // leap + events.RescheduleEvent(2, urand(3000,4000)); // claw + } - void SpellHit(Unit* caster, const SpellInfo* spell) - { - if (spell->Id == SPELL_BK_GHOUL_EXPLODE) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - me->CastSpell(me, SPELL_EXPLODE, false); - } - } + void SpellHit(Unit* caster, const SpellInfo* spell) + { + if (spell->Id == SPELL_BK_GHOUL_EXPLODE) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + me->CastSpell(me, SPELL_EXPLODE, false); + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - switch(spell->Id) - { - case SPELL_CLAW_N: - case SPELL_CLAW_H: - DoResetThreat(); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) - { - me->AddThreat(target, 100.0f); - AttackStart(target); - } - break; - case SPELL_EXPLODE_H: - if (target && target->GetTypeId() == TYPEID_PLAYER) - if (pInstance) - pInstance->SetData(DATA_ACHIEV_IVE_HAD_WORSE, 0); - break; - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + switch(spell->Id) + { + case SPELL_CLAW_N: + case SPELL_CLAW_H: + DoResetThreat(); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f)) + { + me->AddThreat(target, 100.0f); + AttackStart(target); + } + break; + case SPELL_EXPLODE_H: + if (target && target->GetTypeId() == TYPEID_PLAYER) + if (pInstance) + pInstance->SetData(DATA_ACHIEV_IVE_HAD_WORSE, 0); + break; + } + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case 1: // leap - if (Unit* target = me->GetVictim()) - if (me->GetDistance(target) > 5.0f && me->GetDistance(target) < 30.0f) - { - me->CastSpell(target, SPELL_LEAP, false); - events.PopEvent(); - break; - } - events.RepeatEvent(1000); - break; - case 2: // claw - if (Unit* target = me->GetVictim()) - me->CastSpell(target, SPELL_CLAW_N, false); - events.RepeatEvent(urand(6000,8000)); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case 1: // leap + if (Unit* target = me->GetVictim()) + if (me->GetDistance(target) > 5.0f && me->GetDistance(target) < 30.0f) + { + me->CastSpell(target, SPELL_LEAP, false); + events.PopEvent(); + break; + } + events.RepeatEvent(1000); + break; + case 2: // claw + if (Unit* target = me->GetVictim()) + me->CastSpell(target, SPELL_CLAW_N, false); + events.RepeatEvent(urand(6000,8000)); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_black_knight_ghoulAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_black_knight_ghoulAI (pCreature); + } }; void AddSC_boss_black_knight() { - new boss_black_knight(); - new npc_black_knight_skeletal_gryphon(); - new npc_black_knight_ghoul(); + new boss_black_knight(); + new npc_black_knight_skeletal_gryphon(); + new npc_black_knight_ghoul(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index 9c91f6c8d..f2177ed97 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -13,931 +13,931 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum MountSpells { - SPELL_PLAYER_VEHICLE_DEFEND = 66482, - SPELL_MINIONS_DEFEND = 64100, - SPELL_BOSS_DEFEND = 62719, - SPELL_BOSS_DEFEND_PERIODIC = 64553, - SPELL_SHIELD_LEVEL_1_VISUAL = 63130, - SPELL_SHIELD_LEVEL_2_VISUAL = 63131, - SPELL_SHIELD_LEVEL_3_VISUAL = 63132, + SPELL_PLAYER_VEHICLE_DEFEND = 66482, + SPELL_MINIONS_DEFEND = 64100, + SPELL_BOSS_DEFEND = 62719, + SPELL_BOSS_DEFEND_PERIODIC = 64553, + SPELL_SHIELD_LEVEL_1_VISUAL = 63130, + SPELL_SHIELD_LEVEL_2_VISUAL = 63131, + SPELL_SHIELD_LEVEL_3_VISUAL = 63132, - SPELL_PLAYER_VEHICLE_SHIELD_BREAKER = 62575, - SPELL_PLAYER_SHIELD_BREAKER_DAMAGE = 62626, - SPELL_NPC_SHIELD_BREAKER = 68504, + SPELL_PLAYER_VEHICLE_SHIELD_BREAKER = 62575, + SPELL_PLAYER_SHIELD_BREAKER_DAMAGE = 62626, + SPELL_NPC_SHIELD_BREAKER = 68504, - SPELL_PLAYER_VEHICLE_CHARGE = 68284, - SPELL_CHARGE_DAMAGE_20000 = 68498, - SPELL_MINIONS_CHARGE = 63010, - SPELL_BOSS_CHARGE = 68301, // triggers SPELL_MINIONS_CHARGE (should be with custom damage?) + SPELL_PLAYER_VEHICLE_CHARGE = 68284, + SPELL_CHARGE_DAMAGE_20000 = 68498, + SPELL_MINIONS_CHARGE = 63010, + SPELL_BOSS_CHARGE = 68301, // triggers SPELL_MINIONS_CHARGE (should be with custom damage?) - SPELL_PLAYER_VEHICLE_THRUST = 68505, + SPELL_PLAYER_VEHICLE_THRUST = 68505, - SPELL_TRAMPLE_AURA = 67865, - SPELL_TRAMPLE_TRIGGERED_DUMMY = 67866, - SPELL_TRAMPLE_STUN = 67867, + SPELL_TRAMPLE_AURA = 67865, + SPELL_TRAMPLE_TRIGGERED_DUMMY = 67866, + SPELL_TRAMPLE_STUN = 67867, }; enum ChampionSpells { - // Mage (Ambrose Boltspark, Eressea Dawnsinger) - SPELL_FIREBALL_N = 66042, - SPELL_FIREBALL_H = 68310, - SPELL_BLAST_WAVE_N = 66044, - SPELL_BLAST_WAVE_H = 68312, - SPELL_HASTE = 66045, - SPELL_POLYMORPH_N = 66043, - SPELL_POLYMORPH_H = 68311, + // Mage (Ambrose Boltspark, Eressea Dawnsinger) + SPELL_FIREBALL_N = 66042, + SPELL_FIREBALL_H = 68310, + SPELL_BLAST_WAVE_N = 66044, + SPELL_BLAST_WAVE_H = 68312, + SPELL_HASTE = 66045, + SPELL_POLYMORPH_N = 66043, + SPELL_POLYMORPH_H = 68311, - // Shaman (Colosos, Runok Wildmane) - SPELL_CHAIN_LIGHTNING_N = 67529, - SPELL_CHAIN_LIGHTNING_H = 68319, - SPELL_EARTH_SHIELD = 67530, - SPELL_HEALING_WAVE_N = 67528, - SPELL_HEALING_WAVE_H = 68318, - SPELL_HEX_OF_MENDING = 67534, + // Shaman (Colosos, Runok Wildmane) + SPELL_CHAIN_LIGHTNING_N = 67529, + SPELL_CHAIN_LIGHTNING_H = 68319, + SPELL_EARTH_SHIELD = 67530, + SPELL_HEALING_WAVE_N = 67528, + SPELL_HEALING_WAVE_H = 68318, + SPELL_HEX_OF_MENDING = 67534, - // Hunter (Jaelyne Evensong, Zul'tore) - SPELL_DISENGAGE = 68339, - SPELL_LIGHTNING_ARROWS = 66083, - SPELL_MULTI_SHOT = 66081, - SPELL_SHOOT_N = 65868, - SPELL_SHOOT_H = 67988, + // Hunter (Jaelyne Evensong, Zul'tore) + SPELL_DISENGAGE = 68339, + SPELL_LIGHTNING_ARROWS = 66083, + SPELL_MULTI_SHOT = 66081, + SPELL_SHOOT_N = 65868, + SPELL_SHOOT_H = 67988, - // Rogue (Lana Stouthammer Evensong, Deathstalker Visceri) - SPELL_EVISCERATE_N = 67709, - SPELL_EVISCERATE_H = 68317, - SPELL_FAN_OF_KNIVES = 67706, - SPELL_POISON_BOTTLE = 67701, + // Rogue (Lana Stouthammer Evensong, Deathstalker Visceri) + SPELL_EVISCERATE_N = 67709, + SPELL_EVISCERATE_H = 68317, + SPELL_FAN_OF_KNIVES = 67706, + SPELL_POISON_BOTTLE = 67701, - // Warrior (Marshal Jacob Alerius, Mokra the Skullcrusher) - SPELL_MORTAL_STRIKE_N = 68783, - SPELL_MORTAL_STRIKE_H = 68784, - SPELL_BLADESTORM = 63784, - SPELL_INTERCEPT = 67540, - SPELL_ROLLING_THROW = 67546, // not implemented yet! + // Warrior (Marshal Jacob Alerius, Mokra the Skullcrusher) + SPELL_MORTAL_STRIKE_N = 68783, + SPELL_MORTAL_STRIKE_H = 68784, + SPELL_BLADESTORM = 63784, + SPELL_INTERCEPT = 67540, + SPELL_ROLLING_THROW = 67546, // not implemented yet! }; -#define SPELL_FIREBALL DUNGEON_MODE(SPELL_FIREBALL_N, SPELL_FIREBALL_H) -#define SPELL_BLAST_WAVE DUNGEON_MODE(SPELL_BLAST_WAVE_N, SPELL_BLAST_WAVE_H) -#define SPELL_POLYMORPH DUNGEON_MODE(SPELL_POLYMORPH_N, SPELL_POLYMORPH_H) -#define SPELL_CHAIN_LIGHTNING DUNGEON_MODE(SPELL_CHAIN_LIGHTNING_N, SPELL_CHAIN_LIGHTNING_H) -#define SPELL_HEALING_WAVE DUNGEON_MODE(SPELL_HEALING_WAVE_N, SPELL_HEALING_WAVE_H) -#define SPELL_SHOOT DUNGEON_MODE(SPELL_SHOOT_N, SPELL_SHOOT_H) -#define SPELL_EVISCERATE DUNGEON_MODE(SPELL_EVISCERATE_N, SPELL_EVISCERATE_H) -#define SPELL_MORTAL_STRIKE DUNGEON_MODE(SPELL_MORTAL_STRIKE_N, SPELL_MORTAL_STRIKE_H) +#define SPELL_FIREBALL DUNGEON_MODE(SPELL_FIREBALL_N, SPELL_FIREBALL_H) +#define SPELL_BLAST_WAVE DUNGEON_MODE(SPELL_BLAST_WAVE_N, SPELL_BLAST_WAVE_H) +#define SPELL_POLYMORPH DUNGEON_MODE(SPELL_POLYMORPH_N, SPELL_POLYMORPH_H) +#define SPELL_CHAIN_LIGHTNING DUNGEON_MODE(SPELL_CHAIN_LIGHTNING_N, SPELL_CHAIN_LIGHTNING_H) +#define SPELL_HEALING_WAVE DUNGEON_MODE(SPELL_HEALING_WAVE_N, SPELL_HEALING_WAVE_H) +#define SPELL_SHOOT DUNGEON_MODE(SPELL_SHOOT_N, SPELL_SHOOT_H) +#define SPELL_EVISCERATE DUNGEON_MODE(SPELL_EVISCERATE_N, SPELL_EVISCERATE_H) +#define SPELL_MORTAL_STRIKE DUNGEON_MODE(SPELL_MORTAL_STRIKE_N, SPELL_MORTAL_STRIKE_H) enum MountEvents { - EVENT_NONE = 0, - EVENT_MOUNT_CHARGE, - EVENT_SHIELD_BREAKER, - EVENT_THRUST, - EVENT_FIND_NEW_MOUNT, + EVENT_NONE = 0, + EVENT_MOUNT_CHARGE, + EVENT_SHIELD_BREAKER, + EVENT_THRUST, + EVENT_FIND_NEW_MOUNT, }; enum ChampionEvents { - EVEMT_MAGE_SPELL_FIREBALL = 101, - EVEMT_MAGE_SPELL_BLAST_WAVE, - EVEMT_MAGE_SPELL_HASTE, - EVEMT_MAGE_SPELL_POLYMORPH, + EVEMT_MAGE_SPELL_FIREBALL = 101, + EVEMT_MAGE_SPELL_BLAST_WAVE, + EVEMT_MAGE_SPELL_HASTE, + EVEMT_MAGE_SPELL_POLYMORPH, - EVENT_SHAMAN_SPELL_CHAIN_LIGHTNING, - EVENT_SHAMAN_SPELL_EARTH_SHIELD, - EVENT_SHAMAN_SPELL_HEALING_WAVE, - EVENT_SHAMAN_SPELL_HEX_OF_MENDING, + EVENT_SHAMAN_SPELL_CHAIN_LIGHTNING, + EVENT_SHAMAN_SPELL_EARTH_SHIELD, + EVENT_SHAMAN_SPELL_HEALING_WAVE, + EVENT_SHAMAN_SPELL_HEX_OF_MENDING, - EVENT_HUNTER_SPELL_DISENGAGE, - EVENT_HUNTER_SPELL_LIGHTNING_ARROWS, - EVENT_HUNTER_SPELL_MULTI_SHOT, - EVENT_HUNTER_SPELL_SHOOT, + EVENT_HUNTER_SPELL_DISENGAGE, + EVENT_HUNTER_SPELL_LIGHTNING_ARROWS, + EVENT_HUNTER_SPELL_MULTI_SHOT, + EVENT_HUNTER_SPELL_SHOOT, - EVENT_ROGUE_SPELL_EVISCERATE, - EVENT_ROGUE_SPELL_FAN_OF_KNIVES, - EVENT_ROGUE_SPELL_POISON_BOTTLE, + EVENT_ROGUE_SPELL_EVISCERATE, + EVENT_ROGUE_SPELL_FAN_OF_KNIVES, + EVENT_ROGUE_SPELL_POISON_BOTTLE, - EVENT_WARRIOR_SPELL_MORTAL_STRIKE, - EVENT_WARRIOR_SPELL_BLADESTORM, - EVENT_WARRIOR_SPELL_INTERCEPT, - EVENT_WARRIOR_SPELL_ROLLING_THROW, + EVENT_WARRIOR_SPELL_MORTAL_STRIKE, + EVENT_WARRIOR_SPELL_BLADESTORM, + EVENT_WARRIOR_SPELL_INTERCEPT, + EVENT_WARRIOR_SPELL_ROLLING_THROW, }; class npc_toc5_player_vehicle : public CreatureScript { public: - npc_toc5_player_vehicle() : CreatureScript("npc_toc5_player_vehicle") { } + npc_toc5_player_vehicle() : CreatureScript("npc_toc5_player_vehicle") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_toc5_player_vehicleAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_toc5_player_vehicleAI(pCreature); + } - struct npc_toc5_player_vehicleAI : public NullCreatureAI - { - npc_toc5_player_vehicleAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry()); - m_ConditionsTimer = 1000; - } + struct npc_toc5_player_vehicleAI : public NullCreatureAI + { + npc_toc5_player_vehicleAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry()); + m_ConditionsTimer = 1000; + } - ConditionList conditions; - uint16 m_ConditionsTimer; + ConditionList conditions; + uint16 m_ConditionsTimer; - void Reset() - { - me->SetReactState(REACT_PASSIVE); - me->getHostileRefManager().setOnlineOfflineState(false); - } + void Reset() + { + me->SetReactState(REACT_PASSIVE); + me->getHostileRefManager().setOnlineOfflineState(false); + } - void OnCharmed(bool apply) - { - if (me->IsDuringRemoveFromWorld()) - return; + void OnCharmed(bool apply) + { + if (me->IsDuringRemoveFromWorld()) + return; - if( apply ) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetSpeed(MOVE_RUN, 2.0f, false); - me->CastSpell(me, SPELL_TRAMPLE_AURA, true); - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->StopMoving(); - me->RemoveAura(SPELL_TRAMPLE_AURA); - } - } + if( apply ) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetSpeed(MOVE_RUN, 2.0f, false); + me->CastSpell(me, SPELL_TRAMPLE_AURA, true); + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->StopMoving(); + me->RemoveAura(SPELL_TRAMPLE_AURA); + } + } - // just in case, should be done in spell_gen_defend - void PassengerBoarded(Unit* who, int8 seat, bool apply) - { - if (me->IsDuringRemoveFromWorld()) - return; + // just in case, should be done in spell_gen_defend + void PassengerBoarded(Unit* who, int8 seat, bool apply) + { + if (me->IsDuringRemoveFromWorld()) + return; - if( !apply ) - { - me->RemoveAura(SPELL_PLAYER_VEHICLE_DEFEND); - who->RemoveAura(SPELL_PLAYER_VEHICLE_DEFEND); - for (uint8 i=0; i<3; ++i) - who->RemoveAura(SPELL_SHIELD_LEVEL_1_VISUAL + i); - } - } + if( !apply ) + { + me->RemoveAura(SPELL_PLAYER_VEHICLE_DEFEND); + who->RemoveAura(SPELL_PLAYER_VEHICLE_DEFEND); + for (uint8 i=0; i<3; ++i) + who->RemoveAura(SPELL_SHIELD_LEVEL_1_VISUAL + i); + } + } - //void EnterEvadeMode() { CreatureAI::EnterEvadeMode(); } - void MoveInLineOfSight(Unit* who) {} - void UpdateAI(uint32 diff) - { - if (m_ConditionsTimer <= diff) - { - if (!conditions.empty()) - if (Unit* passenger = me->GetVehicleKit()->GetPassenger(0)) - if (!sConditionMgr->IsObjectMeetToConditions(passenger, me, conditions)) - passenger->ExitVehicle(); - m_ConditionsTimer = VEHICLE_CONDITION_CHECK_TIME; - } - else - m_ConditionsTimer -= diff; - } - void AttackStart(Unit* who) {} - void EnterCombat(Unit* who) {} - }; + //void EnterEvadeMode() { CreatureAI::EnterEvadeMode(); } + void MoveInLineOfSight(Unit* who) {} + void UpdateAI(uint32 diff) + { + if (m_ConditionsTimer <= diff) + { + if (!conditions.empty()) + if (Unit* passenger = me->GetVehicleKit()->GetPassenger(0)) + if (!sConditionMgr->IsObjectMeetToConditions(passenger, me, conditions)) + passenger->ExitVehicle(); + m_ConditionsTimer = VEHICLE_CONDITION_CHECK_TIME; + } + else + m_ConditionsTimer -= diff; + } + void AttackStart(Unit* who) {} + void EnterCombat(Unit* who) {} + }; }; class npc_toc5_grand_champion_minion : public CreatureScript { public: - npc_toc5_grand_champion_minion() : CreatureScript("npc_toc5_grand_champion_minion") { } + npc_toc5_grand_champion_minion() : CreatureScript("npc_toc5_grand_champion_minion") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_toc5_grand_champion_minionAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_toc5_grand_champion_minionAI(pCreature); + } - struct npc_toc5_grand_champion_minionAI : public ScriptedAI - { - npc_toc5_grand_champion_minionAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - } + struct npc_toc5_grand_champion_minionAI : public ScriptedAI + { + npc_toc5_grand_champion_minionAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - InstanceScript* pInstance; - int32 ShieldTimer; - EventMap events; + InstanceScript* pInstance; + int32 ShieldTimer; + EventMap events; - void Reset() - { - ShieldTimer = 0; - events.Reset(); - } + void Reset() + { + ShieldTimer = 0; + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.Reset(); - events.ScheduleEvent(EVENT_MOUNT_CHARGE, urand(2500,4000)); - events.ScheduleEvent(EVENT_SHIELD_BREAKER, urand(5000,8000)); - events.ScheduleEvent(EVENT_THRUST, urand(3000,5000)); - me->CastSpell(me, SPELL_TRAMPLE_AURA, true); - } + void EnterCombat(Unit* /*who*/) + { + events.Reset(); + events.ScheduleEvent(EVENT_MOUNT_CHARGE, urand(2500,4000)); + events.ScheduleEvent(EVENT_SHIELD_BREAKER, urand(5000,8000)); + events.ScheduleEvent(EVENT_THRUST, urand(3000,5000)); + me->CastSpell(me, SPELL_TRAMPLE_AURA, true); + } - void UpdateAI(uint32 diff) - { - if( ShieldTimer <= (int32)diff ) - { - me->CastSpell(me, SPELL_MINIONS_DEFEND, true); - ShieldTimer = 5000; - } - else - ShieldTimer -= diff; + void UpdateAI(uint32 diff) + { + if( ShieldTimer <= (int32)diff ) + { + me->CastSpell(me, SPELL_MINIONS_DEFEND, true); + ShieldTimer = 5000; + } + else + ShieldTimer -= diff; - if ( !UpdateVictim() ) - return; + if ( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_MOUNT_CHARGE: - { - std::vector LIST; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - { - if( me->GetExactDist(plr) < 8.0f || me->GetExactDist(plr) > 25.0f || plr->isDead() ) - continue; - if( !plr->GetVehicle() ) - LIST.push_back(plr->GetGUID()); - else if( Vehicle* v = plr->GetVehicle() ) - { - if( Unit* mount = v->GetBase() ) - LIST.push_back(mount->GetGUID()); - } - } - if( !LIST.empty() ) - { - uint8 rnd = LIST.size()>1 ? urand(0,LIST.size()-1) : 0; - if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) ) - { - me->getThreatManager().resetAllAggro(); - me->AddThreat(target, 10000.0f); - AttackStart(target); - me->CastSpell(target, SPELL_MINIONS_CHARGE, false); - } - } - events.RepeatEvent(urand(4500,6000)); - } - break; - case EVENT_SHIELD_BREAKER: - { - std::vector LIST; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - { - if( me->GetExactDist(plr) < 10.0f || me->GetExactDist(plr) > 30.0f ) - continue; - if( Vehicle* v = plr->GetVehicle() ) - if( Unit* mount = v->GetBase() ) - LIST.push_back(mount->GetGUID()); - } - if( !LIST.empty() ) - { - uint8 rnd = LIST.size()>1 ? urand(0,LIST.size()-1) : 0; - if( Unit* target = ObjectAccessor::GetCreature(*me, LIST.at(rnd)) ) - me->CastSpell(target, SPELL_NPC_SHIELD_BREAKER, false); - } - events.RepeatEvent(urand(6000,8000)); - } - break; - case EVENT_THRUST: - if( me->GetVictim() && me->GetExactDist(me->GetVictim()) <= 5.5f ) - me->CastSpell(me->GetVictim(), SPELL_PLAYER_VEHICLE_THRUST, false); - events.RepeatEvent(urand(3000,5000)); - break; - } - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_MOUNT_CHARGE: + { + std::vector LIST; + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + { + if( me->GetExactDist(plr) < 8.0f || me->GetExactDist(plr) > 25.0f || plr->isDead() ) + continue; + if( !plr->GetVehicle() ) + LIST.push_back(plr->GetGUID()); + else if( Vehicle* v = plr->GetVehicle() ) + { + if( Unit* mount = v->GetBase() ) + LIST.push_back(mount->GetGUID()); + } + } + if( !LIST.empty() ) + { + uint8 rnd = LIST.size()>1 ? urand(0,LIST.size()-1) : 0; + if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) ) + { + me->getThreatManager().resetAllAggro(); + me->AddThreat(target, 10000.0f); + AttackStart(target); + me->CastSpell(target, SPELL_MINIONS_CHARGE, false); + } + } + events.RepeatEvent(urand(4500,6000)); + } + break; + case EVENT_SHIELD_BREAKER: + { + std::vector LIST; + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + { + if( me->GetExactDist(plr) < 10.0f || me->GetExactDist(plr) > 30.0f ) + continue; + if( Vehicle* v = plr->GetVehicle() ) + if( Unit* mount = v->GetBase() ) + LIST.push_back(mount->GetGUID()); + } + if( !LIST.empty() ) + { + uint8 rnd = LIST.size()>1 ? urand(0,LIST.size()-1) : 0; + if( Unit* target = ObjectAccessor::GetCreature(*me, LIST.at(rnd)) ) + me->CastSpell(target, SPELL_NPC_SHIELD_BREAKER, false); + } + events.RepeatEvent(urand(6000,8000)); + } + break; + case EVENT_THRUST: + if( me->GetVictim() && me->GetExactDist(me->GetVictim()) <= 5.5f ) + me->CastSpell(me->GetVictim(), SPELL_PLAYER_VEHICLE_THRUST, false); + events.RepeatEvent(urand(3000,5000)); + break; + } + } - void JustDied(Unit* /*pKiller*/) - { - me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); - me->DespawnOrUnsummon(10000); - if( pInstance ) - pInstance->SetData(DATA_MOUNT_DIED, 0); - } - }; + void JustDied(Unit* /*pKiller*/) + { + me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); + me->DespawnOrUnsummon(10000); + if( pInstance ) + pInstance->SetData(DATA_MOUNT_DIED, 0); + } + }; }; class boss_grand_champion : public CreatureScript { public: - boss_grand_champion() : CreatureScript("boss_grand_champion") { } + boss_grand_champion() : CreatureScript("boss_grand_champion") { } - struct boss_grand_championAI : public npc_escortAI - { - boss_grand_championAI(Creature* pCreature) : npc_escortAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - MountPhase = true; - SetDespawnAtEnd(false); - me->SetReactState(REACT_PASSIVE); - BossOrder = 0; - NewMountGUID = 0; - me->CastSpell(me, SPELL_BOSS_DEFEND_PERIODIC, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + struct boss_grand_championAI : public npc_escortAI + { + boss_grand_championAI(Creature* pCreature) : npc_escortAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + MountPhase = true; + SetDespawnAtEnd(false); + me->SetReactState(REACT_PASSIVE); + BossOrder = 0; + NewMountGUID = 0; + me->CastSpell(me, SPELL_BOSS_DEFEND_PERIODIC, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - events.Reset(); - events.ScheduleEvent(EVENT_MOUNT_CHARGE, urand(2500,4000)); - events.ScheduleEvent(EVENT_SHIELD_BREAKER, urand(5000,8000)); - events.ScheduleEvent(EVENT_THRUST, urand(3000,5000)); + events.Reset(); + events.ScheduleEvent(EVENT_MOUNT_CHARGE, urand(2500,4000)); + events.ScheduleEvent(EVENT_SHIELD_BREAKER, urand(5000,8000)); + events.ScheduleEvent(EVENT_THRUST, urand(3000,5000)); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISTRACT, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FEAR, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_GRIP, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_ROOT, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SLEEP, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SNARE, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FREEZE, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_KNOCKOUT, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SHACKLE, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_TURN, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_HORROR, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DAZE, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SAPPED, true); - } + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISTRACT, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FEAR, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_GRIP, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_ROOT, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SLEEP, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SNARE, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FREEZE, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_KNOCKOUT, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SHACKLE, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_TURN, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_HORROR, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DAZE, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SAPPED, true); + } - InstanceScript* pInstance; - EventMap events; - uint32 BossOrder; - bool MountPhase; - uint64 NewMountGUID; - uint64 UnitTargetGUID; + InstanceScript* pInstance; + EventMap events; + uint32 BossOrder; + bool MountPhase; + uint64 NewMountGUID; + uint64 UnitTargetGUID; - void Reset() - { - if( pInstance && pInstance->GetData(DATA_INSTANCE_PROGRESS) == INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED ) - { - DoAction(1); - DoAction(2); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); - me->SetReactState(REACT_AGGRESSIVE); - } - } + void Reset() + { + if( pInstance && pInstance->GetData(DATA_INSTANCE_PROGRESS) == INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED ) + { + DoAction(1); + DoAction(2); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); + me->SetReactState(REACT_AGGRESSIVE); + } + } - void EnterCombat(Unit* /*who*/) - { - if( pInstance && pInstance->GetData(DATA_INSTANCE_PROGRESS) == INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED ) - me->CallForHelp(100.0f); - } + void EnterCombat(Unit* /*who*/) + { + if( pInstance && pInstance->GetData(DATA_INSTANCE_PROGRESS) == INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED ) + me->CallForHelp(100.0f); + } - void ScheduleAbilitiesEvents() - { - me->m_spellImmune[IMMUNITY_MECHANIC].clear(); - events.Reset(); - switch( me->GetEntry() ) - { - case NPC_AMBROSE: // Ambrose Boltspark - case NPC_ERESSEA: // Eressea Dawnsinger - events.RescheduleEvent(EVEMT_MAGE_SPELL_FIREBALL, 5000); - events.RescheduleEvent(EVEMT_MAGE_SPELL_BLAST_WAVE, 12000); - events.RescheduleEvent(EVEMT_MAGE_SPELL_HASTE, 22000); - events.RescheduleEvent(EVEMT_MAGE_SPELL_POLYMORPH, 8000); - break; - case NPC_COLOSOS: // Colosos - case NPC_RUNOK: // Runok Wildmane - events.RescheduleEvent(EVENT_SHAMAN_SPELL_CHAIN_LIGHTNING, 16000); - events.RescheduleEvent(EVENT_SHAMAN_SPELL_EARTH_SHIELD, urand(30000,35000)); - events.RescheduleEvent(EVENT_SHAMAN_SPELL_HEALING_WAVE, 12000); - events.RescheduleEvent(EVENT_SHAMAN_SPELL_HEX_OF_MENDING, urand(20000,25000)); - break; - case NPC_JAELYNE: // Jaelyne Evensong - case NPC_ZULTORE: // Zul'tore - //events.RescheduleEvent(EVENT_HUNTER_SPELL_DISENGAGE, x); - events.RescheduleEvent(EVENT_HUNTER_SPELL_LIGHTNING_ARROWS, 7000); - events.RescheduleEvent(EVENT_HUNTER_SPELL_MULTI_SHOT, 12000); - break; - case NPC_LANA: // Lana Stouthammer - case NPC_VISCERI: // Deathstalker Visceri - events.RescheduleEvent(EVENT_ROGUE_SPELL_EVISCERATE, 8000); - events.RescheduleEvent(EVENT_ROGUE_SPELL_FAN_OF_KNIVES, 14000); - events.RescheduleEvent(EVENT_ROGUE_SPELL_POISON_BOTTLE, 19000); - break; - case NPC_JACOB: // Marshal Jacob Alerius - case NPC_MOKRA: // Mokra the Skullcrusher - events.RescheduleEvent(EVENT_WARRIOR_SPELL_MORTAL_STRIKE, urand(8000,12000)); - events.RescheduleEvent(EVENT_WARRIOR_SPELL_BLADESTORM, urand(15000,20000)); - events.RescheduleEvent(EVENT_WARRIOR_SPELL_INTERCEPT, 7000); - //events.RescheduleEvent(EVENT_WARRIOR_SPELL_ROLLING_THROW, x); - break; - default: - break; - } - } + void ScheduleAbilitiesEvents() + { + me->m_spellImmune[IMMUNITY_MECHANIC].clear(); + events.Reset(); + switch( me->GetEntry() ) + { + case NPC_AMBROSE: // Ambrose Boltspark + case NPC_ERESSEA: // Eressea Dawnsinger + events.RescheduleEvent(EVEMT_MAGE_SPELL_FIREBALL, 5000); + events.RescheduleEvent(EVEMT_MAGE_SPELL_BLAST_WAVE, 12000); + events.RescheduleEvent(EVEMT_MAGE_SPELL_HASTE, 22000); + events.RescheduleEvent(EVEMT_MAGE_SPELL_POLYMORPH, 8000); + break; + case NPC_COLOSOS: // Colosos + case NPC_RUNOK: // Runok Wildmane + events.RescheduleEvent(EVENT_SHAMAN_SPELL_CHAIN_LIGHTNING, 16000); + events.RescheduleEvent(EVENT_SHAMAN_SPELL_EARTH_SHIELD, urand(30000,35000)); + events.RescheduleEvent(EVENT_SHAMAN_SPELL_HEALING_WAVE, 12000); + events.RescheduleEvent(EVENT_SHAMAN_SPELL_HEX_OF_MENDING, urand(20000,25000)); + break; + case NPC_JAELYNE: // Jaelyne Evensong + case NPC_ZULTORE: // Zul'tore + //events.RescheduleEvent(EVENT_HUNTER_SPELL_DISENGAGE, x); + events.RescheduleEvent(EVENT_HUNTER_SPELL_LIGHTNING_ARROWS, 7000); + events.RescheduleEvent(EVENT_HUNTER_SPELL_MULTI_SHOT, 12000); + break; + case NPC_LANA: // Lana Stouthammer + case NPC_VISCERI: // Deathstalker Visceri + events.RescheduleEvent(EVENT_ROGUE_SPELL_EVISCERATE, 8000); + events.RescheduleEvent(EVENT_ROGUE_SPELL_FAN_OF_KNIVES, 14000); + events.RescheduleEvent(EVENT_ROGUE_SPELL_POISON_BOTTLE, 19000); + break; + case NPC_JACOB: // Marshal Jacob Alerius + case NPC_MOKRA: // Mokra the Skullcrusher + events.RescheduleEvent(EVENT_WARRIOR_SPELL_MORTAL_STRIKE, urand(8000,12000)); + events.RescheduleEvent(EVENT_WARRIOR_SPELL_BLADESTORM, urand(15000,20000)); + events.RescheduleEvent(EVENT_WARRIOR_SPELL_INTERCEPT, 7000); + //events.RescheduleEvent(EVENT_WARRIOR_SPELL_ROLLING_THROW, x); + break; + default: + break; + } + } - void AddCreatureAddonAuras() - { - CreatureAddon const *cainfo = me->GetCreatureAddon(); - if (!cainfo) - return; + void AddCreatureAddonAuras() + { + CreatureAddon const *cainfo = me->GetCreatureAddon(); + if (!cainfo) + return; - if (!cainfo->auras.empty()) - { - for (std::vector::const_iterator itr = cainfo->auras.begin(); itr != cainfo->auras.end(); ++itr) - { - SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr); - if (!AdditionalSpellInfo) - continue; + if (!cainfo->auras.empty()) + { + for (std::vector::const_iterator itr = cainfo->auras.begin(); itr != cainfo->auras.end(); ++itr) + { + SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr); + if (!AdditionalSpellInfo) + continue; - if (me->HasAura(AdditionalSpellInfo->Id)) - continue; + if (me->HasAura(AdditionalSpellInfo->Id)) + continue; - me->AddAura(AdditionalSpellInfo->Id, me); - } - } - } + me->AddAura(AdditionalSpellInfo->Id, me); + } + } + } - void DoAction(int32 param) - { - if( param == 1 ) - { - MountPhase = false; - NewMountGUID = 0; - me->SetHealth(me->GetMaxHealth()); - me->SetRegeneratingHealth(true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - me->SetSpeed(MOVE_RUN, 1.0f, false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->RemoveAllAuras(); - AddCreatureAddonAuras(); - events.Reset(); - } - else if( param == 2 ) - ScheduleAbilitiesEvents(); - } + void DoAction(int32 param) + { + if( param == 1 ) + { + MountPhase = false; + NewMountGUID = 0; + me->SetHealth(me->GetMaxHealth()); + me->SetRegeneratingHealth(true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + me->SetSpeed(MOVE_RUN, 1.0f, false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->RemoveAllAuras(); + AddCreatureAddonAuras(); + events.Reset(); + } + else if( param == 2 ) + ScheduleAbilitiesEvents(); + } - void SetData(uint32 uiType, uint32 uiData) - { - BossOrder = uiType; - if( uiData > 1 ) - return; - switch( BossOrder ) - { - case 0: - if (uiData == 0) // 1 == short version - { - AddWaypoint(0,747.36f,634.07f,411.572f); - AddWaypoint(1,780.43f,607.15f,411.82f); - } - AddWaypoint(2,785.99f,599.41f,411.92f); - AddWaypoint(3,778.44f,601.64f,411.79f); - break; - case 1: - if (uiData == 0) // 1 == short version - { - AddWaypoint(0,747.35f,634.07f,411.57f); - AddWaypoint(1,768.72f,581.01f,411.92f); - } - AddWaypoint(2,763.55f,590.52f,411.71f); - break; - case 2: - if (uiData == 0) // 1 == short version - { - AddWaypoint(0,747.35f,634.07f,411.57f); - AddWaypoint(1,784.02f,645.33f,412.39f); - } - AddWaypoint(2,775.67f,641.91f,411.91f); - break; - default: - return; - } + void SetData(uint32 uiType, uint32 uiData) + { + BossOrder = uiType; + if( uiData > 1 ) + return; + switch( BossOrder ) + { + case 0: + if (uiData == 0) // 1 == short version + { + AddWaypoint(0,747.36f,634.07f,411.572f); + AddWaypoint(1,780.43f,607.15f,411.82f); + } + AddWaypoint(2,785.99f,599.41f,411.92f); + AddWaypoint(3,778.44f,601.64f,411.79f); + break; + case 1: + if (uiData == 0) // 1 == short version + { + AddWaypoint(0,747.35f,634.07f,411.57f); + AddWaypoint(1,768.72f,581.01f,411.92f); + } + AddWaypoint(2,763.55f,590.52f,411.71f); + break; + case 2: + if (uiData == 0) // 1 == short version + { + AddWaypoint(0,747.35f,634.07f,411.57f); + AddWaypoint(1,784.02f,645.33f,412.39f); + } + AddWaypoint(2,775.67f,641.91f,411.91f); + break; + default: + return; + } - Start(false, true, 0, NULL); - } + Start(false, true, 0, NULL); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if( MountPhase ) - { - if( me->GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID) == 0 ) - damage = 0; - else if( damage >= me->GetHealth() ) - { - events.Reset(); - damage = me->GetHealth()-1; - me->SetReactState(REACT_PASSIVE); - me->RemoveAllAuras(); - AddCreatureAddonAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->GetMotionMaster()->Clear(); - me->StopMoving(); - me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); - me->SetRegeneratingHealth(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - if( pInstance ) - { - pInstance->SetData(DATA_MOUNT_DIED, BossOrder); - if( Creature* mount = me->FindNearestCreature( pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? VEHICLE_ARGENT_WARHORSE : VEHICLE_ARGENT_BATTLEWORG, 100.0f, true ) ) - { - NewMountGUID = mount->GetGUID(); - me->GetMotionMaster()->MovePoint(7, *mount); - events.RescheduleEvent(EVENT_FIND_NEW_MOUNT, 1000); - } - } - } - } - else - { - if( damage >= me->GetHealth() ) - { - events.Reset(); - damage = me->GetHealth()-1; - me->SetReactState(REACT_PASSIVE); - me->RemoveAllAuras(); - AddCreatureAddonAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->GetMotionMaster()->Clear(); - me->SetRegeneratingHealth(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( pInstance ) - pInstance->SetData(DATA_GRAND_CHAMPION_DIED, BossOrder); - } - } - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if( MountPhase ) + { + if( me->GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID) == 0 ) + damage = 0; + else if( damage >= me->GetHealth() ) + { + events.Reset(); + damage = me->GetHealth()-1; + me->SetReactState(REACT_PASSIVE); + me->RemoveAllAuras(); + AddCreatureAddonAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->GetMotionMaster()->Clear(); + me->StopMoving(); + me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0); + me->SetRegeneratingHealth(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + if( pInstance ) + { + pInstance->SetData(DATA_MOUNT_DIED, BossOrder); + if( Creature* mount = me->FindNearestCreature( pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? VEHICLE_ARGENT_WARHORSE : VEHICLE_ARGENT_BATTLEWORG, 100.0f, true ) ) + { + NewMountGUID = mount->GetGUID(); + me->GetMotionMaster()->MovePoint(7, *mount); + events.RescheduleEvent(EVENT_FIND_NEW_MOUNT, 1000); + } + } + } + } + else + { + if( damage >= me->GetHealth() ) + { + events.Reset(); + damage = me->GetHealth()-1; + me->SetReactState(REACT_PASSIVE); + me->RemoveAllAuras(); + AddCreatureAddonAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->GetMotionMaster()->Clear(); + me->SetRegeneratingHealth(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( pInstance ) + pInstance->SetData(DATA_GRAND_CHAMPION_DIED, BossOrder); + } + } + } - void EnterEvadeMode() {} + void EnterEvadeMode() {} - void WaypointReached(uint32 i) - { - if( !pInstance ) - return; + void WaypointReached(uint32 i) + { + if( !pInstance ) + return; - if( (i==2 && (BossOrder==1 || BossOrder==2)) || (i==3 && BossOrder==0) ) - pInstance->SetData(DATA_GRAND_CHAMPION_REACHED_DEST, BossOrder); - } + if( (i==2 && (BossOrder==1 || BossOrder==2)) || (i==3 && BossOrder==0) ) + pInstance->SetData(DATA_GRAND_CHAMPION_REACHED_DEST, BossOrder); + } - void MovementInform(uint32 type, uint32 id) - { - if( id < 4 ) - npc_escortAI::MovementInform(type, id); + void MovementInform(uint32 type, uint32 id) + { + if( id < 4 ) + npc_escortAI::MovementInform(type, id); - if( type == POINT_MOTION_TYPE ) - { - if( id == 5 ) - me->SetFacingTo(3*M_PI/2); - else if( id == 7 ) // reached new mount! - { - if( NewMountGUID ) - if( Creature* mount = ObjectAccessor::GetCreature(*me, NewMountGUID) ) - { - mount->DespawnOrUnsummon(); - me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, mount->GetDisplayId()); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetHealth(50000); - me->CastSpell(me, SPELL_BOSS_DEFEND_PERIODIC, true); - me->SetRegeneratingHealth(true); - events.Reset(); - events.ScheduleEvent(EVENT_MOUNT_CHARGE, urand(2500,4000)); - events.ScheduleEvent(EVENT_SHIELD_BREAKER, urand(5000,8000)); - events.ScheduleEvent(EVENT_THRUST, urand(3000,5000)); - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( Unit* target = me->SelectNearestTarget(200.0f) ) - AttackStart(target); - DoZoneInCombat(); - me->CastSpell(me, SPELL_TRAMPLE_AURA, true); - if( pInstance ) - pInstance->SetData(DATA_REACHED_NEW_MOUNT, 0); - NewMountGUID = 0; - } - } - else if( id == 9 ) - me->DespawnOrUnsummon(); - } - } + if( type == POINT_MOTION_TYPE ) + { + if( id == 5 ) + me->SetFacingTo(3*M_PI/2); + else if( id == 7 ) // reached new mount! + { + if( NewMountGUID ) + if( Creature* mount = ObjectAccessor::GetCreature(*me, NewMountGUID) ) + { + mount->DespawnOrUnsummon(); + me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, mount->GetDisplayId()); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetHealth(50000); + me->CastSpell(me, SPELL_BOSS_DEFEND_PERIODIC, true); + me->SetRegeneratingHealth(true); + events.Reset(); + events.ScheduleEvent(EVENT_MOUNT_CHARGE, urand(2500,4000)); + events.ScheduleEvent(EVENT_SHIELD_BREAKER, urand(5000,8000)); + events.ScheduleEvent(EVENT_THRUST, urand(3000,5000)); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( Unit* target = me->SelectNearestTarget(200.0f) ) + AttackStart(target); + DoZoneInCombat(); + me->CastSpell(me, SPELL_TRAMPLE_AURA, true); + if( pInstance ) + pInstance->SetData(DATA_REACHED_NEW_MOUNT, 0); + NewMountGUID = 0; + } + } + else if( id == 9 ) + me->DespawnOrUnsummon(); + } + } - void SpellHit(Unit* caster, const SpellInfo* spell) - { - switch( spell->Id ) - { - case SPELL_TRAMPLE_STUN: - { - char buffer[50]; - sprintf(buffer, "%s is trampled!", me->GetName().c_str()); - me->MonsterTextEmote(buffer, 0); - } - break; - } - } + void SpellHit(Unit* caster, const SpellInfo* spell) + { + switch( spell->Id ) + { + case SPELL_TRAMPLE_STUN: + { + char buffer[50]; + sprintf(buffer, "%s is trampled!", me->GetName().c_str()); + me->MonsterTextEmote(buffer, 0); + } + break; + } + } - void UpdateAI(uint32 diff) - { - npc_escortAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + npc_escortAI::UpdateAI(diff); - if ( !UpdateVictim() && !NewMountGUID ) - return; - - events.Update(diff); + if ( !UpdateVictim() && !NewMountGUID ) + return; + + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) || ((me->GetEntry()==NPC_JACOB || me->GetEntry()==NPC_MOKRA) && me->HasAura(SPELL_BLADESTORM)) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) || ((me->GetEntry()==NPC_JACOB || me->GetEntry()==NPC_MOKRA) && me->HasAura(SPELL_BLADESTORM)) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_FIND_NEW_MOUNT: - { - if( me->HasAura(SPELL_TRAMPLE_STUN) ) - { - events.RepeatEvent(200); - break; - } - - // hackfix, trample won't hit grand champions because of UNIT_FLAG_NON_ATTACKABLE - if( pInstance ) - { - bool trample = false; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - if( me->GetExactDist(plr) <= 5.0f ) - if( Vehicle* v = plr->GetVehicle() ) - if( Unit* c = v->GetBase() ) - if( c->GetTypeId() == TYPEID_UNIT && c->ToCreature()->GetEntry() == (pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? VEHICLE_ARGENT_BATTLEWORG : VEHICLE_ARGENT_WARHORSE) ) - { - me->GetMotionMaster()->MovementExpired();; - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->CastSpell(me, SPELL_TRAMPLE_STUN, false); - trample = true; - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_FIND_NEW_MOUNT: + { + if( me->HasAura(SPELL_TRAMPLE_STUN) ) + { + events.RepeatEvent(200); + break; + } + + // hackfix, trample won't hit grand champions because of UNIT_FLAG_NON_ATTACKABLE + if( pInstance ) + { + bool trample = false; + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + if( me->GetExactDist(plr) <= 5.0f ) + if( Vehicle* v = plr->GetVehicle() ) + if( Unit* c = v->GetBase() ) + if( c->GetTypeId() == TYPEID_UNIT && c->ToCreature()->GetEntry() == (pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? VEHICLE_ARGENT_BATTLEWORG : VEHICLE_ARGENT_WARHORSE) ) + { + me->GetMotionMaster()->MovementExpired();; + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->CastSpell(me, SPELL_TRAMPLE_STUN, false); + trample = true; + break; + } - if( trample ) - { - events.RepeatEvent(15100); - break; - } - } + if( trample ) + { + events.RepeatEvent(15100); + break; + } + } - if( Creature* mount = ObjectAccessor::GetCreature(*me, NewMountGUID) ) - if( mount->IsAlive() ) - { - if( me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE ) - me->GetMotionMaster()->MovePoint(7, *mount); - events.RepeatEvent(200); - break; - } + if( Creature* mount = ObjectAccessor::GetCreature(*me, NewMountGUID) ) + if( mount->IsAlive() ) + { + if( me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE ) + me->GetMotionMaster()->MovePoint(7, *mount); + events.RepeatEvent(200); + break; + } - if( Creature* mount = me->FindNearestCreature( pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? VEHICLE_ARGENT_WARHORSE : VEHICLE_ARGENT_BATTLEWORG, 100.0f, true ) ) - { - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - NewMountGUID = mount->GetGUID(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->GetMotionMaster()->MovePoint(7, *mount); - events.RepeatEvent(200); - break; - } + if( Creature* mount = me->FindNearestCreature( pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? VEHICLE_ARGENT_WARHORSE : VEHICLE_ARGENT_BATTLEWORG, 100.0f, true ) ) + { + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + NewMountGUID = mount->GetGUID(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->GetMotionMaster()->MovePoint(7, *mount); + events.RepeatEvent(200); + break; + } - events.PopEvent(); - } - break; - case EVENT_MOUNT_CHARGE: - { - std::vector LIST; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - { - if( me->GetExactDist(plr) < 8.0f || me->GetExactDist(plr) > 25.0f || plr->isDead() ) - continue; - if( !plr->GetVehicle() ) - LIST.push_back(plr->GetGUID()); - else if( Vehicle* v = plr->GetVehicle() ) - { - if( Unit* mount = v->GetBase() ) - LIST.push_back(mount->GetGUID()); - } - } - if( !LIST.empty() ) - { - uint8 rnd = LIST.size()>1 ? urand(0,LIST.size()-1) : 0; - if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) ) - { - me->getThreatManager().resetAllAggro(); - me->AddThreat(target, 10000.0f); - AttackStart(target); - me->CastSpell(target, SPELL_MINIONS_CHARGE, false); - } - } - events.RepeatEvent(urand(4500,6000)); - } - break; - case EVENT_SHIELD_BREAKER: - { - std::vector LIST; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - { - if( me->GetExactDist(plr) < 10.0f || me->GetExactDist(plr) > 30.0f ) - continue; - if( Vehicle* v = plr->GetVehicle() ) - if( Unit* mount = v->GetBase() ) - LIST.push_back(mount->GetGUID()); - } - if( !LIST.empty() ) - { - uint8 rnd = LIST.size()>1 ? urand(0,LIST.size()-1) : 0; - if( Unit* target = ObjectAccessor::GetCreature(*me, LIST.at(rnd)) ) - me->CastSpell(target, SPELL_NPC_SHIELD_BREAKER, false); - } - events.RepeatEvent(urand(6000,8000)); - } - break; - case EVENT_THRUST: - if( Unit* victim = me->GetVictim() ) - if( me->GetExactDist(victim) <= 6.0f ) - me->CastSpell(victim, SPELL_PLAYER_VEHICLE_THRUST, false); - events.RepeatEvent(urand(3000,5000)); - break; + events.PopEvent(); + } + break; + case EVENT_MOUNT_CHARGE: + { + std::vector LIST; + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + { + if( me->GetExactDist(plr) < 8.0f || me->GetExactDist(plr) > 25.0f || plr->isDead() ) + continue; + if( !plr->GetVehicle() ) + LIST.push_back(plr->GetGUID()); + else if( Vehicle* v = plr->GetVehicle() ) + { + if( Unit* mount = v->GetBase() ) + LIST.push_back(mount->GetGUID()); + } + } + if( !LIST.empty() ) + { + uint8 rnd = LIST.size()>1 ? urand(0,LIST.size()-1) : 0; + if( Unit* target = ObjectAccessor::GetUnit(*me, LIST.at(rnd)) ) + { + me->getThreatManager().resetAllAggro(); + me->AddThreat(target, 10000.0f); + AttackStart(target); + me->CastSpell(target, SPELL_MINIONS_CHARGE, false); + } + } + events.RepeatEvent(urand(4500,6000)); + } + break; + case EVENT_SHIELD_BREAKER: + { + std::vector LIST; + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + { + if( me->GetExactDist(plr) < 10.0f || me->GetExactDist(plr) > 30.0f ) + continue; + if( Vehicle* v = plr->GetVehicle() ) + if( Unit* mount = v->GetBase() ) + LIST.push_back(mount->GetGUID()); + } + if( !LIST.empty() ) + { + uint8 rnd = LIST.size()>1 ? urand(0,LIST.size()-1) : 0; + if( Unit* target = ObjectAccessor::GetCreature(*me, LIST.at(rnd)) ) + me->CastSpell(target, SPELL_NPC_SHIELD_BREAKER, false); + } + events.RepeatEvent(urand(6000,8000)); + } + break; + case EVENT_THRUST: + if( Unit* victim = me->GetVictim() ) + if( me->GetExactDist(victim) <= 6.0f ) + me->CastSpell(victim, SPELL_PLAYER_VEHICLE_THRUST, false); + events.RepeatEvent(urand(3000,5000)); + break; - /******************* MAGE *******************/ - case EVEMT_MAGE_SPELL_FIREBALL: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_FIREBALL, false); - events.RepeatEvent(5000); - break; - case EVEMT_MAGE_SPELL_BLAST_WAVE: - me->CastSpell((Unit*)NULL, SPELL_BLAST_WAVE, false); - events.RepeatEvent(13000); - break; - case EVEMT_MAGE_SPELL_HASTE: - me->CastSpell(me, SPELL_HASTE, false); - events.RepeatEvent(22000); - break; - case EVEMT_MAGE_SPELL_POLYMORPH: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) - me->CastSpell(target, SPELL_POLYMORPH, false); - events.RepeatEvent(8000); - break; - /***************** MAGE END *****************/ + /******************* MAGE *******************/ + case EVEMT_MAGE_SPELL_FIREBALL: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_FIREBALL, false); + events.RepeatEvent(5000); + break; + case EVEMT_MAGE_SPELL_BLAST_WAVE: + me->CastSpell((Unit*)NULL, SPELL_BLAST_WAVE, false); + events.RepeatEvent(13000); + break; + case EVEMT_MAGE_SPELL_HASTE: + me->CastSpell(me, SPELL_HASTE, false); + events.RepeatEvent(22000); + break; + case EVEMT_MAGE_SPELL_POLYMORPH: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) + me->CastSpell(target, SPELL_POLYMORPH, false); + events.RepeatEvent(8000); + break; + /***************** MAGE END *****************/ - /****************** SHAMAN ******************/ - case EVENT_SHAMAN_SPELL_CHAIN_LIGHTNING: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) - me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false); - events.RepeatEvent(16000); - break; - case EVENT_SHAMAN_SPELL_EARTH_SHIELD: - me->CastSpell(me, SPELL_EARTH_SHIELD, false); - events.RepeatEvent(urand(30000,35000)); - break; - case EVENT_SHAMAN_SPELL_HEALING_WAVE: - { - Unit* target = NULL; - if( urand(0,1) ) - { - target = DoSelectLowestHpFriendly(40.0f); - if( !target ) - target = me; - } - else - target = me; - me->CastSpell(target, SPELL_HEALING_WAVE, false); - events.RepeatEvent(22000); - } - break; - case EVENT_SHAMAN_SPELL_HEX_OF_MENDING: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_HEX_OF_MENDING, false); - events.RepeatEvent(urand(20000,25000)); - break; - /**************** SHAMAN END ****************/ + /****************** SHAMAN ******************/ + case EVENT_SHAMAN_SPELL_CHAIN_LIGHTNING: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) + me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false); + events.RepeatEvent(16000); + break; + case EVENT_SHAMAN_SPELL_EARTH_SHIELD: + me->CastSpell(me, SPELL_EARTH_SHIELD, false); + events.RepeatEvent(urand(30000,35000)); + break; + case EVENT_SHAMAN_SPELL_HEALING_WAVE: + { + Unit* target = NULL; + if( urand(0,1) ) + { + target = DoSelectLowestHpFriendly(40.0f); + if( !target ) + target = me; + } + else + target = me; + me->CastSpell(target, SPELL_HEALING_WAVE, false); + events.RepeatEvent(22000); + } + break; + case EVENT_SHAMAN_SPELL_HEX_OF_MENDING: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_HEX_OF_MENDING, false); + events.RepeatEvent(urand(20000,25000)); + break; + /**************** SHAMAN END ****************/ - /****************** HUNTER ******************/ - case EVENT_HUNTER_SPELL_DISENGAGE: - events.PopEvent(); - break; - case EVENT_HUNTER_SPELL_LIGHTNING_ARROWS: - me->CastSpell((Unit*)NULL, SPELL_LIGHTNING_ARROWS, false); - events.RepeatEvent(urand(20000,25000)); - break; - case EVENT_HUNTER_SPELL_MULTI_SHOT: - { - if( !UnitTargetGUID ) - { - if( Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 30.0f, true) ) - { - me->CastSpell(target, SPELL_SHOOT, false); - UnitTargetGUID = target->GetGUID(); - } - events.RepeatEvent(2000); - break; - } - else - { - Unit* target = ObjectAccessor::GetUnit(*me, UnitTargetGUID); - if( target && me->IsInRange(target, 5.0f, 30.0f, false) ) - me->CastSpell(target, SPELL_MULTI_SHOT, false); - else - { - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - { - Player* player = itr->GetSource(); - if( player && me->IsInRange(player, 5.0f, 30.0f, false) ) - { - me->CastSpell(player, SPELL_MULTI_SHOT, false); - break; - } - } - } - UnitTargetGUID = 0; - } - events.RepeatEvent(urand(15000,20000)); - } - break; - /**************** HUNTER END ****************/ + /****************** HUNTER ******************/ + case EVENT_HUNTER_SPELL_DISENGAGE: + events.PopEvent(); + break; + case EVENT_HUNTER_SPELL_LIGHTNING_ARROWS: + me->CastSpell((Unit*)NULL, SPELL_LIGHTNING_ARROWS, false); + events.RepeatEvent(urand(20000,25000)); + break; + case EVENT_HUNTER_SPELL_MULTI_SHOT: + { + if( !UnitTargetGUID ) + { + if( Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 30.0f, true) ) + { + me->CastSpell(target, SPELL_SHOOT, false); + UnitTargetGUID = target->GetGUID(); + } + events.RepeatEvent(2000); + break; + } + else + { + Unit* target = ObjectAccessor::GetUnit(*me, UnitTargetGUID); + if( target && me->IsInRange(target, 5.0f, 30.0f, false) ) + me->CastSpell(target, SPELL_MULTI_SHOT, false); + else + { + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + { + Player* player = itr->GetSource(); + if( player && me->IsInRange(player, 5.0f, 30.0f, false) ) + { + me->CastSpell(player, SPELL_MULTI_SHOT, false); + break; + } + } + } + UnitTargetGUID = 0; + } + events.RepeatEvent(urand(15000,20000)); + } + break; + /**************** HUNTER END ****************/ - /****************** ROGUE *******************/ - case EVENT_ROGUE_SPELL_EVISCERATE: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_EVISCERATE, false); - events.RepeatEvent(8000); - break; - case EVENT_ROGUE_SPELL_FAN_OF_KNIVES: - me->CastSpell((Unit*)NULL, SPELL_FAN_OF_KNIVES, false); - events.RepeatEvent(14000); - break; - case EVENT_ROGUE_SPELL_POISON_BOTTLE: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) - me->CastSpell(target, SPELL_POISON_BOTTLE, false); - events.RepeatEvent(19000); - break; - /**************** ROGUE END *****************/ + /****************** ROGUE *******************/ + case EVENT_ROGUE_SPELL_EVISCERATE: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_EVISCERATE, false); + events.RepeatEvent(8000); + break; + case EVENT_ROGUE_SPELL_FAN_OF_KNIVES: + me->CastSpell((Unit*)NULL, SPELL_FAN_OF_KNIVES, false); + events.RepeatEvent(14000); + break; + case EVENT_ROGUE_SPELL_POISON_BOTTLE: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) + me->CastSpell(target, SPELL_POISON_BOTTLE, false); + events.RepeatEvent(19000); + break; + /**************** ROGUE END *****************/ - /***************** WARRIOR ******************/ - case EVENT_WARRIOR_SPELL_MORTAL_STRIKE: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); - events.RepeatEvent(urand(8000,12000)); - break; - case EVENT_WARRIOR_SPELL_BLADESTORM: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_BLADESTORM, false); - events.RepeatEvent(urand(15000,20000)); - break; - case EVENT_WARRIOR_SPELL_INTERCEPT: - { - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - { - Player* player = itr->GetSource(); - if( player && me->IsInRange(player, 8.0f, 25.0f, false) ) - { - DoResetThreat(); - me->AddThreat(player,5.0f); - me->CastSpell(player, SPELL_INTERCEPT, false); - break; - } - } - events.RepeatEvent(7000); - } - break; - case EVENT_WARRIOR_SPELL_ROLLING_THROW: - events.PopEvent(); - break; - /*************** WARRIOR END ****************/ - } + /***************** WARRIOR ******************/ + case EVENT_WARRIOR_SPELL_MORTAL_STRIKE: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); + events.RepeatEvent(urand(8000,12000)); + break; + case EVENT_WARRIOR_SPELL_BLADESTORM: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_BLADESTORM, false); + events.RepeatEvent(urand(15000,20000)); + break; + case EVENT_WARRIOR_SPELL_INTERCEPT: + { + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + { + Player* player = itr->GetSource(); + if( player && me->IsInRange(player, 8.0f, 25.0f, false) ) + { + DoResetThreat(); + me->AddThreat(player,5.0f); + me->CastSpell(player, SPELL_INTERCEPT, false); + break; + } + } + events.RepeatEvent(7000); + } + break; + case EVENT_WARRIOR_SPELL_ROLLING_THROW: + events.PopEvent(); + break; + /*************** WARRIOR END ****************/ + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_grand_championAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_grand_championAI(pCreature); + } }; void AddSC_boss_grand_champions() { - new boss_grand_champion(); - new npc_toc5_grand_champion_minion(); - new npc_toc5_player_vehicle(); + new boss_grand_champion(); + new npc_toc5_grand_champion_minion(); + new npc_toc5_player_vehicle(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp index f2ef966d6..ee82e1458 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp @@ -9,1282 +9,1282 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! #include "Player.h" const Position SpawnPosition = {746.67f, 684.08f, 412.5f, 4.65f}; -#define CLEANUP_CHECK_INTERVAL 5000 +#define CLEANUP_CHECK_INTERVAL 5000 class instance_trial_of_the_champion : public InstanceMapScript { public: - instance_trial_of_the_champion() : InstanceMapScript("instance_trial_of_the_champion", 650) { } + instance_trial_of_the_champion() : InstanceMapScript("instance_trial_of_the_champion", 650) { } - InstanceScript* GetInstanceScript(InstanceMap* pMap) const - { - return new instance_trial_of_the_champion_InstanceMapScript(pMap); - } + InstanceScript* GetInstanceScript(InstanceMap* pMap) const + { + return new instance_trial_of_the_champion_InstanceMapScript(pMap); + } - struct instance_trial_of_the_champion_InstanceMapScript : public InstanceScript - { - instance_trial_of_the_champion_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } + struct instance_trial_of_the_champion_InstanceMapScript : public InstanceScript + { + instance_trial_of_the_champion_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } - bool CLEANED; - TeamId TeamIdInInstance; - uint32 InstanceProgress; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; + bool CLEANED; + TeamId TeamIdInInstance; + uint32 InstanceProgress; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; - std::list VehicleList; - EventMap events; - uint8 Counter; - uint8 temp1, temp2; - bool shortver; - bool bAchievIveHadWorse; + std::list VehicleList; + EventMap events; + uint8 Counter; + uint8 temp1, temp2; + bool shortver; + bool bAchievIveHadWorse; - uint64 NPC_AnnouncerGUID; - uint64 NPC_TirionGUID; - uint64 NPC_GrandChampionGUID[3]; - uint64 NPC_GrandChampionMinionsGUID[3][3]; - uint64 NPC_ArgentChampionGUID; - uint64 NPC_ArgentSoldierGUID[3][3]; - uint64 NPC_MemoryEntry; - uint64 NPC_BlackKnightVehicleGUID; - uint64 NPC_BlackKnightGUID; - uint64 GO_MainGateGUID; + uint64 NPC_AnnouncerGUID; + uint64 NPC_TirionGUID; + uint64 NPC_GrandChampionGUID[3]; + uint64 NPC_GrandChampionMinionsGUID[3][3]; + uint64 NPC_ArgentChampionGUID; + uint64 NPC_ArgentSoldierGUID[3][3]; + uint64 NPC_MemoryEntry; + uint64 NPC_BlackKnightVehicleGUID; + uint64 NPC_BlackKnightGUID; + uint64 GO_MainGateGUID; - void Initialize() - { - TeamIdInInstance = TEAM_NEUTRAL; - InstanceProgress = 0; - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + void Initialize() + { + TeamIdInInstance = TEAM_NEUTRAL; + InstanceProgress = 0; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - VehicleList.clear(); - CLEANED = false; - events.Reset(); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); - Counter = 0; - temp1 = 0; - temp2 = 0; - shortver = false; - bAchievIveHadWorse = true; + VehicleList.clear(); + CLEANED = false; + events.Reset(); + events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); + Counter = 0; + temp1 = 0; + temp2 = 0; + shortver = false; + bAchievIveHadWorse = true; - NPC_AnnouncerGUID = 0; - NPC_TirionGUID = 0; - memset(&NPC_GrandChampionGUID, 0, sizeof(NPC_GrandChampionGUID)); - memset(&NPC_GrandChampionMinionsGUID, 0, sizeof(NPC_GrandChampionMinionsGUID)); - memset(&NPC_ArgentSoldierGUID, 0, sizeof(NPC_ArgentSoldierGUID)); - NPC_ArgentChampionGUID = 0; - NPC_MemoryEntry = 0; - NPC_BlackKnightVehicleGUID = 0; - NPC_BlackKnightGUID = 0; - GO_MainGateGUID = 0; - } + NPC_AnnouncerGUID = 0; + NPC_TirionGUID = 0; + memset(&NPC_GrandChampionGUID, 0, sizeof(NPC_GrandChampionGUID)); + memset(&NPC_GrandChampionMinionsGUID, 0, sizeof(NPC_GrandChampionMinionsGUID)); + memset(&NPC_ArgentSoldierGUID, 0, sizeof(NPC_ArgentSoldierGUID)); + NPC_ArgentChampionGUID = 0; + NPC_MemoryEntry = 0; + NPC_BlackKnightVehicleGUID = 0; + NPC_BlackKnightGUID = 0; + GO_MainGateGUID = 0; + } - bool IsEncounterInProgress() const - { - for( uint8 i = 0; i < MAX_ENCOUNTER; ++i ) - if( m_auiEncounter[i] == IN_PROGRESS ) - return true; + bool IsEncounterInProgress() const + { + for( uint8 i = 0; i < MAX_ENCOUNTER; ++i ) + if( m_auiEncounter[i] == IN_PROGRESS ) + return true; - return false; - } + return false; + } - void OnCreatureCreate(Creature* creature) - { - if (TeamIdInInstance == TEAM_NEUTRAL) - { - Map::PlayerList const &players = instance->GetPlayers(); - if( !players.isEmpty() ) - if( Player* pPlayer = players.begin()->GetSource() ) - TeamIdInInstance = pPlayer->GetTeamId(); - } + void OnCreatureCreate(Creature* creature) + { + if (TeamIdInInstance == TEAM_NEUTRAL) + { + Map::PlayerList const &players = instance->GetPlayers(); + if( !players.isEmpty() ) + if( Player* pPlayer = players.begin()->GetSource() ) + TeamIdInInstance = pPlayer->GetTeamId(); + } - switch( creature->GetEntry() ) - { - // Grand Champions: - case NPC_MOKRA: - if( TeamIdInInstance == TEAM_HORDE ) - creature->UpdateEntry(NPC_JACOB); - break; - case NPC_ERESSEA: - if( TeamIdInInstance == TEAM_HORDE ) - creature->UpdateEntry(NPC_AMBROSE); - break; - case NPC_RUNOK: - if( TeamIdInInstance == TEAM_HORDE ) - creature->UpdateEntry(NPC_COLOSOS); - break; - case NPC_ZULTORE: - if( TeamIdInInstance == TEAM_HORDE ) - creature->UpdateEntry(NPC_JAELYNE); - break; - case NPC_VISCERI: - if( TeamIdInInstance == TEAM_HORDE ) - creature->UpdateEntry(NPC_LANA); - break; + switch( creature->GetEntry() ) + { + // Grand Champions: + case NPC_MOKRA: + if( TeamIdInInstance == TEAM_HORDE ) + creature->UpdateEntry(NPC_JACOB); + break; + case NPC_ERESSEA: + if( TeamIdInInstance == TEAM_HORDE ) + creature->UpdateEntry(NPC_AMBROSE); + break; + case NPC_RUNOK: + if( TeamIdInInstance == TEAM_HORDE ) + creature->UpdateEntry(NPC_COLOSOS); + break; + case NPC_ZULTORE: + if( TeamIdInInstance == TEAM_HORDE ) + creature->UpdateEntry(NPC_JAELYNE); + break; + case NPC_VISCERI: + if( TeamIdInInstance == TEAM_HORDE ) + creature->UpdateEntry(NPC_LANA); + break; - // Grand Champion Minions: - case NPC_ORGRIMMAR_MINION: - if( TeamIdInInstance == TEAM_HORDE ) - creature->UpdateEntry(NPC_STORMWIND_MINION); - break; - case NPC_SILVERMOON_MINION: - if( TeamIdInInstance == TEAM_HORDE ) - creature->UpdateEntry(NPC_GNOMEREGAN_MINION); - break; - case NPC_THUNDER_BLUFF_MINION: - if( TeamIdInInstance == TEAM_HORDE ) - creature->UpdateEntry(NPC_EXODAR_MINION); - break; - case NPC_SENJIN_MINION: - if( TeamIdInInstance == TEAM_HORDE ) - creature->UpdateEntry(NPC_DARNASSUS_MINION); - break; - case NPC_UNDERCITY_MINION: - if( TeamIdInInstance == TEAM_HORDE ) - creature->UpdateEntry(NPC_IRONFORGE_MINION); - break; + // Grand Champion Minions: + case NPC_ORGRIMMAR_MINION: + if( TeamIdInInstance == TEAM_HORDE ) + creature->UpdateEntry(NPC_STORMWIND_MINION); + break; + case NPC_SILVERMOON_MINION: + if( TeamIdInInstance == TEAM_HORDE ) + creature->UpdateEntry(NPC_GNOMEREGAN_MINION); + break; + case NPC_THUNDER_BLUFF_MINION: + if( TeamIdInInstance == TEAM_HORDE ) + creature->UpdateEntry(NPC_EXODAR_MINION); + break; + case NPC_SENJIN_MINION: + if( TeamIdInInstance == TEAM_HORDE ) + creature->UpdateEntry(NPC_DARNASSUS_MINION); + break; + case NPC_UNDERCITY_MINION: + if( TeamIdInInstance == TEAM_HORDE ) + creature->UpdateEntry(NPC_IRONFORGE_MINION); + break; - // Argent Champion: - case NPC_EADRIC: - case NPC_PALETRESS: - NPC_ArgentChampionGUID = creature->GetGUID(); - break; + // Argent Champion: + case NPC_EADRIC: + case NPC_PALETRESS: + NPC_ArgentChampionGUID = creature->GetGUID(); + break; - // Coliseum Announcer: - case NPC_JAEREN: - NPC_AnnouncerGUID = creature->GetGUID(); - //if( TeamIdInInstance == TEAM_ALLIANCE ) - // creature->UpdateEntry(NPC_ARELAS); - creature->SetReactState(REACT_PASSIVE); - break; + // Coliseum Announcer: + case NPC_JAEREN: + NPC_AnnouncerGUID = creature->GetGUID(); + //if( TeamIdInInstance == TEAM_ALLIANCE ) + // creature->UpdateEntry(NPC_ARELAS); + creature->SetReactState(REACT_PASSIVE); + break; - // Highlord Tirion Fordring - case NPC_TIRION: - NPC_TirionGUID = creature->GetGUID(); - break; + // Highlord Tirion Fordring + case NPC_TIRION: + NPC_TirionGUID = creature->GetGUID(); + break; - // Beginning vehicles: - case VEHICLE_ARGENT_WARHORSE: - case VEHICLE_ARGENT_BATTLEWORG: - if( InstanceProgress < INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED && m_auiEncounter[0] == NOT_STARTED ) - { - creature->DespawnOrUnsummon(); - creature->SetRespawnTime(3); - VehicleList.push_back(creature->GetGUID()); - } - else - creature->DespawnOrUnsummon(); - break; - } - if (creature->GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID)) - if (const CreatureAddon* ca = creature->GetCreatureAddon()) - if (ca->mount != creature->GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID)) - creature->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, ca->mount); - } + // Beginning vehicles: + case VEHICLE_ARGENT_WARHORSE: + case VEHICLE_ARGENT_BATTLEWORG: + if( InstanceProgress < INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED && m_auiEncounter[0] == NOT_STARTED ) + { + creature->DespawnOrUnsummon(); + creature->SetRespawnTime(3); + VehicleList.push_back(creature->GetGUID()); + } + else + creature->DespawnOrUnsummon(); + break; + } + if (creature->GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID)) + if (const CreatureAddon* ca = creature->GetCreatureAddon()) + if (ca->mount != creature->GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID)) + creature->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, ca->mount); + } - void OnGameObjectCreate(GameObject* go) - { - switch( go->GetEntry() ) - { - case GO_MAIN_GATE: - GO_MainGateGUID = go->GetGUID(); - HandleGameObject(GO_MainGateGUID, false, go); - break; - case GO_SOUTH_PORTCULLIS: - case GO_EAST_PORTCULLIS: - HandleGameObject(go->GetGUID(), false, go); - break; - } - } + void OnGameObjectCreate(GameObject* go) + { + switch( go->GetEntry() ) + { + case GO_MAIN_GATE: + GO_MainGateGUID = go->GetGUID(); + HandleGameObject(GO_MainGateGUID, false, go); + break; + case GO_SOUTH_PORTCULLIS: + case GO_EAST_PORTCULLIS: + HandleGameObject(go->GetGUID(), false, go); + break; + } + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "T C " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << InstanceProgress; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + std::ostringstream saveStream; + saveStream << "T C " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << InstanceProgress; + str_data = saveStream.str(); + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - CLEANED = false; - events.Reset(); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); + void Load(const char* in) + { + CLEANED = false; + events.Reset(); + events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); - if( !in ) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if( !in ) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - if( dataHead1 == 'T' && dataHead2 == 'C' ) - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - InstanceProgress = data3; - if( InstanceProgress == INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED ) - InstanceProgress = INSTANCE_PROGRESS_INITIAL; + if( dataHead1 == 'T' && dataHead2 == 'C' ) + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + InstanceProgress = data3; + if( InstanceProgress == INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED ) + InstanceProgress = INSTANCE_PROGRESS_INITIAL; - for( uint8 i = 0; i < MAX_ENCOUNTER; ++i ) - if( m_auiEncounter[i] == IN_PROGRESS ) - m_auiEncounter[i] = NOT_STARTED; + for( uint8 i = 0; i < MAX_ENCOUNTER; ++i ) + if( m_auiEncounter[i] == IN_PROGRESS ) + m_auiEncounter[i] = NOT_STARTED; - } - else - OUT_LOAD_INST_DATA_FAIL; + } + else + OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } - // EVENT STUFF BELOW: + // EVENT STUFF BELOW: - void OnPlayerEnter(Player *) - { - if( DoNeedCleanup(true) ) - InstanceCleanup(); + void OnPlayerEnter(Player *) + { + if( DoNeedCleanup(true) ) + InstanceCleanup(); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); - } + events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); + } - bool DoNeedCleanup(bool /*enter*/) - { - uint8 aliveCount = 0; - Map::PlayerList const &pl = instance->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - if( plr->IsAlive() && !plr->IsGameMaster() ) - ++aliveCount; + bool DoNeedCleanup(bool /*enter*/) + { + uint8 aliveCount = 0; + Map::PlayerList const &pl = instance->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + if( plr->IsAlive() && !plr->IsGameMaster() ) + ++aliveCount; - bool need = aliveCount==0; - if( !need && CLEANED ) - CLEANED = false; - return need; - } + bool need = aliveCount==0; + if( !need && CLEANED ) + CLEANED = false; + return need; + } - void InstanceCleanup() - { - if( CLEANED ) - return; + void InstanceCleanup() + { + if( CLEANED ) + return; - switch( InstanceProgress ) - { - case INSTANCE_PROGRESS_INITIAL: - case INSTANCE_PROGRESS_GRAND_CHAMPIONS_REACHED_DEST: - case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_1: - case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_2: - case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_3: - // revert to INSTANCE_PROGRESS_INITIAL - { - for( std::list::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr ) - if( Creature* veh = instance->GetCreature(*itr) ) - { - veh->DespawnOrUnsummon(); - veh->SetRespawnTime(3); - } - for( uint8 i=0; i<3; ++i ) - { - for( uint8 j=0; j<3; ++j ) - { - if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[i][j]) ) - c->DespawnOrUnsummon(); - NPC_GrandChampionMinionsGUID[i][j] = 0; - } - if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) - c->DespawnOrUnsummon(); - NPC_GrandChampionGUID[i] = 0; - } - if( Creature* c = instance->GetCreature(NPC_AnnouncerGUID) ) - { - c->DespawnOrUnsummon(); - c->SetHomePosition(748.309f, 619.488f, 411.172f, 4.71239f); - c->SetPosition(748.309f, 619.488f, 411.172f, 4.71239f); - c->SetRespawnTime(3); - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - InstanceProgress = INSTANCE_PROGRESS_INITIAL; - } - break; - case INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED: - { - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - { - announcer->DespawnOrUnsummon(); - announcer->SetHomePosition(735.81f, 661.92f, 412.39f, 4.714f); - announcer->SetPosition(735.81f, 661.92f, 412.39f, 4.714f); - announcer->SetRespawnTime(3); - announcer->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + switch( InstanceProgress ) + { + case INSTANCE_PROGRESS_INITIAL: + case INSTANCE_PROGRESS_GRAND_CHAMPIONS_REACHED_DEST: + case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_1: + case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_2: + case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_3: + // revert to INSTANCE_PROGRESS_INITIAL + { + for( std::list::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr ) + if( Creature* veh = instance->GetCreature(*itr) ) + { + veh->DespawnOrUnsummon(); + veh->SetRespawnTime(3); + } + for( uint8 i=0; i<3; ++i ) + { + for( uint8 j=0; j<3; ++j ) + { + if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[i][j]) ) + c->DespawnOrUnsummon(); + NPC_GrandChampionMinionsGUID[i][j] = 0; + } + if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) + c->DespawnOrUnsummon(); + NPC_GrandChampionGUID[i] = 0; + } + if( Creature* c = instance->GetCreature(NPC_AnnouncerGUID) ) + { + c->DespawnOrUnsummon(); + c->SetHomePosition(748.309f, 619.488f, 411.172f, 4.71239f); + c->SetPosition(748.309f, 619.488f, 411.172f, 4.71239f); + c->SetRespawnTime(3); + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + InstanceProgress = INSTANCE_PROGRESS_INITIAL; + } + break; + case INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED: + { + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + { + announcer->DespawnOrUnsummon(); + announcer->SetHomePosition(735.81f, 661.92f, 412.39f, 4.714f); + announcer->SetPosition(735.81f, 661.92f, 412.39f, 4.714f); + announcer->SetRespawnTime(3); + announcer->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) - { - uint32 entry = c->GetEntry(); - c->DespawnOrUnsummon(); - switch( i ) - { - case 0: - if( Creature* pBoss = announcer->SummonCreature(entry, 736.695f, 650.02f, 412.4f, 3*M_PI/2) ) - { - NPC_GrandChampionGUID[0] = pBoss->GetGUID(); - pBoss->AI()->SetData(0, 2); - } - break; - case 1: - if( Creature* pBoss = announcer->SummonCreature(entry, 756.32f, 650.05f, 412.4f, 3*M_PI/2) ) - { - NPC_GrandChampionGUID[1] = pBoss->GetGUID(); - pBoss->AI()->SetData(1, 2); - } - break; - case 2: - if( Creature* pBoss = announcer->SummonCreature(entry, 746.5f, 650.65f, 411.7f, 3*M_PI/2) ) - { - NPC_GrandChampionGUID[2] = pBoss->GetGUID(); - pBoss->AI()->SetData(2, 2); - } - break; - } - } - } - } - break; - case INSTANCE_PROGRESS_CHAMPIONS_DEAD: - case INSTANCE_PROGRESS_ARGENT_SOLDIERS_DIED: - // revert to INSTANCE_PROGRESS_CHAMPIONS_DEAD - { - for( uint8 i=0; i<3; ++i ) - for( uint8 j=0; j<3; ++j ) - { - if( Creature* c = instance->GetCreature(NPC_ArgentSoldierGUID[i][j]) ) - c->DespawnOrUnsummon(); - NPC_ArgentSoldierGUID[i][j] = 0; - } - if( Creature* c = instance->GetCreature(NPC_ArgentChampionGUID) ) - { - c->AI()->DoAction(-1); // paletress despawn memory - c->DespawnOrUnsummon(); - } - NPC_ArgentChampionGUID = 0; - if( Creature* c = instance->GetCreature(NPC_AnnouncerGUID) ) - { - c->DespawnOrUnsummon(); - c->SetHomePosition(743.14f, 628.77f, 411.2f, 4.71239f); - c->SetPosition(743.14f, 628.77f, 411.2f, 4.71239f); - c->SetRespawnTime(3); - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - NPC_MemoryEntry = 0; - InstanceProgress = INSTANCE_PROGRESS_CHAMPIONS_DEAD; - } - break; - case INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED: - // revert to INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED - { - if( Creature* c = instance->GetCreature(NPC_BlackKnightVehicleGUID) ) - c->DespawnOrUnsummon(); - NPC_BlackKnightVehicleGUID = 0; - if( Creature* c = instance->GetCreature(NPC_BlackKnightGUID) ) - { - c->AI()->DoAction(-1); - c->DespawnOrUnsummon(); - } - NPC_BlackKnightGUID = 0; - if( Creature* c = instance->GetCreature(NPC_AnnouncerGUID) ) - { - c->DespawnOrUnsummon(); - c->SetHomePosition(743.14f, 628.77f, 411.2f, 4.71239f); - c->SetPosition(743.14f, 628.77f, 411.2f, 4.71239f); - c->SetRespawnTime(3); - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - InstanceProgress = INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED; - } - break; - case INSTANCE_PROGRESS_FINISHED: - if( Creature* c = instance->GetCreature(NPC_AnnouncerGUID) ) - c->DespawnOrUnsummon(); - break; - } + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) + { + uint32 entry = c->GetEntry(); + c->DespawnOrUnsummon(); + switch( i ) + { + case 0: + if( Creature* pBoss = announcer->SummonCreature(entry, 736.695f, 650.02f, 412.4f, 3*M_PI/2) ) + { + NPC_GrandChampionGUID[0] = pBoss->GetGUID(); + pBoss->AI()->SetData(0, 2); + } + break; + case 1: + if( Creature* pBoss = announcer->SummonCreature(entry, 756.32f, 650.05f, 412.4f, 3*M_PI/2) ) + { + NPC_GrandChampionGUID[1] = pBoss->GetGUID(); + pBoss->AI()->SetData(1, 2); + } + break; + case 2: + if( Creature* pBoss = announcer->SummonCreature(entry, 746.5f, 650.65f, 411.7f, 3*M_PI/2) ) + { + NPC_GrandChampionGUID[2] = pBoss->GetGUID(); + pBoss->AI()->SetData(2, 2); + } + break; + } + } + } + } + break; + case INSTANCE_PROGRESS_CHAMPIONS_DEAD: + case INSTANCE_PROGRESS_ARGENT_SOLDIERS_DIED: + // revert to INSTANCE_PROGRESS_CHAMPIONS_DEAD + { + for( uint8 i=0; i<3; ++i ) + for( uint8 j=0; j<3; ++j ) + { + if( Creature* c = instance->GetCreature(NPC_ArgentSoldierGUID[i][j]) ) + c->DespawnOrUnsummon(); + NPC_ArgentSoldierGUID[i][j] = 0; + } + if( Creature* c = instance->GetCreature(NPC_ArgentChampionGUID) ) + { + c->AI()->DoAction(-1); // paletress despawn memory + c->DespawnOrUnsummon(); + } + NPC_ArgentChampionGUID = 0; + if( Creature* c = instance->GetCreature(NPC_AnnouncerGUID) ) + { + c->DespawnOrUnsummon(); + c->SetHomePosition(743.14f, 628.77f, 411.2f, 4.71239f); + c->SetPosition(743.14f, 628.77f, 411.2f, 4.71239f); + c->SetRespawnTime(3); + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + NPC_MemoryEntry = 0; + InstanceProgress = INSTANCE_PROGRESS_CHAMPIONS_DEAD; + } + break; + case INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED: + // revert to INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED + { + if( Creature* c = instance->GetCreature(NPC_BlackKnightVehicleGUID) ) + c->DespawnOrUnsummon(); + NPC_BlackKnightVehicleGUID = 0; + if( Creature* c = instance->GetCreature(NPC_BlackKnightGUID) ) + { + c->AI()->DoAction(-1); + c->DespawnOrUnsummon(); + } + NPC_BlackKnightGUID = 0; + if( Creature* c = instance->GetCreature(NPC_AnnouncerGUID) ) + { + c->DespawnOrUnsummon(); + c->SetHomePosition(743.14f, 628.77f, 411.2f, 4.71239f); + c->SetPosition(743.14f, 628.77f, 411.2f, 4.71239f); + c->SetRespawnTime(3); + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + InstanceProgress = INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED; + } + break; + case INSTANCE_PROGRESS_FINISHED: + if( Creature* c = instance->GetCreature(NPC_AnnouncerGUID) ) + c->DespawnOrUnsummon(); + break; + } - HandleGameObject(GO_MainGateGUID, false); - Counter = 0; - SaveToDB(); - events.Reset(); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); + HandleGameObject(GO_MainGateGUID, false); + Counter = 0; + SaveToDB(); + events.Reset(); + events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); - CLEANED = true; - } + CLEANED = true; + } - uint32 GetData(uint32 uiData) const - { - switch( uiData ) - { - case DATA_INSTANCE_PROGRESS: - return InstanceProgress; - case DATA_TEAMID_IN_INSTANCE: - return TeamIdInInstance; - } + uint32 GetData(uint32 uiData) const + { + switch( uiData ) + { + case DATA_INSTANCE_PROGRESS: + return InstanceProgress; + case DATA_TEAMID_IN_INSTANCE: + return TeamIdInInstance; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 uiData) const - { - switch( uiData ) - { - case DATA_ANNOUNCER: - return NPC_AnnouncerGUID; - case DATA_PALETRESS: - return NPC_ArgentChampionGUID; - } + uint64 GetData64(uint32 uiData) const + { + switch( uiData ) + { + case DATA_ANNOUNCER: + return NPC_AnnouncerGUID; + case DATA_PALETRESS: + return NPC_ArgentChampionGUID; + } - return 0; - } + return 0; + } - void SetData(uint32 uiType, uint32 uiData) - { - switch( uiType ) - { - case DATA_ANNOUNCER_GOSSIP_SELECT: - switch( InstanceProgress ) - { - case INSTANCE_PROGRESS_INITIAL: - if (uiData == 0) // normal intro - { - shortver = false; + void SetData(uint32 uiType, uint32 uiData) + { + switch( uiType ) + { + case DATA_ANNOUNCER_GOSSIP_SELECT: + switch( InstanceProgress ) + { + case INSTANCE_PROGRESS_INITIAL: + if (uiData == 0) // normal intro + { + shortver = false; - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - { - if( GameObject* gate = instance->GetGameObject(GO_MainGateGUID) ) - announcer->SetFacingToObject(gate); - if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) - tirion->AI()->Talk(TEXT_WELCOME); - } - events.RescheduleEvent(EVENT_YELL_WELCOME_2, 8000); - } - else // short version - { - shortver = true; + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + { + if( GameObject* gate = instance->GetGameObject(GO_MainGateGUID) ) + announcer->SetFacingToObject(gate); + if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) + tirion->AI()->Talk(TEXT_WELCOME); + } + events.RescheduleEvent(EVENT_YELL_WELCOME_2, 8000); + } + else // short version + { + shortver = true; - temp1 = urand(0,4); - DoSummonGrandChampion(temp1, 0); - do { temp2 = urand(0,4); } while( temp1 == temp2 ); - DoSummonGrandChampion(temp2, 1); - uint8 number = 0; - do { number = urand(0,4); } while( number == temp1 || number == temp2 ); - DoSummonGrandChampion(number, 2); + temp1 = urand(0,4); + DoSummonGrandChampion(temp1, 0); + do { temp2 = urand(0,4); } while( temp1 == temp2 ); + DoSummonGrandChampion(temp2, 1); + uint8 number = 0; + do { number = urand(0,4); } while( number == temp1 || number == temp2 ); + DoSummonGrandChampion(number, 2); - InstanceProgress = INSTANCE_PROGRESS_GRAND_CHAMPIONS_REACHED_DEST; - uiData = DONE; // save to db - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - { - announcer->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); - announcer->GetMotionMaster()->MovePoint(1, 735.81f, 661.92f, 412.39f); - } - events.ScheduleEvent(EVENT_GRAND_GROUP_1_MOVE_MIDDLE, 10000); - } - break; - case INSTANCE_PROGRESS_CHAMPIONS_DEAD: - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - { - Counter = urand(0,1); - if( Counter ) - announcer->AI()->Talk(TEXT_INTRODUCE_EADRIC); - else - announcer->AI()->Talk(TEXT_INTRODUCE_PALETRESS); - } - events.RescheduleEvent(EVENT_START_ARGENT_CHALLENGE_INTRO, 0); - break; - case INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED: - if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) - tirion->AI()->Talk(TEXT_BK_INTRO); - events.RescheduleEvent(EVENT_SUMMON_BLACK_KNIGHT, 3000); - break; - } - break; - case DATA_GRAND_CHAMPION_REACHED_DEST: - if (shortver) - break; - switch( uiData ) - { - case 0: - events.ScheduleEvent(EVENT_SUMMON_GRAND_CHAMPION_2, 0); - break; - case 1: - events.ScheduleEvent(EVENT_SUMMON_GRAND_CHAMPION_3, 0); - break; - case 2: - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - { - InstanceProgress = INSTANCE_PROGRESS_GRAND_CHAMPIONS_REACHED_DEST; - uiData = DONE; // save to db - announcer->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); - announcer->GetMotionMaster()->MovePoint(1, 735.81f, 661.92f, 412.39f); - events.ScheduleEvent(EVENT_GRAND_GROUP_1_MOVE_MIDDLE, 8500); - } - break; - } - break; - case DATA_MOUNT_DIED: - switch( InstanceProgress ) - { - case INSTANCE_PROGRESS_GRAND_CHAMPIONS_REACHED_DEST: // fighting group 1/3 - if( ++Counter >= 3 ) - { - Counter = 0; - InstanceProgress = INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_1; - uiData = DONE; // save to db - events.ScheduleEvent(EVENT_GRAND_GROUP_2_MOVE_MIDDLE, 0); - } - break; - case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_1: // fighting group 2/3 - if( ++Counter >= 3 ) - { - Counter = 0; - InstanceProgress = INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_2; - uiData = DONE; // save to db - events.ScheduleEvent(EVENT_GRAND_GROUP_3_MOVE_MIDDLE, 0); - } - break; - case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_2: // fighting group 3/3 - if( ++Counter >= 3 ) - { - Counter = 0; - InstanceProgress = INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_3; - uiData = DONE; // save to db - events.ScheduleEvent(EVENT_GRAND_CHAMPIONS_MOVE_MIDDLE, 0); - } - break; - case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_3: // fighting grand champions (on vehicles) - if( ++Counter >= 3 ) - { - Counter = 0; - InstanceProgress = INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED; - for( std::list::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr ) - if( Creature* veh = instance->GetCreature(*itr) ) - veh->DespawnOrUnsummon(); - events.ScheduleEvent(EVENT_GRAND_CHAMPIONS_MOVE_SIDE, 0); - } - break; - } - break; - case DATA_REACHED_NEW_MOUNT: - --Counter; - break; - case DATA_GRAND_CHAMPION_DIED: - if( ++Counter >= 3 ) - { - Counter = 0; - VehicleList.clear(); - uiData = DONE; - InstanceProgress = INSTANCE_PROGRESS_CHAMPIONS_DEAD; - m_auiEncounter[0] = DONE; - bool creditCasted = false; - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) - { - c->GetMotionMaster()->MovePoint(9, 747.36f, 670.07f, 411.9f); - if (!creditCasted) - { - c->CastSpell((Unit*)NULL, 68572, true); - creditCasted = true; - } - } - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - { - announcer->GetMotionMaster()->MovePoint(0, 743.14f, 628.77f, 411.2f); - announcer->SummonGameObject(instance->IsHeroic() ? GO_CHAMPIONS_LOOT_H : GO_CHAMPIONS_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, 0, 0, 0, 0, 90000000); // [LOOT] - events.ScheduleEvent(EVENT_RESTORE_ANNOUNCER_GOSSIP, 15000); - events.ScheduleEvent(EVENT_GRATZ_SLAIN_CHAMPIONS, 6000); - } + InstanceProgress = INSTANCE_PROGRESS_GRAND_CHAMPIONS_REACHED_DEST; + uiData = DONE; // save to db + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + { + announcer->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + announcer->GetMotionMaster()->MovePoint(1, 735.81f, 661.92f, 412.39f); + } + events.ScheduleEvent(EVENT_GRAND_GROUP_1_MOVE_MIDDLE, 10000); + } + break; + case INSTANCE_PROGRESS_CHAMPIONS_DEAD: + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + { + Counter = urand(0,1); + if( Counter ) + announcer->AI()->Talk(TEXT_INTRODUCE_EADRIC); + else + announcer->AI()->Talk(TEXT_INTRODUCE_PALETRESS); + } + events.RescheduleEvent(EVENT_START_ARGENT_CHALLENGE_INTRO, 0); + break; + case INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED: + if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) + tirion->AI()->Talk(TEXT_BK_INTRO); + events.RescheduleEvent(EVENT_SUMMON_BLACK_KNIGHT, 3000); + break; + } + break; + case DATA_GRAND_CHAMPION_REACHED_DEST: + if (shortver) + break; + switch( uiData ) + { + case 0: + events.ScheduleEvent(EVENT_SUMMON_GRAND_CHAMPION_2, 0); + break; + case 1: + events.ScheduleEvent(EVENT_SUMMON_GRAND_CHAMPION_3, 0); + break; + case 2: + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + { + InstanceProgress = INSTANCE_PROGRESS_GRAND_CHAMPIONS_REACHED_DEST; + uiData = DONE; // save to db + announcer->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + announcer->GetMotionMaster()->MovePoint(1, 735.81f, 661.92f, 412.39f); + events.ScheduleEvent(EVENT_GRAND_GROUP_1_MOVE_MIDDLE, 8500); + } + break; + } + break; + case DATA_MOUNT_DIED: + switch( InstanceProgress ) + { + case INSTANCE_PROGRESS_GRAND_CHAMPIONS_REACHED_DEST: // fighting group 1/3 + if( ++Counter >= 3 ) + { + Counter = 0; + InstanceProgress = INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_1; + uiData = DONE; // save to db + events.ScheduleEvent(EVENT_GRAND_GROUP_2_MOVE_MIDDLE, 0); + } + break; + case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_1: // fighting group 2/3 + if( ++Counter >= 3 ) + { + Counter = 0; + InstanceProgress = INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_2; + uiData = DONE; // save to db + events.ScheduleEvent(EVENT_GRAND_GROUP_3_MOVE_MIDDLE, 0); + } + break; + case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_2: // fighting group 3/3 + if( ++Counter >= 3 ) + { + Counter = 0; + InstanceProgress = INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_3; + uiData = DONE; // save to db + events.ScheduleEvent(EVENT_GRAND_CHAMPIONS_MOVE_MIDDLE, 0); + } + break; + case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_3: // fighting grand champions (on vehicles) + if( ++Counter >= 3 ) + { + Counter = 0; + InstanceProgress = INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED; + for( std::list::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr ) + if( Creature* veh = instance->GetCreature(*itr) ) + veh->DespawnOrUnsummon(); + events.ScheduleEvent(EVENT_GRAND_CHAMPIONS_MOVE_SIDE, 0); + } + break; + } + break; + case DATA_REACHED_NEW_MOUNT: + --Counter; + break; + case DATA_GRAND_CHAMPION_DIED: + if( ++Counter >= 3 ) + { + Counter = 0; + VehicleList.clear(); + uiData = DONE; + InstanceProgress = INSTANCE_PROGRESS_CHAMPIONS_DEAD; + m_auiEncounter[0] = DONE; + bool creditCasted = false; + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) + { + c->GetMotionMaster()->MovePoint(9, 747.36f, 670.07f, 411.9f); + if (!creditCasted) + { + c->CastSpell((Unit*)NULL, 68572, true); + creditCasted = true; + } + } + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + { + announcer->GetMotionMaster()->MovePoint(0, 743.14f, 628.77f, 411.2f); + announcer->SummonGameObject(instance->IsHeroic() ? GO_CHAMPIONS_LOOT_H : GO_CHAMPIONS_LOOT, 746.59f, 618.49f, 411.09f, 1.42f, 0, 0, 0, 0, 90000000); // [LOOT] + events.ScheduleEvent(EVENT_RESTORE_ANNOUNCER_GOSSIP, 15000); + events.ScheduleEvent(EVENT_GRATZ_SLAIN_CHAMPIONS, 6000); + } - // bind players to instance - if( instance->IsHeroic() ) - instance->ToInstanceMap()->PermBindAllPlayers(); - } - break; - case DATA_ARGENT_SOLDIER_DEFEATED: - if( ++Counter >= 9 ) - { - Counter = 0; - InstanceProgress = INSTANCE_PROGRESS_ARGENT_SOLDIERS_DIED; - uiData = DONE; // save to db - events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_MOVE_FORWARD, 0); - } - break; - case BOSS_ARGENT_CHALLENGE: - { - m_auiEncounter[1] = uiData; - if( uiData == DONE ) - { - InstanceProgress = INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED; - events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_RUN_MIDDLE, 0); - } - } - break; - case DATA_MEMORY_ENTRY: - NPC_MemoryEntry = uiData; - break; - case DATA_SKELETAL_GRYPHON_LANDED: - { - events.ScheduleEvent(EVENT_START_BLACK_KNIGHT_SCENE, 3000); - } - break; - case BOSS_BLACK_KNIGHT: - { - m_auiEncounter[2] = uiData; - if (uiData == NOT_STARTED) - bAchievIveHadWorse = true; - else if( uiData == DONE ) - InstanceProgress = INSTANCE_PROGRESS_FINISHED; - } - break; - case DATA_ACHIEV_IVE_HAD_WORSE: - if (bAchievIveHadWorse) - bAchievIveHadWorse = false; - break; - } + // bind players to instance + if( instance->IsHeroic() ) + instance->ToInstanceMap()->PermBindAllPlayers(); + } + break; + case DATA_ARGENT_SOLDIER_DEFEATED: + if( ++Counter >= 9 ) + { + Counter = 0; + InstanceProgress = INSTANCE_PROGRESS_ARGENT_SOLDIERS_DIED; + uiData = DONE; // save to db + events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_MOVE_FORWARD, 0); + } + break; + case BOSS_ARGENT_CHALLENGE: + { + m_auiEncounter[1] = uiData; + if( uiData == DONE ) + { + InstanceProgress = INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED; + events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_RUN_MIDDLE, 0); + } + } + break; + case DATA_MEMORY_ENTRY: + NPC_MemoryEntry = uiData; + break; + case DATA_SKELETAL_GRYPHON_LANDED: + { + events.ScheduleEvent(EVENT_START_BLACK_KNIGHT_SCENE, 3000); + } + break; + case BOSS_BLACK_KNIGHT: + { + m_auiEncounter[2] = uiData; + if (uiData == NOT_STARTED) + bAchievIveHadWorse = true; + else if( uiData == DONE ) + InstanceProgress = INSTANCE_PROGRESS_FINISHED; + } + break; + case DATA_ACHIEV_IVE_HAD_WORSE: + if (bAchievIveHadWorse) + bAchievIveHadWorse = false; + break; + } - if( uiData == DONE ) - SaveToDB(); - } + if( uiData == DONE ) + SaveToDB(); + } - void DoSummonGrandChampion(uint32 BossNumber, uint8 BossOrder) - { - uint32 CHAMPION_TO_SUMMON = 0; - uint32 MINION_TO_SUMMON = 0; - int32 TEXT_ID = 0; + void DoSummonGrandChampion(uint32 BossNumber, uint8 BossOrder) + { + uint32 CHAMPION_TO_SUMMON = 0; + uint32 MINION_TO_SUMMON = 0; + int32 TEXT_ID = 0; - switch( BossNumber ) - { - case 0: - CHAMPION_TO_SUMMON = NPC_MOKRA; - MINION_TO_SUMMON = NPC_ORGRIMMAR_MINION; - TEXT_ID = TEXT_MOKRA_SKILLCRUSHER; - break; - case 1: - CHAMPION_TO_SUMMON = NPC_ERESSEA; - MINION_TO_SUMMON = NPC_SILVERMOON_MINION; - TEXT_ID = TEXT_ERESSEA_DAWNSINGER; - break; - case 2: - CHAMPION_TO_SUMMON = NPC_RUNOK; - MINION_TO_SUMMON = NPC_THUNDER_BLUFF_MINION; - TEXT_ID = TEXT_RUNOK_WILDMANE; - break; - case 3: - CHAMPION_TO_SUMMON = NPC_ZULTORE; - MINION_TO_SUMMON = NPC_SENJIN_MINION; - TEXT_ID = TEXT_ZUL_TORE; - break; - case 4: - CHAMPION_TO_SUMMON = NPC_VISCERI; - MINION_TO_SUMMON = NPC_UNDERCITY_MINION; - TEXT_ID = TEXT_DEATHSTALKER_VESCERI; - break; - default: - return; - } + switch( BossNumber ) + { + case 0: + CHAMPION_TO_SUMMON = NPC_MOKRA; + MINION_TO_SUMMON = NPC_ORGRIMMAR_MINION; + TEXT_ID = TEXT_MOKRA_SKILLCRUSHER; + break; + case 1: + CHAMPION_TO_SUMMON = NPC_ERESSEA; + MINION_TO_SUMMON = NPC_SILVERMOON_MINION; + TEXT_ID = TEXT_ERESSEA_DAWNSINGER; + break; + case 2: + CHAMPION_TO_SUMMON = NPC_RUNOK; + MINION_TO_SUMMON = NPC_THUNDER_BLUFF_MINION; + TEXT_ID = TEXT_RUNOK_WILDMANE; + break; + case 3: + CHAMPION_TO_SUMMON = NPC_ZULTORE; + MINION_TO_SUMMON = NPC_SENJIN_MINION; + TEXT_ID = TEXT_ZUL_TORE; + break; + case 4: + CHAMPION_TO_SUMMON = NPC_VISCERI; + MINION_TO_SUMMON = NPC_UNDERCITY_MINION; + TEXT_ID = TEXT_DEATHSTALKER_VESCERI; + break; + default: + return; + } - Position SpawnPos = SpawnPosition; - if (shortver) - switch (BossOrder) - { - case 0: - SpawnPos.Relocate(780.43f, 607.15f, 411.82f); - break; - case 1: - SpawnPos.Relocate(768.72f, 581.01f, 411.92f); - break; - case 2: - SpawnPos.Relocate(784.02f, 645.33f, 412.39f); - break; - } + Position SpawnPos = SpawnPosition; + if (shortver) + switch (BossOrder) + { + case 0: + SpawnPos.Relocate(780.43f, 607.15f, 411.82f); + break; + case 1: + SpawnPos.Relocate(768.72f, 581.01f, 411.92f); + break; + case 2: + SpawnPos.Relocate(784.02f, 645.33f, 412.39f); + break; + } - if( Creature* pBoss = instance->SummonCreature(CHAMPION_TO_SUMMON, SpawnPos) ) - { - NPC_GrandChampionGUID[BossOrder] = pBoss->GetGUID(); - pBoss->ToCreature()->SetHomePosition(748.309f, 619.448f, 411.3f, M_PI/2); - pBoss->ToCreature()->SetReactState(REACT_PASSIVE); - pBoss->AI()->SetData(BossOrder, (shortver ? 1 : 0)); + if( Creature* pBoss = instance->SummonCreature(CHAMPION_TO_SUMMON, SpawnPos) ) + { + NPC_GrandChampionGUID[BossOrder] = pBoss->GetGUID(); + pBoss->ToCreature()->SetHomePosition(748.309f, 619.448f, 411.3f, M_PI/2); + pBoss->ToCreature()->SetReactState(REACT_PASSIVE); + pBoss->AI()->SetData(BossOrder, (shortver ? 1 : 0)); - for( uint8 i = 0; i < 3; ++i ) - if( Creature* pAdd = instance->SummonCreature(MINION_TO_SUMMON, SpawnPos) ) - { - NPC_GrandChampionMinionsGUID[BossOrder][i] = pAdd->GetGUID(); - pAdd->SetHomePosition(748.309f, 619.448f, 411.3f, M_PI/2); - pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, (i+1)*M_PI/2); - pAdd->SetReactState(REACT_PASSIVE); - } + for( uint8 i = 0; i < 3; ++i ) + if( Creature* pAdd = instance->SummonCreature(MINION_TO_SUMMON, SpawnPos) ) + { + NPC_GrandChampionMinionsGUID[BossOrder][i] = pAdd->GetGUID(); + pAdd->SetHomePosition(748.309f, 619.448f, 411.3f, M_PI/2); + pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, (i+1)*M_PI/2); + pAdd->SetReactState(REACT_PASSIVE); + } - } - - if (!shortver) - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - { - if( TeamIdInInstance == TEAM_HORDE ) - TEXT_ID -= 10; - announcer->AI()->Talk(TEXT_ID); - announcer->AI()->Talk(TEXT_ID+1); - } - } + } + + if (!shortver) + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + { + if( TeamIdInInstance == TEAM_HORDE ) + TEXT_ID -= 10; + announcer->AI()->Talk(TEXT_ID); + announcer->AI()->Talk(TEXT_ID+1); + } + } - void Update(uint32 diff) - { - events.Update(diff); - switch( events.GetEvent() ) - { - case EVENT_NULL: - break; - case EVENT_CHECK_PLAYERS: - { - if( DoNeedCleanup(false) ) - InstanceCleanup(); - events.RepeatEvent(CLEANUP_CHECK_INTERVAL); - } - break; - case EVENT_SUMMON_GRAND_CHAMPION_1: - { - temp1 = urand(0,4); - DoSummonGrandChampion(temp1, 0); - HandleGameObject(GO_MainGateGUID, true); - events.ScheduleEvent(EVENT_CLOSE_GATE, 6000); - events.PopEvent(); - } - break; - case EVENT_SUMMON_GRAND_CHAMPION_2: - { - do { temp2 = urand(0,4); } while( temp1 == temp2 ); - DoSummonGrandChampion(temp2, 1); - HandleGameObject(GO_MainGateGUID, true); - events.ScheduleEvent(EVENT_CLOSE_GATE, 6000); - events.PopEvent(); - } - break; - case EVENT_SUMMON_GRAND_CHAMPION_3: - { - uint8 number = 0; - do { number = urand(0,4); } while( number == temp1 || number == temp2 ); - DoSummonGrandChampion(number, 2); - HandleGameObject(GO_MainGateGUID, true); - events.ScheduleEvent(EVENT_CLOSE_GATE, 6000); - events.PopEvent(); - } - break; - case EVENT_CLOSE_GATE: - { - HandleGameObject(GO_MainGateGUID, false); - events.PopEvent(); - } - break; - case EVENT_YELL_WELCOME_2: - { - if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) - tirion->AI()->Talk(TEXT_WELCOME_2); - events.RescheduleEvent(EVENT_SUMMON_GRAND_CHAMPION_1, 8000); - events.PopEvent(); - } - break; - case EVENT_GRAND_GROUP_1_MOVE_MIDDLE: - { - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - { - announcer->SetFacingTo(4.714f); - if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) - tirion->AI()->Talk(TEXT_BEGIN); - } - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[1][i]) ) - { - float angle = rand_norm()*2*M_PI; - c->GetMotionMaster()->MovePoint(0, 748.309f+3.0f*cos(angle), 619.448f+3.0f*sin(angle), 411.3f); - } + void Update(uint32 diff) + { + events.Update(diff); + switch( events.GetEvent() ) + { + case EVENT_NULL: + break; + case EVENT_CHECK_PLAYERS: + { + if( DoNeedCleanup(false) ) + InstanceCleanup(); + events.RepeatEvent(CLEANUP_CHECK_INTERVAL); + } + break; + case EVENT_SUMMON_GRAND_CHAMPION_1: + { + temp1 = urand(0,4); + DoSummonGrandChampion(temp1, 0); + HandleGameObject(GO_MainGateGUID, true); + events.ScheduleEvent(EVENT_CLOSE_GATE, 6000); + events.PopEvent(); + } + break; + case EVENT_SUMMON_GRAND_CHAMPION_2: + { + do { temp2 = urand(0,4); } while( temp1 == temp2 ); + DoSummonGrandChampion(temp2, 1); + HandleGameObject(GO_MainGateGUID, true); + events.ScheduleEvent(EVENT_CLOSE_GATE, 6000); + events.PopEvent(); + } + break; + case EVENT_SUMMON_GRAND_CHAMPION_3: + { + uint8 number = 0; + do { number = urand(0,4); } while( number == temp1 || number == temp2 ); + DoSummonGrandChampion(number, 2); + HandleGameObject(GO_MainGateGUID, true); + events.ScheduleEvent(EVENT_CLOSE_GATE, 6000); + events.PopEvent(); + } + break; + case EVENT_CLOSE_GATE: + { + HandleGameObject(GO_MainGateGUID, false); + events.PopEvent(); + } + break; + case EVENT_YELL_WELCOME_2: + { + if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) + tirion->AI()->Talk(TEXT_WELCOME_2); + events.RescheduleEvent(EVENT_SUMMON_GRAND_CHAMPION_1, 8000); + events.PopEvent(); + } + break; + case EVENT_GRAND_GROUP_1_MOVE_MIDDLE: + { + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + { + announcer->SetFacingTo(4.714f); + if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) + tirion->AI()->Talk(TEXT_BEGIN); + } + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[1][i]) ) + { + float angle = rand_norm()*2*M_PI; + c->GetMotionMaster()->MovePoint(0, 748.309f+3.0f*cos(angle), 619.448f+3.0f*sin(angle), 411.3f); + } - events.ScheduleEvent(EVENT_GRAND_GROUP_1_ATTACK, 3000); - events.PopEvent(); - } - break; - case EVENT_GRAND_GROUP_1_ATTACK: - { - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[1][i]) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( Unit* target = c->SelectNearestTarget(200.0f) ) - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - } - Counter = 0; - events.PopEvent(); - } - break; - case EVENT_GRAND_GROUP_2_MOVE_MIDDLE: - { - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[0][i]) ) - { - float angle = rand_norm()*2*M_PI; - c->GetMotionMaster()->MovePoint(0, 748.309f+3.0f*cos(angle), 619.448f+3.0f*sin(angle), 411.3f); - } + events.ScheduleEvent(EVENT_GRAND_GROUP_1_ATTACK, 3000); + events.PopEvent(); + } + break; + case EVENT_GRAND_GROUP_1_ATTACK: + { + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[1][i]) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( Unit* target = c->SelectNearestTarget(200.0f) ) + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + } + Counter = 0; + events.PopEvent(); + } + break; + case EVENT_GRAND_GROUP_2_MOVE_MIDDLE: + { + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[0][i]) ) + { + float angle = rand_norm()*2*M_PI; + c->GetMotionMaster()->MovePoint(0, 748.309f+3.0f*cos(angle), 619.448f+3.0f*sin(angle), 411.3f); + } - events.ScheduleEvent(EVENT_GRAND_GROUP_2_ATTACK, 3000); - events.PopEvent(); - } - break; - case EVENT_GRAND_GROUP_2_ATTACK: - { - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[0][i]) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( Unit* target = c->SelectNearestTarget(200.0f) ) - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - } - events.PopEvent(); - } - break; - case EVENT_GRAND_GROUP_3_MOVE_MIDDLE: - { - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[2][i]) ) - { - float angle = rand_norm()*2*M_PI; - c->GetMotionMaster()->MovePoint(0, 748.309f+3.0f*cos(angle), 619.448f+3.0f*sin(angle), 411.3f); - } + events.ScheduleEvent(EVENT_GRAND_GROUP_2_ATTACK, 3000); + events.PopEvent(); + } + break; + case EVENT_GRAND_GROUP_2_ATTACK: + { + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[0][i]) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( Unit* target = c->SelectNearestTarget(200.0f) ) + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + } + events.PopEvent(); + } + break; + case EVENT_GRAND_GROUP_3_MOVE_MIDDLE: + { + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[2][i]) ) + { + float angle = rand_norm()*2*M_PI; + c->GetMotionMaster()->MovePoint(0, 748.309f+3.0f*cos(angle), 619.448f+3.0f*sin(angle), 411.3f); + } - events.ScheduleEvent(EVENT_GRAND_GROUP_3_ATTACK, 3000); - events.PopEvent(); - } - break; - case EVENT_GRAND_GROUP_3_ATTACK: - { - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[2][i]) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( Unit* target = c->SelectNearestTarget(200.0f) ) - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - } - events.PopEvent(); - } - break; - case EVENT_GRAND_CHAMPIONS_MOVE_MIDDLE: - { - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) - { - float angle = rand_norm()*2*M_PI; - c->GetMotionMaster()->MovePoint(4, 748.309f+3.0f*cos(angle), 619.448f+3.0f*sin(angle), 411.3f); - } + events.ScheduleEvent(EVENT_GRAND_GROUP_3_ATTACK, 3000); + events.PopEvent(); + } + break; + case EVENT_GRAND_GROUP_3_ATTACK: + { + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[2][i]) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( Unit* target = c->SelectNearestTarget(200.0f) ) + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + } + events.PopEvent(); + } + break; + case EVENT_GRAND_CHAMPIONS_MOVE_MIDDLE: + { + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) + { + float angle = rand_norm()*2*M_PI; + c->GetMotionMaster()->MovePoint(4, 748.309f+3.0f*cos(angle), 619.448f+3.0f*sin(angle), 411.3f); + } - events.ScheduleEvent(EVENT_GRAND_CHAMPIONS_MOUNTS_ATTACK, 3000); - events.PopEvent(); - } - break; - case EVENT_GRAND_CHAMPIONS_MOUNTS_ATTACK: - { - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( Unit* target = c->SelectNearestTarget(200.0f) ) - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - c->CastSpell(c, 67865, true); // SPELL_TRAMPLE_AURA - } - events.PopEvent(); - } - break; - case EVENT_GRAND_CHAMPIONS_MOVE_SIDE: - { - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) - { - c->AI()->DoAction(1); - switch( i ) - { - case 0: - c->GetMotionMaster()->MovePoint(5, 736.695f, 650.02f, 412.4f); - break; - case 1: - c->GetMotionMaster()->MovePoint(5, 756.32f, 650.05f, 412.4f); - break; - case 2: - c->GetMotionMaster()->MovePoint(5, 746.5f, 650.65f, 411.7f); - break; - } - } + events.ScheduleEvent(EVENT_GRAND_CHAMPIONS_MOUNTS_ATTACK, 3000); + events.PopEvent(); + } + break; + case EVENT_GRAND_CHAMPIONS_MOUNTS_ATTACK: + { + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( Unit* target = c->SelectNearestTarget(200.0f) ) + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + c->CastSpell(c, 67865, true); // SPELL_TRAMPLE_AURA + } + events.PopEvent(); + } + break; + case EVENT_GRAND_CHAMPIONS_MOVE_SIDE: + { + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) + { + c->AI()->DoAction(1); + switch( i ) + { + case 0: + c->GetMotionMaster()->MovePoint(5, 736.695f, 650.02f, 412.4f); + break; + case 1: + c->GetMotionMaster()->MovePoint(5, 756.32f, 650.05f, 412.4f); + break; + case 2: + c->GetMotionMaster()->MovePoint(5, 746.5f, 650.65f, 411.7f); + break; + } + } - events.ScheduleEvent(EVENT_GRAND_CHAMPIONS_ATTACK, 15000); - events.PopEvent(); - } - break; - case EVENT_GRAND_CHAMPIONS_ATTACK: - { - for( uint8 i=0; i<3; ++i ) - if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( Unit* target = c->SelectNearestTarget(200.0f) ) - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - c->AI()->DoAction(2); - } - events.PopEvent(); - } - break; - case EVENT_GRATZ_SLAIN_CHAMPIONS: - { - if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) - tirion->AI()->Talk(TEXT_GRATZ_SLAIN_CHAMPIONS); - events.PopEvent(); - } - break; - case EVENT_RESTORE_ANNOUNCER_GOSSIP: - { - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - events.PopEvent(); - } - break; - case EVENT_START_ARGENT_CHALLENGE_INTRO: - { - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - { - if( GameObject* gate = instance->GetGameObject(GO_MainGateGUID) ) - { - announcer->SetFacingToObject(gate); - HandleGameObject(GO_MainGateGUID, true, gate); - } - if( Counter ) - { - announcer->AI()->Talk(TEXT_CHEER_EADRIC_1); - announcer->AI()->Talk(TEXT_CHEER_EADRIC_2); - } - else - { - announcer->AI()->Talk(TEXT_CHEER_PALETRESS_1); - announcer->AI()->Talk(TEXT_CHEER_PALETRESS_2); - } - } - - for( int8 i = 0; i < 3; ++i ) - { - Position pos(SpawnPosition); - float x = pos.GetPositionX(); + events.ScheduleEvent(EVENT_GRAND_CHAMPIONS_ATTACK, 15000); + events.PopEvent(); + } + break; + case EVENT_GRAND_CHAMPIONS_ATTACK: + { + for( uint8 i=0; i<3; ++i ) + if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( Unit* target = c->SelectNearestTarget(200.0f) ) + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + c->AI()->DoAction(2); + } + events.PopEvent(); + } + break; + case EVENT_GRATZ_SLAIN_CHAMPIONS: + { + if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) + tirion->AI()->Talk(TEXT_GRATZ_SLAIN_CHAMPIONS); + events.PopEvent(); + } + break; + case EVENT_RESTORE_ANNOUNCER_GOSSIP: + { + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + events.PopEvent(); + } + break; + case EVENT_START_ARGENT_CHALLENGE_INTRO: + { + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + { + if( GameObject* gate = instance->GetGameObject(GO_MainGateGUID) ) + { + announcer->SetFacingToObject(gate); + HandleGameObject(GO_MainGateGUID, true, gate); + } + if( Counter ) + { + announcer->AI()->Talk(TEXT_CHEER_EADRIC_1); + announcer->AI()->Talk(TEXT_CHEER_EADRIC_2); + } + else + { + announcer->AI()->Talk(TEXT_CHEER_PALETRESS_1); + announcer->AI()->Talk(TEXT_CHEER_PALETRESS_2); + } + } + + for( int8 i = 0; i < 3; ++i ) + { + Position pos(SpawnPosition); + float x = pos.GetPositionX(); - pos.m_positionX = x-2.0f+(i-1)*10.0f; - if( Creature* pTrash = instance->SummonCreature(NPC_ARGENT_LIGHTWIELDER, pos) ) - { - pTrash->AI()->SetData(i,0); - NPC_ArgentSoldierGUID[i][0] = pTrash->GetGUID(); - } - pos.m_positionX = x+(i-1)*10.0f; - if( Creature* pTrash = instance->SummonCreature(NPC_ARGENT_MONK, pos) ) - { - pTrash->AI()->SetData(i,0); - NPC_ArgentSoldierGUID[i][1] = pTrash->GetGUID(); - } - pos.m_positionX = x+2.0f+(i-1)*10.0f; - if( Creature* pTrash = instance->SummonCreature(NPC_PRIESTESS, pos) ) - { - pTrash->AI()->SetData(i,0); - NPC_ArgentSoldierGUID[i][2] = pTrash->GetGUID(); - } - } - events.ScheduleEvent(EVENT_SUMMON_ARGENT_CHALLENGE, 4000); - events.PopEvent(); - } - break; - case EVENT_SUMMON_ARGENT_CHALLENGE: - { - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - announcer->GetMotionMaster()->MovePoint(0, 735.81f, 661.92f, 412.39f); - if( Creature* boss = instance->SummonCreature(Counter ? NPC_EADRIC : NPC_PALETRESS, SpawnPosition) ) - boss->GetMotionMaster()->MovePoint(0, 746.881f, 660.263f, 411.7f); - events.ScheduleEvent(EVENT_CLOSE_GATE, 5000); - events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_SAY_1, 4000); - events.ScheduleEvent(EVENT_ARGENT_SOLDIER_GROUP_ATTACK, 12500); - events.PopEvent(); - } - break; - case EVENT_ARGENT_CHALLENGE_SAY_1: - { - if( Creature* ac = instance->GetCreature(NPC_ArgentChampionGUID) ) - ac->AI()->Talk(Counter ? TEXT_EADRIC_SAY_1 : TEXT_PALETRESS_SAY_1); - if( !Counter ) - events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_SAY_2, 6000); - events.PopEvent(); - } - break; - case EVENT_ARGENT_CHALLENGE_SAY_2: - { - if( Creature* ac = instance->GetCreature(NPC_ArgentChampionGUID) ) - ac->AI()->Talk(TEXT_PALETRESS_SAY_2); - events.PopEvent(); - } - break; - case EVENT_ARGENT_SOLDIER_GROUP_ATTACK: - { - Counter = 0; - for( uint8 i=0; i<3; ++i ) - for( uint8 j=0; j<3; ++j ) - if( Creature* c = instance->GetCreature(NPC_ArgentSoldierGUID[i][j]) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - //c->AI()->DoZoneInCombat(); - } - if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) - tirion->AI()->Talk(TEXT_YOU_MAY_BEGIN); - events.PopEvent(); - } - break; - case EVENT_ARGENT_CHALLENGE_MOVE_FORWARD: - { - if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) - boss->GetMotionMaster()->MovePoint(0, 746.881f, 635.263f, 411.7f); - events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_ATTACK, 3000); - events.PopEvent(); - } - break; - case EVENT_ARGENT_CHALLENGE_ATTACK: - { - if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) - { - boss->SetReactState(REACT_AGGRESSIVE); - boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( Unit* target = boss->SelectNearestTarget(200.0f) ) - boss->AI()->AttackStart(target); - boss->AI()->DoZoneInCombat(); - } - events.PopEvent(); - } - break; - case EVENT_ARGENT_CHALLENGE_RUN_MIDDLE: - { - if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) - { - boss->GetMotionMaster()->MovePoint(1, 747.13f, 628.037f, 411.2f); - events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_LEAVE_CHEST, 6000); - } - events.PopEvent(); - } - break; - case EVENT_ARGENT_CHALLENGE_LEAVE_CHEST: - { - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) - { - announcer->GetMotionMaster()->MovePoint(0, 743.14f, 628.77f, 411.2f); - uint32 chest = 0; - if( instance->IsHeroic() ) - chest = (boss->GetEntry() == NPC_EADRIC || boss->GetEntry() == NPC_EADRIC_H) ? GO_EADRIC_LOOT_H : GO_PALETRESS_LOOT_H; - else - chest = (boss->GetEntry() == NPC_EADRIC || boss->GetEntry() == NPC_EADRIC_H) ? GO_EADRIC_LOOT : GO_PALETRESS_LOOT; - announcer->SummonGameObject(chest, 746.59f, 618.49f, 411.09f, 1.42f, 0, 0, 0, 0, 90000000); // [LOOT] - } + pos.m_positionX = x-2.0f+(i-1)*10.0f; + if( Creature* pTrash = instance->SummonCreature(NPC_ARGENT_LIGHTWIELDER, pos) ) + { + pTrash->AI()->SetData(i,0); + NPC_ArgentSoldierGUID[i][0] = pTrash->GetGUID(); + } + pos.m_positionX = x+(i-1)*10.0f; + if( Creature* pTrash = instance->SummonCreature(NPC_ARGENT_MONK, pos) ) + { + pTrash->AI()->SetData(i,0); + NPC_ArgentSoldierGUID[i][1] = pTrash->GetGUID(); + } + pos.m_positionX = x+2.0f+(i-1)*10.0f; + if( Creature* pTrash = instance->SummonCreature(NPC_PRIESTESS, pos) ) + { + pTrash->AI()->SetData(i,0); + NPC_ArgentSoldierGUID[i][2] = pTrash->GetGUID(); + } + } + events.ScheduleEvent(EVENT_SUMMON_ARGENT_CHALLENGE, 4000); + events.PopEvent(); + } + break; + case EVENT_SUMMON_ARGENT_CHALLENGE: + { + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + announcer->GetMotionMaster()->MovePoint(0, 735.81f, 661.92f, 412.39f); + if( Creature* boss = instance->SummonCreature(Counter ? NPC_EADRIC : NPC_PALETRESS, SpawnPosition) ) + boss->GetMotionMaster()->MovePoint(0, 746.881f, 660.263f, 411.7f); + events.ScheduleEvent(EVENT_CLOSE_GATE, 5000); + events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_SAY_1, 4000); + events.ScheduleEvent(EVENT_ARGENT_SOLDIER_GROUP_ATTACK, 12500); + events.PopEvent(); + } + break; + case EVENT_ARGENT_CHALLENGE_SAY_1: + { + if( Creature* ac = instance->GetCreature(NPC_ArgentChampionGUID) ) + ac->AI()->Talk(Counter ? TEXT_EADRIC_SAY_1 : TEXT_PALETRESS_SAY_1); + if( !Counter ) + events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_SAY_2, 6000); + events.PopEvent(); + } + break; + case EVENT_ARGENT_CHALLENGE_SAY_2: + { + if( Creature* ac = instance->GetCreature(NPC_ArgentChampionGUID) ) + ac->AI()->Talk(TEXT_PALETRESS_SAY_2); + events.PopEvent(); + } + break; + case EVENT_ARGENT_SOLDIER_GROUP_ATTACK: + { + Counter = 0; + for( uint8 i=0; i<3; ++i ) + for( uint8 j=0; j<3; ++j ) + if( Creature* c = instance->GetCreature(NPC_ArgentSoldierGUID[i][j]) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + //c->AI()->DoZoneInCombat(); + } + if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) + tirion->AI()->Talk(TEXT_YOU_MAY_BEGIN); + events.PopEvent(); + } + break; + case EVENT_ARGENT_CHALLENGE_MOVE_FORWARD: + { + if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) + boss->GetMotionMaster()->MovePoint(0, 746.881f, 635.263f, 411.7f); + events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_ATTACK, 3000); + events.PopEvent(); + } + break; + case EVENT_ARGENT_CHALLENGE_ATTACK: + { + if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) + { + boss->SetReactState(REACT_AGGRESSIVE); + boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( Unit* target = boss->SelectNearestTarget(200.0f) ) + boss->AI()->AttackStart(target); + boss->AI()->DoZoneInCombat(); + } + events.PopEvent(); + } + break; + case EVENT_ARGENT_CHALLENGE_RUN_MIDDLE: + { + if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) + { + boss->GetMotionMaster()->MovePoint(1, 747.13f, 628.037f, 411.2f); + events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_LEAVE_CHEST, 6000); + } + events.PopEvent(); + } + break; + case EVENT_ARGENT_CHALLENGE_LEAVE_CHEST: + { + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) + { + announcer->GetMotionMaster()->MovePoint(0, 743.14f, 628.77f, 411.2f); + uint32 chest = 0; + if( instance->IsHeroic() ) + chest = (boss->GetEntry() == NPC_EADRIC || boss->GetEntry() == NPC_EADRIC_H) ? GO_EADRIC_LOOT_H : GO_PALETRESS_LOOT_H; + else + chest = (boss->GetEntry() == NPC_EADRIC || boss->GetEntry() == NPC_EADRIC_H) ? GO_EADRIC_LOOT : GO_PALETRESS_LOOT; + announcer->SummonGameObject(chest, 746.59f, 618.49f, 411.09f, 1.42f, 0, 0, 0, 0, 90000000); // [LOOT] + } - events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_DISAPPEAR, 4000); - events.ScheduleEvent(EVENT_RESTORE_ANNOUNCER_GOSSIP, 15000); - events.PopEvent(); - } - break; - case EVENT_ARGENT_CHALLENGE_DISAPPEAR: - { - if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) - { - boss->GetMotionMaster()->MovePoint(0, SpawnPosition); - boss->DespawnOrUnsummon(3000); - } - events.PopEvent(); - } - break; - case EVENT_SUMMON_BLACK_KNIGHT: - { - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - if( Creature* bk_vehicle = announcer->SummonCreature(VEHICLE_BLACK_KNIGHT, 769.834f, 651.915f, 447.035f, 0.0f) ) - { - NPC_BlackKnightVehicleGUID = bk_vehicle->GetGUID(); - bk_vehicle->SetReactState(REACT_PASSIVE); - bk_vehicle->SetFacingTo(M_PI); - if( Vehicle* v = bk_vehicle->GetVehicleKit() ) - if( Unit* bk = v->GetPassenger(0) ) - { - NPC_BlackKnightGUID = bk->GetGUID(); - bk->SendMovementFlagUpdate(); // put him on vehicle visually - if( bk->GetTypeId() == TYPEID_UNIT ) - bk->ToCreature()->SetReactState(REACT_PASSIVE); - } + events.ScheduleEvent(EVENT_ARGENT_CHALLENGE_DISAPPEAR, 4000); + events.ScheduleEvent(EVENT_RESTORE_ANNOUNCER_GOSSIP, 15000); + events.PopEvent(); + } + break; + case EVENT_ARGENT_CHALLENGE_DISAPPEAR: + { + if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) ) + { + boss->GetMotionMaster()->MovePoint(0, SpawnPosition); + boss->DespawnOrUnsummon(3000); + } + events.PopEvent(); + } + break; + case EVENT_SUMMON_BLACK_KNIGHT: + { + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + if( Creature* bk_vehicle = announcer->SummonCreature(VEHICLE_BLACK_KNIGHT, 769.834f, 651.915f, 447.035f, 0.0f) ) + { + NPC_BlackKnightVehicleGUID = bk_vehicle->GetGUID(); + bk_vehicle->SetReactState(REACT_PASSIVE); + bk_vehicle->SetFacingTo(M_PI); + if( Vehicle* v = bk_vehicle->GetVehicleKit() ) + if( Unit* bk = v->GetPassenger(0) ) + { + NPC_BlackKnightGUID = bk->GetGUID(); + bk->SendMovementFlagUpdate(); // put him on vehicle visually + if( bk->GetTypeId() == TYPEID_UNIT ) + bk->ToCreature()->SetReactState(REACT_PASSIVE); + } - announcer->SetFacingToObject(bk_vehicle); - announcer->AI()->Talk(TEXT_BK_RAFTERS); - } - events.PopEvent(); - } - break; - case EVENT_START_BLACK_KNIGHT_SCENE: - { - if( Creature* bk = instance->GetCreature(NPC_BlackKnightGUID) ) - { - Position exitPos = {745.016f, 631.506f, 411.575f, M_PI}; - bk->ExitVehicle(/*&exitPos*/); - bk->GetMotionMaster()->MoveJump(exitPos, 2.0f, 2.0f); - bk->AI()->Talk(TEXT_BK_SPOILED); - } - events.ScheduleEvent(EVENT_BLACK_KNIGHT_CAST_ANNOUNCER, 2000); - events.PopEvent(); - } - break; - case EVENT_BLACK_KNIGHT_CAST_ANNOUNCER: - { - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - { - if( Creature* bk = instance->GetCreature(NPC_BlackKnightGUID) ) - { - bk->SetPosition(745.016f, 631.506f, 411.575f, bk->GetAngle(announcer)); - bk->SetHomePosition(*bk); - bk->SetFacingToObject(announcer); - announcer->SetFacingToObject(bk); - announcer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - bk->AddAura(68306, announcer); // spell has attribute player only - if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) - tirion->AI()->Talk(TEXT_BK_MEANING); - } - } - events.ScheduleEvent(EVENT_BLACK_KNIGHT_KILL_ANNOUNCER, 1000); - events.PopEvent(); - } - break; - case EVENT_BLACK_KNIGHT_KILL_ANNOUNCER: - { - if( Creature* bk_vehicle = instance->GetCreature(NPC_BlackKnightVehicleGUID) ) - bk_vehicle->AI()->DoAction(1); + announcer->SetFacingToObject(bk_vehicle); + announcer->AI()->Talk(TEXT_BK_RAFTERS); + } + events.PopEvent(); + } + break; + case EVENT_START_BLACK_KNIGHT_SCENE: + { + if( Creature* bk = instance->GetCreature(NPC_BlackKnightGUID) ) + { + Position exitPos = {745.016f, 631.506f, 411.575f, M_PI}; + bk->ExitVehicle(/*&exitPos*/); + bk->GetMotionMaster()->MoveJump(exitPos, 2.0f, 2.0f); + bk->AI()->Talk(TEXT_BK_SPOILED); + } + events.ScheduleEvent(EVENT_BLACK_KNIGHT_CAST_ANNOUNCER, 2000); + events.PopEvent(); + } + break; + case EVENT_BLACK_KNIGHT_CAST_ANNOUNCER: + { + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + { + if( Creature* bk = instance->GetCreature(NPC_BlackKnightGUID) ) + { + bk->SetPosition(745.016f, 631.506f, 411.575f, bk->GetAngle(announcer)); + bk->SetHomePosition(*bk); + bk->SetFacingToObject(announcer); + announcer->SetFacingToObject(bk); + announcer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + bk->AddAura(68306, announcer); // spell has attribute player only + if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) ) + tirion->AI()->Talk(TEXT_BK_MEANING); + } + } + events.ScheduleEvent(EVENT_BLACK_KNIGHT_KILL_ANNOUNCER, 1000); + events.PopEvent(); + } + break; + case EVENT_BLACK_KNIGHT_KILL_ANNOUNCER: + { + if( Creature* bk_vehicle = instance->GetCreature(NPC_BlackKnightVehicleGUID) ) + bk_vehicle->AI()->DoAction(1); - events.ScheduleEvent(EVENT_BLACK_KNIGHT_MOVE_FORWARD, 4000); - events.PopEvent(); - } - break; - case EVENT_BLACK_KNIGHT_MOVE_FORWARD: - { - if( Creature* bk = instance->GetCreature(NPC_BlackKnightGUID) ) - { - bk->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); - bk->GetMotionMaster()->MovePoint(0, 746.81f, 623.15f, 411.42f); - bk->AI()->Talk(TEXT_BK_LICH); - } - if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) - if (announcer->IsAlive()) - Unit::Kill(announcer, announcer); - events.ScheduleEvent(EVENT_BLACK_KNIGHT_SAY_TASK, 14000); - events.PopEvent(); - } - break; - case EVENT_BLACK_KNIGHT_SAY_TASK: - { - if( Creature* bk = instance->GetCreature(NPC_BlackKnightGUID) ) - { - bk->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - bk->AI()->Talk(TEXT_BK_TASK); - } - events.ScheduleEvent(EVENT_BLACK_KNIGHT_ATTACK, 5000); - events.PopEvent(); - } - break; - case EVENT_BLACK_KNIGHT_ATTACK: - { - if( Creature* bk = instance->GetCreature(NPC_BlackKnightGUID) ) - { - bk->SetReactState(REACT_AGGRESSIVE); - bk->SetUInt32Value(UNIT_FIELD_FLAGS, 0); - if( Unit* target = bk->SelectNearestTarget(200.0f) ) - bk->AI()->AttackStart(target); - bk->AI()->DoZoneInCombat(); - bk->AI()->DoAction(1); - } - events.PopEvent(); - } - break; - } - } + events.ScheduleEvent(EVENT_BLACK_KNIGHT_MOVE_FORWARD, 4000); + events.PopEvent(); + } + break; + case EVENT_BLACK_KNIGHT_MOVE_FORWARD: + { + if( Creature* bk = instance->GetCreature(NPC_BlackKnightGUID) ) + { + bk->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + bk->GetMotionMaster()->MovePoint(0, 746.81f, 623.15f, 411.42f); + bk->AI()->Talk(TEXT_BK_LICH); + } + if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) ) + if (announcer->IsAlive()) + Unit::Kill(announcer, announcer); + events.ScheduleEvent(EVENT_BLACK_KNIGHT_SAY_TASK, 14000); + events.PopEvent(); + } + break; + case EVENT_BLACK_KNIGHT_SAY_TASK: + { + if( Creature* bk = instance->GetCreature(NPC_BlackKnightGUID) ) + { + bk->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + bk->AI()->Talk(TEXT_BK_TASK); + } + events.ScheduleEvent(EVENT_BLACK_KNIGHT_ATTACK, 5000); + events.PopEvent(); + } + break; + case EVENT_BLACK_KNIGHT_ATTACK: + { + if( Creature* bk = instance->GetCreature(NPC_BlackKnightGUID) ) + { + bk->SetReactState(REACT_AGGRESSIVE); + bk->SetUInt32Value(UNIT_FIELD_FLAGS, 0); + if( Unit* target = bk->SelectNearestTarget(200.0f) ) + bk->AI()->AttackStart(target); + bk->AI()->DoZoneInCombat(); + bk->AI()->DoAction(1); + } + events.PopEvent(); + } + break; + } + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case 11789: // I've Had Worse criteria id - return bAchievIveHadWorse; - case 11863: - return NPC_MemoryEntry == 34942; - case 11904: - return NPC_MemoryEntry == 35028; - case 11905: - return NPC_MemoryEntry == 35029; - case 11906: - return NPC_MemoryEntry == 35030; - case 11907: - return NPC_MemoryEntry == 35031; - case 11908: - return NPC_MemoryEntry == 35032; - case 11909: - return NPC_MemoryEntry == 35033; - case 11910: - return NPC_MemoryEntry == 35034; - case 11911: - return NPC_MemoryEntry == 35036; - case 11912: - return NPC_MemoryEntry == 35037; - case 11913: - return NPC_MemoryEntry == 35038; - case 11914: - return NPC_MemoryEntry == 35039; - case 11915: - return NPC_MemoryEntry == 35040; - case 11916: - return NPC_MemoryEntry == 35041; - case 11917: - return NPC_MemoryEntry == 35042; - case 11918: - return NPC_MemoryEntry == 35043; - case 11919: - return NPC_MemoryEntry == 35044; - case 11920: - return NPC_MemoryEntry == 35045; - case 11921: - return NPC_MemoryEntry == 35046; - case 11922: - return NPC_MemoryEntry == 35047; - case 11923: - return NPC_MemoryEntry == 35048; - case 11924: - return NPC_MemoryEntry == 35049; - case 11925: - return NPC_MemoryEntry == 35050; - case 11926: - return NPC_MemoryEntry == 35051; - case 11927: - return NPC_MemoryEntry == 35052; - } - return false; - } - }; + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case 11789: // I've Had Worse criteria id + return bAchievIveHadWorse; + case 11863: + return NPC_MemoryEntry == 34942; + case 11904: + return NPC_MemoryEntry == 35028; + case 11905: + return NPC_MemoryEntry == 35029; + case 11906: + return NPC_MemoryEntry == 35030; + case 11907: + return NPC_MemoryEntry == 35031; + case 11908: + return NPC_MemoryEntry == 35032; + case 11909: + return NPC_MemoryEntry == 35033; + case 11910: + return NPC_MemoryEntry == 35034; + case 11911: + return NPC_MemoryEntry == 35036; + case 11912: + return NPC_MemoryEntry == 35037; + case 11913: + return NPC_MemoryEntry == 35038; + case 11914: + return NPC_MemoryEntry == 35039; + case 11915: + return NPC_MemoryEntry == 35040; + case 11916: + return NPC_MemoryEntry == 35041; + case 11917: + return NPC_MemoryEntry == 35042; + case 11918: + return NPC_MemoryEntry == 35043; + case 11919: + return NPC_MemoryEntry == 35044; + case 11920: + return NPC_MemoryEntry == 35045; + case 11921: + return NPC_MemoryEntry == 35046; + case 11922: + return NPC_MemoryEntry == 35047; + case 11923: + return NPC_MemoryEntry == 35048; + case 11924: + return NPC_MemoryEntry == 35049; + case 11925: + return NPC_MemoryEntry == 35050; + case 11926: + return NPC_MemoryEntry == 35051; + case 11927: + return NPC_MemoryEntry == 35052; + } + return false; + } + }; }; void AddSC_instance_trial_of_the_champion() { - new instance_trial_of_the_champion(); + new instance_trial_of_the_champion(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index c249024b4..c69f2c822 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -10,109 +10,109 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! #define GOSSIP_START_EVENT1a "I am ready." #define GOSSIP_START_EVENT1b "I am ready. However I'd like to skip the pageantry." -#define GOSSIP_START_EVENT2 "I'm ready for the next challenge." +#define GOSSIP_START_EVENT2 "I'm ready for the next challenge." #define GOSSIP_START_EVENT3 "I'm ready." class npc_announcer_toc5 : public CreatureScript { public: - npc_announcer_toc5() : CreatureScript("npc_announcer_toc5") {} + npc_announcer_toc5() : CreatureScript("npc_announcer_toc5") {} - bool OnGossipHello(Player* pPlayer, Creature* pCreature) - { - if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) ) - return true; + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) ) + return true; - InstanceScript* pInstance = pCreature->GetInstanceScript(); - if( !pInstance ) - return true; + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if( !pInstance ) + return true; - uint32 gossipTextId = 0; - switch( pInstance->GetData(DATA_INSTANCE_PROGRESS) ) - { - case INSTANCE_PROGRESS_INITIAL: - gossipTextId = 14688; - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1a, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1338); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1b, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1341); - break; - case INSTANCE_PROGRESS_CHAMPIONS_DEAD: - gossipTextId = 14737; - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1339); - break; - case INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED: - gossipTextId = 14738; - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1340); - break; - default: - return true; - } + uint32 gossipTextId = 0; + switch( pInstance->GetData(DATA_INSTANCE_PROGRESS) ) + { + case INSTANCE_PROGRESS_INITIAL: + gossipTextId = 14688; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1a, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1338); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1b, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1341); + break; + case INSTANCE_PROGRESS_CHAMPIONS_DEAD: + gossipTextId = 14737; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1339); + break; + case INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED: + gossipTextId = 14738; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1340); + break; + default: + return true; + } - pPlayer->SEND_GOSSIP_MENU(gossipTextId, pCreature->GetGUID()); - return true; - } + pPlayer->SEND_GOSSIP_MENU(gossipTextId, pCreature->GetGUID()); + return true; + } - bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) - { - if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) ) - return true; + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) ) + return true; - InstanceScript* pInstance = pCreature->GetInstanceScript(); - if( !pInstance ) - return true; + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if( !pInstance ) + return true; - if( uiAction == GOSSIP_ACTION_INFO_DEF+1338 || uiAction == GOSSIP_ACTION_INFO_DEF+1341 || uiAction == GOSSIP_ACTION_INFO_DEF+1339 || uiAction == GOSSIP_ACTION_INFO_DEF+1340 ) - { - pInstance->SetData(DATA_ANNOUNCER_GOSSIP_SELECT, (uiAction == GOSSIP_ACTION_INFO_DEF+1341 ? 1 : 0)); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } + if( uiAction == GOSSIP_ACTION_INFO_DEF+1338 || uiAction == GOSSIP_ACTION_INFO_DEF+1341 || uiAction == GOSSIP_ACTION_INFO_DEF+1339 || uiAction == GOSSIP_ACTION_INFO_DEF+1340 ) + { + pInstance->SetData(DATA_ANNOUNCER_GOSSIP_SELECT, (uiAction == GOSSIP_ACTION_INFO_DEF+1341 ? 1 : 0)); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } - pPlayer->CLOSE_GOSSIP_MENU(); - return true; - } + pPlayer->CLOSE_GOSSIP_MENU(); + return true; + } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_announcer_toc5AI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_announcer_toc5AI(pCreature); + } - struct npc_announcer_toc5AI : public CreatureAI - { - npc_announcer_toc5AI(Creature *pCreature) : CreatureAI(pCreature) {} + struct npc_announcer_toc5AI : public CreatureAI + { + npc_announcer_toc5AI(Creature *pCreature) : CreatureAI(pCreature) {} - void Reset() - { - InstanceScript* pInstance = me->GetInstanceScript(); - if( !pInstance ) - return; - if( pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_ALLIANCE ) - me->UpdateEntry(NPC_ARELAS); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // removed during black knight scene - } + void Reset() + { + InstanceScript* pInstance = me->GetInstanceScript(); + if( !pInstance ) + return; + if( pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_ALLIANCE ) + me->UpdateEntry(NPC_ARELAS); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // removed during black knight scene + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) // for bk scene so strangulate doesn't kill him - damage = me->GetHealth()-1; - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) // for bk scene so strangulate doesn't kill him + damage = me->GetHealth()-1; + } - void MovementInform(uint32 type, uint32 id) - { - if (type != EFFECT_MOTION_TYPE) - return; - InstanceScript* pInstance = me->GetInstanceScript(); - if( !pInstance ) - return; - if (pInstance->GetData(DATA_INSTANCE_PROGRESS) < INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != EFFECT_MOTION_TYPE) + return; + InstanceScript* pInstance = me->GetInstanceScript(); + if( !pInstance ) + return; + if (pInstance->GetData(DATA_INSTANCE_PROGRESS) < INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED) + return; - Unit::Kill(me, me); // for bk scene, die after knockback - } + Unit::Kill(me, me); // for bk scene, die after knockback + } - void UpdateAI(uint32 diff) {} - }; + void UpdateAI(uint32 diff) {} + }; }; void AddSC_trial_of_the_champion() { - new npc_announcer_toc5(); + new npc_announcer_toc5(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h index aea69e489..a337ca006 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h @@ -7,216 +7,216 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum eData { - BOSS_GRAND_CHAMPIONS = 0, - BOSS_ARGENT_CHALLENGE = 1, - BOSS_BLACK_KNIGHT = 2, - MAX_ENCOUNTER = 3, - DATA_INSTANCE_PROGRESS = 4, + BOSS_GRAND_CHAMPIONS = 0, + BOSS_ARGENT_CHALLENGE = 1, + BOSS_BLACK_KNIGHT = 2, + MAX_ENCOUNTER = 3, + DATA_INSTANCE_PROGRESS = 4, - DATA_ANNOUNCER = 5, - DATA_ANNOUNCER_GOSSIP_SELECT, - DATA_GRAND_CHAMPION_REACHED_DEST, - DATA_MOUNT_DIED, - DATA_REACHED_NEW_MOUNT, - DATA_GRAND_CHAMPION_PICKED_NEW_VEHICLE, - DATA_GRAND_CHAMPION_DIED, - DATA_ARGENT_SOLDIER_DEFEATED, - DATA_SKELETAL_GRYPHON_LANDED, - DATA_TEAMID_IN_INSTANCE, - DATA_PALETRESS, - DATA_MEMORY_ENTRY, - DATA_ACHIEV_IVE_HAD_WORSE, + DATA_ANNOUNCER = 5, + DATA_ANNOUNCER_GOSSIP_SELECT, + DATA_GRAND_CHAMPION_REACHED_DEST, + DATA_MOUNT_DIED, + DATA_REACHED_NEW_MOUNT, + DATA_GRAND_CHAMPION_PICKED_NEW_VEHICLE, + DATA_GRAND_CHAMPION_DIED, + DATA_ARGENT_SOLDIER_DEFEATED, + DATA_SKELETAL_GRYPHON_LANDED, + DATA_TEAMID_IN_INSTANCE, + DATA_PALETRESS, + DATA_MEMORY_ENTRY, + DATA_ACHIEV_IVE_HAD_WORSE, }; enum eProgress { - INSTANCE_PROGRESS_INITIAL = 0, - INSTANCE_PROGRESS_GRAND_CHAMPIONS_REACHED_DEST, - INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_1, - INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_2, - INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_3, - INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED, - INSTANCE_PROGRESS_CHAMPIONS_DEAD, - INSTANCE_PROGRESS_ARGENT_SOLDIERS_DIED, - INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED, - INSTANCE_PROGRESS_FINISHED, + INSTANCE_PROGRESS_INITIAL = 0, + INSTANCE_PROGRESS_GRAND_CHAMPIONS_REACHED_DEST, + INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_1, + INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_2, + INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_3, + INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED, + INSTANCE_PROGRESS_CHAMPIONS_DEAD, + INSTANCE_PROGRESS_ARGENT_SOLDIERS_DIED, + INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED, + INSTANCE_PROGRESS_FINISHED, }; enum eEvents { - EVENT_NULL = 0, - EVENT_CHECK_PLAYERS, - EVENT_CLOSE_GATE, - EVENT_SUMMON_GRAND_CHAMPION_1, - EVENT_SUMMON_GRAND_CHAMPION_2, - EVENT_SUMMON_GRAND_CHAMPION_3, - EVENT_YELL_WELCOME_2, - EVENT_GRAND_GROUP_1_MOVE_MIDDLE, - EVENT_GRAND_GROUP_1_ATTACK, - EVENT_GRAND_GROUP_2_MOVE_MIDDLE, - EVENT_GRAND_GROUP_2_ATTACK, - EVENT_GRAND_GROUP_3_MOVE_MIDDLE, - EVENT_GRAND_GROUP_3_ATTACK, - EVENT_GRAND_CHAMPIONS_MOVE_MIDDLE, - EVENT_GRAND_CHAMPIONS_MOUNTS_ATTACK, - EVENT_GRAND_CHAMPIONS_MOVE_SIDE, - EVENT_GRAND_CHAMPIONS_ATTACK, - EVENT_GRATZ_SLAIN_CHAMPIONS, - EVENT_RESTORE_ANNOUNCER_GOSSIP, - EVENT_START_ARGENT_CHALLENGE_INTRO, - EVENT_SUMMON_ARGENT_CHALLENGE, - EVENT_ARGENT_CHALLENGE_SAY_1, - EVENT_ARGENT_CHALLENGE_SAY_2, - EVENT_ARGENT_SOLDIER_GROUP_ATTACK, - EVENT_ARGENT_CHALLENGE_MOVE_FORWARD, - EVENT_ARGENT_CHALLENGE_ATTACK, - EVENT_ARGENT_CHALLENGE_RUN_MIDDLE, - EVENT_ARGENT_CHALLENGE_LEAVE_CHEST, - EVENT_ARGENT_CHALLENGE_DISAPPEAR, - EVENT_SUMMON_BLACK_KNIGHT, - EVENT_START_BLACK_KNIGHT_SCENE, - EVENT_BLACK_KNIGHT_CAST_ANNOUNCER, - EVENT_BLACK_KNIGHT_KILL_ANNOUNCER, - EVENT_BLACK_KNIGHT_MOVE_FORWARD, - EVENT_BLACK_KNIGHT_SAY_TASK, - EVENT_BLACK_KNIGHT_ATTACK, + EVENT_NULL = 0, + EVENT_CHECK_PLAYERS, + EVENT_CLOSE_GATE, + EVENT_SUMMON_GRAND_CHAMPION_1, + EVENT_SUMMON_GRAND_CHAMPION_2, + EVENT_SUMMON_GRAND_CHAMPION_3, + EVENT_YELL_WELCOME_2, + EVENT_GRAND_GROUP_1_MOVE_MIDDLE, + EVENT_GRAND_GROUP_1_ATTACK, + EVENT_GRAND_GROUP_2_MOVE_MIDDLE, + EVENT_GRAND_GROUP_2_ATTACK, + EVENT_GRAND_GROUP_3_MOVE_MIDDLE, + EVENT_GRAND_GROUP_3_ATTACK, + EVENT_GRAND_CHAMPIONS_MOVE_MIDDLE, + EVENT_GRAND_CHAMPIONS_MOUNTS_ATTACK, + EVENT_GRAND_CHAMPIONS_MOVE_SIDE, + EVENT_GRAND_CHAMPIONS_ATTACK, + EVENT_GRATZ_SLAIN_CHAMPIONS, + EVENT_RESTORE_ANNOUNCER_GOSSIP, + EVENT_START_ARGENT_CHALLENGE_INTRO, + EVENT_SUMMON_ARGENT_CHALLENGE, + EVENT_ARGENT_CHALLENGE_SAY_1, + EVENT_ARGENT_CHALLENGE_SAY_2, + EVENT_ARGENT_SOLDIER_GROUP_ATTACK, + EVENT_ARGENT_CHALLENGE_MOVE_FORWARD, + EVENT_ARGENT_CHALLENGE_ATTACK, + EVENT_ARGENT_CHALLENGE_RUN_MIDDLE, + EVENT_ARGENT_CHALLENGE_LEAVE_CHEST, + EVENT_ARGENT_CHALLENGE_DISAPPEAR, + EVENT_SUMMON_BLACK_KNIGHT, + EVENT_START_BLACK_KNIGHT_SCENE, + EVENT_BLACK_KNIGHT_CAST_ANNOUNCER, + EVENT_BLACK_KNIGHT_KILL_ANNOUNCER, + EVENT_BLACK_KNIGHT_MOVE_FORWARD, + EVENT_BLACK_KNIGHT_SAY_TASK, + EVENT_BLACK_KNIGHT_ATTACK, }; enum eNpcs { - // Horde Champions - NPC_MOKRA = 35572, - NPC_ERESSEA = 35569, - NPC_RUNOK = 35571, - NPC_ZULTORE = 35570, - NPC_VISCERI = 35617, + // Horde Champions + NPC_MOKRA = 35572, + NPC_ERESSEA = 35569, + NPC_RUNOK = 35571, + NPC_ZULTORE = 35570, + NPC_VISCERI = 35617, - // Alliance Champions - NPC_JACOB = 34705, - NPC_AMBROSE = 34702, - NPC_COLOSOS = 34701, - NPC_JAELYNE = 34657, - NPC_LANA = 34703, + // Alliance Champions + NPC_JACOB = 34705, + NPC_AMBROSE = 34702, + NPC_COLOSOS = 34701, + NPC_JAELYNE = 34657, + NPC_LANA = 34703, - // Grand Champion Minions - NPC_IRONFORGE_MINION = 35329, - NPC_STORMWIND_MINION = 35328, - NPC_GNOMEREGAN_MINION = 35331, - NPC_EXODAR_MINION = 35330, - NPC_DARNASSUS_MINION = 35332, - NPC_ORGRIMMAR_MINION = 35314, - NPC_SILVERMOON_MINION = 35326, - NPC_THUNDER_BLUFF_MINION = 35325, - NPC_SENJIN_MINION = 35323, - NPC_UNDERCITY_MINION = 35327, + // Grand Champion Minions + NPC_IRONFORGE_MINION = 35329, + NPC_STORMWIND_MINION = 35328, + NPC_GNOMEREGAN_MINION = 35331, + NPC_EXODAR_MINION = 35330, + NPC_DARNASSUS_MINION = 35332, + NPC_ORGRIMMAR_MINION = 35314, + NPC_SILVERMOON_MINION = 35326, + NPC_THUNDER_BLUFF_MINION = 35325, + NPC_SENJIN_MINION = 35323, + NPC_UNDERCITY_MINION = 35327, - NPC_EADRIC = 35119, - NPC_EADRIC_H = 35518, - NPC_PALETRESS = 34928, - NPC_PALETRESS_H = 35517, + NPC_EADRIC = 35119, + NPC_EADRIC_H = 35518, + NPC_PALETRESS = 34928, + NPC_PALETRESS_H = 35517, - NPC_ARGENT_LIGHTWIELDER = 35309, - NPC_ARGENT_MONK = 35305, - NPC_PRIESTESS = 35307, + NPC_ARGENT_LIGHTWIELDER = 35309, + NPC_ARGENT_MONK = 35305, + NPC_PRIESTESS = 35307, - NPC_BLACK_KNIGHT = 35451, + NPC_BLACK_KNIGHT = 35451, - NPC_JAEREN = 35004, - NPC_ARELAS = 35005, - NPC_RISEN_JAEREN = 35545, - NPC_RISEN_ARELAS = 35564, - NPC_TIRION = 33628, + NPC_JAEREN = 35004, + NPC_ARELAS = 35005, + NPC_RISEN_JAEREN = 35545, + NPC_RISEN_ARELAS = 35564, + NPC_TIRION = 33628, }; enum eGameObjects { - GO_MAIN_GATE = 195647, - GO_SOUTH_PORTCULLIS = 195649, - GO_EAST_PORTCULLIS = 195648, + GO_MAIN_GATE = 195647, + GO_SOUTH_PORTCULLIS = 195649, + GO_EAST_PORTCULLIS = 195648, - GO_CHAMPIONS_LOOT = 195709, - GO_CHAMPIONS_LOOT_H = 195710, + GO_CHAMPIONS_LOOT = 195709, + GO_CHAMPIONS_LOOT_H = 195710, - GO_EADRIC_LOOT = 195374, - GO_EADRIC_LOOT_H = 195375, + GO_EADRIC_LOOT = 195374, + GO_EADRIC_LOOT_H = 195375, - GO_PALETRESS_LOOT = 195323, - GO_PALETRESS_LOOT_H = 195324, + GO_PALETRESS_LOOT = 195323, + GO_PALETRESS_LOOT_H = 195324, }; enum eVehicles { - VEHICLE_ARGENT_WARHORSE = 35644, - VEHICLE_ARGENT_BATTLEWORG = 36558, + VEHICLE_ARGENT_WARHORSE = 35644, + VEHICLE_ARGENT_BATTLEWORG = 36558, - VEHICLE_BLACK_KNIGHT = 35491, + VEHICLE_BLACK_KNIGHT = 35491, }; enum eTexts { - TEXT_LANA_STOUTHAMMER = 1, - TEXT_CHEER_LANA_STOUTHAMMER = 2, - TEXT_COLOSOS = 3, - TEXT_CHEER_COLOSOS = 4, - TEXT_EVENSONG = 5, - TEXT_CHEER_EVENSONG = 6, - TEXT_MARSHAL_JACOB_ALERIUS = 7, - TEXT_CHEER_MARSHAL_JACOB_ALERIUS = 8, - TEXT_AMBROSE_BOLTSPARK = 9, - TEXT_CHEER_AMBROSE_BOLTSPARK = 10, + TEXT_LANA_STOUTHAMMER = 1, + TEXT_CHEER_LANA_STOUTHAMMER = 2, + TEXT_COLOSOS = 3, + TEXT_CHEER_COLOSOS = 4, + TEXT_EVENSONG = 5, + TEXT_CHEER_EVENSONG = 6, + TEXT_MARSHAL_JACOB_ALERIUS = 7, + TEXT_CHEER_MARSHAL_JACOB_ALERIUS = 8, + TEXT_AMBROSE_BOLTSPARK = 9, + TEXT_CHEER_AMBROSE_BOLTSPARK = 10, - TEXT_DEATHSTALKER_VESCERI = 11, - TEXT_CHEER_DEATHSTALKER_VESCERI = 12, - TEXT_RUNOK_WILDMANE = 13, - TEXT_CHEER_RUNOK_WILDMANE = 14, - TEXT_ZUL_TORE = 15, - TEXT_CHEER_ZUL_TORE = 16, - TEXT_MOKRA_SKILLCRUSHER = 17, - TEXT_CHEER_MOKRA_SKILLCRUSHER = 18, - TEXT_ERESSEA_DAWNSINGER = 19, - TEXT_CHEER_ERESSEA_DAWNSINGER = 20, + TEXT_DEATHSTALKER_VESCERI = 11, + TEXT_CHEER_DEATHSTALKER_VESCERI = 12, + TEXT_RUNOK_WILDMANE = 13, + TEXT_CHEER_RUNOK_WILDMANE = 14, + TEXT_ZUL_TORE = 15, + TEXT_CHEER_ZUL_TORE = 16, + TEXT_MOKRA_SKILLCRUSHER = 17, + TEXT_CHEER_MOKRA_SKILLCRUSHER = 18, + TEXT_ERESSEA_DAWNSINGER = 19, + TEXT_CHEER_ERESSEA_DAWNSINGER = 20, - TEXT_WELCOME = 21, - TEXT_WELCOME_2 = 22, - TEXT_BEGIN = 23, - TEXT_GRATZ_SLAIN_CHAMPIONS = 24, - TEXT_INTRODUCE_EADRIC = 25, - TEXT_INTRODUCE_PALETRESS = 26, - TEXT_CHEER_EADRIC_1 = 27, - TEXT_CHEER_EADRIC_2 = 28, - TEXT_EADRIC_SAY_1 = 39, - TEXT_CHEER_PALETRESS_1 = 29, - TEXT_CHEER_PALETRESS_2 = 30, - TEXT_PALETRESS_SAY_1 = 37, - TEXT_PALETRESS_SAY_2 = 38, - TEXT_YOU_MAY_BEGIN = 41, + TEXT_WELCOME = 21, + TEXT_WELCOME_2 = 22, + TEXT_BEGIN = 23, + TEXT_GRATZ_SLAIN_CHAMPIONS = 24, + TEXT_INTRODUCE_EADRIC = 25, + TEXT_INTRODUCE_PALETRESS = 26, + TEXT_CHEER_EADRIC_1 = 27, + TEXT_CHEER_EADRIC_2 = 28, + TEXT_EADRIC_SAY_1 = 39, + TEXT_CHEER_PALETRESS_1 = 29, + TEXT_CHEER_PALETRESS_2 = 30, + TEXT_PALETRESS_SAY_1 = 37, + TEXT_PALETRESS_SAY_2 = 38, + TEXT_YOU_MAY_BEGIN = 41, - TEXT_BK_INTRO = 31, - TEXT_BK_RAFTERS = 32, - TEXT_BK_SPOILED = 33, - TEXT_BK_MEANING = 34, - TEXT_BK_LICH = 35, - TEXT_BK_TASK = 36, + TEXT_BK_INTRO = 31, + TEXT_BK_RAFTERS = 32, + TEXT_BK_SPOILED = 33, + TEXT_BK_MEANING = 34, + TEXT_BK_LICH = 35, + TEXT_BK_TASK = 36, - TEXT_EADRIC_AGGRO = 42, - TEXT_EADRIC_HAMMER = 43, - TEXT_EADRIC_SLAIN_1 = 44, - TEXT_EADRIC_SLAIN_2 = 45, - TEXT_EADRIC_DEATH = 46, + TEXT_EADRIC_AGGRO = 42, + TEXT_EADRIC_HAMMER = 43, + TEXT_EADRIC_SLAIN_1 = 44, + TEXT_EADRIC_SLAIN_2 = 45, + TEXT_EADRIC_DEATH = 46, - TEXT_PALETRESS_AGGRO = 47, - TEXT_PALETRESS_MEMORY_SUMMON = 48, - TEXT_PALETRESS_MEMORY_DEFEATED = 51, - TEXT_PALETRESS_SLAIN_1 = 49, - TEXT_PALETRESS_SLAIN_2 = 50, - TEXT_PALETRESS_DEATH = 52, + TEXT_PALETRESS_AGGRO = 47, + TEXT_PALETRESS_MEMORY_SUMMON = 48, + TEXT_PALETRESS_MEMORY_DEFEATED = 51, + TEXT_PALETRESS_SLAIN_1 = 49, + TEXT_PALETRESS_SLAIN_2 = 50, + TEXT_PALETRESS_DEATH = 52, - TEXT_BK_AGGRO = 53, - TEXT_BK_SLAIN_1 = 57, - TEXT_BK_SLAIN_2 = 58, - TEXT_BK_SKELETON_RES = 54, - TEXT_BK_GHOST_RES = 55, - TEXT_BK_DEATH = 56, + TEXT_BK_AGGRO = 53, + TEXT_BK_SLAIN_1 = 57, + TEXT_BK_SLAIN_2 = 58, + TEXT_BK_SKELETON_RES = 54, + TEXT_BK_GHOST_RES = 55, + TEXT_BK_DEATH = 56, }; #endif diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 8529d01be..e34fb1f2e 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -26,847 +26,847 @@ enum AnubTexts enum AnubNPCs { - NPC_FROST_SPHERE = 34606, - NPC_BURROW = 34862, - NPC_BURROWER = 34607, - NPC_SCARAB = 34605, - NPC_SPIKE = 34660, + NPC_FROST_SPHERE = 34606, + NPC_BURROW = 34862, + NPC_BURROWER = 34607, + NPC_SCARAB = 34605, + NPC_SPIKE = 34660, }; const Position AnubLocs[]= { - // scarab's beginning pos - {722.65f, 135.41f, 142.16f, M_PI}, + // scarab's beginning pos + {722.65f, 135.41f, 142.16f, M_PI}, - // churning ground spawns - {694.886353f, 102.484665f, 142.119614f, 0}, - {731.987244f, 83.3824690f, 142.119614f, 0}, - {694.500671f, 185.363968f, 142.117905f, 0}, - {740.184509f, 193.443390f, 142.117584f, 0}, + // churning ground spawns + {694.886353f, 102.484665f, 142.119614f, 0}, + {731.987244f, 83.3824690f, 142.119614f, 0}, + {694.500671f, 185.363968f, 142.117905f, 0}, + {740.184509f, 193.443390f, 142.117584f, 0}, - // sphere spawns - { 786.6439f, 108.2498f, 155.6701f, 0 }, - { 806.8429f, 150.5902f, 155.6701f, 0 }, - { 759.1386f, 163.9654f, 155.6701f, 0 }, - { 744.3701f, 119.5211f, 155.6701f, 0 }, - { 710.0211f, 120.8152f, 155.6701f, 0 }, - { 706.6383f, 161.5266f, 155.6701f, 0 }, + // sphere spawns + { 786.6439f, 108.2498f, 155.6701f, 0 }, + { 806.8429f, 150.5902f, 155.6701f, 0 }, + { 759.1386f, 163.9654f, 155.6701f, 0 }, + { 744.3701f, 119.5211f, 155.6701f, 0 }, + { 710.0211f, 120.8152f, 155.6701f, 0 }, + { 706.6383f, 161.5266f, 155.6701f, 0 }, }; class HideNpcEvent : public BasicEvent { public: - HideNpcEvent(Creature& owner) : _owner(owner) { } + HideNpcEvent(Creature& owner) : _owner(owner) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - _owner.SetVisible(false); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + _owner.SetVisible(false); + return true; + } private: - Creature& _owner; + Creature& _owner; }; enum AnubSpells { - // Anub'arak - SPELL_SUBMERGE = 65981, - SPELL_EMERGE = 65982, - SPELL_BERSERK = 26662, + // Anub'arak + SPELL_SUBMERGE = 65981, + SPELL_EMERGE = 65982, + SPELL_BERSERK = 26662, - SPELL_FREEZING_SLASH = 66012, - SPELL_PENETRATING_COLD = 66013, - SPELL_SUMMON_SCARAB = 66339, - SPELL_SUMMON_BURROWER = 66332, - SPELL_LEECHING_SWARM = 66118, + SPELL_FREEZING_SLASH = 66012, + SPELL_PENETRATING_COLD = 66013, + SPELL_SUMMON_SCARAB = 66339, + SPELL_SUMMON_BURROWER = 66332, + SPELL_LEECHING_SWARM = 66118, - // Anub'arak Pursue - SPELL_MARK = 67574, - SPELL_SUMMON_SPIKE = 66169, - SPELL_SPIKE_SPEED1 = 65920, - SPELL_SPIKE_TRAIL = 65921, - SPELL_SPIKE_SPEED2 = 65922, - SPELL_SPIKE_SPEED3 = 65923, - SPELL_SPIKE_FAIL = 66181, - SPELL_SPIKE_TELE = 66170, - SPELL_IMPALE = 65919, + // Anub'arak Pursue + SPELL_MARK = 67574, + SPELL_SUMMON_SPIKE = 66169, + SPELL_SPIKE_SPEED1 = 65920, + SPELL_SPIKE_TRAIL = 65921, + SPELL_SPIKE_SPEED2 = 65922, + SPELL_SPIKE_SPEED3 = 65923, + SPELL_SPIKE_FAIL = 66181, + SPELL_SPIKE_TELE = 66170, + SPELL_IMPALE = 65919, - // Scarab - SPELL_DETERMINATION = 66092, - SPELL_ACID_MANDIBLE = 65774, + // Scarab + SPELL_DETERMINATION = 66092, + SPELL_ACID_MANDIBLE = 65774, - // Burrow - SPELL_CHURNING_GROUND = 66969, + // Burrow + SPELL_CHURNING_GROUND = 66969, - // Frost Sphere - SPELL_FROST_SPHERE = 67539, - SPELL_PERMAFROST = 66193, - SPELL_PERMAFROST_VISUAL = 65882, + // Frost Sphere + SPELL_FROST_SPHERE = 67539, + SPELL_PERMAFROST = 66193, + SPELL_PERMAFROST_VISUAL = 65882, - // Burrower - SPELL_SPIDER_FRENZY = 66128, - SPELL_EXPOSE_WEAKNESS = 67720, - SPELL_SHADOW_STRIKE = 66134, - SPELL_SUBMERGE_EFFECT = 53421, - SPELL_EMERGE_EFFECT = 66947, + // Burrower + SPELL_SPIDER_FRENZY = 66128, + SPELL_EXPOSE_WEAKNESS = 67720, + SPELL_SHADOW_STRIKE = 66134, + SPELL_SUBMERGE_EFFECT = 53421, + SPELL_EMERGE_EFFECT = 66947, }; enum AnubEvents { - EVENT_RESPAWN_SPHERE = 1, - EVENT_ENRAGE, - EVENT_SPELL_FREEZING_SLASH, - EVENT_SPELL_PENETRATING_COLD, - EVENT_SUMMON_NERUBIAN, - EVENT_SUBMERGE, - EVENT_EMERGE, - EVENT_EMERGE_2, - EVENT_SPELL_SUMMON_SPIKE, - EVENT_SPELL_SHADOW_STRIKE, - EVENT_SUMMON_SCARAB, + EVENT_RESPAWN_SPHERE = 1, + EVENT_ENRAGE, + EVENT_SPELL_FREEZING_SLASH, + EVENT_SPELL_PENETRATING_COLD, + EVENT_SUMMON_NERUBIAN, + EVENT_SUBMERGE, + EVENT_EMERGE, + EVENT_EMERGE_2, + EVENT_SPELL_SUMMON_SPIKE, + EVENT_SPELL_SHADOW_STRIKE, + EVENT_SUMMON_SCARAB, }; -#define SUBMERGE_INTERVAL 80000 -#define EMERGE_INTERVAL 60000 +#define SUBMERGE_INTERVAL 80000 +#define EMERGE_INTERVAL 60000 class boss_anubarak_trial : public CreatureScript { public: - boss_anubarak_trial() : CreatureScript("boss_anubarak_trial") {} + boss_anubarak_trial() : CreatureScript("boss_anubarak_trial") {} - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_anubarak_trialAI(pCreature); - }; + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_anubarak_trialAI(pCreature); + }; - struct boss_anubarak_trialAI : public ScriptedAI - { - boss_anubarak_trialAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) - { - pInstance = (InstanceScript*)pCreature->GetInstanceScript(); - events.Reset(); - bIntro = false; - bPhase3 = false; - me->ApplySpellImmune(0, IMMUNITY_ID, RAID_MODE(66193,67855,67856,67857), true); - me->m_SightDistance = 90.0f; // for MoveInLineOfSight distance - } + struct boss_anubarak_trialAI : public ScriptedAI + { + boss_anubarak_trialAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) + { + pInstance = (InstanceScript*)pCreature->GetInstanceScript(); + events.Reset(); + bIntro = false; + bPhase3 = false; + me->ApplySpellImmune(0, IMMUNITY_ID, RAID_MODE(66193,67855,67856,67857), true); + me->m_SightDistance = 90.0f; // for MoveInLineOfSight distance + } - InstanceScript* pInstance; - SummonList summons; - EventMap events; - bool bIntro; - bool bPhase3; - uint64 SphereGUID[6]; - uint64 BurrowGUID[4]; + InstanceScript* pInstance; + SummonList summons; + EventMap events; + bool bIntro; + bool bPhase3; + uint64 SphereGUID[6]; + uint64 BurrowGUID[4]; - void Reset() - { - me->SetStandState(UNIT_STAND_STATE_SUBMERGED); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - summons.DespawnAll(); - for( uint8 i=0; i<10; ++i ) - { - float angle = rand_norm()*2*M_PI; - float dist = rand_norm()*40.0f; - if( Creature* c = me->SummonCreature(NPC_SCARAB, AnubLocs[0].GetPositionX()+cos(angle)*dist, AnubLocs[0].GetPositionY()+sin(angle)*dist, AnubLocs[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000) ) - { - c->setFaction(31); - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - c->GetMotionMaster()->MoveRandom(15.0f); - } - } - } + void Reset() + { + me->SetStandState(UNIT_STAND_STATE_SUBMERGED); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + summons.DespawnAll(); + for( uint8 i=0; i<10; ++i ) + { + float angle = rand_norm()*2*M_PI; + float dist = rand_norm()*40.0f; + if( Creature* c = me->SummonCreature(NPC_SCARAB, AnubLocs[0].GetPositionX()+cos(angle)*dist, AnubLocs[0].GetPositionY()+sin(angle)*dist, AnubLocs[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000) ) + { + c->setFaction(31); + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + c->GetMotionMaster()->MoveRandom(15.0f); + } + } + } - void DoAction(int32 param) - { - switch( param ) - { - case -1: - summons.DespawnAll(); - break; - } - } + void DoAction(int32 param) + { + switch( param ) + { + case -1: + summons.DespawnAll(); + break; + } + } - void EnterCombat(Unit* /*who*/) - { - me->setActive(true); - events.Reset(); - events.RescheduleEvent(EVENT_ENRAGE, 600000); - events.RescheduleEvent(EVENT_SPELL_FREEZING_SLASH, urand(7000,15000)); - events.RescheduleEvent(EVENT_SPELL_PENETRATING_COLD, urand(15000,20000)); - events.RescheduleEvent(EVENT_SUMMON_NERUBIAN, urand(5000,8000)); - events.RescheduleEvent(EVENT_SUBMERGE, SUBMERGE_INTERVAL); - if( !IsHeroic() ) - events.RescheduleEvent(EVENT_RESPAWN_SPHERE, 4000); + void EnterCombat(Unit* /*who*/) + { + me->setActive(true); + events.Reset(); + events.RescheduleEvent(EVENT_ENRAGE, 600000); + events.RescheduleEvent(EVENT_SPELL_FREEZING_SLASH, urand(7000,15000)); + events.RescheduleEvent(EVENT_SPELL_PENETRATING_COLD, urand(15000,20000)); + events.RescheduleEvent(EVENT_SUMMON_NERUBIAN, urand(5000,8000)); + events.RescheduleEvent(EVENT_SUBMERGE, SUBMERGE_INTERVAL); + if( !IsHeroic() ) + events.RescheduleEvent(EVENT_RESPAWN_SPHERE, 4000); - for( std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr ) - if( Creature* c = pInstance->instance->GetCreature(*itr) ) - { - c->GetMotionMaster()->MoveIdle(); - c->StopMoving(); - c->CastSpell(c, SPELL_SUBMERGE, false); - c->AI()->DoAction(1); - } - summons.clear(); - for( uint8 i=0; i<4; ++i ) - if( Creature* c = me->SummonCreature(NPC_BURROW, AnubLocs[i+1]) ) - BurrowGUID[i] = c->GetGUID(); - for( uint8 i=0; i<6; ++i ) - if( Creature* c = me->SummonCreature(NPC_FROST_SPHERE, AnubLocs[i+5]) ) - SphereGUID[i] = c->GetGUID(); + for( std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr ) + if( Creature* c = pInstance->instance->GetCreature(*itr) ) + { + c->GetMotionMaster()->MoveIdle(); + c->StopMoving(); + c->CastSpell(c, SPELL_SUBMERGE, false); + c->AI()->DoAction(1); + } + summons.clear(); + for( uint8 i=0; i<4; ++i ) + if( Creature* c = me->SummonCreature(NPC_BURROW, AnubLocs[i+1]) ) + BurrowGUID[i] = c->GetGUID(); + for( uint8 i=0; i<6; ++i ) + if( Creature* c = me->SummonCreature(NPC_FROST_SPHERE, AnubLocs[i+5]) ) + SphereGUID[i] = c->GetGUID(); - Talk(SAY_AGGRO); - DoZoneInCombat(); - if( pInstance ) - pInstance->SetData(TYPE_ANUBARAK, IN_PROGRESS); - } + Talk(SAY_AGGRO); + DoZoneInCombat(); + if( pInstance ) + pInstance->SetData(TYPE_ANUBARAK, IN_PROGRESS); + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - if( !bPhase3 && HealthBelowPct(30) && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && !me->HasAura(SPELL_SUBMERGE) && !me->HasAura(SPELL_EMERGE) ) - { - bPhase3 = true; - events.CancelEvent(EVENT_SUBMERGE); - events.CancelEvent(EVENT_EMERGE); - events.CancelEvent(EVENT_EMERGE_2); - if( !IsHeroic() ) - events.CancelEvent(EVENT_SUMMON_NERUBIAN); - me->CastSpell((Unit*)NULL, SPELL_LEECHING_SWARM, false); - Talk(EMOTE_LEECHING_SWARM); - Talk(SAY_LEECHING_SWARM); - return; - } + if( !bPhase3 && HealthBelowPct(30) && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && !me->HasAura(SPELL_SUBMERGE) && !me->HasAura(SPELL_EMERGE) ) + { + bPhase3 = true; + events.CancelEvent(EVENT_SUBMERGE); + events.CancelEvent(EVENT_EMERGE); + events.CancelEvent(EVENT_EMERGE_2); + if( !IsHeroic() ) + events.CancelEvent(EVENT_SUMMON_NERUBIAN); + me->CastSpell((Unit*)NULL, SPELL_LEECHING_SWARM, false); + Talk(EMOTE_LEECHING_SWARM); + Talk(SAY_LEECHING_SWARM); + return; + } - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_ENRAGE: - { - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - } - break; - case EVENT_RESPAWN_SPHERE: - { - uint8 StartAt = urand(0,5); - uint8 i = StartAt; - do - { - if( Creature* c = ObjectAccessor::GetCreature(*me, SphereGUID[i]) ) - if( !c->HasAura(SPELL_FROST_SPHERE) ) - { - if( Creature* c = me->SummonCreature(NPC_FROST_SPHERE, AnubLocs[i+5]) ) - SphereGUID[i] = c->GetGUID(); - break; - } - i = (i+1)%6; - } - while( i != StartAt ); - events.RepeatEvent(4000); - } - break; - case EVENT_SPELL_FREEZING_SLASH: - { - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_FREEZING_SLASH, false); - events.RepeatEvent(urand(15000,20000)); - } - break; - case EVENT_SPELL_PENETRATING_COLD: - { - me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2,5,2,5)); - events.RepeatEvent(18000); - } - break; - case EVENT_SUMMON_NERUBIAN: - { - me->CastCustomSpell(SPELL_SUMMON_BURROWER, SPELLVALUE_MAX_TARGETS, RAID_MODE(1,2,2,4)); - events.RepeatEvent(45000); - } - break; - case EVENT_SUBMERGE: - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - bool berserk = me->HasAura(SPELL_BERSERK); - me->RemoveAllAuras(); - if (berserk) - me->CastSpell(me, SPELL_BERSERK, true); - Talk(EMOTE_SUBMERGE); - Talk(EMOTE_BURROWER); - me->CastSpell(me, SPELL_SUBMERGE, false); - events.CancelEvent(EVENT_SUMMON_NERUBIAN); - events.CancelEvent(EVENT_SPELL_FREEZING_SLASH); - events.CancelEvent(EVENT_SPELL_PENETRATING_COLD); - events.RescheduleEvent(EVENT_EMERGE, EMERGE_INTERVAL); - events.RescheduleEvent(EVENT_SPELL_SUMMON_SPIKE, 2500); - events.RescheduleEvent(EVENT_SUMMON_SCARAB, 3000); - events.PopEvent(); - } - break; - case EVENT_SUMMON_SCARAB: - { - uint8 i = urand(0,3); - if( Creature* c = ObjectAccessor::GetCreature(*me, BurrowGUID[i]) ) - me->CastSpell(c, SPELL_SUMMON_SCARAB, true); - events.RepeatEvent(4000); - } - break; - case EVENT_EMERGE: - { - me->CastSpell(me, SPELL_SPIKE_TELE, true); - summons.DespawnEntry(NPC_SPIKE); - events.CancelEvent(EVENT_SUMMON_SCARAB); - events.RescheduleEvent(EVENT_EMERGE_2, 2000); - events.PopEvent(); - } - break; - case EVENT_EMERGE_2: - { - Talk(SAY_EMERGE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setAttackTimer(BASE_ATTACK, 3000); - me->RemoveAura(SPELL_SUBMERGE); - me->CastSpell(me, SPELL_EMERGE, false); - events.RescheduleEvent(EVENT_SUMMON_NERUBIAN, urand(5000,8000)); - events.RescheduleEvent(EVENT_SPELL_FREEZING_SLASH, urand(7000,15000)); - events.RescheduleEvent(EVENT_SPELL_PENETRATING_COLD, urand(15000,20000)); - events.RescheduleEvent(EVENT_SUBMERGE, SUBMERGE_INTERVAL); - events.PopEvent(); - } - break; - case EVENT_SPELL_SUMMON_SPIKE: - me->CastSpell(me, SPELL_SUMMON_SPIKE, true); - events.PopEvent(); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_ENRAGE: + { + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + } + break; + case EVENT_RESPAWN_SPHERE: + { + uint8 StartAt = urand(0,5); + uint8 i = StartAt; + do + { + if( Creature* c = ObjectAccessor::GetCreature(*me, SphereGUID[i]) ) + if( !c->HasAura(SPELL_FROST_SPHERE) ) + { + if( Creature* c = me->SummonCreature(NPC_FROST_SPHERE, AnubLocs[i+5]) ) + SphereGUID[i] = c->GetGUID(); + break; + } + i = (i+1)%6; + } + while( i != StartAt ); + events.RepeatEvent(4000); + } + break; + case EVENT_SPELL_FREEZING_SLASH: + { + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_FREEZING_SLASH, false); + events.RepeatEvent(urand(15000,20000)); + } + break; + case EVENT_SPELL_PENETRATING_COLD: + { + me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2,5,2,5)); + events.RepeatEvent(18000); + } + break; + case EVENT_SUMMON_NERUBIAN: + { + me->CastCustomSpell(SPELL_SUMMON_BURROWER, SPELLVALUE_MAX_TARGETS, RAID_MODE(1,2,2,4)); + events.RepeatEvent(45000); + } + break; + case EVENT_SUBMERGE: + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + bool berserk = me->HasAura(SPELL_BERSERK); + me->RemoveAllAuras(); + if (berserk) + me->CastSpell(me, SPELL_BERSERK, true); + Talk(EMOTE_SUBMERGE); + Talk(EMOTE_BURROWER); + me->CastSpell(me, SPELL_SUBMERGE, false); + events.CancelEvent(EVENT_SUMMON_NERUBIAN); + events.CancelEvent(EVENT_SPELL_FREEZING_SLASH); + events.CancelEvent(EVENT_SPELL_PENETRATING_COLD); + events.RescheduleEvent(EVENT_EMERGE, EMERGE_INTERVAL); + events.RescheduleEvent(EVENT_SPELL_SUMMON_SPIKE, 2500); + events.RescheduleEvent(EVENT_SUMMON_SCARAB, 3000); + events.PopEvent(); + } + break; + case EVENT_SUMMON_SCARAB: + { + uint8 i = urand(0,3); + if( Creature* c = ObjectAccessor::GetCreature(*me, BurrowGUID[i]) ) + me->CastSpell(c, SPELL_SUMMON_SCARAB, true); + events.RepeatEvent(4000); + } + break; + case EVENT_EMERGE: + { + me->CastSpell(me, SPELL_SPIKE_TELE, true); + summons.DespawnEntry(NPC_SPIKE); + events.CancelEvent(EVENT_SUMMON_SCARAB); + events.RescheduleEvent(EVENT_EMERGE_2, 2000); + events.PopEvent(); + } + break; + case EVENT_EMERGE_2: + { + Talk(SAY_EMERGE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setAttackTimer(BASE_ATTACK, 3000); + me->RemoveAura(SPELL_SUBMERGE); + me->CastSpell(me, SPELL_EMERGE, false); + events.RescheduleEvent(EVENT_SUMMON_NERUBIAN, urand(5000,8000)); + events.RescheduleEvent(EVENT_SPELL_FREEZING_SLASH, urand(7000,15000)); + events.RescheduleEvent(EVENT_SPELL_PENETRATING_COLD, urand(15000,20000)); + events.RescheduleEvent(EVENT_SUBMERGE, SUBMERGE_INTERVAL); + events.PopEvent(); + } + break; + case EVENT_SPELL_SUMMON_SPIKE: + me->CastSpell(me, SPELL_SUMMON_SPIKE, true); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustSummoned(Creature* summon) - { - if( !summon ) - return; + void JustSummoned(Creature* summon) + { + if( !summon ) + return; - summons.Summon(summon); - } + summons.Summon(summon); + } - void JustDied(Unit* /*pKiller*/) - { - events.Reset(); - summons.DespawnAll(); - Talk(SAY_DEATH); - if( pInstance ) - pInstance->SetData(TYPE_ANUBARAK, DONE); + void JustDied(Unit* /*pKiller*/) + { + events.Reset(); + summons.DespawnAll(); + Talk(SAY_DEATH); + if( pInstance ) + pInstance->SetData(TYPE_ANUBARAK, DONE); - Player* plr = NULL; - if( !pInstance->instance->GetPlayers().isEmpty() ) - plr = pInstance->instance->GetPlayers().begin()->GetSource(); + Player* plr = NULL; + if( !pInstance->instance->GetPlayers().isEmpty() ) + plr = pInstance->instance->GetPlayers().begin()->GetSource(); - if( !plr ) - return; + if( !plr ) + return; - // remove loot for the other faction (items are invisible for players, done in conditions), so corpse can be skinned - for( std::vector::iterator itr = me->loot.items.begin(); itr != me->loot.items.end(); ++itr ) - if( ItemTemplate const *iProto = sObjectMgr->GetItemTemplate((*itr).itemid) ) - if( ((iProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && plr->GetTeamId() != TEAM_HORDE) || ((iProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && plr->GetTeamId() != TEAM_ALLIANCE) ) - { - (*itr).count = 0; - (*itr).is_looted = true; - --me->loot.unlootedCount; - } - } - - void KilledUnit(Unit* who) - { - if( who->GetTypeId() == TYPEID_PLAYER ) - Talk(SAY_KILL_PLAYER); - } + // remove loot for the other faction (items are invisible for players, done in conditions), so corpse can be skinned + for( std::vector::iterator itr = me->loot.items.begin(); itr != me->loot.items.end(); ++itr ) + if( ItemTemplate const *iProto = sObjectMgr->GetItemTemplate((*itr).itemid) ) + if( ((iProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && plr->GetTeamId() != TEAM_HORDE) || ((iProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && plr->GetTeamId() != TEAM_ALLIANCE) ) + { + (*itr).count = 0; + (*itr).is_looted = true; + --me->loot.unlootedCount; + } + } + + void KilledUnit(Unit* who) + { + if( who->GetTypeId() == TYPEID_PLAYER ) + Talk(SAY_KILL_PLAYER); + } - void EnterEvadeMode() - { - events.Reset(); - summons.DespawnAll(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( pInstance ) - pInstance->SetData(TYPE_FAILED, 1); - } - - void MoveInLineOfSight(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER || me->GetExactDistSq(who) > 6400.0f) // 80yd*80yd - return; + void EnterEvadeMode() + { + events.Reset(); + summons.DespawnAll(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( pInstance ) + pInstance->SetData(TYPE_FAILED, 1); + } + + void MoveInLineOfSight(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER || me->GetExactDistSq(who) > 6400.0f) // 80yd*80yd + return; - if (me->getStandState() != UNIT_STAND_STATE_STAND) - me->SetStandState(UNIT_STAND_STATE_STAND); + if (me->getStandState() != UNIT_STAND_STATE_STAND) + me->SetStandState(UNIT_STAND_STATE_STAND); - if (!bIntro) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( !me->IsInCombat() ) - Talk(SAY_INTRO); - bIntro = true; - } - ScriptedAI::MoveInLineOfSight(who); - } + if (!bIntro) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( !me->IsInCombat() ) + Talk(SAY_INTRO); + bIntro = true; + } + ScriptedAI::MoveInLineOfSight(who); + } - bool CanAIAttack(const Unit* target) const - { - return target->GetEntry() != NPC_FROST_SPHERE; - } - }; + bool CanAIAttack(const Unit* target) const + { + return target->GetEntry() != NPC_FROST_SPHERE; + } + }; }; class npc_swarm_scarab : public CreatureScript { public: - npc_swarm_scarab() : CreatureScript("npc_swarm_scarab") {} + npc_swarm_scarab() : CreatureScript("npc_swarm_scarab") {} - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_swarm_scarabAI(pCreature); - }; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_swarm_scarabAI(pCreature); + }; - struct npc_swarm_scarabAI : public ScriptedAI - { - npc_swarm_scarabAI(Creature* pCreature) : ScriptedAI(pCreature) {} + struct npc_swarm_scarabAI : public ScriptedAI + { + npc_swarm_scarabAI(Creature* pCreature) : ScriptedAI(pCreature) {} - int32 determinationTimer; - int32 despawnTimer; + int32 determinationTimer; + int32 despawnTimer; - void DoAction(int32 param) - { - if( param == 1 ) - despawnTimer = 2000; - } + void DoAction(int32 param) + { + if( param == 1 ) + despawnTimer = 2000; + } - void Reset() - { - me->SetCorpseDelay(10*60); - me->CastSpell(me, SPELL_ACID_MANDIBLE, true); - determinationTimer = urand(10000,50000); - despawnTimer = 0; - if( me->getFaction() == 16 ) // hostile - it's phase 2 - if( Unit* target = me->SelectNearestTarget(250.0f) ) - { - AttackStart(target); - DoZoneInCombat(); - if( Unit* t = SelectTarget(SELECT_TARGET_RANDOM, 0, 250.0f, true) ) - { - me->AddThreat(t, 20000.0f); - AttackStart(t); - } - } - } + void Reset() + { + me->SetCorpseDelay(10*60); + me->CastSpell(me, SPELL_ACID_MANDIBLE, true); + determinationTimer = urand(10000,50000); + despawnTimer = 0; + if( me->getFaction() == 16 ) // hostile - it's phase 2 + if( Unit* target = me->SelectNearestTarget(250.0f) ) + { + AttackStart(target); + DoZoneInCombat(); + if( Unit* t = SelectTarget(SELECT_TARGET_RANDOM, 0, 250.0f, true) ) + { + me->AddThreat(t, 20000.0f); + AttackStart(t); + } + } + } - void EnterCombat(Unit* /*who*/) - { - DoZoneInCombat(); - } + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + } - void UpdateAI(uint32 diff) - { - if( despawnTimer ) - { - if( despawnTimer <= (int32)diff ) - { - despawnTimer = 0; - me->DisappearAndDie(); - } - else - despawnTimer -= diff; + void UpdateAI(uint32 diff) + { + if( despawnTimer ) + { + if( despawnTimer <= (int32)diff ) + { + despawnTimer = 0; + me->DisappearAndDie(); + } + else + despawnTimer -= diff; - return; - } + return; + } - if( !UpdateVictim() ) - return; + if( !UpdateVictim() ) + return; - if( determinationTimer <= (int32)diff ) - { - me->CastSpell(me, SPELL_DETERMINATION, false); - determinationTimer = urand(20000,60000); - } - else - determinationTimer -= diff; + if( determinationTimer <= (int32)diff ) + { + me->CastSpell(me, SPELL_DETERMINATION, false); + determinationTimer = urand(20000,60000); + } + else + determinationTimer -= diff; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* killer) - { - me->CastSpell(me, RAID_MODE(SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25, SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25), true); - me->m_Events.AddEvent(new HideNpcEvent(*me), me->m_Events.CalculateTime(5000)); - } + void JustDied(Unit* killer) + { + me->CastSpell(me, RAID_MODE(SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25, SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25), true); + me->m_Events.AddEvent(new HideNpcEvent(*me), me->m_Events.CalculateTime(5000)); + } - bool CanAIAttack(const Unit* target) const - { - return target->GetEntry() != NPC_FROST_SPHERE && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - }; + bool CanAIAttack(const Unit* target) const + { + return target->GetEntry() != NPC_FROST_SPHERE && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + }; }; class npc_frost_sphere : public CreatureScript { public: - npc_frost_sphere() : CreatureScript("npc_frost_sphere") { } + npc_frost_sphere() : CreatureScript("npc_frost_sphere") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_frost_sphereAI(pCreature); - }; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_frost_sphereAI(pCreature); + }; - struct npc_frost_sphereAI : public NullCreatureAI - { - npc_frost_sphereAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - uint32 ID = 0; - if (me->GetMap()) - switch (me->GetMap()->GetDifficulty()) - { - case RAID_DIFFICULTY_10MAN_NORMAL: ID = 66118; break; - case RAID_DIFFICULTY_25MAN_NORMAL: ID = 67630; break; - case RAID_DIFFICULTY_10MAN_HEROIC: ID = 68646; break; - case RAID_DIFFICULTY_25MAN_HEROIC: ID = 68647; break; - } - if (ID) - me->ApplySpellImmune(0, IMMUNITY_ID, ID, true); + struct npc_frost_sphereAI : public NullCreatureAI + { + npc_frost_sphereAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + uint32 ID = 0; + if (me->GetMap()) + switch (me->GetMap()->GetDifficulty()) + { + case RAID_DIFFICULTY_10MAN_NORMAL: ID = 66118; break; + case RAID_DIFFICULTY_25MAN_NORMAL: ID = 67630; break; + case RAID_DIFFICULTY_10MAN_HEROIC: ID = 68646; break; + case RAID_DIFFICULTY_25MAN_HEROIC: ID = 68647; break; + } + if (ID) + me->ApplySpellImmune(0, IMMUNITY_ID, ID, true); - permafrostTimer = 0; - me->CastSpell(me, SPELL_FROST_SPHERE, true); - me->GetMotionMaster()->MoveRandom(20.0f); - me->SetCorpseDelay(15*60*1000); - } + permafrostTimer = 0; + me->CastSpell(me, SPELL_FROST_SPHERE, true); + me->GetMotionMaster()->MoveRandom(20.0f); + me->SetCorpseDelay(15*60*1000); + } - uint32 permafrostTimer; + uint32 permafrostTimer; - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if( me->GetHealth() <= damage ) - { - damage = 0; - if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) ) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->GetMotionMaster()->MoveIdle(); - me->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), 143.0f, 20.0f); - permafrostTimer = 1500; - } - } - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if( me->GetHealth() <= damage ) + { + damage = 0; + if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) ) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->MoveIdle(); + me->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), 143.0f, 20.0f); + permafrostTimer = 1500; + } + } + } - void SpellHit(Unit* caster, const SpellInfo* spell) - { - if( spell->Id == SPELL_SPIKE_FAIL ) - { - me->RemoveAllAuras(); - me->DespawnOrUnsummon(1500); - } - } + void SpellHit(Unit* caster, const SpellInfo* spell) + { + if( spell->Id == SPELL_SPIKE_FAIL ) + { + me->RemoveAllAuras(); + me->DespawnOrUnsummon(1500); + } + } - void UpdateAI(uint32 diff) - { - if( permafrostTimer ) - { - if( permafrostTimer <= diff ) - { - permafrostTimer = 0; - me->RemoveAurasDueToSpell(SPELL_FROST_SPHERE); - me->SetDisplayId(11686); - me->SetObjectScale(2.0f); - me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), 142.7f, me->GetOrientation(), false); - me->SetFacingTo(me->GetOrientation()); - me->CastSpell(me, SPELL_PERMAFROST_VISUAL, true); - me->CastSpell(me, SPELL_PERMAFROST, true); - me->SetCanFly(false); - } - else - permafrostTimer -= diff; - } - } - }; + void UpdateAI(uint32 diff) + { + if( permafrostTimer ) + { + if( permafrostTimer <= diff ) + { + permafrostTimer = 0; + me->RemoveAurasDueToSpell(SPELL_FROST_SPHERE); + me->SetDisplayId(11686); + me->SetObjectScale(2.0f); + me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), 142.7f, me->GetOrientation(), false); + me->SetFacingTo(me->GetOrientation()); + me->CastSpell(me, SPELL_PERMAFROST_VISUAL, true); + me->CastSpell(me, SPELL_PERMAFROST, true); + me->SetCanFly(false); + } + else + permafrostTimer -= diff; + } + } + }; }; class npc_nerubian_burrower : public CreatureScript { public: - npc_nerubian_burrower() : CreatureScript("npc_nerubian_burrower") { } + npc_nerubian_burrower() : CreatureScript("npc_nerubian_burrower") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_nerubian_burrowerAI(pCreature); - }; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_nerubian_burrowerAI(pCreature); + }; - struct npc_nerubian_burrowerAI : public ScriptedAI - { - npc_nerubian_burrowerAI(Creature* pCreature) : ScriptedAI(pCreature) - { - // I am summoned by another npc (SPELL_EFFECT_FORCE_CAST), inform Anub'arak - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (uint64 guid = pInstance->GetData64(TYPE_ANUBARAK)) - if (Creature* anub = pInstance->instance->GetCreature(guid)) - CAST_AI(boss_anubarak_trial::boss_anubarak_trialAI, anub->AI())->JustSummoned(me); - } + struct npc_nerubian_burrowerAI : public ScriptedAI + { + npc_nerubian_burrowerAI(Creature* pCreature) : ScriptedAI(pCreature) + { + // I am summoned by another npc (SPELL_EFFECT_FORCE_CAST), inform Anub'arak + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (uint64 guid = pInstance->GetData64(TYPE_ANUBARAK)) + if (Creature* anub = pInstance->instance->GetCreature(guid)) + CAST_AI(boss_anubarak_trial::boss_anubarak_trialAI, anub->AI())->JustSummoned(me); + } - EventMap events; + EventMap events; - void Reset() - { - me->SetCorpseDelay(10*60); - me->CastSpell(me, SPELL_EXPOSE_WEAKNESS, true); - me->CastSpell(me, SPELL_SPIDER_FRENZY, true); - events.Reset(); - events.RescheduleEvent(EVENT_SUBMERGE, 30000); - if( IsHeroic() ) - events.RescheduleEvent(EVENT_SPELL_SHADOW_STRIKE, urand(30000,45000)); - if( Unit* target = me->SelectNearestTarget(250.0f) ) - { - AttackStart(target); - DoZoneInCombat(); - } - } + void Reset() + { + me->SetCorpseDelay(10*60); + me->CastSpell(me, SPELL_EXPOSE_WEAKNESS, true); + me->CastSpell(me, SPELL_SPIDER_FRENZY, true); + events.Reset(); + events.RescheduleEvent(EVENT_SUBMERGE, 30000); + if( IsHeroic() ) + events.RescheduleEvent(EVENT_SPELL_SHADOW_STRIKE, urand(30000,45000)); + if( Unit* target = me->SelectNearestTarget(250.0f) ) + { + AttackStart(target); + DoZoneInCombat(); + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if( !target || !spell ) - return; + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if( !target || !spell ) + return; - if( spell->Id == SPELL_SHADOW_STRIKE ) - { - float o = target->GetOrientation(); - if( o >= M_PI ) - o -= M_PI; - else - o += M_PI; - me->NearTeleportTo(target->GetPositionX()+cos(o)*5.0f, target->GetPositionY()+sin(o)*5.0f, target->GetPositionZ()+0.6f, target->GetOrientation()); - AttackStart(target); - me->GetMotionMaster()->MoveChase(target); - events.DelayEvents(3000); - } - } + if( spell->Id == SPELL_SHADOW_STRIKE ) + { + float o = target->GetOrientation(); + if( o >= M_PI ) + o -= M_PI; + else + o += M_PI; + me->NearTeleportTo(target->GetPositionX()+cos(o)*5.0f, target->GetPositionY()+sin(o)*5.0f, target->GetPositionZ()+0.6f, target->GetOrientation()); + AttackStart(target); + me->GetMotionMaster()->MoveChase(target); + events.DelayEvents(3000); + } + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_SHADOW_STRIKE: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250.0f, true) ) - me->CastSpell(target, SPELL_SHADOW_STRIKE, false); - events.RepeatEvent(urand(30000,45000)); - break; - case EVENT_SUBMERGE: - if( HealthBelowPct(80) && !me->HasAura(RAID_MODE(66193,67855,67856,67857)) ) // not having permafrost - allow submerge - { - me->GetMotionMaster()->MoveIdle(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveAllAuras(); - me->CastSpell(me, SPELL_EXPOSE_WEAKNESS, true); - me->CastSpell(me, SPELL_SPIDER_FRENZY, true); - me->CastSpell(me, SPELL_SUBMERGE, false); - events.PopEvent(); - events.DelayEvents(15000); - events.RescheduleEvent(EVENT_EMERGE, 10000); - } - else - events.RepeatEvent(3000); - break; - case EVENT_EMERGE: - me->SetHealth(me->GetMaxHealth()); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->CastSpell(me, SPELL_EMERGE, false); - me->RemoveAura(SPELL_SUBMERGE); - events.PopEvent(); - events.RescheduleEvent(EVENT_SUBMERGE, 30000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_SHADOW_STRIKE: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250.0f, true) ) + me->CastSpell(target, SPELL_SHADOW_STRIKE, false); + events.RepeatEvent(urand(30000,45000)); + break; + case EVENT_SUBMERGE: + if( HealthBelowPct(80) && !me->HasAura(RAID_MODE(66193,67855,67856,67857)) ) // not having permafrost - allow submerge + { + me->GetMotionMaster()->MoveIdle(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveAllAuras(); + me->CastSpell(me, SPELL_EXPOSE_WEAKNESS, true); + me->CastSpell(me, SPELL_SPIDER_FRENZY, true); + me->CastSpell(me, SPELL_SUBMERGE, false); + events.PopEvent(); + events.DelayEvents(15000); + events.RescheduleEvent(EVENT_EMERGE, 10000); + } + else + events.RepeatEvent(3000); + break; + case EVENT_EMERGE: + me->SetHealth(me->GetMaxHealth()); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->CastSpell(me, SPELL_EMERGE, false); + me->RemoveAura(SPELL_SUBMERGE); + events.PopEvent(); + events.RescheduleEvent(EVENT_SUBMERGE, 30000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* killer) - { - me->m_Events.AddEvent(new HideNpcEvent(*me), me->m_Events.CalculateTime(5000)); - } + void JustDied(Unit* killer) + { + me->m_Events.AddEvent(new HideNpcEvent(*me), me->m_Events.CalculateTime(5000)); + } - bool CanAIAttack(const Unit* target) const - { - return target->GetEntry() != NPC_FROST_SPHERE; - } - }; + bool CanAIAttack(const Unit* target) const + { + return target->GetEntry() != NPC_FROST_SPHERE; + } + }; }; class npc_anubarak_spike : public CreatureScript { public: - npc_anubarak_spike() : CreatureScript("npc_anubarak_spike") { } + npc_anubarak_spike() : CreatureScript("npc_anubarak_spike") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_anubarak_spikeAI(pCreature); - }; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_anubarak_spikeAI(pCreature); + }; - struct npc_anubarak_spikeAI : public ScriptedAI - { - npc_anubarak_spikeAI(Creature* pCreature) : ScriptedAI(pCreature) - { - me->SetReactState(REACT_PASSIVE); - me->SetCorpseDelay(0); - } + struct npc_anubarak_spikeAI : public ScriptedAI + { + npc_anubarak_spikeAI(Creature* pCreature) : ScriptedAI(pCreature) + { + me->SetReactState(REACT_PASSIVE); + me->SetCorpseDelay(0); + } - EventMap events; - uint64 TargetGUID; + EventMap events; + uint64 TargetGUID; - void DoAction(int32 param) - { - if( param == -1 ) - { - if( Unit* target = ObjectAccessor::GetPlayer(*me, TargetGUID) ) - target->RemoveAura(SPELL_MARK); - TargetGUID = 0; - me->RemoveAllAuras(); - me->GetMotionMaster()->MoveIdle(); - events.Reset(); - events.RescheduleEvent(3, 4000); - } - } + void DoAction(int32 param) + { + if( param == -1 ) + { + if( Unit* target = ObjectAccessor::GetPlayer(*me, TargetGUID) ) + target->RemoveAura(SPELL_MARK); + TargetGUID = 0; + me->RemoveAllAuras(); + me->GetMotionMaster()->MoveIdle(); + events.Reset(); + events.RescheduleEvent(3, 4000); + } + } - void SelectNewTarget(bool next) - { - if (TargetGUID) - if( Unit* target = ObjectAccessor::GetPlayer(*me, TargetGUID) ) - target->RemoveAura(SPELL_MARK); - TargetGUID = 0; - if (!next) - { - events.Reset(); - me->RemoveAllAuras(); - } - DoZoneInCombat(); - DoResetThreat(); - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250.0f, true) ) - { - if (!next) - { - me->CastSpell(me, SPELL_SPIKE_SPEED1, true); - me->CastSpell(me, SPELL_SPIKE_TRAIL, true); - events.RescheduleEvent(1, 7000); - } - TargetGUID = target->GetGUID(); - me->CastSpell(target, SPELL_MARK, true); - Talk(EMOTE_SPIKE, target); - AttackStart(target); - me->GetMotionMaster()->MoveChase(target); - } - } + void SelectNewTarget(bool next) + { + if (TargetGUID) + if( Unit* target = ObjectAccessor::GetPlayer(*me, TargetGUID) ) + target->RemoveAura(SPELL_MARK); + TargetGUID = 0; + if (!next) + { + events.Reset(); + me->RemoveAllAuras(); + } + DoZoneInCombat(); + DoResetThreat(); + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250.0f, true) ) + { + if (!next) + { + me->CastSpell(me, SPELL_SPIKE_SPEED1, true); + me->CastSpell(me, SPELL_SPIKE_TRAIL, true); + events.RescheduleEvent(1, 7000); + } + TargetGUID = target->GetGUID(); + me->CastSpell(target, SPELL_MARK, true); + Talk(EMOTE_SPIKE, target); + AttackStart(target); + me->GetMotionMaster()->MoveChase(target); + } + } - void Reset() - { - SelectNewTarget(false); - } + void Reset() + { + SelectNewTarget(false); + } - void UpdateAI(uint32 diff) - { - if( TargetGUID ) - { - Unit* target = ObjectAccessor::GetPlayer(*me, TargetGUID); - if( !target || !target->HasAura(SPELL_MARK) || !me->IsValidAttackTarget(target) || me->GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE || !me->HasUnitState(UNIT_STATE_CHASE_MOVE) ) - { - SelectNewTarget(true); - return; - } - } + void UpdateAI(uint32 diff) + { + if( TargetGUID ) + { + Unit* target = ObjectAccessor::GetPlayer(*me, TargetGUID); + if( !target || !target->HasAura(SPELL_MARK) || !me->IsValidAttackTarget(target) || me->GetMotionMaster()->GetCurrentMovementGeneratorType() != CHASE_MOTION_TYPE || !me->HasUnitState(UNIT_STATE_CHASE_MOVE) ) + { + SelectNewTarget(true); + return; + } + } - events.Update(diff); + events.Update(diff); - switch( events.GetEvent() ) - { - case 0: - break; - case 1: - me->CastSpell(me, SPELL_SPIKE_SPEED2, true); - events.PopEvent(); - events.RescheduleEvent(2, 7000); - break; - case 2: - me->CastSpell(me, SPELL_SPIKE_SPEED3, true); - events.PopEvent(); - break; - case 3: - Reset(); - break; - } - } + switch( events.GetEvent() ) + { + case 0: + break; + case 1: + me->CastSpell(me, SPELL_SPIKE_SPEED2, true); + events.PopEvent(); + events.RescheduleEvent(2, 7000); + break; + case 2: + me->CastSpell(me, SPELL_SPIKE_SPEED3, true); + events.PopEvent(); + break; + case 3: + Reset(); + break; + } + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - damage = 0; - } - }; + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + damage = 0; + } + }; }; class spell_pursuing_spikes : public SpellScriptLoader { - public: - spell_pursuing_spikes() : SpellScriptLoader("spell_pursuing_spikes") { } + public: + spell_pursuing_spikes() : SpellScriptLoader("spell_pursuing_spikes") { } - class spell_pursuing_spikesAuraScript : public AuraScript - { - PrepareAuraScript(spell_pursuing_spikesAuraScript) + class spell_pursuing_spikesAuraScript : public AuraScript + { + PrepareAuraScript(spell_pursuing_spikesAuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if( Unit* target = GetTarget() ) - { - if( Creature* c = target->FindNearestCreature(NPC_FROST_SPHERE, 8.0f, true) ) - { - target->UpdatePosition(*c, false); - target->CastCustomSpell(SPELL_SPIKE_FAIL, SPELLVALUE_MAX_TARGETS, 1); - if( target->GetTypeId() == TYPEID_UNIT ) - target->ToCreature()->AI()->DoAction(-1); - Remove(); - return; - } - target->CastSpell((Unit*)NULL, SPELL_IMPALE, true); - } - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if( Unit* target = GetTarget() ) + { + if( Creature* c = target->FindNearestCreature(NPC_FROST_SPHERE, 8.0f, true) ) + { + target->UpdatePosition(*c, false); + target->CastCustomSpell(SPELL_SPIKE_FAIL, SPELLVALUE_MAX_TARGETS, 1); + if( target->GetTypeId() == TYPEID_UNIT ) + target->ToCreature()->AI()->DoAction(-1); + Remove(); + return; + } + target->CastSpell((Unit*)NULL, SPELL_IMPALE, true); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_pursuing_spikesAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_pursuing_spikesAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_pursuing_spikesAuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_pursuing_spikesAuraScript(); + } }; // 66118 Leeching Swarm @@ -878,12 +878,12 @@ enum eLeechingSwarmSpells class spell_gen_leeching_swarm : public SpellScriptLoader { - public: - spell_gen_leeching_swarm() : SpellScriptLoader("spell_gen_leeching_swarm") { } + public: + spell_gen_leeching_swarm() : SpellScriptLoader("spell_gen_leeching_swarm") { } - class spell_gen_leeching_swarm_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_leeching_swarm_AuraScript); + class spell_gen_leeching_swarm_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_leeching_swarm_AuraScript); bool Validate(SpellInfo const* /*spellEntry*/) { @@ -894,71 +894,71 @@ class spell_gen_leeching_swarm : public SpellScriptLoader return true; } - void HandleEffectPeriodic(AuraEffect const* aurEff) - { - if (Unit* caster = GetCaster()) - { - int32 lifeLeeched = GetTarget()->CountPctFromCurHealth(aurEff->GetAmount()); - if (lifeLeeched < 250) - lifeLeeched = 250; - // Damage - caster->CastCustomSpell(GetTarget(), SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, true); - // Heal is handled in damage spell. It has to heal the same amount, but some of the dmg can be resisted. - } - } + void HandleEffectPeriodic(AuraEffect const* aurEff) + { + if (Unit* caster = GetCaster()) + { + int32 lifeLeeched = GetTarget()->CountPctFromCurHealth(aurEff->GetAmount()); + if (lifeLeeched < 250) + lifeLeeched = 250; + // Damage + caster->CastCustomSpell(GetTarget(), SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, true); + // Heal is handled in damage spell. It has to heal the same amount, but some of the dmg can be resisted. + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_leeching_swarm_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_leeching_swarm_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_gen_leeching_swarm_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_gen_leeching_swarm_AuraScript(); + } }; class spell_gen_leeching_swarm_dmg : public SpellScriptLoader { - public: - spell_gen_leeching_swarm_dmg() : SpellScriptLoader("spell_gen_leeching_swarm_dmg") {} + public: + spell_gen_leeching_swarm_dmg() : SpellScriptLoader("spell_gen_leeching_swarm_dmg") {} - class spell_gen_leeching_swarm_dmg_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_leeching_swarm_dmg_SpellScript); + class spell_gen_leeching_swarm_dmg_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_leeching_swarm_dmg_SpellScript); - void HandleAfterHit() - { - if (Unit* caster = GetCaster()) - if (GetHitDamage() > 0) - { - int32 damage = GetHitDamage(); - caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &damage, 0, 0, true); - } - } + void HandleAfterHit() + { + if (Unit* caster = GetCaster()) + if (GetHitDamage() > 0) + { + int32 damage = GetHitDamage(); + caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &damage, 0, 0, true); + } + } - void Register() - { - AfterHit += SpellHitFn(spell_gen_leeching_swarm_dmg_SpellScript::HandleAfterHit); - } - }; + void Register() + { + AfterHit += SpellHitFn(spell_gen_leeching_swarm_dmg_SpellScript::HandleAfterHit); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_gen_leeching_swarm_dmg_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_gen_leeching_swarm_dmg_SpellScript(); + } }; void AddSC_boss_anubarak_trial() { - new boss_anubarak_trial(); - new npc_swarm_scarab(); - new npc_frost_sphere(); - new npc_nerubian_burrower(); - new npc_anubarak_spike(); - new spell_pursuing_spikes(); + new boss_anubarak_trial(); + new npc_swarm_scarab(); + new npc_frost_sphere(); + new npc_nerubian_burrower(); + new npc_anubarak_spike(); + new spell_pursuing_spikes(); new spell_gen_leeching_swarm(); - new spell_gen_leeching_swarm_dmg(); + new spell_gen_leeching_swarm_dmg(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 5dbf2c0bb..f7f33122f 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -10,2454 +10,2454 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum eAIs { - AI_MELEE = 0, - AI_RANGED = 1, - AI_HEALER = 2, - AI_PET = 3, + AI_MELEE = 0, + AI_RANGED = 1, + AI_HEALER = 2, + AI_PET = 3, }; enum eSharedSpells { - SPELL_ANTI_AOE = 68595, - SPELL_PVP_TRINKET = 65547, + SPELL_ANTI_AOE = 68595, + SPELL_PVP_TRINKET = 65547, }; struct boss_faction_championsAI : public ScriptedAI { - boss_faction_championsAI(Creature* pCreature, uint32 aitype) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - me->SetReactState(REACT_PASSIVE); - mAIType = aitype; - threatTimer = 2000; - powerTimer = 1000; - } + boss_faction_championsAI(Creature* pCreature, uint32 aitype) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + me->SetReactState(REACT_PASSIVE); + mAIType = aitype; + threatTimer = 2000; + powerTimer = 1000; + } - InstanceScript* pInstance; - uint32 mAIType; - uint32 threatTimer; - uint32 powerTimer; + InstanceScript* pInstance; + uint32 mAIType; + uint32 threatTimer; + uint32 powerTimer; - void EnterCombat(Unit* /*who*/) - { - me->SetInCombatWithZone(); - RecalculateThreat(); - if( pInstance ) - pInstance->SetData(TYPE_FACTION_CHAMPIONS_START, 0); - } + void EnterCombat(Unit* /*who*/) + { + me->SetInCombatWithZone(); + RecalculateThreat(); + if( pInstance ) + pInstance->SetData(TYPE_FACTION_CHAMPIONS_START, 0); + } - void AttackStart(Unit* who) - { - if( !who ) - return; + void AttackStart(Unit* who) + { + if( !who ) + return; - if( mAIType == AI_MELEE || mAIType == AI_PET ) - UnitAI::AttackStart(who); - else - UnitAI::AttackStartCaster(who, 18.5f); - } + if( mAIType == AI_MELEE || mAIType == AI_PET ) + UnitAI::AttackStart(who); + else + UnitAI::AttackStartCaster(who, 18.5f); + } - float GetThreatMod(float dist, float armor, uint32 health, uint32 /*maxhealth*/, Unit* target) - { - /*float mod_health = ((float)health)/maxhealth; - if (mod_health < 0.4f) mod_health = 0.4f; - float unimportant_dist = (mAIType == AI_MELEE || mAIType == AI_PET ? 5.0f : 20.0f); - if (dist > unimportant_dist) - dist -= unimportant_dist; // compensate melee range - else - dist = 0.0f; - float mod_dist = 25.0f/(25.0f + dist); - float mod_armor = (mAIType == AI_MELEE || mAIType == AI_PET) ? armor / 16635.0f : 0.0f; - return mod_dist / ((0.15f+mod_armor)*mod_health);*/ + float GetThreatMod(float dist, float armor, uint32 health, uint32 /*maxhealth*/, Unit* target) + { + /*float mod_health = ((float)health)/maxhealth; + if (mod_health < 0.4f) mod_health = 0.4f; + float unimportant_dist = (mAIType == AI_MELEE || mAIType == AI_PET ? 5.0f : 20.0f); + if (dist > unimportant_dist) + dist -= unimportant_dist; // compensate melee range + else + dist = 0.0f; + float mod_dist = 25.0f/(25.0f + dist); + float mod_armor = (mAIType == AI_MELEE || mAIType == AI_PET) ? armor / 16635.0f : 0.0f; + return mod_dist / ((0.15f+mod_armor)*mod_health);*/ - // TC: + // TC: /*float dist_mod = (mAIType == AI_MELEE || mAIType == AI_PET) ? 15.0f / (15.0f + dist) : 1.0f; float armor_mod = (mAIType == AI_MELEE || mAIType == AI_PET) ? armor / 16635.0f : 0.0f; float eh = (health + 1) * (1.0f + armor_mod); return dist_mod * 30000.0f / eh;*/ - // third try: - float unimportant_dist = (mAIType == AI_MELEE || mAIType == AI_PET ? 5.0f : 35.0f); - if (dist > unimportant_dist) dist -= unimportant_dist; else dist = 0.0f; - const float dist_factor = (mAIType == AI_MELEE || mAIType == AI_PET ? 15.0f : 25.0f); - float mod_dist = dist_factor/(dist_factor + dist); // 0.2 .. 1.0 - float mod_health = health > 40000 ? 2.0f : (60000-health)/10000.0f; // 2.0 .. 6.0 - float mod_armor = (mAIType == AI_MELEE || mAIType == AI_PET) ? Unit::CalcArmorReducedDamage(me, target, 10000, NULL)/10000.0f : 1.0f; - return mod_dist * mod_health * mod_armor; - } + // third try: + float unimportant_dist = (mAIType == AI_MELEE || mAIType == AI_PET ? 5.0f : 35.0f); + if (dist > unimportant_dist) dist -= unimportant_dist; else dist = 0.0f; + const float dist_factor = (mAIType == AI_MELEE || mAIType == AI_PET ? 15.0f : 25.0f); + float mod_dist = dist_factor/(dist_factor + dist); // 0.2 .. 1.0 + float mod_health = health > 40000 ? 2.0f : (60000-health)/10000.0f; // 2.0 .. 6.0 + float mod_armor = (mAIType == AI_MELEE || mAIType == AI_PET) ? Unit::CalcArmorReducedDamage(me, target, 10000, NULL)/10000.0f : 1.0f; + return mod_dist * mod_health * mod_armor; + } - void RecalculateThreat() - { - ThreatContainer::StorageType const& tList = me->getThreatManager().getThreatList(); - for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr ) - { - Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); - if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->getThreatManager().getThreat(pUnit) ) - { - float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit); - me->getThreatManager().modifyThreatPercent(pUnit, -100); - //me->getThreatManager().doAddThreat(pUnit, 10000000.0f * threatMod); - if (HostileReference* ref = me->getThreatManager().getOnlineContainer().getReferenceByTarget(pUnit)) - ref->addThreat(10000000.0f * threatMod); - } - } - } + void RecalculateThreat() + { + ThreatContainer::StorageType const& tList = me->getThreatManager().getThreatList(); + for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr ) + { + Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); + if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->getThreatManager().getThreat(pUnit) ) + { + float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit); + me->getThreatManager().modifyThreatPercent(pUnit, -100); + //me->getThreatManager().doAddThreat(pUnit, 10000000.0f * threatMod); + if (HostileReference* ref = me->getThreatManager().getOnlineContainer().getReferenceByTarget(pUnit)) + ref->addThreat(10000000.0f * threatMod); + } + } + } - void EventMapGCD(EventMap &e, uint32 delay, uint32 gcd = 0) - { - e.DelayEventsToMax(delay, gcd); - } + void EventMapGCD(EventMap &e, uint32 delay, uint32 gcd = 0) + { + e.DelayEventsToMax(delay, gcd); + } - void JustDied(Unit* /*pKiller*/) - { - if( pInstance && mAIType != AI_PET ) - pInstance->SetData(TYPE_FACTION_CHAMPIONS, DONE); - } + void JustDied(Unit* /*pKiller*/) + { + if( pInstance && mAIType != AI_PET ) + pInstance->SetData(TYPE_FACTION_CHAMPIONS, DONE); + } - void KilledUnit(Unit* who) - { - if( pInstance ) - pInstance->SetData(TYPE_FACTION_CHAMPIONS_PLAYER_DIED, 1); - } + void KilledUnit(Unit* who) + { + if( pInstance ) + pInstance->SetData(TYPE_FACTION_CHAMPIONS_PLAYER_DIED, 1); + } - void EnterEvadeMode() - { - if( pInstance ) - pInstance->SetData(TYPE_FAILED, 0); - } + void EnterEvadeMode() + { + if( pInstance ) + pInstance->SetData(TYPE_FAILED, 0); + } - bool IsCCed() - { - // check for stun, fear, etc. - // for casting, silence, disarm check individually in the ai - if( me->isFeared() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED) ) - { - if( !IsHeroic() ) - return true; - if( me->HasSpellCooldown(SPELL_PVP_TRINKET) ) - return true; - else - { - me->CastSpell(me, SPELL_PVP_TRINKET, false); - me->AddSpellCooldown(SPELL_PVP_TRINKET, 0, 0); - } - } - return false; - } + bool IsCCed() + { + // check for stun, fear, etc. + // for casting, silence, disarm check individually in the ai + if( me->isFeared() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED) ) + { + if( !IsHeroic() ) + return true; + if( me->HasSpellCooldown(SPELL_PVP_TRINKET) ) + return true; + else + { + me->CastSpell(me, SPELL_PVP_TRINKET, false); + me->AddSpellCooldown(SPELL_PVP_TRINKET, 0, 0); + } + } + return false; + } - Creature* SelectTarget_MostHPLostFriendlyMissingBuff(uint32 spell, float range) - { - std::list lst = DoFindFriendlyMissingBuff(range, spell); - if( lst.empty() ) - return NULL; - std::list::const_iterator iter = lst.begin(); - uint32 lowestHP = (*iter)->GetMaxHealth() - (*iter)->GetHealth(); - for( std::list::const_iterator itr = lst.begin(); itr != lst.end(); ++itr ) - if( ((*itr)->GetMaxHealth() - (*itr)->GetHealth()) > lowestHP ) - { - iter = itr; - lowestHP = (*itr)->GetMaxHealth() - (*itr)->GetHealth(); - } - return (*iter); - } + Creature* SelectTarget_MostHPLostFriendlyMissingBuff(uint32 spell, float range) + { + std::list lst = DoFindFriendlyMissingBuff(range, spell); + if( lst.empty() ) + return NULL; + std::list::const_iterator iter = lst.begin(); + uint32 lowestHP = (*iter)->GetMaxHealth() - (*iter)->GetHealth(); + for( std::list::const_iterator itr = lst.begin(); itr != lst.end(); ++itr ) + if( ((*itr)->GetMaxHealth() - (*itr)->GetHealth()) > lowestHP ) + { + iter = itr; + lowestHP = (*itr)->GetMaxHealth() - (*itr)->GetHealth(); + } + return (*iter); + } - uint32 EnemiesInRange(float distance) - { - ThreatContainer::StorageType const& tList = me->getThreatManager().getThreatList(); - uint32 count = 0; - Unit *target; - for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter ) - { - target = ObjectAccessor::GetUnit((*me), (*iter)->getUnitGuid()); - if( target && me->GetDistance2d(target) < distance ) - ++count; - } - return count; - } + uint32 EnemiesInRange(float distance) + { + ThreatContainer::StorageType const& tList = me->getThreatManager().getThreatList(); + uint32 count = 0; + Unit *target; + for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter ) + { + target = ObjectAccessor::GetUnit((*me), (*iter)->getUnitGuid()); + if( target && me->GetDistance2d(target) < distance ) + ++count; + } + return count; + } - Unit* SelectEnemyCaster(bool casting, float range) - { - ThreatContainer::StorageType const& tList = me->getThreatManager().getThreatList(); - Unit *target; - for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter ) - { - target = ObjectAccessor::GetUnit((*me), (*iter)->getUnitGuid()); - if( target && target->getPowerType() == POWER_MANA && (!casting || target->HasUnitState(UNIT_STATE_CASTING)) && me->GetExactDist(target) <= range ) - return target; - } - return NULL; - } + Unit* SelectEnemyCaster(bool casting, float range) + { + ThreatContainer::StorageType const& tList = me->getThreatManager().getThreatList(); + Unit *target; + for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter ) + { + target = ObjectAccessor::GetUnit((*me), (*iter)->getUnitGuid()); + if( target && target->getPowerType() == POWER_MANA && (!casting || target->HasUnitState(UNIT_STATE_CASTING)) && me->GetExactDist(target) <= range ) + return target; + } + return NULL; + } - void UpdateAI(uint32 diff) - { - if (!me->IsInCombat()) - return; + void UpdateAI(uint32 diff) + { + if (!me->IsInCombat()) + return; - if( threatTimer <= diff ) - { - RecalculateThreat(); - threatTimer = urand(8750, 9250); - } - else - threatTimer -= diff; + if( threatTimer <= diff ) + { + RecalculateThreat(); + threatTimer = urand(8750, 9250); + } + else + threatTimer -= diff; - if( me->getPowerType() == POWER_MANA ) - { - if( powerTimer <= diff ) - { - me->ModifyPower(POWER_MANA, me->GetMaxPower(POWER_MANA)/3); - powerTimer = 4000; - } - else - powerTimer -= diff; - } - else if( me->getPowerType() == POWER_ENERGY ) - { - if( powerTimer <= diff ) - { - me->ModifyPower(POWER_ENERGY, me->GetMaxPower(POWER_ENERGY)/3); - powerTimer = 1000; - } - else - powerTimer -= diff; - } - } + if( me->getPowerType() == POWER_MANA ) + { + if( powerTimer <= diff ) + { + me->ModifyPower(POWER_MANA, me->GetMaxPower(POWER_MANA)/3); + powerTimer = 4000; + } + else + powerTimer -= diff; + } + else if( me->getPowerType() == POWER_ENERGY ) + { + if( powerTimer <= diff ) + { + me->ModifyPower(POWER_ENERGY, me->GetMaxPower(POWER_ENERGY)/3); + powerTimer = 1000; + } + else + powerTimer -= diff; + } + } }; enum eDruidSpells { - SPELL_LIFEBLOOM = 66093, - SPELL_NOURISH = 66066, - SPELL_REGROWTH = 66067, - SPELL_REJUVENATION = 66065, - SPELL_THORNS = 66068, - SPELL_TRANQUILITY = 66086, - SPELL_BARKSKIN = 65860, - SPELL_NATURE_GRASP = 66071, + SPELL_LIFEBLOOM = 66093, + SPELL_NOURISH = 66066, + SPELL_REGROWTH = 66067, + SPELL_REJUVENATION = 66065, + SPELL_THORNS = 66068, + SPELL_TRANQUILITY = 66086, + SPELL_BARKSKIN = 65860, + SPELL_NATURE_GRASP = 66071, }; enum eDruidEvents { - EVENT_SPELL_LIFEBLOOM = 1, - EVENT_SPELL_NOURISH, - EVENT_SPELL_REGROWTH, - EVENT_SPELL_REJUVENATION, - EVENT_SPELL_THORNS, - EVENT_SPELL_TRANQUILITY, - EVENT_SPELL_NATURE_GRASP, - EVENT_SPELL_BARKSKIN = 101, + EVENT_SPELL_LIFEBLOOM = 1, + EVENT_SPELL_NOURISH, + EVENT_SPELL_REGROWTH, + EVENT_SPELL_REJUVENATION, + EVENT_SPELL_THORNS, + EVENT_SPELL_TRANQUILITY, + EVENT_SPELL_NATURE_GRASP, + EVENT_SPELL_BARKSKIN = 101, }; class npc_toc_druid : public CreatureScript { public: - npc_toc_druid() : CreatureScript("npc_toc_druid") { } + npc_toc_druid() : CreatureScript("npc_toc_druid") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_druidAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_druidAI (pCreature); + } - struct npc_toc_druidAI : public boss_faction_championsAI - { - npc_toc_druidAI(Creature* pCreature) : boss_faction_championsAI(pCreature, AI_HEALER) - { - SetEquipmentSlots(false, 51799, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_LIFEBLOOM, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_NOURISH, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_REGROWTH, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_REJUVENATION, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_TRANQUILITY, urand(25000,40000)); - events.RescheduleEvent(EVENT_SPELL_BARKSKIN, 10000); - events.RescheduleEvent(EVENT_SPELL_THORNS, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_NATURE_GRASP, urand(5000,15000)); - } + struct npc_toc_druidAI : public boss_faction_championsAI + { + npc_toc_druidAI(Creature* pCreature) : boss_faction_championsAI(pCreature, AI_HEALER) + { + SetEquipmentSlots(false, 51799, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_LIFEBLOOM, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_NOURISH, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_REGROWTH, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_REJUVENATION, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_TRANQUILITY, urand(25000,40000)); + events.RescheduleEvent(EVENT_SPELL_BARKSKIN, 10000); + events.RescheduleEvent(EVENT_SPELL_THORNS, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_NATURE_GRASP, urand(5000,15000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_LIFEBLOOM: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_LIFEBLOOM, 40.0f) ) - me->CastSpell(target, SPELL_LIFEBLOOM, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_NOURISH: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_NOURISH, 40.0f) ) - me->CastSpell(target, SPELL_NOURISH, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_REGROWTH: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_REGROWTH, 40.0f) ) - me->CastSpell(target, SPELL_REGROWTH, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_REJUVENATION: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_REJUVENATION, 40.0f) ) - me->CastSpell(target, SPELL_REJUVENATION, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_THORNS: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_THORNS, 30.0f) ) - me->CastSpell(target, SPELL_THORNS, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_TRANQUILITY: - me->CastSpell(me, SPELL_TRANQUILITY, false); - events.RepeatEvent(urand(120000,180000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_BARKSKIN: - if( HealthBelowPct(50) ) - { - me->CastSpell(me, SPELL_BARKSKIN, false); - events.RepeatEvent(60000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_NATURE_GRASP: - me->CastSpell(me, SPELL_NATURE_GRASP, false); - events.RepeatEvent(60000); - EventMapGCD(events, 1500); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_LIFEBLOOM: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_LIFEBLOOM, 40.0f) ) + me->CastSpell(target, SPELL_LIFEBLOOM, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_NOURISH: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_NOURISH, 40.0f) ) + me->CastSpell(target, SPELL_NOURISH, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_REGROWTH: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_REGROWTH, 40.0f) ) + me->CastSpell(target, SPELL_REGROWTH, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_REJUVENATION: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_REJUVENATION, 40.0f) ) + me->CastSpell(target, SPELL_REJUVENATION, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_THORNS: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_THORNS, 30.0f) ) + me->CastSpell(target, SPELL_THORNS, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_TRANQUILITY: + me->CastSpell(me, SPELL_TRANQUILITY, false); + events.RepeatEvent(urand(120000,180000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_BARKSKIN: + if( HealthBelowPct(50) ) + { + me->CastSpell(me, SPELL_BARKSKIN, false); + events.RepeatEvent(60000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_NATURE_GRASP: + me->CastSpell(me, SPELL_NATURE_GRASP, false); + events.RepeatEvent(60000); + EventMapGCD(events, 1500); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eShamanSpells { - SPELL_HEALING_WAVE = 66055, - SPELL_RIPTIDE = 66053, - SPELL_SPIRIT_CLEANSE = 66056, - SPELL_HEROISM = 65983, - SPELL_BLOODLUST = 65980, - SPELL_HEX = 66054, - SPELL_EARTH_SHIELD = 66063, - SPELL_EARTH_SHOCK = 65973, - AURA_EXHAUSTION = 57723, - AURA_SATED = 57724, + SPELL_HEALING_WAVE = 66055, + SPELL_RIPTIDE = 66053, + SPELL_SPIRIT_CLEANSE = 66056, + SPELL_HEROISM = 65983, + SPELL_BLOODLUST = 65980, + SPELL_HEX = 66054, + SPELL_EARTH_SHIELD = 66063, + SPELL_EARTH_SHOCK = 65973, + AURA_EXHAUSTION = 57723, + AURA_SATED = 57724, }; enum eShamanEvents { - EVENT_SPELL_HEALING_WAVE = 1, - EVENT_SPELL_RIPTIDE, - EVENT_SPELL_SPIRIT_CLEANSE, - EVENT_SPELL_HEROISM_OR_BLOODLUST, - EVENT_SPELL_HEX, - EVENT_SPELL_EARTH_SHIELD, - EVENT_SPELL_EARTH_SHOCK, + EVENT_SPELL_HEALING_WAVE = 1, + EVENT_SPELL_RIPTIDE, + EVENT_SPELL_SPIRIT_CLEANSE, + EVENT_SPELL_HEROISM_OR_BLOODLUST, + EVENT_SPELL_HEX, + EVENT_SPELL_EARTH_SHIELD, + EVENT_SPELL_EARTH_SHOCK, }; class npc_toc_shaman : public CreatureScript { public: - npc_toc_shaman() : CreatureScript("npc_toc_shaman") { } + npc_toc_shaman() : CreatureScript("npc_toc_shaman") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_shamanAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_shamanAI (pCreature); + } - struct npc_toc_shamanAI : public boss_faction_championsAI - { - npc_toc_shamanAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_HEALER) - { - SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_HEALING_WAVE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_RIPTIDE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_SPIRIT_CLEANSE, urand(10000,15000)); - events.RescheduleEvent(EVENT_SPELL_HEROISM_OR_BLOODLUST, urand(25000,40000)); - events.RescheduleEvent(EVENT_SPELL_HEX, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_EARTH_SHIELD, urand(15000,25000)); - events.RescheduleEvent(EVENT_SPELL_EARTH_SHOCK, urand(3000,10000)); - } + struct npc_toc_shamanAI : public boss_faction_championsAI + { + npc_toc_shamanAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_HEALER) + { + SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_HEALING_WAVE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_RIPTIDE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_SPIRIT_CLEANSE, urand(10000,15000)); + events.RescheduleEvent(EVENT_SPELL_HEROISM_OR_BLOODLUST, urand(25000,40000)); + events.RescheduleEvent(EVENT_SPELL_HEX, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_EARTH_SHIELD, urand(15000,25000)); + events.RescheduleEvent(EVENT_SPELL_EARTH_SHOCK, urand(3000,10000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_HEALING_WAVE: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HEALING_WAVE, 40.0f) ) - me->CastSpell(target, SPELL_HEALING_WAVE, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_RIPTIDE: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_RIPTIDE, 40.0f) ) - me->CastSpell(target, SPELL_RIPTIDE, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_SPIRIT_CLEANSE: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_SPIRIT_CLEANSE, 40.0f) ) - me->CastSpell(target, SPELL_SPIRIT_CLEANSE, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_HEROISM_OR_BLOODLUST: - if( me->GetEntry() == NPC_ALLIANCE_SHAMAN_RESTORATION ) - me->CastSpell((Unit*)NULL, SPELL_HEROISM, true); - else - me->CastSpell((Unit*)NULL, SPELL_BLOODLUST, true); - events.RepeatEvent(600000); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_HEX: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true) ) - me->CastSpell(target, SPELL_HEX, false); - events.RepeatEvent(45000); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_EARTH_SHIELD: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_EARTH_SHIELD, 40.0f) ) - me->CastSpell(target, SPELL_EARTH_SHIELD, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_EARTH_SHOCK: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_EARTH_SHOCK, false); - events.RepeatEvent(urand(5000,10000)); - EventMapGCD(events, 1500); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_HEALING_WAVE: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HEALING_WAVE, 40.0f) ) + me->CastSpell(target, SPELL_HEALING_WAVE, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_RIPTIDE: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_RIPTIDE, 40.0f) ) + me->CastSpell(target, SPELL_RIPTIDE, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_SPIRIT_CLEANSE: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_SPIRIT_CLEANSE, 40.0f) ) + me->CastSpell(target, SPELL_SPIRIT_CLEANSE, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_HEROISM_OR_BLOODLUST: + if( me->GetEntry() == NPC_ALLIANCE_SHAMAN_RESTORATION ) + me->CastSpell((Unit*)NULL, SPELL_HEROISM, true); + else + me->CastSpell((Unit*)NULL, SPELL_BLOODLUST, true); + events.RepeatEvent(600000); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_HEX: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true) ) + me->CastSpell(target, SPELL_HEX, false); + events.RepeatEvent(45000); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_EARTH_SHIELD: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_EARTH_SHIELD, 40.0f) ) + me->CastSpell(target, SPELL_EARTH_SHIELD, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_EARTH_SHOCK: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_EARTH_SHOCK, false); + events.RepeatEvent(urand(5000,10000)); + EventMapGCD(events, 1500); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum ePaladinSpells { - SPELL_HAND_OF_FREEDOM = 68757, - SPELL_BUBBLE = 66010, - SPELL_CLEANSE = 66116, - SPELL_FLASH_OF_LIGHT = 66113, - SPELL_HOLY_LIGHT = 66112, - SPELL_HOLY_SHOCK = 66114, - SPELL_HAND_OF_PROTECTION = 66009, - SPELL_HAMMER_OF_JUSTICE = 66613, + SPELL_HAND_OF_FREEDOM = 68757, + SPELL_BUBBLE = 66010, + SPELL_CLEANSE = 66116, + SPELL_FLASH_OF_LIGHT = 66113, + SPELL_HOLY_LIGHT = 66112, + SPELL_HOLY_SHOCK = 66114, + SPELL_HAND_OF_PROTECTION = 66009, + SPELL_HAMMER_OF_JUSTICE = 66613, }; enum ePaladinEvents { - EVENT_SPELL_HAND_OF_FREEDOM = 1, - EVENT_SPELL_BUBBLE, - EVENT_SPELL_CLEANSE, - EVENT_SPELL_FLASH_OF_LIGHT, - EVENT_SPELL_HOLY_LIGHT, - EVENT_SPELL_HOLY_SHOCK, - EVENT_SPELL_HAND_OF_PROTECTION, - EVENT_SPELL_HAMMER_OF_JUSTICE, + EVENT_SPELL_HAND_OF_FREEDOM = 1, + EVENT_SPELL_BUBBLE, + EVENT_SPELL_CLEANSE, + EVENT_SPELL_FLASH_OF_LIGHT, + EVENT_SPELL_HOLY_LIGHT, + EVENT_SPELL_HOLY_SHOCK, + EVENT_SPELL_HAND_OF_PROTECTION, + EVENT_SPELL_HAMMER_OF_JUSTICE, }; class npc_toc_paladin : public CreatureScript { public: - npc_toc_paladin() : CreatureScript("npc_toc_paladin") { } + npc_toc_paladin() : CreatureScript("npc_toc_paladin") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_paladinAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_paladinAI (pCreature); + } - struct npc_toc_paladinAI : public boss_faction_championsAI - { - npc_toc_paladinAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_HEALER) - { - SetEquipmentSlots(false, 50771, 47079, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_HAND_OF_FREEDOM, urand(10000,15000)); - events.RescheduleEvent(EVENT_SPELL_BUBBLE, 10000); - events.RescheduleEvent(EVENT_SPELL_CLEANSE, urand(10000,15000)); - events.RescheduleEvent(EVENT_SPELL_FLASH_OF_LIGHT, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_HOLY_LIGHT, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_HOLY_SHOCK, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_HAND_OF_PROTECTION, urand(20000,35000)); - events.RescheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, urand(10000,20000)); - } + struct npc_toc_paladinAI : public boss_faction_championsAI + { + npc_toc_paladinAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_HEALER) + { + SetEquipmentSlots(false, 50771, 47079, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_HAND_OF_FREEDOM, urand(10000,15000)); + events.RescheduleEvent(EVENT_SPELL_BUBBLE, 10000); + events.RescheduleEvent(EVENT_SPELL_CLEANSE, urand(10000,15000)); + events.RescheduleEvent(EVENT_SPELL_FLASH_OF_LIGHT, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_HOLY_LIGHT, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_HOLY_SHOCK, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_HAND_OF_PROTECTION, urand(20000,35000)); + events.RescheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, urand(10000,20000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_HAND_OF_FREEDOM: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HAND_OF_FREEDOM, 30.0f) ) - me->CastSpell(target, SPELL_HAND_OF_FREEDOM, false); - events.RepeatEvent(25000); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_BUBBLE: - if( HealthBelowPct(25) ) - { - me->CastSpell(me, SPELL_BUBBLE, false); - events.RepeatEvent(300000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(10000); - break; - case EVENT_SPELL_CLEANSE: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_CLEANSE, 40.0f) ) - me->CastSpell(target, SPELL_CLEANSE, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_FLASH_OF_LIGHT: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_FLASH_OF_LIGHT, 40.0f) ) - me->CastSpell(target, SPELL_FLASH_OF_LIGHT, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_HOLY_LIGHT: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HOLY_LIGHT, 40.0f) ) - me->CastSpell(target, SPELL_HOLY_LIGHT, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_HOLY_SHOCK: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HOLY_SHOCK, 40.0f) ) - me->CastSpell(target, SPELL_HOLY_SHOCK, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_HAND_OF_PROTECTION: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HAND_OF_PROTECTION, 40.0f) ) - { - me->CastSpell(target, SPELL_HAND_OF_PROTECTION, false); - events.RepeatEvent(300000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(10000); - break; - case EVENT_SPELL_HAMMER_OF_JUSTICE: - if( Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 15.0f, true) ) - { - me->CastSpell(target, SPELL_HAMMER_OF_JUSTICE, false); - events.RepeatEvent(40000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(10000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_HAND_OF_FREEDOM: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HAND_OF_FREEDOM, 30.0f) ) + me->CastSpell(target, SPELL_HAND_OF_FREEDOM, false); + events.RepeatEvent(25000); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_BUBBLE: + if( HealthBelowPct(25) ) + { + me->CastSpell(me, SPELL_BUBBLE, false); + events.RepeatEvent(300000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(10000); + break; + case EVENT_SPELL_CLEANSE: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_CLEANSE, 40.0f) ) + me->CastSpell(target, SPELL_CLEANSE, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_FLASH_OF_LIGHT: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_FLASH_OF_LIGHT, 40.0f) ) + me->CastSpell(target, SPELL_FLASH_OF_LIGHT, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_HOLY_LIGHT: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HOLY_LIGHT, 40.0f) ) + me->CastSpell(target, SPELL_HOLY_LIGHT, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_HOLY_SHOCK: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HOLY_SHOCK, 40.0f) ) + me->CastSpell(target, SPELL_HOLY_SHOCK, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_HAND_OF_PROTECTION: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HAND_OF_PROTECTION, 40.0f) ) + { + me->CastSpell(target, SPELL_HAND_OF_PROTECTION, false); + events.RepeatEvent(300000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(10000); + break; + case EVENT_SPELL_HAMMER_OF_JUSTICE: + if( Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 15.0f, true) ) + { + me->CastSpell(target, SPELL_HAMMER_OF_JUSTICE, false); + events.RepeatEvent(40000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(10000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum ePriestSpells { - SPELL_RENEW = 66177, - SPELL_SHIELD = 66099, - SPELL_FLASH_HEAL = 66104, - SPELL_DISPEL = 65546, - SPELL_MANA_BURN = 66100, - SPELL_PSYCHIC_SCREAM = 65543, + SPELL_RENEW = 66177, + SPELL_SHIELD = 66099, + SPELL_FLASH_HEAL = 66104, + SPELL_DISPEL = 65546, + SPELL_MANA_BURN = 66100, + SPELL_PSYCHIC_SCREAM = 65543, }; enum ePriestEvents { - EVENT_SPELL_RENEW = 1, - EVENT_SPELL_SHIELD, - EVENT_SPELL_FLASH_HEAL, - EVENT_SPELL_MANA_BURN, - EVENT_SPELL_DISPEL = 100, - EVENT_SPELL_PSYCHIC_SCREAM = 101, + EVENT_SPELL_RENEW = 1, + EVENT_SPELL_SHIELD, + EVENT_SPELL_FLASH_HEAL, + EVENT_SPELL_MANA_BURN, + EVENT_SPELL_DISPEL = 100, + EVENT_SPELL_PSYCHIC_SCREAM = 101, }; class npc_toc_priest : public CreatureScript { public: - npc_toc_priest() : CreatureScript("npc_toc_priest") { } + npc_toc_priest() : CreatureScript("npc_toc_priest") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_priestAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_priestAI (pCreature); + } - struct npc_toc_priestAI : public boss_faction_championsAI - { - npc_toc_priestAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_HEALER) - { - SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_RENEW, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_SHIELD, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_FLASH_HEAL, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_DISPEL, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_MANA_BURN, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_PSYCHIC_SCREAM, 10000); - } + struct npc_toc_priestAI : public boss_faction_championsAI + { + npc_toc_priestAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_HEALER) + { + SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_RENEW, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_SHIELD, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_FLASH_HEAL, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_DISPEL, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_MANA_BURN, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_PSYCHIC_SCREAM, 10000); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_RENEW: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_RENEW, 40.0f) ) - me->CastSpell(target, SPELL_RENEW, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_SHIELD: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_SHIELD, 40.0f) ) - me->CastSpell(target, SPELL_SHIELD, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_FLASH_HEAL: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_FLASH_HEAL, 40.0f) ) - me->CastSpell(target, SPELL_FLASH_HEAL, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_DISPEL: - if( Unit* target = (urand(0,1) ? SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 30.0f, true) : SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_DISPEL, 40.0f)) ) - me->CastSpell(target, SPELL_DISPEL, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_MANA_BURN: - if( Unit* target = SelectEnemyCaster(false, 30.0f) ) - { - me->CastSpell(target, SPELL_MANA_BURN, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_PSYCHIC_SCREAM: - if( HealthBelowPct(50) && EnemiesInRange(8.0f) >= 3 ) - { - me->CastSpell((Unit*)NULL, SPELL_PSYCHIC_SCREAM, false); - events.RepeatEvent(30000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_RENEW: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_RENEW, 40.0f) ) + me->CastSpell(target, SPELL_RENEW, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_SHIELD: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_SHIELD, 40.0f) ) + me->CastSpell(target, SPELL_SHIELD, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_FLASH_HEAL: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_FLASH_HEAL, 40.0f) ) + me->CastSpell(target, SPELL_FLASH_HEAL, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_DISPEL: + if( Unit* target = (urand(0,1) ? SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 30.0f, true) : SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_DISPEL, 40.0f)) ) + me->CastSpell(target, SPELL_DISPEL, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_MANA_BURN: + if( Unit* target = SelectEnemyCaster(false, 30.0f) ) + { + me->CastSpell(target, SPELL_MANA_BURN, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_PSYCHIC_SCREAM: + if( HealthBelowPct(50) && EnemiesInRange(8.0f) >= 3 ) + { + me->CastSpell((Unit*)NULL, SPELL_PSYCHIC_SCREAM, false); + events.RepeatEvent(30000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eShadowPriestSpells { - SPELL_SILENCE = 65542, - SPELL_VAMPIRIC_TOUCH = 65490, - SPELL_SW_PAIN = 65541, - SPELL_MIND_FLAY = 65488, - SPELL_MIND_BLAST = 65492, - SPELL_HORROR = 65545, - SPELL_DISPERSION = 65544, - SPELL_SHADOWFORM = 16592, + SPELL_SILENCE = 65542, + SPELL_VAMPIRIC_TOUCH = 65490, + SPELL_SW_PAIN = 65541, + SPELL_MIND_FLAY = 65488, + SPELL_MIND_BLAST = 65492, + SPELL_HORROR = 65545, + SPELL_DISPERSION = 65544, + SPELL_SHADOWFORM = 16592, }; enum eShadowPriestEvents { - EVENT_SPELL_SILENCE = 1, - EVENT_SPELL_VAMPIRIC_TOUCH, - EVENT_SPELL_SW_PAIN, - EVENT_SPELL_MIND_FLAY, - EVENT_SPELL_MIND_BLAST, - EVENT_SPELL_HORROR, - EVENT_SPELL_DISPERSION, + EVENT_SPELL_SILENCE = 1, + EVENT_SPELL_VAMPIRIC_TOUCH, + EVENT_SPELL_SW_PAIN, + EVENT_SPELL_MIND_FLAY, + EVENT_SPELL_MIND_BLAST, + EVENT_SPELL_HORROR, + EVENT_SPELL_DISPERSION, }; class npc_toc_shadow_priest : public CreatureScript { public: - npc_toc_shadow_priest() : CreatureScript("npc_toc_shadow_priest") {} + npc_toc_shadow_priest() : CreatureScript("npc_toc_shadow_priest") {} - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_shadow_priestAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_shadow_priestAI (pCreature); + } - struct npc_toc_shadow_priestAI : public boss_faction_championsAI - { - npc_toc_shadow_priestAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_RANGED) - { - SetEquipmentSlots(false, 50040, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_SILENCE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_VAMPIRIC_TOUCH, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_SW_PAIN, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_MIND_FLAY, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_MIND_BLAST, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_HORROR, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_DISPERSION, 10000); - events.RescheduleEvent(EVENT_SPELL_DISPEL, urand(5000,10000)); - events.RescheduleEvent(EVENT_SPELL_PSYCHIC_SCREAM, 10000); - } + struct npc_toc_shadow_priestAI : public boss_faction_championsAI + { + npc_toc_shadow_priestAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_RANGED) + { + SetEquipmentSlots(false, 50040, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_SILENCE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_VAMPIRIC_TOUCH, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_SW_PAIN, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_MIND_FLAY, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_MIND_BLAST, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_HORROR, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_DISPERSION, 10000); + events.RescheduleEvent(EVENT_SPELL_DISPEL, urand(5000,10000)); + events.RescheduleEvent(EVENT_SPELL_PSYCHIC_SCREAM, 10000); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_SILENCE: - if( Unit* target = SelectEnemyCaster(false, 30.0f) ) - { - me->CastSpell(target, SPELL_SILENCE, false); - events.RepeatEvent(45000); - EventMapGCD(events, 1500); - break; - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_VAMPIRIC_TOUCH: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_VAMPIRIC_TOUCH, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_SW_PAIN: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_SW_PAIN, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_MIND_FLAY: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_MIND_FLAY, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_MIND_BLAST: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_MIND_BLAST, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_HORROR: - if( me->GetVictim() && me->GetExactDist2d(me->GetVictim()) <= 30.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_HORROR, false); - events.RepeatEvent(120000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(10000); - break; - case EVENT_SPELL_DISPERSION: - if( HealthBelowPct(25) ) - { - me->CastSpell(me, SPELL_DISPERSION, false); - events.RepeatEvent(180000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_DISPEL: - if( Unit* target = (urand(0,1) ? SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 30.0f, true) : SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_DISPEL, 40.0f)) ) - me->CastSpell(target, SPELL_DISPEL, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_PSYCHIC_SCREAM: - if( EnemiesInRange(8.0f) >= 3 ) - { - me->CastSpell((Unit*)NULL, SPELL_PSYCHIC_SCREAM, false); - events.RepeatEvent(30000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_SILENCE: + if( Unit* target = SelectEnemyCaster(false, 30.0f) ) + { + me->CastSpell(target, SPELL_SILENCE, false); + events.RepeatEvent(45000); + EventMapGCD(events, 1500); + break; + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_VAMPIRIC_TOUCH: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_VAMPIRIC_TOUCH, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_SW_PAIN: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_SW_PAIN, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_MIND_FLAY: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_MIND_FLAY, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_MIND_BLAST: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_MIND_BLAST, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_HORROR: + if( me->GetVictim() && me->GetExactDist2d(me->GetVictim()) <= 30.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_HORROR, false); + events.RepeatEvent(120000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(10000); + break; + case EVENT_SPELL_DISPERSION: + if( HealthBelowPct(25) ) + { + me->CastSpell(me, SPELL_DISPERSION, false); + events.RepeatEvent(180000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_DISPEL: + if( Unit* target = (urand(0,1) ? SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 30.0f, true) : SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_DISPEL, 40.0f)) ) + me->CastSpell(target, SPELL_DISPEL, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_PSYCHIC_SCREAM: + if( EnemiesInRange(8.0f) >= 3 ) + { + me->CastSpell((Unit*)NULL, SPELL_PSYCHIC_SCREAM, false); + events.RepeatEvent(30000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eWarlockSpells { - SPELL_HELLFIRE = 65816, - SPELL_CORRUPTION = 65810, - SPELL_CURSE_OF_AGONY = 65814, - SPELL_CURSE_OF_EXHAUSTION = 65815, - SPELL_FEAR = 65809, - SPELL_SEARING_PAIN = 65819, - SPELL_SHADOW_BOLT = 65821, - SPELL_UNSTABLE_AFFLICTION = 65812, - SPELL_UNSTABLE_AFFLICTION_DISPEL = 65813, - SPELL_SUMMON_FELHUNTER = 67514, + SPELL_HELLFIRE = 65816, + SPELL_CORRUPTION = 65810, + SPELL_CURSE_OF_AGONY = 65814, + SPELL_CURSE_OF_EXHAUSTION = 65815, + SPELL_FEAR = 65809, + SPELL_SEARING_PAIN = 65819, + SPELL_SHADOW_BOLT = 65821, + SPELL_UNSTABLE_AFFLICTION = 65812, + SPELL_UNSTABLE_AFFLICTION_DISPEL = 65813, + SPELL_SUMMON_FELHUNTER = 67514, }; enum eWarlockEvents { - EVENT_SPELL_HELLFIRE = 1, - EVENT_SPELL_CORRUPTION, - EVENT_SPELL_CURSE_OF_AGONY, - EVENT_SPELL_CURSE_OF_EXHAUSTION, - EVENT_SPELL_FEAR, - EVENT_SPELL_SEARING_PAIN, - EVENT_SPELL_SHADOW_BOLT, - EVENT_SPELL_UNSTABLE_AFFLICTION, - EVENT_SPELL_SUMMON_FELHUNTER, + EVENT_SPELL_HELLFIRE = 1, + EVENT_SPELL_CORRUPTION, + EVENT_SPELL_CURSE_OF_AGONY, + EVENT_SPELL_CURSE_OF_EXHAUSTION, + EVENT_SPELL_FEAR, + EVENT_SPELL_SEARING_PAIN, + EVENT_SPELL_SHADOW_BOLT, + EVENT_SPELL_UNSTABLE_AFFLICTION, + EVENT_SPELL_SUMMON_FELHUNTER, }; class npc_toc_warlock : public CreatureScript { public: - npc_toc_warlock() : CreatureScript("npc_toc_warlock") { } + npc_toc_warlock() : CreatureScript("npc_toc_warlock") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_warlockAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_warlockAI (pCreature); + } - struct npc_toc_warlockAI : public boss_faction_championsAI - { - npc_toc_warlockAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_RANGED) - { - SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_HELLFIRE, 10000); - events.RescheduleEvent(EVENT_SPELL_CORRUPTION, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_CURSE_OF_AGONY, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_CURSE_OF_EXHAUSTION, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_FEAR, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_SEARING_PAIN, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_SHADOW_BOLT, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_UNSTABLE_AFFLICTION, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_SUMMON_FELHUNTER, 0); - } + struct npc_toc_warlockAI : public boss_faction_championsAI + { + npc_toc_warlockAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_RANGED) + { + SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_HELLFIRE, 10000); + events.RescheduleEvent(EVENT_SPELL_CORRUPTION, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_CURSE_OF_AGONY, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_CURSE_OF_EXHAUSTION, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_FEAR, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_SEARING_PAIN, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_SHADOW_BOLT, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_UNSTABLE_AFFLICTION, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_SUMMON_FELHUNTER, 0); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); + } - void JustSummoned(Creature* c) - { - if( Unit* target = c->SelectNearestTarget(200.0f) ) - c->AI()->AttackStart(target); - } + void JustSummoned(Creature* c) + { + if( Unit* target = c->SelectNearestTarget(200.0f) ) + c->AI()->AttackStart(target); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_SUMMON_FELHUNTER: - DoSummon(35465, *me); - events.PopEvent(); - break; - case EVENT_SPELL_HELLFIRE: - if( EnemiesInRange(9.0f) >= 3 ) - { - me->CastSpell((Unit*)NULL, SPELL_HELLFIRE, false); - events.RepeatEvent(30000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_CORRUPTION: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_CORRUPTION, false); - events.RepeatEvent(urand(10000,20000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_CURSE_OF_AGONY: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_CURSE_OF_AGONY, false); - events.RepeatEvent(urand(10000,20000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_CURSE_OF_EXHAUSTION: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_CURSE_OF_EXHAUSTION, false); - events.RepeatEvent(urand(10000,20000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_FEAR: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true) ) - me->CastSpell(target, SPELL_FEAR, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_SEARING_PAIN: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_SEARING_PAIN, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_SHADOW_BOLT: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_UNSTABLE_AFFLICTION: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_UNSTABLE_AFFLICTION, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_SUMMON_FELHUNTER: + DoSummon(35465, *me); + events.PopEvent(); + break; + case EVENT_SPELL_HELLFIRE: + if( EnemiesInRange(9.0f) >= 3 ) + { + me->CastSpell((Unit*)NULL, SPELL_HELLFIRE, false); + events.RepeatEvent(30000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_CORRUPTION: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_CORRUPTION, false); + events.RepeatEvent(urand(10000,20000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_CURSE_OF_AGONY: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_CURSE_OF_AGONY, false); + events.RepeatEvent(urand(10000,20000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_CURSE_OF_EXHAUSTION: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_CURSE_OF_EXHAUSTION, false); + events.RepeatEvent(urand(10000,20000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_FEAR: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true) ) + me->CastSpell(target, SPELL_FEAR, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_SEARING_PAIN: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_SEARING_PAIN, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_SHADOW_BOLT: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_UNSTABLE_AFFLICTION: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_UNSTABLE_AFFLICTION, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eMageSpells { - SPELL_ARCANE_BARRAGE = 65799, - SPELL_ARCANE_BLAST = 65791, - SPELL_ARCANE_EXPLOSION = 65800, - SPELL_BLINK = 65793, - SPELL_COUNTERSPELL = 65790, - SPELL_FROST_NOVA = 65792, - SPELL_FROSTBOLT = 65807, - SPELL_ICE_BLOCK = 65802, - SPELL_POLYMORPH = 65801, + SPELL_ARCANE_BARRAGE = 65799, + SPELL_ARCANE_BLAST = 65791, + SPELL_ARCANE_EXPLOSION = 65800, + SPELL_BLINK = 65793, + SPELL_COUNTERSPELL = 65790, + SPELL_FROST_NOVA = 65792, + SPELL_FROSTBOLT = 65807, + SPELL_ICE_BLOCK = 65802, + SPELL_POLYMORPH = 65801, }; enum eMageEvents { - EVENT_SPELL_ARCANE_BARRAGE = 1, - EVENT_SPELL_ARCANE_BLAST, - EVENT_SPELL_ARCANE_EXPLOSION, - EVENT_SPELL_BLINK, - EVENT_SPELL_BLINK_2, - EVENT_SPELL_COUNTERSPELL, - EVENT_SPELL_FROSTBOLT, - EVENT_SPELL_ICE_BLOCK, - EVENT_SPELL_POLYMORPH, + EVENT_SPELL_ARCANE_BARRAGE = 1, + EVENT_SPELL_ARCANE_BLAST, + EVENT_SPELL_ARCANE_EXPLOSION, + EVENT_SPELL_BLINK, + EVENT_SPELL_BLINK_2, + EVENT_SPELL_COUNTERSPELL, + EVENT_SPELL_FROSTBOLT, + EVENT_SPELL_ICE_BLOCK, + EVENT_SPELL_POLYMORPH, }; class npc_toc_mage : public CreatureScript { public: - npc_toc_mage() : CreatureScript("npc_toc_mage") { } + npc_toc_mage() : CreatureScript("npc_toc_mage") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_mageAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_mageAI (pCreature); + } - struct npc_toc_mageAI : public boss_faction_championsAI - { - npc_toc_mageAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_RANGED) - { - SetEquipmentSlots(false, 47524, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_ARCANE_BARRAGE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_ARCANE_BLAST, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_ARCANE_EXPLOSION, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_BLINK, 10000); - events.RescheduleEvent(EVENT_SPELL_COUNTERSPELL, urand(10000,20000)); - events.RescheduleEvent(EVENT_SPELL_FROSTBOLT, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_ICE_BLOCK, 10000); - events.RescheduleEvent(EVENT_SPELL_POLYMORPH, urand(5000,10000)); - } + struct npc_toc_mageAI : public boss_faction_championsAI + { + npc_toc_mageAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_RANGED) + { + SetEquipmentSlots(false, 47524, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_ARCANE_BARRAGE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_ARCANE_BLAST, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_ARCANE_EXPLOSION, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_BLINK, 10000); + events.RescheduleEvent(EVENT_SPELL_COUNTERSPELL, urand(10000,20000)); + events.RescheduleEvent(EVENT_SPELL_FROSTBOLT, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_ICE_BLOCK, 10000); + events.RescheduleEvent(EVENT_SPELL_POLYMORPH, urand(5000,10000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_ARCANE_BARRAGE: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_ARCANE_BARRAGE, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_ARCANE_BLAST: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_ARCANE_BLAST, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_ARCANE_EXPLOSION: - if( EnemiesInRange(9.0f) >= 3 ) - { - me->CastSpell((Unit*)NULL, SPELL_ARCANE_EXPLOSION, false); - events.RepeatEvent(6000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_BLINK: - if( HealthBelowPct(50) && EnemiesInRange(10.0f) >= 3 ) - { - me->CastSpell((Unit*)NULL, SPELL_FROST_NOVA, false); - events.RepeatEvent(15000); - EventMapGCD(events, 1500); - // blink disabled, fucking movement shit not working - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_COUNTERSPELL: - if( Unit* target = SelectEnemyCaster(true, 30.0f) ) - { - me->CastSpell(target, SPELL_COUNTERSPELL, false); - events.RepeatEvent(24000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_FROSTBOLT: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_FROSTBOLT, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_ICE_BLOCK: - if( HealthBelowPct(25) ) - { - me->CastSpell(me, SPELL_ICE_BLOCK, false); - events.RepeatEvent(300000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_POLYMORPH: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) - me->CastSpell(target, SPELL_POLYMORPH, false); - events.RepeatEvent(15000); - EventMapGCD(events, 1500); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_ARCANE_BARRAGE: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_ARCANE_BARRAGE, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_ARCANE_BLAST: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_ARCANE_BLAST, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_ARCANE_EXPLOSION: + if( EnemiesInRange(9.0f) >= 3 ) + { + me->CastSpell((Unit*)NULL, SPELL_ARCANE_EXPLOSION, false); + events.RepeatEvent(6000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_BLINK: + if( HealthBelowPct(50) && EnemiesInRange(10.0f) >= 3 ) + { + me->CastSpell((Unit*)NULL, SPELL_FROST_NOVA, false); + events.RepeatEvent(15000); + EventMapGCD(events, 1500); + // blink disabled, fucking movement shit not working + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_COUNTERSPELL: + if( Unit* target = SelectEnemyCaster(true, 30.0f) ) + { + me->CastSpell(target, SPELL_COUNTERSPELL, false); + events.RepeatEvent(24000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_FROSTBOLT: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_FROSTBOLT, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_ICE_BLOCK: + if( HealthBelowPct(25) ) + { + me->CastSpell(me, SPELL_ICE_BLOCK, false); + events.RepeatEvent(300000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_POLYMORPH: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) + me->CastSpell(target, SPELL_POLYMORPH, false); + events.RepeatEvent(15000); + EventMapGCD(events, 1500); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eHunterSpells { - SPELL_AIMED_SHOT = 65883, - SPELL_DETERRENCE = 65871, - SPELL_DISENGAGE = 65870, - SPELL_EXPLOSIVE_SHOT = 65866, - SPELL_FROST_TRAP = 65880, - SPELL_SHOOT = 65868, - SPELL_STEADY_SHOT = 65867, - SPELL_WING_CLIP = 66207, - SPELL_WYVERN_STING = 65877, - SPELL_CALL_PET = 67777, + SPELL_AIMED_SHOT = 65883, + SPELL_DETERRENCE = 65871, + SPELL_DISENGAGE = 65870, + SPELL_EXPLOSIVE_SHOT = 65866, + SPELL_FROST_TRAP = 65880, + SPELL_SHOOT = 65868, + SPELL_STEADY_SHOT = 65867, + SPELL_WING_CLIP = 66207, + SPELL_WYVERN_STING = 65877, + SPELL_CALL_PET = 67777, }; enum eHunterEvents { - EVENT_SPELL_AIMED_SHOT = 1, - EVENT_SPELL_DETERRENCE, - EVENT_SPELL_DISENGAGE, - EVENT_SPELL_EXPLOSIVE_SHOT, - EVENT_SPELL_FROST_TRAP, - EVENT_SPELL_STEADY_SHOT, - EVENT_SPELL_WING_CLIP, - EVENT_SPELL_WYVERN_STING, - EVENT_SPELL_CALL_PET, + EVENT_SPELL_AIMED_SHOT = 1, + EVENT_SPELL_DETERRENCE, + EVENT_SPELL_DISENGAGE, + EVENT_SPELL_EXPLOSIVE_SHOT, + EVENT_SPELL_FROST_TRAP, + EVENT_SPELL_STEADY_SHOT, + EVENT_SPELL_WING_CLIP, + EVENT_SPELL_WYVERN_STING, + EVENT_SPELL_CALL_PET, }; class npc_toc_hunter : public CreatureScript { public: - npc_toc_hunter() : CreatureScript("npc_toc_hunter") { } + npc_toc_hunter() : CreatureScript("npc_toc_hunter") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_hunterAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_hunterAI (pCreature); + } - struct npc_toc_hunterAI : public boss_faction_championsAI - { - npc_toc_hunterAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_RANGED) - { - SetEquipmentSlots(false, 47156, EQUIP_NO_CHANGE, 48711); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_AIMED_SHOT, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_DETERRENCE, 10000); - //events.RescheduleEvent(EVENT_SPELL_DISENGAGE, 10000); - events.RescheduleEvent(EVENT_SPELL_EXPLOSIVE_SHOT, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_FROST_TRAP, urand(15000,20000)); - events.RescheduleEvent(EVENT_SPELL_STEADY_SHOT, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_WING_CLIP, 10000); - events.RescheduleEvent(EVENT_SPELL_WYVERN_STING, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_CALL_PET, 0); - } + struct npc_toc_hunterAI : public boss_faction_championsAI + { + npc_toc_hunterAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_RANGED) + { + SetEquipmentSlots(false, 47156, EQUIP_NO_CHANGE, 48711); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_AIMED_SHOT, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_DETERRENCE, 10000); + //events.RescheduleEvent(EVENT_SPELL_DISENGAGE, 10000); + events.RescheduleEvent(EVENT_SPELL_EXPLOSIVE_SHOT, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_FROST_TRAP, urand(15000,20000)); + events.RescheduleEvent(EVENT_SPELL_STEADY_SHOT, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_WING_CLIP, 10000); + events.RescheduleEvent(EVENT_SPELL_WYVERN_STING, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_CALL_PET, 0); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_RANGED) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_RANGED) || IsCCed()); + } - void JustSummoned(Creature* c) - { - if( Unit* target = c->SelectNearestTarget(200.0f) ) - c->AI()->AttackStart(target); - } + void JustSummoned(Creature* c) + { + if( Unit* target = c->SelectNearestTarget(200.0f) ) + c->AI()->AttackStart(target); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_CALL_PET: - DoSummon(35610, *me); - events.PopEvent(); - break; - case EVENT_SPELL_AIMED_SHOT: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_AIMED_SHOT, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_DETERRENCE: - if( HealthBelowPct(25) ) - { - me->CastSpell(me, SPELL_DETERRENCE, false); - events.RepeatEvent(90000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_DISENGAGE: - if( EnemiesInRange(10.0f) >= 3 ) - { - me->CastSpell(me, SPELL_DISENGAGE, false); - events.RepeatEvent(20000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_EXPLOSIVE_SHOT: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_EXPLOSIVE_SHOT, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_FROST_TRAP: - me->CastSpell(me, SPELL_FROST_TRAP, false); - events.RepeatEvent(30000); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_STEADY_SHOT: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_STEADY_SHOT, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_WING_CLIP: - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 5.0f ) - me->CastSpell(me->GetVictim(), SPELL_WING_CLIP, false); - events.RepeatEvent(8000); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_WYVERN_STING: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true) ) - { - me->CastSpell(target, SPELL_WYVERN_STING, false); - events.RepeatEvent(60000); - EventMapGCD(events, 1500); - break; - } - events.RepeatEvent(10000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_CALL_PET: + DoSummon(35610, *me); + events.PopEvent(); + break; + case EVENT_SPELL_AIMED_SHOT: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_AIMED_SHOT, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_DETERRENCE: + if( HealthBelowPct(25) ) + { + me->CastSpell(me, SPELL_DETERRENCE, false); + events.RepeatEvent(90000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_DISENGAGE: + if( EnemiesInRange(10.0f) >= 3 ) + { + me->CastSpell(me, SPELL_DISENGAGE, false); + events.RepeatEvent(20000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_EXPLOSIVE_SHOT: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_EXPLOSIVE_SHOT, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_FROST_TRAP: + me->CastSpell(me, SPELL_FROST_TRAP, false); + events.RepeatEvent(30000); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_STEADY_SHOT: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_STEADY_SHOT, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_WING_CLIP: + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 5.0f ) + me->CastSpell(me->GetVictim(), SPELL_WING_CLIP, false); + events.RepeatEvent(8000); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_WYVERN_STING: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true) ) + { + me->CastSpell(target, SPELL_WYVERN_STING, false); + events.RepeatEvent(60000); + EventMapGCD(events, 1500); + break; + } + events.RepeatEvent(10000); + break; + } - if( me->isAttackReady() && !me->HasUnitState(UNIT_STATE_CASTING) ) - { - me->CastSpell(me->GetVictim(), SPELL_SHOOT, true); - me->resetAttackTimer(); - } - } - }; + if( me->isAttackReady() && !me->HasUnitState(UNIT_STATE_CASTING) ) + { + me->CastSpell(me->GetVictim(), SPELL_SHOOT, true); + me->resetAttackTimer(); + } + } + }; }; enum eBoomkinSpells { - SPELL_WRATH = 65862, - SPELL_MOONFIRE = 65856, - SPELL_STARFIRE = 65854, - SPELL_INSECT_SWARM = 65855, - SPELL_ENTANGLING_ROOTS = 65857, - SPELL_FAERIE_FIRE = 65863, - SPELL_CYCLONE = 65859, - SPELL_FORCE_OF_NATURE = 65861, + SPELL_WRATH = 65862, + SPELL_MOONFIRE = 65856, + SPELL_STARFIRE = 65854, + SPELL_INSECT_SWARM = 65855, + SPELL_ENTANGLING_ROOTS = 65857, + SPELL_FAERIE_FIRE = 65863, + SPELL_CYCLONE = 65859, + SPELL_FORCE_OF_NATURE = 65861, }; enum eBoomkinEvents { - EVENT_SPELL_WRATH = 1, - EVENT_SPELL_MOONFIRE, - EVENT_SPELL_STARFIRE, - EVENT_SPELL_INSECT_SWARM, - EVENT_SPELL_ENTANGLING_ROOTS, - EVENT_SPELL_FAERIE_FIRE, - EVENT_SPELL_CYCLONE, - EVENT_SPELL_FORCE_OF_NATURE, + EVENT_SPELL_WRATH = 1, + EVENT_SPELL_MOONFIRE, + EVENT_SPELL_STARFIRE, + EVENT_SPELL_INSECT_SWARM, + EVENT_SPELL_ENTANGLING_ROOTS, + EVENT_SPELL_FAERIE_FIRE, + EVENT_SPELL_CYCLONE, + EVENT_SPELL_FORCE_OF_NATURE, }; class npc_toc_boomkin : public CreatureScript { public: - npc_toc_boomkin() : CreatureScript("npc_toc_boomkin") { } + npc_toc_boomkin() : CreatureScript("npc_toc_boomkin") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_boomkinAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_boomkinAI (pCreature); + } - struct npc_toc_boomkinAI : public boss_faction_championsAI - { - npc_toc_boomkinAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_RANGED) - { - SetEquipmentSlots(false, 50966, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_BARKSKIN, 10000); - events.RescheduleEvent(EVENT_SPELL_WRATH, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_MOONFIRE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_STARFIRE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_INSECT_SWARM, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_ENTANGLING_ROOTS, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_FAERIE_FIRE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_CYCLONE, urand(10000,15000)); - events.RescheduleEvent(EVENT_SPELL_FORCE_OF_NATURE, urand(20000,40000)); - } + struct npc_toc_boomkinAI : public boss_faction_championsAI + { + npc_toc_boomkinAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_RANGED) + { + SetEquipmentSlots(false, 50966, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_BARKSKIN, 10000); + events.RescheduleEvent(EVENT_SPELL_WRATH, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_MOONFIRE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_STARFIRE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_INSECT_SWARM, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_ENTANGLING_ROOTS, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_FAERIE_FIRE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_CYCLONE, urand(10000,15000)); + events.RescheduleEvent(EVENT_SPELL_FORCE_OF_NATURE, urand(20000,40000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); + } - void JustSummoned(Creature* c) - { - if( Unit* target = c->SelectNearestTarget(200.0f) ) - c->AI()->AttackStart(target); - } + void JustSummoned(Creature* c) + { + if( Unit* target = c->SelectNearestTarget(200.0f) ) + c->AI()->AttackStart(target); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_BARKSKIN: - if( HealthBelowPct(50) ) - { - me->CastSpell(me, SPELL_BARKSKIN, false); - events.RepeatEvent(60000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_WRATH: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_WRATH, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_MOONFIRE: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_MOONFIRE, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_STARFIRE: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_STARFIRE, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_INSECT_SWARM: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_INSECT_SWARM, false); - events.RepeatEvent(urand(5000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_ENTANGLING_ROOTS: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) - me->CastSpell(target, SPELL_ENTANGLING_ROOTS, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_FAERIE_FIRE: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_FAERIE_FIRE, false); - events.RepeatEvent(urand(15000,20000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_CYCLONE: - if( Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 20.0f, true) ) - me->CastSpell(target, SPELL_CYCLONE, false); - events.RepeatEvent(urand(25000,40000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_FORCE_OF_NATURE: - me->CastSpell((Unit*)NULL, SPELL_FORCE_OF_NATURE, false); - events.RepeatEvent(180000); - EventMapGCD(events, 1500); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_BARKSKIN: + if( HealthBelowPct(50) ) + { + me->CastSpell(me, SPELL_BARKSKIN, false); + events.RepeatEvent(60000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_WRATH: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_WRATH, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_MOONFIRE: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_MOONFIRE, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_STARFIRE: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_STARFIRE, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_INSECT_SWARM: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_INSECT_SWARM, false); + events.RepeatEvent(urand(5000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_ENTANGLING_ROOTS: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) ) + me->CastSpell(target, SPELL_ENTANGLING_ROOTS, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_FAERIE_FIRE: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_FAERIE_FIRE, false); + events.RepeatEvent(urand(15000,20000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_CYCLONE: + if( Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 20.0f, true) ) + me->CastSpell(target, SPELL_CYCLONE, false); + events.RepeatEvent(urand(25000,40000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_FORCE_OF_NATURE: + me->CastSpell((Unit*)NULL, SPELL_FORCE_OF_NATURE, false); + events.RepeatEvent(180000); + EventMapGCD(events, 1500); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eWarriorSpells { - SPELL_BLADESTORM = 65947, - SPELL_INTIMIDATING_SHOUT = 65930, - SPELL_MORTAL_STRIKE = 65926, - SPELL_CHARGE = 68764, - SPELL_DISARM = 65935, - SPELL_OVERPOWER = 65924, - SPELL_SUNDER_ARMOR = 65936, - SPELL_SHATTERING_THROW = 65940, - SPELL_RETALIATION = 65932, + SPELL_BLADESTORM = 65947, + SPELL_INTIMIDATING_SHOUT = 65930, + SPELL_MORTAL_STRIKE = 65926, + SPELL_CHARGE = 68764, + SPELL_DISARM = 65935, + SPELL_OVERPOWER = 65924, + SPELL_SUNDER_ARMOR = 65936, + SPELL_SHATTERING_THROW = 65940, + SPELL_RETALIATION = 65932, }; enum eWarriorEvents { - EVENT_SPELL_BLADESTORM = 1, - EVENT_SPELL_INTIMIDATING_SHOUT, - EVENT_SPELL_MORTAL_STRIKE, - EVENT_SPELL_CHARGE, - EVENT_SPELL_DISARM, - EVENT_SPELL_OVERPOWER, - EVENT_SPELL_SUNDER_ARMOR, - EVENT_SPELL_SHATTERING_THROW, - EVENT_SPELL_RETALIATION, + EVENT_SPELL_BLADESTORM = 1, + EVENT_SPELL_INTIMIDATING_SHOUT, + EVENT_SPELL_MORTAL_STRIKE, + EVENT_SPELL_CHARGE, + EVENT_SPELL_DISARM, + EVENT_SPELL_OVERPOWER, + EVENT_SPELL_SUNDER_ARMOR, + EVENT_SPELL_SHATTERING_THROW, + EVENT_SPELL_RETALIATION, }; class npc_toc_warrior : public CreatureScript { public: - npc_toc_warrior() : CreatureScript("npc_toc_warrior") { } + npc_toc_warrior() : CreatureScript("npc_toc_warrior") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_warriorAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_warriorAI (pCreature); + } - struct npc_toc_warriorAI : public boss_faction_championsAI - { - npc_toc_warriorAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_MELEE) - { - SetEquipmentSlots(false, 47427, 46964, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_BLADESTORM, 20000); - events.RescheduleEvent(EVENT_SPELL_INTIMIDATING_SHOUT, 14000); - events.RescheduleEvent(EVENT_SPELL_MORTAL_STRIKE, urand(5000,10000)); - events.RescheduleEvent(EVENT_SPELL_CHARGE, 3000); - events.RescheduleEvent(EVENT_SPELL_DISARM, urand(15000,25000)); - events.RescheduleEvent(EVENT_SPELL_OVERPOWER, urand(5000,10000)); - events.RescheduleEvent(EVENT_SPELL_SUNDER_ARMOR, urand(5000,10000)); - events.RescheduleEvent(EVENT_SPELL_SHATTERING_THROW, urand(25000,40000)); - events.RescheduleEvent(EVENT_SPELL_RETALIATION, urand(25000,40000)); - } + struct npc_toc_warriorAI : public boss_faction_championsAI + { + npc_toc_warriorAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_MELEE) + { + SetEquipmentSlots(false, 47427, 46964, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_BLADESTORM, 20000); + events.RescheduleEvent(EVENT_SPELL_INTIMIDATING_SHOUT, 14000); + events.RescheduleEvent(EVENT_SPELL_MORTAL_STRIKE, urand(5000,10000)); + events.RescheduleEvent(EVENT_SPELL_CHARGE, 3000); + events.RescheduleEvent(EVENT_SPELL_DISARM, urand(15000,25000)); + events.RescheduleEvent(EVENT_SPELL_OVERPOWER, urand(5000,10000)); + events.RescheduleEvent(EVENT_SPELL_SUNDER_ARMOR, urand(5000,10000)); + events.RescheduleEvent(EVENT_SPELL_SHATTERING_THROW, urand(25000,40000)); + events.RescheduleEvent(EVENT_SPELL_RETALIATION, urand(25000,40000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_BLADESTORM: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( EnemiesInRange(8.0f) >= 3 ) - { - me->CastSpell(me, SPELL_BLADESTORM, false); - events.RepeatEvent(90000); - events.DelayEvents(9000); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_INTIMIDATING_SHOUT: - if( EnemiesInRange(8.0f) >= 3 ) - { - me->CastSpell((Unit*)NULL, SPELL_INTIMIDATING_SHOUT, false); - events.RepeatEvent(120000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_MORTAL_STRIKE: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); - events.RepeatEvent(urand(6000,8000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_CHARGE: - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) > 8.0f && me->GetDistance2d(me->GetVictim()) < 25.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_CHARGE, false); - events.RepeatEvent(10000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_DISARM: - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 5.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_DISARM, false); - events.RepeatEvent(60000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_OVERPOWER: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 5.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_OVERPOWER, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_SUNDER_ARMOR: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 5.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_SUNDER_ARMOR, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_SHATTERING_THROW: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 25.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_SHATTERING_THROW, false); - events.RepeatEvent(300000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_RETALIATION: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( EnemiesInRange(8.0f) >= 3 ) - { - me->CastSpell(me, SPELL_RETALIATION, false); - events.RepeatEvent(300000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_BLADESTORM: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( EnemiesInRange(8.0f) >= 3 ) + { + me->CastSpell(me, SPELL_BLADESTORM, false); + events.RepeatEvent(90000); + events.DelayEvents(9000); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_INTIMIDATING_SHOUT: + if( EnemiesInRange(8.0f) >= 3 ) + { + me->CastSpell((Unit*)NULL, SPELL_INTIMIDATING_SHOUT, false); + events.RepeatEvent(120000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_MORTAL_STRIKE: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); + events.RepeatEvent(urand(6000,8000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_CHARGE: + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) > 8.0f && me->GetDistance2d(me->GetVictim()) < 25.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_CHARGE, false); + events.RepeatEvent(10000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_DISARM: + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 5.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_DISARM, false); + events.RepeatEvent(60000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_OVERPOWER: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 5.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_OVERPOWER, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_SUNDER_ARMOR: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 5.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_SUNDER_ARMOR, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_SHATTERING_THROW: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 25.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_SHATTERING_THROW, false); + events.RepeatEvent(300000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_RETALIATION: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( EnemiesInRange(8.0f) >= 3 ) + { + me->CastSpell(me, SPELL_RETALIATION, false); + events.RepeatEvent(300000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eDeathKnightSpells { - SPELL_CHAINS_OF_ICE = 66020, - SPELL_DEATH_COIL = 66019, - SPELL_DEATH_GRIP = 66017, - SPELL_FROST_STRIKE = 66047, - SPELL_ICEBOUND_FORTITUDE = 66023, - SPELL_ICY_TOUCH = 66021, - SPELL_STRANGULATE = 66018, + SPELL_CHAINS_OF_ICE = 66020, + SPELL_DEATH_COIL = 66019, + SPELL_DEATH_GRIP = 66017, + SPELL_FROST_STRIKE = 66047, + SPELL_ICEBOUND_FORTITUDE = 66023, + SPELL_ICY_TOUCH = 66021, + SPELL_STRANGULATE = 66018, }; enum eDeathKnightEvents { - EVENT_SPELL_CHAINS_OF_ICE = 1, - EVENT_SPELL_DEATH_COIL, - EVENT_SPELL_DEATH_GRIP, - EVENT_SPELL_FROST_STRIKE, - EVENT_SPELL_ICEBOUND_FORTITUDE, - EVENT_SPELL_ICY_TOUCH, - EVENT_SPELL_STRANGULATE, + EVENT_SPELL_CHAINS_OF_ICE = 1, + EVENT_SPELL_DEATH_COIL, + EVENT_SPELL_DEATH_GRIP, + EVENT_SPELL_FROST_STRIKE, + EVENT_SPELL_ICEBOUND_FORTITUDE, + EVENT_SPELL_ICY_TOUCH, + EVENT_SPELL_STRANGULATE, }; class npc_toc_dk : public CreatureScript { public: - npc_toc_dk() : CreatureScript("npc_toc_dk") { } + npc_toc_dk() : CreatureScript("npc_toc_dk") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_dkAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_dkAI (pCreature); + } - struct npc_toc_dkAI : public boss_faction_championsAI - { - npc_toc_dkAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_MELEE) - { - SetEquipmentSlots(false, 47518, 51021, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_CHAINS_OF_ICE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_DEATH_COIL, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_DEATH_GRIP, 0); - events.RescheduleEvent(EVENT_SPELL_FROST_STRIKE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_ICEBOUND_FORTITUDE, 10000); - events.RescheduleEvent(EVENT_SPELL_ICY_TOUCH, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_STRANGULATE, urand(20000,30000)); - } + struct npc_toc_dkAI : public boss_faction_championsAI + { + npc_toc_dkAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_MELEE) + { + SetEquipmentSlots(false, 47518, 51021, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_CHAINS_OF_ICE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_DEATH_COIL, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_DEATH_GRIP, 0); + events.RescheduleEvent(EVENT_SPELL_FROST_STRIKE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_ICEBOUND_FORTITUDE, 10000); + events.RescheduleEvent(EVENT_SPELL_ICY_TOUCH, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_STRANGULATE, urand(20000,30000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_CHAINS_OF_ICE: - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 25.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_CHAINS_OF_ICE, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_DEATH_COIL: - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 30.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_DEATH_COIL, false); - events.RepeatEvent(urand(5000,8000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_DEATH_GRIP: - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 30.0f && me->GetDistance2d(me->GetVictim()) >= 12.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_DEATH_GRIP, false); - Position pos; - float x, y, z; - me->GetClosePoint(x,y,z,3.0f); - pos.Relocate(x, y, z); - me->GetVictim()->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), 49575, true); - events.RepeatEvent(35000); - EventMapGCD(events, 2000); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_FROST_STRIKE: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 5.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_FROST_STRIKE, false); - events.RepeatEvent(urand(6000,10000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_ICEBOUND_FORTITUDE: - if( HealthBelowPct(50) ) - { - me->CastSpell(me, SPELL_ICEBOUND_FORTITUDE, false); - events.RepeatEvent(60000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_ICY_TOUCH: - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 20.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_ICY_TOUCH, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_STRANGULATE: - if( Unit* target = SelectEnemyCaster(false, 30.0f) ) - { - me->CastSpell(me->GetVictim(), SPELL_STRANGULATE, false); - events.RepeatEvent(120000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_CHAINS_OF_ICE: + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 25.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_CHAINS_OF_ICE, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_DEATH_COIL: + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 30.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_DEATH_COIL, false); + events.RepeatEvent(urand(5000,8000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_DEATH_GRIP: + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 30.0f && me->GetDistance2d(me->GetVictim()) >= 12.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_DEATH_GRIP, false); + Position pos; + float x, y, z; + me->GetClosePoint(x,y,z,3.0f); + pos.Relocate(x, y, z); + me->GetVictim()->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), 49575, true); + events.RepeatEvent(35000); + EventMapGCD(events, 2000); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_FROST_STRIKE: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 5.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_FROST_STRIKE, false); + events.RepeatEvent(urand(6000,10000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_ICEBOUND_FORTITUDE: + if( HealthBelowPct(50) ) + { + me->CastSpell(me, SPELL_ICEBOUND_FORTITUDE, false); + events.RepeatEvent(60000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_ICY_TOUCH: + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 20.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_ICY_TOUCH, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_STRANGULATE: + if( Unit* target = SelectEnemyCaster(false, 30.0f) ) + { + me->CastSpell(me->GetVictim(), SPELL_STRANGULATE, false); + events.RepeatEvent(120000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eRogueSpells { - SPELL_FAN_OF_KNIVES = 65955, - SPELL_BLIND = 65960, - SPELL_CLOAK = 65961, - SPELL_BLADE_FLURRY = 65956, - SPELL_SHADOWSTEP = 66178, - SPELL_HEMORRHAGE = 65954, - SPELL_EVISCERATE = 65957, + SPELL_FAN_OF_KNIVES = 65955, + SPELL_BLIND = 65960, + SPELL_CLOAK = 65961, + SPELL_BLADE_FLURRY = 65956, + SPELL_SHADOWSTEP = 66178, + SPELL_HEMORRHAGE = 65954, + SPELL_EVISCERATE = 65957, }; enum eRogueEvents { - EVENT_SPELL_FAN_OF_KNIVES = 1, - EVENT_SPELL_BLIND, - EVENT_SPELL_CLOAK, - EVENT_SPELL_BLADE_FLURRY, - EVENT_SPELL_SHADOWSTEP, - EVENT_SPELL_HEMORRHAGE, - EVENT_SPELL_EVISCERATE, + EVENT_SPELL_FAN_OF_KNIVES = 1, + EVENT_SPELL_BLIND, + EVENT_SPELL_CLOAK, + EVENT_SPELL_BLADE_FLURRY, + EVENT_SPELL_SHADOWSTEP, + EVENT_SPELL_HEMORRHAGE, + EVENT_SPELL_EVISCERATE, }; class npc_toc_rogue : public CreatureScript { public: - npc_toc_rogue() : CreatureScript("npc_toc_rogue") { } + npc_toc_rogue() : CreatureScript("npc_toc_rogue") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_rogueAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_rogueAI (pCreature); + } - struct npc_toc_rogueAI : public boss_faction_championsAI - { - npc_toc_rogueAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_MELEE) - { - SetEquipmentSlots(false, 47422, 49982, EQUIP_NO_CHANGE); - me->setPowerType(POWER_ENERGY); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_FAN_OF_KNIVES, 10000); - events.RescheduleEvent(EVENT_SPELL_BLIND, urand(10000,15000)); - events.RescheduleEvent(EVENT_SPELL_CLOAK, 10000); - events.RescheduleEvent(EVENT_SPELL_BLADE_FLURRY, urand(20000,40000)); - //events.RescheduleEvent(EVENT_SPELL_SHADOWSTEP, urand(15000,25000)); - events.RescheduleEvent(EVENT_SPELL_HEMORRHAGE, urand(3000,5000)); - events.RescheduleEvent(EVENT_SPELL_EVISCERATE, urand(20000,25000)); - } + struct npc_toc_rogueAI : public boss_faction_championsAI + { + npc_toc_rogueAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_MELEE) + { + SetEquipmentSlots(false, 47422, 49982, EQUIP_NO_CHANGE); + me->setPowerType(POWER_ENERGY); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_FAN_OF_KNIVES, 10000); + events.RescheduleEvent(EVENT_SPELL_BLIND, urand(10000,15000)); + events.RescheduleEvent(EVENT_SPELL_CLOAK, 10000); + events.RescheduleEvent(EVENT_SPELL_BLADE_FLURRY, urand(20000,40000)); + //events.RescheduleEvent(EVENT_SPELL_SHADOWSTEP, urand(15000,25000)); + events.RescheduleEvent(EVENT_SPELL_HEMORRHAGE, urand(3000,5000)); + events.RescheduleEvent(EVENT_SPELL_EVISCERATE, urand(20000,25000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_FAN_OF_KNIVES: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( EnemiesInRange(10.0f) >= 3 ) - { - me->CastSpell(me->GetVictim(), SPELL_FAN_OF_KNIVES, false); - events.RepeatEvent(urand(6000,10000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_BLIND: - if( Unit* target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, 20.0f, true) ) - { - me->CastSpell(target, SPELL_BLIND, false); - events.RepeatEvent(120000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_CLOAK: - if( HealthBelowPct(50) ) - { - me->CastSpell(me, SPELL_CLOAK, false); - events.RepeatEvent(90000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(6000); - break; - case EVENT_SPELL_BLADE_FLURRY: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - events.RepeatEvent(5000); - else - { - me->CastSpell(me, SPELL_BLADE_FLURRY, false); - events.RepeatEvent(120000); - EventMapGCD(events, 1500); - } - break; - case EVENT_SPELL_SHADOWSTEP: - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 40.0f && me->GetDistance2d(me->GetVictim()) > 10.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_SHADOWSTEP, false); - events.RepeatEvent(30000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_HEMORRHAGE: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 5.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_HEMORRHAGE, false); - events.RepeatEvent(5000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_EVISCERATE: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 5.0f ) - { - me->CastSpell(me->GetVictim(), SPELL_EVISCERATE, false); - events.RepeatEvent(urand(15000,25000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_FAN_OF_KNIVES: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( EnemiesInRange(10.0f) >= 3 ) + { + me->CastSpell(me->GetVictim(), SPELL_FAN_OF_KNIVES, false); + events.RepeatEvent(urand(6000,10000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_BLIND: + if( Unit* target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, 20.0f, true) ) + { + me->CastSpell(target, SPELL_BLIND, false); + events.RepeatEvent(120000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_CLOAK: + if( HealthBelowPct(50) ) + { + me->CastSpell(me, SPELL_CLOAK, false); + events.RepeatEvent(90000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(6000); + break; + case EVENT_SPELL_BLADE_FLURRY: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + events.RepeatEvent(5000); + else + { + me->CastSpell(me, SPELL_BLADE_FLURRY, false); + events.RepeatEvent(120000); + EventMapGCD(events, 1500); + } + break; + case EVENT_SPELL_SHADOWSTEP: + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) < 40.0f && me->GetDistance2d(me->GetVictim()) > 10.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_SHADOWSTEP, false); + events.RepeatEvent(30000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_HEMORRHAGE: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 5.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_HEMORRHAGE, false); + events.RepeatEvent(5000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_EVISCERATE: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( me->GetVictim() && me->GetDistance2d(me->GetVictim()) <= 5.0f ) + { + me->CastSpell(me->GetVictim(), SPELL_EVISCERATE, false); + events.RepeatEvent(urand(15000,25000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eEnhShamanSpells { - SPELL_EARTH_SHOCK_ENH = 65973, - SPELL_LAVA_LASH = 65974, - SPELL_STORMSTRIKE = 65970, - SPELL_GROUNDING_TOTEM = 65989, - SPELL_WINDFURY_TOTEM = 65990, - SPELL_TREMOR_TOTEM = 65992, + SPELL_EARTH_SHOCK_ENH = 65973, + SPELL_LAVA_LASH = 65974, + SPELL_STORMSTRIKE = 65970, + SPELL_GROUNDING_TOTEM = 65989, + SPELL_WINDFURY_TOTEM = 65990, + SPELL_TREMOR_TOTEM = 65992, }; enum eEnhShamanEvents { - EVENT_SPELL_EARTH_SHOCK_ENH = 201, - EVENT_SPELL_LAVA_LASH, - EVENT_SPELL_STORMSTRIKE, - EVENT_SUMMON_TOTEM, + EVENT_SPELL_EARTH_SHOCK_ENH = 201, + EVENT_SPELL_LAVA_LASH, + EVENT_SPELL_STORMSTRIKE, + EVENT_SUMMON_TOTEM, }; class npc_toc_enh_shaman : public CreatureScript { public: - npc_toc_enh_shaman() : CreatureScript("npc_toc_enh_shaman") { } + npc_toc_enh_shaman() : CreatureScript("npc_toc_enh_shaman") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_enh_shamanAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_enh_shamanAI (pCreature); + } - struct npc_toc_enh_shamanAI : public boss_faction_championsAI - { - npc_toc_enh_shamanAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_MELEE) - { - SetEquipmentSlots(false, 51803, 48013, EQUIP_NO_CHANGE); - me->SetModifierValue(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, 1.0f); - me->UpdateDamagePhysical(OFF_ATTACK); + struct npc_toc_enh_shamanAI : public boss_faction_championsAI + { + npc_toc_enh_shamanAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_MELEE) + { + SetEquipmentSlots(false, 51803, 48013, EQUIP_NO_CHANGE); + me->SetModifierValue(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, 1.0f); + me->UpdateDamagePhysical(OFF_ATTACK); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_HEROISM_OR_BLOODLUST, urand(25000,40000)); - events.RescheduleEvent(EVENT_SPELL_EARTH_SHOCK_ENH, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_LAVA_LASH, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_STORMSTRIKE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SUMMON_TOTEM, urand(10000,20000)); - } + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_HEROISM_OR_BLOODLUST, urand(25000,40000)); + events.RescheduleEvent(EVENT_SPELL_EARTH_SHOCK_ENH, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_LAVA_LASH, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_STORMSTRIKE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SUMMON_TOTEM, urand(10000,20000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_EARTH_SHOCK_ENH: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) ) - { - events.RepeatEvent(5000); - break; - } - if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 25.0f, true) ) - { - me->CastSpell(target, SPELL_EARTH_SHOCK_ENH, false); - events.RepeatEvent(urand(6000,8000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_LAVA_LASH: - if( me->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_OFFHAND) ) - { - events.RepeatEvent(5000); - break; - } - if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 5.0f, true) ) - { - me->CastSpell(target, SPELL_LAVA_LASH, false); - events.RepeatEvent(urand(6000,8000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_STORMSTRIKE: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) && me->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_OFFHAND) ) - { - events.RepeatEvent(5000); - break; - } - if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 5.0f, true) ) - { - me->CastSpell(target, SPELL_STORMSTRIKE, false); - events.RepeatEvent(urand(8000,9000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_HEROISM_OR_BLOODLUST: - if( me->GetEntry() == NPC_ALLIANCE_SHAMAN_RESTORATION ) - me->CastSpell((Unit*)NULL, SPELL_HEROISM, true); - else - me->CastSpell((Unit*)NULL, SPELL_BLOODLUST, true); - events.RepeatEvent(600000); - EventMapGCD(events, 1500); - break; - case EVENT_SUMMON_TOTEM: - me->CastSpell((Unit*)NULL, RAND(SPELL_GROUNDING_TOTEM,SPELL_WINDFURY_TOTEM,SPELL_TREMOR_TOTEM), false); - events.RepeatEvent(30000); - EventMapGCD(events, 1500); - break; + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_EARTH_SHOCK_ENH: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) ) + { + events.RepeatEvent(5000); + break; + } + if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 25.0f, true) ) + { + me->CastSpell(target, SPELL_EARTH_SHOCK_ENH, false); + events.RepeatEvent(urand(6000,8000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_LAVA_LASH: + if( me->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_OFFHAND) ) + { + events.RepeatEvent(5000); + break; + } + if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 5.0f, true) ) + { + me->CastSpell(target, SPELL_LAVA_LASH, false); + events.RepeatEvent(urand(6000,8000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_STORMSTRIKE: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) && me->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_OFFHAND) ) + { + events.RepeatEvent(5000); + break; + } + if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 5.0f, true) ) + { + me->CastSpell(target, SPELL_STORMSTRIKE, false); + events.RepeatEvent(urand(8000,9000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_HEROISM_OR_BLOODLUST: + if( me->GetEntry() == NPC_ALLIANCE_SHAMAN_RESTORATION ) + me->CastSpell((Unit*)NULL, SPELL_HEROISM, true); + else + me->CastSpell((Unit*)NULL, SPELL_BLOODLUST, true); + events.RepeatEvent(600000); + EventMapGCD(events, 1500); + break; + case EVENT_SUMMON_TOTEM: + me->CastSpell((Unit*)NULL, RAND(SPELL_GROUNDING_TOTEM,SPELL_WINDFURY_TOTEM,SPELL_TREMOR_TOTEM), false); + events.RepeatEvent(30000); + EventMapGCD(events, 1500); + break; - } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eRetroPaladinSpells { - SPELL_AVENGING_WRATH = 66011, - SPELL_CRUSADER_STRIKE = 66003, - SPELL_DIVINE_SHIELD = 66010, - SPELL_DIVINE_STORM = 66006, - SPELL_HAMMER_OF_JUSTICE_RET = 66007, - SPELL_HAND_OF_PROTECTION_RET = 66009, - SPELL_JUDGEMENT_OF_COMMAND = 66005, - SPELL_REPENTANCE = 66008, - SPELL_SEAL_OF_COMMAND = 66004, + SPELL_AVENGING_WRATH = 66011, + SPELL_CRUSADER_STRIKE = 66003, + SPELL_DIVINE_SHIELD = 66010, + SPELL_DIVINE_STORM = 66006, + SPELL_HAMMER_OF_JUSTICE_RET = 66007, + SPELL_HAND_OF_PROTECTION_RET = 66009, + SPELL_JUDGEMENT_OF_COMMAND = 66005, + SPELL_REPENTANCE = 66008, + SPELL_SEAL_OF_COMMAND = 66004, }; enum eRetroPaladinEvents { - EVENT_SPELL_AVENGING_WRATH = 1, - EVENT_SPELL_CRUSADER_STRIKE, - EVENT_SPELL_DIVINE_SHIELD, - EVENT_SPELL_DIVINE_STORM, - EVENT_SPELL_HAMMER_OF_JUSTICE_RET, - EVENT_SPELL_HAND_OF_PROTECTION_RET, - EVENT_SPELL_JUDGEMENT_OF_COMMAND, - EVENT_SPELL_REPENTANCE, + EVENT_SPELL_AVENGING_WRATH = 1, + EVENT_SPELL_CRUSADER_STRIKE, + EVENT_SPELL_DIVINE_SHIELD, + EVENT_SPELL_DIVINE_STORM, + EVENT_SPELL_HAMMER_OF_JUSTICE_RET, + EVENT_SPELL_HAND_OF_PROTECTION_RET, + EVENT_SPELL_JUDGEMENT_OF_COMMAND, + EVENT_SPELL_REPENTANCE, }; class npc_toc_retro_paladin : public CreatureScript { public: - npc_toc_retro_paladin() : CreatureScript("npc_toc_retro_paladin") { } + npc_toc_retro_paladin() : CreatureScript("npc_toc_retro_paladin") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_retro_paladinAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_retro_paladinAI (pCreature); + } - struct npc_toc_retro_paladinAI : public boss_faction_championsAI - { - npc_toc_retro_paladinAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_MELEE) - { - SetEquipmentSlots(false, 47519, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_AVENGING_WRATH, urand(20000,30000)); - events.RescheduleEvent(EVENT_SPELL_CRUSADER_STRIKE, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_DIVINE_SHIELD, 10000); - events.RescheduleEvent(EVENT_SPELL_DIVINE_STORM, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE_RET, urand(15000,25000)); - events.RescheduleEvent(EVENT_SPELL_HAND_OF_PROTECTION_RET, urand(25000,40000)); - events.RescheduleEvent(EVENT_SPELL_JUDGEMENT_OF_COMMAND, urand(3000,10000)); - events.RescheduleEvent(EVENT_SPELL_REPENTANCE, urand(10000,15000)); - } + struct npc_toc_retro_paladinAI : public boss_faction_championsAI + { + npc_toc_retro_paladinAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_MELEE) + { + SetEquipmentSlots(false, 47519, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_AVENGING_WRATH, urand(20000,30000)); + events.RescheduleEvent(EVENT_SPELL_CRUSADER_STRIKE, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_DIVINE_SHIELD, 10000); + events.RescheduleEvent(EVENT_SPELL_DIVINE_STORM, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE_RET, urand(15000,25000)); + events.RescheduleEvent(EVENT_SPELL_HAND_OF_PROTECTION_RET, urand(25000,40000)); + events.RescheduleEvent(EVENT_SPELL_JUDGEMENT_OF_COMMAND, urand(3000,10000)); + events.RescheduleEvent(EVENT_SPELL_REPENTANCE, urand(10000,15000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasUnitState(UNIT_STATE_CASTING) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasUnitState(UNIT_STATE_CASTING) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_AVENGING_WRATH: - me->CastSpell(me, SPELL_AVENGING_WRATH, false); - events.RepeatEvent(180000); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_CRUSADER_STRIKE: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 5.0f, true) ) - { - me->CastSpell(target, SPELL_CRUSADER_STRIKE, false); - events.RepeatEvent(urand(6000,8000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_DIVINE_SHIELD: - if( HealthBelowPct(25) ) - { - me->CastSpell(me, SPELL_DIVINE_SHIELD, false); - events.RepeatEvent(300000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_DIVINE_STORM: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - events.RepeatEvent(5000); - break; - } - if( EnemiesInRange(5.0f) >= 3 ) - { - me->CastSpell((Unit*)NULL, SPELL_DIVINE_STORM, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_HAMMER_OF_JUSTICE_RET: - if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 15.0f, true) ) - { - me->CastSpell(target, SPELL_HAMMER_OF_JUSTICE_RET, false); - events.RepeatEvent(40000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_HAND_OF_PROTECTION_RET: - if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HAND_OF_PROTECTION_RET, 30.0f) ) - { - me->CastSpell(target, SPELL_HAND_OF_PROTECTION_RET, false); - events.RepeatEvent(300000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_JUDGEMENT_OF_COMMAND: - if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 20.0f, true) ) - { - me->CastSpell(target, SPELL_JUDGEMENT_OF_COMMAND, false); - events.RepeatEvent(urand(10000,15000)); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - case EVENT_SPELL_REPENTANCE: - if( Unit* target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, 20.0f, true) ) - { - me->CastSpell(target, SPELL_REPENTANCE, false); - events.RepeatEvent(60000); - EventMapGCD(events, 1500); - } - else - events.RepeatEvent(5000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_AVENGING_WRATH: + me->CastSpell(me, SPELL_AVENGING_WRATH, false); + events.RepeatEvent(180000); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_CRUSADER_STRIKE: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 5.0f, true) ) + { + me->CastSpell(target, SPELL_CRUSADER_STRIKE, false); + events.RepeatEvent(urand(6000,8000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_DIVINE_SHIELD: + if( HealthBelowPct(25) ) + { + me->CastSpell(me, SPELL_DIVINE_SHIELD, false); + events.RepeatEvent(300000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_DIVINE_STORM: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + events.RepeatEvent(5000); + break; + } + if( EnemiesInRange(5.0f) >= 3 ) + { + me->CastSpell((Unit*)NULL, SPELL_DIVINE_STORM, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_HAMMER_OF_JUSTICE_RET: + if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 15.0f, true) ) + { + me->CastSpell(target, SPELL_HAMMER_OF_JUSTICE_RET, false); + events.RepeatEvent(40000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_HAND_OF_PROTECTION_RET: + if( Creature* target = SelectTarget_MostHPLostFriendlyMissingBuff(SPELL_HAND_OF_PROTECTION_RET, 30.0f) ) + { + me->CastSpell(target, SPELL_HAND_OF_PROTECTION_RET, false); + events.RepeatEvent(300000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_JUDGEMENT_OF_COMMAND: + if( Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 20.0f, true) ) + { + me->CastSpell(target, SPELL_JUDGEMENT_OF_COMMAND, false); + events.RepeatEvent(urand(10000,15000)); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + case EVENT_SPELL_REPENTANCE: + if( Unit* target = SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0, 20.0f, true) ) + { + me->CastSpell(target, SPELL_REPENTANCE, false); + events.RepeatEvent(60000); + EventMapGCD(events, 1500); + } + else + events.RepeatEvent(5000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eWarlockPetSpells { - SPELL_DEVOUR_MAGIC = 67518, - SPELL_SPELL_LOCK = 67519, + SPELL_DEVOUR_MAGIC = 67518, + SPELL_SPELL_LOCK = 67519, }; enum eWarlockPetEvents { - EVENT_SPELL_DEVOUR_MAGIC = 1, - EVENT_SPELL_SPELL_LOCK, + EVENT_SPELL_DEVOUR_MAGIC = 1, + EVENT_SPELL_SPELL_LOCK, }; class npc_toc_pet_warlock : public CreatureScript { public: - npc_toc_pet_warlock() : CreatureScript("npc_toc_pet_warlock") { } + npc_toc_pet_warlock() : CreatureScript("npc_toc_pet_warlock") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_pet_warlockAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_pet_warlockAI (pCreature); + } - struct npc_toc_pet_warlockAI : public boss_faction_championsAI - { - npc_toc_pet_warlockAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_PET) - { - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_DEVOUR_MAGIC, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_SPELL_LOCK, urand(5000,15000)); - } + struct npc_toc_pet_warlockAI : public boss_faction_championsAI + { + npc_toc_pet_warlockAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_PET) + { + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_DEVOUR_MAGIC, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_SPELL_LOCK, urand(5000,15000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !(me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); - } + bool myCanCast() + { + return !(me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) || IsCCed()); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_DEVOUR_MAGIC: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_DEVOUR_MAGIC, false); - events.RepeatEvent(urand(8000,15000)); - EventMapGCD(events, 1500); - break; - case EVENT_SPELL_SPELL_LOCK: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_SPELL_LOCK, false); - events.RepeatEvent(24000); - EventMapGCD(events, 1500); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_DEVOUR_MAGIC: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_DEVOUR_MAGIC, false); + events.RepeatEvent(urand(8000,15000)); + EventMapGCD(events, 1500); + break; + case EVENT_SPELL_SPELL_LOCK: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_SPELL_LOCK, false); + events.RepeatEvent(24000); + EventMapGCD(events, 1500); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - me->DespawnOrUnsummon(); - } - }; + void EnterEvadeMode() + { + me->DespawnOrUnsummon(); + } + }; }; enum eHunterPetSpells { - SPELL_CLAW = 67793, + SPELL_CLAW = 67793, }; enum eHunterPetEvents { - EVENT_SPELL_CLAW = 1, + EVENT_SPELL_CLAW = 1, }; class npc_toc_pet_hunter : public CreatureScript { public: - npc_toc_pet_hunter() : CreatureScript("npc_toc_pet_hunter") { } + npc_toc_pet_hunter() : CreatureScript("npc_toc_pet_hunter") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_toc_pet_hunterAI (pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_toc_pet_hunterAI (pCreature); + } - struct npc_toc_pet_hunterAI : public boss_faction_championsAI - { - npc_toc_pet_hunterAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_PET) - { - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_CLAW, urand(5000,15000)); - } + struct npc_toc_pet_hunterAI : public boss_faction_championsAI + { + npc_toc_pet_hunterAI(Creature *pCreature) : boss_faction_championsAI(pCreature, AI_PET) + { + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_CLAW, urand(5000,15000)); + } - EventMap events; + EventMap events; - bool myCanCast() - { - return !IsCCed(); - } + bool myCanCast() + { + return !IsCCed(); + } - void UpdateAI(uint32 diff) - { - boss_faction_championsAI::UpdateAI(diff); - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + boss_faction_championsAI::UpdateAI(diff); + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( !myCanCast() ) - return; + if( !myCanCast() ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_CLAW: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_CLAW, false); - events.RepeatEvent(urand(8000,15000)); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_CLAW: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_CLAW, false); + events.RepeatEvent(urand(8000,15000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - me->DespawnOrUnsummon(); - } - }; + void EnterEvadeMode() + { + me->DespawnOrUnsummon(); + } + }; }; class go_toc_champions_cache : public GameObjectScript { public: - go_toc_champions_cache() : GameObjectScript("go_toc_champions_cache") { } + go_toc_champions_cache() : GameObjectScript("go_toc_champions_cache") { } - bool OnGossipHello(Player* plr, GameObject* go) - { - if (plr->IsGameMaster()) - return false; + bool OnGossipHello(Player* plr, GameObject* go) + { + if (plr->IsGameMaster()) + return false; - if (!go->loot.items.size()) - return false; + if (!go->loot.items.size()) + return false; - uint8 invalidCount = 0; - for( std::vector::iterator itr = go->loot.items.begin(); itr != go->loot.items.end(); ++itr ) - if( ItemTemplate const *iProto = sObjectMgr->GetItemTemplate((*itr).itemid) ) - if( ((iProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && plr->GetTeamId() != TEAM_HORDE) || ((iProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && plr->GetTeamId() != TEAM_ALLIANCE) ) - if (!((*itr).is_looted)) - { - (*itr).count = 0; - (*itr).is_looted = true; - if (go->loot.unlootedCount) - --go->loot.unlootedCount; - } + uint8 invalidCount = 0; + for( std::vector::iterator itr = go->loot.items.begin(); itr != go->loot.items.end(); ++itr ) + if( ItemTemplate const *iProto = sObjectMgr->GetItemTemplate((*itr).itemid) ) + if( ((iProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && plr->GetTeamId() != TEAM_HORDE) || ((iProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && plr->GetTeamId() != TEAM_ALLIANCE) ) + if (!((*itr).is_looted)) + { + (*itr).count = 0; + (*itr).is_looted = true; + if (go->loot.unlootedCount) + --go->loot.unlootedCount; + } - return false; - } + return false; + } }; class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader @@ -2496,22 +2496,22 @@ class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader void AddSC_boss_faction_champions() { - new npc_toc_druid(); - new npc_toc_shaman(); - new npc_toc_paladin(); - new npc_toc_priest(); - new npc_toc_shadow_priest(); - new npc_toc_mage(); - new npc_toc_warlock(); - new npc_toc_hunter(); - new npc_toc_boomkin(); - new npc_toc_warrior(); - new npc_toc_dk(); - new npc_toc_rogue(); - new npc_toc_enh_shaman(); - new npc_toc_retro_paladin(); - new npc_toc_pet_warlock(); - new npc_toc_pet_hunter(); - new go_toc_champions_cache(); - new spell_faction_champion_warl_unstable_affliction(); + new npc_toc_druid(); + new npc_toc_shaman(); + new npc_toc_paladin(); + new npc_toc_priest(); + new npc_toc_shadow_priest(); + new npc_toc_mage(); + new npc_toc_warlock(); + new npc_toc_hunter(); + new npc_toc_boomkin(); + new npc_toc_warrior(); + new npc_toc_dk(); + new npc_toc_rogue(); + new npc_toc_enh_shaman(); + new npc_toc_retro_paladin(); + new npc_toc_pet_warlock(); + new npc_toc_pet_hunter(); + new go_toc_champions_cache(); + new spell_faction_champion_warl_unstable_affliction(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 6883e8ce7..505fd3f21 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -26,435 +26,435 @@ enum JaraxxusTexts enum JaraxxusNPCs { - NPC_LEGION_FLAME = 34784, - NPC_INFERNAL_VOLCANO = 34813, - NPC_FEL_INFERNAL = 34815, - NPC_NETHER_PORTAL = 34825, - NPC_MISTRESS_OF_PAIN = 34826, + NPC_LEGION_FLAME = 34784, + NPC_INFERNAL_VOLCANO = 34813, + NPC_FEL_INFERNAL = 34815, + NPC_NETHER_PORTAL = 34825, + NPC_MISTRESS_OF_PAIN = 34826, }; enum JaraxxusSpells { - SPELL_NETHER_POWER = 66228, - SPELL_INCINERATE_FLESH = 66237, - SPELL_FEL_FIREBALL = 66532, - SPELL_FEL_LIGHTNING = 66528, - SPELL_TOUCH_OF_JARAXXUS = 66209, - SPELL_LEGION_FLAME = 66197, - SPELL_LEGION_FLAME_NPC_AURA = 66201, - SPELL_SUMMON_VOLCANO = 66258, - SPELL_SUMMON_NETHER_PORTAL = 66269, + SPELL_NETHER_POWER = 66228, + SPELL_INCINERATE_FLESH = 66237, + SPELL_FEL_FIREBALL = 66532, + SPELL_FEL_LIGHTNING = 66528, + SPELL_TOUCH_OF_JARAXXUS = 66209, + SPELL_LEGION_FLAME = 66197, + SPELL_LEGION_FLAME_NPC_AURA = 66201, + SPELL_SUMMON_VOLCANO = 66258, + SPELL_SUMMON_NETHER_PORTAL = 66269, - SPELL_FEL_STEAK = 66494, - SPELL_FEL_STEAK_MORPH = 66493, + SPELL_FEL_STEAK = 66494, + SPELL_FEL_STEAK_MORPH = 66493, - SPELL_SHIVAN_SLASH = 66378, - SPELL_SPINNING_PAIN_SPIKE = 66283, - SPELL_MISTRESS_KISS = 66336, - SPELL_MISTRESS_KISS_PERIODIC_DUMMY = 66334, // also 67905, 67906, 67907 - SPELL_MISTRESS_KISS_INTERRUPT = 66359, + SPELL_SHIVAN_SLASH = 66378, + SPELL_SPINNING_PAIN_SPIKE = 66283, + SPELL_MISTRESS_KISS = 66336, + SPELL_MISTRESS_KISS_PERIODIC_DUMMY = 66334, // also 67905, 67906, 67907 + SPELL_MISTRESS_KISS_INTERRUPT = 66359, - SPELL_CHAINS = 67924, - SPELL_BERSERK = 64238, + SPELL_CHAINS = 67924, + SPELL_BERSERK = 64238, }; enum JaraxxusEvents { - EVENT_SPELL_FEL_FIREBALL = 1, - EVENT_SPELL_FEL_LIGHTNING, - EVENT_SPELL_INCINERATE_FLESH, - EVENT_SPELL_NETHER_POWER, - EVENT_SPELL_LEGION_FLAME, - EVENT_SPELL_TOUCH_OF_JARAXXUS, - EVENT_SUMMON_VOLCANO, - EVENT_SUMMON_NETHER_PORTAL, + EVENT_SPELL_FEL_FIREBALL = 1, + EVENT_SPELL_FEL_LIGHTNING, + EVENT_SPELL_INCINERATE_FLESH, + EVENT_SPELL_NETHER_POWER, + EVENT_SPELL_LEGION_FLAME, + EVENT_SPELL_TOUCH_OF_JARAXXUS, + EVENT_SUMMON_VOLCANO, + EVENT_SUMMON_NETHER_PORTAL, - EVENT_SPELL_FEL_STEAK, + EVENT_SPELL_FEL_STEAK, - EVENT_SPELL_SHIVAN_SLASH, - EVENT_SPELL_SPINNING_PAIN_SPIKE, - EVENT_SPELL_MISTRESS_KISS, + EVENT_SPELL_SHIVAN_SLASH, + EVENT_SPELL_SPINNING_PAIN_SPIKE, + EVENT_SPELL_MISTRESS_KISS, }; class boss_jaraxxus : public CreatureScript { public: - boss_jaraxxus() : CreatureScript("boss_jaraxxus") { } + boss_jaraxxus() : CreatureScript("boss_jaraxxus") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_jaraxxusAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_jaraxxusAI(pCreature); + } - struct boss_jaraxxusAI : public ScriptedAI - { - boss_jaraxxusAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetReactState(REACT_PASSIVE); - } + struct boss_jaraxxusAI : public ScriptedAI + { + boss_jaraxxusAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetReactState(REACT_PASSIVE); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; + InstanceScript* pInstance; + EventMap events; + SummonList summons; - void Reset() - { - events.Reset(); - if( pInstance ) - pInstance->SetData(TYPE_JARAXXUS, NOT_STARTED); + void Reset() + { + events.Reset(); + if( pInstance ) + pInstance->SetData(TYPE_JARAXXUS, NOT_STARTED); - // checked for safety - while( Creature* c = me->FindNearestCreature(NPC_INFERNAL_VOLCANO, 500.0f, true) ) - c->DespawnOrUnsummon(); - while( Creature* c = me->FindNearestCreature(NPC_NETHER_PORTAL, 500.0f, true) ) - c->DespawnOrUnsummon(); - } + // checked for safety + while( Creature* c = me->FindNearestCreature(NPC_INFERNAL_VOLCANO, 500.0f, true) ) + c->DespawnOrUnsummon(); + while( Creature* c = me->FindNearestCreature(NPC_NETHER_PORTAL, 500.0f, true) ) + c->DespawnOrUnsummon(); + } - void EnterCombat(Unit* /*who*/) - { - me->setActive(true); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_FEL_FIREBALL, 5000); - events.RescheduleEvent(EVENT_SPELL_FEL_LIGHTNING, urand(10000,15000)); - events.RescheduleEvent(EVENT_SPELL_INCINERATE_FLESH, urand(24000,26000)); - events.RescheduleEvent(EVENT_SPELL_NETHER_POWER, urand(25000,45000)); - events.RescheduleEvent(EVENT_SPELL_LEGION_FLAME, 30000); - //if( GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC ) - // events.RescheduleEvent(EVENT_SPELL_TOUCH_OF_JARAXXUS, urand(10000,15000)); - events.RescheduleEvent(EVENT_SUMMON_NETHER_PORTAL, 20000); // it schedules EVENT_SUMMON_VOLCANO + void EnterCombat(Unit* /*who*/) + { + me->setActive(true); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_FEL_FIREBALL, 5000); + events.RescheduleEvent(EVENT_SPELL_FEL_LIGHTNING, urand(10000,15000)); + events.RescheduleEvent(EVENT_SPELL_INCINERATE_FLESH, urand(24000,26000)); + events.RescheduleEvent(EVENT_SPELL_NETHER_POWER, urand(25000,45000)); + events.RescheduleEvent(EVENT_SPELL_LEGION_FLAME, 30000); + //if( GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC ) + // events.RescheduleEvent(EVENT_SPELL_TOUCH_OF_JARAXXUS, urand(10000,15000)); + events.RescheduleEvent(EVENT_SUMMON_NETHER_PORTAL, 20000); // it schedules EVENT_SUMMON_VOLCANO - me->RemoveAura(SPELL_CHAINS); - Talk(SAY_AGGRO); - DoZoneInCombat(); - if( pInstance ) - pInstance->SetData(TYPE_JARAXXUS, IN_PROGRESS); - } + me->RemoveAura(SPELL_CHAINS); + Talk(SAY_AGGRO); + DoZoneInCombat(); + if( pInstance ) + pInstance->SetData(TYPE_JARAXXUS, IN_PROGRESS); + } - void SpellHit(Unit* caster, const SpellInfo* spell) - { - switch( spell->Id ) - { - case 66228: - case 67106: - case 67107: - case 67108: - if( Aura* a = me->GetAura(spell->Id) ) - a->SetStackAmount(spell->StackAmount); - break; - case 30449: - { - if( !caster ) - return; - uint32 id = 0; - switch( me->GetMap()->GetDifficulty() ) - { - case 0: id = 66228; break; - case 1: id = 67106; break; - case 2: id = 67107; break; - case 3: id = 67108; break; - } - if( Aura* a = me->GetAura(id) ) - { - if( a->GetStackAmount() > 1 ) - a->ModStackAmount(-1); - else - a->Remove(); - caster->CastSpell(caster, SPELL_NETHER_POWER, true); - } - } - break; - default: - break; - } - } + void SpellHit(Unit* caster, const SpellInfo* spell) + { + switch( spell->Id ) + { + case 66228: + case 67106: + case 67107: + case 67108: + if( Aura* a = me->GetAura(spell->Id) ) + a->SetStackAmount(spell->StackAmount); + break; + case 30449: + { + if( !caster ) + return; + uint32 id = 0; + switch( me->GetMap()->GetDifficulty() ) + { + case 0: id = 66228; break; + case 1: id = 67106; break; + case 2: id = 67107; break; + case 3: id = 67108; break; + } + if( Aura* a = me->GetAura(id) ) + { + if( a->GetStackAmount() > 1 ) + a->ModStackAmount(-1); + else + a->Remove(); + caster->CastSpell(caster, SPELL_NETHER_POWER, true); + } + } + break; + default: + break; + } + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_FEL_FIREBALL: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_FEL_FIREBALL, false); - events.RepeatEvent(urand(10000,15000)); - break; - case EVENT_SPELL_FEL_LIGHTNING: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) ) - me->CastSpell(target, SPELL_FEL_LIGHTNING, false); - events.RepeatEvent(urand(10000,15000)); - break; - case EVENT_SPELL_INCINERATE_FLESH: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) ) - { - Talk(EMOTE_INCINERATE, target); - Talk(SAY_INCINERATE); - me->CastSpell(target, SPELL_INCINERATE_FLESH, false); - } - events.RepeatEvent(urand(20000,25000)); - break; - case EVENT_SPELL_NETHER_POWER: - me->CastSpell(me, SPELL_NETHER_POWER, false); - events.DelayEvents(5000); - events.RepeatEvent(urand(25000,45000)); - break; - case EVENT_SPELL_LEGION_FLAME: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) ) - { - Talk(EMOTE_LEGION_FLAME, target); - me->CastSpell(target, SPELL_LEGION_FLAME, false); - } - events.RepeatEvent(30000); - break; - case EVENT_SPELL_TOUCH_OF_JARAXXUS: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) ) - me->CastSpell(target, SPELL_TOUCH_OF_JARAXXUS, false); - events.RepeatEvent(urand(10000,15000)); - break; - case EVENT_SUMMON_NETHER_PORTAL: - Talk(EMOTE_NETHER_PORTAL); - Talk(SAY_MISTRESS_OF_PAIN); - me->CastSpell((Unit*)NULL, SPELL_SUMMON_NETHER_PORTAL, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_SUMMON_VOLCANO, 60000); - break; - case EVENT_SUMMON_VOLCANO: - Talk(EMOTE_INFERNAL_ERUPTION); - Talk(SAY_INFERNAL_ERUPTION); - me->CastSpell((Unit*)NULL, SPELL_SUMMON_VOLCANO, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_SUMMON_NETHER_PORTAL, 60000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_FEL_FIREBALL: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_FEL_FIREBALL, false); + events.RepeatEvent(urand(10000,15000)); + break; + case EVENT_SPELL_FEL_LIGHTNING: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) ) + me->CastSpell(target, SPELL_FEL_LIGHTNING, false); + events.RepeatEvent(urand(10000,15000)); + break; + case EVENT_SPELL_INCINERATE_FLESH: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) ) + { + Talk(EMOTE_INCINERATE, target); + Talk(SAY_INCINERATE); + me->CastSpell(target, SPELL_INCINERATE_FLESH, false); + } + events.RepeatEvent(urand(20000,25000)); + break; + case EVENT_SPELL_NETHER_POWER: + me->CastSpell(me, SPELL_NETHER_POWER, false); + events.DelayEvents(5000); + events.RepeatEvent(urand(25000,45000)); + break; + case EVENT_SPELL_LEGION_FLAME: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) ) + { + Talk(EMOTE_LEGION_FLAME, target); + me->CastSpell(target, SPELL_LEGION_FLAME, false); + } + events.RepeatEvent(30000); + break; + case EVENT_SPELL_TOUCH_OF_JARAXXUS: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) ) + me->CastSpell(target, SPELL_TOUCH_OF_JARAXXUS, false); + events.RepeatEvent(urand(10000,15000)); + break; + case EVENT_SUMMON_NETHER_PORTAL: + Talk(EMOTE_NETHER_PORTAL); + Talk(SAY_MISTRESS_OF_PAIN); + me->CastSpell((Unit*)NULL, SPELL_SUMMON_NETHER_PORTAL, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_SUMMON_VOLCANO, 60000); + break; + case EVENT_SUMMON_VOLCANO: + Talk(EMOTE_INFERNAL_ERUPTION); + Talk(SAY_INFERNAL_ERUPTION); + me->CastSpell((Unit*)NULL, SPELL_SUMMON_VOLCANO, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_SUMMON_NETHER_PORTAL, 60000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*pKiller*/) - { - summons.DespawnAll(); - Talk(SAY_DEATH); - if( pInstance ) - pInstance->SetData(TYPE_JARAXXUS, DONE); - } + void JustDied(Unit* /*pKiller*/) + { + summons.DespawnAll(); + Talk(SAY_DEATH); + if( pInstance ) + pInstance->SetData(TYPE_JARAXXUS, DONE); + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void EnterEvadeMode() - { - events.Reset(); - summons.DespawnAll(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( pInstance ) - pInstance->SetData(TYPE_FAILED, 1); - } + void EnterEvadeMode() + { + events.Reset(); + summons.DespawnAll(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( pInstance ) + pInstance->SetData(TYPE_FAILED, 1); + } - void MoveInLineOfSight(Unit* /*who*/) {} - }; + void MoveInLineOfSight(Unit* /*who*/) {} + }; }; class npc_fel_infernal : public CreatureScript { public: - npc_fel_infernal() : CreatureScript("npc_fel_infernal") { } + npc_fel_infernal() : CreatureScript("npc_fel_infernal") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_fel_infernalAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_fel_infernalAI(pCreature); + } - struct npc_fel_infernalAI : public ScriptedAI - { - npc_fel_infernalAI(Creature* pCreature) : ScriptedAI(pCreature) {} + struct npc_fel_infernalAI : public ScriptedAI + { + npc_fel_infernalAI(Creature* pCreature) : ScriptedAI(pCreature) {} - EventMap events; + EventMap events; - void Reset() - { - if( Unit* target = me->SelectNearestTarget(200.0f) ) - { - AttackStart(target); - DoZoneInCombat(); - } - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_FEL_STEAK, urand(7000,20000)); - } + void Reset() + { + if( Unit* target = me->SelectNearestTarget(200.0f) ) + { + AttackStart(target); + DoZoneInCombat(); + } + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_FEL_STEAK, urand(7000,20000)); + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_FEL_STEAK: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 44.0f, true) ) - { - DoResetThreat(); - me->AddThreat(target, 50000.0f); - me->CastSpell(target, SPELL_FEL_STEAK_MORPH, true); - me->CastSpell(target, SPELL_FEL_STEAK, true); - events.RepeatEvent(30000); - } - else - events.RepeatEvent(5000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_FEL_STEAK: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 44.0f, true) ) + { + DoResetThreat(); + me->AddThreat(target, 50000.0f); + me->CastSpell(target, SPELL_FEL_STEAK_MORPH, true); + me->CastSpell(target, SPELL_FEL_STEAK, true); + events.RepeatEvent(30000); + } + else + events.RepeatEvent(5000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - me->DespawnOrUnsummon(10000); - } + void JustDied(Unit* /*killer*/) + { + me->DespawnOrUnsummon(10000); + } - void EnterEvadeMode() - { - me->DespawnOrUnsummon(); - } - }; + void EnterEvadeMode() + { + me->DespawnOrUnsummon(); + } + }; }; class npc_mistress_of_pain : public CreatureScript { public: - npc_mistress_of_pain() : CreatureScript("npc_mistress_of_pain") { } + npc_mistress_of_pain() : CreatureScript("npc_mistress_of_pain") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_mistress_of_painAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_mistress_of_painAI(pCreature); + } - struct npc_mistress_of_painAI : public ScriptedAI - { - npc_mistress_of_painAI(Creature* pCreature) : ScriptedAI(pCreature) {} + struct npc_mistress_of_painAI : public ScriptedAI + { + npc_mistress_of_painAI(Creature* pCreature) : ScriptedAI(pCreature) {} - EventMap events; + EventMap events; - void Reset() - { - if( Unit* target = me->SelectNearestTarget(200.0f) ) - { - AttackStart(target); - DoZoneInCombat(); - } - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_SHIVAN_SLASH, urand(10000,20000)); - events.RescheduleEvent(EVENT_SPELL_SPINNING_PAIN_SPIKE, urand(22000,30000)); - if( IsHeroic() ) - events.RescheduleEvent(EVENT_SPELL_MISTRESS_KISS, urand(10000,15000)); - } + void Reset() + { + if( Unit* target = me->SelectNearestTarget(200.0f) ) + { + AttackStart(target); + DoZoneInCombat(); + } + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_SHIVAN_SLASH, urand(10000,20000)); + events.RescheduleEvent(EVENT_SPELL_SPINNING_PAIN_SPIKE, urand(22000,30000)); + if( IsHeroic() ) + events.RescheduleEvent(EVENT_SPELL_MISTRESS_KISS, urand(10000,15000)); + } - void SpellHit(Unit* caster, const SpellInfo* spell) - { - //if (caster && spell && spell->Id == 66287 /*control vehicle*/) - // caster->ClearUnitState(UNIT_STATE_ONVEHICLE); - } + void SpellHit(Unit* caster, const SpellInfo* spell) + { + //if (caster && spell && spell->Id == 66287 /*control vehicle*/) + // caster->ClearUnitState(UNIT_STATE_ONVEHICLE); + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_SHIVAN_SLASH: - if( me->GetVictim() ) - me->CastSpell(me->GetVictim(), SPELL_SHIVAN_SLASH, false); - events.RepeatEvent(urand(15000,25000)); - break; - case EVENT_SPELL_SPINNING_PAIN_SPIKE: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 140.0f, true) ) - me->CastSpell(target, SPELL_SPINNING_PAIN_SPIKE, false); - events.RepeatEvent(urand(25000,30000)); - break; - case EVENT_SPELL_MISTRESS_KISS: - me->CastSpell((Unit*)NULL, SPELL_MISTRESS_KISS, false); - events.RepeatEvent(urand(25000,35000)); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_SHIVAN_SLASH: + if( me->GetVictim() ) + me->CastSpell(me->GetVictim(), SPELL_SHIVAN_SLASH, false); + events.RepeatEvent(urand(15000,25000)); + break; + case EVENT_SPELL_SPINNING_PAIN_SPIKE: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 140.0f, true) ) + me->CastSpell(target, SPELL_SPINNING_PAIN_SPIKE, false); + events.RepeatEvent(urand(25000,30000)); + break; + case EVENT_SPELL_MISTRESS_KISS: + me->CastSpell((Unit*)NULL, SPELL_MISTRESS_KISS, false); + events.RepeatEvent(urand(25000,35000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - me->DespawnOrUnsummon(10000); - } + void JustDied(Unit* /*killer*/) + { + me->DespawnOrUnsummon(10000); + } - void EnterEvadeMode() - { - me->DespawnOrUnsummon(); - } - }; + void EnterEvadeMode() + { + me->DespawnOrUnsummon(); + } + }; }; class spell_toc25_mistress_kiss : public SpellScriptLoader { public: - spell_toc25_mistress_kiss() : SpellScriptLoader("spell_toc25_mistress_kiss") { } + spell_toc25_mistress_kiss() : SpellScriptLoader("spell_toc25_mistress_kiss") { } - class spell_toc25_mistress_kiss_AuraScript : public AuraScript - { - PrepareAuraScript(spell_toc25_mistress_kiss_AuraScript) + class spell_toc25_mistress_kiss_AuraScript : public AuraScript + { + PrepareAuraScript(spell_toc25_mistress_kiss_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (Unit* caster = GetCaster()) - if (Unit* target = GetTarget()) - if( target->HasUnitState(UNIT_STATE_CASTING) ) - { - caster->CastSpell(target, 66359, true); - SetDuration(0); - } - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (Unit* caster = GetCaster()) + if (Unit* target = GetTarget()) + if( target->HasUnitState(UNIT_STATE_CASTING) ) + { + caster->CastSpell(target, 66359, true); + SetDuration(0); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_toc25_mistress_kiss_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_toc25_mistress_kiss_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_toc25_mistress_kiss_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_toc25_mistress_kiss_AuraScript(); + } }; class spell_mistress_kiss_area : public SpellScriptLoader @@ -469,8 +469,8 @@ class spell_mistress_kiss_area : public SpellScriptLoader void FilterTargets(std::list& targets) { // get a list of players with mana - targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); - targets.remove_if(Trinity::PowerCheck(POWER_MANA, false)); + targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); + targets.remove_if(Trinity::PowerCheck(POWER_MANA, false)); if (targets.empty()) return; @@ -499,9 +499,9 @@ class spell_mistress_kiss_area : public SpellScriptLoader void AddSC_boss_jaraxxus() { - new boss_jaraxxus(); - new npc_fel_infernal(); - new npc_mistress_of_pain(); - new spell_toc25_mistress_kiss(); - new spell_mistress_kiss_area(); + new boss_jaraxxus(); + new npc_fel_infernal(); + new npc_mistress_of_pain(); + new spell_toc25_mistress_kiss(); + new spell_mistress_kiss_area(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 0ad5f86a2..167dc8894 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -14,35 +14,35 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum GormokSpells { - SPELL_IMPALE = 66331, - SPELL_STAGGERING_STOMP = 67648, - SPELL_RISING_ANGER = 66636, - SPELL_CHANGE_VEHICLE = 66342, // custom spell - //Snobold - SPELL_SNOBOLLED = 66406, - SPELL_BATTER = 66408, - SPELL_FIRE_BOMB = 66313, - SPELL_FIRE_BOMB_AURA = 66318, - SPELL_HEAD_CRACK = 66407, + SPELL_IMPALE = 66331, + SPELL_STAGGERING_STOMP = 67648, + SPELL_RISING_ANGER = 66636, + SPELL_CHANGE_VEHICLE = 66342, // custom spell + //Snobold + SPELL_SNOBOLLED = 66406, + SPELL_BATTER = 66408, + SPELL_FIRE_BOMB = 66313, + SPELL_FIRE_BOMB_AURA = 66318, + SPELL_HEAD_CRACK = 66407, }; enum GormokEvents { - EVENT_SPELL_IMPALE = 1, - EVENT_SPELL_STAGGERING_STOMP, - EVENT_PICK_SNOBOLD_TARGET, - EVENT_RELEASE_SNOBOLD, + EVENT_SPELL_IMPALE = 1, + EVENT_SPELL_STAGGERING_STOMP, + EVENT_PICK_SNOBOLD_TARGET, + EVENT_RELEASE_SNOBOLD, - EVENT_SPELL_SNOBOLLED, - EVENT_SPELL_BATTER, - EVENT_SPELL_FIRE_BOMB, - EVENT_SPELL_HEAD_CRACK, + EVENT_SPELL_SNOBOLLED, + EVENT_SPELL_BATTER, + EVENT_SPELL_FIRE_BOMB, + EVENT_SPELL_HEAD_CRACK, }; enum GormokNPCs { - NPC_SNOBOLD_VASSAL = 34800, - NPC_FIRE_BOMB = 34854, + NPC_SNOBOLD_VASSAL = 34800, + NPC_FIRE_BOMB = 34854, }; enum Yells @@ -52,8 +52,8 @@ enum Yells // Acidmaw & Dreadscale EMOTE_ENRAGE = 0, - EMOTE_SUBMERGE = 1, - EMOTE_EMERGE = 2, + EMOTE_SUBMERGE = 1, + EMOTE_EMERGE = 2, // Icehowl EMOTE_TRAMPLE_STARE = 0, @@ -64,341 +64,341 @@ enum Yells class npc_snobold_vassal : public CreatureScript { public: - npc_snobold_vassal() : CreatureScript("npc_snobold_vassal") { } + npc_snobold_vassal() : CreatureScript("npc_snobold_vassal") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_snobold_vassalAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_snobold_vassalAI(pCreature); + } - struct npc_snobold_vassalAI : public ScriptedAI - { - npc_snobold_vassalAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - TargetGUID = 0; - me->SetReactState(REACT_PASSIVE); - } + struct npc_snobold_vassalAI : public ScriptedAI + { + npc_snobold_vassalAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + TargetGUID = 0; + me->SetReactState(REACT_PASSIVE); + } - InstanceScript* pInstance; - EventMap events; - uint64 TargetGUID; + InstanceScript* pInstance; + EventMap events; + uint64 TargetGUID; - void Reset() - { - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_FIRE_BOMB, urand(10000,30000)); - } + void Reset() + { + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_FIRE_BOMB, urand(10000,30000)); + } - void EnterCombat(Unit* who) - { - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_SNOBOLLED, 1500); - events.ScheduleEvent(EVENT_SPELL_BATTER, 5000); - events.ScheduleEvent(EVENT_SPELL_HEAD_CRACK, 25000); - } + void EnterCombat(Unit* who) + { + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_SNOBOLLED, 1500); + events.ScheduleEvent(EVENT_SPELL_BATTER, 5000); + events.ScheduleEvent(EVENT_SPELL_HEAD_CRACK, 25000); + } - void AttackStart(Unit* who) - { - if( who->GetGUID() != TargetGUID ) - return; - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if( who->GetGUID() != TargetGUID ) + return; + ScriptedAI::AttackStart(who); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(uint32 diff) - { - if( !TargetGUID && !me->GetVehicle() ) - return; + void UpdateAI(uint32 diff) + { + if( !TargetGUID && !me->GetVehicle() ) + return; - Unit* t = ObjectAccessor::GetUnit(*me, TargetGUID); - if( !t && !(t = me->GetVehicleBase()) ) - return; + Unit* t = ObjectAccessor::GetUnit(*me, TargetGUID); + if( !t && !(t = me->GetVehicleBase()) ) + return; - if( t->isDead() ) - { - t->RemoveAura(SPELL_CHANGE_VEHICLE); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->SetHealth(me->GetMaxHealth()); - if( pInstance ) - if( Creature* gormok = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_GORMOK)) ) - if( gormok->IsAlive() ) - if( Vehicle* vk = gormok->GetVehicleKit() ) - for( uint8 i=0; i<4; ++i ) - if( !vk->GetPassenger(i) ) - { - me->EnterVehicleUnattackable(gormok, i); - Reset(); - break; - } - TargetGUID = 0; - return; - } + if( t->isDead() ) + { + t->RemoveAura(SPELL_CHANGE_VEHICLE); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->SetHealth(me->GetMaxHealth()); + if( pInstance ) + if( Creature* gormok = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_GORMOK)) ) + if( gormok->IsAlive() ) + if( Vehicle* vk = gormok->GetVehicleKit() ) + for( uint8 i=0; i<4; ++i ) + if( !vk->GetPassenger(i) ) + { + me->EnterVehicleUnattackable(gormok, i); + Reset(); + break; + } + TargetGUID = 0; + return; + } - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_SNOBOLLED: - if( t->GetTypeId() == TYPEID_PLAYER ) - me->CastSpell((Unit*)NULL, SPELL_SNOBOLLED, true); - events.PopEvent(); - break; - case EVENT_SPELL_BATTER: - if( t->GetTypeId() == TYPEID_PLAYER ) - me->CastSpell(t, SPELL_BATTER); - events.RepeatEvent(urand(6000,8000)); - break; - case EVENT_SPELL_FIRE_BOMB: - { - if( t->GetTypeId() != TYPEID_PLAYER && pInstance ) - { - std::vector validPlayers; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - Creature* gormok = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_GORMOK)); + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_SNOBOLLED: + if( t->GetTypeId() == TYPEID_PLAYER ) + me->CastSpell((Unit*)NULL, SPELL_SNOBOLLED, true); + events.PopEvent(); + break; + case EVENT_SPELL_BATTER: + if( t->GetTypeId() == TYPEID_PLAYER ) + me->CastSpell(t, SPELL_BATTER); + events.RepeatEvent(urand(6000,8000)); + break; + case EVENT_SPELL_FIRE_BOMB: + { + if( t->GetTypeId() != TYPEID_PLAYER && pInstance ) + { + std::vector validPlayers; + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + Creature* gormok = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_GORMOK)); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - { - if( Player* p = itr->GetSource() ) - if( p->IsAlive() && p->GetGUID()!=TargetGUID && (!gormok || !p->IsWithinMeleeRange(gormok)) ) - validPlayers.push_back(p->GetGUID()); - } + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + { + if( Player* p = itr->GetSource() ) + if( p->IsAlive() && p->GetGUID()!=TargetGUID && (!gormok || !p->IsWithinMeleeRange(gormok)) ) + validPlayers.push_back(p->GetGUID()); + } - if( !validPlayers.empty() ) - if( Player* p = ObjectAccessor::GetPlayer(*me, validPlayers.at(urand(0,validPlayers.size()-1))) ) - if( Creature* trigger = me->SummonCreature(NPC_FIRE_BOMB, *p, TEMPSUMMON_TIMED_DESPAWN, 60000) ) - { - me->CastSpell(trigger, SPELL_FIRE_BOMB_AURA, true); // periodic damage aura, speed 14.0f - me->CastSpell(trigger, SPELL_FIRE_BOMB); // visual + initial damage 4k - } - } + if( !validPlayers.empty() ) + if( Player* p = ObjectAccessor::GetPlayer(*me, validPlayers.at(urand(0,validPlayers.size()-1))) ) + if( Creature* trigger = me->SummonCreature(NPC_FIRE_BOMB, *p, TEMPSUMMON_TIMED_DESPAWN, 60000) ) + { + me->CastSpell(trigger, SPELL_FIRE_BOMB_AURA, true); // periodic damage aura, speed 14.0f + me->CastSpell(trigger, SPELL_FIRE_BOMB); // visual + initial damage 4k + } + } - events.RepeatEvent(urand(20000,30000)); - } - break; - case EVENT_SPELL_HEAD_CRACK: - if( t->GetTypeId() == TYPEID_PLAYER ) - me->CastSpell(t, SPELL_HEAD_CRACK); - events.RepeatEvent(urand(30000,35000)); - break; - } + events.RepeatEvent(urand(20000,30000)); + } + break; + case EVENT_SPELL_HEAD_CRACK: + if( t->GetTypeId() == TYPEID_PLAYER ) + me->CastSpell(t, SPELL_HEAD_CRACK); + events.RepeatEvent(urand(30000,35000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*pKiller*/) - { - if( Unit* t = ObjectAccessor::GetUnit(*me, TargetGUID)) - { - t->RemoveAura(SPELL_CHANGE_VEHICLE); - if( t->IsAlive() ) - t->RemoveAurasDueToSpell(SPELL_SNOBOLLED); - } - } + void JustDied(Unit* /*pKiller*/) + { + if( Unit* t = ObjectAccessor::GetUnit(*me, TargetGUID)) + { + t->RemoveAura(SPELL_CHANGE_VEHICLE); + if( t->IsAlive() ) + t->RemoveAurasDueToSpell(SPELL_SNOBOLLED); + } + } - void DoAction(int32 param) - { - if( param == 1 && !TargetGUID ) - me->DespawnOrUnsummon(); - } - }; + void DoAction(int32 param) + { + if( param == 1 && !TargetGUID ) + me->DespawnOrUnsummon(); + } + }; }; class boss_gormok : public CreatureScript { public: - boss_gormok() : CreatureScript("boss_gormok") { } + boss_gormok() : CreatureScript("boss_gormok") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_gormokAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_gormokAI(pCreature); + } - struct boss_gormokAI : public ScriptedAI - { - boss_gormokAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetReactState(REACT_PASSIVE); - } + struct boss_gormokAI : public ScriptedAI + { + boss_gormokAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetReactState(REACT_PASSIVE); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint64 PlayerGUID; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint64 PlayerGUID; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - PlayerGUID = 0; - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + PlayerGUID = 0; + } - void EnterCombat(Unit* /*who*/) - { - me->setActive(true); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_IMPALE, urand(9000,10000)); - events.RescheduleEvent(EVENT_SPELL_STAGGERING_STOMP, 15000); - events.RescheduleEvent(EVENT_PICK_SNOBOLD_TARGET, urand(16000,24000)); + void EnterCombat(Unit* /*who*/) + { + me->setActive(true); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_IMPALE, urand(9000,10000)); + events.RescheduleEvent(EVENT_SPELL_STAGGERING_STOMP, 15000); + events.RescheduleEvent(EVENT_PICK_SNOBOLD_TARGET, urand(16000,24000)); - // refresh snobold position - if( Vehicle* vk = me->GetVehicleKit() ) - for( uint8 i=0; i<4; ++i ) - if( Unit* snobold = vk->GetPassenger(i) ) - snobold->SendMovementFlagUpdate(); - } + // refresh snobold position + if( Vehicle* vk = me->GetVehicleKit() ) + for( uint8 i=0; i<4; ++i ) + if( Unit* snobold = vk->GetPassenger(i) ) + snobold->SendMovementFlagUpdate(); + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_IMPALE: - if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) - { - if( Unit* victim = me->GetVictim() ) - me->CastSpell(victim, SPELL_IMPALE, false); - events.RepeatEvent(urand(9000,10000)); - } - else - events.RepeatEvent(2500); - break; - case EVENT_SPELL_STAGGERING_STOMP: - me->CastSpell((Unit*)NULL, SPELL_STAGGERING_STOMP, false); - events.RepeatEvent(urand(20000,25000)); - break; - case EVENT_PICK_SNOBOLD_TARGET: - if( Vehicle* vk = me->GetVehicleKit() ) - for( uint8 i=0; i<4; ++i ) - if( Unit* snobold = vk->GetPassenger(i) ) - { - std::vector validPlayers; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - { - if( Player* p = itr->GetSource() ) - if( p->IsAlive() && !p->GetVehicleKit() && !p->IsMounted() && !p->GetVehicle() && !p->IsGameMaster() ) - validPlayers.push_back(p->GetGUID()); - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_IMPALE: + if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) ) + { + if( Unit* victim = me->GetVictim() ) + me->CastSpell(victim, SPELL_IMPALE, false); + events.RepeatEvent(urand(9000,10000)); + } + else + events.RepeatEvent(2500); + break; + case EVENT_SPELL_STAGGERING_STOMP: + me->CastSpell((Unit*)NULL, SPELL_STAGGERING_STOMP, false); + events.RepeatEvent(urand(20000,25000)); + break; + case EVENT_PICK_SNOBOLD_TARGET: + if( Vehicle* vk = me->GetVehicleKit() ) + for( uint8 i=0; i<4; ++i ) + if( Unit* snobold = vk->GetPassenger(i) ) + { + std::vector validPlayers; + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + { + if( Player* p = itr->GetSource() ) + if( p->IsAlive() && !p->GetVehicleKit() && !p->IsMounted() && !p->GetVehicle() && !p->IsGameMaster() ) + validPlayers.push_back(p->GetGUID()); + } - if( !validPlayers.empty() ) - if( Player* p = ObjectAccessor::GetPlayer(*me, validPlayers.at(urand(0,validPlayers.size()-1))) ) - { - snobold->ChangeSeat(4); // switch to hand - me->setAttackTimer(BASE_ATTACK, 3000); - PlayerGUID = p->GetGUID(); - events.RescheduleEvent(EVENT_RELEASE_SNOBOLD, 2500); - } + if( !validPlayers.empty() ) + if( Player* p = ObjectAccessor::GetPlayer(*me, validPlayers.at(urand(0,validPlayers.size()-1))) ) + { + snobold->ChangeSeat(4); // switch to hand + me->setAttackTimer(BASE_ATTACK, 3000); + PlayerGUID = p->GetGUID(); + events.RescheduleEvent(EVENT_RELEASE_SNOBOLD, 2500); + } - break; - } - events.RepeatEvent(urand(16000,24000)); - break; - case EVENT_RELEASE_SNOBOLD: - { - me->CastSpell(me, SPELL_RISING_ANGER, true); - Player* p = ObjectAccessor::GetPlayer(*me, PlayerGUID); - if( p && p->IsAlive() && !p->GetVehicleKit() && !p->IsMounted() && !p->GetVehicle() ) - { - if( Vehicle* vk = me->GetVehicleKit() ) - if( Unit* snobold = vk->GetPassenger(4) ) - { - if( snobold->GetTypeId() == TYPEID_UNIT ) - { - CAST_AI(npc_snobold_vassal::npc_snobold_vassalAI, snobold->ToCreature()->AI())->TargetGUID = PlayerGUID; - snobold->ToCreature()->AI()->AttackStart(p); - } - //Talk(EMOTE_SNOBOLLED); - p->CastSpell(p, SPELL_CHANGE_VEHICLE, true); - snobold->EnterVehicle(p, 0); - //snobold->ClearUnitState(UNIT_STATE_ONVEHICLE); - } - } - else if( Vehicle* vk = me->GetVehicleKit() ) - { - events.RescheduleEvent(EVENT_PICK_SNOBOLD_TARGET, 5000); // player not found (died? left instance?), pick new one faster! - if( Unit* snobold = vk->GetPassenger(4) ) - if( snobold->GetTypeId() == TYPEID_UNIT ) - { - bool needDespawn = true; - for( uint8 i=0; i<4; ++i ) - if( !vk->GetPassenger(i) ) - { - snobold->ChangeSeat(i); - needDespawn = false; - break; - } - if( needDespawn ) - snobold->ToCreature()->DespawnOrUnsummon(); - } - } - PlayerGUID = 0; - events.PopEvent(); - } - break; - } + break; + } + events.RepeatEvent(urand(16000,24000)); + break; + case EVENT_RELEASE_SNOBOLD: + { + me->CastSpell(me, SPELL_RISING_ANGER, true); + Player* p = ObjectAccessor::GetPlayer(*me, PlayerGUID); + if( p && p->IsAlive() && !p->GetVehicleKit() && !p->IsMounted() && !p->GetVehicle() ) + { + if( Vehicle* vk = me->GetVehicleKit() ) + if( Unit* snobold = vk->GetPassenger(4) ) + { + if( snobold->GetTypeId() == TYPEID_UNIT ) + { + CAST_AI(npc_snobold_vassal::npc_snobold_vassalAI, snobold->ToCreature()->AI())->TargetGUID = PlayerGUID; + snobold->ToCreature()->AI()->AttackStart(p); + } + //Talk(EMOTE_SNOBOLLED); + p->CastSpell(p, SPELL_CHANGE_VEHICLE, true); + snobold->EnterVehicle(p, 0); + //snobold->ClearUnitState(UNIT_STATE_ONVEHICLE); + } + } + else if( Vehicle* vk = me->GetVehicleKit() ) + { + events.RescheduleEvent(EVENT_PICK_SNOBOLD_TARGET, 5000); // player not found (died? left instance?), pick new one faster! + if( Unit* snobold = vk->GetPassenger(4) ) + if( snobold->GetTypeId() == TYPEID_UNIT ) + { + bool needDespawn = true; + for( uint8 i=0; i<4; ++i ) + if( !vk->GetPassenger(i) ) + { + snobold->ChangeSeat(i); + needDespawn = false; + break; + } + if( needDespawn ) + snobold->ToCreature()->DespawnOrUnsummon(); + } + } + PlayerGUID = 0; + events.PopEvent(); + } + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*pKiller*/) - { - summons.DoAction(1); + void JustDied(Unit* /*pKiller*/) + { + summons.DoAction(1); - if( pInstance ) - pInstance->SetData(TYPE_GORMOK, DONE); - } + if( pInstance ) + pInstance->SetData(TYPE_GORMOK, DONE); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void DoAction(int32 param) - { - switch( param ) - { - case -1: - summons.DespawnAll(); - break; - } - } + void DoAction(int32 param) + { + switch( param ) + { + case -1: + summons.DespawnAll(); + break; + } + } - void EnterEvadeMode() - { - events.Reset(); - summons.DespawnAll(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( pInstance ) - pInstance->SetData(TYPE_FAILED, 1); - } - }; + void EnterEvadeMode() + { + events.Reset(); + summons.DespawnAll(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( pInstance ) + pInstance->SetData(TYPE_FAILED, 1); + } + }; }; @@ -408,313 +408,313 @@ public: enum JormungarSpells { - SPELL_ACID_SPIT = 66880, - SPELL_ACID_SPEW = 66818, - SPELL_PARALYTIC_SPRAY = 66901, - SPELL_PARALYTIC_BITE = 66824, + SPELL_ACID_SPIT = 66880, + SPELL_ACID_SPEW = 66818, + SPELL_PARALYTIC_SPRAY = 66901, + SPELL_PARALYTIC_BITE = 66824, - SPELL_FIRE_SPIT = 66796, - SPELL_MOLTEN_SPEW = 66821, - SPELL_BURNING_SPRAY = 66902, - SPELL_BURNING_BITE = 66879, + SPELL_FIRE_SPIT = 66796, + SPELL_MOLTEN_SPEW = 66821, + SPELL_BURNING_SPRAY = 66902, + SPELL_BURNING_BITE = 66879, - SUMMON_SLIME_POOL = 66883, - SPELL_SLIME_POOL_EFFECT = 66882, - SPELL_SWEEP_0 = 66794, - SPELL_SWEEP_1 = 67646, + SUMMON_SLIME_POOL = 66883, + SPELL_SLIME_POOL_EFFECT = 66882, + SPELL_SWEEP_0 = 66794, + SPELL_SWEEP_1 = 67646, - SPELL_EMERGE_0 = 66947, - SPELL_SUBMERGE_0 = 53421, - SPELL_ENRAGE = 68335, - SPELL_CHURNING_GROUND = 66969, + SPELL_EMERGE_0 = 66947, + SPELL_SUBMERGE_0 = 53421, + SPELL_ENRAGE = 68335, + SPELL_CHURNING_GROUND = 66969, }; enum Model { - MODEL_ACIDMAW_STATIONARY = 29815, - MODEL_ACIDMAW_MOBILE = 29816, - MODEL_DREADSCALE_STATIONARY = 26935, - MODEL_DREADSCALE_MOBILE = 24564, + MODEL_ACIDMAW_STATIONARY = 29815, + MODEL_ACIDMAW_MOBILE = 29816, + MODEL_DREADSCALE_STATIONARY = 26935, + MODEL_DREADSCALE_MOBILE = 24564, }; enum JormungarNPCs { - NPC_SLIME_POOL = 35176, + NPC_SLIME_POOL = 35176, }; enum JormungarEvents { - EVENT_SUBMERGE = 1, - EVENT_EMERGE, - EVENT_MOVE_UNDERGROUND, + EVENT_SUBMERGE = 1, + EVENT_EMERGE, + EVENT_MOVE_UNDERGROUND, - EVENT_SPELL_SPRAY, - EVENT_SPELL_SWEEP, - EVENT_SPELL_BITE, - EVENT_SPELL_SPEW, - EVENT_SPELL_SLIME_POOL, + EVENT_SPELL_SPRAY, + EVENT_SPELL_SWEEP, + EVENT_SPELL_BITE, + EVENT_SPELL_SPEW, + EVENT_SPELL_SLIME_POOL, }; struct boss_jormungarAI : public ScriptedAI { - boss_jormungarAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - me->SetReactState(REACT_PASSIVE); - } + boss_jormungarAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + me->SetReactState(REACT_PASSIVE); + } - InstanceScript* pInstance; - EventMap events; - bool bIsStationary; + InstanceScript* pInstance; + EventMap events; + bool bIsStationary; - uint32 _SPELL_BITE; - uint32 _SPELL_SPEW; - uint32 _SPELL_SPIT; - uint32 _SPELL_SPRAY; - uint32 _MODEL_STATIONARY; - uint32 _MODEL_MOBILE; - uint32 _TYPE_OTHER; + uint32 _SPELL_BITE; + uint32 _SPELL_SPEW; + uint32 _SPELL_SPIT; + uint32 _SPELL_SPRAY; + uint32 _MODEL_STATIONARY; + uint32 _MODEL_MOBILE; + uint32 _TYPE_OTHER; - void DoAction(int32 param) - { - switch( param ) - { - case -1: - if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) - events.RescheduleEvent(EVENT_SUBMERGE, 1500); - break; - case -2: - if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) - bIsStationary = true; // it will come out mobile soon - else if( me->GetDisplayId() == _MODEL_STATIONARY ) - events.RescheduleEvent(EVENT_SUBMERGE, 1000); - else - events.CancelEvent(EVENT_SUBMERGE); - me->CastSpell(me, SPELL_ENRAGE, true); - Talk(EMOTE_ENRAGE); - break; - } - } + void DoAction(int32 param) + { + switch( param ) + { + case -1: + if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) + events.RescheduleEvent(EVENT_SUBMERGE, 1500); + break; + case -2: + if( me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) + bIsStationary = true; // it will come out mobile soon + else if( me->GetDisplayId() == _MODEL_STATIONARY ) + events.RescheduleEvent(EVENT_SUBMERGE, 1000); + else + events.CancelEvent(EVENT_SUBMERGE); + me->CastSpell(me, SPELL_ENRAGE, true); + Talk(EMOTE_ENRAGE); + break; + } + } - void ScheduleEvents() - { - events.Reset(); - if( me->GetDisplayId() == _MODEL_STATIONARY ) - { - me->SetAttackTime(BASE_ATTACK, 1500); - events.RescheduleEvent(EVENT_SPELL_SPRAY, (me->GetEntry() == NPC_ACIDMAW ? 20000 : 15000)); - events.RescheduleEvent(EVENT_SPELL_SWEEP, urand(15000,30000)); - } - else - { - me->SetAttackTime(BASE_ATTACK, 2000); - events.RescheduleEvent(EVENT_SPELL_BITE, (me->GetEntry() == NPC_ACIDMAW ? 20000 : 15000)); - events.RescheduleEvent(EVENT_SPELL_SPEW, urand(15000,30000)); - events.RescheduleEvent(EVENT_SPELL_SLIME_POOL, 15000); - } - if( !me->HasAura(SPELL_ENRAGE) ) - events.RescheduleEvent(EVENT_SUBMERGE, urand(45000,50000)); - } + void ScheduleEvents() + { + events.Reset(); + if( me->GetDisplayId() == _MODEL_STATIONARY ) + { + me->SetAttackTime(BASE_ATTACK, 1500); + events.RescheduleEvent(EVENT_SPELL_SPRAY, (me->GetEntry() == NPC_ACIDMAW ? 20000 : 15000)); + events.RescheduleEvent(EVENT_SPELL_SWEEP, urand(15000,30000)); + } + else + { + me->SetAttackTime(BASE_ATTACK, 2000); + events.RescheduleEvent(EVENT_SPELL_BITE, (me->GetEntry() == NPC_ACIDMAW ? 20000 : 15000)); + events.RescheduleEvent(EVENT_SPELL_SPEW, urand(15000,30000)); + events.RescheduleEvent(EVENT_SPELL_SLIME_POOL, 15000); + } + if( !me->HasAura(SPELL_ENRAGE) ) + events.RescheduleEvent(EVENT_SUBMERGE, urand(45000,50000)); + } - void EnterCombat(Unit* /*who*/) - { - me->setActive(true); - ScheduleEvents(); - } + void EnterCombat(Unit* /*who*/) + { + me->setActive(true); + ScheduleEvents(); + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - void AttackStart(Unit* who) - { - if( me->GetDisplayId() == _MODEL_STATIONARY ) - { - if( !who ) - return; - if( me->Attack(who, true) ) - DoStartNoMovement(who); - } - else - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if( me->GetDisplayId() == _MODEL_STATIONARY ) + { + if( !who ) + return; + if( me->Attack(who, true) ) + DoStartNoMovement(who); + } + else + ScriptedAI::AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SUBMERGE: - { - bIsStationary = me->GetDisplayId() == _MODEL_STATIONARY ? true : false; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->CastSpell(me, SPELL_SUBMERGE_0, false); - Talk(EMOTE_SUBMERGE); + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SUBMERGE: + { + bIsStationary = me->GetDisplayId() == _MODEL_STATIONARY ? true : false; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->CastSpell(me, SPELL_SUBMERGE_0, false); + Talk(EMOTE_SUBMERGE); - // second one submerge 1.5sec after the first one, used also for synchronizing - if( pInstance ) - if( Creature* c = ObjectAccessor::GetCreature(*me, pInstance->GetData64(_TYPE_OTHER)) ) - c->AI()->DoAction(-1); + // second one submerge 1.5sec after the first one, used also for synchronizing + if( pInstance ) + if( Creature* c = ObjectAccessor::GetCreature(*me, pInstance->GetData64(_TYPE_OTHER)) ) + c->AI()->DoAction(-1); - events.Reset(); - events.RescheduleEvent(EVENT_MOVE_UNDERGROUND, 2500); - } - break; - case EVENT_MOVE_UNDERGROUND: - { - float angle=me->GetAngle(Locs[LOC_CENTER].GetPositionX()+urand(0,20)-10.0f, Locs[LOC_CENTER].GetPositionY()+urand(0,20)-10.0f), dist=urand(10,35); - if( Creature* c = me->SummonCreature(NPC_WORLD_TRIGGER, *me, TEMPSUMMON_TIMED_DESPAWN, 6000) ) - { - c->SetSpeed(MOVE_RUN, 2.5f); - c->CastSpell(c, SPELL_CHURNING_GROUND, true); - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); - c->GetMotionMaster()->MovePoint(0, Locs[LOC_CENTER].GetPositionX()+cos(angle)*dist, Locs[LOC_CENTER].GetPositionY()+sin(angle)*dist, me->GetPositionZ()); - } - me->UpdatePosition(Locs[LOC_CENTER].GetPositionX()+cos(angle)*dist, Locs[LOC_CENTER].GetPositionY()+sin(angle)*dist, me->GetPositionZ(), me->GetOrientation(), true); - me->StopMovingOnCurrentPos(); - DoResetThreat(); - events.PopEvent(); - events.RescheduleEvent(EVENT_EMERGE, 6000); - } - break; - case EVENT_EMERGE: - { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - if( bIsStationary ) - { - me->SetNativeDisplayId(_MODEL_MOBILE); - SetCombatMovement(true); - if( Unit* victim = me->GetVictim() ) - me->GetMotionMaster()->MoveChase(victim); - } - else - { - me->SetNativeDisplayId(_MODEL_STATIONARY); - SetCombatMovement(false); - } - me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); - me->CastSpell(me, SPELL_EMERGE_0, false); - Talk(EMOTE_EMERGE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - ScheduleEvents(); - } - break; - case EVENT_SPELL_SPRAY: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true) ) - me->CastSpell(target, _SPELL_SPRAY, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_SWEEP: - me->CastSpell((Unit*)NULL, SPELL_SWEEP_0, false); - events.RepeatEvent(urand(15000,30000)); - break; - case EVENT_SPELL_BITE: - if( Unit* victim = me->GetVictim() ) - me->CastSpell(victim, _SPELL_BITE, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_SPEW: - me->CastSpell(me->GetVictim(), _SPELL_SPEW, false); - events.RepeatEvent(urand(15000,30000)); - break; - case EVENT_SPELL_SLIME_POOL: - if( Creature* c = me->SummonCreature(NPC_SLIME_POOL, *me, TEMPSUMMON_TIMED_DESPAWN, 30000) ) - c->CastSpell(c, SPELL_SLIME_POOL_EFFECT, true); - events.RepeatEvent(30000); - break; - } + events.Reset(); + events.RescheduleEvent(EVENT_MOVE_UNDERGROUND, 2500); + } + break; + case EVENT_MOVE_UNDERGROUND: + { + float angle=me->GetAngle(Locs[LOC_CENTER].GetPositionX()+urand(0,20)-10.0f, Locs[LOC_CENTER].GetPositionY()+urand(0,20)-10.0f), dist=urand(10,35); + if( Creature* c = me->SummonCreature(NPC_WORLD_TRIGGER, *me, TEMPSUMMON_TIMED_DESPAWN, 6000) ) + { + c->SetSpeed(MOVE_RUN, 2.5f); + c->CastSpell(c, SPELL_CHURNING_GROUND, true); + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); + c->GetMotionMaster()->MovePoint(0, Locs[LOC_CENTER].GetPositionX()+cos(angle)*dist, Locs[LOC_CENTER].GetPositionY()+sin(angle)*dist, me->GetPositionZ()); + } + me->UpdatePosition(Locs[LOC_CENTER].GetPositionX()+cos(angle)*dist, Locs[LOC_CENTER].GetPositionY()+sin(angle)*dist, me->GetPositionZ(), me->GetOrientation(), true); + me->StopMovingOnCurrentPos(); + DoResetThreat(); + events.PopEvent(); + events.RescheduleEvent(EVENT_EMERGE, 6000); + } + break; + case EVENT_EMERGE: + { + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + if( bIsStationary ) + { + me->SetNativeDisplayId(_MODEL_MOBILE); + SetCombatMovement(true); + if( Unit* victim = me->GetVictim() ) + me->GetMotionMaster()->MoveChase(victim); + } + else + { + me->SetNativeDisplayId(_MODEL_STATIONARY); + SetCombatMovement(false); + } + me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); + me->CastSpell(me, SPELL_EMERGE_0, false); + Talk(EMOTE_EMERGE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + ScheduleEvents(); + } + break; + case EVENT_SPELL_SPRAY: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true) ) + me->CastSpell(target, _SPELL_SPRAY, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_SWEEP: + me->CastSpell((Unit*)NULL, SPELL_SWEEP_0, false); + events.RepeatEvent(urand(15000,30000)); + break; + case EVENT_SPELL_BITE: + if( Unit* victim = me->GetVictim() ) + me->CastSpell(victim, _SPELL_BITE, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_SPEW: + me->CastSpell(me->GetVictim(), _SPELL_SPEW, false); + events.RepeatEvent(urand(15000,30000)); + break; + case EVENT_SPELL_SLIME_POOL: + if( Creature* c = me->SummonCreature(NPC_SLIME_POOL, *me, TEMPSUMMON_TIMED_DESPAWN, 30000) ) + c->CastSpell(c, SPELL_SLIME_POOL_EFFECT, true); + events.RepeatEvent(30000); + break; + } - if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) - { - if( me->GetDisplayId() == _MODEL_STATIONARY ) - DoSpellAttackIfReady(_SPELL_SPIT); - else - DoMeleeAttackIfReady(); - } - } + if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) + { + if( me->GetDisplayId() == _MODEL_STATIONARY ) + DoSpellAttackIfReady(_SPELL_SPIT); + else + DoMeleeAttackIfReady(); + } + } - void JustDied(Unit* /*pKiller*/) - { - if( pInstance ) - { - if( Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(_TYPE_OTHER)) ) - if( c->IsAlive() ) - c->AI()->DoAction(-2); - pInstance->SetData(TYPE_JORMUNGAR, DONE); - } - } + void JustDied(Unit* /*pKiller*/) + { + if( pInstance ) + { + if( Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(_TYPE_OTHER)) ) + if( c->IsAlive() ) + c->AI()->DoAction(-2); + pInstance->SetData(TYPE_JORMUNGAR, DONE); + } + } - void EnterEvadeMode() - { - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( pInstance ) - pInstance->SetData(TYPE_FAILED, 1); - } + void EnterEvadeMode() + { + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( pInstance ) + pInstance->SetData(TYPE_FAILED, 1); + } }; class boss_acidmaw : public CreatureScript { - public: - boss_acidmaw() : CreatureScript("boss_acidmaw") { } + public: + boss_acidmaw() : CreatureScript("boss_acidmaw") { } - struct boss_acidmawAI : public boss_jormungarAI - { - boss_acidmawAI(Creature* pCreature) : boss_jormungarAI(pCreature) - { - _SPELL_BITE = SPELL_PARALYTIC_BITE; - _SPELL_SPEW = SPELL_ACID_SPEW; - _SPELL_SPIT = SPELL_ACID_SPIT; - _SPELL_SPRAY = SPELL_PARALYTIC_SPRAY; - _MODEL_STATIONARY = MODEL_ACIDMAW_STATIONARY; - _MODEL_MOBILE = MODEL_ACIDMAW_MOBILE; - _TYPE_OTHER = TYPE_DREADSCALE; - SetCombatMovement(false); - } - }; + struct boss_acidmawAI : public boss_jormungarAI + { + boss_acidmawAI(Creature* pCreature) : boss_jormungarAI(pCreature) + { + _SPELL_BITE = SPELL_PARALYTIC_BITE; + _SPELL_SPEW = SPELL_ACID_SPEW; + _SPELL_SPIT = SPELL_ACID_SPIT; + _SPELL_SPRAY = SPELL_PARALYTIC_SPRAY; + _MODEL_STATIONARY = MODEL_ACIDMAW_STATIONARY; + _MODEL_MOBILE = MODEL_ACIDMAW_MOBILE; + _TYPE_OTHER = TYPE_DREADSCALE; + SetCombatMovement(false); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_acidmawAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_acidmawAI(creature); + } }; class boss_dreadscale : public CreatureScript { public: - boss_dreadscale() : CreatureScript("boss_dreadscale") { } + boss_dreadscale() : CreatureScript("boss_dreadscale") { } - struct boss_dreadscaleAI : public boss_jormungarAI - { - boss_dreadscaleAI(Creature* pCreature) : boss_jormungarAI(pCreature) - { - _SPELL_BITE = SPELL_BURNING_BITE; - _SPELL_SPEW = SPELL_MOLTEN_SPEW; - _SPELL_SPIT = SPELL_FIRE_SPIT; - _SPELL_SPRAY = SPELL_BURNING_SPRAY; - _MODEL_STATIONARY = MODEL_DREADSCALE_STATIONARY; - _MODEL_MOBILE = MODEL_DREADSCALE_MOBILE; - _TYPE_OTHER = TYPE_ACIDMAW; - } - }; + struct boss_dreadscaleAI : public boss_jormungarAI + { + boss_dreadscaleAI(Creature* pCreature) : boss_jormungarAI(pCreature) + { + _SPELL_BITE = SPELL_BURNING_BITE; + _SPELL_SPEW = SPELL_MOLTEN_SPEW; + _SPELL_SPIT = SPELL_FIRE_SPIT; + _SPELL_SPRAY = SPELL_BURNING_SPRAY; + _MODEL_STATIONARY = MODEL_DREADSCALE_STATIONARY; + _MODEL_MOBILE = MODEL_DREADSCALE_MOBILE; + _TYPE_OTHER = TYPE_ACIDMAW; + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_dreadscaleAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_dreadscaleAI(pCreature); + } }; @@ -724,317 +724,317 @@ public: enum IcehowlSpells { - SPELL_FEROCIOUS_BUTT = 66770, - SPELL_WHIRL = 67345, - SPELL_ARCTIC_BREATH = 66689, + SPELL_FEROCIOUS_BUTT = 66770, + SPELL_WHIRL = 67345, + SPELL_ARCTIC_BREATH = 66689, - SPELL_MASSIVE_CRASH = 66683, - SPELL_JUMP_BACK = 66733, - SPELL_TRAMPLE = 66734, - SPELL_FROTHING_RAGE = 66759, - SPELL_STAGGERED_DAZE = 66758, - SPELL_BERSERK = 26662, - SPELL_SURGE_OF_ADRENALINE = 68667, + SPELL_MASSIVE_CRASH = 66683, + SPELL_JUMP_BACK = 66733, + SPELL_TRAMPLE = 66734, + SPELL_FROTHING_RAGE = 66759, + SPELL_STAGGERED_DAZE = 66758, + SPELL_BERSERK = 26662, + SPELL_SURGE_OF_ADRENALINE = 68667, }; enum IcehowlEvents { - EVENT_JUMP_MIDDLE = 1, - EVENT_GAZE, - EVENT_JUMP_BACK, - EVENT_TRAMPLE, - EVENT_CHECK_TRAMPLE_PLAYERS, - EVENT_REFRESH_POSITION, - EVENT_SPELL_FEROCIOUS_BUTT, - EVENT_SPELL_MASSIVE_CRASH, - EVENT_SPELL_WHIRL, - EVENT_SPELL_ARCTIC_BREATH, + EVENT_JUMP_MIDDLE = 1, + EVENT_GAZE, + EVENT_JUMP_BACK, + EVENT_TRAMPLE, + EVENT_CHECK_TRAMPLE_PLAYERS, + EVENT_REFRESH_POSITION, + EVENT_SPELL_FEROCIOUS_BUTT, + EVENT_SPELL_MASSIVE_CRASH, + EVENT_SPELL_WHIRL, + EVENT_SPELL_ARCTIC_BREATH, }; class boss_icehowl : public CreatureScript { public: - boss_icehowl() : CreatureScript("boss_icehowl") { } + boss_icehowl() : CreatureScript("boss_icehowl") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_icehowlAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_icehowlAI(pCreature); + } - struct boss_icehowlAI : public ScriptedAI - { - boss_icehowlAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetReactState(REACT_PASSIVE); - if (IsHeroic()) - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_DISPEL, true); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_DECREASE_SPEED, true); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_SPEED_NOT_STACK, true); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_SPEED_ALWAYS, true); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_SPEED_SLOW_ALL, true); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED, true); // judgement of justice - //me->SetLootMode(0); // [LOOT] - } + struct boss_icehowlAI : public ScriptedAI + { + boss_icehowlAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetReactState(REACT_PASSIVE); + if (IsHeroic()) + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_DISPEL, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_DECREASE_SPEED, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_SPEED_NOT_STACK, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_SPEED_ALWAYS, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_SPEED_SLOW_ALL, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED, true); // judgement of justice + //me->SetLootMode(0); // [LOOT] + } - InstanceScript* pInstance; - EventMap events; - uint64 TargetGUID; - float destX, destY, destZ; + InstanceScript* pInstance; + EventMap events; + uint64 TargetGUID; + float destX, destY, destZ; - void AttackStart(Unit* who) - { - if (me->GetReactState() != REACT_PASSIVE) - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (me->GetReactState() != REACT_PASSIVE) + ScriptedAI::AttackStart(who); + } - void EnterCombat(Unit* /*who*/) - { - me->setActive(true); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_FEROCIOUS_BUTT, urand(15000,30000)); - events.RescheduleEvent(EVENT_SPELL_WHIRL, urand(10000,12000)); - events.RescheduleEvent(EVENT_SPELL_ARCTIC_BREATH, 14000); - events.RescheduleEvent(EVENT_JUMP_MIDDLE, 30000); - } + void EnterCombat(Unit* /*who*/) + { + me->setActive(true); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_FEROCIOUS_BUTT, urand(15000,30000)); + events.RescheduleEvent(EVENT_SPELL_WHIRL, urand(10000,12000)); + events.RescheduleEvent(EVENT_SPELL_ARCTIC_BREATH, 14000); + events.RescheduleEvent(EVENT_JUMP_MIDDLE, 30000); + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - bool DoTrampleIfValid() - { - Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr ) - if( Unit* p = itr->GetSource() ) - if( p->IsAlive() && p->GetExactDist(me) <= 12.0f ) - { - DoCastAOE(SPELL_TRAMPLE); - return true; - } + bool DoTrampleIfValid() + { + Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr ) + if( Unit* p = itr->GetSource() ) + if( p->IsAlive() && p->GetExactDist(me) <= 12.0f ) + { + DoCastAOE(SPELL_TRAMPLE); + return true; + } - return false; - } + return false; + } - void MovementInform(uint32 type, uint32 id) - { - if( id == EVENT_CHARGE ) - { - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_FEROCIOUS_BUTT, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_WHIRL, urand(2000,5000)); - events.RescheduleEvent(EVENT_SPELL_ARCTIC_BREATH, urand(5000,8000)); - events.RescheduleEvent(EVENT_JUMP_MIDDLE, urand(30000,50000)); + void MovementInform(uint32 type, uint32 id) + { + if( id == EVENT_CHARGE ) + { + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_FEROCIOUS_BUTT, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_WHIRL, urand(2000,5000)); + events.RescheduleEvent(EVENT_SPELL_ARCTIC_BREATH, urand(5000,8000)); + events.RescheduleEvent(EVENT_JUMP_MIDDLE, urand(30000,50000)); - float angle = me->GetAngle(&Locs[LOC_CENTER]); - angle = angle >= M_PI ? angle-M_PI : angle+M_PI; + float angle = me->GetAngle(&Locs[LOC_CENTER]); + angle = angle >= M_PI ? angle-M_PI : angle+M_PI; - me->UpdatePosition(destX, destY, destZ, angle, true); - me->StopMovingOnCurrentPos(); + me->UpdatePosition(destX, destY, destZ, angle, true); + me->StopMovingOnCurrentPos(); - if( !DoTrampleIfValid() ) - { - me->CastSpell(me, SPELL_STAGGERED_DAZE, true); - me->CastSpell((Unit*)NULL, SPELL_TRAMPLE, true); - Talk(EMOTE_TRAMPLE_CRASH); - events.DelayEvents(15000); - } - else - { - Talk(EMOTE_TRAMPLE_FAIL); - me->CastSpell(me, SPELL_FROTHING_RAGE, true); - } + if( !DoTrampleIfValid() ) + { + me->CastSpell(me, SPELL_STAGGERED_DAZE, true); + me->CastSpell((Unit*)NULL, SPELL_TRAMPLE, true); + Talk(EMOTE_TRAMPLE_CRASH); + events.DelayEvents(15000); + } + else + { + Talk(EMOTE_TRAMPLE_FAIL); + me->CastSpell(me, SPELL_FROTHING_RAGE, true); + } - me->SetReactState(REACT_AGGRESSIVE); - } - } + me->SetReactState(REACT_AGGRESSIVE); + } + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_FEROCIOUS_BUTT: - if( Unit* victim = me->GetVictim() ) - me->CastSpell(victim, SPELL_FEROCIOUS_BUTT, false); - events.RepeatEvent(urand(15000,30000)); - break; - case EVENT_SPELL_WHIRL: - me->CastSpell((Unit*)NULL, SPELL_WHIRL, false); - events.RepeatEvent(urand(15000,20000)); - break; - case EVENT_SPELL_ARCTIC_BREATH: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 90.0f, true) ) - me->CastSpell(target, SPELL_ARCTIC_BREATH, false); - events.RepeatEvent(urand(20000,30000)); - break; - case EVENT_JUMP_MIDDLE: - me->StopMoving(); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - me->GetMotionMaster()->MoveJump(Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), 40.0f, 12.0f); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_MASSIVE_CRASH, 2000); - break; - case EVENT_SPELL_MASSIVE_CRASH: - me->GetMotionMaster()->Clear(); - me->CastSpell((Unit*)NULL, SPELL_MASSIVE_CRASH, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_GAZE, 2000); - break; - case EVENT_GAZE: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 500.0f, true) ) - { - TargetGUID = target->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, TargetGUID); - me->SetFacingToObject(target); - Talk(EMOTE_TRAMPLE_STARE, target); - me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - events.RescheduleEvent(EVENT_JUMP_BACK, 2000); - } - else // in case something went wrong - { - events.RescheduleEvent(EVENT_SPELL_FEROCIOUS_BUTT, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_WHIRL, urand(2000,5000)); - events.RescheduleEvent(EVENT_SPELL_ARCTIC_BREATH, urand(5000,8000)); - events.RescheduleEvent(EVENT_JUMP_MIDDLE, urand(30000,50000)); - me->GetMotionMaster()->MovementExpired(); - me->SetReactState(REACT_AGGRESSIVE); - } - events.PopEvent(); - break; - case EVENT_JUMP_BACK: - { - float angle; - if( Unit* target = ObjectAccessor::GetPlayer(*me, TargetGUID) ) - angle = me->GetAngle(target); - else // in case something went wrong - angle = rand_norm()*2*M_PI; + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_FEROCIOUS_BUTT: + if( Unit* victim = me->GetVictim() ) + me->CastSpell(victim, SPELL_FEROCIOUS_BUTT, false); + events.RepeatEvent(urand(15000,30000)); + break; + case EVENT_SPELL_WHIRL: + me->CastSpell((Unit*)NULL, SPELL_WHIRL, false); + events.RepeatEvent(urand(15000,20000)); + break; + case EVENT_SPELL_ARCTIC_BREATH: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 90.0f, true) ) + me->CastSpell(target, SPELL_ARCTIC_BREATH, false); + events.RepeatEvent(urand(20000,30000)); + break; + case EVENT_JUMP_MIDDLE: + me->StopMoving(); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + me->GetMotionMaster()->MoveJump(Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), 40.0f, 12.0f); + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_MASSIVE_CRASH, 2000); + break; + case EVENT_SPELL_MASSIVE_CRASH: + me->GetMotionMaster()->Clear(); + me->CastSpell((Unit*)NULL, SPELL_MASSIVE_CRASH, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_GAZE, 2000); + break; + case EVENT_GAZE: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 500.0f, true) ) + { + TargetGUID = target->GetGUID(); + me->SetUInt64Value(UNIT_FIELD_TARGET, TargetGUID); + me->SetFacingToObject(target); + Talk(EMOTE_TRAMPLE_STARE, target); + me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + events.RescheduleEvent(EVENT_JUMP_BACK, 2000); + } + else // in case something went wrong + { + events.RescheduleEvent(EVENT_SPELL_FEROCIOUS_BUTT, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_WHIRL, urand(2000,5000)); + events.RescheduleEvent(EVENT_SPELL_ARCTIC_BREATH, urand(5000,8000)); + events.RescheduleEvent(EVENT_JUMP_MIDDLE, urand(30000,50000)); + me->GetMotionMaster()->MovementExpired(); + me->SetReactState(REACT_AGGRESSIVE); + } + events.PopEvent(); + break; + case EVENT_JUMP_BACK: + { + float angle; + if( Unit* target = ObjectAccessor::GetPlayer(*me, TargetGUID) ) + angle = me->GetAngle(target); + else // in case something went wrong + angle = rand_norm()*2*M_PI; - float jumpangle = angle >= M_PI ? angle-M_PI : angle+M_PI; - float dist = 50.0f; - if( angle > 1.0f && angle < 2.0f ) // near main gate - dist = 46.0f; - destX = Locs[LOC_CENTER].GetPositionX()+cos(angle)*dist; - destY = Locs[LOC_CENTER].GetPositionY()+sin(angle)*dist; - destZ = Locs[LOC_CENTER].GetPositionZ()+1.0f; - me->StopMoving(); - me->GetMotionMaster()->MoveJump(Locs[LOC_CENTER].GetPositionX()+cos(jumpangle)*35.0f, Locs[LOC_CENTER].GetPositionY()+sin(jumpangle)*35.0f, Locs[LOC_CENTER].GetPositionZ()+1.0f, 40.0f, 12.0f); - - events.PopEvent(); - events.RescheduleEvent(EVENT_TRAMPLE, 1500); + float jumpangle = angle >= M_PI ? angle-M_PI : angle+M_PI; + float dist = 50.0f; + if( angle > 1.0f && angle < 2.0f ) // near main gate + dist = 46.0f; + destX = Locs[LOC_CENTER].GetPositionX()+cos(angle)*dist; + destY = Locs[LOC_CENTER].GetPositionY()+sin(angle)*dist; + destZ = Locs[LOC_CENTER].GetPositionZ()+1.0f; + me->StopMoving(); + me->GetMotionMaster()->MoveJump(Locs[LOC_CENTER].GetPositionX()+cos(jumpangle)*35.0f, Locs[LOC_CENTER].GetPositionY()+sin(jumpangle)*35.0f, Locs[LOC_CENTER].GetPositionZ()+1.0f, 40.0f, 12.0f); + + events.PopEvent(); + events.RescheduleEvent(EVENT_TRAMPLE, 1500); - if( pInstance ) - switch( GetDifficulty() ) - { - case RAID_DIFFICULTY_10MAN_NORMAL: - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MASSIVE_CRASH); - pInstance->DoCastSpellOnPlayers(SPELL_SURGE_OF_ADRENALINE); - break; - case RAID_DIFFICULTY_25MAN_NORMAL: - pInstance->DoRemoveAurasDueToSpellOnPlayers(67660); - pInstance->DoCastSpellOnPlayers(SPELL_SURGE_OF_ADRENALINE); - break; - case RAID_DIFFICULTY_10MAN_HEROIC: - pInstance->DoRemoveAurasDueToSpellOnPlayers(67661); - break; - case RAID_DIFFICULTY_25MAN_HEROIC: - pInstance->DoRemoveAurasDueToSpellOnPlayers(67662); - break; - } - } - break; - case EVENT_TRAMPLE: - //Talk(EMOTE_TRAMPLE_START); - me->DisableSpline(); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveCharge(destX, destY, destZ+1.0f, 65.0f); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - events.RescheduleEvent(EVENT_CHECK_TRAMPLE_PLAYERS, 100); - events.PopEvent(); - break; - case EVENT_CHECK_TRAMPLE_PLAYERS: - if( DoTrampleIfValid() ) - { - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_FEROCIOUS_BUTT, urand(5000,15000)); - events.RescheduleEvent(EVENT_SPELL_WHIRL, urand(2000,5000)); - events.RescheduleEvent(EVENT_SPELL_ARCTIC_BREATH, urand(5000,8000)); - events.RescheduleEvent(EVENT_JUMP_MIDDLE, urand(30000,50000)); - Talk(EMOTE_TRAMPLE_FAIL); - me->CastSpell(me, SPELL_FROTHING_RAGE, true); - me->GetMotionMaster()->MovementExpired(); - me->SetReactState(REACT_AGGRESSIVE); - } - // no PopEvent() intended! - break; - case EVENT_REFRESH_POSITION: - //me->SetFacingTo(me->GetOrientation()); - events.PopEvent(); - break; - } + if( pInstance ) + switch( GetDifficulty() ) + { + case RAID_DIFFICULTY_10MAN_NORMAL: + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MASSIVE_CRASH); + pInstance->DoCastSpellOnPlayers(SPELL_SURGE_OF_ADRENALINE); + break; + case RAID_DIFFICULTY_25MAN_NORMAL: + pInstance->DoRemoveAurasDueToSpellOnPlayers(67660); + pInstance->DoCastSpellOnPlayers(SPELL_SURGE_OF_ADRENALINE); + break; + case RAID_DIFFICULTY_10MAN_HEROIC: + pInstance->DoRemoveAurasDueToSpellOnPlayers(67661); + break; + case RAID_DIFFICULTY_25MAN_HEROIC: + pInstance->DoRemoveAurasDueToSpellOnPlayers(67662); + break; + } + } + break; + case EVENT_TRAMPLE: + //Talk(EMOTE_TRAMPLE_START); + me->DisableSpline(); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveCharge(destX, destY, destZ+1.0f, 65.0f); + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + events.RescheduleEvent(EVENT_CHECK_TRAMPLE_PLAYERS, 100); + events.PopEvent(); + break; + case EVENT_CHECK_TRAMPLE_PLAYERS: + if( DoTrampleIfValid() ) + { + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_FEROCIOUS_BUTT, urand(5000,15000)); + events.RescheduleEvent(EVENT_SPELL_WHIRL, urand(2000,5000)); + events.RescheduleEvent(EVENT_SPELL_ARCTIC_BREATH, urand(5000,8000)); + events.RescheduleEvent(EVENT_JUMP_MIDDLE, urand(30000,50000)); + Talk(EMOTE_TRAMPLE_FAIL); + me->CastSpell(me, SPELL_FROTHING_RAGE, true); + me->GetMotionMaster()->MovementExpired(); + me->SetReactState(REACT_AGGRESSIVE); + } + // no PopEvent() intended! + break; + case EVENT_REFRESH_POSITION: + //me->SetFacingTo(me->GetOrientation()); + events.PopEvent(); + break; + } - if( me->GetReactState() != REACT_PASSIVE ) - DoMeleeAttackIfReady(); - } + if( me->GetReactState() != REACT_PASSIVE ) + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if( pInstance ) - pInstance->SetData(TYPE_FAILED, 1); - } + void EnterEvadeMode() + { + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if( pInstance ) + pInstance->SetData(TYPE_FAILED, 1); + } - void JustDied(Unit* /*killer*/) - { - if( !pInstance ) - return; + void JustDied(Unit* /*killer*/) + { + if( !pInstance ) + return; - pInstance->SetData(TYPE_ICEHOWL, DONE); + pInstance->SetData(TYPE_ICEHOWL, DONE); - Player* plr = NULL; - if( !pInstance->instance->GetPlayers().isEmpty() ) - plr = pInstance->instance->GetPlayers().begin()->GetSource(); + Player* plr = NULL; + if( !pInstance->instance->GetPlayers().isEmpty() ) + plr = pInstance->instance->GetPlayers().begin()->GetSource(); - if( !plr ) - return; + if( !plr ) + return; - // remove loot for the other faction (items are invisible for players, done in conditions), so corpse can be skinned - for( std::vector::iterator itr = me->loot.items.begin(); itr != me->loot.items.end(); ++itr ) - if( ItemTemplate const *iProto = sObjectMgr->GetItemTemplate((*itr).itemid) ) - if( ((iProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && plr->GetTeamId() != TEAM_HORDE) || ((iProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && plr->GetTeamId() != TEAM_ALLIANCE) ) - { - (*itr).count = 0; - (*itr).is_looted = true; - --me->loot.unlootedCount; - } - } - }; + // remove loot for the other faction (items are invisible for players, done in conditions), so corpse can be skinned + for( std::vector::iterator itr = me->loot.items.begin(); itr != me->loot.items.end(); ++itr ) + if( ItemTemplate const *iProto = sObjectMgr->GetItemTemplate((*itr).itemid) ) + if( ((iProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && plr->GetTeamId() != TEAM_HORDE) || ((iProto->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) && plr->GetTeamId() != TEAM_ALLIANCE) ) + { + (*itr).count = 0; + (*itr).is_looted = true; + --me->loot.unlootedCount; + } + } + }; }; void AddSC_boss_northrend_beasts() { - new boss_gormok(); - new npc_snobold_vassal(); + new boss_gormok(); + new npc_snobold_vassal(); - new boss_acidmaw(); - new boss_dreadscale(); + new boss_acidmaw(); + new boss_dreadscale(); - new boss_icehowl(); + new boss_icehowl(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index fcf0a8a10..6c8d0cc85 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -47,16 +47,16 @@ enum ValkyrNPCs enum ValkyrSpells { SPELL_LIGHT_ESSENCE = 65686, - SPELL_LIGHT_ESSENCE_2 = 65811, + SPELL_LIGHT_ESSENCE_2 = 65811, SPELL_DARK_ESSENCE = 65684, - SPELL_DARK_ESSENCE_2 = 65827, + SPELL_DARK_ESSENCE_2 = 65827, SPELL_UNLEASHED_DARK = 65808, SPELL_UNLEASHED_LIGHT = 65795, - SPELL_POWERING_UP = 67590, + SPELL_POWERING_UP = 67590, SPELL_EMPOWERED_DARK = 65724, SPELL_EMPOWERED_LIGHT = 65748, - SPELL_SURGE_OF_SPEED = 65828, + SPELL_SURGE_OF_SPEED = 65828, SPELL_LIGHT_TWIN_SPIKE = 66075, SPELL_LIGHT_SURGE = 65766, @@ -78,425 +78,425 @@ enum ValkyrSpells enum ValkyrEvents { - EVENT_BERSERK = 1, - EVENT_SUMMON_BALLS_1, - EVENT_SUMMON_BALLS_2, - EVENT_SUMMON_BALLS_3, - EVENT_SPELL_SPIKE, - EVENT_SPELL_TOUCH, - EVENT_SPECIAL, - EVENT_REMOVE_DUAL_WIELD, + EVENT_BERSERK = 1, + EVENT_SUMMON_BALLS_1, + EVENT_SUMMON_BALLS_2, + EVENT_SUMMON_BALLS_3, + EVENT_SPELL_SPIKE, + EVENT_SPELL_TOUCH, + EVENT_SPECIAL, + EVENT_REMOVE_DUAL_WIELD, }; struct boss_twin_valkyrAI : public ScriptedAI { - boss_twin_valkyrAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) - { - pInstance = pCreature->GetInstanceScript(); - me->SetReactState(REACT_PASSIVE); - me->SetModifierValue(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, 1.0f); - me->UpdateDamagePhysical(OFF_ATTACK); - LastSynchroHP = (int32)me->GetMaxHealth(); - SpecialMask = 0; - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_HASTE_SPELLS, true); + boss_twin_valkyrAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) + { + pInstance = pCreature->GetInstanceScript(); + me->SetReactState(REACT_PASSIVE); + me->SetModifierValue(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, 1.0f); + me->UpdateDamagePhysical(OFF_ATTACK); + LastSynchroHP = (int32)me->GetMaxHealth(); + SpecialMask = 0; + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_HASTE_SPELLS, true); - events.Reset(); - if( me->GetEntry() == NPC_LIGHTBANE ) - { - if( pInstance ) - pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21853); + events.Reset(); + if( me->GetEntry() == NPC_LIGHTBANE ) + { + if( pInstance ) + pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21853); - // special events here - events.RescheduleEvent(EVENT_BERSERK, IsHeroic() ? 360000 : 600000); - events.RescheduleEvent(EVENT_SUMMON_BALLS_1, urand(10000,15000)); - events.RescheduleEvent(EVENT_SPECIAL, 45000); - } - events.RescheduleEvent(EVENT_SPELL_SPIKE, urand(5000,8000)); - if( IsHeroic() ) - events.RescheduleEvent(EVENT_SPELL_TOUCH, urand(10000,25000), 1); + // special events here + events.RescheduleEvent(EVENT_BERSERK, IsHeroic() ? 360000 : 600000); + events.RescheduleEvent(EVENT_SUMMON_BALLS_1, urand(10000,15000)); + events.RescheduleEvent(EVENT_SPECIAL, 45000); + } + events.RescheduleEvent(EVENT_SPELL_SPIKE, urand(5000,8000)); + if( IsHeroic() ) + events.RescheduleEvent(EVENT_SPELL_TOUCH, urand(10000,25000), 1); - me->SetDisableGravity(true); - me->SetHover(true); - me->SetCanFly(true); - } + me->SetDisableGravity(true); + me->SetHover(true); + me->SetCanFly(true); + } - InstanceScript* pInstance; - SummonList summons; - EventMap events; - int32 LastSynchroHP; - uint8 SpecialMask; + InstanceScript* pInstance; + SummonList summons; + EventMap events; + int32 LastSynchroHP; + uint8 SpecialMask; - void DoAction(int32 a) - { - switch( a ) - { - case -1: - summons.DespawnAll(); - if( pInstance && me->GetEntry() == NPC_LIGHTBANE ) - { - uint32 essenceId1 = 0, empoweredId1 = 0, touchId1 = 0, essenceId2 = 0, empoweredId2 = 0, touchId2 = 0; - switch( me->GetMap()->GetDifficulty() ) - { - case 0: - essenceId1 = 65684; - empoweredId1 = 65724; - touchId1 = 65950; - essenceId2 = 65686; - empoweredId2 = 65748; - touchId2 = 66001; - break; - case 1: - essenceId1 = 67176; - empoweredId1 = 67213; - touchId1 = 67296; - essenceId2 = 67222; - empoweredId2 = 67216; - touchId2 = 67281; - break; - case 2: - essenceId1 = 67177; - empoweredId1 = 67214; - touchId1 = 67297; - essenceId2 = 67223; - empoweredId2 = 67217; - touchId2 = 67282; - break; - case 3: - essenceId1 = 67178; - empoweredId1 = 67215; - touchId1 = 67298; - essenceId2 = 67224; - empoweredId2 = 67218; - touchId2 = 67283; - break; - } - pInstance->DoRemoveAurasDueToSpellOnPlayers(essenceId1); - pInstance->DoRemoveAurasDueToSpellOnPlayers(empoweredId1); - pInstance->DoRemoveAurasDueToSpellOnPlayers(touchId1); - pInstance->DoRemoveAurasDueToSpellOnPlayers(essenceId2); - pInstance->DoRemoveAurasDueToSpellOnPlayers(empoweredId2); - pInstance->DoRemoveAurasDueToSpellOnPlayers(touchId2); - } - break; - case -3: - me->SetCanDualWield(true); - me->CastSpell(me, SPELL_TWIN_POWER, true); - events.RescheduleEvent(EVENT_REMOVE_DUAL_WIELD, 15000); - break; - } - } + void DoAction(int32 a) + { + switch( a ) + { + case -1: + summons.DespawnAll(); + if( pInstance && me->GetEntry() == NPC_LIGHTBANE ) + { + uint32 essenceId1 = 0, empoweredId1 = 0, touchId1 = 0, essenceId2 = 0, empoweredId2 = 0, touchId2 = 0; + switch( me->GetMap()->GetDifficulty() ) + { + case 0: + essenceId1 = 65684; + empoweredId1 = 65724; + touchId1 = 65950; + essenceId2 = 65686; + empoweredId2 = 65748; + touchId2 = 66001; + break; + case 1: + essenceId1 = 67176; + empoweredId1 = 67213; + touchId1 = 67296; + essenceId2 = 67222; + empoweredId2 = 67216; + touchId2 = 67281; + break; + case 2: + essenceId1 = 67177; + empoweredId1 = 67214; + touchId1 = 67297; + essenceId2 = 67223; + empoweredId2 = 67217; + touchId2 = 67282; + break; + case 3: + essenceId1 = 67178; + empoweredId1 = 67215; + touchId1 = 67298; + essenceId2 = 67224; + empoweredId2 = 67218; + touchId2 = 67283; + break; + } + pInstance->DoRemoveAurasDueToSpellOnPlayers(essenceId1); + pInstance->DoRemoveAurasDueToSpellOnPlayers(empoweredId1); + pInstance->DoRemoveAurasDueToSpellOnPlayers(touchId1); + pInstance->DoRemoveAurasDueToSpellOnPlayers(essenceId2); + pInstance->DoRemoveAurasDueToSpellOnPlayers(empoweredId2); + pInstance->DoRemoveAurasDueToSpellOnPlayers(touchId2); + } + break; + case -3: + me->SetCanDualWield(true); + me->CastSpell(me, SPELL_TWIN_POWER, true); + events.RescheduleEvent(EVENT_REMOVE_DUAL_WIELD, 15000); + break; + } + } - Creature* GetSister() - { - return ObjectAccessor::GetCreature(*me, pInstance->GetData64(me->GetEntry()==NPC_DARKBANE ? NPC_LIGHTBANE : NPC_DARKBANE)); - } + Creature* GetSister() + { + return ObjectAccessor::GetCreature(*me, pInstance->GetData64(me->GetEntry()==NPC_DARKBANE ? NPC_LIGHTBANE : NPC_DARKBANE)); + } - /*void AttackStart(Unit* victim) - { - if( victim && me->Attack(victim, true) ) - me->GetMotionMaster()->MoveChase(victim, 0.0f, 0.0f, 6.0f); - }*/ + /*void AttackStart(Unit* victim) + { + if( victim && me->Attack(victim, true) ) + me->GetMotionMaster()->MoveChase(victim, 0.0f, 0.0f, 6.0f); + }*/ - void EnterCombat(Unit* /*who*/) - { - me->setActive(true); - me->LowerPlayerDamageReq(me->GetMaxHealth()); - DoZoneInCombat(); - if( Creature* twin = GetSister() ) - if( !twin->IsInCombat() ) - if( Unit* target = twin->SelectNearestTarget(200.0f) ) - twin->AI()->AttackStart(target); + void EnterCombat(Unit* /*who*/) + { + me->setActive(true); + me->LowerPlayerDamageReq(me->GetMaxHealth()); + DoZoneInCombat(); + if( Creature* twin = GetSister() ) + if( !twin->IsInCombat() ) + if( Unit* target = twin->SelectNearestTarget(200.0f) ) + twin->AI()->AttackStart(target); - Talk(SAY_AGGRO); - me->CastSpell(me, me->GetEntry() == NPC_LIGHTBANE ? SPELL_LIGHT_SURGE : SPELL_DARK_SURGE, true); + Talk(SAY_AGGRO); + me->CastSpell(me, me->GetEntry() == NPC_LIGHTBANE ? SPELL_LIGHT_SURGE : SPELL_DARK_SURGE, true); - if( pInstance && me->GetEntry() == NPC_LIGHTBANE ) - pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21853); - } + if( pInstance && me->GetEntry() == NPC_LIGHTBANE ) + pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21853); + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - void myDoMeleeAttackIfReady() - { - DoMeleeAttackIfReady(); - return; + void myDoMeleeAttackIfReady() + { + DoMeleeAttackIfReady(); + return; - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - Unit *victim = me->GetVictim(); - if (!victim || !victim->IsInWorld()) - return; + Unit *victim = me->GetVictim(); + if (!victim || !victim->IsInWorld()) + return; - float allowedDist = sqrt(MELEE_RANGE * MELEE_RANGE + 6.0f * 6.0f); - if (!me->IsWithinMeleeRange(victim, allowedDist)) - return; + float allowedDist = sqrt(MELEE_RANGE * MELEE_RANGE + 6.0f * 6.0f); + if (!me->IsWithinMeleeRange(victim, allowedDist)) + return; - if (me->isAttackReady()) - { - me->AttackerStateUpdate(victim); - me->resetAttackTimer(); - } + if (me->isAttackReady()) + { + me->AttackerStateUpdate(victim); + me->resetAttackTimer(); + } - if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK)) - { - me->AttackerStateUpdate(victim, OFF_ATTACK); - me->resetAttackTimer(OFF_ATTACK); - } - } + if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK)) + { + me->AttackerStateUpdate(victim, OFF_ATTACK); + me->resetAttackTimer(OFF_ATTACK); + } + } - void UpdateSharedHealth() - { - // lightbane synchronizes - if( me->GetEntry() == NPC_LIGHTBANE ) - if( Creature* twin = GetSister() ) - if( twin->IsAlive() && me->IsAlive() ) - { - int32 d = CAST_AI(boss_twin_valkyrAI, twin->AI())->LastSynchroHP - (int32)twin->GetHealth(); - int32 newhealth = (int32)me->GetHealth() - d; - if( newhealth <= 0 ) - newhealth = 1; - me->SetHealth( (uint32)newhealth ); - twin->SetHealth(me->GetHealth()); - CAST_AI(boss_twin_valkyrAI, twin->AI())->LastSynchroHP = (int32)twin->GetHealth(); - } - } + void UpdateSharedHealth() + { + // lightbane synchronizes + if( me->GetEntry() == NPC_LIGHTBANE ) + if( Creature* twin = GetSister() ) + if( twin->IsAlive() && me->IsAlive() ) + { + int32 d = CAST_AI(boss_twin_valkyrAI, twin->AI())->LastSynchroHP - (int32)twin->GetHealth(); + int32 newhealth = (int32)me->GetHealth() - d; + if( newhealth <= 0 ) + newhealth = 1; + me->SetHealth( (uint32)newhealth ); + twin->SetHealth(me->GetHealth()); + CAST_AI(boss_twin_valkyrAI, twin->AI())->LastSynchroHP = (int32)twin->GetHealth(); + } + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - UpdateSharedHealth(); - events.Update(diff); + UpdateSharedHealth(); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - Talk(SAY_BERSERK); - if( Creature* twin = GetSister() ) - { - twin->CastSpell(twin, SPELL_BERSERK, true); - twin->AI()->Talk(SAY_BERSERK); - } - events.PopEvent(); - break; - case EVENT_SUMMON_BALLS_1: - case EVENT_SUMMON_BALLS_2: - case EVENT_SUMMON_BALLS_3: - { - uint8 eventId = events.GetEvent(); - uint8 count = 0; - if( IsHeroic() ) - count = eventId==EVENT_SUMMON_BALLS_3 ? 36 : 6; - else - count = eventId==EVENT_SUMMON_BALLS_3 ? 24 : 4; - for( uint8 i=0; iSummonCreature((i%2) ? NPC_CONCENTRATED_DARK : NPC_CONCENTRATED_LIGHT, Locs[LOC_CENTER].GetPositionX()+cos(angle)*47.0f, Locs[LOC_CENTER].GetPositionY()+sin(angle)*47.0f, Locs[LOC_CENTER].GetPositionZ()+1.5f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1500) ) - boss_twin_valkyrAI::JustSummoned(ball); - } - events.PopEvent(); - switch( eventId ) - { - case EVENT_SUMMON_BALLS_1: - events.RescheduleEvent(EVENT_SUMMON_BALLS_2, 8000); - break; - case EVENT_SUMMON_BALLS_2: - events.RescheduleEvent(EVENT_SUMMON_BALLS_3, 8000); - break; - case EVENT_SUMMON_BALLS_3: - events.RescheduleEvent(EVENT_SUMMON_BALLS_1, 15000); - break; - } - } - break; - case EVENT_SPELL_SPIKE: - me->CastSpell(me->GetVictim(), me->GetEntry()==NPC_LIGHTBANE ? SPELL_LIGHT_TWIN_SPIKE : SPELL_DARK_TWIN_SPIKE, false); - events.RepeatEvent(urand(7000,10000)); - break; - case EVENT_SPELL_TOUCH: - { - uint32 essenceId = 0; - switch( me->GetEntry() ) - { - case NPC_LIGHTBANE: - switch( GetDifficulty() ) - { - case 0: - essenceId = 65684; - break; - case 1: - essenceId = 67176; - break; - case 2: - essenceId = 67177; - break; - case 3: - essenceId = 67178; - break; - } - break; - case NPC_DARKBANE: - switch( GetDifficulty() ) - { - case 0: - essenceId = 65686; - break; - case 1: - essenceId = 67222; - break; - case 2: - essenceId = 67223; - break; - case 3: - essenceId = 67224; - break; - } - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + Talk(SAY_BERSERK); + if( Creature* twin = GetSister() ) + { + twin->CastSpell(twin, SPELL_BERSERK, true); + twin->AI()->Talk(SAY_BERSERK); + } + events.PopEvent(); + break; + case EVENT_SUMMON_BALLS_1: + case EVENT_SUMMON_BALLS_2: + case EVENT_SUMMON_BALLS_3: + { + uint8 eventId = events.GetEvent(); + uint8 count = 0; + if( IsHeroic() ) + count = eventId==EVENT_SUMMON_BALLS_3 ? 36 : 6; + else + count = eventId==EVENT_SUMMON_BALLS_3 ? 24 : 4; + for( uint8 i=0; iSummonCreature((i%2) ? NPC_CONCENTRATED_DARK : NPC_CONCENTRATED_LIGHT, Locs[LOC_CENTER].GetPositionX()+cos(angle)*47.0f, Locs[LOC_CENTER].GetPositionY()+sin(angle)*47.0f, Locs[LOC_CENTER].GetPositionZ()+1.5f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1500) ) + boss_twin_valkyrAI::JustSummoned(ball); + } + events.PopEvent(); + switch( eventId ) + { + case EVENT_SUMMON_BALLS_1: + events.RescheduleEvent(EVENT_SUMMON_BALLS_2, 8000); + break; + case EVENT_SUMMON_BALLS_2: + events.RescheduleEvent(EVENT_SUMMON_BALLS_3, 8000); + break; + case EVENT_SUMMON_BALLS_3: + events.RescheduleEvent(EVENT_SUMMON_BALLS_1, 15000); + break; + } + } + break; + case EVENT_SPELL_SPIKE: + me->CastSpell(me->GetVictim(), me->GetEntry()==NPC_LIGHTBANE ? SPELL_LIGHT_TWIN_SPIKE : SPELL_DARK_TWIN_SPIKE, false); + events.RepeatEvent(urand(7000,10000)); + break; + case EVENT_SPELL_TOUCH: + { + uint32 essenceId = 0; + switch( me->GetEntry() ) + { + case NPC_LIGHTBANE: + switch( GetDifficulty() ) + { + case 0: + essenceId = 65684; + break; + case 1: + essenceId = 67176; + break; + case 2: + essenceId = 67177; + break; + case 3: + essenceId = 67178; + break; + } + break; + case NPC_DARKBANE: + switch( GetDifficulty() ) + { + case 0: + essenceId = 65686; + break; + case 1: + essenceId = 67222; + break; + case 2: + essenceId = 67223; + break; + case 3: + essenceId = 67224; + break; + } + break; + } - /* - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, essenceId) ) - me->CastSpell(target, me->GetEntry()==NPC_LIGHTBANE ? SPELL_LIGHT_TOUCH : SPELL_DARK_TOUCH, false); - events.RepeatEvent(urand(45000,50000)); - */ + /* + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, essenceId) ) + me->CastSpell(target, me->GetEntry()==NPC_LIGHTBANE ? SPELL_LIGHT_TOUCH : SPELL_DARK_TOUCH, false); + events.RepeatEvent(urand(45000,50000)); + */ - std::vector tList; - Map::PlayerList const &pList = me->GetMap()->GetPlayers(); - if (pList.getSize()) - { - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (Player* plr = itr->GetSource()) - if (Creature* sister = GetSister()) - if ((!me->GetVictim() || me->GetVictim()->GetGUID() != plr->GetGUID()) && (!sister->GetVictim() || sister->GetVictim()->GetGUID() != plr->GetGUID()) && plr->HasAura(essenceId)) - tList.push_back(plr->GetGUID()); + std::vector tList; + Map::PlayerList const &pList = me->GetMap()->GetPlayers(); + if (pList.getSize()) + { + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if (Player* plr = itr->GetSource()) + if (Creature* sister = GetSister()) + if ((!me->GetVictim() || me->GetVictim()->GetGUID() != plr->GetGUID()) && (!sister->GetVictim() || sister->GetVictim()->GetGUID() != plr->GetGUID()) && plr->HasAura(essenceId)) + tList.push_back(plr->GetGUID()); - if (!tList.empty()) - if (Player* target = ObjectAccessor::GetPlayer(*me, tList[urand(0,tList.size()-1)])) - { - me->CastSpell(target, me->GetEntry()==NPC_LIGHTBANE ? SPELL_LIGHT_TOUCH : SPELL_DARK_TOUCH, false); - events.RepeatEvent(urand(45000,50000)); - break; - } - } - events.RepeatEvent(10000); - } - break; - case EVENT_SPECIAL: - { - uint8 s; - do s=urand(0,3); while( SpecialMask & (1<CastSpell((Unit*)NULL, SPELL_LIGHT_VORTEX, false); - Talk(EMOTE_VORTEX); - Talk(SAY_LIGHT); - if( Creature* twin = GetSister() ) - twin->AI()->Talk(SAY_LIGHT); - break; - case 1: // dark vortex - if( Creature* twin = GetSister() ) - { - twin->CastSpell((Unit*)NULL, SPELL_DARK_VORTEX, false); - twin->AI()->Talk(EMOTE_VORTEX); - twin->AI()->Talk(SAY_NIGHT); - Talk(SAY_NIGHT); - } - break; - case 2: // light pact - Talk(EMOTE_TWINK_PACT); - Talk(SAY_TWINK_PACT); - if( Creature* twin = GetSister() ) - { - twin->AI()->Talk(SAY_TWINK_PACT); - twin->AI()->DoAction(-3); - } - me->CastSpell(me, SPELL_LIGHT_SHIELD, true); - me->CastSpell(me, SPELL_LIGHT_TWIN_PACT, false); - break; - case 3: // dark pact - if( Creature* twin = GetSister() ) - { - twin->AI()->Talk(EMOTE_TWINK_PACT); - twin->AI()->Talk(SAY_TWINK_PACT); - Talk(SAY_TWINK_PACT); - twin->CastSpell(twin, SPELL_DARK_SHIELD, true); - twin->CastSpell(twin, SPELL_DARK_TWIN_PACT, false); - DoAction(-3); - } - break; - } - if( (SpecialMask & 0xF) == 0xF ) - SpecialMask = 0; - events.RepeatEvent(45000); - events.DelayEventsToMax(15000, 1); // no touch of light/darkness during special abilities! - } - break; - case EVENT_REMOVE_DUAL_WIELD: - me->SetCanDualWield(false); - events.PopEvent(); - break; - } + if (!tList.empty()) + if (Player* target = ObjectAccessor::GetPlayer(*me, tList[urand(0,tList.size()-1)])) + { + me->CastSpell(target, me->GetEntry()==NPC_LIGHTBANE ? SPELL_LIGHT_TOUCH : SPELL_DARK_TOUCH, false); + events.RepeatEvent(urand(45000,50000)); + break; + } + } + events.RepeatEvent(10000); + } + break; + case EVENT_SPECIAL: + { + uint8 s; + do s=urand(0,3); while( SpecialMask & (1<CastSpell((Unit*)NULL, SPELL_LIGHT_VORTEX, false); + Talk(EMOTE_VORTEX); + Talk(SAY_LIGHT); + if( Creature* twin = GetSister() ) + twin->AI()->Talk(SAY_LIGHT); + break; + case 1: // dark vortex + if( Creature* twin = GetSister() ) + { + twin->CastSpell((Unit*)NULL, SPELL_DARK_VORTEX, false); + twin->AI()->Talk(EMOTE_VORTEX); + twin->AI()->Talk(SAY_NIGHT); + Talk(SAY_NIGHT); + } + break; + case 2: // light pact + Talk(EMOTE_TWINK_PACT); + Talk(SAY_TWINK_PACT); + if( Creature* twin = GetSister() ) + { + twin->AI()->Talk(SAY_TWINK_PACT); + twin->AI()->DoAction(-3); + } + me->CastSpell(me, SPELL_LIGHT_SHIELD, true); + me->CastSpell(me, SPELL_LIGHT_TWIN_PACT, false); + break; + case 3: // dark pact + if( Creature* twin = GetSister() ) + { + twin->AI()->Talk(EMOTE_TWINK_PACT); + twin->AI()->Talk(SAY_TWINK_PACT); + Talk(SAY_TWINK_PACT); + twin->CastSpell(twin, SPELL_DARK_SHIELD, true); + twin->CastSpell(twin, SPELL_DARK_TWIN_PACT, false); + DoAction(-3); + } + break; + } + if( (SpecialMask & 0xF) == 0xF ) + SpecialMask = 0; + events.RepeatEvent(45000); + events.DelayEventsToMax(15000, 1); // no touch of light/darkness during special abilities! + } + break; + case EVENT_REMOVE_DUAL_WIELD: + me->SetCanDualWield(false); + events.PopEvent(); + break; + } - myDoMeleeAttackIfReady(); - } + myDoMeleeAttackIfReady(); + } - void JustDied(Unit* /*pKiller*/) - { - DoAction(-1); - Talk(SAY_DEATH); - if( pInstance ) - { - pInstance->SetData(TYPE_VALKYR, DONE); - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POWERING_UP); - } - if( Creature* twin = GetSister() ) - if( twin->IsAlive() ) - { - twin->SetHealth(1); - Unit::Kill(twin, twin); - } - } + void JustDied(Unit* /*pKiller*/) + { + DoAction(-1); + Talk(SAY_DEATH); + if( pInstance ) + { + pInstance->SetData(TYPE_VALKYR, DONE); + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POWERING_UP); + } + if( Creature* twin = GetSister() ) + if( twin->IsAlive() ) + { + twin->SetHealth(1); + Unit::Kill(twin, twin); + } + } - void JustSummoned(Creature* s) - { - summons.Summon(s); - } + void JustSummoned(Creature* s) + { + summons.Summon(s); + } - void SummonedCreatureDespawn(Creature* s) - { - summons.Despawn(s); - } + void SummonedCreatureDespawn(Creature* s) + { + summons.Despawn(s); + } - void KilledUnit(Unit* who) - { - if( who->GetTypeId() == TYPEID_PLAYER ) - { - int32 id = urand(0,1) ? SAY_KILL_PLAYER_1 : SAY_KILL_PLAYER_2; - Talk(id); - if( Creature* twin = GetSister() ) - twin->AI()->Talk(id); - } - } + void KilledUnit(Unit* who) + { + if( who->GetTypeId() == TYPEID_PLAYER ) + { + int32 id = urand(0,1) ? SAY_KILL_PLAYER_1 : SAY_KILL_PLAYER_2; + Talk(id); + if( Creature* twin = GetSister() ) + twin->AI()->Talk(id); + } + } - void EnterEvadeMode() - { - if( pInstance ) - pInstance->SetData(TYPE_FAILED, 0); - } + void EnterEvadeMode() + { + if( pInstance ) + pInstance->SetData(TYPE_FAILED, 0); + } }; class boss_eydis : public CreatureScript @@ -509,46 +509,46 @@ public: return new boss_eydisAI(pCreature); } - struct boss_eydisAI : public boss_twin_valkyrAI - { - boss_eydisAI(Creature* pCreature) : boss_twin_valkyrAI(pCreature) - { - me->SetFlag(UNIT_FIELD_AURASTATE, 1<<(19-1)); - SetEquipmentSlots(false, EQUIP_MAIN_2, EQUIP_OFFHAND_2, EQUIP_RANGED_2); - if( Creature* c = me->SummonCreature(NPC_DARK_ESSENCE, Locs[LOC_DARKESS_1]) ) - boss_twin_valkyrAI::JustSummoned(c); - if( Creature* c = me->SummonCreature(NPC_DARK_ESSENCE, Locs[LOC_DARKESS_2]) ) - boss_twin_valkyrAI::JustSummoned(c); - } + struct boss_eydisAI : public boss_twin_valkyrAI + { + boss_eydisAI(Creature* pCreature) : boss_twin_valkyrAI(pCreature) + { + me->SetFlag(UNIT_FIELD_AURASTATE, 1<<(19-1)); + SetEquipmentSlots(false, EQUIP_MAIN_2, EQUIP_OFFHAND_2, EQUIP_RANGED_2); + if( Creature* c = me->SummonCreature(NPC_DARK_ESSENCE, Locs[LOC_DARKESS_1]) ) + boss_twin_valkyrAI::JustSummoned(c); + if( Creature* c = me->SummonCreature(NPC_DARK_ESSENCE, Locs[LOC_DARKESS_2]) ) + boss_twin_valkyrAI::JustSummoned(c); + } - void JustSummoned(Creature* s) {} - }; + void JustSummoned(Creature* s) {} + }; }; class boss_fjola : public CreatureScript { public: - boss_fjola() : CreatureScript("boss_fjola") {} + boss_fjola() : CreatureScript("boss_fjola") {} - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_fjolaAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_fjolaAI(pCreature); + } - struct boss_fjolaAI : public boss_twin_valkyrAI - { - boss_fjolaAI(Creature* pCreature) : boss_twin_valkyrAI(pCreature) - { - me->SetFlag(UNIT_FIELD_AURASTATE, 1<<(22-1)); - SetEquipmentSlots(false, EQUIP_MAIN_1, EQUIP_OFFHAND_1, EQUIP_RANGED_1); - if( Creature* c = me->SummonCreature(NPC_LIGHT_ESSENCE, Locs[LOC_LIGHTESS_1]) ) - boss_twin_valkyrAI::JustSummoned(c); - if( Creature* c = me->SummonCreature(NPC_LIGHT_ESSENCE, Locs[LOC_LIGHTESS_2]) ) - boss_twin_valkyrAI::JustSummoned(c); - } + struct boss_fjolaAI : public boss_twin_valkyrAI + { + boss_fjolaAI(Creature* pCreature) : boss_twin_valkyrAI(pCreature) + { + me->SetFlag(UNIT_FIELD_AURASTATE, 1<<(22-1)); + SetEquipmentSlots(false, EQUIP_MAIN_1, EQUIP_OFFHAND_1, EQUIP_RANGED_1); + if( Creature* c = me->SummonCreature(NPC_LIGHT_ESSENCE, Locs[LOC_LIGHTESS_1]) ) + boss_twin_valkyrAI::JustSummoned(c); + if( Creature* c = me->SummonCreature(NPC_LIGHT_ESSENCE, Locs[LOC_LIGHTESS_2]) ) + boss_twin_valkyrAI::JustSummoned(c); + } - void JustSummoned(Creature* s) {} - }; + void JustSummoned(Creature* s) {} + }; }; class npc_essence_of_twin : public CreatureScript @@ -561,96 +561,96 @@ public: switch( creature->GetEntry() ) { case NPC_LIGHT_ESSENCE: - { - uint32 essenceId = 0; - uint32 effect2Id = 0; - uint32 empoweredId = 0; - uint32 touchId1 = 0; - uint32 touchId2 = 0; - switch( creature->GetMap()->GetDifficulty() ) - { - case 0: - essenceId = 65684; - empoweredId = 65724; - touchId1 = 65950; - touchId2 = 66001; - effect2Id = 65827; - break; - case 1: - essenceId = 67176; - empoweredId = 67213; - touchId1 = 67296; - touchId2 = 67281; - effect2Id = 67179; - break; - case 2: - essenceId = 67177; - empoweredId = 67214; - touchId1 = 67297; - touchId2 = 67282; - effect2Id = 67180; - break; - case 3: - essenceId = 67178; - empoweredId = 67215; - touchId1 = 67298; - touchId2 = 67283; - effect2Id = 67181; - break; - } - player->RemoveAura(essenceId); - player->RemoveAura(effect2Id); - player->RemoveAura(touchId1); - //player->RemoveAura(touchId2); // dont remove black touch here - only white can have black touch - so white changing to white - so no change of color - //player->RemoveAura(empoweredId); // apply new empowered? - player->CastSpell(player, SPELL_LIGHT_ESSENCE, true); - } + { + uint32 essenceId = 0; + uint32 effect2Id = 0; + uint32 empoweredId = 0; + uint32 touchId1 = 0; + uint32 touchId2 = 0; + switch( creature->GetMap()->GetDifficulty() ) + { + case 0: + essenceId = 65684; + empoweredId = 65724; + touchId1 = 65950; + touchId2 = 66001; + effect2Id = 65827; + break; + case 1: + essenceId = 67176; + empoweredId = 67213; + touchId1 = 67296; + touchId2 = 67281; + effect2Id = 67179; + break; + case 2: + essenceId = 67177; + empoweredId = 67214; + touchId1 = 67297; + touchId2 = 67282; + effect2Id = 67180; + break; + case 3: + essenceId = 67178; + empoweredId = 67215; + touchId1 = 67298; + touchId2 = 67283; + effect2Id = 67181; + break; + } + player->RemoveAura(essenceId); + player->RemoveAura(effect2Id); + player->RemoveAura(touchId1); + //player->RemoveAura(touchId2); // dont remove black touch here - only white can have black touch - so white changing to white - so no change of color + //player->RemoveAura(empoweredId); // apply new empowered? + player->CastSpell(player, SPELL_LIGHT_ESSENCE, true); + } break; case NPC_DARK_ESSENCE: - { - uint32 essenceId = 0; - uint32 effect2Id = 0; - uint32 empoweredId = 0; - uint32 touchId1 = 0; - uint32 touchId2 = 0; - switch( creature->GetMap()->GetDifficulty() ) - { - case 0: - essenceId = 65686; - empoweredId = 65748; - touchId1 = 65950; - touchId2 = 66001; - effect2Id = 65811; - break; - case 1: - essenceId = 67222; - empoweredId = 67216; - touchId1 = 67296; - touchId2 = 67281; - effect2Id = 67511; - break; - case 2: - essenceId = 67223; - empoweredId = 67217; - touchId1 = 67297; - touchId2 = 67282; - effect2Id = 67512; - break; - case 3: - essenceId = 67224; - empoweredId = 67218; - touchId1 = 67298; - touchId2 = 67283; - effect2Id = 67513; - break; - } - player->RemoveAura(essenceId); - player->RemoveAura(effect2Id); - //player->RemoveAura(touchId1); // dont remove white touch here - only black can have white touch - so black changing to black - so no change of color - player->RemoveAura(touchId2); - //player->RemoveAura(empoweredId); // apply new empowered? - player->CastSpell(player, SPELL_DARK_ESSENCE, true); - } + { + uint32 essenceId = 0; + uint32 effect2Id = 0; + uint32 empoweredId = 0; + uint32 touchId1 = 0; + uint32 touchId2 = 0; + switch( creature->GetMap()->GetDifficulty() ) + { + case 0: + essenceId = 65686; + empoweredId = 65748; + touchId1 = 65950; + touchId2 = 66001; + effect2Id = 65811; + break; + case 1: + essenceId = 67222; + empoweredId = 67216; + touchId1 = 67296; + touchId2 = 67281; + effect2Id = 67511; + break; + case 2: + essenceId = 67223; + empoweredId = 67217; + touchId1 = 67297; + touchId2 = 67282; + effect2Id = 67512; + break; + case 3: + essenceId = 67224; + empoweredId = 67218; + touchId1 = 67298; + touchId2 = 67283; + effect2Id = 67513; + break; + } + player->RemoveAura(essenceId); + player->RemoveAura(effect2Id); + //player->RemoveAura(touchId1); // dont remove white touch here - only black can have white touch - so black changing to black - so no change of color + player->RemoveAura(touchId2); + //player->RemoveAura(empoweredId); // apply new empowered? + player->CastSpell(player, SPELL_DARK_ESSENCE, true); + } break; default: break; @@ -670,49 +670,49 @@ public: return new npc_concentrated_ballAI(pCreature); } - struct npc_concentrated_ballAI : public NullCreatureAI - { - npc_concentrated_ballAI(Creature *pCreature) : NullCreatureAI(pCreature) - { - me->SetReactState(REACT_PASSIVE); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->CastSpell(me, 100101, true); // custom periodic dummy spell - despawning = false; - } + struct npc_concentrated_ballAI : public NullCreatureAI + { + npc_concentrated_ballAI(Creature *pCreature) : NullCreatureAI(pCreature) + { + me->SetReactState(REACT_PASSIVE); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->CastSpell(me, 100101, true); // custom periodic dummy spell + despawning = false; + } - bool despawning; + bool despawning; - void DoAction(int32 param) - { - if (param == 1) - despawning = true; - } + void DoAction(int32 param) + { + if (param == 1) + despawning = true; + } - void MovementInform(uint32 type, uint32 id) - { - if( type != POINT_MOTION_TYPE || id != 0 ) - return; + void MovementInform(uint32 type, uint32 id) + { + if( type != POINT_MOTION_TYPE || id != 0 ) + return; - if( urand(0,2) ) - me->DespawnOrUnsummon(0); - } + if( urand(0,2) ) + me->DespawnOrUnsummon(0); + } - void MoveToNextPoint() - { - float angle = rand_norm()*2*M_PI; - me->GetMotionMaster()->MovePoint(0, Locs[LOC_CENTER].GetPositionX()+cos(angle)*47.0f, Locs[LOC_CENTER].GetPositionY()+sin(angle)*47.0f, me->GetPositionZ()); - } + void MoveToNextPoint() + { + float angle = rand_norm()*2*M_PI; + me->GetMotionMaster()->MovePoint(0, Locs[LOC_CENTER].GetPositionX()+cos(angle)*47.0f, Locs[LOC_CENTER].GetPositionY()+sin(angle)*47.0f, me->GetPositionZ()); + } - void UpdateAI(uint32 diff) - { - if( despawning ) - return; + void UpdateAI(uint32 diff) + { + if( despawning ) + return; - if( me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE ) - MoveToNextPoint(); - } - }; + if( me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE ) + MoveToNextPoint(); + } + }; }; class spell_valkyr_essence : public SpellScriptLoader @@ -726,72 +726,72 @@ class spell_valkyr_essence : public SpellScriptLoader void HandleAfterEffectAbsorb(AuraEffect * /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) { - uint16 count = absorbAmount/1000; - if( !count || !GetOwner() ) - return; + uint16 count = absorbAmount/1000; + if( !count || !GetOwner() ) + return; - if( const SpellInfo* se = GetAura()->GetSpellInfo() ) - if( Unit* owner = GetOwner()->ToUnit() ) - { - uint32 auraId = 0; - uint32 empoweredId = 0; - switch( se->Id ) - { - case 65686: - auraId = 67590; - empoweredId = 65748; - break; - case 65684: - auraId = 67590; - empoweredId = 65724; - break; - case 67222: - auraId = 67602; - empoweredId = 65748; - break; - case 67176: - auraId = 67602; - empoweredId = 65724; - break; - case 67223: - auraId = 67603; - empoweredId = 65748; - break; - case 67177: - auraId = 67603; - empoweredId = 65724; - break; - case 67224: - auraId = 67604; - empoweredId = 65748; - break; - case 67178: - auraId = 67604; - empoweredId = 65724; - break; - } - if( !owner->HasAura(auraId) ) - { - owner->CastSpell(owner, SPELL_POWERING_UP, true); - if( --count == 0 ) - return; - } - if( Aura* aur = owner->GetAura(auraId) ) - { - if( aur->GetStackAmount()+count < 100 ) - { - aur->ModStackAmount(count); + if( const SpellInfo* se = GetAura()->GetSpellInfo() ) + if( Unit* owner = GetOwner()->ToUnit() ) + { + uint32 auraId = 0; + uint32 empoweredId = 0; + switch( se->Id ) + { + case 65686: + auraId = 67590; + empoweredId = 65748; + break; + case 65684: + auraId = 67590; + empoweredId = 65724; + break; + case 67222: + auraId = 67602; + empoweredId = 65748; + break; + case 67176: + auraId = 67602; + empoweredId = 65724; + break; + case 67223: + auraId = 67603; + empoweredId = 65748; + break; + case 67177: + auraId = 67603; + empoweredId = 65724; + break; + case 67224: + auraId = 67604; + empoweredId = 65748; + break; + case 67178: + auraId = 67604; + empoweredId = 65724; + break; + } + if( !owner->HasAura(auraId) ) + { + owner->CastSpell(owner, SPELL_POWERING_UP, true); + if( --count == 0 ) + return; + } + if( Aura* aur = owner->GetAura(auraId) ) + { + if( aur->GetStackAmount()+count < 100 ) + { + aur->ModStackAmount(count); - if (roll_chance_i(30)) // 30% chance to gain extra speed for collecting - owner->CastSpell(owner, SPELL_SURGE_OF_SPEED, true); - } - else - { - owner->CastSpell(owner, empoweredId, true); - aur->Remove(); - } - } - } + if (roll_chance_i(30)) // 30% chance to gain extra speed for collecting + owner->CastSpell(owner, SPELL_SURGE_OF_SPEED, true); + } + else + { + owner->CastSpell(owner, empoweredId, true); + aur->Remove(); + } + } + } } void Register() @@ -808,102 +808,102 @@ class spell_valkyr_essence : public SpellScriptLoader class spell_valkyr_touch : public SpellScriptLoader { - public: - spell_valkyr_touch() : SpellScriptLoader("spell_valkyr_touch") { } + public: + spell_valkyr_touch() : SpellScriptLoader("spell_valkyr_touch") { } - class spell_valkyr_touchAuraScript : public AuraScript - { - PrepareAuraScript(spell_valkyr_touchAuraScript) + class spell_valkyr_touchAuraScript : public AuraScript + { + PrepareAuraScript(spell_valkyr_touchAuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - PreventDefaultAction(); - Unit* caster = GetCaster(); - if( !caster ) - return; - if( caster->GetMap()->GetId() == 649 ) - { - uint32 excludedID = GetSpellInfo()->ExcludeTargetAuraSpell; - Map::PlayerList const &pl = caster->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - if( plr->IsAlive() && !plr->HasAura(excludedID) && !plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) ) - { - uint32 absorb=0; - uint32 resist=0; - CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); - int32 dmg = urand(2925,3075)*(caster->GetMap()->GetDifficulty()-1); - if (caster->CanApplyResilience()) - Unit::ApplyResilience(plr, NULL, &dmg, false, CR_CRIT_TAKEN_SPELL); - uint32 damage = dmg; - Unit::CalcAbsorbResist(caster, plr, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo()); - Unit::DealDamageMods(plr,damage,&absorb); - int32 overkill = damage - plr->GetHealth(); - if (overkill < 0) - overkill = 0; - SpellPeriodicAuraLogInfo pInfo(aurEff, damage, overkill, absorb, resist, 0.0f, false); - plr->SendPeriodicAuraLog(&pInfo); - Unit::DealDamage(caster, plr, damage, 0, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); - } - } - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + PreventDefaultAction(); + Unit* caster = GetCaster(); + if( !caster ) + return; + if( caster->GetMap()->GetId() == 649 ) + { + uint32 excludedID = GetSpellInfo()->ExcludeTargetAuraSpell; + Map::PlayerList const &pl = caster->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + if( plr->IsAlive() && !plr->HasAura(excludedID) && !plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) ) + { + uint32 absorb=0; + uint32 resist=0; + CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL); + int32 dmg = urand(2925,3075)*(caster->GetMap()->GetDifficulty()-1); + if (caster->CanApplyResilience()) + Unit::ApplyResilience(plr, NULL, &dmg, false, CR_CRIT_TAKEN_SPELL); + uint32 damage = dmg; + Unit::CalcAbsorbResist(caster, plr, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo()); + Unit::DealDamageMods(plr,damage,&absorb); + int32 overkill = damage - plr->GetHealth(); + if (overkill < 0) + overkill = 0; + SpellPeriodicAuraLogInfo pInfo(aurEff, damage, overkill, absorb, resist, 0.0f, false); + plr->SendPeriodicAuraLog(&pInfo); + Unit::DealDamage(caster, plr, damage, 0, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true); + } + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_valkyr_touchAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_valkyr_touchAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_valkyr_touchAuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_valkyr_touchAuraScript(); + } }; class spell_valkyr_ball_periodic_dummy : public SpellScriptLoader { - public: - spell_valkyr_ball_periodic_dummy() : SpellScriptLoader("spell_valkyr_ball_periodic_dummy") { } + public: + spell_valkyr_ball_periodic_dummy() : SpellScriptLoader("spell_valkyr_ball_periodic_dummy") { } - class spell_valkyr_ball_periodic_dummyAuraScript : public AuraScript - { - PrepareAuraScript(spell_valkyr_ball_periodic_dummyAuraScript) + class spell_valkyr_ball_periodic_dummyAuraScript : public AuraScript + { + PrepareAuraScript(spell_valkyr_ball_periodic_dummyAuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (Unit* target = GetTarget()) - if (target->GetDisplayId() != 11686) - if (Creature* me = target->ToCreature()) - if (Player* p = me->SelectNearestPlayer(2.75f)) - if (me->GetExactDist2d(p) <= 2.75f) - { - me->AI()->DoAction(1); // despawning = true; - me->GetMotionMaster()->MoveIdle(); - me->CastSpell((Unit*)NULL, me->GetEntry()==NPC_CONCENTRATED_LIGHT ? SPELL_UNLEASHED_LIGHT : SPELL_UNLEASHED_DARK, false); - me->SetDisplayId(11686); - me->DespawnOrUnsummon(1500); - } - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (Unit* target = GetTarget()) + if (target->GetDisplayId() != 11686) + if (Creature* me = target->ToCreature()) + if (Player* p = me->SelectNearestPlayer(2.75f)) + if (me->GetExactDist2d(p) <= 2.75f) + { + me->AI()->DoAction(1); // despawning = true; + me->GetMotionMaster()->MoveIdle(); + me->CastSpell((Unit*)NULL, me->GetEntry()==NPC_CONCENTRATED_LIGHT ? SPELL_UNLEASHED_LIGHT : SPELL_UNLEASHED_DARK, false); + me->SetDisplayId(11686); + me->DespawnOrUnsummon(1500); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_valkyr_ball_periodic_dummyAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_valkyr_ball_periodic_dummyAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_valkyr_ball_periodic_dummyAuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_valkyr_ball_periodic_dummyAuraScript(); + } }; void AddSC_boss_twin_valkyr() { - new boss_fjola(); - new boss_eydis(); - new npc_essence_of_twin(); - new npc_concentrated_ball(); - new spell_valkyr_essence(); - new spell_valkyr_touch(); - new spell_valkyr_ball_periodic_dummy(); + new boss_fjola(); + new boss_eydis(); + new npc_essence_of_twin(); + new npc_concentrated_ball(); + new spell_valkyr_essence(); + new spell_valkyr_touch(); + new spell_valkyr_ball_periodic_dummy(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index e9c9c3b1a..c3754805d 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -8,1709 +8,1709 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! #include "Group.h" #include "Player.h" -#define CLEANUP_CHECK_INTERVAL 5000 +#define CLEANUP_CHECK_INTERVAL 5000 std::map validDedicatedInsanityItems; class instance_trial_of_the_crusader : public InstanceMapScript { public: - instance_trial_of_the_crusader() : InstanceMapScript("instance_trial_of_the_crusader", 649) { } - - struct instance_trial_of_the_crusader_InstanceMapScript : public InstanceScript - { - instance_trial_of_the_crusader_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } - - bool CLEANED; - uint32 EncounterStatus; - uint32 InstanceProgress; - uint32 AttemptsLeft; - TeamId TeamIdInInstance; - uint8 Counter; - uint8 northrendBeastsMask; - uint32 AchievementTimer; - bool bDedicatedInsanity; - bool bSwitcher; - bool bNooneDied; - std::string str_data; - EventMap events; - - uint64 NPC_BarrettGUID; - uint64 NPC_TirionGUID; - uint64 NPC_FizzlebangGUID; - uint64 NPC_GarroshGUID; - uint64 NPC_VarianGUID; - - uint64 NPC_GormokGUID; - uint64 NPC_DreadscaleGUID; - uint64 NPC_AcidmawGUID; - uint64 NPC_IcehowlGUID; - uint64 NPC_JaraxxusGUID; - std::vector NPC_ChampionGUIDs; - uint64 NPC_LightbaneGUID; - uint64 NPC_DarkbaneGUID; - uint64 NPC_LichKingGUID; - uint64 NPC_AnubarakGUID; - - uint64 NPC_PurpleGroundGUID; - uint64 NPC_PortalGUID; - - uint64 GO_MainGateGUID; - uint64 GO_EnterGateGUID; - uint64 GO_WebDoorGUID; - uint64 GO_FloorGUID; - - bool IsValidDedicatedInsanityItem(const ItemTemplate* item) - { - if (!item) // should not happen, but checked in GetAverageItemLevel() - return true; - if (item->ItemLevel < 245) - return true; - if (item->ItemId == 46017) // Val'anyr, Hammer of Ancient Kings - exception, too powerful - return false; - if (item->ItemLevel == 245 && item->Bonding == BIND_WHEN_EQUIPED) // this also includes items crafted from patterns obtained in ToC 10 norm/hc - return true; - if (validDedicatedInsanityItems.find(item->ItemId) != validDedicatedInsanityItems.end()) // list of items dropping from ToC 10 norm/hc and also items ilevel 245 buyable for emblems of triumph - return true; - - return false; - } - - void DoCheckDedicatedInsanity() - { - if (!bDedicatedInsanity || AttemptsLeft < 50 || instance->GetDifficulty() != RAID_DIFFICULTY_10MAN_HEROIC) - return; - - if (validDedicatedInsanityItems.empty()) - { - for (uint32 i=0; iGetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* plr = itr->GetSource()) - if (!plr->IsGameMaster() && plr->IsInCombat() /*performance*/) - { - for (uint8 i=EQUIPMENT_SLOT_START; iGetItemByPos(INVENTORY_SLOT_BAG_0, i)) - if (!IsValidDedicatedInsanityItem(item->GetTemplate())) - { - bDedicatedInsanity = false; - SaveToDB(); - return; - } - } - } - - void OnUnitDeath(Unit* u) - { - if (bNooneDied && u->GetTypeId() == TYPEID_PLAYER) - { - bNooneDied = false; - SaveToDB(); - } - } - - void Initialize() - { - CLEANED = false; - EncounterStatus = NOT_STARTED; - InstanceProgress = INSTANCE_PROGRESS_INITIAL; - AttemptsLeft = 50; - TeamIdInInstance = TEAM_NEUTRAL; - Counter = 0; - northrendBeastsMask = 0; - AchievementTimer = 0; - bDedicatedInsanity = true; - bSwitcher = false; - bNooneDied = true; - events.Reset(); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); - - NPC_BarrettGUID = 0; - NPC_TirionGUID = 0; - NPC_FizzlebangGUID = 0; - NPC_GarroshGUID = 0; - NPC_VarianGUID = 0; - - NPC_GormokGUID = 0; - NPC_DreadscaleGUID = 0; - NPC_AcidmawGUID = 0; - NPC_IcehowlGUID = 0; - NPC_JaraxxusGUID = 0; - NPC_ChampionGUIDs.clear(); - NPC_LightbaneGUID = 0; - NPC_DarkbaneGUID = 0; - NPC_LichKingGUID = 0; - NPC_AnubarakGUID = 0; - - NPC_PurpleGroundGUID = 0; - NPC_PortalGUID = 0; - - GO_MainGateGUID = 0; - GO_EnterGateGUID = 0; - GO_WebDoorGUID = 0; - GO_FloorGUID = 0; - } - - bool IsEncounterInProgress() const - { - uint8 aliveCount = 0; - Map::PlayerList const &pl = instance->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - if( plr->IsAlive() && !plr->IsGameMaster() ) - return EncounterStatus == IN_PROGRESS; // found alive player - - if( EncounterStatus != NOT_STARTED ) - *(const_cast(&EncounterStatus)) = NOT_STARTED; - return false; - } - - void OnCreatureCreate(Creature* creature) - { - switch( creature->GetEntry() ) - { - case NPC_BARRENT: - NPC_BarrettGUID = creature->GetGUID(); - break; - case NPC_TIRION: - NPC_TirionGUID = creature->GetGUID(); - break; - case NPC_GARROSH: - NPC_GarroshGUID = creature->GetGUID(); - break; - case NPC_VARIAN: - NPC_VarianGUID = creature->GetGUID(); - break; - case NPC_FIZZLEBANG: - NPC_FizzlebangGUID = creature->GetGUID(); - break; - - case NPC_GORMOK: - NPC_GormokGUID = creature->GetGUID(); - break; - case NPC_DREADSCALE: - NPC_DreadscaleGUID = creature->GetGUID(); - break; - case NPC_ACIDMAW: - NPC_AcidmawGUID = creature->GetGUID(); - break; - case NPC_ICEHOWL: - NPC_IcehowlGUID = creature->GetGUID(); - break; - case NPC_JARAXXUS: - NPC_JaraxxusGUID = creature->GetGUID(); - break; - case NPC_LIGHTBANE: - NPC_LightbaneGUID = creature->GetGUID(); - break; - case NPC_DARKBANE: - NPC_DarkbaneGUID = creature->GetGUID(); - break; - case NPC_LICH_KING: - NPC_LichKingGUID = creature->GetGUID(); - break; - case NPC_ANUBARAK: - NPC_AnubarakGUID = creature->GetGUID(); - break; - } - } - - void OnGameObjectCreate(GameObject* go) - { - switch( go->GetEntry() ) - { - case GO_MAIN_GATE_DOOR: - GO_MainGateGUID = go->GetGUID(); - HandleGameObject(GO_MainGateGUID, false, go); - break; - case GO_WEB_DOOR: - GO_WebDoorGUID = go->GetGUID(); - HandleGameObject(GO_WebDoorGUID, true, go); - break; - case GO_ARGENT_COLISEUM_FLOOR: - GO_FloorGUID = go->GetGUID(); - break; - case GO_SOUTH_PORTCULLIS: - case GO_NORTH_PORTCULLIS: - HandleGameObject(go->GetGUID(), false, go); - break; - case GO_EAST_PORTCULLIS: - HandleGameObject(go->GetGUID(), true, go); - GO_EnterGateGUID = go->GetGUID(); - break; - } - } - - void SetData(uint32 type, uint32 data) - { - switch( type ) - { - case TYPE_FAILED: - // - some scene here? - if( instance->IsHeroic() && !CLEANED ) - { - if( AttemptsLeft > 0 ) - --AttemptsLeft; - Map::PlayerList const &pl = instance->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - plr->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, AttemptsLeft); - } - InstanceCleanup(true); - SaveToDB(); - break; - case TYPE_ANNOUNCER_GOSSIP_SELECT: - if( instance->IsHeroic() && AttemptsLeft == 0 ) - break; - switch( InstanceProgress ) - { - case INSTANCE_PROGRESS_INITIAL: - events.RescheduleEvent(EVENT_SCENE_001, 0); - break; - case INSTANCE_PROGRESS_INTRO_DONE: - events.RescheduleEvent(EVENT_SCENE_004, 0); - break; - case INSTANCE_PROGRESS_BEASTS_DEAD: - events.RescheduleEvent(EVENT_SCENE_101, 0); - break; - case INSTANCE_PROGRESS_JARAXXUS_DEAD: - events.RescheduleEvent(EVENT_SCENE_201, 0); - break; - case INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD: - events.RescheduleEvent(EVENT_SCENE_301, 0); - break; - case INSTANCE_PROGRESS_VALKYR_DEAD: - events.RescheduleEvent(EVENT_SCENE_401, 0); - break; - } - break; - case TYPE_GORMOK: - if( data == DONE ) - { - if (Creature* trigger = instance->SummonCreature(WORLD_TRIGGER, Locs[LOC_CENTER], NULL, 25000)) - { - trigger->SetDisplayId(11686); - trigger->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - trigger->setFaction(14); - trigger->SetInCombatWithZone(); - } - - EncounterStatus = IN_PROGRESS; - - northrendBeastsMask |= 1; - if ((northrendBeastsMask & 7) == 7) - SetData(TYPE_NORTHREND_BEASTS_ALL, DONE); - else if ((northrendBeastsMask & 16) == 0) - events.RescheduleEvent(EVENT_SCENE_005, 2500); - } - break; - case TYPE_JORMUNGAR: - if( data == DONE ) - { - if( ++Counter == 2 ) - { - if (Creature* trigger = instance->SummonCreature(WORLD_TRIGGER, Locs[LOC_CENTER], NULL, 25000)) - { - trigger->SetDisplayId(11686); - trigger->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - trigger->setFaction(14); - trigger->SetInCombatWithZone(); - } - - if( Creature* c = instance->GetCreature(NPC_AcidmawGUID) ) - c->DespawnOrUnsummon(10000); - if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) ) - c->DespawnOrUnsummon(10000); - if( AchievementTimer+10 >= time(NULL) ) - DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_JORMUNGAR_ACHIEV); - AchievementTimer = 0; - - EncounterStatus = IN_PROGRESS; - - northrendBeastsMask |= 2; - if ((northrendBeastsMask & 7) == 7) - SetData(TYPE_NORTHREND_BEASTS_ALL, DONE); - else if ((northrendBeastsMask & 32) == 0) - { - Counter = 0; - events.RescheduleEvent(EVENT_SCENE_006, 2500); - } - } - else // first one died, start timer for achievement - { - AchievementTimer = time(NULL); - } - } - else - AchievementTimer = 0; - break; - case TYPE_ICEHOWL: - if( data == DONE ) - { - northrendBeastsMask |= 4; - if ((northrendBeastsMask & 7) == 7) - SetData(TYPE_NORTHREND_BEASTS_ALL, DONE); - } - break; - case TYPE_NORTHREND_BEASTS_ALL: - if (data == DONE) - { - northrendBeastsMask = 0; - EncounterStatus = NOT_STARTED; - InstanceProgress = INSTANCE_PROGRESS_BEASTS_DEAD; - HandleGameObject(GO_EnterGateGUID, true); - events.CancelEvent(EVENT_NORTHREND_BEASTS_ENRAGE); - events.RescheduleEvent(EVENT_SCENE_BEASTS_DONE, 2500); - SaveToDB(); - } - break; - case TYPE_JARAXXUS: - EncounterStatus = data == IN_PROGRESS ? IN_PROGRESS : NOT_STARTED; - if( data == IN_PROGRESS ) - HandleGameObject(GO_EnterGateGUID, false); - else if( data == DONE ) - { - HandleGameObject(GO_EnterGateGUID, true); - InstanceProgress = INSTANCE_PROGRESS_JARAXXUS_DEAD; - events.RescheduleEvent(EVENT_SCENE_110, 2500); - SaveToDB(); - } - break; - case TYPE_FACTION_CHAMPIONS: - if( data == DONE ) - { - if( ++Counter >= NPC_ChampionGUIDs.size() ) - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->CastSpell(c, SPELL_FACTION_CHAMPIONS_KILL_CREDIT, true); - Counter = 0; - EncounterStatus = NOT_STARTED; - InstanceProgress = INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD; - events.RescheduleEvent(EVENT_SCENE_FACTION_CHAMPIONS_DEAD, 2500); - - for( std::vector::iterator itr = NPC_ChampionGUIDs.begin(); itr != NPC_ChampionGUIDs.end(); ++itr ) - if( Creature* c = instance->GetCreature(*itr) ) - c->DespawnOrUnsummon(15000); - NPC_ChampionGUIDs.clear(); - - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - { - uint32 cacheEntry = 0; - switch( instance->GetDifficulty() ) - { - case RAID_DIFFICULTY_10MAN_NORMAL: - cacheEntry = GO_CRUSADERS_CACHE_10; - break; - case RAID_DIFFICULTY_25MAN_NORMAL: - cacheEntry = GO_CRUSADERS_CACHE_25; - break; - case RAID_DIFFICULTY_10MAN_HEROIC: - cacheEntry = GO_CRUSADERS_CACHE_10_H; - break; - case RAID_DIFFICULTY_25MAN_HEROIC: - cacheEntry = GO_CRUSADERS_CACHE_25_H; - break; - } - if (GameObject* go = c->SummonGameObject(cacheEntry, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 630000000)) - { - Map::PlayerList const &pl = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* plr = itr->GetSource()) - if (Group* g = plr->GetGroup()) - if (!plr->IsGameMaster() && g->GetLeaderGUID() == plr->GetGUID()) - { - go->SetLootRecipient(plr); - break; - } - } - } - - HandleGameObject(GO_EnterGateGUID, true); - - if( AchievementTimer+60 >= time(NULL) ) - DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_RESILIENCE_WILL_FIX_IT_CREDIT); - AchievementTimer = 0; - - SaveToDB(); - } - else if( Counter == 1 ) - AchievementTimer = time(NULL); - } - break; - case TYPE_FACTION_CHAMPIONS_START: - { - EncounterStatus = IN_PROGRESS; - AchievementTimer = 0; - for( std::vector::iterator itr = NPC_ChampionGUIDs.begin(); itr != NPC_ChampionGUIDs.end(); ++itr ) - if( Creature* c = instance->GetCreature(*itr) ) - if( !c->IsInCombat() ) - if( Unit* target = c->SelectNearestTarget(200.0f) ) - c->AI()->AttackStart(target); - } - break; - case TYPE_FACTION_CHAMPIONS_PLAYER_DIED: - if( urand(0,2) == 0 ) - { - if( TeamIdInInstance == TEAM_HORDE ) - { - if( Creature* pTemp = instance->GetCreature(NPC_VarianGUID) ) - pTemp->AI()->Talk(SAY_VARIAN_KILL_HORDE_PLAYER_1); - } - else - if( Creature* pTemp = instance->GetCreature(NPC_GarroshGUID) ) - pTemp->AI()->Talk(SAY_GARROSH_KILL_ALLIANCE_PLAYER_1); - } - break; - case TYPE_VALKYR: - if( data == DONE && ++Counter >= 2 ) - { - Counter = 0; - EncounterStatus = NOT_STARTED; - InstanceProgress = INSTANCE_PROGRESS_VALKYR_DEAD; - DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 34497, 1); // Lightbane - DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 34496, 1); // Darkbane - events.RescheduleEvent(EVENT_SCENE_VALKYR_DEAD, 2500); - HandleGameObject(GO_EnterGateGUID, true); - SaveToDB(); - } - break; - case TYPE_ANUBARAK: - if( data == IN_PROGRESS ) - { - EncounterStatus = IN_PROGRESS; - HandleGameObject(GO_WebDoorGUID, false); - } - else if( data == DONE ) - { - Counter = 0; - EncounterStatus = NOT_STARTED; - InstanceProgress = INSTANCE_PROGRESS_DONE; - HandleGameObject(GO_EnterGateGUID, true); - HandleGameObject(GO_WebDoorGUID, true); - SaveToDB(); - - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - { - c->UpdatePosition(Locs[LOC_TIRION_FINAL], true); - c->StopMovingOnCurrentPos(); - c->SetFacingTo(Locs[LOC_TIRION_FINAL].GetOrientation()); - events.RescheduleEvent(EVENT_SCENE_501, 20000); - } - if( GameObject* floor = instance->GetGameObject(GO_FloorGUID) ) - floor->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); - } - break; - } - } - - uint32 GetData(uint32 type) const - { - switch( type ) - { - case TYPE_INSTANCE_PROGRESS: return InstanceProgress; - } - return 0; - } - - uint64 GetData64(uint32 type) const - { - switch( type ) - { - case TYPE_GORMOK: return NPC_GormokGUID; - case TYPE_DREADSCALE: return NPC_DreadscaleGUID; - case TYPE_ACIDMAW: return NPC_AcidmawGUID; - case NPC_DARKBANE: return NPC_DarkbaneGUID; - case NPC_LIGHTBANE: return NPC_LightbaneGUID; - case TYPE_ANUBARAK: return NPC_AnubarakGUID; - } - return 0; - } - - void Update(uint32 diff) - { - events.Update(diff); - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_CHECK_PLAYERS: - { - if (bSwitcher) // used to double the check interval - DoCheckDedicatedInsanity(); - bSwitcher = !bSwitcher; - - if( DoNeedCleanup(false) ) - InstanceCleanup(); - events.RepeatEvent(CLEANUP_CHECK_INTERVAL); - } - break; - case EVENT_OPEN_GATE: - { - HandleGameObject(GO_MainGateGUID, true); - events.PopEvent(); - } - break; - case EVENT_CLOSE_GATE: - { - HandleGameObject(GO_MainGateGUID, false); - events.PopEvent(); - } - break; - case EVENT_SCENE_001: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_0_01); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_002, 22000); - } - break; - case EVENT_SCENE_002: - { - if( Creature* c = instance->GetCreature(NPC_VarianGUID) ) - c->AI()->Talk(SAY_STAGE_0_03a); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_003, 5000); - } - break; - case EVENT_SCENE_003: - { - if( Creature* c = instance->GetCreature(NPC_GarroshGUID) ) - c->AI()->Talk(SAY_STAGE_0_03h); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_004, 8000); - } - break; - case EVENT_SCENE_004: - { - InstanceProgress = INSTANCE_PROGRESS_INTRO_DONE; - EncounterStatus = IN_PROGRESS; - - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_0_02); - HandleGameObject(GO_MainGateGUID, true); - HandleGameObject(GO_EnterGateGUID, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_SUMMON_GORMOK, 1000); - if (instance->IsHeroic()) - { - events.RescheduleEvent(EVENT_SCENE_005, 150000); - events.RescheduleEvent(EVENT_SCENE_006, 340000); - events.RescheduleEvent(EVENT_NORTHREND_BEASTS_ENRAGE, 520000); - } - } - break; - case EVENT_NORTHREND_BEASTS_ENRAGE: - if( Creature* c = instance->GetCreature(NPC_GormokGUID) ) - if (c->IsAlive()) - c->CastSpell(c, 26662, true); - if( Creature* c = instance->GetCreature(NPC_AcidmawGUID) ) - if (c->IsAlive()) - c->CastSpell(c, 26662, true); - if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) ) - if (c->IsAlive()) - c->CastSpell(c, 26662, true); - if( Creature* c = instance->GetCreature(NPC_IcehowlGUID) ) - if (c->IsAlive()) - c->CastSpell(c, 26662, true); - events.PopEvent(); - break; - case EVENT_SUMMON_GORMOK: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - if( Creature* gormok = c->SummonCreature(NPC_GORMOK, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY(), Locs[LOC_BEHIND_GATE].GetPositionZ(), Locs[LOC_BEHIND_GATE].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000) ) - gormok->GetMotionMaster()->MovePoint(0, Locs[LOC_GATE_FRONT].GetPositionX(), Locs[LOC_GATE_FRONT].GetPositionY(), Locs[LOC_GATE_FRONT].GetPositionZ()); - events.PopEvent(); - events.RescheduleEvent(EVENT_GORMOK_ATTACK, 10000); - events.RescheduleEvent(EVENT_CLOSE_GATE, 6000); - } - break; - case EVENT_GORMOK_ATTACK: - { - northrendBeastsMask = 0; - if( Creature* c = instance->GetCreature(NPC_GormokGUID) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - if( Unit* target = c->SelectNearestTarget(200.0f) ) - { - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - } - } - events.PopEvent(); - } - break; - case EVENT_SCENE_005: - { - northrendBeastsMask |= 16; - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_0_04); - events.PopEvent(); - events.RescheduleEvent(EVENT_OPEN_GATE, 3000); - events.RescheduleEvent(EVENT_SUMMON_ACIDMAW_AND_DREADSCALE, 4000); - } - break; - case EVENT_SUMMON_ACIDMAW_AND_DREADSCALE: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - { - if( Creature* dreadscale = c->SummonCreature(NPC_DREADSCALE, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY(), Locs[LOC_BEHIND_GATE].GetPositionZ(), Locs[LOC_BEHIND_GATE].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN) ) - dreadscale->GetMotionMaster()->MovePoint(0, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY()-25.0f, Locs[LOC_BEHIND_GATE].GetPositionZ()); - if( Creature* acidmaw = c->SummonCreature(NPC_ACIDMAW, Locs[LOC_ACIDMAW].GetPositionX(), Locs[LOC_ACIDMAW].GetPositionY(), Locs[LOC_ACIDMAW].GetPositionZ(), Locs[LOC_ACIDMAW].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN) ) - acidmaw->AddAura(53421, acidmaw); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_005_2, 4000); - } - break; - case EVENT_SCENE_005_2: - { - if( Creature* dreadscale = instance->GetCreature(NPC_DreadscaleGUID) ) - dreadscale->GetMotionMaster()->MovePoint(0, Locs[LOC_DREADSCALE].GetPositionX(), Locs[LOC_DREADSCALE].GetPositionY(), Locs[LOC_DREADSCALE].GetPositionZ()); - events.PopEvent(); - events.RescheduleEvent(EVENT_ACIDMAW_AND_DREADSCALE_ATTACK, 7000); - } - break; - case EVENT_ACIDMAW_AND_DREADSCALE_ATTACK: - { - HandleGameObject(GO_MainGateGUID, false); - if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - if( Unit* target = c->SelectNearestTarget(200.0f) ) - { - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - } - } - if( Creature* c = instance->GetCreature(NPC_AcidmawGUID) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - if( Unit* target = c->SelectNearestTarget(200.0f) ) - { - c->RemoveAura(53421); - c->CastSpell(c, 66947, false); - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - } - } - events.PopEvent(); - } - break; - case EVENT_SCENE_006: - { - northrendBeastsMask |= 32; - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_0_05); - events.PopEvent(); - events.RescheduleEvent(EVENT_OPEN_GATE, 2000); - events.RescheduleEvent(EVENT_SUMMON_ICEHOWL, 3000); - } - break; - case EVENT_SUMMON_ICEHOWL: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - if( Creature* icehowl = c->SummonCreature(NPC_ICEHOWL, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY(), Locs[LOC_BEHIND_GATE].GetPositionZ(), Locs[LOC_BEHIND_GATE].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) ) - icehowl->GetMotionMaster()->MovePoint(0, Locs[LOC_GATE_FRONT].GetPositionX(), Locs[LOC_GATE_FRONT].GetPositionY(), Locs[LOC_GATE_FRONT].GetPositionZ()); - events.PopEvent(); - events.RescheduleEvent(EVENT_ICEHOWL_ATTACK, 10000); - events.RescheduleEvent(EVENT_CLOSE_GATE, 6000); - } - break; - case EVENT_ICEHOWL_ATTACK: - { - if( Creature* c = instance->GetCreature(NPC_IcehowlGUID) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - if( Unit* target = c->SelectNearestTarget(200.0f) ) - { - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - } - } - events.PopEvent(); - } - break; - case EVENT_SCENE_BEASTS_DONE: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_0_06); - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - events.PopEvent(); - } - break; - case EVENT_SCENE_101: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - { - HandleGameObject(GO_MainGateGUID, true); - c->AI()->Talk(SAY_STAGE_1_01); - if( Creature* fizzlebang = c->SummonCreature(NPC_FIZZLEBANG, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY(), Locs[LOC_BEHIND_GATE].GetPositionZ(), Locs[LOC_BEHIND_GATE].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000) ) - { - fizzlebang->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - fizzlebang->GetMotionMaster()->MovePoint(0, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY()-65.0f, Locs[LOC_BEHIND_GATE].GetPositionZ()-1.0f); - } - events.RescheduleEvent(EVENT_SCENE_102, 20000); - - // move Icehowl to side, can't remove corpse because of loot! - if( Creature* icehowl = instance->GetCreature(NPC_IcehowlGUID) ) - { - icehowl->UpdatePosition(513.19f, 139.48f, 395.22f, 3*M_PI/2, true); - icehowl->StopMovingOnCurrentPos(); - icehowl->DestroyForNearbyPlayers(); - } - } - events.PopEvent(); - } - break; - case EVENT_SCENE_102: - { - HandleGameObject(GO_MainGateGUID, false); - if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) - c->AI()->Talk(SAY_STAGE_1_02); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_103, 11000); - } - break; - case EVENT_SCENE_103: - { - if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) - { - c->AI()->Talk(SAY_STAGE_1_03); - c->HandleEmoteCommand(EMOTE_STATE_SPELL_PRECAST); - if( Creature* trigger = c->SummonCreature(NPC_PURPLE_GROUND, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN) ) - NPC_PurpleGroundGUID = trigger->GetGUID(); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_104, 5000); - } - break; - case EVENT_SCENE_104: - { - if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) - { - if( Creature* portal = c->SummonCreature(NPC_WORLD_TRIGGER, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN) ) - { - NPC_PortalGUID = portal->GetGUID(); - portal->SetObjectScale(3.0f); - portal->SetReactState(REACT_PASSIVE); - portal->CastSpell(portal, SPELL_WILFRED_PORTAL, true); - } - c->HandleEmoteCommand(EMOTE_STATE_SPELL_PRECAST); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SUMMON_JARAXXUS, 5000); - } - break; - case EVENT_SUMMON_JARAXXUS: - { - if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) - { - if( Creature* jaraxxus = c->SummonCreature(NPC_JARAXXUS, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) ) - jaraxxus->GetMotionMaster()->MovePoint(0, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY()-10.0f, Locs[LOC_CENTER].GetPositionZ()); - c->HandleEmoteCommand(EMOTE_STATE_NONE); - c->AI()->Talk(SAY_STAGE_1_04); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_105, 3000); - } - break; - case EVENT_SCENE_105: - { - if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) - c->SetFacingTo(M_PI/2); - if( Creature* c = instance->GetCreature(NPC_PurpleGroundGUID) ) - c->DespawnOrUnsummon(); - NPC_PurpleGroundGUID = 0; - if( Creature* c = instance->GetCreature(NPC_PortalGUID) ) - c->DespawnOrUnsummon(); - NPC_PortalGUID = 0; - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_106, 10000); - } - break; - case EVENT_SCENE_106: - { - if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) - c->AI()->Talk(SAY_STAGE_1_05); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_107, 5000); - } - break; - case EVENT_SCENE_107: - { - if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) - c->AI()->Talk(SAY_STAGE_1_06); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_108, 800); - } - break; - case EVENT_SCENE_108: - { - if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) - { - c->MonsterYell("Banished to the Nether!", LANG_UNIVERSAL, 0); - c->PlayDirectSound(16146, 0); - if( Creature* f = instance->GetCreature(NPC_FizzlebangGUID) ) - { - c->CastSpell(f, 67888, true); - Unit::Kill(f, f); - } - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_109, 5000); - } - break; - case EVENT_SCENE_109: - { - if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) - c->SetFacingTo(3*M_PI/2); - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_1_07); - events.PopEvent(); - events.RescheduleEvent(EVENT_JARAXXUS_ATTACK, 6000); - } - break; - case EVENT_JARAXXUS_ATTACK: - { - InstanceProgress = INSTANCE_PROGRESS_JARAXXUS_INTRO_DONE; - if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - if( Unit* target = c->SelectNearestTarget(200.0f) ) - { - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - } - } - events.PopEvent(); - } - break; - case EVENT_SCENE_110: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_1_08); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_111, 18000); - } - break; - case EVENT_SCENE_111: - { - if( Creature* c = instance->GetCreature(NPC_GarroshGUID) ) - c->AI()->Talk(SAY_STAGE_1_09); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_112, 9000); - } - break; - case EVENT_SCENE_112: - { - if( Creature* c = instance->GetCreature(NPC_VarianGUID) ) - c->AI()->Talk(SAY_STAGE_1_10); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_113, 5000); - } - break; - case EVENT_SCENE_113: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_1_11); - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - events.PopEvent(); - } - break; - case EVENT_SCENE_201: - { - // move Jaraxxus to side, can't remove corpse because of loot! - if( Creature* jaraxxus = instance->GetCreature(NPC_JaraxxusGUID) ) - { - jaraxxus->UpdatePosition(613.83f, 139.5f, 395.22f, 3*M_PI/2, true); - jaraxxus->StopMovingOnCurrentPos(); - jaraxxus->DestroyForNearbyPlayers(); - } - - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_2_01); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_202, 9000); - } - break; - case EVENT_SCENE_202: - { - Map::PlayerList const &pl = instance->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - if( !plr->IsGameMaster() ) - { - TeamIdInInstance = plr->GetTeamId(); - break; - } - - if( TeamIdInInstance == TEAM_ALLIANCE ) - { - if( Creature* c = instance->GetCreature(NPC_GarroshGUID) ) - c->AI()->Talk(SAY_STAGE_2_02h); - events.RescheduleEvent(EVENT_SCENE_203, 15000); - } - else - { - if( Creature* c = instance->GetCreature(NPC_VarianGUID) ) - c->AI()->Talk(SAY_STAGE_2_02a); - events.RescheduleEvent(EVENT_SCENE_203, 18000); - } - events.PopEvent(); - } - break; - case EVENT_SCENE_203: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_2_03); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_204, 5000); - } - break; - case EVENT_SCENE_204: - { - if( TeamIdInInstance == TEAM_ALLIANCE ) - { - if( Creature* c = instance->GetCreature(NPC_GarroshGUID) ) - c->AI()->Talk(SAY_STAGE_2_04h); - events.RescheduleEvent(EVENT_SCENE_205, 6000); - } - else - { - if( Creature* c = instance->GetCreature(NPC_VarianGUID) ) - c->AI()->Talk(SAY_STAGE_2_04a); - events.RescheduleEvent(EVENT_SCENE_205, 5000); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SUMMON_CHAMPIONS, 2500); - } - break; - case EVENT_SCENE_205: - { - if( Creature* c = instance->GetCreature(TeamIdInInstance == TEAM_ALLIANCE ? NPC_VarianGUID : NPC_GarroshGUID) ) - c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_STAGE_2_05a : SAY_STAGE_2_05h); - events.PopEvent(); - } - break; - case EVENT_SUMMON_CHAMPIONS: - { - std::vector vHealerEntries; - vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_DRUID_RESTORATION : NPC_ALLIANCE_DRUID_RESTORATION); - vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_PALADIN_HOLY : NPC_ALLIANCE_PALADIN_HOLY); - vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_PRIEST_DISCIPLINE : NPC_ALLIANCE_PRIEST_DISCIPLINE); - vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_SHAMAN_RESTORATION : NPC_ALLIANCE_SHAMAN_RESTORATION); - - std::vector vOtherEntries; - vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_DEATH_KNIGHT : NPC_ALLIANCE_DEATH_KNIGHT); - vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_HUNTER : NPC_ALLIANCE_HUNTER); - vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_MAGE : NPC_ALLIANCE_MAGE); - vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_ROGUE : NPC_ALLIANCE_ROGUE); - vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_WARLOCK : NPC_ALLIANCE_WARLOCK); - vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR); - - uint8 healersSubtracted = 2; - if( instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC ) - healersSubtracted = 1; - for( uint8 i = 0; i < healersSubtracted; ++i ) - { - uint8 pos = urand(0, vHealerEntries.size()-1); - switch( vHealerEntries[pos] ) - { - case NPC_ALLIANCE_DRUID_RESTORATION: - vOtherEntries.push_back(NPC_ALLIANCE_DRUID_BALANCE); - break; - case NPC_HORDE_DRUID_RESTORATION: - vOtherEntries.push_back(NPC_HORDE_DRUID_BALANCE); - break; - case NPC_ALLIANCE_PALADIN_HOLY: - vOtherEntries.push_back(NPC_ALLIANCE_PALADIN_RETRIBUTION); - break; - case NPC_HORDE_PALADIN_HOLY: - vOtherEntries.push_back(NPC_HORDE_PALADIN_RETRIBUTION); - break; - case NPC_ALLIANCE_PRIEST_DISCIPLINE: - vOtherEntries.push_back(NPC_ALLIANCE_PRIEST_SHADOW); - break; - case NPC_HORDE_PRIEST_DISCIPLINE: - vOtherEntries.push_back(NPC_HORDE_PRIEST_SHADOW); - break; - case NPC_ALLIANCE_SHAMAN_RESTORATION: - vOtherEntries.push_back(NPC_ALLIANCE_SHAMAN_ENHANCEMENT); - break; - case NPC_HORDE_SHAMAN_RESTORATION: - vOtherEntries.push_back(NPC_HORDE_SHAMAN_ENHANCEMENT); - break; - } - vHealerEntries.erase(vHealerEntries.begin()+pos); - } - - if( instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL || instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC ) - for( uint8 i=0; i<4; ++i ) - vOtherEntries.erase(vOtherEntries.begin()+urand(0, vOtherEntries.size()-1)); - - for( std::vector::iterator itr = vHealerEntries.begin(); itr != vHealerEntries.end(); ++itr ) - vOtherEntries.push_back(*itr); - - uint8 pos2 = 10; - for( std::vector::iterator itr = vOtherEntries.begin(); itr != vOtherEntries.end(); ++itr ) - { - if( Creature* pTemp = instance->SummonCreature(*itr, FactionChampionLoc[urand(0, 4)+(TeamIdInInstance == TEAM_ALLIANCE ? 0 : 5)]) ) - { - NPC_ChampionGUIDs.push_back(pTemp->GetGUID()); - pTemp->SetHomePosition((TeamIdInInstance == TEAM_ALLIANCE ? FactionChampionLoc[pos2].GetPositionX() : (Locs[LOC_CENTER].GetPositionX()*2-FactionChampionLoc[pos2].GetPositionX())), FactionChampionLoc[pos2].GetPositionY(), FactionChampionLoc[pos2].GetPositionZ(), 0.0f); - pTemp->GetMotionMaster()->MoveJump((TeamIdInInstance == TEAM_ALLIANCE ? FactionChampionLoc[pos2].GetPositionX() : (Locs[LOC_CENTER].GetPositionX()*2-FactionChampionLoc[pos2].GetPositionX())), FactionChampionLoc[pos2].GetPositionY(), FactionChampionLoc[pos2].GetPositionZ(), 20.0f, 20.0f); - } - ++pos2; - } - - HandleGameObject(GO_EnterGateGUID, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_CHAMPIONS_ATTACK, 4000); - } - break; - case EVENT_CHAMPIONS_ATTACK: - { - for( std::vector::iterator itr = NPC_ChampionGUIDs.begin(); itr != NPC_ChampionGUIDs.end(); ++itr ) - if( Creature* c = instance->GetCreature(*itr) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - //if( Unit* target = c->SelectNearestTarget(200.0f) ) - // c->AI()->AttackStart(target); - } - Map::PlayerList const& pl = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - itr->GetSource()->AddToNotify(NOTIFY_AI_RELOCATION); - EncounterStatus = IN_PROGRESS; - events.PopEvent(); - } - break; - case EVENT_SCENE_FACTION_CHAMPIONS_DEAD: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_2_06); - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - events.PopEvent(); - } - break; - case EVENT_SCENE_301: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_3_01); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_302, 13000); - } - break; - case EVENT_SCENE_302: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_3_02); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_303, 3000); - } - break; - case EVENT_SCENE_303: - { - HandleGameObject(GO_EnterGateGUID, false); - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - { - HandleGameObject(GO_MainGateGUID, true); - if( Creature* t = c->SummonCreature(NPC_LIGHTBANE, Locs[LOC_VALKYR_RIGHT].GetPositionX(), Locs[LOC_VALKYR_RIGHT].GetPositionY(), Locs[LOC_VALKYR_RIGHT].GetPositionZ(), Locs[LOC_VALKYR_RIGHT].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) ) - t->GetMotionMaster()->MovePoint(0, Locs[LOC_VALKYR_DEST_RIGHT].GetPositionX(), Locs[LOC_VALKYR_DEST_RIGHT].GetPositionY(), Locs[LOC_VALKYR_DEST_RIGHT].GetPositionZ()); - if( Creature* t = c->SummonCreature(NPC_DARKBANE, Locs[LOC_VALKYR_LEFT].GetPositionX(), Locs[LOC_VALKYR_LEFT].GetPositionY(), Locs[LOC_VALKYR_LEFT].GetPositionZ(), Locs[LOC_VALKYR_LEFT].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) ) - t->GetMotionMaster()->MovePoint(0, Locs[LOC_VALKYR_DEST_LEFT].GetPositionX(), Locs[LOC_VALKYR_DEST_LEFT].GetPositionY(), Locs[LOC_VALKYR_DEST_LEFT].GetPositionZ()); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_304, 6250); - } - break; - case EVENT_SCENE_304: - { - HandleGameObject(GO_MainGateGUID, false); - EncounterStatus = IN_PROGRESS; - if( Creature* c = instance->GetCreature(NPC_LightbaneGUID) ) - c->GetMotionMaster()->MovePoint(0, Locs[LOC_VALKYR_DEST_2_RIGHT].GetPositionX(), Locs[LOC_VALKYR_DEST_2_RIGHT].GetPositionY(), Locs[LOC_VALKYR_DEST_2_RIGHT].GetPositionZ()); - if( Creature* c = instance->GetCreature(NPC_DarkbaneGUID) ) - c->GetMotionMaster()->MovePoint(0, Locs[LOC_VALKYR_DEST_2_LEFT].GetPositionX(), Locs[LOC_VALKYR_DEST_2_LEFT].GetPositionY(), Locs[LOC_VALKYR_DEST_2_LEFT].GetPositionZ()); - events.PopEvent(); - events.RescheduleEvent(EVENT_VALKYRIES_ATTACK, 3250); - } - break; - case EVENT_VALKYRIES_ATTACK: - { - if( Creature* c = instance->GetCreature(NPC_LightbaneGUID) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - /*if( Unit* target = c->SelectNearestTarget(200.0f) ) - { - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - }*/ - } - if( Creature* c = instance->GetCreature(NPC_DarkbaneGUID) ) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - /*if( Unit* target = c->SelectNearestTarget(200.0f) ) - { - c->AI()->AttackStart(target); - c->AI()->DoZoneInCombat(); - }*/ - } - events.PopEvent(); - } - break; - case EVENT_SCENE_VALKYR_DEAD: - { - if (TeamIdInInstance == TEAM_NEUTRAL) - { - Map::PlayerList const &pl = instance->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - if( !plr->IsGameMaster() ) - { - TeamIdInInstance = plr->GetTeamId(); - break; - } - } - if( Creature* c = instance->GetCreature(TeamIdInInstance == TEAM_ALLIANCE ? NPC_VarianGUID : NPC_GarroshGUID) ) - c->AI()->Talk((TeamIdInInstance == TEAM_ALLIANCE ? SAY_STAGE_3_03a : SAY_STAGE_3_03h)); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_401, 60000); - } - break; - case EVENT_SCENE_401: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_4_01); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_402, 20000); - } - break; - case EVENT_SCENE_402: - { - HandleGameObject(GO_EnterGateGUID, false); - EncounterStatus = IN_PROGRESS; - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - if( Creature* t = c->SummonCreature(NPC_LICH_KING, Locs[LOC_ARTHAS_PORTAL]) ) - { - t->SetReactState(REACT_PASSIVE); - t->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - t->SetDisplayId(11686); - t->AI()->Talk(SAY_STAGE_4_02); - t->SetVisible(false); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_403, 2000); - } - break; - case EVENT_SCENE_403: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - if( Creature* t = c->SummonCreature(NPC_WORLD_TRIGGER, Locs[LOC_ARTHAS_PORTAL], TEMPSUMMON_TIMED_DESPAWN, 60000) ) - { - t->SetReactState(REACT_PASSIVE); - t->CastSpell(t, 51807, true); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_404, 2000); - } - break; - case EVENT_SCENE_404: - { - if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) - { - c->SetDisplayId(c->GetNativeDisplayId()); - c->SetVisible(true); - c->GetMotionMaster()->MovePoint(0, Locs[LOC_ARTHAS]); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_405, 3000); - } - break; - case EVENT_SCENE_405: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - c->AI()->Talk(SAY_STAGE_4_03); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_406, 7000); - } - break; - case EVENT_SCENE_406: - { - if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) - { - c->AI()->Talk(SAY_STAGE_4_04); - c->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_406_2, 2500); - events.RescheduleEvent(EVENT_SCENE_407, 12000); - } - break; - case EVENT_SCENE_406_2: - { - if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) - c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); - events.PopEvent(); - } - break; - case EVENT_SCENE_407: - { - if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) - c->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_408, 4000); - } - break; - case EVENT_SCENE_408: - { - if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) - { - c->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_409, 1500); - } - break; - case EVENT_SCENE_409: - { - if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) - { - if( GameObject* floor = instance->GetGameObject(GO_FloorGUID) ) - floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);//floor->ModifyHealth(-10000000, c); - c->CastSpell((Unit*)NULL, 68193, true); - c->SetVisible(false); - c->SetDisplayId(11686); - if( Creature* t = c->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f, true) ) - t->DespawnOrUnsummon(); - - if( Creature* barrett = instance->GetCreature(NPC_BarrettGUID) ) - { - barrett->SetVisible(false); - barrett->SummonCreature(NPC_ANUBARAK, Locs[LOC_ANUB].GetPositionX(), Locs[LOC_ANUB].GetPositionY(), Locs[LOC_ANUB].GetPositionZ(), Locs[LOC_ANUB].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000); - } - - // move corpses: - if( Creature* c = instance->GetCreature(NPC_IcehowlGUID) ) - { - c->UpdatePosition(626.57f, 162.8f, 140.25f, 4.44f, true); - c->StopMovingOnCurrentPos(); - c->DestroyForNearbyPlayers(); - } - if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) - { - c->UpdatePosition(603.92f, 102.61f, 141.85f, 1.4f, true); - c->StopMovingOnCurrentPos(); - c->DestroyForNearbyPlayers(); - } - if( Creature* c = instance->GetCreature(NPC_LightbaneGUID) ) - { - c->UpdatePosition(634.58f, 147.16f, 140.5f, 3.02f, true); - c->StopMovingOnCurrentPos(); - c->DestroyForNearbyPlayers(); - } - if( Creature* c = instance->GetCreature(NPC_DarkbaneGUID) ) - { - c->UpdatePosition(630.88f, 131.39f, 140.8f, 3.02f, true); - c->StopMovingOnCurrentPos(); - c->DestroyForNearbyPlayers(); - } - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_410, 2000); - } - break; - case EVENT_SCENE_410: - { - if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) - { - c->SetVisible(true); - c->AI()->Talk(SAY_STAGE_4_05); - c->DespawnOrUnsummon(0); - } - events.PopEvent(); - } - break; - case EVENT_SCENE_501: - { - if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) - { - c->AI()->Talk(SAY_STAGE_4_06); - c->SummonCreature(NPC_ARGENT_MAGE, Locs[LOC_MAGE].GetPositionX(), Locs[LOC_MAGE].GetPositionY(), Locs[LOC_MAGE].GetPositionZ(), Locs[LOC_MAGE].GetOrientation()); - c->SummonGameObject(195682, 668.15f, 134.57f, 142.12f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 630000000); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SCENE_502, 20000); - } - break; - case EVENT_SCENE_502: - { - if( instance->IsHeroic() ) - { - uint32 tributeChest = 0; - if( instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC ) - { - if (AttemptsLeft >= 50) - tributeChest = GO_TRIBUTE_CHEST_10H_99; - else if (AttemptsLeft >= 45) - tributeChest = GO_TRIBUTE_CHEST_10H_50; - else if (AttemptsLeft >= 25) - tributeChest = GO_TRIBUTE_CHEST_10H_45; - else - tributeChest = GO_TRIBUTE_CHEST_10H_25; - } - else if( instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC ) - { - if (AttemptsLeft >= 50) - tributeChest = GO_TRIBUTE_CHEST_25H_99; - else if (AttemptsLeft >= 45) - tributeChest = GO_TRIBUTE_CHEST_25H_50; - else if (AttemptsLeft >= 25) - tributeChest = GO_TRIBUTE_CHEST_25H_45; - else - tributeChest = GO_TRIBUTE_CHEST_25H_25; - } - if (tributeChest) - if (Creature* c = instance->GetCreature(NPC_TirionGUID)) - { - c->AI()->Talk(SAY_STAGE_4_07); - if (GameObject* chest = c->SummonGameObject(tributeChest, 665.12f, 143.78f, 142.12f, 0.0f, 0, 0, 0, 0, 90000000)) - { - chest->SetRespawnTime(chest->GetRespawnDelay()); - - Map::PlayerList const &pl = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* plr = itr->GetSource()) - if (Group* g = plr->GetGroup()) - if (!plr->IsGameMaster() && g->GetLeaderGUID() == plr->GetGUID()) - { - chest->SetLootRecipient(plr); - break; - } - } - } - } - - events.PopEvent(); - } - break; - } - } - - void OnPlayerEnter(Player* plr) - { - if( instance->IsHeroic() ) - { - plr->SendUpdateWorldState(UPDATE_STATE_UI_SHOW, 1); - plr->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, AttemptsLeft); - } - else - plr->SendUpdateWorldState(UPDATE_STATE_UI_SHOW, 0); - - if( DoNeedCleanup(true) ) - InstanceCleanup(); - - events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); - } - - bool DoNeedCleanup(bool /*enter*/) - { - uint8 aliveCount = 0; - Map::PlayerList const &pl = instance->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - if( plr->IsAlive() && !plr->IsGameMaster() ) - ++aliveCount; - - bool need = aliveCount==0; - if( !need && CLEANED ) - CLEANED = false; - return need; - } - - void InstanceCleanup(bool fromFailed = false) - { - if( CLEANED ) - return; - CLEANED = true; - - switch( InstanceProgress ) - { - case INSTANCE_PROGRESS_INITIAL: - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - case INSTANCE_PROGRESS_INTRO_DONE: - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - if( Creature* c = instance->GetCreature(NPC_GormokGUID) ) - { - c->AI()->DoAction(-1); // despawn summons - c->DespawnOrUnsummon(); - } - NPC_GormokGUID = 0; - if( Creature* c = instance->GetCreature(NPC_AcidmawGUID) ) - c->DespawnOrUnsummon(); - NPC_AcidmawGUID = 0; - if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) ) - c->DespawnOrUnsummon(); - NPC_DreadscaleGUID = 0; - if( Creature* c = instance->GetCreature(NPC_IcehowlGUID) ) - c->DespawnOrUnsummon(); - NPC_IcehowlGUID = 0; - northrendBeastsMask = 0; - break; - case INSTANCE_PROGRESS_BEASTS_DEAD: - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) - c->DespawnOrUnsummon(); - NPC_FizzlebangGUID = 0; - if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) - c->DespawnOrUnsummon(); - NPC_JaraxxusGUID = 0; - if( Creature* c = instance->GetCreature(NPC_PurpleGroundGUID) ) - c->DespawnOrUnsummon(); - NPC_PurpleGroundGUID = 0; - if( Creature* c = instance->GetCreature(NPC_PortalGUID) ) - c->DespawnOrUnsummon(); - NPC_PortalGUID = 0; - break; - case INSTANCE_PROGRESS_JARAXXUS_INTRO_DONE: - if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) - c->DespawnOrUnsummon(); - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - { - c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - if( Creature* jaraxxus = c->SummonCreature(NPC_JARAXXUS, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) ) - { - jaraxxus->CastSpell(jaraxxus, 67924, true); - jaraxxus->SetReactState(REACT_AGGRESSIVE); - jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - jaraxxus->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - } - } - break; - case INSTANCE_PROGRESS_JARAXXUS_DEAD: - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - for( std::vector::iterator itr = NPC_ChampionGUIDs.begin(); itr != NPC_ChampionGUIDs.end(); ++itr ) - if( Creature* c = instance->GetCreature(*itr) ) - c->DespawnOrUnsummon(); - NPC_ChampionGUIDs.clear(); - break; - case INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD: - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - if( Creature* c = instance->GetCreature(NPC_DarkbaneGUID) ) - { - c->AI()->DoAction(-1); - c->DespawnOrUnsummon(); - } - NPC_DarkbaneGUID = 0; - if( Creature* c = instance->GetCreature(NPC_LightbaneGUID) ) - { - c->AI()->DoAction(-1); - c->DespawnOrUnsummon(); - } - NPC_LightbaneGUID = 0; - break; - case INSTANCE_PROGRESS_VALKYR_DEAD: - if( GameObject* floor = instance->GetGameObject(GO_FloorGUID) ) - floor->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - { - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - c->SetVisible(true); - c->SetFacingTo(c->GetOrientation()); - if( Creature* t = c->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f, true) ) - t->DespawnOrUnsummon(); - } - if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) - c->DespawnOrUnsummon(); - NPC_LichKingGUID = 0; - - if( Creature* c = instance->GetCreature(NPC_AnubarakGUID) ) - { - c->AI()->DoAction(-1); - c->DespawnOrUnsummon(); - } - NPC_AnubarakGUID = 0; - - break; - case INSTANCE_PROGRESS_DONE: - if( GameObject* floor = instance->GetGameObject(GO_FloorGUID) ) - floor->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - { - c->SetVisible(false); - c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - break; - } - - if (instance->IsHeroic() && AttemptsLeft > 0 && !fromFailed && EncounterStatus == IN_PROGRESS) - { - --AttemptsLeft; - Map::PlayerList const &pl = instance->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - plr->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, AttemptsLeft); - } - - if( instance->IsHeroic() && AttemptsLeft == 0 ) - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - - HandleGameObject(GO_MainGateGUID, false); - HandleGameObject(GO_EnterGateGUID, true); - HandleGameObject(GO_WebDoorGUID, true); - Counter = 0; - EncounterStatus = NOT_STARTED; - events.Reset(); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "T C " << InstanceProgress; - if( instance->IsHeroic() ) - saveStream << ' ' << AttemptsLeft << ' ' << (bDedicatedInsanity ? (uint32)1 : (uint32)0) << ' ' << (bNooneDied ? (uint32)1 : (uint32)0); - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - EncounterStatus = NOT_STARTED; - CLEANED = false; - events.Reset(); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); - - if( !in ) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0; - - if( dataHead1 == 'T' && dataHead2 == 'C' ) - { - InstanceProgress = data0; - if( instance->IsHeroic() ) - { - uint32 data1 = 0, data2 = 0, data3 = 0; - loadStream >> data1 >> data2 >> data3; - AttemptsLeft = data1; - bDedicatedInsanity = data2 ? true : false; - bNooneDied = data3 ? true : false; - } - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } - - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case ACHIEV_CRITERIA_UPPER_BACK_PAIN_10_N: - case ACHIEV_CRITERIA_UPPER_BACK_PAIN_10_H: - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - { - std::list L; - uint8 count = 0; - c->GetCreaturesWithEntryInRange(L, 200.0f, 34800); // find all snobolds - for( std::list::const_iterator itr = L.begin(); itr != L.end(); ++itr ) - if( (*itr)->GetVehicle() ) - ++count; - return (count >= 2); - } - break; - case ACHIEV_CRITERIA_UPPER_BACK_PAIN_25_N: - case ACHIEV_CRITERIA_UPPER_BACK_PAIN_25_H: - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - { - std::list L; - uint8 count = 0; - c->GetCreaturesWithEntryInRange(L, 200.0f, 34800); // find all snobolds - for( std::list::const_iterator itr = L.begin(); itr != L.end(); ++itr ) - if( (*itr)->GetVehicle() ) - ++count; - return (count >= 4); - } - break; - case ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_10_N: - case ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_10_H: - case ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_25_N: - case ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_25_H: - if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) - { - std::list L; - uint8 count = 0; - c->GetCreaturesWithEntryInRange(L, 200.0f, 34826); // find all mistress of pain - for( std::list::const_iterator itr = L.begin(); itr != L.end(); ++itr ) - if( (*itr)->IsAlive() ) - ++count; - return (count >= 2); - } - break; - case ACHIEV_CRITERIA_A_TRIBUTE_TO_SKILL_10_PLAYER: - case ACHIEV_CRITERIA_A_TRIBUTE_TO_SKILL_25_PLAYER: - return AttemptsLeft >= 25; - case ACHIEV_CRITERIA_A_TRIBUTE_TO_MAD_SKILL_10_PLAYER: - case ACHIEV_CRITERIA_A_TRIBUTE_TO_MAD_SKILL_25_PLAYER: - return AttemptsLeft >= 45; - case ACHIEV_CRITERIA_A_TRIBUTE_TO_INSANITY_10_PLAYER: - case ACHIEV_CRITERIA_A_TRIBUTE_TO_INSANITY_25_PLAYER: - case ACHIEV_CRITERIA_REALM_FIRST_GRAND_CRUSADER: - return AttemptsLeft == 50; - case ACHIEV_CRITERIA_A_TRIBUTE_TO_IMMORTALITY_HORDE: - case ACHIEV_CRITERIA_A_TRIBUTE_TO_IMMORTALITY_ALLIANCE: - return AttemptsLeft == 50 && bNooneDied; - case ACHIEV_CRITERIA_A_TRIBUTE_TO_DEDICATED_INSANITY: - return AttemptsLeft == 50 && bDedicatedInsanity; - } - return false; - } - }; - - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_trial_of_the_crusader_InstanceMapScript(map); - } + instance_trial_of_the_crusader() : InstanceMapScript("instance_trial_of_the_crusader", 649) { } + + struct instance_trial_of_the_crusader_InstanceMapScript : public InstanceScript + { + instance_trial_of_the_crusader_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } + + bool CLEANED; + uint32 EncounterStatus; + uint32 InstanceProgress; + uint32 AttemptsLeft; + TeamId TeamIdInInstance; + uint8 Counter; + uint8 northrendBeastsMask; + uint32 AchievementTimer; + bool bDedicatedInsanity; + bool bSwitcher; + bool bNooneDied; + std::string str_data; + EventMap events; + + uint64 NPC_BarrettGUID; + uint64 NPC_TirionGUID; + uint64 NPC_FizzlebangGUID; + uint64 NPC_GarroshGUID; + uint64 NPC_VarianGUID; + + uint64 NPC_GormokGUID; + uint64 NPC_DreadscaleGUID; + uint64 NPC_AcidmawGUID; + uint64 NPC_IcehowlGUID; + uint64 NPC_JaraxxusGUID; + std::vector NPC_ChampionGUIDs; + uint64 NPC_LightbaneGUID; + uint64 NPC_DarkbaneGUID; + uint64 NPC_LichKingGUID; + uint64 NPC_AnubarakGUID; + + uint64 NPC_PurpleGroundGUID; + uint64 NPC_PortalGUID; + + uint64 GO_MainGateGUID; + uint64 GO_EnterGateGUID; + uint64 GO_WebDoorGUID; + uint64 GO_FloorGUID; + + bool IsValidDedicatedInsanityItem(const ItemTemplate* item) + { + if (!item) // should not happen, but checked in GetAverageItemLevel() + return true; + if (item->ItemLevel < 245) + return true; + if (item->ItemId == 46017) // Val'anyr, Hammer of Ancient Kings - exception, too powerful + return false; + if (item->ItemLevel == 245 && item->Bonding == BIND_WHEN_EQUIPED) // this also includes items crafted from patterns obtained in ToC 10 norm/hc + return true; + if (validDedicatedInsanityItems.find(item->ItemId) != validDedicatedInsanityItems.end()) // list of items dropping from ToC 10 norm/hc and also items ilevel 245 buyable for emblems of triumph + return true; + + return false; + } + + void DoCheckDedicatedInsanity() + { + if (!bDedicatedInsanity || AttemptsLeft < 50 || instance->GetDifficulty() != RAID_DIFFICULTY_10MAN_HEROIC) + return; + + if (validDedicatedInsanityItems.empty()) + { + for (uint32 i=0; iGetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* plr = itr->GetSource()) + if (!plr->IsGameMaster() && plr->IsInCombat() /*performance*/) + { + for (uint8 i=EQUIPMENT_SLOT_START; iGetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (!IsValidDedicatedInsanityItem(item->GetTemplate())) + { + bDedicatedInsanity = false; + SaveToDB(); + return; + } + } + } + + void OnUnitDeath(Unit* u) + { + if (bNooneDied && u->GetTypeId() == TYPEID_PLAYER) + { + bNooneDied = false; + SaveToDB(); + } + } + + void Initialize() + { + CLEANED = false; + EncounterStatus = NOT_STARTED; + InstanceProgress = INSTANCE_PROGRESS_INITIAL; + AttemptsLeft = 50; + TeamIdInInstance = TEAM_NEUTRAL; + Counter = 0; + northrendBeastsMask = 0; + AchievementTimer = 0; + bDedicatedInsanity = true; + bSwitcher = false; + bNooneDied = true; + events.Reset(); + events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); + + NPC_BarrettGUID = 0; + NPC_TirionGUID = 0; + NPC_FizzlebangGUID = 0; + NPC_GarroshGUID = 0; + NPC_VarianGUID = 0; + + NPC_GormokGUID = 0; + NPC_DreadscaleGUID = 0; + NPC_AcidmawGUID = 0; + NPC_IcehowlGUID = 0; + NPC_JaraxxusGUID = 0; + NPC_ChampionGUIDs.clear(); + NPC_LightbaneGUID = 0; + NPC_DarkbaneGUID = 0; + NPC_LichKingGUID = 0; + NPC_AnubarakGUID = 0; + + NPC_PurpleGroundGUID = 0; + NPC_PortalGUID = 0; + + GO_MainGateGUID = 0; + GO_EnterGateGUID = 0; + GO_WebDoorGUID = 0; + GO_FloorGUID = 0; + } + + bool IsEncounterInProgress() const + { + uint8 aliveCount = 0; + Map::PlayerList const &pl = instance->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + if( plr->IsAlive() && !plr->IsGameMaster() ) + return EncounterStatus == IN_PROGRESS; // found alive player + + if( EncounterStatus != NOT_STARTED ) + *(const_cast(&EncounterStatus)) = NOT_STARTED; + return false; + } + + void OnCreatureCreate(Creature* creature) + { + switch( creature->GetEntry() ) + { + case NPC_BARRENT: + NPC_BarrettGUID = creature->GetGUID(); + break; + case NPC_TIRION: + NPC_TirionGUID = creature->GetGUID(); + break; + case NPC_GARROSH: + NPC_GarroshGUID = creature->GetGUID(); + break; + case NPC_VARIAN: + NPC_VarianGUID = creature->GetGUID(); + break; + case NPC_FIZZLEBANG: + NPC_FizzlebangGUID = creature->GetGUID(); + break; + + case NPC_GORMOK: + NPC_GormokGUID = creature->GetGUID(); + break; + case NPC_DREADSCALE: + NPC_DreadscaleGUID = creature->GetGUID(); + break; + case NPC_ACIDMAW: + NPC_AcidmawGUID = creature->GetGUID(); + break; + case NPC_ICEHOWL: + NPC_IcehowlGUID = creature->GetGUID(); + break; + case NPC_JARAXXUS: + NPC_JaraxxusGUID = creature->GetGUID(); + break; + case NPC_LIGHTBANE: + NPC_LightbaneGUID = creature->GetGUID(); + break; + case NPC_DARKBANE: + NPC_DarkbaneGUID = creature->GetGUID(); + break; + case NPC_LICH_KING: + NPC_LichKingGUID = creature->GetGUID(); + break; + case NPC_ANUBARAK: + NPC_AnubarakGUID = creature->GetGUID(); + break; + } + } + + void OnGameObjectCreate(GameObject* go) + { + switch( go->GetEntry() ) + { + case GO_MAIN_GATE_DOOR: + GO_MainGateGUID = go->GetGUID(); + HandleGameObject(GO_MainGateGUID, false, go); + break; + case GO_WEB_DOOR: + GO_WebDoorGUID = go->GetGUID(); + HandleGameObject(GO_WebDoorGUID, true, go); + break; + case GO_ARGENT_COLISEUM_FLOOR: + GO_FloorGUID = go->GetGUID(); + break; + case GO_SOUTH_PORTCULLIS: + case GO_NORTH_PORTCULLIS: + HandleGameObject(go->GetGUID(), false, go); + break; + case GO_EAST_PORTCULLIS: + HandleGameObject(go->GetGUID(), true, go); + GO_EnterGateGUID = go->GetGUID(); + break; + } + } + + void SetData(uint32 type, uint32 data) + { + switch( type ) + { + case TYPE_FAILED: + // - some scene here? + if( instance->IsHeroic() && !CLEANED ) + { + if( AttemptsLeft > 0 ) + --AttemptsLeft; + Map::PlayerList const &pl = instance->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + plr->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, AttemptsLeft); + } + InstanceCleanup(true); + SaveToDB(); + break; + case TYPE_ANNOUNCER_GOSSIP_SELECT: + if( instance->IsHeroic() && AttemptsLeft == 0 ) + break; + switch( InstanceProgress ) + { + case INSTANCE_PROGRESS_INITIAL: + events.RescheduleEvent(EVENT_SCENE_001, 0); + break; + case INSTANCE_PROGRESS_INTRO_DONE: + events.RescheduleEvent(EVENT_SCENE_004, 0); + break; + case INSTANCE_PROGRESS_BEASTS_DEAD: + events.RescheduleEvent(EVENT_SCENE_101, 0); + break; + case INSTANCE_PROGRESS_JARAXXUS_DEAD: + events.RescheduleEvent(EVENT_SCENE_201, 0); + break; + case INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD: + events.RescheduleEvent(EVENT_SCENE_301, 0); + break; + case INSTANCE_PROGRESS_VALKYR_DEAD: + events.RescheduleEvent(EVENT_SCENE_401, 0); + break; + } + break; + case TYPE_GORMOK: + if( data == DONE ) + { + if (Creature* trigger = instance->SummonCreature(WORLD_TRIGGER, Locs[LOC_CENTER], NULL, 25000)) + { + trigger->SetDisplayId(11686); + trigger->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + trigger->setFaction(14); + trigger->SetInCombatWithZone(); + } + + EncounterStatus = IN_PROGRESS; + + northrendBeastsMask |= 1; + if ((northrendBeastsMask & 7) == 7) + SetData(TYPE_NORTHREND_BEASTS_ALL, DONE); + else if ((northrendBeastsMask & 16) == 0) + events.RescheduleEvent(EVENT_SCENE_005, 2500); + } + break; + case TYPE_JORMUNGAR: + if( data == DONE ) + { + if( ++Counter == 2 ) + { + if (Creature* trigger = instance->SummonCreature(WORLD_TRIGGER, Locs[LOC_CENTER], NULL, 25000)) + { + trigger->SetDisplayId(11686); + trigger->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + trigger->setFaction(14); + trigger->SetInCombatWithZone(); + } + + if( Creature* c = instance->GetCreature(NPC_AcidmawGUID) ) + c->DespawnOrUnsummon(10000); + if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) ) + c->DespawnOrUnsummon(10000); + if( AchievementTimer+10 >= time(NULL) ) + DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_JORMUNGAR_ACHIEV); + AchievementTimer = 0; + + EncounterStatus = IN_PROGRESS; + + northrendBeastsMask |= 2; + if ((northrendBeastsMask & 7) == 7) + SetData(TYPE_NORTHREND_BEASTS_ALL, DONE); + else if ((northrendBeastsMask & 32) == 0) + { + Counter = 0; + events.RescheduleEvent(EVENT_SCENE_006, 2500); + } + } + else // first one died, start timer for achievement + { + AchievementTimer = time(NULL); + } + } + else + AchievementTimer = 0; + break; + case TYPE_ICEHOWL: + if( data == DONE ) + { + northrendBeastsMask |= 4; + if ((northrendBeastsMask & 7) == 7) + SetData(TYPE_NORTHREND_BEASTS_ALL, DONE); + } + break; + case TYPE_NORTHREND_BEASTS_ALL: + if (data == DONE) + { + northrendBeastsMask = 0; + EncounterStatus = NOT_STARTED; + InstanceProgress = INSTANCE_PROGRESS_BEASTS_DEAD; + HandleGameObject(GO_EnterGateGUID, true); + events.CancelEvent(EVENT_NORTHREND_BEASTS_ENRAGE); + events.RescheduleEvent(EVENT_SCENE_BEASTS_DONE, 2500); + SaveToDB(); + } + break; + case TYPE_JARAXXUS: + EncounterStatus = data == IN_PROGRESS ? IN_PROGRESS : NOT_STARTED; + if( data == IN_PROGRESS ) + HandleGameObject(GO_EnterGateGUID, false); + else if( data == DONE ) + { + HandleGameObject(GO_EnterGateGUID, true); + InstanceProgress = INSTANCE_PROGRESS_JARAXXUS_DEAD; + events.RescheduleEvent(EVENT_SCENE_110, 2500); + SaveToDB(); + } + break; + case TYPE_FACTION_CHAMPIONS: + if( data == DONE ) + { + if( ++Counter >= NPC_ChampionGUIDs.size() ) + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->CastSpell(c, SPELL_FACTION_CHAMPIONS_KILL_CREDIT, true); + Counter = 0; + EncounterStatus = NOT_STARTED; + InstanceProgress = INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD; + events.RescheduleEvent(EVENT_SCENE_FACTION_CHAMPIONS_DEAD, 2500); + + for( std::vector::iterator itr = NPC_ChampionGUIDs.begin(); itr != NPC_ChampionGUIDs.end(); ++itr ) + if( Creature* c = instance->GetCreature(*itr) ) + c->DespawnOrUnsummon(15000); + NPC_ChampionGUIDs.clear(); + + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + { + uint32 cacheEntry = 0; + switch( instance->GetDifficulty() ) + { + case RAID_DIFFICULTY_10MAN_NORMAL: + cacheEntry = GO_CRUSADERS_CACHE_10; + break; + case RAID_DIFFICULTY_25MAN_NORMAL: + cacheEntry = GO_CRUSADERS_CACHE_25; + break; + case RAID_DIFFICULTY_10MAN_HEROIC: + cacheEntry = GO_CRUSADERS_CACHE_10_H; + break; + case RAID_DIFFICULTY_25MAN_HEROIC: + cacheEntry = GO_CRUSADERS_CACHE_25_H; + break; + } + if (GameObject* go = c->SummonGameObject(cacheEntry, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 630000000)) + { + Map::PlayerList const &pl = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* plr = itr->GetSource()) + if (Group* g = plr->GetGroup()) + if (!plr->IsGameMaster() && g->GetLeaderGUID() == plr->GetGUID()) + { + go->SetLootRecipient(plr); + break; + } + } + } + + HandleGameObject(GO_EnterGateGUID, true); + + if( AchievementTimer+60 >= time(NULL) ) + DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_RESILIENCE_WILL_FIX_IT_CREDIT); + AchievementTimer = 0; + + SaveToDB(); + } + else if( Counter == 1 ) + AchievementTimer = time(NULL); + } + break; + case TYPE_FACTION_CHAMPIONS_START: + { + EncounterStatus = IN_PROGRESS; + AchievementTimer = 0; + for( std::vector::iterator itr = NPC_ChampionGUIDs.begin(); itr != NPC_ChampionGUIDs.end(); ++itr ) + if( Creature* c = instance->GetCreature(*itr) ) + if( !c->IsInCombat() ) + if( Unit* target = c->SelectNearestTarget(200.0f) ) + c->AI()->AttackStart(target); + } + break; + case TYPE_FACTION_CHAMPIONS_PLAYER_DIED: + if( urand(0,2) == 0 ) + { + if( TeamIdInInstance == TEAM_HORDE ) + { + if( Creature* pTemp = instance->GetCreature(NPC_VarianGUID) ) + pTemp->AI()->Talk(SAY_VARIAN_KILL_HORDE_PLAYER_1); + } + else + if( Creature* pTemp = instance->GetCreature(NPC_GarroshGUID) ) + pTemp->AI()->Talk(SAY_GARROSH_KILL_ALLIANCE_PLAYER_1); + } + break; + case TYPE_VALKYR: + if( data == DONE && ++Counter >= 2 ) + { + Counter = 0; + EncounterStatus = NOT_STARTED; + InstanceProgress = INSTANCE_PROGRESS_VALKYR_DEAD; + DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 34497, 1); // Lightbane + DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 34496, 1); // Darkbane + events.RescheduleEvent(EVENT_SCENE_VALKYR_DEAD, 2500); + HandleGameObject(GO_EnterGateGUID, true); + SaveToDB(); + } + break; + case TYPE_ANUBARAK: + if( data == IN_PROGRESS ) + { + EncounterStatus = IN_PROGRESS; + HandleGameObject(GO_WebDoorGUID, false); + } + else if( data == DONE ) + { + Counter = 0; + EncounterStatus = NOT_STARTED; + InstanceProgress = INSTANCE_PROGRESS_DONE; + HandleGameObject(GO_EnterGateGUID, true); + HandleGameObject(GO_WebDoorGUID, true); + SaveToDB(); + + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + { + c->UpdatePosition(Locs[LOC_TIRION_FINAL], true); + c->StopMovingOnCurrentPos(); + c->SetFacingTo(Locs[LOC_TIRION_FINAL].GetOrientation()); + events.RescheduleEvent(EVENT_SCENE_501, 20000); + } + if( GameObject* floor = instance->GetGameObject(GO_FloorGUID) ) + floor->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); + } + break; + } + } + + uint32 GetData(uint32 type) const + { + switch( type ) + { + case TYPE_INSTANCE_PROGRESS: return InstanceProgress; + } + return 0; + } + + uint64 GetData64(uint32 type) const + { + switch( type ) + { + case TYPE_GORMOK: return NPC_GormokGUID; + case TYPE_DREADSCALE: return NPC_DreadscaleGUID; + case TYPE_ACIDMAW: return NPC_AcidmawGUID; + case NPC_DARKBANE: return NPC_DarkbaneGUID; + case NPC_LIGHTBANE: return NPC_LightbaneGUID; + case TYPE_ANUBARAK: return NPC_AnubarakGUID; + } + return 0; + } + + void Update(uint32 diff) + { + events.Update(diff); + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_CHECK_PLAYERS: + { + if (bSwitcher) // used to double the check interval + DoCheckDedicatedInsanity(); + bSwitcher = !bSwitcher; + + if( DoNeedCleanup(false) ) + InstanceCleanup(); + events.RepeatEvent(CLEANUP_CHECK_INTERVAL); + } + break; + case EVENT_OPEN_GATE: + { + HandleGameObject(GO_MainGateGUID, true); + events.PopEvent(); + } + break; + case EVENT_CLOSE_GATE: + { + HandleGameObject(GO_MainGateGUID, false); + events.PopEvent(); + } + break; + case EVENT_SCENE_001: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_0_01); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_002, 22000); + } + break; + case EVENT_SCENE_002: + { + if( Creature* c = instance->GetCreature(NPC_VarianGUID) ) + c->AI()->Talk(SAY_STAGE_0_03a); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_003, 5000); + } + break; + case EVENT_SCENE_003: + { + if( Creature* c = instance->GetCreature(NPC_GarroshGUID) ) + c->AI()->Talk(SAY_STAGE_0_03h); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_004, 8000); + } + break; + case EVENT_SCENE_004: + { + InstanceProgress = INSTANCE_PROGRESS_INTRO_DONE; + EncounterStatus = IN_PROGRESS; + + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_0_02); + HandleGameObject(GO_MainGateGUID, true); + HandleGameObject(GO_EnterGateGUID, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_SUMMON_GORMOK, 1000); + if (instance->IsHeroic()) + { + events.RescheduleEvent(EVENT_SCENE_005, 150000); + events.RescheduleEvent(EVENT_SCENE_006, 340000); + events.RescheduleEvent(EVENT_NORTHREND_BEASTS_ENRAGE, 520000); + } + } + break; + case EVENT_NORTHREND_BEASTS_ENRAGE: + if( Creature* c = instance->GetCreature(NPC_GormokGUID) ) + if (c->IsAlive()) + c->CastSpell(c, 26662, true); + if( Creature* c = instance->GetCreature(NPC_AcidmawGUID) ) + if (c->IsAlive()) + c->CastSpell(c, 26662, true); + if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) ) + if (c->IsAlive()) + c->CastSpell(c, 26662, true); + if( Creature* c = instance->GetCreature(NPC_IcehowlGUID) ) + if (c->IsAlive()) + c->CastSpell(c, 26662, true); + events.PopEvent(); + break; + case EVENT_SUMMON_GORMOK: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + if( Creature* gormok = c->SummonCreature(NPC_GORMOK, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY(), Locs[LOC_BEHIND_GATE].GetPositionZ(), Locs[LOC_BEHIND_GATE].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000) ) + gormok->GetMotionMaster()->MovePoint(0, Locs[LOC_GATE_FRONT].GetPositionX(), Locs[LOC_GATE_FRONT].GetPositionY(), Locs[LOC_GATE_FRONT].GetPositionZ()); + events.PopEvent(); + events.RescheduleEvent(EVENT_GORMOK_ATTACK, 10000); + events.RescheduleEvent(EVENT_CLOSE_GATE, 6000); + } + break; + case EVENT_GORMOK_ATTACK: + { + northrendBeastsMask = 0; + if( Creature* c = instance->GetCreature(NPC_GormokGUID) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + if( Unit* target = c->SelectNearestTarget(200.0f) ) + { + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + } + } + events.PopEvent(); + } + break; + case EVENT_SCENE_005: + { + northrendBeastsMask |= 16; + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_0_04); + events.PopEvent(); + events.RescheduleEvent(EVENT_OPEN_GATE, 3000); + events.RescheduleEvent(EVENT_SUMMON_ACIDMAW_AND_DREADSCALE, 4000); + } + break; + case EVENT_SUMMON_ACIDMAW_AND_DREADSCALE: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + { + if( Creature* dreadscale = c->SummonCreature(NPC_DREADSCALE, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY(), Locs[LOC_BEHIND_GATE].GetPositionZ(), Locs[LOC_BEHIND_GATE].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN) ) + dreadscale->GetMotionMaster()->MovePoint(0, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY()-25.0f, Locs[LOC_BEHIND_GATE].GetPositionZ()); + if( Creature* acidmaw = c->SummonCreature(NPC_ACIDMAW, Locs[LOC_ACIDMAW].GetPositionX(), Locs[LOC_ACIDMAW].GetPositionY(), Locs[LOC_ACIDMAW].GetPositionZ(), Locs[LOC_ACIDMAW].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN) ) + acidmaw->AddAura(53421, acidmaw); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_005_2, 4000); + } + break; + case EVENT_SCENE_005_2: + { + if( Creature* dreadscale = instance->GetCreature(NPC_DreadscaleGUID) ) + dreadscale->GetMotionMaster()->MovePoint(0, Locs[LOC_DREADSCALE].GetPositionX(), Locs[LOC_DREADSCALE].GetPositionY(), Locs[LOC_DREADSCALE].GetPositionZ()); + events.PopEvent(); + events.RescheduleEvent(EVENT_ACIDMAW_AND_DREADSCALE_ATTACK, 7000); + } + break; + case EVENT_ACIDMAW_AND_DREADSCALE_ATTACK: + { + HandleGameObject(GO_MainGateGUID, false); + if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + if( Unit* target = c->SelectNearestTarget(200.0f) ) + { + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + } + } + if( Creature* c = instance->GetCreature(NPC_AcidmawGUID) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + if( Unit* target = c->SelectNearestTarget(200.0f) ) + { + c->RemoveAura(53421); + c->CastSpell(c, 66947, false); + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + } + } + events.PopEvent(); + } + break; + case EVENT_SCENE_006: + { + northrendBeastsMask |= 32; + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_0_05); + events.PopEvent(); + events.RescheduleEvent(EVENT_OPEN_GATE, 2000); + events.RescheduleEvent(EVENT_SUMMON_ICEHOWL, 3000); + } + break; + case EVENT_SUMMON_ICEHOWL: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + if( Creature* icehowl = c->SummonCreature(NPC_ICEHOWL, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY(), Locs[LOC_BEHIND_GATE].GetPositionZ(), Locs[LOC_BEHIND_GATE].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) ) + icehowl->GetMotionMaster()->MovePoint(0, Locs[LOC_GATE_FRONT].GetPositionX(), Locs[LOC_GATE_FRONT].GetPositionY(), Locs[LOC_GATE_FRONT].GetPositionZ()); + events.PopEvent(); + events.RescheduleEvent(EVENT_ICEHOWL_ATTACK, 10000); + events.RescheduleEvent(EVENT_CLOSE_GATE, 6000); + } + break; + case EVENT_ICEHOWL_ATTACK: + { + if( Creature* c = instance->GetCreature(NPC_IcehowlGUID) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + if( Unit* target = c->SelectNearestTarget(200.0f) ) + { + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + } + } + events.PopEvent(); + } + break; + case EVENT_SCENE_BEASTS_DONE: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_0_06); + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + events.PopEvent(); + } + break; + case EVENT_SCENE_101: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + { + HandleGameObject(GO_MainGateGUID, true); + c->AI()->Talk(SAY_STAGE_1_01); + if( Creature* fizzlebang = c->SummonCreature(NPC_FIZZLEBANG, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY(), Locs[LOC_BEHIND_GATE].GetPositionZ(), Locs[LOC_BEHIND_GATE].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000) ) + { + fizzlebang->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + fizzlebang->GetMotionMaster()->MovePoint(0, Locs[LOC_BEHIND_GATE].GetPositionX(), Locs[LOC_BEHIND_GATE].GetPositionY()-65.0f, Locs[LOC_BEHIND_GATE].GetPositionZ()-1.0f); + } + events.RescheduleEvent(EVENT_SCENE_102, 20000); + + // move Icehowl to side, can't remove corpse because of loot! + if( Creature* icehowl = instance->GetCreature(NPC_IcehowlGUID) ) + { + icehowl->UpdatePosition(513.19f, 139.48f, 395.22f, 3*M_PI/2, true); + icehowl->StopMovingOnCurrentPos(); + icehowl->DestroyForNearbyPlayers(); + } + } + events.PopEvent(); + } + break; + case EVENT_SCENE_102: + { + HandleGameObject(GO_MainGateGUID, false); + if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) + c->AI()->Talk(SAY_STAGE_1_02); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_103, 11000); + } + break; + case EVENT_SCENE_103: + { + if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) + { + c->AI()->Talk(SAY_STAGE_1_03); + c->HandleEmoteCommand(EMOTE_STATE_SPELL_PRECAST); + if( Creature* trigger = c->SummonCreature(NPC_PURPLE_GROUND, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN) ) + NPC_PurpleGroundGUID = trigger->GetGUID(); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_104, 5000); + } + break; + case EVENT_SCENE_104: + { + if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) + { + if( Creature* portal = c->SummonCreature(NPC_WORLD_TRIGGER, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN) ) + { + NPC_PortalGUID = portal->GetGUID(); + portal->SetObjectScale(3.0f); + portal->SetReactState(REACT_PASSIVE); + portal->CastSpell(portal, SPELL_WILFRED_PORTAL, true); + } + c->HandleEmoteCommand(EMOTE_STATE_SPELL_PRECAST); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SUMMON_JARAXXUS, 5000); + } + break; + case EVENT_SUMMON_JARAXXUS: + { + if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) + { + if( Creature* jaraxxus = c->SummonCreature(NPC_JARAXXUS, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) ) + jaraxxus->GetMotionMaster()->MovePoint(0, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY()-10.0f, Locs[LOC_CENTER].GetPositionZ()); + c->HandleEmoteCommand(EMOTE_STATE_NONE); + c->AI()->Talk(SAY_STAGE_1_04); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_105, 3000); + } + break; + case EVENT_SCENE_105: + { + if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) + c->SetFacingTo(M_PI/2); + if( Creature* c = instance->GetCreature(NPC_PurpleGroundGUID) ) + c->DespawnOrUnsummon(); + NPC_PurpleGroundGUID = 0; + if( Creature* c = instance->GetCreature(NPC_PortalGUID) ) + c->DespawnOrUnsummon(); + NPC_PortalGUID = 0; + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_106, 10000); + } + break; + case EVENT_SCENE_106: + { + if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) + c->AI()->Talk(SAY_STAGE_1_05); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_107, 5000); + } + break; + case EVENT_SCENE_107: + { + if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) + c->AI()->Talk(SAY_STAGE_1_06); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_108, 800); + } + break; + case EVENT_SCENE_108: + { + if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) + { + c->MonsterYell("Banished to the Nether!", LANG_UNIVERSAL, 0); + c->PlayDirectSound(16146, 0); + if( Creature* f = instance->GetCreature(NPC_FizzlebangGUID) ) + { + c->CastSpell(f, 67888, true); + Unit::Kill(f, f); + } + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_109, 5000); + } + break; + case EVENT_SCENE_109: + { + if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) + c->SetFacingTo(3*M_PI/2); + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_1_07); + events.PopEvent(); + events.RescheduleEvent(EVENT_JARAXXUS_ATTACK, 6000); + } + break; + case EVENT_JARAXXUS_ATTACK: + { + InstanceProgress = INSTANCE_PROGRESS_JARAXXUS_INTRO_DONE; + if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + if( Unit* target = c->SelectNearestTarget(200.0f) ) + { + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + } + } + events.PopEvent(); + } + break; + case EVENT_SCENE_110: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_1_08); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_111, 18000); + } + break; + case EVENT_SCENE_111: + { + if( Creature* c = instance->GetCreature(NPC_GarroshGUID) ) + c->AI()->Talk(SAY_STAGE_1_09); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_112, 9000); + } + break; + case EVENT_SCENE_112: + { + if( Creature* c = instance->GetCreature(NPC_VarianGUID) ) + c->AI()->Talk(SAY_STAGE_1_10); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_113, 5000); + } + break; + case EVENT_SCENE_113: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_1_11); + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + events.PopEvent(); + } + break; + case EVENT_SCENE_201: + { + // move Jaraxxus to side, can't remove corpse because of loot! + if( Creature* jaraxxus = instance->GetCreature(NPC_JaraxxusGUID) ) + { + jaraxxus->UpdatePosition(613.83f, 139.5f, 395.22f, 3*M_PI/2, true); + jaraxxus->StopMovingOnCurrentPos(); + jaraxxus->DestroyForNearbyPlayers(); + } + + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_2_01); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_202, 9000); + } + break; + case EVENT_SCENE_202: + { + Map::PlayerList const &pl = instance->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + if( !plr->IsGameMaster() ) + { + TeamIdInInstance = plr->GetTeamId(); + break; + } + + if( TeamIdInInstance == TEAM_ALLIANCE ) + { + if( Creature* c = instance->GetCreature(NPC_GarroshGUID) ) + c->AI()->Talk(SAY_STAGE_2_02h); + events.RescheduleEvent(EVENT_SCENE_203, 15000); + } + else + { + if( Creature* c = instance->GetCreature(NPC_VarianGUID) ) + c->AI()->Talk(SAY_STAGE_2_02a); + events.RescheduleEvent(EVENT_SCENE_203, 18000); + } + events.PopEvent(); + } + break; + case EVENT_SCENE_203: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_2_03); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_204, 5000); + } + break; + case EVENT_SCENE_204: + { + if( TeamIdInInstance == TEAM_ALLIANCE ) + { + if( Creature* c = instance->GetCreature(NPC_GarroshGUID) ) + c->AI()->Talk(SAY_STAGE_2_04h); + events.RescheduleEvent(EVENT_SCENE_205, 6000); + } + else + { + if( Creature* c = instance->GetCreature(NPC_VarianGUID) ) + c->AI()->Talk(SAY_STAGE_2_04a); + events.RescheduleEvent(EVENT_SCENE_205, 5000); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SUMMON_CHAMPIONS, 2500); + } + break; + case EVENT_SCENE_205: + { + if( Creature* c = instance->GetCreature(TeamIdInInstance == TEAM_ALLIANCE ? NPC_VarianGUID : NPC_GarroshGUID) ) + c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_STAGE_2_05a : SAY_STAGE_2_05h); + events.PopEvent(); + } + break; + case EVENT_SUMMON_CHAMPIONS: + { + std::vector vHealerEntries; + vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_DRUID_RESTORATION : NPC_ALLIANCE_DRUID_RESTORATION); + vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_PALADIN_HOLY : NPC_ALLIANCE_PALADIN_HOLY); + vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_PRIEST_DISCIPLINE : NPC_ALLIANCE_PRIEST_DISCIPLINE); + vHealerEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_SHAMAN_RESTORATION : NPC_ALLIANCE_SHAMAN_RESTORATION); + + std::vector vOtherEntries; + vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_DEATH_KNIGHT : NPC_ALLIANCE_DEATH_KNIGHT); + vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_HUNTER : NPC_ALLIANCE_HUNTER); + vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_MAGE : NPC_ALLIANCE_MAGE); + vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_ROGUE : NPC_ALLIANCE_ROGUE); + vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_WARLOCK : NPC_ALLIANCE_WARLOCK); + vOtherEntries.push_back(TeamIdInInstance == TEAM_ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR); + + uint8 healersSubtracted = 2; + if( instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC ) + healersSubtracted = 1; + for( uint8 i = 0; i < healersSubtracted; ++i ) + { + uint8 pos = urand(0, vHealerEntries.size()-1); + switch( vHealerEntries[pos] ) + { + case NPC_ALLIANCE_DRUID_RESTORATION: + vOtherEntries.push_back(NPC_ALLIANCE_DRUID_BALANCE); + break; + case NPC_HORDE_DRUID_RESTORATION: + vOtherEntries.push_back(NPC_HORDE_DRUID_BALANCE); + break; + case NPC_ALLIANCE_PALADIN_HOLY: + vOtherEntries.push_back(NPC_ALLIANCE_PALADIN_RETRIBUTION); + break; + case NPC_HORDE_PALADIN_HOLY: + vOtherEntries.push_back(NPC_HORDE_PALADIN_RETRIBUTION); + break; + case NPC_ALLIANCE_PRIEST_DISCIPLINE: + vOtherEntries.push_back(NPC_ALLIANCE_PRIEST_SHADOW); + break; + case NPC_HORDE_PRIEST_DISCIPLINE: + vOtherEntries.push_back(NPC_HORDE_PRIEST_SHADOW); + break; + case NPC_ALLIANCE_SHAMAN_RESTORATION: + vOtherEntries.push_back(NPC_ALLIANCE_SHAMAN_ENHANCEMENT); + break; + case NPC_HORDE_SHAMAN_RESTORATION: + vOtherEntries.push_back(NPC_HORDE_SHAMAN_ENHANCEMENT); + break; + } + vHealerEntries.erase(vHealerEntries.begin()+pos); + } + + if( instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL || instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC ) + for( uint8 i=0; i<4; ++i ) + vOtherEntries.erase(vOtherEntries.begin()+urand(0, vOtherEntries.size()-1)); + + for( std::vector::iterator itr = vHealerEntries.begin(); itr != vHealerEntries.end(); ++itr ) + vOtherEntries.push_back(*itr); + + uint8 pos2 = 10; + for( std::vector::iterator itr = vOtherEntries.begin(); itr != vOtherEntries.end(); ++itr ) + { + if( Creature* pTemp = instance->SummonCreature(*itr, FactionChampionLoc[urand(0, 4)+(TeamIdInInstance == TEAM_ALLIANCE ? 0 : 5)]) ) + { + NPC_ChampionGUIDs.push_back(pTemp->GetGUID()); + pTemp->SetHomePosition((TeamIdInInstance == TEAM_ALLIANCE ? FactionChampionLoc[pos2].GetPositionX() : (Locs[LOC_CENTER].GetPositionX()*2-FactionChampionLoc[pos2].GetPositionX())), FactionChampionLoc[pos2].GetPositionY(), FactionChampionLoc[pos2].GetPositionZ(), 0.0f); + pTemp->GetMotionMaster()->MoveJump((TeamIdInInstance == TEAM_ALLIANCE ? FactionChampionLoc[pos2].GetPositionX() : (Locs[LOC_CENTER].GetPositionX()*2-FactionChampionLoc[pos2].GetPositionX())), FactionChampionLoc[pos2].GetPositionY(), FactionChampionLoc[pos2].GetPositionZ(), 20.0f, 20.0f); + } + ++pos2; + } + + HandleGameObject(GO_EnterGateGUID, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_CHAMPIONS_ATTACK, 4000); + } + break; + case EVENT_CHAMPIONS_ATTACK: + { + for( std::vector::iterator itr = NPC_ChampionGUIDs.begin(); itr != NPC_ChampionGUIDs.end(); ++itr ) + if( Creature* c = instance->GetCreature(*itr) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + //if( Unit* target = c->SelectNearestTarget(200.0f) ) + // c->AI()->AttackStart(target); + } + Map::PlayerList const& pl = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + itr->GetSource()->AddToNotify(NOTIFY_AI_RELOCATION); + EncounterStatus = IN_PROGRESS; + events.PopEvent(); + } + break; + case EVENT_SCENE_FACTION_CHAMPIONS_DEAD: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_2_06); + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + events.PopEvent(); + } + break; + case EVENT_SCENE_301: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_3_01); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_302, 13000); + } + break; + case EVENT_SCENE_302: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_3_02); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_303, 3000); + } + break; + case EVENT_SCENE_303: + { + HandleGameObject(GO_EnterGateGUID, false); + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + { + HandleGameObject(GO_MainGateGUID, true); + if( Creature* t = c->SummonCreature(NPC_LIGHTBANE, Locs[LOC_VALKYR_RIGHT].GetPositionX(), Locs[LOC_VALKYR_RIGHT].GetPositionY(), Locs[LOC_VALKYR_RIGHT].GetPositionZ(), Locs[LOC_VALKYR_RIGHT].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) ) + t->GetMotionMaster()->MovePoint(0, Locs[LOC_VALKYR_DEST_RIGHT].GetPositionX(), Locs[LOC_VALKYR_DEST_RIGHT].GetPositionY(), Locs[LOC_VALKYR_DEST_RIGHT].GetPositionZ()); + if( Creature* t = c->SummonCreature(NPC_DARKBANE, Locs[LOC_VALKYR_LEFT].GetPositionX(), Locs[LOC_VALKYR_LEFT].GetPositionY(), Locs[LOC_VALKYR_LEFT].GetPositionZ(), Locs[LOC_VALKYR_LEFT].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) ) + t->GetMotionMaster()->MovePoint(0, Locs[LOC_VALKYR_DEST_LEFT].GetPositionX(), Locs[LOC_VALKYR_DEST_LEFT].GetPositionY(), Locs[LOC_VALKYR_DEST_LEFT].GetPositionZ()); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_304, 6250); + } + break; + case EVENT_SCENE_304: + { + HandleGameObject(GO_MainGateGUID, false); + EncounterStatus = IN_PROGRESS; + if( Creature* c = instance->GetCreature(NPC_LightbaneGUID) ) + c->GetMotionMaster()->MovePoint(0, Locs[LOC_VALKYR_DEST_2_RIGHT].GetPositionX(), Locs[LOC_VALKYR_DEST_2_RIGHT].GetPositionY(), Locs[LOC_VALKYR_DEST_2_RIGHT].GetPositionZ()); + if( Creature* c = instance->GetCreature(NPC_DarkbaneGUID) ) + c->GetMotionMaster()->MovePoint(0, Locs[LOC_VALKYR_DEST_2_LEFT].GetPositionX(), Locs[LOC_VALKYR_DEST_2_LEFT].GetPositionY(), Locs[LOC_VALKYR_DEST_2_LEFT].GetPositionZ()); + events.PopEvent(); + events.RescheduleEvent(EVENT_VALKYRIES_ATTACK, 3250); + } + break; + case EVENT_VALKYRIES_ATTACK: + { + if( Creature* c = instance->GetCreature(NPC_LightbaneGUID) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + /*if( Unit* target = c->SelectNearestTarget(200.0f) ) + { + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + }*/ + } + if( Creature* c = instance->GetCreature(NPC_DarkbaneGUID) ) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + /*if( Unit* target = c->SelectNearestTarget(200.0f) ) + { + c->AI()->AttackStart(target); + c->AI()->DoZoneInCombat(); + }*/ + } + events.PopEvent(); + } + break; + case EVENT_SCENE_VALKYR_DEAD: + { + if (TeamIdInInstance == TEAM_NEUTRAL) + { + Map::PlayerList const &pl = instance->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + if( !plr->IsGameMaster() ) + { + TeamIdInInstance = plr->GetTeamId(); + break; + } + } + if( Creature* c = instance->GetCreature(TeamIdInInstance == TEAM_ALLIANCE ? NPC_VarianGUID : NPC_GarroshGUID) ) + c->AI()->Talk((TeamIdInInstance == TEAM_ALLIANCE ? SAY_STAGE_3_03a : SAY_STAGE_3_03h)); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_401, 60000); + } + break; + case EVENT_SCENE_401: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_4_01); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_402, 20000); + } + break; + case EVENT_SCENE_402: + { + HandleGameObject(GO_EnterGateGUID, false); + EncounterStatus = IN_PROGRESS; + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + if( Creature* t = c->SummonCreature(NPC_LICH_KING, Locs[LOC_ARTHAS_PORTAL]) ) + { + t->SetReactState(REACT_PASSIVE); + t->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + t->SetDisplayId(11686); + t->AI()->Talk(SAY_STAGE_4_02); + t->SetVisible(false); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_403, 2000); + } + break; + case EVENT_SCENE_403: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + if( Creature* t = c->SummonCreature(NPC_WORLD_TRIGGER, Locs[LOC_ARTHAS_PORTAL], TEMPSUMMON_TIMED_DESPAWN, 60000) ) + { + t->SetReactState(REACT_PASSIVE); + t->CastSpell(t, 51807, true); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_404, 2000); + } + break; + case EVENT_SCENE_404: + { + if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) + { + c->SetDisplayId(c->GetNativeDisplayId()); + c->SetVisible(true); + c->GetMotionMaster()->MovePoint(0, Locs[LOC_ARTHAS]); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_405, 3000); + } + break; + case EVENT_SCENE_405: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + c->AI()->Talk(SAY_STAGE_4_03); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_406, 7000); + } + break; + case EVENT_SCENE_406: + { + if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) + { + c->AI()->Talk(SAY_STAGE_4_04); + c->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_406_2, 2500); + events.RescheduleEvent(EVENT_SCENE_407, 12000); + } + break; + case EVENT_SCENE_406_2: + { + if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) + c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); + events.PopEvent(); + } + break; + case EVENT_SCENE_407: + { + if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) + c->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_408, 4000); + } + break; + case EVENT_SCENE_408: + { + if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) + { + c->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_409, 1500); + } + break; + case EVENT_SCENE_409: + { + if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) + { + if( GameObject* floor = instance->GetGameObject(GO_FloorGUID) ) + floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);//floor->ModifyHealth(-10000000, c); + c->CastSpell((Unit*)NULL, 68193, true); + c->SetVisible(false); + c->SetDisplayId(11686); + if( Creature* t = c->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f, true) ) + t->DespawnOrUnsummon(); + + if( Creature* barrett = instance->GetCreature(NPC_BarrettGUID) ) + { + barrett->SetVisible(false); + barrett->SummonCreature(NPC_ANUBARAK, Locs[LOC_ANUB].GetPositionX(), Locs[LOC_ANUB].GetPositionY(), Locs[LOC_ANUB].GetPositionZ(), Locs[LOC_ANUB].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000); + } + + // move corpses: + if( Creature* c = instance->GetCreature(NPC_IcehowlGUID) ) + { + c->UpdatePosition(626.57f, 162.8f, 140.25f, 4.44f, true); + c->StopMovingOnCurrentPos(); + c->DestroyForNearbyPlayers(); + } + if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) + { + c->UpdatePosition(603.92f, 102.61f, 141.85f, 1.4f, true); + c->StopMovingOnCurrentPos(); + c->DestroyForNearbyPlayers(); + } + if( Creature* c = instance->GetCreature(NPC_LightbaneGUID) ) + { + c->UpdatePosition(634.58f, 147.16f, 140.5f, 3.02f, true); + c->StopMovingOnCurrentPos(); + c->DestroyForNearbyPlayers(); + } + if( Creature* c = instance->GetCreature(NPC_DarkbaneGUID) ) + { + c->UpdatePosition(630.88f, 131.39f, 140.8f, 3.02f, true); + c->StopMovingOnCurrentPos(); + c->DestroyForNearbyPlayers(); + } + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_410, 2000); + } + break; + case EVENT_SCENE_410: + { + if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) + { + c->SetVisible(true); + c->AI()->Talk(SAY_STAGE_4_05); + c->DespawnOrUnsummon(0); + } + events.PopEvent(); + } + break; + case EVENT_SCENE_501: + { + if( Creature* c = instance->GetCreature(NPC_TirionGUID) ) + { + c->AI()->Talk(SAY_STAGE_4_06); + c->SummonCreature(NPC_ARGENT_MAGE, Locs[LOC_MAGE].GetPositionX(), Locs[LOC_MAGE].GetPositionY(), Locs[LOC_MAGE].GetPositionZ(), Locs[LOC_MAGE].GetOrientation()); + c->SummonGameObject(195682, 668.15f, 134.57f, 142.12f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 630000000); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SCENE_502, 20000); + } + break; + case EVENT_SCENE_502: + { + if( instance->IsHeroic() ) + { + uint32 tributeChest = 0; + if( instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC ) + { + if (AttemptsLeft >= 50) + tributeChest = GO_TRIBUTE_CHEST_10H_99; + else if (AttemptsLeft >= 45) + tributeChest = GO_TRIBUTE_CHEST_10H_50; + else if (AttemptsLeft >= 25) + tributeChest = GO_TRIBUTE_CHEST_10H_45; + else + tributeChest = GO_TRIBUTE_CHEST_10H_25; + } + else if( instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC ) + { + if (AttemptsLeft >= 50) + tributeChest = GO_TRIBUTE_CHEST_25H_99; + else if (AttemptsLeft >= 45) + tributeChest = GO_TRIBUTE_CHEST_25H_50; + else if (AttemptsLeft >= 25) + tributeChest = GO_TRIBUTE_CHEST_25H_45; + else + tributeChest = GO_TRIBUTE_CHEST_25H_25; + } + if (tributeChest) + if (Creature* c = instance->GetCreature(NPC_TirionGUID)) + { + c->AI()->Talk(SAY_STAGE_4_07); + if (GameObject* chest = c->SummonGameObject(tributeChest, 665.12f, 143.78f, 142.12f, 0.0f, 0, 0, 0, 0, 90000000)) + { + chest->SetRespawnTime(chest->GetRespawnDelay()); + + Map::PlayerList const &pl = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* plr = itr->GetSource()) + if (Group* g = plr->GetGroup()) + if (!plr->IsGameMaster() && g->GetLeaderGUID() == plr->GetGUID()) + { + chest->SetLootRecipient(plr); + break; + } + } + } + } + + events.PopEvent(); + } + break; + } + } + + void OnPlayerEnter(Player* plr) + { + if( instance->IsHeroic() ) + { + plr->SendUpdateWorldState(UPDATE_STATE_UI_SHOW, 1); + plr->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, AttemptsLeft); + } + else + plr->SendUpdateWorldState(UPDATE_STATE_UI_SHOW, 0); + + if( DoNeedCleanup(true) ) + InstanceCleanup(); + + events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); + } + + bool DoNeedCleanup(bool /*enter*/) + { + uint8 aliveCount = 0; + Map::PlayerList const &pl = instance->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + if( plr->IsAlive() && !plr->IsGameMaster() ) + ++aliveCount; + + bool need = aliveCount==0; + if( !need && CLEANED ) + CLEANED = false; + return need; + } + + void InstanceCleanup(bool fromFailed = false) + { + if( CLEANED ) + return; + CLEANED = true; + + switch( InstanceProgress ) + { + case INSTANCE_PROGRESS_INITIAL: + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case INSTANCE_PROGRESS_INTRO_DONE: + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + if( Creature* c = instance->GetCreature(NPC_GormokGUID) ) + { + c->AI()->DoAction(-1); // despawn summons + c->DespawnOrUnsummon(); + } + NPC_GormokGUID = 0; + if( Creature* c = instance->GetCreature(NPC_AcidmawGUID) ) + c->DespawnOrUnsummon(); + NPC_AcidmawGUID = 0; + if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) ) + c->DespawnOrUnsummon(); + NPC_DreadscaleGUID = 0; + if( Creature* c = instance->GetCreature(NPC_IcehowlGUID) ) + c->DespawnOrUnsummon(); + NPC_IcehowlGUID = 0; + northrendBeastsMask = 0; + break; + case INSTANCE_PROGRESS_BEASTS_DEAD: + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) ) + c->DespawnOrUnsummon(); + NPC_FizzlebangGUID = 0; + if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) + c->DespawnOrUnsummon(); + NPC_JaraxxusGUID = 0; + if( Creature* c = instance->GetCreature(NPC_PurpleGroundGUID) ) + c->DespawnOrUnsummon(); + NPC_PurpleGroundGUID = 0; + if( Creature* c = instance->GetCreature(NPC_PortalGUID) ) + c->DespawnOrUnsummon(); + NPC_PortalGUID = 0; + break; + case INSTANCE_PROGRESS_JARAXXUS_INTRO_DONE: + if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) ) + c->DespawnOrUnsummon(); + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + { + c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + if( Creature* jaraxxus = c->SummonCreature(NPC_JARAXXUS, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) ) + { + jaraxxus->CastSpell(jaraxxus, 67924, true); + jaraxxus->SetReactState(REACT_AGGRESSIVE); + jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + jaraxxus->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + } + } + break; + case INSTANCE_PROGRESS_JARAXXUS_DEAD: + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + for( std::vector::iterator itr = NPC_ChampionGUIDs.begin(); itr != NPC_ChampionGUIDs.end(); ++itr ) + if( Creature* c = instance->GetCreature(*itr) ) + c->DespawnOrUnsummon(); + NPC_ChampionGUIDs.clear(); + break; + case INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD: + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + if( Creature* c = instance->GetCreature(NPC_DarkbaneGUID) ) + { + c->AI()->DoAction(-1); + c->DespawnOrUnsummon(); + } + NPC_DarkbaneGUID = 0; + if( Creature* c = instance->GetCreature(NPC_LightbaneGUID) ) + { + c->AI()->DoAction(-1); + c->DespawnOrUnsummon(); + } + NPC_LightbaneGUID = 0; + break; + case INSTANCE_PROGRESS_VALKYR_DEAD: + if( GameObject* floor = instance->GetGameObject(GO_FloorGUID) ) + floor->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + { + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + c->SetVisible(true); + c->SetFacingTo(c->GetOrientation()); + if( Creature* t = c->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f, true) ) + t->DespawnOrUnsummon(); + } + if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) + c->DespawnOrUnsummon(); + NPC_LichKingGUID = 0; + + if( Creature* c = instance->GetCreature(NPC_AnubarakGUID) ) + { + c->AI()->DoAction(-1); + c->DespawnOrUnsummon(); + } + NPC_AnubarakGUID = 0; + + break; + case INSTANCE_PROGRESS_DONE: + if( GameObject* floor = instance->GetGameObject(GO_FloorGUID) ) + floor->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + { + c->SetVisible(false); + c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + break; + } + + if (instance->IsHeroic() && AttemptsLeft > 0 && !fromFailed && EncounterStatus == IN_PROGRESS) + { + --AttemptsLeft; + Map::PlayerList const &pl = instance->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + plr->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, AttemptsLeft); + } + + if( instance->IsHeroic() && AttemptsLeft == 0 ) + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + + HandleGameObject(GO_MainGateGUID, false); + HandleGameObject(GO_EnterGateGUID, true); + HandleGameObject(GO_WebDoorGUID, true); + Counter = 0; + EncounterStatus = NOT_STARTED; + events.Reset(); + events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + std::ostringstream saveStream; + saveStream << "T C " << InstanceProgress; + if( instance->IsHeroic() ) + saveStream << ' ' << AttemptsLeft << ' ' << (bDedicatedInsanity ? (uint32)1 : (uint32)0) << ' ' << (bNooneDied ? (uint32)1 : (uint32)0); + str_data = saveStream.str(); + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + EncounterStatus = NOT_STARTED; + CLEANED = false; + events.Reset(); + events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); + + if( !in ) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0; + + if( dataHead1 == 'T' && dataHead2 == 'C' ) + { + InstanceProgress = data0; + if( instance->IsHeroic() ) + { + uint32 data1 = 0, data2 = 0, data3 = 0; + loadStream >> data1 >> data2 >> data3; + AttemptsLeft = data1; + bDedicatedInsanity = data2 ? true : false; + bNooneDied = data3 ? true : false; + } + } + else + OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case ACHIEV_CRITERIA_UPPER_BACK_PAIN_10_N: + case ACHIEV_CRITERIA_UPPER_BACK_PAIN_10_H: + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + { + std::list L; + uint8 count = 0; + c->GetCreaturesWithEntryInRange(L, 200.0f, 34800); // find all snobolds + for( std::list::const_iterator itr = L.begin(); itr != L.end(); ++itr ) + if( (*itr)->GetVehicle() ) + ++count; + return (count >= 2); + } + break; + case ACHIEV_CRITERIA_UPPER_BACK_PAIN_25_N: + case ACHIEV_CRITERIA_UPPER_BACK_PAIN_25_H: + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + { + std::list L; + uint8 count = 0; + c->GetCreaturesWithEntryInRange(L, 200.0f, 34800); // find all snobolds + for( std::list::const_iterator itr = L.begin(); itr != L.end(); ++itr ) + if( (*itr)->GetVehicle() ) + ++count; + return (count >= 4); + } + break; + case ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_10_N: + case ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_10_H: + case ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_25_N: + case ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_25_H: + if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) + { + std::list L; + uint8 count = 0; + c->GetCreaturesWithEntryInRange(L, 200.0f, 34826); // find all mistress of pain + for( std::list::const_iterator itr = L.begin(); itr != L.end(); ++itr ) + if( (*itr)->IsAlive() ) + ++count; + return (count >= 2); + } + break; + case ACHIEV_CRITERIA_A_TRIBUTE_TO_SKILL_10_PLAYER: + case ACHIEV_CRITERIA_A_TRIBUTE_TO_SKILL_25_PLAYER: + return AttemptsLeft >= 25; + case ACHIEV_CRITERIA_A_TRIBUTE_TO_MAD_SKILL_10_PLAYER: + case ACHIEV_CRITERIA_A_TRIBUTE_TO_MAD_SKILL_25_PLAYER: + return AttemptsLeft >= 45; + case ACHIEV_CRITERIA_A_TRIBUTE_TO_INSANITY_10_PLAYER: + case ACHIEV_CRITERIA_A_TRIBUTE_TO_INSANITY_25_PLAYER: + case ACHIEV_CRITERIA_REALM_FIRST_GRAND_CRUSADER: + return AttemptsLeft == 50; + case ACHIEV_CRITERIA_A_TRIBUTE_TO_IMMORTALITY_HORDE: + case ACHIEV_CRITERIA_A_TRIBUTE_TO_IMMORTALITY_ALLIANCE: + return AttemptsLeft == 50 && bNooneDied; + case ACHIEV_CRITERIA_A_TRIBUTE_TO_DEDICATED_INSANITY: + return AttemptsLeft == 50 && bDedicatedInsanity; + } + return false; + } + }; + + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_trial_of_the_crusader_InstanceMapScript(map); + } }; void AddSC_instance_trial_of_the_crusader() { - new instance_trial_of_the_crusader(); + new instance_trial_of_the_crusader(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 5bc0395a2..ef14494ca 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -10,74 +10,74 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum MenuTexts { - MSG_TESTED = 724001, - MSG_NEXT_STAGE = 724002, - MSG_CRUSADERS = 724003, - MSG_ANUBARAK = 724005, + MSG_TESTED = 724001, + MSG_NEXT_STAGE = 724002, + MSG_CRUSADERS = 724003, + MSG_ANUBARAK = 724005, }; class npc_announcer_toc10 : public CreatureScript { public: - npc_announcer_toc10() : CreatureScript("npc_announcer_toc10") { } + npc_announcer_toc10() : CreatureScript("npc_announcer_toc10") { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) - { - if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) ) - return true; + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) ) + return true; - InstanceScript* pInstance = pCreature->GetInstanceScript(); - if( !pInstance ) - return true; + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if( !pInstance ) + return true; - uint32 gossipTextId = 0; - switch( pInstance->GetData(TYPE_INSTANCE_PROGRESS) ) - { - case INSTANCE_PROGRESS_INITIAL: - gossipTextId = MSG_TESTED; - break; - case INSTANCE_PROGRESS_INTRO_DONE: - case INSTANCE_PROGRESS_BEASTS_DEAD: - case INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD: - case INSTANCE_PROGRESS_VALKYR_DEAD: - gossipTextId = MSG_NEXT_STAGE; - break; - case INSTANCE_PROGRESS_JARAXXUS_DEAD: - gossipTextId = MSG_CRUSADERS; - break; - case INSTANCE_PROGRESS_DONE: - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - return true; - default: - return true; - } + uint32 gossipTextId = 0; + switch( pInstance->GetData(TYPE_INSTANCE_PROGRESS) ) + { + case INSTANCE_PROGRESS_INITIAL: + gossipTextId = MSG_TESTED; + break; + case INSTANCE_PROGRESS_INTRO_DONE: + case INSTANCE_PROGRESS_BEASTS_DEAD: + case INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD: + case INSTANCE_PROGRESS_VALKYR_DEAD: + gossipTextId = MSG_NEXT_STAGE; + break; + case INSTANCE_PROGRESS_JARAXXUS_DEAD: + gossipTextId = MSG_CRUSADERS; + break; + case INSTANCE_PROGRESS_DONE: + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + return true; + default: + return true; + } - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "We are ready!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1337); - pPlayer->SEND_GOSSIP_MENU(gossipTextId, pCreature->GetGUID()); - return true; - } + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "We are ready!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1337); + pPlayer->SEND_GOSSIP_MENU(gossipTextId, pCreature->GetGUID()); + return true; + } - bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*sender*/, uint32 uiAction) - { - if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) ) - return true; + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*sender*/, uint32 uiAction) + { + if( !pCreature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) ) + return true; - InstanceScript* pInstance = pCreature->GetInstanceScript(); - if( !pInstance ) - return true; + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if( !pInstance ) + return true; - if( uiAction == GOSSIP_ACTION_INFO_DEF+1337 ) - { - pInstance->SetData(TYPE_ANNOUNCER_GOSSIP_SELECT, 0); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } + if( uiAction == GOSSIP_ACTION_INFO_DEF+1337 ) + { + pInstance->SetData(TYPE_ANNOUNCER_GOSSIP_SELECT, 0); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } - pPlayer->CLOSE_GOSSIP_MENU(); - return true; - } + pPlayer->CLOSE_GOSSIP_MENU(); + return true; + } }; void AddSC_trial_of_the_crusader() { - new npc_announcer_toc10(); + new npc_announcer_toc10(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h index e3c9e9032..628dddd9f 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h @@ -7,188 +7,188 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum DataTypes { - TYPE_NONE = 0, - TYPE_INSTANCE_PROGRESS, - TYPE_ANNOUNCER_GOSSIP_SELECT, - TYPE_FAILED, + TYPE_NONE = 0, + TYPE_INSTANCE_PROGRESS, + TYPE_ANNOUNCER_GOSSIP_SELECT, + TYPE_FAILED, - TYPE_GORMOK, - TYPE_JORMUNGAR, - TYPE_DREADSCALE, - TYPE_ACIDMAW, - TYPE_ICEHOWL, - TYPE_JARAXXUS, - TYPE_FACTION_CHAMPIONS, - TYPE_FACTION_CHAMPIONS_PLAYER_DIED, - TYPE_VALKYR, - TYPE_ANUBARAK, + TYPE_GORMOK, + TYPE_JORMUNGAR, + TYPE_DREADSCALE, + TYPE_ACIDMAW, + TYPE_ICEHOWL, + TYPE_JARAXXUS, + TYPE_FACTION_CHAMPIONS, + TYPE_FACTION_CHAMPIONS_PLAYER_DIED, + TYPE_VALKYR, + TYPE_ANUBARAK, - TYPE_FACTION_CHAMPIONS_START, - TYPE_NORTHREND_BEASTS_ALL, + TYPE_FACTION_CHAMPIONS_START, + TYPE_NORTHREND_BEASTS_ALL, }; enum Progress { - INSTANCE_PROGRESS_INITIAL = 0, - INSTANCE_PROGRESS_INTRO_DONE, - INSTANCE_PROGRESS_BEASTS_DEAD, - INSTANCE_PROGRESS_JARAXXUS_INTRO_DONE, - INSTANCE_PROGRESS_JARAXXUS_DEAD, - INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD = 6, - INSTANCE_PROGRESS_VALKYR_DEAD = 8, - INSTANCE_PROGRESS_DONE = 10, + INSTANCE_PROGRESS_INITIAL = 0, + INSTANCE_PROGRESS_INTRO_DONE, + INSTANCE_PROGRESS_BEASTS_DEAD, + INSTANCE_PROGRESS_JARAXXUS_INTRO_DONE, + INSTANCE_PROGRESS_JARAXXUS_DEAD, + INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD = 6, + INSTANCE_PROGRESS_VALKYR_DEAD = 8, + INSTANCE_PROGRESS_DONE = 10, }; enum Events { - EVENT_CHECK_PLAYERS = 1, - EVENT_OPEN_GATE, - EVENT_CLOSE_GATE, + EVENT_CHECK_PLAYERS = 1, + EVENT_OPEN_GATE, + EVENT_CLOSE_GATE, - EVENT_SCENE_001, - EVENT_SCENE_002, - EVENT_SCENE_003, - EVENT_SCENE_004, - EVENT_SUMMON_GORMOK, - EVENT_GORMOK_ATTACK, - EVENT_SCENE_005, - EVENT_SCENE_005_2, - EVENT_SUMMON_ACIDMAW_AND_DREADSCALE, - EVENT_ACIDMAW_AND_DREADSCALE_ATTACK, - EVENT_SCENE_006, - EVENT_SUMMON_ICEHOWL, - EVENT_ICEHOWL_ATTACK, - EVENT_SCENE_BEASTS_DONE, - EVENT_NORTHREND_BEASTS_ENRAGE, + EVENT_SCENE_001, + EVENT_SCENE_002, + EVENT_SCENE_003, + EVENT_SCENE_004, + EVENT_SUMMON_GORMOK, + EVENT_GORMOK_ATTACK, + EVENT_SCENE_005, + EVENT_SCENE_005_2, + EVENT_SUMMON_ACIDMAW_AND_DREADSCALE, + EVENT_ACIDMAW_AND_DREADSCALE_ATTACK, + EVENT_SCENE_006, + EVENT_SUMMON_ICEHOWL, + EVENT_ICEHOWL_ATTACK, + EVENT_SCENE_BEASTS_DONE, + EVENT_NORTHREND_BEASTS_ENRAGE, - EVENT_SCENE_101, - EVENT_SCENE_102, - EVENT_SCENE_103, - EVENT_SCENE_104, - EVENT_SUMMON_JARAXXUS, - EVENT_SCENE_105, - EVENT_SCENE_106, - EVENT_SCENE_107, - EVENT_SCENE_108, - EVENT_SCENE_109, - EVENT_JARAXXUS_ATTACK, - EVENT_SCENE_110, - EVENT_SCENE_111, - EVENT_SCENE_112, - EVENT_SCENE_113, + EVENT_SCENE_101, + EVENT_SCENE_102, + EVENT_SCENE_103, + EVENT_SCENE_104, + EVENT_SUMMON_JARAXXUS, + EVENT_SCENE_105, + EVENT_SCENE_106, + EVENT_SCENE_107, + EVENT_SCENE_108, + EVENT_SCENE_109, + EVENT_JARAXXUS_ATTACK, + EVENT_SCENE_110, + EVENT_SCENE_111, + EVENT_SCENE_112, + EVENT_SCENE_113, - EVENT_SCENE_201, - EVENT_SCENE_202, - EVENT_SCENE_203, - EVENT_SCENE_204, - EVENT_SCENE_205, - EVENT_SUMMON_CHAMPIONS, - EVENT_CHAMPIONS_ATTACK, - EVENT_SCENE_FACTION_CHAMPIONS_DEAD, + EVENT_SCENE_201, + EVENT_SCENE_202, + EVENT_SCENE_203, + EVENT_SCENE_204, + EVENT_SCENE_205, + EVENT_SUMMON_CHAMPIONS, + EVENT_CHAMPIONS_ATTACK, + EVENT_SCENE_FACTION_CHAMPIONS_DEAD, - EVENT_SCENE_301, - EVENT_SCENE_302, - EVENT_SCENE_303, - EVENT_SCENE_304, - EVENT_VALKYRIES_ATTACK, - EVENT_SCENE_VALKYR_DEAD, + EVENT_SCENE_301, + EVENT_SCENE_302, + EVENT_SCENE_303, + EVENT_SCENE_304, + EVENT_VALKYRIES_ATTACK, + EVENT_SCENE_VALKYR_DEAD, - EVENT_SCENE_401, - EVENT_SCENE_402, - EVENT_SCENE_403, - EVENT_SCENE_404, - EVENT_SCENE_405, - EVENT_SCENE_406, - EVENT_SCENE_406_2, - EVENT_SCENE_407, - EVENT_SCENE_408, - EVENT_SCENE_409, - EVENT_SCENE_410, - EVENT_SCENE_501, - EVENT_SCENE_502, + EVENT_SCENE_401, + EVENT_SCENE_402, + EVENT_SCENE_403, + EVENT_SCENE_404, + EVENT_SCENE_405, + EVENT_SCENE_406, + EVENT_SCENE_406_2, + EVENT_SCENE_407, + EVENT_SCENE_408, + EVENT_SCENE_409, + EVENT_SCENE_410, + EVENT_SCENE_501, + EVENT_SCENE_502, }; enum NPCs { - NPC_BARRENT = 34816, - NPC_TIRION = 34996, - NPC_GARROSH = 34995, - NPC_THRALL = 34994, - NPC_VARIAN = 34990, - NPC_PROUDMOORE = 34992, - NPC_ARGENT_MAGE = 36097, + NPC_BARRENT = 34816, + NPC_TIRION = 34996, + NPC_GARROSH = 34995, + NPC_THRALL = 34994, + NPC_VARIAN = 34990, + NPC_PROUDMOORE = 34992, + NPC_ARGENT_MAGE = 36097, - NPC_FIZZLEBANG = 35458, - NPC_LICH_KING = 35877, + NPC_FIZZLEBANG = 35458, + NPC_LICH_KING = 35877, - NPC_GORMOK = 34796, - NPC_DREADSCALE = 34799, - NPC_ACIDMAW = 35144, - NPC_ICEHOWL = 34797, - NPC_JARAXXUS = 34780, + NPC_GORMOK = 34796, + NPC_DREADSCALE = 34799, + NPC_ACIDMAW = 35144, + NPC_ICEHOWL = 34797, + NPC_JARAXXUS = 34780, - NPC_PURPLE_GROUND = 35651, - NPC_WORLD_TRIGGER = 18721, + NPC_PURPLE_GROUND = 35651, + NPC_WORLD_TRIGGER = 18721, - NPC_ALLIANCE_DEATH_KNIGHT = 34461, - NPC_ALLIANCE_DRUID_BALANCE = 34460, - NPC_ALLIANCE_DRUID_RESTORATION = 34469, - NPC_ALLIANCE_HUNTER = 34467, - NPC_ALLIANCE_MAGE = 34468, - NPC_ALLIANCE_PALADIN_HOLY = 34465, - NPC_ALLIANCE_PALADIN_RETRIBUTION = 34471, - NPC_ALLIANCE_PRIEST_DISCIPLINE = 34466, - NPC_ALLIANCE_PRIEST_SHADOW = 34473, - NPC_ALLIANCE_ROGUE = 34472, - NPC_ALLIANCE_SHAMAN_ENHANCEMENT = 34463, - NPC_ALLIANCE_SHAMAN_RESTORATION = 34470, - NPC_ALLIANCE_WARLOCK = 34474, - NPC_ALLIANCE_WARRIOR = 34475, + NPC_ALLIANCE_DEATH_KNIGHT = 34461, + NPC_ALLIANCE_DRUID_BALANCE = 34460, + NPC_ALLIANCE_DRUID_RESTORATION = 34469, + NPC_ALLIANCE_HUNTER = 34467, + NPC_ALLIANCE_MAGE = 34468, + NPC_ALLIANCE_PALADIN_HOLY = 34465, + NPC_ALLIANCE_PALADIN_RETRIBUTION = 34471, + NPC_ALLIANCE_PRIEST_DISCIPLINE = 34466, + NPC_ALLIANCE_PRIEST_SHADOW = 34473, + NPC_ALLIANCE_ROGUE = 34472, + NPC_ALLIANCE_SHAMAN_ENHANCEMENT = 34463, + NPC_ALLIANCE_SHAMAN_RESTORATION = 34470, + NPC_ALLIANCE_WARLOCK = 34474, + NPC_ALLIANCE_WARRIOR = 34475, - NPC_HORDE_DEATH_KNIGHT = 34458, - NPC_HORDE_DRUID_BALANCE = 34451, - NPC_HORDE_DRUID_RESTORATION = 34459, - NPC_HORDE_HUNTER = 34448, - NPC_HORDE_MAGE = 34449, - NPC_HORDE_PALADIN_HOLY = 34445, - NPC_HORDE_PALADIN_RETRIBUTION = 34456, - NPC_HORDE_PRIEST_DISCIPLINE = 34447, - NPC_HORDE_PRIEST_SHADOW = 34441, - NPC_HORDE_ROGUE = 34454, - NPC_HORDE_SHAMAN_ENHANCEMENT = 34455, - NPC_HORDE_SHAMAN_RESTORATION = 34444, - NPC_HORDE_WARLOCK = 34450, - NPC_HORDE_WARRIOR = 34453, + NPC_HORDE_DEATH_KNIGHT = 34458, + NPC_HORDE_DRUID_BALANCE = 34451, + NPC_HORDE_DRUID_RESTORATION = 34459, + NPC_HORDE_HUNTER = 34448, + NPC_HORDE_MAGE = 34449, + NPC_HORDE_PALADIN_HOLY = 34445, + NPC_HORDE_PALADIN_RETRIBUTION = 34456, + NPC_HORDE_PRIEST_DISCIPLINE = 34447, + NPC_HORDE_PRIEST_SHADOW = 34441, + NPC_HORDE_ROGUE = 34454, + NPC_HORDE_SHAMAN_ENHANCEMENT = 34455, + NPC_HORDE_SHAMAN_RESTORATION = 34444, + NPC_HORDE_WARLOCK = 34450, + NPC_HORDE_WARRIOR = 34453, - NPC_LIGHTBANE = 34497, - NPC_DARKBANE = 34496, + NPC_LIGHTBANE = 34497, + NPC_DARKBANE = 34496, - NPC_ANUBARAK = 34564, + NPC_ANUBARAK = 34564, }; enum GOs { - GO_ARGENT_COLISEUM_FLOOR = 195527, - GO_MAIN_GATE_DOOR = 195647, - GO_WEB_DOOR = 195485, - GO_EAST_PORTCULLIS = 195648, - GO_SOUTH_PORTCULLIS = 195649, - GO_NORTH_PORTCULLIS = 195650, + GO_ARGENT_COLISEUM_FLOOR = 195527, + GO_MAIN_GATE_DOOR = 195647, + GO_WEB_DOOR = 195485, + GO_EAST_PORTCULLIS = 195648, + GO_SOUTH_PORTCULLIS = 195649, + GO_NORTH_PORTCULLIS = 195650, - GO_CRUSADERS_CACHE_10 = 195631, - GO_CRUSADERS_CACHE_25 = 195632, - GO_CRUSADERS_CACHE_10_H = 195633, - GO_CRUSADERS_CACHE_25_H = 195635, + GO_CRUSADERS_CACHE_10 = 195631, + GO_CRUSADERS_CACHE_25 = 195632, + GO_CRUSADERS_CACHE_10_H = 195633, + GO_CRUSADERS_CACHE_25_H = 195635, // Tribute Chest (heroic) - GO_TRIBUTE_CHEST_10H_25 = 195668, // 10man 01-24 attempts - GO_TRIBUTE_CHEST_10H_45 = 195667, // 10man 25-44 attempts - GO_TRIBUTE_CHEST_10H_50 = 195666, // 10man 45-49 attempts - GO_TRIBUTE_CHEST_10H_99 = 195665, // 10man 50 attempts - GO_TRIBUTE_CHEST_25H_25 = 195672, // 25man 01-24 attempts - GO_TRIBUTE_CHEST_25H_45 = 195671, // 25man 25-44 attempts - GO_TRIBUTE_CHEST_25H_50 = 195670, // 25man 45-49 attempts - GO_TRIBUTE_CHEST_25H_99 = 195669, // 25man 50 attempts + GO_TRIBUTE_CHEST_10H_25 = 195668, // 10man 01-24 attempts + GO_TRIBUTE_CHEST_10H_45 = 195667, // 10man 25-44 attempts + GO_TRIBUTE_CHEST_10H_50 = 195666, // 10man 45-49 attempts + GO_TRIBUTE_CHEST_10H_99 = 195665, // 10man 50 attempts + GO_TRIBUTE_CHEST_25H_25 = 195672, // 25man 01-24 attempts + GO_TRIBUTE_CHEST_25H_45 = 195671, // 25man 25-44 attempts + GO_TRIBUTE_CHEST_25H_50 = 195670, // 25man 45-49 attempts + GO_TRIBUTE_CHEST_25H_99 = 195669, // 25man 50 attempts }; enum eTexts @@ -219,7 +219,7 @@ enum eTexts SAY_STAGE_2_04a = 3, SAY_STAGE_2_05a = 4, SAY_STAGE_3_03a = 5, - SAY_VARIAN_KILL_HORDE_PLAYER_1 = 6, + SAY_VARIAN_KILL_HORDE_PLAYER_1 = 6, // Garrosh SAY_STAGE_0_03h = 0, @@ -228,7 +228,7 @@ enum eTexts SAY_STAGE_2_04h = 3, SAY_STAGE_2_05h = 4, SAY_STAGE_3_03h = 5, - SAY_GARROSH_KILL_ALLIANCE_PLAYER_1 = 6, + SAY_GARROSH_KILL_ALLIANCE_PLAYER_1 = 6, // Wilfred Fizzlebang SAY_STAGE_1_02 = 0, @@ -251,117 +251,117 @@ enum eTexts const Position Locs[] = { - {563.8f, 216.1f, 395.1f, 3*M_PI/2}, // 0 - {563.93f, 178.37f, 394.49f, 3*M_PI/2}, // 1 - {575.74f, 171.5f, 394.75f, 3*M_PI/2}, // 2 - {549.93f, 171.5f, 394.75f, 3*M_PI/2}, // 3 - {563.672974f, 139.571f, 393.837006f, 3*M_PI/2}, // 4 - {577.347839f, 210.0f, 395.14f /*+ 6.0f*/, 3*M_PI/2}, // 5 - {550.955933f, 210.0f, 395.14f /*+ 6.0f*/, 3*M_PI/2}, // 6 - {573.5f, 180.5f, 395.14f /*+ 6.0f*/, 0}, // 7 - {553.5f, 180.5f, 395.14f /*+ 6.0f*/, 0}, // 8 - {585.5f, 170.0f, 395.14f /*+ 6.0f*/, 0}, // 9 - {545.5f, 170.0f, 395.14f /*+ 6.0f*/, 0}, // 10 - {563.833008f, 179.244995f, 394.5f, 3*M_PI/2}, // 11 - {563.547f, 141.613f, 393.908f, 0}, // 12 - {586.060242f, 117.514809f, 394.314026f, 0}, // 13 - Dark essence 1 - {541.602112f, 161.879837f, 394.587952f, 0}, // 14 - Dark essence 2 - {541.021118f, 117.262932f, 395.314819f, 0}, // 15 - Light essence 1 - {586.200562f, 162.145523f, 394.626129f, 0}, // 16 - Light essence 2 - {785.90f, 133.42f, 142.612f, M_PI}, // 17 - {665.04f, 139.25f, 142.2f, 0.0f}, // 18 - {664.75f, 135.0f, 142.2f, 0.0f} + {563.8f, 216.1f, 395.1f, 3*M_PI/2}, // 0 + {563.93f, 178.37f, 394.49f, 3*M_PI/2}, // 1 + {575.74f, 171.5f, 394.75f, 3*M_PI/2}, // 2 + {549.93f, 171.5f, 394.75f, 3*M_PI/2}, // 3 + {563.672974f, 139.571f, 393.837006f, 3*M_PI/2}, // 4 + {577.347839f, 210.0f, 395.14f /*+ 6.0f*/, 3*M_PI/2}, // 5 + {550.955933f, 210.0f, 395.14f /*+ 6.0f*/, 3*M_PI/2}, // 6 + {573.5f, 180.5f, 395.14f /*+ 6.0f*/, 0}, // 7 + {553.5f, 180.5f, 395.14f /*+ 6.0f*/, 0}, // 8 + {585.5f, 170.0f, 395.14f /*+ 6.0f*/, 0}, // 9 + {545.5f, 170.0f, 395.14f /*+ 6.0f*/, 0}, // 10 + {563.833008f, 179.244995f, 394.5f, 3*M_PI/2}, // 11 + {563.547f, 141.613f, 393.908f, 0}, // 12 + {586.060242f, 117.514809f, 394.314026f, 0}, // 13 - Dark essence 1 + {541.602112f, 161.879837f, 394.587952f, 0}, // 14 - Dark essence 2 + {541.021118f, 117.262932f, 395.314819f, 0}, // 15 - Light essence 1 + {586.200562f, 162.145523f, 394.626129f, 0}, // 16 - Light essence 2 + {785.90f, 133.42f, 142.612f, M_PI}, // 17 + {665.04f, 139.25f, 142.2f, 0.0f}, // 18 + {664.75f, 135.0f, 142.2f, 0.0f} }; enum LocNames { - LOC_BEHIND_GATE = 0, - LOC_GATE_FRONT, - LOC_DREADSCALE, - LOC_ACIDMAW, - LOC_CENTER, - LOC_VALKYR_RIGHT, - LOC_VALKYR_LEFT, - LOC_VALKYR_DEST_RIGHT, - LOC_VALKYR_DEST_LEFT, - LOC_VALKYR_DEST_2_RIGHT, - LOC_VALKYR_DEST_2_LEFT, - LOC_ARTHAS_PORTAL, - LOC_ARTHAS, - LOC_DARKESS_1, - LOC_DARKESS_2, - LOC_LIGHTESS_1, - LOC_LIGHTESS_2, - LOC_ANUB, - LOC_TIRION_FINAL, - LOC_MAGE, + LOC_BEHIND_GATE = 0, + LOC_GATE_FRONT, + LOC_DREADSCALE, + LOC_ACIDMAW, + LOC_CENTER, + LOC_VALKYR_RIGHT, + LOC_VALKYR_LEFT, + LOC_VALKYR_DEST_RIGHT, + LOC_VALKYR_DEST_LEFT, + LOC_VALKYR_DEST_2_RIGHT, + LOC_VALKYR_DEST_2_LEFT, + LOC_ARTHAS_PORTAL, + LOC_ARTHAS, + LOC_DARKESS_1, + LOC_DARKESS_2, + LOC_LIGHTESS_1, + LOC_LIGHTESS_2, + LOC_ANUB, + LOC_TIRION_FINAL, + LOC_MAGE, }; const Position FactionChampionLoc[]= { - {514.231f, 105.569f, 418.234f, 0}, // 0 - Horde Initial Pos 0 - {508.334f, 115.377f, 418.234f, 0}, // 1 - Horde Initial Pos 1 - {506.454f, 126.291f, 418.234f, 0}, // 2 - Horde Initial Pos 2 - {506.243f, 106.596f, 421.592f, 0}, // 3 - Horde Initial Pos 3 - {499.885f, 117.717f, 421.557f, 0}, // 4 - Horde Initial Pos 4 + {514.231f, 105.569f, 418.234f, 0}, // 0 - Horde Initial Pos 0 + {508.334f, 115.377f, 418.234f, 0}, // 1 - Horde Initial Pos 1 + {506.454f, 126.291f, 418.234f, 0}, // 2 - Horde Initial Pos 2 + {506.243f, 106.596f, 421.592f, 0}, // 3 - Horde Initial Pos 3 + {499.885f, 117.717f, 421.557f, 0}, // 4 - Horde Initial Pos 4 - {613.127f, 100.443f, 419.74f, 0}, // 5 - Ally Initial Pos 0 - {621.126f, 128.042f, 418.231f, 0}, // 6 - Ally Initial Pos 1 - {618.829f, 113.606f, 418.232f, 0}, // 7 - Ally Initial Pos 2 - {625.845f, 112.914f, 421.575f, 0}, // 8 - Ally Initial Pos 3 - {615.566f, 109.653f, 418.234f, 0}, // 9 - Ally Initial Pos 4 + {613.127f, 100.443f, 419.74f, 0}, // 5 - Ally Initial Pos 0 + {621.126f, 128.042f, 418.231f, 0}, // 6 - Ally Initial Pos 1 + {618.829f, 113.606f, 418.232f, 0}, // 7 - Ally Initial Pos 2 + {625.845f, 112.914f, 421.575f, 0}, // 8 - Ally Initial Pos 3 + {615.566f, 109.653f, 418.234f, 0}, // 9 - Ally Initial Pos 4 - {535.469f, 113.012f, 394.55f, 0}, // 10 - Final Pos 0 - {526.417f, 137.465f, 394.55f, 0}, // 11 - Final Pos 1 - {528.108f, 111.057f, 394.55f, 0}, // 12 - Final Pos 2 - {519.92f, 134.285f, 394.55f, 0}, // 13 - Final Pos 3 - {533.648f, 119.148f, 394.55f, 0}, // 14 - Final Pos 4 - {531.399f, 125.63f, 394.55f, 0}, // 15 - Final Pos 5 - {528.958f, 131.47f, 394.55f, 0}, // 16 - Final Pos 6 - {526.309f, 116.667f, 394.55f, 0}, // 17 - Final Pos 7 - {524.238f, 122.411f, 394.55f, 0}, // 18 - Final Pos 8 - {521.901f, 128.488f, 394.55f, 0}, // 19 - Final Pos 9 + {535.469f, 113.012f, 394.55f, 0}, // 10 - Final Pos 0 + {526.417f, 137.465f, 394.55f, 0}, // 11 - Final Pos 1 + {528.108f, 111.057f, 394.55f, 0}, // 12 - Final Pos 2 + {519.92f, 134.285f, 394.55f, 0}, // 13 - Final Pos 3 + {533.648f, 119.148f, 394.55f, 0}, // 14 - Final Pos 4 + {531.399f, 125.63f, 394.55f, 0}, // 15 - Final Pos 5 + {528.958f, 131.47f, 394.55f, 0}, // 16 - Final Pos 6 + {526.309f, 116.667f, 394.55f, 0}, // 17 - Final Pos 7 + {524.238f, 122.411f, 394.55f, 0}, // 18 - Final Pos 8 + {521.901f, 128.488f, 394.55f, 0}, // 19 - Final Pos 9 }; enum EventSpells { - SPELL_WILFRED_PORTAL = 68424, - SPELL_JORMUNGAR_ACHIEV = 68523, - SPELL_FACTION_CHAMPIONS_KILL_CREDIT = 68184, - SPELL_RESILIENCE_WILL_FIX_IT_CREDIT = 68620, - SPELL_TRAITOR_KING_10 = 68186, - SPELL_TRAITOR_KING_25 = 68515, - SPELL_PORTAL_TO_DALARAN = 53142, + SPELL_WILFRED_PORTAL = 68424, + SPELL_JORMUNGAR_ACHIEV = 68523, + SPELL_FACTION_CHAMPIONS_KILL_CREDIT = 68184, + SPELL_RESILIENCE_WILL_FIX_IT_CREDIT = 68620, + SPELL_TRAITOR_KING_10 = 68186, + SPELL_TRAITOR_KING_25 = 68515, + SPELL_PORTAL_TO_DALARAN = 53142, }; enum eAchievementCriteria { - ACHIEV_CRITERIA_UPPER_BACK_PAIN_10_N = 11779, - ACHIEV_CRITERIA_UPPER_BACK_PAIN_10_H = 11802, - ACHIEV_CRITERIA_UPPER_BACK_PAIN_25_N = 11780, - ACHIEV_CRITERIA_UPPER_BACK_PAIN_25_H = 11801, - ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_10_N = 11838, - ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_10_H = 11861, - ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_25_N = 11839, - ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_25_H = 11862, + ACHIEV_CRITERIA_UPPER_BACK_PAIN_10_N = 11779, + ACHIEV_CRITERIA_UPPER_BACK_PAIN_10_H = 11802, + ACHIEV_CRITERIA_UPPER_BACK_PAIN_25_N = 11780, + ACHIEV_CRITERIA_UPPER_BACK_PAIN_25_H = 11801, + ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_10_N = 11838, + ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_10_H = 11861, + ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_25_N = 11839, + ACHIEV_CRITERIA_THREE_SIXTY_PAIN_SPIKE_25_H = 11862, - ACHIEV_CRITERIA_A_TRIBUTE_TO_SKILL_10_PLAYER = 12344, - ACHIEV_CRITERIA_A_TRIBUTE_TO_SKILL_25_PLAYER = 12338, - ACHIEV_CRITERIA_A_TRIBUTE_TO_MAD_SKILL_10_PLAYER = 12347, - ACHIEV_CRITERIA_A_TRIBUTE_TO_MAD_SKILL_25_PLAYER = 12341, - ACHIEV_CRITERIA_A_TRIBUTE_TO_INSANITY_10_PLAYER = 12349, - ACHIEV_CRITERIA_A_TRIBUTE_TO_INSANITY_25_PLAYER = 12343, - ACHIEV_CRITERIA_A_TRIBUTE_TO_IMMORTALITY_HORDE = 12358, - ACHIEV_CRITERIA_A_TRIBUTE_TO_IMMORTALITY_ALLIANCE = 12359, - ACHIEV_CRITERIA_A_TRIBUTE_TO_DEDICATED_INSANITY = 12360, - ACHIEV_CRITERIA_REALM_FIRST_GRAND_CRUSADER = 12350, + ACHIEV_CRITERIA_A_TRIBUTE_TO_SKILL_10_PLAYER = 12344, + ACHIEV_CRITERIA_A_TRIBUTE_TO_SKILL_25_PLAYER = 12338, + ACHIEV_CRITERIA_A_TRIBUTE_TO_MAD_SKILL_10_PLAYER = 12347, + ACHIEV_CRITERIA_A_TRIBUTE_TO_MAD_SKILL_25_PLAYER = 12341, + ACHIEV_CRITERIA_A_TRIBUTE_TO_INSANITY_10_PLAYER = 12349, + ACHIEV_CRITERIA_A_TRIBUTE_TO_INSANITY_25_PLAYER = 12343, + ACHIEV_CRITERIA_A_TRIBUTE_TO_IMMORTALITY_HORDE = 12358, + ACHIEV_CRITERIA_A_TRIBUTE_TO_IMMORTALITY_ALLIANCE = 12359, + ACHIEV_CRITERIA_A_TRIBUTE_TO_DEDICATED_INSANITY = 12360, + ACHIEV_CRITERIA_REALM_FIRST_GRAND_CRUSADER = 12350, }; enum euiWorldStates { - UPDATE_STATE_UI_SHOW = 4390, - UPDATE_STATE_UI_COUNT = 4389, + UPDATE_STATE_UI_SHOW = 4390, + UPDATE_STATE_UI_COUNT = 4389, }; const uint32 dIIc = 405; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp index 373c8a105..85b35befc 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp @@ -9,166 +9,166 @@ REWRITTEN BY XINEF enum Spells { - SPELL_BELLOWING_ROAR = 22686, - SPELL_GRIEVOUS_BITE = 48920, - SPELL_MANGLING_SLASH = 48873, - SPELL_FEARSOME_ROAR = 48849, - SPELL_PIERCING_SLASH = 48878, - SPELL_RAPTOR_CALL = 59416 + SPELL_BELLOWING_ROAR = 22686, + SPELL_GRIEVOUS_BITE = 48920, + SPELL_MANGLING_SLASH = 48873, + SPELL_FEARSOME_ROAR = 48849, + SPELL_PIERCING_SLASH = 48878, + SPELL_RAPTOR_CALL = 59416 }; enum Misc { - NPC_DRAKKARI_SCYTHECLAW = 26628, - NPC_DRAKKARI_GUTRIPPER = 26641, + NPC_DRAKKARI_SCYTHECLAW = 26628, + NPC_DRAKKARI_GUTRIPPER = 26641, - SAY_CLAW_EMOTE = 0, + SAY_CLAW_EMOTE = 0, - EVENT_SPELL_BELLOWING_ROAR = 1, - EVENT_SPELL_GRIEVOUS_BITE = 2, - EVENT_SPELL_MANGLING_SLASH = 3, - EVENT_SPELL_FEARSOME_ROAR = 4, - EVENT_SPELL_PIERCING_SLASH = 5, - EVENT_SPELL_RAPTOR_CALL = 6, - EVENT_MENACING_CLAW = 7 + EVENT_SPELL_BELLOWING_ROAR = 1, + EVENT_SPELL_GRIEVOUS_BITE = 2, + EVENT_SPELL_MANGLING_SLASH = 3, + EVENT_SPELL_FEARSOME_ROAR = 4, + EVENT_SPELL_PIERCING_SLASH = 5, + EVENT_SPELL_RAPTOR_CALL = 6, + EVENT_MENACING_CLAW = 7 }; class boss_dred : public CreatureScript { - public: - boss_dred() : CreatureScript("boss_dred") {} + public: + boss_dred() : CreatureScript("boss_dred") {} - CreatureAI *GetAI(Creature *creature) const - { - return GetInstanceAI(creature); - } + CreatureAI *GetAI(Creature *creature) const + { + return GetInstanceAI(creature); + } - struct boss_dredAI : public BossAI - { - boss_dredAI(Creature* creature) : BossAI(creature, DATA_DRED) - { - } + struct boss_dredAI : public BossAI + { + boss_dredAI(Creature* creature) : BossAI(creature, DATA_DRED) + { + } - void Reset() - { - BossAI::Reset(); - _raptorCount = 0; - } + void Reset() + { + BossAI::Reset(); + _raptorCount = 0; + } - uint32 GetData(uint32 data) const - { - if (data == me->GetEntry()) - return uint32(_raptorCount >= _raptorCount); - return 0; - } + uint32 GetData(uint32 data) const + { + if (data == me->GetEntry()) + return uint32(_raptorCount >= _raptorCount); + return 0; + } - void SetData(uint32 type, uint32) - { - if (type == me->GetEntry()) - ++_raptorCount; - } + void SetData(uint32 type, uint32) + { + if (type == me->GetEntry()) + ++_raptorCount; + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - _raptorCount = 0; + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + _raptorCount = 0; - events.ScheduleEvent(EVENT_SPELL_BELLOWING_ROAR, 33000); - events.ScheduleEvent(EVENT_SPELL_GRIEVOUS_BITE, 20000); - events.ScheduleEvent(EVENT_SPELL_MANGLING_SLASH, 18500); - events.ScheduleEvent(EVENT_SPELL_FEARSOME_ROAR, urand(10000,20000)); - events.ScheduleEvent(EVENT_SPELL_PIERCING_SLASH, 17000); - if (IsHeroic()) - { - events.ScheduleEvent(EVENT_MENACING_CLAW, 21000); - events.ScheduleEvent(EVENT_SPELL_RAPTOR_CALL, urand(20000,25000)); - } - } + events.ScheduleEvent(EVENT_SPELL_BELLOWING_ROAR, 33000); + events.ScheduleEvent(EVENT_SPELL_GRIEVOUS_BITE, 20000); + events.ScheduleEvent(EVENT_SPELL_MANGLING_SLASH, 18500); + events.ScheduleEvent(EVENT_SPELL_FEARSOME_ROAR, urand(10000,20000)); + events.ScheduleEvent(EVENT_SPELL_PIERCING_SLASH, 17000); + if (IsHeroic()) + { + events.ScheduleEvent(EVENT_MENACING_CLAW, 21000); + events.ScheduleEvent(EVENT_SPELL_RAPTOR_CALL, urand(20000,25000)); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_BELLOWING_ROAR: - me->CastSpell(me, SPELL_BELLOWING_ROAR, false); - events.ScheduleEvent(EVENT_SPELL_BELLOWING_ROAR, 40000); - break; - case EVENT_SPELL_GRIEVOUS_BITE: - me->CastSpell(me->GetVictim(), SPELL_GRIEVOUS_BITE, false); - events.ScheduleEvent(EVENT_SPELL_GRIEVOUS_BITE, 20000); - break; - case EVENT_SPELL_MANGLING_SLASH: - me->CastSpell(me->GetVictim(), SPELL_MANGLING_SLASH, false); - events.ScheduleEvent(EVENT_SPELL_MANGLING_SLASH, 20000); - break; - case EVENT_SPELL_FEARSOME_ROAR: - me->CastSpell(me, SPELL_FEARSOME_ROAR, false); - events.ScheduleEvent(EVENT_SPELL_FEARSOME_ROAR, 17000); - break; - case EVENT_SPELL_PIERCING_SLASH: - me->CastSpell(me->GetVictim(), SPELL_PIERCING_SLASH, false); - events.ScheduleEvent(EVENT_SPELL_PIERCING_SLASH, 20000); - break; - case EVENT_SPELL_RAPTOR_CALL: - me->CastSpell(me, SPELL_RAPTOR_CALL, false); - events.ScheduleEvent(EVENT_SPELL_RAPTOR_CALL, 20000); - break; - case EVENT_MENACING_CLAW: - Talk(SAY_CLAW_EMOTE); - me->setAttackTimer(BASE_ATTACK, 2000); - me->AttackerStateUpdate(me->GetVictim()); - if (me->GetVictim()) - me->AttackerStateUpdate(me->GetVictim()); - if (me->GetVictim()) - me->AttackerStateUpdate(me->GetVictim()); - events.ScheduleEvent(EVENT_MENACING_CLAW, 20000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_BELLOWING_ROAR: + me->CastSpell(me, SPELL_BELLOWING_ROAR, false); + events.ScheduleEvent(EVENT_SPELL_BELLOWING_ROAR, 40000); + break; + case EVENT_SPELL_GRIEVOUS_BITE: + me->CastSpell(me->GetVictim(), SPELL_GRIEVOUS_BITE, false); + events.ScheduleEvent(EVENT_SPELL_GRIEVOUS_BITE, 20000); + break; + case EVENT_SPELL_MANGLING_SLASH: + me->CastSpell(me->GetVictim(), SPELL_MANGLING_SLASH, false); + events.ScheduleEvent(EVENT_SPELL_MANGLING_SLASH, 20000); + break; + case EVENT_SPELL_FEARSOME_ROAR: + me->CastSpell(me, SPELL_FEARSOME_ROAR, false); + events.ScheduleEvent(EVENT_SPELL_FEARSOME_ROAR, 17000); + break; + case EVENT_SPELL_PIERCING_SLASH: + me->CastSpell(me->GetVictim(), SPELL_PIERCING_SLASH, false); + events.ScheduleEvent(EVENT_SPELL_PIERCING_SLASH, 20000); + break; + case EVENT_SPELL_RAPTOR_CALL: + me->CastSpell(me, SPELL_RAPTOR_CALL, false); + events.ScheduleEvent(EVENT_SPELL_RAPTOR_CALL, 20000); + break; + case EVENT_MENACING_CLAW: + Talk(SAY_CLAW_EMOTE); + me->setAttackTimer(BASE_ATTACK, 2000); + me->AttackerStateUpdate(me->GetVictim()); + if (me->GetVictim()) + me->AttackerStateUpdate(me->GetVictim()); + if (me->GetVictim()) + me->AttackerStateUpdate(me->GetVictim()); + events.ScheduleEvent(EVENT_MENACING_CLAW, 20000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - uint8 _raptorCount; - }; + private: + uint8 _raptorCount; + }; }; class spell_dred_grievious_bite : public SpellScriptLoader { - public: - spell_dred_grievious_bite() : SpellScriptLoader("spell_dred_grievious_bite") { } + public: + spell_dred_grievious_bite() : SpellScriptLoader("spell_dred_grievious_bite") { } - class spell_dred_grievious_bite_AuraScript : public AuraScript - { - PrepareAuraScript(spell_dred_grievious_bite_AuraScript); + class spell_dred_grievious_bite_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dred_grievious_bite_AuraScript); - void OnPeriodic(AuraEffect const* /*aurEff*/) - { - if (Unit* target = GetTarget()) - if (target->GetHealth() == target->GetMaxHealth()) - { - PreventDefaultAction(); - SetDuration(0); - } - } + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (Unit* target = GetTarget()) + if (target->GetHealth() == target->GetMaxHealth()) + { + PreventDefaultAction(); + SetDuration(0); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_dred_grievious_bite_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dred_grievious_bite_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_dred_grievious_bite_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_dred_grievious_bite_AuraScript(); + } }; class spell_dred_raptor_call : public SpellScriptLoader @@ -209,14 +209,14 @@ class achievement_better_off_dred : public AchievementCriteriaScript if (!target) return false; - return target->GetAI()->GetData(target->GetEntry()); + return target->GetAI()->GetData(target->GetEntry()); } }; void AddSC_boss_dred() { - new boss_dred(); - new spell_dred_grievious_bite(); - new spell_dred_raptor_call(); - new achievement_better_off_dred(); + new boss_dred(); + new spell_dred_grievious_bite(); + new spell_dred_raptor_call(); + new achievement_better_off_dred(); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 3d4be84d5..314c0bf68 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -8,215 +8,215 @@ REWRITTEN BY XINEF enum Yells { - SAY_AGGRO = 0, - SAY_KILL = 1, - SAY_DEATH = 2, - SAY_SUMMONING_ADDS = 3, - SAY_ARCANE_FIELD = 4, - EMOTE_SUMMONING_ADDS = 5 + SAY_AGGRO = 0, + SAY_KILL = 1, + SAY_DEATH = 2, + SAY_SUMMONING_ADDS = 3, + SAY_ARCANE_FIELD = 4, + EMOTE_SUMMONING_ADDS = 5 }; enum Spells { - SPELL_BEAM_CHANNEL = 52106, - SPELL_ARCANE_BLAST = 49198, - SPELL_ARCANE_FIELD = 47346, - SPELL_SUMMON_FETID_TROLL_CORPSE = 49103, - SPELL_SUMMON_HULKING_CORPSE = 49104, - SPELL_SUMMON_RISEN_SHADOWCASTER = 49105, - SPELL_SUMMON_CRYSTAL_HANDLER = 49179, - SPELL_DESPAWN_CRYSTAL_HANDLER = 51403, + SPELL_BEAM_CHANNEL = 52106, + SPELL_ARCANE_BLAST = 49198, + SPELL_ARCANE_FIELD = 47346, + SPELL_SUMMON_FETID_TROLL_CORPSE = 49103, + SPELL_SUMMON_HULKING_CORPSE = 49104, + SPELL_SUMMON_RISEN_SHADOWCASTER = 49105, + SPELL_SUMMON_CRYSTAL_HANDLER = 49179, + SPELL_DESPAWN_CRYSTAL_HANDLER = 51403, - SPELL_SUMMON_MINIONS = 59910, - SPELL_COPY_OF_SUMMON_MINIONS = 59933, - SPELL_BLIZZARD = 49034, - SPELL_FROSTBOLT = 49037, - SPELL_TOUCH_OF_MISERY = 50090 + SPELL_SUMMON_MINIONS = 59910, + SPELL_COPY_OF_SUMMON_MINIONS = 59933, + SPELL_BLIZZARD = 49034, + SPELL_FROSTBOLT = 49037, + SPELL_TOUCH_OF_MISERY = 50090 }; enum Misc { - NPC_CRYSTAL_CHANNEL_TARGET = 26712, - NPC_CRYSTAL_HANDLER = 26627, + NPC_CRYSTAL_CHANNEL_TARGET = 26712, + NPC_CRYSTAL_HANDLER = 26627, - EVENT_SUMMON_FETID_TROLL = 1, - EVENT_SUMMON_SHADOWCASTER = 2, - EVENT_SUMMON_HULKING_CORPSE = 3, - EVENT_SUMMON_CRYSTAL_HANDLER = 4, - EVENT_CAST_OFFENSIVE_SPELL = 5, - EVENT_KILL_TALK = 6, - EVENT_CHECK_PHASE = 7, - EVENT_SPELL_SUMMON_MINIONS = 8 + EVENT_SUMMON_FETID_TROLL = 1, + EVENT_SUMMON_SHADOWCASTER = 2, + EVENT_SUMMON_HULKING_CORPSE = 3, + EVENT_SUMMON_CRYSTAL_HANDLER = 4, + EVENT_CAST_OFFENSIVE_SPELL = 5, + EVENT_KILL_TALK = 6, + EVENT_CHECK_PHASE = 7, + EVENT_SPELL_SUMMON_MINIONS = 8 }; class boss_novos : public CreatureScript { - public: - boss_novos() : CreatureScript("boss_novos") { } + public: + boss_novos() : CreatureScript("boss_novos") { } - struct boss_novosAI : public BossAI - { - boss_novosAI(Creature* creature) : BossAI(creature, DATA_NOVOS) - { - } + struct boss_novosAI : public BossAI + { + boss_novosAI(Creature* creature) : BossAI(creature, DATA_NOVOS) + { + } - void Reset() - { - BossAI::Reset(); - instance->SetBossState(DATA_NOVOS_CRYSTALS, IN_PROGRESS); - instance->SetBossState(DATA_NOVOS_CRYSTALS, NOT_STARTED); - _crystalCounter = 0; + void Reset() + { + BossAI::Reset(); + instance->SetBossState(DATA_NOVOS_CRYSTALS, IN_PROGRESS); + instance->SetBossState(DATA_NOVOS_CRYSTALS, NOT_STARTED); + _crystalCounter = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - _achievement = true; - } + _achievement = true; + } - uint32 GetData(uint32 data) const - { - if (data == me->GetEntry()) - return uint32(_achievement); - return 0; - } + uint32 GetData(uint32 data) const + { + if (data == me->GetEntry()) + return uint32(_achievement); + return 0; + } - void SetData(uint32 type, uint32) - { - if (type == me->GetEntry()) - _achievement = false; - } + void SetData(uint32 type, uint32) + { + if (type == me->GetEntry()) + _achievement = false; + } - void MoveInLineOfSight(Unit* who) { } + void MoveInLineOfSight(Unit* who) { } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - BossAI::EnterCombat(who); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SUMMON_FETID_TROLL, 3000); - events.ScheduleEvent(EVENT_SUMMON_SHADOWCASTER, 9000); - events.ScheduleEvent(EVENT_SUMMON_HULKING_CORPSE, 30000); - events.ScheduleEvent(EVENT_SUMMON_CRYSTAL_HANDLER, 20000); - events.ScheduleEvent(EVENT_CHECK_PHASE, 80000); + events.ScheduleEvent(EVENT_SUMMON_FETID_TROLL, 3000); + events.ScheduleEvent(EVENT_SUMMON_SHADOWCASTER, 9000); + events.ScheduleEvent(EVENT_SUMMON_HULKING_CORPSE, 30000); + events.ScheduleEvent(EVENT_SUMMON_CRYSTAL_HANDLER, 20000); + events.ScheduleEvent(EVENT_CHECK_PHASE, 80000); - me->CastSpell(me, SPELL_ARCANE_BLAST, true); - me->CastSpell(me, SPELL_ARCANE_FIELD, true); - me->CastSpell(me, SPELL_DESPAWN_CRYSTAL_HANDLER, true); - me->SummonCreature(NPC_CRYSTAL_CHANNEL_TARGET, -378.40f, -813.13f, 59.74f, 0.0f); + me->CastSpell(me, SPELL_ARCANE_BLAST, true); + me->CastSpell(me, SPELL_ARCANE_FIELD, true); + me->CastSpell(me, SPELL_DESPAWN_CRYSTAL_HANDLER, true); + me->SummonCreature(NPC_CRYSTAL_CHANNEL_TARGET, -378.40f, -813.13f, 59.74f, 0.0f); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - instance->SetBossState(DATA_NOVOS_CRYSTALS, DONE); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + instance->SetBossState(DATA_NOVOS_CRYSTALS, DONE); + } - void KilledUnit(Unit* victim) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* victim) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && summon->GetEntry() != NPC_CRYSTAL_CHANNEL_TARGET && summon->GetEntry() != NPC_CRYSTAL_HANDLER) - summon->SetReactState(REACT_DEFENSIVE); - else if (summon->GetEntry() != NPC_CRYSTAL_CHANNEL_TARGET) - summon->SetInCombatWithZone(); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && summon->GetEntry() != NPC_CRYSTAL_CHANNEL_TARGET && summon->GetEntry() != NPC_CRYSTAL_HANDLER) + summon->SetReactState(REACT_DEFENSIVE); + else if (summon->GetEntry() != NPC_CRYSTAL_CHANNEL_TARGET) + summon->SetInCombatWithZone(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_SUMMON_FETID_TROLL: - if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET)) - trigger->CastSpell(trigger, SPELL_SUMMON_FETID_TROLL_CORPSE, true, NULL, NULL, me->GetGUID()); - events.ScheduleEvent(EVENT_SUMMON_FETID_TROLL, 3000); - break; - case EVENT_SUMMON_HULKING_CORPSE: - if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET)) - trigger->CastSpell(trigger, SPELL_SUMMON_HULKING_CORPSE, true, NULL, NULL, me->GetGUID()); - events.ScheduleEvent(EVENT_SUMMON_HULKING_CORPSE, 30000); - break; - case EVENT_SUMMON_SHADOWCASTER: - if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET)) - trigger->CastSpell(trigger, SPELL_SUMMON_RISEN_SHADOWCASTER, true, NULL, NULL, me->GetGUID()); - events.ScheduleEvent(EVENT_SUMMON_SHADOWCASTER, 10000); - break; - case EVENT_SUMMON_CRYSTAL_HANDLER: - if (_crystalCounter++ < 4) - { - Talk(SAY_SUMMONING_ADDS); - Talk(EMOTE_SUMMONING_ADDS); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f)) - target->CastSpell(target, SPELL_SUMMON_CRYSTAL_HANDLER, true, NULL, NULL, me->GetGUID()); - events.ScheduleEvent(EVENT_SUMMON_CRYSTAL_HANDLER, 20000); - } - break; - case EVENT_CHECK_PHASE: - if (me->HasAura(SPELL_BEAM_CHANNEL)) - { - events.ScheduleEvent(EVENT_CHECK_PHASE, 2000); - break; - } - events.Reset(); - events.ScheduleEvent(EVENT_CAST_OFFENSIVE_SPELL, 3000); - events.ScheduleEvent(EVENT_SPELL_SUMMON_MINIONS, 10000); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->InterruptNonMeleeSpells(false); - break; - case EVENT_CAST_OFFENSIVE_SPELL: - if (!me->HasUnitState(UNIT_STATE_CASTING)) - if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - me->CastSpell(target, RAND(SPELL_BLIZZARD,SPELL_FROSTBOLT,SPELL_TOUCH_OF_MISERY), false); + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_SUMMON_FETID_TROLL: + if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET)) + trigger->CastSpell(trigger, SPELL_SUMMON_FETID_TROLL_CORPSE, true, NULL, NULL, me->GetGUID()); + events.ScheduleEvent(EVENT_SUMMON_FETID_TROLL, 3000); + break; + case EVENT_SUMMON_HULKING_CORPSE: + if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET)) + trigger->CastSpell(trigger, SPELL_SUMMON_HULKING_CORPSE, true, NULL, NULL, me->GetGUID()); + events.ScheduleEvent(EVENT_SUMMON_HULKING_CORPSE, 30000); + break; + case EVENT_SUMMON_SHADOWCASTER: + if (Creature* trigger = summons.GetCreatureWithEntry(NPC_CRYSTAL_CHANNEL_TARGET)) + trigger->CastSpell(trigger, SPELL_SUMMON_RISEN_SHADOWCASTER, true, NULL, NULL, me->GetGUID()); + events.ScheduleEvent(EVENT_SUMMON_SHADOWCASTER, 10000); + break; + case EVENT_SUMMON_CRYSTAL_HANDLER: + if (_crystalCounter++ < 4) + { + Talk(SAY_SUMMONING_ADDS); + Talk(EMOTE_SUMMONING_ADDS); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f)) + target->CastSpell(target, SPELL_SUMMON_CRYSTAL_HANDLER, true, NULL, NULL, me->GetGUID()); + events.ScheduleEvent(EVENT_SUMMON_CRYSTAL_HANDLER, 20000); + } + break; + case EVENT_CHECK_PHASE: + if (me->HasAura(SPELL_BEAM_CHANNEL)) + { + events.ScheduleEvent(EVENT_CHECK_PHASE, 2000); + break; + } + events.Reset(); + events.ScheduleEvent(EVENT_CAST_OFFENSIVE_SPELL, 3000); + events.ScheduleEvent(EVENT_SPELL_SUMMON_MINIONS, 10000); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->InterruptNonMeleeSpells(false); + break; + case EVENT_CAST_OFFENSIVE_SPELL: + if (!me->HasUnitState(UNIT_STATE_CASTING)) + if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + me->CastSpell(target, RAND(SPELL_BLIZZARD,SPELL_FROSTBOLT,SPELL_TOUCH_OF_MISERY), false); - events.ScheduleEvent(EVENT_CAST_OFFENSIVE_SPELL, 500); - break; - case EVENT_SPELL_SUMMON_MINIONS: - if (me->HasUnitState(UNIT_STATE_CASTING)) - { - me->CastSpell(me, SPELL_SUMMON_MINIONS, false); - events.ScheduleEvent(EVENT_SPELL_SUMMON_MINIONS, 15000); - break; - } - events.ScheduleEvent(EVENT_SPELL_SUMMON_MINIONS, 500); - break; - } + events.ScheduleEvent(EVENT_CAST_OFFENSIVE_SPELL, 500); + break; + case EVENT_SPELL_SUMMON_MINIONS: + if (me->HasUnitState(UNIT_STATE_CASTING)) + { + me->CastSpell(me, SPELL_SUMMON_MINIONS, false); + events.ScheduleEvent(EVENT_SPELL_SUMMON_MINIONS, 15000); + break; + } + events.ScheduleEvent(EVENT_SPELL_SUMMON_MINIONS, 500); + break; + } EnterEvadeIfOutOfCombatArea(); } - - bool CheckEvadeIfOutOfCombatArea() const - { - return !SelectTargetFromPlayerList(80.0f); - } + + bool CheckEvadeIfOutOfCombatArea() const + { + return !SelectTargetFromPlayerList(80.0f); + } - private: - uint8 _crystalCounter; - bool _achievement; - }; + private: + uint8 _crystalCounter; + bool _achievement; + }; - CreatureAI *GetAI(Creature *creature) const - { - return GetInstanceAI(creature); - } + CreatureAI *GetAI(Creature *creature) const + { + return GetInstanceAI(creature); + } }; class spell_novos_despawn_crystal_handler : public SpellScriptLoader @@ -248,30 +248,30 @@ class spell_novos_despawn_crystal_handler : public SpellScriptLoader class spell_novos_crystal_handler_death : public SpellScriptLoader { - public: - spell_novos_crystal_handler_death() : SpellScriptLoader("spell_novos_crystal_handler_death") { } + public: + spell_novos_crystal_handler_death() : SpellScriptLoader("spell_novos_crystal_handler_death") { } - class spell_novos_crystal_handler_death_AuraScript : public AuraScript - { - PrepareAuraScript(spell_novos_crystal_handler_death_AuraScript) + class spell_novos_crystal_handler_death_AuraScript : public AuraScript + { + PrepareAuraScript(spell_novos_crystal_handler_death_AuraScript) - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->InterruptNonMeleeSpells(false); - if (GameObject* crystal = GetUnitOwner()->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_DOOR, 5.0f)) - crystal->SetGoState(GO_STATE_READY); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->InterruptNonMeleeSpells(false); + if (GameObject* crystal = GetUnitOwner()->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_DOOR, 5.0f)) + crystal->SetGoState(GO_STATE_READY); + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_novos_crystal_handler_death_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_novos_crystal_handler_death_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_novos_crystal_handler_death_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_novos_crystal_handler_death_AuraScript(); + } }; class spell_novos_summon_minions : public SpellScriptLoader @@ -303,20 +303,20 @@ class spell_novos_summon_minions : public SpellScriptLoader class achievement_oh_novos : public AchievementCriteriaScript { - public: - achievement_oh_novos() : AchievementCriteriaScript("achievement_oh_novos") { } + public: + achievement_oh_novos() : AchievementCriteriaScript("achievement_oh_novos") { } - bool OnCheck(Player* /*player*/, Unit* target) - { - return target && target->GetAI()->GetData(target->GetEntry()); - } + bool OnCheck(Player* /*player*/, Unit* target) + { + return target && target->GetAI()->GetData(target->GetEntry()); + } }; void AddSC_boss_novos() { - new boss_novos(); - new spell_novos_despawn_crystal_handler(); - new spell_novos_crystal_handler_death(); - new spell_novos_summon_minions(); - new achievement_oh_novos(); + new boss_novos(); + new spell_novos_despawn_crystal_handler(); + new spell_novos_crystal_handler_death(); + new spell_novos_summon_minions(); + new achievement_oh_novos(); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index 4fff1fbed..3d6680561 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -8,259 +8,259 @@ REWRITTEN BY XINEF enum Yells { - SAY_AGGRO = 0, - SAY_KILL = 1, - SAY_FLESH = 2, - SAY_SKELETON = 3, - SAY_DEATH = 4 + SAY_AGGRO = 0, + SAY_KILL = 1, + SAY_FLESH = 2, + SAY_SKELETON = 3, + SAY_DEATH = 4 }; enum Spells { - SPELL_CURSE_OF_LIFE = 49527, - SPELL_RAIN_OF_FIRE = 49518, - SPELL_SHADOW_VOLLEY = 49528, + SPELL_CURSE_OF_LIFE = 49527, + SPELL_RAIN_OF_FIRE = 49518, + SPELL_SHADOW_VOLLEY = 49528, - // flesh spells - SPELL_EYE_BEAM = 49544, - SPELL_LIGHTNING_BREATH = 49537, - SPELL_POISON_CLOUD = 49548, + // flesh spells + SPELL_EYE_BEAM = 49544, + SPELL_LIGHTNING_BREATH = 49537, + SPELL_POISON_CLOUD = 49548, - SPELL_TURN_FLESH = 49356, - SPELL_TURN_BONES = 53463, - SPELL_GIFT_OF_THARON_JA = 52509, - SPELL_DUMMY = 49551, - SPELL_FLESH_VISUAL = 52582, - SPELL_CLEAR_GIFT = 53242, + SPELL_TURN_FLESH = 49356, + SPELL_TURN_BONES = 53463, + SPELL_GIFT_OF_THARON_JA = 52509, + SPELL_DUMMY = 49551, + SPELL_FLESH_VISUAL = 52582, + SPELL_CLEAR_GIFT = 53242, - SPELL_ACHIEVEMENT_CHECK = 61863 + SPELL_ACHIEVEMENT_CHECK = 61863 }; enum Misc { - ACTION_TURN_BONES = 1, + ACTION_TURN_BONES = 1, - EVENT_SPELL_CURSE_OF_LIFE = 1, - EVENT_SPELL_RAIN_OF_FIRE = 2, - EVENT_SPELL_SHADOW_VOLLEY = 3, - EVENT_SPELL_EYE_BEAM = 4, - EVENT_SPELL_LIGHTNING_BREATH = 5, - EVENT_SPELL_POISON_CLOUD = 6, - EVENT_SPELL_TURN_FLESH = 7, - EVENT_TURN_FLESH_REAL = 9, - EVENT_TURN_BONES_REAL = 10, - EVENT_KILL_TALK = 11 + EVENT_SPELL_CURSE_OF_LIFE = 1, + EVENT_SPELL_RAIN_OF_FIRE = 2, + EVENT_SPELL_SHADOW_VOLLEY = 3, + EVENT_SPELL_EYE_BEAM = 4, + EVENT_SPELL_LIGHTNING_BREATH = 5, + EVENT_SPELL_POISON_CLOUD = 6, + EVENT_SPELL_TURN_FLESH = 7, + EVENT_TURN_FLESH_REAL = 9, + EVENT_TURN_BONES_REAL = 10, + EVENT_KILL_TALK = 11 }; class boss_tharon_ja : public CreatureScript { - public: - boss_tharon_ja() : CreatureScript("boss_tharon_ja") { } + public: + boss_tharon_ja() : CreatureScript("boss_tharon_ja") { } - CreatureAI *GetAI(Creature *creature) const - { - return GetInstanceAI(creature); - } + CreatureAI *GetAI(Creature *creature) const + { + return GetInstanceAI(creature); + } - struct boss_tharon_jaAI : public BossAI - { - boss_tharon_jaAI(Creature* creature) : BossAI(creature, DATA_THARON_JA) - { - } + struct boss_tharon_jaAI : public BossAI + { + boss_tharon_jaAI(Creature* creature) : BossAI(creature, DATA_THARON_JA) + { + } - void Reset() - { - BossAI::Reset(); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true); - me->SetDisplayId(me->GetNativeDisplayId()); - me->CastSpell(me, SPELL_CLEAR_GIFT, true); - } + void Reset() + { + BossAI::Reset(); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true); + me->SetDisplayId(me->GetNativeDisplayId()); + me->CastSpell(me, SPELL_CLEAR_GIFT, true); + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_CURSE_OF_LIFE, 5000); - events.ScheduleEvent(EVENT_SPELL_RAIN_OF_FIRE, urand(14000,18000)); - events.ScheduleEvent(EVENT_SPELL_SHADOW_VOLLEY, urand(8000,10000)); - events.ScheduleEvent(EVENT_SPELL_TURN_FLESH, 1000); - } + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + BossAI::EnterCombat(who); + events.ScheduleEvent(EVENT_SPELL_CURSE_OF_LIFE, 5000); + events.ScheduleEvent(EVENT_SPELL_RAIN_OF_FIRE, urand(14000,18000)); + events.ScheduleEvent(EVENT_SPELL_SHADOW_VOLLEY, urand(8000,10000)); + events.ScheduleEvent(EVENT_SPELL_TURN_FLESH, 1000); + } - void KilledUnit(Unit *victim) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit *victim) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void DoAction(int32 param) - { - if (param == ACTION_TURN_BONES && me->IsAlive()) - { - Talk(SAY_SKELETON); - events.Reset(); - events.ScheduleEvent(EVENT_TURN_BONES_REAL, 3000); - } - } + void DoAction(int32 param) + { + if (param == ACTION_TURN_BONES && me->IsAlive()) + { + Talk(SAY_SKELETON); + events.Reset(); + events.ScheduleEvent(EVENT_TURN_BONES_REAL, 3000); + } + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - me->CastSpell(me, SPELL_ACHIEVEMENT_CHECK, true); - me->CastSpell(me, SPELL_CLEAR_GIFT, true); - if (me->GetDisplayId() != me->GetNativeDisplayId()) - { - me->SetDisplayId(me->GetNativeDisplayId()); - me->CastSpell(me, SPELL_FLESH_VISUAL, true); - } - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + me->CastSpell(me, SPELL_ACHIEVEMENT_CHECK, true); + me->CastSpell(me, SPELL_CLEAR_GIFT, true); + if (me->GetDisplayId() != me->GetNativeDisplayId()) + { + me->SetDisplayId(me->GetNativeDisplayId()); + me->CastSpell(me, SPELL_FLESH_VISUAL, true); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_CURSE_OF_LIFE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) - me->CastSpell(target, SPELL_CURSE_OF_LIFE, false); - events.ScheduleEvent(EVENT_SPELL_CURSE_OF_LIFE, 13000); - break; - case EVENT_SPELL_RAIN_OF_FIRE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) - me->CastSpell(target, SPELL_RAIN_OF_FIRE, false); - events.ScheduleEvent(EVENT_SPELL_RAIN_OF_FIRE, 16000); - break; - case EVENT_SPELL_SHADOW_VOLLEY: - me->CastSpell(me, SPELL_SHADOW_VOLLEY, false); - events.ScheduleEvent(EVENT_SPELL_SHADOW_VOLLEY, 9000); - break; - case EVENT_SPELL_TURN_FLESH: - if (me->HealthBelowPct(50)) - { - Talk(SAY_FLESH); - me->getThreatManager().resetAllAggro(); - me->CastSpell((Unit*)NULL, SPELL_TURN_FLESH, false); + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_CURSE_OF_LIFE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + me->CastSpell(target, SPELL_CURSE_OF_LIFE, false); + events.ScheduleEvent(EVENT_SPELL_CURSE_OF_LIFE, 13000); + break; + case EVENT_SPELL_RAIN_OF_FIRE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + me->CastSpell(target, SPELL_RAIN_OF_FIRE, false); + events.ScheduleEvent(EVENT_SPELL_RAIN_OF_FIRE, 16000); + break; + case EVENT_SPELL_SHADOW_VOLLEY: + me->CastSpell(me, SPELL_SHADOW_VOLLEY, false); + events.ScheduleEvent(EVENT_SPELL_SHADOW_VOLLEY, 9000); + break; + case EVENT_SPELL_TURN_FLESH: + if (me->HealthBelowPct(50)) + { + Talk(SAY_FLESH); + me->getThreatManager().resetAllAggro(); + me->CastSpell((Unit*)NULL, SPELL_TURN_FLESH, false); - events.Reset(); - events.ScheduleEvent(EVENT_TURN_FLESH_REAL, 3000); - return; - } - events.ScheduleEvent(EVENT_SPELL_TURN_FLESH, 1000); - break; - case EVENT_TURN_FLESH_REAL: - me->CastSpell(me, SPELL_DUMMY, true); + events.Reset(); + events.ScheduleEvent(EVENT_TURN_FLESH_REAL, 3000); + return; + } + events.ScheduleEvent(EVENT_SPELL_TURN_FLESH, 1000); + break; + case EVENT_TURN_FLESH_REAL: + me->CastSpell(me, SPELL_DUMMY, true); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - events.ScheduleEvent(EVENT_SPELL_EYE_BEAM, 11000); - events.ScheduleEvent(EVENT_SPELL_LIGHTNING_BREATH, 3000); - events.ScheduleEvent(EVENT_SPELL_POISON_CLOUD, 6000); - break; - case EVENT_SPELL_EYE_BEAM: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true)) - me->CastSpell(target, SPELL_EYE_BEAM, false); - break; - case EVENT_SPELL_LIGHTNING_BREATH: - me->CastSpell(me->GetVictim(), SPELL_LIGHTNING_BREATH, false); - events.ScheduleEvent(EVENT_SPELL_LIGHTNING_BREATH, 8000); - break; - case EVENT_SPELL_POISON_CLOUD: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true)) - me->CastSpell(target, SPELL_POISON_CLOUD, false); - events.ScheduleEvent(EVENT_SPELL_POISON_CLOUD, 10000); - break; - case EVENT_TURN_BONES_REAL: - me->SetDisplayId(me->GetNativeDisplayId()); - me->CastSpell(me, SPELL_FLESH_VISUAL, true); - me->CastSpell(me, SPELL_CLEAR_GIFT, true); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_CURSE_OF_LIFE, 1000); - events.ScheduleEvent(EVENT_SPELL_RAIN_OF_FIRE, urand(12000,14000)); - events.ScheduleEvent(EVENT_SPELL_SHADOW_VOLLEY, urand(8000,10000)); - break; - } + me->GetMotionMaster()->MoveChase(me->GetVictim()); + events.ScheduleEvent(EVENT_SPELL_EYE_BEAM, 11000); + events.ScheduleEvent(EVENT_SPELL_LIGHTNING_BREATH, 3000); + events.ScheduleEvent(EVENT_SPELL_POISON_CLOUD, 6000); + break; + case EVENT_SPELL_EYE_BEAM: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true)) + me->CastSpell(target, SPELL_EYE_BEAM, false); + break; + case EVENT_SPELL_LIGHTNING_BREATH: + me->CastSpell(me->GetVictim(), SPELL_LIGHTNING_BREATH, false); + events.ScheduleEvent(EVENT_SPELL_LIGHTNING_BREATH, 8000); + break; + case EVENT_SPELL_POISON_CLOUD: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true)) + me->CastSpell(target, SPELL_POISON_CLOUD, false); + events.ScheduleEvent(EVENT_SPELL_POISON_CLOUD, 10000); + break; + case EVENT_TURN_BONES_REAL: + me->SetDisplayId(me->GetNativeDisplayId()); + me->CastSpell(me, SPELL_FLESH_VISUAL, true); + me->CastSpell(me, SPELL_CLEAR_GIFT, true); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_CURSE_OF_LIFE, 1000); + events.ScheduleEvent(EVENT_SPELL_RAIN_OF_FIRE, urand(12000,14000)); + events.ScheduleEvent(EVENT_SPELL_SHADOW_VOLLEY, urand(8000,10000)); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_tharon_ja_curse_of_life : public SpellScriptLoader { - public: - spell_tharon_ja_curse_of_life() : SpellScriptLoader("spell_tharon_ja_curse_of_life") { } + public: + spell_tharon_ja_curse_of_life() : SpellScriptLoader("spell_tharon_ja_curse_of_life") { } - class spell_tharon_ja_curse_of_life_AuraScript : public AuraScript - { - PrepareAuraScript(spell_tharon_ja_curse_of_life_AuraScript); + class spell_tharon_ja_curse_of_life_AuraScript : public AuraScript + { + PrepareAuraScript(spell_tharon_ja_curse_of_life_AuraScript); - void OnPeriodic(AuraEffect const* /*aurEff*/) - { - if (GetUnitOwner()->HealthBelowPct(50)) - { - PreventDefaultAction(); - SetDuration(0); - } - } + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (GetUnitOwner()->HealthBelowPct(50)) + { + PreventDefaultAction(); + SetDuration(0); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_tharon_ja_curse_of_life_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_tharon_ja_curse_of_life_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_tharon_ja_curse_of_life_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_tharon_ja_curse_of_life_AuraScript(); + } }; class spell_tharon_ja_dummy : public SpellScriptLoader { - public: - spell_tharon_ja_dummy() : SpellScriptLoader("spell_tharon_ja_dummy") { } + public: + spell_tharon_ja_dummy() : SpellScriptLoader("spell_tharon_ja_dummy") { } - class spell_tharon_ja_dummy_AuraScript : public AuraScript - { - PrepareAuraScript(spell_tharon_ja_dummy_AuraScript) + class spell_tharon_ja_dummy_AuraScript : public AuraScript + { + PrepareAuraScript(spell_tharon_ja_dummy_AuraScript) - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - PreventDefaultAction(); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FLESH_VISUAL, true); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_GIFT_OF_THARON_JA, true); - GetUnitOwner()->SetDisplayId(GetUnitOwner()->GetNativeDisplayId()+1); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + PreventDefaultAction(); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FLESH_VISUAL, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_GIFT_OF_THARON_JA, true); + GetUnitOwner()->SetDisplayId(GetUnitOwner()->GetNativeDisplayId()+1); + } - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - PreventDefaultAction(); - GetUnitOwner()->getThreatManager().resetAllAggro(); - GetUnitOwner()->GetMotionMaster()->Clear(); - GetUnitOwner()->CastSpell((Unit*)NULL, SPELL_TURN_BONES, false); - GetUnitOwner()->GetAI()->DoAction(ACTION_TURN_BONES); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + PreventDefaultAction(); + GetUnitOwner()->getThreatManager().resetAllAggro(); + GetUnitOwner()->GetMotionMaster()->Clear(); + GetUnitOwner()->CastSpell((Unit*)NULL, SPELL_TURN_BONES, false); + GetUnitOwner()->GetAI()->DoAction(ACTION_TURN_BONES); + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_tharon_ja_dummy_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_tharon_ja_dummy_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_tharon_ja_dummy_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_tharon_ja_dummy_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_tharon_ja_dummy_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_tharon_ja_dummy_AuraScript(); + } }; class spell_tharon_ja_clear_gift_of_tharon_ja : public SpellScriptLoader @@ -292,8 +292,8 @@ class spell_tharon_ja_clear_gift_of_tharon_ja : public SpellScriptLoader void AddSC_boss_tharon_ja() { - new boss_tharon_ja(); - new spell_tharon_ja_curse_of_life(); - new spell_tharon_ja_dummy(); - new spell_tharon_ja_clear_gift_of_tharon_ja(); + new boss_tharon_ja(); + new spell_tharon_ja_curse_of_life(); + new spell_tharon_ja_dummy(); + new spell_tharon_ja_clear_gift_of_tharon_ja(); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index 6932f51b4..8ecaf6dc2 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -18,143 +18,143 @@ enum Yells enum Spells { - SPELL_SUMMON_INVADER_A = 49456, - SPELL_SUMMON_INVADER_B = 49457, - SPELL_SUMMON_INVADER_C = 49458, + SPELL_SUMMON_INVADER_A = 49456, + SPELL_SUMMON_INVADER_B = 49457, + SPELL_SUMMON_INVADER_C = 49458, - SPELL_INFECTED_WOUND = 49637, - SPELL_CRUSH = 49639, - SPELL_CONSUME = 49380, - SPELL_CORPSE_EXPLODE = 49555, + SPELL_INFECTED_WOUND = 49637, + SPELL_CRUSH = 49639, + SPELL_CONSUME = 49380, + SPELL_CORPSE_EXPLODE = 49555, - SPELL_CORPSE_EXPLODE_DAMAGE = 49618, - SPELL_CONSUME_AURA = 49381, + SPELL_CORPSE_EXPLODE_DAMAGE = 49618, + SPELL_CONSUME_AURA = 49381, }; enum Events { - EVENT_SPELL_INFECTED_WOUND = 1, - EVENT_SPELL_CRUSH = 2, - EVENT_SPELL_CONSUME = 3, - EVENT_SPELL_CORPSE_EXPLODE = 4, - EVENT_SPAWN_INVADERS = 5, - EVENT_KILL_TALK = 6 + EVENT_SPELL_INFECTED_WOUND = 1, + EVENT_SPELL_CRUSH = 2, + EVENT_SPELL_CONSUME = 3, + EVENT_SPELL_CORPSE_EXPLODE = 4, + EVENT_SPAWN_INVADERS = 5, + EVENT_KILL_TALK = 6 }; class boss_trollgore : public CreatureScript { - public: - boss_trollgore() : CreatureScript("boss_trollgore") { } + public: + boss_trollgore() : CreatureScript("boss_trollgore") { } - struct boss_trollgoreAI : public BossAI - { - boss_trollgoreAI(Creature* creature) : BossAI(creature, DATA_TROLLGORE) - { - } + struct boss_trollgoreAI : public BossAI + { + boss_trollgoreAI(Creature* creature) : BossAI(creature, DATA_TROLLGORE) + { + } - void Reset() - { - BossAI::Reset(); - events2.Reset(); - events2.ScheduleEvent(EVENT_SPAWN_INVADERS, 30000); - } + void Reset() + { + BossAI::Reset(); + events2.Reset(); + events2.ScheduleEvent(EVENT_SPAWN_INVADERS, 30000); + } - void EnterCombat(Unit* who) - { - events.ScheduleEvent(EVENT_SPELL_INFECTED_WOUND, urand(6000,10000)); - events.ScheduleEvent(EVENT_SPELL_CRUSH, urand(3000,5000)); - events.ScheduleEvent(EVENT_SPELL_CONSUME, 15000); - events.ScheduleEvent(EVENT_SPELL_CORPSE_EXPLODE, 35000); - events.ScheduleEvent(EVENT_SPAWN_INVADERS, 20000, 30000); - - me->setActive(true); - instance->SetBossState(DATA_TROLLGORE, IN_PROGRESS); - if (who->GetTypeId() == TYPEID_PLAYER) - { - Talk(SAY_AGGRO); - me->SetInCombatWithZone(); - } - } + void EnterCombat(Unit* who) + { + events.ScheduleEvent(EVENT_SPELL_INFECTED_WOUND, urand(6000,10000)); + events.ScheduleEvent(EVENT_SPELL_CRUSH, urand(3000,5000)); + events.ScheduleEvent(EVENT_SPELL_CONSUME, 15000); + events.ScheduleEvent(EVENT_SPELL_CORPSE_EXPLODE, 35000); + events.ScheduleEvent(EVENT_SPAWN_INVADERS, 20000, 30000); + + me->setActive(true); + instance->SetBossState(DATA_TROLLGORE, IN_PROGRESS); + if (who->GetTypeId() == TYPEID_PLAYER) + { + Talk(SAY_AGGRO); + me->SetInCombatWithZone(); + } + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + } - void KilledUnit(Unit* victim) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* victim) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void UpdateAI(uint32 diff) - { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_SPAWN_INVADERS: - me->CastSpell(me, SPELL_SUMMON_INVADER_A, true); - me->CastSpell(me, SPELL_SUMMON_INVADER_B, true); - me->CastSpell(me, SPELL_SUMMON_INVADER_C, true); - events2.ScheduleEvent(EVENT_SPAWN_INVADERS, 30000); - break; - } + void UpdateAI(uint32 diff) + { + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_SPAWN_INVADERS: + me->CastSpell(me, SPELL_SUMMON_INVADER_A, true); + me->CastSpell(me, SPELL_SUMMON_INVADER_B, true); + me->CastSpell(me, SPELL_SUMMON_INVADER_C, true); + events2.ScheduleEvent(EVENT_SPAWN_INVADERS, 30000); + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.ExecuteEvent()) - { - case EVENT_SPELL_INFECTED_WOUND: - me->CastSpell(me->GetVictim(), SPELL_INFECTED_WOUND, false); - events.ScheduleEvent(EVENT_SPELL_INFECTED_WOUND, urand(25000,35000)); - break; - case EVENT_SPELL_CRUSH: - me->CastSpell(me->GetVictim(), SPELL_CRUSH, false); - events.ScheduleEvent(EVENT_SPELL_CRUSH, urand(10000,15000)); - break; - case EVENT_SPELL_CONSUME: - Talk(SAY_CONSUME); - me->CastSpell(me, SPELL_CONSUME, false); - events.ScheduleEvent(EVENT_SPELL_CONSUME, 15000); - break; - case EVENT_SPELL_CORPSE_EXPLODE: - Talk(SAY_EXPLODE); - me->CastSpell(me, SPELL_CORPSE_EXPLODE, false); - events.ScheduleEvent(EVENT_SPELL_CORPSE_EXPLODE, urand(15000,19000)); - break; - } + switch(events.ExecuteEvent()) + { + case EVENT_SPELL_INFECTED_WOUND: + me->CastSpell(me->GetVictim(), SPELL_INFECTED_WOUND, false); + events.ScheduleEvent(EVENT_SPELL_INFECTED_WOUND, urand(25000,35000)); + break; + case EVENT_SPELL_CRUSH: + me->CastSpell(me->GetVictim(), SPELL_CRUSH, false); + events.ScheduleEvent(EVENT_SPELL_CRUSH, urand(10000,15000)); + break; + case EVENT_SPELL_CONSUME: + Talk(SAY_CONSUME); + me->CastSpell(me, SPELL_CONSUME, false); + events.ScheduleEvent(EVENT_SPELL_CONSUME, 15000); + break; + case EVENT_SPELL_CORPSE_EXPLODE: + Talk(SAY_EXPLODE); + me->CastSpell(me, SPELL_CORPSE_EXPLODE, false); + events.ScheduleEvent(EVENT_SPELL_CORPSE_EXPLODE, urand(15000,19000)); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(); } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetHomePosition().GetExactDist2d(me) > 60.0f; - } + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetHomePosition().GetExactDist2d(me) > 60.0f; + } - private: - EventMap events2; - }; + private: + EventMap events2; + }; - CreatureAI *GetAI(Creature *creature) const - { - return GetInstanceAI(creature); - } + CreatureAI *GetAI(Creature *creature) const + { + return GetInstanceAI(creature); + } }; class spell_trollgore_consume : public SpellScriptLoader @@ -264,9 +264,9 @@ class achievement_consumption_junction : public AchievementCriteriaScript void AddSC_boss_trollgore() { - new boss_trollgore(); - new spell_trollgore_consume(); - new spell_trollgore_corpse_explode(); - new spell_trollgore_invader_taunt(); - new achievement_consumption_junction(); + new boss_trollgore(); + new spell_trollgore_consume(); + new spell_trollgore_corpse_explode(); + new spell_trollgore_invader_taunt(); + new achievement_consumption_junction(); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h b/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h index 881a82471..966212020 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h +++ b/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h @@ -7,33 +7,33 @@ REWRITTEN BY XINEF enum Data { - DATA_TROLLGORE = 0, - DATA_NOVOS = 1, - DATA_NOVOS_CRYSTALS = 2, - DATA_DRED = 3, - DATA_THARON_JA = 4, - MAX_ENCOUNTERS = 5 + DATA_TROLLGORE = 0, + DATA_NOVOS = 1, + DATA_NOVOS_CRYSTALS = 2, + DATA_DRED = 3, + DATA_THARON_JA = 4, + MAX_ENCOUNTERS = 5 }; enum Creatures { - NPC_KURZEL = 26664, - NPC_DRAKKARI_GUARDIAN = 26620, - NPC_RISEN_DRAKKARI_WARRIOR = 26635, + NPC_KURZEL = 26664, + NPC_DRAKKARI_GUARDIAN = 26620, + NPC_RISEN_DRAKKARI_WARRIOR = 26635, }; enum GameObjects { - GO_NOVOS_CRYSTAL_1 = 189299, - GO_NOVOS_CRYSTAL_2 = 189300, - GO_NOVOS_CRYSTAL_3 = 189301, - GO_NOVOS_CRYSTAL_4 = 189302, + GO_NOVOS_CRYSTAL_1 = 189299, + GO_NOVOS_CRYSTAL_2 = 189300, + GO_NOVOS_CRYSTAL_3 = 189301, + GO_NOVOS_CRYSTAL_4 = 189302, }; enum DTKSpells { - SPELL_SUMMON_DRAKKARI_SHAMAN = 49958, - SPELL_SUMMON_DRAKKARI_GUARDIAN = 49959 + SPELL_SUMMON_DRAKKARI_SHAMAN = 49958, + SPELL_SUMMON_DRAKKARI_GUARDIAN = 49959 }; #endif diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index f34911c71..4f3d18702 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -8,117 +8,117 @@ REWRITTEN BY XINEF DoorData const doorData[] = { - { GO_NOVOS_CRYSTAL_1, DATA_NOVOS_CRYSTALS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - { GO_NOVOS_CRYSTAL_2, DATA_NOVOS_CRYSTALS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - { GO_NOVOS_CRYSTAL_3, DATA_NOVOS_CRYSTALS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - { GO_NOVOS_CRYSTAL_4, DATA_NOVOS_CRYSTALS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } + { GO_NOVOS_CRYSTAL_1, DATA_NOVOS_CRYSTALS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_NOVOS_CRYSTAL_2, DATA_NOVOS_CRYSTALS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_NOVOS_CRYSTAL_3, DATA_NOVOS_CRYSTALS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_NOVOS_CRYSTAL_4, DATA_NOVOS_CRYSTALS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } }; class instance_drak_tharon_keep : public InstanceMapScript { - public: - instance_drak_tharon_keep() : InstanceMapScript("instance_drak_tharon_keep", 600) { } + public: + instance_drak_tharon_keep() : InstanceMapScript("instance_drak_tharon_keep", 600) { } - struct instance_drak_tharon_keep_InstanceScript : public InstanceScript - { - instance_drak_tharon_keep_InstanceScript(Map* map) : InstanceScript(map) - { - SetBossNumber(MAX_ENCOUNTERS); - LoadDoorData(doorData); - } - - void OnGameObjectCreate(GameObject* go) - { - switch (go->GetEntry()) - { - case GO_NOVOS_CRYSTAL_1: - case GO_NOVOS_CRYSTAL_2: - case GO_NOVOS_CRYSTAL_3: - case GO_NOVOS_CRYSTAL_4: + struct instance_drak_tharon_keep_InstanceScript : public InstanceScript + { + instance_drak_tharon_keep_InstanceScript(Map* map) : InstanceScript(map) + { + SetBossNumber(MAX_ENCOUNTERS); + LoadDoorData(doorData); + } + + void OnGameObjectCreate(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_NOVOS_CRYSTAL_1: + case GO_NOVOS_CRYSTAL_2: + case GO_NOVOS_CRYSTAL_3: + case GO_NOVOS_CRYSTAL_4: AddDoor(go, true); - break; - } - } - - void OnGameObjectRemove(GameObject* go) - { - switch (go->GetEntry()) - { - case GO_NOVOS_CRYSTAL_1: - case GO_NOVOS_CRYSTAL_2: - case GO_NOVOS_CRYSTAL_3: - case GO_NOVOS_CRYSTAL_4: + break; + } + } + + void OnGameObjectRemove(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_NOVOS_CRYSTAL_1: + case GO_NOVOS_CRYSTAL_2: + case GO_NOVOS_CRYSTAL_3: + case GO_NOVOS_CRYSTAL_4: AddDoor(go, false); - break; - } - } + break; + } + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "D K " << GetBossSaveData(); - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "D K " << GetBossSaveData(); + return saveStream.str(); + } - void Load(const char* in) - { - if( !in ) - return; + void Load(const char* in) + { + if( !in ) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'D' && dataHead2 == 'K') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); - } - } - } - }; + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'D' && dataHead2 == 'K') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } + } + } + }; - InstanceScript* GetInstanceScript(InstanceMap *map) const - { - return new instance_drak_tharon_keep_InstanceScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap *map) const + { + return new instance_drak_tharon_keep_InstanceScript(map); + } }; class spell_dtk_raise_dead : public SpellScriptLoader { - public: - spell_dtk_raise_dead() : SpellScriptLoader("spell_dtk_raise_dead") { } + public: + spell_dtk_raise_dead() : SpellScriptLoader("spell_dtk_raise_dead") { } - class spell_dtk_raise_dead_AuraScript : public AuraScript - { - PrepareAuraScript(spell_dtk_raise_dead_AuraScript) + class spell_dtk_raise_dead_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dtk_raise_dead_AuraScript) - bool Load() - { - return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; + } - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->ToCreature()->DespawnOrUnsummon(1); - GetUnitOwner()->SummonCreature(NPC_RISEN_DRAKKARI_WARRIOR, *GetUnitOwner()); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->ToCreature()->DespawnOrUnsummon(1); + GetUnitOwner()->SummonCreature(NPC_RISEN_DRAKKARI_WARRIOR, *GetUnitOwner()); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_dtk_raise_dead_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_dtk_raise_dead_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_dtk_raise_dead_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_dtk_raise_dead_AuraScript(); + } }; class spell_dtk_summon_random_drakkari : public SpellScriptLoader @@ -149,7 +149,7 @@ class spell_dtk_summon_random_drakkari : public SpellScriptLoader void AddSC_instance_drak_tharon_keep() { - new instance_drak_tharon_keep(); - new spell_dtk_raise_dead(); - new spell_dtk_summon_random_drakkari(); + new instance_drak_tharon_keep(); + new spell_dtk_raise_dead(); + new spell_dtk_summon_random_drakkari(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index 67970ed71..9a3cbb086 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -20,374 +20,374 @@ enum Yells enum eSpells { - SPELL_SOULSTORM_CHANNEL_OOC = 69008, + SPELL_SOULSTORM_CHANNEL_OOC = 69008, - SPELL_SHADOW_BOLT = 70043, - SPELL_FEAR = 68950, - SPELL_MAGICS_BANE = 68793, - SPELL_CORRUPT_SOUL = 68839, - SPELL_CONSUME_SOUL = 68861, - //SPELL_CONSUME_SOUL_HEAL = 68858, + SPELL_SHADOW_BOLT = 70043, + SPELL_FEAR = 68950, + SPELL_MAGICS_BANE = 68793, + SPELL_CORRUPT_SOUL = 68839, + SPELL_CONSUME_SOUL = 68861, + //SPELL_CONSUME_SOUL_HEAL = 68858, - SPELL_TELEPORT = 68988, - SPELL_TELEPORT_VISUAL = 52096, + SPELL_TELEPORT = 68988, + SPELL_TELEPORT_VISUAL = 52096, - SPELL_SOULSTORM_VISUAL = 68870, - SPELL_SOULSTORM = 68872, + SPELL_SOULSTORM_VISUAL = 68870, + SPELL_SOULSTORM = 68872, }; enum eEvents { - EVENT_SPELL_SHADOW_BOLT = 1, - EVENT_SPELL_FEAR, - EVENT_SPELL_MAGICS_BANE, - EVENT_SPELL_CORRUPT_SOUL, - EVENT_START_SOULSTORM, + EVENT_SPELL_SHADOW_BOLT = 1, + EVENT_SPELL_FEAR, + EVENT_SPELL_MAGICS_BANE, + EVENT_SPELL_CORRUPT_SOUL, + EVENT_START_SOULSTORM, }; class boss_bronjahm : public CreatureScript { public: - boss_bronjahm() : CreatureScript("boss_bronjahm") { } + boss_bronjahm() : CreatureScript("boss_bronjahm") { } - struct boss_bronjahmAI : public ScriptedAI - { - boss_bronjahmAI(Creature* creature) : ScriptedAI(creature), summons(me) - { - pInstance = creature->GetInstanceScript(); - } + struct boss_bronjahmAI : public ScriptedAI + { + boss_bronjahmAI(Creature* creature) : ScriptedAI(creature), summons(me) + { + pInstance = creature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; + InstanceScript* pInstance; + EventMap events; + SummonList summons; - void JustReachedHome() - { - me->CastSpell(me, SPELL_SOULSTORM_CHANNEL_OOC, true); - } + void JustReachedHome() + { + me->CastSpell(me, SPELL_SOULSTORM_CHANNEL_OOC, true); + } - void Reset() - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->CastSpell(me, SPELL_SOULSTORM_CHANNEL_OOC, true); - events.Reset(); - summons.DespawnAll(); - if (pInstance) - pInstance->SetData(DATA_BRONJAHM, NOT_STARTED); - } + void Reset() + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->CastSpell(me, SPELL_SOULSTORM_CHANNEL_OOC, true); + events.Reset(); + summons.DespawnAll(); + if (pInstance) + pInstance->SetData(DATA_BRONJAHM, NOT_STARTED); + } - void EnterCombat(Unit* /*who*/) - { - Talk(SAY_AGGRO); - me->RemoveAurasDueToSpell(SPELL_SOULSTORM_CHANNEL_OOC); + void EnterCombat(Unit* /*who*/) + { + Talk(SAY_AGGRO); + me->RemoveAurasDueToSpell(SPELL_SOULSTORM_CHANNEL_OOC); - DoZoneInCombat(); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_SHADOW_BOLT, 2000); - events.RescheduleEvent(EVENT_SPELL_MAGICS_BANE, urand(5000, 10000)); - events.RescheduleEvent(EVENT_SPELL_CORRUPT_SOUL, urand(14000, 20000)); + DoZoneInCombat(); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_SHADOW_BOLT, 2000); + events.RescheduleEvent(EVENT_SPELL_MAGICS_BANE, urand(5000, 10000)); + events.RescheduleEvent(EVENT_SPELL_CORRUPT_SOUL, urand(14000, 20000)); - if (pInstance) - pInstance->SetData(DATA_BRONJAHM, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(DATA_BRONJAHM, IN_PROGRESS); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE) && me->HealthBelowPctDamaged(35, damage)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); - me->CastSpell(me, SPELL_TELEPORT, false); - events.CancelEvent(EVENT_SPELL_CORRUPT_SOUL); - events.DelayEvents(6000); - events.RescheduleEvent(EVENT_SPELL_FEAR, urand(8000, 14000)); - } - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE) && me->HealthBelowPctDamaged(35, damage)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + me->CastSpell(me, SPELL_TELEPORT, false); + events.CancelEvent(EVENT_SPELL_CORRUPT_SOUL); + events.DelayEvents(6000); + events.RescheduleEvent(EVENT_SPELL_FEAR, urand(8000, 14000)); + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (spell->Id == SPELL_TELEPORT) - { - me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); - events.RescheduleEvent(EVENT_START_SOULSTORM, 1); - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (spell->Id == SPELL_TELEPORT) + { + me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); + events.RescheduleEvent(EVENT_START_SOULSTORM, 1); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) - if (me->isAttackReady()) - me->SetFacingToObject(me->GetVictim()); + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) + if (me->isAttackReady()) + me->SetFacingToObject(me->GetVictim()); - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_SHADOW_BOLT: - if (!me->IsWithinMeleeRange(me->GetVictim())) - me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); - events.RepeatEvent(2000); - break; - case EVENT_SPELL_FEAR: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true)) - me->CastCustomSpell(SPELL_FEAR, SPELLVALUE_MAX_TARGETS, 1, target, false); - events.RepeatEvent(urand(8000, 12000)); - break; - case EVENT_SPELL_MAGICS_BANE: - me->CastSpell(me->GetVictim(), SPELL_MAGICS_BANE, false); - events.RepeatEvent(urand(10000, 15000)); - break; - case EVENT_SPELL_CORRUPT_SOUL: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - { - Talk(SAY_CORRUPT_SOUL); - me->CastSpell(target, SPELL_CORRUPT_SOUL, false); - } - events.RepeatEvent(urand(20000, 25000)); - break; - case EVENT_START_SOULSTORM: - Talk(SAY_SOUL_STORM); - me->CastSpell(me, SPELL_SOULSTORM, false); - me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); - me->CastSpell(me, SPELL_SOULSTORM_VISUAL, true); - events.PopEvent(); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_SHADOW_BOLT: + if (!me->IsWithinMeleeRange(me->GetVictim())) + me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); + events.RepeatEvent(2000); + break; + case EVENT_SPELL_FEAR: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true)) + me->CastCustomSpell(SPELL_FEAR, SPELLVALUE_MAX_TARGETS, 1, target, false); + events.RepeatEvent(urand(8000, 12000)); + break; + case EVENT_SPELL_MAGICS_BANE: + me->CastSpell(me->GetVictim(), SPELL_MAGICS_BANE, false); + events.RepeatEvent(urand(10000, 15000)); + break; + case EVENT_SPELL_CORRUPT_SOUL: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + { + Talk(SAY_CORRUPT_SOUL); + me->CastSpell(target, SPELL_CORRUPT_SOUL, false); + } + events.RepeatEvent(urand(20000, 25000)); + break; + case EVENT_START_SOULSTORM: + Talk(SAY_SOUL_STORM); + me->CastSpell(me, SPELL_SOULSTORM, false); + me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); + me->CastSpell(me, SPELL_SOULSTORM_VISUAL, true); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_BRONJAHM, DONE); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(DATA_BRONJAHM, DONE); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->SetReactState(REACT_PASSIVE); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->SetReactState(REACT_PASSIVE); + } - void EnterEvadeMode() - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - ScriptedAI::EnterEvadeMode(); - } - }; + void EnterEvadeMode() + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + ScriptedAI::EnterEvadeMode(); + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new boss_bronjahmAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new boss_bronjahmAI(creature); + } }; class npc_fos_corrupted_soul_fragment : public CreatureScript { public: - npc_fos_corrupted_soul_fragment() : CreatureScript("npc_fos_corrupted_soul_fragment") { } + npc_fos_corrupted_soul_fragment() : CreatureScript("npc_fos_corrupted_soul_fragment") { } - struct npc_fos_corrupted_soul_fragmentAI : public NullCreatureAI - { - npc_fos_corrupted_soul_fragmentAI(Creature* creature) : NullCreatureAI(creature) - { - pInstance = me->GetInstanceScript(); - } + struct npc_fos_corrupted_soul_fragmentAI : public NullCreatureAI + { + npc_fos_corrupted_soul_fragmentAI(Creature* creature) : NullCreatureAI(creature) + { + pInstance = me->GetInstanceScript(); + } - uint32 timer; - InstanceScript* pInstance; + uint32 timer; + InstanceScript* pInstance; - void Reset() - { - timer = 0; - } + void Reset() + { + timer = 0; + } - void UpdateAI(uint32 diff) - { - if (pInstance) - if (Creature* b = pInstance->instance->GetCreature(pInstance->GetData64(DATA_BRONJAHM))) - { - if (me->GetExactDist2d(b) <= 2.0f) - { - me->GetMotionMaster()->MoveIdle(); - me->CastSpell(b, SPELL_CONSUME_SOUL, true); - me->DespawnOrUnsummon(1); - return; - } + void UpdateAI(uint32 diff) + { + if (pInstance) + if (Creature* b = pInstance->instance->GetCreature(pInstance->GetData64(DATA_BRONJAHM))) + { + if (me->GetExactDist2d(b) <= 2.0f) + { + me->GetMotionMaster()->MoveIdle(); + me->CastSpell(b, SPELL_CONSUME_SOUL, true); + me->DespawnOrUnsummon(1); + return; + } - if (timer <= diff) - { - if (!me->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) - me->GetMotionMaster()->MovePoint(0, *b); - timer = 1000; - } - else - timer -= diff; - } - - } - }; + if (timer <= diff) + { + if (!me->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) + me->GetMotionMaster()->MovePoint(0, *b); + timer = 1000; + } + else + timer -= diff; + } + + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_fos_corrupted_soul_fragmentAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_fos_corrupted_soul_fragmentAI(creature); + } }; class spell_bronjahm_magic_bane : public SpellScriptLoader { public: - spell_bronjahm_magic_bane() : SpellScriptLoader("spell_bronjahm_magic_bane") { } + spell_bronjahm_magic_bane() : SpellScriptLoader("spell_bronjahm_magic_bane") { } - class spell_bronjahm_magic_bane_SpellScript : public SpellScript - { - PrepareSpellScript(spell_bronjahm_magic_bane_SpellScript); + class spell_bronjahm_magic_bane_SpellScript : public SpellScript + { + PrepareSpellScript(spell_bronjahm_magic_bane_SpellScript); - void RecalculateDamage() - { - if (GetHitUnit()->getPowerType() != POWER_MANA) - return; + void RecalculateDamage() + { + if (GetHitUnit()->getPowerType() != POWER_MANA) + return; - if (Unit* caster = GetCaster()) - { - const int32 maxDamage = caster->GetMap()->GetSpawnMode() == 1 ? 15000 : 10000; - int32 newDamage = GetHitDamage(); - newDamage += GetHitUnit()->GetMaxPower(POWER_MANA)/2; - newDamage = std::min(maxDamage, newDamage); + if (Unit* caster = GetCaster()) + { + const int32 maxDamage = caster->GetMap()->GetSpawnMode() == 1 ? 15000 : 10000; + int32 newDamage = GetHitDamage(); + newDamage += GetHitUnit()->GetMaxPower(POWER_MANA)/2; + newDamage = std::min(maxDamage, newDamage); - SetHitDamage(newDamage); - } - } + SetHitDamage(newDamage); + } + } - void Register() - { - OnHit += SpellHitFn(spell_bronjahm_magic_bane_SpellScript::RecalculateDamage); - } - }; + void Register() + { + OnHit += SpellHitFn(spell_bronjahm_magic_bane_SpellScript::RecalculateDamage); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_bronjahm_magic_bane_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_bronjahm_magic_bane_SpellScript(); + } }; class spell_bronjahm_soulstorm_channel_ooc : public SpellScriptLoader { public: - spell_bronjahm_soulstorm_channel_ooc() : SpellScriptLoader("spell_bronjahm_soulstorm_channel_ooc") { } + spell_bronjahm_soulstorm_channel_ooc() : SpellScriptLoader("spell_bronjahm_soulstorm_channel_ooc") { } - class spell_bronjahm_soulstorm_channel_ooc_AuraScript : public AuraScript - { - PrepareAuraScript(spell_bronjahm_soulstorm_channel_ooc_AuraScript); + class spell_bronjahm_soulstorm_channel_ooc_AuraScript : public AuraScript + { + PrepareAuraScript(spell_bronjahm_soulstorm_channel_ooc_AuraScript); - void HandlePeriodicTick(AuraEffect const* aurEff) - { - PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), 68904+(aurEff->GetTickNumber()%4), true); - } + void HandlePeriodicTick(AuraEffect const* aurEff) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), 68904+(aurEff->GetTickNumber()%4), true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_channel_ooc_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_channel_ooc_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_bronjahm_soulstorm_channel_ooc_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_bronjahm_soulstorm_channel_ooc_AuraScript(); + } }; class spell_bronjahm_soulstorm_visual : public SpellScriptLoader { public: - spell_bronjahm_soulstorm_visual() : SpellScriptLoader("spell_bronjahm_soulstorm_visual") { } + spell_bronjahm_soulstorm_visual() : SpellScriptLoader("spell_bronjahm_soulstorm_visual") { } - class spell_bronjahm_soulstorm_visual_AuraScript : public AuraScript - { - PrepareAuraScript(spell_bronjahm_soulstorm_visual_AuraScript); + class spell_bronjahm_soulstorm_visual_AuraScript : public AuraScript + { + PrepareAuraScript(spell_bronjahm_soulstorm_visual_AuraScript); - void HandlePeriodicTick(AuraEffect const* aurEff) - { - PreventDefaultAction(); - uint32 spellId = 0; - switch (aurEff->GetTickNumber()%4) - { - case 0: spellId = 68886; break; - case 1: spellId = 68896; break; - case 2: spellId = 68897; break; - case 3: spellId = 68898; break; - } - GetTarget()->CastSpell(GetTarget(), spellId, true); - } + void HandlePeriodicTick(AuraEffect const* aurEff) + { + PreventDefaultAction(); + uint32 spellId = 0; + switch (aurEff->GetTickNumber()%4) + { + case 0: spellId = 68886; break; + case 1: spellId = 68896; break; + case 2: spellId = 68897; break; + case 3: spellId = 68898; break; + } + GetTarget()->CastSpell(GetTarget(), spellId, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_visual_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_bronjahm_soulstorm_visual_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_bronjahm_soulstorm_visual_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_bronjahm_soulstorm_visual_AuraScript(); + } }; class spell_bronjahm_soulstorm_targeting : public SpellScriptLoader { public: - spell_bronjahm_soulstorm_targeting() : SpellScriptLoader("spell_bronjahm_soulstorm_targeting") { } + spell_bronjahm_soulstorm_targeting() : SpellScriptLoader("spell_bronjahm_soulstorm_targeting") { } - class spell_bronjahm_soulstorm_targeting_SpellScript : public SpellScript - { - PrepareSpellScript(spell_bronjahm_soulstorm_targeting_SpellScript); + class spell_bronjahm_soulstorm_targeting_SpellScript : public SpellScript + { + PrepareSpellScript(spell_bronjahm_soulstorm_targeting_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 10.0f, false)); - } + void FilterTargets(std::list& targets) + { + targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 10.0f, false)); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_bronjahm_soulstorm_targeting_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_bronjahm_soulstorm_targeting_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_bronjahm_soulstorm_targeting_SpellScript(); + } }; void AddSC_boss_bronjahm() { - new boss_bronjahm(); - new npc_fos_corrupted_soul_fragment(); + new boss_bronjahm(); + new npc_fos_corrupted_soul_fragment(); - new spell_bronjahm_magic_bane(); - new spell_bronjahm_soulstorm_channel_ooc(); - new spell_bronjahm_soulstorm_visual(); - new spell_bronjahm_soulstorm_targeting(); + new spell_bronjahm_magic_bane(); + new spell_bronjahm_soulstorm_channel_ooc(); + new spell_bronjahm_soulstorm_visual(); + new spell_bronjahm_soulstorm_targeting(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index ba7d39b13..1e6374a8b 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -12,7 +12,7 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum eTexts { - SAY_FACE_AGGRO = 0, + SAY_FACE_AGGRO = 0, SAY_FACE_ANGER_SLAY = 1, SAY_FACE_SORROW_SLAY = 2, SAY_FACE_DESIRE_SLAY = 3, @@ -26,342 +26,342 @@ enum eTexts enum eSpells { - SPELL_PHANTOM_BLAST = 68982, - SPELL_PHANTOM_BLAST_H = 70322, - SPELL_MIRRORED_SOUL = 69051, - SPELL_WELL_OF_SOULS = 68820, - //SPELL_WELL_OF_SOULS_SUMMON = 68853, - //SPELL_WELL_OF_SOULS_PERIODIC = 68854, - SPELL_UNLEASHED_SOULS = 68939, + SPELL_PHANTOM_BLAST = 68982, + SPELL_PHANTOM_BLAST_H = 70322, + SPELL_MIRRORED_SOUL = 69051, + SPELL_WELL_OF_SOULS = 68820, + //SPELL_WELL_OF_SOULS_SUMMON = 68853, + //SPELL_WELL_OF_SOULS_PERIODIC = 68854, + SPELL_UNLEASHED_SOULS = 68939, - SPELL_WAILING_SOULS = 68899, // target 1.0,1.0, change model, triggers 68871, cast time 3 secs - SPELL_WAILING_SOULS_SCRIPT_EFFECT = 68871, // target 1.0, script effect, instant - SPELL_WAILING_SOULS_PERIODIC_DUMMY = 68875, // target 1.0, aura 226, instant - SPELL_WAILING_SOULS_PERIODIC_DUMMY_2= 68876, // target 1.0, aura 226, instant - SPELL_WAILING_SOULS_TARGETING = 68912, // target 22.15, aura dummy, 50000yd, cast instant, duration 4 secs - SPELL_WAILING_SOULS_DMG_N = 68873, // 100yd, 104.0 - SPELL_WAILING_SOULS_DMG_H = 70324, // 100yd, 104.0 + SPELL_WAILING_SOULS = 68899, // target 1.0,1.0, change model, triggers 68871, cast time 3 secs + SPELL_WAILING_SOULS_SCRIPT_EFFECT = 68871, // target 1.0, script effect, instant + SPELL_WAILING_SOULS_PERIODIC_DUMMY = 68875, // target 1.0, aura 226, instant + SPELL_WAILING_SOULS_PERIODIC_DUMMY_2= 68876, // target 1.0, aura 226, instant + SPELL_WAILING_SOULS_TARGETING = 68912, // target 22.15, aura dummy, 50000yd, cast instant, duration 4 secs + SPELL_WAILING_SOULS_DMG_N = 68873, // 100yd, 104.0 + SPELL_WAILING_SOULS_DMG_H = 70324, // 100yd, 104.0 }; enum eEvents { - EVENT_SPELL_PHANTOM_BLAST = 1, - EVENT_SPELL_MIRRORED_SOUL, - EVENT_SPELL_WELL_OF_SOULS, - EVENT_SPELL_UNLEASHED_SOULS, - EVENT_SPELL_WAILING_SOULS, + EVENT_SPELL_PHANTOM_BLAST = 1, + EVENT_SPELL_MIRRORED_SOUL, + EVENT_SPELL_WELL_OF_SOULS, + EVENT_SPELL_UNLEASHED_SOULS, + EVENT_SPELL_WAILING_SOULS, }; enum eDisplayIds { - DISPLAY_ANGER = 30148, - DISPLAY_SORROW = 30149, - DISPLAY_DESIRE = 30150, + DISPLAY_ANGER = 30148, + DISPLAY_SORROW = 30149, + DISPLAY_DESIRE = 30150, }; enum eMisc { - NPC_CRUCIBLE_OF_SOULS = 37094, - QUEST_TEMPERING_THE_BLADE_A = 24476, - QUEST_TEMPERING_THE_BLADE_H = 24560, + NPC_CRUCIBLE_OF_SOULS = 37094, + QUEST_TEMPERING_THE_BLADE_A = 24476, + QUEST_TEMPERING_THE_BLADE_H = 24560, }; class boss_devourer_of_souls : public CreatureScript { public: - boss_devourer_of_souls() : CreatureScript("boss_devourer_of_souls") { } + boss_devourer_of_souls() : CreatureScript("boss_devourer_of_souls") { } - struct boss_devourer_of_soulsAI : public ScriptedAI - { - boss_devourer_of_soulsAI(Creature* creature) : ScriptedAI(creature), summons(me) - { - pInstance = creature->GetInstanceScript(); - } + struct boss_devourer_of_soulsAI : public ScriptedAI + { + boss_devourer_of_soulsAI(Creature* creature) : ScriptedAI(creature), summons(me) + { + pInstance = creature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - bool bAchiev; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + bool bAchiev; - void Reset() - { - bAchiev = true; - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - me->SetReactState(REACT_AGGRESSIVE); - events.Reset(); - summons.DespawnAll(); - if (pInstance) - pInstance->SetData(DATA_DEVOURER, NOT_STARTED); - } + void Reset() + { + bAchiev = true; + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + me->SetReactState(REACT_AGGRESSIVE); + events.Reset(); + summons.DespawnAll(); + if (pInstance) + pInstance->SetData(DATA_DEVOURER, NOT_STARTED); + } - uint32 GetData(uint32 id) const - { - if (id == 1) - return bAchiev; + uint32 GetData(uint32 id) const + { + if (id == 1) + return bAchiev; - return 0; - } + return 0; + } - void EnterCombat(Unit* /*who*/) - { - Talk(SAY_FACE_AGGRO); - DoZoneInCombat(); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_PHANTOM_BLAST, 5000); - events.RescheduleEvent(EVENT_SPELL_MIRRORED_SOUL, 9000); - events.RescheduleEvent(EVENT_SPELL_WELL_OF_SOULS, urand(6000,8000)); - events.RescheduleEvent(EVENT_SPELL_UNLEASHED_SOULS, urand(18000,20000)); - events.RescheduleEvent(EVENT_SPELL_WAILING_SOULS, 65000); + void EnterCombat(Unit* /*who*/) + { + Talk(SAY_FACE_AGGRO); + DoZoneInCombat(); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_PHANTOM_BLAST, 5000); + events.RescheduleEvent(EVENT_SPELL_MIRRORED_SOUL, 9000); + events.RescheduleEvent(EVENT_SPELL_WELL_OF_SOULS, urand(6000,8000)); + events.RescheduleEvent(EVENT_SPELL_UNLEASHED_SOULS, urand(18000,20000)); + events.RescheduleEvent(EVENT_SPELL_WAILING_SOULS, 65000); - if (pInstance) - pInstance->SetData(DATA_DEVOURER, IN_PROGRESS); + if (pInstance) + pInstance->SetData(DATA_DEVOURER, IN_PROGRESS); - // Suport for Quest Tempering the Blade - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - Player* player = itr->GetSource(); - if ((player->GetTeamId() == TEAM_ALLIANCE && player->GetQuestStatus(QUEST_TEMPERING_THE_BLADE_A) == QUEST_STATUS_INCOMPLETE) || - (player->GetTeamId() == TEAM_HORDE && player->GetQuestStatus(QUEST_TEMPERING_THE_BLADE_H) == QUEST_STATUS_INCOMPLETE)) - { - if (!me->FindNearestCreature(NPC_CRUCIBLE_OF_SOULS, 100.0f)) - me->SummonCreature(NPC_CRUCIBLE_OF_SOULS, 5672.29f, 2520.69f, 713.44f, 0.96f); - } - } - } + // Suport for Quest Tempering the Blade + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + Player* player = itr->GetSource(); + if ((player->GetTeamId() == TEAM_ALLIANCE && player->GetQuestStatus(QUEST_TEMPERING_THE_BLADE_A) == QUEST_STATUS_INCOMPLETE) || + (player->GetTeamId() == TEAM_HORDE && player->GetQuestStatus(QUEST_TEMPERING_THE_BLADE_H) == QUEST_STATUS_INCOMPLETE)) + { + if (!me->FindNearestCreature(NPC_CRUCIBLE_OF_SOULS, 100.0f)) + me->SummonCreature(NPC_CRUCIBLE_OF_SOULS, 5672.29f, 2520.69f, 713.44f, 0.96f); + } + } + } - void SpellHitTarget(Unit* target, const SpellInfo *spell) - { - if (spell->Id == SPELL_PHANTOM_BLAST_H) - bAchiev = false; - else if (spell->Id == SPELL_WAILING_SOULS_TARGETING) - { - me->SetOrientation(me->GetAngle(target)); - me->SetControlled(true, UNIT_STATE_ROOT); - me->DisableRotate(true); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - me->StopMovingOnCurrentPos(); + void SpellHitTarget(Unit* target, const SpellInfo *spell) + { + if (spell->Id == SPELL_PHANTOM_BLAST_H) + bAchiev = false; + else if (spell->Id == SPELL_WAILING_SOULS_TARGETING) + { + me->SetOrientation(me->GetAngle(target)); + me->SetControlled(true, UNIT_STATE_ROOT); + me->DisableRotate(true); + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + me->StopMovingOnCurrentPos(); - me->SetFacingToObject(target); - me->SendMovementFlagUpdate(); - me->CastSpell(me, SPELL_WAILING_SOULS, false); - } - } + me->SetFacingToObject(target); + me->SendMovementFlagUpdate(); + me->CastSpell(me, SPELL_WAILING_SOULS, false); + } + } - bool CanAIAttack(const Unit* target) const { return target->GetPositionZ() > 706.5f; } + bool CanAIAttack(const Unit* target) const { return target->GetPositionZ() > 706.5f; } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (Spell* s = me->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - if (s->m_spellInfo->Id == SPELL_MIRRORED_SOUL) - { - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_PHANTOM_BLAST: - me->CastSpell(me->GetVictim(), SPELL_PHANTOM_BLAST, false); - events.RepeatEvent(5000); - break; - default: - events.RepeatEvent(1000); - break; - } + if (Spell* s = me->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + if (s->m_spellInfo->Id == SPELL_MIRRORED_SOUL) + { + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_PHANTOM_BLAST: + me->CastSpell(me->GetVictim(), SPELL_PHANTOM_BLAST, false); + events.RepeatEvent(5000); + break; + default: + events.RepeatEvent(1000); + break; + } - if (!me->GetCurrentSpell(CURRENT_GENERIC_SPELL)) - { - me->ClearUnitState(UNIT_STATE_CASTING); - DoMeleeAttackIfReady(); - me->AddUnitState(UNIT_STATE_CASTING); - } + if (!me->GetCurrentSpell(CURRENT_GENERIC_SPELL)) + { + me->ClearUnitState(UNIT_STATE_CASTING); + DoMeleeAttackIfReady(); + me->AddUnitState(UNIT_STATE_CASTING); + } - return; - } + return; + } - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_PHANTOM_BLAST: - me->CastSpell(me->GetVictim(), SPELL_PHANTOM_BLAST, false); - events.RepeatEvent(5000); - break; - case EVENT_SPELL_MIRRORED_SOUL: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 90.0f, true)) - { - me->CastSpell(target, SPELL_MIRRORED_SOUL, false); - me->setAttackTimer(BASE_ATTACK, 2500); - Talk(EMOTE_MIRRORED_SOUL); - } - events.RepeatEvent(urand(20000,30000)); - break; - case EVENT_SPELL_WELL_OF_SOULS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) - me->CastSpell(target, SPELL_WELL_OF_SOULS, false); - events.RepeatEvent(urand(25000,30000)); - events.DelayEventsToMax(4000, 0); - break; - case EVENT_SPELL_UNLEASHED_SOULS: - me->CastSpell(me, SPELL_UNLEASHED_SOULS, false); - Talk(SAY_FACE_UNLEASH_SOUL); - Talk(EMOTE_UNLEASH_SOUL); - events.RepeatEvent(urand(30000,40000)); - events.DelayEventsToMax(5000, 0); - me->setAttackTimer(BASE_ATTACK, 5500); - break; - case EVENT_SPELL_WAILING_SOULS: - Talk(SAY_FACE_WAILING_SOUL); - Talk(EMOTE_WAILING_SOUL); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) - me->CastCustomSpell(SPELL_WAILING_SOULS_TARGETING, SPELLVALUE_MAX_TARGETS, 1, target, false); - events.RepeatEvent(80000); - events.DelayEventsToMax(20000, 0); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_PHANTOM_BLAST: + me->CastSpell(me->GetVictim(), SPELL_PHANTOM_BLAST, false); + events.RepeatEvent(5000); + break; + case EVENT_SPELL_MIRRORED_SOUL: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 90.0f, true)) + { + me->CastSpell(target, SPELL_MIRRORED_SOUL, false); + me->setAttackTimer(BASE_ATTACK, 2500); + Talk(EMOTE_MIRRORED_SOUL); + } + events.RepeatEvent(urand(20000,30000)); + break; + case EVENT_SPELL_WELL_OF_SOULS: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + me->CastSpell(target, SPELL_WELL_OF_SOULS, false); + events.RepeatEvent(urand(25000,30000)); + events.DelayEventsToMax(4000, 0); + break; + case EVENT_SPELL_UNLEASHED_SOULS: + me->CastSpell(me, SPELL_UNLEASHED_SOULS, false); + Talk(SAY_FACE_UNLEASH_SOUL); + Talk(EMOTE_UNLEASH_SOUL); + events.RepeatEvent(urand(30000,40000)); + events.DelayEventsToMax(5000, 0); + me->setAttackTimer(BASE_ATTACK, 5500); + break; + case EVENT_SPELL_WAILING_SOULS: + Talk(SAY_FACE_WAILING_SOUL); + Talk(EMOTE_WAILING_SOUL); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + me->CastCustomSpell(SPELL_WAILING_SOULS_TARGETING, SPELLVALUE_MAX_TARGETS, 1, target, false); + events.RepeatEvent(80000); + events.DelayEventsToMax(20000, 0); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_FACE_DEATH); - summons.DespawnAll(); - if (pInstance) - pInstance->SetData(DATA_DEVOURER, DONE); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_FACE_DEATH); + summons.DespawnAll(); + if (pInstance) + pInstance->SetData(DATA_DEVOURER, DONE); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; - int32 textId = 0; - switch (me->GetDisplayId()) - { - case DISPLAY_ANGER: - textId = SAY_FACE_ANGER_SLAY; - break; - case DISPLAY_SORROW: - textId = SAY_FACE_SORROW_SLAY; - break; - case DISPLAY_DESIRE: - textId = SAY_FACE_DESIRE_SLAY; - break; - default: - break; - } + int32 textId = 0; + switch (me->GetDisplayId()) + { + case DISPLAY_ANGER: + textId = SAY_FACE_ANGER_SLAY; + break; + case DISPLAY_SORROW: + textId = SAY_FACE_SORROW_SLAY; + break; + case DISPLAY_DESIRE: + textId = SAY_FACE_DESIRE_SLAY; + break; + default: + break; + } - if (textId) - Talk(textId); - } + if (textId) + Talk(textId); + } - void JustSummoned(Creature* summon) - { - if (summon->GetEntry() != NPC_CRUCIBLE_OF_SOULS) - summons.Summon(summon); + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() != NPC_CRUCIBLE_OF_SOULS) + summons.Summon(summon); - if (summon->GetEntry() == 36595) - if (Player* plr = summon->SelectNearestPlayer(100.0f)) - { - summon->AddThreat(plr, 100000.0f); - summon->AI()->AttackStart(plr); - } - } + if (summon->GetEntry() == 36595) + if (Player* plr = summon->SelectNearestPlayer(100.0f)) + { + summon->AddThreat(plr, 100000.0f); + summon->AI()->AttackStart(plr); + } + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - ScriptedAI::EnterEvadeMode(); - } - }; + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + ScriptedAI::EnterEvadeMode(); + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new boss_devourer_of_soulsAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new boss_devourer_of_soulsAI(creature); + } }; class spell_wailing_souls_periodic : public SpellScriptLoader { public: - spell_wailing_souls_periodic() : SpellScriptLoader("spell_wailing_souls_periodic") { } + spell_wailing_souls_periodic() : SpellScriptLoader("spell_wailing_souls_periodic") { } - class spell_wailing_souls_periodic_AuraScript : public AuraScript - { - PrepareAuraScript(spell_wailing_souls_periodic_AuraScript); + class spell_wailing_souls_periodic_AuraScript : public AuraScript + { + PrepareAuraScript(spell_wailing_souls_periodic_AuraScript); - int8 dir; + int8 dir; - bool Load() - { - dir = urand(0,1) ? 1 : -1; - return true; - } + bool Load() + { + dir = urand(0,1) ? 1 : -1; + return true; + } - void HandlePeriodicTick(AuraEffect const* aurEff) - { - PreventDefaultAction(); - if (Unit* t = GetTarget()) - { - if (aurEff->GetTickNumber() < 30) - { - // spinning, casting, etc. - float diff = (2*M_PI)/(4*30); - float new_o = t->GetOrientation() + diff*dir; - if (new_o >= 2*M_PI) - new_o -= 2*M_PI; - else if (new_o < 0) - new_o += 2*M_PI; - t->UpdateOrientation(new_o); - t->SetFacingTo(new_o); - t->CastSpell(t, SPELL_WAILING_SOULS_DMG_N, true); - } - else if (aurEff->GetTickNumber() == 33) - { - t->SetControlled(false, UNIT_STATE_ROOT); - t->DisableRotate(false); - if (t->GetTypeId() == TYPEID_UNIT) - t->ToCreature()->SetReactState(REACT_AGGRESSIVE); - if (t->GetVictim()) - { - t->SetUInt64Value(UNIT_FIELD_TARGET, t->GetVictim()->GetGUID()); - t->GetMotionMaster()->MoveChase(t->GetVictim()); - } - } - else if (aurEff->GetTickNumber() >= 34) - Remove(AURA_REMOVE_BY_EXPIRE); - } - } + void HandlePeriodicTick(AuraEffect const* aurEff) + { + PreventDefaultAction(); + if (Unit* t = GetTarget()) + { + if (aurEff->GetTickNumber() < 30) + { + // spinning, casting, etc. + float diff = (2*M_PI)/(4*30); + float new_o = t->GetOrientation() + diff*dir; + if (new_o >= 2*M_PI) + new_o -= 2*M_PI; + else if (new_o < 0) + new_o += 2*M_PI; + t->UpdateOrientation(new_o); + t->SetFacingTo(new_o); + t->CastSpell(t, SPELL_WAILING_SOULS_DMG_N, true); + } + else if (aurEff->GetTickNumber() == 33) + { + t->SetControlled(false, UNIT_STATE_ROOT); + t->DisableRotate(false); + if (t->GetTypeId() == TYPEID_UNIT) + t->ToCreature()->SetReactState(REACT_AGGRESSIVE); + if (t->GetVictim()) + { + t->SetUInt64Value(UNIT_FIELD_TARGET, t->GetVictim()->GetGUID()); + t->GetMotionMaster()->MoveChase(t->GetVictim()); + } + } + else if (aurEff->GetTickNumber() >= 34) + Remove(AURA_REMOVE_BY_EXPIRE); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_wailing_souls_periodic_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_wailing_souls_periodic_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_wailing_souls_periodic_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_wailing_souls_periodic_AuraScript(); + } }; void AddSC_boss_devourer_of_souls() { - new boss_devourer_of_souls(); - new spell_wailing_souls_periodic(); + new boss_devourer_of_souls(); + new spell_wailing_souls_periodic(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp index 4d046e315..4e866de08 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp @@ -27,262 +27,262 @@ enum Yells SAY_SYLVANAS_INTRO_5 = 4, SAY_SYLVANAS_INTRO_6 = 5, - SAY_JAINA_OUTRO = 0, - SAY_SYLVANAS_OUTRO = 0, + SAY_JAINA_OUTRO = 0, + SAY_SYLVANAS_OUTRO = 0, }; class npc_fos_leader : public CreatureScript { public: - npc_fos_leader() : CreatureScript("npc_fos_leader") { } + npc_fos_leader() : CreatureScript("npc_fos_leader") { } - struct npc_fos_leaderAI: public ScriptedAI - { - npc_fos_leaderAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_fos_leaderAI: public ScriptedAI + { + npc_fos_leaderAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void DoAction(int32 a) - { - if (a == 1) - if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - events.Reset(); - events.ScheduleEvent(1, 1000); - } - } + void DoAction(int32 a) + { + if (a == 1) + if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + events.Reset(); + events.ScheduleEvent(1, 1000); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch(events.GetEvent()) - { - case 0: - break; - case 1: - events.PopEvent(); - if (me->GetEntry() == NPC_JAINA_PART1) - { - Talk(SAY_JAINA_INTRO_1); - events.ScheduleEvent(2, 8000); - } - else - { - Talk(SAY_SYLVANAS_INTRO_1); - events.ScheduleEvent(2, 11500); - } - break; - case 2: - events.PopEvent(); - if (me->GetEntry() == NPC_JAINA_PART1) - { - Talk(SAY_JAINA_INTRO_2); - events.ScheduleEvent(3, 9000); - } - else - { - Talk(SAY_SYLVANAS_INTRO_2); - events.ScheduleEvent(3, 10500); - } - break; - case 3: - events.PopEvent(); - if (me->GetEntry() == NPC_JAINA_PART1) - { - Talk(SAY_JAINA_INTRO_3); - events.ScheduleEvent(4, 8000); - } - else - { - Talk(SAY_SYLVANAS_INTRO_3); - events.ScheduleEvent(4, 10500); - } - break; - case 4: - events.PopEvent(); - if (me->GetEntry() == NPC_JAINA_PART1) - { - Talk(SAY_JAINA_INTRO_4); - events.ScheduleEvent(5, 10000); - } - else - { - Talk(SAY_SYLVANAS_INTRO_4); - events.ScheduleEvent(5, 11000); - } - break; - case 5: - events.PopEvent(); - if (me->GetEntry() == NPC_JAINA_PART1) - { - Talk(SAY_JAINA_INTRO_5); - events.ScheduleEvent(6, 8000); - } - else - { - Talk(SAY_SYLVANAS_INTRO_5); - events.ScheduleEvent(6, 9500); - } - break; - case 6: - events.PopEvent(); - if (me->GetEntry() == NPC_JAINA_PART1) - { - Talk(SAY_JAINA_INTRO_6); - events.ScheduleEvent(7, 12000); - } - else - { - Talk(SAY_SYLVANAS_INTRO_6); - } - break; - case 7: - events.PopEvent(); - if (me->GetEntry() == NPC_JAINA_PART1) - { - Talk(SAY_JAINA_INTRO_7); - events.ScheduleEvent(8, 8000); - } - break; - case 8: - events.PopEvent(); - if (me->GetEntry() == NPC_JAINA_PART1) - { - Talk(SAY_JAINA_INTRO_8); - } - break; - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch(events.GetEvent()) + { + case 0: + break; + case 1: + events.PopEvent(); + if (me->GetEntry() == NPC_JAINA_PART1) + { + Talk(SAY_JAINA_INTRO_1); + events.ScheduleEvent(2, 8000); + } + else + { + Talk(SAY_SYLVANAS_INTRO_1); + events.ScheduleEvent(2, 11500); + } + break; + case 2: + events.PopEvent(); + if (me->GetEntry() == NPC_JAINA_PART1) + { + Talk(SAY_JAINA_INTRO_2); + events.ScheduleEvent(3, 9000); + } + else + { + Talk(SAY_SYLVANAS_INTRO_2); + events.ScheduleEvent(3, 10500); + } + break; + case 3: + events.PopEvent(); + if (me->GetEntry() == NPC_JAINA_PART1) + { + Talk(SAY_JAINA_INTRO_3); + events.ScheduleEvent(4, 8000); + } + else + { + Talk(SAY_SYLVANAS_INTRO_3); + events.ScheduleEvent(4, 10500); + } + break; + case 4: + events.PopEvent(); + if (me->GetEntry() == NPC_JAINA_PART1) + { + Talk(SAY_JAINA_INTRO_4); + events.ScheduleEvent(5, 10000); + } + else + { + Talk(SAY_SYLVANAS_INTRO_4); + events.ScheduleEvent(5, 11000); + } + break; + case 5: + events.PopEvent(); + if (me->GetEntry() == NPC_JAINA_PART1) + { + Talk(SAY_JAINA_INTRO_5); + events.ScheduleEvent(6, 8000); + } + else + { + Talk(SAY_SYLVANAS_INTRO_5); + events.ScheduleEvent(6, 9500); + } + break; + case 6: + events.PopEvent(); + if (me->GetEntry() == NPC_JAINA_PART1) + { + Talk(SAY_JAINA_INTRO_6); + events.ScheduleEvent(7, 12000); + } + else + { + Talk(SAY_SYLVANAS_INTRO_6); + } + break; + case 7: + events.PopEvent(); + if (me->GetEntry() == NPC_JAINA_PART1) + { + Talk(SAY_JAINA_INTRO_7); + events.ScheduleEvent(8, 8000); + } + break; + case 8: + events.PopEvent(); + if (me->GetEntry() == NPC_JAINA_PART1) + { + Talk(SAY_JAINA_INTRO_8); + } + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + bool OnGossipHello(Player* player, Creature* creature) + { + if (creature->IsQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); - if (creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - { - if (creature->GetEntry() == NPC_JAINA_PART1) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What would you have of me, my lady?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - else - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What would you have of me, Banshee Queen?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - } + if (creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + { + if (creature->GetEntry() == NPC_JAINA_PART1) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What would you have of me, my lady?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + else + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What would you have of me, Banshee Queen?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + } - player->SEND_GOSSIP_MENU(15207, creature->GetGUID()); - return true; - } + player->SEND_GOSSIP_MENU(15207, creature->GetGUID()); + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->PlayerTalkClass->ClearMenus(); - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->CLOSE_GOSSIP_MENU(); - if (creature->AI()) - creature->AI()->DoAction(1); - break; - } + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + { + player->PlayerTalkClass->ClearMenus(); + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + player->CLOSE_GOSSIP_MENU(); + if (creature->AI()) + creature->AI()->DoAction(1); + break; + } - return true; - } + return true; + } - CreatureAI *GetAI(Creature* creature) const - { - return new npc_fos_leaderAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_fos_leaderAI(creature); + } }; class npc_fos_leader_second : public CreatureScript { public: - npc_fos_leader_second() : CreatureScript("npc_fos_leader_second") { } + npc_fos_leader_second() : CreatureScript("npc_fos_leader_second") { } - struct npc_fos_leader_secondAI: public ScriptedAI - { - npc_fos_leader_secondAI(Creature* creature) : ScriptedAI(creature) - { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - } + struct npc_fos_leader_secondAI: public ScriptedAI + { + npc_fos_leader_secondAI(Creature* creature) : ScriptedAI(creature) + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == 1) - { - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - if (me->GetEntry() == NPC_JAINA_PART1) - Talk(SAY_JAINA_OUTRO); - else - Talk(SAY_SYLVANAS_OUTRO); - me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); - } - } - }; + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == 1) + { + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + if (me->GetEntry() == NPC_JAINA_PART1) + Talk(SAY_JAINA_OUTRO); + else + Talk(SAY_SYLVANAS_OUTRO); + me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); + } + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_fos_leader_secondAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_fos_leader_secondAI(creature); + } }; class spell_shield_of_bones : public SpellScriptLoader { public: - spell_shield_of_bones() : SpellScriptLoader("spell_shield_of_bones") { } + spell_shield_of_bones() : SpellScriptLoader("spell_shield_of_bones") { } - class spell_shield_of_bones_AuraScript : public AuraScript - { - PrepareAuraScript(spell_shield_of_bones_AuraScript); + class spell_shield_of_bones_AuraScript : public AuraScript + { + PrepareAuraScript(spell_shield_of_bones_AuraScript); - int32 amount; - bool fired; + int32 amount; + bool fired; - bool Load() - { - fired = false; - amount = 0; - return true; - } + bool Load() + { + fired = false; + amount = 0; + return true; + } - void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) - { - amount += absorbAmount; - if (!fired && amount >= GetSpellInfo()->Effects[EFFECT_0].BasePoints+1) - if (Unit* caster = GetCaster()) - { - fired = true; - caster->CastSpell(caster, 69642, true); - } - } + void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) + { + amount += absorbAmount; + if (!fired && amount >= GetSpellInfo()->Effects[EFFECT_0].BasePoints+1) + if (Unit* caster = GetCaster()) + { + fired = true; + caster->CastSpell(caster, 69642, true); + } + } - void Register() - { - AfterEffectAbsorb += AuraEffectAbsorbFn(spell_shield_of_bones_AuraScript::HandleAfterEffectAbsorb, EFFECT_0); - } - }; + void Register() + { + AfterEffectAbsorb += AuraEffectAbsorbFn(spell_shield_of_bones_AuraScript::HandleAfterEffectAbsorb, EFFECT_0); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_shield_of_bones_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_shield_of_bones_AuraScript(); + } }; void AddSC_forge_of_souls() { - new npc_fos_leader(); - new npc_fos_leader_second(); - new spell_shield_of_bones(); + new npc_fos_leader(); + new npc_fos_leader_second(); + new spell_shield_of_bones(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h index a51ee21d7..827343609 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h @@ -7,68 +7,68 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Data { - DATA_BRONJAHM, - DATA_DEVOURER, - MAX_ENCOUNTER, + DATA_BRONJAHM, + DATA_DEVOURER, + MAX_ENCOUNTER, }; enum Creatures { - NPC_BRONJAHM = 36497, - NPC_DEVOURER = 36502, + NPC_BRONJAHM = 36497, + NPC_DEVOURER = 36502, - NPC_SYLVANAS_PART1 = 37596, - NPC_SYLVANAS_PART2 = 38161, - NPC_JAINA_PART1 = 37597, - NPC_JAINA_PART2 = 38160, - NPC_KALIRA = 37583, - NPC_ELANDRA = 37774, - NPC_LORALEN = 37779, - NPC_KORELN = 37582, + NPC_SYLVANAS_PART1 = 37596, + NPC_SYLVANAS_PART2 = 38161, + NPC_JAINA_PART1 = 37597, + NPC_JAINA_PART2 = 38160, + NPC_KALIRA = 37583, + NPC_ELANDRA = 37774, + NPC_LORALEN = 37779, + NPC_KORELN = 37582, - NPC_CHAMPION_1_HORDE = 37584, - NPC_CHAMPION_2_HORDE = 37587, - NPC_CHAMPION_3_HORDE = 37588, - NPC_CHAMPION_1_ALLIANCE = 37496, - NPC_CHAMPION_2_ALLIANCE = 37497, + NPC_CHAMPION_1_HORDE = 37584, + NPC_CHAMPION_2_HORDE = 37587, + NPC_CHAMPION_3_HORDE = 37588, + NPC_CHAMPION_1_ALLIANCE = 37496, + NPC_CHAMPION_2_ALLIANCE = 37497, }; // OUTRO: struct outroPosition { - uint32 entry[2]; - Position startPosition; - uint32 pathId; + uint32 entry[2]; + Position startPosition; + uint32 pathId; }; #define PATH_BEGIN_VALUE 3000100 const outroPosition outroPositions[] = { - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5590.47f, 2427.79f, 705.935f, 0.802851f }, PATH_BEGIN_VALUE+14 }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5593.59f, 2428.34f, 705.935f, 0.977384f }, PATH_BEGIN_VALUE+15 }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5600.81f, 2429.31f, 705.935f, 0.890118f }, PATH_BEGIN_VALUE+5 }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5600.81f, 2421.12f, 705.935f, 0.890118f }, PATH_BEGIN_VALUE+18 }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5601.43f, 2426.53f, 705.935f, 0.890118f }, PATH_BEGIN_VALUE+6 }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5601.55f, 2418.36f, 705.935f, 1.15192f }, PATH_BEGIN_VALUE+17 }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5598, 2429.14f, 705.935f, 1.0472f }, PATH_BEGIN_VALUE+4 }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5594.04f, 2424.87f, 705.935f, 1.15192f }, PATH_BEGIN_VALUE+16 }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5597.89f, 2421.54f, 705.935f, 0.610865f }, PATH_BEGIN_VALUE+19 }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5598.57f, 2434.62f, 705.935f, 1.13446f }, PATH_BEGIN_VALUE+2 }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5585.46f, 2417.99f, 705.935f, 1.06465f }, PATH_BEGIN_VALUE+12 }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5605.81f, 2428.42f, 705.935f, 0.820305f }, PATH_BEGIN_VALUE+3 }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5591.61f, 2412.66f, 705.935f, 0.925025f }, PATH_BEGIN_VALUE+11 }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5593.9f, 2410.64f, 705.935f, 0.872665f }, PATH_BEGIN_VALUE+10 }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5586.76f, 2416.73f, 705.935f, 0.942478f }, PATH_BEGIN_VALUE+13 }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 5592.23f, 2419.14f, 705.935f, 0.855211f }, PATH_BEGIN_VALUE+8 }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 5594.61f, 2416.87f, 705.935f, 0.907571f }, PATH_BEGIN_VALUE+7 }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 5589.77f, 2421.03f, 705.935f, 0.855211f }, PATH_BEGIN_VALUE+9 }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5590.47f, 2427.79f, 705.935f, 0.802851f }, PATH_BEGIN_VALUE+14 }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5593.59f, 2428.34f, 705.935f, 0.977384f }, PATH_BEGIN_VALUE+15 }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5600.81f, 2429.31f, 705.935f, 0.890118f }, PATH_BEGIN_VALUE+5 }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5600.81f, 2421.12f, 705.935f, 0.890118f }, PATH_BEGIN_VALUE+18 }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5601.43f, 2426.53f, 705.935f, 0.890118f }, PATH_BEGIN_VALUE+6 }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5601.55f, 2418.36f, 705.935f, 1.15192f }, PATH_BEGIN_VALUE+17 }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5598, 2429.14f, 705.935f, 1.0472f }, PATH_BEGIN_VALUE+4 }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5594.04f, 2424.87f, 705.935f, 1.15192f }, PATH_BEGIN_VALUE+16 }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 5597.89f, 2421.54f, 705.935f, 0.610865f }, PATH_BEGIN_VALUE+19 }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5598.57f, 2434.62f, 705.935f, 1.13446f }, PATH_BEGIN_VALUE+2 }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5585.46f, 2417.99f, 705.935f, 1.06465f }, PATH_BEGIN_VALUE+12 }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5605.81f, 2428.42f, 705.935f, 0.820305f }, PATH_BEGIN_VALUE+3 }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5591.61f, 2412.66f, 705.935f, 0.925025f }, PATH_BEGIN_VALUE+11 }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5593.9f, 2410.64f, 705.935f, 0.872665f }, PATH_BEGIN_VALUE+10 }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 5586.76f, 2416.73f, 705.935f, 0.942478f }, PATH_BEGIN_VALUE+13 }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 5592.23f, 2419.14f, 705.935f, 0.855211f }, PATH_BEGIN_VALUE+8 }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 5594.61f, 2416.87f, 705.935f, 0.907571f }, PATH_BEGIN_VALUE+7 }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 5589.77f, 2421.03f, 705.935f, 0.855211f }, PATH_BEGIN_VALUE+9 }, - { { NPC_KORELN, NPC_LORALEN }, { 5602.58f, 2435.95f, 705.935f, 0.959931f }, PATH_BEGIN_VALUE+0 }, - { { NPC_ELANDRA, NPC_KALIRA }, { 5606.13f, 2433.16f, 705.935f, 0.785398f }, PATH_BEGIN_VALUE+1 }, + { { NPC_KORELN, NPC_LORALEN }, { 5602.58f, 2435.95f, 705.935f, 0.959931f }, PATH_BEGIN_VALUE+0 }, + { { NPC_ELANDRA, NPC_KALIRA }, { 5606.13f, 2433.16f, 705.935f, 0.785398f }, PATH_BEGIN_VALUE+1 }, - { { 0, 0 }, { 0.0f, 0.0f, 0.0f, 0.0f }, 0 } + { { 0, 0 }, { 0.0f, 0.0f, 0.0f, 0.0f }, 0 } }; const Position outroSpawnPoint = {5618.139f, 2451.873f, 705.854f, 0.0f}; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index e80956853..c4e89210c 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -10,225 +10,225 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! class instance_forge_of_souls : public InstanceMapScript { public: - instance_forge_of_souls() : InstanceMapScript("instance_forge_of_souls", 632) { } + instance_forge_of_souls() : InstanceMapScript("instance_forge_of_souls", 632) { } - InstanceScript* GetInstanceScript(InstanceMap *map) const - { - return new instance_forge_of_souls_InstanceScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap *map) const + { + return new instance_forge_of_souls_InstanceScript(map); + } - struct instance_forge_of_souls_InstanceScript : public InstanceScript - { - instance_forge_of_souls_InstanceScript(Map* map) : InstanceScript(map) {} + struct instance_forge_of_souls_InstanceScript : public InstanceScript + { + instance_forge_of_souls_InstanceScript(Map* map) : InstanceScript(map) {} - uint32 m_auiEncounter[MAX_ENCOUNTER]; - TeamId teamIdInInstance; - std::string str_data; - uint64 NPC_BronjahmGUID; - uint64 NPC_DevourerGUID; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + TeamId teamIdInInstance; + std::string str_data; + uint64 NPC_BronjahmGUID; + uint64 NPC_DevourerGUID; - uint64 NPC_LeaderFirstGUID; - uint64 NPC_LeaderSecondGUID; - uint64 NPC_GuardFirstGUID; - uint64 NPC_GuardSecondGUID; + uint64 NPC_LeaderFirstGUID; + uint64 NPC_LeaderSecondGUID; + uint64 NPC_GuardFirstGUID; + uint64 NPC_GuardSecondGUID; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - teamIdInInstance = TEAM_NEUTRAL; - NPC_BronjahmGUID = 0; - NPC_DevourerGUID = 0; + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + teamIdInInstance = TEAM_NEUTRAL; + NPC_BronjahmGUID = 0; + NPC_DevourerGUID = 0; - NPC_LeaderFirstGUID = 0; - NPC_LeaderSecondGUID = 0; - NPC_GuardFirstGUID = 0; - NPC_GuardSecondGUID = 0; - } + NPC_LeaderFirstGUID = 0; + NPC_LeaderSecondGUID = 0; + NPC_GuardFirstGUID = 0; + NPC_GuardSecondGUID = 0; + } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; - } + return false; + } - void OnPlayerEnter(Player* /*plr*/) - { - // this will happen only after crash and loading the instance from db - if (m_auiEncounter[0] == DONE && m_auiEncounter[1] == DONE && (!NPC_LeaderSecondGUID || !instance->GetCreature(NPC_LeaderSecondGUID))) - { - Position pos = {5658.15f, 2502.564f, 708.83f, 0.885207f}; - instance->SummonCreature(NPC_SYLVANAS_PART2, pos); - } - } + void OnPlayerEnter(Player* /*plr*/) + { + // this will happen only after crash and loading the instance from db + if (m_auiEncounter[0] == DONE && m_auiEncounter[1] == DONE && (!NPC_LeaderSecondGUID || !instance->GetCreature(NPC_LeaderSecondGUID))) + { + Position pos = {5658.15f, 2502.564f, 708.83f, 0.885207f}; + instance->SummonCreature(NPC_SYLVANAS_PART2, pos); + } + } - void OnCreatureCreate(Creature* creature) - { - if (teamIdInInstance == TEAM_NEUTRAL) - { - Map::PlayerList const &players = instance->GetPlayers(); - if (!players.isEmpty()) - if (Player* player = players.begin()->GetSource()) - teamIdInInstance = player->GetTeamId(); - } + void OnCreatureCreate(Creature* creature) + { + if (teamIdInInstance == TEAM_NEUTRAL) + { + Map::PlayerList const &players = instance->GetPlayers(); + if (!players.isEmpty()) + if (Player* player = players.begin()->GetSource()) + teamIdInInstance = player->GetTeamId(); + } - switch (creature->GetEntry()) - { - case NPC_BRONJAHM: - NPC_BronjahmGUID = creature->GetGUID(); - break; - case NPC_DEVOURER: - NPC_DevourerGUID = creature->GetGUID(); - break; - case NPC_SYLVANAS_PART1: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_JAINA_PART1); - NPC_LeaderFirstGUID = creature->GetGUID(); + switch (creature->GetEntry()) + { + case NPC_BRONJAHM: + NPC_BronjahmGUID = creature->GetGUID(); + break; + case NPC_DEVOURER: + NPC_DevourerGUID = creature->GetGUID(); + break; + case NPC_SYLVANAS_PART1: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_JAINA_PART1); + NPC_LeaderFirstGUID = creature->GetGUID(); - if (m_auiEncounter[0] == DONE && m_auiEncounter[1] == DONE) - creature->SetVisible(false); - break; - case NPC_SYLVANAS_PART2: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_JAINA_PART2); - NPC_LeaderSecondGUID = creature->GetGUID(); - break; - case NPC_LORALEN: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_ELANDRA); - if (!NPC_GuardFirstGUID) - { - NPC_GuardFirstGUID = creature->GetGUID(); - if (m_auiEncounter[0] == DONE && m_auiEncounter[1] == DONE) - creature->SetVisible(false); - } - break; - case NPC_KALIRA: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_KORELN); - if (!NPC_GuardSecondGUID) - { - NPC_GuardSecondGUID = creature->GetGUID(); - if (m_auiEncounter[0] == DONE && m_auiEncounter[1] == DONE) - creature->SetVisible(false); - } - break; - } - } + if (m_auiEncounter[0] == DONE && m_auiEncounter[1] == DONE) + creature->SetVisible(false); + break; + case NPC_SYLVANAS_PART2: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_JAINA_PART2); + NPC_LeaderSecondGUID = creature->GetGUID(); + break; + case NPC_LORALEN: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_ELANDRA); + if (!NPC_GuardFirstGUID) + { + NPC_GuardFirstGUID = creature->GetGUID(); + if (m_auiEncounter[0] == DONE && m_auiEncounter[1] == DONE) + creature->SetVisible(false); + } + break; + case NPC_KALIRA: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_KORELN); + if (!NPC_GuardSecondGUID) + { + NPC_GuardSecondGUID = creature->GetGUID(); + if (m_auiEncounter[0] == DONE && m_auiEncounter[1] == DONE) + creature->SetVisible(false); + } + break; + } + } - void HandleOutro() - { - if (!NPC_LeaderSecondGUID || !instance->GetCreature(NPC_LeaderSecondGUID)) - if (Creature* leader = instance->SummonCreature(NPC_SYLVANAS_PART2, outroSpawnPoint)) - if (Creature* boss = instance->GetCreature(NPC_DevourerGUID)) - { - float angle = boss->GetAngle(leader); - leader->GetMotionMaster()->MovePoint(1, boss->GetPositionX()+10.0f*cos(angle), boss->GetPositionY()+10.0f*sin(angle), boss->GetPositionZ()); - } + void HandleOutro() + { + if (!NPC_LeaderSecondGUID || !instance->GetCreature(NPC_LeaderSecondGUID)) + if (Creature* leader = instance->SummonCreature(NPC_SYLVANAS_PART2, outroSpawnPoint)) + if (Creature* boss = instance->GetCreature(NPC_DevourerGUID)) + { + float angle = boss->GetAngle(leader); + leader->GetMotionMaster()->MovePoint(1, boss->GetPositionX()+10.0f*cos(angle), boss->GetPositionY()+10.0f*sin(angle), boss->GetPositionZ()); + } - for (int8 i = 0; outroPositions[i].entry[teamIdInInstance] != 0; ++i) - if (Creature* summon = instance->SummonCreature(outroPositions[i].entry[teamIdInInstance], outroPositions[i].startPosition)) - summon->GetMotionMaster()->MovePath(outroPositions[i].pathId, false); - } + for (int8 i = 0; outroPositions[i].entry[teamIdInInstance] != 0; ++i) + if (Creature* summon = instance->SummonCreature(outroPositions[i].entry[teamIdInInstance], outroPositions[i].startPosition)) + summon->GetMotionMaster()->MovePath(outroPositions[i].pathId, false); + } - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_BRONJAHM: - m_auiEncounter[type] = data; - break; - case DATA_DEVOURER: - m_auiEncounter[type] = data; - if (m_auiEncounter[0] == DONE && m_auiEncounter[1] == DONE) - HandleOutro(); - break; - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_BRONJAHM: + m_auiEncounter[type] = data; + break; + case DATA_DEVOURER: + m_auiEncounter[type] = data; + if (m_auiEncounter[0] == DONE && m_auiEncounter[1] == DONE) + HandleOutro(); + break; + } - if (data == DONE) - SaveToDB(); - } + if (data == DONE) + SaveToDB(); + } - uint64 GetData64(uint32 type) const - { - switch (type) - { - case DATA_BRONJAHM: return NPC_BronjahmGUID; - } + uint64 GetData64(uint32 type) const + { + switch (type) + { + case DATA_BRONJAHM: return NPC_BronjahmGUID; + } - return 0; - } + return 0; + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case 12752: // Soul Power - if( Creature* c = instance->GetCreature(NPC_BronjahmGUID) ) - { - std::list L; - uint8 count = 0; - c->GetCreaturesWithEntryInRange(L, 200.0f, 36535); // find all Corrupted Soul Fragment (36535) - for( std::list::const_iterator itr = L.begin(); itr != L.end(); ++itr ) - if( (*itr)->IsAlive() ) - ++count; - return (count >= 4); - } - break; - case 12976: - if( Creature* c = instance->GetCreature(NPC_DevourerGUID) ) - return (bool)c->AI()->GetData(1); - break; - } - return false; - } + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case 12752: // Soul Power + if( Creature* c = instance->GetCreature(NPC_BronjahmGUID) ) + { + std::list L; + uint8 count = 0; + c->GetCreaturesWithEntryInRange(L, 200.0f, 36535); // find all Corrupted Soul Fragment (36535) + for( std::list::const_iterator itr = L.begin(); itr != L.end(); ++itr ) + if( (*itr)->IsAlive() ) + ++count; + return (count >= 4); + } + break; + case 12976: + if( Creature* c = instance->GetCreature(NPC_DevourerGUID) ) + return (bool)c->AI()->GetData(1); + break; + } + return false; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "F S " << m_auiEncounter[0] << ' ' << m_auiEncounter[1]; - str_data = saveStream.str(); + std::ostringstream saveStream; + saveStream << "F S " << m_auiEncounter[0] << ' ' << m_auiEncounter[1]; + str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint32 data0, data1; + char dataHead1, dataHead2; + uint32 data0, data1; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1; - if (dataHead1 == 'F' && dataHead2 == 'S') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; + if (dataHead1 == 'F' && dataHead2 == 'S') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } - else OUT_LOAD_INST_DATA_FAIL; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } + else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } - }; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; }; void AddSC_instance_forge_of_souls() { - new instance_forge_of_souls(); + new instance_forge_of_souls(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp index fe8c17cc6..b7e188994 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp @@ -7,28 +7,28 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Yells { - SAY_AGGRO = 50, - SAY_SLAY_1 = 51, - SAY_SLAY_2 = 52, - SAY_DEATH = 53, - SAY_IMPENDING_DESPAIR = 54, - SAY_DEFILING_HORROR = 55, + SAY_AGGRO = 50, + SAY_SLAY_1 = 51, + SAY_SLAY_2 = 52, + SAY_DEATH = 53, + SAY_IMPENDING_DESPAIR = 54, + SAY_DEFILING_HORROR = 55, }; enum Spells { - SPELL_QUIVERING_STRIKE = 72422, - SPELL_IMPENDING_DESPAIR = 72426, - SPELL_DEFILING_HORROR = 72435, + SPELL_QUIVERING_STRIKE = 72422, + SPELL_IMPENDING_DESPAIR = 72426, + SPELL_DEFILING_HORROR = 72435, }; enum Events { - EVENT_NONE, - EVENT_QUIVERING_STRIKE, - EVENT_IMPENDING_DESPAIR, - EVENT_DEFILING_HORROR, - EVENT_UNROOT, + EVENT_NONE, + EVENT_QUIVERING_STRIKE, + EVENT_IMPENDING_DESPAIR, + EVENT_DEFILING_HORROR, + EVENT_UNROOT, }; const uint32 hopelessnessId[3][2] = { {72395, 72390}, {72396, 72391}, {72397, 72393} }; @@ -36,138 +36,138 @@ const uint32 hopelessnessId[3][2] = { {72395, 72390}, {72396, 72391}, {72397, 72 class boss_falric : public CreatureScript { public: - boss_falric() : CreatureScript("boss_falric") { } + boss_falric() : CreatureScript("boss_falric") { } - struct boss_falricAI : public ScriptedAI - { - boss_falricAI(Creature* creature) : ScriptedAI(creature) - { - pInstance = creature->GetInstanceScript(); - } + struct boss_falricAI : public ScriptedAI + { + boss_falricAI(Creature* creature) : ScriptedAI(creature) + { + pInstance = creature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - uint8 uiHopelessnessCount; - uint16 startFightTimer; + InstanceScript* pInstance; + EventMap events; + uint8 uiHopelessnessCount; + uint16 startFightTimer; - void Reset() - { - startFightTimer = 0; - uiHopelessnessCount = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->SetControlled(false, UNIT_STATE_ROOT); - events.Reset(); - if (pInstance) - pInstance->SetData(DATA_FALRIC, NOT_STARTED); - } + void Reset() + { + startFightTimer = 0; + uiHopelessnessCount = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetControlled(false, UNIT_STATE_ROOT); + events.Reset(); + if (pInstance) + pInstance->SetData(DATA_FALRIC, NOT_STARTED); + } - void EnterCombat(Unit* /*who*/) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + void EnterCombat(Unit* /*who*/) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 5000); - events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 11000); - events.ScheduleEvent(EVENT_DEFILING_HORROR, 20000); - } + events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 5000); + events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 11000); + events.ScheduleEvent(EVENT_DEFILING_HORROR, 20000); + } - void DoAction(int32 a) - { - if (a == 1) - { - Talk(SAY_AGGRO); - startFightTimer = 8000; - } - } + void DoAction(int32 a) + { + if (a == 1) + { + Talk(SAY_AGGRO); + startFightTimer = 8000; + } + } - void UpdateAI(uint32 diff) - { - if (startFightTimer) - { - if (startFightTimer <= diff) - { - startFightTimer = 0; - me->SetInCombatWithZone(); - } - else - startFightTimer -= diff; - } + void UpdateAI(uint32 diff) + { + if (startFightTimer) + { + if (startFightTimer <= diff) + { + startFightTimer = 0; + me->SetInCombatWithZone(); + } + else + startFightTimer -= diff; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_QUIVERING_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_QUIVERING_STRIKE, false); - events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 5000); - break; - case EVENT_IMPENDING_DESPAIR: - if (Unit* target = SelectTargetFromPlayerList(45.0f, 0, true)) - { - Talk(SAY_IMPENDING_DESPAIR); - me->CastSpell(target, SPELL_IMPENDING_DESPAIR, false); - } - events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 12000); - break; - case EVENT_DEFILING_HORROR: - Talk(SAY_DEFILING_HORROR); - me->CastSpell((Unit*)NULL, SPELL_DEFILING_HORROR, false); - me->SetControlled(true, UNIT_STATE_ROOT); - events.DelayEventsToMax(5000, 0); - events.ScheduleEvent(EVENT_UNROOT, 4000); - events.ScheduleEvent(EVENT_DEFILING_HORROR, 20000); - break; - case EVENT_UNROOT: - me->SetControlled(false, UNIT_STATE_ROOT); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_QUIVERING_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_QUIVERING_STRIKE, false); + events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 5000); + break; + case EVENT_IMPENDING_DESPAIR: + if (Unit* target = SelectTargetFromPlayerList(45.0f, 0, true)) + { + Talk(SAY_IMPENDING_DESPAIR); + me->CastSpell(target, SPELL_IMPENDING_DESPAIR, false); + } + events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 12000); + break; + case EVENT_DEFILING_HORROR: + Talk(SAY_DEFILING_HORROR); + me->CastSpell((Unit*)NULL, SPELL_DEFILING_HORROR, false); + me->SetControlled(true, UNIT_STATE_ROOT); + events.DelayEventsToMax(5000, 0); + events.ScheduleEvent(EVENT_UNROOT, 4000); + events.ScheduleEvent(EVENT_DEFILING_HORROR, 20000); + break; + case EVENT_UNROOT: + me->SetControlled(false, UNIT_STATE_ROOT); + break; + } - if ((uiHopelessnessCount == 0 && HealthBelowPct(67)) || (uiHopelessnessCount == 1 && HealthBelowPct(34)) || (uiHopelessnessCount == 2 && HealthBelowPct(11))) - { - if (uiHopelessnessCount) - me->RemoveOwnedAura(hopelessnessId[uiHopelessnessCount-1][DUNGEON_MODE(0, 1)]); - me->CastSpell((Unit*)NULL, hopelessnessId[uiHopelessnessCount][DUNGEON_MODE(0, 1)], true); - ++uiHopelessnessCount; - } + if ((uiHopelessnessCount == 0 && HealthBelowPct(67)) || (uiHopelessnessCount == 1 && HealthBelowPct(34)) || (uiHopelessnessCount == 2 && HealthBelowPct(11))) + { + if (uiHopelessnessCount) + me->RemoveOwnedAura(hopelessnessId[uiHopelessnessCount-1][DUNGEON_MODE(0, 1)]); + me->CastSpell((Unit*)NULL, hopelessnessId[uiHopelessnessCount][DUNGEON_MODE(0, 1)], true); + ++uiHopelessnessCount; + } - if (!me->HasUnitState(UNIT_STATE_ROOT)) - DoMeleeAttackIfReady(); - } + if (!me->HasUnitState(UNIT_STATE_ROOT)) + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_FALRIC, DONE); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(DATA_FALRIC, DONE); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER) - Talk(RAND(SAY_SLAY_1, SAY_SLAY_2)); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(RAND(SAY_SLAY_1, SAY_SLAY_2)); + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - ScriptedAI::EnterEvadeMode(); - if (startFightTimer) - Reset(); - } - }; + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + ScriptedAI::EnterEvadeMode(); + if (startFightTimer) + Reset(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_falricAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_falricAI(creature); + } }; void AddSC_boss_falric() { - new boss_falric(); + new boss_falric(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp index 303370f31..ffd6d649e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp @@ -7,198 +7,198 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Yells { - SAY_AGGRO = 60, - SAY_SLAY_1 = 61, - SAY_SLAY_2 = 62, - SAY_DEATH = 63, - SAY_CORRUPTED_FLESH_1 = 64, - SAY_CORRUPTED_FLESH_2 = 65, + SAY_AGGRO = 60, + SAY_SLAY_1 = 61, + SAY_SLAY_2 = 62, + SAY_DEATH = 63, + SAY_CORRUPTED_FLESH_1 = 64, + SAY_CORRUPTED_FLESH_2 = 65, }; enum Spells { - SPELL_OBLITERATE = 72360, - SPELL_WELL_OF_CORRUPTION = 72362, - SPELL_CORRUPTED_FLESH = 72363, - SPELL_SHARED_SUFFERING = 72368, + SPELL_OBLITERATE = 72360, + SPELL_WELL_OF_CORRUPTION = 72362, + SPELL_CORRUPTED_FLESH = 72363, + SPELL_SHARED_SUFFERING = 72368, }; enum Events { - EVENT_NONE, - EVENT_OBLITERATE, - EVENT_WELL_OF_CORRUPTION, - EVENT_CORRUPTED_FLESH, - EVENT_SHARED_SUFFERING, + EVENT_NONE, + EVENT_OBLITERATE, + EVENT_WELL_OF_CORRUPTION, + EVENT_CORRUPTED_FLESH, + EVENT_SHARED_SUFFERING, }; class boss_marwyn : public CreatureScript { public: - boss_marwyn() : CreatureScript("boss_marwyn") { } + boss_marwyn() : CreatureScript("boss_marwyn") { } - struct boss_marwynAI : public ScriptedAI - { - boss_marwynAI(Creature* creature) : ScriptedAI(creature) - { - pInstance = creature->GetInstanceScript(); - } + struct boss_marwynAI : public ScriptedAI + { + boss_marwynAI(Creature* creature) : ScriptedAI(creature) + { + pInstance = creature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - uint16 startFightTimer; + InstanceScript* pInstance; + EventMap events; + uint16 startFightTimer; - void Reset() - { - startFightTimer = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - events.Reset(); - if (pInstance) - pInstance->SetData(DATA_MARWYN, NOT_STARTED); - } + void Reset() + { + startFightTimer = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + events.Reset(); + if (pInstance) + pInstance->SetData(DATA_MARWYN, NOT_STARTED); + } - void EnterCombat(Unit* /*who*/) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + void EnterCombat(Unit* /*who*/) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - events.ScheduleEvent(EVENT_OBLITERATE, 15000); - events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000); - events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000); - events.ScheduleEvent(EVENT_SHARED_SUFFERING, 5000); - } + events.ScheduleEvent(EVENT_OBLITERATE, 15000); + events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000); + events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000); + events.ScheduleEvent(EVENT_SHARED_SUFFERING, 5000); + } - void DoAction(int32 a) - { - if (a == 1) - { - Talk(SAY_AGGRO); - startFightTimer = 8000; - } - } + void DoAction(int32 a) + { + if (a == 1) + { + Talk(SAY_AGGRO); + startFightTimer = 8000; + } + } - void UpdateAI(uint32 diff) - { - if (startFightTimer) - { - if (startFightTimer <= diff) - { - startFightTimer = 0; - me->SetInCombatWithZone(); - } - else - startFightTimer -= diff; - } + void UpdateAI(uint32 diff) + { + if (startFightTimer) + { + if (startFightTimer <= diff) + { + startFightTimer = 0; + me->SetInCombatWithZone(); + } + else + startFightTimer -= diff; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_OBLITERATE: - if (me->IsWithinMeleeRange(me->GetVictim())) - { - me->CastSpell(me->GetVictim(), SPELL_OBLITERATE, false); - events.ScheduleEvent(EVENT_OBLITERATE, 15000); - } - else - events.ScheduleEvent(EVENT_OBLITERATE, 3000); - break; - case EVENT_WELL_OF_CORRUPTION: - if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) - me->CastSpell(target, SPELL_WELL_OF_CORRUPTION, false); - events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000); - break; - case EVENT_CORRUPTED_FLESH: - Talk(RAND(SAY_CORRUPTED_FLESH_1, SAY_CORRUPTED_FLESH_2)); - me->CastSpell((Unit*)NULL, SPELL_CORRUPTED_FLESH, false); - events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000); - break; - case EVENT_SHARED_SUFFERING: - if (Unit* target = SelectTargetFromPlayerList(200.0f, 0, true)) - me->CastSpell(target, SPELL_SHARED_SUFFERING, true); - events.ScheduleEvent(EVENT_SHARED_SUFFERING, 15000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_OBLITERATE: + if (me->IsWithinMeleeRange(me->GetVictim())) + { + me->CastSpell(me->GetVictim(), SPELL_OBLITERATE, false); + events.ScheduleEvent(EVENT_OBLITERATE, 15000); + } + else + events.ScheduleEvent(EVENT_OBLITERATE, 3000); + break; + case EVENT_WELL_OF_CORRUPTION: + if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) + me->CastSpell(target, SPELL_WELL_OF_CORRUPTION, false); + events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000); + break; + case EVENT_CORRUPTED_FLESH: + Talk(RAND(SAY_CORRUPTED_FLESH_1, SAY_CORRUPTED_FLESH_2)); + me->CastSpell((Unit*)NULL, SPELL_CORRUPTED_FLESH, false); + events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000); + break; + case EVENT_SHARED_SUFFERING: + if (Unit* target = SelectTargetFromPlayerList(200.0f, 0, true)) + me->CastSpell(target, SPELL_SHARED_SUFFERING, true); + events.ScheduleEvent(EVENT_SHARED_SUFFERING, 15000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_MARWYN, DONE); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(DATA_MARWYN, DONE); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER) - Talk(RAND(SAY_SLAY_1, SAY_SLAY_2)); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(RAND(SAY_SLAY_1, SAY_SLAY_2)); + } - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - if (startFightTimer) - Reset(); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + if (startFightTimer) + Reset(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_marwynAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_marwynAI(creature); + } }; class spell_hor_shared_suffering : public SpellScriptLoader { public: - spell_hor_shared_suffering() : SpellScriptLoader("spell_hor_shared_suffering") { } + spell_hor_shared_suffering() : SpellScriptLoader("spell_hor_shared_suffering") { } - class spell_hor_shared_sufferingAuraScript : public AuraScript - { - PrepareAuraScript(spell_hor_shared_sufferingAuraScript); + class spell_hor_shared_sufferingAuraScript : public AuraScript + { + PrepareAuraScript(spell_hor_shared_sufferingAuraScript); - void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode) - { - if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL) // dispelled - if (Unit* caster = GetCaster()) - if (Map* map = caster->FindMap()) - if (Aura* a = aurEff->GetBase()) - { - uint32 count = 0; - uint32 ticks = 0; - uint32 dmgPerTick = a->GetSpellInfo()->Effects[0].BasePoints; - Map::PlayerList const& pl = map->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->IsAlive()) - ++count; - ticks = (a->GetDuration() / int32(a->GetSpellInfo()->Effects[0].Amplitude)) + 1; - int32 dmg = (ticks*dmgPerTick)/count; - caster->CastCustomSpell(GetTarget(), 72373, NULL, &dmg, NULL, true); - } - } + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode) + { + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL) // dispelled + if (Unit* caster = GetCaster()) + if (Map* map = caster->FindMap()) + if (Aura* a = aurEff->GetBase()) + { + uint32 count = 0; + uint32 ticks = 0; + uint32 dmgPerTick = a->GetSpellInfo()->Effects[0].BasePoints; + Map::PlayerList const& pl = map->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->IsAlive()) + ++count; + ticks = (a->GetDuration() / int32(a->GetSpellInfo()->Effects[0].Amplitude)) + 1; + int32 dmg = (ticks*dmgPerTick)/count; + caster->CastCustomSpell(GetTarget(), 72373, NULL, &dmg, NULL, true); + } + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_hor_shared_sufferingAuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_hor_shared_sufferingAuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_hor_shared_sufferingAuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_hor_shared_sufferingAuraScript(); + } }; void AddSC_boss_marwyn() { - new boss_marwyn(); - new spell_hor_shared_suffering(); + new boss_marwyn(); + new spell_hor_shared_suffering(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index ba31d7522..c309c6db6 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -8,2046 +8,2046 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Events { - EVENT_NONE, + EVENT_NONE, - EVENT_PRE_INTRO_1, - EVENT_PRE_INTRO_2, - EVENT_PRE_INTRO_3, + EVENT_PRE_INTRO_1, + EVENT_PRE_INTRO_2, + EVENT_PRE_INTRO_3, - EVENT_START_INTRO, - EVENT_SKIP_INTRO, + EVENT_START_INTRO, + EVENT_SKIP_INTRO, - EVENT_INTRO_A2_1, - EVENT_INTRO_A2_2, - EVENT_INTRO_A2_3, - EVENT_INTRO_A2_4, - EVENT_INTRO_A2_5, - EVENT_INTRO_A2_6, - EVENT_INTRO_A2_7, - EVENT_INTRO_A2_8, - EVENT_INTRO_A2_9, - EVENT_INTRO_A2_10, - EVENT_INTRO_A2_11, - EVENT_INTRO_A2_12, - EVENT_INTRO_A2_13, - EVENT_INTRO_A2_14, - EVENT_INTRO_A2_15, - EVENT_INTRO_A2_16, - EVENT_INTRO_A2_17, - EVENT_INTRO_A2_18, - EVENT_INTRO_A2_19, + EVENT_INTRO_A2_1, + EVENT_INTRO_A2_2, + EVENT_INTRO_A2_3, + EVENT_INTRO_A2_4, + EVENT_INTRO_A2_5, + EVENT_INTRO_A2_6, + EVENT_INTRO_A2_7, + EVENT_INTRO_A2_8, + EVENT_INTRO_A2_9, + EVENT_INTRO_A2_10, + EVENT_INTRO_A2_11, + EVENT_INTRO_A2_12, + EVENT_INTRO_A2_13, + EVENT_INTRO_A2_14, + EVENT_INTRO_A2_15, + EVENT_INTRO_A2_16, + EVENT_INTRO_A2_17, + EVENT_INTRO_A2_18, + EVENT_INTRO_A2_19, - EVENT_INTRO_H2_1, - EVENT_INTRO_H2_2, - EVENT_INTRO_H2_3, - EVENT_INTRO_H2_4, - EVENT_INTRO_H2_5, - EVENT_INTRO_H2_6, - EVENT_INTRO_H2_7, - EVENT_INTRO_H2_8, - EVENT_INTRO_H2_9, - EVENT_INTRO_H2_10, - EVENT_INTRO_H2_11, - EVENT_INTRO_H2_12, - EVENT_INTRO_H2_13, - EVENT_INTRO_H2_14, - EVENT_INTRO_H2_15, + EVENT_INTRO_H2_1, + EVENT_INTRO_H2_2, + EVENT_INTRO_H2_3, + EVENT_INTRO_H2_4, + EVENT_INTRO_H2_5, + EVENT_INTRO_H2_6, + EVENT_INTRO_H2_7, + EVENT_INTRO_H2_8, + EVENT_INTRO_H2_9, + EVENT_INTRO_H2_10, + EVENT_INTRO_H2_11, + EVENT_INTRO_H2_12, + EVENT_INTRO_H2_13, + EVENT_INTRO_H2_14, + EVENT_INTRO_H2_15, - EVENT_INTRO_LK_1, - EVENT_INTRO_LK_1_2, - EVENT_INTRO_LK_1_3, - EVENT_INTRO_LK_2, - EVENT_INTRO_LK_3, - EVENT_INTRO_LK_4, - EVENT_INTRO_LK_4_2, - EVENT_INTRO_LK_4_3, - EVENT_INTRO_LK_5, - EVENT_INTRO_LK_5_2, - EVENT_INTRO_LK_6, - EVENT_INTRO_LK_7, - EVENT_INTRO_LK_8, - EVENT_INTRO_LK_9, + EVENT_INTRO_LK_1, + EVENT_INTRO_LK_1_2, + EVENT_INTRO_LK_1_3, + EVENT_INTRO_LK_2, + EVENT_INTRO_LK_3, + EVENT_INTRO_LK_4, + EVENT_INTRO_LK_4_2, + EVENT_INTRO_LK_4_3, + EVENT_INTRO_LK_5, + EVENT_INTRO_LK_5_2, + EVENT_INTRO_LK_6, + EVENT_INTRO_LK_7, + EVENT_INTRO_LK_8, + EVENT_INTRO_LK_9, - EVENT_INTRO_END, - EVENT_INTRO_END_SET, + EVENT_INTRO_END, + EVENT_INTRO_END_SET, }; class npc_hor_leader : public CreatureScript { public: - npc_hor_leader() : CreatureScript("npc_hor_leader") { } + npc_hor_leader() : CreatureScript("npc_hor_leader") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - return true; + bool OnGossipHello(Player* player, Creature* creature) + { + if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return true; - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + if (creature->IsQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); - bool canStart = true; - if (InstanceScript* instance = creature->GetInstanceScript()) - if (uint32 bhd = instance->GetData(DATA_BATTERED_HILT)) - if ((bhd & BHSF_FINISHED) == 0) - canStart = false; + bool canStart = true; + if (InstanceScript* instance = creature->GetInstanceScript()) + if (uint32 bhd = instance->GetData(DATA_BATTERED_HILT)) + if ((bhd & BHSF_FINISHED) == 0) + canStart = false; - if (canStart) - { - QuestStatus status = player->GetQuestStatus(creature->GetEntry() == NPC_SYLVANAS_PART1 ? QUEST_DELIVRANCE_FROM_THE_PIT_H2 : QUEST_DELIVRANCE_FROM_THE_PIT_A2); - if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED) - player->ADD_GOSSIP_ITEM(0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (canStart) + { + QuestStatus status = player->GetQuestStatus(creature->GetEntry() == NPC_SYLVANAS_PART1 ? QUEST_DELIVRANCE_FROM_THE_PIT_H2 : QUEST_DELIVRANCE_FROM_THE_PIT_A2); + if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED) + player->ADD_GOSSIP_ITEM(0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - // once last quest is completed, she offers this shortcut of the starting event - status = player->GetQuestStatus(creature->GetEntry() == NPC_SYLVANAS_PART1 ? QUEST_WRATH_OF_THE_LICH_KING_H2 : QUEST_WRATH_OF_THE_LICH_KING_A2); - if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED) - { - if (creature->GetEntry() == NPC_SYLVANAS_PART1) - player->ADD_GOSSIP_ITEM(0, "Dark Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - else - player->ADD_GOSSIP_ITEM(0, "My Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - } - } + // once last quest is completed, she offers this shortcut of the starting event + status = player->GetQuestStatus(creature->GetEntry() == NPC_SYLVANAS_PART1 ? QUEST_WRATH_OF_THE_LICH_KING_H2 : QUEST_WRATH_OF_THE_LICH_KING_A2); + if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED) + { + if (creature->GetEntry() == NPC_SYLVANAS_PART1) + player->ADD_GOSSIP_ITEM(0, "Dark Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + else + player->ADD_GOSSIP_ITEM(0, "My Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + } + } - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); - return true; - } + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - return true; + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + { + if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return true; - InstanceScript* instance = creature->GetInstanceScript(); - if (!instance) - return true; + InstanceScript* instance = creature->GetInstanceScript(); + if (!instance) + return true; - if (uint32 bhd = instance->GetData(DATA_BATTERED_HILT)) - if ((bhd & BHSF_FINISHED) == 0) - return true; + if (uint32 bhd = instance->GetData(DATA_BATTERED_HILT)) + if ((bhd & BHSF_FINISHED) == 0) + return true; - instance->SetData(DATA_BATTERED_HILT, 1); + instance->SetData(DATA_BATTERED_HILT, 1); - player->PlayerTalkClass->ClearMenus(); - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->CLOSE_GOSSIP_MENU(); - if (creature->AI()) - creature->AI()->DoAction(ACTION_START_INTRO); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->CLOSE_GOSSIP_MENU(); - if (creature->AI()) - creature->AI()->DoAction(ACTION_SKIP_INTRO); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); - break; - } + player->PlayerTalkClass->ClearMenus(); + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + player->CLOSE_GOSSIP_MENU(); + if (creature->AI()) + creature->AI()->DoAction(ACTION_START_INTRO); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + break; + case GOSSIP_ACTION_INFO_DEF+2: + player->CLOSE_GOSSIP_MENU(); + if (creature->AI()) + creature->AI()->DoAction(ACTION_SKIP_INTRO); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + break; + } - return true; - } + return true; + } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_hor_leaderAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_hor_leaderAI(creature); + } - struct npc_hor_leaderAI : public NullCreatureAI - { - npc_hor_leaderAI(Creature* creature) : NullCreatureAI(creature) - { - pInstance = me->GetInstanceScript(); - if (!pInstance) - me->IsAIEnabled = false; - first = (pInstance && !pInstance->GetData(DATA_INTRO)); - } + struct npc_hor_leaderAI : public NullCreatureAI + { + npc_hor_leaderAI(Creature* creature) : NullCreatureAI(creature) + { + pInstance = me->GetInstanceScript(); + if (!pInstance) + me->IsAIEnabled = false; + first = (pInstance && !pInstance->GetData(DATA_INTRO)); + } - InstanceScript* pInstance; - EventMap events; - bool first; - bool shortver; + InstanceScript* pInstance; + EventMap events; + bool first; + bool shortver; - void Reset() - { - shortver = false; - events.Reset(); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - if (first) - { - first = false; - events.ScheduleEvent(EVENT_PRE_INTRO_1, 10000); - events.ScheduleEvent(EVENT_PRE_INTRO_2, 11000); - events.ScheduleEvent(EVENT_PRE_INTRO_3, 17000); - } - } + void Reset() + { + shortver = false; + events.Reset(); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + if (first) + { + first = false; + events.ScheduleEvent(EVENT_PRE_INTRO_1, 10000); + events.ScheduleEvent(EVENT_PRE_INTRO_2, 11000); + events.ScheduleEvent(EVENT_PRE_INTRO_3, 17000); + } + } - void DoAction(int32 actionId) - { - switch(actionId) - { - case ACTION_START_INTRO: - events.ScheduleEvent(EVENT_START_INTRO, 0); - break; - case ACTION_SKIP_INTRO: - events.ScheduleEvent(EVENT_SKIP_INTRO, 0); - break; - } - } + void DoAction(int32 actionId) + { + switch(actionId) + { + case ACTION_START_INTRO: + events.ScheduleEvent(EVENT_START_INTRO, 0); + break; + case ACTION_SKIP_INTRO: + events.ScheduleEvent(EVENT_SKIP_INTRO, 0); + break; + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch(events.ExecuteEvent()) - { - case EVENT_PRE_INTRO_1: - if (pInstance) - { - me->SetVisible(true); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DARK_RANGER_LORALEN))) - c->SetVisible(true); - } - break; - case EVENT_PRE_INTRO_2: - if (me->GetEntry() == NPC_JAINA_PART1) - Talk(SAY_JAINA_INTRO_1); - me->GetMotionMaster()->MovePoint(0, SpawnPos); - break; - case EVENT_PRE_INTRO_3: - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); - Talk(me->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_INTRO_2 : SAY_SYLVANAS_INTRO_1); - me->SetFacingTo(0.89f); - break; + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch(events.ExecuteEvent()) + { + case EVENT_PRE_INTRO_1: + if (pInstance) + { + me->SetVisible(true); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DARK_RANGER_LORALEN))) + c->SetVisible(true); + } + break; + case EVENT_PRE_INTRO_2: + if (me->GetEntry() == NPC_JAINA_PART1) + Talk(SAY_JAINA_INTRO_1); + me->GetMotionMaster()->MovePoint(0, SpawnPos); + break; + case EVENT_PRE_INTRO_3: + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + Talk(me->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_INTRO_2 : SAY_SYLVANAS_INTRO_1); + me->SetFacingTo(0.89f); + break; - case EVENT_START_INTRO: - shortver = false; - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->GetMotionMaster()->MovePoint(0, MoveThronePos); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DARK_RANGER_LORALEN))) - c->GetMotionMaster()->MovePoint(0, LoralenFollowPos); - // Begining of intro is differents between factions as the speech sequence and timers are differents. - if (me->GetEntry() == NPC_JAINA_PART1) - events.ScheduleEvent(EVENT_INTRO_A2_1, 10000); - else - events.ScheduleEvent(EVENT_INTRO_H2_2, 10000); - break; - case EVENT_SKIP_INTRO: - shortver = true; - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, (me->GetEntry() == NPC_JAINA_PART1 ? EMOTE_STATE_READY2H : EMOTE_STATE_READY1H)); - me->GetMotionMaster()->MovePoint(0, MoveThronePos); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DARK_RANGER_LORALEN))) - c->GetMotionMaster()->MovePoint(0, LoralenFollowPos); - events.ScheduleEvent(EVENT_INTRO_LK_1, 0); - break; + case EVENT_START_INTRO: + shortver = false; + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->GetMotionMaster()->MovePoint(0, MoveThronePos); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DARK_RANGER_LORALEN))) + c->GetMotionMaster()->MovePoint(0, LoralenFollowPos); + // Begining of intro is differents between factions as the speech sequence and timers are differents. + if (me->GetEntry() == NPC_JAINA_PART1) + events.ScheduleEvent(EVENT_INTRO_A2_1, 10000); + else + events.ScheduleEvent(EVENT_INTRO_H2_2, 10000); + break; + case EVENT_SKIP_INTRO: + shortver = true; + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, (me->GetEntry() == NPC_JAINA_PART1 ? EMOTE_STATE_READY2H : EMOTE_STATE_READY1H)); + me->GetMotionMaster()->MovePoint(0, MoveThronePos); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DARK_RANGER_LORALEN))) + c->GetMotionMaster()->MovePoint(0, LoralenFollowPos); + events.ScheduleEvent(EVENT_INTRO_LK_1, 0); + break; - // A2 Intro Events - case EVENT_INTRO_A2_1: - Talk(SAY_JAINA_INTRO_3); - events.ScheduleEvent(EVENT_INTRO_A2_2, 5000); - break; - case EVENT_INTRO_A2_2: - Talk(SAY_JAINA_INTRO_4); - events.ScheduleEvent(EVENT_INTRO_A2_3, 10000); - break; - case EVENT_INTRO_A2_3: - pInstance->HandleGameObject(pInstance->GetData64(GO_FROSTMOURNE), true); - me->CastSpell(me, SPELL_FROSTMOURNE_SPAWN_SOUND, true); - me->CastSpell(me, SPELL_ARCANE_CAST_VISUAL, false); - events.ScheduleEvent(EVENT_INTRO_A2_4, 10000); - break; - case EVENT_INTRO_A2_4: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - { - pUther->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - pUther->SetVisible(true); - if (Aura* a = pUther->AddAura(SPELL_SHADOWMOURNE_VISUAL, pUther)) - a->SetDuration(8000); - } - events.ScheduleEvent(EVENT_INTRO_A2_5, 2000); - break; - case EVENT_INTRO_A2_5: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_A2_1); - events.ScheduleEvent(EVENT_INTRO_A2_6, 3000); - break; - case EVENT_INTRO_A2_6: - Talk(SAY_JAINA_INTRO_5); - events.ScheduleEvent(EVENT_INTRO_A2_7, 6000); - break; - case EVENT_INTRO_A2_7: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_A2_2); - events.ScheduleEvent(EVENT_INTRO_A2_8, 6500); - break; - case EVENT_INTRO_A2_8: - Talk(SAY_JAINA_INTRO_6); - events.ScheduleEvent(EVENT_INTRO_A2_9, 2000); - break; - case EVENT_INTRO_A2_9: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_A2_3); - events.ScheduleEvent(EVENT_INTRO_A2_10, 9000); - break; - case EVENT_INTRO_A2_10: - Talk(SAY_JAINA_INTRO_7); - events.ScheduleEvent(EVENT_INTRO_A2_11, 5000); - break; - case EVENT_INTRO_A2_11: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_A2_4); - events.ScheduleEvent(EVENT_INTRO_A2_12, 11000); - break; - case EVENT_INTRO_A2_12: - Talk(SAY_JAINA_INTRO_8); - events.ScheduleEvent(EVENT_INTRO_A2_13, 4000); - break; - case EVENT_INTRO_A2_13: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_A2_5); - events.ScheduleEvent(EVENT_INTRO_A2_14, 12500); - break; - case EVENT_INTRO_A2_14: - Talk(SAY_JAINA_INTRO_9); - events.ScheduleEvent(EVENT_INTRO_A2_15, 10000); - break; - case EVENT_INTRO_A2_15: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_A2_6); - events.ScheduleEvent(EVENT_INTRO_A2_16, 24000); - break; - case EVENT_INTRO_A2_16: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_A2_7); - events.ScheduleEvent(EVENT_INTRO_A2_17, 4000); - break; - case EVENT_INTRO_A2_17: - Talk(SAY_JAINA_INTRO_10); - events.ScheduleEvent(EVENT_INTRO_A2_18, 2000); - break; - case EVENT_INTRO_A2_18: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - { - pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); - pUther->AI()->Talk(SAY_UTHER_INTRO_A2_8); - } - events.ScheduleEvent(EVENT_INTRO_A2_19, 11000); - break; - case EVENT_INTRO_A2_19: - Talk(SAY_JAINA_INTRO_11); - events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); - break; + // A2 Intro Events + case EVENT_INTRO_A2_1: + Talk(SAY_JAINA_INTRO_3); + events.ScheduleEvent(EVENT_INTRO_A2_2, 5000); + break; + case EVENT_INTRO_A2_2: + Talk(SAY_JAINA_INTRO_4); + events.ScheduleEvent(EVENT_INTRO_A2_3, 10000); + break; + case EVENT_INTRO_A2_3: + pInstance->HandleGameObject(pInstance->GetData64(GO_FROSTMOURNE), true); + me->CastSpell(me, SPELL_FROSTMOURNE_SPAWN_SOUND, true); + me->CastSpell(me, SPELL_ARCANE_CAST_VISUAL, false); + events.ScheduleEvent(EVENT_INTRO_A2_4, 10000); + break; + case EVENT_INTRO_A2_4: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + { + pUther->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + pUther->SetVisible(true); + if (Aura* a = pUther->AddAura(SPELL_SHADOWMOURNE_VISUAL, pUther)) + a->SetDuration(8000); + } + events.ScheduleEvent(EVENT_INTRO_A2_5, 2000); + break; + case EVENT_INTRO_A2_5: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_A2_1); + events.ScheduleEvent(EVENT_INTRO_A2_6, 3000); + break; + case EVENT_INTRO_A2_6: + Talk(SAY_JAINA_INTRO_5); + events.ScheduleEvent(EVENT_INTRO_A2_7, 6000); + break; + case EVENT_INTRO_A2_7: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_A2_2); + events.ScheduleEvent(EVENT_INTRO_A2_8, 6500); + break; + case EVENT_INTRO_A2_8: + Talk(SAY_JAINA_INTRO_6); + events.ScheduleEvent(EVENT_INTRO_A2_9, 2000); + break; + case EVENT_INTRO_A2_9: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_A2_3); + events.ScheduleEvent(EVENT_INTRO_A2_10, 9000); + break; + case EVENT_INTRO_A2_10: + Talk(SAY_JAINA_INTRO_7); + events.ScheduleEvent(EVENT_INTRO_A2_11, 5000); + break; + case EVENT_INTRO_A2_11: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_A2_4); + events.ScheduleEvent(EVENT_INTRO_A2_12, 11000); + break; + case EVENT_INTRO_A2_12: + Talk(SAY_JAINA_INTRO_8); + events.ScheduleEvent(EVENT_INTRO_A2_13, 4000); + break; + case EVENT_INTRO_A2_13: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_A2_5); + events.ScheduleEvent(EVENT_INTRO_A2_14, 12500); + break; + case EVENT_INTRO_A2_14: + Talk(SAY_JAINA_INTRO_9); + events.ScheduleEvent(EVENT_INTRO_A2_15, 10000); + break; + case EVENT_INTRO_A2_15: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_A2_6); + events.ScheduleEvent(EVENT_INTRO_A2_16, 24000); + break; + case EVENT_INTRO_A2_16: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_A2_7); + events.ScheduleEvent(EVENT_INTRO_A2_17, 4000); + break; + case EVENT_INTRO_A2_17: + Talk(SAY_JAINA_INTRO_10); + events.ScheduleEvent(EVENT_INTRO_A2_18, 2000); + break; + case EVENT_INTRO_A2_18: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + { + pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); + pUther->AI()->Talk(SAY_UTHER_INTRO_A2_8); + } + events.ScheduleEvent(EVENT_INTRO_A2_19, 11000); + break; + case EVENT_INTRO_A2_19: + Talk(SAY_JAINA_INTRO_11); + events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); + break; - // H2 Intro Events - case EVENT_INTRO_H2_2: - Talk(SAY_SYLVANAS_INTRO_2); - events.ScheduleEvent(EVENT_INTRO_H2_3, 6000); - break; - case EVENT_INTRO_H2_3: - Talk(SAY_SYLVANAS_INTRO_3); - pInstance->HandleGameObject(pInstance->GetData64(GO_FROSTMOURNE), true); - me->CastSpell(me, SPELL_FROSTMOURNE_SPAWN_SOUND, true); - me->CastSpell(me, SPELL_ARCANE_CAST_VISUAL, false); - events.ScheduleEvent(EVENT_INTRO_H2_4, 6000); - break; - case EVENT_INTRO_H2_4: - if (Creature* pUther = pInstance->instance->GetCreature(pInstance->GetData64(NPC_UTHER))) - { - pUther->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - pUther->SetVisible(true); - if (Aura* a = pUther->AddAura(SPELL_SHADOWMOURNE_VISUAL, pUther)) - a->SetDuration(8000); - } - events.ScheduleEvent(EVENT_INTRO_H2_5, 2000); - break; - case EVENT_INTRO_H2_5: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_H2_1); - events.ScheduleEvent(EVENT_INTRO_H2_6, 11000); - break; - case EVENT_INTRO_H2_6: - Talk(SAY_SYLVANAS_INTRO_4); - events.ScheduleEvent(EVENT_INTRO_H2_7, 3000); - break; - case EVENT_INTRO_H2_7: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_H2_2); - events.ScheduleEvent(EVENT_INTRO_H2_8, 6000); - break; - case EVENT_INTRO_H2_8: - Talk(SAY_SYLVANAS_INTRO_5); - events.ScheduleEvent(EVENT_INTRO_H2_9, 5000); - break; - case EVENT_INTRO_H2_9: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_H2_3); - events.ScheduleEvent(EVENT_INTRO_H2_10, 19000); - break; - case EVENT_INTRO_H2_10: - Talk(SAY_SYLVANAS_INTRO_6); - events.ScheduleEvent(EVENT_INTRO_H2_11, 1500); - break; - case EVENT_INTRO_H2_11: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_H2_4); - events.ScheduleEvent(EVENT_INTRO_H2_12, 19500); - break; - case EVENT_INTRO_H2_12: - Talk(SAY_SYLVANAS_INTRO_7); - events.ScheduleEvent(EVENT_INTRO_H2_13, 2000); - break; - case EVENT_INTRO_H2_13: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - { - pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); - pUther->AI()->Talk(SAY_UTHER_INTRO_H2_5); - } - events.ScheduleEvent(EVENT_INTRO_H2_14, 12000); - break; - case EVENT_INTRO_H2_14: - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->AI()->Talk(SAY_UTHER_INTRO_H2_6); - events.ScheduleEvent(EVENT_INTRO_H2_15, 8000); - break; - case EVENT_INTRO_H2_15: - Talk(SAY_SYLVANAS_INTRO_8); - events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); - break; + // H2 Intro Events + case EVENT_INTRO_H2_2: + Talk(SAY_SYLVANAS_INTRO_2); + events.ScheduleEvent(EVENT_INTRO_H2_3, 6000); + break; + case EVENT_INTRO_H2_3: + Talk(SAY_SYLVANAS_INTRO_3); + pInstance->HandleGameObject(pInstance->GetData64(GO_FROSTMOURNE), true); + me->CastSpell(me, SPELL_FROSTMOURNE_SPAWN_SOUND, true); + me->CastSpell(me, SPELL_ARCANE_CAST_VISUAL, false); + events.ScheduleEvent(EVENT_INTRO_H2_4, 6000); + break; + case EVENT_INTRO_H2_4: + if (Creature* pUther = pInstance->instance->GetCreature(pInstance->GetData64(NPC_UTHER))) + { + pUther->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + pUther->SetVisible(true); + if (Aura* a = pUther->AddAura(SPELL_SHADOWMOURNE_VISUAL, pUther)) + a->SetDuration(8000); + } + events.ScheduleEvent(EVENT_INTRO_H2_5, 2000); + break; + case EVENT_INTRO_H2_5: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_H2_1); + events.ScheduleEvent(EVENT_INTRO_H2_6, 11000); + break; + case EVENT_INTRO_H2_6: + Talk(SAY_SYLVANAS_INTRO_4); + events.ScheduleEvent(EVENT_INTRO_H2_7, 3000); + break; + case EVENT_INTRO_H2_7: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_H2_2); + events.ScheduleEvent(EVENT_INTRO_H2_8, 6000); + break; + case EVENT_INTRO_H2_8: + Talk(SAY_SYLVANAS_INTRO_5); + events.ScheduleEvent(EVENT_INTRO_H2_9, 5000); + break; + case EVENT_INTRO_H2_9: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_H2_3); + events.ScheduleEvent(EVENT_INTRO_H2_10, 19000); + break; + case EVENT_INTRO_H2_10: + Talk(SAY_SYLVANAS_INTRO_6); + events.ScheduleEvent(EVENT_INTRO_H2_11, 1500); + break; + case EVENT_INTRO_H2_11: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_H2_4); + events.ScheduleEvent(EVENT_INTRO_H2_12, 19500); + break; + case EVENT_INTRO_H2_12: + Talk(SAY_SYLVANAS_INTRO_7); + events.ScheduleEvent(EVENT_INTRO_H2_13, 2000); + break; + case EVENT_INTRO_H2_13: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + { + pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); + pUther->AI()->Talk(SAY_UTHER_INTRO_H2_5); + } + events.ScheduleEvent(EVENT_INTRO_H2_14, 12000); + break; + case EVENT_INTRO_H2_14: + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->AI()->Talk(SAY_UTHER_INTRO_H2_6); + events.ScheduleEvent(EVENT_INTRO_H2_15, 8000); + break; + case EVENT_INTRO_H2_15: + Talk(SAY_SYLVANAS_INTRO_8); + events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); + break; - // Remaining Intro Events common for both faction - case EVENT_INTRO_LK_1: - if (Creature* pLichKing = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_EVENT))) - { - pInstance->HandleGameObject(pInstance->GetData64(GO_ARTHAS_DOOR), true); - pLichKing->SetVisible(true); - pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos, false); - } + // Remaining Intro Events common for both faction + case EVENT_INTRO_LK_1: + if (Creature* pLichKing = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_EVENT))) + { + pInstance->HandleGameObject(pInstance->GetData64(GO_ARTHAS_DOOR), true); + pLichKing->SetVisible(true); + pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos, false); + } - if (!shortver) - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - { - if (me->GetEntry() == NPC_JAINA_PART1) - pUther->AI()->Talk(SAY_UTHER_INTRO_A2_9); - else - pUther->AI()->Talk(SAY_UTHER_INTRO_H2_7); - } + if (!shortver) + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + { + if (me->GetEntry() == NPC_JAINA_PART1) + pUther->AI()->Talk(SAY_UTHER_INTRO_A2_9); + else + pUther->AI()->Talk(SAY_UTHER_INTRO_H2_7); + } - events.ScheduleEvent(EVENT_INTRO_LK_1_2, 2000); - events.ScheduleEvent(EVENT_INTRO_LK_1_3, 4000); - events.ScheduleEvent(EVENT_INTRO_LK_2, 11000); - break; + events.ScheduleEvent(EVENT_INTRO_LK_1_2, 2000); + events.ScheduleEvent(EVENT_INTRO_LK_1_3, 4000); + events.ScheduleEvent(EVENT_INTRO_LK_2, 11000); + break; - case EVENT_INTRO_LK_1_2: - if (!shortver) - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_COWER); - break; + case EVENT_INTRO_LK_1_2: + if (!shortver) + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_COWER); + break; - case EVENT_INTRO_LK_1_3: - pInstance->HandleGameObject(pInstance->GetData64(GO_ARTHAS_DOOR), false); - break; + case EVENT_INTRO_LK_1_3: + pInstance->HandleGameObject(pInstance->GetData64(GO_ARTHAS_DOOR), false); + break; - case EVENT_INTRO_LK_2: - if (!shortver) - if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) - pLichKing->AI()->Talk(SAY_LK_INTRO_1); - events.ScheduleEvent(EVENT_INTRO_LK_3, 2000); - break; + case EVENT_INTRO_LK_2: + if (!shortver) + if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) + pLichKing->AI()->Talk(SAY_LK_INTRO_1); + events.ScheduleEvent(EVENT_INTRO_LK_3, 2000); + break; - case EVENT_INTRO_LK_3: - if (!shortver) - if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) - pUther->SetVisible(false); - events.ScheduleEvent(EVENT_INTRO_LK_4, 4000); - break; + case EVENT_INTRO_LK_3: + if (!shortver) + if (Creature* pUther = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_UTHER))) + pUther->SetVisible(false); + events.ScheduleEvent(EVENT_INTRO_LK_4, 4000); + break; - case EVENT_INTRO_LK_4: - if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) - pLichKing->AI()->Talk(SAY_LK_INTRO_2); - events.ScheduleEvent(EVENT_INTRO_LK_4_2, 10000); - break; + case EVENT_INTRO_LK_4: + if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) + pLichKing->AI()->Talk(SAY_LK_INTRO_2); + events.ScheduleEvent(EVENT_INTRO_LK_4_2, 10000); + break; - case EVENT_INTRO_LK_4_2: - if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) - { - pLichKing->LoadEquipment(1, true); - pLichKing->SendMovementFlagUpdate(); - pLichKing->CastSpell(pLichKing, SPELL_FROSTMOURNE_EQUIP, false); - pInstance->HandleGameObject(pInstance->GetData64(GO_FROSTMOURNE), false); - events.ScheduleEvent(EVENT_INTRO_LK_4_3, 1750); - } - events.ScheduleEvent(EVENT_INTRO_LK_5, 6000); - break; + case EVENT_INTRO_LK_4_2: + if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) + { + pLichKing->LoadEquipment(1, true); + pLichKing->SendMovementFlagUpdate(); + pLichKing->CastSpell(pLichKing, SPELL_FROSTMOURNE_EQUIP, false); + pInstance->HandleGameObject(pInstance->GetData64(GO_FROSTMOURNE), false); + events.ScheduleEvent(EVENT_INTRO_LK_4_3, 1750); + } + events.ScheduleEvent(EVENT_INTRO_LK_5, 6000); + break; - case EVENT_INTRO_LK_4_3: - if (GameObject* go = pInstance->instance->GetGameObject(pInstance->GetData64(GO_FROSTMOURNE))) - go->SetPhaseMask(2, true); - break; - case EVENT_INTRO_LK_5: - if (Creature* pFalric = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - { - pFalric->UpdatePosition(5274.9f, 2039.2f, 709.319f, 5.4619f, true); - pFalric->StopMovingOnCurrentPos(); - pFalric->SetVisible(true); - if (pFalric->IsAlive()) - { - pFalric->GetMotionMaster()->MovePoint(0, FalricMovePos); - if (Aura* a = pFalric->AddAura(SPELL_SHADOWMOURNE_VISUAL, pFalric)) - a->SetDuration(8000); - } - } - if (Creature* pMarwyn = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) - { - pMarwyn->UpdatePosition(5343.77f, 1973.86f, 709.319f, 2.35173f, true); - pMarwyn->StopMovingOnCurrentPos(); - pMarwyn->SetVisible(true); - if (pMarwyn->IsAlive()) - { - pMarwyn->GetMotionMaster()->MovePoint(0, MarwynMovePos); - if (Aura* a = pMarwyn->AddAura(SPELL_SHADOWMOURNE_VISUAL, pMarwyn)) - a->SetDuration(8000); - } - } + case EVENT_INTRO_LK_4_3: + if (GameObject* go = pInstance->instance->GetGameObject(pInstance->GetData64(GO_FROSTMOURNE))) + go->SetPhaseMask(2, true); + break; + case EVENT_INTRO_LK_5: + if (Creature* pFalric = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + { + pFalric->UpdatePosition(5274.9f, 2039.2f, 709.319f, 5.4619f, true); + pFalric->StopMovingOnCurrentPos(); + pFalric->SetVisible(true); + if (pFalric->IsAlive()) + { + pFalric->GetMotionMaster()->MovePoint(0, FalricMovePos); + if (Aura* a = pFalric->AddAura(SPELL_SHADOWMOURNE_VISUAL, pFalric)) + a->SetDuration(8000); + } + } + if (Creature* pMarwyn = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) + { + pMarwyn->UpdatePosition(5343.77f, 1973.86f, 709.319f, 2.35173f, true); + pMarwyn->StopMovingOnCurrentPos(); + pMarwyn->SetVisible(true); + if (pMarwyn->IsAlive()) + { + pMarwyn->GetMotionMaster()->MovePoint(0, MarwynMovePos); + if (Aura* a = pMarwyn->AddAura(SPELL_SHADOWMOURNE_VISUAL, pMarwyn)) + a->SetDuration(8000); + } + } - if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) - pLichKing->AI()->Talk(SAY_LK_INTRO_3); + if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) + pLichKing->AI()->Talk(SAY_LK_INTRO_3); - events.ScheduleEvent(EVENT_INTRO_LK_5_2, 5000); - events.ScheduleEvent(EVENT_INTRO_LK_6, 8000); - break; + events.ScheduleEvent(EVENT_INTRO_LK_5_2, 5000); + events.ScheduleEvent(EVENT_INTRO_LK_6, 8000); + break; - case EVENT_INTRO_LK_5_2: - if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) - pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveAwayPos, false); - break; + case EVENT_INTRO_LK_5_2: + if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) + pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveAwayPos, false); + break; - case EVENT_INTRO_LK_6: - if (Creature* pFalric = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - pFalric->AI()->Talk(SAY_FALRIC_INTRO_1); + case EVENT_INTRO_LK_6: + if (Creature* pFalric = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + pFalric->AI()->Talk(SAY_FALRIC_INTRO_1); - events.ScheduleEvent(EVENT_INTRO_LK_7, 2000); - break; + events.ScheduleEvent(EVENT_INTRO_LK_7, 2000); + break; - case EVENT_INTRO_LK_7: - if (Creature* pMarwyn = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) - pMarwyn->AI()->Talk(SAY_MARWYN_INTRO_1); + case EVENT_INTRO_LK_7: + if (Creature* pMarwyn = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) + pMarwyn->AI()->Talk(SAY_MARWYN_INTRO_1); - events.ScheduleEvent(EVENT_INTRO_LK_8, 2000); - break; + events.ScheduleEvent(EVENT_INTRO_LK_8, 2000); + break; - case EVENT_INTRO_LK_8: - if (Creature* pFalric = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - pFalric->AI()->Talk(SAY_FALRIC_INTRO_2); - pInstance->SetData(ACTION_SHOW_TRASH, 1); + case EVENT_INTRO_LK_8: + if (Creature* pFalric = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + pFalric->AI()->Talk(SAY_FALRIC_INTRO_2); + pInstance->SetData(ACTION_SHOW_TRASH, 1); - pInstance->HandleGameObject(pInstance->GetData64(GO_ARTHAS_DOOR), true); + pInstance->HandleGameObject(pInstance->GetData64(GO_ARTHAS_DOOR), true); - events.ScheduleEvent(EVENT_INTRO_LK_9, 5000); - break; + events.ScheduleEvent(EVENT_INTRO_LK_9, 5000); + break; - case EVENT_INTRO_LK_9: - if (me->GetEntry() == NPC_JAINA_PART1) - Talk(SAY_JAINA_INTRO_END); - else - Talk(SAY_SYLVANAS_INTRO_END); + case EVENT_INTRO_LK_9: + if (me->GetEntry() == NPC_JAINA_PART1) + Talk(SAY_JAINA_INTRO_END); + else + Talk(SAY_SYLVANAS_INTRO_END); - me->GetMotionMaster()->MovePoint(0, LichKingMoveAwayPos, false); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DARK_RANGER_LORALEN))) - c->GetMotionMaster()->MovePoint(0, LichKingMoveAwayPos, false); - events.ScheduleEvent(EVENT_INTRO_END, 14000); - break; + me->GetMotionMaster()->MovePoint(0, LichKingMoveAwayPos, false); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DARK_RANGER_LORALEN))) + c->GetMotionMaster()->MovePoint(0, LichKingMoveAwayPos, false); + events.ScheduleEvent(EVENT_INTRO_END, 14000); + break; - case EVENT_INTRO_END: - pInstance->HandleGameObject(pInstance->GetData64(GO_ARTHAS_DOOR), false); - pInstance->HandleGameObject(pInstance->GetData64(GO_FRONT_DOOR), false); - events.ScheduleEvent(EVENT_INTRO_END_SET, 10000); - break; - case EVENT_INTRO_END_SET: - if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) - pLichKing->SetVisible(false); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DARK_RANGER_LORALEN))) - c->SetVisible(false); - me->SetVisible(false); - pInstance->SetData(DATA_INTRO, DONE); - break; - } - } - }; + case EVENT_INTRO_END: + pInstance->HandleGameObject(pInstance->GetData64(GO_ARTHAS_DOOR), false); + pInstance->HandleGameObject(pInstance->GetData64(GO_FRONT_DOOR), false); + events.ScheduleEvent(EVENT_INTRO_END_SET, 10000); + break; + case EVENT_INTRO_END_SET: + if (Creature* pLichKing = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_LICH_KING_EVENT))) + pLichKing->SetVisible(false); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_DARK_RANGER_LORALEN))) + c->SetVisible(false); + me->SetVisible(false); + pInstance->SetData(DATA_INTRO, DONE); + break; + } + } + }; }; enum TrashSpells { - // Ghostly Priest - SPELL_SHADOW_WORD_PAIN = 72318, - SPELL_CIRCLE_OF_DESTRUCTION = 72320, - SPELL_COWER_IN_FEAR = 72321, - SPELL_DARK_MENDING = 72322, + // Ghostly Priest + SPELL_SHADOW_WORD_PAIN = 72318, + SPELL_CIRCLE_OF_DESTRUCTION = 72320, + SPELL_COWER_IN_FEAR = 72321, + SPELL_DARK_MENDING = 72322, - // Phantom Mage - SPELL_FIREBALL = 72163, - SPELL_FLAMESTRIKE = 72169, - SPELL_FROSTBOLT = 72166, - SPELL_CHAINS_OF_ICE = 72120, - SPELL_HALLUCINATION = 72342, + // Phantom Mage + SPELL_FIREBALL = 72163, + SPELL_FLAMESTRIKE = 72169, + SPELL_FROSTBOLT = 72166, + SPELL_CHAINS_OF_ICE = 72120, + SPELL_HALLUCINATION = 72342, - // Phantom Hallucination (same as phantom mage + HALLUCINATION_2 when dies) - SPELL_HALLUCINATION_2 = 72344, + // Phantom Hallucination (same as phantom mage + HALLUCINATION_2 when dies) + SPELL_HALLUCINATION_2 = 72344, - // Shadowy Mercenary - SPELL_SHADOW_STEP = 72326, - SPELL_DEADLY_POISON = 72329, - SPELL_ENVENOMED_DAGGER_THROW = 72333, - SPELL_KIDNEY_SHOT = 72335, + // Shadowy Mercenary + SPELL_SHADOW_STEP = 72326, + SPELL_DEADLY_POISON = 72329, + SPELL_ENVENOMED_DAGGER_THROW = 72333, + SPELL_KIDNEY_SHOT = 72335, - // Spectral Footman - SPELL_SPECTRAL_STRIKE = 72198, - SPELL_SHIELD_BASH = 72194, - SPELL_TORTURED_ENRAGE = 72203, + // Spectral Footman + SPELL_SPECTRAL_STRIKE = 72198, + SPELL_SHIELD_BASH = 72194, + SPELL_TORTURED_ENRAGE = 72203, - // Tortured Rifleman - SPELL_SHOOT = 72208, - SPELL_CURSED_ARROW = 72222, - SPELL_FROST_TRAP = 72215, - SPELL_ICE_SHOT = 72268, + // Tortured Rifleman + SPELL_SHOOT = 72208, + SPELL_CURSED_ARROW = 72222, + SPELL_FROST_TRAP = 72215, + SPELL_ICE_SHOT = 72268, }; enum TrashEvents { - EVENT_TRASH_NONE, + EVENT_TRASH_NONE, - // Ghostly Priest - EVENT_SHADOW_WORD_PAIN, - EVENT_CIRCLE_OF_DESTRUCTION, - EVENT_COWER_IN_FEAR, - EVENT_DARK_MENDING, + // Ghostly Priest + EVENT_SHADOW_WORD_PAIN, + EVENT_CIRCLE_OF_DESTRUCTION, + EVENT_COWER_IN_FEAR, + EVENT_DARK_MENDING, - // Phantom Mage - EVENT_FIREBALL, - EVENT_FLAMESTRIKE, - EVENT_FROSTBOLT, - EVENT_CHAINS_OF_ICE, - EVENT_HALLUCINATION, + // Phantom Mage + EVENT_FIREBALL, + EVENT_FLAMESTRIKE, + EVENT_FROSTBOLT, + EVENT_CHAINS_OF_ICE, + EVENT_HALLUCINATION, - // Shadowy Mercenary - EVENT_SHADOW_STEP, - EVENT_DEADLY_POISON, - EVENT_ENVENOMED_DAGGER_THROW, - EVENT_KIDNEY_SHOT, + // Shadowy Mercenary + EVENT_SHADOW_STEP, + EVENT_DEADLY_POISON, + EVENT_ENVENOMED_DAGGER_THROW, + EVENT_KIDNEY_SHOT, - // Spectral Footman - EVENT_SPECTRAL_STRIKE, - EVENT_SHIELD_BASH, - EVENT_TORTURED_ENRAGE, + // Spectral Footman + EVENT_SPECTRAL_STRIKE, + EVENT_SHIELD_BASH, + EVENT_TORTURED_ENRAGE, - // Tortured Rifleman - EVENT_SHOOT, - EVENT_CURSED_ARROW, - EVENT_FROST_TRAP, - EVENT_ICE_SHOT, + // Tortured Rifleman + EVENT_SHOOT, + EVENT_CURSED_ARROW, + EVENT_FROST_TRAP, + EVENT_ICE_SHOT, }; class npc_ghostly_priest : public CreatureScript { public: - npc_ghostly_priest() : CreatureScript("npc_ghostly_priest") { } + npc_ghostly_priest() : CreatureScript("npc_ghostly_priest") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_ghostly_priestAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_ghostly_priestAI(creature); + } - struct npc_ghostly_priestAI: public ScriptedAI - { - npc_ghostly_priestAI(Creature* c) : ScriptedAI(c) {} + struct npc_ghostly_priestAI: public ScriptedAI + { + npc_ghostly_priestAI(Creature* c) : ScriptedAI(c) {} - EventMap events; + EventMap events; - void DoAction(int32 a) - { - if (a == 1) - { - me->SetInCombatWithZone(); - if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0f, true)) - AttackStart(target); - } - } + void DoAction(int32 a) + { + if (a == 1) + { + me->SetInCombatWithZone(); + if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0f, true)) + AttackStart(target); + } + } - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 5000); - events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 8000); - events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000); - events.ScheduleEvent(EVENT_DARK_MENDING, 8000); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 5000); + events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 8000); + events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000); + events.ScheduleEvent(EVENT_DARK_MENDING, 8000); + } - void AttackStart(Unit* who) - { - if (!me->IsVisible() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (!me->IsVisible() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; + ScriptedAI::AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SHADOW_WORD_PAIN: - if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) - me->CastSpell(target, SPELL_SHADOW_WORD_PAIN, false); - events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 5000); - break; - case EVENT_CIRCLE_OF_DESTRUCTION: - if (Unit* target = SelectTargetFromPlayerList(10.0f, 0, true)) - me->CastSpell(target, SPELL_CIRCLE_OF_DESTRUCTION, false); - events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 12000); - break; - case EVENT_COWER_IN_FEAR: - if (Unit* target = SelectTargetFromPlayerList(20.0f, 0, true)) - me->CastSpell(target, SPELL_COWER_IN_FEAR, false); - events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000); - break; - case EVENT_DARK_MENDING: - if (Unit* target = DoSelectLowestHpFriendly(35.0f, DUNGEON_MODE(20000, 35000))) - { - me->CastSpell(target, SPELL_DARK_MENDING, false); - events.ScheduleEvent(EVENT_DARK_MENDING, 6000); - } - else - events.ScheduleEvent(EVENT_DARK_MENDING, 3000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SHADOW_WORD_PAIN: + if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) + me->CastSpell(target, SPELL_SHADOW_WORD_PAIN, false); + events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 5000); + break; + case EVENT_CIRCLE_OF_DESTRUCTION: + if (Unit* target = SelectTargetFromPlayerList(10.0f, 0, true)) + me->CastSpell(target, SPELL_CIRCLE_OF_DESTRUCTION, false); + events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 12000); + break; + case EVENT_COWER_IN_FEAR: + if (Unit* target = SelectTargetFromPlayerList(20.0f, 0, true)) + me->CastSpell(target, SPELL_COWER_IN_FEAR, false); + events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000); + break; + case EVENT_DARK_MENDING: + if (Unit* target = DoSelectLowestHpFriendly(35.0f, DUNGEON_MODE(20000, 35000))) + { + me->CastSpell(target, SPELL_DARK_MENDING, false); + events.ScheduleEvent(EVENT_DARK_MENDING, 6000); + } + else + events.ScheduleEvent(EVENT_DARK_MENDING, 3000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + } + }; }; class npc_phantom_mage : public CreatureScript { public: - npc_phantom_mage() : CreatureScript("npc_phantom_mage") { } + npc_phantom_mage() : CreatureScript("npc_phantom_mage") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_phantom_mageAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_phantom_mageAI(creature); + } - struct npc_phantom_mageAI: public ScriptedAI - { - npc_phantom_mageAI(Creature* c) : ScriptedAI(c) {} + struct npc_phantom_mageAI: public ScriptedAI + { + npc_phantom_mageAI(Creature* c) : ScriptedAI(c) {} - EventMap events; + EventMap events; - void DoAction(int32 a) - { - if (a == 1) - { - me->SetInCombatWithZone(); - if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0f, true)) - AttackStart(target); - } - } + void DoAction(int32 a) + { + if (a == 1) + { + me->SetInCombatWithZone(); + if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0f, true)) + AttackStart(target); + } + } - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_FIREBALL, 3000); - events.ScheduleEvent(EVENT_FLAMESTRIKE, 6000); - events.ScheduleEvent(EVENT_FROSTBOLT, 9000); - events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 12000); - events.ScheduleEvent(EVENT_HALLUCINATION, 40000); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_FIREBALL, 3000); + events.ScheduleEvent(EVENT_FLAMESTRIKE, 6000); + events.ScheduleEvent(EVENT_FROSTBOLT, 9000); + events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 12000); + events.ScheduleEvent(EVENT_HALLUCINATION, 40000); + } - void AttackStart(Unit* who) - { - if (!me->IsVisible() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (!me->IsVisible() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; + ScriptedAI::AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_FIREBALL: - me->CastSpell(me->GetVictim(), SPELL_FIREBALL, false); - events.ScheduleEvent(EVENT_FIREBALL, 6000); - break; - case EVENT_FLAMESTRIKE: - me->CastSpell(me->GetVictim(), SPELL_FLAMESTRIKE, false); - events.ScheduleEvent(EVENT_FLAMESTRIKE, 15000); - break; - case EVENT_FROSTBOLT: - if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) - me->CastSpell(target, SPELL_FROSTBOLT, false); - events.ScheduleEvent(EVENT_FROSTBOLT, 9000); - break; - case EVENT_CHAINS_OF_ICE: - if (Unit* target = SelectTargetFromPlayerList(100.0f, 0, true)) - me->CastSpell(target, SPELL_CHAINS_OF_ICE, false); - events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 12000); - break; - case EVENT_HALLUCINATION: - //me->CastSpell(me, SPELL_HALLUCINATION, false); - me->SummonCreature(NPC_PHANTOM_HALLUCINATION, *me, TEMPSUMMON_TIMED_DESPAWN, 30000); - me->CastSpell(me, SPELL_HALLUCINATION+1, true); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_FIREBALL: + me->CastSpell(me->GetVictim(), SPELL_FIREBALL, false); + events.ScheduleEvent(EVENT_FIREBALL, 6000); + break; + case EVENT_FLAMESTRIKE: + me->CastSpell(me->GetVictim(), SPELL_FLAMESTRIKE, false); + events.ScheduleEvent(EVENT_FLAMESTRIKE, 15000); + break; + case EVENT_FROSTBOLT: + if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) + me->CastSpell(target, SPELL_FROSTBOLT, false); + events.ScheduleEvent(EVENT_FROSTBOLT, 9000); + break; + case EVENT_CHAINS_OF_ICE: + if (Unit* target = SelectTargetFromPlayerList(100.0f, 0, true)) + me->CastSpell(target, SPELL_CHAINS_OF_ICE, false); + events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 12000); + break; + case EVENT_HALLUCINATION: + //me->CastSpell(me, SPELL_HALLUCINATION, false); + me->SummonCreature(NPC_PHANTOM_HALLUCINATION, *me, TEMPSUMMON_TIMED_DESPAWN, 30000); + me->CastSpell(me, SPELL_HALLUCINATION+1, true); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + } + }; }; class npc_phantom_hallucination : public CreatureScript { public: - npc_phantom_hallucination() : CreatureScript("npc_phantom_hallucination") { } + npc_phantom_hallucination() : CreatureScript("npc_phantom_hallucination") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_phantom_hallucinationAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_phantom_hallucinationAI(creature); + } - struct npc_phantom_hallucinationAI : public npc_phantom_mage::npc_phantom_mageAI - { - npc_phantom_hallucinationAI(Creature* c) : npc_phantom_mage::npc_phantom_mageAI(c) - { - numOfUpd = 2; - } + struct npc_phantom_hallucinationAI : public npc_phantom_mage::npc_phantom_mageAI + { + npc_phantom_hallucinationAI(Creature* c) : npc_phantom_mage::npc_phantom_mageAI(c) + { + numOfUpd = 2; + } - uint8 numOfUpd; + uint8 numOfUpd; - void JustDied(Unit* /*who*/) - { - me->CastSpell((Unit*)NULL, SPELL_HALLUCINATION_2, false); - } + void JustDied(Unit* /*who*/) + { + me->CastSpell((Unit*)NULL, SPELL_HALLUCINATION_2, false); + } - void UpdateAI(uint32 diff) - { - if (numOfUpd) - { - if (--numOfUpd == 0) - me->SetInCombatWithZone(); - return; - } + void UpdateAI(uint32 diff) + { + if (numOfUpd) + { + if (--numOfUpd == 0) + me->SetInCombatWithZone(); + return; + } - npc_phantom_mageAI::UpdateAI(diff); - } + npc_phantom_mageAI::UpdateAI(diff); + } - void EnterEvadeMode() - { - if (numOfUpd) - return; + void EnterEvadeMode() + { + if (numOfUpd) + return; - ScriptedAI::EnterEvadeMode(); - if (me->IsSummon()) - me->ToTempSummon()->DespawnOrUnsummon(1); - } - }; + ScriptedAI::EnterEvadeMode(); + if (me->IsSummon()) + me->ToTempSummon()->DespawnOrUnsummon(1); + } + }; }; class npc_shadowy_mercenary : public CreatureScript { public: - npc_shadowy_mercenary() : CreatureScript("npc_shadowy_mercenary") { } + npc_shadowy_mercenary() : CreatureScript("npc_shadowy_mercenary") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_shadowy_mercenaryAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_shadowy_mercenaryAI(creature); + } - struct npc_shadowy_mercenaryAI: public ScriptedAI - { - npc_shadowy_mercenaryAI(Creature* c) : ScriptedAI(c) {} + struct npc_shadowy_mercenaryAI: public ScriptedAI + { + npc_shadowy_mercenaryAI(Creature* c) : ScriptedAI(c) {} - EventMap events; + EventMap events; - void DoAction(int32 a) - { - if (a == 1) - { - me->SetInCombatWithZone(); - if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0f, true)) - AttackStart(target); - } - } + void DoAction(int32 a) + { + if (a == 1) + { + me->SetInCombatWithZone(); + if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0f, true)) + AttackStart(target); + } + } - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SHADOW_STEP, 4000); - events.ScheduleEvent(EVENT_DEADLY_POISON, 6000); - events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000); - events.ScheduleEvent(EVENT_KIDNEY_SHOT, 5000); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SHADOW_STEP, 4000); + events.ScheduleEvent(EVENT_DEADLY_POISON, 6000); + events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000); + events.ScheduleEvent(EVENT_KIDNEY_SHOT, 5000); + } - void AttackStart(Unit* who) - { - if (!me->IsVisible() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (!me->IsVisible() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; + ScriptedAI::AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SHADOW_STEP: - if (Unit* target = SelectTargetFromPlayerList(100.0f, 0, true)) - { - DoResetThreat(); - me->AddThreat(target, 5000.0f); - AttackStart(target); - me->CastSpell(target, SPELL_SHADOW_STEP, false); - } - events.ScheduleEvent(EVENT_SHADOW_STEP, 20000); - break; - case EVENT_DEADLY_POISON: - me->CastSpell(me->GetVictim(), SPELL_DEADLY_POISON, false); - events.ScheduleEvent(EVENT_DEADLY_POISON, 4000); - break; - case EVENT_ENVENOMED_DAGGER_THROW: - if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) - me->CastSpell(target, SPELL_ENVENOMED_DAGGER_THROW, false); - events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000); - break; - case EVENT_KIDNEY_SHOT: - me->CastSpell(me->GetVictim(), SPELL_KIDNEY_SHOT, false); - events.ScheduleEvent(EVENT_KIDNEY_SHOT, 10000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SHADOW_STEP: + if (Unit* target = SelectTargetFromPlayerList(100.0f, 0, true)) + { + DoResetThreat(); + me->AddThreat(target, 5000.0f); + AttackStart(target); + me->CastSpell(target, SPELL_SHADOW_STEP, false); + } + events.ScheduleEvent(EVENT_SHADOW_STEP, 20000); + break; + case EVENT_DEADLY_POISON: + me->CastSpell(me->GetVictim(), SPELL_DEADLY_POISON, false); + events.ScheduleEvent(EVENT_DEADLY_POISON, 4000); + break; + case EVENT_ENVENOMED_DAGGER_THROW: + if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) + me->CastSpell(target, SPELL_ENVENOMED_DAGGER_THROW, false); + events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000); + break; + case EVENT_KIDNEY_SHOT: + me->CastSpell(me->GetVictim(), SPELL_KIDNEY_SHOT, false); + events.ScheduleEvent(EVENT_KIDNEY_SHOT, 10000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + } + }; }; class npc_spectral_footman : public CreatureScript { public: - npc_spectral_footman() : CreatureScript("npc_spectral_footman") { } + npc_spectral_footman() : CreatureScript("npc_spectral_footman") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_spectral_footmanAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_spectral_footmanAI(creature); + } - struct npc_spectral_footmanAI: public ScriptedAI - { - npc_spectral_footmanAI(Creature* c) : ScriptedAI(c) {} + struct npc_spectral_footmanAI: public ScriptedAI + { + npc_spectral_footmanAI(Creature* c) : ScriptedAI(c) {} - EventMap events; + EventMap events; - void DoAction(int32 a) - { - if (a == 1) - { - me->SetInCombatWithZone(); - if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0f, true)) - AttackStart(target); - } - } + void DoAction(int32 a) + { + if (a == 1) + { + me->SetInCombatWithZone(); + if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0f, true)) + AttackStart(target); + } + } - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); - events.ScheduleEvent(EVENT_SHIELD_BASH, 6000); - events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); + events.ScheduleEvent(EVENT_SHIELD_BASH, 6000); + events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); + } - void AttackStart(Unit* who) - { - if (!me->IsVisible() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (!me->IsVisible() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; + ScriptedAI::AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPECTRAL_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_SPECTRAL_STRIKE, false); - events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); - break; - case EVENT_SHIELD_BASH: - me->CastSpell(me->GetVictim(), SPELL_SHIELD_BASH, false); - events.ScheduleEvent(EVENT_SHIELD_BASH, 6000); - break; - case EVENT_TORTURED_ENRAGE: - me->CastSpell(me, SPELL_TORTURED_ENRAGE, false); - events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPECTRAL_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_SPECTRAL_STRIKE, false); + events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); + break; + case EVENT_SHIELD_BASH: + me->CastSpell(me->GetVictim(), SPELL_SHIELD_BASH, false); + events.ScheduleEvent(EVENT_SHIELD_BASH, 6000); + break; + case EVENT_TORTURED_ENRAGE: + me->CastSpell(me, SPELL_TORTURED_ENRAGE, false); + events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + } + }; }; class npc_tortured_rifleman : public CreatureScript { public: - npc_tortured_rifleman() : CreatureScript("npc_tortured_rifleman") { } + npc_tortured_rifleman() : CreatureScript("npc_tortured_rifleman") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_tortured_riflemanAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_tortured_riflemanAI(creature); + } - struct npc_tortured_riflemanAI : public ScriptedAI - { - npc_tortured_riflemanAI(Creature* c) : ScriptedAI(c) {} + struct npc_tortured_riflemanAI : public ScriptedAI + { + npc_tortured_riflemanAI(Creature* c) : ScriptedAI(c) {} - EventMap events; + EventMap events; - void DoAction(int32 a) - { - if (a == 1) - { - me->SetInCombatWithZone(); - if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0f, true)) - AttackStart(target); - } - } + void DoAction(int32 a) + { + if (a == 1) + { + me->SetInCombatWithZone(); + if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0f, true)) + AttackStart(target); + } + } - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_CURSED_ARROW, 10000); - events.ScheduleEvent(EVENT_FROST_TRAP, 15000); - events.ScheduleEvent(EVENT_ICE_SHOT, 15000); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_CURSED_ARROW, 10000); + events.ScheduleEvent(EVENT_FROST_TRAP, 15000); + events.ScheduleEvent(EVENT_ICE_SHOT, 15000); + } - void AttackStart(Unit* who) - { - if (!me->IsVisible() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (!me->IsVisible() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; + ScriptedAI::AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CURSED_ARROW: - me->CastSpell(me->GetVictim(), SPELL_CURSED_ARROW, false); - events.ScheduleEvent(EVENT_CURSED_ARROW, 10000); - break; - case EVENT_FROST_TRAP: - me->CastSpell((Unit*)NULL, SPELL_FROST_TRAP, false); - events.ScheduleEvent(EVENT_FROST_TRAP, 30000); - break; - case EVENT_ICE_SHOT: - if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) - me->CastSpell(target, SPELL_ICE_SHOT, false); - events.ScheduleEvent(EVENT_ICE_SHOT, 8000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_CURSED_ARROW: + me->CastSpell(me->GetVictim(), SPELL_CURSED_ARROW, false); + events.ScheduleEvent(EVENT_CURSED_ARROW, 10000); + break; + case EVENT_FROST_TRAP: + me->CastSpell((Unit*)NULL, SPELL_FROST_TRAP, false); + events.ScheduleEvent(EVENT_FROST_TRAP, 30000); + break; + case EVENT_ICE_SHOT: + if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) + me->CastSpell(target, SPELL_ICE_SHOT, false); + events.ScheduleEvent(EVENT_ICE_SHOT, 8000); + break; + } - DoSpellAttackIfReady(SPELL_SHOOT); - } + DoSpellAttackIfReady(SPELL_SHOOT); + } - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER)) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + } + }; }; class boss_frostsworn_general : public CreatureScript { public: - boss_frostsworn_general() : CreatureScript("boss_frostsworn_general") { } + boss_frostsworn_general() : CreatureScript("boss_frostsworn_general") { } - struct boss_frostsworn_generalAI : public ScriptedAI - { - boss_frostsworn_generalAI(Creature* creature) : ScriptedAI(creature) - { - pInstance = creature->GetInstanceScript(); - } + struct boss_frostsworn_generalAI : public ScriptedAI + { + boss_frostsworn_generalAI(Creature* creature) : ScriptedAI(creature) + { + pInstance = creature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - Talk(SAY_FROSTSWORN_GENERAL_AGGRO); - events.ScheduleEvent(EVENT_ACTIVATE_REFLECTIONS, 8000); - events.ScheduleEvent(EVENT_THROW_SHIELD, 6000); - pInstance->SetData(ACTION_SPIRITUAL_REFLECTIONS_COPY, 1); - } + void EnterCombat(Unit* /*who*/) + { + Talk(SAY_FROSTSWORN_GENERAL_AGGRO); + events.ScheduleEvent(EVENT_ACTIVATE_REFLECTIONS, 8000); + events.ScheduleEvent(EVENT_THROW_SHIELD, 6000); + pInstance->SetData(ACTION_SPIRITUAL_REFLECTIONS_COPY, 1); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - Position p = me->GetHomePosition(); - if (me->GetExactDist(&p) > 30.0f) - { - EnterEvadeMode(); - return; - } + Position p = me->GetHomePosition(); + if (me->GetExactDist(&p) > 30.0f) + { + EnterEvadeMode(); + return; + } - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ACTIVATE_REFLECTIONS: - me->CastSpell((Unit*)NULL, SPELL_SUMMON_REFLECTIONS_DUMMY, false); - pInstance->SetData(ACTION_SPIRITUAL_REFLECTIONS_ACTIVATE, 1); - break; - case EVENT_THROW_SHIELD: - if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) - me->CastSpell(target, SPELL_THROW_SHIELD, false); - events.ScheduleEvent(EVENT_THROW_SHIELD, 10000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_ACTIVATE_REFLECTIONS: + me->CastSpell((Unit*)NULL, SPELL_SUMMON_REFLECTIONS_DUMMY, false); + pInstance->SetData(ACTION_SPIRITUAL_REFLECTIONS_ACTIVATE, 1); + break; + case EVENT_THROW_SHIELD: + if (Unit* target = SelectTargetFromPlayerList(40.0f, 0, true)) + me->CastSpell(target, SPELL_THROW_SHIELD, false); + events.ScheduleEvent(EVENT_THROW_SHIELD, 10000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_FROSTSWORN_GENERAL_DEATH); - if (pInstance) - pInstance->SetData(DATA_FROSTSWORN_GENERAL, DONE); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_FROSTSWORN_GENERAL_DEATH); + if (pInstance) + pInstance->SetData(DATA_FROSTSWORN_GENERAL, DONE); + } - void EnterEvadeMode() - { - pInstance->SetData(ACTION_SPIRITUAL_REFLECTIONS_HIDE, 1); - ScriptedAI::EnterEvadeMode(); - } - }; + void EnterEvadeMode() + { + pInstance->SetData(ACTION_SPIRITUAL_REFLECTIONS_HIDE, 1); + ScriptedAI::EnterEvadeMode(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_frostsworn_generalAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_frostsworn_generalAI(creature); + } }; class npc_hor_spiritual_reflection : public CreatureScript { public: - npc_hor_spiritual_reflection() : CreatureScript("npc_hor_spiritual_reflection") { } + npc_hor_spiritual_reflection() : CreatureScript("npc_hor_spiritual_reflection") { } - struct npc_hor_spiritual_reflectionAI : public ScriptedAI - { - npc_hor_spiritual_reflectionAI(Creature* creature) : ScriptedAI(creature) - { - } + struct npc_hor_spiritual_reflectionAI : public ScriptedAI + { + npc_hor_spiritual_reflectionAI(Creature* creature) : ScriptedAI(creature) + { + } - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_BALEFUL_STRIKE, urand(4000, 7000)); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_BALEFUL_STRIKE, urand(4000, 7000)); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_BALEFUL_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_BALEFUL_STRIKE, false); - events.ScheduleEvent(EVENT_BALEFUL_STRIKE, urand(4000,7000)); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_BALEFUL_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_BALEFUL_STRIKE, false); + events.ScheduleEvent(EVENT_BALEFUL_STRIKE, urand(4000,7000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - me->CastSpell((Unit*)NULL, SPELL_SPIRIT_BURST, false); - } + void JustDied(Unit* /*killer*/) + { + me->CastSpell((Unit*)NULL, SPELL_SPIRIT_BURST, false); + } - void EnterEvadeMode() - { - me->UpdatePosition(me->GetHomePosition(), true); - ScriptedAI::EnterEvadeMode(); - me->SetVisible(false); - } - }; + void EnterEvadeMode() + { + me->UpdatePosition(me->GetHomePosition(), true); + ScriptedAI::EnterEvadeMode(); + me->SetVisible(false); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_hor_spiritual_reflectionAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_hor_spiritual_reflectionAI(creature); + } }; class at_hor_shadow_throne : public AreaTriggerScript { - public: - at_hor_shadow_throne() : AreaTriggerScript("at_hor_shadow_throne") { } + public: + at_hor_shadow_throne() : AreaTriggerScript("at_hor_shadow_throne") { } - bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) - { - if (player->IsGameMaster()) - return false; + bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) + { + if (player->IsGameMaster()) + return false; - InstanceScript* inst = player->GetInstanceScript(); - if (!inst) - return false; + InstanceScript* inst = player->GetInstanceScript(); + if (!inst) + return false; - if (inst->GetData(DATA_FROSTSWORN_GENERAL) && !inst->GetData(DATA_LK_INTRO)) - inst->SetData(DATA_LK_INTRO, DONE); + if (inst->GetData(DATA_FROSTSWORN_GENERAL) && !inst->GetData(DATA_LK_INTRO)) + inst->SetData(DATA_LK_INTRO, DONE); - return false; - } + return false; + } }; enum eFightEvents { - EVENT_EMPTY = 0, - EVENT_LK_SAY_AGGRO, - EVENT_JAINA_IMMOBILIZE_LK, - EVENT_SYLVANAS_IMMOBILIZE_JUMP, - EVENT_SYLVANAS_DARK_BINDING, - EVENT_SAY_LEAVE, - EVENT_ADD_GOSSIP, - EVENT_START_RUN, - EVENT_LK_START_FOLLOWING, - EVENT_SAY_LEADER_STOP_TEXT, - EVENT_LK_REMORSELESS_WINTER, - EVENT_LK_CHECK_COMBAT, - EVENT_LK_KILL_LEADER, - EVENT_LK_SUMMON, - EVENT_LK_SUMMON_GHOULS, - EVENT_LK_SUMMON_RWD, - EVENT_LK_SUMMON_LA, - EVENT_LK_SUMMON_NEXT_ICE_WALL, - EVENT_SAY_OPENING, - EVENT_DECREASE_REQ_COUNT_BY_100, + EVENT_EMPTY = 0, + EVENT_LK_SAY_AGGRO, + EVENT_JAINA_IMMOBILIZE_LK, + EVENT_SYLVANAS_IMMOBILIZE_JUMP, + EVENT_SYLVANAS_DARK_BINDING, + EVENT_SAY_LEAVE, + EVENT_ADD_GOSSIP, + EVENT_START_RUN, + EVENT_LK_START_FOLLOWING, + EVENT_SAY_LEADER_STOP_TEXT, + EVENT_LK_REMORSELESS_WINTER, + EVENT_LK_CHECK_COMBAT, + EVENT_LK_KILL_LEADER, + EVENT_LK_SUMMON, + EVENT_LK_SUMMON_GHOULS, + EVENT_LK_SUMMON_RWD, + EVENT_LK_SUMMON_LA, + EVENT_LK_SUMMON_NEXT_ICE_WALL, + EVENT_SAY_OPENING, + EVENT_DECREASE_REQ_COUNT_BY_100, }; class npc_hor_lich_king : public CreatureScript { public: - npc_hor_lich_king() : CreatureScript("npc_hor_lich_king") { } + npc_hor_lich_king() : CreatureScript("npc_hor_lich_king") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_hor_lich_kingAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_hor_lich_kingAI(creature); + } - struct npc_hor_lich_kingAI : public NullCreatureAI - { - npc_hor_lich_kingAI(Creature* creature) : NullCreatureAI(creature), summons(me) - { - pInstance = me->GetInstanceScript(); - if (!pInstance) - me->IsAIEnabled = false; - } + struct npc_hor_lich_kingAI : public NullCreatureAI + { + npc_hor_lich_kingAI(Creature* creature) : NullCreatureAI(creature), summons(me) + { + pInstance = me->GetInstanceScript(); + if (!pInstance) + me->IsAIEnabled = false; + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint8 currentWall; - uint8 reqKillCount; - uint8 div2; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint8 currentWall; + uint8 reqKillCount; + uint8 div2; - void Reset() - { - currentWall = 0; - reqKillCount = 0; - events.Reset(); - events.RescheduleEvent(EVENT_LK_CHECK_COMBAT, 1000); - } + void Reset() + { + currentWall = 0; + reqKillCount = 0; + events.Reset(); + events.RescheduleEvent(EVENT_LK_CHECK_COMBAT, 1000); + } - void DoAction(int32 a) - { - if (a == ACTION_START_LK_FIGHT_REAL) - events.ScheduleEvent(EVENT_LK_START_FOLLOWING, 1500); - else if ((a == ACTION_INFORM_TRASH_DIED && reqKillCount) || a == ACTION_CHECK_TRASH_DIED) - { - if ((a == ACTION_CHECK_TRASH_DIED && reqKillCount == 0) || (a == ACTION_INFORM_TRASH_DIED && (--reqKillCount) == 0)) - { - events.CancelEvent(EVENT_DECREASE_REQ_COUNT_BY_100); // just in case, magic happens sometimes - ++currentWall; - pInstance->SetData(ACTION_DELETE_ICE_WALL, 1); - if (currentWall <= 3) - { - events.ScheduleEvent(EVENT_LK_SUMMON_NEXT_ICE_WALL, 1000); - events.ScheduleEvent(EVENT_LK_SUMMON, currentWall == 3 ? 11000 : 7500); - } - else - me->RemoveAura(SPELL_REMORSELESS_WINTER); + void DoAction(int32 a) + { + if (a == ACTION_START_LK_FIGHT_REAL) + events.ScheduleEvent(EVENT_LK_START_FOLLOWING, 1500); + else if ((a == ACTION_INFORM_TRASH_DIED && reqKillCount) || a == ACTION_CHECK_TRASH_DIED) + { + if ((a == ACTION_CHECK_TRASH_DIED && reqKillCount == 0) || (a == ACTION_INFORM_TRASH_DIED && (--reqKillCount) == 0)) + { + events.CancelEvent(EVENT_DECREASE_REQ_COUNT_BY_100); // just in case, magic happens sometimes + ++currentWall; + pInstance->SetData(ACTION_DELETE_ICE_WALL, 1); + if (currentWall <= 3) + { + events.ScheduleEvent(EVENT_LK_SUMMON_NEXT_ICE_WALL, 1000); + events.ScheduleEvent(EVENT_LK_SUMMON, currentWall == 3 ? 11000 : 7500); + } + else + me->RemoveAura(SPELL_REMORSELESS_WINTER); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_SYLVANAS_PART2))) - c->AI()->DoAction(ACTION_INFORM_WALL_DESTROYED); - } - } - } + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_SYLVANAS_PART2))) + c->AI()->DoAction(ACTION_INFORM_WALL_DESTROYED); + } + } + } - void MovementInform(uint32 type, uint32 id) - { - // Xinef: dont use 0, it is no longer the last point - // Xinef: if type is escort and spline is finalized, it means that we reached last point from the path - if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized()) - { - if (currentWall == 0) - { - Talk(SAY_LK_IW_1); - me->SetOrientation(4.15f); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_ICE_WALL_TARGET))) - { - me->CastSpell(c, SPELL_SUMMON_ICE_WALL, false); - events.ScheduleEvent(EVENT_LK_REMORSELESS_WINTER, 4000); - } - } - else if (currentWall == 4) - { - Talk(SAY_LK_NOWHERE_TO_RUN); - pInstance->SetData(DATA_LICH_KING, DONE); - } - } - } + void MovementInform(uint32 type, uint32 id) + { + // Xinef: dont use 0, it is no longer the last point + // Xinef: if type is escort and spline is finalized, it means that we reached last point from the path + if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized()) + { + if (currentWall == 0) + { + Talk(SAY_LK_IW_1); + me->SetOrientation(4.15f); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_ICE_WALL_TARGET))) + { + me->CastSpell(c, SPELL_SUMMON_ICE_WALL, false); + events.ScheduleEvent(EVENT_LK_REMORSELESS_WINTER, 4000); + } + } + else if (currentWall == 4) + { + Talk(SAY_LK_NOWHERE_TO_RUN); + pInstance->SetData(DATA_LICH_KING, DONE); + } + } + } - void JustSummoned(Creature* s) - { - ++reqKillCount; - if (events.GetNextEventTime(EVENT_DECREASE_REQ_COUNT_BY_100)) - events.RescheduleEvent(EVENT_DECREASE_REQ_COUNT_BY_100, 10000); - summons.Summon(s); - s->SetHomePosition(PathWaypoints[WP_STOP[currentWall+1]]); - s->GetMotionMaster()->MovePoint(0, PathWaypoints[WP_STOP[currentWall+1]]); - s->SetInCombatWithZone(); - if (Unit* target = s->SelectNearestPlayer(350.0f)) - { - s->AddThreat(target, 1000.0f); - s->AI()->AttackStart(target); - } - s->SetHomePosition(PathWaypoints[WP_STOP[currentWall+1]]); - } + void JustSummoned(Creature* s) + { + ++reqKillCount; + if (events.GetNextEventTime(EVENT_DECREASE_REQ_COUNT_BY_100)) + events.RescheduleEvent(EVENT_DECREASE_REQ_COUNT_BY_100, 10000); + summons.Summon(s); + s->SetHomePosition(PathWaypoints[WP_STOP[currentWall+1]]); + s->GetMotionMaster()->MovePoint(0, PathWaypoints[WP_STOP[currentWall+1]]); + s->SetInCombatWithZone(); + if (Unit* target = s->SelectNearestPlayer(350.0f)) + { + s->AddThreat(target, 1000.0f); + s->AI()->AttackStart(target); + } + s->SetHomePosition(PathWaypoints[WP_STOP[currentWall+1]]); + } - void SummonedCreatureDespawn(Creature* s) - { - summons.Despawn(s); - } + void SummonedCreatureDespawn(Creature* s) + { + summons.Despawn(s); + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (target && target->IsAlive() && spell->Id == SPELL_LICH_KING_ZAP_PLAYER) - Unit::DealDamage(me, target, 10000); - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (target && target->IsAlive() && spell->Id == SPELL_LICH_KING_ZAP_PLAYER) + Unit::DealDamage(me, target, 10000); + } - void UpdateAI(uint32 diff) - { - if (me->HealthBelowPct(70)) - me->SetHealth(me->GetMaxHealth()*3/4); + void UpdateAI(uint32 diff) + { + if (me->HealthBelowPct(70)) + me->SetHealth(me->GetMaxHealth()*3/4); - events.Update(diff); - - if (me->IsNonMeleeSpellCast(false, true, true)) - return; + events.Update(diff); + + if (me->IsNonMeleeSpellCast(false, true, true)) + return; - switch(events.ExecuteEvent()) - { - case EVENT_LK_CHECK_COMBAT: - if (me->isActiveObject()) // during fight - { - if (Creature* leader = pInstance->instance->GetCreature(pInstance->GetData64(NPC_SYLVANAS_PART2))) - if (leader->IsAlive() && leader->GetPositionX() < 5575.0f && me->GetExactDist2d(leader) <= 12.5f && !leader->HasAura(SPELL_HARVEST_SOUL) && me->HasAura(SPELL_REMORSELESS_WINTER)) - { - me->GetMotionMaster()->MovementExpired(); - me->StopMoving(); - reqKillCount = 255; - leader->InterruptNonMeleeSpells(true); - me->CastSpell(leader, SPELL_HARVEST_SOUL, false); - events.ScheduleEvent(EVENT_LK_KILL_LEADER, 3000); - events.ScheduleEvent(EVENT_LK_CHECK_COMBAT, 1000); - break; - } - if (pInstance->instance->HavePlayers()) - { - me->SetInCombatWithZone(); - ++div2; - if (div2 > 1) - { - div2 = 0; - if (me->HasAura(SPELL_REMORSELESS_WINTER)) // prevent going behind him during fight - { - Map::PlayerList const& pl = pInstance->instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (!p->IsGameMaster() && p->IsAlive() && (p->GetPositionX() - me->GetPositionX() + p->GetPositionY() - me->GetPositionY()) > 20.0f) - me->CastSpell(p, SPELL_LICH_KING_ZAP_PLAYER, true); - } - } - } - else - { - summons.DespawnAll(); - pInstance->SetData(ACTION_STOP_LK_FIGHT, 1); - } - } - events.ScheduleEvent(EVENT_LK_CHECK_COMBAT, 1000); - break; - case EVENT_LK_KILL_LEADER: - if (Creature* leader = pInstance->instance->GetCreature(pInstance->GetData64(NPC_SYLVANAS_PART2))) - { - leader->CastSpell(leader, SPELL_HOR_SUICIDE, true); - Unit::Kill(me, leader); - me->InterruptNonMeleeSpells(true); - me->CastSpell((Unit*)NULL, SPELL_FURY_OF_FROSTMOURNE, false); - } - break; - case EVENT_LK_START_FOLLOWING: - { - me->SetSpeed(MOVE_RUN, 9.0f/7.0f); - Movement::PointsArray path; - path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - for (uint8 i=0; i<=2; ++i) - path.push_back(G3D::Vector3(PathWaypoints[i].GetPositionX(), PathWaypoints[i].GetPositionY(), PathWaypoints[i].GetPositionZ())); - me->GetMotionMaster()->MoveSplinePath(&path); - } - break; - case EVENT_LK_REMORSELESS_WINTER: - { - me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run); - Talk(SAY_LK_IW_1_SUMMON); - me->CastSpell(me, SPELL_REMORSELESS_WINTER, true); - Movement::PointsArray path; - path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - for (uint8 i=3; iGetMotionMaster()->MoveSplinePath(&path); - me->GetMotionMaster()->propagateSpeedChange(); - events.ScheduleEvent(EVENT_LK_SUMMON, 1000); - } - break; - case EVENT_LK_SUMMON: - switch (currentWall) - { - case 0: - events.ScheduleEvent(EVENT_LK_SUMMON_GHOULS, 0); - events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 4000); - break; - case 1: - events.ScheduleEvent(EVENT_LK_SUMMON_LA, 0); - events.ScheduleEvent(EVENT_LK_SUMMON_GHOULS, 100); - events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 4000); - events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 5100); - break; - case 2: - events.ScheduleEvent(EVENT_LK_SUMMON_LA, 0); - events.ScheduleEvent(EVENT_LK_SUMMON_GHOULS, 100); - events.ScheduleEvent(EVENT_LK_SUMMON_LA, 4000); - events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 4100); - events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 5200); - break; - case 3: - events.ScheduleEvent(EVENT_LK_SUMMON_LA, 0); - events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 100); - events.ScheduleEvent(EVENT_LK_SUMMON_GHOULS, 1200); - events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 5300); - events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 6400); - events.ScheduleEvent(EVENT_LK_SUMMON_GHOULS, 12500); - events.ScheduleEvent(EVENT_LK_SUMMON_LA, 16500); - events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 16600); - events.ScheduleEvent(EVENT_LK_SUMMON_LA, 17700); - break; - } - if (currentWall <= 3) - { - reqKillCount = 100; - events.RescheduleEvent(EVENT_DECREASE_REQ_COUNT_BY_100, 10000); - } - break; - case EVENT_DECREASE_REQ_COUNT_BY_100: - reqKillCount = (reqKillCount <= 100 ? 0 : reqKillCount-100); - DoAction(ACTION_CHECK_TRASH_DIED); - break; - case EVENT_LK_SUMMON_GHOULS: - me->CastSpell((Unit*)NULL, SPELL_SUMMON_RAGING_GHOULS, false); - break; - case EVENT_LK_SUMMON_RWD: - me->CastSpell((Unit*)NULL, SPELL_SUMMON_RISEN_WITCH_DOCTOR, false); - break; - case EVENT_LK_SUMMON_LA: - me->CastSpell((Unit*)NULL, SPELL_SUMMON_LUMBERING_ABOMINATION, false); - break; - case EVENT_LK_SUMMON_NEXT_ICE_WALL: - Talk(SAY_LK_IW_1+currentWall); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_ICE_WALL_TARGET+currentWall))) - me->CastSpell(c, SPELL_SUMMON_ICE_WALL, false); - break; - } - } - }; + switch(events.ExecuteEvent()) + { + case EVENT_LK_CHECK_COMBAT: + if (me->isActiveObject()) // during fight + { + if (Creature* leader = pInstance->instance->GetCreature(pInstance->GetData64(NPC_SYLVANAS_PART2))) + if (leader->IsAlive() && leader->GetPositionX() < 5575.0f && me->GetExactDist2d(leader) <= 12.5f && !leader->HasAura(SPELL_HARVEST_SOUL) && me->HasAura(SPELL_REMORSELESS_WINTER)) + { + me->GetMotionMaster()->MovementExpired(); + me->StopMoving(); + reqKillCount = 255; + leader->InterruptNonMeleeSpells(true); + me->CastSpell(leader, SPELL_HARVEST_SOUL, false); + events.ScheduleEvent(EVENT_LK_KILL_LEADER, 3000); + events.ScheduleEvent(EVENT_LK_CHECK_COMBAT, 1000); + break; + } + if (pInstance->instance->HavePlayers()) + { + me->SetInCombatWithZone(); + ++div2; + if (div2 > 1) + { + div2 = 0; + if (me->HasAura(SPELL_REMORSELESS_WINTER)) // prevent going behind him during fight + { + Map::PlayerList const& pl = pInstance->instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (!p->IsGameMaster() && p->IsAlive() && (p->GetPositionX() - me->GetPositionX() + p->GetPositionY() - me->GetPositionY()) > 20.0f) + me->CastSpell(p, SPELL_LICH_KING_ZAP_PLAYER, true); + } + } + } + else + { + summons.DespawnAll(); + pInstance->SetData(ACTION_STOP_LK_FIGHT, 1); + } + } + events.ScheduleEvent(EVENT_LK_CHECK_COMBAT, 1000); + break; + case EVENT_LK_KILL_LEADER: + if (Creature* leader = pInstance->instance->GetCreature(pInstance->GetData64(NPC_SYLVANAS_PART2))) + { + leader->CastSpell(leader, SPELL_HOR_SUICIDE, true); + Unit::Kill(me, leader); + me->InterruptNonMeleeSpells(true); + me->CastSpell((Unit*)NULL, SPELL_FURY_OF_FROSTMOURNE, false); + } + break; + case EVENT_LK_START_FOLLOWING: + { + me->SetSpeed(MOVE_RUN, 9.0f/7.0f); + Movement::PointsArray path; + path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + for (uint8 i=0; i<=2; ++i) + path.push_back(G3D::Vector3(PathWaypoints[i].GetPositionX(), PathWaypoints[i].GetPositionY(), PathWaypoints[i].GetPositionZ())); + me->GetMotionMaster()->MoveSplinePath(&path); + } + break; + case EVENT_LK_REMORSELESS_WINTER: + { + me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run); + Talk(SAY_LK_IW_1_SUMMON); + me->CastSpell(me, SPELL_REMORSELESS_WINTER, true); + Movement::PointsArray path; + path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + for (uint8 i=3; iGetMotionMaster()->MoveSplinePath(&path); + me->GetMotionMaster()->propagateSpeedChange(); + events.ScheduleEvent(EVENT_LK_SUMMON, 1000); + } + break; + case EVENT_LK_SUMMON: + switch (currentWall) + { + case 0: + events.ScheduleEvent(EVENT_LK_SUMMON_GHOULS, 0); + events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 4000); + break; + case 1: + events.ScheduleEvent(EVENT_LK_SUMMON_LA, 0); + events.ScheduleEvent(EVENT_LK_SUMMON_GHOULS, 100); + events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 4000); + events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 5100); + break; + case 2: + events.ScheduleEvent(EVENT_LK_SUMMON_LA, 0); + events.ScheduleEvent(EVENT_LK_SUMMON_GHOULS, 100); + events.ScheduleEvent(EVENT_LK_SUMMON_LA, 4000); + events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 4100); + events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 5200); + break; + case 3: + events.ScheduleEvent(EVENT_LK_SUMMON_LA, 0); + events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 100); + events.ScheduleEvent(EVENT_LK_SUMMON_GHOULS, 1200); + events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 5300); + events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 6400); + events.ScheduleEvent(EVENT_LK_SUMMON_GHOULS, 12500); + events.ScheduleEvent(EVENT_LK_SUMMON_LA, 16500); + events.ScheduleEvent(EVENT_LK_SUMMON_RWD, 16600); + events.ScheduleEvent(EVENT_LK_SUMMON_LA, 17700); + break; + } + if (currentWall <= 3) + { + reqKillCount = 100; + events.RescheduleEvent(EVENT_DECREASE_REQ_COUNT_BY_100, 10000); + } + break; + case EVENT_DECREASE_REQ_COUNT_BY_100: + reqKillCount = (reqKillCount <= 100 ? 0 : reqKillCount-100); + DoAction(ACTION_CHECK_TRASH_DIED); + break; + case EVENT_LK_SUMMON_GHOULS: + me->CastSpell((Unit*)NULL, SPELL_SUMMON_RAGING_GHOULS, false); + break; + case EVENT_LK_SUMMON_RWD: + me->CastSpell((Unit*)NULL, SPELL_SUMMON_RISEN_WITCH_DOCTOR, false); + break; + case EVENT_LK_SUMMON_LA: + me->CastSpell((Unit*)NULL, SPELL_SUMMON_LUMBERING_ABOMINATION, false); + break; + case EVENT_LK_SUMMON_NEXT_ICE_WALL: + Talk(SAY_LK_IW_1+currentWall); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_ICE_WALL_TARGET+currentWall))) + me->CastSpell(c, SPELL_SUMMON_ICE_WALL, false); + break; + } + } + }; }; class npc_hor_leader_second : public CreatureScript { public: - npc_hor_leader_second() : CreatureScript("npc_hor_leader_second") { } + npc_hor_leader_second() : CreatureScript("npc_hor_leader_second") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - return true; + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + { + if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return true; - player->PlayerTalkClass->ClearMenus(); + player->PlayerTalkClass->ClearMenus(); - if (InstanceScript* pInstance = creature->GetInstanceScript()) - if (!pInstance->GetData(DATA_LICH_KING)) - { - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); - creature->AI()->DoAction(ACTION_START_LK_FIGHT_REAL); - return true; - } + if (InstanceScript* pInstance = creature->GetInstanceScript()) + if (!pInstance->GetData(DATA_LICH_KING)) + { + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + creature->AI()->DoAction(ACTION_START_LK_FIGHT_REAL); + return true; + } - return true; - } + return true; + } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_hor_leader_secondAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_hor_leader_secondAI(creature); + } - struct npc_hor_leader_secondAI : public NullCreatureAI - { - npc_hor_leader_secondAI(Creature* creature) : NullCreatureAI(creature) - { - pInstance = me->GetInstanceScript(); - if (!pInstance) - me->IsAIEnabled = false; - } + struct npc_hor_leader_secondAI : public NullCreatureAI + { + npc_hor_leader_secondAI(Creature* creature) : NullCreatureAI(creature) + { + pInstance = me->GetInstanceScript(); + if (!pInstance) + me->IsAIEnabled = false; + } - InstanceScript* pInstance; - EventMap events; - uint8 currentStopPoint; + InstanceScript* pInstance; + EventMap events; + uint8 currentStopPoint; - void Reset() - { - currentStopPoint = 0; - events.Reset(); - } + void Reset() + { + currentStopPoint = 0; + events.Reset(); + } - void DoAction(int32 actionId) - { - switch(actionId) - { - case ACTION_START_INTRO: - events.ScheduleEvent(EVENT_LK_SAY_AGGRO, 0); - break; - case ACTION_START_LK_FIGHT_REAL: - events.ScheduleEvent(EVENT_START_RUN, 0); - break; - case ACTION_INFORM_WALL_DESTROYED: - MoveToNextStopPoint(); - if (currentStopPoint == 5) - events.ScheduleEvent(EVENT_SAY_OPENING, 3000); - break; - } - } + void DoAction(int32 actionId) + { + switch(actionId) + { + case ACTION_START_INTRO: + events.ScheduleEvent(EVENT_LK_SAY_AGGRO, 0); + break; + case ACTION_START_LK_FIGHT_REAL: + events.ScheduleEvent(EVENT_START_RUN, 0); + break; + case ACTION_INFORM_WALL_DESTROYED: + MoveToNextStopPoint(); + if (currentStopPoint == 5) + events.ScheduleEvent(EVENT_SAY_OPENING, 3000); + break; + } + } - void DamageTaken(Unit*, uint32& dmg, DamageEffectType, SpellSchoolMask) - { - if (dmg >= me->GetHealth()) - dmg = me->GetHealth()-1; - } + void DamageTaken(Unit*, uint32& dmg, DamageEffectType, SpellSchoolMask) + { + if (dmg >= me->GetHealth()) + dmg = me->GetHealth()-1; + } - void MoveToNextStopPoint() - { - me->InterruptNonMeleeSpells(true); - ++currentStopPoint; - Movement::PointsArray path; - path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - for (uint8 i=WP_STOP[currentStopPoint-1]+(currentStopPoint == 1 ? 0 : 1); i<=WP_STOP[currentStopPoint]; ++i) - path.push_back(G3D::Vector3(PathWaypoints[i].GetPositionX(), PathWaypoints[i].GetPositionY(), PathWaypoints[i].GetPositionZ())); - me->GetMotionMaster()->MoveSplinePath(&path); - } + void MoveToNextStopPoint() + { + me->InterruptNonMeleeSpells(true); + ++currentStopPoint; + Movement::PointsArray path; + path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + for (uint8 i=WP_STOP[currentStopPoint-1]+(currentStopPoint == 1 ? 0 : 1); i<=WP_STOP[currentStopPoint]; ++i) + path.push_back(G3D::Vector3(PathWaypoints[i].GetPositionX(), PathWaypoints[i].GetPositionY(), PathWaypoints[i].GetPositionZ())); + me->GetMotionMaster()->MoveSplinePath(&path); + } - void MovementInform(uint32 type, uint32 id) - { - if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized()) - events.ScheduleEvent(EVENT_SAY_LEADER_STOP_TEXT, 1000); - } + void MovementInform(uint32 type, uint32 id) + { + if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized()) + events.ScheduleEvent(EVENT_SAY_LEADER_STOP_TEXT, 1000); + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch(events.ExecuteEvent()) - { - case EVENT_LK_SAY_AGGRO: - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) - c->AI()->Talk(me->GetEntry() == NPC_JAINA_PART2 ? SAY_LK_AGGRO_ALLY : SAY_LK_AGGRO_HORDE); - events.ScheduleEvent(me->GetEntry() == NPC_JAINA_PART2 ? EVENT_JAINA_IMMOBILIZE_LK : EVENT_SYLVANAS_IMMOBILIZE_JUMP, 12000); - break; - case EVENT_JAINA_IMMOBILIZE_LK: - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) - { - c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->CastSpell(c, SPELL_JAINA_ICE_PRISON, false); - events.ScheduleEvent(EVENT_SAY_LEAVE, 5000); - } - break; - case EVENT_SYLVANAS_IMMOBILIZE_JUMP: - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) - { - c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->KnockbackFrom(c->GetPositionX(), c->GetPositionY(), 10.0f, 3.0f); - events.ScheduleEvent(EVENT_SYLVANAS_DARK_BINDING, 1500); - } - break; - case EVENT_SYLVANAS_DARK_BINDING: - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) - me->CastSpell(c, SPELL_SYLVANAS_DARK_BINDING, false); - events.ScheduleEvent(EVENT_SAY_LEAVE, 3500); - break; - case EVENT_SAY_LEAVE: - { - Map::PlayerList const& pl = pInstance->instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - p->KilledMonsterCredit(me->GetEntry(), 0); // for quest + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch(events.ExecuteEvent()) + { + case EVENT_LK_SAY_AGGRO: + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) + c->AI()->Talk(me->GetEntry() == NPC_JAINA_PART2 ? SAY_LK_AGGRO_ALLY : SAY_LK_AGGRO_HORDE); + events.ScheduleEvent(me->GetEntry() == NPC_JAINA_PART2 ? EVENT_JAINA_IMMOBILIZE_LK : EVENT_SYLVANAS_IMMOBILIZE_JUMP, 12000); + break; + case EVENT_JAINA_IMMOBILIZE_LK: + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) + { + c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->CastSpell(c, SPELL_JAINA_ICE_PRISON, false); + events.ScheduleEvent(EVENT_SAY_LEAVE, 5000); + } + break; + case EVENT_SYLVANAS_IMMOBILIZE_JUMP: + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) + { + c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->KnockbackFrom(c->GetPositionX(), c->GetPositionY(), 10.0f, 3.0f); + events.ScheduleEvent(EVENT_SYLVANAS_DARK_BINDING, 1500); + } + break; + case EVENT_SYLVANAS_DARK_BINDING: + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) + me->CastSpell(c, SPELL_SYLVANAS_DARK_BINDING, false); + events.ScheduleEvent(EVENT_SAY_LEAVE, 3500); + break; + case EVENT_SAY_LEAVE: + { + Map::PlayerList const& pl = pInstance->instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + p->KilledMonsterCredit(me->GetEntry(), 0); // for quest - Talk(me->GetEntry() == NPC_JAINA_PART2 ? SAY_JAINA_LEAVE : SAY_SYLVANAS_LEAVE); - me->GetMotionMaster()->MovePoint(0, LeaderEscapePos); - events.ScheduleEvent(EVENT_ADD_GOSSIP, 8000); - } - break; - case EVENT_ADD_GOSSIP: - me->RemoveAura(me->GetEntry() == NPC_JAINA_PART2 ? SPELL_JAINA_ICE_BARRIER : SPELL_SYLVANAS_CLOAK_OF_DARKNESS); - me->SetFacingTo(LeaderEscapePos.GetOrientation()); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - case EVENT_START_RUN: - { - pInstance->SetData(ACTION_START_LK_FIGHT, 1); - me->setActive(true); - MoveToNextStopPoint(); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) - { - c->setActive(true); - c->SetInCombatWithZone(); - c->RemoveAura(me->GetEntry() == NPC_JAINA_PART2 ? SPELL_JAINA_ICE_PRISON : SPELL_SYLVANAS_DARK_BINDING); - c->AI()->DoAction(ACTION_START_LK_FIGHT_REAL); - } - } - break; - case EVENT_SAY_LEADER_STOP_TEXT: - { - int32 textId = 0; - switch (currentStopPoint) - { - case 1: textId = SAY_SYLVANAS_IW_1; break; - case 2: textId = SAY_SYLVANAS_IW_2; break; - case 3: textId = SAY_SYLVANAS_IW_3; break; - case 4: textId = SAY_SYLVANAS_IW_4; break; - case 5: textId = SAY_SYLVANAS_END; break; - } - if (me->GetEntry() == NPC_JAINA_PART2) - textId += 10; - Talk(textId); - if (currentStopPoint <= 4) - me->CastSpell((Unit*)NULL, (me->GetEntry() == NPC_JAINA_PART2 ? SPELL_DESTROY_WALL_JAINA : SPELL_DESTROY_WALL_SYLVANAS), false); - else - { - me->SetFacingTo(PathWaypoints[PATH_WP_COUNT-1].GetOrientation()); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_READY1H); - } - } - break; - case EVENT_SAY_OPENING: - Talk(me->GetEntry() == NPC_JAINA_PART2 ? SAY_JAINA_OPENING : SAY_SYLVANAS_OPENING); - break; - } - } - }; + Talk(me->GetEntry() == NPC_JAINA_PART2 ? SAY_JAINA_LEAVE : SAY_SYLVANAS_LEAVE); + me->GetMotionMaster()->MovePoint(0, LeaderEscapePos); + events.ScheduleEvent(EVENT_ADD_GOSSIP, 8000); + } + break; + case EVENT_ADD_GOSSIP: + me->RemoveAura(me->GetEntry() == NPC_JAINA_PART2 ? SPELL_JAINA_ICE_BARRIER : SPELL_SYLVANAS_CLOAK_OF_DARKNESS); + me->SetFacingTo(LeaderEscapePos.GetOrientation()); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case EVENT_START_RUN: + { + pInstance->SetData(ACTION_START_LK_FIGHT, 1); + me->setActive(true); + MoveToNextStopPoint(); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) + { + c->setActive(true); + c->SetInCombatWithZone(); + c->RemoveAura(me->GetEntry() == NPC_JAINA_PART2 ? SPELL_JAINA_ICE_PRISON : SPELL_SYLVANAS_DARK_BINDING); + c->AI()->DoAction(ACTION_START_LK_FIGHT_REAL); + } + } + break; + case EVENT_SAY_LEADER_STOP_TEXT: + { + int32 textId = 0; + switch (currentStopPoint) + { + case 1: textId = SAY_SYLVANAS_IW_1; break; + case 2: textId = SAY_SYLVANAS_IW_2; break; + case 3: textId = SAY_SYLVANAS_IW_3; break; + case 4: textId = SAY_SYLVANAS_IW_4; break; + case 5: textId = SAY_SYLVANAS_END; break; + } + if (me->GetEntry() == NPC_JAINA_PART2) + textId += 10; + Talk(textId); + if (currentStopPoint <= 4) + me->CastSpell((Unit*)NULL, (me->GetEntry() == NPC_JAINA_PART2 ? SPELL_DESTROY_WALL_JAINA : SPELL_DESTROY_WALL_SYLVANAS), false); + else + { + me->SetFacingTo(PathWaypoints[PATH_WP_COUNT-1].GetOrientation()); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_READY1H); + } + } + break; + case EVENT_SAY_OPENING: + Talk(me->GetEntry() == NPC_JAINA_PART2 ? SAY_JAINA_OPENING : SAY_SYLVANAS_OPENING); + break; + } + } + }; }; class npc_hor_raging_ghoul : public CreatureScript { public: - npc_hor_raging_ghoul() : CreatureScript("npc_hor_raging_ghoul") { } + npc_hor_raging_ghoul() : CreatureScript("npc_hor_raging_ghoul") { } - struct npc_hor_raging_ghoulAI : public ScriptedAI - { - npc_hor_raging_ghoulAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_hor_raging_ghoulAI : public ScriptedAI + { + npc_hor_raging_ghoulAI(Creature* creature) : ScriptedAI(creature) {} - bool leaped; + bool leaped; - void Reset() - { - leaped = false; - } + void Reset() + { + leaped = false; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) + return; - if (!leaped) - if (Unit* target = me->SelectNearestPlayer(30.0f)) - { - AttackStart(target); - me->CastSpell(target, 70150, false); - leaped = true; - } + if (!leaped) + if (Unit* target = me->SelectNearestPlayer(30.0f)) + { + AttackStart(target); + me->CastSpell(target, 70150, false); + leaped = true; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - me->SetCorpseDelay(10); - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (Creature* lk = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) - lk->AI()->DoAction(ACTION_INFORM_TRASH_DIED); - } - }; + void JustDied(Unit* /*killer*/) + { + me->SetCorpseDelay(10); + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (Creature* lk = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) + lk->AI()->DoAction(ACTION_INFORM_TRASH_DIED); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_hor_raging_ghoulAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_hor_raging_ghoulAI(creature); + } }; class npc_hor_risen_witch_doctor : public CreatureScript { public: - npc_hor_risen_witch_doctor() : CreatureScript("npc_hor_risen_witch_doctor") { } + npc_hor_risen_witch_doctor() : CreatureScript("npc_hor_risen_witch_doctor") { } - struct npc_hor_risen_witch_doctorAI : public ScriptedAI - { - npc_hor_risen_witch_doctorAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_hor_risen_witch_doctorAI : public ScriptedAI + { + npc_hor_risen_witch_doctorAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(1, 10000); - events.ScheduleEvent(2, 4500); - events.ScheduleEvent(3, 9000); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(1, 10000); + events.ScheduleEvent(2, 4500); + events.ScheduleEvent(3, 9000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) + return; - switch (events.ExecuteEvent()) - { - case 1: - if (Unit* target = SelectTargetFromPlayerList(30.0f, 0, true)) - me->CastSpell(target, 70144, false); - events.ScheduleEvent(1, 12000); - break; - case 2: - me->CastSpell(me->GetVictim(), 70080, false); - events.ScheduleEvent(2, 4500); - break; - case 3: - if (Unit* target = SelectTargetFromPlayerList(30.0f, 0, true)) - me->CastSpell(me->GetVictim(), 70145, false); - events.ScheduleEvent(3, 9000); - break; - } + switch (events.ExecuteEvent()) + { + case 1: + if (Unit* target = SelectTargetFromPlayerList(30.0f, 0, true)) + me->CastSpell(target, 70144, false); + events.ScheduleEvent(1, 12000); + break; + case 2: + me->CastSpell(me->GetVictim(), 70080, false); + events.ScheduleEvent(2, 4500); + break; + case 3: + if (Unit* target = SelectTargetFromPlayerList(30.0f, 0, true)) + me->CastSpell(me->GetVictim(), 70145, false); + events.ScheduleEvent(3, 9000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - me->SetCorpseDelay(10); - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (Creature* lk = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) - lk->AI()->DoAction(ACTION_INFORM_TRASH_DIED); - } - }; + void JustDied(Unit* /*killer*/) + { + me->SetCorpseDelay(10); + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (Creature* lk = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) + lk->AI()->DoAction(ACTION_INFORM_TRASH_DIED); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_hor_risen_witch_doctorAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_hor_risen_witch_doctorAI(creature); + } }; class npc_hor_lumbering_abomination : public CreatureScript { public: - npc_hor_lumbering_abomination() : CreatureScript("npc_hor_lumbering_abomination") { } + npc_hor_lumbering_abomination() : CreatureScript("npc_hor_lumbering_abomination") { } - struct npc_hor_lumbering_abominationAI : public ScriptedAI - { - npc_hor_lumbering_abominationAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_hor_lumbering_abominationAI : public ScriptedAI + { + npc_hor_lumbering_abominationAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(1, 5000); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(1, 5000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->IsCharmed() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED)) + return; - switch (events.ExecuteEvent()) - { - case 1: - if (me->IsWithinMeleeRange(me->GetVictim())) - { - me->CastSpell(me->GetVictim(), 70176, false); - events.ScheduleEvent(1, 18000); - } - else - events.ScheduleEvent(1, 3000); - break; - } + switch (events.ExecuteEvent()) + { + case 1: + if (me->IsWithinMeleeRange(me->GetVictim())) + { + me->CastSpell(me->GetVictim(), 70176, false); + events.ScheduleEvent(1, 18000); + } + else + events.ScheduleEvent(1, 3000); + break; + } - if (me->GetVictim() && me->isAttackReady() && me->IsWithinMeleeRange(me->GetVictim()) && !me->HasUnitState(UNIT_STATE_CASTING)) - me->CastSpell(me->GetVictim(), 40505, false); + if (me->GetVictim() && me->isAttackReady() && me->IsWithinMeleeRange(me->GetVictim()) && !me->HasUnitState(UNIT_STATE_CASTING)) + me->CastSpell(me->GetVictim(), 40505, false); - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - me->SetCorpseDelay(10); - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (Creature* lk = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) - lk->AI()->DoAction(ACTION_INFORM_TRASH_DIED); - } - }; + void JustDied(Unit* /*killer*/) + { + me->SetCorpseDelay(10); + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (Creature* lk = pInstance->instance->GetCreature(pInstance->GetData64(NPC_LICH_KING_BOSS))) + lk->AI()->DoAction(ACTION_INFORM_TRASH_DIED); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_hor_lumbering_abominationAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_hor_lumbering_abominationAI(creature); + } }; class spell_hor_gunship_cannon_fire : public SpellScriptLoader { public: - spell_hor_gunship_cannon_fire() : SpellScriptLoader("spell_hor_gunship_cannon_fire") { } + spell_hor_gunship_cannon_fire() : SpellScriptLoader("spell_hor_gunship_cannon_fire") { } - class spell_hor_gunship_cannon_fireAuraScript : public AuraScript - { - PrepareAuraScript(spell_hor_gunship_cannon_fireAuraScript) + class spell_hor_gunship_cannon_fireAuraScript : public AuraScript + { + PrepareAuraScript(spell_hor_gunship_cannon_fireAuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - PreventDefaultAction(); - if (Unit* caster = GetCaster()) - if (Creature* c = caster->SummonCreature(WORLD_TRIGGER, CannonFirePos[caster->GetEntry() == NPC_JAINA_PART2 ? 0 : 1][urand(0,2)], TEMPSUMMON_TIMED_DESPAWN, 1)) - c->CastSpell((Unit*)NULL, 70021, true); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + if (Creature* c = caster->SummonCreature(WORLD_TRIGGER, CannonFirePos[caster->GetEntry() == NPC_JAINA_PART2 ? 0 : 1][urand(0,2)], TEMPSUMMON_TIMED_DESPAWN, 1)) + c->CastSpell((Unit*)NULL, 70021, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_hor_gunship_cannon_fireAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_hor_gunship_cannon_fireAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_hor_gunship_cannon_fireAuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_hor_gunship_cannon_fireAuraScript(); + } }; /* BATTERED HILT BELOW */ class at_hor_battered_hilt_start : public AreaTriggerScript { - public: - at_hor_battered_hilt_start() : AreaTriggerScript("at_hor_battered_hilt_start") { } + public: + at_hor_battered_hilt_start() : AreaTriggerScript("at_hor_battered_hilt_start") { } - bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) - { - if (player->HasAura(70013)) - if (InstanceScript* instance = player->GetInstanceScript()) - instance->SetData(DATA_BATTERED_HILT, 2); - return true; - } + bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) + { + if (player->HasAura(70013)) + if (InstanceScript* instance = player->GetInstanceScript()) + instance->SetData(DATA_BATTERED_HILT, 2); + return true; + } }; class at_hor_battered_hilt_throw : public AreaTriggerScript { - public: - at_hor_battered_hilt_throw() : AreaTriggerScript("at_hor_battered_hilt_throw") { } + public: + at_hor_battered_hilt_throw() : AreaTriggerScript("at_hor_battered_hilt_throw") { } - bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) - { - if (player->HasAura(70013)) - if (InstanceScript* instance = player->GetInstanceScript()) - { - uint32 bhd = instance->GetData(DATA_BATTERED_HILT); - if (bhd == BHSF_NONE || bhd != BHSF_STARTED) - return true; - player->CastSpell(player, 70698, true); - player->DestroyItemCount(49766, 1, true); - instance->SetData(DATA_BATTERED_HILT, 3); - } - return true; - } + bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) + { + if (player->HasAura(70013)) + if (InstanceScript* instance = player->GetInstanceScript()) + { + uint32 bhd = instance->GetData(DATA_BATTERED_HILT); + if (bhd == BHSF_NONE || bhd != BHSF_STARTED) + return true; + player->CastSpell(player, 70698, true); + player->DestroyItemCount(49766, 1, true); + instance->SetData(DATA_BATTERED_HILT, 3); + } + return true; + } }; void AddSC_halls_of_reflection() { - new npc_hor_leader(); + new npc_hor_leader(); - new npc_ghostly_priest(); - new npc_phantom_mage(); - new npc_phantom_hallucination(); - new npc_shadowy_mercenary(); - new npc_spectral_footman(); - new npc_tortured_rifleman(); + new npc_ghostly_priest(); + new npc_phantom_mage(); + new npc_phantom_hallucination(); + new npc_shadowy_mercenary(); + new npc_spectral_footman(); + new npc_tortured_rifleman(); - new boss_frostsworn_general(); - new npc_hor_spiritual_reflection(); + new boss_frostsworn_general(); + new npc_hor_spiritual_reflection(); - new at_hor_shadow_throne(); - new npc_hor_lich_king(); - new npc_hor_leader_second(); - new npc_hor_raging_ghoul(); - new npc_hor_risen_witch_doctor(); - new npc_hor_lumbering_abomination(); - new spell_hor_gunship_cannon_fire(); + new at_hor_shadow_throne(); + new npc_hor_lich_king(); + new npc_hor_leader_second(); + new npc_hor_raging_ghoul(); + new npc_hor_risen_witch_doctor(); + new npc_hor_lumbering_abomination(); + new spell_hor_gunship_cannon_fire(); - new at_hor_battered_hilt_start(); - new at_hor_battered_hilt_throw(); + new at_hor_battered_hilt_start(); + new at_hor_battered_hilt_throw(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h index 84f23e712..24de4de99 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -7,88 +7,88 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Data { - DATA_INTRO, - DATA_FALRIC, - DATA_MARWYN, - DATA_FROSTSWORN_GENERAL, - DATA_LK_INTRO, - DATA_LICH_KING, - DATA_BATTERED_HILT, - MAX_ENCOUNTER, - ACTION_SHOW_TRASH, - ACTION_SPIRITUAL_REFLECTIONS_COPY, - ACTION_SPIRITUAL_REFLECTIONS_ACTIVATE, - ACTION_SPIRITUAL_REFLECTIONS_HIDE, - ACTION_START_LK_FIGHT, - ACTION_STOP_LK_FIGHT, - ACTION_DELETE_ICE_WALL, - DATA_WAVE_NUMBER, + DATA_INTRO, + DATA_FALRIC, + DATA_MARWYN, + DATA_FROSTSWORN_GENERAL, + DATA_LK_INTRO, + DATA_LICH_KING, + DATA_BATTERED_HILT, + MAX_ENCOUNTER, + ACTION_SHOW_TRASH, + ACTION_SPIRITUAL_REFLECTIONS_COPY, + ACTION_SPIRITUAL_REFLECTIONS_ACTIVATE, + ACTION_SPIRITUAL_REFLECTIONS_HIDE, + ACTION_START_LK_FIGHT, + ACTION_STOP_LK_FIGHT, + ACTION_DELETE_ICE_WALL, + DATA_WAVE_NUMBER, }; enum Creatures { - NPC_FALRIC = 38112, - NPC_MARWYN = 38113, - NPC_LICH_KING_EVENT = 37226, - NPC_LICH_KING_BOSS = 36954, + NPC_FALRIC = 38112, + NPC_MARWYN = 38113, + NPC_LICH_KING_EVENT = 37226, + NPC_LICH_KING_BOSS = 36954, - NPC_UTHER = 37225, - NPC_JAINA_PART1 = 37221, - NPC_JAINA_PART2 = 36955, - NPC_SYLVANAS_PART1 = 37223, - NPC_SYLVANAS_PART2 = 37554, + NPC_UTHER = 37225, + NPC_JAINA_PART1 = 37221, + NPC_JAINA_PART2 = 36955, + NPC_SYLVANAS_PART1 = 37223, + NPC_SYLVANAS_PART2 = 37554, - NPC_DARK_RANGER_LORALEN = 37779, - NPC_ARCHMAGE_ELANDRA = 37774, + NPC_DARK_RANGER_LORALEN = 37779, + NPC_ARCHMAGE_ELANDRA = 37774, - NPC_WAVE_MERCENARY = 38177, - NPC_WAVE_FOOTMAN = 38173, - NPC_WAVE_RIFLEMAN = 38176, - NPC_WAVE_PRIEST = 38175, - NPC_WAVE_MAGE = 38172, - NPC_PHANTOM_HALLUCINATION = 38567, + NPC_WAVE_MERCENARY = 38177, + NPC_WAVE_FOOTMAN = 38173, + NPC_WAVE_RIFLEMAN = 38176, + NPC_WAVE_PRIEST = 38175, + NPC_WAVE_MAGE = 38172, + NPC_PHANTOM_HALLUCINATION = 38567, - NPC_FROSTSWORN_GENERAL = 36723, - NPC_SPIRITUAL_REFLECTION = 37068, - NPC_ICE_WALL_TARGET = 37014, - NPC_WRATH_OF_THE_LICH_KING_CREDIT = 38211, - NPC_HIGH_CAPTAIN_JUSTIN_BARLETT = 30344, - NPC_SKY_REAVER_KORM_BLACKSKAR = 30824, - NPC_ALTAR_BUNNY = 37704, - NPC_QUEL_DELAR = 37158, + NPC_FROSTSWORN_GENERAL = 36723, + NPC_SPIRITUAL_REFLECTION = 37068, + NPC_ICE_WALL_TARGET = 37014, + NPC_WRATH_OF_THE_LICH_KING_CREDIT = 38211, + NPC_HIGH_CAPTAIN_JUSTIN_BARLETT = 30344, + NPC_SKY_REAVER_KORM_BLACKSKAR = 30824, + NPC_ALTAR_BUNNY = 37704, + NPC_QUEL_DELAR = 37158, }; enum GameObjects { - GO_FROSTMOURNE = 202302, - GO_FROSTMOURNE_ALTAR = 202236, - GO_FRONT_DOOR = 201976, - GO_ARTHAS_DOOR = 197341, - GO_CAVE_IN = 201596, - GO_DOOR_BEFORE_THRONE = 197342, - GO_DOOR_AFTER_THRONE = 197343, - GO_ICE_WALL = 201385, - GO_THE_SKYBREAKER = 201598, - GO_ORGRIMS_HAMMER = 201599, - GO_STAIRS_ALLIANCE = 201709, - GO_STAIRS_HORDE = 202211, - GO_CHEST_NORMAL = 201710, - GO_CHEST_HEROIC = 202336, - GO_PORTAL_TO_DALARAN = 195682, + GO_FROSTMOURNE = 202302, + GO_FROSTMOURNE_ALTAR = 202236, + GO_FRONT_DOOR = 201976, + GO_ARTHAS_DOOR = 197341, + GO_CAVE_IN = 201596, + GO_DOOR_BEFORE_THRONE = 197342, + GO_DOOR_AFTER_THRONE = 197343, + GO_ICE_WALL = 201385, + GO_THE_SKYBREAKER = 201598, + GO_ORGRIMS_HAMMER = 201599, + GO_STAIRS_ALLIANCE = 201709, + GO_STAIRS_HORDE = 202211, + GO_CHEST_NORMAL = 201710, + GO_CHEST_HEROIC = 202336, + GO_PORTAL_TO_DALARAN = 195682, }; enum HorWorldStates { - WORLD_STATE_HOR_COUNTER = 4884, - WORLD_STATE_HOR_WAVE_COUNT = 4882, + WORLD_STATE_HOR_COUNTER = 4884, + WORLD_STATE_HOR_WAVE_COUNT = 4882, }; enum BatteredHiltStatusFlags { - BHSF_NONE = 0, - BHSF_STARTED = 1, - BHSF_THROWN = 2, - BHSF_FINISHED = 4, + BHSF_NONE = 0, + BHSF_STARTED = 1, + BHSF_THROWN = 2, + BHSF_FINISHED = 4, }; #define NUM_OF_TRASH 34 @@ -97,158 +97,158 @@ enum BatteredHiltStatusFlags enum hYells { - SAY_JAINA_INTRO_1 = 1, - SAY_JAINA_INTRO_2 = 2, - SAY_JAINA_INTRO_3 = 3, - SAY_JAINA_INTRO_4 = 4, - SAY_UTHER_INTRO_A2_1 = 5, - SAY_JAINA_INTRO_5 = 6, - SAY_UTHER_INTRO_A2_2 = 7, - SAY_JAINA_INTRO_6 = 8, - SAY_UTHER_INTRO_A2_3 = 9, - SAY_JAINA_INTRO_7 = 10, - SAY_UTHER_INTRO_A2_4 = 11, - SAY_JAINA_INTRO_8 = 12, - SAY_UTHER_INTRO_A2_5 = 13, - SAY_JAINA_INTRO_9 = 14, - SAY_UTHER_INTRO_A2_6 = 15, - SAY_UTHER_INTRO_A2_7 = 16, - SAY_JAINA_INTRO_10 = 17, - SAY_UTHER_INTRO_A2_8 = 18, - SAY_JAINA_INTRO_11 = 19, - SAY_UTHER_INTRO_A2_9 = 20, + SAY_JAINA_INTRO_1 = 1, + SAY_JAINA_INTRO_2 = 2, + SAY_JAINA_INTRO_3 = 3, + SAY_JAINA_INTRO_4 = 4, + SAY_UTHER_INTRO_A2_1 = 5, + SAY_JAINA_INTRO_5 = 6, + SAY_UTHER_INTRO_A2_2 = 7, + SAY_JAINA_INTRO_6 = 8, + SAY_UTHER_INTRO_A2_3 = 9, + SAY_JAINA_INTRO_7 = 10, + SAY_UTHER_INTRO_A2_4 = 11, + SAY_JAINA_INTRO_8 = 12, + SAY_UTHER_INTRO_A2_5 = 13, + SAY_JAINA_INTRO_9 = 14, + SAY_UTHER_INTRO_A2_6 = 15, + SAY_UTHER_INTRO_A2_7 = 16, + SAY_JAINA_INTRO_10 = 17, + SAY_UTHER_INTRO_A2_8 = 18, + SAY_JAINA_INTRO_11 = 19, + SAY_UTHER_INTRO_A2_9 = 20, - SAY_SYLVANAS_INTRO_1 = 21, - SAY_SYLVANAS_INTRO_2 = 22, - SAY_SYLVANAS_INTRO_3 = 23, - SAY_UTHER_INTRO_H2_1 = 24, - SAY_SYLVANAS_INTRO_4 = 25, - SAY_UTHER_INTRO_H2_2 = 26, - SAY_SYLVANAS_INTRO_5 = 27, - SAY_UTHER_INTRO_H2_3 = 28, - SAY_SYLVANAS_INTRO_6 = 29, - SAY_UTHER_INTRO_H2_4 = 30, - SAY_SYLVANAS_INTRO_7 = 31, - SAY_UTHER_INTRO_H2_5 = 32, - SAY_UTHER_INTRO_H2_6 = 33, - SAY_SYLVANAS_INTRO_8 = 34, - SAY_UTHER_INTRO_H2_7 = 35, + SAY_SYLVANAS_INTRO_1 = 21, + SAY_SYLVANAS_INTRO_2 = 22, + SAY_SYLVANAS_INTRO_3 = 23, + SAY_UTHER_INTRO_H2_1 = 24, + SAY_SYLVANAS_INTRO_4 = 25, + SAY_UTHER_INTRO_H2_2 = 26, + SAY_SYLVANAS_INTRO_5 = 27, + SAY_UTHER_INTRO_H2_3 = 28, + SAY_SYLVANAS_INTRO_6 = 29, + SAY_UTHER_INTRO_H2_4 = 30, + SAY_SYLVANAS_INTRO_7 = 31, + SAY_UTHER_INTRO_H2_5 = 32, + SAY_UTHER_INTRO_H2_6 = 33, + SAY_SYLVANAS_INTRO_8 = 34, + SAY_UTHER_INTRO_H2_7 = 35, - SAY_LK_INTRO_1 = 36, - SAY_LK_INTRO_2 = 37, - SAY_LK_INTRO_3 = 38, - SAY_FALRIC_INTRO_1 = 39, - SAY_MARWYN_INTRO_1 = 40, - SAY_FALRIC_INTRO_2 = 41, + SAY_LK_INTRO_1 = 36, + SAY_LK_INTRO_2 = 37, + SAY_LK_INTRO_3 = 38, + SAY_FALRIC_INTRO_1 = 39, + SAY_MARWYN_INTRO_1 = 40, + SAY_FALRIC_INTRO_2 = 41, - SAY_JAINA_INTRO_END = 42, - SAY_SYLVANAS_INTRO_END = 43, + SAY_JAINA_INTRO_END = 42, + SAY_SYLVANAS_INTRO_END = 43, - SAY_FROSTSWORN_GENERAL_AGGRO = 98, - SAY_FROSTSWORN_GENERAL_DEATH = 99, + SAY_FROSTSWORN_GENERAL_AGGRO = 98, + SAY_FROSTSWORN_GENERAL_DEATH = 99, - SAY_LK_AGGRO_HORDE = 100, - SAY_LK_AGGRO_ALLY = 101, - SAY_SYLVANAS_LEAVE = 102, - SAY_JAINA_LEAVE = 103, - SAY_LK_IW_1 = 104, - SAY_LK_IW_2 = 105, - SAY_LK_IW_3 = 106, - SAY_LK_IW_4 = 107, - SAY_LK_IW_1_SUMMON = 108, - SAY_SYLVANAS_IW_1 = 109, - SAY_SYLVANAS_IW_2 = 110, - SAY_SYLVANAS_IW_3 = 111, - SAY_SYLVANAS_IW_4 = 112, - SAY_SYLVANAS_OPENING = 113, - SAY_SYLVANAS_END = 114, - SAY_LK_NOWHERE_TO_RUN = 115, - SAY_FIRE_HORDE = 116, - SAY_ONBOARD_HORDE = 117, - SAY_FINAL_HORDE = 118, - SAY_JAINA_IW_1 = 119, - SAY_JAINA_IW_2 = 120, - SAY_JAINA_IW_3 = 121, - SAY_JAINA_IW_4 = 122, - SAY_JAINA_OPENING = 123, - SAY_JAINA_END = 124, - SAY_FIRE_ALLY = 125, - SAY_ONBOARD_ALLY = 126, - SAY_FINAL_ALLY = 127, - SAY_FINAL_ALLY_SECOND = 128, + SAY_LK_AGGRO_HORDE = 100, + SAY_LK_AGGRO_ALLY = 101, + SAY_SYLVANAS_LEAVE = 102, + SAY_JAINA_LEAVE = 103, + SAY_LK_IW_1 = 104, + SAY_LK_IW_2 = 105, + SAY_LK_IW_3 = 106, + SAY_LK_IW_4 = 107, + SAY_LK_IW_1_SUMMON = 108, + SAY_SYLVANAS_IW_1 = 109, + SAY_SYLVANAS_IW_2 = 110, + SAY_SYLVANAS_IW_3 = 111, + SAY_SYLVANAS_IW_4 = 112, + SAY_SYLVANAS_OPENING = 113, + SAY_SYLVANAS_END = 114, + SAY_LK_NOWHERE_TO_RUN = 115, + SAY_FIRE_HORDE = 116, + SAY_ONBOARD_HORDE = 117, + SAY_FINAL_HORDE = 118, + SAY_JAINA_IW_1 = 119, + SAY_JAINA_IW_2 = 120, + SAY_JAINA_IW_3 = 121, + SAY_JAINA_IW_4 = 122, + SAY_JAINA_OPENING = 123, + SAY_JAINA_END = 124, + SAY_FIRE_ALLY = 125, + SAY_ONBOARD_ALLY = 126, + SAY_FINAL_ALLY = 127, + SAY_FINAL_ALLY_SECOND = 128, - SAY_BATTERED_HILT_HALT = 200, - SAY_BATTERED_HILT_LEAP = 201, - SAY_BATTERED_HILT_REALIZE = 202, - SAY_BATTERED_HILT_PREPARE = 203, - SAY_BATTERED_HILT_OUTRO1 = 204, - SAY_BATTERED_HILT_OUTRO2 = 205, - SAY_BATTERED_HILT_OUTRO3 = 206, - SAY_BATTERED_HILT_OUTRO4 = 207, + SAY_BATTERED_HILT_HALT = 200, + SAY_BATTERED_HILT_LEAP = 201, + SAY_BATTERED_HILT_REALIZE = 202, + SAY_BATTERED_HILT_PREPARE = 203, + SAY_BATTERED_HILT_OUTRO1 = 204, + SAY_BATTERED_HILT_OUTRO2 = 205, + SAY_BATTERED_HILT_OUTRO3 = 206, + SAY_BATTERED_HILT_OUTRO4 = 207, }; enum hMisc { - ACTION_START_INTRO, - ACTION_SKIP_INTRO, - ACTION_START_LK_FIGHT_REAL, - ACTION_INFORM_TRASH_DIED, - ACTION_CHECK_TRASH_DIED, - ACTION_INFORM_WALL_DESTROYED, + ACTION_START_INTRO, + ACTION_SKIP_INTRO, + ACTION_START_LK_FIGHT_REAL, + ACTION_INFORM_TRASH_DIED, + ACTION_CHECK_TRASH_DIED, + ACTION_INFORM_WALL_DESTROYED, - QUEST_DELIVRANCE_FROM_THE_PIT_A2 = 24710, - QUEST_DELIVRANCE_FROM_THE_PIT_H2 = 24712, - QUEST_WRATH_OF_THE_LICH_KING_A2 = 24500, - QUEST_WRATH_OF_THE_LICH_KING_H2 = 24802, - ACHIEV_RETREATING_TIMED_EVENT = 22615, + QUEST_DELIVRANCE_FROM_THE_PIT_A2 = 24710, + QUEST_DELIVRANCE_FROM_THE_PIT_H2 = 24712, + QUEST_WRATH_OF_THE_LICH_KING_A2 = 24500, + QUEST_WRATH_OF_THE_LICH_KING_H2 = 24802, + ACHIEV_RETREATING_TIMED_EVENT = 22615, - SPELL_FROSTMOURNE_SPAWN_SOUND = 70667, - SPELL_FROSTMOURNE_EQUIP = 72729, - SPELL_HOR_START_QUEST_ALLY = 71351, - SPELL_HOR_START_QUEST_HORDE = 71542, - SPELL_SHADOWMOURNE_VISUAL = 72523, - SPELL_ARCANE_CAST_VISUAL = 65633, - SPELL_WELL_OF_SOULS_VISUAL = 72630, + SPELL_FROSTMOURNE_SPAWN_SOUND = 70667, + SPELL_FROSTMOURNE_EQUIP = 72729, + SPELL_HOR_START_QUEST_ALLY = 71351, + SPELL_HOR_START_QUEST_HORDE = 71542, + SPELL_SHADOWMOURNE_VISUAL = 72523, + SPELL_ARCANE_CAST_VISUAL = 65633, + SPELL_WELL_OF_SOULS_VISUAL = 72630, - // Frostsworn General - EVENT_ACTIVATE_REFLECTIONS = 1, - EVENT_THROW_SHIELD = 2, - EVENT_BALEFUL_STRIKE = 3, - SPELL_THROW_SHIELD = 69222, - SPELL_SUMMON_REFLECTIONS_DUMMY = 69223, - SPELL_HOR_CLONE = 69828, - SPELL_HOR_CLONE_NAME = 69837, - SPELL_BALEFUL_STRIKE = 69933, - SPELL_SPIRIT_BURST = 69900, - SPELL_JAINA_ICE_BARRIER = 69787, - SPELL_SYLVANAS_CLOAK_OF_DARKNESS = 70188, - SPELL_JAINA_ICE_PRISON = 69708, - SPELL_SYLVANAS_DARK_BINDING = 70194, - SPELL_REMORSELESS_WINTER = 69780, - SPELL_LICH_KING_ZAP_PLAYER = 70653, - SPELL_DESTROY_WALL_JAINA = 69784, - SPELL_DESTROY_WALL_SYLVANAS = 70224, - SPELL_SUMMON_ICE_WALL = 69768, - SPELL_FURY_OF_FROSTMOURNE = 70063, - SPELL_HARVEST_SOUL = 70070, - SPELL_HOR_SUICIDE = 69908, - SPELL_SUMMON_RAGING_GHOULS = 69818, - SPELL_SUMMON_RISEN_WITCH_DOCTOR = 69836, - SPELL_SUMMON_LUMBERING_ABOMINATION = 69835, - SPELL_GUNSHIP_CANNON_FIRE_PERIODIC = 70017, - SPELL_ACHIEVEMENT_CHECK = 72830, + // Frostsworn General + EVENT_ACTIVATE_REFLECTIONS = 1, + EVENT_THROW_SHIELD = 2, + EVENT_BALEFUL_STRIKE = 3, + SPELL_THROW_SHIELD = 69222, + SPELL_SUMMON_REFLECTIONS_DUMMY = 69223, + SPELL_HOR_CLONE = 69828, + SPELL_HOR_CLONE_NAME = 69837, + SPELL_BALEFUL_STRIKE = 69933, + SPELL_SPIRIT_BURST = 69900, + SPELL_JAINA_ICE_BARRIER = 69787, + SPELL_SYLVANAS_CLOAK_OF_DARKNESS = 70188, + SPELL_JAINA_ICE_PRISON = 69708, + SPELL_SYLVANAS_DARK_BINDING = 70194, + SPELL_REMORSELESS_WINTER = 69780, + SPELL_LICH_KING_ZAP_PLAYER = 70653, + SPELL_DESTROY_WALL_JAINA = 69784, + SPELL_DESTROY_WALL_SYLVANAS = 70224, + SPELL_SUMMON_ICE_WALL = 69768, + SPELL_FURY_OF_FROSTMOURNE = 70063, + SPELL_HARVEST_SOUL = 70070, + SPELL_HOR_SUICIDE = 69908, + SPELL_SUMMON_RAGING_GHOULS = 69818, + SPELL_SUMMON_RISEN_WITCH_DOCTOR = 69836, + SPELL_SUMMON_LUMBERING_ABOMINATION = 69835, + SPELL_GUNSHIP_CANNON_FIRE_PERIODIC = 70017, + SPELL_ACHIEVEMENT_CHECK = 72830, }; const uint32 allowedCompositions[8][5] = { - {NPC_WAVE_MERCENARY, NPC_WAVE_PRIEST, NPC_WAVE_RIFLEMAN, 0, 0}, - {NPC_WAVE_MAGE, NPC_WAVE_RIFLEMAN, NPC_WAVE_FOOTMAN, 0, 0}, - {NPC_WAVE_MERCENARY, NPC_WAVE_PRIEST, NPC_WAVE_FOOTMAN, NPC_WAVE_FOOTMAN, 0}, - {NPC_WAVE_MAGE, NPC_WAVE_PRIEST, NPC_WAVE_FOOTMAN, NPC_WAVE_FOOTMAN, 0}, - {NPC_WAVE_MERCENARY, NPC_WAVE_MAGE, NPC_WAVE_RIFLEMAN, NPC_WAVE_FOOTMAN, NPC_WAVE_FOOTMAN}, - {NPC_WAVE_MERCENARY, NPC_WAVE_MAGE, NPC_WAVE_PRIEST, NPC_WAVE_RIFLEMAN, NPC_WAVE_RIFLEMAN}, - {NPC_WAVE_MERCENARY, NPC_WAVE_MAGE, NPC_WAVE_PRIEST, NPC_WAVE_RIFLEMAN, NPC_WAVE_FOOTMAN}, - {NPC_WAVE_MERCENARY, NPC_WAVE_MAGE, NPC_WAVE_PRIEST, NPC_WAVE_FOOTMAN, NPC_WAVE_FOOTMAN} + {NPC_WAVE_MERCENARY, NPC_WAVE_PRIEST, NPC_WAVE_RIFLEMAN, 0, 0}, + {NPC_WAVE_MAGE, NPC_WAVE_RIFLEMAN, NPC_WAVE_FOOTMAN, 0, 0}, + {NPC_WAVE_MERCENARY, NPC_WAVE_PRIEST, NPC_WAVE_FOOTMAN, NPC_WAVE_FOOTMAN, 0}, + {NPC_WAVE_MAGE, NPC_WAVE_PRIEST, NPC_WAVE_FOOTMAN, NPC_WAVE_FOOTMAN, 0}, + {NPC_WAVE_MERCENARY, NPC_WAVE_MAGE, NPC_WAVE_RIFLEMAN, NPC_WAVE_FOOTMAN, NPC_WAVE_FOOTMAN}, + {NPC_WAVE_MERCENARY, NPC_WAVE_MAGE, NPC_WAVE_PRIEST, NPC_WAVE_RIFLEMAN, NPC_WAVE_RIFLEMAN}, + {NPC_WAVE_MERCENARY, NPC_WAVE_MAGE, NPC_WAVE_PRIEST, NPC_WAVE_RIFLEMAN, NPC_WAVE_FOOTMAN}, + {NPC_WAVE_MERCENARY, NPC_WAVE_MAGE, NPC_WAVE_PRIEST, NPC_WAVE_FOOTMAN, NPC_WAVE_FOOTMAN} }; const Position CenterPos = {5309.459473f, 2006.478516f, 711.595459f, 0.0f}; @@ -275,53 +275,53 @@ const uint8 WP_STOP[6] = {0, 5, 8, 10, 14, 18}; const Position PathWaypoints[PATH_WP_COUNT] = { - {5588.055664f, 2229.327393f, 733.011353f, 5.440755f}, - {5605.567383f, 2203.448486f, 731.304626f, 5.059827f}, - {5607.415039f, 2189.225098f, 731.022217f, 4.203760f}, - {5598.958984f, 2169.660156f, 730.919800f, 4.093812f}, - {5586.018066f, 2149.685303f, 731.090759f, 4.093815f}, - {5558.182617f, 2103.950928f, 731.263000f, 4.239113f}, // Leader Ice Wall 1 - {5534.202637f, 2054.254150f, 731.131165f, 4.360846f}, - {5526.244629f, 2023.878540f, 732.408264f, 4.419744f}, - {5513.573242f, 1996.611206f, 735.115723f, 4.239110f}, // Leader Ice Wall 2 - {5478.590820f, 1938.773315f, 741.926697f, 4.168423f}, - {5456.632324f, 1902.801025f, 747.220886f, 4.058471f}, // Leader Ice Wall 3 - {5423.630371f, 1858.672363f, 754.901367f, 4.078105f}, - {5402.314453f, 1829.705811f, 758.029907f, 3.932807f}, - {5374.380371f, 1802.807007f, 760.831238f, 3.897464f}, - {5340.560059f, 1772.791016f, 766.478149f, 3.760019f}, // Leader Ice Wall 4 - {5318.707031f, 1750.379395f, 771.635132f, 3.944588f}, - {5297.951660f, 1725.419067f, 778.211548f, 4.121302f}, - {5279.251953f, 1697.474365f, 785.700256f, 4.152715f}, - {5262.773926f, 1669.980103f, 784.301697f, 1.015049f} + {5588.055664f, 2229.327393f, 733.011353f, 5.440755f}, + {5605.567383f, 2203.448486f, 731.304626f, 5.059827f}, + {5607.415039f, 2189.225098f, 731.022217f, 4.203760f}, + {5598.958984f, 2169.660156f, 730.919800f, 4.093812f}, + {5586.018066f, 2149.685303f, 731.090759f, 4.093815f}, + {5558.182617f, 2103.950928f, 731.263000f, 4.239113f}, // Leader Ice Wall 1 + {5534.202637f, 2054.254150f, 731.131165f, 4.360846f}, + {5526.244629f, 2023.878540f, 732.408264f, 4.419744f}, + {5513.573242f, 1996.611206f, 735.115723f, 4.239110f}, // Leader Ice Wall 2 + {5478.590820f, 1938.773315f, 741.926697f, 4.168423f}, + {5456.632324f, 1902.801025f, 747.220886f, 4.058471f}, // Leader Ice Wall 3 + {5423.630371f, 1858.672363f, 754.901367f, 4.078105f}, + {5402.314453f, 1829.705811f, 758.029907f, 3.932807f}, + {5374.380371f, 1802.807007f, 760.831238f, 3.897464f}, + {5340.560059f, 1772.791016f, 766.478149f, 3.760019f}, // Leader Ice Wall 4 + {5318.707031f, 1750.379395f, 771.635132f, 3.944588f}, + {5297.951660f, 1725.419067f, 778.211548f, 4.121302f}, + {5279.251953f, 1697.474365f, 785.700256f, 4.152715f}, + {5262.773926f, 1669.980103f, 784.301697f, 1.015049f} }; const Position CannonFirePos[2][3] = { - { - {5231.177734f, 1617.087280f, 813.603755f, 0.990318f}, - {5222.555664f, 1623.302490f, 813.603755f, 0.868589f}, - {5203.667480f, 1630.986694f, 813.603755f, 0.790045f} - }, - { - {5233.234863f, 1572.758789f, 816.572266f, 1.202728f}, - {5220.500488f, 1577.656860f, 816.572266f, 1.128118f}, - {5209.669922f, 1584.753784f, 816.572266f, 0.982819f} - } + { + {5231.177734f, 1617.087280f, 813.603755f, 0.990318f}, + {5222.555664f, 1623.302490f, 813.603755f, 0.868589f}, + {5203.667480f, 1630.986694f, 813.603755f, 0.790045f} + }, + { + {5233.234863f, 1572.758789f, 816.572266f, 1.202728f}, + {5220.500488f, 1577.656860f, 816.572266f, 1.128118f}, + {5209.669922f, 1584.753784f, 816.572266f, 0.982819f} + } }; const Position StairsPos[2][3] = { - { - {5226.36f, 1640.87f, 785.737f, 5.56137f}, - {5213.76f, 1626.21f, 798.068f, 5.56534f}, - {0.0f, 0.0f, 0.0f, 0.0f} - }, - { - {5233.61f, 1607.48f, 796.5f, 5.77774f}, - {5223.32f, 1589.24f, 809.0f, 5.76989f}, - {5243.42f, 1624.8f, 784.361f, 5.76592f} - } + { + {5226.36f, 1640.87f, 785.737f, 5.56137f}, + {5213.76f, 1626.21f, 798.068f, 5.56534f}, + {0.0f, 0.0f, 0.0f, 0.0f} + }, + { + {5233.61f, 1607.48f, 796.5f, 5.77774f}, + {5223.32f, 1589.24f, 809.0f, 5.76989f}, + {5243.42f, 1624.8f, 784.361f, 5.76592f} + } }; #endif diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 1058d37b6..b08ddc60a 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -15,1218 +15,1218 @@ class UtherBatteredHiltEvent : public BasicEvent bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) { switch (_eventId) - { - case 1: - _owner.UpdatePosition(5300.53f, 1987.80f, 707.70f, 3.89f, true); - _owner.StopMovingOnCurrentPos(); - _owner.GetMotionMaster()->Clear(); - _owner.SetVisible(true); - _owner.NearTeleportTo(5300.53f, 1987.80f, 707.70f, 3.89f); - _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 2), _owner.m_Events.CalculateTime(1000)); - break; - case 2: - _owner.AI()->Talk(SAY_BATTERED_HILT_HALT); - break; - case 3: - _owner.CastSpell((Unit*)NULL, 69966, true); - _owner.AI()->Talk(SAY_BATTERED_HILT_REALIZE); - if (InstanceScript* instance = _owner.GetInstanceScript()) - instance->SetData(DATA_BATTERED_HILT, 4); - _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 4), _owner.m_Events.CalculateTime(3500)); - break; - case 4: - _owner.SetWalk(false); - _owner.GetMotionMaster()->MovePoint(0, 5337.53f, 1981.21f, 709.32f); - _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 5), _owner.m_Events.CalculateTime(6000)); - break; - case 5: - _owner.SetFacingTo(2.82f); - _owner.SetStandState(UNIT_STAND_STATE_KNEEL); - break; - case 6: - if (InstanceScript* instance = _owner.GetInstanceScript()) - instance->SetData(DATA_BATTERED_HILT, 6); - _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 7), _owner.m_Events.CalculateTime(2000)); - break; - case 7: - if (InstanceScript* instance = _owner.GetInstanceScript()) - instance->SetData(DATA_BATTERED_HILT, 7); - _owner.AI()->Talk(SAY_BATTERED_HILT_PREPARE); - _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 8), _owner.m_Events.CalculateTime(4000)); - break; - case 8: - _owner.SetReactState(REACT_AGGRESSIVE); - _owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - if (InstanceScript* instance = _owner.GetInstanceScript()) - instance->SetData(DATA_BATTERED_HILT, 8); - break; - case 9: - _owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO1); - _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(11000)); - break; - case 10: - _owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO2); - _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(7500)); - break; - case 11: - _owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO3); - _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(8000)); - break; - case 12: - _owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO4); - _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(5000)); - break; - case 13: - _owner.CastSpell((Unit*)NULL, 73036, true); - _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(3000)); - break; - case 14: - { - Position homePos = _owner.GetHomePosition(); - _owner.SetReactState(REACT_PASSIVE); - _owner.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - _owner.SetVisible(false); - _owner.UpdatePosition(homePos.GetPositionX(), homePos.GetPositionY(), homePos.GetPositionZ(), homePos.GetOrientation(), true); - _owner.StopMovingOnCurrentPos(); - _owner.GetMotionMaster()->Clear(); - if (InstanceScript* instance = _owner.GetInstanceScript()) - instance->SetData(DATA_BATTERED_HILT, 9); - } - break; - } + { + case 1: + _owner.UpdatePosition(5300.53f, 1987.80f, 707.70f, 3.89f, true); + _owner.StopMovingOnCurrentPos(); + _owner.GetMotionMaster()->Clear(); + _owner.SetVisible(true); + _owner.NearTeleportTo(5300.53f, 1987.80f, 707.70f, 3.89f); + _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 2), _owner.m_Events.CalculateTime(1000)); + break; + case 2: + _owner.AI()->Talk(SAY_BATTERED_HILT_HALT); + break; + case 3: + _owner.CastSpell((Unit*)NULL, 69966, true); + _owner.AI()->Talk(SAY_BATTERED_HILT_REALIZE); + if (InstanceScript* instance = _owner.GetInstanceScript()) + instance->SetData(DATA_BATTERED_HILT, 4); + _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 4), _owner.m_Events.CalculateTime(3500)); + break; + case 4: + _owner.SetWalk(false); + _owner.GetMotionMaster()->MovePoint(0, 5337.53f, 1981.21f, 709.32f); + _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 5), _owner.m_Events.CalculateTime(6000)); + break; + case 5: + _owner.SetFacingTo(2.82f); + _owner.SetStandState(UNIT_STAND_STATE_KNEEL); + break; + case 6: + if (InstanceScript* instance = _owner.GetInstanceScript()) + instance->SetData(DATA_BATTERED_HILT, 6); + _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 7), _owner.m_Events.CalculateTime(2000)); + break; + case 7: + if (InstanceScript* instance = _owner.GetInstanceScript()) + instance->SetData(DATA_BATTERED_HILT, 7); + _owner.AI()->Talk(SAY_BATTERED_HILT_PREPARE); + _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 8), _owner.m_Events.CalculateTime(4000)); + break; + case 8: + _owner.SetReactState(REACT_AGGRESSIVE); + _owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + if (InstanceScript* instance = _owner.GetInstanceScript()) + instance->SetData(DATA_BATTERED_HILT, 8); + break; + case 9: + _owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO1); + _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(11000)); + break; + case 10: + _owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO2); + _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(7500)); + break; + case 11: + _owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO3); + _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(8000)); + break; + case 12: + _owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO4); + _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(5000)); + break; + case 13: + _owner.CastSpell((Unit*)NULL, 73036, true); + _owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId+1), _owner.m_Events.CalculateTime(3000)); + break; + case 14: + { + Position homePos = _owner.GetHomePosition(); + _owner.SetReactState(REACT_PASSIVE); + _owner.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + _owner.SetVisible(false); + _owner.UpdatePosition(homePos.GetPositionX(), homePos.GetPositionY(), homePos.GetPositionZ(), homePos.GetOrientation(), true); + _owner.StopMovingOnCurrentPos(); + _owner.GetMotionMaster()->Clear(); + if (InstanceScript* instance = _owner.GetInstanceScript()) + instance->SetData(DATA_BATTERED_HILT, 9); + } + break; + } return true; } private: Creature& _owner; - uint8 _eventId; + uint8 _eventId; }; class instance_halls_of_reflection : public InstanceMapScript { public: - instance_halls_of_reflection() : InstanceMapScript("instance_halls_of_reflection", 668) { } + instance_halls_of_reflection() : InstanceMapScript("instance_halls_of_reflection", 668) { } - InstanceScript* GetInstanceScript(InstanceMap* pMap) const - { - return new instance_halls_of_reflection_InstanceMapScript(pMap); - } + InstanceScript* GetInstanceScript(InstanceMap* pMap) const + { + return new instance_halls_of_reflection_InstanceMapScript(pMap); + } - struct instance_halls_of_reflection_InstanceMapScript : public InstanceScript - { - instance_halls_of_reflection_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {}; + struct instance_halls_of_reflection_InstanceMapScript : public InstanceScript + { + instance_halls_of_reflection_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {}; - uint32 EncounterMask; - TeamId TeamIdInInstance; - uint64 NPC_FalricGUID; - uint64 NPC_MarwynGUID; - uint64 NPC_LichKingIntroGUID; - uint64 NPC_LeaderIntroGUID; - uint64 NPC_GuardGUID; - uint64 NPC_UtherGUID; - uint64 NPC_LichKingGUID; - uint64 NPC_LeaderGUID; - uint64 NPC_IceWallTargetGUID[4]; - uint64 NPC_AltarBunnyGUID; - uint64 NPC_QuelDelarGUID; - uint64 NPC_ShipCaptainGUID; - uint64 GO_FrostmourneGUID; - uint64 GO_FrostmourneAltarGUID; - uint64 GO_FrontDoorGUID; - uint64 GO_ArthasDoorGUID; - uint64 GO_CaveInGUID; - uint64 GO_DoorBeforeThroneGUID; - uint64 GO_DoorAfterThroneGUID; - uint64 GO_IceWallGUID; + uint32 EncounterMask; + TeamId TeamIdInInstance; + uint64 NPC_FalricGUID; + uint64 NPC_MarwynGUID; + uint64 NPC_LichKingIntroGUID; + uint64 NPC_LeaderIntroGUID; + uint64 NPC_GuardGUID; + uint64 NPC_UtherGUID; + uint64 NPC_LichKingGUID; + uint64 NPC_LeaderGUID; + uint64 NPC_IceWallTargetGUID[4]; + uint64 NPC_AltarBunnyGUID; + uint64 NPC_QuelDelarGUID; + uint64 NPC_ShipCaptainGUID; + uint64 GO_FrostmourneGUID; + uint64 GO_FrostmourneAltarGUID; + uint64 GO_FrontDoorGUID; + uint64 GO_ArthasDoorGUID; + uint64 GO_CaveInGUID; + uint64 GO_DoorBeforeThroneGUID; + uint64 GO_DoorAfterThroneGUID; + uint64 GO_IceWallGUID; - uint64 NPC_TrashGUID[NUM_OF_TRASH]; - bool TrashActive[NUM_OF_TRASH]; - uint8 TrashCounter; - uint32 chosenComposition[8][5]; - uint8 WaveNumber; - uint32 NextWaveTimer; - uint16 CheckPlayersTimer; - uint16 ResumeFirstEventTimer; - uint8 ResumeFirstEventStep; - bool bFinished5Waves; - uint8 reqKillCount; - bool IsDuringLKFight; - uint32 BatteredHiltStatus; + uint64 NPC_TrashGUID[NUM_OF_TRASH]; + bool TrashActive[NUM_OF_TRASH]; + uint8 TrashCounter; + uint32 chosenComposition[8][5]; + uint8 WaveNumber; + uint32 NextWaveTimer; + uint16 CheckPlayersTimer; + uint16 ResumeFirstEventTimer; + uint8 ResumeFirstEventStep; + bool bFinished5Waves; + uint8 reqKillCount; + bool IsDuringLKFight; + uint32 BatteredHiltStatus; - uint64 NPC_FrostswornGeneralGUID; - uint64 NPC_SpiritualReflectionGUID[5]; + uint64 NPC_FrostswornGeneralGUID; + uint64 NPC_SpiritualReflectionGUID[5]; - uint32 outroTimer; - uint8 outroStep; - MotionTransport* T1; + uint32 outroTimer; + uint8 outroStep; + MotionTransport* T1; - void Initialize() - { - EncounterMask = 0; - TeamIdInInstance = TEAM_NEUTRAL; - NPC_FalricGUID = 0; - NPC_MarwynGUID = 0; - NPC_LichKingIntroGUID = 0; - NPC_LeaderIntroGUID = 0; - NPC_GuardGUID = 0; - NPC_UtherGUID = 0; - NPC_LichKingGUID = 0; - NPC_LeaderGUID = 0; - memset(&NPC_IceWallTargetGUID, 0, sizeof(NPC_IceWallTargetGUID)); - NPC_AltarBunnyGUID = 0; - NPC_QuelDelarGUID = 0; - NPC_ShipCaptainGUID = 0; - GO_FrostmourneGUID = 0; - GO_FrostmourneAltarGUID = 0; - GO_FrontDoorGUID = 0; - GO_ArthasDoorGUID = 0; - GO_CaveInGUID = 0; - GO_DoorBeforeThroneGUID = 0; - GO_DoorAfterThroneGUID = 0; - GO_IceWallGUID = 0; + void Initialize() + { + EncounterMask = 0; + TeamIdInInstance = TEAM_NEUTRAL; + NPC_FalricGUID = 0; + NPC_MarwynGUID = 0; + NPC_LichKingIntroGUID = 0; + NPC_LeaderIntroGUID = 0; + NPC_GuardGUID = 0; + NPC_UtherGUID = 0; + NPC_LichKingGUID = 0; + NPC_LeaderGUID = 0; + memset(&NPC_IceWallTargetGUID, 0, sizeof(NPC_IceWallTargetGUID)); + NPC_AltarBunnyGUID = 0; + NPC_QuelDelarGUID = 0; + NPC_ShipCaptainGUID = 0; + GO_FrostmourneGUID = 0; + GO_FrostmourneAltarGUID = 0; + GO_FrontDoorGUID = 0; + GO_ArthasDoorGUID = 0; + GO_CaveInGUID = 0; + GO_DoorBeforeThroneGUID = 0; + GO_DoorAfterThroneGUID = 0; + GO_IceWallGUID = 0; - memset(&NPC_TrashGUID, 0, sizeof(NPC_TrashGUID)); - memset(&TrashActive, 0, sizeof(TrashActive)); - TrashCounter = 0; - memset(&chosenComposition, 0, sizeof(chosenComposition)); - WaveNumber = 0; - NextWaveTimer = 0; - CheckPlayersTimer = 5000; - ResumeFirstEventTimer = 0; - ResumeFirstEventStep = 0; - bFinished5Waves = false; - reqKillCount = 0; - IsDuringLKFight = false; - BatteredHiltStatus = 0; + memset(&NPC_TrashGUID, 0, sizeof(NPC_TrashGUID)); + memset(&TrashActive, 0, sizeof(TrashActive)); + TrashCounter = 0; + memset(&chosenComposition, 0, sizeof(chosenComposition)); + WaveNumber = 0; + NextWaveTimer = 0; + CheckPlayersTimer = 5000; + ResumeFirstEventTimer = 0; + ResumeFirstEventStep = 0; + bFinished5Waves = false; + reqKillCount = 0; + IsDuringLKFight = false; + BatteredHiltStatus = 0; - NPC_FrostswornGeneralGUID = 0; - memset(&NPC_SpiritualReflectionGUID, 0, sizeof(NPC_SpiritualReflectionGUID)); + NPC_FrostswornGeneralGUID = 0; + memset(&NPC_SpiritualReflectionGUID, 0, sizeof(NPC_SpiritualReflectionGUID)); - outroTimer = 0; - outroStep = 0; - T1 = NULL; - } + outroTimer = 0; + outroStep = 0; + T1 = NULL; + } - bool IsEncounterInProgress() const - { - return (instance->HavePlayers() && WaveNumber) || IsDuringLKFight; // during LK fight npcs are active and will unset this variable - } + bool IsEncounterInProgress() const + { + return (instance->HavePlayers() && WaveNumber) || IsDuringLKFight; // during LK fight npcs are active and will unset this variable + } - void OnCreatureCreate(Creature* creature) - { - if (TeamIdInInstance == TEAM_NEUTRAL) - { - Map::PlayerList const &players = instance->GetPlayers(); - if (!players.isEmpty()) - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player* p = itr->GetSource()) - if (!p->IsGameMaster()) - { - TeamIdInInstance = p->GetTeamId(); - break; - } - } + void OnCreatureCreate(Creature* creature) + { + if (TeamIdInInstance == TEAM_NEUTRAL) + { + Map::PlayerList const &players = instance->GetPlayers(); + if (!players.isEmpty()) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* p = itr->GetSource()) + if (!p->IsGameMaster()) + { + TeamIdInInstance = p->GetTeamId(); + break; + } + } - switch(creature->GetEntry()) - { - case NPC_SYLVANAS_PART1: - creature->SetVisible(false); - NPC_LeaderIntroGUID = creature->GetGUID(); - if (TeamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_JAINA_PART1); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); - creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - break; - case NPC_DARK_RANGER_LORALEN: - creature->SetVisible(false); - NPC_GuardGUID = creature->GetGUID(); - if (TeamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_ARCHMAGE_ELANDRA); - break; - case NPC_UTHER: - creature->SetVisible(false); - NPC_UtherGUID = creature->GetGUID(); - creature->SetReactState(REACT_PASSIVE); - break; - case NPC_LICH_KING_EVENT: - creature->SetVisible(false); - NPC_LichKingIntroGUID = creature->GetGUID(); - creature->SetReactState(REACT_PASSIVE); - creature->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - break; - case NPC_FALRIC: - creature->SetVisible(false); - NPC_FalricGUID = creature->GetGUID(); - creature->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - break; - case NPC_MARWYN: - creature->SetVisible(false); - NPC_MarwynGUID = creature->GetGUID(); - creature->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - break; - case NPC_WAVE_MERCENARY: - case NPC_WAVE_FOOTMAN: - case NPC_WAVE_RIFLEMAN: - case NPC_WAVE_PRIEST: - case NPC_WAVE_MAGE: - if (TrashCounter < NUM_OF_TRASH) - NPC_TrashGUID[TrashCounter++] = creature->GetGUID(); - if (!(EncounterMask & (1 << DATA_MARWYN)) && !creature->IsAlive()) - creature->Respawn(); - creature->SetVisible(false); - break; - case NPC_FROSTSWORN_GENERAL: - if (!(EncounterMask & (1 << DATA_MARWYN))) - { - creature->SetVisible(false); - creature->SetReactState(REACT_PASSIVE); - } - NPC_FrostswornGeneralGUID = creature->GetGUID(); - break; - case NPC_SPIRITUAL_REFLECTION: - for (uint8 i=0; i<5; ++i) - if (!NPC_SpiritualReflectionGUID[i]) - { - NPC_SpiritualReflectionGUID[i] = creature->GetGUID(); - break; - } - creature->SetVisible(false); - break; - case NPC_LICH_KING_BOSS: - if (!(EncounterMask & (1 << DATA_FROSTSWORN_GENERAL))) - creature->SetVisible(false); - if (!(EncounterMask & (1 << DATA_LK_INTRO))) - { - creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK2HTIGHT); - if (TeamIdInInstance != TEAM_ALLIANCE) - { - creature->StopMoving(); - creature->SetFacingTo(creature->GetAngle(&SylvanasFightPos)); - } - } - else if (!(EncounterMask & (1 << DATA_LICH_KING))) - creature->AddAura(TeamIdInInstance == TEAM_ALLIANCE ? SPELL_JAINA_ICE_PRISON : SPELL_SYLVANAS_DARK_BINDING, creature); - else - creature->SetVisible(false); + switch(creature->GetEntry()) + { + case NPC_SYLVANAS_PART1: + creature->SetVisible(false); + NPC_LeaderIntroGUID = creature->GetGUID(); + if (TeamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_JAINA_PART1); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + break; + case NPC_DARK_RANGER_LORALEN: + creature->SetVisible(false); + NPC_GuardGUID = creature->GetGUID(); + if (TeamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_ARCHMAGE_ELANDRA); + break; + case NPC_UTHER: + creature->SetVisible(false); + NPC_UtherGUID = creature->GetGUID(); + creature->SetReactState(REACT_PASSIVE); + break; + case NPC_LICH_KING_EVENT: + creature->SetVisible(false); + NPC_LichKingIntroGUID = creature->GetGUID(); + creature->SetReactState(REACT_PASSIVE); + creature->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + break; + case NPC_FALRIC: + creature->SetVisible(false); + NPC_FalricGUID = creature->GetGUID(); + creature->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + break; + case NPC_MARWYN: + creature->SetVisible(false); + NPC_MarwynGUID = creature->GetGUID(); + creature->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + break; + case NPC_WAVE_MERCENARY: + case NPC_WAVE_FOOTMAN: + case NPC_WAVE_RIFLEMAN: + case NPC_WAVE_PRIEST: + case NPC_WAVE_MAGE: + if (TrashCounter < NUM_OF_TRASH) + NPC_TrashGUID[TrashCounter++] = creature->GetGUID(); + if (!(EncounterMask & (1 << DATA_MARWYN)) && !creature->IsAlive()) + creature->Respawn(); + creature->SetVisible(false); + break; + case NPC_FROSTSWORN_GENERAL: + if (!(EncounterMask & (1 << DATA_MARWYN))) + { + creature->SetVisible(false); + creature->SetReactState(REACT_PASSIVE); + } + NPC_FrostswornGeneralGUID = creature->GetGUID(); + break; + case NPC_SPIRITUAL_REFLECTION: + for (uint8 i=0; i<5; ++i) + if (!NPC_SpiritualReflectionGUID[i]) + { + NPC_SpiritualReflectionGUID[i] = creature->GetGUID(); + break; + } + creature->SetVisible(false); + break; + case NPC_LICH_KING_BOSS: + if (!(EncounterMask & (1 << DATA_FROSTSWORN_GENERAL))) + creature->SetVisible(false); + if (!(EncounterMask & (1 << DATA_LK_INTRO))) + { + creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK2HTIGHT); + if (TeamIdInInstance != TEAM_ALLIANCE) + { + creature->StopMoving(); + creature->SetFacingTo(creature->GetAngle(&SylvanasFightPos)); + } + } + else if (!(EncounterMask & (1 << DATA_LICH_KING))) + creature->AddAura(TeamIdInInstance == TEAM_ALLIANCE ? SPELL_JAINA_ICE_PRISON : SPELL_SYLVANAS_DARK_BINDING, creature); + else + creature->SetVisible(false); - NPC_LichKingGUID = creature->GetGUID(); - creature->SetHealth((creature->GetMaxHealth()*3)/4); - creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - break; - case NPC_SYLVANAS_PART2: - if (!creature->IsAlive()) - creature->Respawn(); - NPC_LeaderGUID = creature->GetGUID(); - if (TeamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_JAINA_PART2); - creature->SetHealth(creature->GetMaxHealth()/20); + NPC_LichKingGUID = creature->GetGUID(); + creature->SetHealth((creature->GetMaxHealth()*3)/4); + creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + break; + case NPC_SYLVANAS_PART2: + if (!creature->IsAlive()) + creature->Respawn(); + NPC_LeaderGUID = creature->GetGUID(); + if (TeamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_JAINA_PART2); + creature->SetHealth(creature->GetMaxHealth()/20); - if (!(EncounterMask & (1 << DATA_FROSTSWORN_GENERAL))) - creature->SetVisible(false); - if (!(EncounterMask & (1 << DATA_LK_INTRO))) - { - creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, TeamIdInInstance == TEAM_ALLIANCE ? EMOTE_ONESHOT_ATTACK2HTIGHT : EMOTE_ONESHOT_ATTACK1H); - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); - creature->CastSpell(creature, TeamIdInInstance == TEAM_ALLIANCE ? SPELL_JAINA_ICE_BARRIER : SPELL_SYLVANAS_CLOAK_OF_DARKNESS, true); - if (TeamIdInInstance != TEAM_ALLIANCE) - { - creature->UpdatePosition(SylvanasFightPos, true); - creature->StopMovingOnCurrentPos(); - } - } - else if (!(EncounterMask & (1 << DATA_LICH_KING))) - { - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - creature->UpdatePosition(LeaderEscapePos, true); - creature->StopMovingOnCurrentPos(); - } - else - { - instance->LoadGrid(PathWaypoints[PATH_WP_COUNT-1].GetPositionX(), PathWaypoints[PATH_WP_COUNT-1].GetPositionY()); - creature->UpdatePosition(PathWaypoints[PATH_WP_COUNT-1], true); - creature->StopMovingOnCurrentPos(); - } - creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - break; - case NPC_ICE_WALL_TARGET: - if (creature->GetPositionX() > 5525.0f) - NPC_IceWallTargetGUID[0] = creature->GetGUID(); - else if (creature->GetPositionX() > 5475.0f) - NPC_IceWallTargetGUID[1] = creature->GetGUID(); - else if (creature->GetPositionX() > 5400.0f) - NPC_IceWallTargetGUID[2] = creature->GetGUID(); - else - NPC_IceWallTargetGUID[3] = creature->GetGUID(); - break; - case NPC_ALTAR_BUNNY: - NPC_AltarBunnyGUID = creature->GetGUID(); - break; - case NPC_QUEL_DELAR: - NPC_QuelDelarGUID = creature->GetGUID(); - creature->SetReactState(REACT_PASSIVE); - break; - case NPC_HIGH_CAPTAIN_JUSTIN_BARLETT: - case NPC_SKY_REAVER_KORM_BLACKSKAR: - NPC_ShipCaptainGUID = creature->GetGUID(); - break; - } - } + if (!(EncounterMask & (1 << DATA_FROSTSWORN_GENERAL))) + creature->SetVisible(false); + if (!(EncounterMask & (1 << DATA_LK_INTRO))) + { + creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, TeamIdInInstance == TEAM_ALLIANCE ? EMOTE_ONESHOT_ATTACK2HTIGHT : EMOTE_ONESHOT_ATTACK1H); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + creature->CastSpell(creature, TeamIdInInstance == TEAM_ALLIANCE ? SPELL_JAINA_ICE_BARRIER : SPELL_SYLVANAS_CLOAK_OF_DARKNESS, true); + if (TeamIdInInstance != TEAM_ALLIANCE) + { + creature->UpdatePosition(SylvanasFightPos, true); + creature->StopMovingOnCurrentPos(); + } + } + else if (!(EncounterMask & (1 << DATA_LICH_KING))) + { + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + creature->UpdatePosition(LeaderEscapePos, true); + creature->StopMovingOnCurrentPos(); + } + else + { + instance->LoadGrid(PathWaypoints[PATH_WP_COUNT-1].GetPositionX(), PathWaypoints[PATH_WP_COUNT-1].GetPositionY()); + creature->UpdatePosition(PathWaypoints[PATH_WP_COUNT-1], true); + creature->StopMovingOnCurrentPos(); + } + creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + break; + case NPC_ICE_WALL_TARGET: + if (creature->GetPositionX() > 5525.0f) + NPC_IceWallTargetGUID[0] = creature->GetGUID(); + else if (creature->GetPositionX() > 5475.0f) + NPC_IceWallTargetGUID[1] = creature->GetGUID(); + else if (creature->GetPositionX() > 5400.0f) + NPC_IceWallTargetGUID[2] = creature->GetGUID(); + else + NPC_IceWallTargetGUID[3] = creature->GetGUID(); + break; + case NPC_ALTAR_BUNNY: + NPC_AltarBunnyGUID = creature->GetGUID(); + break; + case NPC_QUEL_DELAR: + NPC_QuelDelarGUID = creature->GetGUID(); + creature->SetReactState(REACT_PASSIVE); + break; + case NPC_HIGH_CAPTAIN_JUSTIN_BARLETT: + case NPC_SKY_REAVER_KORM_BLACKSKAR: + NPC_ShipCaptainGUID = creature->GetGUID(); + break; + } + } - void OnGameObjectCreate(GameObject* go) - { - switch(go->GetEntry()) - { - case GO_FROSTMOURNE: - GO_FrostmourneGUID = go->GetGUID(); - HandleGameObject(0, false, go); - if (EncounterMask & (1 << DATA_INTRO)) - go->SetPhaseMask(2, true); - break; - case GO_FROSTMOURNE_ALTAR: - GO_FrostmourneAltarGUID = go->GetGUID(); - break; - case GO_FRONT_DOOR: - GO_FrontDoorGUID = go->GetGUID(); - HandleGameObject(0, true, go); - break; - case GO_ARTHAS_DOOR: - GO_ArthasDoorGUID = go->GetGUID(); - HandleGameObject(0, (EncounterMask & (1 << DATA_MARWYN)), go); - break; - case GO_CAVE_IN: - GO_CaveInGUID = go->GetGUID(); - break; - case GO_DOOR_BEFORE_THRONE: - GO_DoorBeforeThroneGUID = go->GetGUID(); - break; - case GO_DOOR_AFTER_THRONE: - GO_DoorAfterThroneGUID = go->GetGUID(); - break; - case GO_ICE_WALL: - GO_IceWallGUID = go->GetGUID(); - break; - } - } + void OnGameObjectCreate(GameObject* go) + { + switch(go->GetEntry()) + { + case GO_FROSTMOURNE: + GO_FrostmourneGUID = go->GetGUID(); + HandleGameObject(0, false, go); + if (EncounterMask & (1 << DATA_INTRO)) + go->SetPhaseMask(2, true); + break; + case GO_FROSTMOURNE_ALTAR: + GO_FrostmourneAltarGUID = go->GetGUID(); + break; + case GO_FRONT_DOOR: + GO_FrontDoorGUID = go->GetGUID(); + HandleGameObject(0, true, go); + break; + case GO_ARTHAS_DOOR: + GO_ArthasDoorGUID = go->GetGUID(); + HandleGameObject(0, (EncounterMask & (1 << DATA_MARWYN)), go); + break; + case GO_CAVE_IN: + GO_CaveInGUID = go->GetGUID(); + break; + case GO_DOOR_BEFORE_THRONE: + GO_DoorBeforeThroneGUID = go->GetGUID(); + break; + case GO_DOOR_AFTER_THRONE: + GO_DoorAfterThroneGUID = go->GetGUID(); + break; + case GO_ICE_WALL: + GO_IceWallGUID = go->GetGUID(); + break; + } + } - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_INTRO: - EncounterMask |= (1 << DATA_INTRO); - AddWave1(); - break; - case ACTION_SHOW_TRASH: - RandomizeCompositionsAndShow(); - break; - case DATA_FALRIC: - if (WaveNumber) - { - if (data == NOT_STARTED) - DoWipe1(); - else if (data == DONE) - { - NextWaveTimer = 60000; - EncounterMask |= (1 << DATA_FALRIC); - } - } - break; - case DATA_MARWYN: - if (WaveNumber) - { - if (data == NOT_STARTED) - DoWipe1(); - else if (data == DONE) - { - EncounterMask |= (1 << DATA_MARWYN); - HandleGameObject(GO_FrontDoorGUID, true); - HandleGameObject(GO_ArthasDoorGUID, true); - if (Creature* c = instance->GetCreature(NPC_FrostswornGeneralGUID)) - { - c->SetVisible(true); - c->SetReactState(REACT_AGGRESSIVE); - } - WaveNumber = 0; - DoUpdateWorldState(WORLD_STATE_HOR_COUNTER, 0); + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_INTRO: + EncounterMask |= (1 << DATA_INTRO); + AddWave1(); + break; + case ACTION_SHOW_TRASH: + RandomizeCompositionsAndShow(); + break; + case DATA_FALRIC: + if (WaveNumber) + { + if (data == NOT_STARTED) + DoWipe1(); + else if (data == DONE) + { + NextWaveTimer = 60000; + EncounterMask |= (1 << DATA_FALRIC); + } + } + break; + case DATA_MARWYN: + if (WaveNumber) + { + if (data == NOT_STARTED) + DoWipe1(); + else if (data == DONE) + { + EncounterMask |= (1 << DATA_MARWYN); + HandleGameObject(GO_FrontDoorGUID, true); + HandleGameObject(GO_ArthasDoorGUID, true); + if (Creature* c = instance->GetCreature(NPC_FrostswornGeneralGUID)) + { + c->SetVisible(true); + c->SetReactState(REACT_AGGRESSIVE); + } + WaveNumber = 0; + DoUpdateWorldState(WORLD_STATE_HOR_COUNTER, 0); - // give quest - Map::PlayerList const& pl = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - p->CastSpell(p, p->GetTeamId() == TEAM_ALLIANCE ? SPELL_HOR_START_QUEST_ALLY : SPELL_HOR_START_QUEST_HORDE, true); - } - } - break; - case DATA_FROSTSWORN_GENERAL: - EncounterMask |= (1 << DATA_FROSTSWORN_GENERAL); - if (data == DONE) - { - if (Creature* c = instance->GetCreature(NPC_LichKingGUID)) - c->SetVisible(true); - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - c->SetVisible(true); - } - break; - case ACTION_SPIRITUAL_REFLECTIONS_COPY: - { - uint8 i=0; - Map::PlayerList const& pl = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->IsAlive() && !p->IsGameMaster()) - if (Creature* c = instance->GetCreature(NPC_SpiritualReflectionGUID[i++])) - { - if (!c->IsAlive()) - c->Respawn(); - c->SetDisableGravity(true); - c->SetCanFly(true); - c->SetVisible(true); + // give quest + Map::PlayerList const& pl = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + p->CastSpell(p, p->GetTeamId() == TEAM_ALLIANCE ? SPELL_HOR_START_QUEST_ALLY : SPELL_HOR_START_QUEST_HORDE, true); + } + } + break; + case DATA_FROSTSWORN_GENERAL: + EncounterMask |= (1 << DATA_FROSTSWORN_GENERAL); + if (data == DONE) + { + if (Creature* c = instance->GetCreature(NPC_LichKingGUID)) + c->SetVisible(true); + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + c->SetVisible(true); + } + break; + case ACTION_SPIRITUAL_REFLECTIONS_COPY: + { + uint8 i=0; + Map::PlayerList const& pl = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->IsAlive() && !p->IsGameMaster()) + if (Creature* c = instance->GetCreature(NPC_SpiritualReflectionGUID[i++])) + { + if (!c->IsAlive()) + c->Respawn(); + c->SetDisableGravity(true); + c->SetCanFly(true); + c->SetVisible(true); - Item* i; - i = p->GetWeaponForAttack(BASE_ATTACK); - c->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, i ? i->GetEntry() : 0); - i = p->GetWeaponForAttack(OFF_ATTACK); - c->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, i ? i->GetEntry() : 0); - i = p->GetWeaponForAttack(RANGED_ATTACK); - c->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, i ? i->GetEntry() : 0); - p->CastSpell(c, SPELL_HOR_CLONE, true); - p->CastSpell(c, SPELL_HOR_CLONE_NAME, true); - } - } - break; - case ACTION_SPIRITUAL_REFLECTIONS_ACTIVATE: - if (Creature* fg = instance->GetCreature(NPC_FrostswornGeneralGUID)) - for (uint8 i=0; i<5; ++i) - if (Creature* c = instance->GetCreature(NPC_SpiritualReflectionGUID[i])) - if (c->IsVisible()) - { - c->SetInCombatWithZone(); - c->SetDisableGravity(false); - c->SetCanFly(false); - c->GetMotionMaster()->MoveJump(fg->GetPositionX(), fg->GetPositionY(), fg->GetPositionZ(), 20.0f, 10.0f); - } - break; - case ACTION_SPIRITUAL_REFLECTIONS_HIDE: - for (uint8 i=0; i<5; ++i) - if (Creature* c = instance->GetCreature(NPC_SpiritualReflectionGUID[i])) - c->AI()->EnterEvadeMode(); - break; - case DATA_LK_INTRO: - EncounterMask |= (1 << DATA_LK_INTRO); - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - c->AI()->DoAction(ACTION_START_INTRO); - break; - case ACTION_START_LK_FIGHT: - IsDuringLKFight = true; - DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_RETREATING_TIMED_EVENT); - DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_RETREATING_TIMED_EVENT); - break; - case ACTION_STOP_LK_FIGHT: - if (!IsDuringLKFight) - break; - instance->LoadGrid(LeaderEscapePos.GetPositionX(), LeaderEscapePos.GetPositionY()); - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - { - if (!c->IsAlive()) - { - c->Respawn(); - if (TeamIdInInstance == TEAM_ALLIANCE) - c->UpdateEntry(NPC_JAINA_PART2); - } - c->DeleteThreatList(); - c->CombatStop(true); - c->InterruptNonMeleeSpells(true); - c->GetMotionMaster()->Clear(); - c->GetMotionMaster()->MoveIdle(); - c->UpdatePosition(LeaderEscapePos, true); - c->StopMovingOnCurrentPos(); - c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - c->SetHealth(c->GetMaxHealth()/20); - c->AI()->Reset(); - c->setActive(false); - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - } - if (Creature* c = instance->GetCreature(NPC_LichKingGUID)) - { - c->DeleteThreatList(); - c->CombatStop(true); - c->InterruptNonMeleeSpells(true); - c->GetMotionMaster()->Clear(); - c->GetMotionMaster()->MoveIdle(); - c->UpdatePosition(c->GetHomePosition(), true); - c->StopMovingOnCurrentPos(); - c->RemoveAllAuras(); - c->AddAura(TeamIdInInstance == TEAM_ALLIANCE ? SPELL_JAINA_ICE_PRISON : SPELL_SYLVANAS_DARK_BINDING, c); - c->AI()->Reset(); - c->setActive(false); - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - c->SetSpeed(MOVE_RUN, c->GetCreatureTemplate()->speed_run); - } - IsDuringLKFight = false; - outroTimer = 0; - outroStep = 0; - // no break intended - case ACTION_DELETE_ICE_WALL: - HandleGameObject(GO_IceWallGUID, true); - GO_IceWallGUID = 0; - break; - case DATA_LICH_KING: - if (data == DONE) - { - instance->LoadGrid(PathWaypoints[0].GetPositionX(), PathWaypoints[0].GetPositionY()); - EncounterMask |= (1 << DATA_LICH_KING); - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - c->setActive(false); - if (Creature* c = instance->GetCreature(NPC_LichKingGUID)) - c->setActive(false); - IsDuringLKFight = false; - outroStep = 1; - outroTimer = 0; - } - break; - case DATA_BATTERED_HILT: - { - if (EncounterMask & (1 << DATA_BATTERED_HILT)) - return; + Item* i; + i = p->GetWeaponForAttack(BASE_ATTACK); + c->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, i ? i->GetEntry() : 0); + i = p->GetWeaponForAttack(OFF_ATTACK); + c->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, i ? i->GetEntry() : 0); + i = p->GetWeaponForAttack(RANGED_ATTACK); + c->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, i ? i->GetEntry() : 0); + p->CastSpell(c, SPELL_HOR_CLONE, true); + p->CastSpell(c, SPELL_HOR_CLONE_NAME, true); + } + } + break; + case ACTION_SPIRITUAL_REFLECTIONS_ACTIVATE: + if (Creature* fg = instance->GetCreature(NPC_FrostswornGeneralGUID)) + for (uint8 i=0; i<5; ++i) + if (Creature* c = instance->GetCreature(NPC_SpiritualReflectionGUID[i])) + if (c->IsVisible()) + { + c->SetInCombatWithZone(); + c->SetDisableGravity(false); + c->SetCanFly(false); + c->GetMotionMaster()->MoveJump(fg->GetPositionX(), fg->GetPositionY(), fg->GetPositionZ(), 20.0f, 10.0f); + } + break; + case ACTION_SPIRITUAL_REFLECTIONS_HIDE: + for (uint8 i=0; i<5; ++i) + if (Creature* c = instance->GetCreature(NPC_SpiritualReflectionGUID[i])) + c->AI()->EnterEvadeMode(); + break; + case DATA_LK_INTRO: + EncounterMask |= (1 << DATA_LK_INTRO); + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + c->AI()->DoAction(ACTION_START_INTRO); + break; + case ACTION_START_LK_FIGHT: + IsDuringLKFight = true; + DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_RETREATING_TIMED_EVENT); + DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_RETREATING_TIMED_EVENT); + break; + case ACTION_STOP_LK_FIGHT: + if (!IsDuringLKFight) + break; + instance->LoadGrid(LeaderEscapePos.GetPositionX(), LeaderEscapePos.GetPositionY()); + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + { + if (!c->IsAlive()) + { + c->Respawn(); + if (TeamIdInInstance == TEAM_ALLIANCE) + c->UpdateEntry(NPC_JAINA_PART2); + } + c->DeleteThreatList(); + c->CombatStop(true); + c->InterruptNonMeleeSpells(true); + c->GetMotionMaster()->Clear(); + c->GetMotionMaster()->MoveIdle(); + c->UpdatePosition(LeaderEscapePos, true); + c->StopMovingOnCurrentPos(); + c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + c->SetHealth(c->GetMaxHealth()/20); + c->AI()->Reset(); + c->setActive(false); + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + } + if (Creature* c = instance->GetCreature(NPC_LichKingGUID)) + { + c->DeleteThreatList(); + c->CombatStop(true); + c->InterruptNonMeleeSpells(true); + c->GetMotionMaster()->Clear(); + c->GetMotionMaster()->MoveIdle(); + c->UpdatePosition(c->GetHomePosition(), true); + c->StopMovingOnCurrentPos(); + c->RemoveAllAuras(); + c->AddAura(TeamIdInInstance == TEAM_ALLIANCE ? SPELL_JAINA_ICE_PRISON : SPELL_SYLVANAS_DARK_BINDING, c); + c->AI()->Reset(); + c->setActive(false); + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + c->SetSpeed(MOVE_RUN, c->GetCreatureTemplate()->speed_run); + } + IsDuringLKFight = false; + outroTimer = 0; + outroStep = 0; + // no break intended + case ACTION_DELETE_ICE_WALL: + HandleGameObject(GO_IceWallGUID, true); + GO_IceWallGUID = 0; + break; + case DATA_LICH_KING: + if (data == DONE) + { + instance->LoadGrid(PathWaypoints[0].GetPositionX(), PathWaypoints[0].GetPositionY()); + EncounterMask |= (1 << DATA_LICH_KING); + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + c->setActive(false); + if (Creature* c = instance->GetCreature(NPC_LichKingGUID)) + c->setActive(false); + IsDuringLKFight = false; + outroStep = 1; + outroTimer = 0; + } + break; + case DATA_BATTERED_HILT: + { + if (EncounterMask & (1 << DATA_BATTERED_HILT)) + return; - switch(data) - { - case 1: // talked to leader - EncounterMask |= (1 << DATA_BATTERED_HILT); - SaveToDB(); - break; - case 2: - if (BatteredHiltStatus) - break; - BatteredHiltStatus |= BHSF_STARTED; - if (Creature* c = instance->GetCreature(NPC_AltarBunnyGUID)) - c->CastSpell(c, 70720, true); - if (Creature* c = instance->GetCreature(NPC_UtherGUID)) - c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 1), c->m_Events.CalculateTime(3000)); - break; - case 3: - if ((BatteredHiltStatus & BHSF_STARTED) == 0 || (BatteredHiltStatus & BHSF_THROWN)) - break; - BatteredHiltStatus |= BHSF_THROWN; - if (Creature* c = instance->GetCreature(NPC_UtherGUID)) - { - c->AI()->Talk(SAY_BATTERED_HILT_LEAP); - c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 3), c->m_Events.CalculateTime(1500)); - } - break; - case 4: - if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID)) - { - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - c->SetSpeed(MOVE_RUN, 2.5f); - } - break; - case 5: - if (Creature* c = instance->GetCreature(NPC_UtherGUID)) - c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 6), c->m_Events.CalculateTime(3000)); - break; - case 6: - if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID)) - { - c->SetSpeed(MOVE_RUN, c->GetCreatureTemplate()->speed_run); - c->GetMotionMaster()->MoveLand(0, c->GetPositionX(), c->GetPositionY(), 707.70f, 7.0f); - } - break; - case 7: - if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID)) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - c->RemoveAurasDueToSpell(70300); - } - break; - case 8: - if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID)) - c->SetInCombatWithZone(); - break; - case 9: - EncounterMask |= (1 << DATA_BATTERED_HILT); - BatteredHiltStatus |= BHSF_FINISHED; - SaveToDB(); - break; - } - } - return; - } + switch(data) + { + case 1: // talked to leader + EncounterMask |= (1 << DATA_BATTERED_HILT); + SaveToDB(); + break; + case 2: + if (BatteredHiltStatus) + break; + BatteredHiltStatus |= BHSF_STARTED; + if (Creature* c = instance->GetCreature(NPC_AltarBunnyGUID)) + c->CastSpell(c, 70720, true); + if (Creature* c = instance->GetCreature(NPC_UtherGUID)) + c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 1), c->m_Events.CalculateTime(3000)); + break; + case 3: + if ((BatteredHiltStatus & BHSF_STARTED) == 0 || (BatteredHiltStatus & BHSF_THROWN)) + break; + BatteredHiltStatus |= BHSF_THROWN; + if (Creature* c = instance->GetCreature(NPC_UtherGUID)) + { + c->AI()->Talk(SAY_BATTERED_HILT_LEAP); + c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 3), c->m_Events.CalculateTime(1500)); + } + break; + case 4: + if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID)) + { + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + c->SetSpeed(MOVE_RUN, 2.5f); + } + break; + case 5: + if (Creature* c = instance->GetCreature(NPC_UtherGUID)) + c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 6), c->m_Events.CalculateTime(3000)); + break; + case 6: + if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID)) + { + c->SetSpeed(MOVE_RUN, c->GetCreatureTemplate()->speed_run); + c->GetMotionMaster()->MoveLand(0, c->GetPositionX(), c->GetPositionY(), 707.70f, 7.0f); + } + break; + case 7: + if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID)) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + c->RemoveAurasDueToSpell(70300); + } + break; + case 8: + if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID)) + c->SetInCombatWithZone(); + break; + case 9: + EncounterMask |= (1 << DATA_BATTERED_HILT); + BatteredHiltStatus |= BHSF_FINISHED; + SaveToDB(); + break; + } + } + return; + } - if (data == DONE) - SaveToDB(); - } + if (data == DONE) + SaveToDB(); + } - uint32 GetData(uint32 type) const - { - switch(type) - { - case DATA_INTRO: - case DATA_FALRIC: - case DATA_MARWYN: - case DATA_FROSTSWORN_GENERAL: - case DATA_LK_INTRO: - case DATA_LICH_KING: - return EncounterMask & (1 << type); - case DATA_WAVE_NUMBER: - return (uint32)WaveNumber; - case DATA_BATTERED_HILT: - return BatteredHiltStatus; - } + uint32 GetData(uint32 type) const + { + switch(type) + { + case DATA_INTRO: + case DATA_FALRIC: + case DATA_MARWYN: + case DATA_FROSTSWORN_GENERAL: + case DATA_LK_INTRO: + case DATA_LICH_KING: + return EncounterMask & (1 << type); + case DATA_WAVE_NUMBER: + return (uint32)WaveNumber; + case DATA_BATTERED_HILT: + return BatteredHiltStatus; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 type) const - { - switch(type) - { - case NPC_DARK_RANGER_LORALEN: - return NPC_GuardGUID; - case NPC_LICH_KING_EVENT: - return NPC_LichKingIntroGUID; - case NPC_UTHER: - return NPC_UtherGUID; - case DATA_FALRIC: - return NPC_FalricGUID; - case DATA_MARWYN: - return NPC_MarwynGUID; - case NPC_LICH_KING_BOSS: - return NPC_LichKingGUID; - case NPC_SYLVANAS_PART2: - return NPC_LeaderGUID; - case NPC_ICE_WALL_TARGET: - case NPC_ICE_WALL_TARGET+1: - case NPC_ICE_WALL_TARGET+2: - case NPC_ICE_WALL_TARGET+3: - return NPC_IceWallTargetGUID[type-NPC_ICE_WALL_TARGET]; - case GO_FROSTMOURNE: - return GO_FrostmourneGUID; - case GO_ARTHAS_DOOR: - return GO_ArthasDoorGUID; - case GO_FRONT_DOOR: - return GO_FrontDoorGUID; - } + uint64 GetData64(uint32 type) const + { + switch(type) + { + case NPC_DARK_RANGER_LORALEN: + return NPC_GuardGUID; + case NPC_LICH_KING_EVENT: + return NPC_LichKingIntroGUID; + case NPC_UTHER: + return NPC_UtherGUID; + case DATA_FALRIC: + return NPC_FalricGUID; + case DATA_MARWYN: + return NPC_MarwynGUID; + case NPC_LICH_KING_BOSS: + return NPC_LichKingGUID; + case NPC_SYLVANAS_PART2: + return NPC_LeaderGUID; + case NPC_ICE_WALL_TARGET: + case NPC_ICE_WALL_TARGET+1: + case NPC_ICE_WALL_TARGET+2: + case NPC_ICE_WALL_TARGET+3: + return NPC_IceWallTargetGUID[type-NPC_ICE_WALL_TARGET]; + case GO_FROSTMOURNE: + return GO_FrostmourneGUID; + case GO_ARTHAS_DOOR: + return GO_ArthasDoorGUID; + case GO_FRONT_DOOR: + return GO_FrontDoorGUID; + } - return 0; - } + return 0; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "H R " << EncounterMask; + std::ostringstream saveStream; + saveStream << "H R " << EncounterMask; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint32 data0; + char dataHead1, dataHead2; + uint32 data0; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0; - if (dataHead1 == 'H' && dataHead2 == 'R') - { - EncounterMask = data0; - BatteredHiltStatus = (EncounterMask & (1 << DATA_BATTERED_HILT)) ? BHSF_FINISHED : BHSF_NONE; - } - else - OUT_LOAD_INST_DATA_FAIL; + if (dataHead1 == 'H' && dataHead2 == 'R') + { + EncounterMask = data0; + BatteredHiltStatus = (EncounterMask & (1 << DATA_BATTERED_HILT)) ? BHSF_FINISHED : BHSF_NONE; + } + else + OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } - void OnUnitDeath(Unit* unit) - { - if (WaveNumber && reqKillCount) - if (unit->GetEntry() == NPC_WAVE_MERCENARY || unit->GetEntry() == NPC_WAVE_FOOTMAN || unit->GetEntry() == NPC_WAVE_RIFLEMAN || unit->GetEntry() == NPC_WAVE_PRIEST || unit->GetEntry() == NPC_WAVE_MAGE) - if ((--reqKillCount) == 0 && WaveNumber%5 && NextWaveTimer > 5000) - NextWaveTimer = 5000; - - if (unit->GetEntry() == NPC_QUEL_DELAR) - if (Creature* c = instance->GetCreature(NPC_UtherGUID)) - { - c->SetStandState(UNIT_STAND_STATE_STAND); - c->SetWalk(false); - c->GetMotionMaster()->MovePoint(0, 5313.92f, 1989.36f, 707.70f); - c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 9), c->m_Events.CalculateTime(7000)); - } - } + void OnUnitDeath(Unit* unit) + { + if (WaveNumber && reqKillCount) + if (unit->GetEntry() == NPC_WAVE_MERCENARY || unit->GetEntry() == NPC_WAVE_FOOTMAN || unit->GetEntry() == NPC_WAVE_RIFLEMAN || unit->GetEntry() == NPC_WAVE_PRIEST || unit->GetEntry() == NPC_WAVE_MAGE) + if ((--reqKillCount) == 0 && WaveNumber%5 && NextWaveTimer > 5000) + NextWaveTimer = 5000; + + if (unit->GetEntry() == NPC_QUEL_DELAR) + if (Creature* c = instance->GetCreature(NPC_UtherGUID)) + { + c->SetStandState(UNIT_STAND_STATE_STAND); + c->SetWalk(false); + c->GetMotionMaster()->MovePoint(0, 5313.92f, 1989.36f, 707.70f); + c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 9), c->m_Events.CalculateTime(7000)); + } + } - void RandomizeCompositionsAndShow() - { - uint8 r1 = urand(0,1), r2 = urand(2,3); - for (uint8 i=0; i<5; ++i) - { - chosenComposition[0][i] = allowedCompositions[r1][i]; - chosenComposition[1][i] = allowedCompositions[r1 == 0 ? 1 : 0][i]; - chosenComposition[2][i] = allowedCompositions[r2][i]; - chosenComposition[3][i] = allowedCompositions[r2 == 2 ? 3 : 2][i]; - } - bool left[4] = {true, true, true, true}; - for (uint8 k=4; k>0; --k) - { - uint8 r = urand(0, k-1); - uint8 ur = 0; - for (uint8 j=0; j<4; ++j) - if (left[j]) - { - if (ur == r) - { - left[j] = false; - for (uint8 i=0; i<5; ++i) - chosenComposition[8-k][i] = allowedCompositions[j+4][i]; - break; - } - ++ur; - } - } + void RandomizeCompositionsAndShow() + { + uint8 r1 = urand(0,1), r2 = urand(2,3); + for (uint8 i=0; i<5; ++i) + { + chosenComposition[0][i] = allowedCompositions[r1][i]; + chosenComposition[1][i] = allowedCompositions[r1 == 0 ? 1 : 0][i]; + chosenComposition[2][i] = allowedCompositions[r2][i]; + chosenComposition[3][i] = allowedCompositions[r2 == 2 ? 3 : 2][i]; + } + bool left[4] = {true, true, true, true}; + for (uint8 k=4; k>0; --k) + { + uint8 r = urand(0, k-1); + uint8 ur = 0; + for (uint8 j=0; j<4; ++j) + if (left[j]) + { + if (ur == r) + { + left[j] = false; + for (uint8 i=0; i<5; ++i) + chosenComposition[8-k][i] = allowedCompositions[j+4][i]; + break; + } + ++ur; + } + } - if (bFinished5Waves) - { - for (; WaveNumber < 4; ++WaveNumber) - { - uint8 num_to_activate; - if (WaveNumber <= 1) - num_to_activate = 3; - else - num_to_activate = 4; + if (bFinished5Waves) + { + for (; WaveNumber < 4; ++WaveNumber) + { + uint8 num_to_activate; + if (WaveNumber <= 1) + num_to_activate = 3; + else + num_to_activate = 4; - for (uint8 i=0; i=0); (forward ? ++j : --j)) - if (!TrashActive[j]) - if (Creature* c = instance->GetCreature(NPC_TrashGUID[j])) - if (c->GetEntry() == entry) - { - TrashActive[j] = true; - Unit::Kill(c, c); - break; - } - } - } - WaveNumber = 5; - } + for (uint8 i=0; i=0); (forward ? ++j : --j)) + if (!TrashActive[j]) + if (Creature* c = instance->GetCreature(NPC_TrashGUID[j])) + if (c->GetEntry() == entry) + { + TrashActive[j] = true; + Unit::Kill(c, c); + break; + } + } + } + WaveNumber = 5; + } - for (uint8 i=0; iGetCreature(NPC_TrashGUID[i])) - { - c->SetVisible(true); - c->CastSpell(c, SPELL_WELL_OF_SOULS_VISUAL, false); - } - } + for (uint8 i=0; iGetCreature(NPC_TrashGUID[i])) + { + c->SetVisible(true); + c->CastSpell(c, SPELL_WELL_OF_SOULS_VISUAL, false); + } + } - void AddWave1() - { - if (WaveNumber >= 10) - return; + void AddWave1() + { + if (WaveNumber >= 10) + return; - ++WaveNumber; - if (WaveNumber >= 6) - bFinished5Waves = true; + ++WaveNumber; + if (WaveNumber >= 6) + bFinished5Waves = true; - DoUpdateWorldState(WORLD_STATE_HOR_COUNTER, 1); - DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, WaveNumber); - HandleGameObject(GO_FrontDoorGUID, false); + DoUpdateWorldState(WORLD_STATE_HOR_COUNTER, 1); + DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, WaveNumber); + HandleGameObject(GO_FrontDoorGUID, false); - // some of them could go back to spawn due to vanish, etc. - // on activating next wave make those attack again - for (uint8 i=0; iGetCreature(NPC_TrashGUID[i])) - if (c->IsAlive() && !c->IsInCombat()) - c->AI()->DoAction(1); + // some of them could go back to spawn due to vanish, etc. + // on activating next wave make those attack again + for (uint8 i=0; iGetCreature(NPC_TrashGUID[i])) + if (c->IsAlive() && !c->IsInCombat()) + c->AI()->DoAction(1); - if (WaveNumber == 5 || WaveNumber == 10) - { - NextWaveTimer = 0; - if (WaveNumber == 5) - { - if (Creature* falric = instance->GetCreature(NPC_FalricGUID)) - { - if (falric->IsAlive()) - falric->AI()->DoAction(1); - else - NextWaveTimer = 1; - } - } - else - { - if (Creature* marwyn = instance->GetCreature(NPC_MarwynGUID)) - if (marwyn->IsAlive()) // should always be true, but just in case - marwyn->AI()->DoAction(1); - } - } - else - { - NextWaveTimer = 65000; + if (WaveNumber == 5 || WaveNumber == 10) + { + NextWaveTimer = 0; + if (WaveNumber == 5) + { + if (Creature* falric = instance->GetCreature(NPC_FalricGUID)) + { + if (falric->IsAlive()) + falric->AI()->DoAction(1); + else + NextWaveTimer = 1; + } + } + else + { + if (Creature* marwyn = instance->GetCreature(NPC_MarwynGUID)) + if (marwyn->IsAlive()) // should always be true, but just in case + marwyn->AI()->DoAction(1); + } + } + else + { + NextWaveTimer = 65000; - uint8 num_to_activate = 5; - if (WaveNumber <= 2) - num_to_activate = 3; - else if (WaveNumber <= 4) - num_to_activate = 4; + uint8 num_to_activate = 5; + if (WaveNumber <= 2) + num_to_activate = 3; + else if (WaveNumber <= 4) + num_to_activate = 4; - reqKillCount += num_to_activate; + reqKillCount += num_to_activate; - for (uint8 i=0; i 5 ? 2 : 1)][i]; - bool forward = urand(0,1) ? true : false; - for (int8 j = (forward ? 0 : NUM_OF_TRASH-1); (forward ? j=0); (forward ? ++j : --j)) - if (!TrashActive[j]) - if (Creature* c = instance->GetCreature(NPC_TrashGUID[j])) - if (c->GetEntry() == entry) - { - TrashActive[j] = true; - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); - c->AI()->DoAction(1); - break; - } - } - } - } + for (uint8 i=0; i 5 ? 2 : 1)][i]; + bool forward = urand(0,1) ? true : false; + for (int8 j = (forward ? 0 : NUM_OF_TRASH-1); (forward ? j=0); (forward ? ++j : --j)) + if (!TrashActive[j]) + if (Creature* c = instance->GetCreature(NPC_TrashGUID[j])) + if (c->GetEntry() == entry) + { + TrashActive[j] = true; + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + c->AI()->DoAction(1); + break; + } + } + } + } - void DoWipe1() - { - if (!WaveNumber) - return; + void DoWipe1() + { + if (!WaveNumber) + return; - DoUpdateWorldState(WORLD_STATE_HOR_COUNTER, 0); - DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, 0); - HandleGameObject(GO_FrontDoorGUID, true); + DoUpdateWorldState(WORLD_STATE_HOR_COUNTER, 0); + DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, 0); + HandleGameObject(GO_FrontDoorGUID, true); - TrashCounter = NUM_OF_TRASH; - WaveNumber = 0; - NextWaveTimer = 0; - memset(&chosenComposition, 0, sizeof(chosenComposition)); + TrashCounter = NUM_OF_TRASH; + WaveNumber = 0; + NextWaveTimer = 0; + memset(&chosenComposition, 0, sizeof(chosenComposition)); - for (uint8 i=0; iGetCreature(NPC_TrashGUID[i])) - { - c->DeleteThreatList(); - c->CombatStop(true); - c->InterruptNonMeleeSpells(true); - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); - c->Respawn(true); - c->UpdatePosition(c->GetHomePosition(), true); - c->StopMovingOnCurrentPos(); - } - memset(&TrashActive, 0, sizeof(TrashActive)); + for (uint8 i=0; iGetCreature(NPC_TrashGUID[i])) + { + c->DeleteThreatList(); + c->CombatStop(true); + c->InterruptNonMeleeSpells(true); + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + c->Respawn(true); + c->UpdatePosition(c->GetHomePosition(), true); + c->StopMovingOnCurrentPos(); + } + memset(&TrashActive, 0, sizeof(TrashActive)); - if (Creature* falric = instance->GetCreature(NPC_FalricGUID)) - falric->AI()->EnterEvadeMode(); - if (Creature* marwyn = instance->GetCreature(NPC_MarwynGUID)) - marwyn->AI()->EnterEvadeMode(); + if (Creature* falric = instance->GetCreature(NPC_FalricGUID)) + falric->AI()->EnterEvadeMode(); + if (Creature* marwyn = instance->GetCreature(NPC_MarwynGUID)) + marwyn->AI()->EnterEvadeMode(); - ResumeFirstEventTimer = 5000; - ResumeFirstEventStep = 2; - reqKillCount = 0; - } + ResumeFirstEventTimer = 5000; + ResumeFirstEventStep = 2; + reqKillCount = 0; + } - void Update(uint32 diff) - { - if (!instance->HavePlayers()) - return; + void Update(uint32 diff) + { + if (!instance->HavePlayers()) + return; - if (CheckPlayersTimer <= diff) - { - CheckPlayersTimer = 5000; - if ((EncounterMask & (1 << DATA_INTRO)) && !(EncounterMask & (1 << DATA_MARWYN))) // first event - { - Map::PlayerList const& pl = instance->GetPlayers(); - if (WaveNumber || NextWaveTimer) - { - bool allDead = true; - bool outOfRange = false; - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - { - if (p->IsGameMaster()) - continue; - if (p->IsAlive()) - allDead = false; - if (p->GetExactDist2d(&CenterPos) > MAX_DIST_FROM_CENTER_IN_COMBAT) - { - outOfRange = true; - break; - } - } - if (allDead || outOfRange) - DoWipe1(); - } - else if (!ResumeFirstEventTimer) - { - bool allInRangeAndAlive = (instance->GetPlayersCountExceptGMs() > 0 ? true : false); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (!p->IsGameMaster() && (p->GetExactDist2d(&CenterPos) > MAX_DIST_FROM_CENTER_TO_START || !p->IsAlive())) - { - allInRangeAndAlive = false; - break; - } - if (allInRangeAndAlive) - { - ResumeFirstEventTimer = 1; - ResumeFirstEventStep = 0; - } - } - } - } - else - CheckPlayersTimer -= diff; + if (CheckPlayersTimer <= diff) + { + CheckPlayersTimer = 5000; + if ((EncounterMask & (1 << DATA_INTRO)) && !(EncounterMask & (1 << DATA_MARWYN))) // first event + { + Map::PlayerList const& pl = instance->GetPlayers(); + if (WaveNumber || NextWaveTimer) + { + bool allDead = true; + bool outOfRange = false; + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + { + if (p->IsGameMaster()) + continue; + if (p->IsAlive()) + allDead = false; + if (p->GetExactDist2d(&CenterPos) > MAX_DIST_FROM_CENTER_IN_COMBAT) + { + outOfRange = true; + break; + } + } + if (allDead || outOfRange) + DoWipe1(); + } + else if (!ResumeFirstEventTimer) + { + bool allInRangeAndAlive = (instance->GetPlayersCountExceptGMs() > 0 ? true : false); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (!p->IsGameMaster() && (p->GetExactDist2d(&CenterPos) > MAX_DIST_FROM_CENTER_TO_START || !p->IsAlive())) + { + allInRangeAndAlive = false; + break; + } + if (allInRangeAndAlive) + { + ResumeFirstEventTimer = 1; + ResumeFirstEventStep = 0; + } + } + } + } + else + CheckPlayersTimer -= diff; - if (NextWaveTimer) - { - if (NextWaveTimer <= diff) - { - NextWaveTimer = 0; - AddWave1(); - } - else - NextWaveTimer -= diff; - } + if (NextWaveTimer) + { + if (NextWaveTimer <= diff) + { + NextWaveTimer = 0; + AddWave1(); + } + else + NextWaveTimer -= diff; + } - if (ResumeFirstEventTimer) - { - if (ResumeFirstEventTimer <= diff) - { - switch (ResumeFirstEventStep) - { - case 0: - if (Creature* pFalric = instance->GetCreature(NPC_FalricGUID)) - { - pFalric->UpdatePosition(5274.9f, 2039.2f, 709.319f, 5.4619f, true); - pFalric->StopMovingOnCurrentPos(); - pFalric->SetVisible(true); - if (pFalric->IsAlive()) - { - pFalric->GetMotionMaster()->MovePoint(0, FalricMovePos); - if (Aura* a = pFalric->AddAura(SPELL_SHADOWMOURNE_VISUAL, pFalric)) - a->SetDuration(8000); - } - } - if (Creature* pMarwyn = instance->GetCreature(NPC_MarwynGUID)) - { - pMarwyn->UpdatePosition(5343.77f, 1973.86f, 709.319f, 2.35173f, true); - pMarwyn->StopMovingOnCurrentPos(); - pMarwyn->SetVisible(true); - if (pMarwyn->IsAlive()) - { - pMarwyn->GetMotionMaster()->MovePoint(0, MarwynMovePos); - if (Aura* a = pMarwyn->AddAura(SPELL_SHADOWMOURNE_VISUAL, pMarwyn)) - a->SetDuration(8000); - } + if (ResumeFirstEventTimer) + { + if (ResumeFirstEventTimer <= diff) + { + switch (ResumeFirstEventStep) + { + case 0: + if (Creature* pFalric = instance->GetCreature(NPC_FalricGUID)) + { + pFalric->UpdatePosition(5274.9f, 2039.2f, 709.319f, 5.4619f, true); + pFalric->StopMovingOnCurrentPos(); + pFalric->SetVisible(true); + if (pFalric->IsAlive()) + { + pFalric->GetMotionMaster()->MovePoint(0, FalricMovePos); + if (Aura* a = pFalric->AddAura(SPELL_SHADOWMOURNE_VISUAL, pFalric)) + a->SetDuration(8000); + } + } + if (Creature* pMarwyn = instance->GetCreature(NPC_MarwynGUID)) + { + pMarwyn->UpdatePosition(5343.77f, 1973.86f, 709.319f, 2.35173f, true); + pMarwyn->StopMovingOnCurrentPos(); + pMarwyn->SetVisible(true); + if (pMarwyn->IsAlive()) + { + pMarwyn->GetMotionMaster()->MovePoint(0, MarwynMovePos); + if (Aura* a = pMarwyn->AddAura(SPELL_SHADOWMOURNE_VISUAL, pMarwyn)) + a->SetDuration(8000); + } - pMarwyn->MonsterTextEmote("Spirits appear and surround the altar!", 0, true); - } - ++ResumeFirstEventStep; - ResumeFirstEventTimer = 7500; - break; - case 1: - if (Creature* pFalric = instance->GetCreature(NPC_FalricGUID)) - pFalric->AI()->Talk(SAY_FALRIC_INTRO_2); - SetData(ACTION_SHOW_TRASH, 1); - ResumeFirstEventStep = 0; - ResumeFirstEventTimer = 0; - NextWaveTimer = 7000; - break; - default: - for (uint8 i=0; iGetCreature(NPC_TrashGUID[i])) - c->SetVisible(false); - if (Creature* falric = instance->GetCreature(NPC_FalricGUID)) - falric->SetVisible(false); - if (Creature* marwyn = instance->GetCreature(NPC_MarwynGUID)) - marwyn->SetVisible(false); - ResumeFirstEventStep = 0; - ResumeFirstEventTimer = 0; - break; - } - } - else - ResumeFirstEventTimer -= diff; - } + pMarwyn->MonsterTextEmote("Spirits appear and surround the altar!", 0, true); + } + ++ResumeFirstEventStep; + ResumeFirstEventTimer = 7500; + break; + case 1: + if (Creature* pFalric = instance->GetCreature(NPC_FalricGUID)) + pFalric->AI()->Talk(SAY_FALRIC_INTRO_2); + SetData(ACTION_SHOW_TRASH, 1); + ResumeFirstEventStep = 0; + ResumeFirstEventTimer = 0; + NextWaveTimer = 7000; + break; + default: + for (uint8 i=0; iGetCreature(NPC_TrashGUID[i])) + c->SetVisible(false); + if (Creature* falric = instance->GetCreature(NPC_FalricGUID)) + falric->SetVisible(false); + if (Creature* marwyn = instance->GetCreature(NPC_MarwynGUID)) + marwyn->SetVisible(false); + ResumeFirstEventStep = 0; + ResumeFirstEventTimer = 0; + break; + } + } + else + ResumeFirstEventTimer -= diff; + } - if (outroStep) - { - if (outroTimer <= diff) - { - switch (outroStep) - { - case 1: - if (Creature* lk = instance->GetCreature(NPC_LichKingGUID)) - { - lk->UpdatePosition(PathWaypoints[PATH_WP_COUNT-2], true); - lk->StopMovingOnCurrentPos(); - lk->RemoveAllAuras(); - lk->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CUSTOM_SPELL_02); - if (!lk->IsVisible()) - lk->SetVisible(true); - if (Creature* leader = instance->GetCreature(NPC_LeaderGUID)) - { - leader->UpdatePosition(PathWaypoints[PATH_WP_COUNT-1], true); - leader->StopMovingOnCurrentPos(); - leader->RemoveAllAuras(); - leader->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_READY1H); - if (!leader->IsVisible()) - leader->SetVisible(true); - lk->CastSpell(leader, SPELL_HARVEST_SOUL, false); - } - } - ++outroStep; - outroTimer = 500; - break; - case 2: - { - uint32 entry = TeamIdInInstance == TEAM_ALLIANCE ? GO_THE_SKYBREAKER : GO_ORGRIMS_HAMMER; - T1 = sTransportMgr->CreateTransport(entry, 0, instance); + if (outroStep) + { + if (outroTimer <= diff) + { + switch (outroStep) + { + case 1: + if (Creature* lk = instance->GetCreature(NPC_LichKingGUID)) + { + lk->UpdatePosition(PathWaypoints[PATH_WP_COUNT-2], true); + lk->StopMovingOnCurrentPos(); + lk->RemoveAllAuras(); + lk->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CUSTOM_SPELL_02); + if (!lk->IsVisible()) + lk->SetVisible(true); + if (Creature* leader = instance->GetCreature(NPC_LeaderGUID)) + { + leader->UpdatePosition(PathWaypoints[PATH_WP_COUNT-1], true); + leader->StopMovingOnCurrentPos(); + leader->RemoveAllAuras(); + leader->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_READY1H); + if (!leader->IsVisible()) + leader->SetVisible(true); + lk->CastSpell(leader, SPELL_HARVEST_SOUL, false); + } + } + ++outroStep; + outroTimer = 500; + break; + case 2: + { + uint32 entry = TeamIdInInstance == TEAM_ALLIANCE ? GO_THE_SKYBREAKER : GO_ORGRIMS_HAMMER; + T1 = sTransportMgr->CreateTransport(entry, 0, instance); - ++outroStep; - outroTimer = TeamIdInInstance == TEAM_ALLIANCE ? 10000 : 10500; - } - break; - case 3: - if (T1) - T1->EnableMovement(false); - if (Creature* c = instance->GetCreature(NPC_ShipCaptainGUID)) - c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_FIRE_ALLY : SAY_FIRE_HORDE); - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - { - c->RemoveAllAuras(); - c->CastSpell(c, SPELL_GUNSHIP_CANNON_FIRE_PERIODIC, true); - } - if (Creature* c = instance->GetCreature(NPC_LichKingGUID)) - { - c->InterruptNonMeleeSpells(true); - c->RemoveAllAuras(); - } - ++outroStep; - outroTimer = 5000; - break; - case 4: - HandleGameObject(GO_CaveInGUID, false); - ++outroStep; - outroTimer = 3000; - break; - case 5: - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - if (Creature* c = instance->GetCreature(NPC_LichKingGUID)) - { - c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - c->DeleteThreatList(); - c->CombatStop(true); - c->InterruptNonMeleeSpells(true); - c->SetVisible(false); - } - if (instance->IsHeroic()) - instance->ToInstanceMap()->PermBindAllPlayers(); - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - c->CastSpell(c, SPELL_ACHIEVEMENT_CHECK, true); - ++outroStep; - outroTimer = 1000; - break; - case 6: - if (T1) - T1->EnableMovement(true); - ++outroStep; - outroTimer = 3500; - break; - case 7: - if (T1) - T1->EnableMovement(false); - if (Creature* leader = instance->GetCreature(NPC_LeaderGUID)) - { - uint8 index = TeamIdInInstance == TEAM_ALLIANCE ? 0 : 1; - for (uint8 i=0; i<3; ++i) - if (StairsPos[index][i].GetPositionX()) - if (GameObject* go = leader->SummonGameObject(TeamIdInInstance == TEAM_ALLIANCE ? GO_STAIRS_ALLIANCE : GO_STAIRS_HORDE, StairsPos[index][i].GetPositionX(), StairsPos[index][i].GetPositionY(), StairsPos[index][i].GetPositionZ(), StairsPos[index][i].GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 86400, false)) - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); + ++outroStep; + outroTimer = TeamIdInInstance == TEAM_ALLIANCE ? 10000 : 10500; + } + break; + case 3: + if (T1) + T1->EnableMovement(false); + if (Creature* c = instance->GetCreature(NPC_ShipCaptainGUID)) + c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_FIRE_ALLY : SAY_FIRE_HORDE); + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + { + c->RemoveAllAuras(); + c->CastSpell(c, SPELL_GUNSHIP_CANNON_FIRE_PERIODIC, true); + } + if (Creature* c = instance->GetCreature(NPC_LichKingGUID)) + { + c->InterruptNonMeleeSpells(true); + c->RemoveAllAuras(); + } + ++outroStep; + outroTimer = 5000; + break; + case 4: + HandleGameObject(GO_CaveInGUID, false); + ++outroStep; + outroTimer = 3000; + break; + case 5: + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + if (Creature* c = instance->GetCreature(NPC_LichKingGUID)) + { + c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + c->DeleteThreatList(); + c->CombatStop(true); + c->InterruptNonMeleeSpells(true); + c->SetVisible(false); + } + if (instance->IsHeroic()) + instance->ToInstanceMap()->PermBindAllPlayers(); + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + c->CastSpell(c, SPELL_ACHIEVEMENT_CHECK, true); + ++outroStep; + outroTimer = 1000; + break; + case 6: + if (T1) + T1->EnableMovement(true); + ++outroStep; + outroTimer = 3500; + break; + case 7: + if (T1) + T1->EnableMovement(false); + if (Creature* leader = instance->GetCreature(NPC_LeaderGUID)) + { + uint8 index = TeamIdInInstance == TEAM_ALLIANCE ? 0 : 1; + for (uint8 i=0; i<3; ++i) + if (StairsPos[index][i].GetPositionX()) + if (GameObject* go = leader->SummonGameObject(TeamIdInInstance == TEAM_ALLIANCE ? GO_STAIRS_ALLIANCE : GO_STAIRS_HORDE, StairsPos[index][i].GetPositionX(), StairsPos[index][i].GetPositionY(), StairsPos[index][i].GetPositionZ(), StairsPos[index][i].GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 86400, false)) + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); - //Position pos = TeamIdInInstance == TEAM_ALLIANCE ? AllyPortalPos : HordePortalPos; - //leader->SummonGameObject(GO_PORTAL_TO_DALARAN, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 86400); - //pos = TeamIdInInstance == TEAM_ALLIANCE ? AllyChestPos : HordeChestPos; - //leader->SummonGameObject(instance->GetSpawnMode() ? GO_CHEST_HEROIC : GO_CHEST_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 86400); - } - ++outroStep; - outroTimer = 1000; - break; - case 8: - if (Creature* c = instance->GetCreature(NPC_ShipCaptainGUID)) - c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_ONBOARD_ALLY : SAY_ONBOARD_HORDE); - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - { - c->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - c->GetMotionMaster()->MovePoint(0, WalkCaveInPos); - } - ++outroStep; - outroTimer = 6000; - break; - case 9: - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_FINAL_ALLY : SAY_FINAL_HORDE); - HandleGameObject(GO_CaveInGUID, true); - ++outroStep; - outroTimer = 11000; - break; - case 10: - ++outroStep; - outroTimer = 0; - for (Map::PlayerList::const_iterator itr = instance->GetPlayers().begin(); itr != instance->GetPlayers().end(); ++itr) - if (Player* p = itr->GetSource()) - p->KilledMonsterCredit(NPC_WRATH_OF_THE_LICH_KING_CREDIT, 0); - if (TeamIdInInstance == TEAM_ALLIANCE) - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - { - c->AI()->Talk(SAY_FINAL_ALLY_SECOND); - outroTimer = 10000; - } - break; - case 11: - if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - ++outroStep; - outroTimer = 300*1000; - break; - case 12: - outroStep = 0; - outroTimer = 0; - if (T1) - T1->setActive(false); - break; - } - } - else - outroTimer -= diff; - } - } - }; + //Position pos = TeamIdInInstance == TEAM_ALLIANCE ? AllyPortalPos : HordePortalPos; + //leader->SummonGameObject(GO_PORTAL_TO_DALARAN, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 86400); + //pos = TeamIdInInstance == TEAM_ALLIANCE ? AllyChestPos : HordeChestPos; + //leader->SummonGameObject(instance->GetSpawnMode() ? GO_CHEST_HEROIC : GO_CHEST_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 86400); + } + ++outroStep; + outroTimer = 1000; + break; + case 8: + if (Creature* c = instance->GetCreature(NPC_ShipCaptainGUID)) + c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_ONBOARD_ALLY : SAY_ONBOARD_HORDE); + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + { + c->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + c->GetMotionMaster()->MovePoint(0, WalkCaveInPos); + } + ++outroStep; + outroTimer = 6000; + break; + case 9: + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + c->AI()->Talk(TeamIdInInstance == TEAM_ALLIANCE ? SAY_FINAL_ALLY : SAY_FINAL_HORDE); + HandleGameObject(GO_CaveInGUID, true); + ++outroStep; + outroTimer = 11000; + break; + case 10: + ++outroStep; + outroTimer = 0; + for (Map::PlayerList::const_iterator itr = instance->GetPlayers().begin(); itr != instance->GetPlayers().end(); ++itr) + if (Player* p = itr->GetSource()) + p->KilledMonsterCredit(NPC_WRATH_OF_THE_LICH_KING_CREDIT, 0); + if (TeamIdInInstance == TEAM_ALLIANCE) + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + { + c->AI()->Talk(SAY_FINAL_ALLY_SECOND); + outroTimer = 10000; + } + break; + case 11: + if (Creature* c = instance->GetCreature(NPC_LeaderGUID)) + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + ++outroStep; + outroTimer = 300*1000; + break; + case 12: + outroStep = 0; + outroTimer = 0; + if (T1) + T1->setActive(false); + break; + } + } + else + outroTimer -= diff; + } + } + }; }; void AddSC_instance_halls_of_reflection() { - new instance_halls_of_reflection(); + new instance_halls_of_reflection(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index f42a6ff18..96a201c67 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -14,23 +14,23 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Yells { - SAY_AGGRO = 14, - SAY_SLAY_1 = 15, - SAY_DEATH = 17, - SAY_FORGE_1 = 18, - SAY_FORGE_2 = 19, + SAY_AGGRO = 14, + SAY_SLAY_1 = 15, + SAY_DEATH = 17, + SAY_FORGE_1 = 18, + SAY_FORGE_2 = 19, - SAY_BOULDER_HIT = 16, - EMOTE_DEEP_FREEZE = 23, + SAY_BOULDER_HIT = 16, + EMOTE_DEEP_FREEZE = 23, }; -#define EMOTE_THROW_SARONITE "%s hurls a massive saronite boulder at you!" +#define EMOTE_THROW_SARONITE "%s hurls a massive saronite boulder at you!" enum MiscData { - EQUIP_ID_SWORD = 49345, - EQUIP_ID_MACE = 49344, - GO_SARONITE_ROCK = 196485, + EQUIP_ID_SWORD = 49345, + EQUIP_ID_MACE = 49344, + GO_SARONITE_ROCK = 196485, }; Position const northForgePos = {722.5643f, -234.1615f, 527.182f, 2.16421f}; @@ -38,336 +38,336 @@ Position const southForgePos = {639.257f, -210.1198f, 529.015f, 0.523599f}; enum Spells { - SPELL_PERMAFROST = 70326, - SPELL_THROW_SARONITE = 68788, - SPELL_THUNDERING_STOMP = 68771, + SPELL_PERMAFROST = 70326, + SPELL_THROW_SARONITE = 68788, + SPELL_THUNDERING_STOMP = 68771, - SPELL_CHILLING_WAVE = 68778, - SPELL_DEEP_FREEZE = 70381, + SPELL_CHILLING_WAVE = 68778, + SPELL_DEEP_FREEZE = 70381, }; -#define SPELL_FORGE_BLADE RAID_MODE(68774, 70334) -#define SPELL_FORGE_MACE RAID_MODE(68785, 70335) -#define SPELL_SARONITE_TRIGGERED RAID_MODE(68789, 70851) +#define SPELL_FORGE_BLADE RAID_MODE(68774, 70334) +#define SPELL_FORGE_MACE RAID_MODE(68785, 70335) +#define SPELL_SARONITE_TRIGGERED RAID_MODE(68789, 70851) enum Events { - EVENT_SPELL_THROW_SARONITE = 1, - EVENT_JUMP, - EVENT_SPELL_CHILLING_WAVE, - EVENT_SPELL_DEEP_FREEZE, + EVENT_SPELL_THROW_SARONITE = 1, + EVENT_JUMP, + EVENT_SPELL_CHILLING_WAVE, + EVENT_SPELL_DEEP_FREEZE, }; class boss_garfrost : public CreatureScript { public: - boss_garfrost() : CreatureScript("boss_garfrost") { } + boss_garfrost() : CreatureScript("boss_garfrost") { } - struct boss_garfrostAI : public ScriptedAI - { - boss_garfrostAI(Creature* creature) : ScriptedAI(creature) - { - pInstance = creature->GetInstanceScript(); - } + struct boss_garfrostAI : public ScriptedAI + { + boss_garfrostAI(Creature* creature) : ScriptedAI(creature) + { + pInstance = creature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - uint8 phase; - bool bCanSayBoulderHit; + InstanceScript* pInstance; + EventMap events; + uint8 phase; + bool bCanSayBoulderHit; - void Reset() - { - me->RemoveAura(SPELL_PERMAFROST); - SetEquipmentSlots(true); - me->SetReactState(REACT_AGGRESSIVE); - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - phase = 0; - bCanSayBoulderHit = true; + void Reset() + { + me->RemoveAura(SPELL_PERMAFROST); + SetEquipmentSlots(true); + me->SetReactState(REACT_AGGRESSIVE); + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + phase = 0; + bCanSayBoulderHit = true; - events.Reset(); - if (pInstance) - pInstance->SetData(DATA_GARFROST, NOT_STARTED); - } + events.Reset(); + if (pInstance) + pInstance->SetData(DATA_GARFROST, NOT_STARTED); + } - void SetData(uint32 id, uint32 data) - { - if (id == 1 && pInstance) - pInstance->SetData(DATA_ACHIEV_ELEVEN, 0); - } + void SetData(uint32 id, uint32 data) + { + if (id == 1 && pInstance) + pInstance->SetData(DATA_ACHIEV_ELEVEN, 0); + } - void EnterCombat(Unit* /*who*/) - { - me->CastSpell(me, SPELL_PERMAFROST, true); + void EnterCombat(Unit* /*who*/) + { + me->CastSpell(me, SPELL_PERMAFROST, true); - Talk(SAY_AGGRO); - DoZoneInCombat(); - events.RescheduleEvent(EVENT_SPELL_THROW_SARONITE, urand(5000,7500)); + Talk(SAY_AGGRO); + DoZoneInCombat(); + events.RescheduleEvent(EVENT_SPELL_THROW_SARONITE, urand(5000,7500)); - if (pInstance) - pInstance->SetData(DATA_GARFROST, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(DATA_GARFROST, IN_PROGRESS); + } - void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) - { - if (phase == 0 && !HealthAbovePct(66) && !me->HasUnitState(UNIT_STATE_ROOT)) - { - phase = 1; - me->SetReactState(REACT_PASSIVE); - me->SetTarget(0); - me->SendMeleeAttackStop(me->GetVictim()); - events.DelayEvents(8000); - me->CastSpell(me, SPELL_THUNDERING_STOMP, false); - events.RescheduleEvent(EVENT_JUMP, 1250); - return; - } + void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) + { + if (phase == 0 && !HealthAbovePct(66) && !me->HasUnitState(UNIT_STATE_ROOT)) + { + phase = 1; + me->SetReactState(REACT_PASSIVE); + me->SetTarget(0); + me->SendMeleeAttackStop(me->GetVictim()); + events.DelayEvents(8000); + me->CastSpell(me, SPELL_THUNDERING_STOMP, false); + events.RescheduleEvent(EVENT_JUMP, 1250); + return; + } - if (phase == 1 && !HealthAbovePct(33) && !me->HasUnitState(UNIT_STATE_ROOT)) - { - events.CancelEvent(EVENT_SPELL_CHILLING_WAVE); - phase = 2; - me->SetReactState(REACT_PASSIVE); - me->SetTarget(0); - me->SendMeleeAttackStop(me->GetVictim()); - events.DelayEvents(8000); - me->CastSpell(me, SPELL_THUNDERING_STOMP, false); - events.RescheduleEvent(EVENT_JUMP, 1250); - return; - } - } + if (phase == 1 && !HealthAbovePct(33) && !me->HasUnitState(UNIT_STATE_ROOT)) + { + events.CancelEvent(EVENT_SPELL_CHILLING_WAVE); + phase = 2; + me->SetReactState(REACT_PASSIVE); + me->SetTarget(0); + me->SendMeleeAttackStop(me->GetVictim()); + events.DelayEvents(8000); + me->CastSpell(me, SPELL_THUNDERING_STOMP, false); + events.RescheduleEvent(EVENT_JUMP, 1250); + return; + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type != EFFECT_MOTION_TYPE || id != 0) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != EFFECT_MOTION_TYPE || id != 0) + return; - if (phase == 1) - { - me->SetControlled(true, UNIT_STATE_ROOT); - me->CastSpell(me, SPELL_FORGE_BLADE, false); - Talk(SAY_FORGE_1); - } - else if (phase == 2) - { - me->SetControlled(true, UNIT_STATE_ROOT); - me->RemoveAurasDueToSpell(SPELL_FORGE_BLADE); - me->CastSpell(me, SPELL_FORGE_MACE, false); - Talk(SAY_FORGE_2); - } - } + if (phase == 1) + { + me->SetControlled(true, UNIT_STATE_ROOT); + me->CastSpell(me, SPELL_FORGE_BLADE, false); + Talk(SAY_FORGE_1); + } + else if (phase == 2) + { + me->SetControlled(true, UNIT_STATE_ROOT); + me->RemoveAurasDueToSpell(SPELL_FORGE_BLADE); + me->CastSpell(me, SPELL_FORGE_MACE, false); + Talk(SAY_FORGE_2); + } + } void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (spell->Id == SPELL_SARONITE_TRIGGERED) - { - if (bCanSayBoulderHit) - { - bCanSayBoulderHit = false; - Talk(SAY_BOULDER_HIT); - } - } - if (spell->Id == SPELL_FORGE_BLADE) - { - events.RescheduleEvent(EVENT_SPELL_CHILLING_WAVE, 10000); - SetEquipmentSlots(false, EQUIP_ID_SWORD); - me->SetReactState(REACT_AGGRESSIVE); - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - if (me->GetVictim()) - { - AttackStart(me->GetVictim()); - me->SetTarget(me->GetVictim()->GetGUID()); - } - } - else if (spell->Id == SPELL_FORGE_MACE) - { - events.RescheduleEvent(EVENT_SPELL_DEEP_FREEZE, 10000); - SetEquipmentSlots(false, EQUIP_ID_MACE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - if (me->GetVictim()) - { - AttackStart(me->GetVictim()); - me->SetTarget(me->GetVictim()->GetGUID()); - } - } - } + { + if (spell->Id == SPELL_SARONITE_TRIGGERED) + { + if (bCanSayBoulderHit) + { + bCanSayBoulderHit = false; + Talk(SAY_BOULDER_HIT); + } + } + if (spell->Id == SPELL_FORGE_BLADE) + { + events.RescheduleEvent(EVENT_SPELL_CHILLING_WAVE, 10000); + SetEquipmentSlots(false, EQUIP_ID_SWORD); + me->SetReactState(REACT_AGGRESSIVE); + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + if (me->GetVictim()) + { + AttackStart(me->GetVictim()); + me->SetTarget(me->GetVictim()->GetGUID()); + } + } + else if (spell->Id == SPELL_FORGE_MACE) + { + events.RescheduleEvent(EVENT_SPELL_DEEP_FREEZE, 10000); + SetEquipmentSlots(false, EQUIP_ID_MACE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + if (me->GetVictim()) + { + AttackStart(me->GetVictim()); + me->SetTarget(me->GetVictim()->GetGUID()); + } + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if (me->GetVictim()) - { - float x,y,z; - me->GetVictim()->GetPosition(x, y, z); - if (x<600.0f || x>770.0f || y<-270.0f || y>-137.0f || z<514.0f || z>550.0f) - { - me->SetHealth(me->GetMaxHealth()); - EnterEvadeMode(); - if (CreatureGroup* f = me->GetFormation()) - { - const CreatureGroup::CreatureGroupMemberType& m = f->GetMembers(); - for (CreatureGroup::CreatureGroupMemberType::const_iterator itr = m.begin(); itr != m.end(); ++itr) - if (itr->first->IsAlive() && itr->first->IsInCombat() && !itr->first->IsInEvadeMode() && itr->first->IsAIEnabled) - itr->first->AI()->EnterEvadeMode(); - } - return; - } - } + if (me->GetVictim()) + { + float x,y,z; + me->GetVictim()->GetPosition(x, y, z); + if (x<600.0f || x>770.0f || y<-270.0f || y>-137.0f || z<514.0f || z>550.0f) + { + me->SetHealth(me->GetMaxHealth()); + EnterEvadeMode(); + if (CreatureGroup* f = me->GetFormation()) + { + const CreatureGroup::CreatureGroupMemberType& m = f->GetMembers(); + for (CreatureGroup::CreatureGroupMemberType::const_iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->first->IsAlive() && itr->first->IsInCombat() && !itr->first->IsInEvadeMode() && itr->first->IsAIEnabled) + itr->first->AI()->EnterEvadeMode(); + } + return; + } + } - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_THROW_SARONITE: - bCanSayBoulderHit = true; - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 140.0f, true)) - { - WorldPacket data; - ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, me, NULL, EMOTE_THROW_SARONITE); - target->ToPlayer()->GetSession()->SendPacket(&data); - me->CastSpell(target, SPELL_THROW_SARONITE, false); - } - events.RepeatEvent(urand(12500,20000)); - break; - case EVENT_JUMP: - me->DisableRotate(true); - if (phase == 1) - me->GetMotionMaster()->MoveJump(northForgePos.GetPositionX(), northForgePos.GetPositionY(), northForgePos.GetPositionZ(), 25.0f, 15.0f, 0); - else if (phase == 2) - me->GetMotionMaster()->MoveJump(southForgePos.GetPositionX(), southForgePos.GetPositionY(), southForgePos.GetPositionZ(), 25.0f, 15.0f, 0); - events.PopEvent(); - break; - case EVENT_SPELL_CHILLING_WAVE: - me->CastSpell(me->GetVictim(), SPELL_CHILLING_WAVE, false); - events.RepeatEvent(35000); - break; - case EVENT_SPELL_DEEP_FREEZE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) - { - Talk(EMOTE_DEEP_FREEZE, target); - me->CastSpell(target, SPELL_DEEP_FREEZE, false); - } - events.RepeatEvent(35000); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_THROW_SARONITE: + bCanSayBoulderHit = true; + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 140.0f, true)) + { + WorldPacket data; + ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, me, NULL, EMOTE_THROW_SARONITE); + target->ToPlayer()->GetSession()->SendPacket(&data); + me->CastSpell(target, SPELL_THROW_SARONITE, false); + } + events.RepeatEvent(urand(12500,20000)); + break; + case EVENT_JUMP: + me->DisableRotate(true); + if (phase == 1) + me->GetMotionMaster()->MoveJump(northForgePos.GetPositionX(), northForgePos.GetPositionY(), northForgePos.GetPositionZ(), 25.0f, 15.0f, 0); + else if (phase == 2) + me->GetMotionMaster()->MoveJump(southForgePos.GetPositionX(), southForgePos.GetPositionY(), southForgePos.GetPositionZ(), 25.0f, 15.0f, 0); + events.PopEvent(); + break; + case EVENT_SPELL_CHILLING_WAVE: + me->CastSpell(me->GetVictim(), SPELL_CHILLING_WAVE, false); + events.RepeatEvent(35000); + break; + case EVENT_SPELL_DEEP_FREEZE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + { + Talk(EMOTE_DEEP_FREEZE, target); + me->CastSpell(target, SPELL_DEEP_FREEZE, false); + } + events.RepeatEvent(35000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_GARFROST, DONE); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(DATA_GARFROST, DONE); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY_1); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY_1); + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - ScriptedAI::EnterEvadeMode(); - } - }; + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + ScriptedAI::EnterEvadeMode(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_garfrostAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_garfrostAI(creature); + } }; class spell_garfrost_permafrost : public SpellScriptLoader { public: - spell_garfrost_permafrost() : SpellScriptLoader("spell_garfrost_permafrost") { } + spell_garfrost_permafrost() : SpellScriptLoader("spell_garfrost_permafrost") { } - class spell_garfrost_permafrost_SpellScript : public SpellScript - { - PrepareSpellScript(spell_garfrost_permafrost_SpellScript); + class spell_garfrost_permafrost_SpellScript : public SpellScript + { + PrepareSpellScript(spell_garfrost_permafrost_SpellScript); - std::list targetList; + std::list targetList; - void Unload() - { - targetList.clear(); - } + void Unload() + { + targetList.clear(); + } - void FilterTargets(std::list& targets) - { - if (Unit* caster = GetCaster()) - { - std::list blockList; - caster->GetGameObjectListWithEntryInGrid(blockList, GO_SARONITE_ROCK, 100.0f); + void FilterTargets(std::list& targets) + { + if (Unit* caster = GetCaster()) + { + std::list blockList; + caster->GetGameObjectListWithEntryInGrid(blockList, GO_SARONITE_ROCK, 100.0f); - if (!blockList.empty()) - { - for (std::list::iterator itrU = targets.begin(); itrU != targets.end(); ++itrU) - if (WorldObject* target = (*itrU)) - { - bool valid = true; - if (!caster->IsWithinMeleeRange(target->ToUnit())) - for (std::list::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr) - if (!(*itr)->IsInvisibleDueToDespawn()) - if ((*itr)->IsInBetween(caster, target, 4.0f)) - { - valid = false; - break; - } - if (valid) - { - if (Aura* aur = target->ToUnit()->GetAura(70336)) - if (aur->GetStackAmount() >= 10 && caster->GetTypeId() == TYPEID_UNIT) - caster->ToCreature()->AI()->SetData(1, aur->GetStackAmount()); - targetList.push_back(*itrU); - } - } - } - else - { - targetList = targets; - return; - } - } + if (!blockList.empty()) + { + for (std::list::iterator itrU = targets.begin(); itrU != targets.end(); ++itrU) + if (WorldObject* target = (*itrU)) + { + bool valid = true; + if (!caster->IsWithinMeleeRange(target->ToUnit())) + for (std::list::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr) + if (!(*itr)->IsInvisibleDueToDespawn()) + if ((*itr)->IsInBetween(caster, target, 4.0f)) + { + valid = false; + break; + } + if (valid) + { + if (Aura* aur = target->ToUnit()->GetAura(70336)) + if (aur->GetStackAmount() >= 10 && caster->GetTypeId() == TYPEID_UNIT) + caster->ToCreature()->AI()->SetData(1, aur->GetStackAmount()); + targetList.push_back(*itrU); + } + } + } + else + { + targetList = targets; + return; + } + } - targets = targetList; - } + targets = targetList; + } - void FilterTargetsNext(std::list& targets) - { - targets = targetList; - } + void FilterTargetsNext(std::list& targets) + { + targets = targetList; + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargetsNext, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargetsNext, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargetsNext, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_garfrost_permafrost_SpellScript::FilterTargetsNext, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_garfrost_permafrost_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_garfrost_permafrost_SpellScript(); + } }; void AddSC_boss_garfrost() { - new boss_garfrost(); + new boss_garfrost(); - new spell_garfrost_permafrost(); + new spell_garfrost_permafrost(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 77b636922..d4bbae2b9 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -15,517 +15,517 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Yells { - SAY_AGGRO = 24, - SAY_SLAY_1 = 25, - SAY_SLAY_2 = 26, - SAY_ORDER_STOP = 27, - SAY_ORDER_BLOW = 28, - SAY_TARGET_1 = 29, - SAY_TARGET_2 = 30, - SAY_TARGET_3 = 31, - EMOTE_KRICK_MINES = 32, - EMOTE_ICK_POISON = 33, + SAY_AGGRO = 24, + SAY_SLAY_1 = 25, + SAY_SLAY_2 = 26, + SAY_ORDER_STOP = 27, + SAY_ORDER_BLOW = 28, + SAY_TARGET_1 = 29, + SAY_TARGET_2 = 30, + SAY_TARGET_3 = 31, + EMOTE_KRICK_MINES = 32, + EMOTE_ICK_POISON = 33, }; -#define EMOTE_ICK_CHASING "%s is chasing you!" +#define EMOTE_ICK_CHASING "%s is chasing you!" enum Spells { - SPELL_TOXIC_WASTE = 69024, - SPELL_MIGHTY_KICK = 69021, - SPELL_SHADOW_BOLT = 69028, + SPELL_TOXIC_WASTE = 69024, + SPELL_MIGHTY_KICK = 69021, + SPELL_SHADOW_BOLT = 69028, - SPELL_PURSUIT = 68987, + SPELL_PURSUIT = 68987, - SPELL_POISON_NOVA = 68989, + SPELL_POISON_NOVA = 68989, - SPELL_EXPLOSIVE_BARRAGE_KRICK = 69012, - SPELL_EXPLOSIVE_BARRAGE_ICK = 69263, - SPELL_EXPLOSIVE_BARRAGE_SUMMON = 69015, - SPELL_EXPLODING_ORB_VISUAL = 69017, - SPELL_AUTO_GROW = 69020, - SPELL_HASTY_GROW = 44851, - SPELL_EXPLOSIVE_BARRAGE_DAMAGE = 69019, + SPELL_EXPLOSIVE_BARRAGE_KRICK = 69012, + SPELL_EXPLOSIVE_BARRAGE_ICK = 69263, + SPELL_EXPLOSIVE_BARRAGE_SUMMON = 69015, + SPELL_EXPLODING_ORB_VISUAL = 69017, + SPELL_AUTO_GROW = 69020, + SPELL_HASTY_GROW = 44851, + SPELL_EXPLOSIVE_BARRAGE_DAMAGE = 69019, }; enum Events { - EVENT_SPELL_TOXIC_WASTE = 1, - EVENT_SPELL_MIGHTY_KICK, - EVENT_SPELL_SHADOW_BOLT, - EVENT_SPECIAL, - EVENT_SET_REACT_AGGRESSIVE, + EVENT_SPELL_TOXIC_WASTE = 1, + EVENT_SPELL_MIGHTY_KICK, + EVENT_SPELL_SHADOW_BOLT, + EVENT_SPECIAL, + EVENT_SET_REACT_AGGRESSIVE, }; class boss_ick : public CreatureScript { public: - boss_ick() : CreatureScript("boss_ick") { } + boss_ick() : CreatureScript("boss_ick") { } - struct boss_ickAI : public ScriptedAI - { - boss_ickAI(Creature* creature) : ScriptedAI(creature) - { - pInstance = creature->GetInstanceScript(); - } + struct boss_ickAI : public ScriptedAI + { + boss_ickAI(Creature* creature) : ScriptedAI(creature) + { + pInstance = creature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - me->SetReactState(REACT_AGGRESSIVE); - events.Reset(); - if (pInstance) - pInstance->SetData(DATA_ICK, NOT_STARTED); - } + void Reset() + { + me->SetReactState(REACT_AGGRESSIVE); + events.Reset(); + if (pInstance) + pInstance->SetData(DATA_ICK, NOT_STARTED); + } - bool CanAIAttack(const Unit* who) const - { - return pInstance && pInstance->GetData(DATA_INSTANCE_PROGRESS) >= INSTANCE_PROGRESS_FINISHED_INTRO; - } + bool CanAIAttack(const Unit* who) const + { + return pInstance && pInstance->GetData(DATA_INSTANCE_PROGRESS) >= INSTANCE_PROGRESS_FINISHED_INTRO; + } - void EnterCombat(Unit* /*who*/) - { - if (Creature* k = GetKrick()) - k->AI()->Talk(SAY_AGGRO); - DoZoneInCombat(); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_TOXIC_WASTE, urand(3000,5000)); - events.RescheduleEvent(EVENT_SPELL_MIGHTY_KICK, urand(10000, 20000)); - events.RescheduleEvent(EVENT_SPELL_SHADOW_BOLT, 10000); - events.RescheduleEvent(EVENT_SPECIAL, 25000); + void EnterCombat(Unit* /*who*/) + { + if (Creature* k = GetKrick()) + k->AI()->Talk(SAY_AGGRO); + DoZoneInCombat(); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_TOXIC_WASTE, urand(3000,5000)); + events.RescheduleEvent(EVENT_SPELL_MIGHTY_KICK, urand(10000, 20000)); + events.RescheduleEvent(EVENT_SPELL_SHADOW_BOLT, 10000); + events.RescheduleEvent(EVENT_SPECIAL, 25000); - if (pInstance) - pInstance->SetData(DATA_ICK, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(DATA_ICK, IN_PROGRESS); + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (!target || !spell) - return; - if (spell->Id == SPELL_PURSUIT && target->GetTypeId() == TYPEID_PLAYER) - { - WorldPacket data; + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (!target || !spell) + return; + if (spell->Id == SPELL_PURSUIT && target->GetTypeId() == TYPEID_PLAYER) + { + WorldPacket data; - ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, me, NULL, EMOTE_ICK_CHASING); - target->ToPlayer()->GetSession()->SendPacket(&data); - - AttackStart(target); - me->SetReactState(REACT_PASSIVE); - events.RescheduleEvent(EVENT_SET_REACT_AGGRESSIVE, 12000); - } - } + ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, me, NULL, EMOTE_ICK_CHASING); + target->ToPlayer()->GetSession()->SendPacket(&data); + + AttackStart(target); + me->SetReactState(REACT_PASSIVE); + events.RescheduleEvent(EVENT_SET_REACT_AGGRESSIVE, 12000); + } + } - Creature* GetKrick() - { - if (Vehicle* v = me->GetVehicleKit()) - if (Unit* p = v->GetPassenger(0)) - return p->ToCreature(); - return (Creature*)NULL; - } + Creature* GetKrick() + { + if (Vehicle* v = me->GetVehicleKit()) + if (Unit* p = v->GetPassenger(0)) + return p->ToCreature(); + return (Creature*)NULL; + } - void DamageTaken(Unit* /*doneBy*/, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - if (Creature* krick = GetKrick()) - { - krick->InterruptNonMeleeSpells(true); - krick->RemoveAllAuras(); - Position myPos(*me), exitPos; - float ang = me->GetOrientation()+3*M_PI/2; - float dist = 3.0f; - exitPos.Relocate(myPos.GetPositionX()+dist*cos(ang), myPos.GetPositionY()+dist*sin(ang), 515.0f, M_PI); - exitPos.m_positionZ = me->GetMap()->GetHeight(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.GetPositionZ()); + void DamageTaken(Unit* /*doneBy*/, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + if (Creature* krick = GetKrick()) + { + krick->InterruptNonMeleeSpells(true); + krick->RemoveAllAuras(); + Position myPos(*me), exitPos; + float ang = me->GetOrientation()+3*M_PI/2; + float dist = 3.0f; + exitPos.Relocate(myPos.GetPositionX()+dist*cos(ang), myPos.GetPositionY()+dist*sin(ang), 515.0f, M_PI); + exitPos.m_positionZ = me->GetMap()->GetHeight(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.GetPositionZ()); - if (exitPos.GetPositionZ() < 505.0f || exitPos.GetPositionZ() > 512.0f || !me->IsWithinLOS(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.GetPositionZ())) - exitPos.Relocate(myPos); + if (exitPos.GetPositionZ() < 505.0f || exitPos.GetPositionZ() > 512.0f || !me->IsWithinLOS(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.GetPositionZ())) + exitPos.Relocate(myPos); - krick->_ExitVehicle(&exitPos); - krick->AI()->DoAction(1); - } - } + krick->_ExitVehicle(&exitPos); + krick->AI()->DoAction(1); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if (me->GetVictim()) - { - float x,y,z; - me->GetVictim()->GetPosition(x, y, z); - if (KrickCenterPos.GetExactDist(x,y,z) > 80.0f || z > KrickCenterPos.GetPositionZ()+20.0f || z < KrickCenterPos.GetPositionZ()-20.0f) - { - me->SetHealth(me->GetMaxHealth()); - EnterEvadeMode(); - return; - } - } + if (me->GetVictim()) + { + float x,y,z; + me->GetVictim()->GetPosition(x, y, z); + if (KrickCenterPos.GetExactDist(x,y,z) > 80.0f || z > KrickCenterPos.GetPositionZ()+20.0f || z < KrickCenterPos.GetPositionZ()-20.0f) + { + me->SetHealth(me->GetMaxHealth()); + EnterEvadeMode(); + return; + } + } - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_TOXIC_WASTE: - if (Creature* k = GetKrick()) - if (!k->HasUnitState(UNIT_STATE_CASTING)) - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) - { - k->CastSpell(target, SPELL_TOXIC_WASTE); - events.RepeatEvent(urand(7000,10000)); - break; - } - events.RepeatEvent(2500); - break; - case EVENT_SPELL_MIGHTY_KICK: - me->CastSpell(me->GetVictim(), SPELL_MIGHTY_KICK, false); - events.RepeatEvent(urand(20000,25000)); - break; - case EVENT_SPELL_SHADOW_BOLT: - if (Creature* k = GetKrick()) - if (!k->HasUnitState(UNIT_STATE_CASTING)) - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true)) - { - k->CastSpell(target, SPELL_SHADOW_BOLT); - events.RepeatEvent(14000); - break; - } - events.RepeatEvent(2500); - break; - case EVENT_SET_REACT_AGGRESSIVE: - me->SetReactState(REACT_AGGRESSIVE); - if (!UpdateVictim()) - return; - events.PopEvent(); - break; - case EVENT_SPECIAL: - switch(urand(0,2)) - { - case 0: // Pursuit - if (Creature* k = GetKrick()) - k->AI()->Talk(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3)); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 70.0f, true)) - me->CastSpell(target, SPELL_PURSUIT, false); - break; - case 1: // Poison Nova - if (Creature* k = GetKrick()) - { - k->AI()->Talk(SAY_ORDER_BLOW); - Talk(EMOTE_ICK_POISON); - } - me->CastSpell(me, SPELL_POISON_NOVA, false); - break; - case 2: // Explosive Barrage - if (Creature* k = GetKrick()) - { - k->AI()->Talk(SAY_ORDER_STOP); - k->AI()->Talk(EMOTE_KRICK_MINES); - k->InterruptNonMeleeSpells(false); - me->InterruptNonMeleeSpells(false); - k->CastSpell(k, SPELL_EXPLOSIVE_BARRAGE_KRICK, false); - me->CastSpell(me, SPELL_EXPLOSIVE_BARRAGE_ICK, false); - } - events.DelayEvents(20000); - break; - } - events.RepeatEvent(urand(25000,30000)); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_TOXIC_WASTE: + if (Creature* k = GetKrick()) + if (!k->HasUnitState(UNIT_STATE_CASTING)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + { + k->CastSpell(target, SPELL_TOXIC_WASTE); + events.RepeatEvent(urand(7000,10000)); + break; + } + events.RepeatEvent(2500); + break; + case EVENT_SPELL_MIGHTY_KICK: + me->CastSpell(me->GetVictim(), SPELL_MIGHTY_KICK, false); + events.RepeatEvent(urand(20000,25000)); + break; + case EVENT_SPELL_SHADOW_BOLT: + if (Creature* k = GetKrick()) + if (!k->HasUnitState(UNIT_STATE_CASTING)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true)) + { + k->CastSpell(target, SPELL_SHADOW_BOLT); + events.RepeatEvent(14000); + break; + } + events.RepeatEvent(2500); + break; + case EVENT_SET_REACT_AGGRESSIVE: + me->SetReactState(REACT_AGGRESSIVE); + if (!UpdateVictim()) + return; + events.PopEvent(); + break; + case EVENT_SPECIAL: + switch(urand(0,2)) + { + case 0: // Pursuit + if (Creature* k = GetKrick()) + k->AI()->Talk(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3)); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 70.0f, true)) + me->CastSpell(target, SPELL_PURSUIT, false); + break; + case 1: // Poison Nova + if (Creature* k = GetKrick()) + { + k->AI()->Talk(SAY_ORDER_BLOW); + Talk(EMOTE_ICK_POISON); + } + me->CastSpell(me, SPELL_POISON_NOVA, false); + break; + case 2: // Explosive Barrage + if (Creature* k = GetKrick()) + { + k->AI()->Talk(SAY_ORDER_STOP); + k->AI()->Talk(EMOTE_KRICK_MINES); + k->InterruptNonMeleeSpells(false); + me->InterruptNonMeleeSpells(false); + k->CastSpell(k, SPELL_EXPLOSIVE_BARRAGE_KRICK, false); + me->CastSpell(me, SPELL_EXPLOSIVE_BARRAGE_ICK, false); + } + events.DelayEvents(20000); + break; + } + events.RepeatEvent(urand(25000,30000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_ICK, DONE); - me->RemoveAllAuras(); - } + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_ICK, DONE); + me->RemoveAllAuras(); + } - void KilledUnit(Unit* who) - { - // if during pursuit ick kills his target, set to aggressive again - if (who && me->GetVictim() && who->GetGUID() == me->GetVictim()->GetGUID()) - if (me->GetReactState() == REACT_PASSIVE) - me->SetReactState(REACT_AGGRESSIVE); + void KilledUnit(Unit* who) + { + // if during pursuit ick kills his target, set to aggressive again + if (who && me->GetVictim() && who->GetGUID() == me->GetVictim()->GetGUID()) + if (me->GetReactState() == REACT_PASSIVE) + me->SetReactState(REACT_AGGRESSIVE); - if (who->GetTypeId() == TYPEID_PLAYER) - if (Creature* k = GetKrick()) - k->AI()->Talk(RAND(SAY_SLAY_1, SAY_SLAY_2)); - } + if (who->GetTypeId() == TYPEID_PLAYER) + if (Creature* k = GetKrick()) + k->AI()->Talk(RAND(SAY_SLAY_1, SAY_SLAY_2)); + } - void JustSummoned(Creature* summon) - { - } - }; + void JustSummoned(Creature* summon) + { + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_ickAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_ickAI(creature); + } }; class boss_krick : public CreatureScript { public: - boss_krick() : CreatureScript("boss_krick") { } + boss_krick() : CreatureScript("boss_krick") { } - struct boss_krickAI : public NullCreatureAI - { - boss_krickAI(Creature* creature) : NullCreatureAI(creature) - { - pInstance = creature->GetInstanceScript(); - } + struct boss_krickAI : public NullCreatureAI + { + boss_krickAI(Creature* creature) : NullCreatureAI(creature) + { + pInstance = creature->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void DoAction(int32 a) - { - if (a==1) - { - me->setActive(true); - events.RescheduleEvent(20, 0); - } - } + void DoAction(int32 a) + { + if (a==1) + { + me->setActive(true); + events.RescheduleEvent(20, 0); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch(events.GetEvent()) - { - case 0: - break; - case 20: - if (pInstance) - { - pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_FINISHED_KRICK_SCENE); + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch(events.GetEvent()) + { + case 0: + break; + case 20: + if (pInstance) + { + pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_FINISHED_KRICK_SCENE); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) - { - c->GetMotionMaster()->Clear(); - c->UpdatePosition(SBSLeaderStartPos, true); - c->StopMovingOnCurrentPos(); - c->AI()->Reset(); - } - } - events.PopEvent(); - events.RescheduleEvent(1, 3000); - break; - case 1: - Talk(SAY_OUTRO_KRICK_1); - if (pInstance) - { - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) - { - float angle = me->GetAngle(c); - me->SetFacingTo(angle); - float x = me->GetPositionX()+cos(angle)*7.0f; - float y = me->GetPositionY()+sin(angle)*7.0f; - c->GetMotionMaster()->MovePoint(0, x, y, me->GetPositionZ()); - } + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) + { + c->GetMotionMaster()->Clear(); + c->UpdatePosition(SBSLeaderStartPos, true); + c->StopMovingOnCurrentPos(); + c->AI()->Reset(); + } + } + events.PopEvent(); + events.RescheduleEvent(1, 3000); + break; + case 1: + Talk(SAY_OUTRO_KRICK_1); + if (pInstance) + { + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) + { + float angle = me->GetAngle(c); + me->SetFacingTo(angle); + float x = me->GetPositionX()+cos(angle)*7.0f; + float y = me->GetPositionY()+sin(angle)*7.0f; + c->GetMotionMaster()->MovePoint(0, x, y, me->GetPositionZ()); + } - for (uint8 i=0; i<2; ++i) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GUARD_1_GUID+i))) - c->DespawnOrUnsummon(); - } - events.PopEvent(); - events.RescheduleEvent(2, 7000); - break; - case 2: - if (pInstance) - { - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - { - c->setActive(true); - c->UpdatePosition(SBSTyrannusStartPos, true); - c->SetHomePosition(SBSTyrannusStartPos); - } - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) - c->AI()->Talk(c->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_KRICK_1 : SAY_SYLVANAS_KRICK_1); - } - events.PopEvent(); - events.RescheduleEvent(3, 6500); - break; - case 3: - Talk(SAY_OUTRO_KRICK_2); - events.PopEvent(); - events.RescheduleEvent(4, 17000); - break; - case 4: - if (pInstance) - { - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - c->GetMotionMaster()->MovePath(PATH_BEGIN_VALUE+10, false); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) - c->AI()->Talk(c->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_KRICK_2 : SAY_SYLVANAS_KRICK_2); - } - events.PopEvent(); - events.RescheduleEvent(5, 6500); - break; - case 5: - Talk(SAY_OUTRO_KRICK_3); - events.PopEvent(); - events.RescheduleEvent(6, 6500); - break; - case 6: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - { - c->SetFacingToObject(me); - c->AI()->Talk(SAY_TYRANNUS_KRICK_1); - } - events.PopEvent(); - events.RescheduleEvent(7, 4000); - break; - case 7: - me->CastSpell(me, 69413, true); - me->SendMeleeAttackStop(me->GetVictim()); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MoveTakeoff(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+9.0f, 0.5f * 7.0f); + for (uint8 i=0; i<2; ++i) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GUARD_1_GUID+i))) + c->DespawnOrUnsummon(); + } + events.PopEvent(); + events.RescheduleEvent(2, 7000); + break; + case 2: + if (pInstance) + { + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + { + c->setActive(true); + c->UpdatePosition(SBSTyrannusStartPos, true); + c->SetHomePosition(SBSTyrannusStartPos); + } + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) + c->AI()->Talk(c->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_KRICK_1 : SAY_SYLVANAS_KRICK_1); + } + events.PopEvent(); + events.RescheduleEvent(3, 6500); + break; + case 3: + Talk(SAY_OUTRO_KRICK_2); + events.PopEvent(); + events.RescheduleEvent(4, 17000); + break; + case 4: + if (pInstance) + { + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + c->GetMotionMaster()->MovePath(PATH_BEGIN_VALUE+10, false); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) + c->AI()->Talk(c->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_KRICK_2 : SAY_SYLVANAS_KRICK_2); + } + events.PopEvent(); + events.RescheduleEvent(5, 6500); + break; + case 5: + Talk(SAY_OUTRO_KRICK_3); + events.PopEvent(); + events.RescheduleEvent(6, 6500); + break; + case 6: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + { + c->SetFacingToObject(me); + c->AI()->Talk(SAY_TYRANNUS_KRICK_1); + } + events.PopEvent(); + events.RescheduleEvent(7, 4000); + break; + case 7: + me->CastSpell(me, 69413, true); + me->SendMeleeAttackStop(me->GetVictim()); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SendMovementFlagUpdate(); + me->GetMotionMaster()->MoveTakeoff(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+9.0f, 0.5f * 7.0f); - events.PopEvent(); - events.RescheduleEvent(8, 2000); - break; - case 8: - Talk(SAY_OUTRO_KRICK_4); - events.PopEvent(); - events.RescheduleEvent(9, 1500); - break; - case 9: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - c->CastSpell(c, 69753, false); + events.PopEvent(); + events.RescheduleEvent(8, 2000); + break; + case 8: + Talk(SAY_OUTRO_KRICK_4); + events.PopEvent(); + events.RescheduleEvent(9, 1500); + break; + case 9: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + c->CastSpell(c, 69753, false); - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->AddUnitState(UNIT_STATE_DIED); + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->AddUnitState(UNIT_STATE_DIED); - me->CastSpell(me, SPELL_KRICK_KILL_CREDIT, true); + me->CastSpell(me, SPELL_KRICK_KILL_CREDIT, true); - me->RemoveAllAuras(); - me->GetMotionMaster()->MoveFall(0, true); - events.PopEvent(); - events.RescheduleEvent(10, 5000); - break; - case 10: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - c->AI()->Talk(SAY_TYRANNUS_KRICK_2); - events.PopEvent(); - events.RescheduleEvent(11, 9000); - break; - case 11: - if (pInstance) - { - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - c->GetMotionMaster()->MovePoint(1, 809.39f, 74.69f, 541.54f); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) - { - c->AI()->Talk(c->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_KRICK_3 : SAY_SYLVANAS_KRICK_3); - c->GetMotionMaster()->MovePath(PATH_BEGIN_VALUE+11, false); - } - } - me->setActive(false); - Unit::Kill(me, me); - events.PopEvent(); - break; - } - } - }; + me->RemoveAllAuras(); + me->GetMotionMaster()->MoveFall(0, true); + events.PopEvent(); + events.RescheduleEvent(10, 5000); + break; + case 10: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + c->AI()->Talk(SAY_TYRANNUS_KRICK_2); + events.PopEvent(); + events.RescheduleEvent(11, 9000); + break; + case 11: + if (pInstance) + { + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + c->GetMotionMaster()->MovePoint(1, 809.39f, 74.69f, 541.54f); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) + { + c->AI()->Talk(c->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_KRICK_3 : SAY_SYLVANAS_KRICK_3); + c->GetMotionMaster()->MovePath(PATH_BEGIN_VALUE+11, false); + } + } + me->setActive(false); + Unit::Kill(me, me); + events.PopEvent(); + break; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_krickAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_krickAI(creature); + } }; class spell_krick_explosive_barrage : public SpellScriptLoader { public: - spell_krick_explosive_barrage() : SpellScriptLoader("spell_krick_explosive_barrage") { } + spell_krick_explosive_barrage() : SpellScriptLoader("spell_krick_explosive_barrage") { } - class spell_krick_explosive_barrage_AuraScript : public AuraScript - { - PrepareAuraScript(spell_krick_explosive_barrage_AuraScript); + class spell_krick_explosive_barrage_AuraScript : public AuraScript + { + PrepareAuraScript(spell_krick_explosive_barrage_AuraScript); - void HandlePeriodicTick(AuraEffect const* /*aurEff*/) - { - PreventDefaultAction(); - if (Unit* caster = GetCaster()) - if (caster->GetTypeId() == TYPEID_UNIT) - { - Map::PlayerList const &players = caster->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player* player = itr->GetSource()) - if (player->IsWithinDist(caster, 100.0f)) - caster->CastSpell(player, SPELL_EXPLOSIVE_BARRAGE_SUMMON, true); - } - } + void HandlePeriodicTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + if (caster->GetTypeId() == TYPEID_UNIT) + { + Map::PlayerList const &players = caster->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->GetSource()) + if (player->IsWithinDist(caster, 100.0f)) + caster->CastSpell(player, SPELL_EXPLOSIVE_BARRAGE_SUMMON, true); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_krick_explosive_barrage_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_krick_explosive_barrage_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_krick_explosive_barrage_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_krick_explosive_barrage_AuraScript(); + } }; class spell_exploding_orb_auto_grow : public SpellScriptLoader { public: - spell_exploding_orb_auto_grow() : SpellScriptLoader("spell_exploding_orb_auto_grow") { } + spell_exploding_orb_auto_grow() : SpellScriptLoader("spell_exploding_orb_auto_grow") { } - class spell_exploding_orb_auto_grow_AuraScript : public AuraScript - { - PrepareAuraScript(spell_exploding_orb_auto_grow_AuraScript); + class spell_exploding_orb_auto_grow_AuraScript : public AuraScript + { + PrepareAuraScript(spell_exploding_orb_auto_grow_AuraScript); - void HandlePeriodicTick(AuraEffect const* aurEff) - { - if (aurEff->GetTickNumber() >= 16) - if (Unit* target = GetTarget()) - { - PreventDefaultAction(); - target->CastSpell(target, SPELL_EXPLOSIVE_BARRAGE_DAMAGE, false); - target->RemoveAurasDueToSpell(SPELL_HASTY_GROW); - target->RemoveAurasDueToSpell(SPELL_AUTO_GROW); - target->RemoveAurasDueToSpell(SPELL_EXPLODING_ORB_VISUAL); - if (target->GetTypeId() == TYPEID_UNIT) - target->ToCreature()->DespawnOrUnsummon(2000); - } - } + void HandlePeriodicTick(AuraEffect const* aurEff) + { + if (aurEff->GetTickNumber() >= 16) + if (Unit* target = GetTarget()) + { + PreventDefaultAction(); + target->CastSpell(target, SPELL_EXPLOSIVE_BARRAGE_DAMAGE, false); + target->RemoveAurasDueToSpell(SPELL_HASTY_GROW); + target->RemoveAurasDueToSpell(SPELL_AUTO_GROW); + target->RemoveAurasDueToSpell(SPELL_EXPLODING_ORB_VISUAL); + if (target->GetTypeId() == TYPEID_UNIT) + target->ToCreature()->DespawnOrUnsummon(2000); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_exploding_orb_auto_grow_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_exploding_orb_auto_grow_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_exploding_orb_auto_grow_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_exploding_orb_auto_grow_AuraScript(); + } }; void AddSC_boss_ick() { - new boss_ick(); - new boss_krick(); + new boss_ick(); + new boss_krick(); - new spell_krick_explosive_barrage(); - new spell_exploding_orb_auto_grow(); + new spell_krick_explosive_barrage(); + new spell_exploding_orb_auto_grow(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index 3263b3e08..50118f479 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -9,222 +9,222 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Texts { - SAY_AGGRO = 53, - SAY_SLAY_1 = 54, - SAY_SLAY_2 = 55, - SAY_DEATH = 56, - SAY_MARK = 57, - SAY_SMASH = 58, - EMOTE_RIMEFANG_ICEBOLT = 59, - EMOTE_SMASH = 60, + SAY_AGGRO = 53, + SAY_SLAY_1 = 54, + SAY_SLAY_2 = 55, + SAY_DEATH = 56, + SAY_MARK = 57, + SAY_SMASH = 58, + EMOTE_RIMEFANG_ICEBOLT = 59, + EMOTE_SMASH = 60, }; enum Spells { - SPELL_OVERLORDS_BRAND = 69172, - SPELL_OVERLORDS_BRAND_HEAL = 69190, - SPELL_OVERLORDS_BRAND_DAMAGE = 69189, - SPELL_FORCEFUL_SMASH = 69155, - SPELL_UNHOLY_POWER = 69167, - RIMEFANG_SPELL_ICY_BLAST = 69232, - SPELL_MARK_OF_RIMEFANG = 69275, - RIMEFANG_SPELL_HOARFROST = 69246, + SPELL_OVERLORDS_BRAND = 69172, + SPELL_OVERLORDS_BRAND_HEAL = 69190, + SPELL_OVERLORDS_BRAND_DAMAGE = 69189, + SPELL_FORCEFUL_SMASH = 69155, + SPELL_UNHOLY_POWER = 69167, + RIMEFANG_SPELL_ICY_BLAST = 69232, + SPELL_MARK_OF_RIMEFANG = 69275, + RIMEFANG_SPELL_HOARFROST = 69246, }; enum Events { - EVENT_SPELL_FORCEFUL_SMASH = 1, - EVENT_SPELL_UNHOLY_POWER, - EVENT_SPELL_OVERLORDS_BRAND, - EVENT_RIMEFANG_SPELL_ICY_BLAST, - EVENT_SPELL_MARK_OF_RIMEFANG, + EVENT_SPELL_FORCEFUL_SMASH = 1, + EVENT_SPELL_UNHOLY_POWER, + EVENT_SPELL_OVERLORDS_BRAND, + EVENT_RIMEFANG_SPELL_ICY_BLAST, + EVENT_SPELL_MARK_OF_RIMEFANG, }; class boss_tyrannus : public CreatureScript { public: - boss_tyrannus() : CreatureScript("boss_tyrannus") { } + boss_tyrannus() : CreatureScript("boss_tyrannus") { } - struct boss_tyrannusAI : public ScriptedAI - { - boss_tyrannusAI(Creature* creature) : ScriptedAI(creature) - { - pInstance = me->GetInstanceScript(); - me->SetReactState(REACT_PASSIVE); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) - { - c->SetCanFly(true); - } - } + struct boss_tyrannusAI : public ScriptedAI + { + boss_tyrannusAI(Creature* creature) : ScriptedAI(creature) + { + pInstance = me->GetInstanceScript(); + me->SetReactState(REACT_PASSIVE); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) + { + c->SetCanFly(true); + } + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - if (me->HasReactState(REACT_AGGRESSIVE)) // Reset() called by EnterEvadeMode() - { - if (!pInstance) - return; - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MARTIN_OR_GORKUN_GUID))) - { - c->AI()->DoAction(1); - c->DespawnOrUnsummon(); - pInstance->SetData64(DATA_MARTIN_OR_GORKUN_GUID, 0); - } - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) - { - c->GetMotionMaster()->Clear(); - c->GetMotionMaster()->MoveIdle(); + void Reset() + { + events.Reset(); + if (me->HasReactState(REACT_AGGRESSIVE)) // Reset() called by EnterEvadeMode() + { + if (!pInstance) + return; + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MARTIN_OR_GORKUN_GUID))) + { + c->AI()->DoAction(1); + c->DespawnOrUnsummon(); + pInstance->SetData64(DATA_MARTIN_OR_GORKUN_GUID, 0); + } + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) + { + c->GetMotionMaster()->Clear(); + c->GetMotionMaster()->MoveIdle(); - c->RemoveAllAuras(); - c->UpdatePosition(1017.3f, 168.974f, 642.926f, 5.2709f, true); - c->StopMovingOnCurrentPos(); - if (Vehicle* v = c->GetVehicleKit()) - v->InstallAllAccessories(false); - } - } - } + c->RemoveAllAuras(); + c->UpdatePosition(1017.3f, 168.974f, 642.926f, 5.2709f, true); + c->StopMovingOnCurrentPos(); + if (Vehicle* v = c->GetVehicleKit()) + v->InstallAllAccessories(false); + } + } + } - void DoAction(int32 param) - { - if (param == 1) - { - Position exitPos = {1023.46f, 159.12f, 628.2f, 5.23f}; - me->RemoveAllAuras(); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) - { - c->RemoveAura(46598); - c->GetMotionMaster()->Clear(); - c->GetMotionMaster()->MovePath(PATH_BEGIN_VALUE+18, true); - } - me->SetHomePosition(exitPos); - me->GetMotionMaster()->MoveJump(exitPos, 10.0f, 2.0f); + void DoAction(int32 param) + { + if (param == 1) + { + Position exitPos = {1023.46f, 159.12f, 628.2f, 5.23f}; + me->RemoveAllAuras(); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) + { + c->RemoveAura(46598); + c->GetMotionMaster()->Clear(); + c->GetMotionMaster()->MovePath(PATH_BEGIN_VALUE+18, true); + } + me->SetHomePosition(exitPos); + me->GetMotionMaster()->MoveJump(exitPos, 10.0f, 2.0f); - // start real fight - DoZoneInCombat(); - me->CastSpell(me, 43979, true); - Talk(SAY_AGGRO); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_FORCEFUL_SMASH, urand(14000,16000)); - events.RescheduleEvent(EVENT_SPELL_OVERLORDS_BRAND, urand(4000,6000)); - events.RescheduleEvent(EVENT_RIMEFANG_SPELL_ICY_BLAST, 5000); - events.RescheduleEvent(EVENT_SPELL_MARK_OF_RIMEFANG, 25000); - } - } + // start real fight + DoZoneInCombat(); + me->CastSpell(me, 43979, true); + Talk(SAY_AGGRO); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_FORCEFUL_SMASH, urand(14000,16000)); + events.RescheduleEvent(EVENT_SPELL_OVERLORDS_BRAND, urand(4000,6000)); + events.RescheduleEvent(EVENT_RIMEFANG_SPELL_ICY_BLAST, 5000); + events.RescheduleEvent(EVENT_SPELL_MARK_OF_RIMEFANG, 25000); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if (me->GetVictim()) - { - float x,y,z; - me->GetVictim()->GetPosition(x, y, z); - if (TSDistCheckPos.GetExactDist(x,y,z) > 100.0f || z > TSDistCheckPos.GetPositionZ()+20.0f || z < TSDistCheckPos.GetPositionZ()-20.0f) - { - me->SetHealth(me->GetMaxHealth()); - EnterEvadeMode(); - return; - } - } + if (me->GetVictim()) + { + float x,y,z; + me->GetVictim()->GetPosition(x, y, z); + if (TSDistCheckPos.GetExactDist(x,y,z) > 100.0f || z > TSDistCheckPos.GetPositionZ()+20.0f || z < TSDistCheckPos.GetPositionZ()-20.0f) + { + me->SetHealth(me->GetMaxHealth()); + EnterEvadeMode(); + return; + } + } - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_FORCEFUL_SMASH: - if (me->IsWithinMeleeRange(me->GetVictim())) - { - me->CastSpell(me->GetVictim(), SPELL_FORCEFUL_SMASH, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_SPELL_UNHOLY_POWER, 1000); - break; - } - events.RepeatEvent(3000); - break; - case EVENT_SPELL_UNHOLY_POWER: - Talk(SAY_SMASH); - Talk(EMOTE_SMASH); - me->CastSpell(me, SPELL_UNHOLY_POWER, false); - events.PopEvent(); - events.ScheduleEvent(EVENT_SPELL_FORCEFUL_SMASH, urand(40000, 48000)); - break; - case EVENT_SPELL_OVERLORDS_BRAND: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 95.0f, true)) - me->CastSpell(target, SPELL_OVERLORDS_BRAND, false); - events.RepeatEvent(urand(11000,12000)); - break; - case EVENT_RIMEFANG_SPELL_ICY_BLAST: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 190.0f, true)) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) - c->CastSpell(target, RIMEFANG_SPELL_ICY_BLAST, false); - events.RepeatEvent(5000); - break; - case EVENT_SPELL_MARK_OF_RIMEFANG: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 190.0f, true)) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) - { - Talk(SAY_MARK); - c->AI()->Talk(EMOTE_RIMEFANG_ICEBOLT, target); - c->CastSpell(target, RIMEFANG_SPELL_HOARFROST, false); - } - events.RepeatEvent(25000); - events.RescheduleEvent(EVENT_RIMEFANG_SPELL_ICY_BLAST, 10000); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_FORCEFUL_SMASH: + if (me->IsWithinMeleeRange(me->GetVictim())) + { + me->CastSpell(me->GetVictim(), SPELL_FORCEFUL_SMASH, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_SPELL_UNHOLY_POWER, 1000); + break; + } + events.RepeatEvent(3000); + break; + case EVENT_SPELL_UNHOLY_POWER: + Talk(SAY_SMASH); + Talk(EMOTE_SMASH); + me->CastSpell(me, SPELL_UNHOLY_POWER, false); + events.PopEvent(); + events.ScheduleEvent(EVENT_SPELL_FORCEFUL_SMASH, urand(40000, 48000)); + break; + case EVENT_SPELL_OVERLORDS_BRAND: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 95.0f, true)) + me->CastSpell(target, SPELL_OVERLORDS_BRAND, false); + events.RepeatEvent(urand(11000,12000)); + break; + case EVENT_RIMEFANG_SPELL_ICY_BLAST: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 190.0f, true)) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) + c->CastSpell(target, RIMEFANG_SPELL_ICY_BLAST, false); + events.RepeatEvent(5000); + break; + case EVENT_SPELL_MARK_OF_RIMEFANG: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 190.0f, true)) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) + { + Talk(SAY_MARK); + c->AI()->Talk(EMOTE_RIMEFANG_ICEBOLT, target); + c->CastSpell(target, RIMEFANG_SPELL_HOARFROST, false); + } + events.RepeatEvent(25000); + events.RescheduleEvent(EVENT_RIMEFANG_SPELL_ICY_BLAST, 10000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_TYRANNUS, DONE); - if (me->IsSummon()) - me->ToTempSummon()->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(DATA_TYRANNUS, DONE); + if (me->IsSummon()) + me->ToTempSummon()->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER) - Talk(RAND(SAY_SLAY_1,SAY_SLAY_2)); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(RAND(SAY_SLAY_1,SAY_SLAY_2)); + } - bool CanAIAttack(const Unit* who) const - { - switch (who->GetEntry()) - { - case NPC_MARTIN_VICTUS_2: - case NPC_GORKUN_IRONSKULL_2: - case NPC_FREED_SLAVE_1_ALLIANCE: - case NPC_FREED_SLAVE_2_ALLIANCE: - case NPC_FREED_SLAVE_3_ALLIANCE: - case NPC_FREED_SLAVE_1_HORDE: - case NPC_FREED_SLAVE_2_HORDE: - case NPC_FREED_SLAVE_3_HORDE: - return false; - default: - return true; - } - } - }; + bool CanAIAttack(const Unit* who) const + { + switch (who->GetEntry()) + { + case NPC_MARTIN_VICTUS_2: + case NPC_GORKUN_IRONSKULL_2: + case NPC_FREED_SLAVE_1_ALLIANCE: + case NPC_FREED_SLAVE_2_ALLIANCE: + case NPC_FREED_SLAVE_3_ALLIANCE: + case NPC_FREED_SLAVE_1_HORDE: + case NPC_FREED_SLAVE_2_HORDE: + case NPC_FREED_SLAVE_3_HORDE: + return false; + default: + return true; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_tyrannusAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_tyrannusAI(creature); + } }; void AddSC_boss_tyrannus() { - new boss_tyrannus(); + new boss_tyrannus(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 3884916be..f1d92cf90 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -10,74 +10,74 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! class instance_pit_of_saron : public InstanceMapScript { public: - instance_pit_of_saron() : InstanceMapScript("instance_pit_of_saron", 658) { } + instance_pit_of_saron() : InstanceMapScript("instance_pit_of_saron", 658) { } - struct instance_pit_of_saron_InstanceScript : public InstanceScript - { - instance_pit_of_saron_InstanceScript(Map* map) : InstanceScript(map) {} + struct instance_pit_of_saron_InstanceScript : public InstanceScript + { + instance_pit_of_saron_InstanceScript(Map* map) : InstanceScript(map) {} - uint32 m_auiEncounter[MAX_ENCOUNTER]; - TeamId teamIdInInstance; - uint32 InstanceProgress; - std::string str_data; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + TeamId teamIdInInstance; + uint32 InstanceProgress; + std::string str_data; - uint64 NPC_LeaderFirstGUID; - uint64 NPC_LeaderSecondGUID; - uint64 NPC_TyrannusEventGUID; - uint64 NPC_Necrolyte1GUID; - uint64 NPC_Necrolyte2GUID; - uint64 NPC_GuardFirstGUID; - uint64 NPC_GuardSecondGUID; - uint64 NPC_SindragosaGUID; + uint64 NPC_LeaderFirstGUID; + uint64 NPC_LeaderSecondGUID; + uint64 NPC_TyrannusEventGUID; + uint64 NPC_Necrolyte1GUID; + uint64 NPC_Necrolyte2GUID; + uint64 NPC_GuardFirstGUID; + uint64 NPC_GuardSecondGUID; + uint64 NPC_SindragosaGUID; - uint64 NPC_GarfrostGUID; - uint64 NPC_MartinOrGorkunGUID; - uint64 NPC_RimefangGUID; - uint64 NPC_TyrannusGUID; + uint64 NPC_GarfrostGUID; + uint64 NPC_MartinOrGorkunGUID; + uint64 NPC_RimefangGUID; + uint64 NPC_TyrannusGUID; - uint64 GO_IceWallGUID; + uint64 GO_IceWallGUID; - bool bAchievEleven; - bool bAchievDontLookUp; + bool bAchievEleven; + bool bAchievDontLookUp; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - teamIdInInstance = TEAM_NEUTRAL; - InstanceProgress = INSTANCE_PROGRESS_NONE; + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + teamIdInInstance = TEAM_NEUTRAL; + InstanceProgress = INSTANCE_PROGRESS_NONE; - NPC_LeaderFirstGUID = 0; - NPC_LeaderSecondGUID = 0; - NPC_TyrannusEventGUID = 0; - NPC_Necrolyte1GUID = 0; - NPC_Necrolyte2GUID = 0; - NPC_GuardFirstGUID = 0; - NPC_GuardSecondGUID = 0; - NPC_SindragosaGUID = 0; + NPC_LeaderFirstGUID = 0; + NPC_LeaderSecondGUID = 0; + NPC_TyrannusEventGUID = 0; + NPC_Necrolyte1GUID = 0; + NPC_Necrolyte2GUID = 0; + NPC_GuardFirstGUID = 0; + NPC_GuardSecondGUID = 0; + NPC_SindragosaGUID = 0; - NPC_GarfrostGUID = 0; - NPC_MartinOrGorkunGUID = 0; - NPC_RimefangGUID = 0; - NPC_TyrannusGUID = 0; + NPC_GarfrostGUID = 0; + NPC_MartinOrGorkunGUID = 0; + NPC_RimefangGUID = 0; + NPC_TyrannusGUID = 0; - GO_IceWallGUID = 0; + GO_IceWallGUID = 0; - bAchievEleven = true; - bAchievDontLookUp = true; - } + bAchievEleven = true; + bAchievDontLookUp = true; + } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; - } + return false; + } - void OnPlayerEnter(Player* plr) - { - instance->LoadGrid(LeaderIntroPos.GetPositionX(), LeaderIntroPos.GetPositionY()); - } + void OnPlayerEnter(Player* plr) + { + instance->LoadGrid(LeaderIntroPos.GetPositionX(), LeaderIntroPos.GetPositionY()); + } uint32 GetCreatureEntry(uint32 /*guidLow*/, CreatureData const* data) { @@ -100,338 +100,338 @@ public: if (teamIdInInstance == TEAM_ALLIANCE) return 0; break; - } + } - return entry; - } + return entry; + } - void OnCreatureCreate(Creature* creature) - { - if (teamIdInInstance == TEAM_NEUTRAL) - { - Map::PlayerList const &players = instance->GetPlayers(); - if (!players.isEmpty()) - if (Player* player = players.begin()->GetSource()) - teamIdInInstance = player->GetTeamId(); - } + void OnCreatureCreate(Creature* creature) + { + if (teamIdInInstance == TEAM_NEUTRAL) + { + Map::PlayerList const &players = instance->GetPlayers(); + if (!players.isEmpty()) + if (Player* player = players.begin()->GetSource()) + teamIdInInstance = player->GetTeamId(); + } - switch (creature->GetEntry()) - { - case NPC_SYLVANAS_PART1: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_JAINA_PART1); - NPC_LeaderFirstGUID = creature->GetGUID(); + switch (creature->GetEntry()) + { + case NPC_SYLVANAS_PART1: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_JAINA_PART1); + NPC_LeaderFirstGUID = creature->GetGUID(); - switch (InstanceProgress) - { - case INSTANCE_PROGRESS_FINISHED_INTRO: - creature->SetPosition(LeaderIntroPos); - break; - case INSTANCE_PROGRESS_FINISHED_KRICK_SCENE: - case INSTANCE_PROGRESS_AFTER_WARN_1: - case INSTANCE_PROGRESS_AFTER_WARN_2: - case INSTANCE_PROGRESS_AFTER_TUNNEL_WARN: - case INSTANCE_PROGRESS_TYRANNUS_INTRO: - creature->SetPosition(SBSLeaderEndPos); - break; - } - break; - case NPC_SYLVANAS_PART2: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_JAINA_PART2); - NPC_LeaderSecondGUID = creature->GetGUID(); - break; - case NPC_TYRANNUS_EVENT: - if (!NPC_TyrannusEventGUID) - { - switch (InstanceProgress) - { - case INSTANCE_PROGRESS_FINISHED_INTRO: - creature->SetPosition(SBSTyrannusStartPos); - break; - case INSTANCE_PROGRESS_FINISHED_KRICK_SCENE: - creature->SetPosition(PTSTyrannusWaitPos1); - break; - case INSTANCE_PROGRESS_AFTER_WARN_1: - creature->SetPosition(PTSTyrannusWaitPos2); - break; - case INSTANCE_PROGRESS_AFTER_WARN_2: - creature->SetPosition(PTSTyrannusWaitPos3); - break; - case INSTANCE_PROGRESS_AFTER_TUNNEL_WARN: - case INSTANCE_PROGRESS_TYRANNUS_INTRO: - creature->SetPosition(SBSTyrannusStartPos); - break; - } - NPC_TyrannusEventGUID = creature->GetGUID(); - - } - break; - case NPC_LORALEN: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_ELANDRA); - if (!NPC_GuardFirstGUID) - NPC_GuardFirstGUID = creature->GetGUID(); - break; - case NPC_KALIRA: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_KORELN); - if (!NPC_GuardSecondGUID) - NPC_GuardSecondGUID = creature->GetGUID(); - break; - case NPC_HORDE_SLAVE_1: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_ALLIANCE_SLAVE_1); - break; - case NPC_HORDE_SLAVE_2: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_ALLIANCE_SLAVE_2); - break; - case NPC_HORDE_SLAVE_3: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_ALLIANCE_SLAVE_3); - break; - case NPC_HORDE_SLAVE_4: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_ALLIANCE_SLAVE_4); - break; - case NPC_GORKUN_IRONSKULL_1: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_MARTIN_VICTUS_1); - break; - case NPC_GARFROST: - NPC_GarfrostGUID = creature->GetGUID(); - break; - case NPC_FREED_SLAVE_1_HORDE: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_FREED_SLAVE_1_ALLIANCE); - break; - case NPC_FREED_SLAVE_2_HORDE: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_FREED_SLAVE_2_ALLIANCE); - break; - case NPC_FREED_SLAVE_3_HORDE: - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_FREED_SLAVE_3_ALLIANCE); - break; - case NPC_GORKUN_IRONSKULL_2: - if (NPC_MartinOrGorkunGUID) - if (Creature* c = instance->GetCreature(NPC_MartinOrGorkunGUID)) - { - c->AI()->DoAction(1); // despawn summons - c->DespawnOrUnsummon(); - } - if (teamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_MARTIN_VICTUS_2); - NPC_MartinOrGorkunGUID = creature->GetGUID(); - break; - case NPC_RIMEFANG: - NPC_RimefangGUID = creature->GetGUID(); - if (m_auiEncounter[2] == DONE) - creature->SetVisible(false); - break; - case NPC_TYRANNUS: - if (NPC_TyrannusGUID) - if (Creature* c = instance->GetCreature(NPC_TyrannusGUID)) - c->DespawnOrUnsummon(); - NPC_TyrannusGUID = creature->GetGUID(); + switch (InstanceProgress) + { + case INSTANCE_PROGRESS_FINISHED_INTRO: + creature->SetPosition(LeaderIntroPos); + break; + case INSTANCE_PROGRESS_FINISHED_KRICK_SCENE: + case INSTANCE_PROGRESS_AFTER_WARN_1: + case INSTANCE_PROGRESS_AFTER_WARN_2: + case INSTANCE_PROGRESS_AFTER_TUNNEL_WARN: + case INSTANCE_PROGRESS_TYRANNUS_INTRO: + creature->SetPosition(SBSLeaderEndPos); + break; + } + break; + case NPC_SYLVANAS_PART2: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_JAINA_PART2); + NPC_LeaderSecondGUID = creature->GetGUID(); + break; + case NPC_TYRANNUS_EVENT: + if (!NPC_TyrannusEventGUID) + { + switch (InstanceProgress) + { + case INSTANCE_PROGRESS_FINISHED_INTRO: + creature->SetPosition(SBSTyrannusStartPos); + break; + case INSTANCE_PROGRESS_FINISHED_KRICK_SCENE: + creature->SetPosition(PTSTyrannusWaitPos1); + break; + case INSTANCE_PROGRESS_AFTER_WARN_1: + creature->SetPosition(PTSTyrannusWaitPos2); + break; + case INSTANCE_PROGRESS_AFTER_WARN_2: + creature->SetPosition(PTSTyrannusWaitPos3); + break; + case INSTANCE_PROGRESS_AFTER_TUNNEL_WARN: + case INSTANCE_PROGRESS_TYRANNUS_INTRO: + creature->SetPosition(SBSTyrannusStartPos); + break; + } + NPC_TyrannusEventGUID = creature->GetGUID(); + + } + break; + case NPC_LORALEN: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_ELANDRA); + if (!NPC_GuardFirstGUID) + NPC_GuardFirstGUID = creature->GetGUID(); + break; + case NPC_KALIRA: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_KORELN); + if (!NPC_GuardSecondGUID) + NPC_GuardSecondGUID = creature->GetGUID(); + break; + case NPC_HORDE_SLAVE_1: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_ALLIANCE_SLAVE_1); + break; + case NPC_HORDE_SLAVE_2: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_ALLIANCE_SLAVE_2); + break; + case NPC_HORDE_SLAVE_3: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_ALLIANCE_SLAVE_3); + break; + case NPC_HORDE_SLAVE_4: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_ALLIANCE_SLAVE_4); + break; + case NPC_GORKUN_IRONSKULL_1: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_MARTIN_VICTUS_1); + break; + case NPC_GARFROST: + NPC_GarfrostGUID = creature->GetGUID(); + break; + case NPC_FREED_SLAVE_1_HORDE: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_FREED_SLAVE_1_ALLIANCE); + break; + case NPC_FREED_SLAVE_2_HORDE: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_FREED_SLAVE_2_ALLIANCE); + break; + case NPC_FREED_SLAVE_3_HORDE: + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_FREED_SLAVE_3_ALLIANCE); + break; + case NPC_GORKUN_IRONSKULL_2: + if (NPC_MartinOrGorkunGUID) + if (Creature* c = instance->GetCreature(NPC_MartinOrGorkunGUID)) + { + c->AI()->DoAction(1); // despawn summons + c->DespawnOrUnsummon(); + } + if (teamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_MARTIN_VICTUS_2); + NPC_MartinOrGorkunGUID = creature->GetGUID(); + break; + case NPC_RIMEFANG: + NPC_RimefangGUID = creature->GetGUID(); + if (m_auiEncounter[2] == DONE) + creature->SetVisible(false); + break; + case NPC_TYRANNUS: + if (NPC_TyrannusGUID) + if (Creature* c = instance->GetCreature(NPC_TyrannusGUID)) + c->DespawnOrUnsummon(); + NPC_TyrannusGUID = creature->GetGUID(); - if (m_auiEncounter[2] == DONE) - creature->SetVisible(false); - break; - case NPC_SINDRAGOSA: - NPC_SindragosaGUID = creature->GetGUID(); - break; - } - } + if (m_auiEncounter[2] == DONE) + creature->SetVisible(false); + break; + case NPC_SINDRAGOSA: + NPC_SindragosaGUID = creature->GetGUID(); + break; + } + } void OnGameObjectCreate(GameObject* go) { switch (go->GetEntry()) { - case GO_ICE_WALL: - GO_IceWallGUID = go->GetGUID(); - if (GetData(DATA_GARFROST) == DONE && GetData(DATA_ICK) == DONE) - go->SetGoState(GO_STATE_ACTIVE); - break; - } - } + case GO_ICE_WALL: + GO_IceWallGUID = go->GetGUID(); + if (GetData(DATA_GARFROST) == DONE && GetData(DATA_ICK) == DONE) + go->SetGoState(GO_STATE_ACTIVE); + break; + } + } - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_INSTANCE_PROGRESS: - if (InstanceProgress < data) - { - InstanceProgress = data; - if (InstanceProgress == INSTANCE_PROGRESS_TYRANNUS_INTRO && instance->GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC && bAchievDontLookUp) // achiev Don't Look Up (4525) - DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 72845); - } - break; - case DATA_GARFROST: - m_auiEncounter[0] = data; - if (data == DONE) - instance->SummonCreature(NPC_GORKUN_IRONSKULL_1, FBSSpawnPos); - else // NOT_STARTED, IN_PROGRESS - bAchievEleven = true; - if (data == DONE && GetData(DATA_ICK) == DONE) - if (GameObject* icewall = instance->GetGameObject(GO_IceWallGUID)) - icewall->SetGoState(GO_STATE_ACTIVE); - break; - case DATA_ICK: - m_auiEncounter[1] = data; - if (data == DONE && GetData(DATA_GARFROST) == DONE) - if (GameObject* icewall = instance->GetGameObject(GO_IceWallGUID)) - icewall->SetGoState(GO_STATE_ACTIVE); - break; - case DATA_TYRANNUS: - m_auiEncounter[2] = data; - if (data == DONE) - instance->SummonCreature(NPC_SYLVANAS_PART2, TSLeaderSpawnPos); - break; - case DATA_ACHIEV_ELEVEN: - bAchievEleven = false; - break; - case DATA_ACHIEV_DONT_LOOK_UP: - bAchievDontLookUp = false; - break; - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_INSTANCE_PROGRESS: + if (InstanceProgress < data) + { + InstanceProgress = data; + if (InstanceProgress == INSTANCE_PROGRESS_TYRANNUS_INTRO && instance->GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC && bAchievDontLookUp) // achiev Don't Look Up (4525) + DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 72845); + } + break; + case DATA_GARFROST: + m_auiEncounter[0] = data; + if (data == DONE) + instance->SummonCreature(NPC_GORKUN_IRONSKULL_1, FBSSpawnPos); + else // NOT_STARTED, IN_PROGRESS + bAchievEleven = true; + if (data == DONE && GetData(DATA_ICK) == DONE) + if (GameObject* icewall = instance->GetGameObject(GO_IceWallGUID)) + icewall->SetGoState(GO_STATE_ACTIVE); + break; + case DATA_ICK: + m_auiEncounter[1] = data; + if (data == DONE && GetData(DATA_GARFROST) == DONE) + if (GameObject* icewall = instance->GetGameObject(GO_IceWallGUID)) + icewall->SetGoState(GO_STATE_ACTIVE); + break; + case DATA_TYRANNUS: + m_auiEncounter[2] = data; + if (data == DONE) + instance->SummonCreature(NPC_SYLVANAS_PART2, TSLeaderSpawnPos); + break; + case DATA_ACHIEV_ELEVEN: + bAchievEleven = false; + break; + case DATA_ACHIEV_DONT_LOOK_UP: + bAchievDontLookUp = false; + break; + } - if (data == DONE || type == DATA_INSTANCE_PROGRESS) - SaveToDB(); - } + if (data == DONE || type == DATA_INSTANCE_PROGRESS) + SaveToDB(); + } - void SetData64(uint32 type, uint64 data) - { - switch(type) - { - case DATA_NECROLYTE_1_GUID: - NPC_Necrolyte1GUID = data; - break; - case DATA_NECROLYTE_2_GUID: - NPC_Necrolyte2GUID = data; - break; - case DATA_MARTIN_OR_GORKUN_GUID: - NPC_MartinOrGorkunGUID = data; - break; - } - } + void SetData64(uint32 type, uint64 data) + { + switch(type) + { + case DATA_NECROLYTE_1_GUID: + NPC_Necrolyte1GUID = data; + break; + case DATA_NECROLYTE_2_GUID: + NPC_Necrolyte2GUID = data; + break; + case DATA_MARTIN_OR_GORKUN_GUID: + NPC_MartinOrGorkunGUID = data; + break; + } + } - uint32 GetData(uint32 type) const - { - switch (type) - { - case DATA_INSTANCE_PROGRESS: - return InstanceProgress; - case DATA_TEAMID_IN_INSTANCE: - return teamIdInInstance; - case DATA_GARFROST: - return m_auiEncounter[0]; - case DATA_ICK: - return m_auiEncounter[1]; - case DATA_TYRANNUS: - return m_auiEncounter[2]; - } + uint32 GetData(uint32 type) const + { + switch (type) + { + case DATA_INSTANCE_PROGRESS: + return InstanceProgress; + case DATA_TEAMID_IN_INSTANCE: + return teamIdInInstance; + case DATA_GARFROST: + return m_auiEncounter[0]; + case DATA_ICK: + return m_auiEncounter[1]; + case DATA_TYRANNUS: + return m_auiEncounter[2]; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 type) const - { - switch (type) - { - case DATA_TYRANNUS_EVENT_GUID: - return NPC_TyrannusEventGUID; - case DATA_NECROLYTE_1_GUID: - return NPC_Necrolyte1GUID; - case DATA_NECROLYTE_2_GUID: - return NPC_Necrolyte2GUID; - case DATA_GUARD_1_GUID: - return NPC_GuardFirstGUID; - case DATA_GUARD_2_GUID: - return NPC_GuardSecondGUID; - case DATA_LEADER_FIRST_GUID: - return NPC_LeaderFirstGUID; - case DATA_GARFROST_GUID: - return NPC_GarfrostGUID; - case DATA_MARTIN_OR_GORKUN_GUID: - return NPC_MartinOrGorkunGUID; - case DATA_RIMEFANG_GUID: - return NPC_RimefangGUID; - case DATA_TYRANNUS_GUID: - return NPC_TyrannusGUID; - case DATA_LEADER_SECOND_GUID: - return NPC_LeaderSecondGUID; - case DATA_SINDRAGOSA_GUID: - return NPC_SindragosaGUID; - } + uint64 GetData64(uint32 type) const + { + switch (type) + { + case DATA_TYRANNUS_EVENT_GUID: + return NPC_TyrannusEventGUID; + case DATA_NECROLYTE_1_GUID: + return NPC_Necrolyte1GUID; + case DATA_NECROLYTE_2_GUID: + return NPC_Necrolyte2GUID; + case DATA_GUARD_1_GUID: + return NPC_GuardFirstGUID; + case DATA_GUARD_2_GUID: + return NPC_GuardSecondGUID; + case DATA_LEADER_FIRST_GUID: + return NPC_LeaderFirstGUID; + case DATA_GARFROST_GUID: + return NPC_GarfrostGUID; + case DATA_MARTIN_OR_GORKUN_GUID: + return NPC_MartinOrGorkunGUID; + case DATA_RIMEFANG_GUID: + return NPC_RimefangGUID; + case DATA_TYRANNUS_GUID: + return NPC_TyrannusGUID; + case DATA_LEADER_SECOND_GUID: + return NPC_LeaderSecondGUID; + case DATA_SINDRAGOSA_GUID: + return NPC_SindragosaGUID; + } - return 0; - } + return 0; + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case 12993: // Doesn't Go to Eleven (4524) - return bAchievEleven; - } - return false; - } + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case 12993: // Doesn't Go to Eleven (4524) + return bAchievEleven; + } + return false; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "P S " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << InstanceProgress; - str_data = saveStream.str(); + std::ostringstream saveStream; + saveStream << "P S " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << InstanceProgress; + str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint32 data0, data1, data2, data3; + char dataHead1, dataHead2; + uint32 data0, data1, data2, data3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - if (dataHead1 == 'P' && dataHead2 == 'S') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - InstanceProgress = data3; + if (dataHead1 == 'P' && dataHead2 == 'S') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + InstanceProgress = data3; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } - else OUT_LOAD_INST_DATA_FAIL; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } + else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } - }; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_pit_of_saron_InstanceScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_pit_of_saron_InstanceScript(map); + } }; void AddSC_instance_pit_of_saron() { - new instance_pit_of_saron(); + new instance_pit_of_saron(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index 7f33b4b31..867f51043 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -16,1342 +16,1342 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! class npc_pos_leader : public CreatureScript { public: - npc_pos_leader() : CreatureScript("npc_pos_leader") { } + npc_pos_leader() : CreatureScript("npc_pos_leader") { } - struct npc_pos_leaderAI: public NullCreatureAI - { - npc_pos_leaderAI(Creature* creature) : NullCreatureAI(creature), summons(me) - { - pInstance = me->GetInstanceScript(); - } + struct npc_pos_leaderAI: public NullCreatureAI + { + npc_pos_leaderAI(Creature* creature) : NullCreatureAI(creature), summons(me) + { + pInstance = me->GetInstanceScript(); + } - EventMap events; - SummonList summons; - InstanceScript* pInstance; - uint8 counter; + EventMap events; + SummonList summons; + InstanceScript* pInstance; + uint8 counter; - void Reset() - { - counter = 0; - events.Reset(); - summons.DespawnAll(); - me->SetVisible(true); + void Reset() + { + counter = 0; + events.Reset(); + summons.DespawnAll(); + me->SetVisible(true); - if (pInstance) - switch (pInstance->GetData(DATA_INSTANCE_PROGRESS)) - { - case INSTANCE_PROGRESS_NONE: - me->SetVisible(false); - break; - } - } + if (pInstance) + switch (pInstance->GetData(DATA_INSTANCE_PROGRESS)) + { + case INSTANCE_PROGRESS_NONE: + me->SetVisible(false); + break; + } + } - void SetData(uint32 type, uint32 val) - { - if (type == DATA_START_INTRO && pInstance->GetData(DATA_INSTANCE_PROGRESS) == INSTANCE_PROGRESS_NONE && counter == 0 && !me->IsVisible()) - { - me->setActive(true); - events.RescheduleEvent(1, 0); - } - } + void SetData(uint32 type, uint32 val) + { + if (type == DATA_START_INTRO && pInstance->GetData(DATA_INSTANCE_PROGRESS) == INSTANCE_PROGRESS_NONE && counter == 0 && !me->IsVisible()) + { + me->setActive(true); + events.RescheduleEvent(1, 0); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch(events.GetEvent()) - { - case 0: - break; - case 1: - { - if (counter == 0) - { - me->SetVisible(true); - me->GetMotionMaster()->MovePoint(1, LeaderIntroPos); - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch(events.GetEvent()) + { + case 0: + break; + case 1: + { + if (counter == 0) + { + me->SetVisible(true); + me->GetMotionMaster()->MovePoint(1, LeaderIntroPos); + } - uint8 idx = 0; - if (pInstance) - idx = (pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_ALLIANCE ? 0 : 1); - if (introPositions[counter].entry[idx] != 0) - { - if (Creature* summon = me->SummonCreature(introPositions[counter].entry[idx], PortalPos)) - { - summon->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - summon->SetSpeed(MOVE_RUN, 0.8f); - summon->GetMotionMaster()->MovePoint(1, introPositions[counter].endPosition); - summon->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); - } + uint8 idx = 0; + if (pInstance) + idx = (pInstance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_ALLIANCE ? 0 : 1); + if (introPositions[counter].entry[idx] != 0) + { + if (Creature* summon = me->SummonCreature(introPositions[counter].entry[idx], PortalPos)) + { + summon->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + summon->SetSpeed(MOVE_RUN, 0.8f); + summon->GetMotionMaster()->MovePoint(1, introPositions[counter].endPosition); + summon->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); + } - ++counter; - events.RepeatEvent(150); - } - else - { - events.PopEvent(); - events.RescheduleEvent(2, 2500); - } - } - break; - case 2: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - { - c->setActive(true); - c->AI()->Talk(SAY_TYRANNUS_INTRO_1); - } - events.PopEvent(); - events.RescheduleEvent(3, 7000); - break; - case 3: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - c->AI()->Talk(SAY_TYRANNUS_INTRO_2); - events.PopEvent(); - events.RescheduleEvent(4, 14000); - break; - case 4: - if (pInstance) - { - Creature* n1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NECROLYTE_1_GUID)); - Creature* n2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NECROLYTE_2_GUID)); - if (n1 && n2) - { - if (!n1->IsInCombat() && n1->IsAlive()) - { - n1->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - n1->GetMotionMaster()->MovePoint(1, NecrolytePos1); - n1->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); - } - if (!n2->IsInCombat() && n2->IsAlive()) - { - n2->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - n2->GetMotionMaster()->MovePoint(1, NecrolytePos2); - n2->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); - } - if (SPELL_NECROLYTE_CHANNELING) - { - n1->RemoveAura(SPELL_NECROLYTE_CHANNELING); - n2->RemoveAura(SPELL_NECROLYTE_CHANNELING); - } + ++counter; + events.RepeatEvent(150); + } + else + { + events.PopEvent(); + events.RescheduleEvent(2, 2500); + } + } + break; + case 2: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + { + c->setActive(true); + c->AI()->Talk(SAY_TYRANNUS_INTRO_1); + } + events.PopEvent(); + events.RescheduleEvent(3, 7000); + break; + case 3: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + c->AI()->Talk(SAY_TYRANNUS_INTRO_2); + events.PopEvent(); + events.RescheduleEvent(4, 14000); + break; + case 4: + if (pInstance) + { + Creature* n1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NECROLYTE_1_GUID)); + Creature* n2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NECROLYTE_2_GUID)); + if (n1 && n2) + { + if (!n1->IsInCombat() && n1->IsAlive()) + { + n1->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + n1->GetMotionMaster()->MovePoint(1, NecrolytePos1); + n1->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); + } + if (!n2->IsInCombat() && n2->IsAlive()) + { + n2->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + n2->GetMotionMaster()->MovePoint(1, NecrolytePos2); + n2->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); + } + if (SPELL_NECROLYTE_CHANNELING) + { + n1->RemoveAura(SPELL_NECROLYTE_CHANNELING); + n2->RemoveAura(SPELL_NECROLYTE_CHANNELING); + } - for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - { - if (c->GetPositionX() < 440.0f) - continue; - if (c->GetPositionY() > 215.0f) - c->GetMotionMaster()->MoveChase(n2, 0.0f, rand_norm()*2*M_PI); - else - c->GetMotionMaster()->MoveChase(n1, 0.0f, rand_norm()*2*M_PI); - } - } - } - events.PopEvent(); - events.RescheduleEvent(5, 1); - break; - case 5: - Talk(me->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_INTRO_1 : SAY_SYLVANAS_INTRO_1); - events.PopEvent(); - events.RescheduleEvent(6, 1000); - break; - case 6: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - c->AI()->Talk(SAY_TYRANNUS_INTRO_3); - events.PopEvent(); - events.RescheduleEvent(7, 5000); - break; - case 7: - if (pInstance) - { - if (Creature* n1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NECROLYTE_1_GUID))) - n1->AI()->DoAction(1337); // remove invincibility - if (Creature* n2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NECROLYTE_2_GUID))) - n2->AI()->DoAction(1337); // remove invincibility + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + { + if (c->GetPositionX() < 440.0f) + continue; + if (c->GetPositionY() > 215.0f) + c->GetMotionMaster()->MoveChase(n2, 0.0f, rand_norm()*2*M_PI); + else + c->GetMotionMaster()->MoveChase(n1, 0.0f, rand_norm()*2*M_PI); + } + } + } + events.PopEvent(); + events.RescheduleEvent(5, 1); + break; + case 5: + Talk(me->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_INTRO_1 : SAY_SYLVANAS_INTRO_1); + events.PopEvent(); + events.RescheduleEvent(6, 1000); + break; + case 6: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + c->AI()->Talk(SAY_TYRANNUS_INTRO_3); + events.PopEvent(); + events.RescheduleEvent(7, 5000); + break; + case 7: + if (pInstance) + { + if (Creature* n1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NECROLYTE_1_GUID))) + n1->AI()->DoAction(1337); // remove invincibility + if (Creature* n2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NECROLYTE_2_GUID))) + n2->AI()->DoAction(1337); // remove invincibility - for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - { - if (c->GetPositionX() < 450.0f) - continue; - c->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - c->GetMotionMaster()->Clear(false); - c->GetMotionMaster()->MoveIdle(); - c->StopMoving(); - c->CastSpell(c, 69413, true); - c->SetCanFly(true); - c->SetDisableGravity(true); - c->SetHover(true); - c->SendMovementFlagUpdate(); - float dist = rand_norm()*2.0f; - float angle = rand_norm()*2*M_PI; - c->GetMotionMaster()->MoveTakeoff(0, c->GetPositionX()+dist*cos(angle), c->GetPositionY()+dist*sin(angle), c->GetPositionZ()+6.0f+(float)urand(0,4), 1.5f+frand(0.0f, 1.5f)); - } - } - events.PopEvent(); - events.RescheduleEvent(8, 7000); - break; - case 8: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - c->CastSpell(c, 69753, false); - events.PopEvent(); - events.RescheduleEvent(9, 400); - break; - case 9: - if (pInstance) - for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - { - if (c->GetPositionX() < 450.0f) - continue; - Unit::Kill(c, c); - c->RemoveAllAuras(); - c->GetMotionMaster()->MoveFall(0, true); - } - events.PopEvent(); - events.RescheduleEvent(10, 1000); - break; - case 10: - Talk(me->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_INTRO_2 : SAY_SYLVANAS_INTRO_2); - events.PopEvent(); - events.RescheduleEvent(11, 1000); - break; - case 11: - if (pInstance) - for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - { - if (c->GetPositionX() < 450.0f) - continue; - c->SetCanFly(false); - c->SetDisableGravity(false); - c->SetHover(false); - c->SendMovementFlagUpdate(); - c->CastSpell(c, 69350, true); - } - events.PopEvent(); - events.RescheduleEvent(12, 2000); - break; - case 12: - if (pInstance) - { - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - c->AI()->Talk(SAY_TYRANNUS_INTRO_4); + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + { + if (c->GetPositionX() < 450.0f) + continue; + c->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + c->GetMotionMaster()->Clear(false); + c->GetMotionMaster()->MoveIdle(); + c->StopMoving(); + c->CastSpell(c, 69413, true); + c->SetCanFly(true); + c->SetDisableGravity(true); + c->SetHover(true); + c->SendMovementFlagUpdate(); + float dist = rand_norm()*2.0f; + float angle = rand_norm()*2*M_PI; + c->GetMotionMaster()->MoveTakeoff(0, c->GetPositionX()+dist*cos(angle), c->GetPositionY()+dist*sin(angle), c->GetPositionZ()+6.0f+(float)urand(0,4), 1.5f+frand(0.0f, 1.5f)); + } + } + events.PopEvent(); + events.RescheduleEvent(8, 7000); + break; + case 8: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + c->CastSpell(c, 69753, false); + events.PopEvent(); + events.RescheduleEvent(9, 400); + break; + case 9: + if (pInstance) + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + { + if (c->GetPositionX() < 450.0f) + continue; + Unit::Kill(c, c); + c->RemoveAllAuras(); + c->GetMotionMaster()->MoveFall(0, true); + } + events.PopEvent(); + events.RescheduleEvent(10, 1000); + break; + case 10: + Talk(me->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_INTRO_2 : SAY_SYLVANAS_INTRO_2); + events.PopEvent(); + events.RescheduleEvent(11, 1000); + break; + case 11: + if (pInstance) + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + { + if (c->GetPositionX() < 450.0f) + continue; + c->SetCanFly(false); + c->SetDisableGravity(false); + c->SetHover(false); + c->SendMovementFlagUpdate(); + c->CastSpell(c, 69350, true); + } + events.PopEvent(); + events.RescheduleEvent(12, 2000); + break; + case 12: + if (pInstance) + { + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + c->AI()->Talk(SAY_TYRANNUS_INTRO_4); - for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - { - if (c->GetPositionX() < 450.0f) - continue; - c->SetHomePosition(c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), c->GetOrientation()); - c->Respawn(true); - c->UpdateEntry(36796, 0, false); - c->SetFacingTo(M_PI); - c->SetReactState(REACT_PASSIVE); - } - } - events.PopEvent(); - events.RescheduleEvent(13, 3000); - break; - case 13: - if (pInstance) - { - for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - { - if (c->GetPositionX() < 450.0f) - continue; - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - float dist = rand_norm(); - float angle = rand_norm()*2*M_PI; - c->SetSpeed(MOVE_RUN, 0.8f); - c->SetInCombatWithZone(); - c->GetMotionMaster()->MoveChase(me, dist, angle); - c->SetHomePosition(me->GetPositionX()+dist*cos(angle), me->GetPositionY()+dist*sin(angle), me->GetPositionZ(), 0.0f); - } - } - events.PopEvent(); - events.RescheduleEvent(14, 2000); - break; - case 14: - if (pInstance) - { - if (me->GetEntry() == NPC_JAINA_PART1) - { - Talk(SAY_JAINA_INTRO_3); - me->CastSpell(me, 70132, false); - } - else - { - me->CastSpell(me, 59514, false); - for (uint8 i=0; i<2; ++i) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GUARD_1_GUID+i))) - c->CastSpell(c, 70513, false); - } - } - events.PopEvent(); - events.RescheduleEvent(15, 2000); - break; - case 15: - if (pInstance) - { - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) - c->GetMotionMaster()->MovePoint(0, SBSTyrannusStartPos); + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + { + if (c->GetPositionX() < 450.0f) + continue; + c->SetHomePosition(c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), c->GetOrientation()); + c->Respawn(true); + c->UpdateEntry(36796, 0, false); + c->SetFacingTo(M_PI); + c->SetReactState(REACT_PASSIVE); + } + } + events.PopEvent(); + events.RescheduleEvent(13, 3000); + break; + case 13: + if (pInstance) + { + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + { + if (c->GetPositionX() < 450.0f) + continue; + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + float dist = rand_norm(); + float angle = rand_norm()*2*M_PI; + c->SetSpeed(MOVE_RUN, 0.8f); + c->SetInCombatWithZone(); + c->GetMotionMaster()->MoveChase(me, dist, angle); + c->SetHomePosition(me->GetPositionX()+dist*cos(angle), me->GetPositionY()+dist*sin(angle), me->GetPositionZ(), 0.0f); + } + } + events.PopEvent(); + events.RescheduleEvent(14, 2000); + break; + case 14: + if (pInstance) + { + if (me->GetEntry() == NPC_JAINA_PART1) + { + Talk(SAY_JAINA_INTRO_3); + me->CastSpell(me, 70132, false); + } + else + { + me->CastSpell(me, 59514, false); + for (uint8 i=0; i<2; ++i) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GUARD_1_GUID+i))) + c->CastSpell(c, 70513, false); + } + } + events.PopEvent(); + events.RescheduleEvent(15, 2000); + break; + case 15: + if (pInstance) + { + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_EVENT_GUID))) + c->GetMotionMaster()->MovePoint(0, SBSTyrannusStartPos); - if (me->GetEntry() == NPC_JAINA_PART1) - { - for (uint8 i=0; i<2; ++i) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GUARD_1_GUID+i))) - c->CastSpell(c, 70464, false); - } - } - events.PopEvent(); - events.RescheduleEvent(16, 3000); - break; - case 16: - Talk(me->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_INTRO_4 : SAY_SYLVANAS_INTRO_3); - if (pInstance) - { - for (uint8 i=0; i<2; ++i) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GUARD_1_GUID+i))) - c->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + if (me->GetEntry() == NPC_JAINA_PART1) + { + for (uint8 i=0; i<2; ++i) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GUARD_1_GUID+i))) + c->CastSpell(c, 70464, false); + } + } + events.PopEvent(); + events.RescheduleEvent(16, 3000); + break; + case 16: + Talk(me->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_INTRO_4 : SAY_SYLVANAS_INTRO_3); + if (pInstance) + { + for (uint8 i=0; i<2; ++i) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GUARD_1_GUID+i))) + c->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - { - if (c->IsAlive()) - { - if (c->GetEntry() == NPC_KALIRA || c->GetEntry() == NPC_ELANDRA || c->GetEntry() == NPC_LORALEN || c->GetEntry() == NPC_KORELN) - continue; + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + { + if (c->IsAlive()) + { + if (c->GetEntry() == NPC_KALIRA || c->GetEntry() == NPC_ELANDRA || c->GetEntry() == NPC_LORALEN || c->GetEntry() == NPC_KORELN) + continue; - Unit::Kill(c, c, false); - } - c->DespawnOrUnsummon(10000); - } - pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_FINISHED_INTRO); - } - events.PopEvent(); - events.RescheduleEvent(17, 5000); - break; - case 17: - me->setActive(false); - Talk(me->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_INTRO_5 : SAY_SYLVANAS_INTRO_4); - events.PopEvent(); - break; - } + Unit::Kill(c, c, false); + } + c->DespawnOrUnsummon(10000); + } + pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_FINISHED_INTRO); + } + events.PopEvent(); + events.RescheduleEvent(17, 5000); + break; + case 17: + me->setActive(false); + Talk(me->GetEntry() == NPC_JAINA_PART1 ? SAY_JAINA_INTRO_5 : SAY_SYLVANAS_INTRO_4); + events.PopEvent(); + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustSummoned(Creature* s) - { - summons.Summon(s); - } + void JustSummoned(Creature* s) + { + summons.Summon(s); + } - void SummonedCreatureDespawn(Creature *s) - { - summons.Despawn(s); - } + void SummonedCreatureDespawn(Creature *s) + { + summons.Despawn(s); + } - void AttackStart(Unit* who) {} - void MoveInLineOfSight(Unit* who) {} - }; + void AttackStart(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_pos_leaderAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_pos_leaderAI(creature); + } }; class npc_pos_deathwhisper_necrolyte : public CreatureScript { public: - npc_pos_deathwhisper_necrolyte() : CreatureScript("npc_pos_deathwhisper_necrolyte") { } + npc_pos_deathwhisper_necrolyte() : CreatureScript("npc_pos_deathwhisper_necrolyte") { } - struct npc_pos_deathwhisper_necrolyteAI: public ScriptedAI - { - npc_pos_deathwhisper_necrolyteAI(Creature* creature) : ScriptedAI(creature) - { - pInstance = me->GetInstanceScript(); - isInvincible = false; - } + struct npc_pos_deathwhisper_necrolyteAI: public ScriptedAI + { + npc_pos_deathwhisper_necrolyteAI(Creature* creature) : ScriptedAI(creature) + { + pInstance = me->GetInstanceScript(); + isInvincible = false; + } - EventMap events; - InstanceScript* pInstance; - bool isInvincible; + EventMap events; + InstanceScript* pInstance; + bool isInvincible; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void InitializeAI() - { - if (pInstance && pInstance->GetData(DATA_INSTANCE_PROGRESS) == INSTANCE_PROGRESS_NONE) - { - if (me->GetPositionX() > 490.0f && me->GetPositionX() < 504.0f && me->GetPositionY() > 192.0f && me->GetPositionY() < 206.0f || - me->GetPositionX() > 490.0f && me->GetPositionX() < 504.0f && me->GetPositionY() > 240.0f && me->GetPositionY() < 254.0f) - { - isInvincible = true; - if (SPELL_NECROLYTE_CHANNELING) - me->CastSpell(me, SPELL_NECROLYTE_CHANNELING, false); + void InitializeAI() + { + if (pInstance && pInstance->GetData(DATA_INSTANCE_PROGRESS) == INSTANCE_PROGRESS_NONE) + { + if (me->GetPositionX() > 490.0f && me->GetPositionX() < 504.0f && me->GetPositionY() > 192.0f && me->GetPositionY() < 206.0f || + me->GetPositionX() > 490.0f && me->GetPositionX() < 504.0f && me->GetPositionY() > 240.0f && me->GetPositionY() < 254.0f) + { + isInvincible = true; + if (SPELL_NECROLYTE_CHANNELING) + me->CastSpell(me, SPELL_NECROLYTE_CHANNELING, false); - if (me->GetPositionY() < 206.0f) - pInstance->SetData64(DATA_NECROLYTE_1_GUID, me->GetGUID()); - else - pInstance->SetData64(DATA_NECROLYTE_2_GUID, me->GetGUID()); - } - } - } + if (me->GetPositionY() < 206.0f) + pInstance->SetData64(DATA_NECROLYTE_1_GUID, me->GetGUID()); + else + pInstance->SetData64(DATA_NECROLYTE_2_GUID, me->GetGUID()); + } + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == 1) - me->SetFacingTo(M_PI); - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == 1) + me->SetFacingTo(M_PI); + } - void EnterCombat(Unit* /*who*/) - { - if (SPELL_NECROLYTE_CHANNELING) - me->RemoveAura(SPELL_NECROLYTE_CHANNELING); - events.Reset(); - events.RescheduleEvent(1, 0); - events.RescheduleEvent(2, urand(5000,9000)); + void EnterCombat(Unit* /*who*/) + { + if (SPELL_NECROLYTE_CHANNELING) + me->RemoveAura(SPELL_NECROLYTE_CHANNELING); + events.Reset(); + events.RescheduleEvent(1, 0); + events.RescheduleEvent(2, urand(5000,9000)); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) - c->AI()->SetData(DATA_START_INTRO, 0); - } + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_FIRST_GUID))) + c->AI()->SetData(DATA_START_INTRO, 0); + } - void DamageTaken(Unit* /*doneBy*/, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (isInvincible && damage >= me->GetHealth()) - damage = me->GetHealth()-1; - } + void DamageTaken(Unit* /*doneBy*/, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (isInvincible && damage >= me->GetHealth()) + damage = me->GetHealth()-1; + } - void DoAction(int32 a) - { - if (a == 1337) - isInvincible = false; - } + void DoAction(int32 a) + { + if (a == 1337) + isInvincible = false; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case 1: // Shadow Bolt - me->CastSpell(me->GetVictim(), 69577, false); - events.RepeatEvent(4000); - break; - case 2: // Conversion Beam - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) - me->CastSpell(target, 69578, false); - events.RepeatEvent(urand(20000,25000)); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case 1: // Shadow Bolt + me->CastSpell(me->GetVictim(), 69577, false); + events.RepeatEvent(4000); + break; + case 2: // Conversion Beam + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + me->CastSpell(target, 69578, false); + events.RepeatEvent(urand(20000,25000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void MoveInLineOfSight(Unit* who) {} - }; + void MoveInLineOfSight(Unit* who) {} + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_pos_deathwhisper_necrolyteAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_pos_deathwhisper_necrolyteAI(creature); + } }; class npc_pos_after_first_boss : public CreatureScript { public: - npc_pos_after_first_boss() : CreatureScript("npc_pos_after_first_boss") { } + npc_pos_after_first_boss() : CreatureScript("npc_pos_after_first_boss") { } - struct npc_pos_after_first_bossAI: public NullCreatureAI - { - npc_pos_after_first_bossAI(Creature* creature) : NullCreatureAI(creature) - { - pInstance = me->GetInstanceScript(); - me->GetMotionMaster()->MovePoint(1, 695.03f, -149.86f, 527.89f); - } + struct npc_pos_after_first_bossAI: public NullCreatureAI + { + npc_pos_after_first_bossAI(Creature* creature) : NullCreatureAI(creature) + { + pInstance = me->GetInstanceScript(); + me->GetMotionMaster()->MovePoint(1, 695.03f, -149.86f, 527.89f); + } - EventMap events; - InstanceScript* pInstance; + EventMap events; + InstanceScript* pInstance; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - switch(id) - { - case 1: - events.RescheduleEvent(id, 0); - break; - } - } + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + switch(id) + { + case 1: + events.RescheduleEvent(id, 0); + break; + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch(events.GetEvent()) - { - case 0: - break; - case 1: - { - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GARFROST_GUID))) - { - float angle = c->GetAngle(me); - float x = c->GetPositionX()+cos(angle)*12.0f; - float y = c->GetPositionY()+sin(angle)*12.0f; - me->GetMotionMaster()->MovePoint(2, x, y, c->GetPositionZ()); - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch(events.GetEvent()) + { + case 0: + break; + case 1: + { + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_GARFROST_GUID))) + { + float angle = c->GetAngle(me); + float x = c->GetPositionX()+cos(angle)*12.0f; + float y = c->GetPositionY()+sin(angle)*12.0f; + me->GetMotionMaster()->MovePoint(2, x, y, c->GetPositionZ()); + } - uint8 i=0; - while (FBSData[i].entry) - { - if (Creature* c = me->SummonCreature(FBSData[i].entry, 688.69f+i*1.8f, FBSSpawnPos.GetPositionY()+(float)irand(-2,2), FBSSpawnPos.GetPositionZ(), 3*M_PI/2)) - c->GetMotionMaster()->MovePath(FBSData[i].pathId, false); - ++i; - } - events.PopEvent(); - events.RescheduleEvent(2, 3000); - break; - } - case 2: - if (Creature* c = me->SummonCreature(NPC_TYRANNUS_VOICE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()-10.0f, me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 1)) - c->AI()->Talk(SAY_TYRANNUS_GARFROST); - events.PopEvent(); - events.RescheduleEvent(3, 4000); - break; - case 3: - Talk(SAY_GENERAL_GARFROST); - events.PopEvent(); - break; - } - } - }; + uint8 i=0; + while (FBSData[i].entry) + { + if (Creature* c = me->SummonCreature(FBSData[i].entry, 688.69f+i*1.8f, FBSSpawnPos.GetPositionY()+(float)irand(-2,2), FBSSpawnPos.GetPositionZ(), 3*M_PI/2)) + c->GetMotionMaster()->MovePath(FBSData[i].pathId, false); + ++i; + } + events.PopEvent(); + events.RescheduleEvent(2, 3000); + break; + } + case 2: + if (Creature* c = me->SummonCreature(NPC_TYRANNUS_VOICE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()-10.0f, me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 1)) + c->AI()->Talk(SAY_TYRANNUS_GARFROST); + events.PopEvent(); + events.RescheduleEvent(3, 4000); + break; + case 3: + Talk(SAY_GENERAL_GARFROST); + events.PopEvent(); + break; + } + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_pos_after_first_bossAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_pos_after_first_bossAI(creature); + } }; class npc_pos_tyrannus_events : public CreatureScript { public: - npc_pos_tyrannus_events() : CreatureScript("npc_pos_tyrannus_events") { } + npc_pos_tyrannus_events() : CreatureScript("npc_pos_tyrannus_events") { } - struct npc_pos_tyrannus_eventsAI: public NullCreatureAI - { - npc_pos_tyrannus_eventsAI(Creature* creature) : NullCreatureAI(creature) - { - pInstance = me->GetInstanceScript(); - killsLeft = 0; - deathbringerGUID[0] = 0; - deathbringerGUID[1] = 0; - } + struct npc_pos_tyrannus_eventsAI: public NullCreatureAI + { + npc_pos_tyrannus_eventsAI(Creature* creature) : NullCreatureAI(creature) + { + pInstance = me->GetInstanceScript(); + killsLeft = 0; + deathbringerGUID[0] = 0; + deathbringerGUID[1] = 0; + } - InstanceScript* pInstance; - EventMap events; - uint32 killsLeft; - uint64 deathbringerGUID[2]; + InstanceScript* pInstance; + EventMap events; + uint32 killsLeft; + uint64 deathbringerGUID[2]; - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE) - { - switch (id) - { - case 0: - me->setActive(false); - break; - case 1: - events.ScheduleEvent(1, 0); - break; - case 2: - events.ScheduleEvent(2, 0); - break; - case 3: - events.ScheduleEvent(4, 0); - break; - } - } - else if (type == EFFECT_MOTION_TYPE && id == 10) - events.ScheduleEvent(6, 0); - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE) + { + switch (id) + { + case 0: + me->setActive(false); + break; + case 1: + events.ScheduleEvent(1, 0); + break; + case 2: + events.ScheduleEvent(2, 0); + break; + case 3: + events.ScheduleEvent(4, 0); + break; + } + } + else if (type == EFFECT_MOTION_TYPE && id == 10) + events.ScheduleEvent(6, 0); + } - void SetData(uint32 type, uint32 id) - { - if (!me->IsAlive() || pInstance->GetData(DATA_GARFROST) != DONE || pInstance->GetData(DATA_ICK) != DONE) - return; - if (type == 2) - { - if (id == 1) - if (killsLeft) --killsLeft; - return; - } - if (type != 1) - return; - switch (id) - { - case 1: - if (pInstance->GetData(DATA_INSTANCE_PROGRESS) != INSTANCE_PROGRESS_FINISHED_KRICK_SCENE) - return; - if (me->GetExactDist(&PTSTyrannusWaitPos1) > 3.0f) - return; - pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_AFTER_WARN_1); - Talk(SAY_TYRANNUS_AMBUSH_1); - killsLeft = 10; - events.ScheduleEvent(30, 0); - events.ScheduleEvent(3, 25000); - break; - case 2: - if (pInstance->GetData(DATA_INSTANCE_PROGRESS) != INSTANCE_PROGRESS_AFTER_WARN_1) - return; - if (killsLeft != 0) - return; - pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_AFTER_WARN_2); - Talk(SAY_TYRANNUS_AMBUSH_2); - killsLeft = (Difficulty(me->GetMap()->GetSpawnMode()) == DUNGEON_DIFFICULTY_HEROIC ? 12 : 6); - events.ScheduleEvent(60, 0); - events.ScheduleEvent(5, 20000); - break; - break; - case 3: - if (pInstance->GetData(DATA_INSTANCE_PROGRESS) != INSTANCE_PROGRESS_AFTER_WARN_2) - return; - if (killsLeft != 0) - return; - pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_AFTER_TUNNEL_WARN); - if (Creature* c = me->SummonCreature(NPC_TYRANNUS_VOICE, 950.16f, -102.17f, 594.90f-10.0f, 5.43f, TEMPSUMMON_TIMED_DESPAWN, 1)) - c->AI()->Talk(SAY_TYRANNUS_TRAP_TUNNEL); - break; - } - } + void SetData(uint32 type, uint32 id) + { + if (!me->IsAlive() || pInstance->GetData(DATA_GARFROST) != DONE || pInstance->GetData(DATA_ICK) != DONE) + return; + if (type == 2) + { + if (id == 1) + if (killsLeft) --killsLeft; + return; + } + if (type != 1) + return; + switch (id) + { + case 1: + if (pInstance->GetData(DATA_INSTANCE_PROGRESS) != INSTANCE_PROGRESS_FINISHED_KRICK_SCENE) + return; + if (me->GetExactDist(&PTSTyrannusWaitPos1) > 3.0f) + return; + pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_AFTER_WARN_1); + Talk(SAY_TYRANNUS_AMBUSH_1); + killsLeft = 10; + events.ScheduleEvent(30, 0); + events.ScheduleEvent(3, 25000); + break; + case 2: + if (pInstance->GetData(DATA_INSTANCE_PROGRESS) != INSTANCE_PROGRESS_AFTER_WARN_1) + return; + if (killsLeft != 0) + return; + pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_AFTER_WARN_2); + Talk(SAY_TYRANNUS_AMBUSH_2); + killsLeft = (Difficulty(me->GetMap()->GetSpawnMode()) == DUNGEON_DIFFICULTY_HEROIC ? 12 : 6); + events.ScheduleEvent(60, 0); + events.ScheduleEvent(5, 20000); + break; + break; + case 3: + if (pInstance->GetData(DATA_INSTANCE_PROGRESS) != INSTANCE_PROGRESS_AFTER_WARN_2) + return; + if (killsLeft != 0) + return; + pInstance->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_AFTER_TUNNEL_WARN); + if (Creature* c = me->SummonCreature(NPC_TYRANNUS_VOICE, 950.16f, -102.17f, 594.90f-10.0f, 5.43f, TEMPSUMMON_TIMED_DESPAWN, 1)) + c->AI()->Talk(SAY_TYRANNUS_TRAP_TUNNEL); + break; + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case 1: - me->GetMotionMaster()->MovePoint(2, PTSTyrannusWaitPos1, false); - break; - case 2: - me->SetFacingTo(PTSTyrannusWaitPos1.GetOrientation()); - me->setActive(false); - break; - case 3: - me->GetMotionMaster()->MovePoint(3, PTSTyrannusWaitPos2, false); - break; - case 4: - me->SetFacingTo(PTSTyrannusWaitPos2.GetOrientation()); - break; - case 5: - me->GetMotionMaster()->MoveTakeoff(10, me->GetPositionX()+2.0f*cos(me->GetOrientation()), me->GetPositionY()+2.0f*sin(me->GetOrientation()), me->GetPositionZ()+30.0f, 7.0f); - break; - case 6: - me->GetMotionMaster()->MovePoint(4, PTSTyrannusWaitPos3, false); - break; - case 30: - { - Movement::PointsArray path; - path.push_back(G3D::Vector3(950.61f, 50.91f, 567.85f)); - path.push_back(G3D::Vector3(946.48f, 73.25f, 565.89f)); - path.push_back(G3D::Vector3(934.87f, 78.56f, 563.97f)); - path.push_back(G3D::Vector3(915.10f, 75.31f, 553.81f)); - if (Creature* c = me->SummonCreature(NPC_YMIRJAR_DEATHBRINGER, 950.61f, 50.91f, 567.85f, 1.82f)) - { - deathbringerGUID[0] = c->GetGUID(); - c->SetReactState(REACT_PASSIVE); - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - c->SetHomePosition(915.10f, 75.31f, 553.81f, 3.75f); - c->SetWalk(false); - c->GetMotionMaster()->MoveSplinePath(&path); - } - if (Creature* c = me->SummonCreature(NPC_YMIRJAR_DEATHBRINGER, 949.05f, 61.18f, 566.60f, 1.73f)) - { - deathbringerGUID[1] = c->GetGUID(); - c->SetReactState(REACT_PASSIVE); - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - c->SetHomePosition(883.15f, 54.6254f, 528.5f, 3.75f); - c->SetWalk(false); - path.push_back(G3D::Vector3(883.15f, 54.6254f, 528.5f)); - c->GetMotionMaster()->MoveSplinePath(&path); - } - events.ScheduleEvent(31, 500); - events.ScheduleEvent(32, 500); - } - break; - case 31: - if (Creature* c = pInstance->instance->GetCreature(deathbringerGUID[0])) - if (c->GetMotionMaster()->GetCurrentMovementGeneratorType() != ESCORT_MOTION_TYPE) - { - c->CastSpell(c, 69516, false); - events.ScheduleEvent(33, 3000); - break; - } - events.ScheduleEvent(31, 500); - break; - case 32: - if (Creature* c = pInstance->instance->GetCreature(deathbringerGUID[1])) - if (c->GetMotionMaster()->GetCurrentMovementGeneratorType() != ESCORT_MOTION_TYPE) - { - c->CastSpell(c, 69516, false); - events.ScheduleEvent(34, 3000); - break; - } - events.ScheduleEvent(32, 500); - break; - case 33: - me->SummonCreature(NPC_YMIRJAR_WRATHBRINGER, 919.733f, 89.0972f, 558.959f, 3.85718f); - me->SummonCreature(NPC_YMIRJAR_WRATHBRINGER, 911.936f, 63.3542f, 547.698f, 3.735f); - me->SummonCreature(NPC_YMIRJAR_FLAMEBEARER, 909.356f, 83.1684f, 551.717f, 3.57792f); - me->SummonCreature(NPC_YMIRJAR_FLAMEBEARER, 920.946f, 69.1667f, 557.594f, 3.1765f); - events.ScheduleEvent(35, 3500); - break; - case 34: - me->SummonCreature(NPC_YMIRJAR_WRATHBRINGER, 879.464f, 41.1997f, 521.394f, 3.735f); - me->SummonCreature(NPC_YMIRJAR_WRATHBRINGER, 885.715f, 65.5156f, 533.631f, 3.85718f); - me->SummonCreature(NPC_YMIRJAR_FLAMEBEARER, 876.884f, 61.0139f, 527.715f, 3.57792f); - me->SummonCreature(NPC_YMIRJAR_FLAMEBEARER, 889.49f, 45.2865f, 527.233f, 3.97935f); - events.ScheduleEvent(36, 3500); - break; - case 35: - if (Creature* c = pInstance->instance->GetCreature(deathbringerGUID[0])) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - break; - case 36: - if (Creature* c = pInstance->instance->GetCreature(deathbringerGUID[1])) - { - c->SetReactState(REACT_AGGRESSIVE); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - break; - case 60: - { - Position startPos[6] = { {927.11f, -72.60f, 592.2f, 1.52f},{922.92f, -72.64f, 592.3f, 1.52f},{930.46f, -72.57f, 592.1f, 1.52f},{934.52f, -72.52f, 592.1f, 1.52f},{934.57f, -77.66f, 592.20f, 1.52f},{927.15f, -77.07f, 592.20f, 1.52f} }; - Position endPos = {926.10f, -46.63f, 591.2f, 1.52f}; - for (uint8 i=0; i<6; ++i) - if (Creature* s = me->SummonCreature(i < 4 ? NPC_FALLEN_WARRIOR : NPC_WRATHBONE_COLDWRAITH, startPos[i])) - { - s->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - Position finalPos = endPos; - s->MovePosition(finalPos, startPos[i].GetExactDist(&startPos[0]), Position::NormalizeOrientation(startPos[i].GetAngle(&startPos[0])+1.52f)); + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.ExecuteEvent()) + { + case 1: + me->GetMotionMaster()->MovePoint(2, PTSTyrannusWaitPos1, false); + break; + case 2: + me->SetFacingTo(PTSTyrannusWaitPos1.GetOrientation()); + me->setActive(false); + break; + case 3: + me->GetMotionMaster()->MovePoint(3, PTSTyrannusWaitPos2, false); + break; + case 4: + me->SetFacingTo(PTSTyrannusWaitPos2.GetOrientation()); + break; + case 5: + me->GetMotionMaster()->MoveTakeoff(10, me->GetPositionX()+2.0f*cos(me->GetOrientation()), me->GetPositionY()+2.0f*sin(me->GetOrientation()), me->GetPositionZ()+30.0f, 7.0f); + break; + case 6: + me->GetMotionMaster()->MovePoint(4, PTSTyrannusWaitPos3, false); + break; + case 30: + { + Movement::PointsArray path; + path.push_back(G3D::Vector3(950.61f, 50.91f, 567.85f)); + path.push_back(G3D::Vector3(946.48f, 73.25f, 565.89f)); + path.push_back(G3D::Vector3(934.87f, 78.56f, 563.97f)); + path.push_back(G3D::Vector3(915.10f, 75.31f, 553.81f)); + if (Creature* c = me->SummonCreature(NPC_YMIRJAR_DEATHBRINGER, 950.61f, 50.91f, 567.85f, 1.82f)) + { + deathbringerGUID[0] = c->GetGUID(); + c->SetReactState(REACT_PASSIVE); + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + c->SetHomePosition(915.10f, 75.31f, 553.81f, 3.75f); + c->SetWalk(false); + c->GetMotionMaster()->MoveSplinePath(&path); + } + if (Creature* c = me->SummonCreature(NPC_YMIRJAR_DEATHBRINGER, 949.05f, 61.18f, 566.60f, 1.73f)) + { + deathbringerGUID[1] = c->GetGUID(); + c->SetReactState(REACT_PASSIVE); + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + c->SetHomePosition(883.15f, 54.6254f, 528.5f, 3.75f); + c->SetWalk(false); + path.push_back(G3D::Vector3(883.15f, 54.6254f, 528.5f)); + c->GetMotionMaster()->MoveSplinePath(&path); + } + events.ScheduleEvent(31, 500); + events.ScheduleEvent(32, 500); + } + break; + case 31: + if (Creature* c = pInstance->instance->GetCreature(deathbringerGUID[0])) + if (c->GetMotionMaster()->GetCurrentMovementGeneratorType() != ESCORT_MOTION_TYPE) + { + c->CastSpell(c, 69516, false); + events.ScheduleEvent(33, 3000); + break; + } + events.ScheduleEvent(31, 500); + break; + case 32: + if (Creature* c = pInstance->instance->GetCreature(deathbringerGUID[1])) + if (c->GetMotionMaster()->GetCurrentMovementGeneratorType() != ESCORT_MOTION_TYPE) + { + c->CastSpell(c, 69516, false); + events.ScheduleEvent(34, 3000); + break; + } + events.ScheduleEvent(32, 500); + break; + case 33: + me->SummonCreature(NPC_YMIRJAR_WRATHBRINGER, 919.733f, 89.0972f, 558.959f, 3.85718f); + me->SummonCreature(NPC_YMIRJAR_WRATHBRINGER, 911.936f, 63.3542f, 547.698f, 3.735f); + me->SummonCreature(NPC_YMIRJAR_FLAMEBEARER, 909.356f, 83.1684f, 551.717f, 3.57792f); + me->SummonCreature(NPC_YMIRJAR_FLAMEBEARER, 920.946f, 69.1667f, 557.594f, 3.1765f); + events.ScheduleEvent(35, 3500); + break; + case 34: + me->SummonCreature(NPC_YMIRJAR_WRATHBRINGER, 879.464f, 41.1997f, 521.394f, 3.735f); + me->SummonCreature(NPC_YMIRJAR_WRATHBRINGER, 885.715f, 65.5156f, 533.631f, 3.85718f); + me->SummonCreature(NPC_YMIRJAR_FLAMEBEARER, 876.884f, 61.0139f, 527.715f, 3.57792f); + me->SummonCreature(NPC_YMIRJAR_FLAMEBEARER, 889.49f, 45.2865f, 527.233f, 3.97935f); + events.ScheduleEvent(36, 3500); + break; + case 35: + if (Creature* c = pInstance->instance->GetCreature(deathbringerGUID[0])) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + break; + case 36: + if (Creature* c = pInstance->instance->GetCreature(deathbringerGUID[1])) + { + c->SetReactState(REACT_AGGRESSIVE); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + break; + case 60: + { + Position startPos[6] = { {927.11f, -72.60f, 592.2f, 1.52f},{922.92f, -72.64f, 592.3f, 1.52f},{930.46f, -72.57f, 592.1f, 1.52f},{934.52f, -72.52f, 592.1f, 1.52f},{934.57f, -77.66f, 592.20f, 1.52f},{927.15f, -77.07f, 592.20f, 1.52f} }; + Position endPos = {926.10f, -46.63f, 591.2f, 1.52f}; + for (uint8 i=0; i<6; ++i) + if (Creature* s = me->SummonCreature(i < 4 ? NPC_FALLEN_WARRIOR : NPC_WRATHBONE_COLDWRAITH, startPos[i])) + { + s->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Position finalPos = endPos; + s->MovePosition(finalPos, startPos[i].GetExactDist(&startPos[0]), Position::NormalizeOrientation(startPos[i].GetAngle(&startPos[0])+1.52f)); - Movement::PointsArray path; - path.push_back(G3D::Vector3(s->GetPositionX(), s->GetPositionY(), s->GetPositionZ())); - path.push_back(G3D::Vector3(finalPos.GetPositionX(), finalPos.GetPositionY(), finalPos.GetPositionZ())); + Movement::PointsArray path; + path.push_back(G3D::Vector3(s->GetPositionX(), s->GetPositionY(), s->GetPositionZ())); + path.push_back(G3D::Vector3(finalPos.GetPositionX(), finalPos.GetPositionY(), finalPos.GetPositionZ())); - s->SetHomePosition(finalPos); - s->GetMotionMaster()->MoveSplinePath(&path); - } + s->SetHomePosition(finalPos); + s->GetMotionMaster()->MoveSplinePath(&path); + } - if (Difficulty(me->GetMap()->GetSpawnMode()) == DUNGEON_DIFFICULTY_HEROIC) - { - Position startPos[6] = { {925.485f, -65.67f, 592.5f, 1.4f},{921.77f, -65.10f, 592.5f, 1.4f},{929.19f, -66.24f, 592.5f, 1.4f},{932.46f, -66.74f, 592.5f, 1.4f},{924.66f, -71.03f, 592.5f, 1.4f},{928.81f, -71.66f, 592.5f, 1.4f} }; - Position middlePos = {928.43f, -29.31f, 589.0f, 1.4f}; - Position endPos = {937.8f, 21.20f, 574.6f, 1.4f}; - for (uint8 i=0; i<6; ++i) - if (Creature* s = me->SummonCreature(i < 4 ? NPC_FALLEN_WARRIOR : NPC_WRATHBONE_COLDWRAITH, startPos[i])) - { - s->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - Position midPos = middlePos; - Position finalPos = endPos; - s->MovePosition(midPos, startPos[i].GetExactDist(&startPos[0]), Position::NormalizeOrientation(startPos[i].GetAngle(&startPos[0])+1.4f)); - s->MovePosition(finalPos, startPos[i].GetExactDist(&startPos[0]), Position::NormalizeOrientation(startPos[i].GetAngle(&startPos[0])+1.4f)); + if (Difficulty(me->GetMap()->GetSpawnMode()) == DUNGEON_DIFFICULTY_HEROIC) + { + Position startPos[6] = { {925.485f, -65.67f, 592.5f, 1.4f},{921.77f, -65.10f, 592.5f, 1.4f},{929.19f, -66.24f, 592.5f, 1.4f},{932.46f, -66.74f, 592.5f, 1.4f},{924.66f, -71.03f, 592.5f, 1.4f},{928.81f, -71.66f, 592.5f, 1.4f} }; + Position middlePos = {928.43f, -29.31f, 589.0f, 1.4f}; + Position endPos = {937.8f, 21.20f, 574.6f, 1.4f}; + for (uint8 i=0; i<6; ++i) + if (Creature* s = me->SummonCreature(i < 4 ? NPC_FALLEN_WARRIOR : NPC_WRATHBONE_COLDWRAITH, startPos[i])) + { + s->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Position midPos = middlePos; + Position finalPos = endPos; + s->MovePosition(midPos, startPos[i].GetExactDist(&startPos[0]), Position::NormalizeOrientation(startPos[i].GetAngle(&startPos[0])+1.4f)); + s->MovePosition(finalPos, startPos[i].GetExactDist(&startPos[0]), Position::NormalizeOrientation(startPos[i].GetAngle(&startPos[0])+1.4f)); - Movement::PointsArray path; - path.push_back(G3D::Vector3(s->GetPositionX(), s->GetPositionY(), s->GetPositionZ())); - path.push_back(G3D::Vector3(midPos.GetPositionX(), midPos.GetPositionY(), midPos.GetPositionZ())); - path.push_back(G3D::Vector3(finalPos.GetPositionX(), finalPos.GetPositionY(), finalPos.GetPositionZ())); + Movement::PointsArray path; + path.push_back(G3D::Vector3(s->GetPositionX(), s->GetPositionY(), s->GetPositionZ())); + path.push_back(G3D::Vector3(midPos.GetPositionX(), midPos.GetPositionY(), midPos.GetPositionZ())); + path.push_back(G3D::Vector3(finalPos.GetPositionX(), finalPos.GetPositionY(), finalPos.GetPositionZ())); - s->SetHomePosition(finalPos); - s->GetMotionMaster()->MoveSplinePath(&path); - } - } - } - break; - } - } - }; + s->SetHomePosition(finalPos); + s->GetMotionMaster()->MoveSplinePath(&path); + } + } + } + break; + } + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_pos_tyrannus_eventsAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_pos_tyrannus_eventsAI(creature); + } }; class npc_pos_icicle_trigger : public CreatureScript { public: - npc_pos_icicle_trigger() : CreatureScript("npc_pos_icicle_trigger") { } + npc_pos_icicle_trigger() : CreatureScript("npc_pos_icicle_trigger") { } - struct npc_pos_icicle_triggerAI: public NullCreatureAI - { - npc_pos_icicle_triggerAI(Creature* creature) : NullCreatureAI(creature) - { - pInstance = me->GetInstanceScript(); - timer = urand(0, 16000); - } + struct npc_pos_icicle_triggerAI: public NullCreatureAI + { + npc_pos_icicle_triggerAI(Creature* creature) : NullCreatureAI(creature) + { + pInstance = me->GetInstanceScript(); + timer = urand(0, 16000); + } - InstanceScript* pInstance; - uint16 timer; + InstanceScript* pInstance; + uint16 timer; - void UpdateAI(uint32 diff) - { - if (!pInstance) - return; - if (timer <= diff) - { - if (pInstance->GetData(DATA_INSTANCE_PROGRESS) == INSTANCE_PROGRESS_AFTER_TUNNEL_WARN) - me->CastSpell(me, SPELL_TUNNEL_ICICLE, false); - timer = urand(16000,24000); - } - else - timer -= diff; - } - }; + void UpdateAI(uint32 diff) + { + if (!pInstance) + return; + if (timer <= diff) + { + if (pInstance->GetData(DATA_INSTANCE_PROGRESS) == INSTANCE_PROGRESS_AFTER_TUNNEL_WARN) + me->CastSpell(me, SPELL_TUNNEL_ICICLE, false); + timer = urand(16000,24000); + } + else + timer -= diff; + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_pos_icicle_triggerAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_pos_icicle_triggerAI(creature); + } }; class npc_pos_collapsing_icicle : public CreatureScript { public: - npc_pos_collapsing_icicle() : CreatureScript("npc_pos_collapsing_icicle") { } + npc_pos_collapsing_icicle() : CreatureScript("npc_pos_collapsing_icicle") { } - struct npc_pos_collapsing_icicleAI: public NullCreatureAI - { - npc_pos_collapsing_icicleAI(Creature* creature) : NullCreatureAI(creature) - { - pInstance = me->GetInstanceScript(); - timer1 = 2500; - timer2 = 7000; - } + struct npc_pos_collapsing_icicleAI: public NullCreatureAI + { + npc_pos_collapsing_icicleAI(Creature* creature) : NullCreatureAI(creature) + { + pInstance = me->GetInstanceScript(); + timer1 = 2500; + timer2 = 7000; + } - InstanceScript* pInstance; - uint16 timer1; - uint16 timer2; + InstanceScript* pInstance; + uint16 timer1; + uint16 timer2; - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (target && spell && target->GetTypeId() == TYPEID_PLAYER && spell->Id == 70827 && pInstance) - pInstance->SetData(DATA_ACHIEV_DONT_LOOK_UP, 0); - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (target && spell && target->GetTypeId() == TYPEID_PLAYER && spell->Id == 70827 && pInstance) + pInstance->SetData(DATA_ACHIEV_DONT_LOOK_UP, 0); + } - void UpdateAI(uint32 diff) - { - if (timer1 <= diff) - { - me->CastSpell(me, 69428, false); - me->CastSpell(me, 69426, true); - timer1 = 60000; - } - else - timer1 -= diff; + void UpdateAI(uint32 diff) + { + if (timer1 <= diff) + { + me->CastSpell(me, 69428, false); + me->CastSpell(me, 69426, true); + timer1 = 60000; + } + else + timer1 -= diff; - if (timer2 <= diff) - { - me->SetDisplayId(11686); - timer2 = 60000; - } - else - timer2 -= diff; - } - }; + if (timer2 <= diff) + { + me->SetDisplayId(11686); + timer2 = 60000; + } + else + timer2 -= diff; + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_pos_collapsing_icicleAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_pos_collapsing_icicleAI(creature); + } }; class npc_pos_martin_or_gorkun_second : public CreatureScript { public: - npc_pos_martin_or_gorkun_second() : CreatureScript("npc_pos_martin_or_gorkun_second") { } + npc_pos_martin_or_gorkun_second() : CreatureScript("npc_pos_martin_or_gorkun_second") { } - struct npc_pos_martin_or_gorkun_secondAI: public NullCreatureAI - { - npc_pos_martin_or_gorkun_secondAI(Creature* creature) : NullCreatureAI(creature), summons(me) - { - pInstance = me->GetInstanceScript(); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); - i = 0; - events.Reset(); - events.RescheduleEvent(1, 500); - events.RescheduleEvent(2, 15000); + struct npc_pos_martin_or_gorkun_secondAI: public NullCreatureAI + { + npc_pos_martin_or_gorkun_secondAI(Creature* creature) : NullCreatureAI(creature), summons(me) + { + pInstance = me->GetInstanceScript(); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); + i = 0; + events.Reset(); + events.RescheduleEvent(1, 500); + events.RescheduleEvent(2, 15000); - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_GUID))) - { - c->AI()->Talk(SAY_PREFIGHT_1); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - c->SetReactState(REACT_AGGRESSIVE); - //c->ClearUnitState(UNIT_STATE_ONVEHICLE); - if (Player* plr = c->SelectNearestPlayer(100.0f)) - { - c->AI()->AttackStart(plr); - DoZoneInCombat(c); - } - } - } + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_GUID))) + { + c->AI()->Talk(SAY_PREFIGHT_1); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + c->SetReactState(REACT_AGGRESSIVE); + //c->ClearUnitState(UNIT_STATE_ONVEHICLE); + if (Player* plr = c->SelectNearestPlayer(100.0f)) + { + c->AI()->AttackStart(plr); + DoZoneInCombat(c); + } + } + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint8 i; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint8 i; - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == 2) - { - events.RescheduleEvent(5, 1000); - } - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == 2) + { + events.RescheduleEvent(5, 1000); + } + } - void DoAction(int32 p) - { - if (p==1) - summons.DespawnAll(); - else if (p==2) - { - events.Reset(); - summons.DespawnEntry(NPC_FALLEN_WARRIOR); + void DoAction(int32 p) + { + if (p==1) + summons.DespawnAll(); + else if (p==2) + { + events.Reset(); + summons.DespawnEntry(NPC_FALLEN_WARRIOR); - if (!pInstance) - return; + if (!pInstance) + return; - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->GetMotionMaster()->MovePoint(2, TSCenterPos); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->GetMotionMaster()->MovePoint(2, TSCenterPos); - float ZeroAngle = TSSpawnPos.GetAngle(&TSMidPos); + float ZeroAngle = TSSpawnPos.GetAngle(&TSMidPos); - for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - { - float hx, hy, hz, ho; - c->GetHomePosition(hx, hy, hz, ho); - c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CHEER); - float ang = frand(1.92f, 2.36f); - float dist = urand(50, 85); - c->GetMotionMaster()->MovePoint(0, TSSpawnPos.GetPositionX()+cos(ang)*dist, TSSpawnPos.GetPositionY()+sin(ang)*dist, 628.2f); - } - } - else if (p==3) - { - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SINDRAGOSA_GUID))) - { - for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* s = pInstance->instance->GetCreature(*itr)) - if (s->IsAlive()) - Unit::Kill(c, s); - if (me->IsAlive()) - Unit::Kill(c, me); - } - } - } + for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + { + float hx, hy, hz, ho; + c->GetHomePosition(hx, hy, hz, ho); + c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CHEER); + float ang = frand(1.92f, 2.36f); + float dist = urand(50, 85); + c->GetMotionMaster()->MovePoint(0, TSSpawnPos.GetPositionX()+cos(ang)*dist, TSSpawnPos.GetPositionY()+sin(ang)*dist, 628.2f); + } + } + else if (p==3) + { + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SINDRAGOSA_GUID))) + { + for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* s = pInstance->instance->GetCreature(*itr)) + if (s->IsAlive()) + Unit::Kill(c, s); + if (me->IsAlive()) + Unit::Kill(c, me); + } + } + } - void JustSummoned(Creature* s) - { - summons.Summon(s); - } + void JustSummoned(Creature* s) + { + summons.Summon(s); + } - void SummonedCreatureDespawn(Creature* s) - { - summons.Despawn(s); - } + void SummonedCreatureDespawn(Creature* s) + { + summons.Despawn(s); + } - void UpdateAI(uint32 diff) - { - events.Update(diff); + void UpdateAI(uint32 diff) + { + events.Update(diff); - switch(events.ExecuteEvent()) - { - case 0: - break; - case 1: - if (TSData[i].entry) - { - if (Creature* c = me->SummonCreature(TSData[i].entry, TSSpawnPos)) - { - c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); - c->GetMotionMaster()->MovePoint(0, TSData[i].x, TSData[i].y, TSHeight); - } - ++i; - events.ScheduleEvent(1, 150); - } - break; - case 2: - Talk(me->GetEntry() == NPC_MARTIN_VICTUS_2 ? SAY_GENERAL_ALLIANCE_TRASH : SAY_GENERAL_HORDE_TRASH); - events.RescheduleEvent(3, 8000); - break; - case 3: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_GUID))) - c->AI()->Talk(SAY_PREFIGHT_2); + switch(events.ExecuteEvent()) + { + case 0: + break; + case 1: + if (TSData[i].entry) + { + if (Creature* c = me->SummonCreature(TSData[i].entry, TSSpawnPos)) + { + c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); + c->GetMotionMaster()->MovePoint(0, TSData[i].x, TSData[i].y, TSHeight); + } + ++i; + events.ScheduleEvent(1, 150); + } + break; + case 2: + Talk(me->GetEntry() == NPC_MARTIN_VICTUS_2 ? SAY_GENERAL_ALLIANCE_TRASH : SAY_GENERAL_HORDE_TRASH); + events.RescheduleEvent(3, 8000); + break; + case 3: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_GUID))) + c->AI()->Talk(SAY_PREFIGHT_2); - me->SetFacingTo(5.26f); - me->SetOrientation(5.26f); - me->SetHomePosition(*me); - for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - { - c->SetFacingTo(5.26f); - c->SetOrientation(5.26f); - c->SetHomePosition(*c); - } - events.RescheduleEvent(10, 15000); + me->SetFacingTo(5.26f); + me->SetOrientation(5.26f); + me->SetHomePosition(*me); + for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + { + c->SetFacingTo(5.26f); + c->SetOrientation(5.26f); + c->SetHomePosition(*c); + } + events.RescheduleEvent(10, 15000); - events.RescheduleEvent(4, 15000); - break; - case 4: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_GUID))) - c->AI()->DoAction(1); - break; - case 5: - me->SetFacingTo(TSCenterPos.GetOrientation()); - Talk(me->GetEntry() == NPC_MARTIN_VICTUS_2 ? SAY_GENERAL_ALLIANCE_OUTRO_1 : SAY_GENERAL_HORDE_OUTRO_1); - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_SECOND_GUID))) - c->AI()->DoAction(1); - break; - case 10: - if (summons.GetEntryCount(NPC_FALLEN_WARRIOR) < 3) - if (Creature* c = me->SummonCreature(NPC_FALLEN_WARRIOR, 1060.95f, 102.79f, 630.2f, 2.01f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) - { - float offset = frand(0.0f, 10.0f); - c->GetMotionMaster()->MovePoint(0, 1047.0f+offset, 118.0f+offset, 628.2f); - c->SetHomePosition(*me); - for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* s = pInstance->instance->GetCreature(*itr)) - { - if (s->GetEntry() == NPC_FALLEN_WARRIOR) - continue; - c->SetInCombatWith(s); - s->SetInCombatWith(c); - c->AddThreat(s, 0.0f); - s->AddThreat(c, 0.0f); - } - } - events.RescheduleEvent(10, 3000); - break; - } + events.RescheduleEvent(4, 15000); + break; + case 4: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TYRANNUS_GUID))) + c->AI()->DoAction(1); + break; + case 5: + me->SetFacingTo(TSCenterPos.GetOrientation()); + Talk(me->GetEntry() == NPC_MARTIN_VICTUS_2 ? SAY_GENERAL_ALLIANCE_OUTRO_1 : SAY_GENERAL_HORDE_OUTRO_1); + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_LEADER_SECOND_GUID))) + c->AI()->DoAction(1); + break; + case 10: + if (summons.GetEntryCount(NPC_FALLEN_WARRIOR) < 3) + if (Creature* c = me->SummonCreature(NPC_FALLEN_WARRIOR, 1060.95f, 102.79f, 630.2f, 2.01f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) + { + float offset = frand(0.0f, 10.0f); + c->GetMotionMaster()->MovePoint(0, 1047.0f+offset, 118.0f+offset, 628.2f); + c->SetHomePosition(*me); + for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* s = pInstance->instance->GetCreature(*itr)) + { + if (s->GetEntry() == NPC_FALLEN_WARRIOR) + continue; + c->SetInCombatWith(s); + s->SetInCombatWith(c); + c->AddThreat(s, 0.0f); + s->AddThreat(c, 0.0f); + } + } + events.RescheduleEvent(10, 3000); + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_pos_martin_or_gorkun_secondAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_pos_martin_or_gorkun_secondAI(creature); + } }; class npc_pos_freed_slave : public CreatureScript { public: - npc_pos_freed_slave() : CreatureScript("npc_pos_freed_slave") { } + npc_pos_freed_slave() : CreatureScript("npc_pos_freed_slave") { } - struct npc_pos_freed_slaveAI: public SmartAI - { - npc_pos_freed_slaveAI(Creature* creature) : SmartAI(creature) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - // immune to falling icicles - me->ApplySpellImmune(0, IMMUNITY_ID, 69425, true); - me->ApplySpellImmune(0, IMMUNITY_ID, 70827, true); - } + struct npc_pos_freed_slaveAI: public SmartAI + { + npc_pos_freed_slaveAI(Creature* creature) : SmartAI(creature) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + // immune to falling icicles + me->ApplySpellImmune(0, IMMUNITY_ID, 69425, true); + me->ApplySpellImmune(0, IMMUNITY_ID, 70827, true); + } - bool CanAIAttack(const Unit* who) const - { - return who->GetEntry() == NPC_FALLEN_WARRIOR; - } + bool CanAIAttack(const Unit* who) const + { + return who->GetEntry() == NPC_FALLEN_WARRIOR; + } - void EnterEvadeMode() - { - if (!me->IsAlive() || me->IsInEvadeMode()) - return; + void EnterEvadeMode() + { + if (!me->IsAlive() || me->IsInEvadeMode()) + return; - me->RemoveEvadeAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->LoadCreaturesAddon(true); - me->SetLootRecipient(NULL); - me->ResetPlayerDamageReq(); - me->SetLastDamagedTime(0); - } - }; + me->RemoveEvadeAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->LoadCreaturesAddon(true); + me->SetLootRecipient(NULL); + me->ResetPlayerDamageReq(); + me->SetLastDamagedTime(0); + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_pos_freed_slaveAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_pos_freed_slaveAI(creature); + } }; class npc_pos_leader_second : public CreatureScript { public: - npc_pos_leader_second() : CreatureScript("npc_pos_leader_second") { } + npc_pos_leader_second() : CreatureScript("npc_pos_leader_second") { } - struct npc_pos_leader_secondAI: public NullCreatureAI - { - npc_pos_leader_secondAI(Creature* creature) : NullCreatureAI(creature) - { - pInstance = me->GetInstanceScript(); - barrierGUID = 0; - events.Reset(); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + struct npc_pos_leader_secondAI: public NullCreatureAI + { + npc_pos_leader_secondAI(Creature* creature) : NullCreatureAI(creature) + { + pInstance = me->GetInstanceScript(); + barrierGUID = 0; + events.Reset(); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - if (pInstance) - { - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) - { - c->RemoveAllAuras(); - c->GetMotionMaster()->Clear(); - c->GetMotionMaster()->MoveIdle(); - c->SetVisible(false); - } - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MARTIN_OR_GORKUN_GUID))) - { - c->AI()->DoAction(2); - } - } - } + if (pInstance) + { + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_RIMEFANG_GUID))) + { + c->RemoveAllAuras(); + c->GetMotionMaster()->Clear(); + c->GetMotionMaster()->MoveIdle(); + c->SetVisible(false); + } + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MARTIN_OR_GORKUN_GUID))) + { + c->AI()->DoAction(2); + } + } + } - InstanceScript* pInstance; - EventMap events; - uint64 barrierGUID; + InstanceScript* pInstance; + EventMap events; + uint64 barrierGUID; - void DoAction(int32 p) - { - if (p == 1) - { - events.RescheduleEvent(1, me->GetEntry() == NPC_JAINA_PART2 ? 15500 : 18000); - events.RescheduleEvent(2, me->GetEntry() == NPC_JAINA_PART2 ? 16500 : 19000); - } - } + void DoAction(int32 p) + { + if (p == 1) + { + events.RescheduleEvent(1, me->GetEntry() == NPC_JAINA_PART2 ? 15500 : 18000); + events.RescheduleEvent(2, me->GetEntry() == NPC_JAINA_PART2 ? 16500 : 19000); + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if ((spell->Id == SPELL_TELEPORT_JAINA || spell->Id == SPELL_TELEPORT_SYLVANAS) && target && target->GetTypeId() == TYPEID_PLAYER) - { - float angle = rand_norm()*2*M_PI; - float dist = urand(1,4); - target->ToPlayer()->NearTeleportTo(me->GetPositionX()+cos(angle)*dist, me->GetPositionY()+sin(angle)*dist, me->GetPositionZ(), me->GetOrientation()); - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if ((spell->Id == SPELL_TELEPORT_JAINA || spell->Id == SPELL_TELEPORT_SYLVANAS) && target && target->GetTypeId() == TYPEID_PLAYER) + { + float angle = rand_norm()*2*M_PI; + float dist = urand(1,4); + target->ToPlayer()->NearTeleportTo(me->GetPositionX()+cos(angle)*dist, me->GetPositionY()+sin(angle)*dist, me->GetPositionZ(), me->GetOrientation()); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type != WAYPOINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != WAYPOINT_MOTION_TYPE) + return; - switch(id) - { - case 0: - Talk(me->GetEntry() == NPC_JAINA_PART2 ? SAY_JAINA_OUTRO_2 : SAY_SYLVANAS_OUTRO_2); - break; - case 1: - if (me->GetEntry() == NPC_JAINA_PART2) - Talk(SAY_JAINA_OUTRO_3); - break; - case 6: - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - if (GameObject* g = me->FindNearestGameObject(GO_HOR_PORTCULLIS, 50.0f)) - g->SetGoState(GO_STATE_ACTIVE); - break; - } - } + switch(id) + { + case 0: + Talk(me->GetEntry() == NPC_JAINA_PART2 ? SAY_JAINA_OUTRO_2 : SAY_SYLVANAS_OUTRO_2); + break; + case 1: + if (me->GetEntry() == NPC_JAINA_PART2) + Talk(SAY_JAINA_OUTRO_3); + break; + case 6: + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + if (GameObject* g = me->FindNearestGameObject(GO_HOR_PORTCULLIS, 50.0f)) + g->SetGoState(GO_STATE_ACTIVE); + break; + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); + void UpdateAI(uint32 diff) + { + events.Update(diff); - switch(events.GetEvent()) - { - case 0: - break; - case 1: - if (pInstance) - if (Creature* c = me->SummonCreature(NPC_SINDRAGOSA, TSSindragosaPos1)) - { - c->SetCanFly(true); - c->SetDisableGravity(true); - c->SetHover(true); - c->GetMotionMaster()->MovePoint(0, TSSindragosaPos2); - } - events.PopEvent(); - break; - case 2: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MARTIN_OR_GORKUN_GUID))) - c->AI()->Talk(SAY_GENERAL_OUTRO_2); - events.PopEvent(); - events.RescheduleEvent(3, me->GetEntry() == NPC_JAINA_PART2 ? 7000 : 8000); - break; - case 3: - Talk(me->GetEntry() == NPC_JAINA_PART2 ? SAY_JAINA_OUTRO_1 : SAY_SYLVANAS_OUTRO_1); - me->CastSpell(me, me->GetEntry() == NPC_JAINA_PART2 ? SPELL_TELEPORT_JAINA_VISUAL : SPELL_TELEPORT_SYLVANAS_VISUAL, true); - events.PopEvent(); - events.RescheduleEvent(4, 2000); - break; - case 4: - me->CastSpell(me, me->GetEntry() == NPC_JAINA_PART2 ? SPELL_TELEPORT_JAINA : SPELL_TELEPORT_SYLVANAS, true); - if (GameObject* barrier = me->SummonGameObject(203005, 1055.49f, 115.03f, 628.15f, 2.08f, 0.0f, 0.0f, 0.0f, 0.0f, 86400, false)) - barrierGUID = barrier->GetGUID(); - events.PopEvent(); - events.RescheduleEvent(5, 1500); - break; - case 5: - if (pInstance) - if (Creature* x = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MARTIN_OR_GORKUN_GUID))) - { - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SINDRAGOSA_GUID))) - c->CastSpell(x->GetPositionX(), x->GetPositionY(), x->GetPositionZ(), SPELL_SINDRAGOSA_FROST_BOMB_POS, true); - } - events.PopEvent(); - events.RescheduleEvent(6, 5000); - events.RescheduleEvent(10, 2000); - break; - case 6: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SINDRAGOSA_GUID))) - c->GetMotionMaster()->MovePoint(0, TSSindragosaPos1); - events.PopEvent(); - events.RescheduleEvent(7, 4500); - break; - case 7: - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SINDRAGOSA_GUID))) - c->SetVisible(false); - if (GameObject* barrier = pInstance->instance->GetGameObject(barrierGUID)) - barrier->Delete(); - barrierGUID = 0; - events.PopEvent(); - events.RescheduleEvent(8, 2000); - break; - case 8: - me->GetMotionMaster()->MovePath(me->GetEntry() == NPC_JAINA_PART2 ? PATH_BEGIN_VALUE+16 : PATH_BEGIN_VALUE+17, false); - events.PopEvent(); - break; - case 10: - if (Creature* x = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MARTIN_OR_GORKUN_GUID))) - x->AI()->DoAction(3); - events.PopEvent(); - break; - } - } - }; + switch(events.GetEvent()) + { + case 0: + break; + case 1: + if (pInstance) + if (Creature* c = me->SummonCreature(NPC_SINDRAGOSA, TSSindragosaPos1)) + { + c->SetCanFly(true); + c->SetDisableGravity(true); + c->SetHover(true); + c->GetMotionMaster()->MovePoint(0, TSSindragosaPos2); + } + events.PopEvent(); + break; + case 2: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MARTIN_OR_GORKUN_GUID))) + c->AI()->Talk(SAY_GENERAL_OUTRO_2); + events.PopEvent(); + events.RescheduleEvent(3, me->GetEntry() == NPC_JAINA_PART2 ? 7000 : 8000); + break; + case 3: + Talk(me->GetEntry() == NPC_JAINA_PART2 ? SAY_JAINA_OUTRO_1 : SAY_SYLVANAS_OUTRO_1); + me->CastSpell(me, me->GetEntry() == NPC_JAINA_PART2 ? SPELL_TELEPORT_JAINA_VISUAL : SPELL_TELEPORT_SYLVANAS_VISUAL, true); + events.PopEvent(); + events.RescheduleEvent(4, 2000); + break; + case 4: + me->CastSpell(me, me->GetEntry() == NPC_JAINA_PART2 ? SPELL_TELEPORT_JAINA : SPELL_TELEPORT_SYLVANAS, true); + if (GameObject* barrier = me->SummonGameObject(203005, 1055.49f, 115.03f, 628.15f, 2.08f, 0.0f, 0.0f, 0.0f, 0.0f, 86400, false)) + barrierGUID = barrier->GetGUID(); + events.PopEvent(); + events.RescheduleEvent(5, 1500); + break; + case 5: + if (pInstance) + if (Creature* x = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MARTIN_OR_GORKUN_GUID))) + { + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SINDRAGOSA_GUID))) + c->CastSpell(x->GetPositionX(), x->GetPositionY(), x->GetPositionZ(), SPELL_SINDRAGOSA_FROST_BOMB_POS, true); + } + events.PopEvent(); + events.RescheduleEvent(6, 5000); + events.RescheduleEvent(10, 2000); + break; + case 6: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SINDRAGOSA_GUID))) + c->GetMotionMaster()->MovePoint(0, TSSindragosaPos1); + events.PopEvent(); + events.RescheduleEvent(7, 4500); + break; + case 7: + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SINDRAGOSA_GUID))) + c->SetVisible(false); + if (GameObject* barrier = pInstance->instance->GetGameObject(barrierGUID)) + barrier->Delete(); + barrierGUID = 0; + events.PopEvent(); + events.RescheduleEvent(8, 2000); + break; + case 8: + me->GetMotionMaster()->MovePath(me->GetEntry() == NPC_JAINA_PART2 ? PATH_BEGIN_VALUE+16 : PATH_BEGIN_VALUE+17, false); + events.PopEvent(); + break; + case 10: + if (Creature* x = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MARTIN_OR_GORKUN_GUID))) + x->AI()->DoAction(3); + events.PopEvent(); + break; + } + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_pos_leader_secondAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_pos_leader_secondAI(creature); + } }; class npc_frostbite_invisible_stalker : public CreatureScript { public: - npc_frostbite_invisible_stalker() : CreatureScript("npc_frostbite_invisible_stalker") { } + npc_frostbite_invisible_stalker() : CreatureScript("npc_frostbite_invisible_stalker") { } - struct npc_frostbite_invisible_stalkerAI: public NullCreatureAI - { - npc_frostbite_invisible_stalkerAI(Creature* creature) : NullCreatureAI(creature) - { - timer = 3500; - for (uint8 i = 0; i<3; ++i) - { - me->SetOrientation(i*M_PI/3); - me->CastSpell(me, 34740, true); - me->CastSpell(me, 34746, true); - } - } + struct npc_frostbite_invisible_stalkerAI: public NullCreatureAI + { + npc_frostbite_invisible_stalkerAI(Creature* creature) : NullCreatureAI(creature) + { + timer = 3500; + for (uint8 i = 0; i<3; ++i) + { + me->SetOrientation(i*M_PI/3); + me->CastSpell(me, 34740, true); + me->CastSpell(me, 34746, true); + } + } - uint16 timer; + uint16 timer; - void UpdateAI(uint32 diff) - { - if (timer) - { - if (timer <= diff) - { - int32 dmg = 2200; - me->CastCustomSpell(me, 34779, 0, &dmg, 0, true); - timer = 0; - } - else - timer -= diff; - } - } - }; + void UpdateAI(uint32 diff) + { + if (timer) + { + if (timer <= diff) + { + int32 dmg = 2200; + me->CastCustomSpell(me, 34779, 0, &dmg, 0, true); + timer = 0; + } + else + timer -= diff; + } + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_frostbite_invisible_stalkerAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_frostbite_invisible_stalkerAI(creature); + } }; class spell_pos_empowered_blizzard : public SpellScriptLoader { public: - spell_pos_empowered_blizzard() : SpellScriptLoader("spell_pos_empowered_blizzard") { } + spell_pos_empowered_blizzard() : SpellScriptLoader("spell_pos_empowered_blizzard") { } - class spell_pos_empowered_blizzardAuraScript : public AuraScript - { - PrepareAuraScript(spell_pos_empowered_blizzardAuraScript) + class spell_pos_empowered_blizzardAuraScript : public AuraScript + { + PrepareAuraScript(spell_pos_empowered_blizzardAuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - PreventDefaultAction(); - if (Unit* caster = GetCaster()) - caster->CastSpell((float)urand(447,480), (float)urand(200,235), 528.71f, 70131, true); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + caster->CastSpell((float)urand(447,480), (float)urand(200,235), 528.71f, 70131, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_empowered_blizzardAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_empowered_blizzardAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_pos_empowered_blizzardAuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_pos_empowered_blizzardAuraScript(); + } }; const char* slaveTexts[23] = { @@ -1381,10 +1381,10 @@ const char* slaveTexts[23] = { }; const Position slaveFreePos[4] = { - {699.82f, -82.68f, 512.6f, 0.0f}, - {643.51f, 79.20f, 511.57f, 0.0f}, - {800.09f, 78.66f, 510.2f, 0.0f}, - {528.26f, 187.04f, 528.75f, 0.0f} + {699.82f, -82.68f, 512.6f, 0.0f}, + {643.51f, 79.20f, 511.57f, 0.0f}, + {800.09f, 78.66f, 510.2f, 0.0f}, + {528.26f, 187.04f, 528.75f, 0.0f} }; class SlaveRunEvent : public BasicEvent @@ -1394,19 +1394,19 @@ class SlaveRunEvent : public BasicEvent bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) { - uint32 pointId = 0; - float minDist = _owner.GetExactDist2dSq(&slaveFreePos[pointId]); - for (uint32 i=1; i<4; ++i) - { - float dist = _owner.GetExactDist2dSq(&slaveFreePos[i]); - if (dist < minDist) - { - minDist = dist; - pointId = i; - } - } - if (minDist < 200.0f*200.0f) - _owner.GetMotionMaster()->MovePoint(0, slaveFreePos[pointId], true, false); + uint32 pointId = 0; + float minDist = _owner.GetExactDist2dSq(&slaveFreePos[pointId]); + for (uint32 i=1; i<4; ++i) + { + float dist = _owner.GetExactDist2dSq(&slaveFreePos[i]); + if (dist < minDist) + { + minDist = dist; + pointId = i; + } + } + if (minDist < 200.0f*200.0f) + _owner.GetMotionMaster()->MovePoint(0, slaveFreePos[pointId], true, false); return true; } @@ -1417,184 +1417,184 @@ class SlaveRunEvent : public BasicEvent class spell_pos_slave_trigger_closest : public SpellScriptLoader { public: - spell_pos_slave_trigger_closest() : SpellScriptLoader("spell_pos_slave_trigger_closest") { } + spell_pos_slave_trigger_closest() : SpellScriptLoader("spell_pos_slave_trigger_closest") { } - class spell_pos_slave_trigger_closestSpellScript : public SpellScript - { + class spell_pos_slave_trigger_closestSpellScript : public SpellScript + { - PrepareSpellScript(spell_pos_slave_trigger_closestSpellScript); + PrepareSpellScript(spell_pos_slave_trigger_closestSpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetHitUnit()) - if (target->GetUInt32Value(UNIT_NPC_EMOTESTATE)) // prevent using multiple times - { - if (Unit* caster = GetCaster()) - if (Player* p = caster->ToPlayer()) - { - p->RewardPlayerAndGroupAtEvent(36764, caster); // alliance - p->RewardPlayerAndGroupAtEvent(36770, caster); // horde - } - target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - if (Creature* c = target->ToCreature()) - { - c->DespawnOrUnsummon(7000); - uint32 maxIndex = (c->getGender() == GENDER_FEMALE ? 22 : 20); - c->MonsterSay(slaveTexts[urand(0, maxIndex)], LANG_UNIVERSAL, 0); - c->m_Events.AddEvent(new SlaveRunEvent(*c), c->m_Events.CalculateTime(3000)); - } - } - } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + if (target->GetUInt32Value(UNIT_NPC_EMOTESTATE)) // prevent using multiple times + { + if (Unit* caster = GetCaster()) + if (Player* p = caster->ToPlayer()) + { + p->RewardPlayerAndGroupAtEvent(36764, caster); // alliance + p->RewardPlayerAndGroupAtEvent(36770, caster); // horde + } + target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + if (Creature* c = target->ToCreature()) + { + c->DespawnOrUnsummon(7000); + uint32 maxIndex = (c->getGender() == GENDER_FEMALE ? 22 : 20); + c->MonsterSay(slaveTexts[urand(0, maxIndex)], LANG_UNIVERSAL, 0); + c->m_Events.AddEvent(new SlaveRunEvent(*c), c->m_Events.CalculateTime(3000)); + } + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_pos_slave_trigger_closestSpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_pos_slave_trigger_closestSpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_pos_slave_trigger_closestSpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_pos_slave_trigger_closestSpellScript(); + } }; class spell_pos_rimefang_frost_nova : public SpellScriptLoader { public: - spell_pos_rimefang_frost_nova() : SpellScriptLoader("spell_pos_rimefang_frost_nova") { } + spell_pos_rimefang_frost_nova() : SpellScriptLoader("spell_pos_rimefang_frost_nova") { } - class spell_pos_rimefang_frost_novaSpellScript : public SpellScript - { + class spell_pos_rimefang_frost_novaSpellScript : public SpellScript + { - PrepareSpellScript(spell_pos_rimefang_frost_novaSpellScript); + PrepareSpellScript(spell_pos_rimefang_frost_novaSpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetHitUnit()) - if (Unit* caster = GetCaster()) - { - Unit::Kill(caster, target); - if (target->GetTypeId() == TYPEID_UNIT) - target->ToCreature()->DespawnOrUnsummon(30000); - } - } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + if (Unit* caster = GetCaster()) + { + Unit::Kill(caster, target); + if (target->GetTypeId() == TYPEID_UNIT) + target->ToCreature()->DespawnOrUnsummon(30000); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_pos_rimefang_frost_novaSpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_pos_rimefang_frost_novaSpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_pos_rimefang_frost_novaSpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_pos_rimefang_frost_novaSpellScript(); + } }; class spell_pos_blight : public SpellScriptLoader { public: - spell_pos_blight() : SpellScriptLoader("spell_pos_blight") { } + spell_pos_blight() : SpellScriptLoader("spell_pos_blight") { } - class spell_pos_blightAuraScript : public AuraScript - { - PrepareAuraScript(spell_pos_blightAuraScript) + class spell_pos_blightAuraScript : public AuraScript + { + PrepareAuraScript(spell_pos_blightAuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (aurEff->GetTickNumber() == aurEff->GetTotalTicks()) - if (Unit* target = GetTarget()) - target->CastSpell(target, 69604, true); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (aurEff->GetTickNumber() == aurEff->GetTotalTicks()) + if (Unit* target = GetTarget()) + target->CastSpell(target, 69604, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_blightAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_blightAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_pos_blightAuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_pos_blightAuraScript(); + } }; class spell_pos_glacial_strike : public SpellScriptLoader { public: - spell_pos_glacial_strike() : SpellScriptLoader("spell_pos_glacial_strike") { } + spell_pos_glacial_strike() : SpellScriptLoader("spell_pos_glacial_strike") { } - class spell_pos_glacial_strikeAuraScript : public AuraScript - { - PrepareAuraScript(spell_pos_glacial_strikeAuraScript) + class spell_pos_glacial_strikeAuraScript : public AuraScript + { + PrepareAuraScript(spell_pos_glacial_strikeAuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (Unit* target = GetTarget()) - if (target->GetHealth() == target->GetMaxHealth()) - { - PreventDefaultAction(); - aurEff->GetBase()->Remove(AURA_REMOVE_BY_EXPIRE); - return; - } - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (Unit* target = GetTarget()) + if (target->GetHealth() == target->GetMaxHealth()) + { + PreventDefaultAction(); + aurEff->GetBase()->Remove(AURA_REMOVE_BY_EXPIRE); + return; + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_glacial_strikeAuraScript::HandleEffectPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE_PERCENT); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_pos_glacial_strikeAuraScript::HandleEffectPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE_PERCENT); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_pos_glacial_strikeAuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_pos_glacial_strikeAuraScript(); + } }; class at_tyrannus_event_starter : public AreaTriggerScript { - public: - at_tyrannus_event_starter() : AreaTriggerScript("at_tyrannus_event_starter") { } + public: + at_tyrannus_event_starter() : AreaTriggerScript("at_tyrannus_event_starter") { } - bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) - { - InstanceScript* inst = player->GetInstanceScript(); - if (!inst) - return false; + bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) + { + InstanceScript* inst = player->GetInstanceScript(); + if (!inst) + return false; - if (inst->GetData(DATA_INSTANCE_PROGRESS) < INSTANCE_PROGRESS_AFTER_TUNNEL_WARN) - return false; + if (inst->GetData(DATA_INSTANCE_PROGRESS) < INSTANCE_PROGRESS_AFTER_TUNNEL_WARN) + return false; - if (inst->GetData(DATA_GARFROST) == DONE && inst->GetData(DATA_ICK) == DONE && inst->GetData(DATA_TYRANNUS) != DONE && !inst->GetData64(DATA_MARTIN_OR_GORKUN_GUID)) - { - if (Creature* c = inst->instance->SummonCreature(NPC_GORKUN_IRONSKULL_2, TSSpawnPos)) - c->GetMotionMaster()->MovePoint(0, TSMidPos); + if (inst->GetData(DATA_GARFROST) == DONE && inst->GetData(DATA_ICK) == DONE && inst->GetData(DATA_TYRANNUS) != DONE && !inst->GetData64(DATA_MARTIN_OR_GORKUN_GUID)) + { + if (Creature* c = inst->instance->SummonCreature(NPC_GORKUN_IRONSKULL_2, TSSpawnPos)) + c->GetMotionMaster()->MovePoint(0, TSMidPos); - inst->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_TYRANNUS_INTRO); - } + inst->SetData(DATA_INSTANCE_PROGRESS, INSTANCE_PROGRESS_TYRANNUS_INTRO); + } - return false; - } + return false; + } }; void AddSC_pit_of_saron() { - new npc_pos_leader(); - new npc_pos_deathwhisper_necrolyte(); - new npc_pos_after_first_boss(); - new npc_pos_tyrannus_events(); - new npc_pos_icicle_trigger(); - new npc_pos_collapsing_icicle(); - new npc_pos_martin_or_gorkun_second(); - new npc_pos_freed_slave(); - new npc_pos_leader_second(); - new npc_frostbite_invisible_stalker(); + new npc_pos_leader(); + new npc_pos_deathwhisper_necrolyte(); + new npc_pos_after_first_boss(); + new npc_pos_tyrannus_events(); + new npc_pos_icicle_trigger(); + new npc_pos_collapsing_icicle(); + new npc_pos_martin_or_gorkun_second(); + new npc_pos_freed_slave(); + new npc_pos_leader_second(); + new npc_frostbite_invisible_stalker(); - new spell_pos_empowered_blizzard(); - new spell_pos_slave_trigger_closest(); - new spell_pos_rimefang_frost_nova(); - new spell_pos_blight(); - new spell_pos_glacial_strike(); + new spell_pos_empowered_blizzard(); + new spell_pos_slave_trigger_closest(); + new spell_pos_rimefang_frost_nova(); + new spell_pos_blight(); + new spell_pos_glacial_strike(); - new at_tyrannus_event_starter(); + new at_tyrannus_event_starter(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h index bbbe291d8..97effee53 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h @@ -7,116 +7,116 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum DataTypes { - DATA_GARFROST, - DATA_ICK, - DATA_TYRANNUS, - MAX_ENCOUNTER, + DATA_GARFROST, + DATA_ICK, + DATA_TYRANNUS, + MAX_ENCOUNTER, - DATA_INSTANCE_PROGRESS, - DATA_TEAMID_IN_INSTANCE, - DATA_TYRANNUS_EVENT_GUID, - DATA_NECROLYTE_1_GUID, - DATA_NECROLYTE_2_GUID, - DATA_GUARD_1_GUID, - DATA_GUARD_2_GUID, - DATA_LEADER_FIRST_GUID, - DATA_GARFROST_GUID, - DATA_MARTIN_OR_GORKUN_GUID, - DATA_RIMEFANG_GUID, - DATA_TYRANNUS_GUID, - DATA_LEADER_SECOND_GUID, - DATA_SINDRAGOSA_GUID, - DATA_ACHIEV_ELEVEN, - DATA_ACHIEV_DONT_LOOK_UP, - DATA_START_INTRO, + DATA_INSTANCE_PROGRESS, + DATA_TEAMID_IN_INSTANCE, + DATA_TYRANNUS_EVENT_GUID, + DATA_NECROLYTE_1_GUID, + DATA_NECROLYTE_2_GUID, + DATA_GUARD_1_GUID, + DATA_GUARD_2_GUID, + DATA_LEADER_FIRST_GUID, + DATA_GARFROST_GUID, + DATA_MARTIN_OR_GORKUN_GUID, + DATA_RIMEFANG_GUID, + DATA_TYRANNUS_GUID, + DATA_LEADER_SECOND_GUID, + DATA_SINDRAGOSA_GUID, + DATA_ACHIEV_ELEVEN, + DATA_ACHIEV_DONT_LOOK_UP, + DATA_START_INTRO, }; enum InstanceProgressConst { - INSTANCE_PROGRESS_NONE, - INSTANCE_PROGRESS_FINISHED_INTRO, - INSTANCE_PROGRESS_FINISHED_KRICK_SCENE, - INSTANCE_PROGRESS_AFTER_WARN_1, - INSTANCE_PROGRESS_AFTER_WARN_2, - INSTANCE_PROGRESS_AFTER_TUNNEL_WARN, - INSTANCE_PROGRESS_TYRANNUS_INTRO, + INSTANCE_PROGRESS_NONE, + INSTANCE_PROGRESS_FINISHED_INTRO, + INSTANCE_PROGRESS_FINISHED_KRICK_SCENE, + INSTANCE_PROGRESS_AFTER_WARN_1, + INSTANCE_PROGRESS_AFTER_WARN_2, + INSTANCE_PROGRESS_AFTER_TUNNEL_WARN, + INSTANCE_PROGRESS_TYRANNUS_INTRO, }; enum CreatureIds { - NPC_GARFROST = 36494, - NPC_KRICK = 36477, - NPC_ICK = 36476, - NPC_TYRANNUS = 36658, - NPC_RIMEFANG = 36661, - NPC_SINDRAGOSA = 37755, + NPC_GARFROST = 36494, + NPC_KRICK = 36477, + NPC_ICK = 36476, + NPC_TYRANNUS = 36658, + NPC_RIMEFANG = 36661, + NPC_SINDRAGOSA = 37755, - NPC_TYRANNUS_EVENT = 36794, - NPC_TYRANNUS_VOICE = 36795, - NPC_SYLVANAS_PART1 = 36990, - NPC_SYLVANAS_PART2 = 38189, - NPC_JAINA_PART1 = 36993, - NPC_JAINA_PART2 = 38188, + NPC_TYRANNUS_EVENT = 36794, + NPC_TYRANNUS_VOICE = 36795, + NPC_SYLVANAS_PART1 = 36990, + NPC_SYLVANAS_PART2 = 38189, + NPC_JAINA_PART1 = 36993, + NPC_JAINA_PART2 = 38188, - NPC_KALIRA = 37583, - NPC_ELANDRA = 37774, - NPC_LORALEN = 37779, - NPC_KORELN = 37582, + NPC_KALIRA = 37583, + NPC_ELANDRA = 37774, + NPC_LORALEN = 37779, + NPC_KORELN = 37582, - NPC_CHAMPION_1_HORDE = 37584, - NPC_CHAMPION_2_HORDE = 37587, - NPC_CHAMPION_3_HORDE = 37588, - NPC_CHAMPION_1_ALLIANCE = 37496, - NPC_CHAMPION_2_ALLIANCE = 37497, + NPC_CHAMPION_1_HORDE = 37584, + NPC_CHAMPION_2_HORDE = 37587, + NPC_CHAMPION_3_HORDE = 37588, + NPC_CHAMPION_1_ALLIANCE = 37496, + NPC_CHAMPION_2_ALLIANCE = 37497, - NPC_HORDE_SLAVE_1 = 36770, - NPC_HORDE_SLAVE_2 = 36771, - NPC_HORDE_SLAVE_3 = 36772, - NPC_HORDE_SLAVE_4 = 36773, - NPC_ALLIANCE_SLAVE_1 = 36764, - NPC_ALLIANCE_SLAVE_2 = 36765, - NPC_ALLIANCE_SLAVE_3 = 36766, - NPC_ALLIANCE_SLAVE_4 = 36767, + NPC_HORDE_SLAVE_1 = 36770, + NPC_HORDE_SLAVE_2 = 36771, + NPC_HORDE_SLAVE_3 = 36772, + NPC_HORDE_SLAVE_4 = 36773, + NPC_ALLIANCE_SLAVE_1 = 36764, + NPC_ALLIANCE_SLAVE_2 = 36765, + NPC_ALLIANCE_SLAVE_3 = 36766, + NPC_ALLIANCE_SLAVE_4 = 36767, - NPC_RESCUED_ALLIANCE_SLAVE = 36888, - NPC_RESCUED_HORDE_SLAVE = 36889, + NPC_RESCUED_ALLIANCE_SLAVE = 36888, + NPC_RESCUED_HORDE_SLAVE = 36889, - NPC_YMIRJAR_DEATHBRINGER = 36892, - NPC_YMIRJAR_WRATHBRINGER = 36840, - NPC_YMIRJAR_FLAMEBEARER = 36893, + NPC_YMIRJAR_DEATHBRINGER = 36892, + NPC_YMIRJAR_WRATHBRINGER = 36840, + NPC_YMIRJAR_FLAMEBEARER = 36893, - NPC_FALLEN_WARRIOR = 36841, - NPC_WRATHBONE_COLDWRAITH = 36842, + NPC_FALLEN_WARRIOR = 36841, + NPC_WRATHBONE_COLDWRAITH = 36842, - NPC_MARTIN_VICTUS_1 = 37591, - NPC_GORKUN_IRONSKULL_1 = 37592, + NPC_MARTIN_VICTUS_1 = 37591, + NPC_GORKUN_IRONSKULL_1 = 37592, - NPC_MARTIN_VICTUS_2 = 37580, - NPC_GORKUN_IRONSKULL_2 = 37581, - NPC_FREED_SLAVE_1_ALLIANCE = 37576, // mage - NPC_FREED_SLAVE_2_ALLIANCE = 37575, // warr - NPC_FREED_SLAVE_3_ALLIANCE = 37572, // warr - NPC_FREED_SLAVE_1_HORDE = 37579, // mage - NPC_FREED_SLAVE_2_HORDE = 37578, // warr - NPC_FREED_SLAVE_3_HORDE = 37577, // warr + NPC_MARTIN_VICTUS_2 = 37580, + NPC_GORKUN_IRONSKULL_2 = 37581, + NPC_FREED_SLAVE_1_ALLIANCE = 37576, // mage + NPC_FREED_SLAVE_2_ALLIANCE = 37575, // warr + NPC_FREED_SLAVE_3_ALLIANCE = 37572, // warr + NPC_FREED_SLAVE_1_HORDE = 37579, // mage + NPC_FREED_SLAVE_2_HORDE = 37578, // warr + NPC_FREED_SLAVE_3_HORDE = 37577, // warr }; enum GameObjectIds { - GO_HOR_PORTCULLIS = 201848, - GO_ICE_WALL = 201885, + GO_HOR_PORTCULLIS = 201848, + GO_ICE_WALL = 201885, }; enum eSpells { - SPELL_NECROLYTE_CHANNELING = 30540, - SPELL_KRICK_KILL_CREDIT = 71308, - SPELL_TUNNEL_ICICLE = 69424, - SPELL_TELEPORT_JAINA_VISUAL = 70623, - SPELL_TELEPORT_JAINA = 70525, - SPELL_TELEPORT_SYLVANAS_VISUAL = 70638, - SPELL_TELEPORT_SYLVANAS = 70639, - SPELL_SINDRAGOSA_FROST_BOMB_POS = 70521, + SPELL_NECROLYTE_CHANNELING = 30540, + SPELL_KRICK_KILL_CREDIT = 71308, + SPELL_TUNNEL_ICICLE = 69424, + SPELL_TELEPORT_JAINA_VISUAL = 70623, + SPELL_TELEPORT_JAINA = 70525, + SPELL_TELEPORT_SYLVANAS_VISUAL = 70638, + SPELL_TELEPORT_SYLVANAS = 70639, + SPELL_SINDRAGOSA_FROST_BOMB_POS = 70521, }; #define PATH_BEGIN_VALUE 3000200 @@ -127,19 +127,19 @@ enum eSpells enum eIntroTexts { - SAY_TYRANNUS_INTRO_1 = 1, - SAY_JAINA_INTRO_1 = 2, - SAY_SYLVANAS_INTRO_1 = 3, - SAY_TYRANNUS_INTRO_2 = 4, - SAY_TYRANNUS_INTRO_3 = 5, - SAY_JAINA_INTRO_2 = 6, - SAY_SYLVANAS_INTRO_2 = 7, - SAY_TYRANNUS_INTRO_4 = 8, - SAY_JAINA_INTRO_3 = 9, - SAY_JAINA_INTRO_4 = 10, - SAY_SYLVANAS_INTRO_3 = 11, - SAY_JAINA_INTRO_5 = 12, - SAY_SYLVANAS_INTRO_4 = 13, + SAY_TYRANNUS_INTRO_1 = 1, + SAY_JAINA_INTRO_1 = 2, + SAY_SYLVANAS_INTRO_1 = 3, + SAY_TYRANNUS_INTRO_2 = 4, + SAY_TYRANNUS_INTRO_3 = 5, + SAY_JAINA_INTRO_2 = 6, + SAY_SYLVANAS_INTRO_2 = 7, + SAY_TYRANNUS_INTRO_4 = 8, + SAY_JAINA_INTRO_3 = 9, + SAY_JAINA_INTRO_4 = 10, + SAY_SYLVANAS_INTRO_3 = 11, + SAY_JAINA_INTRO_5 = 12, + SAY_SYLVANAS_INTRO_4 = 13, }; const Position PortalPos = {424.46f, 212.16f, 528.8f, 0.0f}; @@ -149,34 +149,34 @@ const Position NecrolytePos2 = {506.127f, 231.46f, 528.71f, M_PI}; struct ChampionPosition { - uint32 entry[2]; - Position endPosition; + uint32 entry[2]; + Position endPosition; }; const ChampionPosition introPositions[] = { - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 452.884f, 209.141f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 450.541f, 212.28f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 449.835f, 206.68f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 446.542f, 209.986f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 447.29f, 213.916f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 445.794f, 206.057f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 452.884f, 209.141f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 450.541f, 212.28f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 449.835f, 206.68f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 446.542f, 209.986f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 447.29f, 213.916f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_2_HORDE }, { 445.794f, 206.057f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 446.74f, 228.577f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 449.19f, 226.21f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 447.352f, 222.754f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 443.346f, 192.343f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 446.293f, 195.047f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 444.035f, 197.67f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 442.69f, 223.525f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 442.967f, 219.535f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 442.526f, 199.361f, 528.84f, 0.0f } }, - { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 442.843f, 203.193f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 446.74f, 228.577f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 449.19f, 226.21f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 447.352f, 222.754f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 443.346f, 192.343f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 446.293f, 195.047f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_1_ALLIANCE, NPC_CHAMPION_1_HORDE }, { 444.035f, 197.67f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 442.69f, 223.525f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 442.967f, 219.535f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 442.526f, 199.361f, 528.84f, 0.0f } }, + { { NPC_CHAMPION_2_ALLIANCE, NPC_CHAMPION_3_HORDE }, { 442.843f, 203.193f, 528.84f, 0.0f } }, - { { NPC_LORALEN, NPC_LORALEN }, { 438.505f, 211.54f, 528.71f, 0.0f } }, - { { NPC_LORALEN, NPC_KALIRA }, { 438.946f, 215.427f, 528.71f, 0.0f } }, + { { NPC_LORALEN, NPC_LORALEN }, { 438.505f, 211.54f, 528.71f, 0.0f } }, + { { NPC_LORALEN, NPC_KALIRA }, { 438.946f, 215.427f, 528.71f, 0.0f } }, - { { 0, 0 }, { 0.0f, 0.0f, 0.0f, 0.0f } } + { { 0, 0 }, { 0.0f, 0.0f, 0.0f, 0.0f } } }; /************ @@ -185,30 +185,30 @@ const ChampionPosition introPositions[] = enum eFBSTexts { - SAY_GENERAL_GARFROST = 21, - SAY_TYRANNUS_GARFROST = 20, + SAY_GENERAL_GARFROST = 21, + SAY_TYRANNUS_GARFROST = 20, }; const Position FBSSpawnPos = {695.685f, -118.825f, 513.877f, 3*M_PI/2}; struct FBSPosition { - uint32 entry; - uint32 pathId; + uint32 entry; + uint32 pathId; }; const FBSPosition FBSData[] = { - { NPC_HORDE_SLAVE_1, PATH_BEGIN_VALUE+0 }, - { NPC_HORDE_SLAVE_1, PATH_BEGIN_VALUE+1 }, - { NPC_HORDE_SLAVE_2, PATH_BEGIN_VALUE+2 }, - { NPC_HORDE_SLAVE_2, PATH_BEGIN_VALUE+3 }, - { NPC_HORDE_SLAVE_2, PATH_BEGIN_VALUE+4 }, - { NPC_HORDE_SLAVE_3, PATH_BEGIN_VALUE+5 }, - { NPC_HORDE_SLAVE_3, PATH_BEGIN_VALUE+6 }, - { NPC_HORDE_SLAVE_4, PATH_BEGIN_VALUE+7 }, - { NPC_HORDE_SLAVE_4, PATH_BEGIN_VALUE+8 }, - { 0, 0 } + { NPC_HORDE_SLAVE_1, PATH_BEGIN_VALUE+0 }, + { NPC_HORDE_SLAVE_1, PATH_BEGIN_VALUE+1 }, + { NPC_HORDE_SLAVE_2, PATH_BEGIN_VALUE+2 }, + { NPC_HORDE_SLAVE_2, PATH_BEGIN_VALUE+3 }, + { NPC_HORDE_SLAVE_2, PATH_BEGIN_VALUE+4 }, + { NPC_HORDE_SLAVE_3, PATH_BEGIN_VALUE+5 }, + { NPC_HORDE_SLAVE_3, PATH_BEGIN_VALUE+6 }, + { NPC_HORDE_SLAVE_4, PATH_BEGIN_VALUE+7 }, + { NPC_HORDE_SLAVE_4, PATH_BEGIN_VALUE+8 }, + { 0, 0 } }; /************ @@ -222,18 +222,18 @@ const Position SBSLeaderEndPos = {823.2f, -4.4497f, 509.49f, 0.86f}; enum eSBSTexts { - SAY_OUTRO_KRICK_1 = 35, - SAY_JAINA_KRICK_1 = 36, - SAY_SYLVANAS_KRICK_1 = 37, - SAY_OUTRO_KRICK_2 = 38, - SAY_JAINA_KRICK_2 = 39, - SAY_SYLVANAS_KRICK_2 = 40, - SAY_OUTRO_KRICK_3 = 41, - SAY_TYRANNUS_KRICK_1 = 42, - SAY_OUTRO_KRICK_4 = 43, - SAY_TYRANNUS_KRICK_2 = 44, - SAY_JAINA_KRICK_3 = 45, - SAY_SYLVANAS_KRICK_3 = 46, + SAY_OUTRO_KRICK_1 = 35, + SAY_JAINA_KRICK_1 = 36, + SAY_SYLVANAS_KRICK_1 = 37, + SAY_OUTRO_KRICK_2 = 38, + SAY_JAINA_KRICK_2 = 39, + SAY_SYLVANAS_KRICK_2 = 40, + SAY_OUTRO_KRICK_3 = 41, + SAY_TYRANNUS_KRICK_1 = 42, + SAY_OUTRO_KRICK_4 = 43, + SAY_TYRANNUS_KRICK_2 = 44, + SAY_JAINA_KRICK_3 = 45, + SAY_SYLVANAS_KRICK_3 = 46, }; /************ @@ -246,9 +246,9 @@ const Position PTSTyrannusWaitPos3 = {1117.93f, -125.16f, 760.34f, 0.10f}; enum ePTSTexts { - SAY_TYRANNUS_AMBUSH_1 = 47, - SAY_TYRANNUS_AMBUSH_2 = 48, - SAY_TYRANNUS_TRAP_TUNNEL = 49, + SAY_TYRANNUS_AMBUSH_1 = 47, + SAY_TYRANNUS_AMBUSH_2 = 48, + SAY_TYRANNUS_TRAP_TUNNEL = 49, }; /************ @@ -266,47 +266,47 @@ const Position TSSindragosaPos2 = {948.39f, 215.47f, 653.71f, 5.51f}; struct TSPosition { - uint32 entry; - float x,y; + uint32 entry; + float x,y; }; const TSPosition TSData[] = { - { NPC_FREED_SLAVE_3_HORDE, 1047.8f, 126.01f }, - { NPC_FREED_SLAVE_3_HORDE, 1049.21f, 127.10f }, - { NPC_FREED_SLAVE_3_HORDE, 1051.68f, 129.02f }, - { NPC_FREED_SLAVE_3_HORDE, 1053.24f, 130.23f }, - { NPC_FREED_SLAVE_1_HORDE, 1044.82f, 121.30f }, - { NPC_FREED_SLAVE_1_HORDE, 1049.33f, 124.01f }, - { NPC_FREED_SLAVE_1_HORDE, 1056.79f, 130.86f }, - { NPC_FREED_SLAVE_2_HORDE, 1045.56f, 118.46f }, - { NPC_FREED_SLAVE_2_HORDE, 1047.75f, 120.85f }, - { NPC_FREED_SLAVE_2_HORDE, 1052.93f, 124.156f }, - { NPC_FREED_SLAVE_2_HORDE, 1057.35f, 127.95f }, - { NPC_FREED_SLAVE_2_HORDE, 1059.18f, 129.86f }, - { NPC_FREED_SLAVE_2_HORDE, 1049.865f, 118.735f }, - { NPC_FREED_SLAVE_2_HORDE, 1052.32f, 121.827f }, - { NPC_FREED_SLAVE_2_HORDE, 1055.38f, 123.99f }, - { NPC_FREED_SLAVE_2_HORDE, 1058.723f, 125.98f }, - { 0, 0.0f, 0.0f } + { NPC_FREED_SLAVE_3_HORDE, 1047.8f, 126.01f }, + { NPC_FREED_SLAVE_3_HORDE, 1049.21f, 127.10f }, + { NPC_FREED_SLAVE_3_HORDE, 1051.68f, 129.02f }, + { NPC_FREED_SLAVE_3_HORDE, 1053.24f, 130.23f }, + { NPC_FREED_SLAVE_1_HORDE, 1044.82f, 121.30f }, + { NPC_FREED_SLAVE_1_HORDE, 1049.33f, 124.01f }, + { NPC_FREED_SLAVE_1_HORDE, 1056.79f, 130.86f }, + { NPC_FREED_SLAVE_2_HORDE, 1045.56f, 118.46f }, + { NPC_FREED_SLAVE_2_HORDE, 1047.75f, 120.85f }, + { NPC_FREED_SLAVE_2_HORDE, 1052.93f, 124.156f }, + { NPC_FREED_SLAVE_2_HORDE, 1057.35f, 127.95f }, + { NPC_FREED_SLAVE_2_HORDE, 1059.18f, 129.86f }, + { NPC_FREED_SLAVE_2_HORDE, 1049.865f, 118.735f }, + { NPC_FREED_SLAVE_2_HORDE, 1052.32f, 121.827f }, + { NPC_FREED_SLAVE_2_HORDE, 1055.38f, 123.99f }, + { NPC_FREED_SLAVE_2_HORDE, 1058.723f, 125.98f }, + { 0, 0.0f, 0.0f } }; enum eTSTexts { - SAY_PREFIGHT_1 = 50, - SAY_GENERAL_HORDE_TRASH = 51, - SAY_PREFIGHT_2 = 52, - SAY_PREFIGHT_AGGRO = 53, + SAY_PREFIGHT_1 = 50, + SAY_GENERAL_HORDE_TRASH = 51, + SAY_PREFIGHT_2 = 52, + SAY_PREFIGHT_AGGRO = 53, - SAY_GENERAL_HORDE_OUTRO_1 = 61, - SAY_GENERAL_OUTRO_2 = 62, - SAY_JAINA_OUTRO_1 = 63, - SAY_SYLVANAS_OUTRO_1 = 64, - SAY_JAINA_OUTRO_2 = 65, - SAY_JAINA_OUTRO_3 = 66, - SAY_SYLVANAS_OUTRO_2 = 67, - SAY_GENERAL_ALLIANCE_OUTRO_1 = 68, - SAY_GENERAL_ALLIANCE_TRASH = 69, + SAY_GENERAL_HORDE_OUTRO_1 = 61, + SAY_GENERAL_OUTRO_2 = 62, + SAY_JAINA_OUTRO_1 = 63, + SAY_SYLVANAS_OUTRO_1 = 64, + SAY_JAINA_OUTRO_2 = 65, + SAY_JAINA_OUTRO_3 = 66, + SAY_SYLVANAS_OUTRO_2 = 67, + SAY_GENERAL_ALLIANCE_OUTRO_1 = 68, + SAY_GENERAL_ALLIANCE_TRASH = 69, }; #endif diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index 9e78060d4..c6ffa4792 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -8,56 +8,56 @@ REWRITTEN BY XINEF enum Spells { - SPELL_MOJO_PUDDLE = 55627, - SPELL_MOJO_WAVE = 55626, - SPELL_FREEZE_ANIM = 52656, - SPELL_MIGHTY_BLOW = 54719, + SPELL_MOJO_PUDDLE = 55627, + SPELL_MOJO_WAVE = 55626, + SPELL_FREEZE_ANIM = 52656, + SPELL_MIGHTY_BLOW = 54719, - SPELL_ELEMENTAL_SPAWN_EFFECT = 54888, - SPELL_EMERGE = 54850, - SPELL_EMERGE_SUMMON = 54851, - SPELL_MOJO_VOLLEY = 54849, + SPELL_ELEMENTAL_SPAWN_EFFECT = 54888, + SPELL_EMERGE = 54850, + SPELL_EMERGE_SUMMON = 54851, + SPELL_MOJO_VOLLEY = 54849, - SPELL_SURGE_VISUAL = 54827, - SPELL_SURGE = 54801, - SPELL_SURGE_DAMAGE = 54819, + SPELL_SURGE_VISUAL = 54827, + SPELL_SURGE = 54801, + SPELL_SURGE_DAMAGE = 54819, - SPELL_FACE_ME = 54991, - SPELL_MERGE = 54878, + SPELL_FACE_ME = 54991, + SPELL_MERGE = 54878, }; enum Misc { - NPC_LIVING_MOJO = 29830, - NPC_DRAKKARI_ELEMENTAL = 29573, + NPC_LIVING_MOJO = 29830, + NPC_DRAKKARI_ELEMENTAL = 29573, - ACTION_MERGE = 1, - ACTION_INFORM = 2, + ACTION_MERGE = 1, + ACTION_INFORM = 2, - POINT_MERGE = 1, - SAY_SURGE = 0, - EMOTE_ALTAR = 1, + POINT_MERGE = 1, + SAY_SURGE = 0, + EMOTE_ALTAR = 1, - EVENT_COLOSSUS_MIGHTY_BLOW = 1, - EVENT_COLOSSUS_HEALTH_1 = 2, - EVENT_COLOSSUS_HEALTH_2 = 3, - EVENT_COLOSSUS_START_FIGHT = 4, + EVENT_COLOSSUS_MIGHTY_BLOW = 1, + EVENT_COLOSSUS_HEALTH_1 = 2, + EVENT_COLOSSUS_HEALTH_2 = 3, + EVENT_COLOSSUS_START_FIGHT = 4, - EVENT_ELEMENTAL_HEALTH = 10, - EVENT_ELEMENTAL_SURGE = 11, - EVENT_ELEMENTAL_VOLLEY = 12, + EVENT_ELEMENTAL_HEALTH = 10, + EVENT_ELEMENTAL_SURGE = 11, + EVENT_ELEMENTAL_VOLLEY = 12, - EVENT_MOJO_MOJO_WAVE = 20, - EVENT_MOJO_MOJO_PUDDLE = 21, + EVENT_MOJO_MOJO_WAVE = 20, + EVENT_MOJO_MOJO_PUDDLE = 21, }; static Position mojoPosition[] = { - {1663.1f, 743.6f, 143.1f}, - {1669.97f, 753.7f, 143.1f}, - {1680.7f, 750.7f, 143.1f}, - {1680.7f, 737.1f, 143.1f}, - {1670.4f, 733.5f, 143.1f} + {1663.1f, 743.6f, 143.1f}, + {1669.97f, 753.7f, 143.1f}, + {1680.7f, 750.7f, 143.1f}, + {1680.7f, 737.1f, 143.1f}, + {1670.4f, 733.5f, 143.1f} }; class RestoreFight : public BasicEvent @@ -67,8 +67,8 @@ class RestoreFight : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - _owner->SetReactState(REACT_AGGRESSIVE); - _owner->SetInCombatWithZone(); + _owner->SetReactState(REACT_AGGRESSIVE); + _owner->SetInCombatWithZone(); return true; } @@ -78,319 +78,319 @@ class RestoreFight : public BasicEvent class boss_drakkari_colossus : public CreatureScript { - public: - boss_drakkari_colossus() : CreatureScript("boss_drakkari_colossus") { } + public: + boss_drakkari_colossus() : CreatureScript("boss_drakkari_colossus") { } - CreatureAI* GetAI(Creature* creature) const - { - return new boss_drakkari_colossusAI (creature); - } - struct boss_drakkari_colossusAI : public BossAI - { - boss_drakkari_colossusAI(Creature* creature) : BossAI(creature, DATA_DRAKKARI_COLOSSUS) - { - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_drakkari_colossusAI (creature); + } + struct boss_drakkari_colossusAI : public BossAI + { + boss_drakkari_colossusAI(Creature* creature) : BossAI(creature, DATA_DRAKKARI_COLOSSUS) + { + } - void MoveInLineOfSight(Unit* who) - { - } + void MoveInLineOfSight(Unit* who) + { + } - void DoAction(int32 param) - { - if (param == ACTION_INFORM) - { - me->SetInCombatWithZone(); - summons.DoAction(ACTION_MERGE); - events.ScheduleEvent(EVENT_COLOSSUS_START_FIGHT, 3500); - } - } + void DoAction(int32 param) + { + if (param == ACTION_INFORM) + { + me->SetInCombatWithZone(); + summons.DoAction(ACTION_MERGE); + events.ScheduleEvent(EVENT_COLOSSUS_START_FIGHT, 3500); + } + } - void Reset() - { - BossAI::Reset(); - for (uint8 i = 0; i < 5; i++) - me->SummonCreature(NPC_LIVING_MOJO, mojoPosition[i].GetPositionX(), mojoPosition[i].GetPositionY(), mojoPosition[i].GetPositionZ(), 0, TEMPSUMMON_MANUAL_DESPAWN, 0); + void Reset() + { + BossAI::Reset(); + for (uint8 i = 0; i < 5; i++) + me->SummonCreature(NPC_LIVING_MOJO, mojoPosition[i].GetPositionX(), mojoPosition[i].GetPositionY(), mojoPosition[i].GetPositionZ(), 0, TEMPSUMMON_MANUAL_DESPAWN, 0); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } - void InitializeAI() - { - BossAI::InitializeAI(); - me->CastSpell(me, SPELL_FREEZE_ANIM, true); - } + void InitializeAI() + { + BossAI::InitializeAI(); + me->CastSpell(me, SPELL_FREEZE_ANIM, true); + } - void JustReachedHome() - { - BossAI::JustReachedHome(); - me->CastSpell(me, SPELL_FREEZE_ANIM, true); - } - - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_COLOSSUS_MIGHTY_BLOW, 10000); - events.ScheduleEvent(EVENT_COLOSSUS_HEALTH_1, 1000); - events.ScheduleEvent(EVENT_COLOSSUS_HEALTH_2, 1000); - } + void JustReachedHome() + { + BossAI::JustReachedHome(); + me->CastSpell(me, SPELL_FREEZE_ANIM, true); + } + + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + events.ScheduleEvent(EVENT_COLOSSUS_MIGHTY_BLOW, 10000); + events.ScheduleEvent(EVENT_COLOSSUS_HEALTH_1, 1000); + events.ScheduleEvent(EVENT_COLOSSUS_HEALTH_2, 1000); + } - void JustSummoned(Creature* summon) - { - if (summon->GetEntry() == NPC_DRAKKARI_ELEMENTAL) - { - summon->SetRegeneratingHealth(false); - summon->SetReactState(REACT_PASSIVE); - summon->m_Events.AddEvent(new RestoreFight(summon), summon->m_Events.CalculateTime(3000)); - if (events.GetNextEventTime(EVENT_COLOSSUS_HEALTH_2) == 0) - { - summon->SetHealth(summon->GetMaxHealth()/2); - summon->LowerPlayerDamageReq(summon->GetMaxHealth()/2); - summon->AI()->DoAction(ACTION_INFORM); - } - } + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() == NPC_DRAKKARI_ELEMENTAL) + { + summon->SetRegeneratingHealth(false); + summon->SetReactState(REACT_PASSIVE); + summon->m_Events.AddEvent(new RestoreFight(summon), summon->m_Events.CalculateTime(3000)); + if (events.GetNextEventTime(EVENT_COLOSSUS_HEALTH_2) == 0) + { + summon->SetHealth(summon->GetMaxHealth()/2); + summon->LowerPlayerDamageReq(summon->GetMaxHealth()/2); + summon->AI()->DoAction(ACTION_INFORM); + } + } - summons.Summon(summon); - } + summons.Summon(summon); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - if (summon->GetEntry() == NPC_DRAKKARI_ELEMENTAL) - Unit::Kill(me, me); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + if (summon->GetEntry() == NPC_DRAKKARI_ELEMENTAL) + Unit::Kill(me, me); + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - if (summon->GetEntry() == NPC_DRAKKARI_ELEMENTAL) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); - if (me->GetVictim()) - me->GetMotionMaster()->MoveChase(me->GetVictim()); - } - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + if (summon->GetEntry() == NPC_DRAKKARI_ELEMENTAL) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); + if (me->GetVictim()) + me->GetMotionMaster()->MoveChase(me->GetVictim()); + } + } - void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - damage = 0; - } + void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + damage = 0; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_COLOSSUS_START_FIGHT: - me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - break; - case EVENT_COLOSSUS_MIGHTY_BLOW: - me->CastSpell(me->GetVictim(), SPELL_MIGHTY_BLOW, false); - events.ScheduleEvent(EVENT_COLOSSUS_MIGHTY_BLOW, 10000); - break; - case EVENT_COLOSSUS_HEALTH_1: - if (me->HealthBelowPct(51)) - { - me->CastSpell(me, SPELL_EMERGE, false); - me->CastSpell(me, SPELL_EMERGE_SUMMON, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->GetMotionMaster()->Clear(); - break; - } - events.ScheduleEvent(EVENT_COLOSSUS_HEALTH_1, 1000); - break; - case EVENT_COLOSSUS_HEALTH_2: - if (me->HealthBelowPct(21)) - { - me->CastSpell(me, SPELL_EMERGE, false); - me->CastSpell(me, SPELL_EMERGE_SUMMON, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->GetMotionMaster()->Clear(); - break; - } - events.ScheduleEvent(EVENT_COLOSSUS_HEALTH_2, 1000); - break; - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_COLOSSUS_START_FIGHT: + me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + break; + case EVENT_COLOSSUS_MIGHTY_BLOW: + me->CastSpell(me->GetVictim(), SPELL_MIGHTY_BLOW, false); + events.ScheduleEvent(EVENT_COLOSSUS_MIGHTY_BLOW, 10000); + break; + case EVENT_COLOSSUS_HEALTH_1: + if (me->HealthBelowPct(51)) + { + me->CastSpell(me, SPELL_EMERGE, false); + me->CastSpell(me, SPELL_EMERGE_SUMMON, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->Clear(); + break; + } + events.ScheduleEvent(EVENT_COLOSSUS_HEALTH_1, 1000); + break; + case EVENT_COLOSSUS_HEALTH_2: + if (me->HealthBelowPct(21)) + { + me->CastSpell(me, SPELL_EMERGE, false); + me->CastSpell(me, SPELL_EMERGE_SUMMON, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->Clear(); + break; + } + events.ScheduleEvent(EVENT_COLOSSUS_HEALTH_2, 1000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_drakkari_elemental : public CreatureScript { - public: - boss_drakkari_elemental() : CreatureScript("boss_drakkari_elemental") { } + public: + boss_drakkari_elemental() : CreatureScript("boss_drakkari_elemental") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_drakkari_elementalAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_drakkari_elementalAI (pCreature); + } - struct boss_drakkari_elementalAI : public ScriptedAI - { - boss_drakkari_elementalAI(Creature* pCreature) : ScriptedAI(pCreature) - { - events.ScheduleEvent(EVENT_ELEMENTAL_HEALTH, 1000); - events.ScheduleEvent(EVENT_ELEMENTAL_SURGE, 7000); - events.ScheduleEvent(EVENT_ELEMENTAL_VOLLEY, 0); - } + struct boss_drakkari_elementalAI : public ScriptedAI + { + boss_drakkari_elementalAI(Creature* pCreature) : ScriptedAI(pCreature) + { + events.ScheduleEvent(EVENT_ELEMENTAL_HEALTH, 1000); + events.ScheduleEvent(EVENT_ELEMENTAL_SURGE, 7000); + events.ScheduleEvent(EVENT_ELEMENTAL_VOLLEY, 0); + } - EventMap events; + EventMap events; - void DoAction(int32 param) - { - if (param == ACTION_INFORM) - events.CancelEvent(EVENT_ELEMENTAL_HEALTH); - } + void DoAction(int32 param) + { + if (param == ACTION_INFORM) + events.CancelEvent(EVENT_ELEMENTAL_HEALTH); + } - void Reset() - { - me->CastSpell(me, SPELL_ELEMENTAL_SPAWN_EFFECT, false); - } + void Reset() + { + me->CastSpell(me, SPELL_ELEMENTAL_SPAWN_EFFECT, false); + } - void JustDied(Unit*) - { - Talk(EMOTE_ALTAR); - } + void JustDied(Unit*) + { + Talk(EMOTE_ALTAR); + } - void EnterCombat(Unit*) - { - } + void EnterCombat(Unit*) + { + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasUnitState(UNIT_STATE_CHARGING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasUnitState(UNIT_STATE_CHARGING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ELEMENTAL_HEALTH: - if (me->HealthBelowPct(51)) - { - me->CastSpell(me, SPELL_FACE_ME, true); - me->CastSpell(me, SPELL_SURGE_VISUAL, true); - me->CastSpell(me, SPELL_MERGE, false); - me->DespawnOrUnsummon(2000); - events.Reset(); - break; - } - events.ScheduleEvent(EVENT_ELEMENTAL_HEALTH, 1000); - break; - case EVENT_ELEMENTAL_SURGE: - Talk(SAY_SURGE); - me->CastSpell(me, SPELL_SURGE_VISUAL, true); - me->CastSpell(me->GetVictim(), SPELL_SURGE, false); - events.ScheduleEvent(EVENT_ELEMENTAL_SURGE, 15000); - break; - case EVENT_ELEMENTAL_VOLLEY: - me->CastSpell(me, SPELL_MOJO_VOLLEY, true); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_ELEMENTAL_HEALTH: + if (me->HealthBelowPct(51)) + { + me->CastSpell(me, SPELL_FACE_ME, true); + me->CastSpell(me, SPELL_SURGE_VISUAL, true); + me->CastSpell(me, SPELL_MERGE, false); + me->DespawnOrUnsummon(2000); + events.Reset(); + break; + } + events.ScheduleEvent(EVENT_ELEMENTAL_HEALTH, 1000); + break; + case EVENT_ELEMENTAL_SURGE: + Talk(SAY_SURGE); + me->CastSpell(me, SPELL_SURGE_VISUAL, true); + me->CastSpell(me->GetVictim(), SPELL_SURGE, false); + events.ScheduleEvent(EVENT_ELEMENTAL_SURGE, 15000); + break; + case EVENT_ELEMENTAL_VOLLEY: + me->CastSpell(me, SPELL_MOJO_VOLLEY, true); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_living_mojo : public CreatureScript { - public: - npc_living_mojo() : CreatureScript("npc_living_mojo") { } + public: + npc_living_mojo() : CreatureScript("npc_living_mojo") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_living_mojoAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_living_mojoAI (pCreature); + } - struct npc_living_mojoAI : public ScriptedAI - { - npc_living_mojoAI(Creature* pCreature) : ScriptedAI(pCreature) - { - } + struct npc_living_mojoAI : public ScriptedAI + { + npc_living_mojoAI(Creature* pCreature) : ScriptedAI(pCreature) + { + } - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - events.ScheduleEvent(EVENT_MOJO_MOJO_PUDDLE, 13000); - events.ScheduleEvent(EVENT_MOJO_MOJO_WAVE, 15000); - } + void Reset() + { + events.Reset(); + events.ScheduleEvent(EVENT_MOJO_MOJO_PUDDLE, 13000); + events.ScheduleEvent(EVENT_MOJO_MOJO_WAVE, 15000); + } - void MoveInLineOfSight(Unit* who) - { - if (me->ToTempSummon()) - return; + void MoveInLineOfSight(Unit* who) + { + if (me->ToTempSummon()) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void AttackStart(Unit* who) - { - if (me->ToTempSummon()) - { - if (who->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(who->GetOwnerGUID())) - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - summoner->GetAI()->DoAction(ACTION_INFORM); - return; - } + void AttackStart(Unit* who) + { + if (me->ToTempSummon()) + { + if (who->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(who->GetOwnerGUID())) + if (Unit* summoner = me->ToTempSummon()->GetSummoner()) + summoner->GetAI()->DoAction(ACTION_INFORM); + return; + } - ScriptedAI::AttackStart(who); - } + ScriptedAI::AttackStart(who); + } - void DoAction(int32 param) - { - if (param == ACTION_MERGE) - { - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveCharge(1672.96f, 743.488f, 143.338f, 7.0f, POINT_MERGE); - me->DespawnOrUnsummon(1200); - } - } + void DoAction(int32 param) + { + if (param == ACTION_MERGE) + { + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MoveCharge(1672.96f, 743.488f, 143.338f, 7.0f, POINT_MERGE); + me->DespawnOrUnsummon(1200); + } + } - void UpdateAI(uint32 diff) - { - if (me->ToTempSummon() || !UpdateVictim()) - return; - - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + void UpdateAI(uint32 diff) + { + if (me->ToTempSummon() || !UpdateVictim()) + return; + + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_MOJO_MOJO_PUDDLE: - { - me->CastSpell(me, SPELL_MOJO_PUDDLE, false); - events.ScheduleEvent(EVENT_MOJO_MOJO_PUDDLE, 13000); - break; - } - case EVENT_MOJO_MOJO_WAVE: - { - me->CastSpell(me->GetVictim(), SPELL_MOJO_WAVE, false); - events.ScheduleEvent(EVENT_MOJO_MOJO_WAVE, 15000); - break; - } - } + switch (events.ExecuteEvent()) + { + case EVENT_MOJO_MOJO_PUDDLE: + { + me->CastSpell(me, SPELL_MOJO_PUDDLE, false); + events.ScheduleEvent(EVENT_MOJO_MOJO_PUDDLE, 13000); + break; + } + case EVENT_MOJO_MOJO_WAVE: + { + me->CastSpell(me->GetVictim(), SPELL_MOJO_WAVE, false); + events.ScheduleEvent(EVENT_MOJO_MOJO_WAVE, 15000); + break; + } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_drakkari_colossus_emerge : public SpellScriptLoader @@ -458,10 +458,10 @@ class spell_drakkari_colossus_face_me : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - { - GetCaster()->SetInFront(target); + { + GetCaster()->SetInFront(target); GetCaster()->SetFacingTo(GetCaster()->GetAngle(target)); - } + } } void Register() @@ -481,7 +481,7 @@ void AddSC_boss_drakkari_colossus() new boss_drakkari_colossus(); new boss_drakkari_elemental(); new npc_living_mojo(); - new spell_drakkari_colossus_emerge(); - new spell_drakkari_colossus_surge(); - new spell_drakkari_colossus_face_me(); + new spell_drakkari_colossus_emerge(); + new spell_drakkari_colossus_surge(); + new spell_drakkari_colossus_face_me(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp index 167f7828a..fc28e8431 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp @@ -8,122 +8,122 @@ REWRITTEN BY XINEF enum Spells { - SPELL_ECK_BERSERK = 55816, - SPELL_ECK_BITE = 55813, - SPELL_ECK_SPIT = 55814, - SPELL_ECK_SPRING = 55815, - SPELL_ECK_SPRING_INIT = 55837 + SPELL_ECK_BERSERK = 55816, + SPELL_ECK_BITE = 55813, + SPELL_ECK_SPIT = 55814, + SPELL_ECK_SPRING = 55815, + SPELL_ECK_SPRING_INIT = 55837 }; enum Misc { - POINT_START = 0, - EVENT_ECK_BERSERK = 1, - EVENT_ECK_BITE = 2, - EVENT_ECK_SPIT = 3, - EVENT_ECK_SPRING = 4, - EVENT_ECK_HEALTH = 5 + POINT_START = 0, + EVENT_ECK_BERSERK = 1, + EVENT_ECK_BITE = 2, + EVENT_ECK_SPIT = 3, + EVENT_ECK_SPRING = 4, + EVENT_ECK_HEALTH = 5 }; class boss_eck : public CreatureScript { - public: - boss_eck() : CreatureScript("boss_eck") { } + public: + boss_eck() : CreatureScript("boss_eck") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_eckAI : public BossAI - { - boss_eckAI(Creature* creature) : BossAI(creature, DATA_ECK_THE_FEROCIOUS) - { - } + struct boss_eckAI : public BossAI + { + boss_eckAI(Creature* creature) : BossAI(creature, DATA_ECK_THE_FEROCIOUS) + { + } - void InitializeAI() - { - BossAI::InitializeAI(); - me->GetMotionMaster()->MovePoint(POINT_START, 1638.55f, 919.76f, 104.95f, false); - me->SetHomePosition(1642.712f, 934.646f, 107.205f, 0.767f); - me->SetReactState(REACT_PASSIVE); - } + void InitializeAI() + { + BossAI::InitializeAI(); + me->GetMotionMaster()->MovePoint(POINT_START, 1638.55f, 919.76f, 104.95f, false); + me->SetHomePosition(1642.712f, 934.646f, 107.205f, 0.767f); + me->SetReactState(REACT_PASSIVE); + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == POINT_START) - { - me->CastSpell(me, SPELL_ECK_SPRING_INIT, true); - me->SetReactState(REACT_AGGRESSIVE); - } - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == POINT_START) + { + me->CastSpell(me, SPELL_ECK_SPRING_INIT, true); + me->SetReactState(REACT_AGGRESSIVE); + } + } - void Reset() - { - BossAI::Reset(); - } + void Reset() + { + BossAI::Reset(); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_ECK_BERSERK, urand(60000, 90000)); - events.ScheduleEvent(EVENT_ECK_BITE, 5000); - events.ScheduleEvent(EVENT_ECK_SPIT, 10000); - events.ScheduleEvent(EVENT_ECK_SPRING, 8000); - } + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + events.ScheduleEvent(EVENT_ECK_BERSERK, urand(60000, 90000)); + events.ScheduleEvent(EVENT_ECK_BITE, 5000); + events.ScheduleEvent(EVENT_ECK_SPIT, 10000); + events.ScheduleEvent(EVENT_ECK_SPRING, 8000); + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ECK_HEALTH: - if (me->HealthBelowPct(21)) - { - events.CancelEvent(EVENT_ECK_BERSERK); - me->CastSpell(me, SPELL_ECK_BERSERK, false); - break; - } - events.ScheduleEvent(EVENT_ECK_HEALTH, 1000); - break; - case EVENT_ECK_BERSERK: - me->CastSpell(me, SPELL_ECK_BERSERK, false); - events.CancelEvent(EVENT_ECK_HEALTH); - break; - case EVENT_ECK_BITE: - me->CastSpell(me->GetVictim(), SPELL_ECK_BITE, false); - events.ScheduleEvent(EVENT_ECK_BITE, urand(8000, 12000)); - break; - case EVENT_ECK_SPIT: - me->CastSpell(me->GetVictim(), SPELL_ECK_SPIT, false); - events.ScheduleEvent(EVENT_ECK_SPIT, 10000); - break; - case EVENT_ECK_SPRING: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 30.0f, true)) - { - me->getThreatManager().resetAllAggro(); - me->AddThreat(target, 500.0f); - me->CastSpell(target, SPELL_ECK_SPRING, false); - } + switch (events.ExecuteEvent()) + { + case EVENT_ECK_HEALTH: + if (me->HealthBelowPct(21)) + { + events.CancelEvent(EVENT_ECK_BERSERK); + me->CastSpell(me, SPELL_ECK_BERSERK, false); + break; + } + events.ScheduleEvent(EVENT_ECK_HEALTH, 1000); + break; + case EVENT_ECK_BERSERK: + me->CastSpell(me, SPELL_ECK_BERSERK, false); + events.CancelEvent(EVENT_ECK_HEALTH); + break; + case EVENT_ECK_BITE: + me->CastSpell(me->GetVictim(), SPELL_ECK_BITE, false); + events.ScheduleEvent(EVENT_ECK_BITE, urand(8000, 12000)); + break; + case EVENT_ECK_SPIT: + me->CastSpell(me->GetVictim(), SPELL_ECK_SPIT, false); + events.ScheduleEvent(EVENT_ECK_SPIT, 10000); + break; + case EVENT_ECK_SPRING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 30.0f, true)) + { + me->getThreatManager().resetAllAggro(); + me->AddThreat(target, 500.0f); + me->CastSpell(target, SPELL_ECK_SPRING, false); + } - events.ScheduleEvent(EVENT_ECK_SPRING, urand(5000, 10000)); - break; - } + events.ScheduleEvent(EVENT_ECK_SPRING, urand(5000, 10000)); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_eck() diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp index 1b31bbcd1..5603cba1a 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp @@ -8,17 +8,17 @@ REWRITTEN BY XINEF enum Spells { - SPELL_START_VISUAL = 54988, - SPELL_ENRAGE = 55285, - SPELL_IMPALING_CHARGE = 54956, - SPELL_IMPALING_CHARGE_VEHICLE = 54958, - SPELL_STOMP = 55292, - SPELL_PUNCTURE = 55276, - SPELL_STAMPEDE = 55218, - SPELL_STAMPEDE_DMG = 55220, - SPELL_WHIRLING_SLASH = 55250, - SPELL_TRANSFORM_TO_RHINO = 55297, - SPELL_TRANSFORM_TO_TROLL = 55299 + SPELL_START_VISUAL = 54988, + SPELL_ENRAGE = 55285, + SPELL_IMPALING_CHARGE = 54956, + SPELL_IMPALING_CHARGE_VEHICLE = 54958, + SPELL_STOMP = 55292, + SPELL_PUNCTURE = 55276, + SPELL_STAMPEDE = 55218, + SPELL_STAMPEDE_DMG = 55220, + SPELL_WHIRLING_SLASH = 55250, + SPELL_TRANSFORM_TO_RHINO = 55297, + SPELL_TRANSFORM_TO_TROLL = 55299 }; enum Yells @@ -33,175 +33,175 @@ enum Yells enum Events { - EVENT_STAMPEDE = 1, - EVENT_WHIRLING_SLASH = 2, - EVENT_PUNCTURE = 3, - EVENT_ENRAGE = 4, - EVENT_IMPALING_CHARGE = 5, - EVENT_UNSUMMON_RHINO = 6, - EVENT_STOMP = 7, - EVENT_KILL_TALK = 8 + EVENT_STAMPEDE = 1, + EVENT_WHIRLING_SLASH = 2, + EVENT_PUNCTURE = 3, + EVENT_ENRAGE = 4, + EVENT_IMPALING_CHARGE = 5, + EVENT_UNSUMMON_RHINO = 6, + EVENT_STOMP = 7, + EVENT_KILL_TALK = 8 }; class boss_gal_darah : public CreatureScript { - public: - boss_gal_darah() : CreatureScript("boss_gal_darah") { } + public: + boss_gal_darah() : CreatureScript("boss_gal_darah") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_gal_darahAI : public BossAI - { - boss_gal_darahAI(Creature* creature) : BossAI(creature, DATA_GAL_DARAH) - { - } + struct boss_gal_darahAI : public BossAI + { + boss_gal_darahAI(Creature* creature) : BossAI(creature, DATA_GAL_DARAH) + { + } - uint8 phaseCounter; - std::set impaledList; + uint8 phaseCounter; + std::set impaledList; - void Reset() - { - BossAI::Reset(); - impaledList.clear(); - phaseCounter = 0; - } + void Reset() + { + BossAI::Reset(); + impaledList.clear(); + phaseCounter = 0; + } - void InitializeAI() - { - BossAI::InitializeAI(); - me->CastSpell(me, SPELL_START_VISUAL, false); - } + void InitializeAI() + { + BossAI::InitializeAI(); + me->CastSpell(me, SPELL_START_VISUAL, false); + } - void JustReachedHome() - { - BossAI::JustReachedHome(); - me->CastSpell(me, SPELL_START_VISUAL, false); - } + void JustReachedHome() + { + BossAI::JustReachedHome(); + me->CastSpell(me, SPELL_START_VISUAL, false); + } - void ScheduleEvents(bool troll) - { - events.Reset(); - if (troll) - { - events.RescheduleEvent(EVENT_STAMPEDE, 10000); - events.RescheduleEvent(EVENT_WHIRLING_SLASH, 21000); - } - else - { - events.RescheduleEvent(EVENT_PUNCTURE, 10000); - events.RescheduleEvent(EVENT_ENRAGE, 15000); - events.RescheduleEvent(EVENT_IMPALING_CHARGE, 21000); - events.RescheduleEvent(EVENT_STOMP, 5000); - } - } + void ScheduleEvents(bool troll) + { + events.Reset(); + if (troll) + { + events.RescheduleEvent(EVENT_STAMPEDE, 10000); + events.RescheduleEvent(EVENT_WHIRLING_SLASH, 21000); + } + else + { + events.RescheduleEvent(EVENT_PUNCTURE, 10000); + events.RescheduleEvent(EVENT_ENRAGE, 15000); + events.RescheduleEvent(EVENT_IMPALING_CHARGE, 21000); + events.RescheduleEvent(EVENT_STOMP, 5000); + } + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - BossAI::EnterCombat(who); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + BossAI::EnterCombat(who); - ScheduleEvents(true); - me->RemoveAurasDueToSpell(SPELL_START_VISUAL); - me->InterruptNonMeleeSpells(true); - } + ScheduleEvents(true); + me->RemoveAurasDueToSpell(SPELL_START_VISUAL); + me->InterruptNonMeleeSpells(true); + } - void JustSummoned(Creature* summon) - { - uint32 despawnTime = 0; - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) - { - summon->CastSpell(target, SPELL_STAMPEDE_DMG, true); - despawnTime = (summon->GetDistance(target)/40.0f*1000)+500; - } + void JustSummoned(Creature* summon) + { + uint32 despawnTime = 0; + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) + { + summon->CastSpell(target, SPELL_STAMPEDE_DMG, true); + despawnTime = (summon->GetDistance(target)/40.0f*1000)+500; + } - summon->DespawnOrUnsummon(despawnTime); - } + summon->DespawnOrUnsummon(despawnTime); + } - uint32 GetData(uint32 type) const - { - return impaledList.size(); - } + uint32 GetData(uint32 type) const + { + return impaledList.size(); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + } - void KilledUnit(Unit*) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit*) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_CHARGING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_CHARGING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_STAMPEDE: - Talk(SAY_SUMMON_RHINO); - me->CastSpell(me->GetVictim(), SPELL_STAMPEDE, false); - events.ScheduleEvent(EVENT_STAMPEDE, 15000); - break; - case EVENT_WHIRLING_SLASH: - if (++phaseCounter >= 3) - { - ScheduleEvents(false); - me->CastSpell(me, SPELL_TRANSFORM_TO_RHINO, false); - Talk(SAY_TRANSFORM_1); - phaseCounter = 0; - return; - } - events.ScheduleEvent(EVENT_WHIRLING_SLASH, 21000); - me->CastSpell(me, SPELL_WHIRLING_SLASH, false); - break; - case EVENT_PUNCTURE: - me->CastSpell(me->GetVictim(), SPELL_PUNCTURE, false); - events.ScheduleEvent(EVENT_PUNCTURE, 8000); - break; - case EVENT_ENRAGE: - me->CastSpell(me, SPELL_ENRAGE, false); - events.ScheduleEvent(EVENT_ENRAGE, 20000); - break; - case EVENT_STOMP: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) - me->CastSpell(target, SPELL_STOMP, false); - events.ScheduleEvent(EVENT_STOMP, 20000); - break; - case EVENT_IMPALING_CHARGE: - if (++phaseCounter >= 3) - { - ScheduleEvents(true); - me->CastSpell(me, SPELL_TRANSFORM_TO_TROLL, false); - Talk(SAY_TRANSFORM_2); - phaseCounter = 0; - return; - } - events.ScheduleEvent(EVENT_IMPALING_CHARGE, 21000); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true)) - { - me->CastSpell(target, SPELL_IMPALING_CHARGE, false); - impaledList.insert(target->GetGUID()); - } - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_STAMPEDE: + Talk(SAY_SUMMON_RHINO); + me->CastSpell(me->GetVictim(), SPELL_STAMPEDE, false); + events.ScheduleEvent(EVENT_STAMPEDE, 15000); + break; + case EVENT_WHIRLING_SLASH: + if (++phaseCounter >= 3) + { + ScheduleEvents(false); + me->CastSpell(me, SPELL_TRANSFORM_TO_RHINO, false); + Talk(SAY_TRANSFORM_1); + phaseCounter = 0; + return; + } + events.ScheduleEvent(EVENT_WHIRLING_SLASH, 21000); + me->CastSpell(me, SPELL_WHIRLING_SLASH, false); + break; + case EVENT_PUNCTURE: + me->CastSpell(me->GetVictim(), SPELL_PUNCTURE, false); + events.ScheduleEvent(EVENT_PUNCTURE, 8000); + break; + case EVENT_ENRAGE: + me->CastSpell(me, SPELL_ENRAGE, false); + events.ScheduleEvent(EVENT_ENRAGE, 20000); + break; + case EVENT_STOMP: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + me->CastSpell(target, SPELL_STOMP, false); + events.ScheduleEvent(EVENT_STOMP, 20000); + break; + case EVENT_IMPALING_CHARGE: + if (++phaseCounter >= 3) + { + ScheduleEvents(true); + me->CastSpell(me, SPELL_TRANSFORM_TO_TROLL, false); + Talk(SAY_TRANSFORM_2); + phaseCounter = 0; + return; + } + events.ScheduleEvent(EVENT_IMPALING_CHARGE, 21000); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true)) + { + me->CastSpell(target, SPELL_IMPALING_CHARGE, false); + impaledList.insert(target->GetGUID()); + } + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_galdarah_impaling_charge : public SpellScriptLoader @@ -216,7 +216,7 @@ class spell_galdarah_impaling_charge : public SpellScriptLoader void HandleApplyAura(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - target->CastSpell(GetCaster(), SPELL_IMPALING_CHARGE_VEHICLE, true); + target->CastSpell(GetCaster(), SPELL_IMPALING_CHARGE_VEHICLE, true); } void Register() @@ -243,7 +243,7 @@ class spell_galdarah_transform : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - target->RemoveAurasDueToSpell(SPELL_TRANSFORM_TO_RHINO); + target->RemoveAurasDueToSpell(SPELL_TRANSFORM_TO_RHINO); } void Register() @@ -277,7 +277,7 @@ class achievement_share_the_love : public AchievementCriteriaScript void AddSC_boss_gal_darah() { new boss_gal_darah(); - new spell_galdarah_impaling_charge(); - new spell_galdarah_transform(); + new spell_galdarah_impaling_charge(); + new spell_galdarah_transform(); new achievement_share_the_love(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp index 20df4c62a..b8e4baba2 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp @@ -8,16 +8,16 @@ REWRITTEN BY XINEF enum eSpells { - SPELL_SUMMON_PHANTOM = 55205, - SPELL_SUMMON_PHANTOM_TRANSFORM = 55097, - SPELL_DETERMINED_STAB = 55104, - SPELL_DETERMINED_GORE = 55102, - SPELL_GROUND_TREMOR = 55142, - SPELL_QUAKE = 55101, - SPELL_NUMBING_SHOUT = 55106, - SPELL_NUMBING_ROAR = 55100, - SPELL_MOJO_FRENZY = 55163, - SPELL_TRANSFORMATION = 55098 + SPELL_SUMMON_PHANTOM = 55205, + SPELL_SUMMON_PHANTOM_TRANSFORM = 55097, + SPELL_DETERMINED_STAB = 55104, + SPELL_DETERMINED_GORE = 55102, + SPELL_GROUND_TREMOR = 55142, + SPELL_QUAKE = 55101, + SPELL_NUMBING_SHOUT = 55106, + SPELL_NUMBING_ROAR = 55100, + SPELL_MOJO_FRENZY = 55163, + SPELL_TRANSFORMATION = 55098 }; enum eSays @@ -28,131 +28,131 @@ enum eSays SAY_TRANSFORM = 3, SAY_QUAKE = 4, EMOTE_TRANSFORM = 5, - EMOTE_TRANSFORMED = 6, - EMOTE_ALTAR = 7 + EMOTE_TRANSFORMED = 6, + EMOTE_ALTAR = 7 }; enum Events { - EVENT_GROUND_TREMOR = 1, - EVENT_NUMBLING_SHOUT = 2, - EVENT_DETERMINED_STAB = 3, - EVENT_TRANSFORMATION = 4, - EVENT_KILL_TALK = 5, + EVENT_GROUND_TREMOR = 1, + EVENT_NUMBLING_SHOUT = 2, + EVENT_DETERMINED_STAB = 3, + EVENT_TRANSFORMATION = 4, + EVENT_KILL_TALK = 5, - EVENT_PHANTOM = 10 + EVENT_PHANTOM = 10 }; class boss_moorabi : public CreatureScript { - public: - boss_moorabi() : CreatureScript("boss_moorabi") { } + public: + boss_moorabi() : CreatureScript("boss_moorabi") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_moorabiAI : public BossAI - { - boss_moorabiAI(Creature* creature) : BossAI(creature, DATA_MOORABI) - { - } + struct boss_moorabiAI : public BossAI + { + boss_moorabiAI(Creature* creature) : BossAI(creature, DATA_MOORABI) + { + } - EventMap events2; + EventMap events2; - void Reset() - { - BossAI::Reset(); - events2.Reset(); - events2.ScheduleEvent(EVENT_PHANTOM, 21000); - } + void Reset() + { + BossAI::Reset(); + events2.Reset(); + events2.ScheduleEvent(EVENT_PHANTOM, 21000); + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - BossAI::EnterCombat(who); - me->CastSpell(me, SPELL_MOJO_FRENZY, true); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + BossAI::EnterCombat(who); + me->CastSpell(me, SPELL_MOJO_FRENZY, true); - events.ScheduleEvent(EVENT_GROUND_TREMOR, 18000); - events.ScheduleEvent(EVENT_NUMBLING_SHOUT, 10000); - events.ScheduleEvent(EVENT_DETERMINED_STAB, 20000); - events.ScheduleEvent(EVENT_TRANSFORMATION, 12000); - } + events.ScheduleEvent(EVENT_GROUND_TREMOR, 18000); + events.ScheduleEvent(EVENT_NUMBLING_SHOUT, 10000); + events.ScheduleEvent(EVENT_DETERMINED_STAB, 20000); + events.ScheduleEvent(EVENT_TRANSFORMATION, 12000); + } - void SpellHitTarget(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_TRANSFORMATION) - { - me->RemoveAurasDueToSpell(SPELL_MOJO_FRENZY); - events.CancelEvent(EVENT_TRANSFORMATION); - Talk(EMOTE_TRANSFORMED); - } - } + void SpellHitTarget(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_TRANSFORMATION) + { + me->RemoveAurasDueToSpell(SPELL_MOJO_FRENZY); + events.CancelEvent(EVENT_TRANSFORMATION); + Talk(EMOTE_TRANSFORMED); + } + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - Talk(EMOTE_ALTAR); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + Talk(EMOTE_ALTAR); + BossAI::JustDied(killer); + } - void KilledUnit(Unit*) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit*) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void UpdateAI(uint32 diff) - { - if (!me->IsInCombat()) - { - events2.Update(diff); - if (events2.ExecuteEvent() == EVENT_PHANTOM) - { - me->CastSpell(me, SPELL_SUMMON_PHANTOM, true); - events2.ScheduleEvent(EVENT_PHANTOM, urand(20000, 25000)); - } - } + void UpdateAI(uint32 diff) + { + if (!me->IsInCombat()) + { + events2.Update(diff); + if (events2.ExecuteEvent() == EVENT_PHANTOM) + { + me->CastSpell(me, SPELL_SUMMON_PHANTOM, true); + events2.ScheduleEvent(EVENT_PHANTOM, urand(20000, 25000)); + } + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_GROUND_TREMOR: - if (roll_chance_i(50)) - Talk(SAY_QUAKE); - me->CastSpell(me, me->GetDisplayId() != me->GetNativeDisplayId() ? SPELL_QUAKE : SPELL_GROUND_TREMOR, false); - events.ScheduleEvent(EVENT_GROUND_TREMOR, 10000); - break; - case EVENT_NUMBLING_SHOUT: - me->CastSpell(me, me->GetDisplayId() != me->GetNativeDisplayId() ? SPELL_NUMBING_ROAR : SPELL_NUMBING_SHOUT, false); - events.ScheduleEvent(EVENT_NUMBLING_SHOUT, 10000); - break; - case EVENT_DETERMINED_STAB: - me->CastSpell(me->GetVictim(), me->GetDisplayId() != me->GetNativeDisplayId() ? SPELL_DETERMINED_GORE : SPELL_DETERMINED_STAB, false); - events.ScheduleEvent(EVENT_DETERMINED_STAB, 8000); - break; - case EVENT_TRANSFORMATION: - Talk(EMOTE_TRANSFORM); - Talk(SAY_TRANSFORM); - me->CastSpell(me, SPELL_TRANSFORMATION, false); - me->CastSpell(me,SPELL_SUMMON_PHANTOM_TRANSFORM, true); - events.ScheduleEvent(EVENT_TRANSFORMATION, 10000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_GROUND_TREMOR: + if (roll_chance_i(50)) + Talk(SAY_QUAKE); + me->CastSpell(me, me->GetDisplayId() != me->GetNativeDisplayId() ? SPELL_QUAKE : SPELL_GROUND_TREMOR, false); + events.ScheduleEvent(EVENT_GROUND_TREMOR, 10000); + break; + case EVENT_NUMBLING_SHOUT: + me->CastSpell(me, me->GetDisplayId() != me->GetNativeDisplayId() ? SPELL_NUMBING_ROAR : SPELL_NUMBING_SHOUT, false); + events.ScheduleEvent(EVENT_NUMBLING_SHOUT, 10000); + break; + case EVENT_DETERMINED_STAB: + me->CastSpell(me->GetVictim(), me->GetDisplayId() != me->GetNativeDisplayId() ? SPELL_DETERMINED_GORE : SPELL_DETERMINED_STAB, false); + events.ScheduleEvent(EVENT_DETERMINED_STAB, 8000); + break; + case EVENT_TRANSFORMATION: + Talk(EMOTE_TRANSFORM); + Talk(SAY_TRANSFORM); + me->CastSpell(me, SPELL_TRANSFORMATION, false); + me->CastSpell(me,SPELL_SUMMON_PHANTOM_TRANSFORM, true); + events.ScheduleEvent(EVENT_TRANSFORMATION, 10000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_moorabi_mojo_frenzy : public SpellScriptLoader @@ -167,11 +167,11 @@ class spell_moorabi_mojo_frenzy : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - - if (GetUnitOwner()->GetMap()->IsHeroic()) - GetUnitOwner()->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f * (GetUnitOwner()->GetHealthPct()*GetUnitOwner()->GetHealthPct()/10000.0f)); - else - GetUnitOwner()->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f * (GetUnitOwner()->GetHealthPct()/100.0f)); + + if (GetUnitOwner()->GetMap()->IsHeroic()) + GetUnitOwner()->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f * (GetUnitOwner()->GetHealthPct()*GetUnitOwner()->GetHealthPct()/10000.0f)); + else + GetUnitOwner()->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f * (GetUnitOwner()->GetHealthPct()/100.0f)); } void Register() @@ -202,6 +202,6 @@ class achievement_less_rabi : public AchievementCriteriaScript void AddSC_boss_moorabi() { new boss_moorabi(); - new spell_moorabi_mojo_frenzy(); - new achievement_less_rabi(); + new spell_moorabi_mojo_frenzy(); + new achievement_less_rabi(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index e3f91f82a..a8dcb9817 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -8,11 +8,11 @@ REWRITTEN BY XINEF enum Spells { - SPELL_POISON_NOVA = 55081, - SPELL_POWERFULL_BITE = 48287, - SPELL_VENOM_BOLT = 54970, + SPELL_POISON_NOVA = 55081, + SPELL_POWERFULL_BITE = 48287, + SPELL_VENOM_BOLT = 54970, - SPELL_SNAKE_WRAP = 55126 + SPELL_SNAKE_WRAP = 55126 }; enum Yells @@ -23,26 +23,26 @@ enum Yells SAY_SUMMON_SNAKES = 3, SAY_SUMMON_CONSTRICTORS = 4, EMOTE_NOVA = 5, - EMOTE_ALTAR = 6 + EMOTE_ALTAR = 6 }; enum Misc { - NPC_SLADRAN_VIPER = 29680, - NPC_SLADRAN_CONSTRICTORS = 29713, + NPC_SLADRAN_VIPER = 29680, + NPC_SLADRAN_CONSTRICTORS = 29713, - MAX_VIPER = 2, - MAX_CONSTRICTOR = 3, - MAX_SUMMONS = 5, + MAX_VIPER = 2, + MAX_CONSTRICTOR = 3, + MAX_SUMMONS = 5, - EVENT_POISON_NOVA = 1, - EVENT_POWERFULL_BITE = 2, - EVENT_VENOM_BOLT = 3, - EVENT_CHECK_HEALTH1 = 4, - EVENT_CHECK_HEALTH2 = 5, - EVENT_SUMMON1 = 6, - EVENT_SUMMON2 = 7, - EVENT_KILL_TALK = 8 + EVENT_POISON_NOVA = 1, + EVENT_POWERFULL_BITE = 2, + EVENT_VENOM_BOLT = 3, + EVENT_CHECK_HEALTH1 = 4, + EVENT_CHECK_HEALTH2 = 5, + EVENT_SUMMON1 = 6, + EVENT_SUMMON2 = 7, + EVENT_KILL_TALK = 8 }; const Position SpawnLoc[]= @@ -56,133 +56,133 @@ const Position SpawnLoc[]= class boss_slad_ran : public CreatureScript { - public: - boss_slad_ran() : CreatureScript("boss_slad_ran") { } + public: + boss_slad_ran() : CreatureScript("boss_slad_ran") { } - CreatureAI* GetAI(Creature* creature) const - { - return new boss_slad_ranAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_slad_ranAI(creature); + } - struct boss_slad_ranAI : public BossAI - { - boss_slad_ranAI(Creature* creature) : BossAI(creature, DATA_SLAD_RAN) - { - } + struct boss_slad_ranAI : public BossAI + { + boss_slad_ranAI(Creature* creature) : BossAI(creature, DATA_SLAD_RAN) + { + } - void Reset() - { - BossAI::Reset(); - _achievement = true; - } + void Reset() + { + BossAI::Reset(); + _achievement = true; + } - uint32 GetData(uint32 data) const - { - if (data == me->GetEntry()) - return uint32(_achievement); - return 0; - } + uint32 GetData(uint32 data) const + { + if (data == me->GetEntry()) + return uint32(_achievement); + return 0; + } - void SetData(uint32 data, uint32) - { - if (data == me->GetEntry()) - _achievement = false; - } + void SetData(uint32 data, uint32) + { + if (data == me->GetEntry()) + _achievement = false; + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - BossAI::EnterCombat(who); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_POISON_NOVA, 10000); - events.ScheduleEvent(EVENT_POWERFULL_BITE, 3000); - events.ScheduleEvent(EVENT_VENOM_BOLT, 15000); - events.ScheduleEvent(EVENT_CHECK_HEALTH1, 1000); - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - } + events.ScheduleEvent(EVENT_POISON_NOVA, 10000); + events.ScheduleEvent(EVENT_POWERFULL_BITE, 3000); + events.ScheduleEvent(EVENT_VENOM_BOLT, 15000); + events.ScheduleEvent(EVENT_CHECK_HEALTH1, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - Talk(EMOTE_ALTAR); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + Talk(EMOTE_ALTAR); + BossAI::JustDied(killer); + } - void KilledUnit(Unit*) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit*) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - summon->SetInCombatWithZone(); - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summon->SetInCombatWithZone(); + summons.Summon(summon); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_HEALTH1: - if (me->HealthBelowPct(70)) - { - Talk(SAY_SUMMON_SNAKES); - events.ScheduleEvent(EVENT_SUMMON1, 1000); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH1, 1000); - break; - case EVENT_CHECK_HEALTH2: - if (me->HealthBelowPct(50)) - { - Talk(SAY_SUMMON_CONSTRICTORS); - events.ScheduleEvent(EVENT_SUMMON2, 1000); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - break; - case EVENT_POISON_NOVA: - Talk(EMOTE_NOVA); - me->CastSpell(me, SPELL_POISON_NOVA, false); - events.ScheduleEvent(EVENT_POISON_NOVA, 15000); - break; - case EVENT_POWERFULL_BITE: - me->CastSpell(me->GetVictim(), SPELL_POWERFULL_BITE, false); - events.ScheduleEvent(EVENT_POWERFULL_BITE, 10000); - break; - case EVENT_VENOM_BOLT: - me->CastSpell(me->GetVictim(), SPELL_VENOM_BOLT, false); - events.ScheduleEvent(EVENT_VENOM_BOLT, 10000); - break; - case EVENT_SUMMON1: - for (uint8 i = MAX_CONSTRICTOR; i < MAX_SUMMONS; ++i) - me->SummonCreature(NPC_SLADRAN_VIPER, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_SUMMON1, 8000); - break; - case EVENT_SUMMON2: - for (uint8 i = 0; i < MAX_CONSTRICTOR; ++i) - me->SummonCreature(NPC_SLADRAN_CONSTRICTORS, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_SUMMON2, urand(3000, 5000)); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_HEALTH1: + if (me->HealthBelowPct(70)) + { + Talk(SAY_SUMMON_SNAKES); + events.ScheduleEvent(EVENT_SUMMON1, 1000); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH1, 1000); + break; + case EVENT_CHECK_HEALTH2: + if (me->HealthBelowPct(50)) + { + Talk(SAY_SUMMON_CONSTRICTORS); + events.ScheduleEvent(EVENT_SUMMON2, 1000); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + break; + case EVENT_POISON_NOVA: + Talk(EMOTE_NOVA); + me->CastSpell(me, SPELL_POISON_NOVA, false); + events.ScheduleEvent(EVENT_POISON_NOVA, 15000); + break; + case EVENT_POWERFULL_BITE: + me->CastSpell(me->GetVictim(), SPELL_POWERFULL_BITE, false); + events.ScheduleEvent(EVENT_POWERFULL_BITE, 10000); + break; + case EVENT_VENOM_BOLT: + me->CastSpell(me->GetVictim(), SPELL_VENOM_BOLT, false); + events.ScheduleEvent(EVENT_VENOM_BOLT, 10000); + break; + case EVENT_SUMMON1: + for (uint8 i = MAX_CONSTRICTOR; i < MAX_SUMMONS; ++i) + me->SummonCreature(NPC_SLADRAN_VIPER, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SUMMON1, 8000); + break; + case EVENT_SUMMON2: + for (uint8 i = 0; i < MAX_CONSTRICTOR; ++i) + me->SummonCreature(NPC_SLADRAN_CONSTRICTORS, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SUMMON2, urand(3000, 5000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - bool _achievement; - }; + private: + bool _achievement; + }; }; class spell_sladran_grip_of_sladran : public SpellScriptLoader @@ -197,11 +197,11 @@ class spell_sladran_grip_of_sladran : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - if (GetStackAmount() >= 5) - { - SetDuration(0); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SNAKE_WRAP, true); - } + if (GetStackAmount() >= 5) + { + SetDuration(0); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SNAKE_WRAP, true); + } } void Register() @@ -236,5 +236,5 @@ void AddSC_boss_slad_ran() { new boss_slad_ran(); new spell_sladran_grip_of_sladran(); - new achievement_snakes_whyd_it_have_to_be_snakes(); + new achievement_snakes_whyd_it_have_to_be_snakes(); } diff --git a/src/server/scripts/Northrend/Gundrak/gundrak.h b/src/server/scripts/Northrend/Gundrak/gundrak.h index ba2b0d684..f8fa15b7e 100644 --- a/src/server/scripts/Northrend/Gundrak/gundrak.h +++ b/src/server/scripts/Northrend/Gundrak/gundrak.h @@ -7,38 +7,38 @@ REWRITTEN BY XINEF enum Data { - DATA_SLAD_RAN = 0, - DATA_MOORABI = 1, - DATA_DRAKKARI_COLOSSUS = 2, - DATA_GAL_DARAH = 3, - DATA_ECK_THE_FEROCIOUS_INIT = 4, - DATA_ECK_THE_FEROCIOUS = 5, - MAX_ENCOUNTERS = 6 + DATA_SLAD_RAN = 0, + DATA_MOORABI = 1, + DATA_DRAKKARI_COLOSSUS = 2, + DATA_GAL_DARAH = 3, + DATA_ECK_THE_FEROCIOUS_INIT = 4, + DATA_ECK_THE_FEROCIOUS = 5, + MAX_ENCOUNTERS = 6 }; enum Creatures { - NPC_ECK_THE_FEROCIOUS = 29932 + NPC_ECK_THE_FEROCIOUS = 29932 }; enum GameObjects { - GO_ALTAR_OF_SLAD_RAN = 192518, - GO_STATUE_OF_SLAD_RAN = 192564, - GO_ALTAR_OF_DRAKKARI = 192520, - GO_STATUE_OF_DRAKKARI = 192567, - GO_ALTAR_OF_MOORABI = 192519, - GO_STATUE_OF_MOORABI = 192565, - GO_STATUE_OF_GAL_DARAH = 192566, + GO_ALTAR_OF_SLAD_RAN = 192518, + GO_STATUE_OF_SLAD_RAN = 192564, + GO_ALTAR_OF_DRAKKARI = 192520, + GO_STATUE_OF_DRAKKARI = 192567, + GO_ALTAR_OF_MOORABI = 192519, + GO_STATUE_OF_MOORABI = 192565, + GO_STATUE_OF_GAL_DARAH = 192566, - GO_GUNDRAK_BRIDGE = 193188, - GO_GUNDRAK_COLLISION = 192633, + GO_GUNDRAK_BRIDGE = 193188, + GO_GUNDRAK_COLLISION = 192633, - GO_ECK_DOORS = 192632, - GO_ECK_UNDERWATER_GATE = 192569, - GO_GAL_DARAH_DOORS0 = 192568, - GO_GAL_DARAH_DOORS1 = 193208, - GO_GAL_DARAH_DOORS2 = 193209 + GO_ECK_DOORS = 192632, + GO_ECK_UNDERWATER_GATE = 192569, + GO_GAL_DARAH_DOORS0 = 192568, + GO_GAL_DARAH_DOORS1 = 193208, + GO_GAL_DARAH_DOORS2 = 193209 }; #endif diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp index 8c6e21506..1ec0b4179 100644 --- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp +++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp @@ -8,228 +8,228 @@ REWRITTEN BY XINEF DoorData const doorData[] = { - { GO_ECK_DOORS, DATA_MOORABI, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { GO_ECK_UNDERWATER_GATE, DATA_ECK_THE_FEROCIOUS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { GO_GAL_DARAH_DOORS0, DATA_GAL_DARAH, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - { GO_GAL_DARAH_DOORS1, DATA_GAL_DARAH, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { GO_GAL_DARAH_DOORS2, DATA_GAL_DARAH, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } + { GO_ECK_DOORS, DATA_MOORABI, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_ECK_UNDERWATER_GATE, DATA_ECK_THE_FEROCIOUS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_GAL_DARAH_DOORS0, DATA_GAL_DARAH, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_GAL_DARAH_DOORS1, DATA_GAL_DARAH, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_GAL_DARAH_DOORS2, DATA_GAL_DARAH, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } }; class instance_gundrak : public InstanceMapScript { - public: - instance_gundrak() : InstanceMapScript("instance_gundrak", 604) { } + public: + instance_gundrak() : InstanceMapScript("instance_gundrak", 604) { } - InstanceScript* GetInstanceScript(InstanceMap* pMap) const - { - return new instance_gundrak_InstanceMapScript(pMap); - } + InstanceScript* GetInstanceScript(InstanceMap* pMap) const + { + return new instance_gundrak_InstanceMapScript(pMap); + } - struct instance_gundrak_InstanceMapScript : public InstanceScript - { - instance_gundrak_InstanceMapScript(Map* map) : InstanceScript(map) - { - } + struct instance_gundrak_InstanceMapScript : public InstanceScript + { + instance_gundrak_InstanceMapScript(Map* map) : InstanceScript(map) + { + } - uint64 _sladRanAltarGUID; - uint64 _moorabiAltarGUID; - uint64 _drakkariAltarGUID; - uint64 _bridgeGUIDs[6]; - uint32 _keysInCount; - uint32 _activateTimer; + uint64 _sladRanAltarGUID; + uint64 _moorabiAltarGUID; + uint64 _drakkariAltarGUID; + uint64 _bridgeGUIDs[6]; + uint32 _keysInCount; + uint32 _activateTimer; - void Initialize() - { - SetBossNumber(MAX_ENCOUNTERS); - LoadDoorData(doorData); + void Initialize() + { + SetBossNumber(MAX_ENCOUNTERS); + LoadDoorData(doorData); - _sladRanAltarGUID = 0; - _moorabiAltarGUID = 0; - _drakkariAltarGUID = 0; - _keysInCount = 0; - _activateTimer = 0; - memset(&_bridgeGUIDs, 0, sizeof(_bridgeGUIDs)); - } + _sladRanAltarGUID = 0; + _moorabiAltarGUID = 0; + _drakkariAltarGUID = 0; + _keysInCount = 0; + _activateTimer = 0; + memset(&_bridgeGUIDs, 0, sizeof(_bridgeGUIDs)); + } - void OnGameObjectCreate(GameObject* gameobject) - { - switch (gameobject->GetEntry()) - { - case GO_ALTAR_OF_SLAD_RAN: - _sladRanAltarGUID = gameobject->GetGUID(); - gameobject->SetGoState(GetBossState(DATA_SLAD_RAN) == DONE ? GO_STATE_ACTIVE : GO_STATE_READY); - break; - case GO_ALTAR_OF_DRAKKARI: - _drakkariAltarGUID = gameobject->GetGUID(); - gameobject->SetGoState(GetBossState(DATA_DRAKKARI_COLOSSUS) == DONE ? GO_STATE_ACTIVE : GO_STATE_READY); - break; - case GO_ALTAR_OF_MOORABI: - _moorabiAltarGUID = gameobject->GetGUID(); - gameobject->SetGoState(GetBossState(DATA_MOORABI) == DONE ? GO_STATE_ACTIVE : GO_STATE_READY); - break; - case GO_STATUE_OF_SLAD_RAN: - _bridgeGUIDs[0] = gameobject->GetGUID(); - gameobject->SetGoState(_keysInCount == 3 ? GO_STATE_ACTIVE_ALTERNATIVE : (GetBossState(DATA_SLAD_RAN) == DONE ? GO_STATE_READY : GO_STATE_ACTIVE)); - break; - case GO_STATUE_OF_DRAKKARI: - _bridgeGUIDs[1] = gameobject->GetGUID(); - gameobject->SetGoState(_keysInCount == 3 ? GO_STATE_ACTIVE_ALTERNATIVE : (GetBossState(DATA_DRAKKARI_COLOSSUS) == DONE ? GO_STATE_READY : GO_STATE_ACTIVE)); - break; - case GO_STATUE_OF_MOORABI: - _bridgeGUIDs[2] = gameobject->GetGUID(); - gameobject->SetGoState(_keysInCount == 3 ? GO_STATE_ACTIVE_ALTERNATIVE : (GetBossState(DATA_MOORABI) == DONE ? GO_STATE_READY : GO_STATE_ACTIVE)); - break; - case GO_STATUE_OF_GAL_DARAH: - _bridgeGUIDs[3] = gameobject->GetGUID(); - gameobject->SetGoState(_keysInCount == 3 ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_READY); - break; - case GO_GUNDRAK_COLLISION: - _bridgeGUIDs[4] = gameobject->GetGUID(); - gameobject->SetGoState(_keysInCount == 3 ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_READY); - break; - case GO_GUNDRAK_BRIDGE: - _bridgeGUIDs[5] = gameobject->GetGUID(); - gameobject->SetGoState(GO_STATE_READY); - break; - case GO_ECK_DOORS: - case GO_ECK_UNDERWATER_GATE: - case GO_GAL_DARAH_DOORS0: - case GO_GAL_DARAH_DOORS1: - case GO_GAL_DARAH_DOORS2: - AddDoor(gameobject, true); - break; - } - } + void OnGameObjectCreate(GameObject* gameobject) + { + switch (gameobject->GetEntry()) + { + case GO_ALTAR_OF_SLAD_RAN: + _sladRanAltarGUID = gameobject->GetGUID(); + gameobject->SetGoState(GetBossState(DATA_SLAD_RAN) == DONE ? GO_STATE_ACTIVE : GO_STATE_READY); + break; + case GO_ALTAR_OF_DRAKKARI: + _drakkariAltarGUID = gameobject->GetGUID(); + gameobject->SetGoState(GetBossState(DATA_DRAKKARI_COLOSSUS) == DONE ? GO_STATE_ACTIVE : GO_STATE_READY); + break; + case GO_ALTAR_OF_MOORABI: + _moorabiAltarGUID = gameobject->GetGUID(); + gameobject->SetGoState(GetBossState(DATA_MOORABI) == DONE ? GO_STATE_ACTIVE : GO_STATE_READY); + break; + case GO_STATUE_OF_SLAD_RAN: + _bridgeGUIDs[0] = gameobject->GetGUID(); + gameobject->SetGoState(_keysInCount == 3 ? GO_STATE_ACTIVE_ALTERNATIVE : (GetBossState(DATA_SLAD_RAN) == DONE ? GO_STATE_READY : GO_STATE_ACTIVE)); + break; + case GO_STATUE_OF_DRAKKARI: + _bridgeGUIDs[1] = gameobject->GetGUID(); + gameobject->SetGoState(_keysInCount == 3 ? GO_STATE_ACTIVE_ALTERNATIVE : (GetBossState(DATA_DRAKKARI_COLOSSUS) == DONE ? GO_STATE_READY : GO_STATE_ACTIVE)); + break; + case GO_STATUE_OF_MOORABI: + _bridgeGUIDs[2] = gameobject->GetGUID(); + gameobject->SetGoState(_keysInCount == 3 ? GO_STATE_ACTIVE_ALTERNATIVE : (GetBossState(DATA_MOORABI) == DONE ? GO_STATE_READY : GO_STATE_ACTIVE)); + break; + case GO_STATUE_OF_GAL_DARAH: + _bridgeGUIDs[3] = gameobject->GetGUID(); + gameobject->SetGoState(_keysInCount == 3 ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_READY); + break; + case GO_GUNDRAK_COLLISION: + _bridgeGUIDs[4] = gameobject->GetGUID(); + gameobject->SetGoState(_keysInCount == 3 ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_READY); + break; + case GO_GUNDRAK_BRIDGE: + _bridgeGUIDs[5] = gameobject->GetGUID(); + gameobject->SetGoState(GO_STATE_READY); + break; + case GO_ECK_DOORS: + case GO_ECK_UNDERWATER_GATE: + case GO_GAL_DARAH_DOORS0: + case GO_GAL_DARAH_DOORS1: + case GO_GAL_DARAH_DOORS2: + AddDoor(gameobject, true); + break; + } + } - void OnGameObjectRemove(GameObject* gameobject) - { - switch (gameobject->GetEntry()) - { - case GO_ECK_DOORS: - case GO_ECK_UNDERWATER_GATE: - case GO_GAL_DARAH_DOORS0: - case GO_GAL_DARAH_DOORS1: - case GO_GAL_DARAH_DOORS2: - AddDoor(gameobject, false); - break; - } - } + void OnGameObjectRemove(GameObject* gameobject) + { + switch (gameobject->GetEntry()) + { + case GO_ECK_DOORS: + case GO_ECK_UNDERWATER_GATE: + case GO_GAL_DARAH_DOORS0: + case GO_GAL_DARAH_DOORS1: + case GO_GAL_DARAH_DOORS2: + AddDoor(gameobject, false); + break; + } + } - void SetData(uint32 type, uint32) - { - switch (type) - { - case NPC_ECK_THE_FEROCIOUS: - if (GetBossState(DATA_ECK_THE_FEROCIOUS_INIT) != DONE) - { - SetBossState(DATA_ECK_THE_FEROCIOUS_INIT, NOT_STARTED); - SetBossState(DATA_ECK_THE_FEROCIOUS_INIT, DONE); - } - break; - case GO_ALTAR_OF_SLAD_RAN: - if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[0])) - statue->SetGoState(GO_STATE_READY); - break; - case GO_ALTAR_OF_DRAKKARI: - if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[1])) - statue->SetGoState(GO_STATE_READY); - break; - case GO_ALTAR_OF_MOORABI: - if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[2])) - statue->SetGoState(GO_STATE_READY); - break; - } + void SetData(uint32 type, uint32) + { + switch (type) + { + case NPC_ECK_THE_FEROCIOUS: + if (GetBossState(DATA_ECK_THE_FEROCIOUS_INIT) != DONE) + { + SetBossState(DATA_ECK_THE_FEROCIOUS_INIT, NOT_STARTED); + SetBossState(DATA_ECK_THE_FEROCIOUS_INIT, DONE); + } + break; + case GO_ALTAR_OF_SLAD_RAN: + if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[0])) + statue->SetGoState(GO_STATE_READY); + break; + case GO_ALTAR_OF_DRAKKARI: + if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[1])) + statue->SetGoState(GO_STATE_READY); + break; + case GO_ALTAR_OF_MOORABI: + if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[2])) + statue->SetGoState(GO_STATE_READY); + break; + } - if (type >= GO_ALTAR_OF_SLAD_RAN) - { - for (uint8 i = 0; i < 3; ++i) - if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[i])) - if (statue->GetGoState() != GO_STATE_READY) - return; - _activateTimer = 1; - } - } + if (type >= GO_ALTAR_OF_SLAD_RAN) + { + for (uint8 i = 0; i < 3; ++i) + if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[i])) + if (statue->GetGoState() != GO_STATE_READY) + return; + _activateTimer = 1; + } + } - bool SetBossState(uint32 type, EncounterState state) - { - if (!InstanceScript::SetBossState(type, state)) - { - if (state == DONE && (type == DATA_SLAD_RAN || type == DATA_MOORABI || type == DATA_DRAKKARI_COLOSSUS)) - ++_keysInCount; - return false; - } + bool SetBossState(uint32 type, EncounterState state) + { + if (!InstanceScript::SetBossState(type, state)) + { + if (state == DONE && (type == DATA_SLAD_RAN || type == DATA_MOORABI || type == DATA_DRAKKARI_COLOSSUS)) + ++_keysInCount; + return false; + } - if (state != DONE) - return true; + if (state != DONE) + return true; - switch (type) - { - case DATA_SLAD_RAN: - if (GameObject* altar = instance->GetGameObject(_sladRanAltarGUID)) - altar->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case DATA_MOORABI: - if (GameObject* altar = instance->GetGameObject(_moorabiAltarGUID)) - altar->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case DATA_DRAKKARI_COLOSSUS: - if (GameObject* altar = instance->GetGameObject(_drakkariAltarGUID)) - altar->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case DATA_ECK_THE_FEROCIOUS_INIT: - { - Position pos = {1624.70f, 891.43f, 95.08f, 1.2f}; - instance->SummonCreature(NPC_ECK_THE_FEROCIOUS, pos); - break; - } - } - return true; - } + switch (type) + { + case DATA_SLAD_RAN: + if (GameObject* altar = instance->GetGameObject(_sladRanAltarGUID)) + altar->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case DATA_MOORABI: + if (GameObject* altar = instance->GetGameObject(_moorabiAltarGUID)) + altar->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case DATA_DRAKKARI_COLOSSUS: + if (GameObject* altar = instance->GetGameObject(_drakkariAltarGUID)) + altar->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case DATA_ECK_THE_FEROCIOUS_INIT: + { + Position pos = {1624.70f, 891.43f, 95.08f, 1.2f}; + instance->SummonCreature(NPC_ECK_THE_FEROCIOUS, pos); + break; + } + } + return true; + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "G D " << GetBossSaveData(); - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "G D " << GetBossSaveData(); + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - return; + void Load(const char* in) + { + if (!in) + return; - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'G' && dataHead2 == 'D') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); - } - } - } + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; + if (dataHead1 == 'G' && dataHead2 == 'D') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } + } + } - void Update(uint32 diff) - { - if (!_activateTimer) - return; + void Update(uint32 diff) + { + if (!_activateTimer) + return; - _activateTimer += diff; - if (_activateTimer >= 5000) - { - _activateTimer = 0; - for (uint8 i = 0; i < 5; ++i) - if (GameObject* go = instance->GetGameObject(_bridgeGUIDs[i])) - go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - } - } - }; + _activateTimer += diff; + if (_activateTimer >= 5000) + { + _activateTimer = 0; + for (uint8 i = 0; i < 5; ++i) + if (GameObject* go = instance->GetGameObject(_bridgeGUIDs[i])) + go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + } + } + }; }; void AddSC_instance_gundrak() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 882c391b6..62c999872 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -11,158 +11,158 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Texts { - // Blood Queen Lana'Thel - SAY_INTRO_1 = 0, - SAY_INTRO_2 = 1, + // Blood Queen Lana'Thel + SAY_INTRO_1 = 0, + SAY_INTRO_2 = 1, - // Prince Keleseth - SAY_KELESETH_INVOCATION = 0, - EMOTE_KELESETH_INVOCATION = 1, - SAY_KELESETH_SPECIAL = 2, - SAY_KELESETH_KILL = 3, - EMOTE_KELESETH_BERSERK = 4, - SAY_KELESETH_DEATH = 5, + // Prince Keleseth + SAY_KELESETH_INVOCATION = 0, + EMOTE_KELESETH_INVOCATION = 1, + SAY_KELESETH_SPECIAL = 2, + SAY_KELESETH_KILL = 3, + EMOTE_KELESETH_BERSERK = 4, + SAY_KELESETH_DEATH = 5, - // Prince Taldaram - SAY_TALDARAM_INVOCATION = 0, - EMOTE_TALDARAM_INVOCATION = 1, - SAY_TALDARAM_SPECIAL = 2, - EMOTE_TALDARAM_FLAME = 3, - SAY_TALDARAM_KILL = 4, - EMOTE_TALDARAM_BERSERK = 5, - EMOTE_TALDARAM_DEATH = 6, + // Prince Taldaram + SAY_TALDARAM_INVOCATION = 0, + EMOTE_TALDARAM_INVOCATION = 1, + SAY_TALDARAM_SPECIAL = 2, + EMOTE_TALDARAM_FLAME = 3, + SAY_TALDARAM_KILL = 4, + EMOTE_TALDARAM_BERSERK = 5, + EMOTE_TALDARAM_DEATH = 6, - // Prince Valanar - SAY_VALANAR_INVOCATION = 0, - EMOTE_VALANAR_INVOCATION = 1, - SAY_VALANAR_SPECIAL = 2, - EMOTE_VALANAR_SHOCK_VORTEX = 3, - SAY_VALANAR_KILL = 4, - SAY_VALANAR_BERSERK = 5, - SAY_VALANAR_DEATH = 6, + // Prince Valanar + SAY_VALANAR_INVOCATION = 0, + EMOTE_VALANAR_INVOCATION = 1, + SAY_VALANAR_SPECIAL = 2, + EMOTE_VALANAR_SHOCK_VORTEX = 3, + SAY_VALANAR_KILL = 4, + SAY_VALANAR_BERSERK = 5, + SAY_VALANAR_DEATH = 6, }; enum Spells { - SPELL_FEIGN_DEATH = 71598, - SPELL_OOC_INVOCATION_VISUAL = 70934, - SPELL_INVOCATION_VISUAL_ACTIVE = 71596, - SPELL_INVOCATION_OF_BLOOD_KELESETH = 70981, - SPELL_INVOCATION_OF_BLOOD_TALDARAM = 70982, - SPELL_INVOCATION_OF_BLOOD_VALANAR = 70952, + SPELL_FEIGN_DEATH = 71598, + SPELL_OOC_INVOCATION_VISUAL = 70934, + SPELL_INVOCATION_VISUAL_ACTIVE = 71596, + SPELL_INVOCATION_OF_BLOOD_KELESETH = 70981, + SPELL_INVOCATION_OF_BLOOD_TALDARAM = 70982, + SPELL_INVOCATION_OF_BLOOD_VALANAR = 70952, - // Heroic mode - SPELL_SHADOW_PRISON = 72998, - SPELL_SHADOW_PRISON_DAMAGE = 72999, - SPELL_SHADOW_PRISON_DUMMY = 73001, + // Heroic mode + SPELL_SHADOW_PRISON = 72998, + SPELL_SHADOW_PRISON_DAMAGE = 72999, + SPELL_SHADOW_PRISON_DUMMY = 73001, - // Prince Keleseth - SPELL_SHADOW_RESONANCE = 71943, - SPELL_SHADOW_LANCE = 71405, - SPELL_EMPOWERED_SHADOW_LANCE = 71815, + // Prince Keleseth + SPELL_SHADOW_RESONANCE = 71943, + SPELL_SHADOW_LANCE = 71405, + SPELL_EMPOWERED_SHADOW_LANCE = 71815, - // Dark Nucleus - SPELL_SHADOW_RESONANCE_AURA = 72980, - SPELL_SHADOW_RESONANCE_RESIST = 71822, + // Dark Nucleus + SPELL_SHADOW_RESONANCE_AURA = 72980, + SPELL_SHADOW_RESONANCE_RESIST = 71822, - // Prince Taldaram - SPELL_GLITTERING_SPARKS = 71806, - SPELL_CONJURE_FLAME = 71718, - SPELL_CONJURE_EMPOWERED_FLAME = 72040, + // Prince Taldaram + SPELL_GLITTERING_SPARKS = 71806, + SPELL_CONJURE_FLAME = 71718, + SPELL_CONJURE_EMPOWERED_FLAME = 72040, - // Ball of Flame - SPELL_FLAME_SPHERE_SPAWN_EFFECT = 55891, // cast from creature_template_addon (needed cast before entering world) - SPELL_BALL_OF_FLAMES_VISUAL = 71706, - SPELL_BALL_OF_FLAMES = 71714, - SPELL_FLAMES = 71393, - SPELL_FLAME_SPHERE_DEATH_EFFECT = 55947, + // Ball of Flame + SPELL_FLAME_SPHERE_SPAWN_EFFECT = 55891, // cast from creature_template_addon (needed cast before entering world) + SPELL_BALL_OF_FLAMES_VISUAL = 71706, + SPELL_BALL_OF_FLAMES = 71714, + SPELL_FLAMES = 71393, + SPELL_FLAME_SPHERE_DEATH_EFFECT = 55947, - // Ball of Inferno Flame - SPELL_BALL_OF_FLAMES_PROC = 71756, - SPELL_BALL_OF_FLAMES_PERIODIC = 71709, + // Ball of Inferno Flame + SPELL_BALL_OF_FLAMES_PROC = 71756, + SPELL_BALL_OF_FLAMES_PERIODIC = 71709, - // Prince Valanar - SPELL_KINETIC_BOMB_TARGET = 72053, - SPELL_KINETIC_BOMB = 72080, - SPELL_SHOCK_VORTEX = 72037, - SPELL_EMPOWERED_SHOCK_VORTEX = 72039, + // Prince Valanar + SPELL_KINETIC_BOMB_TARGET = 72053, + SPELL_KINETIC_BOMB = 72080, + SPELL_SHOCK_VORTEX = 72037, + SPELL_EMPOWERED_SHOCK_VORTEX = 72039, - // Kinetic Bomb - SPELL_UNSTABLE = 72059, - SPELL_KINETIC_BOMB_VISUAL = 72054, - SPELL_KINETIC_BOMB_EXPLOSION = 72052, - SPELL_KINETIC_BOMB_KNOCKBACK = 72087, + // Kinetic Bomb + SPELL_UNSTABLE = 72059, + SPELL_KINETIC_BOMB_VISUAL = 72054, + SPELL_KINETIC_BOMB_EXPLOSION = 72052, + SPELL_KINETIC_BOMB_KNOCKBACK = 72087, - // Shock Vortex - SPELL_SHOCK_VORTEX_PERIODIC = 71945, - SPELL_SHOCK_VORTEX_DUMMY = 72633, + // Shock Vortex + SPELL_SHOCK_VORTEX_PERIODIC = 71945, + SPELL_SHOCK_VORTEX_DUMMY = 72633, }; enum Events { - EVENT_NONE, - EVENT_INTRO_1, - EVENT_INTRO_2, + EVENT_NONE, + EVENT_INTRO_1, + EVENT_INTRO_2, - EVENT_INVOCATION_OF_BLOOD, - EVENT_BERSERK, + EVENT_INVOCATION_OF_BLOOD, + EVENT_BERSERK, - // Keleseth - EVENT_SHADOW_RESONANCE, + // Keleseth + EVENT_SHADOW_RESONANCE, - // Taldaram - EVENT_GLITTERING_SPARKS, - EVENT_CONJURE_FLAME, + // Taldaram + EVENT_GLITTERING_SPARKS, + EVENT_CONJURE_FLAME, - // Valanar - EVENT_KINETIC_BOMB, - EVENT_SHOCK_VORTEX, - EVENT_BOMB_DESPAWN, - EVENT_CONTINUE_FALLING, + // Valanar + EVENT_KINETIC_BOMB, + EVENT_SHOCK_VORTEX, + EVENT_BOMB_DESPAWN, + EVENT_CONTINUE_FALLING, }; enum Actions { - ACTION_STAND_UP = 1, - ACTION_CAST_INVOCATION = 2, - ACTION_REMOVE_INVOCATION = 3, - ACTION_FLAME_BALL_CHASE = 4, - ACTION_KINETIC_BOMB_JUMP = 5, + ACTION_STAND_UP = 1, + ACTION_CAST_INVOCATION = 2, + ACTION_REMOVE_INVOCATION = 3, + ACTION_FLAME_BALL_CHASE = 4, + ACTION_KINETIC_BOMB_JUMP = 5, }; enum Points { - POINT_INTRO_DESPAWN = 380040, + POINT_INTRO_DESPAWN = 380040, }; class StandUpEvent : public BasicEvent { - public: - StandUpEvent(Creature& owner) : BasicEvent(), _owner(owner) { } + public: + StandUpEvent(Creature& owner) : BasicEvent(), _owner(owner) { } - bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) - { - _owner.HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) + { + _owner.HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + return true; + } - private: - Creature& _owner; + private: + Creature& _owner; }; class ShockVortexExplodeEvent : public BasicEvent { - public: - ShockVortexExplodeEvent(Creature& owner) : BasicEvent(), _owner(owner) { } + public: + ShockVortexExplodeEvent(Creature& owner) : BasicEvent(), _owner(owner) { } - bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) - { - _owner.CastSpell(&_owner, SPELL_SHOCK_VORTEX_PERIODIC, true); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) + { + _owner.CastSpell(&_owner, SPELL_SHOCK_VORTEX_PERIODIC, true); + return true; + } - private: - Creature& _owner; + private: + Creature& _owner; }; Position const introFinalPos = {4660.490f, 2769.200f, 430.0000f, 0.000000f}; @@ -171,1508 +171,1508 @@ Position const triggerEndPos = {4680.180f, 2769.150f, 365.5000f, 3.121708f}; class boss_prince_keleseth_icc : public CreatureScript { - public: - boss_prince_keleseth_icc() : CreatureScript("boss_prince_keleseth_icc") { } + public: + boss_prince_keleseth_icc() : CreatureScript("boss_prince_keleseth_icc") { } - struct boss_prince_kelesethAI : public ScriptedAI - { - boss_prince_kelesethAI(Creature* creature) : ScriptedAI(creature), summons(creature), instance(creature->GetInstanceScript()) - { - if (!instance) - { - me->IsAIEnabled = false; - me->AddUnitState(UNIT_STATE_EVADE); - } - _canDie = true; - } + struct boss_prince_kelesethAI : public ScriptedAI + { + boss_prince_kelesethAI(Creature* creature) : ScriptedAI(creature), summons(creature), instance(creature->GetInstanceScript()) + { + if (!instance) + { + me->IsAIEnabled = false; + me->AddUnitState(UNIT_STATE_EVADE); + } + _canDie = true; + } - void InitializeAI() - { - ScriptedAI::InitializeAI(); - if (me->IsAlive()) - { - if (Creature* c = me->SummonCreature(WORLD_TRIGGER, me->GetHomePosition())) - { - c->SetObjectScale(1.75f); - c->CastSpell(c, SPELL_FEIGN_DEATH, true); - } + void InitializeAI() + { + ScriptedAI::InitializeAI(); + if (me->IsAlive()) + { + if (Creature* c = me->SummonCreature(WORLD_TRIGGER, me->GetHomePosition())) + { + c->SetObjectScale(1.75f); + c->CastSpell(c, SPELL_FEIGN_DEATH, true); + } - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->SetReactState(REACT_PASSIVE); - } - } + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetReactState(REACT_PASSIVE); + } + } - EventMap events; - SummonList summons; - InstanceScript* instance; - bool _isEmpowered; - bool _evading; - bool _canDie; + EventMap events; + SummonList summons; + InstanceScript* instance; + bool _isEmpowered; + bool _evading; + bool _canDie; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - _isEmpowered = false; - _evading = false; - me->SetHealth(me->GetMaxHealth()); - me->SetReactState(REACT_AGGRESSIVE); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + _isEmpowered = false; + _evading = false; + me->SetHealth(me->GetMaxHealth()); + me->SetReactState(REACT_AGGRESSIVE); + } - void EnterCombat(Unit* who) - { - bool valid = true; - if (Creature* keleseth = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_KELESETH_GUID))) - if (!keleseth->IsAlive() || keleseth->IsInEvadeMode()) - valid = false; - if (Creature* taldaram = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) - if (!taldaram->IsAlive() || taldaram->IsInEvadeMode()) - valid = false; - if (Creature* valanar = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - if (!valanar->IsAlive() || valanar->IsInEvadeMode()) - valid = false; - if (!valid) - { - EnterEvadeMode(); - return; - } + void EnterCombat(Unit* who) + { + bool valid = true; + if (Creature* keleseth = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (!keleseth->IsAlive() || keleseth->IsInEvadeMode()) + valid = false; + if (Creature* taldaram = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (!taldaram->IsAlive() || taldaram->IsInEvadeMode()) + valid = false; + if (Creature* valanar = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (!valanar->IsAlive() || valanar->IsInEvadeMode()) + valid = false; + if (!valid) + { + EnterEvadeMode(); + return; + } - me->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); // just in case - me->setActive(true); - DoZoneInCombat(); - if (!me->hasLootRecipient()) - me->SetLootRecipient(who); - me->LowerPlayerDamageReq(me->GetMaxHealth()); - me->SetReactState(REACT_AGGRESSIVE); - instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); + me->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); // just in case + me->setActive(true); + DoZoneInCombat(); + if (!me->hasLootRecipient()) + me->SetLootRecipient(who); + me->LowerPlayerDamageReq(me->GetMaxHealth()); + me->SetReactState(REACT_AGGRESSIVE); + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) - if (!taldaram->IsInEvadeMode()) - taldaram->SetInCombatWithZone(); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - if (!valanar->IsInEvadeMode()) - valanar->SetInCombatWithZone(); + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (!taldaram->IsInEvadeMode()) + taldaram->SetInCombatWithZone(); + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (!valanar->IsInEvadeMode()) + valanar->SetInCombatWithZone(); - me->resetAttackTimer(BASE_ATTACK); - DoAction(ACTION_REMOVE_INVOCATION); - events.Reset(); - events.ScheduleEvent(EVENT_BERSERK, 600000); - events.ScheduleEvent(EVENT_SHADOW_RESONANCE, urand(10000, 15000)); - if (IsHeroic()) - me->AddAura(SPELL_SHADOW_PRISON, me); - } + me->resetAttackTimer(BASE_ATTACK); + DoAction(ACTION_REMOVE_INVOCATION); + events.Reset(); + events.ScheduleEvent(EVENT_BERSERK, 600000); + events.ScheduleEvent(EVENT_SHADOW_RESONANCE, urand(10000, 15000)); + if (IsHeroic()) + me->AddAura(SPELL_SHADOW_PRISON, me); + } - void AttackStart(Unit* who) - { - ScriptedAI::AttackStartCaster(who, 10.0f); - } + void AttackStart(Unit* who) + { + ScriptedAI::AttackStartCaster(who, 10.0f); + } - void JustDied(Unit* /*killer*/) - { - events.Reset(); - summons.DespawnAll(); - instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + void JustDied(Unit* /*killer*/) + { + events.Reset(); + summons.DespawnAll(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - if (!_canDie) - { - me->RemoveCorpse(false); - me->SetRespawnTime(10); - me->SaveRespawnTime(); - Position homePos = me->GetHomePosition(); - me->UpdatePosition(homePos); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - me->StopMovingOnCurrentPos(); - return; - } + if (!_canDie) + { + me->RemoveCorpse(false); + me->SetRespawnTime(10); + me->SaveRespawnTime(); + Position homePos = me->GetHomePosition(); + me->UpdatePosition(homePos); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + me->StopMovingOnCurrentPos(); + return; + } - Talk(SAY_KELESETH_DEATH); - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) - if (taldaram->IsAlive()) - Unit::Kill(taldaram, taldaram); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - if (valanar->IsAlive()) - Unit::Kill(valanar, valanar); - } + Talk(SAY_KELESETH_DEATH); + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (taldaram->IsAlive()) + Unit::Kill(taldaram, taldaram); + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (valanar->IsAlive()) + Unit::Kill(valanar, valanar); + } - void JustRespawned() - { - ScriptedAI::JustRespawned(); - JustReachedHome(); - } + void JustRespawned() + { + ScriptedAI::JustRespawned(); + JustReachedHome(); + } - void JustReachedHome() - { - _canDie = true; - me->setActive(false); - instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - DoAction(ACTION_REMOVE_INVOCATION); - me->SetHealth(1); - } + void JustReachedHome() + { + _canDie = true; + me->setActive(false); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + DoAction(ACTION_REMOVE_INVOCATION); + me->SetHealth(1); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (!_isEmpowered) - { - if (attacker) - me->AddThreat(attacker, float(damage)); - damage = 0; - } - } + void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (!_isEmpowered) + { + if (attacker) + me->AddThreat(attacker, float(damage)); + damage = 0; + } + } - void DamageDealt(Unit* target, uint32& damage, DamageEffectType damageType) - { - if (target->GetTypeId() != TYPEID_PLAYER) - return; + void DamageDealt(Unit* target, uint32& damage, DamageEffectType damageType) + { + if (target->GetTypeId() != TYPEID_PLAYER) + return; - if (damage > RAID_MODE(23000, 25000, 23000, 25000)) - instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, 0); - } + if (damage > RAID_MODE(23000, 25000, 23000, 25000)) + instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, 0); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KELESETH_KILL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KELESETH_KILL); + } - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) - { - if (spell->Id == 71080 && me->IsInCombat() && !me->IsInEvadeMode()) - DoAction(ACTION_CAST_INVOCATION); - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == 71080 && me->IsInCombat() && !me->IsInEvadeMode()) + DoAction(ACTION_CAST_INVOCATION); + } - void DoAction(int32 action) - { - switch (action) - { - case ACTION_STAND_UP: - summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetReactState(REACT_AGGRESSIVE); - me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why - me->m_Events.AddEvent(new StandUpEvent(*me), me->m_Events.CalculateTime(1000)); - DoAction(ACTION_REMOVE_INVOCATION); - me->SetHealth(1); - break; - case ACTION_CAST_INVOCATION: - Talk(SAY_KELESETH_INVOCATION); - me->CastSpell(me, SPELL_INVOCATION_OF_BLOOD_KELESETH, true); - me->CastSpell(me, SPELL_INVOCATION_VISUAL_ACTIVE, true); - _isEmpowered = true; - break; - case ACTION_REMOVE_INVOCATION: - _isEmpowered = false; - me->RemoveAurasDueToSpell(SPELL_INVOCATION_VISUAL_ACTIVE); - me->RemoveAurasDueToSpell(SPELL_INVOCATION_OF_BLOOD_KELESETH); - break; - default: - break; - } - } + void DoAction(int32 action) + { + switch (action) + { + case ACTION_STAND_UP: + summons.DespawnEntry(WORLD_TRIGGER); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetReactState(REACT_AGGRESSIVE); + me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why + me->m_Events.AddEvent(new StandUpEvent(*me), me->m_Events.CalculateTime(1000)); + DoAction(ACTION_REMOVE_INVOCATION); + me->SetHealth(1); + break; + case ACTION_CAST_INVOCATION: + Talk(SAY_KELESETH_INVOCATION); + me->CastSpell(me, SPELL_INVOCATION_OF_BLOOD_KELESETH, true); + me->CastSpell(me, SPELL_INVOCATION_VISUAL_ACTIVE, true); + _isEmpowered = true; + break; + case ACTION_REMOVE_INVOCATION: + _isEmpowered = false; + me->RemoveAurasDueToSpell(SPELL_INVOCATION_VISUAL_ACTIVE); + me->RemoveAurasDueToSpell(SPELL_INVOCATION_OF_BLOOD_KELESETH); + break; + default: + break; + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - Talk(EMOTE_KELESETH_BERSERK); - break; - case EVENT_SHADOW_RESONANCE: - Talk(SAY_KELESETH_SPECIAL); - me->CastSpell(me, SPELL_SHADOW_RESONANCE, false); - events.ScheduleEvent(EVENT_SHADOW_RESONANCE, urand(10000, 15000)); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + Talk(EMOTE_KELESETH_BERSERK); + break; + case EVENT_SHADOW_RESONANCE: + Talk(SAY_KELESETH_SPECIAL); + me->CastSpell(me, SPELL_SHADOW_RESONANCE, false); + events.ScheduleEvent(EVENT_SHADOW_RESONANCE, urand(10000, 15000)); + break; + } - DoSpellAttackIfReady(_isEmpowered ? SPELL_EMPOWERED_SHADOW_LANCE : SPELL_SHADOW_LANCE); - } + DoSpellAttackIfReady(_isEmpowered ? SPELL_EMPOWERED_SHADOW_LANCE : SPELL_SHADOW_LANCE); + } - void EnterEvadeMode() - { - if (_evading) - return; - _canDie = false; - me->SetHealth(me->GetMaxHealth()); - DoAction(ACTION_REMOVE_INVOCATION); - _evading = true; - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) - taldaram->AI()->EnterEvadeMode(); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - valanar->AI()->EnterEvadeMode(); - ScriptedAI::EnterEvadeMode(); - _evading = false; - } - }; + void EnterEvadeMode() + { + if (_evading) + return; + _canDie = false; + me->SetHealth(me->GetMaxHealth()); + DoAction(ACTION_REMOVE_INVOCATION); + _evading = true; + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + taldaram->AI()->EnterEvadeMode(); + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + valanar->AI()->EnterEvadeMode(); + ScriptedAI::EnterEvadeMode(); + _evading = false; + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class boss_prince_taldaram_icc : public CreatureScript { - public: - boss_prince_taldaram_icc() : CreatureScript("boss_prince_taldaram_icc") { } + public: + boss_prince_taldaram_icc() : CreatureScript("boss_prince_taldaram_icc") { } - struct boss_prince_taldaramAI : public ScriptedAI - { - boss_prince_taldaramAI(Creature* creature) : ScriptedAI(creature), summons(creature), instance(creature->GetInstanceScript()) - { - if (!instance) - { - me->IsAIEnabled = false; - me->AddUnitState(UNIT_STATE_EVADE); - } - _canDie = true; - } + struct boss_prince_taldaramAI : public ScriptedAI + { + boss_prince_taldaramAI(Creature* creature) : ScriptedAI(creature), summons(creature), instance(creature->GetInstanceScript()) + { + if (!instance) + { + me->IsAIEnabled = false; + me->AddUnitState(UNIT_STATE_EVADE); + } + _canDie = true; + } - void InitializeAI() - { - ScriptedAI::InitializeAI(); - if (me->IsAlive()) - { - if (Creature* c = me->SummonCreature(WORLD_TRIGGER, me->GetHomePosition())) - { - c->SetObjectScale(1.75f); - c->CastSpell(c, SPELL_FEIGN_DEATH, true); - } + void InitializeAI() + { + ScriptedAI::InitializeAI(); + if (me->IsAlive()) + { + if (Creature* c = me->SummonCreature(WORLD_TRIGGER, me->GetHomePosition())) + { + c->SetObjectScale(1.75f); + c->CastSpell(c, SPELL_FEIGN_DEATH, true); + } - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->SetReactState(REACT_PASSIVE); - } - } + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetReactState(REACT_PASSIVE); + } + } - EventMap events; - SummonList summons; - InstanceScript* instance; - bool _isEmpowered; - bool _evading; - bool _canDie; + EventMap events; + SummonList summons; + InstanceScript* instance; + bool _isEmpowered; + bool _evading; + bool _canDie; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - _isEmpowered = false; - _evading = false; - me->SetHealth(me->GetMaxHealth()); - me->SetReactState(REACT_AGGRESSIVE); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + _isEmpowered = false; + _evading = false; + me->SetHealth(me->GetMaxHealth()); + me->SetReactState(REACT_AGGRESSIVE); + } - void EnterCombat(Unit* who) - { - bool valid = true; - if (Creature* keleseth = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_KELESETH_GUID))) - if (!keleseth->IsAlive() || keleseth->IsInEvadeMode()) - valid = false; - if (Creature* taldaram = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) - if (!taldaram->IsAlive() || taldaram->IsInEvadeMode()) - valid = false; - if (Creature* valanar = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - if (!valanar->IsAlive() || valanar->IsInEvadeMode()) - valid = false; - if (!valid) - { - EnterEvadeMode(); - return; - } + void EnterCombat(Unit* who) + { + bool valid = true; + if (Creature* keleseth = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (!keleseth->IsAlive() || keleseth->IsInEvadeMode()) + valid = false; + if (Creature* taldaram = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (!taldaram->IsAlive() || taldaram->IsInEvadeMode()) + valid = false; + if (Creature* valanar = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (!valanar->IsAlive() || valanar->IsInEvadeMode()) + valid = false; + if (!valid) + { + EnterEvadeMode(); + return; + } - me->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); // just in case - me->setActive(true); - DoZoneInCombat(); - if (!me->hasLootRecipient()) - me->SetLootRecipient(who); - me->LowerPlayerDamageReq(me->GetMaxHealth()); - me->SetReactState(REACT_AGGRESSIVE); - instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); + me->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); // just in case + me->setActive(true); + DoZoneInCombat(); + if (!me->hasLootRecipient()) + me->SetLootRecipient(who); + me->LowerPlayerDamageReq(me->GetMaxHealth()); + me->SetReactState(REACT_AGGRESSIVE); + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) - if (!keleseth->IsInEvadeMode()) - keleseth->SetInCombatWithZone(); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - if (!valanar->IsInEvadeMode()) - valanar->SetInCombatWithZone(); + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (!keleseth->IsInEvadeMode()) + keleseth->SetInCombatWithZone(); + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (!valanar->IsInEvadeMode()) + valanar->SetInCombatWithZone(); - DoAction(ACTION_REMOVE_INVOCATION); - events.Reset(); - events.ScheduleEvent(EVENT_BERSERK, 600000); - events.ScheduleEvent(EVENT_GLITTERING_SPARKS, urand(12000, 15000)); - events.ScheduleEvent(EVENT_CONJURE_FLAME, 20000); - if (IsHeroic()) - me->AddAura(SPELL_SHADOW_PRISON, me); - } + DoAction(ACTION_REMOVE_INVOCATION); + events.Reset(); + events.ScheduleEvent(EVENT_BERSERK, 600000); + events.ScheduleEvent(EVENT_GLITTERING_SPARKS, urand(12000, 15000)); + events.ScheduleEvent(EVENT_CONJURE_FLAME, 20000); + if (IsHeroic()) + me->AddAura(SPELL_SHADOW_PRISON, me); + } - void JustDied(Unit* /*killer*/) - { - events.Reset(); - summons.DespawnAll(); - instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + void JustDied(Unit* /*killer*/) + { + events.Reset(); + summons.DespawnAll(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - if (!_canDie) - { - me->RemoveCorpse(false); - me->SetRespawnTime(10); - me->SaveRespawnTime(); - Position homePos = me->GetHomePosition(); - me->UpdatePosition(homePos); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - me->StopMovingOnCurrentPos(); - return; - } + if (!_canDie) + { + me->RemoveCorpse(false); + me->SetRespawnTime(10); + me->SaveRespawnTime(); + Position homePos = me->GetHomePosition(); + me->UpdatePosition(homePos); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + me->StopMovingOnCurrentPos(); + return; + } - Talk(EMOTE_TALDARAM_DEATH); - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) - if (keleseth->IsAlive()) - Unit::Kill(keleseth, keleseth); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - if (valanar->IsAlive()) - Unit::Kill(valanar, valanar); - } + Talk(EMOTE_TALDARAM_DEATH); + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (keleseth->IsAlive()) + Unit::Kill(keleseth, keleseth); + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (valanar->IsAlive()) + Unit::Kill(valanar, valanar); + } - void JustRespawned() - { - ScriptedAI::JustRespawned(); - JustReachedHome(); - } + void JustRespawned() + { + ScriptedAI::JustRespawned(); + JustReachedHome(); + } - void JustReachedHome() - { - _canDie = true; - me->setActive(false); - instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - DoAction(ACTION_REMOVE_INVOCATION); - me->SetHealth(1); - } + void JustReachedHome() + { + _canDie = true; + me->setActive(false); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + DoAction(ACTION_REMOVE_INVOCATION); + me->SetHealth(1); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); + void JustSummoned(Creature* summon) + { + summons.Summon(summon); - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -10.0f, true); - if (!target) - target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); - if (target) - { - if (summon->GetEntry() == NPC_BALL_OF_INFERNO_FLAME) - Talk(EMOTE_TALDARAM_FLAME, target); - summon->AI()->SetGUID(target->GetGUID()); - } - } + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -10.0f, true); + if (!target) + target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); + if (target) + { + if (summon->GetEntry() == NPC_BALL_OF_INFERNO_FLAME) + Talk(EMOTE_TALDARAM_FLAME, target); + summon->AI()->SetGUID(target->GetGUID()); + } + } - void SummonedCreatureDespawn(Creature* s) - { - summons.Despawn(s); - } + void SummonedCreatureDespawn(Creature* s) + { + summons.Despawn(s); + } - void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (!_isEmpowered) - { - if (attacker) - me->AddThreat(attacker, float(damage)); - damage = 0; - } - } + void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (!_isEmpowered) + { + if (attacker) + me->AddThreat(attacker, float(damage)); + damage = 0; + } + } - void DamageDealt(Unit* target, uint32& damage, DamageEffectType damageType) - { - if (target->GetTypeId() != TYPEID_PLAYER) - return; + void DamageDealt(Unit* target, uint32& damage, DamageEffectType damageType) + { + if (target->GetTypeId() != TYPEID_PLAYER) + return; - if (damage > RAID_MODE(23000, 25000, 23000, 25000)) - instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, 0); - } + if (damage > RAID_MODE(23000, 25000, 23000, 25000)) + instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, 0); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_TALDARAM_KILL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_TALDARAM_KILL); + } - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) - { - if (spell->Id == 71081 && me->IsInCombat() && !me->IsInEvadeMode()) - DoAction(ACTION_CAST_INVOCATION); - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == 71081 && me->IsInCombat() && !me->IsInEvadeMode()) + DoAction(ACTION_CAST_INVOCATION); + } - void DoAction(int32 action) - { - switch (action) - { - case ACTION_STAND_UP: - summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetReactState(REACT_AGGRESSIVE); - me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why - me->m_Events.AddEvent(new StandUpEvent(*me), me->m_Events.CalculateTime(1000)); - DoAction(ACTION_REMOVE_INVOCATION); - me->SetHealth(1); - break; - case ACTION_CAST_INVOCATION: - Talk(SAY_TALDARAM_INVOCATION); - me->CastSpell(me, SPELL_INVOCATION_OF_BLOOD_TALDARAM, true); - me->CastSpell(me, SPELL_INVOCATION_VISUAL_ACTIVE, true); - _isEmpowered = true; - break; - case ACTION_REMOVE_INVOCATION: - _isEmpowered = false; - me->RemoveAurasDueToSpell(SPELL_INVOCATION_VISUAL_ACTIVE); - me->RemoveAurasDueToSpell(SPELL_INVOCATION_OF_BLOOD_TALDARAM); - break; - case ACTION_FLAME_BALL_CHASE: - summons.DoAction(ACTION_FLAME_BALL_CHASE, 1); - break; - default: - break; - } - } + void DoAction(int32 action) + { + switch (action) + { + case ACTION_STAND_UP: + summons.DespawnEntry(WORLD_TRIGGER); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetReactState(REACT_AGGRESSIVE); + me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why + me->m_Events.AddEvent(new StandUpEvent(*me), me->m_Events.CalculateTime(1000)); + DoAction(ACTION_REMOVE_INVOCATION); + me->SetHealth(1); + break; + case ACTION_CAST_INVOCATION: + Talk(SAY_TALDARAM_INVOCATION); + me->CastSpell(me, SPELL_INVOCATION_OF_BLOOD_TALDARAM, true); + me->CastSpell(me, SPELL_INVOCATION_VISUAL_ACTIVE, true); + _isEmpowered = true; + break; + case ACTION_REMOVE_INVOCATION: + _isEmpowered = false; + me->RemoveAurasDueToSpell(SPELL_INVOCATION_VISUAL_ACTIVE); + me->RemoveAurasDueToSpell(SPELL_INVOCATION_OF_BLOOD_TALDARAM); + break; + case ACTION_FLAME_BALL_CHASE: + summons.DoAction(ACTION_FLAME_BALL_CHASE, 1); + break; + default: + break; + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - Talk(EMOTE_TALDARAM_BERSERK); - break; - case EVENT_GLITTERING_SPARKS: - me->CastSpell(me->GetVictim(), SPELL_GLITTERING_SPARKS, false); - events.ScheduleEvent(EVENT_GLITTERING_SPARKS, urand(15000, 25000)); - break; - case EVENT_CONJURE_FLAME: - if (_isEmpowered) - { - me->CastSpell(me, SPELL_CONJURE_EMPOWERED_FLAME, false); - events.ScheduleEvent(EVENT_CONJURE_FLAME, 15000); - } - else - { - me->CastSpell(me, SPELL_CONJURE_FLAME, false); - events.ScheduleEvent(EVENT_CONJURE_FLAME, urand(20000, 25000)); - } - Talk(SAY_TALDARAM_SPECIAL); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + Talk(EMOTE_TALDARAM_BERSERK); + break; + case EVENT_GLITTERING_SPARKS: + me->CastSpell(me->GetVictim(), SPELL_GLITTERING_SPARKS, false); + events.ScheduleEvent(EVENT_GLITTERING_SPARKS, urand(15000, 25000)); + break; + case EVENT_CONJURE_FLAME: + if (_isEmpowered) + { + me->CastSpell(me, SPELL_CONJURE_EMPOWERED_FLAME, false); + events.ScheduleEvent(EVENT_CONJURE_FLAME, 15000); + } + else + { + me->CastSpell(me, SPELL_CONJURE_FLAME, false); + events.ScheduleEvent(EVENT_CONJURE_FLAME, urand(20000, 25000)); + } + Talk(SAY_TALDARAM_SPECIAL); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - if (_evading) - return; - _canDie = false; - me->SetHealth(me->GetMaxHealth()); - DoAction(ACTION_REMOVE_INVOCATION); - _evading = true; - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) - keleseth->AI()->EnterEvadeMode(); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - valanar->AI()->EnterEvadeMode(); - ScriptedAI::EnterEvadeMode(); - _evading = false; - } - }; + void EnterEvadeMode() + { + if (_evading) + return; + _canDie = false; + me->SetHealth(me->GetMaxHealth()); + DoAction(ACTION_REMOVE_INVOCATION); + _evading = true; + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + keleseth->AI()->EnterEvadeMode(); + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + valanar->AI()->EnterEvadeMode(); + ScriptedAI::EnterEvadeMode(); + _evading = false; + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class boss_prince_valanar_icc : public CreatureScript { - public: - boss_prince_valanar_icc() : CreatureScript("boss_prince_valanar_icc") { } + public: + boss_prince_valanar_icc() : CreatureScript("boss_prince_valanar_icc") { } - struct boss_prince_valanarAI : public BossAI - { - boss_prince_valanarAI(Creature* creature) : BossAI(creature, DATA_BLOOD_PRINCE_COUNCIL) - { - if (!instance) - { - me->IsAIEnabled = false; - me->AddUnitState(UNIT_STATE_EVADE); - } - _canDie = true; - } + struct boss_prince_valanarAI : public BossAI + { + boss_prince_valanarAI(Creature* creature) : BossAI(creature, DATA_BLOOD_PRINCE_COUNCIL) + { + if (!instance) + { + me->IsAIEnabled = false; + me->AddUnitState(UNIT_STATE_EVADE); + } + _canDie = true; + } - void InitializeAI() - { - ScriptedAI::InitializeAI(); - if (me->IsAlive()) - { - if (Creature* c = me->SummonCreature(WORLD_TRIGGER, me->GetHomePosition())) - { - c->SetObjectScale(1.75f); - c->CastSpell(c, SPELL_FEIGN_DEATH, true); - } + void InitializeAI() + { + ScriptedAI::InitializeAI(); + if (me->IsAlive()) + { + if (Creature* c = me->SummonCreature(WORLD_TRIGGER, me->GetHomePosition())) + { + c->SetObjectScale(1.75f); + c->CastSpell(c, SPELL_FEIGN_DEATH, true); + } - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->SetReactState(REACT_PASSIVE); - } - } + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetReactState(REACT_PASSIVE); + } + } - bool _isEmpowered; - bool _evading; - bool _canDie; - uint32 invocationOrder[3]; - uint8 currentInvocationIndex; + bool _isEmpowered; + bool _evading; + bool _canDie; + uint32 invocationOrder[3]; + uint8 currentInvocationIndex; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - _isEmpowered = false; - _evading = false; - me->SetHealth(me->GetMaxHealth()); - me->SetReactState(REACT_AGGRESSIVE); - instance->SetBossState(DATA_BLOOD_PRINCE_COUNCIL, NOT_STARTED); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + _isEmpowered = false; + _evading = false; + me->SetHealth(me->GetMaxHealth()); + me->SetReactState(REACT_AGGRESSIVE); + instance->SetBossState(DATA_BLOOD_PRINCE_COUNCIL, NOT_STARTED); + } - void EnterCombat(Unit* who) - { - bool valid = true; - if (Creature* keleseth = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_KELESETH_GUID))) - if (!keleseth->IsAlive() || keleseth->IsInEvadeMode()) - valid = false; - if (Creature* taldaram = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) - if (!taldaram->IsAlive() || taldaram->IsInEvadeMode()) - valid = false; - if (Creature* valanar = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - if (!valanar->IsAlive() || valanar->IsInEvadeMode()) - valid = false; - if (!valid) - { - EnterEvadeMode(); - return; - } + void EnterCombat(Unit* who) + { + bool valid = true; + if (Creature* keleseth = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (!keleseth->IsAlive() || keleseth->IsInEvadeMode()) + valid = false; + if (Creature* taldaram = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (!taldaram->IsAlive() || taldaram->IsInEvadeMode()) + valid = false; + if (Creature* valanar = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + if (!valanar->IsAlive() || valanar->IsInEvadeMode()) + valid = false; + if (!valid) + { + EnterEvadeMode(); + return; + } - instance->SetBossState(DATA_BLOOD_PRINCE_COUNCIL, IN_PROGRESS); - instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, 1); - me->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); // just in case - me->setActive(true); - DoZoneInCombat(); - if (!me->hasLootRecipient()) - me->SetLootRecipient(who); - me->LowerPlayerDamageReq(me->GetMaxHealth()); - me->SetReactState(REACT_AGGRESSIVE); - instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); + instance->SetBossState(DATA_BLOOD_PRINCE_COUNCIL, IN_PROGRESS); + instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, 1); + me->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); // just in case + me->setActive(true); + DoZoneInCombat(); + if (!me->hasLootRecipient()) + me->SetLootRecipient(who); + me->LowerPlayerDamageReq(me->GetMaxHealth()); + me->SetReactState(REACT_AGGRESSIVE); + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) - if (!keleseth->IsInEvadeMode()) - keleseth->SetInCombatWithZone(); - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) - if (!taldaram->IsInEvadeMode()) - taldaram->SetInCombatWithZone(); + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (!keleseth->IsInEvadeMode()) + keleseth->SetInCombatWithZone(); + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (!taldaram->IsInEvadeMode()) + taldaram->SetInCombatWithZone(); - DoAction(ACTION_CAST_INVOCATION); - currentInvocationIndex = 0; - invocationOrder[0] = DATA_PRINCE_VALANAR_GUID; - invocationOrder[1] = RAND(DATA_PRINCE_KELESETH_GUID, DATA_PRINCE_TALDARAM_GUID); - invocationOrder[2] = DATA_PRINCE_KELESETH_GUID + DATA_PRINCE_TALDARAM_GUID - invocationOrder[1]; + DoAction(ACTION_CAST_INVOCATION); + currentInvocationIndex = 0; + invocationOrder[0] = DATA_PRINCE_VALANAR_GUID; + invocationOrder[1] = RAND(DATA_PRINCE_KELESETH_GUID, DATA_PRINCE_TALDARAM_GUID); + invocationOrder[2] = DATA_PRINCE_KELESETH_GUID + DATA_PRINCE_TALDARAM_GUID - invocationOrder[1]; - events.ScheduleEvent(EVENT_BERSERK, 600000); - events.ScheduleEvent(EVENT_KINETIC_BOMB, urand(18000, 24000)); - events.ScheduleEvent(EVENT_SHOCK_VORTEX, urand(15000, 20000)); - events.ScheduleEvent(EVENT_INVOCATION_OF_BLOOD, 45000); - if (IsHeroic()) - { - me->AddAura(SPELL_SHADOW_PRISON, me); - me->CastSpell(me, SPELL_SHADOW_PRISON_DUMMY, true); - } - } + events.ScheduleEvent(EVENT_BERSERK, 600000); + events.ScheduleEvent(EVENT_KINETIC_BOMB, urand(18000, 24000)); + events.ScheduleEvent(EVENT_SHOCK_VORTEX, urand(15000, 20000)); + events.ScheduleEvent(EVENT_INVOCATION_OF_BLOOD, 45000); + if (IsHeroic()) + { + me->AddAura(SPELL_SHADOW_PRISON, me); + me->CastSpell(me, SPELL_SHADOW_PRISON_DUMMY, true); + } + } - void JustDied(Unit* /*killer*/) - { - events.Reset(); - summons.DespawnAll(); - instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + void JustDied(Unit* /*killer*/) + { + events.Reset(); + summons.DespawnAll(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - if (!_canDie) - { - me->RemoveCorpse(false); - me->SetRespawnTime(10); - me->SaveRespawnTime(); - Position homePos = me->GetHomePosition(); - me->UpdatePosition(homePos); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - me->StopMovingOnCurrentPos(); - return; - } + if (!_canDie) + { + me->RemoveCorpse(false); + me->SetRespawnTime(10); + me->SaveRespawnTime(); + Position homePos = me->GetHomePosition(); + me->UpdatePosition(homePos); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + me->StopMovingOnCurrentPos(); + return; + } - Talk(SAY_VALANAR_DEATH); - instance->SetBossState(DATA_BLOOD_PRINCE_COUNCIL, DONE); - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) - if (keleseth->IsAlive()) - Unit::Kill(keleseth, keleseth); - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) - if (taldaram->IsAlive()) - Unit::Kill(taldaram, taldaram); - } + Talk(SAY_VALANAR_DEATH); + instance->SetBossState(DATA_BLOOD_PRINCE_COUNCIL, DONE); + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + if (keleseth->IsAlive()) + Unit::Kill(keleseth, keleseth); + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + if (taldaram->IsAlive()) + Unit::Kill(taldaram, taldaram); + } - void JustRespawned() - { - BossAI::JustRespawned(); - JustReachedHome(); - } + void JustRespawned() + { + BossAI::JustRespawned(); + JustReachedHome(); + } - void JustReachedHome() - { - _canDie = true; - me->setActive(false); - instance->SetBossState(DATA_BLOOD_PRINCE_COUNCIL, FAIL); - instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - me->SetHealth(me->GetMaxHealth()); - DoAction(ACTION_CAST_INVOCATION); - } + void JustReachedHome() + { + _canDie = true; + me->setActive(false); + instance->SetBossState(DATA_BLOOD_PRINCE_COUNCIL, FAIL); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + me->SetHealth(me->GetMaxHealth()); + DoAction(ACTION_CAST_INVOCATION); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - switch (summon->GetEntry()) - { - case NPC_KINETIC_BOMB_TARGET: - summon->SetReactState(REACT_PASSIVE); - summon->CastSpell(summon, SPELL_KINETIC_BOMB, true, NULL, NULL, me->GetGUID()); - break; - case NPC_SHOCK_VORTEX: - summon->m_Events.AddEvent(new ShockVortexExplodeEvent(*summon), summon->m_Events.CalculateTime(4500)); - break; - default: - break; - } - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + switch (summon->GetEntry()) + { + case NPC_KINETIC_BOMB_TARGET: + summon->SetReactState(REACT_PASSIVE); + summon->CastSpell(summon, SPELL_KINETIC_BOMB, true, NULL, NULL, me->GetGUID()); + break; + case NPC_SHOCK_VORTEX: + summon->m_Events.AddEvent(new ShockVortexExplodeEvent(*summon), summon->m_Events.CalculateTime(4500)); + break; + default: + break; + } + } - void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (!_isEmpowered) - { - if (attacker) - me->AddThreat(attacker, float(damage)); - damage = 0; - } - } + void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (!_isEmpowered) + { + if (attacker) + me->AddThreat(attacker, float(damage)); + damage = 0; + } + } - void DamageDealt(Unit* target, uint32& damage, DamageEffectType damageType) - { - if (target->GetTypeId() != TYPEID_PLAYER) - return; + void DamageDealt(Unit* target, uint32& damage, DamageEffectType damageType) + { + if (target->GetTypeId() != TYPEID_PLAYER) + return; - if (damage > RAID_MODE(23000, 25000, 23000, 25000)) - instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, 0); - } + if (damage > RAID_MODE(23000, 25000, 23000, 25000)) + instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, 0); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_VALANAR_KILL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_VALANAR_KILL); + } - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) - { - if (spell->Id == 71070 && me->IsInCombat() && !me->IsInEvadeMode()) - DoAction(ACTION_CAST_INVOCATION); - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == 71070 && me->IsInCombat() && !me->IsInEvadeMode()) + DoAction(ACTION_CAST_INVOCATION); + } - void DoAction(int32 action) - { - switch (action) - { - case ACTION_STAND_UP: - summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetReactState(REACT_AGGRESSIVE); - me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why - me->m_Events.AddEvent(new StandUpEvent(*me), me->m_Events.CalculateTime(1000)); - me->SetHealth(me->GetMaxHealth()); - DoAction(ACTION_CAST_INVOCATION); - break; - case ACTION_CAST_INVOCATION: - if (me->IsInCombat()) - Talk(SAY_VALANAR_INVOCATION); - me->CastSpell(me, SPELL_INVOCATION_OF_BLOOD_VALANAR, true); - me->CastSpell(me, SPELL_INVOCATION_VISUAL_ACTIVE, true); - _isEmpowered = true; - break; - case ACTION_REMOVE_INVOCATION: - _isEmpowered = false; - me->RemoveAurasDueToSpell(SPELL_INVOCATION_VISUAL_ACTIVE); - me->RemoveAurasDueToSpell(SPELL_INVOCATION_OF_BLOOD_VALANAR); - break; - default: - break; - } - } + void DoAction(int32 action) + { + switch (action) + { + case ACTION_STAND_UP: + summons.DespawnEntry(WORLD_TRIGGER); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetReactState(REACT_AGGRESSIVE); + me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why + me->m_Events.AddEvent(new StandUpEvent(*me), me->m_Events.CalculateTime(1000)); + me->SetHealth(me->GetMaxHealth()); + DoAction(ACTION_CAST_INVOCATION); + break; + case ACTION_CAST_INVOCATION: + if (me->IsInCombat()) + Talk(SAY_VALANAR_INVOCATION); + me->CastSpell(me, SPELL_INVOCATION_OF_BLOOD_VALANAR, true); + me->CastSpell(me, SPELL_INVOCATION_VISUAL_ACTIVE, true); + _isEmpowered = true; + break; + case ACTION_REMOVE_INVOCATION: + _isEmpowered = false; + me->RemoveAurasDueToSpell(SPELL_INVOCATION_VISUAL_ACTIVE); + me->RemoveAurasDueToSpell(SPELL_INVOCATION_OF_BLOOD_VALANAR); + break; + default: + break; + } + } - bool CheckRoom() - { - Creature* keleseth = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_KELESETH_GUID)); - Creature* taldaram = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_TALDARAM_GUID)); - if (keleseth && taldaram && CheckBoundary(me) && CheckBoundary(keleseth) && CheckBoundary(taldaram)) - return true; + bool CheckRoom() + { + Creature* keleseth = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_KELESETH_GUID)); + Creature* taldaram = instance->instance->GetCreature(instance->GetData64(DATA_PRINCE_TALDARAM_GUID)); + if (keleseth && taldaram && CheckBoundary(me) && CheckBoundary(keleseth) && CheckBoundary(taldaram)) + return true; - EnterEvadeMode(); - return false; - } + EnterEvadeMode(); + return false; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() || !CheckRoom()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() || !CheckRoom()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_INVOCATION_OF_BLOOD: - { - uint32 visualSpellId = 0; - Creature* current = instance->instance->GetCreature(instance->GetData64(invocationOrder[currentInvocationIndex])); - if (++currentInvocationIndex >= 3) - currentInvocationIndex = 0; - Creature* next = instance->instance->GetCreature(instance->GetData64(invocationOrder[currentInvocationIndex])); - switch (invocationOrder[currentInvocationIndex]) - { - case DATA_PRINCE_KELESETH_GUID: - visualSpellId = 71080; - break; - case DATA_PRINCE_TALDARAM_GUID: - visualSpellId = 71081; - break; - case DATA_PRINCE_VALANAR_GUID: - visualSpellId = 71070; - break; - } - if (!visualSpellId || !current || !next || !current->IsInCombat() || !next->IsInCombat()) - { - EnterEvadeMode(); - return; - } - next->SetHealth(current->GetHealth()); - current->AI()->DoAction(ACTION_REMOVE_INVOCATION); - current->SetHealth(1); - current->CastSpell((Unit*)NULL, visualSpellId, true); - next->AI()->Talk(1); - } - events.ScheduleEvent(EVENT_INVOCATION_OF_BLOOD, 46000); - break; - case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - Talk(SAY_VALANAR_BERSERK); - break; - case EVENT_KINETIC_BOMB: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) - { - me->CastSpell(target, SPELL_KINETIC_BOMB_TARGET, false); - Talk(SAY_VALANAR_SPECIAL); - } - events.ScheduleEvent(EVENT_KINETIC_BOMB, me->GetMap()->Is25ManRaid() ? 20500 : 30500); - break; - case EVENT_SHOCK_VORTEX: - if (_isEmpowered) - { - me->CastSpell(me, SPELL_EMPOWERED_SHOCK_VORTEX, false); - Talk(EMOTE_VALANAR_SHOCK_VORTEX); - events.ScheduleEvent(EVENT_SHOCK_VORTEX, 30000); - } - else - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) - me->CastSpell(target, SPELL_SHOCK_VORTEX, false); - events.ScheduleEvent(EVENT_SHOCK_VORTEX, urand(18000, 23000)); - } - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_INVOCATION_OF_BLOOD: + { + uint32 visualSpellId = 0; + Creature* current = instance->instance->GetCreature(instance->GetData64(invocationOrder[currentInvocationIndex])); + if (++currentInvocationIndex >= 3) + currentInvocationIndex = 0; + Creature* next = instance->instance->GetCreature(instance->GetData64(invocationOrder[currentInvocationIndex])); + switch (invocationOrder[currentInvocationIndex]) + { + case DATA_PRINCE_KELESETH_GUID: + visualSpellId = 71080; + break; + case DATA_PRINCE_TALDARAM_GUID: + visualSpellId = 71081; + break; + case DATA_PRINCE_VALANAR_GUID: + visualSpellId = 71070; + break; + } + if (!visualSpellId || !current || !next || !current->IsInCombat() || !next->IsInCombat()) + { + EnterEvadeMode(); + return; + } + next->SetHealth(current->GetHealth()); + current->AI()->DoAction(ACTION_REMOVE_INVOCATION); + current->SetHealth(1); + current->CastSpell((Unit*)NULL, visualSpellId, true); + next->AI()->Talk(1); + } + events.ScheduleEvent(EVENT_INVOCATION_OF_BLOOD, 46000); + break; + case EVENT_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + Talk(SAY_VALANAR_BERSERK); + break; + case EVENT_KINETIC_BOMB: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + { + me->CastSpell(target, SPELL_KINETIC_BOMB_TARGET, false); + Talk(SAY_VALANAR_SPECIAL); + } + events.ScheduleEvent(EVENT_KINETIC_BOMB, me->GetMap()->Is25ManRaid() ? 20500 : 30500); + break; + case EVENT_SHOCK_VORTEX: + if (_isEmpowered) + { + me->CastSpell(me, SPELL_EMPOWERED_SHOCK_VORTEX, false); + Talk(EMOTE_VALANAR_SHOCK_VORTEX); + events.ScheduleEvent(EVENT_SHOCK_VORTEX, 30000); + } + else + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + me->CastSpell(target, SPELL_SHOCK_VORTEX, false); + events.ScheduleEvent(EVENT_SHOCK_VORTEX, urand(18000, 23000)); + } + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - if (_evading) - return; - _canDie = false; - me->SetHealth(me->GetMaxHealth()); - DoAction(ACTION_REMOVE_INVOCATION); - _evading = true; - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) - keleseth->AI()->EnterEvadeMode(); - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) - taldaram->AI()->EnterEvadeMode(); - BossAI::EnterEvadeMode(); - _evading = false; - } - }; + void EnterEvadeMode() + { + if (_evading) + return; + _canDie = false; + me->SetHealth(me->GetMaxHealth()); + DoAction(ACTION_REMOVE_INVOCATION); + _evading = true; + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + keleseth->AI()->EnterEvadeMode(); + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + taldaram->AI()->EnterEvadeMode(); + BossAI::EnterEvadeMode(); + _evading = false; + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_blood_queen_lana_thel : public CreatureScript { - public: - npc_blood_queen_lana_thel() : CreatureScript("npc_blood_queen_lana_thel") { } + public: + npc_blood_queen_lana_thel() : CreatureScript("npc_blood_queen_lana_thel") { } - struct npc_blood_queen_lana_thelAI : public ScriptedAI - { - npc_blood_queen_lana_thelAI(Creature* creature) : ScriptedAI(creature) - { - _introDone = false; - _instance = creature->GetInstanceScript(); - me->m_SightDistance = 100.0f; // for MoveInLineOfSight distance - } + struct npc_blood_queen_lana_thelAI : public ScriptedAI + { + npc_blood_queen_lana_thelAI(Creature* creature) : ScriptedAI(creature) + { + _introDone = false; + _instance = creature->GetInstanceScript(); + me->m_SightDistance = 100.0f; // for MoveInLineOfSight distance + } - void Reset() - { - _events.Reset(); - me->SetDisableGravity(true); - if (_instance->GetBossState(DATA_BLOOD_PRINCE_COUNCIL) == DONE) - { - me->SetVisible(false); - _introDone = true; - } - else - me->SetVisible(true); - } + void Reset() + { + _events.Reset(); + me->SetDisableGravity(true); + if (_instance->GetBossState(DATA_BLOOD_PRINCE_COUNCIL) == DONE) + { + me->SetVisible(false); + _introDone = true; + } + else + me->SetVisible(true); + } - void MoveInLineOfSight(Unit* who) - { - if (_introDone) - return; + void MoveInLineOfSight(Unit* who) + { + if (_introDone) + return; - if (who->GetTypeId() != TYPEID_PLAYER || me->GetExactDist2d(who) > 100.0f) - return; + if (who->GetTypeId() != TYPEID_PLAYER || me->GetExactDist2d(who) > 100.0f) + return; - _introDone = true; - Talk(SAY_INTRO_1); - _events.SetPhase(1); - _events.ScheduleEvent(EVENT_INTRO_1, 14000); - // summon a visual trigger - if (Creature* summon = DoSummon(NPC_FLOATING_TRIGGER, triggerPos, 15000, TEMPSUMMON_TIMED_DESPAWN)) - { - summon->SetDisplayId(11686); // it's a general npc, and the template has 2 models (first is an infernal) - summon->CastSpell(summon, SPELL_OOC_INVOCATION_VISUAL, true); - summon->SetSpeed(MOVE_RUN, 0.15f, true); - summon->GetMotionMaster()->MovePoint(0, triggerEndPos); - } - } + _introDone = true; + Talk(SAY_INTRO_1); + _events.SetPhase(1); + _events.ScheduleEvent(EVENT_INTRO_1, 14000); + // summon a visual trigger + if (Creature* summon = DoSummon(NPC_FLOATING_TRIGGER, triggerPos, 15000, TEMPSUMMON_TIMED_DESPAWN)) + { + summon->SetDisplayId(11686); // it's a general npc, and the template has 2 models (first is an infernal) + summon->CastSpell(summon, SPELL_OOC_INVOCATION_VISUAL, true); + summon->SetSpeed(MOVE_RUN, 0.15f, true); + summon->GetMotionMaster()->MovePoint(0, triggerEndPos); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == POINT_INTRO_DESPAWN) - me->SetVisible(false); - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == POINT_INTRO_DESPAWN) + me->SetVisible(false); + } - void UpdateAI(uint32 diff) - { - if (!_events.GetPhaseMask()) - return; + void UpdateAI(uint32 diff) + { + if (!_events.GetPhaseMask()) + return; - _events.Update(diff); + _events.Update(diff); - if (_events.ExecuteEvent() == EVENT_INTRO_1) - { - Talk(SAY_INTRO_2); - me->GetMotionMaster()->MovePoint(POINT_INTRO_DESPAWN, introFinalPos); - _events.Reset(); + if (_events.ExecuteEvent() == EVENT_INTRO_1) + { + Talk(SAY_INTRO_2); + me->GetMotionMaster()->MovePoint(POINT_INTRO_DESPAWN, introFinalPos); + _events.Reset(); - if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_KELESETH_GUID))) - keleseth->AI()->DoAction(ACTION_STAND_UP); - if (Creature* taldaram = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) - taldaram->AI()->DoAction(ACTION_STAND_UP); - if (Creature* valanar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - valanar->AI()->DoAction(ACTION_STAND_UP); - } - } + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_KELESETH_GUID))) + keleseth->AI()->DoAction(ACTION_STAND_UP); + if (Creature* taldaram = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_TALDARAM_GUID))) + taldaram->AI()->DoAction(ACTION_STAND_UP); + if (Creature* valanar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + valanar->AI()->DoAction(ACTION_STAND_UP); + } + } - private: - EventMap _events; - InstanceScript* _instance; - bool _introDone; - }; + private: + EventMap _events; + InstanceScript* _instance; + bool _introDone; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_dark_nucleus : public CreatureScript { - public: - npc_dark_nucleus() : CreatureScript("npc_dark_nucleus") { } + public: + npc_dark_nucleus() : CreatureScript("npc_dark_nucleus") { } - struct npc_dark_nucleusAI : public ScriptedAI - { - npc_dark_nucleusAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_dark_nucleusAI : public ScriptedAI + { + npc_dark_nucleusAI(Creature* creature) : ScriptedAI(creature) {} - uint16 timer; + uint16 timer; - void Reset() - { - timer = 0; - me->SetReactState(REACT_DEFENSIVE); - me->SetHover(true); - me->CastSpell(me, SPELL_SHADOW_RESONANCE_AURA, true); - } + void Reset() + { + timer = 0; + me->SetReactState(REACT_DEFENSIVE); + me->SetHover(true); + me->CastSpell(me, SPELL_SHADOW_RESONANCE_AURA, true); + } - void AttackStart(Unit* who) - { - if (who != me->GetVictim()) - { - me->InterruptNonMeleeSpells(true, 0, true); - me->CastSpell(who, SPELL_SHADOW_RESONANCE_RESIST, false); - me->ClearUnitState(UNIT_STATE_CASTING); - } - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (who != me->GetVictim()) + { + me->InterruptNonMeleeSpells(true, 0, true); + me->CastSpell(who, SPELL_SHADOW_RESONANCE_RESIST, false); + me->ClearUnitState(UNIT_STATE_CASTING); + } + ScriptedAI::AttackStart(who); + } - void DamageTaken(Unit* attacker, uint32& /*damage*/, DamageEffectType det, SpellSchoolMask) - { - if (!attacker || attacker == me || attacker == me->GetVictim() || (det != DIRECT_DAMAGE && det != SPELL_DIRECT_DAMAGE)) - return; + void DamageTaken(Unit* attacker, uint32& /*damage*/, DamageEffectType det, SpellSchoolMask) + { + if (!attacker || attacker == me || attacker == me->GetVictim() || (det != DIRECT_DAMAGE && det != SPELL_DIRECT_DAMAGE)) + return; - me->DeleteThreatList(); - me->AddThreat(attacker, 500000000.0f); - } + me->DeleteThreatList(); + me->AddThreat(attacker, 500000000.0f); + } - void JustDied(Unit* /*killer*/) - { - me->DespawnOrUnsummon(1); - } + void JustDied(Unit* /*killer*/) + { + me->DespawnOrUnsummon(1); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if (timer <= diff) - { - timer = 1000; - if (Unit* victim = me->GetVictim()) - if (me->GetDistance(victim) < 15.0f && !victim->HasAura(SPELL_SHADOW_RESONANCE_RESIST, me->GetGUID())) - { - me->InterruptNonMeleeSpells(true, 0, true); - me->CastSpell(victim, SPELL_SHADOW_RESONANCE_RESIST, false); - me->ClearUnitState(UNIT_STATE_CASTING); - } - } - else - timer -= diff; - } - }; + if (timer <= diff) + { + timer = 1000; + if (Unit* victim = me->GetVictim()) + if (me->GetDistance(victim) < 15.0f && !victim->HasAura(SPELL_SHADOW_RESONANCE_RESIST, me->GetGUID())) + { + me->InterruptNonMeleeSpells(true, 0, true); + me->CastSpell(victim, SPELL_SHADOW_RESONANCE_RESIST, false); + me->ClearUnitState(UNIT_STATE_CASTING); + } + } + else + timer -= diff; + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_ball_of_flame : public CreatureScript { - public: - npc_ball_of_flame() : CreatureScript("npc_ball_of_flame") { } + public: + npc_ball_of_flame() : CreatureScript("npc_ball_of_flame") { } - struct npc_ball_of_flameAI : public ScriptedAI - { - npc_ball_of_flameAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) - { - _chaseGUID = 0; - _exploded = false; - _started = false; - if (me->GetEntry() == NPC_BALL_OF_INFERNO_FLAME) - me->CastSpell(me, SPELL_BALL_OF_FLAMES_PROC, true); - me->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+5.0f, me->GetOrientation()); - } + struct npc_ball_of_flameAI : public ScriptedAI + { + npc_ball_of_flameAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) + { + _chaseGUID = 0; + _exploded = false; + _started = false; + if (me->GetEntry() == NPC_BALL_OF_INFERNO_FLAME) + me->CastSpell(me, SPELL_BALL_OF_FLAMES_PROC, true); + me->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+5.0f, me->GetOrientation()); + } - InstanceScript* _instance; - uint64 _chaseGUID; - bool _exploded; - bool _started; + InstanceScript* _instance; + uint64 _chaseGUID; + bool _exploded; + bool _started; - void AttackStart(Unit* who) - { - if (_started) - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (_started) + ScriptedAI::AttackStart(who); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void MovementInform(uint32 type, uint32 id) - { - if (type == CHASE_MOTION_TYPE && !_exploded) - { - me->RemoveAurasDueToSpell(SPELL_BALL_OF_FLAMES_PERIODIC); - me->SetReactState(REACT_PASSIVE); - me->SetControlled(true, UNIT_STATE_ROOT); - me->StopMoving(); - me->CastSpell(me, SPELL_FLAMES, true); - me->DespawnOrUnsummon(999); - me->CastSpell(me, SPELL_FLAME_SPHERE_DEATH_EFFECT, true); - _exploded = true; - } - } + void MovementInform(uint32 type, uint32 id) + { + if (type == CHASE_MOTION_TYPE && !_exploded) + { + me->RemoveAurasDueToSpell(SPELL_BALL_OF_FLAMES_PERIODIC); + me->SetReactState(REACT_PASSIVE); + me->SetControlled(true, UNIT_STATE_ROOT); + me->StopMoving(); + me->CastSpell(me, SPELL_FLAMES, true); + me->DespawnOrUnsummon(999); + me->CastSpell(me, SPELL_FLAME_SPHERE_DEATH_EFFECT, true); + _exploded = true; + } + } - void SetGUID(uint64 guid, int32 /*type*/) - { - _chaseGUID = guid; - } + void SetGUID(uint64 guid, int32 /*type*/) + { + _chaseGUID = guid; + } - void DoAction(int32 action) - { - if (action != ACTION_FLAME_BALL_CHASE || me->IsInCombat()) - return; - Player* target = NULL; - if (_chaseGUID) - target = ObjectAccessor::GetPlayer(*me, _chaseGUID); - if (!target) - target = ScriptedAI::SelectTargetFromPlayerList(150.0f, 0, true); - if (target) - { - // need to clear states now because this call is before AuraEffect is fully removed - _started = true; - if (me->GetEntry() == NPC_BALL_OF_INFERNO_FLAME) - me->CastSpell(me, SPELL_BALL_OF_FLAMES_PERIODIC, true); - me->ClearUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED); - me->AddThreat(target, 1000.0f); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - me->SendMovementFlagUpdate(); - AttackStart(target); - me->SetInCombatWithZone(); - return; - } - me->DespawnOrUnsummon(1); - } + void DoAction(int32 action) + { + if (action != ACTION_FLAME_BALL_CHASE || me->IsInCombat()) + return; + Player* target = NULL; + if (_chaseGUID) + target = ObjectAccessor::GetPlayer(*me, _chaseGUID); + if (!target) + target = ScriptedAI::SelectTargetFromPlayerList(150.0f, 0, true); + if (target) + { + // need to clear states now because this call is before AuraEffect is fully removed + _started = true; + if (me->GetEntry() == NPC_BALL_OF_INFERNO_FLAME) + me->CastSpell(me, SPELL_BALL_OF_FLAMES_PERIODIC, true); + me->ClearUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED); + me->AddThreat(target, 1000.0f); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + me->SendMovementFlagUpdate(); + AttackStart(target); + me->SetInCombatWithZone(); + return; + } + me->DespawnOrUnsummon(1); + } - void DamageDealt(Unit* target, uint32& damage, DamageEffectType damageType) - { - if (target->GetTypeId() != TYPEID_PLAYER) - return; + void DamageDealt(Unit* target, uint32& damage, DamageEffectType damageType) + { + if (target->GetTypeId() != TYPEID_PLAYER) + return; - if (damage > RAID_MODE(23000, 25000, 23000, 25000)) - _instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, 0); - } - }; + if (damage > RAID_MODE(23000, 25000, 23000, 25000)) + _instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, 0); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_kinetic_bomb : public CreatureScript { - public: - npc_kinetic_bomb() : CreatureScript("npc_kinetic_bomb") { } + public: + npc_kinetic_bomb() : CreatureScript("npc_kinetic_bomb") { } - struct npc_kinetic_bombAI : public NullCreatureAI - { - npc_kinetic_bombAI(Creature* creature) : NullCreatureAI(creature) - { - } + struct npc_kinetic_bombAI : public NullCreatureAI + { + npc_kinetic_bombAI(Creature* creature) : NullCreatureAI(creature) + { + } - EventMap _events; - float _x; - float _y; - float _groundZ; - bool exploded; + EventMap _events; + float _x; + float _y; + float _groundZ; + bool exploded; - void IsSummonedBy(Unit* /*summoner*/) - { - if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) - valanar->AI()->JustSummoned(me); - } + void IsSummonedBy(Unit* /*summoner*/) + { + if (InstanceScript* instance = me->GetInstanceScript()) + if (Creature* valanar = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PRINCE_VALANAR_GUID))) + valanar->AI()->JustSummoned(me); + } - void Reset() - { - _events.Reset(); - _events.RescheduleEvent(EVENT_BOMB_DESPAWN, 60000); - me->SetWalk(true); - exploded = false; + void Reset() + { + _events.Reset(); + _events.RescheduleEvent(EVENT_BOMB_DESPAWN, 60000); + me->SetWalk(true); + exploded = false; - float x, y, z; - me->GetPosition(x, y, z); - _x = x; - _y = y; - _groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z, true, 500.0f); - me->GetMotionMaster()->MoveCharge(_x, _y, _groundZ, me->GetSpeed(MOVE_WALK)); - } + float x, y, z; + me->GetPosition(x, y, z); + _x = x; + _y = y; + _groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z, true, 500.0f); + me->GetMotionMaster()->MoveCharge(_x, _y, _groundZ, me->GetSpeed(MOVE_WALK)); + } - void DoAction(int32 action) - { - if (action == SPELL_KINETIC_BOMB_EXPLOSION) - { - exploded = true; - _events.RescheduleEvent(EVENT_BOMB_DESPAWN, 1000); - } - else if (action == ACTION_KINETIC_BOMB_JUMP) - { - if (!me->HasAura(SPELL_KINETIC_BOMB_KNOCKBACK)) - { - me->GetMotionMaster()->MovementExpired(false); - me->StopMoving(); - me->GetMotionMaster()->MoveCharge(_x, _y, me->GetPositionZ() + 60.0f, me->GetSpeed(MOVE_RUN)); - } - _events.RescheduleEvent(EVENT_CONTINUE_FALLING, 3000); - } - } + void DoAction(int32 action) + { + if (action == SPELL_KINETIC_BOMB_EXPLOSION) + { + exploded = true; + _events.RescheduleEvent(EVENT_BOMB_DESPAWN, 1000); + } + else if (action == ACTION_KINETIC_BOMB_JUMP) + { + if (!me->HasAura(SPELL_KINETIC_BOMB_KNOCKBACK)) + { + me->GetMotionMaster()->MovementExpired(false); + me->StopMoving(); + me->GetMotionMaster()->MoveCharge(_x, _y, me->GetPositionZ() + 60.0f, me->GetSpeed(MOVE_RUN)); + } + _events.RescheduleEvent(EVENT_CONTINUE_FALLING, 3000); + } + } - void UpdateAI(uint32 diff) - { - _events.Update(diff); - switch (_events.ExecuteEvent()) - { - case EVENT_BOMB_DESPAWN: - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->DespawnOrUnsummon(exploded ? 5000 : 0); - break; - case EVENT_CONTINUE_FALLING: - me->GetMotionMaster()->MovementExpired(false); - me->StopMoving(); - me->GetMotionMaster()->MoveCharge(_x, _y, _groundZ, me->GetSpeed(MOVE_WALK)); - break; - } - } - }; + void UpdateAI(uint32 diff) + { + _events.Update(diff); + switch (_events.ExecuteEvent()) + { + case EVENT_BOMB_DESPAWN: + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->DespawnOrUnsummon(exploded ? 5000 : 0); + break; + case EVENT_CONTINUE_FALLING: + me->GetMotionMaster()->MovementExpired(false); + me->StopMoving(); + me->GetMotionMaster()->MoveCharge(_x, _y, _groundZ, me->GetSpeed(MOVE_WALK)); + break; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_blood_council_shadow_prison : public SpellScriptLoader { - public: - spell_blood_council_shadow_prison() : SpellScriptLoader("spell_blood_council_shadow_prison") { } + public: + spell_blood_council_shadow_prison() : SpellScriptLoader("spell_blood_council_shadow_prison") { } - class spell_blood_council_shadow_prison_AuraScript : public AuraScript - { - PrepareAuraScript(spell_blood_council_shadow_prison_AuraScript); + class spell_blood_council_shadow_prison_AuraScript : public AuraScript + { + PrepareAuraScript(spell_blood_council_shadow_prison_AuraScript); - void HandleDummyTick(AuraEffect const* aurEff) - { - if (GetTarget()->GetTypeId() == TYPEID_PLAYER && GetTarget()->isMoving()) - GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, true, NULL, aurEff); - } + void HandleDummyTick(AuraEffect const* aurEff) + { + if (GetTarget()->GetTypeId() == TYPEID_PLAYER && GetTarget()->isMoving()) + GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, true, NULL, aurEff); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_blood_council_shadow_prison_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_blood_council_shadow_prison_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_blood_council_shadow_prison_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_blood_council_shadow_prison_AuraScript(); + } }; class spell_blood_council_shadow_prison_damage : public SpellScriptLoader { - public: - spell_blood_council_shadow_prison_damage() : SpellScriptLoader("spell_blood_council_shadow_prison_damage") { } + public: + spell_blood_council_shadow_prison_damage() : SpellScriptLoader("spell_blood_council_shadow_prison_damage") { } - class spell_blood_council_shadow_prison_SpellScript : public SpellScript - { - PrepareSpellScript(spell_blood_council_shadow_prison_SpellScript); + class spell_blood_council_shadow_prison_SpellScript : public SpellScript + { + PrepareSpellScript(spell_blood_council_shadow_prison_SpellScript); - void AddExtraDamage() - { - if (Aura* aur = GetHitUnit()->GetAura(GetSpellInfo()->Id)) - if (AuraEffect const* eff = aur->GetEffect(EFFECT_1)) - SetHitDamage(GetHitDamage() + eff->GetAmount()); - } + void AddExtraDamage() + { + if (Aura* aur = GetHitUnit()->GetAura(GetSpellInfo()->Id)) + if (AuraEffect const* eff = aur->GetEffect(EFFECT_1)) + SetHitDamage(GetHitDamage() + eff->GetAmount()); + } - void Register() - { - OnHit += SpellHitFn(spell_blood_council_shadow_prison_SpellScript::AddExtraDamage); - } - }; + void Register() + { + OnHit += SpellHitFn(spell_blood_council_shadow_prison_SpellScript::AddExtraDamage); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_blood_council_shadow_prison_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_blood_council_shadow_prison_SpellScript(); + } }; class spell_taldaram_glittering_sparks : public SpellScriptLoader { - public: - spell_taldaram_glittering_sparks() : SpellScriptLoader("spell_taldaram_glittering_sparks") { } + public: + spell_taldaram_glittering_sparks() : SpellScriptLoader("spell_taldaram_glittering_sparks") { } - class spell_taldaram_glittering_sparks_SpellScript : public SpellScript - { - PrepareSpellScript(spell_taldaram_glittering_sparks_SpellScript); + class spell_taldaram_glittering_sparks_SpellScript : public SpellScript + { + PrepareSpellScript(spell_taldaram_glittering_sparks_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetCaster()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_taldaram_glittering_sparks_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_taldaram_glittering_sparks_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_taldaram_glittering_sparks_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_taldaram_glittering_sparks_SpellScript(); + } }; class spell_taldaram_summon_flame_ball : public SpellScriptLoader { - public: - spell_taldaram_summon_flame_ball() : SpellScriptLoader("spell_taldaram_summon_flame_ball") { } + public: + spell_taldaram_summon_flame_ball() : SpellScriptLoader("spell_taldaram_summon_flame_ball") { } - class spell_taldaram_summon_flame_ball_SpellScript : public SpellScript - { - PrepareSpellScript(spell_taldaram_summon_flame_ball_SpellScript); + class spell_taldaram_summon_flame_ball_SpellScript : public SpellScript + { + PrepareSpellScript(spell_taldaram_summon_flame_ball_SpellScript); - bool Load() - { - if (GetCaster()->GetTypeId() != TYPEID_UNIT) - return false; - GetCaster()->CastSpell(GetCaster(), uint32(GetSpellInfo()->Effects[0].CalcValue()), true); - return true; - } + bool Load() + { + if (GetCaster()->GetTypeId() != TYPEID_UNIT) + return false; + GetCaster()->CastSpell(GetCaster(), uint32(GetSpellInfo()->Effects[0].CalcValue()), true); + return true; + } - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster()->ToCreature()->AI()->DoAction(ACTION_FLAME_BALL_CHASE); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetCaster()->ToCreature()->AI()->DoAction(ACTION_FLAME_BALL_CHASE); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_taldaram_summon_flame_ball_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_taldaram_summon_flame_ball_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_taldaram_summon_flame_ball_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_taldaram_summon_flame_ball_SpellScript(); + } }; class spell_taldaram_ball_of_inferno_flame : public SpellScriptLoader { - public: - spell_taldaram_ball_of_inferno_flame() : SpellScriptLoader("spell_taldaram_ball_of_inferno_flame") { } + public: + spell_taldaram_ball_of_inferno_flame() : SpellScriptLoader("spell_taldaram_ball_of_inferno_flame") { } - class spell_taldaram_ball_of_inferno_flame_SpellScript : public SpellScript - { - PrepareSpellScript(spell_taldaram_ball_of_inferno_flame_SpellScript); + class spell_taldaram_ball_of_inferno_flame_SpellScript : public SpellScript + { + PrepareSpellScript(spell_taldaram_ball_of_inferno_flame_SpellScript); - void ModAuraStack() - { - if (Aura* aur = GetHitAura()) - aur->SetStackAmount(uint8(GetSpellInfo()->StackAmount)); - } + void ModAuraStack() + { + if (Aura* aur = GetHitAura()) + aur->SetStackAmount(uint8(GetSpellInfo()->StackAmount)); + } - void Register() - { - AfterHit += SpellHitFn(spell_taldaram_ball_of_inferno_flame_SpellScript::ModAuraStack); - } - }; + void Register() + { + AfterHit += SpellHitFn(spell_taldaram_ball_of_inferno_flame_SpellScript::ModAuraStack); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_taldaram_ball_of_inferno_flame_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_taldaram_ball_of_inferno_flame_SpellScript(); + } }; class spell_valanar_kinetic_bomb : public SpellScriptLoader { - public: - spell_valanar_kinetic_bomb() : SpellScriptLoader("spell_valanar_kinetic_bomb") { } + public: + spell_valanar_kinetic_bomb() : SpellScriptLoader("spell_valanar_kinetic_bomb") { } - class spell_valanar_kinetic_bomb_SpellScript : public SpellScript - { - PrepareSpellScript(spell_valanar_kinetic_bomb_SpellScript); + class spell_valanar_kinetic_bomb_SpellScript : public SpellScript + { + PrepareSpellScript(spell_valanar_kinetic_bomb_SpellScript); - void ChangeSummonPos(SpellEffIndex /*effIndex*/) - { - WorldLocation summonPos = *GetExplTargetDest(); - Position offset = {0.0f, 0.0f, 20.0f, 0.0f}; - summonPos.RelocateOffset(offset); - SetExplTargetDest(summonPos); - GetHitDest()->RelocateOffset(offset); - } + void ChangeSummonPos(SpellEffIndex /*effIndex*/) + { + WorldLocation summonPos = *GetExplTargetDest(); + Position offset = {0.0f, 0.0f, 20.0f, 0.0f}; + summonPos.RelocateOffset(offset); + SetExplTargetDest(summonPos); + GetHitDest()->RelocateOffset(offset); + } - void Register() - { - OnEffectHit += SpellEffectFn(spell_valanar_kinetic_bomb_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); - } - }; + void Register() + { + OnEffectHit += SpellEffectFn(spell_valanar_kinetic_bomb_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); + } + }; - class spell_valanar_kinetic_bomb_AuraScript : public AuraScript - { - PrepareAuraScript(spell_valanar_kinetic_bomb_AuraScript); + class spell_valanar_kinetic_bomb_AuraScript : public AuraScript + { + PrepareAuraScript(spell_valanar_kinetic_bomb_AuraScript); - void HandleDummyTick(AuraEffect const* /*aurEff*/) - { - Unit* target = GetTarget(); - if (target->GetTypeId() != TYPEID_UNIT) - return; + void HandleDummyTick(AuraEffect const* /*aurEff*/) + { + Unit* target = GetTarget(); + if (target->GetTypeId() != TYPEID_UNIT) + return; - if (Creature* bomb = target->FindNearestCreature(NPC_KINETIC_BOMB, 1.0f, true)) - { - bomb->CastSpell(bomb, SPELL_KINETIC_BOMB_EXPLOSION, true); - bomb->RemoveAurasDueToSpell(SPELL_KINETIC_BOMB_VISUAL); - target->RemoveAura(GetAura()); - bomb->AI()->DoAction(SPELL_KINETIC_BOMB_EXPLOSION); - } - } + if (Creature* bomb = target->FindNearestCreature(NPC_KINETIC_BOMB, 1.0f, true)) + { + bomb->CastSpell(bomb, SPELL_KINETIC_BOMB_EXPLOSION, true); + bomb->RemoveAurasDueToSpell(SPELL_KINETIC_BOMB_VISUAL); + target->RemoveAura(GetAura()); + bomb->AI()->DoAction(SPELL_KINETIC_BOMB_EXPLOSION); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_valanar_kinetic_bomb_AuraScript::HandleDummyTick, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_valanar_kinetic_bomb_AuraScript::HandleDummyTick, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_valanar_kinetic_bomb_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_valanar_kinetic_bomb_SpellScript(); + } - AuraScript* GetAuraScript() const - { - return new spell_valanar_kinetic_bomb_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_valanar_kinetic_bomb_AuraScript(); + } }; class spell_valanar_kinetic_bomb_absorb : public SpellScriptLoader { - public: - spell_valanar_kinetic_bomb_absorb() : SpellScriptLoader("spell_valanar_kinetic_bomb_absorb") { } + public: + spell_valanar_kinetic_bomb_absorb() : SpellScriptLoader("spell_valanar_kinetic_bomb_absorb") { } - class spell_valanar_kinetic_bomb_absorb_AuraScript : public AuraScript - { - PrepareAuraScript(spell_valanar_kinetic_bomb_absorb_AuraScript); + class spell_valanar_kinetic_bomb_absorb_AuraScript : public AuraScript + { + PrepareAuraScript(spell_valanar_kinetic_bomb_absorb_AuraScript); - void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) - { - absorbAmount = CalculatePct(dmgInfo.GetDamage(), aurEff->GetAmount()); - RoundToInterval(absorbAmount, 0, dmgInfo.GetDamage()); - dmgInfo.AbsorbDamage(absorbAmount); - } + void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) + { + absorbAmount = CalculatePct(dmgInfo.GetDamage(), aurEff->GetAmount()); + RoundToInterval(absorbAmount, 0, dmgInfo.GetDamage()); + dmgInfo.AbsorbDamage(absorbAmount); + } - void Register() - { - OnEffectAbsorb += AuraEffectAbsorbFn(spell_valanar_kinetic_bomb_absorb_AuraScript::OnAbsorb, EFFECT_0); - } - }; + void Register() + { + OnEffectAbsorb += AuraEffectAbsorbFn(spell_valanar_kinetic_bomb_absorb_AuraScript::OnAbsorb, EFFECT_0); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_valanar_kinetic_bomb_absorb_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_valanar_kinetic_bomb_absorb_AuraScript(); + } }; class spell_valanar_kinetic_bomb_knockback : public SpellScriptLoader { - public: - spell_valanar_kinetic_bomb_knockback() : SpellScriptLoader("spell_valanar_kinetic_bomb_knockback") { } + public: + spell_valanar_kinetic_bomb_knockback() : SpellScriptLoader("spell_valanar_kinetic_bomb_knockback") { } - class spell_valanar_kinetic_bomb_knockback_SpellScript : public SpellScript - { - PrepareSpellScript(spell_valanar_kinetic_bomb_knockback_SpellScript); + class spell_valanar_kinetic_bomb_knockback_SpellScript : public SpellScript + { + PrepareSpellScript(spell_valanar_kinetic_bomb_knockback_SpellScript); - void KnockIntoAir() - { - if (Creature* target = GetHitCreature()) - target->AI()->DoAction(ACTION_KINETIC_BOMB_JUMP); - } + void KnockIntoAir() + { + if (Creature* target = GetHitCreature()) + target->AI()->DoAction(ACTION_KINETIC_BOMB_JUMP); + } - void Register() - { - BeforeHit += SpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir); - } - }; + void Register() + { + BeforeHit += SpellHitFn(spell_valanar_kinetic_bomb_knockback_SpellScript::KnockIntoAir); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_valanar_kinetic_bomb_knockback_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_valanar_kinetic_bomb_knockback_SpellScript(); + } }; class spell_valanar_kinetic_bomb_summon : public SpellScriptLoader { - public: - spell_valanar_kinetic_bomb_summon() : SpellScriptLoader("spell_valanar_kinetic_bomb_summon") { } + public: + spell_valanar_kinetic_bomb_summon() : SpellScriptLoader("spell_valanar_kinetic_bomb_summon") { } - class spell_valanar_kinetic_bomb_summon_SpellScript : public SpellScript - { - PrepareSpellScript(spell_valanar_kinetic_bomb_summon_SpellScript); + class spell_valanar_kinetic_bomb_summon_SpellScript : public SpellScript + { + PrepareSpellScript(spell_valanar_kinetic_bomb_summon_SpellScript); - void SelectDest() - { - if (Position* dest = const_cast(GetExplTargetDest())) - { - float angle = dest->GetAngle(GetCaster()); - Position offset = {6.0f*cos(angle), 6.0f*sin(angle), 10.0f, 0.0f}; - dest->RelocateOffset(offset); - GetCaster()->UpdateAllowedPositionZ(dest->GetPositionX(), dest->GetPositionY(), dest->m_positionZ); - } - } + void SelectDest() + { + if (Position* dest = const_cast(GetExplTargetDest())) + { + float angle = dest->GetAngle(GetCaster()); + Position offset = {6.0f*cos(angle), 6.0f*sin(angle), 10.0f, 0.0f}; + dest->RelocateOffset(offset); + GetCaster()->UpdateAllowedPositionZ(dest->GetPositionX(), dest->GetPositionY(), dest->m_positionZ); + } + } - void Register() - { - BeforeCast += SpellCastFn(spell_valanar_kinetic_bomb_summon_SpellScript::SelectDest); - } + void Register() + { + BeforeCast += SpellCastFn(spell_valanar_kinetic_bomb_summon_SpellScript::SelectDest); + } - uint32 _targetCount; - }; + uint32 _targetCount; + }; - SpellScript* GetSpellScript() const - { - return new spell_valanar_kinetic_bomb_summon_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_valanar_kinetic_bomb_summon_SpellScript(); + } }; class spell_blood_council_summon_shadow_resonance : public SpellScriptLoader @@ -1686,30 +1686,30 @@ class spell_blood_council_summon_shadow_resonance : public SpellScriptLoader void SetDest(SpellDestination& dest) { - Unit* summoner = GetCaster(); - float x = dest._position.GetPositionX(); - float y = dest._position.GetPositionY(); - float angle = summoner->GetAngle(x, y); - if (dest._position.GetExactDist2d(summoner) > 35.0f && x > 4585.0f && y > 2716.0f && y < 2822.0f) - return; + Unit* summoner = GetCaster(); + float x = dest._position.GetPositionX(); + float y = dest._position.GetPositionY(); + float angle = summoner->GetAngle(x, y); + if (dest._position.GetExactDist2d(summoner) > 35.0f && x > 4585.0f && y > 2716.0f && y < 2822.0f) + return; - for (uint8 a=0; a<2; ++a) - for (uint8 i=6; i>0; --i) - { - float destX = summoner->GetPositionX()+cos(angle + a*M_PI)*i*10.0f; - float destY = summoner->GetPositionY()+sin(angle + a*M_PI)*i*10.0f; - if (summoner->GetMap()->isInLineOfSight(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ()+10.0f, destX, destY, summoner->GetPositionZ()+10.0f, summoner->GetPhaseMask()) && destX > 4585.0f && destY > 2716.0f && destY < 2822.0f) - { - float destZ = summoner->GetMap()->GetHeight(summoner->GetPhaseMask(), destX, destY, summoner->GetPositionZ()+10.0f); - if (fabs(destZ-summoner->GetPositionZ()) < 10.0f) // valid z found - { - dest._position.Relocate(destX, destY, destZ); - return; - } - } - } + for (uint8 a=0; a<2; ++a) + for (uint8 i=6; i>0; --i) + { + float destX = summoner->GetPositionX()+cos(angle + a*M_PI)*i*10.0f; + float destY = summoner->GetPositionY()+sin(angle + a*M_PI)*i*10.0f; + if (summoner->GetMap()->isInLineOfSight(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ()+10.0f, destX, destY, summoner->GetPositionZ()+10.0f, summoner->GetPhaseMask()) && destX > 4585.0f && destY > 2716.0f && destY < 2822.0f) + { + float destZ = summoner->GetMap()->GetHeight(summoner->GetPhaseMask(), destX, destY, summoner->GetPositionZ()+10.0f); + if (fabs(destZ-summoner->GetPositionZ()) < 10.0f) // valid z found + { + dest._position.Relocate(destX, destY, destZ); + return; + } + } + } - dest._position.Relocate(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ()); + dest._position.Relocate(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ()); } void Register() @@ -1726,21 +1726,21 @@ class spell_blood_council_summon_shadow_resonance : public SpellScriptLoader void AddSC_boss_blood_prince_council() { - new boss_prince_keleseth_icc(); - new boss_prince_taldaram_icc(); - new boss_prince_valanar_icc(); - new npc_blood_queen_lana_thel(); - new npc_dark_nucleus(); - new npc_ball_of_flame(); - new npc_kinetic_bomb(); - new spell_blood_council_shadow_prison(); - new spell_blood_council_shadow_prison_damage(); - new spell_taldaram_glittering_sparks(); - new spell_taldaram_summon_flame_ball(); - new spell_taldaram_ball_of_inferno_flame(); - new spell_valanar_kinetic_bomb(); - new spell_valanar_kinetic_bomb_absorb(); - new spell_valanar_kinetic_bomb_knockback(); - new spell_valanar_kinetic_bomb_summon(); - new spell_blood_council_summon_shadow_resonance(); + new boss_prince_keleseth_icc(); + new boss_prince_taldaram_icc(); + new boss_prince_valanar_icc(); + new npc_blood_queen_lana_thel(); + new npc_dark_nucleus(); + new npc_ball_of_flame(); + new npc_kinetic_bomb(); + new spell_blood_council_shadow_prison(); + new spell_blood_council_shadow_prison_damage(); + new spell_taldaram_glittering_sparks(); + new spell_taldaram_summon_flame_ball(); + new spell_taldaram_ball_of_inferno_flame(); + new spell_valanar_kinetic_bomb(); + new spell_valanar_kinetic_bomb_absorb(); + new spell_valanar_kinetic_bomb_knockback(); + new spell_valanar_kinetic_bomb_summon(); + new spell_blood_council_summon_shadow_resonance(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 1637fcb98..3b1dc1957 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -12,48 +12,48 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Texts { - SAY_AGGRO = 0, - SAY_VAMPIRIC_BITE = 1, - SAY_MIND_CONTROL = 2, - EMOTE_BLOODTHIRST = 3, - SAY_SWARMING_SHADOWS = 4, - EMOTE_SWARMING_SHADOWS = 5, - SAY_PACT_OF_THE_DARKFALLEN = 6, - SAY_AIR_PHASE = 7, - SAY_KILL = 8, - SAY_WIPE = 9, - SAY_BERSERK = 10, - SAY_DEATH = 11, - EMOTE_BERSERK_RAID = 12 + SAY_AGGRO = 0, + SAY_VAMPIRIC_BITE = 1, + SAY_MIND_CONTROL = 2, + EMOTE_BLOODTHIRST = 3, + SAY_SWARMING_SHADOWS = 4, + EMOTE_SWARMING_SHADOWS = 5, + SAY_PACT_OF_THE_DARKFALLEN = 6, + SAY_AIR_PHASE = 7, + SAY_KILL = 8, + SAY_WIPE = 9, + SAY_BERSERK = 10, + SAY_DEATH = 11, + EMOTE_BERSERK_RAID = 12 }; enum Spells { - SPELL_SHROUD_OF_SORROW = 70986, - SPELL_FRENZIED_BLOODTHIRST_VISUAL = 71949, - SPELL_VAMPIRIC_BITE = 71726, - SPELL_VAMPIRIC_BITE_DUMMY = 71837, - SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR = 70879, - SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL = 70872, - SPELL_FRENZIED_BLOODTHIRST = 70877, - SPELL_UNCONTROLLABLE_FRENZY = 70923, - SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY = 70994, - SPELL_PRESENCE_OF_THE_DARKFALLEN_EFFECT = 70995, - SPELL_PRESENCE_OF_THE_DARKFALLEN_SE = 71952, - SPELL_BLOOD_MIRROR_DAMAGE = 70821, - SPELL_BLOOD_MIRROR_VISUAL = 71510, - SPELL_BLOOD_MIRROR_DUMMY = 70838, - SPELL_DELIRIOUS_SLASH = 71623, - SPELL_PACT_OF_THE_DARKFALLEN_TARGET = 71336, - SPELL_PACT_OF_THE_DARKFALLEN = 71340, - SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE = 71341, - SPELL_SWARMING_SHADOWS = 71264, - SPELL_TWILIGHT_BLOODBOLT_TARGET = 71445, - SPELL_TWILIGHT_BLOODBOLT = 71818, - SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL = 71446, - SPELL_INCITE_TERROR = 73070, - SPELL_BLOODBOLT_WHIRL = 71772, - SPELL_ANNIHILATE = 71322, + SPELL_SHROUD_OF_SORROW = 70986, + SPELL_FRENZIED_BLOODTHIRST_VISUAL = 71949, + SPELL_VAMPIRIC_BITE = 71726, + SPELL_VAMPIRIC_BITE_DUMMY = 71837, + SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR = 70879, + SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL = 70872, + SPELL_FRENZIED_BLOODTHIRST = 70877, + SPELL_UNCONTROLLABLE_FRENZY = 70923, + SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY = 70994, + SPELL_PRESENCE_OF_THE_DARKFALLEN_EFFECT = 70995, + SPELL_PRESENCE_OF_THE_DARKFALLEN_SE = 71952, + SPELL_BLOOD_MIRROR_DAMAGE = 70821, + SPELL_BLOOD_MIRROR_VISUAL = 71510, + SPELL_BLOOD_MIRROR_DUMMY = 70838, + SPELL_DELIRIOUS_SLASH = 71623, + SPELL_PACT_OF_THE_DARKFALLEN_TARGET = 71336, + SPELL_PACT_OF_THE_DARKFALLEN = 71340, + SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE = 71341, + SPELL_SWARMING_SHADOWS = 71264, + SPELL_TWILIGHT_BLOODBOLT_TARGET = 71445, + SPELL_TWILIGHT_BLOODBOLT = 71818, + SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL = 71446, + SPELL_INCITE_TERROR = 73070, + SPELL_BLOODBOLT_WHIRL = 71772, + SPELL_ANNIHILATE = 71322, }; enum Shadowmourne @@ -72,47 +72,47 @@ enum Shadowmourne uint32 const vampireAuras[3][MAX_DIFFICULTY] = { - {70867, 71473, 71532, 71533}, - {70879, 71525, 71530, 71531}, - {70877, 71474, 70877, 71474}, + {70867, 71473, 71532, 71533}, + {70879, 71525, 71530, 71531}, + {70877, 71474, 70877, 71474}, }; bool IsVampire(Unit const* unit) { - uint8 spawnMode = unit->GetMap()->GetSpawnMode(); - for (uint8 i = 0; i < 3; ++i) - if (unit->HasAura(vampireAuras[i][spawnMode])) - return true; - return false; + uint8 spawnMode = unit->GetMap()->GetSpawnMode(); + for (uint8 i = 0; i < 3; ++i) + if (unit->HasAura(vampireAuras[i][spawnMode])) + return true; + return false; } enum Events { - EVENT_NONE, - EVENT_BERSERK, - EVENT_VAMPIRIC_BITE, - EVENT_BLOOD_MIRROR, - EVENT_DELIRIOUS_SLASH, - EVENT_PACT_OF_THE_DARKFALLEN, - EVENT_SWARMING_SHADOWS, - EVENT_TWILIGHT_BLOODBOLT, - EVENT_AIR_PHASE, - EVENT_AIR_START_FLYING, - EVENT_AIR_FLY_DOWN, + EVENT_NONE, + EVENT_BERSERK, + EVENT_VAMPIRIC_BITE, + EVENT_BLOOD_MIRROR, + EVENT_DELIRIOUS_SLASH, + EVENT_PACT_OF_THE_DARKFALLEN, + EVENT_SWARMING_SHADOWS, + EVENT_TWILIGHT_BLOODBOLT, + EVENT_AIR_PHASE, + EVENT_AIR_START_FLYING, + EVENT_AIR_FLY_DOWN, }; enum Guids { - GUID_VAMPIRE = 1, - GUID_BLOODBOLT = 2, + GUID_VAMPIRE = 1, + GUID_BLOODBOLT = 2, }; enum Points { - POINT_CENTER = 1, - POINT_AIR = 2, - POINT_GROUND = 3, - POINT_MINCHAR = 4, + POINT_CENTER = 1, + POINT_AIR = 2, + POINT_GROUND = 3, + POINT_MINCHAR = 4, }; Position const centerPos = {4595.7090f, 2769.4190f, 400.6368f, 0.000000f}; @@ -121,460 +121,460 @@ Position const mincharPos = {4629.3711f, 2782.6089f, 424.6390f, 0.000000f}; class boss_blood_queen_lana_thel : public CreatureScript { - public: - boss_blood_queen_lana_thel() : CreatureScript("boss_blood_queen_lana_thel") { } + public: + boss_blood_queen_lana_thel() : CreatureScript("boss_blood_queen_lana_thel") { } - struct boss_blood_queen_lana_thelAI : public BossAI - { - boss_blood_queen_lana_thelAI(Creature* creature) : BossAI(creature, DATA_BLOOD_QUEEN_LANA_THEL) - { - bEnteredCombat = false; - } + struct boss_blood_queen_lana_thelAI : public BossAI + { + boss_blood_queen_lana_thelAI(Creature* creature) : BossAI(creature, DATA_BLOOD_QUEEN_LANA_THEL) + { + bEnteredCombat = false; + } - bool _creditBloodQuickening; - bool _killMinchar; - uint64 _tankGUID; - uint64 _offtankGUID; - std::set _bloodboltedPlayers; - std::set _vampires; - bool bEnteredCombat; // needed for failing an attempt in JustReachedHome() + bool _creditBloodQuickening; + bool _killMinchar; + uint64 _tankGUID; + uint64 _offtankGUID; + std::set _bloodboltedPlayers; + std::set _vampires; + bool bEnteredCombat; // needed for failing an attempt in JustReachedHome() - void Reset() - { - _creditBloodQuickening = false; - _killMinchar = false; - _tankGUID = 0; - _offtankGUID = 0; - _vampires.clear(); - CleanAuras(); - me->SetReactState(REACT_AGGRESSIVE); + void Reset() + { + _creditBloodQuickening = false; + _killMinchar = false; + _tankGUID = 0; + _offtankGUID = 0; + _vampires.clear(); + CleanAuras(); + me->SetReactState(REACT_AGGRESSIVE); - events.Reset(); - summons.DespawnAll(); - if (instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) != DONE) - instance->SetBossState(DATA_BLOOD_QUEEN_LANA_THEL, NOT_STARTED); - } + events.Reset(); + summons.DespawnAll(); + if (instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) != DONE) + instance->SetBossState(DATA_BLOOD_QUEEN_LANA_THEL, NOT_STARTED); + } - void EnterCombat(Unit* who) - { - if (!instance->CheckRequiredBosses(DATA_BLOOD_QUEEN_LANA_THEL, who->ToPlayer()) || !me->IsVisible()) - { - EnterEvadeMode(); - instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); - return; - } + void EnterCombat(Unit* who) + { + if (!instance->CheckRequiredBosses(DATA_BLOOD_QUEEN_LANA_THEL, who->ToPlayer()) || !me->IsVisible()) + { + EnterEvadeMode(); + instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); + return; + } - bEnteredCombat = true; - me->CastSpell(me, SPELL_SHROUD_OF_SORROW, true); - me->CastSpell(me, SPELL_FRENZIED_BLOODTHIRST_VISUAL, true); - events.Reset(); - events.ScheduleEvent(EVENT_BERSERK, 330000); - events.ScheduleEvent(EVENT_VAMPIRIC_BITE, 15000); - events.ScheduleEvent(EVENT_BLOOD_MIRROR, 2500); - events.ScheduleEvent(EVENT_DELIRIOUS_SLASH, urand(10000, 12000)); - events.ScheduleEvent(EVENT_PACT_OF_THE_DARKFALLEN, 20000); - events.ScheduleEvent(EVENT_SWARMING_SHADOWS, 30000); - events.ScheduleEvent(EVENT_TWILIGHT_BLOODBOLT, urand(15000, 25000)); - events.ScheduleEvent(EVENT_AIR_PHASE, 124000 + uint32(Is25ManRaid() ? 3000 : 0)); + bEnteredCombat = true; + me->CastSpell(me, SPELL_SHROUD_OF_SORROW, true); + me->CastSpell(me, SPELL_FRENZIED_BLOODTHIRST_VISUAL, true); + events.Reset(); + events.ScheduleEvent(EVENT_BERSERK, 330000); + events.ScheduleEvent(EVENT_VAMPIRIC_BITE, 15000); + events.ScheduleEvent(EVENT_BLOOD_MIRROR, 2500); + events.ScheduleEvent(EVENT_DELIRIOUS_SLASH, urand(10000, 12000)); + events.ScheduleEvent(EVENT_PACT_OF_THE_DARKFALLEN, 20000); + events.ScheduleEvent(EVENT_SWARMING_SHADOWS, 30000); + events.ScheduleEvent(EVENT_TWILIGHT_BLOODBOLT, urand(15000, 25000)); + events.ScheduleEvent(EVENT_AIR_PHASE, 124000 + uint32(Is25ManRaid() ? 3000 : 0)); - CleanAuras(); - me->setActive(true); - DoZoneInCombat(); - Talk(SAY_AGGRO); - if (instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) != DONE) - instance->SetBossState(DATA_BLOOD_QUEEN_LANA_THEL, IN_PROGRESS); - _creditBloodQuickening = instance->GetData(DATA_BLOOD_QUICKENING_STATE) == IN_PROGRESS; - } + CleanAuras(); + me->setActive(true); + DoZoneInCombat(); + Talk(SAY_AGGRO); + if (instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) != DONE) + instance->SetBossState(DATA_BLOOD_QUEEN_LANA_THEL, IN_PROGRESS); + _creditBloodQuickening = instance->GetData(DATA_BLOOD_QUICKENING_STATE) == IN_PROGRESS; + } - void JustDied(Unit* killer) - { - _JustDied(); - Talk(SAY_DEATH); + void JustDied(Unit* killer) + { + _JustDied(); + Talk(SAY_DEATH); - if (Is25ManRaid() && me->HasAura(SPELL_SHADOWS_FATE)) - DoCastAOE(SPELL_BLOOD_INFUSION_CREDIT, true); + if (Is25ManRaid() && me->HasAura(SPELL_SHADOWS_FATE)) + DoCastAOE(SPELL_BLOOD_INFUSION_CREDIT, true); - CleanAuras(); + CleanAuras(); - if (_creditBloodQuickening) - { - instance->SetData(DATA_BLOOD_QUICKENING_STATE, DONE); - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - p->KilledMonsterCredit(RAID_MODE(NPC_INFILTRATOR_MINCHAR_BQ, NPC_BLOOD_QUICKENING_CREDIT_25), 0); - if (Creature* minchar = me->FindNearestCreature(NPC_INFILTRATOR_MINCHAR_BQ, 200.0f)) - { - minchar->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - minchar->SetCanFly(false); - minchar->SetDisableGravity(false); - minchar->SetHover(false); - minchar->RemoveAllAuras(); - minchar->GetMotionMaster()->MoveCharge(4629.3711f, 2782.6089f, 401.5301f, SPEED_CHARGE/3.0f); - } - } - } + if (_creditBloodQuickening) + { + instance->SetData(DATA_BLOOD_QUICKENING_STATE, DONE); + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + p->KilledMonsterCredit(RAID_MODE(NPC_INFILTRATOR_MINCHAR_BQ, NPC_BLOOD_QUICKENING_CREDIT_25), 0); + if (Creature* minchar = me->FindNearestCreature(NPC_INFILTRATOR_MINCHAR_BQ, 200.0f)) + { + minchar->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + minchar->SetCanFly(false); + minchar->SetDisableGravity(false); + minchar->SetHover(false); + minchar->RemoveAllAuras(); + minchar->GetMotionMaster()->MoveCharge(4629.3711f, 2782.6089f, 401.5301f, SPEED_CHARGE/3.0f); + } + } + } - void GoToMinchar() - { - if (!me->IsAlive()) - return; - instance->SetData(DATA_BLOOD_QUICKENING_STATE, DONE); - me->AddUnitState(UNIT_STATE_EVADE); - me->SendMeleeAttackStop(me->GetVictim()); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MovePoint(POINT_MINCHAR, mincharPos); - } + void GoToMinchar() + { + if (!me->IsAlive()) + return; + instance->SetData(DATA_BLOOD_QUICKENING_STATE, DONE); + me->AddUnitState(UNIT_STATE_EVADE); + me->SendMeleeAttackStop(me->GetVictim()); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + me->SendMovementFlagUpdate(); + me->GetMotionMaster()->MovePoint(POINT_MINCHAR, mincharPos); + } - void DoAction(int32 action) - { - if (action != ACTION_KILL_MINCHAR) - return; + void DoAction(int32 action) + { + if (action != ACTION_KILL_MINCHAR) + return; - if (instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == IN_PROGRESS) - _killMinchar = true; - else - GoToMinchar(); - } + if (instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == IN_PROGRESS) + _killMinchar = true; + else + GoToMinchar(); + } - void JustReachedHome() - { - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetHover(false); + void JustReachedHome() + { + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); - _JustReachedHome(); - if (bEnteredCombat) - { - bEnteredCombat = false; - if (me->IsAlive() && instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) != DONE) - instance->SetBossState(DATA_BLOOD_QUEEN_LANA_THEL, FAIL); - } - } + _JustReachedHome(); + if (bEnteredCombat) + { + bEnteredCombat = false; + if (me->IsAlive() && instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) != DONE) + instance->SetBossState(DATA_BLOOD_QUEEN_LANA_THEL, FAIL); + } + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } - void MovementInform(uint32 type, uint32 id) - { - if (type != EFFECT_MOTION_TYPE && type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != EFFECT_MOTION_TYPE && type != POINT_MOTION_TYPE) + return; - switch (id) - { - case POINT_CENTER: - me->CastSpell(me, SPELL_INCITE_TERROR, false); - events.ScheduleEvent(EVENT_AIR_PHASE, 100000 + uint32(Is25ManRaid() ? 0 : 20000)); - events.ScheduleEvent(EVENT_AIR_START_FLYING, 2500); - break; - case POINT_AIR: - _bloodboltedPlayers.clear(); - me->CastSpell(me, SPELL_BLOODBOLT_WHIRL, false); - Talk(SAY_AIR_PHASE); - events.ScheduleEvent(EVENT_AIR_FLY_DOWN, 7000); - break; - case POINT_GROUND: - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetHover(false); - me->SetReactState(REACT_AGGRESSIVE); - if (Unit* target = me->SelectVictim()) - AttackStart(target); - events.RescheduleEvent(EVENT_PACT_OF_THE_DARKFALLEN, 5000); - events.RescheduleEvent(EVENT_SWARMING_SHADOWS, 20000); - break; - case POINT_MINCHAR: - me->CastSpell(me, SPELL_ANNIHILATE, true); - me->GetMotionMaster()->MoveTargetedHome(); - Reset(); - default: - break; - } - } + switch (id) + { + case POINT_CENTER: + me->CastSpell(me, SPELL_INCITE_TERROR, false); + events.ScheduleEvent(EVENT_AIR_PHASE, 100000 + uint32(Is25ManRaid() ? 0 : 20000)); + events.ScheduleEvent(EVENT_AIR_START_FLYING, 2500); + break; + case POINT_AIR: + _bloodboltedPlayers.clear(); + me->CastSpell(me, SPELL_BLOODBOLT_WHIRL, false); + Talk(SAY_AIR_PHASE); + events.ScheduleEvent(EVENT_AIR_FLY_DOWN, 7000); + break; + case POINT_GROUND: + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); + me->SetReactState(REACT_AGGRESSIVE); + if (Unit* target = me->SelectVictim()) + AttackStart(target); + events.RescheduleEvent(EVENT_PACT_OF_THE_DARKFALLEN, 5000); + events.RescheduleEvent(EVENT_SWARMING_SHADOWS, 20000); + break; + case POINT_MINCHAR: + me->CastSpell(me, SPELL_ANNIHILATE, true); + me->GetMotionMaster()->MoveTargetedHome(); + Reset(); + default: + break; + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() || !CheckInRoom()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() || !CheckInRoom()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_BERSERK: - Talk(EMOTE_BERSERK_RAID); - Talk(SAY_BERSERK); - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_VAMPIRIC_BITE: - { - Player* target = NULL; - float maxThreat = 0.0f; - const Map::PlayerList &pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && p->GetDistance(me) < 70.0f) - { - float th = me->getThreatManager().getThreatWithoutTemp(p); - if (!target || th > maxThreat) - { - target = p; - maxThreat = th; - } - } + switch (events.ExecuteEvent()) + { + case EVENT_BERSERK: + Talk(EMOTE_BERSERK_RAID); + Talk(SAY_BERSERK); + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_VAMPIRIC_BITE: + { + Player* target = NULL; + float maxThreat = 0.0f; + const Map::PlayerList &pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && p->GetDistance(me) < 70.0f) + { + float th = me->getThreatManager().getThreatWithoutTemp(p); + if (!target || th > maxThreat) + { + target = p; + maxThreat = th; + } + } - if (target) - { - me->CastSpell(target, SPELL_VAMPIRIC_BITE, false); - me->CastSpell((Unit*)NULL, SPELL_VAMPIRIC_BITE_DUMMY, true); - Talk(SAY_VAMPIRIC_BITE); - SetGUID(target->GetGUID(), GUID_VAMPIRE); - target->CastSpell(target, SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY, TRIGGERED_FULL_MASK); - target->CastSpell(target, SPELL_PRESENCE_OF_THE_DARKFALLEN_SE, TRIGGERED_FULL_MASK); - } - } - break; - case EVENT_BLOOD_MIRROR: - if (me->GetVictim()) - { - std::list myList; - const Map::PlayerList &pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->IsAlive() && p != me->GetVictim() && !p->IsGameMaster() && !p->HasAura(SPELL_UNCONTROLLABLE_FRENZY)) - myList.push_back(p); - if (!myList.empty()) - { - myList.sort(Trinity::ObjectDistanceOrderPred(me->GetVictim())); - Player* target = myList.front(); - if (me->GetVictim()->GetGUID() != _tankGUID || target->GetGUID() != _offtankGUID) - { - // remove manually from previous, single target flag has nothing to do with this shit as caster is in every case different... tc retards - if (_tankGUID) - if (Player* prevTank = ObjectAccessor::GetPlayer(*me, _tankGUID)) - { - prevTank->RemoveAurasDueToSpell(SPELL_BLOOD_MIRROR_DAMAGE); - prevTank->RemoveAurasDueToSpell(SPELL_BLOOD_MIRROR_VISUAL); - } - if (_offtankGUID) - if (Player* prevOfftank = ObjectAccessor::GetPlayer(*me, _offtankGUID)) - prevOfftank->RemoveAurasDueToSpell(SPELL_BLOOD_MIRROR_DUMMY); + if (target) + { + me->CastSpell(target, SPELL_VAMPIRIC_BITE, false); + me->CastSpell((Unit*)NULL, SPELL_VAMPIRIC_BITE_DUMMY, true); + Talk(SAY_VAMPIRIC_BITE); + SetGUID(target->GetGUID(), GUID_VAMPIRE); + target->CastSpell(target, SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY, TRIGGERED_FULL_MASK); + target->CastSpell(target, SPELL_PRESENCE_OF_THE_DARKFALLEN_SE, TRIGGERED_FULL_MASK); + } + } + break; + case EVENT_BLOOD_MIRROR: + if (me->GetVictim()) + { + std::list myList; + const Map::PlayerList &pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->IsAlive() && p != me->GetVictim() && !p->IsGameMaster() && !p->HasAura(SPELL_UNCONTROLLABLE_FRENZY)) + myList.push_back(p); + if (!myList.empty()) + { + myList.sort(Trinity::ObjectDistanceOrderPred(me->GetVictim())); + Player* target = myList.front(); + if (me->GetVictim()->GetGUID() != _tankGUID || target->GetGUID() != _offtankGUID) + { + // remove manually from previous, single target flag has nothing to do with this shit as caster is in every case different... tc retards + if (_tankGUID) + if (Player* prevTank = ObjectAccessor::GetPlayer(*me, _tankGUID)) + { + prevTank->RemoveAurasDueToSpell(SPELL_BLOOD_MIRROR_DAMAGE); + prevTank->RemoveAurasDueToSpell(SPELL_BLOOD_MIRROR_VISUAL); + } + if (_offtankGUID) + if (Player* prevOfftank = ObjectAccessor::GetPlayer(*me, _offtankGUID)) + prevOfftank->RemoveAurasDueToSpell(SPELL_BLOOD_MIRROR_DUMMY); - if (target->GetDistance(me->GetVictim()) > 39.0f || me->GetDistance(me->GetVictim()) > 39.0f) - { - _tankGUID = 0; - _offtankGUID = 0; - events.ScheduleEvent(EVENT_BLOOD_MIRROR, 2500); - break; - } + if (target->GetDistance(me->GetVictim()) > 39.0f || me->GetDistance(me->GetVictim()) > 39.0f) + { + _tankGUID = 0; + _offtankGUID = 0; + events.ScheduleEvent(EVENT_BLOOD_MIRROR, 2500); + break; + } - _tankGUID = me->GetVictim()->GetGUID(); - _offtankGUID = target->GetGUID(); - target->CastSpell(me->GetVictim(), SPELL_BLOOD_MIRROR_DAMAGE, true); - me->GetVictim()->CastSpell(target, SPELL_BLOOD_MIRROR_DUMMY, true); - me->CastSpell(me->GetVictim(), SPELL_BLOOD_MIRROR_VISUAL, false); + _tankGUID = me->GetVictim()->GetGUID(); + _offtankGUID = target->GetGUID(); + target->CastSpell(me->GetVictim(), SPELL_BLOOD_MIRROR_DAMAGE, true); + me->GetVictim()->CastSpell(target, SPELL_BLOOD_MIRROR_DUMMY, true); + me->CastSpell(me->GetVictim(), SPELL_BLOOD_MIRROR_VISUAL, false); - if (Is25ManRaid() && target->GetQuestStatus(QUEST_BLOOD_INFUSION) == QUEST_STATUS_INCOMPLETE && - target->HasAura(SPELL_UNSATED_CRAVING) && !target->HasAura(SPELL_THIRST_QUENCHED) && !target->HasAura(SPELL_GUSHING_WOUND)) - target->CastSpell(target, SPELL_GUSHING_WOUND, TRIGGERED_FULL_MASK); - } - } - } - events.ScheduleEvent(EVENT_BLOOD_MIRROR, 2500); - break; - case EVENT_DELIRIOUS_SLASH: - if (!me->HasReactState(REACT_PASSIVE)) - { - Unit* target = NULL; - if (_offtankGUID) - if (Unit* t = ObjectAccessor::GetUnit(*me, _offtankGUID)) - if (t->IsAlive() && t->GetDistance(me) < 10.0f) - target = t; - if (!target) - if (me->GetVictim() && me->GetVictim()->GetDistance(me) < 10.0f) - target = me->GetVictim(); - if (!target) - { - events.ScheduleEvent(EVENT_DELIRIOUS_SLASH, 5000); - break; - } - me->CastSpell(target, SPELL_DELIRIOUS_SLASH, false); - events.ScheduleEvent(EVENT_DELIRIOUS_SLASH, urand(20000, 24000)); - break; - } - events.ScheduleEvent(EVENT_DELIRIOUS_SLASH, 5000); - break; - case EVENT_PACT_OF_THE_DARKFALLEN: - if (!me->HasReactState(REACT_PASSIVE)) - { - std::list myList; - const Map::PlayerList &pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && p->GetDistance(me) < 100.0f && !p->HasAura(SPELL_UNCONTROLLABLE_FRENZY)) - myList.push_back(p); - Trinity::Containers::RandomResizeList(myList, Is25ManRaid() ? 3 : 2); - if (myList.size() > 1) - { - Talk(SAY_PACT_OF_THE_DARKFALLEN); - for (std::list::iterator itr = myList.begin(); itr != myList.end(); ++itr) - me->CastSpell(*itr, SPELL_PACT_OF_THE_DARKFALLEN, false); - events.ScheduleEvent(EVENT_PACT_OF_THE_DARKFALLEN, 30000); - } - else - events.ScheduleEvent(EVENT_PACT_OF_THE_DARKFALLEN, 5000); - break; - } - events.ScheduleEvent(EVENT_PACT_OF_THE_DARKFALLEN, 5000); - break; - case EVENT_SWARMING_SHADOWS: - if (!me->HasReactState(REACT_PASSIVE)) - { - std::list myList; - const Map::PlayerList &pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && !p->HasAura(SPELL_PACT_OF_THE_DARKFALLEN) && !p->HasAura(SPELL_UNCONTROLLABLE_FRENZY)) - myList.push_back(p); + if (Is25ManRaid() && target->GetQuestStatus(QUEST_BLOOD_INFUSION) == QUEST_STATUS_INCOMPLETE && + target->HasAura(SPELL_UNSATED_CRAVING) && !target->HasAura(SPELL_THIRST_QUENCHED) && !target->HasAura(SPELL_GUSHING_WOUND)) + target->CastSpell(target, SPELL_GUSHING_WOUND, TRIGGERED_FULL_MASK); + } + } + } + events.ScheduleEvent(EVENT_BLOOD_MIRROR, 2500); + break; + case EVENT_DELIRIOUS_SLASH: + if (!me->HasReactState(REACT_PASSIVE)) + { + Unit* target = NULL; + if (_offtankGUID) + if (Unit* t = ObjectAccessor::GetUnit(*me, _offtankGUID)) + if (t->IsAlive() && t->GetDistance(me) < 10.0f) + target = t; + if (!target) + if (me->GetVictim() && me->GetVictim()->GetDistance(me) < 10.0f) + target = me->GetVictim(); + if (!target) + { + events.ScheduleEvent(EVENT_DELIRIOUS_SLASH, 5000); + break; + } + me->CastSpell(target, SPELL_DELIRIOUS_SLASH, false); + events.ScheduleEvent(EVENT_DELIRIOUS_SLASH, urand(20000, 24000)); + break; + } + events.ScheduleEvent(EVENT_DELIRIOUS_SLASH, 5000); + break; + case EVENT_PACT_OF_THE_DARKFALLEN: + if (!me->HasReactState(REACT_PASSIVE)) + { + std::list myList; + const Map::PlayerList &pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && p->GetDistance(me) < 100.0f && !p->HasAura(SPELL_UNCONTROLLABLE_FRENZY)) + myList.push_back(p); + Trinity::Containers::RandomResizeList(myList, Is25ManRaid() ? 3 : 2); + if (myList.size() > 1) + { + Talk(SAY_PACT_OF_THE_DARKFALLEN); + for (std::list::iterator itr = myList.begin(); itr != myList.end(); ++itr) + me->CastSpell(*itr, SPELL_PACT_OF_THE_DARKFALLEN, false); + events.ScheduleEvent(EVENT_PACT_OF_THE_DARKFALLEN, 30000); + } + else + events.ScheduleEvent(EVENT_PACT_OF_THE_DARKFALLEN, 5000); + break; + } + events.ScheduleEvent(EVENT_PACT_OF_THE_DARKFALLEN, 5000); + break; + case EVENT_SWARMING_SHADOWS: + if (!me->HasReactState(REACT_PASSIVE)) + { + std::list myList; + const Map::PlayerList &pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && !p->HasAura(SPELL_PACT_OF_THE_DARKFALLEN) && !p->HasAura(SPELL_UNCONTROLLABLE_FRENZY)) + myList.push_back(p); - if (!myList.empty()) - { - Trinity::Containers::RandomResizeList(myList, 1); - Player* target = myList.front(); - Talk(EMOTE_SWARMING_SHADOWS, target); - Talk(SAY_SWARMING_SHADOWS); - me->CastSpell(target, SPELL_SWARMING_SHADOWS, false); - } + if (!myList.empty()) + { + Trinity::Containers::RandomResizeList(myList, 1); + Player* target = myList.front(); + Talk(EMOTE_SWARMING_SHADOWS, target); + Talk(SAY_SWARMING_SHADOWS); + me->CastSpell(target, SPELL_SWARMING_SHADOWS, false); + } - events.ScheduleEvent(EVENT_SWARMING_SHADOWS, 30000); - break; - } - events.ScheduleEvent(EVENT_SWARMING_SHADOWS, 5000); - break; - case EVENT_TWILIGHT_BLOODBOLT: - if (!me->HasReactState(REACT_PASSIVE)) - { - std::list myList; - const Map::PlayerList &pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && !p->HasAura(SPELL_PACT_OF_THE_DARKFALLEN) && !p->HasAura(SPELL_UNCONTROLLABLE_FRENZY)) - myList.push_back(p); + events.ScheduleEvent(EVENT_SWARMING_SHADOWS, 30000); + break; + } + events.ScheduleEvent(EVENT_SWARMING_SHADOWS, 5000); + break; + case EVENT_TWILIGHT_BLOODBOLT: + if (!me->HasReactState(REACT_PASSIVE)) + { + std::list myList; + const Map::PlayerList &pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && !p->HasAura(SPELL_PACT_OF_THE_DARKFALLEN) && !p->HasAura(SPELL_UNCONTROLLABLE_FRENZY)) + myList.push_back(p); - Trinity::Containers::RandomResizeList(myList, uint32(Is25ManRaid() ? 4 : 2)); - for (std::list::iterator itr = myList.begin(); itr != myList.end(); ++itr) - me->CastSpell(*itr, SPELL_TWILIGHT_BLOODBOLT, false); - me->CastSpell(me, SPELL_TWILIGHT_BLOODBOLT_TARGET, false); - events.ScheduleEvent(EVENT_TWILIGHT_BLOODBOLT, urand(10000, 15000)); - break; - } - events.ScheduleEvent(EVENT_TWILIGHT_BLOODBOLT, 5000); - break; - case EVENT_AIR_PHASE: - me->AttackStop(); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MovePoint(POINT_CENTER, centerPos); - break; - case EVENT_AIR_START_FLYING: - me->SendMeleeAttackStop(me->GetVictim()); - me->GetMotionMaster()->MoveIdle(); - me->DisableSpline(); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MoveTakeoff(POINT_AIR, airPos, 0.642857f * 7.0f); - break; - case EVENT_AIR_FLY_DOWN: - me->GetMotionMaster()->MoveLand(POINT_GROUND, centerPos, 0.642857f * 7.0f); - break; - } + Trinity::Containers::RandomResizeList(myList, uint32(Is25ManRaid() ? 4 : 2)); + for (std::list::iterator itr = myList.begin(); itr != myList.end(); ++itr) + me->CastSpell(*itr, SPELL_TWILIGHT_BLOODBOLT, false); + me->CastSpell(me, SPELL_TWILIGHT_BLOODBOLT_TARGET, false); + events.ScheduleEvent(EVENT_TWILIGHT_BLOODBOLT, urand(10000, 15000)); + break; + } + events.ScheduleEvent(EVENT_TWILIGHT_BLOODBOLT, 5000); + break; + case EVENT_AIR_PHASE: + me->AttackStop(); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MovePoint(POINT_CENTER, centerPos); + break; + case EVENT_AIR_START_FLYING: + me->SendMeleeAttackStop(me->GetVictim()); + me->GetMotionMaster()->MoveIdle(); + me->DisableSpline(); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + me->SendMovementFlagUpdate(); + me->GetMotionMaster()->MoveTakeoff(POINT_AIR, airPos, 0.642857f * 7.0f); + break; + case EVENT_AIR_FLY_DOWN: + me->GetMotionMaster()->MoveLand(POINT_GROUND, centerPos, 0.642857f * 7.0f); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void CleanAuras() - { - instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN); - instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN_PLR); - instance->DoRemoveAurasDueToSpellOnPlayers(FRENZIED_BLOODTHIRST); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_FRENZIED_BLOODTHIRST_VISUAL); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DAMAGE); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_VISUAL); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY); - instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); - instance->DoRemoveAurasDueToSpellOnPlayers(PRESENCE_OF_THE_DARKFALLEN); - } + void CleanAuras() + { + instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN); + instance->DoRemoveAurasDueToSpellOnPlayers(ESSENCE_OF_BLOOD_QUEEN_PLR); + instance->DoRemoveAurasDueToSpellOnPlayers(FRENZIED_BLOODTHIRST); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_FRENZIED_BLOODTHIRST_VISUAL); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_UNCONTROLLABLE_FRENZY); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DAMAGE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_VISUAL); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BLOOD_MIRROR_DUMMY); + instance->DoRemoveAurasDueToSpellOnPlayers(DELIRIOUS_SLASH); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); + instance->DoRemoveAurasDueToSpellOnPlayers(PRESENCE_OF_THE_DARKFALLEN); + } - bool WasVampire(uint64 guid) - { - return _vampires.count(guid) != 0; - } + bool WasVampire(uint64 guid) + { + return _vampires.count(guid) != 0; + } - bool WasBloodbolted(uint64 guid) - { - return _bloodboltedPlayers.count(guid) != 0; - } + bool WasBloodbolted(uint64 guid) + { + return _bloodboltedPlayers.count(guid) != 0; + } - void SetGUID(uint64 guid, int32 type = 0) - { - switch (type) - { - case GUID_BLOODBOLT: - _bloodboltedPlayers.insert(guid); - break; - case GUID_VAMPIRE: - _vampires.insert(guid); - break; - default: - break; - } - } + void SetGUID(uint64 guid, int32 type = 0) + { + switch (type) + { + case GUID_BLOODBOLT: + _bloodboltedPlayers.insert(guid); + break; + case GUID_VAMPIRE: + _vampires.insert(guid); + break; + default: + break; + } + } - void EnterEvadeMode() - { - const Map::PlayerList &pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->IsAlive() && p->HasAura(SPELL_UNCONTROLLABLE_FRENZY)) - Unit::Kill(me, p); - - if (_killMinchar) - { - if (!me->IsAlive()) - return; - _EnterEvadeMode(); - Reset(); - GoToMinchar(); - return; - } + void EnterEvadeMode() + { + const Map::PlayerList &pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->IsAlive() && p->HasAura(SPELL_UNCONTROLLABLE_FRENZY)) + Unit::Kill(me, p); + + if (_killMinchar) + { + if (!me->IsAlive()) + return; + _EnterEvadeMode(); + Reset(); + GoToMinchar(); + return; + } - BossAI::EnterEvadeMode(); - } + BossAI::EnterEvadeMode(); + } - bool CanAIAttack(const Unit* target) const - { - return me->IsVisible(); - } - }; + bool CanAIAttack(const Unit* target) const + { + return me->IsVisible(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; // shortened version for clear code @@ -582,309 +582,309 @@ typedef boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI LanaThelAI; class spell_blood_queen_pact_of_the_darkfallen_dmg : public SpellScriptLoader { - public: - spell_blood_queen_pact_of_the_darkfallen_dmg() : SpellScriptLoader("spell_blood_queen_pact_of_the_darkfallen_dmg") { } + public: + spell_blood_queen_pact_of_the_darkfallen_dmg() : SpellScriptLoader("spell_blood_queen_pact_of_the_darkfallen_dmg") { } - class spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript : public AuraScript - { - PrepareAuraScript(spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript); + class spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript : public AuraScript + { + PrepareAuraScript(spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE)) + return false; + return true; + } - // this is an additional effect to be executed - void PeriodicTick(AuraEffect const* aurEff) - { - if ((aurEff->GetTickNumber()%2) == 0) - return; - SpellInfo const* damageSpell = sSpellMgr->GetSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE); - int32 damage = damageSpell->Effects[EFFECT_0].CalcValue(); - float herobonus = ((GetTarget()->FindMap() && GetTarget()->FindMap()->IsHeroic()) ? 0.2f : 0.0f); - float multiplier = 0.5f + herobonus + 0.1f * uint32(aurEff->GetTickNumber()/10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks) - damage = int32(damage * multiplier); - GetTarget()->CastCustomSpell(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true); - } + // this is an additional effect to be executed + void PeriodicTick(AuraEffect const* aurEff) + { + if ((aurEff->GetTickNumber()%2) == 0) + return; + SpellInfo const* damageSpell = sSpellMgr->GetSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE); + int32 damage = damageSpell->Effects[EFFECT_0].CalcValue(); + float herobonus = ((GetTarget()->FindMap() && GetTarget()->FindMap()->IsHeroic()) ? 0.2f : 0.0f); + float multiplier = 0.5f + herobonus + 0.1f * uint32(aurEff->GetTickNumber()/10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks) + damage = int32(damage * multiplier); + GetTarget()->CastCustomSpell(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript(); + } }; class spell_blood_queen_pact_of_the_darkfallen : public SpellScriptLoader { - public: - spell_blood_queen_pact_of_the_darkfallen() : SpellScriptLoader("spell_blood_queen_pact_of_the_darkfallen") { } + public: + spell_blood_queen_pact_of_the_darkfallen() : SpellScriptLoader("spell_blood_queen_pact_of_the_darkfallen") { } - class spell_blood_queen_pact_of_the_darkfallen_SpellScript : public SpellScript - { - PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_SpellScript); + class spell_blood_queen_pact_of_the_darkfallen_SpellScript : public SpellScript + { + PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove_if(Trinity::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN)); + void FilterTargets(std::list& targets) + { + targets.remove_if(Trinity::UnitAuraCheck(false, SPELL_PACT_OF_THE_DARKFALLEN)); - bool remove = true; - std::list::const_iterator itr, itr2, itrEnd = targets.end(); - for (itr = targets.begin(); itr != itrEnd && remove; ++itr) - { - if (GetCaster()->GetExactDist2d(*itr) > 5.0f) - remove = false; + bool remove = true; + std::list::const_iterator itr, itr2, itrEnd = targets.end(); + for (itr = targets.begin(); itr != itrEnd && remove; ++itr) + { + if (GetCaster()->GetExactDist2d(*itr) > 5.0f) + remove = false; - for (itr2 = targets.begin(); itr2 != itrEnd && remove; ++itr2) - if (itr != itr2 && (*itr2)->GetExactDist2d(*itr) > 5.0f) - remove = false; - } + for (itr2 = targets.begin(); itr2 != itrEnd && remove; ++itr2) + if (itr != itr2 && (*itr2)->GetExactDist2d(*itr) > 5.0f) + remove = false; + } - if (remove) - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - { - targets.clear(); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); - } - } + if (remove) + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + { + targets.clear(); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PACT_OF_THE_DARKFALLEN); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_blood_queen_pact_of_the_darkfallen_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_blood_queen_pact_of_the_darkfallen_SpellScript(); + } }; class spell_blood_queen_pact_of_the_darkfallen_dmg_target : public SpellScriptLoader { - public: - spell_blood_queen_pact_of_the_darkfallen_dmg_target() : SpellScriptLoader("spell_blood_queen_pact_of_the_darkfallen_dmg_target") { } + public: + spell_blood_queen_pact_of_the_darkfallen_dmg_target() : SpellScriptLoader("spell_blood_queen_pact_of_the_darkfallen_dmg_target") { } - class spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript : public SpellScript - { - PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript); + class spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript : public SpellScript + { + PrepareSpellScript(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript); - void FilterTargets(std::list& unitList) - { - unitList.remove_if(Trinity::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN)); - unitList.push_back(GetCaster()); - } + void FilterTargets(std::list& unitList) + { + unitList.remove_if(Trinity::UnitAuraCheck(true, SPELL_PACT_OF_THE_DARKFALLEN)); + unitList.push_back(GetCaster()); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_blood_queen_pact_of_the_darkfallen_dmg_SpellScript(); + } }; class BloodboltHitCheck { - public: - explicit BloodboltHitCheck(LanaThelAI* ai) : _ai(ai) {} + public: + explicit BloodboltHitCheck(LanaThelAI* ai) : _ai(ai) {} - bool operator()(WorldObject* object) const - { - return _ai->WasBloodbolted(object->GetGUID()); - } + bool operator()(WorldObject* object) const + { + return _ai->WasBloodbolted(object->GetGUID()); + } - private: - LanaThelAI* _ai; + private: + LanaThelAI* _ai; }; class spell_blood_queen_bloodbolt : public SpellScriptLoader { - public: - spell_blood_queen_bloodbolt() : SpellScriptLoader("spell_blood_queen_bloodbolt") { } + public: + spell_blood_queen_bloodbolt() : SpellScriptLoader("spell_blood_queen_bloodbolt") { } - class spell_blood_queen_bloodbolt_SpellScript : public SpellScript - { - PrepareSpellScript(spell_blood_queen_bloodbolt_SpellScript); + class spell_blood_queen_bloodbolt_SpellScript : public SpellScript + { + PrepareSpellScript(spell_blood_queen_bloodbolt_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL)) + return false; + return true; + } - bool Load() - { - return GetCaster()->GetEntry() == NPC_BLOOD_QUEEN_LANA_THEL; - } + bool Load() + { + return GetCaster()->GetEntry() == NPC_BLOOD_QUEEN_LANA_THEL; + } - void FilterTargets(std::list& targets) - { - uint32 targetCount = (targets.size() + 2) / 3; - targets.remove_if(BloodboltHitCheck(static_cast(GetCaster()->GetAI()))); - Trinity::Containers::RandomResizeList(targets, targetCount); - // mark targets now, effect hook has missile travel time delay (might cast next in that time) - for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) - GetCaster()->GetAI()->SetGUID((*itr)->GetGUID(), GUID_BLOODBOLT); - } + void FilterTargets(std::list& targets) + { + uint32 targetCount = (targets.size() + 2) / 3; + targets.remove_if(BloodboltHitCheck(static_cast(GetCaster()->GetAI()))); + Trinity::Containers::RandomResizeList(targets, targetCount); + // mark targets now, effect hook has missile travel time delay (might cast next in that time) + for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + GetCaster()->GetAI()->SetGUID((*itr)->GetGUID(), GUID_BLOODBOLT); + } - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster()->CastSpell(GetHitUnit(), SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL, true); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetCaster()->CastSpell(GetHitUnit(), SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL, true); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_bloodbolt_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_blood_queen_bloodbolt_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_bloodbolt_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_blood_queen_bloodbolt_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_blood_queen_bloodbolt_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_blood_queen_bloodbolt_SpellScript(); + } }; class spell_blood_queen_frenzied_bloodthirst : public SpellScriptLoader { - public: - spell_blood_queen_frenzied_bloodthirst() : SpellScriptLoader("spell_blood_queen_frenzied_bloodthirst") { } + public: + spell_blood_queen_frenzied_bloodthirst() : SpellScriptLoader("spell_blood_queen_frenzied_bloodthirst") { } - class spell_blood_queen_frenzied_bloodthirst_AuraScript : public AuraScript - { - PrepareAuraScript(spell_blood_queen_frenzied_bloodthirst_AuraScript); + class spell_blood_queen_frenzied_bloodthirst_AuraScript : public AuraScript + { + PrepareAuraScript(spell_blood_queen_frenzied_bloodthirst_AuraScript); - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (InstanceScript* instance = GetTarget()->GetInstanceScript()) - if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetTarget(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) - bloodQueen->AI()->Talk(EMOTE_BLOODTHIRST, GetTarget()); - } + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (InstanceScript* instance = GetTarget()->GetInstanceScript()) + if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetTarget(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) + bloodQueen->AI()->Talk(EMOTE_BLOODTHIRST, GetTarget()); + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) - if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) - if (bloodQueen->IsAlive() && bloodQueen->IsInCombat()) - { - // this needs to be done BEFORE charm aura or we hit an assert in Unit::SetCharmedBy - if (target->GetVehicleKit()) - target->RemoveVehicleKit(); + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) + if (InstanceScript* instance = target->GetInstanceScript()) + if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) + if (bloodQueen->IsAlive() && bloodQueen->IsInCombat()) + { + // this needs to be done BEFORE charm aura or we hit an assert in Unit::SetCharmedBy + if (target->GetVehicleKit()) + target->RemoveVehicleKit(); - bloodQueen->AI()->Talk(SAY_MIND_CONTROL); - bloodQueen->CastSpell(target, SPELL_UNCONTROLLABLE_FRENZY, true); - } - } + bloodQueen->AI()->Talk(SAY_MIND_CONTROL); + bloodQueen->CastSpell(target, SPELL_UNCONTROLLABLE_FRENZY, true); + } + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_blood_queen_frenzied_bloodthirst_AuraScript::OnApply, EFFECT_0, SPELL_AURA_OVERRIDE_SPELLS, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_blood_queen_frenzied_bloodthirst_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_OVERRIDE_SPELLS, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_blood_queen_frenzied_bloodthirst_AuraScript::OnApply, EFFECT_0, SPELL_AURA_OVERRIDE_SPELLS, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_blood_queen_frenzied_bloodthirst_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_OVERRIDE_SPELLS, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_blood_queen_frenzied_bloodthirst_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_blood_queen_frenzied_bloodthirst_AuraScript(); + } }; class spell_blood_queen_essence_of_the_blood_queen : public SpellScriptLoader { - public: - spell_blood_queen_essence_of_the_blood_queen() : SpellScriptLoader("spell_blood_queen_essence_of_the_blood_queen") { } + public: + spell_blood_queen_essence_of_the_blood_queen() : SpellScriptLoader("spell_blood_queen_essence_of_the_blood_queen") { } - class spell_blood_queen_essence_of_the_blood_queen_AuraScript : public AuraScript - { - PrepareAuraScript(spell_blood_queen_essence_of_the_blood_queen_AuraScript); + class spell_blood_queen_essence_of_the_blood_queen_AuraScript : public AuraScript + { + PrepareAuraScript(spell_blood_queen_essence_of_the_blood_queen_AuraScript); - bool Validate(SpellInfo const* /*spellInfo*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL)) + return false; + return true; + } - void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - int32 heal = CalculatePct(int32(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()); - GetTarget()->CastCustomSpell(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), TRIGGERED_FULL_MASK, NULL, aurEff); - } + void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + int32 heal = CalculatePct(int32(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()); + GetTarget()->CastCustomSpell(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), TRIGGERED_FULL_MASK, NULL, aurEff); + } - void Register() - { - OnEffectProc += AuraEffectProcFn(spell_blood_queen_essence_of_the_blood_queen_AuraScript::OnProc, EFFECT_1, SPELL_AURA_DUMMY); - } - }; + void Register() + { + OnEffectProc += AuraEffectProcFn(spell_blood_queen_essence_of_the_blood_queen_AuraScript::OnProc, EFFECT_1, SPELL_AURA_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_blood_queen_essence_of_the_blood_queen_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_blood_queen_essence_of_the_blood_queen_AuraScript(); + } }; class spell_blood_queen_vampiric_bite : public SpellScriptLoader { - public: - spell_blood_queen_vampiric_bite() : SpellScriptLoader("spell_blood_queen_vampiric_bite") { } + public: + spell_blood_queen_vampiric_bite() : SpellScriptLoader("spell_blood_queen_vampiric_bite") { } - class spell_blood_queen_vampiric_bite_SpellScript : public SpellScript - { - PrepareSpellScript(spell_blood_queen_vampiric_bite_SpellScript); + class spell_blood_queen_vampiric_bite_SpellScript : public SpellScript + { + PrepareSpellScript(spell_blood_queen_vampiric_bite_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_FRENZIED_BLOODTHIRST)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_FRENZIED_BLOODTHIRST)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY)) + return false; + return true; + } - SpellCastResult CheckTarget() - { - if (GetExplTargetUnit()->GetMapId() != 631) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - if (IsVampire(GetExplTargetUnit())) - { - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES); - return SPELL_FAILED_CUSTOM_ERROR; - } - if (InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript()) - if (instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == IN_PROGRESS) - return SPELL_CAST_OK; + SpellCastResult CheckTarget() + { + if (GetExplTargetUnit()->GetMapId() != 631) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + if (IsVampire(GetExplTargetUnit())) + { + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES); + return SPELL_FAILED_CUSTOM_ERROR; + } + if (InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript()) + if (instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == IN_PROGRESS) + return SPELL_CAST_OK; - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - } + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + } - void OnCast() - { - if (GetCaster()->GetTypeId() != TYPEID_PLAYER || GetCaster()->GetMapId() != 631) - return; - InstanceScript* instance = GetCaster()->GetInstanceScript(); - if (!instance || instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) != IN_PROGRESS) - return; + void OnCast() + { + if (GetCaster()->GetTypeId() != TYPEID_PLAYER || GetCaster()->GetMapId() != 631) + return; + InstanceScript* instance = GetCaster()->GetInstanceScript(); + if (!instance || instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) != IN_PROGRESS) + return; - uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_FRENZIED_BLOODTHIRST, GetCaster()); - GetCaster()->RemoveAura(spellId, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); - GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, TRIGGERED_FULL_MASK); + uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_FRENZIED_BLOODTHIRST, GetCaster()); + GetCaster()->RemoveAura(spellId, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); + GetCaster()->CastSpell(GetCaster(), SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR, TRIGGERED_FULL_MASK); if (Aura* aura = GetCaster()->GetAura(SPELL_GUSHING_WOUND)) { @@ -897,121 +897,121 @@ class spell_blood_queen_vampiric_bite : public SpellScriptLoader GetCaster()->CastSpell(GetCaster(), SPELL_GUSHING_WOUND, TRIGGERED_FULL_MASK); } - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) - bloodQueen->AI()->SetGUID(GetHitUnit()->GetGUID(), GUID_VAMPIRE); - } + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) + bloodQueen->AI()->SetGUID(GetHitUnit()->GetGUID(), GUID_VAMPIRE); + } - void HandlePresence(SpellEffIndex /*effIndex*/) - { - GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY, TRIGGERED_FULL_MASK); - GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN_SE, TRIGGERED_FULL_MASK); - } + void HandlePresence(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY, TRIGGERED_FULL_MASK); + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_PRESENCE_OF_THE_DARKFALLEN_SE, TRIGGERED_FULL_MASK); + } - void Register() - { - OnCheckCast += SpellCheckCastFn(spell_blood_queen_vampiric_bite_SpellScript::CheckTarget); - BeforeHit += SpellHitFn(spell_blood_queen_vampiric_bite_SpellScript::OnCast); - OnEffectHitTarget += SpellEffectFn(spell_blood_queen_vampiric_bite_SpellScript::HandlePresence, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL); - } - }; + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_blood_queen_vampiric_bite_SpellScript::CheckTarget); + BeforeHit += SpellHitFn(spell_blood_queen_vampiric_bite_SpellScript::OnCast); + OnEffectHitTarget += SpellEffectFn(spell_blood_queen_vampiric_bite_SpellScript::HandlePresence, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_blood_queen_vampiric_bite_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_blood_queen_vampiric_bite_SpellScript(); + } }; class spell_blood_queen_swarming_shadows_floor_dmg : public SpellScriptLoader { - public: - spell_blood_queen_swarming_shadows_floor_dmg() : SpellScriptLoader("spell_blood_queen_swarming_shadows_floor_dmg") { } + public: + spell_blood_queen_swarming_shadows_floor_dmg() : SpellScriptLoader("spell_blood_queen_swarming_shadows_floor_dmg") { } - class spell_blood_queen_swarming_shadows_floor_dmg_SpellScript : public SpellScript - { - PrepareSpellScript(spell_blood_queen_swarming_shadows_floor_dmg_SpellScript); + class spell_blood_queen_swarming_shadows_floor_dmg_SpellScript : public SpellScript + { + PrepareSpellScript(spell_blood_queen_swarming_shadows_floor_dmg_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), GetSpellInfo()->Effects[0].CalcRadius(), true)); - } + void FilterTargets(std::list& targets) + { + targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), GetSpellInfo()->Effects[0].CalcRadius(), true)); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_swarming_shadows_floor_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_blood_queen_swarming_shadows_floor_dmg_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_blood_queen_swarming_shadows_floor_dmg_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_blood_queen_swarming_shadows_floor_dmg_SpellScript(); + } }; class spell_blood_queen_presence_of_the_darkfallen : public SpellScriptLoader { - public: - spell_blood_queen_presence_of_the_darkfallen() : SpellScriptLoader("spell_blood_queen_presence_of_the_darkfallen") { } + public: + spell_blood_queen_presence_of_the_darkfallen() : SpellScriptLoader("spell_blood_queen_presence_of_the_darkfallen") { } - class spell_blood_queen_presence_of_the_darkfallen_SpellScript : public SpellScript - { - PrepareSpellScript(spell_blood_queen_presence_of_the_darkfallen_SpellScript); + class spell_blood_queen_presence_of_the_darkfallen_SpellScript : public SpellScript + { + PrepareSpellScript(spell_blood_queen_presence_of_the_darkfallen_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (!GetHitUnit()) - return; + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (!GetHitUnit()) + return; - if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) - GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL)); - } + if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) + GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL)); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_blood_queen_presence_of_the_darkfallen_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_FORCE_CAST); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_blood_queen_presence_of_the_darkfallen_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_FORCE_CAST); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_blood_queen_presence_of_the_darkfallen_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_blood_queen_presence_of_the_darkfallen_SpellScript(); + } }; class achievement_once_bitten_twice_shy : public AchievementCriteriaScript { public: - achievement_once_bitten_twice_shy(const char* name, uint8 spawnMode, bool wasVampire) : AchievementCriteriaScript(name), _spawnMode(spawnMode), _wasVampire(wasVampire) { } + achievement_once_bitten_twice_shy(const char* name, uint8 spawnMode, bool wasVampire) : AchievementCriteriaScript(name), _spawnMode(spawnMode), _wasVampire(wasVampire) { } - bool OnCheck(Player* source, Unit* target) - { - if (!target || !target->FindMap()) - return false; + bool OnCheck(Player* source, Unit* target) + { + if (!target || !target->FindMap()) + return false; - if (LanaThelAI* lanaThelAI = CAST_AI(LanaThelAI, target->GetAI())) - return (target->GetMap()->GetSpawnMode()%2) == _spawnMode && lanaThelAI->WasVampire(source->GetGUID()) == _wasVampire; - return false; - } + if (LanaThelAI* lanaThelAI = CAST_AI(LanaThelAI, target->GetAI())) + return (target->GetMap()->GetSpawnMode()%2) == _spawnMode && lanaThelAI->WasVampire(source->GetGUID()) == _wasVampire; + return false; + } - uint8 _spawnMode; - bool _wasVampire; + uint8 _spawnMode; + bool _wasVampire; }; void AddSC_boss_blood_queen_lana_thel() { - new boss_blood_queen_lana_thel(); - new spell_blood_queen_pact_of_the_darkfallen_dmg(); - new spell_blood_queen_pact_of_the_darkfallen(); - new spell_blood_queen_pact_of_the_darkfallen_dmg_target(); - new spell_blood_queen_bloodbolt(); - new spell_blood_queen_frenzied_bloodthirst(); - new spell_blood_queen_essence_of_the_blood_queen(); - new spell_blood_queen_vampiric_bite(); - new spell_blood_queen_swarming_shadows_floor_dmg(); - new spell_blood_queen_presence_of_the_darkfallen(); - new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_n_10", 0, false); - new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_v_10", 0, true); - new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_n_25", 1, false); - new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_v_25", 1, true); + new boss_blood_queen_lana_thel(); + new spell_blood_queen_pact_of_the_darkfallen_dmg(); + new spell_blood_queen_pact_of_the_darkfallen(); + new spell_blood_queen_pact_of_the_darkfallen_dmg_target(); + new spell_blood_queen_bloodbolt(); + new spell_blood_queen_frenzied_bloodthirst(); + new spell_blood_queen_essence_of_the_blood_queen(); + new spell_blood_queen_vampiric_bite(); + new spell_blood_queen_swarming_shadows_floor_dmg(); + new spell_blood_queen_presence_of_the_darkfallen(); + new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_n_10", 0, false); + new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_v_10", 0, true); + new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_n_25", 1, false); + new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_v_25", 1, true); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 8de6d1746..72258a2ce 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -27,7 +27,7 @@ enum ScriptTexts SAY_FRENZY = 11, SAY_BERSERK = 12, SAY_DEATH = 13, - EMOTE_SCENT_OF_BLOOD = 14, + EMOTE_SCENT_OF_BLOOD = 14, // High Overlord Saurfang SAY_INTRO_HORDE_1 = 0, @@ -129,7 +129,7 @@ enum EventTypes EVENT_BERSERK = 18, EVENT_SUMMON_BLOOD_BEAST = 19, - EVENT_BLOOD_BEAST_SCENT_OF_BLOOD = 100, + EVENT_BLOOD_BEAST_SCENT_OF_BLOOD = 100, EVENT_BOILING_BLOOD = 20, EVENT_BLOOD_NOVA = 21, EVENT_RUNE_OF_BLOOD = 22, @@ -179,9 +179,9 @@ enum Actions ACTION_CHARGE = -3781302, ACTION_START_OUTRO = -3781303, ACTION_DESPAWN = -3781304, - ACTION_INTRO_DONE = -3781305, - ACTION_EVADE = -3781306, - ACTION_GAIN_SCENT_OF_BLOOD = -3781307, + ACTION_INTRO_DONE = -3781305, + ACTION_EVADE = -3781306, + ACTION_GAIN_SCENT_OF_BLOOD = -3781307, ACTION_MARK_OF_THE_FALLEN_CHAMPION = -72293, }; @@ -241,10 +241,10 @@ class boss_deathbringer_saurfang : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_DEFENSIVE); events.Reset(); - _introDone = false; + _introDone = false; _frenzied = false; - _fallenChampionCastCount = 0; - _transportCheckTimer = 1000; + _fallenChampionCastCount = 0; + _transportCheckTimer = 1000; me->SetPower(POWER_ENERGY, 0); DoCast(me, SPELL_ZERO_POWER, true); DoCast(me, SPELL_BLOOD_LINK, true); @@ -258,11 +258,11 @@ class boss_deathbringer_saurfang : public CreatureScript void EnterCombat(Unit* who) { - if (!_introDone) - { - me->CombatStop(); - return; - } + if (!_introDone) + { + me->CombatStop(); + return; + } // pussywizard: without this, the aura is not recalculated the first time me->RemoveAurasDueToSpell(SPELL_BLOOD_POWER); @@ -282,7 +282,7 @@ class boss_deathbringer_saurfang : public CreatureScript events.Reset(); events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 30000); - events.ScheduleEvent(EVENT_BERSERK, (IsHeroic() ? 360000 : 480000)); + events.ScheduleEvent(EVENT_BERSERK, (IsHeroic() ? 360000 : 480000)); events.ScheduleEvent(EVENT_BOILING_BLOOD, 15500, 0); events.ScheduleEvent(EVENT_BLOOD_NOVA, 17000, 0); events.ScheduleEvent(EVENT_RUNE_OF_BLOOD, 20000, 0); @@ -303,10 +303,10 @@ class boss_deathbringer_saurfang : public CreatureScript creature->AI()->DoAction(ACTION_START_OUTRO); } - bool CanAIAttack(const Unit* target) const - { - return _introDone; - } + bool CanAIAttack(const Unit* target) const + { + return _introDone; + } void AttackStart(Unit* victim) { @@ -316,7 +316,7 @@ class boss_deathbringer_saurfang : public CreatureScript ScriptedAI::AttackStart(victim); } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} void JustReachedHome() { @@ -384,20 +384,20 @@ class boss_deathbringer_saurfang : public CreatureScript events.Update(diff); - if (_transportCheckTimer <= diff) - { - _transportCheckTimer = 1000; - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->GetTransport()) - { - EnterEvadeMode(); - return; - } - } - else - _transportCheckTimer -= diff; + if (_transportCheckTimer <= diff) + { + _transportCheckTimer = 1000; + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->GetTransport()) + { + EnterEvadeMode(); + return; + } + } + else + _transportCheckTimer -= diff; if (me->HasUnitState(UNIT_STATE_CASTING)) return; @@ -414,13 +414,13 @@ class boss_deathbringer_saurfang : public CreatureScript DoCast(me, SPELL_SUMMON_BLOOD_BEAST_25_MAN+i25); Talk(SAY_BLOOD_BEASTS); events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 40000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_BLOOD_BEAST_SCENT_OF_BLOOD, 10000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_BLOOD_BEAST_SCENT_OF_BLOOD, 10000); + break; + case EVENT_BLOOD_BEAST_SCENT_OF_BLOOD: + Talk(EMOTE_SCENT_OF_BLOOD); + summons.DoAction(ACTION_GAIN_SCENT_OF_BLOOD); break; - case EVENT_BLOOD_BEAST_SCENT_OF_BLOOD: - Talk(EMOTE_SCENT_OF_BLOOD); - summons.DoAction(ACTION_GAIN_SCENT_OF_BLOOD); - break; case EVENT_BLOOD_NOVA: { me->CastSpell((Unit*)NULL, SPELL_BLOOD_NOVA_TRIGGER, false); @@ -447,9 +447,9 @@ class boss_deathbringer_saurfang : public CreatureScript DoMeleeAttackIfReady(); } - void DoAction(int32 action) - { - switch (action) + void DoAction(int32 action) + { + switch (action) { case ACTION_MARK_OF_THE_FALLEN_CHAMPION: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, -SPELL_MARK_OF_THE_FALLEN_CHAMPION)) @@ -461,39 +461,39 @@ class boss_deathbringer_saurfang : public CreatureScript bloodPower->RecalculateAmountOfEffects(); } break; - case ACTION_INTRO_DONE: - _introDone = true; - break; + case ACTION_INTRO_DONE: + _introDone = true; + break; default: break; } - } + } uint32 GetData(uint32 type) const { if (type == DATA_MADE_A_MESS) - { + { if (_fallenChampionCastCount < RAID_MODE(3, 5, 3, 5)) return 1; - } - else if (type == FALLEN_CHAMPION_CAST_COUNT) - return _fallenChampionCastCount; + } + else if (type == FALLEN_CHAMPION_CAST_COUNT) + return _fallenChampionCastCount; return 0; } - void EnterEvadeMode() - { - BossAI::EnterEvadeMode(); - if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SAURFANG_EVENT_NPC))) + void EnterEvadeMode() + { + BossAI::EnterEvadeMode(); + if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SAURFANG_EVENT_NPC))) creature->AI()->DoAction(ACTION_EVADE); - } + } private: uint32 _fallenChampionCastCount; bool _introDone; bool _frenzied; // faster than iterating all auras to find Frenzy - uint16 _transportCheckTimer; + uint16 _transportCheckTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -518,8 +518,8 @@ class npc_high_overlord_saurfang_icc : public CreatureScript void Reset() { _events.Reset(); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetReactState(REACT_PASSIVE); } void DoAction(int32 action) @@ -527,77 +527,77 @@ class npc_high_overlord_saurfang_icc : public CreatureScript switch (action) { case ACTION_START_EVENT: - { - // Prevent crashes - if (_events.GetPhaseMask() & PHASE_INTRO_MASK) - return; + { + // Prevent crashes + if (_events.GetPhaseMask() & PHASE_INTRO_MASK) + return; - Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)); - if (!deathbringer || deathbringer->IsInEvadeMode()) - return; + Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)); + if (!deathbringer || deathbringer->IsInEvadeMode()) + return; - if (_guardList.empty()) - { - GetCreatureListWithEntryInGrid(_guardList, me, NPC_SE_KOR_KRON_REAVER, 20.0f); - _guardList.sort(Trinity::ObjectDistanceOrderPred(me)); - } - uint32 x = 1; - for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) - (*itr)->AI()->SetData(0, x++); + if (_guardList.empty()) + { + GetCreatureListWithEntryInGrid(_guardList, me, NPC_SE_KOR_KRON_REAVER, 20.0f); + _guardList.sort(Trinity::ObjectDistanceOrderPred(me)); + } + uint32 x = 1; + for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) + (*itr)->AI()->SetData(0, x++); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - Talk(SAY_INTRO_HORDE_1); - _events.SetPhase(PHASE_INTRO_H); - _events.ScheduleEvent(EVENT_INTRO_HORDE_2, 5000, 0, PHASE_INTRO_H); - _events.ScheduleEvent(EVENT_INTRO_HORDE_3, 18500, 0, PHASE_INTRO_H); - _instance->HandleGameObject(_instance->GetData64(GO_SAURFANG_S_DOOR), true); - - if (GameObject* teleporter = ObjectAccessor::GetGameObject(*me, _instance->GetData64(GO_SCOURGE_TRANSPORTER_SAURFANG))) - { - _instance->HandleGameObject(0, false, teleporter); - teleporter->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); - } + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + Talk(SAY_INTRO_HORDE_1); + _events.SetPhase(PHASE_INTRO_H); + _events.ScheduleEvent(EVENT_INTRO_HORDE_2, 5000, 0, PHASE_INTRO_H); + _events.ScheduleEvent(EVENT_INTRO_HORDE_3, 18500, 0, PHASE_INTRO_H); + _instance->HandleGameObject(_instance->GetData64(GO_SAURFANG_S_DOOR), true); + + if (GameObject* teleporter = ObjectAccessor::GetGameObject(*me, _instance->GetData64(GO_SCOURGE_TRANSPORTER_SAURFANG))) + { + _instance->HandleGameObject(0, false, teleporter); + teleporter->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + } - deathbringer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - deathbringer->SetWalk(false); - deathbringer->GetMotionMaster()->MovePoint(POINT_SAURFANG, deathbringerPos.GetPositionX(), deathbringerPos.GetPositionY(), deathbringerPos.GetPositionZ()); - } + deathbringer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + deathbringer->SetWalk(false); + deathbringer->GetMotionMaster()->MovePoint(POINT_SAURFANG, deathbringerPos.GetPositionX(), deathbringerPos.GetPositionY(), deathbringerPos.GetPositionZ()); + } break; case ACTION_START_OUTRO: - { - me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY); - me->SetDisableGravity(false); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 539.2917f, 10.0f); - for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) - (*itr)->AI()->DoAction(ACTION_DESPAWN); + { + me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY); + me->SetDisableGravity(false); + me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 539.2917f, 10.0f); + for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) + (*itr)->AI()->DoAction(ACTION_DESPAWN); - /*Talk(SAY_OUTRO_HORDE_1); - _events.ScheduleEvent(EVENT_OUTRO_HORDE_1, 10000); - _events.ScheduleEvent(EVENT_OUTRO_HORDE_2, 18000); - _events.ScheduleEvent(EVENT_OUTRO_HORDE_3, 24000);*/ - - } - break; - case ACTION_EVADE: - { - float x, y, z, o; - me->GetMotionMaster()->Clear(); - me->GetHomePosition(x, y, z, o); - me->SetPosition(x, y, z, o); - me->StopMovingOnCurrentPos(); - me->SetDisableGravity(false); - EnterEvadeMode(); - for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) - { - (*itr)->GetMotionMaster()->Clear(); - (*itr)->GetHomePosition(x, y, z, o); - (*itr)->SetPosition(x, y, z, o); - (*itr)->StopMovingOnCurrentPos(); - (*itr)->SetDisableGravity(false); - (*itr)->AI()->EnterEvadeMode(); - } - } - break; + /*Talk(SAY_OUTRO_HORDE_1); + _events.ScheduleEvent(EVENT_OUTRO_HORDE_1, 10000); + _events.ScheduleEvent(EVENT_OUTRO_HORDE_2, 18000); + _events.ScheduleEvent(EVENT_OUTRO_HORDE_3, 24000);*/ + + } + break; + case ACTION_EVADE: + { + float x, y, z, o; + me->GetMotionMaster()->Clear(); + me->GetHomePosition(x, y, z, o); + me->SetPosition(x, y, z, o); + me->StopMovingOnCurrentPos(); + me->SetDisableGravity(false); + EnterEvadeMode(); + for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) + { + (*itr)->GetMotionMaster()->Clear(); + (*itr)->GetHomePosition(x, y, z, o); + (*itr)->SetPosition(x, y, z, o); + (*itr)->StopMovingOnCurrentPos(); + (*itr)->SetDisableGravity(false); + (*itr)->AI()->EnterEvadeMode(); + } + } + break; default: break; } @@ -621,13 +621,13 @@ class npc_high_overlord_saurfang_icc : public CreatureScript case POINT_FIRST_STEP: me->SetWalk(false); Talk(SAY_INTRO_HORDE_3); - _events.ScheduleEvent(EVENT_INTRO_HORDE_4, 6500, 0, PHASE_INTRO_H); + _events.ScheduleEvent(EVENT_INTRO_HORDE_4, 6500, 0, PHASE_INTRO_H); _events.ScheduleEvent(EVENT_INTRO_HORDE_5, 15500, 0, PHASE_INTRO_H); _events.ScheduleEvent(EVENT_INTRO_HORDE_6, 29500, 0, PHASE_INTRO_H); _events.ScheduleEvent(EVENT_INTRO_HORDE_7, 43800, 0, PHASE_INTRO_H); _events.ScheduleEvent(EVENT_INTRO_HORDE_8, 47000, 0, PHASE_INTRO_H); - _events.ScheduleEvent(EVENT_INTRO_HORDE_9, 46700+1000+500, 0, PHASE_INTRO_H); - _events.ScheduleEvent(EVENT_INTRO_FINISH, 46700+1000+9000, 0, PHASE_INTRO_H); + _events.ScheduleEvent(EVENT_INTRO_HORDE_9, 46700+1000+500, 0, PHASE_INTRO_H); + _events.ScheduleEvent(EVENT_INTRO_FINISH, 46700+1000+9000, 0, PHASE_INTRO_H); break; /*case POINT_CORPSE: if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) @@ -655,19 +655,19 @@ class npc_high_overlord_saurfang_icc : public CreatureScript _events.Update(diff); switch (uint32 eventId = _events.ExecuteEvent()) { - case 0: - break; + case 0: + break; case EVENT_INTRO_HORDE_2: - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) - deathbringer->AI()->Talk(SAY_INTRO_HORDE_2); + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + deathbringer->AI()->Talk(SAY_INTRO_HORDE_2); break; case EVENT_INTRO_HORDE_3: me->SetWalk(true); me->GetMotionMaster()->MovePoint(POINT_FIRST_STEP, firstStepPos.GetPositionX(), firstStepPos.GetPositionY(), firstStepPos.GetPositionZ()); break; case EVENT_INTRO_HORDE_4: - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) - deathbringer->AI()->Talk(SAY_INTRO_HORDE_4); + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + deathbringer->AI()->Talk(SAY_INTRO_HORDE_4); break; case EVENT_INTRO_HORDE_5: Talk(SAY_INTRO_HORDE_5); @@ -685,20 +685,20 @@ class npc_high_overlord_saurfang_icc : public CreatureScript me->GetMotionMaster()->MoveCharge(chargePos[0].GetPositionX(), chargePos[0].GetPositionY(), chargePos[0].GetPositionZ(), 8.5f, POINT_CHARGE); break; case EVENT_INTRO_HORDE_9: - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) - { - deathbringer->AI()->DoCast(me, SPELL_GRIP_OF_AGONY); - deathbringer->AI()->Talk(SAY_INTRO_HORDE_9); - } + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + { + deathbringer->AI()->DoCast(me, SPELL_GRIP_OF_AGONY); + deathbringer->AI()->Talk(SAY_INTRO_HORDE_9); + } break; case EVENT_INTRO_FINISH: - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) - { - deathbringer->AI()->DoAction(ACTION_INTRO_DONE); - deathbringer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - if (Player* target = deathbringer->SelectNearestPlayer(100.0f)) - deathbringer->AI()->AttackStart(target); - } + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + { + deathbringer->AI()->DoAction(ACTION_INTRO_DONE); + deathbringer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + if (Player* target = deathbringer->SelectNearestPlayer(100.0f)) + deathbringer->AI()->AttackStart(target); + } break; /*case EVENT_OUTRO_HORDE_1: @@ -747,14 +747,14 @@ class npc_high_overlord_saurfang_icc : public CreatureScript bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { - InstanceScript* instance = creature->GetInstanceScript(); + InstanceScript* instance = creature->GetInstanceScript(); if (instance && instance->GetBossState(DATA_DEATHBRINGER_SAURFANG) != DONE && instance->GetBossState(DATA_DEATHBRINGER_SAURFANG) != IN_PROGRESS) - { - player->PlayerTalkClass->ClearMenus(); - player->CLOSE_GOSSIP_MENU(); - if (action == -ACTION_START_EVENT) - creature->AI()->DoAction(ACTION_START_EVENT); - } + { + player->PlayerTalkClass->ClearMenus(); + player->CLOSE_GOSSIP_MENU(); + if (action == -ACTION_START_EVENT) + creature->AI()->DoAction(ACTION_START_EVENT); + } return true; } @@ -780,8 +780,8 @@ class npc_muradin_bronzebeard_icc : public CreatureScript void Reset() { _events.Reset(); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetReactState(REACT_PASSIVE); } void DoAction(int32 action) @@ -789,43 +789,43 @@ class npc_muradin_bronzebeard_icc : public CreatureScript switch (action) { case ACTION_START_EVENT: - { - // Prevent crashes - if (_events.GetPhaseMask() & PHASE_INTRO_MASK) - return; + { + // Prevent crashes + if (_events.GetPhaseMask() & PHASE_INTRO_MASK) + return; - Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)); - if (!deathbringer || deathbringer->IsInEvadeMode()) - return; + Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG)); + if (!deathbringer || deathbringer->IsInEvadeMode()) + return; - if (_guardList.empty()) - { - GetCreatureListWithEntryInGrid(_guardList, me, NPC_SE_SKYBREAKER_MARINE, 20.0f); - _guardList.sort(Trinity::ObjectDistanceOrderPred(me)); - } - uint32 x = 1; - for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) - (*itr)->AI()->SetData(0, x++); + if (_guardList.empty()) + { + GetCreatureListWithEntryInGrid(_guardList, me, NPC_SE_SKYBREAKER_MARINE, 20.0f); + _guardList.sort(Trinity::ObjectDistanceOrderPred(me)); + } + uint32 x = 1; + for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) + (*itr)->AI()->SetData(0, x++); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - Talk(SAY_INTRO_ALLIANCE_1); - _events.SetPhase(PHASE_INTRO_A); - _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_2, 2500, 0, PHASE_INTRO_A); - _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_3, 20000, 0, PHASE_INTRO_A); - _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_4, 2500+17500+9500, 0, PHASE_INTRO_A); - _instance->HandleGameObject(_instance->GetData64(GO_SAURFANG_S_DOOR), true); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + Talk(SAY_INTRO_ALLIANCE_1); + _events.SetPhase(PHASE_INTRO_A); + _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_2, 2500, 0, PHASE_INTRO_A); + _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_3, 20000, 0, PHASE_INTRO_A); + _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_4, 2500+17500+9500, 0, PHASE_INTRO_A); + _instance->HandleGameObject(_instance->GetData64(GO_SAURFANG_S_DOOR), true); - if (GameObject* teleporter = ObjectAccessor::GetGameObject(*me, _instance->GetData64(GO_SCOURGE_TRANSPORTER_SAURFANG))) - { - _instance->HandleGameObject(0, false, teleporter); - teleporter->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); - } + if (GameObject* teleporter = ObjectAccessor::GetGameObject(*me, _instance->GetData64(GO_SCOURGE_TRANSPORTER_SAURFANG))) + { + _instance->HandleGameObject(0, false, teleporter); + teleporter->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + } - deathbringer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - deathbringer->SetWalk(false); - deathbringer->GetMotionMaster()->MovePoint(POINT_SAURFANG, deathbringerPos.GetPositionX(), deathbringerPos.GetPositionY(), deathbringerPos.GetPositionZ()); - } - break; + deathbringer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + deathbringer->SetWalk(false); + deathbringer->GetMotionMaster()->MovePoint(POINT_SAURFANG, deathbringerPos.GetPositionX(), deathbringerPos.GetPositionY(), deathbringerPos.GetPositionZ()); + } + break; case ACTION_START_OUTRO: { me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY); @@ -837,28 +837,28 @@ class npc_muradin_bronzebeard_icc : public CreatureScript //Talk(SAY_OUTRO_ALLIANCE_1); break; } - case ACTION_EVADE: - { - float x, y, z, o; - me->GetMotionMaster()->Clear(); - me->GetHomePosition(x, y, z, o); - me->SetPosition(x, y, z, o); - me->StopMovingOnCurrentPos(); - me->SetDisableGravity(false); - EnterEvadeMode(); - for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) - { - (*itr)->GetMotionMaster()->Clear(); - (*itr)->GetHomePosition(x, y, z, o); - (*itr)->SetPosition(x, y, z, o); - (*itr)->StopMovingOnCurrentPos(); - (*itr)->SetDisableGravity(false); - (*itr)->AI()->EnterEvadeMode(); - } - } - break; - default: - break; + case ACTION_EVADE: + { + float x, y, z, o; + me->GetMotionMaster()->Clear(); + me->GetHomePosition(x, y, z, o); + me->SetPosition(x, y, z, o); + me->StopMovingOnCurrentPos(); + me->SetDisableGravity(false); + EnterEvadeMode(); + for (std::list::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr) + { + (*itr)->GetMotionMaster()->Clear(); + (*itr)->GetHomePosition(x, y, z, o); + (*itr)->SetPosition(x, y, z, o); + (*itr)->StopMovingOnCurrentPos(); + (*itr)->SetDisableGravity(false); + (*itr)->AI()->EnterEvadeMode(); + } + } + break; + default: + break; } } @@ -878,16 +878,16 @@ class npc_muradin_bronzebeard_icc : public CreatureScript switch (id) { case POINT_FIRST_STEP: - me->SetWalk(false); - Talk(SAY_INTRO_ALLIANCE_4); - _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_5, 5000, 0, PHASE_INTRO_A); - _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_6, 6500+500, 0, PHASE_INTRO_A); - _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_7, 6500+500+2000, 0, PHASE_INTRO_A); - _events.ScheduleEvent(EVENT_INTRO_FINISH, 6500+500+2000+5000, 0, PHASE_INTRO_A); - break; - default: - break; - } + me->SetWalk(false); + Talk(SAY_INTRO_ALLIANCE_4); + _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_5, 5000, 0, PHASE_INTRO_A); + _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_6, 6500+500, 0, PHASE_INTRO_A); + _events.ScheduleEvent(EVENT_INTRO_ALLIANCE_7, 6500+500+2000, 0, PHASE_INTRO_A); + _events.ScheduleEvent(EVENT_INTRO_FINISH, 6500+500+2000+5000, 0, PHASE_INTRO_A); + break; + default: + break; + } } } @@ -896,15 +896,15 @@ class npc_muradin_bronzebeard_icc : public CreatureScript _events.Update(diff); switch (uint32 eventId = _events.ExecuteEvent()) { - case 0: - break; + case 0: + break; case EVENT_INTRO_ALLIANCE_2: - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) - deathbringer->AI()->Talk(SAY_INTRO_ALLIANCE_2); + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + deathbringer->AI()->Talk(SAY_INTRO_ALLIANCE_2); break; case EVENT_INTRO_ALLIANCE_3: if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) - deathbringer->AI()->Talk(SAY_INTRO_ALLIANCE_3); + deathbringer->AI()->Talk(SAY_INTRO_ALLIANCE_3); break; case EVENT_INTRO_ALLIANCE_4: me->SetWalk(true); @@ -917,26 +917,26 @@ class npc_muradin_bronzebeard_icc : public CreatureScript me->GetMotionMaster()->MoveCharge(chargePos[0].GetPositionX(), chargePos[0].GetPositionY(), chargePos[0].GetPositionZ(), 8.5f, POINT_CHARGE); break; case EVENT_INTRO_ALLIANCE_6: - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) - { - deathbringer->AI()->Talk(SAY_INTRO_ALLIANCE_7); - deathbringer->AI()->DoCast(me, SPELL_GRIP_OF_AGONY); - } + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + { + deathbringer->AI()->Talk(SAY_INTRO_ALLIANCE_7); + deathbringer->AI()->DoCast(me, SPELL_GRIP_OF_AGONY); + } break; case EVENT_INTRO_ALLIANCE_7: - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) - { - deathbringer->AI()->Talk(SAY_INTRO_ALLIANCE_6); - } + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + { + deathbringer->AI()->Talk(SAY_INTRO_ALLIANCE_6); + } break; case EVENT_INTRO_FINISH: - if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) - { - deathbringer->AI()->DoAction(ACTION_INTRO_DONE); - deathbringer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - if (Player* target = deathbringer->SelectNearestPlayer(100.0f)) - deathbringer->AI()->AttackStart(target); - } + if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_DEATHBRINGER_SAURFANG))) + { + deathbringer->AI()->DoAction(ACTION_INTRO_DONE); + deathbringer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + if (Player* target = deathbringer->SelectNearestPlayer(100.0f)) + deathbringer->AI()->AttackStart(target); + } break; } } @@ -949,7 +949,7 @@ class npc_muradin_bronzebeard_icc : public CreatureScript bool OnGossipHello(Player* player, Creature* creature) { - InstanceScript* instance = creature->GetInstanceScript(); + InstanceScript* instance = creature->GetInstanceScript(); if (instance && instance->GetBossState(DATA_DEATHBRINGER_SAURFANG) != DONE && instance->GetBossState(DATA_DEATHBRINGER_SAURFANG) != IN_PROGRESS) { player->ADD_GOSSIP_ITEM(0, "Let it begin...", 631, -ACTION_START_EVENT + 1); @@ -961,14 +961,14 @@ class npc_muradin_bronzebeard_icc : public CreatureScript bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { - InstanceScript* instance = creature->GetInstanceScript(); + InstanceScript* instance = creature->GetInstanceScript(); if (instance && instance->GetBossState(DATA_DEATHBRINGER_SAURFANG) != DONE && instance->GetBossState(DATA_DEATHBRINGER_SAURFANG) != IN_PROGRESS) - { - player->PlayerTalkClass->ClearMenus(); - player->CLOSE_GOSSIP_MENU(); - if (action == -ACTION_START_EVENT + 1) - creature->AI()->DoAction(ACTION_START_EVENT); - } + { + player->PlayerTalkClass->ClearMenus(); + player->CLOSE_GOSSIP_MENU(); + if (action == -ACTION_START_EVENT + 1) + creature->AI()->DoAction(ACTION_START_EVENT); + } return true; } @@ -989,7 +989,7 @@ class npc_saurfang_event : public CreatureScript npc_saurfang_eventAI(Creature* creature) : ScriptedAI(creature) { _index = 0; - me->SetReactState(REACT_PASSIVE); + me->SetReactState(REACT_PASSIVE); } void SetData(uint32 type, uint32 data) @@ -1010,10 +1010,10 @@ class npc_saurfang_event : public CreatureScript void DoAction(int32 action) { if (action == ACTION_CHARGE && _index) - { - me->SetWalk(false); + { + me->SetWalk(false); me->GetMotionMaster()->MoveCharge(chargePos[_index].GetPositionX(), chargePos[_index].GetPositionY(), chargePos[_index].GetPositionZ(), 13.0f, POINT_CHARGE); - } + } else if (action == ACTION_DESPAWN) me->DespawnOrUnsummon(1); } @@ -1045,31 +1045,31 @@ class spell_deathbringer_blood_link_aura : public SpellScriptLoader saurfang->AI()->DoAction(ACTION_MARK_OF_THE_FALLEN_CHAMPION); } - bool CheckProc(ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - SpellInfo const* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo(); - return eventInfo.GetActor() && eventInfo.GetActionTarget() && (eventInfo.GetDamageInfo()->GetDamage() || eventInfo.GetHitMask() & PROC_EX_ABSORB) && procSpell && procSpell->SpellIconID != 2731; // Xinef: Mark of the Fallen Champion + SpellInfo const* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo(); + return eventInfo.GetActor() && eventInfo.GetActionTarget() && (eventInfo.GetDamageInfo()->GetDamage() || eventInfo.GetHitMask() & PROC_EX_ABSORB) && procSpell && procSpell->SpellIconID != 2731; // Xinef: Mark of the Fallen Champion } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - Unit* victim = eventInfo.GetActionTarget(); - SpellInfo const* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo(); + Unit* victim = eventInfo.GetActionTarget(); + SpellInfo const* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo(); - uint32 markCount = 0; - if (Creature* saurfang = eventInfo.GetActor()->ToCreature()) - markCount = saurfang->IsAIEnabled ? saurfang->AI()->GetData(123456 /*FALLEN_CHAMPION_CAST_COUNT*/) : 0; - int32 basepoints = int32(1.0f /*+ 0.5f + 0.5f*markCount*/); - switch (procSpell->Id) // some spells give more Blood Power - { - case 72380: case 72438: case 72439: case 72440: // Blood Nova - basepoints = int32(2.0f /*+ 0.5f + 0.75f*markCount*/); - break; - } + uint32 markCount = 0; + if (Creature* saurfang = eventInfo.GetActor()->ToCreature()) + markCount = saurfang->IsAIEnabled ? saurfang->AI()->GetData(123456 /*FALLEN_CHAMPION_CAST_COUNT*/) : 0; + int32 basepoints = int32(1.0f /*+ 0.5f + 0.5f*markCount*/); + switch (procSpell->Id) // some spells give more Blood Power + { + case 72380: case 72438: case 72439: case 72440: // Blood Nova + basepoints = int32(2.0f /*+ 0.5f + 0.75f*markCount*/); + break; + } - victim->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActor(), true); - return; + victim->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActor(), true); + return; } void Register() @@ -1096,27 +1096,27 @@ class spell_deathbringer_blood_link_blood_beast_aura : public SpellScriptLoader { PrepareAuraScript(spell_deathbringer_blood_link_blood_beast_aura_AuraScript); - bool CheckProc(ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - SpellInfo const* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo(); - return eventInfo.GetActor() && eventInfo.GetActionTarget() && (eventInfo.GetDamageInfo()->GetDamage() || eventInfo.GetHitMask() & PROC_EX_ABSORB) && (!procSpell || procSpell->SpellIconID != 2731); // Xinef: Mark of the Fallen Champion + SpellInfo const* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo(); + return eventInfo.GetActor() && eventInfo.GetActionTarget() && (eventInfo.GetDamageInfo()->GetDamage() || eventInfo.GetHitMask() & PROC_EX_ABSORB) && (!procSpell || procSpell->SpellIconID != 2731); // Xinef: Mark of the Fallen Champion } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - uint32 markCount = 0; - if (Map* map = eventInfo.GetActor()->FindMap()) - if (InstanceMap* imap = map->ToInstanceMap()) - if (InstanceScript* isc = imap->GetInstanceScript()) - if (uint64 sguid = isc->GetData64(3 /*DATA_DEATHBRINGER_SAURFANG*/)) - if (Creature* saurfang = ObjectAccessor::GetCreature(*eventInfo.GetActor(), sguid)) - markCount = saurfang->IsAIEnabled ? saurfang->AI()->GetData(123456 /*FALLEN_CHAMPION_CAST_COUNT*/) : 0; - int32 basepoints = int32(3.0f /*+ 0.5f + 0.5f*markCount*/); + uint32 markCount = 0; + if (Map* map = eventInfo.GetActor()->FindMap()) + if (InstanceMap* imap = map->ToInstanceMap()) + if (InstanceScript* isc = imap->GetInstanceScript()) + if (uint64 sguid = isc->GetData64(3 /*DATA_DEATHBRINGER_SAURFANG*/)) + if (Creature* saurfang = ObjectAccessor::GetCreature(*eventInfo.GetActor(), sguid)) + markCount = saurfang->IsAIEnabled ? saurfang->AI()->GetData(123456 /*FALLEN_CHAMPION_CAST_COUNT*/) : 0; + int32 basepoints = int32(3.0f /*+ 0.5f + 0.5f*markCount*/); - eventInfo.GetActor()->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActionTarget(), true); - return; + eventInfo.GetActor()->CastCustomSpell(SPELL_BLOOD_LINK_DUMMY, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActionTarget(), true); + return; } void Register() @@ -1249,12 +1249,12 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader if (targetsAtRange < minTargets) targetsAtRange = std::min(targets.size(), minTargets); - if (!targetsAtRange) - return; + if (!targetsAtRange) + return; - std::list::iterator itrTarget = targets.begin(); - std::advance(itrTarget, urand(0,targetsAtRange-1)); - target = *itrTarget; + std::list::iterator itrTarget = targets.begin(); + std::advance(itrTarget, urand(0,targetsAtRange-1)); + target = *itrTarget; targets.clear(); targets.push_back(target); } @@ -1304,14 +1304,14 @@ class spell_deathbringer_boiling_blood : public SpellScriptLoader if (targets.empty()) return; - if (GetSpellInfo()->Id == 72385 || GetSpellInfo()->Id == 72442) // 10n, 10h - { - WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); - targets.clear(); - targets.push_back(target); - } - else - Trinity::Containers::RandomResizeList(targets, 3); + if (GetSpellInfo()->Id == 72385 || GetSpellInfo()->Id == 72442) // 10n, 10h + { + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); + } + else + Trinity::Containers::RandomResizeList(targets, 3); } void Register() @@ -1345,45 +1345,45 @@ class achievement_ive_gone_and_made_a_mess : public AchievementCriteriaScript class npc_icc_blood_beast : public CreatureScript { public: - npc_icc_blood_beast() : CreatureScript("npc_icc_blood_beast") { } + npc_icc_blood_beast() : CreatureScript("npc_icc_blood_beast") { } - struct npc_icc_blood_beastAI : public ScriptedAI - { - npc_icc_blood_beastAI(Creature* creature) : ScriptedAI(creature) - { - me->SetControlled(true, UNIT_STATE_ROOT); - timer1 = 1500; - } + struct npc_icc_blood_beastAI : public ScriptedAI + { + npc_icc_blood_beastAI(Creature* creature) : ScriptedAI(creature) + { + me->SetControlled(true, UNIT_STATE_ROOT); + timer1 = 1500; + } - uint16 timer1; + uint16 timer1; - void DoAction(int32 param) - { - if (param == ACTION_GAIN_SCENT_OF_BLOOD) - me->CastSpell(me, SPELL_SCENT_OF_BLOOD, false); - } + void DoAction(int32 param) + { + if (param == ACTION_GAIN_SCENT_OF_BLOOD) + me->CastSpell(me, SPELL_SCENT_OF_BLOOD, false); + } - void UpdateAI(uint32 diff) - { - if (timer1) - { - if (timer1 <= diff) - { - me->SetControlled(false, UNIT_STATE_ROOT); - timer1 = 0; - } - else - timer1 -= diff; - } + void UpdateAI(uint32 diff) + { + if (timer1) + { + if (timer1 <= diff) + { + me->SetControlled(false, UNIT_STATE_ROOT); + timer1 = 0; + } + else + timer1 -= diff; + } - ScriptedAI::UpdateAI(diff); - } - }; + ScriptedAI::UpdateAI(diff); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_icc_blood_beastAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_icc_blood_beastAI(creature); + } }; void AddSC_boss_deathbringer_saurfang() @@ -1392,12 +1392,12 @@ void AddSC_boss_deathbringer_saurfang() new npc_high_overlord_saurfang_icc(); new npc_muradin_bronzebeard_icc(); new npc_saurfang_event(); - new spell_deathbringer_blood_link_aura(); - new spell_deathbringer_blood_link_blood_beast_aura(); + new spell_deathbringer_blood_link_aura(); + new spell_deathbringer_blood_link_blood_beast_aura(); new spell_deathbringer_blood_link(); new spell_deathbringer_blood_power(); new spell_deathbringer_blood_nova_targeting(); new spell_deathbringer_boiling_blood(); new achievement_ive_gone_and_made_a_mess(); - new npc_icc_blood_beast(); + new npc_icc_blood_beast(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index 94a983bf4..546876fae 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -10,34 +10,34 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum ScriptTexts { - SAY_STINKY_DEAD = 0, - SAY_AGGRO = 1, - EMOTE_GAS_SPORE = 2, - EMOTE_WARN_GAS_SPORE = 3, - SAY_PUNGENT_BLIGHT = 4, - EMOTE_WARN_PUNGENT_BLIGHT = 5, - EMOTE_PUNGENT_BLIGHT = 6, - SAY_KILL = 7, - SAY_BERSERK = 8, - SAY_DEATH = 9, + SAY_STINKY_DEAD = 0, + SAY_AGGRO = 1, + EMOTE_GAS_SPORE = 2, + EMOTE_WARN_GAS_SPORE = 3, + SAY_PUNGENT_BLIGHT = 4, + EMOTE_WARN_PUNGENT_BLIGHT = 5, + EMOTE_PUNGENT_BLIGHT = 6, + SAY_KILL = 7, + SAY_BERSERK = 8, + SAY_DEATH = 9, }; enum Spells { - // Festergut - SPELL_INHALE_BLIGHT = 69165, - SPELL_PUNGENT_BLIGHT = 69195, - SPELL_GASTRIC_BLOAT = 72219, // 72214 is the proper way (with proc) but atm procs can't have cooldown for creatures - SPELL_GASTRIC_EXPLOSION = 72227, - SPELL_GAS_SPORE = 69278, - SPELL_VILE_GAS = 69240, - SPELL_INOCULATED = 69291, - SPELL_MALLABLE_GOO_H = 72296, + // Festergut + SPELL_INHALE_BLIGHT = 69165, + SPELL_PUNGENT_BLIGHT = 69195, + SPELL_GASTRIC_BLOAT = 72219, // 72214 is the proper way (with proc) but atm procs can't have cooldown for creatures + SPELL_GASTRIC_EXPLOSION = 72227, + SPELL_GAS_SPORE = 69278, + SPELL_VILE_GAS = 69240, + SPELL_INOCULATED = 69291, + SPELL_MALLABLE_GOO_H = 72296, - // Stinky - SPELL_MORTAL_WOUND = 71127, - SPELL_DECIMATE = 71123, - SPELL_PLAGUE_STENCH = 71805, + // Stinky + SPELL_MORTAL_WOUND = 71127, + SPELL_DECIMATE = 71123, + SPELL_PLAGUE_STENCH = 71805, }; // Used for HasAura checks @@ -51,444 +51,444 @@ uint32 const gaseousBlightVisual[3] = {69126, 69152, 69154}; enum Events { - // Festergut - EVENT_NONE, - EVENT_BERSERK, - EVENT_INHALE_BLIGHT, - EVENT_VILE_GAS, - EVENT_GAS_SPORE, - EVENT_GASTRIC_BLOAT, - EVENT_FESTERGUT_GOO, + // Festergut + EVENT_NONE, + EVENT_BERSERK, + EVENT_INHALE_BLIGHT, + EVENT_VILE_GAS, + EVENT_GAS_SPORE, + EVENT_GASTRIC_BLOAT, + EVENT_FESTERGUT_GOO, - // Stinky - EVENT_DECIMATE, - EVENT_MORTAL_WOUND, + // Stinky + EVENT_DECIMATE, + EVENT_MORTAL_WOUND, }; class boss_festergut : public CreatureScript { - public: - boss_festergut() : CreatureScript("boss_festergut") { } + public: + boss_festergut() : CreatureScript("boss_festergut") { } - struct boss_festergutAI : public BossAI - { - boss_festergutAI(Creature* creature) : BossAI(creature, DATA_FESTERGUT) - { - _gasDummyGUID = 0; - } + struct boss_festergutAI : public BossAI + { + boss_festergutAI(Creature* creature) : BossAI(creature, DATA_FESTERGUT) + { + _gasDummyGUID = 0; + } - uint64 _gasDummyGUID; - uint32 _maxInoculatedStack; - uint32 _inhaleCounter; + uint64 _gasDummyGUID; + uint32 _maxInoculatedStack; + uint32 _inhaleCounter; - void Reset() - { - _maxInoculatedStack = 0; - _inhaleCounter = 0; - _Reset(); - events.Reset(); - if (Creature* gasDummy = me->FindNearestCreature(NPC_GAS_DUMMY, 100.0f, true)) - { - _gasDummyGUID = gasDummy->GetGUID(); - for (uint8 i=0; i<3; ++i) - gasDummy->RemoveAurasDueToSpell(gaseousBlightVisual[i]); - } - } + void Reset() + { + _maxInoculatedStack = 0; + _inhaleCounter = 0; + _Reset(); + events.Reset(); + if (Creature* gasDummy = me->FindNearestCreature(NPC_GAS_DUMMY, 100.0f, true)) + { + _gasDummyGUID = gasDummy->GetGUID(); + for (uint8 i=0; i<3; ++i) + gasDummy->RemoveAurasDueToSpell(gaseousBlightVisual[i]); + } + } - void EnterCombat(Unit* who) - { - if (!instance->CheckRequiredBosses(DATA_FESTERGUT, who->ToPlayer())) - { - EnterEvadeMode(); - instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); - return; - } + void EnterCombat(Unit* who) + { + if (!instance->CheckRequiredBosses(DATA_FESTERGUT, who->ToPlayer())) + { + EnterEvadeMode(); + instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); + return; + } - events.ScheduleEvent(EVENT_BERSERK, 300000); - events.ScheduleEvent(EVENT_INHALE_BLIGHT, urand(25000, 30000)); - events.ScheduleEvent(EVENT_GAS_SPORE, urand(20000, 25000)); - events.ScheduleEvent(EVENT_VILE_GAS, urand(30000, 40000), 1); - events.ScheduleEvent(EVENT_GASTRIC_BLOAT, urand(12500, 15000)); - if (IsHeroic()) - events.ScheduleEvent(EVENT_FESTERGUT_GOO, urand(15000, 20000)); + events.ScheduleEvent(EVENT_BERSERK, 300000); + events.ScheduleEvent(EVENT_INHALE_BLIGHT, urand(25000, 30000)); + events.ScheduleEvent(EVENT_GAS_SPORE, urand(20000, 25000)); + events.ScheduleEvent(EVENT_VILE_GAS, urand(30000, 40000), 1); + events.ScheduleEvent(EVENT_GASTRIC_BLOAT, urand(12500, 15000)); + if (IsHeroic()) + events.ScheduleEvent(EVENT_FESTERGUT_GOO, urand(15000, 20000)); - me->setActive(true); - Talk(SAY_AGGRO); - DoZoneInCombat(); + me->setActive(true); + Talk(SAY_AGGRO); + DoZoneInCombat(); - if (Creature* gasDummy = me->FindNearestCreature(NPC_GAS_DUMMY, 100.0f, true)) - _gasDummyGUID = gasDummy->GetGUID(); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - professor->AI()->DoAction(ACTION_FESTERGUT_COMBAT); - } + if (Creature* gasDummy = me->FindNearestCreature(NPC_GAS_DUMMY, 100.0f, true)) + _gasDummyGUID = gasDummy->GetGUID(); + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + professor->AI()->DoAction(ACTION_FESTERGUT_COMBAT); + } - void JustDied(Unit* /*killer*/) - { - _JustDied(); - Talk(SAY_DEATH); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - professor->AI()->DoAction(ACTION_FESTERGUT_DEATH); + void JustDied(Unit* /*killer*/) + { + _JustDied(); + Talk(SAY_DEATH); + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + professor->AI()->DoAction(ACTION_FESTERGUT_DEATH); - RemoveBlight(); - } + RemoveBlight(); + } - void JustReachedHome() - { - _JustReachedHome(); - instance->SetBossState(DATA_FESTERGUT, FAIL); - } + void JustReachedHome() + { + _JustReachedHome(); + instance->SetBossState(DATA_FESTERGUT, FAIL); + } - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - professor->AI()->EnterEvadeMode(); - } + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + professor->AI()->EnterEvadeMode(); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } - void SpellHitTarget(Unit* target, SpellInfo const* spell) - { - if (spell->Id == PUNGENT_BLIGHT_HELPER) - target->RemoveAurasDueToSpell(INOCULATED_HELPER); - else if (Player* p = target->ToPlayer()) - { - // Gaseous Blight damage - if ((spell->Id == 69159 || spell->Id == 70136 || spell->Id == 69161 || spell->Id == 70139 || spell->Id == 69163 || spell->Id == 70469) && p->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_10) == QUEST_STATUS_INCOMPLETE || - (spell->Id == 70135 || spell->Id == 70138 || spell->Id == 70468 || spell->Id == 70137 || spell->Id == 70140 || spell->Id == 70470) && p->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_25) == QUEST_STATUS_INCOMPLETE) - p->CastSpell(p, SPELL_ORANGE_BLIGHT_RESIDUE, true); - } - } + void SpellHitTarget(Unit* target, SpellInfo const* spell) + { + if (spell->Id == PUNGENT_BLIGHT_HELPER) + target->RemoveAurasDueToSpell(INOCULATED_HELPER); + else if (Player* p = target->ToPlayer()) + { + // Gaseous Blight damage + if ((spell->Id == 69159 || spell->Id == 70136 || spell->Id == 69161 || spell->Id == 70139 || spell->Id == 69163 || spell->Id == 70469) && p->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_10) == QUEST_STATUS_INCOMPLETE || + (spell->Id == 70135 || spell->Id == 70138 || spell->Id == 70468 || spell->Id == 70137 || spell->Id == 70140 || spell->Id == 70470) && p->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_25) == QUEST_STATUS_INCOMPLETE) + p->CastSpell(p, SPELL_ORANGE_BLIGHT_RESIDUE, true); + } + } - void RemoveBlight() - { - if (Creature* gasDummy = ObjectAccessor::GetCreature(*me, _gasDummyGUID)) - for (uint8 i = 0; i < 3; ++i) - { - me->RemoveAurasDueToSpell(gaseousBlight[i]); - gasDummy->RemoveAurasDueToSpell(gaseousBlightVisual[i]); - } - } + void RemoveBlight() + { + if (Creature* gasDummy = ObjectAccessor::GetCreature(*me, _gasDummyGUID)) + for (uint8 i = 0; i < 3; ++i) + { + me->RemoveAurasDueToSpell(gaseousBlight[i]); + gasDummy->RemoveAurasDueToSpell(gaseousBlightVisual[i]); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() || !CheckInRoom()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() || !CheckInRoom()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK2, true); - Talk(SAY_BERSERK); - break; - case EVENT_INHALE_BLIGHT: - RemoveBlight(); - if (_inhaleCounter == 3) - { - Talk(EMOTE_WARN_PUNGENT_BLIGHT); - Talk(SAY_PUNGENT_BLIGHT); - me->CastSpell(me, SPELL_PUNGENT_BLIGHT, false); - _inhaleCounter = 0; - events.RescheduleEvent(EVENT_GAS_SPORE, urand(20000, 25000)); - } - else - { - me->CastSpell(me, SPELL_INHALE_BLIGHT, false); - // just cast and dont bother with target, conditions will handle it - ++_inhaleCounter; - if (_inhaleCounter < 3) - me->CastSpell(me, gaseousBlight[_inhaleCounter], true, NULL, NULL, me->GetGUID()); - } + switch (events.ExecuteEvent()) + { + case EVENT_BERSERK: + me->CastSpell(me, SPELL_BERSERK2, true); + Talk(SAY_BERSERK); + break; + case EVENT_INHALE_BLIGHT: + RemoveBlight(); + if (_inhaleCounter == 3) + { + Talk(EMOTE_WARN_PUNGENT_BLIGHT); + Talk(SAY_PUNGENT_BLIGHT); + me->CastSpell(me, SPELL_PUNGENT_BLIGHT, false); + _inhaleCounter = 0; + events.RescheduleEvent(EVENT_GAS_SPORE, urand(20000, 25000)); + } + else + { + me->CastSpell(me, SPELL_INHALE_BLIGHT, false); + // just cast and dont bother with target, conditions will handle it + ++_inhaleCounter; + if (_inhaleCounter < 3) + me->CastSpell(me, gaseousBlight[_inhaleCounter], true, NULL, NULL, me->GetGUID()); + } - events.ScheduleEvent(EVENT_INHALE_BLIGHT, 34000); - break; - case EVENT_GAS_SPORE: - Talk(EMOTE_WARN_GAS_SPORE); - Talk(EMOTE_GAS_SPORE); - me->CastCustomSpell(SPELL_GAS_SPORE, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 3, 2, 3), me); - events.ScheduleEvent(EVENT_GAS_SPORE, urand(40000, 45000)); - events.DelayEventsToMax(20000, 1); // delay EVENT_VILE_GAS - break; - case EVENT_VILE_GAS: - { - std::list targets; - uint32 minTargets = RAID_MODE(3, 8, 3, 8); - SelectTargetList(targets, minTargets, SELECT_TARGET_RANDOM, -5.0f, true); - float minDist = 0.0f; - if (targets.size() >= minTargets) - minDist = -5.0f; + events.ScheduleEvent(EVENT_INHALE_BLIGHT, 34000); + break; + case EVENT_GAS_SPORE: + Talk(EMOTE_WARN_GAS_SPORE); + Talk(EMOTE_GAS_SPORE); + me->CastCustomSpell(SPELL_GAS_SPORE, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 3, 2, 3), me); + events.ScheduleEvent(EVENT_GAS_SPORE, urand(40000, 45000)); + events.DelayEventsToMax(20000, 1); // delay EVENT_VILE_GAS + break; + case EVENT_VILE_GAS: + { + std::list targets; + uint32 minTargets = RAID_MODE(3, 8, 3, 8); + SelectTargetList(targets, minTargets, SELECT_TARGET_RANDOM, -5.0f, true); + float minDist = 0.0f; + if (targets.size() >= minTargets) + minDist = -5.0f; - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, minDist, true)) - me->CastSpell(target, SPELL_VILE_GAS, false); - events.ScheduleEvent(EVENT_VILE_GAS, urand(28000, 35000), 1); - break; - } - case EVENT_GASTRIC_BLOAT: - me->CastSpell(me->GetVictim(), SPELL_GASTRIC_BLOAT, false); - events.ScheduleEvent(EVENT_GASTRIC_BLOAT, urand(15000, 17500)); - break; - case EVENT_FESTERGUT_GOO: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - professor->CastSpell(target, SPELL_MALLABLE_GOO_H, true); - events.ScheduleEvent(EVENT_FESTERGUT_GOO, urand(15000, 20000)); - default: - break; - } + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, minDist, true)) + me->CastSpell(target, SPELL_VILE_GAS, false); + events.ScheduleEvent(EVENT_VILE_GAS, urand(28000, 35000), 1); + break; + } + case EVENT_GASTRIC_BLOAT: + me->CastSpell(me->GetVictim(), SPELL_GASTRIC_BLOAT, false); + events.ScheduleEvent(EVENT_GASTRIC_BLOAT, urand(15000, 17500)); + break; + case EVENT_FESTERGUT_GOO: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + professor->CastSpell(target, SPELL_MALLABLE_GOO_H, true); + events.ScheduleEvent(EVENT_FESTERGUT_GOO, urand(15000, 20000)); + default: + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void SetData(uint32 type, uint32 data) - { - if (type == DATA_INOCULATED_STACK && data > _maxInoculatedStack) - _maxInoculatedStack = data; - } + void SetData(uint32 type, uint32 data) + { + if (type == DATA_INOCULATED_STACK && data > _maxInoculatedStack) + _maxInoculatedStack = data; + } - uint32 GetData(uint32 type) const - { - if (type == DATA_INOCULATED_STACK) - return _maxInoculatedStack; + uint32 GetData(uint32 type) const + { + if (type == DATA_INOCULATED_STACK) + return _maxInoculatedStack; - return 0; - } - }; + return 0; + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_festergut_pungent_blight : public SpellScriptLoader { - public: - spell_festergut_pungent_blight() : SpellScriptLoader("spell_festergut_pungent_blight") { } + public: + spell_festergut_pungent_blight() : SpellScriptLoader("spell_festergut_pungent_blight") { } - class spell_festergut_pungent_blight_SpellScript : public SpellScript - { - PrepareSpellScript(spell_festergut_pungent_blight_SpellScript); + class spell_festergut_pungent_blight_SpellScript : public SpellScript + { + PrepareSpellScript(spell_festergut_pungent_blight_SpellScript); - bool Load() - { - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } - void HandleScript(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - if (caster->GetTypeId() != TYPEID_UNIT) - return; + void HandleScript(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (caster->GetTypeId() != TYPEID_UNIT) + return; - // Get Inhaled Blight id for our difficulty - uint32 blightId = sSpellMgr->GetSpellIdForDifficulty(uint32(GetEffectValue()), caster); + // Get Inhaled Blight id for our difficulty + uint32 blightId = sSpellMgr->GetSpellIdForDifficulty(uint32(GetEffectValue()), caster); - // ...and remove it - caster->RemoveAurasDueToSpell(blightId); - caster->ToCreature()->AI()->Talk(EMOTE_PUNGENT_BLIGHT); + // ...and remove it + caster->RemoveAurasDueToSpell(blightId); + caster->ToCreature()->AI()->Talk(EMOTE_PUNGENT_BLIGHT); - if (InstanceScript* inst = caster->GetInstanceScript()) - if (Creature* professor = ObjectAccessor::GetCreature(*caster, inst->GetData64(DATA_PROFESSOR_PUTRICIDE))) - professor->AI()->DoAction(ACTION_FESTERGUT_GAS); - } + if (InstanceScript* inst = caster->GetInstanceScript()) + if (Creature* professor = ObjectAccessor::GetCreature(*caster, inst->GetData64(DATA_PROFESSOR_PUTRICIDE))) + professor->AI()->DoAction(ACTION_FESTERGUT_GAS); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_festergut_pungent_blight_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_festergut_pungent_blight_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_festergut_pungent_blight_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_festergut_pungent_blight_SpellScript(); + } }; class spell_festergut_blighted_spores : public SpellScriptLoader { - public: - spell_festergut_blighted_spores() : SpellScriptLoader("spell_festergut_blighted_spores") { } + public: + spell_festergut_blighted_spores() : SpellScriptLoader("spell_festergut_blighted_spores") { } - class spell_festergut_blighted_spores_AuraScript : public AuraScript - { - PrepareAuraScript(spell_festergut_blighted_spores_AuraScript); + class spell_festergut_blighted_spores_AuraScript : public AuraScript + { + PrepareAuraScript(spell_festergut_blighted_spores_AuraScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_INOCULATED)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_INOCULATED)) + return false; + return true; + } - void ExtraEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (Aura* a = aurEff->GetBase()) - if (a->GetDuration() > a->GetMaxDuration()-1000) // this does not stack for different casters and previous is removed by new DoT, prevent it from giving inoculation in such case - return; - uint32 inoculatedId = sSpellMgr->GetSpellIdForDifficulty(SPELL_INOCULATED, GetTarget()); - uint8 inoculatedStack = 1; - if (Aura* a = GetTarget()->GetAura(inoculatedId)) - { - inoculatedStack += a->GetStackAmount(); - if (a->GetDuration() > a->GetMaxDuration()-10000) // player may gain only one stack at a time, no matter how many spores explode near him - return; - } - GetTarget()->CastSpell(GetTarget(), SPELL_INOCULATED, true); - if (InstanceScript* instance = GetTarget()->GetInstanceScript()) - if (Creature* festergut = ObjectAccessor::GetCreature(*GetTarget(), instance->GetData64(DATA_FESTERGUT))) - festergut->AI()->SetData(DATA_INOCULATED_STACK, inoculatedStack); - } + void ExtraEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Aura* a = aurEff->GetBase()) + if (a->GetDuration() > a->GetMaxDuration()-1000) // this does not stack for different casters and previous is removed by new DoT, prevent it from giving inoculation in such case + return; + uint32 inoculatedId = sSpellMgr->GetSpellIdForDifficulty(SPELL_INOCULATED, GetTarget()); + uint8 inoculatedStack = 1; + if (Aura* a = GetTarget()->GetAura(inoculatedId)) + { + inoculatedStack += a->GetStackAmount(); + if (a->GetDuration() > a->GetMaxDuration()-10000) // player may gain only one stack at a time, no matter how many spores explode near him + return; + } + GetTarget()->CastSpell(GetTarget(), SPELL_INOCULATED, true); + if (InstanceScript* instance = GetTarget()->GetInstanceScript()) + if (Creature* festergut = ObjectAccessor::GetCreature(*GetTarget(), instance->GetData64(DATA_FESTERGUT))) + festergut->AI()->SetData(DATA_INOCULATED_STACK, inoculatedStack); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_festergut_blighted_spores_AuraScript::ExtraEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_festergut_blighted_spores_AuraScript::ExtraEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_festergut_blighted_spores_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_festergut_blighted_spores_AuraScript(); + } }; class spell_festergut_gastric_bloat : public SpellScriptLoader { - public: - spell_festergut_gastric_bloat() : SpellScriptLoader("spell_festergut_gastric_bloat") { } + public: + spell_festergut_gastric_bloat() : SpellScriptLoader("spell_festergut_gastric_bloat") { } - class spell_festergut_gastric_bloat_SpellScript : public SpellScript - { - PrepareSpellScript(spell_festergut_gastric_bloat_SpellScript); + class spell_festergut_gastric_bloat_SpellScript : public SpellScript + { + PrepareSpellScript(spell_festergut_gastric_bloat_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_GASTRIC_EXPLOSION)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_GASTRIC_EXPLOSION)) + return false; + return true; + } - void HandleScript(SpellEffIndex /*effIndex*/) - { - Aura const* aura = GetHitUnit()->GetAura(GetSpellInfo()->Id); - if (!(aura && aura->GetStackAmount() == 10)) - return; + void HandleScript(SpellEffIndex /*effIndex*/) + { + Aura const* aura = GetHitUnit()->GetAura(GetSpellInfo()->Id); + if (!(aura && aura->GetStackAmount() == 10)) + return; - GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Id); - GetHitUnit()->CastSpell(GetHitUnit(), SPELL_GASTRIC_EXPLOSION, true); - } + GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Id); + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_GASTRIC_EXPLOSION, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_festergut_gastric_bloat_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_festergut_gastric_bloat_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_festergut_gastric_bloat_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_festergut_gastric_bloat_SpellScript(); + } }; class achievement_flu_shot_shortage : public AchievementCriteriaScript { - public: - achievement_flu_shot_shortage() : AchievementCriteriaScript("achievement_flu_shot_shortage") { } + public: + achievement_flu_shot_shortage() : AchievementCriteriaScript("achievement_flu_shot_shortage") { } - bool OnCheck(Player* /*source*/, Unit* target) - { - if (target && target->GetTypeId() == TYPEID_UNIT) - return target->ToCreature()->AI()->GetData(DATA_INOCULATED_STACK) < 3; + bool OnCheck(Player* /*source*/, Unit* target) + { + if (target && target->GetTypeId() == TYPEID_UNIT) + return target->ToCreature()->AI()->GetData(DATA_INOCULATED_STACK) < 3; - return false; - } + return false; + } }; class npc_stinky_icc : public CreatureScript { - public: - npc_stinky_icc() : CreatureScript("npc_stinky_icc") { } + public: + npc_stinky_icc() : CreatureScript("npc_stinky_icc") { } - struct npc_stinky_iccAI : public ScriptedAI - { - npc_stinky_iccAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_stinky_iccAI : public ScriptedAI + { + npc_stinky_iccAI(Creature* creature) : ScriptedAI(creature) {} - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*target*/) - { - me->setActive(true); - me->CastSpell(me, SPELL_PLAGUE_STENCH, true); - events.ScheduleEvent(EVENT_DECIMATE, urand(20000, 25000)); - events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(1500, 2500)); - } + void EnterCombat(Unit* /*target*/) + { + me->setActive(true); + me->CastSpell(me, SPELL_PLAGUE_STENCH, true); + events.ScheduleEvent(EVENT_DECIMATE, urand(20000, 25000)); + events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(1500, 2500)); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_DECIMATE: - me->CastSpell(me->GetVictim(), SPELL_DECIMATE, false); - events.ScheduleEvent(EVENT_DECIMATE, urand(20000, 25000)); - break; - case EVENT_MORTAL_WOUND: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); - events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(1500, 2500)); - break; - default: - break; - } - } + if (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DECIMATE: + me->CastSpell(me->GetVictim(), SPELL_DECIMATE, false); + events.ScheduleEvent(EVENT_DECIMATE, urand(20000, 25000)); + break; + case EVENT_MORTAL_WOUND: + me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); + events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(1500, 2500)); + break; + default: + break; + } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - if (InstanceScript* _instance = me->GetInstanceScript()) - if (Creature* festergut = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FESTERGUT))) - if (festergut->IsAlive()) - festergut->AI()->Talk(SAY_STINKY_DEAD); - } + void JustDied(Unit* /*killer*/) + { + if (InstanceScript* _instance = me->GetInstanceScript()) + if (Creature* festergut = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FESTERGUT))) + if (festergut->IsAlive()) + festergut->AI()->Talk(SAY_STINKY_DEAD); + } - private: - EventMap events; - }; + private: + EventMap events; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; void AddSC_boss_festergut() { - new boss_festergut(); - new spell_festergut_pungent_blight(); - new spell_festergut_blighted_spores(); - new spell_festergut_gastric_bloat(); - new achievement_flu_shot_shortage(); + new boss_festergut(); + new spell_festergut_pungent_blight(); + new spell_festergut_blighted_spores(); + new spell_festergut_gastric_bloat(); + new achievement_flu_shot_shortage(); - new npc_stinky_icc(); + new npc_stinky_icc(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index 946e2b6f0..9d7df5d9e 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -419,19 +419,19 @@ public: continue; } - Position spawnPos = SelectSpawnPoint(); - if (Creature* passenger = summoner->SummonCreature(_slotInfo[i].Entry, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000)) + Position spawnPos = SelectSpawnPoint(); + if (Creature* passenger = summoner->SummonCreature(_slotInfo[i].Entry, spawnPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000)) { - if (!passenger->GetTransport()) - _transport->AddPassenger(passenger, true); - passenger->ApplySpellImmune(0, IMMUNITY_ID, 49576, true); // death grip + if (!passenger->GetTransport()) + _transport->AddPassenger(passenger, true); + passenger->ApplySpellImmune(0, IMMUNITY_ID, 49576, true); // death grip - if (i >= SLOT_MAGE_1 && i <= SLOT_MORTAR_4) // only these npcs are pooled - { - _controlledSlots[i] = passenger->GetGUID(); - _respawnCooldowns[i] = time_t(0); - } - passenger->AI()->SetData(ACTION_SET_SLOT, i); + if (i >= SLOT_MAGE_1 && i <= SLOT_MORTAR_4) // only these npcs are pooled + { + _controlledSlots[i] = passenger->GetGUID(); + _respawnCooldowns[i] = time_t(0); + } + passenger->AI()->SetData(ACTION_SET_SLOT, i); summoned = true; } } @@ -454,7 +454,7 @@ private: newPos.m_positionY = _spawnPoint->GetPositionY() + 2.0f * std::sin(angle); newPos.m_positionZ = _spawnPoint->GetPositionZ(); newPos.SetOrientation(_spawnPoint->GetOrientation()); - _transport->CalculatePassengerPosition(newPos.m_positionX, newPos.m_positionY, newPos.m_positionZ, &(newPos.m_orientation)); + _transport->CalculatePassengerPosition(newPos.m_positionX, newPos.m_positionY, newPos.m_positionZ, &(newPos.m_orientation)); return newPos; } @@ -472,12 +472,12 @@ public: bool Execute(uint64, uint32) { - if (!_owner->IsAlive() || !_owner->GetTransport()) + if (!_owner->IsAlive() || !_owner->GetTransport()) return true; - float x,y,z,o; - _dest.GetPosition(x,y,z,o); - _owner->GetTransport()->CalculatePassengerPosition(x,y,z,&o); + float x,y,z,o; + _dest.GetPosition(x,y,z,o); + _owner->GetTransport()->CalculatePassengerPosition(x,y,z,&o); _owner->GetMotionMaster()->MovePoint(EVENT_CHARGE_PREPATH, x, y, z, false); return true; } @@ -495,14 +495,14 @@ public: bool Execute(uint64, uint32) { _caster->CastSpell(_caster, _spellId, true); - _caster->GetTransport()->ToMotionTransport()->UnloadNonStaticPassengers(); + _caster->GetTransport()->ToMotionTransport()->UnloadNonStaticPassengers(); _caster->GetTransport()->AddObjectToRemoveList(); if (GameObject* go = HashMapHolder::Find(_otherTransport)) - { - go->ToMotionTransport()->UnloadNonStaticPassengers(); + { + go->ToMotionTransport()->UnloadNonStaticPassengers(); go->AddObjectToRemoveList(); - } + } return true; } @@ -522,16 +522,16 @@ class npc_gunship : public CreatureScript { npc_gunshipAI(Creature* creature) : NullCreatureAI(creature), _instance(creature->GetInstanceScript()), _teamIdInInstance(TeamId(creature->GetInstanceScript()->GetData(DATA_TEAMID_IN_INSTANCE))), _died(false), _summonedFirstMage(false) { - me->SetRegeneratingHealth(false); + me->SetRegeneratingHealth(false); } void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) { - if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) - { - damage = 0; - return; - } + if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) + { + damage = 0; + return; + } if (damage >= me->GetHealth()) { @@ -554,11 +554,11 @@ class npc_gunship : public CreatureScript captain->AI()->DoAction(ACTION_SPAWN_MAGE); } - void JustDied(Unit* /*killer*/) - { - if (_died || _instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) - return; - _died = true; + void JustDied(Unit* /*killer*/) + { + if (_died || _instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) + return; + _died = true; bool isVictory = me->GetTransport()->GetEntry() == GO_THE_SKYBREAKER_H || me->GetTransport()->GetEntry() == GO_ORGRIMS_HAMMER_A; _instance->SetBossState(DATA_ICECROWN_GUNSHIP_BATTLE, isVictory ? DONE : FAIL); @@ -568,44 +568,44 @@ class npc_gunship : public CreatureScript { _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, creature); if (Aura* a = creature->GetAura(SPELL_CHECK_FOR_PLAYERS)) - a->SetDuration(0); + a->SetDuration(0); } _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); if (Aura* a = me->GetAura(SPELL_CHECK_FOR_PLAYERS)) - a->SetDuration(0); + a->SetDuration(0); - uint32 explosionSpell = isVictory ? SPELL_EXPLOSION_VICTORY : SPELL_EXPLOSION_WIPE; - if (MotionTransport* t = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : NULL)) - { - Transport::PassengerSet const& passengers = t->GetStaticPassengers(); - for (Transport::PassengerSet::const_iterator itr = passengers.begin(); itr != passengers.end(); ++itr) - { - if ((*itr)->GetTypeId() != TYPEID_UNIT || (*itr)->GetEntry() != NPC_GUNSHIP_HULL) - continue; - (*itr)->ToCreature()->CastSpell((*itr)->ToCreature(), explosionSpell, true); - } - } + uint32 explosionSpell = isVictory ? SPELL_EXPLOSION_VICTORY : SPELL_EXPLOSION_WIPE; + if (MotionTransport* t = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : NULL)) + { + Transport::PassengerSet const& passengers = t->GetStaticPassengers(); + for (Transport::PassengerSet::const_iterator itr = passengers.begin(); itr != passengers.end(); ++itr) + { + if ((*itr)->GetTypeId() != TYPEID_UNIT || (*itr)->GetEntry() != NPC_GUNSHIP_HULL) + continue; + (*itr)->ToCreature()->CastSpell((*itr)->ToCreature(), explosionSpell, true); + } + } - uint32 cannonEntry = _teamIdInInstance == TEAM_HORDE ? NPC_HORDE_GUNSHIP_CANNON : NPC_ALLIANCE_GUNSHIP_CANNON; - if (GameObject* go = _instance->instance->GetGameObject(_instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE))) - if (MotionTransport* t = go->ToMotionTransport()) - { - Transport::PassengerSet const& passengers = t->GetStaticPassengers(); - for (Transport::PassengerSet::const_iterator itr = passengers.begin(); itr != passengers.end(); ++itr) - { - if ((*itr)->GetTypeId() != TYPEID_UNIT || (*itr)->GetEntry() != cannonEntry) - continue; - Creature* cannon = (*itr)->ToCreature(); - cannon->CastSpell(cannon, SPELL_EJECT_ALL_PASSENGERS, true); + uint32 cannonEntry = _teamIdInInstance == TEAM_HORDE ? NPC_HORDE_GUNSHIP_CANNON : NPC_ALLIANCE_GUNSHIP_CANNON; + if (GameObject* go = _instance->instance->GetGameObject(_instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE))) + if (MotionTransport* t = go->ToMotionTransport()) + { + Transport::PassengerSet const& passengers = t->GetStaticPassengers(); + for (Transport::PassengerSet::const_iterator itr = passengers.begin(); itr != passengers.end(); ++itr) + { + if ((*itr)->GetTypeId() != TYPEID_UNIT || (*itr)->GetEntry() != cannonEntry) + continue; + Creature* cannon = (*itr)->ToCreature(); + cannon->CastSpell(cannon, SPELL_EJECT_ALL_PASSENGERS, true); - WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, cannon->GetPackGUID().size() + 4); - data.append(cannon->GetPackGUID()); - data << uint32(0); - cannon->SendMessageToSet(&data, true); + WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, cannon->GetPackGUID().size() + 4); + data.append(cannon->GetPackGUID()); + data << uint32(0); + cannon->SendMessageToSet(&data, true); - cannon->RemoveVehicleKit(); - } - } + cannon->RemoveVehicleKit(); + } + } uint32 creatureEntry = NPC_IGB_MURADIN_BRONZEBEARD; uint8 textId = isVictory ? SAY_MURADIN_VICTORY : SAY_MURADIN_WIPE; @@ -623,7 +623,7 @@ class npc_gunship : public CreatureScript if (MotionTransport* otherTransport = go->ToMotionTransport()) otherTransport->EnableMovement(true); - me->GetTransport()->ToMotionTransport()->EnableMovement(true); + me->GetTransport()->ToMotionTransport()->EnableMovement(true); if (Creature* ship = me->FindNearestCreature(_teamIdInInstance == TEAM_HORDE ? NPC_ORGRIMS_HAMMER : NPC_THE_SKYBREAKER, 200.0f)) { @@ -632,27 +632,27 @@ class npc_gunship : public CreatureScript ship->CastSpell(ship, SPELL_AWARD_REPUTATION_BOSS_KILL, true); } - for (uint8 i=0; i<2; ++i) - if (GameObject* go = _instance->instance->GetGameObject(_instance->GetData64(i == 0 ? DATA_ICECROWN_GUNSHIP_BATTLE : DATA_ENEMY_GUNSHIP))) - if (MotionTransport* t = go->ToMotionTransport()) - { - Transport::PassengerSet const& passengers = t->GetPassengers(); - for (Transport::PassengerSet::const_iterator itr = passengers.begin(); itr != passengers.end(); ++itr) - { - if ((*itr)->GetTypeId() != TYPEID_UNIT) - continue; - Creature* c = (*itr)->ToCreature(); - if (c->GetEntry() == NPC_SKYBREAKER_MARINE || c->GetEntry() == NPC_SKYBREAKER_SERGEANT || c->GetEntry() == NPC_KOR_KRON_REAVER || c->GetEntry() == NPC_KOR_KRON_SERGEANT) - c->DespawnOrUnsummon(1); - } - } + for (uint8 i=0; i<2; ++i) + if (GameObject* go = _instance->instance->GetGameObject(_instance->GetData64(i == 0 ? DATA_ICECROWN_GUNSHIP_BATTLE : DATA_ENEMY_GUNSHIP))) + if (MotionTransport* t = go->ToMotionTransport()) + { + Transport::PassengerSet const& passengers = t->GetPassengers(); + for (Transport::PassengerSet::const_iterator itr = passengers.begin(); itr != passengers.end(); ++itr) + { + if ((*itr)->GetTypeId() != TYPEID_UNIT) + continue; + Creature* c = (*itr)->ToCreature(); + if (c->GetEntry() == NPC_SKYBREAKER_MARINE || c->GetEntry() == NPC_SKYBREAKER_SERGEANT || c->GetEntry() == NPC_KOR_KRON_REAVER || c->GetEntry() == NPC_KOR_KRON_SERGEANT) + c->DespawnOrUnsummon(1); + } + } } else { uint32 teleportSpellId = _teamIdInInstance == TEAM_HORDE ? SPELL_TELEPORT_PLAYERS_ON_RESET_H : SPELL_TELEPORT_PLAYERS_ON_RESET_A; me->m_Events.AddEvent(new ResetEncounterEvent(me, teleportSpellId, _instance->GetData64(DATA_ENEMY_GUNSHIP)), me->m_Events.CalculateTime(8000)); } - } + } void SetGUID(uint64 guid, int32 id/* = 0*/) { @@ -661,32 +661,32 @@ class npc_gunship : public CreatureScript std::map::iterator itr = _shipVisits.find(guid); if (itr == _shipVisits.end()) - { - if (id == ACTION_SHIP_VISITS_ENEMY) - _shipVisits[guid] = ACTION_SHIP_VISITS_ENEMY; - } + { + if (id == ACTION_SHIP_VISITS_ENEMY) + _shipVisits[guid] = ACTION_SHIP_VISITS_ENEMY; + } else if (itr->second) // if 0 then achiev already failed - { - if (id == ACTION_SHIP_VISITS_SELF) - { - if (itr->second == ACTION_SHIP_VISITS_ENEMY) - itr->second = ACTION_SHIP_VISITS_SELF; - else if (itr->second == ACTION_SHIP_VISITS_ENEMY_2) - itr->second = ACTION_SHIP_VISITS_SELF_2; - } - else - { - if (itr->second == ACTION_SHIP_VISITS_SELF) - { - if (me->GetMap()->Is25ManRaid()) - itr->second = 0; - else - itr->second = ACTION_SHIP_VISITS_ENEMY_2; - } - else if (itr->second == ACTION_SHIP_VISITS_SELF_2) - itr->second = 0; - } - } + { + if (id == ACTION_SHIP_VISITS_SELF) + { + if (itr->second == ACTION_SHIP_VISITS_ENEMY) + itr->second = ACTION_SHIP_VISITS_SELF; + else if (itr->second == ACTION_SHIP_VISITS_ENEMY_2) + itr->second = ACTION_SHIP_VISITS_SELF_2; + } + else + { + if (itr->second == ACTION_SHIP_VISITS_SELF) + { + if (me->GetMap()->Is25ManRaid()) + itr->second = 0; + else + itr->second = ACTION_SHIP_VISITS_ENEMY_2; + } + else if (itr->second == ACTION_SHIP_VISITS_SELF_2) + itr->second = 0; + } + } } uint32 GetData(uint32 id) const @@ -696,18 +696,18 @@ class npc_gunship : public CreatureScript for (std::map::const_iterator itr = _shipVisits.begin(); itr != _shipVisits.end(); ++itr) if (itr->second == 0) - return 0; + return 0; return 1; } private: - InstanceScript* _instance; + InstanceScript* _instance; TeamId _teamIdInInstance; std::map _shipVisits; bool _died; - bool _summonedFirstMage; - }; + bool _summonedFirstMage; + }; CreatureAI* GetAI(Creature* creature) const { @@ -728,21 +728,21 @@ class npc_high_overlord_saurfang_igb : public CreatureScript npc_high_overlord_saurfang_igbAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { _events.Reset(); - _controller.ResetSlots(TEAM_HORDE, creature->GetTransport()->ToMotionTransport()); - me->SetRegeneratingHealth(false); + _controller.ResetSlots(TEAM_HORDE, creature->GetTransport()->ToMotionTransport()); + me->SetRegeneratingHealth(false); me->m_CombatDistance = 70.0f; _firstMageCooldown = time(NULL) + 45; _axethrowersYellCooldown = time_t(0); _rocketeersYellCooldown = time_t(0); - checkTimer = 1000; + checkTimer = 1000; } void sGossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) { - if (!me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - return; + if (!me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return; me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->GetTransport()->setActive(true); + me->GetTransport()->setActive(true); me->GetTransport()->ToMotionTransport()->EnableMovement(true); _events.ScheduleEvent(EVENT_INTRO_H_1, 5000); _events.ScheduleEvent(EVENT_INTRO_H_2, 16000); @@ -753,11 +753,11 @@ class npc_high_overlord_saurfang_igb : public CreatureScript void EnterCombat(Unit* /*target*/) { - if (_instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE && !me->HasAura(SPELL_FRIENDLY_BOSS_DAMAGE_MOD)) - me->CastSpell(me, SPELL_FRIENDLY_BOSS_DAMAGE_MOD, true); - if (!me->HasAura(SPELL_BATTLE_FURY)) - me->CastSpell(me, SPELL_BATTLE_FURY, true); - _events.CancelEvent(EVENT_CLEAVE); + if (_instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE && !me->HasAura(SPELL_FRIENDLY_BOSS_DAMAGE_MOD)) + me->CastSpell(me, SPELL_FRIENDLY_BOSS_DAMAGE_MOD, true); + if (!me->HasAura(SPELL_BATTLE_FURY)) + me->CastSpell(me, SPELL_BATTLE_FURY, true); + _events.CancelEvent(EVENT_CLEAVE); _events.ScheduleEvent(EVENT_CLEAVE, urand(3000, 6000)); } @@ -818,22 +818,22 @@ class npc_high_overlord_saurfang_igb : public CreatureScript } else if (action == ACTION_EXIT_SHIP) { - G3D::Vector3 points[SaurfangExitPathSize]; - for (uint8 i=0; iSetWalk(true); + me->SetWalk(true); Movement::MoveSplineInit init(me); init.DisableTransportPathTransformations(); init.MovebyPath(path, 0); init.Launch(); me->DespawnOrUnsummon(18000); } - } + } void SetData(uint32 type, uint32 data) { @@ -856,50 +856,50 @@ class npc_high_overlord_saurfang_igb : public CreatureScript void UpdateAI(uint32 diff) { - if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS) - { - if (me->GetVictim()) - { - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - { - if (me->GetVictim()->GetPositionZ() >= 478.0f) - { - float x,y,z,o; - me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(0, x, y, z, false); - } - } - else - { - if (me->GetVictim()->GetPositionZ() < 478.0f) - me->GetMotionMaster()->MoveChase(me->GetVictim()); - } - } + if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS) + { + if (me->GetVictim()) + { + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) + { + if (me->GetVictim()->GetPositionZ() >= 478.0f) + { + float x,y,z,o; + me->GetHomePosition(x, y, z, o); + me->GetMotionMaster()->MovePoint(0, x, y, z, false); + } + } + else + { + if (me->GetVictim()->GetPositionZ() < 478.0f) + me->GetMotionMaster()->MoveChase(me->GetVictim()); + } + } - if (checkTimer <= diff) - { - checkTimer = 1000; - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (CanAIAttack(p) && me->IsValidAttackTarget(p)) - { - me->SetInCombatWith(p); - p->SetInCombatWith(me); - me->AddThreat(p, 0.0f); - } - } - else - checkTimer -= diff; - } + if (checkTimer <= diff) + { + checkTimer = 1000; + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (CanAIAttack(p) && me->IsValidAttackTarget(p)) + { + me->SetInCombatWith(p); + p->SetInCombatWith(me); + me->AddThreat(p, 0.0f); + } + } + else + checkTimer -= diff; + } UpdateVictim(); _events.Update(diff); switch (_events.ExecuteEvent()) { - case 0: - break; + case 0: + break; case EVENT_INTRO_H_1: Talk(SAY_SAURFANG_INTRO_1); break; @@ -926,11 +926,11 @@ class npc_high_overlord_saurfang_igb : public CreatureScript if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS) { //_instance->DoCastSpellOnPlayers(SPELL_LOCK_PLAYERS_AND_TAP_CHEST); - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (!p->IsGameMaster()) - p->SetInCombatState(true); + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (!p->IsGameMaster()) + p->SetInCombatState(true); _events.ScheduleEvent(EVENT_KEEP_PLAYER_IN_COMBAT, 4000); } break; @@ -944,22 +944,22 @@ class npc_high_overlord_saurfang_igb : public CreatureScript _controller.SummonCreatures(me, SLOT_MAGE_1, SLOT_MAGE_2); _controller.SummonCreatures(me, SLOT_MARINE_1, Is25ManRaid() ? SLOT_MARINE_4 : SLOT_MARINE_2); _controller.SummonCreatures(me, SLOT_SERGEANT_1, Is25ManRaid() ? SLOT_SERGEANT_2 : SLOT_SERGEANT_1); - if (MotionTransport* orgrimsHammer = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : NULL)) - { - float x,y,z,o; - OrgrimsHammerTeleportPortal.GetPosition(x,y,z,o); - orgrimsHammer->CalculatePassengerPosition(x,y,z,&o); - me->SummonCreature(NPC_TELEPORT_PORTAL, x, y, z, o, TEMPSUMMON_TIMED_DESPAWN, 21000); - } + if (MotionTransport* orgrimsHammer = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : NULL)) + { + float x,y,z,o; + OrgrimsHammerTeleportPortal.GetPosition(x,y,z,o); + orgrimsHammer->CalculatePassengerPosition(x,y,z,&o); + me->SummonCreature(NPC_TELEPORT_PORTAL, x, y, z, o, TEMPSUMMON_TIMED_DESPAWN, 21000); + } if (GameObject* go = HashMapHolder::Find(_instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE))) if (MotionTransport* skybreaker = go->ToMotionTransport()) - { - float x,y,z,o; - SkybreakerTeleportExit.GetPosition(x,y,z,o); - skybreaker->CalculatePassengerPosition(x,y,z,&o); + { + float x,y,z,o; + SkybreakerTeleportExit.GetPosition(x,y,z,o); + skybreaker->CalculatePassengerPosition(x,y,z,&o); me->SummonCreature(NPC_TELEPORT_EXIT, x, y, z, o, TEMPSUMMON_TIMED_DESPAWN, 23000); - } + } _events.ScheduleEvent(EVENT_ADDS_BOARD_YELL, 6000); _events.ScheduleEvent(EVENT_ADDS, 60000); @@ -991,51 +991,51 @@ class npc_high_overlord_saurfang_igb : public CreatureScript _events.ScheduleEvent(EVENT_CHECK_MORTAR, 1500); break; case EVENT_CLEAVE: - if (me->GetVictim()) - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + if (me->GetVictim()) + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); _events.ScheduleEvent(EVENT_CLEAVE, urand(4000, 8000)); break; - default: - break; - } + default: + break; + } - if (!me->GetVictim() || me->HasUnitState(UNIT_STATE_CASTING)) - return; - + if (!me->GetVictim() || me->HasUnitState(UNIT_STATE_CASTING)) + return; + if (me->IsWithinMeleeRange(me->GetVictim())) DoMeleeAttackIfReady(); else if (me->isAttackReady()) { - me->SetOrientation(me->GetAngle(me->GetVictim())); - me->CastSpell(me->GetVictim(), SPELL_RENDING_THROW, false); + me->SetOrientation(me->GetAngle(me->GetVictim())); + me->CastSpell(me->GetVictim(), SPELL_RENDING_THROW, false); me->resetAttackTimer(); } - } + } - void AttackStart(Unit* victim) - { - if (victim && me->Attack(victim, true)) - { - if (victim->GetPositionZ() < 478.0f) - me->GetMotionMaster()->MoveChase(victim); - else - { - float x,y,z,o; - me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(0, x, y, z, false); - } - } - } + void AttackStart(Unit* victim) + { + if (victim && me->Attack(victim, true)) + { + if (victim->GetPositionZ() < 478.0f) + me->GetMotionMaster()->MoveChase(victim); + else + { + float x,y,z,o; + me->GetHomePosition(x, y, z, o); + me->GetMotionMaster()->MovePoint(0, x, y, z, false); + } + } + } - bool CanAIAttack(const Unit* target) const - { - if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) - return false; - if (target->GetEntry() == NPC_SKYBREAKER_MARINE || target->GetEntry() == NPC_SKYBREAKER_SERGEANT) - return target->ToCreature()->GetReactState() != REACT_PASSIVE; - return target->GetTransport() == me->GetTransport() && target->GetPositionY() < (_instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? 2431.0f : 2025.0f); - } + bool CanAIAttack(const Unit* target) const + { + if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) + return false; + if (target->GetEntry() == NPC_SKYBREAKER_MARINE || target->GetEntry() == NPC_SKYBREAKER_SERGEANT) + return target->ToCreature()->GetReactState() != REACT_PASSIVE; + return target->GetTransport() == me->GetTransport() && target->GetPositionY() < (_instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? 2431.0f : 2025.0f); + } private: EventMap _events; @@ -1044,7 +1044,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript time_t _firstMageCooldown; time_t _axethrowersYellCooldown; time_t _rocketeersYellCooldown; - uint16 checkTimer; + uint16 checkTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -1064,20 +1064,20 @@ class npc_muradin_bronzebeard_igb : public CreatureScript { _events.Reset(); _controller.ResetSlots(TEAM_ALLIANCE, creature->GetTransport()->ToMotionTransport()); - me->SetRegeneratingHealth(false); + me->SetRegeneratingHealth(false); me->m_CombatDistance = 70.0f; _firstMageCooldown = time(NULL) + 45; _riflemanYellCooldown = time_t(0); _mortarYellCooldown = time_t(0); - checkTimer = 1000; + checkTimer = 1000; } void sGossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) { - if (!me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - return; + if (!me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return; me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->GetTransport()->setActive(true); + me->GetTransport()->setActive(true); me->GetTransport()->ToMotionTransport()->EnableMovement(true); _events.ScheduleEvent(EVENT_INTRO_A_1, 5000); _events.ScheduleEvent(EVENT_INTRO_A_2, 10000); @@ -1089,11 +1089,11 @@ class npc_muradin_bronzebeard_igb : public CreatureScript void EnterCombat(Unit* /*target*/) { - if (_instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_ALLIANCE && !me->HasAura(SPELL_FRIENDLY_BOSS_DAMAGE_MOD)) - me->CastSpell(me, SPELL_FRIENDLY_BOSS_DAMAGE_MOD, true); - if (!me->HasAura(SPELL_BATTLE_FURY)) - me->CastSpell(me, SPELL_BATTLE_FURY, true); - _events.CancelEvent(EVENT_CLEAVE); + if (_instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_ALLIANCE && !me->HasAura(SPELL_FRIENDLY_BOSS_DAMAGE_MOD)) + me->CastSpell(me, SPELL_FRIENDLY_BOSS_DAMAGE_MOD, true); + if (!me->HasAura(SPELL_BATTLE_FURY)) + me->CastSpell(me, SPELL_BATTLE_FURY, true); + _events.CancelEvent(EVENT_CLEAVE); _events.ScheduleEvent(EVENT_CLEAVE, urand(3000, 6000)); } @@ -1154,22 +1154,22 @@ class npc_muradin_bronzebeard_igb : public CreatureScript } else if (action == ACTION_EXIT_SHIP) { - G3D::Vector3 points[MuradinExitPathSize]; - for (uint8 i=0; iSetWalk(true); + me->SetWalk(true); Movement::MoveSplineInit init(me); init.DisableTransportPathTransformations(); init.MovebyPath(path, 0); init.Launch(); me->DespawnOrUnsummon(18000); } - } + } void SetData(uint32 type, uint32 data) { @@ -1192,50 +1192,50 @@ class npc_muradin_bronzebeard_igb : public CreatureScript void UpdateAI(uint32 diff) { - if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS) - { - if (me->GetVictim()) - { - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - { - if (me->GetVictim()->GetPositionZ() >= 478.0f) - { - float x,y,z,o; - me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(0, x, y, z, false); - } - } - else - { - if (me->GetVictim()->GetPositionZ() < 478.0f) - me->GetMotionMaster()->MoveChase(me->GetVictim()); - } - } + if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS) + { + if (me->GetVictim()) + { + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) + { + if (me->GetVictim()->GetPositionZ() >= 478.0f) + { + float x,y,z,o; + me->GetHomePosition(x, y, z, o); + me->GetMotionMaster()->MovePoint(0, x, y, z, false); + } + } + else + { + if (me->GetVictim()->GetPositionZ() < 478.0f) + me->GetMotionMaster()->MoveChase(me->GetVictim()); + } + } - if (checkTimer <= diff) - { - checkTimer = 1000; - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (CanAIAttack(p) && me->IsValidAttackTarget(p)) - { - me->SetInCombatWith(p); - p->SetInCombatWith(me); - me->AddThreat(p, 0.0f); - } - } - else - checkTimer -= diff; - } + if (checkTimer <= diff) + { + checkTimer = 1000; + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (CanAIAttack(p) && me->IsValidAttackTarget(p)) + { + me->SetInCombatWith(p); + p->SetInCombatWith(me); + me->AddThreat(p, 0.0f); + } + } + else + checkTimer -= diff; + } UpdateVictim(); _events.Update(diff); switch (_events.ExecuteEvent()) { - case 0: - break; + case 0: + break; case EVENT_INTRO_A_1: Talk(SAY_MURADIN_INTRO_1); break; @@ -1265,11 +1265,11 @@ class npc_muradin_bronzebeard_igb : public CreatureScript if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS) { //_instance->DoCastSpellOnPlayers(SPELL_LOCK_PLAYERS_AND_TAP_CHEST); - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (!p->IsGameMaster()) - p->SetInCombatState(true); + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (!p->IsGameMaster()) + p->SetInCombatState(true); _events.ScheduleEvent(EVENT_KEEP_PLAYER_IN_COMBAT, 4000); } break; @@ -1283,22 +1283,22 @@ class npc_muradin_bronzebeard_igb : public CreatureScript _controller.SummonCreatures(me, SLOT_MAGE_1, SLOT_MAGE_2); _controller.SummonCreatures(me, SLOT_MARINE_1, Is25ManRaid() ? SLOT_MARINE_4 : SLOT_MARINE_2); _controller.SummonCreatures(me, SLOT_SERGEANT_1, Is25ManRaid() ? SLOT_SERGEANT_2 : SLOT_SERGEANT_1); - if (MotionTransport* skybreaker = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : NULL)) - { - float x,y,z,o; - SkybreakerTeleportPortal.GetPosition(x,y,z,o); - skybreaker->CalculatePassengerPosition(x,y,z,&o); - me->SummonCreature(NPC_TELEPORT_PORTAL, x, y, z, o, TEMPSUMMON_TIMED_DESPAWN, 21000); - } + if (MotionTransport* skybreaker = (me->GetTransport() ? me->GetTransport()->ToMotionTransport() : NULL)) + { + float x,y,z,o; + SkybreakerTeleportPortal.GetPosition(x,y,z,o); + skybreaker->CalculatePassengerPosition(x,y,z,&o); + me->SummonCreature(NPC_TELEPORT_PORTAL, x, y, z, o, TEMPSUMMON_TIMED_DESPAWN, 21000); + } if (GameObject* go = HashMapHolder::Find(_instance->GetData64(DATA_ICECROWN_GUNSHIP_BATTLE))) if (MotionTransport* orgrimsHammer = go->ToMotionTransport()) - { - float x,y,z,o; - OrgrimsHammerTeleportExit.GetPosition(x,y,z,o); - orgrimsHammer->CalculatePassengerPosition(x,y,z,&o); + { + float x,y,z,o; + OrgrimsHammerTeleportExit.GetPosition(x,y,z,o); + orgrimsHammer->CalculatePassengerPosition(x,y,z,&o); me->SummonCreature(NPC_TELEPORT_EXIT, x, y, z, o, TEMPSUMMON_TIMED_DESPAWN, 23000); - } + } _events.ScheduleEvent(EVENT_ADDS_BOARD_YELL, 6000); _events.ScheduleEvent(EVENT_ADDS, 60000); @@ -1330,51 +1330,51 @@ class npc_muradin_bronzebeard_igb : public CreatureScript _events.ScheduleEvent(EVENT_CHECK_MORTAR, 1500); break; case EVENT_CLEAVE: - if (me->GetVictim()) - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + if (me->GetVictim()) + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); _events.ScheduleEvent(EVENT_CLEAVE, urand(4000, 8000)); break; - default: - break; - } + default: + break; + } - if (!me->GetVictim() || me->HasUnitState(UNIT_STATE_CASTING)) - return; - + if (!me->GetVictim() || me->HasUnitState(UNIT_STATE_CASTING)) + return; + if (me->IsWithinMeleeRange(me->GetVictim())) DoMeleeAttackIfReady(); else if (me->isAttackReady()) { - me->SetOrientation(me->GetAngle(me->GetVictim())); - me->CastSpell(me->GetVictim(), SPELL_RENDING_THROW, false); + me->SetOrientation(me->GetAngle(me->GetVictim())); + me->CastSpell(me->GetVictim(), SPELL_RENDING_THROW, false); me->resetAttackTimer(); } - } + } - void AttackStart(Unit* victim) - { - if (victim && me->Attack(victim, true)) - { - if (victim->GetPositionZ() < 478.0f) - me->GetMotionMaster()->MoveChase(victim); - else - { - float x,y,z,o; - me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(0, x, y, z, false); - } - } - } + void AttackStart(Unit* victim) + { + if (victim && me->Attack(victim, true)) + { + if (victim->GetPositionZ() < 478.0f) + me->GetMotionMaster()->MoveChase(victim); + else + { + float x,y,z,o; + me->GetHomePosition(x, y, z, o); + me->GetMotionMaster()->MovePoint(0, x, y, z, false); + } + } + } - bool CanAIAttack(const Unit* target) const - { - if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) - return false; - if (target->GetEntry() == NPC_KOR_KRON_REAVER || target->GetEntry() == NPC_KOR_KRON_SERGEANT) - return target->ToCreature()->GetReactState() != REACT_PASSIVE; - return target->GetTransport() == me->GetTransport() && target->GetPositionY() > (_instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_ALLIANCE ? 2042.0f : 2445.0f); - } + bool CanAIAttack(const Unit* target) const + { + if (_instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) + return false; + if (target->GetEntry() == NPC_KOR_KRON_REAVER || target->GetEntry() == NPC_KOR_KRON_SERGEANT) + return target->ToCreature()->GetReactState() != REACT_PASSIVE; + return target->GetTransport() == me->GetTransport() && target->GetPositionY() > (_instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_ALLIANCE ? 2042.0f : 2445.0f); + } private: EventMap _events; @@ -1383,7 +1383,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript time_t _firstMageCooldown; time_t _riflemanYellCooldown; time_t _mortarYellCooldown; - uint16 checkTimer; + uint16 checkTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -1424,14 +1424,14 @@ class npc_igb_ship_crew : public CreatureScript struct npc_igb_ship_crewAI : public ScriptedAI { - npc_igb_ship_crewAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) {} + npc_igb_ship_crewAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) {} - bool CanAIAttack(const Unit* target) const - { - return _instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS && target->GetTransport() == me->GetTransport() && target->GetPositionZ() < 478.0f && (me->GetEntry() == NPC_SKYBREAKER_DECKHAND ? (target->GetPositionY()>2042.0f) : (target->GetPositionY()<2431.0f)); - } - private: - InstanceScript* _instance; + bool CanAIAttack(const Unit* target) const + { + return _instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS && target->GetTransport() == me->GetTransport() && target->GetPositionZ() < 478.0f && (me->GetEntry() == NPC_SKYBREAKER_DECKHAND ? (target->GetPositionY()>2042.0f) : (target->GetPositionY()<2431.0f)); + } + private: + InstanceScript* _instance; }; CreatureAI* GetAI(Creature* creature) const @@ -1442,13 +1442,13 @@ class npc_igb_ship_crew : public CreatureScript void TriggerBurningPitch(Creature* c) { - InstanceScript* i = c->GetInstanceScript(); - uint32 spellId = i->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? SPELL_BURNING_PITCH_A : SPELL_BURNING_PITCH_H; - if (!c->HasSpellCooldown(spellId)) - { - c->CastSpell((Unit*)NULL, spellId, false); - c->_AddCreatureSpellCooldown(spellId, urand(3000, 4000)); - } + InstanceScript* i = c->GetInstanceScript(); + uint32 spellId = i->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? SPELL_BURNING_PITCH_A : SPELL_BURNING_PITCH_H; + if (!c->HasSpellCooldown(spellId)) + { + c->CastSpell((Unit*)NULL, spellId, false); + c->_AddCreatureSpellCooldown(spellId, urand(3000, 4000)); + } } struct gunship_npc_AI : public ScriptedAI @@ -1480,7 +1480,7 @@ struct gunship_npc_AI : public ScriptedAI me->DeleteThreatList(); me->CombatStop(true); me->GetMotionMaster()->MoveTargetedHome(); - Reset(); + Reset(); } void JustDied(Unit* /*killer*/) @@ -1517,10 +1517,10 @@ struct npc_gunship_boarding_addAI : public ScriptedAI { npc_gunship_boarding_addAI(Creature* creature) : ScriptedAI(creature), Instance(creature->GetInstanceScript()), Slot(NULL), Index(uint32(-1)) { - anyValid = true; - checkTimer = 1000; + anyValid = true; + checkTimer = 1000; _usedDesperateResolve = false; - me->m_CombatDistance = 70.0f; + me->m_CombatDistance = 70.0f; me->SetRegeneratingHealth(false); } @@ -1541,7 +1541,7 @@ struct npc_gunship_boarding_addAI : public ScriptedAI me->DeleteThreatList(); me->CombatStop(true); me->GetMotionMaster()->MoveTargetedHome(); - Reset(); + Reset(); } void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) @@ -1555,7 +1555,7 @@ struct npc_gunship_boarding_addAI : public ScriptedAI } void MovementInform(uint32 type, uint32 pointId) - { + { if (type == POINT_MOTION_TYPE && pointId == EVENT_CHARGE_PREPATH && Slot) { me->SetFacingTo(Slot->TargetPosition.GetOrientation()); @@ -1587,31 +1587,31 @@ struct npc_gunship_boarding_addAI : public ScriptedAI } } - void UpdateAI(uint32 diff) - { - if (checkTimer <= diff) - { - checkTimer = 1000; - anyValid = false; - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (CanAIAttack(p) && me->IsValidAttackTarget(p)) - { - anyValid = true; - me->SetInCombatWith(p); - p->SetInCombatWith(me); - me->AddThreat(p, 0.0f); - } - } - else - checkTimer -= diff; - } + void UpdateAI(uint32 diff) + { + if (checkTimer <= diff) + { + checkTimer = 1000; + anyValid = false; + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (CanAIAttack(p) && me->IsValidAttackTarget(p)) + { + anyValid = true; + me->SetInCombatWith(p); + p->SetInCombatWith(me); + me->AddThreat(p, 0.0f); + } + } + else + checkTimer -= diff; + } - bool CanAIAttack(const Unit* target) const - { - return Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS && target->GetTransport() && target->GetTransport() != me->GetTransport() && target->GetPositionZ() < 478.0f && (me->GetEntry() == NPC_SKYBREAKER_SERGEANT || me->GetEntry() == NPC_SKYBREAKER_MARINE ? (target->GetPositionY()<2431.0f) : (target->GetPositionY()>2042.0f)); - } + bool CanAIAttack(const Unit* target) const + { + return Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS && target->GetTransport() && target->GetTransport() != me->GetTransport() && target->GetPositionZ() < 478.0f && (me->GetEntry() == NPC_SKYBREAKER_SERGEANT || me->GetEntry() == NPC_SKYBREAKER_MARINE ? (target->GetPositionY()<2431.0f) : (target->GetPositionY()>2042.0f)); + } protected: void SetSlotInfo(uint32 index) @@ -1620,9 +1620,9 @@ protected: Slot = &((Instance->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? SkybreakerSlotInfo : OrgrimsHammerSlotInfo)[Index]); } - bool anyValid; - uint16 checkTimer; - bool _usedDesperateResolve; + bool anyValid; + uint16 checkTimer; + bool _usedDesperateResolve; InstanceScript* Instance; SlotInfo const* Slot; uint32 Index; @@ -1636,51 +1636,51 @@ class npc_gunship_boarding_leader : public CreatureScript struct npc_gunship_boarding_leaderAI : public npc_gunship_boarding_addAI { npc_gunship_boarding_leaderAI(Creature* creature) : npc_gunship_boarding_addAI(creature) - { - } + { + } void EnterCombat(Unit* target) { - _events.Reset(); + _events.Reset(); _events.ScheduleEvent(EVENT_BLADESTORM, urand(13000, 18000)); _events.ScheduleEvent(EVENT_WOUNDING_STRIKE, urand(5000, 10000)); } - void UpdateAI(uint32 diff) - { - if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) - return; - if (me->GetReactState() == REACT_PASSIVE) - return; - npc_gunship_boarding_addAI::UpdateAI(diff); - _events.Update(diff); - UpdateVictim(); + void UpdateAI(uint32 diff) + { + if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) + return; + if (me->GetReactState() == REACT_PASSIVE) + return; + npc_gunship_boarding_addAI::UpdateAI(diff); + _events.Update(diff); + UpdateVictim(); if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasAura(SPELL_BLADESTORM)) return; - if (!anyValid) - { - TriggerBurningPitch(me); - return; - } - if (!me->GetVictim()) - return; + if (!anyValid) + { + TriggerBurningPitch(me); + return; + } + if (!me->GetVictim()) + return; switch (_events.ExecuteEvent()) { - case 0: - break; + case 0: + break; case EVENT_BLADESTORM: - me->CastSpell(me->GetVictim(), SPELL_BLADESTORM, false); + me->CastSpell(me->GetVictim(), SPELL_BLADESTORM, false); _events.ScheduleEvent(EVENT_BLADESTORM, urand(25000, 30000)); break; case EVENT_WOUNDING_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_WOUNDING_STRIKE, false); + me->CastSpell(me->GetVictim(), SPELL_WOUNDING_STRIKE, false); _events.ScheduleEvent(EVENT_WOUNDING_STRIKE, urand(7000, 13000)); break; default: break; } DoMeleeAttackIfReady(); - } + } private: EventMap _events; @@ -1700,29 +1700,29 @@ class npc_gunship_boarding_add : public CreatureScript struct npc_gunship_boarding_add_realAI : public npc_gunship_boarding_addAI { npc_gunship_boarding_add_realAI(Creature* creature) : npc_gunship_boarding_addAI(creature) - { - } + { + } - void UpdateAI(uint32 diff) - { - if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) - return; - if (me->GetReactState() == REACT_PASSIVE) - return; - npc_gunship_boarding_addAI::UpdateAI(diff); - _events.Update(diff); - UpdateVictim(); + void UpdateAI(uint32 diff) + { + if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) + return; + if (me->GetReactState() == REACT_PASSIVE) + return; + npc_gunship_boarding_addAI::UpdateAI(diff); + _events.Update(diff); + UpdateVictim(); if (me->HasUnitState(UNIT_STATE_CASTING)) return; - if (!anyValid) - { - TriggerBurningPitch(me); - return; - } - if (!me->GetVictim()) - return; + if (!anyValid) + { + TriggerBurningPitch(me); + return; + } + if (!me->GetVictim()) + return; DoMeleeAttackIfReady(); - } + } private: EventMap _events; @@ -1742,9 +1742,9 @@ class npc_gunship_mage : public CreatureScript struct npc_gunship_mageAI : public gunship_npc_AI { npc_gunship_mageAI(Creature* creature) : gunship_npc_AI(creature) - { - me->m_CombatDistance = 70.0f; - } + { + me->m_CombatDistance = 70.0f; + } void AttackStart(Unit* target) { @@ -1755,7 +1755,7 @@ class npc_gunship_mage : public CreatureScript { if (type == POINT_MOTION_TYPE && pointId == EVENT_CHARGE_PREPATH && Slot) { - me->SetFacingTo(Slot->TargetPosition.GetOrientation()); + me->SetFacingTo(Slot->TargetPosition.GetOrientation()); switch (Index) { case SLOT_FREEZE_MAGE: @@ -1763,7 +1763,7 @@ class npc_gunship_mage : public CreatureScript break; case SLOT_MAGE_1: case SLOT_MAGE_2: - me->CastSpell((Unit*)NULL, SPELL_SHADOW_CHANNELING, false); + me->CastSpell((Unit*)NULL, SPELL_SHADOW_CHANNELING, false); break; default: break; @@ -1773,19 +1773,19 @@ class npc_gunship_mage : public CreatureScript } } - void UpdateAI(uint32 diff) - { - if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) - return; - if (me->GetReactState() == REACT_PASSIVE) - return; - gunship_npc_AI::UpdateAI(diff); - } + void UpdateAI(uint32 diff) + { + if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) + return; + if (me->GetReactState() == REACT_PASSIVE) + return; + gunship_npc_AI::UpdateAI(diff); + } - bool CanAIAttack(const Unit* target) const - { - return Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS; - } + bool CanAIAttack(const Unit* target) const + { + return Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS; + } }; CreatureAI* GetAI(Creature* creature) const @@ -1803,8 +1803,8 @@ class npc_gunship_gunner : public CreatureScript { npc_gunship_gunnerAI(Creature* creature) : gunship_npc_AI(creature) { - anyValid = true; - checkTimer = 1000; + anyValid = true; + checkTimer = 1000; creature->m_CombatDistance = 150.0f; } @@ -1822,48 +1822,48 @@ class npc_gunship_gunner : public CreatureScript void UpdateAI(uint32 diff) { - if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) - return; - if (me->GetReactState() == REACT_PASSIVE) - return; - if (checkTimer <= diff) - { - checkTimer = 1000; - anyValid = false; - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (CanAIAttack(p) && me->IsValidAttackTarget(p)) - { - anyValid = true; - me->SetInCombatWith(p); - p->SetInCombatWith(me); - me->AddThreat(p, 0.0f); - } - } - else - checkTimer -= diff; - UpdateVictim(); + if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) + return; + if (me->GetReactState() == REACT_PASSIVE) + return; + if (checkTimer <= diff) + { + checkTimer = 1000; + anyValid = false; + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (CanAIAttack(p) && me->IsValidAttackTarget(p)) + { + anyValid = true; + me->SetInCombatWith(p); + p->SetInCombatWith(me); + me->AddThreat(p, 0.0f); + } + } + else + checkTimer -= diff; + UpdateVictim(); if (me->HasUnitState(UNIT_STATE_CASTING)) return; - if (!anyValid) - { - TriggerBurningPitch(me); - return; - } - if (!me->GetVictim()) - return; + if (!anyValid) + { + TriggerBurningPitch(me); + return; + } + if (!me->GetVictim()) + return; DoSpellAttackIfReady(me->GetEntry() == NPC_SKYBREAKER_RIFLEMAN ? SPELL_SHOOT : SPELL_HURL_AXE); } - bool CanAIAttack(const Unit* target) const - { - return Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS && target->GetTransport() && target->GetTransport() != me->GetTransport(); - } + bool CanAIAttack(const Unit* target) const + { + return Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS && target->GetTransport() && target->GetTransport() != me->GetTransport(); + } - protected: - bool anyValid; - uint16 checkTimer; + protected: + bool anyValid; + uint16 checkTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -1893,10 +1893,10 @@ class npc_gunship_rocketeer : public CreatureScript void UpdateAI(uint32 /*diff*/) { - if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) - return; - if (me->GetReactState() == REACT_PASSIVE) - return; + if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != IN_PROGRESS) + return; + if (me->GetReactState() == REACT_PASSIVE) + return; UpdateVictim(); @@ -1911,10 +1911,10 @@ class npc_gunship_rocketeer : public CreatureScript me->_AddCreatureSpellCooldown(spellId, 9000); } - bool CanAIAttack(const Unit* target) const - { - return Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS; - } + bool CanAIAttack(const Unit* target) const + { + return Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS; + } }; CreatureAI* GetAI(Creature* creature) const @@ -2120,9 +2120,9 @@ class spell_igb_gunship_fall_teleport : public SpellScriptLoader void RelocateDest(SpellEffIndex /*effIndex*/) { - Position offset = {0.0f, 0.0f, 0.0f, 0.0f}; - offset.m_positionZ = GetCaster()->GetInstanceScript()->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? 36.0f : 21.0f; - GetHitDest()->RelocateOffset(offset); + Position offset = {0.0f, 0.0f, 0.0f, 0.0f}; + offset.m_positionZ = GetCaster()->GetInstanceScript()->GetData(DATA_TEAMID_IN_INSTANCE) == TEAM_HORDE ? 36.0f : 21.0f; + GetHitDest()->RelocateOffset(offset); } void Register() @@ -2140,51 +2140,51 @@ class spell_igb_gunship_fall_teleport : public SpellScriptLoader class spell_igb_explosion_main : public SpellScriptLoader { - public: - spell_igb_explosion_main() : SpellScriptLoader("spell_igb_explosion_main") { } + public: + spell_igb_explosion_main() : SpellScriptLoader("spell_igb_explosion_main") { } - class spell_igb_explosion_main_AuraScript : public AuraScript - { - PrepareAuraScript(spell_igb_explosion_main_AuraScript); + class spell_igb_explosion_main_AuraScript : public AuraScript + { + PrepareAuraScript(spell_igb_explosion_main_AuraScript); - bool Load() - { - tickNo = urand(0,3); - return true; - } + bool Load() + { + tickNo = urand(0,3); + return true; + } - void PeriodicTick(AuraEffect const* aurEff) - { - if ((aurEff->GetTickNumber() % 4) != tickNo) - PreventDefaultAction(); - } + void PeriodicTick(AuraEffect const* aurEff) + { + if ((aurEff->GetTickNumber() % 4) != tickNo) + PreventDefaultAction(); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_igb_explosion_main_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_igb_explosion_main_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } - uint32 tickNo; - }; + uint32 tickNo; + }; - AuraScript* GetAuraScript() const - { - return new spell_igb_explosion_main_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_igb_explosion_main_AuraScript(); + } }; class IgbExplosionCheck { - public: - IgbExplosionCheck(Unit* source) : _source(source) {} + public: + IgbExplosionCheck(Unit* source) : _source(source) {} - bool operator()(WorldObject* unit) - { - return unit->GetTransport() != _source->GetTransport(); - } + bool operator()(WorldObject* unit) + { + return unit->GetTransport() != _source->GetTransport(); + } - private: - Unit* _source; + private: + Unit* _source; }; class spell_igb_explosion : public SpellScriptLoader @@ -2199,7 +2199,7 @@ class spell_igb_explosion : public SpellScriptLoader void SelectTarget(std::list& targets) { targets.remove_if(IgbExplosionCheck(GetCaster())); - Trinity::Containers::RandomResizeList(targets, 1); + Trinity::Containers::RandomResizeList(targets, 1); } void Register() @@ -2216,16 +2216,16 @@ class spell_igb_explosion : public SpellScriptLoader class IgbTeleportOnVictoryCheck { - public: - IgbTeleportOnVictoryCheck(InstanceScript* inst) : _inst(inst) {} + public: + IgbTeleportOnVictoryCheck(InstanceScript* inst) : _inst(inst) {} - bool operator()(WorldObject* unit) - { - return unit->GetTransGUID() != _inst->GetData64(DATA_ENEMY_GUNSHIP); - } + bool operator()(WorldObject* unit) + { + return unit->GetTransGUID() != _inst->GetData64(DATA_ENEMY_GUNSHIP); + } - private: - InstanceScript* _inst; + private: + InstanceScript* _inst; }; class spell_igb_teleport_players_on_victory : public SpellScriptLoader @@ -2401,20 +2401,20 @@ class spell_igb_incinerating_blast : public SpellScriptLoader void CalculateDamage(SpellEffIndex /*effIndex*/) { - PreventHitEffect(EFFECT_0); - const SpellInfo* si = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[0].TriggerSpell); - if (!si) - return; - SpellCastTargets targets; - Position dest; - GetExplTargetDest()->GetPosition(&dest); - targets.SetDst(dest); - CustomSpellValues values; - int32 damage = si->Effects[0].CalcValue() + _energyLeft * _energyLeft * 8; - values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage); - values.AddSpellMod(SPELLVALUE_BASE_POINT1, damage); - values.AddSpellMod(SPELLVALUE_BASE_POINT2, damage); - GetCaster()->CastSpell(targets, si, &values, TRIGGERED_FULL_MASK); + PreventHitEffect(EFFECT_0); + const SpellInfo* si = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[0].TriggerSpell); + if (!si) + return; + SpellCastTargets targets; + Position dest; + GetExplTargetDest()->GetPosition(&dest); + targets.SetDst(dest); + CustomSpellValues values; + int32 damage = si->Effects[0].CalcValue() + _energyLeft * _energyLeft * 8; + values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage); + values.AddSpellMod(SPELLVALUE_BASE_POINT1, damage); + values.AddSpellMod(SPELLVALUE_BASE_POINT2, damage); + GetCaster()->CastSpell(targets, si, &values, TRIGGERED_FULL_MASK); //SetEffectValue(GetEffectValue() + _energyLeft * _energyLeft * 8); } @@ -2436,18 +2436,18 @@ class spell_igb_incinerating_blast : public SpellScriptLoader class BurningPitchFilterCheck { - public: - BurningPitchFilterCheck(uint32 entry) : _entry(entry) {} + public: + BurningPitchFilterCheck(uint32 entry) : _entry(entry) {} - bool operator()(WorldObject* unit) - { - if (Transport* transport = unit->GetTransport()) - return transport->GetEntry() != _entry; - return true; - } + bool operator()(WorldObject* unit) + { + if (Transport* transport = unit->GetTransport()) + return transport->GetEntry() != _entry; + return true; + } - private: - uint32 _entry; + private: + uint32 _entry; }; class spell_igb_burning_pitch_selector : public SpellScriptLoader @@ -2523,16 +2523,16 @@ class spell_igb_burning_pitch : public SpellScriptLoader class IgbArtilleryCheck { - public: - IgbArtilleryCheck(uint32 entry) : _entry(entry) {} + public: + IgbArtilleryCheck(uint32 entry) : _entry(entry) {} - bool operator()(WorldObject* unit) - { - return unit->GetTypeId() != TYPEID_PLAYER || unit->GetPositionZ() > 478.0f || !unit->GetTransport() || unit->GetTransport()->GetEntry() != _entry || unit->GetMap()->GetHeight(unit->GetPhaseMask(), unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()) < 465.0f; - } + bool operator()(WorldObject* unit) + { + return unit->GetTypeId() != TYPEID_PLAYER || unit->GetPositionZ() > 478.0f || !unit->GetTransport() || unit->GetTransport()->GetEntry() != _entry || unit->GetMap()->GetHeight(unit->GetPhaseMask(), unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()) < 465.0f; + } - private: - uint32 _entry; + private: + uint32 _entry; }; class spell_igb_rocket_artillery : public SpellScriptLoader @@ -2562,7 +2562,7 @@ class spell_igb_rocket_artillery : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetCaster()->CastSpell(GetHitUnit()->GetPositionX(), GetHitUnit()->GetPositionY(), GetHitUnit()->GetMap()->GetHeight(GetCaster()->GetPhaseMask(), GetHitUnit()->GetPositionX(), GetHitUnit()->GetPositionY(), GetHitUnit()->GetPositionZ()), uint32(GetEffectValue()), TRIGGERED_NONE); + GetCaster()->CastSpell(GetHitUnit()->GetPositionX(), GetHitUnit()->GetPositionY(), GetHitUnit()->GetMap()->GetHeight(GetCaster()->GetPhaseMask(), GetHitUnit()->GetPositionX(), GetHitUnit()->GetPositionY(), GetHitUnit()->GetPositionZ()), uint32(GetEffectValue()), TRIGGERED_NONE); } void Register() @@ -2616,7 +2616,7 @@ class spell_igb_below_zero : public SpellScriptLoader void RemovePassengers() { - GetHitUnit()->SetPower(POWER_ENERGY, 0); + GetHitUnit()->SetPower(POWER_ENERGY, 0); GetHitUnit()->CastSpell(GetHitUnit(), SPELL_EJECT_ALL_PASSENGERS, TRIGGERED_FULL_MASK); } @@ -2659,7 +2659,7 @@ class spell_igb_on_gunship_deck : public SpellScriptLoader { bool enemy = GetSpellInfo()->Id == uint32(_teamIdInInstance == TEAM_HORDE ? SPELL_ON_SKYBREAKER_DECK : SPELL_ON_ORGRIMS_HAMMER_DECK); if (Creature* gunship = GetOwner()->FindNearestCreature(_teamIdInInstance == TEAM_HORDE ? NPC_ORGRIMS_HAMMER : NPC_THE_SKYBREAKER, 200.0f)) - gunship->AI()->SetGUID(GetTarget()->GetGUID(), enemy ? ACTION_SHIP_VISITS_ENEMY : ACTION_SHIP_VISITS_SELF); + gunship->AI()->SetGUID(GetTarget()->GetGUID(), enemy ? ACTION_SHIP_VISITS_ENEMY : ACTION_SHIP_VISITS_SELF); } void Register() @@ -2690,33 +2690,33 @@ class achievement_im_on_a_boat : public AchievementCriteriaScript void AddSC_boss_icecrown_gunship_battle() { - new npc_gunship(); + new npc_gunship(); new npc_high_overlord_saurfang_igb(); new npc_muradin_bronzebeard_igb(); new npc_zafod_boombox(); new npc_igb_ship_crew(); - new npc_gunship_boarding_leader(); - new npc_gunship_boarding_add(); - new npc_gunship_mage(); - new npc_gunship_gunner(); - new npc_gunship_rocketeer(); - new spell_igb_rocket_pack(); + new npc_gunship_boarding_leader(); + new npc_gunship_boarding_add(); + new npc_gunship_mage(); + new npc_gunship_gunner(); + new npc_gunship_rocketeer(); + new spell_igb_rocket_pack(); new spell_igb_rocket_pack_useable(); - new spell_igb_teleport_to_enemy_ship(); - new spell_igb_check_for_players(); - new spell_igb_gunship_fall_teleport(); - new spell_igb_explosion_main(); - new spell_igb_explosion(); - new spell_igb_teleport_players_on_victory(); - new spell_igb_periodic_trigger_with_power_cost(); - new spell_igb_overheat(); + new spell_igb_teleport_to_enemy_ship(); + new spell_igb_check_for_players(); + new spell_igb_gunship_fall_teleport(); + new spell_igb_explosion_main(); + new spell_igb_explosion(); + new spell_igb_teleport_players_on_victory(); + new spell_igb_periodic_trigger_with_power_cost(); + new spell_igb_overheat(); new spell_igb_cannon_blast(); new spell_igb_incinerating_blast(); - new spell_igb_burning_pitch_selector(); - new spell_igb_burning_pitch(); - new spell_igb_rocket_artillery(); - new spell_igb_rocket_artillery_explosion(); - new spell_igb_below_zero(); - new spell_igb_on_gunship_deck(); - new achievement_im_on_a_boat(); + new spell_igb_burning_pitch_selector(); + new spell_igb_burning_pitch(); + new spell_igb_rocket_artillery(); + new spell_igb_rocket_artillery_explosion(); + new spell_igb_below_zero(); + new spell_igb_on_gunship_deck(); + new achievement_im_on_a_boat(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index f324e89be..454ddbbde 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -12,155 +12,155 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum ScriptTexts { - // Lady Deathwhisper - SAY_INTRO_1 = 0, - SAY_INTRO_2 = 1, - SAY_INTRO_3 = 2, - SAY_INTRO_4 = 3, - SAY_INTRO_5 = 4, - SAY_INTRO_6 = 5, - SAY_INTRO_7 = 6, - SAY_AGGRO = 7, - SAY_PHASE_2 = 8, - EMOTE_PHASE_2 = 9, - SAY_DOMINATE_MIND = 10, - SAY_DARK_EMPOWERMENT = 11, - SAY_DARK_TRANSFORMATION = 12, - SAY_ANIMATE_DEAD = 13, - SAY_KILL = 14, - SAY_BERSERK = 15, - SAY_DEATH = 16, + // Lady Deathwhisper + SAY_INTRO_1 = 0, + SAY_INTRO_2 = 1, + SAY_INTRO_3 = 2, + SAY_INTRO_4 = 3, + SAY_INTRO_5 = 4, + SAY_INTRO_6 = 5, + SAY_INTRO_7 = 6, + SAY_AGGRO = 7, + SAY_PHASE_2 = 8, + EMOTE_PHASE_2 = 9, + SAY_DOMINATE_MIND = 10, + SAY_DARK_EMPOWERMENT = 11, + SAY_DARK_TRANSFORMATION = 12, + SAY_ANIMATE_DEAD = 13, + SAY_KILL = 14, + SAY_BERSERK = 15, + SAY_DEATH = 16, - // Darnavan - SAY_DARNAVAN_AGGRO = 0, - SAY_DARNAVAN_RESCUED = 1, + // Darnavan + SAY_DARNAVAN_AGGRO = 0, + SAY_DARNAVAN_RESCUED = 1, }; enum Spells { - // Lady Deathwhisper - SPELL_SHADOW_CHANNELING = 43897, // during intro - SPELL_MANA_BARRIER = 70842, - SPELL_DEATH_AND_DECAY = 71001, - SPELL_DOMINATE_MIND_25 = 71289, - SPELL_SHADOW_BOLT = 71254, - SPELL_DARK_MARTYRDOM_T = 70897, - SPELL_DARK_TRANSFORMATION_T = 70895, - SPELL_DARK_EMPOWERMENT_T = 70896, - SPELL_FROSTBOLT = 71420, - SPELL_FROSTBOLT_VOLLEY = 72905, - SPELL_TOUCH_OF_INSIGNIFICANCE = 71204, - SPELL_SUMMON_SHADE = 71363, + // Lady Deathwhisper + SPELL_SHADOW_CHANNELING = 43897, // during intro + SPELL_MANA_BARRIER = 70842, + SPELL_DEATH_AND_DECAY = 71001, + SPELL_DOMINATE_MIND_25 = 71289, + SPELL_SHADOW_BOLT = 71254, + SPELL_DARK_MARTYRDOM_T = 70897, + SPELL_DARK_TRANSFORMATION_T = 70895, + SPELL_DARK_EMPOWERMENT_T = 70896, + SPELL_FROSTBOLT = 71420, + SPELL_FROSTBOLT_VOLLEY = 72905, + SPELL_TOUCH_OF_INSIGNIFICANCE = 71204, + SPELL_SUMMON_SHADE = 71363, - // Fanatics - SPELL_NECROTIC_STRIKE = 70659, - SPELL_SHADOW_CLEAVE = 70670, - SPELL_VAMPIRIC_MIGHT = 70674, - SPELL_DARK_MARTYRDOM_FANATIC = 71236, - SPELL_FANATIC_S_DETERMINATION = 71235, - SPELL_DARK_TRANSFORMATION = 70900, + // Fanatics + SPELL_NECROTIC_STRIKE = 70659, + SPELL_SHADOW_CLEAVE = 70670, + SPELL_VAMPIRIC_MIGHT = 70674, + SPELL_DARK_MARTYRDOM_FANATIC = 71236, + SPELL_FANATIC_S_DETERMINATION = 71235, + SPELL_DARK_TRANSFORMATION = 70900, - // Adherents - SPELL_FROST_FEVER = 67767, - SPELL_DEATHCHILL_BOLT = 70594, - SPELL_DEATHCHILL_BLAST = 70906, - SPELL_CURSE_OF_TORPOR = 71237, - SPELL_SHORUD_OF_THE_OCCULT = 70768, - SPELL_DARK_MARTYRDOM_ADHERENT = 70903, - SPELL_ADHERENT_S_DETERMINATION = 71234, - SPELL_DARK_EMPOWERMENT = 70901, + // Adherents + SPELL_FROST_FEVER = 67767, + SPELL_DEATHCHILL_BOLT = 70594, + SPELL_DEATHCHILL_BLAST = 70906, + SPELL_CURSE_OF_TORPOR = 71237, + SPELL_SHORUD_OF_THE_OCCULT = 70768, + SPELL_DARK_MARTYRDOM_ADHERENT = 70903, + SPELL_ADHERENT_S_DETERMINATION = 71234, + SPELL_DARK_EMPOWERMENT = 70901, - // Vengeful Shade - SPELL_VENGEFUL_BLAST_PASSIVE = 71494, - SPELL_VENGEFUL_BLAST_10N = 71544, - SPELL_VENGEFUL_BLAST_25N = 72010, - SPELL_VENGEFUL_BLAST_10H = 72011, - SPELL_VENGEFUL_BLAST_25H = 72012, + // Vengeful Shade + SPELL_VENGEFUL_BLAST_PASSIVE = 71494, + SPELL_VENGEFUL_BLAST_10N = 71544, + SPELL_VENGEFUL_BLAST_25N = 72010, + SPELL_VENGEFUL_BLAST_10H = 72011, + SPELL_VENGEFUL_BLAST_25H = 72012, - // Darnavan - SPELL_BLADESTORM = 65947, - SPELL_CHARGE = 65927, - SPELL_INTIMIDATING_SHOUT = 65930, - SPELL_MORTAL_STRIKE = 65926, - SPELL_SHATTERING_THROW = 65940, - SPELL_SUNDER_ARMOR = 65936, + // Darnavan + SPELL_BLADESTORM = 65947, + SPELL_CHARGE = 65927, + SPELL_INTIMIDATING_SHOUT = 65930, + SPELL_MORTAL_STRIKE = 65926, + SPELL_SHATTERING_THROW = 65940, + SPELL_SUNDER_ARMOR = 65936, - // misc - SPELL_FULL_HOUSE = 72827, // achievement - SPELL_TELEPORT_VISUAL = 52096, // used by adds + // misc + SPELL_FULL_HOUSE = 72827, // achievement + SPELL_TELEPORT_VISUAL = 52096, // used by adds }; enum EventTypes { - // Lady Deathwhisper: - EVENT_INTRO_2 = 1, - EVENT_INTRO_3, - EVENT_INTRO_4, - EVENT_INTRO_5, - EVENT_INTRO_6, - EVENT_INTRO_7, + // Lady Deathwhisper: + EVENT_INTRO_2 = 1, + EVENT_INTRO_3, + EVENT_INTRO_4, + EVENT_INTRO_5, + EVENT_INTRO_6, + EVENT_INTRO_7, - EVENT_BERSERK, - EVENT_SPELL_DEATH_AND_DECAY, - EVENT_SPELL_DOMINATE_MIND_25, + EVENT_BERSERK, + EVENT_SPELL_DEATH_AND_DECAY, + EVENT_SPELL_DOMINATE_MIND_25, - // Phase 1: - EVENT_SPELL_SHADOW_BOLT, - EVENT_SUMMON_WAVE_P1, - EVENT_REANIMATE_CULTIST, - EVENT_EMPOWER_CULTIST, + // Phase 1: + EVENT_SPELL_SHADOW_BOLT, + EVENT_SUMMON_WAVE_P1, + EVENT_REANIMATE_CULTIST, + EVENT_EMPOWER_CULTIST, - // Phase 2: - EVENT_SPELL_FROSTBOLT, - EVENT_SPELL_FROSTBOLT_VOLLEY, - EVENT_SPELL_TOUCH_OF_INSIGNIFICANCE, - EVENT_SPELL_SUMMON_SHADE, - EVENT_SUMMON_WAVE_P2, + // Phase 2: + EVENT_SPELL_FROSTBOLT, + EVENT_SPELL_FROSTBOLT_VOLLEY, + EVENT_SPELL_TOUCH_OF_INSIGNIFICANCE, + EVENT_SPELL_SUMMON_SHADE, + EVENT_SUMMON_WAVE_P2, - // Shared adds events: - EVENT_SPELL_CULTIST_DARK_MARTYRDOM, - EVENT_CULTIST_DARK_MARTYRDOM_SELF_KILL, + // Shared adds events: + EVENT_SPELL_CULTIST_DARK_MARTYRDOM, + EVENT_CULTIST_DARK_MARTYRDOM_SELF_KILL, - // Cult Fanatic: - EVENT_SPELL_FANATIC_NECROTIC_STRIKE, - EVENT_SPELL_FANATIC_SHADOW_CLEAVE, - EVENT_SPELL_FANATIC_VAMPIRIC_MIGHT, + // Cult Fanatic: + EVENT_SPELL_FANATIC_NECROTIC_STRIKE, + EVENT_SPELL_FANATIC_SHADOW_CLEAVE, + EVENT_SPELL_FANATIC_VAMPIRIC_MIGHT, - // Cult Adherent: - EVENT_SPELL_ADHERENT_FROST_FEVER, - EVENT_SPELL_ADHERENT_DEATHCHILL, - EVENT_SPELL_ADHERENT_CURSE_OF_TORPOR, - EVENT_SPELL_ADHERENT_SHORUD_OF_THE_OCCULT, + // Cult Adherent: + EVENT_SPELL_ADHERENT_FROST_FEVER, + EVENT_SPELL_ADHERENT_DEATHCHILL, + EVENT_SPELL_ADHERENT_CURSE_OF_TORPOR, + EVENT_SPELL_ADHERENT_SHORUD_OF_THE_OCCULT, - // Darnavan: - EVENT_DARNAVAN_BLADESTORM, - EVENT_DARNAVAN_CHARGE, - EVENT_DARNAVAN_INTIMIDATING_SHOUT, - EVENT_DARNAVAN_MORTAL_STRIKE, - EVENT_DARNAVAN_SHATTERING_THROW, - EVENT_DARNAVAN_SUNDER_ARMOR, + // Darnavan: + EVENT_DARNAVAN_BLADESTORM, + EVENT_DARNAVAN_CHARGE, + EVENT_DARNAVAN_INTIMIDATING_SHOUT, + EVENT_DARNAVAN_MORTAL_STRIKE, + EVENT_DARNAVAN_SHATTERING_THROW, + EVENT_DARNAVAN_SUNDER_ARMOR, }; enum Phases { - PHASE_ALL = 0, - PHASE_INTRO = 1, - PHASE_ONE = 2, - PHASE_TWO = 3, + PHASE_ALL = 0, + PHASE_INTRO = 1, + PHASE_ONE = 2, + PHASE_TWO = 3, - PHASE_INTRO_MASK = 1 << (PHASE_INTRO-1), - PHASE_ONE_MASK = 1 << (PHASE_ONE-1), + PHASE_INTRO_MASK = 1 << (PHASE_INTRO-1), + PHASE_ONE_MASK = 1 << (PHASE_ONE-1), }; enum DeprogrammingData { - NPC_DARNAVAN_10 = 38472, - NPC_DARNAVAN_25 = 38485, - NPC_DARNAVAN_CREDIT_10 = 39091, - NPC_DARNAVAN_CREDIT_25 = 39092, + NPC_DARNAVAN_10 = 38472, + NPC_DARNAVAN_25 = 38485, + NPC_DARNAVAN_CREDIT_10 = 39091, + NPC_DARNAVAN_CREDIT_25 = 39092, - ACTION_COMPLETE_QUEST = -384720, - POINT_DESPAWN = 384721, + ACTION_COMPLETE_QUEST = -384720, + POINT_DESPAWN = 384721, }; #define NPC_DARNAVAN RAID_MODE(NPC_DARNAVAN_10, NPC_DARNAVAN_25, NPC_DARNAVAN_10, NPC_DARNAVAN_25) @@ -170,976 +170,976 @@ enum DeprogrammingData uint32 const SummonEntries[2] = {NPC_CULT_FANATIC, NPC_CULT_ADHERENT}; Position const SummonPositions[7] = { - {-578.7066f, 2154.167f, 51.01529f, 1.692969f}, // 1 Left Door 1 (Cult Fanatic) - {-598.9028f, 2155.005f, 51.01530f, 1.692969f}, // 2 Left Door 2 (Cult Adherent) - {-619.2864f, 2154.460f, 51.01530f, 1.692969f}, // 3 Left Door 3 (Cult Fanatic) - {-578.6996f, 2269.856f, 51.01529f, 4.590216f}, // 4 Right Door 1 (Cult Adherent) - {-598.9688f, 2269.264f, 51.01529f, 4.590216f}, // 5 Right Door 2 (Cult Fanatic) - {-619.4323f, 2268.523f, 51.01530f, 4.590216f}, // 6 Right Door 3 (Cult Adherent) - {-524.2480f, 2211.920f, 62.90960f, 3.141592f}, // 7 Upper (Random Cultist) + {-578.7066f, 2154.167f, 51.01529f, 1.692969f}, // 1 Left Door 1 (Cult Fanatic) + {-598.9028f, 2155.005f, 51.01530f, 1.692969f}, // 2 Left Door 2 (Cult Adherent) + {-619.2864f, 2154.460f, 51.01530f, 1.692969f}, // 3 Left Door 3 (Cult Fanatic) + {-578.6996f, 2269.856f, 51.01529f, 4.590216f}, // 4 Right Door 1 (Cult Adherent) + {-598.9688f, 2269.264f, 51.01529f, 4.590216f}, // 5 Right Door 2 (Cult Fanatic) + {-619.4323f, 2268.523f, 51.01530f, 4.590216f}, // 6 Right Door 3 (Cult Adherent) + {-524.2480f, 2211.920f, 62.90960f, 3.141592f}, // 7 Upper (Random Cultist) }; class DaranavanMoveEvent : public BasicEvent { - public: - DaranavanMoveEvent(Creature& darnavan) : _darnavan(darnavan) { } + public: + DaranavanMoveEvent(Creature& darnavan) : _darnavan(darnavan) { } - bool Execute(uint64 /*time*/, uint32 /*diff*/) - { - _darnavan.GetMotionMaster()->MovePoint(POINT_DESPAWN, SummonPositions[6]); - return true; - } + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _darnavan.GetMotionMaster()->MovePoint(POINT_DESPAWN, SummonPositions[6]); + return true; + } - private: - Creature& _darnavan; + private: + Creature& _darnavan; }; class boss_lady_deathwhisper : public CreatureScript { - public: - boss_lady_deathwhisper() : CreatureScript("boss_lady_deathwhisper") { } + public: + boss_lady_deathwhisper() : CreatureScript("boss_lady_deathwhisper") { } - struct boss_lady_deathwhisperAI : public BossAI - { - boss_lady_deathwhisperAI(Creature* creature) : BossAI(creature, DATA_LADY_DEATHWHISPER), _introDone(false), _darnavanGUID(0) - { - } + struct boss_lady_deathwhisperAI : public BossAI + { + boss_lady_deathwhisperAI(Creature* creature) : BossAI(creature, DATA_LADY_DEATHWHISPER), _introDone(false), _darnavanGUID(0) + { + } - void Reset() - { - if (Creature* darnavan = ObjectAccessor::GetCreature(*me, _darnavanGUID)) - darnavan->DespawnOrUnsummon(); - _darnavanGUID = 0; - _waveCounter = 0; - _reanimationQueue.clear(); - _Reset(); - me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)); - events.SetPhase(PHASE_ONE); - me->CastSpell(me, SPELL_SHADOW_CHANNELING, false); - } + void Reset() + { + if (Creature* darnavan = ObjectAccessor::GetCreature(*me, _darnavanGUID)) + darnavan->DespawnOrUnsummon(); + _darnavanGUID = 0; + _waveCounter = 0; + _reanimationQueue.clear(); + _Reset(); + me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)); + events.SetPhase(PHASE_ONE); + me->CastSpell(me, SPELL_SHADOW_CHANNELING, false); + } - void AttackStart(Unit* victim) - { - if (victim && me->Attack(victim, true) && !(events.GetPhaseMask() & PHASE_ONE_MASK)) - me->GetMotionMaster()->MoveChase(victim); - } + void AttackStart(Unit* victim) + { + if (victim && me->Attack(victim, true) && !(events.GetPhaseMask() & PHASE_ONE_MASK)) + me->GetMotionMaster()->MoveChase(victim); + } - void EnterCombat(Unit* who) - { - if (!instance->CheckRequiredBosses(DATA_LADY_DEATHWHISPER, who->ToPlayer())) - { - EnterEvadeMode(); - instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); - return; - } + void EnterCombat(Unit* who) + { + if (!instance->CheckRequiredBosses(DATA_LADY_DEATHWHISPER, who->ToPlayer())) + { + EnterEvadeMode(); + instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); + return; + } - me->setActive(true); - DoZoneInCombat(); + me->setActive(true); + DoZoneInCombat(); - events.Reset(); - events.SetPhase(PHASE_ONE); - events.ScheduleEvent(EVENT_BERSERK, 600000); - events.ScheduleEvent(EVENT_SPELL_DEATH_AND_DECAY, 10000); - if (GetDifficulty() != RAID_DIFFICULTY_10MAN_NORMAL) - events.ScheduleEvent(EVENT_SPELL_DOMINATE_MIND_25, 27000); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, urand(5500, 6000), 0, PHASE_ONE); - events.ScheduleEvent(EVENT_SUMMON_WAVE_P1, 5000, 0, PHASE_ONE); - events.ScheduleEvent(EVENT_EMPOWER_CULTIST, urand(20000, 30000), 0, PHASE_ONE); + events.Reset(); + events.SetPhase(PHASE_ONE); + events.ScheduleEvent(EVENT_BERSERK, 600000); + events.ScheduleEvent(EVENT_SPELL_DEATH_AND_DECAY, 10000); + if (GetDifficulty() != RAID_DIFFICULTY_10MAN_NORMAL) + events.ScheduleEvent(EVENT_SPELL_DOMINATE_MIND_25, 27000); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, urand(5500, 6000), 0, PHASE_ONE); + events.ScheduleEvent(EVENT_SUMMON_WAVE_P1, 5000, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_EMPOWER_CULTIST, urand(20000, 30000), 0, PHASE_ONE); - Talk(SAY_AGGRO); - me->RemoveAurasDueToSpell(SPELL_SHADOW_CHANNELING); - me->CastSpell(me, SPELL_MANA_BARRIER, true); + Talk(SAY_AGGRO); + me->RemoveAurasDueToSpell(SPELL_SHADOW_CHANNELING); + me->CastSpell(me, SPELL_MANA_BARRIER, true); - instance->SetBossState(DATA_LADY_DEATHWHISPER, IN_PROGRESS); - } + instance->SetBossState(DATA_LADY_DEATHWHISPER, IN_PROGRESS); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (events.GetPhaseMask() & PHASE_ONE_MASK && damage >= me->GetPower(POWER_MANA)) - { - // reset threat - ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList(); - for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) - { - Unit* unit = ObjectAccessor::GetUnit((*me), (*itr)->getUnitGuid()); + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (events.GetPhaseMask() & PHASE_ONE_MASK && damage >= me->GetPower(POWER_MANA)) + { + // reset threat + ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList(); + for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + { + Unit* unit = ObjectAccessor::GetUnit((*me), (*itr)->getUnitGuid()); - if (unit && DoGetThreat(unit)) - DoModifyThreatPercent(unit, -100); - } + if (unit && DoGetThreat(unit)) + DoModifyThreatPercent(unit, -100); + } - Talk(SAY_PHASE_2); - Talk(EMOTE_PHASE_2); - DoStartMovement(me->GetVictim()); - damage -= me->GetPower(POWER_MANA); - me->SetPower(POWER_MANA, 0); - me->RemoveAurasDueToSpell(SPELL_MANA_BARRIER); - events.SetPhase(PHASE_TWO); - events.ScheduleEvent(EVENT_SPELL_FROSTBOLT, urand(10000, 12000), 0, PHASE_TWO); - events.ScheduleEvent(EVENT_SPELL_FROSTBOLT_VOLLEY, urand(19000, 21000), 0, PHASE_TWO); - events.ScheduleEvent(EVENT_SPELL_TOUCH_OF_INSIGNIFICANCE, urand(6000, 9000), 0, PHASE_TWO); - events.ScheduleEvent(EVENT_SPELL_SUMMON_SHADE, urand(12000, 15000), 0, PHASE_TWO); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SUMMON_WAVE_P2, 45000, 0, PHASE_TWO); - } - } + Talk(SAY_PHASE_2); + Talk(EMOTE_PHASE_2); + DoStartMovement(me->GetVictim()); + damage -= me->GetPower(POWER_MANA); + me->SetPower(POWER_MANA, 0); + me->RemoveAurasDueToSpell(SPELL_MANA_BARRIER); + events.SetPhase(PHASE_TWO); + events.ScheduleEvent(EVENT_SPELL_FROSTBOLT, urand(10000, 12000), 0, PHASE_TWO); + events.ScheduleEvent(EVENT_SPELL_FROSTBOLT_VOLLEY, urand(19000, 21000), 0, PHASE_TWO); + events.ScheduleEvent(EVENT_SPELL_TOUCH_OF_INSIGNIFICANCE, urand(6000, 9000), 0, PHASE_TWO); + events.ScheduleEvent(EVENT_SPELL_SUMMON_SHADE, urand(12000, 15000), 0, PHASE_TWO); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SUMMON_WAVE_P2, 45000, 0, PHASE_TWO); + } + } - void UpdateAI(uint32 diff) - { - if ((!UpdateVictim() && !(events.GetPhaseMask() & PHASE_INTRO_MASK)) || !CheckInRoom()) - return; + void UpdateAI(uint32 diff) + { + if ((!UpdateVictim() && !(events.GetPhaseMask() & PHASE_INTRO_MASK)) || !CheckInRoom()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_INTRO_2: - Talk(SAY_INTRO_2); - events.PopEvent(); - break; - case EVENT_INTRO_3: - Talk(SAY_INTRO_3); - events.PopEvent(); - break; - case EVENT_INTRO_4: - Talk(SAY_INTRO_4); - events.PopEvent(); - break; - case EVENT_INTRO_5: - Talk(SAY_INTRO_5); - events.PopEvent(); - break; - case EVENT_INTRO_6: - Talk(SAY_INTRO_6); - events.PopEvent(); - break; - case EVENT_INTRO_7: - Talk(SAY_INTRO_7); - events.PopEvent(); - break; - case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - Talk(SAY_BERSERK); - events.PopEvent(); - break; - case EVENT_SPELL_DEATH_AND_DECAY: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(target, SPELL_DEATH_AND_DECAY, false); - events.RepeatEvent(urand(22000, 30000)); - break; - case EVENT_SPELL_DOMINATE_MIND_25: - { - Talk(SAY_DOMINATE_MIND); + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_INTRO_2: + Talk(SAY_INTRO_2); + events.PopEvent(); + break; + case EVENT_INTRO_3: + Talk(SAY_INTRO_3); + events.PopEvent(); + break; + case EVENT_INTRO_4: + Talk(SAY_INTRO_4); + events.PopEvent(); + break; + case EVENT_INTRO_5: + Talk(SAY_INTRO_5); + events.PopEvent(); + break; + case EVENT_INTRO_6: + Talk(SAY_INTRO_6); + events.PopEvent(); + break; + case EVENT_INTRO_7: + Talk(SAY_INTRO_7); + events.PopEvent(); + break; + case EVENT_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + Talk(SAY_BERSERK); + events.PopEvent(); + break; + case EVENT_SPELL_DEATH_AND_DECAY: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(target, SPELL_DEATH_AND_DECAY, false); + events.RepeatEvent(urand(22000, 30000)); + break; + case EVENT_SPELL_DOMINATE_MIND_25: + { + Talk(SAY_DOMINATE_MIND); - std::vector validPlayers; - Map::PlayerList const &pList = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (Player* plr = itr->GetSource()) - if (plr->IsAlive() && !plr->IsGameMaster() && plr->GetExactDist2dSq(me) < (150.0f * 150.0f)) - if (!me->GetVictim() || me->GetVictim()->GetGUID() != plr->GetGUID()) - { - // shouldn't be casted on any victim of summoned mobs - bool valid = true; - for (std::list::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* c = ObjectAccessor::GetCreature(*me, (*itr))) - if (c->IsAlive() && c->GetVictim() && c->GetVictim()->GetGUID() == plr->GetGUID()) - { - valid = false; - break; - } - if (valid) - validPlayers.push_back(plr); - } + std::vector validPlayers; + Map::PlayerList const &pList = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if (Player* plr = itr->GetSource()) + if (plr->IsAlive() && !plr->IsGameMaster() && plr->GetExactDist2dSq(me) < (150.0f * 150.0f)) + if (!me->GetVictim() || me->GetVictim()->GetGUID() != plr->GetGUID()) + { + // shouldn't be casted on any victim of summoned mobs + bool valid = true; + for (std::list::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* c = ObjectAccessor::GetCreature(*me, (*itr))) + if (c->IsAlive() && c->GetVictim() && c->GetVictim()->GetGUID() == plr->GetGUID()) + { + valid = false; + break; + } + if (valid) + validPlayers.push_back(plr); + } - std::vector::iterator begin=validPlayers.begin(), end=validPlayers.end(); - std::random_shuffle(begin, end); + std::vector::iterator begin=validPlayers.begin(), end=validPlayers.end(); + std::random_shuffle(begin, end); - for (uint8 i = 0; i < RAID_MODE(0, 1, 1, 3) && i < validPlayers.size(); i++) - { - Unit* target = validPlayers[i]; - me->CastSpell(target, SPELL_DOMINATE_MIND_25, true); - } + for (uint8 i = 0; i < RAID_MODE(0, 1, 1, 3) && i < validPlayers.size(); i++) + { + Unit* target = validPlayers[i]; + me->CastSpell(target, SPELL_DOMINATE_MIND_25, true); + } - events.RepeatEvent(urand(40000, 45000)); - } - break; - case EVENT_SPELL_SHADOW_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(target, SPELL_SHADOW_BOLT, false); - events.RepeatEvent(urand(5000, 8000)); - break; - case EVENT_SUMMON_WAVE_P1: - SummonWaveP1(); - events.RepeatEvent(IsHeroic() ? 45000 : 60000); - break; - case EVENT_REANIMATE_CULTIST: - ReanimateCultist(); - events.PopEvent(); - break; - case EVENT_EMPOWER_CULTIST: - EmpowerCultist(); - events.RepeatEvent(urand(18000, 25000)); - break; - case EVENT_SPELL_FROSTBOLT: - me->CastSpell(me->GetVictim(), SPELL_FROSTBOLT, false); - events.RepeatEvent(urand(10000, 11000)); - break; - case EVENT_SPELL_FROSTBOLT_VOLLEY: - me->CastSpell((Unit*)NULL, SPELL_FROSTBOLT_VOLLEY, false); - events.RepeatEvent(urand(13000, 15000)); - break; - case EVENT_SPELL_TOUCH_OF_INSIGNIFICANCE: - me->CastSpell(me->GetVictim(), SPELL_TOUCH_OF_INSIGNIFICANCE, false); - events.RepeatEvent(urand(9000, 13000)); - break; - case EVENT_SUMMON_WAVE_P2: - SummonWaveP2(); - events.RepeatEvent(45000); - break; - case EVENT_SPELL_SUMMON_SHADE: - { - uint8 count = 1; - if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) - count = 2; - else if (GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) - count = 3; + events.RepeatEvent(urand(40000, 45000)); + } + break; + case EVENT_SPELL_SHADOW_BOLT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(target, SPELL_SHADOW_BOLT, false); + events.RepeatEvent(urand(5000, 8000)); + break; + case EVENT_SUMMON_WAVE_P1: + SummonWaveP1(); + events.RepeatEvent(IsHeroic() ? 45000 : 60000); + break; + case EVENT_REANIMATE_CULTIST: + ReanimateCultist(); + events.PopEvent(); + break; + case EVENT_EMPOWER_CULTIST: + EmpowerCultist(); + events.RepeatEvent(urand(18000, 25000)); + break; + case EVENT_SPELL_FROSTBOLT: + me->CastSpell(me->GetVictim(), SPELL_FROSTBOLT, false); + events.RepeatEvent(urand(10000, 11000)); + break; + case EVENT_SPELL_FROSTBOLT_VOLLEY: + me->CastSpell((Unit*)NULL, SPELL_FROSTBOLT_VOLLEY, false); + events.RepeatEvent(urand(13000, 15000)); + break; + case EVENT_SPELL_TOUCH_OF_INSIGNIFICANCE: + me->CastSpell(me->GetVictim(), SPELL_TOUCH_OF_INSIGNIFICANCE, false); + events.RepeatEvent(urand(9000, 13000)); + break; + case EVENT_SUMMON_WAVE_P2: + SummonWaveP2(); + events.RepeatEvent(45000); + break; + case EVENT_SPELL_SUMMON_SHADE: + { + uint8 count = 1; + if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + count = 2; + else if (GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) + count = 3; - std::list targets; - SelectTargetList(targets, NonTankTargetSelector(me, true), count, SELECT_TARGET_RANDOM); - if (!targets.empty()) - for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) - me->CastSpell(*itr, SPELL_SUMMON_SHADE, true); - } - events.RepeatEvent(urand(18000, 23000)); - break; - } + std::list targets; + SelectTargetList(targets, NonTankTargetSelector(me, true), count, SELECT_TARGET_RANDOM); + if (!targets.empty()) + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + me->CastSpell(*itr, SPELL_SUMMON_SHADE, true); + } + events.RepeatEvent(urand(18000, 23000)); + break; + } - if (me->HasAura(SPELL_MANA_BARRIER)) - return; + if (me->HasAura(SPELL_MANA_BARRIER)) + return; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustSummoned(Creature* summon) - { - if (summon->GetEntry() == NPC_DARNAVAN) - _darnavanGUID = summon->GetGUID(); - else - summons.Summon(summon); + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() == NPC_DARNAVAN) + _darnavanGUID = summon->GetGUID(); + else + summons.Summon(summon); - Unit* target = NULL; - if (summon->GetEntry() == NPC_VENGEFUL_SHADE) - { - float minrange = 250.0f; - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p != me->GetVictim() && summon->GetExactDist(p) < minrange && me->CanCreatureAttack(p) && me->_CanDetectFeignDeathOf(p)) - { - target = p; - minrange = summon->GetExactDist(p); - } + Unit* target = NULL; + if (summon->GetEntry() == NPC_VENGEFUL_SHADE) + { + float minrange = 250.0f; + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p != me->GetVictim() && summon->GetExactDist(p) < minrange && me->CanCreatureAttack(p) && me->_CanDetectFeignDeathOf(p)) + { + target = p; + minrange = summon->GetExactDist(p); + } - summon->ToTempSummon()->DespawnOrUnsummon(30000); - } - else - { - target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); - } + summon->ToTempSummon()->DespawnOrUnsummon(30000); + } + else + { + target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); + } - summon->AI()->AttackStart(target); - } + summon->AI()->AttackStart(target); + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); - std::set livingAddEntries; - // Full House achievement - for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Unit* unit = ObjectAccessor::GetUnit(*me, *itr)) - if (unit->IsAlive() && unit->GetEntry() != NPC_VENGEFUL_SHADE) - livingAddEntries.insert(unit->GetEntry()); + std::set livingAddEntries; + // Full House achievement + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Unit* unit = ObjectAccessor::GetUnit(*me, *itr)) + if (unit->IsAlive() && unit->GetEntry() != NPC_VENGEFUL_SHADE) + livingAddEntries.insert(unit->GetEntry()); - if (livingAddEntries.size() >= 5) - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_FULL_HOUSE, 0, me); + if (livingAddEntries.size() >= 5) + instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_FULL_HOUSE, 0, me); - if (Creature* darnavan = ObjectAccessor::GetCreature(*me, _darnavanGUID)) - { - if (darnavan->IsAlive()) - { - darnavan->RemoveAllAuras(); - darnavan->setFaction(35); - darnavan->DeleteThreatList(); - darnavan->CombatStop(true); - darnavan->GetMotionMaster()->MoveIdle(); - darnavan->StopMoving(); - darnavan->SetReactState(REACT_PASSIVE); - darnavan->m_Events.AddEvent(new DaranavanMoveEvent(*darnavan), darnavan->m_Events.CalculateTime(10000)); - darnavan->AI()->Talk(SAY_DARNAVAN_RESCUED); - if (Player* owner = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - if (Group* group = owner->GetGroup()) - { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - if (Player* member = itr->GetSource()) - if (member->IsInMap(owner)) - member->KilledMonsterCredit(NPC_DARNAVAN_CREDIT, 0); - } - else - owner->KilledMonsterCredit(NPC_DARNAVAN_CREDIT, 0); - } - } - } + if (Creature* darnavan = ObjectAccessor::GetCreature(*me, _darnavanGUID)) + { + if (darnavan->IsAlive()) + { + darnavan->RemoveAllAuras(); + darnavan->setFaction(35); + darnavan->DeleteThreatList(); + darnavan->CombatStop(true); + darnavan->GetMotionMaster()->MoveIdle(); + darnavan->StopMoving(); + darnavan->SetReactState(REACT_PASSIVE); + darnavan->m_Events.AddEvent(new DaranavanMoveEvent(*darnavan), darnavan->m_Events.CalculateTime(10000)); + darnavan->AI()->Talk(SAY_DARNAVAN_RESCUED); + if (Player* owner = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + if (Group* group = owner->GetGroup()) + { + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Player* member = itr->GetSource()) + if (member->IsInMap(owner)) + member->KilledMonsterCredit(NPC_DARNAVAN_CREDIT, 0); + } + else + owner->KilledMonsterCredit(NPC_DARNAVAN_CREDIT, 0); + } + } + } - _JustDied(); - } + _JustDied(); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } - void MoveInLineOfSight(Unit* who) - { - if (!_introDone && me->IsWithinDistInMap(who, 110.0f)) - { - _introDone = true; - Talk(SAY_INTRO_1); - events.SetPhase(PHASE_INTRO); - events.ScheduleEvent(EVENT_INTRO_2, 11000, 0, PHASE_INTRO); - events.ScheduleEvent(EVENT_INTRO_3, 21000, 0, PHASE_INTRO); - events.ScheduleEvent(EVENT_INTRO_4, 31500, 0, PHASE_INTRO); - events.ScheduleEvent(EVENT_INTRO_5, 39500, 0, PHASE_INTRO); - events.ScheduleEvent(EVENT_INTRO_6, 48500, 0, PHASE_INTRO); - events.ScheduleEvent(EVENT_INTRO_7, 58000, 0, PHASE_INTRO); - } + void MoveInLineOfSight(Unit* who) + { + if (!_introDone && me->IsWithinDistInMap(who, 110.0f)) + { + _introDone = true; + Talk(SAY_INTRO_1); + events.SetPhase(PHASE_INTRO); + events.ScheduleEvent(EVENT_INTRO_2, 11000, 0, PHASE_INTRO); + events.ScheduleEvent(EVENT_INTRO_3, 21000, 0, PHASE_INTRO); + events.ScheduleEvent(EVENT_INTRO_4, 31500, 0, PHASE_INTRO); + events.ScheduleEvent(EVENT_INTRO_5, 39500, 0, PHASE_INTRO); + events.ScheduleEvent(EVENT_INTRO_6, 48500, 0, PHASE_INTRO); + events.ScheduleEvent(EVENT_INTRO_7, 58000, 0, PHASE_INTRO); + } - BossAI::MoveInLineOfSight(who); - } + BossAI::MoveInLineOfSight(who); + } - void SummonWaveP1() - { - uint8 addIndex = _waveCounter & 1; - uint8 addIndexOther = uint8(addIndex ^ 1); + void SummonWaveP1() + { + uint8 addIndex = _waveCounter & 1; + uint8 addIndexOther = uint8(addIndex ^ 1); - // Summon first add, replace it with Darnavan if weekly quest is active - if (_waveCounter || instance->GetData(DATA_WEEKLY_QUEST_ID) != QUEST_DEPROGRAMMING_10) - Summon(SummonEntries[addIndex], SummonPositions[addIndex * 3]); - else - Summon(NPC_DARNAVAN, SummonPositions[addIndex * 3]); + // Summon first add, replace it with Darnavan if weekly quest is active + if (_waveCounter || instance->GetData(DATA_WEEKLY_QUEST_ID) != QUEST_DEPROGRAMMING_10) + Summon(SummonEntries[addIndex], SummonPositions[addIndex * 3]); + else + Summon(NPC_DARNAVAN, SummonPositions[addIndex * 3]); - Summon(SummonEntries[addIndexOther], SummonPositions[addIndex * 3 + 1]); - Summon(SummonEntries[addIndex], SummonPositions[addIndex * 3 + 2]); - if (Is25ManRaid()) - { - Summon(SummonEntries[addIndexOther], SummonPositions[addIndexOther * 3]); - Summon(SummonEntries[addIndex], SummonPositions[addIndexOther * 3 + 1]); - Summon(SummonEntries[addIndexOther], SummonPositions[addIndexOther * 3 + 2]); - Summon(SummonEntries[urand(0, 1)], SummonPositions[6]); - } + Summon(SummonEntries[addIndexOther], SummonPositions[addIndex * 3 + 1]); + Summon(SummonEntries[addIndex], SummonPositions[addIndex * 3 + 2]); + if (Is25ManRaid()) + { + Summon(SummonEntries[addIndexOther], SummonPositions[addIndexOther * 3]); + Summon(SummonEntries[addIndex], SummonPositions[addIndexOther * 3 + 1]); + Summon(SummonEntries[addIndexOther], SummonPositions[addIndexOther * 3 + 2]); + Summon(SummonEntries[urand(0, 1)], SummonPositions[6]); + } - ++_waveCounter; - } + ++_waveCounter; + } - void SummonWaveP2() - { - if (Is25ManRaid()) - { - uint8 addIndex = _waveCounter & 1; - Summon(SummonEntries[addIndex], SummonPositions[addIndex * 3]); - Summon(SummonEntries[addIndex ^ 1], SummonPositions[addIndex * 3 + 1]); - Summon(SummonEntries[addIndex], SummonPositions[addIndex * 3+ 2]); - } - else - Summon(SummonEntries[urand(0, 1)], SummonPositions[6]); + void SummonWaveP2() + { + if (Is25ManRaid()) + { + uint8 addIndex = _waveCounter & 1; + Summon(SummonEntries[addIndex], SummonPositions[addIndex * 3]); + Summon(SummonEntries[addIndex ^ 1], SummonPositions[addIndex * 3 + 1]); + Summon(SummonEntries[addIndex], SummonPositions[addIndex * 3+ 2]); + } + else + Summon(SummonEntries[urand(0, 1)], SummonPositions[6]); - ++_waveCounter; - } + ++_waveCounter; + } - // helper for summoning wave mobs - void Summon(uint32 entry, const Position& pos) - { - if (TempSummon* summon = me->SummonCreature(entry, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000)) - if (TempSummon* trigger = me->SummonCreature(WORLD_TRIGGER, pos, TEMPSUMMON_TIMED_DESPAWN, 2000)) - { - trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - trigger->CastSpell(trigger, SPELL_TELEPORT_VISUAL, true); - } - } + // helper for summoning wave mobs + void Summon(uint32 entry, const Position& pos) + { + if (TempSummon* summon = me->SummonCreature(entry, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000)) + if (TempSummon* trigger = me->SummonCreature(WORLD_TRIGGER, pos, TEMPSUMMON_TIMED_DESPAWN, 2000)) + { + trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + trigger->CastSpell(trigger, SPELL_TELEPORT_VISUAL, true); + } + } - void SetGUID(uint64 guid, int32) - { - if (events.GetPhaseMask() & PHASE_ONE_MASK) - { - _reanimationQueue.push_back(guid); - events.ScheduleEvent(EVENT_REANIMATE_CULTIST, 3000, 0, PHASE_ONE); - } - } + void SetGUID(uint64 guid, int32) + { + if (events.GetPhaseMask() & PHASE_ONE_MASK) + { + _reanimationQueue.push_back(guid); + events.ScheduleEvent(EVENT_REANIMATE_CULTIST, 3000, 0, PHASE_ONE); + } + } - void ReanimateCultist() - { - if (_reanimationQueue.empty()) - return; + void ReanimateCultist() + { + if (_reanimationQueue.empty()) + return; - uint64 cultistGUID = _reanimationQueue.front(); - Creature* cultist = ObjectAccessor::GetCreature(*me, cultistGUID); - _reanimationQueue.pop_front(); - if (!cultist) - return; + uint64 cultistGUID = _reanimationQueue.front(); + Creature* cultist = ObjectAccessor::GetCreature(*me, cultistGUID); + _reanimationQueue.pop_front(); + if (!cultist) + return; - Talk(SAY_ANIMATE_DEAD); - me->CastSpell(cultist, SPELL_DARK_MARTYRDOM_T, true); - } + Talk(SAY_ANIMATE_DEAD); + me->CastSpell(cultist, SPELL_DARK_MARTYRDOM_T, true); + } - void EmpowerCultist() - { - if (summons.empty()) - return; + void EmpowerCultist() + { + if (summons.empty()) + return; - std::list temp; - for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* cre = ObjectAccessor::GetCreature(*me, *itr)) - if (cre->IsAlive() && (cre->GetEntry() == NPC_CULT_FANATIC || cre->GetEntry() == NPC_CULT_ADHERENT)) - temp.push_back(cre); + std::list temp; + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* cre = ObjectAccessor::GetCreature(*me, *itr)) + if (cre->IsAlive() && (cre->GetEntry() == NPC_CULT_FANATIC || cre->GetEntry() == NPC_CULT_ADHERENT)) + temp.push_back(cre); - // noone to empower - if (temp.empty()) - return; + // noone to empower + if (temp.empty()) + return; - // select random cultist - if (Creature* cultist = Trinity::Containers::SelectRandomContainerElement(temp)) - { - me->CastSpell(cultist, cultist->GetEntry() == NPC_CULT_FANATIC ? SPELL_DARK_TRANSFORMATION_T : SPELL_DARK_EMPOWERMENT_T, true); - Talk(uint8(cultist->GetEntry() == NPC_CULT_FANATIC ? SAY_DARK_TRANSFORMATION : SAY_DARK_EMPOWERMENT)); - } - } + // select random cultist + if (Creature* cultist = Trinity::Containers::SelectRandomContainerElement(temp)) + { + me->CastSpell(cultist, cultist->GetEntry() == NPC_CULT_FANATIC ? SPELL_DARK_TRANSFORMATION_T : SPELL_DARK_EMPOWERMENT_T, true); + Talk(uint8(cultist->GetEntry() == NPC_CULT_FANATIC ? SAY_DARK_TRANSFORMATION : SAY_DARK_EMPOWERMENT)); + } + } - void SpellHitTarget(Unit* target, SpellInfo const* spell) - { - if (spell->Id == SPELL_DARK_MARTYRDOM_T) - { - if (target->GetEntry() == NPC_CULT_FANATIC) - me->SummonCreature(NPC_REANIMATED_FANATIC, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - else - me->SummonCreature(NPC_REANIMATED_ADHERENT, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + void SpellHitTarget(Unit* target, SpellInfo const* spell) + { + if (spell->Id == SPELL_DARK_MARTYRDOM_T) + { + if (target->GetEntry() == NPC_CULT_FANATIC) + me->SummonCreature(NPC_REANIMATED_FANATIC, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + else + me->SummonCreature(NPC_REANIMATED_ADHERENT, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - if (TempSummon* summon = target->ToTempSummon()) - summon->UnSummon(); - } - else if (spell->Id == SPELL_DOMINATE_MIND_25) - { - const int32 val = 100; - target->CastCustomSpell(target, 73261, &val, NULL, NULL, true); // scale aura, +100% size - } - } + if (TempSummon* summon = target->ToTempSummon()) + summon->UnSummon(); + } + else if (spell->Id == SPELL_DOMINATE_MIND_25) + { + const int32 val = 100; + target->CastCustomSpell(target, 73261, &val, NULL, NULL, true); // scale aura, +100% size + } + } - private: - uint64 _darnavanGUID; - std::deque _reanimationQueue; - uint32 _waveCounter; - bool _introDone; - }; + private: + uint64 _darnavanGUID; + std::deque _reanimationQueue; + uint32 _waveCounter; + bool _introDone; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_cult_fanatic : public CreatureScript { public: - npc_cult_fanatic() : CreatureScript("npc_cult_fanatic") { } + npc_cult_fanatic() : CreatureScript("npc_cult_fanatic") { } - struct npc_cult_fanaticAI : public ScriptedAI - { - npc_cult_fanaticAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_cult_fanaticAI : public ScriptedAI + { + npc_cult_fanaticAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_FANATIC_NECROTIC_STRIKE, urand(10000, 12000)); - events.ScheduleEvent(EVENT_SPELL_FANATIC_SHADOW_CLEAVE, urand(14000, 16000)); - events.ScheduleEvent(EVENT_SPELL_FANATIC_VAMPIRIC_MIGHT, urand(20000, 27000)); - if (me->GetEntry() == NPC_CULT_FANATIC) - events.ScheduleEvent(EVENT_SPELL_CULTIST_DARK_MARTYRDOM, urand(15000, 32000)); - } + void Reset() + { + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_FANATIC_NECROTIC_STRIKE, urand(10000, 12000)); + events.ScheduleEvent(EVENT_SPELL_FANATIC_SHADOW_CLEAVE, urand(14000, 16000)); + events.ScheduleEvent(EVENT_SPELL_FANATIC_VAMPIRIC_MIGHT, urand(20000, 27000)); + if (me->GetEntry() == NPC_CULT_FANATIC) + events.ScheduleEvent(EVENT_SPELL_CULTIST_DARK_MARTYRDOM, urand(15000, 32000)); + } - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) - { - if (spell->Id == SPELL_DARK_TRANSFORMATION) - me->UpdateEntry(NPC_DEFORMED_FANATIC); - else if (spell->Id == SPELL_DARK_TRANSFORMATION_T) - { - events.CancelEvent(EVENT_SPELL_CULTIST_DARK_MARTYRDOM); - me->InterruptNonMeleeSpells(true); - me->CastSpell(me, SPELL_DARK_TRANSFORMATION, false); - } - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_DARK_TRANSFORMATION) + me->UpdateEntry(NPC_DEFORMED_FANATIC); + else if (spell->Id == SPELL_DARK_TRANSFORMATION_T) + { + events.CancelEvent(EVENT_SPELL_CULTIST_DARK_MARTYRDOM); + me->InterruptNonMeleeSpells(true); + me->CastSpell(me, SPELL_DARK_TRANSFORMATION, false); + } + } - void DoAction(int32 a) - { - if (a == -1) - { - me->SetControlled(true, UNIT_STATE_STUNNED); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - events.Reset(); - events.ScheduleEvent(EVENT_CULTIST_DARK_MARTYRDOM_SELF_KILL, 500); - } - } + void DoAction(int32 a) + { + if (a == -1) + { + me->SetControlled(true, UNIT_STATE_STUNNED); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + events.Reset(); + events.ScheduleEvent(EVENT_CULTIST_DARK_MARTYRDOM_SELF_KILL, 500); + } + } - void EnterCombat(Unit* who) { DoZoneInCombat(); } + void EnterCombat(Unit* who) { DoZoneInCombat(); } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_FANATIC_NECROTIC_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_NECROTIC_STRIKE, false); - events.RepeatEvent(urand(11000, 13000)); - break; - case EVENT_SPELL_FANATIC_SHADOW_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_SHADOW_CLEAVE, false); - events.RepeatEvent((9500, 11000)); - break; - case EVENT_SPELL_FANATIC_VAMPIRIC_MIGHT: - me->CastSpell(me, SPELL_VAMPIRIC_MIGHT, false); - events.RepeatEvent(urand(20000, 27000)); - break; - case EVENT_SPELL_CULTIST_DARK_MARTYRDOM: - me->CastSpell(me, SPELL_DARK_MARTYRDOM_FANATIC, false); - events.RepeatEvent(urand(16000, 21000)); - break; - case EVENT_CULTIST_DARK_MARTYRDOM_SELF_KILL: - Unit::Kill(me, me); - events.PopEvent(); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_FANATIC_NECROTIC_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_NECROTIC_STRIKE, false); + events.RepeatEvent(urand(11000, 13000)); + break; + case EVENT_SPELL_FANATIC_SHADOW_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_SHADOW_CLEAVE, false); + events.RepeatEvent((9500, 11000)); + break; + case EVENT_SPELL_FANATIC_VAMPIRIC_MIGHT: + me->CastSpell(me, SPELL_VAMPIRIC_MIGHT, false); + events.RepeatEvent(urand(20000, 27000)); + break; + case EVENT_SPELL_CULTIST_DARK_MARTYRDOM: + me->CastSpell(me, SPELL_DARK_MARTYRDOM_FANATIC, false); + events.RepeatEvent(urand(16000, 21000)); + break; + case EVENT_CULTIST_DARK_MARTYRDOM_SELF_KILL: + Unit::Kill(me, me); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_cult_adherent : public CreatureScript { public: - npc_cult_adherent() : CreatureScript("npc_cult_adherent") { } + npc_cult_adherent() : CreatureScript("npc_cult_adherent") { } - struct npc_cult_adherentAI : public ScriptedAI - { - npc_cult_adherentAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_cult_adherentAI : public ScriptedAI + { + npc_cult_adherentAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_ADHERENT_FROST_FEVER, urand(10000, 12000)); - events.ScheduleEvent(EVENT_SPELL_ADHERENT_DEATHCHILL, urand(14000, 16000)); - events.ScheduleEvent(EVENT_SPELL_ADHERENT_CURSE_OF_TORPOR, urand(14000, 16000)); - events.ScheduleEvent(EVENT_SPELL_ADHERENT_SHORUD_OF_THE_OCCULT, urand(32000, 39000)); - if (me->GetEntry() == NPC_CULT_ADHERENT) - events.ScheduleEvent(EVENT_SPELL_CULTIST_DARK_MARTYRDOM, urand(15000, 32000)); - } + void Reset() + { + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_ADHERENT_FROST_FEVER, urand(10000, 12000)); + events.ScheduleEvent(EVENT_SPELL_ADHERENT_DEATHCHILL, urand(14000, 16000)); + events.ScheduleEvent(EVENT_SPELL_ADHERENT_CURSE_OF_TORPOR, urand(14000, 16000)); + events.ScheduleEvent(EVENT_SPELL_ADHERENT_SHORUD_OF_THE_OCCULT, urand(32000, 39000)); + if (me->GetEntry() == NPC_CULT_ADHERENT) + events.ScheduleEvent(EVENT_SPELL_CULTIST_DARK_MARTYRDOM, urand(15000, 32000)); + } - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) - { - if (spell->Id == SPELL_DARK_EMPOWERMENT) - me->UpdateEntry(NPC_EMPOWERED_ADHERENT); - else if (spell->Id == SPELL_DARK_EMPOWERMENT_T) - { - events.CancelEvent(EVENT_SPELL_CULTIST_DARK_MARTYRDOM); - me->InterruptNonMeleeSpells(true); - me->CastSpell(me, SPELL_DARK_EMPOWERMENT, false); - } - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_DARK_EMPOWERMENT) + me->UpdateEntry(NPC_EMPOWERED_ADHERENT); + else if (spell->Id == SPELL_DARK_EMPOWERMENT_T) + { + events.CancelEvent(EVENT_SPELL_CULTIST_DARK_MARTYRDOM); + me->InterruptNonMeleeSpells(true); + me->CastSpell(me, SPELL_DARK_EMPOWERMENT, false); + } + } - void DoAction(int32 a) - { - if (a == -1) - { - me->SetControlled(true, UNIT_STATE_STUNNED); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - events.Reset(); - events.ScheduleEvent(EVENT_CULTIST_DARK_MARTYRDOM_SELF_KILL, 500); - } - } + void DoAction(int32 a) + { + if (a == -1) + { + me->SetControlled(true, UNIT_STATE_STUNNED); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + events.Reset(); + events.ScheduleEvent(EVENT_CULTIST_DARK_MARTYRDOM_SELF_KILL, 500); + } + } - void EnterCombat(Unit* who) { DoZoneInCombat(); } + void EnterCombat(Unit* who) { DoZoneInCombat(); } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_ADHERENT_FROST_FEVER: - me->CastSpell(me->GetVictim(), SPELL_FROST_FEVER, false); - events.RepeatEvent(urand(9000, 13000)); - break; - case EVENT_SPELL_ADHERENT_DEATHCHILL: - if (me->GetEntry() == NPC_EMPOWERED_ADHERENT) - me->CastSpell(me->GetVictim(), SPELL_DEATHCHILL_BLAST, false); - else - me->CastSpell(me->GetVictim(), SPELL_DEATHCHILL_BOLT, false); - events.RepeatEvent((9000, 13000)); - break; - case EVENT_SPELL_ADHERENT_CURSE_OF_TORPOR: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) - me->CastSpell(target, SPELL_CURSE_OF_TORPOR, false); - events.RepeatEvent(urand(9000, 13000)); - break; - case EVENT_SPELL_ADHERENT_SHORUD_OF_THE_OCCULT: - me->CastSpell(me, SPELL_SHORUD_OF_THE_OCCULT, false); - events.RepeatEvent(urand(27000, 32000)); - break; - case EVENT_SPELL_CULTIST_DARK_MARTYRDOM: - me->CastSpell(me, SPELL_DARK_MARTYRDOM_ADHERENT, false); - events.RepeatEvent(urand(16000, 21000)); - break; - case EVENT_CULTIST_DARK_MARTYRDOM_SELF_KILL: - Unit::Kill(me, me); - events.PopEvent(); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_ADHERENT_FROST_FEVER: + me->CastSpell(me->GetVictim(), SPELL_FROST_FEVER, false); + events.RepeatEvent(urand(9000, 13000)); + break; + case EVENT_SPELL_ADHERENT_DEATHCHILL: + if (me->GetEntry() == NPC_EMPOWERED_ADHERENT) + me->CastSpell(me->GetVictim(), SPELL_DEATHCHILL_BLAST, false); + else + me->CastSpell(me->GetVictim(), SPELL_DEATHCHILL_BOLT, false); + events.RepeatEvent((9000, 13000)); + break; + case EVENT_SPELL_ADHERENT_CURSE_OF_TORPOR: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) + me->CastSpell(target, SPELL_CURSE_OF_TORPOR, false); + events.RepeatEvent(urand(9000, 13000)); + break; + case EVENT_SPELL_ADHERENT_SHORUD_OF_THE_OCCULT: + me->CastSpell(me, SPELL_SHORUD_OF_THE_OCCULT, false); + events.RepeatEvent(urand(27000, 32000)); + break; + case EVENT_SPELL_CULTIST_DARK_MARTYRDOM: + me->CastSpell(me, SPELL_DARK_MARTYRDOM_ADHERENT, false); + events.RepeatEvent(urand(16000, 21000)); + break; + case EVENT_CULTIST_DARK_MARTYRDOM_SELF_KILL: + Unit::Kill(me, me); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_vengeful_shade : public CreatureScript { public: - npc_vengeful_shade() : CreatureScript("npc_vengeful_shade") { } + npc_vengeful_shade() : CreatureScript("npc_vengeful_shade") { } - struct npc_vengeful_shadeAI : public ScriptedAI - { - npc_vengeful_shadeAI(Creature* creature) : ScriptedAI(creature) - { - me->SetControlled(true, UNIT_STATE_ROOT); - unroot_timer = 500; - targetGUID = 0; - } + struct npc_vengeful_shadeAI : public ScriptedAI + { + npc_vengeful_shadeAI(Creature* creature) : ScriptedAI(creature) + { + me->SetControlled(true, UNIT_STATE_ROOT); + unroot_timer = 500; + targetGUID = 0; + } - uint16 unroot_timer; - uint64 targetGUID; + uint16 unroot_timer; + uint64 targetGUID; - void Reset() - { - me->setAttackTimer(BASE_ATTACK, 2000); - me->AddAura(SPELL_VENGEFUL_BLAST_PASSIVE, me); - } + void Reset() + { + me->setAttackTimer(BASE_ATTACK, 2000); + me->AddAura(SPELL_VENGEFUL_BLAST_PASSIVE, me); + } - void AttackStart(Unit* who) - { - if (!who) - return; - ScriptedAI::AttackStart(who); - if (!targetGUID) - { - me->getThreatManager().resetAllAggro(); - me->AddThreat(who, 1000000.0f); - targetGUID = who->GetGUID(); - } - } + void AttackStart(Unit* who) + { + if (!who) + return; + ScriptedAI::AttackStart(who); + if (!targetGUID) + { + me->getThreatManager().resetAllAggro(); + me->AddThreat(who, 1000000.0f); + targetGUID = who->GetGUID(); + } + } - void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) - { - switch (spell->Id) - { - case SPELL_VENGEFUL_BLAST_10N: - case SPELL_VENGEFUL_BLAST_25N: - case SPELL_VENGEFUL_BLAST_10H: - case SPELL_VENGEFUL_BLAST_25H: - me->GetMotionMaster()->MovementExpired(); - me->StopMoving(); - me->SetControlled(true, UNIT_STATE_STUNNED); - me->DespawnOrUnsummon(500); - break; - default: - break; - } - } + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) + { + switch (spell->Id) + { + case SPELL_VENGEFUL_BLAST_10N: + case SPELL_VENGEFUL_BLAST_25N: + case SPELL_VENGEFUL_BLAST_10H: + case SPELL_VENGEFUL_BLAST_25H: + me->GetMotionMaster()->MovementExpired(); + me->StopMoving(); + me->SetControlled(true, UNIT_STATE_STUNNED); + me->DespawnOrUnsummon(500); + break; + default: + break; + } + } - void UpdateAI(uint32 diff) - { - if (unroot_timer) - { - if (unroot_timer <= diff) - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->SetInCombatWithZone(); - unroot_timer = 0; - } - else - { - unroot_timer -= diff; - return; - } - } + void UpdateAI(uint32 diff) + { + if (unroot_timer) + { + if (unroot_timer <= diff) + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->SetInCombatWithZone(); + unroot_timer = 0; + } + else + { + unroot_timer -= diff; + return; + } + } - UpdateVictim(); + UpdateVictim(); - if (!me->GetVictim() || me->GetVictim()->GetGUID() != targetGUID) - { - me->DespawnOrUnsummon(1); - return; - } + if (!me->GetVictim() || me->GetVictim()->GetGUID() != targetGUID) + { + me->DespawnOrUnsummon(1); + return; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void MoveInLineOfSight(Unit* who) {} - void EnterEvadeMode() {} - }; + void MoveInLineOfSight(Unit* who) {} + void EnterEvadeMode() {} + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_darnavan : public CreatureScript { public: - npc_darnavan() : CreatureScript("npc_darnavan") { } + npc_darnavan() : CreatureScript("npc_darnavan") { } - struct npc_darnavanAI : public ScriptedAI - { - npc_darnavanAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_darnavanAI : public ScriptedAI + { + npc_darnavanAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; - bool _canCharge; - bool _canShatter; + EventMap events; + bool _canCharge; + bool _canShatter; - void Reset() - { - events.Reset(); - events.ScheduleEvent(EVENT_DARNAVAN_BLADESTORM, 10000); - events.ScheduleEvent(EVENT_DARNAVAN_INTIMIDATING_SHOUT, urand(20000, 25000)); - events.ScheduleEvent(EVENT_DARNAVAN_MORTAL_STRIKE, urand(25000, 30000)); - events.ScheduleEvent(EVENT_DARNAVAN_SUNDER_ARMOR, urand(5000, 8000)); - _canCharge = true; - _canShatter = true; - } + void Reset() + { + events.Reset(); + events.ScheduleEvent(EVENT_DARNAVAN_BLADESTORM, 10000); + events.ScheduleEvent(EVENT_DARNAVAN_INTIMIDATING_SHOUT, urand(20000, 25000)); + events.ScheduleEvent(EVENT_DARNAVAN_MORTAL_STRIKE, urand(25000, 30000)); + events.ScheduleEvent(EVENT_DARNAVAN_SUNDER_ARMOR, urand(5000, 8000)); + _canCharge = true; + _canShatter = true; + } - void JustDied(Unit* killer) - { - events.Reset(); - if (Player* owner = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - if (Group* group = owner->GetGroup()) - { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - if (Player* member = itr->GetSource()) - if (member->IsInMap(owner)) - member->FailQuest(QUEST_DEPROGRAMMING); - } - else - owner->FailQuest(QUEST_DEPROGRAMMING); - } - } + void JustDied(Unit* killer) + { + events.Reset(); + if (Player* owner = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + if (Group* group = owner->GetGroup()) + { + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Player* member = itr->GetSource()) + if (member->IsInMap(owner)) + member->FailQuest(QUEST_DEPROGRAMMING); + } + else + owner->FailQuest(QUEST_DEPROGRAMMING); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE || id != POINT_DESPAWN) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE || id != POINT_DESPAWN) + return; - me->DespawnOrUnsummon(); - } + me->DespawnOrUnsummon(); + } - void EnterCombat(Unit* /*victim*/) - { - DoZoneInCombat(); - Talk(SAY_DARNAVAN_AGGRO); - } + void EnterCombat(Unit* /*victim*/) + { + DoZoneInCombat(); + Talk(SAY_DARNAVAN_AGGRO); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (_canShatter && me->GetVictim() && me->GetVictim()->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_NORMAL)) - { - me->CastSpell(me->GetVictim(), SPELL_SHATTERING_THROW, false); - _canShatter = false; - events.ScheduleEvent(EVENT_DARNAVAN_SHATTERING_THROW, 30000); - return; - } + if (_canShatter && me->GetVictim() && me->GetVictim()->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_NORMAL)) + { + me->CastSpell(me->GetVictim(), SPELL_SHATTERING_THROW, false); + _canShatter = false; + events.ScheduleEvent(EVENT_DARNAVAN_SHATTERING_THROW, 30000); + return; + } - if (_canCharge && !me->IsWithinMeleeRange(me->GetVictim())) - { - me->CastSpell(me->GetVictim(), SPELL_CHARGE, false); - _canCharge = false; - events.ScheduleEvent(EVENT_DARNAVAN_CHARGE, 20000); - return; - } + if (_canCharge && !me->IsWithinMeleeRange(me->GetVictim())) + { + me->CastSpell(me->GetVictim(), SPELL_CHARGE, false); + _canCharge = false; + events.ScheduleEvent(EVENT_DARNAVAN_CHARGE, 20000); + return; + } - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_DARNAVAN_BLADESTORM: - me->CastSpell((Unit*)NULL, SPELL_BLADESTORM, false); - events.RepeatEvent(urand(90000, 100000)); - break; - case EVENT_DARNAVAN_CHARGE: - _canCharge = true; - events.PopEvent(); - break; - case EVENT_DARNAVAN_INTIMIDATING_SHOUT: - me->CastSpell((Unit*)NULL, SPELL_INTIMIDATING_SHOUT, false); - events.RepeatEvent((90000, 120000)); - break; - case EVENT_DARNAVAN_MORTAL_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); - events.RepeatEvent(urand(15000, 30000)); - break; - case EVENT_DARNAVAN_SHATTERING_THROW: - _canShatter = true; - events.PopEvent(); - break; - case EVENT_DARNAVAN_SUNDER_ARMOR: - me->CastSpell(me->GetVictim(), SPELL_SUNDER_ARMOR, false); - events.RepeatEvent(urand(3000, 7000)); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_DARNAVAN_BLADESTORM: + me->CastSpell((Unit*)NULL, SPELL_BLADESTORM, false); + events.RepeatEvent(urand(90000, 100000)); + break; + case EVENT_DARNAVAN_CHARGE: + _canCharge = true; + events.PopEvent(); + break; + case EVENT_DARNAVAN_INTIMIDATING_SHOUT: + me->CastSpell((Unit*)NULL, SPELL_INTIMIDATING_SHOUT, false); + events.RepeatEvent((90000, 120000)); + break; + case EVENT_DARNAVAN_MORTAL_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); + events.RepeatEvent(urand(15000, 30000)); + break; + case EVENT_DARNAVAN_SHATTERING_THROW: + _canShatter = true; + events.PopEvent(); + break; + case EVENT_DARNAVAN_SUNDER_ARMOR: + me->CastSpell(me->GetVictim(), SPELL_SUNDER_ARMOR, false); + events.RepeatEvent(urand(3000, 7000)); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_deathwhisper_mana_barrier : public SpellScriptLoader { - public: - spell_deathwhisper_mana_barrier() : SpellScriptLoader("spell_deathwhisper_mana_barrier") { } + public: + spell_deathwhisper_mana_barrier() : SpellScriptLoader("spell_deathwhisper_mana_barrier") { } - class spell_deathwhisper_mana_barrier_AuraScript : public AuraScript - { - PrepareAuraScript(spell_deathwhisper_mana_barrier_AuraScript); + class spell_deathwhisper_mana_barrier_AuraScript : public AuraScript + { + PrepareAuraScript(spell_deathwhisper_mana_barrier_AuraScript); - void HandlePeriodicTick(AuraEffect const* /*aurEff*/) - { - PreventDefaultAction(); - if (Unit* caster = GetCaster()) - { - int32 missingHealth = int32(caster->GetMaxHealth() - caster->GetHealth()); - caster->ModifyHealth(missingHealth); - caster->ModifyPower(POWER_MANA, -missingHealth); - } - } + void HandlePeriodicTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + { + int32 missingHealth = int32(caster->GetMaxHealth() - caster->GetHealth()); + caster->ModifyHealth(missingHealth); + caster->ModifyPower(POWER_MANA, -missingHealth); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_deathwhisper_mana_barrier_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_deathwhisper_mana_barrier_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_deathwhisper_mana_barrier_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_deathwhisper_mana_barrier_AuraScript(); + } }; class spell_cultist_dark_martyrdom : public SpellScriptLoader { public: - spell_cultist_dark_martyrdom() : SpellScriptLoader("spell_cultist_dark_martyrdom") { } + spell_cultist_dark_martyrdom() : SpellScriptLoader("spell_cultist_dark_martyrdom") { } - class spell_cultist_dark_martyrdom_SpellScript : public SpellScript - { - PrepareSpellScript(spell_cultist_dark_martyrdom_SpellScript); + class spell_cultist_dark_martyrdom_SpellScript : public SpellScript + { + PrepareSpellScript(spell_cultist_dark_martyrdom_SpellScript); - void HandleEffect(SpellEffIndex /*effIndex*/) - { - if (GetCaster()->ToTempSummon()) - if (Unit* owner = GetCaster()->ToTempSummon()->GetSummoner()) - owner->GetAI()->SetGUID(GetCaster()->GetGUID()); + void HandleEffect(SpellEffIndex /*effIndex*/) + { + if (GetCaster()->ToTempSummon()) + if (Unit* owner = GetCaster()->ToTempSummon()->GetSummoner()) + owner->GetAI()->SetGUID(GetCaster()->GetGUID()); - if (Creature* caster = GetCaster()->ToCreature()) - caster->AI()->DoAction(-1); - GetCaster()->SetDisplayId(GetCaster()->GetEntry() == NPC_CULT_FANATIC ? 30968 : 30966); - } + if (Creature* caster = GetCaster()->ToCreature()) + caster->AI()->DoAction(-1); + GetCaster()->SetDisplayId(GetCaster()->GetEntry() == NPC_CULT_FANATIC ? 30968 : 30966); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_cultist_dark_martyrdom_SpellScript::HandleEffect, EFFECT_2, SPELL_EFFECT_FORCE_DESELECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_cultist_dark_martyrdom_SpellScript::HandleEffect, EFFECT_2, SPELL_EFFECT_FORCE_DESELECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_cultist_dark_martyrdom_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_cultist_dark_martyrdom_SpellScript(); + } }; void AddSC_boss_lady_deathwhisper() { - new boss_lady_deathwhisper(); - new npc_cult_fanatic(); - new npc_cult_adherent(); - new npc_vengeful_shade(); - new npc_darnavan(); - new spell_deathwhisper_mana_barrier(); - new spell_cultist_dark_martyrdom(); + new boss_lady_deathwhisper(); + new npc_cult_fanatic(); + new npc_cult_adherent(); + new npc_vengeful_shade(); + new npc_darnavan(); + new spell_deathwhisper_mana_barrier(); + new spell_cultist_dark_martyrdom(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 032ba6170..2b259d76e 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -14,635 +14,635 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum ScriptTexts { - SAY_ENTER_ZONE = 0, - SAY_AGGRO = 1, - SAY_BONE_STORM = 2, - SAY_BONESPIKE = 3, - SAY_KILL = 4, - SAY_DEATH = 5, - SAY_BERSERK = 6, - EMOTE_BONE_STORM = 7, + SAY_ENTER_ZONE = 0, + SAY_AGGRO = 1, + SAY_BONE_STORM = 2, + SAY_BONESPIKE = 3, + SAY_KILL = 4, + SAY_DEATH = 5, + SAY_BERSERK = 6, + EMOTE_BONE_STORM = 7, }; enum Spells { - // Lord Marrowgar - SPELL_BONE_SLICE = 69055, - SPELL_BONE_STORM = 69076, - SPELL_BONE_SPIKE_GRAVEYARD = 69057, - SPELL_COLDFLAME_NORMAL = 69140, - SPELL_COLDFLAME_BONE_STORM = 72705, + // Lord Marrowgar + SPELL_BONE_SLICE = 69055, + SPELL_BONE_STORM = 69076, + SPELL_BONE_SPIKE_GRAVEYARD = 69057, + SPELL_COLDFLAME_NORMAL = 69140, + SPELL_COLDFLAME_BONE_STORM = 72705, - // Bone Spike - SPELL_IMPALED = 69065, - SPELL_RIDE_VEHICLE = 46598, + // Bone Spike + SPELL_IMPALED = 69065, + SPELL_RIDE_VEHICLE = 46598, - // Coldflame - SPELL_COLDFLAME_PASSIVE = 69145, - SPELL_COLDFLAME_SUMMON = 69147, + // Coldflame + SPELL_COLDFLAME_PASSIVE = 69145, + SPELL_COLDFLAME_SUMMON = 69147, }; enum Events { - EVENT_ENABLE_BONE_SLICE = 1, - EVENT_SPELL_BONE_SPIKE_GRAVEYARD, - EVENT_SPELL_COLDFLAME, - EVENT_SPELL_COLDFLAME_BONE_STORM, - EVENT_WARN_BONE_STORM, - EVENT_BEGIN_BONE_STORM, - EVENT_BONE_STORM_MOVE, - EVENT_END_BONE_STORM, - EVENT_ENRAGE, + EVENT_ENABLE_BONE_SLICE = 1, + EVENT_SPELL_BONE_SPIKE_GRAVEYARD, + EVENT_SPELL_COLDFLAME, + EVENT_SPELL_COLDFLAME_BONE_STORM, + EVENT_WARN_BONE_STORM, + EVENT_BEGIN_BONE_STORM, + EVENT_BONE_STORM_MOVE, + EVENT_END_BONE_STORM, + EVENT_ENRAGE, }; uint32 const boneSpikeSummonId[3] = {69062, 72669, 72670}; struct BoneStormMoveTargetSelector : public std::unary_function { - public: - BoneStormMoveTargetSelector(Creature* source) : _source(source) { } - bool operator()(Unit const* target) const - { - if (!target) - return false; + public: + BoneStormMoveTargetSelector(Creature* source) : _source(source) { } + bool operator()(Unit const* target) const + { + if (!target) + return false; - if (target->GetExactDist(_source) > 175.0f) - return false; + if (target->GetExactDist(_source) > 175.0f) + return false; - if (target->GetTypeId() != TYPEID_PLAYER) - return false; + if (target->GetTypeId() != TYPEID_PLAYER) + return false; - if (target->GetPositionX() > -337.0f) - return false; + if (target->GetPositionX() > -337.0f) + return false; - return target != _source->GetVictim(); - } + return target != _source->GetVictim(); + } - private: - Creature const* _source; + private: + Creature const* _source; }; class boss_lord_marrowgar : public CreatureScript { - public: - boss_lord_marrowgar() : CreatureScript("boss_lord_marrowgar") { } + public: + boss_lord_marrowgar() : CreatureScript("boss_lord_marrowgar") { } - struct boss_lord_marrowgarAI : public BossAI - { - boss_lord_marrowgarAI(Creature* creature) : BossAI(creature, DATA_LORD_MARROWGAR) - { - _introDone = false; - _boneSlice = false; - } + struct boss_lord_marrowgarAI : public BossAI + { + boss_lord_marrowgarAI(Creature* creature) : BossAI(creature, DATA_LORD_MARROWGAR) + { + _introDone = false; + _boneSlice = false; + } - bool _introDone; - bool _boneSlice; - uint64 _lastBoneSliceTargets[3]; + bool _introDone; + bool _boneSlice; + uint64 _lastBoneSliceTargets[3]; - void Reset() - { - me->SetReactState(REACT_AGGRESSIVE); - _Reset(); - events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000); - events.ScheduleEvent(EVENT_SPELL_BONE_SPIKE_GRAVEYARD, urand(10000, 15000)); - events.ScheduleEvent(EVENT_SPELL_COLDFLAME, 5000); - events.ScheduleEvent(EVENT_WARN_BONE_STORM, urand(45000, 50000)); - events.ScheduleEvent(EVENT_ENRAGE, 600000); + void Reset() + { + me->SetReactState(REACT_AGGRESSIVE); + _Reset(); + events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000); + events.ScheduleEvent(EVENT_SPELL_BONE_SPIKE_GRAVEYARD, urand(10000, 15000)); + events.ScheduleEvent(EVENT_SPELL_COLDFLAME, 5000); + events.ScheduleEvent(EVENT_WARN_BONE_STORM, urand(45000, 50000)); + events.ScheduleEvent(EVENT_ENRAGE, 600000); - _boneSlice = false; - memset(_lastBoneSliceTargets, 0, 3 * sizeof(uint64)); + _boneSlice = false; + memset(_lastBoneSliceTargets, 0, 3 * sizeof(uint64)); - instance->SetData(DATA_BONED_ACHIEVEMENT, uint32(true)); - } + instance->SetData(DATA_BONED_ACHIEVEMENT, uint32(true)); + } - void EnterCombat(Unit* /*who*/) - { - Talk(SAY_AGGRO); - me->setActive(true); - DoZoneInCombat(); - instance->SetBossState(DATA_LORD_MARROWGAR, IN_PROGRESS); - } + void EnterCombat(Unit* /*who*/) + { + Talk(SAY_AGGRO); + me->setActive(true); + DoZoneInCombat(); + instance->SetBossState(DATA_LORD_MARROWGAR, IN_PROGRESS); + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (target && (spell->Id == 69055 || spell->Id == 70814)) // Bone Slice (Saber Lash) - for (uint8 i=0; i<3; ++i) - if (!_lastBoneSliceTargets[i]) - { - _lastBoneSliceTargets[i] = target->GetGUID(); - break; - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (target && (spell->Id == 69055 || spell->Id == 70814)) // Bone Slice (Saber Lash) + for (uint8 i=0; i<3; ++i) + if (!_lastBoneSliceTargets[i]) + { + _lastBoneSliceTargets[i] = target->GetGUID(); + break; + } + } - uint64 GetGUID(int32 id) const - { - if (id >= 0 && id <= 2) - return _lastBoneSliceTargets[id]; + uint64 GetGUID(int32 id) const + { + if (id >= 0 && id <= 2) + return _lastBoneSliceTargets[id]; - return (uint64)0; - } + return (uint64)0; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() || !CheckInRoom()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() || !CheckInRoom()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_ENABLE_BONE_SLICE: - _boneSlice = true; - events.PopEvent(); - break; - case EVENT_SPELL_BONE_SPIKE_GRAVEYARD: - { - bool a = me->HasAura(SPELL_BONE_STORM); - if (IsHeroic() || !a) - me->CastSpell(me, SPELL_BONE_SPIKE_GRAVEYARD, a); - events.RepeatEvent(urand(15000, 20000)); - } - break; - case EVENT_SPELL_COLDFLAME: - if (!me->HasAura(SPELL_BONE_STORM)) - me->CastSpell((Unit*)NULL, SPELL_COLDFLAME_NORMAL, false); - events.RepeatEvent(5000); - break; - case EVENT_SPELL_COLDFLAME_BONE_STORM: - me->CastSpell(me, SPELL_COLDFLAME_BONE_STORM, false); - events.PopEvent(); - break; - case EVENT_WARN_BONE_STORM: - _boneSlice = false; - Talk(EMOTE_BONE_STORM); - Talk(SAY_BONE_STORM); - me->FinishSpell(CURRENT_MELEE_SPELL, false); - me->CastSpell(me, SPELL_BONE_STORM, false); - me->SetReactState(REACT_PASSIVE); // to prevent chasing another target on UpdateVictim() - me->GetMotionMaster()->MoveIdle(); - me->GetMotionMaster()->MovementExpired(); - events.RepeatEvent(urand(90000, 95000)); - events.ScheduleEvent(EVENT_BEGIN_BONE_STORM, 3050); - break; - case EVENT_BEGIN_BONE_STORM: - { - uint32 _boneStormDuration = RAID_MODE(20000, 30000, 20000, 30000); - if (Aura* pStorm = me->GetAura(SPELL_BONE_STORM)) - pStorm->SetDuration(int32(_boneStormDuration)); - events.PopEvent(); - events.ScheduleEvent(EVENT_BONE_STORM_MOVE, 0); - events.ScheduleEvent(EVENT_END_BONE_STORM, _boneStormDuration+1); - } - break; - case EVENT_BONE_STORM_MOVE: - { - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) - { - events.RepeatEvent(1); - break; - } - events.RepeatEvent(5000); - Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0, BoneStormMoveTargetSelector(me)); - if (!unit) - { - if (unit = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 175.0f, true)) - if (unit->GetPositionX() > -337.0f) - { - EnterEvadeMode(); - return; - } - } - if (unit) - me->GetMotionMaster()->MoveCharge(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), 25.0f, 1337); - break; - } - break; - case EVENT_END_BONE_STORM: - me->StopMoving(); - me->GetMotionMaster()->MovementExpired(); - me->SetReactState(REACT_AGGRESSIVE); - DoStartMovement(me->GetVictim()); - events.PopEvent(); - events.CancelEvent(EVENT_BONE_STORM_MOVE); - events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000); - if (!IsHeroic()) - events.RescheduleEvent(EVENT_SPELL_BONE_SPIKE_GRAVEYARD, urand(15000, 20000)); - break; - case EVENT_ENRAGE: - me->CastSpell(me, SPELL_BERSERK, true); - Talk(SAY_BERSERK); - events.PopEvent(); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_ENABLE_BONE_SLICE: + _boneSlice = true; + events.PopEvent(); + break; + case EVENT_SPELL_BONE_SPIKE_GRAVEYARD: + { + bool a = me->HasAura(SPELL_BONE_STORM); + if (IsHeroic() || !a) + me->CastSpell(me, SPELL_BONE_SPIKE_GRAVEYARD, a); + events.RepeatEvent(urand(15000, 20000)); + } + break; + case EVENT_SPELL_COLDFLAME: + if (!me->HasAura(SPELL_BONE_STORM)) + me->CastSpell((Unit*)NULL, SPELL_COLDFLAME_NORMAL, false); + events.RepeatEvent(5000); + break; + case EVENT_SPELL_COLDFLAME_BONE_STORM: + me->CastSpell(me, SPELL_COLDFLAME_BONE_STORM, false); + events.PopEvent(); + break; + case EVENT_WARN_BONE_STORM: + _boneSlice = false; + Talk(EMOTE_BONE_STORM); + Talk(SAY_BONE_STORM); + me->FinishSpell(CURRENT_MELEE_SPELL, false); + me->CastSpell(me, SPELL_BONE_STORM, false); + me->SetReactState(REACT_PASSIVE); // to prevent chasing another target on UpdateVictim() + me->GetMotionMaster()->MoveIdle(); + me->GetMotionMaster()->MovementExpired(); + events.RepeatEvent(urand(90000, 95000)); + events.ScheduleEvent(EVENT_BEGIN_BONE_STORM, 3050); + break; + case EVENT_BEGIN_BONE_STORM: + { + uint32 _boneStormDuration = RAID_MODE(20000, 30000, 20000, 30000); + if (Aura* pStorm = me->GetAura(SPELL_BONE_STORM)) + pStorm->SetDuration(int32(_boneStormDuration)); + events.PopEvent(); + events.ScheduleEvent(EVENT_BONE_STORM_MOVE, 0); + events.ScheduleEvent(EVENT_END_BONE_STORM, _boneStormDuration+1); + } + break; + case EVENT_BONE_STORM_MOVE: + { + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) + { + events.RepeatEvent(1); + break; + } + events.RepeatEvent(5000); + Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0, BoneStormMoveTargetSelector(me)); + if (!unit) + { + if (unit = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 175.0f, true)) + if (unit->GetPositionX() > -337.0f) + { + EnterEvadeMode(); + return; + } + } + if (unit) + me->GetMotionMaster()->MoveCharge(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), 25.0f, 1337); + break; + } + break; + case EVENT_END_BONE_STORM: + me->StopMoving(); + me->GetMotionMaster()->MovementExpired(); + me->SetReactState(REACT_AGGRESSIVE); + DoStartMovement(me->GetVictim()); + events.PopEvent(); + events.CancelEvent(EVENT_BONE_STORM_MOVE); + events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000); + if (!IsHeroic()) + events.RescheduleEvent(EVENT_SPELL_BONE_SPIKE_GRAVEYARD, urand(15000, 20000)); + break; + case EVENT_ENRAGE: + me->CastSpell(me, SPELL_BERSERK, true); + Talk(SAY_BERSERK); + events.PopEvent(); + break; + } - if (me->HasAura(SPELL_BONE_STORM)) - return; + if (me->HasAura(SPELL_BONE_STORM)) + return; - if (_boneSlice && !me->GetCurrentSpell(CURRENT_MELEE_SPELL)) - DoCastVictim(SPELL_BONE_SLICE); + if (_boneSlice && !me->GetCurrentSpell(CURRENT_MELEE_SPELL)) + DoCastVictim(SPELL_BONE_SLICE); - if (_boneSlice && me->isAttackReady() && me->GetVictim() && !me->HasUnitState(UNIT_STATE_CASTING) && me->IsWithinMeleeRange(me->GetVictim())) - memset(_lastBoneSliceTargets, 0, 3 * sizeof(uint64)); + if (_boneSlice && me->isAttackReady() && me->GetVictim() && !me->HasUnitState(UNIT_STATE_CASTING) && me->IsWithinMeleeRange(me->GetVictim())) + memset(_lastBoneSliceTargets, 0, 3 * sizeof(uint64)); - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE || id != 1337) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE || id != 1337) + return; - events.ScheduleEvent(EVENT_SPELL_COLDFLAME_BONE_STORM, 0); - } + events.ScheduleEvent(EVENT_SPELL_COLDFLAME_BONE_STORM, 0); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - _JustDied(); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + _JustDied(); + } - void JustReachedHome() - { - _JustReachedHome(); - instance->SetBossState(DATA_LORD_MARROWGAR, FAIL); - } + void JustReachedHome() + { + _JustReachedHome(); + instance->SetBossState(DATA_LORD_MARROWGAR, FAIL); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } - void MoveInLineOfSight(Unit* who) - { - if (!_introDone && me->IsAlive() && who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2dSq(who) <= 10000.0f) // 100*100, moveinlineofsight limited to 60yd anyway - { - Talk(SAY_ENTER_ZONE); - _introDone = true; - } + void MoveInLineOfSight(Unit* who) + { + if (!_introDone && me->IsAlive() && who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2dSq(who) <= 10000.0f) // 100*100, moveinlineofsight limited to 60yd anyway + { + Talk(SAY_ENTER_ZONE); + _introDone = true; + } - BossAI::MoveInLineOfSight(who); - } + BossAI::MoveInLineOfSight(who); + } - bool CanAIAttack(Unit const* target) const - { - return target->GetPositionX() < -337.0f; // main gate - } - }; + bool CanAIAttack(Unit const* target) const + { + return target->GetPositionX() < -337.0f; // main gate + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_coldflame : public CreatureScript { public: - npc_coldflame() : CreatureScript("npc_coldflame") { } + npc_coldflame() : CreatureScript("npc_coldflame") { } - struct npc_coldflameAI : public NullCreatureAI - { - npc_coldflameAI(Creature* creature) : NullCreatureAI(creature) - { - } + struct npc_coldflameAI : public NullCreatureAI + { + npc_coldflameAI(Creature* creature) : NullCreatureAI(creature) + { + } - EventMap events; + EventMap events; - void IsSummonedBy(Unit* /*summoner*/) - { - events.ScheduleEvent(1, 450); - events.ScheduleEvent(2, 12000); - me->m_positionZ = 42.5f; - } + void IsSummonedBy(Unit* /*summoner*/) + { + events.ScheduleEvent(1, 450); + events.ScheduleEvent(2, 12000); + me->m_positionZ = 42.5f; + } - void UpdateAI(uint32 diff) - { - events.Update(diff); + void UpdateAI(uint32 diff) + { + events.Update(diff); - switch (events.GetEvent()) - { - case 0: - break; - case 1: - { - me->m_positionZ = 42.5f; - me->DisableSpline(); - me->CastSpell(me, SPELL_COLDFLAME_SUMMON, true); - float nx = me->GetPositionX()+5.0f*cos(me->GetOrientation()); - float ny = me->GetPositionY()+5.0f*sin(me->GetOrientation()); - if (!me->IsWithinLOS(nx, ny, 42.5f)) - { - events.PopEvent(); - break; - } - me->NearTeleportTo(nx, ny, 42.5f, me->GetOrientation()); - events.RepeatEvent(450); - } - break; - case 2: - events.Reset(); - break; - } - } - }; + switch (events.GetEvent()) + { + case 0: + break; + case 1: + { + me->m_positionZ = 42.5f; + me->DisableSpline(); + me->CastSpell(me, SPELL_COLDFLAME_SUMMON, true); + float nx = me->GetPositionX()+5.0f*cos(me->GetOrientation()); + float ny = me->GetPositionY()+5.0f*sin(me->GetOrientation()); + if (!me->IsWithinLOS(nx, ny, 42.5f)) + { + events.PopEvent(); + break; + } + me->NearTeleportTo(nx, ny, 42.5f, me->GetOrientation()); + events.RepeatEvent(450); + } + break; + case 2: + events.Reset(); + break; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_bone_spike : public CreatureScript { public: - npc_bone_spike() : CreatureScript("npc_bone_spike") { } + npc_bone_spike() : CreatureScript("npc_bone_spike") { } - struct npc_bone_spikeAI : public NullCreatureAI - { - npc_bone_spikeAI(Creature* creature) : NullCreatureAI(creature), hasTrappedUnit(false) - { - } + struct npc_bone_spikeAI : public NullCreatureAI + { + npc_bone_spikeAI(Creature* creature) : NullCreatureAI(creature), hasTrappedUnit(false) + { + } - EventMap events; - bool hasTrappedUnit; + EventMap events; + bool hasTrappedUnit; - void DoAction(int32 action) - { - if (action != -1337) - return; + void DoAction(int32 action) + { + if (action != -1337) + return; - if (TempSummon* summ = me->ToTempSummon()) - if (Unit* trapped = summ->GetSummoner()) - { - Position exitPos = {me->GetPositionX(), me->GetPositionY(), 60.0f, me->GetOrientation()}; - trapped->UpdateAllowedPositionZ(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.m_positionZ); - exitPos.m_positionZ += 1.0f; - if (Unit* vehBase = trapped->GetVehicleBase()) - vehBase->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, trapped->GetGUID()); - trapped->_ExitVehicle(&exitPos); - trapped->RemoveAurasDueToSpell(SPELL_IMPALED); - trapped->GetMotionMaster()->Clear(); - trapped->UpdatePosition(exitPos, true); - trapped->StopMovingOnCurrentPos(); - trapped->NearTeleportTo(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.GetPositionZ(), exitPos.GetOrientation(), false); - } + if (TempSummon* summ = me->ToTempSummon()) + if (Unit* trapped = summ->GetSummoner()) + { + Position exitPos = {me->GetPositionX(), me->GetPositionY(), 60.0f, me->GetOrientation()}; + trapped->UpdateAllowedPositionZ(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.m_positionZ); + exitPos.m_positionZ += 1.0f; + if (Unit* vehBase = trapped->GetVehicleBase()) + vehBase->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, trapped->GetGUID()); + trapped->_ExitVehicle(&exitPos); + trapped->RemoveAurasDueToSpell(SPELL_IMPALED); + trapped->GetMotionMaster()->Clear(); + trapped->UpdatePosition(exitPos, true); + trapped->StopMovingOnCurrentPos(); + trapped->NearTeleportTo(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.GetPositionZ(), exitPos.GetOrientation(), false); + } - me->DespawnOrUnsummon(1); - } + me->DespawnOrUnsummon(1); + } - void JustDied(Unit* /*killer*/) - { - DoAction(-1337); - } + void JustDied(Unit* /*killer*/) + { + DoAction(-1337); + } - void IsSummonedBy(Unit* summoner) - { - if (!summoner) - return; + void IsSummonedBy(Unit* summoner) + { + if (!summoner) + return; - if (Vehicle* v = summoner->GetVehicle()) - if (Unit* u = v->GetBase()) - if (u->GetEntry() == NPC_BONE_SPIKE && u->GetTypeId() == TYPEID_UNIT) - u->ToCreature()->AI()->DoAction(-1337); + if (Vehicle* v = summoner->GetVehicle()) + if (Unit* u = v->GetBase()) + if (u->GetEntry() == NPC_BONE_SPIKE && u->GetTypeId() == TYPEID_UNIT) + u->ToCreature()->AI()->DoAction(-1337); - uint64 petGUID = summoner->GetPetGUID(); - summoner->SetPetGUID(0); - me->CastSpell(summoner, SPELL_IMPALED, true); - summoner->CastSpell(me, SPELL_RIDE_VEHICLE, true); - //summoner->ClearUnitState(UNIT_STATE_ONVEHICLE); - summoner->SetPetGUID(petGUID); - summoner->GetMotionMaster()->Clear(); - summoner->StopMoving(); - events.ScheduleEvent(1, 8000); - hasTrappedUnit = true; - } + uint64 petGUID = summoner->GetPetGUID(); + summoner->SetPetGUID(0); + me->CastSpell(summoner, SPELL_IMPALED, true); + summoner->CastSpell(me, SPELL_RIDE_VEHICLE, true); + //summoner->ClearUnitState(UNIT_STATE_ONVEHICLE); + summoner->SetPetGUID(petGUID); + summoner->GetMotionMaster()->Clear(); + summoner->StopMoving(); + events.ScheduleEvent(1, 8000); + hasTrappedUnit = true; + } - void UpdateAI(uint32 diff) - { - if (!hasTrappedUnit || !me->IsAlive()) - return; + void UpdateAI(uint32 diff) + { + if (!hasTrappedUnit || !me->IsAlive()) + return; - if (TempSummon* summ = me->ToTempSummon()) - { - if (Unit* trapped = summ->GetSummoner()) - { - if (!trapped->IsOnVehicle(me) || !trapped->IsAlive() || !me->GetInstanceScript() || me->GetInstanceScript()->GetBossState(DATA_LORD_MARROWGAR) != IN_PROGRESS || trapped->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) - { - DoAction(-1337); - return; - } - } - else - { - me->DespawnOrUnsummon(1); - return; - } - } - else - { - me->DespawnOrUnsummon(1); - return; - } + if (TempSummon* summ = me->ToTempSummon()) + { + if (Unit* trapped = summ->GetSummoner()) + { + if (!trapped->IsOnVehicle(me) || !trapped->IsAlive() || !me->GetInstanceScript() || me->GetInstanceScript()->GetBossState(DATA_LORD_MARROWGAR) != IN_PROGRESS || trapped->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) + { + DoAction(-1337); + return; + } + } + else + { + me->DespawnOrUnsummon(1); + return; + } + } + else + { + me->DespawnOrUnsummon(1); + return; + } - events.Update(diff); + events.Update(diff); - if (events.ExecuteEvent() == 1) - if (InstanceScript* instance = me->GetInstanceScript()) - instance->SetData(DATA_BONED_ACHIEVEMENT, uint32(false)); - } - }; + if (events.ExecuteEvent() == 1) + if (InstanceScript* instance = me->GetInstanceScript()) + instance->SetData(DATA_BONED_ACHIEVEMENT, uint32(false)); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_marrowgar_coldflame : public SpellScriptLoader { public: - spell_marrowgar_coldflame() : SpellScriptLoader("spell_marrowgar_coldflame") { } + spell_marrowgar_coldflame() : SpellScriptLoader("spell_marrowgar_coldflame") { } - class spell_marrowgar_coldflame_SpellScript : public SpellScript - { - PrepareSpellScript(spell_marrowgar_coldflame_SpellScript); + class spell_marrowgar_coldflame_SpellScript : public SpellScript + { + PrepareSpellScript(spell_marrowgar_coldflame_SpellScript); - void SelectTarget(std::list& targets) - { - targets.clear(); - Unit* target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 1, -1.0f, true, -SPELL_IMPALED); // -1.0f as it takes into account object size - if (!target) - target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); // if only tank or noone outside of boss' model - if (!target) - return; + void SelectTarget(std::list& targets) + { + targets.clear(); + Unit* target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 1, -1.0f, true, -SPELL_IMPALED); // -1.0f as it takes into account object size + if (!target) + target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); // if only tank or noone outside of boss' model + if (!target) + return; - targets.push_back(target); - } + targets.push_back(target); + } - void HandleScriptEffect(SpellEffIndex effIndex) - { - Unit* caster = GetCaster(); - float angle = caster->GetAngle(GetHitUnit()); - float dist = caster->GetObjectSize()/2.0f; - float z = caster->GetPositionZ()+2.5f; - float nx = caster->GetPositionX()+dist*cos(angle); - float ny = caster->GetPositionY()+dist*sin(angle); + void HandleScriptEffect(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + float angle = caster->GetAngle(GetHitUnit()); + float dist = caster->GetObjectSize()/2.0f; + float z = caster->GetPositionZ()+2.5f; + float nx = caster->GetPositionX()+dist*cos(angle); + float ny = caster->GetPositionY()+dist*sin(angle); - if (!caster->IsWithinLOS(nx, ny, z)) - { - nx = caster->GetPositionX()+0.5f*cos(angle); - ny = caster->GetPositionY()+0.5f*sin(angle); - } + if (!caster->IsWithinLOS(nx, ny, z)) + { + nx = caster->GetPositionX()+0.5f*cos(angle); + ny = caster->GetPositionY()+0.5f*sin(angle); + } - if (caster->IsWithinLOS(nx, ny, z)) - { - caster->m_orientation = angle; - caster->CastSpell(nx, ny, z, uint32(GetEffectValue()), true); - } - } + if (caster->IsWithinLOS(nx, ny, z)) + { + caster->m_orientation = angle; + caster->CastSpell(nx, ny, z, uint32(GetEffectValue()), true); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_marrowgar_coldflame_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_marrowgar_coldflame_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_marrowgar_coldflame_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_marrowgar_coldflame_SpellScript(); + } }; class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader { public: - spell_marrowgar_bone_spike_graveyard() : SpellScriptLoader("spell_marrowgar_bone_spike_graveyard") { } + spell_marrowgar_bone_spike_graveyard() : SpellScriptLoader("spell_marrowgar_bone_spike_graveyard") { } - class spell_marrowgar_bone_spike_graveyard_SpellScript : public SpellScript - { - PrepareSpellScript(spell_marrowgar_bone_spike_graveyard_SpellScript); + class spell_marrowgar_bone_spike_graveyard_SpellScript : public SpellScript + { + PrepareSpellScript(spell_marrowgar_bone_spike_graveyard_SpellScript); - void HandleSpikes(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Creature* marrowgar = GetCaster()->ToCreature()) - { - bool didHit = false; - CreatureAI* marrowgarAI = marrowgar->AI(); - uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1); + void HandleSpikes(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Creature* marrowgar = GetCaster()->ToCreature()) + { + bool didHit = false; + CreatureAI* marrowgarAI = marrowgar->AI(); + uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1); - std::vector validPlayers; - Map::PlayerList const &pList = marrowgar->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (Player* plr = itr->GetSource()) - if (plr->IsAlive() && !plr->IsGameMaster() && plr->GetExactDist2dSq(marrowgar) < (150.0f * 150.0f) && !plr->HasAura(SPELL_IMPALED)) - if (!marrowgar->GetVictim() || marrowgar->GetVictim()->GetGUID() != plr->GetGUID()) - if (plr->GetGUID() != marrowgarAI->GetGUID(0) && plr->GetGUID() != marrowgarAI->GetGUID(1) && plr->GetGUID() != marrowgarAI->GetGUID(2)) // not a bone slice target - validPlayers.push_back(plr); + std::vector validPlayers; + Map::PlayerList const &pList = marrowgar->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if (Player* plr = itr->GetSource()) + if (plr->IsAlive() && !plr->IsGameMaster() && plr->GetExactDist2dSq(marrowgar) < (150.0f * 150.0f) && !plr->HasAura(SPELL_IMPALED)) + if (!marrowgar->GetVictim() || marrowgar->GetVictim()->GetGUID() != plr->GetGUID()) + if (plr->GetGUID() != marrowgarAI->GetGUID(0) && plr->GetGUID() != marrowgarAI->GetGUID(1) && plr->GetGUID() != marrowgarAI->GetGUID(2)) // not a bone slice target + validPlayers.push_back(plr); - std::vector::iterator begin=validPlayers.begin(), end=validPlayers.end(); - std::random_shuffle(begin, end); + std::vector::iterator begin=validPlayers.begin(), end=validPlayers.end(); + std::random_shuffle(begin, end); - for (uint8 i = 0; i < boneSpikeCount && i < validPlayers.size(); ++i) - { - Unit* target = validPlayers[i]; - didHit = true; - //target->CastCustomSpell(boneSpikeSummonId[i], SPELLVALUE_BASE_POINT0, 0, target, true); - target->CastSpell(target, boneSpikeSummonId[i], true); - } + for (uint8 i = 0; i < boneSpikeCount && i < validPlayers.size(); ++i) + { + Unit* target = validPlayers[i]; + didHit = true; + //target->CastCustomSpell(boneSpikeSummonId[i], SPELLVALUE_BASE_POINT0, 0, target, true); + target->CastSpell(target, boneSpikeSummonId[i], true); + } - if (didHit) - marrowgarAI->Talk(SAY_BONESPIKE); - } - } + if (didHit) + marrowgarAI->Talk(SAY_BONESPIKE); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_marrowgar_bone_spike_graveyard_SpellScript::HandleSpikes, EFFECT_1, SPELL_EFFECT_APPLY_AURA); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_marrowgar_bone_spike_graveyard_SpellScript::HandleSpikes, EFFECT_1, SPELL_EFFECT_APPLY_AURA); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_marrowgar_bone_spike_graveyard_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_marrowgar_bone_spike_graveyard_SpellScript(); + } }; class spell_marrowgar_coldflame_bonestorm : public SpellScriptLoader { - public: - spell_marrowgar_coldflame_bonestorm() : SpellScriptLoader("spell_marrowgar_coldflame_bonestorm") { } + public: + spell_marrowgar_coldflame_bonestorm() : SpellScriptLoader("spell_marrowgar_coldflame_bonestorm") { } - class spell_marrowgar_coldflame_SpellScript : public SpellScript - { - PrepareSpellScript(spell_marrowgar_coldflame_SpellScript); + class spell_marrowgar_coldflame_SpellScript : public SpellScript + { + PrepareSpellScript(spell_marrowgar_coldflame_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - Unit* caster = GetCaster(); - float x = caster->GetPositionX(); - float y = caster->GetPositionY(); - float z = caster->GetPositionZ()+2.5f; - for (uint8 i = 0; i < 4; ++i) - { - float nx = x+2.5f*cos((M_PI/4)+(i*(M_PI/2))); - float ny = y+2.5f*sin((M_PI/4)+(i*(M_PI/2))); - if (caster->IsWithinLOS(nx, ny, z)) - { - caster->m_orientation = (M_PI/4)+(i*(M_PI/2)); - caster->CastSpell(nx, ny, z, uint32(GetEffectValue() + i), true); - } - } - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Unit* caster = GetCaster(); + float x = caster->GetPositionX(); + float y = caster->GetPositionY(); + float z = caster->GetPositionZ()+2.5f; + for (uint8 i = 0; i < 4; ++i) + { + float nx = x+2.5f*cos((M_PI/4)+(i*(M_PI/2))); + float ny = y+2.5f*sin((M_PI/4)+(i*(M_PI/2))); + if (caster->IsWithinLOS(nx, ny, z)) + { + caster->m_orientation = (M_PI/4)+(i*(M_PI/2)); + caster->CastSpell(nx, ny, z, uint32(GetEffectValue() + i), true); + } + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_marrowgar_coldflame_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_marrowgar_coldflame_SpellScript(); + } }; class spell_marrowgar_bone_storm : public SpellScriptLoader { - public: - spell_marrowgar_bone_storm() : SpellScriptLoader("spell_marrowgar_bone_storm") { } + public: + spell_marrowgar_bone_storm() : SpellScriptLoader("spell_marrowgar_bone_storm") { } - class spell_marrowgar_bone_storm_SpellScript : public SpellScript - { - PrepareSpellScript(spell_marrowgar_bone_storm_SpellScript); + class spell_marrowgar_bone_storm_SpellScript : public SpellScript + { + PrepareSpellScript(spell_marrowgar_bone_storm_SpellScript); - void RecalculateDamage() - { - float dist = GetHitUnit()->GetExactDist2d(GetCaster()); - if (dist >= 9.0f) dist -= 9.0f; - else dist = 0.0f; - SetHitDamage(int32(GetHitDamage() / std::max(sqrtf(dist), 1.0f))); - } + void RecalculateDamage() + { + float dist = GetHitUnit()->GetExactDist2d(GetCaster()); + if (dist >= 9.0f) dist -= 9.0f; + else dist = 0.0f; + SetHitDamage(int32(GetHitDamage() / std::max(sqrtf(dist), 1.0f))); + } - void Register() - { - OnHit += SpellHitFn(spell_marrowgar_bone_storm_SpellScript::RecalculateDamage); - } - }; + void Register() + { + OnHit += SpellHitFn(spell_marrowgar_bone_storm_SpellScript::RecalculateDamage); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_marrowgar_bone_storm_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_marrowgar_bone_storm_SpellScript(); + } }; class spell_marrowgar_bone_slice : public SpellScriptLoader @@ -690,12 +690,12 @@ class spell_marrowgar_bone_slice : public SpellScriptLoader void AddSC_boss_lord_marrowgar() { - new boss_lord_marrowgar(); - new npc_coldflame(); - new npc_bone_spike(); - new spell_marrowgar_coldflame(); - new spell_marrowgar_coldflame_bonestorm(); - new spell_marrowgar_bone_spike_graveyard(); - new spell_marrowgar_bone_storm(); - new spell_marrowgar_bone_slice(); + new boss_lord_marrowgar(); + new npc_coldflame(); + new npc_bone_spike(); + new spell_marrowgar_coldflame(); + new spell_marrowgar_coldflame_bonestorm(); + new spell_marrowgar_bone_spike_graveyard(); + new spell_marrowgar_bone_storm(); + new spell_marrowgar_bone_slice(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index f954b391d..70a786947 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -14,121 +14,121 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum ScriptTexts { - // Festergut - SAY_FESTERGUT_GASEOUS_BLIGHT = 0, - SAY_FESTERGUT_DEATH = 1, + // Festergut + SAY_FESTERGUT_GASEOUS_BLIGHT = 0, + SAY_FESTERGUT_DEATH = 1, - // Rotface - SAY_ROTFACE_OOZE_FLOOD = 2, - SAY_ROTFACE_DEATH = 3, + // Rotface + SAY_ROTFACE_OOZE_FLOOD = 2, + SAY_ROTFACE_DEATH = 3, - // Professor Putricide - SAY_AGGRO = 4, - EMOTE_UNSTABLE_EXPERIMENT = 5, - SAY_PHASE_TRANSITION_HEROIC = 6, - SAY_TRANSFORM_1 = 7, - SAY_TRANSFORM_2 = 8, // always used for phase2 change, DO NOT GROUP WITH SAY_TRANSFORM_1 - EMOTE_MALLEABLE_GOO = 9, - EMOTE_CHOKING_GAS_BOMB = 10, - SAY_KILL = 11, - SAY_BERSERK = 12, - SAY_DEATH = 13, + // Professor Putricide + SAY_AGGRO = 4, + EMOTE_UNSTABLE_EXPERIMENT = 5, + SAY_PHASE_TRANSITION_HEROIC = 6, + SAY_TRANSFORM_1 = 7, + SAY_TRANSFORM_2 = 8, // always used for phase2 change, DO NOT GROUP WITH SAY_TRANSFORM_1 + EMOTE_MALLEABLE_GOO = 9, + EMOTE_CHOKING_GAS_BOMB = 10, + SAY_KILL = 11, + SAY_BERSERK = 12, + SAY_DEATH = 13, }; enum Spells { - // Festergut - SPELL_RELEASE_GAS_VISUAL = 69125, - SPELL_GASEOUS_BLIGHT_LARGE = 69157, - SPELL_GASEOUS_BLIGHT_MEDIUM = 69162, - SPELL_GASEOUS_BLIGHT_SMALL = 69164, + // Festergut + SPELL_RELEASE_GAS_VISUAL = 69125, + SPELL_GASEOUS_BLIGHT_LARGE = 69157, + SPELL_GASEOUS_BLIGHT_MEDIUM = 69162, + SPELL_GASEOUS_BLIGHT_SMALL = 69164, - // Rotface - not needed here + // Rotface - not needed here - // Professor Putricide - SPELL_SLIME_PUDDLE_TRIGGER = 70341, - SPELL_MALLEABLE_GOO_BALCONY = 72296, - SPELL_MALLEABLE_GOO = 70852, - SPELL_UNSTABLE_EXPERIMENT = 70351, - SPELL_TEAR_GAS = 71617, // phase transition - SPELL_TEAR_GAS_CREATURE = 71618, - SPELL_TEAR_GAS_CANCEL = 71620, - SPELL_TEAR_GAS_PERIODIC_TRIGGER = 73170, - SPELL_CREATE_CONCOCTION = 71621, - SPELL_GUZZLE_POTIONS = 71893, - SPELL_OOZE_TANK_PROTECTION = 71770, // protects the tank - SPELL_CHOKING_GAS_BOMB = 71255, - SPELL_OOZE_VARIABLE = 74118, - SPELL_GAS_VARIABLE = 74119, - SPELL_UNBOUND_PLAGUE = 70911, - SPELL_UNBOUND_PLAGUE_SEARCHER = 70917, - SPELL_PLAGUE_SICKNESS = 70953, - SPELL_UNBOUND_PLAGUE_PROTECTION = 70955, - SPELL_MUTATED_PLAGUE = 72451, - SPELL_MUTATED_PLAGUE_CLEAR = 72618, + // Professor Putricide + SPELL_SLIME_PUDDLE_TRIGGER = 70341, + SPELL_MALLEABLE_GOO_BALCONY = 72296, + SPELL_MALLEABLE_GOO = 70852, + SPELL_UNSTABLE_EXPERIMENT = 70351, + SPELL_TEAR_GAS = 71617, // phase transition + SPELL_TEAR_GAS_CREATURE = 71618, + SPELL_TEAR_GAS_CANCEL = 71620, + SPELL_TEAR_GAS_PERIODIC_TRIGGER = 73170, + SPELL_CREATE_CONCOCTION = 71621, + SPELL_GUZZLE_POTIONS = 71893, + SPELL_OOZE_TANK_PROTECTION = 71770, // protects the tank + SPELL_CHOKING_GAS_BOMB = 71255, + SPELL_OOZE_VARIABLE = 74118, + SPELL_GAS_VARIABLE = 74119, + SPELL_UNBOUND_PLAGUE = 70911, + SPELL_UNBOUND_PLAGUE_SEARCHER = 70917, + SPELL_PLAGUE_SICKNESS = 70953, + SPELL_UNBOUND_PLAGUE_PROTECTION = 70955, + SPELL_MUTATED_PLAGUE = 72451, + SPELL_MUTATED_PLAGUE_CLEAR = 72618, - // Slime Puddle - SPELL_GROW_STACKER = 70345, - SPELL_GROW = 70347, - SPELL_SLIME_PUDDLE_AURA = 70343, + // Slime Puddle + SPELL_GROW_STACKER = 70345, + SPELL_GROW = 70347, + SPELL_SLIME_PUDDLE_AURA = 70343, - // Gas Cloud - SPELL_GASEOUS_BLOAT_PROC = 70215, - SPELL_GASEOUS_BLOAT = 70672, - SPELL_GASEOUS_BLOAT_PROTECTION = 70812, - SPELL_EXPUNGED_GAS = 70701, + // Gas Cloud + SPELL_GASEOUS_BLOAT_PROC = 70215, + SPELL_GASEOUS_BLOAT = 70672, + SPELL_GASEOUS_BLOAT_PROTECTION = 70812, + SPELL_EXPUNGED_GAS = 70701, - // Volatile Ooze - SPELL_OOZE_ERUPTION = 70492, - SPELL_VOLATILE_OOZE_ADHESIVE = 70447, - SPELL_OOZE_ERUPTION_SEARCH_PERIODIC = 70457, - SPELL_VOLATILE_OOZE_PROTECTION = 70530, + // Volatile Ooze + SPELL_OOZE_ERUPTION = 70492, + SPELL_VOLATILE_OOZE_ADHESIVE = 70447, + SPELL_OOZE_ERUPTION_SEARCH_PERIODIC = 70457, + SPELL_VOLATILE_OOZE_PROTECTION = 70530, - // Choking Gas Bomb - SPELL_CHOKING_GAS_BOMB_PERIODIC = 71259, - SPELL_CHOKING_GAS_EXPLOSION_TRIGGER = 71280, + // Choking Gas Bomb + SPELL_CHOKING_GAS_BOMB_PERIODIC = 71259, + SPELL_CHOKING_GAS_EXPLOSION_TRIGGER = 71280, - // Mutated Abomination vehicle - SPELL_ABOMINATION_VEHICLE_POWER_DRAIN = 70385, - SPELL_MUTATED_TRANSFORMATION = 70311, - SPELL_MUTATED_TRANSFORMATION_DAMAGE = 70405, - SPELL_MUTATED_TRANSFORMATION_NAME = 72401, + // Mutated Abomination vehicle + SPELL_ABOMINATION_VEHICLE_POWER_DRAIN = 70385, + SPELL_MUTATED_TRANSFORMATION = 70311, + SPELL_MUTATED_TRANSFORMATION_DAMAGE = 70405, + SPELL_MUTATED_TRANSFORMATION_NAME = 72401, - // Unholy Infusion - SPELL_UNHOLY_INFUSION = 71516, - SPELL_UNHOLY_INFUSION_CREDIT = 71518, + // Unholy Infusion + SPELL_UNHOLY_INFUSION = 71516, + SPELL_UNHOLY_INFUSION_CREDIT = 71518, }; enum PutricideData { - DATA_EXPERIMENT_STAGE = 1, - DATA_PHASE = 2, - DATA_ABOMINATION = 3, + DATA_EXPERIMENT_STAGE = 1, + DATA_PHASE = 2, + DATA_ABOMINATION = 3, }; enum Events { - EVENT_NONE, - EVENT_BERSERK, - EVENT_SLIME_PUDDLE, - EVENT_UNSTABLE_EXPERIMENT, - EVENT_GO_TO_TABLE, - EVENT_TABLE_DRINK_STUFF, - EVENT_PHASE_TRANSITION, - EVENT_RESUME_ATTACK, - EVENT_UNBOUND_PLAGUE, - EVENT_MALLEABLE_GOO, - EVENT_CHOKING_GAS_BOMB, + EVENT_NONE, + EVENT_BERSERK, + EVENT_SLIME_PUDDLE, + EVENT_UNSTABLE_EXPERIMENT, + EVENT_GO_TO_TABLE, + EVENT_TABLE_DRINK_STUFF, + EVENT_PHASE_TRANSITION, + EVENT_RESUME_ATTACK, + EVENT_UNBOUND_PLAGUE, + EVENT_MALLEABLE_GOO, + EVENT_CHOKING_GAS_BOMB, }; #define EVENT_GROUP_ABILITIES 1 enum Points { - POINT_FESTERGUT = 366260, - POINT_ROTFACE = 366270, - POINT_TABLE = 366780, - POINT_TABLE_COMBAT = 366781, + POINT_FESTERGUT = 366260, + POINT_ROTFACE = 366270, + POINT_TABLE = 366780, + POINT_TABLE_COMBAT = 366781, }; Position const festergutWatchPos = {4324.820f, 3166.03f, 389.3831f, 3.316126f}; //emote 432 (release gas) @@ -137,54 +137,54 @@ Position const tablePos = {4356.190f, 3262.90f, 389.4820f, 1.483530f}; class AbominationDespawner { - public: - explicit AbominationDespawner(Unit* owner) : _owner(owner) { } + public: + explicit AbominationDespawner(Unit* owner) : _owner(owner) { } - bool operator()(uint64 guid) - { - if (Unit* summon = ObjectAccessor::GetUnit(*_owner, guid)) - { - if (summon->GetEntry() == NPC_MUTATED_ABOMINATION_10 || summon->GetEntry() == NPC_MUTATED_ABOMINATION_25) - { - if (Vehicle* veh = summon->GetVehicleKit()) - veh->RemoveAllPassengers(); // also despawns the vehicle + bool operator()(uint64 guid) + { + if (Unit* summon = ObjectAccessor::GetUnit(*_owner, guid)) + { + if (summon->GetEntry() == NPC_MUTATED_ABOMINATION_10 || summon->GetEntry() == NPC_MUTATED_ABOMINATION_25) + { + if (Vehicle* veh = summon->GetVehicleKit()) + veh->RemoveAllPassengers(); // also despawns the vehicle - // Found unit is Mutated Abomination, remove it - return true; - } + // Found unit is Mutated Abomination, remove it + return true; + } - // Found unit is not Mutated Abomintaion, leave it - return false; - } + // Found unit is not Mutated Abomintaion, leave it + return false; + } - // No unit found, remove from SummonList - return true; - } + // No unit found, remove from SummonList + return true; + } - private: - Unit* _owner; + private: + Unit* _owner; }; class UnboundPlagueTargetSelector { public: - UnboundPlagueTargetSelector(Creature* source) : _source(source) { } + UnboundPlagueTargetSelector(Creature* source) : _source(source) { } - bool operator()(WorldObject* object) const - { - if (!object) - return true; - if (Player* p = object->ToPlayer()) - { - if (p == _source->GetVictim() || p->GetExactDist(_source) >= 45.0f) - return true; + bool operator()(WorldObject* object) const + { + if (!object) + return true; + if (Player* p = object->ToPlayer()) + { + if (p == _source->GetVictim() || p->GetExactDist(_source) >= 45.0f) + return true; - return false; - } - return true; - } + return false; + } + return true; + } private: - Creature const* _source; + Creature const* _source; }; // xinef: malleable goo selector, check for target validity @@ -207,1518 +207,1518 @@ struct MalleableGooSelector : public std::unary_function class boss_professor_putricide : public CreatureScript { - public: - boss_professor_putricide() : CreatureScript("boss_professor_putricide") { } + public: + boss_professor_putricide() : CreatureScript("boss_professor_putricide") { } - struct boss_professor_putricideAI : public BossAI - { - boss_professor_putricideAI(Creature* creature) : BossAI(creature, DATA_PROFESSOR_PUTRICIDE) - { - bCallEvade = false; - bEnteredCombat = false; - } + struct boss_professor_putricideAI : public BossAI + { + boss_professor_putricideAI(Creature* creature) : BossAI(creature, DATA_PROFESSOR_PUTRICIDE) + { + bCallEvade = false; + bEnteredCombat = false; + } - uint16 sayFestergutDeathTimer; - uint16 sayRotfaceDeathTimer; - bool bCallEvade; - uint8 _experimentState; - uint8 _phase; - bool bChangePhase; - bool bEnteredCombat; // needed for failing an attempt in JustReachedHome() + uint16 sayFestergutDeathTimer; + uint16 sayRotfaceDeathTimer; + bool bCallEvade; + uint8 _experimentState; + uint8 _phase; + bool bChangePhase; + bool bEnteredCombat; // needed for failing an attempt in JustReachedHome() - void Reset() - { - sayFestergutDeathTimer = 0; - sayRotfaceDeathTimer = 0; - _experimentState = 0; - _phase = 1; - bChangePhase = false; - _Reset(); - me->SetReactState(REACT_AGGRESSIVE); - me->SetStandState(UNIT_STAND_STATE_STAND); + void Reset() + { + sayFestergutDeathTimer = 0; + sayRotfaceDeathTimer = 0; + _experimentState = 0; + _phase = 1; + bChangePhase = false; + _Reset(); + me->SetReactState(REACT_AGGRESSIVE); + me->SetStandState(UNIT_STAND_STATE_STAND); - if (instance->GetBossState(DATA_ROTFACE) == DONE && instance->GetBossState(DATA_FESTERGUT) == DONE) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } + if (instance->GetBossState(DATA_ROTFACE) == DONE && instance->GetBossState(DATA_FESTERGUT) == DONE) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } - uint32 GetData(uint32 type) const - { - switch (type) - { - case DATA_EXPERIMENT_STAGE: - return (uint32)_experimentState; - case DATA_PHASE: - return (uint32)_phase; - case DATA_ABOMINATION: - return (uint32)(const_cast(&summons)->HasEntry(NPC_MUTATED_ABOMINATION_10) || const_cast(&summons)->HasEntry(NPC_MUTATED_ABOMINATION_25)); - } + uint32 GetData(uint32 type) const + { + switch (type) + { + case DATA_EXPERIMENT_STAGE: + return (uint32)_experimentState; + case DATA_PHASE: + return (uint32)_phase; + case DATA_ABOMINATION: + return (uint32)(const_cast(&summons)->HasEntry(NPC_MUTATED_ABOMINATION_10) || const_cast(&summons)->HasEntry(NPC_MUTATED_ABOMINATION_25)); + } - return 0; - } + return 0; + } - void SetData(uint32 id, uint32 data) - { - if (id == DATA_EXPERIMENT_STAGE) - _experimentState = (data ? 1 : 0); - } + void SetData(uint32 id, uint32 data) + { + if (id == DATA_EXPERIMENT_STAGE) + _experimentState = (data ? 1 : 0); + } - void AttackStart(Unit* who) - { - if (instance->CheckRequiredBosses(DATA_PROFESSOR_PUTRICIDE)) - BossAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (instance->CheckRequiredBosses(DATA_PROFESSOR_PUTRICIDE)) + BossAI::AttackStart(who); + } - bool CanAIAttack(const Unit* target) const - { - return me->IsVisible() && target->GetPositionZ() > 388.0f && target->GetPositionZ() < 410.0f && target->GetPositionY() > 3157.1f && target->GetExactDist2dSq(4356.0f, 3211.0f) < 80.0f*80.0f; - } + bool CanAIAttack(const Unit* target) const + { + return me->IsVisible() && target->GetPositionZ() > 388.0f && target->GetPositionZ() < 410.0f && target->GetPositionY() > 3157.1f && target->GetExactDist2dSq(4356.0f, 3211.0f) < 80.0f*80.0f; + } - void MoveInLineOfSight(Unit* who) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - BossAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit* who) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + BossAI::MoveInLineOfSight(who); + } - void EnterCombat(Unit* who) - { - Position homePos = me->GetHomePosition(); - if (!instance->CheckRequiredBosses(DATA_PROFESSOR_PUTRICIDE, who->ToPlayer()) || me->GetExactDist2d(&homePos) > 10.0f || !me->IsVisible()) // check home position because during festergut/rotface fight, trigger missile after their death can trigger putricide combat - { - me->CombatStop(); - me->RemoveAllAuras(); - return; - } + void EnterCombat(Unit* who) + { + Position homePos = me->GetHomePosition(); + if (!instance->CheckRequiredBosses(DATA_PROFESSOR_PUTRICIDE, who->ToPlayer()) || me->GetExactDist2d(&homePos) > 10.0f || !me->IsVisible()) // check home position because during festergut/rotface fight, trigger missile after their death can trigger putricide combat + { + me->CombatStop(); + me->RemoveAllAuras(); + return; + } - bEnteredCombat = true; - me->CastSpell(me, SPELL_OOZE_TANK_PROTECTION, true); - events.Reset(); - events.ScheduleEvent(EVENT_BERSERK, 600000); - events.ScheduleEvent(EVENT_SLIME_PUDDLE, 10000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_UNSTABLE_EXPERIMENT, urand(30000, 35000), EVENT_GROUP_ABILITIES); - if (IsHeroic()) - events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 20000, EVENT_GROUP_ABILITIES); + bEnteredCombat = true; + me->CastSpell(me, SPELL_OOZE_TANK_PROTECTION, true); + events.Reset(); + events.ScheduleEvent(EVENT_BERSERK, 600000); + events.ScheduleEvent(EVENT_SLIME_PUDDLE, 10000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_UNSTABLE_EXPERIMENT, urand(30000, 35000), EVENT_GROUP_ABILITIES); + if (IsHeroic()) + events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 20000, EVENT_GROUP_ABILITIES); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE); - me->setActive(true); - Talk(SAY_AGGRO); - DoZoneInCombat(me); - instance->SetBossState(DATA_PROFESSOR_PUTRICIDE, IN_PROGRESS); - instance->SetData(DATA_NAUSEA_ACHIEVEMENT, uint32(true)); - } + me->setActive(true); + Talk(SAY_AGGRO); + DoZoneInCombat(me); + instance->SetBossState(DATA_PROFESSOR_PUTRICIDE, IN_PROGRESS); + instance->SetData(DATA_NAUSEA_ACHIEVEMENT, uint32(true)); + } - void JustReachedHome() - { - _JustReachedHome(); - if (bEnteredCombat) - { - bEnteredCombat = false; - instance->SetBossState(DATA_PROFESSOR_PUTRICIDE, FAIL); - } + void JustReachedHome() + { + _JustReachedHome(); + if (bEnteredCombat) + { + bEnteredCombat = false; + instance->SetBossState(DATA_PROFESSOR_PUTRICIDE, FAIL); + } - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE); - } + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } - void JustDied(Unit* /*killer*/) - { - _JustDied(); - Talk(SAY_DEATH); + void JustDied(Unit* /*killer*/) + { + _JustDied(); + Talk(SAY_DEATH); if (Is25ManRaid() && me->HasAura(SPELL_SHADOWS_FATE)) DoCastAOE(SPELL_UNHOLY_INFUSION_CREDIT, true); // ReqTargetAura in dbc - me->CastSpell((Unit*)NULL, SPELL_MUTATED_PLAGUE_CLEAR, true); - } + me->CastSpell((Unit*)NULL, SPELL_MUTATED_PLAGUE_CLEAR, true); + } - void JustSummoned(Creature* summon) - { - if (summon->GetEntry() != 38308 && summon->GetEntry() != 38309 && (!me->IsInCombat() || me->IsInEvadeMode())) - { - summon->DespawnOrUnsummon(1); - return; - } + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() != 38308 && summon->GetEntry() != 38309 && (!me->IsInCombat() || me->IsInEvadeMode())) + { + summon->DespawnOrUnsummon(1); + return; + } - summons.Summon(summon); + summons.Summon(summon); - switch (summon->GetEntry()) - { - case NPC_GROWING_OOZE_PUDDLE: - // blizzard casts this spell 7 times initially (confirmed in sniff) - for (uint8 i = 0; i < 7; ++i) - summon->CastSpell(summon, SPELL_GROW, true); - return; - case NPC_GAS_CLOUD: - // no possible aura seen in sniff adding the aurastate - summon->ModifyAuraState(AURA_STATE_UNKNOWN22, true); - summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true); - summon->SetReactState(REACT_PASSIVE); - break; - case NPC_VOLATILE_OOZE: - // no possible aura seen in sniff adding the aurastate - summon->ModifyAuraState(AURA_STATE_UNKNOWN19, true); - summon->CastSpell(summon, SPELL_OOZE_ERUPTION_SEARCH_PERIODIC, true); - summon->SetReactState(REACT_PASSIVE); - break; - case NPC_CHOKING_GAS_BOMB: - summon->CastSpell(summon, SPELL_CHOKING_GAS_BOMB_PERIODIC, true); - summon->CastSpell(summon, SPELL_CHOKING_GAS_EXPLOSION_TRIGGER, true); - return; - case NPC_MUTATED_ABOMINATION_10: - case NPC_MUTATED_ABOMINATION_25: - return; - } + switch (summon->GetEntry()) + { + case NPC_GROWING_OOZE_PUDDLE: + // blizzard casts this spell 7 times initially (confirmed in sniff) + for (uint8 i = 0; i < 7; ++i) + summon->CastSpell(summon, SPELL_GROW, true); + return; + case NPC_GAS_CLOUD: + // no possible aura seen in sniff adding the aurastate + summon->ModifyAuraState(AURA_STATE_UNKNOWN22, true); + summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true); + summon->SetReactState(REACT_PASSIVE); + break; + case NPC_VOLATILE_OOZE: + // no possible aura seen in sniff adding the aurastate + summon->ModifyAuraState(AURA_STATE_UNKNOWN19, true); + summon->CastSpell(summon, SPELL_OOZE_ERUPTION_SEARCH_PERIODIC, true); + summon->SetReactState(REACT_PASSIVE); + break; + case NPC_CHOKING_GAS_BOMB: + summon->CastSpell(summon, SPELL_CHOKING_GAS_BOMB_PERIODIC, true); + summon->CastSpell(summon, SPELL_CHOKING_GAS_EXPLOSION_TRIGGER, true); + return; + case NPC_MUTATED_ABOMINATION_10: + case NPC_MUTATED_ABOMINATION_25: + return; + } - if (me->IsInCombat()) - summon->SetInCombatWithZone(); - } + if (me->IsInCombat()) + summon->SetInCombatWithZone(); + } - void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) - { - if (bChangePhase) - return; + void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) + { + if (bChangePhase) + return; - switch (_phase) - { - case 1: - if (HealthAbovePct(80)) - return; - me->SetReactState(REACT_PASSIVE); - bChangePhase = true; - break; - case 2: - if (HealthAbovePct(35)) - return; - me->SetReactState(REACT_PASSIVE); - bChangePhase = true; - break; - default: - break; - } - } + switch (_phase) + { + case 1: + if (HealthAbovePct(80)) + return; + me->SetReactState(REACT_PASSIVE); + bChangePhase = true; + break; + case 2: + if (HealthAbovePct(35)) + return; + me->SetReactState(REACT_PASSIVE); + bChangePhase = true; + break; + default: + break; + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - switch (id) - { - case POINT_FESTERGUT: - if (Creature* c = instance->instance->GetCreature(instance->GetData64(DATA_FESTERGUT))) - if (c->IsInCombat()) - { - instance->SetBossState(DATA_FESTERGUT, IN_PROGRESS); - me->SetFacingTo(festergutWatchPos.GetOrientation()); - DoAction(ACTION_FESTERGUT_GAS); - c->CastSpell(c, SPELL_GASEOUS_BLIGHT_LARGE, true, NULL, NULL, c->GetGUID()); - } - else - bCallEvade = true; - break; - case POINT_ROTFACE: - if (Creature* c = instance->instance->GetCreature(instance->GetData64(DATA_ROTFACE))) - if (c->IsInCombat()) - { - instance->SetBossState(DATA_ROTFACE, IN_PROGRESS); - me->SetFacingTo(rotfaceWatchPos.GetOrientation()); - } - else - bCallEvade = true; - break; - case POINT_TABLE: - me->SetFacingTo(tablePos.GetOrientation()); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING); - break; - case POINT_TABLE_COMBAT: - me->SetFacingTo(tablePos.GetOrientation()); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - events.ScheduleEvent(EVENT_TABLE_DRINK_STUFF, IsHeroic() ? 25000 : 0); - break; - } - } + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + switch (id) + { + case POINT_FESTERGUT: + if (Creature* c = instance->instance->GetCreature(instance->GetData64(DATA_FESTERGUT))) + if (c->IsInCombat()) + { + instance->SetBossState(DATA_FESTERGUT, IN_PROGRESS); + me->SetFacingTo(festergutWatchPos.GetOrientation()); + DoAction(ACTION_FESTERGUT_GAS); + c->CastSpell(c, SPELL_GASEOUS_BLIGHT_LARGE, true, NULL, NULL, c->GetGUID()); + } + else + bCallEvade = true; + break; + case POINT_ROTFACE: + if (Creature* c = instance->instance->GetCreature(instance->GetData64(DATA_ROTFACE))) + if (c->IsInCombat()) + { + instance->SetBossState(DATA_ROTFACE, IN_PROGRESS); + me->SetFacingTo(rotfaceWatchPos.GetOrientation()); + } + else + bCallEvade = true; + break; + case POINT_TABLE: + me->SetFacingTo(tablePos.GetOrientation()); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING); + break; + case POINT_TABLE_COMBAT: + me->SetFacingTo(tablePos.GetOrientation()); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + events.ScheduleEvent(EVENT_TABLE_DRINK_STUFF, IsHeroic() ? 25000 : 0); + break; + } + } - void DoAction(int32 action) - { - switch (action) - { - case ACTION_FESTERGUT_COMBAT: - me->GetMotionMaster()->MoveCharge(festergutWatchPos.GetPositionX(), festergutWatchPos.GetPositionY(), festergutWatchPos.GetPositionZ(), 15.0f, POINT_FESTERGUT); - break; - case ACTION_FESTERGUT_DEATH: - sayFestergutDeathTimer = 4000; - break; - case ACTION_FESTERGUT_GAS: - Talk(SAY_FESTERGUT_GASEOUS_BLIGHT); - DoCast(me, SPELL_RELEASE_GAS_VISUAL, true); - break; - case ACTION_ROTFACE_COMBAT: - me->GetMotionMaster()->MoveCharge(rotfaceWatchPos.GetPositionX(), rotfaceWatchPos.GetPositionY(), rotfaceWatchPos.GetPositionZ(), 15.0f, POINT_ROTFACE); - break; - case ACTION_ROTFACE_DEATH: - sayRotfaceDeathTimer = 4500; - break; - default: - break; - } - } + void DoAction(int32 action) + { + switch (action) + { + case ACTION_FESTERGUT_COMBAT: + me->GetMotionMaster()->MoveCharge(festergutWatchPos.GetPositionX(), festergutWatchPos.GetPositionY(), festergutWatchPos.GetPositionZ(), 15.0f, POINT_FESTERGUT); + break; + case ACTION_FESTERGUT_DEATH: + sayFestergutDeathTimer = 4000; + break; + case ACTION_FESTERGUT_GAS: + Talk(SAY_FESTERGUT_GASEOUS_BLIGHT); + DoCast(me, SPELL_RELEASE_GAS_VISUAL, true); + break; + case ACTION_ROTFACE_COMBAT: + me->GetMotionMaster()->MoveCharge(rotfaceWatchPos.GetPositionX(), rotfaceWatchPos.GetPositionY(), rotfaceWatchPos.GetPositionZ(), 15.0f, POINT_ROTFACE); + break; + case ACTION_ROTFACE_DEATH: + sayRotfaceDeathTimer = 4500; + break; + default: + break; + } + } - void UpdateAI(uint32 diff) - { - if (sayFestergutDeathTimer) - { - if (sayFestergutDeathTimer <= diff) - { - sayFestergutDeathTimer = 0; - Talk(SAY_FESTERGUT_DEATH); - EnterEvadeMode(); - } - else - sayFestergutDeathTimer -= diff; - } - else if (sayRotfaceDeathTimer) - { - if (sayRotfaceDeathTimer <= diff) - { - sayRotfaceDeathTimer = 0; - Talk(SAY_ROTFACE_DEATH); - EnterEvadeMode(); - } - else - sayRotfaceDeathTimer -= diff; - } - else if (bCallEvade) - { - bCallEvade = false; - EnterEvadeMode(); - return; - } + void UpdateAI(uint32 diff) + { + if (sayFestergutDeathTimer) + { + if (sayFestergutDeathTimer <= diff) + { + sayFestergutDeathTimer = 0; + Talk(SAY_FESTERGUT_DEATH); + EnterEvadeMode(); + } + else + sayFestergutDeathTimer -= diff; + } + else if (sayRotfaceDeathTimer) + { + if (sayRotfaceDeathTimer <= diff) + { + sayRotfaceDeathTimer = 0; + Talk(SAY_ROTFACE_DEATH); + EnterEvadeMode(); + } + else + sayRotfaceDeathTimer -= diff; + } + else if (bCallEvade) + { + bCallEvade = false; + EnterEvadeMode(); + return; + } - if (!UpdateVictim() || !CheckInRoom()) - return; + if (!UpdateVictim() || !CheckInRoom()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (bChangePhase) - { - ChangePhase(); - bChangePhase = false; - return; - } + if (bChangePhase) + { + ChangePhase(); + bChangePhase = false; + return; + } - switch (events.ExecuteEvent()) - { - case EVENT_BERSERK: - Talk(SAY_BERSERK); - DoCast(me, SPELL_BERSERK2); - break; - case EVENT_SLIME_PUDDLE: - { - std::list targets; - SelectTargetList(targets, 2, SELECT_TARGET_RANDOM, 0.0f, true); - if (!targets.empty()) - for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) - me->CastSpell(*itr, SPELL_SLIME_PUDDLE_TRIGGER, true); - events.ScheduleEvent(EVENT_SLIME_PUDDLE, 35000, EVENT_GROUP_ABILITIES); - } - break; - case EVENT_UNSTABLE_EXPERIMENT: - Talk(EMOTE_UNSTABLE_EXPERIMENT); - me->CastSpell(me, SPELL_UNSTABLE_EXPERIMENT, false); - events.ScheduleEvent(EVENT_UNSTABLE_EXPERIMENT, urand(35000, 40000), EVENT_GROUP_ABILITIES); - break; - case EVENT_GO_TO_TABLE: - me->CastSpell(me, SPELL_TEAR_GAS_PERIODIC_TRIGGER, true); - me->GetMotionMaster()->MoveCharge(tablePos.GetPositionX(), tablePos.GetPositionY(), tablePos.GetPositionZ(), 15.0f, POINT_TABLE_COMBAT); - break; - case EVENT_TABLE_DRINK_STUFF: - switch (_phase) - { - case 2: - { - SpellInfo const* spell = sSpellMgr->GetSpellInfo(SPELL_CREATE_CONCOCTION); - me->CastSpell(me, SPELL_CREATE_CONCOCTION, false); - events.ScheduleEvent(EVENT_PHASE_TRANSITION, sSpellMgr->GetSpellForDifficultyFromSpell(spell, me)->CalcCastTime() + 2250); - break; - } - case 3: - { - SpellInfo const* spell = sSpellMgr->GetSpellInfo(SPELL_GUZZLE_POTIONS); - me->CastSpell(me, SPELL_GUZZLE_POTIONS, false); - events.ScheduleEvent(EVENT_PHASE_TRANSITION, sSpellMgr->GetSpellForDifficultyFromSpell(spell, me)->CalcCastTime() + 2250); - break; - } - default: - break; - } - break; - case EVENT_PHASE_TRANSITION: - { - switch (_phase) - { - case 2: - if (Creature* face = me->FindNearestCreature(NPC_TEAR_GAS_TARGET_STALKER, 50.0f)) - me->SetFacingToObject(face); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - Talk(SAY_TRANSFORM_1); - events.ScheduleEvent(EVENT_RESUME_ATTACK, 5500); - break; - case 3: - if (Creature* face = me->FindNearestCreature(NPC_TEAR_GAS_TARGET_STALKER, 50.0f)) - me->SetFacingToObject(face); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - Talk(SAY_TRANSFORM_2); - events.ScheduleEvent(EVENT_RESUME_ATTACK, 8500); - break; - default: - break; - } - } - break; - case EVENT_RESUME_ATTACK: - me->SetReactState(REACT_AGGRESSIVE); - me->SetStandState(UNIT_STAND_STATE_STAND); - AttackStart(me->GetVictim()); - // remove Tear Gas - me->RemoveAurasDueToSpell(SPELL_TEAR_GAS_PERIODIC_TRIGGER); - DoCastAOE(SPELL_TEAR_GAS_CANCEL); - if (_phase == 3) - summons.DespawnIf(AbominationDespawner(me)); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE); - break; - case EVENT_UNBOUND_PLAGUE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, UnboundPlagueTargetSelector(me))) - { - me->CastSpell(target, SPELL_UNBOUND_PLAGUE, false); - me->CastSpell(target, SPELL_UNBOUND_PLAGUE_SEARCHER, false); - events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 90000, EVENT_GROUP_ABILITIES); - } - else - events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 3500, EVENT_GROUP_ABILITIES); - break; - case EVENT_MALLEABLE_GOO: - if (Is25ManRaid()) - { - std::list targets; - SelectTargetList(targets, MalleableGooSelector(me), (IsHeroic() ? 3 : 2), SELECT_TARGET_RANDOM); + switch (events.ExecuteEvent()) + { + case EVENT_BERSERK: + Talk(SAY_BERSERK); + DoCast(me, SPELL_BERSERK2); + break; + case EVENT_SLIME_PUDDLE: + { + std::list targets; + SelectTargetList(targets, 2, SELECT_TARGET_RANDOM, 0.0f, true); + if (!targets.empty()) + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + me->CastSpell(*itr, SPELL_SLIME_PUDDLE_TRIGGER, true); + events.ScheduleEvent(EVENT_SLIME_PUDDLE, 35000, EVENT_GROUP_ABILITIES); + } + break; + case EVENT_UNSTABLE_EXPERIMENT: + Talk(EMOTE_UNSTABLE_EXPERIMENT); + me->CastSpell(me, SPELL_UNSTABLE_EXPERIMENT, false); + events.ScheduleEvent(EVENT_UNSTABLE_EXPERIMENT, urand(35000, 40000), EVENT_GROUP_ABILITIES); + break; + case EVENT_GO_TO_TABLE: + me->CastSpell(me, SPELL_TEAR_GAS_PERIODIC_TRIGGER, true); + me->GetMotionMaster()->MoveCharge(tablePos.GetPositionX(), tablePos.GetPositionY(), tablePos.GetPositionZ(), 15.0f, POINT_TABLE_COMBAT); + break; + case EVENT_TABLE_DRINK_STUFF: + switch (_phase) + { + case 2: + { + SpellInfo const* spell = sSpellMgr->GetSpellInfo(SPELL_CREATE_CONCOCTION); + me->CastSpell(me, SPELL_CREATE_CONCOCTION, false); + events.ScheduleEvent(EVENT_PHASE_TRANSITION, sSpellMgr->GetSpellForDifficultyFromSpell(spell, me)->CalcCastTime() + 2250); + break; + } + case 3: + { + SpellInfo const* spell = sSpellMgr->GetSpellInfo(SPELL_GUZZLE_POTIONS); + me->CastSpell(me, SPELL_GUZZLE_POTIONS, false); + events.ScheduleEvent(EVENT_PHASE_TRANSITION, sSpellMgr->GetSpellForDifficultyFromSpell(spell, me)->CalcCastTime() + 2250); + break; + } + default: + break; + } + break; + case EVENT_PHASE_TRANSITION: + { + switch (_phase) + { + case 2: + if (Creature* face = me->FindNearestCreature(NPC_TEAR_GAS_TARGET_STALKER, 50.0f)) + me->SetFacingToObject(face); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + Talk(SAY_TRANSFORM_1); + events.ScheduleEvent(EVENT_RESUME_ATTACK, 5500); + break; + case 3: + if (Creature* face = me->FindNearestCreature(NPC_TEAR_GAS_TARGET_STALKER, 50.0f)) + me->SetFacingToObject(face); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + Talk(SAY_TRANSFORM_2); + events.ScheduleEvent(EVENT_RESUME_ATTACK, 8500); + break; + default: + break; + } + } + break; + case EVENT_RESUME_ATTACK: + me->SetReactState(REACT_AGGRESSIVE); + me->SetStandState(UNIT_STAND_STATE_STAND); + AttackStart(me->GetVictim()); + // remove Tear Gas + me->RemoveAurasDueToSpell(SPELL_TEAR_GAS_PERIODIC_TRIGGER); + DoCastAOE(SPELL_TEAR_GAS_CANCEL); + if (_phase == 3) + summons.DespawnIf(AbominationDespawner(me)); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE); + break; + case EVENT_UNBOUND_PLAGUE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, UnboundPlagueTargetSelector(me))) + { + me->CastSpell(target, SPELL_UNBOUND_PLAGUE, false); + me->CastSpell(target, SPELL_UNBOUND_PLAGUE_SEARCHER, false); + events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 90000, EVENT_GROUP_ABILITIES); + } + else + events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 3500, EVENT_GROUP_ABILITIES); + break; + case EVENT_MALLEABLE_GOO: + if (Is25ManRaid()) + { + std::list targets; + SelectTargetList(targets, MalleableGooSelector(me), (IsHeroic() ? 3 : 2), SELECT_TARGET_RANDOM); - if (!targets.empty()) - { - Talk(EMOTE_MALLEABLE_GOO); - for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) - me->CastSpell(*itr, SPELL_MALLEABLE_GOO, true); - } - } - else - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, MalleableGooSelector(me))) - { - Talk(EMOTE_MALLEABLE_GOO); - me->CastSpell(target, SPELL_MALLEABLE_GOO, true); - } - } - events.ScheduleEvent(EVENT_MALLEABLE_GOO, urand(25000, 30000), EVENT_GROUP_ABILITIES); - break; - case EVENT_CHOKING_GAS_BOMB: - Talk(EMOTE_CHOKING_GAS_BOMB); - me->CastSpell(me, SPELL_CHOKING_GAS_BOMB, false); - events.ScheduleEvent(EVENT_CHOKING_GAS_BOMB, urand(35000, 40000), EVENT_GROUP_ABILITIES); - break; - default: - break; - } + if (!targets.empty()) + { + Talk(EMOTE_MALLEABLE_GOO); + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + me->CastSpell(*itr, SPELL_MALLEABLE_GOO, true); + } + } + else + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, MalleableGooSelector(me))) + { + Talk(EMOTE_MALLEABLE_GOO); + me->CastSpell(target, SPELL_MALLEABLE_GOO, true); + } + } + events.ScheduleEvent(EVENT_MALLEABLE_GOO, urand(25000, 30000), EVENT_GROUP_ABILITIES); + break; + case EVENT_CHOKING_GAS_BOMB: + Talk(EMOTE_CHOKING_GAS_BOMB); + me->CastSpell(me, SPELL_CHOKING_GAS_BOMB, false); + events.ScheduleEvent(EVENT_CHOKING_GAS_BOMB, urand(35000, 40000), EVENT_GROUP_ABILITIES); + break; + default: + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - Position p = me->GetHomePosition(); - if (!me->IsInCombat() && me->GetExactDist2d(&p) > 10.0f) - me->GetMotionMaster()->MoveCharge(tablePos.GetPositionX(), tablePos.GetPositionY(), tablePos.GetPositionZ(), 15.0f, POINT_TABLE); - BossAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + Position p = me->GetHomePosition(); + if (!me->IsInCombat() && me->GetExactDist2d(&p) > 10.0f) + me->GetMotionMaster()->MoveCharge(tablePos.GetPositionX(), tablePos.GetPositionY(), tablePos.GetPositionZ(), 15.0f, POINT_TABLE); + BossAI::EnterEvadeMode(); + } - void ChangePhase() - { - uint32 heroicDelay = (IsHeroic() ? 25000 : 0); - events.DelayEvents(24000 + heroicDelay, EVENT_GROUP_ABILITIES); - me->AttackStop(); - if (!IsHeroic()) - { - me->CastSpell(me, SPELL_TEAR_GAS, false); - events.ScheduleEvent(EVENT_GO_TO_TABLE, 2500); - } - else - { - Talk(SAY_PHASE_TRANSITION_HEROIC); - DoCast(me, SPELL_UNSTABLE_EXPERIMENT, true); - DoCast(me, SPELL_UNSTABLE_EXPERIMENT, true); - // cast variables - if (Is25ManRaid()) - { - std::list targetList; + void ChangePhase() + { + uint32 heroicDelay = (IsHeroic() ? 25000 : 0); + events.DelayEvents(24000 + heroicDelay, EVENT_GROUP_ABILITIES); + me->AttackStop(); + if (!IsHeroic()) + { + me->CastSpell(me, SPELL_TEAR_GAS, false); + events.ScheduleEvent(EVENT_GO_TO_TABLE, 2500); + } + else + { + Talk(SAY_PHASE_TRANSITION_HEROIC); + DoCast(me, SPELL_UNSTABLE_EXPERIMENT, true); + DoCast(me, SPELL_UNSTABLE_EXPERIMENT, true); + // cast variables + if (Is25ManRaid()) + { + std::list targetList; - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (!p->IsGameMaster()) - targetList.push_back(p); + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (!p->IsGameMaster()) + targetList.push_back(p); - size_t half = targetList.size()/2; - // half gets ooze variable - while (half < targetList.size()) - { - std::list::iterator itr = targetList.begin(); - advance(itr, urand(0, targetList.size() - 1)); - (*itr)->CastSpell(*itr, SPELL_OOZE_VARIABLE, true); - targetList.erase(itr); - } - // and half gets gas - for (std::list::iterator itr = targetList.begin(); itr != targetList.end(); ++itr) - (*itr)->CastSpell(*itr, SPELL_GAS_VARIABLE, true); - } + size_t half = targetList.size()/2; + // half gets ooze variable + while (half < targetList.size()) + { + std::list::iterator itr = targetList.begin(); + advance(itr, urand(0, targetList.size() - 1)); + (*itr)->CastSpell(*itr, SPELL_OOZE_VARIABLE, true); + targetList.erase(itr); + } + // and half gets gas + for (std::list::iterator itr = targetList.begin(); itr != targetList.end(); ++itr) + (*itr)->CastSpell(*itr, SPELL_GAS_VARIABLE, true); + } - me->GetMotionMaster()->MoveCharge(tablePos.GetPositionX(), tablePos.GetPositionY(), tablePos.GetPositionZ(), 15.0f, POINT_TABLE_COMBAT); - } + me->GetMotionMaster()->MoveCharge(tablePos.GetPositionX(), tablePos.GetPositionY(), tablePos.GetPositionZ(), 15.0f, POINT_TABLE_COMBAT); + } - switch (_phase) - { - case 1: - _phase = 2; - events.ScheduleEvent(EVENT_MALLEABLE_GOO, urand(25000, 28000) + heroicDelay, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_CHOKING_GAS_BOMB, urand(35000, 40000) + heroicDelay, EVENT_GROUP_ABILITIES); - break; - case 2: - _phase = 3; - events.CancelEvent(EVENT_UNSTABLE_EXPERIMENT); - break; - default: - break; - } - } - }; + switch (_phase) + { + case 1: + _phase = 2; + events.ScheduleEvent(EVENT_MALLEABLE_GOO, urand(25000, 28000) + heroicDelay, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_CHOKING_GAS_BOMB, urand(35000, 40000) + heroicDelay, EVENT_GROUP_ABILITIES); + break; + case 2: + _phase = 3; + events.CancelEvent(EVENT_UNSTABLE_EXPERIMENT); + break; + default: + break; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_putricide_oozeAI : public ScriptedAI { - public: - npc_putricide_oozeAI(Creature* creature, uint32 hitTargetSpellId) : ScriptedAI(creature), - _hitTargetSpellId(hitTargetSpellId), _newTargetSelectTimer(0) - { - targetGUID = 0; - me->SetReactState(REACT_PASSIVE); - } + public: + npc_putricide_oozeAI(Creature* creature, uint32 hitTargetSpellId) : ScriptedAI(creature), + _hitTargetSpellId(hitTargetSpellId), _newTargetSelectTimer(0) + { + targetGUID = 0; + me->SetReactState(REACT_PASSIVE); + } - uint64 targetGUID; + uint64 targetGUID; - void SetGUID(uint64 guid, int32 type) - { - if (type == -1) - targetGUID = guid; - } + void SetGUID(uint64 guid, int32 type) + { + if (type == -1) + targetGUID = guid; + } - void IsSummonedBy(Unit* /*summoner*/) - { - if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - { - if (!professor->IsInCombat()) - me->DespawnOrUnsummon(1); - else - professor->AI()->JustSummoned(me); - } - } + void IsSummonedBy(Unit* /*summoner*/) + { + if (InstanceScript* instance = me->GetInstanceScript()) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + { + if (!professor->IsInCombat()) + me->DespawnOrUnsummon(1); + else + professor->AI()->JustSummoned(me); + } + } - void SelectNewTarget() - { - targetGUID = 0; - me->InterruptNonMeleeSpells(true); - me->AttackStop(); - me->GetMotionMaster()->Clear(); - me->StopMoving(); - _newTargetSelectTimer = 1000; - } + void SelectNewTarget() + { + targetGUID = 0; + me->InterruptNonMeleeSpells(true); + me->AttackStop(); + me->GetMotionMaster()->Clear(); + me->StopMoving(); + _newTargetSelectTimer = 1000; + } - void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) - { - if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(_hitTargetSpellId, me)) - SelectNewTarget(); - } + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) + { + if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(_hitTargetSpellId, me)) + SelectNewTarget(); + } - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) - { - if (spell->Id == SPELL_TEAR_GAS_CREATURE) - SelectNewTarget(); - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_TEAR_GAS_CREATURE) + SelectNewTarget(); + } - void UpdateAI(uint32 diff) - { - if (!_newTargetSelectTimer) - { - if ((!me->HasUnitState(UNIT_STATE_CASTING) && !me->GetVictim()) || !me->IsNonMeleeSpellCast(false, false, true, false, true)) - SelectNewTarget(); - else if (targetGUID) - { - Unit* target = ObjectAccessor::GetUnit(*me, targetGUID); - if (me->GetVictim()->GetGUID() != targetGUID || !target || !me->IsValidAttackTarget(target) || target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH) || target->GetExactDist2dSq(4356.0f, 3211.0f) > 80.0f*80.0f || target->GetPositionZ() < 380.0f || target->GetPositionZ() > 405.0f) - SelectNewTarget(); - } - } + void UpdateAI(uint32 diff) + { + if (!_newTargetSelectTimer) + { + if ((!me->HasUnitState(UNIT_STATE_CASTING) && !me->GetVictim()) || !me->IsNonMeleeSpellCast(false, false, true, false, true)) + SelectNewTarget(); + else if (targetGUID) + { + Unit* target = ObjectAccessor::GetUnit(*me, targetGUID); + if (me->GetVictim()->GetGUID() != targetGUID || !target || !me->IsValidAttackTarget(target) || target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH) || target->GetExactDist2dSq(4356.0f, 3211.0f) > 80.0f*80.0f || target->GetPositionZ() < 380.0f || target->GetPositionZ() > 405.0f) + SelectNewTarget(); + } + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); - if (!_newTargetSelectTimer) - return; + if (!_newTargetSelectTimer) + return; - if (me->HasAura(SPELL_TEAR_GAS_CREATURE)) - return; + if (me->HasAura(SPELL_TEAR_GAS_CREATURE)) + return; - if (_newTargetSelectTimer <= diff) - { - _newTargetSelectTimer = 0; - CastMainSpell(); - } - else - _newTargetSelectTimer -= diff; - } + if (_newTargetSelectTimer <= diff) + { + _newTargetSelectTimer = 0; + CastMainSpell(); + } + else + _newTargetSelectTimer -= diff; + } - virtual void CastMainSpell() = 0; + virtual void CastMainSpell() = 0; - private: - uint32 _hitTargetSpellId; - uint32 _newTargetSelectTimer; + private: + uint32 _hitTargetSpellId; + uint32 _newTargetSelectTimer; }; class npc_volatile_ooze : public CreatureScript { - public: - npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { } + public: + npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { } - struct npc_volatile_oozeAI : public npc_putricide_oozeAI - { - npc_volatile_oozeAI(Creature* creature) : npc_putricide_oozeAI(creature, SPELL_OOZE_ERUPTION) - { - } + struct npc_volatile_oozeAI : public npc_putricide_oozeAI + { + npc_volatile_oozeAI(Creature* creature) : npc_putricide_oozeAI(creature, SPELL_OOZE_ERUPTION) + { + } - void CastMainSpell() - { - me->CastSpell(me, SPELL_VOLATILE_OOZE_ADHESIVE, false); - } - }; + void CastMainSpell() + { + me->CastSpell(me, SPELL_VOLATILE_OOZE_ADHESIVE, false); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_gas_cloud : public CreatureScript { - public: - npc_gas_cloud() : CreatureScript("npc_gas_cloud") { } + public: + npc_gas_cloud() : CreatureScript("npc_gas_cloud") { } - struct npc_gas_cloudAI : public npc_putricide_oozeAI - { - npc_gas_cloudAI(Creature* creature) : npc_putricide_oozeAI(creature, SPELL_EXPUNGED_GAS) - { - _newTargetSelectTimer = 0; - } + struct npc_gas_cloudAI : public npc_putricide_oozeAI + { + npc_gas_cloudAI(Creature* creature) : npc_putricide_oozeAI(creature, SPELL_EXPUNGED_GAS) + { + _newTargetSelectTimer = 0; + } - void CastMainSpell() - { - me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false); - } + void CastMainSpell() + { + me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false); + } - private: - uint32 _newTargetSelectTimer; - }; + private: + uint32 _newTargetSelectTimer; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_putricide_slime_puddle : public SpellScriptLoader { - public: - spell_putricide_slime_puddle() : SpellScriptLoader("spell_putricide_slime_puddle") { } + public: + spell_putricide_slime_puddle() : SpellScriptLoader("spell_putricide_slime_puddle") { } - class spell_putricide_slime_puddle_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_slime_puddle_SpellScript); + class spell_putricide_slime_puddle_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_slime_puddle_SpellScript); - void ScaleRange(std::list& targets) - { - targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 2.5f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X), true)); - } + void ScaleRange(std::list& targets) + { + targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 2.5f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X), true)); + } - // big hax to unlock Abomination Eat Ooze ability, requires caster aura spell from difficulty X, but unlocks clientside when got base aura - void HandleScript(SpellEffIndex effIndex) - { - const SpellInfo* s1 = sSpellMgr->GetSpellInfo(70346); - const SpellInfo* s2 = sSpellMgr->GetSpellInfo(72456); - if (s1 && s2) - if (Unit* target = GetHitUnit()) - { - Aura::TryRefreshStackOrCreate(s1, MAX_EFFECT_MASK, target, target); - Aura::TryRefreshStackOrCreate(s2, MAX_EFFECT_MASK, target, target); - } - } + // big hax to unlock Abomination Eat Ooze ability, requires caster aura spell from difficulty X, but unlocks clientside when got base aura + void HandleScript(SpellEffIndex effIndex) + { + const SpellInfo* s1 = sSpellMgr->GetSpellInfo(70346); + const SpellInfo* s2 = sSpellMgr->GetSpellInfo(72456); + if (s1 && s2) + if (Unit* target = GetHitUnit()) + { + Aura::TryRefreshStackOrCreate(s1, MAX_EFFECT_MASK, target, target); + Aura::TryRefreshStackOrCreate(s2, MAX_EFFECT_MASK, target, target); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY); - OnEffectHitTarget += SpellEffectFn(spell_putricide_slime_puddle_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_APPLY_AURA); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY); + OnEffectHitTarget += SpellEffectFn(spell_putricide_slime_puddle_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_APPLY_AURA); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_slime_puddle_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_slime_puddle_SpellScript(); + } }; class spell_putricide_slime_puddle_spawn : public SpellScriptLoader { - public: - spell_putricide_slime_puddle_spawn() : SpellScriptLoader("spell_putricide_slime_puddle_spawn") { } + public: + spell_putricide_slime_puddle_spawn() : SpellScriptLoader("spell_putricide_slime_puddle_spawn") { } - class spell_putricide_slime_puddle_spawn_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_slime_puddle_spawn_SpellScript); + class spell_putricide_slime_puddle_spawn_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_slime_puddle_spawn_SpellScript); - void SelectDest() - { - if (Position* dest = const_cast(GetExplTargetDest())) - { - float destZ = 395.0f; // random number close to ground, get exact in next call - GetCaster()->UpdateGroundPositionZ(dest->GetPositionX(), dest->GetPositionY(), destZ); - dest->m_positionZ = destZ; - } - } + void SelectDest() + { + if (Position* dest = const_cast(GetExplTargetDest())) + { + float destZ = 395.0f; // random number close to ground, get exact in next call + GetCaster()->UpdateGroundPositionZ(dest->GetPositionX(), dest->GetPositionY(), destZ); + dest->m_positionZ = destZ; + } + } - void Register() - { - BeforeCast += SpellCastFn(spell_putricide_slime_puddle_spawn_SpellScript::SelectDest); - } + void Register() + { + BeforeCast += SpellCastFn(spell_putricide_slime_puddle_spawn_SpellScript::SelectDest); + } - uint32 _targetCount; - }; + uint32 _targetCount; + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_slime_puddle_spawn_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_slime_puddle_spawn_SpellScript(); + } }; class spell_putricide_grow_stacker : public SpellScriptLoader { - public: - spell_putricide_grow_stacker() : SpellScriptLoader("spell_putricide_grow_stacker") { } + public: + spell_putricide_grow_stacker() : SpellScriptLoader("spell_putricide_grow_stacker") { } - class spell_putricide_grow_stacker_AuraScript : public AuraScript - { - PrepareAuraScript(spell_putricide_grow_stacker_AuraScript); + class spell_putricide_grow_stacker_AuraScript : public AuraScript + { + PrepareAuraScript(spell_putricide_grow_stacker_AuraScript); - void HandleTriggerSpell(AuraEffect const* aurEff) - { - if (Unit* target = GetTarget()) - if (target->HasAura(SPELL_TEAR_GAS_CREATURE)) - PreventDefaultAction(); - } + void HandleTriggerSpell(AuraEffect const* aurEff) + { + if (Unit* target = GetTarget()) + if (target->HasAura(SPELL_TEAR_GAS_CREATURE)) + PreventDefaultAction(); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_grow_stacker_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_grow_stacker_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_putricide_grow_stacker_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_putricide_grow_stacker_AuraScript(); + } }; class spell_putricide_unstable_experiment : public SpellScriptLoader { - public: - spell_putricide_unstable_experiment() : SpellScriptLoader("spell_putricide_unstable_experiment") { } + public: + spell_putricide_unstable_experiment() : SpellScriptLoader("spell_putricide_unstable_experiment") { } - class spell_putricide_unstable_experiment_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_unstable_experiment_SpellScript); + class spell_putricide_unstable_experiment_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_unstable_experiment_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (GetCaster()->GetTypeId() != TYPEID_UNIT) - return; + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (GetCaster()->GetTypeId() != TYPEID_UNIT) + return; - Creature* creature = GetCaster()->ToCreature(); + Creature* creature = GetCaster()->ToCreature(); - uint8 stage = creature->AI()->GetData(DATA_EXPERIMENT_STAGE); - creature->AI()->SetData(DATA_EXPERIMENT_STAGE, stage ? 0 : 1); + uint8 stage = creature->AI()->GetData(DATA_EXPERIMENT_STAGE); + creature->AI()->SetData(DATA_EXPERIMENT_STAGE, stage ? 0 : 1); - Creature* target = NULL; - std::list creList; - GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 200.0f); - for (std::list::iterator itr = creList.begin(); itr != creList.end(); ++itr) - if ((*itr)->GetPositionX() > 4350.0f && stage == 0 || (*itr)->GetPositionX() < 4350.0f && stage == 1) - { - target = (*itr); - break; - } + Creature* target = NULL; + std::list creList; + GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 200.0f); + for (std::list::iterator itr = creList.begin(); itr != creList.end(); ++itr) + if ((*itr)->GetPositionX() > 4350.0f && stage == 0 || (*itr)->GetPositionX() < 4350.0f && stage == 1) + { + target = (*itr); + break; + } - if (Aura* aura = target->GetAura(uint32(GetSpellInfo()->Effects[stage].CalcValue()))) - if (aura->GetOwner() == target) // avoid assert(false) at any cost - aura->UpdateOwner(5000, target); // update whole aura so previous periodic ticks before refreshed by new one + if (Aura* aura = target->GetAura(uint32(GetSpellInfo()->Effects[stage].CalcValue()))) + if (aura->GetOwner() == target) // avoid assert(false) at any cost + aura->UpdateOwner(5000, target); // update whole aura so previous periodic ticks before refreshed by new one - GetCaster()->CastSpell(target, uint32(GetSpellInfo()->Effects[stage].CalcValue()), true, NULL, NULL, GetCaster()->GetGUID()); - } + GetCaster()->CastSpell(target, uint32(GetSpellInfo()->Effects[stage].CalcValue()), true, NULL, NULL, GetCaster()->GetGUID()); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_putricide_unstable_experiment_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_putricide_unstable_experiment_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_unstable_experiment_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_unstable_experiment_SpellScript(); + } }; class spell_putricide_tear_gas_effect : public SpellScriptLoader { - public: - spell_putricide_tear_gas_effect() : SpellScriptLoader("spell_putricide_tear_gas_effect") { } + public: + spell_putricide_tear_gas_effect() : SpellScriptLoader("spell_putricide_tear_gas_effect") { } - class spell_putricide_tear_gas_effect_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_tear_gas_effect_SpellScript); + class spell_putricide_tear_gas_effect_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_tear_gas_effect_SpellScript); - void FilterTargets(std::list& targets) - { - // vanish rank 1-3, mage invisibility - targets.remove_if(Trinity::UnitAuraCheck(true, 11327)); - targets.remove_if(Trinity::UnitAuraCheck(true, 11329)); - targets.remove_if(Trinity::UnitAuraCheck(true, 26888)); - targets.remove_if(Trinity::UnitAuraCheck(true, 32612)); - } + void FilterTargets(std::list& targets) + { + // vanish rank 1-3, mage invisibility + targets.remove_if(Trinity::UnitAuraCheck(true, 11327)); + targets.remove_if(Trinity::UnitAuraCheck(true, 11329)); + targets.remove_if(Trinity::UnitAuraCheck(true, 26888)); + targets.remove_if(Trinity::UnitAuraCheck(true, 32612)); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_tear_gas_effect_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_tear_gas_effect_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_tear_gas_effect_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_tear_gas_effect_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_tear_gas_effect_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_tear_gas_effect_SpellScript(); + } }; class spell_putricide_gaseous_bloat : public SpellScriptLoader { - public: - spell_putricide_gaseous_bloat() : SpellScriptLoader("spell_putricide_gaseous_bloat") { } + public: + spell_putricide_gaseous_bloat() : SpellScriptLoader("spell_putricide_gaseous_bloat") { } - class spell_putricide_gaseous_bloat_AuraScript : public AuraScript - { - PrepareAuraScript(spell_putricide_gaseous_bloat_AuraScript); + class spell_putricide_gaseous_bloat_AuraScript : public AuraScript + { + PrepareAuraScript(spell_putricide_gaseous_bloat_AuraScript); - void HandleExtraEffect(AuraEffect const* /*aurEff*/) - { - Unit* target = GetTarget(); - target->RemoveAuraFromStack(GetSpellInfo()->Id, GetCasterGUID()); - /*if (!target->HasAura(GetId())) - if (Unit* caster = GetCaster()) - caster->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, caster, false);*/ - } + void HandleExtraEffect(AuraEffect const* /*aurEff*/) + { + Unit* target = GetTarget(); + target->RemoveAuraFromStack(GetSpellInfo()->Id, GetCasterGUID()); + /*if (!target->HasAura(GetId())) + if (Unit* caster = GetCaster()) + caster->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, caster, false);*/ + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_gaseous_bloat_AuraScript::HandleExtraEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_gaseous_bloat_AuraScript::HandleExtraEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_putricide_gaseous_bloat_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_putricide_gaseous_bloat_AuraScript(); + } }; class spell_putricide_ooze_channel : public SpellScriptLoader { - public: - spell_putricide_ooze_channel() : SpellScriptLoader("spell_putricide_ooze_channel") { } + public: + spell_putricide_ooze_channel() : SpellScriptLoader("spell_putricide_ooze_channel") { } - class spell_putricide_ooze_channel_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_ooze_channel_SpellScript); + class spell_putricide_ooze_channel_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_ooze_channel_SpellScript); - bool Validate(SpellInfo const* spell) - { - if (!spell->ExcludeTargetAuraSpell) - return false; - if (!sSpellMgr->GetSpellInfo(spell->ExcludeTargetAuraSpell)) - return false; - return true; - } + bool Validate(SpellInfo const* spell) + { + if (!spell->ExcludeTargetAuraSpell) + return false; + if (!sSpellMgr->GetSpellInfo(spell->ExcludeTargetAuraSpell)) + return false; + return true; + } - // set up initial variables and check if caster is creature - // this will let use safely use ToCreature() casts in entire script - bool Load() - { - _target = NULL; - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } + // set up initial variables and check if caster is creature + // this will let use safely use ToCreature() casts in entire script + bool Load() + { + _target = NULL; + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } - void SelectTarget(std::list& targets) - { - // dbc has only 1 field for excluding, this will prevent anyone from getting both at the same time - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_VOLATILE_OOZE_PROTECTION)); - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_GASEOUS_BLOAT_PROTECTION)); + void SelectTarget(std::list& targets) + { + // dbc has only 1 field for excluding, this will prevent anyone from getting both at the same time + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_VOLATILE_OOZE_PROTECTION)); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_GASEOUS_BLOAT_PROTECTION)); - if (targets.empty()) - { - FinishCast(SPELL_FAILED_NO_VALID_TARGETS); - GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update - return; - } + if (targets.empty()) + { + FinishCast(SPELL_FAILED_NO_VALID_TARGETS); + GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update + return; + } - WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); - targets.clear(); - targets.push_back(target); - _target = target; - } + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); + _target = target; + } - void SetTarget(std::list& targets) - { - targets.clear(); - if (_target) - targets.push_back(_target); - } + void SetTarget(std::list& targets) + { + targets.clear(); + if (_target) + targets.push_back(_target); + } - void StartAttack() - { - GetCaster()->ClearUnitState(UNIT_STATE_CASTING); - GetCaster()->DeleteThreatList(); - GetCaster()->ToCreature()->SetInCombatWithZone(); - GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit()); - GetCaster()->AddThreat(GetHitUnit(), 500000000.0f); // value seen in sniff - if (Creature* c = GetCaster()->ToCreature()) - c->AI()->SetGUID(GetHitUnit()->GetGUID(), -1); - } + void StartAttack() + { + GetCaster()->ClearUnitState(UNIT_STATE_CASTING); + GetCaster()->DeleteThreatList(); + GetCaster()->ToCreature()->SetInCombatWithZone(); + GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit()); + GetCaster()->AddThreat(GetHitUnit(), 500000000.0f); // value seen in sniff + if (Creature* c = GetCaster()->ToCreature()) + c->AI()->SetGUID(GetHitUnit()->GetGUID(), -1); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); - AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack); - } + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); + AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack); + } - WorldObject* _target; - }; + WorldObject* _target; + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_ooze_channel_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_ooze_channel_SpellScript(); + } }; class spell_putricide_ooze_eruption_searcher : public SpellScriptLoader { - public: - spell_putricide_ooze_eruption_searcher() : SpellScriptLoader("spell_putricide_ooze_eruption_searcher") { } + public: + spell_putricide_ooze_eruption_searcher() : SpellScriptLoader("spell_putricide_ooze_eruption_searcher") { } - class spell_putricide_ooze_eruption_searcher_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_ooze_eruption_searcher_SpellScript); + class spell_putricide_ooze_eruption_searcher_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_ooze_eruption_searcher_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - uint32 adhesiveId = sSpellMgr->GetSpellIdForDifficulty(SPELL_VOLATILE_OOZE_ADHESIVE, GetCaster()); - if (GetHitUnit()->HasAura(adhesiveId)) - { - GetHitUnit()->RemoveAurasDueToSpell(adhesiveId, GetCaster()->GetGUID(), 0, AURA_REMOVE_BY_ENEMY_SPELL); - GetCaster()->CastSpell(GetHitUnit(), SPELL_OOZE_ERUPTION, true); - } - } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + uint32 adhesiveId = sSpellMgr->GetSpellIdForDifficulty(SPELL_VOLATILE_OOZE_ADHESIVE, GetCaster()); + if (GetHitUnit()->HasAura(adhesiveId)) + { + GetHitUnit()->RemoveAurasDueToSpell(adhesiveId, GetCaster()->GetGUID(), 0, AURA_REMOVE_BY_ENEMY_SPELL); + GetCaster()->CastSpell(GetHitUnit(), SPELL_OOZE_ERUPTION, true); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_putricide_ooze_eruption_searcher_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_putricide_ooze_eruption_searcher_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_ooze_eruption_searcher_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_ooze_eruption_searcher_SpellScript(); + } }; class spell_putricide_mutated_plague : public SpellScriptLoader { - public: - spell_putricide_mutated_plague() : SpellScriptLoader("spell_putricide_mutated_plague") { } + public: + spell_putricide_mutated_plague() : SpellScriptLoader("spell_putricide_mutated_plague") { } - class spell_putricide_mutated_plague_AuraScript : public AuraScript - { - PrepareAuraScript(spell_putricide_mutated_plague_AuraScript); + class spell_putricide_mutated_plague_AuraScript : public AuraScript + { + PrepareAuraScript(spell_putricide_mutated_plague_AuraScript); - void HandleTriggerSpell(AuraEffect const* aurEff) - { - PreventDefaultAction(); - Unit* caster = GetCaster(); - if (!caster) - return; + void HandleTriggerSpell(AuraEffect const* aurEff) + { + PreventDefaultAction(); + Unit* caster = GetCaster(); + if (!caster) + return; - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; - SpellInfo const* spell = sSpellMgr->GetSpellInfo(triggerSpell); - spell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, caster); + uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + SpellInfo const* spell = sSpellMgr->GetSpellInfo(triggerSpell); + spell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, caster); - int32 damage = spell->Effects[EFFECT_0].CalcValue(caster); - damage = damage * pow(2.5f, GetStackAmount()); + int32 damage = spell->Effects[EFFECT_0].CalcValue(caster); + damage = damage * pow(2.5f, GetStackAmount()); - GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true, NULL, aurEff, GetCasterGUID()); - } + GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true, NULL, aurEff, GetCasterGUID()); + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - uint32 healSpell = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); - SpellInfo const* spell = sSpellMgr->GetSpellInfo(healSpell); - if (!spell) - return; - spell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, GetTarget()); - int32 healAmount = spell->Effects[EFFECT_0].CalcValue(); - healAmount *= GetStackAmount(); - GetTarget()->CastCustomSpell(healSpell, SPELLVALUE_BASE_POINT0, healAmount, GetTarget(), TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + uint32 healSpell = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); + SpellInfo const* spell = sSpellMgr->GetSpellInfo(healSpell); + if (!spell) + return; + spell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, GetTarget()); + int32 healAmount = spell->Effects[EFFECT_0].CalcValue(); + healAmount *= GetStackAmount(); + GetTarget()->CastCustomSpell(healSpell, SPELLVALUE_BASE_POINT0, healAmount, GetTarget(), TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_mutated_plague_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - AfterEffectRemove += AuraEffectRemoveFn(spell_putricide_mutated_plague_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_mutated_plague_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + AfterEffectRemove += AuraEffectRemoveFn(spell_putricide_mutated_plague_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_putricide_mutated_plague_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_putricide_mutated_plague_AuraScript(); + } }; class spell_putricide_unbound_plague : public SpellScriptLoader { - public: - spell_putricide_unbound_plague() : SpellScriptLoader("spell_putricide_unbound_plague") { } + public: + spell_putricide_unbound_plague() : SpellScriptLoader("spell_putricide_unbound_plague") { } - class spell_putricide_unbound_plague_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_unbound_plague_SpellScript); + class spell_putricide_unbound_plague_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_unbound_plague_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_UNBOUND_PLAGUE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_UNBOUND_PLAGUE_SEARCHER)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_UNBOUND_PLAGUE)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_UNBOUND_PLAGUE_SEARCHER)) + return false; + return true; + } - void FilterTargets(std::list& targets) - { - if (AuraEffect const* eff = GetCaster()->GetAuraEffect(SPELL_UNBOUND_PLAGUE_SEARCHER, EFFECT_0)) - { - if (eff->GetTickNumber() < 2) - { - targets.clear(); - return; - } - } + void FilterTargets(std::list& targets) + { + if (AuraEffect const* eff = GetCaster()->GetAuraEffect(SPELL_UNBOUND_PLAGUE_SEARCHER, EFFECT_0)) + { + if (eff->GetTickNumber() < 2) + { + targets.clear(); + return; + } + } - targets.remove_if(Trinity::UnitAuraCheck(true, sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster()))); - Trinity::Containers::RandomResizeList(targets, 1); - } + targets.remove_if(Trinity::UnitAuraCheck(true, sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster()))); + Trinity::Containers::RandomResizeList(targets, 1); + } - void HandleScript(SpellEffIndex /*effIndex*/) - { - if (!GetHitUnit()) - return; + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (!GetHitUnit()) + return; - InstanceScript* instance = GetCaster()->GetInstanceScript(); - if (!instance) - return; + InstanceScript* instance = GetCaster()->GetInstanceScript(); + if (!instance) + return; - uint32 plagueId = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster()); + uint32 plagueId = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster()); - if (!GetHitUnit()->HasAura(plagueId)) - { - if (Creature* professor = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - { - if (Aura* oldPlague = GetCaster()->GetAura(plagueId, professor->GetGUID())) - { - if (Aura* newPlague = professor->AddAura(plagueId, GetHitUnit())) - { - newPlague->SetMaxDuration(oldPlague->GetMaxDuration()); - newPlague->SetDuration(oldPlague->GetDuration()); - oldPlague->Remove(); - GetCaster()->RemoveAurasDueToSpell(SPELL_UNBOUND_PLAGUE_SEARCHER); - GetCaster()->CastSpell(GetCaster(), SPELL_PLAGUE_SICKNESS, true); - GetCaster()->CastSpell(GetCaster(), SPELL_UNBOUND_PLAGUE_PROTECTION, true); - professor->CastSpell(GetHitUnit(), SPELL_UNBOUND_PLAGUE_SEARCHER, true); - } - } - } - } - } + if (!GetHitUnit()->HasAura(plagueId)) + { + if (Creature* professor = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + { + if (Aura* oldPlague = GetCaster()->GetAura(plagueId, professor->GetGUID())) + { + if (Aura* newPlague = professor->AddAura(plagueId, GetHitUnit())) + { + newPlague->SetMaxDuration(oldPlague->GetMaxDuration()); + newPlague->SetDuration(oldPlague->GetDuration()); + oldPlague->Remove(); + GetCaster()->RemoveAurasDueToSpell(SPELL_UNBOUND_PLAGUE_SEARCHER); + GetCaster()->CastSpell(GetCaster(), SPELL_PLAGUE_SICKNESS, true); + GetCaster()->CastSpell(GetCaster(), SPELL_UNBOUND_PLAGUE_PROTECTION, true); + professor->CastSpell(GetHitUnit(), SPELL_UNBOUND_PLAGUE_SEARCHER, true); + } + } + } + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_unbound_plague_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); - OnEffectHitTarget += SpellEffectFn(spell_putricide_unbound_plague_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_unbound_plague_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnEffectHitTarget += SpellEffectFn(spell_putricide_unbound_plague_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_unbound_plague_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_unbound_plague_SpellScript(); + } }; class spell_putricide_unbound_plague_dmg : public SpellScriptLoader { - public: - spell_putricide_unbound_plague_dmg() : SpellScriptLoader("spell_putricide_unbound_plague_dmg") { } + public: + spell_putricide_unbound_plague_dmg() : SpellScriptLoader("spell_putricide_unbound_plague_dmg") { } - class spell_putricide_unbound_plague_dmg_AuraScript : public AuraScript - { - PrepareAuraScript(spell_putricide_unbound_plague_dmg_AuraScript); + class spell_putricide_unbound_plague_dmg_AuraScript : public AuraScript + { + PrepareAuraScript(spell_putricide_unbound_plague_dmg_AuraScript); - void HandlePeriodic(AuraEffect* aurEff) - { - int32 baseAmt = aurEff->GetSpellInfo()->Effects[0].CalcValue(); - int32 dmg = int32(baseAmt * pow(1.25f, float(aurEff->GetTickNumber()))); - if (dmg <= 0) // safety check, impossible - return; - aurEff->SetAmount(dmg); - } + void HandlePeriodic(AuraEffect* aurEff) + { + int32 baseAmt = aurEff->GetSpellInfo()->Effects[0].CalcValue(); + int32 dmg = int32(baseAmt * pow(1.25f, float(aurEff->GetTickNumber()))); + if (dmg <= 0) // safety check, impossible + return; + aurEff->SetAmount(dmg); + } - void Register() - { - OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_putricide_unbound_plague_dmg_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_putricide_unbound_plague_dmg_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_putricide_unbound_plague_dmg_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_putricide_unbound_plague_dmg_AuraScript(); + } }; class spell_putricide_choking_gas_bomb : public SpellScriptLoader { - public: - spell_putricide_choking_gas_bomb() : SpellScriptLoader("spell_putricide_choking_gas_bomb") { } + public: + spell_putricide_choking_gas_bomb() : SpellScriptLoader("spell_putricide_choking_gas_bomb") { } - class spell_putricide_choking_gas_bomb_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_choking_gas_bomb_SpellScript); + class spell_putricide_choking_gas_bomb_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_choking_gas_bomb_SpellScript); - void HandleScript(SpellEffIndex /*effIndex*/) - { - uint32 skipIndex = urand(0, 2); - for (uint32 i = 0; i < 3; ++i) - { - if (i == skipIndex) - continue; + void HandleScript(SpellEffIndex /*effIndex*/) + { + uint32 skipIndex = urand(0, 2); + for (uint32 i = 0; i < 3; ++i) + { + if (i == skipIndex) + continue; - uint32 spellId = uint32(GetSpellInfo()->Effects[i].CalcValue()); - GetCaster()->CastSpell(GetCaster(), spellId, true, NULL, NULL, GetCaster()->GetGUID()); - } - } + uint32 spellId = uint32(GetSpellInfo()->Effects[i].CalcValue()); + GetCaster()->CastSpell(GetCaster(), spellId, true, NULL, NULL, GetCaster()->GetGUID()); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_putricide_choking_gas_bomb_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_putricide_choking_gas_bomb_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_choking_gas_bomb_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_choking_gas_bomb_SpellScript(); + } }; // Removes aura with id stored in effect value class spell_putricide_clear_aura_effect_value : public SpellScriptLoader { - public: - spell_putricide_clear_aura_effect_value() : SpellScriptLoader("spell_putricide_clear_aura_effect_value") { } + public: + spell_putricide_clear_aura_effect_value() : SpellScriptLoader("spell_putricide_clear_aura_effect_value") { } - class spell_putricide_clear_aura_effect_value_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_clear_aura_effect_value_SpellScript); + class spell_putricide_clear_aura_effect_value_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_clear_aura_effect_value_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - uint32 auraId = sSpellMgr->GetSpellIdForDifficulty(uint32(GetEffectValue()), GetCaster()); - GetHitUnit()->RemoveAurasDueToSpell(auraId); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + uint32 auraId = sSpellMgr->GetSpellIdForDifficulty(uint32(GetEffectValue()), GetCaster()); + GetHitUnit()->RemoveAurasDueToSpell(auraId); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_putricide_clear_aura_effect_value_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_putricide_clear_aura_effect_value_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_clear_aura_effect_value_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_clear_aura_effect_value_SpellScript(); + } }; class spell_putricide_mutation_init : public SpellScriptLoader { - public: - spell_putricide_mutation_init() : SpellScriptLoader("spell_putricide_mutation_init") { } + public: + spell_putricide_mutation_init() : SpellScriptLoader("spell_putricide_mutation_init") { } - class spell_putricide_mutation_init_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_mutation_init_SpellScript); + class spell_putricide_mutation_init_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_mutation_init_SpellScript); - SpellCastResult CheckRequirementInternal(SpellCustomErrors& extendedError) - { - InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript(); - if (!instance) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + SpellCastResult CheckRequirementInternal(SpellCustomErrors& extendedError) + { + InstanceScript* instance = GetExplTargetUnit()->GetInstanceScript(); + if (!instance) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); - if (!professor) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + Creature* professor = ObjectAccessor::GetCreature(*GetExplTargetUnit(), instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); + if (!professor) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - if (professor->AI()->GetData(DATA_PHASE) == 3 || !professor->IsAlive()) - { - extendedError = SPELL_CUSTOM_ERROR_ALL_POTIONS_USED; - return SPELL_FAILED_CUSTOM_ERROR; - } + if (professor->AI()->GetData(DATA_PHASE) == 3 || !professor->IsAlive()) + { + extendedError = SPELL_CUSTOM_ERROR_ALL_POTIONS_USED; + return SPELL_FAILED_CUSTOM_ERROR; + } - if (professor->AI()->GetData(DATA_ABOMINATION)) - { - extendedError = SPELL_CUSTOM_ERROR_TOO_MANY_ABOMINATIONS; - return SPELL_FAILED_CUSTOM_ERROR; - } + if (professor->AI()->GetData(DATA_ABOMINATION)) + { + extendedError = SPELL_CUSTOM_ERROR_TOO_MANY_ABOMINATIONS; + return SPELL_FAILED_CUSTOM_ERROR; + } - return SPELL_CAST_OK; - } + return SPELL_CAST_OK; + } - SpellCastResult CheckRequirement() - { - if (!GetExplTargetUnit()) - return SPELL_FAILED_BAD_TARGETS; + SpellCastResult CheckRequirement() + { + if (!GetExplTargetUnit()) + return SPELL_FAILED_BAD_TARGETS; - if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER) - return SPELL_FAILED_TARGET_NOT_PLAYER; + if (GetExplTargetUnit()->GetTypeId() != TYPEID_PLAYER) + return SPELL_FAILED_TARGET_NOT_PLAYER; - SpellCustomErrors extension = SPELL_CUSTOM_ERROR_NONE; - SpellCastResult result = CheckRequirementInternal(extension); - if (result != SPELL_CAST_OK) - { - Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension); - return result; - } + SpellCustomErrors extension = SPELL_CUSTOM_ERROR_NONE; + SpellCastResult result = CheckRequirementInternal(extension); + if (result != SPELL_CAST_OK) + { + Spell::SendCastResult(GetExplTargetUnit()->ToPlayer(), GetSpellInfo(), 0, result, extension); + return result; + } - return SPELL_CAST_OK; - } + return SPELL_CAST_OK; + } - void Register() - { - OnCheckCast += SpellCheckCastFn(spell_putricide_mutation_init_SpellScript::CheckRequirement); - } - }; + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_putricide_mutation_init_SpellScript::CheckRequirement); + } + }; - class spell_putricide_mutation_init_AuraScript : public AuraScript - { - PrepareAuraScript(spell_putricide_mutation_init_AuraScript); + class spell_putricide_mutation_init_AuraScript : public AuraScript + { + PrepareAuraScript(spell_putricide_mutation_init_AuraScript); - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - uint32 spellId = 70311; - if (GetTarget()->GetMap()->GetSpawnMode() & 1) - spellId = 71503; + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + uint32 spellId = 70311; + if (GetTarget()->GetMap()->GetSpawnMode() & 1) + spellId = 71503; - GetTarget()->CastSpell(GetTarget(), spellId, true); - } + GetTarget()->CastSpell(GetTarget(), spellId, true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_putricide_mutation_init_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_putricide_mutation_init_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_mutation_init_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_mutation_init_SpellScript(); + } - AuraScript* GetAuraScript() const - { - return new spell_putricide_mutation_init_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_putricide_mutation_init_AuraScript(); + } }; class spell_putricide_mutated_transformation : public SpellScriptLoader { - public: - spell_putricide_mutated_transformation() : SpellScriptLoader("spell_putricide_mutated_transformation") { } + public: + spell_putricide_mutated_transformation() : SpellScriptLoader("spell_putricide_mutated_transformation") { } - class spell_putricide_mutated_transformation_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_mutated_transformation_SpellScript); + class spell_putricide_mutated_transformation_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_mutated_transformation_SpellScript); - void HandleSummon(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - Unit* caster = GetOriginalCaster(); - if (!caster) - return; + void HandleSummon(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Unit* caster = GetOriginalCaster(); + if (!caster) + return; - InstanceScript* instance = caster->GetInstanceScript(); - if (!instance) - return; + InstanceScript* instance = caster->GetInstanceScript(); + if (!instance) + return; - Creature* putricide = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); - if (!putricide) - return; + Creature* putricide = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)); + if (!putricide) + return; - if (putricide->AI()->GetData(DATA_ABOMINATION)) - { - if (Player* player = caster->ToPlayer()) - Spell::SendCastResult(player, GetSpellInfo(), 0, SPELL_FAILED_CUSTOM_ERROR, SPELL_CUSTOM_ERROR_TOO_MANY_ABOMINATIONS); - return; - } + if (putricide->AI()->GetData(DATA_ABOMINATION)) + { + if (Player* player = caster->ToPlayer()) + Spell::SendCastResult(player, GetSpellInfo(), 0, SPELL_FAILED_CUSTOM_ERROR, SPELL_CUSTOM_ERROR_TOO_MANY_ABOMINATIONS); + return; + } - if (!putricide->IsInCombat()) - putricide->SetInCombatWithZone(); + if (!putricide->IsInCombat()) + putricide->SetInCombatWithZone(); - uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB)); - uint32 duration = uint32(GetSpellInfo()->GetDuration()); + uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB)); + uint32 duration = uint32(GetSpellInfo()->GetDuration()); - Position pos; - caster->GetPosition(&pos); - TempSummon* summon = caster->GetMap()->SummonCreature(entry, pos, properties, duration, caster, GetSpellInfo()->Id); - if (!summon || !summon->IsVehicle()) - return; + Position pos; + caster->GetPosition(&pos); + TempSummon* summon = caster->GetMap()->SummonCreature(entry, pos, properties, duration, caster, GetSpellInfo()->Id); + if (!summon || !summon->IsVehicle()) + return; - summon->CastSpell(summon, SPELL_ABOMINATION_VEHICLE_POWER_DRAIN, true); - summon->CastSpell(summon, SPELL_MUTATED_TRANSFORMATION_DAMAGE, true); - caster->CastSpell(summon, SPELL_MUTATED_TRANSFORMATION_NAME, true); + summon->CastSpell(summon, SPELL_ABOMINATION_VEHICLE_POWER_DRAIN, true); + summon->CastSpell(summon, SPELL_MUTATED_TRANSFORMATION_DAMAGE, true); + caster->CastSpell(summon, SPELL_MUTATED_TRANSFORMATION_NAME, true); - //EnterVehicle(summon, 0); // VEHICLE_SPELL_RIDE_HARDCODED is used according to sniff, this is ok - caster->CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, 1, summon, TRIGGERED_FULL_MASK); - summon->SetCreatorGUID(caster->GetGUID()); - putricide->AI()->JustSummoned(summon); + //EnterVehicle(summon, 0); // VEHICLE_SPELL_RIDE_HARDCODED is used according to sniff, this is ok + caster->CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, 1, summon, TRIGGERED_FULL_MASK); + summon->SetCreatorGUID(caster->GetGUID()); + putricide->AI()->JustSummoned(summon); - summon->setPowerType(POWER_ENERGY); - summon->SetMaxPower(POWER_ENERGY, 100); - summon->SetPower(POWER_ENERGY, 0); - summon->SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, 0); - summon->SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, 0); - } + summon->setPowerType(POWER_ENERGY); + summon->SetMaxPower(POWER_ENERGY, 100); + summon->SetPower(POWER_ENERGY, 0); + summon->SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, 0); + summon->SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, 0); + } - void Register() - { - OnEffectHit += SpellEffectFn(spell_putricide_mutated_transformation_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON); - } - }; + void Register() + { + OnEffectHit += SpellEffectFn(spell_putricide_mutated_transformation_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_mutated_transformation_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_mutated_transformation_SpellScript(); + } }; class spell_putricide_mutated_transformation_dismiss : public SpellScriptLoader { - public: - spell_putricide_mutated_transformation_dismiss() : SpellScriptLoader("spell_putricide_mutated_transformation_dismiss") { } + public: + spell_putricide_mutated_transformation_dismiss() : SpellScriptLoader("spell_putricide_mutated_transformation_dismiss") { } - class spell_putricide_mutated_transformation_dismiss_AuraScript : public AuraScript - { - PrepareAuraScript(spell_putricide_mutated_transformation_dismiss_AuraScript); + class spell_putricide_mutated_transformation_dismiss_AuraScript : public AuraScript + { + PrepareAuraScript(spell_putricide_mutated_transformation_dismiss_AuraScript); - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Vehicle* veh = GetTarget()->GetVehicleKit()) - veh->RemoveAllPassengers(); - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Vehicle* veh = GetTarget()->GetVehicleKit()) + veh->RemoveAllPassengers(); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_putricide_mutated_transformation_dismiss_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_putricide_mutated_transformation_dismiss_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_putricide_mutated_transformation_dismiss_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_putricide_mutated_transformation_dismiss_AuraScript(); + } }; class spell_putricide_mutated_transformation_dmg : public SpellScriptLoader { - public: - spell_putricide_mutated_transformation_dmg() : SpellScriptLoader("spell_putricide_mutated_transformation_dmg") { } + public: + spell_putricide_mutated_transformation_dmg() : SpellScriptLoader("spell_putricide_mutated_transformation_dmg") { } - class spell_putricide_mutated_transformation_dmg_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_mutated_transformation_dmg_SpellScript); + class spell_putricide_mutated_transformation_dmg_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_mutated_transformation_dmg_SpellScript); - void FilterTargetsInitial(std::list& targets) - { - if (Unit* owner = ObjectAccessor::GetUnit(*GetCaster(), GetCaster()->GetCreatorGUID())) - targets.remove(owner); - } + void FilterTargetsInitial(std::list& targets) + { + if (Unit* owner = ObjectAccessor::GetUnit(*GetCaster(), GetCaster()->GetCreatorGUID())) + targets.remove(owner); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_mutated_transformation_dmg_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_mutated_transformation_dmg_SpellScript::FilterTargetsInitial, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_mutated_transformation_dmg_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_mutated_transformation_dmg_SpellScript(); + } }; class spell_putricide_eat_ooze : public SpellScriptLoader { - public: - spell_putricide_eat_ooze() : SpellScriptLoader("spell_putricide_eat_ooze") { } + public: + spell_putricide_eat_ooze() : SpellScriptLoader("spell_putricide_eat_ooze") { } - class spell_putricide_eat_ooze_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_eat_ooze_SpellScript); + class spell_putricide_eat_ooze_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_eat_ooze_SpellScript); - void SelectTarget(std::list& targets) - { - if (targets.empty()) - return; + void SelectTarget(std::list& targets) + { + if (targets.empty()) + return; - targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); - WorldObject* target = targets.front(); - targets.clear(); - targets.push_back(target); - } + targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); + WorldObject* target = targets.front(); + targets.clear(); + targets.push_back(target); + } - void HandleScript(SpellEffIndex /*effIndex*/) - { - Creature* target = GetHitCreature(); - if (!target) - return; + void HandleScript(SpellEffIndex /*effIndex*/) + { + Creature* target = GetHitCreature(); + if (!target) + return; - if (Aura* grow = target->GetAura(uint32(GetEffectValue()))) - { - if (grow->GetStackAmount() <= 4) - { - target->RemoveAurasDueToSpell(SPELL_GROW_STACKER); - target->RemoveAura(grow); - target->DespawnOrUnsummon(1); - } - else - grow->ModStackAmount(-4); - } - } + if (Aura* grow = target->GetAura(uint32(GetEffectValue()))) + { + if (grow->GetStackAmount() <= 4) + { + target->RemoveAurasDueToSpell(SPELL_GROW_STACKER); + target->RemoveAura(grow); + target->DespawnOrUnsummon(1); + } + else + grow->ModStackAmount(-4); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_putricide_eat_ooze_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_eat_ooze_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_putricide_eat_ooze_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_eat_ooze_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENTRY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_eat_ooze_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_eat_ooze_SpellScript(); + } }; class spell_putricide_regurgitated_ooze : public SpellScriptLoader { - public: - spell_putricide_regurgitated_ooze() : SpellScriptLoader("spell_putricide_regurgitated_ooze") { } + public: + spell_putricide_regurgitated_ooze() : SpellScriptLoader("spell_putricide_regurgitated_ooze") { } - class spell_putricide_regurgitated_ooze_SpellScript : public SpellScript - { - PrepareSpellScript(spell_putricide_regurgitated_ooze_SpellScript); + class spell_putricide_regurgitated_ooze_SpellScript : public SpellScript + { + PrepareSpellScript(spell_putricide_regurgitated_ooze_SpellScript); - // the only purpose of this hook is to fail the achievement - void ExtraEffect(SpellEffIndex /*effIndex*/) - { - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - instance->SetData(DATA_NAUSEA_ACHIEVEMENT, uint32(false)); - } + // the only purpose of this hook is to fail the achievement + void ExtraEffect(SpellEffIndex /*effIndex*/) + { + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + instance->SetData(DATA_NAUSEA_ACHIEVEMENT, uint32(false)); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_putricide_regurgitated_ooze_SpellScript::ExtraEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_putricide_regurgitated_ooze_SpellScript::ExtraEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_putricide_regurgitated_ooze_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_putricide_regurgitated_ooze_SpellScript(); + } }; void AddSC_boss_professor_putricide() { - new boss_professor_putricide(); - new npc_volatile_ooze(); - new npc_gas_cloud(); - new spell_putricide_slime_puddle(); - new spell_putricide_slime_puddle_spawn(); - new spell_putricide_grow_stacker(); - new spell_putricide_unstable_experiment(); - new spell_putricide_tear_gas_effect(); - new spell_putricide_gaseous_bloat(); - new spell_putricide_ooze_channel(); - new spell_putricide_ooze_eruption_searcher(); - new spell_putricide_mutated_plague(); - new spell_putricide_unbound_plague(); - new spell_putricide_unbound_plague_dmg(); - new spell_putricide_choking_gas_bomb(); - new spell_putricide_clear_aura_effect_value(); - new spell_putricide_mutation_init(); - new spell_putricide_mutated_transformation(); - new spell_putricide_mutated_transformation_dismiss(); - new spell_putricide_mutated_transformation_dmg(); - new spell_putricide_eat_ooze(); - new spell_putricide_regurgitated_ooze(); + new boss_professor_putricide(); + new npc_volatile_ooze(); + new npc_gas_cloud(); + new spell_putricide_slime_puddle(); + new spell_putricide_slime_puddle_spawn(); + new spell_putricide_grow_stacker(); + new spell_putricide_unstable_experiment(); + new spell_putricide_tear_gas_effect(); + new spell_putricide_gaseous_bloat(); + new spell_putricide_ooze_channel(); + new spell_putricide_ooze_eruption_searcher(); + new spell_putricide_mutated_plague(); + new spell_putricide_unbound_plague(); + new spell_putricide_unbound_plague_dmg(); + new spell_putricide_choking_gas_bomb(); + new spell_putricide_clear_aura_effect_value(); + new spell_putricide_mutation_init(); + new spell_putricide_mutated_transformation(); + new spell_putricide_mutated_transformation_dismiss(); + new spell_putricide_mutated_transformation_dmg(); + new spell_putricide_eat_ooze(); + new spell_putricide_regurgitated_ooze(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index f6f3c8f04..64a411ee2 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -11,951 +11,951 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Texts { - SAY_PRECIOUS_DIES = 0, - SAY_AGGRO = 1, - EMOTE_SLIME_SPRAY = 2, - SAY_SLIME_SPRAY = 3, - EMOTE_UNSTABLE_EXPLOSION = 4, - SAY_UNSTABLE_EXPLOSION = 5, - SAY_KILL = 6, - SAY_BERSERK = 7, - SAY_DEATH = 8, - EMOTE_MUTATED_INFECTION = 9, + SAY_PRECIOUS_DIES = 0, + SAY_AGGRO = 1, + EMOTE_SLIME_SPRAY = 2, + SAY_SLIME_SPRAY = 3, + EMOTE_UNSTABLE_EXPLOSION = 4, + SAY_UNSTABLE_EXPLOSION = 5, + SAY_KILL = 6, + SAY_BERSERK = 7, + SAY_DEATH = 8, + EMOTE_MUTATED_INFECTION = 9, - SAY_ROTFACE_OOZE_FLOOD = 2, // professor + SAY_ROTFACE_OOZE_FLOOD = 2, // professor - EMOTE_PRECIOUS_ZOMBIES = 0, + EMOTE_PRECIOUS_ZOMBIES = 0, }; enum Spells { - // Rotface - SPELL_SLIME_SPRAY = 69508, // every 20 seconds - SPELL_MUTATED_INFECTION = 69674, // hastens every 1:30 + // Rotface + SPELL_SLIME_SPRAY = 69508, // every 20 seconds + SPELL_MUTATED_INFECTION = 69674, // hastens every 1:30 - SPELL_VILE_GAS_H = 69240, + SPELL_VILE_GAS_H = 69240, - // Ooze Flood - SPELL_OOZE_FLOOD_VISUAL = 69785, - SPELL_OOZE_FLOOD_PERIODIC = 69788, + // Ooze Flood + SPELL_OOZE_FLOOD_VISUAL = 69785, + SPELL_OOZE_FLOOD_PERIODIC = 69788, - // Oozes - SPELL_LITTLE_OOZE_COMBINE = 69537, // combine 2 Small Oozes - SPELL_LARGE_OOZE_COMBINE = 69552, // combine 2 Large Oozes - SPELL_LARGE_OOZE_BUFF_COMBINE = 69611, // combine Large and Small Ooze - SPELL_OOZE_MERGE = 69889, // 2 Small Oozes summon a Large Ooze - SPELL_WEAK_RADIATING_OOZE = 69750, // passive damage aura - small - SPELL_RADIATING_OOZE = 69760, // passive damage aura - large - SPELL_UNSTABLE_OOZE = 69558, // damage boost and counter for explosion - SPELL_GREEN_ABOMINATION_HITTIN__YA_PROC = 70001, // prevents getting hit by infection - SPELL_UNSTABLE_OOZE_EXPLOSION = 69839, - SPELL_STICKY_OOZE = 69774, - SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER = 69832, + // Oozes + SPELL_LITTLE_OOZE_COMBINE = 69537, // combine 2 Small Oozes + SPELL_LARGE_OOZE_COMBINE = 69552, // combine 2 Large Oozes + SPELL_LARGE_OOZE_BUFF_COMBINE = 69611, // combine Large and Small Ooze + SPELL_OOZE_MERGE = 69889, // 2 Small Oozes summon a Large Ooze + SPELL_WEAK_RADIATING_OOZE = 69750, // passive damage aura - small + SPELL_RADIATING_OOZE = 69760, // passive damage aura - large + SPELL_UNSTABLE_OOZE = 69558, // damage boost and counter for explosion + SPELL_GREEN_ABOMINATION_HITTIN__YA_PROC = 70001, // prevents getting hit by infection + SPELL_UNSTABLE_OOZE_EXPLOSION = 69839, + SPELL_STICKY_OOZE = 69774, + SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER = 69832, - // Precious - SPELL_MORTAL_WOUND = 71127, - SPELL_DECIMATE = 71123, - SPELL_AWAKEN_PLAGUED_ZOMBIES = 71159, + // Precious + SPELL_MORTAL_WOUND = 71127, + SPELL_DECIMATE = 71123, + SPELL_AWAKEN_PLAGUED_ZOMBIES = 71159, }; #define MUTATED_INFECTION RAID_MODE(69674, 71224, 73022, 73023) enum Events { - EVENT_NONE, - // Rotface - EVENT_UNROOT, - EVENT_SLIME_SPRAY, - EVENT_HASTEN_INFECTIONS, - EVENT_MUTATED_INFECTION, - EVENT_ROTFACE_OOZE_FLOOD, - EVENT_ROTFACE_VILE_GAS, + EVENT_NONE, + // Rotface + EVENT_UNROOT, + EVENT_SLIME_SPRAY, + EVENT_HASTEN_INFECTIONS, + EVENT_MUTATED_INFECTION, + EVENT_ROTFACE_OOZE_FLOOD, + EVENT_ROTFACE_VILE_GAS, - EVENT_STICKY_OOZE, + EVENT_STICKY_OOZE, - // Precious - EVENT_DECIMATE, - EVENT_MORTAL_WOUND, - EVENT_SUMMON_ZOMBIES, + // Precious + EVENT_DECIMATE, + EVENT_MORTAL_WOUND, + EVENT_SUMMON_ZOMBIES, }; uint32 const oozeFloodSpells[4] = {69782, 69796, 69798, 69801}; uint32 getOozeFloodSpellIndex(uint32 id) { - switch (id) - { - case 69782: return 0; - case 69796: return 1; - case 69798: return 2; - case 69801: return 3; - } - return 0; + switch (id) + { + case 69782: return 0; + case 69796: return 1; + case 69798: return 2; + case 69801: return 3; + } + return 0; } struct RotfaceHeightCheck { - RotfaceHeightCheck() {} + RotfaceHeightCheck() {} - bool operator()(Creature* stalker) const - { - return stalker->GetPositionZ() < 365.0f; - } + bool operator()(Creature* stalker) const + { + return stalker->GetPositionZ() < 365.0f; + } }; class boss_rotface : public CreatureScript { - public: - boss_rotface() : CreatureScript("boss_rotface") { } + public: + boss_rotface() : CreatureScript("boss_rotface") { } - struct boss_rotfaceAI : public BossAI - { - boss_rotfaceAI(Creature* creature) : BossAI(creature, DATA_ROTFACE) - { - } + struct boss_rotfaceAI : public BossAI + { + boss_rotfaceAI(Creature* creature) : BossAI(creature, DATA_ROTFACE) + { + } - uint32 infectionCooldown; - uint64 _oozeFloodDummyGUIDs[4][2]; - uint8 _oozeFloodStage; + uint32 infectionCooldown; + uint64 _oozeFloodDummyGUIDs[4][2]; + uint8 _oozeFloodStage; - void Reset() - { - infectionCooldown = 14000; - memset(&_oozeFloodDummyGUIDs, 0, sizeof(_oozeFloodDummyGUIDs)); - _oozeFloodStage = 0; - _Reset(); - events.Reset(); - } + void Reset() + { + infectionCooldown = 14000; + memset(&_oozeFloodDummyGUIDs, 0, sizeof(_oozeFloodDummyGUIDs)); + _oozeFloodStage = 0; + _Reset(); + events.Reset(); + } - void EnterCombat(Unit* who) - { - if (!instance->CheckRequiredBosses(DATA_ROTFACE, who->ToPlayer())) - { - EnterEvadeMode(); - instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); - return; - } + void EnterCombat(Unit* who) + { + if (!instance->CheckRequiredBosses(DATA_ROTFACE, who->ToPlayer())) + { + EnterEvadeMode(); + instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); + return; + } - // schedule events - events.Reset(); - events.ScheduleEvent(EVENT_SLIME_SPRAY, 20000); - events.ScheduleEvent(EVENT_HASTEN_INFECTIONS, 90000); - events.ScheduleEvent(EVENT_MUTATED_INFECTION, 14000); - events.ScheduleEvent(EVENT_ROTFACE_OOZE_FLOOD, 8000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_ROTFACE_VILE_GAS, urand(15000, 20000)); + // schedule events + events.Reset(); + events.ScheduleEvent(EVENT_SLIME_SPRAY, 20000); + events.ScheduleEvent(EVENT_HASTEN_INFECTIONS, 90000); + events.ScheduleEvent(EVENT_MUTATED_INFECTION, 14000); + events.ScheduleEvent(EVENT_ROTFACE_OOZE_FLOOD, 8000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_ROTFACE_VILE_GAS, urand(15000, 20000)); - me->setActive(true); - Talk(SAY_AGGRO); - DoZoneInCombat(); + me->setActive(true); + Talk(SAY_AGGRO); + DoZoneInCombat(); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - professor->AI()->DoAction(ACTION_ROTFACE_COMBAT); + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + professor->AI()->DoAction(ACTION_ROTFACE_COMBAT); - instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(true)); // reset + instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(true)); // reset - // randomize ooze flood - _oozeFloodStage = urand(0,3); - std::list list; - GetCreatureListWithEntryInGrid(list, me, NPC_PUDDLE_STALKER, 60.0f); - list.remove_if(RotfaceHeightCheck()); // remove from the list all on the ground - for (std::list::const_iterator itr = list.begin(); itr != list.end(); ++itr) - { - uint32 index = me->GetHomePosition().GetAngle(*itr)/(M_PI/2.0f); - if (index>3) index = 3; - if (_oozeFloodDummyGUIDs[index][0]) - _oozeFloodDummyGUIDs[index][1] = (*itr)->GetGUID(); - else - _oozeFloodDummyGUIDs[index][0] = (*itr)->GetGUID(); - } - } + // randomize ooze flood + _oozeFloodStage = urand(0,3); + std::list list; + GetCreatureListWithEntryInGrid(list, me, NPC_PUDDLE_STALKER, 60.0f); + list.remove_if(RotfaceHeightCheck()); // remove from the list all on the ground + for (std::list::const_iterator itr = list.begin(); itr != list.end(); ++itr) + { + uint32 index = me->GetHomePosition().GetAngle(*itr)/(M_PI/2.0f); + if (index>3) index = 3; + if (_oozeFloodDummyGUIDs[index][0]) + _oozeFloodDummyGUIDs[index][1] = (*itr)->GetGUID(); + else + _oozeFloodDummyGUIDs[index][0] = (*itr)->GetGUID(); + } + } - void JustDied(Unit* /*killer*/) - { - instance->DoRemoveAurasDueToSpellOnPlayers(MUTATED_INFECTION); - _JustDied(); - Talk(SAY_DEATH); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - professor->AI()->DoAction(ACTION_ROTFACE_DEATH); - } + void JustDied(Unit* /*killer*/) + { + instance->DoRemoveAurasDueToSpellOnPlayers(MUTATED_INFECTION); + _JustDied(); + Talk(SAY_DEATH); + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + professor->AI()->DoAction(ACTION_ROTFACE_DEATH); + } - void JustReachedHome() - { - _JustReachedHome(); - instance->SetBossState(DATA_ROTFACE, FAIL); - } + void JustReachedHome() + { + _JustReachedHome(); + instance->SetBossState(DATA_ROTFACE, FAIL); + } - void JustSummoned(Creature* summon) - { - if (me->IsAlive() && me->IsInCombat() && !me->IsInEvadeMode()) - summons.Summon(summon); - else - summon->DespawnOrUnsummon(1); - } + void JustSummoned(Creature* summon) + { + if (me->IsAlive() && me->IsInCombat() && !me->IsInEvadeMode()) + summons.Summon(summon); + else + summon->DespawnOrUnsummon(1); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - ScriptedAI::EnterEvadeMode(); - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - professor->AI()->EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + ScriptedAI::EnterEvadeMode(); + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + professor->AI()->EnterEvadeMode(); + } - void SpellHitTarget(Unit* target, SpellInfo const* spell) - { - switch (spell->Id) - { - case SPELL_SLIME_SPRAY: - Talk(SAY_SLIME_SPRAY); - break; - case 69507: // Slime Spray damage - case 71213: - case 73189: - case 73190: - if (Player* p = target->ToPlayer()) - if (p->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_10) == QUEST_STATUS_INCOMPLETE || p->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_25) == QUEST_STATUS_INCOMPLETE) - p->CastSpell(p, SPELL_GREEN_BLIGHT_RESIDUE, true); - break; - case 69782: - case 69796: - case 69798: - case 69801: - { - uint32 index = getOozeFloodSpellIndex(spell->Id); - if (target->GetGUID() == _oozeFloodDummyGUIDs[index][0] || target->GetGUID() == _oozeFloodDummyGUIDs[index][1]) - target->CastSpell((Unit*)NULL, spell->Effects[0].CalcValue(), false); - } - break; - } - } + void SpellHitTarget(Unit* target, SpellInfo const* spell) + { + switch (spell->Id) + { + case SPELL_SLIME_SPRAY: + Talk(SAY_SLIME_SPRAY); + break; + case 69507: // Slime Spray damage + case 71213: + case 73189: + case 73190: + if (Player* p = target->ToPlayer()) + if (p->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_10) == QUEST_STATUS_INCOMPLETE || p->GetQuestStatus(QUEST_RESIDUE_RENDEZVOUS_25) == QUEST_STATUS_INCOMPLETE) + p->CastSpell(p, SPELL_GREEN_BLIGHT_RESIDUE, true); + break; + case 69782: + case 69796: + case 69798: + case 69801: + { + uint32 index = getOozeFloodSpellIndex(spell->Id); + if (target->GetGUID() == _oozeFloodDummyGUIDs[index][0] || target->GetGUID() == _oozeFloodDummyGUIDs[index][1]) + target->CastSpell((Unit*)NULL, spell->Effects[0].CalcValue(), false); + } + break; + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() || !CheckInRoom()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() || !CheckInRoom()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_UNROOT: - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - break; - case EVENT_SLIME_SPRAY: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) - { - if (Creature* c = me->SummonCreature(NPC_OOZE_SPRAY_STALKER, *target, TEMPSUMMON_TIMED_DESPAWN, 8000)) - { - me->SetOrientation(me->GetAngle(c)); - me->SetControlled(true, UNIT_STATE_ROOT); - me->DisableRotate(true); - me->SetFacingTo(me->GetAngle(c)); - me->SendMovementFlagUpdate(); - Talk(EMOTE_SLIME_SPRAY); - me->CastSpell(c, SPELL_SLIME_SPRAY, false); - } - } - events.DelayEvents(1); - events.ScheduleEvent(EVENT_SLIME_SPRAY, 20000); - events.ScheduleEvent(EVENT_UNROOT, 0); - break; - case EVENT_HASTEN_INFECTIONS: - if (infectionCooldown >= 8000) - { - infectionCooldown -= 2000; - events.ScheduleEvent(EVENT_HASTEN_INFECTIONS, 90000); - } - break; - case EVENT_MUTATED_INFECTION: - me->CastCustomSpell(SPELL_MUTATED_INFECTION, SPELLVALUE_MAX_TARGETS, 1, NULL, false); - events.ScheduleEvent(EVENT_MUTATED_INFECTION, infectionCooldown); - break; - case EVENT_ROTFACE_OOZE_FLOOD: - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - { - professor->AI()->Talk(SAY_ROTFACE_OOZE_FLOOD); - me->CastSpell((Unit*)NULL, oozeFloodSpells[_oozeFloodStage], true); - if (++_oozeFloodStage == 4) - _oozeFloodStage = 0; - } - events.ScheduleEvent(EVENT_ROTFACE_OOZE_FLOOD, 25000); - break; - case EVENT_ROTFACE_VILE_GAS: - { - std::list targets; - uint32 minTargets = RAID_MODE(3, 8, 3, 8); - SelectTargetList(targets, minTargets, SELECT_TARGET_RANDOM, -5.0f, true); - float minDist = 0.0f; - if (targets.size() >= minTargets) - minDist = -5.0f; + switch (events.ExecuteEvent()) + { + case EVENT_UNROOT: + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + break; + case EVENT_SLIME_SPRAY: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + { + if (Creature* c = me->SummonCreature(NPC_OOZE_SPRAY_STALKER, *target, TEMPSUMMON_TIMED_DESPAWN, 8000)) + { + me->SetOrientation(me->GetAngle(c)); + me->SetControlled(true, UNIT_STATE_ROOT); + me->DisableRotate(true); + me->SetFacingTo(me->GetAngle(c)); + me->SendMovementFlagUpdate(); + Talk(EMOTE_SLIME_SPRAY); + me->CastSpell(c, SPELL_SLIME_SPRAY, false); + } + } + events.DelayEvents(1); + events.ScheduleEvent(EVENT_SLIME_SPRAY, 20000); + events.ScheduleEvent(EVENT_UNROOT, 0); + break; + case EVENT_HASTEN_INFECTIONS: + if (infectionCooldown >= 8000) + { + infectionCooldown -= 2000; + events.ScheduleEvent(EVENT_HASTEN_INFECTIONS, 90000); + } + break; + case EVENT_MUTATED_INFECTION: + me->CastCustomSpell(SPELL_MUTATED_INFECTION, SPELLVALUE_MAX_TARGETS, 1, NULL, false); + events.ScheduleEvent(EVENT_MUTATED_INFECTION, infectionCooldown); + break; + case EVENT_ROTFACE_OOZE_FLOOD: + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + { + professor->AI()->Talk(SAY_ROTFACE_OOZE_FLOOD); + me->CastSpell((Unit*)NULL, oozeFloodSpells[_oozeFloodStage], true); + if (++_oozeFloodStage == 4) + _oozeFloodStage = 0; + } + events.ScheduleEvent(EVENT_ROTFACE_OOZE_FLOOD, 25000); + break; + case EVENT_ROTFACE_VILE_GAS: + { + std::list targets; + uint32 minTargets = RAID_MODE(3, 8, 3, 8); + SelectTargetList(targets, minTargets, SELECT_TARGET_RANDOM, -5.0f, true); + float minDist = 0.0f; + if (targets.size() >= minTargets) + minDist = -5.0f; - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, minDist, true)) - if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) - professor->CastSpell(target, SPELL_VILE_GAS_H, true); // triggered, to skip LoS check - } - events.ScheduleEvent(EVENT_ROTFACE_VILE_GAS, urand(15000, 20000)); - break; - default: - break; - } + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, minDist, true)) + if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE))) + professor->CastSpell(target, SPELL_VILE_GAS_H, true); // triggered, to skip LoS check + } + events.ScheduleEvent(EVENT_ROTFACE_VILE_GAS, urand(15000, 20000)); + break; + default: + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_little_ooze : public CreatureScript { - public: - npc_little_ooze() : CreatureScript("npc_little_ooze") { } + public: + npc_little_ooze() : CreatureScript("npc_little_ooze") { } - struct npc_little_oozeAI : public ScriptedAI - { - npc_little_oozeAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) - { - firstUpdate = true; - if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) - rotface->AI()->JustSummoned(me); - } + struct npc_little_oozeAI : public ScriptedAI + { + npc_little_oozeAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) + { + firstUpdate = true; + if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) + rotface->AI()->JustSummoned(me); + } - bool firstUpdate; - EventMap events; - InstanceScript* instance; + bool firstUpdate; + EventMap events; + InstanceScript* instance; - void IsSummonedBy(Unit* summoner) - { - if (!summoner) - return; + void IsSummonedBy(Unit* summoner) + { + if (!summoner) + return; - me->AddThreat(summoner, 500000.0f); - AttackStart(summoner); - } + me->AddThreat(summoner, 500000.0f); + AttackStart(summoner); + } - void JustDied(Unit* /*killer*/) - { - if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) - rotface->AI()->SummonedCreatureDespawn(me); - me->DespawnOrUnsummon(0); - } + void JustDied(Unit* /*killer*/) + { + if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) + rotface->AI()->SummonedCreatureDespawn(me); + me->DespawnOrUnsummon(0); + } - void UpdateAI(uint32 diff) - { - if (firstUpdate) - { - firstUpdate = false; - me->CastSpell(me, SPELL_LITTLE_OOZE_COMBINE, true); - me->CastSpell(me, SPELL_WEAK_RADIATING_OOZE, true); - events.Reset(); - events.ScheduleEvent(EVENT_STICKY_OOZE, 5000); - DoResetThreat(); - me->SetInCombatWithZone(); - if (TempSummon* ts = me->ToTempSummon()) - if (Unit* summoner = ts->GetSummoner()) - { - me->AddThreat(summoner, 500000.0f); - AttackStart(summoner); - } - } + void UpdateAI(uint32 diff) + { + if (firstUpdate) + { + firstUpdate = false; + me->CastSpell(me, SPELL_LITTLE_OOZE_COMBINE, true); + me->CastSpell(me, SPELL_WEAK_RADIATING_OOZE, true); + events.Reset(); + events.ScheduleEvent(EVENT_STICKY_OOZE, 5000); + DoResetThreat(); + me->SetInCombatWithZone(); + if (TempSummon* ts = me->ToTempSummon()) + if (Unit* summoner = ts->GetSummoner()) + { + me->AddThreat(summoner, 500000.0f); + AttackStart(summoner); + } + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (events.ExecuteEvent() == EVENT_STICKY_OOZE) - { - me->CastSpell(me->GetVictim(), SPELL_STICKY_OOZE, false); - events.ScheduleEvent(EVENT_STICKY_OOZE, 15000); - } + if (events.ExecuteEvent() == EVENT_STICKY_OOZE) + { + me->CastSpell(me->GetVictim(), SPELL_STICKY_OOZE, false); + events.ScheduleEvent(EVENT_STICKY_OOZE, 15000); + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - me->SetInCombatWithZone(); - } - }; + void EnterEvadeMode() + { + me->SetInCombatWithZone(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_big_ooze : public CreatureScript { - public: - npc_big_ooze() : CreatureScript("npc_big_ooze") { } + public: + npc_big_ooze() : CreatureScript("npc_big_ooze") { } - struct npc_big_oozeAI : public ScriptedAI - { - npc_big_oozeAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) - { - firstUpdate = true; - if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) - rotface->AI()->JustSummoned(me); - } + struct npc_big_oozeAI : public ScriptedAI + { + npc_big_oozeAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) + { + firstUpdate = true; + if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) + rotface->AI()->JustSummoned(me); + } - bool firstUpdate; - EventMap events; - InstanceScript* instance; + bool firstUpdate; + EventMap events; + InstanceScript* instance; - void IsSummonedBy(Unit* /*summoner*/) - { - if (Player* p = me->SelectNearestPlayer(100.0f)) - AttackStart(p); - } + void IsSummonedBy(Unit* /*summoner*/) + { + if (Player* p = me->SelectNearestPlayer(100.0f)) + AttackStart(p); + } - void JustDied(Unit* /*killer*/) - { - if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) - rotface->AI()->SummonedCreatureDespawn(me); - me->DespawnOrUnsummon(); - } + void JustDied(Unit* /*killer*/) + { + if (Creature* rotface = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ROTFACE))) + rotface->AI()->SummonedCreatureDespawn(me); + me->DespawnOrUnsummon(); + } - void DoAction(int32 action) - { - if (action == EVENT_STICKY_OOZE) - events.CancelEvent(EVENT_STICKY_OOZE); - } + void DoAction(int32 action) + { + if (action == EVENT_STICKY_OOZE) + events.CancelEvent(EVENT_STICKY_OOZE); + } - void UpdateAI(uint32 diff) - { - if (firstUpdate) - { - firstUpdate = false; - me->CastSpell(me, SPELL_LARGE_OOZE_COMBINE, true); - me->CastSpell(me, SPELL_LARGE_OOZE_BUFF_COMBINE, true); - me->CastSpell(me, SPELL_RADIATING_OOZE, true); - me->CastSpell(me, SPELL_UNSTABLE_OOZE, true); - me->CastSpell(me, SPELL_GREEN_ABOMINATION_HITTIN__YA_PROC, true); - events.Reset(); - events.ScheduleEvent(EVENT_STICKY_OOZE, 5000); - DoResetThreat(); - me->SetInCombatWithZone(); - if (Player* p = me->SelectNearestPlayer(100.0f)) - AttackStart(p); - } + void UpdateAI(uint32 diff) + { + if (firstUpdate) + { + firstUpdate = false; + me->CastSpell(me, SPELL_LARGE_OOZE_COMBINE, true); + me->CastSpell(me, SPELL_LARGE_OOZE_BUFF_COMBINE, true); + me->CastSpell(me, SPELL_RADIATING_OOZE, true); + me->CastSpell(me, SPELL_UNSTABLE_OOZE, true); + me->CastSpell(me, SPELL_GREEN_ABOMINATION_HITTIN__YA_PROC, true); + events.Reset(); + events.ScheduleEvent(EVENT_STICKY_OOZE, 5000); + DoResetThreat(); + me->SetInCombatWithZone(); + if (Player* p = me->SelectNearestPlayer(100.0f)) + AttackStart(p); + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_STICKY_OOZE: - me->CastSpell(me->GetVictim(), SPELL_STICKY_OOZE, false); - events.ScheduleEvent(EVENT_STICKY_OOZE, 15000); - default: - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_STICKY_OOZE: + me->CastSpell(me->GetVictim(), SPELL_STICKY_OOZE, false); + events.ScheduleEvent(EVENT_STICKY_OOZE, 15000); + default: + break; + } - if (me->IsVisible()) - DoMeleeAttackIfReady(); - } + if (me->IsVisible()) + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - me->SetInCombatWithZone(); - } - }; + void EnterEvadeMode() + { + me->SetInCombatWithZone(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_rotface_mutated_infection : public SpellScriptLoader { - public: - spell_rotface_mutated_infection() : SpellScriptLoader("spell_rotface_mutated_infection") { } + public: + spell_rotface_mutated_infection() : SpellScriptLoader("spell_rotface_mutated_infection") { } - class spell_rotface_mutated_infection_SpellScript : public SpellScript - { - PrepareSpellScript(spell_rotface_mutated_infection_SpellScript); + class spell_rotface_mutated_infection_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rotface_mutated_infection_SpellScript); - bool Load() - { - _target = NULL; - return true; - } + bool Load() + { + _target = NULL; + return true; + } - void FilterTargets(std::list& targets) - { - // remove targets with this aura already - // tank is not on this list - targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); - targets.remove(GetCaster()->GetVictim()); - if (targets.empty()) - return; + void FilterTargets(std::list& targets) + { + // remove targets with this aura already + // tank is not on this list + targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); + targets.remove(GetCaster()->GetVictim()); + if (targets.empty()) + return; - WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); - targets.clear(); - targets.push_back(target); - _target = target; - } + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); + _target = target; + } - void ReplaceTargets(std::list& targets) - { - targets.clear(); - if (_target) - targets.push_back(_target); - } + void ReplaceTargets(std::list& targets) + { + targets.clear(); + if (_target) + targets.push_back(_target); + } - void NotifyTargets() - { - if (Creature* caster = GetCaster()->ToCreature()) - if (Unit* target = GetHitUnit()) - caster->AI()->Talk(EMOTE_MUTATED_INFECTION, target); - } + void NotifyTargets() + { + if (Creature* caster = GetCaster()->ToCreature()) + if (Unit* target = GetHitUnit()) + caster->AI()->Talk(EMOTE_MUTATED_INFECTION, target); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); - AfterHit += SpellHitFn(spell_rotface_mutated_infection_SpellScript::NotifyTargets); - } + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rotface_mutated_infection_SpellScript::ReplaceTargets, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY); + AfterHit += SpellHitFn(spell_rotface_mutated_infection_SpellScript::NotifyTargets); + } - WorldObject* _target; - }; + WorldObject* _target; + }; - class spell_rotface_mutated_infection_AuraScript : public AuraScript - { - PrepareAuraScript(spell_rotface_mutated_infection_AuraScript); + class spell_rotface_mutated_infection_AuraScript : public AuraScript + { + PrepareAuraScript(spell_rotface_mutated_infection_AuraScript); - void ExtraRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[2].CalcValue(), true); - } + void ExtraRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[2].CalcValue(), true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_rotface_mutated_infection_AuraScript::ExtraRemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_rotface_mutated_infection_AuraScript::ExtraRemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_rotface_mutated_infection_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_rotface_mutated_infection_SpellScript(); + } - AuraScript* GetAuraScript() const - { - return new spell_rotface_mutated_infection_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_rotface_mutated_infection_AuraScript(); + } }; class spell_rotface_little_ooze_combine : public SpellScriptLoader { - public: - spell_rotface_little_ooze_combine() : SpellScriptLoader("spell_rotface_little_ooze_combine") { } + public: + spell_rotface_little_ooze_combine() : SpellScriptLoader("spell_rotface_little_ooze_combine") { } - class spell_rotface_little_ooze_combine_SpellScript : public SpellScript - { - PrepareSpellScript(spell_rotface_little_ooze_combine_SpellScript); + class spell_rotface_little_ooze_combine_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rotface_little_ooze_combine_SpellScript); - void HandleScript(SpellEffIndex /*effIndex*/) - { - // little targetting little + void HandleScript(SpellEffIndex /*effIndex*/) + { + // little targetting little - if (!GetHitCreature() || !GetHitCreature()->IsAlive()) - return; + if (!GetHitCreature() || !GetHitCreature()->IsAlive()) + return; - GetCaster()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE); - GetHitCreature()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE); - GetHitCreature()->CastSpell(GetCaster(), SPELL_OOZE_MERGE, true); - GetHitCreature()->DespawnOrUnsummon(); - if (GetCaster()->ToCreature()) - GetCaster()->ToCreature()->DespawnOrUnsummon(); - } + GetCaster()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE); + GetHitCreature()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE); + GetHitCreature()->CastSpell(GetCaster(), SPELL_OOZE_MERGE, true); + GetHitCreature()->DespawnOrUnsummon(); + if (GetCaster()->ToCreature()) + GetCaster()->ToCreature()->DespawnOrUnsummon(); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_rotface_little_ooze_combine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_rotface_little_ooze_combine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_rotface_little_ooze_combine_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_rotface_little_ooze_combine_SpellScript(); + } }; class spell_rotface_large_ooze_combine : public SpellScriptLoader { - public: - spell_rotface_large_ooze_combine() : SpellScriptLoader("spell_rotface_large_ooze_combine") { } + public: + spell_rotface_large_ooze_combine() : SpellScriptLoader("spell_rotface_large_ooze_combine") { } - class spell_rotface_large_ooze_combine_SpellScript : public SpellScript - { - PrepareSpellScript(spell_rotface_large_ooze_combine_SpellScript); + class spell_rotface_large_ooze_combine_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rotface_large_ooze_combine_SpellScript); - void HandleScript(SpellEffIndex /*effIndex*/) - { - // large targetting large + void HandleScript(SpellEffIndex /*effIndex*/) + { + // large targetting large - if (!GetHitCreature() || !GetHitCreature()->IsAlive()) - return; + if (!GetHitCreature() || !GetHitCreature()->IsAlive()) + return; - uint8 casterStack = 1; - uint8 targetStack = 1; - Aura* casterAura = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE); - if (casterAura) - casterStack = casterAura->GetStackAmount(); - Aura* targetAura = GetHitCreature()->GetAura(SPELL_UNSTABLE_OOZE); - if (targetAura) - targetStack = targetAura->GetStackAmount(); - uint8 newStack = casterStack+targetStack; - if (newStack > 5) - newStack = 5; - if (casterAura) - casterAura->SetStackAmount(newStack); - else - { - GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE, true); - if (Aura* aur = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE)) - aur->SetStackAmount(newStack); - } + uint8 casterStack = 1; + uint8 targetStack = 1; + Aura* casterAura = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE); + if (casterAura) + casterStack = casterAura->GetStackAmount(); + Aura* targetAura = GetHitCreature()->GetAura(SPELL_UNSTABLE_OOZE); + if (targetAura) + targetStack = targetAura->GetStackAmount(); + uint8 newStack = casterStack+targetStack; + if (newStack > 5) + newStack = 5; + if (casterAura) + casterAura->SetStackAmount(newStack); + else + { + GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE, true); + if (Aura* aur = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE)) + aur->SetStackAmount(newStack); + } - // red color! - if (newStack >= 4) - GetCaster()->CastSpell(GetCaster(), 69844, true); + // red color! + if (newStack >= 4) + GetCaster()->CastSpell(GetCaster(), 69844, true); - // explode! - if (newStack >= 5) - { - GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE); - GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE); - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_ROTFACE))) - if (rotface->IsAlive()) - { - if (GetCaster()->GetTypeId() == TYPEID_UNIT) - GetCaster()->ToCreature()->AI()->Talk(EMOTE_UNSTABLE_EXPLOSION); - rotface->AI()->Talk(SAY_UNSTABLE_EXPLOSION); - } + // explode! + if (newStack >= 5) + { + GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE); + GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE); + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_ROTFACE))) + if (rotface->IsAlive()) + { + if (GetCaster()->GetTypeId() == TYPEID_UNIT) + GetCaster()->ToCreature()->AI()->Talk(EMOTE_UNSTABLE_EXPLOSION); + rotface->AI()->Talk(SAY_UNSTABLE_EXPLOSION); + } - if (Creature* cre = GetCaster()->ToCreature()) - cre->AI()->DoAction(EVENT_STICKY_OOZE); - GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, NULL, NULL, GetCaster()->GetGUID()); - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false)); - } + if (Creature* cre = GetCaster()->ToCreature()) + cre->AI()->DoAction(EVENT_STICKY_OOZE); + GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, NULL, NULL, GetCaster()->GetGUID()); + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false)); + } - GetHitCreature()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE); - GetHitCreature()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE); - GetHitCreature()->DespawnOrUnsummon(); - } + GetHitCreature()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE); + GetHitCreature()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE); + GetHitCreature()->DespawnOrUnsummon(); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_rotface_large_ooze_combine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_rotface_large_ooze_combine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_rotface_large_ooze_combine_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_rotface_large_ooze_combine_SpellScript(); + } }; class spell_rotface_large_ooze_buff_combine : public SpellScriptLoader { - public: - spell_rotface_large_ooze_buff_combine() : SpellScriptLoader("spell_rotface_large_ooze_buff_combine") { } + public: + spell_rotface_large_ooze_buff_combine() : SpellScriptLoader("spell_rotface_large_ooze_buff_combine") { } - class spell_rotface_large_ooze_buff_combine_SpellScript : public SpellScript - { - PrepareSpellScript(spell_rotface_large_ooze_buff_combine_SpellScript); + class spell_rotface_large_ooze_buff_combine_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rotface_large_ooze_buff_combine_SpellScript); - void HandleScript(SpellEffIndex /*effIndex*/) - { - // large targetting little + void HandleScript(SpellEffIndex /*effIndex*/) + { + // large targetting little - if (!GetHitCreature() || !GetHitCreature()->IsAlive()) - return; + if (!GetHitCreature() || !GetHitCreature()->IsAlive()) + return; - if (Aura* unstable = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE)) - { - uint8 newStack = uint8(unstable->GetStackAmount()+1); - unstable->SetStackAmount(newStack); + if (Aura* unstable = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE)) + { + uint8 newStack = uint8(unstable->GetStackAmount()+1); + unstable->SetStackAmount(newStack); - // red color! - if (newStack >= 4) - GetCaster()->CastSpell(GetCaster(), 69844, true); + // red color! + if (newStack >= 4) + GetCaster()->CastSpell(GetCaster(), 69844, true); - // explode! - if (newStack >= 5) - { - GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE); - GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE); - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_ROTFACE))) - if (rotface->IsAlive()) - { - if (GetCaster()->GetTypeId() == TYPEID_UNIT) - GetCaster()->ToCreature()->AI()->Talk(EMOTE_UNSTABLE_EXPLOSION); - rotface->AI()->Talk(SAY_UNSTABLE_EXPLOSION); - } + // explode! + if (newStack >= 5) + { + GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE); + GetCaster()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE); + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + if (Creature* rotface = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_ROTFACE))) + if (rotface->IsAlive()) + { + if (GetCaster()->GetTypeId() == TYPEID_UNIT) + GetCaster()->ToCreature()->AI()->Talk(EMOTE_UNSTABLE_EXPLOSION); + rotface->AI()->Talk(SAY_UNSTABLE_EXPLOSION); + } - if (Creature* cre = GetCaster()->ToCreature()) - cre->AI()->DoAction(EVENT_STICKY_OOZE); - GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, NULL, NULL, GetCaster()->GetGUID()); - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false)); - } - } + if (Creature* cre = GetCaster()->ToCreature()) + cre->AI()->DoAction(EVENT_STICKY_OOZE); + GetCaster()->CastSpell(GetCaster(), SPELL_UNSTABLE_OOZE_EXPLOSION, false, NULL, NULL, GetCaster()->GetGUID()); + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + instance->SetData(DATA_OOZE_DANCE_ACHIEVEMENT, uint32(false)); + } + } - GetHitCreature()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE); - GetHitCreature()->DespawnOrUnsummon(); - } + GetHitCreature()->RemoveAurasDueToSpell(SPELL_LITTLE_OOZE_COMBINE); + GetHitCreature()->DespawnOrUnsummon(); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_rotface_large_ooze_buff_combine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_rotface_large_ooze_buff_combine_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_rotface_large_ooze_buff_combine_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_rotface_large_ooze_buff_combine_SpellScript(); + } }; class spell_rotface_unstable_ooze_explosion_init : public SpellScriptLoader { - public: - spell_rotface_unstable_ooze_explosion_init() : SpellScriptLoader("spell_rotface_unstable_ooze_explosion_init") { } + public: + spell_rotface_unstable_ooze_explosion_init() : SpellScriptLoader("spell_rotface_unstable_ooze_explosion_init") { } - class spell_rotface_unstable_ooze_explosion_init_SpellScript : public SpellScript - { - PrepareSpellScript(spell_rotface_unstable_ooze_explosion_init_SpellScript); + class spell_rotface_unstable_ooze_explosion_init_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rotface_unstable_ooze_explosion_init_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER)) + return false; + return true; + } - void HandleCast(SpellEffIndex effIndex) - { - PreventHitEffect(effIndex); - if (!GetHitUnit()) - return; + void HandleCast(SpellEffIndex effIndex) + { + PreventHitEffect(effIndex); + if (!GetHitUnit()) + return; - float x, y, z; - GetHitUnit()->GetPosition(x, y, z); - Creature* dummy = GetCaster()->SummonCreature(NPC_UNSTABLE_EXPLOSION_STALKER, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); - GetCaster()->CastSpell(dummy, SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER, true); - } + float x, y, z; + GetHitUnit()->GetPosition(x, y, z); + Creature* dummy = GetCaster()->SummonCreature(NPC_UNSTABLE_EXPLOSION_STALKER, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); + GetCaster()->CastSpell(dummy, SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_rotface_unstable_ooze_explosion_init_SpellScript::HandleCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_rotface_unstable_ooze_explosion_init_SpellScript::HandleCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_rotface_unstable_ooze_explosion_init_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_rotface_unstable_ooze_explosion_init_SpellScript(); + } }; class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader { - public: - spell_rotface_unstable_ooze_explosion() : SpellScriptLoader("spell_rotface_unstable_ooze_explosion") { } + public: + spell_rotface_unstable_ooze_explosion() : SpellScriptLoader("spell_rotface_unstable_ooze_explosion") { } - class spell_rotface_unstable_ooze_explosion_SpellScript : public SpellScript - { - PrepareSpellScript(spell_rotface_unstable_ooze_explosion_SpellScript); + class spell_rotface_unstable_ooze_explosion_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rotface_unstable_ooze_explosion_SpellScript); - void CheckTarget(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(EFFECT_0); - if (!GetExplTargetDest()) - return; + void CheckTarget(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(EFFECT_0); + if (!GetExplTargetDest()) + return; - uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell; + uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell; - float x, y, z; - GetExplTargetDest()->GetPosition(x, y, z); - // let Rotface handle the cast - caster dies before this executes - if (InstanceScript* script = GetCaster()->GetInstanceScript()) - if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE))) - rotface->CastSpell(x, y, z, triggered_spell_id, true/*, NULL, NULL, GetCaster()->GetGUID()*/); // caster not available on clientside, no log in such case - } + float x, y, z; + GetExplTargetDest()->GetPosition(x, y, z); + // let Rotface handle the cast - caster dies before this executes + if (InstanceScript* script = GetCaster()->GetInstanceScript()) + if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE))) + rotface->CastSpell(x, y, z, triggered_spell_id, true/*, NULL, NULL, GetCaster()->GetGUID()*/); // caster not available on clientside, no log in such case + } - void Register() - { - OnEffectHit += SpellEffectFn(spell_rotface_unstable_ooze_explosion_SpellScript::CheckTarget, EFFECT_0, SPELL_EFFECT_TRIGGER_MISSILE); - } - }; + void Register() + { + OnEffectHit += SpellEffectFn(spell_rotface_unstable_ooze_explosion_SpellScript::CheckTarget, EFFECT_0, SPELL_EFFECT_TRIGGER_MISSILE); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_rotface_unstable_ooze_explosion_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_rotface_unstable_ooze_explosion_SpellScript(); + } }; class spell_rotface_unstable_ooze_explosion_suicide : public SpellScriptLoader { - public: - spell_rotface_unstable_ooze_explosion_suicide() : SpellScriptLoader("spell_rotface_unstable_ooze_explosion_suicide") { } + public: + spell_rotface_unstable_ooze_explosion_suicide() : SpellScriptLoader("spell_rotface_unstable_ooze_explosion_suicide") { } - class spell_rotface_unstable_ooze_explosion_suicide_AuraScript : public AuraScript - { - PrepareAuraScript(spell_rotface_unstable_ooze_explosion_suicide_AuraScript); + class spell_rotface_unstable_ooze_explosion_suicide_AuraScript : public AuraScript + { + PrepareAuraScript(spell_rotface_unstable_ooze_explosion_suicide_AuraScript); - void DespawnSelf(AuraEffect const* /*aurEff*/) - { - PreventDefaultAction(); - Unit* target = GetTarget(); - if (target->GetTypeId() != TYPEID_UNIT) - return; + void DespawnSelf(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + Unit* target = GetTarget(); + if (target->GetTypeId() != TYPEID_UNIT) + return; - target->SetVisible(false); - target->RemoveAllAuras(); - //target->ToCreature()->DespawnOrUnsummon(); - target->ToCreature()->DespawnOrUnsummon(60000); - } + target->SetVisible(false); + target->RemoveAllAuras(); + //target->ToCreature()->DespawnOrUnsummon(); + target->ToCreature()->DespawnOrUnsummon(60000); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_rotface_unstable_ooze_explosion_suicide_AuraScript::DespawnSelf, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_rotface_unstable_ooze_explosion_suicide_AuraScript::DespawnSelf, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_rotface_unstable_ooze_explosion_suicide_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_rotface_unstable_ooze_explosion_suicide_AuraScript(); + } }; class npc_precious_icc : public CreatureScript { - public: - npc_precious_icc() : CreatureScript("npc_precious_icc") { } + public: + npc_precious_icc() : CreatureScript("npc_precious_icc") { } - struct npc_precious_iccAI : public ScriptedAI - { - npc_precious_iccAI(Creature* creature) : ScriptedAI(creature), summons(me){} + struct npc_precious_iccAI : public ScriptedAI + { + npc_precious_iccAI(Creature* creature) : ScriptedAI(creature), summons(me){} - void Reset() - { - events.Reset(); - summons.DespawnAll(); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + } - void EnterCombat(Unit* /*target*/) - { - me->setActive(true); - events.ScheduleEvent(EVENT_DECIMATE, urand(20000, 25000)); - events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(1500, 2500)); - events.ScheduleEvent(EVENT_SUMMON_ZOMBIES, urand(25000, 30000)); - } + void EnterCombat(Unit* /*target*/) + { + me->setActive(true); + events.ScheduleEvent(EVENT_DECIMATE, urand(20000, 25000)); + events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(1500, 2500)); + events.ScheduleEvent(EVENT_SUMMON_ZOMBIES, urand(25000, 30000)); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - summon->AI()->AttackStart(target); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + summon->AI()->AttackStart(target); + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + } - void JustDied(Unit* /*killer*/) - { - summons.DespawnAll(); - if (InstanceScript* _instance = me->GetInstanceScript()) - if (Creature* rotface = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ROTFACE))) - if (rotface->IsAlive()) - rotface->AI()->Talk(SAY_PRECIOUS_DIES); - } + void JustDied(Unit* /*killer*/) + { + summons.DespawnAll(); + if (InstanceScript* _instance = me->GetInstanceScript()) + if (Creature* rotface = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ROTFACE))) + if (rotface->IsAlive()) + rotface->AI()->Talk(SAY_PRECIOUS_DIES); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_DECIMATE: - me->CastSpell(me->GetVictim(), SPELL_DECIMATE, false); - events.ScheduleEvent(EVENT_DECIMATE, urand(20000, 25000)); - break; - case EVENT_MORTAL_WOUND: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); - events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(1500, 2500)); - break; - case EVENT_SUMMON_ZOMBIES: - Talk(EMOTE_PRECIOUS_ZOMBIES); - for (uint32 i = 0; i < 11; ++i) - me->CastSpell(me, SPELL_AWAKEN_PLAGUED_ZOMBIES, true); - events.ScheduleEvent(EVENT_SUMMON_ZOMBIES, urand(20000, 25000)); - break; - default: - break; - } - } + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DECIMATE: + me->CastSpell(me->GetVictim(), SPELL_DECIMATE, false); + events.ScheduleEvent(EVENT_DECIMATE, urand(20000, 25000)); + break; + case EVENT_MORTAL_WOUND: + me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); + events.ScheduleEvent(EVENT_MORTAL_WOUND, urand(1500, 2500)); + break; + case EVENT_SUMMON_ZOMBIES: + Talk(EMOTE_PRECIOUS_ZOMBIES); + for (uint32 i = 0; i < 11; ++i) + me->CastSpell(me, SPELL_AWAKEN_PLAGUED_ZOMBIES, true); + events.ScheduleEvent(EVENT_SUMMON_ZOMBIES, urand(20000, 25000)); + break; + default: + break; + } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap events; - SummonList summons; - }; + private: + EventMap events; + SummonList summons; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; void AddSC_boss_rotface() { - new boss_rotface(); - new npc_little_ooze(); - new npc_big_ooze(); - new spell_rotface_mutated_infection(); - new spell_rotface_little_ooze_combine(); - new spell_rotface_large_ooze_combine(); - new spell_rotface_large_ooze_buff_combine(); - new spell_rotface_unstable_ooze_explosion_init(); - new spell_rotface_unstable_ooze_explosion(); - new spell_rotface_unstable_ooze_explosion_suicide(); + new boss_rotface(); + new npc_little_ooze(); + new npc_big_ooze(); + new spell_rotface_mutated_infection(); + new spell_rotface_little_ooze_combine(); + new spell_rotface_large_ooze_combine(); + new spell_rotface_large_ooze_buff_combine(); + new spell_rotface_unstable_ooze_explosion_init(); + new spell_rotface_unstable_ooze_explosion(); + new spell_rotface_unstable_ooze_explosion_suicide(); - new npc_precious_icc(); + new npc_precious_icc(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 1ff0a1010..b4b29a62e 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -11,67 +11,67 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Texts { - SAY_AGGRO = 0, // You are fools to have come to this place! The icy winds of Northrend will consume your souls! - SAY_UNCHAINED_MAGIC = 1, // Suffer, mortals, as your pathetic magic betrays you! - EMOTE_WARN_BLISTERING_COLD = 2, // %s prepares to unleash a wave of blistering cold! - SAY_BLISTERING_COLD = 3, // Can you feel the cold hand of death upon your heart? - SAY_RESPITE_FOR_A_TORMENTED_SOUL = 4, // Aaah! It burns! What sorcery is this?! - SAY_AIR_PHASE = 5, // Your incursion ends here! None shall survive! - SAY_PHASE_2 = 6, // Now feel my master's limitless power and despair! - EMOTE_WARN_FROZEN_ORB = 7, // %s fires a frozen orb towards $N! - SAY_KILL = 8, // Perish! - // A flaw of mortality... - SAY_BERSERK = 9, // Enough! I tire of these games! - SAY_DEATH = 10, // Free...at last... - EMOTE_BERSERK_RAID = 11, - EMOTE_WEAKENING = 101, // %s appears to be weakening! + SAY_AGGRO = 0, // You are fools to have come to this place! The icy winds of Northrend will consume your souls! + SAY_UNCHAINED_MAGIC = 1, // Suffer, mortals, as your pathetic magic betrays you! + EMOTE_WARN_BLISTERING_COLD = 2, // %s prepares to unleash a wave of blistering cold! + SAY_BLISTERING_COLD = 3, // Can you feel the cold hand of death upon your heart? + SAY_RESPITE_FOR_A_TORMENTED_SOUL = 4, // Aaah! It burns! What sorcery is this?! + SAY_AIR_PHASE = 5, // Your incursion ends here! None shall survive! + SAY_PHASE_2 = 6, // Now feel my master's limitless power and despair! + EMOTE_WARN_FROZEN_ORB = 7, // %s fires a frozen orb towards $N! + SAY_KILL = 8, // Perish! + // A flaw of mortality... + SAY_BERSERK = 9, // Enough! I tire of these games! + SAY_DEATH = 10, // Free...at last... + EMOTE_BERSERK_RAID = 11, + EMOTE_WEAKENING = 101, // %s appears to be weakening! }; enum Spells { - // Sindragosa - SPELL_SINDRAGOSA_S_FURY = 70608, - SPELL_TANK_MARKER = 71039, - SPELL_TANK_MARKER_AURA = 71038, - SPELL_FROST_AURA = 70084, - SPELL_PERMAEATING_CHILL = 70109, - SPELL_CLEAVE = 19983, - SPELL_TAIL_SMASH = 71077, - SPELL_FROST_BREATH_P1 = 69649, - SPELL_FROST_BREATH_P2 = 73061, - SPELL_UNCHAINED_MAGIC = 69762, - SPELL_INSTABILITY = 69766, - SPELL_BACKLASH = 69770, - SPELL_ICY_GRIP = 70117, - SPELL_ICY_GRIP_JUMP = 70122, - SPELL_BLISTERING_COLD = 70123, - SPELL_FROST_BEACON = 70126, - SPELL_ICE_TOMB_TARGET = 69712, - SPELL_ICE_TOMB_DUMMY = 69675, - SPELL_ICE_TOMB_UNTARGETABLE = 69700, - SPELL_ICE_TOMB_DAMAGE = 70157, - SPELL_ASPHYXIATION = 71665, - SPELL_FROST_BOMB_TRIGGER = 69846, - SPELL_FROST_BOMB_VISUAL = 70022, - SPELL_BIRTH_NO_VISUAL = 40031, - SPELL_FROST_BOMB = 69845, - SPELL_MYSTIC_BUFFET = 70128, + // Sindragosa + SPELL_SINDRAGOSA_S_FURY = 70608, + SPELL_TANK_MARKER = 71039, + SPELL_TANK_MARKER_AURA = 71038, + SPELL_FROST_AURA = 70084, + SPELL_PERMAEATING_CHILL = 70109, + SPELL_CLEAVE = 19983, + SPELL_TAIL_SMASH = 71077, + SPELL_FROST_BREATH_P1 = 69649, + SPELL_FROST_BREATH_P2 = 73061, + SPELL_UNCHAINED_MAGIC = 69762, + SPELL_INSTABILITY = 69766, + SPELL_BACKLASH = 69770, + SPELL_ICY_GRIP = 70117, + SPELL_ICY_GRIP_JUMP = 70122, + SPELL_BLISTERING_COLD = 70123, + SPELL_FROST_BEACON = 70126, + SPELL_ICE_TOMB_TARGET = 69712, + SPELL_ICE_TOMB_DUMMY = 69675, + SPELL_ICE_TOMB_UNTARGETABLE = 69700, + SPELL_ICE_TOMB_DAMAGE = 70157, + SPELL_ASPHYXIATION = 71665, + SPELL_FROST_BOMB_TRIGGER = 69846, + SPELL_FROST_BOMB_VISUAL = 70022, + SPELL_BIRTH_NO_VISUAL = 40031, + SPELL_FROST_BOMB = 69845, + SPELL_MYSTIC_BUFFET = 70128, - // Spinestalker - SPELL_BELLOWING_ROAR = 36922, - SPELL_CLEAVE_SPINESTALKER = 40505, - SPELL_TAIL_SWEEP = 71370, + // Spinestalker + SPELL_BELLOWING_ROAR = 36922, + SPELL_CLEAVE_SPINESTALKER = 40505, + SPELL_TAIL_SWEEP = 71370, - // Rimefang - SPELL_FROST_BREATH = 71386, - SPELL_FROST_AURA_RIMEFANG = 71387, - SPELL_ICY_BLAST = 71376, - SPELL_ICY_BLAST_AREA = 71380, + // Rimefang + SPELL_FROST_BREATH = 71386, + SPELL_FROST_AURA_RIMEFANG = 71387, + SPELL_ICY_BLAST = 71376, + SPELL_ICY_BLAST_AREA = 71380, - // Frostwarden Handler - SPELL_FOCUS_FIRE = 71350, - SPELL_ORDER_WHELP = 71357, - SPELL_CONCUSSIVE_SHOCK = 71337, + // Frostwarden Handler + SPELL_FOCUS_FIRE = 71350, + SPELL_ORDER_WHELP = 71357, + SPELL_CONCUSSIVE_SHOCK = 71337, }; enum Shadowmourne @@ -84,65 +84,65 @@ enum Shadowmourne enum Events { - EVENT_NONE, + EVENT_NONE, - // Sindragosa - EVENT_BERSERK, - EVENT_CLEAVE, - EVENT_TAIL_SMASH, - EVENT_FROST_BREATH, - EVENT_UNROOT, - EVENT_UNCHAINED_MAGIC, - EVENT_ICY_GRIP, - EVENT_BLISTERING_COLD, - EVENT_BLISTERING_COLD_YELL, - EVENT_AIR_PHASE, - EVENT_AIR_MOVEMENT, - EVENT_AIR_MOVEMENT_FAR, - EVENT_LAND, - EVENT_LAND_GROUND, - EVENT_FROST_BOMB, - EVENT_THIRD_PHASE_CHECK, - EVENT_ICE_TOMB, + // Sindragosa + EVENT_BERSERK, + EVENT_CLEAVE, + EVENT_TAIL_SMASH, + EVENT_FROST_BREATH, + EVENT_UNROOT, + EVENT_UNCHAINED_MAGIC, + EVENT_ICY_GRIP, + EVENT_BLISTERING_COLD, + EVENT_BLISTERING_COLD_YELL, + EVENT_AIR_PHASE, + EVENT_AIR_MOVEMENT, + EVENT_AIR_MOVEMENT_FAR, + EVENT_LAND, + EVENT_LAND_GROUND, + EVENT_FROST_BOMB, + EVENT_THIRD_PHASE_CHECK, + EVENT_ICE_TOMB, - // Spinestalker - EVENT_BELLOWING_ROAR = 13, - EVENT_CLEAVE_SPINESTALKER = 14, - EVENT_TAIL_SWEEP = 15, + // Spinestalker + EVENT_BELLOWING_ROAR = 13, + EVENT_CLEAVE_SPINESTALKER = 14, + EVENT_TAIL_SWEEP = 15, - // Rimefang - EVENT_FROST_BREATH_RIMEFANG = 16, - EVENT_ICY_BLAST = 17, - EVENT_ICY_BLAST_CAST = 18, + // Rimefang + EVENT_FROST_BREATH_RIMEFANG = 16, + EVENT_ICY_BLAST = 17, + EVENT_ICY_BLAST_CAST = 18, - // Trash - EVENT_FROSTWARDEN_ORDER_WHELP = 19, - EVENT_CONCUSSIVE_SHOCK = 20, - EVENT_WHELP_FROST_BLAST = 21, + // Trash + EVENT_FROSTWARDEN_ORDER_WHELP = 19, + EVENT_CONCUSSIVE_SHOCK = 20, + EVENT_WHELP_FROST_BLAST = 21, - // event groups - EVENT_GROUP_LAND_PHASE = 1, + // event groups + EVENT_GROUP_LAND_PHASE = 1, }; enum FrostwingData { - DATA_MYSTIC_BUFFET_STACK = 0, - DATA_FROSTWYRM_OWNER = 1, - DATA_WHELP_MARKER = 2, - DATA_LINKED_GAMEOBJECT = 3, - DATA_TRAPPED_PLAYER = 4, + DATA_MYSTIC_BUFFET_STACK = 0, + DATA_FROSTWYRM_OWNER = 1, + DATA_WHELP_MARKER = 2, + DATA_LINKED_GAMEOBJECT = 3, + DATA_TRAPPED_PLAYER = 4, }; enum MovementPoints { - POINT_FROSTWYRM_FLY_IN = 1, - POINT_FROSTWYRM_LAND = 2, - POINT_AIR_PHASE = 3, - POINT_TAKEOFF = 4, - POINT_LAND = 5, - POINT_AIR_PHASE_FAR = 6, - POINT_LAND_GROUND = 7, - POINT_CHASE_VICTIM = 8, + POINT_FROSTWYRM_FLY_IN = 1, + POINT_FROSTWYRM_LAND = 2, + POINT_AIR_PHASE = 3, + POINT_TAKEOFF = 4, + POINT_LAND = 5, + POINT_AIR_PHASE_FAR = 6, + POINT_LAND_GROUND = 7, + POINT_CHASE_VICTIM = 8, }; Position const RimefangFlyPos = {4413.309f, 2456.421f, 233.3795f, 2.890186f}; @@ -157,996 +157,996 @@ Position const SindragosaAirPosFar = {4525.600f, 2485.150f, 245.0820f, 3.141593f class FrostwyrmLandEvent : public BasicEvent { - public: - FrostwyrmLandEvent(Creature& owner, Position const& dest) : _owner(owner), _dest(dest) { } + public: + FrostwyrmLandEvent(Creature& owner, Position const& dest) : _owner(owner), _dest(dest) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - _owner.GetMotionMaster()->MoveLand(POINT_FROSTWYRM_LAND, _dest, 8.5f); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + _owner.GetMotionMaster()->MoveLand(POINT_FROSTWYRM_LAND, _dest, 8.5f); + return true; + } - private: - Creature& _owner; - Position const& _dest; + private: + Creature& _owner; + Position const& _dest; }; class FrostBombExplosion : public BasicEvent { - public: - FrostBombExplosion(Creature* owner, uint64 sindragosaGUID) : _owner(owner), _sindragosaGUID(sindragosaGUID) { } + public: + FrostBombExplosion(Creature* owner, uint64 sindragosaGUID) : _owner(owner), _sindragosaGUID(sindragosaGUID) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - _owner->CastSpell((Unit*)NULL, SPELL_FROST_BOMB, false, NULL, NULL, _sindragosaGUID); - _owner->RemoveAurasDueToSpell(SPELL_FROST_BOMB_VISUAL); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + _owner->CastSpell((Unit*)NULL, SPELL_FROST_BOMB, false, NULL, NULL, _sindragosaGUID); + _owner->RemoveAurasDueToSpell(SPELL_FROST_BOMB_VISUAL); + return true; + } - private: - Creature* _owner; - uint64 _sindragosaGUID; + private: + Creature* _owner; + uint64 _sindragosaGUID; }; class IceTombSummonEvent : public BasicEvent { - public: - IceTombSummonEvent(Unit* owner, uint64 sindragosaGUID) : _owner(owner), _sindragosaGUID(sindragosaGUID) { } + public: + IceTombSummonEvent(Unit* owner, uint64 sindragosaGUID) : _owner(owner), _sindragosaGUID(sindragosaGUID) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - if (!_owner->IsAlive() || !_owner->HasAura(SPELL_ICE_TOMB_DAMAGE)) - return true; - if (Creature* sindragosa = ObjectAccessor::GetCreature(*_owner, _sindragosaGUID)) - { - if (!sindragosa->IsAlive()) - return true; - Position pos; - _owner->GetPosition(&pos); - _owner->m_positionZ -= 1.0f; // +2.0f in UpdateGroundPositionZ, prevent going over GO model of another ice block, because new would be spawned on top of the old one xd - _owner->UpdateGroundPositionZ(pos.m_positionX, pos.m_positionY, pos.m_positionZ); - if (pos.GetPositionZ() < 203.0f) - pos.m_positionZ = 203.0f; - if (TempSummon* summon = sindragosa->SummonCreature(NPC_ICE_TOMB, pos)) - { - summon->m_positionZ = summon->GetPositionZ()+5.0f; - summon->AI()->SetGUID(_owner->GetGUID(), DATA_TRAPPED_PLAYER); - _owner->CastSpell(_owner, SPELL_ICE_TOMB_UNTARGETABLE, true); - if (GameObject* go = summon->SummonGameObject(GO_ICE_BLOCK, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()-3.5f, pos.GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0)) - { - go->SetSpellId(SPELL_ICE_TOMB_DAMAGE); - summon->AddGameObject(go); - } - } - } - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + if (!_owner->IsAlive() || !_owner->HasAura(SPELL_ICE_TOMB_DAMAGE)) + return true; + if (Creature* sindragosa = ObjectAccessor::GetCreature(*_owner, _sindragosaGUID)) + { + if (!sindragosa->IsAlive()) + return true; + Position pos; + _owner->GetPosition(&pos); + _owner->m_positionZ -= 1.0f; // +2.0f in UpdateGroundPositionZ, prevent going over GO model of another ice block, because new would be spawned on top of the old one xd + _owner->UpdateGroundPositionZ(pos.m_positionX, pos.m_positionY, pos.m_positionZ); + if (pos.GetPositionZ() < 203.0f) + pos.m_positionZ = 203.0f; + if (TempSummon* summon = sindragosa->SummonCreature(NPC_ICE_TOMB, pos)) + { + summon->m_positionZ = summon->GetPositionZ()+5.0f; + summon->AI()->SetGUID(_owner->GetGUID(), DATA_TRAPPED_PLAYER); + _owner->CastSpell(_owner, SPELL_ICE_TOMB_UNTARGETABLE, true); + if (GameObject* go = summon->SummonGameObject(GO_ICE_BLOCK, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()-3.5f, pos.GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0)) + { + go->SetSpellId(SPELL_ICE_TOMB_DAMAGE); + summon->AddGameObject(go); + } + } + } + return true; + } - private: - Unit* _owner; - uint64 _sindragosaGUID; + private: + Unit* _owner; + uint64 _sindragosaGUID; }; struct LastPhaseIceTombTargetSelector : public std::unary_function { - public: - LastPhaseIceTombTargetSelector(Creature* source) : _source(source) { } - bool operator()(Unit const* target) const - { - if (!target) - return false; + public: + LastPhaseIceTombTargetSelector(Creature* source) : _source(source) { } + bool operator()(Unit const* target) const + { + if (!target) + return false; - if (target->GetExactDist(_source) > 80.0f) - return false; + if (target->GetExactDist(_source) > 80.0f) + return false; - if (target->GetTypeId() != TYPEID_PLAYER) - return false; + if (target->GetTypeId() != TYPEID_PLAYER) + return false; - if (target->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL) || target->HasAura(SPELL_ICE_TOMB_UNTARGETABLE) || target->HasAura(SPELL_ICE_TOMB_DAMAGE) || target->HasAura(SPELL_TANK_MARKER_AURA) || target->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) - return false; + if (target->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL) || target->HasAura(SPELL_ICE_TOMB_UNTARGETABLE) || target->HasAura(SPELL_ICE_TOMB_DAMAGE) || target->HasAura(SPELL_TANK_MARKER_AURA) || target->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) + return false; - return target != _source->GetVictim(); - } + return target != _source->GetVictim(); + } - private: - Creature const* _source; + private: + Creature const* _source; }; class boss_sindragosa : public CreatureScript { - public: - boss_sindragosa() : CreatureScript("boss_sindragosa") { } + public: + boss_sindragosa() : CreatureScript("boss_sindragosa") { } - struct boss_sindragosaAI : public BossAI - { - boss_sindragosaAI(Creature* creature) : BossAI(creature, DATA_SINDRAGOSA), _summoned(false) - { - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_HASTE_SPELLS, true); - } + struct boss_sindragosaAI : public BossAI + { + boss_sindragosaAI(Creature* creature) : BossAI(creature, DATA_SINDRAGOSA), _summoned(false) + { + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_HASTE_SPELLS, true); + } - void Reset() - { - _didFirstFlyPhase = false; - _isBelow20Pct = false; - _isThirdPhase = false; - _bombCount = 0; - _mysticBuffetStack = 0; - _Reset(); - me->DisableRotate(false); - me->SetControlled(false, UNIT_STATE_ROOT); - me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run); - me->SetReactState(REACT_AGGRESSIVE); - me->CastSpell(me, SPELL_TANK_MARKER, true); + void Reset() + { + _didFirstFlyPhase = false; + _isBelow20Pct = false; + _isThirdPhase = false; + _bombCount = 0; + _mysticBuffetStack = 0; + _Reset(); + me->DisableRotate(false); + me->SetControlled(false, UNIT_STATE_ROOT); + me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run); + me->SetReactState(REACT_AGGRESSIVE); + me->CastSpell(me, SPELL_TANK_MARKER, true); - if (!_summoned) - { - me->SetDisableGravity(true); - me->SetHover(true); - me->SetCanFly(true); - } - } + if (!_summoned) + { + me->SetDisableGravity(true); + me->SetHover(true); + me->SetCanFly(true); + } + } - void MoveInLineOfSight(Unit* who) - { - if (!me->HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY)) - BossAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit* who) + { + if (!me->HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY)) + BossAI::MoveInLineOfSight(who); + } - void JustDied(Unit* /* killer */) - { - _JustDied(); - Talk(SAY_DEATH); + void JustDied(Unit* /* killer */) + { + _JustDied(); + Talk(SAY_DEATH); if (Is25ManRaid() && me->HasAura(SPELL_SHADOWS_FATE)) DoCastAOE(SPELL_FROST_INFUSION_CREDIT, true); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_FROST_BEACON); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICE_TOMB_TARGET); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICE_TOMB_DUMMY); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICE_TOMB_UNTARGETABLE); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICE_TOMB_DAMAGE); - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ASPHYXIATION); - } + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_FROST_BEACON); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICE_TOMB_TARGET); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICE_TOMB_DUMMY); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICE_TOMB_UNTARGETABLE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICE_TOMB_DAMAGE); + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ASPHYXIATION); + } - void EnterCombat(Unit* victim) - { - if (!instance->CheckRequiredBosses(DATA_SINDRAGOSA, victim->ToPlayer()) || !me->IsVisible()) - { - EnterEvadeMode(); - instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); - return; - } + void EnterCombat(Unit* victim) + { + if (!instance->CheckRequiredBosses(DATA_SINDRAGOSA, victim->ToPlayer()) || !me->IsVisible()) + { + EnterEvadeMode(); + instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); + return; + } - _didFirstFlyPhase = false; - _isBelow20Pct = false; - _isThirdPhase = false; - _bombCount = 0; - _mysticBuffetStack = 0; + _didFirstFlyPhase = false; + _isBelow20Pct = false; + _isThirdPhase = false; + _bombCount = 0; + _mysticBuffetStack = 0; - summons.DespawnAll(); - events.Reset(); - events.ScheduleEvent(EVENT_BERSERK, 600000); - events.ScheduleEvent(EVENT_AIR_PHASE, 50000); - events.ScheduleEvent(EVENT_CLEAVE, 10000, EVENT_GROUP_LAND_PHASE); - events.ScheduleEvent(EVENT_TAIL_SMASH, 20000, EVENT_GROUP_LAND_PHASE); - events.ScheduleEvent(EVENT_FROST_BREATH, urand(8000, 12000), EVENT_GROUP_LAND_PHASE); - events.ScheduleEvent(EVENT_UNCHAINED_MAGIC, urand(9000, 14000), EVENT_GROUP_LAND_PHASE); - events.ScheduleEvent(EVENT_ICY_GRIP, 33500, EVENT_GROUP_LAND_PHASE); + summons.DespawnAll(); + events.Reset(); + events.ScheduleEvent(EVENT_BERSERK, 600000); + events.ScheduleEvent(EVENT_AIR_PHASE, 50000); + events.ScheduleEvent(EVENT_CLEAVE, 10000, EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_TAIL_SMASH, 20000, EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_FROST_BREATH, urand(8000, 12000), EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_UNCHAINED_MAGIC, urand(9000, 14000), EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_ICY_GRIP, 33500, EVENT_GROUP_LAND_PHASE); - me->setActive(true); - me->SetInCombatWithZone(); - instance->SetBossState(DATA_SINDRAGOSA, IN_PROGRESS); + me->setActive(true); + me->SetInCombatWithZone(); + instance->SetBossState(DATA_SINDRAGOSA, IN_PROGRESS); - me->CastSpell(me, SPELL_FROST_AURA, true); - me->CastSpell(me, SPELL_PERMAEATING_CHILL, true); - Talk(SAY_AGGRO); - } + me->CastSpell(me, SPELL_FROST_AURA, true); + me->CastSpell(me, SPELL_PERMAEATING_CHILL, true); + Talk(SAY_AGGRO); + } - bool CanAIAttack(const Unit* target) const - { - return me->IsVisible() && target->GetEntry() != NPC_CROK_SCOURGEBANE; - } + bool CanAIAttack(const Unit* target) const + { + return me->IsVisible() && target->GetEntry() != NPC_CROK_SCOURGEBANE; + } - void JustReachedHome() - { - _JustReachedHome(); - instance->SetBossState(DATA_SINDRAGOSA, FAIL); - if (_summoned) - { - me->SetDisableGravity(false); - me->SetHover(false); - me->SetCanFly(false); - } - } + void JustReachedHome() + { + _JustReachedHome(); + instance->SetBossState(DATA_SINDRAGOSA, FAIL); + if (_summoned) + { + me->SetDisableGravity(false); + me->SetHover(false); + me->SetCanFly(false); + } + } - void EnterEvadeMode() - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) // this flag is removed after she lands and can be engaged - { - const Map::PlayerList &pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->IsAlive() && !p->IsGameMaster() && p->GetExactDist(&SindragosaLandPos) < 200.0f && !p->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL)) - Unit::Kill(me, p); - } - me->DisableRotate(false); - me->SetControlled(false, UNIT_STATE_ROOT); - BossAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) // this flag is removed after she lands and can be engaged + { + const Map::PlayerList &pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->IsAlive() && !p->IsGameMaster() && p->GetExactDist(&SindragosaLandPos) < 200.0f && !p->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL)) + Unit::Kill(me, p); + } + me->DisableRotate(false); + me->SetControlled(false, UNIT_STATE_ROOT); + BossAI::EnterEvadeMode(); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } - void DoAction(int32 action) - { - if (action == ACTION_START_FROSTWYRM) - { - if (_summoned) - return; + void DoAction(int32 action) + { + if (action == ACTION_START_FROSTWYRM) + { + if (_summoned) + return; - _summoned = true; - if (TempSummon* summon = me->ToTempSummon()) - summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN); + _summoned = true; + if (TempSummon* summon = me->ToTempSummon()) + summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN); - if (me->isDead()) - return; + if (me->isDead()) + return; - me->setActive(true); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetSpeed(MOVE_RUN, 4.28571f); - float moveTime = me->GetExactDist(&SindragosaFlyInPos) / (me->GetSpeed(MOVE_RUN) * 0.001f); - me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SindragosaLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250)); - me->GetMotionMaster()->MovePoint(POINT_FROSTWYRM_FLY_IN, SindragosaFlyInPos); - me->CastSpell(me, SPELL_SINDRAGOSA_S_FURY, true); - } - } + me->setActive(true); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetSpeed(MOVE_RUN, 4.28571f); + float moveTime = me->GetExactDist(&SindragosaFlyInPos) / (me->GetSpeed(MOVE_RUN) * 0.001f); + me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SindragosaLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250)); + me->GetMotionMaster()->MovePoint(POINT_FROSTWYRM_FLY_IN, SindragosaFlyInPos); + me->CastSpell(me, SPELL_SINDRAGOSA_S_FURY, true); + } + } - uint32 GetData(uint32 type) const - { - if (type == DATA_MYSTIC_BUFFET_STACK) - return _mysticBuffetStack; - return 0xFFFFFFFF; - } + uint32 GetData(uint32 type) const + { + if (type == DATA_MYSTIC_BUFFET_STACK) + return _mysticBuffetStack; + return 0xFFFFFFFF; + } - void MovementInform(uint32 type, uint32 point) - { - if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 point) + { + if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE) + return; - switch (point) - { - case POINT_FROSTWYRM_LAND: - me->setActive(false); - me->SetDisableGravity(false); - me->SetHover(false); - me->SetCanFly(false); - me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run); - me->SetHomePosition(SindragosaLandPos); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + switch (point) + { + case POINT_FROSTWYRM_LAND: + me->setActive(false); + me->SetDisableGravity(false); + me->SetHover(false); + me->SetCanFly(false); + me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run); + me->SetHomePosition(SindragosaLandPos); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - // Sindragosa enters combat as soon as she lands - me->SetInCombatWithZone(); - break; - case POINT_TAKEOFF: - events.ScheduleEvent(EVENT_AIR_MOVEMENT, 0); - break; - case POINT_AIR_PHASE: - me->CastCustomSpell(SPELL_ICE_TOMB_TARGET, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 6), NULL); - me->SetFacingTo(float(M_PI)); - events.ScheduleEvent(EVENT_AIR_MOVEMENT_FAR, 0); // won't be processed during cast time anyway, so 0 - events.ScheduleEvent(EVENT_FROST_BOMB, 7000); - _bombCount = 0; - break; - case POINT_AIR_PHASE_FAR: - me->SetFacingTo(float(M_PI)); - break; - case POINT_LAND: - events.ScheduleEvent(EVENT_LAND_GROUND, 0); - break; - case POINT_LAND_GROUND: - { - me->SetDisableGravity(false); - me->SetHover(false); - me->SetCanFly(false); - me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run); - me->SetReactState(REACT_AGGRESSIVE); - if (Unit* target = me->SelectVictim()) - AttackStart(target); - break; - } - default: - break; - } - } + // Sindragosa enters combat as soon as she lands + me->SetInCombatWithZone(); + break; + case POINT_TAKEOFF: + events.ScheduleEvent(EVENT_AIR_MOVEMENT, 0); + break; + case POINT_AIR_PHASE: + me->CastCustomSpell(SPELL_ICE_TOMB_TARGET, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 6), NULL); + me->SetFacingTo(float(M_PI)); + events.ScheduleEvent(EVENT_AIR_MOVEMENT_FAR, 0); // won't be processed during cast time anyway, so 0 + events.ScheduleEvent(EVENT_FROST_BOMB, 7000); + _bombCount = 0; + break; + case POINT_AIR_PHASE_FAR: + me->SetFacingTo(float(M_PI)); + break; + case POINT_LAND: + events.ScheduleEvent(EVENT_LAND_GROUND, 0); + break; + case POINT_LAND_GROUND: + { + me->SetDisableGravity(false); + me->SetHover(false); + me->SetCanFly(false); + me->SetSpeed(MOVE_RUN, me->GetCreatureTemplate()->speed_run); + me->SetReactState(REACT_AGGRESSIVE); + if (Unit* target = me->SelectVictim()) + AttackStart(target); + break; + } + default: + break; + } + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (!damage || me->IsInEvadeMode()) - return; + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (!damage || me->IsInEvadeMode()) + return; - if (!_didFirstFlyPhase) - return; + if (!_didFirstFlyPhase) + return; - if (!_isThirdPhase) - { - if (!HealthAbovePct(35)) - { - _isThirdPhase = true; - events.CancelEvent(EVENT_AIR_PHASE); - events.ScheduleEvent(EVENT_THIRD_PHASE_CHECK, 1000); - } - } - else if (!_isBelow20Pct) - { - if (!HealthAbovePct(20)) - { - _isBelow20Pct = true; - if (instance->GetData(DATA_WEEKLY_QUEST_ID) == QUEST_RESPITE_FOR_A_TORMENTED_SOUL_10) - Talk(EMOTE_WEAKENING); - } - } - } + if (!_isThirdPhase) + { + if (!HealthAbovePct(35)) + { + _isThirdPhase = true; + events.CancelEvent(EVENT_AIR_PHASE); + events.ScheduleEvent(EVENT_THIRD_PHASE_CHECK, 1000); + } + } + else if (!_isBelow20Pct) + { + if (!HealthAbovePct(20)) + { + _isBelow20Pct = true; + if (instance->GetData(DATA_WEEKLY_QUEST_ID) == QUEST_RESPITE_FOR_A_TORMENTED_SOUL_10) + Talk(EMOTE_WEAKENING); + } + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() == NPC_FROST_BOMB) - summon->m_Events.AddEvent(new FrostBombExplosion(summon, me->GetGUID()), summon->m_Events.CalculateTime(5500)); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() == NPC_FROST_BOMB) + summon->m_Events.AddEvent(new FrostBombExplosion(summon, me->GetGUID()), summon->m_Events.CalculateTime(5500)); + } - void SummonedCreatureDespawn(Creature* summon) - { - BossAI::SummonedCreatureDespawn(summon); - if (summon->GetEntry() == NPC_ICE_TOMB) - summon->AI()->JustDied(summon); - } + void SummonedCreatureDespawn(Creature* summon) + { + BossAI::SummonedCreatureDespawn(summon); + if (summon->GetEntry() == NPC_ICE_TOMB) + summon->AI()->JustDied(summon); + } - void SpellHitTarget(Unit* target, SpellInfo const* spell) - { - if (target->GetTypeId() == TYPEID_PLAYER) - if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(70127, me)) - if (spellId == spell->Id) - if (Aura const* mysticBuffet = target->GetAura(spell->Id)) - _mysticBuffetStack = std::max(_mysticBuffetStack, mysticBuffet->GetStackAmount()); - } + void SpellHitTarget(Unit* target, SpellInfo const* spell) + { + if (target->GetTypeId() == TYPEID_PLAYER) + if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(70127, me)) + if (spellId == spell->Id) + if (Aura const* mysticBuffet = target->GetAura(spell->Id)) + _mysticBuffetStack = std::max(_mysticBuffetStack, mysticBuffet->GetStackAmount()); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() || !CheckInRoom()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() || !CheckInRoom()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_BERSERK: - Talk(EMOTE_BERSERK_RAID); - Talk(SAY_BERSERK); - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - events.ScheduleEvent(EVENT_CLEAVE, urand(10000, 15000), EVENT_GROUP_LAND_PHASE); - break; - case EVENT_TAIL_SMASH: - me->DisableRotate(true); - me->SetControlled(true, UNIT_STATE_ROOT); - me->SendMovementFlagUpdate(); - me->CastSpell(me->GetVictim(), SPELL_TAIL_SMASH, false); - events.DelayEventsToMax(1, 0); - events.ScheduleEvent(EVENT_UNROOT, 0); - events.ScheduleEvent(EVENT_TAIL_SMASH, urand(22000, 27000), EVENT_GROUP_LAND_PHASE); - break; - case EVENT_FROST_BREATH: - me->DisableRotate(true); - me->SetControlled(true, UNIT_STATE_ROOT); - me->SendMovementFlagUpdate(); - me->CastSpell(me->GetVictim(), _isThirdPhase ? SPELL_FROST_BREATH_P2 : SPELL_FROST_BREATH_P1, false); - events.DelayEventsToMax(1, 0); - events.ScheduleEvent(EVENT_UNROOT, 0); - events.ScheduleEvent(EVENT_FROST_BREATH, urand(20000, 25000), EVENT_GROUP_LAND_PHASE); - break; - case EVENT_UNROOT: - me->DisableRotate(false); - me->SetControlled(false, UNIT_STATE_ROOT); - break; - case EVENT_UNCHAINED_MAGIC: - Talk(SAY_UNCHAINED_MAGIC); - me->CastSpell((Unit*)NULL, SPELL_UNCHAINED_MAGIC, false); - events.ScheduleEvent(EVENT_UNCHAINED_MAGIC, urand(30000, 35000), EVENT_GROUP_LAND_PHASE); - break; - case EVENT_ICY_GRIP: - me->CastSpell((Unit*)NULL, SPELL_ICY_GRIP, false); - events.DelayEventsToMax(1001, 0); - events.ScheduleEvent(EVENT_BLISTERING_COLD, 1000, EVENT_GROUP_LAND_PHASE); - if (uint32 evTime = events.GetNextEventTime(EVENT_ICE_TOMB)) - if (events.GetTimer() > evTime || evTime - events.GetTimer() < 7000) - events.RescheduleEvent(EVENT_ICE_TOMB, 7000); - break; - case EVENT_BLISTERING_COLD: - Talk(EMOTE_WARN_BLISTERING_COLD); - me->CastSpell(me, SPELL_BLISTERING_COLD, false); - events.ScheduleEvent(EVENT_BLISTERING_COLD_YELL, 5000, EVENT_GROUP_LAND_PHASE); - if (_isThirdPhase) - events.RescheduleEvent(EVENT_ICY_GRIP, urand(65000, 70000)); - break; - case EVENT_BLISTERING_COLD_YELL: - Talk(SAY_BLISTERING_COLD); - break; + switch (events.ExecuteEvent()) + { + case EVENT_BERSERK: + Talk(EMOTE_BERSERK_RAID); + Talk(SAY_BERSERK); + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + events.ScheduleEvent(EVENT_CLEAVE, urand(10000, 15000), EVENT_GROUP_LAND_PHASE); + break; + case EVENT_TAIL_SMASH: + me->DisableRotate(true); + me->SetControlled(true, UNIT_STATE_ROOT); + me->SendMovementFlagUpdate(); + me->CastSpell(me->GetVictim(), SPELL_TAIL_SMASH, false); + events.DelayEventsToMax(1, 0); + events.ScheduleEvent(EVENT_UNROOT, 0); + events.ScheduleEvent(EVENT_TAIL_SMASH, urand(22000, 27000), EVENT_GROUP_LAND_PHASE); + break; + case EVENT_FROST_BREATH: + me->DisableRotate(true); + me->SetControlled(true, UNIT_STATE_ROOT); + me->SendMovementFlagUpdate(); + me->CastSpell(me->GetVictim(), _isThirdPhase ? SPELL_FROST_BREATH_P2 : SPELL_FROST_BREATH_P1, false); + events.DelayEventsToMax(1, 0); + events.ScheduleEvent(EVENT_UNROOT, 0); + events.ScheduleEvent(EVENT_FROST_BREATH, urand(20000, 25000), EVENT_GROUP_LAND_PHASE); + break; + case EVENT_UNROOT: + me->DisableRotate(false); + me->SetControlled(false, UNIT_STATE_ROOT); + break; + case EVENT_UNCHAINED_MAGIC: + Talk(SAY_UNCHAINED_MAGIC); + me->CastSpell((Unit*)NULL, SPELL_UNCHAINED_MAGIC, false); + events.ScheduleEvent(EVENT_UNCHAINED_MAGIC, urand(30000, 35000), EVENT_GROUP_LAND_PHASE); + break; + case EVENT_ICY_GRIP: + me->CastSpell((Unit*)NULL, SPELL_ICY_GRIP, false); + events.DelayEventsToMax(1001, 0); + events.ScheduleEvent(EVENT_BLISTERING_COLD, 1000, EVENT_GROUP_LAND_PHASE); + if (uint32 evTime = events.GetNextEventTime(EVENT_ICE_TOMB)) + if (events.GetTimer() > evTime || evTime - events.GetTimer() < 7000) + events.RescheduleEvent(EVENT_ICE_TOMB, 7000); + break; + case EVENT_BLISTERING_COLD: + Talk(EMOTE_WARN_BLISTERING_COLD); + me->CastSpell(me, SPELL_BLISTERING_COLD, false); + events.ScheduleEvent(EVENT_BLISTERING_COLD_YELL, 5000, EVENT_GROUP_LAND_PHASE); + if (_isThirdPhase) + events.RescheduleEvent(EVENT_ICY_GRIP, urand(65000, 70000)); + break; + case EVENT_BLISTERING_COLD_YELL: + Talk(SAY_BLISTERING_COLD); + break; - // AIR PHASE EVENTS BELOW: - case EVENT_AIR_PHASE: - // pussywizard: unroot may be scheduled after this event cos of events shitness (time must be unique) - if (me->HasUnitState(UNIT_STATE_ROOT)) - { - events.CancelEvent(EVENT_UNROOT); - me->DisableRotate(false); - me->SetControlled(false, UNIT_STATE_ROOT); - } + // AIR PHASE EVENTS BELOW: + case EVENT_AIR_PHASE: + // pussywizard: unroot may be scheduled after this event cos of events shitness (time must be unique) + if (me->HasUnitState(UNIT_STATE_ROOT)) + { + events.CancelEvent(EVENT_UNROOT); + me->DisableRotate(false); + me->SetControlled(false, UNIT_STATE_ROOT); + } - _didFirstFlyPhase = true; - Talk(SAY_AIR_PHASE); - me->SetReactState(REACT_PASSIVE); - me->SetSpeed(MOVE_RUN, 4.28571f); - me->SendMeleeAttackStop(me->GetVictim()); - me->AttackStop(); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+20.0f, 10.0f); - events.CancelEventGroup(EVENT_GROUP_LAND_PHASE); - events.ScheduleEvent(EVENT_AIR_PHASE, 110000); - break; - case EVENT_AIR_MOVEMENT: - me->GetMotionMaster()->MovePoint(POINT_AIR_PHASE, SindragosaAirPos); - break; - case EVENT_AIR_MOVEMENT_FAR: - me->GetMotionMaster()->MovePoint(POINT_AIR_PHASE_FAR, SindragosaAirPosFar); - break; - case EVENT_FROST_BOMB: - { - ++_bombCount; - float destX, destY, destZ; - std::list gl; - me->GetGameObjectListWithEntryInGrid(gl, GO_ICE_BLOCK, SIZE_OF_GRIDS); - uint8 triesLeft = 10; - do - { - destX = float(rand_norm()) * 75.0f + 4350.0f; - destY = float(rand_norm()) * 75.0f + 2450.0f; - destZ = 205.0f; // random number close to ground, get exact in next call - me->UpdateGroundPositionZ(destX, destY, destZ); - bool ok = true; - for (std::list::const_iterator itr = gl.begin(); itr != gl.end(); ++itr) - if ((*itr)->GetExactDist2dSq(destX, destY) < 3.0f*3.0f) - { - ok = false; - break; - } - if (ok) - break; - } while (--triesLeft); - - me->CastSpell(destX, destY, destZ, SPELL_FROST_BOMB_TRIGGER, false); - if (_bombCount >= 4) - events.ScheduleEvent(EVENT_LAND, 5500); - else - events.ScheduleEvent(EVENT_FROST_BOMB, 6000); - break; - } - case EVENT_LAND: - me->GetMotionMaster()->MovePoint(POINT_LAND, SindragosaFlyInPos); - break; - case EVENT_LAND_GROUND: - events.ScheduleEvent(EVENT_CLEAVE, urand(13000, 15000), EVENT_GROUP_LAND_PHASE); - events.ScheduleEvent(EVENT_TAIL_SMASH, urand(19000, 23000), EVENT_GROUP_LAND_PHASE); - events.ScheduleEvent(EVENT_FROST_BREATH, urand(7000, 10000), EVENT_GROUP_LAND_PHASE); - events.ScheduleEvent(EVENT_UNCHAINED_MAGIC, urand(12000, 17000), EVENT_GROUP_LAND_PHASE); - events.ScheduleEvent(EVENT_ICY_GRIP, urand(35000, 40000), EVENT_GROUP_LAND_PHASE); - me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SindragosaLandPos, 10.0f); - break; - case EVENT_THIRD_PHASE_CHECK: - if (!me->HasByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_HOVER)) - { - Talk(SAY_PHASE_2); - events.ScheduleEvent(EVENT_ICE_TOMB, urand(7000, 10000)); - events.RescheduleEvent(EVENT_ICY_GRIP, urand(35000, 40000), EVENT_GROUP_LAND_PHASE); - me->CastSpell(me, SPELL_MYSTIC_BUFFET, true); - } - else - events.ScheduleEvent(EVENT_THIRD_PHASE_CHECK, 5000); - break; - case EVENT_ICE_TOMB: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, LastPhaseIceTombTargetSelector(me))) - { - Talk(EMOTE_WARN_FROZEN_ORB, target); - me->CastSpell(target, SPELL_ICE_TOMB_DUMMY, true); - me->CastSpell(target, SPELL_FROST_BEACON, true); - if (uint32 evTime = events.GetNextEventTime(EVENT_ICY_GRIP)) - if (events.GetTimer() > evTime || evTime - events.GetTimer() < 8000) - events.RescheduleEvent(EVENT_ICY_GRIP, 8000, EVENT_GROUP_LAND_PHASE); - } - events.ScheduleEvent(EVENT_ICE_TOMB, urand(18000, 22000)); - break; - default: - break; - } + _didFirstFlyPhase = true; + Talk(SAY_AIR_PHASE); + me->SetReactState(REACT_PASSIVE); + me->SetSpeed(MOVE_RUN, 4.28571f); + me->SendMeleeAttackStop(me->GetVictim()); + me->AttackStop(); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + me->SendMovementFlagUpdate(); + me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+20.0f, 10.0f); + events.CancelEventGroup(EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_AIR_PHASE, 110000); + break; + case EVENT_AIR_MOVEMENT: + me->GetMotionMaster()->MovePoint(POINT_AIR_PHASE, SindragosaAirPos); + break; + case EVENT_AIR_MOVEMENT_FAR: + me->GetMotionMaster()->MovePoint(POINT_AIR_PHASE_FAR, SindragosaAirPosFar); + break; + case EVENT_FROST_BOMB: + { + ++_bombCount; + float destX, destY, destZ; + std::list gl; + me->GetGameObjectListWithEntryInGrid(gl, GO_ICE_BLOCK, SIZE_OF_GRIDS); + uint8 triesLeft = 10; + do + { + destX = float(rand_norm()) * 75.0f + 4350.0f; + destY = float(rand_norm()) * 75.0f + 2450.0f; + destZ = 205.0f; // random number close to ground, get exact in next call + me->UpdateGroundPositionZ(destX, destY, destZ); + bool ok = true; + for (std::list::const_iterator itr = gl.begin(); itr != gl.end(); ++itr) + if ((*itr)->GetExactDist2dSq(destX, destY) < 3.0f*3.0f) + { + ok = false; + break; + } + if (ok) + break; + } while (--triesLeft); + + me->CastSpell(destX, destY, destZ, SPELL_FROST_BOMB_TRIGGER, false); + if (_bombCount >= 4) + events.ScheduleEvent(EVENT_LAND, 5500); + else + events.ScheduleEvent(EVENT_FROST_BOMB, 6000); + break; + } + case EVENT_LAND: + me->GetMotionMaster()->MovePoint(POINT_LAND, SindragosaFlyInPos); + break; + case EVENT_LAND_GROUND: + events.ScheduleEvent(EVENT_CLEAVE, urand(13000, 15000), EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_TAIL_SMASH, urand(19000, 23000), EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_FROST_BREATH, urand(7000, 10000), EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_UNCHAINED_MAGIC, urand(12000, 17000), EVENT_GROUP_LAND_PHASE); + events.ScheduleEvent(EVENT_ICY_GRIP, urand(35000, 40000), EVENT_GROUP_LAND_PHASE); + me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SindragosaLandPos, 10.0f); + break; + case EVENT_THIRD_PHASE_CHECK: + if (!me->HasByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_HOVER)) + { + Talk(SAY_PHASE_2); + events.ScheduleEvent(EVENT_ICE_TOMB, urand(7000, 10000)); + events.RescheduleEvent(EVENT_ICY_GRIP, urand(35000, 40000), EVENT_GROUP_LAND_PHASE); + me->CastSpell(me, SPELL_MYSTIC_BUFFET, true); + } + else + events.ScheduleEvent(EVENT_THIRD_PHASE_CHECK, 5000); + break; + case EVENT_ICE_TOMB: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, LastPhaseIceTombTargetSelector(me))) + { + Talk(EMOTE_WARN_FROZEN_ORB, target); + me->CastSpell(target, SPELL_ICE_TOMB_DUMMY, true); + me->CastSpell(target, SPELL_FROST_BEACON, true); + if (uint32 evTime = events.GetNextEventTime(EVENT_ICY_GRIP)) + if (events.GetTimer() > evTime || evTime - events.GetTimer() < 8000) + events.RescheduleEvent(EVENT_ICY_GRIP, 8000, EVENT_GROUP_LAND_PHASE); + } + events.ScheduleEvent(EVENT_ICE_TOMB, urand(18000, 22000)); + break; + default: + break; + } - if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim()) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && !me->IsWithinLOSInMap(me->GetVictim())) - me->GetMotionMaster()->MoveCharge(me->GetVictim()->GetPositionX(), me->GetVictim()->GetPositionY(), me->GetVictim()->GetPositionZ(), me->GetSpeed(MOVE_RUN), POINT_CHASE_VICTIM); - DoMeleeAttackIfReady(); - } + if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim()) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && !me->IsWithinLOSInMap(me->GetVictim())) + me->GetMotionMaster()->MoveCharge(me->GetVictim()->GetPositionX(), me->GetVictim()->GetPositionY(), me->GetVictim()->GetPositionZ(), me->GetSpeed(MOVE_RUN), POINT_CHASE_VICTIM); + DoMeleeAttackIfReady(); + } - private: - bool _summoned; - uint8 _bombCount; - uint8 _mysticBuffetStack; - bool _didFirstFlyPhase; - bool _isBelow20Pct; - bool _isThirdPhase; - }; + private: + bool _summoned; + uint8 _bombCount; + uint8 _mysticBuffetStack; + bool _didFirstFlyPhase; + bool _isBelow20Pct; + bool _isThirdPhase; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_ice_tomb : public CreatureScript { - public: - npc_ice_tomb() : CreatureScript("npc_ice_tomb") { } + public: + npc_ice_tomb() : CreatureScript("npc_ice_tomb") { } - struct npc_ice_tombAI : public NullCreatureAI - { - npc_ice_tombAI(Creature* creature) : NullCreatureAI(creature) - { - me->SetReactState(REACT_PASSIVE); - _trappedPlayerGUID = 0; - _existenceCheckTimer = 1000; - _asphyxiationTimer = 22500; - } + struct npc_ice_tombAI : public NullCreatureAI + { + npc_ice_tombAI(Creature* creature) : NullCreatureAI(creature) + { + me->SetReactState(REACT_PASSIVE); + _trappedPlayerGUID = 0; + _existenceCheckTimer = 1000; + _asphyxiationTimer = 22500; + } - uint64 _trappedPlayerGUID; - uint32 _existenceCheckTimer; - uint16 _asphyxiationTimer; + uint64 _trappedPlayerGUID; + uint32 _existenceCheckTimer; + uint16 _asphyxiationTimer; - void SetGUID(uint64 guid, int32 type) - { - if (type == DATA_TRAPPED_PLAYER) - _trappedPlayerGUID = guid; - } + void SetGUID(uint64 guid, int32 type) + { + if (type == DATA_TRAPPED_PLAYER) + _trappedPlayerGUID = guid; + } - void DamageTaken(Unit*, uint32 &dmg, DamageEffectType, SpellSchoolMask) - { - if (dmg >= me->GetHealth()) - me->m_positionZ = me->GetPositionZ() - 5.0f; - } + void DamageTaken(Unit*, uint32 &dmg, DamageEffectType, SpellSchoolMask) + { + if (dmg >= me->GetHealth()) + me->m_positionZ = me->GetPositionZ() - 5.0f; + } - void JustDied(Unit* /*killer*/) - { - me->RemoveAllGameObjects(); + void JustDied(Unit* /*killer*/) + { + me->RemoveAllGameObjects(); - if (Player* player = ObjectAccessor::GetPlayer(*me, _trappedPlayerGUID)) - { - _trappedPlayerGUID = 0; - player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_DAMAGE); - player->RemoveAurasDueToSpell(SPELL_ASPHYXIATION); - player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_UNTARGETABLE); - me->DespawnOrUnsummon(5000); - } - } + if (Player* player = ObjectAccessor::GetPlayer(*me, _trappedPlayerGUID)) + { + _trappedPlayerGUID = 0; + player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_DAMAGE); + player->RemoveAurasDueToSpell(SPELL_ASPHYXIATION); + player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_UNTARGETABLE); + me->DespawnOrUnsummon(5000); + } + } - void UpdateAI(uint32 diff) - { - if (!_trappedPlayerGUID) - return; + void UpdateAI(uint32 diff) + { + if (!_trappedPlayerGUID) + return; - if (_existenceCheckTimer <= diff) - { - Player* player = ObjectAccessor::GetPlayer(*me, _trappedPlayerGUID); - if (!player || !player->IsAlive() || !player->HasAura(SPELL_ICE_TOMB_DAMAGE)) - { - // Remove object - JustDied(me); - me->DespawnOrUnsummon(); - return; - } - _existenceCheckTimer = 1000; - } - else - _existenceCheckTimer -= diff; + if (_existenceCheckTimer <= diff) + { + Player* player = ObjectAccessor::GetPlayer(*me, _trappedPlayerGUID); + if (!player || !player->IsAlive() || !player->HasAura(SPELL_ICE_TOMB_DAMAGE)) + { + // Remove object + JustDied(me); + me->DespawnOrUnsummon(); + return; + } + _existenceCheckTimer = 1000; + } + else + _existenceCheckTimer -= diff; - if (_asphyxiationTimer) - { - if (_asphyxiationTimer <= diff) - { - _asphyxiationTimer = 0; - if (Player* player = ObjectAccessor::GetPlayer(*me, _trappedPlayerGUID)) - { - player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_UNTARGETABLE); - player->CastSpell(player, SPELL_ASPHYXIATION, true); - } - } - else - _asphyxiationTimer -= diff; - } - } - }; + if (_asphyxiationTimer) + { + if (_asphyxiationTimer <= diff) + { + _asphyxiationTimer = 0; + if (Player* player = ObjectAccessor::GetPlayer(*me, _trappedPlayerGUID)) + { + player->RemoveAurasDueToSpell(SPELL_ICE_TOMB_UNTARGETABLE); + player->CastSpell(player, SPELL_ASPHYXIATION, true); + } + } + else + _asphyxiationTimer -= diff; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_sindragosa_s_fury : public SpellScriptLoader { - public: - spell_sindragosa_s_fury() : SpellScriptLoader("spell_sindragosa_s_fury") { } + public: + spell_sindragosa_s_fury() : SpellScriptLoader("spell_sindragosa_s_fury") { } - class spell_sindragosa_s_fury_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sindragosa_s_fury_SpellScript); + class spell_sindragosa_s_fury_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sindragosa_s_fury_SpellScript); - bool Load() - { - _targetCount = 0; + bool Load() + { + _targetCount = 0; - // This script should execute only in Icecrown Citadel - if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap()) - if (instance->GetInstanceScript()) - if (instance->GetScriptId() == sObjectMgr->GetScriptId(ICCScriptName)) - return true; + // This script should execute only in Icecrown Citadel + if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap()) + if (instance->GetInstanceScript()) + if (instance->GetScriptId() == sObjectMgr->GetScriptId(ICCScriptName)) + return true; - return false; - } + return false; + } - void SelectDest() - { - if (Position* dest = const_cast(GetExplTargetDest())) - { - float destX = float(rand_norm()) * 75.0f + 4350.0f; - float destY = float(rand_norm()) * 75.0f + 2450.0f; - float destZ = 205.0f; // random number close to ground, get exact in next call - GetCaster()->UpdateGroundPositionZ(destX, destY, destZ); - dest->Relocate(destX, destY, destZ); - } - } + void SelectDest() + { + if (Position* dest = const_cast(GetExplTargetDest())) + { + float destX = float(rand_norm()) * 75.0f + 4350.0f; + float destY = float(rand_norm()) * 75.0f + 2450.0f; + float destZ = 205.0f; // random number close to ground, get exact in next call + GetCaster()->UpdateGroundPositionZ(destX, destY, destZ); + dest->Relocate(destX, destY, destZ); + } + } - void CountTargets(std::list& targets) - { - _targetCount = targets.size(); - } + void CountTargets(std::list& targets) + { + _targetCount = targets.size(); + } - void HandleDummy(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); - if (!GetHitUnit()->IsAlive() || (GetHitUnit()->GetTypeId() == TYPEID_PLAYER && GetHitUnit()->ToPlayer()->IsGameMaster()) || !_targetCount) - return; + if (!GetHitUnit()->IsAlive() || (GetHitUnit()->GetTypeId() == TYPEID_PLAYER && GetHitUnit()->ToPlayer()->IsGameMaster()) || !_targetCount) + return; - float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask))); - float ResistFactor = ((resistance*2.0f) / (resistance + 510.0f)); - if (ResistFactor > 0.9f) - ResistFactor = 0.9f; + float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask))); + float ResistFactor = ((resistance*2.0f) / (resistance + 510.0f)); + if (ResistFactor > 0.9f) + ResistFactor = 0.9f; - uint32 damage = uint32( (GetEffectValue()/_targetCount) * (1.0f-ResistFactor) ); + uint32 damage = uint32( (GetEffectValue()/_targetCount) * (1.0f-ResistFactor) ); - SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo()->Id, GetSpellInfo()->SchoolMask); - damageInfo.damage = damage; - GetCaster()->SendSpellNonMeleeDamageLog(&damageInfo); - GetCaster()->DealSpellDamage(&damageInfo, false); - } + SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo()->Id, GetSpellInfo()->SchoolMask); + damageInfo.damage = damage; + GetCaster()->SendSpellNonMeleeDamageLog(&damageInfo); + GetCaster()->DealSpellDamage(&damageInfo, false); + } - void Register() - { - BeforeCast += SpellCastFn(spell_sindragosa_s_fury_SpellScript::SelectDest); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_s_fury_SpellScript::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY); - OnEffectHitTarget += SpellEffectFn(spell_sindragosa_s_fury_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); - } + void Register() + { + BeforeCast += SpellCastFn(spell_sindragosa_s_fury_SpellScript::SelectDest); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_s_fury_SpellScript::CountTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENTRY); + OnEffectHitTarget += SpellEffectFn(spell_sindragosa_s_fury_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + } - uint32 _targetCount; - }; + uint32 _targetCount; + }; - SpellScript* GetSpellScript() const - { - return new spell_sindragosa_s_fury_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_sindragosa_s_fury_SpellScript(); + } }; class UnchainedMagicTargetSelector { public: - UnchainedMagicTargetSelector(bool removeHealers) : _removeHealers(removeHealers) { } + UnchainedMagicTargetSelector(bool removeHealers) : _removeHealers(removeHealers) { } - bool operator()(WorldObject* object) const - { - if (Player* p = object->ToPlayer()) - { - if (p->getPowerType() != POWER_MANA) - return true; - if (p->getClass() == CLASS_HUNTER) - return true; - uint8 maxIndex = p->GetMostPointsTalentTree(); - if (p->getClass() == CLASS_PALADIN && maxIndex >= 1 || p->getClass() == CLASS_SHAMAN && maxIndex == 1 || p->getClass() == CLASS_DRUID && maxIndex == 1) - return true; - if (_removeHealers == (p->getClass() == CLASS_DRUID && maxIndex == 2 || p->getClass() == CLASS_PALADIN && maxIndex == 0 || p->getClass() == CLASS_PRIEST && maxIndex <= 1 || p->getClass() == CLASS_SHAMAN && maxIndex == 2)) - return true; + bool operator()(WorldObject* object) const + { + if (Player* p = object->ToPlayer()) + { + if (p->getPowerType() != POWER_MANA) + return true; + if (p->getClass() == CLASS_HUNTER) + return true; + uint8 maxIndex = p->GetMostPointsTalentTree(); + if (p->getClass() == CLASS_PALADIN && maxIndex >= 1 || p->getClass() == CLASS_SHAMAN && maxIndex == 1 || p->getClass() == CLASS_DRUID && maxIndex == 1) + return true; + if (_removeHealers == (p->getClass() == CLASS_DRUID && maxIndex == 2 || p->getClass() == CLASS_PALADIN && maxIndex == 0 || p->getClass() == CLASS_PRIEST && maxIndex <= 1 || p->getClass() == CLASS_SHAMAN && maxIndex == 2)) + return true; - return false; - } - return true; - } + return false; + } + return true; + } private: - bool _removeHealers; + bool _removeHealers; }; class spell_sindragosa_unchained_magic : public SpellScriptLoader { - public: - spell_sindragosa_unchained_magic() : SpellScriptLoader("spell_sindragosa_unchained_magic") { } + public: + spell_sindragosa_unchained_magic() : SpellScriptLoader("spell_sindragosa_unchained_magic") { } - class spell_sindragosa_unchained_magic_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sindragosa_unchained_magic_SpellScript); + class spell_sindragosa_unchained_magic_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sindragosa_unchained_magic_SpellScript); - void FilterTargets(std::list& unitList) - { - std::list healList = unitList; - std::list dpsList = unitList; - unitList.clear(); - uint32 maxSize = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1); - healList.remove_if(UnchainedMagicTargetSelector(false)); - if (healList.size() > maxSize) - Trinity::Containers::RandomResizeList(healList, maxSize); - dpsList.remove_if(UnchainedMagicTargetSelector(true)); - if (dpsList.size() > maxSize) - Trinity::Containers::RandomResizeList(dpsList, maxSize); - unitList.splice(unitList.begin(), healList); - unitList.splice(unitList.begin(), dpsList); - } + void FilterTargets(std::list& unitList) + { + std::list healList = unitList; + std::list dpsList = unitList; + unitList.clear(); + uint32 maxSize = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1); + healList.remove_if(UnchainedMagicTargetSelector(false)); + if (healList.size() > maxSize) + Trinity::Containers::RandomResizeList(healList, maxSize); + dpsList.remove_if(UnchainedMagicTargetSelector(true)); + if (dpsList.size() > maxSize) + Trinity::Containers::RandomResizeList(dpsList, maxSize); + unitList.splice(unitList.begin(), healList); + unitList.splice(unitList.begin(), dpsList); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_unchained_magic_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_unchained_magic_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_sindragosa_unchained_magic_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_sindragosa_unchained_magic_SpellScript(); + } - class spell_sindragosa_unchained_magic_AuraScript : public AuraScript - { - PrepareAuraScript(spell_sindragosa_unchained_magic_AuraScript); + class spell_sindragosa_unchained_magic_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sindragosa_unchained_magic_AuraScript); - std::map _lastMSTimeForSpell; + std::map _lastMSTimeForSpell; - bool Validate(SpellInfo const* /*spellInfo*/) - { - _lastMSTimeForSpell.clear(); - return true; - } + bool Validate(SpellInfo const* /*spellInfo*/) + { + _lastMSTimeForSpell.clear(); + return true; + } - bool CheckProc(ProcEventInfo& eventInfo) - { - const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); - if (!spellInfo) - return false; + bool CheckProc(ProcEventInfo& eventInfo) + { + const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); + if (!spellInfo) + return false; - uint32 currMSTime = World::GetGameTimeMS(); - std::map::iterator itr = _lastMSTimeForSpell.find(spellInfo->Id); - if (itr != _lastMSTimeForSpell.end()) - { - uint32 lastMSTime = itr->second; - itr->second = currMSTime; - if (getMSTimeDiff(lastMSTime, currMSTime) < 600) - return false; + uint32 currMSTime = World::GetGameTimeMS(); + std::map::iterator itr = _lastMSTimeForSpell.find(spellInfo->Id); + if (itr != _lastMSTimeForSpell.end()) + { + uint32 lastMSTime = itr->second; + itr->second = currMSTime; + if (getMSTimeDiff(lastMSTime, currMSTime) < 600) + return false; - return true; - } + return true; + } - _lastMSTimeForSpell[spellInfo->Id] = currMSTime; - return true; - } + _lastMSTimeForSpell[spellInfo->Id] = currMSTime; + return true; + } - void Register() - { - DoCheckProc += AuraCheckProcFn(spell_sindragosa_unchained_magic_AuraScript::CheckProc); - } - }; + void Register() + { + DoCheckProc += AuraCheckProcFn(spell_sindragosa_unchained_magic_AuraScript::CheckProc); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_sindragosa_unchained_magic_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_sindragosa_unchained_magic_AuraScript(); + } }; class spell_sindragosa_permeating_chill : public SpellScriptLoader { - public: - spell_sindragosa_permeating_chill() : SpellScriptLoader("spell_sindragosa_permeating_chill") { } + public: + spell_sindragosa_permeating_chill() : SpellScriptLoader("spell_sindragosa_permeating_chill") { } - class spell_sindragosa_permeating_chill_AuraScript : public AuraScript - { - PrepareAuraScript(spell_sindragosa_permeating_chill_AuraScript); + class spell_sindragosa_permeating_chill_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sindragosa_permeating_chill_AuraScript); - bool CheckProc(ProcEventInfo& eventInfo) - { - return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->GetEntry() == NPC_SINDRAGOSA; - } + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->GetEntry() == NPC_SINDRAGOSA; + } - void Register() - { - DoCheckProc += AuraCheckProcFn(spell_sindragosa_permeating_chill_AuraScript::CheckProc); - } - }; + void Register() + { + DoCheckProc += AuraCheckProcFn(spell_sindragosa_permeating_chill_AuraScript::CheckProc); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_sindragosa_permeating_chill_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_sindragosa_permeating_chill_AuraScript(); + } }; class spell_sindragosa_instability : public SpellScriptLoader { - public: - spell_sindragosa_instability() : SpellScriptLoader("spell_sindragosa_instability") { } + public: + spell_sindragosa_instability() : SpellScriptLoader("spell_sindragosa_instability") { } - class spell_sindragosa_instability_AuraScript : public AuraScript - { - PrepareAuraScript(spell_sindragosa_instability_AuraScript); + class spell_sindragosa_instability_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sindragosa_instability_AuraScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_BACKLASH)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_BACKLASH)) + return false; + return true; + } - void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) - GetTarget()->CastCustomSpell(SPELL_BACKLASH, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, NULL, aurEff, GetCasterGUID()); - } + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) + GetTarget()->CastCustomSpell(SPELL_BACKLASH, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, NULL, aurEff, GetCasterGUID()); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_sindragosa_instability_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_sindragosa_instability_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_sindragosa_instability_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_sindragosa_instability_AuraScript(); + } }; class spell_sindragosa_icy_grip : public SpellScriptLoader { - public: - spell_sindragosa_icy_grip() : SpellScriptLoader("spell_sindragosa_icy_grip") { } + public: + spell_sindragosa_icy_grip() : SpellScriptLoader("spell_sindragosa_icy_grip") { } - class spell_sindragosa_icy_grip_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sindragosa_icy_grip_SpellScript); + class spell_sindragosa_icy_grip_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sindragosa_icy_grip_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_ICY_GRIP_JUMP)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ICY_GRIP_JUMP)) + return false; + return true; + } - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (!GetHitUnit()->IsWithinLOSInMap(GetCaster()) || GetHitUnit()->HasAura(SPELL_TANK_MARKER_AURA)) - return; + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (!GetHitUnit()->IsWithinLOSInMap(GetCaster()) || GetHitUnit()->HasAura(SPELL_TANK_MARKER_AURA)) + return; - GetHitUnit()->CastSpell(GetCaster(), SPELL_ICY_GRIP_JUMP, true); - } + GetHitUnit()->CastSpell(GetCaster(), SPELL_ICY_GRIP_JUMP, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_sindragosa_icy_grip_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_sindragosa_icy_grip_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_sindragosa_icy_grip_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_sindragosa_icy_grip_SpellScript(); + } }; class spell_sindragosa_icy_grip_jump : public SpellScriptLoader { - public: - spell_sindragosa_icy_grip_jump() : SpellScriptLoader("spell_sindragosa_icy_grip_jump") { } + public: + spell_sindragosa_icy_grip_jump() : SpellScriptLoader("spell_sindragosa_icy_grip_jump") { } - class spell_sindragosa_icy_grip_jump_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sindragosa_icy_grip_jump_SpellScript); + class spell_sindragosa_icy_grip_jump_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sindragosa_icy_grip_jump_SpellScript); - void HandleSpecial(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); + void HandleSpecial(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); - float x = GetHitUnit()->GetPositionX(); - float y = GetHitUnit()->GetPositionY(); - float z = GetHitUnit()->GetPositionZ()+0.1f; - float speedXY, speedZ; + float x = GetHitUnit()->GetPositionX(); + float y = GetHitUnit()->GetPositionY(); + float z = GetHitUnit()->GetPositionZ()+0.1f; + float speedXY, speedZ; - if (GetSpellInfo()->Effects[effIndex].MiscValue) - speedZ = float(GetSpellInfo()->Effects[effIndex].MiscValue)/10; - else if (GetSpellInfo()->Effects[effIndex].MiscValueB) - speedZ = float(GetSpellInfo()->Effects[effIndex].MiscValueB)/10; - else - speedZ = 10.0f; - speedXY = GetCaster()->GetExactDist2d(x, y) * 10.0f / speedZ; + if (GetSpellInfo()->Effects[effIndex].MiscValue) + speedZ = float(GetSpellInfo()->Effects[effIndex].MiscValue)/10; + else if (GetSpellInfo()->Effects[effIndex].MiscValueB) + speedZ = float(GetSpellInfo()->Effects[effIndex].MiscValueB)/10; + else + speedZ = 10.0f; + speedXY = GetCaster()->GetExactDist2d(x, y) * 10.0f / speedZ; - GetCaster()->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ); - } + GetCaster()->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ); + } - void Register() - { - OnEffectLaunchTarget += SpellEffectFn(spell_sindragosa_icy_grip_jump_SpellScript::HandleSpecial, EFFECT_0, SPELL_EFFECT_JUMP); - } - }; + void Register() + { + OnEffectLaunchTarget += SpellEffectFn(spell_sindragosa_icy_grip_jump_SpellScript::HandleSpecial, EFFECT_0, SPELL_EFFECT_JUMP); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_sindragosa_icy_grip_jump_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_sindragosa_icy_grip_jump_SpellScript(); + } }; class spell_sindragosa_frost_beacon : public SpellScriptLoader { - public: - spell_sindragosa_frost_beacon() : SpellScriptLoader("spell_sindragosa_frost_beacon") { } + public: + spell_sindragosa_frost_beacon() : SpellScriptLoader("spell_sindragosa_frost_beacon") { } - class spell_sindragosa_frost_beacon_AuraScript : public AuraScript - { - PrepareAuraScript(spell_sindragosa_frost_beacon_AuraScript); + class spell_sindragosa_frost_beacon_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sindragosa_frost_beacon_AuraScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_ICE_TOMB_DAMAGE)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ICE_TOMB_DAMAGE)) + return false; + return true; + } - void PeriodicTick(AuraEffect const* /*aurEff*/) - { - PreventDefaultAction(); - if (Unit* caster = GetCaster()) - caster->CastSpell(GetTarget(), SPELL_ICE_TOMB_DAMAGE, true); - } + void PeriodicTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), SPELL_ICE_TOMB_DAMAGE, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_frost_beacon_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_frost_beacon_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_sindragosa_frost_beacon_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_sindragosa_frost_beacon_AuraScript(); + } }; class SindragosaIceTombCheck @@ -1154,944 +1154,944 @@ class SindragosaIceTombCheck public: bool operator()(Unit* unit) const { - return unit->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL); + return unit->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL); } bool operator()(WorldObject* object) const { - return object->ToUnit() && object->ToUnit()->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL); + return object->ToUnit() && object->ToUnit()->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL); } }; class spell_sindragosa_ice_tomb_filter : public SpellScriptLoader { - public: - spell_sindragosa_ice_tomb_filter() : SpellScriptLoader("spell_sindragosa_ice_tomb_filter") { } + public: + spell_sindragosa_ice_tomb_filter() : SpellScriptLoader("spell_sindragosa_ice_tomb_filter") { } - class spell_sindragosa_ice_tomb_filter_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sindragosa_ice_tomb_filter_SpellScript); + class spell_sindragosa_ice_tomb_filter_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sindragosa_ice_tomb_filter_SpellScript); - void FilterTargets(std::list& unitList) - { - unitList.remove_if(SindragosaIceTombCheck()); - } + void FilterTargets(std::list& unitList) + { + unitList.remove_if(SindragosaIceTombCheck()); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_filter_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_filter_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_sindragosa_ice_tomb_filter_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_sindragosa_ice_tomb_filter_SpellScript(); + } }; class spell_sindragosa_ice_tomb : public SpellScriptLoader { - public: - spell_sindragosa_ice_tomb() : SpellScriptLoader("spell_sindragosa_ice_tomb_trap") { } + public: + spell_sindragosa_ice_tomb() : SpellScriptLoader("spell_sindragosa_ice_tomb_trap") { } - class spell_sindragosa_ice_tomb_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sindragosa_ice_tomb_SpellScript); + class spell_sindragosa_ice_tomb_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sindragosa_ice_tomb_SpellScript); - std::list targetList; + std::list targetList; - bool Validate(SpellInfo const* /*spell*/) - { - if (!sObjectMgr->GetCreatureTemplate(NPC_ICE_TOMB)) - return false; - if (!sObjectMgr->GetGameObjectTemplate(GO_ICE_BLOCK)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sObjectMgr->GetCreatureTemplate(NPC_ICE_TOMB)) + return false; + if (!sObjectMgr->GetGameObjectTemplate(GO_ICE_BLOCK)) + return false; + return true; + } - void FilterTargets(std::list& unitList) - { - unitList.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); - targetList.clear(); - targetList = unitList; - } + void FilterTargets(std::list& unitList) + { + unitList.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); + targetList.clear(); + targetList = unitList; + } - void FilterTargetsSubseq(std::list& unitList) - { - unitList.clear(); - unitList = targetList; - } + void FilterTargetsSubseq(std::list& unitList) + { + unitList.clear(); + unitList = targetList; + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_SpellScript::FilterTargetsSubseq, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_ice_tomb_SpellScript::FilterTargetsSubseq, EFFECT_2, TARGET_UNIT_DEST_AREA_ENEMY); + } + }; - class spell_sindragosa_ice_tomb_AuraScript : public AuraScript - { - PrepareAuraScript(spell_sindragosa_ice_tomb_AuraScript); + class spell_sindragosa_ice_tomb_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sindragosa_ice_tomb_AuraScript); - void PeriodicTick(AuraEffect const* /*aurEff*/) - { - PreventDefaultAction(); - } + void PeriodicTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + } - void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* c = GetCaster()) - GetTarget()->m_Events.AddEvent(new IceTombSummonEvent(GetTarget(), c->GetGUID()), GetTarget()->m_Events.CalculateTime(500)); - } + void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* c = GetCaster()) + GetTarget()->m_Events.AddEvent(new IceTombSummonEvent(GetTarget(), c->GetGUID()), GetTarget()->m_Events.CalculateTime(500)); + } - void ExtraRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAurasDueToSpell(SPELL_ASPHYXIATION); - GetTarget()->RemoveAurasDueToSpell(SPELL_ICE_TOMB_UNTARGETABLE); - } + void ExtraRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(SPELL_ASPHYXIATION); + GetTarget()->RemoveAurasDueToSpell(SPELL_ICE_TOMB_UNTARGETABLE); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_ice_tomb_AuraScript::PeriodicTick, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - AfterEffectRemove += AuraEffectRemoveFn(spell_sindragosa_ice_tomb_AuraScript::ExtraRemoveEffect, EFFECT_1, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); - AfterEffectApply += AuraEffectApplyFn(spell_sindragosa_ice_tomb_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_ice_tomb_AuraScript::PeriodicTick, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + AfterEffectRemove += AuraEffectRemoveFn(spell_sindragosa_ice_tomb_AuraScript::ExtraRemoveEffect, EFFECT_1, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); + AfterEffectApply += AuraEffectApplyFn(spell_sindragosa_ice_tomb_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_sindragosa_ice_tomb_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_sindragosa_ice_tomb_SpellScript(); + } - AuraScript* GetAuraScript() const - { - return new spell_sindragosa_ice_tomb_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_sindragosa_ice_tomb_AuraScript(); + } }; class MysticBuffetTargetFilter { - public: - explicit MysticBuffetTargetFilter(Unit* caster) : _caster(caster) { } + public: + explicit MysticBuffetTargetFilter(Unit* caster) : _caster(caster) { } - bool operator()(WorldObject* unit) const - { - if (!unit->IsInMap(_caster)) - return true; + bool operator()(WorldObject* unit) const + { + if (!unit->IsInMap(_caster)) + return true; - // for standard creatures check full LOS - if (Creature* c = unit->ToCreature()) - if (!c->IsPet() && c->GetDBTableGUIDLow()) - return !_caster->IsWithinLOSInMap(unit); + // for standard creatures check full LOS + if (Creature* c = unit->ToCreature()) + if (!c->IsPet() && c->GetDBTableGUIDLow()) + return !_caster->IsWithinLOSInMap(unit); - // for players and pets check only dynamic los (ice block gameobjects) - float ox, oy, oz; - _caster->GetPosition(ox, oy, oz); - DynamicMapTree const& dTree = unit->GetMap()->GetDynamicMapTree(); - return !dTree.isInLineOfSight(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()+2.f, ox, oy, oz+2.f, unit->GetPhaseMask()); - } + // for players and pets check only dynamic los (ice block gameobjects) + float ox, oy, oz; + _caster->GetPosition(ox, oy, oz); + DynamicMapTree const& dTree = unit->GetMap()->GetDynamicMapTree(); + return !dTree.isInLineOfSight(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()+2.f, ox, oy, oz+2.f, unit->GetPhaseMask()); + } - private: - Unit* _caster; + private: + Unit* _caster; }; class spell_sindragosa_mystic_buffet : public SpellScriptLoader { - public: - spell_sindragosa_mystic_buffet() : SpellScriptLoader("spell_sindragosa_mystic_buffet") { } + public: + spell_sindragosa_mystic_buffet() : SpellScriptLoader("spell_sindragosa_mystic_buffet") { } - class spell_sindragosa_mystic_buffet_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sindragosa_mystic_buffet_SpellScript); + class spell_sindragosa_mystic_buffet_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sindragosa_mystic_buffet_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove_if(MysticBuffetTargetFilter(GetCaster())); - } + void FilterTargets(std::list& targets) + { + targets.remove_if(MysticBuffetTargetFilter(GetCaster())); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_mystic_buffet_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sindragosa_mystic_buffet_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_sindragosa_mystic_buffet_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_sindragosa_mystic_buffet_SpellScript(); + } }; class spell_sindragosa_soul_preservation : public SpellScriptLoader { - public: - spell_sindragosa_soul_preservation() : SpellScriptLoader("spell_sindragosa_soul_preservation") { } + public: + spell_sindragosa_soul_preservation() : SpellScriptLoader("spell_sindragosa_soul_preservation") { } - class spell_sindragosa_soul_preservation_AuraScript : public AuraScript - { - PrepareAuraScript(spell_sindragosa_soul_preservation_AuraScript); + class spell_sindragosa_soul_preservation_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sindragosa_soul_preservation_AuraScript); - void PeriodicTick(AuraEffect const* aurEff) - { - PreventDefaultAction(); - if (Unit* s = GetTarget()) - if (GetStackAmount() >= (s->GetMap()->Is25ManRaid() ? 75 : 30)) - { - s->CastSpell(s, 72466, true); - s->RemoveAurasDueToSpell(72424); - if (s->GetTypeId() == TYPEID_UNIT) s->ToCreature()->SetLootMode(3); - SetDuration(1); - } - } + void PeriodicTick(AuraEffect const* aurEff) + { + PreventDefaultAction(); + if (Unit* s = GetTarget()) + if (GetStackAmount() >= (s->GetMap()->Is25ManRaid() ? 75 : 30)) + { + s->CastSpell(s, 72466, true); + s->RemoveAurasDueToSpell(72424); + if (s->GetTypeId() == TYPEID_UNIT) s->ToCreature()->SetLootMode(3); + SetDuration(1); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_soul_preservation_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_sindragosa_soul_preservation_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_sindragosa_soul_preservation_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_sindragosa_soul_preservation_AuraScript(); + } }; class achievement_all_you_can_eat : public AchievementCriteriaScript { - public: - achievement_all_you_can_eat() : AchievementCriteriaScript("achievement_all_you_can_eat") { } + public: + achievement_all_you_can_eat() : AchievementCriteriaScript("achievement_all_you_can_eat") { } - bool OnCheck(Player* /*source*/, Unit* target) - { - if (!target || target->GetEntry() != NPC_SINDRAGOSA) - return false; - return target->GetAI()->GetData(DATA_MYSTIC_BUFFET_STACK) <= 5; - } + bool OnCheck(Player* /*source*/, Unit* target) + { + if (!target || target->GetEntry() != NPC_SINDRAGOSA) + return false; + return target->GetAI()->GetData(DATA_MYSTIC_BUFFET_STACK) <= 5; + } }; class npc_spinestalker : public CreatureScript { - public: - npc_spinestalker() : CreatureScript("npc_spinestalker") { } + public: + npc_spinestalker() : CreatureScript("npc_spinestalker") { } - struct npc_spinestalkerAI : public ScriptedAI - { - npc_spinestalkerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summoned(false) - { - } + struct npc_spinestalkerAI : public ScriptedAI + { + npc_spinestalkerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summoned(false) + { + } - void InitializeAI() - { - if (!me->isDead()) - { - _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade - Reset(); - } - } + void InitializeAI() + { + if (!me->isDead()) + { + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade + Reset(); + } + } - void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EVENT_BELLOWING_ROAR, urand(20000, 25000)); - _events.ScheduleEvent(EVENT_CLEAVE_SPINESTALKER, urand(10000, 15000)); - _events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(8000, 12000)); - me->SetReactState(REACT_DEFENSIVE); + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_BELLOWING_ROAR, urand(20000, 25000)); + _events.ScheduleEvent(EVENT_CLEAVE_SPINESTALKER, urand(10000, 15000)); + _events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(8000, 12000)); + me->SetReactState(REACT_DEFENSIVE); - if (!_summoned) - { - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - } - } + if (!_summoned) + { + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + } + } - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); - if (_summoned) - { - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetHover(false); - } - } + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); + if (_summoned) + { + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); + } + } - void JustRespawned() - { - ScriptedAI::JustRespawned(); - _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade - } + void JustRespawned() + { + ScriptedAI::JustRespawned(); + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade + } - void JustDied(Unit* /*killer*/) - { - _events.Reset(); - } + void JustDied(Unit* /*killer*/) + { + _events.Reset(); + } - void DoAction(int32 action) - { - if (action == ACTION_START_FROSTWYRM) - { - if (_summoned) - return; + void DoAction(int32 action) + { + if (action == ACTION_START_FROSTWYRM) + { + if (_summoned) + return; - _summoned = true; - if (me->isDead()) - return; + _summoned = true; + if (me->isDead()) + return; - me->setActive(true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - float moveTime = me->GetExactDist(&SpinestalkerFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f); - me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SpinestalkerLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250)); - me->SetDefaultMovementType(IDLE_MOTION_TYPE); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->GetMotionMaster()->MovePoint(POINT_FROSTWYRM_FLY_IN, SpinestalkerFlyPos); - } - } + me->setActive(true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + float moveTime = me->GetExactDist(&SpinestalkerFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f); + me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SpinestalkerLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250)); + me->SetDefaultMovementType(IDLE_MOTION_TYPE); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->GetMotionMaster()->MovePoint(POINT_FROSTWYRM_FLY_IN, SpinestalkerFlyPos); + } + } - void MovementInform(uint32 type, uint32 point) - { - if (type != EFFECT_MOTION_TYPE || point != POINT_FROSTWYRM_LAND) - return; + void MovementInform(uint32 type, uint32 point) + { + if (type != EFFECT_MOTION_TYPE || point != POINT_FROSTWYRM_LAND) + return; - me->setActive(false); - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetHover(false); - me->SetHomePosition(SpinestalkerLandPos); - me->SetFacingTo(SpinestalkerLandPos.GetOrientation()); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - } + me->setActive(false); + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); + me->SetHomePosition(SpinestalkerLandPos); + me->SetFacingTo(SpinestalkerLandPos.GetOrientation()); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (_events.ExecuteEvent()) - { - case EVENT_BELLOWING_ROAR: - me->CastSpell(me, SPELL_BELLOWING_ROAR, false); - _events.ScheduleEvent(EVENT_BELLOWING_ROAR, urand(25000, 30000)); - break; - case EVENT_CLEAVE_SPINESTALKER: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE_SPINESTALKER, false); - _events.ScheduleEvent(EVENT_CLEAVE_SPINESTALKER, urand(10000, 15000)); - break; - case EVENT_TAIL_SWEEP: - me->CastSpell(me->GetVictim(), SPELL_TAIL_SWEEP, false); - _events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(22000, 25000)); - break; - default: - break; - } + switch (_events.ExecuteEvent()) + { + case EVENT_BELLOWING_ROAR: + me->CastSpell(me, SPELL_BELLOWING_ROAR, false); + _events.ScheduleEvent(EVENT_BELLOWING_ROAR, urand(25000, 30000)); + break; + case EVENT_CLEAVE_SPINESTALKER: + me->CastSpell(me->GetVictim(), SPELL_CLEAVE_SPINESTALKER, false); + _events.ScheduleEvent(EVENT_CLEAVE_SPINESTALKER, urand(10000, 15000)); + break; + case EVENT_TAIL_SWEEP: + me->CastSpell(me->GetVictim(), SPELL_TAIL_SWEEP, false); + _events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(22000, 25000)); + break; + default: + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap _events; - InstanceScript* _instance; - bool _summoned; - }; + private: + EventMap _events; + InstanceScript* _instance; + bool _summoned; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_rimefang : public CreatureScript { - public: - npc_rimefang() : CreatureScript("npc_rimefang_icc") { } + public: + npc_rimefang() : CreatureScript("npc_rimefang_icc") { } - struct npc_rimefangAI : public ScriptedAI - { - npc_rimefangAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summoned(false) - { - } + struct npc_rimefangAI : public ScriptedAI + { + npc_rimefangAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summoned(false) + { + } - void InitializeAI() - { - if (!me->isDead()) - { - _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade - Reset(); - } - } + void InitializeAI() + { + if (!me->isDead()) + { + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade + Reset(); + } + } - void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EVENT_FROST_BREATH_RIMEFANG, urand(12000, 15000)); - _events.ScheduleEvent(EVENT_ICY_BLAST, urand(30000, 35000)); - me->SetReactState(REACT_DEFENSIVE); - _icyBlastCounter = 0; + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_FROST_BREATH_RIMEFANG, urand(12000, 15000)); + _events.ScheduleEvent(EVENT_ICY_BLAST, urand(30000, 35000)); + me->SetReactState(REACT_DEFENSIVE); + _icyBlastCounter = 0; - if (!_summoned) - { - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - } - } + if (!_summoned) + { + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + } + } - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); - if (_summoned) - { - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetHover(false); - } - } + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); + if (_summoned) + { + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); + } + } - void JustRespawned() - { - ScriptedAI::JustRespawned(); - _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade - } + void JustRespawned() + { + ScriptedAI::JustRespawned(); + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade + } - void JustDied(Unit* /*killer*/) - { - _events.Reset(); - } + void JustDied(Unit* /*killer*/) + { + _events.Reset(); + } - void DoAction(int32 action) - { - if (action == ACTION_START_FROSTWYRM) - { - if (_summoned) - return; + void DoAction(int32 action) + { + if (action == ACTION_START_FROSTWYRM) + { + if (_summoned) + return; - _summoned = true; - if (me->isDead()) - return; + _summoned = true; + if (me->isDead()) + return; - me->setActive(true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - float moveTime = me->GetExactDist(&RimefangFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f); - me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, RimefangLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250)); - me->SetDefaultMovementType(IDLE_MOTION_TYPE); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->GetMotionMaster()->MovePoint(POINT_FROSTWYRM_FLY_IN, RimefangFlyPos); - } - } + me->setActive(true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + float moveTime = me->GetExactDist(&RimefangFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f); + me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, RimefangLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250)); + me->SetDefaultMovementType(IDLE_MOTION_TYPE); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->GetMotionMaster()->MovePoint(POINT_FROSTWYRM_FLY_IN, RimefangFlyPos); + } + } - void MovementInform(uint32 type, uint32 point) - { - if (type != EFFECT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 point) + { + if (type != EFFECT_MOTION_TYPE) + return; - if (point == POINT_FROSTWYRM_LAND) - { - me->setActive(false); - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetHover(false); - me->SetHomePosition(RimefangLandPos); - me->SetFacingTo(RimefangLandPos.GetOrientation()); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - } - else if (point == POINT_LAND_GROUND) - { - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetHover(false); - me->SetReactState(REACT_DEFENSIVE); - if (Unit* victim = me->SelectVictim()) - AttackStart(victim); - } - } + if (point == POINT_FROSTWYRM_LAND) + { + me->setActive(false); + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); + me->SetHomePosition(RimefangLandPos); + me->SetFacingTo(RimefangLandPos.GetOrientation()); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + } + else if (point == POINT_LAND_GROUND) + { + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); + me->SetReactState(REACT_DEFENSIVE); + if (Unit* victim = me->SelectVictim()) + AttackStart(victim); + } + } - void EnterCombat(Unit* /*victim*/) - { - me->CastSpell(me, SPELL_FROST_AURA_RIMEFANG, true); - } + void EnterCombat(Unit* /*victim*/) + { + me->CastSpell(me, SPELL_FROST_AURA_RIMEFANG, true); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (_events.ExecuteEvent()) - { - case EVENT_FROST_BREATH_RIMEFANG: - if (!me->IsFlying()) - { - me->CastSpell(me->GetVictim(), SPELL_FROST_BREATH, false); - _events.ScheduleEvent(EVENT_FROST_BREATH_RIMEFANG, urand(20000, 25000)); - } - else - _events.ScheduleEvent(EVENT_FROST_BREATH_RIMEFANG, 5000); - break; - case EVENT_ICY_BLAST: - { - _icyBlastCounter = RAID_MODE(5, 7, 6, 8); - me->SetReactState(REACT_PASSIVE); + switch (_events.ExecuteEvent()) + { + case EVENT_FROST_BREATH_RIMEFANG: + if (!me->IsFlying()) + { + me->CastSpell(me->GetVictim(), SPELL_FROST_BREATH, false); + _events.ScheduleEvent(EVENT_FROST_BREATH_RIMEFANG, urand(20000, 25000)); + } + else + _events.ScheduleEvent(EVENT_FROST_BREATH_RIMEFANG, 5000); + break; + case EVENT_ICY_BLAST: + { + _icyBlastCounter = RAID_MODE(5, 7, 6, 8); + me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->SendMeleeAttackStop(me->GetVictim()); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->SendMeleeAttackStop(me->GetVictim()); - me->AttackStop(); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - me->SendMovementFlagUpdate(); - float floorZ = me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+2.0f); - float destZ; - if (floorZ > 190.0f) destZ = floorZ + 25.0f; - else destZ = me->GetPositionZ() + 25.0f; - me->GetMotionMaster()->MoveTakeoff(0, me->GetPositionX(), me->GetPositionY(), destZ, me->GetSpeed(MOVE_RUN)); - float moveTime = fabs(destZ-me->GetPositionZ())/(me->GetSpeed(MOVE_RUN)*0.001f); - _events.ScheduleEvent(EVENT_ICY_BLAST, uint32(moveTime) + urand(60000, 70000)); - _events.ScheduleEvent(EVENT_ICY_BLAST_CAST, uint32(moveTime) + 250); - break; - } - case EVENT_ICY_BLAST_CAST: - if (--_icyBlastCounter) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) - { - me->SetFacingToObject(target); - me->CastSpell(target, SPELL_ICY_BLAST, false); - } - _events.ScheduleEvent(EVENT_ICY_BLAST_CAST, 3000); - } - else - { - float floorZ = me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+2.0f); - float destZ; - if (floorZ > 190.0f) destZ = floorZ; - else destZ = me->GetPositionZ() - 25.0f; - me->SendMeleeAttackStop(me->GetVictim()); - me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, me->GetPositionX(), me->GetPositionY(), destZ, me->GetSpeed(MOVE_RUN)); - } - break; - default: - break; - } + me->AttackStop(); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + me->SendMovementFlagUpdate(); + float floorZ = me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+2.0f); + float destZ; + if (floorZ > 190.0f) destZ = floorZ + 25.0f; + else destZ = me->GetPositionZ() + 25.0f; + me->GetMotionMaster()->MoveTakeoff(0, me->GetPositionX(), me->GetPositionY(), destZ, me->GetSpeed(MOVE_RUN)); + float moveTime = fabs(destZ-me->GetPositionZ())/(me->GetSpeed(MOVE_RUN)*0.001f); + _events.ScheduleEvent(EVENT_ICY_BLAST, uint32(moveTime) + urand(60000, 70000)); + _events.ScheduleEvent(EVENT_ICY_BLAST_CAST, uint32(moveTime) + 250); + break; + } + case EVENT_ICY_BLAST_CAST: + if (--_icyBlastCounter) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + { + me->SetFacingToObject(target); + me->CastSpell(target, SPELL_ICY_BLAST, false); + } + _events.ScheduleEvent(EVENT_ICY_BLAST_CAST, 3000); + } + else + { + float floorZ = me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+2.0f); + float destZ; + if (floorZ > 190.0f) destZ = floorZ; + else destZ = me->GetPositionZ() - 25.0f; + me->SendMeleeAttackStop(me->GetVictim()); + me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, me->GetPositionX(), me->GetPositionY(), destZ, me->GetSpeed(MOVE_RUN)); + } + break; + default: + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap _events; - InstanceScript* _instance; - uint8 _icyBlastCounter; - bool _summoned; - }; + private: + EventMap _events; + InstanceScript* _instance; + uint8 _icyBlastCounter; + bool _summoned; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_rimefang_icy_blast : public SpellScriptLoader { - public: - spell_rimefang_icy_blast() : SpellScriptLoader("spell_rimefang_icy_blast") { } + public: + spell_rimefang_icy_blast() : SpellScriptLoader("spell_rimefang_icy_blast") { } - class spell_rimefang_icy_blast_SpellScript : public SpellScript - { - PrepareSpellScript(spell_rimefang_icy_blast_SpellScript); + class spell_rimefang_icy_blast_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rimefang_icy_blast_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_ICY_BLAST_AREA)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ICY_BLAST_AREA)) + return false; + return true; + } - void HandleTriggerMissile(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Position const* pos = GetExplTargetDest()) - if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 40000)) - summon->CastSpell(summon, SPELL_ICY_BLAST_AREA, true); - } + void HandleTriggerMissile(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Position const* pos = GetExplTargetDest()) + if (TempSummon* summon = GetCaster()->SummonCreature(NPC_ICY_BLAST, *pos, TEMPSUMMON_TIMED_DESPAWN, 40000)) + summon->CastSpell(summon, SPELL_ICY_BLAST_AREA, true); + } - void Register() - { - OnEffectHit += SpellEffectFn(spell_rimefang_icy_blast_SpellScript::HandleTriggerMissile, EFFECT_1, SPELL_EFFECT_TRIGGER_MISSILE); - } - }; + void Register() + { + OnEffectHit += SpellEffectFn(spell_rimefang_icy_blast_SpellScript::HandleTriggerMissile, EFFECT_1, SPELL_EFFECT_TRIGGER_MISSILE); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_rimefang_icy_blast_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_rimefang_icy_blast_SpellScript(); + } }; class at_sindragosa_lair : public AreaTriggerScript { - public: - at_sindragosa_lair() : AreaTriggerScript("at_sindragosa_lair") { } + public: + at_sindragosa_lair() : AreaTriggerScript("at_sindragosa_lair") { } - bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) - { - if (InstanceScript* instance = player->GetInstanceScript()) - { - if (!instance->GetData(DATA_SPINESTALKER)) - if (Creature* spinestalker = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_SPINESTALKER))) - spinestalker->AI()->DoAction(ACTION_START_FROSTWYRM); + bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) + { + if (InstanceScript* instance = player->GetInstanceScript()) + { + if (!instance->GetData(DATA_SPINESTALKER)) + if (Creature* spinestalker = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_SPINESTALKER))) + spinestalker->AI()->DoAction(ACTION_START_FROSTWYRM); - if (!instance->GetData(DATA_RIMEFANG)) - if (Creature* rimefang = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_RIMEFANG))) - rimefang->AI()->DoAction(ACTION_START_FROSTWYRM); + if (!instance->GetData(DATA_RIMEFANG)) + if (Creature* rimefang = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_RIMEFANG))) + rimefang->AI()->DoAction(ACTION_START_FROSTWYRM); - if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && !instance->GetData64(DATA_SINDRAGOSA) && instance->GetBossState(DATA_SINDRAGOSA) != DONE) - { - if (instance->GetData(DATA_HAS_LIMITED_ATTEMPTS) && !instance->GetData(DATA_HEROIC_ATTEMPTS)) - return true; + if (!instance->GetData(DATA_SINDRAGOSA_FROSTWYRMS) && !instance->GetData64(DATA_SINDRAGOSA) && instance->GetBossState(DATA_SINDRAGOSA) != DONE) + { + if (instance->GetData(DATA_HAS_LIMITED_ATTEMPTS) && !instance->GetData(DATA_HEROIC_ATTEMPTS)) + return true; - player->GetMap()->LoadGrid(SindragosaSpawnPos.GetPositionX(), SindragosaSpawnPos.GetPositionY()); - if (Creature* sindragosa = player->GetMap()->SummonCreature(NPC_SINDRAGOSA, SindragosaSpawnPos)) - sindragosa->AI()->DoAction(ACTION_START_FROSTWYRM); - } - } + player->GetMap()->LoadGrid(SindragosaSpawnPos.GetPositionX(), SindragosaSpawnPos.GetPositionY()); + if (Creature* sindragosa = player->GetMap()->SummonCreature(NPC_SINDRAGOSA, SindragosaSpawnPos)) + sindragosa->AI()->DoAction(ACTION_START_FROSTWYRM); + } + } - return true; - } + return true; + } }; /*** TRASH ***/ class npc_sindragosa_trash : public CreatureScript { - public: - npc_sindragosa_trash() : CreatureScript("npc_sindragosa_trash") { } + public: + npc_sindragosa_trash() : CreatureScript("npc_sindragosa_trash") { } - struct npc_sindragosa_trashAI : public ScriptedAI - { - npc_sindragosa_trashAI(Creature* creature) : ScriptedAI(creature) - { - _instance = creature->GetInstanceScript(); - } + struct npc_sindragosa_trashAI : public ScriptedAI + { + npc_sindragosa_trashAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + } - void InitializeAI() - { - _frostwyrmId = (me->GetHomePosition().GetPositionY() < 2484.35f) ? DATA_RIMEFANG : DATA_SPINESTALKER; - if (!me->isDead()) - { - if (me->GetEntry() == NPC_FROSTWING_WHELP) - _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade - Reset(); - } - } + void InitializeAI() + { + _frostwyrmId = (me->GetHomePosition().GetPositionY() < 2484.35f) ? DATA_RIMEFANG : DATA_SPINESTALKER; + if (!me->isDead()) + { + if (me->GetEntry() == NPC_FROSTWING_WHELP) + _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade + Reset(); + } + } - void Reset() - { - _isTaunted = false; - _events.Reset(); - if (me->GetEntry() == NPC_FROSTWARDEN_HANDLER) - { - _events.ScheduleEvent(EVENT_FROSTWARDEN_ORDER_WHELP, 3000); - _events.ScheduleEvent(EVENT_CONCUSSIVE_SHOCK, urand(8000, 10000)); - } - else - _events.ScheduleEvent(EVENT_WHELP_FROST_BLAST, urand(3000, 6000)); - } + void Reset() + { + _isTaunted = false; + _events.Reset(); + if (me->GetEntry() == NPC_FROSTWARDEN_HANDLER) + { + _events.ScheduleEvent(EVENT_FROSTWARDEN_ORDER_WHELP, 3000); + _events.ScheduleEvent(EVENT_CONCUSSIVE_SHOCK, urand(8000, 10000)); + } + else + _events.ScheduleEvent(EVENT_WHELP_FROST_BLAST, urand(3000, 6000)); + } - void EnterCombat(Unit* who) - { - if (me->GetEntry() == NPC_FROSTWARDEN_HANDLER) - { - std::list unitList; - GetCreatureListWithEntryInGrid(unitList, me, NPC_FROSTWING_WHELP, 40.0f); - for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - if (!(*itr)->IsInCombat()) - (*itr)->AI()->AttackStart(who); - } - else - { - if (Creature* c = me->FindNearestCreature(NPC_FROSTWARDEN_HANDLER, 40.0f, true)) - if (!c->IsInCombat()) - c->AI()->AttackStart(who); - me->CallForHelp(15.0f); - } - } + void EnterCombat(Unit* who) + { + if (me->GetEntry() == NPC_FROSTWARDEN_HANDLER) + { + std::list unitList; + GetCreatureListWithEntryInGrid(unitList, me, NPC_FROSTWING_WHELP, 40.0f); + for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + if (!(*itr)->IsInCombat()) + (*itr)->AI()->AttackStart(who); + } + else + { + if (Creature* c = me->FindNearestCreature(NPC_FROSTWARDEN_HANDLER, 40.0f, true)) + if (!c->IsInCombat()) + c->AI()->AttackStart(who); + me->CallForHelp(15.0f); + } + } - void JustRespawned() - { - ScriptedAI::JustRespawned(); + void JustRespawned() + { + ScriptedAI::JustRespawned(); - // Increase add count - if (me->GetEntry() == NPC_FROSTWING_WHELP) - _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade - } + // Increase add count + if (me->GetEntry() == NPC_FROSTWING_WHELP) + _instance->SetData(_frostwyrmId, me->GetDBTableGUIDLow()); // this cannot be in Reset because reset also happens on evade + } - void SetData(uint32 type, uint32 data) - { - if (type == DATA_WHELP_MARKER) - _isTaunted = data != 0; - } + void SetData(uint32 type, uint32 data) + { + if (type == DATA_WHELP_MARKER) + _isTaunted = data != 0; + } - uint32 GetData(uint32 type) const - { - if (type == DATA_FROSTWYRM_OWNER) - return _frostwyrmId; - else if (type == DATA_WHELP_MARKER) - return uint32(_isTaunted); - return 0; - } + uint32 GetData(uint32 type) const + { + if (type == DATA_FROSTWYRM_OWNER) + return _frostwyrmId; + else if (type == DATA_WHELP_MARKER) + return uint32(_isTaunted); + return 0; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (_events.ExecuteEvent()) - { - case EVENT_FROSTWARDEN_ORDER_WHELP: - me->CastSpell(me, SPELL_ORDER_WHELP, false); - _events.ScheduleEvent(EVENT_FROSTWARDEN_ORDER_WHELP, 3000); - break; - case EVENT_CONCUSSIVE_SHOCK: - me->CastSpell(me, SPELL_CONCUSSIVE_SHOCK, false); - _events.ScheduleEvent(EVENT_CONCUSSIVE_SHOCK, urand(10000, 13000)); - break; - case EVENT_WHELP_FROST_BLAST: - me->CastSpell(me->GetVictim(), 71361, false); - _events.ScheduleEvent(EVENT_WHELP_FROST_BLAST, urand(5000,8000)); - default: - break; - } + switch (_events.ExecuteEvent()) + { + case EVENT_FROSTWARDEN_ORDER_WHELP: + me->CastSpell(me, SPELL_ORDER_WHELP, false); + _events.ScheduleEvent(EVENT_FROSTWARDEN_ORDER_WHELP, 3000); + break; + case EVENT_CONCUSSIVE_SHOCK: + me->CastSpell(me, SPELL_CONCUSSIVE_SHOCK, false); + _events.ScheduleEvent(EVENT_CONCUSSIVE_SHOCK, urand(10000, 13000)); + break; + case EVENT_WHELP_FROST_BLAST: + me->CastSpell(me->GetVictim(), 71361, false); + _events.ScheduleEvent(EVENT_WHELP_FROST_BLAST, urand(5000,8000)); + default: + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap _events; - InstanceScript* _instance; - uint32 _frostwyrmId; - bool _isTaunted; // Frostwing Whelp only - }; + private: + EventMap _events; + InstanceScript* _instance; + uint32 _frostwyrmId; + bool _isTaunted; // Frostwing Whelp only + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class OrderWhelpTargetSelector { - public: - explicit OrderWhelpTargetSelector(Creature* owner) : _owner(owner) { } + public: + explicit OrderWhelpTargetSelector(Creature* owner) : _owner(owner) { } - bool operator()(Creature* creature) - { - if (!creature->AI()->GetData(DATA_WHELP_MARKER) && creature->AI()->GetData(DATA_FROSTWYRM_OWNER) == _owner->AI()->GetData(DATA_FROSTWYRM_OWNER)) - return false; - return true; - } + bool operator()(Creature* creature) + { + if (!creature->AI()->GetData(DATA_WHELP_MARKER) && creature->AI()->GetData(DATA_FROSTWYRM_OWNER) == _owner->AI()->GetData(DATA_FROSTWYRM_OWNER)) + return false; + return true; + } - private: - Creature* _owner; + private: + Creature* _owner; }; class spell_frostwarden_handler_order_whelp : public SpellScriptLoader { - public: - spell_frostwarden_handler_order_whelp() : SpellScriptLoader("spell_frostwarden_handler_order_whelp") { } + public: + spell_frostwarden_handler_order_whelp() : SpellScriptLoader("spell_frostwarden_handler_order_whelp") { } - class spell_frostwarden_handler_order_whelp_SpellScript : public SpellScript - { - PrepareSpellScript(spell_frostwarden_handler_order_whelp_SpellScript); + class spell_frostwarden_handler_order_whelp_SpellScript : public SpellScript + { + PrepareSpellScript(spell_frostwarden_handler_order_whelp_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_FOCUS_FIRE)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_FOCUS_FIRE)) + return false; + return true; + } - void FilterTargets(std::list& targets) - { - targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); - if (targets.empty()) - return; + void FilterTargets(std::list& targets) + { + targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); + if (targets.empty()) + return; - WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); - targets.clear(); - targets.push_back(target); - } + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); + } - void HandleForcedCast(SpellEffIndex effIndex) - { - // caster is Frostwarden Handler, target is player, caster of triggered is whelp - PreventHitDefaultEffect(effIndex); - std::list unitList; - GetCreatureListWithEntryInGrid(unitList, GetCaster(), NPC_FROSTWING_WHELP, 150.0f); - if (Creature* creature = GetCaster()->ToCreature()) - unitList.remove_if(OrderWhelpTargetSelector(creature)); + void HandleForcedCast(SpellEffIndex effIndex) + { + // caster is Frostwarden Handler, target is player, caster of triggered is whelp + PreventHitDefaultEffect(effIndex); + std::list unitList; + GetCreatureListWithEntryInGrid(unitList, GetCaster(), NPC_FROSTWING_WHELP, 150.0f); + if (Creature* creature = GetCaster()->ToCreature()) + unitList.remove_if(OrderWhelpTargetSelector(creature)); - if (unitList.empty()) - return; + if (unitList.empty()) + return; - Trinity::Containers::SelectRandomContainerElement(unitList)->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); - } + Trinity::Containers::SelectRandomContainerElement(unitList)->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_order_whelp_SpellScript::HandleForcedCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frostwarden_handler_order_whelp_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_order_whelp_SpellScript::HandleForcedCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_frostwarden_handler_order_whelp_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_frostwarden_handler_order_whelp_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_frostwarden_handler_order_whelp_SpellScript(); + } }; class spell_frostwarden_handler_focus_fire : public SpellScriptLoader { - public: - spell_frostwarden_handler_focus_fire() : SpellScriptLoader("spell_frostwarden_handler_focus_fire") { } + public: + spell_frostwarden_handler_focus_fire() : SpellScriptLoader("spell_frostwarden_handler_focus_fire") { } - class spell_frostwarden_handler_focus_fire_SpellScript : public SpellScript - { - PrepareSpellScript(spell_frostwarden_handler_focus_fire_SpellScript); + class spell_frostwarden_handler_focus_fire_SpellScript : public SpellScript + { + PrepareSpellScript(spell_frostwarden_handler_focus_fire_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster()->AddThreat(GetHitUnit(), float(GetEffectValue())); - GetCaster()->GetAI()->SetData(DATA_WHELP_MARKER, 1); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetCaster()->AddThreat(GetHitUnit(), float(GetEffectValue())); + GetCaster()->GetAI()->SetData(DATA_WHELP_MARKER, 1); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_focus_fire_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_frostwarden_handler_focus_fire_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - class spell_frostwarden_handler_focus_fire_AuraScript : public AuraScript - { - PrepareAuraScript(spell_frostwarden_handler_focus_fire_AuraScript); + class spell_frostwarden_handler_focus_fire_AuraScript : public AuraScript + { + PrepareAuraScript(spell_frostwarden_handler_focus_fire_AuraScript); - void PeriodicTick(AuraEffect const* /*aurEff*/) - { - PreventDefaultAction(); - if (Unit* caster = GetCaster()) - { - caster->AddThreat(GetTarget(), -float(GetSpellInfo()->Effects[EFFECT_1].CalcValue())); - caster->GetAI()->SetData(DATA_WHELP_MARKER, 0); - } - } + void PeriodicTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + { + caster->AddThreat(GetTarget(), -float(GetSpellInfo()->Effects[EFFECT_1].CalcValue())); + caster->GetAI()->SetData(DATA_WHELP_MARKER, 0); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_frostwarden_handler_focus_fire_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_frostwarden_handler_focus_fire_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_frostwarden_handler_focus_fire_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_frostwarden_handler_focus_fire_SpellScript(); + } - AuraScript* GetAuraScript() const - { - return new spell_frostwarden_handler_focus_fire_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_frostwarden_handler_focus_fire_AuraScript(); + } }; class spell_sindragosa_frost_breath : public SpellScriptLoader { - public: - spell_sindragosa_frost_breath() : SpellScriptLoader("spell_sindragosa_frost_breath") { } + public: + spell_sindragosa_frost_breath() : SpellScriptLoader("spell_sindragosa_frost_breath") { } - class spell_sindragosa_frost_breath_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sindragosa_frost_breath_SpellScript); + class spell_sindragosa_frost_breath_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sindragosa_frost_breath_SpellScript); - void HandleInfusion() - { - Player* target = GetHitPlayer(); - if (!target) - return; + void HandleInfusion() + { + Player* target = GetHitPlayer(); + if (!target) + return; - // Check difficulty and quest status - if (!(target->GetRaidDifficulty() & RAID_DIFFICULTY_MASK_25MAN) || target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE) - return; + // Check difficulty and quest status + if (!(target->GetRaidDifficulty() & RAID_DIFFICULTY_MASK_25MAN) || target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE) + return; - // Check if player has Shadow's Edge equipped and not ready for infusion - if (!target->HasAura(SPELL_UNSATED_CRAVING) || target->HasAura(SPELL_FROST_IMBUED_BLADE)) - return; + // Check if player has Shadow's Edge equipped and not ready for infusion + if (!target->HasAura(SPELL_UNSATED_CRAVING) || target->HasAura(SPELL_FROST_IMBUED_BLADE)) + return; - Aura* infusion = target->GetAura(SPELL_FROST_INFUSION, target->GetGUID()); - if (infusion && infusion->GetStackAmount() >= 3) - { - target->RemoveAura(infusion); - target->CastSpell(target, SPELL_FROST_IMBUED_BLADE, TRIGGERED_FULL_MASK); - } - else - target->CastSpell(target, SPELL_FROST_INFUSION, TRIGGERED_FULL_MASK); - } + Aura* infusion = target->GetAura(SPELL_FROST_INFUSION, target->GetGUID()); + if (infusion && infusion->GetStackAmount() >= 3) + { + target->RemoveAura(infusion); + target->CastSpell(target, SPELL_FROST_IMBUED_BLADE, TRIGGERED_FULL_MASK); + } + else + target->CastSpell(target, SPELL_FROST_INFUSION, TRIGGERED_FULL_MASK); + } - void Register() - { - AfterHit += SpellHitFn(spell_sindragosa_frost_breath_SpellScript::HandleInfusion); - } - }; + void Register() + { + AfterHit += SpellHitFn(spell_sindragosa_frost_breath_SpellScript::HandleInfusion); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_sindragosa_frost_breath_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_sindragosa_frost_breath_SpellScript(); + } }; void AddSC_boss_sindragosa() { - new boss_sindragosa(); - new npc_ice_tomb(); - new spell_sindragosa_s_fury(); - new spell_sindragosa_unchained_magic(); - new spell_sindragosa_permeating_chill(); - new spell_sindragosa_instability(); - new spell_sindragosa_icy_grip(); - new spell_sindragosa_icy_grip_jump(); - new spell_sindragosa_ice_tomb_filter(); - new spell_trigger_spell_from_caster("spell_sindragosa_ice_tomb", SPELL_ICE_TOMB_DUMMY); - new spell_trigger_spell_from_caster("spell_sindragosa_ice_tomb_dummy", SPELL_FROST_BEACON); - new spell_sindragosa_frost_beacon(); - new spell_sindragosa_ice_tomb(); - new spell_sindragosa_mystic_buffet(); - new spell_sindragosa_soul_preservation(); - new achievement_all_you_can_eat(); + new boss_sindragosa(); + new npc_ice_tomb(); + new spell_sindragosa_s_fury(); + new spell_sindragosa_unchained_magic(); + new spell_sindragosa_permeating_chill(); + new spell_sindragosa_instability(); + new spell_sindragosa_icy_grip(); + new spell_sindragosa_icy_grip_jump(); + new spell_sindragosa_ice_tomb_filter(); + new spell_trigger_spell_from_caster("spell_sindragosa_ice_tomb", SPELL_ICE_TOMB_DUMMY); + new spell_trigger_spell_from_caster("spell_sindragosa_ice_tomb_dummy", SPELL_FROST_BEACON); + new spell_sindragosa_frost_beacon(); + new spell_sindragosa_ice_tomb(); + new spell_sindragosa_mystic_buffet(); + new spell_sindragosa_soul_preservation(); + new achievement_all_you_can_eat(); - new npc_spinestalker(); - new npc_rimefang(); - new spell_rimefang_icy_blast(); - new at_sindragosa_lair(); + new npc_spinestalker(); + new npc_rimefang(); + new spell_rimefang_icy_blast(); + new at_sindragosa_lair(); - new npc_sindragosa_trash(); - new spell_frostwarden_handler_order_whelp(); - new spell_frostwarden_handler_focus_fire(); + new npc_sindragosa_trash(); + new spell_frostwarden_handler_order_whelp(); + new spell_frostwarden_handler_focus_fire(); - new spell_sindragosa_frost_breath(); + new spell_sindragosa_frost_breath(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index ff1ccc1cd..deeef24de 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -19,154 +19,154 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Texts { - // The Lich King - SAY_LK_INTRO_1 = 0, - SAY_LK_INTRO_2 = 1, - SAY_LK_INTRO_3 = 2, - SAY_LK_REMORSELESS_WINTER = 4, - SAY_LK_QUAKE = 5, - SAY_LK_SUMMON_VALKYR = 6, - SAY_LK_HARVEST_SOUL = 7, - SAY_LK_FROSTMOURNE_ESCAPE = 8, // not said on heroic - SAY_LK_FROSTMOURNE_KILL = 9, // not said on heroic - SAY_LK_KILL = 10, - SAY_LK_BERSERK = 11, - EMOTE_DEFILE_WARNING = 12, - EMOTE_NECROTIC_PLAGUE_WARNING = 13, - SAY_LK_OUTRO_1 = 14, - SAY_LK_OUTRO_2 = 15, - SAY_LK_OUTRO_3 = 16, - SAY_LK_OUTRO_4 = 17, - SAY_LK_OUTRO_5 = 18, - SAY_LK_OUTRO_6 = 19, - SAY_LK_OUTRO_7 = 20, - SAY_LK_OUTRO_8 = 21, + // The Lich King + SAY_LK_INTRO_1 = 0, + SAY_LK_INTRO_2 = 1, + SAY_LK_INTRO_3 = 2, + SAY_LK_REMORSELESS_WINTER = 4, + SAY_LK_QUAKE = 5, + SAY_LK_SUMMON_VALKYR = 6, + SAY_LK_HARVEST_SOUL = 7, + SAY_LK_FROSTMOURNE_ESCAPE = 8, // not said on heroic + SAY_LK_FROSTMOURNE_KILL = 9, // not said on heroic + SAY_LK_KILL = 10, + SAY_LK_BERSERK = 11, + EMOTE_DEFILE_WARNING = 12, + EMOTE_NECROTIC_PLAGUE_WARNING = 13, + SAY_LK_OUTRO_1 = 14, + SAY_LK_OUTRO_2 = 15, + SAY_LK_OUTRO_3 = 16, + SAY_LK_OUTRO_4 = 17, + SAY_LK_OUTRO_5 = 18, + SAY_LK_OUTRO_6 = 19, + SAY_LK_OUTRO_7 = 20, + SAY_LK_OUTRO_8 = 21, - // Highlord Tirion Fordring - SAY_TIRION_INTRO_1 = 0, - SAY_TIRION_INTRO_2 = 1, - SAY_TIRION_OUTRO_1 = 2, - SAY_TIRION_OUTRO_2 = 3, + // Highlord Tirion Fordring + SAY_TIRION_INTRO_1 = 0, + SAY_TIRION_INTRO_2 = 1, + SAY_TIRION_OUTRO_1 = 2, + SAY_TIRION_OUTRO_2 = 3, - // Terenas Menethil (outro) - SAY_TERENAS_OUTRO_1 = 0, - SAY_TERENAS_OUTRO_2 = 1, + // Terenas Menethil (outro) + SAY_TERENAS_OUTRO_1 = 0, + SAY_TERENAS_OUTRO_2 = 1, - // Terenas Menethil (Frostmourne) - SAY_TERENAS_INTRO_1 = 0, - SAY_TERENAS_INTRO_2 = 1, - SAY_TERENAS_INTRO_3 = 2, + // Terenas Menethil (Frostmourne) + SAY_TERENAS_INTRO_1 = 0, + SAY_TERENAS_INTRO_2 = 1, + SAY_TERENAS_INTRO_3 = 2, }; enum Spells { - // Basic - SPELL_PLAGUE_AVOIDANCE = 72846, - SPELL_EMOTE_SIT_NO_SHEATH = 73220, - SPELL_BOSS_HITTIN_YA = 73878, - SPELL_BOSS_HITTIN_YA_AURA = 73879, - SPELL_EMOTE_SHOUT_NO_SHEATH = 73213, - SPELL_ICE_LOCK = 71614, + // Basic + SPELL_PLAGUE_AVOIDANCE = 72846, + SPELL_EMOTE_SIT_NO_SHEATH = 73220, + SPELL_BOSS_HITTIN_YA = 73878, + SPELL_BOSS_HITTIN_YA_AURA = 73879, + SPELL_EMOTE_SHOUT_NO_SHEATH = 73213, + SPELL_ICE_LOCK = 71614, - // Outro - SPELL_FURY_OF_FROSTMOURNE = 72350, - SPELL_FURY_OF_FROSTMOURNE_NO_REZ = 72351, - SPELL_EMOTE_QUESTION_NO_SHEATH = 73330, - SPELL_RAISE_DEAD = 71769, - SPELL_LIGHTS_BLESSING = 71797, - SPELL_JUMP = 71809, - SPELL_JUMP_TRIGGERED = 71811, - SPELL_JUMP_2 = 72431, - SPELL_SUMMON_BROKEN_FROSTMOURNE = 74081, - SPELL_SUMMON_BROKEN_FROSTMOURNE_2 = 72406, - SPELL_SUMMON_BROKEN_FROSTMOURNE_3 = 73017, - SPELL_BROKEN_FROSTMOURNE = 72398, - SPELL_BROKEN_FROSTMOURNE_KNOCK = 72405, - SPELL_SOUL_BARRAGE = 72305, - SPELL_SUMMON_TERENAS = 72420, - SPELL_MASS_RESURRECTION = 72429, - SPELL_MASS_RESURRECTION_REAL = 72423, - SPELL_PLAY_MOVIE = 73159, + // Outro + SPELL_FURY_OF_FROSTMOURNE = 72350, + SPELL_FURY_OF_FROSTMOURNE_NO_REZ = 72351, + SPELL_EMOTE_QUESTION_NO_SHEATH = 73330, + SPELL_RAISE_DEAD = 71769, + SPELL_LIGHTS_BLESSING = 71797, + SPELL_JUMP = 71809, + SPELL_JUMP_TRIGGERED = 71811, + SPELL_JUMP_2 = 72431, + SPELL_SUMMON_BROKEN_FROSTMOURNE = 74081, + SPELL_SUMMON_BROKEN_FROSTMOURNE_2 = 72406, + SPELL_SUMMON_BROKEN_FROSTMOURNE_3 = 73017, + SPELL_BROKEN_FROSTMOURNE = 72398, + SPELL_BROKEN_FROSTMOURNE_KNOCK = 72405, + SPELL_SOUL_BARRAGE = 72305, + SPELL_SUMMON_TERENAS = 72420, + SPELL_MASS_RESURRECTION = 72429, + SPELL_MASS_RESURRECTION_REAL = 72423, + SPELL_PLAY_MOVIE = 73159, - // Phase Transition - SPELL_REMORSELESS_WINTER_1 = 68981, - SPELL_REMORSELESS_WINTER_2 = 72259, - SPELL_QUAKE = 72262, - SPELL_PAIN_AND_SUFFERING = 72133, - SPELL_SUMMON_ICE_SPHERE = 69104, - SPELL_ICE_SPHERE = 69090, - SPELL_ICE_BURST_TARGET_SEARCH = 69109, - SPELL_ICE_PULSE = 69091, - SPELL_ICE_BURST = 69108, - SPELL_RAGING_SPIRIT = 69200, - SPELL_RAGING_SPIRIT_VISUAL = 69197, - SPELL_RAGING_SPIRIT_VISUAL_CLONE = 69198, - SPELL_SOUL_SHRIEK = 69242, + // Phase Transition + SPELL_REMORSELESS_WINTER_1 = 68981, + SPELL_REMORSELESS_WINTER_2 = 72259, + SPELL_QUAKE = 72262, + SPELL_PAIN_AND_SUFFERING = 72133, + SPELL_SUMMON_ICE_SPHERE = 69104, + SPELL_ICE_SPHERE = 69090, + SPELL_ICE_BURST_TARGET_SEARCH = 69109, + SPELL_ICE_PULSE = 69091, + SPELL_ICE_BURST = 69108, + SPELL_RAGING_SPIRIT = 69200, + SPELL_RAGING_SPIRIT_VISUAL = 69197, + SPELL_RAGING_SPIRIT_VISUAL_CLONE = 69198, + SPELL_SOUL_SHRIEK = 69242, - // Phase 1 - SPELL_RISEN_WITCH_DOCTOR_SPAWN = 69639, - SPELL_SUMMON_SHAMBLING_HORROR = 70372, - SPELL_SUMMON_DRUDGE_GHOULS = 70358, - SPELL_INFEST = 70541, - SPELL_NECROTIC_PLAGUE = 70337, - SPELL_NECROTIC_PLAGUE_JUMP = 70338, - SPELL_PLAGUE_SIPHON = 74074, - SPELL_SHADOW_TRAP = 73539, - SPELL_SHADOW_TRAP_AURA = 73525, - SPELL_SHADOW_TRAP_KNOCKBACK = 73529, + // Phase 1 + SPELL_RISEN_WITCH_DOCTOR_SPAWN = 69639, + SPELL_SUMMON_SHAMBLING_HORROR = 70372, + SPELL_SUMMON_DRUDGE_GHOULS = 70358, + SPELL_INFEST = 70541, + SPELL_NECROTIC_PLAGUE = 70337, + SPELL_NECROTIC_PLAGUE_JUMP = 70338, + SPELL_PLAGUE_SIPHON = 74074, + SPELL_SHADOW_TRAP = 73539, + SPELL_SHADOW_TRAP_AURA = 73525, + SPELL_SHADOW_TRAP_KNOCKBACK = 73529, - // Phase 2 - SPELL_DEFILE = 72762, - SPELL_DEFILE_AURA = 72743, - SPELL_DEFILE_GROW = 72756, - SPELL_SOUL_REAPER = 69409, - SPELL_SOUL_REAPER_BUFF = 69410, - SPELL_SUMMON_VALKYR = 69037, - SPELL_SUMMON_VALKYR_PERIODIC = 74361, - SPELL_WINGS_OF_THE_DAMNED = 74352, - SPELL_VALKYR_TARGET_SEARCH = 69030, - SPELL_HARVEST_SOUL_VALKYR = 68985, // vehicle aura used by Val'kyr Shadowguard and Strangulate Vehicle - SPELL_CHARGE = 74399, - SPELL_VALKYR_CARRY = 74445, - SPELL_EJECT_ALL_PASSENGERS = 68576, - SPELL_LIFE_SIPHON = 73488, - SPELL_LIFE_SIPHON_HEAL = 73489, + // Phase 2 + SPELL_DEFILE = 72762, + SPELL_DEFILE_AURA = 72743, + SPELL_DEFILE_GROW = 72756, + SPELL_SOUL_REAPER = 69409, + SPELL_SOUL_REAPER_BUFF = 69410, + SPELL_SUMMON_VALKYR = 69037, + SPELL_SUMMON_VALKYR_PERIODIC = 74361, + SPELL_WINGS_OF_THE_DAMNED = 74352, + SPELL_VALKYR_TARGET_SEARCH = 69030, + SPELL_HARVEST_SOUL_VALKYR = 68985, // vehicle aura used by Val'kyr Shadowguard and Strangulate Vehicle + SPELL_CHARGE = 74399, + SPELL_VALKYR_CARRY = 74445, + SPELL_EJECT_ALL_PASSENGERS = 68576, + SPELL_LIFE_SIPHON = 73488, + SPELL_LIFE_SIPHON_HEAL = 73489, - // Phase 3 - SPELL_VILE_SPIRITS = 70498, - SPELL_VILE_SPIRIT_MOVE_SEARCH = 70501, - SPELL_VILE_SPIRIT_DAMAGE_SEARCH = 70502, - SPELL_SPIRIT_BURST = 70503, - SPELL_HARVEST_SOUL = 68980, - SPELL_HARVEST_SOUL_VEHICLE = 68984, - SPELL_HARVEST_SOUL_VISUAL = 71372, - SPELL_HARVEST_SOUL_TELEPORT = 72546, - SPELL_HARVEST_SOUL_TELEPORT_BACK = 72597, - SPELL_KILL_FROSTMOURNE_PLAYERS = 75127, - SPELL_HARVESTED_SOUL_LK_BUFF = 72679, - SPELL_HARVEST_SOULS = 73654, - SPELL_HARVEST_SOULS_TELEPORT = 73655, - //SPELL_IN_FROSTMOURNE_ROOM = 74276, + // Phase 3 + SPELL_VILE_SPIRITS = 70498, + SPELL_VILE_SPIRIT_MOVE_SEARCH = 70501, + SPELL_VILE_SPIRIT_DAMAGE_SEARCH = 70502, + SPELL_SPIRIT_BURST = 70503, + SPELL_HARVEST_SOUL = 68980, + SPELL_HARVEST_SOUL_VEHICLE = 68984, + SPELL_HARVEST_SOUL_VISUAL = 71372, + SPELL_HARVEST_SOUL_TELEPORT = 72546, + SPELL_HARVEST_SOUL_TELEPORT_BACK = 72597, + SPELL_KILL_FROSTMOURNE_PLAYERS = 75127, + SPELL_HARVESTED_SOUL_LK_BUFF = 72679, + SPELL_HARVEST_SOULS = 73654, + SPELL_HARVEST_SOULS_TELEPORT = 73655, + //SPELL_IN_FROSTMOURNE_ROOM = 74276, - // Frostmourne - SPELL_LIGHTS_FAVOR = 69382, - SPELL_RESTORE_SOUL = 72595, - SPELL_RESTORE_SOULS = 73650, - SPELL_TERENAS_LOSES_INSIDE = 72572, - SPELL_DESTROY_SOUL = 74086, - SPELL_DARK_HUNGER = 69383, // Passive proc healing - SPELL_DARK_HUNGER_HEAL = 69384, - SPELL_SOUL_RIP = 69397, // Deals increasing damage - SPELL_SOUL_RIP_DAMAGE = 69398, - SPELL_SUMMON_SPIRIT_BOMB_1 = 73581, - SPELL_SUMMON_SPIRIT_BOMB_2 = 74299, - SPELL_TRIGGER_VILE_SPIRIT_HEROIC = 73582, - SPELL_EXPLOSION = 73576, + // Frostmourne + SPELL_LIGHTS_FAVOR = 69382, + SPELL_RESTORE_SOUL = 72595, + SPELL_RESTORE_SOULS = 73650, + SPELL_TERENAS_LOSES_INSIDE = 72572, + SPELL_DESTROY_SOUL = 74086, + SPELL_DARK_HUNGER = 69383, // Passive proc healing + SPELL_DARK_HUNGER_HEAL = 69384, + SPELL_SOUL_RIP = 69397, // Deals increasing damage + SPELL_SOUL_RIP_DAMAGE = 69398, + SPELL_SUMMON_SPIRIT_BOMB_1 = 73581, + SPELL_SUMMON_SPIRIT_BOMB_2 = 74299, + SPELL_TRIGGER_VILE_SPIRIT_HEROIC = 73582, + SPELL_EXPLOSION = 73576, - // Shambling Horror - SPELL_SHOCKWAVE = 72149, - SPELL_ENRAGE = 72143, - SPELL_FRENZY = 28747, + // Shambling Horror + SPELL_SHOCKWAVE = 72149, + SPELL_ENRAGE = 72143, + SPELL_FRENZY = 28747, }; #define NECROTIC_PLAGUE_LK RAID_MODE(70337, 73912, 73913, 73914) @@ -179,119 +179,119 @@ enum Spells enum Events { - EVENT_NONE, + EVENT_NONE, - // Intro - EVENT_INTRO_LK_MOVE, - EVENT_INTRO_LK_TALK_1, - EVENT_INTRO_LK_EMOTE_CAST_SHOUT, - EVENT_INTRO_LK_EMOTE_1, - EVENT_INTRO_LK_CAST_FREEZE, - EVENT_INTRO_FORDRING_TALK_1, - EVENT_INTRO_FORDRING_TALK_2, - EVENT_INTRO_FORDRING_EMOTE_1, - EVENT_INTRO_FORDRING_CHARGE, - EVENT_INTRO_FINISH, + // Intro + EVENT_INTRO_LK_MOVE, + EVENT_INTRO_LK_TALK_1, + EVENT_INTRO_LK_EMOTE_CAST_SHOUT, + EVENT_INTRO_LK_EMOTE_1, + EVENT_INTRO_LK_CAST_FREEZE, + EVENT_INTRO_FORDRING_TALK_1, + EVENT_INTRO_FORDRING_TALK_2, + EVENT_INTRO_FORDRING_EMOTE_1, + EVENT_INTRO_FORDRING_CHARGE, + EVENT_INTRO_FINISH, - // Outro - EVENT_OUTRO_LK_TALK_1, - EVENT_OUTRO_LK_TALK_2, - EVENT_OUTRO_LK_EMOTE_TALK, - EVENT_OUTRO_LK_TALK_3, - EVENT_OUTRO_LK_EMOTE_CAST_SHOUT, - EVENT_OUTRO_LK_MOVE_CENTER, - EVENT_OUTRO_LK_TALK_4, - EVENT_OUTRO_LK_RAISE_DEAD, - EVENT_OUTRO_LK_TALK_5, - EVENT_OUTRO_LK_TALK_6, - EVENT_OUTRO_LK_TALK_7, - EVENT_OUTRO_LK_TALK_8, - EVENT_OUTRO_FORDRING_TALK_1, - EVENT_OUTRO_FORDRING_BLESS, - EVENT_OUTRO_FORDRING_REMOVE_ICE, - EVENT_OUTRO_FORDRING_MOVE_1, - EVENT_OUTRO_FORDRING_JUMP, - EVENT_OUTRO_AFTER_SUMMON_BROKEN_FROSTMOURNE, - EVENT_OUTRO_KNOCK_BACK, - EVENT_OUTRO_SOUL_BARRAGE, - EVENT_OUTRO_AFTER_SOUL_BARRAGE, - EVENT_OUTRO_SUMMON_TERENAS, - EVENT_OUTRO_TERENAS_TALK_1, - EVENT_OUTRO_TERENAS_TALK_2, + // Outro + EVENT_OUTRO_LK_TALK_1, + EVENT_OUTRO_LK_TALK_2, + EVENT_OUTRO_LK_EMOTE_TALK, + EVENT_OUTRO_LK_TALK_3, + EVENT_OUTRO_LK_EMOTE_CAST_SHOUT, + EVENT_OUTRO_LK_MOVE_CENTER, + EVENT_OUTRO_LK_TALK_4, + EVENT_OUTRO_LK_RAISE_DEAD, + EVENT_OUTRO_LK_TALK_5, + EVENT_OUTRO_LK_TALK_6, + EVENT_OUTRO_LK_TALK_7, + EVENT_OUTRO_LK_TALK_8, + EVENT_OUTRO_FORDRING_TALK_1, + EVENT_OUTRO_FORDRING_BLESS, + EVENT_OUTRO_FORDRING_REMOVE_ICE, + EVENT_OUTRO_FORDRING_MOVE_1, + EVENT_OUTRO_FORDRING_JUMP, + EVENT_OUTRO_AFTER_SUMMON_BROKEN_FROSTMOURNE, + EVENT_OUTRO_KNOCK_BACK, + EVENT_OUTRO_SOUL_BARRAGE, + EVENT_OUTRO_AFTER_SOUL_BARRAGE, + EVENT_OUTRO_SUMMON_TERENAS, + EVENT_OUTRO_TERENAS_TALK_1, + EVENT_OUTRO_TERENAS_TALK_2, - // General - EVENT_BERSERK, - EVENT_START_ATTACK, - EVENT_QUAKE, - EVENT_QUAKE_2, + // General + EVENT_BERSERK, + EVENT_START_ATTACK, + EVENT_QUAKE, + EVENT_QUAKE_2, - // Combat - EVENT_SUMMON_SHAMBLING_HORROR, - EVENT_SUMMON_DRUDGE_GHOUL, - EVENT_INFEST, - EVENT_NECROTIC_PLAGUE, - EVENT_SHADOW_TRAP, - EVENT_PAIN_AND_SUFFERING, - EVENT_SUMMON_ICE_SPHERE, - EVENT_SUMMON_RAGING_SPIRIT, - EVENT_DEFILE, - EVENT_SOUL_REAPER, - EVENT_SUMMON_VALKYR, - EVENT_VILE_SPIRITS, - EVENT_HARVEST_SOUL, - EVENT_HARVEST_SOULS, - EVENT_FROSTMOURNE_HEROIC, + // Combat + EVENT_SUMMON_SHAMBLING_HORROR, + EVENT_SUMMON_DRUDGE_GHOUL, + EVENT_INFEST, + EVENT_NECROTIC_PLAGUE, + EVENT_SHADOW_TRAP, + EVENT_PAIN_AND_SUFFERING, + EVENT_SUMMON_ICE_SPHERE, + EVENT_SUMMON_RAGING_SPIRIT, + EVENT_DEFILE, + EVENT_SOUL_REAPER, + EVENT_SUMMON_VALKYR, + EVENT_VILE_SPIRITS, + EVENT_HARVEST_SOUL, + EVENT_HARVEST_SOULS, + EVENT_FROSTMOURNE_HEROIC, - // Shambling Horror - EVENT_SHOCKWAVE, - EVENT_ENRAGE, + // Shambling Horror + EVENT_SHOCKWAVE, + EVENT_ENRAGE, - // Raging Spirit - EVENT_SOUL_SHRIEK, - EVENT_RAGING_SPIRIT_UNROOT, + // Raging Spirit + EVENT_SOUL_SHRIEK, + EVENT_RAGING_SPIRIT_UNROOT, - // Val'kyr Shadowguard - EVENT_GRAB_PLAYER, - EVENT_MOVE_TO_DROP_POS, - EVENT_MOVE_TO_SIPHON_POS, - EVENT_LIFE_SIPHON, + // Val'kyr Shadowguard + EVENT_GRAB_PLAYER, + EVENT_MOVE_TO_DROP_POS, + EVENT_MOVE_TO_SIPHON_POS, + EVENT_LIFE_SIPHON, - // Strangulate Vehicle (Harvest Soul) - EVENT_TELEPORT, - EVENT_MOVE_TO_LICH_KING, - EVENT_DESPAWN_SELF, + // Strangulate Vehicle (Harvest Soul) + EVENT_TELEPORT, + EVENT_MOVE_TO_LICH_KING, + EVENT_DESPAWN_SELF, - // Inside Frostmourne - EVENT_FROSTMOURNE_TALK_1, - EVENT_FROSTMOURNE_TALK_2, - EVENT_FROSTMOURNE_TALK_3, - EVENT_DESTROY_SOUL, - EVENT_TELEPORT_BACK, - EVENT_SOUL_RIP, + // Inside Frostmourne + EVENT_FROSTMOURNE_TALK_1, + EVENT_FROSTMOURNE_TALK_2, + EVENT_FROSTMOURNE_TALK_3, + EVENT_DESTROY_SOUL, + EVENT_TELEPORT_BACK, + EVENT_SOUL_RIP, }; enum EventGroups { - EVENT_GROUP_NONE, - EVENT_GROUP_ABILITIES, - EVENT_GROUP_BERSERK, - EVENT_GROUP_VILE_SPIRITS, + EVENT_GROUP_NONE, + EVENT_GROUP_ABILITIES, + EVENT_GROUP_BERSERK, + EVENT_GROUP_VILE_SPIRITS, }; enum Phases { - PHASE_NONE = 0, - PHASE_INTRO = 1, - PHASE_ONE = 2, - PHASE_TWO = 3, - PHASE_THREE = 4, - PHASE_TRANSITION = 5, - PHASE_FROSTMOURNE = 6, // only set on heroic mode when all players are sent into frostmourne - PHASE_OUTRO = 7, + PHASE_NONE = 0, + PHASE_INTRO = 1, + PHASE_ONE = 2, + PHASE_TWO = 3, + PHASE_THREE = 4, + PHASE_TRANSITION = 5, + PHASE_FROSTMOURNE = 6, // only set on heroic mode when all players are sent into frostmourne + PHASE_OUTRO = 7, - PHASE_MASK_NO_CAST_CHECK = (1 << PHASE_TRANSITION) | (1 << PHASE_FROSTMOURNE) | (1 << PHASE_OUTRO), - PHASE_MASK_NO_VICTIM = (1 << PHASE_INTRO) | (1 << PHASE_OUTRO) | (1 << PHASE_FROSTMOURNE), + PHASE_MASK_NO_CAST_CHECK = (1 << PHASE_TRANSITION) | (1 << PHASE_FROSTMOURNE) | (1 << PHASE_OUTRO), + PHASE_MASK_NO_VICTIM = (1 << PHASE_INTRO) | (1 << PHASE_OUTRO) | (1 << PHASE_FROSTMOURNE), }; Position const CenterPosition = {503.6282f, -2124.655f, 840.8569f, 0.0f}; @@ -306,37 +306,37 @@ Position const SpiritWardenSpawn = {495.3406f, -2529.983f, 1050.000f, 1.5592f}; enum MovePoints { - POINT_NONE, - POINT_CENTER_1, - POINT_CENTER_2, - POINT_TIRION_INTRO, - POINT_TIRION_OUTRO, - POINT_DROP_PLAYER, - POINT_START_SIPHON, - POINT_GROUND, + POINT_NONE, + POINT_CENTER_1, + POINT_CENTER_2, + POINT_TIRION_INTRO, + POINT_TIRION_OUTRO, + POINT_DROP_PLAYER, + POINT_START_SIPHON, + POINT_GROUND, }; enum EncounterActions { - ACTION_NONE, - ACTION_START_ATTACK, - ACTION_OUTRO, - ACTION_BREAK_FROSTMOURNE, - ACTION_TELEPORT_BACK, + ACTION_NONE, + ACTION_START_ATTACK, + ACTION_OUTRO, + ACTION_BREAK_FROSTMOURNE, + ACTION_TELEPORT_BACK, }; enum MiscData { - LIGHT_SNOWSTORM = 2490, - LIGHT_SOULSTORM = 2508, - MUSIC_FROZEN_THRONE = 17457, - MUSIC_SPECIAL = 17458, // Summon Shambling Horror, Remorseless Winter, Quake, Summon Val'kyr Periodic, Harvest Soul, Vile Spirits - MUSIC_FURY_OF_FROSTMOURNE = 17459, - MUSIC_FINAL = 17460, // Raise Dead, Light's Blessing - SOUND_PAIN = 17360, // separate sound, not attached to any text - EQUIP_ASHBRINGER_GLOWING = 50442, - EQUIP_BROKEN_FROSTMOURNE = 50840, - MOVIE_FALL_OF_THE_LICH_KING = 16, + LIGHT_SNOWSTORM = 2490, + LIGHT_SOULSTORM = 2508, + MUSIC_FROZEN_THRONE = 17457, + MUSIC_SPECIAL = 17458, // Summon Shambling Horror, Remorseless Winter, Quake, Summon Val'kyr Periodic, Harvest Soul, Vile Spirits + MUSIC_FURY_OF_FROSTMOURNE = 17459, + MUSIC_FINAL = 17460, // Raise Dead, Light's Blessing + SOUND_PAIN = 17360, // separate sound, not attached to any text + EQUIP_ASHBRINGER_GLOWING = 50442, + EQUIP_BROKEN_FROSTMOURNE = 50840, + MOVIE_FALL_OF_THE_LICH_KING = 16, }; #define DATA_PLAGUE_STACK 70337 @@ -344,3449 +344,3449 @@ enum MiscData bool IsValidPlatformTarget(Unit const* target) { - return target->GetExactDist2dSq(&CenterPosition) < 90.0f*90.0f && target->GetPositionZ() > 840.0f && target->GetPositionZ() < 875.0f; + return target->GetExactDist2dSq(&CenterPosition) < 90.0f*90.0f && target->GetPositionZ() > 840.0f && target->GetPositionZ() < 875.0f; } void SendPacketToPlayers(WorldPacket const* data, Unit* source) { - // Send packet to all players in The Frozen Throne - Map::PlayerList const& players = source->GetMap()->GetPlayers(); - if (!players.isEmpty()) - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player* player = itr->GetSource()) - if (player->GetAreaId() == AREA_THE_FROZEN_THRONE) - player->GetSession()->SendPacket(data); + // Send packet to all players in The Frozen Throne + Map::PlayerList const& players = source->GetMap()->GetPlayers(); + if (!players.isEmpty()) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->GetSource()) + if (player->GetAreaId() == AREA_THE_FROZEN_THRONE) + player->GetSession()->SendPacket(data); } struct NonTankLKTargetSelector : public std::unary_function { public: - NonTankLKTargetSelector(Creature* source, bool playerOnly = true, bool reqLOS = false, float maxDist = 0.0f, uint32 exclude1 = 0, uint32 exclude2 = 0) : _source(source), _playerOnly(playerOnly), _reqLOS(reqLOS), _maxDist(maxDist), _exclude1(exclude1), _exclude2(exclude2) { } - bool operator()(Unit const* target) const - { - if (!target) - return false; - if (!target->IsAlive()) - return false; - if (_playerOnly && target->GetTypeId() != TYPEID_PLAYER) - return false; - if (target == _source->GetVictim()) - return false; - if (target->HasAura(SPELL_BOSS_HITTIN_YA_AURA)) - return false; - if (_maxDist && _source->GetExactDist(target) > _maxDist) - return false; - if (_exclude1 && target->HasAura(_exclude1) || _exclude2 && target->HasAura(_exclude2)) - return false; - if (_reqLOS && !_source->IsWithinLOSInMap(target)) - return false; - return true; - } + NonTankLKTargetSelector(Creature* source, bool playerOnly = true, bool reqLOS = false, float maxDist = 0.0f, uint32 exclude1 = 0, uint32 exclude2 = 0) : _source(source), _playerOnly(playerOnly), _reqLOS(reqLOS), _maxDist(maxDist), _exclude1(exclude1), _exclude2(exclude2) { } + bool operator()(Unit const* target) const + { + if (!target) + return false; + if (!target->IsAlive()) + return false; + if (_playerOnly && target->GetTypeId() != TYPEID_PLAYER) + return false; + if (target == _source->GetVictim()) + return false; + if (target->HasAura(SPELL_BOSS_HITTIN_YA_AURA)) + return false; + if (_maxDist && _source->GetExactDist(target) > _maxDist) + return false; + if (_exclude1 && target->HasAura(_exclude1) || _exclude2 && target->HasAura(_exclude2)) + return false; + if (_reqLOS && !_source->IsWithinLOSInMap(target)) + return false; + return true; + } private: - Creature const* _source; - bool _playerOnly; - bool _reqLOS; - float _maxDist; - uint32 _exclude1; - uint32 _exclude2; + Creature const* _source; + bool _playerOnly; + bool _reqLOS; + float _maxDist; + uint32 _exclude1; + uint32 _exclude2; }; struct DefileTargetSelector : public std::unary_function { public: - DefileTargetSelector(Creature* source) : _source(source) { } - bool operator()(Unit const* target) const - { - if (!target) - return false; - if (!target->IsAlive()) - return false; - if (target->GetTypeId() != TYPEID_PLAYER) - return false; - if (_source->GetExactDist(target) > 100.0f) - return false; - if (target->HasAura(SPELL_HARVEST_SOUL_VALKYR) || target->HasAura(SPELL_VALKYR_TARGET_SEARCH)) - return false; - if (!_source->IsWithinLOSInMap(target)) - return false; - return true; - } + DefileTargetSelector(Creature* source) : _source(source) { } + bool operator()(Unit const* target) const + { + if (!target) + return false; + if (!target->IsAlive()) + return false; + if (target->GetTypeId() != TYPEID_PLAYER) + return false; + if (_source->GetExactDist(target) > 100.0f) + return false; + if (target->HasAura(SPELL_HARVEST_SOUL_VALKYR) || target->HasAura(SPELL_VALKYR_TARGET_SEARCH)) + return false; + if (!_source->IsWithinLOSInMap(target)) + return false; + return true; + } private: - Creature const* _source; + Creature const* _source; }; class FrozenThroneResetWorker { - public: - FrozenThroneResetWorker() { } + public: + FrozenThroneResetWorker() { } - bool operator()(GameObject* go) - { - switch (go->GetEntry()) - { - case GO_ARTHAS_PLATFORM: - go->SetDestructibleState(GO_DESTRUCTIBLE_INTACT, NULL, true); - break; - case GO_DOODAD_ICECROWN_THRONEFROSTYWIND01: - go->SetGoState(GO_STATE_ACTIVE); - break; - case GO_DOODAD_ICECROWN_THRONEFROSTYEDGE01: - go->SetGoState(GO_STATE_READY); - break; - case GO_DOODAD_ICECROWN_SNOWEDGEWARNING01: - go->SetGoState(GO_STATE_READY); - break; - case GO_DOODAD_ICESHARD_STANDING02: - case GO_DOODAD_ICESHARD_STANDING01: - case GO_DOODAD_ICESHARD_STANDING03: - case GO_DOODAD_ICESHARD_STANDING04: - go->ResetDoorOrButton(); - break; - default: - break; - } + bool operator()(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_ARTHAS_PLATFORM: + go->SetDestructibleState(GO_DESTRUCTIBLE_INTACT, NULL, true); + break; + case GO_DOODAD_ICECROWN_THRONEFROSTYWIND01: + go->SetGoState(GO_STATE_ACTIVE); + break; + case GO_DOODAD_ICECROWN_THRONEFROSTYEDGE01: + go->SetGoState(GO_STATE_READY); + break; + case GO_DOODAD_ICECROWN_SNOWEDGEWARNING01: + go->SetGoState(GO_STATE_READY); + break; + case GO_DOODAD_ICESHARD_STANDING02: + case GO_DOODAD_ICESHARD_STANDING01: + case GO_DOODAD_ICESHARD_STANDING03: + case GO_DOODAD_ICESHARD_STANDING04: + go->ResetDoorOrButton(); + break; + default: + break; + } - return false; - } + return false; + } }; class StartMovementEvent : public BasicEvent { - public: - StartMovementEvent(Creature* summoner, Creature* owner) : _summoner(summoner), _owner(owner) {} + public: + StartMovementEvent(Creature* summoner, Creature* owner) : _summoner(summoner), _owner(owner) {} - bool Execute(uint64 /*time*/, uint32 /*diff*/) - { - _owner->SetReactState(REACT_AGGRESSIVE); - if (!_owner->getThreatManager().isThreatListEmpty()) - if (Unit* target = _owner->SelectVictim()) - _owner->AI()->AttackStart(target); - if (!_owner->GetVictim()) - if (Unit* target = _summoner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankLKTargetSelector(_summoner))) - _owner->AI()->AttackStart(target); - _owner->AI()->DoZoneInCombat(); - return true; - } + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _owner->SetReactState(REACT_AGGRESSIVE); + if (!_owner->getThreatManager().isThreatListEmpty()) + if (Unit* target = _owner->SelectVictim()) + _owner->AI()->AttackStart(target); + if (!_owner->GetVictim()) + if (Unit* target = _summoner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankLKTargetSelector(_summoner))) + _owner->AI()->AttackStart(target); + _owner->AI()->DoZoneInCombat(); + return true; + } - private: - Creature* _summoner; - Creature* _owner; + private: + Creature* _summoner; + Creature* _owner; }; class VileSpiritActivateEvent : public BasicEvent { - public: - explicit VileSpiritActivateEvent(Creature* owner) : _owner(owner) {} + public: + explicit VileSpiritActivateEvent(Creature* owner) : _owner(owner) {} - bool Execute(uint64 /*time*/, uint32 /*diff*/) - { - _owner->SetReactState(REACT_AGGRESSIVE); - _owner->CastSpell(_owner, SPELL_VILE_SPIRIT_MOVE_SEARCH, true); - _owner->CastSpell((Unit*)NULL, SPELL_VILE_SPIRIT_DAMAGE_SEARCH, true); - return true; - } + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _owner->SetReactState(REACT_AGGRESSIVE); + _owner->CastSpell(_owner, SPELL_VILE_SPIRIT_MOVE_SEARCH, true); + _owner->CastSpell((Unit*)NULL, SPELL_VILE_SPIRIT_DAMAGE_SEARCH, true); + return true; + } - private: - Creature* _owner; + private: + Creature* _owner; }; class TriggerWickedSpirit : public BasicEvent { - public: - explicit TriggerWickedSpirit(Creature* owner) - : _owner(owner), _counter(13) - { - } + public: + explicit TriggerWickedSpirit(Creature* owner) + : _owner(owner), _counter(13) + { + } - bool Execute(uint64 /*time*/, uint32 /*diff*/) - { - _owner->CastCustomSpell(SPELL_TRIGGER_VILE_SPIRIT_HEROIC, SPELLVALUE_MAX_TARGETS, 1, NULL, true); + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _owner->CastCustomSpell(SPELL_TRIGGER_VILE_SPIRIT_HEROIC, SPELLVALUE_MAX_TARGETS, 1, NULL, true); - if (--_counter) - { - _owner->m_Events.AddEvent(this, _owner->m_Events.CalculateTime(3000)); - return false; - } + if (--_counter) + { + _owner->m_Events.AddEvent(this, _owner->m_Events.CalculateTime(3000)); + return false; + } - return true; - } + return true; + } - private: - Creature* _owner; - uint32 _counter; + private: + Creature* _owner; + uint32 _counter; }; class LichKingDeathEvent : public BasicEvent { public: - LichKingDeathEvent(Creature& owner) : _owner(owner) { } + LichKingDeathEvent(Creature& owner) : _owner(owner) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - _owner.RemoveAllAuras(); - Unit::Kill(&_owner, &_owner); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + _owner.RemoveAllAuras(); + Unit::Kill(&_owner, &_owner); + return true; + } private: - Creature& _owner; + Creature& _owner; }; class LichKingMovieEvent : public BasicEvent { public: - LichKingMovieEvent(Creature& owner) : _owner(owner) { } + LichKingMovieEvent(Creature& owner) : _owner(owner) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - _owner.CastSpell((Unit*)NULL, SPELL_PLAY_MOVIE, false); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + _owner.CastSpell((Unit*)NULL, SPELL_PLAY_MOVIE, false); + return true; + } private: - Creature& _owner; + Creature& _owner; }; class NecroticPlagueTargetCheck : public std::unary_function { - public: - NecroticPlagueTargetCheck(Unit const* obj, uint32 notAura1, uint32 notAura2) : _sourceObj(obj), _notAura1(notAura1), _notAura2(notAura2) {} + public: + NecroticPlagueTargetCheck(Unit const* obj, uint32 notAura1, uint32 notAura2) : _sourceObj(obj), _notAura1(notAura1), _notAura2(notAura2) {} - bool operator()(Unit* unit) const - { - if (!unit || unit->GetTypeId() != TYPEID_PLAYER || unit == _sourceObj || _sourceObj->GetVictim() == unit || !unit->isTargetableForAttack()) - return false; - if (unit->HasAura(SPELL_PLAGUE_AVOIDANCE) || unit->HasAura(SPELL_BOSS_HITTIN_YA_AURA) || unit->HasAura(_notAura1) || unit->HasAura(_notAura2)) - return false; - if (!_sourceObj->IsWithinLOSInMap(unit)) - return false; - return true; - } + bool operator()(Unit* unit) const + { + if (!unit || unit->GetTypeId() != TYPEID_PLAYER || unit == _sourceObj || _sourceObj->GetVictim() == unit || !unit->isTargetableForAttack()) + return false; + if (unit->HasAura(SPELL_PLAGUE_AVOIDANCE) || unit->HasAura(SPELL_BOSS_HITTIN_YA_AURA) || unit->HasAura(_notAura1) || unit->HasAura(_notAura2)) + return false; + if (!_sourceObj->IsWithinLOSInMap(unit)) + return false; + return true; + } - private: - Unit const* _sourceObj; - uint32 _notAura1; - uint32 _notAura2; + private: + Unit const* _sourceObj; + uint32 _notAura1; + uint32 _notAura2; }; class HeightDifferenceCheck { - public: - HeightDifferenceCheck(GameObject* go, float diff, bool reverse) : _baseObject(go), _difference(diff), _reverse(reverse) {} - bool operator()(WorldObject* unit) const { return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse; } - private: - GameObject* _baseObject; - float _difference; - bool _reverse; + public: + HeightDifferenceCheck(GameObject* go, float diff, bool reverse) : _baseObject(go), _difference(diff), _reverse(reverse) {} + bool operator()(WorldObject* unit) const { return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse; } + private: + GameObject* _baseObject; + float _difference; + bool _reverse; }; class boss_the_lich_king : public CreatureScript { - public: - boss_the_lich_king() : CreatureScript("boss_the_lich_king") { } + public: + boss_the_lich_king() : CreatureScript("boss_the_lich_king") { } - struct boss_the_lich_kingAI : public BossAI - { - boss_the_lich_kingAI(Creature* creature) : BossAI(creature, DATA_THE_LICH_KING) - { - me->AddAura(SPELL_EMOTE_SIT_NO_SHEATH, me); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_PASSIVE); - } + struct boss_the_lich_kingAI : public BossAI + { + boss_the_lich_kingAI(Creature* creature) : BossAI(creature, DATA_THE_LICH_KING) + { + me->AddAura(SPELL_EMOTE_SIT_NO_SHEATH, me); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetReactState(REACT_PASSIVE); + } - uint8 _phase; - uint32 _necroticPlagueStack; - uint32 _vileSpiritExplosions; - uint16 _positionCheckTimer; - uint32 _lastTalkTimeKill; - uint32 _lastTalkTimeBuff; - bool _bFrostmournePhase; - bool _bFordringMustFallYell; + uint8 _phase; + uint32 _necroticPlagueStack; + uint32 _vileSpiritExplosions; + uint16 _positionCheckTimer; + uint32 _lastTalkTimeKill; + uint32 _lastTalkTimeBuff; + bool _bFrostmournePhase; + bool _bFordringMustFallYell; - void Reset() - { - _phase = PHASE_NONE; - _necroticPlagueStack = 0; - _vileSpiritExplosions = 0; - _positionCheckTimer = 5000; - _lastTalkTimeKill = 0; - _lastTalkTimeBuff = 0; - _bFrostmournePhase = false; - _bFordringMustFallYell = false; + void Reset() + { + _phase = PHASE_NONE; + _necroticPlagueStack = 0; + _vileSpiritExplosions = 0; + _positionCheckTimer = 5000; + _lastTalkTimeKill = 0; + _lastTalkTimeBuff = 0; + _bFrostmournePhase = false; + _bFordringMustFallYell = false; - _Reset(); - DoAction(ACTION_RESTORE_LIGHT); - SetEquipmentSlots(true); - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) - me->SetStandState(UNIT_STAND_STATE_SIT); - } + _Reset(); + DoAction(ACTION_RESTORE_LIGHT); + SetEquipmentSlots(true); + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) + me->SetStandState(UNIT_STAND_STATE_SIT); + } - void JustDied(Unit* /*killer*/) - { - _JustDied(); - DoAction(ACTION_RESTORE_LIGHT); - me->PlayDirectSound(17374); - } + void JustDied(Unit* /*killer*/) + { + _JustDied(); + DoAction(ACTION_RESTORE_LIGHT); + me->PlayDirectSound(17374); + } - void EnterCombat(Unit* target) - { - if (!instance->CheckRequiredBosses(DATA_THE_LICH_KING, target->ToPlayer()) || !me->IsVisible()) - { - EnterEvadeMode(); - instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); - return; - } + void EnterCombat(Unit* target) + { + if (!instance->CheckRequiredBosses(DATA_THE_LICH_KING, target->ToPlayer()) || !me->IsVisible()) + { + EnterEvadeMode(); + instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); + return; + } - _phase = PHASE_ONE; - instance->SetBossState(DATA_THE_LICH_KING, IN_PROGRESS); - me->setActive(true); - me->SetInCombatWithZone(); - me->RemoveAurasDueToSpell(SPELL_EMOTE_SIT_NO_SHEATH); // just to be sure + _phase = PHASE_ONE; + instance->SetBossState(DATA_THE_LICH_KING, IN_PROGRESS); + me->setActive(true); + me->SetInCombatWithZone(); + me->RemoveAurasDueToSpell(SPELL_EMOTE_SIT_NO_SHEATH); // just to be sure - events.ScheduleEvent(EVENT_BERSERK, 900000, EVENT_GROUP_BERSERK); - events.ScheduleEvent(EVENT_SUMMON_SHAMBLING_HORROR, 15000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SUMMON_DRUDGE_GHOUL, 10000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_INFEST, 5000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_NECROTIC_PLAGUE, urand(30000, 31000), EVENT_GROUP_ABILITIES); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SHADOW_TRAP, 15500, EVENT_GROUP_ABILITIES); - } + events.ScheduleEvent(EVENT_BERSERK, 900000, EVENT_GROUP_BERSERK); + events.ScheduleEvent(EVENT_SUMMON_SHAMBLING_HORROR, 15000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SUMMON_DRUDGE_GHOUL, 10000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_INFEST, 5000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_NECROTIC_PLAGUE, urand(30000, 31000), EVENT_GROUP_ABILITIES); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SHADOW_TRAP, 15500, EVENT_GROUP_ABILITIES); + } - void JustReachedHome() - { - _JustReachedHome(); - DoAction(ACTION_RESTORE_LIGHT); + void JustReachedHome() + { + _JustReachedHome(); + DoAction(ACTION_RESTORE_LIGHT); - // Reset The Frozen Throne gameobjects - FrozenThroneResetWorker reset; - Trinity::GameObjectWorker worker(me, reset); - me->VisitNearbyGridObject(333.0f, worker); + // Reset The Frozen Throne gameobjects + FrozenThroneResetWorker reset; + Trinity::GameObjectWorker worker(me, reset); + me->VisitNearbyGridObject(333.0f, worker); - me->AddAura(SPELL_EMOTE_SIT_NO_SHEATH, me); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_PASSIVE); - me->SetStandState(UNIT_STAND_STATE_SIT); + me->AddAura(SPELL_EMOTE_SIT_NO_SHEATH, me); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetReactState(REACT_PASSIVE); + me->SetStandState(UNIT_STAND_STATE_SIT); - } + } - bool CanAIAttack(Unit const* target) const - { - return me->IsVisible() && IsValidPlatformTarget(target) && !target->GetVehicle(); - } + bool CanAIAttack(Unit const* target) const + { + return me->IsVisible() && IsValidPlatformTarget(target) && !target->GetVehicle(); + } - /*bool CanBeSeen(Player const* p) - { - return me->GetExactDistSq(p) < 200.0f*200.0f; - }*/ + /*bool CanBeSeen(Player const* p) + { + return me->GetExactDistSq(p) < 200.0f*200.0f; + }*/ - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill+5 < time(NULL)) - { - _lastTalkTimeKill = time(NULL); - Talk(SAY_LK_KILL); - } - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill+5 < time(NULL)) + { + _lastTalkTimeKill = time(NULL); + Talk(SAY_LK_KILL); + } + } - void DoAction(int32 action) - { - switch (action) - { - case ACTION_RESTORE_LIGHT: - me->GetMap()->SetZoneOverrideLight(AREA_THE_FROZEN_THRONE, 0, 5000); - me->GetMap()->SetZoneWeather(AREA_THE_FROZEN_THRONE, WEATHER_STATE_FINE, 0.5f); - break; - case ACTION_START_ATTACK: - events.ScheduleEvent(EVENT_START_ATTACK, 5250); - break; - case ACTION_BREAK_FROSTMOURNE: - me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE, true); - me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE_2, false); - SetEquipmentSlots(false, EQUIP_BROKEN_FROSTMOURNE); - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) - tirion->AI()->DoAction(ACTION_BREAK_FROSTMOURNE); - break; - case ACTION_TELEPORT_BACK: - { - if (_phase == PHASE_FROSTMOURNE) - events.RescheduleEvent(EVENT_START_ATTACK, 1000); - EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE); - summons.DoAction(ACTION_TELEPORT_BACK, pred); - if (!IsHeroic() && _phase != PHASE_OUTRO && me->IsInCombat() && _lastTalkTimeBuff+5 <= time(NULL)) - Talk(SAY_LK_FROSTMOURNE_ESCAPE); - } - break; - default: - break; - } - } + void DoAction(int32 action) + { + switch (action) + { + case ACTION_RESTORE_LIGHT: + me->GetMap()->SetZoneOverrideLight(AREA_THE_FROZEN_THRONE, 0, 5000); + me->GetMap()->SetZoneWeather(AREA_THE_FROZEN_THRONE, WEATHER_STATE_FINE, 0.5f); + break; + case ACTION_START_ATTACK: + events.ScheduleEvent(EVENT_START_ATTACK, 5250); + break; + case ACTION_BREAK_FROSTMOURNE: + me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE, true); + me->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE_2, false); + SetEquipmentSlots(false, EQUIP_BROKEN_FROSTMOURNE); + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + tirion->AI()->DoAction(ACTION_BREAK_FROSTMOURNE); + break; + case ACTION_TELEPORT_BACK: + { + if (_phase == PHASE_FROSTMOURNE) + events.RescheduleEvent(EVENT_START_ATTACK, 1000); + EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE); + summons.DoAction(ACTION_TELEPORT_BACK, pred); + if (!IsHeroic() && _phase != PHASE_OUTRO && me->IsInCombat() && _lastTalkTimeBuff+5 <= time(NULL)) + Talk(SAY_LK_FROSTMOURNE_ESCAPE); + } + break; + default: + break; + } + } - void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (!attacker || (_bFrostmournePhase && attacker->GetExactDistSq(495.708f, -2523.76f, 1049.95f) > 40.0f*40.0f)) // frostmourne room, prevent exploiting (tele hack to get back and damage him) - { - damage = 0; - return; - } + void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (!attacker || (_bFrostmournePhase && attacker->GetExactDistSq(495.708f, -2523.76f, 1049.95f) > 40.0f*40.0f)) // frostmourne room, prevent exploiting (tele hack to get back and damage him) + { + damage = 0; + return; + } - if (_phase == PHASE_ONE && !HealthAbovePct(70) && !me->HasUnitState(UNIT_STATE_CASTING)) - { - _phase = PHASE_TRANSITION; - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - events.CancelEventGroup(EVENT_GROUP_ABILITIES); - me->InterruptNonMeleeSpells(false); - me->GetMotionMaster()->MovePoint(POINT_CENTER_1, CenterPosition); - return; - } + if (_phase == PHASE_ONE && !HealthAbovePct(70) && !me->HasUnitState(UNIT_STATE_CASTING)) + { + _phase = PHASE_TRANSITION; + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + events.CancelEventGroup(EVENT_GROUP_ABILITIES); + me->InterruptNonMeleeSpells(false); + me->GetMotionMaster()->MovePoint(POINT_CENTER_1, CenterPosition); + return; + } - if (_phase == PHASE_TWO && !HealthAbovePct(40) && !me->HasUnitState(UNIT_STATE_CASTING)) - { - _phase = PHASE_TRANSITION; - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - events.CancelEventGroup(EVENT_GROUP_ABILITIES); - me->InterruptNonMeleeSpells(false); - me->GetMotionMaster()->MovePoint(POINT_CENTER_2, CenterPosition); - return; - } + if (_phase == PHASE_TWO && !HealthAbovePct(40) && !me->HasUnitState(UNIT_STATE_CASTING)) + { + _phase = PHASE_TRANSITION; + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + events.CancelEventGroup(EVENT_GROUP_ABILITIES); + me->InterruptNonMeleeSpells(false); + me->GetMotionMaster()->MovePoint(POINT_CENTER_2, CenterPosition); + return; + } - if (_phase == PHASE_THREE && HealthBelowPct(10) && !me->HasUnitState(UNIT_STATE_CASTING)) - { - _phase = PHASE_OUTRO; - EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE); - summons.DoAction(ACTION_TELEPORT_BACK, pred); - events.Reset(); - summons.DespawnAll(); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_FURY_OF_FROSTMOURNE); - me->InterruptNonMeleeSpells(true); - me->CastSpell((Unit*)NULL, SPELL_FURY_OF_FROSTMOURNE, false); - me->SetWalk(true); + if (_phase == PHASE_THREE && HealthBelowPct(10) && !me->HasUnitState(UNIT_STATE_CASTING)) + { + _phase = PHASE_OUTRO; + EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE); + summons.DoAction(ACTION_TELEPORT_BACK, pred); + events.Reset(); + summons.DespawnAll(); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_FURY_OF_FROSTMOURNE); + me->InterruptNonMeleeSpells(true); + me->CastSpell((Unit*)NULL, SPELL_FURY_OF_FROSTMOURNE, false); + me->SetWalk(true); - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) - tirion->AI()->DoAction(ACTION_OUTRO); - return; - } + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + tirion->AI()->DoAction(ACTION_OUTRO); + return; + } - if (_phase == PHASE_OUTRO) - { - if (!me->HasByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_HOVER)) - damage = me->GetHealth() > 1 ? 1 : 0; - else if (damage >= me->GetHealth()) // dying... - { - damage = me->GetHealth()-1; - me->SetDisableGravity(false); - me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); - me->SendMonsterMove(me->GetPositionX()+0.25f, me->GetPositionY(), 840.86f, 300, SPLINEFLAG_FALLING); - me->m_positionZ = 840.86f; - me->SetOrientation(0.0f); - if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) - frostmourne->DespawnOrUnsummon(1); - if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f)) - terenas->DespawnOrUnsummon(1); + if (_phase == PHASE_OUTRO) + { + if (!me->HasByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_HOVER)) + damage = me->GetHealth() > 1 ? 1 : 0; + else if (damage >= me->GetHealth()) // dying... + { + damage = me->GetHealth()-1; + me->SetDisableGravity(false); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + me->SendMonsterMove(me->GetPositionX()+0.25f, me->GetPositionY(), 840.86f, 300, SPLINEFLAG_FALLING); + me->m_positionZ = 840.86f; + me->SetOrientation(0.0f); + if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) + frostmourne->DespawnOrUnsummon(1); + if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f)) + terenas->DespawnOrUnsummon(1); - me->m_Events.AddEvent(new LichKingDeathEvent(*me), me->m_Events.CalculateTime(2500)); // die after spinning anim is over, so death anim is visible - me->m_Events.AddEvent(new LichKingMovieEvent(*me), me->m_Events.CalculateTime(11500)); - } + me->m_Events.AddEvent(new LichKingDeathEvent(*me), me->m_Events.CalculateTime(2500)); // die after spinning anim is over, so death anim is visible + me->m_Events.AddEvent(new LichKingMovieEvent(*me), me->m_Events.CalculateTime(11500)); + } - if (!_bFordringMustFallYell && me->GetHealth() < 500000) - { - _bFordringMustFallYell = true; - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) - { - tirion->MonsterYell("The Lich King must fall!", LANG_UNIVERSAL, 0); - tirion->PlayDirectSound(17389); - } - } - - } - else if (damage >= me->GetHealth()) - damage = me->GetHealth()-1; - } + if (!_bFordringMustFallYell && me->GetHealth() < 500000) + { + _bFordringMustFallYell = true; + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + { + tirion->MonsterYell("The Lich King must fall!", LANG_UNIVERSAL, 0); + tirion->PlayDirectSound(17389); + } + } + + } + else if (damage >= me->GetHealth()) + damage = me->GetHealth()-1; + } - void JustSummoned(Creature* summon) - { - switch (summon->GetEntry()) - { - case NPC_SHAMBLING_HORROR: - case NPC_DRUDGE_GHOUL: - summon->SetHomePosition(CenterPosition); - summon->CastSpell(summon, SPELL_RISEN_WITCH_DOCTOR_SPAWN, true); - summon->SetReactState(REACT_PASSIVE); - summon->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - summon->m_Events.AddEvent(new StartMovementEvent(me, summon), summon->m_Events.CalculateTime(5000)); - break; - case NPC_RAGING_SPIRIT: - summon->SetHomePosition(CenterPosition); - break; - case NPC_VILE_SPIRIT: - { - summon->SetReactState(REACT_PASSIVE); - summon->GetMotionMaster()->MoveRandom(10.0f); - if (_phase == PHASE_THREE) - summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000)); - break; - } - case NPC_STRANGULATE_VEHICLE: - summons.Summon(summon); - return; - case NPC_DEFILE: - case NPC_SHADOW_TRAP_TRIGGER: - summon->m_positionZ = 840.86f; - summon->UpdatePosition(summon->GetPositionX(), summon->GetPositionY(), summon->GetPositionZ(), summon->GetOrientation(), true); - summon->StopMovingOnCurrentPos(); - break; - case NPC_VALKYR_SHADOWGUARD: - if (_phase == PHASE_THREE || events.GetNextEventTime(EVENT_QUAKE_2)) - summon->DespawnOrUnsummon(1); - break; - default: - break; - } + void JustSummoned(Creature* summon) + { + switch (summon->GetEntry()) + { + case NPC_SHAMBLING_HORROR: + case NPC_DRUDGE_GHOUL: + summon->SetHomePosition(CenterPosition); + summon->CastSpell(summon, SPELL_RISEN_WITCH_DOCTOR_SPAWN, true); + summon->SetReactState(REACT_PASSIVE); + summon->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); + summon->m_Events.AddEvent(new StartMovementEvent(me, summon), summon->m_Events.CalculateTime(5000)); + break; + case NPC_RAGING_SPIRIT: + summon->SetHomePosition(CenterPosition); + break; + case NPC_VILE_SPIRIT: + { + summon->SetReactState(REACT_PASSIVE); + summon->GetMotionMaster()->MoveRandom(10.0f); + if (_phase == PHASE_THREE) + summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000)); + break; + } + case NPC_STRANGULATE_VEHICLE: + summons.Summon(summon); + return; + case NPC_DEFILE: + case NPC_SHADOW_TRAP_TRIGGER: + summon->m_positionZ = 840.86f; + summon->UpdatePosition(summon->GetPositionX(), summon->GetPositionY(), summon->GetPositionZ(), summon->GetOrientation(), true); + summon->StopMovingOnCurrentPos(); + break; + case NPC_VALKYR_SHADOWGUARD: + if (_phase == PHASE_THREE || events.GetNextEventTime(EVENT_QUAKE_2)) + summon->DespawnOrUnsummon(1); + break; + default: + break; + } - BossAI::JustSummoned(summon); - } + BossAI::JustSummoned(summon); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - switch (summon->GetEntry()) - { - case NPC_SHAMBLING_HORROR: - case NPC_DRUDGE_GHOUL: - case NPC_ICE_SPHERE: - case NPC_VALKYR_SHADOWGUARD: - case NPC_RAGING_SPIRIT: - case NPC_VILE_SPIRIT: - summon->ToTempSummon()->SetTimer(5000); - summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_TIMED_DESPAWN); - break; - default: - break; - } - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + switch (summon->GetEntry()) + { + case NPC_SHAMBLING_HORROR: + case NPC_DRUDGE_GHOUL: + case NPC_ICE_SPHERE: + case NPC_VALKYR_SHADOWGUARD: + case NPC_RAGING_SPIRIT: + case NPC_VILE_SPIRIT: + summon->ToTempSummon()->SetTimer(5000); + summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_TIMED_DESPAWN); + break; + default: + break; + } + } - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) - { - if (spell->Id == HARVESTED_SOUL_BUFF && me->IsInCombat() && !IsHeroic() && _phase != PHASE_OUTRO && _lastTalkTimeBuff+5 <= time(NULL)) - { - _lastTalkTimeBuff = time(NULL); - Talk(SAY_LK_FROSTMOURNE_KILL); - } - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == HARVESTED_SOUL_BUFF && me->IsInCombat() && !IsHeroic() && _phase != PHASE_OUTRO && _lastTalkTimeBuff+5 <= time(NULL)) + { + _lastTalkTimeBuff = time(NULL); + Talk(SAY_LK_FROSTMOURNE_KILL); + } + } - void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) - { - if (spell->Id == REMORSELESS_WINTER_1 || spell->Id == REMORSELESS_WINTER_2) - { - me->GetMap()->SetZoneOverrideLight(AREA_THE_FROZEN_THRONE, LIGHT_SNOWSTORM, 5000); - me->GetMap()->SetZoneWeather(AREA_THE_FROZEN_THRONE, WEATHER_STATE_LIGHT_SNOW, 0.5f); - summons.DespawnEntry(NPC_SHADOW_TRAP_TRIGGER); - } - } + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) + { + if (spell->Id == REMORSELESS_WINTER_1 || spell->Id == REMORSELESS_WINTER_2) + { + me->GetMap()->SetZoneOverrideLight(AREA_THE_FROZEN_THRONE, LIGHT_SNOWSTORM, 5000); + me->GetMap()->SetZoneWeather(AREA_THE_FROZEN_THRONE, WEATHER_STATE_LIGHT_SNOW, 0.5f); + summons.DespawnEntry(NPC_SHADOW_TRAP_TRIGGER); + } + } - void MovementInform(uint32 type, uint32 pointId) - { - if (type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 pointId) + { + if (type != POINT_MOTION_TYPE) + return; - switch (pointId) - { - case POINT_CENTER_1: - me->SetFacingTo(0.0f); - Talk(SAY_LK_REMORSELESS_WINTER); - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); - me->CastSpell(me, SPELL_REMORSELESS_WINTER_1, false); - //events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions, bullshit, 15mins on movies - events.ScheduleEvent(EVENT_QUAKE, 62500); - events.ScheduleEvent(EVENT_PAIN_AND_SUFFERING, 3500, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SUMMON_ICE_SPHERE, 8000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SUMMON_RAGING_SPIRIT, 4000, EVENT_GROUP_ABILITIES); - break; - case POINT_CENTER_2: - me->SetFacingTo(0.0f); - Talk(SAY_LK_REMORSELESS_WINTER); - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); - me->CastSpell(me, SPELL_REMORSELESS_WINTER_2, false); - summons.DespawnEntry(NPC_VALKYR_SHADOWGUARD); - //events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions, bullshit, 15 mins on movies - events.ScheduleEvent(EVENT_QUAKE_2, 62500); - events.ScheduleEvent(EVENT_PAIN_AND_SUFFERING, 3500, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SUMMON_ICE_SPHERE, 8000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SUMMON_RAGING_SPIRIT, 4000, EVENT_GROUP_ABILITIES); - break; - default: - break; - } - } + switch (pointId) + { + case POINT_CENTER_1: + me->SetFacingTo(0.0f); + Talk(SAY_LK_REMORSELESS_WINTER); + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); + me->CastSpell(me, SPELL_REMORSELESS_WINTER_1, false); + //events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions, bullshit, 15mins on movies + events.ScheduleEvent(EVENT_QUAKE, 62500); + events.ScheduleEvent(EVENT_PAIN_AND_SUFFERING, 3500, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SUMMON_ICE_SPHERE, 8000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SUMMON_RAGING_SPIRIT, 4000, EVENT_GROUP_ABILITIES); + break; + case POINT_CENTER_2: + me->SetFacingTo(0.0f); + Talk(SAY_LK_REMORSELESS_WINTER); + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); + me->CastSpell(me, SPELL_REMORSELESS_WINTER_2, false); + summons.DespawnEntry(NPC_VALKYR_SHADOWGUARD); + //events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions, bullshit, 15 mins on movies + events.ScheduleEvent(EVENT_QUAKE_2, 62500); + events.ScheduleEvent(EVENT_PAIN_AND_SUFFERING, 3500, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SUMMON_ICE_SPHERE, 8000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SUMMON_RAGING_SPIRIT, 4000, EVENT_GROUP_ABILITIES); + break; + default: + break; + } + } - void UpdateAI(uint32 diff) - { - if (_phase == PHASE_NONE) - return; + void UpdateAI(uint32 diff) + { + if (_phase == PHASE_NONE) + return; - // check phase first to prevent updating victim and entering evade mode when not wanted - if (!((1 << _phase) & PHASE_MASK_NO_VICTIM)) - if (!UpdateVictim()) - return; + // check phase first to prevent updating victim and entering evade mode when not wanted + if (!((1 << _phase) & PHASE_MASK_NO_VICTIM)) + if (!UpdateVictim()) + return; - // handle falling players so they don't fall infinitely - if (_positionCheckTimer <= diff) - { - _positionCheckTimer = 5000; - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (!players.isEmpty()) - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player* player = itr->GetSource()) - if (player->GetPositionZ() < 700.0f) - Unit::Kill(me, player); - } - else - _positionCheckTimer -= diff; + // handle falling players so they don't fall infinitely + if (_positionCheckTimer <= diff) + { + _positionCheckTimer = 5000; + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (!players.isEmpty()) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->GetSource()) + if (player->GetPositionZ() < 700.0f) + Unit::Kill(me, player); + } + else + _positionCheckTimer -= diff; - events.Update(diff); + events.Update(diff); - // during Remorseless Winter phases The Lich King is channeling a spell, but we must continue casting other spells - if (me->HasUnitState(UNIT_STATE_CASTING) && !((1 << _phase) & PHASE_MASK_NO_CAST_CHECK)) - return; + // during Remorseless Winter phases The Lich King is channeling a spell, but we must continue casting other spells + if (me->HasUnitState(UNIT_STATE_CASTING) && !((1 << _phase) & PHASE_MASK_NO_CAST_CHECK)) + return; - switch (uint32 eventId = events.ExecuteEvent()) - { - case EVENT_BERSERK: - Talk(SAY_LK_BERSERK); - me->CastSpell(me, SPELL_BERSERK2, true); - break; - case EVENT_START_ATTACK: - me->SetReactState(REACT_AGGRESSIVE); - if (_phase == PHASE_FROSTMOURNE) - { - _bFrostmournePhase = false; - _phase = PHASE_THREE; - events.RescheduleEvent(EVENT_DEFILE, 0, EVENT_GROUP_ABILITIES); - events.RescheduleEvent(EVENT_SOUL_REAPER, urand(7000, 12000), EVENT_GROUP_ABILITIES); + switch (uint32 eventId = events.ExecuteEvent()) + { + case EVENT_BERSERK: + Talk(SAY_LK_BERSERK); + me->CastSpell(me, SPELL_BERSERK2, true); + break; + case EVENT_START_ATTACK: + me->SetReactState(REACT_AGGRESSIVE); + if (_phase == PHASE_FROSTMOURNE) + { + _bFrostmournePhase = false; + _phase = PHASE_THREE; + events.RescheduleEvent(EVENT_DEFILE, 0, EVENT_GROUP_ABILITIES); + events.RescheduleEvent(EVENT_SOUL_REAPER, urand(7000, 12000), EVENT_GROUP_ABILITIES); - for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) - if (summon->GetEntry() == NPC_RAGING_SPIRIT) - summon->SetReactState(REACT_AGGRESSIVE); - } - break; - case EVENT_QUAKE: - _phase = PHASE_TWO; - events.CancelEventGroup(EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_INFEST, 8000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SUMMON_VALKYR, 15000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SOUL_REAPER, 22000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_DEFILE, 32500, EVENT_GROUP_ABILITIES); + for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) + if (summon->GetEntry() == NPC_RAGING_SPIRIT) + summon->SetReactState(REACT_AGGRESSIVE); + } + break; + case EVENT_QUAKE: + _phase = PHASE_TWO; + events.CancelEventGroup(EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_INFEST, 8000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SUMMON_VALKYR, 15000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SOUL_REAPER, 22000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_DEFILE, 32500, EVENT_GROUP_ABILITIES); - me->InterruptNonMeleeSpells(false); - me->ClearUnitState(UNIT_STATE_CASTING); - me->SetFacingTo(0.0f); - me->CastSpell((Unit*)NULL, SPELL_QUAKE, false); - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); - Talk(SAY_LK_QUAKE); - break; - case EVENT_QUAKE_2: - _phase = PHASE_THREE; - events.CancelEventGroup(EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SOUL_REAPER, 25000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_DEFILE, 32500, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_VILE_SPIRITS, 18000, EVENT_GROUP_VILE_SPIRITS); - events.ScheduleEvent(IsHeroic() ? EVENT_HARVEST_SOULS : EVENT_HARVEST_SOUL, 11000, EVENT_GROUP_ABILITIES); + me->InterruptNonMeleeSpells(false); + me->ClearUnitState(UNIT_STATE_CASTING); + me->SetFacingTo(0.0f); + me->CastSpell((Unit*)NULL, SPELL_QUAKE, false); + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); + Talk(SAY_LK_QUAKE); + break; + case EVENT_QUAKE_2: + _phase = PHASE_THREE; + events.CancelEventGroup(EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SOUL_REAPER, 25000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_DEFILE, 32500, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_VILE_SPIRITS, 18000, EVENT_GROUP_VILE_SPIRITS); + events.ScheduleEvent(IsHeroic() ? EVENT_HARVEST_SOULS : EVENT_HARVEST_SOUL, 11000, EVENT_GROUP_ABILITIES); - me->InterruptNonMeleeSpells(false); - me->ClearUnitState(UNIT_STATE_CASTING); - me->SetFacingTo(0.0f); - me->CastSpell((Unit*)NULL, SPELL_QUAKE, false); - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); - Talk(SAY_LK_QUAKE); - break; + me->InterruptNonMeleeSpells(false); + me->ClearUnitState(UNIT_STATE_CASTING); + me->SetFacingTo(0.0f); + me->CastSpell((Unit*)NULL, SPELL_QUAKE, false); + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); + Talk(SAY_LK_QUAKE); + break; - // ABILITIES: - case EVENT_SUMMON_SHAMBLING_HORROR: - me->CastSpell(me, SPELL_SUMMON_SHAMBLING_HORROR, false); - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); - events.ScheduleEvent(EVENT_SUMMON_SHAMBLING_HORROR, 60000, EVENT_GROUP_ABILITIES); - break; - case EVENT_SUMMON_DRUDGE_GHOUL: - me->CastSpell(me, SPELL_SUMMON_DRUDGE_GHOULS, false); - events.ScheduleEvent(EVENT_SUMMON_DRUDGE_GHOUL, 30000, EVENT_GROUP_ABILITIES); - break; - case EVENT_INFEST: - me->CastSpell(me, SPELL_INFEST, false); - events.ScheduleEvent(EVENT_INFEST, urand(21000, 22000), EVENT_GROUP_ABILITIES); - break; - case EVENT_NECROTIC_PLAGUE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NecroticPlagueTargetCheck(me, NECROTIC_PLAGUE_LK, NECROTIC_PLAGUE_PLR))) - { - Talk(EMOTE_NECROTIC_PLAGUE_WARNING, target); - me->CastSpell(target, SPELL_NECROTIC_PLAGUE, false); - events.ScheduleEvent(EVENT_NECROTIC_PLAGUE, urand(30000, 31000), EVENT_GROUP_ABILITIES); - } - else - events.ScheduleEvent(EVENT_NECROTIC_PLAGUE, 5000, EVENT_GROUP_ABILITIES); - break; - case EVENT_SHADOW_TRAP: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankLKTargetSelector(me, true, true, 100.0f))) - me->CastSpell(target, SPELL_SHADOW_TRAP, false); - events.ScheduleEvent(EVENT_SHADOW_TRAP, 15500, EVENT_GROUP_ABILITIES); - break; - case EVENT_PAIN_AND_SUFFERING: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) - { - events.DelayEventsToMax(500, EVENT_GROUP_ABILITIES); - me->SetOrientation(me->GetAngle(target)); - me->CastSpell(target, SPELL_PAIN_AND_SUFFERING, false); - } - events.ScheduleEvent(EVENT_PAIN_AND_SUFFERING, (IsHeroic() ? urand(1250, 1750) : urand(1750, 2250)), EVENT_GROUP_ABILITIES); - break; - case EVENT_SUMMON_ICE_SPHERE: - me->CastSpell((Unit*)NULL, SPELL_SUMMON_ICE_SPHERE, false); - events.ScheduleEvent(EVENT_SUMMON_ICE_SPHERE, 7500, EVENT_GROUP_ABILITIES); - break; - case EVENT_SUMMON_RAGING_SPIRIT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - me->CastSpell(target, SPELL_RAGING_SPIRIT, false); - events.ScheduleEvent(EVENT_SUMMON_RAGING_SPIRIT, (!HealthAbovePct(40) ? 15000 : 20000), EVENT_GROUP_ABILITIES); - break; - case EVENT_DEFILE: - { - uint32 evTime = events.GetNextEventTime(EVENT_SUMMON_VALKYR); - if (evTime && (events.GetTimer() > evTime || evTime - events.GetTimer() < 5000)) // defile cast 2sec -> valkyr in less than 3 secs after defile appears - { - if (events.GetTimer() > evTime || evTime - events.GetTimer() < 3500) // valkyr is less than 1.5 secs after defile - reschedule defile - { - uint32 t = events.GetTimer() > evTime ? 0 : evTime - events.GetTimer(); - events.ScheduleEvent(EVENT_DEFILE, t+(Is25ManRaid() ? 5000 : 4000), EVENT_GROUP_ABILITIES); - break; - } - // delay valkyr just a bit - events.RescheduleEvent(EVENT_SUMMON_VALKYR, 5000, EVENT_GROUP_ABILITIES); - } - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, DefileTargetSelector(me))) - { - Talk(EMOTE_DEFILE_WARNING); - me->CastSpell(target, SPELL_DEFILE, false); - events.ScheduleEvent(EVENT_DEFILE, urand(31000, 34000), EVENT_GROUP_ABILITIES); - } - else - events.ScheduleEvent(EVENT_DEFILE, 2000, EVENT_GROUP_ABILITIES); - } - break; - case EVENT_SOUL_REAPER: - if (me->IsWithinMeleeRange(me->GetVictim())) - { - me->CastSpell(me->GetVictim(), SPELL_SOUL_REAPER, false); - events.DelayEventsToMax(12000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SOUL_REAPER, 30000, EVENT_GROUP_ABILITIES); - } - else - events.ScheduleEvent(EVENT_SOUL_REAPER, 1000, EVENT_GROUP_ABILITIES); - break; - case EVENT_SUMMON_VALKYR: - { - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); - Talk(SAY_LK_SUMMON_VALKYR); - me->CastSpell((Unit*)NULL, SUMMON_VALKYR, false); - events.ScheduleEvent(EVENT_SUMMON_VALKYR, urand(45000, 48000), EVENT_GROUP_ABILITIES); + // ABILITIES: + case EVENT_SUMMON_SHAMBLING_HORROR: + me->CastSpell(me, SPELL_SUMMON_SHAMBLING_HORROR, false); + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); + events.ScheduleEvent(EVENT_SUMMON_SHAMBLING_HORROR, 60000, EVENT_GROUP_ABILITIES); + break; + case EVENT_SUMMON_DRUDGE_GHOUL: + me->CastSpell(me, SPELL_SUMMON_DRUDGE_GHOULS, false); + events.ScheduleEvent(EVENT_SUMMON_DRUDGE_GHOUL, 30000, EVENT_GROUP_ABILITIES); + break; + case EVENT_INFEST: + me->CastSpell(me, SPELL_INFEST, false); + events.ScheduleEvent(EVENT_INFEST, urand(21000, 22000), EVENT_GROUP_ABILITIES); + break; + case EVENT_NECROTIC_PLAGUE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NecroticPlagueTargetCheck(me, NECROTIC_PLAGUE_LK, NECROTIC_PLAGUE_PLR))) + { + Talk(EMOTE_NECROTIC_PLAGUE_WARNING, target); + me->CastSpell(target, SPELL_NECROTIC_PLAGUE, false); + events.ScheduleEvent(EVENT_NECROTIC_PLAGUE, urand(30000, 31000), EVENT_GROUP_ABILITIES); + } + else + events.ScheduleEvent(EVENT_NECROTIC_PLAGUE, 5000, EVENT_GROUP_ABILITIES); + break; + case EVENT_SHADOW_TRAP: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankLKTargetSelector(me, true, true, 100.0f))) + me->CastSpell(target, SPELL_SHADOW_TRAP, false); + events.ScheduleEvent(EVENT_SHADOW_TRAP, 15500, EVENT_GROUP_ABILITIES); + break; + case EVENT_PAIN_AND_SUFFERING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + { + events.DelayEventsToMax(500, EVENT_GROUP_ABILITIES); + me->SetOrientation(me->GetAngle(target)); + me->CastSpell(target, SPELL_PAIN_AND_SUFFERING, false); + } + events.ScheduleEvent(EVENT_PAIN_AND_SUFFERING, (IsHeroic() ? urand(1250, 1750) : urand(1750, 2250)), EVENT_GROUP_ABILITIES); + break; + case EVENT_SUMMON_ICE_SPHERE: + me->CastSpell((Unit*)NULL, SPELL_SUMMON_ICE_SPHERE, false); + events.ScheduleEvent(EVENT_SUMMON_ICE_SPHERE, 7500, EVENT_GROUP_ABILITIES); + break; + case EVENT_SUMMON_RAGING_SPIRIT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + me->CastSpell(target, SPELL_RAGING_SPIRIT, false); + events.ScheduleEvent(EVENT_SUMMON_RAGING_SPIRIT, (!HealthAbovePct(40) ? 15000 : 20000), EVENT_GROUP_ABILITIES); + break; + case EVENT_DEFILE: + { + uint32 evTime = events.GetNextEventTime(EVENT_SUMMON_VALKYR); + if (evTime && (events.GetTimer() > evTime || evTime - events.GetTimer() < 5000)) // defile cast 2sec -> valkyr in less than 3 secs after defile appears + { + if (events.GetTimer() > evTime || evTime - events.GetTimer() < 3500) // valkyr is less than 1.5 secs after defile - reschedule defile + { + uint32 t = events.GetTimer() > evTime ? 0 : evTime - events.GetTimer(); + events.ScheduleEvent(EVENT_DEFILE, t+(Is25ManRaid() ? 5000 : 4000), EVENT_GROUP_ABILITIES); + break; + } + // delay valkyr just a bit + events.RescheduleEvent(EVENT_SUMMON_VALKYR, 5000, EVENT_GROUP_ABILITIES); + } + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, DefileTargetSelector(me))) + { + Talk(EMOTE_DEFILE_WARNING); + me->CastSpell(target, SPELL_DEFILE, false); + events.ScheduleEvent(EVENT_DEFILE, urand(31000, 34000), EVENT_GROUP_ABILITIES); + } + else + events.ScheduleEvent(EVENT_DEFILE, 2000, EVENT_GROUP_ABILITIES); + } + break; + case EVENT_SOUL_REAPER: + if (me->IsWithinMeleeRange(me->GetVictim())) + { + me->CastSpell(me->GetVictim(), SPELL_SOUL_REAPER, false); + events.DelayEventsToMax(12000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SOUL_REAPER, 30000, EVENT_GROUP_ABILITIES); + } + else + events.ScheduleEvent(EVENT_SOUL_REAPER, 1000, EVENT_GROUP_ABILITIES); + break; + case EVENT_SUMMON_VALKYR: + { + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); + Talk(SAY_LK_SUMMON_VALKYR); + me->CastSpell((Unit*)NULL, SUMMON_VALKYR, false); + events.ScheduleEvent(EVENT_SUMMON_VALKYR, urand(45000, 48000), EVENT_GROUP_ABILITIES); - uint32 minTime = (Is25ManRaid() ? 5000 : 4000); - if (uint32 evTime = events.GetNextEventTime(EVENT_DEFILE)) - if (events.GetTimer() > evTime || evTime - events.GetTimer() < minTime) - events.RescheduleEvent(EVENT_DEFILE, minTime, EVENT_GROUP_ABILITIES); - } - break; - case EVENT_VILE_SPIRITS: - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); - me->CastSpell((Unit*)NULL, SPELL_VILE_SPIRITS, false); - events.ScheduleEvent(EVENT_VILE_SPIRITS, 30000, EVENT_GROUP_VILE_SPIRITS); - break; - case EVENT_HARVEST_SOUL: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankLKTargetSelector(me, true, true, 55.0f))) - { - Talk(SAY_LK_HARVEST_SOUL); - me->CastSpell(target, SPELL_HARVEST_SOUL, false); - events.ScheduleEvent(EVENT_HARVEST_SOUL, 70000, EVENT_GROUP_ABILITIES); - } - else - events.ScheduleEvent(EVENT_HARVEST_SOUL, 10000, EVENT_GROUP_ABILITIES); - break; - case EVENT_HARVEST_SOULS: - Talk(SAY_LK_HARVEST_SOUL); - me->CastSpell((Unit*)NULL, SPELL_HARVEST_SOULS, false); - _phase = PHASE_FROSTMOURNE; - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - events.ScheduleEvent(EVENT_START_ATTACK, 55000); - events.DelayEvents(52500, EVENT_GROUP_VILE_SPIRITS); - events.CancelEvent(EVENT_DEFILE); - events.CancelEvent(EVENT_SOUL_REAPER); - events.ScheduleEvent(EVENT_FROSTMOURNE_HEROIC, 6000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_HARVEST_SOULS, urand(100000, 110000), EVENT_GROUP_ABILITIES); + uint32 minTime = (Is25ManRaid() ? 5000 : 4000); + if (uint32 evTime = events.GetNextEventTime(EVENT_DEFILE)) + if (events.GetTimer() > evTime || evTime - events.GetTimer() < minTime) + events.RescheduleEvent(EVENT_DEFILE, minTime, EVENT_GROUP_ABILITIES); + } + break; + case EVENT_VILE_SPIRITS: + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_SPECIAL); + me->CastSpell((Unit*)NULL, SPELL_VILE_SPIRITS, false); + events.ScheduleEvent(EVENT_VILE_SPIRITS, 30000, EVENT_GROUP_VILE_SPIRITS); + break; + case EVENT_HARVEST_SOUL: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankLKTargetSelector(me, true, true, 55.0f))) + { + Talk(SAY_LK_HARVEST_SOUL); + me->CastSpell(target, SPELL_HARVEST_SOUL, false); + events.ScheduleEvent(EVENT_HARVEST_SOUL, 70000, EVENT_GROUP_ABILITIES); + } + else + events.ScheduleEvent(EVENT_HARVEST_SOUL, 10000, EVENT_GROUP_ABILITIES); + break; + case EVENT_HARVEST_SOULS: + Talk(SAY_LK_HARVEST_SOUL); + me->CastSpell((Unit*)NULL, SPELL_HARVEST_SOULS, false); + _phase = PHASE_FROSTMOURNE; + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + events.ScheduleEvent(EVENT_START_ATTACK, 55000); + events.DelayEvents(52500, EVENT_GROUP_VILE_SPIRITS); + events.CancelEvent(EVENT_DEFILE); + events.CancelEvent(EVENT_SOUL_REAPER); + events.ScheduleEvent(EVENT_FROSTMOURNE_HEROIC, 6000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_HARVEST_SOULS, urand(100000, 110000), EVENT_GROUP_ABILITIES); - for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) - { - if (summon->GetEntry() == NPC_VILE_SPIRIT) - { - summon->m_Events.KillAllEvents(true); - summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(55000)); - summon->GetMotionMaster()->Clear(true); - summon->StopMoving(); - summon->SetReactState(REACT_PASSIVE); - summon->AttackStop(); - } - else if (summon->GetEntry() == NPC_RAGING_SPIRIT) - { - summon->GetMotionMaster()->Clear(true); - summon->StopMoving(); - summon->SetReactState(REACT_PASSIVE); - summon->AttackStop(); - } - } - break; - case EVENT_FROSTMOURNE_HEROIC: - _bFrostmournePhase = true; - if (TempSummon* terenas = me->GetMap()->SummonCreature(NPC_TERENAS_MENETHIL_FROSTMOURNE_H, TerenasSpawnHeroic, NULL, 55000)) - { - terenas->AI()->DoAction(ACTION_FROSTMOURNE_INTRO); - if (Creature* spawner = terenas->FindNearestCreature(NPC_WORLD_TRIGGER_INFINITE_AOI, 100.0f, true)) - { - spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_1, true); // summons bombs randomly - spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_2, true); // summons bombs on players - spawner->m_Events.AddEvent(new TriggerWickedSpirit(spawner), spawner->m_Events.CalculateTime(3000)); - terenas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); // to avoid being healed by player trinket procs. terenas' health doesn't matter on heroic - } - } - break; + for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) + { + if (summon->GetEntry() == NPC_VILE_SPIRIT) + { + summon->m_Events.KillAllEvents(true); + summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(55000)); + summon->GetMotionMaster()->Clear(true); + summon->StopMoving(); + summon->SetReactState(REACT_PASSIVE); + summon->AttackStop(); + } + else if (summon->GetEntry() == NPC_RAGING_SPIRIT) + { + summon->GetMotionMaster()->Clear(true); + summon->StopMoving(); + summon->SetReactState(REACT_PASSIVE); + summon->AttackStop(); + } + } + break; + case EVENT_FROSTMOURNE_HEROIC: + _bFrostmournePhase = true; + if (TempSummon* terenas = me->GetMap()->SummonCreature(NPC_TERENAS_MENETHIL_FROSTMOURNE_H, TerenasSpawnHeroic, NULL, 55000)) + { + terenas->AI()->DoAction(ACTION_FROSTMOURNE_INTRO); + if (Creature* spawner = terenas->FindNearestCreature(NPC_WORLD_TRIGGER_INFINITE_AOI, 100.0f, true)) + { + spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_1, true); // summons bombs randomly + spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_2, true); // summons bombs on players + spawner->m_Events.AddEvent(new TriggerWickedSpirit(spawner), spawner->m_Events.CalculateTime(3000)); + terenas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); // to avoid being healed by player trinket procs. terenas' health doesn't matter on heroic + } + } + break; - default: - break; - } + default: + break; + } - if (!me->HasReactState(REACT_PASSIVE) && me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim()) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && !me->IsWithinLOSInMap(me->GetVictim())) - me->GetMotionMaster()->MoveCharge(me->GetVictim()->GetPositionX(), me->GetVictim()->GetPositionY(), me->GetVictim()->GetPositionZ(), me->GetSpeed(MOVE_RUN), POINT_NONE); + if (!me->HasReactState(REACT_PASSIVE) && me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim()) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && !me->IsWithinLOSInMap(me->GetVictim())) + me->GetMotionMaster()->MoveCharge(me->GetVictim()->GetPositionX(), me->GetVictim()->GetPositionY(), me->GetVictim()->GetPositionZ(), me->GetSpeed(MOVE_RUN), POINT_NONE); - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - uint32 GetData(uint32 type) const - { - switch (type) - { - case DATA_PLAGUE_STACK: - return _necroticPlagueStack; - case DATA_VILE: - return _vileSpiritExplosions; - default: - break; - } + uint32 GetData(uint32 type) const + { + switch (type) + { + case DATA_PLAGUE_STACK: + return _necroticPlagueStack; + case DATA_VILE: + return _vileSpiritExplosions; + default: + break; + } - return 0; - } + return 0; + } - void SetData(uint32 type, uint32 value) - { - switch (type) - { - case DATA_PLAGUE_STACK: - _necroticPlagueStack = std::max(value, _necroticPlagueStack); - break; - case DATA_VILE: - _vileSpiritExplosions += value; - break; - default: - break; - } - } + void SetData(uint32 type, uint32 value) + { + switch (type) + { + case DATA_PLAGUE_STACK: + _necroticPlagueStack = std::max(value, _necroticPlagueStack); + break; + case DATA_VILE: + _vileSpiritExplosions += value; + break; + default: + break; + } + } - void EnterEvadeMode() - { - EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE); - summons.DoAction(ACTION_TELEPORT_BACK, pred); - instance->SetBossState(DATA_THE_LICH_KING, FAIL); - me->CastSpell((Unit*)NULL, SPELL_KILL_FROSTMOURNE_PLAYERS, true); - BossAI::EnterEvadeMode(); - me->SetReactState(REACT_AGGRESSIVE); + void EnterEvadeMode() + { + EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE); + summons.DoAction(ACTION_TELEPORT_BACK, pred); + instance->SetBossState(DATA_THE_LICH_KING, FAIL); + me->CastSpell((Unit*)NULL, SPELL_KILL_FROSTMOURNE_PLAYERS, true); + BossAI::EnterEvadeMode(); + me->SetReactState(REACT_AGGRESSIVE); - if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) - tirion->AI()->EnterEvadeMode(); - } - }; + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + tirion->AI()->EnterEvadeMode(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_tirion_fordring_tft : public CreatureScript { - public: - npc_tirion_fordring_tft() : CreatureScript("npc_tirion_fordring_tft") { } + public: + npc_tirion_fordring_tft() : CreatureScript("npc_tirion_fordring_tft") { } - struct npc_tirion_fordringAI : public ScriptedAI - { - npc_tirion_fordringAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) {} + struct npc_tirion_fordringAI : public ScriptedAI + { + npc_tirion_fordringAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) {} - void Reset() - { - _events.Reset(); - if (_instance->GetBossState(DATA_THE_LICH_KING) == DONE || me->GetMap()->IsHeroic() && !_instance->GetData(DATA_LK_HC_AVAILABLE)) - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetReactState(REACT_PASSIVE); - } + void Reset() + { + _events.Reset(); + if (_instance->GetBossState(DATA_THE_LICH_KING) == DONE || me->GetMap()->IsHeroic() && !_instance->GetData(DATA_LK_HC_AVAILABLE)) + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetReactState(REACT_PASSIVE); + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; - switch (id) - { - case POINT_TIRION_INTRO: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - if (!theLichKing->IsAlive() || !theLichKing->IsVisible()) - break; - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - theLichKing->SetStandState(UNIT_STAND_STATE_STAND); - theLichKing->SetSheath(SHEATH_STATE_MELEE); - theLichKing->RemoveAurasDueToSpell(SPELL_EMOTE_SIT_NO_SHEATH); - theLichKing->AI()->Talk(SAY_LK_INTRO_1); - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_FROZEN_THRONE); - _events.ScheduleEvent(EVENT_INTRO_LK_MOVE, 3000); - } - break; - case POINT_TIRION_OUTRO: - _events.ScheduleEvent(EVENT_OUTRO_FORDRING_JUMP, 1); - break; - } - } + switch (id) + { + case POINT_TIRION_INTRO: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + if (!theLichKing->IsAlive() || !theLichKing->IsVisible()) + break; + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + theLichKing->SetStandState(UNIT_STAND_STATE_STAND); + theLichKing->SetSheath(SHEATH_STATE_MELEE); + theLichKing->RemoveAurasDueToSpell(SPELL_EMOTE_SIT_NO_SHEATH); + theLichKing->AI()->Talk(SAY_LK_INTRO_1); + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_FROZEN_THRONE); + _events.ScheduleEvent(EVENT_INTRO_LK_MOVE, 3000); + } + break; + case POINT_TIRION_OUTRO: + _events.ScheduleEvent(EVENT_OUTRO_FORDRING_JUMP, 1); + break; + } + } - void DoAction(int32 action) - { - switch (action) - { - case ACTION_OUTRO: - _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_1, 2600); - _events.ScheduleEvent(EVENT_OUTRO_LK_EMOTE_TALK, 6600); - _events.ScheduleEvent(EVENT_OUTRO_LK_EMOTE_TALK, 17600); - _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_2, 30000); - _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_3, 39000); - _events.ScheduleEvent(EVENT_OUTRO_LK_EMOTE_CAST_SHOUT, 50000); - _events.ScheduleEvent(EVENT_OUTRO_LK_EMOTE_TALK, 54000); - _events.ScheduleEvent(EVENT_OUTRO_LK_MOVE_CENTER, 65000); - break; - case ACTION_BREAK_FROSTMOURNE: - _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_6, 2500); - _events.ScheduleEvent(EVENT_OUTRO_SOUL_BARRAGE, 6500); - break; - } - } + void DoAction(int32 action) + { + switch (action) + { + case ACTION_OUTRO: + _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_1, 2600); + _events.ScheduleEvent(EVENT_OUTRO_LK_EMOTE_TALK, 6600); + _events.ScheduleEvent(EVENT_OUTRO_LK_EMOTE_TALK, 17600); + _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_2, 30000); + _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_3, 39000); + _events.ScheduleEvent(EVENT_OUTRO_LK_EMOTE_CAST_SHOUT, 50000); + _events.ScheduleEvent(EVENT_OUTRO_LK_EMOTE_TALK, 54000); + _events.ScheduleEvent(EVENT_OUTRO_LK_MOVE_CENTER, 65000); + break; + case ACTION_BREAK_FROSTMOURNE: + _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_6, 2500); + _events.ScheduleEvent(EVENT_OUTRO_SOUL_BARRAGE, 6500); + break; + } + } - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) - { - if (spell->Id == SPELL_ICE_LOCK) - { - me->StopMoving(); - me->GetMotionMaster()->Clear(true); - me->SetFacingTo(3.085098f); - } - else if (spell->Id == SPELL_BROKEN_FROSTMOURNE_KNOCK) - { - // remove glow on ashbringer and tirion - me->RemoveAllAuras(); - SetEquipmentSlots(true); - } - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_ICE_LOCK) + { + me->StopMoving(); + me->GetMotionMaster()->Clear(true); + me->SetFacingTo(3.085098f); + } + else if (spell->Id == SPELL_BROKEN_FROSTMOURNE_KNOCK) + { + // remove glow on ashbringer and tirion + me->RemoveAllAuras(); + SetEquipmentSlots(true); + } + } - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); - if (!(_instance->GetBossState(DATA_THE_LICH_KING) == DONE || me->GetMap()->IsHeroic() && !_instance->GetData(DATA_LK_HC_AVAILABLE))) - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - } + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); + if (!(_instance->GetBossState(DATA_THE_LICH_KING) == DONE || me->GetMap()->IsHeroic() && !_instance->GetData(DATA_LK_HC_AVAILABLE))) + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + } - void sGossipSelect(Player* /*player*/, uint32 sender, uint32 action) - { - Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)); - if (me->GetCreatureTemplate()->GossipMenuId == sender && !action && me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) && theLichKing && !theLichKing->IsInEvadeMode()) - { - if (me->GetMap()->IsHeroic() && !_instance->GetData(DATA_LK_HC_AVAILABLE)) - return; - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetWalk(true); - me->GetMotionMaster()->MovePoint(POINT_TIRION_INTRO, TirionIntro); - } - } + void sGossipSelect(Player* /*player*/, uint32 sender, uint32 action) + { + Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING)); + if (me->GetCreatureTemplate()->GossipMenuId == sender && !action && me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) && theLichKing && !theLichKing->IsInEvadeMode()) + { + if (me->GetMap()->IsHeroic() && !_instance->GetData(DATA_LK_HC_AVAILABLE)) + return; + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(POINT_TIRION_INTRO, TirionIntro); + } + } - /*bool CanBeSeen(Player const* p) - { - return me->GetExactDistSq(p) < 200.0f*200.0f; - }*/ + /*bool CanBeSeen(Player const* p) + { + return me->GetExactDistSq(p) < 200.0f*200.0f; + }*/ - void UpdateAI(uint32 diff) - { - UpdateVictim(); + void UpdateAI(uint32 diff) + { + UpdateVictim(); - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (uint32 eventId = _events.ExecuteEvent()) - { - case EVENT_INTRO_LK_MOVE: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - Movement::PointsArray path; - path.push_back(G3D::Vector3(theLichKing->GetPositionX(), theLichKing->GetPositionY(), theLichKing->GetPositionZ())); - for (uint8 i=0; i<3; ++i) - path.push_back(G3D::Vector3(LichKingIntro[i].GetPositionX(), LichKingIntro[i].GetPositionY(), LichKingIntro[i].GetPositionZ())); - theLichKing->SetWalk(true); - theLichKing->GetMotionMaster()->MoveSplinePath(&path); - _events.ScheduleEvent(EVENT_INTRO_FORDRING_TALK_1, 11000); - } - break; - case EVENT_INTRO_LK_TALK_1: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->AI()->Talk(SAY_LK_INTRO_2); - theLichKing->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE); - _events.ScheduleEvent(EVENT_INTRO_LK_EMOTE_CAST_SHOUT, 7000); - _events.ScheduleEvent(EVENT_INTRO_LK_EMOTE_1, 13000); - _events.ScheduleEvent(EVENT_INTRO_LK_EMOTE_CAST_SHOUT, 18000); - _events.ScheduleEvent(EVENT_INTRO_LK_CAST_FREEZE, 31000); - } - break; - case EVENT_INTRO_LK_EMOTE_CAST_SHOUT: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - theLichKing->CastSpell(theLichKing, SPELL_EMOTE_SHOUT_NO_SHEATH, false); - break; - case EVENT_INTRO_LK_EMOTE_1: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - theLichKing->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NO_SHEATHE); - break; - case EVENT_INTRO_LK_CAST_FREEZE: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->AI()->Talk(SAY_LK_INTRO_3); - theLichKing->CastSpell((Unit*)NULL, SPELL_ICE_LOCK, false); - _events.ScheduleEvent(EVENT_INTRO_FINISH, 1000); - } - break; - case EVENT_INTRO_FORDRING_TALK_1: - { - Talk(SAY_TIRION_INTRO_1); - _events.ScheduleEvent(EVENT_INTRO_LK_TALK_1, 9000); - _events.ScheduleEvent(EVENT_INTRO_FORDRING_TALK_2, 34000); - } - break; - case EVENT_INTRO_FORDRING_TALK_2: - { - Talk(SAY_TIRION_INTRO_2); - _events.ScheduleEvent(EVENT_INTRO_FORDRING_EMOTE_1, 2000); - _events.ScheduleEvent(EVENT_INTRO_FORDRING_CHARGE, 5000); - } - break; - case EVENT_INTRO_FORDRING_EMOTE_1: - me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NO_SHEATHE); - break; - case EVENT_INTRO_FORDRING_CHARGE: - me->SetWalk(false); - me->GetMotionMaster()->MovePoint(0, TirionCharge); - break; - case EVENT_INTRO_FINISH: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->SetWalk(false); - theLichKing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - theLichKing->SetReactState(REACT_AGGRESSIVE); - theLichKing->SetInCombatWithZone(); - if (!theLichKing->IsInCombat()) - theLichKing->AI()->EnterEvadeMode(); - } - break; + switch (uint32 eventId = _events.ExecuteEvent()) + { + case EVENT_INTRO_LK_MOVE: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + Movement::PointsArray path; + path.push_back(G3D::Vector3(theLichKing->GetPositionX(), theLichKing->GetPositionY(), theLichKing->GetPositionZ())); + for (uint8 i=0; i<3; ++i) + path.push_back(G3D::Vector3(LichKingIntro[i].GetPositionX(), LichKingIntro[i].GetPositionY(), LichKingIntro[i].GetPositionZ())); + theLichKing->SetWalk(true); + theLichKing->GetMotionMaster()->MoveSplinePath(&path); + _events.ScheduleEvent(EVENT_INTRO_FORDRING_TALK_1, 11000); + } + break; + case EVENT_INTRO_LK_TALK_1: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->AI()->Talk(SAY_LK_INTRO_2); + theLichKing->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE); + _events.ScheduleEvent(EVENT_INTRO_LK_EMOTE_CAST_SHOUT, 7000); + _events.ScheduleEvent(EVENT_INTRO_LK_EMOTE_1, 13000); + _events.ScheduleEvent(EVENT_INTRO_LK_EMOTE_CAST_SHOUT, 18000); + _events.ScheduleEvent(EVENT_INTRO_LK_CAST_FREEZE, 31000); + } + break; + case EVENT_INTRO_LK_EMOTE_CAST_SHOUT: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + theLichKing->CastSpell(theLichKing, SPELL_EMOTE_SHOUT_NO_SHEATH, false); + break; + case EVENT_INTRO_LK_EMOTE_1: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + theLichKing->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NO_SHEATHE); + break; + case EVENT_INTRO_LK_CAST_FREEZE: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->AI()->Talk(SAY_LK_INTRO_3); + theLichKing->CastSpell((Unit*)NULL, SPELL_ICE_LOCK, false); + _events.ScheduleEvent(EVENT_INTRO_FINISH, 1000); + } + break; + case EVENT_INTRO_FORDRING_TALK_1: + { + Talk(SAY_TIRION_INTRO_1); + _events.ScheduleEvent(EVENT_INTRO_LK_TALK_1, 9000); + _events.ScheduleEvent(EVENT_INTRO_FORDRING_TALK_2, 34000); + } + break; + case EVENT_INTRO_FORDRING_TALK_2: + { + Talk(SAY_TIRION_INTRO_2); + _events.ScheduleEvent(EVENT_INTRO_FORDRING_EMOTE_1, 2000); + _events.ScheduleEvent(EVENT_INTRO_FORDRING_CHARGE, 5000); + } + break; + case EVENT_INTRO_FORDRING_EMOTE_1: + me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NO_SHEATHE); + break; + case EVENT_INTRO_FORDRING_CHARGE: + me->SetWalk(false); + me->GetMotionMaster()->MovePoint(0, TirionCharge); + break; + case EVENT_INTRO_FINISH: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->SetWalk(false); + theLichKing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + theLichKing->SetReactState(REACT_AGGRESSIVE); + theLichKing->SetInCombatWithZone(); + if (!theLichKing->IsInCombat()) + theLichKing->AI()->EnterEvadeMode(); + } + break; - case EVENT_OUTRO_LK_TALK_1: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->AI()->Talk(SAY_LK_OUTRO_1); - theLichKing->CastSpell((Unit*)NULL, SPELL_FURY_OF_FROSTMOURNE_NO_REZ, true); - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (p->IsAlive()) - Unit::Kill(me, p); - } - break; - case EVENT_OUTRO_LK_TALK_2: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->AI()->Talk(SAY_LK_OUTRO_2); - theLichKing->CastSpell((Unit*)NULL, SPELL_EMOTE_QUESTION_NO_SHEATH, false); - } - break; - case EVENT_OUTRO_LK_EMOTE_TALK: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - theLichKing->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE); - break; - case EVENT_OUTRO_LK_TALK_3: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->SetFacingToObject(me); - theLichKing->AI()->Talk(SAY_LK_OUTRO_3); - } - break; - case EVENT_OUTRO_LK_MOVE_CENTER: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->GetMotionMaster()->MovePoint(0, CenterPosition); - uint32 travelTime = 1000*theLichKing->GetExactDist(&CenterPosition)/theLichKing->GetSpeed(MOVE_WALK) + 1000; - - _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_4, 1+travelTime); - _events.ScheduleEvent(EVENT_OUTRO_LK_RAISE_DEAD, 1000+travelTime); - _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_5, 29000+travelTime); - } - break; - case EVENT_OUTRO_LK_TALK_4: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->SetFacingTo(0.01745329f); - theLichKing->AI()->Talk(SAY_LK_OUTRO_4); - } - break; - case EVENT_OUTRO_LK_RAISE_DEAD: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->CastSpell((Unit*)NULL, SPELL_RAISE_DEAD, false); - theLichKing->ClearUnitState(UNIT_STATE_CASTING); - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_FINAL); - } - break; - case EVENT_OUTRO_LK_TALK_5: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->AI()->Talk(SAY_LK_OUTRO_5); - _events.ScheduleEvent(EVENT_OUTRO_FORDRING_TALK_1, 7000); - _events.ScheduleEvent(EVENT_OUTRO_FORDRING_BLESS, 18000); - _events.ScheduleEvent(EVENT_OUTRO_FORDRING_REMOVE_ICE, 23000); - _events.ScheduleEvent(EVENT_OUTRO_FORDRING_MOVE_1, 25000); - } - break; - case EVENT_OUTRO_LK_TALK_6: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->AI()->Talk(SAY_LK_OUTRO_6); - me->SetFacingToObject(theLichKing); - theLichKing->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, EQUIP_UNEQUIP); - theLichKing->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE_3, true); - me->GetMap()->SetZoneOverrideLight(AREA_THE_FROZEN_THRONE, LIGHT_SOULSTORM, 10000); - me->GetMap()->SetZoneWeather(AREA_THE_FROZEN_THRONE, WEATHER_STATE_BLACKSNOW, 0.5f); + case EVENT_OUTRO_LK_TALK_1: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->AI()->Talk(SAY_LK_OUTRO_1); + theLichKing->CastSpell((Unit*)NULL, SPELL_FURY_OF_FROSTMOURNE_NO_REZ, true); + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (p->IsAlive()) + Unit::Kill(me, p); + } + break; + case EVENT_OUTRO_LK_TALK_2: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->AI()->Talk(SAY_LK_OUTRO_2); + theLichKing->CastSpell((Unit*)NULL, SPELL_EMOTE_QUESTION_NO_SHEATH, false); + } + break; + case EVENT_OUTRO_LK_EMOTE_TALK: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + theLichKing->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE); + break; + case EVENT_OUTRO_LK_TALK_3: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->SetFacingToObject(me); + theLichKing->AI()->Talk(SAY_LK_OUTRO_3); + } + break; + case EVENT_OUTRO_LK_MOVE_CENTER: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->GetMotionMaster()->MovePoint(0, CenterPosition); + uint32 travelTime = 1000*theLichKing->GetExactDist(&CenterPosition)/theLichKing->GetSpeed(MOVE_WALK) + 1000; + + _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_4, 1+travelTime); + _events.ScheduleEvent(EVENT_OUTRO_LK_RAISE_DEAD, 1000+travelTime); + _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_5, 29000+travelTime); + } + break; + case EVENT_OUTRO_LK_TALK_4: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->SetFacingTo(0.01745329f); + theLichKing->AI()->Talk(SAY_LK_OUTRO_4); + } + break; + case EVENT_OUTRO_LK_RAISE_DEAD: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->CastSpell((Unit*)NULL, SPELL_RAISE_DEAD, false); + theLichKing->ClearUnitState(UNIT_STATE_CASTING); + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_FINAL); + } + break; + case EVENT_OUTRO_LK_TALK_5: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->AI()->Talk(SAY_LK_OUTRO_5); + _events.ScheduleEvent(EVENT_OUTRO_FORDRING_TALK_1, 7000); + _events.ScheduleEvent(EVENT_OUTRO_FORDRING_BLESS, 18000); + _events.ScheduleEvent(EVENT_OUTRO_FORDRING_REMOVE_ICE, 23000); + _events.ScheduleEvent(EVENT_OUTRO_FORDRING_MOVE_1, 25000); + } + break; + case EVENT_OUTRO_LK_TALK_6: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->AI()->Talk(SAY_LK_OUTRO_6); + me->SetFacingToObject(theLichKing); + theLichKing->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, EQUIP_UNEQUIP); + theLichKing->CastSpell((Unit*)NULL, SPELL_SUMMON_BROKEN_FROSTMOURNE_3, true); + me->GetMap()->SetZoneOverrideLight(AREA_THE_FROZEN_THRONE, LIGHT_SOULSTORM, 10000); + me->GetMap()->SetZoneWeather(AREA_THE_FROZEN_THRONE, WEATHER_STATE_BLACKSNOW, 0.5f); - _events.ScheduleEvent(EVENT_OUTRO_AFTER_SUMMON_BROKEN_FROSTMOURNE, 1000); - _events.ScheduleEvent(EVENT_OUTRO_KNOCK_BACK, 3000); - break; - } - break; - case EVENT_OUTRO_AFTER_SUMMON_BROKEN_FROSTMOURNE: - if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) - frostmourne->CastSpell((Unit*)NULL, SPELL_BROKEN_FROSTMOURNE, true); - break; - case EVENT_OUTRO_KNOCK_BACK: - if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) - frostmourne->CastSpell((Unit*)NULL, SPELL_BROKEN_FROSTMOURNE_KNOCK, false); - break; - case EVENT_OUTRO_SOUL_BARRAGE: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - theLichKing->CastSpell((Unit*)NULL, SPELL_SOUL_BARRAGE, TRIGGERED_IGNORE_CAST_IN_PROGRESS); - sCreatureTextMgr->SendSound(theLichKing, SOUND_PAIN, CHAT_MSG_MONSTER_YELL, 0, TEXT_RANGE_NORMAL, TEAM_NEUTRAL, false); - theLichKing->SetDisableGravity(true); - theLichKing->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); - theLichKing->GetMotionMaster()->MovePoint(0, OutroFlying); - - _events.ScheduleEvent(EVENT_OUTRO_AFTER_SOUL_BARRAGE, 3000); - } - break; - case EVENT_OUTRO_AFTER_SOUL_BARRAGE: - Talk(SAY_TIRION_OUTRO_2); - _events.ScheduleEvent(EVENT_OUTRO_SUMMON_TERENAS, 6000); - break; - case EVENT_OUTRO_SUMMON_TERENAS: - if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) - { - frostmourne->CastSpell((Unit*)NULL, SPELL_SUMMON_TERENAS, false); - if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f)) - terenas->SetFacingToObject(frostmourne); - } - _events.ScheduleEvent(EVENT_OUTRO_TERENAS_TALK_1, 2000); - _events.ScheduleEvent(EVENT_OUTRO_TERENAS_TALK_2, 14000); - break; - case EVENT_OUTRO_TERENAS_TALK_1: - if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f)) - terenas->AI()->Talk(SAY_TERENAS_OUTRO_1); - break; - case EVENT_OUTRO_TERENAS_TALK_2: - if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f)) - { - terenas->AI()->Talk(SAY_TERENAS_OUTRO_2); - terenas->CastSpell((Unit*)NULL, SPELL_MASS_RESURRECTION, false); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - lichKing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->RemoveAllAuras(); - SetEquipmentSlots(true); - me->Attack(lichKing, true); - me->GetMotionMaster()->MovePoint(0, 512.16f, -2120.25f, 840.86f); - } - _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_7, 7000); - _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_8, 17000); - } - break; - case EVENT_OUTRO_LK_TALK_7: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - theLichKing->AI()->Talk(SAY_LK_OUTRO_7); - break; - case EVENT_OUTRO_LK_TALK_8: - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - theLichKing->AI()->Talk(SAY_LK_OUTRO_8); - break; - case EVENT_OUTRO_FORDRING_TALK_1: - Talk(SAY_TIRION_OUTRO_1); - break; - case EVENT_OUTRO_FORDRING_BLESS: - me->CastSpell(me, SPELL_LIGHTS_BLESSING, false); - break; - case EVENT_OUTRO_FORDRING_REMOVE_ICE: - me->RemoveAurasDueToSpell(SPELL_ICE_LOCK); - SetEquipmentSlots(false, EQUIP_ASHBRINGER_GLOWING); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - me->SetFacingToObject(lichKing); - me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_FINAL); - } - break; - case EVENT_OUTRO_FORDRING_MOVE_1: - me->GetMotionMaster()->MovePoint(POINT_TIRION_OUTRO, OutroPosition1); - break; - case EVENT_OUTRO_FORDRING_JUMP: - me->CastSpell((Unit*)NULL, SPELL_JUMP, false); - break; + _events.ScheduleEvent(EVENT_OUTRO_AFTER_SUMMON_BROKEN_FROSTMOURNE, 1000); + _events.ScheduleEvent(EVENT_OUTRO_KNOCK_BACK, 3000); + break; + } + break; + case EVENT_OUTRO_AFTER_SUMMON_BROKEN_FROSTMOURNE: + if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) + frostmourne->CastSpell((Unit*)NULL, SPELL_BROKEN_FROSTMOURNE, true); + break; + case EVENT_OUTRO_KNOCK_BACK: + if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) + frostmourne->CastSpell((Unit*)NULL, SPELL_BROKEN_FROSTMOURNE_KNOCK, false); + break; + case EVENT_OUTRO_SOUL_BARRAGE: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + theLichKing->CastSpell((Unit*)NULL, SPELL_SOUL_BARRAGE, TRIGGERED_IGNORE_CAST_IN_PROGRESS); + sCreatureTextMgr->SendSound(theLichKing, SOUND_PAIN, CHAT_MSG_MONSTER_YELL, 0, TEXT_RANGE_NORMAL, TEAM_NEUTRAL, false); + theLichKing->SetDisableGravity(true); + theLichKing->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + theLichKing->GetMotionMaster()->MovePoint(0, OutroFlying); + + _events.ScheduleEvent(EVENT_OUTRO_AFTER_SOUL_BARRAGE, 3000); + } + break; + case EVENT_OUTRO_AFTER_SOUL_BARRAGE: + Talk(SAY_TIRION_OUTRO_2); + _events.ScheduleEvent(EVENT_OUTRO_SUMMON_TERENAS, 6000); + break; + case EVENT_OUTRO_SUMMON_TERENAS: + if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) + { + frostmourne->CastSpell((Unit*)NULL, SPELL_SUMMON_TERENAS, false); + if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f)) + terenas->SetFacingToObject(frostmourne); + } + _events.ScheduleEvent(EVENT_OUTRO_TERENAS_TALK_1, 2000); + _events.ScheduleEvent(EVENT_OUTRO_TERENAS_TALK_2, 14000); + break; + case EVENT_OUTRO_TERENAS_TALK_1: + if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f)) + terenas->AI()->Talk(SAY_TERENAS_OUTRO_1); + break; + case EVENT_OUTRO_TERENAS_TALK_2: + if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f)) + { + terenas->AI()->Talk(SAY_TERENAS_OUTRO_2); + terenas->CastSpell((Unit*)NULL, SPELL_MASS_RESURRECTION, false); + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + lichKing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->RemoveAllAuras(); + SetEquipmentSlots(true); + me->Attack(lichKing, true); + me->GetMotionMaster()->MovePoint(0, 512.16f, -2120.25f, 840.86f); + } + _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_7, 7000); + _events.ScheduleEvent(EVENT_OUTRO_LK_TALK_8, 17000); + } + break; + case EVENT_OUTRO_LK_TALK_7: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + theLichKing->AI()->Talk(SAY_LK_OUTRO_7); + break; + case EVENT_OUTRO_LK_TALK_8: + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + theLichKing->AI()->Talk(SAY_LK_OUTRO_8); + break; + case EVENT_OUTRO_FORDRING_TALK_1: + Talk(SAY_TIRION_OUTRO_1); + break; + case EVENT_OUTRO_FORDRING_BLESS: + me->CastSpell(me, SPELL_LIGHTS_BLESSING, false); + break; + case EVENT_OUTRO_FORDRING_REMOVE_ICE: + me->RemoveAurasDueToSpell(SPELL_ICE_LOCK); + SetEquipmentSlots(false, EQUIP_ASHBRINGER_GLOWING); + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + me->SetFacingToObject(lichKing); + me->GetMap()->SetZoneMusic(AREA_THE_FROZEN_THRONE, MUSIC_FINAL); + } + break; + case EVENT_OUTRO_FORDRING_MOVE_1: + me->GetMotionMaster()->MovePoint(POINT_TIRION_OUTRO, OutroPosition1); + break; + case EVENT_OUTRO_FORDRING_JUMP: + me->CastSpell((Unit*)NULL, SPELL_JUMP, false); + break; - default: - break; - } + default: + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - if (!me->IsAlive()) - return; + void EnterEvadeMode() + { + if (!me->IsAlive()) + return; - if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - if (theLichKing->IsInEvadeMode()) - { - ScriptedAI::EnterEvadeMode(); - return; - } + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (theLichKing->IsInEvadeMode()) + { + ScriptedAI::EnterEvadeMode(); + return; + } - me->DeleteThreatList(); - me->CombatStop(false); - } + me->DeleteThreatList(); + me->CombatStop(false); + } - bool CanAIAttack(Unit const* target) const - { - return target->GetEntry() == NPC_THE_LICH_KING; - } + bool CanAIAttack(Unit const* target) const + { + return target->GetEntry() == NPC_THE_LICH_KING; + } - private: - EventMap _events; - InstanceScript* _instance; - }; + private: + EventMap _events; + InstanceScript* _instance; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_the_lich_king_quake : public SpellScriptLoader { - public: - spell_the_lich_king_quake() : SpellScriptLoader("spell_the_lich_king_quake") { } + public: + spell_the_lich_king_quake() : SpellScriptLoader("spell_the_lich_king_quake") { } - class spell_the_lich_king_quake_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_quake_SpellScript); + class spell_the_lich_king_quake_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_quake_SpellScript); - bool Load() - { - return GetCaster()->GetInstanceScript() != NULL; - } + bool Load() + { + return GetCaster()->GetInstanceScript() != NULL; + } - void FilterTargets(std::list& targets) - { - if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetData64(DATA_ARTHAS_PLATFORM))) - targets.remove_if(HeightDifferenceCheck(platform, 5.0f, false)); - } + void FilterTargets(std::list& targets) + { + if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetData64(DATA_ARTHAS_PLATFORM))) + targets.remove_if(HeightDifferenceCheck(platform, 5.0f, false)); + } - void HandleSendEvent(SpellEffIndex /*effIndex*/) - { - if (GetCaster()->IsAIEnabled) - GetCaster()->GetAI()->DoAction(ACTION_START_ATTACK); - } + void HandleSendEvent(SpellEffIndex /*effIndex*/) + { + if (GetCaster()->IsAIEnabled) + GetCaster()->GetAI()->DoAction(ACTION_START_ATTACK); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - OnEffectHit += SpellEffectFn(spell_the_lich_king_quake_SpellScript::HandleSendEvent, EFFECT_1, SPELL_EFFECT_SEND_EVENT); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnEffectHit += SpellEffectFn(spell_the_lich_king_quake_SpellScript::HandleSendEvent, EFFECT_1, SPELL_EFFECT_SEND_EVENT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_quake_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_quake_SpellScript(); + } }; class spell_the_lich_king_jump : public SpellScriptLoader { - public: - spell_the_lich_king_jump() : SpellScriptLoader("spell_the_lich_king_jump") { } + public: + spell_the_lich_king_jump() : SpellScriptLoader("spell_the_lich_king_jump") { } - class spell_the_lich_king_jump_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_jump_SpellScript); + class spell_the_lich_king_jump_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_jump_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetHitUnit()->RemoveAurasDueToSpell(SPELL_RAISE_DEAD); - GetHitUnit()->InterruptNonMeleeSpells(true); - GetHitUnit()->CastSpell((Unit*)NULL, SPELL_JUMP_2, true); - if (Creature* creature = GetHitCreature()) - creature->AI()->DoAction(ACTION_BREAK_FROSTMOURNE); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->RemoveAurasDueToSpell(SPELL_RAISE_DEAD); + GetHitUnit()->InterruptNonMeleeSpells(true); + GetHitUnit()->CastSpell((Unit*)NULL, SPELL_JUMP_2, true); + if (Creature* creature = GetHitCreature()) + creature->AI()->DoAction(ACTION_BREAK_FROSTMOURNE); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_jump_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_jump_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_jump_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_jump_SpellScript(); + } }; class spell_the_lich_king_jump_remove_aura : public SpellScriptLoader { - public: - spell_the_lich_king_jump_remove_aura() : SpellScriptLoader("spell_the_lich_king_jump_remove_aura") { } + public: + spell_the_lich_king_jump_remove_aura() : SpellScriptLoader("spell_the_lich_king_jump_remove_aura") { } - class spell_the_lich_king_jump_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_jump_SpellScript); + class spell_the_lich_king_jump_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_jump_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetHitUnit()->RemoveAurasDueToSpell(uint32(GetEffectValue())); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->RemoveAurasDueToSpell(uint32(GetEffectValue())); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_jump_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_jump_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_jump_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_jump_SpellScript(); + } }; class spell_the_lich_king_play_movie : public SpellScriptLoader { - public: - spell_the_lich_king_play_movie() : SpellScriptLoader("spell_the_lich_king_play_movie") { } + public: + spell_the_lich_king_play_movie() : SpellScriptLoader("spell_the_lich_king_play_movie") { } - class spell_the_lich_king_play_movie_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_play_movie_SpellScript); + class spell_the_lich_king_play_movie_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_play_movie_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sMovieStore.LookupEntry(MOVIE_FALL_OF_THE_LICH_KING)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sMovieStore.LookupEntry(MOVIE_FALL_OF_THE_LICH_KING)) + return false; + return true; + } - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Player* player = GetHitPlayer()) - player->SendMovieStart(MOVIE_FALL_OF_THE_LICH_KING); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Player* player = GetHitPlayer()) + player->SendMovieStart(MOVIE_FALL_OF_THE_LICH_KING); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_play_movie_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_play_movie_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_play_movie_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_play_movie_SpellScript(); + } }; /*** FIGHT STUFF BELOW ***/ class npc_shambling_horror_icc : public CreatureScript { - public: - npc_shambling_horror_icc() : CreatureScript("npc_shambling_horror_icc") { } + public: + npc_shambling_horror_icc() : CreatureScript("npc_shambling_horror_icc") { } - struct npc_shambling_horror_iccAI : public ScriptedAI - { - npc_shambling_horror_iccAI(Creature* creature) : ScriptedAI(creature) - { - _frenzied = false; - } + struct npc_shambling_horror_iccAI : public ScriptedAI + { + npc_shambling_horror_iccAI(Creature* creature) : ScriptedAI(creature) + { + _frenzied = false; + } - EventMap _events; - bool _frenzied; + EventMap _events; + bool _frenzied; - void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EVENT_SHOCKWAVE, urand(20000, 25000)); - _events.ScheduleEvent(EVENT_ENRAGE, urand(11000, 14000)); - } + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_SHOCKWAVE, urand(20000, 25000)); + _events.ScheduleEvent(EVENT_ENRAGE, urand(11000, 14000)); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (!_frenzied && IsHeroic() && me->HealthBelowPctDamaged(20, damage)) - { - _frenzied = true; - me->CastSpell(me, SPELL_FRENZY, true); - } - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (!_frenzied && IsHeroic() && me->HealthBelowPctDamaged(20, damage)) + { + _frenzied = true; + me->CastSpell(me, SPELL_FRENZY, true); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (uint32 eventId = _events.ExecuteEvent()) - { - case EVENT_SHOCKWAVE: - me->CastSpell(me->GetVictim(), SPELL_SHOCKWAVE, false); - _events.ScheduleEvent(EVENT_SHOCKWAVE, urand(20000, 25000)); - break; - case EVENT_ENRAGE: - me->CastSpell(me, SPELL_ENRAGE, false); - _events.ScheduleEvent(EVENT_ENRAGE, urand(20000, 25000)); - break; - default: - break; - } + switch (uint32 eventId = _events.ExecuteEvent()) + { + case EVENT_SHOCKWAVE: + me->CastSpell(me->GetVictim(), SPELL_SHOCKWAVE, false); + _events.ScheduleEvent(EVENT_SHOCKWAVE, urand(20000, 25000)); + break; + case EVENT_ENRAGE: + me->CastSpell(me, SPELL_ENRAGE, false); + _events.ScheduleEvent(EVENT_ENRAGE, urand(20000, 25000)); + break; + default: + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - bool CanAIAttack(Unit const* target) const - { - return IsValidPlatformTarget(target) && !target->GetVehicle(); - } - }; + bool CanAIAttack(Unit const* target) const + { + return IsValidPlatformTarget(target) && !target->GetVehicle(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_the_lich_king_infest : public SpellScriptLoader { - public: - spell_the_lich_king_infest() : SpellScriptLoader("spell_the_lich_king_infest") { } + public: + spell_the_lich_king_infest() : SpellScriptLoader("spell_the_lich_king_infest") { } - class spell_the_lich_king_infest_AuraScript : public AuraScript - { - PrepareAuraScript(spell_the_lich_king_infest_AuraScript); + class spell_the_lich_king_infest_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_infest_AuraScript); - void OnPeriodic(AuraEffect const* /*aurEff*/) - { - if (GetUnitOwner()->HealthAbovePct(90)) - { - PreventDefaultAction(); - Remove(AURA_REMOVE_BY_ENEMY_SPELL); - } - } + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (GetUnitOwner()->HealthAbovePct(90)) + { + PreventDefaultAction(); + Remove(AURA_REMOVE_BY_ENEMY_SPELL); + } + } - void OnUpdate(AuraEffect* aurEff) - { - // multiply, starting from 2nd tick - if (aurEff->GetTickNumber() == 1) - return; + void OnUpdate(AuraEffect* aurEff) + { + // multiply, starting from 2nd tick + if (aurEff->GetTickNumber() == 1) + return; - aurEff->SetAmount(int32(aurEff->GetAmount() * 1.15f)); - } + aurEff->SetAmount(int32(aurEff->GetAmount() * 1.15f)); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_infest_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_the_lich_king_infest_AuraScript::OnUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_infest_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_the_lich_king_infest_AuraScript::OnUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_the_lich_king_infest_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_infest_AuraScript(); + } }; class spell_the_lich_king_necrotic_plague : public SpellScriptLoader { - public: - spell_the_lich_king_necrotic_plague() : SpellScriptLoader("spell_the_lich_king_necrotic_plague") { } + public: + spell_the_lich_king_necrotic_plague() : SpellScriptLoader("spell_the_lich_king_necrotic_plague") { } - class spell_the_lich_king_necrotic_plague_AuraScript : public AuraScript - { - PrepareAuraScript(spell_the_lich_king_necrotic_plague_AuraScript); + class spell_the_lich_king_necrotic_plague_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_necrotic_plague_AuraScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_NECROTIC_PLAGUE_JUMP)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_NECROTIC_PLAGUE_JUMP)) + return false; + return true; + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - bool dispel = false; - switch (GetTargetApplication()->GetRemoveMode()) - { - case AURA_REMOVE_BY_ENEMY_SPELL: - dispel = true; - case AURA_REMOVE_BY_EXPIRE: - case AURA_REMOVE_BY_DEATH: - break; - default: - return; - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + bool dispel = false; + switch (GetTargetApplication()->GetRemoveMode()) + { + case AURA_REMOVE_BY_ENEMY_SPELL: + dispel = true; + case AURA_REMOVE_BY_EXPIRE: + case AURA_REMOVE_BY_DEATH: + break; + default: + return; + } - CustomSpellValues values; - if (dispel) - values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1) - GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); + CustomSpellValues values; + if (dispel) + values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1) + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); - if (Unit* caster = GetCaster()) - caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); - } + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_necrotic_plague_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_necrotic_plague_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_the_lich_king_necrotic_plague_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_necrotic_plague_AuraScript(); + } }; class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader { - public: - spell_the_lich_king_necrotic_plague_jump() : SpellScriptLoader("spell_the_lich_king_necrotic_plague_jump") { } + public: + spell_the_lich_king_necrotic_plague_jump() : SpellScriptLoader("spell_the_lich_king_necrotic_plague_jump") { } - class spell_the_lich_king_necrotic_plague_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_necrotic_plague_SpellScript); + class spell_the_lich_king_necrotic_plague_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_necrotic_plague_SpellScript); - bool Load() - { - _hadJumpingAura = false; - _hadInitialAura = false; - return true; - } + bool Load() + { + _hadJumpingAura = false; + _hadInitialAura = false; + return true; + } - void FilterTargets(std::list& targets) - { - targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); - if (targets.size() <= 1) - return; + void FilterTargets(std::list& targets) + { + targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); + if (targets.size() <= 1) + return; - targets.resize(1); - } + targets.resize(1); + } - void CheckAura() - { - if (GetHitUnit()->HasAura(GetSpellInfo()->Id)) - _hadJumpingAura = true; - else if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_NECROTIC_PLAGUE, GetHitUnit())) - if (GetHitUnit()->HasAura(spellId)) - _hadInitialAura = true; - } + void CheckAura() + { + if (GetHitUnit()->HasAura(GetSpellInfo()->Id)) + _hadJumpingAura = true; + else if (uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_NECROTIC_PLAGUE, GetHitUnit())) + if (GetHitUnit()->HasAura(spellId)) + _hadInitialAura = true; + } - void AddMissingStack() - { - if (GetHitAura() && !_hadJumpingAura) - { - uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_NECROTIC_PLAGUE, GetHitUnit()); - if (GetSpellValue()->EffectBasePoints[EFFECT_1] != AURA_REMOVE_BY_ENEMY_SPELL || _hadInitialAura) - GetHitAura()->ModStackAmount(1); - if (_hadInitialAura) - if (Aura* a = GetHitUnit()->GetAura(spellId)) - a->Remove(AURA_REMOVE_BY_DEFAULT); - } - } + void AddMissingStack() + { + if (GetHitAura() && !_hadJumpingAura) + { + uint32 spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_NECROTIC_PLAGUE, GetHitUnit()); + if (GetSpellValue()->EffectBasePoints[EFFECT_1] != AURA_REMOVE_BY_ENEMY_SPELL || _hadInitialAura) + GetHitAura()->ModStackAmount(1); + if (_hadInitialAura) + if (Aura* a = GetHitUnit()->GetAura(spellId)) + a->Remove(AURA_REMOVE_BY_DEFAULT); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_necrotic_plague_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - BeforeHit += SpellHitFn(spell_the_lich_king_necrotic_plague_SpellScript::CheckAura); - OnHit += SpellHitFn(spell_the_lich_king_necrotic_plague_SpellScript::AddMissingStack); - } + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_necrotic_plague_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + BeforeHit += SpellHitFn(spell_the_lich_king_necrotic_plague_SpellScript::CheckAura); + OnHit += SpellHitFn(spell_the_lich_king_necrotic_plague_SpellScript::AddMissingStack); + } - bool _hadJumpingAura; - bool _hadInitialAura; - }; + bool _hadJumpingAura; + bool _hadInitialAura; + }; - class spell_the_lich_king_necrotic_plague_AuraScript : public AuraScript - { - PrepareAuraScript(spell_the_lich_king_necrotic_plague_AuraScript); + class spell_the_lich_king_necrotic_plague_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_necrotic_plague_AuraScript); - bool Load() - { - _lastAmount = 0; - return true; - } + bool Load() + { + _lastAmount = 0; + return true; + } - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - if (caster->GetAI()) - caster->GetAI()->SetData(DATA_PLAGUE_STACK, GetStackAmount()); - } + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (caster->GetAI()) + caster->GetAI()->SetData(DATA_PLAGUE_STACK, GetStackAmount()); + } - void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - _lastAmount = aurEff->GetAmount(); - switch (GetTargetApplication()->GetRemoveMode()) - { - case AURA_REMOVE_BY_EXPIRE: - case AURA_REMOVE_BY_DEATH: - break; - default: - return; - } + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + _lastAmount = aurEff->GetAmount(); + switch (GetTargetApplication()->GetRemoveMode()) + { + case AURA_REMOVE_BY_EXPIRE: + case AURA_REMOVE_BY_DEATH: + break; + default: + return; + } - CustomSpellValues values; - values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); - GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); - if (Unit* caster = GetCaster()) - caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); - } + CustomSpellValues values; + values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); + } - void OnDispel(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - _lastAmount = aurEff->GetAmount(); - } + void OnDispel(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + _lastAmount = aurEff->GetAmount(); + } - void AfterDispel(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - // this means the stack increased so don't process as if dispelled - if (aurEff->GetAmount() > _lastAmount) - return; + void AfterDispel(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + // this means the stack increased so don't process as if dispelled + if (aurEff->GetAmount() > _lastAmount) + return; - CustomSpellValues values; - values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); - values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1) - GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); - if (Unit* caster = GetCaster()) - caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); + CustomSpellValues values; + values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); + values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1) + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID()); + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); - Remove(AURA_REMOVE_BY_ENEMY_SPELL); - } + Remove(AURA_REMOVE_BY_ENEMY_SPELL); + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_the_lich_king_necrotic_plague_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_necrotic_plague_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_necrotic_plague_AuraScript::OnDispel, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAPPLY); - AfterEffectApply += AuraEffectApplyFn(spell_the_lich_king_necrotic_plague_AuraScript::AfterDispel, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAPPLY); - } + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_the_lich_king_necrotic_plague_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_necrotic_plague_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_necrotic_plague_AuraScript::OnDispel, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAPPLY); + AfterEffectApply += AuraEffectApplyFn(spell_the_lich_king_necrotic_plague_AuraScript::AfterDispel, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAPPLY); + } - int32 _lastAmount; - }; + int32 _lastAmount; + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_necrotic_plague_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_necrotic_plague_SpellScript(); + } - AuraScript* GetAuraScript() const - { - return new spell_the_lich_king_necrotic_plague_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_necrotic_plague_AuraScript(); + } }; class spell_the_lich_king_shadow_trap_visual : public SpellScriptLoader { - public: - spell_the_lich_king_shadow_trap_visual() : SpellScriptLoader("spell_the_lich_king_shadow_trap_visual") { } + public: + spell_the_lich_king_shadow_trap_visual() : SpellScriptLoader("spell_the_lich_king_shadow_trap_visual") { } - class spell_the_lich_king_shadow_trap_visual_AuraScript : public AuraScript - { - PrepareAuraScript(spell_the_lich_king_shadow_trap_visual_AuraScript); + class spell_the_lich_king_shadow_trap_visual_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_shadow_trap_visual_AuraScript); - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) - GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_TRAP_AURA, TRIGGERED_NONE); - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) + GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_TRAP_AURA, TRIGGERED_NONE); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_shadow_trap_visual_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_shadow_trap_visual_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_the_lich_king_shadow_trap_visual_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_shadow_trap_visual_AuraScript(); + } }; class spell_the_lich_king_shadow_trap_periodic : public SpellScriptLoader { - public: - spell_the_lich_king_shadow_trap_periodic() : SpellScriptLoader("spell_the_lich_king_shadow_trap_periodic") { } + public: + spell_the_lich_king_shadow_trap_periodic() : SpellScriptLoader("spell_the_lich_king_shadow_trap_periodic") { } - class spell_the_lich_king_shadow_trap_periodic_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_shadow_trap_periodic_SpellScript); + class spell_the_lich_king_shadow_trap_periodic_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_shadow_trap_periodic_SpellScript); - void CheckTargetCount(std::list& targets) - { - if (targets.empty()) - return; + void CheckTargetCount(std::list& targets) + { + if (targets.empty()) + return; - GetCaster()->CastSpell((Unit*)NULL, SPELL_SHADOW_TRAP_KNOCKBACK, true); - if (Aura* a = GetCaster()->GetAura(SPELL_SHADOW_TRAP_AURA)) - a->SetDuration(0); - if (GetCaster()->GetTypeId() == TYPEID_UNIT) - GetCaster()->ToCreature()->DespawnOrUnsummon(3000); + GetCaster()->CastSpell((Unit*)NULL, SPELL_SHADOW_TRAP_KNOCKBACK, true); + if (Aura* a = GetCaster()->GetAura(SPELL_SHADOW_TRAP_AURA)) + a->SetDuration(0); + if (GetCaster()->GetTypeId() == TYPEID_UNIT) + GetCaster()->ToCreature()->DespawnOrUnsummon(3000); - } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_shadow_trap_periodic_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_shadow_trap_periodic_SpellScript(); + } }; class spell_the_lich_king_ice_burst_target_search : public SpellScriptLoader { - public: - spell_the_lich_king_ice_burst_target_search() : SpellScriptLoader("spell_the_lich_king_ice_burst_target_search") { } + public: + spell_the_lich_king_ice_burst_target_search() : SpellScriptLoader("spell_the_lich_king_ice_burst_target_search") { } - class spell_the_lich_king_ice_burst_target_search_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_ice_burst_target_search_SpellScript); + class spell_the_lich_king_ice_burst_target_search_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_ice_burst_target_search_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_ICE_BURST)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ICE_BURST)) + return false; + return true; + } - void CheckTargetCount(std::list& unitList) - { - if (unitList.empty()) - return; + void CheckTargetCount(std::list& unitList) + { + if (unitList.empty()) + return; - if (GetCaster()->GetTypeId() == TYPEID_UNIT) - GetCaster()->ToCreature()->AI()->DoAction(-1); - } + if (GetCaster()->GetTypeId() == TYPEID_UNIT) + GetCaster()->ToCreature()->AI()->DoAction(-1); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_ice_burst_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_ice_burst_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_ice_burst_target_search_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_ice_burst_target_search_SpellScript(); + } }; class npc_icc_ice_sphere : public CreatureScript { - public: - npc_icc_ice_sphere() : CreatureScript("npc_icc_ice_sphere") { } + public: + npc_icc_ice_sphere() : CreatureScript("npc_icc_ice_sphere") { } - struct npc_icc_ice_sphereAI : public ScriptedAI - { - npc_icc_ice_sphereAI(Creature* creature) : ScriptedAI(creature) - { - targetGUID = 0; - timer = 250; - me->SetReactState(REACT_PASSIVE); - } + struct npc_icc_ice_sphereAI : public ScriptedAI + { + npc_icc_ice_sphereAI(Creature* creature) : ScriptedAI(creature) + { + targetGUID = 0; + timer = 250; + me->SetReactState(REACT_PASSIVE); + } - uint64 targetGUID; - uint16 timer; + uint64 targetGUID; + uint16 timer; - void DoAction(int32 a) - { - if (a == -1) - { - me->RemoveAllAuras(); - me->CastSpell(me, SPELL_ICE_BURST, true); - me->DespawnOrUnsummon(1000); - targetGUID = 0; - timer = 9999; - me->InterruptNonMeleeSpells(true); - me->AttackStop(); - me->GetMotionMaster()->Clear(); - me->StopMoving(); - } - } + void DoAction(int32 a) + { + if (a == -1) + { + me->RemoveAllAuras(); + me->CastSpell(me, SPELL_ICE_BURST, true); + me->DespawnOrUnsummon(1000); + targetGUID = 0; + timer = 9999; + me->InterruptNonMeleeSpells(true); + me->AttackStop(); + me->GetMotionMaster()->Clear(); + me->StopMoving(); + } + } - void SelectNewTarget() - { - if (!me->HasAura(SPELL_ICE_SPHERE)) - me->CastSpell(me, SPELL_ICE_SPHERE, true); - targetGUID = 0; - me->InterruptNonMeleeSpells(true); - me->AttackStop(); - me->GetMotionMaster()->Clear(); - me->StopMoving(); - if (Player* p = ScriptedAI::SelectTargetFromPlayerList(120.0f, SPELL_ICE_PULSE, false)) - { - targetGUID = p->GetGUID(); - me->CastSpell(p, SPELL_ICE_PULSE, false); - me->ClearUnitState(UNIT_STATE_CASTING); - me->Attack(p, true); - me->GetMotionMaster()->MoveFollow(p, 0.01f, 0.0f); - } - } + void SelectNewTarget() + { + if (!me->HasAura(SPELL_ICE_SPHERE)) + me->CastSpell(me, SPELL_ICE_SPHERE, true); + targetGUID = 0; + me->InterruptNonMeleeSpells(true); + me->AttackStop(); + me->GetMotionMaster()->Clear(); + me->StopMoving(); + if (Player* p = ScriptedAI::SelectTargetFromPlayerList(120.0f, SPELL_ICE_PULSE, false)) + { + targetGUID = p->GetGUID(); + me->CastSpell(p, SPELL_ICE_PULSE, false); + me->ClearUnitState(UNIT_STATE_CASTING); + me->Attack(p, true); + me->GetMotionMaster()->MoveFollow(p, 0.01f, 0.0f); + } + } - void UpdateAI(uint32 diff) - { - if (timer > diff) - { - timer -= diff; - return; - } - timer = 1000; + void UpdateAI(uint32 diff) + { + if (timer > diff) + { + timer -= diff; + return; + } + timer = 1000; - if (!targetGUID || !me->GetVictim() || !me->IsNonMeleeSpellCast(false, false, true, false, true)) - SelectNewTarget(); - else - { - Unit* target = ObjectAccessor::GetUnit(*me, targetGUID); - if (me->GetVictim()->GetGUID() != targetGUID || !target || !me->IsValidAttackTarget(target) || target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH) || target->GetExactDist2dSq(&CenterPosition) > 75.0f*75.0f || target->GetPositionZ() < 830.0f || target->GetPositionZ() > 855.0f) - SelectNewTarget(); - } - } - }; + if (!targetGUID || !me->GetVictim() || !me->IsNonMeleeSpellCast(false, false, true, false, true)) + SelectNewTarget(); + else + { + Unit* target = ObjectAccessor::GetUnit(*me, targetGUID); + if (me->GetVictim()->GetGUID() != targetGUID || !target || !me->IsValidAttackTarget(target) || target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH) || target->GetExactDist2dSq(&CenterPosition) > 75.0f*75.0f || target->GetPositionZ() < 830.0f || target->GetPositionZ() > 855.0f) + SelectNewTarget(); + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_the_lich_king_raging_spirit : public SpellScriptLoader { - public: - spell_the_lich_king_raging_spirit() : SpellScriptLoader("spell_the_lich_king_raging_spirit") { } + public: + spell_the_lich_king_raging_spirit() : SpellScriptLoader("spell_the_lich_king_raging_spirit") { } - class spell_the_lich_king_raging_spirit_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_raging_spirit_SpellScript); + class spell_the_lich_king_raging_spirit_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_raging_spirit_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(target, uint32(GetEffectValue()), true, 0, 0, target->GetGUID()); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, uint32(GetEffectValue()), true, 0, 0, target->GetGUID()); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_raging_spirit_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_raging_spirit_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_raging_spirit_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_raging_spirit_SpellScript(); + } }; class npc_raging_spirit : public CreatureScript { - public: - npc_raging_spirit() : CreatureScript("npc_raging_spirit") { } + public: + npc_raging_spirit() : CreatureScript("npc_raging_spirit") { } - struct npc_raging_spiritAI : public ScriptedAI - { - npc_raging_spiritAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) - { - me->SetControlled(true, UNIT_STATE_ROOT); - } + struct npc_raging_spiritAI : public ScriptedAI + { + npc_raging_spiritAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) + { + me->SetControlled(true, UNIT_STATE_ROOT); + } - void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EVENT_RAGING_SPIRIT_UNROOT, 3000); - _events.ScheduleEvent(EVENT_SOUL_SHRIEK, urand(12000, 15000)); + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_RAGING_SPIRIT_UNROOT, 3000); + _events.ScheduleEvent(EVENT_SOUL_SHRIEK, urand(12000, 15000)); - bool valid = false; - me->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL, true); - if (TempSummon* summon = me->ToTempSummon()) - if (Unit* summoner = summon->GetSummoner()) - if (summoner->GetTypeId() == TYPEID_PLAYER && summoner->IsAlive() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap()) - { - valid = true; - summoner->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL_CLONE, true); - } - if (!valid) - { - if (Player* plr = ScriptedAI::SelectTargetFromPlayerList(100.0f, 0, true)) - plr->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL_CLONE, true); - else - me->DespawnOrUnsummon(1); - } - } + bool valid = false; + me->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL, true); + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* summoner = summon->GetSummoner()) + if (summoner->GetTypeId() == TYPEID_PLAYER && summoner->IsAlive() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap()) + { + valid = true; + summoner->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL_CLONE, true); + } + if (!valid) + { + if (Player* plr = ScriptedAI::SelectTargetFromPlayerList(100.0f, 0, true)) + plr->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL_CLONE, true); + else + me->DespawnOrUnsummon(1); + } + } - void IsSummonedBy(Unit* /*summoner*/) - { - // player is the spellcaster so register summon manually - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - lichKing->AI()->JustSummoned(me); - } + void IsSummonedBy(Unit* /*summoner*/) + { + // player is the spellcaster so register summon manually + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->JustSummoned(me); + } - void JustDied(Unit* /*killer*/) - { - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - lichKing->AI()->SummonedCreatureDespawn(me); - if (TempSummon* summon = me->ToTempSummon()) - { - summon->SetTimer(5000); - summon->SetTempSummonType(TEMPSUMMON_TIMED_DESPAWN); - } - } + void JustDied(Unit* /*killer*/) + { + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->SummonedCreatureDespawn(me); + if (TempSummon* summon = me->ToTempSummon()) + { + summon->SetTimer(5000); + summon->SetTempSummonType(TEMPSUMMON_TIMED_DESPAWN); + } + } - void AttackStart(Unit* who) - { - if (!me->HasUnitState(UNIT_STATE_ROOT)) - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (!me->HasUnitState(UNIT_STATE_ROOT)) + ScriptedAI::AttackStart(who); + } - void UpdateAI(uint32 diff) - { - UpdateVictim(); + void UpdateAI(uint32 diff) + { + UpdateVictim(); - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (uint32 eventId = _events.ExecuteEvent()) - { - case EVENT_RAGING_SPIRIT_UNROOT: - { - me->SetControlled(false, UNIT_STATE_ROOT); + switch (uint32 eventId = _events.ExecuteEvent()) + { + case EVENT_RAGING_SPIRIT_UNROOT: + { + me->SetControlled(false, UNIT_STATE_ROOT); - if (!me->getThreatManager().isThreatListEmpty()) - if (Unit* target = me->SelectVictim()) - AttackStart(target); - if (!me->GetVictim()) - { - bool valid = false; - if (TempSummon* summon = me->ToTempSummon()) - if (Unit* summoner = summon->GetSummoner()) - if (summoner->GetTypeId() == TYPEID_PLAYER && summoner->IsAlive() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap()) - { - valid = true; - AttackStart(summoner); - } - if (!valid) - if (Player* plr = ScriptedAI::SelectTargetFromPlayerList(100.0f, 0, true)) - AttackStart(plr); - } - DoZoneInCombat(NULL, 150.0f); - } - break; - case EVENT_SOUL_SHRIEK: - if (!me->HasReactState(REACT_PASSIVE)) - me->CastSpell(me->GetVictim(), SPELL_SOUL_SHRIEK, false); - _events.ScheduleEvent(EVENT_SOUL_SHRIEK, urand(12000, 15000)); - break; - default: - break; - } + if (!me->getThreatManager().isThreatListEmpty()) + if (Unit* target = me->SelectVictim()) + AttackStart(target); + if (!me->GetVictim()) + { + bool valid = false; + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* summoner = summon->GetSummoner()) + if (summoner->GetTypeId() == TYPEID_PLAYER && summoner->IsAlive() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap()) + { + valid = true; + AttackStart(summoner); + } + if (!valid) + if (Player* plr = ScriptedAI::SelectTargetFromPlayerList(100.0f, 0, true)) + AttackStart(plr); + } + DoZoneInCombat(NULL, 150.0f); + } + break; + case EVENT_SOUL_SHRIEK: + if (!me->HasReactState(REACT_PASSIVE)) + me->CastSpell(me->GetVictim(), SPELL_SOUL_SHRIEK, false); + _events.ScheduleEvent(EVENT_SOUL_SHRIEK, urand(12000, 15000)); + break; + default: + break; + } - if (!me->HasUnitState(UNIT_STATE_ROOT)) - DoMeleeAttackIfReady(); - } + if (!me->HasUnitState(UNIT_STATE_ROOT)) + DoMeleeAttackIfReady(); + } - bool CanAIAttack(Unit const* target) const - { - return IsValidPlatformTarget(target) && !target->GetVehicle(); - } + bool CanAIAttack(Unit const* target) const + { + return IsValidPlatformTarget(target) && !target->GetVehicle(); + } - private: - EventMap _events; - InstanceScript* _instance; - }; + private: + EventMap _events; + InstanceScript* _instance; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class VehicleCheck { public: - bool operator()(WorldObject* unit) - { - return (unit->GetTypeId() != TYPEID_UNIT && unit->GetTypeId() != TYPEID_PLAYER) || unit->ToUnit()->GetVehicle(); - } + bool operator()(WorldObject* unit) + { + return (unit->GetTypeId() != TYPEID_UNIT && unit->GetTypeId() != TYPEID_PLAYER) || unit->ToUnit()->GetVehicle(); + } }; class spell_the_lich_king_defile : public SpellScriptLoader { - public: - spell_the_lich_king_defile() : SpellScriptLoader("spell_the_lich_king_defile") { } + public: + spell_the_lich_king_defile() : SpellScriptLoader("spell_the_lich_king_defile") { } - class spell_the_lich_king_defile_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_defile_SpellScript); + class spell_the_lich_king_defile_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_defile_SpellScript); - void CorrectRange(std::list& targets) - { - targets.remove_if(VehicleCheck()); - targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 10.0f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X), true)); - uint32 strangulatedAura[4] = {68980, 74325, 74296, 74297}; - targets.remove_if(Trinity::UnitAuraCheck(true, strangulatedAura[GetCaster()->GetMap()->GetDifficulty()])); - } + void CorrectRange(std::list& targets) + { + targets.remove_if(VehicleCheck()); + targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 10.0f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X), true)); + uint32 strangulatedAura[4] = {68980, 74325, 74296, 74297}; + targets.remove_if(Trinity::UnitAuraCheck(true, strangulatedAura[GetCaster()->GetMap()->GetDifficulty()])); + } - void ChangeDamageAndGrow() - { - SetHitDamage(int32(GetHitDamage() * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X))); - // HACK: target player should cast this spell on defile - // however with current aura handling auras cast by different units - // cannot stack on the same aura object increasing the stack count - GetCaster()->CastSpell(GetCaster(), SPELL_DEFILE_GROW, true); - } + void ChangeDamageAndGrow() + { + SetHitDamage(int32(GetHitDamage() * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X))); + // HACK: target player should cast this spell on defile + // however with current aura handling auras cast by different units + // cannot stack on the same aura object increasing the stack count + GetCaster()->CastSpell(GetCaster(), SPELL_DEFILE_GROW, true); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - OnHit += SpellHitFn(spell_the_lich_king_defile_SpellScript::ChangeDamageAndGrow); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnHit += SpellHitFn(spell_the_lich_king_defile_SpellScript::ChangeDamageAndGrow); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_defile_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_defile_SpellScript(); + } }; class spell_the_lich_king_soul_reaper : public SpellScriptLoader { - public: - spell_the_lich_king_soul_reaper() : SpellScriptLoader("spell_the_lich_king_soul_reaper") { } + public: + spell_the_lich_king_soul_reaper() : SpellScriptLoader("spell_the_lich_king_soul_reaper") { } - class spell_the_lich_king_soul_reaper_AuraScript : public AuraScript - { - PrepareAuraScript(spell_the_lich_king_soul_reaper_AuraScript); + class spell_the_lich_king_soul_reaper_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_soul_reaper_AuraScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_SOUL_REAPER_BUFF)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SOUL_REAPER_BUFF)) + return false; + return true; + } - void OnPeriodic(AuraEffect const* /*aurEff*/) - { - if (Unit* caster = GetCaster()) - GetTarget()->CastSpell(caster, SPELL_SOUL_REAPER_BUFF, true); - } + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (Unit* caster = GetCaster()) + GetTarget()->CastSpell(caster, SPELL_SOUL_REAPER_BUFF, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_soul_reaper_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_soul_reaper_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_the_lich_king_soul_reaper_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_soul_reaper_AuraScript(); + } }; class npc_valkyr_shadowguard : public CreatureScript { - public: - npc_valkyr_shadowguard() : CreatureScript("npc_valkyr_shadowguard") { } + public: + npc_valkyr_shadowguard() : CreatureScript("npc_valkyr_shadowguard") { } - struct npc_valkyr_shadowguardAI : public NullCreatureAI - { - npc_valkyr_shadowguardAI(Creature* creature) : NullCreatureAI(creature), _grabbedPlayer(0), didbelow50pct(false), dropped(false), _instance(creature->GetInstanceScript()) - { - me->SetReactState(REACT_PASSIVE); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); - _events.Reset(); - _events.ScheduleEvent(EVENT_GRAB_PLAYER, 2500); - me->SetWalk(false); - } + struct npc_valkyr_shadowguardAI : public NullCreatureAI + { + npc_valkyr_shadowguardAI(Creature* creature) : NullCreatureAI(creature), _grabbedPlayer(0), didbelow50pct(false), dropped(false), _instance(creature->GetInstanceScript()) + { + me->SetReactState(REACT_PASSIVE); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); + _events.Reset(); + _events.ScheduleEvent(EVENT_GRAB_PLAYER, 2500); + me->SetWalk(false); + } - EventMap _events; - InstanceScript* _instance; - Position _destPoint; - uint64 _grabbedPlayer; - bool didbelow50pct; - bool dropped; + EventMap _events; + InstanceScript* _instance; + Position _destPoint; + uint64 _grabbedPlayer; + bool didbelow50pct; + bool dropped; - bool IsHeroic() { return me->GetMap()->IsHeroic(); } + bool IsHeroic() { return me->GetMap()->IsHeroic(); } - void GoSiphon() - { - didbelow50pct = true; - me->CastSpell((Unit*)NULL, SPELL_EJECT_ALL_PASSENGERS, false); - float dist = rand_norm()*10.0f + 5.0f; - float angle = CenterPosition.GetAngle(me); - _destPoint.Relocate(CenterPosition.GetPositionX()+dist*cos(angle), CenterPosition.GetPositionY()+dist*sin(angle), 855.0f+frand(0.0f, 4.0f), 0.0f); - me->SetHomePosition(_destPoint); - _events.Reset(); - _events.ScheduleEvent(EVENT_MOVE_TO_SIPHON_POS, 0); - } + void GoSiphon() + { + didbelow50pct = true; + me->CastSpell((Unit*)NULL, SPELL_EJECT_ALL_PASSENGERS, false); + float dist = rand_norm()*10.0f + 5.0f; + float angle = CenterPosition.GetAngle(me); + _destPoint.Relocate(CenterPosition.GetPositionX()+dist*cos(angle), CenterPosition.GetPositionY()+dist*sin(angle), 855.0f+frand(0.0f, 4.0f), 0.0f); + me->SetHomePosition(_destPoint); + _events.Reset(); + _events.ScheduleEvent(EVENT_MOVE_TO_SIPHON_POS, 0); + } - void OnCharmed(bool apply) {} + void OnCharmed(bool apply) {} - void PassengerBoarded(Unit* pass, int8 seat, bool apply) - { - if (apply) - { - //pass->ClearUnitState(UNIT_STATE_ONVEHICLE); - return; - } - pass->RemoveAurasDueToSpell(VEHICLE_SPELL_PARACHUTE); - if (didbelow50pct || dropped) - return; - if (IsHeroic()) - GoSiphon(); - else - me->DespawnOrUnsummon(1000); - } + void PassengerBoarded(Unit* pass, int8 seat, bool apply) + { + if (apply) + { + //pass->ClearUnitState(UNIT_STATE_ONVEHICLE); + return; + } + pass->RemoveAurasDueToSpell(VEHICLE_SPELL_PARACHUTE); + if (didbelow50pct || dropped) + return; + if (IsHeroic()) + GoSiphon(); + else + me->DespawnOrUnsummon(1000); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (IsHeroic() && !didbelow50pct && !dropped && me->HealthBelowPctDamaged(50, damage)) - GoSiphon(); - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (IsHeroic() && !didbelow50pct && !dropped && me->HealthBelowPctDamaged(50, damage)) + GoSiphon(); + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; - switch (id) - { - case EVENT_CHARGE: - { - bool valid = false; - if (Player* target = ObjectAccessor::GetPlayer(*me, _grabbedPlayer)) - if (target->FindMap() == me->GetMap() && target->GetExactDist(me) < 15.0f && !target->GetVehicle()) - if (GameObject* platform = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_ARTHAS_PLATFORM))) - { - std::list triggers; - GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 150.0f); - triggers.remove_if(HeightDifferenceCheck(platform, 5.0f, true)); - if (!triggers.empty()) - { - valid = true; - triggers.sort(Trinity::ObjectDistanceOrderPred(me)); + switch (id) + { + case EVENT_CHARGE: + { + bool valid = false; + if (Player* target = ObjectAccessor::GetPlayer(*me, _grabbedPlayer)) + if (target->FindMap() == me->GetMap() && target->GetExactDist(me) < 15.0f && !target->GetVehicle()) + if (GameObject* platform = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_ARTHAS_PLATFORM))) + { + std::list triggers; + GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 150.0f); + triggers.remove_if(HeightDifferenceCheck(platform, 5.0f, true)); + if (!triggers.empty()) + { + valid = true; + triggers.sort(Trinity::ObjectDistanceOrderPred(me)); - target->GetMotionMaster()->Clear(); - target->UpdatePosition(*me, true); - target->StopMovingOnCurrentPos(); + target->GetMotionMaster()->Clear(); + target->UpdatePosition(*me, true); + target->StopMovingOnCurrentPos(); - me->CastSpell(target, SPELL_VALKYR_CARRY, false); - _destPoint.Relocate(triggers.front()); - _events.Reset(); - _events.ScheduleEvent(EVENT_MOVE_TO_DROP_POS, 1000); - } - } - if (!valid) - { - _events.Reset(); - _events.ScheduleEvent(EVENT_GRAB_PLAYER, 500); - _grabbedPlayer = 0; - } - } - break; - case POINT_DROP_PLAYER: - { - if (didbelow50pct || dropped) - break; - if (me->GetExactDist(&_destPoint) > 1.5f) // movement was interrupted (probably by a stun, start again) - { - _events.Reset(); - _events.ScheduleEvent(EVENT_MOVE_TO_DROP_POS, 0); - break; - } - dropped = true; - _events.Reset(); - Player* p = NULL; - if (Vehicle* v = me->GetVehicleKit()) - if (Unit* passenger = v->GetPassenger(0)) - p = passenger->ToPlayer(); - me->CastSpell((Unit*)NULL, SPELL_EJECT_ALL_PASSENGERS, false); + me->CastSpell(target, SPELL_VALKYR_CARRY, false); + _destPoint.Relocate(triggers.front()); + _events.Reset(); + _events.ScheduleEvent(EVENT_MOVE_TO_DROP_POS, 1000); + } + } + if (!valid) + { + _events.Reset(); + _events.ScheduleEvent(EVENT_GRAB_PLAYER, 500); + _grabbedPlayer = 0; + } + } + break; + case POINT_DROP_PLAYER: + { + if (didbelow50pct || dropped) + break; + if (me->GetExactDist(&_destPoint) > 1.5f) // movement was interrupted (probably by a stun, start again) + { + _events.Reset(); + _events.ScheduleEvent(EVENT_MOVE_TO_DROP_POS, 0); + break; + } + dropped = true; + _events.Reset(); + Player* p = NULL; + if (Vehicle* v = me->GetVehicleKit()) + if (Unit* passenger = v->GetPassenger(0)) + p = passenger->ToPlayer(); + me->CastSpell((Unit*)NULL, SPELL_EJECT_ALL_PASSENGERS, false); - if (IsHeroic()) - GoSiphon(); - else - me->DespawnOrUnsummon(1000); - } - break; - case POINT_START_SIPHON: - if (me->GetExactDist(&_destPoint) > 1.5f) // movement was interrupted (probably by a stun, start again) - { - _events.Reset(); - _events.ScheduleEvent(EVENT_MOVE_TO_SIPHON_POS, 0); - break; - } - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false); - _events.ScheduleEvent(EVENT_LIFE_SIPHON, 2000); - break; - } - } + if (IsHeroic()) + GoSiphon(); + else + me->DespawnOrUnsummon(1000); + } + break; + case POINT_START_SIPHON: + if (me->GetExactDist(&_destPoint) > 1.5f) // movement was interrupted (probably by a stun, start again) + { + _events.Reset(); + _events.ScheduleEvent(EVENT_MOVE_TO_SIPHON_POS, 0); + break; + } + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false); + _events.ScheduleEvent(EVENT_LIFE_SIPHON, 2000); + break; + } + } - void SetGUID(uint64 guid, int32 /* = 0*/) - { - _grabbedPlayer = guid; - } + void SetGUID(uint64 guid, int32 /* = 0*/) + { + _grabbedPlayer = guid; + } - void UpdateAI(uint32 diff) - { - _events.Update(diff); + void UpdateAI(uint32 diff) + { + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED)) + return; - switch (uint32 eventId = _events.ExecuteEvent()) - { - case EVENT_GRAB_PLAYER: - if (!_grabbedPlayer) - { - me->CastSpell((Unit*)NULL, SPELL_VALKYR_TARGET_SEARCH, false); - _events.ScheduleEvent(EVENT_GRAB_PLAYER, 2000); - } - break; - case EVENT_MOVE_TO_DROP_POS: - me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - me->SetDisableGravity(false); - me->SetHover(false); - me->SetCanFly(false); - me->GetMotionMaster()->MovePoint(POINT_DROP_PLAYER, _destPoint, false); - me->SetDisableGravity(true, true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - break; - case EVENT_MOVE_TO_SIPHON_POS: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // just in case if passenger disappears so quickly that EVENT_MOVE_TO_DROP_POS is never executed - { int32 bp0 = 80; me->CastCustomSpell(me, 1557, &bp0, NULL, NULL, true); } - me->SetDisableGravity(true); - me->SetHover(true); - me->SetCanFly(true); - me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MovePoint(POINT_START_SIPHON, _destPoint); - break; - case EVENT_LIFE_SIPHON: - { - Unit* target = NULL; - Unit::AuraEffectList const& tauntAuras = me->GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT); - if (!tauntAuras.empty()) - for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr) - if (Unit* caster = (*itr)->GetCaster()) - if (me->IsValidAttackTarget(caster)) - { - target = caster; - break; - } - if (!target) - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - target = lichKing->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankLKTargetSelector(lichKing, true, false, 100.0f)); - if (target) - me->CastSpell(target, SPELL_LIFE_SIPHON, false); - _events.ScheduleEvent(EVENT_LIFE_SIPHON, 2500); - } - break; - default: - break; - } - } - }; + switch (uint32 eventId = _events.ExecuteEvent()) + { + case EVENT_GRAB_PLAYER: + if (!_grabbedPlayer) + { + me->CastSpell((Unit*)NULL, SPELL_VALKYR_TARGET_SEARCH, false); + _events.ScheduleEvent(EVENT_GRAB_PLAYER, 2000); + } + break; + case EVENT_MOVE_TO_DROP_POS: + me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + me->SetDisableGravity(false); + me->SetHover(false); + me->SetCanFly(false); + me->GetMotionMaster()->MovePoint(POINT_DROP_PLAYER, _destPoint, false); + me->SetDisableGravity(true, true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + break; + case EVENT_MOVE_TO_SIPHON_POS: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); // just in case if passenger disappears so quickly that EVENT_MOVE_TO_DROP_POS is never executed + { int32 bp0 = 80; me->CastCustomSpell(me, 1557, &bp0, NULL, NULL, true); } + me->SetDisableGravity(true); + me->SetHover(true); + me->SetCanFly(true); + me->SendMovementFlagUpdate(); + me->GetMotionMaster()->MovePoint(POINT_START_SIPHON, _destPoint); + break; + case EVENT_LIFE_SIPHON: + { + Unit* target = NULL; + Unit::AuraEffectList const& tauntAuras = me->GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT); + if (!tauntAuras.empty()) + for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr) + if (Unit* caster = (*itr)->GetCaster()) + if (me->IsValidAttackTarget(caster)) + { + target = caster; + break; + } + if (!target) + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + target = lichKing->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankLKTargetSelector(lichKing, true, false, 100.0f)); + if (target) + me->CastSpell(target, SPELL_LIFE_SIPHON, false); + _events.ScheduleEvent(EVENT_LIFE_SIPHON, 2500); + } + break; + default: + break; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_the_lich_king_summon_into_air : public SpellScriptLoader { - public: - spell_the_lich_king_summon_into_air() : SpellScriptLoader("spell_the_lich_king_summon_into_air") { } + public: + spell_the_lich_king_summon_into_air() : SpellScriptLoader("spell_the_lich_king_summon_into_air") { } - class spell_the_lich_king_summon_into_air_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_summon_into_air_SpellScript); + class spell_the_lich_king_summon_into_air_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_summon_into_air_SpellScript); - void ModDestHeight(SpellEffIndex effIndex) - { - float addZ; - switch (GetSpellInfo()->Effects[effIndex].MiscValue) - { - case NPC_SPIRIT_BOMB: addZ = 30.0f; break; - case NPC_VILE_SPIRIT: addZ = 13.0f; break; - default: addZ = 15.0f; break; - } - Position const offset = {0.0f, 0.0f, addZ, 0.0f}; - WorldLocation* dest = const_cast(GetExplTargetDest()); - dest->RelocateOffset(offset); - GetHitDest()->RelocateOffset(offset); - } + void ModDestHeight(SpellEffIndex effIndex) + { + float addZ; + switch (GetSpellInfo()->Effects[effIndex].MiscValue) + { + case NPC_SPIRIT_BOMB: addZ = 30.0f; break; + case NPC_VILE_SPIRIT: addZ = 13.0f; break; + default: addZ = 15.0f; break; + } + Position const offset = {0.0f, 0.0f, addZ, 0.0f}; + WorldLocation* dest = const_cast(GetExplTargetDest()); + dest->RelocateOffset(offset); + GetHitDest()->RelocateOffset(offset); + } - void Register() - { - OnEffectHit += SpellEffectFn(spell_the_lich_king_summon_into_air_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); - } - }; + void Register() + { + OnEffectHit += SpellEffectFn(spell_the_lich_king_summon_into_air_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_summon_into_air_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_summon_into_air_SpellScript(); + } }; class spell_the_lich_king_teleport_to_frostmourne_hc : public SpellScriptLoader { - public: - spell_the_lich_king_teleport_to_frostmourne_hc() : SpellScriptLoader("spell_the_lich_king_teleport_to_frostmourne_hc") { } + public: + spell_the_lich_king_teleport_to_frostmourne_hc() : SpellScriptLoader("spell_the_lich_king_teleport_to_frostmourne_hc") { } - class spell_the_lich_king_teleport_to_frostmourne_hc_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_teleport_to_frostmourne_hc_SpellScript); + class spell_the_lich_king_teleport_to_frostmourne_hc_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_teleport_to_frostmourne_hc_SpellScript); - void ModDest(SpellEffIndex effIndex) - { - float dist = 2.0f + rand_norm()*18.0f; - float angle = rand_norm()*2*M_PI; - Position const offset = {dist*cos(angle), dist*sin(angle), 0.0f, 0.0f}; - WorldLocation* dest = const_cast(GetExplTargetDest()); - dest->RelocateOffset(offset); - GetHitDest()->RelocateOffset(offset); - } + void ModDest(SpellEffIndex effIndex) + { + float dist = 2.0f + rand_norm()*18.0f; + float angle = rand_norm()*2*M_PI; + Position const offset = {dist*cos(angle), dist*sin(angle), 0.0f, 0.0f}; + WorldLocation* dest = const_cast(GetExplTargetDest()); + dest->RelocateOffset(offset); + GetHitDest()->RelocateOffset(offset); + } - void Register() - { - OnEffectHit += SpellEffectFn(spell_the_lich_king_teleport_to_frostmourne_hc_SpellScript::ModDest, EFFECT_1, SPELL_EFFECT_TELEPORT_UNITS); - } - }; + void Register() + { + OnEffectHit += SpellEffectFn(spell_the_lich_king_teleport_to_frostmourne_hc_SpellScript::ModDest, EFFECT_1, SPELL_EFFECT_TELEPORT_UNITS); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_teleport_to_frostmourne_hc_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_teleport_to_frostmourne_hc_SpellScript(); + } }; class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader { - public: - spell_the_lich_king_valkyr_target_search() : SpellScriptLoader("spell_the_lich_king_valkyr_target_search") { } + public: + spell_the_lich_king_valkyr_target_search() : SpellScriptLoader("spell_the_lich_king_valkyr_target_search") { } - class spell_the_lich_king_valkyr_target_search_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_valkyr_target_search_SpellScript); + class spell_the_lich_king_valkyr_target_search_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_valkyr_target_search_SpellScript); - WorldObject* _target; + WorldObject* _target; - bool Load() - { - _target = NULL; - return true; - } + bool Load() + { + _target = NULL; + return true; + } - void SelectTarget(std::list& targets) - { - if (targets.empty()) - return; - Creature* caster = GetCaster()->ToCreature(); - if (!caster) - { - targets.clear(); - return; - } - targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_BOSS_HITTIN_YA_AURA)); // done in dbc, but just to be sure xd - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_HARVEST_SOUL_VALKYR)); - if (InstanceScript* _instance = caster->GetInstanceScript()) - if (Creature* lichKing = ObjectAccessor::GetCreature(*caster, _instance->GetData64(DATA_THE_LICH_KING))) - if (Spell* s = lichKing->GetCurrentSpell(CURRENT_GENERIC_SPELL)) - if (s->GetSpellInfo()->Id == SPELL_DEFILE && s->m_targets.GetUnitTarget()) - targets.remove(s->m_targets.GetUnitTarget()); + void SelectTarget(std::list& targets) + { + if (targets.empty()) + return; + Creature* caster = GetCaster()->ToCreature(); + if (!caster) + { + targets.clear(); + return; + } + targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_BOSS_HITTIN_YA_AURA)); // done in dbc, but just to be sure xd + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_HARVEST_SOUL_VALKYR)); + if (InstanceScript* _instance = caster->GetInstanceScript()) + if (Creature* lichKing = ObjectAccessor::GetCreature(*caster, _instance->GetData64(DATA_THE_LICH_KING))) + if (Spell* s = lichKing->GetCurrentSpell(CURRENT_GENERIC_SPELL)) + if (s->GetSpellInfo()->Id == SPELL_DEFILE && s->m_targets.GetUnitTarget()) + targets.remove(s->m_targets.GetUnitTarget()); - if (targets.empty()) - return; + if (targets.empty()) + return; - _target = Trinity::Containers::SelectRandomContainerElement(targets); - targets.clear(); - targets.push_back(_target); - if (Creature* caster = GetCaster()->ToCreature()) - caster->AI()->SetGUID(_target->GetGUID()); - } + _target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(_target); + if (Creature* caster = GetCaster()->ToCreature()) + caster->AI()->SetGUID(_target->GetGUID()); + } - void ReplaceTarget(std::list& targets) - { - targets.clear(); - if (_target) - targets.push_back(_target); - } + void ReplaceTarget(std::list& targets) + { + targets.clear(); + if (_target) + targets.push_back(_target); + } - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - { - GetCaster()->GetMotionMaster()->MoveCharge(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+4.0f, 42.0f, EVENT_CHARGE); - GetCaster()->SetDisableGravity(true, true); - } - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + { + GetCaster()->GetMotionMaster()->MoveCharge(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+4.0f, 42.0f, EVENT_CHARGE); + GetCaster()->SetDisableGravity(true, true); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_valkyr_target_search_SpellScript::ReplaceTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_valkyr_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_valkyr_target_search_SpellScript::ReplaceTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_valkyr_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_valkyr_target_search_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_valkyr_target_search_SpellScript(); + } }; class spell_the_lich_king_cast_back_to_caster : public SpellScriptLoader { - public: - spell_the_lich_king_cast_back_to_caster() : SpellScriptLoader("spell_the_lich_king_cast_back_to_caster") { } + public: + spell_the_lich_king_cast_back_to_caster() : SpellScriptLoader("spell_the_lich_king_cast_back_to_caster") { } - class spell_the_lich_king_cast_back_to_caster_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_cast_back_to_caster_SpellScript); + class spell_the_lich_king_cast_back_to_caster_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_cast_back_to_caster_SpellScript); - void HandleScript(SpellEffIndex /*effIndex*/) - { - GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); - } + void HandleScript(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_cast_back_to_caster_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_cast_back_to_caster_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_cast_back_to_caster_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_cast_back_to_caster_SpellScript(); + } }; class spell_the_lich_king_life_siphon : public SpellScriptLoader { - public: - spell_the_lich_king_life_siphon() : SpellScriptLoader("spell_the_lich_king_life_siphon") { } + public: + spell_the_lich_king_life_siphon() : SpellScriptLoader("spell_the_lich_king_life_siphon") { } - class spell_the_lich_king_life_siphon_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_life_siphon_SpellScript); + class spell_the_lich_king_life_siphon_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_life_siphon_SpellScript); - bool Validate(SpellInfo const* /*spell*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_SIPHON_HEAL)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_SIPHON_HEAL)) + return false; + return true; + } - void TriggerHeal() - { - GetHitUnit()->CastCustomSpell(SPELL_LIFE_SIPHON_HEAL, SPELLVALUE_BASE_POINT0, GetHitDamage() * 10, GetCaster(), true); - } + void TriggerHeal() + { + GetHitUnit()->CastCustomSpell(SPELL_LIFE_SIPHON_HEAL, SPELLVALUE_BASE_POINT0, GetHitDamage() * 10, GetCaster(), true); + } - void Register() - { - AfterHit += SpellHitFn(spell_the_lich_king_life_siphon_SpellScript::TriggerHeal); - } - }; + void Register() + { + AfterHit += SpellHitFn(spell_the_lich_king_life_siphon_SpellScript::TriggerHeal); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_life_siphon_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_life_siphon_SpellScript(); + } }; class spell_the_lich_king_vile_spirits : public SpellScriptLoader { - public: - spell_the_lich_king_vile_spirits() : SpellScriptLoader("spell_the_lich_king_vile_spirits") { } + public: + spell_the_lich_king_vile_spirits() : SpellScriptLoader("spell_the_lich_king_vile_spirits") { } - class spell_the_lich_king_vile_spirits_AuraScript : public AuraScript - { - PrepareAuraScript(spell_the_lich_king_vile_spirits_AuraScript); + class spell_the_lich_king_vile_spirits_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_vile_spirits_AuraScript); - bool Load() - { - _is25Man = GetUnitOwner()->GetMap()->Is25ManRaid(); - return true; - } + bool Load() + { + _is25Man = GetUnitOwner()->GetMap()->Is25ManRaid(); + return true; + } - void OnPeriodic(AuraEffect const* aurEff) - { - if (_is25Man || ((aurEff->GetTickNumber() - 1) % 5)) - GetTarget()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, NULL, aurEff, GetCasterGUID()); - } + void OnPeriodic(AuraEffect const* aurEff) + { + if (_is25Man || ((aurEff->GetTickNumber() - 1) % 5)) + GetTarget()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, NULL, aurEff, GetCasterGUID()); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_vile_spirits_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_vile_spirits_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } - bool _is25Man; - }; + bool _is25Man; + }; - AuraScript* GetAuraScript() const - { - return new spell_the_lich_king_vile_spirits_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_vile_spirits_AuraScript(); + } }; class spell_the_lich_king_vile_spirits_visual : public SpellScriptLoader { - public: - spell_the_lich_king_vile_spirits_visual() : SpellScriptLoader("spell_the_lich_king_vile_spirits_visual") { } + public: + spell_the_lich_king_vile_spirits_visual() : SpellScriptLoader("spell_the_lich_king_vile_spirits_visual") { } - class spell_the_lich_king_vile_spirits_visual_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_vile_spirits_visual_SpellScript); + class spell_the_lich_king_vile_spirits_visual_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_vile_spirits_visual_SpellScript); - void ModDestHeight(SpellEffIndex /*effIndex*/) - { - Position offset = {0.0f, 0.0f, 15.0f, 0.0f}; - const_cast(GetExplTargetDest())->RelocateOffset(offset); - } + void ModDestHeight(SpellEffIndex /*effIndex*/) + { + Position offset = {0.0f, 0.0f, 15.0f, 0.0f}; + const_cast(GetExplTargetDest())->RelocateOffset(offset); + } - void Register() - { - OnEffectLaunch += SpellEffectFn(spell_the_lich_king_vile_spirits_visual_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_the_lich_king_vile_spirits_visual_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_vile_spirits_visual_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_vile_spirits_visual_SpellScript(); + } }; class spell_the_lich_king_vile_spirit_move_target_search : public SpellScriptLoader { - public: - spell_the_lich_king_vile_spirit_move_target_search() : SpellScriptLoader("spell_the_lich_king_vile_spirit_move_target_search") { } + public: + spell_the_lich_king_vile_spirit_move_target_search() : SpellScriptLoader("spell_the_lich_king_vile_spirit_move_target_search") { } - class spell_the_lich_king_vile_spirit_move_target_search_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_vile_spirit_move_target_search_SpellScript); + class spell_the_lich_king_vile_spirit_move_target_search_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_vile_spirit_move_target_search_SpellScript); - bool Load() - { - _target = NULL; - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + _target = NULL; + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } - void SelectTarget(std::list& targets) - { - if (targets.empty()) - return; + void SelectTarget(std::list& targets) + { + if (targets.empty()) + return; - _target = Trinity::Containers::SelectRandomContainerElement(targets); - } + _target = Trinity::Containers::SelectRandomContainerElement(targets); + } - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (GetHitUnit() != _target) - return; + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (GetHitUnit() != _target) + return; - GetCaster()->ToCreature()->SetInCombatWithZone(); - GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit()); - GetCaster()->AddThreat(GetHitUnit(), GetCaster()->GetMaxHealth()*0.2f); - } + GetCaster()->ToCreature()->SetInCombatWithZone(); + GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit()); + GetCaster()->AddThreat(GetHitUnit(), GetCaster()->GetMaxHealth()*0.2f); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } - WorldObject* _target; - }; + WorldObject* _target; + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_vile_spirit_move_target_search_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_vile_spirit_move_target_search_SpellScript(); + } }; class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptLoader { - public: - spell_the_lich_king_vile_spirit_damage_target_search() : SpellScriptLoader("spell_the_lich_king_vile_spirit_damage_target_search") { } + public: + spell_the_lich_king_vile_spirit_damage_target_search() : SpellScriptLoader("spell_the_lich_king_vile_spirit_damage_target_search") { } - class spell_the_lich_king_vile_spirit_damage_target_search_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript); + class spell_the_lich_king_vile_spirit_damage_target_search_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript); - void CheckTargetCount(std::list& targets) - { - if (targets.empty()) - return; + void CheckTargetCount(std::list& targets) + { + if (targets.empty()) + return; - if (TempSummon* summon = GetCaster()->ToTempSummon()) - if (Unit* summoner = summon->GetSummoner()) - summoner->GetAI()->SetData(DATA_VILE, 1); + if (TempSummon* summon = GetCaster()->ToTempSummon()) + if (Unit* summoner = summon->GetSummoner()) + summoner->GetAI()->SetData(DATA_VILE, 1); - if (Creature* c = GetCaster()->ToCreature()) - { - c->RemoveAurasDueToSpell(SPELL_VILE_SPIRIT_DAMAGE_SEARCH); - c->GetMotionMaster()->Clear(true); - c->StopMoving(); - c->CastSpell((Unit*)NULL, SPELL_SPIRIT_BURST, true); - c->DespawnOrUnsummon(3000); - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - } + if (Creature* c = GetCaster()->ToCreature()) + { + c->RemoveAurasDueToSpell(SPELL_VILE_SPIRIT_DAMAGE_SEARCH); + c->GetMotionMaster()->Clear(true); + c->StopMoving(); + c->CastSpell((Unit*)NULL, SPELL_SPIRIT_BURST, true); + c->DespawnOrUnsummon(3000); + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_vile_spirit_damage_target_search_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_vile_spirit_damage_target_search_SpellScript(); + } }; class spell_the_lich_king_harvest_soul : public SpellScriptLoader { - public: - spell_the_lich_king_harvest_soul() : SpellScriptLoader("spell_the_lich_king_harvest_soul") { } + public: + spell_the_lich_king_harvest_soul() : SpellScriptLoader("spell_the_lich_king_harvest_soul") { } - class spell_the_lich_king_harvest_soul_AuraScript : public AuraScript - { - PrepareAuraScript(spell_the_lich_king_harvest_soul_AuraScript); + class spell_the_lich_king_harvest_soul_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_harvest_soul_AuraScript); - bool Load() - { - return GetOwner()->GetInstanceScript() != NULL; - } + bool Load() + { + return GetOwner()->GetInstanceScript() != NULL; + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - // m_originalCaster to allow stacking from different casters, meh - if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) - GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetData64(DATA_THE_LICH_KING)); - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + // m_originalCaster to allow stacking from different casters, meh + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) + GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetData64(DATA_THE_LICH_KING)); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_harvest_soul_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_harvest_soul_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_the_lich_king_harvest_soul_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_harvest_soul_AuraScript(); + } }; class npc_strangulate_vehicle : public CreatureScript { - public: - npc_strangulate_vehicle() : CreatureScript("npc_strangulate_vehicle") { } + public: + npc_strangulate_vehicle() : CreatureScript("npc_strangulate_vehicle") { } - struct npc_strangulate_vehicleAI : public NullCreatureAI - { - npc_strangulate_vehicleAI(Creature* creature) : NullCreatureAI(creature), _instance(creature->GetInstanceScript()) {} + struct npc_strangulate_vehicleAI : public NullCreatureAI + { + npc_strangulate_vehicleAI(Creature* creature) : NullCreatureAI(creature), _instance(creature->GetInstanceScript()) {} - EventMap _events; - InstanceScript* _instance; + EventMap _events; + InstanceScript* _instance; - void IsSummonedBy(Unit* summoner) - { - if (!summoner) - return; + void IsSummonedBy(Unit* summoner) + { + if (!summoner) + return; - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - { - me->SetWalk(false); - Movement::PointsArray path; - path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), 843.0f)); - me->GetMotionMaster()->MoveSplinePath(&path); + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + me->SetWalk(false); + Movement::PointsArray path; + path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), 843.0f)); + me->GetMotionMaster()->MoveSplinePath(&path); - uint64 petGUID = summoner->GetPetGUID(); - summoner->SetPetGUID(0); - summoner->StopMoving(); - me->CastSpell(summoner, SPELL_HARVEST_SOUL_VEHICLE, true); - //summoner->ClearUnitState(UNIT_STATE_ONVEHICLE); - summoner->SendMovementFlagUpdate(true); - summoner->SetPetGUID(petGUID); - _events.Reset(); - _events.ScheduleEvent(EVENT_MOVE_TO_LICH_KING, 1000); - _events.ScheduleEvent(EVENT_TELEPORT, 6250); - _events.ScheduleEvent(EVENT_DESPAWN_SELF, 6000+70000); + uint64 petGUID = summoner->GetPetGUID(); + summoner->SetPetGUID(0); + summoner->StopMoving(); + me->CastSpell(summoner, SPELL_HARVEST_SOUL_VEHICLE, true); + //summoner->ClearUnitState(UNIT_STATE_ONVEHICLE); + summoner->SendMovementFlagUpdate(true); + summoner->SetPetGUID(petGUID); + _events.Reset(); + _events.ScheduleEvent(EVENT_MOVE_TO_LICH_KING, 1000); + _events.ScheduleEvent(EVENT_TELEPORT, 6250); + _events.ScheduleEvent(EVENT_DESPAWN_SELF, 6000+70000); - // this will let us easily access all creatures of this entry on heroic mode when its time to teleport back - lichKing->AI()->JustSummoned(me); - } - } + // this will let us easily access all creatures of this entry on heroic mode when its time to teleport back + lichKing->AI()->JustSummoned(me); + } + } - bool IsHeroic() { return me->GetMap()->IsHeroic(); } - void OnCharmed(bool apply) {} - void PassengerBoarded(Unit* pass, int8 seat, bool apply) - { - if (!apply) - pass->RemoveAurasDueToSpell(VEHICLE_SPELL_PARACHUTE); - } + bool IsHeroic() { return me->GetMap()->IsHeroic(); } + void OnCharmed(bool apply) {} + void PassengerBoarded(Unit* pass, int8 seat, bool apply) + { + if (!apply) + pass->RemoveAurasDueToSpell(VEHICLE_SPELL_PARACHUTE); + } - void DoAction(int32 action) - { - if (action != ACTION_TELEPORT_BACK) - return; + void DoAction(int32 action) + { + if (action != ACTION_TELEPORT_BACK) + return; - if (TempSummon* summ = me->ToTempSummon()) - { - if (Unit* summoner = summ->GetSummoner()) - { - bool buff = _instance->GetBossState(DATA_THE_LICH_KING) == IN_PROGRESS && summoner->GetTypeId() == TYPEID_PLAYER && (!summoner->IsAlive() || summoner->ToPlayer()->IsBeingTeleported() || summoner->FindMap() != me->GetMap()); - if (summoner->GetTypeId() == TYPEID_PLAYER && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap()) - { - if (buff) - summoner->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, _instance->GetData64(DATA_THE_LICH_KING)); + if (TempSummon* summ = me->ToTempSummon()) + { + if (Unit* summoner = summ->GetSummoner()) + { + bool buff = _instance->GetBossState(DATA_THE_LICH_KING) == IN_PROGRESS && summoner->GetTypeId() == TYPEID_PLAYER && (!summoner->IsAlive() || summoner->ToPlayer()->IsBeingTeleported() || summoner->FindMap() != me->GetMap()); + if (summoner->GetTypeId() == TYPEID_PLAYER && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap()) + { + if (buff) + summoner->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, _instance->GetData64(DATA_THE_LICH_KING)); - me->CastSpell(summoner, SPELL_HARVEST_SOUL_TELEPORT_BACK, false); - } - else if (buff) - me->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, _instance->GetData64(DATA_THE_LICH_KING)); + me->CastSpell(summoner, SPELL_HARVEST_SOUL_TELEPORT_BACK, false); + } + else if (buff) + me->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, _instance->GetData64(DATA_THE_LICH_KING)); - summoner->RemoveAurasDueToSpell(IsHeroic() ? SPELL_HARVEST_SOULS_TELEPORT : SPELL_HARVEST_SOUL_TELEPORT); - } - else - me->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, _instance->GetData64(DATA_THE_LICH_KING)); - } + summoner->RemoveAurasDueToSpell(IsHeroic() ? SPELL_HARVEST_SOULS_TELEPORT : SPELL_HARVEST_SOUL_TELEPORT); + } + else + me->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL_LK_BUFF, true, NULL, NULL, _instance->GetData64(DATA_THE_LICH_KING)); + } - _events.Reset(); - me->RemoveAllAuras(); - me->DespawnOrUnsummon(500); + _events.Reset(); + me->RemoveAllAuras(); + me->DespawnOrUnsummon(500); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - lichKing->AI()->SummonedCreatureDespawn(me); - } + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->SummonedCreatureDespawn(me); + } - void UpdateAI(uint32 diff) - { - _events.Update(diff); + void UpdateAI(uint32 diff) + { + _events.Update(diff); - switch (uint32 eventId = _events.ExecuteEvent()) - { - case EVENT_TELEPORT: - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - if (TempSummon* summ = me->ToTempSummon()) - if (Unit* summoner = summ->GetSummoner()) - { - if (summoner->IsAlive() && summoner->GetTypeId() == TYPEID_PLAYER) - { - summoner->CastSpell((Unit*)NULL, SPELL_HARVEST_SOUL_VISUAL, true); - summoner->ExitVehicle(summoner); - me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), 840.87f, me->GetOrientation(), true); - me->StopMovingOnCurrentPos(); - if (!IsHeroic()) - summoner->CastSpell(summoner, SPELL_HARVEST_SOUL_TELEPORT, true); - else - summoner->CastSpell(summoner, SPELL_HARVEST_SOULS_TELEPORT, true); - } - else - { - summoner->ExitVehicle(summoner); - _events.RescheduleEvent(EVENT_DESPAWN_SELF, 0); - } - } - break; - case EVENT_MOVE_TO_LICH_KING: - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - if (me->GetExactDist(lichKing) > 8.0f) - { - float dist = float(rand_norm()) * 5.0f + 8.0f; - float angle = lichKing->GetAngle(me); - Movement::PointsArray path; - path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - path.push_back(G3D::Vector3(lichKing->GetPositionX()+dist*cos(angle), lichKing->GetPositionY()+dist*sin(angle), 843.0f)); - me->GetMotionMaster()->MoveSplinePath(&path); - } - break; - case EVENT_DESPAWN_SELF: - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - lichKing->AI()->SummonedCreatureDespawn(me); - me->DespawnOrUnsummon(1); - break; - default: - break; - } - } - }; + switch (uint32 eventId = _events.ExecuteEvent()) + { + case EVENT_TELEPORT: + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + if (TempSummon* summ = me->ToTempSummon()) + if (Unit* summoner = summ->GetSummoner()) + { + if (summoner->IsAlive() && summoner->GetTypeId() == TYPEID_PLAYER) + { + summoner->CastSpell((Unit*)NULL, SPELL_HARVEST_SOUL_VISUAL, true); + summoner->ExitVehicle(summoner); + me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), 840.87f, me->GetOrientation(), true); + me->StopMovingOnCurrentPos(); + if (!IsHeroic()) + summoner->CastSpell(summoner, SPELL_HARVEST_SOUL_TELEPORT, true); + else + summoner->CastSpell(summoner, SPELL_HARVEST_SOULS_TELEPORT, true); + } + else + { + summoner->ExitVehicle(summoner); + _events.RescheduleEvent(EVENT_DESPAWN_SELF, 0); + } + } + break; + case EVENT_MOVE_TO_LICH_KING: + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + if (me->GetExactDist(lichKing) > 8.0f) + { + float dist = float(rand_norm()) * 5.0f + 8.0f; + float angle = lichKing->GetAngle(me); + Movement::PointsArray path; + path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + path.push_back(G3D::Vector3(lichKing->GetPositionX()+dist*cos(angle), lichKing->GetPositionY()+dist*sin(angle), 843.0f)); + me->GetMotionMaster()->MoveSplinePath(&path); + } + break; + case EVENT_DESPAWN_SELF: + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->SummonedCreatureDespawn(me); + me->DespawnOrUnsummon(1); + break; + default: + break; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_terenas_menethil : public CreatureScript { - public: - npc_terenas_menethil() : CreatureScript("npc_terenas_menethil") { } + public: + npc_terenas_menethil() : CreatureScript("npc_terenas_menethil") { } - struct npc_terenas_menethilAI : public ScriptedAI - { - npc_terenas_menethilAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) {} + struct npc_terenas_menethilAI : public ScriptedAI + { + npc_terenas_menethilAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) {} - EventMap _events; - InstanceScript* _instance; + EventMap _events; + InstanceScript* _instance; - void DoAction(int32 action) - { - switch (action) - { - case ACTION_FROSTMOURNE_INTRO: - me->SetControlled(true, UNIT_STATE_ROOT); - me->setActive(true); - _events.Reset(); - _events.ScheduleEvent(EVENT_FROSTMOURNE_TALK_1, 2000); - _events.ScheduleEvent(EVENT_FROSTMOURNE_TALK_2, 11000); - if (!IsHeroic()) - { - me->SetHealth(me->GetMaxHealth() / 2); - _events.ScheduleEvent(EVENT_DESTROY_SOUL, 60000); - _events.ScheduleEvent(EVENT_FROSTMOURNE_TALK_3, 25000); - } - break; - case ACTION_TELEPORT_BACK: - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - { - _events.Reset(); - me->CastSpell((Unit*)NULL, SPELL_RESTORE_SOUL, false); - me->DespawnOrUnsummon(3000); - } - break; - } - } + void DoAction(int32 action) + { + switch (action) + { + case ACTION_FROSTMOURNE_INTRO: + me->SetControlled(true, UNIT_STATE_ROOT); + me->setActive(true); + _events.Reset(); + _events.ScheduleEvent(EVENT_FROSTMOURNE_TALK_1, 2000); + _events.ScheduleEvent(EVENT_FROSTMOURNE_TALK_2, 11000); + if (!IsHeroic()) + { + me->SetHealth(me->GetMaxHealth() / 2); + _events.ScheduleEvent(EVENT_DESTROY_SOUL, 60000); + _events.ScheduleEvent(EVENT_FROSTMOURNE_TALK_3, 25000); + } + break; + case ACTION_TELEPORT_BACK: + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + { + _events.Reset(); + me->CastSpell((Unit*)NULL, SPELL_RESTORE_SOUL, false); + me->DespawnOrUnsummon(3000); + } + break; + } + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - { - damage = me->GetHealth() - 1; - if (IsHeroic()) - return; - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - { - _events.Reset(); - _events.ScheduleEvent(EVENT_TELEPORT_BACK, 1000); - if (Creature* warden = me->FindNearestCreature(NPC_SPIRIT_WARDEN, 20.0f)) - { - warden->CastSpell((Unit*)NULL, SPELL_DESTROY_SOUL, false); - warden->DespawnOrUnsummon(2000); - } - me->CastSpell(me, SPELL_TERENAS_LOSES_INSIDE, false); - me->SetDisplayId(16946); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->DespawnOrUnsummon(2000); - } - } - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + { + damage = me->GetHealth() - 1; + if (IsHeroic()) + return; + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + { + _events.Reset(); + _events.ScheduleEvent(EVENT_TELEPORT_BACK, 1000); + if (Creature* warden = me->FindNearestCreature(NPC_SPIRIT_WARDEN, 20.0f)) + { + warden->CastSpell((Unit*)NULL, SPELL_DESTROY_SOUL, false); + warden->DespawnOrUnsummon(2000); + } + me->CastSpell(me, SPELL_TERENAS_LOSES_INSIDE, false); + me->SetDisplayId(16946); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->DespawnOrUnsummon(2000); + } + } + } - void UpdateAI(uint32 diff) - { - UpdateVictim(); + void UpdateAI(uint32 diff) + { + UpdateVictim(); - _events.Update(diff); + _events.Update(diff); - switch (uint32 eventId = _events.ExecuteEvent()) - { - case EVENT_FROSTMOURNE_TALK_1: - me->SetControlled(false, UNIT_STATE_ROOT); - Talk(SAY_TERENAS_INTRO_1); - if (IsHeroic()) - me->CastSpell((Unit*)NULL, SPELL_RESTORE_SOULS, false); - break; - case EVENT_FROSTMOURNE_TALK_2: - Talk(SAY_TERENAS_INTRO_2); - break; - case EVENT_FROSTMOURNE_TALK_3: - Talk(SAY_TERENAS_INTRO_3); - break; - case EVENT_DESTROY_SOUL: - if (Creature* warden = me->FindNearestCreature(NPC_SPIRIT_WARDEN, 20.0f)) - warden->CastSpell((Unit*)NULL, SPELL_DESTROY_SOUL, false); - me->CastSpell(me, SPELL_TERENAS_LOSES_INSIDE, false); - me->SetDisplayId(16946); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - _events.Reset(); - _events.ScheduleEvent(EVENT_TELEPORT_BACK, 1000); - break; - case EVENT_TELEPORT_BACK: - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) - lichKing->AI()->DoAction(ACTION_TELEPORT_BACK); - break; - default: - break; - } + switch (uint32 eventId = _events.ExecuteEvent()) + { + case EVENT_FROSTMOURNE_TALK_1: + me->SetControlled(false, UNIT_STATE_ROOT); + Talk(SAY_TERENAS_INTRO_1); + if (IsHeroic()) + me->CastSpell((Unit*)NULL, SPELL_RESTORE_SOULS, false); + break; + case EVENT_FROSTMOURNE_TALK_2: + Talk(SAY_TERENAS_INTRO_2); + break; + case EVENT_FROSTMOURNE_TALK_3: + Talk(SAY_TERENAS_INTRO_3); + break; + case EVENT_DESTROY_SOUL: + if (Creature* warden = me->FindNearestCreature(NPC_SPIRIT_WARDEN, 20.0f)) + warden->CastSpell((Unit*)NULL, SPELL_DESTROY_SOUL, false); + me->CastSpell(me, SPELL_TERENAS_LOSES_INSIDE, false); + me->SetDisplayId(16946); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + _events.Reset(); + _events.ScheduleEvent(EVENT_TELEPORT_BACK, 1000); + break; + case EVENT_TELEPORT_BACK: + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->DoAction(ACTION_TELEPORT_BACK); + break; + default: + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - bool CanAIAttack(Unit const* target) const - { - return target->GetEntry() != NPC_THE_LICH_KING; - } + bool CanAIAttack(Unit const* target) const + { + return target->GetEntry() != NPC_THE_LICH_KING; + } - void EnterEvadeMode() - { - if (!me->IsAlive()) - return; + void EnterEvadeMode() + { + if (!me->IsAlive()) + return; - me->DeleteThreatList(); - me->CombatStop(false); - } - }; + me->DeleteThreatList(); + me->CombatStop(false); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_the_lich_king_lights_favor : public SpellScriptLoader { - public: - spell_the_lich_king_lights_favor() : SpellScriptLoader("spell_the_lich_king_lights_favor") { } + public: + spell_the_lich_king_lights_favor() : SpellScriptLoader("spell_the_lich_king_lights_favor") { } - class spell_the_lich_king_lights_favor_AuraScript : public AuraScript - { - PrepareAuraScript(spell_the_lich_king_lights_favor_AuraScript); + class spell_the_lich_king_lights_favor_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_lights_favor_AuraScript); - void OnPeriodic(AuraEffect const* /*aurEff*/) - { - if (Unit* caster = GetCaster()) - if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1)) - effect->RecalculateAmount(caster); - } + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (Unit* caster = GetCaster()) + if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1)) + effect->RecalculateAmount(caster); + } - void CalculateBonus(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) - { - canBeRecalculated = true; - amount = 0; - if (Unit* caster = GetCaster()) - amount = int32(caster->GetHealthPct()); - } + void CalculateBonus(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + { + canBeRecalculated = true; + amount = 0; + if (Unit* caster = GetCaster()) + amount = int32(caster->GetHealthPct()); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_lights_favor_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_the_lich_king_lights_favor_AuraScript::CalculateBonus, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_lights_favor_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_the_lich_king_lights_favor_AuraScript::CalculateBonus, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_the_lich_king_lights_favor_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_lights_favor_AuraScript(); + } }; class spell_the_lich_king_restore_soul : public SpellScriptLoader { - public: - spell_the_lich_king_restore_soul() : SpellScriptLoader("spell_the_lich_king_restore_soul") { } + public: + spell_the_lich_king_restore_soul() : SpellScriptLoader("spell_the_lich_king_restore_soul") { } - class spell_the_lich_king_restore_soul_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_restore_soul_SpellScript); + class spell_the_lich_king_restore_soul_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_restore_soul_SpellScript); - bool Load() - { - _instance = GetCaster()->GetInstanceScript(); - return _instance != NULL; - } + bool Load() + { + _instance = GetCaster()->GetInstanceScript(); + return _instance != NULL; + } - void FilterTargets(std::list& unitList) - { - for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - if (Unit* target = (*itr)->ToUnit()) - target->RemoveAurasDueToSpell(target->GetMap()->IsHeroic() ? SPELL_HARVEST_SOULS_TELEPORT : SPELL_HARVEST_SOUL_TELEPORT); - if (Creature* lichKing = ObjectAccessor::GetCreature(*GetCaster(), _instance->GetData64(DATA_THE_LICH_KING))) - lichKing->AI()->DoAction(ACTION_TELEPORT_BACK); - if (Creature* spawner = GetCaster()->FindNearestCreature(NPC_WORLD_TRIGGER_INFINITE_AOI, 50.0f, true)) - { - spawner->RemoveAllAuras(); - spawner->m_Events.KillAllEvents(true); - } + void FilterTargets(std::list& unitList) + { + for (std::list::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + if (Unit* target = (*itr)->ToUnit()) + target->RemoveAurasDueToSpell(target->GetMap()->IsHeroic() ? SPELL_HARVEST_SOULS_TELEPORT : SPELL_HARVEST_SOUL_TELEPORT); + if (Creature* lichKing = ObjectAccessor::GetCreature(*GetCaster(), _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->DoAction(ACTION_TELEPORT_BACK); + if (Creature* spawner = GetCaster()->FindNearestCreature(NPC_WORLD_TRIGGER_INFINITE_AOI, 50.0f, true)) + { + spawner->RemoveAllAuras(); + spawner->m_Events.KillAllEvents(true); + } - std::list spirits; - GetCaster()->GetCreatureListWithEntryInGrid(spirits, NPC_WICKED_SPIRIT, 200.0f); - for (std::list::iterator itr = spirits.begin(); itr != spirits.end(); ++itr) - { - (*itr)->m_Events.KillAllEvents(true); - (*itr)->RemoveAllAuras(); - (*itr)->AI()->EnterEvadeMode(); - (*itr)->SetReactState(REACT_PASSIVE); - } - } + std::list spirits; + GetCaster()->GetCreatureListWithEntryInGrid(spirits, NPC_WICKED_SPIRIT, 200.0f); + for (std::list::iterator itr = spirits.begin(); itr != spirits.end(); ++itr) + { + (*itr)->m_Events.KillAllEvents(true); + (*itr)->RemoveAllAuras(); + (*itr)->AI()->EnterEvadeMode(); + (*itr)->SetReactState(REACT_PASSIVE); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_restore_soul_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - } + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_restore_soul_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } - InstanceScript* _instance; - }; + InstanceScript* _instance; + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_restore_soul_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_restore_soul_SpellScript(); + } }; class npc_spirit_warden : public CreatureScript { - public: - npc_spirit_warden() : CreatureScript("npc_spirit_warden") { } + public: + npc_spirit_warden() : CreatureScript("npc_spirit_warden") { } - struct npc_spirit_wardenAI : public ScriptedAI - { - npc_spirit_wardenAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) {} + struct npc_spirit_wardenAI : public ScriptedAI + { + npc_spirit_wardenAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) {} - EventMap _events; - InstanceScript* _instance; + EventMap _events; + InstanceScript* _instance; - void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EVENT_SOUL_RIP, urand(12000, 15000)); - } + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_SOUL_RIP, urand(12000, 15000)); + } - void JustDied(Unit* /*killer*/) - { - if (Creature* terenas = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TERENAS_MENETHIL))) - terenas->AI()->DoAction(ACTION_TELEPORT_BACK); - } + void JustDied(Unit* /*killer*/) + { + if (Creature* terenas = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TERENAS_MENETHIL))) + terenas->AI()->DoAction(ACTION_TELEPORT_BACK); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _events.Update(diff); + _events.Update(diff); - if (_events.ExecuteEvent() == EVENT_SOUL_RIP) - { - me->CastSpell(me->GetVictim(), SPELL_SOUL_RIP, false); - _events.ScheduleEvent(EVENT_SOUL_RIP, urand(23000, 27000)); - } + if (_events.ExecuteEvent() == EVENT_SOUL_RIP) + { + me->CastSpell(me->GetVictim(), SPELL_SOUL_RIP, false); + _events.ScheduleEvent(EVENT_SOUL_RIP, urand(23000, 27000)); + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_the_lich_king_dark_hunger : public SpellScriptLoader { - public: - spell_the_lich_king_dark_hunger() : SpellScriptLoader("spell_the_lich_king_dark_hunger") { } + public: + spell_the_lich_king_dark_hunger() : SpellScriptLoader("spell_the_lich_king_dark_hunger") { } - class spell_the_lich_king_dark_hunger_AuraScript : public AuraScript - { - PrepareAuraScript(spell_the_lich_king_dark_hunger_AuraScript); + class spell_the_lich_king_dark_hunger_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_dark_hunger_AuraScript); - bool Validate(SpellInfo const* /*spellInfo*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_DARK_HUNGER_HEAL)) - return false; - return true; - } + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_DARK_HUNGER_HEAL)) + return false; + return true; + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - int32 heal = int32(eventInfo.GetDamageInfo()->GetDamage() / 2); - GetTarget()->CastCustomSpell(SPELL_DARK_HUNGER_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), true, NULL, aurEff); - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + int32 heal = int32(eventInfo.GetDamageInfo()->GetDamage() / 2); + GetTarget()->CastCustomSpell(SPELL_DARK_HUNGER_HEAL, SPELLVALUE_BASE_POINT0, heal, GetTarget(), true, NULL, aurEff); + } - void Register() - { - OnEffectProc += AuraEffectProcFn(spell_the_lich_king_dark_hunger_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + void Register() + { + OnEffectProc += AuraEffectProcFn(spell_the_lich_king_dark_hunger_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_the_lich_king_dark_hunger_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_dark_hunger_AuraScript(); + } }; class spell_the_lich_king_soul_rip : public SpellScriptLoader { - public: - spell_the_lich_king_soul_rip() : SpellScriptLoader("spell_the_lich_king_soul_rip") { } + public: + spell_the_lich_king_soul_rip() : SpellScriptLoader("spell_the_lich_king_soul_rip") { } - class spell_the_lich_king_soul_rip_AuraScript : public AuraScript - { - PrepareAuraScript(spell_the_lich_king_soul_rip_AuraScript); + class spell_the_lich_king_soul_rip_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_soul_rip_AuraScript); - void OnPeriodic(AuraEffect const* aurEff) - { - PreventDefaultAction(); - // shouldn't be needed, this is channeled - if (Unit* caster = GetCaster()) - caster->CastCustomSpell(SPELL_SOUL_RIP_DAMAGE, SPELLVALUE_BASE_POINT0, 5000 * aurEff->GetTickNumber(), GetTarget(), true, NULL, aurEff, GetCasterGUID()); - } + void OnPeriodic(AuraEffect const* aurEff) + { + PreventDefaultAction(); + // shouldn't be needed, this is channeled + if (Unit* caster = GetCaster()) + caster->CastCustomSpell(SPELL_SOUL_RIP_DAMAGE, SPELLVALUE_BASE_POINT0, 5000 * aurEff->GetTickNumber(), GetTarget(), true, NULL, aurEff, GetCasterGUID()); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_soul_rip_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_soul_rip_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_the_lich_king_soul_rip_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_soul_rip_AuraScript(); + } }; class npc_icc_lk_checktarget : public CreatureScript { - public: - npc_icc_lk_checktarget() : CreatureScript("npc_icc_lk_checktarget") { } + public: + npc_icc_lk_checktarget() : CreatureScript("npc_icc_lk_checktarget") { } - struct npc_icc_lk_checktargetAI : public ScriptedAI - { - npc_icc_lk_checktargetAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_icc_lk_checktargetAI : public ScriptedAI + { + npc_icc_lk_checktargetAI(Creature* creature) : ScriptedAI(creature) {} - bool CanAIAttack(Unit const* target) const - { - return IsValidPlatformTarget(target) && !target->GetVehicle(); - } - }; + bool CanAIAttack(Unit const* target) const + { + return IsValidPlatformTarget(target) && !target->GetVehicle(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_the_lich_king_summon_spirit_bomb : public SpellScriptLoader { - public: - spell_the_lich_king_summon_spirit_bomb() : SpellScriptLoader("spell_the_lich_king_summon_spirit_bomb") { } + public: + spell_the_lich_king_summon_spirit_bomb() : SpellScriptLoader("spell_the_lich_king_summon_spirit_bomb") { } - class spell_the_lich_king_summon_spirit_bomb_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_summon_spirit_bomb_SpellScript); + class spell_the_lich_king_summon_spirit_bomb_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_summon_spirit_bomb_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetHitUnit()->CastSpell((Unit*)NULL, uint32(GetEffectValue()), true); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->CastSpell((Unit*)NULL, uint32(GetEffectValue()), true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_summon_spirit_bomb_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_summon_spirit_bomb_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_summon_spirit_bomb_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_summon_spirit_bomb_SpellScript(); + } }; class npc_lk_spirit_bomb : public CreatureScript { - public: - npc_lk_spirit_bomb() : CreatureScript("npc_lk_spirit_bomb") { } + public: + npc_lk_spirit_bomb() : CreatureScript("npc_lk_spirit_bomb") { } - struct npc_lk_spirit_bombAI : public NullCreatureAI - { - npc_lk_spirit_bombAI(Creature* creature) : NullCreatureAI(creature) - { - me->SetReactState(REACT_PASSIVE); - me->DespawnOrUnsummon(45000); // for safety - timer = 0; - } + struct npc_lk_spirit_bombAI : public NullCreatureAI + { + npc_lk_spirit_bombAI(Creature* creature) : NullCreatureAI(creature) + { + me->SetReactState(REACT_PASSIVE); + me->DespawnOrUnsummon(45000); // for safety + timer = 0; + } - uint16 timer; + uint16 timer; - void IsSummonedBy(Unit* /*summoner*/) - { - float destX, destY, destZ; - me->GetPosition(destX, destY); - destZ = 1055.0f; // approximation, gets more precise later - me->UpdateGroundPositionZ(destX, destY, destZ); - me->SetWalk(false); - me->GetMotionMaster()->MovePoint(POINT_GROUND, destX, destY, destZ); - } + void IsSummonedBy(Unit* /*summoner*/) + { + float destX, destY, destZ; + me->GetPosition(destX, destY); + destZ = 1055.0f; // approximation, gets more precise later + me->UpdateGroundPositionZ(destX, destY, destZ); + me->SetWalk(false); + me->GetMotionMaster()->MovePoint(POINT_GROUND, destX, destY, destZ); + } - void MovementInform(uint32 type, uint32 point) - { - if (type != POINT_MOTION_TYPE || point != POINT_GROUND) - return; + void MovementInform(uint32 type, uint32 point) + { + if (type != POINT_MOTION_TYPE || point != POINT_GROUND) + return; - timer = 1000; - } + timer = 1000; + } - void UpdateAI(uint32 diff) - { - if (timer) - { - if (timer <= diff) - { - timer = 0; - me->RemoveAllAuras(); - me->CastSpell((Unit*)NULL, SPELL_EXPLOSION, false); - me->DespawnOrUnsummon(1000); - } - else - timer -= diff; - } - } - }; + void UpdateAI(uint32 diff) + { + if (timer) + { + if (timer <= diff) + { + timer = 0; + me->RemoveAllAuras(); + me->CastSpell((Unit*)NULL, SPELL_EXPLOSION, false); + me->DespawnOrUnsummon(1000); + } + else + timer -= diff; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_the_lich_king_trigger_vile_spirit : public SpellScriptLoader { - public: - spell_the_lich_king_trigger_vile_spirit() : SpellScriptLoader("spell_the_lich_king_trigger_vile_spirit") { } + public: + spell_the_lich_king_trigger_vile_spirit() : SpellScriptLoader("spell_the_lich_king_trigger_vile_spirit") { } - class spell_the_lich_king_trigger_vile_spirit_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_lich_king_trigger_vile_spirit_SpellScript); + class spell_the_lich_king_trigger_vile_spirit_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_trigger_vile_spirit_SpellScript); - void ActivateSpirit() - { - Creature* target = GetHitCreature(); - if (!target) - return; + void ActivateSpirit() + { + Creature* target = GetHitCreature(); + if (!target) + return; - target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - target->ForceValuesUpdateAtIndex(UNIT_FIELD_FLAGS); - VileSpiritActivateEvent(target).Execute(0, 0); - } + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + target->ForceValuesUpdateAtIndex(UNIT_FIELD_FLAGS); + VileSpiritActivateEvent(target).Execute(0, 0); + } - void Register() - { - OnHit += SpellHitFn(spell_the_lich_king_trigger_vile_spirit_SpellScript::ActivateSpirit); - } - }; + void Register() + { + OnHit += SpellHitFn(spell_the_lich_king_trigger_vile_spirit_SpellScript::ActivateSpirit); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_lich_king_trigger_vile_spirit_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_trigger_vile_spirit_SpellScript(); + } }; class npc_lk_wicked_spirit : public CreatureScript { - public: - npc_lk_wicked_spirit() : CreatureScript("npc_lk_wicked_spirit") { } + public: + npc_lk_wicked_spirit() : CreatureScript("npc_lk_wicked_spirit") { } - struct npc_lk_wicked_spiritAI : public ScriptedAI - { - npc_lk_wicked_spiritAI(Creature* creature) : ScriptedAI(creature) { } + struct npc_lk_wicked_spiritAI : public ScriptedAI + { + npc_lk_wicked_spiritAI(Creature* creature) : ScriptedAI(creature) { } - void Reset() - { - me->SetCorpseDelay(0); - me->SetReactState(REACT_PASSIVE); - } + void Reset() + { + me->SetCorpseDelay(0); + me->SetReactState(REACT_PASSIVE); + } - void JustDied(Unit* /*killer*/) - { - me->SetReactState(REACT_PASSIVE); - } + void JustDied(Unit* /*killer*/) + { + me->SetReactState(REACT_PASSIVE); + } - void JustRespawned() - { - me->SetReactState(REACT_PASSIVE); - } + void JustRespawned() + { + me->SetReactState(REACT_PASSIVE); + } - bool CanAIAttack(Unit const* target) const - { - return me->GetReactState() == REACT_AGGRESSIVE && target->GetTypeId() == TYPEID_PLAYER && target->GetExactDistSq(495.708f, -2523.76f, 1049.95f) < 40.0f*40.0f; - } - }; + bool CanAIAttack(Unit const* target) const + { + return me->GetReactState() == REACT_AGGRESSIVE && target->GetTypeId() == TYPEID_PLAYER && target->GetExactDistSq(495.708f, -2523.76f, 1049.95f) < 40.0f*40.0f; + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class achievement_been_waiting_long_time : public AchievementCriteriaScript { - public: - achievement_been_waiting_long_time() : AchievementCriteriaScript("achievement_been_waiting_long_time") { } + public: + achievement_been_waiting_long_time() : AchievementCriteriaScript("achievement_been_waiting_long_time") { } - bool OnCheck(Player* /*source*/, Unit* target) - { - if (!target) - return false; + bool OnCheck(Player* /*source*/, Unit* target) + { + if (!target) + return false; - return target->GetAI()->GetData(DATA_PLAGUE_STACK) >= 30; - } + return target->GetAI()->GetData(DATA_PLAGUE_STACK) >= 30; + } }; class achievement_neck_deep_in_vile : public AchievementCriteriaScript { - public: - achievement_neck_deep_in_vile() : AchievementCriteriaScript("achievement_neck_deep_in_vile") { } + public: + achievement_neck_deep_in_vile() : AchievementCriteriaScript("achievement_neck_deep_in_vile") { } - bool OnCheck(Player* /*source*/, Unit* target) - { - if (!target) - return false; + bool OnCheck(Player* /*source*/, Unit* target) + { + if (!target) + return false; - return !target->GetAI()->GetData(DATA_VILE); - } + return !target->GetAI()->GetData(DATA_VILE); + } }; void AddSC_boss_the_lich_king() { - new boss_the_lich_king(); - new npc_tirion_fordring_tft(); - new spell_the_lich_king_quake(); - new spell_the_lich_king_jump(); - new spell_the_lich_king_jump_remove_aura(); - new spell_trigger_spell_from_caster("spell_the_lich_king_mass_resurrection", SPELL_MASS_RESURRECTION_REAL); - new spell_the_lich_king_play_movie(); + new boss_the_lich_king(); + new npc_tirion_fordring_tft(); + new spell_the_lich_king_quake(); + new spell_the_lich_king_jump(); + new spell_the_lich_king_jump_remove_aura(); + new spell_trigger_spell_from_caster("spell_the_lich_king_mass_resurrection", SPELL_MASS_RESURRECTION_REAL); + new spell_the_lich_king_play_movie(); - // fight stuff below - new npc_shambling_horror_icc(); - new spell_the_lich_king_infest(); - new spell_the_lich_king_necrotic_plague(); - new spell_the_lich_king_necrotic_plague_jump(); - new spell_the_lich_king_shadow_trap_visual(); - new spell_the_lich_king_shadow_trap_periodic(); - new spell_the_lich_king_ice_burst_target_search(); - new npc_icc_ice_sphere(); - new spell_the_lich_king_raging_spirit(); - new npc_raging_spirit(); - new spell_the_lich_king_defile(); - new spell_the_lich_king_soul_reaper(); - new npc_valkyr_shadowguard(); - new spell_the_lich_king_summon_into_air(); - new spell_the_lich_king_teleport_to_frostmourne_hc(); - new spell_the_lich_king_valkyr_target_search(); - new spell_the_lich_king_cast_back_to_caster(); - new spell_the_lich_king_life_siphon(); - new spell_the_lich_king_vile_spirits(); - new spell_the_lich_king_vile_spirits_visual(); - new spell_the_lich_king_vile_spirit_move_target_search(); - new spell_the_lich_king_vile_spirit_damage_target_search(); - new spell_the_lich_king_harvest_soul(); - new npc_strangulate_vehicle(); - new npc_terenas_menethil(); - new spell_the_lich_king_lights_favor(); - new spell_the_lich_king_restore_soul(); - new npc_spirit_warden(); - new spell_the_lich_king_dark_hunger(); - new spell_the_lich_king_soul_rip(); - new npc_icc_lk_checktarget(); - new spell_the_lich_king_summon_spirit_bomb(); - new npc_lk_spirit_bomb(); - new spell_the_lich_king_trigger_vile_spirit(); - new npc_lk_wicked_spirit(); - new achievement_been_waiting_long_time(); - new achievement_neck_deep_in_vile(); + // fight stuff below + new npc_shambling_horror_icc(); + new spell_the_lich_king_infest(); + new spell_the_lich_king_necrotic_plague(); + new spell_the_lich_king_necrotic_plague_jump(); + new spell_the_lich_king_shadow_trap_visual(); + new spell_the_lich_king_shadow_trap_periodic(); + new spell_the_lich_king_ice_burst_target_search(); + new npc_icc_ice_sphere(); + new spell_the_lich_king_raging_spirit(); + new npc_raging_spirit(); + new spell_the_lich_king_defile(); + new spell_the_lich_king_soul_reaper(); + new npc_valkyr_shadowguard(); + new spell_the_lich_king_summon_into_air(); + new spell_the_lich_king_teleport_to_frostmourne_hc(); + new spell_the_lich_king_valkyr_target_search(); + new spell_the_lich_king_cast_back_to_caster(); + new spell_the_lich_king_life_siphon(); + new spell_the_lich_king_vile_spirits(); + new spell_the_lich_king_vile_spirits_visual(); + new spell_the_lich_king_vile_spirit_move_target_search(); + new spell_the_lich_king_vile_spirit_damage_target_search(); + new spell_the_lich_king_harvest_soul(); + new npc_strangulate_vehicle(); + new npc_terenas_menethil(); + new spell_the_lich_king_lights_favor(); + new spell_the_lich_king_restore_soul(); + new npc_spirit_warden(); + new spell_the_lich_king_dark_hunger(); + new spell_the_lich_king_soul_rip(); + new npc_icc_lk_checktarget(); + new spell_the_lich_king_summon_spirit_bomb(); + new npc_lk_spirit_bomb(); + new spell_the_lich_king_trigger_vile_spirit(); + new npc_lk_wicked_spirit(); + new achievement_been_waiting_long_time(); + new achievement_neck_deep_in_vile(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index abf1f7533..f1b63ff48 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -14,75 +14,75 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Texts { - // The Lich King - SAY_LICH_KING_INTRO = 0, + // The Lich King + SAY_LICH_KING_INTRO = 0, - // Valithria Dreamwalker - SAY_VALITHRIA_ENTER_COMBAT = 0, - SAY_VALITHRIA_DREAM_PORTAL = 1, - SAY_VALITHRIA_75_PERCENT = 2, - SAY_VALITHRIA_25_PERCENT = 3, - SAY_VALITHRIA_DEATH = 4, - SAY_VALITHRIA_PLAYER_DEATH = 5, - SAY_VALITHRIA_BERSERK = 6, - SAY_VALITHRIA_SUCCESS = 7, + // Valithria Dreamwalker + SAY_VALITHRIA_ENTER_COMBAT = 0, + SAY_VALITHRIA_DREAM_PORTAL = 1, + SAY_VALITHRIA_75_PERCENT = 2, + SAY_VALITHRIA_25_PERCENT = 3, + SAY_VALITHRIA_DEATH = 4, + SAY_VALITHRIA_PLAYER_DEATH = 5, + SAY_VALITHRIA_BERSERK = 6, + SAY_VALITHRIA_SUCCESS = 7, }; enum Spells { - // Valithria Dreamwalker - SPELL_COPY_DAMAGE = 71948, - SPELL_DREAM_PORTAL_VISUAL_PRE = 71304, - SPELL_NIGHTMARE_PORTAL_VISUAL_PRE = 71986, - SPELL_NIGHTMARE_CLOUD = 71970, - SPELL_NIGHTMARE_CLOUD_VISUAL = 71939, - SPELL_PRE_SUMMON_DREAM_PORTAL = 72224, - SPELL_PRE_SUMMON_NIGHTMARE_PORTAL = 72480, - SPELL_SUMMON_DREAM_PORTAL = 71305, - SPELL_SUMMON_NIGHTMARE_PORTAL = 71987, - SPELL_DREAMWALKERS_RAGE = 71189, - SPELL_DREAM_SLIP = 71196, - SPELL_ACHIEVEMENT_CHECK = 72706, - SPELL_CLEAR_ALL = 71721, - SPELL_AWARD_REPUTATION_BOSS_KILL = 73843, - SPELL_CORRUPTION_VALITHRIA = 70904, + // Valithria Dreamwalker + SPELL_COPY_DAMAGE = 71948, + SPELL_DREAM_PORTAL_VISUAL_PRE = 71304, + SPELL_NIGHTMARE_PORTAL_VISUAL_PRE = 71986, + SPELL_NIGHTMARE_CLOUD = 71970, + SPELL_NIGHTMARE_CLOUD_VISUAL = 71939, + SPELL_PRE_SUMMON_DREAM_PORTAL = 72224, + SPELL_PRE_SUMMON_NIGHTMARE_PORTAL = 72480, + SPELL_SUMMON_DREAM_PORTAL = 71305, + SPELL_SUMMON_NIGHTMARE_PORTAL = 71987, + SPELL_DREAMWALKERS_RAGE = 71189, + SPELL_DREAM_SLIP = 71196, + SPELL_ACHIEVEMENT_CHECK = 72706, + SPELL_CLEAR_ALL = 71721, + SPELL_AWARD_REPUTATION_BOSS_KILL = 73843, + SPELL_CORRUPTION_VALITHRIA = 70904, - // The Lich King - SPELL_TIMER_GLUTTONOUS_ABOMINATION = 70915, - SPELL_TIMER_SUPPRESSER = 70912, - SPELL_TIMER_BLISTERING_ZOMBIE = 70914, - SPELL_TIMER_RISEN_ARCHMAGE = 70916, - SPELL_TIMER_BLAZING_SKELETON = 70913, - SPELL_SUMMON_SUPPRESSER = 70936, - SPELL_RECENTLY_SPAWNED = 72954, - SPELL_SPAWN_CHEST = 71207, + // The Lich King + SPELL_TIMER_GLUTTONOUS_ABOMINATION = 70915, + SPELL_TIMER_SUPPRESSER = 70912, + SPELL_TIMER_BLISTERING_ZOMBIE = 70914, + SPELL_TIMER_RISEN_ARCHMAGE = 70916, + SPELL_TIMER_BLAZING_SKELETON = 70913, + SPELL_SUMMON_SUPPRESSER = 70936, + SPELL_RECENTLY_SPAWNED = 72954, + SPELL_SPAWN_CHEST = 71207, - // Risen Archmage - SPELL_CORRUPTION = 70602, - SPELL_FROSTBOLT_VOLLEY = 70759, - SPELL_MANA_VOID = 71179, - SPELL_COLUMN_OF_FROST = 70704, - SPELL_COLUMN_OF_FROST_DAMAGE = 70702, + // Risen Archmage + SPELL_CORRUPTION = 70602, + SPELL_FROSTBOLT_VOLLEY = 70759, + SPELL_MANA_VOID = 71179, + SPELL_COLUMN_OF_FROST = 70704, + SPELL_COLUMN_OF_FROST_DAMAGE = 70702, - // Blazing Skeleton - SPELL_FIREBALL = 70754, - SPELL_LEY_WASTE = 69325, + // Blazing Skeleton + SPELL_FIREBALL = 70754, + SPELL_LEY_WASTE = 69325, - // Suppresser - SPELL_SUPPRESSION = 70588, + // Suppresser + SPELL_SUPPRESSION = 70588, - // Blistering Zombie - SPELL_ACID_BURST = 70744, + // Blistering Zombie + SPELL_ACID_BURST = 70744, - // Gluttonous Abomination - SPELL_GUT_SPRAY = 70633, - SPELL_ROT_WORM_SPAWNER = 70675, + // Gluttonous Abomination + SPELL_GUT_SPRAY = 70633, + SPELL_ROT_WORM_SPAWNER = 70675, - // Dream Cloud - SPELL_EMERALD_VIGOR = 70873, + // Dream Cloud + SPELL_EMERALD_VIGOR = 70873, - // Nightmare Cloud - SPELL_TWISTED_NIGHTMARE = 71941, + // Nightmare Cloud + SPELL_TWISTED_NIGHTMARE = 71941, }; #define SUMMON_PORTAL RAID_MODE(SPELL_PRE_SUMMON_DREAM_PORTAL, SPELL_PRE_SUMMON_DREAM_PORTAL, SPELL_PRE_SUMMON_NIGHTMARE_PORTAL, SPELL_PRE_SUMMON_NIGHTMARE_PORTAL) @@ -90,1433 +90,1433 @@ enum Spells enum Events { - // Valithria Dreamwalker - EVENT_INTRO_TALK = 1, - EVENT_BERSERK = 2, - EVENT_DREAM_PORTAL = 3, - EVENT_DREAM_SLIP = 4, + // Valithria Dreamwalker + EVENT_INTRO_TALK = 1, + EVENT_BERSERK = 2, + EVENT_DREAM_PORTAL = 3, + EVENT_DREAM_SLIP = 4, - // The Lich King - EVENT_GLUTTONOUS_ABOMINATION_SUMMONER = 5, - EVENT_SUPPRESSER_SUMMONER = 6, - EVENT_BLISTERING_ZOMBIE_SUMMONER = 7, - EVENT_RISEN_ARCHMAGE_SUMMONER = 8, - EVENT_BLAZING_SKELETON_SUMMONER = 9, + // The Lich King + EVENT_GLUTTONOUS_ABOMINATION_SUMMONER = 5, + EVENT_SUPPRESSER_SUMMONER = 6, + EVENT_BLISTERING_ZOMBIE_SUMMONER = 7, + EVENT_RISEN_ARCHMAGE_SUMMONER = 8, + EVENT_BLAZING_SKELETON_SUMMONER = 9, - // Risen Archmage - EVENT_FROSTBOLT_VOLLEY = 10, - EVENT_MANA_VOID = 11, - EVENT_COLUMN_OF_FROST = 12, + // Risen Archmage + EVENT_FROSTBOLT_VOLLEY = 10, + EVENT_MANA_VOID = 11, + EVENT_COLUMN_OF_FROST = 12, - // Blazing Skeleton - EVENT_FIREBALL = 13, - EVENT_LEY_WASTE = 14, + // Blazing Skeleton + EVENT_FIREBALL = 13, + EVENT_LEY_WASTE = 14, - // Suppresser - EVENT_SUPPRESSION = 15, + // Suppresser + EVENT_SUPPRESSION = 15, - // Gluttonous Abomination - EVENT_GUT_SPRAY = 16, + // Gluttonous Abomination + EVENT_GUT_SPRAY = 16, - // Dream Cloud - // Nightmare Cloud - EVENT_CHECK_PLAYER = 17, - EVENT_EXPLODE = 18, + // Dream Cloud + // Nightmare Cloud + EVENT_CHECK_PLAYER = 17, + EVENT_EXPLODE = 18, }; enum Actions { - ACTION_ENTER_COMBAT = 1, - MISSED_PORTALS = 2, - ACTION_DEATH = 3, + ACTION_ENTER_COMBAT = 1, + MISSED_PORTALS = 2, + ACTION_DEATH = 3, }; Position const ValithriaSpawnPos = {4210.813f, 2484.443f, 364.9558f, 0.01745329f}; class RisenArchmageCheck { - public: - // look for all permanently spawned Risen Archmages that are not yet in combat - bool operator()(Creature* creature) - { - return creature->IsAlive() && creature->GetEntry() == NPC_RISEN_ARCHMAGE && - creature->GetDBTableGUIDLow() && !creature->IsInCombat(); - } + public: + // look for all permanently spawned Risen Archmages that are not yet in combat + bool operator()(Creature* creature) + { + return creature->IsAlive() && creature->GetEntry() == NPC_RISEN_ARCHMAGE && + creature->GetDBTableGUIDLow() && !creature->IsInCombat(); + } }; struct ManaVoidSelector : public std::unary_function { - explicit ManaVoidSelector(WorldObject const* source) : _source(source) { } + explicit ManaVoidSelector(WorldObject const* source) : _source(source) { } - bool operator()(Unit* unit) const - { - return unit->getPowerType() == POWER_MANA && _source->GetDistance(unit) > 15.0f; - } + bool operator()(Unit* unit) const + { + return unit->getPowerType() == POWER_MANA && _source->GetDistance(unit) > 15.0f; + } - WorldObject const* _source; + WorldObject const* _source; }; class DelayedCastEvent : public BasicEvent { - public: - DelayedCastEvent(Creature* trigger, uint32 spellId, uint64 originalCaster, uint32 despawnTime) : _trigger(trigger), _originalCaster(originalCaster), _spellId(spellId), _despawnTime(despawnTime) - { - } + public: + DelayedCastEvent(Creature* trigger, uint32 spellId, uint64 originalCaster, uint32 despawnTime) : _trigger(trigger), _originalCaster(originalCaster), _spellId(spellId), _despawnTime(despawnTime) + { + } - bool Execute(uint64 /*time*/, uint32 /*diff*/) - { - _trigger->CastSpell(_trigger, _spellId, false, NULL, NULL, _originalCaster); - if (_despawnTime) - _trigger->DespawnOrUnsummon(_despawnTime); - return true; - } + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _trigger->CastSpell(_trigger, _spellId, false, NULL, NULL, _originalCaster); + if (_despawnTime) + _trigger->DespawnOrUnsummon(_despawnTime); + return true; + } - private: - Creature* _trigger; - uint64 _originalCaster; - uint32 _spellId; - uint32 _despawnTime; + private: + Creature* _trigger; + uint64 _originalCaster; + uint32 _spellId; + uint32 _despawnTime; }; class AuraRemoveEvent : public BasicEvent { - public: - AuraRemoveEvent(Creature* trigger, uint32 spellId) : _trigger(trigger), _spellId(spellId) - { - } + public: + AuraRemoveEvent(Creature* trigger, uint32 spellId) : _trigger(trigger), _spellId(spellId) + { + } - bool Execute(uint64 /*time*/, uint32 /*diff*/) - { - _trigger->RemoveAurasDueToSpell(_spellId); - return true; - } + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _trigger->RemoveAurasDueToSpell(_spellId); + return true; + } - private: - Creature* _trigger; - uint32 _spellId; + private: + Creature* _trigger; + uint32 _spellId; }; class ValithriaDespawner : public BasicEvent { - public: - explicit ValithriaDespawner(Creature* creature) : _creature(creature) - { - } + public: + explicit ValithriaDespawner(Creature* creature) : _creature(creature) + { + } - bool Execute(uint64 /*currTime*/, uint32 /*diff*/) - { - Trinity::CreatureWorker worker(_creature, *this); - _creature->VisitNearbyGridObject(333.0f, worker); - _creature->AI()->Reset(); - _creature->setActive(false); - return true; - } + bool Execute(uint64 /*currTime*/, uint32 /*diff*/) + { + Trinity::CreatureWorker worker(_creature, *this); + _creature->VisitNearbyGridObject(333.0f, worker); + _creature->AI()->Reset(); + _creature->setActive(false); + return true; + } - void operator()(Creature* creature) const - { - switch (creature->GetEntry()) - { - case NPC_VALITHRIA_DREAMWALKER: - if (InstanceScript* instance = creature->GetInstanceScript()) - instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, creature); - break; - case NPC_THE_LICH_KING_VALITHRIA: - if (creature->IsAlive()) - creature->AI()->Reset(); - return; - case NPC_BLAZING_SKELETON: - case NPC_SUPPRESSER: - case NPC_BLISTERING_ZOMBIE: - case NPC_GLUTTONOUS_ABOMINATION: - case NPC_MANA_VOID: - case NPC_COLUMN_OF_FROST: - case NPC_ROT_WORM: - creature->DespawnOrUnsummon(); - return; - case NPC_RISEN_ARCHMAGE: - if (!creature->GetDBTableGUIDLow()) - { - creature->DespawnOrUnsummon(); - return; - } - break; - default: - return; - } + void operator()(Creature* creature) const + { + switch (creature->GetEntry()) + { + case NPC_VALITHRIA_DREAMWALKER: + if (InstanceScript* instance = creature->GetInstanceScript()) + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, creature); + break; + case NPC_THE_LICH_KING_VALITHRIA: + if (creature->IsAlive()) + creature->AI()->Reset(); + return; + case NPC_BLAZING_SKELETON: + case NPC_SUPPRESSER: + case NPC_BLISTERING_ZOMBIE: + case NPC_GLUTTONOUS_ABOMINATION: + case NPC_MANA_VOID: + case NPC_COLUMN_OF_FROST: + case NPC_ROT_WORM: + creature->DespawnOrUnsummon(); + return; + case NPC_RISEN_ARCHMAGE: + if (!creature->GetDBTableGUIDLow()) + { + creature->DespawnOrUnsummon(); + return; + } + break; + default: + return; + } - uint32 corpseDelay = creature->GetCorpseDelay(); - uint32 respawnDelay = creature->GetRespawnDelay(); - creature->SetCorpseDelay(1); - creature->SetRespawnDelay(10); + uint32 corpseDelay = creature->GetCorpseDelay(); + uint32 respawnDelay = creature->GetRespawnDelay(); + creature->SetCorpseDelay(1); + creature->SetRespawnDelay(10); - if (CreatureData const* data = creature->GetCreatureData()) - creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); - if (!creature->IsAlive()) - { - creature->RemoveCorpse(false); - creature->SetRespawnTime(11); - } - else - creature->DespawnOrUnsummon(); + if (CreatureData const* data = creature->GetCreatureData()) + creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); + if (!creature->IsAlive()) + { + creature->RemoveCorpse(false); + creature->SetRespawnTime(11); + } + else + creature->DespawnOrUnsummon(); - creature->SetCorpseDelay(corpseDelay); - creature->SetRespawnDelay(respawnDelay); - } + creature->SetCorpseDelay(corpseDelay); + creature->SetRespawnDelay(respawnDelay); + } - private: - Creature* _creature; + private: + Creature* _creature; }; class boss_valithria_dreamwalker : public CreatureScript { - public: - boss_valithria_dreamwalker() : CreatureScript("boss_valithria_dreamwalker") { } + public: + boss_valithria_dreamwalker() : CreatureScript("boss_valithria_dreamwalker") { } - struct boss_valithria_dreamwalkerAI : public ScriptedAI - { - boss_valithria_dreamwalkerAI(Creature* creature) : ScriptedAI(creature), - _instance(creature->GetInstanceScript()), _portalCount(RAID_MODE(3, 8, 3, 8)) - { - me->SetReactState(REACT_PASSIVE); - _spawnHealth = 1; // just in case if not set below - if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetDBTableGUIDLow())) - if (data->curhealth) - _spawnHealth = data->curhealth; - } + struct boss_valithria_dreamwalkerAI : public ScriptedAI + { + boss_valithria_dreamwalkerAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()), _portalCount(RAID_MODE(3, 8, 3, 8)) + { + me->SetReactState(REACT_PASSIVE); + _spawnHealth = 1; // just in case if not set below + if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetDBTableGUIDLow())) + if (data->curhealth) + _spawnHealth = data->curhealth; + } - void Reset() - { - _events.Reset(); - me->SetHealth(_spawnHealth); - me->LoadCreaturesAddon(true); - // immune to percent heals - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_OBS_MOD_HEALTH, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_HEAL_PCT, true); - // Glyph of Dispel Magic - not a percent heal by effect, its cast with custom basepoints - me->ApplySpellImmune(0, IMMUNITY_ID, 56131, true); - _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - _missedPortals = 0; - _under25PercentTalkDone = false; - _over75PercentTalkDone = false; - _justDied = false; - _done = false; - } + void Reset() + { + _events.Reset(); + me->SetHealth(_spawnHealth); + me->LoadCreaturesAddon(true); + // immune to percent heals + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_OBS_MOD_HEALTH, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_HEAL_PCT, true); + // Glyph of Dispel Magic - not a percent heal by effect, its cast with custom basepoints + me->ApplySpellImmune(0, IMMUNITY_ID, 56131, true); + _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + _missedPortals = 0; + _under25PercentTalkDone = false; + _over75PercentTalkDone = false; + _justDied = false; + _done = false; + } - void AttackStart(Unit* /*target*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} + void AttackStart(Unit* /*target*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void DoAction(int32 action) - { - if (action != ACTION_ENTER_COMBAT) - return; + void DoAction(int32 action) + { + if (action != ACTION_ENTER_COMBAT) + return; - _instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); - _events.Reset(); - _events.ScheduleEvent(EVENT_INTRO_TALK, 15000); - _events.ScheduleEvent(EVENT_DREAM_PORTAL, urand(45000, 48000)); - if (IsHeroic()) - _events.ScheduleEvent(EVENT_BERSERK, 420000); - } + _instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); + _events.Reset(); + _events.ScheduleEvent(EVENT_INTRO_TALK, 15000); + _events.ScheduleEvent(EVENT_DREAM_PORTAL, urand(45000, 48000)); + if (IsHeroic()) + _events.ScheduleEvent(EVENT_BERSERK, 420000); + } - void HealReceived(Unit* healer, uint32& heal) - { - if (!me->hasLootRecipient()) - me->SetLootRecipient(healer); - me->LowerPlayerDamageReq(heal); + void HealReceived(Unit* healer, uint32& heal) + { + if (!me->hasLootRecipient()) + me->SetLootRecipient(healer); + me->LowerPlayerDamageReq(heal); - // encounter complete - if (me->HealthAbovePctHealed(100, heal) && !_done) - { - _done = true; - Talk(SAY_VALITHRIA_SUCCESS); - _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - _instance->DoRemoveAurasDueToSpellOnPlayers(70766); - me->RemoveAurasDueToSpell(SPELL_CORRUPTION_VALITHRIA); - me->CastSpell(me, SPELL_ACHIEVEMENT_CHECK, true); - me->CastSpell((Unit*)NULL, SPELL_DREAMWALKERS_RAGE, false); - _events.Reset(); - _events.ScheduleEvent(EVENT_DREAM_SLIP, 3500); - _instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, DONE); + // encounter complete + if (me->HealthAbovePctHealed(100, heal) && !_done) + { + _done = true; + Talk(SAY_VALITHRIA_SUCCESS); + _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + _instance->DoRemoveAurasDueToSpellOnPlayers(70766); + me->RemoveAurasDueToSpell(SPELL_CORRUPTION_VALITHRIA); + me->CastSpell(me, SPELL_ACHIEVEMENT_CHECK, true); + me->CastSpell((Unit*)NULL, SPELL_DREAMWALKERS_RAGE, false); + _events.Reset(); + _events.ScheduleEvent(EVENT_DREAM_SLIP, 3500); + _instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, DONE); - if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) - trigger->AI()->EnterEvadeMode(); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING))) - lichKing->AI()->Reset(); - } - else if (!_over75PercentTalkDone && me->HealthAbovePctHealed(75, heal)) - { - _over75PercentTalkDone = true; - Talk(SAY_VALITHRIA_75_PERCENT); - } - else if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) == NOT_STARTED) - if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) - trigger->AI()->DoAction(ACTION_ENTER_COMBAT); - } + if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) + trigger->AI()->EnterEvadeMode(); + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING))) + lichKing->AI()->Reset(); + } + else if (!_over75PercentTalkDone && me->HealthAbovePctHealed(75, heal)) + { + _over75PercentTalkDone = true; + Talk(SAY_VALITHRIA_75_PERCENT); + } + else if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) == NOT_STARTED) + if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) + trigger->AI()->DoAction(ACTION_ENTER_COMBAT); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (me->HealthBelowPctDamaged(25, damage)) - { - if (!_under25PercentTalkDone) - { - _under25PercentTalkDone = true; - Talk(SAY_VALITHRIA_25_PERCENT); - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (me->HealthBelowPctDamaged(25, damage)) + { + if (!_under25PercentTalkDone) + { + _under25PercentTalkDone = true; + Talk(SAY_VALITHRIA_25_PERCENT); + } - if (damage >= me->GetHealth()) - { - damage = 0; - if (!_justDied) - { - _justDied = true; - Talk(SAY_VALITHRIA_DEATH); - _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) - trigger->AI()->EnterEvadeMode(); - } - } - } - } + if (damage >= me->GetHealth()) + { + damage = 0; + if (!_justDied) + { + _justDied = true; + Talk(SAY_VALITHRIA_DEATH); + _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) + trigger->AI()->EnterEvadeMode(); + } + } + } + } - void SpellHit(Unit* /*caster*/, SpellInfo const* spell) - { - if (spell->Id == SPELL_DREAM_SLIP) - { - me->CastSpell(me, SPELL_CLEAR_ALL, true); - me->CastSpell(me, SPELL_AWARD_REPUTATION_BOSS_KILL, true); - // this display id was found in sniff instead of the one on aura - me->SetDisplayId(11686); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->DespawnOrUnsummon(4000); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING))) - lichKing->CastSpell(lichKing, SPELL_SPAWN_CHEST, false); - _instance->SetData(DATA_WEEKLY_QUEST_ID, 0); // show hidden npc if necessary - } - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_DREAM_SLIP) + { + me->CastSpell(me, SPELL_CLEAR_ALL, true); + me->CastSpell(me, SPELL_AWARD_REPUTATION_BOSS_KILL, true); + // this display id was found in sniff instead of the one on aura + me->SetDisplayId(11686); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->DespawnOrUnsummon(4000); + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING))) + lichKing->CastSpell(lichKing, SPELL_SPAWN_CHEST, false); + _instance->SetData(DATA_WEEKLY_QUEST_ID, 0); // show hidden npc if necessary + } + } - void JustSummoned(Creature* summon) - { - if (summon->GetEntry() == NPC_DREAM_PORTAL_PRE_EFFECT) - { - summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_SUMMON_DREAM_PORTAL, me->GetGUID(), 6000), summon->m_Events.CalculateTime(15000)); - summon->m_Events.AddEvent(new AuraRemoveEvent(summon, SPELL_DREAM_PORTAL_VISUAL_PRE), summon->m_Events.CalculateTime(15000)); - } - else if (summon->GetEntry() == NPC_NIGHTMARE_PORTAL_PRE_EFFECT) - { - summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_SUMMON_NIGHTMARE_PORTAL, me->GetGUID(), 6000), summon->m_Events.CalculateTime(15000)); - summon->m_Events.AddEvent(new AuraRemoveEvent(summon, SPELL_NIGHTMARE_PORTAL_VISUAL_PRE), summon->m_Events.CalculateTime(15000)); - } - } + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() == NPC_DREAM_PORTAL_PRE_EFFECT) + { + summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_SUMMON_DREAM_PORTAL, me->GetGUID(), 6000), summon->m_Events.CalculateTime(15000)); + summon->m_Events.AddEvent(new AuraRemoveEvent(summon, SPELL_DREAM_PORTAL_VISUAL_PRE), summon->m_Events.CalculateTime(15000)); + } + else if (summon->GetEntry() == NPC_NIGHTMARE_PORTAL_PRE_EFFECT) + { + summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_SUMMON_NIGHTMARE_PORTAL, me->GetGUID(), 6000), summon->m_Events.CalculateTime(15000)); + summon->m_Events.AddEvent(new AuraRemoveEvent(summon, SPELL_NIGHTMARE_PORTAL_VISUAL_PRE), summon->m_Events.CalculateTime(15000)); + } + } - void SummonedCreatureDespawn(Creature* summon) - { - if (summon->GetEntry() == NPC_DREAM_PORTAL || summon->GetEntry() == NPC_NIGHTMARE_PORTAL) - if (summon->AI()->GetData(MISSED_PORTALS)) - ++_missedPortals; - } + void SummonedCreatureDespawn(Creature* summon) + { + if (summon->GetEntry() == NPC_DREAM_PORTAL || summon->GetEntry() == NPC_NIGHTMARE_PORTAL) + if (summon->AI()->GetData(MISSED_PORTALS)) + ++_missedPortals; + } - void UpdateAI(uint32 diff) - { - // does not enter combat - if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) == NOT_STARTED) - { - if (me->GetHealth() != _spawnHealth) // healing when boss cannot be engaged (lower spire not finished, cheating) doesn't start the fight, prevent winning this way - me->SetHealth(_spawnHealth); - return; - } + void UpdateAI(uint32 diff) + { + // does not enter combat + if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) == NOT_STARTED) + { + if (me->GetHealth() != _spawnHealth) // healing when boss cannot be engaged (lower spire not finished, cheating) doesn't start the fight, prevent winning this way + me->SetHealth(_spawnHealth); + return; + } - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (_events.ExecuteEvent()) - { - case EVENT_INTRO_TALK: - Talk(SAY_VALITHRIA_ENTER_COMBAT); - break; - case EVENT_BERSERK: - Talk(SAY_VALITHRIA_BERSERK); - break; - case EVENT_DREAM_PORTAL: - if (!IsHeroic()) - Talk(SAY_VALITHRIA_DREAM_PORTAL); - for (uint32 i = 0; i < _portalCount; ++i) - me->CastSpell(me, SUMMON_PORTAL, false); - _events.ScheduleEvent(EVENT_DREAM_PORTAL, urand(45000, 48000)); - break; - case EVENT_DREAM_SLIP: - me->CastSpell(me, SPELL_DREAM_SLIP, false); - break; - default: - break; - } - } + switch (_events.ExecuteEvent()) + { + case EVENT_INTRO_TALK: + Talk(SAY_VALITHRIA_ENTER_COMBAT); + break; + case EVENT_BERSERK: + Talk(SAY_VALITHRIA_BERSERK); + break; + case EVENT_DREAM_PORTAL: + if (!IsHeroic()) + Talk(SAY_VALITHRIA_DREAM_PORTAL); + for (uint32 i = 0; i < _portalCount; ++i) + me->CastSpell(me, SUMMON_PORTAL, false); + _events.ScheduleEvent(EVENT_DREAM_PORTAL, urand(45000, 48000)); + break; + case EVENT_DREAM_SLIP: + me->CastSpell(me, SPELL_DREAM_SLIP, false); + break; + default: + break; + } + } - uint32 GetData(uint32 type) const - { - if (type == MISSED_PORTALS) - return _missedPortals; + uint32 GetData(uint32 type) const + { + if (type == MISSED_PORTALS) + return _missedPortals; - return 0; - } + return 0; + } - private: - EventMap _events; - InstanceScript* _instance; - uint32 _spawnHealth; - uint32 const _portalCount; - uint32 _missedPortals; - bool _under25PercentTalkDone; - bool _over75PercentTalkDone; - bool _justDied; - bool _done; - }; + private: + EventMap _events; + InstanceScript* _instance; + uint32 _spawnHealth; + uint32 const _portalCount; + uint32 _missedPortals; + bool _under25PercentTalkDone; + bool _over75PercentTalkDone; + bool _justDied; + bool _done; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_green_dragon_combat_trigger : public CreatureScript { - public: - npc_green_dragon_combat_trigger() : CreatureScript("npc_green_dragon_combat_trigger") { } + public: + npc_green_dragon_combat_trigger() : CreatureScript("npc_green_dragon_combat_trigger") { } - struct npc_green_dragon_combat_triggerAI : public BossAI - { - npc_green_dragon_combat_triggerAI(Creature* creature) : BossAI(creature, DATA_VALITHRIA_DREAMWALKER) - { - } + struct npc_green_dragon_combat_triggerAI : public BossAI + { + npc_green_dragon_combat_triggerAI(Creature* creature) : BossAI(creature, DATA_VALITHRIA_DREAMWALKER) + { + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - if (instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != DONE) - instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, NOT_STARTED); - me->SetReactState(REACT_PASSIVE); - checkTimer = 5000; - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + if (instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != DONE) + instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, NOT_STARTED); + me->SetReactState(REACT_PASSIVE); + checkTimer = 5000; + } - void EnterCombat(Unit* target) - { - if (!instance->CheckRequiredBosses(DATA_VALITHRIA_DREAMWALKER, target->ToPlayer())) - { - me->setActive(true); - EnterEvadeMode(); - instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); - return; - } - if (instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) == DONE) - { - me->CombatStop(); - return; - } + void EnterCombat(Unit* target) + { + if (!instance->CheckRequiredBosses(DATA_VALITHRIA_DREAMWALKER, target->ToPlayer())) + { + me->setActive(true); + EnterEvadeMode(); + instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); + return; + } + if (instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) == DONE) + { + me->CombatStop(); + return; + } - me->setActive(true); - me->SetInCombatWithZone(); - instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, IN_PROGRESS); - if (Creature* valithria = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VALITHRIA_DREAMWALKER))) - valithria->AI()->DoAction(ACTION_ENTER_COMBAT); - if (Creature* lichKing = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VALITHRIA_LICH_KING))) - lichKing->AI()->DoAction(ACTION_ENTER_COMBAT); + me->setActive(true); + me->SetInCombatWithZone(); + instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, IN_PROGRESS); + if (Creature* valithria = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VALITHRIA_DREAMWALKER))) + valithria->AI()->DoAction(ACTION_ENTER_COMBAT); + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VALITHRIA_LICH_KING))) + lichKing->AI()->DoAction(ACTION_ENTER_COMBAT); - std::list archmages; - RisenArchmageCheck check; - Trinity::CreatureListSearcher searcher(me, archmages, check); - me->VisitNearbyGridObject(100.0f, searcher); - for (std::list::iterator itr = archmages.begin(); itr != archmages.end(); ++itr) - (*itr)->AI()->DoAction(ACTION_ENTER_COMBAT); - } + std::list archmages; + RisenArchmageCheck check; + Trinity::CreatureListSearcher searcher(me, archmages, check); + me->VisitNearbyGridObject(100.0f, searcher); + for (std::list::iterator itr = archmages.begin(); itr != archmages.end(); ++itr) + (*itr)->AI()->DoAction(ACTION_ENTER_COMBAT); + } - void AttackStart(Unit* target) - { - if (target->GetTypeId() == TYPEID_PLAYER) - BossAI::AttackStart(target); - } + void AttackStart(Unit* target) + { + if (target->GetTypeId() == TYPEID_PLAYER) + BossAI::AttackStart(target); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - bool CanAIAttack(Unit const* target) const - { - return target->GetTypeId() == TYPEID_PLAYER; - } + bool CanAIAttack(Unit const* target) const + { + return target->GetTypeId() == TYPEID_PLAYER; + } - void JustReachedHome() - { - if (instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != DONE) - DoAction(ACTION_DEATH); // setActive(false) in ValithriaDespawner - else - _JustReachedHome(); - } + void JustReachedHome() + { + if (instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != DONE) + DoAction(ACTION_DEATH); // setActive(false) in ValithriaDespawner + else + _JustReachedHome(); + } - void DoAction(int32 action) - { - if (action == ACTION_DEATH) - me->m_Events.AddEvent(new ValithriaDespawner(me), me->m_Events.CalculateTime(5000)); - else if (action == ACTION_ENTER_COMBAT) - { - if (!me->IsInCombat()) - me->SetInCombatWithZone(); - } - } + void DoAction(int32 action) + { + if (action == ACTION_DEATH) + me->m_Events.AddEvent(new ValithriaDespawner(me), me->m_Events.CalculateTime(5000)); + else if (action == ACTION_ENTER_COMBAT) + { + if (!me->IsInCombat()) + me->SetInCombatWithZone(); + } + } - void UpdateAI(uint32 diff) - { - if (!me->IsInCombat()) - return; + void UpdateAI(uint32 diff) + { + if (!me->IsInCombat()) + return; - if (checkTimer <= diff) - { - checkTimer = 3000; - me->SetInCombatWithZone(); - ThreatContainer::StorageType const& threatList = me->getThreatManager().getThreatList(); - if (!threatList.empty()) - for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) - if (Unit* target = (*itr)->getTarget()) - if (target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER && me->GetExactDist(target) < 200.0f && !target->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL)) - return; - EnterEvadeMode(); - } - else - checkTimer -= diff; - } + if (checkTimer <= diff) + { + checkTimer = 3000; + me->SetInCombatWithZone(); + ThreatContainer::StorageType const& threatList = me->getThreatManager().getThreatList(); + if (!threatList.empty()) + for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + if (Unit* target = (*itr)->getTarget()) + if (target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER && me->GetExactDist(target) < 200.0f && !target->IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_ALL)) + return; + EnterEvadeMode(); + } + else + checkTimer -= diff; + } - private: - uint16 checkTimer; - }; + private: + uint16 checkTimer; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_the_lich_king_controller : public CreatureScript { - public: - npc_the_lich_king_controller() : CreatureScript("npc_the_lich_king_controller") { } + public: + npc_the_lich_king_controller() : CreatureScript("npc_the_lich_king_controller") { } - struct npc_the_lich_king_controllerAI : public ScriptedAI - { - npc_the_lich_king_controllerAI(Creature* creature) : ScriptedAI(creature), - _instance(creature->GetInstanceScript()) - { - me->SetReactState(REACT_PASSIVE); - } + struct npc_the_lich_king_controllerAI : public ScriptedAI + { + npc_the_lich_king_controllerAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) + { + me->SetReactState(REACT_PASSIVE); + } - void Reset() - { - _events.Reset(); - me->RemoveAllAuras(); - me->CombatStop(); - } + void Reset() + { + _events.Reset(); + me->RemoveAllAuras(); + me->CombatStop(); + } - void DoAction(int32 action) - { - if (action == ACTION_ENTER_COMBAT) - { - Talk(SAY_LICH_KING_INTRO); - _events.Reset(); - _events.ScheduleEvent(EVENT_GLUTTONOUS_ABOMINATION_SUMMONER, 5000); - _events.ScheduleEvent(EVENT_SUPPRESSER_SUMMONER, 10000); - _events.ScheduleEvent(EVENT_BLISTERING_ZOMBIE_SUMMONER, 15000); - _events.ScheduleEvent(EVENT_RISEN_ARCHMAGE_SUMMONER, 20000); - _events.ScheduleEvent(EVENT_BLAZING_SKELETON_SUMMONER, 30000); - } - } + void DoAction(int32 action) + { + if (action == ACTION_ENTER_COMBAT) + { + Talk(SAY_LICH_KING_INTRO); + _events.Reset(); + _events.ScheduleEvent(EVENT_GLUTTONOUS_ABOMINATION_SUMMONER, 5000); + _events.ScheduleEvent(EVENT_SUPPRESSER_SUMMONER, 10000); + _events.ScheduleEvent(EVENT_BLISTERING_ZOMBIE_SUMMONER, 15000); + _events.ScheduleEvent(EVENT_RISEN_ARCHMAGE_SUMMONER, 20000); + _events.ScheduleEvent(EVENT_BLAZING_SKELETON_SUMMONER, 30000); + } + } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void JustSummoned(Creature* summon) - { - summon->SetPhaseMask((summon->GetPhaseMask() & ~0x10), true); // must not be in dream phase - if (summon->GetEntry() != NPC_SUPPRESSER) - if (Unit* target = SelectTargetFromPlayerList(200.0f)) - summon->AI()->AttackStart(target); - } + void JustSummoned(Creature* summon) + { + summon->SetPhaseMask((summon->GetPhaseMask() & ~0x10), true); // must not be in dream phase + if (summon->GetEntry() != NPC_SUPPRESSER) + if (Unit* target = SelectTargetFromPlayerList(200.0f)) + summon->AI()->AttackStart(target); + } - void UpdateAI(uint32 diff) - { - // does not enter combat - if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != IN_PROGRESS) - return; + void UpdateAI(uint32 diff) + { + // does not enter combat + if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != IN_PROGRESS) + return; - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (_events.ExecuteEvent()) - { - case EVENT_GLUTTONOUS_ABOMINATION_SUMMONER: - me->CastSpell(me, SPELL_TIMER_GLUTTONOUS_ABOMINATION, false); - break; - case EVENT_SUPPRESSER_SUMMONER: - me->CastSpell(me, SPELL_TIMER_SUPPRESSER, false); - break; - case EVENT_BLISTERING_ZOMBIE_SUMMONER: - me->CastSpell(me, SPELL_TIMER_BLISTERING_ZOMBIE, false); - break; - case EVENT_RISEN_ARCHMAGE_SUMMONER: - me->CastSpell(me, SPELL_TIMER_RISEN_ARCHMAGE, false); - break; - case EVENT_BLAZING_SKELETON_SUMMONER: - me->CastSpell(me, SPELL_TIMER_BLAZING_SKELETON, false); - break; - default: - break; - } - } + switch (_events.ExecuteEvent()) + { + case EVENT_GLUTTONOUS_ABOMINATION_SUMMONER: + me->CastSpell(me, SPELL_TIMER_GLUTTONOUS_ABOMINATION, false); + break; + case EVENT_SUPPRESSER_SUMMONER: + me->CastSpell(me, SPELL_TIMER_SUPPRESSER, false); + break; + case EVENT_BLISTERING_ZOMBIE_SUMMONER: + me->CastSpell(me, SPELL_TIMER_BLISTERING_ZOMBIE, false); + break; + case EVENT_RISEN_ARCHMAGE_SUMMONER: + me->CastSpell(me, SPELL_TIMER_RISEN_ARCHMAGE, false); + break; + case EVENT_BLAZING_SKELETON_SUMMONER: + me->CastSpell(me, SPELL_TIMER_BLAZING_SKELETON, false); + break; + default: + break; + } + } - private: - EventMap _events; - InstanceScript* _instance; - }; + private: + EventMap _events; + InstanceScript* _instance; + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_the_lich_king_controllerAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_the_lich_king_controllerAI(creature); + } }; class npc_risen_archmage : public CreatureScript { - public: - npc_risen_archmage() : CreatureScript("npc_risen_archmage") { } + public: + npc_risen_archmage() : CreatureScript("npc_risen_archmage") { } - struct npc_risen_archmageAI : public ScriptedAI - { - npc_risen_archmageAI(Creature* creature) : ScriptedAI(creature), - _instance(creature->GetInstanceScript()) - { - } + struct npc_risen_archmageAI : public ScriptedAI + { + npc_risen_archmageAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) + { + } - bool CanAIAttack(Unit const* target) const - { - return target->GetEntry() != NPC_VALITHRIA_DREAMWALKER; - } + bool CanAIAttack(Unit const* target) const + { + return target->GetEntry() != NPC_VALITHRIA_DREAMWALKER; + } - void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EVENT_FROSTBOLT_VOLLEY, urand(5000, 15000)); - _events.ScheduleEvent(EVENT_MANA_VOID, urand(15000, 25000)); - _events.ScheduleEvent(EVENT_COLUMN_OF_FROST, urand(10000, 20000)); - } + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_FROSTBOLT_VOLLEY, urand(5000, 15000)); + _events.ScheduleEvent(EVENT_MANA_VOID, urand(15000, 25000)); + _events.ScheduleEvent(EVENT_COLUMN_OF_FROST, urand(10000, 20000)); + } - void EnterCombat(Unit* /*target*/) - { - me->FinishSpell(CURRENT_CHANNELED_SPELL, false); - me->SetInCombatWithZone(); - if (me->GetDBTableGUIDLow()) - if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) - trigger->AI()->DoAction(ACTION_ENTER_COMBAT); - } + void EnterCombat(Unit* /*target*/) + { + me->FinishSpell(CURRENT_CHANNELED_SPELL, false); + me->SetInCombatWithZone(); + if (me->GetDBTableGUIDLow()) + if (Creature* trigger = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_TRIGGER))) + trigger->AI()->DoAction(ACTION_ENTER_COMBAT); + } - void DoAction(int32 action) - { - if (action == ACTION_ENTER_COMBAT && !me->IsInCombat()) - me->SetInCombatWithZone(); - } + void DoAction(int32 action) + { + if (action == ACTION_ENTER_COMBAT && !me->IsInCombat()) + me->SetInCombatWithZone(); + } - void JustSummoned(Creature* summon) - { - if (summon->GetEntry() == NPC_COLUMN_OF_FROST) - summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_COLUMN_OF_FROST_DAMAGE, 0, 8000), summon->m_Events.CalculateTime(2000)); - else if (summon->GetEntry() == NPC_MANA_VOID) - summon->DespawnOrUnsummon(36000); - } + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() == NPC_COLUMN_OF_FROST) + summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_COLUMN_OF_FROST_DAMAGE, 0, 8000), summon->m_Events.CalculateTime(2000)); + else if (summon->GetEntry() == NPC_MANA_VOID) + summon->DespawnOrUnsummon(36000); + } - void UpdateAI(uint32 diff) - { - if (!me->IsInCombat()) - if (me->GetDBTableGUIDLow()) - if (!me->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - me->CastSpell(me, SPELL_CORRUPTION, false); + void UpdateAI(uint32 diff) + { + if (!me->IsInCombat()) + if (me->GetDBTableGUIDLow()) + if (!me->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + me->CastSpell(me, SPELL_CORRUPTION, false); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - while (uint32 eventId = _events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_FROSTBOLT_VOLLEY: - me->CastSpell(me, SPELL_FROSTBOLT_VOLLEY, false); - _events.ScheduleEvent(EVENT_FROSTBOLT_VOLLEY, urand(8000, 15000)); - break; - case EVENT_MANA_VOID: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, ManaVoidSelector(me))) - me->CastSpell(target, SPELL_MANA_VOID, false); - _events.ScheduleEvent(EVENT_MANA_VOID, urand(20000, 25000)); - break; - case EVENT_COLUMN_OF_FROST: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -10.0f, true)) - me->CastSpell(target, SPELL_COLUMN_OF_FROST, false); - _events.ScheduleEvent(EVENT_COLUMN_OF_FROST, urand(15000, 25000)); - break; - default: - break; - } - } + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FROSTBOLT_VOLLEY: + me->CastSpell(me, SPELL_FROSTBOLT_VOLLEY, false); + _events.ScheduleEvent(EVENT_FROSTBOLT_VOLLEY, urand(8000, 15000)); + break; + case EVENT_MANA_VOID: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, ManaVoidSelector(me))) + me->CastSpell(target, SPELL_MANA_VOID, false); + _events.ScheduleEvent(EVENT_MANA_VOID, urand(20000, 25000)); + break; + case EVENT_COLUMN_OF_FROST: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -10.0f, true)) + me->CastSpell(target, SPELL_COLUMN_OF_FROST, false); + _events.ScheduleEvent(EVENT_COLUMN_OF_FROST, urand(15000, 25000)); + break; + default: + break; + } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap _events; - InstanceScript* _instance; - }; + private: + EventMap _events; + InstanceScript* _instance; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_valithria_portal : public CreatureScript { - public: - npc_valithria_portal() : CreatureScript("npc_valithria_portal") { } + public: + npc_valithria_portal() : CreatureScript("npc_valithria_portal") { } - struct npc_valithria_portalAI : public NullCreatureAI - { - npc_valithria_portalAI(Creature* creature) : NullCreatureAI(creature), _used(false) {} + struct npc_valithria_portalAI : public NullCreatureAI + { + npc_valithria_portalAI(Creature* creature) : NullCreatureAI(creature), _used(false) {} void OnSpellClick(Unit* /*clicker*/, bool& result) { if (!result) return; - _used = true; - me->DespawnOrUnsummon(); - } + _used = true; + me->DespawnOrUnsummon(); + } - uint32 GetData(uint32 type) const - { - return (type == MISSED_PORTALS && _used) ? 0 : 1; - } + uint32 GetData(uint32 type) const + { + return (type == MISSED_PORTALS && _used) ? 0 : 1; + } - private: - bool _used; - }; + private: + bool _used; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_valithria_cloud : public CreatureScript { - public: - npc_valithria_cloud() : CreatureScript("npc_valithria_cloud") { } + public: + npc_valithria_cloud() : CreatureScript("npc_valithria_cloud") { } - struct npc_valithria_cloudAI : public ScriptedAI - { - npc_valithria_cloudAI(Creature* creature) : ScriptedAI(creature), - _instance(creature->GetInstanceScript()) - { - } + struct npc_valithria_cloudAI : public ScriptedAI + { + npc_valithria_cloudAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) + { + } - void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EVENT_CHECK_PLAYER, 750); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetCorpseDelay(0); - me->LoadCreaturesAddon(true); - } + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_CHECK_PLAYER, 750); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetCorpseDelay(0); + me->LoadCreaturesAddon(true); + } - void AttackStart(Unit*) {} - void MoveInLineOfSight(Unit*) {} - void EnterEvadeMode() {} + void AttackStart(Unit*) {} + void MoveInLineOfSight(Unit*) {} + void EnterEvadeMode() {} - void UpdateAI(uint32 diff) - { - if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != IN_PROGRESS) - return; + void UpdateAI(uint32 diff) + { + if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != IN_PROGRESS) + return; - _events.Update(diff); + _events.Update(diff); - switch (_events.ExecuteEvent()) - { - case EVENT_CHECK_PLAYER: - if (me->SelectNearestPlayer(5.0f)) // also checks phase - _events.ScheduleEvent(EVENT_EXPLODE, 500); - else - _events.ScheduleEvent(EVENT_CHECK_PLAYER, 750); - break; - case EVENT_EXPLODE: - me->StopMoving(); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - // must use originalCaster the same for all clouds to allow stacking - me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); - me->DespawnOrUnsummon(1000); - break; - default: - break; - } - } + switch (_events.ExecuteEvent()) + { + case EVENT_CHECK_PLAYER: + if (me->SelectNearestPlayer(5.0f)) // also checks phase + _events.ScheduleEvent(EVENT_EXPLODE, 500); + else + _events.ScheduleEvent(EVENT_CHECK_PLAYER, 750); + break; + case EVENT_EXPLODE: + me->StopMoving(); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + // must use originalCaster the same for all clouds to allow stacking + me->CastSpell(me, EMERALD_VIGOR, false, NULL, NULL, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); + me->DespawnOrUnsummon(1000); + break; + default: + break; + } + } - private: - EventMap _events; - InstanceScript* _instance; - }; + private: + EventMap _events; + InstanceScript* _instance; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_blazing_skeleton : public CreatureScript { - public: - npc_blazing_skeleton() : CreatureScript("npc_blazing_skeleton") { } + public: + npc_blazing_skeleton() : CreatureScript("npc_blazing_skeleton") { } - struct npc_blazing_skeletonAI : public ScriptedAI - { - npc_blazing_skeletonAI(Creature* creature) : ScriptedAI(creature) - { - } + struct npc_blazing_skeletonAI : public ScriptedAI + { + npc_blazing_skeletonAI(Creature* creature) : ScriptedAI(creature) + { + } - void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EVENT_FIREBALL, urand(2000, 4000)); - _events.ScheduleEvent(EVENT_LEY_WASTE, urand(15000, 20000)); - } + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_FIREBALL, urand(2000, 4000)); + _events.ScheduleEvent(EVENT_LEY_WASTE, urand(15000, 20000)); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (_events.ExecuteEvent()) - { - case EVENT_FIREBALL: - if (!me->IsWithinMeleeRange(me->GetVictim())) - me->CastSpell(me->GetVictim(), SPELL_FIREBALL, false); - _events.ScheduleEvent(EVENT_FIREBALL, urand(2000, 4000)); - break; - case EVENT_LEY_WASTE: - me->CastSpell(me, SPELL_LEY_WASTE, false); - _events.ScheduleEvent(EVENT_LEY_WASTE, urand(15000, 20000)); - break; - default: - break; - } + switch (_events.ExecuteEvent()) + { + case EVENT_FIREBALL: + if (!me->IsWithinMeleeRange(me->GetVictim())) + me->CastSpell(me->GetVictim(), SPELL_FIREBALL, false); + _events.ScheduleEvent(EVENT_FIREBALL, urand(2000, 4000)); + break; + case EVENT_LEY_WASTE: + me->CastSpell(me, SPELL_LEY_WASTE, false); + _events.ScheduleEvent(EVENT_LEY_WASTE, urand(15000, 20000)); + break; + default: + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap _events; - }; + private: + EventMap _events; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_suppresser : public CreatureScript { - public: - npc_suppresser() : CreatureScript("npc_suppresser") { } + public: + npc_suppresser() : CreatureScript("npc_suppresser") { } - struct npc_suppresserAI : public ScriptedAI - { - npc_suppresserAI(Creature* creature) : ScriptedAI(creature), - _instance(creature->GetInstanceScript()) - { - me->SetReactState(REACT_PASSIVE); - } + struct npc_suppresserAI : public ScriptedAI + { + npc_suppresserAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) + { + me->SetReactState(REACT_PASSIVE); + } - InstanceScript* const _instance; + InstanceScript* const _instance; - void AttackStart(Unit* who) - { - if (who->GetEntry() == NPC_VALITHRIA_DREAMWALKER) - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (who->GetEntry() == NPC_VALITHRIA_DREAMWALKER) + ScriptedAI::AttackStart(who); + } - void IsSummonedBy(Unit* /*summoner*/) - { - if (Creature* valithria = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER))) - AttackStart(valithria); - } + void IsSummonedBy(Unit* /*summoner*/) + { + if (Creature* valithria = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER))) + AttackStart(valithria); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if (!me->GetVictim()) - if (Creature* valithria = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER))) - if (valithria->IsAlive()) - AttackStart(valithria); + if (!me->GetVictim()) + if (Creature* valithria = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_DREAMWALKER))) + if (valithria->IsAlive()) + AttackStart(valithria); - if (!me->GetVictim() || me->GetVictim()->GetEntry() != NPC_VALITHRIA_DREAMWALKER) - return; + if (!me->GetVictim() || me->GetVictim()->GetEntry() != NPC_VALITHRIA_DREAMWALKER) + return; - if (!me->HasUnitState(UNIT_STATE_CASTING) && !me->isMoving() && me->IsWithinMeleeRange(me->GetVictim())) - me->CastSpell((Unit*)NULL, SPELL_SUPPRESSION, false); - } - }; + if (!me->HasUnitState(UNIT_STATE_CASTING) && !me->isMoving() && me->IsWithinMeleeRange(me->GetVictim())) + me->CastSpell((Unit*)NULL, SPELL_SUPPRESSION, false); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_blistering_zombie : public CreatureScript { - public: - npc_blistering_zombie() : CreatureScript("npc_blistering_zombie") { } + public: + npc_blistering_zombie() : CreatureScript("npc_blistering_zombie") { } - struct npc_blistering_zombieAI : public ScriptedAI - { - npc_blistering_zombieAI(Creature* creature) : ScriptedAI(creature) - { - timer = 0; - casted = false; - } + struct npc_blistering_zombieAI : public ScriptedAI + { + npc_blistering_zombieAI(Creature* creature) : ScriptedAI(creature) + { + timer = 0; + casted = false; + } - uint16 timer; - bool casted; + uint16 timer; + bool casted; - void DamageTaken(Unit*, uint32 &dmg, DamageEffectType, SpellSchoolMask) - { - if (dmg >= me->GetHealth()) - { - dmg = me->GetHealth()-1; - if (!casted) - { - casted = true; - me->StopMoving(); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - me->SetControlled(true, UNIT_STATE_ROOT); - me->CastSpell(me, SPELL_ACID_BURST, false); - timer = 750; - } - } - } + void DamageTaken(Unit*, uint32 &dmg, DamageEffectType, SpellSchoolMask) + { + if (dmg >= me->GetHealth()) + { + dmg = me->GetHealth()-1; + if (!casted) + { + casted = true; + me->StopMoving(); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + me->SetControlled(true, UNIT_STATE_ROOT); + me->CastSpell(me, SPELL_ACID_BURST, false); + timer = 750; + } + } + } - void UpdateAI(uint32 diff) - { - if (timer) - { - if (timer <= diff) - { - timer = 0; - me->SetDisplayId(11686); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->DespawnOrUnsummon(2000); - } - else - timer -= diff; - } + void UpdateAI(uint32 diff) + { + if (timer) + { + if (timer <= diff) + { + timer = 0; + me->SetDisplayId(11686); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->DespawnOrUnsummon(2000); + } + else + timer -= diff; + } - if (casted) - return; + if (casted) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class npc_gluttonous_abomination : public CreatureScript { - public: - npc_gluttonous_abomination() : CreatureScript("npc_gluttonous_abomination") { } + public: + npc_gluttonous_abomination() : CreatureScript("npc_gluttonous_abomination") { } - struct npc_gluttonous_abominationAI : public ScriptedAI - { - npc_gluttonous_abominationAI(Creature* creature) : ScriptedAI(creature) - { - } + struct npc_gluttonous_abominationAI : public ScriptedAI + { + npc_gluttonous_abominationAI(Creature* creature) : ScriptedAI(creature) + { + } - void Reset() - { - _events.Reset(); - _events.ScheduleEvent(EVENT_GUT_SPRAY, urand(10000, 13000)); - } + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_GUT_SPRAY, urand(10000, 13000)); + } - void JustSummoned(Creature* summon) - { - if (me->GetInstanceScript() && me->GetInstanceScript()->GetBossState(DATA_VALITHRIA_DREAMWALKER) == DONE) - summon->DespawnOrUnsummon(1); - else if (Unit* target = SelectTargetFromPlayerList(200.0f)) - summon->AI()->AttackStart(target); - } + void JustSummoned(Creature* summon) + { + if (me->GetInstanceScript() && me->GetInstanceScript()->GetBossState(DATA_VALITHRIA_DREAMWALKER) == DONE) + summon->DespawnOrUnsummon(1); + else if (Unit* target = SelectTargetFromPlayerList(200.0f)) + summon->AI()->AttackStart(target); + } - void JustDied(Unit* /*killer*/) - { - me->CastSpell(me, SPELL_ROT_WORM_SPAWNER, true); - } + void JustDied(Unit* /*killer*/) + { + me->CastSpell(me, SPELL_ROT_WORM_SPAWNER, true); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (_events.ExecuteEvent()) - { - case EVENT_GUT_SPRAY: - me->CastSpell(me, SPELL_GUT_SPRAY, false); - _events.ScheduleEvent(EVENT_GUT_SPRAY, urand(10000, 13000)); - break; - default: - break; - } + switch (_events.ExecuteEvent()) + { + case EVENT_GUT_SPRAY: + me->CastSpell(me, SPELL_GUT_SPRAY, false); + _events.ScheduleEvent(EVENT_GUT_SPRAY, urand(10000, 13000)); + break; + default: + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap _events; - }; + private: + EventMap _events; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetIcecrownCitadelAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI(creature); + } }; class spell_dreamwalker_summon_portal : public SpellScriptLoader { - public: - spell_dreamwalker_summon_portal() : SpellScriptLoader("spell_dreamwalker_summon_portal") { } + public: + spell_dreamwalker_summon_portal() : SpellScriptLoader("spell_dreamwalker_summon_portal") { } - class spell_dreamwalker_summon_portal_SpellScript : public SpellScript - { - PrepareSpellScript(spell_dreamwalker_summon_portal_SpellScript); + class spell_dreamwalker_summon_portal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dreamwalker_summon_portal_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - Unit* target = GetHitUnit(); - if (!target) - return; + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Unit* target = GetHitUnit(); + if (!target) + return; - uint32 spellId = (GetSpellInfo()->Id == 72224 ? 71301 : 71977); // spell implicit target replaced to TARGET_DEST_DEST - float minDist = 20.0f; - float maxDist = 30.0f; - float dist = (maxDist-minDist)*rand_norm() + minDist; - float startAngle = 3*M_PI/2; - float maxAddAngle = ((target->GetMap()->GetSpawnMode()%2) == 0 ? M_PI : 2*M_PI); - float angle = startAngle + rand_norm()*maxAddAngle; - target->CastSpell(target->GetPositionX()+cos(angle)*dist, target->GetPositionY()+sin(angle)*dist, target->GetPositionZ(), spellId, true); - } + uint32 spellId = (GetSpellInfo()->Id == 72224 ? 71301 : 71977); // spell implicit target replaced to TARGET_DEST_DEST + float minDist = 20.0f; + float maxDist = 30.0f; + float dist = (maxDist-minDist)*rand_norm() + minDist; + float startAngle = 3*M_PI/2; + float maxAddAngle = ((target->GetMap()->GetSpawnMode()%2) == 0 ? M_PI : 2*M_PI); + float angle = startAngle + rand_norm()*maxAddAngle; + target->CastSpell(target->GetPositionX()+cos(angle)*dist, target->GetPositionY()+sin(angle)*dist, target->GetPositionZ(), spellId, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summon_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summon_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_dreamwalker_summon_portal_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_dreamwalker_summon_portal_SpellScript(); + } }; class spell_dreamwalker_twisted_nightmares : public SpellScriptLoader { - public: - spell_dreamwalker_twisted_nightmares() : SpellScriptLoader("spell_dreamwalker_twisted_nightmares") { } + public: + spell_dreamwalker_twisted_nightmares() : SpellScriptLoader("spell_dreamwalker_twisted_nightmares") { } - class spell_dreamwalker_twisted_nightmares_SpellScript : public SpellScript - { - PrepareSpellScript(spell_dreamwalker_twisted_nightmares_SpellScript); + class spell_dreamwalker_twisted_nightmares_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dreamwalker_twisted_nightmares_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (!GetHitUnit()) - return; + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (!GetHitUnit()) + return; - if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) - GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); - } + if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) + GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_twisted_nightmares_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_FORCE_CAST); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_twisted_nightmares_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_FORCE_CAST); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_dreamwalker_twisted_nightmares_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_dreamwalker_twisted_nightmares_SpellScript(); + } }; class spell_dreamwalker_nightmare_cloud : public SpellScriptLoader { - public: - spell_dreamwalker_nightmare_cloud() : SpellScriptLoader("spell_dreamwalker_nightmare_cloud") { } + public: + spell_dreamwalker_nightmare_cloud() : SpellScriptLoader("spell_dreamwalker_nightmare_cloud") { } - class spell_dreamwalker_nightmare_cloud_AuraScript : public AuraScript - { - PrepareAuraScript(spell_dreamwalker_nightmare_cloud_AuraScript); + class spell_dreamwalker_nightmare_cloud_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dreamwalker_nightmare_cloud_AuraScript); - bool Load() - { - _instance = GetOwner()->GetInstanceScript(); - return _instance != NULL; - } + bool Load() + { + _instance = GetOwner()->GetInstanceScript(); + return _instance != NULL; + } - void PeriodicTick(AuraEffect const* /*aurEff*/) - { - if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != IN_PROGRESS) - PreventDefaultAction(); - } + void PeriodicTick(AuraEffect const* /*aurEff*/) + { + if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) != IN_PROGRESS) + PreventDefaultAction(); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_nightmare_cloud_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_nightmare_cloud_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } - InstanceScript* _instance; - }; + InstanceScript* _instance; + }; - AuraScript* GetAuraScript() const - { - return new spell_dreamwalker_nightmare_cloud_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_dreamwalker_nightmare_cloud_AuraScript(); + } }; class spell_dreamwalker_mana_void : public SpellScriptLoader { - public: - spell_dreamwalker_mana_void() : SpellScriptLoader("spell_dreamwalker_mana_void") { } + public: + spell_dreamwalker_mana_void() : SpellScriptLoader("spell_dreamwalker_mana_void") { } - class spell_dreamwalker_mana_void_AuraScript : public AuraScript - { - PrepareAuraScript(spell_dreamwalker_mana_void_AuraScript); + class spell_dreamwalker_mana_void_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dreamwalker_mana_void_AuraScript); - void PeriodicTick(AuraEffect const* aurEff) - { - // first 3 ticks have amplitude 1 second - // remaining tick every 500ms - if (aurEff->GetTickNumber() <= 5) - if (!(aurEff->GetTickNumber() & 1)) - PreventDefaultAction(); - } + void PeriodicTick(AuraEffect const* aurEff) + { + // first 3 ticks have amplitude 1 second + // remaining tick every 500ms + if (aurEff->GetTickNumber() <= 5) + if (!(aurEff->GetTickNumber() & 1)) + PreventDefaultAction(); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_mana_void_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_mana_void_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_dreamwalker_mana_void_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_dreamwalker_mana_void_AuraScript(); + } }; class spell_dreamwalker_decay_periodic_timer : public SpellScriptLoader { - public: - spell_dreamwalker_decay_periodic_timer() : SpellScriptLoader("spell_dreamwalker_decay_periodic_timer") { } + public: + spell_dreamwalker_decay_periodic_timer() : SpellScriptLoader("spell_dreamwalker_decay_periodic_timer") { } - class spell_dreamwalker_decay_periodic_timer_AuraScript : public AuraScript - { - PrepareAuraScript(spell_dreamwalker_decay_periodic_timer_AuraScript); + class spell_dreamwalker_decay_periodic_timer_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dreamwalker_decay_periodic_timer_AuraScript); - bool Load() - { - _decayRate = GetId() != SPELL_TIMER_BLAZING_SKELETON ? 1000 : 5000; - return true; - } + bool Load() + { + _decayRate = GetId() != SPELL_TIMER_BLAZING_SKELETON ? 1000 : 5000; + return true; + } - void DecayPeriodicTimer(AuraEffect* aurEff) - { - int32 timer = aurEff->GetPeriodicTimer(); - if (timer <= 5000) - return; + void DecayPeriodicTimer(AuraEffect* aurEff) + { + int32 timer = aurEff->GetPeriodicTimer(); + if (timer <= 5000) + return; - aurEff->SetPeriodicTimer(timer - _decayRate); - } + aurEff->SetPeriodicTimer(timer - _decayRate); + } - void Register() - { - OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dreamwalker_decay_periodic_timer_AuraScript::DecayPeriodicTimer, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } + void Register() + { + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dreamwalker_decay_periodic_timer_AuraScript::DecayPeriodicTimer, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } - int32 _decayRate; - }; + int32 _decayRate; + }; - AuraScript* GetAuraScript() const - { - return new spell_dreamwalker_decay_periodic_timer_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_dreamwalker_decay_periodic_timer_AuraScript(); + } }; class spell_dreamwalker_summoner : public SpellScriptLoader { - public: - spell_dreamwalker_summoner() : SpellScriptLoader("spell_dreamwalker_summoner") { } + public: + spell_dreamwalker_summoner() : SpellScriptLoader("spell_dreamwalker_summoner") { } - class spell_dreamwalker_summoner_SpellScript : public SpellScript - { - PrepareSpellScript(spell_dreamwalker_summoner_SpellScript); + class spell_dreamwalker_summoner_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dreamwalker_summoner_SpellScript); - bool Load() - { - if (!GetCaster()->GetInstanceScript()) - return false; - return true; - } + bool Load() + { + if (!GetCaster()->GetInstanceScript()) + return false; + return true; + } - void FilterTargets(std::list& targets) - { - targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 250.0f, true)); - std::list list_copy = targets; - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); - if (targets.empty()) - { - if (list_copy.empty()) - return; - targets = list_copy; - } + void FilterTargets(std::list& targets) + { + targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 250.0f, true)); + std::list list_copy = targets; + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); + if (targets.empty()) + { + if (list_copy.empty()) + return; + targets = list_copy; + } - WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); - targets.clear(); - targets.push_back(target); - } + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); + } - void HandleForceCast(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (!GetHitUnit()) - return; + void HandleForceCast(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (!GetHitUnit()) + return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); - } + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dreamwalker_summoner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summoner_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dreamwalker_summoner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summoner_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_dreamwalker_summoner_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_dreamwalker_summoner_SpellScript(); + } }; class spell_dreamwalker_summon_suppresser : public SpellScriptLoader { - public: - spell_dreamwalker_summon_suppresser() : SpellScriptLoader("spell_dreamwalker_summon_suppresser") { } + public: + spell_dreamwalker_summon_suppresser() : SpellScriptLoader("spell_dreamwalker_summon_suppresser") { } - class spell_dreamwalker_summon_suppresser_AuraScript : public AuraScript - { - PrepareAuraScript(spell_dreamwalker_summon_suppresser_AuraScript); + class spell_dreamwalker_summon_suppresser_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dreamwalker_summon_suppresser_AuraScript); - void PeriodicTick(AuraEffect const* /*aurEff*/) - { - PreventDefaultAction(); - Unit* caster = GetCaster(); - if (!caster) - return; + void PeriodicTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + Unit* caster = GetCaster(); + if (!caster) + return; - std::list summoners; - caster->GetCreaturesWithEntryInRange(summoners, 200.0f, NPC_WORLD_TRIGGER); - std::list list_copy = summoners; - summoners.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); - if (summoners.empty()) - { - if (list_copy.empty()) - return; - summoners = list_copy; - } - Trinity::Containers::RandomResizeList(summoners, 2); + std::list summoners; + caster->GetCreaturesWithEntryInRange(summoners, 200.0f, NPC_WORLD_TRIGGER); + std::list list_copy = summoners; + summoners.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); + if (summoners.empty()) + { + if (list_copy.empty()) + return; + summoners = list_copy; + } + Trinity::Containers::RandomResizeList(summoners, 2); - for (uint32 i = 0; i < 3; ++i) - caster->CastSpell(summoners.front(), SPELL_SUMMON_SUPPRESSER, true); - for (uint32 i = 0; i < 3; ++i) - caster->CastSpell(summoners.back(), SPELL_SUMMON_SUPPRESSER, true); - } + for (uint32 i = 0; i < 3; ++i) + caster->CastSpell(summoners.front(), SPELL_SUMMON_SUPPRESSER, true); + for (uint32 i = 0; i < 3; ++i) + caster->CastSpell(summoners.back(), SPELL_SUMMON_SUPPRESSER, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_summon_suppresser_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_summon_suppresser_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_dreamwalker_summon_suppresser_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_dreamwalker_summon_suppresser_AuraScript(); + } }; class spell_dreamwalker_summon_suppresser_effect : public SpellScriptLoader { - public: - spell_dreamwalker_summon_suppresser_effect() : SpellScriptLoader("spell_dreamwalker_summon_suppresser_effect") { } + public: + spell_dreamwalker_summon_suppresser_effect() : SpellScriptLoader("spell_dreamwalker_summon_suppresser_effect") { } - class spell_dreamwalker_summon_suppresser_effect_SpellScript : public SpellScript - { - PrepareSpellScript(spell_dreamwalker_summon_suppresser_effect_SpellScript); + class spell_dreamwalker_summon_suppresser_effect_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dreamwalker_summon_suppresser_effect_SpellScript); - bool Load() - { - if (!GetCaster()->GetInstanceScript()) - return false; - return true; - } + bool Load() + { + if (!GetCaster()->GetInstanceScript()) + return false; + return true; + } - void HandleForceCast(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (!GetHitUnit()) - return; + void HandleForceCast(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (!GetHitUnit()) + return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); - } + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summon_suppresser_effect_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_dreamwalker_summon_suppresser_effect_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_dreamwalker_summon_suppresser_effect_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_dreamwalker_summon_suppresser_effect_SpellScript(); + } }; class spell_valithria_suppression : public SpellScriptLoader { - public: - spell_valithria_suppression() : SpellScriptLoader("spell_valithria_suppression") { } + public: + spell_valithria_suppression() : SpellScriptLoader("spell_valithria_suppression") { } - class spell_valithria_suppression_AuraScript : public AuraScript - { - PrepareAuraScript(spell_valithria_suppression_AuraScript); + class spell_valithria_suppression_AuraScript : public AuraScript + { + PrepareAuraScript(spell_valithria_suppression_AuraScript); - void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - const_cast(aurEff)->SetAmount(0); + void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + const_cast(aurEff)->SetAmount(0); - Unit* target = GetTarget(); - Unit::AuraApplicationMap &aam = target->GetAppliedAuras(); - Unit::AuraApplicationMapBounds range = aam.equal_range(GetSpellInfo()->Id); - uint32 count = target->GetAuraCount(GetSpellInfo()->Id); + Unit* target = GetTarget(); + Unit::AuraApplicationMap &aam = target->GetAppliedAuras(); + Unit::AuraApplicationMapBounds range = aam.equal_range(GetSpellInfo()->Id); + uint32 count = target->GetAuraCount(GetSpellInfo()->Id); - if (range.first == range.second) - return; + if (range.first == range.second) + return; - for (Unit::AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr) - if (count == 1 || itr->second->GetBase()->GetEffect(EFFECT_0)->GetAmount()) - { - itr->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(count * GetSpellInfo()->Effects[0].CalcValue()); - break; - } - } + for (Unit::AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr) + if (count == 1 || itr->second->GetBase()->GetEffect(EFFECT_0)->GetAmount()) + { + itr->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(count * GetSpellInfo()->Effects[0].CalcValue()); + break; + } + } - void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode) - { - Unit* target = GetTarget(); - Unit::AuraApplicationMap &aam = target->GetAppliedAuras(); - Unit::AuraApplicationMapBounds range = aam.equal_range(GetSpellInfo()->Id); - uint32 count = target->GetAuraCount(GetSpellInfo()->Id); + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode) + { + Unit* target = GetTarget(); + Unit::AuraApplicationMap &aam = target->GetAppliedAuras(); + Unit::AuraApplicationMapBounds range = aam.equal_range(GetSpellInfo()->Id); + uint32 count = target->GetAuraCount(GetSpellInfo()->Id); - if (range.first == range.second) - return; + if (range.first == range.second) + return; - for (Unit::AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr) - if (itr->second->GetBase()->GetEffect(EFFECT_0)->GetAmount()) - itr->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(0); + for (Unit::AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr) + if (itr->second->GetBase()->GetEffect(EFFECT_0)->GetAmount()) + itr->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(0); - range.first->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(count * GetSpellInfo()->Effects[0].CalcValue()); - } + range.first->second->GetBase()->GetEffect(EFFECT_0)->SetAmount(count * GetSpellInfo()->Effects[0].CalcValue()); + } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_valithria_suppression_AuraScript::OnApply, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - AfterEffectRemove += AuraEffectRemoveFn(spell_valithria_suppression_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_valithria_suppression_AuraScript::OnApply, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_valithria_suppression_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_valithria_suppression_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_valithria_suppression_AuraScript(); + } }; class achievement_portal_jockey : public AchievementCriteriaScript { - public: - achievement_portal_jockey() : AchievementCriteriaScript("achievement_portal_jockey") { } + public: + achievement_portal_jockey() : AchievementCriteriaScript("achievement_portal_jockey") { } - bool OnCheck(Player* /*source*/, Unit* target) - { - return target && target->GetEntry() == NPC_VALITHRIA_DREAMWALKER && !target->GetAI()->GetData(MISSED_PORTALS); - } + bool OnCheck(Player* /*source*/, Unit* target) + { + return target && target->GetEntry() == NPC_VALITHRIA_DREAMWALKER && !target->GetAI()->GetData(MISSED_PORTALS); + } }; void AddSC_boss_valithria_dreamwalker() { - new boss_valithria_dreamwalker(); - new npc_green_dragon_combat_trigger(); - new npc_the_lich_king_controller(); - new npc_risen_archmage(); - new npc_valithria_portal(); - new npc_valithria_cloud(); - new npc_blazing_skeleton(); - new npc_suppresser(); - new npc_blistering_zombie(); - new npc_gluttonous_abomination(); + new boss_valithria_dreamwalker(); + new npc_green_dragon_combat_trigger(); + new npc_the_lich_king_controller(); + new npc_risen_archmage(); + new npc_valithria_portal(); + new npc_valithria_cloud(); + new npc_blazing_skeleton(); + new npc_suppresser(); + new npc_blistering_zombie(); + new npc_gluttonous_abomination(); - new spell_dreamwalker_summon_portal(); - new spell_dreamwalker_twisted_nightmares(); - new spell_dreamwalker_nightmare_cloud(); - new spell_dreamwalker_mana_void(); - new spell_dreamwalker_decay_periodic_timer(); - new spell_dreamwalker_summoner(); - new spell_dreamwalker_summon_suppresser(); - new spell_dreamwalker_summon_suppresser_effect(); - new spell_valithria_suppression(); + new spell_dreamwalker_summon_portal(); + new spell_dreamwalker_twisted_nightmares(); + new spell_dreamwalker_nightmare_cloud(); + new spell_dreamwalker_mana_void(); + new spell_dreamwalker_decay_periodic_timer(); + new spell_dreamwalker_summoner(); + new spell_dreamwalker_summon_suppresser(); + new spell_dreamwalker_summon_suppresser_effect(); + new spell_valithria_suppression(); - new achievement_portal_jockey(); + new achievement_portal_jockey(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index f63396f3c..00495855a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -322,9 +322,9 @@ class FrostwingGauntletRespawner break; case NPC_SISTER_SVALNA: // she never dies or the event is over creature->AI()->DoAction(ACTION_RESET_EVENT); - creature->AI()->EnterEvadeMode(); - creature->AI()->Reset(); - return; + creature->AI()->EnterEvadeMode(); + creature->AI()->Reset(); + return; default: return; } @@ -333,7 +333,7 @@ class FrostwingGauntletRespawner creature->SetPosition(data->posX, data->posY, data->posZ, data->orientation); creature->DespawnOrUnsummon(); - creature->SetRespawnTime(5); + creature->SetRespawnTime(5); } }; @@ -645,7 +645,7 @@ class npc_frost_freeze_trap : public CreatureScript { npc_frost_freeze_trapAI(Creature* creature) : NullCreatureAI(creature) { - me->SetReactState(REACT_PASSIVE); + me->SetReactState(REACT_PASSIVE); } void DoAction(int32 action) @@ -663,18 +663,18 @@ class npc_frost_freeze_trap : public CreatureScript void UpdateAI(uint32 diff) { - if (me->IsInCombat()) - me->CombatStop(false); + if (me->IsInCombat()) + me->CombatStop(false); _events.Update(diff); if (_events.ExecuteEvent() == EVENT_ACTIVATE_TRAP) - if (InstanceScript* instance = me->GetInstanceScript()) - if (instance->GetData(DATA_COLDFLAME_JETS) == IN_PROGRESS) - { - DoCast(me, SPELL_COLDFLAME_JETS); - _events.ScheduleEvent(EVENT_ACTIVATE_TRAP, 22000); - } + if (InstanceScript* instance = me->GetInstanceScript()) + if (instance->GetData(DATA_COLDFLAME_JETS) == IN_PROGRESS) + { + DoCast(me, SPELL_COLDFLAME_JETS); + _events.ScheduleEvent(EVENT_ACTIVATE_TRAP, 22000); + } } private: @@ -706,7 +706,7 @@ class npc_crok_scourgebane : public CreatureScript me->SetReactState(REACT_DEFENSIVE); _didUnderTenPercentText = false; _wipeCheckTimer = 3000; - _handledWP4 = false; + _handledWP4 = false; _events.Reset(); _events.ScheduleEvent(EVENT_SCOURGE_STRIKE, urand(7500, 12500)); @@ -717,11 +717,11 @@ class npc_crok_scourgebane : public CreatureScript { if (action == ACTION_START_GAUNTLET) { - if (_isEventDone || me->isActiveObject() || !me->IsAlive()) + if (_isEventDone || me->isActiveObject() || !me->IsAlive()) return; me->setActive(true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); // Load Grid with Sister Svalna me->GetMap()->LoadGrid(4356.71f, 2484.33f); if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA))) @@ -741,10 +741,10 @@ class npc_crok_scourgebane : public CreatureScript me->setActive(false); _aliveTrash.clear(); _currentWPid = 0; - _handledWP4 = false; + _handledWP4 = false; - me->CombatStop(); - me->DeleteThreatList(); + me->CombatStop(); + me->DeleteThreatList(); } } @@ -756,9 +756,9 @@ class npc_crok_scourgebane : public CreatureScript if (_aliveTrash.empty()) { SetEscortPaused(false); - if (_currentWPid == 4 && !_handledWP4) + if (_currentWPid == 4 && !_handledWP4) { - _handledWP4 = true; + _handledWP4 = true; Talk(SAY_CROK_FINAL_WP); if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA))) svalna->AI()->DoAction(ACTION_RESURRECT_CAPTAINS); @@ -787,9 +787,9 @@ class npc_crok_scourgebane : public CreatureScript SetEscortPaused(true); break; case 4: - if (_aliveTrash.empty() && !_handledWP4) + if (_aliveTrash.empty() && !_handledWP4) { - _handledWP4 = true; + _handledWP4 = true; Talk(SAY_CROK_FINAL_WP); if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA))) svalna->AI()->DoAction(ACTION_RESURRECT_CAPTAINS); @@ -803,32 +803,32 @@ class npc_crok_scourgebane : public CreatureScript void WaypointStart(uint32 waypointId) { _currentWPid = waypointId; - float minY = 0.0f; + float minY = 0.0f; switch (waypointId) { case 0: - minY = 2600.0f; - break; + minY = 2600.0f; + break; case 1: - minY = 2550.0f; + minY = 2550.0f; if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA))) svalna->AI()->DoAction(ACTION_KILL_CAPTAIN); - break; - case 2: - minY = 2515.0f; + break; + case 2: + minY = 2515.0f; if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_SISTER_SVALNA))) svalna->AI()->DoAction(ACTION_KILL_CAPTAIN); - break; + break; case 4: - minY = 2475.0f; + minY = 2475.0f; break; default: break; } - if (minY) - { - // get all nearby vrykul + if (minY) + { + // get all nearby vrykul std::list temp; FrostwingVrykulSearcher check(me, 150.0f); Trinity::CreatureListSearcher searcher(me, temp, check); @@ -838,7 +838,7 @@ class npc_crok_scourgebane : public CreatureScript for (std::list::iterator itr = temp.begin(); itr != temp.end(); ++itr) if ((*itr)->GetHomePosition().GetPositionY() > minY) _aliveTrash.insert((*itr)->GetGUID()); - } + } } void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) @@ -848,7 +848,7 @@ class npc_crok_scourgebane : public CreatureScript if (!_didUnderTenPercentText) { _didUnderTenPercentText = true; - if (me->GetVictim() && me->GetVictim()->GetEntry() == NPC_SISTER_SVALNA) + if (me->GetVictim() && me->GetVictim()->GetEntry() == NPC_SISTER_SVALNA) Talk(SAY_CROK_WEAKENING_SVALNA); else Talk(SAY_CROK_WEAKENING_GAUNTLET); @@ -860,36 +860,36 @@ class npc_crok_scourgebane : public CreatureScript } } - void UpdateEscortAI(uint32 diff) {} + void UpdateEscortAI(uint32 diff) {} void UpdateAI(uint32 diff) { - npc_escortAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); - //Position pos = me->GetHomePosition(); - if (!me->isActiveObject()/* && me->GetExactDist(&pos) < 5.0f*/) // during event - return; + //Position pos = me->GetHomePosition(); + if (!me->isActiveObject()/* && me->GetExactDist(&pos) < 5.0f*/) // during event + return; - if (_wipeCheckTimer <= diff) - { - _wipeCheckTimer = 3000; + if (_wipeCheckTimer <= diff) + { + _wipeCheckTimer = 3000; - Player* player = NULL; - Trinity::AnyPlayerInObjectRangeCheck check(me, 140.0f); - Trinity::PlayerSearcher searcher(me, player, check); - me->VisitNearbyWorldObject(140.0f, searcher); - // wipe - if (!player || me->GetExactDist(4357.0f, 2606.0f, 350.0f) > 125.0f) - { - //Talk(SAY_CROK_DEATH); - FrostwingGauntletRespawner respawner; - Trinity::CreatureWorker worker(me, respawner); - me->VisitNearbyGridObject(333.0f, worker); - return; - } - } - else - _wipeCheckTimer -= diff; + Player* player = NULL; + Trinity::AnyPlayerInObjectRangeCheck check(me, 140.0f); + Trinity::PlayerSearcher searcher(me, player, check); + me->VisitNearbyWorldObject(140.0f, searcher); + // wipe + if (!player || me->GetExactDist(4357.0f, 2606.0f, 350.0f) > 125.0f) + { + //Talk(SAY_CROK_DEATH); + FrostwingGauntletRespawner respawner; + Trinity::CreatureWorker worker(me, respawner); + me->VisitNearbyGridObject(333.0f, worker); + return; + } + } + else + _wipeCheckTimer -= diff; UpdateVictim(); @@ -908,7 +908,7 @@ class npc_crok_scourgebane : public CreatureScript Talk(SAY_CROK_INTRO_3); break; case EVENT_START_PATHING: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); Start(true, true); break; case EVENT_SCOURGE_STRIKE: @@ -928,7 +928,7 @@ class npc_crok_scourgebane : public CreatureScript } else { - Unit::DealHeal(me, me, me->CountPctFromMaxHealth(3)); + Unit::DealHeal(me, me, me->CountPctFromMaxHealth(3)); _events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); } break; @@ -942,7 +942,7 @@ class npc_crok_scourgebane : public CreatureScript bool CanAIAttack(Unit const* target) const { // do not see targets inside Frostwing Halls when we are not there - return target->GetTypeId() != TYPEID_PLAYER && (me->GetPositionY() > 2660.0f) == (target->GetPositionY() > 2660.0f) && target->GetEntry() != NPC_SINDRAGOSA; + return target->GetTypeId() != TYPEID_PLAYER && (me->GetPositionY() > 2660.0f) == (target->GetPositionY() > 2660.0f) && target->GetEntry() != NPC_SINDRAGOSA; } private: @@ -951,7 +951,7 @@ class npc_crok_scourgebane : public CreatureScript InstanceScript* _instance; uint32 _currentWPid; uint32 _wipeCheckTimer; - bool _handledWP4; + bool _handledWP4; bool _isEventDone; bool _didUnderTenPercentText; }; @@ -973,63 +973,63 @@ class boss_sister_svalna : public CreatureScript { } - void Reset() - { - _Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->SetReactState(REACT_PASSIVE); - me->SetCanFly(true); + void Reset() + { + _Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetReactState(REACT_PASSIVE); + me->SetCanFly(true); me->SetDisableGravity(true); me->SetHover(true); - me->SendMovementFlagUpdate(); - } + me->SendMovementFlagUpdate(); + } - void AttackStart(Unit* victim) - { - if (me->HasReactState(REACT_PASSIVE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC)) - return; - BossAI::AttackStart(victim); - } + void AttackStart(Unit* victim) + { + if (me->HasReactState(REACT_PASSIVE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC)) + return; + BossAI::AttackStart(victim); + } void JustDied(Unit* /*killer*/) { _JustDied(); Talk(SAY_SVALNA_DEATH); - if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) // _isEventDone = true, setActive(false) - crok->AI()->DoAction(ACTION_RESET_EVENT); + if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) // _isEventDone = true, setActive(false) + crok->AI()->DoAction(ACTION_RESET_EVENT); uint64 delay = 6000; for (uint32 i = 0; i < 4; ++i) if (Creature* crusader = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CAPTAIN_ARNATH + i))) if (crusader->IsAlive()) - { - if (crusader->GetEntry() == crusader->GetCreatureData()->id) - { - crusader->m_Events.AddEvent(new CaptainSurviveTalk(*crusader), crusader->m_Events.CalculateTime(delay)); - delay += 6000; - } - else - Unit::Kill(crusader, crusader); - } + { + if (crusader->GetEntry() == crusader->GetCreatureData()->id) + { + crusader->m_Events.AddEvent(new CaptainSurviveTalk(*crusader), crusader->m_Events.CalculateTime(delay)); + delay += 6000; + } + else + Unit::Kill(crusader, crusader); + } } void EnterCombat(Unit* /*attacker*/) { - if (me->HasReactState(REACT_PASSIVE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC)) - { - me->CombatStop(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->SetReactState(REACT_PASSIVE); - return; - } + if (me->HasReactState(REACT_PASSIVE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC)) + { + me->CombatStop(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetReactState(REACT_PASSIVE); + return; + } _EnterCombat(); - me->LowerPlayerDamageReq(me->GetMaxHealth()); + me->LowerPlayerDamageReq(me->GetMaxHealth()); if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) - { + { crok->AI()->Talk(SAY_CROK_COMBAT_SVALNA); - crok->AI()->AttackStart(me); - } + crok->AI()->AttackStart(me); + } events.ScheduleEvent(EVENT_SVALNA_COMBAT, 9000); events.ScheduleEvent(EVENT_IMPALING_SPEAR, urand(15000, 20000)); } @@ -1064,8 +1064,8 @@ class boss_sister_svalna : public CreatureScript switch (action) { case ACTION_KILL_CAPTAIN: - if (me->IsAlive()) - me->CastCustomSpell(SPELL_CARESS_OF_DEATH, SPELLVALUE_MAX_TARGETS, 1, me, true); + if (me->IsAlive()) + me->CastCustomSpell(SPELL_CARESS_OF_DEATH, SPELLVALUE_MAX_TARGETS, 1, me, true); break; case ACTION_START_GAUNTLET: me->setActive(true); @@ -1101,11 +1101,11 @@ class boss_sister_svalna : public CreatureScript return; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - me->SetCanFly(false); + me->SetCanFly(false); me->SetDisableGravity(false); me->SetHover(false); - me->SetReactState(REACT_AGGRESSIVE); - DoZoneInCombat(NULL, 150.0f); + me->SetReactState(REACT_AGGRESSIVE); + DoZoneInCombat(NULL, 150.0f); } void SpellHitTarget(Unit* target, SpellInfo const* spell) @@ -1130,8 +1130,8 @@ class boss_sister_svalna : public CreatureScript void UpdateAI(uint32 diff) { - if (!me->isActiveObject()) - return; + if (!me->isActiveObject()) + return; UpdateVictim(); @@ -1156,7 +1156,7 @@ class boss_sister_svalna : public CreatureScript if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, -SPELL_IMPALING_SPEAR)) { DoCast(me, SPELL_AETHER_SHIELD); - me->AddAura(70203, me); + me->AddAura(70203, me); DoCast(target, SPELL_IMPALING_SPEAR); } events.ScheduleEvent(EVENT_IMPALING_SPEAR, urand(20000, 25000)); @@ -1184,20 +1184,20 @@ struct npc_argent_captainAI : public ScriptedAI FollowDist = PET_FOLLOW_DIST; } - void Reset() - { - me->SetCorpseDelay(DAY); // leave corpse for a long time so svalna can resurrect - IsUndead = (me->GetCreatureData() && me->GetCreatureData()->id != me->GetEntry()); - } + void Reset() + { + me->SetCorpseDelay(DAY); // leave corpse for a long time so svalna can resurrect + IsUndead = (me->GetCreatureData() && me->GetCreatureData()->id != me->GetEntry()); + } void JustDied(Unit* /*killer*/) { - if (IsUndead) + if (IsUndead) Talk(SAY_CAPTAIN_DEATH); else Talk(SAY_CAPTAIN_SECOND_DEATH); - IsUndead = false; + IsUndead = false; } void KilledUnit(Unit* victim) @@ -1228,7 +1228,7 @@ struct npc_argent_captainAI : public ScriptedAI bool CanAIAttack(Unit const* target) const { // do not see targets inside Frostwing Halls when we are not there - return (me->GetPositionY() > 2660.0f) == (target->GetPositionY() > 2660.0f) && (target->GetTypeId() == TYPEID_PLAYER || target->IsInCombat()); + return (me->GetPositionY() > 2660.0f) == (target->GetPositionY() > 2660.0f) && (target->GetTypeId() == TYPEID_PLAYER || target->IsInCombat()); } void EnterEvadeMode() @@ -1237,10 +1237,10 @@ struct npc_argent_captainAI : public ScriptedAI return; me->GetMotionMaster()->Clear(false); - if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) - me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_IDLE); - else - me->GetMotionMaster()->MoveTargetedHome(); + if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) + me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_IDLE); + else + me->GetMotionMaster()->MoveTargetedHome(); Reset(); } @@ -1271,11 +1271,11 @@ struct npc_argent_captainAI : public ScriptedAI Talk(SAY_CAPTAIN_RESURRECTED); me->UpdateEntry(newEntry, me->GetCreatureData()); - IsUndead = true; + IsUndead = true; DoCast(me, SPELL_UNDEATH, true); - if (Player* p = me->SelectNearestPlayer(150.0f)) - AttackStart(p); - me->SetInCombatWithZone(); + if (Player* p = me->SelectNearestPlayer(150.0f)) + AttackStart(p); + me->SetInCombatWithZone(); } } @@ -1284,7 +1284,7 @@ struct npc_argent_captainAI : public ScriptedAI InstanceScript* instance; float FollowAngle; float FollowDist; - bool IsUndead; + bool IsUndead; }; class npc_captain_arnath : public CreatureScript @@ -1300,7 +1300,7 @@ class npc_captain_arnath : public CreatureScript void Reset() { - npc_argent_captainAI::Reset(); + npc_argent_captainAI::Reset(); Events.Reset(); Events.ScheduleEvent(EVENT_ARNATH_FLASH_HEAL, urand(4000, 7000)); Events.ScheduleEvent(EVENT_ARNATH_PW_SHIELD, urand(8000, 14000)); @@ -1329,8 +1329,8 @@ class npc_captain_arnath : public CreatureScript case EVENT_ARNATH_PW_SHIELD: { std::list targets = DoFindFriendlyMissingBuff(40.0f, SPELL_POWER_WORD_SHIELD); - if (!targets.empty()) - DoCast(Trinity::Containers::SelectRandomContainerElement(targets), SPELL_POWER_WORD_SHIELD); + if (!targets.empty()) + DoCast(Trinity::Containers::SelectRandomContainerElement(targets), SPELL_POWER_WORD_SHIELD); Events.ScheduleEvent(EVENT_ARNATH_PW_SHIELD, urand(15000, 20000)); break; } @@ -1380,7 +1380,7 @@ class npc_captain_brandon : public CreatureScript void Reset() { - npc_argent_captainAI::Reset(); + npc_argent_captainAI::Reset(); Events.Reset(); Events.ScheduleEvent(EVENT_BRANDON_CRUSADER_STRIKE, urand(6000, 10000)); Events.ScheduleEvent(EVENT_BRANDON_DIVINE_SHIELD, 500); @@ -1449,7 +1449,7 @@ class npc_captain_grondel : public CreatureScript void Reset() { - npc_argent_captainAI::Reset(); + npc_argent_captainAI::Reset(); Events.Reset(); Events.ScheduleEvent(EVENT_GRONDEL_CHARGE_CHECK, 500); Events.ScheduleEvent(EVENT_GRONDEL_MORTAL_STRIKE, urand(8000, 14000)); @@ -1517,7 +1517,7 @@ class npc_captain_rupert : public CreatureScript void Reset() { - npc_argent_captainAI::Reset(); + npc_argent_captainAI::Reset(); Events.Reset(); Events.ScheduleEvent(EVENT_RUPERT_FEL_IRON_BOMB, urand(15000, 20000)); Events.ScheduleEvent(EVENT_RUPERT_MACHINE_GUN, urand(25000, 30000)); @@ -1570,9 +1570,9 @@ class npc_captain_rupert : public CreatureScript enum FrostwingVrykl { - SPELL_SPIRIT_STREAM = 69929, + SPELL_SPIRIT_STREAM = 69929, - NPC_INVISIBLE_STALKER_3_0 = 38310 + NPC_INVISIBLE_STALKER_3_0 = 38310 }; class npc_frostwing_vrykul : public CreatureScript @@ -1584,191 +1584,191 @@ class npc_frostwing_vrykul : public CreatureScript { npc_frostwing_vrykulAI(Creature* creature) : ScriptedAI(creature), summons(me) { - if (me->GetEntry() == NPC_YMIRJAR_DEATHBRINGER || me->GetEntry() == NPC_YMIRJAR_FROSTBINDER || me->GetEntry() == NPC_YMIRJAR_HUNTRESS) - isRanged = true; - else - isRanged = false; + if (me->GetEntry() == NPC_YMIRJAR_DEATHBRINGER || me->GetEntry() == NPC_YMIRJAR_FROSTBINDER || me->GetEntry() == NPC_YMIRJAR_HUNTRESS) + isRanged = true; + else + isRanged = false; } - EventMap events; - EventMap events2; - SummonList summons; - bool isRanged; + EventMap events; + EventMap events2; + SummonList summons; + bool isRanged; - void AttackStart(Unit* victim) - { - if (me->GetEntry() == NPC_YMIRJAR_FROSTBINDER) - ScriptedAI::AttackStartNoMove(victim); - else if (isRanged) - ScriptedAI::AttackStartCaster(victim, 16.0f); - else - ScriptedAI::AttackStart(victim); - } + void AttackStart(Unit* victim) + { + if (me->GetEntry() == NPC_YMIRJAR_FROSTBINDER) + ScriptedAI::AttackStartNoMove(victim); + else if (isRanged) + ScriptedAI::AttackStartCaster(victim, 16.0f); + else + ScriptedAI::AttackStart(victim); + } - void EnterCombat(Unit* /*who*/) - { - me->InterruptNonMeleeSpells(false); - me->CallForHelp(8.5f); - if (me->GetEntry() == NPC_YMIRJAR_FROSTBINDER) - me->SetHover(true); - } + void EnterCombat(Unit* /*who*/) + { + me->InterruptNonMeleeSpells(false); + me->CallForHelp(8.5f); + if (me->GetEntry() == NPC_YMIRJAR_FROSTBINDER) + me->SetHover(true); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void Reset() - { - summons.DespawnAll(); - events.Reset(); - events2.Reset(); - switch (me->GetEntry()) - { - case NPC_YMIRJAR_HUNTRESS: - events.ScheduleEvent(1, urand(10000, 15000)); // Ice Trap - events.ScheduleEvent(2, urand(8000, 12000)); // Rapid Shot - events.ScheduleEvent(3, urand(6000, 10000)); // Volley - if (me->GetMap()->Is25ManRaid()) - events.ScheduleEvent(4, 5000); // Summon Warhawk - break; - case NPC_YMIRJAR_WARLORD: - events.ScheduleEvent(11, 6000); // Whirlwind - break; - case NPC_YMIRJAR_BATTLE_MAIDEN: - events.ScheduleEvent(21, 3000); // Barbaric Strike - events.ScheduleEvent(22, urand(8000, 12000)); // Adrenaline Rush - break; - case NPC_YMIRJAR_FROSTBINDER: - events.ScheduleEvent(31, 0); // Arctic Chill - events.ScheduleEvent(32, urand(15000, 25000)); // Frozen Orb - events.ScheduleEvent(33, urand(15000, 30000)); // Twisted Winds - events2.ScheduleEvent(100, 0); // Spirit Stream - me->SetHover(false); - break; - case NPC_YMIRJAR_DEATHBRINGER: - events.ScheduleEvent(41, 2500); // Empowered Shadow Bolt - events.ScheduleEvent(42, 5000); // Summon Undead - events2.ScheduleEvent(100, 0); // Spirit Stream - break; - } - } + void Reset() + { + summons.DespawnAll(); + events.Reset(); + events2.Reset(); + switch (me->GetEntry()) + { + case NPC_YMIRJAR_HUNTRESS: + events.ScheduleEvent(1, urand(10000, 15000)); // Ice Trap + events.ScheduleEvent(2, urand(8000, 12000)); // Rapid Shot + events.ScheduleEvent(3, urand(6000, 10000)); // Volley + if (me->GetMap()->Is25ManRaid()) + events.ScheduleEvent(4, 5000); // Summon Warhawk + break; + case NPC_YMIRJAR_WARLORD: + events.ScheduleEvent(11, 6000); // Whirlwind + break; + case NPC_YMIRJAR_BATTLE_MAIDEN: + events.ScheduleEvent(21, 3000); // Barbaric Strike + events.ScheduleEvent(22, urand(8000, 12000)); // Adrenaline Rush + break; + case NPC_YMIRJAR_FROSTBINDER: + events.ScheduleEvent(31, 0); // Arctic Chill + events.ScheduleEvent(32, urand(15000, 25000)); // Frozen Orb + events.ScheduleEvent(33, urand(15000, 30000)); // Twisted Winds + events2.ScheduleEvent(100, 0); // Spirit Stream + me->SetHover(false); + break; + case NPC_YMIRJAR_DEATHBRINGER: + events.ScheduleEvent(41, 2500); // Empowered Shadow Bolt + events.ScheduleEvent(42, 5000); // Summon Undead + events2.ScheduleEvent(100, 0); // Spirit Stream + break; + } + } - void UpdateAI(uint32 diff) - { - if (!me->IsInCombat()) - { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case 100: - if (Creature* stalker = me->FindNearestCreature(NPC_INVISIBLE_STALKER_3_0, 50.0f)) - me->CastSpell(stalker, SPELL_SPIRIT_STREAM, false); - events2.ScheduleEvent(100, 33000); - break; - } - } + void UpdateAI(uint32 diff) + { + if (!me->IsInCombat()) + { + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case 100: + if (Creature* stalker = me->FindNearestCreature(NPC_INVISIBLE_STALKER_3_0, 50.0f)) + me->CastSpell(stalker, SPELL_SPIRIT_STREAM, false); + events2.ScheduleEvent(100, 33000); + break; + } + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED) || ((me->GetEntry() == NPC_YMIRJAR_DEATHBRINGER || me->GetEntry() == NPC_YMIRJAR_FROSTBINDER) && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))) - return; + if (me->HasUnitState(UNIT_STATE_CASTING) || me->isFeared() || me->isFrozen() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasUnitState(UNIT_STATE_CONFUSED) || ((me->GetEntry() == NPC_YMIRJAR_DEATHBRINGER || me->GetEntry() == NPC_YMIRJAR_FROSTBINDER) && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))) + return; - switch (events.GetEvent()) - { - case 0: - break; - case 1: // Ice Trap - me->CastSpell((Unit*)NULL, 71249, false); - events.RepeatEvent(urand(35000, 40000)); - break; - case 2: // Rapid Shot - me->CastSpell(me->GetVictim(), 71251, false); - events.RepeatEvent(urand(25000, 30000)); - break; - case 3: // Volley - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true); - if (target && me->GetDistance(target) > 10.0f) - { - me->CastSpell(target, 71252, false); - events.RepeatEvent(urand(25000, 35000)); - } - else - events.RepeatEvent(2500); - } - break; - case 4: // Summon Warhawk - me->CastSpell(me, 71705, false); - events.PopEvent(); - break; - case 11: // Whirlwind - me->CastSpell(me->GetVictim(), 41056, false); - events.RepeatEvent(6000); - break; - case 21: // Barbaric Strike - me->CastSpell(me->GetVictim(), 71257, false); - events.RepeatEvent(3000); - break; - case 22: // Adrenaline Rush - me->CastSpell(me, 71258, false); - events.RepeatEvent(urand(15000, 25000)); - break; - case 31: // Arctic Chill - me->CastSpell(me, 71270, true); - events.PopEvent(); - break; - case 32: // Frozen Orb - if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 30.0f, true)) - me->CastSpell(target, 71274, false); - events.RepeatEvent(urand(40000, 50000)); - break; - case 33: // Twisted Winds - me->CastSpell((Unit*)NULL, 71306, false); - events.RepeatEvent(urand(35000, 50000)); - break; - case 41: // Empowered Shadow Bolt - me->CastSpell(me->GetVictim(), 69528, false); - events.RepeatEvent(2500); - break; - case 42: // Summon Undead - me->CastSpell(me->GetVictim(), 69516, false); - events.RepeatEvent(45000); - break; - default: - events.PopEvent(); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case 1: // Ice Trap + me->CastSpell((Unit*)NULL, 71249, false); + events.RepeatEvent(urand(35000, 40000)); + break; + case 2: // Rapid Shot + me->CastSpell(me->GetVictim(), 71251, false); + events.RepeatEvent(urand(25000, 30000)); + break; + case 3: // Volley + { + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true); + if (target && me->GetDistance(target) > 10.0f) + { + me->CastSpell(target, 71252, false); + events.RepeatEvent(urand(25000, 35000)); + } + else + events.RepeatEvent(2500); + } + break; + case 4: // Summon Warhawk + me->CastSpell(me, 71705, false); + events.PopEvent(); + break; + case 11: // Whirlwind + me->CastSpell(me->GetVictim(), 41056, false); + events.RepeatEvent(6000); + break; + case 21: // Barbaric Strike + me->CastSpell(me->GetVictim(), 71257, false); + events.RepeatEvent(3000); + break; + case 22: // Adrenaline Rush + me->CastSpell(me, 71258, false); + events.RepeatEvent(urand(15000, 25000)); + break; + case 31: // Arctic Chill + me->CastSpell(me, 71270, true); + events.PopEvent(); + break; + case 32: // Frozen Orb + if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 30.0f, true)) + me->CastSpell(target, 71274, false); + events.RepeatEvent(urand(40000, 50000)); + break; + case 33: // Twisted Winds + me->CastSpell((Unit*)NULL, 71306, false); + events.RepeatEvent(urand(35000, 50000)); + break; + case 41: // Empowered Shadow Bolt + me->CastSpell(me->GetVictim(), 69528, false); + events.RepeatEvent(2500); + break; + case 42: // Summon Undead + me->CastSpell(me->GetVictim(), 69516, false); + events.RepeatEvent(45000); + break; + default: + events.PopEvent(); + break; + } - if (me->GetEntry() == NPC_YMIRJAR_HUNTRESS && me->GetVictim() && me->GetDistance(me->GetVictim()) > 5.0f) - DoSpellAttackIfReady(71253); // Shoot - else - DoMeleeAttackIfReady(); - } + if (me->GetEntry() == NPC_YMIRJAR_HUNTRESS && me->GetVictim() && me->GetDistance(me->GetVictim()) > 5.0f) + DoSpellAttackIfReady(71253); // Shoot + else + DoMeleeAttackIfReady(); + } - void SpellHitTarget(Unit* c, const SpellInfo* spell) - { - if (spell->Id == 71306 && c->GetTypeId() == TYPEID_UNIT) // Twisted Winds - { - Position myPos; - me->GetPosition(&myPos); - me->NearTeleportTo(c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), c->GetOrientation()); - c->NearTeleportTo(myPos.GetPositionX(), myPos.GetPositionY(), myPos.GetPositionZ(), myPos.GetOrientation()); - const ThreatContainer::StorageType me_tl = me->getThreatManager().getThreatList(); - const ThreatContainer::StorageType target_tl = c->getThreatManager().getThreatList(); - DoResetThreat(); - for (ThreatContainer::StorageType::const_iterator iter = target_tl.begin(); iter != target_tl.end(); ++iter) - me->getThreatManager().addThreat((*iter)->getTarget(), (*iter)->getThreat()); + void SpellHitTarget(Unit* c, const SpellInfo* spell) + { + if (spell->Id == 71306 && c->GetTypeId() == TYPEID_UNIT) // Twisted Winds + { + Position myPos; + me->GetPosition(&myPos); + me->NearTeleportTo(c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), c->GetOrientation()); + c->NearTeleportTo(myPos.GetPositionX(), myPos.GetPositionY(), myPos.GetPositionZ(), myPos.GetOrientation()); + const ThreatContainer::StorageType me_tl = me->getThreatManager().getThreatList(); + const ThreatContainer::StorageType target_tl = c->getThreatManager().getThreatList(); + DoResetThreat(); + for (ThreatContainer::StorageType::const_iterator iter = target_tl.begin(); iter != target_tl.end(); ++iter) + me->getThreatManager().addThreat((*iter)->getTarget(), (*iter)->getThreat()); - c->getThreatManager().resetAllAggro(); - for (ThreatContainer::StorageType::const_iterator iter = me_tl.begin(); iter != me_tl.end(); ++iter) - c->getThreatManager().addThreat((*iter)->getTarget(), (*iter)->getThreat()); + c->getThreatManager().resetAllAggro(); + for (ThreatContainer::StorageType::const_iterator iter = me_tl.begin(); iter != me_tl.end(); ++iter) + c->getThreatManager().addThreat((*iter)->getTarget(), (*iter)->getThreat()); - } - } + } + } bool CanAIAttack(Unit const* target) const { @@ -1828,10 +1828,10 @@ class npc_alchemist_adrianna : public CreatureScript bool OnGossipHello(Player* player, Creature* creature) { - if (InstanceScript* instance = creature->GetInstanceScript()) - if (instance->GetBossState(DATA_ROTFACE) == DONE && instance->GetBossState(DATA_FESTERGUT) == DONE && !creature->FindCurrentSpellBySpellId(SPELL_HARVEST_BLIGHT_SPECIMEN) && !creature->FindCurrentSpellBySpellId(SPELL_HARVEST_BLIGHT_SPECIMEN25)) - if (player->HasAura(SPELL_ORANGE_BLIGHT_RESIDUE) && player->HasAura(SPELL_GREEN_BLIGHT_RESIDUE)) - creature->CastSpell(creature, SPELL_HARVEST_BLIGHT_SPECIMEN, false); + if (InstanceScript* instance = creature->GetInstanceScript()) + if (instance->GetBossState(DATA_ROTFACE) == DONE && instance->GetBossState(DATA_FESTERGUT) == DONE && !creature->FindCurrentSpellBySpellId(SPELL_HARVEST_BLIGHT_SPECIMEN) && !creature->FindCurrentSpellBySpellId(SPELL_HARVEST_BLIGHT_SPECIMEN25)) + if (player->HasAura(SPELL_ORANGE_BLIGHT_RESIDUE) && player->HasAura(SPELL_GREEN_BLIGHT_RESIDUE)) + creature->CastSpell(creature, SPELL_HARVEST_BLIGHT_SPECIMEN, false); return false; } }; @@ -1963,11 +1963,11 @@ class spell_icc_sprit_alarm : public SpellScriptLoader if ((*itr)->IsAlive() && (*itr)->HasAura(SPELL_STONEFORM)) { if (Player* target = (*itr)->SelectNearestPlayer(150.0f)) - { - (*itr)->AI()->Talk(SAY_TRAP_ACTIVATE); - (*itr)->RemoveAurasDueToSpell(SPELL_STONEFORM); - (*itr)->AI()->AttackStart(target); - } + { + (*itr)->AI()->Talk(SAY_TRAP_ACTIVATE); + (*itr)->RemoveAurasDueToSpell(SPELL_STONEFORM); + (*itr)->AI()->AttackStart(target); + } break; } } @@ -1987,61 +1987,61 @@ class spell_icc_sprit_alarm : public SpellScriptLoader class spell_icc_geist_alarm : public SpellScriptLoader { - public: - spell_icc_geist_alarm() : SpellScriptLoader("spell_icc_geist_alarm") { } + public: + spell_icc_geist_alarm() : SpellScriptLoader("spell_icc_geist_alarm") { } - class spell_icc_geist_alarm_SpellScript : public SpellScript - { - PrepareSpellScript(spell_icc_geist_alarm_SpellScript); + class spell_icc_geist_alarm_SpellScript : public SpellScript + { + PrepareSpellScript(spell_icc_geist_alarm_SpellScript); - void HandleEvent(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - { - Position p = {4356.77f, 2971.90f, 360.52f, M_PI/2}; - if (Creature* l = instance->instance->SummonCreature(NPC_VENGEFUL_FLESHREAPER, p)) - { - bool hasTarget = false; - Unit* target = NULL; - if (target = l->SelectNearestTarget(20.0f)) - hasTarget = true; - else - { - target = l->SelectNearestTarget(120.0f); - l->GetMotionMaster()->MoveJump(l->GetPositionX(), l->GetPositionY()+55.0f, l->GetPositionZ(), 20.0f, 6.0f); - } - l->AI()->Talk(0); - l->AI()->AttackStart(target); - l->AddThreat(target, 1.0f); - for (uint8 i = 0; i<5; ++i) - { - float dist = 2.0f + rand_norm()*4.0f; - float angle = rand_norm()*2*M_PI; - Position pos(p); - l->MovePosition(pos, dist, angle); - if (Creature* c = l->SummonCreature(NPC_VENGEFUL_FLESHREAPER, pos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30*MINUTE*IN_MILLISECONDS)) - { - c->AI()->AttackStart(l->GetVictim()); - c->AddThreat(l->GetVictim(), 1.0f); - if (!hasTarget) - c->GetMotionMaster()->MoveJump(c->GetPositionX(), c->GetPositionY()+55.0f, c->GetPositionZ(), 20.0f, 6.0f); - } - } - } - } - } + void HandleEvent(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + { + Position p = {4356.77f, 2971.90f, 360.52f, M_PI/2}; + if (Creature* l = instance->instance->SummonCreature(NPC_VENGEFUL_FLESHREAPER, p)) + { + bool hasTarget = false; + Unit* target = NULL; + if (target = l->SelectNearestTarget(20.0f)) + hasTarget = true; + else + { + target = l->SelectNearestTarget(120.0f); + l->GetMotionMaster()->MoveJump(l->GetPositionX(), l->GetPositionY()+55.0f, l->GetPositionZ(), 20.0f, 6.0f); + } + l->AI()->Talk(0); + l->AI()->AttackStart(target); + l->AddThreat(target, 1.0f); + for (uint8 i = 0; i<5; ++i) + { + float dist = 2.0f + rand_norm()*4.0f; + float angle = rand_norm()*2*M_PI; + Position pos(p); + l->MovePosition(pos, dist, angle); + if (Creature* c = l->SummonCreature(NPC_VENGEFUL_FLESHREAPER, pos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30*MINUTE*IN_MILLISECONDS)) + { + c->AI()->AttackStart(l->GetVictim()); + c->AddThreat(l->GetVictim(), 1.0f); + if (!hasTarget) + c->GetMotionMaster()->MoveJump(c->GetPositionX(), c->GetPositionY()+55.0f, c->GetPositionZ(), 20.0f, 6.0f); + } + } + } + } + } - void Register() - { - OnEffectHit += SpellEffectFn(spell_icc_geist_alarm_SpellScript::HandleEvent, EFFECT_2, SPELL_EFFECT_SEND_EVENT); - } - }; + void Register() + { + OnEffectHit += SpellEffectFn(spell_icc_geist_alarm_SpellScript::HandleEvent, EFFECT_2, SPELL_EFFECT_SEND_EVENT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_icc_geist_alarm_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_icc_geist_alarm_SpellScript(); + } }; class spell_frost_giant_death_plague : public SpellScriptLoader @@ -2056,29 +2056,29 @@ class spell_frost_giant_death_plague : public SpellScriptLoader // First effect void CountTargets(std::list& targets) { - targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); - targets.remove_if(Trinity::ObjectGUIDCheck(GetCaster()->GetGUID(), true)); + targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); + targets.remove_if(Trinity::ObjectGUIDCheck(GetCaster()->GetGUID(), true)); - bool kill = true; - for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) - if (!(*itr)->ToUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA)) - { - kill = false; - break; - } - if (kill) - GetCaster()->CastSpell(GetCaster(), SPELL_DEATH_PLAGUE_KILL, true); - else - { - GetCaster()->CastSpell(GetCaster(), SPELL_RECENTLY_INFECTED, true); - targets.push_back(GetCaster()); - } + bool kill = true; + for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + if (!(*itr)->ToUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA)) + { + kill = false; + break; + } + if (kill) + GetCaster()->CastSpell(GetCaster(), SPELL_DEATH_PLAGUE_KILL, true); + else + { + GetCaster()->CastSpell(GetCaster(), SPELL_RECENTLY_INFECTED, true); + targets.push_back(GetCaster()); + } } void HandleScript(SpellEffIndex effIndex) { - if (!GetHitUnit()->HasAura(SPELL_RECENTLY_INFECTED) && !GetHitUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA)) - GetHitUnit()->CastSpell(GetHitUnit(), SPELL_DEATH_PLAGUE_AURA, true); + if (!GetHitUnit()->HasAura(SPELL_RECENTLY_INFECTED) && !GetHitUnit()->HasAura(SPELL_DEATH_PLAGUE_AURA)) + GetHitUnit()->CastSpell(GetHitUnit(), SPELL_DEATH_PLAGUE_AURA, true); } void Register() @@ -2164,7 +2164,7 @@ class spell_svalna_revive_champion : public SpellScriptLoader caster->GetNearPosition(pos, 5.0f, 0.0f); pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f); pos.m_positionZ += 0.1f; - caster->SendMeleeAttackStop(caster->GetVictim()); + caster->SendMeleeAttackStop(caster->GetVictim()); caster->GetMotionMaster()->MoveLand(POINT_LAND, pos, 7.0f); } @@ -2317,19 +2317,19 @@ class at_icc_start_frostwing_gauntlet : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) { if (InstanceScript* instance = player->GetInstanceScript()) - if (instance->GetBossState(DATA_SISTER_SVALNA) != DONE) - if (Creature* crok = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_CROK_SCOURGEBANE))) - { - if (!crok->IsAlive()) - { - FrostwingGauntletRespawner respawner; - Trinity::CreatureWorker worker(crok, respawner); - crok->VisitNearbyGridObject(333.0f, worker); - return true; - } - else - crok->AI()->DoAction(ACTION_START_GAUNTLET); - } + if (instance->GetBossState(DATA_SISTER_SVALNA) != DONE) + if (Creature* crok = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_CROK_SCOURGEBANE))) + { + if (!crok->IsAlive()) + { + FrostwingGauntletRespawner respawner; + Trinity::CreatureWorker worker(crok, respawner); + crok->VisitNearbyGridObject(333.0f, worker); + return true; + } + else + crok->AI()->DoAction(ACTION_START_GAUNTLET); + } return true; } }; @@ -2348,9 +2348,9 @@ public: void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = GetTarget(); - if (!target->HasAura(71010)) - target->CastSpell(target, 71010, true); + Unit* target = GetTarget(); + if (!target->HasAura(71010)) + target->CastSpell(target, 71010, true); } void Register() @@ -2368,28 +2368,28 @@ public: class spell_icc_dark_reckoning : public SpellScriptLoader { public: - spell_icc_dark_reckoning() : SpellScriptLoader("spell_icc_dark_reckoning") { } + spell_icc_dark_reckoning() : SpellScriptLoader("spell_icc_dark_reckoning") { } - class spell_icc_dark_reckoning_AuraScript : public AuraScript - { - PrepareAuraScript(spell_icc_dark_reckoning_AuraScript); + class spell_icc_dark_reckoning_AuraScript : public AuraScript + { + PrepareAuraScript(spell_icc_dark_reckoning_AuraScript); - void OnPeriodic(AuraEffect const* /*aurEff*/) - { - if (Unit* caster = GetCaster()) - caster->CastSpell(GetTarget(), 69482, true); - } + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), 69482, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_dark_reckoning_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_dark_reckoning_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_icc_dark_reckoning_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_icc_dark_reckoning_AuraScript(); + } }; class spell_stinky_precious_decimate : public SpellScriptLoader @@ -2425,93 +2425,93 @@ class spell_stinky_precious_decimate : public SpellScriptLoader class spell_icc_yf_frozen_orb : public SpellScriptLoader { public: - spell_icc_yf_frozen_orb() : SpellScriptLoader("spell_icc_yf_frozen_orb") { } + spell_icc_yf_frozen_orb() : SpellScriptLoader("spell_icc_yf_frozen_orb") { } - class spell_icc_yf_frozen_orb_AuraScript : public AuraScript - { - PrepareAuraScript(spell_icc_yf_frozen_orb_AuraScript) + class spell_icc_yf_frozen_orb_AuraScript : public AuraScript + { + PrepareAuraScript(spell_icc_yf_frozen_orb_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - PreventDefaultAction(); - if (Unit* c = GetCaster()) - if (Unit* t = GetTarget()) - c->CastSpell(t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 71285, true); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + PreventDefaultAction(); + if (Unit* c = GetCaster()) + if (Unit* t = GetTarget()) + c->CastSpell(t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 71285, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_yf_frozen_orb_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_yf_frozen_orb_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_icc_yf_frozen_orb_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_icc_yf_frozen_orb_AuraScript(); + } }; class spell_icc_yh_volley : public SpellScriptLoader { public: - spell_icc_yh_volley() : SpellScriptLoader("spell_icc_yh_volley") { } + spell_icc_yh_volley() : SpellScriptLoader("spell_icc_yh_volley") { } - class spell_icc_yh_volley_AuraScript : public AuraScript - { - PrepareAuraScript(spell_icc_yh_volley_AuraScript) + class spell_icc_yh_volley_AuraScript : public AuraScript + { + PrepareAuraScript(spell_icc_yh_volley_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - PreventDefaultAction(); - if (Unit* c = GetCaster()) - if (Unit* t = GetTarget()) - { - if ((aurEff->GetTickNumber()%5) == 0) - c->SetFacingToObject(t); - int32 basepoints1 = aurEff->GetAmount(); - c->CastCustomSpell(t, 41089, 0, &basepoints1, 0, true); - } - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + PreventDefaultAction(); + if (Unit* c = GetCaster()) + if (Unit* t = GetTarget()) + { + if ((aurEff->GetTickNumber()%5) == 0) + c->SetFacingToObject(t); + int32 basepoints1 = aurEff->GetAmount(); + c->CastCustomSpell(t, 41089, 0, &basepoints1, 0, true); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_yh_volley_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_icc_yh_volley_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_icc_yh_volley_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_icc_yh_volley_AuraScript(); + } }; class spell_icc_yd_summon_undead : public SpellScriptLoader { - public: - spell_icc_yd_summon_undead() : SpellScriptLoader("spell_icc_yd_summon_undead") { } + public: + spell_icc_yd_summon_undead() : SpellScriptLoader("spell_icc_yd_summon_undead") { } - class spell_icc_yd_summon_undead_SpellScript : public SpellScript - { - PrepareSpellScript(spell_icc_yd_summon_undead_SpellScript); + class spell_icc_yd_summon_undead_SpellScript : public SpellScript + { + PrepareSpellScript(spell_icc_yd_summon_undead_SpellScript); - void HandleDummyLaunch(SpellEffIndex /*effIndex*/) - { - if (Unit* c = GetCaster()) - if (c->GetMapId() == 631) - for (uint8 i = 0; i < 5; ++i) - c->CastSpell(c, 71302, true); - } + void HandleDummyLaunch(SpellEffIndex /*effIndex*/) + { + if (Unit* c = GetCaster()) + if (c->GetMapId() == 631) + for (uint8 i = 0; i < 5; ++i) + c->CastSpell(c, 71302, true); + } - void Register() - { - OnEffectLaunch += SpellEffectFn(spell_icc_yd_summon_undead_SpellScript::HandleDummyLaunch, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_icc_yd_summon_undead_SpellScript::HandleDummyLaunch, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_icc_yd_summon_undead_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_icc_yd_summon_undead_SpellScript(); + } }; class spell_icc_shattered_bones : public SpellScriptLoader @@ -2526,7 +2526,7 @@ class spell_icc_shattered_bones : public SpellScriptLoader void HandleDummy() { for (uint8 i=0; i<10; ++i) - GetCaster()->CastSpell((Unit*)NULL, 70963, true); + GetCaster()->CastSpell((Unit*)NULL, 70963, true); } void Register() @@ -2549,57 +2549,57 @@ public: struct npc_icc_skybreaker_hierophantAI : public ScriptedAI { npc_icc_skybreaker_hierophantAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; + EventMap events; void Reset() { events.Reset(); } - void AttackStart(Unit* who) { AttackStartCaster(who, 20.0f); } + void AttackStart(Unit* who) { AttackStartCaster(who, 20.0f); } - void EnterCombat(Unit* who) - { - events.Reset(); - events.ScheduleEvent(1, urand(5000,15000)); - events.ScheduleEvent(2, urand(5000,15000)); - events.ScheduleEvent(3, urand(5000,15000)); - events.ScheduleEvent(4, urand(1000,3000)); - } + void EnterCombat(Unit* who) + { + events.Reset(); + events.ScheduleEvent(1, urand(5000,15000)); + events.ScheduleEvent(2, urand(5000,15000)); + events.ScheduleEvent(3, urand(5000,15000)); + events.ScheduleEvent(4, urand(1000,3000)); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case 1: - if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) - me->CastSpell(target, 69899, false); - events.RepeatEvent(urand(10000,20000)); - break; - case 2: - if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) - me->CastSpell(target, 69882, false); - events.RepeatEvent(urand(10000,20000)); - break; - case 3: - if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) - me->CastSpell(target, 69898, false); - events.RepeatEvent(urand(10000,20000)); - break; - case 4: - me->CastSpell(me->GetVictim(), 69968, false); - events.RepeatEvent(urand(2000,3000)); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case 1: + if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) + me->CastSpell(target, 69899, false); + events.RepeatEvent(urand(10000,20000)); + break; + case 2: + if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) + me->CastSpell(target, 69882, false); + events.RepeatEvent(urand(10000,20000)); + break; + case 3: + if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) + me->CastSpell(target, 69898, false); + events.RepeatEvent(urand(10000,20000)); + break; + case 4: + me->CastSpell(me->GetVictim(), 69968, false); + events.RepeatEvent(urand(2000,3000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -2616,44 +2616,44 @@ public: struct npc_icc_skybreaker_marksmanAI : public ScriptedAI { npc_icc_skybreaker_marksmanAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; + EventMap events; void Reset() { events.Reset(); } - void AttackStart(Unit* who) { AttackStartCaster(who, 20.0f); } + void AttackStart(Unit* who) { AttackStartCaster(who, 20.0f); } - void EnterCombat(Unit* who) - { - events.Reset(); - events.ScheduleEvent(1, urand(5000,10000)); - events.ScheduleEvent(2, urand(5000,15000)); - } + void EnterCombat(Unit* who) + { + events.Reset(); + events.ScheduleEvent(1, urand(5000,10000)); + events.ScheduleEvent(2, urand(5000,15000)); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case 1: - me->CastSpell(me->GetVictim(), 69989, false); - events.RepeatEvent(urand(5000,10000)); - break; - case 2: - me->CastSpell(me->GetVictim(), 69975, false); - events.RepeatEvent(urand(10000,15000)); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case 1: + me->CastSpell(me->GetVictim(), 69989, false); + events.RepeatEvent(urand(5000,10000)); + break; + case 2: + me->CastSpell(me->GetVictim(), 69975, false); + events.RepeatEvent(urand(10000,15000)); + break; + } - DoSpellAttackIfReady(69974); - } + DoSpellAttackIfReady(69974); + } }; CreatureAI* GetAI(Creature* creature) const @@ -2670,51 +2670,51 @@ public: struct npc_icc_skybreaker_vicarAI : public ScriptedAI { npc_icc_skybreaker_vicarAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; + EventMap events; void Reset() { events.Reset(); } - void AttackStart(Unit* who) { AttackStartCaster(who, 20.0f); } + void AttackStart(Unit* who) { AttackStartCaster(who, 20.0f); } - void EnterCombat(Unit* who) - { - events.Reset(); - events.ScheduleEvent(1, urand(5000,15000)); - events.ScheduleEvent(2, urand(5000,15000)); - events.ScheduleEvent(3, urand(1000,3000)); - } + void EnterCombat(Unit* who) + { + events.Reset(); + events.ScheduleEvent(1, urand(5000,15000)); + events.ScheduleEvent(2, urand(5000,15000)); + events.ScheduleEvent(3, urand(1000,3000)); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case 1: - if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) - me->CastSpell(target, 69963, false); - events.RepeatEvent(urand(10000,20000)); - break; - case 2: - if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) - me->CastSpell(target, 69910, false); - events.RepeatEvent(urand(10000,20000)); - break; - case 3: - me->CastSpell(me->GetVictim(), 69967, false); - events.RepeatEvent(urand(2000,3000)); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case 1: + if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) + me->CastSpell(target, 69963, false); + events.RepeatEvent(urand(10000,20000)); + break; + case 2: + if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) + me->CastSpell(target, 69910, false); + events.RepeatEvent(urand(10000,20000)); + break; + case 3: + me->CastSpell(me->GetVictim(), 69967, false); + events.RepeatEvent(urand(2000,3000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -2731,57 +2731,57 @@ public: struct npc_icc_skybreaker_luminaryAI : public ScriptedAI { npc_icc_skybreaker_luminaryAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; + EventMap events; void Reset() { events.Reset(); } - void AttackStart(Unit* who) { AttackStartCaster(who, 20.0f); } + void AttackStart(Unit* who) { AttackStartCaster(who, 20.0f); } - void EnterCombat(Unit* who) - { - events.Reset(); - events.ScheduleEvent(1, urand(5000,15000)); - events.ScheduleEvent(2, urand(5000,15000)); - events.ScheduleEvent(3, urand(5000,15000)); - events.ScheduleEvent(4, urand(1000,3000)); - } + void EnterCombat(Unit* who) + { + events.Reset(); + events.ScheduleEvent(1, urand(5000,15000)); + events.ScheduleEvent(2, urand(5000,15000)); + events.ScheduleEvent(3, urand(5000,15000)); + events.ScheduleEvent(4, urand(1000,3000)); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case 1: - if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) - me->CastSpell(target, 69923, false); - events.RepeatEvent(urand(10000,20000)); - break; - case 2: - if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) - me->CastSpell(target, 69926, false); - events.RepeatEvent(urand(20000,30000)); - break; - case 3: - if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) - me->CastSpell(target, 69958, false); - events.RepeatEvent(urand(10000,20000)); - break; - case 4: - me->CastSpell(me->GetVictim(), 69970, false); - events.RepeatEvent(urand(3000,4000)); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case 1: + if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) + me->CastSpell(target, 69923, false); + events.RepeatEvent(urand(10000,20000)); + break; + case 2: + if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) + me->CastSpell(target, 69926, false); + events.RepeatEvent(urand(20000,30000)); + break; + case 3: + if (Unit* target = DoSelectLowestHpFriendly(35.0f, 5000)) + me->CastSpell(target, 69958, false); + events.RepeatEvent(urand(10000,20000)); + break; + case 4: + me->CastSpell(me->GetVictim(), 69970, false); + events.RepeatEvent(urand(3000,4000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -2798,103 +2798,103 @@ public: struct npc_icc_valkyr_heraldAI : public ScriptedAI { npc_icc_valkyr_heraldAI(Creature* creature) : ScriptedAI(creature), summons(me) {} - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; - void Reset() { events.Reset(); summons.DespawnAll(); } + void Reset() { events.Reset(); summons.DespawnAll(); } - void EnterCombat(Unit* /*who*/) - { - events.Reset(); - summons.DespawnAll(); - me->setActive(true); - events.ScheduleEvent(1, 10000); - me->SetInCombatWithZone(); - } + void EnterCombat(Unit* /*who*/) + { + events.Reset(); + summons.DespawnAll(); + me->setActive(true); + events.ScheduleEvent(1, 10000); + me->SetInCombatWithZone(); + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - void JustSummoned(Creature* s) - { - summons.Summon(s); - } + void JustSummoned(Creature* s) + { + summons.Summon(s); + } - void MoveInLineOfSight(Unit* who) - { - if (me->IsAlive() && !me->IsInCombat() && who->GetTypeId() == TYPEID_PLAYER && who->GetExactDist2d(me) < 35.0f) - AttackStart(who); - } + void MoveInLineOfSight(Unit* who) + { + if (me->IsAlive() && !me->IsInCombat() && who->GetTypeId() == TYPEID_PLAYER && who->GetExactDist2d(me) < 35.0f) + AttackStart(who); + } - void SummonedCreatureDespawn(Creature* s) - { - summons.Despawn(s); - } + void SummonedCreatureDespawn(Creature* s) + { + summons.Despawn(s); + } - bool CanAIAttack(Unit const* target) const - { - return target->GetExactDist(4357.0f, 2769.0f, 356.0f) < 170.0f; - } + bool CanAIAttack(Unit const* target) const + { + return target->GetExactDist(4357.0f, 2769.0f, 356.0f) < 170.0f; + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (spell->Id == 71906 || spell->Id == 71942) - { - if (Creature* c = me->SummonCreature(38410, *target, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - { - c->AI()->AttackStart(target); - DoZoneInCombat(c); - uint8 Class = target->getClass(); - if (Class != CLASS_DRUID) - if (Player* p = target->ToPlayer()) - { - if (Item* i = p->GetWeaponForAttack(BASE_ATTACK)) - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, i->GetEntry()); - if (Item* i = p->GetWeaponForAttack(OFF_ATTACK)) - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, i->GetEntry()); - if (Item* i = p->GetWeaponForAttack(RANGED_ATTACK)) - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, i->GetEntry()); + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (spell->Id == 71906 || spell->Id == 71942) + { + if (Creature* c = me->SummonCreature(38410, *target, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + { + c->AI()->AttackStart(target); + DoZoneInCombat(c); + uint8 Class = target->getClass(); + if (Class != CLASS_DRUID) + if (Player* p = target->ToPlayer()) + { + if (Item* i = p->GetWeaponForAttack(BASE_ATTACK)) + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, i->GetEntry()); + if (Item* i = p->GetWeaponForAttack(OFF_ATTACK)) + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, i->GetEntry()); + if (Item* i = p->GetWeaponForAttack(RANGED_ATTACK)) + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, i->GetEntry()); - target->CastSpell(c, 60352, true); // Mirror Image, clone visual appearance - } - c->AI()->DoAction(Class); - } - } - } + target->CastSpell(c, 60352, true); // Mirror Image, clone visual appearance + } + c->AI()->DoAction(Class); + } + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case 1: - { - uint8 count = me->GetMap()->Is25ManRaid() ? 4 : 2; - bool casted = false; - for (uint8 i=0; iCastSpell(target, 71906, true); // Severed Essence - } - events.RepeatEvent(casted ? 25000 : 5000); - } - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case 1: + { + uint8 count = me->GetMap()->Is25ManRaid() ? 4 : 2; + bool casted = false; + for (uint8 i=0; iCastSpell(target, 71906, true); // Severed Essence + } + events.RepeatEvent(casted ? 25000 : 5000); + } + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -2906,40 +2906,40 @@ public: class SeveredEssenceSpellInfo { public: - uint8 Class; - uint32 id; - uint32 cooldown_ms; - uint8 targetType; - float range; + uint8 Class; + uint32 id; + uint32 cooldown_ms; + uint8 targetType; + float range; }; SeveredEssenceSpellInfo sesi_spells[] = { - {CLASS_SHAMAN, 71938, 5000, 1, 0.0f}, - {CLASS_PALADIN, 57767, 8000, 2, 30.0f}, - {CLASS_WARLOCK, 71937, 10000, 1, 0.0f}, - {CLASS_DEATH_KNIGHT, 49576, 15000, 1, 30.0f}, - {CLASS_ROGUE, 71933, 8000, 1, 0.0f}, - {CLASS_MAGE, 71928, 4000, 1, 40.0f}, - {CLASS_PALADIN, 71930, 5000, 2, 40.0f}, - {CLASS_ROGUE, 71955, 40000, 1, 30.0f}, - {CLASS_PRIEST, 71931, 5000, 2, 40.0f}, - {CLASS_SHAMAN, 71934, 7000, 1, 0.0f}, - {CLASS_DRUID, 71925, 5000, 1, 0.0f}, - {CLASS_DEATH_KNIGHT, 71951, 8000, 1, 0.0f}, - {CLASS_DEATH_KNIGHT, 71924, 8000, 1, 0.0f}, - {CLASS_WARLOCK, 71965, 20000, 0, 0.0f}, - {CLASS_PRIEST, 71932, 8000, 2, 40.0f}, - {CLASS_DRUID, 71926, 10000, 1, 0.0f}, - {CLASS_WARLOCK, 71936, 9000, 1, 0.0f}, - {CLASS_ROGUE, 57640, 3000, 1, 0.0f}, - {CLASS_WARRIOR, 71961, 5000, 1, 0.0f}, - {CLASS_MAGE, 71929, 10000, 1, 0.0f}, - {CLASS_WARRIOR, 53395, 5000, 1, 0.0f}, - {CLASS_WARRIOR, 71552, 5000, 1, 0.0f}, - {CLASS_HUNTER, 36984, 7000, 1, 0.0f}, - {CLASS_HUNTER, 29576, 5000, 1, 0.0f}, - {0, 0, 0, 0, 0.0f}, + {CLASS_SHAMAN, 71938, 5000, 1, 0.0f}, + {CLASS_PALADIN, 57767, 8000, 2, 30.0f}, + {CLASS_WARLOCK, 71937, 10000, 1, 0.0f}, + {CLASS_DEATH_KNIGHT, 49576, 15000, 1, 30.0f}, + {CLASS_ROGUE, 71933, 8000, 1, 0.0f}, + {CLASS_MAGE, 71928, 4000, 1, 40.0f}, + {CLASS_PALADIN, 71930, 5000, 2, 40.0f}, + {CLASS_ROGUE, 71955, 40000, 1, 30.0f}, + {CLASS_PRIEST, 71931, 5000, 2, 40.0f}, + {CLASS_SHAMAN, 71934, 7000, 1, 0.0f}, + {CLASS_DRUID, 71925, 5000, 1, 0.0f}, + {CLASS_DEATH_KNIGHT, 71951, 8000, 1, 0.0f}, + {CLASS_DEATH_KNIGHT, 71924, 8000, 1, 0.0f}, + {CLASS_WARLOCK, 71965, 20000, 0, 0.0f}, + {CLASS_PRIEST, 71932, 8000, 2, 40.0f}, + {CLASS_DRUID, 71926, 10000, 1, 0.0f}, + {CLASS_WARLOCK, 71936, 9000, 1, 0.0f}, + {CLASS_ROGUE, 57640, 3000, 1, 0.0f}, + {CLASS_WARRIOR, 71961, 5000, 1, 0.0f}, + {CLASS_MAGE, 71929, 10000, 1, 0.0f}, + {CLASS_WARRIOR, 53395, 5000, 1, 0.0f}, + {CLASS_WARRIOR, 71552, 5000, 1, 0.0f}, + {CLASS_HUNTER, 36984, 7000, 1, 0.0f}, + {CLASS_HUNTER, 29576, 5000, 1, 0.0f}, + {0, 0, 0, 0, 0.0f}, }; class npc_icc_severed_essence : public CreatureScript @@ -2950,78 +2950,78 @@ public: struct npc_icc_severed_essenceAI : public ScriptedAI { npc_icc_severed_essenceAI(Creature* creature) : ScriptedAI(creature) {} - EventMap events; - uint8 Class; + EventMap events; + uint8 Class; - void DoAction(int32 a) - { - switch (a) - { - case CLASS_PALADIN: - me->CastSpell(me, 71953, true); - break; - case CLASS_DRUID: - //me->CastSpell(me, 57655, true); - me->SetNativeDisplayId(1933); - me->SetDisplayId(1933); - break; - } + void DoAction(int32 a) + { + switch (a) + { + case CLASS_PALADIN: + me->CastSpell(me, 71953, true); + break; + case CLASS_DRUID: + //me->CastSpell(me, 57655, true); + me->SetNativeDisplayId(1933); + me->SetDisplayId(1933); + break; + } - Class = a; + Class = a; - for (uint8 i=0; ; ++i) - { - if (sesi_spells[i].id) - { - if (Class == sesi_spells[i].Class) - events.ScheduleEvent(i+1, sesi_spells[i].cooldown_ms/4); - } - else - break; - } + for (uint8 i=0; ; ++i) + { + if (sesi_spells[i].id) + { + if (Class == sesi_spells[i].Class) + events.ScheduleEvent(i+1, sesi_spells[i].cooldown_ms/4); + } + else + break; + } - } + } - bool CanAIAttack(Unit const* target) const - { - return target->GetExactDist(4357.0f, 2769.0f, 356.0f) < 170.0f; - } + bool CanAIAttack(Unit const* target) const + { + return target->GetExactDist(4357.0f, 2769.0f, 356.0f) < 170.0f; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (uint32 e = events.GetEvent()) - { - Unit* target = NULL; - if (sesi_spells[e-1].targetType == 1) - target = me->GetVictim(); - else - target = DoSelectLowestHpFriendly(sesi_spells[e-1].range-3.0f); + if (uint32 e = events.GetEvent()) + { + Unit* target = NULL; + if (sesi_spells[e-1].targetType == 1) + target = me->GetVictim(); + else + target = DoSelectLowestHpFriendly(sesi_spells[e-1].range-3.0f); - if (target) - me->CastSpell(target, sesi_spells[e-1].id, TRIGGERED_IGNORE_SHAPESHIFT); + if (target) + me->CastSpell(target, sesi_spells[e-1].id, TRIGGERED_IGNORE_SHAPESHIFT); - events.RepeatEvent(sesi_spells[e-1].cooldown_ms); - } + events.RepeatEvent(sesi_spells[e-1].cooldown_ms); + } - if (Class == CLASS_HUNTER) - { - if (me->isAttackReady() && !me->HasUnitState(UNIT_STATE_CASTING)) - { - me->CastSpell(me->GetVictim(), 71927, true); - me->resetAttackTimer(); - } - } - else - DoMeleeAttackIfReady(); - } + if (Class == CLASS_HUNTER) + { + if (me->isAttackReady() && !me->HasUnitState(UNIT_STATE_CASTING)) + { + me->CastSpell(me->GetVictim(), 71927, true); + me->resetAttackTimer(); + } + } + else + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -3033,239 +3033,239 @@ public: class npc_icc_spire_frostwyrm : public CreatureScript { public: - npc_icc_spire_frostwyrm() : CreatureScript("npc_icc_spire_frostwyrm") { } + npc_icc_spire_frostwyrm() : CreatureScript("npc_icc_spire_frostwyrm") { } - struct npc_icc_spire_frostwyrmAI : public ScriptedAI - { - npc_icc_spire_frostwyrmAI(Creature* creature) : ScriptedAI(creature) - { - me->SetDisableGravity(true); - me->SetHover(true); - me->SetCanFly(true); - } + struct npc_icc_spire_frostwyrmAI : public ScriptedAI + { + npc_icc_spire_frostwyrmAI(Creature* creature) : ScriptedAI(creature) + { + me->SetDisableGravity(true); + me->SetHover(true); + me->SetCanFly(true); + } - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - events.ScheduleEvent(1, urand(15000, 25000)); // blizzard - events.ScheduleEvent(2, 5000); // cleave - events.ScheduleEvent(3, urand(10000, 15000)); // frost breath - } + void Reset() + { + events.Reset(); + events.ScheduleEvent(1, urand(15000, 25000)); // blizzard + events.ScheduleEvent(2, 5000); // cleave + events.ScheduleEvent(3, urand(10000, 15000)); // frost breath + } - void DoAction(int32 a) - { - if (a != -1) - return; - if (me->GetHomePosition().GetPositionZ() < 225.0f) - return; - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), 191.26f, me->GetOrientation()); - me->GetMotionMaster()->MoveLand(1, me->GetPositionX(), me->GetPositionY(), 191.26f, 2.5f*7.0f); - Talk(0); - } + void DoAction(int32 a) + { + if (a != -1) + return; + if (me->GetHomePosition().GetPositionZ() < 225.0f) + return; + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), 191.26f, me->GetOrientation()); + me->GetMotionMaster()->MoveLand(1, me->GetPositionX(), me->GetPositionY(), 191.26f, 2.5f*7.0f); + Talk(0); + } - void MovementInform(uint32 type, uint32 id) - { - if (type == EFFECT_MOTION_TYPE && id == 1) - { - me->SetDisableGravity(false); - me->SetHover(false); - me->SetCanFly(false); + void MovementInform(uint32 type, uint32 id) + { + if (type == EFFECT_MOTION_TYPE && id == 1) + { + me->SetDisableGravity(false); + me->SetHover(false); + me->SetCanFly(false); - if (Player* p = SelectTargetFromPlayerList(100.0f)) - { - Talk(p->GetTeamId() == TEAM_HORDE ? 1 : 2); - AttackStart(p); - } - } - } + if (Player* p = SelectTargetFromPlayerList(100.0f)) + { + Talk(p->GetTeamId() == TEAM_HORDE ? 1 : 2); + AttackStart(p); + } + } + } - bool CanAIAttack(Unit const* target) const - { - return me->GetPositionZ() < 225.0f && me->GetHomePosition().GetExactDist(target) < 200.0f; - } + bool CanAIAttack(Unit const* target) const + { + return me->GetPositionZ() < 225.0f && me->GetHomePosition().GetExactDist(target) < 200.0f; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 1: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) - me->CastSpell(target, 70362, false); - events.RepeatEvent(urand(25000, 35000)); - break; - case 2: - me->CastSpell(me->GetVictim(), 70361, false); - events.RepeatEvent(5000); - break; - case 3: - me->CastSpell(me->GetVictim(), 70116, false); - events.RepeatEvent(urand(10000, 15000)); - break; - } + switch (events.GetEvent()) + { + case 1: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + me->CastSpell(target, 70362, false); + events.RepeatEvent(urand(25000, 35000)); + break; + case 2: + me->CastSpell(me->GetVictim(), 70361, false); + events.RepeatEvent(5000); + break; + case 3: + me->CastSpell(me->GetVictim(), 70116, false); + events.RepeatEvent(urand(10000, 15000)); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_icc_spire_frostwyrmAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_icc_spire_frostwyrmAI(creature); + } }; #define VENGEFUL_WP_COUNT 6 const Position VengefulWP[VENGEFUL_WP_COUNT] = { - {4432.21f, 3041.5f, 372.783f, 0.0f}, - {4370.50f, 3042.00f, 372.80f, 0.0f}, - {4370.37f, 3059.16f, 371.69f, 0.0f}, - {4342.53f, 3058.97f, 371.68f, 0.0f}, - {4342.51f, 3041.24f, 372.80f, 0.0f}, - {4281.30f, 3041.77f, 372.78f, 0.0f}, + {4432.21f, 3041.5f, 372.783f, 0.0f}, + {4370.50f, 3042.00f, 372.80f, 0.0f}, + {4370.37f, 3059.16f, 371.69f, 0.0f}, + {4342.53f, 3058.97f, 371.68f, 0.0f}, + {4342.51f, 3041.24f, 372.80f, 0.0f}, + {4281.30f, 3041.77f, 372.78f, 0.0f}, }; class npc_icc_vengeful_fleshreaper : public CreatureScript { public: - npc_icc_vengeful_fleshreaper() : CreatureScript("npc_icc_vengeful_fleshreaper") { } + npc_icc_vengeful_fleshreaper() : CreatureScript("npc_icc_vengeful_fleshreaper") { } - struct npc_icc_vengeful_fleshreaperAI : public ScriptedAI - { - npc_icc_vengeful_fleshreaperAI(Creature* creature) : ScriptedAI(creature) - { - currPipeWP = VENGEFUL_WP_COUNT; - forward = true; - needMove = false; - Position homePos = me->GetHomePosition(); - if (homePos.GetPositionZ() > 365.0f) - { - currPipeWP = (homePos.GetPositionX() > 4400.0f ? 0 : 1); - needMove = true; - } - } + struct npc_icc_vengeful_fleshreaperAI : public ScriptedAI + { + npc_icc_vengeful_fleshreaperAI(Creature* creature) : ScriptedAI(creature) + { + currPipeWP = VENGEFUL_WP_COUNT; + forward = true; + needMove = false; + Position homePos = me->GetHomePosition(); + if (homePos.GetPositionZ() > 365.0f) + { + currPipeWP = (homePos.GetPositionX() > 4400.0f ? 0 : 1); + needMove = true; + } + } - uint8 currPipeWP; - bool forward; - bool needMove; - EventMap events; + uint8 currPipeWP; + bool forward; + bool needMove; + EventMap events; - void Reset() - { - me->SetWalk(false); - events.Reset(); - events.ScheduleEvent(1, urand(3000, 6000)); // leaping face maul - } + void Reset() + { + me->SetWalk(false); + events.Reset(); + events.ScheduleEvent(1, urand(3000, 6000)); // leaping face maul + } - void JustReachedHome() - { - if (currPipeWP != VENGEFUL_WP_COUNT) - needMove = true; - me->SetWalk(false); - } + void JustReachedHome() + { + if (currPipeWP != VENGEFUL_WP_COUNT) + needMove = true; + me->SetWalk(false); + } - void MovementInform(uint32 type, uint32 id) - { - if (currPipeWP != VENGEFUL_WP_COUNT && (type == POINT_MOTION_TYPE || type == EFFECT_MOTION_TYPE) && id) - needMove = true; - } + void MovementInform(uint32 type, uint32 id) + { + if (currPipeWP != VENGEFUL_WP_COUNT && (type == POINT_MOTION_TYPE || type == EFFECT_MOTION_TYPE) && id) + needMove = true; + } - void MoveInLineOfSight(Unit* who) - { - if (currPipeWP == VENGEFUL_WP_COUNT) - ScriptedAI::MoveInLineOfSight(who); - else - { - if (!me->IsInCombat() && who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2dSq(who) < 25.0f*25.0f && me->CanSeeOrDetect(who) && me->IsValidAttackTarget(who)) - AttackStart(who); - } - } + void MoveInLineOfSight(Unit* who) + { + if (currPipeWP == VENGEFUL_WP_COUNT) + ScriptedAI::MoveInLineOfSight(who); + else + { + if (!me->IsInCombat() && who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2dSq(who) < 25.0f*25.0f && me->CanSeeOrDetect(who) && me->IsValidAttackTarget(who)) + AttackStart(who); + } + } - void AttackStart(Unit* who) - { - ScriptedAI::AttackStart(who); + void AttackStart(Unit* who) + { + ScriptedAI::AttackStart(who); - if (currPipeWP != VENGEFUL_WP_COUNT) - { - Position pos; - who->GetPosition(&pos); - float angle = who->GetAngle(me); - float dist = 3.0f; - pos.m_positionX += cos(angle)*dist; - pos.m_positionY += sin(angle)*dist; - me->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), 10.0f, 6.0f, 0); - } - } + if (currPipeWP != VENGEFUL_WP_COUNT) + { + Position pos; + who->GetPosition(&pos); + float angle = who->GetAngle(me); + float dist = 3.0f; + pos.m_positionX += cos(angle)*dist; + pos.m_positionY += sin(angle)*dist; + me->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), 10.0f, 6.0f, 0); + } + } - void UpdateAI(uint32 diff) - { - if (needMove) - { - needMove = false; - if (forward) - { - if (currPipeWP == VENGEFUL_WP_COUNT-1) - { - forward = false; - --currPipeWP; - } - else - ++currPipeWP; - } - else - { - if (currPipeWP == 0) - { - forward = true; - ++currPipeWP; - } - else - --currPipeWP; - } - me->SetHomePosition(VengefulWP[currPipeWP].GetPositionX(), VengefulWP[currPipeWP].GetPositionY(), VengefulWP[currPipeWP].GetPositionZ(), me->GetOrientation()); - if (forward && currPipeWP == 3 || !forward && currPipeWP == 2) - me->GetMotionMaster()->MoveJump(VengefulWP[currPipeWP].GetPositionX(), VengefulWP[currPipeWP].GetPositionY(), VengefulWP[currPipeWP].GetPositionZ(), 10.0f, 6.0f, 1); - else - me->GetMotionMaster()->MovePoint(1, VengefulWP[currPipeWP].GetPositionX(), VengefulWP[currPipeWP].GetPositionY(), VengefulWP[currPipeWP].GetPositionZ()); - } + void UpdateAI(uint32 diff) + { + if (needMove) + { + needMove = false; + if (forward) + { + if (currPipeWP == VENGEFUL_WP_COUNT-1) + { + forward = false; + --currPipeWP; + } + else + ++currPipeWP; + } + else + { + if (currPipeWP == 0) + { + forward = true; + ++currPipeWP; + } + else + --currPipeWP; + } + me->SetHomePosition(VengefulWP[currPipeWP].GetPositionX(), VengefulWP[currPipeWP].GetPositionY(), VengefulWP[currPipeWP].GetPositionZ(), me->GetOrientation()); + if (forward && currPipeWP == 3 || !forward && currPipeWP == 2) + me->GetMotionMaster()->MoveJump(VengefulWP[currPipeWP].GetPositionX(), VengefulWP[currPipeWP].GetPositionY(), VengefulWP[currPipeWP].GetPositionZ(), 10.0f, 6.0f, 1); + else + me->GetMotionMaster()->MovePoint(1, VengefulWP[currPipeWP].GetPositionX(), VengefulWP[currPipeWP].GetPositionY(), VengefulWP[currPipeWP].GetPositionZ()); + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 1: - if (me->GetVictim() && !me->GetVictim()->HasAura(71163) && me->GetVictim()->GetDistance(me) > 5.0f && me->GetVictim()->GetDistance(me) < 30.0f) - { - me->CastSpell(me->GetVictim(), 71164, false); - events.RepeatEvent(urand(15000, 20000)); - } - else - events.RepeatEvent(3000); - break; - } + switch (events.GetEvent()) + { + case 1: + if (me->GetVictim() && !me->GetVictim()->HasAura(71163) && me->GetVictim()->GetDistance(me) > 5.0f && me->GetVictim()->GetDistance(me) < 30.0f) + { + me->CastSpell(me->GetVictim(), 71164, false); + events.RepeatEvent(urand(15000, 20000)); + } + else + events.RepeatEvent(3000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_icc_vengeful_fleshreaperAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_icc_vengeful_fleshreaperAI(creature); + } }; class npc_icc_buff_switcher : public CreatureScript @@ -3275,434 +3275,434 @@ public: bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { - if (creature->GetEntry() == NPC_GARROSH_HELLSCREAM && player->PlayerTalkClass->GetGossipMenu().GetMenuId() == 11206 || creature->GetEntry() == NPC_KING_VARIAN_WRYNN && player->PlayerTalkClass->GetGossipMenu().GetMenuId() == 11204) - { - if (!player->GetGroup() || !player->GetGroup()->isRaidGroup() || !player->GetGroup()->IsLeader(player->GetGUID())) - { - player->CLOSE_GOSSIP_MENU(); - ChatHandler(player->GetSession()).PSendSysMessage("Only the raid leader can turn off the buff."); - return true; - } - if (InstanceScript* inst = creature->GetInstanceScript()) - if (inst->GetData(DATA_BUFF_AVAILABLE)) - inst->SetData(DATA_BUFF_AVAILABLE, 0); - if (creature->GetEntry() == NPC_GARROSH_HELLSCREAM) - { - player->CLOSE_GOSSIP_MENU(); - return true; - } - } - return false; + if (creature->GetEntry() == NPC_GARROSH_HELLSCREAM && player->PlayerTalkClass->GetGossipMenu().GetMenuId() == 11206 || creature->GetEntry() == NPC_KING_VARIAN_WRYNN && player->PlayerTalkClass->GetGossipMenu().GetMenuId() == 11204) + { + if (!player->GetGroup() || !player->GetGroup()->isRaidGroup() || !player->GetGroup()->IsLeader(player->GetGUID())) + { + player->CLOSE_GOSSIP_MENU(); + ChatHandler(player->GetSession()).PSendSysMessage("Only the raid leader can turn off the buff."); + return true; + } + if (InstanceScript* inst = creature->GetInstanceScript()) + if (inst->GetData(DATA_BUFF_AVAILABLE)) + inst->SetData(DATA_BUFF_AVAILABLE, 0); + if (creature->GetEntry() == NPC_GARROSH_HELLSCREAM) + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + } + return false; } }; class npc_icc_nerubar_broodkeeper : public CreatureScript { public: - npc_icc_nerubar_broodkeeper() : CreatureScript("npc_icc_nerubar_broodkeeper") { } + npc_icc_nerubar_broodkeeper() : CreatureScript("npc_icc_nerubar_broodkeeper") { } - struct npc_icc_nerubar_broodkeeperAI : public ScriptedAI - { - npc_icc_nerubar_broodkeeperAI(Creature* creature) : ScriptedAI(creature) - { - me->SetDisableGravity(true); - me->SetCanFly(true); - me->SetHover(true); - _didWebBeam = false; - me->m_SightDistance = 100.0f; // for MoveInLineOfSight distance - } + struct npc_icc_nerubar_broodkeeperAI : public ScriptedAI + { + npc_icc_nerubar_broodkeeperAI(Creature* creature) : ScriptedAI(creature) + { + me->SetDisableGravity(true); + me->SetCanFly(true); + me->SetHover(true); + _didWebBeam = false; + me->m_SightDistance = 100.0f; // for MoveInLineOfSight distance + } - EventMap events; - bool _didWebBeam; + EventMap events; + bool _didWebBeam; - void Reset() - { - events.Reset(); - events.ScheduleEvent(1, urand(3000, 10000)); // Crypt Scarabs - events.ScheduleEvent(2, urand(15000, 25000)); // Dark Mending - events.ScheduleEvent(3, urand(8000, 15000)); // Web Wrap - } + void Reset() + { + events.Reset(); + events.ScheduleEvent(1, urand(3000, 10000)); // Crypt Scarabs + events.ScheduleEvent(2, urand(15000, 25000)); // Dark Mending + events.ScheduleEvent(3, urand(8000, 15000)); // Web Wrap + } - void MoveInLineOfSight(Unit* who) - { - if (!_didWebBeam && who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2d(who) < 70.0f) - { - _didWebBeam = true; - float nx = me->GetPositionX() + cos(me->GetOrientation())*2.0f; - float ny = me->GetPositionY() + sin(me->GetOrientation())*2.0f; - float nz = me->GetMap()->GetHeight(nx, ny, 50.0f); - me->SetHomePosition(nx, ny, nz, me->GetOrientation()); - me->CastSpell(me, SPELL_WEB_BEAM, false); - me->GetMotionMaster()->MovePoint(1, nx, ny, nz, false); - return; - } - if (me->HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY)) - return; - ScriptedAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit* who) + { + if (!_didWebBeam && who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2d(who) < 70.0f) + { + _didWebBeam = true; + float nx = me->GetPositionX() + cos(me->GetOrientation())*2.0f; + float ny = me->GetPositionY() + sin(me->GetOrientation())*2.0f; + float nz = me->GetMap()->GetHeight(nx, ny, 50.0f); + me->SetHomePosition(nx, ny, nz, me->GetOrientation()); + me->CastSpell(me, SPELL_WEB_BEAM, false); + me->GetMotionMaster()->MovePoint(1, nx, ny, nz, false); + return; + } + if (me->HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY)) + return; + ScriptedAI::MoveInLineOfSight(who); + } - void EnterCombat(Unit* /*who*/) - { - me->CallForHelp(15.0f); - } + void EnterCombat(Unit* /*who*/) + { + me->CallForHelp(15.0f); + } - void JustReachedHome() - { - if (me->IsHovering()) - { - me->SetDisableGravity(false); - me->SetCanFly(false); - me->SetHover(false); - me->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - } - } + void JustReachedHome() + { + if (me->IsHovering()) + { + me->SetDisableGravity(false); + me->SetCanFly(false); + me->SetHover(false); + me->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == 1) - { - if (me->IsHovering()) - { - me->SetDisableGravity(false); - me->SetCanFly(false); - me->SetHover(false); - me->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - } - } - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == 1) + { + if (me->IsHovering()) + { + me->SetDisableGravity(false); + me->SetCanFly(false); + me->SetHover(false); + me->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + } + } + } - bool CanAIAttack(const Unit* target) const - { - return !me->HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); - } + bool CanAIAttack(const Unit* target) const + { + return !me->HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case 1: - me->CastSpell(me->GetVictim(), 70965, false); - events.RepeatEvent(urand(20000, 30000)); - break; - case 2: - me->CastSpell(me->GetVictim(), 71020, false); - events.RepeatEvent(urand(20000, 30000)); - break; - case 3: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) - me->CastSpell(target, 70980, false); - events.RepeatEvent(urand(20000, 30000)); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case 1: + me->CastSpell(me->GetVictim(), 70965, false); + events.RepeatEvent(urand(20000, 30000)); + break; + case 2: + me->CastSpell(me->GetVictim(), 71020, false); + events.RepeatEvent(urand(20000, 30000)); + break; + case 3: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + me->CastSpell(target, 70980, false); + events.RepeatEvent(urand(20000, 30000)); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_icc_nerubar_broodkeeperAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_icc_nerubar_broodkeeperAI(creature); + } }; enum gauntletEvents { - SAY_INIT = 0, - POINT_ENTER_COMBAT = 1, + SAY_INIT = 0, + POINT_ENTER_COMBAT = 1, - EVENT_CHECK_FIGHT = 1, - EVENT_GAUNTLET_PHASE1 = 2, - EVENT_GAUNTLET_PHASE2 = 3, - EVENT_GAUNTLET_PHASE3 = 4, - EVENT_SUMMON_BROODLING = 5 + EVENT_CHECK_FIGHT = 1, + EVENT_GAUNTLET_PHASE1 = 2, + EVENT_GAUNTLET_PHASE2 = 3, + EVENT_GAUNTLET_PHASE3 = 4, + EVENT_SUMMON_BROODLING = 5 }; class npc_icc_gauntlet_controller : public CreatureScript { - public: - npc_icc_gauntlet_controller() : CreatureScript("npc_icc_gauntlet_controller") { } + public: + npc_icc_gauntlet_controller() : CreatureScript("npc_icc_gauntlet_controller") { } - struct npc_icc_gauntlet_controllerAI : public NullCreatureAI - { - npc_icc_gauntlet_controllerAI(Creature* creature) : NullCreatureAI(creature), summons(me) - { - instance = creature->GetInstanceScript(); - } + struct npc_icc_gauntlet_controllerAI : public NullCreatureAI + { + npc_icc_gauntlet_controllerAI(Creature* creature) : NullCreatureAI(creature), summons(me) + { + instance = creature->GetInstanceScript(); + } - SummonList summons; - InstanceScript* instance; - EventMap events; + SummonList summons; + InstanceScript* instance; + EventMap events; - void ScheduleBroodlings() - { - for (uint8 i = 0; i < 30; ++i) - events.ScheduleEvent(EVENT_SUMMON_BROODLING, 10000+i*350); - } + void ScheduleBroodlings() + { + for (uint8 i = 0; i < 30; ++i) + events.ScheduleEvent(EVENT_SUMMON_BROODLING, 10000+i*350); + } - void SummonBroodling() - { - float dist = frand(18.0f, 39.0f); - float o = rand_norm()*2*M_PI; - if (Creature* broodling = me->SummonCreature(NPC_NERUBAR_BROODLING, me->GetPositionX()+cos(o)*dist, me->GetPositionY()+sin(o)*dist, 250.0f, Position::NormalizeOrientation(o-M_PI))) - { - broodling->CastSpell(broodling, SPELL_WEB_BEAM2, false); - broodling->GetMotionMaster()->MovePoint(POINT_ENTER_COMBAT, broodling->GetPositionX(), broodling->GetPositionY(), 213.03f, false); - } - } + void SummonBroodling() + { + float dist = frand(18.0f, 39.0f); + float o = rand_norm()*2*M_PI; + if (Creature* broodling = me->SummonCreature(NPC_NERUBAR_BROODLING, me->GetPositionX()+cos(o)*dist, me->GetPositionY()+sin(o)*dist, 250.0f, Position::NormalizeOrientation(o-M_PI))) + { + broodling->CastSpell(broodling, SPELL_WEB_BEAM2, false); + broodling->GetMotionMaster()->MovePoint(POINT_ENTER_COMBAT, broodling->GetPositionX(), broodling->GetPositionY(), 213.03f, false); + } + } - void SummonFrostwardens() - { - for (uint8 i = 0; i < 3; ++i) - { - me->SummonCreature(i == 1 ? NPC_FROSTWARDEN_SORCERESS : NPC_FROSTWARDEN_WARRIOR, 4173.94f+i*7.0f, 2409.15f, 211.033f, 1.56f); - me->SummonCreature(i == 1 ? NPC_FROSTWARDEN_SORCERESS : NPC_FROSTWARDEN_WARRIOR, 4173.94f+i*7.0f, 2556.71f, 211.033f, 4.712f); - } - } + void SummonFrostwardens() + { + for (uint8 i = 0; i < 3; ++i) + { + me->SummonCreature(i == 1 ? NPC_FROSTWARDEN_SORCERESS : NPC_FROSTWARDEN_WARRIOR, 4173.94f+i*7.0f, 2409.15f, 211.033f, 1.56f); + me->SummonCreature(i == 1 ? NPC_FROSTWARDEN_SORCERESS : NPC_FROSTWARDEN_WARRIOR, 4173.94f+i*7.0f, 2556.71f, 211.033f, 4.712f); + } + } - void SummonSpiders() - { - me->SummonCreature(NPC_NERUBAR_CHAMPION, 4207.30f, 2532.00f, 256.0, 4.253f); - me->SummonCreature(NPC_NERUBAR_WEBWEAVER, 4228.79f, 2510.36f, 256.0f, 3.577f); - me->SummonCreature(NPC_NERUBAR_CHAMPION, 4228.34f, 2458.20f, 256.0f, 2.642f); - me->SummonCreature(NPC_NERUBAR_WEBWEAVER, 4207.54f, 2437.18f, 256.0f, 2.073f); - me->SummonCreature(NPC_NERUBAR_CHAMPION, 4156.20f, 2436.80f, 256.0f, 1.083f); - me->SummonCreature(NPC_NERUBAR_WEBWEAVER, 4133.50f, 2459.28f, 256.0f, 0.483f); - me->SummonCreature(NPC_NERUBAR_CHAMPION, 4134.28f, 2509.71f, 256.0f, 5.788f); - me->SummonCreature(NPC_NERUBAR_WEBWEAVER, 4156.29f, 2532.19f, 256.0f, 5.187f); - } + void SummonSpiders() + { + me->SummonCreature(NPC_NERUBAR_CHAMPION, 4207.30f, 2532.00f, 256.0, 4.253f); + me->SummonCreature(NPC_NERUBAR_WEBWEAVER, 4228.79f, 2510.36f, 256.0f, 3.577f); + me->SummonCreature(NPC_NERUBAR_CHAMPION, 4228.34f, 2458.20f, 256.0f, 2.642f); + me->SummonCreature(NPC_NERUBAR_WEBWEAVER, 4207.54f, 2437.18f, 256.0f, 2.073f); + me->SummonCreature(NPC_NERUBAR_CHAMPION, 4156.20f, 2436.80f, 256.0f, 1.083f); + me->SummonCreature(NPC_NERUBAR_WEBWEAVER, 4133.50f, 2459.28f, 256.0f, 0.483f); + me->SummonCreature(NPC_NERUBAR_CHAMPION, 4134.28f, 2509.71f, 256.0f, 5.788f); + me->SummonCreature(NPC_NERUBAR_WEBWEAVER, 4156.29f, 2532.19f, 256.0f, 5.187f); + } - void SpidersMoveDown() - { - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* spider = ObjectAccessor::GetCreature(*me, *itr)) - if (spider->GetPositionZ() > 220.0f) - { - spider->CastSpell(spider, SPELL_WEB_BEAM2, false); - spider->GetMotionMaster()->MovePoint(POINT_ENTER_COMBAT, spider->GetPositionX(), spider->GetPositionY(), 213.03f, false); - } - } + void SpidersMoveDown() + { + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* spider = ObjectAccessor::GetCreature(*me, *itr)) + if (spider->GetPositionZ() > 220.0f) + { + spider->CastSpell(spider, SPELL_WEB_BEAM2, false); + spider->GetMotionMaster()->MovePoint(POINT_ENTER_COMBAT, spider->GetPositionX(), spider->GetPositionY(), 213.03f, false); + } + } - void DoAction(int32 param) - { - if (param == ACTION_START_GAUNTLET) - { - Talk(SAY_INIT); - me->setActive(true); - events.Reset(); - events.SetPhase(0); - events.ScheduleEvent(EVENT_CHECK_FIGHT, 1000); - events.ScheduleEvent(EVENT_GAUNTLET_PHASE1, 0); - instance->SetBossState(DATA_SINDRAGOSA_GAUNTLET, IN_PROGRESS); - } - } + void DoAction(int32 param) + { + if (param == ACTION_START_GAUNTLET) + { + Talk(SAY_INIT); + me->setActive(true); + events.Reset(); + events.SetPhase(0); + events.ScheduleEvent(EVENT_CHECK_FIGHT, 1000); + events.ScheduleEvent(EVENT_GAUNTLET_PHASE1, 0); + instance->SetBossState(DATA_SINDRAGOSA_GAUNTLET, IN_PROGRESS); + } + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - if (instance->GetBossState(DATA_SINDRAGOSA_GAUNTLET) != DONE) - { - instance->SetBossState(DATA_SINDRAGOSA_GAUNTLET, NOT_STARTED); - SummonSpiders(); - } - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + if (instance->GetBossState(DATA_SINDRAGOSA_GAUNTLET) != DONE) + { + instance->SetBossState(DATA_SINDRAGOSA_GAUNTLET, NOT_STARTED); + SummonSpiders(); + } + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - void JustDied(Unit*) - { - instance->SetBossState(DATA_SINDRAGOSA_GAUNTLET, DONE); - } + void JustDied(Unit*) + { + instance->SetBossState(DATA_SINDRAGOSA_GAUNTLET, DONE); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetPositionZ() > 220.0f) - { - summon->SetDisableGravity(true); - summon->SetHover(true); - summon->SetWalk(true); - } - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetPositionZ() > 220.0f) + { + summon->SetDisableGravity(true); + summon->SetHover(true); + summon->SetWalk(true); + } + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - if (summon->GetEntry() != NPC_NERUBAR_BROODLING && summons.GetEntryCount(NPC_NERUBAR_BROODLING) == summons.size()) - { - if (events.GetPhaseMask() == 0) - { - events.SetPhase(1); - events.ScheduleEvent(EVENT_GAUNTLET_PHASE2, 0); - } - else if (events.GetPhaseMask() == 1) - { - events.SetPhase(2); - events.ScheduleEvent(EVENT_GAUNTLET_PHASE3, 0); - } - else - Unit::Kill(me, me); - } - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + if (summon->GetEntry() != NPC_NERUBAR_BROODLING && summons.GetEntryCount(NPC_NERUBAR_BROODLING) == summons.size()) + { + if (events.GetPhaseMask() == 0) + { + events.SetPhase(1); + events.ScheduleEvent(EVENT_GAUNTLET_PHASE2, 0); + } + else if (events.GetPhaseMask() == 1) + { + events.SetPhase(2); + events.ScheduleEvent(EVENT_GAUNTLET_PHASE3, 0); + } + else + Unit::Kill(me, me); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_FIGHT: - { - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - if (me->GetDistance(itr->GetSource()) > 100.0f || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) - continue; - - events.ScheduleEvent(EVENT_CHECK_FIGHT, 1000); - return; - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_FIGHT: + { + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + if (me->GetDistance(itr->GetSource()) > 100.0f || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) + continue; + + events.ScheduleEvent(EVENT_CHECK_FIGHT, 1000); + return; + } - CreatureAI::EnterEvadeMode(); - return; - } - case EVENT_GAUNTLET_PHASE1: - ScheduleBroodlings(); - SpidersMoveDown(); - break; - case EVENT_GAUNTLET_PHASE2: - ScheduleBroodlings(); - SummonFrostwardens(); - break; - case EVENT_GAUNTLET_PHASE3: - ScheduleBroodlings(); - SummonSpiders(); - SpidersMoveDown(); - break; - case EVENT_SUMMON_BROODLING: - SummonBroodling(); - break; - } - } - }; + CreatureAI::EnterEvadeMode(); + return; + } + case EVENT_GAUNTLET_PHASE1: + ScheduleBroodlings(); + SpidersMoveDown(); + break; + case EVENT_GAUNTLET_PHASE2: + ScheduleBroodlings(); + SummonFrostwardens(); + break; + case EVENT_GAUNTLET_PHASE3: + ScheduleBroodlings(); + SummonSpiders(); + SpidersMoveDown(); + break; + case EVENT_SUMMON_BROODLING: + SummonBroodling(); + break; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; class npc_icc_putricades_trap : public CreatureScript { - public: - npc_icc_putricades_trap() : CreatureScript("npc_icc_putricades_trap") { } + public: + npc_icc_putricades_trap() : CreatureScript("npc_icc_putricades_trap") { } - struct npc_icc_putricades_trapAI : public NullCreatureAI - { - npc_icc_putricades_trapAI(Creature* creature) : NullCreatureAI(creature), summons(me) - { - instance = creature->GetInstanceScript(); - } + struct npc_icc_putricades_trapAI : public NullCreatureAI + { + npc_icc_putricades_trapAI(Creature* creature) : NullCreatureAI(creature), summons(me) + { + instance = creature->GetInstanceScript(); + } - SummonList summons; - InstanceScript* instance; - EventMap events; + SummonList summons; + InstanceScript* instance; + EventMap events; - void DoAction(int32 param) - { - if (param == ACTION_START_GAUNTLET) - { - me->setActive(true); - events.Reset(); - events.ScheduleEvent(EVENT_CHECK_FIGHT, 1000); - instance->SetData(DATA_PUTRICIDE_TRAP_STATE, IN_PROGRESS); - me->CastSpell(me, SPELL_GIANT_INSECT_SWARM, true); + void DoAction(int32 param) + { + if (param == ACTION_START_GAUNTLET) + { + me->setActive(true); + events.Reset(); + events.ScheduleEvent(EVENT_CHECK_FIGHT, 1000); + instance->SetData(DATA_PUTRICIDE_TRAP_STATE, IN_PROGRESS); + me->CastSpell(me, SPELL_GIANT_INSECT_SWARM, true); - for (uint8 i = 0; i < 60; ++i) - events.ScheduleEvent(EVENT_GAUNTLET_PHASE1, i*1000); - events.ScheduleEvent(EVENT_GAUNTLET_PHASE2, 60000); - } - } + for (uint8 i = 0; i < 60; ++i) + events.ScheduleEvent(EVENT_GAUNTLET_PHASE1, i*1000); + events.ScheduleEvent(EVENT_GAUNTLET_PHASE2, 60000); + } + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - if (instance->GetData(DATA_PUTRICIDE_TRAP_STATE) != DONE) - instance->SetData(DATA_PUTRICIDE_TRAP_STATE, NOT_STARTED); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + if (instance->GetData(DATA_PUTRICIDE_TRAP_STATE) != DONE) + instance->SetData(DATA_PUTRICIDE_TRAP_STATE, NOT_STARTED); + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->CastSpell(summon, SPELL_LEAP_TO_A_RANDOM_LOCATION, true); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->CastSpell(summon, SPELL_LEAP_TO_A_RANDOM_LOCATION, true); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_FIGHT: - { - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - if (me->GetDistance(itr->GetSource()) > 100.0f || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) - continue; - - events.ScheduleEvent(EVENT_CHECK_FIGHT, 1000); - return; - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_FIGHT: + { + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + if (me->GetDistance(itr->GetSource()) > 100.0f || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) + continue; + + events.ScheduleEvent(EVENT_CHECK_FIGHT, 1000); + return; + } - CreatureAI::EnterEvadeMode(); - return; - } - case EVENT_GAUNTLET_PHASE1: - { - std::list clist; - me->GetCreaturesWithEntryInRange(clist, 80.0f, NPC_INVISIBLE_STALKER); - // xinef: spell: 70484, some hack would be required, skip - for (std::list::const_iterator itr = clist.begin(); itr != clist.end(); ++itr) - me->SummonCreature(NPC_FLASH_EATING_INSECT, **itr, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - break; - } - case EVENT_GAUNTLET_PHASE2: - instance->SetData(DATA_PUTRICIDE_TRAP_STATE, DONE); - me->RemoveAllAuras(); - me->RemoveAllDynObjects(); - break; - } - } - }; + CreatureAI::EnterEvadeMode(); + return; + } + case EVENT_GAUNTLET_PHASE1: + { + std::list clist; + me->GetCreaturesWithEntryInRange(clist, 80.0f, NPC_INVISIBLE_STALKER); + // xinef: spell: 70484, some hack would be required, skip + for (std::list::const_iterator itr = clist.begin(); itr != clist.end(); ++itr) + me->SummonCreature(NPC_FLASH_EATING_INSECT, **itr, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + break; + } + case EVENT_GAUNTLET_PHASE2: + instance->SetData(DATA_PUTRICIDE_TRAP_STATE, DONE); + me->RemoveAllAuras(); + me->RemoveAllDynObjects(); + break; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; class at_icc_gauntlet_event : public AreaTriggerScript @@ -3713,9 +3713,9 @@ class at_icc_gauntlet_event : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) { if (InstanceScript* instance = player->GetInstanceScript()) - if (instance->GetBossState(DATA_SINDRAGOSA_GAUNTLET) == NOT_STARTED && !player->IsGameMaster()) - if (Creature* gauntlet = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_SINDRAGOSA_GAUNTLET))) - gauntlet->AI()->DoAction(ACTION_START_GAUNTLET); + if (instance->GetBossState(DATA_SINDRAGOSA_GAUNTLET) == NOT_STARTED && !player->IsGameMaster()) + if (Creature* gauntlet = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_SINDRAGOSA_GAUNTLET))) + gauntlet->AI()->DoAction(ACTION_START_GAUNTLET); return true; } }; @@ -3727,26 +3727,26 @@ class at_icc_putricide_trap : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) { - if (InstanceScript* instance = player->GetInstanceScript()) - if (instance->GetData(DATA_PUTRICIDE_TRAP_STATE) == NOT_STARTED && !player->IsGameMaster()) - if (Creature* trap = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_PUTRICADES_TRAP))) - trap->AI()->DoAction(ACTION_START_GAUNTLET); + if (InstanceScript* instance = player->GetInstanceScript()) + if (instance->GetData(DATA_PUTRICIDE_TRAP_STATE) == NOT_STARTED && !player->IsGameMaster()) + if (Creature* trap = ObjectAccessor::GetCreature(*player, instance->GetData64(NPC_PUTRICADES_TRAP))) + trap->AI()->DoAction(ACTION_START_GAUNTLET); return true; } }; class at_icc_spire_frostwyrm : public AreaTriggerScript { - public: - at_icc_spire_frostwyrm() : AreaTriggerScript("at_icc_spire_frostwyrm") { } + public: + at_icc_spire_frostwyrm() : AreaTriggerScript("at_icc_spire_frostwyrm") { } - bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) - { - if (Creature* frostwyrm = player->FindNearestCreature(NPC_SPIRE_FROSTWYRM, 150.0f, true)) - if (frostwyrm->GetPositionZ() > 250.0f && frostwyrm->AI()) - frostwyrm->AI()->DoAction(-1); - return true; - } + bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) + { + if (Creature* frostwyrm = player->FindNearestCreature(NPC_SPIRE_FROSTWYRM, 150.0f, true)) + if (frostwyrm->GetPositionZ() > 250.0f && frostwyrm->AI()) + frostwyrm->AI()->DoAction(-1); + return true; + } }; void AddSC_icecrown_citadel() @@ -3778,27 +3778,27 @@ void AddSC_icecrown_citadel() new at_icc_start_blood_quickening(); new at_icc_start_frostwing_gauntlet(); - // pussywizard below: - new spell_icc_web_wrap(); - new spell_icc_dark_reckoning(); - new spell_stinky_precious_decimate(); - new spell_icc_yf_frozen_orb(); - new spell_icc_yh_volley(); - new spell_icc_yd_summon_undead(); - new spell_icc_shattered_bones(); - new npc_icc_skybreaker_hierophant(); - new npc_icc_skybreaker_marksman(); - new npc_icc_skybreaker_vicar(); - new npc_icc_skybreaker_luminary(); - new npc_icc_valkyr_herald(); - new npc_icc_severed_essence(); - new npc_icc_spire_frostwyrm(); - new npc_icc_vengeful_fleshreaper(); - new npc_icc_buff_switcher(); - new npc_icc_nerubar_broodkeeper(); - new npc_icc_gauntlet_controller(); - new npc_icc_putricades_trap(); - new at_icc_gauntlet_event(); - new at_icc_putricide_trap(); - new at_icc_spire_frostwyrm(); + // pussywizard below: + new spell_icc_web_wrap(); + new spell_icc_dark_reckoning(); + new spell_stinky_precious_decimate(); + new spell_icc_yf_frozen_orb(); + new spell_icc_yh_volley(); + new spell_icc_yd_summon_undead(); + new spell_icc_shattered_bones(); + new npc_icc_skybreaker_hierophant(); + new npc_icc_skybreaker_marksman(); + new npc_icc_skybreaker_vicar(); + new npc_icc_skybreaker_luminary(); + new npc_icc_valkyr_herald(); + new npc_icc_severed_essence(); + new npc_icc_spire_frostwyrm(); + new npc_icc_vengeful_fleshreaper(); + new npc_icc_buff_switcher(); + new npc_icc_nerubar_broodkeeper(); + new npc_icc_gauntlet_controller(); + new npc_icc_putricades_trap(); + new at_icc_gauntlet_event(); + new at_icc_putricide_trap(); + new at_icc_spire_frostwyrm(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 48461315c..d3f9ddc7d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -42,14 +42,14 @@ enum SharedSpells SPELL_FROSTMOURNE_TELEPORT_VISUAL = 73078, // Shadowmourne questline - SPELL_UNSATED_CRAVING = 71168, + SPELL_UNSATED_CRAVING = 71168, SPELL_SHADOWS_FATE = 71169, - // Misc - SPELL_WEB_BEAM = 69887, - SPELL_WEB_BEAM2 = 69986, - SPELL_GIANT_INSECT_SWARM = 70475, - SPELL_LEAP_TO_A_RANDOM_LOCATION = 70485 + // Misc + SPELL_WEB_BEAM = 69887, + SPELL_WEB_BEAM2 = 69986, + SPELL_GIANT_INSECT_SWARM = 70475, + SPELL_LEAP_TO_A_RANDOM_LOCATION = 70485 }; enum TeleporterSpells @@ -79,9 +79,9 @@ enum DataTypes DATA_VALITHRIA_DREAMWALKER = 10, DATA_SINDRAGOSA = 11, DATA_THE_LICH_KING = 12, - DATA_SINDRAGOSA_GAUNTLET = 13, - DATA_BLOOD_PRINCE_TRASH = 14, - MAX_ENCOUNTERS = 15, + DATA_SINDRAGOSA_GAUNTLET = 13, + DATA_BLOOD_PRINCE_TRASH = 14, + MAX_ENCOUNTERS = 15, // Additional data DATA_SAURFANG_EVENT_NPC = 13, @@ -113,15 +113,15 @@ enum DataTypes DATA_TERENAS_MENETHIL = 39, DATA_ENEMY_GUNSHIP = 40, - // pussywizard: - DATA_BUFF_AVAILABLE = 251, - DATA_WEEKLY_QUEST_ID = 252, - // NONE = 253, - DATA_PUTRICIDE_TRAP_STATE = 254, - DATA_HAS_LIMITED_ATTEMPTS = 255, - DATA_LK_HC_AVAILABLE = 256, + // pussywizard: + DATA_BUFF_AVAILABLE = 251, + DATA_WEEKLY_QUEST_ID = 252, + // NONE = 253, + DATA_PUTRICIDE_TRAP_STATE = 254, + DATA_HAS_LIMITED_ATTEMPTS = 255, + DATA_LK_HC_AVAILABLE = 256, - DATA_BPC_TRASH_DIED = 300, + DATA_BPC_TRASH_DIED = 300, }; enum CreaturesIds @@ -147,8 +147,8 @@ enum CreaturesIds NPC_GARROSH_HELLSCREAM = 39372, NPC_KING_VARIAN_WRYNN = 39371, NPC_DEATHBOUND_WARD = 37007, - NPC_HIGH_OVERLORD_SAURFANG_DUMMY = 32315, - NPC_MURADIN_BRONZEBEARD_DUMMY = 38607, + NPC_HIGH_OVERLORD_SAURFANG_DUMMY = 32315, + NPC_MURADIN_BRONZEBEARD_DUMMY = 38607, NPC_LADY_JAINA_PROUDMOORE_QUEST = 38606, NPC_MURADIN_BRONZEBEARD_QUEST = 38607, NPC_UTHER_THE_LIGHTBRINGER_QUEST = 38608, @@ -183,7 +183,7 @@ enum CreaturesIds NPC_VENGEFUL_SHADE = 38222, NPC_DEATHSPEAKER_SERVANT = 36805, - NPC_RISEN_DEATHSPEAKER_SERVANT = 36844, + NPC_RISEN_DEATHSPEAKER_SERVANT = 36844, // Icecrown Gunship Battle NPC_MARTYR_STALKER_IGB_SAURFANG = 38569, @@ -305,17 +305,17 @@ enum CreaturesIds NPC_FROST_BOMB = 37186, NPC_ICE_TOMB = 36980, - // Sindragosa Gauntlet - NPC_SINDRAGOSA_GAUNTLET = 37503, - NPC_NERUBAR_CHAMPION = 37501, - NPC_NERUBAR_WEBWEAVER = 37502, - NPC_NERUBAR_BROODLING = 37232, - NPC_FROSTWARDEN_SORCERESS = 37229, - NPC_FROSTWARDEN_WARRIOR = 37228, + // Sindragosa Gauntlet + NPC_SINDRAGOSA_GAUNTLET = 37503, + NPC_NERUBAR_CHAMPION = 37501, + NPC_NERUBAR_WEBWEAVER = 37502, + NPC_NERUBAR_BROODLING = 37232, + NPC_FROSTWARDEN_SORCERESS = 37229, + NPC_FROSTWARDEN_WARRIOR = 37228, - // Putricade Trap - NPC_PUTRICADES_TRAP = 38879, - NPC_FLASH_EATING_INSECT = 37782, + // Putricade Trap + NPC_PUTRICADES_TRAP = 38879, + NPC_FLASH_EATING_INSECT = 37782, // The Lich King NPC_THE_LICH_KING = 36597, @@ -338,7 +338,7 @@ enum CreaturesIds NPC_SPIRIT_BOMB = 39189, NPC_FROSTMOURNE_TRIGGER = 38584, NPC_TERENAS_MENETHIL_OUTRO = 38579, - + // Generic NPC_INVISIBLE_STALKER = 30298, NPC_SPIRE_FROSTWYRM = 37230, @@ -528,7 +528,7 @@ enum WeekliesICC enum QuestsICC { - QUEST_A_FEAST_OF_SOULS = 24547 + QUEST_A_FEAST_OF_SOULS = 24547 }; enum WorldStatesICC @@ -542,10 +542,10 @@ enum WorldStatesICC enum PutricideEventFlags { - PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE = 1, - PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE = 2, - PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS = 4, - PUTRICIDE_EVENT_FLAG_TRAP_FINISHED = 8, + PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE = 1, + PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE = 2, + PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS = 4, + PUTRICIDE_EVENT_FLAG_TRAP_FINISHED = 8, }; enum AreaIds diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp index 930fcb5e6..6327a22e7 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp @@ -30,7 +30,7 @@ class icecrown_citadel_teleport : public GameObjectScript player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Deathbringer's Rise.", GOSSIP_SENDER_ICC_PORT, DEATHBRINGER_S_RISE_TELEPORT); // M_PI/6 if (instance->GetData(DATA_COLDFLAME_JETS) == DONE && go->GetEntry() != 202235) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Upper Spire.", GOSSIP_SENDER_ICC_PORT, UPPER_SPIRE_TELEPORT); // M_PI/6 - if (instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) == DONE && instance->GetBossState(DATA_SINDRAGOSA_GAUNTLET) == DONE && go->GetEntry() != 202246) + if (instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) == DONE && instance->GetBossState(DATA_SINDRAGOSA_GAUNTLET) == DONE && go->GetEntry() != 202246) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to Sindragosa's Lair", GOSSIP_SENDER_ICC_PORT, SINDRAGOSA_S_LAIR_TELEPORT); // M_PI*3/2 + M_PI/6 } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index a9f6d63e7..951e613b2 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -27,8 +27,8 @@ enum EventIds EVENT_QUAKE = 23437, EVENT_SECOND_REMORSELESS_WINTER = 23507, EVENT_TELEPORT_TO_FROSMOURNE = 23617, - EVENT_FESTERGUT_VALVE_USED = 23438, - EVENT_ROTFACE_VALVE_USED = 23426, + EVENT_FESTERGUT_VALVE_USED = 23438, + EVENT_ROTFACE_VALVE_USED = 23426, }; enum TimedEvents @@ -63,7 +63,7 @@ DoorData const doorData[] = {GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_02, DATA_VALITHRIA_DREAMWALKER, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_S }, {GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_03, DATA_VALITHRIA_DREAMWALKER, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_N }, {GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_04, DATA_VALITHRIA_DREAMWALKER, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_S }, - {GO_SINDRAGOSA_ENTRANCE_DOOR, DATA_SINDRAGOSA, DOOR_TYPE_ROOM, BOUNDARY_NONE}, + {GO_SINDRAGOSA_ENTRANCE_DOOR, DATA_SINDRAGOSA, DOOR_TYPE_ROOM, BOUNDARY_NONE}, {GO_SINDRAGOSA_ENTRANCE_DOOR, DATA_SINDRAGOSA_GAUNTLET, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, {GO_SINDRAGOSA_SHORTCUT_ENTRANCE_DOOR, DATA_SINDRAGOSA, DOOR_TYPE_PASSAGE, BOUNDARY_E }, {GO_SINDRAGOSA_SHORTCUT_EXIT_DOOR, DATA_SINDRAGOSA, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, @@ -116,19 +116,19 @@ class RespawnEvent : public BasicEvent class DelayedCastMincharEvent : public BasicEvent { - public: - DelayedCastMincharEvent(Creature* trigger, uint32 spellId) : _trigger(trigger), _spellId(spellId) {} + public: + DelayedCastMincharEvent(Creature* trigger, uint32 spellId) : _trigger(trigger), _spellId(spellId) {} - bool Execute(uint64 /*time*/, uint32 /*diff*/) - { - if (Creature* minchar = _trigger->FindNearestCreature(NPC_INFILTRATOR_MINCHAR_BQ, 50.0f, true)) - _trigger->CastSpell(minchar, _spellId, true); - return true; - } + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + if (Creature* minchar = _trigger->FindNearestCreature(NPC_INFILTRATOR_MINCHAR_BQ, 50.0f, true)) + _trigger->CastSpell(minchar, _spellId, true); + return true; + } - private: - Creature* _trigger; - uint32 _spellId; + private: + Creature* _trigger; + uint32 _spellId; }; class instance_icecrown_citadel : public InstanceMapScript @@ -140,18 +140,18 @@ class instance_icecrown_citadel : public InstanceMapScript { instance_icecrown_citadel_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { - // pussywizard: - IsBuffAvailable = true; - WeeklyQuestId10 = 0; - PutricideEnteranceDoorGUID = 0; - GasReleaseValveGUID = 0; - OozeReleaseValveGUID = 0; - PutricideEventProgress = 0; - LichKingHeroicAvailable = true; - LichKingRandomWhisperTimer = 120*IN_MILLISECONDS; - DarkwhisperElevatorTimer = 3000; - memset(&WeeklyQuestNpcGUID, 0, sizeof(WeeklyQuestNpcGUID)); - ScourgeTransporterFirstGUID = 0; + // pussywizard: + IsBuffAvailable = true; + WeeklyQuestId10 = 0; + PutricideEnteranceDoorGUID = 0; + GasReleaseValveGUID = 0; + OozeReleaseValveGUID = 0; + PutricideEventProgress = 0; + LichKingHeroicAvailable = true; + LichKingRandomWhisperTimer = 120*IN_MILLISECONDS; + DarkwhisperElevatorTimer = 3000; + memset(&WeeklyQuestNpcGUID, 0, sizeof(WeeklyQuestNpcGUID)); + ScourgeTransporterFirstGUID = 0; SetBossNumber(MAX_ENCOUNTERS); LoadDoorData(doorData); @@ -185,8 +185,8 @@ class instance_icecrown_citadel : public InstanceMapScript ValithriaDreamwalkerGUID = 0; ValithriaLichKingGUID = 0; ValithriaTriggerGUID = 0; - PutricadeTrapGUID = 0; - SindragosaGauntletGUID = 0; + PutricadeTrapGUID = 0; + SindragosaGauntletGUID = 0; SindragosaGUID = 0; SpinestalkerGUID = 0; RimefangGUID = 0; @@ -206,7 +206,7 @@ class instance_icecrown_citadel : public InstanceMapScript ColdflameJetsState = NOT_STARTED; BloodQuickeningState = NOT_STARTED; BloodQuickeningMinutes = 0; - BloodPrinceTrashCount = 0; + BloodPrinceTrashCount = 0; } void FillInitialWorldStates(WorldPacket& data) @@ -218,28 +218,28 @@ class instance_icecrown_citadel : public InstanceMapScript data << uint32(WORLDSTATE_ATTEMPTS_MAX) << uint32(MaxHeroicAttempts); } - void OnPlayerAreaUpdate(Player* player, uint32 oldArea, uint32 newArea) - { - if (newArea == 4890 /*Putricide's Laboratory of Alchemical Horrors and Fun*/ || - newArea == 4891 /*The Sanctum of Blood*/ || - newArea == 4889 /*The Frost Queen's Lair*/ || - newArea == 4859 /*The Frozen Throne*/ || - newArea == 4910 /*Frostmourne*/) - { - player->SendInitWorldStates(player->GetZoneId(), player->GetAreaId()); - } - else - player->SendUpdateWorldState(WORLDSTATE_SHOW_ATTEMPTS, 0); - } + void OnPlayerAreaUpdate(Player* player, uint32 oldArea, uint32 newArea) + { + if (newArea == 4890 /*Putricide's Laboratory of Alchemical Horrors and Fun*/ || + newArea == 4891 /*The Sanctum of Blood*/ || + newArea == 4889 /*The Frost Queen's Lair*/ || + newArea == 4859 /*The Frozen Throne*/ || + newArea == 4910 /*Frostmourne*/) + { + player->SendInitWorldStates(player->GetZoneId(), player->GetAreaId()); + } + else + player->SendUpdateWorldState(WORLDSTATE_SHOW_ATTEMPTS, 0); + } void OnPlayerEnter(Player* player) { if (TeamIdInInstance == TEAM_NEUTRAL) TeamIdInInstance = player->GetTeamId(); - // for professor putricide hc - DoRemoveAurasDueToSpellOnPlayers(74119 /*SPELL_GAS_VARIABLE*/); - DoRemoveAurasDueToSpellOnPlayers(74118 /*SPELL_OOZE_VARIABLE*/); + // for professor putricide hc + DoRemoveAurasDueToSpellOnPlayers(74119 /*SPELL_GAS_VARIABLE*/); + DoRemoveAurasDueToSpellOnPlayers(74118 /*SPELL_OOZE_VARIABLE*/); if (GetBossState(DATA_LADY_DEATHWHISPER) == DONE && GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != DONE) SpawnGunship(); @@ -255,47 +255,47 @@ class instance_icecrown_citadel : public InstanceMapScript TeamIdInInstance = player->GetTeamId(); } - // apply ICC buff to pets/summons - if (GetData(DATA_BUFF_AVAILABLE) && IS_PLAYER_GUID(creature->GetOwnerGUID()) && creature->HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && creature->CanHaveThreatList()) - if (Unit* owner = creature->GetOwner()) - if (Player* plr = owner->ToPlayer()) - { - SpellAreaForAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForAreaMapBounds(4812); - for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) - if ((itr->second->raceMask & plr->getRaceMask()) && !creature->HasAura(itr->second->spellId)) - if (const SpellInfo* si = sSpellMgr->GetSpellInfo(itr->second->spellId)) - if (si->HasAura(SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT)) - creature->AddAura(itr->second->spellId, creature); - } + // apply ICC buff to pets/summons + if (GetData(DATA_BUFF_AVAILABLE) && IS_PLAYER_GUID(creature->GetOwnerGUID()) && creature->HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN) && creature->CanHaveThreatList()) + if (Unit* owner = creature->GetOwner()) + if (Player* plr = owner->ToPlayer()) + { + SpellAreaForAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForAreaMapBounds(4812); + for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) + if ((itr->second->raceMask & plr->getRaceMask()) && !creature->HasAura(itr->second->spellId)) + if (const SpellInfo* si = sSpellMgr->GetSpellInfo(itr->second->spellId)) + if (si->HasAura(SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT)) + creature->AddAura(itr->second->spellId, creature); + } - // fighting npcs in Rampart of Skulls - std::string name1("Skybreaker "); - std::string name2("Kor'kron "); - if (!creature->GetTransport() && creature->GetPositionZ() <= 205.0f && creature->GetExactDist2d(-439.0f, 2210.0f) <= 150.0f && (creature->GetEntry() == 37544 || creature->GetEntry() == 37545 || creature->GetName().compare(0, name1.length(), name1) == 0 || creature->GetName().compare(0, name2.length(), name2) == 0)) - creature->AddToNotify(NOTIFY_AI_RELOCATION); + // fighting npcs in Rampart of Skulls + std::string name1("Skybreaker "); + std::string name2("Kor'kron "); + if (!creature->GetTransport() && creature->GetPositionZ() <= 205.0f && creature->GetExactDist2d(-439.0f, 2210.0f) <= 150.0f && (creature->GetEntry() == 37544 || creature->GetEntry() == 37545 || creature->GetName().compare(0, name1.length(), name1) == 0 || creature->GetName().compare(0, name2.length(), name2) == 0)) + creature->AddToNotify(NOTIFY_AI_RELOCATION); - // pussywizard: check weekly here, before possible UpdateEntry - // allow creating all of them, because after killing Marrowgar some have to appear, so just hide them - switch (creature->GetEntry()) - { - case NPC_INFILTRATOR_MINCHAR: - case NPC_KOR_KRON_LIEUTENANT: - case NPC_ALCHEMIST_ADRIANNA: - case NPC_ALRIN_THE_AGILE: - case NPC_INFILTRATOR_MINCHAR_BQ: - case NPC_MINCHAR_BEAM_STALKER: - case NPC_VALITHRIA_DREAMWALKER_QUEST: - for (uint8 i = 0; i < WeeklyNPCs; ++i) - if (WeeklyQuestData[i].creatureEntry == creature->GetEntry()) - { - WeeklyQuestNpcGUID[i] = creature->GetGUID(); - if (WeeklyQuestId10 != WeeklyQuestData[i].questId[0]) - creature->SetVisible(false); - else if (WeeklyQuestData[i].creatureEntry == NPC_VALITHRIA_DREAMWALKER_QUEST && GetBossState(DATA_VALITHRIA_DREAMWALKER) != DONE) - creature->SetVisible(false); - } - break; - } + // pussywizard: check weekly here, before possible UpdateEntry + // allow creating all of them, because after killing Marrowgar some have to appear, so just hide them + switch (creature->GetEntry()) + { + case NPC_INFILTRATOR_MINCHAR: + case NPC_KOR_KRON_LIEUTENANT: + case NPC_ALCHEMIST_ADRIANNA: + case NPC_ALRIN_THE_AGILE: + case NPC_INFILTRATOR_MINCHAR_BQ: + case NPC_MINCHAR_BEAM_STALKER: + case NPC_VALITHRIA_DREAMWALKER_QUEST: + for (uint8 i = 0; i < WeeklyNPCs; ++i) + if (WeeklyQuestData[i].creatureEntry == creature->GetEntry()) + { + WeeklyQuestNpcGUID[i] = creature->GetGUID(); + if (WeeklyQuestId10 != WeeklyQuestData[i].questId[0]) + creature->SetVisible(false); + else if (WeeklyQuestData[i].creatureEntry == NPC_VALITHRIA_DREAMWALKER_QUEST && GetBossState(DATA_VALITHRIA_DREAMWALKER) != DONE) + creature->SetVisible(false); + } + break; + } switch (creature->GetEntry()) { @@ -335,37 +335,37 @@ class instance_icecrown_citadel : public InstanceMapScript if (TeamIdInInstance == TEAM_ALLIANCE) creature->UpdateEntry(NPC_KING_VARIAN_WRYNN); - // Xinef: summon in case of instance unload - if (GetBossState(DATA_THE_LICH_KING) == DONE) - { - instance->SummonCreature(NPC_LADY_JAINA_PROUDMOORE_QUEST, JainaSpawnPos); + // Xinef: summon in case of instance unload + if (GetBossState(DATA_THE_LICH_KING) == DONE) + { + instance->SummonCreature(NPC_LADY_JAINA_PROUDMOORE_QUEST, JainaSpawnPos); instance->SummonCreature(NPC_MURADIN_BRONZEBEARD_QUEST, MuradinSpawnPos); instance->SummonCreature(NPC_UTHER_THE_LIGHTBRINGER_QUEST, UtherSpawnPos); instance->SummonCreature(NPC_LADY_SYLVANAS_WINDRUNNER_QUEST, SylvanasSpawnPos); - } + } break; case NPC_DEATHBRINGER_SAURFANG: DeathbringerSaurfangGUID = creature->GetGUID(); break; case NPC_SE_HIGH_OVERLORD_SAURFANG: if (TeamIdInInstance == TEAM_ALLIANCE) - { + { creature->UpdateEntry(NPC_SE_MURADIN_BRONZEBEARD, creature->GetCreatureData()); - creature->LoadEquipment(); - } + creature->LoadEquipment(); + } DeathbringerSaurfangEventGUID = creature->GetGUID(); creature->LastUsedScriptID = creature->GetScriptId(); - break; + break; case NPC_SE_MURADIN_BRONZEBEARD: DeathbringerSaurfangEventGUID = creature->GetGUID(); break; - case NPC_HIGH_OVERLORD_SAURFANG_DUMMY: - if (TeamIdInInstance == TEAM_ALLIANCE) - { - creature->UpdateEntry(NPC_MURADIN_BRONZEBEARD_DUMMY, creature->GetCreatureData()); - creature->LoadEquipment(); - } - break; + case NPC_HIGH_OVERLORD_SAURFANG_DUMMY: + if (TeamIdInInstance == TEAM_ALLIANCE) + { + creature->UpdateEntry(NPC_MURADIN_BRONZEBEARD_DUMMY, creature->GetCreatureData()); + creature->LoadEquipment(); + } + break; case NPC_SE_KOR_KRON_REAVER: if (TeamIdInInstance == TEAM_ALLIANCE) creature->UpdateEntry(NPC_SE_SKYBREAKER_MARINE); @@ -420,12 +420,12 @@ class instance_icecrown_citadel : public InstanceMapScript case NPC_GREEN_DRAGON_COMBAT_TRIGGER: ValithriaTriggerGUID = creature->GetGUID(); break; - case NPC_PUTRICADES_TRAP: - PutricadeTrapGUID = creature->GetGUID(); - break; - case NPC_SINDRAGOSA_GAUNTLET: - SindragosaGauntletGUID = creature->GetGUID(); - break; + case NPC_PUTRICADES_TRAP: + PutricadeTrapGUID = creature->GetGUID(); + break; + case NPC_SINDRAGOSA_GAUNTLET: + SindragosaGauntletGUID = creature->GetGUID(); + break; case NPC_SINDRAGOSA: SindragosaGUID = creature->GetGUID(); if (!HeroicAttempts && GetData(DATA_HAS_LIMITED_ATTEMPTS) && creature->IsAlive()) @@ -454,30 +454,30 @@ class instance_icecrown_citadel : public InstanceMapScript case NPC_TERENAS_MENETHIL_FROSTMOURNE_H: TerenasMenethilGUID = creature->GetGUID(); break; - case NPC_INFILTRATOR_MINCHAR_BQ: - if (BloodQuickeningState == DONE) - creature->DespawnOrUnsummon(1); - break; - case NPC_MINCHAR_BEAM_STALKER: - if (BloodQuickeningState != DONE) - { - uint32 spellId = 0; - if (creature->GetPositionY() > 2790.0f && creature->GetPositionZ() > 420.0f) - spellId = 72304; - else if (creature->GetPositionY() < 2790.0f && creature->GetPositionZ() > 420.0f) - spellId = 72303; - else if (creature->GetPositionY() < 2790.0f && creature->GetPositionZ() < 420.0f) - spellId = 72302; - else - spellId = 72301; - creature->m_Events.AddEvent(new DelayedCastMincharEvent(creature, spellId), creature->m_Events.CalculateTime(1000)); - } - break; - case NPC_SKYBREAKER_DECKHAND: - case NPC_ORGRIMS_HAMMER_CREW: - if (!creature->IsAlive()) - creature->Respawn(); - break; + case NPC_INFILTRATOR_MINCHAR_BQ: + if (BloodQuickeningState == DONE) + creature->DespawnOrUnsummon(1); + break; + case NPC_MINCHAR_BEAM_STALKER: + if (BloodQuickeningState != DONE) + { + uint32 spellId = 0; + if (creature->GetPositionY() > 2790.0f && creature->GetPositionZ() > 420.0f) + spellId = 72304; + else if (creature->GetPositionY() < 2790.0f && creature->GetPositionZ() > 420.0f) + spellId = 72303; + else if (creature->GetPositionY() < 2790.0f && creature->GetPositionZ() < 420.0f) + spellId = 72302; + else + spellId = 72301; + creature->m_Events.AddEvent(new DelayedCastMincharEvent(creature, spellId), creature->m_Events.CalculateTime(1000)); + } + break; + case NPC_SKYBREAKER_DECKHAND: + case NPC_ORGRIMS_HAMMER_CREW: + if (!creature->IsAlive()) + creature->Respawn(); + break; default: break; } @@ -525,10 +525,10 @@ class instance_icecrown_citadel : public InstanceMapScript (TeamIdInInstance == TEAM_HORDE && data->posX < 10.0f)) return entry; return 0; - case NPC_SPIRE_FROSTWYRM: - if (TeamIdInInstance == TEAM_ALLIANCE && data->posY < 2200.0f || TeamIdInInstance == TEAM_HORDE && data->posY > 2200.0f) - return 0; - break; + case NPC_SPIRE_FROSTWYRM: + if (TeamIdInInstance == TEAM_ALLIANCE && data->posY < 2200.0f || TeamIdInInstance == TEAM_HORDE && data->posY > 2200.0f) + return 0; + break; } return entry; @@ -571,12 +571,12 @@ class instance_icecrown_citadel : public InstanceMapScript if (!creature) return; - // fighting npcs in Rampart of Skulls - std::string name1("Skybreaker "); - std::string name2("Kor'kron "); - if (!creature->GetTransport() && creature->GetPositionZ() <= 205.0f && creature->GetExactDist2d(-439.0f, 2210.0f) <= 150.0f && (creature->GetEntry() == 37544 || creature->GetEntry() == 37545 || creature->GetName().compare(0, name1.length(), name1) == 0 || creature->GetName().compare(0, name2.length(), name2) == 0)) - if (!creature->GetLootRecipient()) - creature->m_Events.AddEvent(new RespawnEvent(*creature), creature->m_Events.CalculateTime(3000)); + // fighting npcs in Rampart of Skulls + std::string name1("Skybreaker "); + std::string name2("Kor'kron "); + if (!creature->GetTransport() && creature->GetPositionZ() <= 205.0f && creature->GetExactDist2d(-439.0f, 2210.0f) <= 150.0f && (creature->GetEntry() == 37544 || creature->GetEntry() == 37545 || creature->GetName().compare(0, name1.length(), name1) == 0 || creature->GetName().compare(0, name2.length(), name2) == 0)) + if (!creature->GetLootRecipient()) + creature->m_Events.AddEvent(new RespawnEvent(*creature), creature->m_Events.CalculateTime(3000)); switch (creature->GetEntry()) { @@ -625,14 +625,14 @@ class instance_icecrown_citadel : public InstanceMapScript } break; } - case NPC_DEATHSPEAKER_SERVANT: - if (Creature* c = unit->SummonCreature(WORLD_TRIGGER, *unit, TEMPSUMMON_TIMED_DESPAWN, 10000)) - { - c->CastSpell(c, 69422, true); - unit->SummonCreature(NPC_RISEN_DEATHSPEAKER_SERVANT, *unit, TEMPSUMMON_MANUAL_DESPAWN); - unit->ToCreature()->DespawnOrUnsummon(3000); - } - break; + case NPC_DEATHSPEAKER_SERVANT: + if (Creature* c = unit->SummonCreature(WORLD_TRIGGER, *unit, TEMPSUMMON_TIMED_DESPAWN, 10000)) + { + c->CastSpell(c, 69422, true); + unit->SummonCreature(NPC_RISEN_DEATHSPEAKER_SERVANT, *unit, TEMPSUMMON_MANUAL_DESPAWN); + unit->ToCreature()->DespawnOrUnsummon(3000); + } + break; default: break; } @@ -650,22 +650,22 @@ class instance_icecrown_citadel : public InstanceMapScript switch (go->GetEntry()) { - case GO_SPIRIT_ALARM_1: - case GO_SPIRIT_ALARM_2: - case GO_SPIRIT_ALARM_3: - case GO_SPIRIT_ALARM_4: - { - Position pos[4*3] = {{-160.96f, 2210.46f, 35.24f, 0.0f}, {-176.27f, 2201.93f, 35.24f, 0.0f}, {-207.83f, 2207.38f, 35.24f, 0.0f}, - {-178.41f, 2225.11f, 35.24f, 0.0f}, {-195.23f, 2221.55f, 35.24f, 0.0f}, {-209.94f, 2250.34f, 37.99f, 0.0f}, - {-289.80f, 2216.60f, 42.39f, 0.0f}, {-317.76f, 2216.11f, 42.57f, 0.0f}, {-301.07f, 2216.62f, 42.0f, 0.0f}, - {-276.07f, 2206.76f, 42.57f, 0.0f}, {-304.44f, 2199.11f, 41.99f, 0.0f}, {-292.82f, 2204.61f, 42.02f, 0.0f}}; - go->SetPosition(pos[3*(go->GetEntry()-GO_SPIRIT_ALARM_1)+urand(0,2)]); - } - break; - case GO_GEIST_ALARM_1: - case GO_GEIST_ALARM_2: - go->SetPosition(go->GetPositionX()+urand(0,2)*20.0f*(go->GetEntry()==GO_GEIST_ALARM_1?-1.0f:1.0f), go->GetPositionY(), go->GetPositionZ(), go->GetOrientation()); - break; + case GO_SPIRIT_ALARM_1: + case GO_SPIRIT_ALARM_2: + case GO_SPIRIT_ALARM_3: + case GO_SPIRIT_ALARM_4: + { + Position pos[4*3] = {{-160.96f, 2210.46f, 35.24f, 0.0f}, {-176.27f, 2201.93f, 35.24f, 0.0f}, {-207.83f, 2207.38f, 35.24f, 0.0f}, + {-178.41f, 2225.11f, 35.24f, 0.0f}, {-195.23f, 2221.55f, 35.24f, 0.0f}, {-209.94f, 2250.34f, 37.99f, 0.0f}, + {-289.80f, 2216.60f, 42.39f, 0.0f}, {-317.76f, 2216.11f, 42.57f, 0.0f}, {-301.07f, 2216.62f, 42.0f, 0.0f}, + {-276.07f, 2206.76f, 42.57f, 0.0f}, {-304.44f, 2199.11f, 41.99f, 0.0f}, {-292.82f, 2204.61f, 42.02f, 0.0f}}; + go->SetPosition(pos[3*(go->GetEntry()-GO_SPIRIT_ALARM_1)+urand(0,2)]); + } + break; + case GO_GEIST_ALARM_1: + case GO_GEIST_ALARM_2: + go->SetPosition(go->GetPositionX()+urand(0,2)*20.0f*(go->GetEntry()==GO_GEIST_ALARM_1?-1.0f:1.0f), go->GetPositionY(), go->GetPositionZ(), go->GetOrientation()); + break; case GO_DOODAD_ICECROWN_ICEWALL02: case GO_ICEWALL: case GO_LORD_MARROWGAR_S_ENTRANCE: @@ -684,13 +684,13 @@ class instance_icecrown_citadel : public InstanceMapScript case GO_SINDRAGOSA_SHORTCUT_ENTRANCE_DOOR: case GO_SINDRAGOSA_SHORTCUT_EXIT_DOOR: case GO_ICE_WALL: - case GO_SINDRAGOSA_ENTRANCE_DOOR: + case GO_SINDRAGOSA_ENTRANCE_DOOR: AddDoor(go, true); break; case GO_SCIENTIST_ENTRANCE: - PutricideEnteranceDoorGUID = go->GetGUID(); - HandleGameObject(PutricideEnteranceDoorGUID, PutricideEventProgress & PUTRICIDE_EVENT_FLAG_TRAP_FINISHED, go); - break; + PutricideEnteranceDoorGUID = go->GetGUID(); + HandleGameObject(PutricideEnteranceDoorGUID, PutricideEventProgress & PUTRICIDE_EVENT_FLAG_TRAP_FINISHED, go); + break; // these 2 gates are functional only on 25man modes case GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_01: case GO_DOODAD_ICECROWN_ROOSTPORTCULLIS_04: @@ -770,16 +770,16 @@ class instance_icecrown_citadel : public InstanceMapScript if (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE) HandleGameObject(PutricidePipeGUIDs[1], true, go); break; - case GO_GAS_RELEASE_VALVE: - GasReleaseValveGUID = go->GetGUID(); - if (GetBossState(DATA_FESTERGUT) != DONE) - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); - break; - case GO_OOZE_RELEASE_VALVE: - OozeReleaseValveGUID = go->GetGUID(); - if (GetBossState(DATA_ROTFACE) != DONE) - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); - break; + case GO_GAS_RELEASE_VALVE: + GasReleaseValveGUID = go->GetGUID(); + if (GetBossState(DATA_FESTERGUT) != DONE) + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); + break; + case GO_OOZE_RELEASE_VALVE: + OozeReleaseValveGUID = go->GetGUID(); + if (GetBossState(DATA_ROTFACE) != DONE) + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); + break; case GO_DRINK_ME: PutricideTableGUID = go->GetGUID(); break; @@ -830,12 +830,12 @@ class instance_icecrown_citadel : public InstanceMapScript if (GetBossState(DATA_THE_LICH_KING) == DONE) go->SetRespawnTime(7 * DAY); break; - case GO_SCOURGE_TRANSPORTER_FIRST: + case GO_SCOURGE_TRANSPORTER_FIRST: AddDoor(go, true); - ScourgeTransporterFirstGUID = go->GetGUID(); - if (GetBossState(DATA_LORD_MARROWGAR) == DONE) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; + ScourgeTransporterFirstGUID = go->GetGUID(); + if (GetBossState(DATA_LORD_MARROWGAR) == DONE) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; default: break; } @@ -868,7 +868,7 @@ class instance_icecrown_citadel : public InstanceMapScript case GO_SINDRAGOSA_SHORTCUT_ENTRANCE_DOOR: case GO_SINDRAGOSA_SHORTCUT_EXIT_DOOR: case GO_ICE_WALL: - case GO_SCOURGE_TRANSPORTER_FIRST: + case GO_SCOURGE_TRANSPORTER_FIRST: AddDoor(go, false); break; case GO_THE_SKYBREAKER_A: @@ -884,22 +884,22 @@ class instance_icecrown_citadel : public InstanceMapScript { switch (type) { - case DATA_BUFF_AVAILABLE: - return (IsBuffAvailable ? 1 : 0); - case DATA_WEEKLY_QUEST_ID: - return WeeklyQuestId10; - case DATA_PUTRICIDE_TRAP_STATE: - if (!(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) || !(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)) - return TO_BE_DECIDED; - if (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS) - return IN_PROGRESS; - if (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_TRAP_FINISHED) - return DONE; - return NOT_STARTED; - case DATA_HAS_LIMITED_ATTEMPTS: - return (instance->IsHeroic() ? 1 : 0); - case DATA_LK_HC_AVAILABLE: - return (LichKingHeroicAvailable ? 1 : 0); + case DATA_BUFF_AVAILABLE: + return (IsBuffAvailable ? 1 : 0); + case DATA_WEEKLY_QUEST_ID: + return WeeklyQuestId10; + case DATA_PUTRICIDE_TRAP_STATE: + if (!(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) || !(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)) + return TO_BE_DECIDED; + if (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS) + return IN_PROGRESS; + if (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_TRAP_FINISHED) + return DONE; + return NOT_STARTED; + case DATA_HAS_LIMITED_ATTEMPTS: + return (instance->IsHeroic() ? 1 : 0); + case DATA_LK_HC_AVAILABLE: + return (LichKingHeroicAvailable ? 1 : 0); case DATA_SINDRAGOSA_FROSTWYRMS: return FrostwyrmGUIDs.size(); case DATA_SPINESTALKER: @@ -970,10 +970,10 @@ class instance_icecrown_citadel : public InstanceMapScript return ValithriaLichKingGUID; case DATA_VALITHRIA_TRIGGER: return ValithriaTriggerGUID; - case NPC_SINDRAGOSA_GAUNTLET: - return SindragosaGauntletGUID; - case NPC_PUTRICADES_TRAP: - return PutricadeTrapGUID; + case NPC_SINDRAGOSA_GAUNTLET: + return SindragosaGauntletGUID; + case NPC_PUTRICADES_TRAP: + return PutricadeTrapGUID; case DATA_SINDRAGOSA: return SindragosaGUID; case DATA_SPINESTALKER: @@ -995,32 +995,32 @@ class instance_icecrown_citadel : public InstanceMapScript return 0; } - void HandleDropAttempt(bool drop = true) - { - if (!GetData(DATA_HAS_LIMITED_ATTEMPTS)) - return; - if (drop && HeroicAttempts) - { - --HeroicAttempts; - DoUpdateWorldState(WORLDSTATE_ATTEMPTS_REMAINING, HeroicAttempts); - SaveToDB(); - } - if (HeroicAttempts) - return; - if (GetBossState(DATA_ROTFACE) == DONE && GetBossState(DATA_FESTERGUT) == DONE) - if (Creature* professor = instance->GetCreature(ProfessorPutricideGUID)) - if (professor->IsAlive()) - professor->SetVisible(false); - if (Creature* bq = instance->GetCreature(BloodQueenLanaThelGUID)) - if (bq->IsAlive()) - bq->SetVisible(false); - if (Creature* sindra = instance->GetCreature(SindragosaGUID)) - if (sindra->IsAlive()) - sindra->SetVisible(false); - if (Creature* theLichKing = instance->GetCreature(TheLichKingGUID)) - if (theLichKing->IsAlive()) - theLichKing->SetVisible(false); - } + void HandleDropAttempt(bool drop = true) + { + if (!GetData(DATA_HAS_LIMITED_ATTEMPTS)) + return; + if (drop && HeroicAttempts) + { + --HeroicAttempts; + DoUpdateWorldState(WORLDSTATE_ATTEMPTS_REMAINING, HeroicAttempts); + SaveToDB(); + } + if (HeroicAttempts) + return; + if (GetBossState(DATA_ROTFACE) == DONE && GetBossState(DATA_FESTERGUT) == DONE) + if (Creature* professor = instance->GetCreature(ProfessorPutricideGUID)) + if (professor->IsAlive()) + professor->SetVisible(false); + if (Creature* bq = instance->GetCreature(BloodQueenLanaThelGUID)) + if (bq->IsAlive()) + bq->SetVisible(false); + if (Creature* sindra = instance->GetCreature(SindragosaGUID)) + if (sindra->IsAlive()) + sindra->SetVisible(false); + if (Creature* theLichKing = instance->GetCreature(TheLichKingGUID)) + if (theLichKing->IsAlive()) + theLichKing->SetVisible(false); + } bool SetBossState(uint32 type, EncounterState state) { @@ -1029,35 +1029,35 @@ class instance_icecrown_citadel : public InstanceMapScript switch (type) { - case DATA_LORD_MARROWGAR: - if (state == DONE) - { - WeeklyQuestId10 = RAND(QUEST_BLOOD_QUICKENING_10, QUEST_RESIDUE_RENDEZVOUS_10, QUEST_RESPITE_FOR_A_TORMENTED_SOUL_10, QUEST_DEPROGRAMMING_10, QUEST_SECURING_THE_RAMPARTS_10); - SetData(DATA_WEEKLY_QUEST_ID, 0); // show required hidden npcs - if (GameObject* transporter = instance->GetGameObject(ScourgeTransporterFirstGUID)) - transporter->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - SaveToDB(); - } - break; + case DATA_LORD_MARROWGAR: + if (state == DONE) + { + WeeklyQuestId10 = RAND(QUEST_BLOOD_QUICKENING_10, QUEST_RESIDUE_RENDEZVOUS_10, QUEST_RESPITE_FOR_A_TORMENTED_SOUL_10, QUEST_DEPROGRAMMING_10, QUEST_SECURING_THE_RAMPARTS_10); + SetData(DATA_WEEKLY_QUEST_ID, 0); // show required hidden npcs + if (GameObject* transporter = instance->GetGameObject(ScourgeTransporterFirstGUID)) + transporter->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + SaveToDB(); + } + break; case DATA_LADY_DEATHWHISPER: if (state == DONE) - SpawnGunship(); + SpawnGunship(); break; case DATA_ICECROWN_GUNSHIP_BATTLE: if (state == DONE) { if (GameObject* loot = instance->GetGameObject(GunshipArmoryGUID)) - { - Map::PlayerList const& pl = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* p = itr->GetSource()) - if (!p->IsGameMaster() && p->GetGroup() && p->GetGroup()->isRaidGroup()) - { - loot->SetLootRecipient(p); - break; - } + { + Map::PlayerList const& pl = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* p = itr->GetSource()) + if (!p->IsGameMaster() && p->GetGroup() && p->GetGroup()->isRaidGroup()) + { + loot->SetLootRecipient(p); + break; + } loot->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE | GO_FLAG_NODESPAWN); - } + } } else if (state == FAIL) Events.ScheduleEvent(EVENT_RESPAWN_GUNSHIP, 30000); @@ -1087,8 +1087,8 @@ class instance_icecrown_citadel : public InstanceMapScript case DATA_FESTERGUT: if (state == DONE) { - if (GameObject* go = instance->GetGameObject(GasReleaseValveGUID)) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); + if (GameObject* go = instance->GetGameObject(GasReleaseValveGUID)) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); if (GetBossState(DATA_ROTFACE) == DONE) HandleDropAttempt(false); } @@ -1096,24 +1096,24 @@ class instance_icecrown_citadel : public InstanceMapScript case DATA_ROTFACE: if (state == DONE) { - if (GameObject* go = instance->GetGameObject(OozeReleaseValveGUID)) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); + if (GameObject* go = instance->GetGameObject(OozeReleaseValveGUID)) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND | GO_FLAG_NOT_SELECTABLE); if (GetBossState(DATA_FESTERGUT) == DONE) HandleDropAttempt(false); } break; case DATA_PROFESSOR_PUTRICIDE: - HandleGameObject(PutricideEnteranceDoorGUID, (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_TRAP_FINISHED) && state != IN_PROGRESS); + HandleGameObject(PutricideEnteranceDoorGUID, (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_TRAP_FINISHED) && state != IN_PROGRESS); HandleGameObject(PlagueSigilGUID, state != DONE); if (state == DONE) CheckLichKingAvailability(); else if (state == FAIL) HandleDropAttempt(); - if (state == DONE && !instance->IsHeroic() && LichKingHeroicAvailable) - { - LichKingHeroicAvailable = false; - SaveToDB(); - } + if (state == DONE && !instance->IsHeroic() && LichKingHeroicAvailable) + { + LichKingHeroicAvailable = false; + SaveToDB(); + } break; case DATA_BLOOD_QUEEN_LANA_THEL: HandleGameObject(BloodwingSigilGUID, state != DONE); @@ -1121,40 +1121,40 @@ class instance_icecrown_citadel : public InstanceMapScript CheckLichKingAvailability(); else if (state == FAIL) HandleDropAttempt(); - if (state == DONE && !instance->IsHeroic() && LichKingHeroicAvailable) - { - LichKingHeroicAvailable = false; - SaveToDB(); - } + if (state == DONE && !instance->IsHeroic() && LichKingHeroicAvailable) + { + LichKingHeroicAvailable = false; + SaveToDB(); + } + break; + case DATA_VALITHRIA_DREAMWALKER: + if (state == DONE) + SetData(DATA_WEEKLY_QUEST_ID, GetData(DATA_WEEKLY_QUEST_ID)); // will show weekly quest npc if necessary break; - case DATA_VALITHRIA_DREAMWALKER: - if (state == DONE) - SetData(DATA_WEEKLY_QUEST_ID, GetData(DATA_WEEKLY_QUEST_ID)); // will show weekly quest npc if necessary - break; case DATA_SINDRAGOSA: HandleGameObject(FrostwingSigilGUID, state != DONE); if (state == DONE) CheckLichKingAvailability(); else if (state == FAIL) HandleDropAttempt(); - if (state == DONE && !instance->IsHeroic() && LichKingHeroicAvailable) - { - LichKingHeroicAvailable = false; - SaveToDB(); - } + if (state == DONE && !instance->IsHeroic() && LichKingHeroicAvailable) + { + LichKingHeroicAvailable = false; + SaveToDB(); + } break; case DATA_THE_LICH_KING: { // dramatically increase visibility range during fight to seeing frostmourne room instance->SetVisibilityRange(state == IN_PROGRESS ? 500.0f : 200.0f); - if (state == FAIL) - { - Events.CancelEvent(EVENT_QUAKE_SHATTER); - Events.CancelEvent(EVENT_REBUILD_PLATFORM); + if (state == FAIL) + { + Events.CancelEvent(EVENT_QUAKE_SHATTER); + Events.CancelEvent(EVENT_REBUILD_PLATFORM); - HandleDropAttempt(); - } + HandleDropAttempt(); + } if (state == DONE) { @@ -1165,8 +1165,8 @@ class instance_icecrown_citadel : public InstanceMapScript if (GameObject* pillars = instance->GetGameObject(PillarsUnchainedGUID)) pillars->SetRespawnTime(7 * DAY); - instance->LoadGrid(JainaSpawnPos.GetPositionX(), JainaSpawnPos.GetPositionY()); - instance->SummonCreature(NPC_LADY_JAINA_PROUDMOORE_QUEST, JainaSpawnPos); + instance->LoadGrid(JainaSpawnPos.GetPositionX(), JainaSpawnPos.GetPositionY()); + instance->SummonCreature(NPC_LADY_JAINA_PROUDMOORE_QUEST, JainaSpawnPos); instance->SummonCreature(NPC_MURADIN_BRONZEBEARD_QUEST, MuradinSpawnPos); instance->SummonCreature(NPC_UTHER_THE_LIGHTBRINGER_QUEST, UtherSpawnPos); instance->SummonCreature(NPC_LADY_SYLVANAS_WINDRUNNER_QUEST, SylvanasSpawnPos); @@ -1187,10 +1187,10 @@ class instance_icecrown_citadel : public InstanceMapScript SetBossState(DATA_ICECROWN_GUNSHIP_BATTLE, NOT_STARTED); uint32 gunshipEntry = TeamIdInInstance == TEAM_HORDE ? GO_ORGRIMS_HAMMER_H : GO_THE_SKYBREAKER_A; if (MotionTransport* gunship = sTransportMgr->CreateTransport(gunshipEntry, 0, instance)) - { + { GunshipGUID = gunship->GetGUID(); - gunship->setActive(false); - } + gunship->setActive(false); + } } } @@ -1198,88 +1198,88 @@ class instance_icecrown_citadel : public InstanceMapScript { switch (type) { - case DATA_BUFF_AVAILABLE: - IsBuffAvailable = (data ? true : false); - if (!IsBuffAvailable) - { - Map::PlayerList const& plrList = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = plrList.begin(); itr != plrList.end(); ++itr) - if (Player* plr = itr->GetSource()) - { - plr->UpdateAreaDependentAuras(plr->GetAreaId()); - for (Unit::ControlSet::const_iterator itr = plr->m_Controlled.begin(); itr != plr->m_Controlled.end(); ++itr) - { - Unit::AuraMap& am = (*itr)->GetOwnedAuras(); - for (Unit::AuraMap::iterator itra = am.begin(); itra != am.end();) - switch (itra->second->GetId()) - { - // Hellscream's Warsong - case 73816: case 73818: case 73819: case 73820: case 73821: case 73822: - // Strength of Wrynn - case 73762: case 73824: case 73825: case 73826: case 73827: case 73828: - (*itr)->RemoveOwnedAura(itra); - break; - default: - ++itra; - break; - } - } - } - } - break; - case DATA_WEEKLY_QUEST_ID: - for (uint8 i=0; iGetCreature(WeeklyQuestNpcGUID[i])) - c->SetVisible(true); - break; - case DATA_PUTRICIDE_TRAP_STATE: - if (data == NOT_STARTED) - { - PutricideEventProgress &= ~PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS; - HandleGameObject(PutricideCollisionGUID, ((PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) && (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE))); - if ((PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) && (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)) - { - for (uint8 i=0; i<2; ++i) - if (GameObject* go = instance->GetGameObject(PutricideGateGUIDs[i])) - go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - } - else - { - HandleGameObject(PutricideGateGUIDs[0], !(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE)); - HandleGameObject(PutricideGateGUIDs[1], !(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)); - } - SaveToDB(); - } - else if (data == IN_PROGRESS) - { - PutricideEventProgress |= PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS; - HandleGameObject(PutricideCollisionGUID, false); - HandleGameObject(PutricideGateGUIDs[0], false); - HandleGameObject(PutricideGateGUIDs[1], false); - SaveToDB(); - } - else if (data == DONE) - { - PutricideEventProgress &= ~PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS; - PutricideEventProgress |= PUTRICIDE_EVENT_FLAG_TRAP_FINISHED; - HandleGameObject(PutricideEnteranceDoorGUID, true); - HandleGameObject(PutricideCollisionGUID, ((PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) && (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE))); - if ((PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) && (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)) - { - for (uint8 i=0; i<2; ++i) - if (GameObject* go = instance->GetGameObject(PutricideGateGUIDs[i])) - go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - } - else - { - HandleGameObject(PutricideGateGUIDs[0], !(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE)); - HandleGameObject(PutricideGateGUIDs[1], !(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)); - } - SaveToDB(); - } - return; + case DATA_BUFF_AVAILABLE: + IsBuffAvailable = (data ? true : false); + if (!IsBuffAvailable) + { + Map::PlayerList const& plrList = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = plrList.begin(); itr != plrList.end(); ++itr) + if (Player* plr = itr->GetSource()) + { + plr->UpdateAreaDependentAuras(plr->GetAreaId()); + for (Unit::ControlSet::const_iterator itr = plr->m_Controlled.begin(); itr != plr->m_Controlled.end(); ++itr) + { + Unit::AuraMap& am = (*itr)->GetOwnedAuras(); + for (Unit::AuraMap::iterator itra = am.begin(); itra != am.end();) + switch (itra->second->GetId()) + { + // Hellscream's Warsong + case 73816: case 73818: case 73819: case 73820: case 73821: case 73822: + // Strength of Wrynn + case 73762: case 73824: case 73825: case 73826: case 73827: case 73828: + (*itr)->RemoveOwnedAura(itra); + break; + default: + ++itra; + break; + } + } + } + } + break; + case DATA_WEEKLY_QUEST_ID: + for (uint8 i=0; iGetCreature(WeeklyQuestNpcGUID[i])) + c->SetVisible(true); + break; + case DATA_PUTRICIDE_TRAP_STATE: + if (data == NOT_STARTED) + { + PutricideEventProgress &= ~PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS; + HandleGameObject(PutricideCollisionGUID, ((PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) && (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE))); + if ((PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) && (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)) + { + for (uint8 i=0; i<2; ++i) + if (GameObject* go = instance->GetGameObject(PutricideGateGUIDs[i])) + go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + } + else + { + HandleGameObject(PutricideGateGUIDs[0], !(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE)); + HandleGameObject(PutricideGateGUIDs[1], !(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)); + } + SaveToDB(); + } + else if (data == IN_PROGRESS) + { + PutricideEventProgress |= PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS; + HandleGameObject(PutricideCollisionGUID, false); + HandleGameObject(PutricideGateGUIDs[0], false); + HandleGameObject(PutricideGateGUIDs[1], false); + SaveToDB(); + } + else if (data == DONE) + { + PutricideEventProgress &= ~PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS; + PutricideEventProgress |= PUTRICIDE_EVENT_FLAG_TRAP_FINISHED; + HandleGameObject(PutricideEnteranceDoorGUID, true); + HandleGameObject(PutricideCollisionGUID, ((PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) && (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE))); + if ((PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) && (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)) + { + for (uint8 i=0; i<2; ++i) + if (GameObject* go = instance->GetGameObject(PutricideGateGUIDs[i])) + go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + } + else + { + HandleGameObject(PutricideGateGUIDs[0], !(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE)); + HandleGameObject(PutricideGateGUIDs[1], !(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)); + } + SaveToDB(); + } + return; case DATA_BONED_ACHIEVEMENT: IsBonedEligible = data ? true : false; break; @@ -1336,16 +1336,16 @@ class instance_icecrown_citadel : public InstanceMapScript SaveToDB(); break; } - case DATA_BPC_TRASH_DIED: - { - if (++BloodPrinceTrashCount >= 4) - { - SetBossState(DATA_BLOOD_PRINCE_TRASH, NOT_STARTED); - SetBossState(DATA_BLOOD_PRINCE_TRASH, DONE); - } - SaveToDB(); - break; - } + case DATA_BPC_TRASH_DIED: + { + if (++BloodPrinceTrashCount >= 4) + { + SetBossState(DATA_BLOOD_PRINCE_TRASH, NOT_STARTED); + SetBossState(DATA_BLOOD_PRINCE_TRASH, DONE); + } + SaveToDB(); + break; + } default: break; } @@ -1474,8 +1474,8 @@ class instance_icecrown_citadel : public InstanceMapScript case DATA_SINDRAGOSA: if (GetBossState(DATA_VALITHRIA_DREAMWALKER) != DONE) return false; - if (GetBossState(DATA_SINDRAGOSA_GAUNTLET) != DONE) - return false; + if (GetBossState(DATA_SINDRAGOSA_GAUNTLET) != DONE) + return false; break; default: break; @@ -1548,7 +1548,7 @@ class instance_icecrown_citadel : public InstanceMapScript std::ostringstream saveStream; saveStream << "I C " << GetBossSaveData() << HeroicAttempts << ' ' << ColdflameJetsState << ' ' << BloodQuickeningState << ' ' << BloodQuickeningMinutes << ' ' << WeeklyQuestId10 << ' ' << PutricideEventProgress << ' ' - << uint32(LichKingHeroicAvailable ? 1 : 0) << ' ' << BloodPrinceTrashCount; + << uint32(LichKingHeroicAvailable ? 1 : 0) << ' ' << BloodPrinceTrashCount; OUT_SAVE_INST_DATA_COMPLETE; return saveStream.str(); @@ -1586,20 +1586,20 @@ class instance_icecrown_citadel : public InstanceMapScript loadStream >> temp; ColdflameJetsState = temp ? DONE : NOT_STARTED; - loadStream >> BloodQuickeningState; - loadStream >> BloodQuickeningMinutes; - if (BloodQuickeningState == IN_PROGRESS) - { - Events.ScheduleEvent(EVENT_UPDATE_EXECUTION_TIME, 60000); - DoUpdateWorldState(WORLDSTATE_SHOW_TIMER, 1); - DoUpdateWorldState(WORLDSTATE_EXECUTION_TIME, BloodQuickeningMinutes); - } + loadStream >> BloodQuickeningState; + loadStream >> BloodQuickeningMinutes; + if (BloodQuickeningState == IN_PROGRESS) + { + Events.ScheduleEvent(EVENT_UPDATE_EXECUTION_TIME, 60000); + DoUpdateWorldState(WORLDSTATE_SHOW_TIMER, 1); + DoUpdateWorldState(WORLDSTATE_EXECUTION_TIME, BloodQuickeningMinutes); + } loadStream >> WeeklyQuestId10; - loadStream >> PutricideEventProgress; PutricideEventProgress &= ~PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS; - loadStream >> temp; - LichKingHeroicAvailable = temp ? true : false; - loadStream >> BloodPrinceTrashCount; + loadStream >> PutricideEventProgress; PutricideEventProgress &= ~PUTRICIDE_EVENT_FLAG_TRAP_INPROGRESS; + loadStream >> temp; + LichKingHeroicAvailable = temp ? true : false; + loadStream >> BloodPrinceTrashCount; } else OUT_LOAD_INST_DATA_FAIL; @@ -1609,41 +1609,41 @@ class instance_icecrown_citadel : public InstanceMapScript void Update(uint32 diff) { - // Xinef: A Feast of Souls (24547) whispers - if (LichKingRandomWhisperTimer <= diff) - { - LichKingRandomWhisperTimer = urand(100, 300)*IN_MILLISECONDS; - Map::PlayerList const &players = instance->GetPlayers(); + // Xinef: A Feast of Souls (24547) whispers + if (LichKingRandomWhisperTimer <= diff) + { + LichKingRandomWhisperTimer = urand(100, 300)*IN_MILLISECONDS; + Map::PlayerList const &players = instance->GetPlayers(); if (!players.isEmpty()) if (Player* player = players.begin()->GetSource()) - if (player->GetQuestStatus(QUEST_A_FEAST_OF_SOULS) == QUEST_STATUS_INCOMPLETE) - { - uint8 id = urand(0, 15); - std::string const& text = sCreatureTextMgr->GetLocalizedChatString(NPC_THE_LICH_KING_LH, 20+id, 0, LOCALE_enUS); - WorldPacket data; - ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, 0, player->GetGUID(), text, CHAT_TAG_NONE, "The Lich King"); - player->SendPlaySound(17235 + id, true); - player->SendDirectMessage(&data); - } - } - else - LichKingRandomWhisperTimer -= diff; + if (player->GetQuestStatus(QUEST_A_FEAST_OF_SOULS) == QUEST_STATUS_INCOMPLETE) + { + uint8 id = urand(0, 15); + std::string const& text = sCreatureTextMgr->GetLocalizedChatString(NPC_THE_LICH_KING_LH, 20+id, 0, LOCALE_enUS); + WorldPacket data; + ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, 0, player->GetGUID(), text, CHAT_TAG_NONE, "The Lich King"); + player->SendPlaySound(17235 + id, true); + player->SendDirectMessage(&data); + } + } + else + LichKingRandomWhisperTimer -= diff; - if (DarkwhisperElevatorTimer <= diff) - { - DarkwhisperElevatorTimer = 3000; - if (GetBossState(DATA_LADY_DEATHWHISPER) == DONE) - if (GameObject* elevator = instance->GetGameObject(LadyDeathwisperElevatorGUID)) - if (StaticTransport* trans = elevator->ToStaticTransport()) - { - if (trans->GetGoState() == GO_STATE_READY && trans->GetPathProgress() == 0) - trans->SetGoState(GO_STATE_ACTIVE); - else if (trans->GetGoState() == GO_STATE_ACTIVE && trans->GetPathProgress() == trans->GetPauseTime()) - trans->SetGoState(GO_STATE_READY); - } - } - else - DarkwhisperElevatorTimer -= diff; + if (DarkwhisperElevatorTimer <= diff) + { + DarkwhisperElevatorTimer = 3000; + if (GetBossState(DATA_LADY_DEATHWHISPER) == DONE) + if (GameObject* elevator = instance->GetGameObject(LadyDeathwisperElevatorGUID)) + if (StaticTransport* trans = elevator->ToStaticTransport()) + { + if (trans->GetGoState() == GO_STATE_READY && trans->GetPathProgress() == 0) + trans->SetGoState(GO_STATE_ACTIVE); + else if (trans->GetGoState() == GO_STATE_ACTIVE && trans->GetPathProgress() == trans->GetPauseTime()) + trans->SetGoState(GO_STATE_READY); + } + } + else + DarkwhisperElevatorTimer -= diff; if (BloodQuickeningState != IN_PROGRESS && GetBossState(DATA_THE_LICH_KING) != IN_PROGRESS && GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != FAIL) return; @@ -1710,12 +1710,12 @@ class instance_icecrown_citadel : public InstanceMapScript { case EVENT_ENEMY_GUNSHIP_DESPAWN: if (GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == DONE) - { - if (GameObject* go = source->ToGameObject()) - if (MotionTransport* transport = go->ToMotionTransport()) - transport->UnloadNonStaticPassengers(); - source->AddObjectToRemoveList(); - } + { + if (GameObject* go = source->ToGameObject()) + if (MotionTransport* transport = go->ToMotionTransport()) + transport->UnloadNonStaticPassengers(); + source->AddObjectToRemoveList(); + } break; case EVENT_ENEMY_GUNSHIP_COMBAT: if (Creature* captain = source->FindNearestCreature(TeamIdInInstance == TEAM_HORDE ? NPC_IGB_HIGH_OVERLORD_SAURFANG : NPC_IGB_MURADIN_BRONZEBEARD, 200.0f)) @@ -1730,10 +1730,10 @@ class instance_icecrown_citadel : public InstanceMapScript case EVENT_PLAYERS_GUNSHIP_SAURFANG: if (GameObject* go = source->ToGameObject()) if (MotionTransport* transport = go->ToMotionTransport()) - { - transport->setActive(false); + { + transport->setActive(false); transport->EnableMovement(false); - } + } if (Creature* captain = source->FindNearestCreature(TeamIdInInstance == TEAM_HORDE ? NPC_IGB_HIGH_OVERLORD_SAURFANG : NPC_IGB_MURADIN_BRONZEBEARD, 200.0f)) captain->AI()->DoAction(ACTION_EXIT_SHIP); break; @@ -1770,56 +1770,56 @@ class instance_icecrown_citadel : public InstanceMapScript } } break; - case EVENT_FESTERGUT_VALVE_USED: - if (!(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE)) - { - PutricideEventProgress |= PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE; + case EVENT_FESTERGUT_VALVE_USED: + if (!(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE)) + { + PutricideEventProgress |= PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE; if (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE) { HandleGameObject(PutricideCollisionGUID, true); - for (uint8 i=0; i<2; ++i) - if (GameObject* go = instance->GetGameObject(PutricideGateGUIDs[i])) - go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + for (uint8 i=0; i<2; ++i) + if (GameObject* go = instance->GetGameObject(PutricideGateGUIDs[i])) + go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); } else HandleGameObject(PutricideGateGUIDs[0], false); HandleGameObject(PutricidePipeGUIDs[0], true); - SaveToDB(); + SaveToDB(); } - break; - case EVENT_ROTFACE_VALVE_USED: - if (!(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)) - { - PutricideEventProgress |= PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE; + break; + case EVENT_ROTFACE_VALVE_USED: + if (!(PutricideEventProgress & PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE)) + { + PutricideEventProgress |= PUTRICIDE_EVENT_FLAG_ROTFACE_VALVE; if (PutricideEventProgress & PUTRICIDE_EVENT_FLAG_FESTERGUT_VALVE) { HandleGameObject(PutricideCollisionGUID, true); - for (uint8 i=0; i<2; ++i) - if (GameObject* go = instance->GetGameObject(PutricideGateGUIDs[i])) - go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + for (uint8 i=0; i<2; ++i) + if (GameObject* go = instance->GetGameObject(PutricideGateGUIDs[i])) + go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); } else HandleGameObject(PutricideGateGUIDs[1], false); HandleGameObject(PutricidePipeGUIDs[1], true); - SaveToDB(); + SaveToDB(); } - break; + break; } } protected: - // pussywizard: - bool IsBuffAvailable; - uint32 WeeklyQuestId10; // contains id from 10man for any difficulty (for simplicity) - uint64 WeeklyQuestNpcGUID[WeeklyNPCs]; - uint64 PutricideEnteranceDoorGUID; - uint32 PutricideEventProgress; - uint64 GasReleaseValveGUID; - uint64 OozeReleaseValveGUID; - bool LichKingHeroicAvailable; - uint32 LichKingRandomWhisperTimer; - uint32 DarkwhisperElevatorTimer; - uint64 ScourgeTransporterFirstGUID; + // pussywizard: + bool IsBuffAvailable; + uint32 WeeklyQuestId10; // contains id from 10man for any difficulty (for simplicity) + uint64 WeeklyQuestNpcGUID[WeeklyNPCs]; + uint64 PutricideEnteranceDoorGUID; + uint32 PutricideEventProgress; + uint64 GasReleaseValveGUID; + uint64 OozeReleaseValveGUID; + bool LichKingHeroicAvailable; + uint32 LichKingRandomWhisperTimer; + uint32 DarkwhisperElevatorTimer; + uint64 ScourgeTransporterFirstGUID; EventMap Events; uint64 LadyDeathwisperElevatorGUID; @@ -1850,8 +1850,8 @@ class instance_icecrown_citadel : public InstanceMapScript uint64 ValithriaDreamwalkerGUID; uint64 ValithriaLichKingGUID; uint64 ValithriaTriggerGUID; - uint64 PutricadeTrapGUID; - uint64 SindragosaGauntletGUID; + uint64 PutricadeTrapGUID; + uint64 SindragosaGauntletGUID; uint64 SindragosaGUID; uint64 SpinestalkerGUID; uint64 RimefangGUID; @@ -1875,7 +1875,7 @@ class instance_icecrown_citadel : public InstanceMapScript uint32 BloodQuickeningState; uint32 HeroicAttempts; uint16 BloodQuickeningMinutes; - uint32 BloodPrinceTrashCount; + uint32 BloodPrinceTrashCount; bool IsBonedEligible; bool IsOozeDanceEligible; bool IsNauseaEligible; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp index ff48ee6d7..ad34df46d 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp @@ -15,28 +15,28 @@ enum Says enum Spells { - SPELL_IMPALE_10 = 28783, - SPELL_IMPALE_25 = 56090, - SPELL_LOCUST_SWARM_10 = 28785, - SPELL_LOCUST_SWARM_25 = 54021, - SPELL_SUMMON_CORPSE_SCRABS_5 = 29105, - SPELL_SUMMON_CORPSE_SCRABS_10 = 28864, - SPELL_BERSERK = 26662, + SPELL_IMPALE_10 = 28783, + SPELL_IMPALE_25 = 56090, + SPELL_LOCUST_SWARM_10 = 28785, + SPELL_LOCUST_SWARM_25 = 54021, + SPELL_SUMMON_CORPSE_SCRABS_5 = 29105, + SPELL_SUMMON_CORPSE_SCRABS_10 = 28864, + SPELL_BERSERK = 26662, }; enum Events { - EVENT_SPELL_IMPALE = 1, - EVENT_SPELL_LOCUST_SWARM = 2, - EVENT_SPELL_BERSERK = 3, + EVENT_SPELL_IMPALE = 1, + EVENT_SPELL_LOCUST_SWARM = 2, + EVENT_SPELL_BERSERK = 3, }; enum Misc { - NPC_CORPSE_SCARAB = 16698, - NPC_CRYPT_GUARD = 16573, + NPC_CORPSE_SCARAB = 16698, + NPC_CRYPT_GUARD = 16573, - ACHIEV_TIMED_START_EVENT = 9891, + ACHIEV_TIMED_START_EVENT = 9891, }; class boss_anubrekhan : public CreatureScript @@ -49,153 +49,153 @@ public: return new boss_anubrekhanAI (pCreature); } - struct boss_anubrekhanAI : public ScriptedAI - { - boss_anubrekhanAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = c->GetInstanceScript(); - sayGreet = false; - } + struct boss_anubrekhanAI : public ScriptedAI + { + boss_anubrekhanAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = c->GetInstanceScript(); + sayGreet = false; + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - bool sayGreet; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + bool sayGreet; - void SummonCryptGuards() - { - me->SummonCreature(NPC_CRYPT_GUARD, 3308.590f, -3466.29f, 287.16f, M_PI, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); - if (IsHeroic()) - me->SummonCreature(NPC_CRYPT_GUARD, 3308.590f, -3486.29f, 287.16f, M_PI, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); - } + void SummonCryptGuards() + { + me->SummonCreature(NPC_CRYPT_GUARD, 3308.590f, -3466.29f, 287.16f, M_PI, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); + if (IsHeroic()) + me->SummonCreature(NPC_CRYPT_GUARD, 3308.590f, -3486.29f, 287.16f, M_PI, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000); + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - SummonCryptGuards(); + void Reset() + { + events.Reset(); + summons.DespawnAll(); + SummonCryptGuards(); - if (pInstance) - { - pInstance->SetData(EVENT_ANUB, NOT_STARTED); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_ANUB_GATE))) - go->SetGoState(GO_STATE_ACTIVE); - } - } + if (pInstance) + { + pInstance->SetData(EVENT_ANUB, NOT_STARTED); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_ANUB_GATE))) + go->SetGoState(GO_STATE_ACTIVE); + } + } - void JustSummoned(Creature* cr) - { - if (me->IsInCombat()) - cr->SetInCombatWithZone(); - if (cr->GetEntry() == NPC_CORPSE_SCARAB) - { - cr->SetReactState(REACT_PASSIVE); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - cr->AI()->AttackStart(target); - } + void JustSummoned(Creature* cr) + { + if (me->IsInCombat()) + cr->SetInCombatWithZone(); + if (cr->GetEntry() == NPC_CORPSE_SCARAB) + { + cr->SetReactState(REACT_PASSIVE); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + cr->AI()->AttackStart(target); + } - summons.Summon(cr); - } + summons.Summon(cr); + } - void SummonedCreatureDies(Creature* cr, Unit*) - { - if (cr->GetEntry() == NPC_CRYPT_GUARD) - cr->CastSpell(cr, SPELL_SUMMON_CORPSE_SCRABS_10, true, NULL, NULL, me->GetGUID()); - } + void SummonedCreatureDies(Creature* cr, Unit*) + { + if (cr->GetEntry() == NPC_CRYPT_GUARD) + cr->CastSpell(cr, SPELL_SUMMON_CORPSE_SCRABS_10, true, NULL, NULL, me->GetGUID()); + } - void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } + void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } - void JustDied(Unit* Killer) - { - summons.DespawnAll(); - if (pInstance) - { - pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - pInstance->SetData(EVENT_ANUB, DONE); - } - } + void JustDied(Unit* Killer) + { + summons.DespawnAll(); + if (pInstance) + { + pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + pInstance->SetData(EVENT_ANUB, DONE); + } + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; - if (!urand(0,3)) - Talk(SAY_SLAY); + if (!urand(0,3)) + Talk(SAY_SLAY); - //Force the player to spawn corpse scarabs via spell - victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCRABS_5, true, NULL, NULL, me->GetGUID()); + //Force the player to spawn corpse scarabs via spell + victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCRABS_5, true, NULL, NULL, me->GetGUID()); - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void EnterCombat(Unit *who) - { - me->CallForHelp(30.0f); // catch helpers - Talk(SAY_AGGRO); - if (pInstance) - { - pInstance->SetData(EVENT_ANUB, IN_PROGRESS); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_ANUB_GATE))) - go->SetGoState(GO_STATE_READY); - } + void EnterCombat(Unit *who) + { + me->CallForHelp(30.0f); // catch helpers + Talk(SAY_AGGRO); + if (pInstance) + { + pInstance->SetData(EVENT_ANUB, IN_PROGRESS); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_ANUB_GATE))) + go->SetGoState(GO_STATE_READY); + } - events.ScheduleEvent(EVENT_SPELL_IMPALE, 15000); - events.ScheduleEvent(EVENT_SPELL_LOCUST_SWARM, 70000+urand(0,50000)); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); - - if (!summons.HasEntry(NPC_CRYPT_GUARD)) - SummonCryptGuards(); - } + events.ScheduleEvent(EVENT_SPELL_IMPALE, 15000); + events.ScheduleEvent(EVENT_SPELL_LOCUST_SWARM, 70000+urand(0,50000)); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); + + if (!summons.HasEntry(NPC_CRYPT_GUARD)) + SummonCryptGuards(); + } - void MoveInLineOfSight(Unit *who) - { - if (!sayGreet && who->GetTypeId() == TYPEID_PLAYER) - { - Talk(SAY_GREET); - sayGreet = true; - } + void MoveInLineOfSight(Unit *who) + { + if (!sayGreet && who->GetTypeId() == TYPEID_PLAYER) + { + Talk(SAY_GREET); + sayGreet = true; + } - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_IMPALE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25), false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_LOCUST_SWARM: - me->CastSpell(me, RAID_MODE(SPELL_LOCUST_SWARM_10, SPELL_LOCUST_SWARM_25), false); - Position pos; - me->GetNearPosition(pos, 10.0f, rand_norm()*2*M_PI); - me->SummonCreature(NPC_CRYPT_GUARD, pos); - events.RepeatEvent(90000); - break; - case EVENT_SPELL_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - break; - } + switch (events.GetEvent()) + { + case EVENT_SPELL_IMPALE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25), false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_LOCUST_SWARM: + me->CastSpell(me, RAID_MODE(SPELL_LOCUST_SWARM_10, SPELL_LOCUST_SWARM_25), false); + Position pos; + me->GetNearPosition(pos, 10.0f, rand_norm()*2*M_PI); + me->SummonCreature(NPC_CRYPT_GUARD, pos); + events.RepeatEvent(90000); + break; + case EVENT_SPELL_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_anubrekhan() { - new boss_anubrekhan(); + new boss_anubrekhan(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index 40a98129e..7cd7c96a9 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -17,26 +17,26 @@ enum Yells enum Spells { - SPELL_POISON_BOLT_VOLLEY_10 = 28796, - SPELL_POISON_BOLT_VOLLEY_25 = 54098, - SPELL_RAIN_OF_FIRE_10 = 28794, - SPELL_RAIN_OF_FIRE_25 = 54099, - SPELL_FRENZY_10 = 28798, - SPELL_FRENZY_25 = 54100, - SPELL_WIDOWS_EMBRACE = 28732, + SPELL_POISON_BOLT_VOLLEY_10 = 28796, + SPELL_POISON_BOLT_VOLLEY_25 = 54098, + SPELL_RAIN_OF_FIRE_10 = 28794, + SPELL_RAIN_OF_FIRE_25 = 54099, + SPELL_FRENZY_10 = 28798, + SPELL_FRENZY_25 = 54100, + SPELL_WIDOWS_EMBRACE = 28732, }; enum Events { - EVENT_SPELL_POISON_BOLT = 1, - EVENT_SPELL_RAIN_OF_FIRE = 2, - EVENT_SPELL_FRENZY = 3, + EVENT_SPELL_POISON_BOLT = 1, + EVENT_SPELL_RAIN_OF_FIRE = 2, + EVENT_SPELL_FRENZY = 3, }; enum Misc { - NPC_NAXXRAMAS_WORSHIPPER = 16506, - NPC_NAXXRAMAS_FOLLOWER = 16505, + NPC_NAXXRAMAS_WORSHIPPER = 16506, + NPC_NAXXRAMAS_FOLLOWER = 16505, }; class boss_faerlina : public CreatureScript @@ -49,137 +49,137 @@ public: return new boss_faerlinaAI (pCreature); } - struct boss_faerlinaAI : public ScriptedAI - { - boss_faerlinaAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = me->GetInstanceScript(); - sayGreet = false; - } + struct boss_faerlinaAI : public ScriptedAI + { + boss_faerlinaAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = me->GetInstanceScript(); + sayGreet = false; + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - bool sayGreet; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + bool sayGreet; - void SummonHelpers() - { - me->SummonCreature(NPC_NAXXRAMAS_WORSHIPPER, 3362.66f, -3620.97f, 261.08f, 4.57276f); - me->SummonCreature(NPC_NAXXRAMAS_WORSHIPPER, 3344.3f, -3618.31f, 261.08f, 4.69494f); - me->SummonCreature(NPC_NAXXRAMAS_WORSHIPPER, 3356.71f, -3620.05f, 261.08f, 4.57276f); - me->SummonCreature(NPC_NAXXRAMAS_WORSHIPPER, 3350.26f, -3619.11f, 261.08f, 4.67748f); + void SummonHelpers() + { + me->SummonCreature(NPC_NAXXRAMAS_WORSHIPPER, 3362.66f, -3620.97f, 261.08f, 4.57276f); + me->SummonCreature(NPC_NAXXRAMAS_WORSHIPPER, 3344.3f, -3618.31f, 261.08f, 4.69494f); + me->SummonCreature(NPC_NAXXRAMAS_WORSHIPPER, 3356.71f, -3620.05f, 261.08f, 4.57276f); + me->SummonCreature(NPC_NAXXRAMAS_WORSHIPPER, 3350.26f, -3619.11f, 261.08f, 4.67748f); - // Followers - if (Is25ManRaid()) - { - me->SummonCreature(NPC_NAXXRAMAS_FOLLOWER, 3347.49f, -3617.59f, 261.0f, 4.49f); - me->SummonCreature(NPC_NAXXRAMAS_FOLLOWER, 3359.64f, -3619.16f, 261.0f, 4.56f); - } - } + // Followers + if (Is25ManRaid()) + { + me->SummonCreature(NPC_NAXXRAMAS_FOLLOWER, 3347.49f, -3617.59f, 261.0f, 4.49f); + me->SummonCreature(NPC_NAXXRAMAS_FOLLOWER, 3359.64f, -3619.16f, 261.0f, 4.56f); + } + } - void JustSummoned(Creature* cr) { summons.Summon(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - SummonHelpers(); - if (pInstance) - pInstance->SetData(EVENT_FAERLINA, NOT_STARTED); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + SummonHelpers(); + if (pInstance) + pInstance->SetData(EVENT_FAERLINA, NOT_STARTED); + } - void EnterCombat(Unit *who) - { - me->SetInCombatWithZone(); - Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_POISON_BOLT, urand(12000,15000)); - events.ScheduleEvent(EVENT_SPELL_RAIN_OF_FIRE, urand(6000,18000)); - events.ScheduleEvent(EVENT_SPELL_FRENZY, urand(60000,80000), 1); - events.SetPhase(1); + void EnterCombat(Unit *who) + { + me->SetInCombatWithZone(); + Talk(SAY_AGGRO); + events.ScheduleEvent(EVENT_SPELL_POISON_BOLT, urand(12000,15000)); + events.ScheduleEvent(EVENT_SPELL_RAIN_OF_FIRE, urand(6000,18000)); + events.ScheduleEvent(EVENT_SPELL_FRENZY, urand(60000,80000), 1); + events.SetPhase(1); - if (pInstance) - pInstance->SetData(EVENT_FAERLINA, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(EVENT_FAERLINA, IN_PROGRESS); + } - void MoveInLineOfSight(Unit *who) - { - if (!sayGreet && who->GetTypeId() == TYPEID_PLAYER) - { - Talk(SAY_GREET); - sayGreet = true; - } + void MoveInLineOfSight(Unit *who) + { + if (!sayGreet && who->GetTypeId() == TYPEID_PLAYER) + { + Talk(SAY_GREET); + sayGreet = true; + } - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (!urand(0,3)) - Talk(SAY_SLAY); + if (!urand(0,3)) + Talk(SAY_SLAY); - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void JustDied(Unit* Killer) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(EVENT_FAERLINA, DONE); - } + void JustDied(Unit* Killer) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(EVENT_FAERLINA, DONE); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_POISON_BOLT: - if (!me->HasAura(SPELL_WIDOWS_EMBRACE)) - me->CastCustomSpell(RAID_MODE(SPELL_POISON_BOLT_VOLLEY_10, SPELL_POISON_BOLT_VOLLEY_25), SPELLVALUE_MAX_TARGETS, 3, me, false); - events.RepeatEvent(14000); - break; - case EVENT_SPELL_RAIN_OF_FIRE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, RAID_MODE(SPELL_RAIN_OF_FIRE_10, SPELL_RAIN_OF_FIRE_25), false); - events.RepeatEvent(12000); - break; - case EVENT_SPELL_FRENZY: - me->MonsterTextEmote("%s goes into a frenzy!", 0, true); - me->CastSpell(me, RAID_MODE(SPELL_FRENZY_10, SPELL_FRENZY_25), true); - events.RepeatEvent(70000); - break; - } + switch (events.GetEvent()) + { + case EVENT_SPELL_POISON_BOLT: + if (!me->HasAura(SPELL_WIDOWS_EMBRACE)) + me->CastCustomSpell(RAID_MODE(SPELL_POISON_BOLT_VOLLEY_10, SPELL_POISON_BOLT_VOLLEY_25), SPELLVALUE_MAX_TARGETS, 3, me, false); + events.RepeatEvent(14000); + break; + case EVENT_SPELL_RAIN_OF_FIRE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, RAID_MODE(SPELL_RAIN_OF_FIRE_10, SPELL_RAIN_OF_FIRE_25), false); + events.RepeatEvent(12000); + break; + case EVENT_SPELL_FRENZY: + me->MonsterTextEmote("%s goes into a frenzy!", 0, true); + me->CastSpell(me, RAID_MODE(SPELL_FRENZY_10, SPELL_FRENZY_25), true); + events.RepeatEvent(70000); + break; + } - DoMeleeAttackIfReady(); - } - - void SpellHit(Unit* caster, const SpellInfo *spell) - { - if (spell->Id == SPELL_WIDOWS_EMBRACE) - { - me->MonsterTextEmote("%s is affected by Widow's Embrace!", 0, true); - if (me->HasAura(RAID_MODE(SPELL_FRENZY_10, SPELL_FRENZY_25))) - { - me->RemoveAurasDueToSpell(RAID_MODE(SPELL_FRENZY_10, SPELL_FRENZY_25)); - events.DelayEvents(60000, 1); - } - else - events.DelayEvents(30000, 1); + DoMeleeAttackIfReady(); + } + + void SpellHit(Unit* caster, const SpellInfo *spell) + { + if (spell->Id == SPELL_WIDOWS_EMBRACE) + { + me->MonsterTextEmote("%s is affected by Widow's Embrace!", 0, true); + if (me->HasAura(RAID_MODE(SPELL_FRENZY_10, SPELL_FRENZY_25))) + { + me->RemoveAurasDueToSpell(RAID_MODE(SPELL_FRENZY_10, SPELL_FRENZY_25)); + events.DelayEvents(60000, 1); + } + else + events.DelayEvents(30000, 1); - if (pInstance) - pInstance->SetData(DATA_FRENZY_REMOVED, 0); - } - } - }; + if (pInstance) + pInstance->SetData(DATA_FRENZY_REMOVED, 0); + } + } + }; }; void AddSC_boss_faerlina() diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index a1ae85179..b4ca9a544 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -11,59 +11,59 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_BERSERK = 26662, + SPELL_BERSERK = 26662, - // Marks - SPELL_MARK_OF_KORTHAZZ = 28832, - SPELL_MARK_OF_BLAUMEUX = 28833, - SPELL_MARK_OF_RIVENDARE = 28834, - SPELL_MARK_OF_ZELIEK = 28835, - SPELL_MARK_DAMAGE = 28836, + // Marks + SPELL_MARK_OF_KORTHAZZ = 28832, + SPELL_MARK_OF_BLAUMEUX = 28833, + SPELL_MARK_OF_RIVENDARE = 28834, + SPELL_MARK_OF_ZELIEK = 28835, + SPELL_MARK_DAMAGE = 28836, - // Korth'azz - SPELL_KORTHAZZ_METEOR_10 = 28884, - SPELL_KORTHAZZ_METEOR_25 = 57467, + // Korth'azz + SPELL_KORTHAZZ_METEOR_10 = 28884, + SPELL_KORTHAZZ_METEOR_25 = 57467, - // Blaumeux - SPELL_BLAUMEUX_SHADOW_BOLT_10 = 57374, - SPELL_BLAUMEUX_SHADOW_BOLT_25 = 57464, - SPELL_BLAUMEUX_VOID_ZONE_10 = 28863, - SPELL_BLAUMEUX_VOID_ZONE_25 = 57463, - SPELL_BLAUMEUX_UNYIELDING_PAIN = 57381, + // Blaumeux + SPELL_BLAUMEUX_SHADOW_BOLT_10 = 57374, + SPELL_BLAUMEUX_SHADOW_BOLT_25 = 57464, + SPELL_BLAUMEUX_VOID_ZONE_10 = 28863, + SPELL_BLAUMEUX_VOID_ZONE_25 = 57463, + SPELL_BLAUMEUX_UNYIELDING_PAIN = 57381, - // Zeliek - SPELL_ZELIEK_HOLY_WRATH_10 = 28883, - SPELL_ZELIEK_HOLY_WRATH_25 = 57466, - SPELL_ZELIEK_HOLY_BOLT_10 = 57376, - SPELL_ZELIEK_HOLY_BOLT_25 = 57465, - SPELL_ZELIEK_CONDEMNATION = 57377, + // Zeliek + SPELL_ZELIEK_HOLY_WRATH_10 = 28883, + SPELL_ZELIEK_HOLY_WRATH_25 = 57466, + SPELL_ZELIEK_HOLY_BOLT_10 = 57376, + SPELL_ZELIEK_HOLY_BOLT_25 = 57465, + SPELL_ZELIEK_CONDEMNATION = 57377, - // Rivendare - SPELL_RIVENDARE_UNHOLY_SHADOW_10 = 28882, - SPELL_RIVENDARE_UNHOLY_SHADOW_25 = 57369, + // Rivendare + SPELL_RIVENDARE_UNHOLY_SHADOW_10 = 28882, + SPELL_RIVENDARE_UNHOLY_SHADOW_25 = 57369, }; enum Events { - EVENT_SPELL_MARK_CAST = 1, - EVENT_SPELL_PRIMARY = 2, - EVENT_SPELL_SECONDARY = 3, - EVENT_SPELL_PUNISH = 4, - EVENT_BERSERK = 5, + EVENT_SPELL_MARK_CAST = 1, + EVENT_SPELL_PRIMARY = 2, + EVENT_SPELL_SECONDARY = 3, + EVENT_SPELL_PUNISH = 4, + EVENT_BERSERK = 5, }; enum Misc { - // Movement - MOVE_PHASE_NONE = 0, - MOVE_PHASE_STARTED = 1, - MOVE_PHASE_FINISHED = 2, + // Movement + MOVE_PHASE_NONE = 0, + MOVE_PHASE_STARTED = 1, + MOVE_PHASE_FINISHED = 2, - // Horseman - HORSEMAN_ZELIEK = 0, - HORSEMAN_BLAUMEUX = 1, - HORSEMAN_RIVENDARE = 2, - HORSEMAN_KORTHAZZ = 3, + // Horseman + HORSEMAN_ZELIEK = 0, + HORSEMAN_BLAUMEUX = 1, + HORSEMAN_RIVENDARE = 2, + HORSEMAN_KORTHAZZ = 3, }; enum FourHorsemen @@ -121,219 +121,219 @@ public: return new boss_four_horsemenAI (pCreature); } - struct boss_four_horsemenAI : public ScriptedAI - { - boss_four_horsemenAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceScript(); - switch (me->GetEntry()) - { - case NPC_SIR_ZELIEK: - horsemanId = HORSEMAN_ZELIEK; - break; - case NPC_LADY_BLAUMEUX: - horsemanId = HORSEMAN_BLAUMEUX; - break; - case NPC_BARON_RIVENDARE: - horsemanId = HORSEMAN_RIVENDARE; - break; - case NPC_THANE_KORTHAZZ: - horsemanId = HORSEMAN_KORTHAZZ; - break; - } - } + struct boss_four_horsemenAI : public ScriptedAI + { + boss_four_horsemenAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + switch (me->GetEntry()) + { + case NPC_SIR_ZELIEK: + horsemanId = HORSEMAN_ZELIEK; + break; + case NPC_LADY_BLAUMEUX: + horsemanId = HORSEMAN_BLAUMEUX; + break; + case NPC_BARON_RIVENDARE: + horsemanId = HORSEMAN_RIVENDARE; + break; + case NPC_THANE_KORTHAZZ: + horsemanId = HORSEMAN_KORTHAZZ; + break; + } + } - EventMap events; - InstanceScript* pInstance; - uint8 currentWaypoint; - uint8 movementPhase; - uint8 horsemanId; + EventMap events; + InstanceScript* pInstance; + uint8 currentWaypoint; + uint8 movementPhase; + uint8 horsemanId; - void MoveToCorner() - { - switch(me->GetEntry()) - { - case NPC_THANE_KORTHAZZ: currentWaypoint = 0; break; - case NPC_LADY_BLAUMEUX: currentWaypoint = 3; break; - case NPC_BARON_RIVENDARE: currentWaypoint = 6; break; - case NPC_SIR_ZELIEK: currentWaypoint = 9; break; - } - me->GetMotionMaster()->MovePoint(currentWaypoint, WaypointPositions[currentWaypoint]); - } + void MoveToCorner() + { + switch(me->GetEntry()) + { + case NPC_THANE_KORTHAZZ: currentWaypoint = 0; break; + case NPC_LADY_BLAUMEUX: currentWaypoint = 3; break; + case NPC_BARON_RIVENDARE: currentWaypoint = 6; break; + case NPC_SIR_ZELIEK: currentWaypoint = 9; break; + } + me->GetMotionMaster()->MovePoint(currentWaypoint, WaypointPositions[currentWaypoint]); + } - bool IsInRoom() - { - if (me->GetExactDist(2535.1f, -2968.7f, 241.3f) > 100.0f) - { - EnterEvadeMode(); - return false; - } + bool IsInRoom() + { + if (me->GetExactDist(2535.1f, -2968.7f, 241.3f) > 100.0f) + { + EnterEvadeMode(); + return false; + } - return true; - } + return true; + } - void Reset() - { - me->SetPosition(me->GetHomePosition()); - movementPhase = MOVE_PHASE_NONE; - currentWaypoint = 0; - me->SetReactState(REACT_AGGRESSIVE); - events.Reset(); + void Reset() + { + me->SetPosition(me->GetHomePosition()); + movementPhase = MOVE_PHASE_NONE; + currentWaypoint = 0; + me->SetReactState(REACT_AGGRESSIVE); + events.Reset(); - if (pInstance) - pInstance->SetData(EVENT_HORSEMAN, NOT_STARTED); + if (pInstance) + pInstance->SetData(EVENT_HORSEMAN, NOT_STARTED); - // Schedule Events - events.RescheduleEvent(EVENT_SPELL_MARK_CAST, 24000); - events.RescheduleEvent(EVENT_BERSERK, 100*15000); + // Schedule Events + events.RescheduleEvent(EVENT_SPELL_MARK_CAST, 24000); + events.RescheduleEvent(EVENT_BERSERK, 100*15000); - if ((me->GetEntry() != NPC_LADY_BLAUMEUX && me->GetEntry() != NPC_SIR_ZELIEK)) - events.RescheduleEvent(EVENT_SPELL_PRIMARY, 10000+rand()%5000); - else - { - events.RescheduleEvent(EVENT_SPELL_PUNISH, 5000); - events.RescheduleEvent(EVENT_SPELL_SECONDARY, 15000); - } - } + if ((me->GetEntry() != NPC_LADY_BLAUMEUX && me->GetEntry() != NPC_SIR_ZELIEK)) + events.RescheduleEvent(EVENT_SPELL_PRIMARY, 10000+rand()%5000); + else + { + events.RescheduleEvent(EVENT_SPELL_PUNISH, 5000); + events.RescheduleEvent(EVENT_SPELL_SECONDARY, 15000); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; - // final waypoint - if (id % 3 == 2) - { - movementPhase = MOVE_PHASE_FINISHED; - me->SetReactState(REACT_AGGRESSIVE); + // final waypoint + if (id % 3 == 2) + { + movementPhase = MOVE_PHASE_FINISHED; + me->SetReactState(REACT_AGGRESSIVE); - me->SetInCombatWithZone(); - if (!UpdateVictim()) - { - EnterEvadeMode(); - return; - } + me->SetInCombatWithZone(); + if (!UpdateVictim()) + { + EnterEvadeMode(); + return; + } - if (me->GetEntry() == NPC_LADY_BLAUMEUX || me->GetEntry() == NPC_SIR_ZELIEK) - { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - } - return; - } + if (me->GetEntry() == NPC_LADY_BLAUMEUX || me->GetEntry() == NPC_SIR_ZELIEK) + { + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + } + return; + } - currentWaypoint = id+1; - } + currentWaypoint = id+1; + } - void AttackStart(Unit* who) - { - if (movementPhase == MOVE_PHASE_FINISHED) - { - if (me->GetEntry() == NPC_LADY_BLAUMEUX || me->GetEntry() == NPC_SIR_ZELIEK) - me->Attack(who, false); - else - ScriptedAI::AttackStart(who); - } - } + void AttackStart(Unit* who) + { + if (movementPhase == MOVE_PHASE_FINISHED) + { + if (me->GetEntry() == NPC_LADY_BLAUMEUX || me->GetEntry() == NPC_SIR_ZELIEK) + me->Attack(who, false); + else + ScriptedAI::AttackStart(who); + } + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (!urand(0,4)) - Talk(SAY_SLAY); + if (!urand(0,4)) + Talk(SAY_SLAY); - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void JustDied(Unit* killer) - { - if (pInstance) - { - pInstance->SetData(EVENT_HORSEMAN, DONE); - if (pInstance->GetData(EVENT_HORSEMAN) == DONE) - if (!me->GetMap()->GetPlayers().isEmpty()) - if (Player* player = me->GetMap()->GetPlayers().getFirst()->GetSource()) - player->SummonGameObject(RAID_MODE(GO_HORSEMEN_CHEST_10, GO_HORSEMEN_CHEST_25), 2514.8f, -2944.9f, 245.55f, 5.51f, 0, 0, 0, 0, 0); - } + void JustDied(Unit* killer) + { + if (pInstance) + { + pInstance->SetData(EVENT_HORSEMAN, DONE); + if (pInstance->GetData(EVENT_HORSEMAN) == DONE) + if (!me->GetMap()->GetPlayers().isEmpty()) + if (Player* player = me->GetMap()->GetPlayers().getFirst()->GetSource()) + player->SummonGameObject(RAID_MODE(GO_HORSEMEN_CHEST_10, GO_HORSEMEN_CHEST_25), 2514.8f, -2944.9f, 245.55f, 5.51f, 0, 0, 0, 0, 0); + } - Talk(SAY_DEATH); - } + Talk(SAY_DEATH); + } - void EnterCombat(Unit *who) - { - if (pInstance) - pInstance->SetData(EVENT_HORSEMAN, IN_PROGRESS); + void EnterCombat(Unit *who) + { + if (pInstance) + pInstance->SetData(EVENT_HORSEMAN, IN_PROGRESS); - if (movementPhase == MOVE_PHASE_NONE) - { - Talk(SAY_AGGRO); + if (movementPhase == MOVE_PHASE_NONE) + { + Talk(SAY_AGGRO); - me->SetReactState(REACT_PASSIVE); - movementPhase = MOVE_PHASE_STARTED; - me->SetSpeed(MOVE_RUN, me->GetSpeedRate(MOVE_RUN), true); - MoveToCorner(); - } - } + me->SetReactState(REACT_PASSIVE); + movementPhase = MOVE_PHASE_STARTED; + me->SetSpeed(MOVE_RUN, me->GetSpeedRate(MOVE_RUN), true); + MoveToCorner(); + } + } - void UpdateAI(uint32 diff) - { - if (movementPhase == MOVE_PHASE_STARTED && currentWaypoint) - { - me->GetMotionMaster()->MovePoint(currentWaypoint, WaypointPositions[currentWaypoint]); - currentWaypoint = 0; - } + void UpdateAI(uint32 diff) + { + if (movementPhase == MOVE_PHASE_STARTED && currentWaypoint) + { + me->GetMotionMaster()->MovePoint(currentWaypoint, WaypointPositions[currentWaypoint]); + currentWaypoint = 0; + } - if (!IsInRoom()) - return; + if (!IsInRoom()) + return; - if (movementPhase < MOVE_PHASE_FINISHED || !UpdateVictim()) - return; - - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (movementPhase < MOVE_PHASE_FINISHED || !UpdateVictim()) + return; + + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_MARK_CAST: - me->CastSpell(me, TABLE_SPELL_MARK[horsemanId], false); - events.RepeatEvent((me->GetEntry() == NPC_LADY_BLAUMEUX || me->GetEntry() == NPC_SIR_ZELIEK) ? 15000 : 12000); - return; - case EVENT_BERSERK: - Talk(SAY_SPECIAL); - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - return; - case EVENT_SPELL_PRIMARY: - if (!urand(0,10)) - Talk(SAY_TAUNT); + switch (events.GetEvent()) + { + case EVENT_SPELL_MARK_CAST: + me->CastSpell(me, TABLE_SPELL_MARK[horsemanId], false); + events.RepeatEvent((me->GetEntry() == NPC_LADY_BLAUMEUX || me->GetEntry() == NPC_SIR_ZELIEK) ? 15000 : 12000); + return; + case EVENT_BERSERK: + Talk(SAY_SPECIAL); + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + return; + case EVENT_SPELL_PRIMARY: + if (!urand(0,10)) + Talk(SAY_TAUNT); - me->CastSpell(me->GetVictim(), RAID_MODE(TABLE_SPELL_PRIMARY_10[horsemanId], TABLE_SPELL_PRIMARY_25[horsemanId]), false); - events.RepeatEvent(15000); - return; - case EVENT_SPELL_PUNISH: - if (!SelectTarget(SELECT_TARGET_NEAREST, 0, 45.0f, true)) - me->CastSpell(me, TABLE_SPELL_PUNISH[horsemanId], false); - events.RepeatEvent(3000); - return; - case EVENT_SPELL_SECONDARY: - me->CastSpell(me->GetVictim(), RAID_MODE(TABLE_SPELL_SECONDARY_10[horsemanId], TABLE_SPELL_SECONDARY_25[horsemanId]), false); - events.RepeatEvent(15000); - return; - } + me->CastSpell(me->GetVictim(), RAID_MODE(TABLE_SPELL_PRIMARY_10[horsemanId], TABLE_SPELL_PRIMARY_25[horsemanId]), false); + events.RepeatEvent(15000); + return; + case EVENT_SPELL_PUNISH: + if (!SelectTarget(SELECT_TARGET_NEAREST, 0, 45.0f, true)) + me->CastSpell(me, TABLE_SPELL_PUNISH[horsemanId], false); + events.RepeatEvent(3000); + return; + case EVENT_SPELL_SECONDARY: + me->CastSpell(me->GetVictim(), RAID_MODE(TABLE_SPELL_SECONDARY_10[horsemanId], TABLE_SPELL_SECONDARY_25[horsemanId]), false); + events.RepeatEvent(15000); + return; + } - if ((me->GetEntry() == NPC_LADY_BLAUMEUX || me->GetEntry() == NPC_SIR_ZELIEK)) - { - if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 45.0f, true)) - me->CastSpell(target, RAID_MODE(TABLE_SPELL_PRIMARY_10[horsemanId], TABLE_SPELL_PRIMARY_25[horsemanId]), false); - } - else - DoMeleeAttackIfReady(); - } - }; + if ((me->GetEntry() == NPC_LADY_BLAUMEUX || me->GetEntry() == NPC_SIR_ZELIEK)) + { + if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 45.0f, true)) + me->CastSpell(target, RAID_MODE(TABLE_SPELL_PRIMARY_10[horsemanId], TABLE_SPELL_PRIMARY_25[horsemanId]), false); + } + else + DoMeleeAttackIfReady(); + } + }; }; class spell_four_horsemen_mark : public SpellScriptLoader @@ -394,5 +394,5 @@ class spell_four_horsemen_mark : public SpellScriptLoader void AddSC_boss_four_horsemen() { new boss_four_horsemen(); - new spell_four_horsemen_mark(); + new spell_four_horsemen_mark(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index 674435db1..c8b7b8000 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -10,29 +10,29 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_MORTAL_WOUND = 25646, - SPELL_ENRAGE_10 = 28371, - SPELL_ENRAGE_25 = 54427, - SPELL_DECIMATE_10 = 28374, - SPELL_DECIMATE_25 = 54426, - SPELL_BERSERK = 26662, - SPELL_INFECTED_WOUND = 29306, - SPELL_CHOW_SEARCHER = 28404, + SPELL_MORTAL_WOUND = 25646, + SPELL_ENRAGE_10 = 28371, + SPELL_ENRAGE_25 = 54427, + SPELL_DECIMATE_10 = 28374, + SPELL_DECIMATE_25 = 54426, + SPELL_BERSERK = 26662, + SPELL_INFECTED_WOUND = 29306, + SPELL_CHOW_SEARCHER = 28404, }; enum Events { - EVENT_SPELL_MORTAL_WOUND = 1, - EVENT_SPELL_ENRAGE = 2, - EVENT_SPELL_DECIMATE = 3, - EVENT_SPELL_BERSERK = 4, - EVENT_SUMMON_ZOMBIE = 5, - EVENT_CAN_EAT_ZOMBIE = 6, + EVENT_SPELL_MORTAL_WOUND = 1, + EVENT_SPELL_ENRAGE = 2, + EVENT_SPELL_DECIMATE = 3, + EVENT_SPELL_BERSERK = 4, + EVENT_SUMMON_ZOMBIE = 5, + EVENT_CAN_EAT_ZOMBIE = 6, }; enum Misc { - NPC_ZOMBIE_CHOW = 16360, + NPC_ZOMBIE_CHOW = 16360, }; const Position zombiePos[3] = @@ -52,157 +52,157 @@ public: return new boss_gluthAI (pCreature); } - struct boss_gluthAI : public ScriptedAI - { - boss_gluthAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = me->GetInstanceScript(); - } + struct boss_gluthAI : public ScriptedAI + { + boss_gluthAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = me->GetInstanceScript(); + } - EventMap events; - SummonList summons; - InstanceScript* pInstance; - uint64 gazeTarget; - - void Reset() - { - me->ApplySpellImmune(29306, IMMUNITY_ID, 29306, true); - events.Reset(); - summons.DespawnAll(); - gazeTarget = 0; - me->SetReactState(REACT_AGGRESSIVE); + EventMap events; + SummonList summons; + InstanceScript* pInstance; + uint64 gazeTarget; + + void Reset() + { + me->ApplySpellImmune(29306, IMMUNITY_ID, 29306, true); + events.Reset(); + summons.DespawnAll(); + gazeTarget = 0; + me->SetReactState(REACT_AGGRESSIVE); - if (pInstance) - pInstance->SetData(EVENT_GLUTH, NOT_STARTED); - } + if (pInstance) + pInstance->SetData(EVENT_GLUTH, NOT_STARTED); + } - void MoveInLineOfSight(Unit *who) - { - if ((!me->GetVictim() || me->GetVictim()->GetEntry() != NPC_ZOMBIE_CHOW) && who->GetEntry() == NPC_ZOMBIE_CHOW && me->IsWithinDistInMap(who, 15)) - { - SetGazeOn(who); - me->MonsterTextEmote("%s spots a nearby zombie to devour!", 0, false); - } - else - ScriptedAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit *who) + { + if ((!me->GetVictim() || me->GetVictim()->GetEntry() != NPC_ZOMBIE_CHOW) && who->GetEntry() == NPC_ZOMBIE_CHOW && me->IsWithinDistInMap(who, 15)) + { + SetGazeOn(who); + me->MonsterTextEmote("%s spots a nearby zombie to devour!", 0, false); + } + else + ScriptedAI::MoveInLineOfSight(who); + } - void EnterCombat(Unit *who) - { - me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_SPELL_MORTAL_WOUND, 10000); - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 30000); - events.ScheduleEvent(EVENT_SPELL_DECIMATE, 105000); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 8*60000); - events.ScheduleEvent(EVENT_SUMMON_ZOMBIE, 10000); - events.ScheduleEvent(EVENT_CAN_EAT_ZOMBIE, 1000); + void EnterCombat(Unit *who) + { + me->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_SPELL_MORTAL_WOUND, 10000); + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 30000); + events.ScheduleEvent(EVENT_SPELL_DECIMATE, 105000); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 8*60000); + events.ScheduleEvent(EVENT_SUMMON_ZOMBIE, 10000); + events.ScheduleEvent(EVENT_CAN_EAT_ZOMBIE, 1000); - if (pInstance) - pInstance->SetData(EVENT_GLUTH, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(EVENT_GLUTH, IN_PROGRESS); + } - void JustSummoned(Creature *summon) - { - if (summon->GetEntry() == NPC_ZOMBIE_CHOW) - summon->AI()->AttackStart(me); + void JustSummoned(Creature *summon) + { + if (summon->GetEntry() == NPC_ZOMBIE_CHOW) + summon->AI()->AttackStart(me); - summons.Summon(summon); - } + summons.Summon(summon); + } - void SummonedCreatureDies(Creature* cr, Unit*) { summons.Despawn(cr); } + void SummonedCreatureDies(Creature* cr, Unit*) { summons.Despawn(cr); } - void KilledUnit(Unit* who) - { - if (me->IsAlive() && who->GetEntry() == NPC_ZOMBIE_CHOW) - me->ModifyHealth(int32(me->GetMaxHealth()*0.05f)); + void KilledUnit(Unit* who) + { + if (me->IsAlive() && who->GetEntry() == NPC_ZOMBIE_CHOW) + me->ModifyHealth(int32(me->GetMaxHealth()*0.05f)); - if (who->GetTypeId() == TYPEID_PLAYER && pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (who->GetTypeId() == TYPEID_PLAYER && pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void JustDied(Unit*) - { - summons.DespawnAll(); - if (pInstance) - pInstance->SetData(EVENT_GLUTH, DONE); - } + void JustDied(Unit*) + { + summons.DespawnAll(); + if (pInstance) + pInstance->SetData(EVENT_GLUTH, DONE); + } - bool SelectPlayerInRoom() - { - if (me->IsInCombat()) - return false; + bool SelectPlayerInRoom() + { + if (me->IsInCombat()) + return false; - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - Player* player = itr->GetSource(); - if (!player || !player->IsAlive()) - continue; - if (player->GetPositionZ() > 300.0f || me->GetExactDist(player) > 50.0f) - continue; + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + Player* player = itr->GetSource(); + if (!player || !player->IsAlive()) + continue; + if (player->GetPositionZ() > 300.0f || me->GetExactDist(player) > 50.0f) + continue; - AttackStart(player); - return true; - } + AttackStart(player); + return true; + } - return false; - } + return false; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictimWithGaze() && !SelectPlayerInRoom()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictimWithGaze() && !SelectPlayerInRoom()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - break; - case EVENT_SPELL_ENRAGE: - me->MonsterTextEmote("Gluth becomes enraged!", 0, true); - me->CastSpell(me, RAID_MODE(SPELL_ENRAGE_10, SPELL_ENRAGE_25), true); - events.RepeatEvent(30000); - break; - case EVENT_SPELL_MORTAL_WOUND: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); - events.RepeatEvent(10000); - break; - case EVENT_SPELL_DECIMATE: - me->MonsterTextEmote("Gluth decimates all nearby flesh!", 0, true); - me->CastSpell(me, RAID_MODE(SPELL_DECIMATE_10, SPELL_DECIMATE_25), false); - events.RepeatEvent(105000); - break; - case EVENT_SUMMON_ZOMBIE: - { - uint8 rand = urand(0,2); - for (int32 i = 0; i < RAID_MODE(1,2); ++i) - { - me->SummonCreature(NPC_ZOMBIE_CHOW, zombiePos[urand(0,2)]); - (rand == 2 ? rand = 0 : rand++); - } + switch (events.GetEvent()) + { + case EVENT_SPELL_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + break; + case EVENT_SPELL_ENRAGE: + me->MonsterTextEmote("Gluth becomes enraged!", 0, true); + me->CastSpell(me, RAID_MODE(SPELL_ENRAGE_10, SPELL_ENRAGE_25), true); + events.RepeatEvent(30000); + break; + case EVENT_SPELL_MORTAL_WOUND: + me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); + events.RepeatEvent(10000); + break; + case EVENT_SPELL_DECIMATE: + me->MonsterTextEmote("Gluth decimates all nearby flesh!", 0, true); + me->CastSpell(me, RAID_MODE(SPELL_DECIMATE_10, SPELL_DECIMATE_25), false); + events.RepeatEvent(105000); + break; + case EVENT_SUMMON_ZOMBIE: + { + uint8 rand = urand(0,2); + for (int32 i = 0; i < RAID_MODE(1,2); ++i) + { + me->SummonCreature(NPC_ZOMBIE_CHOW, zombiePos[urand(0,2)]); + (rand == 2 ? rand = 0 : rand++); + } - events.RepeatEvent(10000); - break; - } - case EVENT_CAN_EAT_ZOMBIE: - events.RepeatEvent(1000); - if (me->GetVictim()->GetEntry() == NPC_ZOMBIE_CHOW && me->IsWithinMeleeRange(me->GetVictim())) - { - me->CastCustomSpell(SPELL_CHOW_SEARCHER, SPELLVALUE_RADIUS_MOD, 20000, me, true); - me->MonsterTextEmote("%s devour all nearby zombies!", 0, false); - return; // leave it to skip DoMeleeAttackIfReady - } - break; - } + events.RepeatEvent(10000); + break; + } + case EVENT_CAN_EAT_ZOMBIE: + events.RepeatEvent(1000); + if (me->GetVictim()->GetEntry() == NPC_ZOMBIE_CHOW && me->IsWithinMeleeRange(me->GetVictim())) + { + me->CastCustomSpell(SPELL_CHOW_SEARCHER, SPELLVALUE_RADIUS_MOD, 20000, me, true); + me->MonsterTextEmote("%s devour all nearby zombies!", 0, false); + return; // leave it to skip DoMeleeAttackIfReady + } + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_gluth_decimate : public SpellScriptLoader @@ -218,18 +218,18 @@ class spell_gluth_decimate : public SpellScriptLoader { if (Unit* unitTarget = GetHitUnit()) { - int32 damage = int32(unitTarget->GetHealth()) - int32(unitTarget->CountPctFromMaxHealth(5)); - if (damage <= 0) - return; + int32 damage = int32(unitTarget->GetHealth()) - int32(unitTarget->CountPctFromMaxHealth(5)); + if (damage <= 0) + return; - if (Creature* cTarget = unitTarget->ToCreature()) - { - cTarget->SetWalk(true); - cTarget->GetMotionMaster()->MoveFollow(GetCaster(), 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); - cTarget->SetReactState(REACT_PASSIVE); - Unit::DealDamage(GetCaster(), cTarget, damage); - return; - } + if (Creature* cTarget = unitTarget->ToCreature()) + { + cTarget->SetWalk(true); + cTarget->GetMotionMaster()->MoveFollow(GetCaster(), 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); + cTarget->SetReactState(REACT_PASSIVE); + Unit::DealDamage(GetCaster(), cTarget, damage); + return; + } GetCaster()->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, unitTarget); } @@ -237,7 +237,7 @@ class spell_gluth_decimate : public SpellScriptLoader void Register() { - OnEffectHitTarget += SpellEffectFn(spell_gluth_decimate_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_gluth_decimate_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -250,6 +250,6 @@ class spell_gluth_decimate : public SpellScriptLoader void AddSC_boss_gluth() { new boss_gluth(); - new spell_gluth_decimate(); + new spell_gluth_decimate(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index c62387bab..5b196f913 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -19,67 +19,67 @@ enum Yells enum Spells { - SPELL_HARVEST_SOUL = 28679, - SPELL_SHADOW_BOLT_10 = 29317, - SPELL_SHADOW_BOLT_25 = 56405, - SPELL_INFORM_LIVING_TRAINEE = 27892, - SPELL_INFORM_LIVING_KNIGHT = 27928, - SPELL_INFORM_LIVING_RIDER = 27935, - SPELL_INFORM_DEAD_TRAINEE = 27915, - SPELL_INFORM_DEAD_KNIGHT = 27931, - SPELL_INFORM_DEAD_RIDER = 27937, + SPELL_HARVEST_SOUL = 28679, + SPELL_SHADOW_BOLT_10 = 29317, + SPELL_SHADOW_BOLT_25 = 56405, + SPELL_INFORM_LIVING_TRAINEE = 27892, + SPELL_INFORM_LIVING_KNIGHT = 27928, + SPELL_INFORM_LIVING_RIDER = 27935, + SPELL_INFORM_DEAD_TRAINEE = 27915, + SPELL_INFORM_DEAD_KNIGHT = 27931, + SPELL_INFORM_DEAD_RIDER = 27937, - SPELL_SHADOW_MARK = 27825 + SPELL_SHADOW_MARK = 27825 }; enum Misc { - NPC_LIVING_TRAINEE = 16124, - NPC_LIVING_KNIGHT = 16125, - NPC_LIVING_RIDER = 16126, - NPC_DEAD_TRAINEE = 16127, - NPC_DEAD_KNIGHT = 16148, - NPC_DEAD_HORSE = 16149, - NPC_DEAD_RIDER = 16150, + NPC_LIVING_TRAINEE = 16124, + NPC_LIVING_KNIGHT = 16125, + NPC_LIVING_RIDER = 16126, + NPC_DEAD_TRAINEE = 16127, + NPC_DEAD_KNIGHT = 16148, + NPC_DEAD_HORSE = 16149, + NPC_DEAD_RIDER = 16150, - ACTION_GATE_OPEN = 1, + ACTION_GATE_OPEN = 1, }; enum Events { - EVENT_SUMMON_ADDS = 1, - EVENT_SPELL_HARVEST_SOUL = 2, - EVENT_SPELL_SHADOW_BOLT = 3, - EVENT_TELEPORT = 4, - EVENT_CHECK_HEALTH = 5, - EVENT_CHECK_PLAYERS = 6, + EVENT_SUMMON_ADDS = 1, + EVENT_SPELL_HARVEST_SOUL = 2, + EVENT_SPELL_SHADOW_BOLT = 3, + EVENT_TELEPORT = 4, + EVENT_CHECK_HEALTH = 5, + EVENT_CHECK_PLAYERS = 6, }; const uint32 gothikWaves[24][2] = { - {NPC_LIVING_TRAINEE, 20000}, - {NPC_LIVING_TRAINEE, 20000}, - {NPC_LIVING_TRAINEE, 10000}, - {NPC_LIVING_KNIGHT, 10000}, - {NPC_LIVING_TRAINEE, 15000}, - {NPC_LIVING_KNIGHT, 10000}, - {NPC_LIVING_TRAINEE, 15000}, - {NPC_LIVING_TRAINEE, 0}, - {NPC_LIVING_KNIGHT, 10000}, - {NPC_LIVING_RIDER, 10000}, - {NPC_LIVING_TRAINEE, 5000}, - {NPC_LIVING_KNIGHT, 15000}, - {NPC_LIVING_RIDER, 0}, - {NPC_LIVING_TRAINEE, 10000}, - {NPC_LIVING_KNIGHT, 10000}, - {NPC_LIVING_TRAINEE, 10000}, - {NPC_LIVING_RIDER, 5000}, - {NPC_LIVING_KNIGHT, 5000}, - {NPC_LIVING_TRAINEE, 20000}, - {NPC_LIVING_RIDER, 0}, - {NPC_LIVING_KNIGHT, 0}, - {NPC_LIVING_TRAINEE, 15000}, - {NPC_LIVING_TRAINEE, 29000}, + {NPC_LIVING_TRAINEE, 20000}, + {NPC_LIVING_TRAINEE, 20000}, + {NPC_LIVING_TRAINEE, 10000}, + {NPC_LIVING_KNIGHT, 10000}, + {NPC_LIVING_TRAINEE, 15000}, + {NPC_LIVING_KNIGHT, 10000}, + {NPC_LIVING_TRAINEE, 15000}, + {NPC_LIVING_TRAINEE, 0}, + {NPC_LIVING_KNIGHT, 10000}, + {NPC_LIVING_RIDER, 10000}, + {NPC_LIVING_TRAINEE, 5000}, + {NPC_LIVING_KNIGHT, 15000}, + {NPC_LIVING_RIDER, 0}, + {NPC_LIVING_TRAINEE, 10000}, + {NPC_LIVING_KNIGHT, 10000}, + {NPC_LIVING_TRAINEE, 10000}, + {NPC_LIVING_RIDER, 5000}, + {NPC_LIVING_KNIGHT, 5000}, + {NPC_LIVING_TRAINEE, 20000}, + {NPC_LIVING_RIDER, 0}, + {NPC_LIVING_KNIGHT, 0}, + {NPC_LIVING_TRAINEE, 15000}, + {NPC_LIVING_TRAINEE, 29000}, {0, 0} }; @@ -119,9 +119,9 @@ struct NotOnSameSide : public std::unary_function bool m_inLiveSide; NotOnSameSide(Unit *pSource) : m_inLiveSide(IN_LIVE_SIDE(pSource)) {} - bool operator() (const Unit *pTarget) - { - return (m_inLiveSide != IN_LIVE_SIDE(pTarget)); + bool operator() (const Unit *pTarget) + { + return (m_inLiveSide != IN_LIVE_SIDE(pTarget)); } }; @@ -135,281 +135,281 @@ public: return new boss_gothikAI (pCreature); } - struct boss_gothikAI : public ScriptedAI - { - boss_gothikAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = me->GetInstanceScript(); - } + struct boss_gothikAI : public ScriptedAI + { + boss_gothikAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = me->GetInstanceScript(); + } - EventMap events; - SummonList summons; - InstanceScript* pInstance; - bool secondPhase; - bool gateOpened; - uint8 waveCount; + EventMap events; + SummonList summons; + InstanceScript* pInstance; + bool secondPhase; + bool gateOpened; + uint8 waveCount; - bool IsInRoom() - { - if (me->GetPositionX() > 2767 || me->GetPositionX() < 2618 || me->GetPositionY() > -3285 || me->GetPositionY() < -3435) - { - EnterEvadeMode(); - return false; - } + bool IsInRoom() + { + if (me->GetPositionX() > 2767 || me->GetPositionX() < 2618 || me->GetPositionY() > -3285 || me->GetPositionY() < -3435) + { + EnterEvadeMode(); + return false; + } - return true; - } + return true; + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_DISABLE_MOVE); - me->SetReactState(REACT_PASSIVE); - secondPhase = false; - gateOpened = false; - waveCount = 0; + void Reset() + { + events.Reset(); + summons.DespawnAll(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_DISABLE_MOVE); + me->SetReactState(REACT_PASSIVE); + secondPhase = false; + gateOpened = false; + waveCount = 0; - if (pInstance) - { - pInstance->SetData(EVENT_GOTHIK, NOT_STARTED); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_ENTER_GATE))) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_INNER_GATE))) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_EXIT_GATE))) - go->SetGoState(GO_STATE_READY); - } - } + if (pInstance) + { + pInstance->SetData(EVENT_GOTHIK, NOT_STARTED); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_ENTER_GATE))) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_INNER_GATE))) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_EXIT_GATE))) + go->SetGoState(GO_STATE_READY); + } + } - void EnterCombat(Unit *who) - { - me->SetInCombatWithZone(); - Talk(SAY_SPEECH); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); - me->NearTeleportTo(PosPlatform.GetPositionX(), PosPlatform.GetPositionY(), PosPlatform.GetPositionZ(), PosPlatform.GetOrientation()); - - events.ScheduleEvent(EVENT_SUMMON_ADDS, 30000); - events.ScheduleEvent(EVENT_CHECK_PLAYERS, 120000); - - if (pInstance) - { - pInstance->SetData(EVENT_GOTHIK, IN_PROGRESS); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_ENTER_GATE))) - go->SetGoState(GO_STATE_READY); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_INNER_GATE))) - go->SetGoState(GO_STATE_READY); - } - } + void EnterCombat(Unit *who) + { + me->SetInCombatWithZone(); + Talk(SAY_SPEECH); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); + me->NearTeleportTo(PosPlatform.GetPositionX(), PosPlatform.GetPositionY(), PosPlatform.GetPositionZ(), PosPlatform.GetOrientation()); + + events.ScheduleEvent(EVENT_SUMMON_ADDS, 30000); + events.ScheduleEvent(EVENT_CHECK_PLAYERS, 120000); + + if (pInstance) + { + pInstance->SetData(EVENT_GOTHIK, IN_PROGRESS); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_ENTER_GATE))) + go->SetGoState(GO_STATE_READY); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_INNER_GATE))) + go->SetGoState(GO_STATE_READY); + } + } - void JustSummoned(Creature *summon) - { - if (gateOpened) - summon->AI()->DoAction(ACTION_GATE_OPEN); - - summons.Summon(summon); - summon->SetInCombatWithZone(); - } + void JustSummoned(Creature *summon) + { + if (gateOpened) + summon->AI()->DoAction(ACTION_GATE_OPEN); + + summons.Summon(summon); + summon->SetInCombatWithZone(); + } - void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } + void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (!urand(0,3)) - Talk(SAY_KILL); + if (!urand(0,3)) + Talk(SAY_KILL); - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void JustDied(Unit* Killer) - { - Talk(SAY_DEATH); - summons.DespawnAll(); + void JustDied(Unit* Killer) + { + Talk(SAY_DEATH); + summons.DespawnAll(); - if (pInstance) - { - pInstance->SetData(EVENT_GOTHIK, DONE); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_ENTER_GATE))) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_INNER_GATE))) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_EXIT_GATE))) - go->SetGoState(GO_STATE_ACTIVE); - } - } + if (pInstance) + { + pInstance->SetData(EVENT_GOTHIK, DONE); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_ENTER_GATE))) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_INNER_GATE))) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_EXIT_GATE))) + go->SetGoState(GO_STATE_ACTIVE); + } + } - void SummonHelpers(uint32 entry) - { - switch(entry) - { - case NPC_LIVING_TRAINEE: - me->SummonCreature(NPC_LIVING_TRAINEE, PosSummonLiving[0].GetPositionX(), PosSummonLiving[0].GetPositionY(), PosSummonLiving[0].GetPositionZ(), PosSummonLiving[0].GetOrientation()); - me->SummonCreature(NPC_LIVING_TRAINEE, PosSummonLiving[1].GetPositionX(), PosSummonLiving[1].GetPositionY(), PosSummonLiving[1].GetPositionZ(), PosSummonLiving[1].GetOrientation()); - if (Is25ManRaid()) - me->SummonCreature(NPC_LIVING_TRAINEE, PosSummonLiving[2].GetPositionX(), PosSummonLiving[2].GetPositionY(), PosSummonLiving[2].GetPositionZ(), PosSummonLiving[2].GetOrientation()); - break; - case NPC_LIVING_KNIGHT: - me->SummonCreature(NPC_LIVING_KNIGHT, PosSummonLiving[3].GetPositionX(), PosSummonLiving[3].GetPositionY(), PosSummonLiving[3].GetPositionZ(), PosSummonLiving[3].GetOrientation()); - if (Is25ManRaid()) - me->SummonCreature(NPC_LIVING_KNIGHT, PosSummonLiving[5].GetPositionX(), PosSummonLiving[5].GetPositionY(), PosSummonLiving[5].GetPositionZ(), PosSummonLiving[5].GetOrientation()); - break; - case NPC_LIVING_RIDER: - me->SummonCreature(NPC_LIVING_RIDER, PosSummonLiving[4].GetPositionX(), PosSummonLiving[4].GetPositionY(), PosSummonLiving[4].GetPositionZ(), PosSummonLiving[4].GetOrientation()); - break; - } - } + void SummonHelpers(uint32 entry) + { + switch(entry) + { + case NPC_LIVING_TRAINEE: + me->SummonCreature(NPC_LIVING_TRAINEE, PosSummonLiving[0].GetPositionX(), PosSummonLiving[0].GetPositionY(), PosSummonLiving[0].GetPositionZ(), PosSummonLiving[0].GetOrientation()); + me->SummonCreature(NPC_LIVING_TRAINEE, PosSummonLiving[1].GetPositionX(), PosSummonLiving[1].GetPositionY(), PosSummonLiving[1].GetPositionZ(), PosSummonLiving[1].GetOrientation()); + if (Is25ManRaid()) + me->SummonCreature(NPC_LIVING_TRAINEE, PosSummonLiving[2].GetPositionX(), PosSummonLiving[2].GetPositionY(), PosSummonLiving[2].GetPositionZ(), PosSummonLiving[2].GetOrientation()); + break; + case NPC_LIVING_KNIGHT: + me->SummonCreature(NPC_LIVING_KNIGHT, PosSummonLiving[3].GetPositionX(), PosSummonLiving[3].GetPositionY(), PosSummonLiving[3].GetPositionZ(), PosSummonLiving[3].GetOrientation()); + if (Is25ManRaid()) + me->SummonCreature(NPC_LIVING_KNIGHT, PosSummonLiving[5].GetPositionX(), PosSummonLiving[5].GetPositionY(), PosSummonLiving[5].GetPositionZ(), PosSummonLiving[5].GetOrientation()); + break; + case NPC_LIVING_RIDER: + me->SummonCreature(NPC_LIVING_RIDER, PosSummonLiving[4].GetPositionX(), PosSummonLiving[4].GetPositionY(), PosSummonLiving[4].GetPositionZ(), PosSummonLiving[4].GetOrientation()); + break; + } + } - bool CheckGroupSplitted() - { - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); - if (!PlayerList.isEmpty()) - { - bool checklife = false; - bool checkdead = false; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - Player* player = i->GetSource(); - if (player->IsAlive() && - player->GetPositionX() <= POS_X_NORTH && - player->GetPositionX() >= POS_X_SOUTH && - player->GetPositionY() <= POS_Y_GATE && - player->GetPositionY() >= POS_Y_EAST) - checklife = true; - else if (player->IsAlive() && - player->GetPositionX() <= POS_X_NORTH && - player->GetPositionX() >= POS_X_SOUTH && - player->GetPositionY() >= POS_Y_GATE && - player->GetPositionY() <= POS_Y_WEST) - checkdead = true; + bool CheckGroupSplitted() + { + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + if (!PlayerList.isEmpty()) + { + bool checklife = false; + bool checkdead = false; + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + Player* player = i->GetSource(); + if (player->IsAlive() && + player->GetPositionX() <= POS_X_NORTH && + player->GetPositionX() >= POS_X_SOUTH && + player->GetPositionY() <= POS_Y_GATE && + player->GetPositionY() >= POS_Y_EAST) + checklife = true; + else if (player->IsAlive() && + player->GetPositionX() <= POS_X_NORTH && + player->GetPositionX() >= POS_X_SOUTH && + player->GetPositionY() >= POS_Y_GATE && + player->GetPositionY() <= POS_Y_WEST) + checkdead = true; - if (checklife && checkdead) - return true; - } - } - return false; - } + if (checklife && checkdead) + return true; + } + } + return false; + } - void SpellHit(Unit *caster, const SpellInfo* spellInfo) - { - uint8 pos = urand(0,4); - switch (spellInfo->Id) - { - case SPELL_INFORM_LIVING_TRAINEE: - me->SummonCreature(NPC_DEAD_TRAINEE, PosSummonDead[pos].GetPositionX(), PosSummonDead[pos].GetPositionY(), PosSummonDead[pos].GetPositionZ(), PosSummonDead[pos].GetOrientation()); - break; - case SPELL_INFORM_LIVING_KNIGHT: - me->SummonCreature(NPC_DEAD_KNIGHT, PosSummonDead[pos].GetPositionX(), PosSummonDead[pos].GetPositionY(), PosSummonDead[pos].GetPositionZ(), PosSummonDead[pos].GetOrientation()); - break; - case SPELL_INFORM_LIVING_RIDER: - me->SummonCreature(NPC_DEAD_RIDER, PosSummonDead[pos].GetPositionX(), PosSummonDead[pos].GetPositionY(), PosSummonDead[pos].GetPositionZ(), PosSummonDead[pos].GetOrientation()); - me->SummonCreature(NPC_DEAD_HORSE, PosSummonDead[pos].GetPositionX(), PosSummonDead[pos].GetPositionY(), PosSummonDead[pos].GetPositionZ(), PosSummonDead[pos].GetOrientation()); - break; - } + void SpellHit(Unit *caster, const SpellInfo* spellInfo) + { + uint8 pos = urand(0,4); + switch (spellInfo->Id) + { + case SPELL_INFORM_LIVING_TRAINEE: + me->SummonCreature(NPC_DEAD_TRAINEE, PosSummonDead[pos].GetPositionX(), PosSummonDead[pos].GetPositionY(), PosSummonDead[pos].GetPositionZ(), PosSummonDead[pos].GetOrientation()); + break; + case SPELL_INFORM_LIVING_KNIGHT: + me->SummonCreature(NPC_DEAD_KNIGHT, PosSummonDead[pos].GetPositionX(), PosSummonDead[pos].GetPositionY(), PosSummonDead[pos].GetPositionZ(), PosSummonDead[pos].GetOrientation()); + break; + case SPELL_INFORM_LIVING_RIDER: + me->SummonCreature(NPC_DEAD_RIDER, PosSummonDead[pos].GetPositionX(), PosSummonDead[pos].GetPositionY(), PosSummonDead[pos].GetPositionZ(), PosSummonDead[pos].GetOrientation()); + me->SummonCreature(NPC_DEAD_HORSE, PosSummonDead[pos].GetPositionX(), PosSummonDead[pos].GetPositionY(), PosSummonDead[pos].GetPositionZ(), PosSummonDead[pos].GetOrientation()); + break; + } - me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST); - } + me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (!secondPhase) - damage = 0; - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (!secondPhase) + damage = 0; + } - void UpdateAI(uint32 diff) - { - if (!IsInRoom()) - return; + void UpdateAI(uint32 diff) + { + if (!IsInRoom()) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_SHADOW_BOLT: - me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_SHADOW_BOLT_10, SPELL_SHADOW_BOLT_25), false); - events.RepeatEvent(2000); - break; - case EVENT_SPELL_HARVEST_SOUL: - me->CastSpell(me, SPELL_HARVEST_SOUL, false); - events.RepeatEvent(15000); - break; - case EVENT_TELEPORT: - me->AttackStop(); - if (IN_LIVE_SIDE(me)) - me->NearTeleportTo(PosGroundDeadSide.GetPositionX(), PosGroundDeadSide.GetPositionY(), PosGroundDeadSide.GetPositionZ(), PosGroundDeadSide.GetOrientation()); - else - me->NearTeleportTo(PosGroundLivingSide.GetPositionX(), PosGroundLivingSide.GetPositionY(), PosGroundLivingSide.GetPositionZ(), PosGroundLivingSide.GetOrientation()); + switch (events.GetEvent()) + { + case EVENT_SPELL_SHADOW_BOLT: + me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_SHADOW_BOLT_10, SPELL_SHADOW_BOLT_25), false); + events.RepeatEvent(2000); + break; + case EVENT_SPELL_HARVEST_SOUL: + me->CastSpell(me, SPELL_HARVEST_SOUL, false); + events.RepeatEvent(15000); + break; + case EVENT_TELEPORT: + me->AttackStop(); + if (IN_LIVE_SIDE(me)) + me->NearTeleportTo(PosGroundDeadSide.GetPositionX(), PosGroundDeadSide.GetPositionY(), PosGroundDeadSide.GetPositionZ(), PosGroundDeadSide.GetOrientation()); + else + me->NearTeleportTo(PosGroundLivingSide.GetPositionX(), PosGroundLivingSide.GetPositionY(), PosGroundLivingSide.GetPositionZ(), PosGroundLivingSide.GetOrientation()); - me->getThreatManager().resetAggro(NotOnSameSide(me)); - if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) - { - me->getThreatManager().addThreat(pTarget, 100.0f); - AttackStart(pTarget); - } - events.RepeatEvent(20000); - break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(30) && pInstance) - { - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_INNER_GATE))) - go->SetGoState(GO_STATE_ACTIVE); + me->getThreatManager().resetAggro(NotOnSameSide(me)); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) + { + me->getThreatManager().addThreat(pTarget, 100.0f); + AttackStart(pTarget); + } + events.RepeatEvent(20000); + break; + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(30) && pInstance) + { + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_INNER_GATE))) + go->SetGoState(GO_STATE_ACTIVE); - events.CancelEvent(EVENT_TELEPORT); - events.PopEvent(); - break; - } - events.RepeatEvent(1000); - break; - case EVENT_SUMMON_ADDS: - if (gothikWaves[waveCount][0]) - { - SummonHelpers(gothikWaves[waveCount][0]); - events.RepeatEvent(gothikWaves[waveCount][1]); - } - else - { - secondPhase = true; - Talk(SAY_TELEPORT); - me->NearTeleportTo(PosGroundLivingSide.GetPositionX(), PosGroundLivingSide.GetPositionY(), PosGroundLivingSide.GetPositionZ(), PosGroundLivingSide.GetOrientation()); - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_DISABLE_MOVE); - - summons.DoAction(ACTION_GATE_OPEN); - summons.DoZoneInCombat(); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 1000); - events.ScheduleEvent(EVENT_SPELL_HARVEST_SOUL, urand(5000,15000)); - events.ScheduleEvent(EVENT_TELEPORT, 20000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - events.PopEvent(); - } + events.CancelEvent(EVENT_TELEPORT); + events.PopEvent(); + break; + } + events.RepeatEvent(1000); + break; + case EVENT_SUMMON_ADDS: + if (gothikWaves[waveCount][0]) + { + SummonHelpers(gothikWaves[waveCount][0]); + events.RepeatEvent(gothikWaves[waveCount][1]); + } + else + { + secondPhase = true; + Talk(SAY_TELEPORT); + me->NearTeleportTo(PosGroundLivingSide.GetPositionX(), PosGroundLivingSide.GetPositionY(), PosGroundLivingSide.GetPositionZ(), PosGroundLivingSide.GetOrientation()); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_DISABLE_MOVE); + + summons.DoAction(ACTION_GATE_OPEN); + summons.DoZoneInCombat(); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 1000); + events.ScheduleEvent(EVENT_SPELL_HARVEST_SOUL, urand(5000,15000)); + events.ScheduleEvent(EVENT_TELEPORT, 20000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.PopEvent(); + } - waveCount++; - break; - case EVENT_CHECK_PLAYERS: - if (!CheckGroupSplitted()) - { - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_INNER_GATE))) - go->SetGoState(GO_STATE_ACTIVE); + waveCount++; + break; + case EVENT_CHECK_PLAYERS: + if (!CheckGroupSplitted()) + { + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_GOTHIK_INNER_GATE))) + go->SetGoState(GO_STATE_ACTIVE); - summons.DoAction(ACTION_GATE_OPEN); - summons.DoZoneInCombat(); - gateOpened = true; - } - events.PopEvent(); - break; - } + summons.DoAction(ACTION_GATE_OPEN); + summons.DoZoneInCombat(); + gateOpened = true; + } + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_boss_gothik_minion : public CreatureScript @@ -422,57 +422,57 @@ public: return new npc_boss_gothik_minionAI (pCreature); } - struct npc_boss_gothik_minionAI : public CombatAI - { - npc_boss_gothik_minionAI(Creature *c) : CombatAI(c) - { - livingSide = IN_LIVE_SIDE(me); - gateOpened = false; - } + struct npc_boss_gothik_minionAI : public CombatAI + { + npc_boss_gothik_minionAI(Creature *c) : CombatAI(c) + { + livingSide = IN_LIVE_SIDE(me); + gateOpened = false; + } - EventMap events; - bool livingSide; - bool gateOpened; + EventMap events; + bool livingSide; + bool gateOpened; - bool IsOnSameSide(Unit const* who) const { return livingSide == IN_LIVE_SIDE(who); } - bool CanAIAttack(Unit const* target) const { return gateOpened || IsOnSameSide(target); } + bool IsOnSameSide(Unit const* who) const { return livingSide == IN_LIVE_SIDE(who); } + bool CanAIAttack(Unit const* target) const { return gateOpened || IsOnSameSide(target); } - void Reset() { events.Reset(); } - void EnterCombat(Unit* who) { me->SetInCombatWithZone(); } - void DamageTaken(Unit* attacker, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (!attacker || (!gateOpened && !IsOnSameSide(attacker))) - damage = 0; - } + void Reset() { events.Reset(); } + void EnterCombat(Unit* who) { me->SetInCombatWithZone(); } + void DamageTaken(Unit* attacker, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (!attacker || (!gateOpened && !IsOnSameSide(attacker))) + damage = 0; + } - void DoAction(int32 param) - { - if (param == ACTION_GATE_OPEN) - gateOpened = true; - } + void DoAction(int32 param) + { + if (param == ACTION_GATE_OPEN) + gateOpened = true; + } - void JustDied(Unit *) - { - switch (me->GetEntry()) - { - case NPC_LIVING_TRAINEE: - me->CastSpell(me, SPELL_INFORM_LIVING_TRAINEE, true); - break; - case NPC_LIVING_KNIGHT: - me->CastSpell(me, SPELL_INFORM_LIVING_KNIGHT, true); - break; - case NPC_LIVING_RIDER: - me->CastSpell(me, SPELL_INFORM_LIVING_RIDER, true); - break; - } - } + void JustDied(Unit *) + { + switch (me->GetEntry()) + { + case NPC_LIVING_TRAINEE: + me->CastSpell(me, SPELL_INFORM_LIVING_TRAINEE, true); + break; + case NPC_LIVING_KNIGHT: + me->CastSpell(me, SPELL_INFORM_LIVING_KNIGHT, true); + break; + case NPC_LIVING_RIDER: + me->CastSpell(me, SPELL_INFORM_LIVING_RIDER, true); + break; + } + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript()) - me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0); - } - }; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript()) + me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0); + } + }; }; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index 2c4f6d9bf..c59d58f09 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -10,29 +10,29 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_POISON_CLOUD = 28240, - SPELL_MUTATING_INJECTION = 28169, - SPELL_SLIME_SPRAY_10 = 28157, - SPELL_SLIME_SPRAY_25 = 54364, - SPELL_POISON_CLOUD_DAMAGE_AURA_10 = 28158, - SPELL_POISON_CLOUD_DAMAGE_AURA_25 = 54362, - SPELL_BERSERK = 26662, + SPELL_POISON_CLOUD = 28240, + SPELL_MUTATING_INJECTION = 28169, + SPELL_SLIME_SPRAY_10 = 28157, + SPELL_SLIME_SPRAY_25 = 54364, + SPELL_POISON_CLOUD_DAMAGE_AURA_10 = 28158, + SPELL_POISON_CLOUD_DAMAGE_AURA_25 = 54362, + SPELL_BERSERK = 26662, - SPELL_BOMBARD_SLIME = 28280, // Spawn slime when hit by slime spray + SPELL_BOMBARD_SLIME = 28280, // Spawn slime when hit by slime spray }; enum Events { - EVENT_SPELL_BERSERK = 1, - EVENT_SPELL_POISON_CLOUD = 2, - EVENT_SPELL_SLIME_SPRAY = 3, - EVENT_SPELL_MUTATING_INJECTION = 4, + EVENT_SPELL_BERSERK = 1, + EVENT_SPELL_POISON_CLOUD = 2, + EVENT_SPELL_SLIME_SPRAY = 3, + EVENT_SPELL_MUTATING_INJECTION = 4, }; enum Misc { - NPC_FALLOUT_SLIME = 16290, - NPC_SEWAGE_SLIME = 16375, + NPC_FALLOUT_SLIME = 16290, + NPC_SEWAGE_SLIME = 16375, }; class boss_grobbulus : public CreatureScript @@ -45,114 +45,114 @@ public: return new boss_grobbulusAI (pCreature); } - struct boss_grobbulusAI : public ScriptedAI - { - boss_grobbulusAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = me->GetInstanceScript(); - } + struct boss_grobbulusAI : public ScriptedAI + { + boss_grobbulusAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = me->GetInstanceScript(); + } - EventMap events; - SummonList summons; - InstanceScript* pInstance; - uint32 dropSludgeTimer; + EventMap events; + SummonList summons; + InstanceScript* pInstance; + uint32 dropSludgeTimer; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - dropSludgeTimer = 0; + void Reset() + { + events.Reset(); + summons.DespawnAll(); + dropSludgeTimer = 0; - if (pInstance) - pInstance->SetData(EVENT_GROBBULUS, NOT_STARTED); - } + if (pInstance) + pInstance->SetData(EVENT_GROBBULUS, NOT_STARTED); + } - void EnterCombat(Unit *who) - { - me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_SPELL_POISON_CLOUD, 15000); - events.ScheduleEvent(EVENT_SPELL_MUTATING_INJECTION, 20000); - events.ScheduleEvent(EVENT_SPELL_SLIME_SPRAY, 10000); - events.ScheduleEvent(EVENT_SPELL_BERSERK, RAID_MODE(12*MINUTE*IN_MILLISECONDS, 9*MINUTE*IN_MILLISECONDS)); + void EnterCombat(Unit *who) + { + me->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_SPELL_POISON_CLOUD, 15000); + events.ScheduleEvent(EVENT_SPELL_MUTATING_INJECTION, 20000); + events.ScheduleEvent(EVENT_SPELL_SLIME_SPRAY, 10000); + events.ScheduleEvent(EVENT_SPELL_BERSERK, RAID_MODE(12*MINUTE*IN_MILLISECONDS, 9*MINUTE*IN_MILLISECONDS)); - if (pInstance) - pInstance->SetData(EVENT_GROBBULUS, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(EVENT_GROBBULUS, IN_PROGRESS); + } - void SpellHitTarget(Unit *target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25) && target->GetTypeId() == TYPEID_PLAYER) - me->SummonCreature(NPC_FALLOUT_SLIME, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); - } + void SpellHitTarget(Unit *target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25) && target->GetTypeId() == TYPEID_PLAYER) + me->SummonCreature(NPC_FALLOUT_SLIME, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); + } - void JustSummoned(Creature* cr) - { - if (cr->GetEntry() == NPC_FALLOUT_SLIME) - cr->SetInCombatWithZone(); + void JustSummoned(Creature* cr) + { + if (cr->GetEntry() == NPC_FALLOUT_SLIME) + cr->SetInCombatWithZone(); - summons.Summon(cr); - } + summons.Summon(cr); + } - void SummonedCreatureDespawn(Creature* summon){ summons.Despawn(summon); } + void SummonedCreatureDespawn(Creature* summon){ summons.Despawn(summon); } - void JustDied(Unit*) - { - summons.DespawnAll(); - if (pInstance) - pInstance->SetData(EVENT_GROBBULUS, DONE); - } + void JustDied(Unit*) + { + summons.DespawnAll(); + if (pInstance) + pInstance->SetData(EVENT_GROBBULUS, DONE); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void UpdateAI(uint32 diff) - { - // Some nice visuals - dropSludgeTimer += diff; - if (!me->IsInCombat() && dropSludgeTimer >= 5000) - { - if (me->IsWithinDist3d(3178, -3305, 319, 5.0f) && !summons.HasEntry(NPC_SEWAGE_SLIME)) - me->CastSpell(3128.96f+irand(-20, 20), -3312.96f+irand(-20, 20), 293.25f, SPELL_BOMBARD_SLIME, false); + void UpdateAI(uint32 diff) + { + // Some nice visuals + dropSludgeTimer += diff; + if (!me->IsInCombat() && dropSludgeTimer >= 5000) + { + if (me->IsWithinDist3d(3178, -3305, 319, 5.0f) && !summons.HasEntry(NPC_SEWAGE_SLIME)) + me->CastSpell(3128.96f+irand(-20, 20), -3312.96f+irand(-20, 20), 293.25f, SPELL_BOMBARD_SLIME, false); - dropSludgeTimer = 0; - } + dropSludgeTimer = 0; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_POISON_CLOUD: - me->CastSpell(me, SPELL_POISON_CLOUD, true); - events.RepeatEvent(15000); - break; - case EVENT_SPELL_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - break; - case EVENT_SPELL_SLIME_SPRAY: - me->MonsterTextEmote("Grobbulus sprays slime across the room!", 0, true); - me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25), false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_MUTATING_INJECTION: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true, -SPELL_MUTATING_INJECTION)) - me->CastSpell(target, SPELL_MUTATING_INJECTION, false); + switch (events.GetEvent()) + { + case EVENT_SPELL_POISON_CLOUD: + me->CastSpell(me, SPELL_POISON_CLOUD, true); + events.RepeatEvent(15000); + break; + case EVENT_SPELL_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + break; + case EVENT_SPELL_SLIME_SPRAY: + me->MonsterTextEmote("Grobbulus sprays slime across the room!", 0, true); + me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25), false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_MUTATING_INJECTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true, -SPELL_MUTATING_INJECTION)) + me->CastSpell(target, SPELL_MUTATING_INJECTION, false); - events.RepeatEvent(8000 + uint32(120 * me->GetHealthPct())); - break; - } + events.RepeatEvent(8000 + uint32(120 * me->GetHealthPct())); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_grobbulus_poison_cloud : public CreatureScript @@ -165,47 +165,47 @@ public: return new boss_grobbulus_poison_cloudAI(pCreature); } - struct boss_grobbulus_poison_cloudAI : public NullCreatureAI - { - boss_grobbulus_poison_cloudAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - } + struct boss_grobbulus_poison_cloudAI : public NullCreatureAI + { + boss_grobbulus_poison_cloudAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + } - uint32 sizeTimer; - uint32 auraVisualTimer; + uint32 sizeTimer; + uint32 auraVisualTimer; - void Reset() - { - sizeTimer = 0; - auraVisualTimer = 1; - me->SetFloatValue(UNIT_FIELD_COMBATREACH, 2.0f); - me->setFaction(21); // Grobbulus one - } + void Reset() + { + sizeTimer = 0; + auraVisualTimer = 1; + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 2.0f); + me->setFaction(21); // Grobbulus one + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript()) - me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript()) + me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0); + } - void UpdateAI(uint32 diff) - { - // this has to be delayed to be visible :/ - if (auraVisualTimer) - { - auraVisualTimer += diff; - if (auraVisualTimer >= 1000) - { - me->CastSpell(me, (me->GetMap()->Is25ManRaid() ? SPELL_POISON_CLOUD_DAMAGE_AURA_25 : SPELL_POISON_CLOUD_DAMAGE_AURA_10), true); - auraVisualTimer = 0; - } - } + void UpdateAI(uint32 diff) + { + // this has to be delayed to be visible :/ + if (auraVisualTimer) + { + auraVisualTimer += diff; + if (auraVisualTimer >= 1000) + { + me->CastSpell(me, (me->GetMap()->Is25ManRaid() ? SPELL_POISON_CLOUD_DAMAGE_AURA_25 : SPELL_POISON_CLOUD_DAMAGE_AURA_10), true); + auraVisualTimer = 0; + } + } - sizeTimer += diff; - // increase size to 15yd in 60 seconds, 0.00025 is the growth of size in 1ms - me->SetFloatValue(UNIT_FIELD_COMBATREACH, 2.0f+(0.00025f*sizeTimer)); - } - }; + sizeTimer += diff; + // increase size to 15yd in 60 seconds, 0.00025 is the growth of size in 1ms + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 2.0f+(0.00025f*sizeTimer)); + } + }; }; @@ -221,13 +221,13 @@ class spell_grobbulus_poison : public SpellScriptLoader void FilterTargets(std::list& targets) { std::list tmplist; - for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) - if (GetCaster()->IsWithinDist3d((*itr), 0.0f)) - tmplist.push_back(*itr); + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + if (GetCaster()->IsWithinDist3d((*itr), 0.0f)) + tmplist.push_back(*itr); - targets.clear(); - for( std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr ) - targets.push_back(*itr); + targets.clear(); + for( std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr ) + targets.push_back(*itr); } void Register() @@ -246,5 +246,5 @@ void AddSC_boss_grobbulus() { new boss_grobbulus(); new boss_grobbulus_poison_cloud(); - new spell_grobbulus_poison(); + new spell_grobbulus_poison(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp index 209920e7c..5a388ac47 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp @@ -17,25 +17,25 @@ enum Says enum Spells { - SPELL_SPELL_DISRUPTION = 29310, - SPELL_DECREPIT_FEVER_10 = 29998, - SPELL_DECREPIT_FEVER_25 = 55011, - SPELL_PLAGUE_CLOUD = 29350, + SPELL_SPELL_DISRUPTION = 29310, + SPELL_DECREPIT_FEVER_10 = 29998, + SPELL_DECREPIT_FEVER_25 = 55011, + SPELL_PLAGUE_CLOUD = 29350, }; enum Events { - EVENT_SPELL_SPELL_DISRUPTION = 1, - EVENT_SPELL_DECEPIT_FEVER = 2, - EVENT_ERUPT_SECTION = 3, - EVENT_SWITCH_PHASE = 4, - EVENT_SAFETY_DANCE = 5, + EVENT_SPELL_SPELL_DISRUPTION = 1, + EVENT_SPELL_DECEPIT_FEVER = 2, + EVENT_ERUPT_SECTION = 3, + EVENT_SWITCH_PHASE = 4, + EVENT_SAFETY_DANCE = 5, }; enum Misc { - PHASE_SLOW_DANCE = 0, - PHASE_FAST_DANCE = 1, + PHASE_SLOW_DANCE = 0, + PHASE_FAST_DANCE = 1, }; class boss_heigan : public CreatureScript @@ -48,174 +48,174 @@ public: return new boss_heiganAI (pCreature); } - struct boss_heiganAI : public ScriptedAI - { - boss_heiganAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceScript(); - } + struct boss_heiganAI : public ScriptedAI + { + boss_heiganAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - uint8 currentPhase; - uint8 currentSection; - bool moveRight; + InstanceScript* pInstance; + EventMap events; + uint8 currentPhase; + uint8 currentSection; + bool moveRight; - void Reset() - { - events.Reset(); - currentPhase = 0; - currentSection = 3; - moveRight = true; + void Reset() + { + events.Reset(); + currentPhase = 0; + currentSection = 3; + moveRight = true; - if (pInstance) - { - pInstance->SetData(EVENT_HEIGAN, NOT_STARTED); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_HEIGAN_ENTER_GATE))) - go->SetGoState(GO_STATE_ACTIVE); - } - } + if (pInstance) + { + pInstance->SetData(EVENT_HEIGAN, NOT_STARTED); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_HEIGAN_ENTER_GATE))) + go->SetGoState(GO_STATE_ACTIVE); + } + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (!urand(0,3)) - Talk(SAY_SLAY); + if (!urand(0,3)) + Talk(SAY_SLAY); - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void JustDied(Unit* Killer) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(EVENT_HEIGAN, DONE); - } + void JustDied(Unit* Killer) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(EVENT_HEIGAN, DONE); + } - void EnterCombat(Unit *who) - { - me->SetInCombatWithZone(); - Talk(SAY_AGGRO); - if (pInstance) - { - pInstance->SetData(EVENT_HEIGAN, IN_PROGRESS); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_HEIGAN_ENTER_GATE))) - go->SetGoState(GO_STATE_READY); - } + void EnterCombat(Unit *who) + { + me->SetInCombatWithZone(); + Talk(SAY_AGGRO); + if (pInstance) + { + pInstance->SetData(EVENT_HEIGAN, IN_PROGRESS); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_HEIGAN_ENTER_GATE))) + go->SetGoState(GO_STATE_READY); + } - StartFightPhase(PHASE_SLOW_DANCE); - } + StartFightPhase(PHASE_SLOW_DANCE); + } - void StartFightPhase(uint8 phase) - { - currentSection = 3; - currentPhase = phase; - events.Reset(); - if (phase == PHASE_SLOW_DANCE) - { - events.ScheduleEvent(EVENT_SPELL_SPELL_DISRUPTION, 0); - events.ScheduleEvent(EVENT_SPELL_DECEPIT_FEVER, 12000); - events.ScheduleEvent(EVENT_ERUPT_SECTION, 10000); - events.ScheduleEvent(EVENT_SWITCH_PHASE, 90000); - } - else // if (phase == PHASE_FAST_DANCE) - { - me->MonsterTextEmote("%s teleports and begins to channel a spell!", 0, true); - // teleport - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->NearTeleportTo(x, y, z, o); + void StartFightPhase(uint8 phase) + { + currentSection = 3; + currentPhase = phase; + events.Reset(); + if (phase == PHASE_SLOW_DANCE) + { + events.ScheduleEvent(EVENT_SPELL_SPELL_DISRUPTION, 0); + events.ScheduleEvent(EVENT_SPELL_DECEPIT_FEVER, 12000); + events.ScheduleEvent(EVENT_ERUPT_SECTION, 10000); + events.ScheduleEvent(EVENT_SWITCH_PHASE, 90000); + } + else // if (phase == PHASE_FAST_DANCE) + { + me->MonsterTextEmote("%s teleports and begins to channel a spell!", 0, true); + // teleport + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->NearTeleportTo(x, y, z, o); - me->CastSpell(me, SPELL_PLAGUE_CLOUD, false); - events.ScheduleEvent(EVENT_ERUPT_SECTION, 4000); - events.ScheduleEvent(EVENT_SWITCH_PHASE, 45000); - } - events.ScheduleEvent(EVENT_SAFETY_DANCE, 5000); - } + me->CastSpell(me, SPELL_PLAGUE_CLOUD, false); + events.ScheduleEvent(EVENT_ERUPT_SECTION, 4000); + events.ScheduleEvent(EVENT_SWITCH_PHASE, 45000); + } + events.ScheduleEvent(EVENT_SAFETY_DANCE, 5000); + } - bool IsInRoom(Unit* who) - { - if (who->GetPositionX() > 2826 || who->GetPositionX() < 2723 || who->GetPositionY() > -3641 || who->GetPositionY() < -3736) - { - if (who->GetGUID() == me->GetGUID()) - EnterEvadeMode(); - return false; - } + bool IsInRoom(Unit* who) + { + if (who->GetPositionX() > 2826 || who->GetPositionX() < 2723 || who->GetPositionY() > -3641 || who->GetPositionY() < -3736) + { + if (who->GetGUID() == me->GetGUID()) + EnterEvadeMode(); + return false; + } - return true; - } + return true; + } - void UpdateAI(uint32 diff) - { - if (!IsInRoom(me)) - return; + void UpdateAI(uint32 diff) + { + if (!IsInRoom(me)) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - //if (me->HasUnitState(UNIT_STATE_CASTING)) - // return; + events.Update(diff); + //if (me->HasUnitState(UNIT_STATE_CASTING)) + // return; - switch (events.GetEvent()) - { - case EVENT_SPELL_SPELL_DISRUPTION: - me->CastSpell(me, SPELL_SPELL_DISRUPTION, false); - events.RepeatEvent(10000); - break; - case EVENT_SPELL_DECEPIT_FEVER: - me->CastSpell(me, RAID_MODE(SPELL_DECREPIT_FEVER_10, SPELL_DECREPIT_FEVER_25), false); - events.RepeatEvent(20000); - break; - case EVENT_SWITCH_PHASE: - StartFightPhase(currentPhase == PHASE_SLOW_DANCE ? PHASE_FAST_DANCE : PHASE_SLOW_DANCE); - // no pop, there is reset in start fight - break; - case EVENT_ERUPT_SECTION: - if (pInstance) - { - pInstance->SetData(DATA_HEIGAN_ERUPTION, currentSection); - if (currentSection == 3) - moveRight = false; - else if (currentSection == 0) - moveRight = true; + switch (events.GetEvent()) + { + case EVENT_SPELL_SPELL_DISRUPTION: + me->CastSpell(me, SPELL_SPELL_DISRUPTION, false); + events.RepeatEvent(10000); + break; + case EVENT_SPELL_DECEPIT_FEVER: + me->CastSpell(me, RAID_MODE(SPELL_DECREPIT_FEVER_10, SPELL_DECREPIT_FEVER_25), false); + events.RepeatEvent(20000); + break; + case EVENT_SWITCH_PHASE: + StartFightPhase(currentPhase == PHASE_SLOW_DANCE ? PHASE_FAST_DANCE : PHASE_SLOW_DANCE); + // no pop, there is reset in start fight + break; + case EVENT_ERUPT_SECTION: + if (pInstance) + { + pInstance->SetData(DATA_HEIGAN_ERUPTION, currentSection); + if (currentSection == 3) + moveRight = false; + else if (currentSection == 0) + moveRight = true; - moveRight ? currentSection++ : currentSection--; - } + moveRight ? currentSection++ : currentSection--; + } - if (currentPhase == PHASE_SLOW_DANCE && !urand(0,3)) - Talk(SAY_TAUNT); + if (currentPhase == PHASE_SLOW_DANCE && !urand(0,3)) + Talk(SAY_TAUNT); - events.RepeatEvent(currentPhase == PHASE_SLOW_DANCE ? 10000 : 4000); - break; - case EVENT_SAFETY_DANCE: - { - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - if (IsInRoom(itr->GetSource()) && !itr->GetSource()->IsAlive()) - { - events.PopEvent(); - pInstance->SetData(DATA_DANCE_FAIL, 0); - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - return; - } + events.RepeatEvent(currentPhase == PHASE_SLOW_DANCE ? 10000 : 4000); + break; + case EVENT_SAFETY_DANCE: + { + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + if (IsInRoom(itr->GetSource()) && !itr->GetSource()->IsAlive()) + { + events.PopEvent(); + pInstance->SetData(DATA_DANCE_FAIL, 0); + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + return; + } - } - events.RepeatEvent(5000); - return; - } - } + } + events.RepeatEvent(5000); + return; + } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_heigan() { - new boss_heigan(); + new boss_heigan(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index b78b44757..a55072fe3 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -24,63 +24,63 @@ enum Yells enum Spells { - SPELL_FROST_BOLT_SINGLE_10 = 28478, - SPELL_FROST_BOLT_SINGLE_25 = 55802, - SPELL_FROST_BOLT_MULTI_10 = 28479, - SPELL_FROST_BOLT_MULTI_25 = 55807, - SPELL_SHADOW_FISURE = 27810, - SPELL_VOID_BLAST = 27812, - SPELL_DETONATE_MANA = 27819, - SPELL_MANA_DETONATION_DAMAGE = 27820, - SPELL_FROST_BLAST = 27808, - SPELL_CHAINS_OF_KELTHUZAD = 28410, //28408 script effect - SPELL_BERSERK = 28498, + SPELL_FROST_BOLT_SINGLE_10 = 28478, + SPELL_FROST_BOLT_SINGLE_25 = 55802, + SPELL_FROST_BOLT_MULTI_10 = 28479, + SPELL_FROST_BOLT_MULTI_25 = 55807, + SPELL_SHADOW_FISURE = 27810, + SPELL_VOID_BLAST = 27812, + SPELL_DETONATE_MANA = 27819, + SPELL_MANA_DETONATION_DAMAGE = 27820, + SPELL_FROST_BLAST = 27808, + SPELL_CHAINS_OF_KELTHUZAD = 28410, //28408 script effect + SPELL_BERSERK = 28498, - // Minions - SPELL_FRENZY = 28468, - SPELL_MORTAL_WOUND = 28467, - SPELL_BLOOD_TAP = 28470, + // Minions + SPELL_FRENZY = 28468, + SPELL_MORTAL_WOUND = 28467, + SPELL_BLOOD_TAP = 28470, }; enum Misc { - NPC_SOLDIER_OF_THE_FROZEN_WASTES = 16427, - NPC_UNSTOPPABLE_ABOMINATION = 16428, - NPC_SOUL_WEAVER = 16429, - NPC_GUARDIAN_OF_ICECROWN = 16441, + NPC_SOLDIER_OF_THE_FROZEN_WASTES = 16427, + NPC_UNSTOPPABLE_ABOMINATION = 16428, + NPC_SOUL_WEAVER = 16429, + NPC_GUARDIAN_OF_ICECROWN = 16441, - ACTION_CALL_HELP_ON = 1, - ACTION_CALL_HELP_OFF = 2, - ACTION_SECOND_PHASE = 3, + ACTION_CALL_HELP_ON = 1, + ACTION_CALL_HELP_OFF = 2, + ACTION_SECOND_PHASE = 3, }; enum Event { - // Kel'Thuzad - EVENT_SUMMON_SOLDIER = 1, - EVENT_SUMMON_UNSTOPPABLE_ABOMINATION = 2, - EVENT_SUMMON_SOUL_WEAVER = 3, - EVENT_START_SECOND_PHASE = 4, - EVENT_SPELL_FROST_BOLT_SINGLE = 5, - EVENT_SPELL_FROST_BOLT_MULTI = 6, - EVENT_SPELL_DETONATE_MANA = 7, - EVENT_SECOND_PHASE_HEALTH_CHECK = 8, - EVENT_THIRD_PHASE_LICH_KING_SAY = 9, - EVENT_SPELL_SHADOW_FISSURE = 10, - EVENT_SPELL_FROST_BLAST = 11, - EVENT_SPELL_CHAINS = 12, - EVENT_SUMMON_GUARDIAN_OF_ICECROWN = 13, - EVENT_FLOOR_CHANGE = 14, + // Kel'Thuzad + EVENT_SUMMON_SOLDIER = 1, + EVENT_SUMMON_UNSTOPPABLE_ABOMINATION = 2, + EVENT_SUMMON_SOUL_WEAVER = 3, + EVENT_START_SECOND_PHASE = 4, + EVENT_SPELL_FROST_BOLT_SINGLE = 5, + EVENT_SPELL_FROST_BOLT_MULTI = 6, + EVENT_SPELL_DETONATE_MANA = 7, + EVENT_SECOND_PHASE_HEALTH_CHECK = 8, + EVENT_THIRD_PHASE_LICH_KING_SAY = 9, + EVENT_SPELL_SHADOW_FISSURE = 10, + EVENT_SPELL_FROST_BLAST = 11, + EVENT_SPELL_CHAINS = 12, + EVENT_SUMMON_GUARDIAN_OF_ICECROWN = 13, + EVENT_FLOOR_CHANGE = 14, - // Minions - EVENT_MINION_SPELL_FRENZY = 100, - EVENT_MINION_SPELL_MORTAL_WOUND = 101, - EVENT_MINION_SPELL_BLOOD_TAP = 102, + // Minions + EVENT_MINION_SPELL_FRENZY = 100, + EVENT_MINION_SPELL_MORTAL_WOUND = 101, + EVENT_MINION_SPELL_BLOOD_TAP = 102, }; const Position SummonPositions[12] = { - // Portals + // Portals {3783.272705f, -5062.697266f, 143.711203f, 3.617599f}, //LEFT_FAR {3730.291260f, -5027.239258f, 143.956909f, 4.461900f}, //LEFT_MIDDLE {3683.868652f, -5057.281250f, 143.183884f, 5.237086f}, //LEFT_NEAR @@ -88,7 +88,7 @@ const Position SummonPositions[12] = {3700.724365f, -5185.123047f, 143.928024f, 1.309310f}, //RIGHT_MIDDLE {3665.121094f, -5138.679199f, 143.183212f, 0.604023f}, //RIGHT_NEAR - // Edges + // Edges //{3754.431396f, -5080.727734f, 142.036316f, 3.736189f}, //LEFT_FAR // {3724.396484f, -5061.330566f, 142.032700f, 4.564785f}, //LEFT_MIDDLE //{3687.158424f, -5076.834473f, 142.017319f, 5.237086f}, //LEFT_NEAR @@ -96,13 +96,13 @@ const Position SummonPositions[12] = //{3707.990733f, -5151.450195f, 142.032562f, 1.376855f}, //RIGHT_MIDDLE // {3739.500000f, -5141.883989f, 142.014113f, 2.121412f} //RIGHT_NEAR - // Middle - {3769.34f, -5071.80f, 143.2082f, 3.658f}, - {3729.78f, -5043.56f, 143.3867f, 4.475f}, - {3682.75f, -5055.26f, 143.1848f, 5.295f}, - {3752.58f, -5161.82f, 143.2944f, 2.126f}, - {3702.83f, -5171.70f, 143.4356f, 1.305f}, - {3665.30f, -5141.55f, 143.1846f, 0.566f} + // Middle + {3769.34f, -5071.80f, 143.2082f, 3.658f}, + {3729.78f, -5043.56f, 143.3867f, 4.475f}, + {3682.75f, -5055.26f, 143.1848f, 5.295f}, + {3752.58f, -5161.82f, 143.2944f, 2.126f}, + {3702.83f, -5171.70f, 143.4356f, 1.305f}, + {3665.30f, -5141.55f, 143.1846f, 0.566f} }; class boss_kelthuzad : public CreatureScript @@ -115,292 +115,292 @@ public: return new boss_kelthuzadAI (pCreature); } - struct boss_kelthuzadAI : public ScriptedAI - { - boss_kelthuzadAI(Creature* c) : ScriptedAI(c), summons(me) - { - pInstance = me->GetInstanceScript(); - } - - EventMap events; - SummonList summons; - InstanceScript* pInstance; - - float NormalizeOrientation(float o) + struct boss_kelthuzadAI : public ScriptedAI + { + boss_kelthuzadAI(Creature* c) : ScriptedAI(c), summons(me) { - // Only positive values will be passed + pInstance = me->GetInstanceScript(); + } + + EventMap events; + SummonList summons; + InstanceScript* pInstance; + + float NormalizeOrientation(float o) + { + // Only positive values will be passed return fmod(o, 2.0f * static_cast(M_PI)); } - void SpawnHelpers() - { - // Ehhh... - // in short: 6 rooms, 8 soldiers, 3 abominations and 1 weaver in each room - // middle positions in table starts from 6 - for (uint8 i = 6; i < 12; ++i) - for (uint8 j = 0; j < 8; ++j) - { - float angle = M_PI*2/8*j; - me->SummonCreature(NPC_SOLDIER_OF_THE_FROZEN_WASTES, SummonPositions[i].GetPositionX()+6*cos(angle), SummonPositions[i].GetPositionY()+6*sin(angle), SummonPositions[i].GetPositionZ()+0.5f, SummonPositions[i].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); - } - for (uint8 i = 6; i < 12; ++i) - for (uint8 j = 1; j < 4; ++j) - { - float dist = j == 2 ? 0.0f : 8.0f; // second in middle - float angle = SummonPositions[i].GetOrientation() + M_PI*2/4*j; - NormalizeOrientation(angle); - me->SummonCreature(NPC_UNSTOPPABLE_ABOMINATION, SummonPositions[i].GetPositionX()+dist*cos(angle), SummonPositions[i].GetPositionY()+dist*sin(angle), SummonPositions[i].GetPositionZ()+0.5f, SummonPositions[i].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); - } - for (uint8 i = 6; i < 12; ++i) - for (uint8 j = 0; j < 1; ++j) - { - float angle = SummonPositions[i].GetOrientation() + M_PI; - NormalizeOrientation(angle); - me->SummonCreature(NPC_SOUL_WEAVER, SummonPositions[i].GetPositionX()+6*cos(angle), SummonPositions[i].GetPositionY()+6*sin(angle), SummonPositions[i].GetPositionZ()+0.5f, SummonPositions[i].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); - } - } + void SpawnHelpers() + { + // Ehhh... + // in short: 6 rooms, 8 soldiers, 3 abominations and 1 weaver in each room + // middle positions in table starts from 6 + for (uint8 i = 6; i < 12; ++i) + for (uint8 j = 0; j < 8; ++j) + { + float angle = M_PI*2/8*j; + me->SummonCreature(NPC_SOLDIER_OF_THE_FROZEN_WASTES, SummonPositions[i].GetPositionX()+6*cos(angle), SummonPositions[i].GetPositionY()+6*sin(angle), SummonPositions[i].GetPositionZ()+0.5f, SummonPositions[i].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); + } + for (uint8 i = 6; i < 12; ++i) + for (uint8 j = 1; j < 4; ++j) + { + float dist = j == 2 ? 0.0f : 8.0f; // second in middle + float angle = SummonPositions[i].GetOrientation() + M_PI*2/4*j; + NormalizeOrientation(angle); + me->SummonCreature(NPC_UNSTOPPABLE_ABOMINATION, SummonPositions[i].GetPositionX()+dist*cos(angle), SummonPositions[i].GetPositionY()+dist*sin(angle), SummonPositions[i].GetPositionZ()+0.5f, SummonPositions[i].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); + } + for (uint8 i = 6; i < 12; ++i) + for (uint8 j = 0; j < 1; ++j) + { + float angle = SummonPositions[i].GetOrientation() + M_PI; + NormalizeOrientation(angle); + me->SummonCreature(NPC_SOUL_WEAVER, SummonPositions[i].GetPositionX()+6*cos(angle), SummonPositions[i].GetPositionY()+6*sin(angle), SummonPositions[i].GetPositionZ()+0.5f, SummonPositions[i].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); + } + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - me->SetReactState(REACT_AGGRESSIVE); - - if (pInstance) - { - pInstance->SetData(EVENT_KELTHUZAD, NOT_STARTED); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_FLOOR))) - { - go->SetPhaseMask(1, true); - go->SetGoState(GO_STATE_READY); - } - } - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); + me->SetReactState(REACT_AGGRESSIVE); + + if (pInstance) + { + pInstance->SetData(EVENT_KELTHUZAD, NOT_STARTED); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_FLOOR))) + { + go->SetPhaseMask(1, true); + go->SetGoState(GO_STATE_READY); + } + } + } - void EnterEvadeMode() - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); + ScriptedAI::EnterEvadeMode(); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (!urand(0,3)) - Talk(SAY_SLAY); + if (!urand(0,3)) + Talk(SAY_SLAY); - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void JustDied(Unit* Killer) - { - summons.DespawnAll(); - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(EVENT_KELTHUZAD, DONE); - } + void JustDied(Unit* Killer) + { + summons.DespawnAll(); + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(EVENT_KELTHUZAD, DONE); + } - void MoveInLineOfSight(Unit* who) - { - if (!me->IsInCombat() && who->GetTypeId() == TYPEID_PLAYER && who->IsAlive() && me->GetDistance(who) <= 50.0f) - AttackStart(who); - } + void MoveInLineOfSight(Unit* who) + { + if (!me->IsInCombat() && who->GetTypeId() == TYPEID_PLAYER && who->IsAlive() && me->GetDistance(who) <= 50.0f) + AttackStart(who); + } - void EnterCombat(Unit* who) - { - Talk(SAY_SUMMON_MINIONS); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE); - me->RemoveAllAttackers(); - me->SetTarget(0); - me->SetReactState(REACT_PASSIVE); + void EnterCombat(Unit* who) + { + Talk(SAY_SUMMON_MINIONS); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE); + me->RemoveAllAttackers(); + me->SetTarget(0); + me->SetReactState(REACT_PASSIVE); - // Spawn helpers - SpawnHelpers(); + // Spawn helpers + SpawnHelpers(); - events.ScheduleEvent(EVENT_SUMMON_SOLDIER, 3200); - events.ScheduleEvent(EVENT_SUMMON_UNSTOPPABLE_ABOMINATION, 10000); - events.ScheduleEvent(EVENT_SUMMON_SOUL_WEAVER, 24000); - events.ScheduleEvent(EVENT_START_SECOND_PHASE, 228000); - if (pInstance) - { - pInstance->SetData(EVENT_KELTHUZAD, IN_PROGRESS); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_FLOOR))) - { - events.ScheduleEvent(EVENT_FLOOR_CHANGE, 15000); - go->SetGoState(GO_STATE_ACTIVE); - } - } - } + events.ScheduleEvent(EVENT_SUMMON_SOLDIER, 3200); + events.ScheduleEvent(EVENT_SUMMON_UNSTOPPABLE_ABOMINATION, 10000); + events.ScheduleEvent(EVENT_SUMMON_SOUL_WEAVER, 24000); + events.ScheduleEvent(EVENT_START_SECOND_PHASE, 228000); + if (pInstance) + { + pInstance->SetData(EVENT_KELTHUZAD, IN_PROGRESS); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_FLOOR))) + { + events.ScheduleEvent(EVENT_FLOOR_CHANGE, 15000); + go->SetGoState(GO_STATE_ACTIVE); + } + } + } - void JustSummoned(Creature* cr) { summons.Summon(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_FLOOR_CHANGE: - if (pInstance) - { - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_FLOOR))) - { - events.ScheduleEvent(EVENT_FLOOR_CHANGE, 15000); - go->SetGoState(GO_STATE_READY); - go->SetPhaseMask(2, true); - } - } - events.PopEvent(); - break; - case EVENT_SUMMON_SOLDIER: - if (Creature* cr = me->SummonCreature(NPC_SOLDIER_OF_THE_FROZEN_WASTES, SummonPositions[urand(0,5)], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) - { - if (Unit* target = SelectTargetFromPlayerList(100.0f)) - { - cr->AI()->DoAction(ACTION_CALL_HELP_OFF); - cr->AI()->AttackStart(target); - } - } + switch (events.GetEvent()) + { + case EVENT_FLOOR_CHANGE: + if (pInstance) + { + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_FLOOR))) + { + events.ScheduleEvent(EVENT_FLOOR_CHANGE, 15000); + go->SetGoState(GO_STATE_READY); + go->SetPhaseMask(2, true); + } + } + events.PopEvent(); + break; + case EVENT_SUMMON_SOLDIER: + if (Creature* cr = me->SummonCreature(NPC_SOLDIER_OF_THE_FROZEN_WASTES, SummonPositions[urand(0,5)], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) + { + if (Unit* target = SelectTargetFromPlayerList(100.0f)) + { + cr->AI()->DoAction(ACTION_CALL_HELP_OFF); + cr->AI()->AttackStart(target); + } + } - events.RepeatEvent(3200); - break; - case EVENT_SUMMON_UNSTOPPABLE_ABOMINATION: - if (Creature* cr = me->SummonCreature(NPC_UNSTOPPABLE_ABOMINATION, SummonPositions[urand(0,5)], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) - { - if (Unit* target = SelectTargetFromPlayerList(100.0f)) - { - cr->AI()->DoAction(ACTION_CALL_HELP_OFF); - cr->AI()->AttackStart(target); - } - } + events.RepeatEvent(3200); + break; + case EVENT_SUMMON_UNSTOPPABLE_ABOMINATION: + if (Creature* cr = me->SummonCreature(NPC_UNSTOPPABLE_ABOMINATION, SummonPositions[urand(0,5)], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) + { + if (Unit* target = SelectTargetFromPlayerList(100.0f)) + { + cr->AI()->DoAction(ACTION_CALL_HELP_OFF); + cr->AI()->AttackStart(target); + } + } - events.RepeatEvent(30000); - break; - case EVENT_SUMMON_SOUL_WEAVER: - if (Creature* cr = me->SummonCreature(NPC_SOUL_WEAVER, SummonPositions[urand(0,5)], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) - { - if (Unit* target = SelectTargetFromPlayerList(100.0f)) - { - cr->AI()->DoAction(ACTION_CALL_HELP_OFF); - cr->AI()->AttackStart(target); - } - } + events.RepeatEvent(30000); + break; + case EVENT_SUMMON_SOUL_WEAVER: + if (Creature* cr = me->SummonCreature(NPC_SOUL_WEAVER, SummonPositions[urand(0,5)], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) + { + if (Unit* target = SelectTargetFromPlayerList(100.0f)) + { + cr->AI()->DoAction(ACTION_CALL_HELP_OFF); + cr->AI()->AttackStart(target); + } + } - events.RepeatEvent(30000); - break; - case EVENT_START_SECOND_PHASE: - // same as pop - Talk(SAY_AGGRO); - events.Reset(); - summons.DoAction(ACTION_SECOND_PHASE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - me->SetReactState(REACT_AGGRESSIVE); - events.ScheduleEvent(EVENT_SPELL_FROST_BOLT_SINGLE, 2000); - events.ScheduleEvent(EVENT_SPELL_FROST_BOLT_MULTI, 15000); - events.ScheduleEvent(EVENT_SPELL_DETONATE_MANA, 20000); - events.ScheduleEvent(EVENT_SECOND_PHASE_HEALTH_CHECK, 1000); - events.ScheduleEvent(EVENT_SPELL_SHADOW_FISSURE, 25000); - events.ScheduleEvent(EVENT_SPELL_FROST_BLAST, 45000); - if (Is25ManRaid()) - events.ScheduleEvent(EVENT_SPELL_CHAINS, 50000); - break; - case EVENT_SPELL_FROST_BOLT_SINGLE: - me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_FROST_BOLT_SINGLE_10, SPELL_FROST_BOLT_SINGLE_25), false); - events.RepeatEvent(urand(2000, 15000)); - break; - case EVENT_SPELL_FROST_BOLT_MULTI: - me->CastSpell(me, RAID_MODE(SPELL_FROST_BOLT_MULTI_10, SPELL_FROST_BOLT_MULTI_25), false); - events.RepeatEvent(24000); - break; - case EVENT_SPELL_SHADOW_FISSURE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - me->CastSpell(target, SPELL_SHADOW_FISURE, false); - events.RepeatEvent(25000); - break; - case EVENT_SPELL_FROST_BLAST: - if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1,0), 0, true)) - me->CastSpell(target, SPELL_FROST_BLAST, false); - - if (!urand(0,2)) - Talk(SAY_FROST_BLAST); - events.RepeatEvent(45000); - break; - case EVENT_SPELL_CHAINS: - for (uint8 i = 0; i < 3; ++i) - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true, -SPELL_CHAINS_OF_KELTHUZAD)) - me->CastSpell(target, SPELL_CHAINS_OF_KELTHUZAD, true); + events.RepeatEvent(30000); + break; + case EVENT_START_SECOND_PHASE: + // same as pop + Talk(SAY_AGGRO); + events.Reset(); + summons.DoAction(ACTION_SECOND_PHASE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + me->SetReactState(REACT_AGGRESSIVE); + events.ScheduleEvent(EVENT_SPELL_FROST_BOLT_SINGLE, 2000); + events.ScheduleEvent(EVENT_SPELL_FROST_BOLT_MULTI, 15000); + events.ScheduleEvent(EVENT_SPELL_DETONATE_MANA, 20000); + events.ScheduleEvent(EVENT_SECOND_PHASE_HEALTH_CHECK, 1000); + events.ScheduleEvent(EVENT_SPELL_SHADOW_FISSURE, 25000); + events.ScheduleEvent(EVENT_SPELL_FROST_BLAST, 45000); + if (Is25ManRaid()) + events.ScheduleEvent(EVENT_SPELL_CHAINS, 50000); + break; + case EVENT_SPELL_FROST_BOLT_SINGLE: + me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_FROST_BOLT_SINGLE_10, SPELL_FROST_BOLT_SINGLE_25), false); + events.RepeatEvent(urand(2000, 15000)); + break; + case EVENT_SPELL_FROST_BOLT_MULTI: + me->CastSpell(me, RAID_MODE(SPELL_FROST_BOLT_MULTI_10, SPELL_FROST_BOLT_MULTI_25), false); + events.RepeatEvent(24000); + break; + case EVENT_SPELL_SHADOW_FISSURE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + me->CastSpell(target, SPELL_SHADOW_FISURE, false); + events.RepeatEvent(25000); + break; + case EVENT_SPELL_FROST_BLAST: + if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1,0), 0, true)) + me->CastSpell(target, SPELL_FROST_BLAST, false); + + if (!urand(0,2)) + Talk(SAY_FROST_BLAST); + events.RepeatEvent(45000); + break; + case EVENT_SPELL_CHAINS: + for (uint8 i = 0; i < 3; ++i) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true, -SPELL_CHAINS_OF_KELTHUZAD)) + me->CastSpell(target, SPELL_CHAINS_OF_KELTHUZAD, true); - if (!urand(0,2)) - Talk(SAY_CHAIN); - events.RepeatEvent(50000); - break; - case EVENT_SPELL_DETONATE_MANA: - { - std::vector unitList; - ThreatContainer::StorageType const& threatList = me->getThreatManager().getThreatList(); - for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) - { - if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER - && (*itr)->getTarget()->getPowerType() == POWER_MANA - && (*itr)->getTarget()->GetPower(POWER_MANA)) - unitList.push_back((*itr)->getTarget()); - } + if (!urand(0,2)) + Talk(SAY_CHAIN); + events.RepeatEvent(50000); + break; + case EVENT_SPELL_DETONATE_MANA: + { + std::vector unitList; + ThreatContainer::StorageType const& threatList = me->getThreatManager().getThreatList(); + for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + { + if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER + && (*itr)->getTarget()->getPowerType() == POWER_MANA + && (*itr)->getTarget()->GetPower(POWER_MANA)) + unitList.push_back((*itr)->getTarget()); + } - if (!unitList.empty()) - { - std::vector::iterator itr = unitList.begin(); - advance(itr, urand(0, unitList.size()-1)); - me->CastSpell(*itr, SPELL_DETONATE_MANA, false); - if (!urand(0,2)) - Talk(SAY_SPECIAL); - } + if (!unitList.empty()) + { + std::vector::iterator itr = unitList.begin(); + advance(itr, urand(0, unitList.size()-1)); + me->CastSpell(*itr, SPELL_DETONATE_MANA, false); + if (!urand(0,2)) + Talk(SAY_SPECIAL); + } - events.RepeatEvent(30000); - break; - } - case EVENT_SECOND_PHASE_HEALTH_CHECK: - if (me->HealthBelowPct(45)) - { - events.PopEvent(); - Talk(SAY_REQUEST_AID); - events.DelayEvents(5500); - events.ScheduleEvent(EVENT_THIRD_PHASE_LICH_KING_SAY, 5000); - break; - } - events.RepeatEvent(1000); - break; - case EVENT_THIRD_PHASE_LICH_KING_SAY: - if (pInstance) - if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_LICH_KING_BOSS))) - cr->AI()->Talk(SAY_ANSWER_REQUEST); + events.RepeatEvent(30000); + break; + } + case EVENT_SECOND_PHASE_HEALTH_CHECK: + if (me->HealthBelowPct(45)) + { + events.PopEvent(); + Talk(SAY_REQUEST_AID); + events.DelayEvents(5500); + events.ScheduleEvent(EVENT_THIRD_PHASE_LICH_KING_SAY, 5000); + break; + } + events.RepeatEvent(1000); + break; + case EVENT_THIRD_PHASE_LICH_KING_SAY: + if (pInstance) + if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_LICH_KING_BOSS))) + cr->AI()->Talk(SAY_ANSWER_REQUEST); - for (uint8 i = 0 ; i < RAID_MODE(2,4); ++i) - events.ScheduleEvent(EVENT_SUMMON_GUARDIAN_OF_ICECROWN, 10000+(i*5000)); - events.PopEvent(); - break; - case EVENT_SUMMON_GUARDIAN_OF_ICECROWN: - me->MonsterTextEmote("A Guardian of Icecrown enter the fight!", 0, true); - if (Creature* cr = me->SummonCreature(NPC_GUARDIAN_OF_ICECROWN, SummonPositions[RAND(0, 1, 3, 4)])) - cr->AI()->AttackStart(me->GetVictim()); + for (uint8 i = 0 ; i < RAID_MODE(2,4); ++i) + events.ScheduleEvent(EVENT_SUMMON_GUARDIAN_OF_ICECROWN, 10000+(i*5000)); + events.PopEvent(); + break; + case EVENT_SUMMON_GUARDIAN_OF_ICECROWN: + me->MonsterTextEmote("A Guardian of Icecrown enter the fight!", 0, true); + if (Creature* cr = me->SummonCreature(NPC_GUARDIAN_OF_ICECROWN, SummonPositions[RAND(0, 1, 3, 4)])) + cr->AI()->AttackStart(me->GetVictim()); - events.PopEvent(); - break; - } + events.PopEvent(); + break; + } - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) - DoMeleeAttackIfReady(); - } - }; + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) + DoMeleeAttackIfReady(); + } + }; }; class boss_kelthuzad_minion : public CreatureScript @@ -413,158 +413,158 @@ public: return new boss_kelthuzad_minionAI (pCreature); } - struct boss_kelthuzad_minionAI : public ScriptedAI - { - boss_kelthuzad_minionAI(Creature* c) : ScriptedAI(c) - { - } + struct boss_kelthuzad_minionAI : public ScriptedAI + { + boss_kelthuzad_minionAI(Creature* c) : ScriptedAI(c) + { + } - EventMap events; - bool callHelp; + EventMap events; + bool callHelp; - void Reset() - { - me->SetNoCallAssistance(true); - callHelp = true; - events.Reset(); - } + void Reset() + { + me->SetNoCallAssistance(true); + callHelp = true; + events.Reset(); + } - void DoAction(int32 param) - { - if (param == ACTION_CALL_HELP_ON) - callHelp = true; - else if (param == ACTION_CALL_HELP_OFF) - callHelp = false; - else if (param == ACTION_SECOND_PHASE) - { - if (!me->IsInCombat()) - me->DespawnOrUnsummon(500); - } - } + void DoAction(int32 param) + { + if (param == ACTION_CALL_HELP_ON) + callHelp = true; + else if (param == ACTION_CALL_HELP_OFF) + callHelp = false; + else if (param == ACTION_SECOND_PHASE) + { + if (!me->IsInCombat()) + me->DespawnOrUnsummon(500); + } + } - void MoveInLineOfSight(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER && !who->IsPet()) - return; + void MoveInLineOfSight(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER && !who->IsPet()) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void JustDied(Unit* ) - { - if (me->GetEntry() == NPC_UNSTOPPABLE_ABOMINATION && me->GetInstanceScript()) - me->GetInstanceScript()->SetData(DATA_ABOMINATION_KILLED, 0); - } + void JustDied(Unit* ) + { + if (me->GetEntry() == NPC_UNSTOPPABLE_ABOMINATION && me->GetInstanceScript()) + me->GetInstanceScript()->SetData(DATA_ABOMINATION_KILLED, 0); + } - void AttackStart(Unit* who) - { - ScriptedAI::AttackStart(who); - if (callHelp) - { - std::list targets; - me->GetCreaturesWithEntryInRange(targets, 15.0f, me->GetEntry()); - for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) - { - if ((*itr)->GetGUID() != me->GetGUID()) - { - (*itr)->ToCreature()->AI()->DoAction(ACTION_CALL_HELP_OFF); - (*itr)->ToCreature()->AI()->AttackStart(who); - } - } - } + void AttackStart(Unit* who) + { + ScriptedAI::AttackStart(who); + if (callHelp) + { + std::list targets; + me->GetCreaturesWithEntryInRange(targets, 15.0f, me->GetEntry()); + for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + { + if ((*itr)->GetGUID() != me->GetGUID()) + { + (*itr)->ToCreature()->AI()->DoAction(ACTION_CALL_HELP_OFF); + (*itr)->ToCreature()->AI()->AttackStart(who); + } + } + } - if (me->GetEntry() != NPC_UNSTOPPABLE_ABOMINATION && me->GetEntry() != NPC_GUARDIAN_OF_ICECROWN) - me->AddThreat(who, 1000000.0f); - } + if (me->GetEntry() != NPC_UNSTOPPABLE_ABOMINATION && me->GetEntry() != NPC_GUARDIAN_OF_ICECROWN) + me->AddThreat(who, 1000000.0f); + } - void EnterCombat(Unit* who) - { - me->SetInCombatWithZone(); - if (me->GetEntry() == NPC_UNSTOPPABLE_ABOMINATION) - { - events.ScheduleEvent(EVENT_MINION_SPELL_FRENZY, 1000); - events.ScheduleEvent(EVENT_MINION_SPELL_MORTAL_WOUND, 5000); - } - else if (me->GetEntry() == NPC_GUARDIAN_OF_ICECROWN) - events.ScheduleEvent(EVENT_MINION_SPELL_BLOOD_TAP, 15000); - } + void EnterCombat(Unit* who) + { + me->SetInCombatWithZone(); + if (me->GetEntry() == NPC_UNSTOPPABLE_ABOMINATION) + { + events.ScheduleEvent(EVENT_MINION_SPELL_FRENZY, 1000); + events.ScheduleEvent(EVENT_MINION_SPELL_MORTAL_WOUND, 5000); + } + else if (me->GetEntry() == NPC_GUARDIAN_OF_ICECROWN) + events.ScheduleEvent(EVENT_MINION_SPELL_BLOOD_TAP, 15000); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript()) - me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript()) + me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_MINION_SPELL_MORTAL_WOUND: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); - events.RepeatEvent(15000); - break; - case EVENT_MINION_SPELL_FRENZY: - if (me->HealthBelowPct(35)) - { - me->CastSpell(me, SPELL_FRENZY, true); - events.PopEvent(); - break; - } - events.RepeatEvent(1000); - break; - case EVENT_MINION_SPELL_BLOOD_TAP: - me->CastSpell(me->GetVictim(), SPELL_BLOOD_TAP, false); - events.RepeatEvent(15000); - break; - } + switch (events.GetEvent()) + { + case EVENT_MINION_SPELL_MORTAL_WOUND: + me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); + events.RepeatEvent(15000); + break; + case EVENT_MINION_SPELL_FRENZY: + if (me->HealthBelowPct(35)) + { + me->CastSpell(me, SPELL_FRENZY, true); + events.PopEvent(); + break; + } + events.RepeatEvent(1000); + break; + case EVENT_MINION_SPELL_BLOOD_TAP: + me->CastSpell(me->GetVictim(), SPELL_BLOOD_TAP, false); + events.RepeatEvent(15000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_kelthuzad_frost_blast : public SpellScriptLoader { - public: - spell_kelthuzad_frost_blast() : SpellScriptLoader("spell_kelthuzad_frost_blast") { } + public: + spell_kelthuzad_frost_blast() : SpellScriptLoader("spell_kelthuzad_frost_blast") { } - class spell_kelthuzad_frost_blast_SpellScript : public SpellScript - { - PrepareSpellScript(spell_kelthuzad_frost_blast_SpellScript); + class spell_kelthuzad_frost_blast_SpellScript : public SpellScript + { + PrepareSpellScript(spell_kelthuzad_frost_blast_SpellScript); - void FilterTargets(std::list& targets) - { - Unit* caster = GetCaster(); - if (!caster || !caster->ToCreature()) - return; + void FilterTargets(std::list& targets) + { + Unit* caster = GetCaster(); + if (!caster || !caster->ToCreature()) + return; - std::list tmplist; - for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) - if (!(*itr)->ToUnit()->HasAura(SPELL_FROST_BLAST)) - tmplist.push_back(*itr); + std::list tmplist; + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + if (!(*itr)->ToUnit()->HasAura(SPELL_FROST_BLAST)) + tmplist.push_back(*itr); - targets.clear(); - for (std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr) - targets.push_back(*itr); - } + targets.clear(); + for (std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr) + targets.push_back(*itr); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kelthuzad_frost_blast_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kelthuzad_frost_blast_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_kelthuzad_frost_blast_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_kelthuzad_frost_blast_SpellScript(); + } }; class spell_kelthuzad_detonate_mana : public SpellScriptLoader @@ -610,8 +610,8 @@ class spell_kelthuzad_detonate_mana : public SpellScriptLoader void AddSC_boss_kelthuzad() { - new boss_kelthuzad(); - new boss_kelthuzad_minion(); - new spell_kelthuzad_frost_blast(); - new spell_kelthuzad_detonate_mana(); + new boss_kelthuzad(); + new boss_kelthuzad_minion(); + new spell_kelthuzad_frost_blast(); + new spell_kelthuzad_detonate_mana(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp index 2a7af5d21..3b82192f4 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp @@ -8,21 +8,21 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_NECROTIC_AURA = 55593, - SPELL_SUMMON_SPORE = 29234, - SPELL_DEATHBLOOM_10 = 29865, - SPELL_DEATHBLOOM_25 = 55053, - SPELL_INEVITABLE_DOOM_10 = 29204, - SPELL_INEVITABLE_DOOM_25 = 55052, - SPELL_BERSERK = 26662, + SPELL_NECROTIC_AURA = 55593, + SPELL_SUMMON_SPORE = 29234, + SPELL_DEATHBLOOM_10 = 29865, + SPELL_DEATHBLOOM_25 = 55053, + SPELL_INEVITABLE_DOOM_10 = 29204, + SPELL_INEVITABLE_DOOM_25 = 55052, + SPELL_BERSERK = 26662, }; enum Events { - EVENT_SPELL_NECROTIC_AURA = 1, - EVENT_SPELL_DEATHBLOOM = 2, - EVENT_SPELL_INEVITABLE_DOOM = 3, - EVENT_SPELL_BERSERK = 4, + EVENT_SPELL_NECROTIC_AURA = 1, + EVENT_SPELL_DEATHBLOOM = 2, + EVENT_SPELL_INEVITABLE_DOOM = 3, + EVENT_SPELL_BERSERK = 4, }; enum Texts @@ -42,96 +42,96 @@ public: return new boss_loathebAI (pCreature); } - struct boss_loathebAI : public ScriptedAI - { - boss_loathebAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceScript(); - } + struct boss_loathebAI : public ScriptedAI + { + boss_loathebAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - if (pInstance) - { - pInstance->SetData(EVENT_LOATHEB, NOT_STARTED); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_LOATHEB_GATE))) - go->SetGoState(GO_STATE_ACTIVE); - } - } + void Reset() + { + events.Reset(); + if (pInstance) + { + pInstance->SetData(EVENT_LOATHEB, NOT_STARTED); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_LOATHEB_GATE))) + go->SetGoState(GO_STATE_ACTIVE); + } + } - void JustSummoned(Creature* cr) { cr->SetInCombatWithZone(); } + void JustSummoned(Creature* cr) { cr->SetInCombatWithZone(); } - void SummonedCreatureDies(Creature* cr, Unit*) - { - if (pInstance) - pInstance->SetData(DATA_SPORE_KILLED, 0); - } + void SummonedCreatureDies(Creature* cr, Unit*) + { + if (pInstance) + pInstance->SetData(DATA_SPORE_KILLED, 0); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void EnterCombat(Unit *who) - { - if (pInstance) - { - pInstance->SetData(EVENT_LOATHEB, IN_PROGRESS); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_LOATHEB_GATE))) - go->SetGoState(GO_STATE_READY); - } + void EnterCombat(Unit *who) + { + if (pInstance) + { + pInstance->SetData(EVENT_LOATHEB, IN_PROGRESS); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_LOATHEB_GATE))) + go->SetGoState(GO_STATE_READY); + } - me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_SPELL_NECROTIC_AURA, 0); - events.ScheduleEvent(EVENT_SPELL_DEATHBLOOM, 25000); - events.ScheduleEvent(EVENT_SPELL_INEVITABLE_DOOM, 120000); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 720000); - } + me->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_SPELL_NECROTIC_AURA, 0); + events.ScheduleEvent(EVENT_SPELL_DEATHBLOOM, 25000); + events.ScheduleEvent(EVENT_SPELL_INEVITABLE_DOOM, 120000); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 720000); + } - void JustDied(Unit* Killer) - { - if (pInstance) - pInstance->SetData(EVENT_LOATHEB, DONE); - } + void JustDied(Unit* Killer) + { + if (pInstance) + pInstance->SetData(EVENT_LOATHEB, DONE); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_NECROTIC_AURA: - me->CastSpell(me, SPELL_NECROTIC_AURA, true); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_DEATHBLOOM: - me->CastSpell(me, SPELL_SUMMON_SPORE, true); - me->CastSpell(me, RAID_MODE(SPELL_DEATHBLOOM_10, SPELL_DEATHBLOOM_25), false); - events.RepeatEvent(30000); - break; - case EVENT_SPELL_INEVITABLE_DOOM: - me->CastSpell(me, RAID_MODE(SPELL_INEVITABLE_DOOM_10, SPELL_INEVITABLE_DOOM_25), false); - events.RepeatEvent(events.GetTimer() < 5*MINUTE*IN_MILLISECONDS ? 30000 : 15000); - break; - case EVENT_SPELL_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - break; - } + switch (events.GetEvent()) + { + case EVENT_SPELL_NECROTIC_AURA: + me->CastSpell(me, SPELL_NECROTIC_AURA, true); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_DEATHBLOOM: + me->CastSpell(me, SPELL_SUMMON_SPORE, true); + me->CastSpell(me, RAID_MODE(SPELL_DEATHBLOOM_10, SPELL_DEATHBLOOM_25), false); + events.RepeatEvent(30000); + break; + case EVENT_SPELL_INEVITABLE_DOOM: + me->CastSpell(me, RAID_MODE(SPELL_INEVITABLE_DOOM_10, SPELL_INEVITABLE_DOOM_25), false); + events.RepeatEvent(events.GetTimer() < 5*MINUTE*IN_MILLISECONDS ? 30000 : 15000); + break; + case EVENT_SPELL_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_loatheb_necrotic_aura_warning : public SpellScriptLoader @@ -145,14 +145,14 @@ class spell_loatheb_necrotic_aura_warning : public SpellScriptLoader void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Creature* target = GetTarget()->ToCreature(); + Creature* target = GetTarget()->ToCreature(); if (target->IsAIEnabled) target->AI()->Talk(SAY_NECROTIC_AURA_APPLIED); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Creature* target = GetTarget()->ToCreature(); + Creature* target = GetTarget()->ToCreature(); if (target->IsAIEnabled) target->AI()->Talk(SAY_NECROTIC_AURA_REMOVED); } @@ -173,5 +173,5 @@ class spell_loatheb_necrotic_aura_warning : public SpellScriptLoader void AddSC_boss_loatheb() { new boss_loatheb(); - new spell_loatheb_necrotic_aura_warning(); + new spell_loatheb_necrotic_aura_warning(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp index a07ad9275..5ca0f55f4 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp @@ -9,31 +9,31 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_WEB_WRAP = 28622, - SPELL_WEB_SPRAY_10 = 29484, - SPELL_WEB_SPRAY_25 = 54125, - SPELL_POISON_SHOCK_10 = 28741, - SPELL_POISON_SHOCK_25 = 54122, - SPELL_NECROTIC_POISON_10 = 54121, - SPELL_NECROTIC_POISON_25 = 28776, - SPELL_FRENZY_10 = 54123, - SPELL_FRENZY_25 = 54124, + SPELL_WEB_WRAP = 28622, + SPELL_WEB_SPRAY_10 = 29484, + SPELL_WEB_SPRAY_25 = 54125, + SPELL_POISON_SHOCK_10 = 28741, + SPELL_POISON_SHOCK_25 = 54122, + SPELL_NECROTIC_POISON_10 = 54121, + SPELL_NECROTIC_POISON_25 = 28776, + SPELL_FRENZY_10 = 54123, + SPELL_FRENZY_25 = 54124, }; enum Events { - EVENT_SPELL_WEB_SPRAY = 1, - EVENT_SPELL_POISON_SHOCK = 2, - EVENT_SPELL_NECROTIC_POISON = 3, - EVENT_WEB_WRAP = 4, - EVENT_HEALTH_CHECK = 5, - EVENT_SUMMON_SPIDERLINGS = 6, + EVENT_SPELL_WEB_SPRAY = 1, + EVENT_SPELL_POISON_SHOCK = 2, + EVENT_SPELL_NECROTIC_POISON = 3, + EVENT_WEB_WRAP = 4, + EVENT_HEALTH_CHECK = 5, + EVENT_SUMMON_SPIDERLINGS = 6, }; enum Misc { - NPC_WEB_WRAP = 16486, - NPC_MAEXXNA_SPIDERLING = 17055, + NPC_WEB_WRAP = 16486, + NPC_MAEXXNA_SPIDERLING = 17055, }; const Position PosWrap[3] = @@ -53,146 +53,146 @@ public: return new boss_maexxnaAI (pCreature); } - struct boss_maexxnaAI : public ScriptedAI - { - boss_maexxnaAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = me->GetInstanceScript(); - } + struct boss_maexxnaAI : public ScriptedAI + { + boss_maexxnaAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = me->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; + InstanceScript* pInstance; + EventMap events; + SummonList summons; - bool IsInRoom() - { - if (me->GetExactDist(3486.6f, -3890.6f, 291.8f) > 100.0f) - { - EnterEvadeMode(); - return false; - } + bool IsInRoom() + { + if (me->GetExactDist(3486.6f, -3890.6f, 291.8f) > 100.0f) + { + EnterEvadeMode(); + return false; + } - return true; - } + return true; + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); + void Reset() + { + events.Reset(); + summons.DespawnAll(); - if (pInstance) - { - pInstance->SetData(EVENT_MAEXXNA, NOT_STARTED); - if (pInstance->GetData(EVENT_FAERLINA) == DONE) - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_MAEXXNA_GATE))) - go->SetGoState(GO_STATE_ACTIVE); - } - } + if (pInstance) + { + pInstance->SetData(EVENT_MAEXXNA, NOT_STARTED); + if (pInstance->GetData(EVENT_FAERLINA) == DONE) + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_MAEXXNA_GATE))) + go->SetGoState(GO_STATE_ACTIVE); + } + } - void EnterCombat(Unit *who) - { - me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_WEB_WRAP, 20000); - events.ScheduleEvent(EVENT_SPELL_WEB_SPRAY, 40000); - events.ScheduleEvent(EVENT_SPELL_POISON_SHOCK, 10000); - events.ScheduleEvent(EVENT_SPELL_NECROTIC_POISON, 5000); - events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); - events.ScheduleEvent(EVENT_SUMMON_SPIDERLINGS, 30000); + void EnterCombat(Unit *who) + { + me->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_WEB_WRAP, 20000); + events.ScheduleEvent(EVENT_SPELL_WEB_SPRAY, 40000); + events.ScheduleEvent(EVENT_SPELL_POISON_SHOCK, 10000); + events.ScheduleEvent(EVENT_SPELL_NECROTIC_POISON, 5000); + events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); + events.ScheduleEvent(EVENT_SUMMON_SPIDERLINGS, 30000); - if (pInstance) - { - pInstance->SetData(EVENT_MAEXXNA, IN_PROGRESS); - if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_MAEXXNA_GATE))) - go->SetGoState(GO_STATE_READY); - } - } + if (pInstance) + { + pInstance->SetData(EVENT_MAEXXNA, IN_PROGRESS); + if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetData64(DATA_MAEXXNA_GATE))) + go->SetGoState(GO_STATE_READY); + } + } - void JustDied(Unit* Killer) - { - if (pInstance) - pInstance->SetData(EVENT_MAEXXNA, DONE); - } + void JustDied(Unit* Killer) + { + if (pInstance) + pInstance->SetData(EVENT_MAEXXNA, DONE); + } - void JustSummoned(Creature* cr) - { - if (cr->GetEntry() == NPC_MAEXXNA_SPIDERLING) - { - cr->SetInCombatWithZone(); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - cr->AI()->AttackStart(target); - } + void JustSummoned(Creature* cr) + { + if (cr->GetEntry() == NPC_MAEXXNA_SPIDERLING) + { + cr->SetInCombatWithZone(); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + cr->AI()->AttackStart(target); + } - summons.Summon(cr); - } + summons.Summon(cr); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void UpdateAI(uint32 diff) - { - if (!IsInRoom()) - return; + void UpdateAI(uint32 diff) + { + if (!IsInRoom()) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_WEB_SPRAY: - me->MonsterTextEmote("%s sprays strands of web everywhere!", 0, true); - me->CastSpell(me, RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25), true); - events.RepeatEvent(40000); - break; - case EVENT_SPELL_POISON_SHOCK: - me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_POISON_SHOCK_10, SPELL_POISON_SHOCK_25), false); - events.RepeatEvent(40000); - break; - case EVENT_SPELL_NECROTIC_POISON: - me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_NECROTIC_POISON_10, SPELL_NECROTIC_POISON_25), false); - events.RepeatEvent(30000); - break; - case EVENT_SUMMON_SPIDERLINGS: - me->MonsterTextEmote("Spiderlings appear on the web!", 0, true); - for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(NPC_MAEXXNA_SPIDERLING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - events.RepeatEvent(40000); - break; - case EVENT_HEALTH_CHECK: - if (me->GetHealthPct() < 30) - { - me->CastSpell(me, RAID_MODE(SPELL_FRENZY_10, SPELL_FRENZY_25), true); - events.PopEvent(); - break; - } + switch (events.GetEvent()) + { + case EVENT_SPELL_WEB_SPRAY: + me->MonsterTextEmote("%s sprays strands of web everywhere!", 0, true); + me->CastSpell(me, RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25), true); + events.RepeatEvent(40000); + break; + case EVENT_SPELL_POISON_SHOCK: + me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_POISON_SHOCK_10, SPELL_POISON_SHOCK_25), false); + events.RepeatEvent(40000); + break; + case EVENT_SPELL_NECROTIC_POISON: + me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_NECROTIC_POISON_10, SPELL_NECROTIC_POISON_25), false); + events.RepeatEvent(30000); + break; + case EVENT_SUMMON_SPIDERLINGS: + me->MonsterTextEmote("Spiderlings appear on the web!", 0, true); + for (uint8 i = 0; i < 8; ++i) + me->SummonCreature(NPC_MAEXXNA_SPIDERLING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + events.RepeatEvent(40000); + break; + case EVENT_HEALTH_CHECK: + if (me->GetHealthPct() < 30) + { + me->CastSpell(me, RAID_MODE(SPELL_FRENZY_10, SPELL_FRENZY_25), true); + events.PopEvent(); + break; + } - events.RepeatEvent(1000); - break; - case EVENT_WEB_WRAP: - me->MonsterTextEmote("%s spins her web into a cocoon!", 0, true); - for (uint8 i = 0; i < RAID_MODE(1,2); ++i) - if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP)) - { - target->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25)); - uint8 pos = urand(0,2); + events.RepeatEvent(1000); + break; + case EVENT_WEB_WRAP: + me->MonsterTextEmote("%s spins her web into a cocoon!", 0, true); + for (uint8 i = 0; i < RAID_MODE(1,2); ++i) + if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP)) + { + target->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10, SPELL_WEB_SPRAY_25)); + uint8 pos = urand(0,2); - target->GetMotionMaster()->MoveJump(PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20); - if (Creature *wrap = me->SummonCreature(NPC_WEB_WRAP, PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) - wrap->AI()->SetGUID(target->GetGUID()); - } - events.RepeatEvent(40000); - break; - } + target->GetMotionMaster()->MoveJump(PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20); + if (Creature *wrap = me->SummonCreature(NPC_WEB_WRAP, PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) + wrap->AI()->SetGUID(target->GetGUID()); + } + events.RepeatEvent(40000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; @@ -206,31 +206,31 @@ public: return new boss_maexxna_webwrapAI (pCreature); } - struct boss_maexxna_webwrapAI : public NullCreatureAI - { - boss_maexxna_webwrapAI(Creature *c) : NullCreatureAI(c), victimGUID(0) {} + struct boss_maexxna_webwrapAI : public NullCreatureAI + { + boss_maexxna_webwrapAI(Creature *c) : NullCreatureAI(c), victimGUID(0) {} - uint64 victimGUID; - void SetGUID(uint64 guid, int32 param) - { - victimGUID = guid; - if (me->m_spells[0] && victimGUID) - if (Unit *victim = ObjectAccessor::GetUnit(*me, victimGUID)) - victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID()); - } + uint64 victimGUID; + void SetGUID(uint64 guid, int32 param) + { + victimGUID = guid; + if (me->m_spells[0] && victimGUID) + if (Unit *victim = ObjectAccessor::GetUnit(*me, victimGUID)) + victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID()); + } - void JustDied(Unit *killer) - { - if (me->m_spells[0] && victimGUID) - if (Unit *victim = ObjectAccessor::GetUnit(*me, victimGUID)) - victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID()); - } - }; + void JustDied(Unit *killer) + { + if (me->m_spells[0] && victimGUID) + if (Unit *victim = ObjectAccessor::GetUnit(*me, victimGUID)) + victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID()); + } + }; }; void AddSC_boss_maexxna() { - new boss_maexxna(); - new boss_maexxna_webwrap(); + new boss_maexxna(); + new boss_maexxna_webwrap(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp index da2372f92..58553c3c9 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp @@ -16,33 +16,33 @@ enum Says enum Spells { - SPELL_CURSE_OF_THE_PLAGUEBRINGER_10 = 29213, - SPELL_CURSE_OF_THE_PLAGUEBRINGER_25 = 54835, - SPELL_CRIPPLE_10 = 29212, - SPELL_CRIPPLE_25 = 54814, - SPELL_SUMMON_PLAGUED_WARRIORS = 29237, - SPELL_TELEPORT = 29216, - SPELL_BLINK = 29208, + SPELL_CURSE_OF_THE_PLAGUEBRINGER_10 = 29213, + SPELL_CURSE_OF_THE_PLAGUEBRINGER_25 = 54835, + SPELL_CRIPPLE_10 = 29212, + SPELL_CRIPPLE_25 = 54814, + SPELL_SUMMON_PLAGUED_WARRIORS = 29237, + SPELL_TELEPORT = 29216, + SPELL_BLINK = 29208, }; enum Events { - EVENT_SPELL_CURSE = 1, - EVENT_SPELL_CRIPPLE = 2, - EVENT_SUMMON_PLAGUED_WARRIOR_ANNOUNCE = 3, - EVENT_MOVE_TO_BALCONY = 4, - EVENT_SPELL_BLINK = 5, - EVENT_MOVE_TO_GROUND = 6, - EVENT_SUMMON_PLAGUED_WARRIOR_REAL = 7, - EVENT_BALCONY_SUMMON_ANNOUNCE = 8, - EVENT_BALCONY_SUMMON_REAL = 9, + EVENT_SPELL_CURSE = 1, + EVENT_SPELL_CRIPPLE = 2, + EVENT_SUMMON_PLAGUED_WARRIOR_ANNOUNCE = 3, + EVENT_MOVE_TO_BALCONY = 4, + EVENT_SPELL_BLINK = 5, + EVENT_MOVE_TO_GROUND = 6, + EVENT_SUMMON_PLAGUED_WARRIOR_REAL = 7, + EVENT_BALCONY_SUMMON_ANNOUNCE = 8, + EVENT_BALCONY_SUMMON_REAL = 9, }; enum Misc { - NPC_PLAGUED_WARRIOR = 16984, - NPC_PLAGUED_CHAMPION = 16983, - NPC_PLAGUED_GUARDIAN = 16981, + NPC_PLAGUED_WARRIOR = 16984, + NPC_PLAGUED_CHAMPION = 16983, + NPC_PLAGUED_GUARDIAN = 16981, }; const Position summoningPosition[5] = @@ -66,187 +66,187 @@ public: return new boss_nothAI (pCreature); } - struct boss_nothAI : public ScriptedAI - { - boss_nothAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = me->GetInstanceScript(); - } + struct boss_nothAI : public ScriptedAI + { + boss_nothAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = me->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint8 totalPhase; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint8 totalPhase; - void StartGroundPhase() - { - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(false, UNIT_STATE_ROOT); + void StartGroundPhase() + { + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetControlled(false, UNIT_STATE_ROOT); - events.Reset(); - events.ScheduleEvent(EVENT_MOVE_TO_BALCONY, (totalPhase < 2 ? 110000 : (110000 / totalPhase))); - events.ScheduleEvent(EVENT_SPELL_CURSE, 15000); - events.ScheduleEvent(EVENT_SUMMON_PLAGUED_WARRIOR_ANNOUNCE, 25000); - if (Is25ManRaid()) - events.ScheduleEvent(EVENT_SPELL_BLINK, 26000); - } + events.Reset(); + events.ScheduleEvent(EVENT_MOVE_TO_BALCONY, (totalPhase < 2 ? 110000 : (110000 / totalPhase))); + events.ScheduleEvent(EVENT_SPELL_CURSE, 15000); + events.ScheduleEvent(EVENT_SUMMON_PLAGUED_WARRIOR_ANNOUNCE, 25000); + if (Is25ManRaid()) + events.ScheduleEvent(EVENT_SPELL_BLINK, 26000); + } - void StartBalconyPhase() - { - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + void StartBalconyPhase() + { + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - events.Reset(); - events.ScheduleEvent(EVENT_BALCONY_SUMMON_ANNOUNCE, 4000); - events.ScheduleEvent(EVENT_MOVE_TO_GROUND, 70000); - } + events.Reset(); + events.ScheduleEvent(EVENT_BALCONY_SUMMON_ANNOUNCE, 4000); + events.ScheduleEvent(EVENT_MOVE_TO_GROUND, 70000); + } - void SummonHelper(uint32 entry, uint32 count) - { - for (uint8 i = 0; i < count; ++i) - me->SummonCreature(entry, summoningPosition[urand(0,4)]); - } + void SummonHelper(uint32 entry, uint32 count) + { + for (uint8 i = 0; i < count; ++i) + me->SummonCreature(entry, summoningPosition[urand(0,4)]); + } - bool IsInRoom() - { - if (me->GetPositionX() > 2730 || me->GetPositionX() < 2614 || me->GetPositionY() > -3455 || me->GetPositionY() < -3553) - { - EnterEvadeMode(); - return false; - } + bool IsInRoom() + { + if (me->GetPositionX() > 2730 || me->GetPositionX() < 2614 || me->GetPositionY() > -3455 || me->GetPositionY() < -3553) + { + EnterEvadeMode(); + return false; + } - return true; - } + return true; + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - me->SetControlled(false, UNIT_STATE_ROOT); - me->SetReactState(REACT_AGGRESSIVE); - totalPhase = 0; + void Reset() + { + events.Reset(); + summons.DespawnAll(); + me->SetControlled(false, UNIT_STATE_ROOT); + me->SetReactState(REACT_AGGRESSIVE); + totalPhase = 0; - if (pInstance) - pInstance->SetData(EVENT_NOTH, NOT_STARTED); - } + if (pInstance) + pInstance->SetData(EVENT_NOTH, NOT_STARTED); + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + ScriptedAI::EnterEvadeMode(); + } - void EnterCombat(Unit *who) - { - Talk(SAY_AGGRO); - if (pInstance) - pInstance->SetData(EVENT_NOTH, IN_PROGRESS); + void EnterCombat(Unit *who) + { + Talk(SAY_AGGRO); + if (pInstance) + pInstance->SetData(EVENT_NOTH, IN_PROGRESS); - StartGroundPhase(); - } + StartGroundPhase(); + } - void JustSummoned(Creature *summon) - { - summons.Summon(summon); - summon->SetInCombatWithZone(); - } + void JustSummoned(Creature *summon) + { + summons.Summon(summon); + summon->SetInCombatWithZone(); + } - void JustDied(Unit* Killer) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(EVENT_NOTH, DONE); - } + void JustDied(Unit* Killer) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(EVENT_NOTH, DONE); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (!urand(0,3)) - Talk(SAY_SLAY); + if (!urand(0,3)) + Talk(SAY_SLAY); - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void UpdateAI(uint32 diff) - { - if (!IsInRoom()) - return; + void UpdateAI(uint32 diff) + { + if (!IsInRoom()) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - // GROUND - case EVENT_SPELL_CURSE: - me->CastCustomSpell(RAID_MODE(SPELL_CURSE_OF_THE_PLAGUEBRINGER_10, SPELL_CURSE_OF_THE_PLAGUEBRINGER_25), SPELLVALUE_MAX_TARGETS, RAID_MODE(3, 10), me, false); - events.RepeatEvent(25000); - break; - case EVENT_SUMMON_PLAGUED_WARRIOR_ANNOUNCE: - me->MonsterTextEmote("Noth the Plaguebringer summons forth Skeletal Warriors!", 0, true); - Talk(SAY_SUMMON); - events.RepeatEvent(25000); - events.ScheduleEvent(EVENT_SUMMON_PLAGUED_WARRIOR_REAL, 4000); - break; - case EVENT_SUMMON_PLAGUED_WARRIOR_REAL: - me->CastSpell(me, SPELL_SUMMON_PLAGUED_WARRIORS, true); - SummonHelper(NPC_PLAGUED_WARRIOR, RAID_MODE(2,3)); - events.PopEvent(); - break; - case EVENT_MOVE_TO_BALCONY: - me->MonsterTextEmote("%s teleports to the balcony above!", 0, true); - me->CastSpell(me, SPELL_TELEPORT, true); - StartBalconyPhase(); - //events.PopEvent(); events.Reset()!! - break; - case EVENT_SPELL_BLINK: - DoResetThreat(); - me->MonsterTextEmote("%s blinks away!", 0, true); - me->CastSpell(me, RAID_MODE(SPELL_CRIPPLE_10, SPELL_CRIPPLE_25), false); - me->CastSpell(me, SPELL_BLINK, true); - events.RepeatEvent(30000); - break; - // BALCONY - case EVENT_BALCONY_SUMMON_ANNOUNCE: - me->MonsterTextEmote("%s raises more skeletons!", 0, true); - events.RepeatEvent(25000); - events.ScheduleEvent(EVENT_BALCONY_SUMMON_REAL, 4000); - break; - case EVENT_BALCONY_SUMMON_REAL: - me->CastSpell(me, SPELL_SUMMON_PLAGUED_WARRIORS, true); // visual only - if (totalPhase == 0) - SummonHelper(NPC_PLAGUED_CHAMPION, RAID_MODE(2,4)); - else if (totalPhase == 1) - { - SummonHelper(NPC_PLAGUED_CHAMPION, RAID_MODE(1,2)); - SummonHelper(NPC_PLAGUED_GUARDIAN, RAID_MODE(1,2)); - } - else - SummonHelper(NPC_PLAGUED_GUARDIAN, RAID_MODE(2,4)); - events.PopEvent(); - break; - case EVENT_MOVE_TO_GROUND: - me->MonsterTextEmote("%s teleports back into the battle!", 0, true); - totalPhase++; - StartGroundPhase(); - me->NearTeleportTo(nothPosition.GetPositionX(), nothPosition.GetPositionY(), nothPosition.GetPositionZ(), nothPosition.GetOrientation(), true); - events.PopEvent(); - break; - } + switch (events.GetEvent()) + { + // GROUND + case EVENT_SPELL_CURSE: + me->CastCustomSpell(RAID_MODE(SPELL_CURSE_OF_THE_PLAGUEBRINGER_10, SPELL_CURSE_OF_THE_PLAGUEBRINGER_25), SPELLVALUE_MAX_TARGETS, RAID_MODE(3, 10), me, false); + events.RepeatEvent(25000); + break; + case EVENT_SUMMON_PLAGUED_WARRIOR_ANNOUNCE: + me->MonsterTextEmote("Noth the Plaguebringer summons forth Skeletal Warriors!", 0, true); + Talk(SAY_SUMMON); + events.RepeatEvent(25000); + events.ScheduleEvent(EVENT_SUMMON_PLAGUED_WARRIOR_REAL, 4000); + break; + case EVENT_SUMMON_PLAGUED_WARRIOR_REAL: + me->CastSpell(me, SPELL_SUMMON_PLAGUED_WARRIORS, true); + SummonHelper(NPC_PLAGUED_WARRIOR, RAID_MODE(2,3)); + events.PopEvent(); + break; + case EVENT_MOVE_TO_BALCONY: + me->MonsterTextEmote("%s teleports to the balcony above!", 0, true); + me->CastSpell(me, SPELL_TELEPORT, true); + StartBalconyPhase(); + //events.PopEvent(); events.Reset()!! + break; + case EVENT_SPELL_BLINK: + DoResetThreat(); + me->MonsterTextEmote("%s blinks away!", 0, true); + me->CastSpell(me, RAID_MODE(SPELL_CRIPPLE_10, SPELL_CRIPPLE_25), false); + me->CastSpell(me, SPELL_BLINK, true); + events.RepeatEvent(30000); + break; + // BALCONY + case EVENT_BALCONY_SUMMON_ANNOUNCE: + me->MonsterTextEmote("%s raises more skeletons!", 0, true); + events.RepeatEvent(25000); + events.ScheduleEvent(EVENT_BALCONY_SUMMON_REAL, 4000); + break; + case EVENT_BALCONY_SUMMON_REAL: + me->CastSpell(me, SPELL_SUMMON_PLAGUED_WARRIORS, true); // visual only + if (totalPhase == 0) + SummonHelper(NPC_PLAGUED_CHAMPION, RAID_MODE(2,4)); + else if (totalPhase == 1) + { + SummonHelper(NPC_PLAGUED_CHAMPION, RAID_MODE(1,2)); + SummonHelper(NPC_PLAGUED_GUARDIAN, RAID_MODE(1,2)); + } + else + SummonHelper(NPC_PLAGUED_GUARDIAN, RAID_MODE(2,4)); + events.PopEvent(); + break; + case EVENT_MOVE_TO_GROUND: + me->MonsterTextEmote("%s teleports back into the battle!", 0, true); + totalPhase++; + StartGroundPhase(); + me->NearTeleportTo(nothPosition.GetPositionX(), nothPosition.GetPositionY(), nothPosition.GetPositionZ(), nothPosition.GetOrientation(), true); + events.PopEvent(); + break; + } - if (me->HasReactState(REACT_AGGRESSIVE)) - DoMeleeAttackIfReady(); - } - }; + if (me->HasReactState(REACT_AGGRESSIVE)) + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_noth() diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp index 2f48ed24e..e79250933 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp @@ -17,24 +17,24 @@ enum Yells enum Spells { - SPELL_HATEFUL_STRIKE_10 = 41926, - SPELL_HATEFUL_STRIKE_25 = 59192, - SPELL_FRENZY = 28131, - SPELL_BERSERK = 26662, - SPELL_SLIME_BOLT = 32309, + SPELL_HATEFUL_STRIKE_10 = 41926, + SPELL_HATEFUL_STRIKE_25 = 59192, + SPELL_FRENZY = 28131, + SPELL_BERSERK = 26662, + SPELL_SLIME_BOLT = 32309, }; enum Events { - EVENT_HEALTH_CHECK = 1, - EVENT_SPELL_HATEFUL_STRIKE = 2, - EVENT_SPELL_SLIME_BOLT = 3, - EVENT_SPELL_BERSERK = 4, + EVENT_HEALTH_CHECK = 1, + EVENT_SPELL_HATEFUL_STRIKE = 2, + EVENT_SPELL_SLIME_BOLT = 3, + EVENT_SPELL_BERSERK = 4, }; enum Misc { - ACHIEV_TIMED_START_EVENT = 10286, + ACHIEV_TIMED_START_EVENT = 10286, }; class boss_patchwerk : public CreatureScript @@ -47,139 +47,139 @@ public: return new boss_patchwerkAI (pCreature); } - struct boss_patchwerkAI : public ScriptedAI - { - boss_patchwerkAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceScript(); - } + struct boss_patchwerkAI : public ScriptedAI + { + boss_patchwerkAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - EventMap events; - InstanceScript* pInstance; + EventMap events; + InstanceScript* pInstance; - void Reset() - { - events.Reset(); - if (pInstance) - pInstance->SetData(EVENT_PATCHWERK, NOT_STARTED); - } + void Reset() + { + events.Reset(); + if (pInstance) + pInstance->SetData(EVENT_PATCHWERK, NOT_STARTED); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (!urand(0,3)) - Talk(SAY_SLAY); + if (!urand(0,3)) + Talk(SAY_SLAY); - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void JustDied(Unit* Killer) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(EVENT_PATCHWERK, DONE); - } + void JustDied(Unit* Killer) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(EVENT_PATCHWERK, DONE); + } - void EnterCombat(Unit *who) - { - Talk(SAY_AGGRO); - - me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_SPELL_HATEFUL_STRIKE, 1200); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 360000); - events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); + void EnterCombat(Unit *who) + { + Talk(SAY_AGGRO); + + me->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_SPELL_HATEFUL_STRIKE, 1200); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 360000); + events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); - if (pInstance) - { + if (pInstance) + { pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - pInstance->SetData(EVENT_PATCHWERK, IN_PROGRESS); - } - } + pInstance->SetData(EVENT_PATCHWERK, IN_PROGRESS); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_HATEFUL_STRIKE: - { - //Cast Hateful strike on the player with the highest - //amount of HP within melee distance, and second threat amount - std::list meleeRangeTargets; - Unit* finalTarget = NULL; - uint8 counter = 0; - - ThreatContainer::StorageType::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i, ++counter) - { - // Gather all units with melee range - Unit *target = (*i)->getTarget(); - if (me->IsWithinMeleeRange(target)) - meleeRangeTargets.push_back(target); + switch (events.GetEvent()) + { + case EVENT_SPELL_HATEFUL_STRIKE: + { + //Cast Hateful strike on the player with the highest + //amount of HP within melee distance, and second threat amount + std::list meleeRangeTargets; + Unit* finalTarget = NULL; + uint8 counter = 0; + + ThreatContainer::StorageType::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i, ++counter) + { + // Gather all units with melee range + Unit *target = (*i)->getTarget(); + if (me->IsWithinMeleeRange(target)) + meleeRangeTargets.push_back(target); - // and add threat to most hated - if (counter < RAID_MODE(2,3)) - me->AddThreat(target, 500.0f); - } + // and add threat to most hated + if (counter < RAID_MODE(2,3)) + me->AddThreat(target, 500.0f); + } - counter = 0; - for (std::list::const_iterator i = meleeRangeTargets.begin(); i != meleeRangeTargets.end(); ++i, ++counter) - { - // if there is only one target available - if (meleeRangeTargets.size() == 1) - finalTarget = (*i); - else if (counter > 0) // skip first target - { - if (!finalTarget || (*i)->GetHealth() > finalTarget->GetHealth()) - finalTarget = (*i); + counter = 0; + for (std::list::const_iterator i = meleeRangeTargets.begin(); i != meleeRangeTargets.end(); ++i, ++counter) + { + // if there is only one target available + if (meleeRangeTargets.size() == 1) + finalTarget = (*i); + else if (counter > 0) // skip first target + { + if (!finalTarget || (*i)->GetHealth() > finalTarget->GetHealth()) + finalTarget = (*i); - // third loop - if (counter >= 2) - break; - } - } + // third loop + if (counter >= 2) + break; + } + } - if (finalTarget) - me->CastSpell(finalTarget, RAID_MODE(SPELL_HATEFUL_STRIKE_10, SPELL_HATEFUL_STRIKE_25), false); + if (finalTarget) + me->CastSpell(finalTarget, RAID_MODE(SPELL_HATEFUL_STRIKE_10, SPELL_HATEFUL_STRIKE_25), false); - events.RepeatEvent(1000); - break; - } - case EVENT_SPELL_BERSERK: - Talk(EMOTE_BERSERK); - me->CastSpell(me, SPELL_BERSERK, true); - events.ScheduleEvent(EVENT_SPELL_SLIME_BOLT, 2000); - events.PopEvent(); - break; - case EVENT_SPELL_SLIME_BOLT: - me->CastSpell(me, SPELL_SLIME_BOLT, false); - events.RepeatEvent(3000); - break; - case EVENT_HEALTH_CHECK: - if (me->GetHealthPct() <= 5) - { - Talk(EMOTE_ENRAGE); - me->CastSpell(me, SPELL_FRENZY, true); - events.PopEvent(); - break; - } - events.RepeatEvent(1000); - break; + events.RepeatEvent(1000); + break; + } + case EVENT_SPELL_BERSERK: + Talk(EMOTE_BERSERK); + me->CastSpell(me, SPELL_BERSERK, true); + events.ScheduleEvent(EVENT_SPELL_SLIME_BOLT, 2000); + events.PopEvent(); + break; + case EVENT_SPELL_SLIME_BOLT: + me->CastSpell(me, SPELL_SLIME_BOLT, false); + events.RepeatEvent(3000); + break; + case EVENT_HEALTH_CHECK: + if (me->GetHealthPct() <= 5) + { + Talk(EMOTE_ENRAGE); + me->CastSpell(me, SPELL_FRENZY, true); + events.PopEvent(); + break; + } + events.RepeatEvent(1000); + break; - } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_patchwerk() diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp index cac79fccb..3ccbbb572 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp @@ -8,46 +8,46 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Sounds { - SOUND_AGGRO_1 = 8852, - SOUND_AGGRO_2 = 8853, - SOUND_AGGRO_3 = 8854, - SOUND_SLAY = 8861, - SOUND_COMMAND_1 = 8855, - SOUND_COMMAND_2 = 8856, - SOUND_COMMAND_3 = 8858, - SOUND_COMMAND_4 = 8859, - SOUND_COMMAND_5 = 8861, - SOUND_DEATH = 8860, + SOUND_AGGRO_1 = 8852, + SOUND_AGGRO_2 = 8853, + SOUND_AGGRO_3 = 8854, + SOUND_SLAY = 8861, + SOUND_COMMAND_1 = 8855, + SOUND_COMMAND_2 = 8856, + SOUND_COMMAND_3 = 8858, + SOUND_COMMAND_4 = 8859, + SOUND_COMMAND_5 = 8861, + SOUND_DEATH = 8860, }; enum Spells { - SPELL_UNBALANCING_STRIKE = 26613, - SPELL_DISRUPTING_SHOUT_10 = 29107, - SPELL_DISRUPTING_SHOUT_25 = 55543, - SPELL_JAGGED_KNIFE = 55550, - SPELL_HOPELESS = 29125, + SPELL_UNBALANCING_STRIKE = 26613, + SPELL_DISRUPTING_SHOUT_10 = 29107, + SPELL_DISRUPTING_SHOUT_25 = 55543, + SPELL_JAGGED_KNIFE = 55550, + SPELL_HOPELESS = 29125, - SPELL_BONE_BARRIER = 29061, - SPELL_BLOOD_STRIKE = 61696, + SPELL_BONE_BARRIER = 29061, + SPELL_BLOOD_STRIKE = 61696, }; enum Events { - EVENT_SPELL_UNBALANCING_STRIKE = 1, - EVENT_SPELL_DISRUPTING_SHOUT = 2, - EVENT_SPELL_JAGGED_KNIFE = 3, - EVENT_PLAY_COMMAND = 4, + EVENT_SPELL_UNBALANCING_STRIKE = 1, + EVENT_SPELL_DISRUPTING_SHOUT = 2, + EVENT_SPELL_JAGGED_KNIFE = 3, + EVENT_PLAY_COMMAND = 4, - EVENT_MINION_BLOOD_STRIKE = 10, - EVENT_MINION_BONE_BARRIER = 11, + EVENT_MINION_BLOOD_STRIKE = 10, + EVENT_MINION_BONE_BARRIER = 11, }; enum Misc { - NPC_DEATH_KNIGHT_UNDERSTUDY = 16803, - NPC_RAZUVIOUS = 16061, + NPC_DEATH_KNIGHT_UNDERSTUDY = 16803, + NPC_RAZUVIOUS = 16061, }; class boss_razuvious : public CreatureScript @@ -60,147 +60,147 @@ public: return new boss_razuviousAI (pCreature); } - struct boss_razuviousAI : public ScriptedAI - { - boss_razuviousAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = me->GetInstanceScript(); - } + struct boss_razuviousAI : public ScriptedAI + { + boss_razuviousAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = me->GetInstanceScript(); + } - EventMap events; - SummonList summons; - InstanceScript* pInstance; + EventMap events; + SummonList summons; + InstanceScript* pInstance; - void SpawnHelpers() - { - me->SummonCreature(NPC_DEATH_KNIGHT_UNDERSTUDY, 2782.45f, -3088.03f, 267.685f, 0.75f); - me->SummonCreature(NPC_DEATH_KNIGHT_UNDERSTUDY, 2778.56f, -3113.74f, 267.685f, 5.28f); - if (Is25ManRaid()) - { - me->SummonCreature(NPC_DEATH_KNIGHT_UNDERSTUDY, 2762.23f, -3085.07f, 267.685f, 1.95f); - me->SummonCreature(NPC_DEATH_KNIGHT_UNDERSTUDY, 2758.24f, -3110.97f, 267.685f, 3.94f); - } - } + void SpawnHelpers() + { + me->SummonCreature(NPC_DEATH_KNIGHT_UNDERSTUDY, 2782.45f, -3088.03f, 267.685f, 0.75f); + me->SummonCreature(NPC_DEATH_KNIGHT_UNDERSTUDY, 2778.56f, -3113.74f, 267.685f, 5.28f); + if (Is25ManRaid()) + { + me->SummonCreature(NPC_DEATH_KNIGHT_UNDERSTUDY, 2762.23f, -3085.07f, 267.685f, 1.95f); + me->SummonCreature(NPC_DEATH_KNIGHT_UNDERSTUDY, 2758.24f, -3110.97f, 267.685f, 3.94f); + } + } - void JustSummoned(Creature* cr) { summons.Summon(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } - void Reset() - { - summons.DespawnAll(); - events.Reset(); - SpawnHelpers(); - if (pInstance) - pInstance->SetData(EVENT_RAZUVIOUS, NOT_STARTED); - } + void Reset() + { + summons.DespawnAll(); + events.Reset(); + SpawnHelpers(); + if (pInstance) + pInstance->SetData(EVENT_RAZUVIOUS, NOT_STARTED); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (!urand(0,3)) - { - DoPlaySoundToSet(me, SOUND_SLAY); - me->MonsterYell("You should've stayed home!", LANG_UNIVERSAL, 0); - } + if (!urand(0,3)) + { + DoPlaySoundToSet(me, SOUND_SLAY); + me->MonsterYell("You should've stayed home!", LANG_UNIVERSAL, 0); + } - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) - { - // Damage done by the controlled Death Knight understudies should also count toward damage done by players - if(who && who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_DEATH_KNIGHT_UNDERSTUDY) - me->LowerPlayerDamageReq(damage); - } + void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) + { + // Damage done by the controlled Death Knight understudies should also count toward damage done by players + if(who && who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_DEATH_KNIGHT_UNDERSTUDY) + me->LowerPlayerDamageReq(damage); + } - void JustDied(Unit* killer) - { - DoPlaySoundToSet(me, SOUND_DEATH); - me->MonsterYell("An honorable... death...", LANG_UNIVERSAL, 0); - - me->CastSpell(me, SPELL_HOPELESS, true); - if (pInstance) - pInstance->SetData(EVENT_RAZUVIOUS, DONE); - } + void JustDied(Unit* killer) + { + DoPlaySoundToSet(me, SOUND_DEATH); + me->MonsterYell("An honorable... death...", LANG_UNIVERSAL, 0); + + me->CastSpell(me, SPELL_HOPELESS, true); + if (pInstance) + pInstance->SetData(EVENT_RAZUVIOUS, DONE); + } - void EnterCombat(Unit *who) - { - switch (urand(0,2)) - { - case 0: - DoPlaySoundToSet(me, SOUND_AGGRO_1); - me->MonsterYell("Hah hah, I'm just getting warmed up!", LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_AGGRO_2); - me->MonsterYell("Stand and fight!", LANG_UNIVERSAL, 0); - break; - case 2: - DoPlaySoundToSet(me, SOUND_AGGRO_3); - me->MonsterYell("Show me what you've got!", LANG_UNIVERSAL, 0); - break; - } + void EnterCombat(Unit *who) + { + switch (urand(0,2)) + { + case 0: + DoPlaySoundToSet(me, SOUND_AGGRO_1); + me->MonsterYell("Hah hah, I'm just getting warmed up!", LANG_UNIVERSAL, 0); + break; + case 1: + DoPlaySoundToSet(me, SOUND_AGGRO_2); + me->MonsterYell("Stand and fight!", LANG_UNIVERSAL, 0); + break; + case 2: + DoPlaySoundToSet(me, SOUND_AGGRO_3); + me->MonsterYell("Show me what you've got!", LANG_UNIVERSAL, 0); + break; + } - events.ScheduleEvent(EVENT_SPELL_UNBALANCING_STRIKE, 30000); - events.ScheduleEvent(EVENT_SPELL_DISRUPTING_SHOUT, 25000); - events.ScheduleEvent(EVENT_SPELL_JAGGED_KNIFE, 15000); - events.ScheduleEvent(EVENT_PLAY_COMMAND, 40000); - if (pInstance) - pInstance->SetData(EVENT_RAZUVIOUS, IN_PROGRESS); + events.ScheduleEvent(EVENT_SPELL_UNBALANCING_STRIKE, 30000); + events.ScheduleEvent(EVENT_SPELL_DISRUPTING_SHOUT, 25000); + events.ScheduleEvent(EVENT_SPELL_JAGGED_KNIFE, 15000); + events.ScheduleEvent(EVENT_PLAY_COMMAND, 40000); + if (pInstance) + pInstance->SetData(EVENT_RAZUVIOUS, IN_PROGRESS); - summons.DoZoneInCombat(); - } + summons.DoZoneInCombat(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_UNBALANCING_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_UNBALANCING_STRIKE, false); - events.RepeatEvent(30000); - break; - case EVENT_SPELL_DISRUPTING_SHOUT: - me->CastSpell(me, RAID_MODE(SPELL_DISRUPTING_SHOUT_10, SPELL_DISRUPTING_SHOUT_25), false); - events.RepeatEvent(25000); - break; - case EVENT_SPELL_JAGGED_KNIFE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) - me->CastSpell(target, SPELL_JAGGED_KNIFE, false); + switch (events.GetEvent()) + { + case EVENT_SPELL_UNBALANCING_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_UNBALANCING_STRIKE, false); + events.RepeatEvent(30000); + break; + case EVENT_SPELL_DISRUPTING_SHOUT: + me->CastSpell(me, RAID_MODE(SPELL_DISRUPTING_SHOUT_10, SPELL_DISRUPTING_SHOUT_25), false); + events.RepeatEvent(25000); + break; + case EVENT_SPELL_JAGGED_KNIFE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) + me->CastSpell(target, SPELL_JAGGED_KNIFE, false); - events.RepeatEvent(25000); - break; - case EVENT_PLAY_COMMAND: - switch (urand(0,2)) - { - case 0: - DoPlaySoundToSet(me, SOUND_COMMAND_1); - me->MonsterYell("Do as I taught you!", LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_COMMAND_2); - me->MonsterYell("Show them no mercy!", LANG_UNIVERSAL, 0); - break; - case 2: - DoPlaySoundToSet(me, SOUND_COMMAND_3); - me->MonsterYell("You disappoint me, students!", LANG_UNIVERSAL, 0); - break; - } - events.RepeatEvent(40000); - break; - } + events.RepeatEvent(25000); + break; + case EVENT_PLAY_COMMAND: + switch (urand(0,2)) + { + case 0: + DoPlaySoundToSet(me, SOUND_COMMAND_1); + me->MonsterYell("Do as I taught you!", LANG_UNIVERSAL, 0); + break; + case 1: + DoPlaySoundToSet(me, SOUND_COMMAND_2); + me->MonsterYell("Show them no mercy!", LANG_UNIVERSAL, 0); + break; + case 2: + DoPlaySoundToSet(me, SOUND_COMMAND_3); + me->MonsterYell("You disappoint me, students!", LANG_UNIVERSAL, 0); + break; + } + events.RepeatEvent(40000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_razuvious_minion : public CreatureScript @@ -213,68 +213,68 @@ public: return new boss_razuvious_minionAI (pCreature); } - struct boss_razuvious_minionAI : public ScriptedAI - { - boss_razuvious_minionAI(Creature *c) : ScriptedAI(c) - { - } + struct boss_razuvious_minionAI : public ScriptedAI + { + boss_razuvious_minionAI(Creature *c) : ScriptedAI(c) + { + } - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (me->GetInstanceScript()) - me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (me->GetInstanceScript()) + me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0); + } - void EnterCombat(Unit *who) - { - if (Creature* cr = me->FindNearestCreature(NPC_RAZUVIOUS, 100.0f)) - { - cr->SetInCombatWithZone(); - cr->AI()->AttackStart(who); - } + void EnterCombat(Unit *who) + { + if (Creature* cr = me->FindNearestCreature(NPC_RAZUVIOUS, 100.0f)) + { + cr->SetInCombatWithZone(); + cr->AI()->AttackStart(who); + } - events.ScheduleEvent(EVENT_MINION_BLOOD_STRIKE, 4000); - events.ScheduleEvent(EVENT_MINION_BONE_BARRIER, 9000); - } + events.ScheduleEvent(EVENT_MINION_BLOOD_STRIKE, 4000); + events.ScheduleEvent(EVENT_MINION_BONE_BARRIER, 9000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING) || me->IsCharmed()) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING) || me->IsCharmed()) + return; - switch (events.GetEvent()) - { - case EVENT_MINION_BLOOD_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_BLOOD_STRIKE, false); - events.RepeatEvent(8000); - break; - case EVENT_MINION_BONE_BARRIER: - me->CastSpell(me, SPELL_BONE_BARRIER, true); - events.RepeatEvent(40000); - break; - } + switch (events.GetEvent()) + { + case EVENT_MINION_BLOOD_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_BLOOD_STRIKE, false); + events.RepeatEvent(8000); + break; + case EVENT_MINION_BONE_BARRIER: + me->CastSpell(me, SPELL_BONE_BARRIER, true); + events.RepeatEvent(40000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_razuvious() { new boss_razuvious(); - new boss_razuvious_minion(); + new boss_razuvious_minion(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index f64cd1f5d..3b55f2adf 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -18,53 +18,53 @@ enum Yells enum Spells { - // Fight - SPELL_FROST_AURA_10 = 28531, - SPELL_FROST_AURA_25 = 55799, - SPELL_CLEAVE = 19983, - SPELL_TAIL_SWEEP_10 = 55697, - SPELL_TAIL_SWEEP_25 = 55696, - SPELL_SUMMON_BLIZZARD = 28560, - SPELL_LIFE_DRAIN_10 = 28542, - SPELL_LIFE_DRAIN_25 = 55665, - SPELL_BERSERK = 26662, + // Fight + SPELL_FROST_AURA_10 = 28531, + SPELL_FROST_AURA_25 = 55799, + SPELL_CLEAVE = 19983, + SPELL_TAIL_SWEEP_10 = 55697, + SPELL_TAIL_SWEEP_25 = 55696, + SPELL_SUMMON_BLIZZARD = 28560, + SPELL_LIFE_DRAIN_10 = 28542, + SPELL_LIFE_DRAIN_25 = 55665, + SPELL_BERSERK = 26662, - // Ice block - SPELL_ICEBOLT_CAST = 28526, - SPELL_ICEBOLT_TRIGGER = 28522, - SPELL_FROST_MISSILE = 30101, - SPELL_FROST_EXPLOSION = 28524, + // Ice block + SPELL_ICEBOLT_CAST = 28526, + SPELL_ICEBOLT_TRIGGER = 28522, + SPELL_FROST_MISSILE = 30101, + SPELL_FROST_EXPLOSION = 28524, - // Visuals - SPELL_SAPPHIRON_DIES = 29357, + // Visuals + SPELL_SAPPHIRON_DIES = 29357, }; enum Misc { - GO_ICE_BLOCK = 181247, - NPC_BLIZZARD = 16474, + GO_ICE_BLOCK = 181247, + NPC_BLIZZARD = 16474, - POINT_CENTER = 1, - FAKE_POINTER = 1, + POINT_CENTER = 1, + FAKE_POINTER = 1, }; enum Events { - //EVENT_SAPPHIRON_BIRTH = 1, - EVENT_BERSERK = 2, - EVENT_SPELL_CLEAVE = 3, - EVENT_SPELL_TAIL_SWEEP = 4, - EVENT_SPELL_LIFE_DRAIN = 5, - EVENT_SPELL_BLIZZARD = 6, - EVENT_FLIGHT_START = 7, - EVENT_FLIGHT_LIFTOFF = 8, - EVENT_FLIGHT_ICEBOLT = 9, - EVENT_FLIGHT_BREATH = 10, - EVENT_FLIGHT_SPELL_EXPLOSION = 11, - EVENT_FLIGHT_START_LAND = 12, - EVENT_LAND = 13, - EVENT_GROUND = 14, - EVENT_HUNDRED_CLUB = 15, + //EVENT_SAPPHIRON_BIRTH = 1, + EVENT_BERSERK = 2, + EVENT_SPELL_CLEAVE = 3, + EVENT_SPELL_TAIL_SWEEP = 4, + EVENT_SPELL_LIFE_DRAIN = 5, + EVENT_SPELL_BLIZZARD = 6, + EVENT_FLIGHT_START = 7, + EVENT_FLIGHT_LIFTOFF = 8, + EVENT_FLIGHT_ICEBOLT = 9, + EVENT_FLIGHT_BREATH = 10, + EVENT_FLIGHT_SPELL_EXPLOSION = 11, + EVENT_FLIGHT_START_LAND = 12, + EVENT_LAND = 13, + EVENT_GROUND = 14, + EVENT_HUNDRED_CLUB = 15, }; class boss_sapphiron : public CreatureScript @@ -77,362 +77,362 @@ public: return new boss_sapphironAI (pCreature); } - struct boss_sapphironAI : public ScriptedAI - { - boss_sapphironAI(Creature* c) : ScriptedAI(c) - { - pInstance = me->GetInstanceScript(); - } + struct boss_sapphironAI : public ScriptedAI + { + boss_sapphironAI(Creature* c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - EventMap events; - InstanceScript* pInstance; - uint8 iceboltCount; - uint32 spawnTimer; - std::list blockList; - uint64 currentTarget; + EventMap events; + InstanceScript* pInstance; + uint8 iceboltCount; + uint32 spawnTimer; + std::list blockList; + uint64 currentTarget; - void InitializeAI() - { - me->SummonGameObject(GO_SAPPHIRON_BIRTH, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, 0, 0, 0, 0, 0); - me->SetVisible(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - ScriptedAI::InitializeAI(); - } + void InitializeAI() + { + me->SummonGameObject(GO_SAPPHIRON_BIRTH, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, 0, 0, 0, 0, 0); + me->SetVisible(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + ScriptedAI::InitializeAI(); + } - bool IsInRoom() - { - if (me->GetExactDist(3523.5f, -5235.3f, 137.6f) > 100.0f) - { - EnterEvadeMode(); - return false; - } + bool IsInRoom() + { + if (me->GetExactDist(3523.5f, -5235.3f, 137.6f) > 100.0f) + { + EnterEvadeMode(); + return false; + } - return true; - } + return true; + } - void Reset() - { - if (me->IsVisible()) - me->SetReactState(REACT_AGGRESSIVE); + void Reset() + { + if (me->IsVisible()) + me->SetReactState(REACT_AGGRESSIVE); - events.Reset(); - iceboltCount = 0; - spawnTimer = 0; - currentTarget = 0; - blockList.clear(); + events.Reset(); + iceboltCount = 0; + spawnTimer = 0; + currentTarget = 0; + blockList.clear(); - if (pInstance) - pInstance->SetData(EVENT_SAPPHIRON, NOT_STARTED); - } + if (pInstance) + pInstance->SetData(EVENT_SAPPHIRON, NOT_STARTED); + } - void EnterCombatSelfFunction() - { - Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); - if (PlList.isEmpty()) - return; - for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) - { - if (Player* player = i->GetSource()) - { - if (player->IsGameMaster()) - continue; - if (player->IsAlive() && me->GetDistance(player) < 80.0f) - { - me->SetInCombatWith(player); - player->SetInCombatWith(me); - me->AddThreat(player, 0.0f); - } - } - } - } + void EnterCombatSelfFunction() + { + Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); + if (PlList.isEmpty()) + return; + for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) + { + if (Player* player = i->GetSource()) + { + if (player->IsGameMaster()) + continue; + if (player->IsAlive() && me->GetDistance(player) < 80.0f) + { + me->SetInCombatWith(player); + player->SetInCombatWith(me); + me->AddThreat(player, 0.0f); + } + } + } + } - void EnterCombat(Unit *who) - { - EnterCombatSelfFunction(); - me->CastSpell(me, RAID_MODE(SPELL_FROST_AURA_10, SPELL_FROST_AURA_25), true); + void EnterCombat(Unit *who) + { + EnterCombatSelfFunction(); + me->CastSpell(me, RAID_MODE(SPELL_FROST_AURA_10, SPELL_FROST_AURA_25), true); - events.ScheduleEvent(EVENT_BERSERK, 15*60000); - events.ScheduleEvent(EVENT_SPELL_CLEAVE, 5000); - events.ScheduleEvent(EVENT_SPELL_TAIL_SWEEP, 10000); - events.ScheduleEvent(EVENT_SPELL_LIFE_DRAIN, 17000); - events.ScheduleEvent(EVENT_SPELL_BLIZZARD, 21000); - events.ScheduleEvent(EVENT_FLIGHT_START, 45000); - events.ScheduleEvent(EVENT_HUNDRED_CLUB, 5000); + events.ScheduleEvent(EVENT_BERSERK, 15*60000); + events.ScheduleEvent(EVENT_SPELL_CLEAVE, 5000); + events.ScheduleEvent(EVENT_SPELL_TAIL_SWEEP, 10000); + events.ScheduleEvent(EVENT_SPELL_LIFE_DRAIN, 17000); + events.ScheduleEvent(EVENT_SPELL_BLIZZARD, 21000); + events.ScheduleEvent(EVENT_FLIGHT_START, 45000); + events.ScheduleEvent(EVENT_HUNDRED_CLUB, 5000); - if (pInstance) - pInstance->SetData(EVENT_SAPPHIRON, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(EVENT_SAPPHIRON, IN_PROGRESS); + } - void JustDied(Unit* who) - { - me->CastSpell(me, SPELL_SAPPHIRON_DIES, true); - if (pInstance) - pInstance->SetData(EVENT_SAPPHIRON, DONE); - } + void JustDied(Unit* who) + { + me->CastSpell(me, SPELL_SAPPHIRON_DIES, true); + if (pInstance) + pInstance->SetData(EVENT_SAPPHIRON, DONE); + } - void DoAction(int32 param) - { - if (param == ACTION_SAPPHIRON_BIRTH) - spawnTimer = 1; - } + void DoAction(int32 param) + { + if (param == ACTION_SAPPHIRON_BIRTH) + spawnTimer = 1; + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == POINT_CENTER) - events.ScheduleEvent(EVENT_FLIGHT_LIFTOFF, 500); - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == POINT_CENTER) + events.ScheduleEvent(EVENT_FLIGHT_LIFTOFF, 500); + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_ICEBOLT_CAST) - { - me->CastSpell(target, SPELL_ICEBOLT_TRIGGER, true); - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_ICEBOLT_CAST) + { + me->CastSpell(target, SPELL_ICEBOLT_TRIGGER, true); + } + } - bool IsValidExplosionTarget(WorldObject* target) - { - for (std::list::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr) - { - if (target->GetGUID() == (*itr)) - return false; + bool IsValidExplosionTarget(WorldObject* target) + { + for (std::list::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr) + { + if (target->GetGUID() == (*itr)) + return false; - if (Unit* block = ObjectAccessor::GetUnit(*me, *itr)) - { - if (block->IsInBetween(me, target, 2.0f) && block->IsWithinDist(target, 10.0f)) - return false; - } - } + if (Unit* block = ObjectAccessor::GetUnit(*me, *itr)) + { + if (block->IsInBetween(me, target, 2.0f) && block->IsWithinDist(target, 10.0f)) + return false; + } + } - return true; - } + return true; + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void UpdateAI(uint32 diff) - { - if (spawnTimer) - { - spawnTimer += diff; - if (spawnTimer >= 21500) - { - me->SetVisible(true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - spawnTimer = 0; - } - return; - } + void UpdateAI(uint32 diff) + { + if (spawnTimer) + { + spawnTimer += diff; + if (spawnTimer >= 21500) + { + me->SetVisible(true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + spawnTimer = 0; + } + return; + } - if (!IsInRoom()) - return; + if (!IsInRoom()) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_BERSERK: - Talk(EMOTE_ENRAGE); - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - return; - case EVENT_SPELL_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - events.RepeatEvent(10000); - return; - case EVENT_SPELL_TAIL_SWEEP: - me->CastSpell(me, RAID_MODE(SPELL_TAIL_SWEEP_10, SPELL_TAIL_SWEEP_25), false); - events.RepeatEvent(10000); - return; - case EVENT_SPELL_LIFE_DRAIN: - me->CastCustomSpell(RAID_MODE(SPELL_LIFE_DRAIN_10, SPELL_LIFE_DRAIN_25), SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5), me, false); - events.RepeatEvent(24000); - return; - case EVENT_SPELL_BLIZZARD: - { - Creature* cr; - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) - cr = me->SummonCreature(NPC_BLIZZARD, *target, TEMPSUMMON_TIMED_DESPAWN, 16000); - else - cr = me->SummonCreature(NPC_BLIZZARD, *me, TEMPSUMMON_TIMED_DESPAWN, 16000); - - if (cr) - cr->GetMotionMaster()->MoveRandom(40); - events.RepeatEvent(RAID_MODE(8000, 6500)); - return; - } - case EVENT_FLIGHT_START: - if (me->HealthBelowPct(11)) - { - events.PopEvent(); - return; - } - events.RepeatEvent(45000); - events.DelayEvents(35000); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(POINT_CENTER, x, y, z); - return; - case EVENT_FLIGHT_LIFTOFF: - me->GetMotionMaster()->MoveIdle(); - me->SendMeleeAttackStop(me->GetVictim()); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->SetDisableGravity(true); - currentTarget = 0; - events.PopEvent(); - events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, 3000); - iceboltCount = RAID_MODE(2, 3); - return; - case EVENT_FLIGHT_ICEBOLT: - { - events.PopEvent(); - if (currentTarget) - if (Unit* target = ObjectAccessor::GetUnit(*me, currentTarget)) - me->SummonGameObject(GO_ICE_BLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0); - - std::vector targets; - ThreatContainer::StorageType::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) - if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER) - { - bool inList = false; - if (!blockList.empty()) - for (std::list::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr) - if ((*i)->getTarget()->GetGUID() == *itr) - { - inList = true; - break; - } - - if (!inList) - targets.push_back((*i)->getTarget()); - } + switch (events.GetEvent()) + { + case EVENT_BERSERK: + Talk(EMOTE_ENRAGE); + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + return; + case EVENT_SPELL_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + events.RepeatEvent(10000); + return; + case EVENT_SPELL_TAIL_SWEEP: + me->CastSpell(me, RAID_MODE(SPELL_TAIL_SWEEP_10, SPELL_TAIL_SWEEP_25), false); + events.RepeatEvent(10000); + return; + case EVENT_SPELL_LIFE_DRAIN: + me->CastCustomSpell(RAID_MODE(SPELL_LIFE_DRAIN_10, SPELL_LIFE_DRAIN_25), SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5), me, false); + events.RepeatEvent(24000); + return; + case EVENT_SPELL_BLIZZARD: + { + Creature* cr; + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + cr = me->SummonCreature(NPC_BLIZZARD, *target, TEMPSUMMON_TIMED_DESPAWN, 16000); + else + cr = me->SummonCreature(NPC_BLIZZARD, *me, TEMPSUMMON_TIMED_DESPAWN, 16000); + + if (cr) + cr->GetMotionMaster()->MoveRandom(40); + events.RepeatEvent(RAID_MODE(8000, 6500)); + return; + } + case EVENT_FLIGHT_START: + if (me->HealthBelowPct(11)) + { + events.PopEvent(); + return; + } + events.RepeatEvent(45000); + events.DelayEvents(35000); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->GetMotionMaster()->MovePoint(POINT_CENTER, x, y, z); + return; + case EVENT_FLIGHT_LIFTOFF: + me->GetMotionMaster()->MoveIdle(); + me->SendMeleeAttackStop(me->GetVictim()); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->SetDisableGravity(true); + currentTarget = 0; + events.PopEvent(); + events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, 3000); + iceboltCount = RAID_MODE(2, 3); + return; + case EVENT_FLIGHT_ICEBOLT: + { + events.PopEvent(); + if (currentTarget) + if (Unit* target = ObjectAccessor::GetUnit(*me, currentTarget)) + me->SummonGameObject(GO_ICE_BLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0); + + std::vector targets; + ThreatContainer::StorageType::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) + if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER) + { + bool inList = false; + if (!blockList.empty()) + for (std::list::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr) + if ((*i)->getTarget()->GetGUID() == *itr) + { + inList = true; + break; + } + + if (!inList) + targets.push_back((*i)->getTarget()); + } - if (!targets.empty() && iceboltCount) - { - std::vector::iterator itr = targets.begin(); - advance(itr, urand(0, targets.size()-1)); - me->CastSpell(*itr, SPELL_ICEBOLT_CAST, false); - blockList.push_back((*itr)->GetGUID()); - currentTarget = (*itr)->GetGUID(); - --iceboltCount; - events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, (me->GetExactDist(*itr) / 13.0f)*IN_MILLISECONDS); - } - else - events.ScheduleEvent(EVENT_FLIGHT_BREATH, 1000); - return; - } - case EVENT_FLIGHT_BREATH: - currentTarget = 0; - Talk(EMOTE_BREATH); - me->CastSpell(me, SPELL_FROST_MISSILE, false); - events.ScheduleEvent(EVENT_FLIGHT_SPELL_EXPLOSION, 8500); - events.PopEvent(); - return; - case EVENT_FLIGHT_SPELL_EXPLOSION: + if (!targets.empty() && iceboltCount) + { + std::vector::iterator itr = targets.begin(); + advance(itr, urand(0, targets.size()-1)); + me->CastSpell(*itr, SPELL_ICEBOLT_CAST, false); + blockList.push_back((*itr)->GetGUID()); + currentTarget = (*itr)->GetGUID(); + --iceboltCount; + events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, (me->GetExactDist(*itr) / 13.0f)*IN_MILLISECONDS); + } + else + events.ScheduleEvent(EVENT_FLIGHT_BREATH, 1000); + return; + } + case EVENT_FLIGHT_BREATH: + currentTarget = 0; + Talk(EMOTE_BREATH); + me->CastSpell(me, SPELL_FROST_MISSILE, false); + events.ScheduleEvent(EVENT_FLIGHT_SPELL_EXPLOSION, 8500); + events.PopEvent(); + return; + case EVENT_FLIGHT_SPELL_EXPLOSION: me->CastSpell(me, SPELL_FROST_EXPLOSION, true); - events.PopEvent(); + events.PopEvent(); events.ScheduleEvent(EVENT_FLIGHT_START_LAND, 3000); return; - case EVENT_FLIGHT_START_LAND: - if (!blockList.empty()) - for (std::list::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr) - if (Unit* block = ObjectAccessor::GetUnit(*me, *itr)) - block->RemoveAurasDueToSpell(SPELL_ICEBOLT_TRIGGER); + case EVENT_FLIGHT_START_LAND: + if (!blockList.empty()) + for (std::list::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr) + if (Unit* block = ObjectAccessor::GetUnit(*me, *itr)) + block->RemoveAurasDueToSpell(SPELL_ICEBOLT_TRIGGER); - blockList.clear(); - me->RemoveAllGameObjects(); - events.ScheduleEvent(EVENT_LAND, 1000); - events.PopEvent(); - return; + blockList.clear(); + me->RemoveAllGameObjects(); + events.ScheduleEvent(EVENT_LAND, 1000); + events.PopEvent(); + return; case EVENT_LAND: me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->SetDisableGravity(false); - events.PopEvent(); + events.PopEvent(); events.ScheduleEvent(EVENT_GROUND, 1500); return; case EVENT_GROUND: - me->SetReactState(REACT_AGGRESSIVE); + me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); - events.PopEvent(); + events.PopEvent(); return; - case EVENT_HUNDRED_CLUB: - { - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - if (itr->GetSource()->GetResistance(SPELL_SCHOOL_FROST) > 100 && pInstance) - { - events.PopEvent(); - pInstance->SetData(DATA_HUNDRED_CLUB, 0); - return; - } + case EVENT_HUNDRED_CLUB: + { + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + if (itr->GetSource()->GetResistance(SPELL_SCHOOL_FROST) > 100 && pInstance) + { + events.PopEvent(); + pInstance->SetData(DATA_HUNDRED_CLUB, 0); + return; + } - } - events.RepeatEvent(5000); - return; - } - } + } + events.RepeatEvent(5000); + return; + } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_sapphiron_frost_explosion : public SpellScriptLoader { - public: - spell_sapphiron_frost_explosion() : SpellScriptLoader("spell_sapphiron_frost_explosion") { } + public: + spell_sapphiron_frost_explosion() : SpellScriptLoader("spell_sapphiron_frost_explosion") { } - class spell_sapphiron_frost_explosion_SpellScript : public SpellScript - { - PrepareSpellScript(spell_sapphiron_frost_explosion_SpellScript); + class spell_sapphiron_frost_explosion_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sapphiron_frost_explosion_SpellScript); - void FilterTargets(std::list& targets) - { - Unit* caster = GetCaster(); - if (!caster || !caster->ToCreature()) - return; + void FilterTargets(std::list& targets) + { + Unit* caster = GetCaster(); + if (!caster || !caster->ToCreature()) + return; - std::list tmplist; - for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) - { - if (CAST_AI(boss_sapphiron::boss_sapphironAI, caster->ToCreature()->AI())->IsValidExplosionTarget(*itr)) - tmplist.push_back(*itr); - } + std::list tmplist; + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + { + if (CAST_AI(boss_sapphiron::boss_sapphironAI, caster->ToCreature()->AI())->IsValidExplosionTarget(*itr)) + tmplist.push_back(*itr); + } - targets.clear(); - for (std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr) - targets.push_back(*itr); - } + targets.clear(); + for (std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr) + targets.push_back(*itr); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sapphiron_frost_explosion_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sapphiron_frost_explosion_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_sapphiron_frost_explosion_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_sapphiron_frost_explosion_SpellScript(); + } }; void AddSC_boss_sapphiron() { new boss_sapphiron(); - new spell_sapphiron_frost_explosion(); + new spell_sapphiron_frost_explosion(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index 8ffe668fc..0f092ee78 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -10,17 +10,17 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Says { - // Stalagg + // Stalagg SAY_STAL_AGGRO = 0, SAY_STAL_SLAY = 1, SAY_STAL_DEATH = 2, - // Feugen + // Feugen SAY_FEUG_AGGRO = 0, SAY_FEUG_SLAY = 1, SAY_FEUG_DEATH = 2, - // Thaddius + // Thaddius SAY_GREET = 0, SAY_AGGRO = 1, SAY_SLAY = 2, @@ -31,57 +31,57 @@ enum Says enum Spells { - SPELL_MAGNETIC_PULL = 28337, - SPELL_TESLA_SHOCK = 28099, + SPELL_MAGNETIC_PULL = 28337, + SPELL_TESLA_SHOCK = 28099, - // Stalagg - SPELL_POWER_SURGE_10 = 54529, - SPELL_POWER_SURGE_25 = 28134, - SPELL_STALAGG_CHAIN = 28096, + // Stalagg + SPELL_POWER_SURGE_10 = 54529, + SPELL_POWER_SURGE_25 = 28134, + SPELL_STALAGG_CHAIN = 28096, - // Feugen - SPELL_STATIC_FIELD_10 = 28135, - SPELL_STATIC_FIELD_25 = 54528, - SPELL_FEUGEN_CHAIN = 28111, + // Feugen + SPELL_STATIC_FIELD_10 = 28135, + SPELL_STATIC_FIELD_25 = 54528, + SPELL_FEUGEN_CHAIN = 28111, - // Thaddius - SPELL_POLARITY_SHIFT = 28089, - SPELL_BALL_LIGHTNING = 28299, - SPELL_CHAIN_LIGHTNING_10 = 28167, - SPELL_CHAIN_LIGHTNING_25 = 54531, - SPELL_BERSERK = 27680, + // Thaddius + SPELL_POLARITY_SHIFT = 28089, + SPELL_BALL_LIGHTNING = 28299, + SPELL_CHAIN_LIGHTNING_10 = 28167, + SPELL_CHAIN_LIGHTNING_25 = 54531, + SPELL_BERSERK = 27680, - SPELL_THADDIUS_VISUAL_LIGHTNING = 28136, - SPELL_THADDIUS_SPAWN_STUN = 28160, + SPELL_THADDIUS_VISUAL_LIGHTNING = 28136, + SPELL_THADDIUS_SPAWN_STUN = 28160, - SPELL_POSITIVE_CHARGE = 28062, - SPELL_POSITIVE_CHARGE_STACK = 29659, - SPELL_NEGATIVE_CHARGE = 28085, - SPELL_NEGATIVE_CHARGE_STACK = 29660, - SPELL_POSITIVE_POLARITY = 28059, - SPELL_NEGATIVE_POLARITY = 28084, + SPELL_POSITIVE_CHARGE = 28062, + SPELL_POSITIVE_CHARGE_STACK = 29659, + SPELL_NEGATIVE_CHARGE = 28085, + SPELL_NEGATIVE_CHARGE_STACK = 29660, + SPELL_POSITIVE_POLARITY = 28059, + SPELL_NEGATIVE_POLARITY = 28084, }; enum Events { - EVENT_MINION_SPELL_POWER_SURGE = 1, - EVENT_MINION_SPELL_MAGNETIC_PULL = 2, - EVENT_MINION_CHECK_DISTANCE = 3, - EVENT_MINION_SPELL_STATIC_FIELD = 4, + EVENT_MINION_SPELL_POWER_SURGE = 1, + EVENT_MINION_SPELL_MAGNETIC_PULL = 2, + EVENT_MINION_CHECK_DISTANCE = 3, + EVENT_MINION_SPELL_STATIC_FIELD = 4, - EVENT_THADDIUS_START = 10, - EVENT_THADDIUS_SPELL_CHAIN_LIGHTNING= 11, - EVENT_THADDIUS_SPELL_BERSERK = 12, - EVENT_THADDIUS_POLARITY_SHIFT = 13, - EVENT_THADDIUS_START_2 = 14, + EVENT_THADDIUS_START = 10, + EVENT_THADDIUS_SPELL_CHAIN_LIGHTNING= 11, + EVENT_THADDIUS_SPELL_BERSERK = 12, + EVENT_THADDIUS_POLARITY_SHIFT = 13, + EVENT_THADDIUS_START_2 = 14, }; enum Misc { - ACTION_MAGNETIC_PULL = 1, - ACTION_SUMMON_DIED = 2, - ACTION_RESTORE = 3, - NPC_TESLA_COIL = 16218, //the coils (emotes "Tesla Coil overloads!") + ACTION_MAGNETIC_PULL = 1, + ACTION_SUMMON_DIED = 2, + ACTION_RESTORE = 3, + NPC_TESLA_COIL = 16218, //the coils (emotes "Tesla Coil overloads!") }; class boss_thaddius : public CreatureScript @@ -94,398 +94,398 @@ public: return new boss_thaddiusAI (pCreature); } - struct boss_thaddiusAI : public ScriptedAI - { - boss_thaddiusAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = me->GetInstanceScript(); - } + struct boss_thaddiusAI : public ScriptedAI + { + boss_thaddiusAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = me->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint32 summonTimer; - uint32 reviveTimer; - uint32 resetTimer; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint32 summonTimer; + uint32 reviveTimer; + uint32 resetTimer; - void StartEvent() - { - me->RemoveAllAuras(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - events.ScheduleEvent(EVENT_THADDIUS_START_2, 1000); - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* cr = ObjectAccessor::GetCreature(*me, (*itr))) - if (cr->GetEntry() == NPC_TESLA_COIL) - { - cr->CastSpell(me, SPELL_TESLA_SHOCK, true); // till smth better is found ;( ZOMG - Unit::Kill(cr, cr); - } - } + void StartEvent() + { + me->RemoveAllAuras(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + events.ScheduleEvent(EVENT_THADDIUS_START_2, 1000); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* cr = ObjectAccessor::GetCreature(*me, (*itr))) + if (cr->GetEntry() == NPC_TESLA_COIL) + { + cr->CastSpell(me, SPELL_TESLA_SHOCK, true); // till smth better is found ;( ZOMG + Unit::Kill(cr, cr); + } + } - void DoAction(int32 param) - { - if (param == ACTION_SUMMON_DIED) - { - // Hooray, we did it! - if (summonTimer) - { - summonTimer = 0; - reviveTimer = 1; - //events.ScheduleEvent(EVENT_THADDIUS_START, 12000); - return; - } + void DoAction(int32 param) + { + if (param == ACTION_SUMMON_DIED) + { + // Hooray, we did it! + if (summonTimer) + { + summonTimer = 0; + reviveTimer = 1; + //events.ScheduleEvent(EVENT_THADDIUS_START, 12000); + return; + } - summonTimer = 1; - } - } + summonTimer = 1; + } + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - summonTimer = 0; - reviveTimer = 0; - resetTimer = 1; - me->SetPosition(me->GetHomePosition()); + void Reset() + { + events.Reset(); + summons.DespawnAll(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + summonTimer = 0; + reviveTimer = 0; + resetTimer = 1; + me->SetPosition(me->GetHomePosition()); - if (pInstance) - pInstance->SetData(EVENT_THADDIUS, NOT_STARTED); + if (pInstance) + pInstance->SetData(EVENT_THADDIUS, NOT_STARTED); - me->SummonCreature(NPC_STALAGG, 3450.45f, -2931.42f, 312.091f, 5.49779f); - me->SummonCreature(NPC_FEUGEN, 3508.14f, -2988.65f, 312.092f, 2.37365f); - if (Creature* cr = me->SummonCreature(NPC_TESLA_COIL, 3527.34f, -2951.56f, 318.75f, 0.0f)) - { - cr->RemoveAllAuras(); - cr->InterruptNonMeleeSpells(true); - cr->CastSpell(cr, SPELL_FEUGEN_CHAIN, false); - cr->SetDisableGravity(true); - } - if (Creature* cr = me->SummonCreature(NPC_TESLA_COIL, 3487.04f, -2911.68f, 318.75f, 0.0f)) - { - cr->RemoveAllAuras(); - cr->InterruptNonMeleeSpells(true); - cr->CastSpell(cr, SPELL_STALAGG_CHAIN, false); - cr->SetDisableGravity(true); - } - } + me->SummonCreature(NPC_STALAGG, 3450.45f, -2931.42f, 312.091f, 5.49779f); + me->SummonCreature(NPC_FEUGEN, 3508.14f, -2988.65f, 312.092f, 2.37365f); + if (Creature* cr = me->SummonCreature(NPC_TESLA_COIL, 3527.34f, -2951.56f, 318.75f, 0.0f)) + { + cr->RemoveAllAuras(); + cr->InterruptNonMeleeSpells(true); + cr->CastSpell(cr, SPELL_FEUGEN_CHAIN, false); + cr->SetDisableGravity(true); + } + if (Creature* cr = me->SummonCreature(NPC_TESLA_COIL, 3487.04f, -2911.68f, 318.75f, 0.0f)) + { + cr->RemoveAllAuras(); + cr->InterruptNonMeleeSpells(true); + cr->CastSpell(cr, SPELL_STALAGG_CHAIN, false); + cr->SetDisableGravity(true); + } + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (!urand(0,3)) - Talk(SAY_SLAY); + if (!urand(0,3)) + Talk(SAY_SLAY); - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - } + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + } - void JustDied(Unit* Killer) - { - Talk(SAY_DEATH); - if (pInstance) - { - pInstance->SetData(EVENT_THADDIUS, DONE); - pInstance->DoRemoveAurasDueToSpellOnPlayers(28059); - pInstance->DoRemoveAurasDueToSpellOnPlayers(28084); - } - } + void JustDied(Unit* Killer) + { + Talk(SAY_DEATH); + if (pInstance) + { + pInstance->SetData(EVENT_THADDIUS, DONE); + pInstance->DoRemoveAurasDueToSpellOnPlayers(28059); + pInstance->DoRemoveAurasDueToSpellOnPlayers(28084); + } + } - void JustSummoned(Creature* cr) { summons.Summon(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } - void EnterCombat(Unit *who) - { - me->SetInCombatWithZone(); - summons.DoZoneInCombat(NPC_FEUGEN); - summons.DoZoneInCombat(NPC_STALAGG); + void EnterCombat(Unit *who) + { + me->SetInCombatWithZone(); + summons.DoZoneInCombat(NPC_FEUGEN); + summons.DoZoneInCombat(NPC_STALAGG); - if (pInstance) - pInstance->SetData(EVENT_THADDIUS, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(EVENT_THADDIUS, IN_PROGRESS); + } - void UpdateAI(uint32 diff) - { - if (resetTimer) - { - resetTimer += diff; - if (resetTimer > 1000) - { - resetTimer = 0; - me->CastSpell(me, SPELL_THADDIUS_SPAWN_STUN, true); - } - return; - } - if (reviveTimer) - { - reviveTimer += diff; - if (reviveTimer >= 12000) - { - StartEvent(); - reviveTimer = 0; - } - return; - } + void UpdateAI(uint32 diff) + { + if (resetTimer) + { + resetTimer += diff; + if (resetTimer > 1000) + { + resetTimer = 0; + me->CastSpell(me, SPELL_THADDIUS_SPAWN_STUN, true); + } + return; + } + if (reviveTimer) + { + reviveTimer += diff; + if (reviveTimer >= 12000) + { + StartEvent(); + reviveTimer = 0; + } + return; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - // Revive code! - if (summonTimer) - { - summonTimer += diff; - if (summonTimer >= 5000) - { - summons.DoAction(ACTION_RESTORE); - summonTimer = 0; - } - } + // Revive code! + if (summonTimer) + { + summonTimer += diff; + if (summonTimer >= 5000) + { + summons.DoAction(ACTION_RESTORE); + summonTimer = 0; + } + } - switch (events.GetEvent()) - { - //case EVENT_THADDIUS_START: - // StartEvent(); - // events.PopEvent(); - // break; - case EVENT_THADDIUS_START_2: - events.PopEvent(); - Talk(SAY_AGGRO); - me->SetReactState(REACT_AGGRESSIVE); - me->SetControlled(false, UNIT_STATE_STUNNED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setAttackTimer(BASE_ATTACK, 4000); - - events.ScheduleEvent(EVENT_THADDIUS_SPELL_CHAIN_LIGHTNING, 14000); - events.ScheduleEvent(EVENT_THADDIUS_SPELL_BERSERK, 360000); - events.ScheduleEvent(EVENT_THADDIUS_POLARITY_SHIFT, 30000); - return; - case EVENT_THADDIUS_SPELL_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - break; - case EVENT_THADDIUS_SPELL_CHAIN_LIGHTNING: - me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_CHAIN_LIGHTNING_10, SPELL_CHAIN_LIGHTNING_25), false); - events.RepeatEvent(15000); - break; - case EVENT_THADDIUS_POLARITY_SHIFT: - me->CastSpell(me, SPELL_POLARITY_SHIFT, false); - events.RepeatEvent(30000); - break; - } + switch (events.GetEvent()) + { + //case EVENT_THADDIUS_START: + // StartEvent(); + // events.PopEvent(); + // break; + case EVENT_THADDIUS_START_2: + events.PopEvent(); + Talk(SAY_AGGRO); + me->SetReactState(REACT_AGGRESSIVE); + me->SetControlled(false, UNIT_STATE_STUNNED); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->setAttackTimer(BASE_ATTACK, 4000); + + events.ScheduleEvent(EVENT_THADDIUS_SPELL_CHAIN_LIGHTNING, 14000); + events.ScheduleEvent(EVENT_THADDIUS_SPELL_BERSERK, 360000); + events.ScheduleEvent(EVENT_THADDIUS_POLARITY_SHIFT, 30000); + return; + case EVENT_THADDIUS_SPELL_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + break; + case EVENT_THADDIUS_SPELL_CHAIN_LIGHTNING: + me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_CHAIN_LIGHTNING_10, SPELL_CHAIN_LIGHTNING_25), false); + events.RepeatEvent(15000); + break; + case EVENT_THADDIUS_POLARITY_SHIFT: + me->CastSpell(me, SPELL_POLARITY_SHIFT, false); + events.RepeatEvent(30000); + break; + } - if (me->isAttackReady()) - { - if (!me->IsWithinMeleeRange(me->GetVictim())) - me->CastSpell(me->GetVictim(), SPELL_BALL_LIGHTNING, false); - else - DoMeleeAttackIfReady(); - } - } - }; + if (me->isAttackReady()) + { + if (!me->IsWithinMeleeRange(me->GetVictim())) + me->CastSpell(me->GetVictim(), SPELL_BALL_LIGHTNING, false); + else + DoMeleeAttackIfReady(); + } + } + }; }; class boss_thaddius_summon : public CreatureScript { public: - boss_thaddius_summon() : CreatureScript("boss_thaddius_summon") { } + boss_thaddius_summon() : CreatureScript("boss_thaddius_summon") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_thaddius_summonAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_thaddius_summonAI (pCreature); + } - struct boss_thaddius_summonAI : public ScriptedAI - { - boss_thaddius_summonAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceScript(); - } + struct boss_thaddius_summonAI : public ScriptedAI + { + boss_thaddius_summonAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - uint32 pullTimer; - uint32 visualTimer; + InstanceScript* pInstance; + EventMap events; + uint32 pullTimer; + uint32 visualTimer; - void Reset() - { - pullTimer = 0; - visualTimer = 1; - - events.Reset(); - me->SetControlled(false, UNIT_STATE_STUNNED); - if (Creature* cr = me->FindNearestCreature(NPC_TESLA_COIL, 150.0f)) - cr->CastSpell(cr, me->GetEntry() == NPC_STALAGG ? SPELL_STALAGG_CHAIN : SPELL_FEUGEN_CHAIN, false); - } + void Reset() + { + pullTimer = 0; + visualTimer = 1; + + events.Reset(); + me->SetControlled(false, UNIT_STATE_STUNNED); + if (Creature* cr = me->FindNearestCreature(NPC_TESLA_COIL, 150.0f)) + cr->CastSpell(cr, me->GetEntry() == NPC_STALAGG ? SPELL_STALAGG_CHAIN : SPELL_FEUGEN_CHAIN, false); + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_STUNNED); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_STUNNED); + ScriptedAI::EnterEvadeMode(); + } - void EnterCombat(Unit* pWho) - { - me->SetInCombatWithZone(); + void EnterCombat(Unit* pWho) + { + me->SetInCombatWithZone(); - if (me->GetEntry() == NPC_STALAGG) - { - events.ScheduleEvent(EVENT_MINION_SPELL_POWER_SURGE, 10000); - Talk(SAY_STAL_AGGRO); - } - else - { - events.ScheduleEvent(EVENT_MINION_SPELL_STATIC_FIELD, 5000); - Talk(SAY_FEUG_AGGRO); - } - - events.ScheduleEvent(EVENT_MINION_CHECK_DISTANCE, 5000); + if (me->GetEntry() == NPC_STALAGG) + { + events.ScheduleEvent(EVENT_MINION_SPELL_POWER_SURGE, 10000); + Talk(SAY_STAL_AGGRO); + } + else + { + events.ScheduleEvent(EVENT_MINION_SPELL_STATIC_FIELD, 5000); + Talk(SAY_FEUG_AGGRO); + } + + events.ScheduleEvent(EVENT_MINION_CHECK_DISTANCE, 5000); - // This event needs synchronisation, called for stalagg only - if (me->GetEntry() == NPC_STALAGG) - events.ScheduleEvent(EVENT_MINION_SPELL_MAGNETIC_PULL, 25000); + // This event needs synchronisation, called for stalagg only + if (me->GetEntry() == NPC_STALAGG) + events.ScheduleEvent(EVENT_MINION_SPELL_MAGNETIC_PULL, 25000); - if (pInstance) - if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_THADDIUS_BOSS))) - { - cr->AI()->AttackStart(pWho); - cr->AddThreat(pWho, 10.0f); - } - } + if (pInstance) + if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_THADDIUS_BOSS))) + { + cr->AI()->AttackStart(pWho); + cr->AddThreat(pWho, 10.0f); + } + } - void DoAction(int32 param) - { - if (param == ACTION_MAGNETIC_PULL) - { - pullTimer = 1; - me->SetControlled(true, UNIT_STATE_STUNNED); - } - else if (param == ACTION_RESTORE) - { - if (!me->IsAlive()) - { - me->Respawn(); - me->SetInCombatWithZone(); - } - else - me->SetHealth(me->GetMaxHealth()); - } - } + void DoAction(int32 param) + { + if (param == ACTION_MAGNETIC_PULL) + { + pullTimer = 1; + me->SetControlled(true, UNIT_STATE_STUNNED); + } + else if (param == ACTION_RESTORE) + { + if (!me->IsAlive()) + { + me->Respawn(); + me->SetInCombatWithZone(); + } + else + me->SetHealth(me->GetMaxHealth()); + } + } - void JustDied(Unit* ) - { - Talk(me->GetEntry() == NPC_STALAGG ? SAY_FEUG_DEATH : SAY_STAL_DEATH); - if (pInstance) - if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_THADDIUS_BOSS))) - cr->AI()->DoAction(ACTION_SUMMON_DIED); - } + void JustDied(Unit* ) + { + Talk(me->GetEntry() == NPC_STALAGG ? SAY_FEUG_DEATH : SAY_STAL_DEATH); + if (pInstance) + if (Creature* cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_THADDIUS_BOSS))) + cr->AI()->DoAction(ACTION_SUMMON_DIED); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (pInstance) - pInstance->SetData(DATA_IMMORTAL_FAIL, 0); + if (pInstance) + pInstance->SetData(DATA_IMMORTAL_FAIL, 0); - if (!urand(0,2)) - Talk(me->GetEntry() == NPC_STALAGG ? SAY_FEUG_SLAY : SAY_STAL_SLAY); - } + if (!urand(0,2)) + Talk(me->GetEntry() == NPC_STALAGG ? SAY_FEUG_SLAY : SAY_STAL_SLAY); + } - void UpdateAI(uint32 diff) - { - if (visualTimer) - { - visualTimer += diff; - if (visualTimer >= 3000) - { - visualTimer = 0; - if (Creature* cr = me->FindNearestCreature(NPC_TESLA_COIL, 150.0f)) - cr->CastSpell(cr, me->GetEntry() == NPC_STALAGG ? SPELL_STALAGG_CHAIN : SPELL_FEUGEN_CHAIN, false); - } - } + void UpdateAI(uint32 diff) + { + if (visualTimer) + { + visualTimer += diff; + if (visualTimer >= 3000) + { + visualTimer = 0; + if (Creature* cr = me->FindNearestCreature(NPC_TESLA_COIL, 150.0f)) + cr->CastSpell(cr, me->GetEntry() == NPC_STALAGG ? SPELL_STALAGG_CHAIN : SPELL_FEUGEN_CHAIN, false); + } + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - // Disable AI during pull - if (pullTimer) - { - pullTimer += diff; - if (pullTimer >= 3000) - { - me->SetControlled(false, UNIT_STATE_STUNNED); - pullTimer = 0; - } - return; - } + // Disable AI during pull + if (pullTimer) + { + pullTimer += diff; + if (pullTimer >= 3000) + { + me->SetControlled(false, UNIT_STATE_STUNNED); + pullTimer = 0; + } + return; + } - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_MINION_SPELL_POWER_SURGE: - me->CastSpell(me, RAID_MODE(SPELL_POWER_SURGE_10, SPELL_POWER_SURGE_25), false); - events.RepeatEvent(19000); - break; - case EVENT_MINION_SPELL_STATIC_FIELD: - me->CastSpell(me, RAID_MODE(SPELL_STATIC_FIELD_10, SPELL_STATIC_FIELD_25), false); - events.RepeatEvent(3000); - break; - case EVENT_MINION_SPELL_MAGNETIC_PULL: - events.RepeatEvent(25000); - if (pInstance) - if (Creature* feugen = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_FEUGEN_BOSS))) - { - if (!feugen->IsAlive() || !feugen->GetVictim() || !me->GetVictim()) - return; + switch (events.GetEvent()) + { + case EVENT_MINION_SPELL_POWER_SURGE: + me->CastSpell(me, RAID_MODE(SPELL_POWER_SURGE_10, SPELL_POWER_SURGE_25), false); + events.RepeatEvent(19000); + break; + case EVENT_MINION_SPELL_STATIC_FIELD: + me->CastSpell(me, RAID_MODE(SPELL_STATIC_FIELD_10, SPELL_STATIC_FIELD_25), false); + events.RepeatEvent(3000); + break; + case EVENT_MINION_SPELL_MAGNETIC_PULL: + events.RepeatEvent(25000); + if (pInstance) + if (Creature* feugen = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_FEUGEN_BOSS))) + { + if (!feugen->IsAlive() || !feugen->GetVictim() || !me->GetVictim()) + return; - float threatFeugen = feugen->getThreatManager().getThreat(feugen->GetVictim()); - float threatStalagg = me->getThreatManager().getThreat(me->GetVictim()); - Unit* tankFeugen = feugen->GetVictim(); - Unit* tankStalagg = me->GetVictim(); + float threatFeugen = feugen->getThreatManager().getThreat(feugen->GetVictim()); + float threatStalagg = me->getThreatManager().getThreat(me->GetVictim()); + Unit* tankFeugen = feugen->GetVictim(); + Unit* tankStalagg = me->GetVictim(); - feugen->getThreatManager().modifyThreatPercent(tankFeugen, -100); - feugen->AddThreat(tankStalagg, threatFeugen); - feugen->CastSpell(tankStalagg, SPELL_MAGNETIC_PULL, true); - feugen->AI()->DoAction(ACTION_MAGNETIC_PULL); + feugen->getThreatManager().modifyThreatPercent(tankFeugen, -100); + feugen->AddThreat(tankStalagg, threatFeugen); + feugen->CastSpell(tankStalagg, SPELL_MAGNETIC_PULL, true); + feugen->AI()->DoAction(ACTION_MAGNETIC_PULL); - me->getThreatManager().modifyThreatPercent(tankStalagg, -100); - me->AddThreat(tankFeugen, threatStalagg); - me->CastSpell(tankFeugen, SPELL_MAGNETIC_PULL, true); - DoAction(ACTION_MAGNETIC_PULL); - } - - break; - case EVENT_MINION_CHECK_DISTANCE: - if (Creature* cr = me->FindNearestCreature(NPC_TESLA_COIL, 150.0f)) - { - if (me->GetExactDist(cr) > 60.0f || me->GetExactDist(cr) < 20.0f) - { - cr->InterruptNonMeleeSpells(true); - cr->CastSpell(me->GetVictim(), SPELL_TESLA_SHOCK, true); // dont know real spell - events.RepeatEvent(1500); - break; - } - else - { - cr->CastSpell(cr, me->GetEntry() == NPC_STALAGG ? SPELL_STALAGG_CHAIN : SPELL_FEUGEN_CHAIN, false); - } - } + me->getThreatManager().modifyThreatPercent(tankStalagg, -100); + me->AddThreat(tankFeugen, threatStalagg); + me->CastSpell(tankFeugen, SPELL_MAGNETIC_PULL, true); + DoAction(ACTION_MAGNETIC_PULL); + } + + break; + case EVENT_MINION_CHECK_DISTANCE: + if (Creature* cr = me->FindNearestCreature(NPC_TESLA_COIL, 150.0f)) + { + if (me->GetExactDist(cr) > 60.0f || me->GetExactDist(cr) < 20.0f) + { + cr->InterruptNonMeleeSpells(true); + cr->CastSpell(me->GetVictim(), SPELL_TESLA_SHOCK, true); // dont know real spell + events.RepeatEvent(1500); + break; + } + else + { + cr->CastSpell(cr, me->GetEntry() == NPC_STALAGG ? SPELL_STALAGG_CHAIN : SPELL_FEUGEN_CHAIN, false); + } + } - events.RepeatEvent(5000); - break; - } + events.RepeatEvent(5000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_thaddius_pos_neg_charge : public SpellScriptLoader @@ -525,13 +525,13 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader return; Unit* target = GetHitUnit(); - if (!target) - return; + if (!target) + return; if (target->HasAura(GetTriggeringSpell()->Id) || target->GetTypeId() != TYPEID_PLAYER) SetHitDamage(0); else if (target->GetInstanceScript()) - target->GetInstanceScript()->SetData(DATA_CHARGES_CROSSED, 0); + target->GetInstanceScript()->SetData(DATA_CHARGES_CROSSED, 0); } void Register() @@ -587,6 +587,6 @@ void AddSC_boss_thaddius() new boss_thaddius(); new boss_thaddius_summon(); - new spell_thaddius_pos_neg_charge(); + new spell_thaddius_pos_neg_charge(); new spell_thaddius_polarity_shift(); } diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index 3496f1c11..3a24e2ff2 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -49,698 +49,698 @@ public: { instance_naxxramas_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { - memset(&Encounters, 0, sizeof(Encounters)); - for (uint8 i = 0; i < 4; ++i) - HeiganEruption[i].clear(); + memset(&Encounters, 0, sizeof(Encounters)); + for (uint8 i = 0; i < 4; ++i) + HeiganEruption[i].clear(); - // GOs - _patchwerkGateGUID = 0; - _gluthGateGUID = 0; - _nothGateGUID = 0; - _heiganGateGUID = 0; - _heiganGateExitGUID = 0; - _loathebGateGUID = 0; - _anubGateGUID = 0; - _anubNextGateGUID = 0; - _faerlinaGateGUID = 0; - _maexxnaGateGUID = 0; - _thaddiusGateGUID = 0; - _horsemanGateGUID = 0; - _kelthuzadfloorGUID = 0; - _sapphironGateGUID = 0; - _horsemanPortalGUID = 0; - _loathebPortalGUID = 0; - _maexxnaPortalGUID = 0; - _thaddiusPortalGUID = 0; + // GOs + _patchwerkGateGUID = 0; + _gluthGateGUID = 0; + _nothGateGUID = 0; + _heiganGateGUID = 0; + _heiganGateExitGUID = 0; + _loathebGateGUID = 0; + _anubGateGUID = 0; + _anubNextGateGUID = 0; + _faerlinaGateGUID = 0; + _maexxnaGateGUID = 0; + _thaddiusGateGUID = 0; + _horsemanGateGUID = 0; + _kelthuzadfloorGUID = 0; + _sapphironGateGUID = 0; + _horsemanPortalGUID = 0; + _loathebPortalGUID = 0; + _maexxnaPortalGUID = 0; + _thaddiusPortalGUID = 0; - // NPCs - _thaddiusGUID = 0; - _stalaggGUID = 0; - _feugenGUID = 0; - _zeliekGUID = 0; - _rivendareGUID = 0; - _blaumeuxGUID = 0; - _korthazzGUID = 0; - _sapphironGUID = 0; - _kelthuzadGUID = 0; - _lichkingGUID = 0; + // NPCs + _thaddiusGUID = 0; + _stalaggGUID = 0; + _feugenGUID = 0; + _zeliekGUID = 0; + _rivendareGUID = 0; + _blaumeuxGUID = 0; + _korthazzGUID = 0; + _sapphironGUID = 0; + _kelthuzadGUID = 0; + _lichkingGUID = 0; - // Controls - _horsemanKilled = 0; - _speakTimer = 0; - _horsemanTimer = 0; + // Controls + _horsemanKilled = 0; + _speakTimer = 0; + _horsemanTimer = 0; - // Achievements - abominationsKilled = 0; - faerlinaAchievement = true; - thaddiusAchievement = true; - loathebAchievement = true; - sapphironAchievement = true; - heiganAchievement = true; - immortalAchievement = 1; - } + // Achievements + abominationsKilled = 0; + faerlinaAchievement = true; + thaddiusAchievement = true; + loathebAchievement = true; + sapphironAchievement = true; + heiganAchievement = true; + immortalAchievement = 1; + } - uint32 Encounters[MAX_ENCOUNTERS]; - std::set HeiganEruption[4]; + uint32 Encounters[MAX_ENCOUNTERS]; + std::set HeiganEruption[4]; - // GOs - uint64 _patchwerkGateGUID; - uint64 _gluthGateGUID; - uint64 _nothGateGUID; - uint64 _heiganGateGUID; - uint64 _heiganGateExitGUID; - uint64 _loathebGateGUID; - uint64 _anubGateGUID; - uint64 _anubNextGateGUID; - uint64 _faerlinaGateGUID; - uint64 _maexxnaGateGUID; - uint64 _thaddiusGateGUID; - uint64 _gothikEnterGateGUID; - uint64 _gothikInnerGateGUID; - uint64 _gothikExitGateGUID; - uint64 _horsemanGateGUID; - uint64 _kelthuzadfloorGUID; - uint64 _sapphironGateGUID; - uint64 _horsemanPortalGUID; - uint64 _loathebPortalGUID; - uint64 _maexxnaPortalGUID; - uint64 _thaddiusPortalGUID; + // GOs + uint64 _patchwerkGateGUID; + uint64 _gluthGateGUID; + uint64 _nothGateGUID; + uint64 _heiganGateGUID; + uint64 _heiganGateExitGUID; + uint64 _loathebGateGUID; + uint64 _anubGateGUID; + uint64 _anubNextGateGUID; + uint64 _faerlinaGateGUID; + uint64 _maexxnaGateGUID; + uint64 _thaddiusGateGUID; + uint64 _gothikEnterGateGUID; + uint64 _gothikInnerGateGUID; + uint64 _gothikExitGateGUID; + uint64 _horsemanGateGUID; + uint64 _kelthuzadfloorGUID; + uint64 _sapphironGateGUID; + uint64 _horsemanPortalGUID; + uint64 _loathebPortalGUID; + uint64 _maexxnaPortalGUID; + uint64 _thaddiusPortalGUID; - // NPCs - uint64 _thaddiusGUID; - uint64 _stalaggGUID; - uint64 _feugenGUID; - uint64 _zeliekGUID; - uint64 _rivendareGUID; - uint64 _blaumeuxGUID; - uint64 _korthazzGUID; - uint64 _sapphironGUID; - uint64 _kelthuzadGUID; - uint64 _lichkingGUID; + // NPCs + uint64 _thaddiusGUID; + uint64 _stalaggGUID; + uint64 _feugenGUID; + uint64 _zeliekGUID; + uint64 _rivendareGUID; + uint64 _blaumeuxGUID; + uint64 _korthazzGUID; + uint64 _sapphironGUID; + uint64 _kelthuzadGUID; + uint64 _lichkingGUID; - // Controls - uint8 _horsemanKilled; - uint32 _speakTimer; - uint32 _horsemanTimer; + // Controls + uint8 _horsemanKilled; + uint32 _speakTimer; + uint32 _horsemanTimer; - // Achievements - uint8 abominationsKilled; - bool faerlinaAchievement; - bool thaddiusAchievement; - bool loathebAchievement; - bool sapphironAchievement; - bool heiganAchievement; - uint32 immortalAchievement; + // Achievements + uint8 abominationsKilled; + bool faerlinaAchievement; + bool thaddiusAchievement; + bool loathebAchievement; + bool sapphironAchievement; + bool heiganAchievement; + uint32 immortalAchievement; - void HeiganEruptSections(uint32 section) - { - for (uint8 i = 0; i < 4; ++i) - { - if (i == section) - continue; + void HeiganEruptSections(uint32 section) + { + for (uint8 i = 0; i < 4; ++i) + { + if (i == section) + continue; - for (std::set::iterator itr = HeiganEruption[i].begin(); itr != HeiganEruption[i].end(); ++itr) - { - (*itr)->SendCustomAnim((*itr)->GetGoAnimProgress()); - (*itr)->CastSpell(NULL, SPELL_ERUPTION); - } - } - } + for (std::set::iterator itr = HeiganEruption[i].begin(); itr != HeiganEruption[i].end(); ++itr) + { + (*itr)->SendCustomAnim((*itr)->GetGoAnimProgress()); + (*itr)->CastSpell(NULL, SPELL_ERUPTION); + } + } + } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - if (Encounters[i] == IN_PROGRESS) - return true; - } - return false; - } + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + if (Encounters[i] == IN_PROGRESS) + return true; + } + return false; + } - void OnCreatureCreate(Creature* creature) - { - switch(creature->GetEntry()) - { - case NPC_THADDIUS: - _thaddiusGUID = creature->GetGUID(); - return; - case NPC_STALAGG: - _stalaggGUID = creature->GetGUID(); - return; - case NPC_FEUGEN: - _feugenGUID = creature->GetGUID(); - return; - case NPC_LADY_BLAUMEUX: - _blaumeuxGUID = creature->GetGUID(); - return; - case NPC_SIR_ZELIEK: - _zeliekGUID = creature->GetGUID(); - return; - case NPC_BARON_RIVENDARE: - _rivendareGUID = creature->GetGUID(); - return; - case NPC_THANE_KORTHAZZ: - _korthazzGUID = creature->GetGUID(); - return; - case NPC_SAPPHIRON: - _sapphironGUID = creature->GetGUID(); - return; - case NPC_KELTHUZAD: - _kelthuzadGUID = creature->GetGUID(); - return; - case NPC_LICH_KING: - _lichkingGUID = creature->GetGUID(); - return; - } - } + void OnCreatureCreate(Creature* creature) + { + switch(creature->GetEntry()) + { + case NPC_THADDIUS: + _thaddiusGUID = creature->GetGUID(); + return; + case NPC_STALAGG: + _stalaggGUID = creature->GetGUID(); + return; + case NPC_FEUGEN: + _feugenGUID = creature->GetGUID(); + return; + case NPC_LADY_BLAUMEUX: + _blaumeuxGUID = creature->GetGUID(); + return; + case NPC_SIR_ZELIEK: + _zeliekGUID = creature->GetGUID(); + return; + case NPC_BARON_RIVENDARE: + _rivendareGUID = creature->GetGUID(); + return; + case NPC_THANE_KORTHAZZ: + _korthazzGUID = creature->GetGUID(); + return; + case NPC_SAPPHIRON: + _sapphironGUID = creature->GetGUID(); + return; + case NPC_KELTHUZAD: + _kelthuzadGUID = creature->GetGUID(); + return; + case NPC_LICH_KING: + _lichkingGUID = creature->GetGUID(); + return; + } + } - void OnGameObjectCreate(GameObject* pGo) - { - if (pGo->GetGOInfo()->displayId == 6785 || pGo->GetGOInfo()->displayId == 1287) - { - HeiganEruption[GetEruptionSection(pGo->GetPositionX(), pGo->GetPositionY())].insert(pGo); - return; - } + void OnGameObjectCreate(GameObject* pGo) + { + if (pGo->GetGOInfo()->displayId == 6785 || pGo->GetGOInfo()->displayId == 1287) + { + HeiganEruption[GetEruptionSection(pGo->GetPositionX(), pGo->GetPositionY())].insert(pGo); + return; + } - switch(pGo->GetEntry()) - { - case GO_PATCHWERK_GATE: - _patchwerkGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_PATCHWERK] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_GLUTH_GATE: - _gluthGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_GLUTH] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_NOTH_GATE: - _nothGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_NOTH] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_HEIGAN_ENTERANCE_GATE: - _heiganGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_HEIGAN] == DONE || Encounters[EVENT_NOTH] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_HEIGAN_EXIT_GATE: - _heiganGateExitGUID = pGo->GetGUID(); - if (Encounters[EVENT_HEIGAN] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_LOATHEB_GATE: - _loathebGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_LOATHEB] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_ANUB_GATE: - _anubGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_ANUB] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_ANUB_NEXT_GATE: - _anubNextGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_ANUB] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_FAERLINA_GATE: - _faerlinaGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_FAERLINA] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_MAEXXNA_GATE: - _maexxnaGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_FAERLINA] == DONE) // faerlina is correct - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_THADDIUS_GATE: - _thaddiusGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_GLUTH] == DONE) // gluth is correct - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_GOTHIK_ENTER_GATE: - _gothikEnterGateGUID = pGo->GetGUID(); - break; - case GO_GOTHIK_INNER_GATE: - _gothikInnerGateGUID = pGo->GetGUID(); - break; - case GO_GOTHIK_EXIT_GATE: - _gothikExitGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_GOTHIK] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_HORSEMAN_GATE: - _horsemanGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_GOTHIK] == DONE) // correct - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_KELTHUZAD_FLOOR: - _kelthuzadfloorGUID = pGo->GetGUID(); - break; - case GO_SAPPHIRON_GATE: - _sapphironGateGUID = pGo->GetGUID(); - if (Encounters[EVENT_SAPPHIRON] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_DEATHKNIGHT_WING: - _loathebPortalGUID = pGo->GetGUID(); - if (Encounters[EVENT_LOATHEB] == DONE) - pGo->SetPhaseMask(1, true); - break; - case GO_THADDIUS_PORTAL: - _thaddiusPortalGUID = pGo->GetGUID(); - if (Encounters[EVENT_THADDIUS] == DONE) - pGo->SetPhaseMask(1, true); - break; - case GO_MAEXXNA_PORTAL: - _maexxnaPortalGUID = pGo->GetGUID(); - if (Encounters[EVENT_MAEXXNA] == DONE) - pGo->SetPhaseMask(1, true); - break; - case GO_HORSEMAN_PORTAL: - _horsemanPortalGUID = pGo->GetGUID(); - if (Encounters[EVENT_HORSEMAN] == DONE) - pGo->SetPhaseMask(1, true); - break; - } - } + switch(pGo->GetEntry()) + { + case GO_PATCHWERK_GATE: + _patchwerkGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_PATCHWERK] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_GLUTH_GATE: + _gluthGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_GLUTH] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_NOTH_GATE: + _nothGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_NOTH] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_HEIGAN_ENTERANCE_GATE: + _heiganGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_HEIGAN] == DONE || Encounters[EVENT_NOTH] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_HEIGAN_EXIT_GATE: + _heiganGateExitGUID = pGo->GetGUID(); + if (Encounters[EVENT_HEIGAN] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_LOATHEB_GATE: + _loathebGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_LOATHEB] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_ANUB_GATE: + _anubGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_ANUB] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_ANUB_NEXT_GATE: + _anubNextGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_ANUB] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_FAERLINA_GATE: + _faerlinaGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_FAERLINA] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_MAEXXNA_GATE: + _maexxnaGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_FAERLINA] == DONE) // faerlina is correct + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_THADDIUS_GATE: + _thaddiusGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_GLUTH] == DONE) // gluth is correct + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_GOTHIK_ENTER_GATE: + _gothikEnterGateGUID = pGo->GetGUID(); + break; + case GO_GOTHIK_INNER_GATE: + _gothikInnerGateGUID = pGo->GetGUID(); + break; + case GO_GOTHIK_EXIT_GATE: + _gothikExitGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_GOTHIK] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_HORSEMAN_GATE: + _horsemanGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_GOTHIK] == DONE) // correct + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_KELTHUZAD_FLOOR: + _kelthuzadfloorGUID = pGo->GetGUID(); + break; + case GO_SAPPHIRON_GATE: + _sapphironGateGUID = pGo->GetGUID(); + if (Encounters[EVENT_SAPPHIRON] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_DEATHKNIGHT_WING: + _loathebPortalGUID = pGo->GetGUID(); + if (Encounters[EVENT_LOATHEB] == DONE) + pGo->SetPhaseMask(1, true); + break; + case GO_THADDIUS_PORTAL: + _thaddiusPortalGUID = pGo->GetGUID(); + if (Encounters[EVENT_THADDIUS] == DONE) + pGo->SetPhaseMask(1, true); + break; + case GO_MAEXXNA_PORTAL: + _maexxnaPortalGUID = pGo->GetGUID(); + if (Encounters[EVENT_MAEXXNA] == DONE) + pGo->SetPhaseMask(1, true); + break; + case GO_HORSEMAN_PORTAL: + _horsemanPortalGUID = pGo->GetGUID(); + if (Encounters[EVENT_HORSEMAN] == DONE) + pGo->SetPhaseMask(1, true); + break; + } + } - void OnGameObjectRemove(GameObject* pGo) - { - if (pGo->GetGOInfo()->displayId == 6785 || pGo->GetGOInfo()->displayId == 1287) - { - uint32 section = GetEruptionSection(pGo->GetPositionX(), pGo->GetPositionY()); - HeiganEruption[section].erase(pGo); - return; - } + void OnGameObjectRemove(GameObject* pGo) + { + if (pGo->GetGOInfo()->displayId == 6785 || pGo->GetGOInfo()->displayId == 1287) + { + uint32 section = GetEruptionSection(pGo->GetPositionX(), pGo->GetPositionY()); + HeiganEruption[section].erase(pGo); + return; + } - if (pGo->GetEntry() == GO_SAPPHIRON_BIRTH) - if (Creature* cr = instance->GetCreature(_sapphironGUID)) - cr->AI()->DoAction(ACTION_SAPPHIRON_BIRTH); - } + if (pGo->GetEntry() == GO_SAPPHIRON_BIRTH) + if (Creature* cr = instance->GetCreature(_sapphironGUID)) + cr->AI()->DoAction(ACTION_SAPPHIRON_BIRTH); + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case 7600: // And They Would All Go Down Together (10 player) - case 7601: // And They Would All Go Down Together (25 player) - return (_horsemanTimer < 15*IN_MILLISECONDS); - case 7614: // Just Can't Get Enough (10 player) - case 7615: // Just Can't Get Enough (25 player) - return abominationsKilled >= 18; - case 7265: // Momma Said Knock You Out (10 player) - case 7549: // Momma Said Knock You Out (25 player) - return faerlinaAchievement; - case 7604: // Shocking! (10 player) - case 7605: // Shocking! (25 player) - return thaddiusAchievement; - case 7612: // Spore Loser (10 player) - case 7613: // Spore Loser (25 player) - return loathebAchievement; - case 7264: // The Safety Dance (10 player) - case 7548: // The Safety Dance (25 player) - return heiganAchievement; - case 7608: // Subtraction (10 player) - // The Dedicated few (10 player) - case 6802: case 7146: case 7147: case 7148: case 7149: - case 7150: case 7151: case 7152: case 7153: case 7154: - case 7155: case 7156: case 7157: case 7158: - return (instance->GetPlayersCountExceptGMs() < 9); - case 7609: // Subtraction (25 player) - // The Dedicated few (25 player) - case 7159: case 7160: case 7161: case 7162: case 7163: - case 7164: case 7165: case 7166: case 7167: case 7168: - case 7169: case 7170: case 7171: case 7172: - return (instance->GetPlayersCountExceptGMs() < 21); - case 7567: // The Hundred Club (10 player) - case 7568: // The Hundred Club (25 player) - return sapphironAchievement; - // The Undying - case 7617: case 13237: case 13238: case 13239: case 13240: - // The Immortal - case 7616: case 13233: case 13234: case 13235: case 13236: - { - uint8 count = 0; - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - if (Encounters[i] == NOT_STARTED) - ++count; + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case 7600: // And They Would All Go Down Together (10 player) + case 7601: // And They Would All Go Down Together (25 player) + return (_horsemanTimer < 15*IN_MILLISECONDS); + case 7614: // Just Can't Get Enough (10 player) + case 7615: // Just Can't Get Enough (25 player) + return abominationsKilled >= 18; + case 7265: // Momma Said Knock You Out (10 player) + case 7549: // Momma Said Knock You Out (25 player) + return faerlinaAchievement; + case 7604: // Shocking! (10 player) + case 7605: // Shocking! (25 player) + return thaddiusAchievement; + case 7612: // Spore Loser (10 player) + case 7613: // Spore Loser (25 player) + return loathebAchievement; + case 7264: // The Safety Dance (10 player) + case 7548: // The Safety Dance (25 player) + return heiganAchievement; + case 7608: // Subtraction (10 player) + // The Dedicated few (10 player) + case 6802: case 7146: case 7147: case 7148: case 7149: + case 7150: case 7151: case 7152: case 7153: case 7154: + case 7155: case 7156: case 7157: case 7158: + return (instance->GetPlayersCountExceptGMs() < 9); + case 7609: // Subtraction (25 player) + // The Dedicated few (25 player) + case 7159: case 7160: case 7161: case 7162: case 7163: + case 7164: case 7165: case 7166: case 7167: case 7168: + case 7169: case 7170: case 7171: case 7172: + return (instance->GetPlayersCountExceptGMs() < 21); + case 7567: // The Hundred Club (10 player) + case 7568: // The Hundred Club (25 player) + return sapphironAchievement; + // The Undying + case 7617: case 13237: case 13238: case 13239: case 13240: + // The Immortal + case 7616: case 13233: case 13234: case 13235: case 13236: + { + uint8 count = 0; + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + if (Encounters[i] == NOT_STARTED) + ++count; - return !count && immortalAchievement; - } - } - return false; - } + return !count && immortalAchievement; + } + } + return false; + } - void SetData(uint32 id, uint32 data) - { - // Bosses data - switch(id) - { - case EVENT_PATCHWERK: - case EVENT_GROBBULUS: - case EVENT_GLUTH: - case EVENT_NOTH: - case EVENT_ANUB: - case EVENT_MAEXXNA: - case EVENT_RAZUVIOUS: - case EVENT_GOTHIK: - // EVENT_HORSEMAN HANDLED BELOW - Encounters[id] = data; - break; - case EVENT_KELTHUZAD: - if (data == NOT_STARTED) - abominationsKilled = 0; - Encounters[id] = data; - break; - case EVENT_FAERLINA: - if (data == NOT_STARTED) - faerlinaAchievement = true; - Encounters[id] = data; - break; - case EVENT_THADDIUS: - if (data == NOT_STARTED) - thaddiusAchievement = true; - Encounters[id] = data; - break; - case EVENT_LOATHEB: - if (data == NOT_STARTED) - loathebAchievement = true; - Encounters[id] = data; - break; - case EVENT_HEIGAN: - if (data == NOT_STARTED) - heiganAchievement = true; - Encounters[id] = data; - break; - case DATA_HEIGAN_ERUPTION: - HeiganEruptSections(data); - return; - case EVENT_SAPPHIRON: - Encounters[id] = data; - if (data == DONE) - _speakTimer = 1; - else if (data == NOT_STARTED) - sapphironAchievement = true; - break; - case DATA_ABOMINATION_KILLED: - abominationsKilled++; - return; - case DATA_FRENZY_REMOVED: - faerlinaAchievement = false; - return; - case DATA_CHARGES_CROSSED: - thaddiusAchievement = false; - return; - case DATA_SPORE_KILLED: - loathebAchievement = false; - return; - case DATA_HUNDRED_CLUB: - sapphironAchievement = false; - return; - case DATA_DANCE_FAIL: - heiganAchievement = false; - return; - case DATA_IMMORTAL_FAIL: - immortalAchievement = 0; - SaveToDB(); - return; - } + void SetData(uint32 id, uint32 data) + { + // Bosses data + switch(id) + { + case EVENT_PATCHWERK: + case EVENT_GROBBULUS: + case EVENT_GLUTH: + case EVENT_NOTH: + case EVENT_ANUB: + case EVENT_MAEXXNA: + case EVENT_RAZUVIOUS: + case EVENT_GOTHIK: + // EVENT_HORSEMAN HANDLED BELOW + Encounters[id] = data; + break; + case EVENT_KELTHUZAD: + if (data == NOT_STARTED) + abominationsKilled = 0; + Encounters[id] = data; + break; + case EVENT_FAERLINA: + if (data == NOT_STARTED) + faerlinaAchievement = true; + Encounters[id] = data; + break; + case EVENT_THADDIUS: + if (data == NOT_STARTED) + thaddiusAchievement = true; + Encounters[id] = data; + break; + case EVENT_LOATHEB: + if (data == NOT_STARTED) + loathebAchievement = true; + Encounters[id] = data; + break; + case EVENT_HEIGAN: + if (data == NOT_STARTED) + heiganAchievement = true; + Encounters[id] = data; + break; + case DATA_HEIGAN_ERUPTION: + HeiganEruptSections(data); + return; + case EVENT_SAPPHIRON: + Encounters[id] = data; + if (data == DONE) + _speakTimer = 1; + else if (data == NOT_STARTED) + sapphironAchievement = true; + break; + case DATA_ABOMINATION_KILLED: + abominationsKilled++; + return; + case DATA_FRENZY_REMOVED: + faerlinaAchievement = false; + return; + case DATA_CHARGES_CROSSED: + thaddiusAchievement = false; + return; + case DATA_SPORE_KILLED: + loathebAchievement = false; + return; + case DATA_HUNDRED_CLUB: + sapphironAchievement = false; + return; + case DATA_DANCE_FAIL: + heiganAchievement = false; + return; + case DATA_IMMORTAL_FAIL: + immortalAchievement = 0; + SaveToDB(); + return; + } - // Horseman handling - if (id == EVENT_HORSEMAN) - { - if (data == DONE) - { - _horsemanTimer++; - _horsemanKilled++; - if (_horsemanKilled < 4) - return; + // Horseman handling + if (id == EVENT_HORSEMAN) + { + if (data == DONE) + { + _horsemanTimer++; + _horsemanKilled++; + if (_horsemanKilled < 4) + return; - // All horsemans are killed - if (Creature* cr = instance->GetCreature(_blaumeuxGUID)) - cr->CastSpell(cr, 59450, true); // credit - } + // All horsemans are killed + if (Creature* cr = instance->GetCreature(_blaumeuxGUID)) + cr->CastSpell(cr, 59450, true); // credit + } - // respawn - else if (data == NOT_STARTED && _horsemanKilled > 0) - { - Creature* cr; - _horsemanKilled = 0; - if (cr = instance->GetCreature(_blaumeuxGUID)) - if (!cr->IsAlive()) - { - cr->SetPosition(cr->GetHomePosition()); - cr->Respawn(); - } - if (cr = instance->GetCreature(_rivendareGUID)) - if (!cr->IsAlive()) - { - cr->SetPosition(cr->GetHomePosition()); - cr->Respawn(); - } - if (cr = instance->GetCreature(_zeliekGUID)) - if (!cr->IsAlive()) - { - cr->SetPosition(cr->GetHomePosition()); - cr->Respawn(); - } - if (cr = instance->GetCreature(_korthazzGUID)) - if (!cr->IsAlive()) - { - cr->SetPosition(cr->GetHomePosition()); - cr->Respawn(); - } - } - else if (data == IN_PROGRESS) - { - Creature* cr; - if (cr = instance->GetCreature(_blaumeuxGUID)) - cr->SetInCombatWithZone(); - if (cr = instance->GetCreature(_rivendareGUID)) - cr->SetInCombatWithZone(); - if (cr = instance->GetCreature(_zeliekGUID)) - cr->SetInCombatWithZone(); - if (cr = instance->GetCreature(_korthazzGUID)) - cr->SetInCombatWithZone(); - } + // respawn + else if (data == NOT_STARTED && _horsemanKilled > 0) + { + Creature* cr; + _horsemanKilled = 0; + if (cr = instance->GetCreature(_blaumeuxGUID)) + if (!cr->IsAlive()) + { + cr->SetPosition(cr->GetHomePosition()); + cr->Respawn(); + } + if (cr = instance->GetCreature(_rivendareGUID)) + if (!cr->IsAlive()) + { + cr->SetPosition(cr->GetHomePosition()); + cr->Respawn(); + } + if (cr = instance->GetCreature(_zeliekGUID)) + if (!cr->IsAlive()) + { + cr->SetPosition(cr->GetHomePosition()); + cr->Respawn(); + } + if (cr = instance->GetCreature(_korthazzGUID)) + if (!cr->IsAlive()) + { + cr->SetPosition(cr->GetHomePosition()); + cr->Respawn(); + } + } + else if (data == IN_PROGRESS) + { + Creature* cr; + if (cr = instance->GetCreature(_blaumeuxGUID)) + cr->SetInCombatWithZone(); + if (cr = instance->GetCreature(_rivendareGUID)) + cr->SetInCombatWithZone(); + if (cr = instance->GetCreature(_zeliekGUID)) + cr->SetInCombatWithZone(); + if (cr = instance->GetCreature(_korthazzGUID)) + cr->SetInCombatWithZone(); + } - if (data == NOT_STARTED) - _horsemanTimer = 0; + if (data == NOT_STARTED) + _horsemanTimer = 0; - Encounters[id] = data; - } + Encounters[id] = data; + } - // Save instance and open gates - if (data == DONE) - { - SaveToDB(); + // Save instance and open gates + if (data == DONE) + { + SaveToDB(); - switch (id) - { - case EVENT_PATCHWERK: - if (GameObject* go = instance->GetGameObject(_patchwerkGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - break; - case EVENT_GLUTH: - if (GameObject* go = instance->GetGameObject(_gluthGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = instance->GetGameObject(_thaddiusGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - break; - case EVENT_NOTH: - if (GameObject* go = instance->GetGameObject(_nothGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = instance->GetGameObject(_heiganGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - break; - case EVENT_HEIGAN: - if (GameObject* go = instance->GetGameObject(_heiganGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = instance->GetGameObject(_heiganGateExitGUID)) - go->SetGoState(GO_STATE_ACTIVE); - break; - case EVENT_LOATHEB: - if (GameObject* go = instance->GetGameObject(_loathebGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = instance->GetGameObject(_loathebPortalGUID)) - go->SetPhaseMask(1, true); - break; - case EVENT_ANUB: - if (GameObject* go = instance->GetGameObject(_anubGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = instance->GetGameObject(_anubNextGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - break; - case EVENT_FAERLINA: - if (GameObject* go = instance->GetGameObject(_faerlinaGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = instance->GetGameObject(_maexxnaGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - break; - case EVENT_MAEXXNA: - if (GameObject* go = instance->GetGameObject(_maexxnaGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = instance->GetGameObject(_maexxnaPortalGUID)) - go->SetPhaseMask(1, true); - break; - case EVENT_GOTHIK: - if (GameObject* go = instance->GetGameObject(_gothikEnterGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = instance->GetGameObject(_gothikExitGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - if (GameObject* go = instance->GetGameObject(_horsemanGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - break; - case EVENT_SAPPHIRON: - if (GameObject* go = instance->GetGameObject(_sapphironGateGUID)) - go->SetGoState(GO_STATE_ACTIVE); - break; - case EVENT_THADDIUS: - if (GameObject* go = instance->GetGameObject(_thaddiusPortalGUID)) - go->SetPhaseMask(1, true); - break; - case EVENT_HORSEMAN: - if (GameObject* go = instance->GetGameObject(_horsemanPortalGUID)) - go->SetPhaseMask(1, true); - break; - } - } - } + switch (id) + { + case EVENT_PATCHWERK: + if (GameObject* go = instance->GetGameObject(_patchwerkGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + break; + case EVENT_GLUTH: + if (GameObject* go = instance->GetGameObject(_gluthGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = instance->GetGameObject(_thaddiusGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + break; + case EVENT_NOTH: + if (GameObject* go = instance->GetGameObject(_nothGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = instance->GetGameObject(_heiganGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + break; + case EVENT_HEIGAN: + if (GameObject* go = instance->GetGameObject(_heiganGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = instance->GetGameObject(_heiganGateExitGUID)) + go->SetGoState(GO_STATE_ACTIVE); + break; + case EVENT_LOATHEB: + if (GameObject* go = instance->GetGameObject(_loathebGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = instance->GetGameObject(_loathebPortalGUID)) + go->SetPhaseMask(1, true); + break; + case EVENT_ANUB: + if (GameObject* go = instance->GetGameObject(_anubGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = instance->GetGameObject(_anubNextGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + break; + case EVENT_FAERLINA: + if (GameObject* go = instance->GetGameObject(_faerlinaGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = instance->GetGameObject(_maexxnaGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + break; + case EVENT_MAEXXNA: + if (GameObject* go = instance->GetGameObject(_maexxnaGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = instance->GetGameObject(_maexxnaPortalGUID)) + go->SetPhaseMask(1, true); + break; + case EVENT_GOTHIK: + if (GameObject* go = instance->GetGameObject(_gothikEnterGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = instance->GetGameObject(_gothikExitGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + if (GameObject* go = instance->GetGameObject(_horsemanGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + break; + case EVENT_SAPPHIRON: + if (GameObject* go = instance->GetGameObject(_sapphironGateGUID)) + go->SetGoState(GO_STATE_ACTIVE); + break; + case EVENT_THADDIUS: + if (GameObject* go = instance->GetGameObject(_thaddiusPortalGUID)) + go->SetPhaseMask(1, true); + break; + case EVENT_HORSEMAN: + if (GameObject* go = instance->GetGameObject(_horsemanPortalGUID)) + go->SetPhaseMask(1, true); + break; + } + } + } - uint32 GetData(uint32 identifier) const - { - switch(identifier) - { - case EVENT_HORSEMAN: - return Encounters[identifier]; - } - return 0; - } + uint32 GetData(uint32 identifier) const + { + switch(identifier) + { + case EVENT_HORSEMAN: + return Encounters[identifier]; + } + return 0; + } - void Update(uint32 diff) - { - if (_speakTimer) - { - Creature* kel = instance->GetCreature(_kelthuzadGUID); - Creature* lich = instance->GetCreature(_lichkingGUID); - if (kel && lich) - _speakTimer += diff; - else - return; - if (_speakTimer > 20000 && _speakTimer < 30000) - { - kel->AI()->Talk(SAY_SAPP_DIALOG1); - _speakTimer = 30000; - } - else if (_speakTimer > 45000 && _speakTimer < 50000) - { - lich->AI()->Talk(SAY_SAPP_DIALOG2_LICH); - _speakTimer = 50000; - } - else if (_speakTimer > 58000 && _speakTimer < 70000) - { - kel->AI()->Talk(SAY_SAPP_DIALOG3); - _speakTimer = 70000; - } - else if (_speakTimer > 78000 && _speakTimer < 90000) - { - lich->AI()->Talk(SAY_SAPP_DIALOG4_LICH); - _speakTimer = 90000; - } - else if (_speakTimer > 98000) - { - kel->AI()->Talk(SAY_SAPP_DIALOG5); - _speakTimer = 0; - } - } + void Update(uint32 diff) + { + if (_speakTimer) + { + Creature* kel = instance->GetCreature(_kelthuzadGUID); + Creature* lich = instance->GetCreature(_lichkingGUID); + if (kel && lich) + _speakTimer += diff; + else + return; + if (_speakTimer > 20000 && _speakTimer < 30000) + { + kel->AI()->Talk(SAY_SAPP_DIALOG1); + _speakTimer = 30000; + } + else if (_speakTimer > 45000 && _speakTimer < 50000) + { + lich->AI()->Talk(SAY_SAPP_DIALOG2_LICH); + _speakTimer = 50000; + } + else if (_speakTimer > 58000 && _speakTimer < 70000) + { + kel->AI()->Talk(SAY_SAPP_DIALOG3); + _speakTimer = 70000; + } + else if (_speakTimer > 78000 && _speakTimer < 90000) + { + lich->AI()->Talk(SAY_SAPP_DIALOG4_LICH); + _speakTimer = 90000; + } + else if (_speakTimer > 98000) + { + kel->AI()->Talk(SAY_SAPP_DIALOG5); + _speakTimer = 0; + } + } - // And They would all - if (_horsemanTimer) - _horsemanTimer += diff; - } + // And They would all + if (_horsemanTimer) + _horsemanTimer += diff; + } - uint64 GetData64(uint32 id) const - { - switch (id) - { - // GameObjects - case DATA_HEIGAN_ENTER_GATE: - return _heiganGateGUID; - case DATA_LOATHEB_GATE: - return _loathebGateGUID; - case DATA_ANUB_GATE: - return _anubGateGUID; - case DATA_MAEXXNA_GATE: - return _maexxnaGateGUID; - case DATA_GOTHIK_ENTER_GATE: - return _gothikEnterGateGUID; - case DATA_GOTHIK_INNER_GATE: - return _gothikInnerGateGUID; - case DATA_GOTHIK_EXIT_GATE: - return _gothikExitGateGUID; - case DATA_KELTHUZAD_FLOOR: - return _kelthuzadfloorGUID; + uint64 GetData64(uint32 id) const + { + switch (id) + { + // GameObjects + case DATA_HEIGAN_ENTER_GATE: + return _heiganGateGUID; + case DATA_LOATHEB_GATE: + return _loathebGateGUID; + case DATA_ANUB_GATE: + return _anubGateGUID; + case DATA_MAEXXNA_GATE: + return _maexxnaGateGUID; + case DATA_GOTHIK_ENTER_GATE: + return _gothikEnterGateGUID; + case DATA_GOTHIK_INNER_GATE: + return _gothikInnerGateGUID; + case DATA_GOTHIK_EXIT_GATE: + return _gothikExitGateGUID; + case DATA_KELTHUZAD_FLOOR: + return _kelthuzadfloorGUID; - // NPCs - case DATA_THADDIUS_BOSS: - return _thaddiusGUID; - case DATA_STALAGG_BOSS: - return _stalaggGUID; - case DATA_FEUGEN_BOSS: - return _feugenGUID; - case DATA_LICH_KING_BOSS: - return _lichkingGUID; - } - return 0; - } + // NPCs + case DATA_THADDIUS_BOSS: + return _thaddiusGUID; + case DATA_STALAGG_BOSS: + return _stalaggGUID; + case DATA_FEUGEN_BOSS: + return _feugenGUID; + case DATA_LICH_KING_BOSS: + return _lichkingGUID; + } + return 0; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "N X X " << Encounters[0] << ' ' << Encounters[1] << ' ' << Encounters[2] << ' ' << Encounters[3] - << ' ' << Encounters[4] << ' ' << Encounters[5] << ' ' << Encounters[6] << ' ' << Encounters[7] - << ' ' << Encounters[8] << ' ' << Encounters[9] << ' ' << Encounters[10] << ' ' << Encounters[11] - << ' ' << Encounters[12] << ' ' << Encounters[13] << ' ' << Encounters[14] << ' ' << immortalAchievement; + std::ostringstream saveStream; + saveStream << "N X X " << Encounters[0] << ' ' << Encounters[1] << ' ' << Encounters[2] << ' ' << Encounters[3] + << ' ' << Encounters[4] << ' ' << Encounters[5] << ' ' << Encounters[6] << ' ' << Encounters[7] + << ' ' << Encounters[8] << ' ' << Encounters[9] << ' ' << Encounters[10] << ' ' << Encounters[11] + << ' ' << Encounters[12] << ' ' << Encounters[13] << ' ' << Encounters[14] << ' ' << immortalAchievement; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2, dataHead3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> dataHead3; + char dataHead1, dataHead2, dataHead3; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> dataHead3; - if (dataHead1 == 'N' && dataHead2 == 'X' && dataHead3 == 'X') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - loadStream >> Encounters[i]; - if (Encounters[i] == IN_PROGRESS) - Encounters[i] = NOT_STARTED; - } - loadStream >> immortalAchievement; + if (dataHead1 == 'N' && dataHead2 == 'X' && dataHead3 == 'X') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + loadStream >> Encounters[i]; + if (Encounters[i] == IN_PROGRESS) + Encounters[i] = NOT_STARTED; + } + loadStream >> immortalAchievement; - OUT_LOAD_INST_DATA_COMPLETE; - } - else - OUT_LOAD_INST_DATA_FAIL; - } - - }; + OUT_LOAD_INST_DATA_COMPLETE; + } + else + OUT_LOAD_INST_DATA_FAIL; + } + + }; }; class boss_naxxramas_misc : public CreatureScript { @@ -752,57 +752,57 @@ public: return new boss_naxxramas_miscAI (pCreature); } - struct boss_naxxramas_miscAI : public NullCreatureAI - { - boss_naxxramas_miscAI(Creature* c) : NullCreatureAI(c) - { - timer = 0; - } + struct boss_naxxramas_miscAI : public NullCreatureAI + { + boss_naxxramas_miscAI(Creature* c) : NullCreatureAI(c) + { + timer = 0; + } - uint32 timer; + uint32 timer; - void JustDied(Unit* ) - { - if (me->GetEntry() == NPC_MR_BIGGLESWORTH && me->GetInstanceScript()) - { - if (Creature* cr = me->SummonCreature(20350/*NPC_KELTHUZAD*/, *me, TEMPSUMMON_TIMED_DESPAWN, 1)) - { - cr->SetDisplayId(11686); - cr->AI()->Talk(SAY_CAT_DIED); - } - } - } + void JustDied(Unit* ) + { + if (me->GetEntry() == NPC_MR_BIGGLESWORTH && me->GetInstanceScript()) + { + if (Creature* cr = me->SummonCreature(20350/*NPC_KELTHUZAD*/, *me, TEMPSUMMON_TIMED_DESPAWN, 1)) + { + cr->SetDisplayId(11686); + cr->AI()->Talk(SAY_CAT_DIED); + } + } + } - void UpdateAI(uint32 diff) - { - if (me->GetEntry() == NPC_NAXXRAMAS_TRIGGER) - { - timer += diff; - if (timer >= 5000) - { - if (Creature* cr = me->SummonCreature(NPC_LIVING_POISON, *me, TEMPSUMMON_TIMED_DESPAWN, 9000)) - { - cr->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - cr->GetMotionMaster()->MovePoint(0, me->GetPositionX()+50*cos(me->GetOrientation()), me->GetPositionY()+50*sin(me->GetOrientation()), me->GetPositionZ(), false); - } - timer = 0; - } - } - else if (me->GetEntry() == NPC_LIVING_POISON) - { - Unit* target = NULL; - Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 0.5f); - Trinity::UnitLastSearcher searcher(me, target, u_check); - me->VisitNearbyObject(1.5f, searcher); - if (target) - me->CastSpell(me, SPELL_FROGGER_EXPLODE, true); - } - } - }; + void UpdateAI(uint32 diff) + { + if (me->GetEntry() == NPC_NAXXRAMAS_TRIGGER) + { + timer += diff; + if (timer >= 5000) + { + if (Creature* cr = me->SummonCreature(NPC_LIVING_POISON, *me, TEMPSUMMON_TIMED_DESPAWN, 9000)) + { + cr->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + cr->GetMotionMaster()->MovePoint(0, me->GetPositionX()+50*cos(me->GetOrientation()), me->GetPositionY()+50*sin(me->GetOrientation()), me->GetPositionZ(), false); + } + timer = 0; + } + } + else if (me->GetEntry() == NPC_LIVING_POISON) + { + Unit* target = NULL; + Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 0.5f); + Trinity::UnitLastSearcher searcher(me, target, u_check); + me->VisitNearbyObject(1.5f, searcher); + if (target) + me->CastSpell(me, SPELL_FROGGER_EXPLODE, true); + } + } + }; }; void AddSC_instance_naxxramas() { new instance_naxxramas(); - new boss_naxxramas_misc(); + new boss_naxxramas_misc(); } diff --git a/src/server/scripts/Northrend/Naxxramas/naxxramas.h b/src/server/scripts/Northrend/Naxxramas/naxxramas.h index 47a5e54e9..7bf1e87da 100644 --- a/src/server/scripts/Northrend/Naxxramas/naxxramas.h +++ b/src/server/scripts/Northrend/Naxxramas/naxxramas.h @@ -7,113 +7,113 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum NXEncounter { - EVENT_PATCHWERK = 0, - EVENT_GROBBULUS = 1, - EVENT_GLUTH = 2, - EVENT_NOTH = 3, - EVENT_HEIGAN = 4, - EVENT_LOATHEB = 5, - EVENT_ANUB = 6, - EVENT_FAERLINA = 7, - EVENT_MAEXXNA = 8, - EVENT_THADDIUS = 9, - EVENT_RAZUVIOUS = 10, - EVENT_GOTHIK = 11, - EVENT_HORSEMAN = 12, - EVENT_SAPPHIRON = 13, - EVENT_KELTHUZAD = 14, + EVENT_PATCHWERK = 0, + EVENT_GROBBULUS = 1, + EVENT_GLUTH = 2, + EVENT_NOTH = 3, + EVENT_HEIGAN = 4, + EVENT_LOATHEB = 5, + EVENT_ANUB = 6, + EVENT_FAERLINA = 7, + EVENT_MAEXXNA = 8, + EVENT_THADDIUS = 9, + EVENT_RAZUVIOUS = 10, + EVENT_GOTHIK = 11, + EVENT_HORSEMAN = 12, + EVENT_SAPPHIRON = 13, + EVENT_KELTHUZAD = 14, MAX_ENCOUNTERS, }; enum NXData { - DATA_HEIGAN_ERUPTION = 100, - DATA_HEIGAN_ENTER_GATE = 101, - DATA_LOATHEB_GATE = 102, - DATA_ANUB_GATE = 103, - DATA_MAEXXNA_GATE = 104, - DATA_THADDIUS_BOSS = 105, - DATA_STALAGG_BOSS = 106, - DATA_FEUGEN_BOSS = 107, - DATA_GOTHIK_ENTER_GATE = 108, - DATA_GOTHIK_INNER_GATE = 109, - DATA_GOTHIK_EXIT_GATE = 110, - DATA_LICH_KING_BOSS = 111, - DATA_KELTHUZAD_FLOOR = 112, - DATA_ABOMINATION_KILLED = 113, - DATA_FRENZY_REMOVED = 114, - DATA_CHARGES_CROSSED = 115, - DATA_SPORE_KILLED = 116, - DATA_HUNDRED_CLUB = 117, - DATA_DANCE_FAIL = 118, - DATA_IMMORTAL_FAIL = 119, + DATA_HEIGAN_ERUPTION = 100, + DATA_HEIGAN_ENTER_GATE = 101, + DATA_LOATHEB_GATE = 102, + DATA_ANUB_GATE = 103, + DATA_MAEXXNA_GATE = 104, + DATA_THADDIUS_BOSS = 105, + DATA_STALAGG_BOSS = 106, + DATA_FEUGEN_BOSS = 107, + DATA_GOTHIK_ENTER_GATE = 108, + DATA_GOTHIK_INNER_GATE = 109, + DATA_GOTHIK_EXIT_GATE = 110, + DATA_LICH_KING_BOSS = 111, + DATA_KELTHUZAD_FLOOR = 112, + DATA_ABOMINATION_KILLED = 113, + DATA_FRENZY_REMOVED = 114, + DATA_CHARGES_CROSSED = 115, + DATA_SPORE_KILLED = 116, + DATA_HUNDRED_CLUB = 117, + DATA_DANCE_FAIL = 118, + DATA_IMMORTAL_FAIL = 119, }; enum NXGOs { - GO_PATCHWERK_GATE = 181123, - GO_GLUTH_GATE = 181120, - GO_NOTH_GATE = 181201, - GO_HEIGAN_ENTERANCE_GATE = 181202, - GO_HEIGAN_EXIT_GATE = 181203, - GO_LOATHEB_GATE = 181241, - GO_ANUB_GATE = 181126, - GO_ANUB_NEXT_GATE = 181195, - GO_FAERLINA_GATE = 194022, - GO_MAEXXNA_GATE = 181209, - GO_THADDIUS_GATE = 181121, - GO_GOTHIK_ENTER_GATE = 181124, - GO_GOTHIK_INNER_GATE = 181170, - GO_GOTHIK_EXIT_GATE = 181125, - GO_HORSEMAN_GATE = 181119, - GO_SAPPHIRON_GATE = 181225, + GO_PATCHWERK_GATE = 181123, + GO_GLUTH_GATE = 181120, + GO_NOTH_GATE = 181201, + GO_HEIGAN_ENTERANCE_GATE = 181202, + GO_HEIGAN_EXIT_GATE = 181203, + GO_LOATHEB_GATE = 181241, + GO_ANUB_GATE = 181126, + GO_ANUB_NEXT_GATE = 181195, + GO_FAERLINA_GATE = 194022, + GO_MAEXXNA_GATE = 181209, + GO_THADDIUS_GATE = 181121, + GO_GOTHIK_ENTER_GATE = 181124, + GO_GOTHIK_INNER_GATE = 181170, + GO_GOTHIK_EXIT_GATE = 181125, + GO_HORSEMAN_GATE = 181119, + GO_SAPPHIRON_GATE = 181225, - GO_HORSEMEN_CHEST_10 = 181366, - GO_HORSEMEN_CHEST_25 = 193426, + GO_HORSEMEN_CHEST_10 = 181366, + GO_HORSEMEN_CHEST_25 = 193426, - GO_SAPPHIRON_BIRTH = 181356, - GO_KELTHUZAD_FLOOR = 181444, + GO_SAPPHIRON_BIRTH = 181356, + GO_KELTHUZAD_FLOOR = 181444, - GO_DEATHKNIGHT_WING = 181577, //Loatheb portal - GO_THADDIUS_PORTAL = 181576, //Thadius portal - GO_MAEXXNA_PORTAL = 181575, //Maexxna portal - GO_HORSEMAN_PORTAL = 181578, //Four Horseman portal + GO_DEATHKNIGHT_WING = 181577, //Loatheb portal + GO_THADDIUS_PORTAL = 181576, //Thadius portal + GO_MAEXXNA_PORTAL = 181575, //Maexxna portal + GO_HORSEMAN_PORTAL = 181578, //Four Horseman portal }; enum NXNPCs { - // Thaddius - NPC_THADDIUS = 15928, - NPC_STALAGG = 15929, - NPC_FEUGEN = 15930, + // Thaddius + NPC_THADDIUS = 15928, + NPC_STALAGG = 15929, + NPC_FEUGEN = 15930, - // Four horseman - NPC_BARON_RIVENDARE = 30549, - NPC_SIR_ZELIEK = 16063, - NPC_LADY_BLAUMEUX = 16065, - NPC_THANE_KORTHAZZ = 16064, + // Four horseman + NPC_BARON_RIVENDARE = 30549, + NPC_SIR_ZELIEK = 16063, + NPC_LADY_BLAUMEUX = 16065, + NPC_THANE_KORTHAZZ = 16064, - // Sapphiron - NPC_SAPPHIRON = 15989, + // Sapphiron + NPC_SAPPHIRON = 15989, - // Kel'Thuzad - NPC_KELTHUZAD = 15990, - NPC_LICH_KING = 16980, + // Kel'Thuzad + NPC_KELTHUZAD = 15990, + NPC_LICH_KING = 16980, - // Frogger - NPC_LIVING_POISON = 16027, - NPC_NAXXRAMAS_TRIGGER = 16082, - NPC_MR_BIGGLESWORTH = 16998 + // Frogger + NPC_LIVING_POISON = 16027, + NPC_NAXXRAMAS_TRIGGER = 16082, + NPC_MR_BIGGLESWORTH = 16998 }; enum NXMisc { - // Spells - SPELL_ERUPTION = 29371, - SPELL_FROGGER_EXPLODE = 28433, + // Spells + SPELL_ERUPTION = 29371, + SPELL_FROGGER_EXPLODE = 28433, - // Actions - ACTION_SAPPHIRON_BIRTH = 1 + // Actions + ACTION_SAPPHIRON_BIRTH = 1 }; enum NXSays diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 04e533d93..4bbd80670 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -17,120 +17,120 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum MovementInformPoints { - MI_POINT_INTRO_SIDE_0 = 0, - MI_POINT_INTRO_SIDE_1 = 1, - MI_POINT_INTRO_SIDE_2 = 2, - MI_POINT_INTRO_SIDE_3 = 3, + MI_POINT_INTRO_SIDE_0 = 0, + MI_POINT_INTRO_SIDE_1 = 1, + MI_POINT_INTRO_SIDE_2 = 2, + MI_POINT_INTRO_SIDE_3 = 3, - MI_POINT_INTRO_CENTER_AIR, - MI_POINT_INTRO_LAND, - MI_POINT_VORTEX_TAKEOFF, - MI_POINT_VORTEX_CENTER, - MI_POINT_VORTEX_LAND, + MI_POINT_INTRO_CENTER_AIR, + MI_POINT_INTRO_LAND, + MI_POINT_VORTEX_TAKEOFF, + MI_POINT_VORTEX_CENTER, + MI_POINT_VORTEX_LAND, - MI_POINT_CENTER_GROUND_PH_2, - MI_POINT_CENTER_AIR_PH_2, - MI_POINT_CIRCLE_OUTSIDE_PH_2, - MI_POINT_SURGE_OF_POWER_CENTER, + MI_POINT_CENTER_GROUND_PH_2, + MI_POINT_CENTER_AIR_PH_2, + MI_POINT_CIRCLE_OUTSIDE_PH_2, + MI_POINT_SURGE_OF_POWER_CENTER, - MI_POINT_START_PH_3, - MI_POINT_PH_3_FIGHT_POSITION, + MI_POINT_START_PH_3, + MI_POINT_PH_3_FIGHT_POSITION, - MI_POINT_SCION, - MI_POINT_NEXUS_LORD, + MI_POINT_SCION, + MI_POINT_NEXUS_LORD, }; enum MalygosSpells { - SPELL_BERSERK = 64238, - SPELL_ARCANE_BREATH_N = 56272, - SPELL_ARCANE_BREATH_H = 60072, - SPELL_ARCANE_STORM_N = 61693, - SPELL_ARCANE_STORM_H = 61694, + SPELL_BERSERK = 64238, + SPELL_ARCANE_BREATH_N = 56272, + SPELL_ARCANE_BREATH_H = 60072, + SPELL_ARCANE_STORM_N = 61693, + SPELL_ARCANE_STORM_H = 61694, - SPELL_VORTEX_VISUAL = 55873, - SPELL_VORTEX_CONTROL_VEHICLE = 56263, - SPELL_FREEZE_ANIM = 55883, + SPELL_VORTEX_VISUAL = 55873, + SPELL_VORTEX_CONTROL_VEHICLE = 56263, + SPELL_FREEZE_ANIM = 55883, - SPELL_ARCANE_OVERLOAD = 56430, - SPELL_ARCANE_OVERLOAD_SUMMON = 56429, - SPELL_ARCANE_OVERLOAD_AURA = 56432, - SPELL_ARCANE_OVERLOAD_DMG = 56431, - SPELL_ARCANE_OVERLOAD_SIZE = 56435, - SPELL_ARCANE_OVERLOAD_PROTECTION = 56438, + SPELL_ARCANE_OVERLOAD = 56430, + SPELL_ARCANE_OVERLOAD_SUMMON = 56429, + SPELL_ARCANE_OVERLOAD_AURA = 56432, + SPELL_ARCANE_OVERLOAD_DMG = 56431, + SPELL_ARCANE_OVERLOAD_SIZE = 56435, + SPELL_ARCANE_OVERLOAD_PROTECTION = 56438, - SPELL_SURGE_OF_POWER = 56505, // no heroic version? - SPELL_SURGE_OF_POWER_DMG = 56548, + SPELL_SURGE_OF_POWER = 56505, // no heroic version? + SPELL_SURGE_OF_POWER_DMG = 56548, - SPELL_DESTROY_PLATFORM_EFFECT = 59099, - SPELL_DESTROY_PLATFORM_VISUAL = 59084, + SPELL_DESTROY_PLATFORM_EFFECT = 59099, + SPELL_DESTROY_PLATFORM_VISUAL = 59084, - SPELL_ARCANE_PULSE = 57432, - SPELL_PH3_SURGE_OF_POWER_N = 57407, - SPELL_PH3_SURGE_OF_POWER_H = 60936, + SPELL_ARCANE_PULSE = 57432, + SPELL_PH3_SURGE_OF_POWER_N = 57407, + SPELL_PH3_SURGE_OF_POWER_H = 60936, - SPELL_STATIC_FIELD_MAIN = 57430, - SPELL_STATIC_FIELD_SUMMON = 57431, - SPELL_STATIC_FIELD_AURA = 57428, - SPELL_STATIC_FIELD_DAMAGE = 57429, + SPELL_STATIC_FIELD_MAIN = 57430, + SPELL_STATIC_FIELD_SUMMON = 57431, + SPELL_STATIC_FIELD_AURA = 57428, + SPELL_STATIC_FIELD_DAMAGE = 57429, }; -#define SPELL_ARCANE_BREATH DUNGEON_MODE(SPELL_ARCANE_BREATH_N, SPELL_ARCANE_BREATH_H) -#define SPELL_ARCANE_STORM DUNGEON_MODE(SPELL_ARCANE_STORM_N, SPELL_ARCANE_STORM_H) -#define SPELL_PH3_SURGE_OF_POWER DUNGEON_MODE(SPELL_PH3_SURGE_OF_POWER_N, SPELL_PH3_SURGE_OF_POWER_H) +#define SPELL_ARCANE_BREATH DUNGEON_MODE(SPELL_ARCANE_BREATH_N, SPELL_ARCANE_BREATH_H) +#define SPELL_ARCANE_STORM DUNGEON_MODE(SPELL_ARCANE_STORM_N, SPELL_ARCANE_STORM_H) +#define SPELL_PH3_SURGE_OF_POWER DUNGEON_MODE(SPELL_PH3_SURGE_OF_POWER_N, SPELL_PH3_SURGE_OF_POWER_H) enum MalygosEvents { - EVENT_INTRO_MOVE_CENTER = 1, - EVENT_INTRO_LAND, - EVENT_START_FIGHT, - EVENT_BERSERK, + EVENT_INTRO_MOVE_CENTER = 1, + EVENT_INTRO_LAND, + EVENT_START_FIGHT, + EVENT_BERSERK, - // Phase 1: - EVENT_SPELL_ARCANE_BREATH, - EVENT_SPELL_ARCANE_STORM, - EVENT_SUMMON_POWER_SPARK, - EVENT_START_VORTEX_0, - EVENT_VORTEX_FLY_TO_CENTER, - EVENT_START_VORTEX_REAL, - EVENT_VORTEX_LAND_0, - EVENT_VORTEX_LAND_1, + // Phase 1: + EVENT_SPELL_ARCANE_BREATH, + EVENT_SPELL_ARCANE_STORM, + EVENT_SUMMON_POWER_SPARK, + EVENT_START_VORTEX_0, + EVENT_VORTEX_FLY_TO_CENTER, + EVENT_START_VORTEX_REAL, + EVENT_VORTEX_LAND_0, + EVENT_VORTEX_LAND_1, - // Phase 2: - EVENT_START_PHASE_2, - EVENT_START_PHASE_2_FLY_UP, - EVENT_START_PHASE_2_FLY_UP_2, - EVENT_START_PHASE_2_MOVE_TO_SIDE, - EVENT_CHECK_TRASH_DEAD, - EVENT_CLEAR_TARGET, + // Phase 2: + EVENT_START_PHASE_2, + EVENT_START_PHASE_2_FLY_UP, + EVENT_START_PHASE_2_FLY_UP_2, + EVENT_START_PHASE_2_MOVE_TO_SIDE, + EVENT_CHECK_TRASH_DEAD, + EVENT_CLEAR_TARGET, - EVENT_SPELL_ARCANE_OVERLOAD, - //EVENT_SPELL_ARCANE_STORM, - EVENT_RESUME_FLYING_CIRCLES_PH_2, - EVENT_MOVE_TO_SURGE_OF_POWER, - EVENT_SURGE_OF_POWER_WARNING, - EVENT_SPELL_SURGE_OF_POWER, + EVENT_SPELL_ARCANE_OVERLOAD, + //EVENT_SPELL_ARCANE_STORM, + EVENT_RESUME_FLYING_CIRCLES_PH_2, + EVENT_MOVE_TO_SURGE_OF_POWER, + EVENT_SURGE_OF_POWER_WARNING, + EVENT_SPELL_SURGE_OF_POWER, - // Phase 3: - EVENT_LIGHT_DIMENSION_CHANGE, - EVENT_DESTROY_PLATFORM_0, - EVENT_MOVE_TO_PHASE_3_POSITION, - EVENT_START_PHASE_3, - EVENT_SAY_PHASE_3_INTRO, - EVENT_SPELL_ARCANE_PULSE, - EVENT_SPELL_STATIC_FIELD, - EVENT_SPELL_PH3_SURGE_OF_POWER, + // Phase 3: + EVENT_LIGHT_DIMENSION_CHANGE, + EVENT_DESTROY_PLATFORM_0, + EVENT_MOVE_TO_PHASE_3_POSITION, + EVENT_START_PHASE_3, + EVENT_SAY_PHASE_3_INTRO, + EVENT_SPELL_ARCANE_PULSE, + EVENT_SPELL_STATIC_FIELD, + EVENT_SPELL_PH3_SURGE_OF_POWER, - // Trash: - EVENT_TELEPORT_VISUAL, - EVENT_SCION_OF_ETERNITY_ARCANE_BARRAGE, - EVENT_NEXUS_LORD_ARCANE_SHOCK, - EVENT_NEXUS_LORD_HASTE, - EVENT_DISK_MOVE_NEXT_POINT, + // Trash: + EVENT_TELEPORT_VISUAL, + EVENT_SCION_OF_ETERNITY_ARCANE_BARRAGE, + EVENT_NEXUS_LORD_ARCANE_SHOCK, + EVENT_NEXUS_LORD_HASTE, + EVENT_DISK_MOVE_NEXT_POINT, }; -#define MAX_NEXUS_LORDS DUNGEON_MODE(2, 4) -#define MAX_SCIONS_OF_ETERNITY DUNGEON_MODE(4, 8) +#define MAX_NEXUS_LORDS DUNGEON_MODE(2, 4) +#define MAX_SCIONS_OF_ETERNITY DUNGEON_MODE(4, 8) #define AREA_EYE_OF_ETERNITY 4500 enum MalygosLightOverrides @@ -153,666 +153,666 @@ public: return new boss_malygosAI (pCreature); } - struct boss_malygosAI : public ScriptedAI - { - boss_malygosAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = me->GetInstanceScript(); - } - - InstanceScript* pInstance; - EventMap events; - SummonList summons; + struct boss_malygosAI : public ScriptedAI + { + boss_malygosAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = me->GetInstanceScript(); + } + + InstanceScript* pInstance; + EventMap events; + SummonList summons; - uint32 timer1, timer2; - uint8 IntroCounter; - bool bLockHealthCheck; + uint32 timer1, timer2; + uint8 IntroCounter; + bool bLockHealthCheck; - void Reset() - { - events.Reset(); - summons.DespawnAll(); + void Reset() + { + events.Reset(); + summons.DespawnAll(); - timer1 = MalygosIntroIntervals[4]; - timer2 = INTRO_MOVEMENT_INTERVAL; - IntroCounter = 0; - bLockHealthCheck = false; + timer1 = MalygosIntroIntervals[4]; + timer2 = INTRO_MOVEMENT_INTERVAL; + IntroCounter = 0; + bLockHealthCheck = false; - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->SetCanFly(true); - me->SetDisableGravity(true); - //me->SetHover(true); - me->SendMovementFlagUpdate(); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->SetCanFly(true); + me->SetDisableGravity(true); + //me->SetHover(true); + me->SendMovementFlagUpdate(); - if (pInstance) - { - pInstance->SetData(DATA_ENCOUNTER_STATUS, NOT_STARTED); - pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_YOU_DONT_HAVE_AN_ENTERNITY_EVENT); - } - } + if (pInstance) + { + pInstance->SetData(DATA_ENCOUNTER_STATUS, NOT_STARTED); + pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_YOU_DONT_HAVE_AN_ENTERNITY_EVENT); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE) - { - switch (id) - { - case MI_POINT_INTRO_SIDE_0: - case MI_POINT_INTRO_SIDE_1: - case MI_POINT_INTRO_SIDE_2: - case MI_POINT_INTRO_SIDE_3: - { - float angle = me->GetOrientation(); - float dist = 75.0f; - if (Creature *c = me->SummonCreature(NPC_PORTAL, me->GetPositionX()+cos(angle)*dist, me->GetPositionY()+sin(angle)*dist, me->GetPositionZ(), FourSidesPos[id].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 13000)) - me->CastSpell(c, SPELL_PORTAL_BEAM, false); - timer2 = INTRO_MOVEMENT_INTERVAL-10000; - } - break; + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE) + { + switch (id) + { + case MI_POINT_INTRO_SIDE_0: + case MI_POINT_INTRO_SIDE_1: + case MI_POINT_INTRO_SIDE_2: + case MI_POINT_INTRO_SIDE_3: + { + float angle = me->GetOrientation(); + float dist = 75.0f; + if (Creature *c = me->SummonCreature(NPC_PORTAL, me->GetPositionX()+cos(angle)*dist, me->GetPositionY()+sin(angle)*dist, me->GetPositionZ(), FourSidesPos[id].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 13000)) + me->CastSpell(c, SPELL_PORTAL_BEAM, false); + timer2 = INTRO_MOVEMENT_INTERVAL-10000; + } + break; - case MI_POINT_INTRO_CENTER_AIR: - events.RescheduleEvent(EVENT_INTRO_LAND, 0, 1); - break; - case MI_POINT_VORTEX_CENTER: - if (Creature* c = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 15000)) - c->CastSpell(c, SPELL_VORTEX_VISUAL, true); - events.RescheduleEvent(EVENT_START_VORTEX_REAL, 1000, 1); - break; - case MI_POINT_CENTER_GROUND_PH_2: - events.RescheduleEvent(EVENT_START_PHASE_2_FLY_UP, 0, 1); - break; - case MI_POINT_CIRCLE_OUTSIDE_PH_2: - events.RescheduleEvent(EVENT_RESUME_FLYING_CIRCLES_PH_2, 0, 1); - break; - case MI_POINT_SURGE_OF_POWER_CENTER: - events.RescheduleEvent(EVENT_SURGE_OF_POWER_WARNING, 0, 1); - break; - } - } - else if (type == EFFECT_MOTION_TYPE) - { - switch (id) - { - case MI_POINT_INTRO_LAND: - me->SetCanFly(false); - me->SetDisableGravity(false); - //me->SetHover(false); - events.RescheduleEvent(EVENT_START_FIGHT, 0, 1); - break; - case MI_POINT_VORTEX_TAKEOFF: - events.RescheduleEvent(EVENT_VORTEX_FLY_TO_CENTER, 0, 1); - break; - case MI_POINT_VORTEX_LAND: - me->SetCanFly(false); - me->SetDisableGravity(false); - //me->SetHover(false); - events.RescheduleEvent(EVENT_VORTEX_LAND_1, 0, 1); - break; - case MI_POINT_CENTER_AIR_PH_2: - me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_ARCANE_RUNES, 5 * IN_MILLISECONDS); - break; - case MI_POINT_PH_3_FIGHT_POSITION: - events.RescheduleEvent(EVENT_START_PHASE_3, 6000, 1); - break; - } - } - } + case MI_POINT_INTRO_CENTER_AIR: + events.RescheduleEvent(EVENT_INTRO_LAND, 0, 1); + break; + case MI_POINT_VORTEX_CENTER: + if (Creature* c = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 15000)) + c->CastSpell(c, SPELL_VORTEX_VISUAL, true); + events.RescheduleEvent(EVENT_START_VORTEX_REAL, 1000, 1); + break; + case MI_POINT_CENTER_GROUND_PH_2: + events.RescheduleEvent(EVENT_START_PHASE_2_FLY_UP, 0, 1); + break; + case MI_POINT_CIRCLE_OUTSIDE_PH_2: + events.RescheduleEvent(EVENT_RESUME_FLYING_CIRCLES_PH_2, 0, 1); + break; + case MI_POINT_SURGE_OF_POWER_CENTER: + events.RescheduleEvent(EVENT_SURGE_OF_POWER_WARNING, 0, 1); + break; + } + } + else if (type == EFFECT_MOTION_TYPE) + { + switch (id) + { + case MI_POINT_INTRO_LAND: + me->SetCanFly(false); + me->SetDisableGravity(false); + //me->SetHover(false); + events.RescheduleEvent(EVENT_START_FIGHT, 0, 1); + break; + case MI_POINT_VORTEX_TAKEOFF: + events.RescheduleEvent(EVENT_VORTEX_FLY_TO_CENTER, 0, 1); + break; + case MI_POINT_VORTEX_LAND: + me->SetCanFly(false); + me->SetDisableGravity(false); + //me->SetHover(false); + events.RescheduleEvent(EVENT_VORTEX_LAND_1, 0, 1); + break; + case MI_POINT_CENTER_AIR_PH_2: + me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_ARCANE_RUNES, 5 * IN_MILLISECONDS); + break; + case MI_POINT_PH_3_FIGHT_POSITION: + events.RescheduleEvent(EVENT_START_PHASE_3, 6000, 1); + break; + } + } + } - void SpellHit(Unit *caster, const SpellInfo *spell) - { - if (spell->Id == SPELL_POWER_SPARK_MALYGOS_BUFF) - { - if (!bLockHealthCheck) - { - me->MonsterYell("I AM UNSTOPPABLE!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SPARK_BUFF); - } - else - me->RemoveAura(SPELL_POWER_SPARK_MALYGOS_BUFF); - } - } + void SpellHit(Unit *caster, const SpellInfo *spell) + { + if (spell->Id == SPELL_POWER_SPARK_MALYGOS_BUFF) + { + if (!bLockHealthCheck) + { + me->MonsterYell("I AM UNSTOPPABLE!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SPARK_BUFF); + } + else + me->RemoveAura(SPELL_POWER_SPARK_MALYGOS_BUFF); + } + } - void EnterCombat(Unit* who) - { - events.Reset(); - DoZoneInCombat(); + void EnterCombat(Unit* who) + { + events.Reset(); + DoZoneInCombat(); - me->MonsterYell("My patience has reached it's limit, I will be rid of you!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_AGGRO_1); + me->MonsterYell("My patience has reached it's limit, I will be rid of you!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_AGGRO_1); - events.RescheduleEvent(EVENT_INTRO_MOVE_CENTER, 0, 1); - if (pInstance) - pInstance->SetData(DATA_ENCOUNTER_STATUS, IN_PROGRESS); - } + events.RescheduleEvent(EVENT_INTRO_MOVE_CENTER, 0, 1); + if (pInstance) + pInstance->SetData(DATA_ENCOUNTER_STATUS, IN_PROGRESS); + } - void AttackStart(Unit* victim) - { - if (!victim) - return; + void AttackStart(Unit* victim) + { + if (!victim) + return; - if (me->GetVictim() && me->GetVictim()->GetGUID() == victim->GetGUID() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED)) - { - if (!me->GetUInt64Value(UNIT_FIELD_TARGET)) - me->SetTarget(victim->GetGUID()); - } - else if (me->Attack(victim, true)) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED)) - me->GetMotionMaster()->MoveChase(victim); - else - me->SetTarget(0); - } - } + if (me->GetVictim() && me->GetVictim()->GetGUID() == victim->GetGUID() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED)) + { + if (!me->GetUInt64Value(UNIT_FIELD_TARGET)) + me->SetTarget(victim->GetGUID()); + } + else if (me->Attack(victim, true)) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED)) + me->GetMotionMaster()->MoveChase(victim); + else + me->SetTarget(0); + } + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) // allow dying only in phase 3! - { - damage = 0; - return; - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) // allow dying only in phase 3! + { + damage = 0; + return; + } - if (!bLockHealthCheck && me->HealthBelowPctDamaged(50, damage)) - { - bLockHealthCheck = true; - events.RescheduleEvent(EVENT_START_PHASE_2, 0, 1); - } - } + if (!bLockHealthCheck && me->HealthBelowPctDamaged(50, damage)) + { + bLockHealthCheck = true; + events.RescheduleEvent(EVENT_START_PHASE_2, 0, 1); + } + } - void UpdateAI(uint32 diff) - { - HandleIntroSpeech(diff); + void UpdateAI(uint32 diff) + { + HandleIntroSpeech(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - break; - case EVENT_INTRO_MOVE_CENTER: - { - if (pInstance) - pInstance->SetData(DATA_SET_IRIS_INACTIVE, 0); - summons.DespawnAll(); - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - float angle = CenterPos.GetAngle(me); - float x = CenterPos.GetPositionX() + cos(angle)*35.0f; - float y = CenterPos.GetPositionY() + sin(angle)*35.0f; - float z = FourSidesPos[0].GetPositionZ(); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->GetMotionMaster()->MovePoint(MI_POINT_INTRO_CENTER_AIR, x, y, z); - events.PopEvent(); - } - break; - case EVENT_INTRO_LAND: - { - me->GetMotionMaster()->MoveLand(MI_POINT_INTRO_LAND, me->GetPositionX(), me->GetPositionY(), CenterPos.GetPositionZ(), 7.0f); - events.PopEvent(); - } - break; - case EVENT_START_FIGHT: - { - if (pInstance) - { - pInstance->SetData(DATA_HIDE_IRIS_AND_PORTAL, 0); - pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_YOU_DONT_HAVE_AN_ENTERNITY_EVENT); - } - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); - if (Unit* target = me->SelectNearestTarget(250.0f)) - { - AttackStart(target); - me->GetMotionMaster()->MoveChase(target); - } - events.PopEvent(); + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + break; + case EVENT_INTRO_MOVE_CENTER: + { + if (pInstance) + pInstance->SetData(DATA_SET_IRIS_INACTIVE, 0); + summons.DespawnAll(); + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + float angle = CenterPos.GetAngle(me); + float x = CenterPos.GetPositionX() + cos(angle)*35.0f; + float y = CenterPos.GetPositionY() + sin(angle)*35.0f; + float z = FourSidesPos[0].GetPositionZ(); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->GetMotionMaster()->MovePoint(MI_POINT_INTRO_CENTER_AIR, x, y, z); + events.PopEvent(); + } + break; + case EVENT_INTRO_LAND: + { + me->GetMotionMaster()->MoveLand(MI_POINT_INTRO_LAND, me->GetPositionX(), me->GetPositionY(), CenterPos.GetPositionZ(), 7.0f); + events.PopEvent(); + } + break; + case EVENT_START_FIGHT: + { + if (pInstance) + { + pInstance->SetData(DATA_HIDE_IRIS_AND_PORTAL, 0); + pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_YOU_DONT_HAVE_AN_ENTERNITY_EVENT); + } + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); + if (Unit* target = me->SelectNearestTarget(250.0f)) + { + AttackStart(target); + me->GetMotionMaster()->MoveChase(target); + } + events.PopEvent(); - events.RescheduleEvent(EVENT_BERSERK, 600000, 0); - events.RescheduleEvent(EVENT_SPELL_ARCANE_BREATH, urand(9000,12000), 1); - events.RescheduleEvent(EVENT_SPELL_ARCANE_STORM, urand(2000,5000), 1); - events.RescheduleEvent(EVENT_SUMMON_POWER_SPARK, urand(10000,15000), 1); - events.RescheduleEvent(EVENT_START_VORTEX_0, 30000, 1); - } - break; + events.RescheduleEvent(EVENT_BERSERK, 600000, 0); + events.RescheduleEvent(EVENT_SPELL_ARCANE_BREATH, urand(9000,12000), 1); + events.RescheduleEvent(EVENT_SPELL_ARCANE_STORM, urand(2000,5000), 1); + events.RescheduleEvent(EVENT_SUMMON_POWER_SPARK, urand(10000,15000), 1); + events.RescheduleEvent(EVENT_START_VORTEX_0, 30000, 1); + } + break; - case EVENT_SPELL_ARCANE_BREATH: - me->CastSpell(me->GetVictim(), SPELL_ARCANE_BREATH, false); - events.RepeatEvent(urand(12000,15000)); - break; - case EVENT_SPELL_ARCANE_STORM: - me->CastCustomSpell(SPELL_ARCANE_STORM, SPELLVALUE_MAX_TARGETS, DUNGEON_MODE(5, 12), me, true); - events.RepeatEvent(urand(10000,15000)); - break; - case EVENT_SUMMON_POWER_SPARK: - { - uint8 random = urand(0, 3); - if (Creature *c = me->SummonCreature(NPC_PORTAL, FourSidesPos[random], TEMPSUMMON_TIMED_DESPAWN, 6000)) - c->CastSpell(c, SPELL_PORTAL_BEAM, false); - if (Creature* c = me->SummonCreature(NPC_POWER_SPARK, FourSidesPos[random], TEMPSUMMON_MANUAL_DESPAWN, 0)) - c->AI()->DoAction(1); - me->MonsterTextEmote("A Power Spark forms from a nearby rift!", 0, true); - events.RepeatEvent(urand(20000,30000)); - } - break; - case EVENT_START_VORTEX_0: - { - bLockHealthCheck = true; - me->MonsterYell("Watch helplessly as your hopes are swept away...", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_VORTEX); - EntryCheckPredicate pred(NPC_POWER_SPARK); - summons.DoAction(2, pred); // stop following - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + case EVENT_SPELL_ARCANE_BREATH: + me->CastSpell(me->GetVictim(), SPELL_ARCANE_BREATH, false); + events.RepeatEvent(urand(12000,15000)); + break; + case EVENT_SPELL_ARCANE_STORM: + me->CastCustomSpell(SPELL_ARCANE_STORM, SPELLVALUE_MAX_TARGETS, DUNGEON_MODE(5, 12), me, true); + events.RepeatEvent(urand(10000,15000)); + break; + case EVENT_SUMMON_POWER_SPARK: + { + uint8 random = urand(0, 3); + if (Creature *c = me->SummonCreature(NPC_PORTAL, FourSidesPos[random], TEMPSUMMON_TIMED_DESPAWN, 6000)) + c->CastSpell(c, SPELL_PORTAL_BEAM, false); + if (Creature* c = me->SummonCreature(NPC_POWER_SPARK, FourSidesPos[random], TEMPSUMMON_MANUAL_DESPAWN, 0)) + c->AI()->DoAction(1); + me->MonsterTextEmote("A Power Spark forms from a nearby rift!", 0, true); + events.RepeatEvent(urand(20000,30000)); + } + break; + case EVENT_START_VORTEX_0: + { + bLockHealthCheck = true; + me->MonsterYell("Watch helplessly as your hopes are swept away...", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_VORTEX); + EntryCheckPredicate pred(NPC_POWER_SPARK); + summons.DoAction(2, pred); // stop following + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - me->SendMeleeAttackStop(me->GetVictim()); - me->SetTarget((uint64)0); + me->SendMeleeAttackStop(me->GetVictim()); + me->SetTarget((uint64)0); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->SetCanFly(true); - me->SetDisableGravity(true); - //me->SetHover(true); - me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MoveTakeoff(MI_POINT_VORTEX_TAKEOFF, me->GetPositionX(), me->GetPositionY(), CenterPos.GetPositionZ()+20.0f, 7.0f); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->SetCanFly(true); + me->SetDisableGravity(true); + //me->SetHover(true); + me->SendMovementFlagUpdate(); + me->GetMotionMaster()->MoveTakeoff(MI_POINT_VORTEX_TAKEOFF, me->GetPositionX(), me->GetPositionY(), CenterPos.GetPositionZ()+20.0f, 7.0f); - events.PopEvent(); - events.DelayEvents(25000, 1); // don't delay berserk (group 0) - } - break; - case EVENT_VORTEX_FLY_TO_CENTER: - me->GetMotionMaster()->MovePoint(MI_POINT_VORTEX_CENTER, CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ()+20.0f); - events.PopEvent(); - break; - case EVENT_START_VORTEX_REAL: - me->SendMeleeAttackStop(me->GetVictim()); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_01); - me->HandleEmoteCommand(EMOTE_STATE_CUSTOM_SPELL_01); + events.PopEvent(); + events.DelayEvents(25000, 1); // don't delay berserk (group 0) + } + break; + case EVENT_VORTEX_FLY_TO_CENTER: + me->GetMotionMaster()->MovePoint(MI_POINT_VORTEX_CENTER, CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ()+20.0f); + events.PopEvent(); + break; + case EVENT_START_VORTEX_REAL: + me->SendMeleeAttackStop(me->GetVictim()); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_01); + me->HandleEmoteCommand(EMOTE_STATE_CUSTOM_SPELL_01); - { - Position pos; - float angle = (me->GetOrientation() >= M_PI/4 ? me->GetOrientation()-M_PI/4 : 7*M_PI/4+me->GetOrientation()); - pos.m_positionX = CenterPos.GetPositionX()+cos(angle)*40.0f; - pos.m_positionY = CenterPos.GetPositionY()+sin(angle)*40.0f; - pos.m_positionZ = CenterPos.GetPositionZ()+20.0f; - pos.m_orientation = pos.GetAngle(&CenterPos); + { + Position pos; + float angle = (me->GetOrientation() >= M_PI/4 ? me->GetOrientation()-M_PI/4 : 7*M_PI/4+me->GetOrientation()); + pos.m_positionX = CenterPos.GetPositionX()+cos(angle)*40.0f; + pos.m_positionY = CenterPos.GetPositionY()+sin(angle)*40.0f; + pos.m_positionZ = CenterPos.GetPositionZ()+20.0f; + pos.m_orientation = pos.GetAngle(&CenterPos); - if (Creature* vp = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, pos, TEMPSUMMON_TIMED_DESPAWN, 14000)) - { - vp->SetCanFly(true); - vp->SetDisableGravity(true); + if (Creature* vp = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, pos, TEMPSUMMON_TIMED_DESPAWN, 14000)) + { + vp->SetCanFly(true); + vp->SetDisableGravity(true); - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player *pPlayer = i->GetSource()) - { - if (!pPlayer->IsAlive() || pPlayer->IsGameMaster()) - continue; + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player *pPlayer = i->GetSource()) + { + if (!pPlayer->IsAlive() || pPlayer->IsGameMaster()) + continue; - Position plrpos; - float angle = CenterPos.GetAngle(pPlayer); - plrpos.m_positionX = CenterPos.GetPositionX()+cos(angle)*5.0f; - plrpos.m_positionY = CenterPos.GetPositionY()+sin(angle)*5.0f; - plrpos.m_positionZ = CenterPos.GetPositionZ()+18.0f; - plrpos.m_orientation = plrpos.GetAngle(&CenterPos); + Position plrpos; + float angle = CenterPos.GetAngle(pPlayer); + plrpos.m_positionX = CenterPos.GetPositionX()+cos(angle)*5.0f; + plrpos.m_positionY = CenterPos.GetPositionY()+sin(angle)*5.0f; + plrpos.m_positionZ = CenterPos.GetPositionZ()+18.0f; + plrpos.m_orientation = plrpos.GetAngle(&CenterPos); - if (Creature* c = me->SummonCreature(NPC_VORTEX, plrpos, TEMPSUMMON_TIMED_DESPAWN, 15000)) - { - pPlayer->CastSpell(pPlayer, SPELL_FREEZE_ANIM, true); - pPlayer->CastSpell(c, SPELL_VORTEX_CONTROL_VEHICLE, true); - if (!pPlayer->GetVehicle()) // didn't work somehow, try again with a different way, if fails - break - { - pPlayer->EnterVehicle(c, 0); - if (!pPlayer->GetVehicle()) - continue; - } - //pPlayer->ClearUnitState(UNIT_STATE_ONVEHICLE); + if (Creature* c = me->SummonCreature(NPC_VORTEX, plrpos, TEMPSUMMON_TIMED_DESPAWN, 15000)) + { + pPlayer->CastSpell(pPlayer, SPELL_FREEZE_ANIM, true); + pPlayer->CastSpell(c, SPELL_VORTEX_CONTROL_VEHICLE, true); + if (!pPlayer->GetVehicle()) // didn't work somehow, try again with a different way, if fails - break + { + pPlayer->EnterVehicle(c, 0); + if (!pPlayer->GetVehicle()) + continue; + } + //pPlayer->ClearUnitState(UNIT_STATE_ONVEHICLE); - Movement::MoveSplineInit init(pPlayer); - init.MoveTo(CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ()); - init.SetFacing(pPlayer->GetOrientation()); - init.SetTransportExit(); - init.Launch(); + Movement::MoveSplineInit init(pPlayer); + init.MoveTo(CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ()); + init.SetFacing(pPlayer->GetOrientation()); + init.SetTransportExit(); + init.Launch(); - pPlayer->SetUnitMovementFlags(MOVEMENTFLAG_NONE); - pPlayer->SetDisableGravity(true, true); - WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8); - data.append(pPlayer->GetPackGUID()); - pPlayer->SendMessageToSet(&data, true); + pPlayer->SetUnitMovementFlags(MOVEMENTFLAG_NONE); + pPlayer->SetDisableGravity(true, true); + WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8); + data.append(pPlayer->GetPackGUID()); + pPlayer->SendMessageToSet(&data, true); - pPlayer->SetUInt64Value(PLAYER_FARSIGHT, vp->GetGUID()); - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - } - } - } - events.PopEvent(); - events.RescheduleEvent(EVENT_VORTEX_LAND_0, 11000, 1); - break; - case EVENT_VORTEX_LAND_0: - me->GetMotionMaster()->MoveLand(MI_POINT_VORTEX_LAND, CenterPos, 7.0f); - events.PopEvent(); - break; - case EVENT_VORTEX_LAND_1: - { - bLockHealthCheck = false; - EntryCheckPredicate pred(NPC_POWER_SPARK); - summons.DoAction(1, pred); // resume following - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - if (Unit* target = me->GetVictim()) - { - AttackStart(target); - me->GetMotionMaster()->MoveChase(target); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_START_VORTEX_0, 60000, 1); - break; - } - case EVENT_START_PHASE_2: - me->MonsterYell("I had hoped to end your lives quickly, but you have proven more...resilient then I had anticipated. Nonetheless, 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!", LANG_UNIVERSAL,0); - me->PlayDirectSound(SOUND_PHASE_1_END); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); - me->SendMeleeAttackStop(); - me->SetTarget((uint64)0); - me->GetMotionMaster()->MoveIdle(); - me->DisableSpline(); - me->GetMotionMaster()->MovePoint(MI_POINT_CENTER_GROUND_PH_2, CenterPos); - events.CancelEventGroup(1); // don't cancel berserk (group 0) - break; - case EVENT_START_PHASE_2_FLY_UP: - { - me->SendMeleeAttackStop(me->GetVictim()); - me->GetMotionMaster()->MoveIdle(); - me->DisableSpline(); - me->SetCanFly(true); - me->SetDisableGravity(true); - //me->SetHover(true); - me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MoveTakeoff(MI_POINT_CENTER_AIR_PH_2, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+32.0f, 7.0f); - events.PopEvent(); - events.RescheduleEvent(EVENT_START_PHASE_2_MOVE_TO_SIDE, 22500, 1); - break; - } - case EVENT_START_PHASE_2_MOVE_TO_SIDE: - me->MonsterYell("Few have experienced the pain I will now inflict upon you!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_AGGRO_2); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); - me->GetMotionMaster()->MovePoint(MI_POINT_CIRCLE_OUTSIDE_PH_2, Phase2NorthPos); - events.RescheduleEvent(EVENT_SPELL_ARCANE_STORM, urand(12000,15000), 1); - events.RescheduleEvent(EVENT_SPELL_ARCANE_OVERLOAD, 8000, 1); - events.RescheduleEvent(EVENT_MOVE_TO_SURGE_OF_POWER, 55000, 1); - events.RescheduleEvent(EVENT_CHECK_TRASH_DEAD, 3000, 1); - - for (int i=0; iSummonCreature(NPC_HOVER_DISK, CenterPos.GetPositionX()+cos(angle)*dist, CenterPos.GetPositionY()+sin(angle)*dist, CenterPos.GetPositionZ()+30.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0)) - if (Creature* c = me->SummonCreature(NPC_NEXUS_LORD, *disk, TEMPSUMMON_MANUAL_DESPAWN, 0)) - { - c->EnterVehicle(disk, 0); - disk->AI()->DoAction(1); // start moving - } - } - for (int i=0; iSummonCreature(NPC_HOVER_DISK, CenterPos.GetPositionX()+cos(angle)*dist, CenterPos.GetPositionY()+sin(angle)*dist, CenterPos.GetPositionZ()+30.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0)) - if (Creature* c = me->SummonCreature(NPC_SCION_OF_ETERNITY, *disk, TEMPSUMMON_MANUAL_DESPAWN, 0)) - { - c->EnterVehicle(disk, 0); - disk->AI()->DoAction(1); // start moving - } - } + pPlayer->SetUInt64Value(PLAYER_FARSIGHT, vp->GetGUID()); + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + } + } + } + events.PopEvent(); + events.RescheduleEvent(EVENT_VORTEX_LAND_0, 11000, 1); + break; + case EVENT_VORTEX_LAND_0: + me->GetMotionMaster()->MoveLand(MI_POINT_VORTEX_LAND, CenterPos, 7.0f); + events.PopEvent(); + break; + case EVENT_VORTEX_LAND_1: + { + bLockHealthCheck = false; + EntryCheckPredicate pred(NPC_POWER_SPARK); + summons.DoAction(1, pred); // resume following + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + if (Unit* target = me->GetVictim()) + { + AttackStart(target); + me->GetMotionMaster()->MoveChase(target); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_START_VORTEX_0, 60000, 1); + break; + } + case EVENT_START_PHASE_2: + me->MonsterYell("I had hoped to end your lives quickly, but you have proven more...resilient then I had anticipated. Nonetheless, 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!", LANG_UNIVERSAL,0); + me->PlayDirectSound(SOUND_PHASE_1_END); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + me->SendMeleeAttackStop(); + me->SetTarget((uint64)0); + me->GetMotionMaster()->MoveIdle(); + me->DisableSpline(); + me->GetMotionMaster()->MovePoint(MI_POINT_CENTER_GROUND_PH_2, CenterPos); + events.CancelEventGroup(1); // don't cancel berserk (group 0) + break; + case EVENT_START_PHASE_2_FLY_UP: + { + me->SendMeleeAttackStop(me->GetVictim()); + me->GetMotionMaster()->MoveIdle(); + me->DisableSpline(); + me->SetCanFly(true); + me->SetDisableGravity(true); + //me->SetHover(true); + me->SendMovementFlagUpdate(); + me->GetMotionMaster()->MoveTakeoff(MI_POINT_CENTER_AIR_PH_2, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+32.0f, 7.0f); + events.PopEvent(); + events.RescheduleEvent(EVENT_START_PHASE_2_MOVE_TO_SIDE, 22500, 1); + break; + } + case EVENT_START_PHASE_2_MOVE_TO_SIDE: + me->MonsterYell("Few have experienced the pain I will now inflict upon you!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_AGGRO_2); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED); + me->GetMotionMaster()->MovePoint(MI_POINT_CIRCLE_OUTSIDE_PH_2, Phase2NorthPos); + events.RescheduleEvent(EVENT_SPELL_ARCANE_STORM, urand(12000,15000), 1); + events.RescheduleEvent(EVENT_SPELL_ARCANE_OVERLOAD, 8000, 1); + events.RescheduleEvent(EVENT_MOVE_TO_SURGE_OF_POWER, 55000, 1); + events.RescheduleEvent(EVENT_CHECK_TRASH_DEAD, 3000, 1); + + for (int i=0; iSummonCreature(NPC_HOVER_DISK, CenterPos.GetPositionX()+cos(angle)*dist, CenterPos.GetPositionY()+sin(angle)*dist, CenterPos.GetPositionZ()+30.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0)) + if (Creature* c = me->SummonCreature(NPC_NEXUS_LORD, *disk, TEMPSUMMON_MANUAL_DESPAWN, 0)) + { + c->EnterVehicle(disk, 0); + disk->AI()->DoAction(1); // start moving + } + } + for (int i=0; iSummonCreature(NPC_HOVER_DISK, CenterPos.GetPositionX()+cos(angle)*dist, CenterPos.GetPositionY()+sin(angle)*dist, CenterPos.GetPositionZ()+30.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0)) + if (Creature* c = me->SummonCreature(NPC_SCION_OF_ETERNITY, *disk, TEMPSUMMON_MANUAL_DESPAWN, 0)) + { + c->EnterVehicle(disk, 0); + disk->AI()->DoAction(1); // start moving + } + } - events.PopEvent(); - break; - case EVENT_SPELL_ARCANE_OVERLOAD: - { - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - float dist = urand(5, 30); - float angle = rand_norm()*2*M_PI; - float posx = CenterPos.GetPositionX()+cos(angle)*dist; - float posy = CenterPos.GetPositionY()+sin(angle)*dist; - me->SetFacingTo(me->GetAngle(posx, posy)); - me->CastSpell(posx, posy, CenterPos.GetPositionZ()+1.5f, SPELL_ARCANE_OVERLOAD, true); - events.RepeatEvent(15000); - events.RescheduleEvent(EVENT_RESUME_FLYING_CIRCLES_PH_2, 3000, 1); - } - break; - case EVENT_RESUME_FLYING_CIRCLES_PH_2: - { - float angle = CenterPos.GetAngle(me); - float dist = Phase2NorthPos.GetExactDist2d(&CenterPos); - float newangle = angle+0.5f; - if (newangle >= 2*M_PI) newangle -= 2*M_PI; - me->GetMotionMaster()->MovePoint(MI_POINT_CIRCLE_OUTSIDE_PH_2, CenterPos.GetPositionX()+cos(newangle)*dist, CenterPos.GetPositionY()+sin(newangle)*dist, Phase2NorthPos.GetPositionZ()); - events.PopEvent(); - } - break; - case EVENT_MOVE_TO_SURGE_OF_POWER: - { - me->MonsterYell("You will not succeed while i draw breath!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_DEEP_BREATH); - float angle = CenterPos.GetAngle(me); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->GetMotionMaster()->MovePoint(MI_POINT_SURGE_OF_POWER_CENTER, CenterPos.GetPositionX()+cos(angle)*10.0f, CenterPos.GetPositionY()+sin(angle)*10.0f, Phase2NorthPos.GetPositionZ()); - events.CancelEventGroup(1); // everything beside berserk - } - break; - case EVENT_SURGE_OF_POWER_WARNING: - me->MonsterTextEmote("Malygos takes a deep breath.", 0, true); - events.PopEvent(); - events.RescheduleEvent(EVENT_SPELL_SURGE_OF_POWER, 1500, 1); - break; - case EVENT_SPELL_SURGE_OF_POWER: - if (Creature* c = me->SummonCreature(NPC_SURGE_OF_POWER, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 10000)) - me->CastSpell(c, SPELL_SURGE_OF_POWER, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_CLEAR_TARGET, 10000, 1); - events.RescheduleEvent(EVENT_RESUME_FLYING_CIRCLES_PH_2, 10000, 1); - events.RescheduleEvent(EVENT_SPELL_ARCANE_STORM, urand(17000,25000), 1); - events.RescheduleEvent(EVENT_SPELL_ARCANE_OVERLOAD, 16000, 1); - events.RescheduleEvent(EVENT_MOVE_TO_SURGE_OF_POWER, 55000+10000, 1); - events.RescheduleEvent(EVENT_CHECK_TRASH_DEAD, 3000, 1); - break; - case EVENT_CLEAR_TARGET: - me->SendMeleeAttackStop(); - me->SetTarget(0); - events.PopEvent(); - break; - case EVENT_CHECK_TRASH_DEAD: - { - if (me->FindNearestCreature(NPC_SCION_OF_ETERNITY, 250.0f, true) || me->FindNearestCreature(NPC_NEXUS_LORD, 250.0f, true)) - events.RepeatEvent(3000); - else - { - me->SendMeleeAttackStop(); - me->SetTarget(0); - events.CancelEventGroup(1); - summons.DespawnAll(); - // start phase 3 - me->MonsterYell("ENOUGH! If you intend to reclaim Azeroth\'s magic, then you shall have it...", LANG_UNIVERSAL,0); - me->PlayDirectSound(SOUND_PHASE_2_END); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->GetMotionMaster()->MovePoint(MI_POINT_START_PH_3, CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ()+70.0f); - events.RescheduleEvent(EVENT_LIGHT_DIMENSION_CHANGE, 1000, 1); - events.RescheduleEvent(EVENT_DESTROY_PLATFORM_0, 10000, 1); - } - } - break; + events.PopEvent(); + break; + case EVENT_SPELL_ARCANE_OVERLOAD: + { + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + float dist = urand(5, 30); + float angle = rand_norm()*2*M_PI; + float posx = CenterPos.GetPositionX()+cos(angle)*dist; + float posy = CenterPos.GetPositionY()+sin(angle)*dist; + me->SetFacingTo(me->GetAngle(posx, posy)); + me->CastSpell(posx, posy, CenterPos.GetPositionZ()+1.5f, SPELL_ARCANE_OVERLOAD, true); + events.RepeatEvent(15000); + events.RescheduleEvent(EVENT_RESUME_FLYING_CIRCLES_PH_2, 3000, 1); + } + break; + case EVENT_RESUME_FLYING_CIRCLES_PH_2: + { + float angle = CenterPos.GetAngle(me); + float dist = Phase2NorthPos.GetExactDist2d(&CenterPos); + float newangle = angle+0.5f; + if (newangle >= 2*M_PI) newangle -= 2*M_PI; + me->GetMotionMaster()->MovePoint(MI_POINT_CIRCLE_OUTSIDE_PH_2, CenterPos.GetPositionX()+cos(newangle)*dist, CenterPos.GetPositionY()+sin(newangle)*dist, Phase2NorthPos.GetPositionZ()); + events.PopEvent(); + } + break; + case EVENT_MOVE_TO_SURGE_OF_POWER: + { + me->MonsterYell("You will not succeed while i draw breath!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_DEEP_BREATH); + float angle = CenterPos.GetAngle(me); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->GetMotionMaster()->MovePoint(MI_POINT_SURGE_OF_POWER_CENTER, CenterPos.GetPositionX()+cos(angle)*10.0f, CenterPos.GetPositionY()+sin(angle)*10.0f, Phase2NorthPos.GetPositionZ()); + events.CancelEventGroup(1); // everything beside berserk + } + break; + case EVENT_SURGE_OF_POWER_WARNING: + me->MonsterTextEmote("Malygos takes a deep breath.", 0, true); + events.PopEvent(); + events.RescheduleEvent(EVENT_SPELL_SURGE_OF_POWER, 1500, 1); + break; + case EVENT_SPELL_SURGE_OF_POWER: + if (Creature* c = me->SummonCreature(NPC_SURGE_OF_POWER, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 10000)) + me->CastSpell(c, SPELL_SURGE_OF_POWER, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_CLEAR_TARGET, 10000, 1); + events.RescheduleEvent(EVENT_RESUME_FLYING_CIRCLES_PH_2, 10000, 1); + events.RescheduleEvent(EVENT_SPELL_ARCANE_STORM, urand(17000,25000), 1); + events.RescheduleEvent(EVENT_SPELL_ARCANE_OVERLOAD, 16000, 1); + events.RescheduleEvent(EVENT_MOVE_TO_SURGE_OF_POWER, 55000+10000, 1); + events.RescheduleEvent(EVENT_CHECK_TRASH_DEAD, 3000, 1); + break; + case EVENT_CLEAR_TARGET: + me->SendMeleeAttackStop(); + me->SetTarget(0); + events.PopEvent(); + break; + case EVENT_CHECK_TRASH_DEAD: + { + if (me->FindNearestCreature(NPC_SCION_OF_ETERNITY, 250.0f, true) || me->FindNearestCreature(NPC_NEXUS_LORD, 250.0f, true)) + events.RepeatEvent(3000); + else + { + me->SendMeleeAttackStop(); + me->SetTarget(0); + events.CancelEventGroup(1); + summons.DespawnAll(); + // start phase 3 + me->MonsterYell("ENOUGH! If you intend to reclaim Azeroth\'s magic, then you shall have it...", LANG_UNIVERSAL,0); + me->PlayDirectSound(SOUND_PHASE_2_END); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->GetMotionMaster()->MovePoint(MI_POINT_START_PH_3, CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ()+70.0f); + events.RescheduleEvent(EVENT_LIGHT_DIMENSION_CHANGE, 1000, 1); + events.RescheduleEvent(EVENT_DESTROY_PLATFORM_0, 10000, 1); + } + } + break; case EVENT_LIGHT_DIMENSION_CHANGE: me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_CHANGE_DIMENSIONS, 2 * IN_MILLISECONDS); - events.PopEvent(); + events.PopEvent(); break; - case EVENT_DESTROY_PLATFORM_0: - if (Creature* c = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 3000)) - { - c->setFaction(me->getFaction()); - c->CastSpell(c, SPELL_DESTROY_PLATFORM_VISUAL, true); - c->CastSpell(c, SPELL_DESTROY_PLATFORM_EFFECT, false); - } - me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_OBSCURE_SPACE, 1 * IN_MILLISECONDS); - events.PopEvent(); - events.RescheduleEvent(EVENT_MOVE_TO_PHASE_3_POSITION, 2000, 1); - break; - case EVENT_MOVE_TO_PHASE_3_POSITION: - { - me->SendMeleeAttackStop(me->GetVictim()); - me->GetMotionMaster()->MoveTakeoff(MI_POINT_PH_3_FIGHT_POSITION, CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ()-5.0f, me->GetSpeed(MOVE_RUN)); + case EVENT_DESTROY_PLATFORM_0: + if (Creature* c = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 3000)) + { + c->setFaction(me->getFaction()); + c->CastSpell(c, SPELL_DESTROY_PLATFORM_VISUAL, true); + c->CastSpell(c, SPELL_DESTROY_PLATFORM_EFFECT, false); + } + me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_OBSCURE_SPACE, 1 * IN_MILLISECONDS); + events.PopEvent(); + events.RescheduleEvent(EVENT_MOVE_TO_PHASE_3_POSITION, 2000, 1); + break; + case EVENT_MOVE_TO_PHASE_3_POSITION: + { + me->SendMeleeAttackStop(me->GetVictim()); + me->GetMotionMaster()->MoveTakeoff(MI_POINT_PH_3_FIGHT_POSITION, CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ()-5.0f, me->GetSpeed(MOVE_RUN)); - me->DeleteThreatList(); // players on vehicle are unattackable -> leads to EnterEvadeMode() because target is not acceptable! + me->DeleteThreatList(); // players on vehicle are unattackable -> leads to EnterEvadeMode() because target is not acceptable! - // mount players: - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player *pPlayer = i->GetSource()) - { - if (!pPlayer->IsAlive() || pPlayer->IsGameMaster()) - continue; + // mount players: + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player *pPlayer = i->GetSource()) + { + if (!pPlayer->IsAlive() || pPlayer->IsGameMaster()) + continue; - if (Creature* c = me->SummonCreature(NPC_WYRMREST_SKYTALON, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ()-20.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0)) - { - c->setFaction(pPlayer->getFaction()); - //pPlayer->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, c, true); - c->m_Events.AddEvent(new EoEDrakeEnterVehicleEvent(*c, pPlayer->GetGUID()), c->m_Events.CalculateTime(500)); - AttackStart(c); - } - } + if (Creature* c = me->SummonCreature(NPC_WYRMREST_SKYTALON, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ()-20.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0)) + { + c->setFaction(pPlayer->getFaction()); + //pPlayer->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, c, true); + c->m_Events.AddEvent(new EoEDrakeEnterVehicleEvent(*c, pPlayer->GetGUID()), c->m_Events.CalculateTime(500)); + AttackStart(c); + } + } - events.PopEvent(); - events.RescheduleEvent(EVENT_SAY_PHASE_3_INTRO, 3000, 1); - } - break; - case EVENT_SAY_PHASE_3_INTRO: - me->MonsterYell("Now your benefactors make their appearance...But they are too late. The powers contained here are sufficient to destroy the world ten times over! What do you think they will do to you?", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_PHASE_3_START); - events.PopEvent(); - break; - case EVENT_START_PHASE_3: - events.PopEvent(); - me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_OBSCURE_ARCANE_RUNES, 1 * IN_MILLISECONDS); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED | UNIT_FLAG_DISABLE_MOVE); - if (Unit* target = me->GetVictim()) - AttackStart(target); - events.RescheduleEvent(EVENT_SPELL_ARCANE_PULSE, 0, 1); - events.RescheduleEvent(EVENT_SPELL_STATIC_FIELD, urand(1000,4000), 1); - events.RescheduleEvent(EVENT_SPELL_PH3_SURGE_OF_POWER, urand(4000,7000), 1); - events.RescheduleEvent(EVENT_SPELL_ARCANE_STORM, urand(12000,15000), 1); - break; - case EVENT_SPELL_ARCANE_PULSE: - me->CastSpell(me, SPELL_ARCANE_PULSE, true); - events.RepeatEvent(3000); - break; - case EVENT_SPELL_STATIC_FIELD: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, false)) - { - me->SetFacingToObject(target); - me->CastSpell(target, SPELL_STATIC_FIELD_MAIN, true); - } - events.RepeatEvent(12000); - break; - case EVENT_SPELL_PH3_SURGE_OF_POWER: - me->CastSpell((Unit*)NULL, SPELL_PH3_SURGE_OF_POWER, false); - events.RepeatEvent(7000); - break; - } + events.PopEvent(); + events.RescheduleEvent(EVENT_SAY_PHASE_3_INTRO, 3000, 1); + } + break; + case EVENT_SAY_PHASE_3_INTRO: + me->MonsterYell("Now your benefactors make their appearance...But they are too late. The powers contained here are sufficient to destroy the world ten times over! What do you think they will do to you?", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_PHASE_3_START); + events.PopEvent(); + break; + case EVENT_START_PHASE_3: + events.PopEvent(); + me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_OBSCURE_ARCANE_RUNES, 1 * IN_MILLISECONDS); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED | UNIT_FLAG_DISABLE_MOVE); + if (Unit* target = me->GetVictim()) + AttackStart(target); + events.RescheduleEvent(EVENT_SPELL_ARCANE_PULSE, 0, 1); + events.RescheduleEvent(EVENT_SPELL_STATIC_FIELD, urand(1000,4000), 1); + events.RescheduleEvent(EVENT_SPELL_PH3_SURGE_OF_POWER, urand(4000,7000), 1); + events.RescheduleEvent(EVENT_SPELL_ARCANE_STORM, urand(12000,15000), 1); + break; + case EVENT_SPELL_ARCANE_PULSE: + me->CastSpell(me, SPELL_ARCANE_PULSE, true); + events.RepeatEvent(3000); + break; + case EVENT_SPELL_STATIC_FIELD: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, false)) + { + me->SetFacingToObject(target); + me->CastSpell(target, SPELL_STATIC_FIELD_MAIN, true); + } + events.RepeatEvent(12000); + break; + case EVENT_SPELL_PH3_SURGE_OF_POWER: + me->CastSpell((Unit*)NULL, SPELL_PH3_SURGE_OF_POWER, false); + events.RepeatEvent(7000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* killer) - { - me->MonsterYell("UNTHINKABLE! The mortals will destroy... e-everything... my sister... what have you-", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_DEATH); - if (pInstance) - { - pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, NPC_MALYGOS, 1); - pInstance->SetData(DATA_ENCOUNTER_STATUS, DONE); - } - } + void JustDied(Unit* killer) + { + me->MonsterYell("UNTHINKABLE! The mortals will destroy... e-everything... my sister... what have you-", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_DEATH); + if (pInstance) + { + pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, NPC_MALYGOS, 1); + pInstance->SetData(DATA_ENCOUNTER_STATUS, DONE); + } + } - void KilledUnit(Unit *victim) - { - if (victim && victim->GetGUID() == me->GetGUID()) - return; - } + void KilledUnit(Unit *victim) + { + if (victim && victim->GetGUID() == me->GetGUID()) + return; + } - void JustSummoned(Creature* summon) - { - if (!summon) - return; - summons.Summon(summon); - switch(summon->GetEntry()) - { - case NPC_ARCANE_OVERLOAD: - summon->CastSpell(summon, SPELL_ARCANE_OVERLOAD_DMG, true); - summon->DespawnOrUnsummon(45000); - break; - case NPC_STATIC_FIELD: - summon->DespawnOrUnsummon(20000); - break; - } - } + void JustSummoned(Creature* summon) + { + if (!summon) + return; + summons.Summon(summon); + switch(summon->GetEntry()) + { + case NPC_ARCANE_OVERLOAD: + summon->CastSpell(summon, SPELL_ARCANE_OVERLOAD_DMG, true); + summon->DespawnOrUnsummon(45000); + break; + case NPC_STATIC_FIELD: + summon->DespawnOrUnsummon(20000); + break; + } + } - void MoveInLineOfSight(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} - void EnterEvadeMode() - { - me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_GET_DEFAULT_FOR_MAP, 1*IN_MILLISECONDS); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_GET_DEFAULT_FOR_MAP, 1*IN_MILLISECONDS); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + ScriptedAI::EnterEvadeMode(); + } - void HandleIntroSpeech(const uint32 diff) - { - if (me->IsInCombat() || me->isDead()) - return; + void HandleIntroSpeech(const uint32 diff) + { + if (me->IsInCombat() || me->isDead()) + return; - // speech timer - if (timer1 <= diff) - { - me->PlayDirectSound(MalygosIntroTexts[IntroCounter].sound); - me->MonsterYell(MalygosIntroTexts[IntroCounter].text, LANG_UNIVERSAL, 0); - timer1 = MalygosIntroIntervals[IntroCounter]; - if (++IntroCounter >= 5) - IntroCounter = 0; - } - else - timer1 -= diff; + // speech timer + if (timer1 <= diff) + { + me->PlayDirectSound(MalygosIntroTexts[IntroCounter].sound); + me->MonsterYell(MalygosIntroTexts[IntroCounter].text, LANG_UNIVERSAL, 0); + timer1 = MalygosIntroIntervals[IntroCounter]; + if (++IntroCounter >= 5) + IntroCounter = 0; + } + else + timer1 -= diff; - // movement timer - if (timer2) - { - if (timer2 <= diff) - { - timer2 = 0; - uint32 tmp = urand(0,3); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->GetMotionMaster()->MovePoint(MI_POINT_INTRO_SIDE_0+tmp, FourSidesPos[tmp]); - } - else - timer2 -= diff; - } - } - }; + // movement timer + if (timer2) + { + if (timer2 <= diff) + { + timer2 = 0; + uint32 tmp = urand(0,3); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->GetMotionMaster()->MovePoint(MI_POINT_INTRO_SIDE_0+tmp, FourSidesPos[tmp]); + } + else + timer2 -= diff; + } + } + }; }; @@ -830,91 +830,91 @@ public: return new npc_vortex_rideAI (pCreature); } - struct npc_vortex_rideAI : public VehicleAI - { - npc_vortex_rideAI(Creature* pCreature) : VehicleAI(pCreature) - { - VORTEX_RADIUS = urand(22,28); - float h = urand(15, 30); - float angle = CenterPos.GetAngle(me); - Position pos; - pos.m_positionX = CenterPos.GetPositionX()+VORTEX_RADIUS*cos(angle); - pos.m_positionY = CenterPos.GetPositionY()+VORTEX_RADIUS*sin(angle); - pos.m_positionZ = CenterPos.GetPositionZ()+h; - pos.m_orientation = pos.GetAngle(&CenterPos); - me->SetPosition(pos); - timer = 0; - despawnTimer = 9500; - bUpdatedFlying = false; - } + struct npc_vortex_rideAI : public VehicleAI + { + npc_vortex_rideAI(Creature* pCreature) : VehicleAI(pCreature) + { + VORTEX_RADIUS = urand(22,28); + float h = urand(15, 30); + float angle = CenterPos.GetAngle(me); + Position pos; + pos.m_positionX = CenterPos.GetPositionX()+VORTEX_RADIUS*cos(angle); + pos.m_positionY = CenterPos.GetPositionY()+VORTEX_RADIUS*sin(angle); + pos.m_positionZ = CenterPos.GetPositionZ()+h; + pos.m_orientation = pos.GetAngle(&CenterPos); + me->SetPosition(pos); + timer = 0; + despawnTimer = 9500; + bUpdatedFlying = false; + } - uint32 timer; - uint32 despawnTimer; - bool bUpdatedFlying; - float VORTEX_RADIUS; + uint32 timer; + uint32 despawnTimer; + bool bUpdatedFlying; + float VORTEX_RADIUS; - void PassengerBoarded(Unit* pass, int8 seat, bool apply) - { - if (pass && !apply && pass->GetTypeId() == TYPEID_PLAYER) - { - Player* plr = pass->ToPlayer(); - float speed = plr->GetDistance(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()) / (1.0f * 0.001f); - plr->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), speed); - plr->RemoveAura(SPELL_FREEZE_ANIM); - plr->SetDisableGravity(false, true); - plr->SetUInt64Value(PLAYER_FARSIGHT, 0);; - } - } + void PassengerBoarded(Unit* pass, int8 seat, bool apply) + { + if (pass && !apply && pass->GetTypeId() == TYPEID_PLAYER) + { + Player* plr = pass->ToPlayer(); + float speed = plr->GetDistance(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()) / (1.0f * 0.001f); + plr->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), speed); + plr->RemoveAura(SPELL_FREEZE_ANIM); + plr->SetDisableGravity(false, true); + plr->SetUInt64Value(PLAYER_FARSIGHT, 0);; + } + } - void UpdateAI(uint32 diff) - { - /* here: if player has some aura that should make him exit vehicle (eg. ice block) -> exit - or make it another way (dunno how) */ + void UpdateAI(uint32 diff) + { + /* here: if player has some aura that should make him exit vehicle (eg. ice block) -> exit + or make it another way (dunno how) */ - if (despawnTimer <= diff) - { - despawnTimer = 0; - me->UpdatePosition(CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ()+18.0f, 0.0f, true); - me->StopMovingOnCurrentPos(); - me->GetVehicleKit()->RemoveAllPassengers(); - me->DespawnOrUnsummon(); - return; - } - else - despawnTimer -= diff; + if (despawnTimer <= diff) + { + despawnTimer = 0; + me->UpdatePosition(CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ()+18.0f, 0.0f, true); + me->StopMovingOnCurrentPos(); + me->GetVehicleKit()->RemoveAllPassengers(); + me->DespawnOrUnsummon(); + return; + } + else + despawnTimer -= diff; - if (timer <= diff) - { - float angle = CenterPos.GetAngle(me); - float newangle = angle+2*M_PI/((float)VORTEX_TRAVEL_TIME/VORTEX_DEFAULT_DIFF); - if (newangle >= 2*M_PI) - newangle -= 2*M_PI; - float newx = CenterPos.GetPositionX()+VORTEX_RADIUS*cos(newangle); - float newy = CenterPos.GetPositionY()+VORTEX_RADIUS*sin(newangle); - float arcangle = me->GetAngle(newx, newy); - float dist = 2*me->GetDistance2d(newx, newy); - if (me->GetVehicleKit()) if (Unit* pass = me->GetVehicleKit()->GetPassenger(0)) if (Player* plr = pass->ToPlayer()) - { - if (!bUpdatedFlying && timer) - { - bUpdatedFlying = true; - plr->SetDisableGravity(true, true); - } + if (timer <= diff) + { + float angle = CenterPos.GetAngle(me); + float newangle = angle+2*M_PI/((float)VORTEX_TRAVEL_TIME/VORTEX_DEFAULT_DIFF); + if (newangle >= 2*M_PI) + newangle -= 2*M_PI; + float newx = CenterPos.GetPositionX()+VORTEX_RADIUS*cos(newangle); + float newy = CenterPos.GetPositionY()+VORTEX_RADIUS*sin(newangle); + float arcangle = me->GetAngle(newx, newy); + float dist = 2*me->GetDistance2d(newx, newy); + if (me->GetVehicleKit()) if (Unit* pass = me->GetVehicleKit()->GetPassenger(0)) if (Player* plr = pass->ToPlayer()) + { + if (!bUpdatedFlying && timer) + { + bUpdatedFlying = true; + plr->SetDisableGravity(true, true); + } - plr->SendMonsterMove(me->GetPositionX()+dist*cos(arcangle), me->GetPositionY()+dist*sin(arcangle), me->GetPositionZ(), VORTEX_DEFAULT_DIFF*2, SPLINEFLAG_FLYING); - me->Relocate(newx, newy); - } + plr->SendMonsterMove(me->GetPositionX()+dist*cos(arcangle), me->GetPositionY()+dist*sin(arcangle), me->GetPositionZ(), VORTEX_DEFAULT_DIFF*2, SPLINEFLAG_FLYING); + me->Relocate(newx, newy); + } - timer = (diff-timer <= VORTEX_DEFAULT_DIFF) ? VORTEX_DEFAULT_DIFF - (diff-timer) : 0; - } - else - timer -= diff; - } + timer = (diff-timer <= VORTEX_DEFAULT_DIFF) ? VORTEX_DEFAULT_DIFF - (diff-timer) : 0; + } + else + timer -= diff; + } - void AttackStart(Unit* who) {} - void MoveInLineOfSight(Unit* who) {} - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) { damage = 0; } - }; + void AttackStart(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) { damage = 0; } + }; }; @@ -928,90 +928,90 @@ public: return new npc_power_sparkAI (pCreature); } - struct npc_power_sparkAI : public NullCreatureAI - { - npc_power_sparkAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - pInstance = me->GetInstanceScript(); - me->CastSpell(me, SPELL_POWER_SPARK_VISUAL, false); - CheckTimer = 1000; - MoveTimer = 0; - } - - InstanceScript* pInstance; - uint16 CheckTimer; - uint16 MoveTimer; + struct npc_power_sparkAI : public NullCreatureAI + { + npc_power_sparkAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + pInstance = me->GetInstanceScript(); + me->CastSpell(me, SPELL_POWER_SPARK_VISUAL, false); + CheckTimer = 1000; + MoveTimer = 0; + } + + InstanceScript* pInstance; + uint16 CheckTimer; + uint16 MoveTimer; - void DoAction(int32 param) - { - switch(param) - { - case 1: - MoveTimer = 1; - break; - case 2: - MoveTimer = 0; - me->GetMotionMaster()->MoveIdle(); - me->DisableSpline(); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+0.05f, 7.0f); - break; - } - } + void DoAction(int32 param) + { + switch(param) + { + case 1: + MoveTimer = 1; + break; + case 2: + MoveTimer = 0; + me->GetMotionMaster()->MoveIdle(); + me->DisableSpline(); + me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+0.05f, 7.0f); + break; + } + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - { - damage = 0; - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - { - MoveTimer = 0; - me->GetMotionMaster()->MoveIdle(); - me->DisableSpline(); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), CenterPos.GetPositionZ(), 100.0f); - me->SetPosition(me->GetPositionX(), me->GetPositionY(), CenterPos.GetPositionZ(), me->GetOrientation()); - me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE); - me->RemoveAura(SPELL_POWER_SPARK_VISUAL); - me->CastSpell(me, SPELL_POWER_SPARK_GROUND_BUFF, true); - me->DespawnOrUnsummon(60000); - } - } - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + { + damage = 0; + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + MoveTimer = 0; + me->GetMotionMaster()->MoveIdle(); + me->DisableSpline(); + me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), CenterPos.GetPositionZ(), 100.0f); + me->SetPosition(me->GetPositionX(), me->GetPositionY(), CenterPos.GetPositionZ(), me->GetOrientation()); + me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE); + me->RemoveAura(SPELL_POWER_SPARK_VISUAL); + me->CastSpell(me, SPELL_POWER_SPARK_GROUND_BUFF, true); + me->DespawnOrUnsummon(60000); + } + } + } - void UpdateAI(uint32 diff) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + void UpdateAI(uint32 diff) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (CheckTimer <= diff) - { - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MALYGOS_GUID))) - if (me->IsWithinDist3d(c, 12.0f)) - { - me->CastSpell(c, SPELL_POWER_SPARK_MALYGOS_BUFF, true); - me->DespawnOrUnsummon(); - return; - } - CheckTimer = 1000; - } - else - CheckTimer -= diff; + if (CheckTimer <= diff) + { + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MALYGOS_GUID))) + if (me->IsWithinDist3d(c, 12.0f)) + { + me->CastSpell(c, SPELL_POWER_SPARK_MALYGOS_BUFF, true); + me->DespawnOrUnsummon(); + return; + } + CheckTimer = 1000; + } + else + CheckTimer -= diff; - if (MoveTimer) - { - if (MoveTimer <= diff) - { - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MALYGOS_GUID))) - me->GetMotionMaster()->MovePoint(0, *c); - MoveTimer = 2000; - } - else - MoveTimer -= diff; - } - } - }; + if (MoveTimer) + { + if (MoveTimer <= diff) + { + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_MALYGOS_GUID))) + me->GetMotionMaster()->MovePoint(0, *c); + MoveTimer = 2000; + } + else + MoveTimer -= diff; + } + } + }; }; @@ -1025,88 +1025,88 @@ public: return new npc_nexus_lordAI (pCreature); } - struct npc_nexus_lordAI : public ScriptedAI - { - npc_nexus_lordAI(Creature* pCreature) : ScriptedAI(pCreature) - { - me->SetReactState(REACT_PASSIVE); - pInstance = me->GetInstanceScript(); - timer = 0; - events.Reset(); - events.RescheduleEvent(EVENT_TELEPORT_VISUAL, 0); - } + struct npc_nexus_lordAI : public ScriptedAI + { + npc_nexus_lordAI(Creature* pCreature) : ScriptedAI(pCreature) + { + me->SetReactState(REACT_PASSIVE); + pInstance = me->GetInstanceScript(); + timer = 0; + events.Reset(); + events.RescheduleEvent(EVENT_TELEPORT_VISUAL, 0); + } - InstanceScript* pInstance; - EventMap events; - uint16 timer; + InstanceScript* pInstance; + EventMap events; + uint16 timer; - void EnterCombat(Unit* who) - { - DoZoneInCombat(); - events.Reset(); - events.RescheduleEvent(EVENT_NEXUS_LORD_ARCANE_SHOCK, urand(3000,10000)); - events.RescheduleEvent(EVENT_NEXUS_LORD_HASTE, urand(8000,14000)); - } + void EnterCombat(Unit* who) + { + DoZoneInCombat(); + events.Reset(); + events.RescheduleEvent(EVENT_NEXUS_LORD_ARCANE_SHOCK, urand(3000,10000)); + events.RescheduleEvent(EVENT_NEXUS_LORD_HASTE, urand(8000,14000)); + } - void AttackStart(Unit* victim) - { - if (victim && me->Attack(victim, true)) - me->GetMotionMaster()->MoveIdle(); - } + void AttackStart(Unit* victim) + { + if (victim && me->Attack(victim, true)) + me->GetMotionMaster()->MoveIdle(); + } - void UpdateAI(uint32 diff) - { - if (UpdateVictim()) - if (Unit* victim = me->GetVictim()) - { - if (timer <= diff) - { - if (!victim->IsWithinMeleeRange(me)) - { - float x,y,z; - victim->GetClosePoint(x, y, z, 0.0f, 1.5f, me->GetAngle(victim)); - if (Unit* v = me->GetVehicleBase()) - v->GetMotionMaster()->MovePoint(0, x, y ,z); - } - timer = 1000; - } - else - timer -= diff; - } + void UpdateAI(uint32 diff) + { + if (UpdateVictim()) + if (Unit* victim = me->GetVictim()) + { + if (timer <= diff) + { + if (!victim->IsWithinMeleeRange(me)) + { + float x,y,z; + victim->GetClosePoint(x, y, z, 0.0f, 1.5f, me->GetAngle(victim)); + if (Unit* v = me->GetVehicleBase()) + v->GetMotionMaster()->MovePoint(0, x, y ,z); + } + timer = 1000; + } + else + timer -= diff; + } - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_TELEPORT_VISUAL: - me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); - events.PopEvent(); - break; - case EVENT_NEXUS_LORD_ARCANE_SHOCK: - if (Unit* victim = me->GetVictim()) - me->CastSpell(victim, SPELL_ARCANE_SHOCK); - events.RepeatEvent(urand(10000,15000)); - break; - case EVENT_NEXUS_LORD_HASTE: - me->CastSpell(me, SPELL_HASTE); - events.RepeatEvent(urand(20000,30000)); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_TELEPORT_VISUAL: + me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); + events.PopEvent(); + break; + case EVENT_NEXUS_LORD_ARCANE_SHOCK: + if (Unit* victim = me->GetVictim()) + me->CastSpell(victim, SPELL_ARCANE_SHOCK); + events.RepeatEvent(urand(10000,15000)); + break; + case EVENT_NEXUS_LORD_HASTE: + me->CastSpell(me, SPELL_HASTE); + events.RepeatEvent(urand(20000,30000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - if (Vehicle* v = me->GetVehicle()) - v->RemoveAllPassengers(); - } - }; + void JustDied(Unit* /*killer*/) + { + if (Vehicle* v = me->GetVehicle()) + v->RemoveAllPassengers(); + } + }; }; @@ -1120,69 +1120,69 @@ public: return new npc_scion_of_eternityAI (pCreature); } - struct npc_scion_of_eternityAI : public ScriptedAI - { - npc_scion_of_eternityAI(Creature* pCreature) : ScriptedAI(pCreature) - { - me->SetReactState(REACT_PASSIVE); - pInstance = me->GetInstanceScript(); - events.Reset(); - events.RescheduleEvent(EVENT_TELEPORT_VISUAL, 0); - events.RescheduleEvent(EVENT_SCION_OF_ETERNITY_ARCANE_BARRAGE, urand(20000,25000)); - } + struct npc_scion_of_eternityAI : public ScriptedAI + { + npc_scion_of_eternityAI(Creature* pCreature) : ScriptedAI(pCreature) + { + me->SetReactState(REACT_PASSIVE); + pInstance = me->GetInstanceScript(); + events.Reset(); + events.RescheduleEvent(EVENT_TELEPORT_VISUAL, 0); + events.RescheduleEvent(EVENT_SCION_OF_ETERNITY_ARCANE_BARRAGE, urand(20000,25000)); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void UpdateAI(uint32 diff) - { - events.Update(diff); + void UpdateAI(uint32 diff) + { + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_TELEPORT_VISUAL: - me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); - events.PopEvent(); - break; - case EVENT_SCION_OF_ETERNITY_ARCANE_BARRAGE: - { - std::vector guids; - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player *pPlayer = i->GetSource()) - { - if (!pPlayer->IsAlive() || pPlayer->IsGameMaster()) - continue; - guids.push_back(pPlayer->GetGUID()); - } - if (!guids.empty()) - if (Player* plr = ObjectAccessor::GetPlayer(*me, guids.at(urand(0, guids.size()-1)))) - me->CastSpell(plr, SPELL_SCION_ARCANE_BARRAGE); + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_TELEPORT_VISUAL: + me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); + events.PopEvent(); + break; + case EVENT_SCION_OF_ETERNITY_ARCANE_BARRAGE: + { + std::vector guids; + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player *pPlayer = i->GetSource()) + { + if (!pPlayer->IsAlive() || pPlayer->IsGameMaster()) + continue; + guids.push_back(pPlayer->GetGUID()); + } + if (!guids.empty()) + if (Player* plr = ObjectAccessor::GetPlayer(*me, guids.at(urand(0, guids.size()-1)))) + me->CastSpell(plr, SPELL_SCION_ARCANE_BARRAGE); - events.RepeatEvent(urand(5000,8000)); - } - break; - } - } + events.RepeatEvent(urand(5000,8000)); + } + break; + } + } - void JustDied(Unit* killer) - { - if (Vehicle* v = me->GetVehicle()) - v->RemoveAllPassengers(); + void JustDied(Unit* killer) + { + if (Vehicle* v = me->GetVehicle()) + v->RemoveAllPassengers(); - if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, me); - } + if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, me); + } - void MoveInLineOfSight(Unit* who) {} - void AttackStart(Unit* who) {} - }; + void MoveInLineOfSight(Unit* who) {} + void AttackStart(Unit* who) {} + }; }; @@ -1196,138 +1196,138 @@ public: return new npc_hover_diskAI (pCreature); } - struct npc_hover_diskAI : public VehicleAI - { - npc_hover_diskAI(Creature* pCreature) : VehicleAI(pCreature) - { - pInstance = me->GetInstanceScript(); - events.Reset(); - } + struct npc_hover_diskAI : public VehicleAI + { + npc_hover_diskAI(Creature* pCreature) : VehicleAI(pCreature) + { + pInstance = me->GetInstanceScript(); + events.Reset(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void PassengerBoarded(Unit *who, int8 seat, bool apply) - { - events.Reset(); - if (!who) - return; - if (apply) - { - if (who->GetTypeId() == TYPEID_PLAYER) - { - who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_ARCANE_OVERLOAD_DMG, true); - who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SURGE_OF_POWER_DMG, true); - me->SetSpeed(MOVE_RUN, 1.5f); - me->SetSpeed(MOVE_FLIGHT, 1.5f); - } - else if (who->GetEntry() == NPC_NEXUS_LORD) - { - me->SetSpeed(MOVE_RUN, 1.5f); - me->SetSpeed(MOVE_FLIGHT, 1.5f); - } - else - { - me->SetSpeed(MOVE_RUN, 0.6f); - me->SetSpeed(MOVE_FLIGHT, 0.6f); - } + void PassengerBoarded(Unit *who, int8 seat, bool apply) + { + events.Reset(); + if (!who) + return; + if (apply) + { + if (who->GetTypeId() == TYPEID_PLAYER) + { + who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_ARCANE_OVERLOAD_DMG, true); + who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SURGE_OF_POWER_DMG, true); + me->SetSpeed(MOVE_RUN, 1.5f); + me->SetSpeed(MOVE_FLIGHT, 1.5f); + } + else if (who->GetEntry() == NPC_NEXUS_LORD) + { + me->SetSpeed(MOVE_RUN, 1.5f); + me->SetSpeed(MOVE_FLIGHT, 1.5f); + } + else + { + me->SetSpeed(MOVE_RUN, 0.6f); + me->SetSpeed(MOVE_FLIGHT, 0.6f); + } - who->SetFacingTo(me->GetOrientation()); - me->SetCanFly(true); - } - else - { - me->GetMotionMaster()->MoveIdle(); - me->DisableSpline(); - me->SetCanFly(false); - me->GetMotionMaster()->MoveLand(0, me->GetPositionX(), me->GetPositionY(), 267.24f, 10.0f); + who->SetFacingTo(me->GetOrientation()); + me->SetCanFly(true); + } + else + { + me->GetMotionMaster()->MoveIdle(); + me->DisableSpline(); + me->SetCanFly(false); + me->GetMotionMaster()->MoveLand(0, me->GetPositionX(), me->GetPositionY(), 267.24f, 10.0f); - if (who->GetTypeId() == TYPEID_PLAYER) - { - who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_ARCANE_OVERLOAD_DMG, false); - who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SURGE_OF_POWER_DMG, false); - } - } - } + if (who->GetTypeId() == TYPEID_PLAYER) + { + who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_ARCANE_OVERLOAD_DMG, false); + who->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SURGE_OF_POWER_DMG, false); + } + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; - switch (id) - { - case MI_POINT_SCION: - events.RescheduleEvent(EVENT_DISK_MOVE_NEXT_POINT, 0); - break; - case MI_POINT_NEXUS_LORD: - if (me->GetPositionZ() > CenterPos.GetPositionZ()+2.0f) - events.RescheduleEvent(EVENT_DISK_MOVE_NEXT_POINT, 0); - else - if (Vehicle* v = me->GetVehicleKit()) - if (Unit* pass = v->GetPassenger(0)) - if (Creature* c = pass->ToCreature()) - { - c->SetReactState(REACT_AGGRESSIVE); - if (Player* plr = c->SelectNearestPlayer(100.0f)) - c->AI()->AttackStart(plr); - } - break; - } - } + switch (id) + { + case MI_POINT_SCION: + events.RescheduleEvent(EVENT_DISK_MOVE_NEXT_POINT, 0); + break; + case MI_POINT_NEXUS_LORD: + if (me->GetPositionZ() > CenterPos.GetPositionZ()+2.0f) + events.RescheduleEvent(EVENT_DISK_MOVE_NEXT_POINT, 0); + else + if (Vehicle* v = me->GetVehicleKit()) + if (Unit* pass = v->GetPassenger(0)) + if (Creature* c = pass->ToCreature()) + { + c->SetReactState(REACT_AGGRESSIVE); + if (Player* plr = c->SelectNearestPlayer(100.0f)) + c->AI()->AttackStart(plr); + } + break; + } + } - void DoAction(int32 param) - { - switch(param) - { - case 1: // move to next point - if (Vehicle* v = me->GetVehicleKit()) - if (Unit* pass = v->GetPassenger(0)) - switch(pass->GetEntry()) - { - case NPC_NEXUS_LORD: - { - float angle = CenterPos.GetAngle(me); - float newangle = angle - 0.5f; - if (newangle < 0.0f) newangle += 2*M_PI; - float newz = me->GetPositionZ()-4.0f; - if (newzGetMotionMaster()->MovePoint(MI_POINT_NEXUS_LORD, CenterPos.GetPositionX()+cos(newangle)*22.0f, CenterPos.GetPositionY()+sin(newangle)*22.0f, newz); - } - break; - case NPC_SCION_OF_ETERNITY: - { - float angle = CenterPos.GetAngle(me); - float newangle = angle - 0.3f; - if (newangle < 0.0f) newangle += 2*M_PI; - float newz = me->GetPositionZ()-2.0f; - if (newzGetMotionMaster()->MovePoint(MI_POINT_SCION, CenterPos.GetPositionX()+cos(newangle)*30.0f, CenterPos.GetPositionY()+sin(newangle)*30.0f, newz); - } - break; - } - break; - } - } + void DoAction(int32 param) + { + switch(param) + { + case 1: // move to next point + if (Vehicle* v = me->GetVehicleKit()) + if (Unit* pass = v->GetPassenger(0)) + switch(pass->GetEntry()) + { + case NPC_NEXUS_LORD: + { + float angle = CenterPos.GetAngle(me); + float newangle = angle - 0.5f; + if (newangle < 0.0f) newangle += 2*M_PI; + float newz = me->GetPositionZ()-4.0f; + if (newzGetMotionMaster()->MovePoint(MI_POINT_NEXUS_LORD, CenterPos.GetPositionX()+cos(newangle)*22.0f, CenterPos.GetPositionY()+sin(newangle)*22.0f, newz); + } + break; + case NPC_SCION_OF_ETERNITY: + { + float angle = CenterPos.GetAngle(me); + float newangle = angle - 0.3f; + if (newangle < 0.0f) newangle += 2*M_PI; + float newz = me->GetPositionZ()-2.0f; + if (newzGetMotionMaster()->MovePoint(MI_POINT_SCION, CenterPos.GetPositionX()+cos(newangle)*30.0f, CenterPos.GetPositionY()+sin(newangle)*30.0f, newz); + } + break; + } + break; + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); + void UpdateAI(uint32 diff) + { + events.Update(diff); - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_DISK_MOVE_NEXT_POINT: - DoAction(1); - events.PopEvent(); - break; - } - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_DISK_MOVE_NEXT_POINT: + DoAction(1); + events.PopEvent(); + break; + } + } - void MoveInLineOfSight(Unit* who) {} - void AttackStart(Unit* who) {} - }; + void MoveInLineOfSight(Unit* who) {} + void AttackStart(Unit* who) {} + }; }; @@ -1341,59 +1341,59 @@ public: return new npc_alexstraszaAI (pCreature); } - struct npc_alexstraszaAI : public ScriptedAI - { - npc_alexstraszaAI(Creature* pCreature) : ScriptedAI(pCreature) - { - events.Reset(); - events.ScheduleEvent(1, 9000); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - } + struct npc_alexstraszaAI : public ScriptedAI + { + npc_alexstraszaAI(Creature* pCreature) : ScriptedAI(pCreature) + { + events.Reset(); + events.ScheduleEvent(1, 9000); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + } - EventMap events; + EventMap events; - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch(events.GetEvent()) - { - case 0: - break; - case 1: - me->CastSpell(773.98f, 1285.97f, 266.254f, SPELL_ALEXSTRASZA_GIFT, true); - me->SummonGameObject(ALEXSTRASZA_GIFT, 773.98f, 1285.97f, 266.254f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); - me->SummonGameObject(HEART_OF_MAGIC, 773.98f, 1275.97f, 266.254f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch(events.GetEvent()) + { + case 0: + break; + case 1: + me->CastSpell(773.98f, 1285.97f, 266.254f, SPELL_ALEXSTRASZA_GIFT, true); + me->SummonGameObject(ALEXSTRASZA_GIFT, 773.98f, 1285.97f, 266.254f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); + me->SummonGameObject(HEART_OF_MAGIC, 773.98f, 1275.97f, 266.254f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); - me->PlayDirectSound(14406); - me->MonsterYell("I did what I had to, brother. You gave me no alternative.", LANG_UNIVERSAL, 0); - events.PopEvent(); - events.RescheduleEvent(2, 6000); - break; - case 2: - me->PlayDirectSound(14407); - me->MonsterYell("And so ends the Nexus War.", LANG_UNIVERSAL, 0); - events.PopEvent(); - events.RescheduleEvent(3, 5000); - break; - case 3: - me->PlayDirectSound(14408); - me->MonsterYell("This resolution pains me deeply, but the destruction, the monumental loss of life had to end. Regardless of Malygos\' recent transgressions, I will mourn his loss. He was once a guardian, a protector. This day, one of the world\'s mightiest has fallen.", LANG_UNIVERSAL, 0); - events.PopEvent(); - events.RescheduleEvent(4, 22000); - break; - case 4: - me->PlayDirectSound(14409); - me->MonsterYell("The red dragonflight will take on the burden of mending the devastation wrought on Azeroth. Return home to your people and rest. Tomorrow will bring you new challenges, and you must be ready to face them. Life... goes on.", LANG_UNIVERSAL, 0); - events.PopEvent(); - break; - } - } + me->PlayDirectSound(14406); + me->MonsterYell("I did what I had to, brother. You gave me no alternative.", LANG_UNIVERSAL, 0); + events.PopEvent(); + events.RescheduleEvent(2, 6000); + break; + case 2: + me->PlayDirectSound(14407); + me->MonsterYell("And so ends the Nexus War.", LANG_UNIVERSAL, 0); + events.PopEvent(); + events.RescheduleEvent(3, 5000); + break; + case 3: + me->PlayDirectSound(14408); + me->MonsterYell("This resolution pains me deeply, but the destruction, the monumental loss of life had to end. Regardless of Malygos\' recent transgressions, I will mourn his loss. He was once a guardian, a protector. This day, one of the world\'s mightiest has fallen.", LANG_UNIVERSAL, 0); + events.PopEvent(); + events.RescheduleEvent(4, 22000); + break; + case 4: + me->PlayDirectSound(14409); + me->MonsterYell("The red dragonflight will take on the burden of mending the devastation wrought on Azeroth. Return home to your people and rest. Tomorrow will bring you new challenges, and you must be ready to face them. Life... goes on.", LANG_UNIVERSAL, 0); + events.PopEvent(); + break; + } + } - void MoveInLineOfSight(Unit* who) {} - void AttackStart(Unit* who) {} - }; + void MoveInLineOfSight(Unit* who) {} + void AttackStart(Unit* who) {} + }; }; @@ -1407,30 +1407,30 @@ public: return new npc_eoe_wyrmrest_skytalonAI (pCreature); } - struct npc_eoe_wyrmrest_skytalonAI : public VehicleAI - { - npc_eoe_wyrmrest_skytalonAI(Creature* pCreature) : VehicleAI(pCreature) { } + struct npc_eoe_wyrmrest_skytalonAI : public VehicleAI + { + npc_eoe_wyrmrest_skytalonAI(Creature* pCreature) : VehicleAI(pCreature) { } - void PassengerBoarded(Unit* pass, int8 seat, bool apply) - { - if (apply) - { - me->SetDisableGravity(false); - me->SendMovementFlagUpdate(); - } - else if (pass && pass->GetTypeId() == TYPEID_PLAYER && me->IsAlive()) - { - me->SetDisplayId(11686); // prevents nasty falling animation at despawn - me->DespawnOrUnsummon(1); - } - } + void PassengerBoarded(Unit* pass, int8 seat, bool apply) + { + if (apply) + { + me->SetDisableGravity(false); + me->SendMovementFlagUpdate(); + } + else if (pass && pass->GetTypeId() == TYPEID_PLAYER && me->IsAlive()) + { + me->SetDisplayId(11686); // prevents nasty falling animation at despawn + me->DespawnOrUnsummon(1); + } + } - void JustDied(Unit* /*killer*/) - { - me->SetDisplayId(11686); // prevents nasty falling animation at despawn - me->DespawnOrUnsummon(1); - } - }; + void JustDied(Unit* /*killer*/) + { + me->SetDisplayId(11686); // prevents nasty falling animation at despawn + me->DespawnOrUnsummon(1); + } + }; }; @@ -1439,92 +1439,92 @@ class go_the_focusing_iris : public GameObjectScript public: go_the_focusing_iris() : GameObjectScript("go_the_focusing_iris") { } - bool OnGossipHello(Player* user, GameObject* go) - { - if (!user || !go) - return true; - - if (InstanceScript* pInstance = go->GetInstanceScript()) - pInstance->SetData(DATA_IRIS_ACTIVATED, 0); + bool OnGossipHello(Player* user, GameObject* go) + { + if (!user || !go) + return true; + + if (InstanceScript* pInstance = go->GetInstanceScript()) + pInstance->SetData(DATA_IRIS_ACTIVATED, 0); - return true; - } + return true; + } }; class spell_eoe_ph3_surge_of_power : public SpellScriptLoader { - public: - spell_eoe_ph3_surge_of_power() : SpellScriptLoader("spell_eoe_ph3_surge_of_power") { } + public: + spell_eoe_ph3_surge_of_power() : SpellScriptLoader("spell_eoe_ph3_surge_of_power") { } - class spell_eoe_ph3_surge_of_power_SpellScript : public SpellScript - { - PrepareSpellScript(spell_eoe_ph3_surge_of_power_SpellScript); + class spell_eoe_ph3_surge_of_power_SpellScript : public SpellScript + { + PrepareSpellScript(spell_eoe_ph3_surge_of_power_SpellScript); - uint64 DrakeGUID[3]; + uint64 DrakeGUID[3]; - bool Load() - { - memset(&DrakeGUID, 0, sizeof(DrakeGUID)); - if (Unit* caster = GetCaster()) - if (Creature* c = caster->ToCreature()) - { - uint8 i=0; - std::list drakes; - c->AI()->SelectTargetList(drakes, (c->GetMap()->GetSpawnMode() == 0 ? 1 : 3), SELECT_TARGET_RANDOM, 0.0f, false, 57403 /*only drakes have this aura*/); - for (std::list::iterator itr = drakes.begin(); itr != drakes.end() && i < 3; ++itr) - { - DrakeGUID[i++] = (*itr)->GetGUID(); - if (Vehicle* v = (*itr)->GetVehicleKit()) - if (Unit* p = v->GetPassenger(0)) - if (Player* plr = p->ToPlayer()) - { - WorldPacket data; - ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, caster, p, "Malygos fixes his eyes on you!"); - plr->GetSession()->SendPacket(&data); - } - } - } + bool Load() + { + memset(&DrakeGUID, 0, sizeof(DrakeGUID)); + if (Unit* caster = GetCaster()) + if (Creature* c = caster->ToCreature()) + { + uint8 i=0; + std::list drakes; + c->AI()->SelectTargetList(drakes, (c->GetMap()->GetSpawnMode() == 0 ? 1 : 3), SELECT_TARGET_RANDOM, 0.0f, false, 57403 /*only drakes have this aura*/); + for (std::list::iterator itr = drakes.begin(); itr != drakes.end() && i < 3; ++itr) + { + DrakeGUID[i++] = (*itr)->GetGUID(); + if (Vehicle* v = (*itr)->GetVehicleKit()) + if (Unit* p = v->GetPassenger(0)) + if (Player* plr = p->ToPlayer()) + { + WorldPacket data; + ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, caster, p, "Malygos fixes his eyes on you!"); + plr->GetSession()->SendPacket(&data); + } + } + } - return true; - } + return true; + } - void FilterTargets(std::list& targets) - { - if (Unit* caster = GetCaster()) - { - targets.clear(); - for (uint8 i=0; i<3; ++i) - if (DrakeGUID[i]) - if (Unit* u = ObjectAccessor::GetUnit(*caster, DrakeGUID[i])) - targets.push_back(u); - } - } + void FilterTargets(std::list& targets) + { + if (Unit* caster = GetCaster()) + { + targets.clear(); + for (uint8 i=0; i<3; ++i) + if (DrakeGUID[i]) + if (Unit* u = ObjectAccessor::GetUnit(*caster, DrakeGUID[i])) + targets.push_back(u); + } + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eoe_ph3_surge_of_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eoe_ph3_surge_of_power_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_eoe_ph3_surge_of_power_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_eoe_ph3_surge_of_power_SpellScript(); + } }; void AddSC_boss_malygos() { new boss_malygos(); - new npc_power_spark(); - new npc_vortex_ride(); - new npc_alexstrasza(); - new go_the_focusing_iris(); - new npc_nexus_lord(); - new npc_scion_of_eternity(); - new npc_hover_disk(); - new npc_eoe_wyrmrest_skytalon(); + new npc_power_spark(); + new npc_vortex_ride(); + new npc_alexstrasza(); + new go_the_focusing_iris(); + new npc_nexus_lord(); + new npc_scion_of_eternity(); + new npc_hover_disk(); + new npc_eoe_wyrmrest_skytalon(); - new spell_eoe_ph3_surge_of_power(); + new spell_eoe_ph3_surge_of_power(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h b/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h index eafe485ce..932223907 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h @@ -7,72 +7,72 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Objects { - GO_NEXUS_PLATFORM = 193070, - GO_IRIS_N = 193958, - GO_IRIS_H = 193960, - GO_EXIT_PORTAL = 193908, + GO_NEXUS_PLATFORM = 193070, + GO_IRIS_N = 193958, + GO_IRIS_H = 193960, + GO_EXIT_PORTAL = 193908, }; -#define ALEXSTRASZA_GIFT DUNGEON_MODE(193905, 193967) -#define HEART_OF_MAGIC DUNGEON_MODE(194158, 194159) +#define ALEXSTRASZA_GIFT DUNGEON_MODE(193905, 193967) +#define HEART_OF_MAGIC DUNGEON_MODE(194158, 194159) enum NPCs { - NPC_MALYGOS = 28859, - NPC_PORTAL = 30118, - NPC_WORLD_TRIGGER_LAOI = 22517, - NPC_POWER_SPARK = 30084, - NPC_VORTEX = 30090, - NPC_NEXUS_LORD = 30245, - NPC_SCION_OF_ETERNITY = 30249, - NPC_HOVER_DISK = 30248, - NPC_ARCANE_OVERLOAD = 30282, - NPC_SURGE_OF_POWER = 30334, - NPC_WYRMREST_SKYTALON = 30161, - NPC_STATIC_FIELD = 30592, - NPC_ALEXSTRASZA = 32295, + NPC_MALYGOS = 28859, + NPC_PORTAL = 30118, + NPC_WORLD_TRIGGER_LAOI = 22517, + NPC_POWER_SPARK = 30084, + NPC_VORTEX = 30090, + NPC_NEXUS_LORD = 30245, + NPC_SCION_OF_ETERNITY = 30249, + NPC_HOVER_DISK = 30248, + NPC_ARCANE_OVERLOAD = 30282, + NPC_SURGE_OF_POWER = 30334, + NPC_WYRMREST_SKYTALON = 30161, + NPC_STATIC_FIELD = 30592, + NPC_ALEXSTRASZA = 32295, }; enum Data { - DATA_IRIS_ACTIVATED, - DATA_ENCOUNTER_STATUS, - DATA_SET_IRIS_INACTIVE, - DATA_HIDE_IRIS_AND_PORTAL, - DATA_MALYGOS_GUID, + DATA_IRIS_ACTIVATED, + DATA_ENCOUNTER_STATUS, + DATA_SET_IRIS_INACTIVE, + DATA_HIDE_IRIS_AND_PORTAL, + DATA_MALYGOS_GUID, }; enum eSpells { - SPELL_PORTAL_BEAM = 56046, - SPELL_IRIS_ACTIVATED = 61012, - SPELL_POWER_SPARK_VISUAL = 55845, - SPELL_POWER_SPARK_GROUND_BUFF = 55852, - SPELL_POWER_SPARK_MALYGOS_BUFF = 56152, + SPELL_PORTAL_BEAM = 56046, + SPELL_IRIS_ACTIVATED = 61012, + SPELL_POWER_SPARK_VISUAL = 55845, + SPELL_POWER_SPARK_GROUND_BUFF = 55852, + SPELL_POWER_SPARK_MALYGOS_BUFF = 56152, - SPELL_TELEPORT_VISUAL = 52096, + SPELL_TELEPORT_VISUAL = 52096, - SPELL_SCION_ARCANE_BARRAGE = 56397, - SPELL_ARCANE_SHOCK_N = 57058, - SPELL_ARCANE_SHOCK_H = 60073, - SPELL_HASTE = 57060, + SPELL_SCION_ARCANE_BARRAGE = 56397, + SPELL_ARCANE_SHOCK_N = 57058, + SPELL_ARCANE_SHOCK_H = 60073, + SPELL_HASTE = 57060, - SPELL_ALEXSTRASZA_GIFT = 61028, + SPELL_ALEXSTRASZA_GIFT = 61028, }; -#define SPELL_ARCANE_SHOCK DUNGEON_MODE(SPELL_ARCANE_SHOCK_N, SPELL_ARCANE_SHOCK_H) +#define SPELL_ARCANE_SHOCK DUNGEON_MODE(SPELL_ARCANE_SHOCK_N, SPELL_ARCANE_SHOCK_H) enum eAchiev { - ACHIEV_CRITERIA_DENYIN_THE_SCION_10 = 7573, - ACHIEV_CRITERIA_DENYIN_THE_SCION_25 = 7574, - ACHIEV_CRITERIA_A_POKE_IN_THE_EYE_10 = 7174, - ACHIEV_CRITERIA_A_POKE_IN_THE_EYE_25 = 7175, - ACHIEV_YOU_DONT_HAVE_AN_ENTERNITY_EVENT = 20387, + ACHIEV_CRITERIA_DENYIN_THE_SCION_10 = 7573, + ACHIEV_CRITERIA_DENYIN_THE_SCION_25 = 7574, + ACHIEV_CRITERIA_A_POKE_IN_THE_EYE_10 = 7174, + ACHIEV_CRITERIA_A_POKE_IN_THE_EYE_25 = 7175, + ACHIEV_YOU_DONT_HAVE_AN_ENTERNITY_EVENT = 20387, }; /*** POSITIONS/WAYPOINTS BELOW ***/ -#define INTRO_MOVEMENT_INTERVAL 25000 +#define INTRO_MOVEMENT_INTERVAL 25000 const Position CenterPos = {754.395f, 1301.27f, 266.10f, 0.0f}; @@ -90,41 +90,41 @@ const Position Phase2NorthPos = {837.22f, 1301.676f, 296.10f, M_PI}; enum sounds { - SOUND_VORTEX = 14525, - SOUND_SPARK_BUFF = 14533, + SOUND_VORTEX = 14525, + SOUND_SPARK_BUFF = 14533, - SOUND_SLAY_1_1 = 14519, - SOUND_SLAY_1_2 = 14520, - SOUND_SLAY_1_3 = 14521, - SOUND_SLAY_2_1 = 14526, - SOUND_SLAY_2_2 = 14527, - SOUND_SLAY_2_3 = 14528, - SOUND_SLAY_3_1 = 14534, - SOUND_SLAY_3_2 = 14535, - SOUND_SLAY_3_3 = 14536, - - SOUND_AGGRO_1 = 14517, - SOUND_AGGRO_2 = 14523, - SOUND_DEEP_BREATH = 14518, - SOUND_DEATH = 14540, - SOUND_PHASE_1_END = 14522, - SOUND_PHASE_2_END = 14529, - SOUND_PHASE_3_START = 14530 + SOUND_SLAY_1_1 = 14519, + SOUND_SLAY_1_2 = 14520, + SOUND_SLAY_1_3 = 14521, + SOUND_SLAY_2_1 = 14526, + SOUND_SLAY_2_2 = 14527, + SOUND_SLAY_2_3 = 14528, + SOUND_SLAY_3_1 = 14534, + SOUND_SLAY_3_2 = 14535, + SOUND_SLAY_3_3 = 14536, + + SOUND_AGGRO_1 = 14517, + SOUND_AGGRO_2 = 14523, + SOUND_DEEP_BREATH = 14518, + SOUND_DEATH = 14540, + SOUND_PHASE_1_END = 14522, + SOUND_PHASE_2_END = 14529, + SOUND_PHASE_3_START = 14530 }; struct Speech { - uint32 sound; - const char* text; + uint32 sound; + const char* text; }; const Speech MalygosIntroTexts[] = { - {14512, "Lesser beings, intruding here! A shame that your excess courage does not compensate for your stupidity!"}, - {14513, "None but the blue dragonflight are welcome here! Perhaps this is the work of Alexstrasza? Well then, she has sent you to your deaths."}, - {14514, "What could you hope to accomplish, to storm brazenly into my domain? To employ MAGIC? Against ME?"}, - {14515, "I am without limits here... the rules of your cherished reality do not apply... In this realm, I am in control..."}, - {14516, "I give you one chance. Pledge fealty to me, and perhaps I won\'t slaughter you for your insolence!"}, + {14512, "Lesser beings, intruding here! A shame that your excess courage does not compensate for your stupidity!"}, + {14513, "None but the blue dragonflight are welcome here! Perhaps this is the work of Alexstrasza? Well then, she has sent you to your deaths."}, + {14514, "What could you hope to accomplish, to storm brazenly into my domain? To employ MAGIC? Against ME?"}, + {14515, "I am without limits here... the rules of your cherished reality do not apply... In this realm, I am in control..."}, + {14516, "I give you one chance. Pledge fealty to me, and perhaps I won\'t slaughter you for your insolence!"}, }; const uint32 MalygosIntroIntervals[] = {18000, 19000, 21000, 18000, 15000}; @@ -134,9 +134,9 @@ class EoEDrakeEnterVehicleEvent : public BasicEvent public: EoEDrakeEnterVehicleEvent(Creature& owner, uint64 playerGUID) : _owner(owner), _playerGUID(playerGUID) { } bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/); - private: + private: Creature& _owner; - uint64 _playerGUID; + uint64 _playerGUID; }; #endif diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index 58e1444ea..f52628dbe 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -10,257 +10,257 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! bool EoEDrakeEnterVehicleEvent::Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) { - if (Player* p = ObjectAccessor::GetPlayer(_owner, _playerGUID)) - if (p->IsInWorld() && !p->IsDuringRemoveFromWorld() && !p->isBeingLoaded() && p->FindMap() == _owner.FindMap()) - { - p->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, &_owner, true); - return true; - } - _owner.DespawnOrUnsummon(1); - return true; + if (Player* p = ObjectAccessor::GetPlayer(_owner, _playerGUID)) + if (p->IsInWorld() && !p->IsDuringRemoveFromWorld() && !p->isBeingLoaded() && p->FindMap() == _owner.FindMap()) + { + p->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, &_owner, true); + return true; + } + _owner.DespawnOrUnsummon(1); + return true; } class instance_eye_of_eternity : public InstanceMapScript { public: - instance_eye_of_eternity() : InstanceMapScript("instance_eye_of_eternity", 616) { } + instance_eye_of_eternity() : InstanceMapScript("instance_eye_of_eternity", 616) { } - InstanceScript* GetInstanceScript(InstanceMap* pMap) const - { - return new instance_eye_of_eternity_InstanceMapScript(pMap); - } + InstanceScript* GetInstanceScript(InstanceMap* pMap) const + { + return new instance_eye_of_eternity_InstanceMapScript(pMap); + } - struct instance_eye_of_eternity_InstanceMapScript : public InstanceScript - { - instance_eye_of_eternity_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } + struct instance_eye_of_eternity_InstanceMapScript : public InstanceScript + { + instance_eye_of_eternity_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } - uint32 EncounterStatus; - std::string str_data; + uint32 EncounterStatus; + std::string str_data; - uint64 NPC_MalygosGUID; - uint64 GO_IrisGUID; - uint64 GO_ExitPortalGUID; - uint64 GO_PlatformGUID; - bool bPokeAchiev; + uint64 NPC_MalygosGUID; + uint64 GO_IrisGUID; + uint64 GO_ExitPortalGUID; + uint64 GO_PlatformGUID; + bool bPokeAchiev; - void Initialize() - { - EncounterStatus = NOT_STARTED; + void Initialize() + { + EncounterStatus = NOT_STARTED; - NPC_MalygosGUID = 0; - GO_IrisGUID = 0; - GO_ExitPortalGUID = 0; - GO_PlatformGUID = 0; - bPokeAchiev = false; - } - - bool IsEncounterInProgress() const - { - return EncounterStatus == IN_PROGRESS; - } + NPC_MalygosGUID = 0; + GO_IrisGUID = 0; + GO_ExitPortalGUID = 0; + GO_PlatformGUID = 0; + bPokeAchiev = false; + } + + bool IsEncounterInProgress() const + { + return EncounterStatus == IN_PROGRESS; + } - void OnPlayerEnter(Player* pPlayer) - { - if (EncounterStatus == DONE) - { - // destroy platform, hide iris (actually ensure, done at loading, but doesn't always work - ProcessEvent(NULL, 20158); - if (GameObject* go = instance->GetGameObject(GO_IrisGUID)) - if (go->GetPhaseMask() != 2) - go->SetPhaseMask(2, true); + void OnPlayerEnter(Player* pPlayer) + { + if (EncounterStatus == DONE) + { + // destroy platform, hide iris (actually ensure, done at loading, but doesn't always work + ProcessEvent(NULL, 20158); + if (GameObject* go = instance->GetGameObject(GO_IrisGUID)) + if (go->GetPhaseMask() != 2) + go->SetPhaseMask(2, true); - // no floor, so put players on drakes - if (pPlayer) - { - if (!pPlayer->IsAlive()) - return; + // no floor, so put players on drakes + if (pPlayer) + { + if (!pPlayer->IsAlive()) + return; - if (Creature* c = pPlayer->SummonCreature(NPC_WYRMREST_SKYTALON, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ()-20.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0)) - { - c->SetCanFly(true); - c->setFaction(pPlayer->getFaction()); - //pPlayer->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, c, true); - c->m_Events.AddEvent(new EoEDrakeEnterVehicleEvent(*c, pPlayer->GetGUID()), c->m_Events.CalculateTime(500)); - } - } - } - } + if (Creature* c = pPlayer->SummonCreature(NPC_WYRMREST_SKYTALON, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ()-20.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0)) + { + c->SetCanFly(true); + c->setFaction(pPlayer->getFaction()); + //pPlayer->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, c, true); + c->m_Events.AddEvent(new EoEDrakeEnterVehicleEvent(*c, pPlayer->GetGUID()), c->m_Events.CalculateTime(500)); + } + } + } + } - void OnCreatureCreate(Creature* creature) - { - switch(creature->GetEntry()) - { - case NPC_MALYGOS: - NPC_MalygosGUID = creature->GetGUID(); - break; - } - } + void OnCreatureCreate(Creature* creature) + { + switch(creature->GetEntry()) + { + case NPC_MALYGOS: + NPC_MalygosGUID = creature->GetGUID(); + break; + } + } - void OnGameObjectCreate(GameObject* go) - { - switch(go->GetEntry()) - { - case GO_IRIS_N: - case GO_IRIS_H: - GO_IrisGUID = go->GetGUID(); - break; - case GO_EXIT_PORTAL: - GO_ExitPortalGUID = go->GetGUID(); - break; - case GO_NEXUS_PLATFORM: - GO_PlatformGUID = go->GetGUID(); - break; - } - } + void OnGameObjectCreate(GameObject* go) + { + switch(go->GetEntry()) + { + case GO_IRIS_N: + case GO_IRIS_H: + GO_IrisGUID = go->GetGUID(); + break; + case GO_EXIT_PORTAL: + GO_ExitPortalGUID = go->GetGUID(); + break; + case GO_NEXUS_PLATFORM: + GO_PlatformGUID = go->GetGUID(); + break; + } + } - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_IRIS_ACTIVATED: - if (EncounterStatus == NOT_STARTED) - if (Creature* c = instance->GetCreature(NPC_MalygosGUID)) - if (Player* plr = c->SelectNearestPlayer(250.0f)) - c->AI()->AttackStart(plr); - break; - case DATA_ENCOUNTER_STATUS: - EncounterStatus = data; - switch(data) - { - case NOT_STARTED: - bPokeAchiev = false; - if (GameObject* go = instance->GetGameObject(GO_IrisGUID)) - { - go->SetPhaseMask(1, true); - HandleGameObject(GO_IrisGUID, false, go); - } - if (GameObject* go = instance->GetGameObject(GO_ExitPortalGUID)) - go->SetPhaseMask(1, true); - if (GameObject* go = instance->GetGameObject(GO_PlatformGUID)) - { - go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); - go->EnableCollision(true); - } - break; - case IN_PROGRESS: - bPokeAchiev = (instance->GetPlayersCountExceptGMs() < (instance->GetSpawnMode() == 0 ? (uint32)9 : (uint32)21)); - break; - case DONE: - bPokeAchiev = false; - if (GameObject* go = instance->GetGameObject(GO_ExitPortalGUID)) - go->SetPhaseMask(1, true); - if (Creature* c = instance->GetCreature(NPC_MalygosGUID)) - if (Creature* alexstrasza = c->SummonCreature(NPC_ALEXSTRASZA, 798.0f, 1268.0f, 299.0f, 2.45f ,TEMPSUMMON_TIMED_DESPAWN, 604800000)) - break; - } - if (data == DONE) - SaveToDB(); - break; - case DATA_SET_IRIS_INACTIVE: - if (GameObject* go = instance->GetGameObject(GO_IrisGUID)) - { - HandleGameObject(GO_IrisGUID, true, go); - if (Creature* c = go->SummonCreature(NPC_WORLD_TRIGGER_LAOI, *go, TEMPSUMMON_TIMED_DESPAWN, 10000)) - c->CastSpell(c, SPELL_IRIS_ACTIVATED, true); - } - break; - case DATA_HIDE_IRIS_AND_PORTAL: - if (GameObject* go = instance->GetGameObject(GO_IrisGUID)) - go->SetPhaseMask(2, true); - if (GameObject* go = instance->GetGameObject(GO_ExitPortalGUID)) - go->SetPhaseMask(2, true); - break; - } - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_IRIS_ACTIVATED: + if (EncounterStatus == NOT_STARTED) + if (Creature* c = instance->GetCreature(NPC_MalygosGUID)) + if (Player* plr = c->SelectNearestPlayer(250.0f)) + c->AI()->AttackStart(plr); + break; + case DATA_ENCOUNTER_STATUS: + EncounterStatus = data; + switch(data) + { + case NOT_STARTED: + bPokeAchiev = false; + if (GameObject* go = instance->GetGameObject(GO_IrisGUID)) + { + go->SetPhaseMask(1, true); + HandleGameObject(GO_IrisGUID, false, go); + } + if (GameObject* go = instance->GetGameObject(GO_ExitPortalGUID)) + go->SetPhaseMask(1, true); + if (GameObject* go = instance->GetGameObject(GO_PlatformGUID)) + { + go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); + go->EnableCollision(true); + } + break; + case IN_PROGRESS: + bPokeAchiev = (instance->GetPlayersCountExceptGMs() < (instance->GetSpawnMode() == 0 ? (uint32)9 : (uint32)21)); + break; + case DONE: + bPokeAchiev = false; + if (GameObject* go = instance->GetGameObject(GO_ExitPortalGUID)) + go->SetPhaseMask(1, true); + if (Creature* c = instance->GetCreature(NPC_MalygosGUID)) + if (Creature* alexstrasza = c->SummonCreature(NPC_ALEXSTRASZA, 798.0f, 1268.0f, 299.0f, 2.45f ,TEMPSUMMON_TIMED_DESPAWN, 604800000)) + break; + } + if (data == DONE) + SaveToDB(); + break; + case DATA_SET_IRIS_INACTIVE: + if (GameObject* go = instance->GetGameObject(GO_IrisGUID)) + { + HandleGameObject(GO_IrisGUID, true, go); + if (Creature* c = go->SummonCreature(NPC_WORLD_TRIGGER_LAOI, *go, TEMPSUMMON_TIMED_DESPAWN, 10000)) + c->CastSpell(c, SPELL_IRIS_ACTIVATED, true); + } + break; + case DATA_HIDE_IRIS_AND_PORTAL: + if (GameObject* go = instance->GetGameObject(GO_IrisGUID)) + go->SetPhaseMask(2, true); + if (GameObject* go = instance->GetGameObject(GO_ExitPortalGUID)) + go->SetPhaseMask(2, true); + break; + } + } - uint64 GetData64(uint32 type) const - { - switch(type) - { - case DATA_MALYGOS_GUID: return NPC_MalygosGUID; - } - return 0; - } + uint64 GetData64(uint32 type) const + { + switch(type) + { + case DATA_MALYGOS_GUID: return NPC_MalygosGUID; + } + return 0; + } - void ProcessEvent(WorldObject* /*unit*/, uint32 eventId) - { - switch(eventId) - { - case 20158: - if (GameObject* go = instance->GetGameObject(GO_PlatformGUID)) - if (Creature* c = instance->GetCreature(NPC_MalygosGUID)) - { - go->ModifyHealth(-1000000, c); - go->EnableCollision(false); - } - break; - } - } + void ProcessEvent(WorldObject* /*unit*/, uint32 eventId) + { + switch(eventId) + { + case 20158: + if (GameObject* go = instance->GetGameObject(GO_PlatformGUID)) + if (Creature* c = instance->GetCreature(NPC_MalygosGUID)) + { + go->ModifyHealth(-1000000, c); + go->EnableCollision(false); + } + break; + } + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "E E " << EncounterStatus; - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + std::ostringstream saveStream; + saveStream << "E E " << EncounterStatus; + str_data = saveStream.str(); + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if( !in ) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if( !in ) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint32 data0; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0; + char dataHead1, dataHead2; + uint32 data0; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0; - if( dataHead1 == 'E' && dataHead2 == 'E' ) - { - EncounterStatus = data0; - switch(EncounterStatus) - { - case IN_PROGRESS: - EncounterStatus = NOT_STARTED; - break; - case DONE: - // destroy platform, hide iris - ProcessEvent(NULL, 20158); - if (GameObject* go = instance->GetGameObject(GO_IrisGUID)) - go->SetPhaseMask(2, true); - break; - } - } - else - OUT_LOAD_INST_DATA_FAIL; + if( dataHead1 == 'E' && dataHead2 == 'E' ) + { + EncounterStatus = data0; + switch(EncounterStatus) + { + case IN_PROGRESS: + EncounterStatus = NOT_STARTED; + break; + case DONE: + // destroy platform, hide iris + ProcessEvent(NULL, 20158); + if (GameObject* go = instance->GetGameObject(GO_IrisGUID)) + go->SetPhaseMask(2, true); + break; + } + } + else + OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case ACHIEV_CRITERIA_A_POKE_IN_THE_EYE_10: - case ACHIEV_CRITERIA_A_POKE_IN_THE_EYE_25: - return bPokeAchiev; - case ACHIEV_CRITERIA_DENYIN_THE_SCION_10: - case ACHIEV_CRITERIA_DENYIN_THE_SCION_25: - return (source && source->GetVehicle() && source->GetVehicle()->GetVehicleInfo()->m_ID == 224); - } - return false; - } - }; + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case ACHIEV_CRITERIA_A_POKE_IN_THE_EYE_10: + case ACHIEV_CRITERIA_A_POKE_IN_THE_EYE_25: + return bPokeAchiev; + case ACHIEV_CRITERIA_DENYIN_THE_SCION_10: + case ACHIEV_CRITERIA_DENYIN_THE_SCION_25: + return (source && source->GetVehicle() && source->GetVehicle()->GetVehicleInfo()->m_ID == 224); + } + return false; + } + }; }; void AddSC_instance_eye_of_eternity() { - new instance_eye_of_eternity(); + new instance_eye_of_eternity(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp index a7c80b3dc..7ed901c5c 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp @@ -10,28 +10,28 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_SPARK = 47751, - SPELL_RIFT_SHIELD = 47748, - SPELL_CHARGE_RIFTS = 47747, - SPELL_CREATE_RIFT = 47743, - SPELL_ARCANE_ATTRACTION = 57063, - SPELL_CLOSE_RIFTS = 47745 + SPELL_SPARK = 47751, + SPELL_RIFT_SHIELD = 47748, + SPELL_CHARGE_RIFTS = 47747, + SPELL_CREATE_RIFT = 47743, + SPELL_ARCANE_ATTRACTION = 57063, + SPELL_CLOSE_RIFTS = 47745 }; enum Yells { - SAY_AGGRO = 0, - SAY_DEATH = 1, - SAY_RIFT = 2, - EMOTE_RIFT = 3, - EMOTE_SHIELD = 4 + SAY_AGGRO = 0, + SAY_DEATH = 1, + SAY_RIFT = 2, + EMOTE_RIFT = 3, + EMOTE_SHIELD = 4 }; enum Events { - EVENT_ANOMALUS_SPARK = 1, - EVENT_ANOMALUS_HEALTH = 2, - EVENT_ANOMALUS_ARCANE_ATTRACTION = 3 + EVENT_ANOMALUS_SPARK = 1, + EVENT_ANOMALUS_HEALTH = 2, + EVENT_ANOMALUS_ARCANE_ATTRACTION = 3 }; class ChargeRifts : public BasicEvent @@ -43,8 +43,8 @@ class ChargeRifts : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - _caster->AI()->Talk(EMOTE_SHIELD); - _caster->CastSpell(_caster, SPELL_CHARGE_RIFTS, true); + _caster->AI()->Talk(EMOTE_SHIELD); + _caster->CastSpell(_caster, SPELL_CHARGE_RIFTS, true); return true; } @@ -54,115 +54,115 @@ class ChargeRifts : public BasicEvent class boss_anomalus : public CreatureScript { - public: - boss_anomalus() : CreatureScript("boss_anomalus") { } + public: + boss_anomalus() : CreatureScript("boss_anomalus") { } - CreatureAI* GetAI(Creature* creature) const - { - return new boss_anomalusAI (creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_anomalusAI (creature); + } - struct boss_anomalusAI : public BossAI - { - boss_anomalusAI(Creature* creature) : BossAI(creature, DATA_ANOMALUS_EVENT) - { - } + struct boss_anomalusAI : public BossAI + { + boss_anomalusAI(Creature* creature) : BossAI(creature, DATA_ANOMALUS_EVENT) + { + } - bool achievement; + bool achievement; - void Reset() - { - BossAI::Reset(); - achievement = true; - me->CastSpell(me, SPELL_CLOSE_RIFTS, true); - } + void Reset() + { + BossAI::Reset(); + achievement = true; + me->CastSpell(me, SPELL_CLOSE_RIFTS, true); + } - uint32 GetData(uint32 data) const - { - if (data == me->GetEntry()) - return achievement; - return 0; - } + uint32 GetData(uint32 data) const + { + if (data == me->GetEntry()) + return achievement; + return 0; + } - void SetData(uint32 type, uint32) - { - if (type == me->GetEntry()) - { - me->RemoveAura(SPELL_RIFT_SHIELD); - me->InterruptNonMeleeSpells(false); - achievement = false; - } - } + void SetData(uint32 type, uint32) + { + if (type == me->GetEntry()) + { + me->RemoveAura(SPELL_RIFT_SHIELD); + me->InterruptNonMeleeSpells(false); + achievement = false; + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - BossAI::EnterCombat(who); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + BossAI::EnterCombat(who); - events.SetTimer(45000); - events.ScheduleEvent(EVENT_ANOMALUS_SPARK, 5000); - events.ScheduleEvent(EVENT_ANOMALUS_HEALTH, 1000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_ANOMALUS_ARCANE_ATTRACTION, 8000); - } + events.SetTimer(45000); + events.ScheduleEvent(EVENT_ANOMALUS_SPARK, 5000); + events.ScheduleEvent(EVENT_ANOMALUS_HEALTH, 1000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_ANOMALUS_ARCANE_ATTRACTION, 8000); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - me->CastSpell(me, SPELL_CLOSE_RIFTS, true); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + me->CastSpell(me, SPELL_CLOSE_RIFTS, true); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ANOMALUS_HEALTH: - if (me->HealthBelowPct(51)) - { - Talk(SAY_RIFT); - Talk(EMOTE_RIFT); - - me->CastSpell(me, SPELL_CREATE_RIFT, false); - me->CastSpell(me, SPELL_RIFT_SHIELD, true); - me->m_Events.AddEvent(new ChargeRifts(me), me->m_Events.CalculateTime(1000)); - events.DelayEvents(46000); - break; - } - events.ScheduleEvent(EVENT_ANOMALUS_HEALTH, 1000); - break; - case EVENT_ANOMALUS_SPARK: - me->CastSpell(me->GetVictim(), SPELL_SPARK, false); - events.ScheduleEvent(EVENT_ANOMALUS_SPARK, 5000); - break; - case EVENT_ANOMALUS_ARCANE_ATTRACTION: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, SPELL_ARCANE_ATTRACTION, false); - events.ScheduleEvent(EVENT_ANOMALUS_ARCANE_ATTRACTION, 15000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_ANOMALUS_HEALTH: + if (me->HealthBelowPct(51)) + { + Talk(SAY_RIFT); + Talk(EMOTE_RIFT); + + me->CastSpell(me, SPELL_CREATE_RIFT, false); + me->CastSpell(me, SPELL_RIFT_SHIELD, true); + me->m_Events.AddEvent(new ChargeRifts(me), me->m_Events.CalculateTime(1000)); + events.DelayEvents(46000); + break; + } + events.ScheduleEvent(EVENT_ANOMALUS_HEALTH, 1000); + break; + case EVENT_ANOMALUS_SPARK: + me->CastSpell(me->GetVictim(), SPELL_SPARK, false); + events.ScheduleEvent(EVENT_ANOMALUS_SPARK, 5000); + break; + case EVENT_ANOMALUS_ARCANE_ATTRACTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, SPELL_ARCANE_ATTRACTION, false); + events.ScheduleEvent(EVENT_ANOMALUS_ARCANE_ATTRACTION, 15000); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(); } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetHomePosition().GetExactDist2d(me) > 60.0f; - } - }; + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetHomePosition().GetExactDist2d(me) > 60.0f; + } + }; }; class achievement_chaos_theory : public AchievementCriteriaScript @@ -177,12 +177,12 @@ class achievement_chaos_theory : public AchievementCriteriaScript if (!target) return false; - return target->GetAI()->GetData(target->GetEntry()); + return target->GetAI()->GetData(target->GetEntry()); } }; void AddSC_boss_anomalus() { new boss_anomalus(); - new achievement_chaos_theory(); + new achievement_chaos_theory(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_stoutbeard_kolurg.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_stoutbeard_kolurg.cpp index 5d6c2a0e8..9c3f9ae58 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_stoutbeard_kolurg.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_commander_stoutbeard_kolurg.cpp @@ -8,109 +8,109 @@ REWRITTEN BY XINEF enum Spells { - SPELL_BATTLE_SHOUT = 31403, - SPELL_CHARGE = 60067, - SPELL_FRIGHTENING_SHOUT = 19134, - SPELL_WHIRLWIND = 38618 + SPELL_BATTLE_SHOUT = 31403, + SPELL_CHARGE = 60067, + SPELL_FRIGHTENING_SHOUT = 19134, + SPELL_WHIRLWIND = 38618 }; enum Events { - EVENT_BATTLE_SHOUT = 1, - EVENT_FRIGHTENING_SHOUT = 2, - EVENT_WHIRLWIND = 3, - EVENT_COMMANDER_CHARGE = 4, - EVENT_KILL_TALK = 5 + EVENT_BATTLE_SHOUT = 1, + EVENT_FRIGHTENING_SHOUT = 2, + EVENT_WHIRLWIND = 3, + EVENT_COMMANDER_CHARGE = 4, + EVENT_KILL_TALK = 5 }; enum Says { - SAY_AGGRO = 0, - SAY_DEATH = 1, - SAY_KILL = 2 + SAY_AGGRO = 0, + SAY_DEATH = 1, + SAY_KILL = 2 }; class boss_commander_stoutbeard : public CreatureScript { - public: - boss_commander_stoutbeard() : CreatureScript("boss_commander_stoutbeard") { } + public: + boss_commander_stoutbeard() : CreatureScript("boss_commander_stoutbeard") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_commander_stoutbeardAI : public BossAI - { - boss_commander_stoutbeardAI(Creature* creature) : BossAI(creature, DATA_COMMANDER_EVENT) - { - } + struct boss_commander_stoutbeardAI : public BossAI + { + boss_commander_stoutbeardAI(Creature* creature) : BossAI(creature, DATA_COMMANDER_EVENT) + { + } - void Reset() - { - BossAI::Reset(); - } + void Reset() + { + BossAI::Reset(); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); - - events.ScheduleEvent(EVENT_BATTLE_SHOUT, 0); - events.ScheduleEvent(EVENT_FRIGHTENING_SHOUT, 10000); - events.ScheduleEvent(EVENT_WHIRLWIND, 15000); - events.ScheduleEvent(EVENT_COMMANDER_CHARGE, 1000); - me->RemoveAllAuras(); - } + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); + + events.ScheduleEvent(EVENT_BATTLE_SHOUT, 0); + events.ScheduleEvent(EVENT_FRIGHTENING_SHOUT, 10000); + events.ScheduleEvent(EVENT_WHIRLWIND, 15000); + events.ScheduleEvent(EVENT_COMMANDER_CHARGE, 1000); + me->RemoveAllAuras(); + } - void KilledUnit(Unit*) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit*) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - Talk(SAY_DEATH); - } - - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + Talk(SAY_DEATH); + } + + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_BATTLE_SHOUT: - me->CastSpell(me, SPELL_BATTLE_SHOUT, true); - events.ScheduleEvent(EVENT_BATTLE_SHOUT, 120000); - break; - case EVENT_FRIGHTENING_SHOUT: - me->CastSpell(me->GetVictim(), SPELL_FRIGHTENING_SHOUT, false); - events.ScheduleEvent(EVENT_FRIGHTENING_SHOUT, urand(15000, 20000)); - break; - case EVENT_WHIRLWIND: - me->CastSpell(me, SPELL_WHIRLWIND, false); - events.ScheduleEvent(EVENT_WHIRLWIND, 16000); - break; - case EVENT_COMMANDER_CHARGE: - if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 25.0f)) - me->CastSpell(target, SPELL_CHARGE, false); - events.ScheduleEvent(EVENT_COMMANDER_CHARGE, 20000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_BATTLE_SHOUT: + me->CastSpell(me, SPELL_BATTLE_SHOUT, true); + events.ScheduleEvent(EVENT_BATTLE_SHOUT, 120000); + break; + case EVENT_FRIGHTENING_SHOUT: + me->CastSpell(me->GetVictim(), SPELL_FRIGHTENING_SHOUT, false); + events.ScheduleEvent(EVENT_FRIGHTENING_SHOUT, urand(15000, 20000)); + break; + case EVENT_WHIRLWIND: + me->CastSpell(me, SPELL_WHIRLWIND, false); + events.ScheduleEvent(EVENT_WHIRLWIND, 16000); + break; + case EVENT_COMMANDER_CHARGE: + if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 25.0f)) + me->CastSpell(target, SPELL_CHARGE, false); + events.ScheduleEvent(EVENT_COMMANDER_CHARGE, 20000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_commander_stoutbeard() diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index 2d8d7beda..ce4291340 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -9,14 +9,14 @@ REWRITTEN BY XINEF enum eEnums { - SPELL_FROZEN_PRISON = 47854, - SPELL_TAIL_SWEEP = 50155, - SPELL_CRYSTAL_CHAINS = 50997, - SPELL_ENRAGE = 8599, - SPELL_CRYSTALFIRE_BREATH = 48096, - SPELL_CRYSTALIZE = 48179, - SPELL_INTENSE_COLD = 48094, - SPELL_INTENSE_COLD_TRIGGER = 48095, + SPELL_FROZEN_PRISON = 47854, + SPELL_TAIL_SWEEP = 50155, + SPELL_CRYSTAL_CHAINS = 50997, + SPELL_ENRAGE = 8599, + SPELL_CRYSTALFIRE_BREATH = 48096, + SPELL_CRYSTALIZE = 48179, + SPELL_INTENSE_COLD = 48094, + SPELL_INTENSE_COLD_TRIGGER = 48095, }; enum Yells @@ -26,157 +26,157 @@ enum Yells SAY_ENRAGE = 2, SAY_DEATH = 3, SAY_CRYSTAL_NOVA = 4, - EMOTE_FRENZY = 5 + EMOTE_FRENZY = 5 }; enum Events { - EVENT_CRYSTALFIRE_BREATH = 1, - EVENT_CRYSTAL_CHAINS = 2, - EVENT_TAIL_SWEEP = 3, - EVENT_HEALTH_CHECK = 4, - EVENT_ACHIEVEMENT_CHECK = 5, - EVENT_KILL_TALK = 6 + EVENT_CRYSTALFIRE_BREATH = 1, + EVENT_CRYSTAL_CHAINS = 2, + EVENT_TAIL_SWEEP = 3, + EVENT_HEALTH_CHECK = 4, + EVENT_ACHIEVEMENT_CHECK = 5, + EVENT_KILL_TALK = 6 }; class boss_keristrasza : public CreatureScript { - public: - boss_keristrasza() : CreatureScript("boss_keristrasza") { } + public: + boss_keristrasza() : CreatureScript("boss_keristrasza") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_keristraszaAI : public BossAI - { - boss_keristraszaAI(Creature* creature) : BossAI(creature, DATA_KERISTRASZA_EVENT) - { - } + struct boss_keristraszaAI : public BossAI + { + boss_keristraszaAI(Creature* creature) : BossAI(creature, DATA_KERISTRASZA_EVENT) + { + } - std::set aGuids; + std::set aGuids; - void Reset() - { - BossAI::Reset(); - RemovePrison(CanRemovePrison()); - aGuids.clear(); - } + void Reset() + { + BossAI::Reset(); + RemovePrison(CanRemovePrison()); + aGuids.clear(); + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - BossAI::EnterCombat(who); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + BossAI::EnterCombat(who); - me->CastSpell(me, SPELL_INTENSE_COLD, true); - events.ScheduleEvent(EVENT_CRYSTALFIRE_BREATH, 14000); - events.ScheduleEvent(EVENT_CRYSTAL_CHAINS, DUNGEON_MODE(20000,11000)); - events.ScheduleEvent(EVENT_TAIL_SWEEP, 5000); - events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); - events.ScheduleEvent(EVENT_ACHIEVEMENT_CHECK, 1000); - } + me->CastSpell(me, SPELL_INTENSE_COLD, true); + events.ScheduleEvent(EVENT_CRYSTALFIRE_BREATH, 14000); + events.ScheduleEvent(EVENT_CRYSTAL_CHAINS, DUNGEON_MODE(20000,11000)); + events.ScheduleEvent(EVENT_TAIL_SWEEP, 5000); + events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); + events.ScheduleEvent(EVENT_ACHIEVEMENT_CHECK, 1000); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + } - void KilledUnit(Unit*) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit*) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void SetData(uint32 type, uint32) - { - if (type == me->GetEntry() && CanRemovePrison()) - RemovePrison(true); - } + void SetData(uint32 type, uint32) + { + if (type == me->GetEntry() && CanRemovePrison()) + RemovePrison(true); + } - bool CanRemovePrison() - { - for (uint8 i = DATA_TELESTRA_ORB; i <= DATA_ORMOROK_ORB; ++i) - if (instance->GetBossState(i) != DONE) - return false; - return true; - } + bool CanRemovePrison() + { + for (uint8 i = DATA_TELESTRA_ORB; i <= DATA_ORMOROK_ORB; ++i) + if (instance->GetBossState(i) != DONE) + return false; + return true; + } - void RemovePrison(bool remove) - { - if (remove) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveAurasDueToSpell(SPELL_FROZEN_PRISON); - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->CastSpell(me, SPELL_FROZEN_PRISON, true); - } - } + void RemovePrison(bool remove) + { + if (remove) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveAurasDueToSpell(SPELL_FROZEN_PRISON); + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->CastSpell(me, SPELL_FROZEN_PRISON, true); + } + } - uint32 GetData(uint32 guid) const - { - return aGuids.find(guid) == aGuids.end(); - } + uint32 GetData(uint32 guid) const + { + return aGuids.find(guid) == aGuids.end(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_HEALTH_CHECK: - if (me->HealthBelowPct(26)) - { - Talk(SAY_ENRAGE); - Talk(EMOTE_FRENZY); - me->CastSpell(me, SPELL_ENRAGE, true); - break; - } - events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); - break; - case EVENT_ACHIEVEMENT_CHECK: - { - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (Aura *aur = itr->GetSource()->GetAura(SPELL_INTENSE_COLD_TRIGGER)) - if (aur->GetStackAmount() > 2) - aGuids.insert(itr->GetSource()->GetGUIDLow()); - events.ScheduleEvent(EVENT_ACHIEVEMENT_CHECK, 500); - break; - } - case EVENT_CRYSTALFIRE_BREATH: - me->CastSpell(me->GetVictim(), SPELL_CRYSTALFIRE_BREATH, false); - events.ScheduleEvent(EVENT_CRYSTALFIRE_BREATH, 14000); - break; - case EVENT_TAIL_SWEEP: - me->CastSpell(me, SPELL_TAIL_SWEEP, false); - events.ScheduleEvent(EVENT_TAIL_SWEEP, 5000); - break; - case EVENT_CRYSTAL_CHAINS: - Talk(SAY_CRYSTAL_NOVA); - if (IsHeroic()) - me->CastSpell(me, SPELL_CRYSTALIZE, false); - else if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) - me->CastSpell(target, SPELL_CRYSTAL_CHAINS, false); - events.ScheduleEvent(EVENT_CRYSTAL_CHAINS, DUNGEON_MODE(20000, 11000)); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_HEALTH_CHECK: + if (me->HealthBelowPct(26)) + { + Talk(SAY_ENRAGE); + Talk(EMOTE_FRENZY); + me->CastSpell(me, SPELL_ENRAGE, true); + break; + } + events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); + break; + case EVENT_ACHIEVEMENT_CHECK: + { + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if (Aura *aur = itr->GetSource()->GetAura(SPELL_INTENSE_COLD_TRIGGER)) + if (aur->GetStackAmount() > 2) + aGuids.insert(itr->GetSource()->GetGUIDLow()); + events.ScheduleEvent(EVENT_ACHIEVEMENT_CHECK, 500); + break; + } + case EVENT_CRYSTALFIRE_BREATH: + me->CastSpell(me->GetVictim(), SPELL_CRYSTALFIRE_BREATH, false); + events.ScheduleEvent(EVENT_CRYSTALFIRE_BREATH, 14000); + break; + case EVENT_TAIL_SWEEP: + me->CastSpell(me, SPELL_TAIL_SWEEP, false); + events.ScheduleEvent(EVENT_TAIL_SWEEP, 5000); + break; + case EVENT_CRYSTAL_CHAINS: + Talk(SAY_CRYSTAL_NOVA); + if (IsHeroic()) + me->CastSpell(me, SPELL_CRYSTALIZE, false); + else if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + me->CastSpell(target, SPELL_CRYSTAL_CHAINS, false); + events.ScheduleEvent(EVENT_CRYSTAL_CHAINS, DUNGEON_MODE(20000, 11000)); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class achievement_intense_cold : public AchievementCriteriaScript @@ -191,12 +191,12 @@ class achievement_intense_cold : public AchievementCriteriaScript if (!target) return false; - return target->GetAI()->GetData(player->GetGUIDLow()); + return target->GetAI()->GetData(player->GetGUIDLow()); } }; void AddSC_boss_keristrasza() { new boss_keristrasza(); - new achievement_intense_cold(); + new achievement_intense_cold(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp index 23399cca3..015240823 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp @@ -8,209 +8,209 @@ REWRITTEN BY XINEF enum Spells { - // Main - SPELL_ICE_NOVA = 47772, - SPELL_FIREBOMB = 47773, + // Main + SPELL_ICE_NOVA = 47772, + SPELL_FIREBOMB = 47773, - SPELL_GRAVITY_WELL = 47756, - SPELL_TELESTRA_BACK = 47714, - SPELL_BURNING_WINDS = 46308, - SPELL_START_SUMMON_CLONES = 47710, + SPELL_GRAVITY_WELL = 47756, + SPELL_TELESTRA_BACK = 47714, + SPELL_BURNING_WINDS = 46308, + SPELL_START_SUMMON_CLONES = 47710, - SPELL_FIRE_MAGUS_SUMMON = 47707, - SPELL_FROST_MAGUS_SUMMON = 47709, - SPELL_ARCANE_MAGUS_SUMMON = 47708, + SPELL_FIRE_MAGUS_SUMMON = 47707, + SPELL_FROST_MAGUS_SUMMON = 47709, + SPELL_ARCANE_MAGUS_SUMMON = 47708, - SPELL_FIRE_MAGUS_DEATH = 47711, - SPELL_ARCANE_MAGUS_DEATH = 47713, + SPELL_FIRE_MAGUS_DEATH = 47711, + SPELL_ARCANE_MAGUS_DEATH = 47713, SPELL_WEAR_CHRISTMAS_HAT = 61400 }; enum Yells { - SAY_AGGRO = 0, - SAY_KILL = 1, - SAY_DEATH = 2, - SAY_MERGE = 3, - SAY_SPLIT = 4 + SAY_AGGRO = 0, + SAY_KILL = 1, + SAY_DEATH = 2, + SAY_MERGE = 3, + SAY_SPLIT = 4 }; enum Misc { - NPC_FIRE_MAGUS = 26928, - NPC_FROST_MAGUS = 26930, - NPC_ARCANE_MAGUS = 26929, + NPC_FIRE_MAGUS = 26928, + NPC_FROST_MAGUS = 26930, + NPC_ARCANE_MAGUS = 26929, - ACHIEVEMENT_SPLIT_PERSONALITY = 2150, + ACHIEVEMENT_SPLIT_PERSONALITY = 2150, GAME_EVENT_WINTER_VEIL = 2, }; enum Events { - EVENT_MAGUS_ICE_NOVA = 1, - EVENT_MAGUS_FIREBOMB = 2, - EVENT_MAGUS_GRAVITY_WELL = 3, - EVENT_MAGUS_HEALTH1 = 4, - EVENT_MAGUS_HEALTH2 = 5, - EVENT_MAGUS_FAIL_ACHIEVEMENT = 6, - EVENT_MAGUS_MERGED = 7, - EVENT_MAGUS_RELOCATE = 8, - EVENT_KILL_TALK = 9 + EVENT_MAGUS_ICE_NOVA = 1, + EVENT_MAGUS_FIREBOMB = 2, + EVENT_MAGUS_GRAVITY_WELL = 3, + EVENT_MAGUS_HEALTH1 = 4, + EVENT_MAGUS_HEALTH2 = 5, + EVENT_MAGUS_FAIL_ACHIEVEMENT = 6, + EVENT_MAGUS_MERGED = 7, + EVENT_MAGUS_RELOCATE = 8, + EVENT_KILL_TALK = 9 }; class boss_magus_telestra : public CreatureScript { - public: - boss_magus_telestra() : CreatureScript("boss_magus_telestra") { } + public: + boss_magus_telestra() : CreatureScript("boss_magus_telestra") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_magus_telestraAI : public BossAI - { - boss_magus_telestraAI(Creature* creature) : BossAI(creature, DATA_MAGUS_TELESTRA_EVENT) - { - } + struct boss_magus_telestraAI : public BossAI + { + boss_magus_telestraAI(Creature* creature) : BossAI(creature, DATA_MAGUS_TELESTRA_EVENT) + { + } - uint8 copiesDied; - bool achievement; + uint8 copiesDied; + bool achievement; - void Reset() - { - BossAI::Reset(); - copiesDied = 0; - achievement = true; + void Reset() + { + BossAI::Reset(); + copiesDied = 0; + achievement = true; - if (IsHeroic() && sGameEventMgr->IsActiveEvent(GAME_EVENT_WINTER_VEIL) && !me->HasAura(SPELL_WEAR_CHRISTMAS_HAT)) - me->AddAura(SPELL_WEAR_CHRISTMAS_HAT, me); - } + if (IsHeroic() && sGameEventMgr->IsActiveEvent(GAME_EVENT_WINTER_VEIL) && !me->HasAura(SPELL_WEAR_CHRISTMAS_HAT)) + me->AddAura(SPELL_WEAR_CHRISTMAS_HAT, me); + } - uint32 GetData(uint32 data) const - { - if (data == me->GetEntry()) - return achievement; - return 0; - } + uint32 GetData(uint32 data) const + { + if (data == me->GetEntry()) + return achievement; + return 0; + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_MAGUS_ICE_NOVA, 10000); - events.ScheduleEvent(EVENT_MAGUS_FIREBOMB, 0); - events.ScheduleEvent(EVENT_MAGUS_GRAVITY_WELL, 20000); - events.ScheduleEvent(EVENT_MAGUS_HEALTH1, 1000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_MAGUS_HEALTH2, 1000); - } + events.ScheduleEvent(EVENT_MAGUS_ICE_NOVA, 10000); + events.ScheduleEvent(EVENT_MAGUS_FIREBOMB, 0); + events.ScheduleEvent(EVENT_MAGUS_GRAVITY_WELL, 20000); + events.ScheduleEvent(EVENT_MAGUS_HEALTH1, 1000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_MAGUS_HEALTH2, 1000); + } - void AttackStart(Unit* who) - { - if (who && me->Attack(who, true)) - me->GetMotionMaster()->MoveChase(who, 20.0f); - } + void AttackStart(Unit* who) + { + if (who && me->Attack(who, true)) + me->GetMotionMaster()->MoveChase(who, 20.0f); + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - Talk(SAY_DEATH); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + Talk(SAY_DEATH); + } - void KilledUnit(Unit*) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit*) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->SetInCombatWithZone(); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->SetInCombatWithZone(); + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id >= SPELL_FIRE_MAGUS_DEATH && spellInfo->Id <= SPELL_ARCANE_MAGUS_DEATH && caster->ToCreature()) - { - events.ScheduleEvent(EVENT_MAGUS_FAIL_ACHIEVEMENT, 5000); - caster->ToCreature()->DespawnOrUnsummon(1000); + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id >= SPELL_FIRE_MAGUS_DEATH && spellInfo->Id <= SPELL_ARCANE_MAGUS_DEATH && caster->ToCreature()) + { + events.ScheduleEvent(EVENT_MAGUS_FAIL_ACHIEVEMENT, 5000); + caster->ToCreature()->DespawnOrUnsummon(1000); - if (++copiesDied >= 3) - { - copiesDied = 0; - Talk(SAY_MERGE); - events.CancelEvent(EVENT_MAGUS_FAIL_ACHIEVEMENT); - events.ScheduleEvent(EVENT_MAGUS_MERGED, 5000); - me->CastSpell(me, SPELL_BURNING_WINDS, true); - } - } - } + if (++copiesDied >= 3) + { + copiesDied = 0; + Talk(SAY_MERGE); + events.CancelEvent(EVENT_MAGUS_FAIL_ACHIEVEMENT); + events.ScheduleEvent(EVENT_MAGUS_MERGED, 5000); + me->CastSpell(me, SPELL_BURNING_WINDS, true); + } + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_MAGUS_HEALTH1: - if (me->HealthBelowPct(51)) - { - me->CastSpell(me, SPELL_START_SUMMON_CLONES, false); - events.ScheduleEvent(EVENT_MAGUS_RELOCATE, 3500); - break; - } - events.ScheduleEvent(EVENT_MAGUS_HEALTH1, 1000); - break; - case EVENT_MAGUS_HEALTH2: - if (me->HealthBelowPct(11)) - { - me->CastSpell(me, SPELL_START_SUMMON_CLONES, false); - events.ScheduleEvent(EVENT_MAGUS_RELOCATE, 3500); - break; - } - events.ScheduleEvent(EVENT_MAGUS_HEALTH2, 1000); - break; - case EVENT_MAGUS_FIREBOMB: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_FIREBOMB, false); - events.ScheduleEvent(EVENT_MAGUS_FIREBOMB, 3000); - break; - case EVENT_MAGUS_ICE_NOVA: - me->CastSpell(me, SPELL_ICE_NOVA, false); - events.ScheduleEvent(EVENT_MAGUS_ICE_NOVA, 15000); - break; - case EVENT_MAGUS_GRAVITY_WELL: - me->CastSpell(me, SPELL_GRAVITY_WELL, false); - events.ScheduleEvent(EVENT_MAGUS_GRAVITY_WELL, 15000); - break; - case EVENT_MAGUS_FAIL_ACHIEVEMENT: - achievement = false; - break; - case EVENT_MAGUS_RELOCATE: - me->NearTeleportTo(505.04f, 88.915f, -16.13f, 2.98f); - break; - case EVENT_MAGUS_MERGED: - me->CastSpell(me, SPELL_TELESTRA_BACK, true); - me->RemoveAllAuras(); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_MAGUS_HEALTH1: + if (me->HealthBelowPct(51)) + { + me->CastSpell(me, SPELL_START_SUMMON_CLONES, false); + events.ScheduleEvent(EVENT_MAGUS_RELOCATE, 3500); + break; + } + events.ScheduleEvent(EVENT_MAGUS_HEALTH1, 1000); + break; + case EVENT_MAGUS_HEALTH2: + if (me->HealthBelowPct(11)) + { + me->CastSpell(me, SPELL_START_SUMMON_CLONES, false); + events.ScheduleEvent(EVENT_MAGUS_RELOCATE, 3500); + break; + } + events.ScheduleEvent(EVENT_MAGUS_HEALTH2, 1000); + break; + case EVENT_MAGUS_FIREBOMB: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_FIREBOMB, false); + events.ScheduleEvent(EVENT_MAGUS_FIREBOMB, 3000); + break; + case EVENT_MAGUS_ICE_NOVA: + me->CastSpell(me, SPELL_ICE_NOVA, false); + events.ScheduleEvent(EVENT_MAGUS_ICE_NOVA, 15000); + break; + case EVENT_MAGUS_GRAVITY_WELL: + me->CastSpell(me, SPELL_GRAVITY_WELL, false); + events.ScheduleEvent(EVENT_MAGUS_GRAVITY_WELL, 15000); + break; + case EVENT_MAGUS_FAIL_ACHIEVEMENT: + achievement = false; + break; + case EVENT_MAGUS_RELOCATE: + me->NearTeleportTo(505.04f, 88.915f, -16.13f, 2.98f); + break; + case EVENT_MAGUS_MERGED: + me->CastSpell(me, SPELL_TELESTRA_BACK, true); + me->RemoveAllAuras(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_boss_magus_telestra_summon_telestra_clones : public SpellScriptLoader @@ -222,29 +222,29 @@ class spell_boss_magus_telestra_summon_telestra_clones : public SpellScriptLoade { PrepareAuraScript(spell_boss_magus_telestra_summon_telestra_clones_AuraScript); - bool Load() - { - return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; + } void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->ToCreature()->AI()->Talk(SAY_SPLIT); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FIRE_MAGUS_SUMMON, true); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FROST_MAGUS_SUMMON, true); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_ARCANE_MAGUS_SUMMON, true); + GetUnitOwner()->ToCreature()->AI()->Talk(SAY_SPLIT); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FIRE_MAGUS_SUMMON, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FROST_MAGUS_SUMMON, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_ARCANE_MAGUS_SUMMON, true); - GetUnitOwner()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - GetUnitOwner()->SetControlled(true, UNIT_STATE_STUNNED); - GetUnitOwner()->ToCreature()->LoadEquipment(0, true); + GetUnitOwner()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + GetUnitOwner()->SetControlled(true, UNIT_STATE_STUNNED); + GetUnitOwner()->ToCreature()->LoadEquipment(0, true); } void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - GetUnitOwner()->SetControlled(false, UNIT_STATE_STUNNED); - GetUnitOwner()->ToCreature()->LoadEquipment(1, true); + GetUnitOwner()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + GetUnitOwner()->SetControlled(false, UNIT_STATE_STUNNED); + GetUnitOwner()->ToCreature()->LoadEquipment(1, true); } void Register() @@ -271,37 +271,37 @@ class spell_boss_magus_telestra_gravity_well : public SpellScriptLoader void SelectTarget(std::list& targets) { - targets.remove_if(Trinity::RandomCheck(50)); + targets.remove_if(Trinity::RandomCheck(50)); } void HandlePull(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - Unit* target = GetHitUnit(); - if (!target) - return; + PreventHitDefaultEffect(effIndex); + Unit* target = GetHitUnit(); + if (!target) + return; - Position pos; - if (target->GetDistance(GetCaster()) < 5.0f) - { - pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ()+1.0f); - float o = frand(0, 2*M_PI); - target->MovePositionToFirstCollision(pos, 20.0f, frand(0, 2*M_PI)); - pos.m_positionZ += frand(5.0f, 15.0f); - } - else - pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ()+1.0f); + Position pos; + if (target->GetDistance(GetCaster()) < 5.0f) + { + pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ()+1.0f); + float o = frand(0, 2*M_PI); + target->MovePositionToFirstCollision(pos, 20.0f, frand(0, 2*M_PI)); + pos.m_positionZ += frand(5.0f, 15.0f); + } + else + pos.Relocate(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ()+1.0f); - float speedXY = float(GetSpellInfo()->Effects[effIndex].MiscValue) * 0.1f; - float speedZ = target->GetDistance(pos) / speedXY * 0.5f * Movement::gravity; + float speedXY = float(GetSpellInfo()->Effects[effIndex].MiscValue) * 0.1f; + float speedZ = target->GetDistance(pos) / speedXY * 0.5f * Movement::gravity; - target->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ); + target->GetMotionMaster()->MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ); } void Register() { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_boss_magus_telestra_gravity_well_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_boss_magus_telestra_gravity_well_SpellScript::HandlePull, EFFECT_0, SPELL_EFFECT_PULL_TOWARDS_DEST); + OnEffectHitTarget += SpellEffectFn(spell_boss_magus_telestra_gravity_well_SpellScript::HandlePull, EFFECT_0, SPELL_EFFECT_PULL_TOWARDS_DEST); } }; @@ -323,14 +323,14 @@ class achievement_split_personality : public AchievementCriteriaScript if (!target) return false; - return target->GetAI()->GetData(target->GetEntry()); + return target->GetAI()->GetData(target->GetEntry()); } }; void AddSC_boss_magus_telestra() { new boss_magus_telestra(); - new spell_boss_magus_telestra_summon_telestra_clones(); - new spell_boss_magus_telestra_gravity_well(); - new achievement_split_personality(); + new spell_boss_magus_telestra_summon_telestra_clones(); + new spell_boss_magus_telestra_gravity_well(); + new achievement_split_personality(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp index 5bc5b8fd3..b9c2ff4b3 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp @@ -9,14 +9,14 @@ REWRITTEN BY XINEF enum eEnums { - SPELL_CRYSTAL_SPIKES = 47958, - SPELL_CRYSTAL_SPIKE_DAMAGE = 47944, - SPELL_CRYSTAL_SPIKE_PREVISUAL = 50442, - SPELL_SPELL_REFLECTION = 47981, - SPELL_TRAMPLE = 48016, - SPELL_FRENZY = 48017, - SPELL_SUMMON_CRYSTALLINE_TANGLER = 61564, - SPELL_CRYSTAL_CHAINS = 47698, + SPELL_CRYSTAL_SPIKES = 47958, + SPELL_CRYSTAL_SPIKE_DAMAGE = 47944, + SPELL_CRYSTAL_SPIKE_PREVISUAL = 50442, + SPELL_SPELL_REFLECTION = 47981, + SPELL_TRAMPLE = 48016, + SPELL_FRENZY = 48017, + SPELL_SUMMON_CRYSTALLINE_TANGLER = 61564, + SPELL_CRYSTAL_CHAINS = 47698, }; enum Yells @@ -26,191 +26,191 @@ enum Yells SAY_REFLECT = 3, SAY_CRYSTAL_SPIKES = 4, SAY_KILL = 5, - EMOTE_FRENZY = 6 + EMOTE_FRENZY = 6 }; enum Events { - EVENT_ORMOROK_CRYSTAL_SPIKES = 1, - EVENT_ORMOROK_TRAMPLE = 2, - EVENT_ORMOROK_SPELL_REFLECTION = 3, - EVENT_ORMOROK_SUMMON = 4, - EVENT_ORMOROK_HEALTH = 5, - EVENT_ORMOROK_SUMMON_SPIKES = 6, - EVENT_KILL_TALK = 7 + EVENT_ORMOROK_CRYSTAL_SPIKES = 1, + EVENT_ORMOROK_TRAMPLE = 2, + EVENT_ORMOROK_SPELL_REFLECTION = 3, + EVENT_ORMOROK_SUMMON = 4, + EVENT_ORMOROK_HEALTH = 5, + EVENT_ORMOROK_SUMMON_SPIKES = 6, + EVENT_KILL_TALK = 7 }; enum Misc { - NPC_CRYSTAL_SPIKE = 27099, - NPC_CRYSTALLINE_TANGLER = 32665, - GO_CRYSTAL_SPIKE = 188537 + NPC_CRYSTAL_SPIKE = 27099, + NPC_CRYSTALLINE_TANGLER = 32665, + GO_CRYSTAL_SPIKE = 188537 }; class boss_ormorok : public CreatureScript { - public: - boss_ormorok() : CreatureScript("boss_ormorok") { } + public: + boss_ormorok() : CreatureScript("boss_ormorok") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_ormorokAI : public BossAI - { - boss_ormorokAI(Creature* creature) : BossAI(creature, DATA_ORMOROK_EVENT) - { - } + struct boss_ormorokAI : public BossAI + { + boss_ormorokAI(Creature* creature) : BossAI(creature, DATA_ORMOROK_EVENT) + { + } - uint8 _spikesCount; + uint8 _spikesCount; - void Reset() - { - _spikesCount = 0; - BossAI::Reset(); - } + void Reset() + { + _spikesCount = 0; + BossAI::Reset(); + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - BossAI::EnterCombat(who); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_ORMOROK_CRYSTAL_SPIKES, 12000); - events.ScheduleEvent(EVENT_ORMOROK_TRAMPLE, 10000); - events.ScheduleEvent(EVENT_ORMOROK_SPELL_REFLECTION, 30000); - events.ScheduleEvent(EVENT_ORMOROK_HEALTH, 1000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_ORMOROK_SUMMON, 17000); - } + events.ScheduleEvent(EVENT_ORMOROK_CRYSTAL_SPIKES, 12000); + events.ScheduleEvent(EVENT_ORMOROK_TRAMPLE, 10000); + events.ScheduleEvent(EVENT_ORMOROK_SPELL_REFLECTION, 30000); + events.ScheduleEvent(EVENT_ORMOROK_HEALTH, 1000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_ORMOROK_SUMMON, 17000); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + } - void KilledUnit(Unit *victim) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit *victim) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ORMOROK_HEALTH: - if (me->HealthBelowPct(26)) - { - me->CastSpell(me, SPELL_FRENZY, true); - Talk(EMOTE_FRENZY); - break; - } - events.ScheduleEvent(EVENT_ORMOROK_HEALTH, 1000); - break; - case EVENT_ORMOROK_TRAMPLE: - me->CastSpell(me, SPELL_TRAMPLE, false); - events.ScheduleEvent(EVENT_ORMOROK_TRAMPLE, 10000); - break; - case EVENT_ORMOROK_SPELL_REFLECTION: - Talk(SAY_REFLECT); - me->CastSpell(me, SPELL_SPELL_REFLECTION, false); - events.ScheduleEvent(EVENT_ORMOROK_SPELL_REFLECTION, 30000); - break; - case EVENT_ORMOROK_SUMMON: - if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 50.0f, true)) - me->CastSpell(target, SPELL_SUMMON_CRYSTALLINE_TANGLER, true); - events.ScheduleEvent(EVENT_ORMOROK_SUMMON, 17000); - break; - case EVENT_ORMOROK_CRYSTAL_SPIKES: - Talk(SAY_CRYSTAL_SPIKES); - me->CastSpell(me, SPELL_CRYSTAL_SPIKES, false); - _spikesCount = 0; - events.ScheduleEvent(EVENT_ORMOROK_SUMMON_SPIKES, 300); - events.ScheduleEvent(EVENT_ORMOROK_CRYSTAL_SPIKES, 20000); - break; - case EVENT_ORMOROK_SUMMON_SPIKES: - if (++_spikesCount > 9) - break; - for (uint8 i = 0; i < 4; ++i) - { - float o = rand_norm()*2.0f*M_PI; - float x = me->GetPositionX()+5.0f*_spikesCount*cos(o); - float y = me->GetPositionY()+5.0f*_spikesCount*sin(o); - me->SummonCreature(NPC_CRYSTAL_SPIKE, x, y, me->GetMap()->GetHeight(x, y, me->GetPositionZ()+5.0f), 0, TEMPSUMMON_TIMED_DESPAWN, 7000); - } - events.ScheduleEvent(EVENT_ORMOROK_SUMMON_SPIKES, 200); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_ORMOROK_HEALTH: + if (me->HealthBelowPct(26)) + { + me->CastSpell(me, SPELL_FRENZY, true); + Talk(EMOTE_FRENZY); + break; + } + events.ScheduleEvent(EVENT_ORMOROK_HEALTH, 1000); + break; + case EVENT_ORMOROK_TRAMPLE: + me->CastSpell(me, SPELL_TRAMPLE, false); + events.ScheduleEvent(EVENT_ORMOROK_TRAMPLE, 10000); + break; + case EVENT_ORMOROK_SPELL_REFLECTION: + Talk(SAY_REFLECT); + me->CastSpell(me, SPELL_SPELL_REFLECTION, false); + events.ScheduleEvent(EVENT_ORMOROK_SPELL_REFLECTION, 30000); + break; + case EVENT_ORMOROK_SUMMON: + if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 50.0f, true)) + me->CastSpell(target, SPELL_SUMMON_CRYSTALLINE_TANGLER, true); + events.ScheduleEvent(EVENT_ORMOROK_SUMMON, 17000); + break; + case EVENT_ORMOROK_CRYSTAL_SPIKES: + Talk(SAY_CRYSTAL_SPIKES); + me->CastSpell(me, SPELL_CRYSTAL_SPIKES, false); + _spikesCount = 0; + events.ScheduleEvent(EVENT_ORMOROK_SUMMON_SPIKES, 300); + events.ScheduleEvent(EVENT_ORMOROK_CRYSTAL_SPIKES, 20000); + break; + case EVENT_ORMOROK_SUMMON_SPIKES: + if (++_spikesCount > 9) + break; + for (uint8 i = 0; i < 4; ++i) + { + float o = rand_norm()*2.0f*M_PI; + float x = me->GetPositionX()+5.0f*_spikesCount*cos(o); + float y = me->GetPositionY()+5.0f*_spikesCount*sin(o); + me->SummonCreature(NPC_CRYSTAL_SPIKE, x, y, me->GetMap()->GetHeight(x, y, me->GetPositionZ()+5.0f), 0, TEMPSUMMON_TIMED_DESPAWN, 7000); + } + events.ScheduleEvent(EVENT_ORMOROK_SUMMON_SPIKES, 200); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_crystal_spike : public CreatureScript { - public: - npc_crystal_spike() : CreatureScript("npc_crystal_spike") { } + public: + npc_crystal_spike() : CreatureScript("npc_crystal_spike") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return GetInstanceAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return GetInstanceAI(pCreature); + } - struct npc_crystal_spikeAI : public NullCreatureAI - { - npc_crystal_spikeAI(Creature *c) : NullCreatureAI(c) - { - } + struct npc_crystal_spikeAI : public NullCreatureAI + { + npc_crystal_spikeAI(Creature *c) : NullCreatureAI(c) + { + } - int32 _damageTimer; - uint64 _gameObjectGUID; + int32 _damageTimer; + uint64 _gameObjectGUID; - void Reset() - { - if (GameObject* gameobject = me->SummonGameObject(GO_CRYSTAL_SPIKE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3500)) - _gameObjectGUID = gameobject->GetGUID(); + void Reset() + { + if (GameObject* gameobject = me->SummonGameObject(GO_CRYSTAL_SPIKE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3500)) + _gameObjectGUID = gameobject->GetGUID(); - _damageTimer = 1; - } + _damageTimer = 1; + } - void UpdateAI(uint32 diff) - { - if (_damageTimer) - { - _damageTimer += diff; - if (_damageTimer >= 2000) - { - if (GameObject* gameobject = ObjectAccessor::GetGameObject(*me, _gameObjectGUID)) - gameobject->SetGoState(GO_STATE_ACTIVE); + void UpdateAI(uint32 diff) + { + if (_damageTimer) + { + _damageTimer += diff; + if (_damageTimer >= 2000) + { + if (GameObject* gameobject = ObjectAccessor::GetGameObject(*me, _gameObjectGUID)) + gameobject->SetGoState(GO_STATE_ACTIVE); - me->CastSpell(me, SPELL_CRYSTAL_SPIKE_DAMAGE, false); - _damageTimer = 0; - } - } - } - }; + me->CastSpell(me, SPELL_CRYSTAL_SPIKE_DAMAGE, false); + _damageTimer = 0; + } + } + } + }; }; void AddSC_boss_ormorok() { new boss_ormorok(); - new npc_crystal_spike(); + new npc_crystal_spike(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp index 081a1407d..532d078c5 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp @@ -8,277 +8,277 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! DoorData const doorData[] = { - { GO_TELESTRA_SPHERE, DATA_TELESTRA_ORB, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { GO_ANOMALUS_SPHERE, DATA_ANOMALUS_ORB, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { GO_ORMOROK_SPHERE, DATA_ORMOROK_ORB, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } + { GO_TELESTRA_SPHERE, DATA_TELESTRA_ORB, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_ANOMALUS_SPHERE, DATA_ANOMALUS_ORB, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_ORMOROK_SPHERE, DATA_ORMOROK_ORB, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } }; class instance_nexus : public InstanceMapScript { - public: - instance_nexus() : InstanceMapScript("instance_nexus", 576) { } + public: + instance_nexus() : InstanceMapScript("instance_nexus", 576) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_nexus_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_nexus_InstanceMapScript(map); + } - struct instance_nexus_InstanceMapScript : public InstanceScript - { - instance_nexus_InstanceMapScript(Map* map) : InstanceScript(map) {} + struct instance_nexus_InstanceMapScript : public InstanceScript + { + instance_nexus_InstanceMapScript(Map* map) : InstanceScript(map) {} - void Initialize() - { - SetBossNumber(MAX_ENCOUNTERS); - LoadDoorData(doorData); - } + void Initialize() + { + SetBossNumber(MAX_ENCOUNTERS); + LoadDoorData(doorData); + } - void OnCreatureCreate(Creature* creature) - { - Map::PlayerList const& players = instance->GetPlayers(); - TeamId TeamIdInInstance = TEAM_NEUTRAL; - if (!players.isEmpty()) - if (Player* pPlayer = players.begin()->GetSource()) - TeamIdInInstance = pPlayer->GetTeamId(); + void OnCreatureCreate(Creature* creature) + { + Map::PlayerList const& players = instance->GetPlayers(); + TeamId TeamIdInInstance = TEAM_NEUTRAL; + if (!players.isEmpty()) + if (Player* pPlayer = players.begin()->GetSource()) + TeamIdInInstance = pPlayer->GetTeamId(); - switch (creature->GetEntry()) - { - case NPC_ALLIANCE_RANGER: - creature->setFaction(16); - if (TeamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_HORDE_RANGER); - break; - case NPC_ALLIANCE_BERSERKER: - creature->setFaction(16); - if (TeamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_HORDE_BERSERKER); - break; - case NPC_ALLIANCE_COMMANDER: - creature->setFaction(16); - if (TeamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_HORDE_COMMANDER); - break; - case NPC_ALLIANCE_CLERIC: - creature->setFaction(16); - if (TeamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_HORDE_CLERIC); - break; - case NPC_COMMANDER_STOUTBEARD: - creature->setFaction(16); - if (TeamIdInInstance == TEAM_ALLIANCE) - creature->UpdateEntry(NPC_COMMANDER_KOLURG); - break; - } - } + switch (creature->GetEntry()) + { + case NPC_ALLIANCE_RANGER: + creature->setFaction(16); + if (TeamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_HORDE_RANGER); + break; + case NPC_ALLIANCE_BERSERKER: + creature->setFaction(16); + if (TeamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_HORDE_BERSERKER); + break; + case NPC_ALLIANCE_COMMANDER: + creature->setFaction(16); + if (TeamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_HORDE_COMMANDER); + break; + case NPC_ALLIANCE_CLERIC: + creature->setFaction(16); + if (TeamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_HORDE_CLERIC); + break; + case NPC_COMMANDER_STOUTBEARD: + creature->setFaction(16); + if (TeamIdInInstance == TEAM_ALLIANCE) + creature->UpdateEntry(NPC_COMMANDER_KOLURG); + break; + } + } - void OnGameObjectCreate(GameObject* gameObject) - { - switch (gameObject->GetEntry()) - { - case GO_TELESTRA_SPHERE: - if (GetBossState(DATA_TELESTRA_ORB) != DONE && GetBossState(DATA_MAGUS_TELESTRA_EVENT) == DONE) - gameObject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - AddDoor(gameObject, true); - break; - case GO_ANOMALUS_SPHERE: - if (GetBossState(DATA_ANOMALUS_ORB) != DONE && GetBossState(DATA_ANOMALUS_EVENT) == DONE) - gameObject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - AddDoor(gameObject, true); - break; - case GO_ORMOROK_SPHERE: - if (GetBossState(DATA_ORMOROK_ORB) != DONE && GetBossState(DATA_ORMOROK_EVENT) == DONE) - gameObject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - AddDoor(gameObject, true); - break; - } - } + void OnGameObjectCreate(GameObject* gameObject) + { + switch (gameObject->GetEntry()) + { + case GO_TELESTRA_SPHERE: + if (GetBossState(DATA_TELESTRA_ORB) != DONE && GetBossState(DATA_MAGUS_TELESTRA_EVENT) == DONE) + gameObject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + AddDoor(gameObject, true); + break; + case GO_ANOMALUS_SPHERE: + if (GetBossState(DATA_ANOMALUS_ORB) != DONE && GetBossState(DATA_ANOMALUS_EVENT) == DONE) + gameObject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + AddDoor(gameObject, true); + break; + case GO_ORMOROK_SPHERE: + if (GetBossState(DATA_ORMOROK_ORB) != DONE && GetBossState(DATA_ORMOROK_EVENT) == DONE) + gameObject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + AddDoor(gameObject, true); + break; + } + } - void OnGameObjectRemove(GameObject* gameObject) - { - switch (gameObject->GetEntry()) - { - case GO_TELESTRA_SPHERE: - case GO_ANOMALUS_SPHERE: - case GO_ORMOROK_SPHERE: - AddDoor(gameObject, false); - break; - } - } + void OnGameObjectRemove(GameObject* gameObject) + { + switch (gameObject->GetEntry()) + { + case GO_TELESTRA_SPHERE: + case GO_ANOMALUS_SPHERE: + case GO_ORMOROK_SPHERE: + AddDoor(gameObject, false); + break; + } + } - void SetData(uint32 type, uint32) - { - switch (type) - { - case GO_TELESTRA_SPHERE: - SetBossState(DATA_TELESTRA_ORB, NOT_STARTED); - SetBossState(DATA_TELESTRA_ORB, DONE); - break; - case GO_ANOMALUS_SPHERE: - SetBossState(DATA_ANOMALUS_ORB, NOT_STARTED); - SetBossState(DATA_ANOMALUS_ORB, DONE); - break; - case GO_ORMOROK_SPHERE: - SetBossState(DATA_ORMOROK_ORB, NOT_STARTED); - SetBossState(DATA_ORMOROK_ORB, DONE); - break; - } - } + void SetData(uint32 type, uint32) + { + switch (type) + { + case GO_TELESTRA_SPHERE: + SetBossState(DATA_TELESTRA_ORB, NOT_STARTED); + SetBossState(DATA_TELESTRA_ORB, DONE); + break; + case GO_ANOMALUS_SPHERE: + SetBossState(DATA_ANOMALUS_ORB, NOT_STARTED); + SetBossState(DATA_ANOMALUS_ORB, DONE); + break; + case GO_ORMOROK_SPHERE: + SetBossState(DATA_ORMOROK_ORB, NOT_STARTED); + SetBossState(DATA_ORMOROK_ORB, DONE); + break; + } + } - bool SetBossState(uint32 id, EncounterState state) - { - if (!InstanceScript::SetBossState(id, state)) - return false; + bool SetBossState(uint32 id, EncounterState state) + { + if (!InstanceScript::SetBossState(id, state)) + return false; - if (state != DONE || id > DATA_ORMOROK_EVENT) - return true; + if (state != DONE || id > DATA_ORMOROK_EVENT) + return true; - BossInfo const* bossInfo = GetBossInfo(id + DATA_TELESTRA_ORB); - for (DoorSet::const_iterator i = bossInfo->door[DOOR_TYPE_PASSAGE].begin(); i != bossInfo->door[DOOR_TYPE_PASSAGE].end(); ++i) - (*i)->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - return true; - } + BossInfo const* bossInfo = GetBossInfo(id + DATA_TELESTRA_ORB); + for (DoorSet::const_iterator i = bossInfo->door[DOOR_TYPE_PASSAGE].begin(); i != bossInfo->door[DOOR_TYPE_PASSAGE].end(); ++i) + (*i)->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + return true; + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "N E X " << GetBossSaveData(); - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "N E X " << GetBossSaveData(); + return saveStream.str(); + } - void Load(const char* in) - { - if( !in ) - return; + void Load(const char* in) + { + if( !in ) + return; - char dataHead1, dataHead2, dataHead3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> dataHead3; - if (dataHead1 == 'N' && dataHead2 == 'E' && dataHead3 == 'X') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); - } - } - } - }; + char dataHead1, dataHead2, dataHead3; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> dataHead3; + if (dataHead1 == 'N' && dataHead2 == 'E' && dataHead3 == 'X') + { + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } + } + } + }; }; enum eFrayer { - SPELL_SUMMON_SEED_POD = 52796, - SPELL_SEED_POD = 48082, - SPELL_AURA_OF_REGENERATION = 52067, - SPELL_CRYSTAL_BLOOM = 48058, - SPELL_ENSNARE = 48053 + SPELL_SUMMON_SEED_POD = 52796, + SPELL_SEED_POD = 48082, + SPELL_AURA_OF_REGENERATION = 52067, + SPELL_CRYSTAL_BLOOM = 48058, + SPELL_ENSNARE = 48053 }; class npc_crystalline_frayer : public CreatureScript { - public: - npc_crystalline_frayer() : CreatureScript("npc_crystalline_frayer") { } + public: + npc_crystalline_frayer() : CreatureScript("npc_crystalline_frayer") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct npc_crystalline_frayerAI : public ScriptedAI - { - npc_crystalline_frayerAI(Creature* creature) : ScriptedAI(creature) - { - } + struct npc_crystalline_frayerAI : public ScriptedAI + { + npc_crystalline_frayerAI(Creature* creature) : ScriptedAI(creature) + { + } - bool _allowDeath; - uint32 restoreTimer; - uint32 abilityTimer1; - uint32 abilityTimer2; + bool _allowDeath; + uint32 restoreTimer; + uint32 abilityTimer1; + uint32 abilityTimer2; - void Reset() - { - restoreTimer = 0; - abilityTimer1 = 0; - abilityTimer2 = 30000; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + void Reset() + { + restoreTimer = 0; + abilityTimer1 = 0; + abilityTimer2 = 30000; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - void EnterCombat(Unit*) - { - _allowDeath = me->GetInstanceScript()->GetBossState(DATA_ORMOROK_EVENT) == DONE; - } + void EnterCombat(Unit*) + { + _allowDeath = me->GetInstanceScript()->GetBossState(DATA_ORMOROK_EVENT) == DONE; + } - void EnterEvadeMode() - { - if (me->isRegeneratingHealth()) - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + if (me->isRegeneratingHealth()) + ScriptedAI::EnterEvadeMode(); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - { - if (!_allowDeath) - { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - damage = 0; + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + { + if (!_allowDeath) + { + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + damage = 0; - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetRegeneratingHealth(false); - me->CastSpell(me, SPELL_SUMMON_SEED_POD, true); - me->CastSpell(me, SPELL_SEED_POD, true); - me->CastSpell(me, SPELL_AURA_OF_REGENERATION, false); - restoreTimer = 1; - } - } - } + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetRegeneratingHealth(false); + me->CastSpell(me, SPELL_SUMMON_SEED_POD, true); + me->CastSpell(me, SPELL_SEED_POD, true); + me->CastSpell(me, SPELL_AURA_OF_REGENERATION, false); + restoreTimer = 1; + } + } + } - void UpdateAI(uint32 diff) - { - if (restoreTimer) - { - restoreTimer += diff; - if (restoreTimer >= 90*IN_MILLISECONDS) - { - Talk(0); - me->SetRegeneratingHealth(true); - restoreTimer = 0; - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - return; - } + void UpdateAI(uint32 diff) + { + if (restoreTimer) + { + restoreTimer += diff; + if (restoreTimer >= 90*IN_MILLISECONDS) + { + Talk(0); + me->SetRegeneratingHealth(true); + restoreTimer = 0; + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + return; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - abilityTimer1 += diff; - abilityTimer2 += diff; - - if (abilityTimer1 >= 5000) - { - me->CastSpell(me->GetVictim(), SPELL_ENSNARE, false); - abilityTimer1 = 0; - } + abilityTimer1 += diff; + abilityTimer2 += diff; + + if (abilityTimer1 >= 5000) + { + me->CastSpell(me->GetVictim(), SPELL_ENSNARE, false); + abilityTimer1 = 0; + } - if (abilityTimer2 >= 30000) - { - me->CastSpell(me->GetVictim(), SPELL_CRYSTAL_BLOOM, false); - abilityTimer2 = 0; - } - } - }; + if (abilityTimer2 >= 30000) + { + me->CastSpell(me->GetVictim(), SPELL_CRYSTAL_BLOOM, false); + abilityTimer2 = 0; + } + } + }; }; void AddSC_instance_nexus() { new instance_nexus(); - new npc_crystalline_frayer(); + new npc_crystalline_frayer(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/nexus.h b/src/server/scripts/Northrend/Nexus/Nexus/nexus.h index abfb4576a..8d275edbc 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/nexus.h +++ b/src/server/scripts/Northrend/Nexus/Nexus/nexus.h @@ -7,34 +7,34 @@ REWRITTEN BY XINEF enum eTypes { - DATA_MAGUS_TELESTRA_EVENT = 0, - DATA_ANOMALUS_EVENT = 1, - DATA_ORMOROK_EVENT = 2, - DATA_KERISTRASZA_EVENT = 3, - DATA_COMMANDER_EVENT = 4, - DATA_TELESTRA_ORB = 5, - DATA_ANOMALUS_ORB = 6, - DATA_ORMOROK_ORB = 7, - MAX_ENCOUNTERS = 8 + DATA_MAGUS_TELESTRA_EVENT = 0, + DATA_ANOMALUS_EVENT = 1, + DATA_ORMOROK_EVENT = 2, + DATA_KERISTRASZA_EVENT = 3, + DATA_COMMANDER_EVENT = 4, + DATA_TELESTRA_ORB = 5, + DATA_ANOMALUS_ORB = 6, + DATA_ORMOROK_ORB = 7, + MAX_ENCOUNTERS = 8 }; enum Npcs { - NPC_ALLIANCE_RANGER = 26802, - NPC_ALLIANCE_BERSERKER = 26800, - NPC_ALLIANCE_COMMANDER = 27949, - NPC_ALLIANCE_CLERIC = 26805, - NPC_HORDE_RANGER = 26801, - NPC_HORDE_BERSERKER = 26799, - NPC_HORDE_COMMANDER = 27947, - NPC_HORDE_CLERIC = 26803, + NPC_ALLIANCE_RANGER = 26802, + NPC_ALLIANCE_BERSERKER = 26800, + NPC_ALLIANCE_COMMANDER = 27949, + NPC_ALLIANCE_CLERIC = 26805, + NPC_HORDE_RANGER = 26801, + NPC_HORDE_BERSERKER = 26799, + NPC_HORDE_COMMANDER = 27947, + NPC_HORDE_CLERIC = 26803, - NPC_COMMANDER_STOUTBEARD = 26796, - NPC_COMMANDER_KOLURG = 26798, + NPC_COMMANDER_STOUTBEARD = 26796, + NPC_COMMANDER_KOLURG = 26798, - GO_TELESTRA_SPHERE = 188526, - GO_ANOMALUS_SPHERE = 188527, - GO_ORMOROK_SPHERE = 188528 + GO_TELESTRA_SPHERE = 188526, + GO_ANOMALUS_SPHERE = 188527, + GO_ORMOROK_SPHERE = 188528 }; #endif diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index 49eead6a8..49c5be90f 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -8,30 +8,30 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Spells { - SPELL_MAGIC_PULL = 51336, - SPELL_THUNDERING_STOMP_N = 50774, - SPELL_THUNDERING_STOMP_H = 59370, + SPELL_MAGIC_PULL = 51336, + SPELL_THUNDERING_STOMP_N = 50774, + SPELL_THUNDERING_STOMP_H = 59370, - SPELL_UNSTABLE_SPHERE_PASSIVE = 50756, - SPELL_UNSTABLE_SPHERE_PULSE = 50757, - SPELL_UNSTABLE_SPHERE_TIMER = 50758, - SPELL_TELEPORT_VISUAL = 52096, + SPELL_UNSTABLE_SPHERE_PASSIVE = 50756, + SPELL_UNSTABLE_SPHERE_PULSE = 50757, + SPELL_UNSTABLE_SPHERE_TIMER = 50758, + SPELL_TELEPORT_VISUAL = 52096, }; enum DrakosNPCs { - NPC_UNSTABLE_SPHERE = 28166, + NPC_UNSTABLE_SPHERE = 28166, }; enum Events { - EVENT_MAGIC_PULL = 1, - EVENT_THUNDERING_STOMP = 2, - EVENT_SUMMON = 3, - EVENT_SUMMON_x4 = 4, + EVENT_MAGIC_PULL = 1, + EVENT_THUNDERING_STOMP = 2, + EVENT_SUMMON = 3, + EVENT_SUMMON_x4 = 4, }; -#define SPELL_THUNDERING_STOMP DUNGEON_MODE(SPELL_THUNDERING_STOMP_N, SPELL_THUNDERING_STOMP_H) +#define SPELL_THUNDERING_STOMP DUNGEON_MODE(SPELL_THUNDERING_STOMP_N, SPELL_THUNDERING_STOMP_H) enum Yells { @@ -52,120 +52,120 @@ public: return new boss_drakosAI (pCreature); } - struct boss_drakosAI : public ScriptedAI - { - boss_drakosAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } - - InstanceScript* pInstance; - EventMap events; + struct boss_drakosAI : public ScriptedAI + { + boss_drakosAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + EventMap events; - void Reset() - { - if (pInstance) - pInstance->SetData(DATA_DRAKOS, NOT_STARTED); + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_DRAKOS, NOT_STARTED); - events.Reset(); - } + events.Reset(); + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); - if (pInstance) - pInstance->SetData(DATA_DRAKOS, IN_PROGRESS); + if (pInstance) + pInstance->SetData(DATA_DRAKOS, IN_PROGRESS); - me->SetInCombatWithZone(); + me->SetInCombatWithZone(); - events.RescheduleEvent(EVENT_MAGIC_PULL, urand(10000,15000)); - events.RescheduleEvent(EVENT_THUNDERING_STOMP, urand(3000, 6000)); - events.RescheduleEvent(EVENT_SUMMON, 2000); - } + events.RescheduleEvent(EVENT_MAGIC_PULL, urand(10000,15000)); + events.RescheduleEvent(EVENT_THUNDERING_STOMP, urand(3000, 6000)); + events.RescheduleEvent(EVENT_SUMMON, 2000); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); - if (pInstance) - { - pInstance->SetData(DATA_DRAKOS, DONE); - for( uint8 i=0; i<3; ++i ) - if( uint64 guid = pInstance->GetData64(DATA_DCD_1+i) ) - if( GameObject* pGo = ObjectAccessor::GetGameObject(*me, guid) ) - if( pGo->GetGoState() != GO_STATE_ACTIVE ) - { - pGo->SetLootState(GO_READY); - pGo->UseDoorOrButton(0, false); - } - } + if (pInstance) + { + pInstance->SetData(DATA_DRAKOS, DONE); + for( uint8 i=0; i<3; ++i ) + if( uint64 guid = pInstance->GetData64(DATA_DCD_1+i) ) + if( GameObject* pGo = ObjectAccessor::GetGameObject(*me, guid) ) + if( pGo->GetGoState() != GO_STATE_ACTIVE ) + { + pGo->SetLootState(GO_READY); + pGo->UseDoorOrButton(0, false); + } + } - } + } - void KilledUnit(Unit *victim) - { - Talk(SAY_KILL); - } + void KilledUnit(Unit *victim) + { + Talk(SAY_KILL); + } - void MoveInLineOfSight(Unit* who) {} - void JustSummoned(Creature* summon) {} + void MoveInLineOfSight(Unit* who) {} + void JustSummoned(Creature* summon) {} - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_MAGIC_PULL: - { - Talk(SAY_PULL); - //me->MonsterTextEmote(TEXT_MAGIC_PULL, 0, true); + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_MAGIC_PULL: + { + Talk(SAY_PULL); + //me->MonsterTextEmote(TEXT_MAGIC_PULL, 0, true); - me->CastSpell(me, SPELL_MAGIC_PULL, false); - events.RepeatEvent(urand(15000,25000)); - events.ScheduleEvent(EVENT_SUMMON_x4, 1500); - } - break; - case EVENT_THUNDERING_STOMP: - { - Talk(SAY_STOMP); + me->CastSpell(me, SPELL_MAGIC_PULL, false); + events.RepeatEvent(urand(15000,25000)); + events.ScheduleEvent(EVENT_SUMMON_x4, 1500); + } + break; + case EVENT_THUNDERING_STOMP: + { + Talk(SAY_STOMP); - me->CastSpell(me, SPELL_THUNDERING_STOMP, false); - events.RepeatEvent(urand(10000,20000)); - } - break; - case EVENT_SUMMON: - { - for( uint8 i=0; i<2; ++i ) - { - float angle = rand_norm()*2*M_PI; - me->SummonCreature(NPC_UNSTABLE_SPHERE, me->GetPositionX() + 5.0f*cos(angle), me->GetPositionY() + 5.0f*sin(angle), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 18000); - } - events.RepeatEvent(2000); - } - break; - case EVENT_SUMMON_x4: - for( uint8 i=0; i<4; ++i ) - { - float angle = rand_norm()*2*M_PI; - me->SummonCreature(NPC_UNSTABLE_SPHERE, me->GetPositionX() + 5.0f*cos(angle), me->GetPositionY() + 5.0f*sin(angle), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 18000); - } - events.PopEvent(); - break; - } - } - }; + me->CastSpell(me, SPELL_THUNDERING_STOMP, false); + events.RepeatEvent(urand(10000,20000)); + } + break; + case EVENT_SUMMON: + { + for( uint8 i=0; i<2; ++i ) + { + float angle = rand_norm()*2*M_PI; + me->SummonCreature(NPC_UNSTABLE_SPHERE, me->GetPositionX() + 5.0f*cos(angle), me->GetPositionY() + 5.0f*sin(angle), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 18000); + } + events.RepeatEvent(2000); + } + break; + case EVENT_SUMMON_x4: + for( uint8 i=0; i<4; ++i ) + { + float angle = rand_norm()*2*M_PI; + me->SummonCreature(NPC_UNSTABLE_SPHERE, me->GetPositionX() + 5.0f*cos(angle), me->GetPositionY() + 5.0f*sin(angle), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 18000); + } + events.PopEvent(); + break; + } + } + }; }; class npc_oculus_unstable_sphere : public CreatureScript @@ -178,72 +178,72 @@ public: return new npc_oculus_unstable_sphereAI (pCreature); } - struct npc_oculus_unstable_sphereAI : public ScriptedAI - { - npc_oculus_unstable_sphereAI(Creature *c) : ScriptedAI(c) {} + struct npc_oculus_unstable_sphereAI : public ScriptedAI + { + npc_oculus_unstable_sphereAI(Creature *c) : ScriptedAI(c) {} - uint32 timer; - bool located, gonext; + uint32 timer; + bool located, gonext; - void PickNewLocation() - { - float dist = rand_norm()*40.0f; - float angle = rand_norm()*2*M_PI; - me->GetMotionMaster()->MovePoint(1, 961.29f + dist*cos(angle), 1049.0f + dist*sin(angle), 360.0f); - } + void PickNewLocation() + { + float dist = rand_norm()*40.0f; + float angle = rand_norm()*2*M_PI; + me->GetMotionMaster()->MovePoint(1, 961.29f + dist*cos(angle), 1049.0f + dist*sin(angle), 360.0f); + } - void MovementInform(uint32 type, uint32 id) - { - if( type != POINT_MOTION_TYPE || id != 1 ) - return; + void MovementInform(uint32 type, uint32 id) + { + if( type != POINT_MOTION_TYPE || id != 1 ) + return; - if( !located ) - gonext = true; - } + if( !located ) + gonext = true; + } - void Reset() - { - me->SetReactState(REACT_PASSIVE); - me->SetSpeed(MOVE_RUN, 1.4f, true); - me->CastSpell(me, SPELL_UNSTABLE_SPHERE_PASSIVE, true); - me->CastSpell(me, SPELL_UNSTABLE_SPHERE_TIMER, true); - timer = 0; - located = false; - gonext = false; + void Reset() + { + me->SetReactState(REACT_PASSIVE); + me->SetSpeed(MOVE_RUN, 1.4f, true); + me->CastSpell(me, SPELL_UNSTABLE_SPHERE_PASSIVE, true); + me->CastSpell(me, SPELL_UNSTABLE_SPHERE_TIMER, true); + timer = 0; + located = false; + gonext = false; - PickNewLocation(); - } + PickNewLocation(); + } - void AttackStart(Unit* who) {} - void MoveInLineOfSight(Unit* who) {} + void AttackStart(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} - void UpdateAI(uint32 diff) - { - if( timer == 0 ) - me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); + void UpdateAI(uint32 diff) + { + if( timer == 0 ) + me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); - timer += diff; + timer += diff; - if( timer > 10000 ) - { - if( !located ) - me->GetMotionMaster()->MoveIdle(); - located = true; - me->CastSpell(me, SPELL_UNSTABLE_SPHERE_PULSE, true); - timer -= 2000; - } + if( timer > 10000 ) + { + if( !located ) + me->GetMotionMaster()->MoveIdle(); + located = true; + me->CastSpell(me, SPELL_UNSTABLE_SPHERE_PULSE, true); + timer -= 2000; + } - if( !located && gonext ) - { - PickNewLocation(); - gonext = false; - } - } - }; + if( !located && gonext ) + { + PickNewLocation(); + gonext = false; + } + } + }; }; void AddSC_boss_drakos() { - new boss_drakos(); - new npc_oculus_unstable_sphere(); + new boss_drakos(); + new npc_oculus_unstable_sphere(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index b83eb74e3..e76b5b73e 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -8,39 +8,39 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Spells { - SPELL_ARCANE_BARRAGE_N = 50804, - SPELL_ARCANE_BARRAGE_H = 59381, - SPELL_ARCANE_VOLLEY_N = 51153, - SPELL_ARCANE_VOLLEY_H = 59382, - SPELL_ENRAGED_ASSAULT = 51170, - SPELL_PLANAR_ANOMALIES = 57959, - SPELL_PLANAR_SHIFT = 51162, + SPELL_ARCANE_BARRAGE_N = 50804, + SPELL_ARCANE_BARRAGE_H = 59381, + SPELL_ARCANE_VOLLEY_N = 51153, + SPELL_ARCANE_VOLLEY_H = 59382, + SPELL_ENRAGED_ASSAULT = 51170, + SPELL_PLANAR_ANOMALIES = 57959, + SPELL_PLANAR_SHIFT = 51162, - SPELL_PLANAR_AURA_DAMAGE = 59379, - SPELL_PLANAR_AURA_VISUAL = 57971, - SPELL_PLANAR_BLAST = 57976, - SPELL_SUMMON_PLANAR_ANOMALY = 57963, + SPELL_PLANAR_AURA_DAMAGE = 59379, + SPELL_PLANAR_AURA_VISUAL = 57971, + SPELL_PLANAR_BLAST = 57976, + SPELL_SUMMON_PLANAR_ANOMALY = 57963, - SPELL_DRAKE_STOP_TIME = 49838, + SPELL_DRAKE_STOP_TIME = 49838, }; -#define SPELL_ARCANE_BARRAGE DUNGEON_MODE(SPELL_ARCANE_BARRAGE_N, SPELL_ARCANE_BARRAGE_H) -#define SPELL_ARCANE_VOLLEY DUNGEON_MODE(SPELL_ARCANE_VOLLEY_N, SPELL_ARCANE_VOLLEY_H) +#define SPELL_ARCANE_BARRAGE DUNGEON_MODE(SPELL_ARCANE_BARRAGE_N, SPELL_ARCANE_BARRAGE_H) +#define SPELL_ARCANE_VOLLEY DUNGEON_MODE(SPELL_ARCANE_VOLLEY_N, SPELL_ARCANE_VOLLEY_H) enum VarosNPCs { - NPC_LEY_GUARDIAN_WHELP = 28276, - NPC_PLANAR_ANOMALY = 30879, + NPC_LEY_GUARDIAN_WHELP = 28276, + NPC_PLANAR_ANOMALY = 30879, }; enum Events { - EVENT_SPELL_ARCANE_BARRAGE = 1, - EVENT_SPELL_ARCANE_VOLLEY = 2, - EVENT_SPELL_ENRAGED_ASSAULT = 3, - EVENT_SPELL_PLANAR_SHIFT = 4, - EVENT_SUMMON_WHELPS = 5, - EVENT_SUMMON_SINGLE_WHELP = 6, + EVENT_SPELL_ARCANE_BARRAGE = 1, + EVENT_SPELL_ARCANE_VOLLEY = 2, + EVENT_SPELL_ENRAGED_ASSAULT = 3, + EVENT_SPELL_PLANAR_SHIFT = 4, + EVENT_SUMMON_WHELPS = 5, + EVENT_SUMMON_SINGLE_WHELP = 6, }; enum Says @@ -63,179 +63,179 @@ public: return new boss_eregosAI (pCreature); } - struct boss_eregosAI : public ScriptedAI - { - boss_eregosAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } + struct boss_eregosAI : public ScriptedAI + { + boss_eregosAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - uint8 shiftNumber; + InstanceScript* pInstance; + EventMap events; + uint8 shiftNumber; - void Reset() - { - if (pInstance) - { - pInstance->SetData(DATA_EREGOS, NOT_STARTED); - if( pInstance->GetData(DATA_UROM) != DONE ) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - else - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + void Reset() + { + if (pInstance) + { + pInstance->SetData(DATA_EREGOS, NOT_STARTED); + if( pInstance->GetData(DATA_UROM) != DONE ) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + else + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - events.Reset(); - } + events.Reset(); + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); - if (pInstance) - { - pInstance->SetData(DATA_EREGOS, IN_PROGRESS); + if (pInstance) + { + pInstance->SetData(DATA_EREGOS, IN_PROGRESS); - if( me->FindNearestCreature(NPC_AMBER_DRAKE, 750.0f, true) ) - pInstance->SetData(DATA_AMBER_VOID, 0); - else - pInstance->SetData(DATA_AMBER_VOID, 1); + if( me->FindNearestCreature(NPC_AMBER_DRAKE, 750.0f, true) ) + pInstance->SetData(DATA_AMBER_VOID, 0); + else + pInstance->SetData(DATA_AMBER_VOID, 1); - if( me->FindNearestCreature(NPC_EMERALD_DRAKE, 750.0f, true) ) - pInstance->SetData(DATA_EMERALD_VOID, 0); - else - pInstance->SetData(DATA_EMERALD_VOID, 1); + if( me->FindNearestCreature(NPC_EMERALD_DRAKE, 750.0f, true) ) + pInstance->SetData(DATA_EMERALD_VOID, 0); + else + pInstance->SetData(DATA_EMERALD_VOID, 1); - if( me->FindNearestCreature(NPC_RUBY_DRAKE, 750.0f, true) ) - pInstance->SetData(DATA_RUBY_VOID, 0); - else - pInstance->SetData(DATA_RUBY_VOID, 1); - } + if( me->FindNearestCreature(NPC_RUBY_DRAKE, 750.0f, true) ) + pInstance->SetData(DATA_RUBY_VOID, 0); + else + pInstance->SetData(DATA_RUBY_VOID, 1); + } - me->SetInCombatWithZone(); + me->SetInCombatWithZone(); - shiftNumber = 0; + shiftNumber = 0; - events.RescheduleEvent(EVENT_SPELL_ARCANE_BARRAGE, 0); - events.RescheduleEvent(EVENT_SPELL_ARCANE_VOLLEY, 5000); - events.RescheduleEvent(EVENT_SPELL_ENRAGED_ASSAULT, 35000); - events.RescheduleEvent(EVENT_SUMMON_WHELPS, 40000); - } + events.RescheduleEvent(EVENT_SPELL_ARCANE_BARRAGE, 0); + events.RescheduleEvent(EVENT_SPELL_ARCANE_VOLLEY, 5000); + events.RescheduleEvent(EVENT_SPELL_ENRAGED_ASSAULT, 35000); + events.RescheduleEvent(EVENT_SUMMON_WHELPS, 40000); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_EREGOS, DONE); + if (pInstance) + pInstance->SetData(DATA_EREGOS, DONE); - me->SummonGameObject(GO_SPOTLIGHT, 1018.06f, 1051.09f, 605.619019f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); - } + me->SummonGameObject(GO_SPOTLIGHT, 1018.06f, 1051.09f, 605.619019f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if( !me->GetMap()->IsHeroic() ) - return; + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if( !me->GetMap()->IsHeroic() ) + return; - if( shiftNumber <= uint32(1) && uint32(me->GetHealth()*100/me->GetMaxHealth()) <= uint32(60-shiftNumber*40) ) - { - ++shiftNumber; - events.RescheduleEvent(EVENT_SPELL_PLANAR_SHIFT, 0); - } - } + if( shiftNumber <= uint32(1) && uint32(me->GetHealth()*100/me->GetMaxHealth()) <= uint32(60-shiftNumber*40) ) + { + ++shiftNumber; + events.RescheduleEvent(EVENT_SPELL_PLANAR_SHIFT, 0); + } + } - void KilledUnit(Unit *victim) - { - Talk(SAY_KILL); - } + void KilledUnit(Unit *victim) + { + Talk(SAY_KILL); + } - void MoveInLineOfSight(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} - void JustSummoned(Creature* pSummon) - { - if( pSummon->GetEntry() != NPC_LEY_GUARDIAN_WHELP ) - return; + void JustSummoned(Creature* pSummon) + { + if( pSummon->GetEntry() != NPC_LEY_GUARDIAN_WHELP ) + return; - DoZoneInCombat(pSummon, 300.0f); - } + DoZoneInCombat(pSummon, 300.0f); + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - if( me->HasAura(SPELL_PLANAR_SHIFT) || me->HasAura(SPELL_DRAKE_STOP_TIME) ) - return; + if( me->HasAura(SPELL_PLANAR_SHIFT) || me->HasAura(SPELL_DRAKE_STOP_TIME) ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_ARCANE_BARRAGE: - if( Unit* v = me->GetVictim() ) - me->CastSpell(v, SPELL_ARCANE_BARRAGE, false); - events.RepeatEvent(2500); - break; - case EVENT_SPELL_ARCANE_VOLLEY: - me->CastSpell(me, SPELL_ARCANE_VOLLEY, false); - events.RepeatEvent(8000); - break; - case EVENT_SPELL_ENRAGED_ASSAULT: - Talk(SAY_ENRAGE); - me->CastSpell(me, SPELL_ENRAGED_ASSAULT, false); - events.RepeatEvent(35000); - break; - case EVENT_SUMMON_WHELPS: - for( uint8 i=0; i<5; ++i ) - events.ScheduleEvent(EVENT_SUMMON_SINGLE_WHELP, urand(0, 8000)); - events.RepeatEvent(40000); - break; - case EVENT_SUMMON_SINGLE_WHELP: - { - float x = rand_norm()*50.0f-25.0f; - float y = rand_norm()*50.0f-25.0f; - float z = rand_norm()*50.0f-25.0f; - me->SummonCreature(NPC_LEY_GUARDIAN_WHELP, me->GetPositionX()+x, me->GetPositionY()+y, me->GetPositionZ()+z, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - events.PopEvent(); - } - break; - case EVENT_SPELL_PLANAR_SHIFT: - //me->MonsterYell(TEXT_PLANAR_SHIFT_SAY, LANG_UNIVERSAL, 0); - Talk(SAY_SHIELD); - me->CastSpell(me, SPELL_PLANAR_SHIFT, false); - for( uint8 i=0; i<3; ++i ) - if( Unit* t = SelectTarget(SELECT_TARGET_RANDOM, 0, 300.0f, false) ) - if( Creature* pa = me->SummonCreature(NPC_PLANAR_ANOMALY, *me, TEMPSUMMON_TIMED_DESPAWN, 17000) ) - { - pa->SetCanFly(true); - pa->SetDisableGravity(true); - pa->SetHover(true); - pa->SendMovementFlagUpdate(); - pa->CastSpell(pa, SPELL_PLANAR_AURA_VISUAL, true); - pa->CastSpell(pa, SPELL_PLANAR_AURA_DAMAGE, true); - if (Aura* a = pa->GetAura(SPELL_PLANAR_AURA_DAMAGE)) - a->SetDuration(15000); - if( pa->AI() ) - { - pa->AI()->AttackStart(t); - pa->GetMotionMaster()->MoveChase(t, 0.01f); - } - } - events.PopEvent(); - break; - } - } - }; + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_ARCANE_BARRAGE: + if( Unit* v = me->GetVictim() ) + me->CastSpell(v, SPELL_ARCANE_BARRAGE, false); + events.RepeatEvent(2500); + break; + case EVENT_SPELL_ARCANE_VOLLEY: + me->CastSpell(me, SPELL_ARCANE_VOLLEY, false); + events.RepeatEvent(8000); + break; + case EVENT_SPELL_ENRAGED_ASSAULT: + Talk(SAY_ENRAGE); + me->CastSpell(me, SPELL_ENRAGED_ASSAULT, false); + events.RepeatEvent(35000); + break; + case EVENT_SUMMON_WHELPS: + for( uint8 i=0; i<5; ++i ) + events.ScheduleEvent(EVENT_SUMMON_SINGLE_WHELP, urand(0, 8000)); + events.RepeatEvent(40000); + break; + case EVENT_SUMMON_SINGLE_WHELP: + { + float x = rand_norm()*50.0f-25.0f; + float y = rand_norm()*50.0f-25.0f; + float z = rand_norm()*50.0f-25.0f; + me->SummonCreature(NPC_LEY_GUARDIAN_WHELP, me->GetPositionX()+x, me->GetPositionY()+y, me->GetPositionZ()+z, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + events.PopEvent(); + } + break; + case EVENT_SPELL_PLANAR_SHIFT: + //me->MonsterYell(TEXT_PLANAR_SHIFT_SAY, LANG_UNIVERSAL, 0); + Talk(SAY_SHIELD); + me->CastSpell(me, SPELL_PLANAR_SHIFT, false); + for( uint8 i=0; i<3; ++i ) + if( Unit* t = SelectTarget(SELECT_TARGET_RANDOM, 0, 300.0f, false) ) + if( Creature* pa = me->SummonCreature(NPC_PLANAR_ANOMALY, *me, TEMPSUMMON_TIMED_DESPAWN, 17000) ) + { + pa->SetCanFly(true); + pa->SetDisableGravity(true); + pa->SetHover(true); + pa->SendMovementFlagUpdate(); + pa->CastSpell(pa, SPELL_PLANAR_AURA_VISUAL, true); + pa->CastSpell(pa, SPELL_PLANAR_AURA_DAMAGE, true); + if (Aura* a = pa->GetAura(SPELL_PLANAR_AURA_DAMAGE)) + a->SetDuration(15000); + if( pa->AI() ) + { + pa->AI()->AttackStart(t); + pa->GetMotionMaster()->MoveChase(t, 0.01f); + } + } + events.PopEvent(); + break; + } + } + }; }; void AddSC_boss_eregos() { - new boss_eregos(); + new boss_eregos(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index da9d1602b..b324e5d1e 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -9,43 +9,43 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Spells { - SPELL_EVOCATION = 51602, - SPELL_SUMMON_MENAGERIE_1 = 50476, - SPELL_SUMMON_MENAGERIE_2 = 50495, - SPELL_SUMMON_MENAGERIE_3 = 50496, - SPELL_TELEPORT = 51112, + SPELL_EVOCATION = 51602, + SPELL_SUMMON_MENAGERIE_1 = 50476, + SPELL_SUMMON_MENAGERIE_2 = 50495, + SPELL_SUMMON_MENAGERIE_3 = 50496, + SPELL_TELEPORT = 51112, - SPELL_FROSTBOMB = 51103, - SPELL_TIME_BOMB_N = 51121, - SPELL_TIME_BOMB_H = 59376, - SPELL_EMPOWERED_ARCANE_EXPLOSION_N = 51110, - SPELL_EMPOWERED_ARCANE_EXPLOSION_H = 59377, + SPELL_FROSTBOMB = 51103, + SPELL_TIME_BOMB_N = 51121, + SPELL_TIME_BOMB_H = 59376, + SPELL_EMPOWERED_ARCANE_EXPLOSION_N = 51110, + SPELL_EMPOWERED_ARCANE_EXPLOSION_H = 59377, }; -#define SPELL_EMPOWERED_ARCANE_EXPLOSION DUNGEON_MODE(SPELL_EMPOWERED_ARCANE_EXPLOSION_N, SPELL_EMPOWERED_ARCANE_EXPLOSION_H) -#define SPELL_TIME_BOMB DUNGEON_MODE(SPELL_TIME_BOMB_N, SPELL_TIME_BOMB_H) +#define SPELL_EMPOWERED_ARCANE_EXPLOSION DUNGEON_MODE(SPELL_EMPOWERED_ARCANE_EXPLOSION_N, SPELL_EMPOWERED_ARCANE_EXPLOSION_H) +#define SPELL_TIME_BOMB DUNGEON_MODE(SPELL_TIME_BOMB_N, SPELL_TIME_BOMB_H) enum UromNPCs { - NPC_PHANTASMAL_CLOUDSCRAPER = 27645, - NPC_PHANTASMAL_MAMMOTH = 27642, - NPC_PHANTASMAL_WOLF = 27644, + NPC_PHANTASMAL_CLOUDSCRAPER = 27645, + NPC_PHANTASMAL_MAMMOTH = 27642, + NPC_PHANTASMAL_WOLF = 27644, - NPC_PHANTASMAL_AIR = 27650, - NPC_PHANTASMAL_FIRE = 27651, - NPC_PHANTASMAL_WATER = 27653, + NPC_PHANTASMAL_AIR = 27650, + NPC_PHANTASMAL_FIRE = 27651, + NPC_PHANTASMAL_WATER = 27653, - NPC_PHANTASMAL_MURLOC = 27649, - NPC_PHANTASMAL_NAGAL = 27648, - NPC_PHANTASMAL_OGRE = 27647, + NPC_PHANTASMAL_MURLOC = 27649, + NPC_PHANTASMAL_NAGAL = 27648, + NPC_PHANTASMAL_OGRE = 27647, }; enum Events { - EVENT_FROSTBOMB = 1, - EVENT_TELEPORT_TO_CENTER = 2, - EVENT_TELE_BACK = 3, - EVENT_TIME_BOMB = 4, + EVENT_FROSTBOMB = 1, + EVENT_TELEPORT_TO_CENTER = 2, + EVENT_TELE_BACK = 3, + EVENT_TIME_BOMB = 4, }; enum Yells @@ -60,18 +60,18 @@ enum Yells SAY_PLAYER_KILL = 7 }; -float summons[3][4] = { - {NPC_PHANTASMAL_AIR, NPC_PHANTASMAL_AIR, NPC_PHANTASMAL_WATER, NPC_PHANTASMAL_FIRE}, - {NPC_PHANTASMAL_OGRE, NPC_PHANTASMAL_OGRE, NPC_PHANTASMAL_NAGAL, NPC_PHANTASMAL_MURLOC}, - {NPC_PHANTASMAL_CLOUDSCRAPER, NPC_PHANTASMAL_CLOUDSCRAPER, NPC_PHANTASMAL_MAMMOTH, NPC_PHANTASMAL_WOLF} - }; +float summons[3][4] = { + {NPC_PHANTASMAL_AIR, NPC_PHANTASMAL_AIR, NPC_PHANTASMAL_WATER, NPC_PHANTASMAL_FIRE}, + {NPC_PHANTASMAL_OGRE, NPC_PHANTASMAL_OGRE, NPC_PHANTASMAL_NAGAL, NPC_PHANTASMAL_MURLOC}, + {NPC_PHANTASMAL_CLOUDSCRAPER, NPC_PHANTASMAL_CLOUDSCRAPER, NPC_PHANTASMAL_MAMMOTH, NPC_PHANTASMAL_WOLF} + }; -float cords[4][4] = { - {1177.47f, 937.722f, 527.405f, 2.21657f}, - {968.66f, 1042.53f, 527.32f, 0.077f}, - {1164.02f, 1170.85f, 527.321f, 3.66f}, - {1118.31f, 1080.377f, 508.361f, 4.25f} - }; +float cords[4][4] = { + {1177.47f, 937.722f, 527.405f, 2.21657f}, + {968.66f, 1042.53f, 527.32f, 0.077f}, + {1164.02f, 1170.85f, 527.321f, 3.66f}, + {1118.31f, 1080.377f, 508.361f, 4.25f} + }; class boss_urom : public CreatureScript { @@ -83,249 +83,249 @@ public: return new boss_uromAI (pCreature); } - struct boss_uromAI : public ScriptedAI - { - boss_uromAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } - - InstanceScript* pInstance; - EventMap events; - bool lock; - float x,y,z; - int32 releaseLockTimer; + struct boss_uromAI : public ScriptedAI + { + boss_uromAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + EventMap events; + bool lock; + float x,y,z; + int32 releaseLockTimer; - uint8 GetPhaseByCurrentPosition() - { - for (uint8 i=0; i<4; ++i) - if (me->GetDistance(cords[i][0], cords[i][1], cords[i][2]) < 20.0f) - return i; + uint8 GetPhaseByCurrentPosition() + { + for (uint8 i=0; i<4; ++i) + if (me->GetDistance(cords[i][0], cords[i][1], cords[i][2]) < 20.0f) + return i; - return 0; - } + return 0; + } - void Reset() - { - if (pInstance) - { - pInstance->SetData(DATA_UROM, NOT_STARTED); - if( pInstance->GetData(DATA_VAROS) != DONE ) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - else - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + void Reset() + { + if (pInstance) + { + pInstance->SetData(DATA_UROM, NOT_STARTED); + if( pInstance->GetData(DATA_VAROS) != DONE ) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + else + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - me->CastSpell(me, SPELL_EVOCATION, true); - events.Reset(); - lock = false; - x,y,z = 0.0f; - releaseLockTimer = 0; - me->ApplySpellImmune(0, IMMUNITY_ID, 49838, true); - } + me->CastSpell(me, SPELL_EVOCATION, true); + events.Reset(); + lock = false; + x,y,z = 0.0f; + releaseLockTimer = 0; + me->ApplySpellImmune(0, IMMUNITY_ID, 49838, true); + } - void EnterCombat(Unit* who) - { - if( lock ) - return; + void EnterCombat(Unit* who) + { + if( lock ) + return; - uint8 phase = GetPhaseByCurrentPosition(); - if( phase == 3 ) - { - Talk(SAY_AGGRO); + uint8 phase = GetPhaseByCurrentPosition(); + if( phase == 3 ) + { + Talk(SAY_AGGRO); - if( pInstance ) - pInstance->SetData(DATA_UROM, IN_PROGRESS); + if( pInstance ) + pInstance->SetData(DATA_UROM, IN_PROGRESS); - me->SetInCombatWithZone(); - me->SetHomePosition(cords[0][0], cords[0][1], cords[0][2], cords[0][3]); - if( me->FindCurrentSpellBySpellId(SPELL_EVOCATION) ) - me->InterruptNonMeleeSpells(false); + me->SetInCombatWithZone(); + me->SetHomePosition(cords[0][0], cords[0][1], cords[0][2], cords[0][3]); + if( me->FindCurrentSpellBySpellId(SPELL_EVOCATION) ) + me->InterruptNonMeleeSpells(false); - events.RescheduleEvent(EVENT_FROSTBOMB, urand(7000, 11000)); - events.RescheduleEvent(EVENT_TELEPORT_TO_CENTER, urand(30000, 35000)); - events.RescheduleEvent(EVENT_TIME_BOMB, urand(20000, 25000)); - } - else - { - lock = true; + events.RescheduleEvent(EVENT_FROSTBOMB, urand(7000, 11000)); + events.RescheduleEvent(EVENT_TELEPORT_TO_CENTER, urand(30000, 35000)); + events.RescheduleEvent(EVENT_TIME_BOMB, urand(20000, 25000)); + } + else + { + lock = true; - switch( phase ) - { - case 0: - Talk(SAY_SUMMON_1); - me->InterruptNonMeleeSpells(false); - me->CastSpell(me, SPELL_SUMMON_MENAGERIE_1, false); - break; - case 1: - Talk(SAY_SUMMON_2); - me->InterruptNonMeleeSpells(false); - me->CastSpell(me, SPELL_SUMMON_MENAGERIE_2, false); - break; - case 2: - Talk(SAY_SUMMON_3); - me->InterruptNonMeleeSpells(false); - me->CastSpell(me, SPELL_SUMMON_MENAGERIE_3, false); - break; - } - } - } + switch( phase ) + { + case 0: + Talk(SAY_SUMMON_1); + me->InterruptNonMeleeSpells(false); + me->CastSpell(me, SPELL_SUMMON_MENAGERIE_1, false); + break; + case 1: + Talk(SAY_SUMMON_2); + me->InterruptNonMeleeSpells(false); + me->CastSpell(me, SPELL_SUMMON_MENAGERIE_2, false); + break; + case 2: + Talk(SAY_SUMMON_3); + me->InterruptNonMeleeSpells(false); + me->CastSpell(me, SPELL_SUMMON_MENAGERIE_3, false); + break; + } + } + } - void AttackStart(Unit* who) - { - if( lock ) - return; + void AttackStart(Unit* who) + { + if( lock ) + return; - if (me->GetDistance(1103.0f, 1049.0f, 510.0f) < 55.0f) - ScriptedAI::AttackStart(who); - } + if (me->GetDistance(1103.0f, 1049.0f, 510.0f) < 55.0f) + ScriptedAI::AttackStart(who); + } - void JustSummoned(Creature* pSummon) - { - pSummon->SetInCombatWithZone(); - if( Unit* v = pSummon->SelectVictim() ) - if( pSummon->AI() ) - pSummon->AI()->AttackStart(v); - } + void JustSummoned(Creature* pSummon) + { + pSummon->SetInCombatWithZone(); + if( Unit* v = pSummon->SelectVictim() ) + if( pSummon->AI() ) + pSummon->AI()->AttackStart(v); + } - void LeaveCombat() - { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->LoadCreaturesAddon(true); - me->SetLootRecipient(NULL); - me->ResetPlayerDamageReq(); - } + void LeaveCombat() + { + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->LoadCreaturesAddon(true); + me->SetLootRecipient(NULL); + me->ResetPlayerDamageReq(); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_UROM, DONE); - } + if (pInstance) + pInstance->SetData(DATA_UROM, DONE); + } - void KilledUnit(Unit *victim) - { - Talk(SAY_PLAYER_KILL); - } + void KilledUnit(Unit *victim) + { + Talk(SAY_PLAYER_KILL); + } - void SpellHit(Unit* caster, const SpellInfo* spell) - { - switch( spell->Id ) - { - case SPELL_SUMMON_MENAGERIE_1: - case SPELL_SUMMON_MENAGERIE_2: - case SPELL_SUMMON_MENAGERIE_3: - { - me->DestroyForNearbyPlayers(); - uint8 phase = GetPhaseByCurrentPosition(); - for( uint8 i=0; i<4; ++i ) - me->SummonCreature(summons[phase][i], cords[phase][0] + ((i%2) ? 4.0f : -4.0f), cords[phase][1] + (i<2 ? 4.0f : -4.0f), cords[phase][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000); - me->SetHomePosition(cords[phase+1][0], cords[phase+1][1], cords[phase+1][2], cords[phase+1][3]); - LeaveCombat(); - me->CastSpell(me, SPELL_EVOCATION, true); - releaseLockTimer = 1; - } - break; - case SPELL_TELEPORT: - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->SetControlled(true, UNIT_STATE_ROOT); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->NearTeleportTo(1103.69f, 1048.76f, 512.279f, 1.16f); - - Talk(SAY_ARCANE_EXPLOSION); - Talk(EMOTE_ARCANE_EXPLOSION); + void SpellHit(Unit* caster, const SpellInfo* spell) + { + switch( spell->Id ) + { + case SPELL_SUMMON_MENAGERIE_1: + case SPELL_SUMMON_MENAGERIE_2: + case SPELL_SUMMON_MENAGERIE_3: + { + me->DestroyForNearbyPlayers(); + uint8 phase = GetPhaseByCurrentPosition(); + for( uint8 i=0; i<4; ++i ) + me->SummonCreature(summons[phase][i], cords[phase][0] + ((i%2) ? 4.0f : -4.0f), cords[phase][1] + (i<2 ? 4.0f : -4.0f), cords[phase][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000); + me->SetHomePosition(cords[phase+1][0], cords[phase+1][1], cords[phase+1][2], cords[phase+1][3]); + LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATION, true); + releaseLockTimer = 1; + } + break; + case SPELL_TELEPORT: + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->SetControlled(true, UNIT_STATE_ROOT); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->NearTeleportTo(1103.69f, 1048.76f, 512.279f, 1.16f); + + Talk(SAY_ARCANE_EXPLOSION); + Talk(EMOTE_ARCANE_EXPLOSION); - me->CastSpell(me, SPELL_EMPOWERED_ARCANE_EXPLOSION, false); - events.RescheduleEvent(EVENT_TELE_BACK, DUNGEON_MODE(9000, 7000)); - default: - break; - } - } + me->CastSpell(me, SPELL_EMPOWERED_ARCANE_EXPLOSION, false); + events.RescheduleEvent(EVENT_TELE_BACK, DUNGEON_MODE(9000, 7000)); + default: + break; + } + } - void MoveInLineOfSight(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} - void UpdateAI(uint32 diff) - { - if( releaseLockTimer ) - { - if( releaseLockTimer >= 5000 ) - { - lock = false; - if (me->IsInCombat()) - { - LeaveCombat(); - me->CastSpell(me, SPELL_EVOCATION, true); - } - releaseLockTimer = 0; - } - else - releaseLockTimer += diff; - } + void UpdateAI(uint32 diff) + { + if( releaseLockTimer ) + { + if( releaseLockTimer >= 5000 ) + { + lock = false; + if (me->IsInCombat()) + { + LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATION, true); + } + releaseLockTimer = 0; + } + else + releaseLockTimer += diff; + } - if( !UpdateVictim() ) - return; + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_FROSTBOMB: - if( Unit* v = me->GetVictim() ) - me->CastSpell(v, SPELL_FROSTBOMB, false); - events.RepeatEvent(urand(7000,11000)); - break; - case EVENT_TIME_BOMB: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true) ) - me->CastSpell(target, SPELL_TIME_BOMB, false); - events.RepeatEvent(urand(20000, 25000)); - break; - case EVENT_TELEPORT_TO_CENTER: - x = me->GetPositionX(); - y = me->GetPositionY(); - z = me->GetPositionZ(); - me->CastSpell(me, SPELL_TELEPORT, false); - events.RepeatEvent(urand(25000,30000)); - events.DelayEvents(10000); - break; - case EVENT_TELE_BACK: - me->GetMotionMaster()->MoveIdle(); - me->DisableSpline(); - me->SetCanFly(false); - me->SetDisableGravity(false); - me->NearTeleportTo(x, y, z, 0.0f); - me->SetControlled(false, UNIT_STATE_ROOT); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - events.PopEvent(); - break; - } - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_FROSTBOMB: + if( Unit* v = me->GetVictim() ) + me->CastSpell(v, SPELL_FROSTBOMB, false); + events.RepeatEvent(urand(7000,11000)); + break; + case EVENT_TIME_BOMB: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true) ) + me->CastSpell(target, SPELL_TIME_BOMB, false); + events.RepeatEvent(urand(20000, 25000)); + break; + case EVENT_TELEPORT_TO_CENTER: + x = me->GetPositionX(); + y = me->GetPositionY(); + z = me->GetPositionZ(); + me->CastSpell(me, SPELL_TELEPORT, false); + events.RepeatEvent(urand(25000,30000)); + events.DelayEvents(10000); + break; + case EVENT_TELE_BACK: + me->GetMotionMaster()->MoveIdle(); + me->DisableSpline(); + me->SetCanFly(false); + me->SetDisableGravity(false); + me->NearTeleportTo(x, y, z, 0.0f); + me->SetControlled(false, UNIT_STATE_ROOT); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + events.PopEvent(); + break; + } + } - void EnterEvadeMode() - { - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetControlled(false, UNIT_STATE_ROOT); - ScriptedAI::EnterEvadeMode(); - } - }; + void EnterEvadeMode() + { + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetControlled(false, UNIT_STATE_ROOT); + ScriptedAI::EnterEvadeMode(); + } + }; }; void AddSC_boss_urom() { - new boss_urom(); + new boss_urom(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 486b7579e..4bc3bf93d 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -8,51 +8,51 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Spells { - SPELL_CORE_AURA_PASSIVE = 50798, + SPELL_CORE_AURA_PASSIVE = 50798, - SPELL_AMPLIFY_MAGIC_N = 51054, - SPELL_AMPLIFY_MAGIC_H = 59371, + SPELL_AMPLIFY_MAGIC_N = 51054, + SPELL_AMPLIFY_MAGIC_H = 59371, - SPELL_ENERGIZE_CORES_N = 50785, - SPELL_ENERGIZE_CORES_H = 59372, - SPELL_ENERGIZE_CORES_THIN_N = 61407, - SPELL_ENERGIZE_CORES_THIN_H = 62136, - SPELL_ENERGIZE_CORES_TRIGGER_1 = 54069, - SPELL_ENERGIZE_CORES_TRIGGER_2 = 56251, + SPELL_ENERGIZE_CORES_N = 50785, + SPELL_ENERGIZE_CORES_H = 59372, + SPELL_ENERGIZE_CORES_THIN_N = 61407, + SPELL_ENERGIZE_CORES_THIN_H = 62136, + SPELL_ENERGIZE_CORES_TRIGGER_1 = 54069, + SPELL_ENERGIZE_CORES_TRIGGER_2 = 56251, - SPELL_CALL_AZURE_RING_CAPTAIN_1 = 51002, - SPELL_CALL_AZURE_RING_CAPTAIN_2 = 51006, - SPELL_CALL_AZURE_RING_CAPTAIN_3 = 51007, - SPELL_CALL_AZURE_RING_CAPTAIN_4 = 51008, + SPELL_CALL_AZURE_RING_CAPTAIN_1 = 51002, + SPELL_CALL_AZURE_RING_CAPTAIN_2 = 51006, + SPELL_CALL_AZURE_RING_CAPTAIN_3 = 51007, + SPELL_CALL_AZURE_RING_CAPTAIN_4 = 51008, - SPELL_SUMMON_ARCANE_BEAM_1 = 51014, - SPELL_SUMMON_ARCANE_BEAM_2 = 51017, - SPELL_ARCANE_BEAM_SPAWN_TRIGGER = 51022, - SPELL_ARCANE_BEAM_VISUAL = 51024, - SPELL_ARCANE_BEAM_PERIODIC_DAMAGE = 51019, + SPELL_SUMMON_ARCANE_BEAM_1 = 51014, + SPELL_SUMMON_ARCANE_BEAM_2 = 51017, + SPELL_ARCANE_BEAM_SPAWN_TRIGGER = 51022, + SPELL_ARCANE_BEAM_VISUAL = 51024, + SPELL_ARCANE_BEAM_PERIODIC_DAMAGE = 51019, }; enum VarosNPCs { - NPC_CENTRIFUGE_CORE = 28183, - NPC_AZURE_RING_CAPTAIN = 28236, - NPC_ARCANE_BEAM = 28239, + NPC_CENTRIFUGE_CORE = 28183, + NPC_AZURE_RING_CAPTAIN = 28236, + NPC_ARCANE_BEAM = 28239, }; enum Events { - EVENT_AMPLIFY_MAGIC = 1, - EVENT_CALL_AZURE_RING_CAPTAIN_1 = 2, - EVENT_CALL_AZURE_RING_CAPTAIN_2 = 3, - EVENT_CALL_AZURE_RING_CAPTAIN_3 = 4, - EVENT_CALL_AZURE_RING_CAPTAIN_4 = 5, - EVENT_ENERGIZE_CORES_THIN = 6, - EVENT_ENERGIZE_CORES_DAMAGE = 7, + EVENT_AMPLIFY_MAGIC = 1, + EVENT_CALL_AZURE_RING_CAPTAIN_1 = 2, + EVENT_CALL_AZURE_RING_CAPTAIN_2 = 3, + EVENT_CALL_AZURE_RING_CAPTAIN_3 = 4, + EVENT_CALL_AZURE_RING_CAPTAIN_4 = 5, + EVENT_ENERGIZE_CORES_THIN = 6, + EVENT_ENERGIZE_CORES_DAMAGE = 7, }; -#define SPELL_AMPLIFY_MAGIC DUNGEON_MODE(SPELL_AMPLIFY_MAGIC_N, SPELL_AMPLIFY_MAGIC_H) -#define SPELL_ENERGIZE_CORES DUNGEON_MODE(SPELL_ENERGIZE_CORES_N, SPELL_ENERGIZE_CORES_H) -#define SPELL_ENERGIZE_CORES_THIN DUNGEON_MODE(SPELL_ENERGIZE_CORES_THIN_N, SPELL_ENERGIZE_CORES_THIN_H) +#define SPELL_AMPLIFY_MAGIC DUNGEON_MODE(SPELL_AMPLIFY_MAGIC_N, SPELL_AMPLIFY_MAGIC_H) +#define SPELL_ENERGIZE_CORES DUNGEON_MODE(SPELL_ENERGIZE_CORES_N, SPELL_ENERGIZE_CORES_H) +#define SPELL_ENERGIZE_CORES_THIN DUNGEON_MODE(SPELL_ENERGIZE_CORES_THIN_N, SPELL_ENERGIZE_CORES_THIN_H) enum Says { @@ -71,170 +71,170 @@ public: { return new boss_varosAI (pCreature); } - struct boss_varosAI : public ScriptedAI - { - boss_varosAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } - - InstanceScript* pInstance; - EventMap events; - float ZapAngle; + struct boss_varosAI : public ScriptedAI + { + boss_varosAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + EventMap events; + float ZapAngle; - void Reset() - { - if (pInstance) - { - pInstance->SetData(DATA_VAROS, NOT_STARTED); - if( pInstance->GetData(DATA_CC_COUNT) < 10 ) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->CastSpell(me, 50053, true); - } - else - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->InterruptNonMeleeSpells(false); - me->RemoveAura(50053); - } - } + void Reset() + { + if (pInstance) + { + pInstance->SetData(DATA_VAROS, NOT_STARTED); + if( pInstance->GetData(DATA_CC_COUNT) < 10 ) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->CastSpell(me, 50053, true); + } + else + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->InterruptNonMeleeSpells(false); + me->RemoveAura(50053); + } + } - events.Reset(); - ZapAngle = 6.20f; - me->ApplySpellImmune(0, IMMUNITY_ID, 49838, true); - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - } + events.Reset(); + ZapAngle = 6.20f; + me->ApplySpellImmune(0, IMMUNITY_ID, 49838, true); + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); - if (pInstance) - pInstance->SetData(DATA_VAROS, IN_PROGRESS); + if (pInstance) + pInstance->SetData(DATA_VAROS, IN_PROGRESS); - me->SetInCombatWithZone(); + me->SetInCombatWithZone(); - events.RescheduleEvent(EVENT_AMPLIFY_MAGIC, urand(5000, 10000)); - events.RescheduleEvent(EVENT_CALL_AZURE_RING_CAPTAIN_1, 5000); - events.RescheduleEvent(EVENT_ENERGIZE_CORES_THIN, 0); - } + events.RescheduleEvent(EVENT_AMPLIFY_MAGIC, urand(5000, 10000)); + events.RescheduleEvent(EVENT_CALL_AZURE_RING_CAPTAIN_1, 5000); + events.RescheduleEvent(EVENT_ENERGIZE_CORES_THIN, 0); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); - if (pInstance) - { - pInstance->SetData(DATA_VAROS, DONE); - pInstance->instance->SummonCreature(NPC_IMAGE_OF_BELGARISTRASZ, *me); - } - } + if (pInstance) + { + pInstance->SetData(DATA_VAROS, DONE); + pInstance->instance->SummonCreature(NPC_IMAGE_OF_BELGARISTRASZ, *me); + } + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + ScriptedAI::EnterEvadeMode(); + } - void MoveInLineOfSight(Unit* who) {} - void JustSummoned(Creature* summon) {} + void MoveInLineOfSight(Unit* who) {} + void JustSummoned(Creature* summon) {} - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_AMPLIFY_MAGIC: - { - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true) ) - me->CastSpell(target, SPELL_AMPLIFY_MAGIC, false); - events.RepeatEvent(urand(17500, 22500)); - } - break; - case EVENT_CALL_AZURE_RING_CAPTAIN_1: - case EVENT_CALL_AZURE_RING_CAPTAIN_2: - case EVENT_CALL_AZURE_RING_CAPTAIN_3: - case EVENT_CALL_AZURE_RING_CAPTAIN_4: - { - Talk(SAY_AZURE); - Talk(SAY_AZURE_EMOTE); - switch( events.GetEvent() ) - { - case EVENT_CALL_AZURE_RING_CAPTAIN_1: - me->CastSpell(me, SPELL_CALL_AZURE_RING_CAPTAIN_1, true); - events.ScheduleEvent(EVENT_CALL_AZURE_RING_CAPTAIN_2, 16000); - break; - case EVENT_CALL_AZURE_RING_CAPTAIN_2: - me->CastSpell(me, SPELL_CALL_AZURE_RING_CAPTAIN_2, true); - events.ScheduleEvent(EVENT_CALL_AZURE_RING_CAPTAIN_3, 16000); - break; - case EVENT_CALL_AZURE_RING_CAPTAIN_3: - me->CastSpell(me, SPELL_CALL_AZURE_RING_CAPTAIN_3, true); - events.ScheduleEvent(EVENT_CALL_AZURE_RING_CAPTAIN_4, 16000); - break; - case EVENT_CALL_AZURE_RING_CAPTAIN_4: - me->CastSpell(me, SPELL_CALL_AZURE_RING_CAPTAIN_4, true); - events.ScheduleEvent(EVENT_CALL_AZURE_RING_CAPTAIN_1, 16000); - break; - } - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true) ) - { - if( Creature* trigger = me->SummonCreature(NPC_ARCANE_BEAM, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 13000) ) - { - if( Creature* c = me->FindNearestCreature(NPC_AZURE_RING_CAPTAIN, 500.0f, true) ) - c->CastSpell(trigger, SPELL_ARCANE_BEAM_VISUAL, true); - trigger->GetMotionMaster()->MoveChase(target, 0.1f); - trigger->CastSpell(me, SPELL_ARCANE_BEAM_PERIODIC_DAMAGE, true); - } - } - events.PopEvent(); - } - break; - case EVENT_ENERGIZE_CORES_THIN: - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - me->SetOrientation(ZapAngle); - me->CastSpell(me, SPELL_ENERGIZE_CORES_THIN, true); - events.PopEvent(); - events.ScheduleEvent(EVENT_ENERGIZE_CORES_DAMAGE, 4500); - } - break; - case EVENT_ENERGIZE_CORES_DAMAGE: - { - me->SetOrientation(ZapAngle); - me->DisableRotate(true); - me->DisableSpline(); - me->SetFacingTo(ZapAngle); - me->SetControlled(true, UNIT_STATE_ROOT); - me->CastSpell((Unit*)NULL, SPELL_ENERGIZE_CORES, false); - ZapAngle += M_PI/2; - if( ZapAngle >= 2*M_PI ) - ZapAngle -= 2*M_PI; - events.PopEvent(); - events.ScheduleEvent(EVENT_ENERGIZE_CORES_THIN, 2000); - } - break; - } - } - }; + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_AMPLIFY_MAGIC: + { + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true) ) + me->CastSpell(target, SPELL_AMPLIFY_MAGIC, false); + events.RepeatEvent(urand(17500, 22500)); + } + break; + case EVENT_CALL_AZURE_RING_CAPTAIN_1: + case EVENT_CALL_AZURE_RING_CAPTAIN_2: + case EVENT_CALL_AZURE_RING_CAPTAIN_3: + case EVENT_CALL_AZURE_RING_CAPTAIN_4: + { + Talk(SAY_AZURE); + Talk(SAY_AZURE_EMOTE); + switch( events.GetEvent() ) + { + case EVENT_CALL_AZURE_RING_CAPTAIN_1: + me->CastSpell(me, SPELL_CALL_AZURE_RING_CAPTAIN_1, true); + events.ScheduleEvent(EVENT_CALL_AZURE_RING_CAPTAIN_2, 16000); + break; + case EVENT_CALL_AZURE_RING_CAPTAIN_2: + me->CastSpell(me, SPELL_CALL_AZURE_RING_CAPTAIN_2, true); + events.ScheduleEvent(EVENT_CALL_AZURE_RING_CAPTAIN_3, 16000); + break; + case EVENT_CALL_AZURE_RING_CAPTAIN_3: + me->CastSpell(me, SPELL_CALL_AZURE_RING_CAPTAIN_3, true); + events.ScheduleEvent(EVENT_CALL_AZURE_RING_CAPTAIN_4, 16000); + break; + case EVENT_CALL_AZURE_RING_CAPTAIN_4: + me->CastSpell(me, SPELL_CALL_AZURE_RING_CAPTAIN_4, true); + events.ScheduleEvent(EVENT_CALL_AZURE_RING_CAPTAIN_1, 16000); + break; + } + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true) ) + { + if( Creature* trigger = me->SummonCreature(NPC_ARCANE_BEAM, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 13000) ) + { + if( Creature* c = me->FindNearestCreature(NPC_AZURE_RING_CAPTAIN, 500.0f, true) ) + c->CastSpell(trigger, SPELL_ARCANE_BEAM_VISUAL, true); + trigger->GetMotionMaster()->MoveChase(target, 0.1f); + trigger->CastSpell(me, SPELL_ARCANE_BEAM_PERIODIC_DAMAGE, true); + } + } + events.PopEvent(); + } + break; + case EVENT_ENERGIZE_CORES_THIN: + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + me->SetOrientation(ZapAngle); + me->CastSpell(me, SPELL_ENERGIZE_CORES_THIN, true); + events.PopEvent(); + events.ScheduleEvent(EVENT_ENERGIZE_CORES_DAMAGE, 4500); + } + break; + case EVENT_ENERGIZE_CORES_DAMAGE: + { + me->SetOrientation(ZapAngle); + me->DisableRotate(true); + me->DisableSpline(); + me->SetFacingTo(ZapAngle); + me->SetControlled(true, UNIT_STATE_ROOT); + me->CastSpell((Unit*)NULL, SPELL_ENERGIZE_CORES, false); + ZapAngle += M_PI/2; + if( ZapAngle >= 2*M_PI ) + ZapAngle -= 2*M_PI; + events.PopEvent(); + events.ScheduleEvent(EVENT_ENERGIZE_CORES_THIN, 2000); + } + break; + } + } + }; }; void AddSC_boss_varos() { - new boss_varos(); + new boss_varos(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index 057b0cb3b..15c2e0101 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -19,284 +19,284 @@ public: return new instance_oculus_InstanceMapScript(pMap); } - struct instance_oculus_InstanceMapScript : public InstanceScript - { - instance_oculus_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } + struct instance_oculus_InstanceMapScript : public InstanceScript + { + instance_oculus_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 DragonCageDoorGUID[3]; - uint64 EregosCacheGUID; - uint32 CentrifugeCount; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint64 DragonCageDoorGUID[3]; + uint64 EregosCacheGUID; + uint32 CentrifugeCount; - uint64 uiDrakosGUID; - uint64 uiVarosGUID; - uint64 uiUromGUID; - uint64 uiEregosGUID; + uint64 uiDrakosGUID; + uint64 uiVarosGUID; + uint64 uiUromGUID; + uint64 uiEregosGUID; - bool bAmberVoid; - bool bEmeraldVoid; - bool bRubyVoid; - - void Initialize() - { - EregosCacheGUID = 0; - uiDrakosGUID = 0; - uiVarosGUID = 0; - uiUromGUID = 0; - uiEregosGUID = 0; - CentrifugeCount = 0; - bAmberVoid = false; - bEmeraldVoid = false; - bRubyVoid = false; + bool bAmberVoid; + bool bEmeraldVoid; + bool bRubyVoid; + + void Initialize() + { + EregosCacheGUID = 0; + uiDrakosGUID = 0; + uiVarosGUID = 0; + uiUromGUID = 0; + uiEregosGUID = 0; + CentrifugeCount = 0; + bAmberVoid = false; + bEmeraldVoid = false; + bRubyVoid = false; - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - memset(&DragonCageDoorGUID, 0, sizeof(DragonCageDoorGUID)); - } - - void OnCreatureCreate(Creature* pCreature) - { - switch( pCreature->GetEntry() ) - { - case NPC_DRAKOS: - uiDrakosGUID = pCreature->GetGUID(); - break; - case NPC_VAROS: - uiVarosGUID = pCreature->GetGUID(); - break; - case NPC_UROM: - uiUromGUID = pCreature->GetGUID(); - break; - case NPC_EREGOS: - uiEregosGUID = pCreature->GetGUID(); - break; - } - } + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + memset(&DragonCageDoorGUID, 0, sizeof(DragonCageDoorGUID)); + } + + void OnCreatureCreate(Creature* pCreature) + { + switch( pCreature->GetEntry() ) + { + case NPC_DRAKOS: + uiDrakosGUID = pCreature->GetGUID(); + break; + case NPC_VAROS: + uiVarosGUID = pCreature->GetGUID(); + break; + case NPC_UROM: + uiUromGUID = pCreature->GetGUID(); + break; + case NPC_EREGOS: + uiEregosGUID = pCreature->GetGUID(); + break; + } + } - void OnGameObjectCreate(GameObject* pGo) - { - switch( pGo->GetEntry() ) - { - case GO_DRAGON_CAGE_DOOR: - for( uint8 i=0; i<3; ++i ) - { - if( DragonCageDoorGUID[i] ) - continue; + void OnGameObjectCreate(GameObject* pGo) + { + switch( pGo->GetEntry() ) + { + case GO_DRAGON_CAGE_DOOR: + for( uint8 i=0; i<3; ++i ) + { + if( DragonCageDoorGUID[i] ) + continue; - DragonCageDoorGUID[i] = pGo->GetGUID(); - break; - } - if( m_auiEncounter[DATA_DRAKOS] == DONE ) - if( pGo->GetGoState() != GO_STATE_ACTIVE ) - { - pGo->SetLootState(GO_READY); - pGo->UseDoorOrButton(0, false); - } - break; - case GO_CACHE_OF_EREGOS: - case GO_CACHE_OF_EREGOS_HERO: - EregosCacheGUID = pGo->GetGUID(); - break; - } - } + DragonCageDoorGUID[i] = pGo->GetGUID(); + break; + } + if( m_auiEncounter[DATA_DRAKOS] == DONE ) + if( pGo->GetGoState() != GO_STATE_ACTIVE ) + { + pGo->SetLootState(GO_READY); + pGo->UseDoorOrButton(0, false); + } + break; + case GO_CACHE_OF_EREGOS: + case GO_CACHE_OF_EREGOS_HERO: + EregosCacheGUID = pGo->GetGUID(); + break; + } + } - void OnPlayerEnter(Player* player) - { - if (m_auiEncounter[DATA_DRAKOS] == DONE && m_auiEncounter[DATA_VAROS] != DONE) - { - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 10-CentrifugeCount); - } - else - { - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 0); - } - } + void OnPlayerEnter(Player* player) + { + if (m_auiEncounter[DATA_DRAKOS] == DONE && m_auiEncounter[DATA_VAROS] != DONE) + { + player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); + player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 10-CentrifugeCount); + } + else + { + player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); + player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 0); + } + } - void OnUnitDeath(Unit* unit) - { - if (unit->GetEntry() == NPC_CENTRIFUGE_CONSTRUCT) - SetData(DATA_CC_COUNT, DONE); - } - - void SetData(uint32 type, uint32 data) - { - switch( type ) - { - case DATA_DRAKOS: - m_auiEncounter[DATA_DRAKOS] = data; - if( data == DONE ) - { - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 10-CentrifugeCount); + void OnUnitDeath(Unit* unit) + { + if (unit->GetEntry() == NPC_CENTRIFUGE_CONSTRUCT) + SetData(DATA_CC_COUNT, DONE); + } + + void SetData(uint32 type, uint32 data) + { + switch( type ) + { + case DATA_DRAKOS: + m_auiEncounter[DATA_DRAKOS] = data; + if( data == DONE ) + { + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 10-CentrifugeCount); - if (instance->IsHeroic()) - DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_IT_COUNT_TIMED_EVENT); - } - break; - case DATA_VAROS: - m_auiEncounter[DATA_VAROS] = data; - if( data == DONE ) - { - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); + if (instance->IsHeroic()) + DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_IT_COUNT_TIMED_EVENT); + } + break; + case DATA_VAROS: + m_auiEncounter[DATA_VAROS] = data; + if( data == DONE ) + { + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); - if( Creature* urom = instance->GetCreature(uiUromGUID) ) - urom->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - break; - case DATA_UROM: - m_auiEncounter[DATA_UROM] = data; - if( data == DONE ) - if( Creature* eregos = instance->GetCreature(uiEregosGUID) ) - eregos->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - break; - case DATA_EREGOS: - m_auiEncounter[DATA_EREGOS] = data; - if (data == DONE) - DoRespawnGameObject(EregosCacheGUID, 7*DAY); - break; - case DATA_CC_COUNT: - if( CentrifugeCount < 10 ) - { - ++CentrifugeCount; - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 10-CentrifugeCount); - } - if( CentrifugeCount >= 10 ) - if( Creature* varos = instance->GetCreature(uiVarosGUID) ) - { - varos->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - varos->InterruptNonMeleeSpells(false); - varos->RemoveAura(50053); - } - break; - case DATA_AMBER_VOID: - bAmberVoid = data ? true : false; - break; - case DATA_EMERALD_VOID: - bEmeraldVoid = data ? true : false; - break; - case DATA_RUBY_VOID: - bRubyVoid = data ? true : false; - break; - } + if( Creature* urom = instance->GetCreature(uiUromGUID) ) + urom->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + break; + case DATA_UROM: + m_auiEncounter[DATA_UROM] = data; + if( data == DONE ) + if( Creature* eregos = instance->GetCreature(uiEregosGUID) ) + eregos->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + break; + case DATA_EREGOS: + m_auiEncounter[DATA_EREGOS] = data; + if (data == DONE) + DoRespawnGameObject(EregosCacheGUID, 7*DAY); + break; + case DATA_CC_COUNT: + if( CentrifugeCount < 10 ) + { + ++CentrifugeCount; + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 10-CentrifugeCount); + } + if( CentrifugeCount >= 10 ) + if( Creature* varos = instance->GetCreature(uiVarosGUID) ) + { + varos->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + varos->InterruptNonMeleeSpells(false); + varos->RemoveAura(50053); + } + break; + case DATA_AMBER_VOID: + bAmberVoid = data ? true : false; + break; + case DATA_EMERALD_VOID: + bEmeraldVoid = data ? true : false; + break; + case DATA_RUBY_VOID: + bRubyVoid = data ? true : false; + break; + } - if( data == DONE ) - SaveToDB(); - } - - uint32 GetData(uint32 type) const - { - switch( type ) - { - case DATA_DRAKOS: - case DATA_VAROS: - case DATA_UROM: - case DATA_EREGOS: - return m_auiEncounter[type]; - case DATA_CC_COUNT: - return CentrifugeCount; - } + if( data == DONE ) + SaveToDB(); + } + + uint32 GetData(uint32 type) const + { + switch( type ) + { + case DATA_DRAKOS: + case DATA_VAROS: + case DATA_UROM: + case DATA_EREGOS: + return m_auiEncounter[type]; + case DATA_CC_COUNT: + return CentrifugeCount; + } - return 0; - } - - uint64 GetData64(uint32 identifier) const - { - switch( identifier ) - { - case DATA_DRAKOS: - return uiDrakosGUID; - case DATA_VAROS: - return uiVarosGUID; - case DATA_UROM: - return uiUromGUID; - case DATA_EREGOS: - return uiEregosGUID; - case DATA_DCD_1: - case DATA_DCD_2: - case DATA_DCD_3: - return DragonCageDoorGUID[identifier-100]; - } + return 0; + } + + uint64 GetData64(uint32 identifier) const + { + switch( identifier ) + { + case DATA_DRAKOS: + return uiDrakosGUID; + case DATA_VAROS: + return uiVarosGUID; + case DATA_UROM: + return uiUromGUID; + case DATA_EREGOS: + return uiEregosGUID; + case DATA_DCD_1: + case DATA_DCD_2: + case DATA_DCD_3: + return DragonCageDoorGUID[identifier-100]; + } - return 0; - } + return 0; + } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "T O " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << CentrifugeCount; + std::ostringstream saveStream; + saveStream << "T O " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << CentrifugeCount; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* in) - { - if( !in ) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if( !in ) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; + char dataHead1, dataHead2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2; - if( dataHead1 == 'T' && dataHead2 == 'O' ) - { - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> CentrifugeCount; + if( dataHead1 == 'T' && dataHead2 == 'O' ) + { + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> CentrifugeCount; - for( uint8 i=0; iGetVehicleBase() ) - if( drake->GetEntry() == NPC_AMBER_DRAKE ) - return true; - break; - case CRITERIA_EXPERIENCED_EMERALD: - if( source ) - if( Unit* drake = source->GetVehicleBase() ) - if( drake->GetEntry() == NPC_EMERALD_DRAKE ) - return true; - break; - case CRITERIA_EXPERIENCED_RUBY: - if( source ) - if( Unit* drake = source->GetVehicleBase() ) - if( drake->GetEntry() == NPC_RUBY_DRAKE ) - return true; - break; - case CRITERIA_AMBER_VOID: - return bAmberVoid; - case CRITERIA_EMERALD_VOID: - return bEmeraldVoid; - case CRITERIA_RUBY_VOID: - return bRubyVoid; - } - return false; - } - }; + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case CRITERIA_EXPERIENCED_AMBER: + if( source ) + if( Unit* drake = source->GetVehicleBase() ) + if( drake->GetEntry() == NPC_AMBER_DRAKE ) + return true; + break; + case CRITERIA_EXPERIENCED_EMERALD: + if( source ) + if( Unit* drake = source->GetVehicleBase() ) + if( drake->GetEntry() == NPC_EMERALD_DRAKE ) + return true; + break; + case CRITERIA_EXPERIENCED_RUBY: + if( source ) + if( Unit* drake = source->GetVehicleBase() ) + if( drake->GetEntry() == NPC_RUBY_DRAKE ) + return true; + break; + case CRITERIA_AMBER_VOID: + return bAmberVoid; + case CRITERIA_EMERALD_VOID: + return bEmeraldVoid; + case CRITERIA_RUBY_VOID: + return bRubyVoid; + } + return false; + } + }; }; void AddSC_instance_oculus() { - new instance_oculus(); + new instance_oculus(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index ffe290521..1de6b7525 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -13,25 +13,25 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum DrakeGiverTexts { - GOSSIP_TEXTID_DRAKES = 13267, - GOSSIP_TEXTID_BELGARISTRASZ1 = 12916, - GOSSIP_TEXTID_BELGARISTRASZ2 = 13466, - GOSSIP_TEXTID_BELGARISTRASZ3 = 13254, - GOSSIP_TEXTID_VERDISA1 = 1, - GOSSIP_TEXTID_VERDISA2 = 1, - GOSSIP_TEXTID_VERDISA3 = 1, - GOSSIP_TEXTID_ETERNOS1 = 1, - GOSSIP_TEXTID_ETERNOS2 = 1, - GOSSIP_TEXTID_ETERNOS3 = 13256, + GOSSIP_TEXTID_DRAKES = 13267, + GOSSIP_TEXTID_BELGARISTRASZ1 = 12916, + GOSSIP_TEXTID_BELGARISTRASZ2 = 13466, + GOSSIP_TEXTID_BELGARISTRASZ3 = 13254, + GOSSIP_TEXTID_VERDISA1 = 1, + GOSSIP_TEXTID_VERDISA2 = 1, + GOSSIP_TEXTID_VERDISA3 = 1, + GOSSIP_TEXTID_ETERNOS1 = 1, + GOSSIP_TEXTID_ETERNOS2 = 1, + GOSSIP_TEXTID_ETERNOS3 = 13256, }; -#define GOSSIP_ITEM_DRAKES "So where do we go from here?" -#define GOSSIP_ITEM_BELGARISTRASZ1 "I want to fly on the wings of the Red Flight" -#define GOSSIP_ITEM_BELGARISTRASZ2 "What abilities do Ruby Drakes have?" -#define GOSSIP_ITEM_VERDISA1 "I want to fly on the wings of the Green Flight" -#define GOSSIP_ITEM_VERDISA2 "What abilities do Emerald Drakes have?" -#define GOSSIP_ITEM_ETERNOS1 "I want to fly on the wings of the Bronze Flight" -#define GOSSIP_ITEM_ETERNOS2 "What abilities do Amber Drakes have?" +#define GOSSIP_ITEM_DRAKES "So where do we go from here?" +#define GOSSIP_ITEM_BELGARISTRASZ1 "I want to fly on the wings of the Red Flight" +#define GOSSIP_ITEM_BELGARISTRASZ2 "What abilities do Ruby Drakes have?" +#define GOSSIP_ITEM_VERDISA1 "I want to fly on the wings of the Green Flight" +#define GOSSIP_ITEM_VERDISA2 "What abilities do Emerald Drakes have?" +#define GOSSIP_ITEM_ETERNOS1 "I want to fly on the wings of the Bronze Flight" +#define GOSSIP_ITEM_ETERNOS2 "What abilities do Amber Drakes have?" #define HAS_ESSENCE(a) ((a)->HasItemCount(ITEM_EMERALD_ESSENCE) || (a)->HasItemCount(ITEM_AMBER_ESSENCE) || (a)->HasItemCount(ITEM_RUBY_ESSENCE)) @@ -41,125 +41,125 @@ class npc_oculus_drakegiver : public CreatureScript public: npc_oculus_drakegiver() : CreatureScript("npc_oculus_drakegiver") { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) - { - if( pCreature->IsQuestGiver() ) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if( pCreature->IsQuestGiver() ) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if( pCreature->GetInstanceScript()->GetData(DATA_DRAKOS) == DONE ) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DRAKES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DRAKES, pCreature->GetGUID()); - } + if( pCreature->GetInstanceScript()->GetData(DATA_DRAKOS) == DONE ) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DRAKES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DRAKES, pCreature->GetGUID()); + } - return true; - } + return true; + } - bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) - { - pPlayer->PlayerTalkClass->GetGossipMenu().ClearMenu(); - switch(pCreature->GetEntry()) - { - case NPC_VERDISA: - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(pPlayer)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA1, pCreature->GetGUID()); - } - else - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA2, pCreature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_EMERALD_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, ITEM_EMERALD_ESSENCE, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - if (!HAS_ESSENCE(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA3, pCreature->GetGUID()); - break; - } - break; - case NPC_BELGARISTRASZ: - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(pPlayer)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ1, pCreature->GetGUID()); - } - else - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ2, pCreature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_RUBY_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, ITEM_RUBY_ESSENCE, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - if (!HAS_ESSENCE(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ3, pCreature->GetGUID()); - break; - } - break; - case NPC_ETERNOS: - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(pPlayer)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS1, pCreature->GetGUID()); - } - else - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS2, pCreature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_AMBER_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, ITEM_AMBER_ESSENCE, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - if (!HAS_ESSENCE(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS3, pCreature->GetGUID()); - break; - } - break; - } + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + pPlayer->PlayerTalkClass->GetGossipMenu().ClearMenu(); + switch(pCreature->GetEntry()) + { + case NPC_VERDISA: + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(pPlayer)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA1, pCreature->GetGUID()); + } + else + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA2, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_EMERALD_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, ITEM_EMERALD_ESSENCE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + if (!HAS_ESSENCE(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA3, pCreature->GetGUID()); + break; + } + break; + case NPC_BELGARISTRASZ: + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(pPlayer)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ1, pCreature->GetGUID()); + } + else + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ2, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_RUBY_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, ITEM_RUBY_ESSENCE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + if (!HAS_ESSENCE(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ3, pCreature->GetGUID()); + break; + } + break; + case NPC_ETERNOS: + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(pPlayer)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS1, pCreature->GetGUID()); + } + else + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS2, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_AMBER_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, ITEM_AMBER_ESSENCE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + if (!HAS_ESSENCE(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS3, pCreature->GetGUID()); + break; + } + break; + } - return true; - } + return true; + } }; class npc_oculus_drake : public CreatureScript @@ -172,139 +172,139 @@ public: return new npc_oculus_drakeAI (pCreature); } - struct npc_oculus_drakeAI : public VehicleAI - { - npc_oculus_drakeAI(Creature *pCreature) : VehicleAI(pCreature) - { - m_pInstance = me->GetInstanceScript(); - JustSummoned = true; - } + struct npc_oculus_drakeAI : public VehicleAI + { + npc_oculus_drakeAI(Creature *pCreature) : VehicleAI(pCreature) + { + m_pInstance = me->GetInstanceScript(); + JustSummoned = true; + } - InstanceScript* m_pInstance; - bool JustSummoned; - uint16 despawnTimer; + InstanceScript* m_pInstance; + bool JustSummoned; + uint16 despawnTimer; - void PassengerBoarded(Unit* who, int8 seatid, bool add) - { - if (add) - { - me->SetDisableGravity(false); - me->SendMovementFlagUpdate(); - despawnTimer = 0; - } - else - { - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->DisappearAndDie(); - me->DespawnOrUnsummon(1); - } - } + void PassengerBoarded(Unit* who, int8 seatid, bool add) + { + if (add) + { + me->SetDisableGravity(false); + me->SendMovementFlagUpdate(); + despawnTimer = 0; + } + else + { + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + me->DisappearAndDie(); + me->DespawnOrUnsummon(1); + } + } - void JustDied(Unit* killer) - { - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->DisappearAndDie(); - me->DespawnOrUnsummon(1); - } + void JustDied(Unit* killer) + { + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + me->DisappearAndDie(); + me->DespawnOrUnsummon(1); + } - void SpellHitTarget(Unit* target, SpellInfo const* spell) - { - for( uint8 i = 0; i < 8; ++i ) - if( me->m_spells[i] == spell->Id ) - { - if( target && target->IsAlive() && !target->CanFly() && target->IsHostileTo(me) && !spell->IsTargetingArea()) - { - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - if( Unit* charmer = me->GetCharmer() ) - Unit::Kill(charmer, charmer, false); - me->DisappearAndDie(); - me->DespawnOrUnsummon(1); - } - break; - } - } + void SpellHitTarget(Unit* target, SpellInfo const* spell) + { + for( uint8 i = 0; i < 8; ++i ) + if( me->m_spells[i] == spell->Id ) + { + if( target && target->IsAlive() && !target->CanFly() && target->IsHostileTo(me) && !spell->IsTargetingArea()) + { + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + if( Unit* charmer = me->GetCharmer() ) + Unit::Kill(charmer, charmer, false); + me->DisappearAndDie(); + me->DespawnOrUnsummon(1); + } + break; + } + } - void UpdateAI(uint32 diff) - { - if( JustSummoned ) - { - despawnTimer = 1; - JustSummoned = false; - if( m_pInstance ) - { - if( !m_pInstance->IsEncounterInProgress() || m_pInstance->GetData(DATA_EREGOS)==IN_PROGRESS ) - { - if( me->GetVehicleKit() && me->IsSummon() ) - if( !me->GetVehicleKit()->GetPassenger(0) ) - { - TempSummon* ts = (TempSummon*)me; - if( Unit* summoner = ts->GetSummoner() ) - { - if( m_pInstance->GetData(DATA_UROM) == DONE ) - { - switch( me->GetEntry() ) - { - case 27692: - me->m_spells[5] = 50344; - break; - case 27755: - me->m_spells[5] = 49592; - break; - case 27756: - me->m_spells[5] = 50253; - break; - } - } + void UpdateAI(uint32 diff) + { + if( JustSummoned ) + { + despawnTimer = 1; + JustSummoned = false; + if( m_pInstance ) + { + if( !m_pInstance->IsEncounterInProgress() || m_pInstance->GetData(DATA_EREGOS)==IN_PROGRESS ) + { + if( me->GetVehicleKit() && me->IsSummon() ) + if( !me->GetVehicleKit()->GetPassenger(0) ) + { + TempSummon* ts = (TempSummon*)me; + if( Unit* summoner = ts->GetSummoner() ) + { + if( m_pInstance->GetData(DATA_UROM) == DONE ) + { + switch( me->GetEntry() ) + { + case 27692: + me->m_spells[5] = 50344; + break; + case 27755: + me->m_spells[5] = 49592; + break; + case 27756: + me->m_spells[5] = 50253; + break; + } + } - uint32 spell = 0; - switch (me->GetEntry()) - { - case 27692: spell = 49427; break; - case 27755: spell = 49459; break; - case 27756: spell = 49463; break; - } + uint32 spell = 0; + switch (me->GetEntry()) + { + case 27692: spell = 49427; break; + case 27755: spell = 49459; break; + case 27756: spell = 49463; break; + } - //summoner->EnterVehicle(me); - if (spell) - me->CastSpell(summoner, spell, true); - me->SetCanFly(true); - me->SetSpeed(MOVE_FLIGHT, me->GetSpeedRate(MOVE_RUN), true); - } - } - } - else - { - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->DisappearAndDie(); - me->DespawnOrUnsummon(1); - return; - } - } - } + //summoner->EnterVehicle(me); + if (spell) + me->CastSpell(summoner, spell, true); + me->SetCanFly(true); + me->SetSpeed(MOVE_FLIGHT, me->GetSpeedRate(MOVE_RUN), true); + } + } + } + else + { + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + me->DisappearAndDie(); + me->DespawnOrUnsummon(1); + return; + } + } + } - if (despawnTimer) - { - if (despawnTimer >= 5000) - { - despawnTimer = 0; - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->DisappearAndDie(); - me->DespawnOrUnsummon(1); - return; - } - else - despawnTimer += diff; - } + if (despawnTimer) + { + if (despawnTimer >= 5000) + { + despawnTimer = 0; + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + me->DisappearAndDie(); + me->DespawnOrUnsummon(1); + return; + } + else + despawnTimer += diff; + } - VehicleAI::UpdateAI(diff); - } - }; + VehicleAI::UpdateAI(diff); + } + }; }; enum oculusSpells { - SPELL_AMBER_SHOCK_CHARGE = 49836, - SPELL_RUBY_EVASIVE_CHARGES = 50241, + SPELL_AMBER_SHOCK_CHARGE = 49836, + SPELL_RUBY_EVASIVE_CHARGES = 50241, }; // 49838 - Stop Time @@ -405,9 +405,9 @@ class spell_oculus_shock_lance : public SpellScriptLoader { int32 damage = GetHitDamage(); if (Unit* target = GetHitUnit()) - if (Aura* aura = target->GetAura(SPELL_AMBER_SHOCK_CHARGE, GetCaster()->GetGUID())) // shock charges from same caster + if (Aura* aura = target->GetAura(SPELL_AMBER_SHOCK_CHARGE, GetCaster()->GetGUID())) // shock charges from same caster { - damage += aura->GetStackAmount()*6525; + damage += aura->GetStackAmount()*6525; aura->Remove(); } @@ -446,15 +446,15 @@ class spell_oculus_temporal_rift : public SpellScriptLoader void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - int32 amount = aurEff->GetAmount() + eventInfo.GetDamageInfo()->GetDamage(); + int32 amount = aurEff->GetAmount() + eventInfo.GetDamageInfo()->GetDamage(); - uint8 num = amount/15000; - if (amount >= 15000) - { - if (Unit* caster = GetCaster()) - for (uint8 i =0; i < num; ++i ) - caster->CastSpell(GetTarget(), SPELL_AMBER_SHOCK_CHARGE, true); - } + uint8 num = amount/15000; + if (amount >= 15000) + { + if (Unit* caster = GetCaster()) + for (uint8 i =0; i < num; ++i ) + caster->CastSpell(GetTarget(), SPELL_AMBER_SHOCK_CHARGE, true); + } const_cast(aurEff)->SetAmount(amount - 15000*num); } @@ -589,15 +589,15 @@ class spell_oculus_ride_ruby_emerald_amber_drake_que : public SpellScriptLoader void AddSC_oculus() { - new npc_oculus_drakegiver(); - new npc_oculus_drake(); + new npc_oculus_drakegiver(); + new npc_oculus_drake(); - new spell_oculus_stop_time(); - new spell_oculus_evasive_maneuvers(); - new spell_oculus_shock_lance(); - new spell_oculus_temporal_rift(); - new spell_oculus_touch_the_nightmare(); - new spell_oculus_dream_funnel(); - new spell_oculus_call_ruby_emerald_amber_drake(); - new spell_oculus_ride_ruby_emerald_amber_drake_que(); + new spell_oculus_stop_time(); + new spell_oculus_evasive_maneuvers(); + new spell_oculus_shock_lance(); + new spell_oculus_temporal_rift(); + new spell_oculus_touch_the_nightmare(); + new spell_oculus_dream_funnel(); + new spell_oculus_call_ruby_emerald_amber_drake(); + new spell_oculus_ride_ruby_emerald_amber_drake_que(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h index 9e3ec0202..76812607e 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h @@ -7,71 +7,71 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Data { - DATA_DRAKOS, // Drakos the Interrogator - DATA_VAROS, // Varos Cloudstrider - DATA_UROM, // Mage-Lord Urom - DATA_EREGOS, // Ley-Guardian Eregos - MAX_ENCOUNTER, - DATA_CC_COUNT, - DATA_AMBER_VOID, - DATA_EMERALD_VOID, - DATA_RUBY_VOID, - DATA_DCD_1 = 100, - DATA_DCD_2 = 101, - DATA_DCD_3 = 102, + DATA_DRAKOS, // Drakos the Interrogator + DATA_VAROS, // Varos Cloudstrider + DATA_UROM, // Mage-Lord Urom + DATA_EREGOS, // Ley-Guardian Eregos + MAX_ENCOUNTER, + DATA_CC_COUNT, + DATA_AMBER_VOID, + DATA_EMERALD_VOID, + DATA_RUBY_VOID, + DATA_DCD_1 = 100, + DATA_DCD_2 = 101, + DATA_DCD_3 = 102, }; enum NPCs { - NPC_DRAKOS = 27654, - NPC_VAROS = 27447, - NPC_UROM = 27655, - NPC_EREGOS = 27656, + NPC_DRAKOS = 27654, + NPC_VAROS = 27447, + NPC_UROM = 27655, + NPC_EREGOS = 27656, - NPC_VERDISA = 27657, - NPC_BELGARISTRASZ = 27658, - NPC_ETERNOS = 27659, + NPC_VERDISA = 27657, + NPC_BELGARISTRASZ = 27658, + NPC_ETERNOS = 27659, - NPC_AMBER_DRAKE = 27755, - NPC_EMERALD_DRAKE = 27692, - NPC_RUBY_DRAKE = 27756, + NPC_AMBER_DRAKE = 27755, + NPC_EMERALD_DRAKE = 27692, + NPC_RUBY_DRAKE = 27756, - NPC_CENTRIFUGE_CONSTRUCT = 27641, + NPC_CENTRIFUGE_CONSTRUCT = 27641, - NPC_IMAGE_OF_BELGARISTRASZ = 28012, + NPC_IMAGE_OF_BELGARISTRASZ = 28012, }; enum Items { - ITEM_EMERALD_ESSENCE = 37815, - ITEM_AMBER_ESSENCE = 37859, - ITEM_RUBY_ESSENCE = 37860, + ITEM_EMERALD_ESSENCE = 37815, + ITEM_AMBER_ESSENCE = 37859, + ITEM_RUBY_ESSENCE = 37860, }; enum GOs { - GO_DRAGON_CAGE = 189986, - GO_DRAGON_CAGE_DOOR = 193995, - GO_CACHE_OF_EREGOS = 191349, - GO_CACHE_OF_EREGOS_HERO = 193603, - GO_SPOTLIGHT = 191351, + GO_DRAGON_CAGE = 189986, + GO_DRAGON_CAGE_DOOR = 193995, + GO_CACHE_OF_EREGOS = 191349, + GO_CACHE_OF_EREGOS_HERO = 193603, + GO_SPOTLIGHT = 191351, }; enum AchievData { - ACHIEV_MAKE_IT_COUNT_TIMED_EVENT = 18153, - CRITERIA_EXPERIENCED_AMBER = 7177, - CRITERIA_EXPERIENCED_EMERALD = 7178, - CRITERIA_EXPERIENCED_RUBY = 7179, - CRITERIA_AMBER_VOID = 7325, - CRITERIA_EMERALD_VOID = 7324, - CRITERIA_RUBY_VOID = 7323, + ACHIEV_MAKE_IT_COUNT_TIMED_EVENT = 18153, + CRITERIA_EXPERIENCED_AMBER = 7177, + CRITERIA_EXPERIENCED_EMERALD = 7178, + CRITERIA_EXPERIENCED_RUBY = 7179, + CRITERIA_AMBER_VOID = 7325, + CRITERIA_EMERALD_VOID = 7324, + CRITERIA_RUBY_VOID = 7323, }; enum OculusWorldStates { - WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW = 3524, - WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT = 3486 + WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW = 3524, + WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT = 3486 }; #endif diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp index ee6721d76..73fec131e 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp @@ -9,75 +9,75 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum BjarngrimSpells { - // DEFENSIVE STANCE - SPELL_DEFENSIVE_STANCE = 53790, - SPELL_DEFENSIVE_AURA = 41105, - SPELL_BJARNGRIM_REFLETION = 36096, - SPELL_PUMMEL = 12555, - SPELL_KNOCK_AWAY = 52029, - SPELL_IRONFORM = 52022, + // DEFENSIVE STANCE + SPELL_DEFENSIVE_STANCE = 53790, + SPELL_DEFENSIVE_AURA = 41105, + SPELL_BJARNGRIM_REFLETION = 36096, + SPELL_PUMMEL = 12555, + SPELL_KNOCK_AWAY = 52029, + SPELL_IRONFORM = 52022, - // BERSERKER STANCE - SPELL_BERSERKER_STANCE = 53791, - SPELL_BERSERKER_AURA = 41107, - SPELL_MORTAL_STRIKE = 16856, - SPELL_WHIRLWIND = 52027, - - // BATTLE STANCE - SPELL_BATTLE_STANCE = 53792, - SPELL_BATTLE_AURA = 41106, - SPELL_INTERCEPT = 58769, - SPELL_CLEAVE = 15284, - SPELL_SLAM = 52026, + // BERSERKER STANCE + SPELL_BERSERKER_STANCE = 53791, + SPELL_BERSERKER_AURA = 41107, + SPELL_MORTAL_STRIKE = 16856, + SPELL_WHIRLWIND = 52027, + + // BATTLE STANCE + SPELL_BATTLE_STANCE = 53792, + SPELL_BATTLE_AURA = 41106, + SPELL_INTERCEPT = 58769, + SPELL_CLEAVE = 15284, + SPELL_SLAM = 52026, - //OTHER SPELLS - SPELL_CHARGE_UP = 52098, // only used when starting walk from one platform to the other - SPELL_TEMPORARY_ELECTRICAL_CHARGE = 52092, // triggered part of above + //OTHER SPELLS + SPELL_CHARGE_UP = 52098, // only used when starting walk from one platform to the other + SPELL_TEMPORARY_ELECTRICAL_CHARGE = 52092, // triggered part of above - // STORMFORGED LIEUTENANT - SPELL_ARC_WELD = 59085, - SPELL_RENEW_STEEL_N = 52774, - SPELL_RENEW_STEEL_H = 59160, + // STORMFORGED LIEUTENANT + SPELL_ARC_WELD = 59085, + SPELL_RENEW_STEEL_N = 52774, + SPELL_RENEW_STEEL_H = 59160, }; enum BjarngrimOther { - // Stances - STANCE_DEFENSIVE = 1, - STANCE_BERSERKER = 2, - STANCE_BATTLE = 3, + // Stances + STANCE_DEFENSIVE = 1, + STANCE_BERSERKER = 2, + STANCE_BATTLE = 3, - // NPCs - NPC_STORMFORGED_LIEUTENANT = 29240, + // NPCs + NPC_STORMFORGED_LIEUTENANT = 29240, - // Models - EQUIP_SWORD = 37871, - EQUIP_SHIELD = 35642, - EQUIP_MACE = 43623, + // Models + EQUIP_SWORD = 37871, + EQUIP_SHIELD = 35642, + EQUIP_MACE = 43623, }; enum BjarngrimEvents { - EVENT_BJARNGRIM_CHANGE_STANCE = 1, + EVENT_BJARNGRIM_CHANGE_STANCE = 1, - // DEFENSIVE STANCE - EVENT_BJARNGRIM_REFLECTION = 11, - EVENT_BJARNGRIM_PUMMEL = 12, - EVENT_BJARNGRIM_KNOCK = 13, - EVENT_BJARNGRIM_IRONFORM = 14, + // DEFENSIVE STANCE + EVENT_BJARNGRIM_REFLECTION = 11, + EVENT_BJARNGRIM_PUMMEL = 12, + EVENT_BJARNGRIM_KNOCK = 13, + EVENT_BJARNGRIM_IRONFORM = 14, - // BERSERKER STANCE - EVENT_BJARNGRIM_MORTAL_STRIKE = 21, - EVENT_BJARNGRIM_WHIRLWIND = 22, + // BERSERKER STANCE + EVENT_BJARNGRIM_MORTAL_STRIKE = 21, + EVENT_BJARNGRIM_WHIRLWIND = 22, - // BATTLE STANCE - EVENT_BJARNGRIM_INTERCEPT = 31, - EVENT_BJARNGRIM_CLEAVE = 32, - EVENT_BJARNGRIM_SLAM = 33, + // BATTLE STANCE + EVENT_BJARNGRIM_INTERCEPT = 31, + EVENT_BJARNGRIM_CLEAVE = 32, + EVENT_BJARNGRIM_SLAM = 33, - // STORMFORGED LIEUTENANT - EVENT_ARC_WELD = 41, - EVENT_RENEW_STEEL = 42, + // STORMFORGED LIEUTENANT + EVENT_ARC_WELD = 41, + EVENT_RENEW_STEEL = 42, }; enum Yells @@ -103,258 +103,258 @@ public: return new boss_bjarngrimAI (creature); } - struct boss_bjarngrimAI : public npc_escortAI - { - boss_bjarngrimAI(Creature* creature) : npc_escortAI(creature), summons(creature) - { - m_pInstance = creature->GetInstanceScript(); + struct boss_bjarngrimAI : public npc_escortAI + { + boss_bjarngrimAI(Creature* creature) : npc_escortAI(creature), summons(creature) + { + m_pInstance = creature->GetInstanceScript(); - // Init waypoints - AddWaypoint(1, 1262.18f, 99.3f, 33.5f, 0); - AddWaypoint(2, 1281.6f, 99.5f, 33.5f, 0); - AddWaypoint(3, 1311.7f, 99.4f, 40.1f, 0); - AddWaypoint(4, 1332.5f, 99.7f, 40.18f, 0); - AddWaypoint(5, 1311.7f, 99.4f, 40.1f, 0); - AddWaypoint(6, 1281.6f, 99.5f, 33.5f, 0); - AddWaypoint(7, 1262.18f, 99.3f, 33.5f, 0); - AddWaypoint(8, 1262, -26.9f, 33.5f, 0); - AddWaypoint(9, 1281.2f, -26.8f, 33.5f, 0); - AddWaypoint(10, 1311.3f, -26.9f, 40.03f, 0); - AddWaypoint(11, 1332, -26.6f, 40.18f, 0); - AddWaypoint(12, 1311.3f, -26.9f, 40.03f, 0); - AddWaypoint(13, 1281.2f, -26.8f, 33.5f, 0); - AddWaypoint(14, 1262, -26.9f, 33.5f, 0); - - Start(true, false, 0, NULL, false, true); - } + // Init waypoints + AddWaypoint(1, 1262.18f, 99.3f, 33.5f, 0); + AddWaypoint(2, 1281.6f, 99.5f, 33.5f, 0); + AddWaypoint(3, 1311.7f, 99.4f, 40.1f, 0); + AddWaypoint(4, 1332.5f, 99.7f, 40.18f, 0); + AddWaypoint(5, 1311.7f, 99.4f, 40.1f, 0); + AddWaypoint(6, 1281.6f, 99.5f, 33.5f, 0); + AddWaypoint(7, 1262.18f, 99.3f, 33.5f, 0); + AddWaypoint(8, 1262, -26.9f, 33.5f, 0); + AddWaypoint(9, 1281.2f, -26.8f, 33.5f, 0); + AddWaypoint(10, 1311.3f, -26.9f, 40.03f, 0); + AddWaypoint(11, 1332, -26.6f, 40.18f, 0); + AddWaypoint(12, 1311.3f, -26.9f, 40.03f, 0); + AddWaypoint(13, 1281.2f, -26.8f, 33.5f, 0); + AddWaypoint(14, 1262, -26.9f, 33.5f, 0); + + Start(true, false, 0, NULL, false, true); + } - InstanceScript* m_pInstance; - EventMap events; - SummonList summons; - uint8 m_uiStance; + InstanceScript* m_pInstance; + EventMap events; + SummonList summons; + uint8 m_uiStance; - void Reset() - { - events.Reset(); - summons.DespawnAll(); + void Reset() + { + events.Reset(); + summons.DespawnAll(); - for (uint8 i = 0; i < 2; ++i) - if (Creature* dwarf = me->SummonCreature(NPC_STORMFORGED_LIEUTENANT, me->GetPositionX()+urand(4,12), me->GetPositionY()+urand(4,12), me->GetPositionZ())) - { - dwarf->GetMotionMaster()->MoveFollow(me, 3, rand_norm()*2*3.14f); - summons.Summon(dwarf); - } + for (uint8 i = 0; i < 2; ++i) + if (Creature* dwarf = me->SummonCreature(NPC_STORMFORGED_LIEUTENANT, me->GetPositionX()+urand(4,12), me->GetPositionY()+urand(4,12), me->GetPositionZ())) + { + dwarf->GetMotionMaster()->MoveFollow(me, 3, rand_norm()*2*3.14f); + summons.Summon(dwarf); + } - me->RemoveAllAuras(); - me->CastSpell(me, SPELL_TEMPORARY_ELECTRICAL_CHARGE, true); - RollStance(0, STANCE_DEFENSIVE); + me->RemoveAllAuras(); + me->CastSpell(me, SPELL_TEMPORARY_ELECTRICAL_CHARGE, true); + RollStance(0, STANCE_DEFENSIVE); - if (m_pInstance) - m_pInstance->SetData(TYPE_BJARNGRIM, NOT_STARTED); - } + if (m_pInstance) + m_pInstance->SetData(TYPE_BJARNGRIM, NOT_STARTED); + } - void EnterCombat(Unit*) - { - me->SetInCombatWithZone(); - Talk(SAY_AGGRO); + void EnterCombat(Unit*) + { + me->SetInCombatWithZone(); + Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_BJARNGRIM_CHANGE_STANCE, 20000, 0); + events.ScheduleEvent(EVENT_BJARNGRIM_CHANGE_STANCE, 20000, 0); - // DEFENSIVE STANCE - events.ScheduleEvent(EVENT_BJARNGRIM_REFLECTION, 8000, STANCE_DEFENSIVE); - events.ScheduleEvent(EVENT_BJARNGRIM_PUMMEL, 5000, STANCE_DEFENSIVE); - events.ScheduleEvent(EVENT_BJARNGRIM_KNOCK, 16000, STANCE_DEFENSIVE); - events.ScheduleEvent(EVENT_BJARNGRIM_IRONFORM, 12000, STANCE_DEFENSIVE); + // DEFENSIVE STANCE + events.ScheduleEvent(EVENT_BJARNGRIM_REFLECTION, 8000, STANCE_DEFENSIVE); + events.ScheduleEvent(EVENT_BJARNGRIM_PUMMEL, 5000, STANCE_DEFENSIVE); + events.ScheduleEvent(EVENT_BJARNGRIM_KNOCK, 16000, STANCE_DEFENSIVE); + events.ScheduleEvent(EVENT_BJARNGRIM_IRONFORM, 12000, STANCE_DEFENSIVE); - // BERSERKER STANCE - events.ScheduleEvent(EVENT_BJARNGRIM_MORTAL_STRIKE, 20000+4000, STANCE_BERSERKER); - events.ScheduleEvent(EVENT_BJARNGRIM_WHIRLWIND, 20000+6000, STANCE_BERSERKER); + // BERSERKER STANCE + events.ScheduleEvent(EVENT_BJARNGRIM_MORTAL_STRIKE, 20000+4000, STANCE_BERSERKER); + events.ScheduleEvent(EVENT_BJARNGRIM_WHIRLWIND, 20000+6000, STANCE_BERSERKER); - // BATTLE STANCE - events.ScheduleEvent(EVENT_BJARNGRIM_INTERCEPT, 20000+3000, STANCE_BATTLE); - events.ScheduleEvent(EVENT_BJARNGRIM_CLEAVE, 20000+5000, STANCE_BATTLE); - events.ScheduleEvent(EVENT_BJARNGRIM_SLAM, 20000+10000, STANCE_BATTLE); + // BATTLE STANCE + events.ScheduleEvent(EVENT_BJARNGRIM_INTERCEPT, 20000+3000, STANCE_BATTLE); + events.ScheduleEvent(EVENT_BJARNGRIM_CLEAVE, 20000+5000, STANCE_BATTLE); + events.ScheduleEvent(EVENT_BJARNGRIM_SLAM, 20000+10000, STANCE_BATTLE); - if (m_pInstance) - { - m_pInstance->SetData(TYPE_BJARNGRIM, IN_PROGRESS); - m_pInstance->SetData(DATA_BJARNGRIM_ACHIEVEMENT, me->HasAura(SPELL_TEMPORARY_ELECTRICAL_CHARGE)); - } - } + if (m_pInstance) + { + m_pInstance->SetData(TYPE_BJARNGRIM, IN_PROGRESS); + m_pInstance->SetData(DATA_BJARNGRIM_ACHIEVEMENT, me->HasAura(SPELL_TEMPORARY_ELECTRICAL_CHARGE)); + } + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; - Talk(SAY_SLAY); - } + Talk(SAY_SLAY); + } - void JustDied(Unit*) - { - Talk(SAY_DEATH); + void JustDied(Unit*) + { + Talk(SAY_DEATH); - if (m_pInstance) - m_pInstance->SetData(TYPE_BJARNGRIM, DONE); - } + if (m_pInstance) + m_pInstance->SetData(TYPE_BJARNGRIM, DONE); + } - void RemoveStanceAura(uint8 stance) - { - switch (stance) - { - case STANCE_DEFENSIVE: - me->RemoveAura(SPELL_DEFENSIVE_STANCE); - me->RemoveAura(SPELL_DEFENSIVE_AURA); - break; - case STANCE_BERSERKER: - me->RemoveAura(SPELL_BERSERKER_STANCE); - me->RemoveAura(SPELL_BERSERKER_AURA); - break; - case STANCE_BATTLE: - me->RemoveAura(SPELL_BATTLE_STANCE); - me->RemoveAura(SPELL_BATTLE_AURA); - break; - } - } + void RemoveStanceAura(uint8 stance) + { + switch (stance) + { + case STANCE_DEFENSIVE: + me->RemoveAura(SPELL_DEFENSIVE_STANCE); + me->RemoveAura(SPELL_DEFENSIVE_AURA); + break; + case STANCE_BERSERKER: + me->RemoveAura(SPELL_BERSERKER_STANCE); + me->RemoveAura(SPELL_BERSERKER_AURA); + break; + case STANCE_BATTLE: + me->RemoveAura(SPELL_BATTLE_STANCE); + me->RemoveAura(SPELL_BATTLE_AURA); + break; + } + } - void RollStance(uint8 stance, uint8 force = 0) - { - if (urand(0,1)) - stance = (++stance == 4 ? 1 : stance); - else - stance = (--stance == 0 ? 3 : stance); + void RollStance(uint8 stance, uint8 force = 0) + { + if (urand(0,1)) + stance = (++stance == 4 ? 1 : stance); + else + stance = (--stance == 0 ? 3 : stance); - if (force) - stance = force; - - switch (stance) - { - case STANCE_DEFENSIVE: - Talk(SAY_DEFENSIVE_STANCE); + if (force) + stance = force; + + switch (stance) + { + case STANCE_DEFENSIVE: + Talk(SAY_DEFENSIVE_STANCE); - me->CastSpell(me, SPELL_DEFENSIVE_STANCE, true); - me->CastSpell(me, SPELL_DEFENSIVE_AURA, true); + me->CastSpell(me, SPELL_DEFENSIVE_STANCE, true); + me->CastSpell(me, SPELL_DEFENSIVE_AURA, true); - events.DelayEvents(20000, STANCE_BERSERKER); - events.DelayEvents(20000, STANCE_BATTLE); + events.DelayEvents(20000, STANCE_BERSERKER); + events.DelayEvents(20000, STANCE_BATTLE); - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); - break; - case STANCE_BERSERKER: - Talk(SAY_BERSERKER_STANCE); + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); + break; + case STANCE_BERSERKER: + Talk(SAY_BERSERKER_STANCE); - me->CastSpell(me, SPELL_BERSERKER_STANCE, true); - me->CastSpell(me, SPELL_BERSERKER_AURA, true); + me->CastSpell(me, SPELL_BERSERKER_STANCE, true); + me->CastSpell(me, SPELL_BERSERKER_AURA, true); - events.DelayEvents(20000, STANCE_DEFENSIVE); - events.DelayEvents(20000, STANCE_BATTLE); + events.DelayEvents(20000, STANCE_DEFENSIVE); + events.DelayEvents(20000, STANCE_BATTLE); - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); - break; - case STANCE_BATTLE: - Talk(SAY_BATTLE_STANCE); + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); + break; + case STANCE_BATTLE: + Talk(SAY_BATTLE_STANCE); - me->CastSpell(me, SPELL_BATTLE_STANCE, true); - me->CastSpell(me, SPELL_BATTLE_AURA, true); + me->CastSpell(me, SPELL_BATTLE_STANCE, true); + me->CastSpell(me, SPELL_BATTLE_AURA, true); - events.DelayEvents(20000, STANCE_BERSERKER); - events.DelayEvents(20000, STANCE_DEFENSIVE); + events.DelayEvents(20000, STANCE_BERSERKER); + events.DelayEvents(20000, STANCE_DEFENSIVE); - SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - break; - } + SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + break; + } - m_uiStance = stance; - } + m_uiStance = stance; + } - void WaypointReached(uint32 Point) - { - if (Point == 1 || Point == 8) - me->CastSpell(me, SPELL_TEMPORARY_ELECTRICAL_CHARGE, true); - else if (Point == 7 || Point == 14) - me->RemoveAura(SPELL_TEMPORARY_ELECTRICAL_CHARGE); - } + void WaypointReached(uint32 Point) + { + if (Point == 1 || Point == 8) + me->CastSpell(me, SPELL_TEMPORARY_ELECTRICAL_CHARGE, true); + else if (Point == 7 || Point == 14) + me->RemoveAura(SPELL_TEMPORARY_ELECTRICAL_CHARGE); + } - void UpdateEscortAI(uint32 diff) - { - if (!me->IsInCombat()) - return; + void UpdateEscortAI(uint32 diff) + { + if (!me->IsInCombat()) + return; - // Return since we have no target - if (!UpdateVictim()) - { - Reset(); - return; - } + // Return since we have no target + if (!UpdateVictim()) + { + Reset(); + return; + } - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_BJARNGRIM_CHANGE_STANCE: - // roll new stance - RemoveStanceAura(m_uiStance); - RollStance(m_uiStance); - events.RepeatEvent(20000); - break; + switch (events.GetEvent()) + { + case EVENT_BJARNGRIM_CHANGE_STANCE: + // roll new stance + RemoveStanceAura(m_uiStance); + RollStance(m_uiStance); + events.RepeatEvent(20000); + break; - /////////////////////////////////////////////////////// - ///// DEFENSIVE STANCE - /////////////////////////////////////////////////////// - case EVENT_BJARNGRIM_REFLECTION: - me->CastSpell(me, SPELL_BJARNGRIM_REFLETION, true); - events.RepeatEvent(8000 + rand()%1000); - break; - case EVENT_BJARNGRIM_PUMMEL: - me->CastSpell(me->GetVictim(), SPELL_PUMMEL, false); - events.RepeatEvent(10000 + rand()%1000); - break; - case EVENT_BJARNGRIM_KNOCK: - me->CastSpell(me, SPELL_KNOCK_AWAY, false); - events.RepeatEvent(20000 + rand()%1000); - break; - case EVENT_BJARNGRIM_IRONFORM: - me->CastSpell(me, SPELL_IRONFORM, true); - events.RepeatEvent(18000 + rand()%5000); - break; + /////////////////////////////////////////////////////// + ///// DEFENSIVE STANCE + /////////////////////////////////////////////////////// + case EVENT_BJARNGRIM_REFLECTION: + me->CastSpell(me, SPELL_BJARNGRIM_REFLETION, true); + events.RepeatEvent(8000 + rand()%1000); + break; + case EVENT_BJARNGRIM_PUMMEL: + me->CastSpell(me->GetVictim(), SPELL_PUMMEL, false); + events.RepeatEvent(10000 + rand()%1000); + break; + case EVENT_BJARNGRIM_KNOCK: + me->CastSpell(me, SPELL_KNOCK_AWAY, false); + events.RepeatEvent(20000 + rand()%1000); + break; + case EVENT_BJARNGRIM_IRONFORM: + me->CastSpell(me, SPELL_IRONFORM, true); + events.RepeatEvent(18000 + rand()%5000); + break; - /////////////////////////////////////////////////////// - ///// BERSERKER STANCE - /////////////////////////////////////////////////////// - case EVENT_BJARNGRIM_MORTAL_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); - events.RepeatEvent(10000); - break; - case EVENT_BJARNGRIM_WHIRLWIND: - me->CastSpell(me, SPELL_WHIRLWIND, true); - events.RepeatEvent(25000); - break; - - /////////////////////////////////////////////////////// - ///// BATTLE STANCE - /////////////////////////////////////////////////////// - case EVENT_BJARNGRIM_INTERCEPT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(target, SPELL_INTERCEPT, true); + /////////////////////////////////////////////////////// + ///// BERSERKER STANCE + /////////////////////////////////////////////////////// + case EVENT_BJARNGRIM_MORTAL_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); + events.RepeatEvent(10000); + break; + case EVENT_BJARNGRIM_WHIRLWIND: + me->CastSpell(me, SPELL_WHIRLWIND, true); + events.RepeatEvent(25000); + break; + + /////////////////////////////////////////////////////// + ///// BATTLE STANCE + /////////////////////////////////////////////////////// + case EVENT_BJARNGRIM_INTERCEPT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(target, SPELL_INTERCEPT, true); - events.RepeatEvent(30000); - break; - case EVENT_BJARNGRIM_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - events.RepeatEvent(25000); - break; - case EVENT_BJARNGRIM_SLAM: - me->CastSpell(me->GetVictim(), SPELL_SLAM, false); - events.RepeatEvent(10000 + rand()%2000); - break; - } + events.RepeatEvent(30000); + break; + case EVENT_BJARNGRIM_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + events.RepeatEvent(25000); + break; + case EVENT_BJARNGRIM_SLAM: + me->CastSpell(me->GetVictim(), SPELL_SLAM, false); + events.RepeatEvent(10000 + rand()%2000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_stormforged_lieutenant : public CreatureScript @@ -367,61 +367,61 @@ public: return new npc_stormforged_lieutenantAI (creature); } - struct npc_stormforged_lieutenantAI : public ScriptedAI - { - npc_stormforged_lieutenantAI(Creature* creature) : ScriptedAI(creature) { } + struct npc_stormforged_lieutenantAI : public ScriptedAI + { + npc_stormforged_lieutenantAI(Creature* creature) : ScriptedAI(creature) { } - EventMap events; - uint64 BjarngrimGUID; + EventMap events; + uint64 BjarngrimGUID; - void Reset() - { - if (me->IsSummon()) - BjarngrimGUID = me->ToTempSummon()->GetSummonerGUID(); - else - BjarngrimGUID = 0; - } + void Reset() + { + if (me->IsSummon()) + BjarngrimGUID = me->ToTempSummon()->GetSummonerGUID(); + else + BjarngrimGUID = 0; + } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_ARC_WELD, 2000); - events.ScheduleEvent(EVENT_RENEW_STEEL, 10000 + rand()%1000); - } + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_ARC_WELD, 2000); + events.ScheduleEvent(EVENT_RENEW_STEEL, 10000 + rand()%1000); + } - void UpdateAI(uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_ARC_WELD: - me->CastSpell(me->GetVictim(), SPELL_ARC_WELD, true); - events.RepeatEvent(20000); - break; - case EVENT_RENEW_STEEL: - if (Creature* bjarngrim = ObjectAccessor::GetCreature(*me, BjarngrimGUID)) - if (bjarngrim->IsAlive()) - me->CastSpell(bjarngrim, me->GetMap()->IsHeroic() ? SPELL_RENEW_STEEL_H : SPELL_RENEW_STEEL_N, true); + switch (events.GetEvent()) + { + case EVENT_ARC_WELD: + me->CastSpell(me->GetVictim(), SPELL_ARC_WELD, true); + events.RepeatEvent(20000); + break; + case EVENT_RENEW_STEEL: + if (Creature* bjarngrim = ObjectAccessor::GetCreature(*me, BjarngrimGUID)) + if (bjarngrim->IsAlive()) + me->CastSpell(bjarngrim, me->GetMap()->IsHeroic() ? SPELL_RENEW_STEEL_H : SPELL_RENEW_STEEL_N, true); - events.RepeatEvent(10000 + rand()%4000); - break; - } + events.RepeatEvent(10000 + rand()%4000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_bjarngrim() { - new boss_bjarngrim(); - new npc_stormforged_lieutenant(); + new boss_bjarngrim(); + new npc_stormforged_lieutenant(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp index d5fcbc72a..bd0eff7ba 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp @@ -10,29 +10,29 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum IonarSpells { - SPELL_BALL_LIGHTNING_N = 52780, - SPELL_BALL_LIGHTNING_H = 59800, - SPELL_STATIC_OVERLOAD_N = 52658, - SPELL_STATIC_OVERLOAD_H = 59795, + SPELL_BALL_LIGHTNING_N = 52780, + SPELL_BALL_LIGHTNING_H = 59800, + SPELL_STATIC_OVERLOAD_N = 52658, + SPELL_STATIC_OVERLOAD_H = 59795, - SPELL_DISPERSE = 52770, - SPELL_SUMMON_SPARK = 52746, - SPELL_SPARK_DESPAWN = 52776, + SPELL_DISPERSE = 52770, + SPELL_SUMMON_SPARK = 52746, + SPELL_SPARK_DESPAWN = 52776, - //Spark of Ionar - SPELL_SPARK_VISUAL_TRIGGER_N = 52667, - SPELL_SPARK_VISUAL_TRIGGER_H = 59833, - SPELL_RANDOM_LIGHTNING = 52663, + //Spark of Ionar + SPELL_SPARK_VISUAL_TRIGGER_N = 52667, + SPELL_SPARK_VISUAL_TRIGGER_H = 59833, + SPELL_RANDOM_LIGHTNING = 52663, }; enum IonarOther { - // NPCs - NPC_SPARK_OF_IONAR = 28926, + // NPCs + NPC_SPARK_OF_IONAR = 28926, - // Actions - ACTION_CALLBACK = 1, - ACTION_SPARK_DESPAWN = 2, + // Actions + ACTION_CALLBACK = 1, + ACTION_SPARK_DESPAWN = 2, }; enum Yells @@ -45,11 +45,11 @@ enum Yells enum IonarEvents { - EVENT_BALL_LIGHTNING = 1, - EVENT_STATIC_OVERLOAD = 2, - EVENT_CHECK_HEALTH = 3, - EVENT_CALL_SPARKS = 4, - EVENT_RESTORE = 5, + EVENT_BALL_LIGHTNING = 1, + EVENT_STATIC_OVERLOAD = 2, + EVENT_CHECK_HEALTH = 3, + EVENT_CALL_SPARKS = 4, + EVENT_RESTORE = 5, }; class boss_ionar : public CreatureScript @@ -62,157 +62,157 @@ public: return new boss_ionarAI (creature); } - struct boss_ionarAI : public ScriptedAI - { - boss_ionarAI(Creature* creature) : ScriptedAI(creature), summons(creature) - { - m_pInstance = creature->GetInstanceScript(); - } + struct boss_ionarAI : public ScriptedAI + { + boss_ionarAI(Creature* creature) : ScriptedAI(creature), summons(creature) + { + m_pInstance = creature->GetInstanceScript(); + } - InstanceScript* m_pInstance; - EventMap events; - SummonList summons; - uint8 HealthCheck; + InstanceScript* m_pInstance; + EventMap events; + SummonList summons; + uint8 HealthCheck; - void Reset() - { - HealthCheck = 50; - events.Reset(); - summons.DespawnAll(); + void Reset() + { + HealthCheck = 50; + events.Reset(); + summons.DespawnAll(); - me->SetVisible(true); + me->SetVisible(true); - if (m_pInstance) - m_pInstance->SetData(TYPE_IONAR, NOT_STARTED); + if (m_pInstance) + m_pInstance->SetData(TYPE_IONAR, NOT_STARTED); - // Ionar is immune to nature damage - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NATURE, true); - } + // Ionar is immune to nature damage + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NATURE, true); + } - void ScheduleEvents(bool spark) - { - events.SetPhase(1); - if (!spark) - events.RescheduleEvent(EVENT_CHECK_HEALTH, 1000, 0, 1); + void ScheduleEvents(bool spark) + { + events.SetPhase(1); + if (!spark) + events.RescheduleEvent(EVENT_CHECK_HEALTH, 1000, 0, 1); - events.RescheduleEvent(EVENT_BALL_LIGHTNING, 10000, 0, 1); - events.RescheduleEvent(EVENT_STATIC_OVERLOAD, 5000, 0, 1); - } + events.RescheduleEvent(EVENT_BALL_LIGHTNING, 10000, 0, 1); + events.RescheduleEvent(EVENT_STATIC_OVERLOAD, 5000, 0, 1); + } - void EnterCombat(Unit*) - { - me->SetInCombatWithZone(); - Talk(SAY_AGGRO); + void EnterCombat(Unit*) + { + me->SetInCombatWithZone(); + Talk(SAY_AGGRO); - if (m_pInstance) - m_pInstance->SetData(TYPE_IONAR, IN_PROGRESS); + if (m_pInstance) + m_pInstance->SetData(TYPE_IONAR, IN_PROGRESS); - ScheduleEvents(false); - } + ScheduleEvents(false); + } - void JustDied(Unit*) - { - Talk(SAY_DEATH); + void JustDied(Unit*) + { + Talk(SAY_DEATH); - summons.DespawnAll(); + summons.DespawnAll(); - if (m_pInstance) - m_pInstance->SetData(TYPE_IONAR, DONE); - } + if (m_pInstance) + m_pInstance->SetData(TYPE_IONAR, DONE); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; - Talk(SAY_SLAY); - } + Talk(SAY_SLAY); + } - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) - { - if (spell->Id == SPELL_DISPERSE) - Split(); - } + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) + { + if (spell->Id == SPELL_DISPERSE) + Split(); + } - void Split() - { - Talk(SAY_SPLIT); + void Split() + { + Talk(SAY_SPLIT); - Creature* spark; - for (uint8 i = 0; i < 5; ++i) - { - if (spark = me->SummonCreature(NPC_SPARK_OF_IONAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) - { - summons.Summon(spark); - spark->CastSpell(spark, me->GetMap()->IsHeroic() ? SPELL_SPARK_VISUAL_TRIGGER_H : SPELL_SPARK_VISUAL_TRIGGER_N, true); - spark->CastSpell(spark, SPELL_RANDOM_LIGHTNING, true); - spark->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - spark->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0); + Creature* spark; + for (uint8 i = 0; i < 5; ++i) + { + if (spark = me->SummonCreature(NPC_SPARK_OF_IONAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) + { + summons.Summon(spark); + spark->CastSpell(spark, me->GetMap()->IsHeroic() ? SPELL_SPARK_VISUAL_TRIGGER_H : SPELL_SPARK_VISUAL_TRIGGER_N, true); + spark->CastSpell(spark, SPELL_RANDOM_LIGHTNING, true); + spark->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + spark->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0); - if (Player* tgt = SelectTargetFromPlayerList(100)) - spark->GetMotionMaster()->MoveFollow(tgt, 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); - } - } - - me->SetVisible(false); - me->SetControlled(true, UNIT_STATE_STUNNED); + if (Player* tgt = SelectTargetFromPlayerList(100)) + spark->GetMotionMaster()->MoveFollow(tgt, 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); + } + } + + me->SetVisible(false); + me->SetControlled(true, UNIT_STATE_STUNNED); - events.SetPhase(2); - events.ScheduleEvent(EVENT_CALL_SPARKS, 15000, 0, 2); - } + events.SetPhase(2); + events.ScheduleEvent(EVENT_CALL_SPARKS, 15000, 0, 2); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_BALL_LIGHTNING: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(target, me->GetMap()->IsHeroic() ? SPELL_BALL_LIGHTNING_H : SPELL_BALL_LIGHTNING_N, false); - - events.RepeatEvent(10000 + rand()%1000); - break; - case EVENT_STATIC_OVERLOAD: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(target, me->GetMap()->IsHeroic() ? SPELL_STATIC_OVERLOAD_H : SPELL_STATIC_OVERLOAD_N, false); + switch (events.GetEvent()) + { + case EVENT_BALL_LIGHTNING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(target, me->GetMap()->IsHeroic() ? SPELL_BALL_LIGHTNING_H : SPELL_BALL_LIGHTNING_N, false); + + events.RepeatEvent(10000 + rand()%1000); + break; + case EVENT_STATIC_OVERLOAD: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(target, me->GetMap()->IsHeroic() ? SPELL_STATIC_OVERLOAD_H : SPELL_STATIC_OVERLOAD_N, false); - events.RepeatEvent(5000 + rand()%1000); - break; - case EVENT_CHECK_HEALTH: - if (HealthBelowPct(HealthCheck)) - me->CastSpell(me, SPELL_DISPERSE, false); + events.RepeatEvent(5000 + rand()%1000); + break; + case EVENT_CHECK_HEALTH: + if (HealthBelowPct(HealthCheck)) + me->CastSpell(me, SPELL_DISPERSE, false); - events.RepeatEvent(1000); - return; - case EVENT_CALL_SPARKS: - { - EntryCheckPredicate pred(NPC_SPARK_OF_IONAR); - summons.DoAction(ACTION_CALLBACK, pred); - events.PopEvent(); - events.ScheduleEvent(EVENT_RESTORE, 2000, 0, 2); - return; - } - case EVENT_RESTORE: - EntryCheckPredicate pred(NPC_SPARK_OF_IONAR); - summons.DoAction(ACTION_SPARK_DESPAWN, pred); - events.PopEvent(); + events.RepeatEvent(1000); + return; + case EVENT_CALL_SPARKS: + { + EntryCheckPredicate pred(NPC_SPARK_OF_IONAR); + summons.DoAction(ACTION_CALLBACK, pred); + events.PopEvent(); + events.ScheduleEvent(EVENT_RESTORE, 2000, 0, 2); + return; + } + case EVENT_RESTORE: + EntryCheckPredicate pred(NPC_SPARK_OF_IONAR); + summons.DoAction(ACTION_SPARK_DESPAWN, pred); + events.PopEvent(); - me->SetVisible(true); - me->SetControlled(false, UNIT_STATE_STUNNED); - ScheduleEvents(true); - return; - } + me->SetVisible(true); + me->SetControlled(false, UNIT_STATE_STUNNED); + ScheduleEvents(true); + return; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_spark_of_ionar : public CreatureScript @@ -225,47 +225,47 @@ public: return new npc_spark_of_ionarAI (creature); } - struct npc_spark_of_ionarAI : public ScriptedAI - { - npc_spark_of_ionarAI(Creature* creature) : ScriptedAI(creature) { } + struct npc_spark_of_ionarAI : public ScriptedAI + { + npc_spark_of_ionarAI(Creature* creature) : ScriptedAI(creature) { } - bool returning; + bool returning; - void MoveInLineOfSight(Unit*) { } - void UpdateAI(uint32) { } - void AttackStart(Unit* who) { } + void MoveInLineOfSight(Unit*) { } + void UpdateAI(uint32) { } + void AttackStart(Unit* who) { } - void Reset() { returning = false; } + void Reset() { returning = false; } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - damage = 0; - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + damage = 0; + } - void DoAction(int32 param) - { - if (param == ACTION_CALLBACK) - { - me->SetSpeed(MOVE_RUN, 2.5f); - me->DeleteThreatList(); - me->CombatStop(true); - me->GetMotionMaster()->MoveTargetedHome(); - returning = true; - } - else if (param == ACTION_SPARK_DESPAWN) - { - me->GetMotionMaster()->MoveIdle(); + void DoAction(int32 param) + { + if (param == ACTION_CALLBACK) + { + me->SetSpeed(MOVE_RUN, 2.5f); + me->DeleteThreatList(); + me->CombatStop(true); + me->GetMotionMaster()->MoveTargetedHome(); + returning = true; + } + else if (param == ACTION_SPARK_DESPAWN) + { + me->GetMotionMaster()->MoveIdle(); - me->RemoveAllAuras(); - me->CastSpell(me, SPELL_SPARK_DESPAWN, true); - me->DespawnOrUnsummon(1000); - } - } - }; + me->RemoveAllAuras(); + me->CastSpell(me, SPELL_SPARK_DESPAWN, true); + me->DespawnOrUnsummon(1000); + } + } + }; }; void AddSC_boss_ionar() { - new boss_ionar(); - new npc_spark_of_ionar(); + new boss_ionar(); + new npc_spark_of_ionar(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp index 6cf45decf..068446b8e 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp @@ -10,17 +10,17 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum LokenSpells { - SPELL_ARC_LIGHTNING = 52921, - SPELL_LIGHTNING_NOVA_N = 52960, - SPELL_LIGHTNING_NOVA_H = 59835, - SPELL_LIGHTNING_NOVA_VISUAL = 56502, - SPELL_LIGHTNING_NOVA_THUNDERS = 52663, + SPELL_ARC_LIGHTNING = 52921, + SPELL_LIGHTNING_NOVA_N = 52960, + SPELL_LIGHTNING_NOVA_H = 59835, + SPELL_LIGHTNING_NOVA_VISUAL = 56502, + SPELL_LIGHTNING_NOVA_THUNDERS = 52663, - SPELL_PULSING_SHOCKWAVE_N = 52961, - SPELL_PULSING_SHOCKWAVE_H = 59836, + SPELL_PULSING_SHOCKWAVE_N = 52961, + SPELL_PULSING_SHOCKWAVE_H = 59836, - // Achievement - ACHIEVEMENT_TIMELY_DEATH = 20384 + // Achievement + ACHIEVEMENT_TIMELY_DEATH = 20384 }; enum Yells @@ -39,11 +39,11 @@ enum Yells enum LokenEvents { - EVENT_LIGHTNING_NOVA = 1, - EVENT_SHOCKWAVE = 2, - EVENT_ARC_LIGHTNING = 3, - EVENT_CHECK_HEALTH = 4, - EVENT_AURA_REMOVE = 5 + EVENT_LIGHTNING_NOVA = 1, + EVENT_SHOCKWAVE = 2, + EVENT_ARC_LIGHTNING = 3, + EVENT_CHECK_HEALTH = 4, + EVENT_AURA_REMOVE = 5 }; class boss_loken : public CreatureScript @@ -56,184 +56,184 @@ public: return new boss_lokenAI (creature); } - struct boss_lokenAI : public ScriptedAI - { - boss_lokenAI(Creature* creature) : ScriptedAI(creature) - { - m_pInstance = creature->GetInstanceScript(); - if (m_pInstance) - isActive = m_pInstance->GetData(TYPE_LOKEN_INTRO); - } + struct boss_lokenAI : public ScriptedAI + { + boss_lokenAI(Creature* creature) : ScriptedAI(creature) + { + m_pInstance = creature->GetInstanceScript(); + if (m_pInstance) + isActive = m_pInstance->GetData(TYPE_LOKEN_INTRO); + } - InstanceScript* m_pInstance; - EventMap events; + InstanceScript* m_pInstance; + EventMap events; - bool isActive; - uint32 IntroTimer; - uint8 HealthCheck; + bool isActive; + uint32 IntroTimer; + uint8 HealthCheck; - void MoveInLineOfSight(Unit*) { } + void MoveInLineOfSight(Unit*) { } - void Reset() - { - events.Reset(); - if (m_pInstance) - { - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_TIMELY_DEATH); - m_pInstance->SetData(TYPE_LOKEN, NOT_STARTED); - } + void Reset() + { + events.Reset(); + if (m_pInstance) + { + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_TIMELY_DEATH); + m_pInstance->SetData(TYPE_LOKEN, NOT_STARTED); + } - HealthCheck = 75; - IntroTimer = 0; - me->RemoveAllAuras(); + HealthCheck = 75; + IntroTimer = 0; + me->RemoveAllAuras(); - if (!isActive) - { - me->SetControlled(true, UNIT_STATE_STUNNED); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else - { - me->SetControlled(false, UNIT_STATE_STUNNED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - } + if (!isActive) + { + me->SetControlled(true, UNIT_STATE_STUNNED); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + me->SetControlled(false, UNIT_STATE_STUNNED); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + } - void EnterCombat(Unit*) - { - me->SetInCombatWithZone(); - Talk(SAY_AGGRO); + void EnterCombat(Unit*) + { + me->SetInCombatWithZone(); + Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_ARC_LIGHTNING, 10000); - events.ScheduleEvent(EVENT_SHOCKWAVE, 3000); - events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 15000); + events.ScheduleEvent(EVENT_ARC_LIGHTNING, 10000); + events.ScheduleEvent(EVENT_SHOCKWAVE, 3000); + events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 15000); - if (m_pInstance) - { - m_pInstance->SetData(TYPE_LOKEN, IN_PROGRESS); + if (m_pInstance) + { + m_pInstance->SetData(TYPE_LOKEN, IN_PROGRESS); - if (me->GetMap()->IsHeroic()) - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_TIMELY_DEATH); - } - } + if (me->GetMap()->IsHeroic()) + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_TIMELY_DEATH); + } + } - void JustDied(Unit*) - { - Talk(SAY_DEATH); + void JustDied(Unit*) + { + Talk(SAY_DEATH); - if (m_pInstance) - m_pInstance->SetData(TYPE_LOKEN, DONE); - } + if (m_pInstance) + m_pInstance->SetData(TYPE_LOKEN, DONE); + } - void LokenSpeach(bool hp) - { - if (hp) - { - switch(HealthCheck) - { - case 75: Talk(SAY_75HEALTH); break; - case 50: Talk(SAY_50HEALTH); break; - case 25: Talk(SAY_25HEALTH); break; - } - } - else - Talk(SAY_NOVA); - } + void LokenSpeach(bool hp) + { + if (hp) + { + switch(HealthCheck) + { + case 75: Talk(SAY_75HEALTH); break; + case 50: Talk(SAY_50HEALTH); break; + case 25: Talk(SAY_25HEALTH); break; + } + } + else + Talk(SAY_NOVA); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; - Talk(SAY_SLAY); - } + Talk(SAY_SLAY); + } - void UpdateAI(uint32 diff) - { - if (!isActive) - { - IntroTimer += diff; - if (IntroTimer > 5000 && IntroTimer < 10000) - { - if (SelectTargetFromPlayerList(60)) - { - Talk(SAY_INTRO_1); - IntroTimer = 10000; - } - else - IntroTimer = 0; - } + void UpdateAI(uint32 diff) + { + if (!isActive) + { + IntroTimer += diff; + if (IntroTimer > 5000 && IntroTimer < 10000) + { + if (SelectTargetFromPlayerList(60)) + { + Talk(SAY_INTRO_1); + IntroTimer = 10000; + } + else + IntroTimer = 0; + } - if (IntroTimer >= 30000 && IntroTimer < 40000) - { - Talk(SAY_INTRO_2); - IntroTimer = 40000; - } - if (IntroTimer >= 60000) - { - isActive = true; - if (m_pInstance) - m_pInstance->SetData(TYPE_LOKEN_INTRO, 1); + if (IntroTimer >= 30000 && IntroTimer < 40000) + { + Talk(SAY_INTRO_2); + IntroTimer = 40000; + } + if (IntroTimer >= 60000) + { + isActive = true; + if (m_pInstance) + m_pInstance->SetData(TYPE_LOKEN_INTRO, 1); - me->SetControlled(false, UNIT_STATE_STUNNED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - if (Player* target = SelectTargetFromPlayerList(80)) - AttackStart(target); - } + me->SetControlled(false, UNIT_STATE_STUNNED); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + if (Player* target = SelectTargetFromPlayerList(80)) + AttackStart(target); + } - return; - } + return; + } - //Return since we have no target - if (!UpdateVictim()) - return; + //Return since we have no target + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_CHECK_HEALTH: - if (HealthBelowPct(HealthCheck)) - { - LokenSpeach(true); - HealthCheck -= 25; - } + switch (events.GetEvent()) + { + case EVENT_CHECK_HEALTH: + if (HealthBelowPct(HealthCheck)) + { + LokenSpeach(true); + HealthCheck -= 25; + } - events.RepeatEvent(1000); - break; - case EVENT_LIGHTNING_NOVA: - events.RepeatEvent(15000); - me->CastSpell(me, SPELL_LIGHTNING_NOVA_VISUAL, true); - me->CastSpell(me, SPELL_LIGHTNING_NOVA_THUNDERS, true); + events.RepeatEvent(1000); + break; + case EVENT_LIGHTNING_NOVA: + events.RepeatEvent(15000); + me->CastSpell(me, SPELL_LIGHTNING_NOVA_VISUAL, true); + me->CastSpell(me, SPELL_LIGHTNING_NOVA_THUNDERS, true); - events.DelayEvents(5001); - events.ScheduleEvent(EVENT_AURA_REMOVE, me->GetMap()->IsHeroic() ? 4000 : 5000); + events.DelayEvents(5001); + events.ScheduleEvent(EVENT_AURA_REMOVE, me->GetMap()->IsHeroic() ? 4000 : 5000); - me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_LIGHTNING_NOVA_H : SPELL_LIGHTNING_NOVA_N, false); - break; - case EVENT_SHOCKWAVE: - me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_PULSING_SHOCKWAVE_H : SPELL_PULSING_SHOCKWAVE_N, false); - events.PopEvent(); - break; - case EVENT_ARC_LIGHTNING: - if (Unit* target = SelectTargetFromPlayerList(100, SPELL_ARC_LIGHTNING)) - me->CastSpell(target, SPELL_ARC_LIGHTNING, false); + me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_LIGHTNING_NOVA_H : SPELL_LIGHTNING_NOVA_N, false); + break; + case EVENT_SHOCKWAVE: + me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_PULSING_SHOCKWAVE_H : SPELL_PULSING_SHOCKWAVE_N, false); + events.PopEvent(); + break; + case EVENT_ARC_LIGHTNING: + if (Unit* target = SelectTargetFromPlayerList(100, SPELL_ARC_LIGHTNING)) + me->CastSpell(target, SPELL_ARC_LIGHTNING, false); - events.RepeatEvent(12000); - break; - case EVENT_AURA_REMOVE: - me->RemoveAura(SPELL_LIGHTNING_NOVA_THUNDERS); - events.PopEvent(); - break; - } + events.RepeatEvent(12000); + break; + case EVENT_AURA_REMOVE: + me->RemoveAura(SPELL_LIGHTNING_NOVA_THUNDERS); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_loken_pulsing_shockwave : public SpellScriptLoader @@ -269,6 +269,6 @@ class spell_loken_pulsing_shockwave : public SpellScriptLoader void AddSC_boss_loken() { - new boss_loken(); - new spell_loken_pulsing_shockwave(); + new boss_loken(); + new spell_loken_pulsing_shockwave(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 8b77bd601..fdab1377f 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -9,49 +9,49 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum VolkahnSpells { - // Volkhan - SPELL_HEAT_N = 52387, - SPELL_HEAT_H = 59528, - SPELL_SHATTERING_STOMP_N = 52237, - SPELL_SHATTERING_STOMP_H = 59529, - SPELL_TEMPER = 52238, - SPELL_SUMMON_MOLTEN_GOLEM = 52405, + // Volkhan + SPELL_HEAT_N = 52387, + SPELL_HEAT_H = 59528, + SPELL_SHATTERING_STOMP_N = 52237, + SPELL_SHATTERING_STOMP_H = 59529, + SPELL_TEMPER = 52238, + SPELL_SUMMON_MOLTEN_GOLEM = 52405, - //Molten Golem - SPELL_BLAST_WAVE = 23113, - SPELL_IMMOLATION_STRIKE_N = 52433, - SPELL_IMMOLATION_STRIKE_H = 59530, - SPELL_SHATTER_N = 52429, - SPELL_SHATTER_H = 59527, + //Molten Golem + SPELL_BLAST_WAVE = 23113, + SPELL_IMMOLATION_STRIKE_N = 52433, + SPELL_IMMOLATION_STRIKE_H = 59530, + SPELL_SHATTER_N = 52429, + SPELL_SHATTER_H = 59527, }; enum VolkhanOther { - // NPCs - NPC_VOLKHAN_ANVIL = 28823, - NPC_MOLTEN_GOLEM = 28695, - NPC_BRITTLE_GOLEM = 28681, + // NPCs + NPC_VOLKHAN_ANVIL = 28823, + NPC_MOLTEN_GOLEM = 28695, + NPC_BRITTLE_GOLEM = 28681, - // Misc - ACTION_SHATTER = 1, - ACTION_DESTROYED = 2, + // Misc + ACTION_SHATTER = 1, + ACTION_DESTROYED = 2, - // Point - POINT_ANVIL = 1, + // Point + POINT_ANVIL = 1, }; enum VolkhanEvents { - // Volkhan - EVENT_HEAT = 1, - EVENT_CHECK_HEALTH = 2, - EVENT_SHATTER = 3, - EVENT_POSITION = 4, - EVENT_MOVE_TO_ANVIL = 5, + // Volkhan + EVENT_HEAT = 1, + EVENT_CHECK_HEALTH = 2, + EVENT_SHATTER = 3, + EVENT_POSITION = 4, + EVENT_MOVE_TO_ANVIL = 5, - // Molten Golem - EVENT_BLAST = 11, - EVENT_IMMOLATION = 12, + // Molten Golem + EVENT_BLAST = 11, + EVENT_IMMOLATION = 12, }; enum Yells @@ -75,236 +75,236 @@ public: return new boss_volkhanAI (creature); } - struct boss_volkhanAI : public ScriptedAI - { - boss_volkhanAI(Creature* creature) : ScriptedAI(creature), summons(creature) - { - m_pInstance = creature->GetInstanceScript(); - } + struct boss_volkhanAI : public ScriptedAI + { + boss_volkhanAI(Creature* creature) : ScriptedAI(creature), summons(creature) + { + m_pInstance = creature->GetInstanceScript(); + } - InstanceScript* m_pInstance; - EventMap events; - SummonList summons; - uint8 HealthCheck; - float x, y, z; - uint8 PointID; - uint8 ShatteredCount; + InstanceScript* m_pInstance; + EventMap events; + SummonList summons; + uint8 HealthCheck; + float x, y, z; + uint8 PointID; + uint8 ShatteredCount; - void Reset() - { - x = y = z = PointID = ShatteredCount = 0; - HealthCheck = 100; - events.Reset(); - summons.DespawnAll(); - me->SetSpeed(MOVE_RUN, 1.2f,true); - me->SetReactState(REACT_AGGRESSIVE); + void Reset() + { + x = y = z = PointID = ShatteredCount = 0; + HealthCheck = 100; + events.Reset(); + summons.DespawnAll(); + me->SetSpeed(MOVE_RUN, 1.2f,true); + me->SetReactState(REACT_AGGRESSIVE); - if (m_pInstance) - { - m_pInstance->SetData(TYPE_VOLKHAN, NOT_STARTED); - m_pInstance->SetData(DATA_VOLKHAN_ACHIEVEMENT, true); - } - } + if (m_pInstance) + { + m_pInstance->SetData(TYPE_VOLKHAN, NOT_STARTED); + m_pInstance->SetData(DATA_VOLKHAN_ACHIEVEMENT, true); + } + } - void EnterCombat(Unit*) - { - me->SetInCombatWithZone(); - Talk(SAY_AGGRO); + void EnterCombat(Unit*) + { + me->SetInCombatWithZone(); + Talk(SAY_AGGRO); - if (m_pInstance) - m_pInstance->SetData(TYPE_VOLKHAN, IN_PROGRESS); + if (m_pInstance) + m_pInstance->SetData(TYPE_VOLKHAN, IN_PROGRESS); - ScheduleEvents(false); - } + ScheduleEvents(false); + } - void JustDied(Unit*) - { - Talk(SAY_DEATH); + void JustDied(Unit*) + { + Talk(SAY_DEATH); - summons.DespawnAll(); + summons.DespawnAll(); - if (m_pInstance) - m_pInstance->SetData(TYPE_VOLKHAN, DONE); - } + if (m_pInstance) + m_pInstance->SetData(TYPE_VOLKHAN, DONE); + } - void GetNextPos() - { - if (me->GetPositionY() < -180) - { - if (me->GetPositionX() > 1330) - x = 1355; - else - x = 1308; + void GetNextPos() + { + if (me->GetPositionY() < -180) + { + if (me->GetPositionX() > 1330) + x = 1355; + else + x = 1308; - y = -178; - z = 52.5f; - } - else if (me->GetPositionY() < -145) - { - if (me->GetPositionX() > 1330) - x = 1355; - else - x = 1308; + y = -178; + z = 52.5f; + } + else if (me->GetPositionY() < -145) + { + if (me->GetPositionX() > 1330) + x = 1355; + else + x = 1308; - y = -137; - z = 52.5f; - } - else if (me->GetPositionY() < -130) - { - if (me->GetPositionX() > 1330) - x = 1343; - else - x = 1320; + y = -137; + z = 52.5f; + } + else if (me->GetPositionY() < -130) + { + if (me->GetPositionX() > 1330) + x = 1343; + else + x = 1320; - y = -123; - z = 56.7f; - } - else - { - PointID = POINT_ANVIL; - x = 1327; - y = -96; - z = 56.7f; - } - } + y = -123; + z = 56.7f; + } + else + { + PointID = POINT_ANVIL; + x = 1327; + y = -96; + z = 56.7f; + } + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; - Talk(SAY_SLAY); - } + Talk(SAY_SLAY); + } - void ScheduleEvents(bool anvil) - { - events.SetPhase(1); - events.RescheduleEvent(EVENT_HEAT, 8000, 0, 1); - events.RescheduleEvent(EVENT_SHATTER, 10000, 0, 1); - events.RescheduleEvent(EVENT_CHECK_HEALTH, anvil ? 1000 : 6000, 0, 1); - events.RescheduleEvent(EVENT_POSITION, 4000, 0, 1); - } + void ScheduleEvents(bool anvil) + { + events.SetPhase(1); + events.RescheduleEvent(EVENT_HEAT, 8000, 0, 1); + events.RescheduleEvent(EVENT_SHATTER, 10000, 0, 1); + events.RescheduleEvent(EVENT_CHECK_HEALTH, anvil ? 1000 : 6000, 0, 1); + events.RescheduleEvent(EVENT_POSITION, 4000, 0, 1); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() == NPC_MOLTEN_GOLEM) - { - summon->setFaction(me->getFaction()); + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() == NPC_MOLTEN_GOLEM) + { + summon->setFaction(me->getFaction()); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - summon->AI()->AttackStart(target); - } - } + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + summon->AI()->AttackStart(target); + } + } - void DoAction(int32 param) - { - if (param == ACTION_DESTROYED) - { - ShatteredCount++; - if (ShatteredCount > 4) - m_pInstance->SetData(DATA_VOLKHAN_ACHIEVEMENT, false); - } - } + void DoAction(int32 param) + { + if (param == ACTION_DESTROYED) + { + ShatteredCount++; + if (ShatteredCount > 4) + m_pInstance->SetData(DATA_VOLKHAN_ACHIEVEMENT, false); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; - if (id == POINT_ANVIL) - { - me->SetSpeed(MOVE_RUN, 1.2f,true); - me->SetReactState(REACT_AGGRESSIVE); - me->CastSpell(me, SPELL_TEMPER, false); - PointID = 0; - ScheduleEvents(true); + if (id == POINT_ANVIL) + { + me->SetSpeed(MOVE_RUN, 1.2f,true); + me->SetReactState(REACT_AGGRESSIVE); + me->CastSpell(me, SPELL_TEMPER, false); + PointID = 0; + ScheduleEvents(true); - // update orientation at server - me->SetOrientation(2.19f); + // update orientation at server + me->SetOrientation(2.19f); - // and client - WorldPacket data; - me->BuildHeartBeatMsg(&data); - me->SendMessageToSet(&data, false); - me->SetControlled(true, UNIT_STATE_ROOT); - } - else - events.ScheduleEvent(EVENT_MOVE_TO_ANVIL, 0, 0, 2); - } + // and client + WorldPacket data; + me->BuildHeartBeatMsg(&data); + me->SendMessageToSet(&data, false); + me->SetControlled(true, UNIT_STATE_ROOT); + } + else + events.ScheduleEvent(EVENT_MOVE_TO_ANVIL, 0, 0, 2); + } - void SpellHitTarget(Unit* /*who*/, const SpellInfo *spellInfo) - { - if (spellInfo->Id == SPELL_TEMPER) - { - me->CastSpell(me, SPELL_SUMMON_MOLTEN_GOLEM, true); - me->CastSpell(me, SPELL_SUMMON_MOLTEN_GOLEM, true); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - me->SetControlled(false, UNIT_STATE_ROOT); - } - } + void SpellHitTarget(Unit* /*who*/, const SpellInfo *spellInfo) + { + if (spellInfo->Id == SPELL_TEMPER) + { + me->CastSpell(me, SPELL_SUMMON_MOLTEN_GOLEM, true); + me->CastSpell(me, SPELL_SUMMON_MOLTEN_GOLEM, true); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + me->SetControlled(false, UNIT_STATE_ROOT); + } + } - void GoToAnvil() - { - events.SetPhase(2); - HealthCheck -= 20; - me->SetSpeed(MOVE_RUN, 4.0f,true); - me->SetReactState(REACT_PASSIVE); + void GoToAnvil() + { + events.SetPhase(2); + HealthCheck -= 20; + me->SetSpeed(MOVE_RUN, 4.0f,true); + me->SetReactState(REACT_PASSIVE); - Talk(SAY_FORGE); + Talk(SAY_FORGE); - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) + me->GetMotionMaster()->MovementExpired(); - events.ScheduleEvent(EVENT_MOVE_TO_ANVIL, 0, 0, 2); - } + events.ScheduleEvent(EVENT_MOVE_TO_ANVIL, 0, 0, 2); + } - void UpdateAI(uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_HEAT: - me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_HEAT_H : SPELL_HEAT_N, true); - events.RepeatEvent(8000); - break; - case EVENT_CHECK_HEALTH: - if (HealthBelowPct(HealthCheck)) - GoToAnvil(); + switch (events.GetEvent()) + { + case EVENT_HEAT: + me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_HEAT_H : SPELL_HEAT_N, true); + events.RepeatEvent(8000); + break; + case EVENT_CHECK_HEALTH: + if (HealthBelowPct(HealthCheck)) + GoToAnvil(); - events.RepeatEvent(1000); - return; - case EVENT_SHATTER: - { - events.RepeatEvent(10000); - summons.DoAction(ACTION_SHATTER); - break; - } - case EVENT_MOVE_TO_ANVIL: - GetNextPos(); - me->GetMotionMaster()->MovePoint(PointID, x, y, z); - events.PopEvent(); - return; - case EVENT_POSITION: - if (me->GetDistance(1331.9f, -106, 56) > 95) - EnterEvadeMode(); - else - events.RepeatEvent(4000); - - return; - } - - DoMeleeAttackIfReady(); - } - }; + events.RepeatEvent(1000); + return; + case EVENT_SHATTER: + { + events.RepeatEvent(10000); + summons.DoAction(ACTION_SHATTER); + break; + } + case EVENT_MOVE_TO_ANVIL: + GetNextPos(); + me->GetMotionMaster()->MovePoint(PointID, x, y, z); + events.PopEvent(); + return; + case EVENT_POSITION: + if (me->GetDistance(1331.9f, -106, 56) > 95) + EnterEvadeMode(); + else + events.RepeatEvent(4000); + + return; + } + + DoMeleeAttackIfReady(); + } + }; }; class npc_molten_golem : public CreatureScript @@ -317,256 +317,256 @@ public: return new npc_molten_golemAI (creature); } - struct npc_molten_golemAI : public ScriptedAI - { - npc_molten_golemAI(Creature* creature) : ScriptedAI(creature) - { - m_pInstance = creature->GetInstanceScript(); - } + struct npc_molten_golemAI : public ScriptedAI + { + npc_molten_golemAI(Creature* creature) : ScriptedAI(creature) + { + m_pInstance = creature->GetInstanceScript(); + } - EventMap events; - InstanceScript* m_pInstance; + EventMap events; + InstanceScript* m_pInstance; - void Reset() - { - events.Reset(); - events.ScheduleEvent(EVENT_BLAST, 7000); - events.ScheduleEvent(EVENT_IMMOLATION, 3000); - } + void Reset() + { + events.Reset(); + events.ScheduleEvent(EVENT_BLAST, 7000); + events.ScheduleEvent(EVENT_IMMOLATION, 3000); + } - void DamageTaken(Unit*, uint32 &uiDamage, DamageEffectType, SpellSchoolMask) - { - if (me->GetEntry() == NPC_BRITTLE_GOLEM) - { - uiDamage = 0; - return; - } + void DamageTaken(Unit*, uint32 &uiDamage, DamageEffectType, SpellSchoolMask) + { + if (me->GetEntry() == NPC_BRITTLE_GOLEM) + { + uiDamage = 0; + return; + } - if (uiDamage >= me->GetHealth()) - { - me->UpdateEntry(NPC_BRITTLE_GOLEM, 0, false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_DISABLE_MOVE); - me->SetHealth(me->GetMaxHealth()); - me->RemoveAllAuras(); - me->AttackStop(); - uiDamage = 0; + if (uiDamage >= me->GetHealth()) + { + me->UpdateEntry(NPC_BRITTLE_GOLEM, 0, false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_DISABLE_MOVE); + me->SetHealth(me->GetMaxHealth()); + me->RemoveAllAuras(); + me->AttackStop(); + uiDamage = 0; - if (me->IsNonMeleeSpellCast(false)) - me->InterruptNonMeleeSpells(false); + if (me->IsNonMeleeSpellCast(false)) + me->InterruptNonMeleeSpells(false); - me->SetControlled(true, UNIT_STATE_STUNNED); - } - } + me->SetControlled(true, UNIT_STATE_STUNNED); + } + } - void DoAction(int32 param) - { - if (me->GetEntry() == NPC_BRITTLE_GOLEM && param == ACTION_SHATTER) - { - if (Creature* volkhan = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(TYPE_VOLKHAN))) - volkhan->AI()->DoAction(ACTION_DESTROYED); + void DoAction(int32 param) + { + if (me->GetEntry() == NPC_BRITTLE_GOLEM && param == ACTION_SHATTER) + { + if (Creature* volkhan = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(TYPE_VOLKHAN))) + volkhan->AI()->DoAction(ACTION_DESTROYED); - me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_SHATTER_H : SPELL_SHATTER_N, true); - me->DespawnOrUnsummon(500); - } - } + me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_SHATTER_H : SPELL_SHATTER_N, true); + me->DespawnOrUnsummon(500); + } + } - void UpdateAI(uint32 diff) - { - //Return since we have no target or if we are frozen - if (!UpdateVictim() || me->GetEntry() == NPC_BRITTLE_GOLEM) - return; + void UpdateAI(uint32 diff) + { + //Return since we have no target or if we are frozen + if (!UpdateVictim() || me->GetEntry() == NPC_BRITTLE_GOLEM) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_BLAST: - me->CastSpell(me, SPELL_BLAST_WAVE, false); - events.RepeatEvent(14000); - break; - case EVENT_IMMOLATION: - me->CastSpell(me->GetVictim(), me->GetMap()->IsHeroic() ? SPELL_IMMOLATION_STRIKE_H : SPELL_IMMOLATION_STRIKE_N, false); - events.RepeatEvent(5000); - break; - } + switch (events.GetEvent()) + { + case EVENT_BLAST: + me->CastSpell(me, SPELL_BLAST_WAVE, false); + events.RepeatEvent(14000); + break; + case EVENT_IMMOLATION: + me->CastSpell(me->GetVictim(), me->GetMap()->IsHeroic() ? SPELL_IMMOLATION_STRIKE_H : SPELL_IMMOLATION_STRIKE_N, false); + events.RepeatEvent(5000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum monumentSpells { - SPELL_FREEZE_ANIM = 16245, - SPELL_AWAKEN = 52875, + SPELL_FREEZE_ANIM = 16245, + SPELL_AWAKEN = 52875, - SPELL_PIERCING_HOWL = 23600, - SPELL_PENETRATING_STRIKE = 52890, - SPELL_FRIGHTENING_SHOUT = 19134, - SPELL_BLADE_TURNING_N = 52891, - SPELL_BLADE_TURNING_H = 59173, + SPELL_PIERCING_HOWL = 23600, + SPELL_PENETRATING_STRIKE = 52890, + SPELL_FRIGHTENING_SHOUT = 19134, + SPELL_BLADE_TURNING_N = 52891, + SPELL_BLADE_TURNING_H = 59173, - SPELL_DEADLY_THROW_N = 52885, - SPELL_DEADLY_THROW_H = 59180, - SPELL_DEFLECTION_N = 52879, - SPELL_DEFLECTION_H = 59181, - SPELL_THROW_N = 52904, - SPELL_THROW_H = 59179, + SPELL_DEADLY_THROW_N = 52885, + SPELL_DEADLY_THROW_H = 59180, + SPELL_DEFLECTION_N = 52879, + SPELL_DEFLECTION_H = 59181, + SPELL_THROW_N = 52904, + SPELL_THROW_H = 59179, }; enum monumentEvents { - EVENT_PIERCING_HOWL = 1, - EVENT_PENETRATING_STRIKE = 2, - EVENT_FRIGHTENING_SHOUT = 3, - EVENT_BLADE_TURNING = 4, + EVENT_PIERCING_HOWL = 1, + EVENT_PENETRATING_STRIKE = 2, + EVENT_FRIGHTENING_SHOUT = 3, + EVENT_BLADE_TURNING = 4, - EVENT_DEADLY_THROW = 11, - EVENT_DEFLECTION = 12, - EVENT_THROW = 13, + EVENT_DEADLY_THROW = 11, + EVENT_DEFLECTION = 12, + EVENT_THROW = 13, - EVENT_UNFREEZE = 20, + EVENT_UNFREEZE = 20, }; class npc_hol_monument : public CreatureScript { public: - npc_hol_monument() : CreatureScript("npc_hol_monument") {} + npc_hol_monument() : CreatureScript("npc_hol_monument") {} - CreatureAI* GetAI(Creature* creature) const - { - return new npc_hol_monumentAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_hol_monumentAI(creature); + } - struct npc_hol_monumentAI : public ScriptedAI - { - npc_hol_monumentAI(Creature* creature) : ScriptedAI(creature) - { - _attackGUID = 0; - _isActive = urand(0,1); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->CastSpell(me, SPELL_FREEZE_ANIM, true); - } + struct npc_hol_monumentAI : public ScriptedAI + { + npc_hol_monumentAI(Creature* creature) : ScriptedAI(creature) + { + _attackGUID = 0; + _isActive = urand(0,1); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->CastSpell(me, SPELL_FREEZE_ANIM, true); + } - EventMap events; - bool _isActive; - uint64 _attackGUID; + EventMap events; + bool _isActive; + uint64 _attackGUID; - void Reset() - { - } + void Reset() + { + } - void MoveInLineOfSight(Unit* who) - { - if (_attackGUID) - ScriptedAI::MoveInLineOfSight(who); - else if (_isActive && who->GetTypeId() == TYPEID_PLAYER) - { - if ((who->GetPositionX() < me->GetPositionX() || who->GetPositionY() < -220.0f) && me->GetDistance2d(who) < 40) - { - _isActive = false; - _attackGUID = who->GetGUID(); - events.Reset(); - events.RescheduleEvent(EVENT_UNFREEZE, 5000); - } - } - } + void MoveInLineOfSight(Unit* who) + { + if (_attackGUID) + ScriptedAI::MoveInLineOfSight(who); + else if (_isActive && who->GetTypeId() == TYPEID_PLAYER) + { + if ((who->GetPositionX() < me->GetPositionX() || who->GetPositionY() < -220.0f) && me->GetDistance2d(who) < 40) + { + _isActive = false; + _attackGUID = who->GetGUID(); + events.Reset(); + events.RescheduleEvent(EVENT_UNFREEZE, 5000); + } + } + } - void EnterCombat(Unit*) - { - events.Reset(); - if (me->GetEntry() == 28961) // NPC_TITANIUM_SIEGEBREAKER - { - events.ScheduleEvent(EVENT_PIERCING_HOWL, 10000+rand()%15000); - events.ScheduleEvent(EVENT_PENETRATING_STRIKE, 5000+rand()%5000); - events.ScheduleEvent(EVENT_FRIGHTENING_SHOUT, 20000+rand()%8000); - events.ScheduleEvent(EVENT_BLADE_TURNING, 12000); - } - else - { - events.ScheduleEvent(EVENT_THROW, 10000+rand()%15000); - events.ScheduleEvent(EVENT_DEADLY_THROW, 15000+rand()%15000); - events.ScheduleEvent(EVENT_DEFLECTION, 15000); - } - } + void EnterCombat(Unit*) + { + events.Reset(); + if (me->GetEntry() == 28961) // NPC_TITANIUM_SIEGEBREAKER + { + events.ScheduleEvent(EVENT_PIERCING_HOWL, 10000+rand()%15000); + events.ScheduleEvent(EVENT_PENETRATING_STRIKE, 5000+rand()%5000); + events.ScheduleEvent(EVENT_FRIGHTENING_SHOUT, 20000+rand()%8000); + events.ScheduleEvent(EVENT_BLADE_TURNING, 12000); + } + else + { + events.ScheduleEvent(EVENT_THROW, 10000+rand()%15000); + events.ScheduleEvent(EVENT_DEADLY_THROW, 15000+rand()%15000); + events.ScheduleEvent(EVENT_DEFLECTION, 15000); + } + } - void AttackStart(Unit* who) - { - if (!_attackGUID || !_isActive) - return; - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (!_attackGUID || !_isActive) + return; + ScriptedAI::AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if (!_isActive && !_attackGUID) - return; + void UpdateAI(uint32 diff) + { + if (!_isActive && !_attackGUID) + return; - events.Update(diff); - uint32 eventId = events.GetEvent(); + events.Update(diff); + uint32 eventId = events.GetEvent(); - if (eventId == EVENT_UNFREEZE) - { - events.PopEvent(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->CastSpell(me, SPELL_AWAKEN, true); - me->RemoveAllAuras(); - _isActive = true; - if (Unit* target = ObjectAccessor::GetUnit(*me, _attackGUID)) - AttackStart(target); - return; - } + if (eventId == EVENT_UNFREEZE) + { + events.PopEvent(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->CastSpell(me, SPELL_AWAKEN, true); + me->RemoveAllAuras(); + _isActive = true; + if (Unit* target = ObjectAccessor::GetUnit(*me, _attackGUID)) + AttackStart(target); + return; + } - //Return since we have no target or if we are disabled from fight - if (!UpdateVictim()) - return; + //Return since we have no target or if we are disabled from fight + if (!UpdateVictim()) + return; - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (eventId) - { - case EVENT_PIERCING_HOWL: - me->CastSpell(me->GetVictim(), SPELL_PIERCING_HOWL, false); - events.RepeatEvent(10000+rand()%1500); - break; - case EVENT_PENETRATING_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_PENETRATING_STRIKE, false); - events.RepeatEvent(5000+rand()%5000); - break; - case EVENT_FRIGHTENING_SHOUT: - me->CastSpell(me->GetVictim(), SPELL_FRIGHTENING_SHOUT, false); - events.RepeatEvent(20000+rand()%8000); - break; - case EVENT_BLADE_TURNING: - me->CastSpell(me->GetVictim(), me->GetMap()->IsHeroic() ? SPELL_BLADE_TURNING_H : SPELL_BLADE_TURNING_N, false); - events.RepeatEvent(12000); - break; - case EVENT_THROW: - me->CastSpell(SelectTarget(SELECT_TARGET_RANDOM,0,50.0f, true,0), me->GetMap()->IsHeroic() ? SPELL_THROW_H : SPELL_THROW_N, true); - events.RepeatEvent(10000+rand()%15000); - break; - case EVENT_DEADLY_THROW: - me->CastSpell(SelectTarget(SELECT_TARGET_RANDOM,0,50.0f, true,0), me->GetMap()->IsHeroic() ? SPELL_DEADLY_THROW_H : SPELL_DEADLY_THROW_N, true); - events.RepeatEvent(15000+rand()%15000); - break; - case EVENT_DEFLECTION: - me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_DEFLECTION_H : SPELL_DEFLECTION_N, false); - events.RepeatEvent(15000); - break; - } + switch (eventId) + { + case EVENT_PIERCING_HOWL: + me->CastSpell(me->GetVictim(), SPELL_PIERCING_HOWL, false); + events.RepeatEvent(10000+rand()%1500); + break; + case EVENT_PENETRATING_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_PENETRATING_STRIKE, false); + events.RepeatEvent(5000+rand()%5000); + break; + case EVENT_FRIGHTENING_SHOUT: + me->CastSpell(me->GetVictim(), SPELL_FRIGHTENING_SHOUT, false); + events.RepeatEvent(20000+rand()%8000); + break; + case EVENT_BLADE_TURNING: + me->CastSpell(me->GetVictim(), me->GetMap()->IsHeroic() ? SPELL_BLADE_TURNING_H : SPELL_BLADE_TURNING_N, false); + events.RepeatEvent(12000); + break; + case EVENT_THROW: + me->CastSpell(SelectTarget(SELECT_TARGET_RANDOM,0,50.0f, true,0), me->GetMap()->IsHeroic() ? SPELL_THROW_H : SPELL_THROW_N, true); + events.RepeatEvent(10000+rand()%15000); + break; + case EVENT_DEADLY_THROW: + me->CastSpell(SelectTarget(SELECT_TARGET_RANDOM,0,50.0f, true,0), me->GetMap()->IsHeroic() ? SPELL_DEADLY_THROW_H : SPELL_DEADLY_THROW_N, true); + events.RepeatEvent(15000+rand()%15000); + break; + case EVENT_DEFLECTION: + me->CastSpell(me, me->GetMap()->IsHeroic() ? SPELL_DEFLECTION_H : SPELL_DEFLECTION_N, false); + events.RepeatEvent(15000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_volkhan() { - new boss_volkhan(); - new npc_molten_golem(); - new npc_hol_monument(); + new boss_volkhan(); + new npc_molten_golem(); + new npc_hol_monument(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h index 7750f297f..a5cd5da90 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h @@ -8,32 +8,32 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum HoLEvents { - TYPE_BJARNGRIM = 0, - TYPE_IONAR = 1, - TYPE_LOKEN = 2, - TYPE_VOLKHAN = 3, - TYPE_LOKEN_INTRO = 4, - MAX_ENCOUNTER = 5, + TYPE_BJARNGRIM = 0, + TYPE_IONAR = 1, + TYPE_LOKEN = 2, + TYPE_VOLKHAN = 3, + TYPE_LOKEN_INTRO = 4, + MAX_ENCOUNTER = 5, - DATA_BJARNGRIM_ACHIEVEMENT = 10, - DATA_VOLKHAN_ACHIEVEMENT = 11, + DATA_BJARNGRIM_ACHIEVEMENT = 10, + DATA_VOLKHAN_ACHIEVEMENT = 11, }; enum HoLNPCs { - NPC_BJARNGRIM = 28586, - NPC_VOLKHAN = 28587, - NPC_IONAR = 28546, - NPC_LOKEN = 28923, + NPC_BJARNGRIM = 28586, + NPC_VOLKHAN = 28587, + NPC_IONAR = 28546, + NPC_LOKEN = 28923, }; enum HoLGOs { - GO_BJARNGRIM_DOOR = 191416, //_doors10 - GO_VOLKHAN_DOOR = 191325, //_doors07 - GO_IONAR_DOOR = 191326, //_doors05 - GO_LOKEN_DOOR = 191324, //_doors02 - GO_LOKEN_THRONE = 192654, + GO_BJARNGRIM_DOOR = 191416, //_doors10 + GO_VOLKHAN_DOOR = 191325, //_doors07 + GO_IONAR_DOOR = 191326, //_doors05 + GO_LOKEN_DOOR = 191324, //_doors02 + GO_LOKEN_THRONE = 192654, }; #endif diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp index a4a4025b5..bb3e7e6ab 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp @@ -16,230 +16,230 @@ public: return new instance_halls_of_lightning_InstanceMapScript(pMap); } - struct instance_halls_of_lightning_InstanceMapScript : public InstanceScript - { - instance_halls_of_lightning_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); }; + struct instance_halls_of_lightning_InstanceMapScript : public InstanceScript + { + instance_halls_of_lightning_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); }; - uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 m_uiGeneralBjarngrimGUID; - uint64 m_uiIonarGUID; - uint64 m_uiLokenGUID; - uint64 m_uiVolkhanGUID; + uint64 m_uiGeneralBjarngrimGUID; + uint64 m_uiIonarGUID; + uint64 m_uiLokenGUID; + uint64 m_uiVolkhanGUID; - uint64 m_uiBjarngrimDoorGUID; - uint64 m_uiVolkhanDoorGUID; - uint64 m_uiIonarDoorGUID; - uint64 m_uiLokenDoorGUID; - uint64 m_uiLokenGlobeGUID; + uint64 m_uiBjarngrimDoorGUID; + uint64 m_uiVolkhanDoorGUID; + uint64 m_uiIonarDoorGUID; + uint64 m_uiLokenDoorGUID; + uint64 m_uiLokenGlobeGUID; - bool volkhanAchievement; - bool bjarngrimAchievement; + bool volkhanAchievement; + bool bjarngrimAchievement; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiGeneralBjarngrimGUID = 0; - m_uiVolkhanGUID = 0; - m_uiIonarGUID = 0; - m_uiLokenGUID = 0; + m_uiGeneralBjarngrimGUID = 0; + m_uiVolkhanGUID = 0; + m_uiIonarGUID = 0; + m_uiLokenGUID = 0; - m_uiBjarngrimDoorGUID = 0; - m_uiVolkhanDoorGUID = 0; - m_uiIonarDoorGUID = 0; - m_uiLokenDoorGUID = 0; - m_uiLokenGlobeGUID = 0; + m_uiBjarngrimDoorGUID = 0; + m_uiVolkhanDoorGUID = 0; + m_uiIonarDoorGUID = 0; + m_uiLokenDoorGUID = 0; + m_uiLokenGlobeGUID = 0; - volkhanAchievement = false; - bjarngrimAchievement = false; - } + volkhanAchievement = false; + bjarngrimAchievement = false; + } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - if (m_auiEncounter[i] == IN_PROGRESS) - return true; - } - return false; - } + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + } + return false; + } - void OnCreatureCreate(Creature* pCreature) - { - switch(pCreature->GetEntry()) - { - case NPC_BJARNGRIM: - m_uiGeneralBjarngrimGUID = pCreature->GetGUID(); - break; - case NPC_VOLKHAN: - m_uiVolkhanGUID = pCreature->GetGUID(); - break; - case NPC_IONAR: - m_uiIonarGUID = pCreature->GetGUID(); - break; - case NPC_LOKEN: - m_uiLokenGUID = pCreature->GetGUID(); - break; - } - } + void OnCreatureCreate(Creature* pCreature) + { + switch(pCreature->GetEntry()) + { + case NPC_BJARNGRIM: + m_uiGeneralBjarngrimGUID = pCreature->GetGUID(); + break; + case NPC_VOLKHAN: + m_uiVolkhanGUID = pCreature->GetGUID(); + break; + case NPC_IONAR: + m_uiIonarGUID = pCreature->GetGUID(); + break; + case NPC_LOKEN: + m_uiLokenGUID = pCreature->GetGUID(); + break; + } + } - void OnGameObjectCreate(GameObject* pGo) - { - switch(pGo->GetEntry()) - { - case GO_BJARNGRIM_DOOR: - m_uiBjarngrimDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[TYPE_BJARNGRIM] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); + void OnGameObjectCreate(GameObject* pGo) + { + switch(pGo->GetEntry()) + { + case GO_BJARNGRIM_DOOR: + m_uiBjarngrimDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[TYPE_BJARNGRIM] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_VOLKHAN_DOOR: - m_uiVolkhanDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[TYPE_VOLKHAN] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_VOLKHAN_DOOR: + m_uiVolkhanDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[TYPE_VOLKHAN] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_IONAR_DOOR: - m_uiIonarDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[TYPE_IONAR] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_IONAR_DOOR: + m_uiIonarDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[TYPE_IONAR] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_LOKEN_DOOR: - m_uiLokenDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[TYPE_LOKEN] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); + break; + case GO_LOKEN_DOOR: + m_uiLokenDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[TYPE_LOKEN] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); - break; - case GO_LOKEN_THRONE: - m_uiLokenGlobeGUID = pGo->GetGUID(); - break; - } - } + break; + case GO_LOKEN_THRONE: + m_uiLokenGlobeGUID = pGo->GetGUID(); + break; + } + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case 7321: //Shatter Resistant (2042) - return volkhanAchievement; - case 6835: // Lightning Struck (1834) - return bjarngrimAchievement; - } - return false; - } + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case 7321: //Shatter Resistant (2042) + return volkhanAchievement; + case 6835: // Lightning Struck (1834) + return bjarngrimAchievement; + } + return false; + } - void SetData(uint32 uiType, uint32 uiData) - { - m_auiEncounter[uiType] = uiData; - if( uiType == TYPE_LOKEN_INTRO ) - SaveToDB(); + void SetData(uint32 uiType, uint32 uiData) + { + m_auiEncounter[uiType] = uiData; + if( uiType == TYPE_LOKEN_INTRO ) + SaveToDB(); - // Achievements - if (uiType == DATA_BJARNGRIM_ACHIEVEMENT) - bjarngrimAchievement = (bool)uiData; - else if (uiType == DATA_VOLKHAN_ACHIEVEMENT) - volkhanAchievement = (bool)uiData; + // Achievements + if (uiType == DATA_BJARNGRIM_ACHIEVEMENT) + bjarngrimAchievement = (bool)uiData; + else if (uiType == DATA_VOLKHAN_ACHIEVEMENT) + volkhanAchievement = (bool)uiData; - if( uiData != DONE ) - return; + if( uiData != DONE ) + return; - switch(uiType) - { - case TYPE_BJARNGRIM: - HandleGameObject(m_uiBjarngrimDoorGUID, true); - break; - case TYPE_VOLKHAN: - HandleGameObject(m_uiVolkhanDoorGUID, true); - break; - case TYPE_IONAR: - HandleGameObject(m_uiIonarDoorGUID, true); - break; - case TYPE_LOKEN: - HandleGameObject(m_uiLokenDoorGUID, true); - //Appears to be type 5 GO with animation. Need to figure out how this work, code below only placeholder - if (GameObject* pGlobe = instance->GetGameObject(m_uiLokenGlobeGUID)) - pGlobe->SetGoState(GO_STATE_ACTIVE); + switch(uiType) + { + case TYPE_BJARNGRIM: + HandleGameObject(m_uiBjarngrimDoorGUID, true); + break; + case TYPE_VOLKHAN: + HandleGameObject(m_uiVolkhanDoorGUID, true); + break; + case TYPE_IONAR: + HandleGameObject(m_uiIonarDoorGUID, true); + break; + case TYPE_LOKEN: + HandleGameObject(m_uiLokenDoorGUID, true); + //Appears to be type 5 GO with animation. Need to figure out how this work, code below only placeholder + if (GameObject* pGlobe = instance->GetGameObject(m_uiLokenGlobeGUID)) + pGlobe->SetGoState(GO_STATE_ACTIVE); - break; - } + break; + } - SaveToDB(); - } + SaveToDB(); + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "H L " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' - << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << m_auiEncounter[4]; + std::ostringstream saveStream; + saveStream << "H L " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' + << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' << m_auiEncounter[4]; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint32 data0, data1, data2, data3, data4; + char dataHead1, dataHead2; + uint32 data0, data1, data2, data3, data4; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; - if (dataHead1 == 'H' && dataHead2 == 'L') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; - m_auiEncounter[4] = data4; + if (dataHead1 == 'H' && dataHead2 == 'L') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + m_auiEncounter[4] = data4; - for (uint8 i = 0; i < TYPE_LOKEN_INTRO; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + for (uint8 i = 0; i < TYPE_LOKEN_INTRO; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; + OUT_LOAD_INST_DATA_COMPLETE; - } - else - OUT_LOAD_INST_DATA_FAIL; - } + } + else + OUT_LOAD_INST_DATA_FAIL; + } - uint32 GetData(uint32 uiType) const - { - return m_auiEncounter[uiType]; - } + uint32 GetData(uint32 uiType) const + { + return m_auiEncounter[uiType]; + } - uint64 GetData64(uint32 uiData) const - { - switch(uiData) - { - case TYPE_BJARNGRIM: - return m_uiGeneralBjarngrimGUID; - case TYPE_VOLKHAN: - return m_uiVolkhanGUID; - case TYPE_IONAR: - return m_uiIonarGUID; - case TYPE_LOKEN: - return m_uiLokenGUID; - } - return 0; - } - }; + uint64 GetData64(uint32 uiData) const + { + switch(uiData) + { + case TYPE_BJARNGRIM: + return m_uiGeneralBjarngrimGUID; + case TYPE_VOLKHAN: + return m_uiVolkhanGUID; + case TYPE_IONAR: + return m_uiIonarGUID; + case TYPE_LOKEN: + return m_uiLokenGUID; + } + return 0; + } + }; }; void AddSC_instance_halls_of_lightning() { - new instance_halls_of_lightning(); + new instance_halls_of_lightning(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index 7b10771c4..fd941671d 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -9,27 +9,27 @@ enum spells { - GROUND_SPIKE_H = 59750, - BOULDER_TOSS = 50843, - BOULDER_TOSS_H = 59742, - SHATTER = 50810, - SHATTER_H = 61546, - STOMP = 50868, - STOMP_H = 59744, - GROUND_SLAM = 50827, - GROUND_SLAM_STONED_EFFECT = 50812, - SPELL_SHATTER_EFFECT = 50811, + GROUND_SPIKE_H = 59750, + BOULDER_TOSS = 50843, + BOULDER_TOSS_H = 59742, + SHATTER = 50810, + SHATTER_H = 61546, + STOMP = 50868, + STOMP_H = 59744, + GROUND_SLAM = 50827, + GROUND_SLAM_STONED_EFFECT = 50812, + SPELL_SHATTER_EFFECT = 50811, }; enum events { - EVENT_NONE, - EVENT_BOULDER, - EVENT_STOMP, - EVENT_GROUND_SLAM, - EVENT_GROUND_SPIKE, - EVENT_SHATTER, - EVENT_REMOVE_STONED, + EVENT_NONE, + EVENT_BOULDER, + EVENT_STOMP, + EVENT_GROUND_SLAM, + EVENT_GROUND_SPIKE, + EVENT_SHATTER, + EVENT_REMOVE_STONED, }; enum Yells @@ -50,121 +50,121 @@ public: return new boss_krystallusAI (pCreature); } - struct boss_krystallusAI : public ScriptedAI - { - boss_krystallusAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceScript(); - } + struct boss_krystallusAI : public ScriptedAI + { + boss_krystallusAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - EventMap events; - InstanceScript* pInstance; + EventMap events; + InstanceScript* pInstance; - void Reset() - { - events.Reset(); - if (pInstance) - pInstance->SetData(BOSS_KRYSTALLUS, NOT_STARTED); - } + void Reset() + { + events.Reset(); + if (pInstance) + pInstance->SetData(BOSS_KRYSTALLUS, NOT_STARTED); + } - void EnterCombat(Unit* who) - { - events.Reset(); - events.RescheduleEvent(EVENT_BOULDER, 8000); - events.RescheduleEvent(EVENT_STOMP, 5000); - events.RescheduleEvent(EVENT_GROUND_SLAM, 15000); - if (me->GetMap()->IsHeroic()) - events.RescheduleEvent(EVENT_GROUND_SPIKE, 10000); + void EnterCombat(Unit* who) + { + events.Reset(); + events.RescheduleEvent(EVENT_BOULDER, 8000); + events.RescheduleEvent(EVENT_STOMP, 5000); + events.RescheduleEvent(EVENT_GROUND_SLAM, 15000); + if (me->GetMap()->IsHeroic()) + events.RescheduleEvent(EVENT_GROUND_SPIKE, 10000); - if (pInstance) - pInstance->SetData(BOSS_KRYSTALLUS, IN_PROGRESS); + if (pInstance) + pInstance->SetData(BOSS_KRYSTALLUS, IN_PROGRESS); - Talk(SAY_AGGRO); - } + Talk(SAY_AGGRO); + } - void RemoveStonedEffect() - { - Map* map = me->GetMap(); - if (map->IsDungeon()) - { - Map::PlayerList const &players = map->GetPlayers(); - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (itr->GetSource()->IsAlive()) - itr->GetSource()->RemoveAura(GROUND_SLAM_STONED_EFFECT); - } - } + void RemoveStonedEffect() + { + Map* map = me->GetMap(); + if (map->IsDungeon()) + { + Map::PlayerList const &players = map->GetPlayers(); + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (itr->GetSource()->IsAlive()) + itr->GetSource()->RemoveAura(GROUND_SLAM_STONED_EFFECT); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_BOULDER: - { - if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true, 0)) - me->CastSpell(target, DUNGEON_MODE(BOULDER_TOSS, BOULDER_TOSS_H), false); + switch (events.GetEvent()) + { + case EVENT_BOULDER: + { + if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true, 0)) + me->CastSpell(target, DUNGEON_MODE(BOULDER_TOSS, BOULDER_TOSS_H), false); - events.RepeatEvent(5000 + rand()%2000); - break; - } - case EVENT_GROUND_SPIKE: - { - me->CastSpell(me->GetVictim(), GROUND_SPIKE_H, false); // current enemy target - events.RepeatEvent(8000 + rand()%3000); - break; - } - case EVENT_STOMP: - { - me->CastSpell(me, DUNGEON_MODE(STOMP, STOMP_H), false); - events.RepeatEvent(13000 + rand()% 5000); - break; - } - case EVENT_GROUND_SLAM: - { - events.RepeatEvent(10000 + rand()%3000); - me->CastSpell(me->GetVictim(), GROUND_SLAM, true); - events.DelayEvents(10000); - events.RescheduleEvent(EVENT_SHATTER, 8000); - break; - } - case EVENT_SHATTER: - { - me->CastSpell((Unit*)NULL, DUNGEON_MODE(SHATTER, SHATTER_H), false); - Talk(SAY_SHATTER); - events.RescheduleEvent(EVENT_REMOVE_STONED, 1500); - events.PopEvent(); - break; - } - case EVENT_REMOVE_STONED: - { - RemoveStonedEffect(); - events.PopEvent(); - break; - } - } + events.RepeatEvent(5000 + rand()%2000); + break; + } + case EVENT_GROUND_SPIKE: + { + me->CastSpell(me->GetVictim(), GROUND_SPIKE_H, false); // current enemy target + events.RepeatEvent(8000 + rand()%3000); + break; + } + case EVENT_STOMP: + { + me->CastSpell(me, DUNGEON_MODE(STOMP, STOMP_H), false); + events.RepeatEvent(13000 + rand()% 5000); + break; + } + case EVENT_GROUND_SLAM: + { + events.RepeatEvent(10000 + rand()%3000); + me->CastSpell(me->GetVictim(), GROUND_SLAM, true); + events.DelayEvents(10000); + events.RescheduleEvent(EVENT_SHATTER, 8000); + break; + } + case EVENT_SHATTER: + { + me->CastSpell((Unit*)NULL, DUNGEON_MODE(SHATTER, SHATTER_H), false); + Talk(SAY_SHATTER); + events.RescheduleEvent(EVENT_REMOVE_STONED, 1500); + events.PopEvent(); + break; + } + case EVENT_REMOVE_STONED: + { + RemoveStonedEffect(); + events.PopEvent(); + break; + } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(BOSS_KRYSTALLUS, DONE); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(BOSS_KRYSTALLUS, DONE); + } - void KilledUnit(Unit *victim) - { - Talk(SAY_KILL); - } - }; + void KilledUnit(Unit *victim) + { + Talk(SAY_KILL); + } + }; }; diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp index 4d788c6e4..a8134ded9 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp @@ -5,23 +5,23 @@ #include "halls_of_stone.h" enum spells { - PARTING_SORROW = 59723, - PILLAR_OF_WOE = 50761, - PILLAR_OF_WOE_H = 59727, - SHOCK_OF_SORROW = 50760, - SHOCK_OF_SORROW_H = 59726, - STORM_OF_GRIEF = 50752, - STORM_OF_GRIEF_H = 59772, + PARTING_SORROW = 59723, + PILLAR_OF_WOE = 50761, + PILLAR_OF_WOE_H = 59727, + SHOCK_OF_SORROW = 50760, + SHOCK_OF_SORROW_H = 59726, + STORM_OF_GRIEF = 50752, + STORM_OF_GRIEF_H = 59772, - ACHIEVEMENT_GOOD_GRIEF = 20383, + ACHIEVEMENT_GOOD_GRIEF = 20383, }; enum maidenEvents { - EVENT_NONE, - EVENT_STORM, - EVENT_SHOCK, - EVENT_PILLAR, - EVENT_PARTING, + EVENT_NONE, + EVENT_STORM, + EVENT_SHOCK, + EVENT_PILLAR, + EVENT_PARTING, }; enum Yells @@ -42,107 +42,107 @@ public: return new boss_maiden_of_griefAI (pCreature); } - struct boss_maiden_of_griefAI : public ScriptedAI - { - boss_maiden_of_griefAI(Creature *c) : ScriptedAI(c) - { - pInstance = me->GetInstanceScript(); - } + struct boss_maiden_of_griefAI : public ScriptedAI + { + boss_maiden_of_griefAI(Creature *c) : ScriptedAI(c) + { + pInstance = me->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - if (pInstance) - { - pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_GOOD_GRIEF); - pInstance->SetData(BOSS_MAIDEN_OF_GRIEF, NOT_STARTED); - } - } + void Reset() + { + events.Reset(); + if (pInstance) + { + pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_GOOD_GRIEF); + pInstance->SetData(BOSS_MAIDEN_OF_GRIEF, NOT_STARTED); + } + } - void EnterCombat(Unit* who) - { - events.ScheduleEvent(EVENT_STORM, 5000); - events.ScheduleEvent(EVENT_SHOCK, 26000+rand()%6000); - events.ScheduleEvent(EVENT_PILLAR, 12000+rand()%8000); - events.ScheduleEvent(EVENT_PARTING, 8000); + void EnterCombat(Unit* who) + { + events.ScheduleEvent(EVENT_STORM, 5000); + events.ScheduleEvent(EVENT_SHOCK, 26000+rand()%6000); + events.ScheduleEvent(EVENT_PILLAR, 12000+rand()%8000); + events.ScheduleEvent(EVENT_PARTING, 8000); - Talk(SAY_AGGRO); - if (pInstance) - { - pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_GOOD_GRIEF); - pInstance->SetData(BOSS_MAIDEN_OF_GRIEF, IN_PROGRESS); - } - } + Talk(SAY_AGGRO); + if (pInstance) + { + pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_GOOD_GRIEF); + pInstance->SetData(BOSS_MAIDEN_OF_GRIEF, IN_PROGRESS); + } + } - void UpdateAI(uint32 diff) - { - if(!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if(!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case EVENT_STORM: - { - me->CastSpell(me->GetVictim(), DUNGEON_MODE(STORM_OF_GRIEF, STORM_OF_GRIEF_H), true); - events.RepeatEvent(10000); - break; - } - case EVENT_SHOCK: - { - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SHOCK_OF_SORROW, SHOCK_OF_SORROW_H), false); - Talk(SAY_STUN); + switch( events.GetEvent() ) + { + case EVENT_STORM: + { + me->CastSpell(me->GetVictim(), DUNGEON_MODE(STORM_OF_GRIEF, STORM_OF_GRIEF_H), true); + events.RepeatEvent(10000); + break; + } + case EVENT_SHOCK: + { + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SHOCK_OF_SORROW, SHOCK_OF_SORROW_H), false); + Talk(SAY_STUN); - events.RepeatEvent(16000+rand()%6000); - break; - } - case EVENT_PILLAR: - { - if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true, 0)) - me->CastSpell(target, DUNGEON_MODE(PILLAR_OF_WOE, PILLAR_OF_WOE_H), false); - - events.RepeatEvent(12000+rand()%8000); - break; - } - case EVENT_PARTING: - { - if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true, 0)) - me->CastSpell(target, PARTING_SORROW, false); - - events.RepeatEvent(6000+rand()%10000); - break; - } - } + events.RepeatEvent(16000+rand()%6000); + break; + } + case EVENT_PILLAR: + { + if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true, 0)) + me->CastSpell(target, DUNGEON_MODE(PILLAR_OF_WOE, PILLAR_OF_WOE_H), false); + + events.RepeatEvent(12000+rand()%8000); + break; + } + case EVENT_PARTING: + { + if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true, 0)) + me->CastSpell(target, PARTING_SORROW, false); + + events.RepeatEvent(6000+rand()%10000); + break; + } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - - if (pInstance) - pInstance->SetData(BOSS_MAIDEN_OF_GRIEF, DONE); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + + if (pInstance) + pInstance->SetData(BOSS_MAIDEN_OF_GRIEF, DONE); + } - void KilledUnit(Unit *victim) - { - if (urand(0,1)) - return; + void KilledUnit(Unit *victim) + { + if (urand(0,1)) + return; - Talk(SAY_SLAY); - } - }; + Talk(SAY_SLAY); + } + }; }; void AddSC_boss_maiden_of_grief() { - new boss_maiden_of_grief(); + new boss_maiden_of_grief(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp index 2fdf6f5ab..b8d6fead4 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp @@ -9,37 +9,37 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - // SJONNIR - SPELL_FRENZY = 28747, //at 20% hp - SPELL_CHAIN_LIGHTNING = 50830, - SPELL_CHAIN_LIGHTNING_H = 59844, - SPELL_LIGHTNING_SHIELD = 50831, - SPELL_LIGHTNING_SHIELD_H = 59845, - SPELL_STATIC_CHARGE = 50834, - SPELL_STATIC_CHARGE_H = 59846, - SPELL_LIGHTNING_RING = 50840, - SPELL_LIGHTNING_RING_H = 59848, + // SJONNIR + SPELL_FRENZY = 28747, //at 20% hp + SPELL_CHAIN_LIGHTNING = 50830, + SPELL_CHAIN_LIGHTNING_H = 59844, + SPELL_LIGHTNING_SHIELD = 50831, + SPELL_LIGHTNING_SHIELD_H = 59845, + SPELL_STATIC_CHARGE = 50834, + SPELL_STATIC_CHARGE_H = 59846, + SPELL_LIGHTNING_RING = 50840, + SPELL_LIGHTNING_RING_H = 59848, - // IRON SLUDGE - SPELL_TOXIC_VOLLEY = 50838, - SPELL_TOXIC_VOLLEY_H = 59853, + // IRON SLUDGE + SPELL_TOXIC_VOLLEY = 50838, + SPELL_TOXIC_VOLLEY_H = 59853, - // FORGED IRON DWARF - SPELL_LIGHTNING_TETHER = 50895, - SPELL_LIGHTNING_TETHER_H = 59851, + // FORGED IRON DWARF + SPELL_LIGHTNING_TETHER = 50895, + SPELL_LIGHTNING_TETHER_H = 59851, - // FORGED IRON TROGG - SPELL_LIGHTNING_SHOCK = 50900, - SPELL_LIGHTNING_SHOCK_H = 59852, + // FORGED IRON TROGG + SPELL_LIGHTNING_SHOCK = 50900, + SPELL_LIGHTNING_SHOCK_H = 59852, }; enum Npc { - NPC_IRON_SLUDGE = 28165, // if 2 ooze then spawn 1 iron_sludge - NPC_DWARFES_FRIENDLY = 27980, //after fix the machine by Brann - NPC_OOZE = 27981, //spawn after killing dwarf - NPC_FORGED_IRON_DWARF = 27982, - NPC_FORGED_IRON_TROGG = 27979, + NPC_IRON_SLUDGE = 28165, // if 2 ooze then spawn 1 iron_sludge + NPC_DWARFES_FRIENDLY = 27980, //after fix the machine by Brann + NPC_OOZE = 27981, //spawn after killing dwarf + NPC_FORGED_IRON_DWARF = 27982, + NPC_FORGED_IRON_TROGG = 27979, }; enum Yells @@ -51,44 +51,44 @@ enum Yells enum Events { - // SJONNIR - EVENT_SHIELD = 1, - EVENT_CHAIN_LIGHTNING = 2, - EVENT_STATIC_CHARGE = 3, - EVENT_LIGHTNING_RING = 4, - EVENT_CHECK_HEALTH = 5, - EVENT_SUMMON = 6, - EVENT_SUMMON_SPEACH = 7, + // SJONNIR + EVENT_SHIELD = 1, + EVENT_CHAIN_LIGHTNING = 2, + EVENT_STATIC_CHARGE = 3, + EVENT_LIGHTNING_RING = 4, + EVENT_CHECK_HEALTH = 5, + EVENT_SUMMON = 6, + EVENT_SUMMON_SPEACH = 7, - // TRASH - EVENT_MALFORMED_OOZE_CHECK = 10, - EVENT_TOXIC_VOLLEY = 11, - EVENT_FORGED_LIGHTNING_SHOCK = 12, - EVENT_FORGED_LIGHTNING_TETHER = 13, + // TRASH + EVENT_MALFORMED_OOZE_CHECK = 10, + EVENT_TOXIC_VOLLEY = 11, + EVENT_FORGED_LIGHTNING_SHOCK = 12, + EVENT_FORGED_LIGHTNING_TETHER = 13, }; enum Misc { - POS_GEN_RIGHT = 0, - POS_GEN_LEFT = 1, - POS_ROOM_CENTER = 2, + POS_GEN_RIGHT = 0, + POS_GEN_LEFT = 1, + POS_ROOM_CENTER = 2, - // ACTIONS - ACTION_SLUG_KILLED = 1, + // ACTIONS + ACTION_SLUG_KILLED = 1, }; enum SummonPhases { - PHASE_SUMMON_UNFRIENDLY_DWARFES = 0, - PHASE_SUMMON_OOZE = 1, - PHASE_SUMMON_FRIENDLY_DWARFES = 2, + PHASE_SUMMON_UNFRIENDLY_DWARFES = 0, + PHASE_SUMMON_OOZE = 1, + PHASE_SUMMON_FRIENDLY_DWARFES = 2, }; static Position RoomPosition[] = { - {1293.0f, 610.0f, 199.3f}, - {1294.2f, 724.3f, 199.3f}, - {1295.2f, 667.1f, 189.7f}, + {1293.0f, 610.0f, 199.3f}, + {1294.2f, 724.3f, 199.3f}, + {1295.2f, 667.1f, 189.7f}, }; class boss_sjonnir : public CreatureScript @@ -101,278 +101,278 @@ public: return new boss_sjonnirAI (pCreature); } - struct boss_sjonnirAI : public ScriptedAI - { - boss_sjonnirAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = c->GetInstanceScript(); - } + struct boss_sjonnirAI : public ScriptedAI + { + boss_sjonnirAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; + InstanceScript* pInstance; + EventMap events; + SummonList summons; - uint8 SummonPhase; - uint8 SlugeCount; + uint8 SummonPhase; + uint8 SlugeCount; - void Reset() - { - events.Reset(); - summons.DespawnAll(); + void Reset() + { + events.Reset(); + summons.DespawnAll(); - SlugeCount = 0; - SummonPhase = PHASE_SUMMON_UNFRIENDLY_DWARFES; + SlugeCount = 0; + SummonPhase = PHASE_SUMMON_UNFRIENDLY_DWARFES; - if (pInstance) - { - pInstance->SetData(BOSS_SJONNIR, NOT_STARTED); - pInstance->SetData(DATA_SJONNIR_ACHIEVEMENT, false); - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (pInstance->GetData(BOSS_TRIBUNAL_OF_AGES) == DONE) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (GameObject *doors = me->GetMap()->GetGameObject(pInstance->GetData64(GO_SJONNIR_DOOR))) - doors->SetGoState(GO_STATE_ACTIVE); + if (pInstance) + { + pInstance->SetData(BOSS_SJONNIR, NOT_STARTED); + pInstance->SetData(DATA_SJONNIR_ACHIEVEMENT, false); + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (pInstance->GetData(BOSS_TRIBUNAL_OF_AGES) == DONE) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (GameObject *doors = me->GetMap()->GetGameObject(pInstance->GetData64(GO_SJONNIR_DOOR))) + doors->SetGoState(GO_STATE_ACTIVE); - if (GameObject *console = me->GetMap()->GetGameObject( pInstance->GetData64(GO_SJONNIR_CONSOLE))) - console->SetGoState(GO_STATE_READY); + if (GameObject *console = me->GetMap()->GetGameObject( pInstance->GetData64(GO_SJONNIR_CONSOLE))) + console->SetGoState(GO_STATE_READY); - if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) - { - brann->setDeathState(JUST_DIED); - brann->Respawn(); - brann->AI()->DoAction(5); - } - } - } - } + if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) + { + brann->setDeathState(JUST_DIED); + brann->Respawn(); + brann->AI()->DoAction(5); + } + } + } + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - events.ScheduleEvent(EVENT_SHIELD, 14000 + rand()%5000); - events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 6000 + rand()%6000); - events.ScheduleEvent(EVENT_STATIC_CHARGE, 24000); - events.ScheduleEvent(EVENT_LIGHTNING_RING, 25000 + rand()%6000); - events.ScheduleEvent(EVENT_SUMMON, 20000); - events.ScheduleEvent(EVENT_SUMMON, 21500); - events.ScheduleEvent(EVENT_SUMMON_SPEACH, 20000); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_SHIELD, 14000 + rand()%5000); + events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 6000 + rand()%6000); + events.ScheduleEvent(EVENT_STATIC_CHARGE, 24000); + events.ScheduleEvent(EVENT_LIGHTNING_RING, 25000 + rand()%6000); + events.ScheduleEvent(EVENT_SUMMON, 20000); + events.ScheduleEvent(EVENT_SUMMON, 21500); + events.ScheduleEvent(EVENT_SUMMON_SPEACH, 20000); - if (pInstance) - { - pInstance->SetData(BOSS_SJONNIR, IN_PROGRESS); + if (pInstance) + { + pInstance->SetData(BOSS_SJONNIR, IN_PROGRESS); - if (GameObject *doors = me->GetMap()->GetGameObject(pInstance->GetData64(GO_SJONNIR_DOOR))) - doors->SetGoState(GO_STATE_READY); - - if (pInstance->GetData(BOSS_TRIBUNAL_OF_AGES) == DONE) - if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) - brann->AI()->DoAction(3); - } - } + if (GameObject *doors = me->GetMap()->GetGameObject(pInstance->GetData64(GO_SJONNIR_DOOR))) + doors->SetGoState(GO_STATE_READY); + + if (pInstance->GetData(BOSS_TRIBUNAL_OF_AGES) == DONE) + if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) + brann->AI()->DoAction(3); + } + } - void DoAction(int32 param) - { - if (param == ACTION_SLUG_KILLED) - { - SlugeCount++; - if (SlugeCount >= 5 && pInstance) - pInstance->SetData(DATA_SJONNIR_ACHIEVEMENT, true); - } - } + void DoAction(int32 param) + { + if (param == ACTION_SLUG_KILLED) + { + SlugeCount++; + if (SlugeCount >= 5 && pInstance) + pInstance->SetData(DATA_SJONNIR_ACHIEVEMENT, true); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_CHECK_HEALTH: - { - if (SummonPhase == PHASE_SUMMON_UNFRIENDLY_DWARFES && HealthBelowPct(50)) - { - SummonPhase = PHASE_SUMMON_OOZE; - events.CancelEvent(EVENT_SUMMON); - events.ScheduleEvent(EVENT_SUMMON, 0); - events.ScheduleEvent(EVENT_SUMMON, 1500); + switch (events.GetEvent()) + { + case EVENT_CHECK_HEALTH: + { + if (SummonPhase == PHASE_SUMMON_UNFRIENDLY_DWARFES && HealthBelowPct(50)) + { + SummonPhase = PHASE_SUMMON_OOZE; + events.CancelEvent(EVENT_SUMMON); + events.ScheduleEvent(EVENT_SUMMON, 0); + events.ScheduleEvent(EVENT_SUMMON, 1500); - if (pInstance) - if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) - { - brann->MonsterYell("What in the name o' Madoran did THAT do? Oh! Wait: I just about got it...", LANG_UNIVERSAL, 0); - brann->PlayDirectSound(14276); - } - } + if (pInstance) + if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) + { + brann->MonsterYell("What in the name o' Madoran did THAT do? Oh! Wait: I just about got it...", LANG_UNIVERSAL, 0); + brann->PlayDirectSound(14276); + } + } - if (HealthBelowPct(20)) - { - if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) - { - brann->MonsterYell("Ha, that did it! Help's a-comin'! Take this, ya glowin' iron brute!", LANG_UNIVERSAL, 0); - brann->PlayDirectSound(14277); - } - SummonPhase = PHASE_SUMMON_FRIENDLY_DWARFES; - me->CastSpell(me, SPELL_FRENZY, false); + if (HealthBelowPct(20)) + { + if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) + { + brann->MonsterYell("Ha, that did it! Help's a-comin'! Take this, ya glowin' iron brute!", LANG_UNIVERSAL, 0); + brann->PlayDirectSound(14277); + } + SummonPhase = PHASE_SUMMON_FRIENDLY_DWARFES; + me->CastSpell(me, SPELL_FRENZY, false); - events.CancelEvent(EVENT_SUMMON); - events.ScheduleEvent(EVENT_SUMMON, 0); - events.PopEvent(); - break; - } + events.CancelEvent(EVENT_SUMMON); + events.ScheduleEvent(EVENT_SUMMON, 0); + events.PopEvent(); + break; + } - events.RepeatEvent(1000); - break; - } - case EVENT_SHIELD: - { - me->CastSpell(me, DUNGEON_MODE(SPELL_LIGHTNING_SHIELD, SPELL_LIGHTNING_SHIELD_H), false); - events.RepeatEvent(14000 + rand()%5000); - break; - } - case EVENT_CHAIN_LIGHTNING: - { - if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true, 0)) - me->CastSpell(target, DUNGEON_MODE(SPELL_CHAIN_LIGHTNING, SPELL_CHAIN_LIGHTNING_H), false); + events.RepeatEvent(1000); + break; + } + case EVENT_SHIELD: + { + me->CastSpell(me, DUNGEON_MODE(SPELL_LIGHTNING_SHIELD, SPELL_LIGHTNING_SHIELD_H), false); + events.RepeatEvent(14000 + rand()%5000); + break; + } + case EVENT_CHAIN_LIGHTNING: + { + if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true, 0)) + me->CastSpell(target, DUNGEON_MODE(SPELL_CHAIN_LIGHTNING, SPELL_CHAIN_LIGHTNING_H), false); - events.RepeatEvent(6000 + rand()%6000); - break; - } - case EVENT_STATIC_CHARGE: - { - if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true, 0)) - me->CastSpell(target, DUNGEON_MODE(SPELL_STATIC_CHARGE, SPELL_STATIC_CHARGE_H), false); + events.RepeatEvent(6000 + rand()%6000); + break; + } + case EVENT_STATIC_CHARGE: + { + if (Unit *target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true, 0)) + me->CastSpell(target, DUNGEON_MODE(SPELL_STATIC_CHARGE, SPELL_STATIC_CHARGE_H), false); - events.RepeatEvent(20000); - break; - } - case EVENT_LIGHTNING_RING: - { - me->CastSpell(me, DUNGEON_MODE(SPELL_LIGHTNING_RING, SPELL_LIGHTNING_RING_H), false); - events.RepeatEvent(25000 + rand()%6000); - events.DelayEvents(10000); // Channel duration - break; - } - case EVENT_SUMMON_SPEACH: - { - if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) - { - brann->MonsterYell("This is a wee bit trickier that before... Oh, bloody--incomin'!", LANG_UNIVERSAL, 0); - brann->PlayDirectSound(14275); - } + events.RepeatEvent(20000); + break; + } + case EVENT_LIGHTNING_RING: + { + me->CastSpell(me, DUNGEON_MODE(SPELL_LIGHTNING_RING, SPELL_LIGHTNING_RING_H), false); + events.RepeatEvent(25000 + rand()%6000); + events.DelayEvents(10000); // Channel duration + break; + } + case EVENT_SUMMON_SPEACH: + { + if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) + { + brann->MonsterYell("This is a wee bit trickier that before... Oh, bloody--incomin'!", LANG_UNIVERSAL, 0); + brann->PlayDirectSound(14275); + } - events.PopEvent(); - break; - } - case EVENT_SUMMON: - { - switch (SummonPhase) - { - case PHASE_SUMMON_UNFRIENDLY_DWARFES: - { - SummonDwarfes(false); - events.RepeatEvent(20000); - break; - } - case PHASE_SUMMON_OOZE: - { - for (uint8 i = POS_GEN_RIGHT; i <= POS_GEN_LEFT; i++) - { - if (Creature* ooze = me->SummonCreature(NPC_OOZE, RoomPosition[i].GetPositionX(), RoomPosition[i].GetPositionY(), RoomPosition[i].GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) - { - ActivatePipe(i); - ooze->GetMotionMaster()->MovePoint(0, RoomPosition[POS_ROOM_CENTER].GetPositionX(), RoomPosition[POS_ROOM_CENTER].GetPositionY(), RoomPosition[POS_ROOM_CENTER].GetPositionZ()); - summons.Summon(ooze); - } - } - events.RepeatEvent(10000); - break; - } - case PHASE_SUMMON_FRIENDLY_DWARFES: - { - SummonDwarfes(true); - events.PopEvent(); - break; - } - } - break; - } - } - - DoMeleeAttackIfReady(); - } + events.PopEvent(); + break; + } + case EVENT_SUMMON: + { + switch (SummonPhase) + { + case PHASE_SUMMON_UNFRIENDLY_DWARFES: + { + SummonDwarfes(false); + events.RepeatEvent(20000); + break; + } + case PHASE_SUMMON_OOZE: + { + for (uint8 i = POS_GEN_RIGHT; i <= POS_GEN_LEFT; i++) + { + if (Creature* ooze = me->SummonCreature(NPC_OOZE, RoomPosition[i].GetPositionX(), RoomPosition[i].GetPositionY(), RoomPosition[i].GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) + { + ActivatePipe(i); + ooze->GetMotionMaster()->MovePoint(0, RoomPosition[POS_ROOM_CENTER].GetPositionX(), RoomPosition[POS_ROOM_CENTER].GetPositionY(), RoomPosition[POS_ROOM_CENTER].GetPositionZ()); + summons.Summon(ooze); + } + } + events.RepeatEvent(10000); + break; + } + case PHASE_SUMMON_FRIENDLY_DWARFES: + { + SummonDwarfes(true); + events.PopEvent(); + break; + } + } + break; + } + } + + DoMeleeAttackIfReady(); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); - summons.DespawnAll(); - if (pInstance) - { - pInstance->SetData(BOSS_SJONNIR, DONE); - if (GameObject *sd = me->GetMap()->GetGameObject(pInstance->GetData64(GO_SJONNIR_DOOR))) - sd->SetGoState(GO_STATE_ACTIVE); + summons.DespawnAll(); + if (pInstance) + { + pInstance->SetData(BOSS_SJONNIR, DONE); + if (GameObject *sd = me->GetMap()->GetGameObject(pInstance->GetData64(GO_SJONNIR_DOOR))) + sd->SetGoState(GO_STATE_ACTIVE); - if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) - brann->AI()->DoAction(4); - } - } + if (Creature *brann = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_BRANN))) + brann->AI()->DoAction(4); + } + } - void KilledUnit(Unit *victim) - { - if (urand(0,1)) - return; + void KilledUnit(Unit *victim) + { + if (urand(0,1)) + return; - Talk(SAY_SLAY); - } + Talk(SAY_SLAY); + } - void ActivatePipe(uint8 side) - { - if (pInstance) - if (GameObject *pipe = me->GetMap()->GetGameObject(pInstance->GetData64(side == POS_GEN_RIGHT ? GO_RIGHT_PIPE : GO_LEFT_PIPE))) - pipe->SendCustomAnim(0); - } + void ActivatePipe(uint8 side) + { + if (pInstance) + if (GameObject *pipe = me->GetMap()->GetGameObject(pInstance->GetData64(side == POS_GEN_RIGHT ? GO_RIGHT_PIPE : GO_LEFT_PIPE))) + pipe->SendCustomAnim(0); + } - void SummonDwarfes(bool friendly) - { - if (friendly) - { - for (int i = 0; i < 3; i++) - { - uint8 Pos = urand(POS_GEN_RIGHT, POS_GEN_LEFT); - if (Creature* dwarf = me->SummonCreature(NPC_DWARFES_FRIENDLY, RoomPosition[Pos].GetPositionX(), RoomPosition[Pos].GetPositionY() , RoomPosition[Pos].GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) - { - if (Player *plr = SelectTargetFromPlayerList(100.0f)) - dwarf->setFaction(plr->getFaction()); + void SummonDwarfes(bool friendly) + { + if (friendly) + { + for (int i = 0; i < 3; i++) + { + uint8 Pos = urand(POS_GEN_RIGHT, POS_GEN_LEFT); + if (Creature* dwarf = me->SummonCreature(NPC_DWARFES_FRIENDLY, RoomPosition[Pos].GetPositionX(), RoomPosition[Pos].GetPositionY() , RoomPosition[Pos].GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) + { + if (Player *plr = SelectTargetFromPlayerList(100.0f)) + dwarf->setFaction(plr->getFaction()); - ActivatePipe(Pos); - dwarf->AI()->AttackStart(me); - summons.Summon(dwarf); - } - } - } - else - { - for (int i = 0; i < 2; i++) - { - uint8 Pos = urand(POS_GEN_RIGHT, POS_GEN_LEFT); - if (Creature* dwarf = me->SummonCreature(urand(0,1) ? NPC_FORGED_IRON_TROGG : NPC_FORGED_IRON_DWARF, RoomPosition[Pos].GetPositionX(), RoomPosition[Pos].GetPositionY() , RoomPosition[Pos].GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) - { - ActivatePipe(Pos); - dwarf->SetInCombatWithZone(); - summons.Summon(dwarf); - } - } - } - } - }; + ActivatePipe(Pos); + dwarf->AI()->AttackStart(me); + summons.Summon(dwarf); + } + } + } + else + { + for (int i = 0; i < 2; i++) + { + uint8 Pos = urand(POS_GEN_RIGHT, POS_GEN_LEFT); + if (Creature* dwarf = me->SummonCreature(urand(0,1) ? NPC_FORGED_IRON_TROGG : NPC_FORGED_IRON_DWARF, RoomPosition[Pos].GetPositionX(), RoomPosition[Pos].GetPositionY() , RoomPosition[Pos].GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) + { + ActivatePipe(Pos); + dwarf->SetInCombatWithZone(); + summons.Summon(dwarf); + } + } + } + } + }; }; class boss_sjonnir_dwarf : public CreatureScript @@ -385,18 +385,18 @@ public: return new boss_sjonnir_dwarfAI (pCreature); } - struct boss_sjonnir_dwarfAI : public ScriptedAI - { - boss_sjonnir_dwarfAI(Creature *c) : ScriptedAI(c) { } + struct boss_sjonnir_dwarfAI : public ScriptedAI + { + boss_sjonnir_dwarfAI(Creature *c) : ScriptedAI(c) { } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - DoSpellAttackIfReady((me->GetEntry() == NPC_FORGED_IRON_DWARF) ? DUNGEON_MODE(SPELL_LIGHTNING_TETHER, SPELL_LIGHTNING_TETHER_H) : DUNGEON_MODE(SPELL_LIGHTNING_SHOCK, SPELL_LIGHTNING_SHOCK_H)); - } - }; + DoSpellAttackIfReady((me->GetEntry() == NPC_FORGED_IRON_DWARF) ? DUNGEON_MODE(SPELL_LIGHTNING_TETHER, SPELL_LIGHTNING_TETHER_H) : DUNGEON_MODE(SPELL_LIGHTNING_SHOCK, SPELL_LIGHTNING_SHOCK_H)); + } + }; }; class boss_sjonnir_iron_sludge : public CreatureScript @@ -409,49 +409,49 @@ public: return new boss_sjonnir_iron_sludgeAI (pCreature); } - struct boss_sjonnir_iron_sludgeAI : public ScriptedAI - { - boss_sjonnir_iron_sludgeAI(Creature *c) : ScriptedAI(c) { } - - EventMap events; - void Reset() - { - events.Reset(); - } + struct boss_sjonnir_iron_sludgeAI : public ScriptedAI + { + boss_sjonnir_iron_sludgeAI(Creature *c) : ScriptedAI(c) { } + + EventMap events; + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit *) - { - events.ScheduleEvent(EVENT_TOXIC_VOLLEY, 5000); - } - void JustDied(Unit* killer) - { - if (InstanceScript *pInstance = me->GetInstanceScript()) - if (Creature *sjonnir = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_SJONNIR))) - sjonnir->AI()->DoAction(ACTION_SLUG_KILLED); - } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit *) + { + events.ScheduleEvent(EVENT_TOXIC_VOLLEY, 5000); + } + void JustDied(Unit* killer) + { + if (InstanceScript *pInstance = me->GetInstanceScript()) + if (Creature *sjonnir = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_SJONNIR))) + sjonnir->AI()->DoAction(ACTION_SLUG_KILLED); + } + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - // Every 5 seconds - case EVENT_TOXIC_VOLLEY: - { - me->CastSpell(me, DUNGEON_MODE(SPELL_TOXIC_VOLLEY, SPELL_TOXIC_VOLLEY_H), false); - events.RepeatEvent(5000); - break; - } - } + switch (events.GetEvent()) + { + // Every 5 seconds + case EVENT_TOXIC_VOLLEY: + { + me->CastSpell(me, DUNGEON_MODE(SPELL_TOXIC_VOLLEY, SPELL_TOXIC_VOLLEY_H), false); + events.RepeatEvent(5000); + break; + } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; //OOZE @@ -465,51 +465,51 @@ public: return new boss_sjonnir_malformed_oozeAI (pCreature); } - struct boss_sjonnir_malformed_oozeAI : public ScriptedAI - { - boss_sjonnir_malformed_oozeAI(Creature *c) : ScriptedAI(c) { } + struct boss_sjonnir_malformed_oozeAI : public ScriptedAI + { + boss_sjonnir_malformed_oozeAI(Creature *c) : ScriptedAI(c) { } - EventMap events; - void MovementInform(uint32 type, uint32 point) - { - if (type == POINT_MOTION_TYPE && point == 0) - events.RescheduleEvent(EVENT_MALFORMED_OOZE_CHECK, 1000); - } + EventMap events; + void MovementInform(uint32 type, uint32 point) + { + if (type == POINT_MOTION_TYPE && point == 0) + events.RescheduleEvent(EVENT_MALFORMED_OOZE_CHECK, 1000); + } - void EnterCombat(Unit *) { } - void MoveInLineOfSight(Unit *) { } + void EnterCombat(Unit *) { } + void MoveInLineOfSight(Unit *) { } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_MALFORMED_OOZE_CHECK: - { - std::list oozeList; - me->GetCreaturesWithEntryInRange(oozeList, 5.0f, NPC_OOZE); - for (std::list::const_iterator itr = oozeList.begin(); itr != oozeList.end(); ++itr) - if ((*itr)->GetGUID() != me->GetGUID() && (*itr)->IsAlive() && me->IsAlive()) - if (Creature* is = me->SummonCreature(NPC_IRON_SLUDGE, me->GetPositionX(), me->GetPositionY() , me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000)) - { - Unit::Kill(me, me); - Unit::Kill(*itr, *itr); - is->SetInCombatWithZone(); - break; - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_MALFORMED_OOZE_CHECK: + { + std::list oozeList; + me->GetCreaturesWithEntryInRange(oozeList, 5.0f, NPC_OOZE); + for (std::list::const_iterator itr = oozeList.begin(); itr != oozeList.end(); ++itr) + if ((*itr)->GetGUID() != me->GetGUID() && (*itr)->IsAlive() && me->IsAlive()) + if (Creature* is = me->SummonCreature(NPC_IRON_SLUDGE, me->GetPositionX(), me->GetPositionY() , me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000)) + { + Unit::Kill(me, me); + Unit::Kill(*itr, *itr); + is->SetInCombatWithZone(); + break; + } - events.RepeatEvent(1000); - break; - } - } - } - }; + events.RepeatEvent(1000); + break; + } + } + } + }; }; void AddSC_boss_sjonnir() { - new boss_sjonnir(); - new boss_sjonnir_dwarf(); - new boss_sjonnir_malformed_ooze(); - new boss_sjonnir_iron_sludge(); + new boss_sjonnir(); + new boss_sjonnir_dwarf(); + new boss_sjonnir_malformed_ooze(); + new boss_sjonnir_iron_sludge(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/brann_bronzebeard.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/brann_bronzebeard.cpp index 3b225e214..35da0f744 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/brann_bronzebeard.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/brann_bronzebeard.cpp @@ -10,137 +10,137 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! #include "SpellScript.h" #include "Player.h" -#define GOSSIP_ITEM_1 "Brann, it would be our honor!" -#define GOSSIP_ITEM_2 "Let's move Brann, enough of the history lessons!" -#define GOSSIP_ITEM_3 "We dont have time for this right now, we have to keep going." -#define TEXT_ID_START 13100 -#define YELL_AGGRO "You be dead soon enough!" +#define GOSSIP_ITEM_1 "Brann, it would be our honor!" +#define GOSSIP_ITEM_2 "Let's move Brann, enough of the history lessons!" +#define GOSSIP_ITEM_3 "We dont have time for this right now, we have to keep going." +#define TEXT_ID_START 13100 +#define YELL_AGGRO "You be dead soon enough!" enum NPCs { - NPC_DARK_RUNE_PROTECTOR = 27983, - NPC_DARK_RUNE_STORMCALLER = 27984, - NPC_IRON_GOLEM_CUSTODIAN = 27985, - NPC_DARK_MATTER_TRIGGER = 28237, - NPC_SEARING_GAZE_TRIGGER = 28265, + NPC_DARK_RUNE_PROTECTOR = 27983, + NPC_DARK_RUNE_STORMCALLER = 27984, + NPC_IRON_GOLEM_CUSTODIAN = 27985, + NPC_DARK_MATTER_TRIGGER = 28237, + NPC_SEARING_GAZE_TRIGGER = 28265, }; enum Misc { - // BRANN EVENT - SPELL_GLARE_OF_THE_TRIBUNAL = 50988, - SPELL_GLARE_OF_THE_TRIBUNAL_H = 59870, - SPELL_DARK_MATTER_VISUAL = 51001, - SPELL_DARK_MATTER = 51012, - SPELL_DARK_MATTER_H = 59868, - SPELL_SEARING_GAZE = 51136, - SPELL_SEARING_GAZE_H = 59867, + // BRANN EVENT + SPELL_GLARE_OF_THE_TRIBUNAL = 50988, + SPELL_GLARE_OF_THE_TRIBUNAL_H = 59870, + SPELL_DARK_MATTER_VISUAL = 51001, + SPELL_DARK_MATTER = 51012, + SPELL_DARK_MATTER_H = 59868, + SPELL_SEARING_GAZE = 51136, + SPELL_SEARING_GAZE_H = 59867, - // DARK RUNE PROTECTOR - SPELL_DRP_CHARGE = 22120, - SPELL_DRP_CLEAVE = 42724, + // DARK RUNE PROTECTOR + SPELL_DRP_CHARGE = 22120, + SPELL_DRP_CLEAVE = 42724, - // DARK RUNE STORMCALLER - SPELL_DRS_LIGHTING_BOLT = 12167, - SPELL_DRS_LIGHTING_BOLT_H = 59863, - SPELL_DRS_SHADOW_WORD_PAIN = 15654, - SPELL_DRS_SHADOW_WORD_PAIN_H = 59864, + // DARK RUNE STORMCALLER + SPELL_DRS_LIGHTING_BOLT = 12167, + SPELL_DRS_LIGHTING_BOLT_H = 59863, + SPELL_DRS_SHADOW_WORD_PAIN = 15654, + SPELL_DRS_SHADOW_WORD_PAIN_H = 59864, - // IRON GOLEM CUSTODIAN - SPELL_IGC_CRUSH_ARMOR = 33661, - SPELL_IGC_GROUND_SMASH = 12734, - SPELL_IGC_GROUND_SMASH_H = 59865, + // IRON GOLEM CUSTODIAN + SPELL_IGC_CRUSH_ARMOR = 33661, + SPELL_IGC_GROUND_SMASH = 12734, + SPELL_IGC_GROUND_SMASH_H = 59865, - // ACTIONS - ACTION_START_EVENT = 0, - ACTION_START_TRIBUNAL = 1, - ACTION_GO_TO_SJONNIR = 2, - ACTION_START_SJONNIR_FIGHT = 3, - ACTION_SJONNIR_DEAD = 4, - ACTION_ENTEREVADEMODE = 5, - ACTION_WIPE_START = 6, + // ACTIONS + ACTION_START_EVENT = 0, + ACTION_START_TRIBUNAL = 1, + ACTION_GO_TO_SJONNIR = 2, + ACTION_START_SJONNIR_FIGHT = 3, + ACTION_SJONNIR_DEAD = 4, + ACTION_ENTEREVADEMODE = 5, + ACTION_WIPE_START = 6, - // QUESTS - QUEST_HALLS_OF_STONE = 13207, + // QUESTS + QUEST_HALLS_OF_STONE = 13207, }; enum events { - // BRANN - EVENT_KADDRAK_HEAD = 1, - EVENT_MARNAK_HEAD = 2, - EVENT_ABEDNEUM_HEAD = 3, - EVENT_SUMMON_MONSTERS = 4, - EVENT_TRIBUNAL_END = 5, - EVENT_GO_TO_SJONNIR = 6, - EVENT_END = 7, - EVENT_KADDRAK_VISUAL = 8, - EVENT_MARNAK_VISUAL = 9, - EVENT_ABEDNEUM_VISUAL = 10, - EVENT_KADDRAK_SWITCH_EYE = 11, + // BRANN + EVENT_KADDRAK_HEAD = 1, + EVENT_MARNAK_HEAD = 2, + EVENT_ABEDNEUM_HEAD = 3, + EVENT_SUMMON_MONSTERS = 4, + EVENT_TRIBUNAL_END = 5, + EVENT_GO_TO_SJONNIR = 6, + EVENT_END = 7, + EVENT_KADDRAK_VISUAL = 8, + EVENT_MARNAK_VISUAL = 9, + EVENT_ABEDNEUM_VISUAL = 10, + EVENT_KADDRAK_SWITCH_EYE = 11, - // DARK RUNE PROTECTOR - EVENT_DRP_CHARGE = 15, - EVENT_DRP_CLEAVE = 16, + // DARK RUNE PROTECTOR + EVENT_DRP_CHARGE = 15, + EVENT_DRP_CLEAVE = 16, - // DARK RUNE STORMCALLER - EVENT_DRS_LIGHTNING_BOLD = 20, - EVENT_DRS_SHADOW_WORD_PAIN = 21, + // DARK RUNE STORMCALLER + EVENT_DRS_LIGHTNING_BOLD = 20, + EVENT_DRS_SHADOW_WORD_PAIN = 21, - // IRON GOLEM CUSTODIAN - EVENT_IGC_CRUSH = 30, - EVENT_IGC_GROUND_SMASH = 31, + // IRON GOLEM CUSTODIAN + EVENT_IGC_CRUSH = 30, + EVENT_IGC_GROUND_SMASH = 31, }; struct Yells { - uint32 sound; - const char* text; - uint32 creature, timer; + uint32 sound; + const char* text; + uint32 creature, timer; }; static Yells Conversation[]= { - {14259, "Time to get some answers! Let's get this show on the road!", NPC_BRANN, 0}, - {14247, "Take a moment and relish this with me. Soon... all will be revealed. Okay then, let's do this!", NPC_BRANN, 5000}, - {14248, "Now keep an eye out! I'll have this licked in two shakes of a--", NPC_BRANN, 17000}, - {13765, "Warning: life form pattern not recognized. Archival processing terminated. Continued interference will result in targeted response.", NPC_ABEDNEUM, 20500}, - {14249, "Oh, that doesn't sound good. We might have a complication or two...", NPC_BRANN, 32000}, - {13756, "Security breach in progress. Analysis of historical archives transferred to lower-priority queue. Countermeasures engaged.", NPC_KADDRAK, 37000}, - {14250, "Ah, you want to play hardball, eh? That's just my game!", NPC_BRANN, 49000}, - {14251, "Couple more minutes and I'll--", NPC_BRANN, 100000}, - {13761, "Threat index threshold exceeded. Celestial archive aborted. Security level heightened.", NPC_MARNAK, 105000}, - {14252, "Heightened? What's the good news?", NPC_BRANN, 116000}, - {14253, "So that was the problem? Now I'm makin' progress...", NPC_BRANN, 195000}, - {13767, "Critical threat index. Void analysis diverted. Initiating sanitization protocol.", NPC_ABEDNEUM, 205000}, - {14254, "Hang on! Nobody's gonna' be sanitized as long as I have a say in it!", NPC_BRANN, 215000}, - {14255, "Ha! The old magic fingers finally won through! Now let's get down to--", NPC_BRANN, 295000}, - {13768, "Alert: security fail-safes deactivated. Beginning memory purge and... ", NPC_ABEDNEUM, 303000}, - //The fight is completed at this point. - {14256, "Purge? No no no no no.. where did I-- Aha, this should do the trick...", NPC_BRANN, 310000}, - {13769, "System online. Life form pattern recognized. Welcome, Branbronzan. Query?", NPC_ABEDNEUM, 321000}, - {14263, "Query? What do you think I'm here for, tea and biscuits? Spill the beans already!", NPC_BRANN, 329000}, - {14264, "Tell me how the dwarves came to be, and start at the beginning!", NPC_BRANN, 336000}, - {13770, "Accessing prehistoric data... retrieved. In the beginning the earthen were created to--", NPC_ABEDNEUM, 342000}, - {14265, "Right, right... I know the earthen were made from stone to shape the deep regions o' the world. But what about the anomalies? Matrix non-stabilizin' and what-not?", NPC_BRANN, 348000}, - {13771, "Accessing... In the early stages of it's development cycle, Azeroth suffered infection by parasitic necrophotic symbiotes.", NPC_ABEDNEUM, 360000}, - {14266, "Necrowhatinthe-- Speak bloody Common, will ye?", NPC_BRANN, 373500}, - {13772, "Designation: Old Gods. Old Gods rendered all systems, including earthen, defenseless in order to facilitate assimilation. This matrix destabilization has been termed the Curse of Flesh. Effects of destabilization increased over time.", NPC_ABEDNEUM, 380000}, - {14267, "Old Gods, huh? So they zapped the earthen with this Curse of Flesh... and then what?", NPC_BRANN, 399500}, - {13757, "Accessing... Creators arrived to extirpate symbiotic infection. Assessment revealed that Old God infestation had grown malignant. Excising parasites would result in loss of host--", NPC_KADDRAK, 406000}, - {14268, "If they killed the Old Gods, Azeroth would've been destroyed...", NPC_BRANN, 424000}, - {13758, "Correct. Creators neutralized parasitic threat and contained it within the host. Forge of Wills and other systems were instituted to create new earthen. Safeguards were implemented, and protectors were appointed.", NPC_KADDRAK, 429000}, - {14269, "What protectors?", NPC_BRANN, 449000}, - {13759, "Designations: Aesir and Vanir. Or in the common nomenclature, storm and earth giants. Sentinel Loken designated supreme. Dragon Aspects appointed to monitor evolution on Azeroth.", NPC_KADDRAK, 452000}, - {14270, "Aesir and Vanir... Okay, so the Forge o' Wills started makin' new earthen... but what happened to the old ones?", NPC_BRANN, 471000}, - {13762, "Additional background is relevant to your query: following global combat between Aesir and Vanir--", NPC_MARNAK, 482000}, - {14271, "Hold everything! The Aesir and Vanir went to war? Why?", NPC_BRANN, 489000}, - {13763, "Unknown. Data suggests that impetus for global combat originated with prime designate Loken, who neutralized all remaining Aesir and Vanir, affecting termination of conflict. Prime designate Loken then initiated stasis of several seed races, including earthen, giants and vrykul, at designated holding facilities.", NPC_MARNAK, 494000}, - {14272, "This Loken sounds like a nasty character. Glad we don't have to worry about the likes o' him anymore. So... if I'm understandin' ye right, the original earthen eventually woke up from this stasis, and by that time the destabili-whatever had turned 'em into proper dwarves. Or at least... dwarf ancestors.", NPC_BRANN, 519000}, - {13764, "Essentially that is correct.", NPC_MARNAK, 543000}, - {14273, "Well, now... that's a lot to digest. I'm gonna need some time to take all this in. Thank ye.", NPC_BRANN, 549000}, - {13773, "Acknowledged, Branbronzan. Session terminated.", NPC_ABEDNEUM, 559000}, - {0, "I think it's time to see what's behind the door near the entrance. I'm going to sneak over there, nice and quiet. Meet me at the door and I'll get us in.", NPC_BRANN, 574000}, + {14259, "Time to get some answers! Let's get this show on the road!", NPC_BRANN, 0}, + {14247, "Take a moment and relish this with me. Soon... all will be revealed. Okay then, let's do this!", NPC_BRANN, 5000}, + {14248, "Now keep an eye out! I'll have this licked in two shakes of a--", NPC_BRANN, 17000}, + {13765, "Warning: life form pattern not recognized. Archival processing terminated. Continued interference will result in targeted response.", NPC_ABEDNEUM, 20500}, + {14249, "Oh, that doesn't sound good. We might have a complication or two...", NPC_BRANN, 32000}, + {13756, "Security breach in progress. Analysis of historical archives transferred to lower-priority queue. Countermeasures engaged.", NPC_KADDRAK, 37000}, + {14250, "Ah, you want to play hardball, eh? That's just my game!", NPC_BRANN, 49000}, + {14251, "Couple more minutes and I'll--", NPC_BRANN, 100000}, + {13761, "Threat index threshold exceeded. Celestial archive aborted. Security level heightened.", NPC_MARNAK, 105000}, + {14252, "Heightened? What's the good news?", NPC_BRANN, 116000}, + {14253, "So that was the problem? Now I'm makin' progress...", NPC_BRANN, 195000}, + {13767, "Critical threat index. Void analysis diverted. Initiating sanitization protocol.", NPC_ABEDNEUM, 205000}, + {14254, "Hang on! Nobody's gonna' be sanitized as long as I have a say in it!", NPC_BRANN, 215000}, + {14255, "Ha! The old magic fingers finally won through! Now let's get down to--", NPC_BRANN, 295000}, + {13768, "Alert: security fail-safes deactivated. Beginning memory purge and... ", NPC_ABEDNEUM, 303000}, + //The fight is completed at this point. + {14256, "Purge? No no no no no.. where did I-- Aha, this should do the trick...", NPC_BRANN, 310000}, + {13769, "System online. Life form pattern recognized. Welcome, Branbronzan. Query?", NPC_ABEDNEUM, 321000}, + {14263, "Query? What do you think I'm here for, tea and biscuits? Spill the beans already!", NPC_BRANN, 329000}, + {14264, "Tell me how the dwarves came to be, and start at the beginning!", NPC_BRANN, 336000}, + {13770, "Accessing prehistoric data... retrieved. In the beginning the earthen were created to--", NPC_ABEDNEUM, 342000}, + {14265, "Right, right... I know the earthen were made from stone to shape the deep regions o' the world. But what about the anomalies? Matrix non-stabilizin' and what-not?", NPC_BRANN, 348000}, + {13771, "Accessing... In the early stages of it's development cycle, Azeroth suffered infection by parasitic necrophotic symbiotes.", NPC_ABEDNEUM, 360000}, + {14266, "Necrowhatinthe-- Speak bloody Common, will ye?", NPC_BRANN, 373500}, + {13772, "Designation: Old Gods. Old Gods rendered all systems, including earthen, defenseless in order to facilitate assimilation. This matrix destabilization has been termed the Curse of Flesh. Effects of destabilization increased over time.", NPC_ABEDNEUM, 380000}, + {14267, "Old Gods, huh? So they zapped the earthen with this Curse of Flesh... and then what?", NPC_BRANN, 399500}, + {13757, "Accessing... Creators arrived to extirpate symbiotic infection. Assessment revealed that Old God infestation had grown malignant. Excising parasites would result in loss of host--", NPC_KADDRAK, 406000}, + {14268, "If they killed the Old Gods, Azeroth would've been destroyed...", NPC_BRANN, 424000}, + {13758, "Correct. Creators neutralized parasitic threat and contained it within the host. Forge of Wills and other systems were instituted to create new earthen. Safeguards were implemented, and protectors were appointed.", NPC_KADDRAK, 429000}, + {14269, "What protectors?", NPC_BRANN, 449000}, + {13759, "Designations: Aesir and Vanir. Or in the common nomenclature, storm and earth giants. Sentinel Loken designated supreme. Dragon Aspects appointed to monitor evolution on Azeroth.", NPC_KADDRAK, 452000}, + {14270, "Aesir and Vanir... Okay, so the Forge o' Wills started makin' new earthen... but what happened to the old ones?", NPC_BRANN, 471000}, + {13762, "Additional background is relevant to your query: following global combat between Aesir and Vanir--", NPC_MARNAK, 482000}, + {14271, "Hold everything! The Aesir and Vanir went to war? Why?", NPC_BRANN, 489000}, + {13763, "Unknown. Data suggests that impetus for global combat originated with prime designate Loken, who neutralized all remaining Aesir and Vanir, affecting termination of conflict. Prime designate Loken then initiated stasis of several seed races, including earthen, giants and vrykul, at designated holding facilities.", NPC_MARNAK, 494000}, + {14272, "This Loken sounds like a nasty character. Glad we don't have to worry about the likes o' him anymore. So... if I'm understandin' ye right, the original earthen eventually woke up from this stasis, and by that time the destabili-whatever had turned 'em into proper dwarves. Or at least... dwarf ancestors.", NPC_BRANN, 519000}, + {13764, "Essentially that is correct.", NPC_MARNAK, 543000}, + {14273, "Well, now... that's a lot to digest. I'm gonna need some time to take all this in. Thank ye.", NPC_BRANN, 549000}, + {13773, "Acknowledged, Branbronzan. Session terminated.", NPC_ABEDNEUM, 559000}, + {0, "I think it's time to see what's behind the door near the entrance. I'm going to sneak over there, nice and quiet. Meet me at the door and I'll get us in.", NPC_BRANN, 574000}, }; class brann_bronzebeard : public CreatureScript @@ -148,510 +148,510 @@ class brann_bronzebeard : public CreatureScript public: brann_bronzebeard() : CreatureScript("brann_bronzebeard") { } - bool OnGossipHello(Player *player, Creature *pCreature) - { - InstanceScript* pInstance = (pCreature->GetInstanceScript()); + bool OnGossipHello(Player *player, Creature *pCreature) + { + InstanceScript* pInstance = (pCreature->GetInstanceScript()); - player->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - player->PrepareGossipMenu(pCreature, 0, true); - if (pInstance) - { - uint32 brann = pInstance->GetData(BRANN_BRONZEBEARD); - switch (brann) - { - case 1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - break; - case 2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - break; - case 3: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - break; - case 4: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - break; - default: break; - } + player->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + player->PrepareGossipMenu(pCreature, 0, true); + if (pInstance) + { + uint32 brann = pInstance->GetData(BRANN_BRONZEBEARD); + switch (brann) + { + case 1: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + break; + case 2: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + break; + case 3: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + break; + case 4: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + break; + default: break; + } - } - player->SEND_GOSSIP_MENU(TEXT_ID_START, pCreature->GetGUID()); - return true; - } + } + player->SEND_GOSSIP_MENU(TEXT_ID_START, pCreature->GetGUID()); + return true; + } - bool OnGossipSelect(Player *player, Creature *pCreature, uint32 sender, uint32 action ) - { - if (action) - { - switch (action) - { - case GOSSIP_ACTION_INFO_DEF+1: - pCreature->AI()->DoAction(ACTION_START_EVENT); - player->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pCreature->AI()->DoAction(ACTION_START_TRIBUNAL); - player->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pCreature->AI()->DoAction(ACTION_GO_TO_SJONNIR); - player->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pCreature->AI()->DoAction(ACTION_WIPE_START); - player->CLOSE_GOSSIP_MENU(); - break; - } - } - return true; - } + bool OnGossipSelect(Player *player, Creature *pCreature, uint32 sender, uint32 action ) + { + if (action) + { + switch (action) + { + case GOSSIP_ACTION_INFO_DEF+1: + pCreature->AI()->DoAction(ACTION_START_EVENT); + player->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pCreature->AI()->DoAction(ACTION_START_TRIBUNAL); + player->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pCreature->AI()->DoAction(ACTION_GO_TO_SJONNIR); + player->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pCreature->AI()->DoAction(ACTION_WIPE_START); + player->CLOSE_GOSSIP_MENU(); + break; + } + } + return true; + } CreatureAI* GetAI(Creature* pCreature) const { return new brann_bronzebeardAI (pCreature); } - struct brann_bronzebeardAI : public npc_escortAI - { + struct brann_bronzebeardAI : public npc_escortAI + { - brann_bronzebeardAI(Creature *c) : npc_escortAI(c), summons(me) - { - AbedneumGUID = MarnakGUID = KaddrakGUID = 0; - pInstance = c->GetInstanceScript(); - } + brann_bronzebeardAI(Creature *c) : npc_escortAI(c), summons(me) + { + AbedneumGUID = MarnakGUID = KaddrakGUID = 0; + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint64 AbedneumGUID; - uint64 MarnakGUID; - uint64 KaddrakGUID; - uint8 WaveNum; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint64 AbedneumGUID; + uint64 MarnakGUID; + uint64 KaddrakGUID; + uint8 WaveNum; - bool TalkEvent; - uint32 SpeechCount, SpeechPause; + bool TalkEvent; + uint32 SpeechCount, SpeechPause; - void DespawnHeads() - { - Creature *cr; - if (cr = GetAbedneum()) cr->DespawnOrUnsummon(); - if (cr = GetMarnak()) cr->DespawnOrUnsummon(); - if (cr = GetKaddrak()) cr->DespawnOrUnsummon(); - SwitchHeadVisaul(0x7, false); - } + void DespawnHeads() + { + Creature *cr; + if (cr = GetAbedneum()) cr->DespawnOrUnsummon(); + if (cr = GetMarnak()) cr->DespawnOrUnsummon(); + if (cr = GetKaddrak()) cr->DespawnOrUnsummon(); + SwitchHeadVisaul(0x7, false); + } - void SwitchHeadVisaul(uint8 headMask, bool activate) - { - if (!pInstance) - return; + void SwitchHeadVisaul(uint8 headMask, bool activate) + { + if (!pInstance) + return; - GameObject *go = NULL; - if (headMask & 0x1) // Kaddrak - if (go = me->GetMap()->GetGameObject(pInstance->GetData64(GO_KADDRAK))) - activate ? go->SendCustomAnim(0) : go->SetGoState(GO_STATE_READY); + GameObject *go = NULL; + if (headMask & 0x1) // Kaddrak + if (go = me->GetMap()->GetGameObject(pInstance->GetData64(GO_KADDRAK))) + activate ? go->SendCustomAnim(0) : go->SetGoState(GO_STATE_READY); - if (headMask & 0x2) // Marnak - if (go = me->GetMap()->GetGameObject(pInstance->GetData64(GO_MARNAK))) - activate ? go->SendCustomAnim(0) : go->SetGoState(GO_STATE_READY); + if (headMask & 0x2) // Marnak + if (go = me->GetMap()->GetGameObject(pInstance->GetData64(GO_MARNAK))) + activate ? go->SendCustomAnim(0) : go->SetGoState(GO_STATE_READY); - if (headMask & 0x4) // Abedneum - if (go = me->GetMap()->GetGameObject(pInstance->GetData64(GO_ABEDNEUM))) - activate ? go->SendCustomAnim(0) : go->SetGoState(GO_STATE_READY); - } + if (headMask & 0x4) // Abedneum + if (go = me->GetMap()->GetGameObject(pInstance->GetData64(GO_ABEDNEUM))) + activate ? go->SendCustomAnim(0) : go->SetGoState(GO_STATE_READY); + } - void ResetEvent() - { - if (GameObject *tribunal = ObjectAccessor::GetGameObject(*me, pInstance->GetData64(GO_TRIBUNAL_CONSOLE))) - tribunal->SetGoState(GO_STATE_READY); + void ResetEvent() + { + if (GameObject *tribunal = ObjectAccessor::GetGameObject(*me, pInstance->GetData64(GO_TRIBUNAL_CONSOLE))) + tribunal->SetGoState(GO_STATE_READY); - events.Reset(); - summons.DespawnAll(); - DespawnHeads(); + events.Reset(); + summons.DespawnAll(); + DespawnHeads(); - WaveNum = 0; - SpeechCount = 0; - SpeechPause = 0; - TalkEvent = false; - } + WaveNum = 0; + SpeechCount = 0; + SpeechPause = 0; + TalkEvent = false; + } - void WaypointReached(uint32 id); - void InitializeEvent(); + void WaypointReached(uint32 id); + void InitializeEvent(); - Creature* GetAbedneum() { return ObjectAccessor::GetCreature(*me, AbedneumGUID); } - Creature* GetMarnak() { return ObjectAccessor::GetCreature(*me, MarnakGUID); } - Creature* GetKaddrak() { return ObjectAccessor::GetCreature(*me, KaddrakGUID); } + Creature* GetAbedneum() { return ObjectAccessor::GetCreature(*me, AbedneumGUID); } + Creature* GetMarnak() { return ObjectAccessor::GetCreature(*me, MarnakGUID); } + Creature* GetKaddrak() { return ObjectAccessor::GetCreature(*me, KaddrakGUID); } - void MoveInLineOfSight(Unit* pWho) { } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (damage && pInstance) - pInstance->SetData(DATA_BRANN_ACHIEVEMENT, false); - } - - void Reset() - { - RemoveEscortState(0x7); // all states - SetDespawnAtFar(false); - SetDespawnAtEnd(false); - ResetEvent(); + void MoveInLineOfSight(Unit* pWho) { } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (damage && pInstance) + pInstance->SetData(DATA_BRANN_ACHIEVEMENT, false); + } + + void Reset() + { + RemoveEscortState(0x7); // all states + SetDespawnAtFar(false); + SetDespawnAtEnd(false); + ResetEvent(); - me->setFaction(35); - me->SetReactState(REACT_PASSIVE); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + me->setFaction(35); + me->SetReactState(REACT_PASSIVE); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); - if(pInstance) - { - pInstance->SetData(BRANN_BRONZEBEARD, 1); - pInstance->SetData(DATA_BRANN_ACHIEVEMENT, true); - - if (pInstance->GetData(BOSS_TRIBUNAL_OF_AGES) == DONE) - pInstance->SetData(BRANN_BRONZEBEARD, (pInstance->GetData(BOSS_SJONNIR) == DONE) ? 5 : 4); - } - } + if(pInstance) + { + pInstance->SetData(BRANN_BRONZEBEARD, 1); + pInstance->SetData(DATA_BRANN_ACHIEVEMENT, true); + + if (pInstance->GetData(BOSS_TRIBUNAL_OF_AGES) == DONE) + pInstance->SetData(BRANN_BRONZEBEARD, (pInstance->GetData(BOSS_SJONNIR) == DONE) ? 5 : 4); + } + } - void DoAction(int32 action) - { - switch (action) - { - case ACTION_START_EVENT: - Start(false, true, 0, 0, true, false); - break; - case ACTION_START_TRIBUNAL: - { - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - me->setFaction(i->GetSource()->getFaction()); - break; - } - - SetEscortPaused(false); - InitializeEvent(); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - break; - } - case ACTION_GO_TO_SJONNIR: - SetEscortPaused(false); - ResetEvent(); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - break; - case ACTION_START_SJONNIR_FIGHT: - me->setFaction(35); - me->MonsterYell("Don't worry! Ol' Brann's got yer back! Keep that metal monstrosity busy, and I'll see if I can't sweet talk this machine into helping ye!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(14274); - SetEscortPaused(false); - break; - case ACTION_SJONNIR_DEAD: - me->MonsterYell("Loken? That's downright bothersome... We might've neutralized the iron dwarves, but I'd lay odds there's another machine somewhere else churnin' out a whole mess o' these iron vrykul!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(14278); - events.ScheduleEvent(EVENT_END, 14000); - break; - case ACTION_ENTEREVADEMODE: - RemoveEscortState(0x7); // all states - me->SetHomePosition(1077.41f, 474.16f, 207.8f, 2.70526f); - me->UpdatePosition(1077.41f, 474.16f, 207.9f, 2.70526f, true); - me->StopMovingOnCurrentPos(); - Reset(); - break; - case ACTION_WIPE_START: - Start(false, true, 0, 0, true, false); - SetNextWaypoint(20, false); - ResetEvent(); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - break; - } - } + void DoAction(int32 action) + { + switch (action) + { + case ACTION_START_EVENT: + Start(false, true, 0, 0, true, false); + break; + case ACTION_START_TRIBUNAL: + { + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + me->setFaction(i->GetSource()->getFaction()); + break; + } + + SetEscortPaused(false); + InitializeEvent(); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + break; + } + case ACTION_GO_TO_SJONNIR: + SetEscortPaused(false); + ResetEvent(); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + break; + case ACTION_START_SJONNIR_FIGHT: + me->setFaction(35); + me->MonsterYell("Don't worry! Ol' Brann's got yer back! Keep that metal monstrosity busy, and I'll see if I can't sweet talk this machine into helping ye!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(14274); + SetEscortPaused(false); + break; + case ACTION_SJONNIR_DEAD: + me->MonsterYell("Loken? That's downright bothersome... We might've neutralized the iron dwarves, but I'd lay odds there's another machine somewhere else churnin' out a whole mess o' these iron vrykul!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(14278); + events.ScheduleEvent(EVENT_END, 14000); + break; + case ACTION_ENTEREVADEMODE: + RemoveEscortState(0x7); // all states + me->SetHomePosition(1077.41f, 474.16f, 207.8f, 2.70526f); + me->UpdatePosition(1077.41f, 474.16f, 207.9f, 2.70526f, true); + me->StopMovingOnCurrentPos(); + Reset(); + break; + case ACTION_WIPE_START: + Start(false, true, 0, 0, true, false); + SetNextWaypoint(20, false); + ResetEvent(); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + break; + } + } - void JustSummoned(Creature* cr) - { - if (cr->GetEntry() == NPC_ABEDNEUM || cr->GetEntry() == NPC_KADDRAK || cr->GetEntry() == NPC_MARNAK) - cr->SetCanFly(true); - else - summons.Summon(cr); - } + void JustSummoned(Creature* cr) + { + if (cr->GetEntry() == NPC_ABEDNEUM || cr->GetEntry() == NPC_KADDRAK || cr->GetEntry() == NPC_MARNAK) + cr->SetCanFly(true); + else + summons.Summon(cr); + } - void UpdateEscortAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_KADDRAK_VISUAL: - { - SwitchHeadVisaul(0x1, true); - events.PopEvent(); - break; - } - case EVENT_MARNAK_VISUAL: - { - SwitchHeadVisaul(0x2, true); - events.PopEvent(); - break; - } - case EVENT_ABEDNEUM_VISUAL: - { - SwitchHeadVisaul(0x4, true); - events.PopEvent(); - break; - } - case EVENT_KADDRAK_HEAD: // First - { - if (Creature *kaddrak = GetKaddrak()) - { - if (Player *plr = SelectTargetFromPlayerList(100.0f)) - kaddrak->CastSpell(plr, DUNGEON_MODE(SPELL_GLARE_OF_THE_TRIBUNAL, SPELL_GLARE_OF_THE_TRIBUNAL_H), true); - } + void UpdateEscortAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_KADDRAK_VISUAL: + { + SwitchHeadVisaul(0x1, true); + events.PopEvent(); + break; + } + case EVENT_MARNAK_VISUAL: + { + SwitchHeadVisaul(0x2, true); + events.PopEvent(); + break; + } + case EVENT_ABEDNEUM_VISUAL: + { + SwitchHeadVisaul(0x4, true); + events.PopEvent(); + break; + } + case EVENT_KADDRAK_HEAD: // First + { + if (Creature *kaddrak = GetKaddrak()) + { + if (Player *plr = SelectTargetFromPlayerList(100.0f)) + kaddrak->CastSpell(plr, DUNGEON_MODE(SPELL_GLARE_OF_THE_TRIBUNAL, SPELL_GLARE_OF_THE_TRIBUNAL_H), true); + } - events.RescheduleEvent(EVENT_KADDRAK_SWITCH_EYE, 1500); - events.RepeatEvent(2000+urand(0,2000)); - break; - } - case EVENT_KADDRAK_SWITCH_EYE: - { - if (Creature *kaddrak = GetKaddrak()) - { - if (urand(0,1)) - kaddrak->UpdatePosition(927.9f, 330.9f, 219.4f, 2.4f, true); - else - kaddrak->UpdatePosition(923.7f, 326.9f, 219.5f, 2.1f, true); + events.RescheduleEvent(EVENT_KADDRAK_SWITCH_EYE, 1500); + events.RepeatEvent(2000+urand(0,2000)); + break; + } + case EVENT_KADDRAK_SWITCH_EYE: + { + if (Creature *kaddrak = GetKaddrak()) + { + if (urand(0,1)) + kaddrak->UpdatePosition(927.9f, 330.9f, 219.4f, 2.4f, true); + else + kaddrak->UpdatePosition(923.7f, 326.9f, 219.5f, 2.1f, true); - kaddrak->StopMovingOnCurrentPos(); - } + kaddrak->StopMovingOnCurrentPos(); + } - events.PopEvent(); - break; - } - case EVENT_MARNAK_HEAD: // Second - { - if (Creature *marnak = GetMarnak()) - { - if (Creature *cr = me->SummonCreature(NPC_DARK_MATTER_TRIGGER, marnak->GetPositionX(), marnak->GetPositionY(), marnak->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 7000)) - { - cr->CastSpell(cr, SPELL_DARK_MATTER_VISUAL, true); - if (Player *plr = SelectTargetFromPlayerList(100.0f)) - { - float speed = me->GetDistance(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ()) / (4000.0f * 0.001f); - cr->MonsterMoveWithSpeed(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), speed); - } - } - } - events.RepeatEvent(20000); - break; - } - case EVENT_ABEDNEUM_HEAD: // Third - { - if (Creature *abedneum = GetAbedneum()) - { - Player *plr = SelectTargetFromPlayerList(100.0f); - if (!plr) - break; + events.PopEvent(); + break; + } + case EVENT_MARNAK_HEAD: // Second + { + if (Creature *marnak = GetMarnak()) + { + if (Creature *cr = me->SummonCreature(NPC_DARK_MATTER_TRIGGER, marnak->GetPositionX(), marnak->GetPositionY(), marnak->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 7000)) + { + cr->CastSpell(cr, SPELL_DARK_MATTER_VISUAL, true); + if (Player *plr = SelectTargetFromPlayerList(100.0f)) + { + float speed = me->GetDistance(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ()) / (4000.0f * 0.001f); + cr->MonsterMoveWithSpeed(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), speed); + } + } + } + events.RepeatEvent(20000); + break; + } + case EVENT_ABEDNEUM_HEAD: // Third + { + if (Creature *abedneum = GetAbedneum()) + { + Player *plr = SelectTargetFromPlayerList(100.0f); + if (!plr) + break; - if (Creature *cr = me->SummonCreature(NPC_SEARING_GAZE_TRIGGER, plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) - { - // summon another abedneum to create double beam, despawn just after trigger despawn - me->SummonCreature(NPC_ABEDNEUM, 897.0f, 326.9f, 223.5f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 12000); - cr->CastSpell(cr, DUNGEON_MODE(SPELL_SEARING_GAZE, SPELL_SEARING_GAZE_H), true); - } - } - events.RepeatEvent(30000); - break; - } - case EVENT_SUMMON_MONSTERS: - { - uint32 Time = 45000 - (2500*WaveNum); - SummonCreatures(NPC_DARK_RUNE_PROTECTOR, 3); - if (WaveNum > 2) - SummonCreatures(NPC_DARK_RUNE_STORMCALLER, 2); - if (WaveNum > 5) - SummonCreatures(NPC_IRON_GOLEM_CUSTODIAN, 1); + if (Creature *cr = me->SummonCreature(NPC_SEARING_GAZE_TRIGGER, plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) + { + // summon another abedneum to create double beam, despawn just after trigger despawn + me->SummonCreature(NPC_ABEDNEUM, 897.0f, 326.9f, 223.5f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 12000); + cr->CastSpell(cr, DUNGEON_MODE(SPELL_SEARING_GAZE, SPELL_SEARING_GAZE_H), true); + } + } + events.RepeatEvent(30000); + break; + } + case EVENT_SUMMON_MONSTERS: + { + uint32 Time = 45000 - (2500*WaveNum); + SummonCreatures(NPC_DARK_RUNE_PROTECTOR, 3); + if (WaveNum > 2) + SummonCreatures(NPC_DARK_RUNE_STORMCALLER, 2); + if (WaveNum > 5) + SummonCreatures(NPC_IRON_GOLEM_CUSTODIAN, 1); - WaveNum++; - events.RepeatEvent(Time); - break; - } - case EVENT_TRIBUNAL_END: - { - // Has to be here! - events.Reset(); - //DespawnHeads(); - summons.DespawnAll(); + WaveNum++; + events.RepeatEvent(Time); + break; + } + case EVENT_TRIBUNAL_END: + { + // Has to be here! + events.Reset(); + //DespawnHeads(); + summons.DespawnAll(); - if (pInstance) - { - pInstance->SetData(BOSS_TRIBUNAL_OF_AGES, DONE); - pInstance->SetData(BRANN_BRONZEBEARD, 3); - me->CastSpell(me, 59046, true); // credit - } + if (pInstance) + { + pInstance->SetData(BOSS_TRIBUNAL_OF_AGES, DONE); + pInstance->SetData(BRANN_BRONZEBEARD, 3); + me->CastSpell(me, 59046, true); // credit + } - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); - + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + - // Spawn Chest and quest credit - if (Player *plr = SelectTargetFromPlayerList(200.0f)) - { - if (GameObject* go = plr->SummonGameObject((IsHeroic() ? GO_TRIBUNAL_CHEST_H : GO_TRIBUNAL_CHEST), 880.406f, 345.164f, 203.706f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0)) - { - plr->RemoveGameObject(go, false); - go->SetLootMode(1); - go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); - } + // Spawn Chest and quest credit + if (Player *plr = SelectTargetFromPlayerList(200.0f)) + { + if (GameObject* go = plr->SummonGameObject((IsHeroic() ? GO_TRIBUNAL_CHEST_H : GO_TRIBUNAL_CHEST), 880.406f, 345.164f, 203.706f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0)) + { + plr->RemoveGameObject(go, false); + go->SetLootMode(1); + go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); + } - plr->GroupEventHappens(QUEST_HALLS_OF_STONE, me); - } - - events.ScheduleEvent(EVENT_GO_TO_SJONNIR, 279000); - break; - } - case EVENT_GO_TO_SJONNIR: - { - SetEscortPaused(false); - ResetEvent(); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - break; - } - case EVENT_END: - { - events.Reset(); - if (pInstance) - pInstance->SetData(BRANN_BRONZEBEARD, 6); + plr->GroupEventHappens(QUEST_HALLS_OF_STONE, me); + } + + events.ScheduleEvent(EVENT_GO_TO_SJONNIR, 279000); + break; + } + case EVENT_GO_TO_SJONNIR: + { + SetEscortPaused(false); + ResetEvent(); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + break; + } + case EVENT_END: + { + events.Reset(); + if (pInstance) + pInstance->SetData(BRANN_BRONZEBEARD, 6); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); - me->MonsterYell("I'll use the forge to make batches o' earthen to stand guard... But our greatest challenge still remains: find and stop Loken!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(14279); - break; - } - } + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + me->MonsterYell("I'll use the forge to make batches o' earthen to stand guard... But our greatest challenge still remains: find and stop Loken!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(14279); + break; + } + } - if (TalkEvent) - { - SpeechPause += diff; - if (SpeechPause >= Conversation[SpeechCount].timer) - { - Creature* cs = NULL; - switch (Conversation[SpeechCount].creature) - { - case NPC_BRANN: cs = me; break; - case NPC_ABEDNEUM: cs = GetAbedneum(); break; - case NPC_KADDRAK: cs = GetKaddrak(); break; - case NPC_MARNAK: cs = GetMarnak(); break; - } + if (TalkEvent) + { + SpeechPause += diff; + if (SpeechPause >= Conversation[SpeechCount].timer) + { + Creature* cs = NULL; + switch (Conversation[SpeechCount].creature) + { + case NPC_BRANN: cs = me; break; + case NPC_ABEDNEUM: cs = GetAbedneum(); break; + case NPC_KADDRAK: cs = GetKaddrak(); break; + case NPC_MARNAK: cs = GetMarnak(); break; + } - if (cs) - { - cs->MonsterYell(Conversation[SpeechCount].text, LANG_UNIVERSAL, 0); - cs->PlayDirectSound(Conversation[SpeechCount].sound); - } + if (cs) + { + cs->MonsterYell(Conversation[SpeechCount].text, LANG_UNIVERSAL, 0); + cs->PlayDirectSound(Conversation[SpeechCount].sound); + } - if (SpeechCount < 38) - SpeechPause = Conversation[SpeechCount++].timer; - else - TalkEvent = false; - } - } - } - void SummonCreatures(uint32 entry, uint8 count) - { - for (int i = 0; i < count; ++i) - { - Creature* cr = me->SummonCreature(entry, 946.5971f+urand(0,6), 383.5330f+urand(0,6), 205.9943f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); - if(cr) - { - cr->AI()->AttackStart(me); - cr->AddThreat(me, 100.0f); - cr->SetInCombatWithZone(); - } - } - } + if (SpeechCount < 38) + SpeechPause = Conversation[SpeechCount++].timer; + else + TalkEvent = false; + } + } + } + void SummonCreatures(uint32 entry, uint8 count) + { + for (int i = 0; i < count; ++i) + { + Creature* cr = me->SummonCreature(entry, 946.5971f+urand(0,6), 383.5330f+urand(0,6), 205.9943f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); + if(cr) + { + cr->AI()->AttackStart(me); + cr->AddThreat(me, 100.0f); + cr->SetInCombatWithZone(); + } + } + } - void JustDied(Unit* killer) - { - ResetEvent(); - if(pInstance) - { - if (pInstance->GetData(BOSS_TRIBUNAL_OF_AGES) != DONE) - pInstance->SetData(BOSS_TRIBUNAL_OF_AGES, NOT_STARTED); - } - } - }; + void JustDied(Unit* killer) + { + ResetEvent(); + if(pInstance) + { + if (pInstance->GetData(BOSS_TRIBUNAL_OF_AGES) != DONE) + pInstance->SetData(BOSS_TRIBUNAL_OF_AGES, NOT_STARTED); + } + } + }; }; void brann_bronzebeard::brann_bronzebeardAI::InitializeEvent() { - Creature* cr = NULL; - if (cr = me->SummonCreature(NPC_KADDRAK, 923.7f, 326.9f, 219.5f, 2.1f, TEMPSUMMON_TIMED_DESPAWN, 580000)) - { - cr->SetInCombatWithZone(); - KaddrakGUID = cr->GetGUID(); - } - if (cr = me->SummonCreature(NPC_MARNAK, 895.974f, 363.571f, 219.337f, 5.5f, TEMPSUMMON_TIMED_DESPAWN, 580000)) - { - cr->SetInCombatWithZone(); - MarnakGUID = cr->GetGUID(); - } - if (cr = me->SummonCreature(NPC_ABEDNEUM, 892.25f, 331.25f, 223.86f, 0.6f, TEMPSUMMON_TIMED_DESPAWN, 580000)) - { - cr->SetInCombatWithZone(); - AbedneumGUID = cr->GetGUID(); - } + Creature* cr = NULL; + if (cr = me->SummonCreature(NPC_KADDRAK, 923.7f, 326.9f, 219.5f, 2.1f, TEMPSUMMON_TIMED_DESPAWN, 580000)) + { + cr->SetInCombatWithZone(); + KaddrakGUID = cr->GetGUID(); + } + if (cr = me->SummonCreature(NPC_MARNAK, 895.974f, 363.571f, 219.337f, 5.5f, TEMPSUMMON_TIMED_DESPAWN, 580000)) + { + cr->SetInCombatWithZone(); + MarnakGUID = cr->GetGUID(); + } + if (cr = me->SummonCreature(NPC_ABEDNEUM, 892.25f, 331.25f, 223.86f, 0.6f, TEMPSUMMON_TIMED_DESPAWN, 580000)) + { + cr->SetInCombatWithZone(); + AbedneumGUID = cr->GetGUID(); + } - TalkEvent = true; + TalkEvent = true; - events.Reset(); - events.ScheduleEvent(EVENT_SUMMON_MONSTERS, 21000); - events.ScheduleEvent(EVENT_KADDRAK_HEAD, 20000); - events.ScheduleEvent(EVENT_MARNAK_HEAD, 105000); - events.ScheduleEvent(EVENT_ABEDNEUM_HEAD, 205000); - events.ScheduleEvent(EVENT_TRIBUNAL_END, 315000); + events.Reset(); + events.ScheduleEvent(EVENT_SUMMON_MONSTERS, 21000); + events.ScheduleEvent(EVENT_KADDRAK_HEAD, 20000); + events.ScheduleEvent(EVENT_MARNAK_HEAD, 105000); + events.ScheduleEvent(EVENT_ABEDNEUM_HEAD, 205000); + events.ScheduleEvent(EVENT_TRIBUNAL_END, 315000); - // Viusals - events.ScheduleEvent(EVENT_KADDRAK_VISUAL, 20000); - events.ScheduleEvent(EVENT_MARNAK_VISUAL, 105000); - events.ScheduleEvent(EVENT_ABEDNEUM_VISUAL, 205000); + // Viusals + events.ScheduleEvent(EVENT_KADDRAK_VISUAL, 20000); + events.ScheduleEvent(EVENT_MARNAK_VISUAL, 105000); + events.ScheduleEvent(EVENT_ABEDNEUM_VISUAL, 205000); } void brann_bronzebeard::brann_bronzebeardAI::WaypointReached(uint32 id) { - switch (id) - { - // Stop before stairs and ask to start - case 9: - SetEscortPaused(true); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); - if (pInstance) - pInstance->SetData(BRANN_BRONZEBEARD, 2); + switch (id) + { + // Stop before stairs and ask to start + case 9: + SetEscortPaused(true); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + if (pInstance) + pInstance->SetData(BRANN_BRONZEBEARD, 2); - break; - // In front of Console - case 11: - SetEscortPaused(true); - if(pInstance) - { - pInstance->SetData(BOSS_TRIBUNAL_OF_AGES, IN_PROGRESS); - if (GameObject *tribunal = ObjectAccessor::GetGameObject(*me, pInstance->GetData64(GO_TRIBUNAL_CONSOLE))) - tribunal->SetGoState(GO_STATE_ACTIVE); - } - break; - // Before Sjonnir's door - case 27: - if(pInstance) - { - if (GameObject *door = ObjectAccessor::GetGameObject(*me, pInstance->GetData64(GO_SJONNIR_DOOR))) - door->SetGoState(GO_STATE_ACTIVE); - if (Creature *cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_SJONNIR))) - cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - break; - case 28: - SetEscortPaused(true); - break; - case 29: - SetEscortPaused(true); - if (pInstance) - if (GameObject *console = ObjectAccessor::GetGameObject(*me, pInstance->GetData64(GO_SJONNIR_CONSOLE))) - console->SetGoState(GO_STATE_ACTIVE); + break; + // In front of Console + case 11: + SetEscortPaused(true); + if(pInstance) + { + pInstance->SetData(BOSS_TRIBUNAL_OF_AGES, IN_PROGRESS); + if (GameObject *tribunal = ObjectAccessor::GetGameObject(*me, pInstance->GetData64(GO_TRIBUNAL_CONSOLE))) + tribunal->SetGoState(GO_STATE_ACTIVE); + } + break; + // Before Sjonnir's door + case 27: + if(pInstance) + { + if (GameObject *door = ObjectAccessor::GetGameObject(*me, pInstance->GetData64(GO_SJONNIR_DOOR))) + door->SetGoState(GO_STATE_ACTIVE); + if (Creature *cr = ObjectAccessor::GetCreature(*me, pInstance->GetData64(NPC_SJONNIR))) + cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + break; + case 28: + SetEscortPaused(true); + break; + case 29: + SetEscortPaused(true); + if (pInstance) + if (GameObject *console = ObjectAccessor::GetGameObject(*me, pInstance->GetData64(GO_SJONNIR_CONSOLE))) + console->SetGoState(GO_STATE_ACTIVE); - break; - } + break; + } } class dark_rune_protectors : public CreatureScript @@ -664,52 +664,52 @@ public: return new dark_rune_protectorsAI (pCreature); } - struct dark_rune_protectorsAI : public ScriptedAI - { - dark_rune_protectorsAI(Creature *c) : ScriptedAI(c) { } + struct dark_rune_protectorsAI : public ScriptedAI + { + dark_rune_protectorsAI(Creature *c) : ScriptedAI(c) { } - EventMap events; - void Reset() - { - events.Reset(); - } + EventMap events; + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit *) - { - events.ScheduleEvent(EVENT_DRP_CHARGE, 10000); - events.ScheduleEvent(EVENT_DRP_CLEAVE, 7000); - } + void EnterCombat(Unit *) + { + events.ScheduleEvent(EVENT_DRP_CHARGE, 10000); + events.ScheduleEvent(EVENT_DRP_CLEAVE, 7000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_DRP_CHARGE: - { - if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(tgt, SPELL_DRP_CHARGE, false); + switch (events.GetEvent()) + { + case EVENT_DRP_CHARGE: + { + if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(tgt, SPELL_DRP_CHARGE, false); - events.RepeatEvent(10000); - break; - } - case EVENT_DRP_CLEAVE: - { - me->CastSpell(me->GetVictim(), SPELL_DRP_CLEAVE, false); - events.RepeatEvent(7000); - break; - } - } + events.RepeatEvent(10000); + break; + } + case EVENT_DRP_CLEAVE: + { + me->CastSpell(me->GetVictim(), SPELL_DRP_CLEAVE, false); + events.RepeatEvent(7000); + break; + } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class dark_rune_stormcaller : public CreatureScript @@ -722,50 +722,50 @@ public: return new dark_rune_stormcallerAI (pCreature); } - struct dark_rune_stormcallerAI : public ScriptedAI - { - dark_rune_stormcallerAI(Creature *c) : ScriptedAI(c) { } + struct dark_rune_stormcallerAI : public ScriptedAI + { + dark_rune_stormcallerAI(Creature *c) : ScriptedAI(c) { } - EventMap events; - void Reset() - { - events.Reset(); - } + EventMap events; + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit *) - { - events.ScheduleEvent(EVENT_DRS_LIGHTNING_BOLD, 5000); - events.ScheduleEvent(EVENT_DRS_SHADOW_WORD_PAIN, 12000); - } + void EnterCombat(Unit *) + { + events.ScheduleEvent(EVENT_DRS_LIGHTNING_BOLD, 5000); + events.ScheduleEvent(EVENT_DRS_SHADOW_WORD_PAIN, 12000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_DRS_LIGHTNING_BOLD: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_DRS_LIGHTING_BOLT_H : SPELL_DRS_LIGHTING_BOLT, false); - events.RepeatEvent(5000); - break; - } - case EVENT_DRS_SHADOW_WORD_PAIN: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_DRS_SHADOW_WORD_PAIN_H : SPELL_DRS_SHADOW_WORD_PAIN, false); - events.RepeatEvent(12000); - break; - } - } + switch (events.GetEvent()) + { + case EVENT_DRS_LIGHTNING_BOLD: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_DRS_LIGHTING_BOLT_H : SPELL_DRS_LIGHTING_BOLT, false); + events.RepeatEvent(5000); + break; + } + case EVENT_DRS_SHADOW_WORD_PAIN: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_DRS_SHADOW_WORD_PAIN_H : SPELL_DRS_SHADOW_WORD_PAIN, false); + events.RepeatEvent(12000); + break; + } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class iron_golem_custodian : public CreatureScript @@ -778,48 +778,48 @@ public: return new iron_golem_custodianAI (pCreature); } - struct iron_golem_custodianAI : public ScriptedAI - { - iron_golem_custodianAI(Creature *c) : ScriptedAI(c) { } - EventMap events; - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit *) - { - events.ScheduleEvent(EVENT_IGC_CRUSH, 6000); - events.ScheduleEvent(EVENT_IGC_GROUND_SMASH, 4000); - } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + struct iron_golem_custodianAI : public ScriptedAI + { + iron_golem_custodianAI(Creature *c) : ScriptedAI(c) { } + EventMap events; + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit *) + { + events.ScheduleEvent(EVENT_IGC_CRUSH, 6000); + events.ScheduleEvent(EVENT_IGC_GROUND_SMASH, 4000); + } + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_IGC_CRUSH: - { - me->CastSpell(me->GetVictim(), SPELL_IGC_CRUSH_ARMOR, false); - events.RepeatEvent(6000); - break; - } - case EVENT_IGC_GROUND_SMASH: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_IGC_GROUND_SMASH_H : SPELL_IGC_GROUND_SMASH, false); - events.RepeatEvent(5000); - break; - } - } + switch (events.GetEvent()) + { + case EVENT_IGC_CRUSH: + { + me->CastSpell(me->GetVictim(), SPELL_IGC_CRUSH_ARMOR, false); + events.RepeatEvent(6000); + break; + } + case EVENT_IGC_GROUND_SMASH: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_IGC_GROUND_SMASH_H : SPELL_IGC_GROUND_SMASH, false); + events.RepeatEvent(5000); + break; + } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_hos_dark_matter : public SpellScriptLoader @@ -827,33 +827,33 @@ class spell_hos_dark_matter : public SpellScriptLoader public: spell_hos_dark_matter() : SpellScriptLoader("spell_hos_dark_matter") { } - class spell_hos_dark_matter_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hos_dark_matter_AuraScript); + class spell_hos_dark_matter_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hos_dark_matter_AuraScript); - void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit *caster = GetCaster()) - caster->CastSpell(caster, caster->GetMap()->IsHeroic() ? SPELL_DARK_MATTER_H : SPELL_DARK_MATTER, true); - } + void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit *caster = GetCaster()) + caster->CastSpell(caster, caster->GetMap()->IsHeroic() ? SPELL_DARK_MATTER_H : SPELL_DARK_MATTER, true); + } - void Register() - { - OnEffectRemove += AuraEffectRemoveFn(spell_hos_dark_matter_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_hos_dark_matter_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_hos_dark_matter_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_hos_dark_matter_AuraScript(); + } }; void AddSC_brann_bronzebeard() { - new brann_bronzebeard(); - new dark_rune_protectors(); - new dark_rune_stormcaller(); - new iron_golem_custodian(); - new spell_hos_dark_matter(); + new brann_bronzebeard(); + new dark_rune_protectors(); + new dark_rune_stormcaller(); + new iron_golem_custodian(); + new spell_hos_dark_matter(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h index 1c464c954..6c6e529b9 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h @@ -7,39 +7,39 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Encounter { - BOSS_KRYSTALLUS = 0, - BOSS_MAIDEN_OF_GRIEF = 1, - BOSS_TRIBUNAL_OF_AGES = 2, - BOSS_SJONNIR = 3, - BRANN_BRONZEBEARD = 4, - MAX_ENCOUNTER = 5, + BOSS_KRYSTALLUS = 0, + BOSS_MAIDEN_OF_GRIEF = 1, + BOSS_TRIBUNAL_OF_AGES = 2, + BOSS_SJONNIR = 3, + BRANN_BRONZEBEARD = 4, + MAX_ENCOUNTER = 5, - DATA_BRANN_ACHIEVEMENT, - DATA_SJONNIR_ACHIEVEMENT, + DATA_BRANN_ACHIEVEMENT, + DATA_SJONNIR_ACHIEVEMENT, }; enum gobjects { - GO_TRIBUNAL_CONSOLE = 193907, - GO_KADDRAK = 191671, - GO_MARNAK = 191670, - GO_ABEDNEUM = 191669, - GO_SKY_FLOOR = 191527, - GO_SJONNIR_CONSOLE = 193906, - GO_SJONNIR_DOOR = 191296, - GO_TRIBUNAL_CHEST = 190586, - GO_TRIBUNAL_CHEST_H = 193996, - GO_LEFT_PIPE = 192163, - GO_RIGHT_PIPE = 192164, + GO_TRIBUNAL_CONSOLE = 193907, + GO_KADDRAK = 191671, + GO_MARNAK = 191670, + GO_ABEDNEUM = 191669, + GO_SKY_FLOOR = 191527, + GO_SJONNIR_CONSOLE = 193906, + GO_SJONNIR_DOOR = 191296, + GO_TRIBUNAL_CHEST = 190586, + GO_TRIBUNAL_CHEST_H = 193996, + GO_LEFT_PIPE = 192163, + GO_RIGHT_PIPE = 192164, }; enum npcs { - NPC_KADDRAK = 30898, - NPC_MARNAK = 30897, - NPC_ABEDNEUM = 30899, - NPC_SJONNIR = 27978, - NPC_BRANN = 28070, + NPC_KADDRAK = 30898, + NPC_MARNAK = 30897, + NPC_ABEDNEUM = 30899, + NPC_SJONNIR = 27978, + NPC_BRANN = 28070, }; #endif \ No newline at end of file diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp index 2c839a273..0347a54f5 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp @@ -17,237 +17,237 @@ public: } struct instance_halls_of_stone_InstanceMapScript : public InstanceScript - { - instance_halls_of_stone_InstanceMapScript(Map* map) : InstanceScript(map){ Initialize(); } + { + instance_halls_of_stone_InstanceMapScript(Map* map) : InstanceScript(map){ Initialize(); } - uint32 Encounter[MAX_ENCOUNTER]; + uint32 Encounter[MAX_ENCOUNTER]; - uint64 goKaddrakGUID; - uint64 goMarnakGUID; - uint64 goAbedneumGUID; - uint64 goTribunalConsoleGUID; - uint64 goSkyRoomFloorGUID; - uint64 goSjonnirConsoleGUID; - uint64 goSjonnirDoorGUID; - uint64 goLeftPipeGUID; - uint64 goRightPipeGUID; + uint64 goKaddrakGUID; + uint64 goMarnakGUID; + uint64 goAbedneumGUID; + uint64 goTribunalConsoleGUID; + uint64 goSkyRoomFloorGUID; + uint64 goSjonnirConsoleGUID; + uint64 goSjonnirDoorGUID; + uint64 goLeftPipeGUID; + uint64 goRightPipeGUID; - uint64 SjonnirGUID; - uint64 BrannGUID; + uint64 SjonnirGUID; + uint64 BrannGUID; - bool brannAchievement; - bool sjonnirAchievement; + bool brannAchievement; + bool sjonnirAchievement; - void Initialize() - { - memset(&Encounter, 0, sizeof(Encounter)); + void Initialize() + { + memset(&Encounter, 0, sizeof(Encounter)); - goKaddrakGUID = 0; - goMarnakGUID = 0; - goAbedneumGUID = 0; - goTribunalConsoleGUID = 0; - goSkyRoomFloorGUID = 0; - goSjonnirConsoleGUID = 0; - goSjonnirDoorGUID = 0; - goLeftPipeGUID = 0; - goRightPipeGUID = 0; + goKaddrakGUID = 0; + goMarnakGUID = 0; + goAbedneumGUID = 0; + goTribunalConsoleGUID = 0; + goSkyRoomFloorGUID = 0; + goSjonnirConsoleGUID = 0; + goSjonnirDoorGUID = 0; + goLeftPipeGUID = 0; + goRightPipeGUID = 0; - SjonnirGUID = 0; - BrannGUID = 0; + SjonnirGUID = 0; + BrannGUID = 0; - brannAchievement = false; - sjonnirAchievement = false; - } + brannAchievement = false; + sjonnirAchievement = false; + } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - if (Encounter[i] == IN_PROGRESS) - return true; - } - return false; - } + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + if (Encounter[i] == IN_PROGRESS) + return true; + } + return false; + } - void OnGameObjectCreate(GameObject *go) - { - switch(go->GetEntry()) - { - case GO_KADDRAK: - goKaddrakGUID = go->GetGUID(); - break; - case GO_ABEDNEUM: - goAbedneumGUID = go->GetGUID(); - if (Encounter[BOSS_TRIBUNAL_OF_AGES] == DONE) - go->SetGoState(GO_STATE_ACTIVE); - break; - case GO_MARNAK: - goMarnakGUID = go->GetGUID(); - break; - case GO_TRIBUNAL_CONSOLE: - goTribunalConsoleGUID = go->GetGUID(); - break; - case GO_SKY_FLOOR: - goSkyRoomFloorGUID = go->GetGUID(); - if (Encounter[BOSS_TRIBUNAL_OF_AGES] == DONE) - go->SetGoState(GO_STATE_ACTIVE); - break; - case GO_SJONNIR_CONSOLE: - goSjonnirConsoleGUID = go->GetGUID(); - break; - case GO_SJONNIR_DOOR: - goSjonnirDoorGUID = go->GetGUID(); - if (Encounter[BOSS_TRIBUNAL_OF_AGES] == DONE) - go->SetGoState(GO_STATE_ACTIVE); - break; - case GO_LEFT_PIPE: - goLeftPipeGUID = go->GetGUID(); - break; - case GO_RIGHT_PIPE: - goRightPipeGUID = go->GetGUID(); - break; - } - } + void OnGameObjectCreate(GameObject *go) + { + switch(go->GetEntry()) + { + case GO_KADDRAK: + goKaddrakGUID = go->GetGUID(); + break; + case GO_ABEDNEUM: + goAbedneumGUID = go->GetGUID(); + if (Encounter[BOSS_TRIBUNAL_OF_AGES] == DONE) + go->SetGoState(GO_STATE_ACTIVE); + break; + case GO_MARNAK: + goMarnakGUID = go->GetGUID(); + break; + case GO_TRIBUNAL_CONSOLE: + goTribunalConsoleGUID = go->GetGUID(); + break; + case GO_SKY_FLOOR: + goSkyRoomFloorGUID = go->GetGUID(); + if (Encounter[BOSS_TRIBUNAL_OF_AGES] == DONE) + go->SetGoState(GO_STATE_ACTIVE); + break; + case GO_SJONNIR_CONSOLE: + goSjonnirConsoleGUID = go->GetGUID(); + break; + case GO_SJONNIR_DOOR: + goSjonnirDoorGUID = go->GetGUID(); + if (Encounter[BOSS_TRIBUNAL_OF_AGES] == DONE) + go->SetGoState(GO_STATE_ACTIVE); + break; + case GO_LEFT_PIPE: + goLeftPipeGUID = go->GetGUID(); + break; + case GO_RIGHT_PIPE: + goRightPipeGUID = go->GetGUID(); + break; + } + } - void OnCreatureCreate(Creature *creature) - { - switch(creature->GetEntry()) - { - case NPC_SJONNIR: - SjonnirGUID = creature->GetGUID(); - break; - case NPC_BRANN: - BrannGUID = creature->GetGUID(); - break; - } - } + void OnCreatureCreate(Creature *creature) + { + switch(creature->GetEntry()) + { + case NPC_SJONNIR: + SjonnirGUID = creature->GetGUID(); + break; + case NPC_BRANN: + BrannGUID = creature->GetGUID(); + break; + } + } - uint64 GetData64(uint32 id) const - { - switch(id) - { - case GO_TRIBUNAL_CONSOLE: return goTribunalConsoleGUID; - case GO_SJONNIR_CONSOLE: return goSjonnirConsoleGUID; - case GO_SJONNIR_DOOR: return goSjonnirDoorGUID; - case GO_LEFT_PIPE: return goLeftPipeGUID; - case GO_RIGHT_PIPE: return goRightPipeGUID; - case GO_KADDRAK: return goKaddrakGUID; - case GO_MARNAK: return goMarnakGUID; - case GO_ABEDNEUM: return goAbedneumGUID; + uint64 GetData64(uint32 id) const + { + switch(id) + { + case GO_TRIBUNAL_CONSOLE: return goTribunalConsoleGUID; + case GO_SJONNIR_CONSOLE: return goSjonnirConsoleGUID; + case GO_SJONNIR_DOOR: return goSjonnirDoorGUID; + case GO_LEFT_PIPE: return goLeftPipeGUID; + case GO_RIGHT_PIPE: return goRightPipeGUID; + case GO_KADDRAK: return goKaddrakGUID; + case GO_MARNAK: return goMarnakGUID; + case GO_ABEDNEUM: return goAbedneumGUID; - case NPC_SJONNIR: return SjonnirGUID; - case NPC_BRANN: return BrannGUID; - } - return 0; - } + case NPC_SJONNIR: return SjonnirGUID; + case NPC_BRANN: return BrannGUID; + } + return 0; + } - uint32 GetData(uint32 id) const - { - switch(id) - { - case BOSS_KRYSTALLUS: - case BOSS_MAIDEN_OF_GRIEF: - case BOSS_TRIBUNAL_OF_AGES: - case BOSS_SJONNIR: - case BRANN_BRONZEBEARD: - return Encounter[id]; - } - return 0; - } + uint32 GetData(uint32 id) const + { + switch(id) + { + case BOSS_KRYSTALLUS: + case BOSS_MAIDEN_OF_GRIEF: + case BOSS_TRIBUNAL_OF_AGES: + case BOSS_SJONNIR: + case BRANN_BRONZEBEARD: + return Encounter[id]; + } + return 0; + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case 7590: // Brann Spankin' New (2154) - return brannAchievement; - case 7593: // Abuse the Ooze (2155) - return sjonnirAchievement; - } - return false; - } + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case 7590: // Brann Spankin' New (2154) + return brannAchievement; + case 7593: // Abuse the Ooze (2155) + return sjonnirAchievement; + } + return false; + } - void SetData(uint32 type, uint32 data) - { - if (type < MAX_ENCOUNTER) - Encounter[type] = data; + void SetData(uint32 type, uint32 data) + { + if (type < MAX_ENCOUNTER) + Encounter[type] = data; - if (type == BOSS_TRIBUNAL_OF_AGES && data == DONE) - { - if (GameObject* pA = instance->GetGameObject(goAbedneumGUID)) - pA->SetGoState(GO_STATE_ACTIVE); - if (GameObject* pF = instance->GetGameObject(goSkyRoomFloorGUID)) - pF->SetGoState(GO_STATE_ACTIVE); + if (type == BOSS_TRIBUNAL_OF_AGES && data == DONE) + { + if (GameObject* pA = instance->GetGameObject(goAbedneumGUID)) + pA->SetGoState(GO_STATE_ACTIVE); + if (GameObject* pF = instance->GetGameObject(goSkyRoomFloorGUID)) + pF->SetGoState(GO_STATE_ACTIVE); - // Make sjonnir attackable - if (Creature *cr = instance->GetCreature(SjonnirGUID)) - cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - if (type == BOSS_TRIBUNAL_OF_AGES && data == NOT_STARTED) - { - if (GameObject* pA = instance->GetGameObject(goAbedneumGUID)) - pA->SetGoState(GO_STATE_READY); - if (GameObject* pF = instance->GetGameObject(goSkyRoomFloorGUID)) - pF->SetGoState(GO_STATE_READY); - } + // Make sjonnir attackable + if (Creature *cr = instance->GetCreature(SjonnirGUID)) + cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + if (type == BOSS_TRIBUNAL_OF_AGES && data == NOT_STARTED) + { + if (GameObject* pA = instance->GetGameObject(goAbedneumGUID)) + pA->SetGoState(GO_STATE_READY); + if (GameObject* pF = instance->GetGameObject(goSkyRoomFloorGUID)) + pF->SetGoState(GO_STATE_READY); + } - if (type == DATA_BRANN_ACHIEVEMENT) - { - brannAchievement = (bool)data; - return; - } - if (type == DATA_SJONNIR_ACHIEVEMENT) - { - sjonnirAchievement = (bool)data; - return; - } - - if (data == DONE) - SaveToDB(); - } + if (type == DATA_BRANN_ACHIEVEMENT) + { + brannAchievement = (bool)data; + return; + } + if (type == DATA_SJONNIR_ACHIEVEMENT) + { + sjonnirAchievement = (bool)data; + return; + } + + if (data == DONE) + SaveToDB(); + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "H O S " << Encounter[0] << ' ' << Encounter[1] << ' ' << Encounter[2] << ' ' << Encounter[3] << ' ' << Encounter[4]; + std::ostringstream saveStream; + saveStream << "H O S " << Encounter[0] << ' ' << Encounter[1] << ' ' << Encounter[2] << ' ' << Encounter[3] << ' ' << Encounter[4]; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* strIn) - { - if (!strIn) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* strIn) + { + if (!strIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(strIn); + OUT_LOAD_INST_DATA(strIn); - char dataHead1, dataHead2, dataHead3; + char dataHead1, dataHead2, dataHead3; - std::istringstream loadStream(strIn); - loadStream >> dataHead1 >> dataHead2 >> dataHead3; + std::istringstream loadStream(strIn); + loadStream >> dataHead1 >> dataHead2 >> dataHead3; - if (dataHead1 == 'H' && dataHead2 == 'O' && dataHead3 == 'S') - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - loadStream >> Encounter[i]; - if( Encounter[i] == IN_PROGRESS ) - Encounter[i] = NOT_STARTED; - } - } - OUT_LOAD_INST_DATA_COMPLETE; - } - }; + if (dataHead1 == 'H' && dataHead2 == 'O' && dataHead3 == 'S') + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + loadStream >> Encounter[i]; + if( Encounter[i] == IN_PROGRESS ) + Encounter[i] = NOT_STARTED; + } + } + OUT_LOAD_INST_DATA_COMPLETE; + } + }; }; void AddSC_instance_halls_of_stone() { - new instance_halls_of_stone(); + new instance_halls_of_stone(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index e7818bdf7..c15969d45 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -16,54 +16,54 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - // Algalon the Observer - SPELL_ARRIVAL = 64997, - SPELL_RIDE_THE_LIGHTNING = 64986, - SPELL_SUMMON_AZEROTH = 64994, - SPELL_REORIGINATION = 64996, - SPELL_SUPERMASSIVE_FAIL = 65311, - SPELL_QUANTUM_STRIKE = 64395, - SPELL_PHASE_PUNCH = 64412, - SPELL_BIG_BANG = 64443, - SPELL_ASCEND_TO_THE_HEAVENS = 64487, - SPELL_COSMIC_SMASH = 62301, - SPELL_COSMIC_SMASH_TRIGGERED = 62304, - SPELL_COSMIC_SMASH_VISUAL_STATE = 62300, - SPELL_SELF_STUN = 65256, - SPELL_KILL_CREDIT = 65184, - SPELL_TELEPORT = 62940, - SPELL_DUAL_WIELD = 42459, + // Algalon the Observer + SPELL_ARRIVAL = 64997, + SPELL_RIDE_THE_LIGHTNING = 64986, + SPELL_SUMMON_AZEROTH = 64994, + SPELL_REORIGINATION = 64996, + SPELL_SUPERMASSIVE_FAIL = 65311, + SPELL_QUANTUM_STRIKE = 64395, + SPELL_PHASE_PUNCH = 64412, + SPELL_BIG_BANG = 64443, + SPELL_ASCEND_TO_THE_HEAVENS = 64487, + SPELL_COSMIC_SMASH = 62301, + SPELL_COSMIC_SMASH_TRIGGERED = 62304, + SPELL_COSMIC_SMASH_VISUAL_STATE = 62300, + SPELL_SELF_STUN = 65256, + SPELL_KILL_CREDIT = 65184, + SPELL_TELEPORT = 62940, + SPELL_DUAL_WIELD = 42459, - // Algalon Stalker - SPELL_TRIGGER_3_ADDS = 62266, // Triggers Living Constellation + // Algalon Stalker + SPELL_TRIGGER_3_ADDS = 62266, // Triggers Living Constellation - // Living Constellation - SPELL_ARCANE_BARRAGE = 64599, + // Living Constellation + SPELL_ARCANE_BARRAGE = 64599, - // Collapsing Star - SPELL_COLLAPSE = 62018, - SPELL_BLACK_HOLE_SPAWN_VISUAL = 62003, - SPELL_SUMMON_BLACK_HOLE = 62189, + // Collapsing Star + SPELL_COLLAPSE = 62018, + SPELL_BLACK_HOLE_SPAWN_VISUAL = 62003, + SPELL_SUMMON_BLACK_HOLE = 62189, - // Black Hole - SPELL_BLACK_HOLE_TRIGGER = 62185, - SPELL_CONSTELLATION_PHASE_TRIGGER = 65508, - SPELL_CONSTELLATION_PHASE_EFFECT = 65509, - SPELL_BLACK_HOLE_EXPLOSION = 64122, - SPELL_SUMMON_VOID_ZONE_VISUAL = 64470, - SPELL_VOID_ZONE_VISUAL = 64469, - SPELL_BLACK_HOLE_CREDIT = 65312, - SPELL_BLACK_HOLE_DAMAGE = 62169, + // Black Hole + SPELL_BLACK_HOLE_TRIGGER = 62185, + SPELL_CONSTELLATION_PHASE_TRIGGER = 65508, + SPELL_CONSTELLATION_PHASE_EFFECT = 65509, + SPELL_BLACK_HOLE_EXPLOSION = 64122, + SPELL_SUMMON_VOID_ZONE_VISUAL = 64470, + SPELL_VOID_ZONE_VISUAL = 64469, + SPELL_BLACK_HOLE_CREDIT = 65312, + SPELL_BLACK_HOLE_DAMAGE = 62169, - // Worm Hole - SPELL_WORM_HOLE_TRIGGER = 65251, - SPELL_SUMMON_UNLEASHED_DARK_MATTER = 64450, + // Worm Hole + SPELL_WORM_HOLE_TRIGGER = 65251, + SPELL_SUMMON_UNLEASHED_DARK_MATTER = 64450, }; enum Actions { - //ACTION_INIT_ALGALON = 1, defined in ulduar.h - //ACTION_DESPAWN_ALGALON = 2, defined in ulduar.h + //ACTION_INIT_ALGALON = 1, defined in ulduar.h + //ACTION_DESPAWN_ALGALON = 2, defined in ulduar.h ACTION_START_INTRO = 3, ACTION_FINISH_INTRO = 4, ACTION_ACTIVATE_STAR = 5, @@ -82,10 +82,10 @@ enum Misc POINT_ALGALON_LAND = 1, POINT_ALGALON_OUTRO = 2, - EVENT_ID_SUPERMASSIVE_START = 21697, + EVENT_ID_SUPERMASSIVE_START = 21697, - DATA_HAS_FED_ON_TEARS = 1, - DATA_HERALD_OF_THE_TITANS = 2, + DATA_HAS_FED_ON_TEARS = 1, + DATA_HERALD_OF_THE_TITANS = 2, }; enum Events @@ -127,14 +127,14 @@ enum Events EVENT_OUTRO_9 = 30, EVENT_OUTRO_10 = 31, EVENT_OUTRO_11 = 32, - EVENT_ACTIVATE_LIVING_CONSTELLATION = 33, - EVENT_CHECK_HERALD_ITEMS = 34, - EVENT_REMOVE_UNNATTACKABLE = 35, + EVENT_ACTIVATE_LIVING_CONSTELLATION = 33, + EVENT_CHECK_HERALD_ITEMS = 34, + EVENT_REMOVE_UNNATTACKABLE = 35, EVENT_DESPAWN_ALGALON_1 = 36, EVENT_DESPAWN_ALGALON_2 = 37, EVENT_DESPAWN_ALGALON_3 = 38, - EVENT_DESPAWN_ALGALON_4 = 39, - EVENT_DESPAWN_ALGALON_5 = 40, + EVENT_DESPAWN_ALGALON_4 = 39, + EVENT_DESPAWN_ALGALON_5 = 40, // Living Constellation EVENT_ARCANE_BARRAGE = 41, @@ -189,7 +189,7 @@ Position const BrannIntroWaypoint[MAX_BRANN_WAYPOINTS_INTRO] = {1632.814f, -173.9334f, 427.2621f, 0.0f}, {1632.676f, -190.5927f, 427.2631f, 0.0f}, {1631.497f, -214.2221f, 418.1152f, 0.0f}, - {1636.455f, -263.6647f, 417.3213f, 0.0f}, + {1636.455f, -263.6647f, 417.3213f, 0.0f}, {1629.586f, -267.9792f, 417.3219f, 0.0f}, {1631.497f, -214.2221f, 418.1152f, 0.0f}, {1632.676f, -190.5927f, 425.8831f, 0.0f}, @@ -203,13 +203,13 @@ Position const ConstellationPos[LIVING_CONSTELLATION_COUNT] = {1625.208f, -267.2771f, 446.4296f, 5.044002f}, {1593.389f, -299.4325f, 432.4636f, 6.073746f}, {1668.317f, -324.7676f, 457.9394f, 3.211406f}, - {1685.613f, -300.1219f, 443.2366f, 3.385939f}, + {1685.613f, -300.1219f, 443.2366f, 3.385939f}, {1592.242f, -325.5323f, 446.9508f, 0.226893f}, - {1658.279f, -262.5490f, 441.9073f, 4.188790f}, + {1658.279f, -262.5490f, 441.9073f, 4.188790f}, {1635.821f, -363.3442f, 424.3459f, 1.466077f}, - {1591.706f, -263.8201f, 441.4153f, 5.253441f}, + {1591.706f, -263.8201f, 441.4153f, 5.253441f}, {1672.188f, -357.2484f, 436.7337f, 2.338741f}, - {1678.677f, -276.3280f, 427.7531f, 3.979351f}, + {1678.677f, -276.3280f, 427.7531f, 3.979351f}, {1615.800f, -348.0065f, 442.9586f, 1.134464f}, }; @@ -255,129 +255,129 @@ class boss_algalon_the_observer : public CreatureScript { boss_algalon_the_observerAI(Creature* creature) : ScriptedAI(creature), summons(me) { - _fedOnTears = true; - _firstPull = true; - _fightWon = false; - m_pInstance = me->GetInstanceScript(); + _fedOnTears = true; + _firstPull = true; + _fightWon = false; + m_pInstance = me->GetInstanceScript(); } - EventMap events; - SummonList summons; - InstanceScript* m_pInstance; + EventMap events; + SummonList summons; + InstanceScript* m_pInstance; bool _firstPull; - bool _fightWon; - bool _phaseTwo; - bool _fedOnTears; - bool _heraldOfTheTitans; + bool _fightWon; + bool _phaseTwo; + bool _fedOnTears; + bool _heraldOfTheTitans; - bool IsValidHeraldItem(const ItemTemplate* item) - { - if (!item) // should not happen, but checked in GetAverageItemLevel() - return true; - if (item->ItemLevel <= 226 || item->ItemLevel <= 232 && ( - item->InventoryType == INVTYPE_SHIELD || - item->Class == ITEM_CLASS_WEAPON || - item->Class == ITEM_CLASS_ARMOR && (item->InventoryType == INVTYPE_RELIC || item->InventoryType == INVTYPE_HOLDABLE) - )) - return true; - return false; - } + bool IsValidHeraldItem(const ItemTemplate* item) + { + if (!item) // should not happen, but checked in GetAverageItemLevel() + return true; + if (item->ItemLevel <= 226 || item->ItemLevel <= 232 && ( + item->InventoryType == INVTYPE_SHIELD || + item->Class == ITEM_CLASS_WEAPON || + item->Class == ITEM_CLASS_ARMOR && (item->InventoryType == INVTYPE_RELIC || item->InventoryType == INVTYPE_HOLDABLE) + )) + return true; + return false; + } - bool DoCheckHeraldOfTheTitans() - { - if (!_heraldOfTheTitans) - return true; + bool DoCheckHeraldOfTheTitans() + { + if (!_heraldOfTheTitans) + return true; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* plr = itr->GetSource()) - if (!plr->IsGameMaster() && plr->IsInCombat() /*performance*/) - { - for (uint8 i=EQUIPMENT_SLOT_START; iGetItemByPos(INVENTORY_SLOT_BAG_0, i)) - if (!IsValidHeraldItem(item->GetTemplate())) - { - _heraldOfTheTitans = false; - return true; - } - } + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* plr = itr->GetSource()) + if (!plr->IsGameMaster() && plr->IsInCombat() /*performance*/) + { + for (uint8 i=EQUIPMENT_SLOT_START; iGetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (!IsValidHeraldItem(item->GetTemplate())) + { + _heraldOfTheTitans = false; + return true; + } + } - return false; - } + return false; + } - void AttackStart(Unit* who) - { - if (_fightWon) - return; - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (_fightWon) + return; + ScriptedAI::AttackStart(who); + } - uint32 GetData(uint32 param) const - { - if (param == DATA_HAS_FED_ON_TEARS) - return _fedOnTears; - if (param == DATA_HERALD_OF_THE_TITANS) - return _heraldOfTheTitans; - return 0; - } + uint32 GetData(uint32 param) const + { + if (param == DATA_HAS_FED_ON_TEARS) + return _fedOnTears; + if (param == DATA_HERALD_OF_THE_TITANS) + return _heraldOfTheTitans; + return 0; + } - void CallConstellations() - { - uint8 _count = 0; - for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ) - { - Creature* summon = ObjectAccessor::GetCreature(*me, *i++); - if (summon && summon->GetEntry() == NPC_LIVING_CONSTELLATION && !summon->AI()->GetData(0)) - { - ++_count; - summon->AI()->DoAction(ACTION_ACTIVATE_STAR); - if (_count >= 3) - break; - } - } - } + void CallConstellations() + { + uint8 _count = 0; + for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ) + { + Creature* summon = ObjectAccessor::GetCreature(*me, *i++); + if (summon && summon->GetEntry() == NPC_LIVING_CONSTELLATION && !summon->AI()->GetData(0)) + { + ++_count; + summon->AI()->DoAction(ACTION_ACTIVATE_STAR); + if (_count >= 3) + break; + } + } + } - void EnterEvadeMode() - { - if (_fightWon) - return; + void EnterEvadeMode() + { + if (_fightWon) + return; - if (SelectTargetFromPlayerList(120.0f)) - { - me->SetInCombatWithZone(); - return; - } + if (SelectTargetFromPlayerList(120.0f)) + { + me->SetInCombatWithZone(); + return; + } - ScriptedAI::EnterEvadeMode(); - } + ScriptedAI::EnterEvadeMode(); + } void Reset() { - if (_fightWon) - return; + if (_fightWon) + return; events.Reset(); - summons.DespawnAll(); + summons.DespawnAll(); me->SetReactState(REACT_PASSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetSheath(SHEATH_STATE_UNARMED); - me->setFaction(190); - me->CastSpell(me, SPELL_DUAL_WIELD, true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetSheath(SHEATH_STATE_UNARMED); + me->setFaction(190); + me->CastSpell(me, SPELL_DUAL_WIELD, true); - _phaseTwo = false; - _heraldOfTheTitans = true; + _phaseTwo = false; + _heraldOfTheTitans = true; - if (m_pInstance) - m_pInstance->SetData(TYPE_ALGALON, NOT_STARTED); + if (m_pInstance) + m_pInstance->SetData(TYPE_ALGALON, NOT_STARTED); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() != TYPEID_PLAYER || urand(0,2)) - return; + if (victim->GetTypeId() != TYPEID_PLAYER || urand(0,2)) + return; - Talk(SAY_ALGALON_KILL); + Talk(SAY_ALGALON_KILL); } void DoAction(int32 action) @@ -386,10 +386,10 @@ class boss_algalon_the_observer : public CreatureScript { case ACTION_START_INTRO: { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_INSTANTLY_APPEAR_MODEL); me->SetDisableGravity(true); - me->CastSpell(me, SPELL_ARRIVAL, true); + me->CastSpell(me, SPELL_ARRIVAL, true); me->CastSpell(me, SPELL_RIDE_THE_LIGHTNING, true); me->GetMotionMaster()->MovePoint(POINT_ALGALON_LAND, AlgalonLandPos); me->SetHomePosition(AlgalonLandPos); @@ -406,91 +406,91 @@ class boss_algalon_the_observer : public CreatureScript break; } case ACTION_DESPAWN_ALGALON: - _fightWon = true; - events.Reset(); - summons.DespawnAll(); + _fightWon = true; + events.Reset(); + summons.DespawnAll(); events.SetPhase(PHASE_ROLE_PLAY); events.ScheduleEvent(EVENT_DESPAWN_ALGALON_1, 5000); events.ScheduleEvent(EVENT_DESPAWN_ALGALON_2, 17000); - events.ScheduleEvent(EVENT_DESPAWN_ALGALON_3, 26000); - if (me->IsInCombat()) - events.ScheduleEvent(EVENT_DESPAWN_ALGALON_4, 26000); - events.ScheduleEvent(EVENT_DESPAWN_ALGALON_5, 32000); + events.ScheduleEvent(EVENT_DESPAWN_ALGALON_3, 26000); + if (me->IsInCombat()) + events.ScheduleEvent(EVENT_DESPAWN_ALGALON_4, 26000); + events.ScheduleEvent(EVENT_DESPAWN_ALGALON_5, 32000); me->DespawnOrUnsummon(39000); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->InterruptNonMeleeSpells(false); - if (m_pInstance) - m_pInstance->SetData(TYPE_ALGALON, NOT_STARTED); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->InterruptNonMeleeSpells(false); + if (m_pInstance) + m_pInstance->SetData(TYPE_ALGALON, NOT_STARTED); break; case ACTION_INIT_ALGALON: _firstPull = false; - _fedOnTears = false; + _fedOnTears = false; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; - case ACTION_ASCEND: - summons.DespawnAll(); + case ACTION_ASCEND: + summons.DespawnAll(); events.SetPhase(PHASE_BIG_BANG); events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1500); break; - case ACTION_FEEDS_ON_TEARS_FAILED: - _fedOnTears = false; + case ACTION_FEEDS_ON_TEARS_FAILED: + _fedOnTears = false; } } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } void EnterCombat(Unit*) { - if (_fightWon) - return; + if (_fightWon) + return; - if (!m_pInstance) - { - EnterEvadeMode(); - return; - } + if (!m_pInstance) + { + EnterEvadeMode(); + return; + } uint32 introDelay = 0; - me->setActive(true); - me->SetInCombatWithZone(); + me->setActive(true); + me->SetInCombatWithZone(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); events.Reset(); events.SetPhase(PHASE_ROLE_PLAY); if (!_firstPull) { - events.ScheduleEvent(EVENT_START_COMBAT, 0); + events.ScheduleEvent(EVENT_START_COMBAT, 0); introDelay = 8000; } else { - summons.DespawnEntry(NPC_AZEROTH); + summons.DespawnEntry(NPC_AZEROTH); _firstPull = false; - Talk(SAY_ALGALON_START_TIMER); + Talk(SAY_ALGALON_START_TIMER); introDelay = 22000; events.ScheduleEvent(EVENT_START_COMBAT, 14000); - m_pInstance->SetData(DATA_DESPAWN_ALGALON, 0); + m_pInstance->SetData(DATA_DESPAWN_ALGALON, 0); } - events.ScheduleEvent(EVENT_REMOVE_UNNATTACKABLE, introDelay-500); + events.ScheduleEvent(EVENT_REMOVE_UNNATTACKABLE, introDelay-500); events.ScheduleEvent(EVENT_INTRO_TIMER_DONE, introDelay); events.ScheduleEvent(EVENT_QUANTUM_STRIKE, 3500 + introDelay); events.ScheduleEvent(EVENT_PHASE_PUNCH, 15500 + introDelay); events.ScheduleEvent(EVENT_SUMMON_COLLAPSING_STAR, 16500 + introDelay); - events.ScheduleEvent(EVENT_COSMIC_SMASH, 25000 + introDelay); - events.ScheduleEvent(EVENT_ACTIVATE_LIVING_CONSTELLATION, 50500 + introDelay); - events.ScheduleEvent(EVENT_BIG_BANG, 90000 + introDelay); + events.ScheduleEvent(EVENT_COSMIC_SMASH, 25000 + introDelay); + events.ScheduleEvent(EVENT_ACTIVATE_LIVING_CONSTELLATION, 50500 + introDelay); + events.ScheduleEvent(EVENT_BIG_BANG, 90000 + introDelay); events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 360000 + introDelay); - events.ScheduleEvent(EVENT_CHECK_HERALD_ITEMS, 5000); - DoCheckHeraldOfTheTitans(); + events.ScheduleEvent(EVENT_CHECK_HERALD_ITEMS, 5000); + DoCheckHeraldOfTheTitans(); } void MovementInform(uint32 movementType, uint32 pointId) @@ -521,7 +521,7 @@ class boss_algalon_the_observer : public CreatureScript switch (summon->GetEntry()) { case NPC_AZEROTH: - me->CastSpell(summon, SPELL_REORIGINATION, true); + me->CastSpell(summon, SPELL_REORIGINATION, true); break; case NPC_BLACK_HOLE: summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_TRIGGER, true); @@ -536,23 +536,23 @@ class boss_algalon_the_observer : public CreatureScript summon->CastSpell(summon, SPELL_COSMIC_SMASH_VISUAL_STATE, true); break; case NPC_ALGALON_STALKER_ASTEROID_TARGET_02: - { - float x = summon->GetPositionX(); - float y = summon->GetPositionY(); - float z = summon->GetPositionZ()+35.0f; - float o = summon->GetOrientation(); + { + float x = summon->GetPositionX(); + float y = summon->GetPositionY(); + float z = summon->GetPositionZ()+35.0f; + float o = summon->GetOrientation(); - summon->GetMotionMaster()->Clear(); - summon->SetHomePosition(x, y, z, o); - summon->UpdatePosition(x, y, z, o, true); - summon->StopMovingOnCurrentPos(); + summon->GetMotionMaster()->Clear(); + summon->SetHomePosition(x, y, z, o); + summon->UpdatePosition(x, y, z, o, true); + summon->StopMovingOnCurrentPos(); summon->m_Events.AddEvent(new CosmicSmashDamageEvent(summon), summon->m_Events.CalculateTime(4000)); break; - } + } case NPC_UNLEASHED_DARK_MATTER: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - if (summon->Attack(target, true)) - summon->GetMotionMaster()->MoveChase(target); + if (summon->Attack(target, true)) + summon->GetMotionMaster()->MoveChase(target); break; } } @@ -574,10 +574,10 @@ class boss_algalon_the_observer : public CreatureScript summons.DespawnEntry(NPC_BLACK_HOLE); summons.DespawnEntry(NPC_ALGALON_VOID_ZONE_VISUAL_STALKER); events.CancelEvent(EVENT_SUMMON_COLLAPSING_STAR); - events.CancelEvent(EVENT_ACTIVATE_LIVING_CONSTELLATION); + events.CancelEvent(EVENT_ACTIVATE_LIVING_CONSTELLATION); for (uint32 i = 0; i < COLLAPSING_STAR_COUNT; ++i) - me->SummonCreature(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN); } else if (me->HealthBelowPctDamaged(2, damage) && !_fightWon) { @@ -589,7 +589,7 @@ class boss_algalon_the_observer : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); events.Reset(); summons.DespawnAll(); - me->InterruptNonMeleeSpells(false); + me->InterruptNonMeleeSpells(false); events.SetPhase(PHASE_ROLE_PLAY); events.ScheduleEvent(EVENT_OUTRO_START, 1500); events.ScheduleEvent(EVENT_OUTRO_1, 7200); @@ -610,192 +610,192 @@ class boss_algalon_the_observer : public CreatureScript { case EVENT_INTRO_1: me->RemoveAurasDueToSpell(SPELL_RIDE_THE_LIGHTNING); - Talk(SAY_ALGALON_INTRO_1); - events.PopEvent(); + Talk(SAY_ALGALON_INTRO_1); + events.PopEvent(); break; case EVENT_INTRO_2: - me->CastSpell((Unit*)NULL, SPELL_SUMMON_AZEROTH, true); + me->CastSpell((Unit*)NULL, SPELL_SUMMON_AZEROTH, true); Talk(SAY_ALGALON_INTRO_2); - events.PopEvent(); + events.PopEvent(); break; case EVENT_INTRO_3: Talk(SAY_ALGALON_INTRO_3); - events.PopEvent(); + events.PopEvent(); break; case EVENT_INTRO_FINISH: events.Reset(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - if (Creature* brann = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_BRANN_BRONZBEARD_ALG))) - brann->AI()->DoAction(ACTION_FINISH_INTRO); + if (Creature* brann = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_BRANN_BRONZBEARD_ALG))) + brann->AI()->DoAction(ACTION_FINISH_INTRO); break; case EVENT_START_COMBAT: - m_pInstance->SetData(TYPE_ALGALON, IN_PROGRESS); - Talk(SAY_ALGALON_AGGRO); - events.PopEvent(); + m_pInstance->SetData(TYPE_ALGALON, IN_PROGRESS); + Talk(SAY_ALGALON_AGGRO); + events.PopEvent(); break; - case EVENT_REMOVE_UNNATTACKABLE: - me->SetSheath(SHEATH_STATE_MELEE); + case EVENT_REMOVE_UNNATTACKABLE: + me->SetSheath(SHEATH_STATE_MELEE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); - events.PopEvent(); - break; + events.PopEvent(); + break; case EVENT_INTRO_TIMER_DONE: events.SetPhase(PHASE_NORMAL); - me->CastSpell((Unit*)NULL, SPELL_SUPERMASSIVE_FAIL, true); - // Hack: _IsValidTarget failed earlier due to flags, call AttackStart again - me->SetReactState(REACT_AGGRESSIVE); - me->setFaction(14); - if (Player* target = SelectTargetFromPlayerList(150.0f)) - AttackStart(target); - me->SetInCombatWithZone(); - events.PopEvent(); + me->CastSpell((Unit*)NULL, SPELL_SUPERMASSIVE_FAIL, true); + // Hack: _IsValidTarget failed earlier due to flags, call AttackStart again + me->SetReactState(REACT_AGGRESSIVE); + me->setFaction(14); + if (Player* target = SelectTargetFromPlayerList(150.0f)) + AttackStart(target); + me->SetInCombatWithZone(); + events.PopEvent(); for (uint32 i = 0; i < LIVING_CONSTELLATION_COUNT; ++i) - me->SummonCreature(NPC_LIVING_CONSTELLATION, ConstellationPos[i], TEMPSUMMON_DEAD_DESPAWN); + me->SummonCreature(NPC_LIVING_CONSTELLATION, ConstellationPos[i], TEMPSUMMON_DEAD_DESPAWN); break; case EVENT_QUANTUM_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_QUANTUM_STRIKE, false); - events.RepeatEvent(urand(3000, 4500)); + me->CastSpell(me->GetVictim(), SPELL_QUANTUM_STRIKE, false); + events.RepeatEvent(urand(3000, 4500)); break; - case EVENT_PHASE_PUNCH: - me->CastSpell(me->GetVictim(), SPELL_PHASE_PUNCH, false); - events.RepeatEvent(15500); + case EVENT_PHASE_PUNCH: + me->CastSpell(me->GetVictim(), SPELL_PHASE_PUNCH, false); + events.RepeatEvent(15500); break; - case EVENT_SUMMON_COLLAPSING_STAR: + case EVENT_SUMMON_COLLAPSING_STAR: Talk(SAY_ALGALON_COLLAPSING_STAR); Talk(EMOTE_ALGALON_COLLAPSING_STAR); for (uint8 i = 0; i < COLLAPSING_STAR_COUNT; ++i) me->SummonCreature(NPC_COLLAPSING_STAR, CollapsingStarPos[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); events.RepeatEvent(60000); break; - case EVENT_COSMIC_SMASH: + case EVENT_COSMIC_SMASH: Talk(EMOTE_ALGALON_COSMIC_SMASH); me->CastCustomSpell(SPELL_COSMIC_SMASH, SPELLVALUE_MAX_TARGETS, RAID_MODE(1,3), (Unit*)NULL); events.RepeatEvent(25500); break; - case EVENT_ACTIVATE_LIVING_CONSTELLATION: - { - if (events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) - { - events.RepeatEvent(4000); - break; - } - CallConstellations(); - //me->CastSpell(me, SPELL_TRIGGER_3_ADDS, true); - events.RepeatEvent(50000); - break; - } + case EVENT_ACTIVATE_LIVING_CONSTELLATION: + { + if (events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) + { + events.RepeatEvent(4000); + break; + } + CallConstellations(); + //me->CastSpell(me, SPELL_TRIGGER_3_ADDS, true); + events.RepeatEvent(50000); + break; + } case EVENT_BIG_BANG: - { + { Talk(SAY_ALGALON_BIG_BANG); Talk(EMOTE_ALGALON_BIG_BANG); EntryCheckPredicate pred(NPC_LIVING_CONSTELLATION); - summons.DoAction(ACTION_BIG_BANG, pred); + summons.DoAction(ACTION_BIG_BANG, pred); me->CastSpell((Unit*)NULL, SPELL_BIG_BANG, false); events.RepeatEvent(90500); break; - } + } case EVENT_ASCEND_TO_THE_HEAVENS: Talk(SAY_ALGALON_ASCEND); - me->CastSpell((Unit*)NULL, SPELL_ASCEND_TO_THE_HEAVENS, false); + me->CastSpell((Unit*)NULL, SPELL_ASCEND_TO_THE_HEAVENS, false); events.ScheduleEvent(EVENT_EVADE, 2500); - events.PopEvent(); + events.PopEvent(); break; case EVENT_EVADE: - events.Reset(); - ScriptedAI::EnterEvadeMode(); + events.Reset(); + ScriptedAI::EnterEvadeMode(); return; case EVENT_OUTRO_START: if (m_pInstance) - { - m_pInstance->SetData(TYPE_ALGALON, DONE); - m_pInstance->SetData(DATA_ALGALON_DEFEATED, 1); - } - events.PopEvent(); + { + m_pInstance->SetData(TYPE_ALGALON, DONE); + m_pInstance->SetData(DATA_ALGALON_DEFEATED, 1); + } + events.PopEvent(); break; case EVENT_OUTRO_1: me->RemoveAllAuras(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_RENAME); - events.PopEvent(); + events.PopEvent(); break; case EVENT_OUTRO_2: _EnterEvadeMode(); me->GetMotionMaster()->MovePoint(POINT_ALGALON_OUTRO, AlgalonOutroPos); - events.PopEvent(); + events.PopEvent(); break; case EVENT_OUTRO_3: - me->CastSpell((Unit*)NULL, SPELL_KILL_CREDIT); - // Summon Chest - if (GameObject* go = me->SummonGameObject(RAID_MODE(GO_ALGALON_CHEST, GO_ALGALON_CHEST_HERO), 1632.1f, -306.561f, 417.321f, 4.69494f, 0, 0, 0, 1, 0)) - go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); - events.PopEvent(); + me->CastSpell((Unit*)NULL, SPELL_KILL_CREDIT); + // Summon Chest + if (GameObject* go = me->SummonGameObject(RAID_MODE(GO_ALGALON_CHEST, GO_ALGALON_CHEST_HERO), 1632.1f, -306.561f, 417.321f, 4.69494f, 0, 0, 0, 1, 0)) + go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); + events.PopEvent(); break; case EVENT_OUTRO_4: - me->CastSpell((Unit*)NULL, SPELL_SUPERMASSIVE_FAIL); + me->CastSpell((Unit*)NULL, SPELL_SUPERMASSIVE_FAIL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - events.PopEvent(); + events.PopEvent(); break; case EVENT_OUTRO_5: - if (Creature* brann = me->SummonCreature(NPC_BRANN_BRONZBEARD_ALG, BrannOutroPos[0], TEMPSUMMON_TIMED_DESPAWN, 131500)) + if (Creature* brann = me->SummonCreature(NPC_BRANN_BRONZBEARD_ALG, BrannOutroPos[0], TEMPSUMMON_TIMED_DESPAWN, 131500)) brann->AI()->DoAction(ACTION_OUTRO); - events.PopEvent(); + events.PopEvent(); break; case EVENT_OUTRO_6: Talk(SAY_ALGALON_OUTRO_1); me->SetStandState(UNIT_STAND_STATE_KNEEL); - events.PopEvent(); + events.PopEvent(); break; case EVENT_OUTRO_7: Talk(SAY_ALGALON_OUTRO_2); - events.PopEvent(); + events.PopEvent(); break; case EVENT_OUTRO_8: Talk(SAY_ALGALON_OUTRO_3); - events.PopEvent(); + events.PopEvent(); break; case EVENT_OUTRO_9: Talk(SAY_ALGALON_OUTRO_4); - events.PopEvent(); + events.PopEvent(); break; case EVENT_OUTRO_10: Talk(SAY_ALGALON_OUTRO_5); - events.PopEvent(); + events.PopEvent(); break; case EVENT_OUTRO_11: me->SetStandState(UNIT_STAND_STATE_STAND); - me->CastSpell(me, SPELL_TELEPORT, false); + me->CastSpell(me, SPELL_TELEPORT, false); me->DespawnOrUnsummon(3000); - events.PopEvent(); + events.PopEvent(); break; - case EVENT_DESPAWN_ALGALON_1: - Talk(SAY_ALGALON_DESPAWN_1); - events.PopEvent(); - break; - case EVENT_DESPAWN_ALGALON_2: - Talk(SAY_ALGALON_DESPAWN_2); - events.PopEvent(); - break; - case EVENT_DESPAWN_ALGALON_3: - Talk(SAY_ALGALON_DESPAWN_3); - events.PopEvent(); - break; - case EVENT_DESPAWN_ALGALON_4: - me->CastSpell((Unit*)NULL, SPELL_ASCEND_TO_THE_HEAVENS, false); - events.PopEvent(); - break; - case EVENT_DESPAWN_ALGALON_5: - me->SetStandState(UNIT_STAND_STATE_STAND); - me->CastSpell(me, SPELL_TELEPORT, false); + case EVENT_DESPAWN_ALGALON_1: + Talk(SAY_ALGALON_DESPAWN_1); + events.PopEvent(); + break; + case EVENT_DESPAWN_ALGALON_2: + Talk(SAY_ALGALON_DESPAWN_2); + events.PopEvent(); + break; + case EVENT_DESPAWN_ALGALON_3: + Talk(SAY_ALGALON_DESPAWN_3); + events.PopEvent(); + break; + case EVENT_DESPAWN_ALGALON_4: + me->CastSpell((Unit*)NULL, SPELL_ASCEND_TO_THE_HEAVENS, false); + events.PopEvent(); + break; + case EVENT_DESPAWN_ALGALON_5: + me->SetStandState(UNIT_STAND_STATE_STAND); + me->CastSpell(me, SPELL_TELEPORT, false); me->DespawnOrUnsummon(3000); - events.PopEvent(); - break; - case EVENT_CHECK_HERALD_ITEMS: - if (DoCheckHeraldOfTheTitans()) - events.PopEvent(); - else - events.RepeatEvent(5000); - break; + events.PopEvent(); + break; + case EVENT_CHECK_HERALD_ITEMS: + if (DoCheckHeraldOfTheTitans()) + events.PopEvent(); + else + events.RepeatEvent(5000); + break; } DoMeleeAttackIfReady(); @@ -819,7 +819,7 @@ class npc_brann_bronzebeard_algalon : public CreatureScript { } - EventMap events; + EventMap events; uint32 _currentPoint; void DoAction(int32 action) @@ -827,9 +827,9 @@ class npc_brann_bronzebeard_algalon : public CreatureScript switch (action) { case ACTION_START_INTRO: - me->SetWalk(false); + me->SetWalk(false); _currentPoint = 0; - events.Reset(); + events.Reset(); events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1); break; case ACTION_FINISH_INTRO: @@ -858,9 +858,9 @@ class npc_brann_bronzebeard_algalon : public CreatureScript me->SetWalk(true); break; case 6: - me->SetFacingTo(4.6156f); + me->SetFacingTo(4.6156f); me->SetWalk(false); - Talk(SAY_BRANN_ALGALON_INTRO_1); + Talk(SAY_BRANN_ALGALON_INTRO_1); events.ScheduleEvent(EVENT_SUMMON_ALGALON, 7500); return; case 10: @@ -882,23 +882,23 @@ class npc_brann_bronzebeard_algalon : public CreatureScript switch (events.GetEvent()) { case EVENT_BRANN_MOVE_INTRO: - events.PopEvent(); + events.PopEvent(); if (_currentPoint < MAX_BRANN_WAYPOINTS_INTRO) me->GetMotionMaster()->MovePoint(_currentPoint, BrannIntroWaypoint[_currentPoint]); break; case EVENT_SUMMON_ALGALON: - if (me->GetInstanceScript() && !me->GetInstanceScript()->GetData64(TYPE_ALGALON)) - if (Creature* algalon = me->GetMap()->SummonCreature(NPC_ALGALON, AlgalonSummonPos)) - algalon->AI()->DoAction(ACTION_START_INTRO); - events.PopEvent(); + if (me->GetInstanceScript() && !me->GetInstanceScript()->GetData64(TYPE_ALGALON)) + if (Creature* algalon = me->GetMap()->SummonCreature(NPC_ALGALON, AlgalonSummonPos)) + algalon->AI()->DoAction(ACTION_START_INTRO); + events.PopEvent(); break; case EVENT_BRANN_OUTRO_1: - Talk(SAY_BRANN_ALGALON_OUTRO); - events.PopEvent(); + Talk(SAY_BRANN_ALGALON_OUTRO); + events.PopEvent(); break; case EVENT_BRANN_OUTRO_2: me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO_END, BrannOutroPos[2]); - events.PopEvent(); + events.PopEvent(); break; } } @@ -919,7 +919,7 @@ class npc_collapsing_star : public CreatureScript { npc_collapsing_starAI(Creature* creature) : NullCreatureAI(creature) { - creature->GetMotionMaster()->MoveRandom(25.0f); + creature->GetMotionMaster()->MoveRandom(25.0f); creature->CastSpell(creature, SPELL_COLLAPSE, true); } @@ -955,10 +955,10 @@ class npc_living_constellation : public CreatureScript { npc_living_constellationAI(Creature* creature) : ScriptedAI(creature) { - me->SetReactState(REACT_PASSIVE); + me->SetReactState(REACT_PASSIVE); } - EventMap events; + EventMap events; bool _isActive; void Reset() @@ -978,16 +978,16 @@ class npc_living_constellation : public CreatureScript switch (action) { case ACTION_ACTIVATE_STAR: - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); - _isActive = true; - - if (Player* target = SelectTargetFromPlayerList(250.0f)) - { - AttackStart(target); - me->AddThreat(target, 100.0f); - } - me->SetInCombatWithZone(); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + _isActive = true; + + if (Player* target = SelectTargetFromPlayerList(250.0f)) + { + AttackStart(target); + me->AddThreat(target, 100.0f); + } + me->SetInCombatWithZone(); break; case ACTION_BIG_BANG: events.SetPhase(PHASE_BIG_BANG); @@ -1007,9 +1007,9 @@ class npc_living_constellation : public CreatureScript caster->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_CREDIT, TRIGGERED_FULL_MASK); caster->ToCreature()->DespawnOrUnsummon(1); - me->DespawnOrUnsummon(1); - if (Creature* voidZone = caster->FindNearestCreature(NPC_ALGALON_VOID_ZONE_VISUAL_STALKER, 10.0f)) - voidZone->DespawnOrUnsummon(1); + me->DespawnOrUnsummon(1); + if (Creature* voidZone = caster->FindNearestCreature(NPC_ALGALON_VOID_ZONE_VISUAL_STALKER, 10.0f)) + voidZone->DespawnOrUnsummon(1); } void UpdateAI(uint32 diff) @@ -1021,14 +1021,14 @@ class npc_living_constellation : public CreatureScript switch (events.GetEvent()) { case EVENT_ARCANE_BARRAGE: - me->CastCustomSpell(SPELL_ARCANE_BARRAGE, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, true); + me->CastCustomSpell(SPELL_ARCANE_BARRAGE, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, true); events.RepeatEvent(2500); break; case EVENT_RESUME_UPDATING: events.SetPhase(0); - events.PopEvent(); + events.PopEvent(); break; - } + } } }; @@ -1047,26 +1047,26 @@ class npc_algalon_worm_hole : public CreatureScript { npc_algalon_worm_holeAI(Creature* creature) : NullCreatureAI(creature) { - creature->CastSpell(creature, SPELL_WORM_HOLE_TRIGGER, true); + creature->CastSpell(creature, SPELL_WORM_HOLE_TRIGGER, true); creature->CastSpell(creature, SPELL_SUMMON_VOID_ZONE_VISUAL, true); } - uint32 _summonTimer; + uint32 _summonTimer; - void Reset() - { - _summonTimer = urand(22000, 24000); - } + void Reset() + { + _summonTimer = urand(22000, 24000); + } - void UpdateAI(uint32 diff) - { - _summonTimer += diff; - if (_summonTimer >= 30000) - { - me->CastSpell((Unit*)NULL, SPELL_SUMMON_UNLEASHED_DARK_MATTER, true); - _summonTimer = 0; - } - } + void UpdateAI(uint32 diff) + { + _summonTimer += diff; + if (_summonTimer >= 30000) + { + me->CastSpell((Unit*)NULL, SPELL_SUMMON_UNLEASHED_DARK_MATTER, true); + _summonTimer = 0; + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -1084,11 +1084,11 @@ class go_celestial_planetarium_access : public GameObjectScript { go_celestial_planetarium_accessAI(GameObject* go) : GameObjectAI(go) { - _locked = false; + _locked = false; } - EventMap events; - bool _locked; + EventMap events; + bool _locked; bool GossipHello(Player* player, bool reportUse) { @@ -1112,9 +1112,9 @@ class go_celestial_planetarium_access : public GameObjectScript if (!hasKey) return false; - if (_locked) - return false; - _locked = true; + if (_locked) + return false; + _locked = true; // Start Algalon event go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); events.ScheduleEvent(EVENT_DESPAWN_CONSOLE, 5000); @@ -1144,7 +1144,7 @@ class go_celestial_planetarium_access : public GameObjectScript { case EVENT_DESPAWN_CONSOLE: go->Delete(); - events.PopEvent(); + events.PopEvent(); break; } } @@ -1257,7 +1257,7 @@ class spell_algalon_trigger_3_adds : public SpellScriptLoader void Register() { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_algalon_trigger_3_adds_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - OnEffectHitTarget += SpellEffectFn(spell_algalon_trigger_3_adds_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_algalon_trigger_3_adds_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -1281,10 +1281,10 @@ class spell_algalon_cosmic_smash_damage : public SpellScriptLoader if (!GetExplTargetDest() || !GetHitUnit()) return; - float distance = GetHitUnit()->GetDistance2d(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY()); - if (distance >= 10.0f) - SetHitDamage(int32(float(GetHitDamage()) / distance)); - else if (distance > 6.0f) + float distance = GetHitUnit()->GetDistance2d(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY()); + if (distance >= 10.0f) + SetHitDamage(int32(float(GetHitDamage()) / distance)); + else if (distance > 6.0f) SetHitDamage(int32(float(GetHitDamage()) / distance) * 2); } @@ -1354,7 +1354,7 @@ class spell_algalon_remove_phase : public SpellScriptLoader { PreventDefaultAction(); GetTarget()->RemoveAurasByType(SPELL_AURA_PHASE); - GetTarget()->RemoveAurasDueToSpell(SPELL_BLACK_HOLE_DAMAGE); + GetTarget()->RemoveAurasDueToSpell(SPELL_BLACK_HOLE_DAMAGE); } void Register() @@ -1422,26 +1422,26 @@ class achievement_algalon_herald_of_the_titans : public AchievementCriteriaScrip void AddSC_boss_algalon_the_observer() { - // NPCs - new boss_algalon_the_observer(); - new npc_brann_bronzebeard_algalon(); - new npc_collapsing_star(); - new npc_living_constellation(); - new npc_algalon_worm_hole(); + // NPCs + new boss_algalon_the_observer(); + new npc_brann_bronzebeard_algalon(); + new npc_collapsing_star(); + new npc_living_constellation(); + new npc_algalon_worm_hole(); - // GOs - new go_celestial_planetarium_access(); + // GOs + new go_celestial_planetarium_access(); - // Spells - new spell_algalon_phase_punch(); - new spell_algalon_collapse(); - new spell_algalon_trigger_3_adds(); - new spell_algalon_cosmic_smash_damage(); - new spell_algalon_big_bang(); - new spell_algalon_remove_phase(); - new spell_algalon_supermassive_fail(); + // Spells + new spell_algalon_phase_punch(); + new spell_algalon_collapse(); + new spell_algalon_trigger_3_adds(); + new spell_algalon_cosmic_smash_damage(); + new spell_algalon_big_bang(); + new spell_algalon_remove_phase(); + new spell_algalon_supermassive_fail(); - // Achievements - new achievement_algalon_he_feeds_on_your_tears(); - new achievement_algalon_herald_of_the_titans(); + // Achievements + new achievement_algalon_he_feeds_on_your_tears(); + new achievement_algalon_herald_of_the_titans(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp index b2e31d1df..bb7b8a260 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp @@ -11,177 +11,177 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum AssemblySpells { - // Any boss - SPELL_SUPERCHARGE = 61920, - SPELL_BERSERK = 47008, + // Any boss + SPELL_SUPERCHARGE = 61920, + SPELL_BERSERK = 47008, - // Steelbreaker - SPELL_HIGH_VOLTAGE_10 = 61890, - SPELL_HIGH_VOLTAGE_25 = 63498, - SPELL_FUSION_PUNCH_10 = 61903, - SPELL_FUSION_PUNCH_25 = 63493, - SPELL_STATIC_DISRUPTION_10 = 61911, - SPELL_STATIC_DISRUPTION_25 = 63495, - SPELL_OVERWHELMING_POWER_10 = 64637, - SPELL_OVERWHELMING_POWER_25 = 61888, - SPELL_ELECTRICAL_CHARGE = 61902, + // Steelbreaker + SPELL_HIGH_VOLTAGE_10 = 61890, + SPELL_HIGH_VOLTAGE_25 = 63498, + SPELL_FUSION_PUNCH_10 = 61903, + SPELL_FUSION_PUNCH_25 = 63493, + SPELL_STATIC_DISRUPTION_10 = 61911, + SPELL_STATIC_DISRUPTION_25 = 63495, + SPELL_OVERWHELMING_POWER_10 = 64637, + SPELL_OVERWHELMING_POWER_25 = 61888, + SPELL_ELECTRICAL_CHARGE = 61902, - // Runemaster Molgeim - SPELL_SHIELD_OF_RUNES_BUFF = 62277, - SPELL_SHIELD_OF_RUNES_10 = 62274, - SPELL_SHIELD_OF_RUNES_25 = 63489, - SPELL_RUNE_OF_POWER = 61973, - SPELL_RUNE_OF_DEATH_10 = 62269, - SPELL_RUNE_OF_DEATH_25 = 63490, - SPELL_RUNE_OF_SUMMONING = 62273, - SPELL_RUNE_OF_SUMMONING_VISUAL = 62019, - SPELL_LIGHTNING_BLAST_10 = 62054, - SPELL_LIGHTNING_BLAST_25 = 63491, - CREATURE_LIGHTNING_ELEMENTAL = 32958, - CREATURE_RUNE_OF_SUMMONING = 33051, - SPELL_RUNE_OF_POWER_OOC_CHANNEL = 61975, + // Runemaster Molgeim + SPELL_SHIELD_OF_RUNES_BUFF = 62277, + SPELL_SHIELD_OF_RUNES_10 = 62274, + SPELL_SHIELD_OF_RUNES_25 = 63489, + SPELL_RUNE_OF_POWER = 61973, + SPELL_RUNE_OF_DEATH_10 = 62269, + SPELL_RUNE_OF_DEATH_25 = 63490, + SPELL_RUNE_OF_SUMMONING = 62273, + SPELL_RUNE_OF_SUMMONING_VISUAL = 62019, + SPELL_LIGHTNING_BLAST_10 = 62054, + SPELL_LIGHTNING_BLAST_25 = 63491, + CREATURE_LIGHTNING_ELEMENTAL = 32958, + CREATURE_RUNE_OF_SUMMONING = 33051, + SPELL_RUNE_OF_POWER_OOC_CHANNEL = 61975, - // Stormcaller Brundir - SPELL_CHAIN_LIGHTNING_10 = 61879, - SPELL_CHAIN_LIGHTNING_25 = 63479, - SPELL_OVERLOAD_10 = 61869, - SPELL_OVERLOAD_25 = 63481, - SPELL_LIGHTNING_WHIRL_10 = 61915, - SPELL_LIGHTNING_WHIRL_25 = 63483, - SPELL_LIGHTNING_TENDRILS_10 = 61887, - SPELL_LIGHTNING_TENDRILS_25 = 63486, - SPELL_STORMSHIELD = 64187, - SPELL_LIGHTNING_CHANNEL_PRE = 61942, + // Stormcaller Brundir + SPELL_CHAIN_LIGHTNING_10 = 61879, + SPELL_CHAIN_LIGHTNING_25 = 63479, + SPELL_OVERLOAD_10 = 61869, + SPELL_OVERLOAD_25 = 63481, + SPELL_LIGHTNING_WHIRL_10 = 61915, + SPELL_LIGHTNING_WHIRL_25 = 63483, + SPELL_LIGHTNING_TENDRILS_10 = 61887, + SPELL_LIGHTNING_TENDRILS_25 = 63486, + SPELL_STORMSHIELD = 64187, + SPELL_LIGHTNING_CHANNEL_PRE = 61942, }; -#define SPELL_HIGH_VOLTAGE RAID_MODE(SPELL_HIGH_VOLTAGE_10, SPELL_HIGH_VOLTAGE_25) -#define SPELL_FUSION_PUNCH RAID_MODE(SPELL_FUSION_PUNCH_10, SPELL_FUSION_PUNCH_25) -#define SPELL_STATIC_DISRUPTION RAID_MODE(SPELL_STATIC_DISRUPTION_10, SPELL_STATIC_DISRUPTION_25) -#define SPELL_OVERWHELMING_POWER RAID_MODE(SPELL_OVERWHELMING_POWER_10, SPELL_OVERWHELMING_POWER_25) -#define SPELL_SHIELD_OF_RUNES RAID_MODE(SPELL_SHIELD_OF_RUNES_10, SPELL_SHIELD_OF_RUNES_25) -#define SPELL_RUNE_OF_DEATH RAID_MODE(SPELL_RUNE_OF_DEATH_10, SPELL_RUNE_OF_DEATH_25) -#define SPELL_LIGHTNING_BLAST RAID_MODE(SPELL_LIGHTNING_BLAST_10, SPELL_LIGHTNING_BLAST_25) -#define SPELL_CHAIN_LIGHTNING RAID_MODE(SPELL_CHAIN_LIGHTNING_10, SPELL_CHAIN_LIGHTNING_25) -#define SPELL_OVERLOAD RAID_MODE(SPELL_OVERLOAD_10, SPELL_OVERLOAD_25) -#define SPELL_LIGHTNING_WHIRL RAID_MODE(SPELL_LIGHTNING_WHIRL_10, SPELL_LIGHTNING_WHIRL_25) -#define SPELL_LIGHTNING_TENDRILS RAID_MODE(SPELL_LIGHTNING_TENDRILS_10, SPELL_LIGHTNING_TENDRILS_25) +#define SPELL_HIGH_VOLTAGE RAID_MODE(SPELL_HIGH_VOLTAGE_10, SPELL_HIGH_VOLTAGE_25) +#define SPELL_FUSION_PUNCH RAID_MODE(SPELL_FUSION_PUNCH_10, SPELL_FUSION_PUNCH_25) +#define SPELL_STATIC_DISRUPTION RAID_MODE(SPELL_STATIC_DISRUPTION_10, SPELL_STATIC_DISRUPTION_25) +#define SPELL_OVERWHELMING_POWER RAID_MODE(SPELL_OVERWHELMING_POWER_10, SPELL_OVERWHELMING_POWER_25) +#define SPELL_SHIELD_OF_RUNES RAID_MODE(SPELL_SHIELD_OF_RUNES_10, SPELL_SHIELD_OF_RUNES_25) +#define SPELL_RUNE_OF_DEATH RAID_MODE(SPELL_RUNE_OF_DEATH_10, SPELL_RUNE_OF_DEATH_25) +#define SPELL_LIGHTNING_BLAST RAID_MODE(SPELL_LIGHTNING_BLAST_10, SPELL_LIGHTNING_BLAST_25) +#define SPELL_CHAIN_LIGHTNING RAID_MODE(SPELL_CHAIN_LIGHTNING_10, SPELL_CHAIN_LIGHTNING_25) +#define SPELL_OVERLOAD RAID_MODE(SPELL_OVERLOAD_10, SPELL_OVERLOAD_25) +#define SPELL_LIGHTNING_WHIRL RAID_MODE(SPELL_LIGHTNING_WHIRL_10, SPELL_LIGHTNING_WHIRL_25) +#define SPELL_LIGHTNING_TENDRILS RAID_MODE(SPELL_LIGHTNING_TENDRILS_10, SPELL_LIGHTNING_TENDRILS_25) enum eEnums { - // Steelbreaker - EVENT_FUSION_PUNCH = 1, - EVENT_STATIC_DISRUPTION = 2, - EVENT_OVERWHELMING_POWER = 3, - //EVENT_CHECK_MAIN_TANK = 4, + // Steelbreaker + EVENT_FUSION_PUNCH = 1, + EVENT_STATIC_DISRUPTION = 2, + EVENT_OVERWHELMING_POWER = 3, + //EVENT_CHECK_MAIN_TANK = 4, - // Molgeim - EVENT_RUNE_OF_POWER = 11, - EVENT_SHIELD_OF_RUNES = 12, - EVENT_RUNE_OF_DEATH = 13, - EVENT_RUNE_OF_SUMMONING = 14, - EVENT_LIGHTNING_BLAST = 15, + // Molgeim + EVENT_RUNE_OF_POWER = 11, + EVENT_SHIELD_OF_RUNES = 12, + EVENT_RUNE_OF_DEATH = 13, + EVENT_RUNE_OF_SUMMONING = 14, + EVENT_LIGHTNING_BLAST = 15, - // Brundir - EVENT_CHAIN_LIGHTNING = 21, - EVENT_OVERLOAD = 22, - EVENT_LIGHTNING_WHIRL = 23, - EVENT_LIGHTNING_TENDRILS = 24, - EVENT_LIGHTNING_LAND = 25, - EVENT_LAND_LAND = 26, - EVENT_IMMUNE = 27, + // Brundir + EVENT_CHAIN_LIGHTNING = 21, + EVENT_OVERLOAD = 22, + EVENT_LIGHTNING_WHIRL = 23, + EVENT_LIGHTNING_TENDRILS = 24, + EVENT_LIGHTNING_LAND = 25, + EVENT_LAND_LAND = 26, + EVENT_IMMUNE = 27, - EVENT_ENRAGE = 30, + EVENT_ENRAGE = 30, }; enum AOISounds { - // molgeim - SOUND_MOLGEIM_AGGRO = 15657, - SOUND_MOLGEIM_SLAY1 = 15658, - SOUND_MOLGEIM_SLAY2 = 15659, - SOUND_MOLGEIM_POWER = 15660, - SOUND_MOLGEIM_SUMMON = 15661, - SOUND_MOLGEIM_DEATH1 = 15662, - SOUND_MOLGEIM_DEATH2 = 15663, - SOUND_MOLGEIM_BERSERK = 15664, + // molgeim + SOUND_MOLGEIM_AGGRO = 15657, + SOUND_MOLGEIM_SLAY1 = 15658, + SOUND_MOLGEIM_SLAY2 = 15659, + SOUND_MOLGEIM_POWER = 15660, + SOUND_MOLGEIM_SUMMON = 15661, + SOUND_MOLGEIM_DEATH1 = 15662, + SOUND_MOLGEIM_DEATH2 = 15663, + SOUND_MOLGEIM_BERSERK = 15664, - // steelbreaker - SOUND_SB_AGGRO = 15674, - SOUND_SB_SLAY1 = 15675, - SOUND_SB_SLAY2 = 15676, - SOUND_SB_POWER = 15677, - SOUND_SB_DEATH1 = 15678, - SOUND_SB_DEATH2 = 15679, - SOUND_SB_BERSERK = 15680, + // steelbreaker + SOUND_SB_AGGRO = 15674, + SOUND_SB_SLAY1 = 15675, + SOUND_SB_SLAY2 = 15676, + SOUND_SB_POWER = 15677, + SOUND_SB_DEATH1 = 15678, + SOUND_SB_DEATH2 = 15679, + SOUND_SB_BERSERK = 15680, - // brundir - SOUND_BRUNDIR_AGGRO = 15684, - SOUND_BRUNDIR_SLAY1 = 15685, - SOUND_BRUNDIR_SLAY2 = 15686, - SOUND_BRUNDIR_POWER = 15687, - SOUND_BRUNDIR_FLIGHT = 15688, - SOUND_BRUNDIR_DEATH1 = 15689, - SOUND_BRUNDIR_DEATH2 = 15690, - SOUND_BRUNDIR_BERSERK = 15691, + // brundir + SOUND_BRUNDIR_AGGRO = 15684, + SOUND_BRUNDIR_SLAY1 = 15685, + SOUND_BRUNDIR_SLAY2 = 15686, + SOUND_BRUNDIR_POWER = 15687, + SOUND_BRUNDIR_FLIGHT = 15688, + SOUND_BRUNDIR_DEATH1 = 15689, + SOUND_BRUNDIR_DEATH2 = 15690, + SOUND_BRUNDIR_BERSERK = 15691, }; enum Misc { - ACTION_ADD_CHARGE = 1, - POINT_CHANNEL_STEELBREAKER = 1 + ACTION_ADD_CHARGE = 1, + POINT_CHANNEL_STEELBREAKER = 1 }; bool IsEncounterComplete(InstanceScript* pInstance, Creature* me) { if (!pInstance || !me) - return false; + return false; - for (uint8 i = 0; i < 3; ++i) - { - uint64 guid = pInstance->GetData64(DATA_STEELBREAKER+i); - if (!guid) - return false; + for (uint8 i = 0; i < 3; ++i) + { + uint64 guid = pInstance->GetData64(DATA_STEELBREAKER+i); + if (!guid) + return false; - if (Creature *boss = (ObjectAccessor::GetCreature(*me, guid))) - { - if (boss->IsAlive()) - return false; - continue; - } - else - return false; - } - return true; + if (Creature *boss = (ObjectAccessor::GetCreature(*me, guid))) + { + if (boss->IsAlive()) + return false; + continue; + } + else + return false; + } + return true; } void RespawnAssemblyOfIron(InstanceScript* pInstance, Creature* me) { if (!pInstance || !me) - return; + return; - for (uint8 i = 0; i < 3; ++i) - { - uint64 guid = pInstance->GetData64(DATA_STEELBREAKER+i); - if (!guid) - return; + for (uint8 i = 0; i < 3; ++i) + { + uint64 guid = pInstance->GetData64(DATA_STEELBREAKER+i); + if (!guid) + return; - if (Creature *boss = (ObjectAccessor::GetCreature((*me), guid))) - if (!boss->IsAlive()) - boss->Respawn(); - } - return; + if (Creature *boss = (ObjectAccessor::GetCreature((*me), guid))) + if (!boss->IsAlive()) + boss->Respawn(); + } + return; } void RestoreAssemblyHealth(uint64 guid1, uint64 guid2, Creature *me) { - if(Creature* cr = ObjectAccessor::GetCreature(*me, guid1)) - if(cr->IsAlive()) - cr->SetHealth(cr->GetMaxHealth()); + if(Creature* cr = ObjectAccessor::GetCreature(*me, guid1)) + if(cr->IsAlive()) + cr->SetHealth(cr->GetMaxHealth()); - if(Creature* cr2 = ObjectAccessor::GetCreature(*me, guid2)) - if(cr2->IsAlive()) - cr2->SetHealth(cr2->GetMaxHealth()); + if(Creature* cr2 = ObjectAccessor::GetCreature(*me, guid2)) + if(cr2->IsAlive()) + cr2->SetHealth(cr2->GetMaxHealth()); } @@ -195,209 +195,209 @@ public: return new boss_steelbreakerAI (pCreature); } - struct boss_steelbreakerAI : public ScriptedAI - { - boss_steelbreakerAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } + struct boss_steelbreakerAI : public ScriptedAI + { + boss_steelbreakerAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - EventMap events; - InstanceScript* pInstance; - uint8 _phase; + EventMap events; + InstanceScript* pInstance; + uint8 _phase; - void Reset() - { - me->SetLootMode(0); - RespawnAssemblyOfIron(pInstance, me); + void Reset() + { + me->SetLootMode(0); + RespawnAssemblyOfIron(pInstance, me); - _phase = 0; - events.Reset(); - if (pInstance) - pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); - } + _phase = 0; + events.Reset(); + if (pInstance) + pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); + } - void JustReachedHome() - { - me->setActive(false); - me->RemoveAllAuras(); - } + void JustReachedHome() + { + me->setActive(false); + me->RemoveAllAuras(); + } - void EnterCombat(Unit* who) - { - if (pInstance) - pInstance->SetData(TYPE_ASSEMBLY, IN_PROGRESS); - - me->setActive(true); - me->SetInCombatWithZone(); - me->CastSpell(me, SPELL_HIGH_VOLTAGE, true); - events.ScheduleEvent(EVENT_ENRAGE, 900000); - UpdatePhase(); + void EnterCombat(Unit* who) + { + if (pInstance) + pInstance->SetData(TYPE_ASSEMBLY, IN_PROGRESS); + + me->setActive(true); + me->SetInCombatWithZone(); + me->CastSpell(me, SPELL_HIGH_VOLTAGE, true); + events.ScheduleEvent(EVENT_ENRAGE, 900000); + UpdatePhase(); - if (!pInstance) - return; + if (!pInstance) + return; - if (Creature *boss = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+urand(0,2)))) - { - switch (boss->GetEntry()) - { - case NPC_STEELBREAKER: - boss->MonsterYell("You will not defeat the Assembly of Iron so easily, invaders!", LANG_UNIVERSAL, 0); - boss->PlayDirectSound(SOUND_SB_AGGRO); - break; - case NPC_MOLGEIM: - boss->MonsterYell("Nothing short of total decimation will suffice.", LANG_UNIVERSAL, 0); - boss->PlayDirectSound(SOUND_MOLGEIM_AGGRO); - break; - case NPC_BRUNDIR: - boss->MonsterYell("Whether the world's greatest gnats or the world's greatest heroes, you're still only mortal!", LANG_UNIVERSAL, 0); - boss->PlayDirectSound(SOUND_BRUNDIR_AGGRO); - break; - } - } + if (Creature *boss = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+urand(0,2)))) + { + switch (boss->GetEntry()) + { + case NPC_STEELBREAKER: + boss->MonsterYell("You will not defeat the Assembly of Iron so easily, invaders!", LANG_UNIVERSAL, 0); + boss->PlayDirectSound(SOUND_SB_AGGRO); + break; + case NPC_MOLGEIM: + boss->MonsterYell("Nothing short of total decimation will suffice.", LANG_UNIVERSAL, 0); + boss->PlayDirectSound(SOUND_MOLGEIM_AGGRO); + break; + case NPC_BRUNDIR: + boss->MonsterYell("Whether the world's greatest gnats or the world's greatest heroes, you're still only mortal!", LANG_UNIVERSAL, 0); + boss->PlayDirectSound(SOUND_BRUNDIR_AGGRO); + break; + } + } - for (uint8 i = 0; i < 3; ++i) - if (Creature *boss = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+i))) - if (!boss->IsInCombat()) - boss->AI()->AttackStart(who); - } + for (uint8 i = 0; i < 3; ++i) + if (Creature *boss = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+i))) + if (!boss->IsInCombat()) + boss->AI()->AttackStart(who); + } - void UpdatePhase() - { - if (_phase >= 3) - return; + void UpdatePhase() + { + if (_phase >= 3) + return; - ++_phase; + ++_phase; - switch (_phase) - { - case 1: - events.RescheduleEvent(EVENT_FUSION_PUNCH, 15000); - break; - case 2: - events.RescheduleEvent(EVENT_STATIC_DISRUPTION, 20000); - break; - case 3: - me->ResetLootMode(); - events.RescheduleEvent(EVENT_OVERWHELMING_POWER, 8000); - break; - } - } + switch (_phase) + { + case 1: + events.RescheduleEvent(EVENT_FUSION_PUNCH, 15000); + break; + case 2: + events.RescheduleEvent(EVENT_STATIC_DISRUPTION, 20000); + break; + case 3: + me->ResetLootMode(); + events.RescheduleEvent(EVENT_OVERWHELMING_POWER, 8000); + break; + } + } - void JustDied(Unit* Killer) - { - if (!pInstance) - return; + void JustDied(Unit* Killer) + { + if (!pInstance) + return; - if (IsEncounterComplete(pInstance, me)) - { - pInstance->SetData(TYPE_ASSEMBLY, DONE); - me->CastSpell(me, 65195, true); // credit - } - else - { - RestoreAssemblyHealth(pInstance->GetData64(DATA_BRUNDIR), pInstance->GetData64(DATA_MOLGEIM), me); - me->CastSpell(me, SPELL_SUPERCHARGE, true); - } - - if (urand(0,1)) - { - me->MonsterYell("My death only serves to hasten your demise.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SB_DEATH1); - } - else - { - me->MonsterYell("Impossible!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SB_DEATH2); - } - } + if (IsEncounterComplete(pInstance, me)) + { + pInstance->SetData(TYPE_ASSEMBLY, DONE); + me->CastSpell(me, 65195, true); // credit + } + else + { + RestoreAssemblyHealth(pInstance->GetData64(DATA_BRUNDIR), pInstance->GetData64(DATA_MOLGEIM), me); + me->CastSpell(me, SPELL_SUPERCHARGE, true); + } + + if (urand(0,1)) + { + me->MonsterYell("My death only serves to hasten your demise.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SB_DEATH1); + } + else + { + me->MonsterYell("Impossible!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SB_DEATH2); + } + } - void KilledUnit(Unit* who) - { - if (_phase == 3) - me->CastSpell(me, SPELL_ELECTRICAL_CHARGE, true); + void KilledUnit(Unit* who) + { + if (_phase == 3) + me->CastSpell(me, SPELL_ELECTRICAL_CHARGE, true); - if (who->GetTypeId() != TYPEID_PLAYER || urand(0,2)) - return; + if (who->GetTypeId() != TYPEID_PLAYER || urand(0,2)) + return; - if (urand(0,1)) - { - me->MonsterYell("So fragile and weak!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SB_SLAY1); - } - else - { - me->MonsterYell("Flesh... such a hindrance.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SB_SLAY2); - } - } + if (urand(0,1)) + { + me->MonsterYell("So fragile and weak!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SB_SLAY1); + } + else + { + me->MonsterYell("Flesh... such a hindrance.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SB_SLAY2); + } + } - void DoAction(int32 param) - { - if (param == ACTION_ADD_CHARGE) - me->CastSpell(me, SPELL_ELECTRICAL_CHARGE, true); - } + void DoAction(int32 param) + { + if (param == ACTION_ADD_CHARGE) + me->CastSpell(me, SPELL_ELECTRICAL_CHARGE, true); + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_SUPERCHARGE) - UpdatePhase(); - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_SUPERCHARGE) + UpdatePhase(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case EVENT_FUSION_PUNCH: - me->CastSpell(me->GetVictim(), SPELL_FUSION_PUNCH, false); - events.RepeatEvent(15000 + rand()%5000); - break; - case EVENT_STATIC_DISRUPTION: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_FARTHEST, 0, 0, true)) - me->CastSpell(pTarget, SPELL_STATIC_DISRUPTION, false); + switch(events.GetEvent()) + { + case EVENT_FUSION_PUNCH: + me->CastSpell(me->GetVictim(), SPELL_FUSION_PUNCH, false); + events.RepeatEvent(15000 + rand()%5000); + break; + case EVENT_STATIC_DISRUPTION: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_FARTHEST, 0, 0, true)) + me->CastSpell(pTarget, SPELL_STATIC_DISRUPTION, false); - events.RepeatEvent(20000 + rand()%20000); - break; - case EVENT_OVERWHELMING_POWER: - me->MonsterYell("You seek the secrets of Ulduar? Then take them!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SB_POWER); - me->CastSpell(me->GetVictim(), SPELL_OVERWHELMING_POWER, true); - events.RepeatEvent(RAID_MODE(61000, 36000)); - break; - case EVENT_ENRAGE: - me->MonsterYell("This meeting of the Assembly of Iron is adjourned!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SB_BERSERK); - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - break; - } + events.RepeatEvent(20000 + rand()%20000); + break; + case EVENT_OVERWHELMING_POWER: + me->MonsterYell("You seek the secrets of Ulduar? Then take them!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SB_POWER); + me->CastSpell(me->GetVictim(), SPELL_OVERWHELMING_POWER, true); + events.RepeatEvent(RAID_MODE(61000, 36000)); + break; + case EVENT_ENRAGE: + me->MonsterYell("This meeting of the Assembly of Iron is adjourned!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SB_BERSERK); + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class CastRunesEvent : public BasicEvent { - public: - CastRunesEvent(Creature& owner) : BasicEvent(), _owner(owner) { } + public: + CastRunesEvent(Creature& owner) : BasicEvent(), _owner(owner) { } - bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) - { - if (!_owner.IsInCombat()) - _owner.CastSpell(&_owner, SPELL_RUNE_OF_POWER_OOC_CHANNEL, true); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) + { + if (!_owner.IsInCombat()) + _owner.CastSpell(&_owner, SPELL_RUNE_OF_POWER_OOC_CHANNEL, true); + return true; + } - private: - Creature& _owner; + private: + Creature& _owner; }; class boss_runemaster_molgeim : public CreatureScript @@ -410,182 +410,182 @@ public: return new boss_runemaster_molgeimAI (pCreature); } - struct boss_runemaster_molgeimAI : public ScriptedAI - { - boss_runemaster_molgeimAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = c->GetInstanceScript(); - } + struct boss_runemaster_molgeimAI : public ScriptedAI + { + boss_runemaster_molgeimAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - SummonList summons; - EventMap events; - uint8 _phase; + InstanceScript* pInstance; + SummonList summons; + EventMap events; + uint8 _phase; - void Reset() - { - me->SetLootMode(0); - RespawnAssemblyOfIron(pInstance, me); + void Reset() + { + me->SetLootMode(0); + RespawnAssemblyOfIron(pInstance, me); - _phase = 0; - events.Reset(); - summons.DespawnAll(); - - if (pInstance) - pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); + _phase = 0; + events.Reset(); + summons.DespawnAll(); + + if (pInstance) + pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); - me->m_Events.AddEvent(new CastRunesEvent(*me), me->m_Events.CalculateTime(8000)); - } + me->m_Events.AddEvent(new CastRunesEvent(*me), me->m_Events.CalculateTime(8000)); + } - void JustReachedHome() - { - me->setActive(false); - me->RemoveAllAuras(); - } + void JustReachedHome() + { + me->setActive(false); + me->RemoveAllAuras(); + } - void EnterCombat(Unit* who) - { - me->InterruptNonMeleeSpells(false); - me->setActive(true); - me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_ENRAGE, 900000); - UpdatePhase(); + void EnterCombat(Unit* who) + { + me->InterruptNonMeleeSpells(false); + me->setActive(true); + me->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_ENRAGE, 900000); + UpdatePhase(); - if (!pInstance) - return; + if (!pInstance) + return; - for (uint8 i = 0; i < 3; ++i) - if (Creature* boss = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+i))) - if (!boss->IsInCombat()) - boss->AI()->AttackStart(who); - } + for (uint8 i = 0; i < 3; ++i) + if (Creature* boss = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+i))) + if (!boss->IsInCombat()) + boss->AI()->AttackStart(who); + } - void UpdatePhase() - { - if (_phase >= 3) - return; + void UpdatePhase() + { + if (_phase >= 3) + return; - ++_phase; + ++_phase; - switch (_phase) - { - case 1: - events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 20000); - events.RescheduleEvent(EVENT_RUNE_OF_POWER, 30000); - break; - case 2: - events.RescheduleEvent(EVENT_RUNE_OF_DEATH, 35000); - break; - case 3: - me->ResetLootMode(); - events.RescheduleEvent(EVENT_RUNE_OF_SUMMONING, 20000+rand()%10000); - break; - } - } + switch (_phase) + { + case 1: + events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 20000); + events.RescheduleEvent(EVENT_RUNE_OF_POWER, 30000); + break; + case 2: + events.RescheduleEvent(EVENT_RUNE_OF_DEATH, 35000); + break; + case 3: + me->ResetLootMode(); + events.RescheduleEvent(EVENT_RUNE_OF_SUMMONING, 20000+rand()%10000); + break; + } + } - void JustDied(Unit* killer) - { - if (!pInstance) - return; + void JustDied(Unit* killer) + { + if (!pInstance) + return; - if (IsEncounterComplete(pInstance, me)) - { - pInstance->SetData(TYPE_ASSEMBLY, DONE); - me->CastSpell(me, 65195, true); // credit - } - else - { - RestoreAssemblyHealth(pInstance->GetData64(DATA_STEELBREAKER), pInstance->GetData64(DATA_BRUNDIR), me); - me->CastSpell(me, SPELL_SUPERCHARGE, true); - } + if (IsEncounterComplete(pInstance, me)) + { + pInstance->SetData(TYPE_ASSEMBLY, DONE); + me->CastSpell(me, 65195, true); // credit + } + else + { + RestoreAssemblyHealth(pInstance->GetData64(DATA_STEELBREAKER), pInstance->GetData64(DATA_BRUNDIR), me); + me->CastSpell(me, SPELL_SUPERCHARGE, true); + } - if (urand(0,1)) - { - me->MonsterYell("The legacy of storms shall not be undone.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_MOLGEIM_DEATH1); - } - else - { - me->MonsterYell("What have you gained from my defeat? You are no less doomed, mortals!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_MOLGEIM_DEATH2); - } - } + if (urand(0,1)) + { + me->MonsterYell("The legacy of storms shall not be undone.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_MOLGEIM_DEATH1); + } + else + { + me->MonsterYell("What have you gained from my defeat? You are no less doomed, mortals!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_MOLGEIM_DEATH2); + } + } - void KilledUnit(Unit *who) - { - if (who->GetTypeId() != TYPEID_PLAYER || urand(0,2)) - return; + void KilledUnit(Unit *who) + { + if (who->GetTypeId() != TYPEID_PLAYER || urand(0,2)) + return; - if (urand(0,1)) - { - me->MonsterYell("The world suffers yet another insignificant loss.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_MOLGEIM_SLAY1); - } - else - { - me->MonsterYell("Death is the price of your arrogance.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_MOLGEIM_SLAY2); - } - } + if (urand(0,1)) + { + me->MonsterYell("The world suffers yet another insignificant loss.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_MOLGEIM_SLAY1); + } + else + { + me->MonsterYell("Death is the price of your arrogance.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_MOLGEIM_SLAY2); + } + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_SUPERCHARGE) - UpdatePhase(); - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_SUPERCHARGE) + UpdatePhase(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case EVENT_RUNE_OF_POWER: - { - Unit* target = DoSelectLowestHpFriendly(60); - if (!target || !target->IsAlive()) - target = me; + switch(events.GetEvent()) + { + case EVENT_RUNE_OF_POWER: + { + Unit* target = DoSelectLowestHpFriendly(60); + if (!target || !target->IsAlive()) + target = me; - me->CastSpell(target, SPELL_RUNE_OF_POWER, true); - events.RepeatEvent(60000); - break; - } - case EVENT_SHIELD_OF_RUNES: - me->CastSpell(me, SPELL_SHIELD_OF_RUNES, false); - events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 27000+ rand()%7000); - break; - case EVENT_RUNE_OF_DEATH: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(target, SPELL_RUNE_OF_DEATH, true); + me->CastSpell(target, SPELL_RUNE_OF_POWER, true); + events.RepeatEvent(60000); + break; + } + case EVENT_SHIELD_OF_RUNES: + me->CastSpell(me, SPELL_SHIELD_OF_RUNES, false); + events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 27000+ rand()%7000); + break; + case EVENT_RUNE_OF_DEATH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(target, SPELL_RUNE_OF_DEATH, true); - me->MonsterYell("Decipher this!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_MOLGEIM_POWER); - events.RepeatEvent(30000+ rand()%10000); - break; - case EVENT_RUNE_OF_SUMMONING: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->SummonCreature(CREATURE_RUNE_OF_SUMMONING, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 11000); + me->MonsterYell("Decipher this!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_MOLGEIM_POWER); + events.RepeatEvent(30000+ rand()%10000); + break; + case EVENT_RUNE_OF_SUMMONING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->SummonCreature(CREATURE_RUNE_OF_SUMMONING, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 11000); - me->MonsterYell("Face the lightning surge!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_MOLGEIM_SUMMON); - events.RepeatEvent(20000+rand()%10000); - break; - case EVENT_ENRAGE: - me->CastSpell(me, SPELL_BERSERK, true); - me->MonsterYell("This meeting of the Assembly of Iron is adjourned!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_MOLGEIM_BERSERK); - events.PopEvent(); - break; - } + me->MonsterYell("Face the lightning surge!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_MOLGEIM_SUMMON); + events.RepeatEvent(20000+rand()%10000); + break; + case EVENT_ENRAGE: + me->CastSpell(me, SPELL_BERSERK, true); + me->MonsterYell("This meeting of the Assembly of Iron is adjourned!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_MOLGEIM_BERSERK); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_assembly_lightning : public CreatureScript @@ -598,39 +598,39 @@ public: return new npc_assembly_lightningAI (pCreature); } - struct npc_assembly_lightningAI : public ScriptedAI - { - npc_assembly_lightningAI(Creature *c) : ScriptedAI(c) - { - _boomed = false; - } + struct npc_assembly_lightningAI : public ScriptedAI + { + npc_assembly_lightningAI(Creature *c) : ScriptedAI(c) + { + _boomed = false; + } - void MoveInLineOfSight(Unit*) {} + void MoveInLineOfSight(Unit*) {} void AttackStart(Unit*) {} void UpdateAI(uint32) {} void EnterEvadeMode() {} void OnCharmed(bool /*apply*/) {} - bool _boomed; + bool _boomed; - void Reset() - { - if (Player* target = SelectTargetFromPlayerList(150)) - me->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f); - else - me->DespawnOrUnsummon(1); - } + void Reset() + { + if (Player* target = SelectTargetFromPlayerList(150)) + me->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f); + else + me->DespawnOrUnsummon(1); + } - void MovementInform(uint32 type, uint32 id) - { - if (type == FOLLOW_MOTION_TYPE && !_boomed) - { - _boomed = true; - me->CastSpell(me, SPELL_LIGHTNING_BLAST, true); - me->DespawnOrUnsummon(1000); - } - } - }; + void MovementInform(uint32 type, uint32 id) + { + if (type == FOLLOW_MOTION_TYPE && !_boomed) + { + _boomed = true; + me->CastSpell(me, SPELL_LIGHTNING_BLAST, true); + me->DespawnOrUnsummon(1000); + } + } + }; }; class boss_stormcaller_brundir : public CreatureScript @@ -643,279 +643,279 @@ public: return new boss_stormcaller_brundirAI (pCreature); } - struct boss_stormcaller_brundirAI : public ScriptedAI - { - boss_stormcaller_brundirAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } + struct boss_stormcaller_brundirAI : public ScriptedAI + { + boss_stormcaller_brundirAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - EventMap events; - InstanceScript* pInstance; - uint32 _phase; - bool _flyPhase; - Unit* _flyTarget; - uint32 _channelTimer; + EventMap events; + InstanceScript* pInstance; + uint32 _phase; + bool _flyPhase; + Unit* _flyTarget; + uint32 _channelTimer; - bool _stunnedAchievement; + bool _stunnedAchievement; - void Reset() - { - me->SetLootMode(0); - RespawnAssemblyOfIron(pInstance, me); + void Reset() + { + me->SetLootMode(0); + RespawnAssemblyOfIron(pInstance, me); - _channelTimer = 0; - _phase = 0; - _flyPhase = false; - _flyTarget = NULL; - _stunnedAchievement = true; + _channelTimer = 0; + _phase = 0; + _flyPhase = false; + _flyTarget = NULL; + _stunnedAchievement = true; - events.Reset(); - - me->SetDisableGravity(false); - me->SetRegeneratingHealth(true); - me->SetReactState(REACT_AGGRESSIVE); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); + events.Reset(); + + me->SetDisableGravity(false); + me->SetRegeneratingHealth(true); + me->SetReactState(REACT_AGGRESSIVE); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); - if (pInstance) - pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); - } + if (pInstance) + pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); + } - void JustReachedHome() - { - me->setActive(false); - me->RemoveAllAuras(); - } + void JustReachedHome() + { + me->setActive(false); + me->RemoveAllAuras(); + } - void EnterCombat(Unit* who) - { - me->InterruptNonMeleeSpells(false); - me->setActive(true); - me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_ENRAGE, 900000); - UpdatePhase(); + void EnterCombat(Unit* who) + { + me->InterruptNonMeleeSpells(false); + me->setActive(true); + me->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_ENRAGE, 900000); + UpdatePhase(); - if (!pInstance) - return; + if (!pInstance) + return; - for (uint8 i = 0; i < 3; ++i) - if (Creature *boss = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+i))) - if (!boss->IsInCombat()) - boss->AI()->AttackStart(who); - } + for (uint8 i = 0; i < 3; ++i) + if (Creature *boss = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_STEELBREAKER+i))) + if (!boss->IsInCombat()) + boss->AI()->AttackStart(who); + } - void UpdatePhase() - { - if (_phase >= 3) - return; + void UpdatePhase() + { + if (_phase >= 3) + return; - ++_phase; + ++_phase; - switch (_phase) - { - case 1: - events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, 9000+ rand()%8000); - events.RescheduleEvent(EVENT_OVERLOAD, 25000+ rand()%15000); - break; - case 2: - events.RescheduleEvent(EVENT_LIGHTNING_WHIRL, 20000+ rand()%20000); - break; - case 3: - me->ResetLootMode(); - me->CastSpell(me, SPELL_STORMSHIELD, true); - events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, 15000+ rand()%1000); - break; - } - } + switch (_phase) + { + case 1: + events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, 9000+ rand()%8000); + events.RescheduleEvent(EVENT_OVERLOAD, 25000+ rand()%15000); + break; + case 2: + events.RescheduleEvent(EVENT_LIGHTNING_WHIRL, 20000+ rand()%20000); + break; + case 3: + me->ResetLootMode(); + me->CastSpell(me, SPELL_STORMSHIELD, true); + events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, 15000+ rand()%1000); + break; + } + } - void JustDied(Unit* Killer) - { - if (!pInstance) - return; + void JustDied(Unit* Killer) + { + if (!pInstance) + return; - if (IsEncounterComplete(pInstance, me)) - { - pInstance->SetData(TYPE_ASSEMBLY, DONE); - me->CastSpell(me, 65195, true); // credit - } - else - { - RestoreAssemblyHealth(pInstance->GetData64(DATA_STEELBREAKER), pInstance->GetData64(DATA_MOLGEIM), me); - me->CastSpell(me, SPELL_SUPERCHARGE, true); - } + if (IsEncounterComplete(pInstance, me)) + { + pInstance->SetData(TYPE_ASSEMBLY, DONE); + me->CastSpell(me, 65195, true); // credit + } + else + { + RestoreAssemblyHealth(pInstance->GetData64(DATA_STEELBREAKER), pInstance->GetData64(DATA_MOLGEIM), me); + me->CastSpell(me, SPELL_SUPERCHARGE, true); + } - if (urand(0,1)) - { - me->MonsterYell("The power of the storm lives on...", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRUNDIR_DEATH1); - } - else - { - me->MonsterYell("You rush headlong into the maw of madness!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRUNDIR_DEATH2); - } - } + if (urand(0,1)) + { + me->MonsterYell("The power of the storm lives on...", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRUNDIR_DEATH1); + } + else + { + me->MonsterYell("You rush headlong into the maw of madness!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRUNDIR_DEATH2); + } + } - void KilledUnit(Unit *who) - { - if (who->GetTypeId() != TYPEID_PLAYER || urand(0,2)) - return; + void KilledUnit(Unit *who) + { + if (who->GetTypeId() != TYPEID_PLAYER || urand(0,2)) + return; - if (urand(0,1)) - { - me->MonsterYell("A merciful kill!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRUNDIR_SLAY1); - } - else - { - me->MonsterYell("HAH!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRUNDIR_SLAY2); - } - } + if (urand(0,1)) + { + me->MonsterYell("A merciful kill!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRUNDIR_SLAY1); + } + else + { + me->MonsterYell("HAH!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRUNDIR_SLAY2); + } + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_SUPERCHARGE) - UpdatePhase(); - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_SUPERCHARGE) + UpdatePhase(); + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_CHAIN_LIGHTNING || spellInfo->Id == RAID_MODE(61916, 63482)) // Lightning Whirl triggered - _stunnedAchievement = false; - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_CHAIN_LIGHTNING || spellInfo->Id == RAID_MODE(61916, 63482)) // Lightning Whirl triggered + _stunnedAchievement = false; + } - uint32 GetData(uint32 param) const - { - if (param == DATA_BRUNDIR) - return _stunnedAchievement; + uint32 GetData(uint32 param) const + { + if (param == DATA_BRUNDIR) + return _stunnedAchievement; - return 0; - } + return 0; + } - void MovementInform(uint32 type, uint32 point) - { - if (type == POINT_MOTION_TYPE && point == POINT_CHANNEL_STEELBREAKER) - me->CastSpell(me, SPELL_LIGHTNING_CHANNEL_PRE, true); - } + void MovementInform(uint32 type, uint32 point) + { + if (type == POINT_MOTION_TYPE && point == POINT_CHANNEL_STEELBREAKER) + me->CastSpell(me, SPELL_LIGHTNING_CHANNEL_PRE, true); + } - void UpdateAI(uint32 diff) - { - if (!me->IsInCombat() && me->GetReactState() == REACT_AGGRESSIVE) - { - _channelTimer += diff; - if (_channelTimer >= 10000) - { - _channelTimer = 0; - float o = urand(0, 5) * M_PI / 3.0f; - me->InterruptNonMeleeSpells(false); - me->GetMotionMaster()->MovePoint(POINT_CHANNEL_STEELBREAKER, 1587.18f + 10.0f*cos(o), 121.02f + 10.0f*sin(o), 427.3f); - } - } + void UpdateAI(uint32 diff) + { + if (!me->IsInCombat() && me->GetReactState() == REACT_AGGRESSIVE) + { + _channelTimer += diff; + if (_channelTimer >= 10000) + { + _channelTimer = 0; + float o = urand(0, 5) * M_PI / 3.0f; + me->InterruptNonMeleeSpells(false); + me->GetMotionMaster()->MovePoint(POINT_CHANNEL_STEELBREAKER, 1587.18f + 10.0f*cos(o), 121.02f + 10.0f*sin(o), 427.3f); + } + } - if (!UpdateVictim()) - return; - - if (_flyPhase) - { - if (_flyTarget && me->GetDistance2d(_flyTarget) >= 6 ) - { - //float speed = me->GetDistance(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ()+15) / (1500.0f * 0.001f); - me->SendMonsterMove(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ()+15, 1500, SPLINEFLAG_FLYING); - me->SetPosition(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ(), _flyTarget->GetOrientation()); - } - } + if (!UpdateVictim()) + return; + + if (_flyPhase) + { + if (_flyTarget && me->GetDistance2d(_flyTarget) >= 6 ) + { + //float speed = me->GetDistance(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ()+15) / (1500.0f * 0.001f); + me->SendMonsterMove(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ()+15, 1500, SPLINEFLAG_FLYING); + me->SetPosition(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ(), _flyTarget->GetOrientation()); + } + } - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_CHAIN_LIGHTNING: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false); + switch (events.GetEvent()) + { + case EVENT_CHAIN_LIGHTNING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false); - events.RepeatEvent(9000+ rand()%8000); - break; - case EVENT_IMMUNE: - me->ApplySpellImmune(1, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); - events.PopEvent(); - break; - case EVENT_OVERLOAD: - me->ApplySpellImmune(1, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); - me->CastSpell(me, SPELL_OVERLOAD, true); - events.RescheduleEvent(EVENT_OVERLOAD, 25000+ rand()%15000); - events.RescheduleEvent(EVENT_IMMUNE, 5999); - break; - case EVENT_LIGHTNING_WHIRL: - me->MonsterYell("Stand still and stare into the light!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRUNDIR_POWER); - me->CastSpell(me, SPELL_LIGHTNING_WHIRL, true); - events.RepeatEvent(10000+ rand()%15000); - break; - case EVENT_LIGHTNING_TENDRILS: - { - // Reschedule old - events.RepeatEvent(35000); - events.DelayEvents(18000); - me->MonsterYell("Let the storm clouds rise and rain down death from above!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRUNDIR_FLIGHT); - - _flyPhase = true; - _flyTarget = me->GetVictim(); - me->SetRegeneratingHealth(false); - me->SetDisableGravity(true); + events.RepeatEvent(9000+ rand()%8000); + break; + case EVENT_IMMUNE: + me->ApplySpellImmune(1, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); + events.PopEvent(); + break; + case EVENT_OVERLOAD: + me->ApplySpellImmune(1, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); + me->CastSpell(me, SPELL_OVERLOAD, true); + events.RescheduleEvent(EVENT_OVERLOAD, 25000+ rand()%15000); + events.RescheduleEvent(EVENT_IMMUNE, 5999); + break; + case EVENT_LIGHTNING_WHIRL: + me->MonsterYell("Stand still and stare into the light!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRUNDIR_POWER); + me->CastSpell(me, SPELL_LIGHTNING_WHIRL, true); + events.RepeatEvent(10000+ rand()%15000); + break; + case EVENT_LIGHTNING_TENDRILS: + { + // Reschedule old + events.RepeatEvent(35000); + events.DelayEvents(18000); + me->MonsterYell("Let the storm clouds rise and rain down death from above!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRUNDIR_FLIGHT); + + _flyPhase = true; + _flyTarget = me->GetVictim(); + me->SetRegeneratingHealth(false); + me->SetDisableGravity(true); - me->CombatStop(); - me->StopMoving(); - me->SetReactState(REACT_PASSIVE); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - me->SendMonsterMove(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ()+15, 1500, SPLINEFLAG_FLYING); - - me->CastSpell(me, SPELL_LIGHTNING_TENDRILS, true); - me->CastSpell(me, 61883, true); - events.ScheduleEvent(EVENT_LIGHTNING_LAND, 16000); - - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); - break; - } - case EVENT_LIGHTNING_LAND: - { - float speed = me->GetDistance(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()) / (1000.0f * 0.001f); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), speed); - _flyPhase = false; - events.ScheduleEvent(EVENT_LAND_LAND, 1000); - events.PopEvent(); - break; - } - case EVENT_LAND_LAND: - me->SetCanFly(false); - me->SetReactState(REACT_AGGRESSIVE); - me->SetDisableGravity(false); - if (_flyTarget) - me->Attack(_flyTarget, false); + me->CombatStop(); + me->StopMoving(); + me->SetReactState(REACT_PASSIVE); + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + me->SendMonsterMove(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ()+15, 1500, SPLINEFLAG_FLYING); + + me->CastSpell(me, SPELL_LIGHTNING_TENDRILS, true); + me->CastSpell(me, 61883, true); + events.ScheduleEvent(EVENT_LIGHTNING_LAND, 16000); + + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); + break; + } + case EVENT_LIGHTNING_LAND: + { + float speed = me->GetDistance(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()) / (1000.0f * 0.001f); + me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), speed); + _flyPhase = false; + events.ScheduleEvent(EVENT_LAND_LAND, 1000); + events.PopEvent(); + break; + } + case EVENT_LAND_LAND: + me->SetCanFly(false); + me->SetReactState(REACT_AGGRESSIVE); + me->SetDisableGravity(false); + if (_flyTarget) + me->Attack(_flyTarget, false); - me->SetRegeneratingHealth(true); - _flyTarget = NULL; - me->RemoveAura(SPELL_LIGHTNING_TENDRILS); - me->RemoveAura(61883); - DoResetThreat(); - events.PopEvent(); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); - break; - case EVENT_ENRAGE: - me->MonsterYell("This meeting of the Assembly of Iron is adjourned!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRUNDIR_BERSERK); - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - break; - } + me->SetRegeneratingHealth(true); + _flyTarget = NULL; + me->RemoveAura(SPELL_LIGHTNING_TENDRILS); + me->RemoveAura(61883); + DoResetThreat(); + events.PopEvent(); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); + break; + case EVENT_ENRAGE: + me->MonsterYell("This meeting of the Assembly of Iron is adjourned!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRUNDIR_BERSERK); + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; @@ -986,14 +986,14 @@ class spell_assembly_rune_of_summoning : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - if (Unit* caster = GetCaster()) - if (aurEff->GetTickNumber() % 2 == 0) - caster->SummonCreature(CREATURE_LIGHTNING_ELEMENTAL, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); + if (Unit* caster = GetCaster()) + if (aurEff->GetTickNumber() % 2 == 0) + caster->SummonCreature(CREATURE_LIGHTNING_ELEMENTAL, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_assembly_rune_of_summoning_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_assembly_rune_of_summoning_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -1013,9 +1013,9 @@ class achievement_assembly_of_iron : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - return target && target->GetAuraCount(SPELL_SUPERCHARGE) >= 2 && (!_targetEntry || target->GetEntry() == _targetEntry); + return target && target->GetAuraCount(SPELL_SUPERCHARGE) >= 2 && (!_targetEntry || target->GetEntry() == _targetEntry); } - + private: uint32 const _targetEntry; }; @@ -1027,32 +1027,32 @@ class achievement_cant_do_that_while_stunned : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - bool allow = target && target->GetAuraCount(SPELL_SUPERCHARGE) >= 2; - if (!allow) - return false; - - if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(DATA_BRUNDIR))) - return cr->AI()->GetData(DATA_BRUNDIR); - - return false; + bool allow = target && target->GetAuraCount(SPELL_SUPERCHARGE) >= 2; + if (!allow) + return false; + + if (InstanceScript* instance = target->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(DATA_BRUNDIR))) + return cr->AI()->GetData(DATA_BRUNDIR); + + return false; } }; void AddSC_boss_assembly_of_iron() { - new boss_steelbreaker(); - new boss_runemaster_molgeim(); - new boss_stormcaller_brundir(); - new npc_assembly_lightning(); + new boss_steelbreaker(); + new boss_runemaster_molgeim(); + new boss_stormcaller_brundir(); + new npc_assembly_lightning(); - new spell_shield_of_runes(); + new spell_shield_of_runes(); new spell_assembly_meltdown(); - new spell_assembly_rune_of_summoning(); + new spell_assembly_rune_of_summoning(); - new achievement_assembly_of_iron("achievement_but_im_on_your_side", 0); - new achievement_assembly_of_iron("achievement_assembly_steelbreaker", NPC_STEELBREAKER); - new achievement_assembly_of_iron("achievement_assembly_runemaster", NPC_MOLGEIM); - new achievement_assembly_of_iron("achievement_assembly_stormcaller", NPC_BRUNDIR); - new achievement_cant_do_that_while_stunned(); + new achievement_assembly_of_iron("achievement_but_im_on_your_side", 0); + new achievement_assembly_of_iron("achievement_assembly_steelbreaker", NPC_STEELBREAKER); + new achievement_assembly_of_iron("achievement_assembly_runemaster", NPC_MOLGEIM); + new achievement_assembly_of_iron("achievement_assembly_stormcaller", NPC_BRUNDIR); + new achievement_cant_do_that_while_stunned(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index 61aee43e8..d060f44a0 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp @@ -11,81 +11,81 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum AuriayaSpells { - // BASIC - SPELL_TERRIFYING_SCREECH = 64386, - SPELL_SENTINEL_BLAST_10 = 64389, - SPELL_SENTINEL_BLAST_25 = 64678, - SPELL_SONIC_SCREECH_10 = 64422, - SPELL_SONIC_SCREECH_25 = 64688, - SPELL_GUARDIAN_SWARM = 64396, - SPELL_ENRAGE = 47008, - SPELL_ACTIVATE_FERAL_DEFENDER = 64449, + // BASIC + SPELL_TERRIFYING_SCREECH = 64386, + SPELL_SENTINEL_BLAST_10 = 64389, + SPELL_SENTINEL_BLAST_25 = 64678, + SPELL_SONIC_SCREECH_10 = 64422, + SPELL_SONIC_SCREECH_25 = 64688, + SPELL_GUARDIAN_SWARM = 64396, + SPELL_ENRAGE = 47008, + SPELL_ACTIVATE_FERAL_DEFENDER = 64449, - // Sanctum Sentry - SPELL_SAVAGE_POUNCE_10 = 64666, - SPELL_SAVAGE_POUNCE_25 = 64374, - SPELL_RIP_FLESH_10 = 64375, - SPELL_RIP_FLESH_25 = 64667, - SPELL_STRENGTH_OF_THE_PACK = 64369, + // Sanctum Sentry + SPELL_SAVAGE_POUNCE_10 = 64666, + SPELL_SAVAGE_POUNCE_25 = 64374, + SPELL_RIP_FLESH_10 = 64375, + SPELL_RIP_FLESH_25 = 64667, + SPELL_STRENGTH_OF_THE_PACK = 64369, - // Feral Defender - SPELL_FERAL_ESSENCE = 64455, - SPELL_FERAL_POUNCE_10 = 64478, - SPELL_FERAL_POUNCE_25 = 64669, - SPELL_FERAL_RUSH_10 = 64496, - SPELL_FERAL_RUSH_25 = 64674, - //SPELL_SEEPING_FERAL_ESSENCE_SUMMON = 64457, - SPELL_SEEPING_FERAL_ESSENCE_10 = 64458, - SPELL_SEEPING_FERAL_ESSENCE_25 = 64676, + // Feral Defender + SPELL_FERAL_ESSENCE = 64455, + SPELL_FERAL_POUNCE_10 = 64478, + SPELL_FERAL_POUNCE_25 = 64669, + SPELL_FERAL_RUSH_10 = 64496, + SPELL_FERAL_RUSH_25 = 64674, + //SPELL_SEEPING_FERAL_ESSENCE_SUMMON = 64457, + SPELL_SEEPING_FERAL_ESSENCE_10 = 64458, + SPELL_SEEPING_FERAL_ESSENCE_25 = 64676, }; -#define SPELL_SONIC_SCREECH RAID_MODE(SPELL_SONIC_SCREECH_10, SPELL_SONIC_SCREECH_25) -#define SPELL_SENTINEL_BLAST RAID_MODE(SPELL_SENTINEL_BLAST_10, SPELL_SENTINEL_BLAST_25) -#define SPELL_SAVAGE_POUNCE RAID_MODE(SPELL_SAVAGE_POUNCE_10, SPELL_SAVAGE_POUNCE_25) -#define SPELL_RIP_FLESH RAID_MODE(SPELL_RIP_FLESH_10, SPELL_RIP_FLESH_25) -#define SPELL_FERAL_POUNCE RAID_MODE(SPELL_FERAL_POUNCE_10, SPELL_FERAL_POUNCE_25) -#define SPELL_FERAL_RUSH RAID_MODE(SPELL_FERAL_RUSH_10, SPELL_FERAL_RUSH_25) -#define SPELL_SEEPING_FERAL_ESSENCE RAID_MODE(SPELL_SEEPING_FERAL_ESSENCE_10, SPELL_SEEPING_FERAL_ESSENCE_25) +#define SPELL_SONIC_SCREECH RAID_MODE(SPELL_SONIC_SCREECH_10, SPELL_SONIC_SCREECH_25) +#define SPELL_SENTINEL_BLAST RAID_MODE(SPELL_SENTINEL_BLAST_10, SPELL_SENTINEL_BLAST_25) +#define SPELL_SAVAGE_POUNCE RAID_MODE(SPELL_SAVAGE_POUNCE_10, SPELL_SAVAGE_POUNCE_25) +#define SPELL_RIP_FLESH RAID_MODE(SPELL_RIP_FLESH_10, SPELL_RIP_FLESH_25) +#define SPELL_FERAL_POUNCE RAID_MODE(SPELL_FERAL_POUNCE_10, SPELL_FERAL_POUNCE_25) +#define SPELL_FERAL_RUSH RAID_MODE(SPELL_FERAL_RUSH_10, SPELL_FERAL_RUSH_25) +#define SPELL_SEEPING_FERAL_ESSENCE RAID_MODE(SPELL_SEEPING_FERAL_ESSENCE_10, SPELL_SEEPING_FERAL_ESSENCE_25) enum AuriayaNPC { - NPC_FERAL_DEFENDER = 34035, - NPC_SANCTUM_SENTRY = 34014, - NPC_SEEPING_FERAL_ESSENCE = 34098, + NPC_FERAL_DEFENDER = 34035, + NPC_SANCTUM_SENTRY = 34014, + NPC_SEEPING_FERAL_ESSENCE = 34098, }; enum AuriayaEvents { - EVENT_SUMMON_FERAL_DEFENDER = 1, - EVENT_TERRIFYING_SCREECH = 2, - EVENT_SONIC_SCREECH = 3, - EVENT_GUARDIAN_SWARM = 4, - EVENT_SENTINEL_BLAST = 5, - EVENT_REMOVE_IMMUNE = 6, + EVENT_SUMMON_FERAL_DEFENDER = 1, + EVENT_TERRIFYING_SCREECH = 2, + EVENT_SONIC_SCREECH = 3, + EVENT_GUARDIAN_SWARM = 4, + EVENT_SENTINEL_BLAST = 5, + EVENT_REMOVE_IMMUNE = 6, - EVENT_RESPAWN_FERAL_DEFENDER = 9, - EVENT_ENRAGE = 10, + EVENT_RESPAWN_FERAL_DEFENDER = 9, + EVENT_ENRAGE = 10, }; enum AuriayaSounds { - SOUND_AGGRO = 15473, - SOUND_SLAY1 = 15474, - SOUND_SLAY2 = 15475, - SOUND_DEATH = 15476, - SOUND_BERSERK = 15477, - SOUND_WOUND = 15478, + SOUND_AGGRO = 15473, + SOUND_SLAY1 = 15474, + SOUND_SLAY2 = 15475, + SOUND_DEATH = 15476, + SOUND_BERSERK = 15477, + SOUND_WOUND = 15478, }; enum Misc { - ACTION_FERAL_RESPAWN = 1, - ACTION_FERAL_DEATH = 2, - ACTION_DESPAWN_ADDS = 3, - ACTION_FERAL_DEATH_WITH_STACK = 4, + ACTION_FERAL_RESPAWN = 1, + ACTION_FERAL_DEATH = 2, + ACTION_DESPAWN_ADDS = 3, + ACTION_FERAL_DEATH_WITH_STACK = 4, - DATA_CRAZY_CAT = 10, - DATA_NINE_LIVES = 11, + DATA_CRAZY_CAT = 10, + DATA_NINE_LIVES = 11, }; class boss_auriaya : public CreatureScript @@ -98,181 +98,181 @@ public: return new boss_auriayaAI (pCreature); } - struct boss_auriayaAI : public ScriptedAI - { - boss_auriayaAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) - { - m_pInstance = pCreature->GetInstanceScript(); - } + struct boss_auriayaAI : public ScriptedAI + { + boss_auriayaAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - InstanceScript* m_pInstance; - EventMap events; - SummonList summons; + InstanceScript* m_pInstance; + EventMap events; + SummonList summons; - bool _feralDied; - bool _nineLives; + bool _feralDied; + bool _nineLives; - void Reset() - { - _feralDied = false; - _nineLives = false; + void Reset() + { + _feralDied = false; + _nineLives = false; - events.Reset(); - EntryCheckPredicate pred(NPC_FERAL_DEFENDER); - summons.DoAction(ACTION_DESPAWN_ADDS, pred); - summons.DespawnAll(); + events.Reset(); + EntryCheckPredicate pred(NPC_FERAL_DEFENDER); + summons.DoAction(ACTION_DESPAWN_ADDS, pred); + summons.DespawnAll(); - if (m_pInstance) - m_pInstance->SetData(TYPE_AURIAYA, NOT_STARTED); + if (m_pInstance) + m_pInstance->SetData(TYPE_AURIAYA, NOT_STARTED); - for (uint8 i = 0; i < RAID_MODE(2,4); ++i) - me->SummonCreature(NPC_SANCTUM_SENTRY, me->GetPositionX()+urand(4,12), me->GetPositionY()+urand(4,12), me->GetPositionZ()); - - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); - } + for (uint8 i = 0; i < RAID_MODE(2,4); ++i) + me->SummonCreature(NPC_SANCTUM_SENTRY, me->GetPositionX()+urand(4,12), me->GetPositionY()+urand(4,12), me->GetPositionZ()); + + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); + } - uint32 GetData(uint32 param) const - { - if (param == DATA_CRAZY_CAT) - return !_feralDied; - else if (param == DATA_NINE_LIVES) - return _nineLives; + uint32 GetData(uint32 param) const + { + if (param == DATA_CRAZY_CAT) + return !_feralDied; + else if (param == DATA_NINE_LIVES) + return _nineLives; - return 0; - } + return 0; + } - void JustSummoned(Creature* cr) - { - if (cr->GetEntry() == NPC_SANCTUM_SENTRY) - cr->GetMotionMaster()->MoveFollow(me, 6, rand_norm()*2*3.14f); - else - cr->SetInCombatWithZone(); + void JustSummoned(Creature* cr) + { + if (cr->GetEntry() == NPC_SANCTUM_SENTRY) + cr->GetMotionMaster()->MoveFollow(me, 6, rand_norm()*2*3.14f); + else + cr->SetInCombatWithZone(); - summons.Summon(cr); - } + summons.Summon(cr); + } - void SummonedCreatureDies(Creature* cr, Unit*) - { - if (cr->GetEntry() == NPC_SANCTUM_SENTRY) - _feralDied = true; - } + void SummonedCreatureDies(Creature* cr, Unit*) + { + if (cr->GetEntry() == NPC_SANCTUM_SENTRY) + _feralDied = true; + } - void JustReachedHome() { me->setActive(false); } + void JustReachedHome() { me->setActive(false); } - void EnterCombat(Unit* who) - { - if (m_pInstance) - m_pInstance->SetData(TYPE_AURIAYA, IN_PROGRESS); + void EnterCombat(Unit* who) + { + if (m_pInstance) + m_pInstance->SetData(TYPE_AURIAYA, IN_PROGRESS); - events.ScheduleEvent(EVENT_TERRIFYING_SCREECH, 35000); - events.ScheduleEvent(EVENT_SONIC_SCREECH, 45000); - events.ScheduleEvent(EVENT_GUARDIAN_SWARM, 70000); - events.ScheduleEvent(EVENT_SUMMON_FERAL_DEFENDER, 60000); - events.ScheduleEvent(EVENT_SENTINEL_BLAST, 36000); - events.ScheduleEvent(EVENT_ENRAGE, 600000); + events.ScheduleEvent(EVENT_TERRIFYING_SCREECH, 35000); + events.ScheduleEvent(EVENT_SONIC_SCREECH, 45000); + events.ScheduleEvent(EVENT_GUARDIAN_SWARM, 70000); + events.ScheduleEvent(EVENT_SUMMON_FERAL_DEFENDER, 60000); + events.ScheduleEvent(EVENT_SENTINEL_BLAST, 36000); + events.ScheduleEvent(EVENT_ENRAGE, 600000); - summons.DoZoneInCombat(NPC_SANCTUM_SENTRY); + summons.DoZoneInCombat(NPC_SANCTUM_SENTRY); - me->MonsterYell("Some things are better left alone!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_AGGRO); - me->setActive(true); - } + me->MonsterYell("Some things are better left alone!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_AGGRO); + me->setActive(true); + } - void KilledUnit(Unit* victim) - { - if (urand(0,2)) - return; + void KilledUnit(Unit* victim) + { + if (urand(0,2)) + return; - if (urand(0,1)) - { - me->MonsterYell("The secret dies with you!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SLAY1); - } - else - { - me->MonsterYell("There is no escape!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SLAY2); - } - } + if (urand(0,1)) + { + me->MonsterYell("The secret dies with you!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SLAY1); + } + else + { + me->MonsterYell("There is no escape!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SLAY2); + } + } - void JustDied(Unit *victim) - { - if (m_pInstance) - m_pInstance->SetData(TYPE_AURIAYA, DONE); + void JustDied(Unit *victim) + { + if (m_pInstance) + m_pInstance->SetData(TYPE_AURIAYA, DONE); - EntryCheckPredicate pred(NPC_FERAL_DEFENDER); - summons.DoAction(ACTION_DESPAWN_ADDS, pred); - summons.DespawnAll(); - me->MonsterTextEmote("Auriaya screams in agony.", 0); - me->PlayDirectSound(SOUND_DEATH); - } + EntryCheckPredicate pred(NPC_FERAL_DEFENDER); + summons.DoAction(ACTION_DESPAWN_ADDS, pred); + summons.DespawnAll(); + me->MonsterTextEmote("Auriaya screams in agony.", 0); + me->PlayDirectSound(SOUND_DEATH); + } - void DoAction(int32 param) - { - if (param == ACTION_FERAL_DEATH_WITH_STACK) - events.ScheduleEvent(EVENT_RESPAWN_FERAL_DEFENDER, 25000); - else if (param == ACTION_FERAL_DEATH) - _nineLives = true; - } + void DoAction(int32 param) + { + if (param == ACTION_FERAL_DEATH_WITH_STACK) + events.ScheduleEvent(EVENT_RESPAWN_FERAL_DEFENDER, 25000); + else if (param == ACTION_FERAL_DEATH) + _nineLives = true; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SUMMON_FERAL_DEFENDER: - me->MonsterTextEmote("Auriaya begins to activate Feral Defender.", 0, true); - me->CastSpell(me, SPELL_ACTIVATE_FERAL_DEFENDER, true); - events.PopEvent(); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); - events.ScheduleEvent(EVENT_REMOVE_IMMUNE, 3000); - break; - case EVENT_REMOVE_IMMUNE: - events.PopEvent(); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); - break; - case EVENT_TERRIFYING_SCREECH: - me->MonsterTextEmote("Auriaya begins to cast Terrifying Screech.", 0, true); - me->CastSpell(me, SPELL_TERRIFYING_SCREECH, false); - events.RepeatEvent(35000); - break; - case EVENT_SONIC_SCREECH: - me->CastSpell(me, SPELL_SONIC_SCREECH, false); - events.RepeatEvent(50000); - break; - case EVENT_GUARDIAN_SWARM: - me->CastSpell(me->GetVictim(), SPELL_GUARDIAN_SWARM, false); - events.RepeatEvent(40000); - break; - case EVENT_SENTINEL_BLAST: - me->CastSpell(me, SPELL_SENTINEL_BLAST, false); - events.RepeatEvent(35000); - events.DelayEvents(5000, 0); - break; - case EVENT_RESPAWN_FERAL_DEFENDER: - { - EntryCheckPredicate pred(NPC_FERAL_DEFENDER); - summons.DoAction(ACTION_FERAL_RESPAWN, pred); - events.PopEvent(); - break; - } - case EVENT_ENRAGE: - me->MonsterTextEmote("You waste my time!", 0); - me->PlayDirectSound(SOUND_BERSERK); - me->CastSpell(me, SPELL_ENRAGE, true); - events.PopEvent(); - break; - } + switch (events.GetEvent()) + { + case EVENT_SUMMON_FERAL_DEFENDER: + me->MonsterTextEmote("Auriaya begins to activate Feral Defender.", 0, true); + me->CastSpell(me, SPELL_ACTIVATE_FERAL_DEFENDER, true); + events.PopEvent(); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); + events.ScheduleEvent(EVENT_REMOVE_IMMUNE, 3000); + break; + case EVENT_REMOVE_IMMUNE: + events.PopEvent(); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false); + break; + case EVENT_TERRIFYING_SCREECH: + me->MonsterTextEmote("Auriaya begins to cast Terrifying Screech.", 0, true); + me->CastSpell(me, SPELL_TERRIFYING_SCREECH, false); + events.RepeatEvent(35000); + break; + case EVENT_SONIC_SCREECH: + me->CastSpell(me, SPELL_SONIC_SCREECH, false); + events.RepeatEvent(50000); + break; + case EVENT_GUARDIAN_SWARM: + me->CastSpell(me->GetVictim(), SPELL_GUARDIAN_SWARM, false); + events.RepeatEvent(40000); + break; + case EVENT_SENTINEL_BLAST: + me->CastSpell(me, SPELL_SENTINEL_BLAST, false); + events.RepeatEvent(35000); + events.DelayEvents(5000, 0); + break; + case EVENT_RESPAWN_FERAL_DEFENDER: + { + EntryCheckPredicate pred(NPC_FERAL_DEFENDER); + summons.DoAction(ACTION_FERAL_RESPAWN, pred); + events.PopEvent(); + break; + } + case EVENT_ENRAGE: + me->MonsterTextEmote("You waste my time!", 0); + me->PlayDirectSound(SOUND_BERSERK); + me->CastSpell(me, SPELL_ENRAGE, true); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_auriaya_sanctum_sentry : public CreatureScript @@ -285,56 +285,56 @@ public: return new npc_auriaya_sanctum_sentryAI (pCreature); } - struct npc_auriaya_sanctum_sentryAI : public ScriptedAI - { - npc_auriaya_sanctum_sentryAI(Creature* pCreature) : ScriptedAI(pCreature) { } + struct npc_auriaya_sanctum_sentryAI : public ScriptedAI + { + npc_auriaya_sanctum_sentryAI(Creature* pCreature) : ScriptedAI(pCreature) { } - uint32 _savagePounceTimer; - uint32 _ripFleshTimer; + uint32 _savagePounceTimer; + uint32 _ripFleshTimer; - void EnterCombat(Unit*) - { - if (me->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_AURIAYA))) - cr->SetInCombatWithZone(); - } + void EnterCombat(Unit*) + { + if (me->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_AURIAYA))) + cr->SetInCombatWithZone(); + } - void Reset() - { - _savagePounceTimer = 5000; - _ripFleshTimer = 0; + void Reset() + { + _savagePounceTimer = 5000; + _ripFleshTimer = 0; - me->CastSpell(me, SPELL_STRENGTH_OF_THE_PACK, true); - } + me->CastSpell(me, SPELL_STRENGTH_OF_THE_PACK, true); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _savagePounceTimer += diff; - _ripFleshTimer += diff; + _savagePounceTimer += diff; + _ripFleshTimer += diff; - if (_savagePounceTimer >= 5000) - { - float dist = me->GetDistance(me->GetVictim()); - if (dist >= 8 && dist < 25 && me->IsWithinLOSInMap(me->GetVictim())) - { - me->CastSpell(me->GetVictim(), SPELL_SAVAGE_POUNCE, false); - _savagePounceTimer = 0; - return; - } - _savagePounceTimer = 200; - } - else if (_ripFleshTimer >= 10000) - { - me->CastSpell(me->GetVictim(), SPELL_RIP_FLESH, false); - _ripFleshTimer = 0; - } + if (_savagePounceTimer >= 5000) + { + float dist = me->GetDistance(me->GetVictim()); + if (dist >= 8 && dist < 25 && me->IsWithinLOSInMap(me->GetVictim())) + { + me->CastSpell(me->GetVictim(), SPELL_SAVAGE_POUNCE, false); + _savagePounceTimer = 0; + return; + } + _savagePounceTimer = 200; + } + else if (_ripFleshTimer >= 10000) + { + me->CastSpell(me->GetVictim(), SPELL_RIP_FLESH, false); + _ripFleshTimer = 0; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_auriaya_feral_defender : public CreatureScript @@ -347,90 +347,90 @@ public: return new npc_auriaya_feral_defenderAI (pCreature); } - struct npc_auriaya_feral_defenderAI : public ScriptedAI - { - npc_auriaya_feral_defenderAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) { } + struct npc_auriaya_feral_defenderAI : public ScriptedAI + { + npc_auriaya_feral_defenderAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) { } - int32 _feralRushTimer; - int32 _feralPounceTimer; - uint8 _feralEssenceStack; - SummonList summons; + int32 _feralRushTimer; + int32 _feralPounceTimer; + uint8 _feralEssenceStack; + SummonList summons; - void Reset() - { - summons.DespawnAll(); - _feralRushTimer = 3000; - _feralPounceTimer = 0; - _feralEssenceStack = 8; + void Reset() + { + summons.DespawnAll(); + _feralRushTimer = 3000; + _feralPounceTimer = 0; + _feralEssenceStack = 8; - if (Aura* aur = me->AddAura(SPELL_FERAL_ESSENCE, me)) - aur->SetStackAmount(_feralEssenceStack); - } + if (Aura* aur = me->AddAura(SPELL_FERAL_ESSENCE, me)) + aur->SetStackAmount(_feralEssenceStack); + } - void JustDied(Unit*) - { - // inform about our death, start timer - if (me->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_AURIAYA))) - cr->AI()->DoAction(_feralEssenceStack ? ACTION_FERAL_DEATH_WITH_STACK : ACTION_FERAL_DEATH); + void JustDied(Unit*) + { + // inform about our death, start timer + if (me->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_AURIAYA))) + cr->AI()->DoAction(_feralEssenceStack ? ACTION_FERAL_DEATH_WITH_STACK : ACTION_FERAL_DEATH); - if (_feralEssenceStack) - { - if (Creature *cr = me->SummonCreature(NPC_SEEPING_FERAL_ESSENCE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f)) - summons.Summon(cr); + if (_feralEssenceStack) + { + if (Creature *cr = me->SummonCreature(NPC_SEEPING_FERAL_ESSENCE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f)) + summons.Summon(cr); - --_feralEssenceStack; - } - } + --_feralEssenceStack; + } + } - void DoAction(int32 param) - { - if (param == ACTION_FERAL_RESPAWN) - { - me->setDeathState(JUST_RESPAWNED); + void DoAction(int32 param) + { + if (param == ACTION_FERAL_RESPAWN) + { + me->setDeathState(JUST_RESPAWNED); - if (Player* target = SelectTargetFromPlayerList(200)) - AttackStart(target); - else - { - summons.DespawnAll(); - me->DespawnOrUnsummon(1); - } + if (Player* target = SelectTargetFromPlayerList(200)) + AttackStart(target); + else + { + summons.DespawnAll(); + me->DespawnOrUnsummon(1); + } - if (_feralEssenceStack) - if (Aura* aur = me->AddAura(SPELL_FERAL_ESSENCE, me)) - aur->SetStackAmount(_feralEssenceStack); - } - else if (param == ACTION_DESPAWN_ADDS) - summons.DespawnAll(); - } + if (_feralEssenceStack) + if (Aura* aur = me->AddAura(SPELL_FERAL_ESSENCE, me)) + aur->SetStackAmount(_feralEssenceStack); + } + else if (param == ACTION_DESPAWN_ADDS) + summons.DespawnAll(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _feralRushTimer += diff; - _feralPounceTimer += diff; + _feralRushTimer += diff; + _feralPounceTimer += diff; - if (_feralRushTimer >= 6000) - { - DoResetThreat(); - if (!UpdateVictim()) - return; + if (_feralRushTimer >= 6000) + { + DoResetThreat(); + if (!UpdateVictim()) + return; - me->CastSpell(me->GetVictim(), SPELL_FERAL_RUSH, true); - _feralRushTimer = 0; - } - else if (_feralPounceTimer >= 6000) - { - me->CastSpell(me->GetVictim(), SPELL_FERAL_POUNCE, false); - _feralPounceTimer = 0; - } + me->CastSpell(me->GetVictim(), SPELL_FERAL_RUSH, true); + _feralRushTimer = 0; + } + else if (_feralPounceTimer >= 6000) + { + me->CastSpell(me->GetVictim(), SPELL_FERAL_POUNCE, false); + _feralPounceTimer = 0; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_auriaya_sentinel_blast : public SpellScriptLoader @@ -466,12 +466,12 @@ class achievement_auriaya_crazy_cat_lady : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - if (target) - if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_AURIAYA))) - return cr->AI()->GetData(DATA_CRAZY_CAT); - - return false; + if (target) + if (InstanceScript* instance = target->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_AURIAYA))) + return cr->AI()->GetData(DATA_CRAZY_CAT); + + return false; } }; @@ -482,23 +482,23 @@ class achievement_auriaya_nine_lives : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - if (target) - if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_AURIAYA))) - return cr->AI()->GetData(DATA_NINE_LIVES); - - return false; + if (target) + if (InstanceScript* instance = target->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_AURIAYA))) + return cr->AI()->GetData(DATA_NINE_LIVES); + + return false; } }; void AddSC_boss_auriaya() { - new boss_auriaya(); - new npc_auriaya_sanctum_sentry(); - new npc_auriaya_feral_defender(); + new boss_auriaya(); + new npc_auriaya_sanctum_sentry(); + new npc_auriaya_feral_defender(); - new spell_auriaya_sentinel_blast(); + new spell_auriaya_sentinel_blast(); - new achievement_auriaya_crazy_cat_lady(); - new achievement_auriaya_nine_lives(); + new achievement_auriaya_crazy_cat_lady(); + new achievement_auriaya_nine_lives(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 3d17fea24..009456e64 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -20,154 +20,154 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum LeviathanSpells { - // Leviathan basic - SPELL_PURSUED = 62374, - SPELL_GATHERING_SPEED = 62375, - SPELL_BATTERING_RAM = 62376, - SPELL_FLAME_VENTS = 62396, - SPELL_MISSILE_BARRAGE = 62400, - SPELL_NAPALM_10 = 63666, - SPELL_NAPALM_25 = 65026, - SPELL_INVIS_AND_STEALTH_DETECT = 18950, + // Leviathan basic + SPELL_PURSUED = 62374, + SPELL_GATHERING_SPEED = 62375, + SPELL_BATTERING_RAM = 62376, + SPELL_FLAME_VENTS = 62396, + SPELL_MISSILE_BARRAGE = 62400, + SPELL_NAPALM_10 = 63666, + SPELL_NAPALM_25 = 65026, + SPELL_INVIS_AND_STEALTH_DETECT = 18950, - // Shutdown spells - SPELL_SYSTEMS_SHUTDOWN = 62475, - SPELL_OVERLOAD_CIRCUIT = 62399, + // Shutdown spells + SPELL_SYSTEMS_SHUTDOWN = 62475, + SPELL_OVERLOAD_CIRCUIT = 62399, - // hard mode - SPELL_TOWER_OF_STORMS = 65076, - SPELL_TOWER_OF_FLAMES = 65075, - SPELL_TOWER_OF_FROST = 65077, - SPELL_TOWER_OF_LIFE = 64482, + // hard mode + SPELL_TOWER_OF_STORMS = 65076, + SPELL_TOWER_OF_FLAMES = 65075, + SPELL_TOWER_OF_FROST = 65077, + SPELL_TOWER_OF_LIFE = 64482, - SPELL_HODIRS_FURY = 62533, - SPELL_FREYA_WARD = 62906, // removed spawn effect - SPELL_MIMIRONS_INFERNO = 62909, - SPELL_THORIMS_HAMMER = 62911, + SPELL_HODIRS_FURY = 62533, + SPELL_FREYA_WARD = 62906, // removed spawn effect + SPELL_MIMIRONS_INFERNO = 62909, + SPELL_THORIMS_HAMMER = 62911, - SPELL_FREYA_DUMMY_BLUE = 63294, - SPELL_FREYA_DUMMY_GREEN = 63295, - SPELL_FREYA_DUMMY_YELLOW = 63292, + SPELL_FREYA_DUMMY_BLUE = 63294, + SPELL_FREYA_DUMMY_GREEN = 63295, + SPELL_FREYA_DUMMY_YELLOW = 63292, - // Leviathan turret spell - SPELL_SEARING_FLAME = 62402, - // On turret Destory - SPELL_SMOKE_TRAIL = 63575, + // Leviathan turret spell + SPELL_SEARING_FLAME = 62402, + // On turret Destory + SPELL_SMOKE_TRAIL = 63575, - // Pool of tar blaze - SPELL_BLAZE = 62292, + // Pool of tar blaze + SPELL_BLAZE = 62292, - // Pyrite - SPELL_LIQUID_PYRITE = 62494, - SPELL_DUSTY_EXPLOSION = 63360, - SPELL_DUST_CLOUD_IMPACT = 54740, + // Pyrite + SPELL_LIQUID_PYRITE = 62494, + SPELL_DUSTY_EXPLOSION = 63360, + SPELL_DUST_CLOUD_IMPACT = 54740, }; enum GosNpcs { - NPC_FLAME_LEVIATHAN_TURRET = 33139, - NPC_SEAT = 33114, - NPC_MECHANOLIFT = 33214, - NPC_LIQUID = 33189, + NPC_FLAME_LEVIATHAN_TURRET = 33139, + NPC_SEAT = 33114, + NPC_MECHANOLIFT = 33214, + NPC_LIQUID = 33189, - // Starting event - NPC_ULDUAR_COLOSSUS = 33237, - NPC_HIGH_EXPLORER_DELLORAH = 33701, - NPC_ARCHMAGE_RHYDIAN = 33696, - NPC_START_BRANN_BRONZEBEARD = 33579, - NPC_ARCHMAGE_PENTARUS = 33624, - NPC_BRANN_RADIO = 34054, - NPC_ULDUAR_GAUNTLET_GENERATOR = 33571, - NPC_DEFENDER_GENERATED = 33572, - GO_STARTING_BARRIER = 194484, + // Starting event + NPC_ULDUAR_COLOSSUS = 33237, + NPC_HIGH_EXPLORER_DELLORAH = 33701, + NPC_ARCHMAGE_RHYDIAN = 33696, + NPC_START_BRANN_BRONZEBEARD = 33579, + NPC_ARCHMAGE_PENTARUS = 33624, + NPC_BRANN_RADIO = 34054, + NPC_ULDUAR_GAUNTLET_GENERATOR = 33571, + NPC_DEFENDER_GENERATED = 33572, + GO_STARTING_BARRIER = 194484, - // Hard Mode - NPC_THORIM_HAMMER_TARGET = 33364, - NPC_THORIM_HAMMER = 33365, - NPC_FREYA_WARD_TARGET = 33366, - NPC_FREYA_WARD = 33367, - NPC_MIMIRONS_INFERNO_TARGET = 33369, - NPC_MIMIRONS_INFERNO = 33370, - NPC_HODIRS_FURY_TARGET = 33108, - NPC_HODIRS_FURY = 33212, + // Hard Mode + NPC_THORIM_HAMMER_TARGET = 33364, + NPC_THORIM_HAMMER = 33365, + NPC_FREYA_WARD_TARGET = 33366, + NPC_FREYA_WARD = 33367, + NPC_MIMIRONS_INFERNO_TARGET = 33369, + NPC_MIMIRONS_INFERNO = 33370, + NPC_HODIRS_FURY_TARGET = 33108, + NPC_HODIRS_FURY = 33212, }; enum Events { - EVENT_PURSUE = 1, - EVENT_MISSILE, - EVENT_VENT, - EVENT_SPEED, - EVENT_SUMMON, - EVENT_REINSTALL, - EVENT_HODIRS_FURY, - EVENT_FREYA, - EVENT_MIMIRONS_INFERNO, - EVENT_THORIMS_HAMMER, - EVENT_SOUND_BEGINNING, - EVENT_POSITION_CHECK, + EVENT_PURSUE = 1, + EVENT_MISSILE, + EVENT_VENT, + EVENT_SPEED, + EVENT_SUMMON, + EVENT_REINSTALL, + EVENT_HODIRS_FURY, + EVENT_FREYA, + EVENT_MIMIRONS_INFERNO, + EVENT_THORIMS_HAMMER, + EVENT_SOUND_BEGINNING, + EVENT_POSITION_CHECK, }; enum Sounds { - LV_SOUND_AGGRO = 15506, - LV_SOUND_TARGET1 = 15507, - LV_SOUND_TARGET2 = 15508, - LV_SOUND_TARGET3 = 15509, - LV_SOUND_HARD_MODE = 15510, - LV_SOUND_TOWER_0 = 15511, - LV_SOUND_TOWER_1 = 15512, - LV_SOUND_TOWER_2 = 15513, - LV_SOUND_TOWER_3 = 15514, - LV_SOUND_TOWER_4 = 15515, - LV_SOUND_PLAYER_RIDE = 15516, - LV_SOUND_OVERLOAD1 = 15517, - LV_SOUND_OVERLOAD2 = 15518, - LV_SOUND_OVERLOAD3 = 15519, - LV_SOUND_DIE = 15520, - LV_SOUND_SLY = 15521, + LV_SOUND_AGGRO = 15506, + LV_SOUND_TARGET1 = 15507, + LV_SOUND_TARGET2 = 15508, + LV_SOUND_TARGET3 = 15509, + LV_SOUND_HARD_MODE = 15510, + LV_SOUND_TOWER_0 = 15511, + LV_SOUND_TOWER_1 = 15512, + LV_SOUND_TOWER_2 = 15513, + LV_SOUND_TOWER_3 = 15514, + LV_SOUND_TOWER_4 = 15515, + LV_SOUND_PLAYER_RIDE = 15516, + LV_SOUND_OVERLOAD1 = 15517, + LV_SOUND_OVERLOAD2 = 15518, + LV_SOUND_OVERLOAD3 = 15519, + LV_SOUND_DIE = 15520, + LV_SOUND_SLY = 15521, - RSOUND_L0 = 15807, - RSOUND_L1 = 15804, - RSOUND_L2 = 15805, - RSOUND_L3 = 15806, - RSOUND_ENGAGE = 15794, - RSOUND_SILOS = 15795, - RSOUND_GENERATORS = 15796, - RSOUND_HODIR = 15797, - RSOUND_FREYA = 15798, - RSOUND_MIMIRON = 15799, - RSOUND_THORIM = 15801, - RSOUND_STATION = 15803, + RSOUND_L0 = 15807, + RSOUND_L1 = 15804, + RSOUND_L2 = 15805, + RSOUND_L3 = 15806, + RSOUND_ENGAGE = 15794, + RSOUND_SILOS = 15795, + RSOUND_GENERATORS = 15796, + RSOUND_HODIR = 15797, + RSOUND_FREYA = 15798, + RSOUND_MIMIRON = 15799, + RSOUND_THORIM = 15801, + RSOUND_STATION = 15803, }; enum Seats { - SEAT_PLAYER = 0, - SEAT_TURRET = 1, - SEAT_DEVICE = 2, - SEAT_CANNON = 7, + SEAT_PLAYER = 0, + SEAT_TURRET = 1, + SEAT_DEVICE = 2, + SEAT_CANNON = 7, }; enum Misc { - DATA_EVENT_STARTED = 1, - DATA_GET_TOWER_COUNT = 2, - DATA_GET_SHUTDOWN = 3, + DATA_EVENT_STARTED = 1, + DATA_GET_TOWER_COUNT = 2, + DATA_GET_SHUTDOWN = 3, - TOWER_OF_STORMS = 2, - TOWER_OF_FLAMES = 1, - TOWER_OF_FROST = 3, - TOWER_OF_LIFE = 0, + TOWER_OF_STORMS = 2, + TOWER_OF_FLAMES = 1, + TOWER_OF_FROST = 3, + TOWER_OF_LIFE = 0, - ACTION_START_NORGANNON_EVENT = 1, - ACTION_START_NORGANNON_BRANN = 2, - ACTION_START_BRANN_EVENT = 3, - ACTION_DESPAWN_ADDS = 4, - ACTION_DELAY_CANNON = 5, + ACTION_START_NORGANNON_EVENT = 1, + ACTION_START_NORGANNON_BRANN = 2, + ACTION_START_BRANN_EVENT = 3, + ACTION_DESPAWN_ADDS = 4, + ACTION_DELAY_CANNON = 5, }; -#define LV_SAY_PLAYER_RIDE = "Unauthorized entity attempting circuit overload. Activating anti-personnel countermeasures." +#define LV_SAY_PLAYER_RIDE = "Unauthorized entity attempting circuit overload. Activating anti-personnel countermeasures." /////////////////////////////////////////// // @@ -185,526 +185,526 @@ public: return new boss_flame_leviathanAI (pCreature); } - struct boss_flame_leviathanAI : public ScriptedAI - { - boss_flame_leviathanAI(Creature* pCreature) : ScriptedAI(pCreature), vehicle(me->GetVehicleKit()), summons(me) - { - m_pInstance = pCreature->GetInstanceScript(); - assert(vehicle); - } + struct boss_flame_leviathanAI : public ScriptedAI + { + boss_flame_leviathanAI(Creature* pCreature) : ScriptedAI(pCreature), vehicle(me->GetVehicleKit()), summons(me) + { + m_pInstance = pCreature->GetInstanceScript(); + assert(vehicle); + } - InstanceScript* m_pInstance; - Vehicle* vehicle; - EventMap events; - SummonList summons; + InstanceScript* m_pInstance; + Vehicle* vehicle; + EventMap events; + SummonList summons; - uint32 _startTimer; - uint32 _speakTimer; - uint8 _towersCount; - bool _shutdown; + uint32 _startTimer; + uint32 _speakTimer; + uint8 _towersCount; + bool _shutdown; - // Custom - void BindPlayers(); - void RadioSay(const char* text, uint32 soundId); - void ActivateTowers(); - void TurnGates(bool _start, bool _death); - void TurnHealStations(bool _apply); - void ScheduleEvents(); - void SayPursue(); - void SummonTowerHelpers(uint8 towerId); + // Custom + void BindPlayers(); + void RadioSay(const char* text, uint32 soundId); + void ActivateTowers(); + void TurnGates(bool _start, bool _death); + void TurnHealStations(bool _apply); + void ScheduleEvents(); + void SayPursue(); + void SummonTowerHelpers(uint8 towerId); - // Original - void JustReachedHome() - { - // For achievement - if (m_pInstance) - m_pInstance->SetData(DATA_UNBROKEN_ACHIEVEMENT, 0); - me->setActive(false); - } + // Original + void JustReachedHome() + { + // For achievement + if (m_pInstance) + m_pInstance->SetData(DATA_UNBROKEN_ACHIEVEMENT, 0); + me->setActive(false); + } - void MoveInLineOfSight(Unit*) {} - void JustSummoned(Creature* cr) - { - if (cr->GetEntry() != NPC_FLAME_LEVIATHAN_TURRET && cr->GetEntry() != NPC_SEAT) - summons.Summon(cr); - } + void MoveInLineOfSight(Unit*) {} + void JustSummoned(Creature* cr) + { + if (cr->GetEntry() != NPC_FLAME_LEVIATHAN_TURRET && cr->GetEntry() != NPC_SEAT) + summons.Summon(cr); + } - void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } - void SpellHit(Unit* caster, const SpellInfo* spellInfo); - void JustDied(Unit*); - void KilledUnit(Unit* who); + void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } + void SpellHit(Unit* caster, const SpellInfo* spellInfo); + void JustDied(Unit*); + void KilledUnit(Unit* who); - void AttackStart(Unit* who) - { - if (Unit* veh = who->GetVehicleBase()) - ScriptedAI::AttackStart(veh); - else - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (Unit* veh = who->GetVehicleBase()) + ScriptedAI::AttackStart(veh); + else + ScriptedAI::AttackStart(who); + } - void EnterCombat(Unit*) - { - ScheduleEvents(); - me->MonsterYell("Hostile entities detected. Threat assessment protocol active. Primary target engaged. Time minus thirty seconds to re-evaluation.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_AGGRO); + void EnterCombat(Unit*) + { + ScheduleEvents(); + me->MonsterYell("Hostile entities detected. Threat assessment protocol active. Primary target engaged. Time minus thirty seconds to re-evaluation.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_AGGRO); - me->setActive(true); - me->SetHomePosition(322.4f, -14.3f, 409.8f, 3.23f); - TurnGates(true, false); - TurnHealStations(false); - ActivateTowers(); - if (m_pInstance) - m_pInstance->SetData(TYPE_LEVIATHAN, SPECIAL); + me->setActive(true); + me->SetHomePosition(322.4f, -14.3f, 409.8f, 3.23f); + TurnGates(true, false); + TurnHealStations(false); + ActivateTowers(); + if (m_pInstance) + m_pInstance->SetData(TYPE_LEVIATHAN, SPECIAL); - BindPlayers(); - me->SetInCombatWithZone(); - } + BindPlayers(); + me->SetInCombatWithZone(); + } - void InitializeAI() - { - if (m_pInstance && m_pInstance->GetData(TYPE_LEVIATHAN) == SPECIAL) - { - me->SetHomePosition(322.4f, -14.3f, 409.8f, 3.23f); - me->UpdatePosition(322.4f, -14.3f, 409.8f, 3.23f); - me->StopMovingOnCurrentPos(); - } + void InitializeAI() + { + if (m_pInstance && m_pInstance->GetData(TYPE_LEVIATHAN) == SPECIAL) + { + me->SetHomePosition(322.4f, -14.3f, 409.8f, 3.23f); + me->UpdatePosition(322.4f, -14.3f, 409.8f, 3.23f); + me->StopMovingOnCurrentPos(); + } - ScriptedAI::InitializeAI(); - } + ScriptedAI::InitializeAI(); + } - void Reset() - { - // Special immunity case - me->CastSpell(me, SPELL_INVIS_AND_STEALTH_DETECT, true); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED, true); + void Reset() + { + // Special immunity case + me->CastSpell(me, SPELL_INVIS_AND_STEALTH_DETECT, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED, true); - summons.DoAction(ACTION_DESPAWN_ADDS); - summons.DespawnAll(); - events.Reset(); + summons.DoAction(ACTION_DESPAWN_ADDS); + summons.DespawnAll(); + events.Reset(); - _shutdown = false; - _startTimer = 1; - _speakTimer = 0; - _towersCount = 0; + _shutdown = false; + _startTimer = 1; + _speakTimer = 0; + _towersCount = 0; - if (m_pInstance) - { - if (m_pInstance->GetData(TYPE_LEVIATHAN) != SPECIAL) - { - m_pInstance->SetData(TYPE_LEVIATHAN, NOT_STARTED); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - m_pInstance->SetData(DATA_VEHICLE_SPAWN, VEHICLE_POS_LEVIATHAN); - _startTimer = 0; - } - } + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_LEVIATHAN) != SPECIAL) + { + m_pInstance->SetData(TYPE_LEVIATHAN, NOT_STARTED); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + m_pInstance->SetData(DATA_VEHICLE_SPAWN, VEHICLE_POS_LEVIATHAN); + _startTimer = 0; + } + } - TurnGates(false, false); - TurnHealStations(true); - } + TurnGates(false, false); + TurnHealStations(true); + } - uint32 GetData(uint32 param) const - { - if (param == DATA_GET_TOWER_COUNT) - return _towersCount; - if (param == DATA_GET_SHUTDOWN) - return !_shutdown; + uint32 GetData(uint32 param) const + { + if (param == DATA_GET_TOWER_COUNT) + return _towersCount; + if (param == DATA_GET_SHUTDOWN) + return !_shutdown; - return 0; - } + return 0; + } - void UpdateAI(uint32 diff) - { - // THIS IS USED ONLY FOR FIRST ENGAGE! - if (_startTimer) - { - _startTimer += diff; - if (_startTimer >= 4000) - { - // Colossus dead, players in range - if (me->FindNearestCreature(NPC_ULDUAR_COLOSSUS, 250.0f, true) || !SelectTargetFromPlayerList(250.0f)) - _startTimer = 1; - else - { - _startTimer = 0; - _speakTimer = 1; - } - } - return; - } + void UpdateAI(uint32 diff) + { + // THIS IS USED ONLY FOR FIRST ENGAGE! + if (_startTimer) + { + _startTimer += diff; + if (_startTimer >= 4000) + { + // Colossus dead, players in range + if (me->FindNearestCreature(NPC_ULDUAR_COLOSSUS, 250.0f, true) || !SelectTargetFromPlayerList(250.0f)) + _startTimer = 1; + else + { + _startTimer = 0; + _speakTimer = 1; + } + } + return; + } - if (_speakTimer) - { - _speakTimer += diff; - if (_speakTimer <= 10000) - { - RadioSay("You've done it! You've broken the defenses of Ulduar. In a few moments, we will be dropping in to...", RSOUND_L1); - _speakTimer = 10000; - } - else if (_speakTimer > 16000 && _speakTimer < 20000) - { - _speakTimer = 20000; - RadioSay("What is that? Be careful! Something's headed your way!", RSOUND_L2); - } - else if (_speakTimer > 24000 && _speakTimer < 40000) - { - _speakTimer = 40000; - RadioSay("Quicly! Evasive action! Evasive act--", RSOUND_L3); - } - else if (_speakTimer > 41000 && _speakTimer < 60000) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SendMonsterMove(380.4f, -14.3f, 409.8f, 2000); - me->UpdatePosition(380.4f, -14.3f, 409.8f, me->GetOrientation()); - _speakTimer = 60000; - } - else if (_speakTimer > 61500) - { - me->SetInCombatWithZone(); - if (!me->GetVictim()) - { - me->CastSpell(me, SPELL_PURSUED, false); - events.RescheduleEvent(EVENT_PURSUE, 31000); - } - _speakTimer = 0; - } - return; - } + if (_speakTimer) + { + _speakTimer += diff; + if (_speakTimer <= 10000) + { + RadioSay("You've done it! You've broken the defenses of Ulduar. In a few moments, we will be dropping in to...", RSOUND_L1); + _speakTimer = 10000; + } + else if (_speakTimer > 16000 && _speakTimer < 20000) + { + _speakTimer = 20000; + RadioSay("What is that? Be careful! Something's headed your way!", RSOUND_L2); + } + else if (_speakTimer > 24000 && _speakTimer < 40000) + { + _speakTimer = 40000; + RadioSay("Quicly! Evasive action! Evasive act--", RSOUND_L3); + } + else if (_speakTimer > 41000 && _speakTimer < 60000) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SendMonsterMove(380.4f, -14.3f, 409.8f, 2000); + me->UpdatePosition(380.4f, -14.3f, 409.8f, me->GetOrientation()); + _speakTimer = 60000; + } + else if (_speakTimer > 61500) + { + me->SetInCombatWithZone(); + if (!me->GetVictim()) + { + me->CastSpell(me, SPELL_PURSUED, false); + events.RescheduleEvent(EVENT_PURSUE, 31000); + } + _speakTimer = 0; + } + return; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_POSITION_CHECK: - if (me->GetPositionX() > 450 || me->GetPositionX() < 120) - { - EnterEvadeMode(); - return; - } - events.RepeatEvent(5000); - break; - case EVENT_PURSUE: - SayPursue(); + switch (events.GetEvent()) + { + case EVENT_POSITION_CHECK: + if (me->GetPositionX() > 450 || me->GetPositionX() < 120) + { + EnterEvadeMode(); + return; + } + events.RepeatEvent(5000); + break; + case EVENT_PURSUE: + SayPursue(); me->CastSpell(me, SPELL_PURSUED, false); - events.RescheduleEvent(EVENT_PURSUE, 31000); - return; - case EVENT_SPEED: - me->CastSpell(me, SPELL_GATHERING_SPEED, false); - events.RepeatEvent(15000); - return; - case EVENT_MISSILE: - me->CastSpell(me, SPELL_MISSILE_BARRAGE, true); - events.RepeatEvent(4000); - return; - case EVENT_VENT: - me->CastSpell(me, SPELL_FLAME_VENTS, false); - events.RepeatEvent(20000); - return; - case EVENT_SUMMON: - if(summons.size() < 20) - if (Creature* lift = DoSummonFlyer(NPC_MECHANOLIFT, me, 30.0f, 50.0f, 0)) + events.RescheduleEvent(EVENT_PURSUE, 31000); + return; + case EVENT_SPEED: + me->CastSpell(me, SPELL_GATHERING_SPEED, false); + events.RepeatEvent(15000); + return; + case EVENT_MISSILE: + me->CastSpell(me, SPELL_MISSILE_BARRAGE, true); + events.RepeatEvent(4000); + return; + case EVENT_VENT: + me->CastSpell(me, SPELL_FLAME_VENTS, false); + events.RepeatEvent(20000); + return; + case EVENT_SUMMON: + if(summons.size() < 20) + if (Creature* lift = DoSummonFlyer(NPC_MECHANOLIFT, me, 30.0f, 50.0f, 0)) lift->GetMotionMaster()->MoveRandom(100); - events.RepeatEvent(4000); - return; - case EVENT_SOUND_BEGINNING: - if (_towersCount) - { - me->MonsterYell("Orbital countermeasures enabled.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_HARD_MODE); - } - else - { - me->MonsterYell("Alert! Static defense system failure. Orbital countermeasures disabled.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_TOWER_0); - } - events.PopEvent(); - return; - case EVENT_REINSTALL: - events.PopEvent(); - for (uint8 i = RAID_MODE(0, 2); i < 4; ++i) - if (Unit* seat = vehicle->GetPassenger(i)) - if (seat->GetTypeId() == TYPEID_UNIT) - seat->ToCreature()->AI()->EnterEvadeMode(); - me->MonsterTextEmote("Flame Leviathan reactivated. Resumming combat functions.", 0, true); - return; - case EVENT_THORIMS_HAMMER: - SummonTowerHelpers(TOWER_OF_STORMS); - events.RepeatEvent(60000+rand()%60000); - me->MonsterTextEmote("Flame Leviathan activates Thorim's Hammer.", 0, true); - me->MonsterYell("'Thorim's Hammer' online. Acquiring target.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_TOWER_4); - return; - case EVENT_FREYA: - SummonTowerHelpers(TOWER_OF_LIFE); - events.PopEvent(); - me->MonsterTextEmote("Flame Leviathan activates Freya's Ward.", 0, true); - me->MonsterYell("'Freya's Ward' online. Acquiring target.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_TOWER_3); - return; - case EVENT_MIMIRONS_INFERNO: - SummonTowerHelpers(TOWER_OF_FLAMES); - events.PopEvent(); - me->MonsterTextEmote("Flame Leviathan activates Mimiron's Inferno.", 0, true); - me->MonsterYell("'Mimiron's Inferno' online. Acquiring target.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_TOWER_2); - return; - case EVENT_HODIRS_FURY: - SummonTowerHelpers(TOWER_OF_FROST); - events.PopEvent(); - me->MonsterTextEmote("Flame Leviathan activates Hodir's Fury.", 0, true); - me->MonsterYell("'Hodir's Fury' online. Acquiring target.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_TOWER_1); - return; - } + events.RepeatEvent(4000); + return; + case EVENT_SOUND_BEGINNING: + if (_towersCount) + { + me->MonsterYell("Orbital countermeasures enabled.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_HARD_MODE); + } + else + { + me->MonsterYell("Alert! Static defense system failure. Orbital countermeasures disabled.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_TOWER_0); + } + events.PopEvent(); + return; + case EVENT_REINSTALL: + events.PopEvent(); + for (uint8 i = RAID_MODE(0, 2); i < 4; ++i) + if (Unit* seat = vehicle->GetPassenger(i)) + if (seat->GetTypeId() == TYPEID_UNIT) + seat->ToCreature()->AI()->EnterEvadeMode(); + me->MonsterTextEmote("Flame Leviathan reactivated. Resumming combat functions.", 0, true); + return; + case EVENT_THORIMS_HAMMER: + SummonTowerHelpers(TOWER_OF_STORMS); + events.RepeatEvent(60000+rand()%60000); + me->MonsterTextEmote("Flame Leviathan activates Thorim's Hammer.", 0, true); + me->MonsterYell("'Thorim's Hammer' online. Acquiring target.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_TOWER_4); + return; + case EVENT_FREYA: + SummonTowerHelpers(TOWER_OF_LIFE); + events.PopEvent(); + me->MonsterTextEmote("Flame Leviathan activates Freya's Ward.", 0, true); + me->MonsterYell("'Freya's Ward' online. Acquiring target.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_TOWER_3); + return; + case EVENT_MIMIRONS_INFERNO: + SummonTowerHelpers(TOWER_OF_FLAMES); + events.PopEvent(); + me->MonsterTextEmote("Flame Leviathan activates Mimiron's Inferno.", 0, true); + me->MonsterYell("'Mimiron's Inferno' online. Acquiring target.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_TOWER_2); + return; + case EVENT_HODIRS_FURY: + SummonTowerHelpers(TOWER_OF_FROST); + events.PopEvent(); + me->MonsterTextEmote("Flame Leviathan activates Hodir's Fury.", 0, true); + me->MonsterYell("'Hodir's Fury' online. Acquiring target.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_TOWER_1); + return; + } - if(me->isAttackReady() && !me->HasUnitState(UNIT_STATE_STUNNED)) - { - if(me->IsWithinCombatRange(me->GetVictim(), 15.0f)) - { - me->CastSpell(me->GetVictim(), SPELL_BATTERING_RAM, false); - me->resetAttackTimer(); - } - } - } - }; + if(me->isAttackReady() && !me->HasUnitState(UNIT_STATE_STUNNED)) + { + if(me->IsWithinCombatRange(me->GetVictim(), 15.0f)) + { + me->CastSpell(me->GetVictim(), SPELL_BATTERING_RAM, false); + me->resetAttackTimer(); + } + } + } + }; }; void boss_flame_leviathan::boss_flame_leviathanAI::BindPlayers() { - me->GetMap()->ToInstanceMap()->PermBindAllPlayers(); + me->GetMap()->ToInstanceMap()->PermBindAllPlayers(); } void boss_flame_leviathan::boss_flame_leviathanAI::RadioSay(const char* text, uint32 soundId) { - if (Creature *r = me->SummonCreature(NPC_BRANN_RADIO, me->GetPositionX()-150, me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 5000)) - { - WorldPacket data; - ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, r, NULL, text); - r->SendMessageToSetInRange(&data, 200, true); - r->PlayDirectSound(soundId); - } + if (Creature *r = me->SummonCreature(NPC_BRANN_RADIO, me->GetPositionX()-150, me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 5000)) + { + WorldPacket data; + ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, r, NULL, text); + r->SendMessageToSetInRange(&data, 200, true); + r->PlayDirectSound(soundId); + } } void boss_flame_leviathan::boss_flame_leviathanAI::ActivateTowers() { - _towersCount = 0; - me->ResetLootMode(); - for (uint32 i = EVENT_TOWER_OF_LIFE_DESTROYED; i <= EVENT_TOWER_OF_FLAMES_DESTROYED; ++i) - { - if (m_pInstance->GetData(i)) - { - ++_towersCount; + _towersCount = 0; + me->ResetLootMode(); + for (uint32 i = EVENT_TOWER_OF_LIFE_DESTROYED; i <= EVENT_TOWER_OF_FLAMES_DESTROYED; ++i) + { + if (m_pInstance->GetData(i)) + { + ++_towersCount; - me->AddLootMode(1<<_towersCount); - switch (i) - { - case EVENT_TOWER_OF_LIFE_DESTROYED: - me->AddAura(SPELL_TOWER_OF_LIFE, me); - events.RescheduleEvent(EVENT_FREYA, 30000); - break; - case EVENT_TOWER_OF_STORM_DESTROYED: - me->AddAura(SPELL_TOWER_OF_STORMS, me); - events.RescheduleEvent(EVENT_THORIMS_HAMMER, 60000); - break; - case EVENT_TOWER_OF_FROST_DESTROYED: - me->AddAura(SPELL_TOWER_OF_FROST, me); - events.RescheduleEvent(EVENT_HODIRS_FURY, 20000); - break; - case EVENT_TOWER_OF_FLAMES_DESTROYED: - me->AddAura(SPELL_TOWER_OF_FLAMES, me); - events.RescheduleEvent(EVENT_MIMIRONS_INFERNO, 42000); - break; - } - } - } + me->AddLootMode(1<<_towersCount); + switch (i) + { + case EVENT_TOWER_OF_LIFE_DESTROYED: + me->AddAura(SPELL_TOWER_OF_LIFE, me); + events.RescheduleEvent(EVENT_FREYA, 30000); + break; + case EVENT_TOWER_OF_STORM_DESTROYED: + me->AddAura(SPELL_TOWER_OF_STORMS, me); + events.RescheduleEvent(EVENT_THORIMS_HAMMER, 60000); + break; + case EVENT_TOWER_OF_FROST_DESTROYED: + me->AddAura(SPELL_TOWER_OF_FROST, me); + events.RescheduleEvent(EVENT_HODIRS_FURY, 20000); + break; + case EVENT_TOWER_OF_FLAMES_DESTROYED: + me->AddAura(SPELL_TOWER_OF_FLAMES, me); + events.RescheduleEvent(EVENT_MIMIRONS_INFERNO, 42000); + break; + } + } + } } void boss_flame_leviathan::boss_flame_leviathanAI::TurnGates(bool _start, bool _death) { - if (!m_pInstance) - return; + if (!m_pInstance) + return; - if (_start) - { - // first one is ALWAYS turned on, unless leviathan is beaten - GameObject* go = NULL; - if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_LIGHTNING_WALL2))) - go->SetGoState(GO_STATE_READY); + if (_start) + { + // first one is ALWAYS turned on, unless leviathan is beaten + GameObject* go = NULL; + if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_LIGHTNING_WALL2))) + go->SetGoState(GO_STATE_READY); - if (m_pInstance->GetData(TYPE_LEVIATHAN) == NOT_STARTED) - if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_LEVIATHAN_DOORS))) - go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - } - else - { - GameObject* go = NULL; - if (_death) - if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_LIGHTNING_WALL1))) - go->SetGoState(GO_STATE_ACTIVE); + if (m_pInstance->GetData(TYPE_LEVIATHAN) == NOT_STARTED) + if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_LEVIATHAN_DOORS))) + go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + } + else + { + GameObject* go = NULL; + if (_death) + if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_LIGHTNING_WALL1))) + go->SetGoState(GO_STATE_ACTIVE); - if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_LIGHTNING_WALL2))) - go->SetGoState(GO_STATE_ACTIVE); + if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_LIGHTNING_WALL2))) + go->SetGoState(GO_STATE_ACTIVE); - if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_LEVIATHAN_DOORS))) - { - if (m_pInstance->GetData(TYPE_LEVIATHAN) == SPECIAL || m_pInstance->GetData(TYPE_LEVIATHAN) == DONE) - go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - else - go->SetGoState(GO_STATE_READY); - } - } + if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_LEVIATHAN_DOORS))) + { + if (m_pInstance->GetData(TYPE_LEVIATHAN) == SPECIAL || m_pInstance->GetData(TYPE_LEVIATHAN) == DONE) + go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + else + go->SetGoState(GO_STATE_READY); + } + } } void boss_flame_leviathan::boss_flame_leviathanAI::TurnHealStations(bool _apply) { - if (!m_pInstance) - return; + if (!m_pInstance) + return; - GameObject* go = NULL; - if (_apply) - { - if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_REPAIR_STATION1))) - go->SetLootState(GO_READY); - if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_REPAIR_STATION2))) - go->SetLootState(GO_READY); - } - else - { - if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_REPAIR_STATION1))) - go->SetLootState(GO_ACTIVATED); - if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_REPAIR_STATION2))) - go->SetLootState(GO_ACTIVATED); - } + GameObject* go = NULL; + if (_apply) + { + if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_REPAIR_STATION1))) + go->SetLootState(GO_READY); + if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_REPAIR_STATION2))) + go->SetLootState(GO_READY); + } + else + { + if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_REPAIR_STATION1))) + go->SetLootState(GO_ACTIVATED); + if (go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(DATA_REPAIR_STATION2))) + go->SetLootState(GO_ACTIVATED); + } } void boss_flame_leviathan::boss_flame_leviathanAI::ScheduleEvents() { - events.RescheduleEvent(EVENT_MISSILE, 5000); - events.RescheduleEvent(EVENT_VENT, 20000); - events.RescheduleEvent(EVENT_SPEED, 15000); - events.RescheduleEvent(EVENT_SUMMON, 10000); - events.RescheduleEvent(EVENT_SOUND_BEGINNING, 10000); - events.RescheduleEvent(EVENT_POSITION_CHECK, 5000); + events.RescheduleEvent(EVENT_MISSILE, 5000); + events.RescheduleEvent(EVENT_VENT, 20000); + events.RescheduleEvent(EVENT_SPEED, 15000); + events.RescheduleEvent(EVENT_SUMMON, 10000); + events.RescheduleEvent(EVENT_SOUND_BEGINNING, 10000); + events.RescheduleEvent(EVENT_POSITION_CHECK, 5000); - events.RescheduleEvent(EVENT_PURSUE, 0); + events.RescheduleEvent(EVENT_PURSUE, 0); } void boss_flame_leviathan::boss_flame_leviathanAI::SayPursue() { - if (urand(0,1)) - return; + if (urand(0,1)) + return; - switch (urand(0,2)) - { - case 0: - me->MonsterYell("Threat re-evaluated. Target assessment complete. Changing course.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_TARGET1); - break; - case 1: - me->MonsterYell("Pursuit objective modified. Changing course.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_TARGET2); - break; - case 2: - me->MonsterYell("Hostile entity stratagem predicted. Rerouting battle function. Changing course.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_TARGET3); - break; - } + switch (urand(0,2)) + { + case 0: + me->MonsterYell("Threat re-evaluated. Target assessment complete. Changing course.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_TARGET1); + break; + case 1: + me->MonsterYell("Pursuit objective modified. Changing course.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_TARGET2); + break; + case 2: + me->MonsterYell("Hostile entity stratagem predicted. Rerouting battle function. Changing course.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_TARGET3); + break; + } } void boss_flame_leviathan::boss_flame_leviathanAI::SpellHit(Unit* caster, const SpellInfo* spellInfo) { - if (spellInfo->Id == SPELL_SYSTEMS_SHUTDOWN) - { - _shutdown = true; // ACHIEVEMENT + if (spellInfo->Id == SPELL_SYSTEMS_SHUTDOWN) + { + _shutdown = true; // ACHIEVEMENT - me->MonsterTextEmote("Flame Leviathan's circuits overloaded.", 0, true); - me->MonsterTextEmote("Automatic repair sequence initiated.", 0, true); + me->MonsterTextEmote("Flame Leviathan's circuits overloaded.", 0, true); + me->MonsterTextEmote("Automatic repair sequence initiated.", 0, true); - switch (urand(0,2)) - { - case 0: - me->MonsterYell("System malfunction. Diverting power to support systems.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_OVERLOAD1); - break; - case 1: - me->MonsterYell("Combat matrix overload. Powering do-o-o-own...", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_OVERLOAD2); - break; - case 2: - me->MonsterYell("System restart required. Deactivating weapon systems.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_OVERLOAD3); - break; - } + switch (urand(0,2)) + { + case 0: + me->MonsterYell("System malfunction. Diverting power to support systems.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_OVERLOAD1); + break; + case 1: + me->MonsterYell("Combat matrix overload. Powering do-o-o-own...", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_OVERLOAD2); + break; + case 2: + me->MonsterYell("System restart required. Deactivating weapon systems.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_OVERLOAD3); + break; + } - events.DelayEvents(20 * IN_MILLISECONDS + 1); - events.ScheduleEvent(EVENT_REINSTALL, 20*IN_MILLISECONDS); - } - else if (spellInfo->Id == 62522 /*SPELL_ELECTROSHOCK*/) - me->InterruptNonMeleeSpells(false); + events.DelayEvents(20 * IN_MILLISECONDS + 1); + events.ScheduleEvent(EVENT_REINSTALL, 20*IN_MILLISECONDS); + } + else if (spellInfo->Id == 62522 /*SPELL_ELECTROSHOCK*/) + me->InterruptNonMeleeSpells(false); } void boss_flame_leviathan::boss_flame_leviathanAI::JustDied(Unit*) { - // Despawn Lashers, do before summons clear - summons.DoAction(ACTION_DESPAWN_ADDS); - summons.DespawnAll(); + // Despawn Lashers, do before summons clear + summons.DoAction(ACTION_DESPAWN_ADDS); + summons.DespawnAll(); - if (m_pInstance) - { - m_pInstance->SetData(TYPE_LEVIATHAN, DONE); - m_pInstance->SetData(DATA_VEHICLE_SPAWN, VEHICLE_POS_NONE); - } + if (m_pInstance) + { + m_pInstance->SetData(TYPE_LEVIATHAN, DONE); + m_pInstance->SetData(DATA_VEHICLE_SPAWN, VEHICLE_POS_NONE); + } - me->MonsterYell("Total systems failure. Defense protocols breached. Leviathan Unit shutting down.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(LV_SOUND_DIE); + me->MonsterYell("Total systems failure. Defense protocols breached. Leviathan Unit shutting down.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(LV_SOUND_DIE); - TurnGates(false, true); - BindPlayers(); + TurnGates(false, true); + BindPlayers(); } void boss_flame_leviathan::boss_flame_leviathanAI::KilledUnit(Unit* who) { - if (who == me->GetVictim()) - events.RescheduleEvent(EVENT_PURSUE, 0); + if (who == me->GetVictim()) + events.RescheduleEvent(EVENT_PURSUE, 0); } void boss_flame_leviathan::boss_flame_leviathanAI::SummonTowerHelpers(uint8 towerId) { - if (towerId == TOWER_OF_LIFE) - { - me->SummonCreature(NPC_FREYA_WARD_TARGET, 374, -141, 411, 0, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_FREYA_WARD, 374, -141, 411+40, 0, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_FREYA_WARD_TARGET, 382.9f, 74, 411.6f, 0, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_FREYA_WARD, 382.9f, 74, 411.6f+40, 0, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_FREYA_WARD_TARGET, 159.4f, 64.1f, 409.8f, 0, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_FREYA_WARD, 159.4f, 64.1f, 409.8f+40, 0, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_FREYA_WARD_TARGET, 157.7f, -140.26f, 409.8f, 0, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_FREYA_WARD, 157.7f, -140.26f, 409.8f+40, 0, TEMPSUMMON_MANUAL_DESPAWN); - } - else if (towerId == TOWER_OF_FROST) - { - me->SummonCreature(NPC_HODIRS_FURY_TARGET, 343.4f, -77.5f, 409.8f, 0, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_HODIRS_FURY_TARGET, 222, 41, 409.8f, 0, TEMPSUMMON_MANUAL_DESPAWN); - } - else if (towerId == TOWER_OF_FLAMES) - { - me->SummonCreature(NPC_MIMIRONS_INFERNO_TARGET, 364.4f, -9.7f, 409.8f, 0, TEMPSUMMON_MANUAL_DESPAWN); - //me->SummonCreature(NPC_MIMIRONS_INFERNO, 364.4f, -9.7f, 409.8f+40, 0, TEMPSUMMON_MANUAL_DESPAWN); - } - else if (towerId == TOWER_OF_STORMS) - { - for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(NPC_THORIM_HAMMER_TARGET, 157+rand()%200, -140+rand()%200, 409.8f, 0, TEMPSUMMON_TIMED_DESPAWN, 24000); - } + if (towerId == TOWER_OF_LIFE) + { + me->SummonCreature(NPC_FREYA_WARD_TARGET, 374, -141, 411, 0, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_FREYA_WARD, 374, -141, 411+40, 0, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_FREYA_WARD_TARGET, 382.9f, 74, 411.6f, 0, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_FREYA_WARD, 382.9f, 74, 411.6f+40, 0, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_FREYA_WARD_TARGET, 159.4f, 64.1f, 409.8f, 0, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_FREYA_WARD, 159.4f, 64.1f, 409.8f+40, 0, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_FREYA_WARD_TARGET, 157.7f, -140.26f, 409.8f, 0, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_FREYA_WARD, 157.7f, -140.26f, 409.8f+40, 0, TEMPSUMMON_MANUAL_DESPAWN); + } + else if (towerId == TOWER_OF_FROST) + { + me->SummonCreature(NPC_HODIRS_FURY_TARGET, 343.4f, -77.5f, 409.8f, 0, TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_HODIRS_FURY_TARGET, 222, 41, 409.8f, 0, TEMPSUMMON_MANUAL_DESPAWN); + } + else if (towerId == TOWER_OF_FLAMES) + { + me->SummonCreature(NPC_MIMIRONS_INFERNO_TARGET, 364.4f, -9.7f, 409.8f, 0, TEMPSUMMON_MANUAL_DESPAWN); + //me->SummonCreature(NPC_MIMIRONS_INFERNO, 364.4f, -9.7f, 409.8f+40, 0, TEMPSUMMON_MANUAL_DESPAWN); + } + else if (towerId == TOWER_OF_STORMS) + { + for (uint8 i = 0; i < 8; ++i) + me->SummonCreature(NPC_THORIM_HAMMER_TARGET, 157+rand()%200, -140+rand()%200, 409.8f, 0, TEMPSUMMON_TIMED_DESPAWN, 24000); + } } class boss_flame_leviathan_seat : public CreatureScript @@ -717,74 +717,74 @@ public: return new boss_flame_leviathan_seatAI (pCreature); } - struct boss_flame_leviathan_seatAI : public VehicleAI - { - boss_flame_leviathan_seatAI(Creature *creature) : VehicleAI(creature), vehicle(creature->GetVehicleKit()) - { - ASSERT(vehicle); - me->SetReactState(REACT_PASSIVE); - } + struct boss_flame_leviathan_seatAI : public VehicleAI + { + boss_flame_leviathan_seatAI(Creature *creature) : VehicleAI(creature), vehicle(creature->GetVehicleKit()) + { + ASSERT(vehicle); + me->SetReactState(REACT_PASSIVE); + } - Vehicle* vehicle; - uint32 _despawnTimer; + Vehicle* vehicle; + uint32 _despawnTimer; - void EnterEvadeMode() - { - vehicle->InstallAllAccessories(false); - } + void EnterEvadeMode() + { + vehicle->InstallAllAccessories(false); + } - void Reset() - { - _despawnTimer = !me->GetMap()->Is25ManRaid(); - } + void Reset() + { + _despawnTimer = !me->GetMap()->Is25ManRaid(); + } - void UpdateAI(uint32 diff) - { - if (_despawnTimer) - { - _despawnTimer += diff; - if (_despawnTimer >= 2000) - { - _despawnTimer = 0; - if (Vehicle* veh = me->GetVehicle()) - if (veh->GetPassenger(0) == me || veh->GetPassenger(1) == me) - me->DespawnOrUnsummon(1); - } - } + void UpdateAI(uint32 diff) + { + if (_despawnTimer) + { + _despawnTimer += diff; + if (_despawnTimer >= 2000) + { + _despawnTimer = 0; + if (Vehicle* veh = me->GetVehicle()) + if (veh->GetPassenger(0) == me || veh->GetPassenger(1) == me) + me->DespawnOrUnsummon(1); + } + } - VehicleAI::UpdateAI(diff); - } + VehicleAI::UpdateAI(diff); + } - void AttackStart(Unit*) { } + void AttackStart(Unit*) { } - void PassengerBoarded(Unit* who, int8 seatId, bool apply) - { - if (who->GetTypeId() != TYPEID_PLAYER || !me->GetVehicle()) - return; + void PassengerBoarded(Unit* who, int8 seatId, bool apply) + { + if (who->GetTypeId() != TYPEID_PLAYER || !me->GetVehicle()) + return; - who->ApplySpellImmune(63847, IMMUNITY_ID, 63847, apply); // SPELL_FLAME_VENTS_TRIGGER - who->ApplySpellImmune(SPELL_MISSILE_BARRAGE, IMMUNITY_ID, SPELL_MISSILE_BARRAGE, apply); - who->ApplySpellImmune(SPELL_BATTERING_RAM, IMMUNITY_ID, SPELL_BATTERING_RAM, apply); + who->ApplySpellImmune(63847, IMMUNITY_ID, 63847, apply); // SPELL_FLAME_VENTS_TRIGGER + who->ApplySpellImmune(SPELL_MISSILE_BARRAGE, IMMUNITY_ID, SPELL_MISSILE_BARRAGE, apply); + who->ApplySpellImmune(SPELL_BATTERING_RAM, IMMUNITY_ID, SPELL_BATTERING_RAM, apply); if (seatId == SEAT_PLAYER) { if (Unit* turret = me->GetVehicleKit()->GetPassenger(SEAT_TURRET)) { - if (apply) - { - turret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); - turret->GetAI()->AttackStart(who); - } - else - { - turret->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - if (turret->GetTypeId() == TYPEID_UNIT) - turret->ToCreature()->AI()->EnterEvadeMode(); - } + if (apply) + { + turret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); + turret->GetAI()->AttackStart(who); + } + else + { + turret->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + if (turret->GetTypeId() == TYPEID_UNIT) + turret->ToCreature()->AI()->EnterEvadeMode(); + } } } - } - }; + } + }; }; class boss_flame_leviathan_defense_turret : public CreatureScript @@ -795,28 +795,28 @@ class boss_flame_leviathan_defense_turret : public CreatureScript struct boss_flame_leviathan_defense_turretAI : public TurretAI { boss_flame_leviathan_defense_turretAI(Creature* creature) : TurretAI(creature) - { - _setHealth = false; - } + { + _setHealth = false; + } - bool _setHealth; + bool _setHealth; void DamageTaken(Unit* who, uint32 &damage, DamageEffectType, SpellSchoolMask) { if (!who || !CanAIAttack(who)) - { - _setHealth = true; + { + _setHealth = true; damage = 0; - } - } + } + } - void JustDied(Unit* who) - { - if (Player* killer = who->ToPlayer()) - killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, me); + void JustDied(Unit* who) + { + if (Player* killer = who->ToPlayer()) + killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, me); - if (Vehicle* vehicle = me->GetVehicle()) - if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) - device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable + if (Vehicle* vehicle = me->GetVehicle()) + if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) + device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable } bool CanAIAttack(Unit const* who) const @@ -826,16 +826,16 @@ class boss_flame_leviathan_defense_turret : public CreatureScript return true; } - void UpdateAI(uint32 diff) - { - if (_setHealth) - { - me->SetHealth(std::min(me->GetHealth()+1, me->GetMaxHealth())); - _setHealth = false; - } + void UpdateAI(uint32 diff) + { + if (_setHealth) + { + me->SetHealth(std::min(me->GetHealth()+1, me->GetMaxHealth())); + _setHealth = false; + } - TurretAI::UpdateAI(diff); - } + TurretAI::UpdateAI(diff); + } }; CreatureAI* GetAI(Creature* creature) const @@ -890,74 +890,74 @@ public: return new npc_freya_wardAI (pCreature); } - struct npc_freya_wardAI : public NullCreatureAI - { - npc_freya_wardAI(Creature *c) : NullCreatureAI(c), summons(c) - { - } + struct npc_freya_wardAI : public NullCreatureAI + { + npc_freya_wardAI(Creature *c) : NullCreatureAI(c), summons(c) + { + } - SummonList summons; - uint32 _castTimer; - bool _summoned; + SummonList summons; + uint32 _castTimer; + bool _summoned; - void Reset() - { - _summoned = false; - _castTimer = 25000; - summons.DespawnAll(); - if (Creature* cr = me->FindNearestCreature(NPC_FREYA_WARD_TARGET, 60.0f, true)) - if (Aura* aur = cr->AddAura(SPELL_FREYA_DUMMY_GREEN, cr)) - { - aur->SetMaxDuration(-1); - aur->SetDuration(-1); - } - } + void Reset() + { + _summoned = false; + _castTimer = 25000; + summons.DespawnAll(); + if (Creature* cr = me->FindNearestCreature(NPC_FREYA_WARD_TARGET, 60.0f, true)) + if (Aura* aur = cr->AddAura(SPELL_FREYA_DUMMY_GREEN, cr)) + { + aur->SetMaxDuration(-1); + aur->SetDuration(-1); + } + } - void JustSummoned(Creature* cr) - { - _summoned = true; - summons.Summon(cr); - } + void JustSummoned(Creature* cr) + { + _summoned = true; + summons.Summon(cr); + } - void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } + void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } - void UpdateAI(uint32 diff) - { - if (_summoned) - { - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end();) - { - Creature* summon = ObjectAccessor::GetCreature(*me, *itr); - ++itr; - if (summon) - { - summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); - if (Unit* target = summon->SelectNearestTarget(200.0f)) - summon->AI()->AttackStart(target); - } - } - _summoned = false; - } + void UpdateAI(uint32 diff) + { + if (_summoned) + { + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end();) + { + Creature* summon = ObjectAccessor::GetCreature(*me, *itr); + ++itr; + if (summon) + { + summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_MANUAL_DESPAWN); + if (Unit* target = summon->SelectNearestTarget(200.0f)) + summon->AI()->AttackStart(target); + } + } + _summoned = false; + } - _castTimer += diff; - if (_castTimer >= 29*IN_MILLISECONDS) - { - if (Creature* cr = me->FindNearestCreature(NPC_FREYA_WARD_TARGET, 60.0f, true)) - { - me->CastSpell(cr, SPELL_FREYA_WARD, false); - me->CastSpell(cr, 62947 /*SPELL_FREYA_WARD_SECOND_SUMMON*/, false); - } + _castTimer += diff; + if (_castTimer >= 29*IN_MILLISECONDS) + { + if (Creature* cr = me->FindNearestCreature(NPC_FREYA_WARD_TARGET, 60.0f, true)) + { + me->CastSpell(cr, SPELL_FREYA_WARD, false); + me->CastSpell(cr, 62947 /*SPELL_FREYA_WARD_SECOND_SUMMON*/, false); + } - _castTimer = 0; - } - } - - void DoAction(int32 param) - { - if (param == ACTION_DESPAWN_ADDS) - summons.DespawnAll(); - } - }; + _castTimer = 0; + } + } + + void DoAction(int32 param) + { + if (param == ACTION_DESPAWN_ADDS) + summons.DespawnAll(); + } + }; }; class npc_hodirs_fury : public CreatureScript @@ -970,73 +970,73 @@ public: return new npc_hodirs_furyAI (pCreature); } - struct npc_hodirs_furyAI : public NullCreatureAI - { - npc_hodirs_furyAI(Creature *c) : NullCreatureAI(c) - { - } + struct npc_hodirs_furyAI : public NullCreatureAI + { + npc_hodirs_furyAI(Creature *c) : NullCreatureAI(c) + { + } - uint32 _timeToHit; - uint32 _switchTargetTimer; + uint32 _timeToHit; + uint32 _switchTargetTimer; - void Reset() - { - _timeToHit = 0; - _switchTargetTimer = 30000; - me->SetWalk(true); + void Reset() + { + _timeToHit = 0; + _switchTargetTimer = 30000; + me->SetWalk(true); - if (Aura* aur = me->AddAura(SPELL_FREYA_DUMMY_BLUE, me)) - { - aur->SetMaxDuration(-1); - aur->SetDuration(-1); - } - } + if (Aura* aur = me->AddAura(SPELL_FREYA_DUMMY_BLUE, me)) + { + aur->SetMaxDuration(-1); + aur->SetDuration(-1); + } + } - void MovementInform(uint32 type, uint32 param) - { - if (type == FOLLOW_MOTION_TYPE && !_timeToHit) - { - _timeToHit = 1; - _switchTargetTimer = 0; - me->SetControlled(true, UNIT_STATE_STUNNED); - } - } + void MovementInform(uint32 type, uint32 param) + { + if (type == FOLLOW_MOTION_TYPE && !_timeToHit) + { + _timeToHit = 1; + _switchTargetTimer = 0; + me->SetControlled(true, UNIT_STATE_STUNNED); + } + } - void UpdateAI(uint32 diff) - { - if (_timeToHit) - { - _timeToHit += diff; - if (_timeToHit >= 5000) - { - if (Creature* cr = me->SummonCreature(NPC_HODIRS_FURY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+40, 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) - cr->CastSpell(me, SPELL_HODIRS_FURY, true); + void UpdateAI(uint32 diff) + { + if (_timeToHit) + { + _timeToHit += diff; + if (_timeToHit >= 5000) + { + if (Creature* cr = me->SummonCreature(NPC_HODIRS_FURY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+40, 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) + cr->CastSpell(me, SPELL_HODIRS_FURY, true); - _switchTargetTimer = 25000; // Switch target soon - _timeToHit = 0; - } - return; - } + _switchTargetTimer = 25000; // Switch target soon + _timeToHit = 0; + } + return; + } - _switchTargetTimer += diff; - if (_switchTargetTimer >= 30000) - { - if(Unit* target = me->SelectNearbyTarget(NULL, 200.0f)) - { - if (target->GetVehicleBase() && target->GetVehicleBase()->GetEntry() == NPC_SEAT) - { - _switchTargetTimer = 20000; - return; - } - me->SetControlled(false, UNIT_STATE_STUNNED); - me->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f); - _switchTargetTimer = 0; - } - else - _switchTargetTimer = 25000; - } - } - }; + _switchTargetTimer += diff; + if (_switchTargetTimer >= 30000) + { + if(Unit* target = me->SelectNearbyTarget(NULL, 200.0f)) + { + if (target->GetVehicleBase() && target->GetVehicleBase()->GetEntry() == NPC_SEAT) + { + _switchTargetTimer = 20000; + return; + } + me->SetControlled(false, UNIT_STATE_STUNNED); + me->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f); + _switchTargetTimer = 0; + } + else + _switchTargetTimer = 25000; + } + } + }; }; class npc_mimirons_inferno : public CreatureScript @@ -1056,47 +1056,47 @@ public: me->SetReactState(REACT_PASSIVE); } - SummonList summons; - uint32 _spellTimer; - uint32 _recastTimer; + SummonList summons; + uint32 _spellTimer; + uint32 _recastTimer; - void AttackStart(Unit*) { } - void MoveInLineOfSight(Unit*) { } + void AttackStart(Unit*) { } + void MoveInLineOfSight(Unit*) { } void WaypointReached(uint32 /*waypointId*/) { } - void DoAction(int32 param) - { - if (param == ACTION_DESPAWN_ADDS) - summons.DespawnAll(); - } + void DoAction(int32 param) + { + if (param == ACTION_DESPAWN_ADDS) + summons.DespawnAll(); + } void Reset() { - summons.DespawnAll(); + summons.DespawnAll(); _spellTimer = 0; - Start(false, false, 0, NULL, false, true); - if (Aura* aur = me->AddAura(SPELL_FREYA_DUMMY_YELLOW, me)) - { - aur->SetMaxDuration(-1); - aur->SetDuration(-1); - } + Start(false, false, 0, NULL, false, true); + if (Aura* aur = me->AddAura(SPELL_FREYA_DUMMY_YELLOW, me)) + { + aur->SetMaxDuration(-1); + aur->SetDuration(-1); + } } - void JustSummoned(Creature* cr) { summons.Summon(cr); } - void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } + void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } void UpdateAI(uint32 diff) { npc_escortAI::UpdateAI(diff); - _spellTimer += diff; - if (_spellTimer >= 2000) - { - if (Creature* cr = me->SummonCreature(NPC_MIMIRONS_INFERNO, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+40.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 30000)) - cr->CastSpell(me, SPELL_MIMIRONS_INFERNO, true); + _spellTimer += diff; + if (_spellTimer >= 2000) + { + if (Creature* cr = me->SummonCreature(NPC_MIMIRONS_INFERNO, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+40.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 30000)) + cr->CastSpell(me, SPELL_MIMIRONS_INFERNO, true); - _spellTimer = 0; - } + _spellTimer = 0; + } } }; @@ -1112,50 +1112,50 @@ public: return new npc_thorims_hammerAI (pCreature); } - struct npc_thorims_hammerAI : public NullCreatureAI - { - npc_thorims_hammerAI(Creature *c) : NullCreatureAI(c) - { - } + struct npc_thorims_hammerAI : public NullCreatureAI + { + npc_thorims_hammerAI(Creature *c) : NullCreatureAI(c) + { + } - uint32 _beamTimer; - uint32 _finishTime; - uint32 _removeTimer; + uint32 _beamTimer; + uint32 _finishTime; + uint32 _removeTimer; - void Reset() - { - _finishTime = 5000+rand()%15000; - _beamTimer = 1; - _removeTimer = 0; - me->CastSpell(me, SPELL_FREYA_DUMMY_BLUE, true); - } + void Reset() + { + _finishTime = 5000+rand()%15000; + _beamTimer = 1; + _removeTimer = 0; + me->CastSpell(me, SPELL_FREYA_DUMMY_BLUE, true); + } - void UpdateAI(uint32 diff) - { - if (_beamTimer) - { - _beamTimer += diff; - if (_beamTimer >= _finishTime) - { - if (Creature* cr = me->SummonCreature(NPC_THORIM_HAMMER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+40, 0, TEMPSUMMON_TIMED_DESPAWN, 5000)) - cr->CastSpell(me, SPELL_THORIMS_HAMMER, false); + void UpdateAI(uint32 diff) + { + if (_beamTimer) + { + _beamTimer += diff; + if (_beamTimer >= _finishTime) + { + if (Creature* cr = me->SummonCreature(NPC_THORIM_HAMMER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+40, 0, TEMPSUMMON_TIMED_DESPAWN, 5000)) + cr->CastSpell(me, SPELL_THORIMS_HAMMER, false); - _beamTimer = 0; - _removeTimer = 1; - me->DespawnOrUnsummon(5*IN_MILLISECONDS); - } - } - if (_removeTimer) - { - _removeTimer += diff; - if (_removeTimer >= 3*IN_MILLISECONDS) - { - _removeTimer = 0; - me->RemoveAura(SPELL_FREYA_DUMMY_BLUE); - } - } - } - }; + _beamTimer = 0; + _removeTimer = 1; + me->DespawnOrUnsummon(5*IN_MILLISECONDS); + } + } + if (_removeTimer) + { + _removeTimer += diff; + if (_removeTimer >= 3*IN_MILLISECONDS) + { + _removeTimer = 0; + me->RemoveAura(SPELL_FREYA_DUMMY_BLUE); + } + } + } + }; }; class npc_pool_of_tar : public CreatureScript @@ -1168,23 +1168,23 @@ public: return new npc_pool_of_tarAI (pCreature); } - struct npc_pool_of_tarAI : public NullCreatureAI - { - npc_pool_of_tarAI(Creature *c) : NullCreatureAI(c) - { - } + struct npc_pool_of_tarAI : public NullCreatureAI + { + npc_pool_of_tarAI(Creature *c) : NullCreatureAI(c) + { + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - damage = 0; - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + damage = 0; + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE)) - me->CastSpell(me, SPELL_BLAZE, true); - } - }; + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE)) + me->CastSpell(me, SPELL_BLAZE, true); + } + }; }; class npc_lore_keeper_of_norgannon_ulduar : public CreatureScript @@ -1192,178 +1192,178 @@ class npc_lore_keeper_of_norgannon_ulduar : public CreatureScript public: npc_lore_keeper_of_norgannon_ulduar() : CreatureScript("npc_lore_keeper_of_norgannon_ulduar") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->GetInstanceScript() && creature->GetInstanceScript()->GetData(TYPE_LEVIATHAN) == NOT_STARTED && !creature->AI()->GetData(DATA_EVENT_STARTED)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Activate secondary defensive systems.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + bool OnGossipHello(Player* player, Creature* creature) + { + if (creature->GetInstanceScript() && creature->GetInstanceScript()->GetData(TYPE_LEVIATHAN) == NOT_STARTED && !creature->AI()->GetData(DATA_EVENT_STARTED)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Activate secondary defensive systems.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); - return true; - } + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) - { - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - creature->MonsterSay("Activating secondary defensive systems will result in the extermination of unauthorized life forms via orbital emplacements. You are an unauthorized life form.", LANG_UNIVERSAL, 0); - player->PlayerTalkClass->ClearMenus(); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Confirmed.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - creature->MonsterSay("Security override permitted. Secondary defensive systems activated. Backup deactivation for secondary systems can be accessed via individual generators located on the concourse. ", LANG_UNIVERSAL, 0); - creature->AI()->DoAction(ACTION_START_NORGANNON_EVENT); + bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + creature->MonsterSay("Activating secondary defensive systems will result in the extermination of unauthorized life forms via orbital emplacements. You are an unauthorized life form.", LANG_UNIVERSAL, 0); + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Confirmed.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + creature->MonsterSay("Security override permitted. Secondary defensive systems activated. Backup deactivation for secondary systems can be accessed via individual generators located on the concourse. ", LANG_UNIVERSAL, 0); + creature->AI()->DoAction(ACTION_START_NORGANNON_EVENT); - player->CLOSE_GOSSIP_MENU(); - } - return true; - } + player->CLOSE_GOSSIP_MENU(); + } + return true; + } CreatureAI* GetAI(Creature* pCreature) const { return new npc_lore_keeper_of_norgannon_ulduarAI (pCreature); } - struct npc_lore_keeper_of_norgannon_ulduarAI : public ScriptedAI - { - npc_lore_keeper_of_norgannon_ulduarAI(Creature* c) : ScriptedAI(c) - { - _eventStarted = false; - } + struct npc_lore_keeper_of_norgannon_ulduarAI : public ScriptedAI + { + npc_lore_keeper_of_norgannon_ulduarAI(Creature* c) : ScriptedAI(c) + { + _eventStarted = false; + } - bool _eventStarted; - bool _running; - int32 _checkTimer; - uint8 _step; - uint64 _dellorahGUID; + bool _eventStarted; + bool _running; + int32 _checkTimer; + uint8 _step; + uint64 _dellorahGUID; - uint32 GetData(uint32 param) const - { - if (param == DATA_EVENT_STARTED) - return _eventStarted; - return 0; - } + uint32 GetData(uint32 param) const + { + if (param == DATA_EVENT_STARTED) + return _eventStarted; + return 0; + } - void Reset() - { - _running = false; - _checkTimer = 0; - _step = 0; - _dellorahGUID = 0; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } + void Reset() + { + _running = false; + _checkTimer = 0; + _step = 0; + _dellorahGUID = 0; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } - void NextStep(const uint32 time) - { - ++_step; - _checkTimer = time; - } + void NextStep(const uint32 time) + { + ++_step; + _checkTimer = time; + } - void Say(std::string text, bool self) - { - if (self) - me->MonsterSay(text.c_str(), LANG_UNIVERSAL, 0); - else if (Creature* c = ObjectAccessor::GetCreature(*me, _dellorahGUID)) - c->MonsterSay(text.c_str(), LANG_UNIVERSAL, 0); - } + void Say(std::string text, bool self) + { + if (self) + me->MonsterSay(text.c_str(), LANG_UNIVERSAL, 0); + else if (Creature* c = ObjectAccessor::GetCreature(*me, _dellorahGUID)) + c->MonsterSay(text.c_str(), LANG_UNIVERSAL, 0); + } - void UpdateAI(uint32 diff) - { - if (_running) - { - if (_checkTimer != 0) - { - _checkTimer -= diff; - if (_checkTimer < 0 ) - _checkTimer = 0; - } - else - switch (_step) - { - case 0: - NextStep(14000); - break; - case 1: - Say("I heard a story or two of a Lore Keeper in Uldaman that fit your description. Do you serve a similar purpose?", false); - NextStep(10000); - break; - case 2: - Say("I was constructed to serve as a repository for essential information regarding this complex. My primary functions include communicating the status of the frontal defense systems and assessing the status of the entity that this complex was built to imprison.", true); - NextStep(14000); - break; - case 3: - Say("Frontal defense systems? Is there something I should let Brann know before he has anyone attempt to enter the complex?", false); - NextStep(11000); - break; - case 4: - Say("Access to the interior of the complex is currently restricted. Primary defensive emplacements are active. Secondary systems are currently non-active.", true); - NextStep(12000); - break; - case 5: - Say("Can you detail the nature of these defense systems?", false); - NextStep(8000); - break; - case 6: - Say("Compromise of complex detected, security override enabled - query permitted.", true); - NextStep(7000); - break; - case 7: - Say("Primary defensive emplacements consist of iron constructs and Storm Beacons, which will generate additional constructs as necessary. Secondary systems consist of orbital defense emplacements.", true); - NextStep(11000); - break; - case 8: - Say("Got it. At least we don't have to deal with those orbital emplacements.", false); - NextStep(7000); - break; - case 9: - Say("Rhydian, make sure you let Brann and Archmage Pentarus know about those defenses immediately.", false); - NextStep(7000); - break; - case 10: - if (Creature* c = me->FindNearestCreature(NPC_ARCHMAGE_RHYDIAN, 15.0f)) - { - c->MonsterTextEmote("Archmage Rhydian Nods.", 0, false); - c->GetMotionMaster()->MovePoint(0, -720.6f, -61.7f, 429.84f); - } - Say("And you mentioned an imprisoned entity? What is the nature of this entity and what is its status?", false); - NextStep(6000); - break; - case 11: - Say("Entity designate: Yogg-Saron. Security has been compromised. Prison operational status unknown. Unable to contact Watchers for notification purposes.", true); - NextStep(9000); - break; - case 12: - Say("Yogg-Saron is here? It sounds like we really will have our hands full then.", false); - - if (Creature* c = me->FindNearestCreature(NPC_START_BRANN_BRONZEBEARD, 110.0f, true) ) - c->AI()->DoAction(ACTION_START_NORGANNON_BRANN); + void UpdateAI(uint32 diff) + { + if (_running) + { + if (_checkTimer != 0) + { + _checkTimer -= diff; + if (_checkTimer < 0 ) + _checkTimer = 0; + } + else + switch (_step) + { + case 0: + NextStep(14000); + break; + case 1: + Say("I heard a story or two of a Lore Keeper in Uldaman that fit your description. Do you serve a similar purpose?", false); + NextStep(10000); + break; + case 2: + Say("I was constructed to serve as a repository for essential information regarding this complex. My primary functions include communicating the status of the frontal defense systems and assessing the status of the entity that this complex was built to imprison.", true); + NextStep(14000); + break; + case 3: + Say("Frontal defense systems? Is there something I should let Brann know before he has anyone attempt to enter the complex?", false); + NextStep(11000); + break; + case 4: + Say("Access to the interior of the complex is currently restricted. Primary defensive emplacements are active. Secondary systems are currently non-active.", true); + NextStep(12000); + break; + case 5: + Say("Can you detail the nature of these defense systems?", false); + NextStep(8000); + break; + case 6: + Say("Compromise of complex detected, security override enabled - query permitted.", true); + NextStep(7000); + break; + case 7: + Say("Primary defensive emplacements consist of iron constructs and Storm Beacons, which will generate additional constructs as necessary. Secondary systems consist of orbital defense emplacements.", true); + NextStep(11000); + break; + case 8: + Say("Got it. At least we don't have to deal with those orbital emplacements.", false); + NextStep(7000); + break; + case 9: + Say("Rhydian, make sure you let Brann and Archmage Pentarus know about those defenses immediately.", false); + NextStep(7000); + break; + case 10: + if (Creature* c = me->FindNearestCreature(NPC_ARCHMAGE_RHYDIAN, 15.0f)) + { + c->MonsterTextEmote("Archmage Rhydian Nods.", 0, false); + c->GetMotionMaster()->MovePoint(0, -720.6f, -61.7f, 429.84f); + } + Say("And you mentioned an imprisoned entity? What is the nature of this entity and what is its status?", false); + NextStep(6000); + break; + case 11: + Say("Entity designate: Yogg-Saron. Security has been compromised. Prison operational status unknown. Unable to contact Watchers for notification purposes.", true); + NextStep(9000); + break; + case 12: + Say("Yogg-Saron is here? It sounds like we really will have our hands full then.", false); + + if (Creature* c = me->FindNearestCreature(NPC_START_BRANN_BRONZEBEARD, 110.0f, true) ) + c->AI()->DoAction(ACTION_START_NORGANNON_BRANN); - _running = false; - _checkTimer = 0; - _step = 0; - _dellorahGUID = 0; - return; - } - } - } + _running = false; + _checkTimer = 0; + _step = 0; + _dellorahGUID = 0; + return; + } + } + } - void DoAction(int32 param) - { - if (_eventStarted) - return; + void DoAction(int32 param) + { + if (_eventStarted) + return; - if (param == ACTION_START_NORGANNON_EVENT) - { - if (Creature* cr = me->FindNearestCreature(NPC_HIGH_EXPLORER_DELLORAH, 20.0f, true)) - _dellorahGUID = cr->GetGUID(); + if (param == ACTION_START_NORGANNON_EVENT) + { + if (Creature* cr = me->FindNearestCreature(NPC_HIGH_EXPLORER_DELLORAH, 20.0f, true)) + _dellorahGUID = cr->GetGUID(); - _eventStarted = true; - _running = true; - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - } - }; + _eventStarted = true; + _running = true; + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + } + }; }; class npc_brann_ulduar : public CreatureScript @@ -1371,131 +1371,131 @@ class npc_brann_ulduar : public CreatureScript public: npc_brann_ulduar() : CreatureScript("npc_brann_ulduar") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->GetInstanceScript() && creature->GetInstanceScript()->GetData(TYPE_LEVIATHAN) == NOT_STARTED && !creature->AI()->GetData(DATA_EVENT_STARTED)) - creature->AI()->DoAction(ACTION_START_BRANN_EVENT); - return true; - } + bool OnGossipHello(Player* player, Creature* creature) + { + if (creature->GetInstanceScript() && creature->GetInstanceScript()->GetData(TYPE_LEVIATHAN) == NOT_STARTED && !creature->AI()->GetData(DATA_EVENT_STARTED)) + creature->AI()->DoAction(ACTION_START_BRANN_EVENT); + return true; + } CreatureAI* GetAI(Creature* pCreature) const { return new npc_brann_ulduarAI (pCreature); } - struct npc_brann_ulduarAI : public ScriptedAI - { - npc_brann_ulduarAI(Creature* c) : ScriptedAI(c) - { - _eventStarted = false; - Reset(); - } + struct npc_brann_ulduarAI : public ScriptedAI + { + npc_brann_ulduarAI(Creature* c) : ScriptedAI(c) + { + _eventStarted = false; + Reset(); + } - bool _eventStarted; - bool _running; - int32 _checkTimer; - uint8 _step; - uint64 _pentarusGUID; + bool _eventStarted; + bool _running; + int32 _checkTimer; + uint8 _step; + uint64 _pentarusGUID; - void Reset() - { - _running = false; - _checkTimer = 0; - _step = 0; - _pentarusGUID = 0; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } + void Reset() + { + _running = false; + _checkTimer = 0; + _step = 0; + _pentarusGUID = 0; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } - void NextStep(const uint32 time) - { - _step++; - _checkTimer = time; - } + void NextStep(const uint32 time) + { + _step++; + _checkTimer = time; + } - void Say(std::string text, bool self) - { - WorldPacket data; - - if (self) - ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, me, NULL, text); - else if (Creature* c = ObjectAccessor::GetCreature(*me, _pentarusGUID)) - ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, c, NULL, text); + void Say(std::string text, bool self) + { + WorldPacket data; + + if (self) + ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, me, NULL, text); + else if (Creature* c = ObjectAccessor::GetCreature(*me, _pentarusGUID)) + ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, c, NULL, text); - me->SendMessageToSetInRange(&data, 100.0f, true); - } + me->SendMessageToSetInRange(&data, 100.0f, true); + } - void UpdateAI(uint32 diff) - { - if (_running) - { - if (_checkTimer != 0) - { - _checkTimer -= diff; - if (_checkTimer < 0 ) - _checkTimer = 0; - } - else - switch (_step) - { - case 0: - Say("Pentarus, you heard the man. Have your mages release the shield and let these brave souls through!", true); - NextStep(8000); - break; - case 1: - Say("Of course, Brann: We will have the shield down momentarily.", false); - NextStep(7000); - break; - case 2: - if (Creature* cr = me->SummonCreature(NPC_BRANN_RADIO, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 5000)) - { - cr->PlayDirectSound(RSOUND_L0); - cr->MonsterSay("Okay! Let's move out. Get into your machines; I'll speak to you from here via the radio.", LANG_UNIVERSAL, 0); - } - NextStep(8000); - break; - case 3: - if (GameObject* go = me->FindNearestGameObject(GO_STARTING_BARRIER, 200.0f)) - go->Delete(); + void UpdateAI(uint32 diff) + { + if (_running) + { + if (_checkTimer != 0) + { + _checkTimer -= diff; + if (_checkTimer < 0 ) + _checkTimer = 0; + } + else + switch (_step) + { + case 0: + Say("Pentarus, you heard the man. Have your mages release the shield and let these brave souls through!", true); + NextStep(8000); + break; + case 1: + Say("Of course, Brann: We will have the shield down momentarily.", false); + NextStep(7000); + break; + case 2: + if (Creature* cr = me->SummonCreature(NPC_BRANN_RADIO, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 5000)) + { + cr->PlayDirectSound(RSOUND_L0); + cr->MonsterSay("Okay! Let's move out. Get into your machines; I'll speak to you from here via the radio.", LANG_UNIVERSAL, 0); + } + NextStep(8000); + break; + case 3: + if (GameObject* go = me->FindNearestGameObject(GO_STARTING_BARRIER, 200.0f)) + go->Delete(); - Say("Mages of the Kirin Tor, on Brann's Command, release the shield! Defend this platform and our allies with your lives! For Dalaran!", false); - NextStep(9000); - break; - case 4: - Say("Our allies are ready. Bring down the shield and make way!", true); - _running = false; - me->MonsterTextEmote("Go to your vehicles!", 0, true); - if (me->GetInstanceScript()) - me->GetInstanceScript()->SetData(DATA_VEHICLE_SPAWN, VEHICLE_POS_START); - return; - } - } - } + Say("Mages of the Kirin Tor, on Brann's Command, release the shield! Defend this platform and our allies with your lives! For Dalaran!", false); + NextStep(9000); + break; + case 4: + Say("Our allies are ready. Bring down the shield and make way!", true); + _running = false; + me->MonsterTextEmote("Go to your vehicles!", 0, true); + if (me->GetInstanceScript()) + me->GetInstanceScript()->SetData(DATA_VEHICLE_SPAWN, VEHICLE_POS_START); + return; + } + } + } - void DoAction(int32 param) - { - if (_eventStarted) - return; + void DoAction(int32 param) + { + if (_eventStarted) + return; - if (me->GetInstanceScript()) - { - // deactivate towers, easy mode - if (param != ACTION_START_NORGANNON_BRANN) - { - me->GetInstanceScript()->ProcessEvent(NULL, EVENT_TOWER_OF_STORM_DESTROYED); - me->GetInstanceScript()->ProcessEvent(NULL, EVENT_TOWER_OF_FROST_DESTROYED); - me->GetInstanceScript()->ProcessEvent(NULL, EVENT_TOWER_OF_FLAMES_DESTROYED); - me->GetInstanceScript()->ProcessEvent(NULL, EVENT_TOWER_OF_LIFE_DESTROYED); - } - } + if (me->GetInstanceScript()) + { + // deactivate towers, easy mode + if (param != ACTION_START_NORGANNON_BRANN) + { + me->GetInstanceScript()->ProcessEvent(NULL, EVENT_TOWER_OF_STORM_DESTROYED); + me->GetInstanceScript()->ProcessEvent(NULL, EVENT_TOWER_OF_FROST_DESTROYED); + me->GetInstanceScript()->ProcessEvent(NULL, EVENT_TOWER_OF_FLAMES_DESTROYED); + me->GetInstanceScript()->ProcessEvent(NULL, EVENT_TOWER_OF_LIFE_DESTROYED); + } + } - if (Creature* cr = me->FindNearestCreature(NPC_ARCHMAGE_PENTARUS, 50.0f, true)) - _pentarusGUID = cr->GetGUID(); + if (Creature* cr = me->FindNearestCreature(NPC_ARCHMAGE_PENTARUS, 50.0f, true)) + _pentarusGUID = cr->GetGUID(); - _eventStarted = true; - _running = true; - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - }; + _eventStarted = true; + _running = true; + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + }; }; class npc_brann_radio : public CreatureScript @@ -1508,109 +1508,109 @@ public: return new npc_brann_radioAI (pCreature); } - struct npc_brann_radioAI : public NullCreatureAI - { - npc_brann_radioAI(Creature* c) : NullCreatureAI(c) - { - _lock = (me->GetInstanceScript() && me->GetInstanceScript()->GetData(TYPE_LEVIATHAN) > NOT_STARTED); - _helpLock = _lock; - } + struct npc_brann_radioAI : public NullCreatureAI + { + npc_brann_radioAI(Creature* c) : NullCreatureAI(c) + { + _lock = (me->GetInstanceScript() && me->GetInstanceScript()->GetData(TYPE_LEVIATHAN) > NOT_STARTED); + _helpLock = _lock; + } - bool _lock; - bool _helpLock; + bool _lock; + bool _helpLock; - void Reset() - { - me->SetReactState(REACT_AGGRESSIVE); - } + void Reset() + { + me->SetReactState(REACT_AGGRESSIVE); + } - void Say(const char* text) - { - WorldPacket data; - ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, me, NULL, text); - me->SendMessageToSetInRange(&data, 100.0f, true); - } + void Say(const char* text) + { + WorldPacket data; + ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, me, NULL, text); + me->SendMessageToSetInRange(&data, 100.0f, true); + } - void MoveInLineOfSight(Unit* who) - { - if (!_lock) - { - if (who->GetTypeId() != TYPEID_PLAYER && !who->IsVehicle()) - return; - - // ENGAGE - if (!_helpLock && me->GetDistance2d(-508.898f, -32.9631f) < 5.0f) - { - if (me->GetDistance2d(who) <= 60.0f) - { - Say("The iron dwarves have been seen emerging from the bunkers at the base of the pillars straight ahead of you. Destroy the bunkers and they will be forced to fall back."); - me->PlayDirectSound(RSOUND_ENGAGE); - _helpLock = true; - } - } - // MIMIRON - else if (me->GetDistance2d(-81.9207f, 111.432f) < 5.0f) - { - if (me->GetDistance2d(who) <= 60.0f && who->GetPositionZ() > 430.0f) - { - Say("This generator powers Mimiron's Gaze. In moments, it can turn earth to ash, stone to magma--we cannot let it reach full power!"); - me->PlayDirectSound(RSOUND_MIMIRON); - _lock = true; - } - } - // FREYA - else if (me->GetDistance2d(-221.475f, -271.087f) < 5.0f) - { - if (me->GetDistance2d(who) <= 60.0f && who->GetPositionZ() < 380.0f) - { - Say("You're approaching the tower of Freya. It contains the power to turn barren wastelands into jungles teeming with life overnight"); - me->PlayDirectSound(RSOUND_FREYA); - _lock = true; - } - } - // STATIONS - else if (me->GetDistance2d(73.8978f, -29.3306f) < 5.0f) - { - if (me->GetDistance2d(who) <= 40.0f) - { - Say("It appears you are near a repair station. Drive your vehicle on to the platform and it should be automatically repaired."); - me->PlayDirectSound(RSOUND_STATION); - _lock = true; - } - } - // HODIR - else if (me->GetDistance2d(68.7679f, -325.026f) < 5.0f) - { - if (me->GetDistance2d(who) <= 40.0f) - { - Say("This tower powers the hammer of Hodir. It is said to have the power to turn entire armies to ice!"); - me->PlayDirectSound(RSOUND_HODIR); - _lock = true; - } - } - // THORIM - else if (me->GetDistance2d(174.442f, 345.679f) < 5.0f) - { - if (me->GetDistance2d(who) <= 60.0f) - { - Say("Aaaah, the tower of Krolmir. It is said that the power of Thorim has been used only once. And that it turned an entire continent to dust..."); - me->PlayDirectSound(RSOUND_THORIM); - _lock = true; - } - } - // COME A BIT CLOSER - else if (me->GetDistance2d(-508.898f, -32.9631f) < 5.0f) - { - if (who->GetPositionX() >= -480.0f) - { - Say("There are four generators powering the defense structures. If you sabotage the generators, the missile attacks will stop!"); - me->PlayDirectSound(RSOUND_GENERATORS); - _lock = true; - } - } - } - } - }; + void MoveInLineOfSight(Unit* who) + { + if (!_lock) + { + if (who->GetTypeId() != TYPEID_PLAYER && !who->IsVehicle()) + return; + + // ENGAGE + if (!_helpLock && me->GetDistance2d(-508.898f, -32.9631f) < 5.0f) + { + if (me->GetDistance2d(who) <= 60.0f) + { + Say("The iron dwarves have been seen emerging from the bunkers at the base of the pillars straight ahead of you. Destroy the bunkers and they will be forced to fall back."); + me->PlayDirectSound(RSOUND_ENGAGE); + _helpLock = true; + } + } + // MIMIRON + else if (me->GetDistance2d(-81.9207f, 111.432f) < 5.0f) + { + if (me->GetDistance2d(who) <= 60.0f && who->GetPositionZ() > 430.0f) + { + Say("This generator powers Mimiron's Gaze. In moments, it can turn earth to ash, stone to magma--we cannot let it reach full power!"); + me->PlayDirectSound(RSOUND_MIMIRON); + _lock = true; + } + } + // FREYA + else if (me->GetDistance2d(-221.475f, -271.087f) < 5.0f) + { + if (me->GetDistance2d(who) <= 60.0f && who->GetPositionZ() < 380.0f) + { + Say("You're approaching the tower of Freya. It contains the power to turn barren wastelands into jungles teeming with life overnight"); + me->PlayDirectSound(RSOUND_FREYA); + _lock = true; + } + } + // STATIONS + else if (me->GetDistance2d(73.8978f, -29.3306f) < 5.0f) + { + if (me->GetDistance2d(who) <= 40.0f) + { + Say("It appears you are near a repair station. Drive your vehicle on to the platform and it should be automatically repaired."); + me->PlayDirectSound(RSOUND_STATION); + _lock = true; + } + } + // HODIR + else if (me->GetDistance2d(68.7679f, -325.026f) < 5.0f) + { + if (me->GetDistance2d(who) <= 40.0f) + { + Say("This tower powers the hammer of Hodir. It is said to have the power to turn entire armies to ice!"); + me->PlayDirectSound(RSOUND_HODIR); + _lock = true; + } + } + // THORIM + else if (me->GetDistance2d(174.442f, 345.679f) < 5.0f) + { + if (me->GetDistance2d(who) <= 60.0f) + { + Say("Aaaah, the tower of Krolmir. It is said that the power of Thorim has been used only once. And that it turned an entire continent to dust..."); + me->PlayDirectSound(RSOUND_THORIM); + _lock = true; + } + } + // COME A BIT CLOSER + else if (me->GetDistance2d(-508.898f, -32.9631f) < 5.0f) + { + if (who->GetPositionX() >= -480.0f) + { + Say("There are four generators powering the defense structures. If you sabotage the generators, the missile attacks will stop!"); + me->PlayDirectSound(RSOUND_GENERATORS); + _lock = true; + } + } + } + } + }; }; class npc_storm_beacon_spawn : public CreatureScript @@ -1623,35 +1623,35 @@ public: return new npc_storm_beacon_spawnAI (pCreature); } - struct npc_storm_beacon_spawnAI : public NullCreatureAI - { - npc_storm_beacon_spawnAI(Creature* c) : NullCreatureAI(c) - { - _amount = 0; - _checkTimer = 0; - } + struct npc_storm_beacon_spawnAI : public NullCreatureAI + { + npc_storm_beacon_spawnAI(Creature* c) : NullCreatureAI(c) + { + _amount = 0; + _checkTimer = 0; + } - uint8 _amount; - uint32 _checkTimer; + uint8 _amount; + uint32 _checkTimer; - void UpdateAI(uint32 diff) - { - if (_amount < 40) - { - _checkTimer += diff; - if (_checkTimer >= 4000) - { - _checkTimer = 0; - if (Unit* target = me->SelectNearbyTarget(NULL, 80.0f)) - { - ++_amount; - if (Creature* cr = me->SummonCreature(NPC_DEFENDER_GENERATED, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+4, me->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000)) - cr->AI()->AttackStart(target); - } - } - } - } - }; + void UpdateAI(uint32 diff) + { + if (_amount < 40) + { + _checkTimer += diff; + if (_checkTimer >= 4000) + { + _checkTimer = 0; + if (Unit* target = me->SelectNearbyTarget(NULL, 80.0f)) + { + ++_amount; + if (Creature* cr = me->SummonCreature(NPC_DEFENDER_GENERATED, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+4, me->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000)) + cr->AI()->AttackStart(target); + } + } + } + } + }; }; class boss_flame_leviathan_safety_container : public CreatureScript @@ -1664,42 +1664,42 @@ public: return new boss_flame_leviathan_safety_containerAI (pCreature); } - struct boss_flame_leviathan_safety_containerAI : public NullCreatureAI - { - boss_flame_leviathan_safety_containerAI(Creature *c) : NullCreatureAI(c) - { - _allowTimer = 0; - } + struct boss_flame_leviathan_safety_containerAI : public NullCreatureAI + { + boss_flame_leviathan_safety_containerAI(Creature *c) : NullCreatureAI(c) + { + _allowTimer = 0; + } - uint32 _allowTimer; + uint32 _allowTimer; - void MovementInform(uint32 type, uint32 id) - { - if (id == me->GetEntry()) - { - if (Creature* liquid = me->SummonCreature(NPC_LIQUID, *me)) - { - liquid->CastSpell(liquid, SPELL_LIQUID_PYRITE, true); - liquid->CastSpell(liquid, SPELL_DUST_CLOUD_IMPACT, true); - } - - me->DespawnOrUnsummon(1); - } - } + void MovementInform(uint32 type, uint32 id) + { + if (id == me->GetEntry()) + { + if (Creature* liquid = me->SummonCreature(NPC_LIQUID, *me)) + { + liquid->CastSpell(liquid, SPELL_LIQUID_PYRITE, true); + liquid->CastSpell(liquid, SPELL_DUST_CLOUD_IMPACT, true); + } + + me->DespawnOrUnsummon(1); + } + } - void UpdateAI(uint32 diff) - { - _allowTimer += diff; - if (_allowTimer >= 5000 && !me->GetVehicle() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) - { - float x, y, z; + void UpdateAI(uint32 diff) + { + _allowTimer += diff; + if (_allowTimer >= 5000 && !me->GetVehicle() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) + { + float x, y, z; me->GetPosition(x, y, z); z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z); me->GetMotionMaster()->MovePoint(me->GetEntry(), x, y, z); me->SetPosition(x, y, z, 0); - } - } - }; + } + } + }; }; class npc_mechanolift : public CreatureScript @@ -1712,42 +1712,42 @@ public: return new npc_mechanoliftAI (pCreature); } - struct npc_mechanoliftAI : public NullCreatureAI - { - npc_mechanoliftAI(Creature *c) : NullCreatureAI(c) - { - me->SetSpeed(MOVE_RUN, rand_norm()+0.5f); - } + struct npc_mechanoliftAI : public NullCreatureAI + { + npc_mechanoliftAI(Creature *c) : NullCreatureAI(c) + { + me->SetSpeed(MOVE_RUN, rand_norm()+0.5f); + } - int32 _startTimer; - uint32 _evadeTimer; + int32 _startTimer; + uint32 _evadeTimer; - void Reset() - { - _startTimer = urand(1,5000); - _evadeTimer = 0; - } + void Reset() + { + _startTimer = urand(1,5000); + _evadeTimer = 0; + } - void UpdateAI(uint32 diff) - { - if (_startTimer) - { - _startTimer -= diff; - if (_startTimer <= 0) - { - me->GetMotionMaster()->MovePath(3000000+urand(0,11), true); - _startTimer = 0; - } - } + void UpdateAI(uint32 diff) + { + if (_startTimer) + { + _startTimer -= diff; + if (_startTimer <= 0) + { + me->GetMotionMaster()->MovePath(3000000+urand(0,11), true); + _startTimer = 0; + } + } - _evadeTimer += diff; - if (_evadeTimer >= 10000) - { - _EnterEvadeMode(); - _evadeTimer = 0; - } - } - }; + _evadeTimer += diff; + if (_evadeTimer >= 10000) + { + _EnterEvadeMode(); + _evadeTimer = 0; + } + } + }; }; class go_ulduar_tower : public GameObjectScript @@ -1824,14 +1824,14 @@ class spell_auto_repair : public SpellScriptLoader void FilterTargets(std::list& targets) { - std::list tmplist; - for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) - if (!(*itr)->ToUnit()->HasAura(SPELL_AUTO_REPAIR)) - tmplist.push_back(*itr); + std::list tmplist; + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + if (!(*itr)->ToUnit()->HasAura(SPELL_AUTO_REPAIR)) + tmplist.push_back(*itr); - targets.clear(); - for (std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr) - targets.push_back(*itr); + targets.clear(); + for (std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr) + targets.push_back(*itr); } void HandleScript(SpellEffIndex /*eff*/) @@ -1850,13 +1850,13 @@ class spell_auto_repair : public SpellScriptLoader vehicle->GetBase()->SetFullHealth(); // Achievement - if (InstanceScript* instance = vehicle->GetBase()->GetInstanceScript()) - instance->SetData(DATA_UNBROKEN_ACHIEVEMENT, 0); + if (InstanceScript* instance = vehicle->GetBase()->GetInstanceScript()) + instance->SetData(DATA_UNBROKEN_ACHIEVEMENT, 0); } void Register() { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auto_repair_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENTRY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_auto_repair_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENTRY); OnEffectHitTarget += SpellEffectFn(spell_auto_repair_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -1884,9 +1884,9 @@ class spell_systems_shutdown : public SpellScriptLoader owner->SetControlled(true, UNIT_STATE_STUNNED); owner->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); - if (Vehicle* veh = owner->GetVehicleKit()) - if (Unit* cannon = veh->GetPassenger(SEAT_CANNON)) - cannon->GetAI()->DoAction(ACTION_DELAY_CANNON); + if (Vehicle* veh = owner->GetVehicleKit()) + if (Unit* cannon = veh->GetPassenger(SEAT_CANNON)) + cannon->GetAI()->DoAction(ACTION_DELAY_CANNON); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -1944,7 +1944,7 @@ class FlameLeviathanPursuedTargetSelector //! Vehicle must be in use by player bool playerFound = false; for (SeatMap::const_iterator itr = vehicle->Seats.begin(); itr != vehicle->Seats.end() && !playerFound; ++itr) - if (IS_PLAYER_GUID(itr->second.Passenger.Guid)) + if (IS_PLAYER_GUID(itr->second.Passenger.Guid)) playerFound = true; return !playerFound; @@ -1974,10 +1974,10 @@ class spell_pursue : public SpellScriptLoader else { //! In the end, only one target should be selected - WorldObject* _target = Trinity::Containers::SelectRandomContainerElement(targets); - targets.clear(); - if (_target) - targets.push_back(_target); + WorldObject* _target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + if (_target) + targets.push_back(_target); } } @@ -1985,20 +1985,20 @@ class spell_pursue : public SpellScriptLoader void HandleScript(SpellEffIndex /*eff*/) { Creature* target = GetHitCreature(); - Unit* caster = GetCaster(); + Unit* caster = GetCaster(); if (!target || !caster) return; - caster->getThreatManager().resetAllAggro(); + caster->getThreatManager().resetAllAggro(); caster->GetAI()->AttackStart(target); // Chase target - caster->AddThreat(target, 10000000.0f); - if (target->GetVehicleKit()) - for (SeatMap::const_iterator itr = target->GetVehicleKit()->Seats.begin(); itr != target->GetVehicleKit()->Seats.end(); ++itr) - if (IS_PLAYER_GUID(itr->second.Passenger.Guid)) - { - caster->MonsterTextEmote("Flame Leviathan pursues $N.", ObjectAccessor::GetPlayer(*caster, itr->second.Passenger.Guid), true); - return; - } + caster->AddThreat(target, 10000000.0f); + if (target->GetVehicleKit()) + for (SeatMap::const_iterator itr = target->GetVehicleKit()->Seats.begin(); itr != target->GetVehicleKit()->Seats.end(); ++itr) + if (IS_PLAYER_GUID(itr->second.Passenger.Guid)) + { + caster->MonsterTextEmote("Flame Leviathan pursues $N.", ObjectAccessor::GetPlayer(*caster, itr->second.Passenger.Guid), true); + return; + } } void Register() @@ -2054,10 +2054,10 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader } } if (target && target->IsWithinDist2d(targets.GetDstPos(), GetSpellInfo()->Effects[EFFECT_0].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct - { - passenger->ExitVehicle(); + { + passenger->ExitVehicle(); passenger->EnterVehicle(target, 0); - } + } else { passenger->ExitVehicle(); @@ -2091,12 +2091,12 @@ class spell_tar_blaze : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - GetUnitOwner()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + GetUnitOwner()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_tar_blaze_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_tar_blaze_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -2116,22 +2116,22 @@ class spell_vehicle_grab_pyrite : public SpellScriptLoader PrepareSpellScript(spell_vehicle_grab_pyrite_SpellScript); void HandleScript(SpellEffIndex effIndex) { - if (Unit* target = GetHitUnit()) + if (Unit* target = GetHitUnit()) if (Unit* seat = GetCaster()->GetVehicleBase()) - { - if (Vehicle* vSeat = seat->GetVehicleKit()) - if (Unit* pyrite = vSeat->GetPassenger(1)) - pyrite->ExitVehicle(); + { + if (Vehicle* vSeat = seat->GetVehicleKit()) + if (Unit* pyrite = vSeat->GetPassenger(1)) + pyrite->ExitVehicle(); if (Unit* parent = seat->GetVehicleBase()) { GetCaster()->CastSpell(parent, 62496 /*SPELL_ADD_PYRITE*/, true); - target->CastSpell(seat, GetEffectValue()); + target->CastSpell(seat, GetEffectValue()); - if (target->GetTypeId() == TYPEID_UNIT) - target->ToCreature()->DespawnOrUnsummon(1300); + if (target->GetTypeId() == TYPEID_UNIT) + target->ToCreature()->DespawnOrUnsummon(1300); } - } + } } void Register() @@ -2157,17 +2157,17 @@ class spell_vehicle_circuit_overload : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - if (Unit* target = GetTarget()) - if (int(target->GetAppliedAuras().count(SPELL_OVERLOAD_CIRCUIT)) >= (target->GetMap()->Is25ManRaid() ? 4 : 2)) - { - target->CastSpell(target, SPELL_SYSTEMS_SHUTDOWN, true); - target->RemoveAurasDueToSpell(SPELL_OVERLOAD_CIRCUIT); - } + if (Unit* target = GetTarget()) + if (int(target->GetAppliedAuras().count(SPELL_OVERLOAD_CIRCUIT)) >= (target->GetMap()->Is25ManRaid() ? 4 : 2)) + { + target->CastSpell(target, SPELL_SYSTEMS_SHUTDOWN, true); + target->RemoveAurasDueToSpell(SPELL_OVERLOAD_CIRCUIT); + } } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_vehicle_circuit_overload_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_vehicle_circuit_overload_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -2188,7 +2188,7 @@ class spell_orbital_supports : public SpellScriptLoader bool CheckAreaTarget(Unit* target) { - return target->GetEntry() == NPC_LEVIATHAN; + return target->GetEntry() == NPC_LEVIATHAN; } void Register() { @@ -2204,41 +2204,41 @@ class spell_orbital_supports : public SpellScriptLoader class spell_thorims_hammer : public SpellScriptLoader { - public: - spell_thorims_hammer() : SpellScriptLoader("spell_thorims_hammer") { } + public: + spell_thorims_hammer() : SpellScriptLoader("spell_thorims_hammer") { } - class spell_thorims_hammer_SpellScript : public SpellScript - { - PrepareSpellScript(spell_thorims_hammer_SpellScript); + class spell_thorims_hammer_SpellScript : public SpellScript + { + PrepareSpellScript(spell_thorims_hammer_SpellScript); - void RecalculateDamage(SpellEffIndex effIndex) + void RecalculateDamage(SpellEffIndex effIndex) { - if (!GetHitUnit() || effIndex == EFFECT_1) - { - PreventHitDefaultEffect(effIndex); - return; - } + if (!GetHitUnit() || effIndex == EFFECT_1) + { + PreventHitDefaultEffect(effIndex); + return; + } - float dist = GetHitUnit()->GetExactDist2d(GetCaster()); - if (dist <= 7.0f) - SetHitDamage(GetSpellInfo()->Effects[EFFECT_1].CalcValue()); - else - { - dist -= 6.0f; - SetHitDamage(int32(GetSpellInfo()->Effects[EFFECT_1].CalcValue() / std::max(dist, 1.0f))); - } + float dist = GetHitUnit()->GetExactDist2d(GetCaster()); + if (dist <= 7.0f) + SetHitDamage(GetSpellInfo()->Effects[EFFECT_1].CalcValue()); + else + { + dist -= 6.0f; + SetHitDamage(int32(GetSpellInfo()->Effects[EFFECT_1].CalcValue() / std::max(dist, 1.0f))); + } } void Register() { OnEffectHitTarget += SpellEffectFn(spell_thorims_hammer_SpellScript::RecalculateDamage, EFFECT_ALL, SPELL_EFFECT_SCHOOL_DAMAGE); } - }; + }; - SpellScript* GetSpellScript() const - { - return new spell_thorims_hammer_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_thorims_hammer_SpellScript(); + } }; class spell_shield_generator : public SpellScriptLoader @@ -2250,7 +2250,7 @@ class spell_shield_generator : public SpellScriptLoader { PrepareAuraScript(spell_shield_generator_AuraScript); - uint32 absorbPct; + uint32 absorbPct; bool Load() { @@ -2294,23 +2294,23 @@ class spell_demolisher_ride_vehicle : public SpellScriptLoader SpellCastResult CheckCast() { - if (GetCaster()->GetTypeId() != TYPEID_PLAYER) - return SPELL_CAST_OK; + if (GetCaster()->GetTypeId() != TYPEID_PLAYER) + return SPELL_CAST_OK; - Unit* target = this->GetExplTargetUnit(); - if (!target || target->GetEntry() != NPC_SALVAGED_DEMOLISHER) - return SPELL_FAILED_DONT_REPORT; + Unit* target = this->GetExplTargetUnit(); + if (!target || target->GetEntry() != NPC_SALVAGED_DEMOLISHER) + return SPELL_FAILED_DONT_REPORT; - Vehicle* veh = target->GetVehicleKit(); - if (veh && veh->GetPassenger(0)) - if (Unit* target2 = veh->GetPassenger(1)) - if (Vehicle* veh2 = target2->GetVehicleKit()) - { - if (!veh2->GetPassenger(0)) - target2->HandleSpellClick(GetCaster()); + Vehicle* veh = target->GetVehicleKit(); + if (veh && veh->GetPassenger(0)) + if (Unit* target2 = veh->GetPassenger(1)) + if (Vehicle* veh2 = target2->GetVehicleKit()) + { + if (!veh2->GetPassenger(0)) + target2->HandleSpellClick(GetCaster()); - return SPELL_FAILED_DONT_REPORT; - } + return SPELL_FAILED_DONT_REPORT; + } return SPELL_CAST_OK; } @@ -2337,9 +2337,9 @@ class achievement_flame_leviathan_towers : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target /*Flame Leviathan*/) { - return target && _towerCount <= target->GetAI()->GetData(DATA_GET_TOWER_COUNT); + return target && _towerCount <= target->GetAI()->GetData(DATA_GET_TOWER_COUNT); } - + private: uint32 const _towerCount; }; @@ -2351,10 +2351,10 @@ class achievement_flame_leviathan_shutout : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target /*Flame Leviathan*/) { - if (target) - if (target->GetAI()->GetData(DATA_GET_SHUTDOWN)) - return true; - return false; + if (target) + if (target->GetAI()->GetData(DATA_GET_SHUTDOWN)) + return true; + return false; } }; @@ -2368,15 +2368,15 @@ class achievement_flame_leviathan_garage : public AchievementCriteriaScript bool OnCheck(Player* player, Unit*) { - if (Vehicle* vehicle = player->GetVehicle()) - if (vehicle->GetCreatureEntry() == _entry1 || vehicle->GetCreatureEntry() == _entry2) - return true; - return false; + if (Vehicle* vehicle = player->GetVehicle()) + if (vehicle->GetCreatureEntry() == _entry1 || vehicle->GetCreatureEntry() == _entry2) + return true; + return false; } - + private: uint32 const _entry1; - uint32 const _entry2; + uint32 const _entry2; }; class achievement_flame_leviathan_unbroken : public AchievementCriteriaScript @@ -2386,60 +2386,60 @@ class achievement_flame_leviathan_unbroken : public AchievementCriteriaScript bool OnCheck(Player* player, Unit*) { - if (player->GetInstanceScript()) - if (player->GetInstanceScript()->GetData(DATA_UNBROKEN_ACHIEVEMENT)) - return true; - return false; + if (player->GetInstanceScript()) + if (player->GetInstanceScript()->GetData(DATA_UNBROKEN_ACHIEVEMENT)) + return true; + return false; } }; void AddSC_boss_flame_leviathan() { - new boss_flame_leviathan(); - new boss_flame_leviathan_seat(); - new boss_flame_leviathan_defense_turret(); + new boss_flame_leviathan(); + new boss_flame_leviathan_seat(); + new boss_flame_leviathan_defense_turret(); new boss_flame_leviathan_overload_device(); - new npc_pool_of_tar(); + new npc_pool_of_tar(); - // Hard Mode - new npc_freya_ward(); - new npc_thorims_hammer(); - new npc_mimirons_inferno(); - new npc_hodirs_fury(); + // Hard Mode + new npc_freya_ward(); + new npc_thorims_hammer(); + new npc_mimirons_inferno(); + new npc_hodirs_fury(); - // Helpers - new npc_lore_keeper_of_norgannon_ulduar(); - new npc_brann_ulduar(); - new npc_brann_radio(); - new npc_storm_beacon_spawn(); - new boss_flame_leviathan_safety_container(); - new npc_mechanolift(); + // Helpers + new npc_lore_keeper_of_norgannon_ulduar(); + new npc_brann_ulduar(); + new npc_brann_radio(); + new npc_storm_beacon_spawn(); + new boss_flame_leviathan_safety_container(); + new npc_mechanolift(); - // GOs - new go_ulduar_tower(); + // GOs + new go_ulduar_tower(); - // Spells - new spell_load_into_catapult(); + // Spells + new spell_load_into_catapult(); new spell_auto_repair(); new spell_systems_shutdown(); new spell_pursue(); new spell_vehicle_throw_passenger(); - new spell_tar_blaze(); - new spell_vehicle_grab_pyrite(); - new spell_vehicle_circuit_overload(); - new spell_orbital_supports(); - new spell_thorims_hammer(); - new spell_shield_generator(); - new spell_demolisher_ride_vehicle(); + new spell_tar_blaze(); + new spell_vehicle_grab_pyrite(); + new spell_vehicle_circuit_overload(); + new spell_orbital_supports(); + new spell_thorims_hammer(); + new spell_shield_generator(); + new spell_demolisher_ride_vehicle(); - // Achievements - new achievement_flame_leviathan_towers("achievement_flame_leviathan_orbital_bombardment", 1); - new achievement_flame_leviathan_towers("achievement_flame_leviathan_orbital_devastation", 2); - new achievement_flame_leviathan_towers("achievement_flame_leviathan_nuked_from_orbit", 3); - new achievement_flame_leviathan_towers("achievement_flame_leviathan_orbituary", 4); - new achievement_flame_leviathan_shutout(); - new achievement_flame_leviathan_garage("achievement_flame_leviathan_garage_chopper", NPC_VEHICLE_CHOPPER, 0); - new achievement_flame_leviathan_garage("achievement_flame_leviathan_garage_siege_engine", NPC_SALVAGED_SIEGE_ENGINE, NPC_SALVAGED_SIEGE_ENGINE_TURRET); - new achievement_flame_leviathan_garage("achievement_flame_leviathan_garage_demolisher", NPC_SALVAGED_DEMOLISHER, NPC_SALVAGED_DEMOLISHER_TURRET); - new achievement_flame_leviathan_unbroken(); + // Achievements + new achievement_flame_leviathan_towers("achievement_flame_leviathan_orbital_bombardment", 1); + new achievement_flame_leviathan_towers("achievement_flame_leviathan_orbital_devastation", 2); + new achievement_flame_leviathan_towers("achievement_flame_leviathan_nuked_from_orbit", 3); + new achievement_flame_leviathan_towers("achievement_flame_leviathan_orbituary", 4); + new achievement_flame_leviathan_shutout(); + new achievement_flame_leviathan_garage("achievement_flame_leviathan_garage_chopper", NPC_VEHICLE_CHOPPER, 0); + new achievement_flame_leviathan_garage("achievement_flame_leviathan_garage_siege_engine", NPC_SALVAGED_SIEGE_ENGINE, NPC_SALVAGED_SIEGE_ENGINE_TURRET); + new achievement_flame_leviathan_garage("achievement_flame_leviathan_garage_demolisher", NPC_SALVAGED_DEMOLISHER, NPC_SALVAGED_DEMOLISHER_TURRET); + new achievement_flame_leviathan_unbroken(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index f25763d2c..4a77d7e50 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -11,235 +11,235 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum FreyaSpells { - // LIFEBINDER - SPELL_AUTO_GROW = 62559, - SPELL_LIFEBINDER_PHERONOMES = 62619, - SPELL_LIFEBINDER_VISUAL = 62579, - SPELL_LIFEBINDER_HEAL_10 = 62584, - SPELL_LIFEBINDER_HEAL_25 = 64185, + // LIFEBINDER + SPELL_AUTO_GROW = 62559, + SPELL_LIFEBINDER_PHERONOMES = 62619, + SPELL_LIFEBINDER_VISUAL = 62579, + SPELL_LIFEBINDER_HEAL_10 = 62584, + SPELL_LIFEBINDER_HEAL_25 = 64185, - // FREYA - SPELL_TOUCH_OF_EONAR_10 = 62528, - SPELL_TOUCH_OF_EONAR_25 = 62892, - SPELL_ATTUNED_TO_NATURE = 62519, - SPELL_SUMMON_LIFEBINDER = 62870, - SPELL_SUNBEAM_10 = 62623, - SPELL_SUNBEAM_25 = 62872, - SPELL_NATURE_BOMB_FLIGHT = 64648, - SPELL_NATURE_BOMB_DAMAGE_10 = 64587, - SPELL_NATURE_BOMB_DAMAGE_25 = 64650, - SPELL_GREEN_BANISH_STATE = 32567, - SPELL_BERSERK = 47008, + // FREYA + SPELL_TOUCH_OF_EONAR_10 = 62528, + SPELL_TOUCH_OF_EONAR_25 = 62892, + SPELL_ATTUNED_TO_NATURE = 62519, + SPELL_SUMMON_LIFEBINDER = 62870, + SPELL_SUNBEAM_10 = 62623, + SPELL_SUNBEAM_25 = 62872, + SPELL_NATURE_BOMB_FLIGHT = 64648, + SPELL_NATURE_BOMB_DAMAGE_10 = 64587, + SPELL_NATURE_BOMB_DAMAGE_25 = 64650, + SPELL_GREEN_BANISH_STATE = 32567, + SPELL_BERSERK = 47008, - // HARD MODE - SPELL_GROUND_TREMOR_FREYA_10 = 62437, - SPELL_GROUND_TREMOR_FREYA_25 = 62859, - SPELL_IRON_ROOTS_FREYA_10 = 62862, - SPELL_IRON_ROOTS_FREYA_25 = 62439, - SPELL_IRON_ROOTS_FREYA_DAMAGE_10 = 62861, - SPELL_IRON_ROOTS_FREYA_DAMAGE_25 = 62438, - SPELL_UNSTABLE_SUN_FREYA_DAMAGE_10 = 62451, - SPELL_UNSTABLE_SUN_FREYA_DAMAGE_25 = 62865, - SPELL_UNSTABLE_SUN_VISUAL = 62216, + // HARD MODE + SPELL_GROUND_TREMOR_FREYA_10 = 62437, + SPELL_GROUND_TREMOR_FREYA_25 = 62859, + SPELL_IRON_ROOTS_FREYA_10 = 62862, + SPELL_IRON_ROOTS_FREYA_25 = 62439, + SPELL_IRON_ROOTS_FREYA_DAMAGE_10 = 62861, + SPELL_IRON_ROOTS_FREYA_DAMAGE_25 = 62438, + SPELL_UNSTABLE_SUN_FREYA_DAMAGE_10 = 62451, + SPELL_UNSTABLE_SUN_FREYA_DAMAGE_25 = 62865, + SPELL_UNSTABLE_SUN_VISUAL = 62216, - // ELDERS - SPELL_DRAINED_OF_POWER = 62467, - SPELL_STONEBARK_ESSENCE = 62483, - SPELL_IRONBRANCH_ESSENCE = 62484, - SPELL_BRIGHTLEAF_ESSENCE = 62485, - - // BRIGHTLEAF - SPELL_BRIGHTLEAF_FLUX = 62239, - SPELL_SOLAR_FLARE_10 = 62240, - SPELL_SOLAR_FLARE_25 = 64087, - SPELL_UNSTABLE_SUN_BEAM_AURA = 62211, - SPELL_PHOTOSYNTHESIS = 62209, - SPELL_UNSTABLE_SUN_DAMAGE_10 = 62217, - SPELL_UNSTABLE_SUN_DAMAGE_25 = 62922, - - // IRONBRANCH - SPELL_IMPALE_10 = 62310, - SPELL_IMPALE_25 = 62928, - SPELL_IRON_ROOTS_10 = 62275, - SPELL_IRON_ROOTS_25 = 62929, - SPELL_IRON_ROOTS_DAMAGE_10 = 62283, - SPELL_IRON_ROOTS_DAMAGE_25 = 62930, - SPELL_THORN_SWARM_10 = 62285, - SPELL_THORN_SWARM_25 = 62931, - - // STONEBARK - SPELL_FISTS_OF_STONE = 62344, - SPELL_GROUND_TREMOR_10 = 62325, - SPELL_GROUND_TREMOR_25 = 62932, - SPELL_PETRIFIED_BARK_10 = 62337, - SPELL_PETRIFIED_BARK_25 = 62933, + // ELDERS + SPELL_DRAINED_OF_POWER = 62467, + SPELL_STONEBARK_ESSENCE = 62483, + SPELL_IRONBRANCH_ESSENCE = 62484, + SPELL_BRIGHTLEAF_ESSENCE = 62485, + + // BRIGHTLEAF + SPELL_BRIGHTLEAF_FLUX = 62239, + SPELL_SOLAR_FLARE_10 = 62240, + SPELL_SOLAR_FLARE_25 = 64087, + SPELL_UNSTABLE_SUN_BEAM_AURA = 62211, + SPELL_PHOTOSYNTHESIS = 62209, + SPELL_UNSTABLE_SUN_DAMAGE_10 = 62217, + SPELL_UNSTABLE_SUN_DAMAGE_25 = 62922, + + // IRONBRANCH + SPELL_IMPALE_10 = 62310, + SPELL_IMPALE_25 = 62928, + SPELL_IRON_ROOTS_10 = 62275, + SPELL_IRON_ROOTS_25 = 62929, + SPELL_IRON_ROOTS_DAMAGE_10 = 62283, + SPELL_IRON_ROOTS_DAMAGE_25 = 62930, + SPELL_THORN_SWARM_10 = 62285, + SPELL_THORN_SWARM_25 = 62931, + + // STONEBARK + SPELL_FISTS_OF_STONE = 62344, + SPELL_GROUND_TREMOR_10 = 62325, + SPELL_GROUND_TREMOR_25 = 62932, + SPELL_PETRIFIED_BARK_10 = 62337, + SPELL_PETRIFIED_BARK_25 = 62933, - // SNAPLASHER - SPELL_HARDENED_BARK_10 = 62664, - SPELL_HARDENED_BARK_25 = 64191, + // SNAPLASHER + SPELL_HARDENED_BARK_10 = 62664, + SPELL_HARDENED_BARK_25 = 64191, - // ANCIENT WATER SPIRIT - SPELL_TIDAL_WAVE_10 = 62653, - SPELL_TIDAL_WAVE_25 = 62935, - SPELL_TIDAL_WAVE_DAMAGE_10 = 62654, - SPELL_TIDAL_WAVE_DAMAGE_25 = 62936, - SPELL_TIDAL_WAVE_AURA = 62655, + // ANCIENT WATER SPIRIT + SPELL_TIDAL_WAVE_10 = 62653, + SPELL_TIDAL_WAVE_25 = 62935, + SPELL_TIDAL_WAVE_DAMAGE_10 = 62654, + SPELL_TIDAL_WAVE_DAMAGE_25 = 62936, + SPELL_TIDAL_WAVE_AURA = 62655, - // STORM LASHER - SPELL_LIGHTNING_LASH_10 = 62648, - SPELL_LIGHTNING_LASH_25 = 62939, - SPELL_STORMBOLT_10 = 62649, - SPELL_STORMBOLT_25 = 62938, + // STORM LASHER + SPELL_LIGHTNING_LASH_10 = 62648, + SPELL_LIGHTNING_LASH_25 = 62939, + SPELL_STORMBOLT_10 = 62649, + SPELL_STORMBOLT_25 = 62938, - // ANCIENT CONSERVATOR - SPELL_CONSERVATOR_GRIP = 62532, - SPELL_NATURE_FURY_10 = 62589, - SPELL_NATURE_FURY_25 = 63571, - SPELL_POTENT_PHEROMONES = 62541, - SPELL_HEALTHY_SPORE_VISUAL = 62538, - SPELL_HEALTHY_SPORE_SUMMON = 62566, + // ANCIENT CONSERVATOR + SPELL_CONSERVATOR_GRIP = 62532, + SPELL_NATURE_FURY_10 = 62589, + SPELL_NATURE_FURY_25 = 63571, + SPELL_POTENT_PHEROMONES = 62541, + SPELL_HEALTHY_SPORE_VISUAL = 62538, + SPELL_HEALTHY_SPORE_SUMMON = 62566, - // DETONATING LASHER - SPELL_DETONATE_10 = 62598, - SPELL_DETONATE_25 = 62937, - SPELL_FLAME_LASH = 62608, + // DETONATING LASHER + SPELL_DETONATE_10 = 62598, + SPELL_DETONATE_25 = 62937, + SPELL_FLAME_LASH = 62608, - // ACHIEVEMENT - SPELL_DEFORESTATION_CREDIT = 65015, + // ACHIEVEMENT + SPELL_DEFORESTATION_CREDIT = 65015, }; -#define SPELL_GROUND_TREMOR RAID_MODE(SPELL_GROUND_TREMOR_10, SPELL_GROUND_TREMOR_25) -#define SPELL_PETRIFIED_BARK RAID_MODE(SPELL_PETRIFIED_BARK_10, SPELL_PETRIFIED_BARK_25) -#define SPELL_IRON_ROOTS RAID_MODE(SPELL_IRON_ROOTS_10, SPELL_IRON_ROOTS_25) -#define SPELL_IMPALE RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25) -#define SPELL_THORN_SWARM RAID_MODE(SPELL_THORN_SWARM_10, SPELL_THORN_SWARM_25) -#define SPELL_UNSTABLE_SUN_DAMAGE RAID_MODE(SPELL_UNSTABLE_SUN_DAMAGE_10, SPELL_UNSTABLE_SUN_DAMAGE_25) -#define SPELL_SOLAR_FLARE RAID_MODE(SPELL_SOLAR_FLARE_10, SPELL_SOLAR_FLARE_25) -#define SPELL_TOUCH_OF_EONAR RAID_MODE(SPELL_TOUCH_OF_EONAR_10, SPELL_TOUCH_OF_EONAR_25) -#define SPELL_LIFEBINDER_HEAL RAID_MODE(SPELL_LIFEBINDER_HEAL_10, SPELL_LIFEBINDER_HEAL_25) -#define SPELL_TIDAL_WAVE RAID_MODE(SPELL_TIDAL_WAVE_10, SPELL_TIDAL_WAVE_25) -#define SPELL_TIDAL_WAVE_DAMAGE RAID_MODE(SPELL_TIDAL_WAVE_DAMAGE_10, SPELL_TIDAL_WAVE_DAMAGE_25) -#define SPELL_NATURE_FURY RAID_MODE(SPELL_NATURE_FURY_10, SPELL_NATURE_FURY_25) -#define SPELL_HARDENED_BARK RAID_MODE(SPELL_HARDENED_BARK_10, SPELL_HARDENED_BARK_25) -#define SPELL_DETONATE RAID_MODE(SPELL_DETONATE_10, SPELL_DETONATE_25) -#define SPELL_NATURE_BOMB_DAMAGE RAID_MODE(SPELL_NATURE_BOMB_DAMAGE_10, SPELL_NATURE_BOMB_DAMAGE_25) -#define SPELL_SUNBEAM RAID_MODE(SPELL_SUNBEAM_10, SPELL_SUNBEAM_25) -#define SPELL_GROUND_TREMOR_FREYA RAID_MODE(SPELL_GROUND_TREMOR_FREYA_10, SPELL_GROUND_TREMOR_FREYA_25) -#define SPELL_IRON_ROOTS_FREYA RAID_MODE(SPELL_IRON_ROOTS_FREYA_10, SPELL_IRON_ROOTS_FREYA_25) -#define SPELL_UNSTABLE_SUN_FREYA_DAMAGE RAID_MODE(SPELL_UNSTABLE_SUN_FREYA_DAMAGE_10, SPELL_UNSTABLE_SUN_FREYA_DAMAGE_25) -#define SPELL_LIGHTNING_LASH RAID_MODE(SPELL_LIGHTNING_LASH_10, SPELL_LIGHTNING_LASH_25) -#define SPELL_STORMBOLT RAID_MODE(SPELL_STORMBOLT_10, SPELL_STORMBOLT_25) +#define SPELL_GROUND_TREMOR RAID_MODE(SPELL_GROUND_TREMOR_10, SPELL_GROUND_TREMOR_25) +#define SPELL_PETRIFIED_BARK RAID_MODE(SPELL_PETRIFIED_BARK_10, SPELL_PETRIFIED_BARK_25) +#define SPELL_IRON_ROOTS RAID_MODE(SPELL_IRON_ROOTS_10, SPELL_IRON_ROOTS_25) +#define SPELL_IMPALE RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25) +#define SPELL_THORN_SWARM RAID_MODE(SPELL_THORN_SWARM_10, SPELL_THORN_SWARM_25) +#define SPELL_UNSTABLE_SUN_DAMAGE RAID_MODE(SPELL_UNSTABLE_SUN_DAMAGE_10, SPELL_UNSTABLE_SUN_DAMAGE_25) +#define SPELL_SOLAR_FLARE RAID_MODE(SPELL_SOLAR_FLARE_10, SPELL_SOLAR_FLARE_25) +#define SPELL_TOUCH_OF_EONAR RAID_MODE(SPELL_TOUCH_OF_EONAR_10, SPELL_TOUCH_OF_EONAR_25) +#define SPELL_LIFEBINDER_HEAL RAID_MODE(SPELL_LIFEBINDER_HEAL_10, SPELL_LIFEBINDER_HEAL_25) +#define SPELL_TIDAL_WAVE RAID_MODE(SPELL_TIDAL_WAVE_10, SPELL_TIDAL_WAVE_25) +#define SPELL_TIDAL_WAVE_DAMAGE RAID_MODE(SPELL_TIDAL_WAVE_DAMAGE_10, SPELL_TIDAL_WAVE_DAMAGE_25) +#define SPELL_NATURE_FURY RAID_MODE(SPELL_NATURE_FURY_10, SPELL_NATURE_FURY_25) +#define SPELL_HARDENED_BARK RAID_MODE(SPELL_HARDENED_BARK_10, SPELL_HARDENED_BARK_25) +#define SPELL_DETONATE RAID_MODE(SPELL_DETONATE_10, SPELL_DETONATE_25) +#define SPELL_NATURE_BOMB_DAMAGE RAID_MODE(SPELL_NATURE_BOMB_DAMAGE_10, SPELL_NATURE_BOMB_DAMAGE_25) +#define SPELL_SUNBEAM RAID_MODE(SPELL_SUNBEAM_10, SPELL_SUNBEAM_25) +#define SPELL_GROUND_TREMOR_FREYA RAID_MODE(SPELL_GROUND_TREMOR_FREYA_10, SPELL_GROUND_TREMOR_FREYA_25) +#define SPELL_IRON_ROOTS_FREYA RAID_MODE(SPELL_IRON_ROOTS_FREYA_10, SPELL_IRON_ROOTS_FREYA_25) +#define SPELL_UNSTABLE_SUN_FREYA_DAMAGE RAID_MODE(SPELL_UNSTABLE_SUN_FREYA_DAMAGE_10, SPELL_UNSTABLE_SUN_FREYA_DAMAGE_25) +#define SPELL_LIGHTNING_LASH RAID_MODE(SPELL_LIGHTNING_LASH_10, SPELL_LIGHTNING_LASH_25) +#define SPELL_STORMBOLT RAID_MODE(SPELL_STORMBOLT_10, SPELL_STORMBOLT_25) enum FreyaEvents { - // FREYA - EVENT_FREYA_ADDS_SPAM = 1, - EVENT_FREYA_LIFEBINDER = 2, - EVENT_FREYA_NATURE_BOMB = 3, - EVENT_FREYA_SUNBEAM = 4, - EVENT_FREYA_BERSERK = 5, - // HARD MODE - EVENT_FREYA_GROUND_TREMOR = 6, - EVENT_FREYA_IRON_ROOT = 7, - EVENT_FREYA_UNSTABLE_SUN_BEAM = 8, - EVENT_FREYA_RESPAWN_TRIO = 9, + // FREYA + EVENT_FREYA_ADDS_SPAM = 1, + EVENT_FREYA_LIFEBINDER = 2, + EVENT_FREYA_NATURE_BOMB = 3, + EVENT_FREYA_SUNBEAM = 4, + EVENT_FREYA_BERSERK = 5, + // HARD MODE + EVENT_FREYA_GROUND_TREMOR = 6, + EVENT_FREYA_IRON_ROOT = 7, + EVENT_FREYA_UNSTABLE_SUN_BEAM = 8, + EVENT_FREYA_RESPAWN_TRIO = 9, - // STONEBARK - EVENT_STONEBARK_FISTS_OF_STONE = 10, - EVENT_STONEBARK_GROUND_TREMOR = 11, - EVENT_STONEBARK_PETRIFIED_BARK = 12, + // STONEBARK + EVENT_STONEBARK_FISTS_OF_STONE = 10, + EVENT_STONEBARK_GROUND_TREMOR = 11, + EVENT_STONEBARK_PETRIFIED_BARK = 12, - // BRIGHTLEAF - EVENT_BRIGHTLEAF_FLUX = 20, - EVENT_BRIGHTLEAF_SOLAR_FLARE = 21, - EVENT_BRIGHTLEAF_UNSTABLE_SUN_BEAM = 22, - EVENT_BRIGHTLEAF_DESPAWN_SUN_BEAM = 23, + // BRIGHTLEAF + EVENT_BRIGHTLEAF_FLUX = 20, + EVENT_BRIGHTLEAF_SOLAR_FLARE = 21, + EVENT_BRIGHTLEAF_UNSTABLE_SUN_BEAM = 22, + EVENT_BRIGHTLEAF_DESPAWN_SUN_BEAM = 23, - // IRONBRANCH - EVENT_IRONBRANCH_IMPALE = 30, - EVENT_IRONBRANCH_IRON_ROOT = 31, - EVENT_IRONBRANCH_THORN_SWARM = 32, + // IRONBRANCH + EVENT_IRONBRANCH_IMPALE = 30, + EVENT_IRONBRANCH_IRON_ROOT = 31, + EVENT_IRONBRANCH_THORN_SWARM = 32, - // SUMMONS - EVENT_ANCIENT_CONSERVATOR_NATURE_FURY = 40, - EVENT_WATER_SPIRIT_CHARGE = 45, - EVENT_WATER_SPIRIT_DAMAGE = 46, - EVENT_STORM_LASHER_LIGHTNING_LASH = 50, - EVENT_STORM_LASHER_STORMBOLT = 51, - EVENT_DETONATING_LASHER_FLAME_LASH = 55, + // SUMMONS + EVENT_ANCIENT_CONSERVATOR_NATURE_FURY = 40, + EVENT_WATER_SPIRIT_CHARGE = 45, + EVENT_WATER_SPIRIT_DAMAGE = 46, + EVENT_STORM_LASHER_LIGHTNING_LASH = 50, + EVENT_STORM_LASHER_STORMBOLT = 51, + EVENT_DETONATING_LASHER_FLAME_LASH = 55, }; enum FreyaSounds { - // STONEBARK - SOUND_STONEBARK_AGGRO = 15500, - SOUND_STONEBARK_SLAY1 = 15501, - SOUND_STONEBARK_SLAY2 = 15502, - SOUND_STONEBARK_DEATH = 15503, - - // IRONBRANCH - SOUND_IRONBRANCH_AGGRO = 15493, - SOUND_IRONBRANCH_SLAY1 = 15494, - SOUND_IRONBRANCH_SLAY2 = 15495, - SOUND_IRONBRANCH_DEATH = 15496, + // STONEBARK + SOUND_STONEBARK_AGGRO = 15500, + SOUND_STONEBARK_SLAY1 = 15501, + SOUND_STONEBARK_SLAY2 = 15502, + SOUND_STONEBARK_DEATH = 15503, + + // IRONBRANCH + SOUND_IRONBRANCH_AGGRO = 15493, + SOUND_IRONBRANCH_SLAY1 = 15494, + SOUND_IRONBRANCH_SLAY2 = 15495, + SOUND_IRONBRANCH_DEATH = 15496, - // BRIGHTLEAF - SOUND_BRIGHTLEAF_AGGRO = 15483, - SOUND_BRIGHTLEAF_SLAY1 = 15485, - SOUND_BRIGHTLEAF_SLAY2 = 15486, - SOUND_BRIGHTLEAF_DEATH = 15487, + // BRIGHTLEAF + SOUND_BRIGHTLEAF_AGGRO = 15483, + SOUND_BRIGHTLEAF_SLAY1 = 15485, + SOUND_BRIGHTLEAF_SLAY2 = 15486, + SOUND_BRIGHTLEAF_DEATH = 15487, }; enum FreyaNPCs -{ - NPC_NATURE_BOMB = 34129, - NPC_IRON_ROOT_TRIGGER = 33088, - NPC_FREYA_UNSTABLE_SUN_BEAM = 33170, - NPC_UNSTABLE_SUN_BRIGHTLEAF = 33050, // 10 SECS? +{ + NPC_NATURE_BOMB = 34129, + NPC_IRON_ROOT_TRIGGER = 33088, + NPC_FREYA_UNSTABLE_SUN_BEAM = 33170, + NPC_UNSTABLE_SUN_BRIGHTLEAF = 33050, // 10 SECS? - // FIRST WAVE - NPC_STORM_LASHER = 32919, - NPC_ANCIENT_WATER_SPIRIT = 33202, - NPC_SNAPLASHER = 32916, + // FIRST WAVE + NPC_STORM_LASHER = 32919, + NPC_ANCIENT_WATER_SPIRIT = 33202, + NPC_SNAPLASHER = 32916, - // SEC WAVE - NPC_ANCIENT_CONSERVATOR = 33203, - NPC_HEALTHY_SPORE = 33215, - - // THIRD WAVE - NPC_DETONATING_LASHER = 32918, + // SEC WAVE + NPC_ANCIENT_CONSERVATOR = 33203, + NPC_HEALTHY_SPORE = 33215, + + // THIRD WAVE + NPC_DETONATING_LASHER = 32918, }; enum FreyaSouns { - SOUND_AGGRO = 15526, - SOUND_ELDERS = 15527, - SOUND_CONSERVATOR = 15528, - SOUND_SLAY1 = 15529, - SOUND_SLAY2 = 15530, - SOUND_DEATH = 15531, - SOUND_BERSERK = 15532, - SOUND_TRIO = 15533, - SOUND_DETONATING = 15534, - SOUND_ASKHELP = 15535, + SOUND_AGGRO = 15526, + SOUND_ELDERS = 15527, + SOUND_CONSERVATOR = 15528, + SOUND_SLAY1 = 15529, + SOUND_SLAY2 = 15530, + SOUND_DEATH = 15531, + SOUND_BERSERK = 15532, + SOUND_TRIO = 15533, + SOUND_DETONATING = 15534, + SOUND_ASKHELP = 15535, }; enum Misc { - ACTION_REMOVE_10_STACK = 10, - ACTION_REMOVE_25_STACK = 25, - ACTION_REMOVE_2_STACK = 2, - ACTION_RESPAWN_TRIO = 1, - ACTION_LUMBERJACKED = -1, + ACTION_REMOVE_10_STACK = 10, + ACTION_REMOVE_25_STACK = 25, + ACTION_REMOVE_2_STACK = 2, + ACTION_RESPAWN_TRIO = 1, + ACTION_LUMBERJACKED = -1, - EVENT_PHASE_ADDS = 1, - EVENT_PHASE_FINAL = 2, + EVENT_PHASE_ADDS = 1, + EVENT_PHASE_FINAL = 2, - DATA_GET_ELDER_COUNT = 1, - DATA_BACK_TO_NATURE = 2, + DATA_GET_ELDER_COUNT = 1, + DATA_BACK_TO_NATURE = 2, - CRITERIA_LUMBERJACKED = 21686, + CRITERIA_LUMBERJACKED = 21686, }; class boss_freya : public CreatureScript @@ -252,411 +252,411 @@ public: return new boss_freyaAI (pCreature); } - struct boss_freyaAI : public ScriptedAI - { - boss_freyaAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) - { - m_pInstance = pCreature->GetInstanceScript(); - if (!me->IsAlive()) - if (m_pInstance) - m_pInstance->SetData(TYPE_FREYA, DONE); - memset(_elderGUID, 0, sizeof(_elderGUID)); - } + struct boss_freyaAI : public ScriptedAI + { + boss_freyaAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) + { + m_pInstance = pCreature->GetInstanceScript(); + if (!me->IsAlive()) + if (m_pInstance) + m_pInstance->SetData(TYPE_FREYA, DONE); + memset(_elderGUID, 0, sizeof(_elderGUID)); + } - InstanceScript* m_pInstance; - EventMap events; - SummonList summons; + InstanceScript* m_pInstance; + EventMap events; + SummonList summons; - uint8 _waveNumber; - uint8 _trioKilled; - uint8 _spawnedAmount; - uint8 _lumberjacked; - bool _respawningTrio; - bool _backToNature; - uint8 _deforestation; - - uint64 _elderGUID[3]; + uint8 _waveNumber; + uint8 _trioKilled; + uint8 _spawnedAmount; + uint8 _lumberjacked; + bool _respawningTrio; + bool _backToNature; + uint8 _deforestation; + + uint64 _elderGUID[3]; - void Reset() - { - if (m_pInstance && m_pInstance->GetData(TYPE_FREYA) != DONE) - m_pInstance->SetData(TYPE_FREYA, NOT_STARTED); + void Reset() + { + if (m_pInstance && m_pInstance->GetData(TYPE_FREYA) != DONE) + m_pInstance->SetData(TYPE_FREYA, NOT_STARTED); - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); - for (uint8 i = 0; i < 3; ++i) - { - if (!_elderGUID[i]) - continue; + for (uint8 i = 0; i < 3; ++i) + { + if (!_elderGUID[i]) + continue; - if (Creature* elder = ObjectAccessor::GetCreature(*me, _elderGUID[i])) - elder->AI()->EnterEvadeMode(); - _elderGUID[i] = 0; - } + if (Creature* elder = ObjectAccessor::GetCreature(*me, _elderGUID[i])) + elder->AI()->EnterEvadeMode(); + _elderGUID[i] = 0; + } - _lumberjacked = 0; - _spawnedAmount = 0; - _trioKilled = 0; - _waveNumber = urand(1,3); - _respawningTrio = false; - _backToNature = true; - _deforestation = 0; - } + _lumberjacked = 0; + _spawnedAmount = 0; + _trioKilled = 0; + _waveNumber = urand(1,3); + _respawningTrio = false; + _backToNature = true; + _deforestation = 0; + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER || urand(0,2)) - return; + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER || urand(0,2)) + return; - if (urand(0,1)) - { - me->MonsterYell("Forgive me.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SLAY1); - } - else - { - me->MonsterYell("From your death springs life anew!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SLAY2); - } - } + if (urand(0,1)) + { + me->MonsterYell("Forgive me.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SLAY1); + } + else + { + me->MonsterYell("From your death springs life anew!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SLAY2); + } + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - // kaboom! - if (damage >= me->GetHealth()) - { - me->MonsterYell("His hold on me dissipates. I can see clearly once more. Thank you, heroes.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_DEATH); - - damage = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setFaction(35); - me->SetHealth(me->GetMaxHealth()); - me->CombatStop(); - me->RemoveAllAuras(); - events.Reset(); + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + // kaboom! + if (damage >= me->GetHealth()) + { + me->MonsterYell("His hold on me dissipates. I can see clearly once more. Thank you, heroes.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_DEATH); + + damage = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->setFaction(35); + me->SetHealth(me->GetMaxHealth()); + me->CombatStop(); + me->RemoveAllAuras(); + events.Reset(); - summons.DespawnAll(); - events.Reset(); + summons.DespawnAll(); + events.Reset(); - uint8 _elderCount = 0; - for (uint8 i = 0; i < 3; ++i) - { - if (!_elderGUID[i]) - continue; + uint8 _elderCount = 0; + for (uint8 i = 0; i < 3; ++i) + { + if (!_elderGUID[i]) + continue; - if (Creature* e = ObjectAccessor::GetCreature(*me, _elderGUID[i])) - Unit::Kill(e, e); + if (Creature* e = ObjectAccessor::GetCreature(*me, _elderGUID[i])) + Unit::Kill(e, e); - ++_elderCount; - } + ++_elderCount; + } - uint32 chestId = RAID_MODE(GO_FREYA_CHEST, GO_FREYA_CHEST_HERO); - chestId -= 2*_elderCount; // offset + uint32 chestId = RAID_MODE(GO_FREYA_CHEST, GO_FREYA_CHEST_HERO); + chestId -= 2*_elderCount; // offset - me->DespawnOrUnsummon(5000); - if (GameObject* go = me->SummonGameObject(chestId, 2345.61f, -71.20f, 425.104f, 3.0f, 0, 0, 0, 0, 0)) - go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); + me->DespawnOrUnsummon(5000); + if (GameObject* go = me->SummonGameObject(chestId, 2345.61f, -71.20f, 425.104f, 3.0f, 0, 0, 0, 0, 0)) + go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); - // Defeat credit - if (m_pInstance) - { - me->CastSpell(me, 65074, true); // credit - m_pInstance->SetData(TYPE_FREYA, DONE); - } - } - } + // Defeat credit + if (m_pInstance) + { + me->CastSpell(me, 65074, true); // credit + m_pInstance->SetData(TYPE_FREYA, DONE); + } + } + } - void JustSummoned(Creature* cr) - { - summons.Summon(cr); - } + void JustSummoned(Creature* cr) + { + summons.Summon(cr); + } - void SpawnWave() - { - _waveNumber = _waveNumber == 1 ? 3 : _waveNumber-1; + void SpawnWave() + { + _waveNumber = _waveNumber == 1 ? 3 : _waveNumber-1; - // Wave of three - if (_waveNumber == 1) - { - me->MonsterYell("Children, assist me!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_TRIO); - me->SummonCreature(NPC_ANCIENT_WATER_SPIRIT, me->GetPositionX()+urand(5,15), me->GetPositionY()+urand(5,15), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT)); - me->SummonCreature(NPC_STORM_LASHER, me->GetPositionX()+urand(5,15), me->GetPositionY()+urand(5,15), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT)); - me->SummonCreature(NPC_SNAPLASHER, me->GetPositionX()+urand(5,15), me->GetPositionY()+urand(5,15), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT)); - } - // Ancient Conservator - else if (_waveNumber == 2) - { - me->MonsterYell("Eonar, your servant requires aid!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_CONSERVATOR); - me->SummonCreature(NPC_ANCIENT_CONSERVATOR, me->GetPositionX()+urand(5,15), me->GetPositionY()+urand(5,15), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT), 0, TEMPSUMMON_CORPSE_DESPAWN); - } - // Detonating Lashers - else if (_waveNumber == 3) - { - me->MonsterYell("The swarm of the elements shall overtake you!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_DETONATING); - for (uint8 i = 0; i < 10; ++i) - me->SummonCreature(NPC_DETONATING_LASHER, me->GetPositionX()+urand(5,20), me->GetPositionY()+urand(5,20), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT), 0, TEMPSUMMON_CORPSE_DESPAWN); - } - } + // Wave of three + if (_waveNumber == 1) + { + me->MonsterYell("Children, assist me!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_TRIO); + me->SummonCreature(NPC_ANCIENT_WATER_SPIRIT, me->GetPositionX()+urand(5,15), me->GetPositionY()+urand(5,15), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT)); + me->SummonCreature(NPC_STORM_LASHER, me->GetPositionX()+urand(5,15), me->GetPositionY()+urand(5,15), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT)); + me->SummonCreature(NPC_SNAPLASHER, me->GetPositionX()+urand(5,15), me->GetPositionY()+urand(5,15), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT)); + } + // Ancient Conservator + else if (_waveNumber == 2) + { + me->MonsterYell("Eonar, your servant requires aid!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_CONSERVATOR); + me->SummonCreature(NPC_ANCIENT_CONSERVATOR, me->GetPositionX()+urand(5,15), me->GetPositionY()+urand(5,15), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT), 0, TEMPSUMMON_CORPSE_DESPAWN); + } + // Detonating Lashers + else if (_waveNumber == 3) + { + me->MonsterYell("The swarm of the elements shall overtake you!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_DETONATING); + for (uint8 i = 0; i < 10; ++i) + me->SummonCreature(NPC_DETONATING_LASHER, me->GetPositionX()+urand(5,20), me->GetPositionY()+urand(5,20), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT), 0, TEMPSUMMON_CORPSE_DESPAWN); + } + } - void DoAction(int32 param) - { - if (param == ACTION_LUMBERJACKED) - { - if (!m_pInstance) - return; + void DoAction(int32 param) + { + if (param == ACTION_LUMBERJACKED) + { + if (!m_pInstance) + return; - ++_lumberjacked; - if (_lumberjacked == 1) - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, CRITERIA_LUMBERJACKED); - else if (_lumberjacked == 3) - m_pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65296 /*SPELL_LUMBERJACKED*/, 0, me); - return; - } + ++_lumberjacked; + if (_lumberjacked == 1) + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, CRITERIA_LUMBERJACKED); + else if (_lumberjacked == 3) + m_pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65296 /*SPELL_LUMBERJACKED*/, 0, me); + return; + } - if (param == ACTION_RESPAWN_TRIO) - { - if (!_respawningTrio) - { - _respawningTrio = true; - events.ScheduleEvent(EVENT_FREYA_RESPAWN_TRIO, 10000); - } + if (param == ACTION_RESPAWN_TRIO) + { + if (!_respawningTrio) + { + _respawningTrio = true; + events.ScheduleEvent(EVENT_FREYA_RESPAWN_TRIO, 10000); + } - ++_trioKilled; - return; - } + ++_trioKilled; + return; + } - // Deforestation Achievement Counter - if (param == ACTION_REMOVE_10_STACK) - { - ++_deforestation; - if (_deforestation >= 6 && m_pInstance) - m_pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_DEFORESTATION_CREDIT, 0, me); - // do not return - } + // Deforestation Achievement Counter + if (param == ACTION_REMOVE_10_STACK) + { + ++_deforestation; + if (_deforestation >= 6 && m_pInstance) + m_pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_DEFORESTATION_CREDIT, 0, me); + // do not return + } - if (Aura* aur = me->GetAura(SPELL_ATTUNED_TO_NATURE)) - { - // Back to Nature achievement - if (aur->GetStackAmount() - param < 25) - _backToNature = false; + if (Aura* aur = me->GetAura(SPELL_ATTUNED_TO_NATURE)) + { + // Back to Nature achievement + if (aur->GetStackAmount() - param < 25) + _backToNature = false; - if (aur->GetStackAmount() > param) - aur->SetStackAmount(aur->GetStackAmount()-param); - else // Aura out of stack - { - events.ScheduleEvent(EVENT_FREYA_NATURE_BOMB, 5000); - events.SetPhase(EVENT_PHASE_FINAL); - aur->Remove(); - return; - } - } - } + if (aur->GetStackAmount() > param) + aur->SetStackAmount(aur->GetStackAmount()-param); + else // Aura out of stack + { + events.ScheduleEvent(EVENT_FREYA_NATURE_BOMB, 5000); + events.SetPhase(EVENT_PHASE_FINAL); + aur->Remove(); + return; + } + } + } - uint32 GetData(uint32 param) const - { - if (param == DATA_GET_ELDER_COUNT) - { - uint8 _count = 0; - for (uint8 i = 0; i < 3; ++i) - if (_elderGUID[i]) - ++_count; + uint32 GetData(uint32 param) const + { + if (param == DATA_GET_ELDER_COUNT) + { + uint8 _count = 0; + for (uint8 i = 0; i < 3; ++i) + if (_elderGUID[i]) + ++_count; - return _count; - } - if (param == DATA_BACK_TO_NATURE) - return _backToNature; + return _count; + } + if (param == DATA_BACK_TO_NATURE) + return _backToNature; - return 0; - } + return 0; + } - void JustReachedHome() { me->setActive(false); } + void JustReachedHome() { me->setActive(false); } - void EnterCombat(Unit*) - { - me->setActive(true); - me->SetInCombatWithZone(); - me->CastSpell(me, SPELL_TOUCH_OF_EONAR, true); - if (Aura* aur = me->AddAura(SPELL_ATTUNED_TO_NATURE, me)) - aur->SetStackAmount(150); + void EnterCombat(Unit*) + { + me->setActive(true); + me->SetInCombatWithZone(); + me->CastSpell(me, SPELL_TOUCH_OF_EONAR, true); + if (Aura* aur = me->AddAura(SPELL_ATTUNED_TO_NATURE, me)) + aur->SetStackAmount(150); - events.ScheduleEvent(EVENT_FREYA_ADDS_SPAM, 10000, 0, EVENT_PHASE_ADDS); - events.ScheduleEvent(EVENT_FREYA_LIFEBINDER, 30000); - events.ScheduleEvent(EVENT_FREYA_SUNBEAM, 17000); - events.ScheduleEvent(EVENT_FREYA_BERSERK, 600000); - events.SetPhase(EVENT_PHASE_ADDS); + events.ScheduleEvent(EVENT_FREYA_ADDS_SPAM, 10000, 0, EVENT_PHASE_ADDS); + events.ScheduleEvent(EVENT_FREYA_LIFEBINDER, 30000); + events.ScheduleEvent(EVENT_FREYA_SUNBEAM, 17000); + events.ScheduleEvent(EVENT_FREYA_BERSERK, 600000); + events.SetPhase(EVENT_PHASE_ADDS); - if( !m_pInstance ) - return; + if( !m_pInstance ) + return; - if (m_pInstance->GetData(TYPE_FREYA) != DONE) - m_pInstance->SetData(TYPE_FREYA, IN_PROGRESS); + if (m_pInstance->GetData(TYPE_FREYA) != DONE) + m_pInstance->SetData(TYPE_FREYA, IN_PROGRESS); - // HARD MODE CHECKS - Creature* elder = NULL; - elder = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_ELDER_STONEBARK)); - if (elder && elder->IsAlive()) - { - elder->CastSpell(elder, SPELL_DRAINED_OF_POWER, true); - elder->CastSpell(elder, SPELL_STONEBARK_ESSENCE, true); - elder->SetInCombatWithZone(); + // HARD MODE CHECKS + Creature* elder = NULL; + elder = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_ELDER_STONEBARK)); + if (elder && elder->IsAlive()) + { + elder->CastSpell(elder, SPELL_DRAINED_OF_POWER, true); + elder->CastSpell(elder, SPELL_STONEBARK_ESSENCE, true); + elder->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_FREYA_GROUND_TREMOR, 35000); - _elderGUID[0] = elder->GetGUID(); - } + events.ScheduleEvent(EVENT_FREYA_GROUND_TREMOR, 35000); + _elderGUID[0] = elder->GetGUID(); + } - elder = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_ELDER_IRONBRANCH)); - if (elder && elder->IsAlive()) - { - elder->CastSpell(elder, SPELL_DRAINED_OF_POWER, true); - elder->CastSpell(elder, SPELL_IRONBRANCH_ESSENCE, true); - elder->SetInCombatWithZone(); + elder = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_ELDER_IRONBRANCH)); + if (elder && elder->IsAlive()) + { + elder->CastSpell(elder, SPELL_DRAINED_OF_POWER, true); + elder->CastSpell(elder, SPELL_IRONBRANCH_ESSENCE, true); + elder->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_FREYA_IRON_ROOT, 20000); - _elderGUID[1] = elder->GetGUID(); - } + events.ScheduleEvent(EVENT_FREYA_IRON_ROOT, 20000); + _elderGUID[1] = elder->GetGUID(); + } - elder = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_ELDER_BRIGHTLEAF)); - if (elder && elder->IsAlive()) - { - elder->CastSpell(elder, SPELL_DRAINED_OF_POWER, true); - elder->CastSpell(elder, SPELL_BRIGHTLEAF_ESSENCE, true); - elder->SetInCombatWithZone(); + elder = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_ELDER_BRIGHTLEAF)); + if (elder && elder->IsAlive()) + { + elder->CastSpell(elder, SPELL_DRAINED_OF_POWER, true); + elder->CastSpell(elder, SPELL_BRIGHTLEAF_ESSENCE, true); + elder->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_FREYA_UNSTABLE_SUN_BEAM, 60000); - _elderGUID[2] = elder->GetGUID(); - } + events.ScheduleEvent(EVENT_FREYA_UNSTABLE_SUN_BEAM, 60000); + _elderGUID[2] = elder->GetGUID(); + } - if (_elderGUID[0] || _elderGUID[1] || _elderGUID[2]) - { - me->MonsterYell("Elders, grant me your strength!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_ELDERS); - } - else - { - me->MonsterYell("The Conservatory must be protected!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_AGGRO); - } - } + if (_elderGUID[0] || _elderGUID[1] || _elderGUID[2]) + { + me->MonsterYell("Elders, grant me your strength!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_ELDERS); + } + else + { + me->MonsterYell("The Conservatory must be protected!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_AGGRO); + } + } - void SpellHitTarget(Unit *target, const SpellInfo *spell) - { - if (spell->Id == SPELL_NATURE_BOMB_FLIGHT) - me->SummonCreature(NPC_NATURE_BOMB, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); - } + void SpellHitTarget(Unit *target, const SpellInfo *spell) + { + if (spell->Id == SPELL_NATURE_BOMB_FLIGHT) + me->SummonCreature(NPC_NATURE_BOMB, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_FREYA_ADDS_SPAM: - if (_spawnedAmount < 6) - SpawnWave(); - else if (me->GetAura(SPELL_ATTUNED_TO_NATURE)) - { - me->RemoveAura(SPELL_ATTUNED_TO_NATURE); - events.ScheduleEvent(EVENT_FREYA_NATURE_BOMB, 5000); - events.SetPhase(EVENT_PHASE_FINAL); - events.PopEvent(); - return; - } - _spawnedAmount++; - events.RepeatEvent(60000); - break; - case EVENT_FREYA_LIFEBINDER: - { - events.RepeatEvent(45000); - float x, y, z; - for (uint8 i = 0; i < 10; ++i) - { - x = me->GetPositionX()+urand(7,25); - y = me->GetPositionY()+urand(7,25); - z = me->GetMap()->GetHeight(x, y, MAX_HEIGHT)+0.5f; - if (me->IsWithinLOS(x, y, z)) - { - me->CastSpell(x, y, z, SPELL_SUMMON_LIFEBINDER, true); - return; - } - } + switch (events.GetEvent()) + { + case EVENT_FREYA_ADDS_SPAM: + if (_spawnedAmount < 6) + SpawnWave(); + else if (me->GetAura(SPELL_ATTUNED_TO_NATURE)) + { + me->RemoveAura(SPELL_ATTUNED_TO_NATURE); + events.ScheduleEvent(EVENT_FREYA_NATURE_BOMB, 5000); + events.SetPhase(EVENT_PHASE_FINAL); + events.PopEvent(); + return; + } + _spawnedAmount++; + events.RepeatEvent(60000); + break; + case EVENT_FREYA_LIFEBINDER: + { + events.RepeatEvent(45000); + float x, y, z; + for (uint8 i = 0; i < 10; ++i) + { + x = me->GetPositionX()+urand(7,25); + y = me->GetPositionY()+urand(7,25); + z = me->GetMap()->GetHeight(x, y, MAX_HEIGHT)+0.5f; + if (me->IsWithinLOS(x, y, z)) + { + me->CastSpell(x, y, z, SPELL_SUMMON_LIFEBINDER, true); + return; + } + } - me->CastSpell(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), SPELL_SUMMON_LIFEBINDER, true); - break; - } - case EVENT_FREYA_SUNBEAM: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(target, SPELL_SUNBEAM, false); - events.RepeatEvent(15000+urand(0,5000)); - break; - case EVENT_FREYA_RESPAWN_TRIO: - events.PopEvent(); - _deforestation = 0; - _respawningTrio = false; - if (_trioKilled < 3) - summons.DoAction(ACTION_RESPAWN_TRIO); + me->CastSpell(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), SPELL_SUMMON_LIFEBINDER, true); + break; + } + case EVENT_FREYA_SUNBEAM: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(target, SPELL_SUNBEAM, false); + events.RepeatEvent(15000+urand(0,5000)); + break; + case EVENT_FREYA_RESPAWN_TRIO: + events.PopEvent(); + _deforestation = 0; + _respawningTrio = false; + if (_trioKilled < 3) + summons.DoAction(ACTION_RESPAWN_TRIO); - _trioKilled = 0; - break; - case EVENT_FREYA_NATURE_BOMB: - { - uint8 _minCount = me->GetMap()->Is25ManRaid() ? urand(7,10) : urand(3,4); - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - if (me->GetDistance(itr->GetSource()) > 70 || !itr->GetSource()->IsAlive()) - continue; + _trioKilled = 0; + break; + case EVENT_FREYA_NATURE_BOMB: + { + uint8 _minCount = me->GetMap()->Is25ManRaid() ? urand(7,10) : urand(3,4); + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + if (me->GetDistance(itr->GetSource()) > 70 || !itr->GetSource()->IsAlive()) + continue; - me->CastSpell(itr->GetSource(), SPELL_NATURE_BOMB_FLIGHT, true); + me->CastSpell(itr->GetSource(), SPELL_NATURE_BOMB_FLIGHT, true); - if (!(--_minCount)) - break; - } - events.RepeatEvent(18000); - break; - } - case EVENT_FREYA_BERSERK: - me->MonsterYell("You have strayed too far, wasted too much time!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BERSERK); - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - break; - case EVENT_FREYA_GROUND_TREMOR: - me->CastSpell(me, SPELL_GROUND_TREMOR_FREYA, false); - events.RepeatEvent(25000+urand(0,10000)); - break; - case EVENT_FREYA_IRON_ROOT: - me->CastCustomSpell(SPELL_IRON_ROOTS_FREYA, SPELLVALUE_MAX_TARGETS, 1, me, false); - events.RepeatEvent(45000+urand(0,10000)); - break; - case EVENT_FREYA_UNSTABLE_SUN_BEAM: - if (Creature* cr = me->SummonCreature(NPC_FREYA_UNSTABLE_SUN_BEAM, me->GetPositionX()+urand(7,25), me->GetPositionY()+urand(7,25), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT), 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) - { - cr->CastSpell(cr, SPELL_UNSTABLE_SUN_VISUAL, true); - cr->CastSpell(cr, SPELL_UNSTABLE_SUN_FREYA_DAMAGE, true); - } - events.RepeatEvent(38000+urand(0,10000)); - break; - } + if (!(--_minCount)) + break; + } + events.RepeatEvent(18000); + break; + } + case EVENT_FREYA_BERSERK: + me->MonsterYell("You have strayed too far, wasted too much time!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BERSERK); + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + break; + case EVENT_FREYA_GROUND_TREMOR: + me->CastSpell(me, SPELL_GROUND_TREMOR_FREYA, false); + events.RepeatEvent(25000+urand(0,10000)); + break; + case EVENT_FREYA_IRON_ROOT: + me->CastCustomSpell(SPELL_IRON_ROOTS_FREYA, SPELLVALUE_MAX_TARGETS, 1, me, false); + events.RepeatEvent(45000+urand(0,10000)); + break; + case EVENT_FREYA_UNSTABLE_SUN_BEAM: + if (Creature* cr = me->SummonCreature(NPC_FREYA_UNSTABLE_SUN_BEAM, me->GetPositionX()+urand(7,25), me->GetPositionY()+urand(7,25), me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT), 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) + { + cr->CastSpell(cr, SPELL_UNSTABLE_SUN_VISUAL, true); + cr->CastSpell(cr, SPELL_UNSTABLE_SUN_FREYA_DAMAGE, true); + } + events.RepeatEvent(38000+urand(0,10000)); + break; + } - DoMeleeAttackIfReady(); - EnterEvadeIfOutOfCombatArea(); - } + DoMeleeAttackIfReady(); + EnterEvadeIfOutOfCombatArea(); + } - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetPositionX() < 2135.0f; - } - }; + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetPositionX() < 2135.0f; + } + }; }; class boss_freya_elder_stonebark : public CreatureScript @@ -669,100 +669,100 @@ public: return new boss_freya_elder_stonebarkAI (pCreature); } - struct boss_freya_elder_stonebarkAI : public ScriptedAI - { - boss_freya_elder_stonebarkAI(Creature* pCreature) : ScriptedAI(pCreature) - { - } + struct boss_freya_elder_stonebarkAI : public ScriptedAI + { + boss_freya_elder_stonebarkAI(Creature* pCreature) : ScriptedAI(pCreature) + { + } - EventMap events; - uint8 _chargesCount; + EventMap events; + uint8 _chargesCount; - void Reset() - { - events.Reset(); - _chargesCount = 0; - } + void Reset() + { + events.Reset(); + _chargesCount = 0; + } - void KilledUnit(Unit*) - { - if (urand(0,1)) - return; + void KilledUnit(Unit*) + { + if (urand(0,1)) + return; - if (urand(0,1)) - { - me->MonsterTextEmote("Angry roar", 0); - me->PlayDirectSound(SOUND_STONEBARK_SLAY1); - } - else - { - me->MonsterYell("Such a waste.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_STONEBARK_SLAY2); - } - } + if (urand(0,1)) + { + me->MonsterTextEmote("Angry roar", 0); + me->PlayDirectSound(SOUND_STONEBARK_SLAY1); + } + else + { + me->MonsterYell("Such a waste.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_STONEBARK_SLAY2); + } + } - void JustDied(Unit* killer) - { - if (me->GetEntry() == killer->GetEntry()) - return; - me->MonsterYell("Matron, flee! They are ruthless....", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_STONEBARK_DEATH); + void JustDied(Unit* killer) + { + if (me->GetEntry() == killer->GetEntry()) + return; + me->MonsterYell("Matron, flee! They are ruthless....", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_STONEBARK_DEATH); - // Lumberjacked - if (me->GetInstanceScript()) - if (Creature* freya = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_FREYA))) - freya->AI()->DoAction(ACTION_LUMBERJACKED); - } + // Lumberjacked + if (me->GetInstanceScript()) + if (Creature* freya = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_FREYA))) + freya->AI()->DoAction(ACTION_LUMBERJACKED); + } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_STONEBARK_FISTS_OF_STONE, 40000); - events.ScheduleEvent(EVENT_STONEBARK_GROUND_TREMOR, 5000); - events.ScheduleEvent(EVENT_STONEBARK_PETRIFIED_BARK, 20000); + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_STONEBARK_FISTS_OF_STONE, 40000); + events.ScheduleEvent(EVENT_STONEBARK_GROUND_TREMOR, 5000); + events.ScheduleEvent(EVENT_STONEBARK_PETRIFIED_BARK, 20000); - me->MonsterYell("This place will serve as your graveyard.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_STONEBARK_AGGRO); - } + me->MonsterYell("This place will serve as your graveyard.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_STONEBARK_AGGRO); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType damageType, SpellSchoolMask damageSchoolMask) - { - if ((damageType == DIRECT_DAMAGE || (damageType == SPELL_DIRECT_DAMAGE && damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)) && _chargesCount) - { - --_chargesCount; - damage = 0; - } - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType damageType, SpellSchoolMask damageSchoolMask) + { + if ((damageType == DIRECT_DAMAGE || (damageType == SPELL_DIRECT_DAMAGE && damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)) && _chargesCount) + { + --_chargesCount; + damage = 0; + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_STONEBARK_FISTS_OF_STONE: - me->CastSpell(me, SPELL_FISTS_OF_STONE, false); - events.RepeatEvent(60000); - break; - case EVENT_STONEBARK_GROUND_TREMOR: - if (!me->HasAura(SPELL_FISTS_OF_STONE)) - me->CastSpell(me, SPELL_GROUND_TREMOR, false); - events.RepeatEvent(20000); - break; - case EVENT_STONEBARK_PETRIFIED_BARK: - _chargesCount = RAID_MODE(60, 120); - me->CastSpell(me, SPELL_PETRIFIED_BARK, false); - events.RepeatEvent(30000); - break; - } + switch (events.GetEvent()) + { + case EVENT_STONEBARK_FISTS_OF_STONE: + me->CastSpell(me, SPELL_FISTS_OF_STONE, false); + events.RepeatEvent(60000); + break; + case EVENT_STONEBARK_GROUND_TREMOR: + if (!me->HasAura(SPELL_FISTS_OF_STONE)) + me->CastSpell(me, SPELL_GROUND_TREMOR, false); + events.RepeatEvent(20000); + break; + case EVENT_STONEBARK_PETRIFIED_BARK: + _chargesCount = RAID_MODE(60, 120); + me->CastSpell(me, SPELL_PETRIFIED_BARK, false); + events.RepeatEvent(30000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_freya_elder_brightleaf : public CreatureScript @@ -775,118 +775,118 @@ public: return new boss_freya_elder_brightleafAI (pCreature); } - struct boss_freya_elder_brightleafAI : public ScriptedAI - { - boss_freya_elder_brightleafAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) - { - } + struct boss_freya_elder_brightleafAI : public ScriptedAI + { + boss_freya_elder_brightleafAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) + { + } - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + } - void KilledUnit(Unit*) - { - if (urand(0,1)) - return; + void KilledUnit(Unit*) + { + if (urand(0,1)) + return; - if (urand(0,1)) - { - me->MonsterYell("Fertilizer.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRIGHTLEAF_SLAY1); - } - else - { - me->MonsterYell("Your corpse will nourish the soil!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRIGHTLEAF_SLAY2); - } - } + if (urand(0,1)) + { + me->MonsterYell("Fertilizer.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRIGHTLEAF_SLAY1); + } + else + { + me->MonsterYell("Your corpse will nourish the soil!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRIGHTLEAF_SLAY2); + } + } - void JustDied(Unit* killer) - { - if (me->GetEntry() == killer->GetEntry()) - return; - me->MonsterYell("Matron, one has fallen!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRIGHTLEAF_DEATH); + void JustDied(Unit* killer) + { + if (me->GetEntry() == killer->GetEntry()) + return; + me->MonsterYell("Matron, one has fallen!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRIGHTLEAF_DEATH); - // Lumberjacked - if (me->GetInstanceScript()) - if (Creature* freya = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_FREYA))) - freya->AI()->DoAction(ACTION_LUMBERJACKED); - } + // Lumberjacked + if (me->GetInstanceScript()) + if (Creature* freya = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_FREYA))) + freya->AI()->DoAction(ACTION_LUMBERJACKED); + } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_BRIGHTLEAF_FLUX, 10000); - events.ScheduleEvent(EVENT_BRIGHTLEAF_SOLAR_FLARE, 5000); - events.ScheduleEvent(EVENT_BRIGHTLEAF_UNSTABLE_SUN_BEAM, 8000); + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_BRIGHTLEAF_FLUX, 10000); + events.ScheduleEvent(EVENT_BRIGHTLEAF_SOLAR_FLARE, 5000); + events.ScheduleEvent(EVENT_BRIGHTLEAF_UNSTABLE_SUN_BEAM, 8000); - me->MonsterYell("Matron, the Conservatory has been breached!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BRIGHTLEAF_AGGRO); - } + me->MonsterYell("Matron, the Conservatory has been breached!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BRIGHTLEAF_AGGRO); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_BRIGHTLEAF_FLUX: - if (Aura* aur = me->AddAura(SPELL_BRIGHTLEAF_FLUX, me)) - aur->SetStackAmount(urand(1,10)); - events.RepeatEvent(10000); - break; - case EVENT_BRIGHTLEAF_SOLAR_FLARE: - if (Aura* aur = me->GetAura(SPELL_BRIGHTLEAF_FLUX)) - { - me->CastCustomSpell(SPELL_SOLAR_FLARE, SPELLVALUE_MAX_TARGETS, aur->GetStackAmount(), me, false); - me->RemoveAura(aur); - } - events.RepeatEvent(15000); - break; - case EVENT_BRIGHTLEAF_UNSTABLE_SUN_BEAM: - events.ScheduleEvent(EVENT_BRIGHTLEAF_DESPAWN_SUN_BEAM, 15000); - if (Creature* beam = me->SummonCreature(NPC_UNSTABLE_SUN_BRIGHTLEAF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())) - { - beam->CastSpell(beam, SPELL_UNSTABLE_SUN_BEAM_AURA, true); - beam->CastSpell(beam, SPELL_PHOTOSYNTHESIS, true); - summons.Summon(beam); - } - if (Creature* beam = me->SummonCreature(NPC_UNSTABLE_SUN_BRIGHTLEAF, me->GetPositionX()+8, me->GetPositionY()+8, me->GetPositionZ())) - { - beam->CastSpell(beam, SPELL_UNSTABLE_SUN_BEAM_AURA, true); - beam->CastSpell(beam, SPELL_PHOTOSYNTHESIS, true); - summons.Summon(beam); - } - events.RepeatEvent(20000); - break; - case EVENT_BRIGHTLEAF_DESPAWN_SUN_BEAM: - for (SummonList::iterator i = summons.begin(); i != summons.end();) - { - Creature* summon = ObjectAccessor::GetCreature(*me, *i); - ++i; - if (summon) - summon->CastSpell(summon, SPELL_UNSTABLE_SUN_DAMAGE, false); - } + switch (events.GetEvent()) + { + case EVENT_BRIGHTLEAF_FLUX: + if (Aura* aur = me->AddAura(SPELL_BRIGHTLEAF_FLUX, me)) + aur->SetStackAmount(urand(1,10)); + events.RepeatEvent(10000); + break; + case EVENT_BRIGHTLEAF_SOLAR_FLARE: + if (Aura* aur = me->GetAura(SPELL_BRIGHTLEAF_FLUX)) + { + me->CastCustomSpell(SPELL_SOLAR_FLARE, SPELLVALUE_MAX_TARGETS, aur->GetStackAmount(), me, false); + me->RemoveAura(aur); + } + events.RepeatEvent(15000); + break; + case EVENT_BRIGHTLEAF_UNSTABLE_SUN_BEAM: + events.ScheduleEvent(EVENT_BRIGHTLEAF_DESPAWN_SUN_BEAM, 15000); + if (Creature* beam = me->SummonCreature(NPC_UNSTABLE_SUN_BRIGHTLEAF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())) + { + beam->CastSpell(beam, SPELL_UNSTABLE_SUN_BEAM_AURA, true); + beam->CastSpell(beam, SPELL_PHOTOSYNTHESIS, true); + summons.Summon(beam); + } + if (Creature* beam = me->SummonCreature(NPC_UNSTABLE_SUN_BRIGHTLEAF, me->GetPositionX()+8, me->GetPositionY()+8, me->GetPositionZ())) + { + beam->CastSpell(beam, SPELL_UNSTABLE_SUN_BEAM_AURA, true); + beam->CastSpell(beam, SPELL_PHOTOSYNTHESIS, true); + summons.Summon(beam); + } + events.RepeatEvent(20000); + break; + case EVENT_BRIGHTLEAF_DESPAWN_SUN_BEAM: + for (SummonList::iterator i = summons.begin(); i != summons.end();) + { + Creature* summon = ObjectAccessor::GetCreature(*me, *i); + ++i; + if (summon) + summon->CastSpell(summon, SPELL_UNSTABLE_SUN_DAMAGE, false); + } - summons.DespawnAll(); - events.PopEvent(); - break; - } + summons.DespawnAll(); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_freya_elder_ironbranch : public CreatureScript @@ -899,88 +899,88 @@ public: return new boss_freya_elder_ironbranchAI (pCreature); } - struct boss_freya_elder_ironbranchAI : public ScriptedAI - { - boss_freya_elder_ironbranchAI(Creature* pCreature) : ScriptedAI(pCreature) - { - } + struct boss_freya_elder_ironbranchAI : public ScriptedAI + { + boss_freya_elder_ironbranchAI(Creature* pCreature) : ScriptedAI(pCreature) + { + } - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void KilledUnit(Unit*) - { - if (urand(0,1)) - return; + void KilledUnit(Unit*) + { + if (urand(0,1)) + return; - if (urand(0,1)) - { - me->MonsterYell("I return you whence you came!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_IRONBRANCH_SLAY1); - } - else - { - me->MonsterYell("BEGONE!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_IRONBRANCH_SLAY2); - } - } + if (urand(0,1)) + { + me->MonsterYell("I return you whence you came!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_IRONBRANCH_SLAY1); + } + else + { + me->MonsterYell("BEGONE!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_IRONBRANCH_SLAY2); + } + } - void JustDied(Unit* killer) - { - if (me->GetEntry() == killer->GetEntry()) - return; - me->MonsterYell("Freya! They come for you.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_IRONBRANCH_DEATH); + void JustDied(Unit* killer) + { + if (me->GetEntry() == killer->GetEntry()) + return; + me->MonsterYell("Freya! They come for you.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_IRONBRANCH_DEATH); - // Lumberjacked - if (me->GetInstanceScript()) - if (Creature* freya = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_FREYA))) - freya->AI()->DoAction(ACTION_LUMBERJACKED); - } + // Lumberjacked + if (me->GetInstanceScript()) + if (Creature* freya = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_FREYA))) + freya->AI()->DoAction(ACTION_LUMBERJACKED); + } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_IRONBRANCH_IMPALE, 10000); - events.ScheduleEvent(EVENT_IRONBRANCH_IRON_ROOT, 15000); - events.ScheduleEvent(EVENT_IRONBRANCH_THORN_SWARM, 3000); + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_IRONBRANCH_IMPALE, 10000); + events.ScheduleEvent(EVENT_IRONBRANCH_IRON_ROOT, 15000); + events.ScheduleEvent(EVENT_IRONBRANCH_THORN_SWARM, 3000); - me->MonsterYell("Mortals have no place here!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_IRONBRANCH_AGGRO); - } + me->MonsterYell("Mortals have no place here!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_IRONBRANCH_AGGRO); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_IRONBRANCH_IMPALE: - me->CastSpell(me->GetVictim(), SPELL_IMPALE, false); - events.RepeatEvent(17000); - break; - case EVENT_IRONBRANCH_IRON_ROOT: - me->CastCustomSpell(SPELL_IRON_ROOTS, SPELLVALUE_MAX_TARGETS, 1, me, false); - events.RepeatEvent(20000); - break; - case EVENT_IRONBRANCH_THORN_SWARM: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), SPELL_THORN_SWARM, false); - events.RepeatEvent(14000); - break; - } + switch (events.GetEvent()) + { + case EVENT_IRONBRANCH_IMPALE: + me->CastSpell(me->GetVictim(), SPELL_IMPALE, false); + events.RepeatEvent(17000); + break; + case EVENT_IRONBRANCH_IRON_ROOT: + me->CastCustomSpell(SPELL_IRON_ROOTS, SPELLVALUE_MAX_TARGETS, 1, me, false); + events.RepeatEvent(20000); + break; + case EVENT_IRONBRANCH_THORN_SWARM: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), SPELL_THORN_SWARM, false); + events.RepeatEvent(14000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_freya_iron_root : public CreatureScript @@ -993,24 +993,24 @@ public: return new boss_freya_iron_rootAI (pCreature); } - struct boss_freya_iron_rootAI : public NullCreatureAI - { - boss_freya_iron_rootAI(Creature* pCreature) : NullCreatureAI(pCreature) { } + struct boss_freya_iron_rootAI : public NullCreatureAI + { + boss_freya_iron_rootAI(Creature* pCreature) : NullCreatureAI(pCreature) { } - void JustDied(Unit*) - { - if (!me->IsSummon()) - return; + void JustDied(Unit*) + { + if (!me->IsSummon()) + return; - if (Unit* target = ObjectAccessor::GetUnit(*me, me->ToTempSummon()->GetSummonerGUID())) - { - if (me->GetEntry() == NPC_IRON_ROOT_TRIGGER) // Iron Branch spell - target->RemoveAura(target->GetMap()->Is25ManRaid() ? SPELL_IRON_ROOTS_DAMAGE_25 : SPELL_IRON_ROOTS_DAMAGE_10); - else - target->RemoveAura(target->GetMap()->Is25ManRaid() ? SPELL_IRON_ROOTS_FREYA_DAMAGE_25 : SPELL_IRON_ROOTS_FREYA_DAMAGE_10); - } - } - }; + if (Unit* target = ObjectAccessor::GetUnit(*me, me->ToTempSummon()->GetSummonerGUID())) + { + if (me->GetEntry() == NPC_IRON_ROOT_TRIGGER) // Iron Branch spell + target->RemoveAura(target->GetMap()->Is25ManRaid() ? SPELL_IRON_ROOTS_DAMAGE_25 : SPELL_IRON_ROOTS_DAMAGE_10); + else + target->RemoveAura(target->GetMap()->Is25ManRaid() ? SPELL_IRON_ROOTS_FREYA_DAMAGE_25 : SPELL_IRON_ROOTS_FREYA_DAMAGE_10); + } + } + }; }; class boss_freya_lifebinder : public CreatureScript @@ -1023,34 +1023,34 @@ public: return new boss_freya_lifebinderAI (pCreature); } - struct boss_freya_lifebinderAI : public NullCreatureAI - { - boss_freya_lifebinderAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - } + struct boss_freya_lifebinderAI : public NullCreatureAI + { + boss_freya_lifebinderAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + } - uint32 _healTimer; + uint32 _healTimer; - void Reset() - { - me->CastSpell(me, SPELL_LIFEBINDER_VISUAL, true); - me->CastSpell(me, SPELL_LIFEBINDER_PHERONOMES, true); - me->CastSpell(me, SPELL_AUTO_GROW, true); - _healTimer = 0; - } + void Reset() + { + me->CastSpell(me, SPELL_LIFEBINDER_VISUAL, true); + me->CastSpell(me, SPELL_LIFEBINDER_PHERONOMES, true); + me->CastSpell(me, SPELL_AUTO_GROW, true); + _healTimer = 0; + } - void UpdateAI(uint32 diff) - { - _healTimer += diff; - if (_healTimer >= 12000) - { - me->RemoveAurasDueToSpell(SPELL_AUTO_GROW); - me->CastSpell(me, me->GetMap()->Is25ManRaid() ? SPELL_LIFEBINDER_HEAL_25 : SPELL_LIFEBINDER_HEAL_10, true); - me->DespawnOrUnsummon(2000); - _healTimer = 0; - } - } - }; + void UpdateAI(uint32 diff) + { + _healTimer += diff; + if (_healTimer >= 12000) + { + me->RemoveAurasDueToSpell(SPELL_AUTO_GROW); + me->CastSpell(me, me->GetMap()->Is25ManRaid() ? SPELL_LIFEBINDER_HEAL_25 : SPELL_LIFEBINDER_HEAL_10, true); + me->DespawnOrUnsummon(2000); + _healTimer = 0; + } + } + }; }; @@ -1064,33 +1064,33 @@ public: return new boss_freya_healthy_sporeAI (pCreature); } - struct boss_freya_healthy_sporeAI : public NullCreatureAI - { - boss_freya_healthy_sporeAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - } + struct boss_freya_healthy_sporeAI : public NullCreatureAI + { + boss_freya_healthy_sporeAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + } - uint32 _despawnTimer; + uint32 _despawnTimer; - void Reset() - { - me->CastSpell(me, SPELL_POTENT_PHEROMONES, true); - me->CastSpell(me, SPELL_HEALTHY_SPORE_VISUAL, true); - me->CastSpell(me, SPELL_AUTO_GROW, true); - _despawnTimer = 0; - } + void Reset() + { + me->CastSpell(me, SPELL_POTENT_PHEROMONES, true); + me->CastSpell(me, SPELL_HEALTHY_SPORE_VISUAL, true); + me->CastSpell(me, SPELL_AUTO_GROW, true); + _despawnTimer = 0; + } - void UpdateAI(uint32 diff) - { - _despawnTimer += diff; - if (_despawnTimer >= 22000) - { - me->RemoveAurasDueToSpell(SPELL_AUTO_GROW); - me->DespawnOrUnsummon(2200); - _despawnTimer = 0; - } - } - }; + void UpdateAI(uint32 diff) + { + _despawnTimer += diff; + if (_despawnTimer >= 22000) + { + me->RemoveAurasDueToSpell(SPELL_AUTO_GROW); + me->DespawnOrUnsummon(2200); + _despawnTimer = 0; + } + } + }; }; class boss_freya_summons : public CreatureScript @@ -1103,135 +1103,135 @@ public: return new boss_freya_summonsAI (pCreature); } - struct boss_freya_summonsAI : public ScriptedAI - { - boss_freya_summonsAI(Creature* pCreature) : ScriptedAI(pCreature) - { - _freyaGUID = me->GetInstanceScript() ? me->GetInstanceScript()->GetData64(TYPE_FREYA) : 0; - _isTrio = me->GetEntry() == NPC_ANCIENT_WATER_SPIRIT || me->GetEntry() == NPC_STORM_LASHER || me->GetEntry() == NPC_SNAPLASHER; - _hasDied = false; - } + struct boss_freya_summonsAI : public ScriptedAI + { + boss_freya_summonsAI(Creature* pCreature) : ScriptedAI(pCreature) + { + _freyaGUID = me->GetInstanceScript() ? me->GetInstanceScript()->GetData64(TYPE_FREYA) : 0; + _isTrio = me->GetEntry() == NPC_ANCIENT_WATER_SPIRIT || me->GetEntry() == NPC_STORM_LASHER || me->GetEntry() == NPC_SNAPLASHER; + _hasDied = false; + } - EventMap events; - uint64 _freyaGUID; - uint8 _stackCount; - bool _hasDied; - bool _isTrio; + EventMap events; + uint64 _freyaGUID; + uint8 _stackCount; + bool _hasDied; + bool _isTrio; - void Reset() - { - _stackCount = 0; - events.Reset(); - if (Unit* target = SelectTargetFromPlayerList(70)) - AttackStart(target); - } + void Reset() + { + _stackCount = 0; + events.Reset(); + if (Unit* target = SelectTargetFromPlayerList(70)) + AttackStart(target); + } - void JustDied(Unit*) - { - if (Creature* freya = ObjectAccessor::GetCreature(*me, _freyaGUID)) - { - if (!_hasDied) - freya->AI()->DoAction(_stackCount); + void JustDied(Unit*) + { + if (Creature* freya = ObjectAccessor::GetCreature(*me, _freyaGUID)) + { + if (!_hasDied) + freya->AI()->DoAction(_stackCount); - if (_isTrio) - { - freya->AI()->DoAction(ACTION_RESPAWN_TRIO); - _hasDied = true; - } - } - if (me->GetEntry() == NPC_DETONATING_LASHER) - me->CastSpell(me, SPELL_DETONATE, true); - } + if (_isTrio) + { + freya->AI()->DoAction(ACTION_RESPAWN_TRIO); + _hasDied = true; + } + } + if (me->GetEntry() == NPC_DETONATING_LASHER) + me->CastSpell(me, SPELL_DETONATE, true); + } - void DoAction(int32 param) - { - if (_isTrio && param == ACTION_RESPAWN_TRIO) - { - me->setDeathState(JUST_RESPAWNED); - Reset(); - } - } + void DoAction(int32 param) + { + if (_isTrio && param == ACTION_RESPAWN_TRIO) + { + me->setDeathState(JUST_RESPAWNED); + Reset(); + } + } - void EnterCombat(Unit*) - { - if (me->GetEntry() == NPC_ANCIENT_CONSERVATOR) - { - me->CastSpell(me, SPELL_HEALTHY_SPORE_SUMMON, true); - me->CastSpell(me, SPELL_CONSERVATOR_GRIP, true); - events.ScheduleEvent(EVENT_ANCIENT_CONSERVATOR_NATURE_FURY, 14000); - _stackCount = ACTION_REMOVE_25_STACK; - } - else if (me->GetEntry() == NPC_ANCIENT_WATER_SPIRIT) - { - events.ScheduleEvent(EVENT_WATER_SPIRIT_CHARGE, 12000); - _stackCount = ACTION_REMOVE_10_STACK; - } - else if (me->GetEntry() == NPC_STORM_LASHER) - { - events.ScheduleEvent(EVENT_STORM_LASHER_LIGHTNING_LASH, 10000); - events.ScheduleEvent(EVENT_STORM_LASHER_STORMBOLT, 6000); - _stackCount = ACTION_REMOVE_10_STACK; - } - else if (me->GetEntry() == NPC_DETONATING_LASHER) - { - events.ScheduleEvent(EVENT_DETONATING_LASHER_FLAME_LASH, 10000); - _stackCount = ACTION_REMOVE_2_STACK; - } - else if (me->GetEntry() == NPC_SNAPLASHER) - { - me->CastSpell(me, SPELL_HARDENED_BARK, true); - _stackCount = ACTION_REMOVE_10_STACK; - } - } + void EnterCombat(Unit*) + { + if (me->GetEntry() == NPC_ANCIENT_CONSERVATOR) + { + me->CastSpell(me, SPELL_HEALTHY_SPORE_SUMMON, true); + me->CastSpell(me, SPELL_CONSERVATOR_GRIP, true); + events.ScheduleEvent(EVENT_ANCIENT_CONSERVATOR_NATURE_FURY, 14000); + _stackCount = ACTION_REMOVE_25_STACK; + } + else if (me->GetEntry() == NPC_ANCIENT_WATER_SPIRIT) + { + events.ScheduleEvent(EVENT_WATER_SPIRIT_CHARGE, 12000); + _stackCount = ACTION_REMOVE_10_STACK; + } + else if (me->GetEntry() == NPC_STORM_LASHER) + { + events.ScheduleEvent(EVENT_STORM_LASHER_LIGHTNING_LASH, 10000); + events.ScheduleEvent(EVENT_STORM_LASHER_STORMBOLT, 6000); + _stackCount = ACTION_REMOVE_10_STACK; + } + else if (me->GetEntry() == NPC_DETONATING_LASHER) + { + events.ScheduleEvent(EVENT_DETONATING_LASHER_FLAME_LASH, 10000); + _stackCount = ACTION_REMOVE_2_STACK; + } + else if (me->GetEntry() == NPC_SNAPLASHER) + { + me->CastSpell(me, SPELL_HARDENED_BARK, true); + _stackCount = ACTION_REMOVE_10_STACK; + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_ANCIENT_CONSERVATOR_NATURE_FURY: - me->CastSpell(me->GetVictim(), SPELL_NATURE_FURY, false); - events.RepeatEvent(14000); - break; - case EVENT_WATER_SPIRIT_CHARGE: - me->CastSpell(me, SPELL_TIDAL_WAVE_AURA, true); - me->CastSpell(me->GetVictim(), SPELL_TIDAL_WAVE, false); - events.RepeatEvent(12000); - events.ScheduleEvent(EVENT_WATER_SPIRIT_DAMAGE, 3000); - break; - case EVENT_WATER_SPIRIT_DAMAGE: - me->CastSpell(me, SPELL_TIDAL_WAVE_DAMAGE, false); - events.PopEvent(); - break; - case EVENT_STORM_LASHER_LIGHTNING_LASH: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_LIGHTNING_LASH, false); - events.RepeatEvent(10000); - break; - case EVENT_STORM_LASHER_STORMBOLT: - me->CastSpell(me->GetVictim(), SPELL_STORMBOLT, false); - events.RepeatEvent(6000); - break; - case EVENT_DETONATING_LASHER_FLAME_LASH: - me->CastSpell(me->GetVictim(), SPELL_FLAME_LASH, false); - DoResetThreat(); - if (Unit* target = SelectTargetFromPlayerList(80)) - AttackStart(target); - else - me->DespawnOrUnsummon(1); - events.RepeatEvent(10000); - break; - } + switch (events.GetEvent()) + { + case EVENT_ANCIENT_CONSERVATOR_NATURE_FURY: + me->CastSpell(me->GetVictim(), SPELL_NATURE_FURY, false); + events.RepeatEvent(14000); + break; + case EVENT_WATER_SPIRIT_CHARGE: + me->CastSpell(me, SPELL_TIDAL_WAVE_AURA, true); + me->CastSpell(me->GetVictim(), SPELL_TIDAL_WAVE, false); + events.RepeatEvent(12000); + events.ScheduleEvent(EVENT_WATER_SPIRIT_DAMAGE, 3000); + break; + case EVENT_WATER_SPIRIT_DAMAGE: + me->CastSpell(me, SPELL_TIDAL_WAVE_DAMAGE, false); + events.PopEvent(); + break; + case EVENT_STORM_LASHER_LIGHTNING_LASH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_LIGHTNING_LASH, false); + events.RepeatEvent(10000); + break; + case EVENT_STORM_LASHER_STORMBOLT: + me->CastSpell(me->GetVictim(), SPELL_STORMBOLT, false); + events.RepeatEvent(6000); + break; + case EVENT_DETONATING_LASHER_FLAME_LASH: + me->CastSpell(me->GetVictim(), SPELL_FLAME_LASH, false); + DoResetThreat(); + if (Unit* target = SelectTargetFromPlayerList(80)) + AttackStart(target); + else + me->DespawnOrUnsummon(1); + events.RepeatEvent(10000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_freya_nature_bomb : public CreatureScript @@ -1244,46 +1244,46 @@ public: return new boss_freya_nature_bombAI (pCreature); } - struct boss_freya_nature_bombAI : public NullCreatureAI - { - boss_freya_nature_bombAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - _goGUID = 0; - } + struct boss_freya_nature_bombAI : public NullCreatureAI + { + boss_freya_nature_bombAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + _goGUID = 0; + } - uint64 _goGUID; - uint32 _explodeTimer; + uint64 _goGUID; + uint32 _explodeTimer; - void Reset() - { - me->SetObjectScale(0.5f); - me->CastSpell(me, SPELL_GREEN_BANISH_STATE, true); + void Reset() + { + me->SetObjectScale(0.5f); + me->CastSpell(me, SPELL_GREEN_BANISH_STATE, true); - _explodeTimer = 0; - if (GameObject* go = me->SummonGameObject(194902 /*GO_NATURE_BOMB*/, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, 0, 0, 0, 0, 0)) - _goGUID = go->GetGUID(); - } + _explodeTimer = 0; + if (GameObject* go = me->SummonGameObject(194902 /*GO_NATURE_BOMB*/, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, 0, 0, 0, 0, 0)) + _goGUID = go->GetGUID(); + } - uint32 Timer; - void UpdateAI(uint32 diff) - { - _explodeTimer += diff; - if (_explodeTimer >= 11000) - { - me->CastSpell(me, me->GetMap()->Is25ManRaid() ? SPELL_NATURE_BOMB_DAMAGE_25 : SPELL_NATURE_BOMB_DAMAGE_10, false); - me->DespawnOrUnsummon(1000); - _explodeTimer = 0; - } + uint32 Timer; + void UpdateAI(uint32 diff) + { + _explodeTimer += diff; + if (_explodeTimer >= 11000) + { + me->CastSpell(me, me->GetMap()->Is25ManRaid() ? SPELL_NATURE_BOMB_DAMAGE_25 : SPELL_NATURE_BOMB_DAMAGE_10, false); + me->DespawnOrUnsummon(1000); + _explodeTimer = 0; + } - // Delay explosion a little, visual - if (_explodeTimer >= 5000 && _explodeTimer < 10000) - { - _explodeTimer = 10000; - if (GameObject* go = me->GetMap()->GetGameObject(_goGUID)) - go->SetGoState(GO_STATE_ACTIVE); - } - } - }; + // Delay explosion a little, visual + if (_explodeTimer >= 5000 && _explodeTimer < 10000) + { + _explodeTimer = 10000; + if (GameObject* go = me->GetMap()->GetGameObject(_goGUID)) + go->SetGoState(GO_STATE_ACTIVE); + } + } + }; }; class achievement_freya_getting_back_to_nature : public AchievementCriteriaScript @@ -1293,10 +1293,10 @@ class achievement_freya_getting_back_to_nature : public AchievementCriteriaScrip bool OnCheck(Player* player, Unit* target /*Freya*/) { - if (target) - if (target->GetAI()->GetData(DATA_BACK_TO_NATURE)) - return true; - return false; + if (target) + if (target->GetAI()->GetData(DATA_BACK_TO_NATURE)) + return true; + return false; } }; @@ -1310,27 +1310,27 @@ class achievement_freya_knock_on_wood : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target /*Freya*/) { - return target && _elderCount <= target->GetAI()->GetData(DATA_GET_ELDER_COUNT); + return target && _elderCount <= target->GetAI()->GetData(DATA_GET_ELDER_COUNT); } - + private: uint32 const _elderCount; }; void AddSC_boss_freya() { - new boss_freya(); - new boss_freya_elder_stonebark(); - new boss_freya_elder_brightleaf(); - new boss_freya_elder_ironbranch(); - new boss_freya_iron_root(); - new boss_freya_lifebinder(); - new boss_freya_healthy_spore(); - new boss_freya_summons(); - new boss_freya_nature_bomb(); + new boss_freya(); + new boss_freya_elder_stonebark(); + new boss_freya_elder_brightleaf(); + new boss_freya_elder_ironbranch(); + new boss_freya_iron_root(); + new boss_freya_lifebinder(); + new boss_freya_healthy_spore(); + new boss_freya_summons(); + new boss_freya_nature_bomb(); - new achievement_freya_getting_back_to_nature(); - new achievement_freya_knock_on_wood("achievement_freya_knock_on_wood", 1); - new achievement_freya_knock_on_wood("achievement_freya_knock_knock_on_wood", 2); - new achievement_freya_knock_on_wood("achievement_freya_knock_knock_knock_on_wood", 3); + new achievement_freya_getting_back_to_nature(); + new achievement_freya_knock_on_wood("achievement_freya_knock_on_wood", 1); + new achievement_freya_knock_on_wood("achievement_freya_knock_knock_on_wood", 2); + new achievement_freya_knock_on_wood("achievement_freya_knock_knock_knock_on_wood", 3); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 5c8733c60..1ed0600fa 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -13,697 +13,697 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum VezaxSpellData { - SPELL_VEZAX_BERSERK = 26662, + SPELL_VEZAX_BERSERK = 26662, - SPELL_VEZAX_SHADOW_CRASH = 62660, - SPELL_VEZAX_SHADOW_CRASH_DMG = 62659, - SPELL_VEZAX_SHADOW_CRASH_AREA_AURA = 63277, - SPELL_VEZAX_SHADOW_CRASH_AURA = 65269, + SPELL_VEZAX_SHADOW_CRASH = 62660, + SPELL_VEZAX_SHADOW_CRASH_DMG = 62659, + SPELL_VEZAX_SHADOW_CRASH_AREA_AURA = 63277, + SPELL_VEZAX_SHADOW_CRASH_AURA = 65269, - SPELL_SEARING_FLAMES = 62661, + SPELL_SEARING_FLAMES = 62661, - SPELL_SURGE_OF_DARKNESS = 62662, + SPELL_SURGE_OF_DARKNESS = 62662, - SPELL_MARK_OF_THE_FACELESS_AURA = 63276, - SPELL_MARK_OF_THE_FACELESS_EFFECT = 63278, + SPELL_MARK_OF_THE_FACELESS_AURA = 63276, + SPELL_MARK_OF_THE_FACELESS_EFFECT = 63278, - SPELL_AURA_OF_DESPAIR_1 = 62692, - SPELL_AURA_OF_DESPAIR_2 = 64848, - SPELL_CORRUPTED_RAGE = 68415, - SPELL_CORRUPTED_WISDOM = 64646, - SPELL_SHAMANISTIC_RAGE = 30823, - SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1 = 31876, + SPELL_AURA_OF_DESPAIR_1 = 62692, + SPELL_AURA_OF_DESPAIR_2 = 64848, + SPELL_CORRUPTED_RAGE = 68415, + SPELL_CORRUPTED_WISDOM = 64646, + SPELL_SHAMANISTIC_RAGE = 30823, + SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1 = 31876, - SPELL_SUMMON_SARONITE_VAPORS = 63081, - NPC_SARONITE_VAPORS = 33488, - SPELL_SARONITE_VAPORS_DMG = 63338, - SPELL_SARONITE_VAPORS_ENERGIZE = 63337, - SPELL_SARONITE_VAPORS_AURA = 63323, - SPELL_SARONITE_VAPORS_DUMMYAURA = 63322, + SPELL_SUMMON_SARONITE_VAPORS = 63081, + NPC_SARONITE_VAPORS = 33488, + SPELL_SARONITE_VAPORS_DMG = 63338, + SPELL_SARONITE_VAPORS_ENERGIZE = 63337, + SPELL_SARONITE_VAPORS_AURA = 63323, + SPELL_SARONITE_VAPORS_DUMMYAURA = 63322, - SPELL_SARONITE_ANIMUS_FORMATION_VISUAL = 63319, - SPELL_SUMMON_SARONITE_ANIMUS = 63145, - SPELL_SARONITE_BARRIER = 63364, - SPELL_PROFOUND_DARKNESS = 63420, + SPELL_SARONITE_ANIMUS_FORMATION_VISUAL = 63319, + SPELL_SUMMON_SARONITE_ANIMUS = 63145, + SPELL_SARONITE_BARRIER = 63364, + SPELL_PROFOUND_DARKNESS = 63420, }; enum VezaxNpcs { - // NPC_VEZAX = 33271, - NPC_VEZAX_BUNNY = 33500, - NPC_SARONITE_ANIMUS = 33524, + // NPC_VEZAX = 33271, + NPC_VEZAX_BUNNY = 33500, + NPC_SARONITE_ANIMUS = 33524, }; enum VezaxGOs { - // GO_VEZAX_DOOR = 194750, + // GO_VEZAX_DOOR = 194750, }; enum VezaxSounds { - SOUND_VEZAX_AGGRO = 15542, - SOUND_VEZAX_SLAIN_1 = 15543, - SOUND_VEZAX_SLAIN_2 = 15544, - SOUND_VEZAX_SURGE = 15545, - SOUND_VEZAX_DEATH = 15546, - SOUND_VEZAX_BERSERK = 15547, - SOUND_VEZAX_HARDMODE = 15548, + SOUND_VEZAX_AGGRO = 15542, + SOUND_VEZAX_SLAIN_1 = 15543, + SOUND_VEZAX_SLAIN_2 = 15544, + SOUND_VEZAX_SURGE = 15545, + SOUND_VEZAX_DEATH = 15546, + SOUND_VEZAX_BERSERK = 15547, + SOUND_VEZAX_HARDMODE = 15548, }; enum VezaxEvents { - EVENT_SPELL_VEZAX_SHADOW_CRASH = 1, - EVENT_SPELL_SEARING_FLAMES = 2, - EVENT_SPELL_SURGE_OF_DARKNESS = 3, - EVENT_SPELL_MARK_OF_THE_FACELESS = 4, - EVENT_SPELL_SUMMON_SARONITE_VAPORS = 5, - EVENT_SARONITE_VAPORS_SWIRL = 6, - EVENT_SPELL_SUMMON_SARONITE_ANIMUS = 7, - EVENT_DESPAWN_SARONITE_VAPORS = 8, - EVENT_SPELL_PROFOUND_DARKNESS = 9, - EVENT_BERSERK = 10, - EVENT_RESTORE_TARGET = 11, + EVENT_SPELL_VEZAX_SHADOW_CRASH = 1, + EVENT_SPELL_SEARING_FLAMES = 2, + EVENT_SPELL_SURGE_OF_DARKNESS = 3, + EVENT_SPELL_MARK_OF_THE_FACELESS = 4, + EVENT_SPELL_SUMMON_SARONITE_VAPORS = 5, + EVENT_SARONITE_VAPORS_SWIRL = 6, + EVENT_SPELL_SUMMON_SARONITE_ANIMUS = 7, + EVENT_DESPAWN_SARONITE_VAPORS = 8, + EVENT_SPELL_PROFOUND_DARKNESS = 9, + EVENT_BERSERK = 10, + EVENT_RESTORE_TARGET = 11, }; -#define TEXT_VEZAX_AGGRO "Your destruction will herald a new age of suffering!" -#define TEXT_VEZAX_SLAIN_1 "You thought to stand before the legions of death... and survive?" -#define TEXT_VEZAX_SLAIN_2 "Defiance... a flaw of mortality." -#define TEXT_VEZAX_SURGE "The black blood of Yogg-Saron courses through me! I. AM. UNSTOPPABLE!" -#define TEXT_VEZAX_BERSERK "Your defeat was inevitable!" -#define TEXT_VEZAX_DEATH "Oh, what horrors await...." -#define TEXT_VEZAX_HARDMODE "Behold, now! Terror, absolute!" +#define TEXT_VEZAX_AGGRO "Your destruction will herald a new age of suffering!" +#define TEXT_VEZAX_SLAIN_1 "You thought to stand before the legions of death... and survive?" +#define TEXT_VEZAX_SLAIN_2 "Defiance... a flaw of mortality." +#define TEXT_VEZAX_SURGE "The black blood of Yogg-Saron courses through me! I. AM. UNSTOPPABLE!" +#define TEXT_VEZAX_BERSERK "Your defeat was inevitable!" +#define TEXT_VEZAX_DEATH "Oh, what horrors await...." +#define TEXT_VEZAX_HARDMODE "Behold, now! Terror, absolute!" class boss_vezax : public CreatureScript { public: - boss_vezax() : CreatureScript("boss_vezax") { } + boss_vezax() : CreatureScript("boss_vezax") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_vezaxAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_vezaxAI (pCreature); + } - struct boss_vezaxAI : public ScriptedAI - { - boss_vezaxAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) - { - pInstance = pCreature->GetInstanceScript(); - } + struct boss_vezaxAI : public ScriptedAI + { + boss_vezaxAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) + { + pInstance = pCreature->GetInstanceScript(); + } - EventMap events; - SummonList summons; - uint8 vaporsCount; - bool hardmodeAvailable; - bool berserk; - bool bAchievShadowdodger; + EventMap events; + SummonList summons; + uint8 vaporsCount; + bool hardmodeAvailable; + bool berserk; + bool bAchievShadowdodger; - InstanceScript* pInstance; + InstanceScript* pInstance; - void Reset() - { - vaporsCount = 0; - hardmodeAvailable = true; - berserk = false; - bAchievShadowdodger = true; - events.Reset(); - summons.DespawnAll(); - me->SetLootMode(1); + void Reset() + { + vaporsCount = 0; + hardmodeAvailable = true; + berserk = false; + bAchievShadowdodger = true; + events.Reset(); + summons.DespawnAll(); + me->SetLootMode(1); - if (pInstance) - pInstance->SetData(TYPE_VEZAX, NOT_STARTED); - } + if (pInstance) + pInstance->SetData(TYPE_VEZAX, NOT_STARTED); + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - void EnterCombat(Unit* pWho) - { - me->setActive(true); - me->SetInCombatWithZone(); + void EnterCombat(Unit* pWho) + { + me->setActive(true); + me->SetInCombatWithZone(); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_VEZAX_SHADOW_CRASH, 13000); - events.RescheduleEvent(EVENT_SPELL_SEARING_FLAMES, 10000, 1); - events.RescheduleEvent(EVENT_SPELL_SURGE_OF_DARKNESS, 63000); - events.RescheduleEvent(EVENT_SPELL_MARK_OF_THE_FACELESS, 20000); - events.RescheduleEvent(EVENT_SPELL_SUMMON_SARONITE_VAPORS, 30000); - events.RescheduleEvent(EVENT_BERSERK, 600000); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_VEZAX_SHADOW_CRASH, 13000); + events.RescheduleEvent(EVENT_SPELL_SEARING_FLAMES, 10000, 1); + events.RescheduleEvent(EVENT_SPELL_SURGE_OF_DARKNESS, 63000); + events.RescheduleEvent(EVENT_SPELL_MARK_OF_THE_FACELESS, 20000); + events.RescheduleEvent(EVENT_SPELL_SUMMON_SARONITE_VAPORS, 30000); + events.RescheduleEvent(EVENT_BERSERK, 600000); - me->MonsterYell(TEXT_VEZAX_AGGRO, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_VEZAX_AGGRO, 0); + me->MonsterYell(TEXT_VEZAX_AGGRO, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_VEZAX_AGGRO, 0); - if (pInstance) - pInstance->SetData(TYPE_VEZAX, IN_PROGRESS); + if (pInstance) + pInstance->SetData(TYPE_VEZAX, IN_PROGRESS); - me->CastSpell(me, SPELL_AURA_OF_DESPAIR_1, true); - } + me->CastSpell(me, SPELL_AURA_OF_DESPAIR_1, true); + } - void DoAction(int32 param) - { - switch( param ) - { - case 1: - hardmodeAvailable = false; - break; - case 2: - me->RemoveAura(SPELL_SARONITE_BARRIER); - me->SetLootMode(3); - break; - } - } + void DoAction(int32 param) + { + switch( param ) + { + case 1: + hardmodeAvailable = false; + break; + case 2: + me->RemoveAura(SPELL_SARONITE_BARRIER); + me->SetLootMode(3); + break; + } + } - uint32 GetData(uint32 id) const - { - switch (id) - { - case 1: return (me->GetLootMode() == 3 ? 1 : 0); - case 2: return (bAchievShadowdodger == true ? 1 : 0); - } - return 0; - } + uint32 GetData(uint32 id) const + { + switch (id) + { + case 1: return (me->GetLootMode() == 3 ? 1 : 0); + case 2: return (bAchievShadowdodger == true ? 1 : 0); + } + return 0; + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (target && spell && target->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_VEZAX_SHADOW_CRASH_DMG) - bAchievShadowdodger = false; - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (target && spell && target->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_VEZAX_SHADOW_CRASH_DMG) + bAchievShadowdodger = false; + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - if( !berserk && (me->GetPositionX() < 1720.0f || me->GetPositionX() > 1940.0f || me->GetPositionY() < 20.0f || me->GetPositionY() > 210.0f) ) - events.RescheduleEvent(EVENT_BERSERK, 1); + if( !berserk && (me->GetPositionX() < 1720.0f || me->GetPositionX() > 1940.0f || me->GetPositionY() < 20.0f || me->GetPositionY() > 210.0f) ) + events.RescheduleEvent(EVENT_BERSERK, 1); - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; - - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_BERSERK: - berserk = true; - me->CastSpell(me, SPELL_VEZAX_BERSERK, true); - me->MonsterYell(TEXT_VEZAX_BERSERK, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_VEZAX_BERSERK, 0); - events.PopEvent(); - break; - case EVENT_SPELL_VEZAX_SHADOW_CRASH: - { - events.RepeatEvent(10000); + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; + + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_BERSERK: + berserk = true; + me->CastSpell(me, SPELL_VEZAX_BERSERK, true); + me->MonsterYell(TEXT_VEZAX_BERSERK, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_VEZAX_BERSERK, 0); + events.PopEvent(); + break; + case EVENT_SPELL_VEZAX_SHADOW_CRASH: + { + events.RepeatEvent(10000); - std::vector players; - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - { - Player* temp = itr->GetSource(); - if( temp->IsAlive() && temp->GetDistance(me) > 15.0f ) - players.push_back(temp); - } - if (!players.empty()) - { - me->setAttackTimer(BASE_ATTACK, 2000); - Player* target = players.at(urand(0, players.size()-1)); - me->SetUInt64Value(UNIT_FIELD_TARGET, target->GetGUID()); - me->CastSpell(target, SPELL_VEZAX_SHADOW_CRASH, false); - events.ScheduleEvent(EVENT_RESTORE_TARGET, 750); - } - } - break; - case EVENT_RESTORE_TARGET: - if (me->GetVictim()) - me->SetUInt64Value(UNIT_FIELD_TARGET, me->GetVictim()->GetGUID()); - events.PopEvent(); - break; - case EVENT_SPELL_SEARING_FLAMES: - if(!me->HasAura(SPELL_SARONITE_BARRIER)) - me->CastSpell(me->GetVictim(), SPELL_SEARING_FLAMES, false); - events.RepeatEvent( me->GetMap()->Is25ManRaid() ? 8000 : 15000 ); - break; - case EVENT_SPELL_SURGE_OF_DARKNESS: - me->MonsterYell(TEXT_VEZAX_SURGE, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_VEZAX_SURGE, 0); - me->CastSpell(me, SPELL_SURGE_OF_DARKNESS, false); - events.RepeatEvent(63000); - events.DelayEvents(10000, 1); - break; - case EVENT_SPELL_MARK_OF_THE_FACELESS: - { - std::vector outside; - std::vector inside; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* tmp = itr->GetSource() ) - if( tmp->IsAlive() ) - { - if( tmp->GetDistance(me) > 15.0f ) - outside.push_back(tmp); - else - inside.push_back(tmp); - } + std::vector players; + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + { + Player* temp = itr->GetSource(); + if( temp->IsAlive() && temp->GetDistance(me) > 15.0f ) + players.push_back(temp); + } + if (!players.empty()) + { + me->setAttackTimer(BASE_ATTACK, 2000); + Player* target = players.at(urand(0, players.size()-1)); + me->SetUInt64Value(UNIT_FIELD_TARGET, target->GetGUID()); + me->CastSpell(target, SPELL_VEZAX_SHADOW_CRASH, false); + events.ScheduleEvent(EVENT_RESTORE_TARGET, 750); + } + } + break; + case EVENT_RESTORE_TARGET: + if (me->GetVictim()) + me->SetUInt64Value(UNIT_FIELD_TARGET, me->GetVictim()->GetGUID()); + events.PopEvent(); + break; + case EVENT_SPELL_SEARING_FLAMES: + if(!me->HasAura(SPELL_SARONITE_BARRIER)) + me->CastSpell(me->GetVictim(), SPELL_SEARING_FLAMES, false); + events.RepeatEvent( me->GetMap()->Is25ManRaid() ? 8000 : 15000 ); + break; + case EVENT_SPELL_SURGE_OF_DARKNESS: + me->MonsterYell(TEXT_VEZAX_SURGE, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_VEZAX_SURGE, 0); + me->CastSpell(me, SPELL_SURGE_OF_DARKNESS, false); + events.RepeatEvent(63000); + events.DelayEvents(10000, 1); + break; + case EVENT_SPELL_MARK_OF_THE_FACELESS: + { + std::vector outside; + std::vector inside; + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* tmp = itr->GetSource() ) + if( tmp->IsAlive() ) + { + if( tmp->GetDistance(me) > 15.0f ) + outside.push_back(tmp); + else + inside.push_back(tmp); + } - Player* t = NULL; - if( outside.size() >= uint8(me->GetMap()->Is25ManRaid() ? 9 : 4) ) - t = outside.at(urand(0, outside.size()-1)); - else if( !inside.empty() ) - t = inside.at(urand(0, inside.size()-1)); + Player* t = NULL; + if( outside.size() >= uint8(me->GetMap()->Is25ManRaid() ? 9 : 4) ) + t = outside.at(urand(0, outside.size()-1)); + else if( !inside.empty() ) + t = inside.at(urand(0, inside.size()-1)); - if (t) - me->CastSpell(t, SPELL_MARK_OF_THE_FACELESS_AURA, false); + if (t) + me->CastSpell(t, SPELL_MARK_OF_THE_FACELESS_AURA, false); - events.RepeatEvent(40000); - } - break; - case EVENT_SPELL_SUMMON_SARONITE_VAPORS: - { - vaporsCount++; - me->CastSpell(me, SPELL_SUMMON_SARONITE_VAPORS, false); - me->MonsterTextEmote("A cloud of saronite vapors coalesces nearby!", 0, true); + events.RepeatEvent(40000); + } + break; + case EVENT_SPELL_SUMMON_SARONITE_VAPORS: + { + vaporsCount++; + me->CastSpell(me, SPELL_SUMMON_SARONITE_VAPORS, false); + me->MonsterTextEmote("A cloud of saronite vapors coalesces nearby!", 0, true); - if( vaporsCount < 6 || !hardmodeAvailable ) - events.RepeatEvent(30000); - else - { - for( std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr ) - if( Creature* sv = ObjectAccessor::GetCreature(*me, *itr) ) - { - sv->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - sv->GetMotionMaster()->MoveIdle(); - sv->GetMotionMaster()->MoveCharge(1852.78f, 81.38f, 342.461f, 28.0f); - } + if( vaporsCount < 6 || !hardmodeAvailable ) + events.RepeatEvent(30000); + else + { + for( std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr ) + if( Creature* sv = ObjectAccessor::GetCreature(*me, *itr) ) + { + sv->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + sv->GetMotionMaster()->MoveIdle(); + sv->GetMotionMaster()->MoveCharge(1852.78f, 81.38f, 342.461f, 28.0f); + } - events.PopEvent(); - events.DelayEvents(12000, 0); - events.DelayEvents(12000, 1); - events.ScheduleEvent(EVENT_SARONITE_VAPORS_SWIRL, 6000); - } - } - break; - case EVENT_SARONITE_VAPORS_SWIRL: - if (summons.size()) - { - me->MonsterTextEmote("The saronite vapors mass and swirl violently, merging into a monstrous form!", 0, true); - if( Creature* sv = ObjectAccessor::GetCreature(*me, *(summons.begin())) ) - sv->CastSpell(sv, SPELL_SARONITE_ANIMUS_FORMATION_VISUAL, true); + events.PopEvent(); + events.DelayEvents(12000, 0); + events.DelayEvents(12000, 1); + events.ScheduleEvent(EVENT_SARONITE_VAPORS_SWIRL, 6000); + } + } + break; + case EVENT_SARONITE_VAPORS_SWIRL: + if (summons.size()) + { + me->MonsterTextEmote("The saronite vapors mass and swirl violently, merging into a monstrous form!", 0, true); + if( Creature* sv = ObjectAccessor::GetCreature(*me, *(summons.begin())) ) + sv->CastSpell(sv, SPELL_SARONITE_ANIMUS_FORMATION_VISUAL, true); - events.PopEvent(); - events.ScheduleEvent(EVENT_SPELL_SUMMON_SARONITE_ANIMUS, 2000); - break; - } - events.PopEvent(); - break; - case EVENT_SPELL_SUMMON_SARONITE_ANIMUS: - if (summons.size()) - { - me->MonsterTextEmote("A saronite barrier appears around General Vezax!", 0, true); - me->MonsterYell(TEXT_VEZAX_HARDMODE, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_VEZAX_HARDMODE, 0); + events.PopEvent(); + events.ScheduleEvent(EVENT_SPELL_SUMMON_SARONITE_ANIMUS, 2000); + break; + } + events.PopEvent(); + break; + case EVENT_SPELL_SUMMON_SARONITE_ANIMUS: + if (summons.size()) + { + me->MonsterTextEmote("A saronite barrier appears around General Vezax!", 0, true); + me->MonsterYell(TEXT_VEZAX_HARDMODE, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_VEZAX_HARDMODE, 0); - me->CastSpell(me, SPELL_SARONITE_BARRIER, true); - if( Creature* sv = ObjectAccessor::GetCreature(*me, *(summons.begin())) ) - sv->CastSpell(sv, SPELL_SUMMON_SARONITE_ANIMUS, true); + me->CastSpell(me, SPELL_SARONITE_BARRIER, true); + if( Creature* sv = ObjectAccessor::GetCreature(*me, *(summons.begin())) ) + sv->CastSpell(sv, SPELL_SUMMON_SARONITE_ANIMUS, true); - events.PopEvent(); - events.ScheduleEvent(EVENT_DESPAWN_SARONITE_VAPORS, 2500); - break; - } - events.PopEvent(); - break; - case EVENT_DESPAWN_SARONITE_VAPORS: - summons.DespawnEntry(NPC_SARONITE_VAPORS); - events.PopEvent(); - break; - } + events.PopEvent(); + events.ScheduleEvent(EVENT_DESPAWN_SARONITE_VAPORS, 2500); + break; + } + events.PopEvent(); + break; + case EVENT_DESPAWN_SARONITE_VAPORS: + summons.DespawnEntry(NPC_SARONITE_VAPORS); + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* killer) - { - summons.DespawnAll(); - if (pInstance) - pInstance->SetData(TYPE_VEZAX, DONE); + void JustDied(Unit* killer) + { + summons.DespawnAll(); + if (pInstance) + pInstance->SetData(TYPE_VEZAX, DONE); - me->MonsterYell(TEXT_VEZAX_DEATH, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_VEZAX_DEATH, 0); + me->MonsterYell(TEXT_VEZAX_DEATH, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_VEZAX_DEATH, 0); - if( GameObject* door = me->FindNearestGameObject(GO_VEZAX_DOOR, 500.0f) ) - if( door->GetGoState() != GO_STATE_ACTIVE ) - { - door->SetLootState(GO_READY); - door->UseDoorOrButton(0, false); - } - } + if( GameObject* door = me->FindNearestGameObject(GO_VEZAX_DOOR, 500.0f) ) + if( door->GetGoState() != GO_STATE_ACTIVE ) + { + door->SetLootState(GO_READY); + door->UseDoorOrButton(0, false); + } + } - void KilledUnit(Unit* who) - { - if( who->GetTypeId() == TYPEID_PLAYER ) - { - if( urand(0,1) ) - { - me->MonsterYell(TEXT_VEZAX_SLAIN_1, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_VEZAX_SLAIN_1, 0); - } - else - { - me->MonsterYell(TEXT_VEZAX_SLAIN_2, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_VEZAX_SLAIN_2, 0); - } - } - } + void KilledUnit(Unit* who) + { + if( who->GetTypeId() == TYPEID_PLAYER ) + { + if( urand(0,1) ) + { + me->MonsterYell(TEXT_VEZAX_SLAIN_1, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_VEZAX_SLAIN_1, 0); + } + else + { + me->MonsterYell(TEXT_VEZAX_SLAIN_2, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_VEZAX_SLAIN_2, 0); + } + } + } - void MoveInLineOfSight(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void SummonedCreatureDespawn(Creature* s) - { - summons.Despawn(s); - } - }; + void SummonedCreatureDespawn(Creature* s) + { + summons.Despawn(s); + } + }; }; class npc_ulduar_saronite_vapors : public CreatureScript { public: - npc_ulduar_saronite_vapors() : CreatureScript("npc_ulduar_saronite_vapors") { } + npc_ulduar_saronite_vapors() : CreatureScript("npc_ulduar_saronite_vapors") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_saronite_vaporsAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_saronite_vaporsAI (pCreature); + } - struct npc_ulduar_saronite_vaporsAI : public NullCreatureAI - { - npc_ulduar_saronite_vaporsAI(Creature *pCreature) : NullCreatureAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - me->GetMotionMaster()->MoveRandom(4.0f); - } + struct npc_ulduar_saronite_vaporsAI : public NullCreatureAI + { + npc_ulduar_saronite_vaporsAI(Creature *pCreature) : NullCreatureAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + me->GetMotionMaster()->MoveRandom(4.0f); + } - InstanceScript* pInstance; + InstanceScript* pInstance; - void JustDied(Unit* killer) - { - me->CastSpell(me, SPELL_SARONITE_VAPORS_AURA, true); + void JustDied(Unit* killer) + { + me->CastSpell(me, SPELL_SARONITE_VAPORS_AURA, true); - // killed saronite vapors, hard mode unavailable - if( pInstance ) - if( Creature* vezax = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_VEZAX)) ) - vezax->AI()->DoAction(1); - } - }; + // killed saronite vapors, hard mode unavailable + if( pInstance ) + if( Creature* vezax = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_VEZAX)) ) + vezax->AI()->DoAction(1); + } + }; }; class npc_ulduar_saronite_animus : public CreatureScript { public: - npc_ulduar_saronite_animus() : CreatureScript("npc_ulduar_saronite_animus") { } + npc_ulduar_saronite_animus() : CreatureScript("npc_ulduar_saronite_animus") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_saronite_animusAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_saronite_animusAI (pCreature); + } - struct npc_ulduar_saronite_animusAI : public ScriptedAI - { - npc_ulduar_saronite_animusAI(Creature *pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceScript(); - if( pInstance ) - if( Creature* vezax = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_VEZAX)) ) - vezax->AI()->JustSummoned(me); - timer = 0; - me->SetInCombatWithZone(); - } + struct npc_ulduar_saronite_animusAI : public ScriptedAI + { + npc_ulduar_saronite_animusAI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + if( pInstance ) + if( Creature* vezax = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_VEZAX)) ) + vezax->AI()->JustSummoned(me); + timer = 0; + me->SetInCombatWithZone(); + } - InstanceScript* pInstance; - uint16 timer; + InstanceScript* pInstance; + uint16 timer; - void JustDied(Unit* killer) - { - me->DespawnOrUnsummon(3000); + void JustDied(Unit* killer) + { + me->DespawnOrUnsummon(3000); - if( pInstance ) - if( Creature* vezax = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_VEZAX)) ) - vezax->AI()->DoAction(2); - } + if( pInstance ) + if( Creature* vezax = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_VEZAX)) ) + vezax->AI()->DoAction(2); + } - void UpdateAI(uint32 diff) - { - UpdateVictim(); - - timer += diff; - if (timer >= 2000) - { - me->CastSpell(me, SPELL_PROFOUND_DARKNESS, true); - timer -= 2000; - } + void UpdateAI(uint32 diff) + { + UpdateVictim(); + + timer += diff; + if (timer >= 2000) + { + me->CastSpell(me, SPELL_PROFOUND_DARKNESS, true); + timer -= 2000; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_aura_of_despair : public SpellScriptLoader { public: - spell_aura_of_despair() : SpellScriptLoader("spell_aura_of_despair") { } + spell_aura_of_despair() : SpellScriptLoader("spell_aura_of_despair") { } - class spell_aura_of_despair_AuraScript : public AuraScript - { - PrepareAuraScript(spell_aura_of_despair_AuraScript) + class spell_aura_of_despair_AuraScript : public AuraScript + { + PrepareAuraScript(spell_aura_of_despair_AuraScript) - void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes mode) - { - if (Unit* caster = GetCaster()) - if (Unit* target = GetTarget()) - { - if (target->GetTypeId() != TYPEID_PLAYER) - return; + void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes mode) + { + if (Unit* caster = GetCaster()) + if (Unit* target = GetTarget()) + { + if (target->GetTypeId() != TYPEID_PLAYER) + return; - target->CastSpell(target, SPELL_AURA_OF_DESPAIR_2, true); - if( target->HasSpell(SPELL_SHAMANISTIC_RAGE) ) - caster->CastSpell(target, SPELL_CORRUPTED_RAGE, true); - else if( target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1) || target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1+1) || target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1+2) ) - caster->CastSpell(target, SPELL_CORRUPTED_WISDOM, true); - } - } + target->CastSpell(target, SPELL_AURA_OF_DESPAIR_2, true); + if( target->HasSpell(SPELL_SHAMANISTIC_RAGE) ) + caster->CastSpell(target, SPELL_CORRUPTED_RAGE, true); + else if( target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1) || target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1+1) || target->HasSpell(SPELL_JUDGEMENTS_OF_THE_WISDOM_RANK_1+2) ) + caster->CastSpell(target, SPELL_CORRUPTED_WISDOM, true); + } + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* target = GetTarget()) - { - target->RemoveAurasDueToSpell(SPELL_AURA_OF_DESPAIR_2); - target->RemoveAurasDueToSpell(SPELL_CORRUPTED_RAGE); - target->RemoveAurasDueToSpell(SPELL_CORRUPTED_WISDOM); - } - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + { + target->RemoveAurasDueToSpell(SPELL_AURA_OF_DESPAIR_2); + target->RemoveAurasDueToSpell(SPELL_CORRUPTED_RAGE); + target->RemoveAurasDueToSpell(SPELL_CORRUPTED_WISDOM); + } + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_aura_of_despair_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PREVENT_REGENERATE_POWER, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_aura_of_despair_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PREVENT_REGENERATE_POWER, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_aura_of_despair_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PREVENT_REGENERATE_POWER, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_aura_of_despair_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PREVENT_REGENERATE_POWER, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_aura_of_despair_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_aura_of_despair_AuraScript(); + } }; class spell_mark_of_the_faceless_periodic : public SpellScriptLoader { public: - spell_mark_of_the_faceless_periodic() : SpellScriptLoader("spell_mark_of_the_faceless_periodic") { } + spell_mark_of_the_faceless_periodic() : SpellScriptLoader("spell_mark_of_the_faceless_periodic") { } - class spell_mark_of_the_faceless_periodic_AuraScript : public AuraScript - { - PrepareAuraScript(spell_mark_of_the_faceless_periodic_AuraScript) + class spell_mark_of_the_faceless_periodic_AuraScript : public AuraScript + { + PrepareAuraScript(spell_mark_of_the_faceless_periodic_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (Unit* caster = GetCaster()) - if (Unit* target = GetTarget()) - if (target->GetMapId() == 603) - { - int32 dmg = 5000; - caster->CastCustomSpell(target, SPELL_MARK_OF_THE_FACELESS_EFFECT, 0, &dmg, 0, true); - } - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (Unit* caster = GetCaster()) + if (Unit* target = GetTarget()) + if (target->GetMapId() == 603) + { + int32 dmg = 5000; + caster->CastCustomSpell(target, SPELL_MARK_OF_THE_FACELESS_EFFECT, 0, &dmg, 0, true); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_the_faceless_periodic_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_the_faceless_periodic_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_mark_of_the_faceless_periodic_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_mark_of_the_faceless_periodic_AuraScript(); + } }; class spell_mark_of_the_faceless_drainhealth : public SpellScriptLoader { public: - spell_mark_of_the_faceless_drainhealth() : SpellScriptLoader("spell_mark_of_the_faceless_drainhealth") { } + spell_mark_of_the_faceless_drainhealth() : SpellScriptLoader("spell_mark_of_the_faceless_drainhealth") { } - class spell_mark_of_the_faceless_drainhealth_SpellScript : public SpellScript - { - PrepareSpellScript(spell_mark_of_the_faceless_drainhealth_SpellScript); + class spell_mark_of_the_faceless_drainhealth_SpellScript : public SpellScript + { + PrepareSpellScript(spell_mark_of_the_faceless_drainhealth_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove(GetExplTargetUnit()); - if (targets.empty()) - Cancel(); - } + void FilterTargets(std::list& targets) + { + targets.remove(GetExplTargetUnit()); + if (targets.empty()) + Cancel(); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_the_faceless_drainhealth_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_the_faceless_drainhealth_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); + } + }; - SpellScript *GetSpellScript() const - { - return new spell_mark_of_the_faceless_drainhealth_SpellScript(); - } + SpellScript *GetSpellScript() const + { + return new spell_mark_of_the_faceless_drainhealth_SpellScript(); + } }; class spell_saronite_vapors_dummy : public SpellScriptLoader { public: - spell_saronite_vapors_dummy() : SpellScriptLoader("spell_saronite_vapors_dummy") { } + spell_saronite_vapors_dummy() : SpellScriptLoader("spell_saronite_vapors_dummy") { } - class spell_saronite_vapors_dummy_AuraScript : public AuraScript - { - PrepareAuraScript(spell_saronite_vapors_dummy_AuraScript) + class spell_saronite_vapors_dummy_AuraScript : public AuraScript + { + PrepareAuraScript(spell_saronite_vapors_dummy_AuraScript) - void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - { - int32 damage = 100*pow(2.0f, (float)GetStackAmount()); - caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DMG, &damage, NULL, NULL, true); - } - } + void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + { + int32 damage = 100*pow(2.0f, (float)GetStackAmount()); + caster->CastCustomSpell(GetTarget(), SPELL_SARONITE_VAPORS_DMG, &damage, NULL, NULL, true); + } + } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_saronite_vapors_dummy_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - } - }; + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_saronite_vapors_dummy_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_saronite_vapors_dummy_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_saronite_vapors_dummy_AuraScript(); + } }; class spell_saronite_vapors_damage : public SpellScriptLoader { public: - spell_saronite_vapors_damage() : SpellScriptLoader("spell_saronite_vapors_damage") { } + spell_saronite_vapors_damage() : SpellScriptLoader("spell_saronite_vapors_damage") { } - class spell_saronite_vapors_damage_SpellScript : public SpellScript - { - PrepareSpellScript(spell_saronite_vapors_damage_SpellScript); + class spell_saronite_vapors_damage_SpellScript : public SpellScript + { + PrepareSpellScript(spell_saronite_vapors_damage_SpellScript); - void HandleAfterHit() - { - if (Unit* caster = GetCaster()) - if (GetHitDamage() > 2) - { - int32 mana = GetHitDamage()/2; - if (Unit* t = GetHitUnit()) - caster->CastCustomSpell(t, SPELL_SARONITE_VAPORS_ENERGIZE, &mana, NULL, NULL, true); - } - } + void HandleAfterHit() + { + if (Unit* caster = GetCaster()) + if (GetHitDamage() > 2) + { + int32 mana = GetHitDamage()/2; + if (Unit* t = GetHitUnit()) + caster->CastCustomSpell(t, SPELL_SARONITE_VAPORS_ENERGIZE, &mana, NULL, NULL, true); + } + } - void Register() - { - AfterHit += SpellHitFn(spell_saronite_vapors_damage_SpellScript::HandleAfterHit); - } - }; + void Register() + { + AfterHit += SpellHitFn(spell_saronite_vapors_damage_SpellScript::HandleAfterHit); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_saronite_vapors_damage_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_saronite_vapors_damage_SpellScript(); + } }; class achievement_smell_saronite : public AchievementCriteriaScript { public: - achievement_smell_saronite() : AchievementCriteriaScript("achievement_smell_saronite") {} + achievement_smell_saronite() : AchievementCriteriaScript("achievement_smell_saronite") {} - bool OnCheck(Player* player, Unit* target) - { - return target && target->GetEntry() == NPC_VEZAX && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(1); - } + bool OnCheck(Player* player, Unit* target) + { + return target && target->GetEntry() == NPC_VEZAX && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(1); + } }; class achievement_shadowdodger : public AchievementCriteriaScript { public: - achievement_shadowdodger() : AchievementCriteriaScript("achievement_shadowdodger") {} + achievement_shadowdodger() : AchievementCriteriaScript("achievement_shadowdodger") {} - bool OnCheck(Player* player, Unit* target) - { - return target && target->GetEntry() == NPC_VEZAX && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(2); - } + bool OnCheck(Player* player, Unit* target) + { + return target && target->GetEntry() == NPC_VEZAX && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(2); + } }; class go_ulduar_pure_saronite_deposit : public GameObjectScript { public: - go_ulduar_pure_saronite_deposit() : GameObjectScript("go_ulduar_pure_saronite_deposit") { } + go_ulduar_pure_saronite_deposit() : GameObjectScript("go_ulduar_pure_saronite_deposit") { } - bool OnGossipHello(Player* plr, GameObject* go) - { - if (plr->IsGameMaster()) - return false; + bool OnGossipHello(Player* plr, GameObject* go) + { + if (plr->IsGameMaster()) + return false; - if (InstanceScript* pInstance = go->GetInstanceScript()) - if (pInstance->GetData(TYPE_XT002) != DONE && pInstance->GetData(TYPE_MIMIRON) != DONE && pInstance->GetData(TYPE_THORIM) != DONE && pInstance->GetData(TYPE_FREYA) != DONE && pInstance->GetData(TYPE_HODIR) != DONE) - { - std::string accountName; - AccountMgr::GetName(plr->GetSession()->GetAccountId(), accountName); - sWorld->BanAccount(BAN_ACCOUNT, accountName, "0s", "Tele hack", "Server"); - return true; - } + if (InstanceScript* pInstance = go->GetInstanceScript()) + if (pInstance->GetData(TYPE_XT002) != DONE && pInstance->GetData(TYPE_MIMIRON) != DONE && pInstance->GetData(TYPE_THORIM) != DONE && pInstance->GetData(TYPE_FREYA) != DONE && pInstance->GetData(TYPE_HODIR) != DONE) + { + std::string accountName; + AccountMgr::GetName(plr->GetSession()->GetAccountId(), accountName); + sWorld->BanAccount(BAN_ACCOUNT, accountName, "0s", "Tele hack", "Server"); + return true; + } - return false; - } + return false; + } }; void AddSC_boss_vezax() { - new boss_vezax(); - new npc_ulduar_saronite_vapors(); - new npc_ulduar_saronite_animus(); + new boss_vezax(); + new npc_ulduar_saronite_vapors(); + new npc_ulduar_saronite_animus(); - new spell_aura_of_despair(); - new spell_mark_of_the_faceless_periodic(); - new spell_mark_of_the_faceless_drainhealth(); - new spell_saronite_vapors_dummy(); - new spell_saronite_vapors_damage(); + new spell_aura_of_despair(); + new spell_mark_of_the_faceless_periodic(); + new spell_mark_of_the_faceless_drainhealth(); + new spell_saronite_vapors_dummy(); + new spell_saronite_vapors_damage(); - new achievement_smell_saronite(); - new achievement_shadowdodger(); + new achievement_smell_saronite(); + new achievement_shadowdodger(); - new go_ulduar_pure_saronite_deposit(); + new go_ulduar_pure_saronite_deposit(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index 06e864a93..79d4a7c5a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp @@ -13,1542 +13,1542 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum HodirSpellData { - SPELL_BERSERK = 26662, + SPELL_BERSERK = 26662, - SPELL_BITING_COLD_BOSS_AURA = 62038, - SPELL_BITING_COLD_PLAYER_AURA = 62039, - SPELL_BITING_COLD_DAMAGE = 62188, + SPELL_BITING_COLD_BOSS_AURA = 62038, + SPELL_BITING_COLD_PLAYER_AURA = 62039, + SPELL_BITING_COLD_DAMAGE = 62188, - SPELL_FREEZE = 62469, + SPELL_FREEZE = 62469, - SPELL_FLASH_FREEZE_CAST = 61968, - SPELL_FLASH_FREEZE_INSTAKILL = 62226, - SPELL_FLASH_FREEZE_TRAPPED_PLAYER = 61969, - SPELL_FLASH_FREEZE_TRAPPED_NPC = 61990, - SPELL_FLASH_FREEZE_VISUAL = 62148, - SPELL_SAFE_AREA = 65705, - SPELL_SAFE_AREA_TRIGGERED = 62464, - - SPELL_ICICLE_BOSS_AURA = 62227, - SPELL_ICICLE_TBBA = 63545, + SPELL_FLASH_FREEZE_CAST = 61968, + SPELL_FLASH_FREEZE_INSTAKILL = 62226, + SPELL_FLASH_FREEZE_TRAPPED_PLAYER = 61969, + SPELL_FLASH_FREEZE_TRAPPED_NPC = 61990, + SPELL_FLASH_FREEZE_VISUAL = 62148, + SPELL_SAFE_AREA = 65705, + SPELL_SAFE_AREA_TRIGGERED = 62464, + + SPELL_ICICLE_BOSS_AURA = 62227, + SPELL_ICICLE_TBBA = 63545, - SPELL_ICICLE_VISUAL_UNPACKED = 62234, - SPELL_ICICLE_VISUAL_PACKED = 62462, - SPELL_ICICLE_VISUAL_FALLING = 62453, - SPELL_ICICLE_FALL_EFFECT_UNPACKED = 62236, - SPELL_ICICLE_FALL_EFFECT_PACKED = 62460, - SPELL_ICE_SHARDS_SMALL = 62457, - SPELL_ICE_SHARDS_BIG = 65370, - SPELL_SNOWDRIFT = 62463, + SPELL_ICICLE_VISUAL_UNPACKED = 62234, + SPELL_ICICLE_VISUAL_PACKED = 62462, + SPELL_ICICLE_VISUAL_FALLING = 62453, + SPELL_ICICLE_FALL_EFFECT_UNPACKED = 62236, + SPELL_ICICLE_FALL_EFFECT_PACKED = 62460, + SPELL_ICE_SHARDS_SMALL = 62457, + SPELL_ICE_SHARDS_BIG = 65370, + SPELL_SNOWDRIFT = 62463, - SPELL_FROZEN_BLOWS_10 = 62478, - SPELL_FROZEN_BLOWS_25 = 63512, + SPELL_FROZEN_BLOWS_10 = 62478, + SPELL_FROZEN_BLOWS_25 = 63512, - // Helpers: - SPELL_PRIEST_DISPELL_MAGIC = 63499, - SPELL_PRIEST_GREAT_HEAL = 62809, - SPELL_PRIEST_SMITE = 61923, + // Helpers: + SPELL_PRIEST_DISPELL_MAGIC = 63499, + SPELL_PRIEST_GREAT_HEAL = 62809, + SPELL_PRIEST_SMITE = 61923, - SPELL_DRUID_WRATH = 62793, - SPELL_DRUID_STARLIGHT_AREA_AURA = 62807, + SPELL_DRUID_WRATH = 62793, + SPELL_DRUID_STARLIGHT_AREA_AURA = 62807, - SPELL_SHAMAN_LAVA_BURST = 61924, - SPELL_SHAMAN_STORM_CLOUD_10 = 65123, - SPELL_SHAMAN_STORM_CLOUD_25 = 65133, - SPELL_SHAMAN_STORM_POWER_10 = 63711, - SPELL_SHAMAN_STORM_POWER_25 = 65134, + SPELL_SHAMAN_LAVA_BURST = 61924, + SPELL_SHAMAN_STORM_CLOUD_10 = 65123, + SPELL_SHAMAN_STORM_CLOUD_25 = 65133, + SPELL_SHAMAN_STORM_POWER_10 = 63711, + SPELL_SHAMAN_STORM_POWER_25 = 65134, - SPELL_MAGE_FIREBALL = 61909, - SPELL_MAGE_MELT_ICE = 64528, - SPELL_MAGE_CONJURE_TOASTY_FIRE = 62823, - SPELL_MAGE_SUMMON_TOASTY_FIRE = 62819, - SPELL_MAGE_TOASTY_FIRE_AURA = 62821, - SPELL_SINGED = 65280, + SPELL_MAGE_FIREBALL = 61909, + SPELL_MAGE_MELT_ICE = 64528, + SPELL_MAGE_CONJURE_TOASTY_FIRE = 62823, + SPELL_MAGE_SUMMON_TOASTY_FIRE = 62819, + SPELL_MAGE_TOASTY_FIRE_AURA = 62821, + SPELL_SINGED = 65280, }; enum HodirNPCs { - //NPC_HODIR = 32845, + //NPC_HODIR = 32845, - NPC_PAN_FIELD_MEDIC_PENNY = 32897, - NPC_DAN_ELLIE_NIGHTFEATHER = 32901, - NPC_SAN_ELEMENTALIST_AVUUN = 32900, - NPC_MAN_MISSY_FLAMECUFFS = 32893, + NPC_PAN_FIELD_MEDIC_PENNY = 32897, + NPC_DAN_ELLIE_NIGHTFEATHER = 32901, + NPC_SAN_ELEMENTALIST_AVUUN = 32900, + NPC_MAN_MISSY_FLAMECUFFS = 32893, - NPC_PAH_FIELD_MEDIC_JESSI = 33326, - NPC_DAH_EIVI_NIGHTFEATHER = 33325, - NPC_SAH_ELEMENTALIST_MAHFUUN = 33328, - NPC_MAH_SISSY_FLAMECUFFS = 33327, + NPC_PAH_FIELD_MEDIC_JESSI = 33326, + NPC_DAH_EIVI_NIGHTFEATHER = 33325, + NPC_SAH_ELEMENTALIST_MAHFUUN = 33328, + NPC_MAH_SISSY_FLAMECUFFS = 33327, - NPC_PHN_BATTLEPRIEST_ELIZA = 32948, - NPC_DHN_TOR_GREYCLOUD = 32941, - NPC_SHN_SPIRITWALKER_YONA = 32950, - NPC_MHN_VEESHA_BLAZEWEAVER = 32946, + NPC_PHN_BATTLEPRIEST_ELIZA = 32948, + NPC_DHN_TOR_GREYCLOUD = 32941, + NPC_SHN_SPIRITWALKER_YONA = 32950, + NPC_MHN_VEESHA_BLAZEWEAVER = 32946, - NPC_PHH_BATTLEPRIEST_GINA = 33330, - NPC_DHH_KAR_GREYCLOUD = 33333, - NPC_SHH_SPIRITWALKER_TARA = 33332, - NPC_MHH_AMIRA_BLAZEWEAVER = 33331, + NPC_PHH_BATTLEPRIEST_GINA = 33330, + NPC_DHH_KAR_GREYCLOUD = 33333, + NPC_SHH_SPIRITWALKER_TARA = 33332, + NPC_MHH_AMIRA_BLAZEWEAVER = 33331, - NPC_FLASH_FREEZE_PLR = 32926, - NPC_FLASH_FREEZE_NPC = 32938, - NPC_ICICLE_UNPACKED = 33169, - NPC_ICICLE_PACKED = 33173, - NPC_TOASTY_FIRE = 33342, + NPC_FLASH_FREEZE_PLR = 32926, + NPC_FLASH_FREEZE_NPC = 32938, + NPC_ICICLE_UNPACKED = 33169, + NPC_ICICLE_PACKED = 33173, + NPC_TOASTY_FIRE = 33342, }; enum HodirGOs { - GO_HODIR_SNOWDRIFT = 194173, - // GO_HODIR_FROZEN_DOOR = 194441, - // GO_HODIR_DOOR = 194634, + GO_HODIR_SNOWDRIFT = 194173, + // GO_HODIR_FROZEN_DOOR = 194441, + // GO_HODIR_DOOR = 194634, }; enum HodirEvents { - // Hodir: - EVENT_FLASH_FREEZE = 1, - EVENT_FROZEN_BLOWS = 2, - EVENT_BERSERK = 3, - EVENT_FREEZE = 4, - EVENT_SMALL_ICICLES_ENABLE = 5, - EVENT_HARD_MODE_MISSED = 6, + // Hodir: + EVENT_FLASH_FREEZE = 1, + EVENT_FROZEN_BLOWS = 2, + EVENT_BERSERK = 3, + EVENT_FREEZE = 4, + EVENT_SMALL_ICICLES_ENABLE = 5, + EVENT_HARD_MODE_MISSED = 6, - EVENT_TRY_FREE_HELPER = 10, - EVENT_PRIEST_DISPELL_MAGIC = 11, - EVENT_PRIEST_GREAT_HEAL = 12, - EVENT_PRIEST_SMITE = 13, - EVENT_DRUID_WRATH = 14, - EVENT_DRUID_STARLIGHT = 15, - EVENT_SHAMAN_LAVA_BURST = 16, - EVENT_SHAMAN_STORM_CLOUD = 17, - EVENT_MAGE_TOASTY_FIRE = 18, - EVENT_MAGE_FIREBALL = 19, - EVENT_MAGE_MELT_ICE = 20, + EVENT_TRY_FREE_HELPER = 10, + EVENT_PRIEST_DISPELL_MAGIC = 11, + EVENT_PRIEST_GREAT_HEAL = 12, + EVENT_PRIEST_SMITE = 13, + EVENT_DRUID_WRATH = 14, + EVENT_DRUID_STARLIGHT = 15, + EVENT_SHAMAN_LAVA_BURST = 16, + EVENT_SHAMAN_STORM_CLOUD = 17, + EVENT_MAGE_TOASTY_FIRE = 18, + EVENT_MAGE_FIREBALL = 19, + EVENT_MAGE_MELT_ICE = 20, }; -#define SPELL_FROZEN_BLOWS RAID_MODE(SPELL_FROZEN_BLOWS_10, SPELL_FROZEN_BLOWS_25) -#define SPELL_SHAMAN_STORM_CLOUD RAID_MODE(SPELL_SHAMAN_STORM_CLOUD_10, SPELL_SHAMAN_STORM_CLOUD_25) +#define SPELL_FROZEN_BLOWS RAID_MODE(SPELL_FROZEN_BLOWS_10, SPELL_FROZEN_BLOWS_25) +#define SPELL_SHAMAN_STORM_CLOUD RAID_MODE(SPELL_SHAMAN_STORM_CLOUD_10, SPELL_SHAMAN_STORM_CLOUD_25) -#define TEXT_HODIR_AGGRO "You will suffer for this trespass!" -#define TEXTEMOTE_HODIR_FROZEN_BLOWS "Hodir roars furious." -#define TEXT_HODIR_FLASH_FREEZE "Winds of the north consume you!" +#define TEXT_HODIR_AGGRO "You will suffer for this trespass!" +#define TEXTEMOTE_HODIR_FROZEN_BLOWS "Hodir roars furious." +#define TEXT_HODIR_FLASH_FREEZE "Winds of the north consume you!" #define TEXTEMOTE_HODIR_HARD_MODE_MISSED "Hodir shatters the Rare Cache of Hodir!" -#define TEXT_HODIR_SLAIN_1 "Tragic. To come so far, only to fail." -#define TEXT_HODIR_SLAIN_2 "Welcome to the endless winter." -#define TEXT_HODIR_BERSERK "Enough! This ends now!" -#define TEXT_HODIR_DEFEATED "I... I am released from his grasp... at last." +#define TEXT_HODIR_SLAIN_1 "Tragic. To come so far, only to fail." +#define TEXT_HODIR_SLAIN_2 "Welcome to the endless winter." +#define TEXT_HODIR_BERSERK "Enough! This ends now!" +#define TEXT_HODIR_DEFEATED "I... I am released from his grasp... at last." enum HodirSounds { - SOUND_HODIR_AGGRO = 15552, - SOUND_HODIR_SLAIN_1 = 15553, - SOUND_HODIR_SLAIN_2 = 15554, - SOUND_HODIR_FLASH_FREEZE = 15555, - SOUND_HODIR_FROZEN_BLOWS = 15556, - SOUND_HODIR_DEFEATED = 15557, - SOUND_HODIR_BERSERK = 15558, + SOUND_HODIR_AGGRO = 15552, + SOUND_HODIR_SLAIN_1 = 15553, + SOUND_HODIR_SLAIN_2 = 15554, + SOUND_HODIR_FLASH_FREEZE = 15555, + SOUND_HODIR_FROZEN_BLOWS = 15556, + SOUND_HODIR_DEFEATED = 15557, + SOUND_HODIR_BERSERK = 15558, }; struct HodirHelperData { - uint32 id; - float x,y; + uint32 id; + float x,y; }; HodirHelperData hhd[4][4] = { // Alliance: { - {NPC_PAN_FIELD_MEDIC_PENNY, 2020.46f, -236.74f}, - {NPC_DAN_ELLIE_NIGHTFEATHER, 2007.21f, -241.57f}, - {NPC_SAN_ELEMENTALIST_AVUUN, 1999.14f, -230.69f}, - {NPC_MAN_MISSY_FLAMECUFFS, 1984.38f, -242.57f} + {NPC_PAN_FIELD_MEDIC_PENNY, 2020.46f, -236.74f}, + {NPC_DAN_ELLIE_NIGHTFEATHER, 2007.21f, -241.57f}, + {NPC_SAN_ELEMENTALIST_AVUUN, 1999.14f, -230.69f}, + {NPC_MAN_MISSY_FLAMECUFFS, 1984.38f, -242.57f} }, { - {NPC_PAH_FIELD_MEDIC_JESSI, 2012.29f, -233.70f}, - {NPC_DAH_EIVI_NIGHTFEATHER, 1995.75f, -241.32f}, - {NPC_SAH_ELEMENTALIST_MAHFUUN, 1989.31f, -234.26f}, - {NPC_MAH_SISSY_FLAMECUFFS, 1977.87f, -233.99f} + {NPC_PAH_FIELD_MEDIC_JESSI, 2012.29f, -233.70f}, + {NPC_DAH_EIVI_NIGHTFEATHER, 1995.75f, -241.32f}, + {NPC_SAH_ELEMENTALIST_MAHFUUN, 1989.31f, -234.26f}, + {NPC_MAH_SISSY_FLAMECUFFS, 1977.87f, -233.99f} }, // Horde: { - {NPC_PHN_BATTLEPRIEST_ELIZA, 2020.46f, -236.74f}, - {NPC_DHN_TOR_GREYCLOUD, 2007.21f, -241.57f}, - {NPC_SHN_SPIRITWALKER_YONA, 1999.14f, -230.69f}, - {NPC_MHN_VEESHA_BLAZEWEAVER, 1984.38f, -242.57f} + {NPC_PHN_BATTLEPRIEST_ELIZA, 2020.46f, -236.74f}, + {NPC_DHN_TOR_GREYCLOUD, 2007.21f, -241.57f}, + {NPC_SHN_SPIRITWALKER_YONA, 1999.14f, -230.69f}, + {NPC_MHN_VEESHA_BLAZEWEAVER, 1984.38f, -242.57f} }, { - {NPC_PHH_BATTLEPRIEST_GINA, 2012.29f, -233.70f}, - {NPC_DHH_KAR_GREYCLOUD, 1995.75f, -241.32f}, - {NPC_SHH_SPIRITWALKER_TARA, 1989.31f, -234.6f}, - {NPC_MHH_AMIRA_BLAZEWEAVER, 1977.87f, -233.99f} + {NPC_PHH_BATTLEPRIEST_GINA, 2012.29f, -233.70f}, + {NPC_DHH_KAR_GREYCLOUD, 1995.75f, -241.32f}, + {NPC_SHH_SPIRITWALKER_TARA, 1989.31f, -234.6f}, + {NPC_MHH_AMIRA_BLAZEWEAVER, 1977.87f, -233.99f} } }; class boss_hodir : public CreatureScript { public: - boss_hodir() : CreatureScript("boss_hodir") { } + boss_hodir() : CreatureScript("boss_hodir") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_hodirAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_hodirAI (pCreature); + } - struct boss_hodirAI : public ScriptedAI - { - boss_hodirAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) - { - pInstance = pCreature->GetInstanceScript(); - if (!me->IsAlive()) - if (pInstance) - pInstance->SetData(TYPE_HODIR, DONE); - } + struct boss_hodirAI : public ScriptedAI + { + boss_hodirAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) + { + pInstance = pCreature->GetInstanceScript(); + if (!me->IsAlive()) + if (pInstance) + pInstance->SetData(TYPE_HODIR, DONE); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint64 Helpers[8]; - bool berserk; - bool hardmode; - bool bAchievCheese; - bool bAchievGettingCold; - bool bAchievCoolestFriends; - uint16 addSpawnTimer; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint64 Helpers[8]; + bool berserk; + bool hardmode; + bool bAchievCheese; + bool bAchievGettingCold; + bool bAchievCoolestFriends; + uint16 addSpawnTimer; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - berserk = false; - hardmode = true; - bAchievCheese = true; - bAchievGettingCold = true; - bAchievCoolestFriends = true; - addSpawnTimer = 5000; + void Reset() + { + events.Reset(); + summons.DespawnAll(); + berserk = false; + hardmode = true; + bAchievCheese = true; + bAchievGettingCold = true; + bAchievCoolestFriends = true; + addSpawnTimer = 5000; - if (pInstance && pInstance->GetData(TYPE_HODIR) != DONE) - pInstance->SetData(TYPE_HODIR, NOT_STARTED); - } + if (pInstance && pInstance->GetData(TYPE_HODIR) != DONE) + pInstance->SetData(TYPE_HODIR, NOT_STARTED); + } - void EnterCombat(Unit* pWho) - { - if (summons.size() != RAID_MODE(8, 16)) - { - EnterEvadeMode(); - return; - } - me->setActive(true); - me->CastSpell(me, SPELL_BITING_COLD_BOSS_AURA, true); - SmallIcicles(true); - events.Reset(); - events.RescheduleEvent(EVENT_FLASH_FREEZE, 60000); - events.RescheduleEvent(EVENT_FREEZE, 15000); - events.RescheduleEvent(EVENT_BERSERK, 480000); - events.RescheduleEvent(EVENT_HARD_MODE_MISSED, 180000); + void EnterCombat(Unit* pWho) + { + if (summons.size() != RAID_MODE(8, 16)) + { + EnterEvadeMode(); + return; + } + me->setActive(true); + me->CastSpell(me, SPELL_BITING_COLD_BOSS_AURA, true); + SmallIcicles(true); + events.Reset(); + events.RescheduleEvent(EVENT_FLASH_FREEZE, 60000); + events.RescheduleEvent(EVENT_FREEZE, 15000); + events.RescheduleEvent(EVENT_BERSERK, 480000); + events.RescheduleEvent(EVENT_HARD_MODE_MISSED, 180000); - me->MonsterYell(TEXT_HODIR_AGGRO, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HODIR_AGGRO, 0); + me->MonsterYell(TEXT_HODIR_AGGRO, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HODIR_AGGRO, 0); - if (pInstance && pInstance->GetData(TYPE_HODIR) != DONE) - pInstance->SetData(TYPE_HODIR, IN_PROGRESS); - } + if (pInstance && pInstance->GetData(TYPE_HODIR) != DONE) + pInstance->SetData(TYPE_HODIR, IN_PROGRESS); + } - void JustReachedHome() { me->setActive(false); } + void JustReachedHome() { me->setActive(false); } - void SmallIcicles(bool enable) - { - if( enable ) - me->CastSpell(me, SPELL_ICICLE_BOSS_AURA, true); - else - me->RemoveAura(SPELL_ICICLE_BOSS_AURA); - } + void SmallIcicles(bool enable) + { + if( enable ) + me->CastSpell(me, SPELL_ICICLE_BOSS_AURA, true); + else + me->RemoveAura(SPELL_ICICLE_BOSS_AURA); + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - switch( spell->Id ) - { - case SPELL_ICICLE_TBBA: - me->CastSpell(target, SPELL_ICICLE_VISUAL_UNPACKED, true); - break; - case SPELL_FLASH_FREEZE_VISUAL: - { - std::list fires; - me->GetCreaturesWithEntryInRange(fires, 200.0f, NPC_TOASTY_FIRE); - for (std::list::iterator itr = fires.begin(); itr != fires.end(); ++itr) - (*itr)->AI()->DoAction(1); // remove it - } - break; - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + switch( spell->Id ) + { + case SPELL_ICICLE_TBBA: + me->CastSpell(target, SPELL_ICICLE_VISUAL_UNPACKED, true); + break; + case SPELL_FLASH_FREEZE_VISUAL: + { + std::list fires; + me->GetCreaturesWithEntryInRange(fires, 200.0f, NPC_TOASTY_FIRE); + for (std::list::iterator itr = fires.begin(); itr != fires.end(); ++itr) + (*itr)->AI()->DoAction(1); // remove it + } + break; + } + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth() || me->GetHealth() < 150000) - { - damage = 0; - me->SetReactState(REACT_PASSIVE); - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - { - if (pInstance) - { - pInstance->SetData(TYPE_HODIR, DONE); - me->CastSpell(me, 64899, true); // credit - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth() || me->GetHealth() < 150000) + { + damage = 0; + me->SetReactState(REACT_PASSIVE); + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + if (pInstance) + { + pInstance->SetData(TYPE_HODIR, DONE); + me->CastSpell(me, 64899, true); // credit + } - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setFaction(35); - me->GetMotionMaster()->Clear(); - me->AttackStop(); - me->CombatStop(); - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BITING_COLD_PLAYER_AURA); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->setFaction(35); + me->GetMotionMaster()->Clear(); + me->AttackStop(); + me->CombatStop(); + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_BITING_COLD_PLAYER_AURA); - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); - if( GameObject* d = me->FindNearestGameObject(GO_HODIR_FROZEN_DOOR, 250.0f) ) - if( d->GetGoState() != GO_STATE_ACTIVE ) - { - d->SetLootState(GO_READY); - d->UseDoorOrButton(0, false); - } - if( GameObject* d = me->FindNearestGameObject(GO_HODIR_DOOR, 250.0f) ) - if( d->GetGoState() != GO_STATE_ACTIVE ) - { - d->SetLootState(GO_READY); - d->UseDoorOrButton(0, false); - } + if( GameObject* d = me->FindNearestGameObject(GO_HODIR_FROZEN_DOOR, 250.0f) ) + if( d->GetGoState() != GO_STATE_ACTIVE ) + { + d->SetLootState(GO_READY); + d->UseDoorOrButton(0, false); + } + if( GameObject* d = me->FindNearestGameObject(GO_HODIR_DOOR, 250.0f) ) + if( d->GetGoState() != GO_STATE_ACTIVE ) + { + d->SetLootState(GO_READY); + d->UseDoorOrButton(0, false); + } - me->MonsterYell(TEXT_HODIR_DEFEATED, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HODIR_DEFEATED, 0); - me->DespawnOrUnsummon(10000); + me->MonsterYell(TEXT_HODIR_DEFEATED, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HODIR_DEFEATED, 0); + me->DespawnOrUnsummon(10000); - // spawn appropriate chests - uint32 chestId = me->GetMap()->Is25ManRaid() ? GO_HODIR_CHEST_NORMAL_HERO : GO_HODIR_CHEST_NORMAL; - if( GameObject *go = me->SummonGameObject(chestId, 1969.115f, -212.94f, 432.687f, 3*M_PI/2, 0, 0, 0, 0, 0) ) - go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); - - if( hardmode ) - { - uint32 chestId2 = me->GetMap()->Is25ManRaid() ? GO_HODIR_CHEST_HARD_HERO : GO_HODIR_CHEST_HARD; - if( GameObject *go = me->SummonGameObject(chestId2, 2031.207f, -213.236f, 432.687f, 3*M_PI/2, 0, 0, 0, 0, 0) ) - go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); - } - } - } - } + // spawn appropriate chests + uint32 chestId = me->GetMap()->Is25ManRaid() ? GO_HODIR_CHEST_NORMAL_HERO : GO_HODIR_CHEST_NORMAL; + if( GameObject *go = me->SummonGameObject(chestId, 1969.115f, -212.94f, 432.687f, 3*M_PI/2, 0, 0, 0, 0, 0) ) + go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); + + if( hardmode ) + { + uint32 chestId2 = me->GetMap()->Is25ManRaid() ? GO_HODIR_CHEST_HARD_HERO : GO_HODIR_CHEST_HARD; + if( GameObject *go = me->SummonGameObject(chestId2, 2031.207f, -213.236f, 432.687f, 3*M_PI/2, 0, 0, 0, 0, 0) ) + go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); + } + } + } + } - void UpdateAI(uint32 diff) - { - if (addSpawnTimer <= diff) - { - addSpawnTimer = 5000; - if (!me->IsInCombat() && !summons.size() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - if (SelectTargetFromPlayerList(135.0f)) - SpawnHelpers(); - } - else - addSpawnTimer -= diff; + void UpdateAI(uint32 diff) + { + if (addSpawnTimer <= diff) + { + addSpawnTimer = 5000; + if (!me->IsInCombat() && !summons.size() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + if (SelectTargetFromPlayerList(135.0f)) + SpawnHelpers(); + } + else + addSpawnTimer -= diff; - if (!UpdateVictim()) - { - if (me->IsInCombat()) - { - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - itr->GetSource()->CastSpell(itr->GetSource(), SPELL_FLASH_FREEZE_INSTAKILL, true); - EnterEvadeMode(); - } - return; - } + if (!UpdateVictim()) + { + if (me->IsInCombat()) + { + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + itr->GetSource()->CastSpell(itr->GetSource(), SPELL_FLASH_FREEZE_INSTAKILL, true); + EnterEvadeMode(); + } + return; + } - if( !berserk && (me->GetPositionX() < 1940.0f || me->GetPositionX() > 2070.0f || me->GetPositionY() < -300.0f || me->GetPositionY() > -155.0f) ) - events.RescheduleEvent(EVENT_BERSERK, 1); + if( !berserk && (me->GetPositionX() < 1940.0f || me->GetPositionX() > 2070.0f || me->GetPositionY() < -300.0f || me->GetPositionY() > -155.0f) ) + events.RescheduleEvent(EVENT_BERSERK, 1); - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; - - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_BERSERK: - { - berserk = true; - me->CastSpell(me, SPELL_BERSERK, true); - me->MonsterYell(TEXT_HODIR_BERSERK, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HODIR_BERSERK, 0); - events.PopEvent(); - } - break; - case EVENT_HARD_MODE_MISSED: - { - hardmode = false; - me->MonsterTextEmote(TEXTEMOTE_HODIR_HARD_MODE_MISSED, 0); - events.PopEvent(); - } - break; - case EVENT_FLASH_FREEZE: - { - std::list targets; - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - targets.push_back(itr->GetSource()); - targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_FLASH_FREEZE_TRAPPED_PLAYER)); - Trinity::Containers::RandomResizeList(targets, 2); - for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) - { - float prevZ = (*itr)->GetPositionZ(); - (*itr)->m_positionZ = 432.7f; - (*itr)->CastSpell((*itr), SPELL_ICICLE_VISUAL_PACKED, true); - (*itr)->m_positionZ = prevZ; - } + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; + + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_BERSERK: + { + berserk = true; + me->CastSpell(me, SPELL_BERSERK, true); + me->MonsterYell(TEXT_HODIR_BERSERK, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HODIR_BERSERK, 0); + events.PopEvent(); + } + break; + case EVENT_HARD_MODE_MISSED: + { + hardmode = false; + me->MonsterTextEmote(TEXTEMOTE_HODIR_HARD_MODE_MISSED, 0); + events.PopEvent(); + } + break; + case EVENT_FLASH_FREEZE: + { + std::list targets; + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + targets.push_back(itr->GetSource()); + targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_FLASH_FREEZE_TRAPPED_PLAYER)); + Trinity::Containers::RandomResizeList(targets, 2); + for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + { + float prevZ = (*itr)->GetPositionZ(); + (*itr)->m_positionZ = 432.7f; + (*itr)->CastSpell((*itr), SPELL_ICICLE_VISUAL_PACKED, true); + (*itr)->m_positionZ = prevZ; + } - me->CastSpell((Unit*)NULL, SPELL_FLASH_FREEZE_CAST, false); - me->MonsterTextEmote("Hodir begins to cast Flash Freeze!", 0, true); - me->MonsterYell(TEXT_HODIR_FLASH_FREEZE, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HODIR_FLASH_FREEZE, 0); - SmallIcicles(false); - events.RepeatEvent(55000 + urand(0,10000)); - events.ScheduleEvent(EVENT_SMALL_ICICLES_ENABLE, 12000); - events.ScheduleEvent(EVENT_FROZEN_BLOWS, 15000); - events.RescheduleEvent(EVENT_FREEZE, 20000); - } - break; - case EVENT_SMALL_ICICLES_ENABLE: - { - SmallIcicles(true); - events.PopEvent(); - } - break; - case EVENT_FROZEN_BLOWS: - { - me->MonsterTextEmote("Hodir gains Frozen Blows!", 0, true); - me->MonsterTextEmote(TEXTEMOTE_HODIR_FROZEN_BLOWS, 0); - me->PlayDirectSound(SOUND_HODIR_FROZEN_BLOWS, 0); - me->CastSpell(me, SPELL_FROZEN_BLOWS, true); - events.PopEvent(); - } - break; - case EVENT_FREEZE: - if (Player* plr = SelectTargetFromPlayerList(50.0f, SPELL_FLASH_FREEZE_TRAPPED_PLAYER)) - me->CastSpell(plr, SPELL_FREEZE, false); - else if (Unit* plr = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(plr, SPELL_FREEZE, false); - events.RepeatEvent(15000); - break; - } + me->CastSpell((Unit*)NULL, SPELL_FLASH_FREEZE_CAST, false); + me->MonsterTextEmote("Hodir begins to cast Flash Freeze!", 0, true); + me->MonsterYell(TEXT_HODIR_FLASH_FREEZE, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HODIR_FLASH_FREEZE, 0); + SmallIcicles(false); + events.RepeatEvent(55000 + urand(0,10000)); + events.ScheduleEvent(EVENT_SMALL_ICICLES_ENABLE, 12000); + events.ScheduleEvent(EVENT_FROZEN_BLOWS, 15000); + events.RescheduleEvent(EVENT_FREEZE, 20000); + } + break; + case EVENT_SMALL_ICICLES_ENABLE: + { + SmallIcicles(true); + events.PopEvent(); + } + break; + case EVENT_FROZEN_BLOWS: + { + me->MonsterTextEmote("Hodir gains Frozen Blows!", 0, true); + me->MonsterTextEmote(TEXTEMOTE_HODIR_FROZEN_BLOWS, 0); + me->PlayDirectSound(SOUND_HODIR_FROZEN_BLOWS, 0); + me->CastSpell(me, SPELL_FROZEN_BLOWS, true); + events.PopEvent(); + } + break; + case EVENT_FREEZE: + if (Player* plr = SelectTargetFromPlayerList(50.0f, SPELL_FLASH_FREEZE_TRAPPED_PLAYER)) + me->CastSpell(plr, SPELL_FREEZE, false); + else if (Unit* plr = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(plr, SPELL_FREEZE, false); + events.RepeatEvent(15000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - Creature* GetHelper(uint8 index) - { - return (Helpers[index] ? ObjectAccessor::GetCreature(*me, Helpers[index]) : NULL); - } + Creature* GetHelper(uint8 index) + { + return (Helpers[index] ? ObjectAccessor::GetCreature(*me, Helpers[index]) : NULL); + } - void SpawnHelpers() - { - char faction = 'A'; - if( hhd[0][0].id ) - { - Map::PlayerList const &cl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = cl.begin(); itr != cl.end(); ++itr) - if (!itr->GetSource()->IsGameMaster()) - { - faction = (itr->GetSource()->GetTeamId() == TEAM_ALLIANCE ? 'A' : 'H'); - break; - } - } + void SpawnHelpers() + { + char faction = 'A'; + if( hhd[0][0].id ) + { + Map::PlayerList const &cl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = cl.begin(); itr != cl.end(); ++itr) + if (!itr->GetSource()->IsGameMaster()) + { + faction = (itr->GetSource()->GetTeamId() == TEAM_ALLIANCE ? 'A' : 'H'); + break; + } + } - uint8 cnt = 0; - if( faction ) - for( uint8 k=0; k<4; ++k ) - { - if( faction == 'A' && ( k>1 || k==1 && RAID_MODE(1,0) ) || - faction == 'H' && ( k<2 || k==3 && RAID_MODE(1,0) ) ) - continue; + uint8 cnt = 0; + if( faction ) + for( uint8 k=0; k<4; ++k ) + { + if( faction == 'A' && ( k>1 || k==1 && RAID_MODE(1,0) ) || + faction == 'H' && ( k<2 || k==3 && RAID_MODE(1,0) ) ) + continue; - for( uint8 i=0; i<4; ++i ) - { - if( !hhd[k][i].id ) - continue; + for( uint8 i=0; i<4; ++i ) + { + if( !hhd[k][i].id ) + continue; - if( Creature* h_p = me->SummonCreature(hhd[k][i].id, hhd[k][i].x, hhd[k][i].y, 432.69f, M_PI/2) ) - { - h_p->setFaction(1665); - if( cnt < 8 ) - Helpers[cnt++] = h_p->GetGUID(); + if( Creature* h_p = me->SummonCreature(hhd[k][i].id, hhd[k][i].x, hhd[k][i].y, 432.69f, M_PI/2) ) + { + h_p->setFaction(1665); + if( cnt < 8 ) + Helpers[cnt++] = h_p->GetGUID(); - if( Creature* c = h_p->SummonCreature(NPC_FLASH_FREEZE_NPC, h_p->GetPositionX(), h_p->GetPositionY(), h_p->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000) ) - { - c->CastSpell(h_p, SPELL_FLASH_FREEZE_TRAPPED_NPC, true); - JustSummoned(c); - } - } - } - } - } + if( Creature* c = h_p->SummonCreature(NPC_FLASH_FREEZE_NPC, h_p->GetPositionX(), h_p->GetPositionY(), h_p->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000) ) + { + c->CastSpell(h_p, SPELL_FLASH_FREEZE_TRAPPED_NPC, true); + JustSummoned(c); + } + } + } + } + } - void KilledUnit(Unit* who) - { - if( who->GetTypeId() == TYPEID_PLAYER ) - { - if( urand(0,1) ) - { - me->MonsterYell(TEXT_HODIR_SLAIN_1, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HODIR_SLAIN_1, 0); - } - else - { - me->MonsterYell(TEXT_HODIR_SLAIN_2, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HODIR_SLAIN_2, 0); - } - } - } + void KilledUnit(Unit* who) + { + if( who->GetTypeId() == TYPEID_PLAYER ) + { + if( urand(0,1) ) + { + me->MonsterYell(TEXT_HODIR_SLAIN_1, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HODIR_SLAIN_1, 0); + } + else + { + me->MonsterYell(TEXT_HODIR_SLAIN_2, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HODIR_SLAIN_2, 0); + } + } + } - void JustSummoned(Creature* s) - { - summons.Summon(s); - } + void JustSummoned(Creature* s) + { + summons.Summon(s); + } - void SummonedCreatureDespawn(Creature* s) - { - summons.Despawn(s); - } + void SummonedCreatureDespawn(Creature* s) + { + summons.Despawn(s); + } - bool CanAIAttack(const Unit* t) const - { - if (t->GetTypeId() == TYPEID_PLAYER) - return !t->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER); - else if (t->GetTypeId() == TYPEID_UNIT) - return !t->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC); + bool CanAIAttack(const Unit* t) const + { + if (t->GetTypeId() == TYPEID_PLAYER) + return !t->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER); + else if (t->GetTypeId() == TYPEID_UNIT) + return !t->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC); - return true; - } + return true; + } - void SetData(uint32 id, uint32 value) - { - if (value) - switch (id) - { - case 1: bAchievCheese = false; break; - case 2: bAchievGettingCold = false; break; - case 4: bAchievCoolestFriends = false; break; - } - } + void SetData(uint32 id, uint32 value) + { + if (value) + switch (id) + { + case 1: bAchievCheese = false; break; + case 2: bAchievGettingCold = false; break; + case 4: bAchievCoolestFriends = false; break; + } + } - uint32 GetData(uint32 id) const - { - switch (id) - { - case 1: return (bAchievCheese ? 1 : 0); - case 2: return (bAchievGettingCold ? 1 : 0); - case 3: return (hardmode ? 1 : 0); - case 4: return (bAchievCoolestFriends ? 1 : 0); - } - return 0; - } + uint32 GetData(uint32 id) const + { + switch (id) + { + case 1: return (bAchievCheese ? 1 : 0); + case 2: return (bAchievGettingCold ? 1 : 0); + case 3: return (hardmode ? 1 : 0); + case 4: return (bAchievCoolestFriends ? 1 : 0); + } + return 0; + } - void MoveInLineOfSight(Unit* who) {} - }; + void MoveInLineOfSight(Unit* who) {} + }; }; class npc_ulduar_icicle : public CreatureScript { public: - npc_ulduar_icicle() : CreatureScript("npc_ulduar_icicle") { } + npc_ulduar_icicle() : CreatureScript("npc_ulduar_icicle") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_icicleAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_icicleAI (pCreature); + } - struct npc_ulduar_icicleAI : public NullCreatureAI - { - npc_ulduar_icicleAI(Creature *pCreature) : NullCreatureAI(pCreature) - { - timer1 = 2000; - timer2 = 5000; - } + struct npc_ulduar_icicleAI : public NullCreatureAI + { + npc_ulduar_icicleAI(Creature *pCreature) : NullCreatureAI(pCreature) + { + timer1 = 2000; + timer2 = 5000; + } - uint16 timer1; - uint16 timer2; + uint16 timer1; + uint16 timer2; - void UpdateAI(uint32 diff) - { - if( timer1 <= diff ) - { - me->CastSpell(me, (me->GetEntry()==33169 ? SPELL_ICICLE_FALL_EFFECT_UNPACKED : SPELL_ICICLE_FALL_EFFECT_PACKED), true); - me->CastSpell(me, SPELL_ICICLE_VISUAL_FALLING, false); - timer1 = 60000; - } - else - timer1 -= diff; + void UpdateAI(uint32 diff) + { + if( timer1 <= diff ) + { + me->CastSpell(me, (me->GetEntry()==33169 ? SPELL_ICICLE_FALL_EFFECT_UNPACKED : SPELL_ICICLE_FALL_EFFECT_PACKED), true); + me->CastSpell(me, SPELL_ICICLE_VISUAL_FALLING, false); + timer1 = 60000; + } + else + timer1 -= diff; - if (timer2 <= diff) - { - me->SetDisplayId(11686); - timer2 = 60000; - } - else - timer2 -= diff; - } - }; + if (timer2 <= diff) + { + me->SetDisplayId(11686); + timer2 = 60000; + } + else + timer2 -= diff; + } + }; }; class npc_ulduar_flash_freeze : public CreatureScript { public: - npc_ulduar_flash_freeze() : CreatureScript("npc_ulduar_flash_freeze") { } + npc_ulduar_flash_freeze() : CreatureScript("npc_ulduar_flash_freeze") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_flash_freezeAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_flash_freezeAI (pCreature); + } - struct npc_ulduar_flash_freezeAI : public NullCreatureAI - { - npc_ulduar_flash_freezeAI(Creature *pCreature) : NullCreatureAI(pCreature) - { - timer = 2500; - pInstance = me->GetInstanceScript(); - } + struct npc_ulduar_flash_freezeAI : public NullCreatureAI + { + npc_ulduar_flash_freezeAI(Creature *pCreature) : NullCreatureAI(pCreature) + { + timer = 2500; + pInstance = me->GetInstanceScript(); + } - InstanceScript* pInstance; - uint16 timer; + InstanceScript* pInstance; + uint16 timer; - void DamageTaken(Unit* doneBy, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (pInstance && doneBy) - if (pInstance->GetData(TYPE_HODIR) == NOT_STARTED) - if (Creature* hodir = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_HODIR))) - hodir->AI()->AttackStart(doneBy); - } + void DamageTaken(Unit* doneBy, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (pInstance && doneBy) + if (pInstance->GetData(TYPE_HODIR) == NOT_STARTED) + if (Creature* hodir = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_HODIR))) + hodir->AI()->AttackStart(doneBy); + } - void UpdateAI(uint32 diff) - { - if (timer <= diff) - { - timer = 2500; - if (me->IsSummon()) - if (Unit* s = me->ToTempSummon()->GetSummoner()) - { - if (s->GetTypeId() == TYPEID_PLAYER && !s->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER) || s->GetTypeId() == TYPEID_UNIT && !s->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC)) - me->DespawnOrUnsummon(2000); - else if (s->GetTypeId() == TYPEID_PLAYER) - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (pInstance->GetData(TYPE_HODIR) == NOT_STARTED) - { - s->CastSpell(s, SPELL_FLASH_FREEZE_INSTAKILL, true); - me->DespawnOrUnsummon(2000); - } - } - else - me->DespawnOrUnsummon(2000); - } - else - timer -= diff; - } - }; + void UpdateAI(uint32 diff) + { + if (timer <= diff) + { + timer = 2500; + if (me->IsSummon()) + if (Unit* s = me->ToTempSummon()->GetSummoner()) + { + if (s->GetTypeId() == TYPEID_PLAYER && !s->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER) || s->GetTypeId() == TYPEID_UNIT && !s->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC)) + me->DespawnOrUnsummon(2000); + else if (s->GetTypeId() == TYPEID_PLAYER) + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (pInstance->GetData(TYPE_HODIR) == NOT_STARTED) + { + s->CastSpell(s, SPELL_FLASH_FREEZE_INSTAKILL, true); + me->DespawnOrUnsummon(2000); + } + } + else + me->DespawnOrUnsummon(2000); + } + else + timer -= diff; + } + }; }; class npc_ulduar_toasty_fire : public CreatureScript { public: - npc_ulduar_toasty_fire() : CreatureScript("npc_ulduar_toasty_fire") { } + npc_ulduar_toasty_fire() : CreatureScript("npc_ulduar_toasty_fire") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_toasty_fireAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_toasty_fireAI (pCreature); + } - struct npc_ulduar_toasty_fireAI : public NullCreatureAI - { - npc_ulduar_toasty_fireAI(Creature *pCreature) : NullCreatureAI(pCreature) - { - me->CastSpell(me, SPELL_MAGE_TOASTY_FIRE_AURA, true); - } + struct npc_ulduar_toasty_fireAI : public NullCreatureAI + { + npc_ulduar_toasty_fireAI(Creature *pCreature) : NullCreatureAI(pCreature) + { + me->CastSpell(me, SPELL_MAGE_TOASTY_FIRE_AURA, true); + } - void DoAction(int32 a) - { - if (a == 1) - { - if( GameObject* fire = me->FindNearestGameObject(194300, 1.0f) ) - { - fire->SetOwnerGUID(0); - fire->Delete(); - } - me->DespawnOrUnsummon(); // this will remove DynObjects - } - } + void DoAction(int32 a) + { + if (a == 1) + { + if( GameObject* fire = me->FindNearestGameObject(194300, 1.0f) ) + { + fire->SetOwnerGUID(0); + fire->Delete(); + } + me->DespawnOrUnsummon(); // this will remove DynObjects + } + } - void SpellHit(Unit* caster, const SpellInfo* spell) - { - switch( spell->Id ) - { - case SPELL_ICE_SHARDS_SMALL: - case SPELL_ICE_SHARDS_BIG: - DoAction(1); - break; - } - } - }; + void SpellHit(Unit* caster, const SpellInfo* spell) + { + switch( spell->Id ) + { + case SPELL_ICE_SHARDS_SMALL: + case SPELL_ICE_SHARDS_BIG: + DoAction(1); + break; + } + } + }; }; class npc_ulduar_hodir_priest : public CreatureScript { public: - npc_ulduar_hodir_priest() : CreatureScript("npc_ulduar_hodir_priest") { } + npc_ulduar_hodir_priest() : CreatureScript("npc_ulduar_hodir_priest") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_hodir_priestAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_hodir_priestAI (pCreature); + } - struct npc_ulduar_hodir_priestAI : public ScriptedAI - { - npc_ulduar_hodir_priestAI(Creature *pCreature) : ScriptedAI(pCreature) - { - pInstance = me->GetInstanceScript(); - events.Reset(); - me->SetReactState(REACT_PASSIVE); - } + struct npc_ulduar_hodir_priestAI : public ScriptedAI + { + npc_ulduar_hodir_priestAI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = me->GetInstanceScript(); + events.Reset(); + me->SetReactState(REACT_PASSIVE); + } - EventMap events; - InstanceScript* pInstance; + EventMap events; + InstanceScript* pInstance; - void AttackStart(Unit* who) - { - AttackStartCaster(who, 17.0f); - } + void AttackStart(Unit* who) + { + AttackStartCaster(who, 17.0f); + } - void ScheduleAbilities() - { - events.ScheduleEvent(EVENT_PRIEST_DISPELL_MAGIC, 7000); - events.ScheduleEvent(EVENT_PRIEST_GREAT_HEAL, urand(6000,7000)); - events.ScheduleEvent(EVENT_PRIEST_SMITE, 2100); - } + void ScheduleAbilities() + { + events.ScheduleEvent(EVENT_PRIEST_DISPELL_MAGIC, 7000); + events.ScheduleEvent(EVENT_PRIEST_GREAT_HEAL, urand(6000,7000)); + events.ScheduleEvent(EVENT_PRIEST_SMITE, 2100); + } - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) - { - if(spell->Id == SPELL_FLASH_FREEZE_TRAPPED_NPC) - { - events.Reset(); - events.ScheduleEvent(EVENT_TRY_FREE_HELPER, 2000); - } - } + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) + { + if(spell->Id == SPELL_FLASH_FREEZE_TRAPPED_NPC) + { + events.Reset(); + events.ScheduleEvent(EVENT_TRY_FREE_HELPER, 2000); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); + void UpdateAI(uint32 diff) + { + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_TRY_FREE_HELPER: - { - if( !me->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC) ) - if( pInstance ) - if( uint64 g = pInstance->GetData64(TYPE_HODIR) ) - if( Creature* hodir = ObjectAccessor::GetCreature(*me, g) ) - { - AttackStart(hodir); - events.PopEvent(); - ScheduleAbilities(); - break; - } - events.RepeatEvent(2000); - } - break; - case EVENT_PRIEST_DISPELL_MAGIC: - me->CastCustomSpell(SPELL_PRIEST_DISPELL_MAGIC, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, false); - events.RepeatEvent(7000); - break; - case EVENT_PRIEST_GREAT_HEAL: - me->CastSpell(me, SPELL_PRIEST_GREAT_HEAL, false); - events.RepeatEvent(urand(6000,7000)); - break; - case EVENT_PRIEST_SMITE: - if (Unit* victim = me->GetVictim()) - me->CastSpell(victim, SPELL_PRIEST_SMITE, false); - events.RepeatEvent(2100); - break; - } - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_TRY_FREE_HELPER: + { + if( !me->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC) ) + if( pInstance ) + if( uint64 g = pInstance->GetData64(TYPE_HODIR) ) + if( Creature* hodir = ObjectAccessor::GetCreature(*me, g) ) + { + AttackStart(hodir); + events.PopEvent(); + ScheduleAbilities(); + break; + } + events.RepeatEvent(2000); + } + break; + case EVENT_PRIEST_DISPELL_MAGIC: + me->CastCustomSpell(SPELL_PRIEST_DISPELL_MAGIC, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, false); + events.RepeatEvent(7000); + break; + case EVENT_PRIEST_GREAT_HEAL: + me->CastSpell(me, SPELL_PRIEST_GREAT_HEAL, false); + events.RepeatEvent(urand(6000,7000)); + break; + case EVENT_PRIEST_SMITE: + if (Unit* victim = me->GetVictim()) + me->CastSpell(victim, SPELL_PRIEST_SMITE, false); + events.RepeatEvent(2100); + break; + } + } - void MoveInLineOfSight(Unit* who) {} - void EnterEvadeMode() {} - bool CanAIAttack(const Unit* t) const { return t->GetEntry() == NPC_HODIR; } + void MoveInLineOfSight(Unit* who) {} + void EnterEvadeMode() {} + bool CanAIAttack(const Unit* t) const { return t->GetEntry() == NPC_HODIR; } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_HODIR))) - hodir->AI()->SetData(4, 1); - } - }; + void JustDied(Unit* /*killer*/) + { + if (pInstance) + if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_HODIR))) + hodir->AI()->SetData(4, 1); + } + }; }; class npc_ulduar_hodir_druid : public CreatureScript { public: - npc_ulduar_hodir_druid() : CreatureScript("npc_ulduar_hodir_druid") { } + npc_ulduar_hodir_druid() : CreatureScript("npc_ulduar_hodir_druid") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_hodir_druidAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_hodir_druidAI (pCreature); + } - struct npc_ulduar_hodir_druidAI : public ScriptedAI - { - npc_ulduar_hodir_druidAI(Creature *pCreature) : ScriptedAI(pCreature) - { - pInstance = me->GetInstanceScript(); - events.Reset(); - me->SetReactState(REACT_PASSIVE); - } + struct npc_ulduar_hodir_druidAI : public ScriptedAI + { + npc_ulduar_hodir_druidAI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = me->GetInstanceScript(); + events.Reset(); + me->SetReactState(REACT_PASSIVE); + } - EventMap events; - InstanceScript* pInstance; + EventMap events; + InstanceScript* pInstance; - void AttackStart(Unit* who) - { - AttackStartCaster(who, 22.0f); - } + void AttackStart(Unit* who) + { + AttackStartCaster(who, 22.0f); + } - void ScheduleAbilities() - { - events.ScheduleEvent(EVENT_DRUID_WRATH, 1600); - events.ScheduleEvent(EVENT_DRUID_STARLIGHT, 10000); - } + void ScheduleAbilities() + { + events.ScheduleEvent(EVENT_DRUID_WRATH, 1600); + events.ScheduleEvent(EVENT_DRUID_STARLIGHT, 10000); + } - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) - { - if(spell->Id == SPELL_FLASH_FREEZE_TRAPPED_NPC) - { - events.Reset(); - events.ScheduleEvent(EVENT_TRY_FREE_HELPER, 2000); - } - } + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) + { + if(spell->Id == SPELL_FLASH_FREEZE_TRAPPED_NPC) + { + events.Reset(); + events.ScheduleEvent(EVENT_TRY_FREE_HELPER, 2000); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); + void UpdateAI(uint32 diff) + { + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_TRY_FREE_HELPER: - { - if( !me->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC) ) - if( pInstance ) - if( uint64 g = pInstance->GetData64(TYPE_HODIR) ) - if( Creature* hodir = ObjectAccessor::GetCreature(*me, g) ) - { - AttackStart(hodir); - events.PopEvent(); - ScheduleAbilities(); - break; - } - events.RepeatEvent(2000); - } - break; - case EVENT_DRUID_WRATH: - if (Unit* victim = me->GetVictim()) - me->CastSpell(victim, SPELL_DRUID_WRATH, false); - events.RepeatEvent(1600); - break; - case EVENT_DRUID_STARLIGHT: - if (me->GetPositionZ() < 433.0f) // ensure npc is on the ground - { - me->CastSpell(me, SPELL_DRUID_STARLIGHT_AREA_AURA, false); - events.RepeatEvent(15000); - break; - } - events.RepeatEvent(3000); - break; - } - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_TRY_FREE_HELPER: + { + if( !me->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC) ) + if( pInstance ) + if( uint64 g = pInstance->GetData64(TYPE_HODIR) ) + if( Creature* hodir = ObjectAccessor::GetCreature(*me, g) ) + { + AttackStart(hodir); + events.PopEvent(); + ScheduleAbilities(); + break; + } + events.RepeatEvent(2000); + } + break; + case EVENT_DRUID_WRATH: + if (Unit* victim = me->GetVictim()) + me->CastSpell(victim, SPELL_DRUID_WRATH, false); + events.RepeatEvent(1600); + break; + case EVENT_DRUID_STARLIGHT: + if (me->GetPositionZ() < 433.0f) // ensure npc is on the ground + { + me->CastSpell(me, SPELL_DRUID_STARLIGHT_AREA_AURA, false); + events.RepeatEvent(15000); + break; + } + events.RepeatEvent(3000); + break; + } + } - void MoveInLineOfSight(Unit* who) {} - void EnterEvadeMode() {} - bool CanAIAttack(const Unit* t) const { return t->GetEntry() == NPC_HODIR; } + void MoveInLineOfSight(Unit* who) {} + void EnterEvadeMode() {} + bool CanAIAttack(const Unit* t) const { return t->GetEntry() == NPC_HODIR; } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_HODIR))) - hodir->AI()->SetData(4, 1); - } - }; + void JustDied(Unit* /*killer*/) + { + if (pInstance) + if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_HODIR))) + hodir->AI()->SetData(4, 1); + } + }; }; class npc_ulduar_hodir_shaman : public CreatureScript { public: - npc_ulduar_hodir_shaman() : CreatureScript("npc_ulduar_hodir_shaman") { } + npc_ulduar_hodir_shaman() : CreatureScript("npc_ulduar_hodir_shaman") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_hodir_shamanAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_hodir_shamanAI (pCreature); + } - struct npc_ulduar_hodir_shamanAI : public ScriptedAI - { - npc_ulduar_hodir_shamanAI(Creature *pCreature) : ScriptedAI(pCreature) - { - pInstance = me->GetInstanceScript(); - events.Reset(); - me->SetReactState(REACT_PASSIVE); - } + struct npc_ulduar_hodir_shamanAI : public ScriptedAI + { + npc_ulduar_hodir_shamanAI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = me->GetInstanceScript(); + events.Reset(); + me->SetReactState(REACT_PASSIVE); + } - EventMap events; - InstanceScript* pInstance; + EventMap events; + InstanceScript* pInstance; - void AttackStart(Unit* who) - { - AttackStartCaster(who, 25.0f); - } + void AttackStart(Unit* who) + { + AttackStartCaster(who, 25.0f); + } - void ScheduleAbilities() - { - events.ScheduleEvent(EVENT_SHAMAN_LAVA_BURST, 2600); - events.ScheduleEvent(EVENT_SHAMAN_STORM_CLOUD, 10000); - } + void ScheduleAbilities() + { + events.ScheduleEvent(EVENT_SHAMAN_LAVA_BURST, 2600); + events.ScheduleEvent(EVENT_SHAMAN_STORM_CLOUD, 10000); + } - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) - { - if(spell->Id == SPELL_FLASH_FREEZE_TRAPPED_NPC) - { - events.Reset(); - events.ScheduleEvent(EVENT_TRY_FREE_HELPER, 2000); - } - } + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) + { + if(spell->Id == SPELL_FLASH_FREEZE_TRAPPED_NPC) + { + events.Reset(); + events.ScheduleEvent(EVENT_TRY_FREE_HELPER, 2000); + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (target && spell->Id == SPELL_SHAMAN_STORM_CLOUD) - if (Aura* a = target->GetAura(SPELL_SHAMAN_STORM_CLOUD, me->GetGUID())) - a->SetStackAmount(spell->StackAmount); - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (target && spell->Id == SPELL_SHAMAN_STORM_CLOUD) + if (Aura* a = target->GetAura(SPELL_SHAMAN_STORM_CLOUD, me->GetGUID())) + a->SetStackAmount(spell->StackAmount); + } - void UpdateAI(uint32 diff) - { - events.Update(diff); + void UpdateAI(uint32 diff) + { + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_TRY_FREE_HELPER: - { - if( !me->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC) ) - if( pInstance ) - if( uint64 g = pInstance->GetData64(TYPE_HODIR) ) - if( Creature* hodir = ObjectAccessor::GetCreature(*me, g) ) - { - AttackStart(hodir); - events.PopEvent(); - ScheduleAbilities(); - break; - } - events.RepeatEvent(2000); - } - break; - case EVENT_SHAMAN_LAVA_BURST: - if (Unit* victim = me->GetVictim()) - me->CastSpell(victim, SPELL_SHAMAN_LAVA_BURST, false); - events.RepeatEvent(2600); - break; - case EVENT_SHAMAN_STORM_CLOUD: - if (Player* target = ScriptedAI::SelectTargetFromPlayerList(35.0f, SPELL_SHAMAN_STORM_CLOUD)) - me->CastSpell(target, SPELL_SHAMAN_STORM_CLOUD, false); - events.RepeatEvent(30000); - break; - } - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_TRY_FREE_HELPER: + { + if( !me->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC) ) + if( pInstance ) + if( uint64 g = pInstance->GetData64(TYPE_HODIR) ) + if( Creature* hodir = ObjectAccessor::GetCreature(*me, g) ) + { + AttackStart(hodir); + events.PopEvent(); + ScheduleAbilities(); + break; + } + events.RepeatEvent(2000); + } + break; + case EVENT_SHAMAN_LAVA_BURST: + if (Unit* victim = me->GetVictim()) + me->CastSpell(victim, SPELL_SHAMAN_LAVA_BURST, false); + events.RepeatEvent(2600); + break; + case EVENT_SHAMAN_STORM_CLOUD: + if (Player* target = ScriptedAI::SelectTargetFromPlayerList(35.0f, SPELL_SHAMAN_STORM_CLOUD)) + me->CastSpell(target, SPELL_SHAMAN_STORM_CLOUD, false); + events.RepeatEvent(30000); + break; + } + } - void MoveInLineOfSight(Unit* who) {} - void EnterEvadeMode() {} - bool CanAIAttack(const Unit* t) const { return t->GetEntry() == NPC_HODIR; } + void MoveInLineOfSight(Unit* who) {} + void EnterEvadeMode() {} + bool CanAIAttack(const Unit* t) const { return t->GetEntry() == NPC_HODIR; } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_HODIR))) - hodir->AI()->SetData(4, 1); - } - }; + void JustDied(Unit* /*killer*/) + { + if (pInstance) + if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_HODIR))) + hodir->AI()->SetData(4, 1); + } + }; }; class npc_ulduar_hodir_mage : public CreatureScript { public: - npc_ulduar_hodir_mage() : CreatureScript("npc_ulduar_hodir_mage") { } + npc_ulduar_hodir_mage() : CreatureScript("npc_ulduar_hodir_mage") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_hodir_mageAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_hodir_mageAI (pCreature); + } - struct npc_ulduar_hodir_mageAI : public ScriptedAI - { - npc_ulduar_hodir_mageAI(Creature *pCreature) : ScriptedAI(pCreature) - { - pInstance = me->GetInstanceScript(); - events.Reset(); - me->SetReactState(REACT_PASSIVE); - } + struct npc_ulduar_hodir_mageAI : public ScriptedAI + { + npc_ulduar_hodir_mageAI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = me->GetInstanceScript(); + events.Reset(); + me->SetReactState(REACT_PASSIVE); + } - EventMap events; - InstanceScript* pInstance; + EventMap events; + InstanceScript* pInstance; - void AttackStart(Unit* who) - { - AttackStartCaster(who, 30.0f); - } + void AttackStart(Unit* who) + { + AttackStartCaster(who, 30.0f); + } - void ScheduleAbilities() - { - events.ScheduleEvent(EVENT_MAGE_FIREBALL, 3100); - events.ScheduleEvent(EVENT_MAGE_TOASTY_FIRE, 6000); - events.ScheduleEvent(EVENT_MAGE_MELT_ICE, 1000); - } + void ScheduleAbilities() + { + events.ScheduleEvent(EVENT_MAGE_FIREBALL, 3100); + events.ScheduleEvent(EVENT_MAGE_TOASTY_FIRE, 6000); + events.ScheduleEvent(EVENT_MAGE_MELT_ICE, 1000); + } - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) - { - if(spell->Id == SPELL_FLASH_FREEZE_TRAPPED_NPC) - { - events.Reset(); - events.ScheduleEvent(EVENT_TRY_FREE_HELPER, 2000); - } - } + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) + { + if(spell->Id == SPELL_FLASH_FREEZE_TRAPPED_NPC) + { + events.Reset(); + events.ScheduleEvent(EVENT_TRY_FREE_HELPER, 2000); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); + void UpdateAI(uint32 diff) + { + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_TRY_FREE_HELPER: - { - if( !me->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC) ) - if( pInstance ) - if( uint64 g = pInstance->GetData64(TYPE_HODIR) ) - if( Creature* hodir = ObjectAccessor::GetCreature(*me, g) ) - { - AttackStart(hodir); - events.PopEvent(); - ScheduleAbilities(); - break; - } - events.RepeatEvent(2000); - } - break; - case EVENT_MAGE_FIREBALL: - if (Unit* victim = me->GetVictim()) - me->CastSpell(victim, SPELL_MAGE_FIREBALL, false); - events.RepeatEvent(3100); - break; - case EVENT_MAGE_TOASTY_FIRE: - me->CastSpell(me, SPELL_MAGE_CONJURE_TOASTY_FIRE, false); - events.RepeatEvent(10000); - break; - case EVENT_MAGE_MELT_ICE: - { - std::list FB; - bool found = false; - me->GetCreaturesWithEntryInRange(FB, 150.0f, NPC_FLASH_FREEZE_NPC); - for( std::list::const_iterator itr = FB.begin(); itr != FB.end(); ++itr ) - if( !((*itr)->HasAura(SPELL_MAGE_MELT_ICE)) ) - { - me->CastSpell((*itr), SPELL_MAGE_MELT_ICE, false); - found = true; - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_TRY_FREE_HELPER: + { + if( !me->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC) ) + if( pInstance ) + if( uint64 g = pInstance->GetData64(TYPE_HODIR) ) + if( Creature* hodir = ObjectAccessor::GetCreature(*me, g) ) + { + AttackStart(hodir); + events.PopEvent(); + ScheduleAbilities(); + break; + } + events.RepeatEvent(2000); + } + break; + case EVENT_MAGE_FIREBALL: + if (Unit* victim = me->GetVictim()) + me->CastSpell(victim, SPELL_MAGE_FIREBALL, false); + events.RepeatEvent(3100); + break; + case EVENT_MAGE_TOASTY_FIRE: + me->CastSpell(me, SPELL_MAGE_CONJURE_TOASTY_FIRE, false); + events.RepeatEvent(10000); + break; + case EVENT_MAGE_MELT_ICE: + { + std::list FB; + bool found = false; + me->GetCreaturesWithEntryInRange(FB, 150.0f, NPC_FLASH_FREEZE_NPC); + for( std::list::const_iterator itr = FB.begin(); itr != FB.end(); ++itr ) + if( !((*itr)->HasAura(SPELL_MAGE_MELT_ICE)) ) + { + me->CastSpell((*itr), SPELL_MAGE_MELT_ICE, false); + found = true; + break; + } - if( found ) - { - events.DelayEvents(2000); - events.RepeatEvent(1999); - break; - } - events.RepeatEvent(5000); - } - break; - } - } + if( found ) + { + events.DelayEvents(2000); + events.RepeatEvent(1999); + break; + } + events.RepeatEvent(5000); + } + break; + } + } - void MoveInLineOfSight(Unit* who) {} - void EnterEvadeMode() {} - bool CanAIAttack(const Unit* t) const { return t->GetEntry() == NPC_HODIR; } + void MoveInLineOfSight(Unit* who) {} + void EnterEvadeMode() {} + bool CanAIAttack(const Unit* t) const { return t->GetEntry() == NPC_HODIR; } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_HODIR))) - hodir->AI()->SetData(4, 1); - } - }; + void JustDied(Unit* /*killer*/) + { + if (pInstance) + if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_HODIR))) + hodir->AI()->SetData(4, 1); + } + }; }; class spell_hodir_biting_cold_main_aura : public SpellScriptLoader { public: - spell_hodir_biting_cold_main_aura() : SpellScriptLoader("spell_hodir_biting_cold_main_aura") { } + spell_hodir_biting_cold_main_aura() : SpellScriptLoader("spell_hodir_biting_cold_main_aura") { } - class spell_hodir_biting_cold_main_aura_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hodir_biting_cold_main_aura_AuraScript) + class spell_hodir_biting_cold_main_aura_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hodir_biting_cold_main_aura_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if ((aurEff->GetTickNumber()%4) == 0) - if (Unit* target = GetTarget()) - if (target->GetTypeId() == TYPEID_PLAYER && !target->isMoving() && !target->HasAura(SPELL_BITING_COLD_PLAYER_AURA)) - target->CastSpell(target, SPELL_BITING_COLD_PLAYER_AURA, true); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if ((aurEff->GetTickNumber()%4) == 0) + if (Unit* target = GetTarget()) + if (target->GetTypeId() == TYPEID_PLAYER && !target->isMoving() && !target->HasAura(SPELL_BITING_COLD_PLAYER_AURA)) + target->CastSpell(target, SPELL_BITING_COLD_PLAYER_AURA, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_biting_cold_main_aura_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_biting_cold_main_aura_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_hodir_biting_cold_main_aura_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_hodir_biting_cold_main_aura_AuraScript(); + } }; class spell_hodir_biting_cold_player_aura : public SpellScriptLoader { public: - spell_hodir_biting_cold_player_aura() : SpellScriptLoader("spell_hodir_biting_cold_player_aura") { } + spell_hodir_biting_cold_player_aura() : SpellScriptLoader("spell_hodir_biting_cold_player_aura") { } - class spell_hodir_biting_cold_player_aura_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hodir_biting_cold_player_aura_AuraScript) + class spell_hodir_biting_cold_player_aura_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hodir_biting_cold_player_aura_AuraScript) - uint8 counter; - bool prev; + uint8 counter; + bool prev; - bool Load() - { - counter = 0; - prev = false; - return true; - } + bool Load() + { + counter = 0; + prev = false; + return true; + } - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - - if (Unit* target = GetTarget()) - { - if (target->GetMapId() == 603) - SetDuration(GetMaxDuration()); - if (target->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER)) - return; - if (target->isMoving() || target->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA)) - { - if (prev) - { - ModStackAmount(-1); - prev = false; - } - else - prev = true; + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + + if (Unit* target = GetTarget()) + { + if (target->GetMapId() == 603) + SetDuration(GetMaxDuration()); + if (target->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER)) + return; + if (target->isMoving() || target->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA)) + { + if (prev) + { + ModStackAmount(-1); + prev = false; + } + else + prev = true; - if (counter>=2) - counter -= 2; - else if (counter) - --counter; - } - else - { - prev = false; - ++counter; - if (counter >= 4) - { - if (GetStackAmount() == 2) // increasing from 2 to 3 (not checking >= to improve performance) - if (InstanceScript* pInstance = target->GetInstanceScript()) - if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_HODIR))) - hodir->AI()->SetData(2, 1); - ModStackAmount(1); - counter = 0; - } - } + if (counter>=2) + counter -= 2; + else if (counter) + --counter; + } + else + { + prev = false; + ++counter; + if (counter >= 4) + { + if (GetStackAmount() == 2) // increasing from 2 to 3 (not checking >= to improve performance) + if (InstanceScript* pInstance = target->GetInstanceScript()) + if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_HODIR))) + hodir->AI()->SetData(2, 1); + ModStackAmount(1); + counter = 0; + } + } - const int32 dmg = 200*pow(2.0f, GetStackAmount()); - target->CastCustomSpell(target, SPELL_BITING_COLD_DAMAGE, &dmg, 0, 0, true); - } - } + const int32 dmg = 200*pow(2.0f, GetStackAmount()); + target->CastCustomSpell(target, SPELL_BITING_COLD_DAMAGE, &dmg, 0, 0, true); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_biting_cold_player_aura_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_biting_cold_player_aura_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_hodir_biting_cold_player_aura_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_hodir_biting_cold_player_aura_AuraScript(); + } }; class spell_hodir_periodic_icicle : public SpellScriptLoader { public: - spell_hodir_periodic_icicle() : SpellScriptLoader("spell_hodir_periodic_icicle") { } + spell_hodir_periodic_icicle() : SpellScriptLoader("spell_hodir_periodic_icicle") { } - class spell_hodir_periodic_icicle_SpellScript : public SpellScript - { - PrepareSpellScript(spell_hodir_periodic_icicle_SpellScript); + class spell_hodir_periodic_icicle_SpellScript : public SpellScript + { + PrepareSpellScript(spell_hodir_periodic_icicle_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_FLASH_FREEZE_TRAPPED_PLAYER)); - Trinity::Containers::RandomResizeList(targets, 1); - } + void FilterTargets(std::list& targets) + { + targets.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_FLASH_FREEZE_TRAPPED_PLAYER)); + Trinity::Containers::RandomResizeList(targets, 1); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_periodic_icicle_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_periodic_icicle_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_hodir_periodic_icicle_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_hodir_periodic_icicle_SpellScript(); + } }; class FlashFreezeCheck { public: - FlashFreezeCheck() { } + FlashFreezeCheck() { } - bool operator()(WorldObject* target) const - { - if (Unit* unit = target->ToUnit()) - return unit->HasAura(SPELL_SAFE_AREA_TRIGGERED) || unit->IsPet(); - return true; - } + bool operator()(WorldObject* target) const + { + if (Unit* unit = target->ToUnit()) + return unit->HasAura(SPELL_SAFE_AREA_TRIGGERED) || unit->IsPet(); + return true; + } }; class spell_hodir_flash_freeze : public SpellScriptLoader { public: - spell_hodir_flash_freeze() : SpellScriptLoader("spell_hodir_flash_freeze") { } + spell_hodir_flash_freeze() : SpellScriptLoader("spell_hodir_flash_freeze") { } - class spell_hodir_flash_freeze_SpellScript : public SpellScript - { - PrepareSpellScript(spell_hodir_flash_freeze_SpellScript); + class spell_hodir_flash_freeze_SpellScript : public SpellScript + { + PrepareSpellScript(spell_hodir_flash_freeze_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove_if(FlashFreezeCheck()); - } + void FilterTargets(std::list& targets) + { + targets.remove_if(FlashFreezeCheck()); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_flash_freeze_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_flash_freeze_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_flash_freeze_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_flash_freeze_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; - class spell_hodir_flash_freeze_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hodir_flash_freeze_AuraScript) + class spell_hodir_flash_freeze_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hodir_flash_freeze_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (aurEff->GetTickNumber() == aurEff->GetTotalTicks()-1) - { - Unit* target = GetTarget(); - Unit* caster = GetCaster(); - if (!target || !caster || caster->GetTypeId() != TYPEID_UNIT) - return; + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (aurEff->GetTickNumber() == aurEff->GetTotalTicks()-1) + { + Unit* target = GetTarget(); + Unit* caster = GetCaster(); + if (!target || !caster || caster->GetTypeId() != TYPEID_UNIT) + return; - if (Aura* aur = target->GetAura(target->GetTypeId() == TYPEID_PLAYER ? SPELL_FLASH_FREEZE_TRAPPED_PLAYER : SPELL_FLASH_FREEZE_TRAPPED_NPC)) - { - if (Unit* caster = aur->GetCaster()) - if (caster->GetTypeId() == TYPEID_UNIT) - caster->ToCreature()->DespawnOrUnsummon(); - target->CastSpell(target, SPELL_FLASH_FREEZE_INSTAKILL, true); - return; - } - if (target->GetTypeId() == TYPEID_PLAYER) - { - caster->ToCreature()->AI()->SetData(1, 1); - if( Creature* c = target->SummonCreature(NPC_FLASH_FREEZE_PLR, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 5*60*1000) ) - { - c->CastSpell(target, SPELL_FLASH_FREEZE_TRAPPED_PLAYER, true); - caster->ToCreature()->AI()->JustSummoned(c); - } - } - else if (target->GetTypeId() == TYPEID_UNIT) - { - if( Creature* c = target->SummonCreature(NPC_FLASH_FREEZE_NPC, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000) ) - { - c->CastSpell(target, SPELL_FLASH_FREEZE_TRAPPED_NPC, true); - caster->ToCreature()->AI()->JustSummoned(c); - } - } - } - } + if (Aura* aur = target->GetAura(target->GetTypeId() == TYPEID_PLAYER ? SPELL_FLASH_FREEZE_TRAPPED_PLAYER : SPELL_FLASH_FREEZE_TRAPPED_NPC)) + { + if (Unit* caster = aur->GetCaster()) + if (caster->GetTypeId() == TYPEID_UNIT) + caster->ToCreature()->DespawnOrUnsummon(); + target->CastSpell(target, SPELL_FLASH_FREEZE_INSTAKILL, true); + return; + } + if (target->GetTypeId() == TYPEID_PLAYER) + { + caster->ToCreature()->AI()->SetData(1, 1); + if( Creature* c = target->SummonCreature(NPC_FLASH_FREEZE_PLR, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 5*60*1000) ) + { + c->CastSpell(target, SPELL_FLASH_FREEZE_TRAPPED_PLAYER, true); + caster->ToCreature()->AI()->JustSummoned(c); + } + } + else if (target->GetTypeId() == TYPEID_UNIT) + { + if( Creature* c = target->SummonCreature(NPC_FLASH_FREEZE_NPC, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000) ) + { + c->CastSpell(target, SPELL_FLASH_FREEZE_TRAPPED_NPC, true); + caster->ToCreature()->AI()->JustSummoned(c); + } + } + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_flash_freeze_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_flash_freeze_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_hodir_flash_freeze_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_hodir_flash_freeze_SpellScript(); + } - AuraScript *GetAuraScript() const - { - return new spell_hodir_flash_freeze_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_hodir_flash_freeze_AuraScript(); + } }; class spell_hodir_storm_power : public SpellScriptLoader { public: - spell_hodir_storm_power() : SpellScriptLoader("spell_hodir_storm_power") { } + spell_hodir_storm_power() : SpellScriptLoader("spell_hodir_storm_power") { } - class spell_hodir_storm_power_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hodir_storm_power_AuraScript) + class spell_hodir_storm_power_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hodir_storm_power_AuraScript) - void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - if (Aura* a = caster->GetAura(GetId() == SPELL_SHAMAN_STORM_POWER_10 ? SPELL_SHAMAN_STORM_CLOUD_10 : SPELL_SHAMAN_STORM_CLOUD_25)) - a->ModStackAmount(-1); - } + void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + if (Aura* a = caster->GetAura(GetId() == SPELL_SHAMAN_STORM_POWER_10 ? SPELL_SHAMAN_STORM_CLOUD_10 : SPELL_SHAMAN_STORM_CLOUD_25)) + a->ModStackAmount(-1); + } - void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* target = GetTarget()) - if (target->GetTypeId() == TYPEID_PLAYER) - target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, GetId(), 0, GetCaster()); - } + void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + if (target->GetTypeId() == TYPEID_PLAYER) + target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, GetId(), 0, GetCaster()); + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_hodir_storm_power_AuraScript::OnApply, EFFECT_0, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, AURA_EFFECT_HANDLE_REAL); - AfterEffectApply += AuraEffectApplyFn(spell_hodir_storm_power_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_hodir_storm_power_AuraScript::OnApply, EFFECT_0, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, AURA_EFFECT_HANDLE_REAL); + AfterEffectApply += AuraEffectApplyFn(spell_hodir_storm_power_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_hodir_storm_power_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_hodir_storm_power_AuraScript(); + } }; class spell_hodir_storm_cloud : public SpellScriptLoader { public: - spell_hodir_storm_cloud() : SpellScriptLoader("spell_hodir_storm_cloud") { } + spell_hodir_storm_cloud() : SpellScriptLoader("spell_hodir_storm_cloud") { } - class spell_hodir_storm_cloud_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hodir_storm_cloud_AuraScript) + class spell_hodir_storm_cloud_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hodir_storm_cloud_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - PreventDefaultAction(); - if (Unit* target = GetTarget()) - target->CastSpell((Unit*)NULL, (GetId() == SPELL_SHAMAN_STORM_CLOUD_10 ? SPELL_SHAMAN_STORM_POWER_10 : SPELL_SHAMAN_STORM_POWER_25), true); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + PreventDefaultAction(); + if (Unit* target = GetTarget()) + target->CastSpell((Unit*)NULL, (GetId() == SPELL_SHAMAN_STORM_CLOUD_10 ? SPELL_SHAMAN_STORM_POWER_10 : SPELL_SHAMAN_STORM_POWER_25), true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_storm_cloud_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_storm_cloud_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_hodir_storm_cloud_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_hodir_storm_cloud_AuraScript(); + } }; class achievement_cheese_the_freeze : public AchievementCriteriaScript { public: - achievement_cheese_the_freeze() : AchievementCriteriaScript("achievement_cheese_the_freeze") {} + achievement_cheese_the_freeze() : AchievementCriteriaScript("achievement_cheese_the_freeze") {} - bool OnCheck(Player* player, Unit* target) - { - return target && target->GetEntry() == NPC_HODIR && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(1); - } + bool OnCheck(Player* player, Unit* target) + { + return target && target->GetEntry() == NPC_HODIR && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(1); + } }; class achievement_getting_cold_in_here : public AchievementCriteriaScript { public: - achievement_getting_cold_in_here() : AchievementCriteriaScript("achievement_getting_cold_in_here") {} + achievement_getting_cold_in_here() : AchievementCriteriaScript("achievement_getting_cold_in_here") {} - bool OnCheck(Player* player, Unit* target) - { - return target && target->GetEntry() == NPC_HODIR && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(2); - } + bool OnCheck(Player* player, Unit* target) + { + return target && target->GetEntry() == NPC_HODIR && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(2); + } }; class achievement_i_could_say_that_this_cache_was_rare : public AchievementCriteriaScript { public: - achievement_i_could_say_that_this_cache_was_rare() : AchievementCriteriaScript("achievement_i_could_say_that_this_cache_was_rare") {} + achievement_i_could_say_that_this_cache_was_rare() : AchievementCriteriaScript("achievement_i_could_say_that_this_cache_was_rare") {} - bool OnCheck(Player* player, Unit* target) - { - return target && target->GetEntry() == NPC_HODIR && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(3); - } + bool OnCheck(Player* player, Unit* target) + { + return target && target->GetEntry() == NPC_HODIR && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(3); + } }; class achievement_i_have_the_coolest_friends : public AchievementCriteriaScript { public: - achievement_i_have_the_coolest_friends() : AchievementCriteriaScript("achievement_i_have_the_coolest_friends") {} + achievement_i_have_the_coolest_friends() : AchievementCriteriaScript("achievement_i_have_the_coolest_friends") {} - bool OnCheck(Player* player, Unit* target) - { - return target && target->GetEntry() == NPC_HODIR && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(4); - } + bool OnCheck(Player* player, Unit* target) + { + return target && target->GetEntry() == NPC_HODIR && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(4); + } }; class achievement_staying_buffed_all_winter_10 : public AchievementCriteriaScript { public: - achievement_staying_buffed_all_winter_10() : AchievementCriteriaScript("achievement_staying_buffed_all_winter_10") {} + achievement_staying_buffed_all_winter_10() : AchievementCriteriaScript("achievement_staying_buffed_all_winter_10") {} - bool OnCheck(Player* player, Unit* target) - { - return player && player->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA) && player->HasAura(SPELL_DRUID_STARLIGHT_AREA_AURA) && player->HasAura(SPELL_SHAMAN_STORM_POWER_10); - } + bool OnCheck(Player* player, Unit* target) + { + return player && player->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA) && player->HasAura(SPELL_DRUID_STARLIGHT_AREA_AURA) && player->HasAura(SPELL_SHAMAN_STORM_POWER_10); + } }; class achievement_staying_buffed_all_winter_25 : public AchievementCriteriaScript { public: - achievement_staying_buffed_all_winter_25() : AchievementCriteriaScript("achievement_staying_buffed_all_winter_25") {} + achievement_staying_buffed_all_winter_25() : AchievementCriteriaScript("achievement_staying_buffed_all_winter_25") {} - bool OnCheck(Player* player, Unit* target) - { - return player && player->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA) && player->HasAura(SPELL_DRUID_STARLIGHT_AREA_AURA) && player->HasAura(SPELL_SHAMAN_STORM_POWER_25); - } + bool OnCheck(Player* player, Unit* target) + { + return player && player->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA) && player->HasAura(SPELL_DRUID_STARLIGHT_AREA_AURA) && player->HasAura(SPELL_SHAMAN_STORM_POWER_25); + } }; class spell_hodir_toasty_fire : public SpellScriptLoader { public: - spell_hodir_toasty_fire() : SpellScriptLoader("spell_hodir_toasty_fire") { } + spell_hodir_toasty_fire() : SpellScriptLoader("spell_hodir_toasty_fire") { } - class spell_hodir_toasty_fire_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hodir_toasty_fire_AuraScript); + class spell_hodir_toasty_fire_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hodir_toasty_fire_AuraScript); - void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* target = GetTarget()) - if (target->GetTypeId() == TYPEID_PLAYER) - target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_MAGE_TOASTY_FIRE_AURA, 0, GetCaster()); - } + void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + if (target->GetTypeId() == TYPEID_PLAYER) + target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_MAGE_TOASTY_FIRE_AURA, 0, GetCaster()); + } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_hodir_toasty_fire_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK); - } - }; + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_hodir_toasty_fire_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_hodir_toasty_fire_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_hodir_toasty_fire_AuraScript(); + } }; class spell_hodir_starlight : public SpellScriptLoader { public: - spell_hodir_starlight() : SpellScriptLoader("spell_hodir_starlight") { } + spell_hodir_starlight() : SpellScriptLoader("spell_hodir_starlight") { } - class spell_hodir_starlight_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hodir_starlight_AuraScript); + class spell_hodir_starlight_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hodir_starlight_AuraScript); - void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* target = GetTarget()) - if (target->GetTypeId() == TYPEID_PLAYER) - target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_DRUID_STARLIGHT_AREA_AURA, 0, GetCaster()); - } + void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + if (target->GetTypeId() == TYPEID_PLAYER) + target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_DRUID_STARLIGHT_AREA_AURA, 0, GetCaster()); + } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_hodir_starlight_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MELEE_SLOW, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK); - } - }; + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_hodir_starlight_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MELEE_SLOW, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_hodir_starlight_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_hodir_starlight_AuraScript(); + } }; void AddSC_boss_hodir() { - new boss_hodir(); - new npc_ulduar_icicle(); - new npc_ulduar_flash_freeze(); - new npc_ulduar_toasty_fire(); + new boss_hodir(); + new npc_ulduar_icicle(); + new npc_ulduar_flash_freeze(); + new npc_ulduar_toasty_fire(); - new npc_ulduar_hodir_priest(); - new npc_ulduar_hodir_druid(); - new npc_ulduar_hodir_shaman(); - new npc_ulduar_hodir_mage(); + new npc_ulduar_hodir_priest(); + new npc_ulduar_hodir_druid(); + new npc_ulduar_hodir_shaman(); + new npc_ulduar_hodir_mage(); - new spell_hodir_biting_cold_main_aura(); - new spell_hodir_biting_cold_player_aura(); - new spell_hodir_periodic_icicle(); - new spell_hodir_flash_freeze(); - new spell_hodir_storm_power(); - new spell_hodir_storm_cloud(); + new spell_hodir_biting_cold_main_aura(); + new spell_hodir_biting_cold_player_aura(); + new spell_hodir_periodic_icicle(); + new spell_hodir_flash_freeze(); + new spell_hodir_storm_power(); + new spell_hodir_storm_cloud(); - new achievement_cheese_the_freeze(); - new achievement_getting_cold_in_here(); - new achievement_i_could_say_that_this_cache_was_rare(); - new achievement_i_have_the_coolest_friends(); - new achievement_staying_buffed_all_winter_10(); - new achievement_staying_buffed_all_winter_25(); - new spell_hodir_toasty_fire(); - new spell_hodir_starlight(); + new achievement_cheese_the_freeze(); + new achievement_getting_cold_in_here(); + new achievement_i_could_say_that_this_cache_was_rare(); + new achievement_i_have_the_coolest_friends(); + new achievement_staying_buffed_all_winter_10(); + new achievement_staying_buffed_all_winter_25(); + new spell_hodir_toasty_fire(); + new spell_hodir_starlight(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index 7115ce650..66f29bde5 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp @@ -11,539 +11,539 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! #include "SpellAuraEffects.h" #include "Player.h" -#define SPELL_FLAME_JETS_10 62680 -#define SPELL_FLAME_JETS_25 63472 -#define S_FLAME_JETS RAID_MODE(SPELL_FLAME_JETS_10, SPELL_FLAME_JETS_25) -#define SPELL_SCORCH_10 62546 -#define SPELL_SCORCH_25 63474 -#define S_SCORCH RAID_MODE(SPELL_SCORCH_10, SPELL_SCORCH_25) -#define SPELL_ACTIVATE_CONSTRUCT 62488 -#define SPELL_STRENGTH_OF_THE_CREATOR 64473 -#define SPELL_SLAG_POT_10 62717 -#define SPELL_SLAG_POT_25 63477 -#define S_SLAG_POT RAID_MODE(SPELL_SLAG_POT_10, SPELL_SLAG_POT_25) -#define SPELL_BERSERK 64238 -#define SPELL_GRAB 62707 -#define SPELL_GRAB_TRIGGERED 62708 -#define SPELL_GRAB_CONTROL_2 62711 +#define SPELL_FLAME_JETS_10 62680 +#define SPELL_FLAME_JETS_25 63472 +#define S_FLAME_JETS RAID_MODE(SPELL_FLAME_JETS_10, SPELL_FLAME_JETS_25) +#define SPELL_SCORCH_10 62546 +#define SPELL_SCORCH_25 63474 +#define S_SCORCH RAID_MODE(SPELL_SCORCH_10, SPELL_SCORCH_25) +#define SPELL_ACTIVATE_CONSTRUCT 62488 +#define SPELL_STRENGTH_OF_THE_CREATOR 64473 +#define SPELL_SLAG_POT_10 62717 +#define SPELL_SLAG_POT_25 63477 +#define S_SLAG_POT RAID_MODE(SPELL_SLAG_POT_10, SPELL_SLAG_POT_25) +#define SPELL_BERSERK 64238 +#define SPELL_GRAB 62707 +#define SPELL_GRAB_TRIGGERED 62708 +#define SPELL_GRAB_CONTROL_2 62711 -#define SPELL_SCORCHED_GROUND_10 62548 -#define SPELL_SCORCHED_GROUND_25 63476 -#define S_SCORCHED_GROUND RAID_MODE(SPELL_SCORCHED_GROUND_10, SPELL_SCORCHED_GROUND_25) -#define SPELL_HEAT_AREA 62343 -#define SPELL_HEAT_BUFF 65667 -#define SPELL_MOLTEN 62373 -#define SPELL_BRITTLE_10 62382 -#define SPELL_BRITTLE_25 67114 -#define S_BRITTLE RAID_MODE(SPELL_BRITTLE_10, SPELL_BRITTLE_25) -#define SPELL_SHATTER 62383 +#define SPELL_SCORCHED_GROUND_10 62548 +#define SPELL_SCORCHED_GROUND_25 63476 +#define S_SCORCHED_GROUND RAID_MODE(SPELL_SCORCHED_GROUND_10, SPELL_SCORCHED_GROUND_25) +#define SPELL_HEAT_AREA 62343 +#define SPELL_HEAT_BUFF 65667 +#define SPELL_MOLTEN 62373 +#define SPELL_BRITTLE_10 62382 +#define SPELL_BRITTLE_25 67114 +#define S_BRITTLE RAID_MODE(SPELL_BRITTLE_10, SPELL_BRITTLE_25) +#define SPELL_SHATTER 62383 -#define BOSS_IGNIS 33118 -#define NPC_IRON_CONSTRUCT 33121 -#define NPC_SCORCHED_GROUND 33123 -#define NPC_WATER_TRIGGER 22515 +#define BOSS_IGNIS 33118 +#define NPC_IRON_CONSTRUCT 33121 +#define NPC_SCORCHED_GROUND 33123 +#define NPC_WATER_TRIGGER 22515 -#define TEXT_AGGRO "Insolent whelps! Your blood will temper the weapons used to reclaim this world!" -#define TEXT_ACTIVATE_CONSTRUCT "Arise, soldiers of the Iron Crucible! The Makers' will be done!" -#define TEXT_SCORCH_1 "Let the inferno consume you!" -#define TEXT_SCORCH_2 "BURN! Burn in the makers fire!" -#define TEXT_SLAG_POT "I will burn away your impurities!" -#define TEXT_SLAY_1 "More scraps for the scrapheap!" -#define TEXT_SLAY_2 "Your bones will serve as kindling!" -#define TEXT_BERSERK "Let it be finished!" -#define TEXT_DEATH "I. Have. Failed." -#define TEXT_FLAME_JETS "Ignis The Furnace Master begins to cast Flame Jets!" +#define TEXT_AGGRO "Insolent whelps! Your blood will temper the weapons used to reclaim this world!" +#define TEXT_ACTIVATE_CONSTRUCT "Arise, soldiers of the Iron Crucible! The Makers' will be done!" +#define TEXT_SCORCH_1 "Let the inferno consume you!" +#define TEXT_SCORCH_2 "BURN! Burn in the makers fire!" +#define TEXT_SLAG_POT "I will burn away your impurities!" +#define TEXT_SLAY_1 "More scraps for the scrapheap!" +#define TEXT_SLAY_2 "Your bones will serve as kindling!" +#define TEXT_BERSERK "Let it be finished!" +#define TEXT_DEATH "I. Have. Failed." +#define TEXT_FLAME_JETS "Ignis The Furnace Master begins to cast Flame Jets!" -#define SOUND_AGGRO 15564 -#define SOUND_ACTIVATE_CONSTRUCT 15565 -#define SOUND_SLAG_POT 15566 -#define SOUND_SCORCH_1 15567 -#define SOUND_SCORCH_2 15568 -#define SOUND_SLAY_1 15569 -#define SOUND_SLAY_2 15570 -#define SOUND_BERSERK 15571 -#define SOUND_DEATH 15572 +#define SOUND_AGGRO 15564 +#define SOUND_ACTIVATE_CONSTRUCT 15565 +#define SOUND_SLAG_POT 15566 +#define SOUND_SCORCH_1 15567 +#define SOUND_SCORCH_2 15568 +#define SOUND_SLAY_1 15569 +#define SOUND_SLAY_2 15570 +#define SOUND_BERSERK 15571 +#define SOUND_DEATH 15572 #define ACHIEV_STOKIN_THE_FURNACE_EVENT 20951 enum eEvents { - EVENT_NONE = 0, - EVENT_ACTIVATE_CONSTRUCT, - EVENT_SPELL_SCORCH, - EVENT_ENABLE_ROTATE, - EVENT_SPELL_FLAME_JETS, - EVENT_GRAB, + EVENT_NONE = 0, + EVENT_ACTIVATE_CONSTRUCT, + EVENT_SPELL_SCORCH, + EVENT_ENABLE_ROTATE, + EVENT_SPELL_FLAME_JETS, + EVENT_GRAB, }; class npc_ulduar_iron_construct : public CreatureScript { public: - npc_ulduar_iron_construct() : CreatureScript("npc_ulduar_iron_construct") { } + npc_ulduar_iron_construct() : CreatureScript("npc_ulduar_iron_construct") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_iron_constructAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_iron_constructAI (pCreature); + } - struct npc_ulduar_iron_constructAI : public ScriptedAI - { - npc_ulduar_iron_constructAI(Creature *pCreature) : ScriptedAI(pCreature) - { - me->CastSpell(me, 38757, true); - } + struct npc_ulduar_iron_constructAI : public ScriptedAI + { + npc_ulduar_iron_constructAI(Creature *pCreature) : ScriptedAI(pCreature) + { + me->CastSpell(me, 38757, true); + } - uint16 timer; + uint16 timer; - void Reset() - { - timer = 1000; - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } + void Reset() + { + timer = 1000; + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } - void JustReachedHome() - { - me->CastSpell(me, 38757, true); - } + void JustReachedHome() + { + me->CastSpell(me, 38757, true); + } - void SpellHit(Unit* /*caster*/, const SpellInfo* spell) - { - if (spell->Id == SPELL_ACTIVATE_CONSTRUCT) - { - me->RemoveAura(38757); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetReactState(REACT_AGGRESSIVE); - if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* ignis = ObjectAccessor::GetCreature(*me, instance->GetData64(TYPE_IGNIS))) - { - ignis->CastSpell(ignis, SPELL_STRENGTH_OF_THE_CREATOR, true); - AttackStart(ignis->GetVictim()); - DoZoneInCombat(); - } - } - else if (spell->Id == SPELL_HEAT_BUFF) - { - if (Aura* a = me->GetAura(SPELL_HEAT_BUFF)) - if( a->GetStackAmount() >= RAID_MODE(10,20) ) - { - if (RAID_MODE(1,0) && a->GetStackAmount() > 10) // prevent going over 10 on 10man version - a->ModStackAmount(-1); + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) + { + if (spell->Id == SPELL_ACTIVATE_CONSTRUCT) + { + me->RemoveAura(38757); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_AGGRESSIVE); + if (InstanceScript* instance = me->GetInstanceScript()) + if (Creature* ignis = ObjectAccessor::GetCreature(*me, instance->GetData64(TYPE_IGNIS))) + { + ignis->CastSpell(ignis, SPELL_STRENGTH_OF_THE_CREATOR, true); + AttackStart(ignis->GetVictim()); + DoZoneInCombat(); + } + } + else if (spell->Id == SPELL_HEAT_BUFF) + { + if (Aura* a = me->GetAura(SPELL_HEAT_BUFF)) + if( a->GetStackAmount() >= RAID_MODE(10,20) ) + { + if (RAID_MODE(1,0) && a->GetStackAmount() > 10) // prevent going over 10 on 10man version + a->ModStackAmount(-1); - me->CastSpell(me, SPELL_MOLTEN, true); - me->getThreatManager().resetAllAggro(); - } - } - } + me->CastSpell(me, SPELL_MOLTEN, true); + me->getThreatManager().resetAllAggro(); + } + } + } - void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if( damage >= RAID_MODE(3000U, 5000U) && me->GetAura(S_BRITTLE) ) - { - me->CastSpell(me, SPELL_SHATTER, true); - Unit::Kill(attacker, me); + void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if( damage >= RAID_MODE(3000U, 5000U) && me->GetAura(S_BRITTLE) ) + { + me->CastSpell(me, SPELL_SHATTER, true); + Unit::Kill(attacker, me); - if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* ignis = ObjectAccessor::GetCreature(*me, instance->GetData64(TYPE_IGNIS))) - ignis->AI()->SetData(1337, 0); - } - } + if (InstanceScript* instance = me->GetInstanceScript()) + if (Creature* ignis = ObjectAccessor::GetCreature(*me, instance->GetData64(TYPE_IGNIS))) + ignis->AI()->SetData(1337, 0); + } + } - void JustDied(Unit* killer) - { - if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* ignis = ObjectAccessor::GetCreature(*me, instance->GetData64(TYPE_IGNIS))) - ignis->RemoveAuraFromStack(SPELL_STRENGTH_OF_THE_CREATOR); - } + void JustDied(Unit* killer) + { + if (InstanceScript* instance = me->GetInstanceScript()) + if (Creature* ignis = ObjectAccessor::GetCreature(*me, instance->GetData64(TYPE_IGNIS))) + ignis->RemoveAuraFromStack(SPELL_STRENGTH_OF_THE_CREATOR); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if (timer <= diff) - { - timer = 1000; - if (Aura* a = me->GetAura(SPELL_MOLTEN)) - if (me->FindNearestCreature(NPC_WATER_TRIGGER, 18.0f, true)) - { - me->RemoveAura(a); - me->CastSpell(me, S_BRITTLE, true); - } - } - else - timer -= diff; + if (timer <= diff) + { + timer = 1000; + if (Aura* a = me->GetAura(SPELL_MOLTEN)) + if (me->FindNearestCreature(NPC_WATER_TRIGGER, 18.0f, true)) + { + me->RemoveAura(a); + me->CastSpell(me, S_BRITTLE, true); + } + } + else + timer -= diff; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void MoveInLineOfSight(Unit* /*who*/) {} - }; + void MoveInLineOfSight(Unit* /*who*/) {} + }; }; class boss_ignis : public CreatureScript { public: - boss_ignis() : CreatureScript("boss_ignis") { } + boss_ignis() : CreatureScript("boss_ignis") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_ignisAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_ignisAI (pCreature); + } - struct boss_ignisAI : public ScriptedAI - { - boss_ignisAI(Creature *pCreature) : ScriptedAI(pCreature) { } + struct boss_ignisAI : public ScriptedAI + { + boss_ignisAI(Creature *pCreature) : ScriptedAI(pCreature) { } - EventMap events; - uint8 counter; - bool bShattered; - uint32 lastShatterMSTime; + EventMap events; + uint8 counter; + bool bShattered; + uint32 lastShatterMSTime; - void Reset() - { - events.Reset(); - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - counter = 0; - bShattered = false; - lastShatterMSTime = 0; - - if( InstanceScript* m_pInstance = me->GetInstanceScript() ) - { - m_pInstance->SetData(TYPE_IGNIS, NOT_STARTED); - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_STOKIN_THE_FURNACE_EVENT); - } - } + void Reset() + { + events.Reset(); + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + counter = 0; + bShattered = false; + lastShatterMSTime = 0; + + if( InstanceScript* m_pInstance = me->GetInstanceScript() ) + { + m_pInstance->SetData(TYPE_IGNIS, NOT_STARTED); + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_STOKIN_THE_FURNACE_EVENT); + } + } - void EnterCombat(Unit* who) - { - me->setActive(true); + void EnterCombat(Unit* who) + { + me->setActive(true); - std::list icl; - me->GetCreaturesWithEntryInRange(icl, 300.0f, NPC_IRON_CONSTRUCT); - for( std::list::iterator itr = icl.begin(); itr != icl.end(); ++itr ) - { - if (!(*itr)->IsAlive()) - { - (*itr)->Respawn(); - (*itr)->UpdatePosition((*itr)->GetHomePosition(), true); - (*itr)->StopMovingOnCurrentPos(); - } - (*itr)->AI()->Reset(); - if (!(*itr)->HasAura(38757)) - (*itr)->CastSpell((*itr), 38757, true); - } + std::list icl; + me->GetCreaturesWithEntryInRange(icl, 300.0f, NPC_IRON_CONSTRUCT); + for( std::list::iterator itr = icl.begin(); itr != icl.end(); ++itr ) + { + if (!(*itr)->IsAlive()) + { + (*itr)->Respawn(); + (*itr)->UpdatePosition((*itr)->GetHomePosition(), true); + (*itr)->StopMovingOnCurrentPos(); + } + (*itr)->AI()->Reset(); + if (!(*itr)->HasAura(38757)) + (*itr)->CastSpell((*itr), 38757, true); + } - bShattered = false; - lastShatterMSTime = 0; - events.Reset(); - events.ScheduleEvent(EVENT_ACTIVATE_CONSTRUCT, RAID_MODE(40000,30000)); - events.ScheduleEvent(EVENT_SPELL_SCORCH, 10000); - events.ScheduleEvent(EVENT_SPELL_FLAME_JETS, 32000); - events.ScheduleEvent(EVENT_GRAB, 25000); + bShattered = false; + lastShatterMSTime = 0; + events.Reset(); + events.ScheduleEvent(EVENT_ACTIVATE_CONSTRUCT, RAID_MODE(40000,30000)); + events.ScheduleEvent(EVENT_SPELL_SCORCH, 10000); + events.ScheduleEvent(EVENT_SPELL_FLAME_JETS, 32000); + events.ScheduleEvent(EVENT_GRAB, 25000); - me->MonsterYell(TEXT_AGGRO, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_AGGRO); - DoZoneInCombat(); + me->MonsterYell(TEXT_AGGRO, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_AGGRO); + DoZoneInCombat(); - if( InstanceScript* m_pInstance = me->GetInstanceScript() ) - { - m_pInstance->SetData(TYPE_IGNIS, IN_PROGRESS); - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_STOKIN_THE_FURNACE_EVENT); - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_STOKIN_THE_FURNACE_EVENT); - } - } + if( InstanceScript* m_pInstance = me->GetInstanceScript() ) + { + m_pInstance->SetData(TYPE_IGNIS, IN_PROGRESS); + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_STOKIN_THE_FURNACE_EVENT); + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_STOKIN_THE_FURNACE_EVENT); + } + } - void SetData(uint32 id, uint32 value) - { - if (id == 1337) - { - if (lastShatterMSTime) - if (getMSTimeDiff(lastShatterMSTime, World::GetGameTimeMS()) <= 5000) - bShattered = true; + void SetData(uint32 id, uint32 value) + { + if (id == 1337) + { + if (lastShatterMSTime) + if (getMSTimeDiff(lastShatterMSTime, World::GetGameTimeMS()) <= 5000) + bShattered = true; - lastShatterMSTime = World::GetGameTimeMS(); - } - } + lastShatterMSTime = World::GetGameTimeMS(); + } + } - uint32 GetData(uint32 id) const - { - if (id == 1337) - return (bShattered ? 1 : 0); - return 0; - } + uint32 GetData(uint32 id) const + { + if (id == 1337) + return (bShattered ? 1 : 0); + return 0; + } - void JustReachedHome() - { - me->setActive(false); - } + void JustReachedHome() + { + me->setActive(false); + } - void KilledUnit(Unit* victim) - { - if( rand()%2 ) - { - me->MonsterYell(TEXT_SLAY_1, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SLAY_1); - } - else - { - me->MonsterYell(TEXT_SLAY_2, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SLAY_2); - } - } + void KilledUnit(Unit* victim) + { + if( rand()%2 ) + { + me->MonsterYell(TEXT_SLAY_1, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SLAY_1); + } + else + { + me->MonsterYell(TEXT_SLAY_2, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SLAY_2); + } + } - void JustDied(Unit *victim) - { - me->MonsterYell(TEXT_DEATH, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_DEATH); + void JustDied(Unit *victim) + { + me->MonsterYell(TEXT_DEATH, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_DEATH); - if( me->GetInstanceScript() ) - me->GetInstanceScript()->SetData(TYPE_IGNIS, DONE); + if( me->GetInstanceScript() ) + me->GetInstanceScript()->SetData(TYPE_IGNIS, DONE); - std::list icl; - me->GetCreaturesWithEntryInRange(icl, 300.0f, NPC_IRON_CONSTRUCT); - for( std::list::iterator itr = icl.begin(); itr != icl.end(); ++itr ) - if ((*itr)->IsAlive() && (*itr)->IsInCombat()) - Unit::Kill(*itr, *itr); - } + std::list icl; + me->GetCreaturesWithEntryInRange(icl, 300.0f, NPC_IRON_CONSTRUCT); + for( std::list::iterator itr = icl.begin(); itr != icl.end(); ++itr ) + if ((*itr)->IsAlive() && (*itr)->IsInCombat()) + Unit::Kill(*itr, *itr); + } - void SpellHit(Unit* caster, const SpellInfo* spell) - { - if (caster && spell->Id == SPELL_GRAB_CONTROL_2) - { - //caster->ClearUnitState(UNIT_STATE_ONVEHICLE); - me->CastSpell(caster, S_SLAG_POT, true); - } - } + void SpellHit(Unit* caster, const SpellInfo* spell) + { + if (caster && spell->Id == SPELL_GRAB_CONTROL_2) + { + //caster->ClearUnitState(UNIT_STATE_ONVEHICLE); + me->CastSpell(caster, S_SLAG_POT, true); + } + } - void MoveInLineOfSight(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if( me->GetPositionX() < 490.0f || me->GetPositionX() > 690.0f || me->GetPositionY() < 130.0f || me->GetPositionY() > 410.0f ) - { - EnterEvadeMode(); - return; - } + if( me->GetPositionX() < 490.0f || me->GetPositionX() > 690.0f || me->GetPositionY() < 130.0f || me->GetPositionY() > 410.0f ) + { + EnterEvadeMode(); + return; + } - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_ACTIVATE_CONSTRUCT: - me->CastCustomSpell(SPELL_ACTIVATE_CONSTRUCT, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, false); - if (++counter >= 20) - { - me->MonsterYell(TEXT_BERSERK, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BERSERK); - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - break; - } - events.RepeatEvent(RAID_MODE(40000,30000)); - break; - case EVENT_SPELL_SCORCH: - if( rand()%2 ) - { - me->MonsterYell(TEXT_SCORCH_1, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SCORCH_1); - } - else - { - me->MonsterYell(TEXT_SCORCH_2, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SCORCH_2); - } - me->SetControlled(true, UNIT_STATE_ROOT); - me->DisableRotate(true); - me->SendMovementFlagUpdate(); - me->CastSpell(me->GetVictim(), S_SCORCH, false); - events.RepeatEvent(20000); - events.RescheduleEvent(EVENT_ENABLE_ROTATE, 3001); - break; - case EVENT_ENABLE_ROTATE: - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - events.PopEvent(); - break; - case EVENT_SPELL_FLAME_JETS: - me->MonsterTextEmote(TEXT_FLAME_JETS, 0, true); - me->CastSpell(me->GetVictim(), S_FLAME_JETS, false); - events.RepeatEvent(25000); - break; - case EVENT_GRAB: - { - std::list icl; - me->GetCreaturesWithEntryInRange(icl, 300.0f, NPC_IRON_CONSTRUCT); + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_ACTIVATE_CONSTRUCT: + me->CastCustomSpell(SPELL_ACTIVATE_CONSTRUCT, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, false); + if (++counter >= 20) + { + me->MonsterYell(TEXT_BERSERK, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BERSERK); + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + break; + } + events.RepeatEvent(RAID_MODE(40000,30000)); + break; + case EVENT_SPELL_SCORCH: + if( rand()%2 ) + { + me->MonsterYell(TEXT_SCORCH_1, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SCORCH_1); + } + else + { + me->MonsterYell(TEXT_SCORCH_2, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SCORCH_2); + } + me->SetControlled(true, UNIT_STATE_ROOT); + me->DisableRotate(true); + me->SendMovementFlagUpdate(); + me->CastSpell(me->GetVictim(), S_SCORCH, false); + events.RepeatEvent(20000); + events.RescheduleEvent(EVENT_ENABLE_ROTATE, 3001); + break; + case EVENT_ENABLE_ROTATE: + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + events.PopEvent(); + break; + case EVENT_SPELL_FLAME_JETS: + me->MonsterTextEmote(TEXT_FLAME_JETS, 0, true); + me->CastSpell(me->GetVictim(), S_FLAME_JETS, false); + events.RepeatEvent(25000); + break; + case EVENT_GRAB: + { + std::list icl; + me->GetCreaturesWithEntryInRange(icl, 300.0f, NPC_IRON_CONSTRUCT); - std::vector playerGUIDs; - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - Player* temp = NULL; + std::vector playerGUIDs; + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + Player* temp = NULL; - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - { - temp = itr->GetSource(); - if( !temp->IsAlive() || temp->GetExactDist2d(me) > 90.0f ) - continue; - if( me->GetVictim() && temp->GetGUID() == me->GetVictim()->GetGUID() ) - continue; - bool found = false; - for( std::list::iterator itr = icl.begin(); itr != icl.end(); ++itr ) - if( (*itr)->GetVictim() && (*itr)->GetVictim()->GetGUID() == temp->GetGUID() ) - { - found = true; - break; - } + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + { + temp = itr->GetSource(); + if( !temp->IsAlive() || temp->GetExactDist2d(me) > 90.0f ) + continue; + if( me->GetVictim() && temp->GetGUID() == me->GetVictim()->GetGUID() ) + continue; + bool found = false; + for( std::list::iterator itr = icl.begin(); itr != icl.end(); ++itr ) + if( (*itr)->GetVictim() && (*itr)->GetVictim()->GetGUID() == temp->GetGUID() ) + { + found = true; + break; + } - if( !found ) - playerGUIDs.push_back(temp->GetGUID()); - } + if( !found ) + playerGUIDs.push_back(temp->GetGUID()); + } - if( !playerGUIDs.empty() ) - { - int8 pos = urand(0, playerGUIDs.size()-1); - if( Player* pTarget = ObjectAccessor::GetPlayer(*me,playerGUIDs.at(pos)) ) - { - me->MonsterYell(TEXT_SLAG_POT, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SLAG_POT); - me->CastSpell(pTarget, SPELL_GRAB, false); - } - } + if( !playerGUIDs.empty() ) + { + int8 pos = urand(0, playerGUIDs.size()-1); + if( Player* pTarget = ObjectAccessor::GetPlayer(*me,playerGUIDs.at(pos)) ) + { + me->MonsterYell(TEXT_SLAG_POT, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SLAG_POT); + me->CastSpell(pTarget, SPELL_GRAB, false); + } + } - events.RepeatEvent(24000); // +6000 below - events.DelayEvents(6000); - } - break; - } + events.RepeatEvent(24000); // +6000 below + events.DelayEvents(6000); + } + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - ScriptedAI::EnterEvadeMode(); - } - }; + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + ScriptedAI::EnterEvadeMode(); + } + }; }; class spell_ignis_scorch : public SpellScriptLoader { public: - spell_ignis_scorch() : SpellScriptLoader("spell_ignis_scorch") { } + spell_ignis_scorch() : SpellScriptLoader("spell_ignis_scorch") { } - class spell_ignis_scorch_AuraScript : public AuraScript - { - PrepareAuraScript(spell_ignis_scorch_AuraScript) + class spell_ignis_scorch_AuraScript : public AuraScript + { + PrepareAuraScript(spell_ignis_scorch_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (aurEff->GetTickNumber() == aurEff->GetTotalTicks()) - if (Unit* c = GetCaster()) - if (Creature* s = c->SummonCreature(NPC_SCORCHED_GROUND, c->GetPositionX()+20.0f*cos(c->GetOrientation()), c->GetPositionY()+20.0f*sin(c->GetOrientation()), 361.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 30000)) - { - if (!s->FindNearestCreature(NPC_WATER_TRIGGER, 25.0f,true)) // must be away from the water - s->CastSpell(s, (aurEff->GetId() == 62546 ? SPELL_SCORCHED_GROUND_10 : SPELL_SCORCHED_GROUND_25), true); - } - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (aurEff->GetTickNumber() == aurEff->GetTotalTicks()) + if (Unit* c = GetCaster()) + if (Creature* s = c->SummonCreature(NPC_SCORCHED_GROUND, c->GetPositionX()+20.0f*cos(c->GetOrientation()), c->GetPositionY()+20.0f*sin(c->GetOrientation()), 361.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 30000)) + { + if (!s->FindNearestCreature(NPC_WATER_TRIGGER, 25.0f,true)) // must be away from the water + s->CastSpell(s, (aurEff->GetId() == 62546 ? SPELL_SCORCHED_GROUND_10 : SPELL_SCORCHED_GROUND_25), true); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_ignis_scorch_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_ignis_scorch_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_ignis_scorch_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_ignis_scorch_AuraScript(); + } }; class spell_ignis_grab_initial : public SpellScriptLoader { public: - spell_ignis_grab_initial() : SpellScriptLoader("spell_ignis_grab_initial") { } + spell_ignis_grab_initial() : SpellScriptLoader("spell_ignis_grab_initial") { } - class spell_ignis_grab_initial_SpellScript : public SpellScript - { - PrepareSpellScript(spell_ignis_grab_initial_SpellScript); + class spell_ignis_grab_initial_SpellScript : public SpellScript + { + PrepareSpellScript(spell_ignis_grab_initial_SpellScript); - void HandleScript(SpellEffIndex effIndex) - { - if (Unit* t = GetHitUnit()) - t->CastSpell(t, SPELL_GRAB_TRIGGERED, true); - } + void HandleScript(SpellEffIndex effIndex) + { + if (Unit* t = GetHitUnit()) + t->CastSpell(t, SPELL_GRAB_TRIGGERED, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_ignis_grab_initial_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_ignis_grab_initial_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_ignis_grab_initial_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_ignis_grab_initial_SpellScript(); + } }; class spell_ignis_slag_pot : public SpellScriptLoader { public: - spell_ignis_slag_pot() : SpellScriptLoader("spell_ignis_slag_pot") { } + spell_ignis_slag_pot() : SpellScriptLoader("spell_ignis_slag_pot") { } - class spell_ignis_slag_pot_AuraScript : public AuraScript - { - PrepareAuraScript(spell_ignis_slag_pot_AuraScript) + class spell_ignis_slag_pot_AuraScript : public AuraScript + { + PrepareAuraScript(spell_ignis_slag_pot_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (Unit* c = GetCaster()) - if (Unit* t = GetTarget()) - c->CastSpell(t, (GetId() == 62717 ? 65722 : 65723), true); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (Unit* c = GetCaster()) + if (Unit* t = GetTarget()) + c->CastSpell(t, (GetId() == 62717 ? 65722 : 65723), true); + } - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* t = GetTarget()) - { - t->ApplySpellImmune(GetId(), IMMUNITY_ID, 62549, true); - t->ApplySpellImmune(GetId(), IMMUNITY_ID, 63475, true); - } - } + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* t = GetTarget()) + { + t->ApplySpellImmune(GetId(), IMMUNITY_ID, 62549, true); + t->ApplySpellImmune(GetId(), IMMUNITY_ID, 63475, true); + } + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* t = GetTarget()) - { - t->ApplySpellImmune(GetId(), IMMUNITY_ID, 62549, false); - t->ApplySpellImmune(GetId(), IMMUNITY_ID, 63475, false); - if (t->IsAlive()) - t->CastSpell(t, (GetId() == 62717 ? 62836 : 63536), true); - } - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* t = GetTarget()) + { + t->ApplySpellImmune(GetId(), IMMUNITY_ID, 62549, false); + t->ApplySpellImmune(GetId(), IMMUNITY_ID, 63475, false); + if (t->IsAlive()) + t->CastSpell(t, (GetId() == 62717 ? 62836 : 63536), true); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_ignis_slag_pot_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - OnEffectApply += AuraEffectApplyFn(spell_ignis_slag_pot_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_ignis_slag_pot_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_ignis_slag_pot_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectApply += AuraEffectApplyFn(spell_ignis_slag_pot_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_ignis_slag_pot_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_ignis_slag_pot_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_ignis_slag_pot_AuraScript(); + } }; class achievement_ignis_shattered : public AchievementCriteriaScript @@ -553,18 +553,18 @@ class achievement_ignis_shattered : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - if (!target || target->GetTypeId() != TYPEID_UNIT) - return false; - return (target->ToCreature()->AI()->GetData(1337) ? true : false); + if (!target || target->GetTypeId() != TYPEID_UNIT) + return false; + return (target->ToCreature()->AI()->GetData(1337) ? true : false); } }; void AddSC_boss_ignis() { - new boss_ignis(); - new npc_ulduar_iron_construct(); - new spell_ignis_scorch(); - new spell_ignis_grab_initial(); - new spell_ignis_slag_pot(); - new achievement_ignis_shattered(); + new boss_ignis(); + new npc_ulduar_iron_construct(); + new spell_ignis_scorch(); + new spell_ignis_grab_initial(); + new spell_ignis_slag_pot(); + new achievement_ignis_shattered(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index a57df051c..eea4947c8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -13,114 +13,114 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum KologarnSays { - SAY_AGGRO = 0, - SAY_SLAY = 1, - SAY_LEFT_ARM_GONE = 2, - SAY_RIGHT_ARM_GONE = 3, - SAY_SHOCKWAVE = 4, - SAY_GRAB_PLAYER = 5, - SAY_DEATH = 6, - SAY_BERSERK = 7, - EMOTE_STONE_GRIP = 8, - EMOTE_EYES = 9 + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_LEFT_ARM_GONE = 2, + SAY_RIGHT_ARM_GONE = 3, + SAY_SHOCKWAVE = 4, + SAY_GRAB_PLAYER = 5, + SAY_DEATH = 6, + SAY_BERSERK = 7, + EMOTE_STONE_GRIP = 8, + EMOTE_EYES = 9 }; enum KologarnSpells { - SPELL_KOLOGARN_REDUCE_PARRY = 64651, + SPELL_KOLOGARN_REDUCE_PARRY = 64651, - // BASIC - SPELL_OVERHEAD_SMASH_10 = 63356, - SPELL_OVERHEAD_SMASH_25 = 64003, - SPELL_ONEARMED_OVERHEAD_SMASH_10 = 63573, - SPELL_ONEARMED_OVERHEAD_SMASH_25 = 64006, - SPELL_PETRIFYING_BREATH_10 = 62030, - SPELL_PETRIFYING_BREATH_25 = 63980, - SPELL_STONE_SHOUT_10 = 63716, - SPELL_STONE_SHOUT_25 = 64005, + // BASIC + SPELL_OVERHEAD_SMASH_10 = 63356, + SPELL_OVERHEAD_SMASH_25 = 64003, + SPELL_ONEARMED_OVERHEAD_SMASH_10 = 63573, + SPELL_ONEARMED_OVERHEAD_SMASH_25 = 64006, + SPELL_PETRIFYING_BREATH_10 = 62030, + SPELL_PETRIFYING_BREATH_25 = 63980, + SPELL_STONE_SHOUT_10 = 63716, + SPELL_STONE_SHOUT_25 = 64005, - // EYEBEAM - SPELL_FOCUSED_EYEBEAM_10 = 63347, - SPELL_FOCUSED_EYEBEAM_25 = 63977, - SPELL_FOCUSED_EYEBEAM_RIGHT = 63676, // NPC -> KOLOGARN - SPELL_FOCUSED_EYEBEAM_LEFT = 63352, // KOLOGARN -> NPC + // EYEBEAM + SPELL_FOCUSED_EYEBEAM_10 = 63347, + SPELL_FOCUSED_EYEBEAM_25 = 63977, + SPELL_FOCUSED_EYEBEAM_RIGHT = 63676, // NPC -> KOLOGARN + SPELL_FOCUSED_EYEBEAM_LEFT = 63352, // KOLOGARN -> NPC - // ARMS - SPELL_ARM_DEAD_10 = 63629, - SPELL_ARM_DEAD_25 = 63979, - SPELL_RUBBLE_FALL_10 = 63821, - SPELL_RUBBLE_FALL_25 = 64001, - SPELL_ARM_RESPAWN_VISUAL = 64753, + // ARMS + SPELL_ARM_DEAD_10 = 63629, + SPELL_ARM_DEAD_25 = 63979, + SPELL_RUBBLE_FALL_10 = 63821, + SPELL_RUBBLE_FALL_25 = 64001, + SPELL_ARM_RESPAWN_VISUAL = 64753, - // LEFT ARM - SPELL_ARM_SWEEP_10 = 63766, - SPELL_ARM_SWEEP_25 = 63983, + // LEFT ARM + SPELL_ARM_SWEEP_10 = 63766, + SPELL_ARM_SWEEP_25 = 63983, - // RIGHT ARM - SPELL_STONE_GRIP_10 = 62166, - SPELL_STONE_GRIP_25 = 63981, - SPELL_RIDE_RIGHT_ARM_10 = 62056, - SPELL_RIDE_RIGHT_ARM_25 = 63985, + // RIGHT ARM + SPELL_STONE_GRIP_10 = 62166, + SPELL_STONE_GRIP_25 = 63981, + SPELL_RIDE_RIGHT_ARM_10 = 62056, + SPELL_RIDE_RIGHT_ARM_25 = 63985, - // RUBBLE TRASH - SPELL_RUBBLE_ATTACK_10 = 63818, - SPELL_RUBBLE_ATTACK_25 = 63978, + // RUBBLE TRASH + SPELL_RUBBLE_ATTACK_10 = 63818, + SPELL_RUBBLE_ATTACK_25 = 63978, }; -#define SPELL_PETRIFYING_BREATH RAID_MODE(SPELL_PETRIFYING_BREATH_10, SPELL_PETRIFYING_BREATH_25) -#define SPELL_OVERHEAD_SMASH RAID_MODE(SPELL_OVERHEAD_SMASH_10, SPELL_OVERHEAD_SMASH_25) -#define SPELL_ONEARMED_OVERHEAD_SMASH RAID_MODE(SPELL_ONEARMED_OVERHEAD_SMASH_10, SPELL_ONEARMED_OVERHEAD_SMASH_25) -#define SPELL_ARM_DEAD RAID_MODE(SPELL_ARM_DEAD_10, SPELL_ARM_DEAD_25) -#define SPELL_ARM_SWEEP RAID_MODE(SPELL_ARM_SWEEP_10, SPELL_ARM_SWEEP_25) -#define SPELL_STONE_GRIP RAID_MODE(SPELL_STONE_GRIP_10, SPELL_STONE_GRIP_25) -#define SPELL_FOCUSED_EYEBEAM RAID_MODE(SPELL_FOCUSED_EYEBEAM_10, SPELL_FOCUSED_EYEBEAM_25) -#define SPELL_RUBBLE_FALL RAID_MODE(SPELL_RUBBLE_FALL_10, SPELL_RUBBLE_FALL_25) -#define SPELL_RUBBLE_ATTACK RAID_MODE(SPELL_RUBBLE_ATTACK_10, SPELL_RUBBLE_ATTACK_25) -#define SPELL_RIDE_RIGHT_ARM RAID_MODE(SPELL_RIDE_RIGHT_ARM_10, SPELL_RIDE_RIGHT_ARM_25) -#define SPELL_STONE_SHOUT RAID_MODE(SPELL_STONE_SHOUT_10, SPELL_STONE_SHOUT_25) +#define SPELL_PETRIFYING_BREATH RAID_MODE(SPELL_PETRIFYING_BREATH_10, SPELL_PETRIFYING_BREATH_25) +#define SPELL_OVERHEAD_SMASH RAID_MODE(SPELL_OVERHEAD_SMASH_10, SPELL_OVERHEAD_SMASH_25) +#define SPELL_ONEARMED_OVERHEAD_SMASH RAID_MODE(SPELL_ONEARMED_OVERHEAD_SMASH_10, SPELL_ONEARMED_OVERHEAD_SMASH_25) +#define SPELL_ARM_DEAD RAID_MODE(SPELL_ARM_DEAD_10, SPELL_ARM_DEAD_25) +#define SPELL_ARM_SWEEP RAID_MODE(SPELL_ARM_SWEEP_10, SPELL_ARM_SWEEP_25) +#define SPELL_STONE_GRIP RAID_MODE(SPELL_STONE_GRIP_10, SPELL_STONE_GRIP_25) +#define SPELL_FOCUSED_EYEBEAM RAID_MODE(SPELL_FOCUSED_EYEBEAM_10, SPELL_FOCUSED_EYEBEAM_25) +#define SPELL_RUBBLE_FALL RAID_MODE(SPELL_RUBBLE_FALL_10, SPELL_RUBBLE_FALL_25) +#define SPELL_RUBBLE_ATTACK RAID_MODE(SPELL_RUBBLE_ATTACK_10, SPELL_RUBBLE_ATTACK_25) +#define SPELL_RIDE_RIGHT_ARM RAID_MODE(SPELL_RIDE_RIGHT_ARM_10, SPELL_RIDE_RIGHT_ARM_25) +#define SPELL_STONE_SHOUT RAID_MODE(SPELL_STONE_SHOUT_10, SPELL_STONE_SHOUT_25) enum KologarnEvents { - EVENT_SMASH = 1, - EVENT_GRIP = 2, - EVENT_SWEEP = 3, - EVENT_RESTORE_ARM_LEFT = 4, - EVENT_RESTORE_ARM_RIGHT = 5, - EVENT_FOCUSED_EYEBEAM = 6, - EVENT_STONE_SHOUT = 7, + EVENT_SMASH = 1, + EVENT_GRIP = 2, + EVENT_SWEEP = 3, + EVENT_RESTORE_ARM_LEFT = 4, + EVENT_RESTORE_ARM_RIGHT = 5, + EVENT_FOCUSED_EYEBEAM = 6, + EVENT_STONE_SHOUT = 7, }; enum KologarnNPCs { - NPC_LEFT_ARM = 32933, - NPC_RIGHT_ARM = 32934, - NPC_SWEEP_TRIGGER = 33661, - NPC_EYE_LEFT = 33632, - NPC_EYE_RIGHT = 33802, - NPC_RUBBLE_TRIGGER = 33809, - NPC_RUBBLE_SUMMON = 33768, + NPC_LEFT_ARM = 32933, + NPC_RIGHT_ARM = 32934, + NPC_SWEEP_TRIGGER = 33661, + NPC_EYE_LEFT = 33632, + NPC_EYE_RIGHT = 33802, + NPC_RUBBLE_TRIGGER = 33809, + NPC_RUBBLE_SUMMON = 33768, }; enum KologarnSounds { - SOUND_AGGRO = 15586, - SOUND_SLAY1 = 15587, - SOUND_SLAY2 = 15588, - SOUND_LARM_GONE = 15589, - SOUND_RARM_GONE = 15590, - SOUND_SHOCKWAVE = 15591, - SOUND_GRIP = 15592, - SOUND_DEATH = 15593, - SOUND_BERSERK = 15594, + SOUND_AGGRO = 15586, + SOUND_SLAY1 = 15587, + SOUND_SLAY2 = 15588, + SOUND_LARM_GONE = 15589, + SOUND_RARM_GONE = 15590, + SOUND_SHOCKWAVE = 15591, + SOUND_GRIP = 15592, + SOUND_DEATH = 15593, + SOUND_BERSERK = 15594, }; enum Misc { - ACHIEVEMENT_DISARMED_CRITERIA = 21687, + ACHIEVEMENT_DISARMED_CRITERIA = 21687, - DATA_KOLOGARN_LOOKS_ACHIEV = 55, - DATA_KOLOGARN_RUBBLE_ACHIEV = 56, - DATA_KOLOGARN_ARMS_ACHIEV = 57, + DATA_KOLOGARN_LOOKS_ACHIEV = 55, + DATA_KOLOGARN_RUBBLE_ACHIEV = 56, + DATA_KOLOGARN_ARMS_ACHIEV = 57, }; class boss_kologarn : public CreatureScript @@ -133,352 +133,352 @@ public: return new boss_kologarnAI (pCreature); } - struct boss_kologarnAI : public ScriptedAI - { - boss_kologarnAI(Creature* pCreature) : ScriptedAI(pCreature), vehicle(me->GetVehicleKit()), - _left(0), _right(0), summons(me) - { - m_pInstance = me->GetInstanceScript(); - assert(vehicle); - me->SetStandState(UNIT_STAND_STATE_SUBMERGED); - } + struct boss_kologarnAI : public ScriptedAI + { + boss_kologarnAI(Creature* pCreature) : ScriptedAI(pCreature), vehicle(me->GetVehicleKit()), + _left(0), _right(0), summons(me) + { + m_pInstance = me->GetInstanceScript(); + assert(vehicle); + me->SetStandState(UNIT_STAND_STATE_SUBMERGED); + } - InstanceScript* m_pInstance; + InstanceScript* m_pInstance; - Vehicle* vehicle; - uint64 _left, _right; - EventMap events; - SummonList summons; + Vehicle* vehicle; + uint64 _left, _right; + EventMap events; + SummonList summons; - bool _looksAchievement; - uint8 _rubbleAchievement; + bool _looksAchievement; + uint8 _rubbleAchievement; - void MoveInLineOfSight(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2d(who) < 45.0f && me->getStandState() == UNIT_STAND_STATE_SUBMERGED) - { - me->SetStandState(UNIT_STAND_STATE_STAND); - if (Unit* arm = ObjectAccessor::GetCreature(*me, _left)) - arm->CastSpell(arm, SPELL_ARM_RESPAWN_VISUAL, true); - if (Unit* arm = ObjectAccessor::GetCreature(*me, _right)) - arm->CastSpell(arm, SPELL_ARM_RESPAWN_VISUAL, true); - } + void MoveInLineOfSight(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && me->GetExactDist2d(who) < 45.0f && me->getStandState() == UNIT_STAND_STATE_SUBMERGED) + { + me->SetStandState(UNIT_STAND_STATE_STAND); + if (Unit* arm = ObjectAccessor::GetCreature(*me, _left)) + arm->CastSpell(arm, SPELL_ARM_RESPAWN_VISUAL, true); + if (Unit* arm = ObjectAccessor::GetCreature(*me, _right)) + arm->CastSpell(arm, SPELL_ARM_RESPAWN_VISUAL, true); + } - if (me->GetExactDist2d(who) < 30.0f) - ScriptedAI::MoveInLineOfSight(who); - } + if (me->GetExactDist2d(who) < 30.0f) + ScriptedAI::MoveInLineOfSight(who); + } - void EnterEvadeMode() - { - if (!_EnterEvadeMode()) - return; - Reset(); - me->setActive(false); - } + void EnterEvadeMode() + { + if (!_EnterEvadeMode()) + return; + Reset(); + me->setActive(false); + } - void AttachLeftArm() - { - if (Unit* arm = ObjectAccessor::GetCreature(*me, _left)) - arm->SetHealth(arm->GetMaxHealth()); - else if (Creature* accessory = me->SummonCreature(NPC_LEFT_ARM, *me, TEMPSUMMON_MANUAL_DESPAWN)) - { - accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); - if (!me->HandleSpellClick(accessory, 0)) - accessory->DespawnOrUnsummon(); - else - { - _left = accessory->GetGUID(); - accessory->SetOrientation(M_PI); - accessory->CastSpell(accessory, SPELL_ARM_RESPAWN_VISUAL, true); - } - } - } + void AttachLeftArm() + { + if (Unit* arm = ObjectAccessor::GetCreature(*me, _left)) + arm->SetHealth(arm->GetMaxHealth()); + else if (Creature* accessory = me->SummonCreature(NPC_LEFT_ARM, *me, TEMPSUMMON_MANUAL_DESPAWN)) + { + accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); + if (!me->HandleSpellClick(accessory, 0)) + accessory->DespawnOrUnsummon(); + else + { + _left = accessory->GetGUID(); + accessory->SetOrientation(M_PI); + accessory->CastSpell(accessory, SPELL_ARM_RESPAWN_VISUAL, true); + } + } + } - void AttachRightArm() - { - if (Unit* arm = ObjectAccessor::GetCreature(*me, _right)) - arm->SetHealth(arm->GetMaxHealth()); - else if (Creature* accessory = me->SummonCreature(NPC_RIGHT_ARM, *me, TEMPSUMMON_MANUAL_DESPAWN)) - { - accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); - if (!me->HandleSpellClick(accessory, 1)) - accessory->DespawnOrUnsummon(); - else - { - _right = accessory->GetGUID(); - accessory->SetOrientation(M_PI); - accessory->CastSpell(accessory, SPELL_ARM_RESPAWN_VISUAL, true); - } - } - } + void AttachRightArm() + { + if (Unit* arm = ObjectAccessor::GetCreature(*me, _right)) + arm->SetHealth(arm->GetMaxHealth()); + else if (Creature* accessory = me->SummonCreature(NPC_RIGHT_ARM, *me, TEMPSUMMON_MANUAL_DESPAWN)) + { + accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); + if (!me->HandleSpellClick(accessory, 1)) + accessory->DespawnOrUnsummon(); + else + { + _right = accessory->GetGUID(); + accessory->SetOrientation(M_PI); + accessory->CastSpell(accessory, SPELL_ARM_RESPAWN_VISUAL, true); + } + } + } - void Reset() - { - _rubbleAchievement = 0; - _looksAchievement = true; + void Reset() + { + _rubbleAchievement = 0; + _looksAchievement = true; - me->SetDisableGravity(true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->DisableRotate(true); + me->SetDisableGravity(true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->DisableRotate(true); - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); - if (m_pInstance) - m_pInstance->SetData(TYPE_KOLOGARN, NOT_STARTED); + if (m_pInstance) + m_pInstance->SetData(TYPE_KOLOGARN, NOT_STARTED); - AttachLeftArm(); - AttachRightArm(); - } + AttachLeftArm(); + AttachRightArm(); + } - void DoAction(int32 param) - { - if (param == DATA_KOLOGARN_LOOKS_ACHIEV) - _looksAchievement = false; - if (param == DATA_KOLOGARN_RUBBLE_ACHIEV) - { - // Means arm died - if (m_pInstance && (!_left || !_right)) - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_DISARMED_CRITERIA); + void DoAction(int32 param) + { + if (param == DATA_KOLOGARN_LOOKS_ACHIEV) + _looksAchievement = false; + if (param == DATA_KOLOGARN_RUBBLE_ACHIEV) + { + // Means arm died + if (m_pInstance && (!_left || !_right)) + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_DISARMED_CRITERIA); - ++_rubbleAchievement; - } - } + ++_rubbleAchievement; + } + } - uint32 GetData(uint32 param) const - { - if (param == DATA_KOLOGARN_LOOKS_ACHIEV) - return _looksAchievement; - else if (param == DATA_KOLOGARN_RUBBLE_ACHIEV) - return (_rubbleAchievement >= 5); - else if (param == DATA_KOLOGARN_ARMS_ACHIEV) - return !_rubbleAchievement; + uint32 GetData(uint32 param) const + { + if (param == DATA_KOLOGARN_LOOKS_ACHIEV) + return _looksAchievement; + else if (param == DATA_KOLOGARN_RUBBLE_ACHIEV) + return (_rubbleAchievement >= 5); + else if (param == DATA_KOLOGARN_ARMS_ACHIEV) + return !_rubbleAchievement; - return 0; - } + return 0; + } - void AttackStart(Unit* who) - { - me->Attack(who, true); - } + void AttackStart(Unit* who) + { + me->Attack(who, true); + } - void JustSummoned(Creature* cr) - { - if (cr->GetEntry() != NPC_LEFT_ARM && cr->GetEntry() != NPC_RIGHT_ARM) - summons.Summon(cr); - } + void JustSummoned(Creature* cr) + { + if (cr->GetEntry() != NPC_LEFT_ARM && cr->GetEntry() != NPC_RIGHT_ARM) + summons.Summon(cr); + } - void JustDied(Unit*) - { - summons.DespawnAll(); - me->StopMoving(); - if (m_pInstance) - m_pInstance->SetData(TYPE_KOLOGARN, DONE); + void JustDied(Unit*) + { + summons.DespawnAll(); + me->StopMoving(); + if (m_pInstance) + m_pInstance->SetData(TYPE_KOLOGARN, DONE); - Talk(SAY_DEATH); + Talk(SAY_DEATH); - if (GameObject* bridge = me->FindNearestGameObject(GO_KOLOGARN_BRIDGE, 100)) - bridge->SetGoState(GO_STATE_READY); + if (GameObject* bridge = me->FindNearestGameObject(GO_KOLOGARN_BRIDGE, 100)) + bridge->SetGoState(GO_STATE_READY); - // Summon Chest - if (GameObject* go = me->SummonGameObject(RAID_MODE(GO_KOLOGARN_CHEST, GO_KOLOGARN_CHEST_HERO), 1839.62f, -35.98f, 448.81f, 3.6f, 0, 0, 0, 0, 7*86400)) - { - me->RemoveGameObject(go, false); - go->SetSpellId(1); // hack to make it despawn - go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); - } - if (Creature* arm = ObjectAccessor::GetCreature(*me, _left)) - arm->DespawnOrUnsummon(3000); // visual - if (Creature* arm = ObjectAccessor::GetCreature(*me, _right)) - arm->DespawnOrUnsummon(3000); // visual - } + // Summon Chest + if (GameObject* go = me->SummonGameObject(RAID_MODE(GO_KOLOGARN_CHEST, GO_KOLOGARN_CHEST_HERO), 1839.62f, -35.98f, 448.81f, 3.6f, 0, 0, 0, 0, 7*86400)) + { + me->RemoveGameObject(go, false); + go->SetSpellId(1); // hack to make it despawn + go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); + } + if (Creature* arm = ObjectAccessor::GetCreature(*me, _left)) + arm->DespawnOrUnsummon(3000); // visual + if (Creature* arm = ObjectAccessor::GetCreature(*me, _right)) + arm->DespawnOrUnsummon(3000); // visual + } - void KilledUnit(Unit*) - { - if (!urand(0,2)) - return; + void KilledUnit(Unit*) + { + if (!urand(0,2)) + return; - Talk(SAY_SLAY); - } + Talk(SAY_SLAY); + } - void PassengerBoarded(Unit* who, int8 seatId, bool apply) - { - if (!me->IsAlive()) - return; + void PassengerBoarded(Unit* who, int8 seatId, bool apply) + { + if (!me->IsAlive()) + return; - if (!apply) - { - // left arm - if (who->GetGUID() == _left) - { - _left = 0; - if (me->IsInCombat()) - { - Talk(SAY_LEFT_ARM_GONE); - events.ScheduleEvent(EVENT_RESTORE_ARM_LEFT, 50000); - } - } - else - { - _right = 0; - if (me->IsInCombat()) - { - Talk(SAY_RIGHT_ARM_GONE); - events.ScheduleEvent(EVENT_RESTORE_ARM_RIGHT, 50000); - } - } + if (!apply) + { + // left arm + if (who->GetGUID() == _left) + { + _left = 0; + if (me->IsInCombat()) + { + Talk(SAY_LEFT_ARM_GONE); + events.ScheduleEvent(EVENT_RESTORE_ARM_LEFT, 50000); + } + } + else + { + _right = 0; + if (me->IsInCombat()) + { + Talk(SAY_RIGHT_ARM_GONE); + events.ScheduleEvent(EVENT_RESTORE_ARM_RIGHT, 50000); + } + } - me->CastSpell(me, SPELL_ARM_DEAD, true); - if (!_right && !_left) - events.ScheduleEvent(EVENT_STONE_SHOUT, 5000); - } - } + me->CastSpell(me, SPELL_ARM_DEAD, true); + if (!_right && !_left) + events.ScheduleEvent(EVENT_STONE_SHOUT, 5000); + } + } - void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (who && who->GetEntry() == me->GetEntry() && me->GetHealth()) - { - damage = std::min(damage, me->GetHealth()-1); - me->LowerPlayerDamageReq(damage); - } - } + void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (who && who->GetEntry() == me->GetEntry() && me->GetHealth()) + { + damage = std::min(damage, me->GetHealth()-1); + me->LowerPlayerDamageReq(damage); + } + } - void EnterCombat(Unit* who) - { - if (m_pInstance) - m_pInstance->SetData(TYPE_KOLOGARN, IN_PROGRESS); + void EnterCombat(Unit* who) + { + if (m_pInstance) + m_pInstance->SetData(TYPE_KOLOGARN, IN_PROGRESS); - events.RescheduleEvent(EVENT_SMASH, 8000); - events.RescheduleEvent(EVENT_SWEEP, 17000); - events.RescheduleEvent(EVENT_GRIP, 15000); - events.RescheduleEvent(EVENT_FOCUSED_EYEBEAM, 25000); - //events.ScheduleEvent(EVENT_ENRAGE, x); no info - - Talk(SAY_AGGRO); - me->setActive(true); - } + events.RescheduleEvent(EVENT_SMASH, 8000); + events.RescheduleEvent(EVENT_SWEEP, 17000); + events.RescheduleEvent(EVENT_GRIP, 15000); + events.RescheduleEvent(EVENT_FOCUSED_EYEBEAM, 25000); + //events.ScheduleEvent(EVENT_ENRAGE, x); no info + + Talk(SAY_AGGRO); + me->setActive(true); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - { - EnterEvadeMode(); - return; - } + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + { + EnterEvadeMode(); + return; + } - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_STONE_SHOUT: - if (_left || _right) - { - events.PopEvent(); - return; - } + switch (events.GetEvent()) + { + case EVENT_STONE_SHOUT: + if (_left || _right) + { + events.PopEvent(); + return; + } me->CastSpell(me->GetVictim(), SPELL_STONE_SHOUT, false); events.RepeatEvent(2000); break; - case EVENT_SMASH: - if (_left && _right) - me->CastSpell(me->GetVictim(), SPELL_OVERHEAD_SMASH, false); - else if (_left || _right) - me->CastSpell(me->GetVictim(), SPELL_ONEARMED_OVERHEAD_SMASH, false); - - events.DelayEvents(1000); - events.RepeatEvent(14000); - return; - case EVENT_SWEEP: - if (_left) - { - if (Creature* cr = me->FindNearestCreature(NPC_SWEEP_TRIGGER, 300)) - cr->CastSpell(cr, SPELL_ARM_SWEEP, false); + case EVENT_SMASH: + if (_left && _right) + me->CastSpell(me->GetVictim(), SPELL_OVERHEAD_SMASH, false); + else if (_left || _right) + me->CastSpell(me->GetVictim(), SPELL_ONEARMED_OVERHEAD_SMASH, false); + + events.DelayEvents(1000); + events.RepeatEvent(14000); + return; + case EVENT_SWEEP: + if (_left) + { + if (Creature* cr = me->FindNearestCreature(NPC_SWEEP_TRIGGER, 300)) + cr->CastSpell(cr, SPELL_ARM_SWEEP, false); - if (urand(0,1)) - Talk(SAY_SHOCKWAVE); - } + if (urand(0,1)) + Talk(SAY_SHOCKWAVE); + } - events.DelayEvents(1000); - events.RepeatEvent(17000); - return; - case EVENT_GRIP: - events.RepeatEvent(25000); - if (!_right) - break; + events.DelayEvents(1000); + events.RepeatEvent(17000); + return; + case EVENT_GRIP: + events.RepeatEvent(25000); + if (!_right) + break; - me->CastSpell(me, SPELL_STONE_GRIP, false); - Talk(SAY_GRAB_PLAYER); - Talk(EMOTE_STONE_GRIP); - return; - case EVENT_FOCUSED_EYEBEAM: - { - events.RepeatEvent(13000+rand()%5000); - Unit* target = NULL; - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - if (itr->GetSource()->GetPositionZ() < 420) - continue; + me->CastSpell(me, SPELL_STONE_GRIP, false); + Talk(SAY_GRAB_PLAYER); + Talk(EMOTE_STONE_GRIP); + return; + case EVENT_FOCUSED_EYEBEAM: + { + events.RepeatEvent(13000+rand()%5000); + Unit* target = NULL; + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + if (itr->GetSource()->GetPositionZ() < 420) + continue; - target = itr->GetSource(); - if (urand(0,3) == 3) - break; - } - if (!target) - break; + target = itr->GetSource(); + if (urand(0,3) == 3) + break; + } + if (!target) + break; - if (Creature* eye = me->SummonCreature(NPC_EYE_LEFT, target->GetPositionX(), target->GetPositionY()-6, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 12000)) - { - eye->GetMotionMaster()->MoveFollow(target, 0.01f, M_PI*3/2, MOTION_SLOT_CONTROLLED); - me->CastSpell(eye, SPELL_FOCUSED_EYEBEAM_LEFT, true); - } - if (Creature* eye2 = me->SummonCreature(NPC_EYE_RIGHT, target->GetPositionX(), target->GetPositionY()+6, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 12000)) - { - eye2->GetMotionMaster()->MoveFollow(target, 0.01f, M_PI/2, MOTION_SLOT_CONTROLLED); - eye2->CastSpell(me, SPELL_FOCUSED_EYEBEAM_RIGHT, true); - } + if (Creature* eye = me->SummonCreature(NPC_EYE_LEFT, target->GetPositionX(), target->GetPositionY()-6, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 12000)) + { + eye->GetMotionMaster()->MoveFollow(target, 0.01f, M_PI*3/2, MOTION_SLOT_CONTROLLED); + me->CastSpell(eye, SPELL_FOCUSED_EYEBEAM_LEFT, true); + } + if (Creature* eye2 = me->SummonCreature(NPC_EYE_RIGHT, target->GetPositionX(), target->GetPositionY()+6, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 12000)) + { + eye2->GetMotionMaster()->MoveFollow(target, 0.01f, M_PI/2, MOTION_SLOT_CONTROLLED); + eye2->CastSpell(me, SPELL_FOCUSED_EYEBEAM_RIGHT, true); + } - Talk(EMOTE_EYES); - events.DelayEvents(12000, 0); - return; - } - case EVENT_RESTORE_ARM_LEFT: - // shouldn't happen - events.PopEvent(); - AttachLeftArm(); - return; - case EVENT_RESTORE_ARM_RIGHT: - // shouldn't happen - events.PopEvent(); - AttachRightArm(); - return; - } + Talk(EMOTE_EYES); + events.DelayEvents(12000, 0); + return; + } + case EVENT_RESTORE_ARM_LEFT: + // shouldn't happen + events.PopEvent(); + AttachLeftArm(); + return; + case EVENT_RESTORE_ARM_RIGHT: + // shouldn't happen + events.PopEvent(); + AttachRightArm(); + return; + } - //Make sure our attack is ready and we aren't currently casting before checking distance - if (me->isAttackReady() && me->GetVictim()) // victim could die by a spell (IMPORTANT!!!) and kologarn entered evade mode - { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->GetVictim())) - { - me->AttackerStateUpdate(me->GetVictim()); - me->resetAttackTimer(); - return; - } - else if (Unit* tgt = me->SelectNearbyTarget()) - { - me->AttackerStateUpdate(tgt); - me->resetAttackTimer(); - return; - } + //Make sure our attack is ready and we aren't currently casting before checking distance + if (me->isAttackReady() && me->GetVictim()) // victim could die by a spell (IMPORTANT!!!) and kologarn entered evade mode + { + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->GetVictim())) + { + me->AttackerStateUpdate(me->GetVictim()); + me->resetAttackTimer(); + return; + } + else if (Unit* tgt = me->SelectNearbyTarget()) + { + me->AttackerStateUpdate(tgt); + me->resetAttackTimer(); + return; + } - me->CastSpell(me->GetVictim(), SPELL_PETRIFYING_BREATH, false); - me->resetAttackTimer(); - } - } - }; + me->CastSpell(me->GetVictim(), SPELL_PETRIFYING_BREATH, false); + me->resetAttackTimer(); + } + } + }; }; // also used for left arm, all functions except JustDied wont be used by left arm @@ -492,90 +492,90 @@ public: return new boss_kologarn_armsAI (pCreature); } - struct boss_kologarn_armsAI : public ScriptedAI - { - boss_kologarn_armsAI(Creature* c) : ScriptedAI(c) { } + struct boss_kologarn_armsAI : public ScriptedAI + { + boss_kologarn_armsAI(Creature* c) : ScriptedAI(c) { } - int32 _damageDone; - bool _combatStarted; + int32 _damageDone; + bool _combatStarted; - void EnterEvadeMode() {} - void MoveInLineOfSight(Unit*) {} - void AttackStart(Unit*) {} - void UpdateAI(uint32 diff) {} + void EnterEvadeMode() {} + void MoveInLineOfSight(Unit*) {} + void AttackStart(Unit*) {} + void UpdateAI(uint32 diff) {} - void Reset() - { - _combatStarted = false; - _damageDone = 0; - } + void Reset() + { + _combatStarted = false; + _damageDone = 0; + } - void PassengerBoarded(Unit* who, int8 seatId, bool apply) - { - if (!apply) - _damageDone = 0; - else - { - //who->ClearUnitState(UNIT_STATE_ONVEHICLE); - if (!_damageDone) - _damageDone = RAID_MODE(80000, 380000); - } - } + void PassengerBoarded(Unit* who, int8 seatId, bool apply) + { + if (!apply) + _damageDone = 0; + else + { + //who->ClearUnitState(UNIT_STATE_ONVEHICLE); + if (!_damageDone) + _damageDone = RAID_MODE(80000, 380000); + } + } - void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (!_combatStarted) - if (InstanceScript* instance = me->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*me, instance->GetData64(TYPE_KOLOGARN))) - { - _combatStarted = true; - if (!cr->IsInCombat() && who) - cr->AI()->AttackStart(who); - } + void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (!_combatStarted) + if (InstanceScript* instance = me->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*me, instance->GetData64(TYPE_KOLOGARN))) + { + _combatStarted = true; + if (!cr->IsInCombat() && who) + cr->AI()->AttackStart(who); + } - if (_damageDone > 0) - { - _damageDone -= damage; - if (_damageDone <= 0 || damage >= me->GetHealth()) - me->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE); - } - } + if (_damageDone > 0) + { + _damageDone -= damage; + if (_damageDone <= 0 || damage >= me->GetHealth()) + me->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE); + } + } - void JustDied(Unit*) - { - float x, y, z; - // left arm - if( me->GetEntry() == NPC_LEFT_ARM ) - { - x = 1776.97f; y = -44.8396f; z = 448.888f; - } - else - { - x = 1777.82f; y = -3.50803f; z = 448.888f; - } + void JustDied(Unit*) + { + float x, y, z; + // left arm + if( me->GetEntry() == NPC_LEFT_ARM ) + { + x = 1776.97f; y = -44.8396f; z = 448.888f; + } + else + { + x = 1777.82f; y = -3.50803f; z = 448.888f; + } - if (Creature *cr = me->SummonTrigger(x, y, z, 0, 5000)) - { - cr->CastSpell(cr, SPELL_RUBBLE_FALL, true); + if (Creature *cr = me->SummonTrigger(x, y, z, 0, 5000)) + { + cr->CastSpell(cr, SPELL_RUBBLE_FALL, true); - if (me->GetInstanceScript()) - if (Creature* kologarn = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_KOLOGARN))) - for (uint8 i = 0; i < 5; ++i) - if (Creature* cr2 = kologarn->SummonCreature(NPC_RUBBLE_SUMMON, cr->GetPositionX()+irand(-5,5), cr->GetPositionY()+irand(-5,5), cr->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) - { - cr2->SetInCombatWithZone(); - if (Unit *target = SelectTargetFromPlayerList(100)) - cr2->AI()->AttackStart(target); - } - } + if (me->GetInstanceScript()) + if (Creature* kologarn = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_KOLOGARN))) + for (uint8 i = 0; i < 5; ++i) + if (Creature* cr2 = kologarn->SummonCreature(NPC_RUBBLE_SUMMON, cr->GetPositionX()+irand(-5,5), cr->GetPositionY()+irand(-5,5), cr->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) + { + cr2->SetInCombatWithZone(); + if (Unit *target = SelectTargetFromPlayerList(100)) + cr2->AI()->AttackStart(target); + } + } - if (me->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_KOLOGARN))) - cr->AI()->DoAction(DATA_KOLOGARN_RUBBLE_ACHIEV); - - me->ExitVehicle(); - } - }; + if (me->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_KOLOGARN))) + cr->AI()->DoAction(DATA_KOLOGARN_RUBBLE_ACHIEV); + + me->ExitVehicle(); + } + }; }; class boss_kologarn_eyebeam : public CreatureScript @@ -588,36 +588,36 @@ public: return new boss_kologarn_eyebeamAI (pCreature); } - struct boss_kologarn_eyebeamAI : public NullCreatureAI - { - boss_kologarn_eyebeamAI(Creature *c) : NullCreatureAI(c), _timer(1), _damaged(false) {} + struct boss_kologarn_eyebeamAI : public NullCreatureAI + { + boss_kologarn_eyebeamAI(Creature *c) : NullCreatureAI(c), _timer(1), _damaged(false) {} - uint32 _timer; - bool _damaged; + uint32 _timer; + bool _damaged; - void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) - { - if (damage > 0 && !_damaged && me->GetInstanceScript()) - { - _damaged = true; - if (Creature* cr = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_KOLOGARN))) - cr->AI()->DoAction(DATA_KOLOGARN_LOOKS_ACHIEV); - } - } + void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) + { + if (damage > 0 && !_damaged && me->GetInstanceScript()) + { + _damaged = true; + if (Creature* cr = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_KOLOGARN))) + cr->AI()->DoAction(DATA_KOLOGARN_LOOKS_ACHIEV); + } + } - void UpdateAI(uint32 diff) - { - if (_timer) - { - _timer += diff; - if (_timer >= 2000) - { - me->CastSpell(me, (me->GetMap()->Is25ManRaid() ? SPELL_FOCUSED_EYEBEAM_25 : SPELL_FOCUSED_EYEBEAM_10), true); - _timer = 0; - } - } - } - }; + void UpdateAI(uint32 diff) + { + if (_timer) + { + _timer += diff; + if (_timer >= 2000) + { + me->CastSpell(me, (me->GetMap()->Is25ManRaid() ? SPELL_FOCUSED_EYEBEAM_25 : SPELL_FOCUSED_EYEBEAM_10), true); + _timer = 0; + } + } + } + }; }; @@ -729,7 +729,7 @@ class spell_ulduar_squeezed_lifeless : public SpellScriptLoader if (!GetHitPlayer() || !GetHitPlayer()->GetVehicle()) return; - // Hack to set correct position is in _ExitVehicle() + // Hack to set correct position is in _ExitVehicle() GetHitPlayer()->ExitVehicle(); } @@ -757,14 +757,14 @@ class spell_kologarn_stone_shout : public SpellScriptLoader void OnPeriodic(AuraEffect const* /*aurEff*/) { uint32 triggerSpellId = GetSpellInfo()->Effects[EFFECT_0].TriggerSpell; - if (Unit* caster = GetCaster()) - caster->CastSpell(caster, triggerSpellId, false); + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, triggerSpellId, false); } void Register() { - if (m_scriptSpellId == SPELL_STONE_SHOUT_10 || m_scriptSpellId == SPELL_STONE_SHOUT_25) - OnEffectPeriodic += AuraEffectPeriodicFn(spell_kologarn_stone_shout_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + if (m_scriptSpellId == SPELL_STONE_SHOUT_10 || m_scriptSpellId == SPELL_STONE_SHOUT_25) + OnEffectPeriodic += AuraEffectPeriodicFn(spell_kologarn_stone_shout_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -773,7 +773,7 @@ class spell_kologarn_stone_shout : public SpellScriptLoader return new spell_kologarn_stone_shout_AuraScript(); } - class spell_kologarn_stone_shout_SpellScript : public SpellScript + class spell_kologarn_stone_shout_SpellScript : public SpellScript { PrepareSpellScript(spell_kologarn_stone_shout_SpellScript); @@ -784,8 +784,8 @@ class spell_kologarn_stone_shout : public SpellScriptLoader void Register() { - if (m_scriptSpellId != SPELL_STONE_SHOUT_10 && m_scriptSpellId != SPELL_STONE_SHOUT_25) - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kologarn_stone_shout_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + if (m_scriptSpellId != SPELL_STONE_SHOUT_10 && m_scriptSpellId != SPELL_STONE_SHOUT_25) + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kologarn_stone_shout_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; @@ -802,12 +802,12 @@ class achievement_kologarn_looks_could_kill : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - if (target) - if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_KOLOGARN))) - return cr->AI()->GetData(DATA_KOLOGARN_LOOKS_ACHIEV); - - return false; + if (target) + if (InstanceScript* instance = target->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_KOLOGARN))) + return cr->AI()->GetData(DATA_KOLOGARN_LOOKS_ACHIEV); + + return false; } }; @@ -818,12 +818,12 @@ class achievement_kologarn_rubble_and_roll : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - if (target) - if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_KOLOGARN))) - return cr->AI()->GetData(DATA_KOLOGARN_RUBBLE_ACHIEV); - - return false; + if (target) + if (InstanceScript* instance = target->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_KOLOGARN))) + return cr->AI()->GetData(DATA_KOLOGARN_RUBBLE_ACHIEV); + + return false; } }; @@ -834,30 +834,30 @@ class achievement_kologarn_with_open_arms : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - if (target) - if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_KOLOGARN))) - return cr->AI()->GetData(DATA_KOLOGARN_ARMS_ACHIEV); - - return false; + if (target) + if (InstanceScript* instance = target->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_KOLOGARN))) + return cr->AI()->GetData(DATA_KOLOGARN_ARMS_ACHIEV); + + return false; } }; void AddSC_boss_kologarn() { - // Npcs - new boss_kologarn(); - new boss_kologarn_arms(); - new boss_kologarn_eyebeam(); + // Npcs + new boss_kologarn(); + new boss_kologarn_arms(); + new boss_kologarn_eyebeam(); - // Spells - new spell_ulduar_stone_grip_cast_target(); - new spell_ulduar_stone_grip(); - new spell_ulduar_squeezed_lifeless(); - new spell_kologarn_stone_shout(); + // Spells + new spell_ulduar_stone_grip_cast_target(); + new spell_ulduar_stone_grip(); + new spell_ulduar_squeezed_lifeless(); + new spell_kologarn_stone_shout(); - // Achievements - new achievement_kologarn_looks_could_kill(); - new achievement_kologarn_rubble_and_roll(); - new achievement_kologarn_with_open_arms(); + // Achievements + new achievement_kologarn_looks_could_kill(); + new achievement_kologarn_rubble_and_roll(); + new achievement_kologarn_with_open_arms(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index 9edc23443..f9e7868f8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -15,251 +15,251 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum SpellData { - SPELL_BERSERK = 64238, + SPELL_BERSERK = 64238, - // PHASE 1: - SPELL_NAPALM_SHELL_25 = 65026, - SPELL_NAPALM_SHELL_10 = 63666, + // PHASE 1: + SPELL_NAPALM_SHELL_25 = 65026, + SPELL_NAPALM_SHELL_10 = 63666, - SPELL_PLASMA_BLAST_25 = 64529, - SPELL_PLASMA_BLAST_10 = 62997, + SPELL_PLASMA_BLAST_25 = 64529, + SPELL_PLASMA_BLAST_10 = 62997, - SPELL_SHOCK_BLAST = 63631, + SPELL_SHOCK_BLAST = 63631, - SPELL_PROXIMITY_MINES = 63027, - NPC_PROXIMITY_MINE = 34362, - SPELL_MINE_EXPLOSION_25 = 63009, - SPELL_MINE_EXPLOSION_10 = 66351, + SPELL_PROXIMITY_MINES = 63027, + NPC_PROXIMITY_MINE = 34362, + SPELL_MINE_EXPLOSION_25 = 63009, + SPELL_MINE_EXPLOSION_10 = 66351, - // PHASE 2: - SPELL_HEAT_WAVE = 64533, + // PHASE 2: + SPELL_HEAT_WAVE = 64533, - SPELL_ROCKET_STRIKE_AURA = 64064, - NPC_ROCKET_VISUAL = 34050, - NPC_ROCKET_STRIKE_N = 34047, + SPELL_ROCKET_STRIKE_AURA = 64064, + NPC_ROCKET_VISUAL = 34050, + NPC_ROCKET_STRIKE_N = 34047, - SPELL_RAPID_BURST = 63382, - SPELL_RAPID_BURST_DAMAGE_25_1 = 64531, - SPELL_RAPID_BURST_DAMAGE_25_2 = 64532, - SPELL_RAPID_BURST_DAMAGE_10_1 = 63387, - SPELL_RAPID_BURST_DAMAGE_10_2 = 64019, - SPELL_SUMMON_BURST_TARGET = 64840, + SPELL_RAPID_BURST = 63382, + SPELL_RAPID_BURST_DAMAGE_25_1 = 64531, + SPELL_RAPID_BURST_DAMAGE_25_2 = 64532, + SPELL_RAPID_BURST_DAMAGE_10_1 = 63387, + SPELL_RAPID_BURST_DAMAGE_10_2 = 64019, + SPELL_SUMMON_BURST_TARGET = 64840, - SPELL_SPINNING_UP = 63414, + SPELL_SPINNING_UP = 63414, - // PHASE 3: - SPELL_PLASMA_BALL_25 = 64535, - SPELL_PLASMA_BALL_10 = 63689, + // PHASE 3: + SPELL_PLASMA_BALL_25 = 64535, + SPELL_PLASMA_BALL_10 = 63689, - SPELL_MAGNETIC_CORE = 64436, - SPELL_SPINNING = 64438, + SPELL_MAGNETIC_CORE = 64436, + SPELL_SPINNING = 64438, - SPELL_SUMMON_BOMB_BOT = 63811, - SPELL_BB_EXPLODE = 63801, + SPELL_SUMMON_BOMB_BOT = 63811, + SPELL_BB_EXPLODE = 63801, - SPELL_BEAM_GREEN = 63295, - SPELL_BEAM_YELLOW = 63292, - SPELL_BEAM_BLUE = 63294, + SPELL_BEAM_GREEN = 63295, + SPELL_BEAM_YELLOW = 63292, + SPELL_BEAM_BLUE = 63294, - // PHASE 4: - SPELL_HAND_PULSE_10_R = 64352, - SPELL_HAND_PULSE_25_R = 64537, - SPELL_HAND_PULSE_10_L = 64348, - SPELL_HAND_PULSE_25_L = 64536, + // PHASE 4: + SPELL_HAND_PULSE_10_R = 64352, + SPELL_HAND_PULSE_25_R = 64537, + SPELL_HAND_PULSE_10_L = 64348, + SPELL_HAND_PULSE_25_L = 64536, - SPELL_SELF_REPAIR = 64383, - SPELL_SLEEP = 64394, + SPELL_SELF_REPAIR = 64383, + SPELL_SLEEP = 64394, }; enum NPCs { - //NPC_MIMIRON = 33350, - NPC_LEVIATHAN_MKII = 33432, - NPC_LEVIATHAN_MKII_CANNON = 34071, - NPC_VX001 = 33651, - NPC_AERIAL_COMMAND_UNIT = 33670, - NPC_COMPUTER = 34143, - NPC_BOMB_BOT = 33836, - NPC_BOT_SUMMON_TRIGGER = 33856, - NPC_ASSAULT_BOT = 34057, - NPC_JUNK_BOT = 33855, - NPC_MAGNETIC_CORE = 34068, + //NPC_MIMIRON = 33350, + NPC_LEVIATHAN_MKII = 33432, + NPC_LEVIATHAN_MKII_CANNON = 34071, + NPC_VX001 = 33651, + NPC_AERIAL_COMMAND_UNIT = 33670, + NPC_COMPUTER = 34143, + NPC_BOMB_BOT = 33836, + NPC_BOT_SUMMON_TRIGGER = 33856, + NPC_ASSAULT_BOT = 34057, + NPC_JUNK_BOT = 33855, + NPC_MAGNETIC_CORE = 34068, }; enum GOs { - //GO_MIMIRON_ELEVATOR = 194749, - GO_DOOR_1 = 194776, - GO_DOOR_2 = 194774, - GO_DOOR_3 = 194775, - GO_BUTTON = 194739, - // pads: 194740-48 + //GO_MIMIRON_ELEVATOR = 194749, + GO_DOOR_1 = 194776, + GO_DOOR_2 = 194774, + GO_DOOR_3 = 194775, + GO_BUTTON = 194739, + // pads: 194740-48 }; enum HardMode { - SPELL_EMERGENCY_MODE = 64582, - SPELL_SELF_DESTRUCT = 64610, + SPELL_EMERGENCY_MODE = 64582, + SPELL_SELF_DESTRUCT = 64610, - SPELL_SUMMON_FLAMES_INITIAL = 64563, - NPC_FLAMES_INITIAL = 34363, - SPELL_SUMMON_FLAMES_SPREAD = 64564, - NPC_FLAMES_SPREAD = 34121, - SPELL_FLAMES_AURA = 64561, + SPELL_SUMMON_FLAMES_INITIAL = 64563, + NPC_FLAMES_INITIAL = 34363, + SPELL_SUMMON_FLAMES_SPREAD = 64564, + NPC_FLAMES_SPREAD = 34121, + SPELL_FLAMES_AURA = 64561, - SPELL_VX001_FROST_BOMB = 64623, - SPELL_FROST_BOMB_VISUAL_AURA = 64624, - SPELL_SUMMON_FROST_BOMB = 64627, - NPC_FROST_BOMB = 34149, - SPELL_FROST_BOMB_EXPLOSION_10 = 64626, - SPELL_FROST_BOMB_EXPLOSION_25 = 65333, + SPELL_VX001_FROST_BOMB = 64623, + SPELL_FROST_BOMB_VISUAL_AURA = 64624, + SPELL_SUMMON_FROST_BOMB = 64627, + NPC_FROST_BOMB = 34149, + SPELL_FROST_BOMB_EXPLOSION_10 = 64626, + SPELL_FROST_BOMB_EXPLOSION_25 = 65333, - SPELL_FLAME_SUPPRESSANT_10yd = 65192, - SPELL_FLAME_SUPPRESSANT_50000yd = 64570, + SPELL_FLAME_SUPPRESSANT_10yd = 65192, + SPELL_FLAME_SUPPRESSANT_50000yd = 64570, - SPELL_WATER_SPRAY = 64619, - SPELL_DEAFENING_SIREN = 64616, - NPC_EMERGENCY_FIRE_BOT = 34147, + SPELL_WATER_SPRAY = 64619, + SPELL_DEAFENING_SIREN = 64616, + NPC_EMERGENCY_FIRE_BOT = 34147, - SPELL_ENTER_VEHICLE_0 = 63112, - SPELL_ENTER_VEHICLE_1 = 63313, - SPELL_ENTER_VEHICLE_2 = 63314, - SPELL_ENTER_VEHICLE_4 = 63316, + SPELL_ENTER_VEHICLE_0 = 63112, + SPELL_ENTER_VEHICLE_1 = 63313, + SPELL_ENTER_VEHICLE_2 = 63314, + SPELL_ENTER_VEHICLE_4 = 63316, }; enum EVENTS { - // Mimiron: - EVENT_SIT_LMK2 = 1, - EVENT_SIT_LMK2_INTERVAL = 2, - EVENT_LMK2_RETREAT_INTERVAL = 7, - EVENT_ELEVATOR_INTERVAL_1 = 8, - EVENT_ELEVATOR_INTERVAL_2 = 9, - EVENT_SITTING_ON_VX001 = 10, - EVENT_ENTER_VX001 = 11, - EVENT_EMOTE_VX001 = 12, - EVENT_VX001_START_FIGHT = 13, - EVENT_ELEVATOR_INTERVAL_0 = 14, - EVENT_GET_OUT_VX001 = 21, - EVENT_SAY_VX001_DEAD = 22, - EVENT_ENTER_ACU = 23, - EVENT_SAY_ACU_ACTIVATE = 24, - EVENT_ACU_START_ATTACK = 25, - EVENT_VX001_EMOTESTATE_DEATH = 26, - EVENT_SAY_ACU_DEAD = 31, - EVENT_LEVIATHAN_COME_CLOSER = 32, - EVENT_VX001_EMOTE_JUMP = 33, - EVENT_LEVIATHAN_RIDE_MIDDLE = 34, - EVENT_JOIN_TOGETHER = 342, - EVENT_JOIN_ACU = 35, - EVENT_START_PHASE4 = 36, - EVENT_FINISH = 50, - EVENT_SAY_VOLTRON_DEAD = 51, - EVENT_DISAPPEAR = 52, - EVENT_BERSERK = 53, - EVENT_BERSERK_2 = 54, + // Mimiron: + EVENT_SIT_LMK2 = 1, + EVENT_SIT_LMK2_INTERVAL = 2, + EVENT_LMK2_RETREAT_INTERVAL = 7, + EVENT_ELEVATOR_INTERVAL_1 = 8, + EVENT_ELEVATOR_INTERVAL_2 = 9, + EVENT_SITTING_ON_VX001 = 10, + EVENT_ENTER_VX001 = 11, + EVENT_EMOTE_VX001 = 12, + EVENT_VX001_START_FIGHT = 13, + EVENT_ELEVATOR_INTERVAL_0 = 14, + EVENT_GET_OUT_VX001 = 21, + EVENT_SAY_VX001_DEAD = 22, + EVENT_ENTER_ACU = 23, + EVENT_SAY_ACU_ACTIVATE = 24, + EVENT_ACU_START_ATTACK = 25, + EVENT_VX001_EMOTESTATE_DEATH = 26, + EVENT_SAY_ACU_DEAD = 31, + EVENT_LEVIATHAN_COME_CLOSER = 32, + EVENT_VX001_EMOTE_JUMP = 33, + EVENT_LEVIATHAN_RIDE_MIDDLE = 34, + EVENT_JOIN_TOGETHER = 342, + EVENT_JOIN_ACU = 35, + EVENT_START_PHASE4 = 36, + EVENT_FINISH = 50, + EVENT_SAY_VOLTRON_DEAD = 51, + EVENT_DISAPPEAR = 52, + EVENT_BERSERK = 53, + EVENT_BERSERK_2 = 54, - // Leviathan: - EVENT_SPELL_NAPALM_SHELL = 3, - EVENT_SPELL_PLASMA_BLAST = 4, - EVENT_SPELL_SHOCK_BLAST = 5, - EVENT_PROXIMITY_MINES_1 = 6, + // Leviathan: + EVENT_SPELL_NAPALM_SHELL = 3, + EVENT_SPELL_PLASMA_BLAST = 4, + EVENT_SPELL_SHOCK_BLAST = 5, + EVENT_PROXIMITY_MINES_1 = 6, - // VX001: - EVENT_SPELL_HEAT_WAVE = 15, - EVENT_SPELL_ROCKET_STRIKE = 16, - EVENT_REINSTALL_ROCKETS = 17, - EVENT_SPELL_RAPID_BURST = 18, - EVENT_SPELL_RAPID_BURST_INTERVAL = 19, - EVENT_SPELL_SPINNING_UP = 20, - EVENT_HAND_PULSE = 37, + // VX001: + EVENT_SPELL_HEAT_WAVE = 15, + EVENT_SPELL_ROCKET_STRIKE = 16, + EVENT_REINSTALL_ROCKETS = 17, + EVENT_SPELL_RAPID_BURST = 18, + EVENT_SPELL_RAPID_BURST_INTERVAL = 19, + EVENT_SPELL_SPINNING_UP = 20, + EVENT_HAND_PULSE = 37, - // ACU: - EVENT_SPELL_PLASMA_BALL = 27, - EVENT_SUMMON_BOMB_BOT = 28, - EVENT_BOMB_BOT_CHASE = 29, - EVENT_BOMB_BOT_RELOCATE = 30, - EVENT_SUMMON_ASSAULT_BOT = 40, - EVENT_SUMMON_JUNK_BOT = 41, - EVENT_MAGNETIC_CORE_PULL_DOWN = 42, - EVENT_MAGNETIC_CORE_FREE = 43, - EVENT_MAGNETIC_CORE_REMOVE_IMMOBILIZE = 44, + // ACU: + EVENT_SPELL_PLASMA_BALL = 27, + EVENT_SUMMON_BOMB_BOT = 28, + EVENT_BOMB_BOT_CHASE = 29, + EVENT_BOMB_BOT_RELOCATE = 30, + EVENT_SUMMON_ASSAULT_BOT = 40, + EVENT_SUMMON_JUNK_BOT = 41, + EVENT_MAGNETIC_CORE_PULL_DOWN = 42, + EVENT_MAGNETIC_CORE_FREE = 43, + EVENT_MAGNETIC_CORE_REMOVE_IMMOBILIZE = 44, - // Hard mode: - EVENT_COMPUTER_SAY_INITIATED = 60, - EVENT_COMPUTER_SAY_MINUTES = 61, - EVENT_MIMIRON_SAY_HARDMODE = 62, - EVENT_SPAWN_FLAMES_INITIAL = 63, - EVENT_FLAMES_SPREAD = 64, - EVENT_FLAME_SUPPRESSION_50000 = 65, - EVENT_FLAME_SUPPRESSION_10 = 66, - EVENT_FROST_BOMB = 67, - EVENT_SUMMON_EMERGENCY_FIRE_BOTS = 68, - EVENT_EMERGENCY_BOT_CHECK = 69, - EVENT_EMERGENCY_BOT_ATTACK = 70, + // Hard mode: + EVENT_COMPUTER_SAY_INITIATED = 60, + EVENT_COMPUTER_SAY_MINUTES = 61, + EVENT_MIMIRON_SAY_HARDMODE = 62, + EVENT_SPAWN_FLAMES_INITIAL = 63, + EVENT_FLAMES_SPREAD = 64, + EVENT_FLAME_SUPPRESSION_50000 = 65, + EVENT_FLAME_SUPPRESSION_10 = 66, + EVENT_FROST_BOMB = 67, + EVENT_SUMMON_EMERGENCY_FIRE_BOTS = 68, + EVENT_EMERGENCY_BOT_CHECK = 69, + EVENT_EMERGENCY_BOT_ATTACK = 70, }; enum SOUNDS { - SOUND_TANK_INTRO = 15611, - SOUND_TANK_ACTIVE = 15612, - SOUND_TANK_SLAY_1 = 15613, - SOUND_TANK_SLAY_2 = 15614, - SOUND_TANK_DEATH = 15615, - SOUND_TORSO_ACTIVE = 15616, - SOUND_TORSO_SLAY_1 = 15617, - SOUND_TORSO_SLAY_2 = 15618, - SOUND_TORSO_DEATH = 15619, - SOUND_HEAD_ACTIVE = 15620, - SOUND_HEAD_SLAY_1 = 15621, - SOUND_HEAD_SLAY_2 = 15622, - SOUND_HEAD_DEATH = 15623, - SOUND_VOLTRON_ACTIVE = 15624, - SOUND_VOLTRON_SLAY_1 = 15625, - SOUND_VOLTRON_SLAY_2 = 15626, - SOUND_VOLTRON_DEATH = 15627, - SOUND_BERSERK = 15628, - SOUND_TANK_HARD_INTRO = 15629, + SOUND_TANK_INTRO = 15611, + SOUND_TANK_ACTIVE = 15612, + SOUND_TANK_SLAY_1 = 15613, + SOUND_TANK_SLAY_2 = 15614, + SOUND_TANK_DEATH = 15615, + SOUND_TORSO_ACTIVE = 15616, + SOUND_TORSO_SLAY_1 = 15617, + SOUND_TORSO_SLAY_2 = 15618, + SOUND_TORSO_DEATH = 15619, + SOUND_HEAD_ACTIVE = 15620, + SOUND_HEAD_SLAY_1 = 15621, + SOUND_HEAD_SLAY_2 = 15622, + SOUND_HEAD_DEATH = 15623, + SOUND_VOLTRON_ACTIVE = 15624, + SOUND_VOLTRON_SLAY_1 = 15625, + SOUND_VOLTRON_SLAY_2 = 15626, + SOUND_VOLTRON_DEATH = 15627, + SOUND_BERSERK = 15628, + SOUND_TANK_HARD_INTRO = 15629, }; -#define SPELL_NAPALM_SHELL RAID_MODE(SPELL_NAPALM_SHELL_10, SPELL_NAPALM_SHELL_25) -#define SPELL_PLASMA_BLAST RAID_MODE(SPELL_PLASMA_BLAST_10, SPELL_PLASMA_BLAST_25) -#define SPELL_MINE_EXPLOSION RAID_MODE(SPELL_MINE_EXPLOSION_10, SPELL_MINE_EXPLOSION_25) -#define SPELL_PLASMA_BALL RAID_MODE(SPELL_PLASMA_BALL_10, SPELL_PLASMA_BALL_25) -#define SPELL_HAND_PULSE_R RAID_MODE(SPELL_HAND_PULSE_10_R, SPELL_HAND_PULSE_25_R) -#define SPELL_HAND_PULSE_L RAID_MODE(SPELL_HAND_PULSE_10_L, SPELL_HAND_PULSE_25_L) -#define SPELL_FROST_BOMB_EXPLOSION RAID_MODE(SPELL_FROST_BOMB_EXPLOSION_10, SPELL_FROST_BOMB_EXPLOSION_25) +#define SPELL_NAPALM_SHELL RAID_MODE(SPELL_NAPALM_SHELL_10, SPELL_NAPALM_SHELL_25) +#define SPELL_PLASMA_BLAST RAID_MODE(SPELL_PLASMA_BLAST_10, SPELL_PLASMA_BLAST_25) +#define SPELL_MINE_EXPLOSION RAID_MODE(SPELL_MINE_EXPLOSION_10, SPELL_MINE_EXPLOSION_25) +#define SPELL_PLASMA_BALL RAID_MODE(SPELL_PLASMA_BALL_10, SPELL_PLASMA_BALL_25) +#define SPELL_HAND_PULSE_R RAID_MODE(SPELL_HAND_PULSE_10_R, SPELL_HAND_PULSE_25_R) +#define SPELL_HAND_PULSE_L RAID_MODE(SPELL_HAND_PULSE_10_L, SPELL_HAND_PULSE_25_L) +#define SPELL_FROST_BOMB_EXPLOSION RAID_MODE(SPELL_FROST_BOMB_EXPLOSION_10, SPELL_FROST_BOMB_EXPLOSION_25) -#define TEXT_AGGRO "Oh, my! I wasn't expecting company! The workshop is such a mess! How embarrassing!" -#define TEXT_BERSERK "Oh, my! It would seem that we are out of time, my friends!" -#define TEXT_HARDMODE "Now why would you go and do something like that? Didn't you see the sign that said 'DO NOT PUSH THIS BUTTON!'? How will we finish testing with the self-destruct mechanism active?" -#define TEXT_LMK2_ACTIVATE "We haven't much time, friends! You're going to help me test out my latest and greatest creation. Now, before you change your minds, remember, that you kind of owe it to me after the mess you made with the XT-002." -#define TEXT_LMK2_SLAIN_1 "MEDIC!" -#define TEXT_LMK2_SLAIN_2 "I can fix that... or, maybe not! Sheesh, what a mess..." -#define TEXT_LMK2_DEATH "WONDERFUL! Positively marvelous results! Hull integrity at 98.9 percent! Barely a dent! Moving right along." -#define TEXT_VX001_ACTIVATE "Behold the VX-001 Anti-personnel Assault Cannon! You might want to take cover." -#define TEXT_VX001_SLAIN_1 "Fascinating. I think they call that a \"clean kill\"." -#define TEXT_VX001_SLAIN_2 "Note to self: Cannon highly effective against flesh." -#define TEXT_VX001_DEATH "Thank you, friends! Your efforts have yielded some fantastic data! Now, where did I put-- oh, there it is!" -#define TEXT_ACU_ACTIVATE "Isn't it beautiful? I call it the magnificent aerial command unit!" -#define TEXT_ACU_SLAIN_1 "Outplayed!" -#define TEXT_ACU_SLAIN_2 "You can do better than that!" -#define TEXT_ACU_DEATH "Preliminary testing phase complete. Now comes the true test!!" -#define TEXT_VOLTRON_ACTIVATE "Gaze upon its magnificence! Bask in its glorious, um, glory! I present you... V-07-TR-0N!" -#define TEXT_VOLTRON_SLAIN_1 "Prognosis: Negative!" -#define TEXT_VOLTRON_SLAIN_2 "You're not going to get up from that one, friend." -#define TEXT_VOLTRON_DEATH "It would appear that I've made a slight miscalculation. I allowed my mind to be corrupted by the fiend in the prison, overriding my primary directive. All systems seem to be functional now. Clear." +#define TEXT_AGGRO "Oh, my! I wasn't expecting company! The workshop is such a mess! How embarrassing!" +#define TEXT_BERSERK "Oh, my! It would seem that we are out of time, my friends!" +#define TEXT_HARDMODE "Now why would you go and do something like that? Didn't you see the sign that said 'DO NOT PUSH THIS BUTTON!'? How will we finish testing with the self-destruct mechanism active?" +#define TEXT_LMK2_ACTIVATE "We haven't much time, friends! You're going to help me test out my latest and greatest creation. Now, before you change your minds, remember, that you kind of owe it to me after the mess you made with the XT-002." +#define TEXT_LMK2_SLAIN_1 "MEDIC!" +#define TEXT_LMK2_SLAIN_2 "I can fix that... or, maybe not! Sheesh, what a mess..." +#define TEXT_LMK2_DEATH "WONDERFUL! Positively marvelous results! Hull integrity at 98.9 percent! Barely a dent! Moving right along." +#define TEXT_VX001_ACTIVATE "Behold the VX-001 Anti-personnel Assault Cannon! You might want to take cover." +#define TEXT_VX001_SLAIN_1 "Fascinating. I think they call that a \"clean kill\"." +#define TEXT_VX001_SLAIN_2 "Note to self: Cannon highly effective against flesh." +#define TEXT_VX001_DEATH "Thank you, friends! Your efforts have yielded some fantastic data! Now, where did I put-- oh, there it is!" +#define TEXT_ACU_ACTIVATE "Isn't it beautiful? I call it the magnificent aerial command unit!" +#define TEXT_ACU_SLAIN_1 "Outplayed!" +#define TEXT_ACU_SLAIN_2 "You can do better than that!" +#define TEXT_ACU_DEATH "Preliminary testing phase complete. Now comes the true test!!" +#define TEXT_VOLTRON_ACTIVATE "Gaze upon its magnificence! Bask in its glorious, um, glory! I present you... V-07-TR-0N!" +#define TEXT_VOLTRON_SLAIN_1 "Prognosis: Negative!" +#define TEXT_VOLTRON_SLAIN_2 "You're not going to get up from that one, friend." +#define TEXT_VOLTRON_DEATH "It would appear that I've made a slight miscalculation. I allowed my mind to be corrupted by the fiend in the prison, overriding my primary directive. All systems seem to be functional now. Clear." enum ComputerTalks { - TALK_COMPUTER_INITIATED = 0, + TALK_COMPUTER_INITIATED = 0, TALK_COMPUTER_TERMINATED = 1, TALK_COMPUTER_TEN = 2, TALK_COMPUTER_NINE = 3, @@ -284,1688 +284,1688 @@ enum ComputerTalks class boss_mimiron : public CreatureScript { public: - boss_mimiron() : CreatureScript("boss_mimiron") { } + boss_mimiron() : CreatureScript("boss_mimiron") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_mimironAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_mimironAI (pCreature); + } - struct boss_mimironAI : public ScriptedAI - { - boss_mimironAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) - { - pInstance = me->GetInstanceScript(); - if (!me->IsAlive()) - if (pInstance) - pInstance->SetData(TYPE_MIMIRON, DONE); - bIsEvading = false; - } + struct boss_mimironAI : public ScriptedAI + { + boss_mimironAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) + { + pInstance = me->GetInstanceScript(); + if (!me->IsAlive()) + if (pInstance) + pInstance->SetData(TYPE_MIMIRON, DONE); + bIsEvading = false; + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - bool bIsEvading; - bool hardmode; - bool berserk; - bool bAchievProximityMine; - bool bAchievBombBot; - bool bAchievRocketStrike; - uint32 allowedFlameSpreadTime; - bool changeAllowedFlameSpreadTime; - uint8 minutesTalkNum; - uint32 outofCombatTimer; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + bool bIsEvading; + bool hardmode; + bool berserk; + bool bAchievProximityMine; + bool bAchievBombBot; + bool bAchievRocketStrike; + uint32 allowedFlameSpreadTime; + bool changeAllowedFlameSpreadTime; + uint8 minutesTalkNum; + uint32 outofCombatTimer; - void Reset() - { - hardmode = false; - berserk = false; - bAchievProximityMine = false; - bAchievBombBot = false; - bAchievRocketStrike = false; - allowedFlameSpreadTime = 0; - outofCombatTimer = 0; - changeAllowedFlameSpreadTime = false; - ResetGameObjects(); - events.Reset(); - summons.DespawnAll(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + void Reset() + { + hardmode = false; + berserk = false; + bAchievProximityMine = false; + bAchievBombBot = false; + bAchievRocketStrike = false; + allowedFlameSpreadTime = 0; + outofCombatTimer = 0; + changeAllowedFlameSpreadTime = false; + ResetGameObjects(); + events.Reset(); + summons.DespawnAll(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (pInstance && pInstance->GetData(TYPE_MIMIRON) != DONE) - pInstance->SetData(TYPE_MIMIRON, NOT_STARTED); - } + if (pInstance && pInstance->GetData(TYPE_MIMIRON) != DONE) + pInstance->SetData(TYPE_MIMIRON, NOT_STARTED); + } - void AttackStart(Unit* who) - { - if (who) - me->Attack(who, true); // skip following - } + void AttackStart(Unit* who) + { + if (who) + me->Attack(who, true); // skip following + } - void JustReachedHome() - { - me->setActive(false); - ScriptedAI::JustReachedHome(); - } + void JustReachedHome() + { + me->setActive(false); + ScriptedAI::JustReachedHome(); + } - void EnterCombat(Unit* who) - { - me->setActive(true); - DoZoneInCombat(); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - events.Reset(); + void EnterCombat(Unit* who) + { + me->setActive(true); + DoZoneInCombat(); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + events.Reset(); - if (Creature* c = GetLMK2()) - { - if (c->IsInEvadeMode()) - { - EnterEvadeMode(); - return; - } - if (!c->IsAlive()) - c->Respawn(); + if (Creature* c = GetLMK2()) + { + if (c->IsInEvadeMode()) + { + EnterEvadeMode(); + return; + } + if (!c->IsAlive()) + c->Respawn(); - me->EnterVehicle(c, 1); - } - else - { - EnterEvadeMode(); - return; - } - CloseDoorAndButton(); + me->EnterVehicle(c, 1); + } + else + { + EnterEvadeMode(); + return; + } + CloseDoorAndButton(); - if (!hardmode) - { - me->MonsterYell(TEXT_LMK2_ACTIVATE, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_TANK_ACTIVE); - events.ScheduleEvent(EVENT_SIT_LMK2, 6000); - events.ScheduleEvent(EVENT_BERSERK, 900000); - } - else - { - events.ScheduleEvent(EVENT_MIMIRON_SAY_HARDMODE, 7000); - events.ScheduleEvent(EVENT_BERSERK, Is25ManRaid() ? 10*MINUTE*IN_MILLISECONDS : 8*MINUTE*IN_MILLISECONDS); + if (!hardmode) + { + me->MonsterYell(TEXT_LMK2_ACTIVATE, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_TANK_ACTIVE); + events.ScheduleEvent(EVENT_SIT_LMK2, 6000); + events.ScheduleEvent(EVENT_BERSERK, 900000); + } + else + { + events.ScheduleEvent(EVENT_MIMIRON_SAY_HARDMODE, 7000); + events.ScheduleEvent(EVENT_BERSERK, Is25ManRaid() ? 10*MINUTE*IN_MILLISECONDS : 8*MINUTE*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_COMPUTER_SAY_INITIATED, 0); - events.ScheduleEvent(EVENT_COMPUTER_SAY_MINUTES, 3000); - minutesTalkNum = Is25ManRaid() ? TALK_COMPUTER_TEN : TALK_COMPUTER_EIGHT; - for (uint32 i=0; iUpdatePosition(LMK2->GetHomePosition(), true); - LMK2->StopMovingOnCurrentPos(); - } + // ensure LMK2 is at proper position + if (Creature* LMK2 = GetLMK2()) + { + LMK2->UpdatePosition(LMK2->GetHomePosition(), true); + LMK2->StopMovingOnCurrentPos(); + } - if (pInstance && pInstance->GetData(TYPE_MIMIRON) != DONE) - pInstance->SetData(TYPE_MIMIRON, IN_PROGRESS); - } + if (pInstance && pInstance->GetData(TYPE_MIMIRON) != DONE) + pInstance->SetData(TYPE_MIMIRON, IN_PROGRESS); + } - void UpdateAI(uint32 diff) - { - if (!me->IsInCombat()) - { - outofCombatTimer += diff; - if (outofCombatTimer >= 10000) - { - outofCombatTimer = 0; - if (Creature* c = GetLMK2()) - me->CastSpell(c, RAND(SPELL_ENTER_VEHICLE_0, SPELL_ENTER_VEHICLE_1, SPELL_ENTER_VEHICLE_2, SPELL_ENTER_VEHICLE_4), true); - } - return; - } + void UpdateAI(uint32 diff) + { + if (!me->IsInCombat()) + { + outofCombatTimer += diff; + if (outofCombatTimer >= 10000) + { + outofCombatTimer = 0; + if (Creature* c = GetLMK2()) + me->CastSpell(c, RAND(SPELL_ENTER_VEHICLE_0, SPELL_ENTER_VEHICLE_1, SPELL_ENTER_VEHICLE_2, SPELL_ENTER_VEHICLE_4), true); + } + return; + } - Position p = me->GetHomePosition(); - if (me->GetExactDist(&p) > 80.0f || !SelectTargetFromPlayerList(150.0f)) - { - EnterEvadeMode(); - return; - } + Position p = me->GetHomePosition(); + if (me->GetExactDist(&p) > 80.0f || !SelectTargetFromPlayerList(150.0f)) + { + EnterEvadeMode(); + return; + } - events.Update(diff); + events.Update(diff); - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_COMPUTER_SAY_INITIATED: - if( Creature* computer = me->SummonCreature(NPC_COMPUTER, 2790.0f, 2569.44f, 364.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000) ) - computer->AI()->Talk(TALK_COMPUTER_INITIATED); - events.PopEvent(); - break; - case EVENT_COMPUTER_SAY_MINUTES: - if( Creature* computer = me->SummonCreature(NPC_COMPUTER, 2790.0f, 2569.44f, 364.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000) ) - computer->AI()->Talk(minutesTalkNum++); - events.PopEvent(); - break; - case EVENT_MIMIRON_SAY_HARDMODE: - me->MonsterYell(TEXT_HARDMODE, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_TANK_HARD_INTRO); - events.PopEvent(); - events.ScheduleEvent(EVENT_SPAWN_FLAMES_INITIAL, 0); - events.ScheduleEvent(EVENT_SIT_LMK2, 4000); - break; - case EVENT_SPAWN_FLAMES_INITIAL: - { - if (changeAllowedFlameSpreadTime) - allowedFlameSpreadTime = time(NULL); + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_COMPUTER_SAY_INITIATED: + if( Creature* computer = me->SummonCreature(NPC_COMPUTER, 2790.0f, 2569.44f, 364.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000) ) + computer->AI()->Talk(TALK_COMPUTER_INITIATED); + events.PopEvent(); + break; + case EVENT_COMPUTER_SAY_MINUTES: + if( Creature* computer = me->SummonCreature(NPC_COMPUTER, 2790.0f, 2569.44f, 364.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000) ) + computer->AI()->Talk(minutesTalkNum++); + events.PopEvent(); + break; + case EVENT_MIMIRON_SAY_HARDMODE: + me->MonsterYell(TEXT_HARDMODE, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_TANK_HARD_INTRO); + events.PopEvent(); + events.ScheduleEvent(EVENT_SPAWN_FLAMES_INITIAL, 0); + events.ScheduleEvent(EVENT_SIT_LMK2, 4000); + break; + case EVENT_SPAWN_FLAMES_INITIAL: + { + if (changeAllowedFlameSpreadTime) + allowedFlameSpreadTime = time(NULL); - std::vector pg; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - if( plr->IsAlive() && plr->GetExactDist2d(me) < 150.0f && !plr->IsGameMaster() ) - pg.push_back(plr); + std::vector pg; + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + if( plr->IsAlive() && plr->GetExactDist2d(me) < 150.0f && !plr->IsGameMaster() ) + pg.push_back(plr); - for( uint8 i=0; i<3; ++i ) - if( !pg.empty() ) - { - uint8 index = urand(0, pg.size()-1); - Player* p = pg[index]; - float angle = rand_norm()*2*M_PI; - float z = 364.35f; - if (!p->IsWithinLOS(p->GetPositionX()+cos(angle)*5.0f, p->GetPositionY()+sin(angle)*5.0f, z)) - angle = p->GetAngle(2744.65f, 2569.46f); - me->CastSpell(p->GetPositionX()+cos(angle)*5.0f, p->GetPositionY()+sin(angle)*5.0f, z, SPELL_SUMMON_FLAMES_INITIAL, true); - pg.erase(pg.begin()+index); - } + for( uint8 i=0; i<3; ++i ) + if( !pg.empty() ) + { + uint8 index = urand(0, pg.size()-1); + Player* p = pg[index]; + float angle = rand_norm()*2*M_PI; + float z = 364.35f; + if (!p->IsWithinLOS(p->GetPositionX()+cos(angle)*5.0f, p->GetPositionY()+sin(angle)*5.0f, z)) + angle = p->GetAngle(2744.65f, 2569.46f); + me->CastSpell(p->GetPositionX()+cos(angle)*5.0f, p->GetPositionY()+sin(angle)*5.0f, z, SPELL_SUMMON_FLAMES_INITIAL, true); + pg.erase(pg.begin()+index); + } - events.RepeatEvent(30000); - } - break; - case EVENT_BERSERK: - berserk = true; - me->MonsterYell(TEXT_BERSERK, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BERSERK); - if( hardmode ) - me->SummonCreature(33576, 2744.78f, 2569.47f, 364.32f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 120000); - events.PopEvent(); - events.ScheduleEvent(EVENT_BERSERK_2, 0); - break; - case EVENT_BERSERK_2: - { - Creature* VX001 = NULL; - Creature* LMK2 = NULL; - Creature* ACU = NULL; - if (VX001 = GetVX001()) - VX001->CastSpell(VX001, SPELL_BERSERK, true); - if (LMK2 = GetLMK2()) - LMK2->CastSpell(LMK2, SPELL_BERSERK, true); - if (ACU = GetACU()) - ACU->CastSpell(ACU, SPELL_BERSERK, true); - events.RepeatEvent(30000); - } - break; - case EVENT_SIT_LMK2: - if(Creature* LMK2 = GetLMK2()) - { - me->EnterVehicle(LMK2, 6); - events.PopEvent(); - events.ScheduleEvent(EVENT_SIT_LMK2_INTERVAL, 2000); - break; - } - EnterEvadeMode(); - break; - case EVENT_SIT_LMK2_INTERVAL: - if (Creature* LMK2 = GetLMK2()) - { - if (hardmode) - { - LMK2->CastSpell(LMK2, SPELL_EMERGENCY_MODE, true); - if( Vehicle* veh = LMK2->GetVehicleKit() ) - if( Unit* cannon = veh->GetPassenger(3) ) - cannon->CastSpell(cannon, SPELL_EMERGENCY_MODE, true); - } - LMK2->AI()->SetData(1, 1); - events.PopEvent(); - break; - } - EnterEvadeMode(); - break; - case EVENT_LMK2_RETREAT_INTERVAL: - if (Creature* LMK2 = GetLMK2()) - { - me->EnterVehicle(LMK2, 1); - me->MonsterYell(TEXT_LMK2_DEATH, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_TANK_DEATH); - LMK2->SetFacingTo(3.58f); - events.PopEvent(); - events.ScheduleEvent(EVENT_ELEVATOR_INTERVAL_0, 6000); - break; - } - EnterEvadeMode(); - break; - case EVENT_ELEVATOR_INTERVAL_0: - if( GameObject* elevator = me->FindNearestGameObject(GO_MIMIRON_ELEVATOR, 100.0f) ) - { - elevator->SetLootState(GO_READY); - elevator->UseDoorOrButton(0, false); - elevator->EnableCollision(false); - } - events.PopEvent(); - events.ScheduleEvent(EVENT_ELEVATOR_INTERVAL_1, 6000); - break; - case EVENT_ELEVATOR_INTERVAL_1: - if( Creature* VX001 = me->SummonCreature(NPC_VX001, 2744.65f, 2569.46f, 364.40f, 3.14f, TEMPSUMMON_MANUAL_DESPAWN) ) - { - if( GameObject *elevator = me->FindNearestGameObject(GO_MIMIRON_ELEVATOR, 100.0f) ) - { - elevator->SetLootState(GO_READY); - elevator->UseDoorOrButton(0, true); - elevator->EnableCollision(false); - } - events.PopEvent(); - events.ScheduleEvent(EVENT_ELEVATOR_INTERVAL_2, 18000); - break; - } - EnterEvadeMode(); - break; - case EVENT_ELEVATOR_INTERVAL_2: - if (Creature* VX001 = GetVX001()) - { - me->EnterVehicle(VX001, 0); - events.PopEvent(); - events.ScheduleEvent(EVENT_SITTING_ON_VX001, 4000); - break; - } - EnterEvadeMode(); - break; - case EVENT_SITTING_ON_VX001: - me->MonsterYell(TEXT_VX001_ACTIVATE, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_TORSO_ACTIVE); - events.PopEvent(); - events.ScheduleEvent(EVENT_ENTER_VX001, 5000); - break; - case EVENT_ENTER_VX001: - if( Creature* VX001 = GetVX001() ) - { - me->EnterVehicle(VX001, 1); - events.PopEvent(); - events.ScheduleEvent(EVENT_EMOTE_VX001, 2000); - break; - } - EnterEvadeMode(); - break; - case EVENT_EMOTE_VX001: - if( Creature* VX001 = GetVX001() ) - { - VX001->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - events.PopEvent(); - events.ScheduleEvent(EVENT_VX001_START_FIGHT, 1750); - break; - } - EnterEvadeMode(); - break; - case EVENT_VX001_START_FIGHT: - if( Creature* VX001 = GetVX001() ) - { - if( hardmode ) - VX001->CastSpell(VX001, SPELL_EMERGENCY_MODE, true); - VX001->AI()->SetData(1, 2); - me->SetInCombatWithZone(); - events.PopEvent(); - break; - } - EnterEvadeMode(); - break; - case EVENT_VX001_EMOTESTATE_DEATH: - if( Creature* VX001 = GetVX001() ) - { - VX001->HandleEmoteCommand(EMOTE_STATE_DROWNED); - VX001->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DROWNED); - events.PopEvent(); - events.ScheduleEvent(EVENT_GET_OUT_VX001, 2500); - break; - } - EnterEvadeMode(); - break; - case EVENT_GET_OUT_VX001: - if( Creature* VX001 = GetVX001() ) - if( Creature* ACU = me->SummonCreature(NPC_AERIAL_COMMAND_UNIT, 2743.91f, 2568.78f, 391.34f, M_PI, TEMPSUMMON_MANUAL_DESPAWN) ) - { - me->EnterVehicle(VX001, 4); - float speed = ACU->GetDistance(2737.75f, 2574.22f, 381.34f) / 2.0f; - ACU->MonsterMoveWithSpeed(2737.75f, 2574.22f, 381.34f, speed); - ACU->SetPosition(2737.75f, 2574.22f, 381.34f, M_PI); - events.PopEvent(); - events.ScheduleEvent(EVENT_SAY_VX001_DEAD, 2000); - break; - } - EnterEvadeMode(); - break; - case EVENT_SAY_VX001_DEAD: - changeAllowedFlameSpreadTime = true; - me->MonsterYell(TEXT_VX001_DEATH, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_TORSO_DEATH); - events.PopEvent(); - events.ScheduleEvent(EVENT_ENTER_ACU, 7000); - break; - case EVENT_ENTER_ACU: - if( Creature* ACU = GetACU() ) - { - me->EnterVehicle(ACU, 0); - events.PopEvent(); - events.ScheduleEvent(EVENT_SAY_ACU_ACTIVATE, 6000); - break; - } - EnterEvadeMode(); - break; - case EVENT_SAY_ACU_ACTIVATE: - me->MonsterYell(TEXT_ACU_ACTIVATE, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HEAD_ACTIVE); - events.PopEvent(); - events.ScheduleEvent(EVENT_ACU_START_ATTACK, 4000); - break; - case EVENT_ACU_START_ATTACK: - if( Creature* ACU = GetACU() ) - { - if( hardmode ) - ACU->CastSpell(ACU, SPELL_EMERGENCY_MODE, true); - ACU->AI()->SetData(1, 3); - me->SetInCombatWithZone(); - events.PopEvent(); - break; - } - EnterEvadeMode(); - break; - case EVENT_SAY_ACU_DEAD: - me->MonsterYell(TEXT_ACU_DEATH, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HEAD_DEATH); - events.PopEvent(); - events.ScheduleEvent(EVENT_LEVIATHAN_COME_CLOSER, 5000); - break; - case EVENT_LEVIATHAN_COME_CLOSER: - if (Creature* LMK2 = GetLMK2()) - { - LMK2->GetMotionMaster()->MoveCharge(2755.77f, 2574.95f, 364.31f, 21.0f); - events.PopEvent(); - events.ScheduleEvent(EVENT_VX001_EMOTE_JUMP, 4000); - break; - } - EnterEvadeMode(); - break; - case EVENT_VX001_EMOTE_JUMP: - { - Creature* LMK2 = GetLMK2(); - Creature* VX001 = GetVX001(); - if( !VX001 || !LMK2 ) - { - EnterEvadeMode(); - return; - } + events.RepeatEvent(30000); + } + break; + case EVENT_BERSERK: + berserk = true; + me->MonsterYell(TEXT_BERSERK, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BERSERK); + if( hardmode ) + me->SummonCreature(33576, 2744.78f, 2569.47f, 364.32f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 120000); + events.PopEvent(); + events.ScheduleEvent(EVENT_BERSERK_2, 0); + break; + case EVENT_BERSERK_2: + { + Creature* VX001 = NULL; + Creature* LMK2 = NULL; + Creature* ACU = NULL; + if (VX001 = GetVX001()) + VX001->CastSpell(VX001, SPELL_BERSERK, true); + if (LMK2 = GetLMK2()) + LMK2->CastSpell(LMK2, SPELL_BERSERK, true); + if (ACU = GetACU()) + ACU->CastSpell(ACU, SPELL_BERSERK, true); + events.RepeatEvent(30000); + } + break; + case EVENT_SIT_LMK2: + if(Creature* LMK2 = GetLMK2()) + { + me->EnterVehicle(LMK2, 6); + events.PopEvent(); + events.ScheduleEvent(EVENT_SIT_LMK2_INTERVAL, 2000); + break; + } + EnterEvadeMode(); + break; + case EVENT_SIT_LMK2_INTERVAL: + if (Creature* LMK2 = GetLMK2()) + { + if (hardmode) + { + LMK2->CastSpell(LMK2, SPELL_EMERGENCY_MODE, true); + if( Vehicle* veh = LMK2->GetVehicleKit() ) + if( Unit* cannon = veh->GetPassenger(3) ) + cannon->CastSpell(cannon, SPELL_EMERGENCY_MODE, true); + } + LMK2->AI()->SetData(1, 1); + events.PopEvent(); + break; + } + EnterEvadeMode(); + break; + case EVENT_LMK2_RETREAT_INTERVAL: + if (Creature* LMK2 = GetLMK2()) + { + me->EnterVehicle(LMK2, 1); + me->MonsterYell(TEXT_LMK2_DEATH, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_TANK_DEATH); + LMK2->SetFacingTo(3.58f); + events.PopEvent(); + events.ScheduleEvent(EVENT_ELEVATOR_INTERVAL_0, 6000); + break; + } + EnterEvadeMode(); + break; + case EVENT_ELEVATOR_INTERVAL_0: + if( GameObject* elevator = me->FindNearestGameObject(GO_MIMIRON_ELEVATOR, 100.0f) ) + { + elevator->SetLootState(GO_READY); + elevator->UseDoorOrButton(0, false); + elevator->EnableCollision(false); + } + events.PopEvent(); + events.ScheduleEvent(EVENT_ELEVATOR_INTERVAL_1, 6000); + break; + case EVENT_ELEVATOR_INTERVAL_1: + if( Creature* VX001 = me->SummonCreature(NPC_VX001, 2744.65f, 2569.46f, 364.40f, 3.14f, TEMPSUMMON_MANUAL_DESPAWN) ) + { + if( GameObject *elevator = me->FindNearestGameObject(GO_MIMIRON_ELEVATOR, 100.0f) ) + { + elevator->SetLootState(GO_READY); + elevator->UseDoorOrButton(0, true); + elevator->EnableCollision(false); + } + events.PopEvent(); + events.ScheduleEvent(EVENT_ELEVATOR_INTERVAL_2, 18000); + break; + } + EnterEvadeMode(); + break; + case EVENT_ELEVATOR_INTERVAL_2: + if (Creature* VX001 = GetVX001()) + { + me->EnterVehicle(VX001, 0); + events.PopEvent(); + events.ScheduleEvent(EVENT_SITTING_ON_VX001, 4000); + break; + } + EnterEvadeMode(); + break; + case EVENT_SITTING_ON_VX001: + me->MonsterYell(TEXT_VX001_ACTIVATE, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_TORSO_ACTIVE); + events.PopEvent(); + events.ScheduleEvent(EVENT_ENTER_VX001, 5000); + break; + case EVENT_ENTER_VX001: + if( Creature* VX001 = GetVX001() ) + { + me->EnterVehicle(VX001, 1); + events.PopEvent(); + events.ScheduleEvent(EVENT_EMOTE_VX001, 2000); + break; + } + EnterEvadeMode(); + break; + case EVENT_EMOTE_VX001: + if( Creature* VX001 = GetVX001() ) + { + VX001->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); + events.PopEvent(); + events.ScheduleEvent(EVENT_VX001_START_FIGHT, 1750); + break; + } + EnterEvadeMode(); + break; + case EVENT_VX001_START_FIGHT: + if( Creature* VX001 = GetVX001() ) + { + if( hardmode ) + VX001->CastSpell(VX001, SPELL_EMERGENCY_MODE, true); + VX001->AI()->SetData(1, 2); + me->SetInCombatWithZone(); + events.PopEvent(); + break; + } + EnterEvadeMode(); + break; + case EVENT_VX001_EMOTESTATE_DEATH: + if( Creature* VX001 = GetVX001() ) + { + VX001->HandleEmoteCommand(EMOTE_STATE_DROWNED); + VX001->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DROWNED); + events.PopEvent(); + events.ScheduleEvent(EVENT_GET_OUT_VX001, 2500); + break; + } + EnterEvadeMode(); + break; + case EVENT_GET_OUT_VX001: + if( Creature* VX001 = GetVX001() ) + if( Creature* ACU = me->SummonCreature(NPC_AERIAL_COMMAND_UNIT, 2743.91f, 2568.78f, 391.34f, M_PI, TEMPSUMMON_MANUAL_DESPAWN) ) + { + me->EnterVehicle(VX001, 4); + float speed = ACU->GetDistance(2737.75f, 2574.22f, 381.34f) / 2.0f; + ACU->MonsterMoveWithSpeed(2737.75f, 2574.22f, 381.34f, speed); + ACU->SetPosition(2737.75f, 2574.22f, 381.34f, M_PI); + events.PopEvent(); + events.ScheduleEvent(EVENT_SAY_VX001_DEAD, 2000); + break; + } + EnterEvadeMode(); + break; + case EVENT_SAY_VX001_DEAD: + changeAllowedFlameSpreadTime = true; + me->MonsterYell(TEXT_VX001_DEATH, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_TORSO_DEATH); + events.PopEvent(); + events.ScheduleEvent(EVENT_ENTER_ACU, 7000); + break; + case EVENT_ENTER_ACU: + if( Creature* ACU = GetACU() ) + { + me->EnterVehicle(ACU, 0); + events.PopEvent(); + events.ScheduleEvent(EVENT_SAY_ACU_ACTIVATE, 6000); + break; + } + EnterEvadeMode(); + break; + case EVENT_SAY_ACU_ACTIVATE: + me->MonsterYell(TEXT_ACU_ACTIVATE, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HEAD_ACTIVE); + events.PopEvent(); + events.ScheduleEvent(EVENT_ACU_START_ATTACK, 4000); + break; + case EVENT_ACU_START_ATTACK: + if( Creature* ACU = GetACU() ) + { + if( hardmode ) + ACU->CastSpell(ACU, SPELL_EMERGENCY_MODE, true); + ACU->AI()->SetData(1, 3); + me->SetInCombatWithZone(); + events.PopEvent(); + break; + } + EnterEvadeMode(); + break; + case EVENT_SAY_ACU_DEAD: + me->MonsterYell(TEXT_ACU_DEATH, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HEAD_DEATH); + events.PopEvent(); + events.ScheduleEvent(EVENT_LEVIATHAN_COME_CLOSER, 5000); + break; + case EVENT_LEVIATHAN_COME_CLOSER: + if (Creature* LMK2 = GetLMK2()) + { + LMK2->GetMotionMaster()->MoveCharge(2755.77f, 2574.95f, 364.31f, 21.0f); + events.PopEvent(); + events.ScheduleEvent(EVENT_VX001_EMOTE_JUMP, 4000); + break; + } + EnterEvadeMode(); + break; + case EVENT_VX001_EMOTE_JUMP: + { + Creature* LMK2 = GetLMK2(); + Creature* VX001 = GetVX001(); + if( !VX001 || !LMK2 ) + { + EnterEvadeMode(); + return; + } - VX001->SendMeleeAttackStop(); - VX001->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CUSTOM_SPELL_02); - VX001->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_02); - events.PopEvent(); - events.ScheduleEvent(EVENT_LEVIATHAN_RIDE_MIDDLE, 4800); - } - break; - case EVENT_LEVIATHAN_RIDE_MIDDLE: - { - Creature* VX001 = GetVX001(); - Creature* LMK2 = GetLMK2(); - if( !VX001 || !LMK2 ) - { - EnterEvadeMode(); - return; - } + VX001->SendMeleeAttackStop(); + VX001->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CUSTOM_SPELL_02); + VX001->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_02); + events.PopEvent(); + events.ScheduleEvent(EVENT_LEVIATHAN_RIDE_MIDDLE, 4800); + } + break; + case EVENT_LEVIATHAN_RIDE_MIDDLE: + { + Creature* VX001 = GetVX001(); + Creature* LMK2 = GetLMK2(); + if( !VX001 || !LMK2 ) + { + EnterEvadeMode(); + return; + } - LMK2->GetMotionMaster()->MoveCharge(2744.65f, 2569.46f, 364.31f, 21.0f); - VX001->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_01); - VX001->HandleEmoteCommand(EMOTE_STATE_CUSTOM_SPELL_01); - VX001->EnterVehicle(LMK2, 3); - LMK2->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_01); - LMK2->HandleEmoteCommand(EMOTE_STATE_CUSTOM_SPELL_01); - events.PopEvent(); - events.ScheduleEvent(EVENT_JOIN_TOGETHER, 3000); - } - break; - case EVENT_JOIN_TOGETHER: - { - Creature* ACU = GetACU(); - Creature* VX001 = GetVX001(); - if( !VX001 || !ACU ) - { - EnterEvadeMode(); - return; - } + LMK2->GetMotionMaster()->MoveCharge(2744.65f, 2569.46f, 364.31f, 21.0f); + VX001->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_01); + VX001->HandleEmoteCommand(EMOTE_STATE_CUSTOM_SPELL_01); + VX001->EnterVehicle(LMK2, 3); + LMK2->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_01); + LMK2->HandleEmoteCommand(EMOTE_STATE_CUSTOM_SPELL_01); + events.PopEvent(); + events.ScheduleEvent(EVENT_JOIN_TOGETHER, 3000); + } + break; + case EVENT_JOIN_TOGETHER: + { + Creature* ACU = GetACU(); + Creature* VX001 = GetVX001(); + if( !VX001 || !ACU ) + { + EnterEvadeMode(); + return; + } - ACU->EnterVehicle(VX001, 3); - me->EnterVehicle(VX001, 1); - me->MonsterYell(TEXT_VOLTRON_ACTIVATE, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_VOLTRON_ACTIVE); - events.PopEvent(); - events.ScheduleEvent(EVENT_START_PHASE4, 10000); - } - break; - case EVENT_START_PHASE4: - { - Creature* VX001 = GetVX001(); - Creature* LMK2 = GetLMK2(); - Creature* ACU = GetACU(); - if( !VX001 || !LMK2 || !ACU ) - { - EnterEvadeMode(); - return; - } + ACU->EnterVehicle(VX001, 3); + me->EnterVehicle(VX001, 1); + me->MonsterYell(TEXT_VOLTRON_ACTIVATE, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_VOLTRON_ACTIVE); + events.PopEvent(); + events.ScheduleEvent(EVENT_START_PHASE4, 10000); + } + break; + case EVENT_START_PHASE4: + { + Creature* VX001 = GetVX001(); + Creature* LMK2 = GetLMK2(); + Creature* ACU = GetACU(); + if( !VX001 || !LMK2 || !ACU ) + { + EnterEvadeMode(); + return; + } - LMK2->AI()->SetData(1, 4); - VX001->AI()->SetData(1, 4); - ACU->AI()->SetData(1, 4); - LMK2->CastSpell(LMK2, SPELL_SELF_REPAIR, true); //LMK2->SetHealth( LMK2->GetMaxHealth()/2 ); - VX001->CastSpell(VX001, SPELL_SELF_REPAIR, true); //VX001->SetHealth( VX001->GetMaxHealth()/2 ); - ACU->CastSpell(ACU, SPELL_SELF_REPAIR, true); //ACU->SetHealth( ACU->GetMaxHealth()/2 ); - if( hardmode ) - { - LMK2->CastSpell(LMK2, SPELL_EMERGENCY_MODE, true); - VX001->CastSpell(VX001, SPELL_EMERGENCY_MODE, true); - ACU->CastSpell(ACU, SPELL_EMERGENCY_MODE, true); - } - me->SetInCombatWithZone(); - events.PopEvent(); - } - break; - case EVENT_FINISH: - { - Creature* LMK2 = GetLMK2(); - Creature* VX001 = GetVX001(); - Creature* ACU = GetACU(); - - if (!VX001 || !LMK2 || !ACU) - return; + LMK2->AI()->SetData(1, 4); + VX001->AI()->SetData(1, 4); + ACU->AI()->SetData(1, 4); + LMK2->CastSpell(LMK2, SPELL_SELF_REPAIR, true); //LMK2->SetHealth( LMK2->GetMaxHealth()/2 ); + VX001->CastSpell(VX001, SPELL_SELF_REPAIR, true); //VX001->SetHealth( VX001->GetMaxHealth()/2 ); + ACU->CastSpell(ACU, SPELL_SELF_REPAIR, true); //ACU->SetHealth( ACU->GetMaxHealth()/2 ); + if( hardmode ) + { + LMK2->CastSpell(LMK2, SPELL_EMERGENCY_MODE, true); + VX001->CastSpell(VX001, SPELL_EMERGENCY_MODE, true); + ACU->CastSpell(ACU, SPELL_EMERGENCY_MODE, true); + } + me->SetInCombatWithZone(); + events.PopEvent(); + } + break; + case EVENT_FINISH: + { + Creature* LMK2 = GetLMK2(); + Creature* VX001 = GetVX001(); + Creature* ACU = GetACU(); + + if (!VX001 || !LMK2 || !ACU) + return; - LMK2->GetMotionMaster()->Clear(); - LMK2->StopMoving(); - LMK2->InterruptNonMeleeSpells(false); - LMK2->AttackStop(); - LMK2->AI()->SetData(1, 0); - LMK2->DespawnOrUnsummon(7000); - LMK2->SetReactState(REACT_PASSIVE); - VX001->InterruptNonMeleeSpells(false); - VX001->AttackStop(); - VX001->AI()->SetData(1, 0); - VX001->DespawnOrUnsummon(7000); - VX001->SetReactState(REACT_PASSIVE); - ACU->InterruptNonMeleeSpells(false); - ACU->AttackStop(); - ACU->AI()->SetData(1, 0); - ACU->DespawnOrUnsummon(7000); - ACU->SetReactState(REACT_PASSIVE); + LMK2->GetMotionMaster()->Clear(); + LMK2->StopMoving(); + LMK2->InterruptNonMeleeSpells(false); + LMK2->AttackStop(); + LMK2->AI()->SetData(1, 0); + LMK2->DespawnOrUnsummon(7000); + LMK2->SetReactState(REACT_PASSIVE); + VX001->InterruptNonMeleeSpells(false); + VX001->AttackStop(); + VX001->AI()->SetData(1, 0); + VX001->DespawnOrUnsummon(7000); + VX001->SetReactState(REACT_PASSIVE); + ACU->InterruptNonMeleeSpells(false); + ACU->AttackStop(); + ACU->AI()->SetData(1, 0); + ACU->DespawnOrUnsummon(7000); + ACU->SetReactState(REACT_PASSIVE); - Position exitPos; - me->GetPosition(&exitPos); - me->_ExitVehicle(&exitPos); - me->AttackStop(); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); - me->GetMotionMaster()->Clear(); - summons.DoAction(1337); // despawn summons of summons - summons.DespawnEntry(NPC_FLAMES_INITIAL); - summons.DespawnEntry(33576); + Position exitPos; + me->GetPosition(&exitPos); + me->_ExitVehicle(&exitPos); + me->AttackStop(); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); + me->GetMotionMaster()->Clear(); + summons.DoAction(1337); // despawn summons of summons + summons.DespawnEntry(NPC_FLAMES_INITIAL); + summons.DespawnEntry(33576); - float angle = VX001->GetOrientation(); - float v_x = me->GetPositionX()+cos(angle)*10.0f; - float v_y = me->GetPositionY()+sin(angle)*10.0f; - me->GetMotionMaster()->MoveJump(v_x, v_y, 364.32f, 7.0f, 7.0f); + float angle = VX001->GetOrientation(); + float v_x = me->GetPositionX()+cos(angle)*10.0f; + float v_y = me->GetPositionY()+sin(angle)*10.0f; + me->GetMotionMaster()->MoveJump(v_x, v_y, 364.32f, 7.0f, 7.0f); - if( pInstance ) - for( uint16 i=0; i<3; ++i ) - if( uint64 guid = pInstance->GetData64(DATA_GO_MIMIRON_DOOR_1 + i) ) - if( GameObject* door = ObjectAccessor::GetGameObject(*me, guid) ) - if( door->GetGoState() != GO_STATE_ACTIVE ) - { - door->SetLootState(GO_READY); - door->UseDoorOrButton(0, false); - } + if( pInstance ) + for( uint16 i=0; i<3; ++i ) + if( uint64 guid = pInstance->GetData64(DATA_GO_MIMIRON_DOOR_1 + i) ) + if( GameObject* door = ObjectAccessor::GetGameObject(*me, guid) ) + if( door->GetGoState() != GO_STATE_ACTIVE ) + { + door->SetLootState(GO_READY); + door->UseDoorOrButton(0, false); + } - if (pInstance) - pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, NPC_LEVIATHAN_MKII, 1, me); + if (pInstance) + pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, NPC_LEVIATHAN_MKII, 1, me); - if (hardmode) - if( Creature* computer = me->SummonCreature(NPC_COMPUTER, 2790.0f, 2569.44f, 364.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000) ) - computer->AI()->Talk(TALK_COMPUTER_TERMINATED); + if (hardmode) + if( Creature* computer = me->SummonCreature(NPC_COMPUTER, 2790.0f, 2569.44f, 364.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000) ) + computer->AI()->Talk(TALK_COMPUTER_TERMINATED); - events.Reset(); - events.ScheduleEvent(EVENT_SAY_VOLTRON_DEAD, 6000); - } - break; - case EVENT_SAY_VOLTRON_DEAD: - me->MonsterYell(TEXT_VOLTRON_DEATH, LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_VOLTRON_DEATH); - // spawn chest - if( uint32 chestId = (hardmode ? RAID_MODE(GO_MIMIRON_CHEST_HARD, GO_MIMIRON_CHEST_HERO_HARD) : RAID_MODE(GO_MIMIRON_CHEST, GO_MIMIRON_CHEST_HERO)) ) - if( GameObject *go = me->SummonGameObject(chestId, 2744.65f, 2569.46f, 364.397f, 0, 0, 0, 0, 0, 0) ) - go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); - events.PopEvent(); - events.ScheduleEvent(EVENT_DISAPPEAR, 15000); - break; - case EVENT_DISAPPEAR: - if( pInstance ) - pInstance->SetData(TYPE_MIMIRON, DONE); - summons.DespawnAll(); - me->DespawnOrUnsummon(); - events.PopEvent(); - break; - } - } + events.Reset(); + events.ScheduleEvent(EVENT_SAY_VOLTRON_DEAD, 6000); + } + break; + case EVENT_SAY_VOLTRON_DEAD: + me->MonsterYell(TEXT_VOLTRON_DEATH, LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_VOLTRON_DEATH); + // spawn chest + if( uint32 chestId = (hardmode ? RAID_MODE(GO_MIMIRON_CHEST_HARD, GO_MIMIRON_CHEST_HERO_HARD) : RAID_MODE(GO_MIMIRON_CHEST, GO_MIMIRON_CHEST_HERO)) ) + if( GameObject *go = me->SummonGameObject(chestId, 2744.65f, 2569.46f, 364.397f, 0, 0, 0, 0, 0, 0) ) + go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); + events.PopEvent(); + events.ScheduleEvent(EVENT_DISAPPEAR, 15000); + break; + case EVENT_DISAPPEAR: + if( pInstance ) + pInstance->SetData(TYPE_MIMIRON, DONE); + summons.DespawnAll(); + me->DespawnOrUnsummon(); + events.PopEvent(); + break; + } + } - void MoveInLineOfSight(Unit* mover) {} + void MoveInLineOfSight(Unit* mover) {} - void EnterEvadeMode() - { - if (bIsEvading) - return; - bIsEvading = true; + void EnterEvadeMode() + { + if (bIsEvading) + return; + bIsEvading = true; - if (Creature* c = GetLMK2()) - { - c->AI()->EnterEvadeMode(); - } - if (Creature* c = GetVX001()) - { - c->AI()->EnterEvadeMode(); - c->DespawnOrUnsummon(); - } - if (Creature* c = GetACU()) - { - c->AI()->EnterEvadeMode(); - c->DespawnOrUnsummon(); - } + if (Creature* c = GetLMK2()) + { + c->AI()->EnterEvadeMode(); + } + if (Creature* c = GetVX001()) + { + c->AI()->EnterEvadeMode(); + c->DespawnOrUnsummon(); + } + if (Creature* c = GetACU()) + { + c->AI()->EnterEvadeMode(); + c->DespawnOrUnsummon(); + } - summons.DoAction(1337); // despawn summons of summons + summons.DoAction(1337); // despawn summons of summons - me->RemoveAllAuras(); - me->ExitVehicle(); - ScriptedAI::EnterEvadeMode(); + me->RemoveAllAuras(); + me->ExitVehicle(); + ScriptedAI::EnterEvadeMode(); - bIsEvading = false; - } + bIsEvading = false; + } - void JustSummoned(Creature* s) - { - summons.Summon(s); - } + void JustSummoned(Creature* s) + { + summons.Summon(s); + } - void SummonedCreatureDespawn(Creature* s) - { - summons.Despawn(s); - } + void SummonedCreatureDespawn(Creature* s) + { + summons.Despawn(s); + } - void ResetGameObjects() - { - if( pInstance ) - for( uint16 i=0; i<3; ++i ) - if( uint64 guid = pInstance->GetData64(DATA_GO_MIMIRON_DOOR_1 + i) ) - if( GameObject* door = ObjectAccessor::GetGameObject(*me, guid) ) - if( door->GetGoState() != GO_STATE_ACTIVE ) - { - door->SetLootState(GO_READY); - door->UseDoorOrButton(0, false); - } + void ResetGameObjects() + { + if( pInstance ) + for( uint16 i=0; i<3; ++i ) + if( uint64 guid = pInstance->GetData64(DATA_GO_MIMIRON_DOOR_1 + i) ) + if( GameObject* door = ObjectAccessor::GetGameObject(*me, guid) ) + if( door->GetGoState() != GO_STATE_ACTIVE ) + { + door->SetLootState(GO_READY); + door->UseDoorOrButton(0, false); + } - if( GameObject *elevator = me->FindNearestGameObject(GO_MIMIRON_ELEVATOR, 200.0f) ) - { - if( elevator->GetGoState() != GO_STATE_ACTIVE ) - { - elevator->SetLootState(GO_READY); - elevator->SetByteValue(GAMEOBJECT_BYTES_1, 0, GO_STATE_ACTIVE); - } - elevator->EnableCollision(false); - } + if( GameObject *elevator = me->FindNearestGameObject(GO_MIMIRON_ELEVATOR, 200.0f) ) + { + if( elevator->GetGoState() != GO_STATE_ACTIVE ) + { + elevator->SetLootState(GO_READY); + elevator->SetByteValue(GAMEOBJECT_BYTES_1, 0, GO_STATE_ACTIVE); + } + elevator->EnableCollision(false); + } - if( GameObject *button = me->FindNearestGameObject(GO_BUTTON, 200.0f) ) - if( button->GetGoState() != GO_STATE_READY ) - { - button->SetLootState(GO_READY); - button->UseDoorOrButton(0, false); - button->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); - } - } + if( GameObject *button = me->FindNearestGameObject(GO_BUTTON, 200.0f) ) + if( button->GetGoState() != GO_STATE_READY ) + { + button->SetLootState(GO_READY); + button->UseDoorOrButton(0, false); + button->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + } + } - void CloseDoorAndButton() - { - if( pInstance ) - for( uint16 i=0; i<3; ++i ) - if( uint64 guid = pInstance->GetData64(DATA_GO_MIMIRON_DOOR_1 + i) ) - if( GameObject* door = ObjectAccessor::GetGameObject(*me, guid) ) - if( door->GetGoState() != GO_STATE_READY ) - { - door->SetLootState(GO_READY); - door->UseDoorOrButton(0, false); - } + void CloseDoorAndButton() + { + if( pInstance ) + for( uint16 i=0; i<3; ++i ) + if( uint64 guid = pInstance->GetData64(DATA_GO_MIMIRON_DOOR_1 + i) ) + if( GameObject* door = ObjectAccessor::GetGameObject(*me, guid) ) + if( door->GetGoState() != GO_STATE_READY ) + { + door->SetLootState(GO_READY); + door->UseDoorOrButton(0, false); + } - if( GameObject *button = me->FindNearestGameObject(GO_BUTTON, 200.0f) ) - if( button->GetGoState() != GO_STATE_ACTIVE ) - { - button->SetLootState(GO_READY); - button->UseDoorOrButton(0, false); - } - } + if( GameObject *button = me->FindNearestGameObject(GO_BUTTON, 200.0f) ) + if( button->GetGoState() != GO_STATE_ACTIVE ) + { + button->SetLootState(GO_READY); + button->UseDoorOrButton(0, false); + } + } - void SetData(uint32 id, uint32 value) - { - switch (value) // end of phase 1-3, 4-6 for voltron - { - case 1: - events.ScheduleEvent(EVENT_LMK2_RETREAT_INTERVAL, 5000); - break; - case 2: - events.ScheduleEvent(EVENT_VX001_EMOTESTATE_DEATH, 2500); - break; - case 3: - events.ScheduleEvent(EVENT_SAY_ACU_DEAD, 5000); - break; - case 4: - case 5: - case 6: - { - Creature* LMK2 = GetLMK2(); - Creature* VX001 = GetVX001(); - Creature* ACU = GetACU(); - if (!LMK2 || !VX001 || !ACU) - { - EnterEvadeMode(); - return; - } + void SetData(uint32 id, uint32 value) + { + switch (value) // end of phase 1-3, 4-6 for voltron + { + case 1: + events.ScheduleEvent(EVENT_LMK2_RETREAT_INTERVAL, 5000); + break; + case 2: + events.ScheduleEvent(EVENT_VX001_EMOTESTATE_DEATH, 2500); + break; + case 3: + events.ScheduleEvent(EVENT_SAY_ACU_DEAD, 5000); + break; + case 4: + case 5: + case 6: + { + Creature* LMK2 = GetLMK2(); + Creature* VX001 = GetVX001(); + Creature* ACU = GetACU(); + if (!LMK2 || !VX001 || !ACU) + { + EnterEvadeMode(); + return; + } - Spell* s1 = LMK2->GetCurrentSpell(CURRENT_GENERIC_SPELL); - Spell* s2 = VX001->GetCurrentSpell(CURRENT_GENERIC_SPELL); - Spell* s3 = ACU->GetCurrentSpell(CURRENT_GENERIC_SPELL); - if (s1 && s2 && s3 && s1->GetSpellInfo()->Id == SPELL_SELF_REPAIR && s2->GetSpellInfo()->Id == SPELL_SELF_REPAIR && s3->GetSpellInfo()->Id == SPELL_SELF_REPAIR) - events.ScheduleEvent(EVENT_FINISH, 0); - } - break; - case 7: - hardmode = true; - break; - case 11: - bAchievProximityMine = true; - break; - case 12: - bAchievBombBot = true; - break; - case 13: - bAchievRocketStrike = true; - break; - } - } + Spell* s1 = LMK2->GetCurrentSpell(CURRENT_GENERIC_SPELL); + Spell* s2 = VX001->GetCurrentSpell(CURRENT_GENERIC_SPELL); + Spell* s3 = ACU->GetCurrentSpell(CURRENT_GENERIC_SPELL); + if (s1 && s2 && s3 && s1->GetSpellInfo()->Id == SPELL_SELF_REPAIR && s2->GetSpellInfo()->Id == SPELL_SELF_REPAIR && s3->GetSpellInfo()->Id == SPELL_SELF_REPAIR) + events.ScheduleEvent(EVENT_FINISH, 0); + } + break; + case 7: + hardmode = true; + break; + case 11: + bAchievProximityMine = true; + break; + case 12: + bAchievBombBot = true; + break; + case 13: + bAchievRocketStrike = true; + break; + } + } - uint32 GetData(uint32 id) const - { - switch (id) - { - case 1: return (hardmode ? 1 : 0); - case 2: return (berserk ? 1 : 0); - case 10: return allowedFlameSpreadTime; - case 11: return (bAchievProximityMine ? 1 : 0); - case 12: return (bAchievBombBot ? 1 : 0); - case 13: return (bAchievRocketStrike ? 1 : 0); - } - return 0; - } - }; + uint32 GetData(uint32 id) const + { + switch (id) + { + case 1: return (hardmode ? 1 : 0); + case 2: return (berserk ? 1 : 0); + case 10: return allowedFlameSpreadTime; + case 11: return (bAchievProximityMine ? 1 : 0); + case 12: return (bAchievBombBot ? 1 : 0); + case 13: return (bAchievRocketStrike ? 1 : 0); + } + return 0; + } + }; }; class npc_ulduar_leviathan_mkii : public CreatureScript { public: - npc_ulduar_leviathan_mkii() : CreatureScript("npc_ulduar_leviathan_mkii") { } + npc_ulduar_leviathan_mkii() : CreatureScript("npc_ulduar_leviathan_mkii") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_leviathan_mkiiAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_leviathan_mkiiAI (pCreature); + } - struct npc_ulduar_leviathan_mkiiAI : public ScriptedAI - { - npc_ulduar_leviathan_mkiiAI(Creature *pCreature) : ScriptedAI(pCreature) - { - pInstance = me->GetInstanceScript(); - bIsEvading = false; - } + struct npc_ulduar_leviathan_mkiiAI : public ScriptedAI + { + npc_ulduar_leviathan_mkiiAI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = me->GetInstanceScript(); + bIsEvading = false; + } - InstanceScript* pInstance; - EventMap events; - bool bIsEvading; - uint8 Phase; + InstanceScript* pInstance; + EventMap events; + bool bIsEvading; + uint8 Phase; - void Reset() - { - Phase = 0; - if (Unit* c = GetS3()) - c->ExitVehicle(); // this should never happen! - if (Creature* c = me->SummonCreature(NPC_LEVIATHAN_MKII_CANNON, *me, TEMPSUMMON_MANUAL_DESPAWN)) - c->EnterVehicle(me, 3); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + void Reset() + { + Phase = 0; + if (Unit* c = GetS3()) + c->ExitVehicle(); // this should never happen! + if (Creature* c = me->SummonCreature(NPC_LEVIATHAN_MKII_CANNON, *me, TEMPSUMMON_MANUAL_DESPAWN)) + c->EnterVehicle(me, 3); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - events.Reset(); - } + events.Reset(); + } - void SetData(uint32 id, uint32 value) - { - if (id == 1) // setting phase to start fighting - { - switch (value) - { - case 0: - Phase = 0; - events.Reset(); - break; - case 1: - Phase = 1; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Unit* target = SelectTargetFromPlayerList(75.0f)) - AttackStart(target); - DoZoneInCombat(); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_NAPALM_SHELL, 3000); - events.ScheduleEvent(EVENT_SPELL_PLASMA_BLAST, 10000); - events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, 20000); - events.ScheduleEvent(EVENT_PROXIMITY_MINES_1, 6000); - if (Creature* c = GetMimiron()) - if (c->AI()->GetData(1)) - events.ScheduleEvent(EVENT_FLAME_SUPPRESSION_50000, 60000); - break; - case 4: - me->SetReactState(REACT_AGGRESSIVE); - DoResetThreat(); - Phase = 4; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Unit* target = SelectTargetFromPlayerList(75.0f)) - AttackStart(target); - DoZoneInCombat(); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, 20000); - events.ScheduleEvent(EVENT_PROXIMITY_MINES_1, 6000); - break; + void SetData(uint32 id, uint32 value) + { + if (id == 1) // setting phase to start fighting + { + switch (value) + { + case 0: + Phase = 0; + events.Reset(); + break; + case 1: + Phase = 1; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (Unit* target = SelectTargetFromPlayerList(75.0f)) + AttackStart(target); + DoZoneInCombat(); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_NAPALM_SHELL, 3000); + events.ScheduleEvent(EVENT_SPELL_PLASMA_BLAST, 10000); + events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, 20000); + events.ScheduleEvent(EVENT_PROXIMITY_MINES_1, 6000); + if (Creature* c = GetMimiron()) + if (c->AI()->GetData(1)) + events.ScheduleEvent(EVENT_FLAME_SUPPRESSION_50000, 60000); + break; + case 4: + me->SetReactState(REACT_AGGRESSIVE); + DoResetThreat(); + Phase = 4; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (Unit* target = SelectTargetFromPlayerList(75.0f)) + AttackStart(target); + DoZoneInCombat(); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, 20000); + events.ScheduleEvent(EVENT_PROXIMITY_MINES_1, 6000); + break; - } - } - } + } + } + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth() || me->GetHealth() < 15000) - { - damage = 0; - if (me->GetReactState() == REACT_PASSIVE) - return; - me->SetReactState(REACT_PASSIVE); - if (Phase == 1) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->GetMotionMaster()->Clear(); - me->AttackStop(); - me->SetReactState(REACT_PASSIVE); - SetData(1, 0); - me->InterruptNonMeleeSpells(false); - me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); - if (Unit* cannon = GetS3()) - cannon->ExitVehicle(); - me->GetMotionMaster()->MoveCharge(2795.076f, 2598.616f, 364.32f, 21.0f); - if (Creature* c = GetMimiron()) - c->AI()->SetData(0, 1); - } - } - else if (Phase == 4) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->InterruptNonMeleeSpells(false); - me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); - me->CastSpell(me, SPELL_SELF_REPAIR, false); - if (Creature* c = GetMimiron()) - { - if (c->AI()->GetData(1)) - me->CastSpell(me, SPELL_EMERGENCY_MODE, true); - if (c->AI()->GetData(2)) - me->CastSpell(me, SPELL_BERSERK, true); - c->AI()->SetData(0, 4); - } - } - } - } - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth() || me->GetHealth() < 15000) + { + damage = 0; + if (me->GetReactState() == REACT_PASSIVE) + return; + me->SetReactState(REACT_PASSIVE); + if (Phase == 1) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->Clear(); + me->AttackStop(); + me->SetReactState(REACT_PASSIVE); + SetData(1, 0); + me->InterruptNonMeleeSpells(false); + me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); + if (Unit* cannon = GetS3()) + cannon->ExitVehicle(); + me->GetMotionMaster()->MoveCharge(2795.076f, 2598.616f, 364.32f, 21.0f); + if (Creature* c = GetMimiron()) + c->AI()->SetData(0, 1); + } + } + else if (Phase == 4) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->InterruptNonMeleeSpells(false); + me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); + me->CastSpell(me, SPELL_SELF_REPAIR, false); + if (Creature* c = GetMimiron()) + { + if (c->AI()->GetData(1)) + me->CastSpell(me, SPELL_EMERGENCY_MODE, true); + if (c->AI()->GetData(2)) + me->CastSpell(me, SPELL_BERSERK, true); + c->AI()->SetData(0, 4); + } + } + } + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (!me->HasUnitState(UNIT_STATE_CASTING)) - DoMeleeAttackIfReady(); + if (!me->HasUnitState(UNIT_STATE_CASTING)) + DoMeleeAttackIfReady(); - Unit* cannon = GetS3(); - if (!cannon || cannon->HasUnitState(UNIT_STATE_CASTING) || me->HasUnitState(UNIT_STATE_CASTING) || me->HasAuraType(SPELL_AURA_MOD_SILENCE)) - return; + Unit* cannon = GetS3(); + if (!cannon || cannon->HasUnitState(UNIT_STATE_CASTING) || me->HasUnitState(UNIT_STATE_CASTING) || me->HasAuraType(SPELL_AURA_MOD_SILENCE)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_NAPALM_SHELL: - { - Player* pTarget = NULL; - std::vector pList; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if (Player* plr = itr->GetSource()) - if( plr->IsAlive() && plr->GetDistance2d(me) > 15.0f ) - pList.push_back(plr); + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_NAPALM_SHELL: + { + Player* pTarget = NULL; + std::vector pList; + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if (Player* plr = itr->GetSource()) + if( plr->IsAlive() && plr->GetDistance2d(me) > 15.0f ) + pList.push_back(plr); - if (!pList.empty()) - pTarget = pList[urand(0, pList.size()-1)]; - else - pTarget = (Player*)SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true); + if (!pList.empty()) + pTarget = pList[urand(0, pList.size()-1)]; + else + pTarget = (Player*)SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true); - if( pTarget ) - cannon->CastSpell(pTarget, SPELL_NAPALM_SHELL, false); + if( pTarget ) + cannon->CastSpell(pTarget, SPELL_NAPALM_SHELL, false); - events.RepeatEvent(14000); - } - break; - case EVENT_SPELL_PLASMA_BLAST: - if (Unit* victim = me->GetVictim()) - { - me->MonsterTextEmote("Leviathan Mk II begins to cast Plasma Blast!", 0, true); - cannon->CastSpell(victim, SPELL_PLASMA_BLAST, false); - } - events.RepeatEvent(22000); - break; - case EVENT_SPELL_SHOCK_BLAST: - me->CastSpell(me->GetVictim(), SPELL_SHOCK_BLAST, false); - events.RepeatEvent(30000); - events.ScheduleEvent(EVENT_PROXIMITY_MINES_1, 8000); - break; - case EVENT_PROXIMITY_MINES_1: - { - float angle = rand_norm()*2*M_PI; - float x,y,z; - me->GetPosition(x,y,z); - for( uint8 i=0; i<17; ++i ) - { - if( i == 7 ) - continue; + events.RepeatEvent(14000); + } + break; + case EVENT_SPELL_PLASMA_BLAST: + if (Unit* victim = me->GetVictim()) + { + me->MonsterTextEmote("Leviathan Mk II begins to cast Plasma Blast!", 0, true); + cannon->CastSpell(victim, SPELL_PLASMA_BLAST, false); + } + events.RepeatEvent(22000); + break; + case EVENT_SPELL_SHOCK_BLAST: + me->CastSpell(me->GetVictim(), SPELL_SHOCK_BLAST, false); + events.RepeatEvent(30000); + events.ScheduleEvent(EVENT_PROXIMITY_MINES_1, 8000); + break; + case EVENT_PROXIMITY_MINES_1: + { + float angle = rand_norm()*2*M_PI; + float x,y,z; + me->GetPosition(x,y,z); + for( uint8 i=0; i<17; ++i ) + { + if( i == 7 ) + continue; - float v_xmin = 0.1f * cos( angle + i*M_PI/9 ); - float v_ymin = 0.1f * sin( angle + i*M_PI/9 ); - if( Creature* pmNPC = me->SummonCreature(NPC_PROXIMITY_MINE, x+v_xmin, y+v_ymin, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 40000) ) - pmNPC->KnockbackFrom(x, y, 6.0f, 25.0f); - } + float v_xmin = 0.1f * cos( angle + i*M_PI/9 ); + float v_ymin = 0.1f * sin( angle + i*M_PI/9 ); + if( Creature* pmNPC = me->SummonCreature(NPC_PROXIMITY_MINE, x+v_xmin, y+v_ymin, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 40000) ) + pmNPC->KnockbackFrom(x, y, 6.0f, 25.0f); + } - events.PopEvent(); - } - break; - case EVENT_FLAME_SUPPRESSION_50000: - me->CastSpell(me, SPELL_FLAME_SUPPRESSANT_50000yd, false); - events.PopEvent(); - break; - } - } + events.PopEvent(); + } + break; + case EVENT_FLAME_SUPPRESSION_50000: + me->CastSpell(me, SPELL_FLAME_SUPPRESSANT_50000yd, false); + events.PopEvent(); + break; + } + } - void MoveInLineOfSight(Unit* /*mover*/) {} + void MoveInLineOfSight(Unit* /*mover*/) {} - void KilledUnit(Unit* who) - { - if( who->GetTypeId() == TYPEID_PLAYER ) - if (Creature* c = GetMimiron()) - { - if( Phase == 1 ) - { - if( rand()%2 ) - { - c->MonsterYell(TEXT_LMK2_SLAIN_1, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_TANK_SLAY_1); - } - else - { - c->MonsterYell(TEXT_LMK2_SLAIN_2, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_TANK_SLAY_2); - } - } - else - { - if( rand()%2 ) - { - c->MonsterYell(TEXT_VOLTRON_SLAIN_1, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_VOLTRON_SLAY_1); - } - else - { - c->MonsterYell(TEXT_VOLTRON_SLAIN_2, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_VOLTRON_SLAY_2); - } - } - } - } + void KilledUnit(Unit* who) + { + if( who->GetTypeId() == TYPEID_PLAYER ) + if (Creature* c = GetMimiron()) + { + if( Phase == 1 ) + { + if( rand()%2 ) + { + c->MonsterYell(TEXT_LMK2_SLAIN_1, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_TANK_SLAY_1); + } + else + { + c->MonsterYell(TEXT_LMK2_SLAIN_2, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_TANK_SLAY_2); + } + } + else + { + if( rand()%2 ) + { + c->MonsterYell(TEXT_VOLTRON_SLAIN_1, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_VOLTRON_SLAY_1); + } + else + { + c->MonsterYell(TEXT_VOLTRON_SLAIN_2, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_VOLTRON_SLAY_2); + } + } + } + } - void EnterEvadeMode() - { - if (bIsEvading) - return; - bIsEvading = true; + void EnterEvadeMode() + { + if (bIsEvading) + return; + bIsEvading = true; - me->RemoveAllAuras(); - me->ExitVehicle(); - ScriptedAI::EnterEvadeMode(); + me->RemoveAllAuras(); + me->ExitVehicle(); + ScriptedAI::EnterEvadeMode(); - if (Creature* mimiron = GetMimiron()) - mimiron->AI()->EnterEvadeMode(); + if (Creature* mimiron = GetMimiron()) + mimiron->AI()->EnterEvadeMode(); - bIsEvading = false; - } + bIsEvading = false; + } - void PassengerBoarded(Unit* p, int8 seat, bool apply) - { - if (p->GetEntry() == NPC_LEVIATHAN_MKII_CANNON && !apply) - { - Unit::Kill(p, p); - p->ToCreature()->DespawnOrUnsummon(6000); - } - } + void PassengerBoarded(Unit* p, int8 seat, bool apply) + { + if (p->GetEntry() == NPC_LEVIATHAN_MKII_CANNON && !apply) + { + Unit::Kill(p, p); + p->ToCreature()->DespawnOrUnsummon(6000); + } + } - Unit* GetS3() - { - if (Vehicle* vk = me->GetVehicleKit()) - if (Unit* cannon = vk->GetPassenger(3)) - return cannon; + Unit* GetS3() + { + if (Vehicle* vk = me->GetVehicleKit()) + if (Unit* cannon = vk->GetPassenger(3)) + return cannon; - return 0; - } + return 0; + } - void SpellHit(Unit* caster, const SpellInfo *spell) - { - if( spell->Id == SPELL_SELF_REPAIR ) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - } - } - }; + void SpellHit(Unit* caster, const SpellInfo *spell) + { + if( spell->Id == SPELL_SELF_REPAIR ) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + } + } + }; }; class npc_ulduar_vx001 : public CreatureScript { public: - npc_ulduar_vx001() : CreatureScript("npc_ulduar_vx001") { } + npc_ulduar_vx001() : CreatureScript("npc_ulduar_vx001") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_vx001AI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_vx001AI (pCreature); + } - struct npc_ulduar_vx001AI : public ScriptedAI - { - npc_ulduar_vx001AI(Creature *pCreature) : ScriptedAI(pCreature) - { - pInstance = me->GetInstanceScript(); - bIsEvading = false; - } + struct npc_ulduar_vx001AI : public ScriptedAI + { + npc_ulduar_vx001AI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = me->GetInstanceScript(); + bIsEvading = false; + } - InstanceScript* pInstance; - EventMap events; - bool bIsEvading; - uint8 Phase; - bool fighting; - bool leftarm; - uint32 spinningUpOrientation; - uint16 spinningUpTimer; + InstanceScript* pInstance; + EventMap events; + bool bIsEvading; + uint8 Phase; + bool fighting; + bool leftarm; + uint32 spinningUpOrientation; + uint16 spinningUpTimer; - void Reset() - { - Phase = 0; - fighting = false; - leftarm = false; - spinningUpTimer = 0; - me->SetRegeneratingHealth(false); - events.Reset(); - } + void Reset() + { + Phase = 0; + fighting = false; + leftarm = false; + spinningUpTimer = 0; + me->SetRegeneratingHealth(false); + events.Reset(); + } - void AttackStart(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} - void SetData(uint32 id, uint32 value) - { - if (id == 1) // setting phase to start fighting - { - switch (value) - { - case 0: - Phase = 0; - fighting = false; - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - events.Reset(); - break; - case 2: - Phase = 2; - fighting = true; - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SPELL_CAST_OMNI); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_HEAT_WAVE, 10000); - events.ScheduleEvent(EVENT_SPELL_ROCKET_STRIKE, 16000); - events.ScheduleEvent(EVENT_SPELL_RAPID_BURST, 0); - events.ScheduleEvent(EVENT_SPELL_SPINNING_UP, 30000); - events.ScheduleEvent(EVENT_REINSTALL_ROCKETS, 3000); - if (Creature* c = GetMimiron()) - if (c->AI()->GetData(1)) - { - events.ScheduleEvent(EVENT_FLAME_SUPPRESSION_10, 7000); - events.ScheduleEvent(EVENT_FROST_BOMB, 1000); - } - break; - case 4: - Phase = 4; - fighting = true; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - events.Reset(); - events.ScheduleEvent(EVENT_REINSTALL_ROCKETS, 3000); - events.ScheduleEvent(EVENT_SPELL_ROCKET_STRIKE, 16000); - events.ScheduleEvent(EVENT_HAND_PULSE, 1); - //events.ScheduleEvent(EVENT_SPELL_SPINNING_UP, 30000); - if (Creature* c = GetMimiron()) - if (c->AI()->GetData(1)) - events.ScheduleEvent(EVENT_FROST_BOMB, 1000); - break; - } - } - } + void SetData(uint32 id, uint32 value) + { + if (id == 1) // setting phase to start fighting + { + switch (value) + { + case 0: + Phase = 0; + fighting = false; + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + events.Reset(); + break; + case 2: + Phase = 2; + fighting = true; + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SPELL_CAST_OMNI); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_HEAT_WAVE, 10000); + events.ScheduleEvent(EVENT_SPELL_ROCKET_STRIKE, 16000); + events.ScheduleEvent(EVENT_SPELL_RAPID_BURST, 0); + events.ScheduleEvent(EVENT_SPELL_SPINNING_UP, 30000); + events.ScheduleEvent(EVENT_REINSTALL_ROCKETS, 3000); + if (Creature* c = GetMimiron()) + if (c->AI()->GetData(1)) + { + events.ScheduleEvent(EVENT_FLAME_SUPPRESSION_10, 7000); + events.ScheduleEvent(EVENT_FROST_BOMB, 1000); + } + break; + case 4: + Phase = 4; + fighting = true; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + events.Reset(); + events.ScheduleEvent(EVENT_REINSTALL_ROCKETS, 3000); + events.ScheduleEvent(EVENT_SPELL_ROCKET_STRIKE, 16000); + events.ScheduleEvent(EVENT_HAND_PULSE, 1); + //events.ScheduleEvent(EVENT_SPELL_SPINNING_UP, 30000); + if (Creature* c = GetMimiron()) + if (c->AI()->GetData(1)) + events.ScheduleEvent(EVENT_FROST_BOMB, 1000); + break; + } + } + } - uint32 GetData(uint32 id) const - { - return spinningUpOrientation; - } + uint32 GetData(uint32 id) const + { + return spinningUpOrientation; + } - void DoAction(int32 action) - { - if (action == 1337) - if( Vehicle* vk = me->GetVehicleKit() ) - for (uint8 i=0; i<2; ++i) - if (Unit* r = vk->GetPassenger(5+i)) - if (r->GetTypeId() == TYPEID_UNIT) - r->ToCreature()->DespawnOrUnsummon(1); - } + void DoAction(int32 action) + { + if (action == 1337) + if( Vehicle* vk = me->GetVehicleKit() ) + for (uint8 i=0; i<2; ++i) + if (Unit* r = vk->GetPassenger(5+i)) + if (r->GetTypeId() == TYPEID_UNIT) + r->ToCreature()->DespawnOrUnsummon(1); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth() || me->GetHealth() < 15000) - { - damage = 0; - if (me->GetReactState() == REACT_PASSIVE) - return; - me->SetReactState(REACT_PASSIVE); - if (Phase == 2) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - SetData(1, 0); - me->InterruptNonMeleeSpells(false); - me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); - me->SendMeleeAttackStop(); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CUSTOM_SPELL_06); - me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_06); - if (Creature* c = GetMimiron()) - c->AI()->SetData(0, 2); - } - } - else if (Phase == 4) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->InterruptNonMeleeSpells(false); - me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); - me->CastSpell(me, SPELL_SELF_REPAIR, false); - if (Creature* c = GetMimiron()) - { - if (c->AI()->GetData(1)) - me->CastSpell(me, SPELL_EMERGENCY_MODE, true); - if (c->AI()->GetData(2)) - me->CastSpell(me, SPELL_BERSERK, true); - c->AI()->SetData(0, 5); - } - } - } - } - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth() || me->GetHealth() < 15000) + { + damage = 0; + if (me->GetReactState() == REACT_PASSIVE) + return; + me->SetReactState(REACT_PASSIVE); + if (Phase == 2) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + SetData(1, 0); + me->InterruptNonMeleeSpells(false); + me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); + me->SendMeleeAttackStop(); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CUSTOM_SPELL_06); + me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_06); + if (Creature* c = GetMimiron()) + c->AI()->SetData(0, 2); + } + } + else if (Phase == 4) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->InterruptNonMeleeSpells(false); + me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); + me->CastSpell(me, SPELL_SELF_REPAIR, false); + if (Creature* c = GetMimiron()) + { + if (c->AI()->GetData(1)) + me->CastSpell(me, SPELL_EMERGENCY_MODE, true); + if (c->AI()->GetData(2)) + me->CastSpell(me, SPELL_BERSERK, true); + c->AI()->SetData(0, 5); + } + } + } + } + } - void UpdateAI(uint32 diff) - { - if (!fighting) - return; + void UpdateAI(uint32 diff) + { + if (!fighting) + return; - events.Update(diff); + events.Update(diff); - if (spinningUpTimer) // executed about a second after starting casting to ensure players can see the correct direction - { - if (spinningUpTimer <= diff) - { - float angle = (spinningUpOrientation*2*M_PI)/100.0f; - me->SetOrientation(angle); - me->SetFacingTo(angle); - spinningUpTimer = 0; - } - else - spinningUpTimer -= diff; - } + if (spinningUpTimer) // executed about a second after starting casting to ensure players can see the correct direction + { + if (spinningUpTimer <= diff) + { + float angle = (spinningUpOrientation*2*M_PI)/100.0f; + me->SetOrientation(angle); + me->SetFacingTo(angle); + spinningUpTimer = 0; + } + else + spinningUpTimer -= diff; + } - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_HEAT_WAVE: - me->CastSpell(me, SPELL_HEAT_WAVE, true); - events.RepeatEvent(10000); - break; - case EVENT_SPELL_ROCKET_STRIKE: - if( Vehicle* vk = me->GetVehicleKit() ) - { - for( int i=0; i<(Phase/2); ++i ) - { - uint8 index = (Phase == 2 ? rand()%2 : i); - if( Unit* r = vk->GetPassenger(5 + index) ) - if (Player* temp = SelectTargetFromPlayerList(100.0f)) - { - if( Creature* trigger = me->SummonCreature(NPC_ROCKET_STRIKE_N, temp->GetPositionX(), temp->GetPositionY(), temp->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 6000) ) - trigger->CastSpell(trigger, SPELL_ROCKET_STRIKE_AURA, true); - Position exitPos; - r->GetPosition(&exitPos); - exitPos.m_positionX += cos(me->GetOrientation())*2.35f; - exitPos.m_positionY += sin(me->GetOrientation())*2.35f; - exitPos.m_positionZ += 2.0f*Phase; - r->_ExitVehicle(&exitPos); - me->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, r->GetGUID()); - if (r->GetTypeId() == TYPEID_UNIT) - r->ToCreature()->AI()->SetData(0, 0); - } - } - events.RepeatEvent(20000); - events.ScheduleEvent(EVENT_REINSTALL_ROCKETS, 10000); - } - break; - case EVENT_REINSTALL_ROCKETS: - if (Vehicle* vk = me->GetVehicleKit()) - { - for (uint8 i=5; i<=6; ++i) - if (!vk->GetPassenger(i)) - if (TempSummon* accessory = me->SummonCreature(NPC_ROCKET_VISUAL, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+4.0f, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN)) - if (!me->HandleSpellClick(accessory, i)) - accessory->UnSummon(); - } - events.PopEvent(); - break; - case EVENT_SPELL_RAPID_BURST: - if (Player* p = SelectTargetFromPlayerList(80.0f)) - { - me->CastSpell(p, SPELL_RAPID_BURST, true); - me->SetFacingToObject(p); - } - events.RepeatEvent(3200); - break; - case EVENT_HAND_PULSE: - if (Player* p = SelectTargetFromPlayerList(80.0f)) - { - me->SetOrientation(me->GetAngle(p)); - me->SetFacingTo(me->GetAngle(p)); - if (Unit* vb = me->GetVehicleBase()) - { - vb->SendMeleeAttackStop(); - vb->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_01); - if( !leftarm ) - { - vb->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_03); - me->CastSpell(p, SPELL_HAND_PULSE_R, false); - } - else - { - vb->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_04); - me->CastSpell(p, SPELL_HAND_PULSE_L, false); - } - } + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_HEAT_WAVE: + me->CastSpell(me, SPELL_HEAT_WAVE, true); + events.RepeatEvent(10000); + break; + case EVENT_SPELL_ROCKET_STRIKE: + if( Vehicle* vk = me->GetVehicleKit() ) + { + for( int i=0; i<(Phase/2); ++i ) + { + uint8 index = (Phase == 2 ? rand()%2 : i); + if( Unit* r = vk->GetPassenger(5 + index) ) + if (Player* temp = SelectTargetFromPlayerList(100.0f)) + { + if( Creature* trigger = me->SummonCreature(NPC_ROCKET_STRIKE_N, temp->GetPositionX(), temp->GetPositionY(), temp->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 6000) ) + trigger->CastSpell(trigger, SPELL_ROCKET_STRIKE_AURA, true); + Position exitPos; + r->GetPosition(&exitPos); + exitPos.m_positionX += cos(me->GetOrientation())*2.35f; + exitPos.m_positionY += sin(me->GetOrientation())*2.35f; + exitPos.m_positionZ += 2.0f*Phase; + r->_ExitVehicle(&exitPos); + me->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, r->GetGUID()); + if (r->GetTypeId() == TYPEID_UNIT) + r->ToCreature()->AI()->SetData(0, 0); + } + } + events.RepeatEvent(20000); + events.ScheduleEvent(EVENT_REINSTALL_ROCKETS, 10000); + } + break; + case EVENT_REINSTALL_ROCKETS: + if (Vehicle* vk = me->GetVehicleKit()) + { + for (uint8 i=5; i<=6; ++i) + if (!vk->GetPassenger(i)) + if (TempSummon* accessory = me->SummonCreature(NPC_ROCKET_VISUAL, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+4.0f, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN)) + if (!me->HandleSpellClick(accessory, i)) + accessory->UnSummon(); + } + events.PopEvent(); + break; + case EVENT_SPELL_RAPID_BURST: + if (Player* p = SelectTargetFromPlayerList(80.0f)) + { + me->CastSpell(p, SPELL_RAPID_BURST, true); + me->SetFacingToObject(p); + } + events.RepeatEvent(3200); + break; + case EVENT_HAND_PULSE: + if (Player* p = SelectTargetFromPlayerList(80.0f)) + { + me->SetOrientation(me->GetAngle(p)); + me->SetFacingTo(me->GetAngle(p)); + if (Unit* vb = me->GetVehicleBase()) + { + vb->SendMeleeAttackStop(); + vb->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_01); + if( !leftarm ) + { + vb->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_03); + me->CastSpell(p, SPELL_HAND_PULSE_R, false); + } + else + { + vb->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_04); + me->CastSpell(p, SPELL_HAND_PULSE_L, false); + } + } - leftarm = !leftarm; - } - events.RepeatEvent(1750); - break; - case EVENT_SPELL_SPINNING_UP: - events.RepeatEvent(45000); - if (Player* p = SelectTargetFromPlayerList(80.0f)) - { - float angle = me->GetAngle(p); - spinningUpOrientation = (uint32)((angle*100.0f)/(2*M_PI)); - spinningUpTimer = 1500; - me->SetOrientation(angle); - me->SetFacingTo(angle); - me->CastSpell(p, SPELL_SPINNING_UP, true); - events.RescheduleEvent((Phase == 2 ? EVENT_SPELL_RAPID_BURST : EVENT_HAND_PULSE), 14500); - } - break; - case EVENT_FLAME_SUPPRESSION_10: - me->CastSpell(me, SPELL_FLAME_SUPPRESSANT_10yd, false); - events.RepeatEvent(10000); - break; - case EVENT_FROST_BOMB: - me->CastCustomSpell(SPELL_VX001_FROST_BOMB, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, false); - events.RepeatEvent(45000); - break; - } - } + leftarm = !leftarm; + } + events.RepeatEvent(1750); + break; + case EVENT_SPELL_SPINNING_UP: + events.RepeatEvent(45000); + if (Player* p = SelectTargetFromPlayerList(80.0f)) + { + float angle = me->GetAngle(p); + spinningUpOrientation = (uint32)((angle*100.0f)/(2*M_PI)); + spinningUpTimer = 1500; + me->SetOrientation(angle); + me->SetFacingTo(angle); + me->CastSpell(p, SPELL_SPINNING_UP, true); + events.RescheduleEvent((Phase == 2 ? EVENT_SPELL_RAPID_BURST : EVENT_HAND_PULSE), 14500); + } + break; + case EVENT_FLAME_SUPPRESSION_10: + me->CastSpell(me, SPELL_FLAME_SUPPRESSANT_10yd, false); + events.RepeatEvent(10000); + break; + case EVENT_FROST_BOMB: + me->CastCustomSpell(SPELL_VX001_FROST_BOMB, SPELLVALUE_MAX_TARGETS, 1, (Unit*)NULL, false); + events.RepeatEvent(45000); + break; + } + } - void MoveInLineOfSight(Unit* /*mover*/) {} + void MoveInLineOfSight(Unit* /*mover*/) {} - void KilledUnit(Unit* who) - { - if( who->GetTypeId() == TYPEID_PLAYER ) - if( Creature* c = GetMimiron() ) - { - if( Phase == 2 ) - { - if( rand()%2 ) - { - c->MonsterYell(TEXT_VX001_SLAIN_1, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_TORSO_SLAY_1); - } - else - { - c->MonsterYell(TEXT_VX001_SLAIN_2, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_TORSO_SLAY_2); - } - } - else - { - if( rand()%2 ) - { - c->MonsterYell(TEXT_VOLTRON_SLAIN_1, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_VOLTRON_SLAY_1); - } - else - { - c->MonsterYell(TEXT_VOLTRON_SLAIN_2, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_VOLTRON_SLAY_2); - } - } - } - } + void KilledUnit(Unit* who) + { + if( who->GetTypeId() == TYPEID_PLAYER ) + if( Creature* c = GetMimiron() ) + { + if( Phase == 2 ) + { + if( rand()%2 ) + { + c->MonsterYell(TEXT_VX001_SLAIN_1, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_TORSO_SLAY_1); + } + else + { + c->MonsterYell(TEXT_VX001_SLAIN_2, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_TORSO_SLAY_2); + } + } + else + { + if( rand()%2 ) + { + c->MonsterYell(TEXT_VOLTRON_SLAIN_1, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_VOLTRON_SLAY_1); + } + else + { + c->MonsterYell(TEXT_VOLTRON_SLAIN_2, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_VOLTRON_SLAY_2); + } + } + } + } - void EnterEvadeMode() - { - if (bIsEvading) - return; - bIsEvading = true; + void EnterEvadeMode() + { + if (bIsEvading) + return; + bIsEvading = true; - me->RemoveAllAuras(); - me->ExitVehicle(); - _EnterEvadeMode(); - Reset(); - if (Creature* mimiron = GetMimiron()) - mimiron->AI()->EnterEvadeMode(); + me->RemoveAllAuras(); + me->ExitVehicle(); + _EnterEvadeMode(); + Reset(); + if (Creature* mimiron = GetMimiron()) + mimiron->AI()->EnterEvadeMode(); - bIsEvading = false; - } + bIsEvading = false; + } - void PassengerBoarded(Unit* p, int8 seat, bool apply) - { - if (p->GetEntry() == NPC_ROCKET_VISUAL && !apply) - p->ToCreature()->DespawnOrUnsummon(8000); - } + void PassengerBoarded(Unit* p, int8 seat, bool apply) + { + if (p->GetEntry() == NPC_ROCKET_VISUAL && !apply) + p->ToCreature()->DespawnOrUnsummon(8000); + } - void SpellHit(Unit* caster, const SpellInfo *spell) - { - if( spell->Id == SPELL_SELF_REPAIR ) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - } - } - }; + void SpellHit(Unit* caster, const SpellInfo *spell) + { + if( spell->Id == SPELL_SELF_REPAIR ) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + } + } + }; }; class npc_ulduar_aerial_command_unit : public CreatureScript { public: - npc_ulduar_aerial_command_unit() : CreatureScript("npc_ulduar_aerial_command_unit") { } + npc_ulduar_aerial_command_unit() : CreatureScript("npc_ulduar_aerial_command_unit") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_aerial_command_unitAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_aerial_command_unitAI (pCreature); + } - struct npc_ulduar_aerial_command_unitAI : public ScriptedAI - { - npc_ulduar_aerial_command_unitAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) - { - pInstance = me->GetInstanceScript(); - bIsEvading = false; - immobilized = false; - me->SetDisableGravity(true); - } + struct npc_ulduar_aerial_command_unitAI : public ScriptedAI + { + npc_ulduar_aerial_command_unitAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) + { + pInstance = me->GetInstanceScript(); + bIsEvading = false; + immobilized = false; + me->SetDisableGravity(true); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - bool bIsEvading; - uint8 Phase; - bool immobilized; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + bool bIsEvading; + uint8 Phase; + bool immobilized; - void Reset() - { - Phase = 0; - events.Reset(); - summons.DespawnAll(); - } + void Reset() + { + Phase = 0; + events.Reset(); + summons.DespawnAll(); + } - void AttackStart(Unit* who) - { - if (who) - me->Attack(who, true); // skip following - } + void AttackStart(Unit* who) + { + if (who) + me->Attack(who, true); // skip following + } - void SetData(uint32 id, uint32 value) - { - if (id == 1) // setting phase to start fighting - { - switch (value) - { - case 0: - Phase = 0; - events.Reset(); - immobilized = false; - break; - case 3: - Phase = 3; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Unit* target = SelectTargetFromPlayerList(75.0f)) - AttackStart(target); - DoZoneInCombat(); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_PLASMA_BALL, 0); - events.ScheduleEvent(EVENT_SUMMON_BOMB_BOT, 15000); - events.ScheduleEvent(EVENT_SUMMON_ASSAULT_BOT, 1000); - events.ScheduleEvent(EVENT_SUMMON_JUNK_BOT, 10000); - if (Creature* c = GetMimiron()) - if (c->AI()->GetData(1)) - events.ScheduleEvent(EVENT_SUMMON_EMERGENCY_FIRE_BOTS, 0); - break; - case 4: - me->SetReactState(REACT_AGGRESSIVE); - DoResetThreat(); - Phase = 4; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Unit* target = SelectTargetFromPlayerList(75.0f)) - AttackStart(target); - DoZoneInCombat(); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_PLASMA_BALL, 0); + void SetData(uint32 id, uint32 value) + { + if (id == 1) // setting phase to start fighting + { + switch (value) + { + case 0: + Phase = 0; + events.Reset(); + immobilized = false; + break; + case 3: + Phase = 3; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (Unit* target = SelectTargetFromPlayerList(75.0f)) + AttackStart(target); + DoZoneInCombat(); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_PLASMA_BALL, 0); + events.ScheduleEvent(EVENT_SUMMON_BOMB_BOT, 15000); + events.ScheduleEvent(EVENT_SUMMON_ASSAULT_BOT, 1000); + events.ScheduleEvent(EVENT_SUMMON_JUNK_BOT, 10000); + if (Creature* c = GetMimiron()) + if (c->AI()->GetData(1)) + events.ScheduleEvent(EVENT_SUMMON_EMERGENCY_FIRE_BOTS, 0); + break; + case 4: + me->SetReactState(REACT_AGGRESSIVE); + DoResetThreat(); + Phase = 4; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (Unit* target = SelectTargetFromPlayerList(75.0f)) + AttackStart(target); + DoZoneInCombat(); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_PLASMA_BALL, 0); - } - } - else if (id == 2 && !immobilized && Phase == 3) // magnetic core - { - immobilized = true; - events.ScheduleEvent(EVENT_MAGNETIC_CORE_PULL_DOWN, 2000); - } - } + } + } + else if (id == 2 && !immobilized && Phase == 3) // magnetic core + { + immobilized = true; + events.ScheduleEvent(EVENT_MAGNETIC_CORE_PULL_DOWN, 2000); + } + } - void DoAction(int32 param) - { - if (param == 1337) - summons.DespawnAll(); - } + void DoAction(int32 param) + { + if (param == 1337) + summons.DespawnAll(); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth() || me->GetHealth() < 15000) - { - damage = 0; - if (me->GetReactState() == REACT_PASSIVE) - return; - me->SetReactState(REACT_PASSIVE); - if (Phase == 3) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->GetMotionMaster()->Clear(); - me->StopMoving(); - me->AttackStop(); - me->SetReactState(REACT_PASSIVE); - SetData(1, 0); - me->InterruptNonMeleeSpells(false); - me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth() || me->GetHealth() < 15000) + { + damage = 0; + if (me->GetReactState() == REACT_PASSIVE) + return; + me->SetReactState(REACT_PASSIVE); + if (Phase == 3) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->Clear(); + me->StopMoving(); + me->AttackStop(); + me->SetReactState(REACT_PASSIVE); + SetData(1, 0); + me->InterruptNonMeleeSpells(false); + me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); - me->MonsterMoveWithSpeed(2744.65f, 2569.46f, 381.34f, me->GetDistance(2744.65f, 2569.46f, 381.34f)); - me->UpdatePosition(2744.65f, 2569.46f, 381.34f, M_PI, false); + me->MonsterMoveWithSpeed(2744.65f, 2569.46f, 381.34f, me->GetDistance(2744.65f, 2569.46f, 381.34f)); + me->UpdatePosition(2744.65f, 2569.46f, 381.34f, M_PI, false); - if (Creature* c = GetMimiron()) - c->AI()->SetData(0, 3); - } - } - else if (Phase == 4) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->InterruptNonMeleeSpells(false); - me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); - me->CastSpell(me, SPELL_SELF_REPAIR, false); - if (Creature* c = GetMimiron()) - { - if (c->AI()->GetData(1)) - me->CastSpell(me, SPELL_EMERGENCY_MODE, true); - if (c->AI()->GetData(2)) - me->CastSpell(me, SPELL_BERSERK, true); - c->AI()->SetData(0, 6); - } - } - } - } - } + if (Creature* c = GetMimiron()) + c->AI()->SetData(0, 3); + } + } + else if (Phase == 4) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->InterruptNonMeleeSpells(false); + me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); + me->CastSpell(me, SPELL_SELF_REPAIR, false); + if (Creature* c = GetMimiron()) + { + if (c->AI()->GetData(1)) + me->CastSpell(me, SPELL_EMERGENCY_MODE, true); + if (c->AI()->GetData(2)) + me->CastSpell(me, SPELL_BERSERK, true); + c->AI()->SetData(0, 6); + } + } + } + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - // following :D - if( Phase == 3 && !immobilized ) - if( Unit* victim = me->GetVictim() ) - if( me->GetExactDist2d(victim) > 25.0f ) - { - float angle = victim->GetAngle(me->GetPositionX(), me->GetPositionY()); - me->SetOrientation( me->GetAngle(victim->GetPositionX(), victim->GetPositionY()) ); - float x = victim->GetPositionX() + 15.0f*cos(angle); - float y = victim->GetPositionY() + 15.0f*sin(angle); + // following :D + if( Phase == 3 && !immobilized ) + if( Unit* victim = me->GetVictim() ) + if( me->GetExactDist2d(victim) > 25.0f ) + { + float angle = victim->GetAngle(me->GetPositionX(), me->GetPositionY()); + me->SetOrientation( me->GetAngle(victim->GetPositionX(), victim->GetPositionY()) ); + float x = victim->GetPositionX() + 15.0f*cos(angle); + float y = victim->GetPositionY() + 15.0f*sin(angle); - // check if there's magnetic core in line of movement - Creature* mc = NULL; - std::list cl; - me->GetCreaturesWithEntryInRange(cl, me->GetExactDist2d(victim), NPC_MAGNETIC_CORE); - for( std::list::iterator itr = cl.begin(); itr != cl.end(); ++itr ) - { - if ((*itr)->IsInBetween(me, victim, 4.0f) && (*itr)->GetExactDist2d(victim) >= 10.0f) // don't come very close just because there's a magnetic core - { - x = (*itr)->GetPositionX(); - y = (*itr)->GetPositionY(); - mc = (*itr); - break; - } - } + // check if there's magnetic core in line of movement + Creature* mc = NULL; + std::list cl; + me->GetCreaturesWithEntryInRange(cl, me->GetExactDist2d(victim), NPC_MAGNETIC_CORE); + for( std::list::iterator itr = cl.begin(); itr != cl.end(); ++itr ) + { + if ((*itr)->IsInBetween(me, victim, 4.0f) && (*itr)->GetExactDist2d(victim) >= 10.0f) // don't come very close just because there's a magnetic core + { + x = (*itr)->GetPositionX(); + y = (*itr)->GetPositionY(); + mc = (*itr); + break; + } + } - float speed = me->GetExactDist(x, y, 381.34f); - me->MonsterMoveWithSpeed(x, y, 381.34f, speed); - me->UpdatePosition(x, y, 381.34f, me->GetAngle(victim), false); - if (mc) - { - mc->AI()->SetData(0, 0); - SetData(2, 1); - } - } + float speed = me->GetExactDist(x, y, 381.34f); + me->MonsterMoveWithSpeed(x, y, 381.34f, speed); + me->UpdatePosition(x, y, 381.34f, me->GetAngle(victim), false); + if (mc) + { + mc->AI()->SetData(0, 0); + SetData(2, 1); + } + } - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_PLASMA_BALL: - if( !immobilized ) - { - if (Phase == 3) - { - if( Unit* victim = me->GetVictim() ) - me->CastSpell(victim, SPELL_PLASMA_BALL, false); - } - else - { - if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 27.5f, true)) - { - me->SetFacingTo(me->GetAngle(victim)); - me->CastSpell(victim, SPELL_PLASMA_BALL, false); - } - } - } - events.RepeatEvent(3000); - break; - case EVENT_SUMMON_BOMB_BOT: - if( !immobilized ) - me->CastSpell(me, SPELL_SUMMON_BOMB_BOT, false); - events.RepeatEvent(15000); - break; - case EVENT_SUMMON_ASSAULT_BOT: - if( GameObject* pad = me->FindNearestGameObject(RAND(194742, 194746, 194745), 200.0f) ) - if (Creature* trigger = me->SummonCreature(NPC_BOT_SUMMON_TRIGGER, *pad, TEMPSUMMON_TIMED_DESPAWN, 15000)) - trigger->AI()->DoAction(2); - events.RepeatEvent(30000); - break; - case EVENT_SUMMON_JUNK_BOT: - if( GameObject* pad = me->FindNearestGameObject(RAND(194741, 194744, 194747), 200.0f) ) - if (Creature* trigger = me->SummonCreature(NPC_BOT_SUMMON_TRIGGER, *pad, TEMPSUMMON_TIMED_DESPAWN, 15000)) - trigger->AI()->DoAction(1); - events.RepeatEvent(10000); - break; - case EVENT_SUMMON_EMERGENCY_FIRE_BOTS: - { - uint32 ids[3] = {194740, 194743, 194748}; - for( uint8 i=0; i<3; ++i ) - if( GameObject* pad = me->FindNearestGameObject(ids[i], 200.0f) ) - if (Creature* trigger = me->SummonCreature(NPC_BOT_SUMMON_TRIGGER, *pad, TEMPSUMMON_MANUAL_DESPAWN)) - trigger->AI()->DoAction(3); - events.RepeatEvent(45000); - } - break; - case EVENT_MAGNETIC_CORE_PULL_DOWN: - me->CastSpell(me, SPELL_MAGNETIC_CORE, true); - me->CastSpell(me, SPELL_SPINNING, true); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 365.34f, me->GetExactDist(me->GetPositionX(), me->GetPositionY(), 365.34f)); - me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), 365.34f, me->GetOrientation(), false); - events.PopEvent(); - events.ScheduleEvent(EVENT_MAGNETIC_CORE_FREE, 20000); - break; - case EVENT_MAGNETIC_CORE_FREE: - me->RemoveAura(SPELL_SPINNING); - me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 381.34f, me->GetDistance(me->GetPositionX(), me->GetPositionY(), 381.34f)); - me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), 381.34f, me->GetOrientation(), false); - events.PopEvent(); - events.ScheduleEvent(EVENT_MAGNETIC_CORE_REMOVE_IMMOBILIZE, 1000); - break; - case EVENT_MAGNETIC_CORE_REMOVE_IMMOBILIZE: - immobilized = false; - events.PopEvent(); - break; - } - } + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_PLASMA_BALL: + if( !immobilized ) + { + if (Phase == 3) + { + if( Unit* victim = me->GetVictim() ) + me->CastSpell(victim, SPELL_PLASMA_BALL, false); + } + else + { + if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0, 27.5f, true)) + { + me->SetFacingTo(me->GetAngle(victim)); + me->CastSpell(victim, SPELL_PLASMA_BALL, false); + } + } + } + events.RepeatEvent(3000); + break; + case EVENT_SUMMON_BOMB_BOT: + if( !immobilized ) + me->CastSpell(me, SPELL_SUMMON_BOMB_BOT, false); + events.RepeatEvent(15000); + break; + case EVENT_SUMMON_ASSAULT_BOT: + if( GameObject* pad = me->FindNearestGameObject(RAND(194742, 194746, 194745), 200.0f) ) + if (Creature* trigger = me->SummonCreature(NPC_BOT_SUMMON_TRIGGER, *pad, TEMPSUMMON_TIMED_DESPAWN, 15000)) + trigger->AI()->DoAction(2); + events.RepeatEvent(30000); + break; + case EVENT_SUMMON_JUNK_BOT: + if( GameObject* pad = me->FindNearestGameObject(RAND(194741, 194744, 194747), 200.0f) ) + if (Creature* trigger = me->SummonCreature(NPC_BOT_SUMMON_TRIGGER, *pad, TEMPSUMMON_TIMED_DESPAWN, 15000)) + trigger->AI()->DoAction(1); + events.RepeatEvent(10000); + break; + case EVENT_SUMMON_EMERGENCY_FIRE_BOTS: + { + uint32 ids[3] = {194740, 194743, 194748}; + for( uint8 i=0; i<3; ++i ) + if( GameObject* pad = me->FindNearestGameObject(ids[i], 200.0f) ) + if (Creature* trigger = me->SummonCreature(NPC_BOT_SUMMON_TRIGGER, *pad, TEMPSUMMON_MANUAL_DESPAWN)) + trigger->AI()->DoAction(3); + events.RepeatEvent(45000); + } + break; + case EVENT_MAGNETIC_CORE_PULL_DOWN: + me->CastSpell(me, SPELL_MAGNETIC_CORE, true); + me->CastSpell(me, SPELL_SPINNING, true); + me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 365.34f, me->GetExactDist(me->GetPositionX(), me->GetPositionY(), 365.34f)); + me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), 365.34f, me->GetOrientation(), false); + events.PopEvent(); + events.ScheduleEvent(EVENT_MAGNETIC_CORE_FREE, 20000); + break; + case EVENT_MAGNETIC_CORE_FREE: + me->RemoveAura(SPELL_SPINNING); + me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), 381.34f, me->GetDistance(me->GetPositionX(), me->GetPositionY(), 381.34f)); + me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), 381.34f, me->GetOrientation(), false); + events.PopEvent(); + events.ScheduleEvent(EVENT_MAGNETIC_CORE_REMOVE_IMMOBILIZE, 1000); + break; + case EVENT_MAGNETIC_CORE_REMOVE_IMMOBILIZE: + immobilized = false; + events.PopEvent(); + break; + } + } - void MoveInLineOfSight(Unit* /*mover*/) {} + void MoveInLineOfSight(Unit* /*mover*/) {} - void KilledUnit(Unit* who) - { - if( who->GetTypeId() == TYPEID_PLAYER ) - if( Creature* c = GetMimiron() ) - { - if( Phase == 3 ) - { - if( rand()%2 ) - { - c->MonsterYell(TEXT_ACU_SLAIN_1, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_HEAD_SLAY_1); - } - else - { - c->MonsterYell(TEXT_ACU_SLAIN_2, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_HEAD_SLAY_2); - } - } - else - { - if( rand()%2 ) - { - c->MonsterYell(TEXT_VOLTRON_SLAIN_1, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_VOLTRON_SLAY_1); - } - else - { - c->MonsterYell(TEXT_VOLTRON_SLAIN_2, LANG_UNIVERSAL, 0); - c->PlayDirectSound(SOUND_VOLTRON_SLAY_2); - } - } - } - } + void KilledUnit(Unit* who) + { + if( who->GetTypeId() == TYPEID_PLAYER ) + if( Creature* c = GetMimiron() ) + { + if( Phase == 3 ) + { + if( rand()%2 ) + { + c->MonsterYell(TEXT_ACU_SLAIN_1, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_HEAD_SLAY_1); + } + else + { + c->MonsterYell(TEXT_ACU_SLAIN_2, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_HEAD_SLAY_2); + } + } + else + { + if( rand()%2 ) + { + c->MonsterYell(TEXT_VOLTRON_SLAIN_1, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_VOLTRON_SLAY_1); + } + else + { + c->MonsterYell(TEXT_VOLTRON_SLAIN_2, LANG_UNIVERSAL, 0); + c->PlayDirectSound(SOUND_VOLTRON_SLAY_2); + } + } + } + } - void EnterEvadeMode() - { - if (bIsEvading) - return; - bIsEvading = true; + void EnterEvadeMode() + { + if (bIsEvading) + return; + bIsEvading = true; - me->RemoveAllAuras(); - me->ExitVehicle(); - _EnterEvadeMode(); - Reset(); - if (Creature* mimiron = GetMimiron()) - mimiron->AI()->EnterEvadeMode(); + me->RemoveAllAuras(); + me->ExitVehicle(); + _EnterEvadeMode(); + Reset(); + if (Creature* mimiron = GetMimiron()) + mimiron->AI()->EnterEvadeMode(); - bIsEvading = false; - } + bIsEvading = false; + } - void JustSummoned(Creature* s) - { - summons.Summon(s); - if (s->GetEntry() == NPC_BOMB_BOT) - s->m_positionZ = 364.34f; - } + void JustSummoned(Creature* s) + { + summons.Summon(s); + if (s->GetEntry() == NPC_BOMB_BOT) + s->m_positionZ = 364.34f; + } - void SummonedCreatureDespawn(Creature* s) - { - summons.Despawn(s); - } + void SummonedCreatureDespawn(Creature* s) + { + summons.Despawn(s); + } - void SpellHit(Unit* caster, const SpellInfo *spell) - { - if( spell->Id == SPELL_SELF_REPAIR ) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - } - } - }; + void SpellHit(Unit* caster, const SpellInfo *spell) + { + if( spell->Id == SPELL_SELF_REPAIR ) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + } + } + }; }; class npc_ulduar_proximity_mine : public CreatureScript @@ -1978,59 +1978,59 @@ public: return new npc_ulduar_proximity_mineAI (pCreature); } - struct npc_ulduar_proximity_mineAI : public ScriptedAI - { - npc_ulduar_proximity_mineAI(Creature *pCreature) : ScriptedAI(pCreature) - { - exploded = false; - timer = 2500; - timer2 = 35000; - } + struct npc_ulduar_proximity_mineAI : public ScriptedAI + { + npc_ulduar_proximity_mineAI(Creature *pCreature) : ScriptedAI(pCreature) + { + exploded = false; + timer = 2500; + timer2 = 35000; + } - bool exploded; - uint16 timer; - uint16 timer2; + bool exploded; + uint16 timer; + uint16 timer2; - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - bool CanAIAttack(const Unit* target) const { return false; } + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + bool CanAIAttack(const Unit* target) const { return false; } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (target && spell && target->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_MINE_EXPLOSION) - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (Creature* c = GetMimiron()) - c->AI()->SetData(0, 11); - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (target && spell && target->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_MINE_EXPLOSION) + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (Creature* c = GetMimiron()) + c->AI()->SetData(0, 11); + } - // MoveInLineOfSight is checked every few yards, can't use it - void UpdateAI(uint32 diff) - { - if (timer2 <= diff) - { - timer2 = 35000; - if (!exploded) - { - exploded = true; - me->CastSpell(me, SPELL_MINE_EXPLOSION, false); - } - } - else - timer2 -= diff; + // MoveInLineOfSight is checked every few yards, can't use it + void UpdateAI(uint32 diff) + { + if (timer2 <= diff) + { + timer2 = 35000; + if (!exploded) + { + exploded = true; + me->CastSpell(me, SPELL_MINE_EXPLOSION, false); + } + } + else + timer2 -= diff; - if (timer <= diff) - { - timer = 500; - if (!exploded && SelectTargetFromPlayerList(1.9f)) - { - exploded = true; - me->CastSpell(me, SPELL_MINE_EXPLOSION, false); - } - } - else - timer -= diff; - } - }; + if (timer <= diff) + { + timer = 500; + if (!exploded && SelectTargetFromPlayerList(1.9f)) + { + exploded = true; + me->CastSpell(me, SPELL_MINE_EXPLOSION, false); + } + } + else + timer -= diff; + } + }; }; class npc_ulduar_mimiron_rocket : public CreatureScript @@ -2043,37 +2043,37 @@ public: return new npc_ulduar_mimiron_rocketAI (pCreature); } - struct npc_ulduar_mimiron_rocketAI : public NullCreatureAI - { - npc_ulduar_mimiron_rocketAI(Creature *pCreature) : NullCreatureAI(pCreature) {} + struct npc_ulduar_mimiron_rocketAI : public NullCreatureAI + { + npc_ulduar_mimiron_rocketAI(Creature *pCreature) : NullCreatureAI(pCreature) {} - void InitializeAI() - { - if (!me->isDead()) - Reset(); - } + void InitializeAI() + { + if (!me->isDead()) + Reset(); + } - void Reset() - { - me->SetCanFly(true); - me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); - me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - } + void Reset() + { + me->SetCanFly(true); + me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); + me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + } - void SetData(uint32 id, uint32 value) - { - me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+100.0f, false, true); - } + void SetData(uint32 id, uint32 value) + { + me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+100.0f, false, true); + } - void UpdateAI(uint32 diff) - { - if (!me->GetVehicle()) - { - me->SetSpeed(MOVE_RUN, me->GetSpeedRate(MOVE_RUN)+0.4f, false); - me->SetSpeed(MOVE_FLIGHT, me->GetSpeedRate(MOVE_RUN), false); - } - } - }; + void UpdateAI(uint32 diff) + { + if (!me->GetVehicle()) + { + me->SetSpeed(MOVE_RUN, me->GetSpeedRate(MOVE_RUN)+0.4f, false); + me->SetSpeed(MOVE_FLIGHT, me->GetSpeedRate(MOVE_RUN), false); + } + } + }; }; class npc_ulduar_magnetic_core : public CreatureScript @@ -2086,43 +2086,43 @@ public: return new npc_ulduar_magnetic_coreAI (pCreature); } - struct npc_ulduar_magnetic_coreAI : public NullCreatureAI - { - npc_ulduar_magnetic_coreAI(Creature *pCreature) : NullCreatureAI(pCreature) - { - pInstance = me->GetInstanceScript(); - if (Creature* c = GetACU()) - if (c->GetExactDist2d(me) <= 10.0f) - { - me->SendMonsterMove(c->GetPositionX(), c->GetPositionY(), 364.313f, 1); - me->UpdatePosition(c->GetPositionX(), c->GetPositionY(), 364.313f, me->GetOrientation(), true); - me->StopMovingOnCurrentPos(); - c->AI()->SetData(2, 1); - despawnTimer = 20000; - return; - } - despawnTimer = 60000; - } + struct npc_ulduar_magnetic_coreAI : public NullCreatureAI + { + npc_ulduar_magnetic_coreAI(Creature *pCreature) : NullCreatureAI(pCreature) + { + pInstance = me->GetInstanceScript(); + if (Creature* c = GetACU()) + if (c->GetExactDist2d(me) <= 10.0f) + { + me->SendMonsterMove(c->GetPositionX(), c->GetPositionY(), 364.313f, 1); + me->UpdatePosition(c->GetPositionX(), c->GetPositionY(), 364.313f, me->GetOrientation(), true); + me->StopMovingOnCurrentPos(); + c->AI()->SetData(2, 1); + despawnTimer = 20000; + return; + } + despawnTimer = 60000; + } - InstanceScript* pInstance; - uint16 despawnTimer; + InstanceScript* pInstance; + uint16 despawnTimer; - void SetData(uint32 id, uint32 value) - { - despawnTimer = 20000; - } + void SetData(uint32 id, uint32 value) + { + despawnTimer = 20000; + } - void UpdateAI(uint32 diff) - { - if (despawnTimer <= diff) - { - despawnTimer = 60000; - me->DespawnOrUnsummon(1); - } - else - despawnTimer -= diff; - } - }; + void UpdateAI(uint32 diff) + { + if (despawnTimer <= diff) + { + despawnTimer = 60000; + me->DespawnOrUnsummon(1); + } + else + despawnTimer -= diff; + } + }; }; class npc_ulduar_bot_summon_trigger : public CreatureScript @@ -2135,144 +2135,144 @@ public: return new npc_ulduar_bot_summon_triggerAI (pCreature); } - struct npc_ulduar_bot_summon_triggerAI : public NullCreatureAI - { - npc_ulduar_bot_summon_triggerAI(Creature *pCreature) : NullCreatureAI(pCreature) { } + struct npc_ulduar_bot_summon_triggerAI : public NullCreatureAI + { + npc_ulduar_bot_summon_triggerAI(Creature *pCreature) : NullCreatureAI(pCreature) { } - uint32 timer; - uint8 option; + uint32 timer; + uint8 option; - void Reset() - { - timer = 8000; - option = 0; - } + void Reset() + { + timer = 8000; + option = 0; + } - void DoAction(int32 param) - { - switch( param ) - { - case 1: - me->CastSpell(me, SPELL_BEAM_GREEN, true); - option = 1; - break; - case 2: - me->CastSpell(me, SPELL_BEAM_YELLOW, true); - option = 2; - break; - case 3: - me->CastSpell(me, SPELL_BEAM_BLUE, true); - option = 3; - break; - } - } + void DoAction(int32 param) + { + switch( param ) + { + case 1: + me->CastSpell(me, SPELL_BEAM_GREEN, true); + option = 1; + break; + case 2: + me->CastSpell(me, SPELL_BEAM_YELLOW, true); + option = 2; + break; + case 3: + me->CastSpell(me, SPELL_BEAM_BLUE, true); + option = 3; + break; + } + } - void UpdateAI(uint32 diff) - { - if( timer <= diff ) - { - uint32 option_npcid[3] = {NPC_JUNK_BOT, NPC_ASSAULT_BOT, NPC_EMERGENCY_FIRE_BOT}; - InstanceScript* pInstance = me->GetInstanceScript(); - if (Creature* ACU = GetACU()) // ACU summons for easy removing - if( Creature* bot = ACU->SummonCreature( option_npcid[option-1], *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000 ) ) - { - if( option < 3 ) - bot->SetInCombatWithZone(); - if (Creature* m = GetMimiron()) - if (m->AI()->GetData(1)) // hardmode - bot->CastSpell(bot, SPELL_EMERGENCY_MODE, true); - } + void UpdateAI(uint32 diff) + { + if( timer <= diff ) + { + uint32 option_npcid[3] = {NPC_JUNK_BOT, NPC_ASSAULT_BOT, NPC_EMERGENCY_FIRE_BOT}; + InstanceScript* pInstance = me->GetInstanceScript(); + if (Creature* ACU = GetACU()) // ACU summons for easy removing + if( Creature* bot = ACU->SummonCreature( option_npcid[option-1], *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000 ) ) + { + if( option < 3 ) + bot->SetInCombatWithZone(); + if (Creature* m = GetMimiron()) + if (m->AI()->GetData(1)) // hardmode + bot->CastSpell(bot, SPELL_EMERGENCY_MODE, true); + } - me->DespawnOrUnsummon(500); - timer = 99999; - } - else - timer -= diff; - } - }; + me->DespawnOrUnsummon(500); + timer = 99999; + } + else + timer -= diff; + } + }; }; class spell_mimiron_rapid_burst : public SpellScriptLoader { public: - spell_mimiron_rapid_burst() : SpellScriptLoader("spell_mimiron_rapid_burst") { } + spell_mimiron_rapid_burst() : SpellScriptLoader("spell_mimiron_rapid_burst") { } - class spell_mimiron_rapid_burst_AuraScript : public AuraScript - { - PrepareAuraScript(spell_mimiron_rapid_burst_AuraScript) + class spell_mimiron_rapid_burst_AuraScript : public AuraScript + { + PrepareAuraScript(spell_mimiron_rapid_burst_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (Unit* c = GetCaster()) - { - uint32 id = ( c->GetMap()->Is25ManRaid() ? ((aurEff->GetTickNumber()%2) ? SPELL_RAPID_BURST_DAMAGE_25_2 : SPELL_RAPID_BURST_DAMAGE_25_1) : ((aurEff->GetTickNumber()%2) ? SPELL_RAPID_BURST_DAMAGE_10_2 : SPELL_RAPID_BURST_DAMAGE_10_1) ); - c->CastSpell((Unit*)NULL, id, true); - } - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (Unit* c = GetCaster()) + { + uint32 id = ( c->GetMap()->Is25ManRaid() ? ((aurEff->GetTickNumber()%2) ? SPELL_RAPID_BURST_DAMAGE_25_2 : SPELL_RAPID_BURST_DAMAGE_25_1) : ((aurEff->GetTickNumber()%2) ? SPELL_RAPID_BURST_DAMAGE_10_2 : SPELL_RAPID_BURST_DAMAGE_10_1) ); + c->CastSpell((Unit*)NULL, id, true); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mimiron_rapid_burst_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mimiron_rapid_burst_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_mimiron_rapid_burst_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_mimiron_rapid_burst_AuraScript(); + } }; class spell_mimiron_p3wx2_laser_barrage : public SpellScriptLoader { public: - spell_mimiron_p3wx2_laser_barrage() : SpellScriptLoader("spell_mimiron_p3wx2_laser_barrage") { } + spell_mimiron_p3wx2_laser_barrage() : SpellScriptLoader("spell_mimiron_p3wx2_laser_barrage") { } - class spell_mimiron_p3wx2_laser_barrage_AuraScript : public AuraScript - { - PrepareAuraScript(spell_mimiron_p3wx2_laser_barrage_AuraScript) + class spell_mimiron_p3wx2_laser_barrage_AuraScript : public AuraScript + { + PrepareAuraScript(spell_mimiron_p3wx2_laser_barrage_AuraScript) - uint32 lastMSTime; - float lastOrientation; + uint32 lastMSTime; + float lastOrientation; - bool Load() - { - lastMSTime = World::GetGameTimeMS(); - lastOrientation = -1.0f; - return true; - } + bool Load() + { + lastMSTime = World::GetGameTimeMS(); + lastOrientation = -1.0f; + return true; + } - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (Unit* c = GetCaster()) - { - if (c->GetTypeId() != TYPEID_UNIT) - return; - uint32 diff = getMSTimeDiff(lastMSTime, World::GetGameTimeMS()); - if (lastOrientation == -1.0f) - { - lastOrientation = (c->ToCreature()->AI()->GetData(0)*2*M_PI)/100.0f; - diff = 0; - } - float new_o = Position::NormalizeOrientation(lastOrientation-(M_PI/60)*(diff/250.0f)); - lastMSTime = World::GetGameTimeMS(); - lastOrientation = new_o; - c->SetOrientation(new_o); - c->SetFacingTo(new_o); - c->CastSpell((Unit*)NULL, 63297, true); - c->CastSpell((Unit*)NULL, 64042, true); - } - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (Unit* c = GetCaster()) + { + if (c->GetTypeId() != TYPEID_UNIT) + return; + uint32 diff = getMSTimeDiff(lastMSTime, World::GetGameTimeMS()); + if (lastOrientation == -1.0f) + { + lastOrientation = (c->ToCreature()->AI()->GetData(0)*2*M_PI)/100.0f; + diff = 0; + } + float new_o = Position::NormalizeOrientation(lastOrientation-(M_PI/60)*(diff/250.0f)); + lastMSTime = World::GetGameTimeMS(); + lastOrientation = new_o; + c->SetOrientation(new_o); + c->SetFacingTo(new_o); + c->CastSpell((Unit*)NULL, 63297, true); + c->CastSpell((Unit*)NULL, 64042, true); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mimiron_p3wx2_laser_barrage_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mimiron_p3wx2_laser_barrage_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_mimiron_p3wx2_laser_barrage_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_mimiron_p3wx2_laser_barrage_AuraScript(); + } }; class go_ulduar_do_not_push_this_button : public GameObjectScript @@ -2280,26 +2280,26 @@ class go_ulduar_do_not_push_this_button : public GameObjectScript public: go_ulduar_do_not_push_this_button() : GameObjectScript("go_ulduar_do_not_push_this_button") { } - bool OnGossipHello(Player* Player, GameObject* GO) - { - if( !Player || !GO ) - return true; + bool OnGossipHello(Player* Player, GameObject* GO) + { + if( !Player || !GO ) + return true; - InstanceScript* pInstance = GO->GetInstanceScript(); - if (pInstance) - { - if( pInstance->GetData(TYPE_MIMIRON) != NOT_STARTED ) - return false; + InstanceScript* pInstance = GO->GetInstanceScript(); + if (pInstance) + { + if( pInstance->GetData(TYPE_MIMIRON) != NOT_STARTED ) + return false; - if (Creature* c = ObjectAccessor::GetCreature(*GO, pInstance->GetData64(TYPE_MIMIRON))) - { - c->AI()->SetData(0, 7); - c->AI()->AttackStart(Player); - } - } + if (Creature* c = ObjectAccessor::GetCreature(*GO, pInstance->GetData64(TYPE_MIMIRON))) + { + c->AI()->SetData(0, 7); + c->AI()->AttackStart(Player); + } + } - return false; - } + return false; + } }; class npc_ulduar_flames_initial : public CreatureScript @@ -2312,115 +2312,115 @@ public: return new npc_ulduar_flames_initialAI (pCreature); } - struct npc_ulduar_flames_initialAI : public NullCreatureAI - { - npc_ulduar_flames_initialAI(Creature *pCreature) : NullCreatureAI(pCreature) - { - CreateTime = time(NULL); - events.Reset(); - events.ScheduleEvent(EVENT_FLAMES_SPREAD, 5750); - if( Creature* flame = me->SummonCreature(NPC_FLAMES_SPREAD, me->GetPositionX(), me->GetPositionY(), 364.32f, 0.0f) ) - { - FlameList.push_back(flame->GetGUID()); - flame->CastSpell(flame, SPELL_FLAMES_AURA, true); - } - } + struct npc_ulduar_flames_initialAI : public NullCreatureAI + { + npc_ulduar_flames_initialAI(Creature *pCreature) : NullCreatureAI(pCreature) + { + CreateTime = time(NULL); + events.Reset(); + events.ScheduleEvent(EVENT_FLAMES_SPREAD, 5750); + if( Creature* flame = me->SummonCreature(NPC_FLAMES_SPREAD, me->GetPositionX(), me->GetPositionY(), 364.32f, 0.0f) ) + { + FlameList.push_back(flame->GetGUID()); + flame->CastSpell(flame, SPELL_FLAMES_AURA, true); + } + } - std::list FlameList; - EventMap events; - uint32 CreateTime; + std::list FlameList; + EventMap events; + uint32 CreateTime; - void DoAction(int32 action) - { - if (action == 1337) - RemoveAll(); - } + void DoAction(int32 action) + { + if (action == 1337) + RemoveAll(); + } - void SpreadFlame(float x, float y) - { - if( Creature* flame = me->SummonCreature(NPC_FLAMES_SPREAD, x, y, 364.32f, 0.0f) ) - { - FlameList.push_back(flame->GetGUID()); - if (Creature* c = me->FindNearestCreature(NPC_FLAMES_SPREAD, 10.0f)) - if (c->GetExactDist2d(flame->GetPositionX(), flame->GetPositionY()) <= 4.0f) - return; - flame->CastSpell(flame, SPELL_FLAMES_AURA, true); - } - } + void SpreadFlame(float x, float y) + { + if( Creature* flame = me->SummonCreature(NPC_FLAMES_SPREAD, x, y, 364.32f, 0.0f) ) + { + FlameList.push_back(flame->GetGUID()); + if (Creature* c = me->FindNearestCreature(NPC_FLAMES_SPREAD, 10.0f)) + if (c->GetExactDist2d(flame->GetPositionX(), flame->GetPositionY()) <= 4.0f) + return; + flame->CastSpell(flame, SPELL_FLAMES_AURA, true); + } + } - void RemoveFlame(uint64 guid) - { - FlameList.remove(guid); - } + void RemoveFlame(uint64 guid) + { + FlameList.remove(guid); + } - void RemoveAll() - { - for( std::list::iterator itr = FlameList.begin(); itr != FlameList.end(); ++itr ) - if (Creature* c = ObjectAccessor::GetCreature(*me, (*itr))) - c->DespawnOrUnsummon(); - FlameList.clear(); - me->DespawnOrUnsummon(); - } + void RemoveAll() + { + for( std::list::iterator itr = FlameList.begin(); itr != FlameList.end(); ++itr ) + if (Creature* c = ObjectAccessor::GetCreature(*me, (*itr))) + c->DespawnOrUnsummon(); + FlameList.clear(); + me->DespawnOrUnsummon(); + } - void UpdateAI(uint32 diff) - { - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (pInstance->GetData(TYPE_MIMIRON) != IN_PROGRESS) - { - RemoveAll(); - return; - } + void UpdateAI(uint32 diff) + { + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (pInstance->GetData(TYPE_MIMIRON) != IN_PROGRESS) + { + RemoveAll(); + return; + } - events.Update(diff); + events.Update(diff); - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_FLAMES_SPREAD: - { - if( FlameList.empty() ) - { - me->DespawnOrUnsummon(); - return; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_FLAMES_SPREAD: + { + if( FlameList.empty() ) + { + me->DespawnOrUnsummon(); + return; + } - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (Creature* mimiron = GetMimiron()) - if (CreateTime < mimiron->AI()->GetData(10)) - { - events.PopEvent(); - break; - } + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (Creature* mimiron = GetMimiron()) + if (CreateTime < mimiron->AI()->GetData(10)) + { + events.PopEvent(); + break; + } - Creature* last = ObjectAccessor::GetCreature(*me, FlameList.back()); - if( last ) - { - float prevdist = 100.0f; - Player* target = NULL; + Creature* last = ObjectAccessor::GetCreature(*me, FlameList.back()); + if( last ) + { + float prevdist = 100.0f; + Player* target = NULL; - Map::PlayerList const &pl = me->GetMap()->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - if( plr->IsAlive() && plr->GetExactDist2d(last) < prevdist && !plr->IsGameMaster() ) - { - target = plr; - prevdist = plr->GetExactDist2d(last); - } + Map::PlayerList const &pl = me->GetMap()->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + if( plr->IsAlive() && plr->GetExactDist2d(last) < prevdist && !plr->IsGameMaster() ) + { + target = plr; + prevdist = plr->GetExactDist2d(last); + } - if (target && prevdist >= 4.0f) // no need to spread when player is standing in fire, check distance - { - float angle = last->GetAngle(target->GetPositionX(), target->GetPositionY()) -M_PI/8 + rand_norm()*2*M_PI/8; - SpreadFlame(last->GetPositionX() + 7.0f*cos(angle), last->GetPositionY() + 7.0f*sin(angle)); - } - } + if (target && prevdist >= 4.0f) // no need to spread when player is standing in fire, check distance + { + float angle = last->GetAngle(target->GetPositionX(), target->GetPositionY()) -M_PI/8 + rand_norm()*2*M_PI/8; + SpreadFlame(last->GetPositionX() + 7.0f*cos(angle), last->GetPositionY() + 7.0f*sin(angle)); + } + } - events.RepeatEvent(5750); - } - break; - } - } - }; + events.RepeatEvent(5750); + } + break; + } + } + }; }; class npc_ulduar_flames_spread : public CreatureScript @@ -2433,36 +2433,36 @@ public: return new npc_ulduar_flames_spreadAI (pCreature); } - struct npc_ulduar_flames_spreadAI : public NullCreatureAI - { - npc_ulduar_flames_spreadAI(Creature *pCreature) : NullCreatureAI(pCreature) {} + struct npc_ulduar_flames_spreadAI : public NullCreatureAI + { + npc_ulduar_flames_spreadAI(Creature *pCreature) : NullCreatureAI(pCreature) {} - void SpellHit(Unit* caster, const SpellInfo* spell) - { - switch( spell->Id ) - { - case SPELL_FROST_BOMB_EXPLOSION_10: - case SPELL_FROST_BOMB_EXPLOSION_25: - case SPELL_FLAME_SUPPRESSANT_10yd: - case SPELL_FLAME_SUPPRESSANT_50000yd: - case SPELL_WATER_SPRAY: - { - if (me->IsSummon()) - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - if (Creature* c = summoner->ToCreature()) - if (c->AI()) - CAST_AI(npc_ulduar_flames_initial::npc_ulduar_flames_initialAI, c->AI())->RemoveFlame(me->GetGUID()); + void SpellHit(Unit* caster, const SpellInfo* spell) + { + switch( spell->Id ) + { + case SPELL_FROST_BOMB_EXPLOSION_10: + case SPELL_FROST_BOMB_EXPLOSION_25: + case SPELL_FLAME_SUPPRESSANT_10yd: + case SPELL_FLAME_SUPPRESSANT_50000yd: + case SPELL_WATER_SPRAY: + { + if (me->IsSummon()) + if (Unit* summoner = me->ToTempSummon()->GetSummoner()) + if (Creature* c = summoner->ToCreature()) + if (c->AI()) + CAST_AI(npc_ulduar_flames_initial::npc_ulduar_flames_initialAI, c->AI())->RemoveFlame(me->GetGUID()); - me->RemoveAllAuras(); - me->DespawnOrUnsummon(2500); - } - break; - case SPELL_VX001_FROST_BOMB: - me->CastSpell(me, SPELL_SUMMON_FROST_BOMB, true); - break; - } - } - }; + me->RemoveAllAuras(); + me->DespawnOrUnsummon(2500); + } + break; + case SPELL_VX001_FROST_BOMB: + me->CastSpell(me, SPELL_SUMMON_FROST_BOMB, true); + break; + } + } + }; }; class npc_ulduar_emergency_fire_bot : public CreatureScript @@ -2475,52 +2475,52 @@ public: return new npc_ulduar_emergency_fire_botAI (pCreature); } - struct npc_ulduar_emergency_fire_botAI : public ScriptedAI - { - npc_ulduar_emergency_fire_botAI(Creature *pCreature) : ScriptedAI(pCreature) - { - events.Reset(); - events.ScheduleEvent(EVENT_EMERGENCY_BOT_CHECK, 1000); - } + struct npc_ulduar_emergency_fire_botAI : public ScriptedAI + { + npc_ulduar_emergency_fire_botAI(Creature *pCreature) : ScriptedAI(pCreature) + { + events.Reset(); + events.ScheduleEvent(EVENT_EMERGENCY_BOT_CHECK, 1000); + } - EventMap events; + EventMap events; - void MoveInLineOfSight(Unit*) {} + void MoveInLineOfSight(Unit*) {} void AttackStart(Unit*) {} - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == 1) - events.ScheduleEvent(EVENT_EMERGENCY_BOT_ATTACK, 0); - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == 1) + events.ScheduleEvent(EVENT_EMERGENCY_BOT_ATTACK, 0); + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_EMERGENCY_BOT_CHECK: - events.RepeatEvent(15000); // just in case, will be rescheduled - if( Creature* flame = me->FindNearestCreature(NPC_FLAMES_SPREAD, 150.0f, true) ) - { - me->m_orientation = me->GetAngle(flame->GetPositionX(), flame->GetPositionY()); - float dist = me->GetExactDist2d(flame); - if (dist <= 5.0f) - events.ScheduleEvent(EVENT_EMERGENCY_BOT_ATTACK, 0); - else - me->GetMotionMaster()->MovePoint(1, me->GetPositionX()+(dist-5.0f)*cos(me->GetOrientation()), me->GetPositionY()+(dist-5.0f)*sin(me->GetOrientation()), 364.32f); - } - break; - case EVENT_EMERGENCY_BOT_ATTACK: - me->CastSpell((Unit*)NULL, SPELL_WATER_SPRAY, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_EMERGENCY_BOT_CHECK, 5000); - break; - } - } - }; + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_EMERGENCY_BOT_CHECK: + events.RepeatEvent(15000); // just in case, will be rescheduled + if( Creature* flame = me->FindNearestCreature(NPC_FLAMES_SPREAD, 150.0f, true) ) + { + me->m_orientation = me->GetAngle(flame->GetPositionX(), flame->GetPositionY()); + float dist = me->GetExactDist2d(flame); + if (dist <= 5.0f) + events.ScheduleEvent(EVENT_EMERGENCY_BOT_ATTACK, 0); + else + me->GetMotionMaster()->MovePoint(1, me->GetPositionX()+(dist-5.0f)*cos(me->GetOrientation()), me->GetPositionY()+(dist-5.0f)*sin(me->GetOrientation()), 364.32f); + } + break; + case EVENT_EMERGENCY_BOT_ATTACK: + me->CastSpell((Unit*)NULL, SPELL_WATER_SPRAY, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_EMERGENCY_BOT_CHECK, 5000); + break; + } + } + }; }; class npc_ulduar_rocket_strike_trigger : public CreatureScript @@ -2533,25 +2533,25 @@ public: return new npc_ulduar_rocket_strike_triggerAI (pCreature); } - struct npc_ulduar_rocket_strike_triggerAI : public NullCreatureAI - { - npc_ulduar_rocket_strike_triggerAI(Creature *pCreature) : NullCreatureAI(pCreature) {} + struct npc_ulduar_rocket_strike_triggerAI : public NullCreatureAI + { + npc_ulduar_rocket_strike_triggerAI(Creature *pCreature) : NullCreatureAI(pCreature) {} - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (!target || !spell) - return; - if (spell->Id == 63041) - { - if (target->GetEntry() == NPC_ASSAULT_BOT) - me->CastSpell(me, 65040, true); // achievement Not-So-Friendly Fire - else if (target->GetTypeId() == TYPEID_PLAYER) - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (Creature* c = GetMimiron()) - c->AI()->SetData(0, 13); - } - } - }; + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (!target || !spell) + return; + if (spell->Id == 63041) + { + if (target->GetEntry() == NPC_ASSAULT_BOT) + me->CastSpell(me, 65040, true); // achievement Not-So-Friendly Fire + else if (target->GetTypeId() == TYPEID_PLAYER) + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (Creature* c = GetMimiron()) + c->AI()->SetData(0, 13); + } + } + }; }; class achievement_mimiron_firefighter : public AchievementCriteriaScript @@ -2561,7 +2561,7 @@ public: bool OnCheck(Player* player, Unit* target) { - return target && target->GetEntry() == NPC_MIMIRON && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(1); + return target && target->GetEntry() == NPC_MIMIRON && target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->AI()->GetData(1); } }; @@ -2572,7 +2572,7 @@ public: bool OnCheck(Player* player, Unit* target) { - return target && target->GetEntry() == NPC_MIMIRON && target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->AI()->GetData(11); + return target && target->GetEntry() == NPC_MIMIRON && target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->AI()->GetData(11); } }; @@ -2583,7 +2583,7 @@ public: bool OnCheck(Player* player, Unit* target) { - return target && target->GetEntry() == NPC_MIMIRON && target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->AI()->GetData(12); + return target && target->GetEntry() == NPC_MIMIRON && target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->AI()->GetData(12); } }; @@ -2594,31 +2594,31 @@ public: bool OnCheck(Player* player, Unit* target) { - return target && target->GetEntry() == NPC_MIMIRON && target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->AI()->GetData(13); + return target && target->GetEntry() == NPC_MIMIRON && target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->AI()->GetData(13); } }; void AddSC_boss_mimiron() { - new boss_mimiron(); - new npc_ulduar_leviathan_mkii(); - new npc_ulduar_vx001(); - new npc_ulduar_aerial_command_unit(); + new boss_mimiron(); + new npc_ulduar_leviathan_mkii(); + new npc_ulduar_vx001(); + new npc_ulduar_aerial_command_unit(); - new npc_ulduar_proximity_mine(); - new npc_ulduar_mimiron_rocket(); - new npc_ulduar_magnetic_core(); - new npc_ulduar_bot_summon_trigger(); - new spell_mimiron_rapid_burst(); - new spell_mimiron_p3wx2_laser_barrage(); - new go_ulduar_do_not_push_this_button(); - new npc_ulduar_flames_initial(); - new npc_ulduar_flames_spread(); - new npc_ulduar_emergency_fire_bot(); - new npc_ulduar_rocket_strike_trigger(); + new npc_ulduar_proximity_mine(); + new npc_ulduar_mimiron_rocket(); + new npc_ulduar_magnetic_core(); + new npc_ulduar_bot_summon_trigger(); + new spell_mimiron_rapid_burst(); + new spell_mimiron_p3wx2_laser_barrage(); + new go_ulduar_do_not_push_this_button(); + new npc_ulduar_flames_initial(); + new npc_ulduar_flames_spread(); + new npc_ulduar_emergency_fire_bot(); + new npc_ulduar_rocket_strike_trigger(); - new achievement_mimiron_firefighter(); - new achievement_mimiron_set_up_us_the_bomb_11(); - new achievement_mimiron_set_up_us_the_bomb_12(); - new achievement_mimiron_set_up_us_the_bomb_13(); + new achievement_mimiron_firefighter(); + new achievement_mimiron_set_up_us_the_bomb_11(); + new achievement_mimiron_set_up_us_the_bomb_12(); + new achievement_mimiron_set_up_us_the_bomb_13(); } \ No newline at end of file diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index 9c155af46..c618f4dd8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -13,98 +13,98 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! #include "WaypointManager.h" #include "MoveSplineInit.h" -#define SPELL_FLAMEBUFFET_10 64016 -#define SPELL_FLAMEBUFFET_25 64023 -#define S_FLAMEBUFFET RAID_MODE(SPELL_FLAMEBUFFET_10, SPELL_FLAMEBUFFET_25) -#define SPELL_FIREBALL 63815 -#define SPELL_WINGBUFFET 62666 -#define SPELL_FLAMEBREATH_10 63317 -#define SPELL_FLAMEBREATH_25 64021 -#define S_FLAMEBREATH RAID_MODE(SPELL_FLAMEBREATH_10, SPELL_FLAMEBREATH_25) -#define SPELL_FUSEARMOR 64771 -#define SPELL_DEVOURINGFLAME 63236 -#define SPELL_BERSERK 47008 +#define SPELL_FLAMEBUFFET_10 64016 +#define SPELL_FLAMEBUFFET_25 64023 +#define S_FLAMEBUFFET RAID_MODE(SPELL_FLAMEBUFFET_10, SPELL_FLAMEBUFFET_25) +#define SPELL_FIREBALL 63815 +#define SPELL_WINGBUFFET 62666 +#define SPELL_FLAMEBREATH_10 63317 +#define SPELL_FLAMEBREATH_25 64021 +#define S_FLAMEBREATH RAID_MODE(SPELL_FLAMEBREATH_10, SPELL_FLAMEBREATH_25) +#define SPELL_FUSEARMOR 64771 +#define SPELL_DEVOURINGFLAME 63236 +#define SPELL_BERSERK 47008 -#define SPELL_CHAIN_1 49679 -#define SPELL_CHAIN_2 49682 -#define SPELL_CHAIN_3 49683 -#define SPELL_CHAIN_4 49684 -#define SPELL_LAUNCH_CHAIN 62505 -#define SPELL_HARPOON_SHOT_BUFF 62509 -#define SPELL_HARPOON_FIRE_STATE 62696 -#define REQ_CHAIN_COUNT RAID_MODE(2, 4) +#define SPELL_CHAIN_1 49679 +#define SPELL_CHAIN_2 49682 +#define SPELL_CHAIN_3 49683 +#define SPELL_CHAIN_4 49684 +#define SPELL_LAUNCH_CHAIN 62505 +#define SPELL_HARPOON_SHOT_BUFF 62509 +#define SPELL_HARPOON_FIRE_STATE 62696 +#define REQ_CHAIN_COUNT RAID_MODE(2, 4) -#define SPELL_DEVOURINGFLAME_SUMMON 63308 -#define SPELL_DEVOURINGFLAME_GROUNDAURA_10 64709 -#define SPELL_DEVOURINGFLAME_GROUNDAURA_25 64734 -#define S_DEVOURINGFLAME_GROUNDAURA RAID_MODE(SPELL_DEVOURINGFLAME_GROUNDAURA_10, SPELL_DEVOURINGFLAME_GROUNDAURA_25) -#define NPC_DEVOURINGFLAME 34188 -#define SPELL_STORMSTRIKE 51876 -#define SPELL_WHIRLWIND 63808 -#define SPELL_LIGHTINGBOLT 63809 -#define SPELL_CHAINLIGHTNING 64758 +#define SPELL_DEVOURINGFLAME_SUMMON 63308 +#define SPELL_DEVOURINGFLAME_GROUNDAURA_10 64709 +#define SPELL_DEVOURINGFLAME_GROUNDAURA_25 64734 +#define S_DEVOURINGFLAME_GROUNDAURA RAID_MODE(SPELL_DEVOURINGFLAME_GROUNDAURA_10, SPELL_DEVOURINGFLAME_GROUNDAURA_25) +#define NPC_DEVOURINGFLAME 34188 +#define SPELL_STORMSTRIKE 51876 +#define SPELL_WHIRLWIND 63808 +#define SPELL_LIGHTINGBOLT 63809 +#define SPELL_CHAINLIGHTNING 64758 -#define NPC_DARK_RUNE_SENTINEL 33846 -#define NPC_DARK_RUNE_GUARDIAN 33388 -#define NPC_DARK_RUNE_WATCHER 33453 -#define NPC_EXPEDITION_ENGINEER 33287 -#define NPC_EXPEDITION_COMMANDER 33210 -#define NPC_EXPEDITION_DEFENDER 33816 -#define NPC_EXPEDITION_TRAPPER 33259 -#define NPC_RAZORSCALE 33186 -#define NPC_HARPOON_FIRE_STATE 33282 +#define NPC_DARK_RUNE_SENTINEL 33846 +#define NPC_DARK_RUNE_GUARDIAN 33388 +#define NPC_DARK_RUNE_WATCHER 33453 +#define NPC_EXPEDITION_ENGINEER 33287 +#define NPC_EXPEDITION_COMMANDER 33210 +#define NPC_EXPEDITION_DEFENDER 33816 +#define NPC_EXPEDITION_TRAPPER 33259 +#define NPC_RAZORSCALE 33186 +#define NPC_HARPOON_FIRE_STATE 33282 -#define GO_DRILL 195305 -#define GO_HARPOON_GUN_1 194519 -#define GO_HARPOON_GUN_2 194541 -#define GO_HARPOON_GUN_3 194542 -#define GO_HARPOON_GUN_4 194543 -#define GO_BROKEN_HARPOON 194565 +#define GO_DRILL 195305 +#define GO_HARPOON_GUN_1 194519 +#define GO_HARPOON_GUN_2 194541 +#define GO_HARPOON_GUN_3 194542 +#define GO_HARPOON_GUN_4 194543 +#define GO_BROKEN_HARPOON 194565 -#define TEXT_GOSSIP_ACTION "We are ready to help!" -#define TEXT_EE_AGGRO "Give us a moment to prepare to build the turrets." -#define TEXT_EE_MOVE_OUT "Ready to move out, keep those dwarves off of our backs!" -#define TEXT_EE_FIRES_OUT "Fires out! Let's rebuild those turrets!" +#define TEXT_GOSSIP_ACTION "We are ready to help!" +#define TEXT_EE_AGGRO "Give us a moment to prepare to build the turrets." +#define TEXT_EE_MOVE_OUT "Ready to move out, keep those dwarves off of our backs!" +#define TEXT_EE_FIRES_OUT "Fires out! Let's rebuild those turrets!" -#define TEXT_TURRET_READY "Harpoon Turret is ready for use!" -#define TEXT_DEEP_BREATH "Razorscale takes a deep breath..." -#define TEXT_GROUNDED_PERMANENTLY "Razorscale grounded permanently!" +#define TEXT_TURRET_READY "Harpoon Turret is ready for use!" +#define TEXT_DEEP_BREATH "Razorscale takes a deep breath..." +#define TEXT_GROUNDED_PERMANENTLY "Razorscale grounded permanently!" -#define CORDS_GROUND 588.0f, -166.0f, 391.1f -#define CORDS_AIR 588.0f, -178.0f, 490.0f -#define REPAIR_POINTS 25 +#define CORDS_GROUND 588.0f, -166.0f, 391.1f +#define CORDS_AIR 588.0f, -178.0f, 490.0f +#define REPAIR_POINTS 25 enum eSay { - SAY_COMMANDER_INTRO = 0, - SAY_COMMANDER_GROUND = 1, - SAY_COMMANDER_AGGRO = 2 + SAY_COMMANDER_INTRO = 0, + SAY_COMMANDER_GROUND = 1, + SAY_COMMANDER_AGGRO = 2 }; enum eEvents { - EVENT_NONE = 0, - EVENT_COMMANDER_SAY_AGGRO, - EVENT_EE_SAY_MOVE_OUT, - EVENT_ENRAGE, - EVENT_SPELL_FIREBALL, - EVENT_SPELL_DEVOURING_FLAME, - EVENT_SUMMON_MOLE_MACHINES, - EVENT_SUMMON_ADDS, - EVENT_WARN_DEEP_BREATH, - EVENT_PHASE2_FLAME_BREATH, - EVENT_FLY_UP, - EVENT_RESUME_FIXING, - EVENT_SPELL_FLAME_BREATH, - EVENT_SPELL_DEVOURING_FLAME_GROUND, - EVENT_SPELL_FUSE_ARMOR, - EVENT_SPELL_FLAME_BUFFET, + EVENT_NONE = 0, + EVENT_COMMANDER_SAY_AGGRO, + EVENT_EE_SAY_MOVE_OUT, + EVENT_ENRAGE, + EVENT_SPELL_FIREBALL, + EVENT_SPELL_DEVOURING_FLAME, + EVENT_SUMMON_MOLE_MACHINES, + EVENT_SUMMON_ADDS, + EVENT_WARN_DEEP_BREATH, + EVENT_PHASE2_FLAME_BREATH, + EVENT_FLY_UP, + EVENT_RESUME_FIXING, + EVENT_SPELL_FLAME_BREATH, + EVENT_SPELL_DEVOURING_FLAME_GROUND, + EVENT_SPELL_FUSE_ARMOR, + EVENT_SPELL_FLAME_BUFFET, }; enum eMisc { - POINT_RAZORSCALE_INIT = 1 + POINT_RAZORSCALE_INIT = 1 }; class boss_razorscale : public CreatureScript @@ -117,555 +117,555 @@ public: return new boss_razorscaleAI (pCreature); } - struct boss_razorscaleAI : public ScriptedAI - { - boss_razorscaleAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) - { - pInstance = me->GetInstanceScript(); - startPath = true; - } + struct boss_razorscaleAI : public ScriptedAI + { + boss_razorscaleAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) + { + pInstance = me->GetInstanceScript(); + startPath = true; + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint64 ExpeditionEngineerGUIDs[3]; - uint64 CommanderGUID; - float cords[4][2]; - bool bGroundPhase; - bool startPath; - uint8 flyTimes; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint64 ExpeditionEngineerGUIDs[3]; + uint64 CommanderGUID; + float cords[4][2]; + bool bGroundPhase; + bool startPath; + uint8 flyTimes; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - memset(&ExpeditionEngineerGUIDs, 0, sizeof(ExpeditionEngineerGUIDs)); - CommanderGUID = 0; - bGroundPhase = false; - flyTimes = 0; + void Reset() + { + events.Reset(); + summons.DespawnAll(); + memset(&ExpeditionEngineerGUIDs, 0, sizeof(ExpeditionEngineerGUIDs)); + CommanderGUID = 0; + bGroundPhase = false; + flyTimes = 0; - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - me->SendMovementFlagUpdate(); - me->setActive(true); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + me->SendMovementFlagUpdate(); + me->setActive(true); - if( pInstance ) - pInstance->SetData(TYPE_RAZORSCALE, NOT_STARTED); - } + if( pInstance ) + pInstance->SetData(TYPE_RAZORSCALE, NOT_STARTED); + } - void AttackStart(Unit* who) - { - if (who && me->Attack(who, true) && bGroundPhase) - me->GetMotionMaster()->MoveChase(who); - } + void AttackStart(Unit* who) + { + if (who && me->Attack(who, true) && bGroundPhase) + me->GetMotionMaster()->MoveChase(who); + } - void EnterCombat(Unit* who) - { - me->SetInCombatWithZone(); - events.Reset(); - events.ScheduleEvent(EVENT_COMMANDER_SAY_AGGRO, 5000); - events.ScheduleEvent(EVENT_EE_SAY_MOVE_OUT, 10000); - events.ScheduleEvent(EVENT_ENRAGE, 600000); - events.ScheduleEvent(EVENT_SPELL_FIREBALL, 6000); - events.ScheduleEvent(EVENT_SPELL_DEVOURING_FLAME, 13000); - events.ScheduleEvent(EVENT_SUMMON_MOLE_MACHINES, 11000); + void EnterCombat(Unit* who) + { + me->SetInCombatWithZone(); + events.Reset(); + events.ScheduleEvent(EVENT_COMMANDER_SAY_AGGRO, 5000); + events.ScheduleEvent(EVENT_EE_SAY_MOVE_OUT, 10000); + events.ScheduleEvent(EVENT_ENRAGE, 600000); + events.ScheduleEvent(EVENT_SPELL_FIREBALL, 6000); + events.ScheduleEvent(EVENT_SPELL_DEVOURING_FLAME, 13000); + events.ScheduleEvent(EVENT_SUMMON_MOLE_MACHINES, 11000); - std::list eeList; - me->GetCreaturesWithEntryInRange(eeList, 300.0f, NPC_EXPEDITION_ENGINEER); - uint8 i = 0; - for( std::list::iterator itr = eeList.begin(); itr != eeList.end(); ++itr ) - { - if( i > 2 ) - break; - ExpeditionEngineerGUIDs[i] = (*itr)->GetGUID(); - if (!i) - (*itr)->MonsterYell(TEXT_EE_AGGRO, LANG_UNIVERSAL, 0); - ++i; - } - if (Creature* c = me->FindNearestCreature(NPC_EXPEDITION_COMMANDER, 300.0f, true)) - CommanderGUID = c->GetGUID(); + std::list eeList; + me->GetCreaturesWithEntryInRange(eeList, 300.0f, NPC_EXPEDITION_ENGINEER); + uint8 i = 0; + for( std::list::iterator itr = eeList.begin(); itr != eeList.end(); ++itr ) + { + if( i > 2 ) + break; + ExpeditionEngineerGUIDs[i] = (*itr)->GetGUID(); + if (!i) + (*itr)->MonsterYell(TEXT_EE_AGGRO, LANG_UNIVERSAL, 0); + ++i; + } + if (Creature* c = me->FindNearestCreature(NPC_EXPEDITION_COMMANDER, 300.0f, true)) + CommanderGUID = c->GetGUID(); - if( pInstance ) - pInstance->SetData(TYPE_RAZORSCALE, IN_PROGRESS); - } + if( pInstance ) + pInstance->SetData(TYPE_RAZORSCALE, IN_PROGRESS); + } - void JustDied(Unit* Killer) - { - summons.DespawnAll(); + void JustDied(Unit* Killer) + { + summons.DespawnAll(); - if( pInstance ) - pInstance->SetData(TYPE_RAZORSCALE, DONE); - } + if( pInstance ) + pInstance->SetData(TYPE_RAZORSCALE, DONE); + } - void SpellHit(Unit* caster, const SpellInfo* spell) - { - if (!caster || !pInstance) - return; + void SpellHit(Unit* caster, const SpellInfo* spell) + { + if (!caster || !pInstance) + return; - switch (spell->Id) - { - case SPELL_LAUNCH_CHAIN: - { - uint32 spell = 0; - if( caster->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_1) ) - spell = SPELL_CHAIN_1; - else if( caster->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_2) ) - spell = SPELL_CHAIN_2; - else if( caster->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_3) ) - spell = SPELL_CHAIN_3; - else - spell = SPELL_CHAIN_4; - caster->CastSpell(me, spell, true); - } - break; - case SPELL_CHAIN_1: - case SPELL_CHAIN_2: - case SPELL_CHAIN_3: - case SPELL_CHAIN_4: - { - uint8 count = 0; - if( me->HasAura(SPELL_CHAIN_1) ) - count++; - if( me->HasAura(SPELL_CHAIN_3) ) - count++; - if (RAID_MODE(0,1)) - { - if( me->HasAura(SPELL_CHAIN_2) ) - count++; - if( me->HasAura(SPELL_CHAIN_4) ) - count++; - } - if( count >= REQ_CHAIN_COUNT ) - { - if (Creature* commander = ObjectAccessor::GetCreature(*me, CommanderGUID)) - commander->AI()->Talk(SAY_COMMANDER_GROUND); + switch (spell->Id) + { + case SPELL_LAUNCH_CHAIN: + { + uint32 spell = 0; + if( caster->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_1) ) + spell = SPELL_CHAIN_1; + else if( caster->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_2) ) + spell = SPELL_CHAIN_2; + else if( caster->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_3) ) + spell = SPELL_CHAIN_3; + else + spell = SPELL_CHAIN_4; + caster->CastSpell(me, spell, true); + } + break; + case SPELL_CHAIN_1: + case SPELL_CHAIN_2: + case SPELL_CHAIN_3: + case SPELL_CHAIN_4: + { + uint8 count = 0; + if( me->HasAura(SPELL_CHAIN_1) ) + count++; + if( me->HasAura(SPELL_CHAIN_3) ) + count++; + if (RAID_MODE(0,1)) + { + if( me->HasAura(SPELL_CHAIN_2) ) + count++; + if( me->HasAura(SPELL_CHAIN_4) ) + count++; + } + if( count >= REQ_CHAIN_COUNT ) + { + if (Creature* commander = ObjectAccessor::GetCreature(*me, CommanderGUID)) + commander->AI()->Talk(SAY_COMMANDER_GROUND); - me->InterruptNonMeleeSpells(true); - events.CancelEvent(EVENT_SPELL_FIREBALL); - events.CancelEvent(EVENT_SPELL_DEVOURING_FLAME); - events.CancelEvent(EVENT_SUMMON_MOLE_MACHINES); - me->SetTarget(0); - me->SendMeleeAttackStop(me->GetVictim()); - me->GetMotionMaster()->MoveLand(0, CORDS_GROUND, 25.0f); - } - } - break; - } - } + me->InterruptNonMeleeSpells(true); + events.CancelEvent(EVENT_SPELL_FIREBALL); + events.CancelEvent(EVENT_SPELL_DEVOURING_FLAME); + events.CancelEvent(EVENT_SUMMON_MOLE_MACHINES); + me->SetTarget(0); + me->SendMeleeAttackStop(me->GetVictim()); + me->GetMotionMaster()->MoveLand(0, CORDS_GROUND, 25.0f); + } + } + break; + } + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) - { - if (me->GetPositionZ() > 440.0f) // protection, razorscale is attackable (so harpoons can hit him, etc.), but should not receive dmg while in air - damage = 0; - else if (!bGroundPhase && ((me->GetHealth()*100)/me->GetMaxHealth() < 50) && me->HasAura(62794)) // already below 50%, but still in chains and stunned - events.RescheduleEvent(EVENT_WARN_DEEP_BREATH, 0); - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) + { + if (me->GetPositionZ() > 440.0f) // protection, razorscale is attackable (so harpoons can hit him, etc.), but should not receive dmg while in air + damage = 0; + else if (!bGroundPhase && ((me->GetHealth()*100)/me->GetMaxHealth() < 50) && me->HasAura(62794)) // already below 50%, but still in chains and stunned + events.RescheduleEvent(EVENT_WARN_DEEP_BREATH, 0); + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == POINT_RAZORSCALE_INIT) - { - me->SetFacingTo(1.6f); - return; - } - else if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized() && !me->IsInCombat()) - { - startPath = true; - return; - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == POINT_RAZORSCALE_INIT) + { + me->SetFacingTo(1.6f); + return; + } + else if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized() && !me->IsInCombat()) + { + startPath = true; + return; + } - if (type != EFFECT_MOTION_TYPE) - return; - if (id == 0) // landed - { - me->SetControlled(true, UNIT_STATE_ROOT); - me->DisableRotate(true); - me->SetOrientation((float)(M_PI+0.01)/2); - me->SetFacingTo(M_PI/2); - me->SetCanFly(false); - me->SetDisableGravity(false); - me->SetHover(false); - me->CastSpell(me, 62794, true); - events.ScheduleEvent(EVENT_WARN_DEEP_BREATH, 30000); - } - else if (id == 1) // flied up - { - events.ScheduleEvent(EVENT_SPELL_FIREBALL, 2000); - events.ScheduleEvent(EVENT_SPELL_DEVOURING_FLAME, 4000); - events.ScheduleEvent(EVENT_SUMMON_MOLE_MACHINES, 5000); - } - } + if (type != EFFECT_MOTION_TYPE) + return; + if (id == 0) // landed + { + me->SetControlled(true, UNIT_STATE_ROOT); + me->DisableRotate(true); + me->SetOrientation((float)(M_PI+0.01)/2); + me->SetFacingTo(M_PI/2); + me->SetCanFly(false); + me->SetDisableGravity(false); + me->SetHover(false); + me->CastSpell(me, 62794, true); + events.ScheduleEvent(EVENT_WARN_DEEP_BREATH, 30000); + } + else if (id == 1) // flied up + { + events.ScheduleEvent(EVENT_SPELL_FIREBALL, 2000); + events.ScheduleEvent(EVENT_SPELL_DEVOURING_FLAME, 4000); + events.ScheduleEvent(EVENT_SUMMON_MOLE_MACHINES, 5000); + } + } - void UpdateAI(uint32 diff) - { - if (startPath) - { - me->StopMoving(); - startPath = false; - if (WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath())) - { - Movement::PointsArray pathPoints; - pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - for (uint8 i = 0; i < i_path->size(); ++i) - { - WaypointData const* node = i_path->at(i); - pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); - } - me->GetMotionMaster()->MoveSplinePath(&pathPoints); - } - } + void UpdateAI(uint32 diff) + { + if (startPath) + { + me->StopMoving(); + startPath = false; + if (WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath())) + { + Movement::PointsArray pathPoints; + pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + for (uint8 i = 0; i < i_path->size(); ++i) + { + WaypointData const* node = i_path->at(i); + pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); + } + me->GetMotionMaster()->MoveSplinePath(&pathPoints); + } + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case EVENT_ENRAGE: - me->CastSpell(me, SPELL_BERSERK, true); - events.RepeatEvent(600000); - break; - case EVENT_COMMANDER_SAY_AGGRO: - if (Creature* commander = ObjectAccessor::GetCreature(*me, CommanderGUID)) - commander->AI()->Talk(SAY_COMMANDER_AGGRO); - events.PopEvent(); - break; - case EVENT_EE_SAY_MOVE_OUT: - for (uint8 i=0; i<3; ++i) - if (Creature* c = ObjectAccessor::GetCreature(*me, ExpeditionEngineerGUIDs[i])) - { - if (!i) - c->MonsterYell(TEXT_EE_MOVE_OUT, LANG_UNIVERSAL, 0); - c->AI()->SetData(1, 0); // start repairing - } - events.PopEvent(); - break; - case EVENT_SPELL_FIREBALL: - if( Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true) ) - me->CastSpell(pTarget, SPELL_FIREBALL, false); - events.RepeatEvent(4000); - break; - case EVENT_SPELL_DEVOURING_FLAME: - if( Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true) ) - me->CastSpell(pTarget, SPELL_DEVOURINGFLAME, false); - events.RepeatEvent(13000); - break; - case EVENT_SUMMON_MOLE_MACHINES: - { - memset(cords, '\0', sizeof(cords)); - uint8 num = RAID_MODE( urand(2,3), urand(2,4) ); - for( int i=0; iSummonGameObject(GO_DRILL, cords[i][0], cords[i][1], 391.1f, M_PI/4, 0.0f, 0.0f, 0.0f, 0.0f, 8) ) - { - //drill->SetGoAnimProgress(0); - //drill->SetLootState(GO_READY); - //drill->UseDoorOrButton(8); - //drill->SetGoState(GO_STATE_READY); - drill->SetGoState(GO_STATE_ACTIVE); - drill->SetGoAnimProgress(0); - } - } - events.RepeatEvent(45000); - events.RescheduleEvent(EVENT_SUMMON_ADDS, 4000); - } - break; - case EVENT_SUMMON_ADDS: - for( int i=0; i<4; ++i ) - { - if( !cords[i][0] ) - break; + switch (events.GetEvent()) + { + case 0: + break; + case EVENT_ENRAGE: + me->CastSpell(me, SPELL_BERSERK, true); + events.RepeatEvent(600000); + break; + case EVENT_COMMANDER_SAY_AGGRO: + if (Creature* commander = ObjectAccessor::GetCreature(*me, CommanderGUID)) + commander->AI()->Talk(SAY_COMMANDER_AGGRO); + events.PopEvent(); + break; + case EVENT_EE_SAY_MOVE_OUT: + for (uint8 i=0; i<3; ++i) + if (Creature* c = ObjectAccessor::GetCreature(*me, ExpeditionEngineerGUIDs[i])) + { + if (!i) + c->MonsterYell(TEXT_EE_MOVE_OUT, LANG_UNIVERSAL, 0); + c->AI()->SetData(1, 0); // start repairing + } + events.PopEvent(); + break; + case EVENT_SPELL_FIREBALL: + if( Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true) ) + me->CastSpell(pTarget, SPELL_FIREBALL, false); + events.RepeatEvent(4000); + break; + case EVENT_SPELL_DEVOURING_FLAME: + if( Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true) ) + me->CastSpell(pTarget, SPELL_DEVOURINGFLAME, false); + events.RepeatEvent(13000); + break; + case EVENT_SUMMON_MOLE_MACHINES: + { + memset(cords, '\0', sizeof(cords)); + uint8 num = RAID_MODE( urand(2,3), urand(2,4) ); + for( int i=0; iSummonGameObject(GO_DRILL, cords[i][0], cords[i][1], 391.1f, M_PI/4, 0.0f, 0.0f, 0.0f, 0.0f, 8) ) + { + //drill->SetGoAnimProgress(0); + //drill->SetLootState(GO_READY); + //drill->UseDoorOrButton(8); + //drill->SetGoState(GO_STATE_READY); + drill->SetGoState(GO_STATE_ACTIVE); + drill->SetGoAnimProgress(0); + } + } + events.RepeatEvent(45000); + events.RescheduleEvent(EVENT_SUMMON_ADDS, 4000); + } + break; + case EVENT_SUMMON_ADDS: + for( int i=0; i<4; ++i ) + { + if( !cords[i][0] ) + break; - uint8 opt; - uint8 r = urand(1,100); - if( r <= 30 ) opt = 1; - else if( r <= 65 ) opt = 2; - else opt = 3; + uint8 opt; + uint8 r = urand(1,100); + if( r <= 30 ) opt = 1; + else if( r <= 65 ) opt = 2; + else opt = 3; - for( int j=0; j<4; ++j ) - { - float x = cords[i][0] + 4.0f*cos(j*M_PI/2); - float y = cords[i][1] + 4.0f*sin(j*M_PI/2); + for( int j=0; j<4; ++j ) + { + float x = cords[i][0] + 4.0f*cos(j*M_PI/2); + float y = cords[i][1] + 4.0f*sin(j*M_PI/2); - uint32 npc_entry = 0; - switch( opt ) - { - case 1: if( j == 1 ) npc_entry = NPC_DARK_RUNE_SENTINEL; break; - case 2: - switch( j ) - { - case 1: npc_entry = NPC_DARK_RUNE_WATCHER; break; - case 2: npc_entry = NPC_DARK_RUNE_GUARDIAN; break; - } - break; - default: // case 3: - switch( j ) - { - case 1: npc_entry = NPC_DARK_RUNE_WATCHER; break; - case 2: npc_entry = NPC_DARK_RUNE_GUARDIAN; break; - case 3: npc_entry = NPC_DARK_RUNE_GUARDIAN; break; - } - break; - } + uint32 npc_entry = 0; + switch( opt ) + { + case 1: if( j == 1 ) npc_entry = NPC_DARK_RUNE_SENTINEL; break; + case 2: + switch( j ) + { + case 1: npc_entry = NPC_DARK_RUNE_WATCHER; break; + case 2: npc_entry = NPC_DARK_RUNE_GUARDIAN; break; + } + break; + default: // case 3: + switch( j ) + { + case 1: npc_entry = NPC_DARK_RUNE_WATCHER; break; + case 2: npc_entry = NPC_DARK_RUNE_GUARDIAN; break; + case 3: npc_entry = NPC_DARK_RUNE_GUARDIAN; break; + } + break; + } - if( npc_entry ) - if (Creature* c = me->SummonCreature(npc_entry, x, y, 391.1f, j*M_PI/2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) - DoZoneInCombat(c); + if( npc_entry ) + if (Creature* c = me->SummonCreature(npc_entry, x, y, 391.1f, j*M_PI/2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) + DoZoneInCombat(c); - } - } - events.PopEvent(); - break; - case EVENT_WARN_DEEP_BREATH: - me->MonsterTextEmote(TEXT_DEEP_BREATH, 0, true); - me->RemoveAura(62794); - events.PopEvent(); - events.ScheduleEvent(EVENT_PHASE2_FLAME_BREATH, 2500); - break; - case EVENT_PHASE2_FLAME_BREATH: - me->CastSpell(me, S_FLAMEBREATH, true); - events.PopEvent(); - events.ScheduleEvent(EVENT_FLY_UP, 2000); - break; - case EVENT_FLY_UP: - me->SetInCombatWithZone(); // just in case - if (pInstance) - for( int i=0; i<4; ++i ) - if( uint64 guid = pInstance->GetData64(DATA_HARPOON_FIRE_STATE_1 + i) ) - if( Creature* hfs = ObjectAccessor::GetCreature(*me, guid) ) - { - me->SummonCreature(34188, hfs->GetPositionX(), hfs->GetPositionY(), hfs->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 22000); - hfs->AI()->SetData(1, 0); - } + } + } + events.PopEvent(); + break; + case EVENT_WARN_DEEP_BREATH: + me->MonsterTextEmote(TEXT_DEEP_BREATH, 0, true); + me->RemoveAura(62794); + events.PopEvent(); + events.ScheduleEvent(EVENT_PHASE2_FLAME_BREATH, 2500); + break; + case EVENT_PHASE2_FLAME_BREATH: + me->CastSpell(me, S_FLAMEBREATH, true); + events.PopEvent(); + events.ScheduleEvent(EVENT_FLY_UP, 2000); + break; + case EVENT_FLY_UP: + me->SetInCombatWithZone(); // just in case + if (pInstance) + for( int i=0; i<4; ++i ) + if( uint64 guid = pInstance->GetData64(DATA_HARPOON_FIRE_STATE_1 + i) ) + if( Creature* hfs = ObjectAccessor::GetCreature(*me, guid) ) + { + me->SummonCreature(34188, hfs->GetPositionX(), hfs->GetPositionY(), hfs->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 22000); + hfs->AI()->SetData(1, 0); + } - me->RemoveAura(SPELL_LAUNCH_CHAIN); - me->RemoveAura(SPELL_CHAIN_1); - me->RemoveAura(SPELL_CHAIN_3); - if (RAID_MODE(0,1)) - { - me->RemoveAura(SPELL_CHAIN_2); - me->RemoveAura(SPELL_CHAIN_4); - } - me->CastSpell(me, SPELL_WINGBUFFET, true); - - if( (me->GetHealth()*100) / me->GetMaxHealth() < 50 ) // start phase 3 - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - DoResetThreat(); - Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0, true); - if (!target) - target = me->SelectNearestPlayer(200.0f); - if (target) - { - AttackStart(target); - me->GetMotionMaster()->MoveChase(target); - } - bGroundPhase = true; - events.PopEvent(); - events.CancelEvent(EVENT_SPELL_FIREBALL); - events.CancelEvent(EVENT_SPELL_DEVOURING_FLAME); - events.CancelEvent(EVENT_SUMMON_MOLE_MACHINES); + me->RemoveAura(SPELL_LAUNCH_CHAIN); + me->RemoveAura(SPELL_CHAIN_1); + me->RemoveAura(SPELL_CHAIN_3); + if (RAID_MODE(0,1)) + { + me->RemoveAura(SPELL_CHAIN_2); + me->RemoveAura(SPELL_CHAIN_4); + } + me->CastSpell(me, SPELL_WINGBUFFET, true); + + if( (me->GetHealth()*100) / me->GetMaxHealth() < 50 ) // start phase 3 + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + DoResetThreat(); + Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 0.0, true); + if (!target) + target = me->SelectNearestPlayer(200.0f); + if (target) + { + AttackStart(target); + me->GetMotionMaster()->MoveChase(target); + } + bGroundPhase = true; + events.PopEvent(); + events.CancelEvent(EVENT_SPELL_FIREBALL); + events.CancelEvent(EVENT_SPELL_DEVOURING_FLAME); + events.CancelEvent(EVENT_SUMMON_MOLE_MACHINES); - events.ScheduleEvent(EVENT_SPELL_FLAME_BREATH, 20000); - events.ScheduleEvent(EVENT_SPELL_DEVOURING_FLAME_GROUND, 5000); - events.ScheduleEvent(EVENT_SPELL_FUSE_ARMOR, 10000); - events.ScheduleEvent(EVENT_SPELL_FLAME_BUFFET, 3000); + events.ScheduleEvent(EVENT_SPELL_FLAME_BREATH, 20000); + events.ScheduleEvent(EVENT_SPELL_DEVOURING_FLAME_GROUND, 5000); + events.ScheduleEvent(EVENT_SPELL_FUSE_ARMOR, 10000); + events.ScheduleEvent(EVENT_SPELL_FLAME_BUFFET, 3000); - break; - } - else - { - ++flyTimes; - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - me->SendMeleeAttackStop(me->GetVictim()); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->SetCanFly(true); - me->SetDisableGravity(true); - me->SetHover(true); - me->SendMovementFlagUpdate(); - me->GetMotionMaster()->MoveTakeoff(1, CORDS_AIR, 25.0f); - events.ScheduleEvent(EVENT_RESUME_FIXING, 22000); - } + break; + } + else + { + ++flyTimes; + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + me->SendMeleeAttackStop(me->GetVictim()); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + me->SendMovementFlagUpdate(); + me->GetMotionMaster()->MoveTakeoff(1, CORDS_AIR, 25.0f); + events.ScheduleEvent(EVENT_RESUME_FIXING, 22000); + } - events.PopEvent(); - break; - case EVENT_RESUME_FIXING: - for (uint8 i=0; i<3; ++i) - if (Creature* c = ObjectAccessor::GetCreature(*me, ExpeditionEngineerGUIDs[i])) - { - if (!i) - c->MonsterYell(TEXT_EE_FIRES_OUT, LANG_UNIVERSAL, 0); - c->AI()->SetData(1, 0); // start repairing - } - events.PopEvent(); - break; - case EVENT_SPELL_FLAME_BREATH: - me->CastSpell(me->GetVictim(), S_FLAMEBREATH, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_DEVOURING_FLAME_GROUND: - me->CastSpell(me->GetVictim(), SPELL_DEVOURINGFLAME, false); - events.RepeatEvent(13000); - break; - case EVENT_SPELL_FUSE_ARMOR: - if (Unit* victim = me->GetVictim()) - if (me->IsWithinMeleeRange(victim)) - { - me->CastSpell(victim, SPELL_FUSEARMOR, false); - if (Aura* aur = victim->GetAura(SPELL_FUSEARMOR)) - if (aur->GetStackAmount() == 5) - victim->CastSpell(victim, 64774, true); - events.RepeatEvent(10000); - break; - } - events.RepeatEvent(2000); - break; - case EVENT_SPELL_FLAME_BUFFET: - me->CastSpell(me->GetVictim(), S_FLAMEBUFFET, false); - events.RepeatEvent(7000); - break; - } + events.PopEvent(); + break; + case EVENT_RESUME_FIXING: + for (uint8 i=0; i<3; ++i) + if (Creature* c = ObjectAccessor::GetCreature(*me, ExpeditionEngineerGUIDs[i])) + { + if (!i) + c->MonsterYell(TEXT_EE_FIRES_OUT, LANG_UNIVERSAL, 0); + c->AI()->SetData(1, 0); // start repairing + } + events.PopEvent(); + break; + case EVENT_SPELL_FLAME_BREATH: + me->CastSpell(me->GetVictim(), S_FLAMEBREATH, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_DEVOURING_FLAME_GROUND: + me->CastSpell(me->GetVictim(), SPELL_DEVOURINGFLAME, false); + events.RepeatEvent(13000); + break; + case EVENT_SPELL_FUSE_ARMOR: + if (Unit* victim = me->GetVictim()) + if (me->IsWithinMeleeRange(victim)) + { + me->CastSpell(victim, SPELL_FUSEARMOR, false); + if (Aura* aur = victim->GetAura(SPELL_FUSEARMOR)) + if (aur->GetStackAmount() == 5) + victim->CastSpell(victim, 64774, true); + events.RepeatEvent(10000); + break; + } + events.RepeatEvent(2000); + break; + case EVENT_SPELL_FLAME_BUFFET: + me->CastSpell(me->GetVictim(), S_FLAMEBUFFET, false); + events.RepeatEvent(7000); + break; + } - if (bGroundPhase) - DoMeleeAttackIfReady(); - } + if (bGroundPhase) + DoMeleeAttackIfReady(); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void JustReachedHome() - { - startPath = true; - } + void JustReachedHome() + { + startPath = true; + } - void JustSummoned(Creature* s) - { - summons.Summon(s); - } + void JustSummoned(Creature* s) + { + summons.Summon(s); + } - uint32 GetData(uint32 id) const - { - if (id == 1) - return (flyTimes <= 1 ? 1 : 0); - return 0; - } + uint32 GetData(uint32 id) const + { + if (id == 1) + return (flyTimes <= 1 ? 1 : 0); + return 0; + } - void KilledUnit(Unit* victim) - { - if (victim && victim->GetEntry() == NPC_DARK_RUNE_GUARDIAN) - if (pInstance) - pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, NPC_DARK_RUNE_GUARDIAN, 1, me); - } + void KilledUnit(Unit* victim) + { + if (victim && victim->GetEntry() == NPC_DARK_RUNE_GUARDIAN) + if (pInstance) + pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, NPC_DARK_RUNE_GUARDIAN, 1, me); + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - ScriptedAI::EnterEvadeMode(); - } - }; + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + ScriptedAI::EnterEvadeMode(); + } + }; }; class npc_ulduar_expedition_commander : public CreatureScript { - public: - npc_ulduar_expedition_commander() : CreatureScript("npc_ulduar_expedition_commander") { } + public: + npc_ulduar_expedition_commander() : CreatureScript("npc_ulduar_expedition_commander") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (!player || !creature) - return true; + bool OnGossipHello(Player* player, Creature* creature) + { + if (!player || !creature) + return true; - InstanceScript* instance = creature->GetInstanceScript(); - if (!instance) - return true; + InstanceScript* instance = creature->GetInstanceScript(); + if (!instance) + return true; - if (instance->GetData(TYPE_RAZORSCALE) == DONE) - return true; + if (instance->GetData(TYPE_RAZORSCALE) == DONE) + return true; - Creature* razorscale = ObjectAccessor::GetCreature(*creature, instance->GetData64(TYPE_RAZORSCALE)); - if (!razorscale || razorscale->IsInCombat()) - return true; + Creature* razorscale = ObjectAccessor::GetCreature(*creature, instance->GetData64(TYPE_RAZORSCALE)); + if (!razorscale || razorscale->IsInCombat()) + return true; - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TEXT_GOSSIP_ACTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->PlayerTalkClass->SendGossipMenu(40100, creature->GetGUID()); - return true; - } + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TEXT_GOSSIP_ACTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->PlayerTalkClass->SendGossipMenu(40100, creature->GetGUID()); + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) - { - if (!player || !creature) - return true; + bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + { + if (!player || !creature) + return true; - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - InstanceScript* instance = creature->GetInstanceScript(); - if (!instance || instance->GetData(TYPE_RAZORSCALE) == DONE) - return true; + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + InstanceScript* instance = creature->GetInstanceScript(); + if (!instance || instance->GetData(TYPE_RAZORSCALE) == DONE) + return true; - Creature* razorscale = ObjectAccessor::GetCreature(*creature, instance->GetData64(TYPE_RAZORSCALE)); - if (razorscale && !razorscale->IsInCombat()) - { - // reset npcs NPC_HARPOON_FIRE_STATE - for (uint8 i = 0; i < 4; ++i) - if (Creature* hfs = ObjectAccessor::GetCreature(*creature, instance->GetData64(DATA_HARPOON_FIRE_STATE_1 + i))) - hfs->AI()->SetData(1, 0); + Creature* razorscale = ObjectAccessor::GetCreature(*creature, instance->GetData64(TYPE_RAZORSCALE)); + if (razorscale && !razorscale->IsInCombat()) + { + // reset npcs NPC_HARPOON_FIRE_STATE + for (uint8 i = 0; i < 4; ++i) + if (Creature* hfs = ObjectAccessor::GetCreature(*creature, instance->GetData64(DATA_HARPOON_FIRE_STATE_1 + i))) + hfs->AI()->SetData(1, 0); - if (razorscale->AI()) - { - razorscale->AI()->AttackStart(player); - razorscale->GetMotionMaster()->MoveIdle(); - razorscale->GetMotionMaster()->MovePoint(POINT_RAZORSCALE_INIT, 588.0f, -178.0f, 490.0f, false, false); - } - } - } + if (razorscale->AI()) + { + razorscale->AI()->AttackStart(player); + razorscale->GetMotionMaster()->MoveIdle(); + razorscale->GetMotionMaster()->MovePoint(POINT_RAZORSCALE_INIT, 588.0f, -178.0f, 490.0f, false, false); + } + } + } - player->PlayerTalkClass->SendCloseGossip(); - return true; - } + player->PlayerTalkClass->SendCloseGossip(); + return true; + } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct npc_ulduar_expedition_commanderAI : public NullCreatureAI - { - npc_ulduar_expedition_commanderAI(Creature* creature) : NullCreatureAI(creature) - { - _instance = creature->GetInstanceScript(); - _introSpoken = _instance->GetData(TYPE_RAZORSCALE) == DONE; - me->SetReactState(REACT_AGGRESSIVE); - } + struct npc_ulduar_expedition_commanderAI : public NullCreatureAI + { + npc_ulduar_expedition_commanderAI(Creature* creature) : NullCreatureAI(creature) + { + _instance = creature->GetInstanceScript(); + _introSpoken = _instance->GetData(TYPE_RAZORSCALE) == DONE; + me->SetReactState(REACT_AGGRESSIVE); + } - void MoveInLineOfSight(Unit* who) - { - if (_introSpoken) - return; + void MoveInLineOfSight(Unit* who) + { + if (_introSpoken) + return; - if (who->GetTypeId() != TYPEID_PLAYER || me->GetExactDist2d(who) > 15.0f) - return; + if (who->GetTypeId() != TYPEID_PLAYER || me->GetExactDist2d(who) > 15.0f) + return; - _introSpoken = true; - Talk(SAY_COMMANDER_INTRO); - } + _introSpoken = true; + Talk(SAY_COMMANDER_INTRO); + } - private: - InstanceScript* _instance; - bool _introSpoken; - }; + private: + InstanceScript* _instance; + bool _introSpoken; + }; }; class npc_ulduar_harpoonfirestate : public CreatureScript @@ -678,94 +678,94 @@ public: return new npc_ulduar_harpoonfirestateAI (pCreature); } - struct npc_ulduar_harpoonfirestateAI : public NullCreatureAI - { - npc_ulduar_harpoonfirestateAI(Creature *pCreature) : NullCreatureAI(pCreature) - { - pInstance = me->GetInstanceScript(); - } + struct npc_ulduar_harpoonfirestateAI : public NullCreatureAI + { + npc_ulduar_harpoonfirestateAI(Creature *pCreature) : NullCreatureAI(pCreature) + { + pInstance = me->GetInstanceScript(); + } - InstanceScript* pInstance; - uint8 repairPoints; - - void Reset() - { - repairPoints = 0; - } + InstanceScript* pInstance; + uint8 repairPoints; + + void Reset() + { + repairPoints = 0; + } - uint32 GetHarpoonGunIdForThisHFS() - { - if (pInstance) - { - if( me->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_1) ) - return GO_HARPOON_GUN_1; - else if( me->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_2) ) - return GO_HARPOON_GUN_2; - else if( me->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_3) ) - return GO_HARPOON_GUN_3; - else - return GO_HARPOON_GUN_4; - } - return 0; - } + uint32 GetHarpoonGunIdForThisHFS() + { + if (pInstance) + { + if( me->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_1) ) + return GO_HARPOON_GUN_1; + else if( me->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_2) ) + return GO_HARPOON_GUN_2; + else if( me->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_3) ) + return GO_HARPOON_GUN_3; + else + return GO_HARPOON_GUN_4; + } + return 0; + } - void SetData(uint32 id, uint32 value) - { - switch (id) - { - case 1: // cleanup at the start of the fight - if (pInstance) - { - uint32 h_entry = GetHarpoonGunIdForThisHFS(); - if( GameObject* wh = me->FindNearestGameObject(h_entry, 5.0f) ) - { - wh->SetRespawnTime(0); - wh->Delete(); - } - if( GameObject* bh = me->FindNearestGameObject(GO_BROKEN_HARPOON, 5.0f) ) - if (bh->GetPhaseMask() != 1) - bh->SetPhaseMask(1, true); - } - Reset(); - break; - case 2: // repairing - if (repairPoints < REPAIR_POINTS) - { - if (++repairPoints >= REPAIR_POINTS) - { - if( GameObject* bh = me->FindNearestGameObject(GO_BROKEN_HARPOON, 4.0f) ) - bh->SetPhaseMask(2, true); - if( GameObject* wh = me->SummonGameObject(GetHarpoonGunIdForThisHFS(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 3*M_PI/2, 0.0f, 0.0f, 0.0f, 0.0f, 0) ) - { - me->RemoveGameObject(wh, false); - me->MonsterTextEmote(TEXT_TURRET_READY, 0, true); - } - } - } - break; - case 3: // shoot - if (pInstance) - { - Creature* razorscale = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_RAZORSCALE)); - if (!razorscale) - return; - if (!razorscale->HasAura(value)) - me->CastSpell(razorscale, SPELL_LAUNCH_CHAIN, true); - } - break; - } - } + void SetData(uint32 id, uint32 value) + { + switch (id) + { + case 1: // cleanup at the start of the fight + if (pInstance) + { + uint32 h_entry = GetHarpoonGunIdForThisHFS(); + if( GameObject* wh = me->FindNearestGameObject(h_entry, 5.0f) ) + { + wh->SetRespawnTime(0); + wh->Delete(); + } + if( GameObject* bh = me->FindNearestGameObject(GO_BROKEN_HARPOON, 5.0f) ) + if (bh->GetPhaseMask() != 1) + bh->SetPhaseMask(1, true); + } + Reset(); + break; + case 2: // repairing + if (repairPoints < REPAIR_POINTS) + { + if (++repairPoints >= REPAIR_POINTS) + { + if( GameObject* bh = me->FindNearestGameObject(GO_BROKEN_HARPOON, 4.0f) ) + bh->SetPhaseMask(2, true); + if( GameObject* wh = me->SummonGameObject(GetHarpoonGunIdForThisHFS(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 3*M_PI/2, 0.0f, 0.0f, 0.0f, 0.0f, 0) ) + { + me->RemoveGameObject(wh, false); + me->MonsterTextEmote(TEXT_TURRET_READY, 0, true); + } + } + } + break; + case 3: // shoot + if (pInstance) + { + Creature* razorscale = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_RAZORSCALE)); + if (!razorscale) + return; + if (!razorscale->HasAura(value)) + me->CastSpell(razorscale, SPELL_LAUNCH_CHAIN, true); + } + break; + } + } - uint32 GetData(uint32 id) const - { - switch (id) - { - case 2: - return (repairPoints >= REPAIR_POINTS ? 1 : 0); - } - return 0; - } - }; + uint32 GetData(uint32 id) const + { + switch (id) + { + case 2: + return (repairPoints >= REPAIR_POINTS ? 1 : 0); + } + return 0; + } + }; }; class npc_ulduar_expedition_engineer : public CreatureScript @@ -778,102 +778,102 @@ public: return new npc_ulduar_expedition_engineerAI (pCreature); } - struct npc_ulduar_expedition_engineerAI : public NullCreatureAI - { - npc_ulduar_expedition_engineerAI(Creature *pCreature) : NullCreatureAI(pCreature) - { - pInstance = me->GetInstanceScript(); - } + struct npc_ulduar_expedition_engineerAI : public NullCreatureAI + { + npc_ulduar_expedition_engineerAI(Creature *pCreature) : NullCreatureAI(pCreature) + { + pInstance = me->GetInstanceScript(); + } - InstanceScript* pInstance; - bool working; - uint16 timer; - uint64 fixingGUID; + InstanceScript* pInstance; + bool working; + uint16 timer; + uint64 fixingGUID; - void Reset() - { - working = false; - timer = 0; - fixingGUID = 0; - } + void Reset() + { + working = false; + timer = 0; + fixingGUID = 0; + } - void SetData(uint32 id, uint32 value) - { - switch (id) - { - case 1: // start/resume repairing - working = true; - timer = 0; - fixingGUID = 0; - break; - case 2: // stop repairing - Reset(); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STAND); - me->GetMotionMaster()->MoveTargetedHome(); - break; - } - } + void SetData(uint32 id, uint32 value) + { + switch (id) + { + case 1: // start/resume repairing + working = true; + timer = 0; + fixingGUID = 0; + break; + case 2: // stop repairing + Reset(); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STAND); + me->GetMotionMaster()->MoveTargetedHome(); + break; + } + } - void UpdateAI(uint32 diff) - { - if (working) - { - if (timer <= diff) - { - timer = 3000; + void UpdateAI(uint32 diff) + { + if (working) + { + if (timer <= diff) + { + timer = 3000; - if (fixingGUID) - { - if (Creature* c = ObjectAccessor::GetCreature(*me, fixingGUID)) - if (me->GetExactDist2dSq(c) <= 25.0f) - { - if( me->GetUInt32Value(UNIT_NPC_EMOTESTATE) != EMOTE_STATE_WORK ) - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_WORK); + if (fixingGUID) + { + if (Creature* c = ObjectAccessor::GetCreature(*me, fixingGUID)) + if (me->GetExactDist2dSq(c) <= 25.0f) + { + if( me->GetUInt32Value(UNIT_NPC_EMOTESTATE) != EMOTE_STATE_WORK ) + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_WORK); - if (fabs(me->GetOrientation()-me->GetAngle(c)) > M_PI/4) - me->SetFacingToObject(c); + if (fabs(me->GetOrientation()-me->GetAngle(c)) > M_PI/4) + me->SetFacingToObject(c); - c->AI()->SetData(2, 0); - if (c->AI()->GetData(2)) - fixingGUID = 0; - } - } + c->AI()->SetData(2, 0); + if (c->AI()->GetData(2)) + fixingGUID = 0; + } + } - if (!fixingGUID) - { - Creature* razorscale = NULL; - if( uint64 rsGUID = pInstance->GetData64(TYPE_RAZORSCALE) ) - razorscale = ObjectAccessor::GetCreature(*me, rsGUID); + if (!fixingGUID) + { + Creature* razorscale = NULL; + if( uint64 rsGUID = pInstance->GetData64(TYPE_RAZORSCALE) ) + razorscale = ObjectAccessor::GetCreature(*me, rsGUID); - if( !razorscale || !razorscale->IsInCombat() ) - { - Reset(); - me->GetMotionMaster()->MoveTargetedHome(); - return; - } + if( !razorscale || !razorscale->IsInCombat() ) + { + Reset(); + me->GetMotionMaster()->MoveTargetedHome(); + return; + } - for( int i=0; i<4; ++i ) - if( uint64 fs_GUID = pInstance->GetData64(DATA_HARPOON_FIRE_STATE_1 + i) ) - if( Creature* fs = ObjectAccessor::GetCreature(*me, fs_GUID) ) - if (!fs->AI()->GetData(2)) - { - float a = rand_norm()*M_PI; - me->GetMotionMaster()->MovePoint(0, fs->GetPositionX()+3.0f*cos(a), fs->GetPositionY()+3.0f*sin(a), fs->GetPositionZ()); - fixingGUID = fs->GetGUID(); - return; - } + for( int i=0; i<4; ++i ) + if( uint64 fs_GUID = pInstance->GetData64(DATA_HARPOON_FIRE_STATE_1 + i) ) + if( Creature* fs = ObjectAccessor::GetCreature(*me, fs_GUID) ) + if (!fs->AI()->GetData(2)) + { + float a = rand_norm()*M_PI; + me->GetMotionMaster()->MovePoint(0, fs->GetPositionX()+3.0f*cos(a), fs->GetPositionY()+3.0f*sin(a), fs->GetPositionZ()); + fixingGUID = fs->GetGUID(); + return; + } - Reset(); // all harpoons repaired - me->GetMotionMaster()->MoveTargetedHome(); - } - } - else - timer -= diff; - } - else if (me->GetUInt32Value(UNIT_NPC_EMOTESTATE) == EMOTE_STATE_WORK) - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STAND); - } - }; + Reset(); // all harpoons repaired + me->GetMotionMaster()->MoveTargetedHome(); + } + } + else + timer -= diff; + } + else if (me->GetUInt32Value(UNIT_NPC_EMOTESTATE) == EMOTE_STATE_WORK) + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STAND); + } + }; }; class go_ulduar_working_harpoon : public GameObjectScript @@ -881,55 +881,55 @@ class go_ulduar_working_harpoon : public GameObjectScript public: go_ulduar_working_harpoon() : GameObjectScript("go_ulduar_working_harpoon") { } - bool OnGossipHello(Player* user, GameObject* go) - { - if( !user || !go ) - return true; + bool OnGossipHello(Player* user, GameObject* go) + { + if( !user || !go ) + return true; - InstanceScript* pInstance = go->GetInstanceScript(); - if( !pInstance ) - return true; + InstanceScript* pInstance = go->GetInstanceScript(); + if( !pInstance ) + return true; - Creature* rs = NULL; - if( uint64 rsGUID = pInstance->GetData64(TYPE_RAZORSCALE) ) - rs = ObjectAccessor::GetCreature(*go, rsGUID); + Creature* rs = NULL; + if( uint64 rsGUID = pInstance->GetData64(TYPE_RAZORSCALE) ) + rs = ObjectAccessor::GetCreature(*go, rsGUID); - if( !rs || !rs->IsInCombat() ) - { - go->SetRespawnTime(0); - go->Delete(); - return true; - } + if( !rs || !rs->IsInCombat() ) + { + go->SetRespawnTime(0); + go->Delete(); + return true; + } - uint32 npc = 0; - uint32 spell = 0; - switch( go->GetEntry() ) - { - case GO_HARPOON_GUN_1: - npc = DATA_HARPOON_FIRE_STATE_1; - spell = SPELL_CHAIN_1; - break; - case GO_HARPOON_GUN_2: - npc = DATA_HARPOON_FIRE_STATE_2; - spell = SPELL_CHAIN_2; - break; - case GO_HARPOON_GUN_3: - npc = DATA_HARPOON_FIRE_STATE_3; - spell = SPELL_CHAIN_3; - break; - case GO_HARPOON_GUN_4: - npc = DATA_HARPOON_FIRE_STATE_4; - spell = SPELL_CHAIN_4; - break; - } + uint32 npc = 0; + uint32 spell = 0; + switch( go->GetEntry() ) + { + case GO_HARPOON_GUN_1: + npc = DATA_HARPOON_FIRE_STATE_1; + spell = SPELL_CHAIN_1; + break; + case GO_HARPOON_GUN_2: + npc = DATA_HARPOON_FIRE_STATE_2; + spell = SPELL_CHAIN_2; + break; + case GO_HARPOON_GUN_3: + npc = DATA_HARPOON_FIRE_STATE_3; + spell = SPELL_CHAIN_3; + break; + case GO_HARPOON_GUN_4: + npc = DATA_HARPOON_FIRE_STATE_4; + spell = SPELL_CHAIN_4; + break; + } - if( uint64 g = pInstance->GetData64(npc) ) - if( Creature* hfs = ObjectAccessor::GetCreature(*go, g) ) - hfs->AI()->SetData(3, spell); - - go->SetLootState(GO_JUST_DEACTIVATED); - return true; - } + if( uint64 g = pInstance->GetData64(npc) ) + if( Creature* hfs = ObjectAccessor::GetCreature(*go, g) ) + hfs->AI()->SetData(3, spell); + + go->SetLootState(GO_JUST_DEACTIVATED); + return true; + } }; class npc_ulduar_dark_rune_guardian : public CreatureScript @@ -942,41 +942,41 @@ public: return new npc_ulduar_dark_rune_guardianAI (pCreature); } - struct npc_ulduar_dark_rune_guardianAI : public ScriptedAI - { - npc_ulduar_dark_rune_guardianAI(Creature *pCreature) : ScriptedAI(pCreature) { } + struct npc_ulduar_dark_rune_guardianAI : public ScriptedAI + { + npc_ulduar_dark_rune_guardianAI(Creature *pCreature) : ScriptedAI(pCreature) { } - uint32 timer2; + uint32 timer2; - void Reset() - { - timer2 = 6000; - } + void Reset() + { + timer2 = 6000; + } - bool CanAIAttack(const Unit* target) const - { - return target && target->GetEntry() != NPC_RAZORSCALE; - } + bool CanAIAttack(const Unit* target) const + { + return target && target->GetEntry() != NPC_RAZORSCALE; + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - if (timer2 <= diff) timer2 = 0; - else timer2 -= diff; - if (timer2 == 0 && me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) - { - me->CastSpell(me->GetVictim(), 65971, true); - me->CastSpell(me->GetVictim(), 65971, true); // me->CastSpell(me->GetVictim(), 65972, true); // cast the same twice cus second one requires setting offhand damage - me->CastSpell(me->GetVictim(), 64757, true); - timer2 = urand(8000, 10000); - return; - } + if (timer2 <= diff) timer2 = 0; + else timer2 -= diff; + if (timer2 == 0 && me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) + { + me->CastSpell(me->GetVictim(), 65971, true); + me->CastSpell(me->GetVictim(), 65971, true); // me->CastSpell(me->GetVictim(), 65972, true); // cast the same twice cus second one requires setting offhand damage + me->CastSpell(me->GetVictim(), 64757, true); + timer2 = urand(8000, 10000); + return; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_ulduar_dark_rune_watcher : public CreatureScript @@ -989,50 +989,50 @@ public: return new npc_ulduar_dark_rune_watcherAI (pCreature); } - struct npc_ulduar_dark_rune_watcherAI : public ScriptedAI - { - npc_ulduar_dark_rune_watcherAI(Creature *pCreature) : ScriptedAI(pCreature) { } + struct npc_ulduar_dark_rune_watcherAI : public ScriptedAI + { + npc_ulduar_dark_rune_watcherAI(Creature *pCreature) : ScriptedAI(pCreature) { } - uint32 timer1; - uint32 timer2; + uint32 timer1; + uint32 timer2; - void Reset() - { - timer1 = 6000; - timer2 = 2000; - } + void Reset() + { + timer1 = 6000; + timer2 = 2000; + } - bool CanAIAttack(const Unit* target) const - { - return target && target->GetEntry() != NPC_RAZORSCALE; - } + bool CanAIAttack(const Unit* target) const + { + return target && target->GetEntry() != NPC_RAZORSCALE; + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - if( timer1 <= diff ) - { - me->CastSpell(me->GetVictim(), RAID_MODE(64758, 64759), false); - timer1 = urand(10000, 12000); - return; - } - else - timer1 -= diff; + if( timer1 <= diff ) + { + me->CastSpell(me->GetVictim(), RAID_MODE(64758, 64759), false); + timer1 = urand(10000, 12000); + return; + } + else + timer1 -= diff; - if (timer2 <= diff) - { - me->CastSpell(me->GetVictim(), RAID_MODE(63809, 64696), false); - timer2 = 4000; - return; - } - else - timer2 -= diff; + if (timer2 <= diff) + { + me->CastSpell(me->GetVictim(), RAID_MODE(63809, 64696), false); + timer2 = 4000; + return; + } + else + timer2 -= diff; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_ulduar_dark_rune_sentinel : public CreatureScript @@ -1045,48 +1045,48 @@ public: return new npc_ulduar_dark_rune_sentinelAI (pCreature); } - struct npc_ulduar_dark_rune_sentinelAI : public ScriptedAI - { - npc_ulduar_dark_rune_sentinelAI(Creature *pCreature) : ScriptedAI(pCreature) { } + struct npc_ulduar_dark_rune_sentinelAI : public ScriptedAI + { + npc_ulduar_dark_rune_sentinelAI(Creature *pCreature) : ScriptedAI(pCreature) { } - uint32 timer1; - uint32 timer2; + uint32 timer1; + uint32 timer2; - void Reset() - { - timer1 = urand(1000,2000); - timer2 = 6000; - } + void Reset() + { + timer1 = urand(1000,2000); + timer2 = 6000; + } - bool CanAIAttack(const Unit* target) const - { - return target && target->GetEntry() != NPC_RAZORSCALE; - } + bool CanAIAttack(const Unit* target) const + { + return target && target->GetEntry() != NPC_RAZORSCALE; + } - void UpdateAI(uint32 diff) - { - if( !UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if( !UpdateVictim() ) + return; - if( timer1 <= diff ) - { - me->CastSpell(me, RAID_MODE(46763, 64062), false); - timer1 = urand(15000, 20000); - } - else - timer1 -= diff; + if( timer1 <= diff ) + { + me->CastSpell(me, RAID_MODE(46763, 64062), false); + timer1 = urand(15000, 20000); + } + else + timer1 -= diff; - if (timer2 <= diff) timer2 = 0; - else timer2 -= diff; - if (timer2 == 0 && me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) - { - me->CastSpell(me, 63808, false); - timer2 = urand(10000, 12000); - } + if (timer2 <= diff) timer2 = 0; + else timer2 -= diff; + if (timer2 == 0 && me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) + { + me->CastSpell(me, 63808, false); + timer2 = urand(10000, 12000); + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class achievement_quick_shave : public AchievementCriteriaScript @@ -1096,7 +1096,7 @@ class achievement_quick_shave : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - return target && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == NPC_RAZORSCALE && target->ToCreature()->AI()->GetData(1); + return target && target->GetTypeId() == TYPEID_UNIT && target->GetEntry() == NPC_RAZORSCALE && target->ToCreature()->AI()->GetData(1); } }; @@ -1107,20 +1107,20 @@ class achievement_iron_dwarf_medium_rare : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - return target && target->GetEntry() == NPC_RAZORSCALE; + return target && target->GetEntry() == NPC_RAZORSCALE; } }; void AddSC_boss_razorscale() { new boss_razorscale(); - new npc_ulduar_expedition_commander(); - new npc_ulduar_harpoonfirestate(); - new npc_ulduar_expedition_engineer(); - new go_ulduar_working_harpoon(); - new npc_ulduar_dark_rune_guardian(); - new npc_ulduar_dark_rune_watcher(); - new npc_ulduar_dark_rune_sentinel(); - new achievement_quick_shave(); - new achievement_iron_dwarf_medium_rare(); + new npc_ulduar_expedition_commander(); + new npc_ulduar_harpoonfirestate(); + new npc_ulduar_expedition_engineer(); + new go_ulduar_working_harpoon(); + new npc_ulduar_dark_rune_guardian(); + new npc_ulduar_dark_rune_watcher(); + new npc_ulduar_dark_rune_sentinel(); + new achievement_quick_shave(); + new achievement_iron_dwarf_medium_rare(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index 4151415bb..2e8eaa14a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -13,288 +13,288 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum ThorimSpells { - // THORIM - SPELL_LIGHTNING_DESTRUCTION = 62393, - SPELL_SHEATH_OF_LIGHTNING = 62276, - SPELL_STORMHAMMER = 62042, - SPELL_BERSERK_FRIENDS = 62560, - SPELL_CHAIN_LIGHTNING_10 = 62131, - SPELL_CHAIN_LIGHTNING_25 = 64390, - SPELL_UNBALANCING_STRIKE = 62130, - SPELL_BERSERK = 26662, + // THORIM + SPELL_LIGHTNING_DESTRUCTION = 62393, + SPELL_SHEATH_OF_LIGHTNING = 62276, + SPELL_STORMHAMMER = 62042, + SPELL_BERSERK_FRIENDS = 62560, + SPELL_CHAIN_LIGHTNING_10 = 62131, + SPELL_CHAIN_LIGHTNING_25 = 64390, + SPELL_UNBALANCING_STRIKE = 62130, + SPELL_BERSERK = 26662, - SPELL_CHARGE_ORB = 62016, - SPELL_LIGHTNING_PILLAR_P1 = 63238, + SPELL_CHARGE_ORB = 62016, + SPELL_LIGHTNING_PILLAR_P1 = 63238, - SPELL_LIGHTNING_ORB_VISUAL = 62186, - SPELL_LIGHTNING_CHARGE_DAMAGE = 62466, - SPELL_LIGHTNING_CHARGE_BUFF = 62279, - SPELL_LIGHTNING_PILLAR_P2 = 62976, - SPELL_LIGHTNING_ORB_CHARGER = 62278, - - // SIF - SPELL_TOUCH_OF_DOMINION = 62507, - SPELL_SIF_TRANSFORM = 64778, - SPELL_SIF_CHANNEL_HOLOGRAM = 64324, - SPELL_FROSTBOLT = 62601, - SPELL_FROSTBOLT_VALLEY = 62604, - SPELL_BLIZZARD_10 = 62577, - SPELL_BLIZZARD_25 = 62603, - SPELL_FROST_NOVA = 62605, + SPELL_LIGHTNING_ORB_VISUAL = 62186, + SPELL_LIGHTNING_CHARGE_DAMAGE = 62466, + SPELL_LIGHTNING_CHARGE_BUFF = 62279, + SPELL_LIGHTNING_PILLAR_P2 = 62976, + SPELL_LIGHTNING_ORB_CHARGER = 62278, + + // SIF + SPELL_TOUCH_OF_DOMINION = 62507, + SPELL_SIF_TRANSFORM = 64778, + SPELL_SIF_CHANNEL_HOLOGRAM = 64324, + SPELL_FROSTBOLT = 62601, + SPELL_FROSTBOLT_VALLEY = 62604, + SPELL_BLIZZARD_10 = 62577, + SPELL_BLIZZARD_25 = 62603, + SPELL_FROST_NOVA = 62605, - // DARK RUNE ACOLYTE - SPELL_GREATER_HEAL_10 = 62334, - SPELL_GREATER_HEAL_25 = 62442, - SPELL_HOLY_SMITE_10 = 62335, - SPELL_HOLY_SMITE_25 = 62443, - SPELL_RENEW_10 = 62333, - SPELL_RENEW_25 = 62441, + // DARK RUNE ACOLYTE + SPELL_GREATER_HEAL_10 = 62334, + SPELL_GREATER_HEAL_25 = 62442, + SPELL_HOLY_SMITE_10 = 62335, + SPELL_HOLY_SMITE_25 = 62443, + SPELL_RENEW_10 = 62333, + SPELL_RENEW_25 = 62441, - // CAPTURED MERCENARY SOLDIER - SPELL_BARBED_SHOT = 62318, - SPELL_WING_CLIP = 40652, - SPELL_SHOOT = 16496, + // CAPTURED MERCENARY SOLDIER + SPELL_BARBED_SHOT = 62318, + SPELL_WING_CLIP = 40652, + SPELL_SHOOT = 16496, - // CAPTURED MERCENARY CAPTAIN - SPELL_DEVASTATE = 62317, - SPELL_HEROIC_STRIKE = 62444, + // CAPTURED MERCENARY CAPTAIN + SPELL_DEVASTATE = 62317, + SPELL_HEROIC_STRIKE = 62444, - // JORMUNGAR BEHEMOTH - SPELL_ACID_BREATH_10 = 62315, - SPELL_ACID_BREATH_25 = 62415, - SPELL_SWEEP_10 = 62316, - SPELL_SWEEP_25 = 62417, + // JORMUNGAR BEHEMOTH + SPELL_ACID_BREATH_10 = 62315, + SPELL_ACID_BREATH_25 = 62415, + SPELL_SWEEP_10 = 62316, + SPELL_SWEEP_25 = 62417, - // IRON RING GUARD - SPELL_IMPALE_10 = 62331, - SPELL_IMPALE_25 = 62418, - SPELL_WHIRLING_TRIP = 64151, + // IRON RING GUARD + SPELL_IMPALE_10 = 62331, + SPELL_IMPALE_25 = 62418, + SPELL_WHIRLING_TRIP = 64151, - // IRON HONOR GUARD - SPELL_SHIELD_SMASH_10 = 62332, - SPELL_SHIELD_SMASH_25 = 62420, - SPELL_CLEAVE = 42724, - SPELL_HAMSTRING = 48639, + // IRON HONOR GUARD + SPELL_SHIELD_SMASH_10 = 62332, + SPELL_SHIELD_SMASH_25 = 62420, + SPELL_CLEAVE = 42724, + SPELL_HAMSTRING = 48639, - // DARK RUNE WARBRINGER - SPELL_AURA_OF_CELERITY = 62320, - SPELL_RUNIC_STRIKE = 62322, + // DARK RUNE WARBRINGER + SPELL_AURA_OF_CELERITY = 62320, + SPELL_RUNIC_STRIKE = 62322, - // DARK RUNE EVOKER - SPELL_RUNIC_LIGHTNING_10 = 62327, - SPELL_RUNIC_LIGHTNING_25 = 62445, - SPELL_RUNIC_MENDING_10 = 62328, - SPELL_RUNIC_MENDING_25 = 62446, - SPELL_RUNIC_SHIELD_10 = 62321, - SPELL_RUNIC_SHIELD_25 = 62529, + // DARK RUNE EVOKER + SPELL_RUNIC_LIGHTNING_10 = 62327, + SPELL_RUNIC_LIGHTNING_25 = 62445, + SPELL_RUNIC_MENDING_10 = 62328, + SPELL_RUNIC_MENDING_25 = 62446, + SPELL_RUNIC_SHIELD_10 = 62321, + SPELL_RUNIC_SHIELD_25 = 62529, - // DARK RUNE CHAMPION - SPELL_CHARGE = 32323, - SPELL_MORTAL_STRIKE = 35054, - SPELL_WHIRLWIND = 15578, + // DARK RUNE CHAMPION + SPELL_CHARGE = 32323, + SPELL_MORTAL_STRIKE = 35054, + SPELL_WHIRLWIND = 15578, - // DARK RUNE COMMONER - SPELL_LOW_BLOW = 62326, - SPELL_PUMMEL = 38313, + // DARK RUNE COMMONER + SPELL_LOW_BLOW = 62326, + SPELL_PUMMEL = 38313, - // RUNIC COLOSSUS - SPELL_COLOSSUS_CHARGE_10 = 62613, - SPELL_COLOSSUS_CHARGE_25 = 62614, - SPELL_RUNIC_BARRIER = 62338, - SPELL_SMASH = 62339, - SPELL_RUNIC_SMASH_LEFT = 62057, - SPELL_RUNIC_SMASH_RIGHT = 62058, - SPELL_RUNIC_SMASH_DAMAGE = 62465, + // RUNIC COLOSSUS + SPELL_COLOSSUS_CHARGE_10 = 62613, + SPELL_COLOSSUS_CHARGE_25 = 62614, + SPELL_RUNIC_BARRIER = 62338, + SPELL_SMASH = 62339, + SPELL_RUNIC_SMASH_LEFT = 62057, + SPELL_RUNIC_SMASH_RIGHT = 62058, + SPELL_RUNIC_SMASH_DAMAGE = 62465, - // ANCIENT RUNE GIANT - SPELL_RUNE_DETONATION = 62526, - SPELL_RUNIC_FORTIFICATION = 62942, - SPELL_STOMP_10 = 62411, - SPELL_STOMP_25 = 62413, + // ANCIENT RUNE GIANT + SPELL_RUNE_DETONATION = 62526, + SPELL_RUNIC_FORTIFICATION = 62942, + SPELL_STOMP_10 = 62411, + SPELL_STOMP_25 = 62413, - // TRAPS - SPELL_LIGHTNING_FIELD = 64972, - SPELL_PARALYTIC_FIELD_FIRST = 62241, - SPELL_PARALYTIC_FIELD_SECOND = 63540, + // TRAPS + SPELL_LIGHTNING_FIELD = 64972, + SPELL_PARALYTIC_FIELD_FIRST = 62241, + SPELL_PARALYTIC_FIELD_SECOND = 63540, }; -#define SPELL_GREATER_HEAL RAID_MODE(SPELL_GREATER_HEAL_10, SPELL_GREATER_HEAL_25) -#define SPELL_HOLY_SMITE RAID_MODE(SPELL_HOLY_SMITE_10, SPELL_HOLY_SMITE_25) -#define SPELL_RENEW RAID_MODE(SPELL_RENEW_10, SPELL_RENEW_25) -#define SPELL_ACID_BREATH RAID_MODE(SPELL_ACID_BREATH_10, SPELL_ACID_BREATH_25) -#define SPELL_SWEEP RAID_MODE(SPELL_SWEEP_10, SPELL_SWEEP_25) -#define SPELL_IMPALE RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25) -#define SPELL_COLOSSUS_CHARGE RAID_MODE(SPELL_COLOSSUS_CHARGE_10, SPELL_COLOSSUS_CHARGE_25) -#define SPELL_STOMP RAID_MODE(SPELL_STOMP_10, SPELL_STOMP_25) -#define SPELL_SHIELD_SMASH RAID_MODE(SPELL_SHIELD_SMASH_10, SPELL_SHIELD_SMASH_25) -#define SPELL_RUNIC_LIGHTNING RAID_MODE(SPELL_RUNIC_LIGHTNING_10, SPELL_RUNIC_LIGHTNING_25) -#define SPELL_RUNIC_MENDING RAID_MODE(SPELL_RUNIC_MENDING_10, SPELL_RUNIC_MENDING_25) -#define SPELL_RUNIC_SHIELD RAID_MODE(SPELL_RUNIC_SHIELD_10, SPELL_RUNIC_SHIELD_25) -#define SPELL_CHAIN_LIGHTNING RAID_MODE(SPELL_CHAIN_LIGHTNING_10, SPELL_CHAIN_LIGHTNING_25) +#define SPELL_GREATER_HEAL RAID_MODE(SPELL_GREATER_HEAL_10, SPELL_GREATER_HEAL_25) +#define SPELL_HOLY_SMITE RAID_MODE(SPELL_HOLY_SMITE_10, SPELL_HOLY_SMITE_25) +#define SPELL_RENEW RAID_MODE(SPELL_RENEW_10, SPELL_RENEW_25) +#define SPELL_ACID_BREATH RAID_MODE(SPELL_ACID_BREATH_10, SPELL_ACID_BREATH_25) +#define SPELL_SWEEP RAID_MODE(SPELL_SWEEP_10, SPELL_SWEEP_25) +#define SPELL_IMPALE RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25) +#define SPELL_COLOSSUS_CHARGE RAID_MODE(SPELL_COLOSSUS_CHARGE_10, SPELL_COLOSSUS_CHARGE_25) +#define SPELL_STOMP RAID_MODE(SPELL_STOMP_10, SPELL_STOMP_25) +#define SPELL_SHIELD_SMASH RAID_MODE(SPELL_SHIELD_SMASH_10, SPELL_SHIELD_SMASH_25) +#define SPELL_RUNIC_LIGHTNING RAID_MODE(SPELL_RUNIC_LIGHTNING_10, SPELL_RUNIC_LIGHTNING_25) +#define SPELL_RUNIC_MENDING RAID_MODE(SPELL_RUNIC_MENDING_10, SPELL_RUNIC_MENDING_25) +#define SPELL_RUNIC_SHIELD RAID_MODE(SPELL_RUNIC_SHIELD_10, SPELL_RUNIC_SHIELD_25) +#define SPELL_CHAIN_LIGHTNING RAID_MODE(SPELL_CHAIN_LIGHTNING_10, SPELL_CHAIN_LIGHTNING_25) enum ThormNPCandGOs { - // ARENA INIT - NPC_DARK_RUNE_ACOLYTE_I = 32886, - NPC_CAPTURED_MERCENARY_SOLDIER_ALLY = 32885, - NPC_CAPTURED_MERCENARY_SOLDIER_HORDE = 32883, - NPC_CAPTURED_MERCENARY_CAPTAIN_ALLY = 32908, - NPC_CAPTURED_MERCENARY_CAPTAIN_HORDE = 32907, - NPC_JORMUNGAR_BEHEMOT = 32882, + // ARENA INIT + NPC_DARK_RUNE_ACOLYTE_I = 32886, + NPC_CAPTURED_MERCENARY_SOLDIER_ALLY = 32885, + NPC_CAPTURED_MERCENARY_SOLDIER_HORDE = 32883, + NPC_CAPTURED_MERCENARY_CAPTAIN_ALLY = 32908, + NPC_CAPTURED_MERCENARY_CAPTAIN_HORDE = 32907, + NPC_JORMUNGAR_BEHEMOT = 32882, - // ARENA PHASE - NPC_DARK_RUNE_WARBRINGER = 32877, - NPC_DARK_RUNE_EVOKER = 32878, - NPC_DARK_RUNE_CHAMPION = 32876, - NPC_DARK_RUNE_COMMONER = 32904, + // ARENA PHASE + NPC_DARK_RUNE_WARBRINGER = 32877, + NPC_DARK_RUNE_EVOKER = 32878, + NPC_DARK_RUNE_CHAMPION = 32876, + NPC_DARK_RUNE_COMMONER = 32904, - // GAUNTLET - NPC_IRON_RING_GUARD = 32874, - NPC_RUNIC_COLOSSUS = 32872, - NPC_ANCIENT_RUNE_GIANT = 32873, - NPC_DARK_RUNE_ACOLYTE_G = 33110, - NPC_IRON_HONOR_GUARD = 32875, + // GAUNTLET + NPC_IRON_RING_GUARD = 32874, + NPC_RUNIC_COLOSSUS = 32872, + NPC_ANCIENT_RUNE_GIANT = 32873, + NPC_DARK_RUNE_ACOLYTE_G = 33110, + NPC_IRON_HONOR_GUARD = 32875, - // TRIGGERS - NPC_LIGHTNING_ORB = 33138, - NPC_THUNDER_ORB = 33378, - NPC_PILLAR = 32892, - NPC_SIF_BLIZZARD = 32879, + // TRIGGERS + NPC_LIGHTNING_ORB = 33138, + NPC_THUNDER_ORB = 33378, + NPC_PILLAR = 32892, + NPC_SIF_BLIZZARD = 32879, - NPC_SIF = 33196, + NPC_SIF = 33196, }; enum ThorimEvents { - EVENT_THORIM_START_PHASE1 = 1, - EVENT_THORIM_STORMHAMMER = 2, - EVENT_THORIM_CHARGE_ORB = 3, - EVENT_THORIM_LIGHTNING_ORB = 4, - EVENT_THORIM_NOT_REACH_IN_TIME = 5, - EVENT_THORIM_FILL_ARENA = 6, - EVENT_THORIM_UNBALANCING_STRIKE = 7, - EVENT_THORIM_LIGHTNING_CHARGE = 8, - EVENT_THORIM_CHAIN_LIGHTNING = 9, - EVENT_THORIM_BERSERK = 10, - EVENT_THORIM_AGGRO = 11, - EVENT_THORIM_AGGRO2 = 12, - EVENT_THORIM_OUTRO1 = 13, - EVENT_THORIM_OUTRO2 = 14, - EVENT_THORIM_OUTRO3 = 15, + EVENT_THORIM_START_PHASE1 = 1, + EVENT_THORIM_STORMHAMMER = 2, + EVENT_THORIM_CHARGE_ORB = 3, + EVENT_THORIM_LIGHTNING_ORB = 4, + EVENT_THORIM_NOT_REACH_IN_TIME = 5, + EVENT_THORIM_FILL_ARENA = 6, + EVENT_THORIM_UNBALANCING_STRIKE = 7, + EVENT_THORIM_LIGHTNING_CHARGE = 8, + EVENT_THORIM_CHAIN_LIGHTNING = 9, + EVENT_THORIM_BERSERK = 10, + EVENT_THORIM_AGGRO = 11, + EVENT_THORIM_AGGRO2 = 12, + EVENT_THORIM_OUTRO1 = 13, + EVENT_THORIM_OUTRO2 = 14, + EVENT_THORIM_OUTRO3 = 15, - EVENT_DR_ACOLYTE_GH = 20, - EVENT_DR_ACOLYTE_HS = 21, - EVENT_DR_ACOLYTE_R = 22, + EVENT_DR_ACOLYTE_GH = 20, + EVENT_DR_ACOLYTE_HS = 21, + EVENT_DR_ACOLYTE_R = 22, - EVENT_CM_SOLDIER_BS = 30, - EVENT_CM_SOLDIER_S = 31, - EVENT_CM_SOLDIER_WC = 32, + EVENT_CM_SOLDIER_BS = 30, + EVENT_CM_SOLDIER_S = 31, + EVENT_CM_SOLDIER_WC = 32, - EVENT_CM_CAPTAIN_D = 40, - EVENT_CM_CAPTAIN_HC = 41, + EVENT_CM_CAPTAIN_D = 40, + EVENT_CM_CAPTAIN_HC = 41, - EVENT_JB_ACID_BREATH = 50, - EVENT_JB_SWEEP = 51, + EVENT_JB_ACID_BREATH = 50, + EVENT_JB_SWEEP = 51, - EVENT_IR_GUARD_IMPALE = 60, - EVENT_IR_GUARD_WHIRL = 61, + EVENT_IR_GUARD_IMPALE = 60, + EVENT_IR_GUARD_WHIRL = 61, - EVENT_RC_RUNIC_BARRIER = 70, - EVENT_RC_SMASH = 71, - EVENT_RC_RUNIC_SMASH = 72, - EVENT_RC_RUNIC_SMASH_TRIGGER = 73, - EVENT_RC_CHARGE = 74, + EVENT_RC_RUNIC_BARRIER = 70, + EVENT_RC_SMASH = 71, + EVENT_RC_RUNIC_SMASH = 72, + EVENT_RC_RUNIC_SMASH_TRIGGER = 73, + EVENT_RC_CHARGE = 74, - EVENT_ARG_RD = 80, - EVENT_ARG_RF = 81, - EVENT_ARG_STOMP = 82, - EVENT_ARG_SPAWN = 83, + EVENT_ARG_RD = 80, + EVENT_ARG_RF = 81, + EVENT_ARG_STOMP = 82, + EVENT_ARG_SPAWN = 83, - EVENT_IH_GUARD_CLEAVE = 90, - EVENT_IH_GUARD_HAMSTRING = 91, - EVENT_IH_GUARD_SHIELD_SMASH = 92, + EVENT_IH_GUARD_CLEAVE = 90, + EVENT_IH_GUARD_HAMSTRING = 91, + EVENT_IH_GUARD_SHIELD_SMASH = 92, - EVENT_SIF_START_TALK = 100, - EVENT_SIF_JOIN_TALK = 101, - EVENT_SIF_FINISH_DOMINION = 102, - EVENT_SIF_FROSTBOLT_VALLEY = 103, - EVENT_SIF_BLIZZARD = 104, - EVENT_SIF_FROST_NOVA_START = 105, - EVENT_SIF_FROST_NOVA_CAST = 106, + EVENT_SIF_START_TALK = 100, + EVENT_SIF_JOIN_TALK = 101, + EVENT_SIF_FINISH_DOMINION = 102, + EVENT_SIF_FROSTBOLT_VALLEY = 103, + EVENT_SIF_BLIZZARD = 104, + EVENT_SIF_FROST_NOVA_START = 105, + EVENT_SIF_FROST_NOVA_CAST = 106, - EVENT_DR_WARBRINGER_RS = 110, + EVENT_DR_WARBRINGER_RS = 110, - EVENT_DR_EVOKER_RL = 120, - EVENT_DR_EVOKER_RM = 121, - EVENT_DR_EVOKER_RS = 122, + EVENT_DR_EVOKER_RL = 120, + EVENT_DR_EVOKER_RM = 121, + EVENT_DR_EVOKER_RS = 122, - EVENT_DR_CHAMPION_WH = 130, - EVENT_DR_CHAMPION_CH = 131, - EVENT_DR_CHAMPION_MS = 132, + EVENT_DR_CHAMPION_WH = 130, + EVENT_DR_CHAMPION_CH = 131, + EVENT_DR_CHAMPION_MS = 132, - EVENT_DR_COMMONER_PM = 140, - EVENT_DR_COMMONER_LB = 141, + EVENT_DR_COMMONER_PM = 140, + EVENT_DR_COMMONER_LB = 141, }; const Position ArenaNPCs[] = { - {2178.5f, -300.2f, 441.97f, 2.5f}, - {2188.12f, -295.1f, 443.75, 2.5f}, - {2180.9f, -286.8f, 433.3f, 2.49f}, - {2193.2f, -280.6f, 443.14f, 2.79f}, - {2191.8f, -270.2f, 438.3f, 3.0f}, - {2186.84f, -238.5f, 439.7f, 3.4f}, - {2166.3f, -213.0f, 440.0f, 4.1f}, - {2100.5f, -213.5f, 441.66f, 5.4f}, - {2091.0f, -231.26f, 435.17f, 5.5f}, - {2083.2f, -239.2f, 438.77f, 5.85f}, - {2081.54f, -253.27f, 434.67f, 6.19f}, - {2077.65f, -272.73f, 439.12f, 0.15f}, - {2084.36f, -282.12f, 435.87f, 0.24f}, - {2087.46f, -298.71f, 440.5f, 0.59f} + {2178.5f, -300.2f, 441.97f, 2.5f}, + {2188.12f, -295.1f, 443.75, 2.5f}, + {2180.9f, -286.8f, 433.3f, 2.49f}, + {2193.2f, -280.6f, 443.14f, 2.79f}, + {2191.8f, -270.2f, 438.3f, 3.0f}, + {2186.84f, -238.5f, 439.7f, 3.4f}, + {2166.3f, -213.0f, 440.0f, 4.1f}, + {2100.5f, -213.5f, 441.66f, 5.4f}, + {2091.0f, -231.26f, 435.17f, 5.5f}, + {2083.2f, -239.2f, 438.77f, 5.85f}, + {2081.54f, -253.27f, 434.67f, 6.19f}, + {2077.65f, -272.73f, 439.12f, 0.15f}, + {2084.36f, -282.12f, 435.87f, 0.24f}, + {2087.46f, -298.71f, 440.5f, 0.59f} }; enum ThorimSounds { - SOUND_AGGRO1 = 15733, - SOUND_AGGRO2 = 15734, - SOUND_SPECIAL1 = 15735, - SOUND_SPECIAL2 = 15736, - SOUND_SPECIAL3 = 15737, - SOUND_JUMPDOWN = 15738, - SOUND_SLAY1 = 15739, - SOUND_SLAY2 = 15740, - SOUND_BERSERK = 15741, - SOUND_AWIPE = 15742, - SOUND_DEFEATED = 15743, - SOUND_NORM1 = 15744, - SOUND_NORM2 = 15745, - SOUND_NORM3 = 15746, - SOUND_HARD1 = 15747, - SOUND_HARD2 = 15748, - SOUND_HARD3 = 15749, + SOUND_AGGRO1 = 15733, + SOUND_AGGRO2 = 15734, + SOUND_SPECIAL1 = 15735, + SOUND_SPECIAL2 = 15736, + SOUND_SPECIAL3 = 15737, + SOUND_JUMPDOWN = 15738, + SOUND_SLAY1 = 15739, + SOUND_SLAY2 = 15740, + SOUND_BERSERK = 15741, + SOUND_AWIPE = 15742, + SOUND_DEFEATED = 15743, + SOUND_NORM1 = 15744, + SOUND_NORM2 = 15745, + SOUND_NORM3 = 15746, + SOUND_HARD1 = 15747, + SOUND_HARD2 = 15748, + SOUND_HARD3 = 15749, - SOUND_SIF_START = 15668, - SOUND_SIF_DESPAWN = 15669, - SOUND_SIF_EVENT = 15670, + SOUND_SIF_START = 15668, + SOUND_SIF_DESPAWN = 15669, + SOUND_SIF_EVENT = 15670, }; enum Misc { - ACTION_START_TRASH_DIED = 1, - ACTION_ALLOW_HIT = 2, - ACTION_SIF_JOIN_FIGHT = 3, - ACTION_SIF_START_TALK = 4, - ACTION_SIF_START_DOMINION = 5, - ACTION_SIF_TRANSFORM = 6, - ACTION_IRON_HONOR_DIED = 7, + ACTION_START_TRASH_DIED = 1, + ACTION_ALLOW_HIT = 2, + ACTION_SIF_JOIN_FIGHT = 3, + ACTION_SIF_START_TALK = 4, + ACTION_SIF_START_DOMINION = 5, + ACTION_SIF_TRANSFORM = 6, + ACTION_IRON_HONOR_DIED = 7, - EVENT_PHASE_START = 1, - EVENT_PHASE_RING = 2, - EVENT_PHASE_OUTRO = 3, + EVENT_PHASE_START = 1, + EVENT_PHASE_RING = 2, + EVENT_PHASE_OUTRO = 3, - DATA_HIT_BY_LIGHTNING = 1, - DATA_LOSE_YOUR_ILLUSION = 2, + DATA_HIT_BY_LIGHTNING = 1, + DATA_LOSE_YOUR_ILLUSION = 2, }; const Position Middle = {2134.68f, -263.13f, 419.44f}; @@ -312,514 +312,514 @@ public: return new boss_thorimAI (pCreature); } - struct boss_thorimAI : public ScriptedAI - { - boss_thorimAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) - { - m_pInstance = pCreature->GetInstanceScript(); - if (_encounterFinished = (!me->IsAlive())) - if (m_pInstance) - m_pInstance->SetData(TYPE_THORIM, DONE); - } + struct boss_thorimAI : public ScriptedAI + { + boss_thorimAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) + { + m_pInstance = pCreature->GetInstanceScript(); + if (_encounterFinished = (!me->IsAlive())) + if (m_pInstance) + m_pInstance->SetData(TYPE_THORIM, DONE); + } - bool _isArenaEmpty; - bool _encounterFinished; - bool _spawnCommoners; - bool _hardMode; - bool _isHitAllowed; - bool _isAlly; - uint8 _trashCounter; + bool _isArenaEmpty; + bool _encounterFinished; + bool _spawnCommoners; + bool _hardMode; + bool _isHitAllowed; + bool _isAlly; + uint8 _trashCounter; - InstanceScript* m_pInstance; - EventMap events; - SummonList summons; + InstanceScript* m_pInstance; + EventMap events; + SummonList summons; - bool _hitByLightning; + bool _hitByLightning; - void DisableThorim(bool apply) - { - if (apply) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_PACIFIED); - me->DisableRotate(true); - me->AddUnitState(UNIT_STATE_ROOT); - } - else - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_PACIFIED); - me->DisableRotate(false); - me->ClearUnitState(UNIT_STATE_ROOT); - me->resetAttackTimer(BASE_ATTACK); - } - } + void DisableThorim(bool apply) + { + if (apply) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_PACIFIED); + me->DisableRotate(true); + me->AddUnitState(UNIT_STATE_ROOT); + } + else + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_PACIFIED); + me->DisableRotate(false); + me->ClearUnitState(UNIT_STATE_ROOT); + me->resetAttackTimer(BASE_ATTACK); + } + } - GameObject* GetThorimObject(uint32 entry) - { - if (m_pInstance) - return ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(entry)); - return NULL; - } + GameObject* GetThorimObject(uint32 entry) + { + if (m_pInstance) + return ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(entry)); + return NULL; + } - void JustSummoned(Creature* cr) { summons.Summon(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } - void SpawnAllNPCs() - { - // Jormungar Behemoth 32882 - me->SummonCreature(NPC_JORMUNGAR_BEHEMOT, 2149.68f, -263.477f, 419.679f, 3.12102f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + void SpawnAllNPCs() + { + // Jormungar Behemoth 32882 + me->SummonCreature(NPC_JORMUNGAR_BEHEMOT, 2149.68f, -263.477f, 419.679f, 3.12102f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - // Captured Mercenary Soldier 32885 - me->SummonCreature(_isAlly ? NPC_CAPTURED_MERCENARY_SOLDIER_ALLY : NPC_CAPTURED_MERCENARY_SOLDIER_HORDE, 2127.24f, -251.309f, 419.793f, 5.89921f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - me->SummonCreature(_isAlly ? NPC_CAPTURED_MERCENARY_SOLDIER_ALLY : NPC_CAPTURED_MERCENARY_SOLDIER_HORDE, 2120.1f, -258.99f, 419.764f, 6.24828f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - me->SummonCreature(_isAlly ? NPC_CAPTURED_MERCENARY_SOLDIER_ALLY : NPC_CAPTURED_MERCENARY_SOLDIER_HORDE, 2123.32f, -254.771f, 419.789f, 6.17846f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - - // Captured Mercenary Captain 32908 - me->SummonCreature(_isAlly ? NPC_CAPTURED_MERCENARY_CAPTAIN_ALLY : NPC_CAPTURED_MERCENARY_CAPTAIN_HORDE, 2131.31f, -259.182f, 419.974f, 5.91667f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - - // Dark Rune Acolyte (arena) 32886 - me->SummonCreature(NPC_DARK_RUNE_ACOLYTE_I, 2129.09f, -277.142f, 419.756f, 1.22173f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + // Captured Mercenary Soldier 32885 + me->SummonCreature(_isAlly ? NPC_CAPTURED_MERCENARY_SOLDIER_ALLY : NPC_CAPTURED_MERCENARY_SOLDIER_HORDE, 2127.24f, -251.309f, 419.793f, 5.89921f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + me->SummonCreature(_isAlly ? NPC_CAPTURED_MERCENARY_SOLDIER_ALLY : NPC_CAPTURED_MERCENARY_SOLDIER_HORDE, 2120.1f, -258.99f, 419.764f, 6.24828f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + me->SummonCreature(_isAlly ? NPC_CAPTURED_MERCENARY_SOLDIER_ALLY : NPC_CAPTURED_MERCENARY_SOLDIER_HORDE, 2123.32f, -254.771f, 419.789f, 6.17846f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + + // Captured Mercenary Captain 32908 + me->SummonCreature(_isAlly ? NPC_CAPTURED_MERCENARY_CAPTAIN_ALLY : NPC_CAPTURED_MERCENARY_CAPTAIN_HORDE, 2131.31f, -259.182f, 419.974f, 5.91667f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + + // Dark Rune Acolyte (arena) 32886 + me->SummonCreature(NPC_DARK_RUNE_ACOLYTE_I, 2129.09f, -277.142f, 419.756f, 1.22173f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - // Iron Ring Guard 32874 - me->SummonCreature(NPC_IRON_RING_GUARD, 2217.69f, -337.394f, 412.177f, 1.23918f); - me->SummonCreature(NPC_IRON_RING_GUARD, 2218.38f, -297.505f, 412.176f, 1.02974f); - me->SummonCreature(NPC_IRON_RING_GUARD, 2235.26f, -338.345f, 412.134f, 1.58979f); - me->SummonCreature(NPC_IRON_RING_GUARD, 2235.07f, -297.985f, 412.134f, 1.61336f); + // Iron Ring Guard 32874 + me->SummonCreature(NPC_IRON_RING_GUARD, 2217.69f, -337.394f, 412.177f, 1.23918f); + me->SummonCreature(NPC_IRON_RING_GUARD, 2218.38f, -297.505f, 412.176f, 1.02974f); + me->SummonCreature(NPC_IRON_RING_GUARD, 2235.26f, -338.345f, 412.134f, 1.58979f); + me->SummonCreature(NPC_IRON_RING_GUARD, 2235.07f, -297.985f, 412.134f, 1.61336f); - // Dark Rune Acolyte (gauntlet) 33110 - me->SummonCreature(NPC_DARK_RUNE_ACOLYTE_G, 2198.29f, -436.92f, 419.985f, 0.261799f); - me->SummonCreature(NPC_DARK_RUNE_ACOLYTE_G, 2227.58f, -308.303f, 412.134f, 1.59372f); - me->SummonCreature(NPC_DARK_RUNE_ACOLYTE_G, 2227.47f, -345.375f, 412.134f, 1.56622f); + // Dark Rune Acolyte (gauntlet) 33110 + me->SummonCreature(NPC_DARK_RUNE_ACOLYTE_G, 2198.29f, -436.92f, 419.985f, 0.261799f); + me->SummonCreature(NPC_DARK_RUNE_ACOLYTE_G, 2227.58f, -308.303f, 412.134f, 1.59372f); + me->SummonCreature(NPC_DARK_RUNE_ACOLYTE_G, 2227.47f, -345.375f, 412.134f, 1.56622f); - // Iron Honor Guard 32875 - me->SummonCreature(NPC_IRON_HONOR_GUARD, 2198.05f, -428.769f, 419.985f, 6.05629f); - me->SummonCreature(NPC_IRON_HONOR_GUARD, 2220.31f, -436.22f, 412.26f, 1.06465f); + // Iron Honor Guard 32875 + me->SummonCreature(NPC_IRON_HONOR_GUARD, 2198.05f, -428.769f, 419.985f, 6.05629f); + me->SummonCreature(NPC_IRON_HONOR_GUARD, 2220.31f, -436.22f, 412.26f, 1.06465f); - // Runic Colossus 32872 - me->SummonCreature(NPC_RUNIC_COLOSSUS, 2227.5f, -396.179f, 412.176f, 1.79769f); - - // Ancient Rune Giant 32873 - me->SummonCreature(NPC_ANCIENT_RUNE_GIANT, 2134.57f, -440.318f, 438.331f, 0.226893f); + // Runic Colossus 32872 + me->SummonCreature(NPC_RUNIC_COLOSSUS, 2227.5f, -396.179f, 412.176f, 1.79769f); + + // Ancient Rune Giant 32873 + me->SummonCreature(NPC_ANCIENT_RUNE_GIANT, 2134.57f, -440.318f, 438.331f, 0.226893f); - // Sif 33196 - me->SummonCreature(NPC_SIF, 2147.86f, -301.2f, 438.246f, 2.488f); - } + // Sif 33196 + me->SummonCreature(NPC_SIF, 2147.86f, -301.2f, 438.246f, 2.488f); + } - void CloseDoors() - { - GameObject* go; - if (go = GetThorimObject(DATA_THORIM_LEVER)) - { - go->SetUInt32Value(GAMEOBJECT_FLAGS, 48); - go->SetGoState(GO_STATE_READY); - } - if (go = GetThorimObject(DATA_THORIM_FIRST_DOORS)) - go->SetGoState(GO_STATE_READY); + void CloseDoors() + { + GameObject* go; + if (go = GetThorimObject(DATA_THORIM_LEVER)) + { + go->SetUInt32Value(GAMEOBJECT_FLAGS, 48); + go->SetGoState(GO_STATE_READY); + } + if (go = GetThorimObject(DATA_THORIM_FIRST_DOORS)) + go->SetGoState(GO_STATE_READY); - if (go = GetThorimObject(DATA_THORIM_SECOND_DOORS)) - go->SetGoState(GO_STATE_READY); + if (go = GetThorimObject(DATA_THORIM_SECOND_DOORS)) + go->SetGoState(GO_STATE_READY); - if (go = GetThorimObject(DATA_THORIM_FENCE)) - go->SetGoState(GO_STATE_ACTIVE); - } + if (go = GetThorimObject(DATA_THORIM_FENCE)) + go->SetGoState(GO_STATE_ACTIVE); + } - void EnterEvadeMode() - { - DisableThorim(false); - CreatureAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + DisableThorim(false); + CreatureAI::EnterEvadeMode(); + } - void Reset() - { - if (m_pInstance && !_encounterFinished) - m_pInstance->SetData(TYPE_THORIM, NOT_STARTED); + void Reset() + { + if (m_pInstance && !_encounterFinished) + m_pInstance->SetData(TYPE_THORIM, NOT_STARTED); - events.Reset(); - events.SetPhase(0); - summons.DespawnAll(); + events.Reset(); + events.SetPhase(0); + summons.DespawnAll(); - _trashCounter = 0; - _isAlly = true; - _isHitAllowed = false; - _spawnCommoners = false; - _hardMode = false; - _isArenaEmpty = false; - _hitByLightning = false; + _trashCounter = 0; + _isAlly = true; + _isHitAllowed = false; + _spawnCommoners = false; + _hardMode = false; + _isArenaEmpty = false; + _hitByLightning = false; - if (Player *t = SelectTargetFromPlayerList(1000)) - if (t->GetTeamId() == TEAM_HORDE) - _isAlly = false; + if (Player *t = SelectTargetFromPlayerList(1000)) + if (t->GetTeamId() == TEAM_HORDE) + _isAlly = false; - SpawnAllNPCs(); + SpawnAllNPCs(); - CloseDoors(); - DisableThorim(false); - } + CloseDoors(); + DisableThorim(false); + } - uint32 GetData(uint32 param) const - { - if (param == DATA_HIT_BY_LIGHTNING) - return !_hitByLightning; - if (param == DATA_LOSE_YOUR_ILLUSION) - return _hardMode; + uint32 GetData(uint32 param) const + { + if (param == DATA_HIT_BY_LIGHTNING) + return !_hitByLightning; + if (param == DATA_LOSE_YOUR_ILLUSION) + return _hardMode; - return 0; - } + return 0; + } - void DoAction(int32 param) - { - if (param == ACTION_START_TRASH_DIED) - { - _trashCounter++; - // activate levar - if (_trashCounter >= 6) - { - if (GameObject* go = GetThorimObject(DATA_THORIM_LEVER)) - go->RemoveFlag(GAMEOBJECT_FLAGS, 48); + void DoAction(int32 param) + { + if (param == ACTION_START_TRASH_DIED) + { + _trashCounter++; + // activate levar + if (_trashCounter >= 6) + { + if (GameObject* go = GetThorimObject(DATA_THORIM_LEVER)) + go->RemoveFlag(GAMEOBJECT_FLAGS, 48); - events.SetPhase(EVENT_PHASE_START); - events.ScheduleEvent(EVENT_THORIM_START_PHASE1, 20000); - _trashCounter = 0; - } - else if (_trashCounter == 5) - events.ScheduleEvent(EVENT_THORIM_AGGRO, 0); - } - else if (param == ACTION_ALLOW_HIT) - _isHitAllowed = true; - } + events.SetPhase(EVENT_PHASE_START); + events.ScheduleEvent(EVENT_THORIM_START_PHASE1, 20000); + _trashCounter = 0; + } + else if (_trashCounter == 5) + events.ScheduleEvent(EVENT_THORIM_AGGRO, 0); + } + else if (param == ACTION_ALLOW_HIT) + _isHitAllowed = true; + } - void KilledUnit(Unit*) - { - if (urand(0,2)) - return; + void KilledUnit(Unit*) + { + if (urand(0,2)) + return; - if (urand(0,1)) - { - me->MonsterYell("Can't you at least put up a fight!?", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SLAY1); - } - else - { - me->MonsterYell("Pathetic!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SLAY2); - } - } + if (urand(0,1)) + { + me->MonsterYell("Can't you at least put up a fight!?", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SLAY1); + } + else + { + me->MonsterYell("Pathetic!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SLAY2); + } + } - void JustReachedHome() { me->setActive(false); } + void JustReachedHome() { me->setActive(false); } - void EnterCombat(Unit*) - { - if (m_pInstance && !_encounterFinished) - m_pInstance->SetData(TYPE_THORIM, IN_PROGRESS); - me->setActive(true); - DisableThorim(true); - me->CastSpell(me, SPELL_SHEATH_OF_LIGHTNING, true); - //me->CastSpell(me, SPELL_TOUCH_OF_DOMINION, true); - } + void EnterCombat(Unit*) + { + if (m_pInstance && !_encounterFinished) + m_pInstance->SetData(TYPE_THORIM, IN_PROGRESS); + me->setActive(true); + DisableThorim(true); + me->CastSpell(me, SPELL_SHEATH_OF_LIGHTNING, true); + //me->CastSpell(me, SPELL_TOUCH_OF_DOMINION, true); + } - void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (who && _isHitAllowed && who->GetPositionZ() > 430 && who->GetTypeId() == TYPEID_PLAYER) - { - _isHitAllowed = false; - DisableThorim(false); + void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (who && _isHitAllowed && who->GetPositionZ() > 430 && who->GetTypeId() == TYPEID_PLAYER) + { + _isHitAllowed = false; + DisableThorim(false); - events.SetPhase(EVENT_PHASE_RING); - events.ScheduleEvent(EVENT_THORIM_UNBALANCING_STRIKE, 8000, 0, EVENT_PHASE_RING); - events.ScheduleEvent(EVENT_THORIM_LIGHTNING_CHARGE, 12500, 0, EVENT_PHASE_RING); - events.ScheduleEvent(EVENT_THORIM_CHAIN_LIGHTNING, 13000, 0, EVENT_PHASE_RING); - events.ScheduleEvent(EVENT_THORIM_BERSERK, 300000, 0, EVENT_PHASE_RING); + events.SetPhase(EVENT_PHASE_RING); + events.ScheduleEvent(EVENT_THORIM_UNBALANCING_STRIKE, 8000, 0, EVENT_PHASE_RING); + events.ScheduleEvent(EVENT_THORIM_LIGHTNING_CHARGE, 12500, 0, EVENT_PHASE_RING); + events.ScheduleEvent(EVENT_THORIM_CHAIN_LIGHTNING, 13000, 0, EVENT_PHASE_RING); + events.ScheduleEvent(EVENT_THORIM_BERSERK, 300000, 0, EVENT_PHASE_RING); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - me->GetMotionMaster()->MoveJump(Middle.GetPositionX(), Middle.GetPositionY(), Middle.GetPositionZ(), 20, 20); - me->RemoveAura(SPELL_SHEATH_OF_LIGHTNING); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + me->GetMotionMaster()->MoveJump(Middle.GetPositionX(), Middle.GetPositionY(), Middle.GetPositionZ(), 20, 20); + me->RemoveAura(SPELL_SHEATH_OF_LIGHTNING); - me->MonsterYell("Impertinent whelps! You dare challenge me atop my pedestal! I will crush you myself!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_JUMPDOWN); + me->MonsterYell("Impertinent whelps! You dare challenge me atop my pedestal! I will crush you myself!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_JUMPDOWN); - // Hard Mode - if (!me->HasAura(62565 /*TOUCH OF DOMINION TRIGGER*/)) - { - if (m_pInstance) - m_pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 64980 /*SIFFED ACHIEVEMENT*/); - - _hardMode = true; - EntryCheckPredicate pred(NPC_SIF); - summons.DoAction(ACTION_SIF_JOIN_FIGHT, pred); - } + // Hard Mode + if (!me->HasAura(62565 /*TOUCH OF DOMINION TRIGGER*/)) + { + if (m_pInstance) + m_pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 64980 /*SIFFED ACHIEVEMENT*/); + + _hardMode = true; + EntryCheckPredicate pred(NPC_SIF); + summons.DoAction(ACTION_SIF_JOIN_FIGHT, pred); + } - DoResetThreat(); - if (Player* player = GetArenaPlayer()) - me->AddThreat(player, 1000.0f); - } + DoResetThreat(); + if (Player* player = GetArenaPlayer()) + me->AddThreat(player, 1000.0f); + } - if (damage >= me->GetHealth()) - { - damage = 0; - if (!_encounterFinished) - { - _encounterFinished = true; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setFaction(35); - me->SetHealth(me->GetMaxHealth()); - me->CombatStop(); - me->RemoveAllAuras(); - events.Reset(); - DisableThorim(true); + if (damage >= me->GetHealth()) + { + damage = 0; + if (!_encounterFinished) + { + _encounterFinished = true; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->setFaction(35); + me->SetHealth(me->GetMaxHealth()); + me->CombatStop(); + me->RemoveAllAuras(); + events.Reset(); + DisableThorim(true); - me->MonsterYell("Stay your arms! I yield!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_DEFEATED); - - events.SetPhase(EVENT_PHASE_OUTRO); - events.ScheduleEvent(EVENT_THORIM_OUTRO1, 2000, 0, EVENT_PHASE_OUTRO); + me->MonsterYell("Stay your arms! I yield!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_DEFEATED); + + events.SetPhase(EVENT_PHASE_OUTRO); + events.ScheduleEvent(EVENT_THORIM_OUTRO1, 2000, 0, EVENT_PHASE_OUTRO); - GameObject* go = NULL; - if (go = GetThorimObject(DATA_THORIM_FENCE)) - go->SetGoState(GO_STATE_ACTIVE); + GameObject* go = NULL; + if (go = GetThorimObject(DATA_THORIM_FENCE)) + go->SetGoState(GO_STATE_ACTIVE); - uint32 chestId = me->GetMap()->Is25ManRaid() ? GO_THORIM_CHEST_HERO : GO_THORIM_CHEST; - if (_hardMode) - chestId += 1; // hard mode offset + uint32 chestId = me->GetMap()->Is25ManRaid() ? GO_THORIM_CHEST_HERO : GO_THORIM_CHEST; + if (_hardMode) + chestId += 1; // hard mode offset - if (go = me->SummonGameObject(chestId, 2134.73f, -286.32f, 419.51f, 0.0f, 0, 0, 0, 0, 0)) - go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); + if (go = me->SummonGameObject(chestId, 2134.73f, -286.32f, 419.51f, 0.0f, 0, 0, 0, 0, 0)) + go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); - // Defeat credit - if (m_pInstance) - { - me->CastSpell(me, 64985, true); // credit - m_pInstance->SetData(TYPE_THORIM, DONE); - } - } - } - } + // Defeat credit + if (m_pInstance) + { + me->CastSpell(me, 64985, true); // credit + m_pInstance->SetData(TYPE_THORIM, DONE); + } + } + } + } - void SpawnArenaNPCs() - { - Creature* cr; - uint8 rnd; - if (_spawnCommoners || urand(0,2)) - _spawnCommoners = !_spawnCommoners; + void SpawnArenaNPCs() + { + Creature* cr; + uint8 rnd; + if (_spawnCommoners || urand(0,2)) + _spawnCommoners = !_spawnCommoners; - for (uint8 i = 0; i < (_spawnCommoners ? 7 : 2); ++i) - { - rnd = urand(0, 13); - if (cr = me->SummonCreature((_spawnCommoners ? NPC_DARK_RUNE_COMMONER : RollTable[urand(0,2)]), ArenaNPCs[rnd], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) - cr->GetMotionMaster()->MoveJump( - Middle.GetPositionX()+urand(19,24)*cos(Middle.GetAngle(cr)), - Middle.GetPositionY()+urand(19,24)*sin(Middle.GetAngle(cr)), - Middle.GetPositionZ(), 20, 20); - } - } + for (uint8 i = 0; i < (_spawnCommoners ? 7 : 2); ++i) + { + rnd = urand(0, 13); + if (cr = me->SummonCreature((_spawnCommoners ? NPC_DARK_RUNE_COMMONER : RollTable[urand(0,2)]), ArenaNPCs[rnd], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) + cr->GetMotionMaster()->MoveJump( + Middle.GetPositionX()+urand(19,24)*cos(Middle.GetAngle(cr)), + Middle.GetPositionY()+urand(19,24)*sin(Middle.GetAngle(cr)), + Middle.GetPositionZ(), 20, 20); + } + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_LIGHTNING_ORB_CHARGER) - { - me->SetOrientation(me->GetAngle(caster)); - me->CastSpell(caster, SPELL_LIGHTNING_CHARGE_DAMAGE, true); - me->CastSpell(me, SPELL_LIGHTNING_CHARGE_BUFF, true); - events.RescheduleEvent(EVENT_THORIM_LIGHTNING_CHARGE, 10000, 0, EVENT_PHASE_RING); - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_LIGHTNING_ORB_CHARGER) + { + me->SetOrientation(me->GetAngle(caster)); + me->CastSpell(caster, SPELL_LIGHTNING_CHARGE_DAMAGE, true); + me->CastSpell(me, SPELL_LIGHTNING_CHARGE_BUFF, true); + events.RescheduleEvent(EVENT_THORIM_LIGHTNING_CHARGE, 10000, 0, EVENT_PHASE_RING); + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_LIGHTNING_CHARGE_DAMAGE && target->GetTypeId() == TYPEID_PLAYER) - _hitByLightning = true; - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_LIGHTNING_CHARGE_DAMAGE && target->GetTypeId() == TYPEID_PLAYER) + _hitByLightning = true; + } - void PlaySpecial() - { - if (urand(0,9)) - return; + void PlaySpecial() + { + if (urand(0,9)) + return; - switch (urand(0,2)) - { - case 0: - me->MonsterYell("Behold the power of the storms and despair!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SPECIAL1); - break; - case 1: - me->MonsterYell("Do not hold back! Destroy them!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SPECIAL2); - break; - case 2: - me->MonsterYell("Have you begun to regret your intrusion? ", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SPECIAL3); - break; - } - } + switch (urand(0,2)) + { + case 0: + me->MonsterYell("Behold the power of the storms and despair!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SPECIAL1); + break; + case 1: + me->MonsterYell("Do not hold back! Destroy them!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SPECIAL2); + break; + case 2: + me->MonsterYell("Have you begun to regret your intrusion? ", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SPECIAL3); + break; + } + } - Player* GetArenaPlayer() - { - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (Player *p = itr->GetSource()) - if (p->GetPositionX() > 2085 && p->GetPositionX() < 2185 && p->GetPositionY() < -214 && p->GetPositionY() > -305 && p->IsAlive() && p->GetPositionZ() < 425) - return p; - return NULL; - } + Player* GetArenaPlayer() + { + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if (Player *p = itr->GetSource()) + if (p->GetPositionX() > 2085 && p->GetPositionX() < 2185 && p->GetPositionY() < -214 && p->GetPositionY() > -305 && p->IsAlive() && p->GetPositionZ() < 425) + return p; + return NULL; + } - void UpdateAI(uint32 diff) - { - if (!_encounterFinished && !UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!_encounterFinished && !UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_THORIM_AGGRO: - me->MonsterYell("Interlopers! You mortals who dare to interfere with my sport will pay... Wait--you...", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_AGGRO1); - events.ScheduleEvent(EVENT_THORIM_AGGRO2, 9000); - events.PopEvent(); + switch (events.GetEvent()) + { + case EVENT_THORIM_AGGRO: + me->MonsterYell("Interlopers! You mortals who dare to interfere with my sport will pay... Wait--you...", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_AGGRO1); + events.ScheduleEvent(EVENT_THORIM_AGGRO2, 9000); + events.PopEvent(); - if (GameObject* go = GetThorimObject(DATA_THORIM_FENCE)) - go->SetGoState(GO_STATE_READY); + if (GameObject* go = GetThorimObject(DATA_THORIM_FENCE)) + go->SetGoState(GO_STATE_READY); - break; - case EVENT_THORIM_AGGRO2: - { - me->MonsterYell("I remember you... In the mountains... But you... what is this? Where am--", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_AGGRO2); - events.PopEvent(); + break; + case EVENT_THORIM_AGGRO2: + { + me->MonsterYell("I remember you... In the mountains... But you... what is this? Where am--", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_AGGRO2); + events.PopEvent(); - EntryCheckPredicate pred(NPC_SIF); - summons.DoAction(ACTION_SIF_START_TALK, pred); - break; - } - case EVENT_THORIM_START_PHASE1: - { - events.PopEvent(); - events.ScheduleEvent(EVENT_THORIM_STORMHAMMER, 8000, 0, EVENT_PHASE_START); - events.ScheduleEvent(EVENT_THORIM_CHARGE_ORB, 14000, 0, EVENT_PHASE_START); - events.ScheduleEvent(EVENT_THORIM_FILL_ARENA, 0, 0, EVENT_PHASE_START); - events.ScheduleEvent(EVENT_THORIM_LIGHTNING_ORB, 5000, 0, EVENT_PHASE_START); // checked every 5 secs if there are players on arena - events.ScheduleEvent(EVENT_THORIM_NOT_REACH_IN_TIME, 300000, 0, EVENT_PHASE_START); + EntryCheckPredicate pred(NPC_SIF); + summons.DoAction(ACTION_SIF_START_TALK, pred); + break; + } + case EVENT_THORIM_START_PHASE1: + { + events.PopEvent(); + events.ScheduleEvent(EVENT_THORIM_STORMHAMMER, 8000, 0, EVENT_PHASE_START); + events.ScheduleEvent(EVENT_THORIM_CHARGE_ORB, 14000, 0, EVENT_PHASE_START); + events.ScheduleEvent(EVENT_THORIM_FILL_ARENA, 0, 0, EVENT_PHASE_START); + events.ScheduleEvent(EVENT_THORIM_LIGHTNING_ORB, 5000, 0, EVENT_PHASE_START); // checked every 5 secs if there are players on arena + events.ScheduleEvent(EVENT_THORIM_NOT_REACH_IN_TIME, 300000, 0, EVENT_PHASE_START); - EntryCheckPredicate pred(NPC_SIF); - summons.DoAction(ACTION_SIF_START_DOMINION, pred); - break; - } - case EVENT_THORIM_STORMHAMMER: - me->CastCustomSpell(SPELL_STORMHAMMER, SPELLVALUE_MAX_TARGETS, 1, me->GetVictim(), false); - events.RepeatEvent(16000); - PlaySpecial(); - break; - case EVENT_THORIM_CHARGE_ORB: - me->CastCustomSpell(SPELL_CHARGE_ORB, SPELLVALUE_MAX_TARGETS, 1, me, false); - events.RepeatEvent(16000); - PlaySpecial(); - break; - case EVENT_THORIM_LIGHTNING_ORB: - { - if (GetArenaPlayer()) - { - // Player found, repeat and return - events.RepeatEvent(5000); - return; - } + EntryCheckPredicate pred(NPC_SIF); + summons.DoAction(ACTION_SIF_START_DOMINION, pred); + break; + } + case EVENT_THORIM_STORMHAMMER: + me->CastCustomSpell(SPELL_STORMHAMMER, SPELLVALUE_MAX_TARGETS, 1, me->GetVictim(), false); + events.RepeatEvent(16000); + PlaySpecial(); + break; + case EVENT_THORIM_CHARGE_ORB: + me->CastCustomSpell(SPELL_CHARGE_ORB, SPELLVALUE_MAX_TARGETS, 1, me, false); + events.RepeatEvent(16000); + PlaySpecial(); + break; + case EVENT_THORIM_LIGHTNING_ORB: + { + if (GetArenaPlayer()) + { + // Player found, repeat and return + events.RepeatEvent(5000); + return; + } - // No players found - me->MonsterYell("Failures! Weaklings!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_AWIPE); - me->SummonCreature(NPC_LIGHTNING_ORB, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + // No players found + me->MonsterYell("Failures! Weaklings!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_AWIPE); + me->SummonCreature(NPC_LIGHTNING_ORB, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - _isArenaEmpty = true; - events.PopEvent(); - events.CancelEvent(EVENT_THORIM_NOT_REACH_IN_TIME); - break; - } - case EVENT_THORIM_NOT_REACH_IN_TIME: - _isArenaEmpty = true; - events.PopEvent(); - events.CancelEvent(EVENT_THORIM_LIGHTNING_ORB); - me->CastSpell(me, SPELL_BERSERK_FRIENDS, true); - me->SummonCreature(NPC_LIGHTNING_ORB, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - break; - case EVENT_THORIM_FILL_ARENA: - SpawnArenaNPCs(); - events.RepeatEvent(10000); - PlaySpecial(); - break; - case EVENT_THORIM_UNBALANCING_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_UNBALANCING_STRIKE, false); - events.RepeatEvent(20000); - break; - case EVENT_THORIM_LIGHTNING_CHARGE: - me->CastSpell(me, SPELL_LIGHTNING_PILLAR_P2, true); - events.PopEvent(); - break; - case EVENT_THORIM_CHAIN_LIGHTNING: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false); - events.RepeatEvent(15000); - break; - case EVENT_THORIM_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - events.PopEvent(); - me->MonsterYell("My patience has reached its limit!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_BERSERK); - break; - case EVENT_THORIM_OUTRO1: - events.PopEvent(); - if (_hardMode) - { - me->MonsterYell("You! Fiend! You are not my beloved! Be gone!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HARD1); - events.ScheduleEvent(EVENT_THORIM_OUTRO2, 5000, 0, 3); - EntryCheckPredicate pred(NPC_SIF); - summons.DoAction(ACTION_SIF_TRANSFORM, pred); - } - else - { - me->MonsterYell("I feel as though I am awakening from a nightmare, but the shadows in this place yet linger.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_NORM1); - events.ScheduleEvent(EVENT_THORIM_OUTRO2, 9000, 0, 3); - } - break; - case EVENT_THORIM_OUTRO2: - events.PopEvent(); - if (_hardMode) - { - me->MonsterYell("Behold the hand behind all the evil that has befallen Ulduar! Left my kingdom in ruins, corrupted my brother and slain my wife!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HARD2); - events.ScheduleEvent(EVENT_THORIM_OUTRO3, 12000, 0, 3); - } - else - { - me->MonsterYell("Sif... was Sif here? Impossible--she died by my brother's hand. A dark nightmare indeed....", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_NORM2); - events.ScheduleEvent(EVENT_THORIM_OUTRO3, 10000, 0, 3); - } - break; - case EVENT_THORIM_OUTRO3: - events.PopEvent(); - if (_hardMode) - { - me->MonsterYell("And now it falls to you, champions, to avenge us all! The task before you is great, but I will lend you my aid as I am able. You must prevail!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_HARD3); - } - else - { - me->MonsterYell("I need time to reflect.... I will aid your cause if you should require it. I owe you at least that much. Farewell.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_NORM3); - } + _isArenaEmpty = true; + events.PopEvent(); + events.CancelEvent(EVENT_THORIM_NOT_REACH_IN_TIME); + break; + } + case EVENT_THORIM_NOT_REACH_IN_TIME: + _isArenaEmpty = true; + events.PopEvent(); + events.CancelEvent(EVENT_THORIM_LIGHTNING_ORB); + me->CastSpell(me, SPELL_BERSERK_FRIENDS, true); + me->SummonCreature(NPC_LIGHTNING_ORB, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + break; + case EVENT_THORIM_FILL_ARENA: + SpawnArenaNPCs(); + events.RepeatEvent(10000); + PlaySpecial(); + break; + case EVENT_THORIM_UNBALANCING_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_UNBALANCING_STRIKE, false); + events.RepeatEvent(20000); + break; + case EVENT_THORIM_LIGHTNING_CHARGE: + me->CastSpell(me, SPELL_LIGHTNING_PILLAR_P2, true); + events.PopEvent(); + break; + case EVENT_THORIM_CHAIN_LIGHTNING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false); + events.RepeatEvent(15000); + break; + case EVENT_THORIM_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + events.PopEvent(); + me->MonsterYell("My patience has reached its limit!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_BERSERK); + break; + case EVENT_THORIM_OUTRO1: + events.PopEvent(); + if (_hardMode) + { + me->MonsterYell("You! Fiend! You are not my beloved! Be gone!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HARD1); + events.ScheduleEvent(EVENT_THORIM_OUTRO2, 5000, 0, 3); + EntryCheckPredicate pred(NPC_SIF); + summons.DoAction(ACTION_SIF_TRANSFORM, pred); + } + else + { + me->MonsterYell("I feel as though I am awakening from a nightmare, but the shadows in this place yet linger.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_NORM1); + events.ScheduleEvent(EVENT_THORIM_OUTRO2, 9000, 0, 3); + } + break; + case EVENT_THORIM_OUTRO2: + events.PopEvent(); + if (_hardMode) + { + me->MonsterYell("Behold the hand behind all the evil that has befallen Ulduar! Left my kingdom in ruins, corrupted my brother and slain my wife!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HARD2); + events.ScheduleEvent(EVENT_THORIM_OUTRO3, 12000, 0, 3); + } + else + { + me->MonsterYell("Sif... was Sif here? Impossible--she died by my brother's hand. A dark nightmare indeed....", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_NORM2); + events.ScheduleEvent(EVENT_THORIM_OUTRO3, 10000, 0, 3); + } + break; + case EVENT_THORIM_OUTRO3: + events.PopEvent(); + if (_hardMode) + { + me->MonsterYell("And now it falls to you, champions, to avenge us all! The task before you is great, but I will lend you my aid as I am able. You must prevail!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_HARD3); + } + else + { + me->MonsterYell("I need time to reflect.... I will aid your cause if you should require it. I owe you at least that much. Farewell.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_NORM3); + } - // Defeat credit - if (m_pInstance) - m_pInstance->SetData(TYPE_THORIM, DONE); + // Defeat credit + if (m_pInstance) + m_pInstance->SetData(TYPE_THORIM, DONE); - me->DespawnOrUnsummon(8000); - break; - } + me->DespawnOrUnsummon(8000); + break; + } - if (!_encounterFinished) - DoMeleeAttackIfReady(); - } - }; + if (!_encounterFinished) + DoMeleeAttackIfReady(); + } + }; }; class boss_thorim_sif : public CreatureScript @@ -832,109 +832,109 @@ public: return new boss_thorim_sifAI (pCreature); } - struct boss_thorim_sifAI : public ScriptedAI - { - boss_thorim_sifAI(Creature* pCreature) : ScriptedAI(pCreature) { } + struct boss_thorim_sifAI : public ScriptedAI + { + boss_thorim_sifAI(Creature* pCreature) : ScriptedAI(pCreature) { } - void MoveInLineOfSight(Unit*) {} - void AttackStart(Unit*) {} + void MoveInLineOfSight(Unit*) {} + void AttackStart(Unit*) {} - bool _allowCast; - EventMap events; + bool _allowCast; + EventMap events; - void Reset() - { - events.Reset(); - me->SetReactState(REACT_PASSIVE); - _allowCast = false; - } + void Reset() + { + events.Reset(); + me->SetReactState(REACT_PASSIVE); + _allowCast = false; + } - void DoAction(int32 param) - { - if (param == ACTION_SIF_START_TALK) - events.ScheduleEvent(EVENT_SIF_START_TALK, 9000); - else if (param == ACTION_SIF_START_DOMINION) - { - if (me->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_THORIM))) - me->CastSpell(cr, SPELL_TOUCH_OF_DOMINION, false); + void DoAction(int32 param) + { + if (param == ACTION_SIF_START_TALK) + events.ScheduleEvent(EVENT_SIF_START_TALK, 9000); + else if (param == ACTION_SIF_START_DOMINION) + { + if (me->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_THORIM))) + me->CastSpell(cr, SPELL_TOUCH_OF_DOMINION, false); - events.ScheduleEvent(EVENT_SIF_FINISH_DOMINION, 150000); - } - else if (param == ACTION_SIF_JOIN_FIGHT) - { - me->InterruptNonMeleeSpells(false); - events.ScheduleEvent(EVENT_SIF_JOIN_TALK, 9000); - events.CancelEvent(EVENT_SIF_START_TALK); - events.CancelEvent(EVENT_SIF_FINISH_DOMINION); - } - else if (param == ACTION_SIF_TRANSFORM) - { - me->CastSpell(me, SPELL_SIF_TRANSFORM, true); - me->DespawnOrUnsummon(5000); - events.Reset(); - _allowCast = false; - } - } + events.ScheduleEvent(EVENT_SIF_FINISH_DOMINION, 150000); + } + else if (param == ACTION_SIF_JOIN_FIGHT) + { + me->InterruptNonMeleeSpells(false); + events.ScheduleEvent(EVENT_SIF_JOIN_TALK, 9000); + events.CancelEvent(EVENT_SIF_START_TALK); + events.CancelEvent(EVENT_SIF_FINISH_DOMINION); + } + else if (param == ACTION_SIF_TRANSFORM) + { + me->CastSpell(me, SPELL_SIF_TRANSFORM, true); + me->DespawnOrUnsummon(5000); + events.Reset(); + _allowCast = false; + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + void UpdateAI(uint32 diff) + { + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SIF_FINISH_DOMINION: - events.PopEvent(); - me->PlayDirectSound(SOUND_SIF_DESPAWN); - me->MonsterYell("This pathetic morons are harmless. Relive my station, dispose of them!", LANG_UNIVERSAL, 0); - me->DespawnOrUnsummon(5000); - break; - case EVENT_SIF_START_TALK: - events.PopEvent(); - me->MonsterYell("Thorim, my lord, why else would these invaders have come into your sanctum but to slay you? They must be stopped!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SOUND_SIF_START); - break; - case EVENT_SIF_JOIN_TALK: - me->PlayDirectSound(SOUND_SIF_EVENT); - me->MonsterYell("Impossible! Lord Thorim, I will bring your foes a frigid death!", LANG_UNIVERSAL, 0); - events.PopEvent(); - events.ScheduleEvent(EVENT_SIF_FROST_NOVA_START, 1000); - events.ScheduleEvent(EVENT_SIF_FROSTBOLT_VALLEY, 11000); - events.ScheduleEvent(EVENT_SIF_BLIZZARD, 15000); - break; - case EVENT_SIF_FROSTBOLT_VALLEY: - me->CastSpell(me, SPELL_FROSTBOLT_VALLEY, false); - events.RepeatEvent(13000); - return; - case EVENT_SIF_BLIZZARD: - me->SummonCreature(NPC_SIF_BLIZZARD, 2108.7f, -280.04f, 419.42f, 0, TEMPSUMMON_TIMED_DESPAWN, 30000); - events.RepeatEvent(30000); - return; - case EVENT_SIF_FROST_NOVA_START: - me->NearTeleportTo(2108+urand(0, 42), -238-irand(0,46), 420.02f, me->GetAngle(&Middle)); - events.RepeatEvent(20000); - events.DelayEvents(5001); - events.ScheduleEvent(EVENT_SIF_FROST_NOVA_CAST, 2500); - _allowCast = false; - return; - case EVENT_SIF_FROST_NOVA_CAST: - _allowCast = true; - me->CastSpell(me, SPELL_FROST_NOVA, false); - events.PopEvent(); - return; - } + switch (events.GetEvent()) + { + case EVENT_SIF_FINISH_DOMINION: + events.PopEvent(); + me->PlayDirectSound(SOUND_SIF_DESPAWN); + me->MonsterYell("This pathetic morons are harmless. Relive my station, dispose of them!", LANG_UNIVERSAL, 0); + me->DespawnOrUnsummon(5000); + break; + case EVENT_SIF_START_TALK: + events.PopEvent(); + me->MonsterYell("Thorim, my lord, why else would these invaders have come into your sanctum but to slay you? They must be stopped!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SOUND_SIF_START); + break; + case EVENT_SIF_JOIN_TALK: + me->PlayDirectSound(SOUND_SIF_EVENT); + me->MonsterYell("Impossible! Lord Thorim, I will bring your foes a frigid death!", LANG_UNIVERSAL, 0); + events.PopEvent(); + events.ScheduleEvent(EVENT_SIF_FROST_NOVA_START, 1000); + events.ScheduleEvent(EVENT_SIF_FROSTBOLT_VALLEY, 11000); + events.ScheduleEvent(EVENT_SIF_BLIZZARD, 15000); + break; + case EVENT_SIF_FROSTBOLT_VALLEY: + me->CastSpell(me, SPELL_FROSTBOLT_VALLEY, false); + events.RepeatEvent(13000); + return; + case EVENT_SIF_BLIZZARD: + me->SummonCreature(NPC_SIF_BLIZZARD, 2108.7f, -280.04f, 419.42f, 0, TEMPSUMMON_TIMED_DESPAWN, 30000); + events.RepeatEvent(30000); + return; + case EVENT_SIF_FROST_NOVA_START: + me->NearTeleportTo(2108+urand(0, 42), -238-irand(0,46), 420.02f, me->GetAngle(&Middle)); + events.RepeatEvent(20000); + events.DelayEvents(5001); + events.ScheduleEvent(EVENT_SIF_FROST_NOVA_CAST, 2500); + _allowCast = false; + return; + case EVENT_SIF_FROST_NOVA_CAST: + _allowCast = true; + me->CastSpell(me, SPELL_FROST_NOVA, false); + events.PopEvent(); + return; + } - // has casting check before event select (return in events) - if (_allowCast) - if (Player* target = SelectTargetFromPlayerList(70)) - { - me->CastSpell(target, SPELL_FROSTBOLT, false); - me->StopMoving(); - } - } - }; + // has casting check before event select (return in events) + if (_allowCast) + if (Player* target = SelectTargetFromPlayerList(70)) + { + me->CastSpell(target, SPELL_FROSTBOLT, false); + me->StopMoving(); + } + } + }; }; class boss_thorim_lightning_orb : public CreatureScript @@ -947,42 +947,42 @@ public: return new boss_thorim_lightning_orbAI (pCreature); } - struct boss_thorim_lightning_orbAI : public npc_escortAI - { - boss_thorim_lightning_orbAI(Creature* pCreature) : npc_escortAI(pCreature) - { - InitWaypoint(); - Reset(); - Start(false, true, 0); - } + struct boss_thorim_lightning_orbAI : public npc_escortAI + { + boss_thorim_lightning_orbAI(Creature* pCreature) : npc_escortAI(pCreature) + { + InitWaypoint(); + Reset(); + Start(false, true, 0); + } - uint32 Timer; + uint32 Timer; - void EnterEvadeMode() {} - void MoveInLineOfSight(Unit*) {} - void AttackStart(Unit*) {} + void EnterEvadeMode() {} + void MoveInLineOfSight(Unit*) {} + void AttackStart(Unit*) {} - void InitWaypoint() - { - AddWaypoint(1, 2135, -304, 438.24f, 0); - AddWaypoint(2, 2132, -441, 438.24f, 0); - AddWaypoint(3, 2167, -442, 438.24f, 0); - AddWaypoint(4, 2227, -432, 412.18f, 0); - AddWaypoint(5, 2227, -263, 412.17f, 0); - AddWaypoint(6, 2179, -262, 414.7f, 0); - AddWaypoint(7, 2169, -261, 419.3f, 0); - AddWaypoint(8, 2110, -251, 419.42f, 0); - } + void InitWaypoint() + { + AddWaypoint(1, 2135, -304, 438.24f, 0); + AddWaypoint(2, 2132, -441, 438.24f, 0); + AddWaypoint(3, 2167, -442, 438.24f, 0); + AddWaypoint(4, 2227, -432, 412.18f, 0); + AddWaypoint(5, 2227, -263, 412.17f, 0); + AddWaypoint(6, 2179, -262, 414.7f, 0); + AddWaypoint(7, 2169, -261, 419.3f, 0); + AddWaypoint(8, 2110, -251, 419.42f, 0); + } - void Reset() - { - me->CastSpell(me, SPELL_LIGHTNING_DESTRUCTION, true); - } + void Reset() + { + me->CastSpell(me, SPELL_LIGHTNING_DESTRUCTION, true); + } - void WaypointReached(uint32 point) - { - } - }; + void WaypointReached(uint32 point) + { + } + }; }; class boss_thorim_trap : public CreatureScript @@ -995,32 +995,32 @@ public: return new boss_thorim_trapAI (pCreature); } - struct boss_thorim_trapAI : public NullCreatureAI - { - boss_thorim_trapAI(Creature* pCreature) : NullCreatureAI(pCreature) { } + struct boss_thorim_trapAI : public NullCreatureAI + { + boss_thorim_trapAI(Creature* pCreature) : NullCreatureAI(pCreature) { } - uint32 _checkTimer; + uint32 _checkTimer; - void Reset() { _checkTimer = 1; } - void UpdateAI(uint32 diff) - { - if (_checkTimer) - { - _checkTimer += diff; - if ((_checkTimer >= 1000 && _checkTimer < 10000) || _checkTimer >= 60000) - { - if (me->SelectNearbyTarget(NULL, 12.0f)) - { - me->CastSpell(me, SPELL_LIGHTNING_FIELD, true); - me->CastSpell(me, (me->GetEntry() == 33054 /*NPC_THORIM_TRAP_BUNNY*/ ? SPELL_PARALYTIC_FIELD_FIRST : SPELL_PARALYTIC_FIELD_SECOND), true); - _checkTimer = 10000; - return; - } - _checkTimer = 1; - } - } - } - }; + void Reset() { _checkTimer = 1; } + void UpdateAI(uint32 diff) + { + if (_checkTimer) + { + _checkTimer += diff; + if ((_checkTimer >= 1000 && _checkTimer < 10000) || _checkTimer >= 60000) + { + if (me->SelectNearbyTarget(NULL, 12.0f)) + { + me->CastSpell(me, SPELL_LIGHTNING_FIELD, true); + me->CastSpell(me, (me->GetEntry() == 33054 /*NPC_THORIM_TRAP_BUNNY*/ ? SPELL_PARALYTIC_FIELD_FIRST : SPELL_PARALYTIC_FIELD_SECOND), true); + _checkTimer = 10000; + return; + } + _checkTimer = 1; + } + } + } + }; }; class boss_thorim_sif_blizzard : public CreatureScript @@ -1033,43 +1033,43 @@ public: return new boss_thorim_sif_blizzardAI (pCreature); } - struct boss_thorim_sif_blizzardAI : public npc_escortAI - { - boss_thorim_sif_blizzardAI(Creature* pCreature) : npc_escortAI(pCreature) - { - InitWaypoint(); - Reset(); - Start(false, true, 0); - SetDespawnAtEnd(false); - } + struct boss_thorim_sif_blizzardAI : public npc_escortAI + { + boss_thorim_sif_blizzardAI(Creature* pCreature) : npc_escortAI(pCreature) + { + InitWaypoint(); + Reset(); + Start(false, true, 0); + SetDespawnAtEnd(false); + } - void MoveInLineOfSight(Unit *who) {} - void EnterCombat(Unit *who) {} - void AttackStart(Unit *who) {} + void MoveInLineOfSight(Unit *who) {} + void EnterCombat(Unit *who) {} + void AttackStart(Unit *who) {} - void InitWaypoint() - { - AddWaypoint(1, 2104.6f, -268.5f, 419.4f, 0); - AddWaypoint(2, 2104.3f, -256.3f, 419.4f, 0); - AddWaypoint(3, 2109.3f, -246.4f, 419.4f, 0); - AddWaypoint(4, 2117.9f, -238.6f, 419.4f, 0); - AddWaypoint(5, 2128.8f, -232.1f, 419.4f, 0); - AddWaypoint(6, 2151.9f, -237.5f, 419.4f, 0); - AddWaypoint(7, 2164.9f, -256.3f, 419.4f, 0); - AddWaypoint(8, 2161.5f, -280.0f, 419.4f, 0); - } + void InitWaypoint() + { + AddWaypoint(1, 2104.6f, -268.5f, 419.4f, 0); + AddWaypoint(2, 2104.3f, -256.3f, 419.4f, 0); + AddWaypoint(3, 2109.3f, -246.4f, 419.4f, 0); + AddWaypoint(4, 2117.9f, -238.6f, 419.4f, 0); + AddWaypoint(5, 2128.8f, -232.1f, 419.4f, 0); + AddWaypoint(6, 2151.9f, -237.5f, 419.4f, 0); + AddWaypoint(7, 2164.9f, -256.3f, 419.4f, 0); + AddWaypoint(8, 2161.5f, -280.0f, 419.4f, 0); + } - void Reset() - { - me->SetSpeed(MOVE_RUN, 1); - me->SetSpeed(MOVE_WALK, 1); - me->CastSpell(me, RAID_MODE(SPELL_BLIZZARD_10, SPELL_BLIZZARD_25), true); - } + void Reset() + { + me->SetSpeed(MOVE_RUN, 1); + me->SetSpeed(MOVE_WALK, 1); + me->CastSpell(me, RAID_MODE(SPELL_BLIZZARD_10, SPELL_BLIZZARD_25), true); + } - void WaypointReached(uint32 point) - { - } - }; + void WaypointReached(uint32 point) + { + } + }; }; class boss_thorim_pillar : public CreatureScript @@ -1082,37 +1082,37 @@ public: return new boss_thorim_pillarAI (pCreature); } - struct boss_thorim_pillarAI : public NullCreatureAI - { - boss_thorim_pillarAI(Creature* pCreature) : NullCreatureAI(pCreature) { } + struct boss_thorim_pillarAI : public NullCreatureAI + { + boss_thorim_pillarAI(Creature* pCreature) : NullCreatureAI(pCreature) { } - uint32 _resetTimer; + uint32 _resetTimer; - void Reset() - { - _resetTimer = 0; - me->SetControlled(true, UNIT_STATE_STUNNED); - me->SetDisableGravity(true); - } + void Reset() + { + _resetTimer = 0; + me->SetControlled(true, UNIT_STATE_STUNNED); + me->SetDisableGravity(true); + } - void SpellHit(Unit*, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_CHARGE_ORB) - me->CastSpell(me, SPELL_LIGHTNING_PILLAR_P1, true); - else if (spellInfo->Id == SPELL_LIGHTNING_PILLAR_P2) - { - if (Creature *cr = me->FindNearestCreature(NPC_THUNDER_ORB, 100)) - cr->CastSpell(cr, SPELL_LIGHTNING_ORB_VISUAL, true); - } - } + void SpellHit(Unit*, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_CHARGE_ORB) + me->CastSpell(me, SPELL_LIGHTNING_PILLAR_P1, true); + else if (spellInfo->Id == SPELL_LIGHTNING_PILLAR_P2) + { + if (Creature *cr = me->FindNearestCreature(NPC_THUNDER_ORB, 100)) + cr->CastSpell(cr, SPELL_LIGHTNING_ORB_VISUAL, true); + } + } - void UpdateAI(uint32 diff) - { - _resetTimer += diff; - if (_resetTimer >= 10000) - Reset(); // _resetTimer set to 0 - } - }; + void UpdateAI(uint32 diff) + { + _resetTimer += diff; + if (_resetTimer >= 10000) + Reset(); // _resetTimer set to 0 + } + }; }; class boss_thorim_start_npcs : public CreatureScript @@ -1125,148 +1125,148 @@ public: return new boss_thorim_start_npcsAI (pCreature); } - struct boss_thorim_start_npcsAI : public ScriptedAI - { - boss_thorim_start_npcsAI(Creature* pCreature) : ScriptedAI(pCreature) { } + struct boss_thorim_start_npcsAI : public ScriptedAI + { + boss_thorim_start_npcsAI(Creature* pCreature) : ScriptedAI(pCreature) { } - EventMap events; - bool _isCaster; - bool _playerAttack; + EventMap events; + bool _isCaster; + bool _playerAttack; - void Reset() - { - events.Reset(); - _isCaster = (me->GetEntry() == NPC_DARK_RUNE_ACOLYTE_I); - _playerAttack = false; - if (me->GetEntry() != NPC_JORMUNGAR_BEHEMOT) - if (Creature* cr = me->FindNearestCreature(NPC_JORMUNGAR_BEHEMOT, 30.0f)) - AttackStart(cr); - } + void Reset() + { + events.Reset(); + _isCaster = (me->GetEntry() == NPC_DARK_RUNE_ACOLYTE_I); + _playerAttack = false; + if (me->GetEntry() != NPC_JORMUNGAR_BEHEMOT) + if (Creature* cr = me->FindNearestCreature(NPC_JORMUNGAR_BEHEMOT, 30.0f)) + AttackStart(cr); + } - void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) - { - if (!_playerAttack && who && (who->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(who->GetOwnerGUID()))) - { - if (me->GetInstanceScript()) - if (Creature* thorim = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_THORIM))) - { - if (!thorim->IsInCombat()) - { - thorim->SetInCombatWithZone(); - thorim->AI()->AttackStart(who); - } - } - _playerAttack = true; - me->getThreatManager().resetAllAggro(); - me->CallForHelp(40.0f); - AttackStart(who); - } + void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) + { + if (!_playerAttack && who && (who->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(who->GetOwnerGUID()))) + { + if (me->GetInstanceScript()) + if (Creature* thorim = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_THORIM))) + { + if (!thorim->IsInCombat()) + { + thorim->SetInCombatWithZone(); + thorim->AI()->AttackStart(who); + } + } + _playerAttack = true; + me->getThreatManager().resetAllAggro(); + me->CallForHelp(40.0f); + AttackStart(who); + } - if (!_playerAttack && me->HealthBelowPct(60)) - me->SetHealth(me->GetMaxHealth()); - } + if (!_playerAttack && me->HealthBelowPct(60)) + me->SetHealth(me->GetMaxHealth()); + } - void JustDied(Unit*) - { - if (me->GetInstanceScript()) - if (Creature* thorim = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_THORIM))) - thorim->AI()->DoAction(ACTION_START_TRASH_DIED); - } + void JustDied(Unit*) + { + if (me->GetInstanceScript()) + if (Creature* thorim = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_THORIM))) + thorim->AI()->DoAction(ACTION_START_TRASH_DIED); + } - void EnterCombat(Unit* who) - { - if (me->GetEntry() == NPC_DARK_RUNE_ACOLYTE_I) - { - events.ScheduleEvent(EVENT_DR_ACOLYTE_GH, 10000); - events.ScheduleEvent(EVENT_DR_ACOLYTE_HS, 5000); - events.ScheduleEvent(EVENT_DR_ACOLYTE_R, 7000); - } - else if (me->GetEntry() == NPC_CAPTURED_MERCENARY_SOLDIER_ALLY || me->GetEntry() == NPC_CAPTURED_MERCENARY_SOLDIER_HORDE) - { - events.ScheduleEvent(EVENT_CM_SOLDIER_BS, 9000); - events.ScheduleEvent(EVENT_CM_SOLDIER_WC, 5000); - events.ScheduleEvent(EVENT_CM_SOLDIER_S, 0); - } - else if (me->GetEntry() == NPC_CAPTURED_MERCENARY_CAPTAIN_ALLY || me->GetEntry() == NPC_CAPTURED_MERCENARY_CAPTAIN_HORDE) - { - events.ScheduleEvent(EVENT_CM_CAPTAIN_D, 9000); - events.ScheduleEvent(EVENT_CM_CAPTAIN_HC, 5000); - } - else if (me->GetEntry() == NPC_JORMUNGAR_BEHEMOT) - { - events.ScheduleEvent(EVENT_JB_ACID_BREATH, 12000); - events.ScheduleEvent(EVENT_JB_SWEEP, 5000); - } + void EnterCombat(Unit* who) + { + if (me->GetEntry() == NPC_DARK_RUNE_ACOLYTE_I) + { + events.ScheduleEvent(EVENT_DR_ACOLYTE_GH, 10000); + events.ScheduleEvent(EVENT_DR_ACOLYTE_HS, 5000); + events.ScheduleEvent(EVENT_DR_ACOLYTE_R, 7000); + } + else if (me->GetEntry() == NPC_CAPTURED_MERCENARY_SOLDIER_ALLY || me->GetEntry() == NPC_CAPTURED_MERCENARY_SOLDIER_HORDE) + { + events.ScheduleEvent(EVENT_CM_SOLDIER_BS, 9000); + events.ScheduleEvent(EVENT_CM_SOLDIER_WC, 5000); + events.ScheduleEvent(EVENT_CM_SOLDIER_S, 0); + } + else if (me->GetEntry() == NPC_CAPTURED_MERCENARY_CAPTAIN_ALLY || me->GetEntry() == NPC_CAPTURED_MERCENARY_CAPTAIN_HORDE) + { + events.ScheduleEvent(EVENT_CM_CAPTAIN_D, 9000); + events.ScheduleEvent(EVENT_CM_CAPTAIN_HC, 5000); + } + else if (me->GetEntry() == NPC_JORMUNGAR_BEHEMOT) + { + events.ScheduleEvent(EVENT_JB_ACID_BREATH, 12000); + events.ScheduleEvent(EVENT_JB_SWEEP, 5000); + } - me->CallForHelp(10); - } + me->CallForHelp(10); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_DR_ACOLYTE_GH: - if (HealthBelowPct(60)) - me->CastSpell(me, SPELL_GREATER_HEAL, false); - else if (Unit* target = DoSelectLowestHpFriendly(60.0f, 20)) - me->CastSpell(target, SPELL_GREATER_HEAL, false); - events.RepeatEvent(10000); - break; - case EVENT_DR_ACOLYTE_HS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0)) - me->CastSpell(target, SPELL_HOLY_SMITE, false); - events.RepeatEvent(1600); - break; - case EVENT_DR_ACOLYTE_R: - if (HealthBelowPct(75) && !me->HasAura(SPELL_RENEW)) - me->CastSpell(me, SPELL_GREATER_HEAL, false); - else if (Unit* target = DoSelectLowestHpFriendly(60.0f, 10)) - me->CastSpell(target, SPELL_RENEW, false); - events.RepeatEvent(7000); - break; - case EVENT_CM_SOLDIER_BS: - me->CastSpell(me->GetVictim(), SPELL_BARBED_SHOT, false); - events.RepeatEvent(9000); - break; - case EVENT_CM_SOLDIER_WC: - me->CastSpell(me->GetVictim(), SPELL_WING_CLIP, false); - events.RepeatEvent(5000); - break; - case EVENT_CM_SOLDIER_S: - if (me->GetDistance(me->GetVictim()) > 8) - me->CastSpell(me->GetVictim(), SPELL_SHOOT, false); - - events.RepeatEvent(1500); - break; - case EVENT_CM_CAPTAIN_D: - me->CastSpell(me->GetVictim(), SPELL_DEVASTATE, false); - events.RepeatEvent(9000); - break; - case EVENT_CM_CAPTAIN_HC: - me->CastSpell(me->GetVictim(), SPELL_HEROIC_STRIKE, false); - events.RepeatEvent(5000); - break; - case EVENT_JB_ACID_BREATH: - me->CastSpell(me->GetVictim(), SPELL_ACID_BREATH, false); - events.RepeatEvent(12000); - break; - case EVENT_JB_SWEEP: - me->CastSpell(me->GetVictim(), SPELL_SWEEP, false); - events.RepeatEvent(5000); - break; - } + switch (events.GetEvent()) + { + case EVENT_DR_ACOLYTE_GH: + if (HealthBelowPct(60)) + me->CastSpell(me, SPELL_GREATER_HEAL, false); + else if (Unit* target = DoSelectLowestHpFriendly(60.0f, 20)) + me->CastSpell(target, SPELL_GREATER_HEAL, false); + events.RepeatEvent(10000); + break; + case EVENT_DR_ACOLYTE_HS: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0)) + me->CastSpell(target, SPELL_HOLY_SMITE, false); + events.RepeatEvent(1600); + break; + case EVENT_DR_ACOLYTE_R: + if (HealthBelowPct(75) && !me->HasAura(SPELL_RENEW)) + me->CastSpell(me, SPELL_GREATER_HEAL, false); + else if (Unit* target = DoSelectLowestHpFriendly(60.0f, 10)) + me->CastSpell(target, SPELL_RENEW, false); + events.RepeatEvent(7000); + break; + case EVENT_CM_SOLDIER_BS: + me->CastSpell(me->GetVictim(), SPELL_BARBED_SHOT, false); + events.RepeatEvent(9000); + break; + case EVENT_CM_SOLDIER_WC: + me->CastSpell(me->GetVictim(), SPELL_WING_CLIP, false); + events.RepeatEvent(5000); + break; + case EVENT_CM_SOLDIER_S: + if (me->GetDistance(me->GetVictim()) > 8) + me->CastSpell(me->GetVictim(), SPELL_SHOOT, false); + + events.RepeatEvent(1500); + break; + case EVENT_CM_CAPTAIN_D: + me->CastSpell(me->GetVictim(), SPELL_DEVASTATE, false); + events.RepeatEvent(9000); + break; + case EVENT_CM_CAPTAIN_HC: + me->CastSpell(me->GetVictim(), SPELL_HEROIC_STRIKE, false); + events.RepeatEvent(5000); + break; + case EVENT_JB_ACID_BREATH: + me->CastSpell(me->GetVictim(), SPELL_ACID_BREATH, false); + events.RepeatEvent(12000); + break; + case EVENT_JB_SWEEP: + me->CastSpell(me->GetVictim(), SPELL_SWEEP, false); + events.RepeatEvent(5000); + break; + } - if (!_isCaster || (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10)) - DoMeleeAttackIfReady(); - } - }; + if (!_isCaster || (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10)) + DoMeleeAttackIfReady(); + } + }; }; class boss_thorim_gauntlet_npcs : public CreatureScript @@ -1279,101 +1279,101 @@ public: return new boss_thorim_gauntlet_npcsAI (pCreature); } - struct boss_thorim_gauntlet_npcsAI : public ScriptedAI - { - boss_thorim_gauntlet_npcsAI(Creature* pCreature) : ScriptedAI(pCreature) { } + struct boss_thorim_gauntlet_npcsAI : public ScriptedAI + { + boss_thorim_gauntlet_npcsAI(Creature* pCreature) : ScriptedAI(pCreature) { } - EventMap events; - bool _isCaster; + EventMap events; + bool _isCaster; - void Reset() - { - events.Reset(); - _isCaster = (me->GetEntry() == NPC_DARK_RUNE_ACOLYTE_G); - } + void Reset() + { + events.Reset(); + _isCaster = (me->GetEntry() == NPC_DARK_RUNE_ACOLYTE_G); + } - void EnterCombat(Unit* who) - { - if (me->GetEntry() == NPC_IRON_RING_GUARD) - { - events.ScheduleEvent(EVENT_IR_GUARD_IMPALE, 12000); - events.ScheduleEvent(EVENT_IR_GUARD_WHIRL, 5000); - } - else if (me->GetEntry() == NPC_DARK_RUNE_ACOLYTE_I) - { - events.ScheduleEvent(EVENT_DR_ACOLYTE_GH, 10000); - events.ScheduleEvent(EVENT_DR_ACOLYTE_HS, 5000); - events.ScheduleEvent(EVENT_DR_ACOLYTE_R, 7000); - } - else if (me->GetEntry() == NPC_IRON_HONOR_GUARD) - { - events.ScheduleEvent(EVENT_IH_GUARD_CLEAVE, 6000); - events.ScheduleEvent(EVENT_IH_GUARD_HAMSTRING, 9000); - events.ScheduleEvent(EVENT_IH_GUARD_SHIELD_SMASH, 15000); - - if (Creature* runeGiant = me->FindNearestCreature(NPC_ANCIENT_RUNE_GIANT, 200.0f)) - runeGiant->AI()->DoAction(ACTION_IRON_HONOR_DIED); - } + void EnterCombat(Unit* who) + { + if (me->GetEntry() == NPC_IRON_RING_GUARD) + { + events.ScheduleEvent(EVENT_IR_GUARD_IMPALE, 12000); + events.ScheduleEvent(EVENT_IR_GUARD_WHIRL, 5000); + } + else if (me->GetEntry() == NPC_DARK_RUNE_ACOLYTE_I) + { + events.ScheduleEvent(EVENT_DR_ACOLYTE_GH, 10000); + events.ScheduleEvent(EVENT_DR_ACOLYTE_HS, 5000); + events.ScheduleEvent(EVENT_DR_ACOLYTE_R, 7000); + } + else if (me->GetEntry() == NPC_IRON_HONOR_GUARD) + { + events.ScheduleEvent(EVENT_IH_GUARD_CLEAVE, 6000); + events.ScheduleEvent(EVENT_IH_GUARD_HAMSTRING, 9000); + events.ScheduleEvent(EVENT_IH_GUARD_SHIELD_SMASH, 15000); + + if (Creature* runeGiant = me->FindNearestCreature(NPC_ANCIENT_RUNE_GIANT, 200.0f)) + runeGiant->AI()->DoAction(ACTION_IRON_HONOR_DIED); + } - me->CallForHelp(25); - } + me->CallForHelp(25); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_IR_GUARD_IMPALE: - me->CastSpell(me->GetVictim(), SPELL_IMPALE, false); - events.RepeatEvent(12000); - break; - case EVENT_IR_GUARD_WHIRL: - me->CastSpell(me->GetVictim(), SPELL_WHIRLING_TRIP, false); - events.RepeatEvent(5000); - break; - case EVENT_DR_ACOLYTE_GH: - if (HealthBelowPct(60)) - me->CastSpell(me, SPELL_GREATER_HEAL, false); - else if (Unit* target = DoSelectLowestHpFriendly(60.0f, 20)) - me->CastSpell(target, SPELL_GREATER_HEAL, false); - events.RepeatEvent(10000); - break; - case EVENT_DR_ACOLYTE_HS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0)) - me->CastSpell(target, SPELL_HOLY_SMITE, false); - events.RepeatEvent(1600); - break; - case EVENT_DR_ACOLYTE_R: - if (HealthBelowPct(75) && !me->HasAura(SPELL_RENEW)) - me->CastSpell(me, SPELL_GREATER_HEAL, false); - else if (Unit* target = DoSelectLowestHpFriendly(60.0f, 10)) - me->CastSpell(target, SPELL_RENEW, false); - events.RepeatEvent(7000); - break; - case EVENT_IH_GUARD_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - events.RepeatEvent(6000); - break; - case EVENT_IH_GUARD_HAMSTRING: - me->CastSpell(me->GetVictim(), SPELL_HAMSTRING, false); - events.RepeatEvent(9000); - break; - case EVENT_IH_GUARD_SHIELD_SMASH: - me->CastSpell(me->GetVictim(), SPELL_SHIELD_SMASH, false); - events.RepeatEvent(15000); - break; - } + switch (events.GetEvent()) + { + case EVENT_IR_GUARD_IMPALE: + me->CastSpell(me->GetVictim(), SPELL_IMPALE, false); + events.RepeatEvent(12000); + break; + case EVENT_IR_GUARD_WHIRL: + me->CastSpell(me->GetVictim(), SPELL_WHIRLING_TRIP, false); + events.RepeatEvent(5000); + break; + case EVENT_DR_ACOLYTE_GH: + if (HealthBelowPct(60)) + me->CastSpell(me, SPELL_GREATER_HEAL, false); + else if (Unit* target = DoSelectLowestHpFriendly(60.0f, 20)) + me->CastSpell(target, SPELL_GREATER_HEAL, false); + events.RepeatEvent(10000); + break; + case EVENT_DR_ACOLYTE_HS: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0)) + me->CastSpell(target, SPELL_HOLY_SMITE, false); + events.RepeatEvent(1600); + break; + case EVENT_DR_ACOLYTE_R: + if (HealthBelowPct(75) && !me->HasAura(SPELL_RENEW)) + me->CastSpell(me, SPELL_GREATER_HEAL, false); + else if (Unit* target = DoSelectLowestHpFriendly(60.0f, 10)) + me->CastSpell(target, SPELL_RENEW, false); + events.RepeatEvent(7000); + break; + case EVENT_IH_GUARD_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + events.RepeatEvent(6000); + break; + case EVENT_IH_GUARD_HAMSTRING: + me->CastSpell(me->GetVictim(), SPELL_HAMSTRING, false); + events.RepeatEvent(9000); + break; + case EVENT_IH_GUARD_SHIELD_SMASH: + me->CastSpell(me->GetVictim(), SPELL_SHIELD_SMASH, false); + events.RepeatEvent(15000); + break; + } - if (!_isCaster || (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10)) - DoMeleeAttackIfReady(); - } - }; + if (!_isCaster || (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10)) + DoMeleeAttackIfReady(); + } + }; }; class boss_thorim_runic_colossus : public CreatureScript @@ -1386,130 +1386,130 @@ public: return new boss_thorim_runic_colossusAI (pCreature); } - struct boss_thorim_runic_colossusAI : public ScriptedAI - { - boss_thorim_runic_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) { } + struct boss_thorim_runic_colossusAI : public ScriptedAI + { + boss_thorim_runic_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) { } - EventMap events; - bool _leftHand; - bool _checkTarget; - float _nextTriggerPos; - uint64 _triggerLeftGUID[2], _triggerRightGUID[2]; + EventMap events; + bool _leftHand; + bool _checkTarget; + float _nextTriggerPos; + uint64 _triggerLeftGUID[2], _triggerRightGUID[2]; - void Reset() - { - _nextTriggerPos = 0.0f; - _leftHand = false; - _checkTarget = false; - events.Reset(); - events.ScheduleEvent(EVENT_RC_RUNIC_SMASH, 0); - Creature* c; + void Reset() + { + _nextTriggerPos = 0.0f; + _leftHand = false; + _checkTarget = false; + events.Reset(); + events.ScheduleEvent(EVENT_RC_RUNIC_SMASH, 0); + Creature* c; - if (c = me->SummonCreature(33140, 2221, -385, me->GetPositionZ())) - _triggerRightGUID[0] = c->GetGUID(); - if (c = me->SummonCreature(33140, 2210, -385, me->GetPositionZ())) - _triggerRightGUID[1] = c->GetGUID(); + if (c = me->SummonCreature(33140, 2221, -385, me->GetPositionZ())) + _triggerRightGUID[0] = c->GetGUID(); + if (c = me->SummonCreature(33140, 2210, -385, me->GetPositionZ())) + _triggerRightGUID[1] = c->GetGUID(); - if (c = me->SummonCreature(33141, 2235, -385, me->GetPositionZ())) - _triggerLeftGUID[0] = c->GetGUID(); - if (c = me->SummonCreature(33141, 2246, -385, me->GetPositionZ())) - _triggerLeftGUID[1] = c->GetGUID(); - } + if (c = me->SummonCreature(33141, 2235, -385, me->GetPositionZ())) + _triggerLeftGUID[0] = c->GetGUID(); + if (c = me->SummonCreature(33141, 2246, -385, me->GetPositionZ())) + _triggerLeftGUID[1] = c->GetGUID(); + } - void JustDied(Unit*) - { - if (me->GetInstanceScript()) - if (GameObject *go = ObjectAccessor::GetGameObject(*me, me->GetInstanceScript()->GetData64(DATA_THORIM_FIRST_DOORS))) - go->SetGoState(GO_STATE_ACTIVE); - } + void JustDied(Unit*) + { + if (me->GetInstanceScript()) + if (GameObject *go = ObjectAccessor::GetGameObject(*me, me->GetInstanceScript()->GetData64(DATA_THORIM_FIRST_DOORS))) + go->SetGoState(GO_STATE_ACTIVE); + } - void EnterCombat(Unit*) - { - events.CancelEvent(EVENT_RC_RUNIC_SMASH); - events.ScheduleEvent(EVENT_RC_RUNIC_BARRIER, 10000); - events.ScheduleEvent(EVENT_RC_SMASH, 18000); - events.ScheduleEvent(EVENT_RC_CHARGE, 15000); + void EnterCombat(Unit*) + { + events.CancelEvent(EVENT_RC_RUNIC_SMASH); + events.ScheduleEvent(EVENT_RC_RUNIC_BARRIER, 10000); + events.ScheduleEvent(EVENT_RC_SMASH, 18000); + events.ScheduleEvent(EVENT_RC_CHARGE, 15000); - me->InterruptNonMeleeSpells(false); - _checkTarget = true; - } + me->InterruptNonMeleeSpells(false); + _checkTarget = true; + } - void SpellHit(Unit*, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_RUNIC_SMASH_LEFT || spellInfo->Id == SPELL_RUNIC_SMASH_RIGHT) - { - _leftHand = spellInfo->Id == SPELL_RUNIC_SMASH_LEFT; - events.RescheduleEvent(EVENT_RC_RUNIC_SMASH_TRIGGER, 1000); - } - } + void SpellHit(Unit*, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_RUNIC_SMASH_LEFT || spellInfo->Id == SPELL_RUNIC_SMASH_RIGHT) + { + _leftHand = spellInfo->Id == SPELL_RUNIC_SMASH_LEFT; + events.RescheduleEvent(EVENT_RC_RUNIC_SMASH_TRIGGER, 1000); + } + } - void RunRunicSmash(bool cast) - { - if (Creature* cr = ObjectAccessor::GetCreature(*me, _leftHand ? _triggerLeftGUID[0] : _triggerRightGUID[0]) ) - { - if (cast) - cr->CastSpell(cr, SPELL_RUNIC_SMASH_DAMAGE, true); - cr->SetPosition(_leftHand ? 2235.0f : 2221.0f, _nextTriggerPos, cr->GetPositionZ(), 0.0f); - cr->StopMovingOnCurrentPos(); - } - if( Creature* cr = ObjectAccessor::GetCreature(*me, _leftHand ? _triggerLeftGUID[1] : _triggerRightGUID[1]) ) - { - if (cast) - cr->CastSpell(cr, SPELL_RUNIC_SMASH_DAMAGE, true); - cr->SetPosition(_leftHand ? 2246.0f : 2210.0f, _nextTriggerPos, cr->GetPositionZ(), 0.0f); - cr->StopMovingOnCurrentPos(); - } - } + void RunRunicSmash(bool cast) + { + if (Creature* cr = ObjectAccessor::GetCreature(*me, _leftHand ? _triggerLeftGUID[0] : _triggerRightGUID[0]) ) + { + if (cast) + cr->CastSpell(cr, SPELL_RUNIC_SMASH_DAMAGE, true); + cr->SetPosition(_leftHand ? 2235.0f : 2221.0f, _nextTriggerPos, cr->GetPositionZ(), 0.0f); + cr->StopMovingOnCurrentPos(); + } + if( Creature* cr = ObjectAccessor::GetCreature(*me, _leftHand ? _triggerLeftGUID[1] : _triggerRightGUID[1]) ) + { + if (cast) + cr->CastSpell(cr, SPELL_RUNIC_SMASH_DAMAGE, true); + cr->SetPosition(_leftHand ? 2246.0f : 2210.0f, _nextTriggerPos, cr->GetPositionZ(), 0.0f); + cr->StopMovingOnCurrentPos(); + } + } - void UpdateAI(uint32 diff) - { - if (_checkTarget && !UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (_checkTarget && !UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_RC_RUNIC_SMASH_TRIGGER: - _nextTriggerPos += 16.0f; - if (_nextTriggerPos > -260.0f) - events.PopEvent(); - else - events.RescheduleEvent(EVENT_RC_RUNIC_SMASH_TRIGGER, 500); + switch (events.GetEvent()) + { + case EVENT_RC_RUNIC_SMASH_TRIGGER: + _nextTriggerPos += 16.0f; + if (_nextTriggerPos > -260.0f) + events.PopEvent(); + else + events.RescheduleEvent(EVENT_RC_RUNIC_SMASH_TRIGGER, 500); - RunRunicSmash(true); - break; - case EVENT_RC_RUNIC_SMASH: - if (urand(0,1)) - me->CastSpell(me, SPELL_RUNIC_SMASH_LEFT, false); - else - me->CastSpell(me, SPELL_RUNIC_SMASH_RIGHT, false); + RunRunicSmash(true); + break; + case EVENT_RC_RUNIC_SMASH: + if (urand(0,1)) + me->CastSpell(me, SPELL_RUNIC_SMASH_LEFT, false); + else + me->CastSpell(me, SPELL_RUNIC_SMASH_RIGHT, false); - _nextTriggerPos = -385.0f; - RunRunicSmash(false); - events.RepeatEvent(11000); - break; - case EVENT_RC_RUNIC_BARRIER: - me->CastSpell(me, SPELL_RUNIC_BARRIER, false); - me->MonsterTextEmote("Runic Colossus surrounds itself with a crackling Runic Barrier!", 0, true); - events.RepeatEvent(20000); - break; - case EVENT_RC_SMASH: - me->CastSpell(me->GetVictim(), SPELL_SMASH, false); - events.RepeatEvent(10000); - break; - case EVENT_RC_CHARGE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_CHARGE, false); - events.RepeatEvent(15000); - break; - } + _nextTriggerPos = -385.0f; + RunRunicSmash(false); + events.RepeatEvent(11000); + break; + case EVENT_RC_RUNIC_BARRIER: + me->CastSpell(me, SPELL_RUNIC_BARRIER, false); + me->MonsterTextEmote("Runic Colossus surrounds itself with a crackling Runic Barrier!", 0, true); + events.RepeatEvent(20000); + break; + case EVENT_RC_SMASH: + me->CastSpell(me->GetVictim(), SPELL_SMASH, false); + events.RepeatEvent(10000); + break; + case EVENT_RC_CHARGE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_CHARGE, false); + events.RepeatEvent(15000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_thorim_ancient_rune_giant : public CreatureScript @@ -1522,79 +1522,79 @@ public: return new boss_thorim_ancient_rune_giantAI (pCreature); } - struct boss_thorim_ancient_rune_giantAI : public ScriptedAI - { - boss_thorim_ancient_rune_giantAI(Creature* pCreature) : ScriptedAI(pCreature) { } + struct boss_thorim_ancient_rune_giantAI : public ScriptedAI + { + boss_thorim_ancient_rune_giantAI(Creature* pCreature) : ScriptedAI(pCreature) { } - EventMap events; - bool _isInCombat; + EventMap events; + bool _isInCombat; - void Reset() - { - _isInCombat = false; - events.Reset(); - } + void Reset() + { + _isInCombat = false; + events.Reset(); + } - void EnterCombat(Unit*) - { - _isInCombat = true; - events.CancelEvent(EVENT_ARG_SPAWN); - events.ScheduleEvent(EVENT_ARG_RD, 12000); - events.ScheduleEvent(EVENT_ARG_STOMP, 8000); + void EnterCombat(Unit*) + { + _isInCombat = true; + events.CancelEvent(EVENT_ARG_SPAWN); + events.ScheduleEvent(EVENT_ARG_RD, 12000); + events.ScheduleEvent(EVENT_ARG_STOMP, 8000); - me->CastSpell(me, SPELL_RUNIC_FORTIFICATION, false); - me->MonsterTextEmote("Ancient Rune Giant fortifies nearby allies with runic might", 0, true); - } + me->CastSpell(me, SPELL_RUNIC_FORTIFICATION, false); + me->MonsterTextEmote("Ancient Rune Giant fortifies nearby allies with runic might", 0, true); + } - void JustDied(Unit*) - { - if (InstanceScript* pInstance = me->GetInstanceScript()) - { - if (GameObject* go = ObjectAccessor::GetGameObject(*me, pInstance->GetData64(DATA_THORIM_SECOND_DOORS))) - go->SetGoState(GO_STATE_ACTIVE); + void JustDied(Unit*) + { + if (InstanceScript* pInstance = me->GetInstanceScript()) + { + if (GameObject* go = ObjectAccessor::GetGameObject(*me, pInstance->GetData64(DATA_THORIM_SECOND_DOORS))) + go->SetGoState(GO_STATE_ACTIVE); - if (Creature* thorim = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_THORIM))) - thorim->AI()->DoAction(ACTION_ALLOW_HIT); - } - } + if (Creature* thorim = ObjectAccessor::GetCreature(*me, pInstance->GetData64(TYPE_THORIM))) + thorim->AI()->DoAction(ACTION_ALLOW_HIT); + } + } - void DoAction(int32 param) - { - if (param == ACTION_IRON_HONOR_DIED) - events.RescheduleEvent(EVENT_ARG_SPAWN, 20000); - } + void DoAction(int32 param) + { + if (param == ACTION_IRON_HONOR_DIED) + events.RescheduleEvent(EVENT_ARG_SPAWN, 20000); + } - void UpdateAI(uint32 diff) - { - if (_isInCombat && !UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (_isInCombat && !UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_ARG_RD: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_RUNE_DETONATION, false); - events.RepeatEvent(12000); - break; - case EVENT_ARG_STOMP: - me->CastSpell(me->GetVictim(), SPELL_STOMP, false); - events.RepeatEvent(8000); - break; - case EVENT_ARG_SPAWN: - if (Creature *cr = me->SummonCreature(NPC_IRON_HONOR_GUARD, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000)) - if (Unit* target = SelectTargetFromPlayerList(150.0f)) - cr->AI()->AttackStart(target); - events.RepeatEvent(10000); - break; - } + switch (events.GetEvent()) + { + case EVENT_ARG_RD: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_RUNE_DETONATION, false); + events.RepeatEvent(12000); + break; + case EVENT_ARG_STOMP: + me->CastSpell(me->GetVictim(), SPELL_STOMP, false); + events.RepeatEvent(8000); + break; + case EVENT_ARG_SPAWN: + if (Creature *cr = me->SummonCreature(NPC_IRON_HONOR_GUARD, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000)) + if (Unit* target = SelectTargetFromPlayerList(150.0f)) + cr->AI()->AttackStart(target); + events.RepeatEvent(10000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_thorim_arena_npcs : public CreatureScript @@ -1607,140 +1607,140 @@ public: return new boss_thorim_arena_npcsAI (pCreature); } - struct boss_thorim_arena_npcsAI : public ScriptedAI - { - boss_thorim_arena_npcsAI(Creature* pCreature) : ScriptedAI(pCreature) { } + struct boss_thorim_arena_npcsAI : public ScriptedAI + { + boss_thorim_arena_npcsAI(Creature* pCreature) : ScriptedAI(pCreature) { } - EventMap events; - bool _isCaster; + EventMap events; + bool _isCaster; - void Reset() - { - _isCaster = (me->GetEntry() == NPC_DARK_RUNE_EVOKER); - events.Reset(); - if (me->GetEntry() == NPC_DARK_RUNE_WARBRINGER) - me->CastSpell(me, SPELL_AURA_OF_CELERITY, true); - } + void Reset() + { + _isCaster = (me->GetEntry() == NPC_DARK_RUNE_EVOKER); + events.Reset(); + if (me->GetEntry() == NPC_DARK_RUNE_WARBRINGER) + me->CastSpell(me, SPELL_AURA_OF_CELERITY, true); + } - void EnterCombat(Unit*) - { - if (me->GetEntry() == NPC_DARK_RUNE_WARBRINGER) - { - events.ScheduleEvent(EVENT_DR_WARBRINGER_RS, 8000); - } - else if (me->GetEntry() == NPC_DARK_RUNE_EVOKER) - { - events.ScheduleEvent(EVENT_DR_EVOKER_RL, 2500); - events.ScheduleEvent(EVENT_DR_EVOKER_RM, 4000); - events.ScheduleEvent(EVENT_DR_EVOKER_RS, 10000); - } - else if (me->GetEntry() == NPC_DARK_RUNE_CHAMPION) - { - events.ScheduleEvent(EVENT_DR_CHAMPION_WH, 6000); - events.ScheduleEvent(EVENT_DR_CHAMPION_CH, 12000); - events.ScheduleEvent(EVENT_DR_CHAMPION_MS, 8000); - } - else if (me->GetEntry() == NPC_DARK_RUNE_COMMONER) - { - events.ScheduleEvent(EVENT_DR_COMMONER_LB, 5000); - events.ScheduleEvent(EVENT_DR_COMMONER_PM, 6000); - } - } + void EnterCombat(Unit*) + { + if (me->GetEntry() == NPC_DARK_RUNE_WARBRINGER) + { + events.ScheduleEvent(EVENT_DR_WARBRINGER_RS, 8000); + } + else if (me->GetEntry() == NPC_DARK_RUNE_EVOKER) + { + events.ScheduleEvent(EVENT_DR_EVOKER_RL, 2500); + events.ScheduleEvent(EVENT_DR_EVOKER_RM, 4000); + events.ScheduleEvent(EVENT_DR_EVOKER_RS, 10000); + } + else if (me->GetEntry() == NPC_DARK_RUNE_CHAMPION) + { + events.ScheduleEvent(EVENT_DR_CHAMPION_WH, 6000); + events.ScheduleEvent(EVENT_DR_CHAMPION_CH, 12000); + events.ScheduleEvent(EVENT_DR_CHAMPION_MS, 8000); + } + else if (me->GetEntry() == NPC_DARK_RUNE_COMMONER) + { + events.ScheduleEvent(EVENT_DR_COMMONER_LB, 5000); + events.ScheduleEvent(EVENT_DR_COMMONER_PM, 6000); + } + } - bool CanAIAttack(const Unit* target) const - { - return target->GetPositionX() < 2180 && target->GetPositionZ() < 425; - } + bool CanAIAttack(const Unit* target) const + { + return target->GetPositionX() < 2180 && target->GetPositionZ() < 425; + } - bool SelectT() - { - Player* target = NULL; - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - uint8 num = urand(0, pList.getSize()-1); - uint8 count = 0; - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr, ++count) - { - if (itr->GetSource()->GetPositionX() > 2180 || !itr->GetSource()->IsAlive() || itr->GetSource()->GetPositionZ() > 425) - continue; + bool SelectT() + { + Player* target = NULL; + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + uint8 num = urand(0, pList.getSize()-1); + uint8 count = 0; + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr, ++count) + { + if (itr->GetSource()->GetPositionX() > 2180 || !itr->GetSource()->IsAlive() || itr->GetSource()->GetPositionZ() > 425) + continue; - if (count <= num || !target) - target = itr->GetSource(); - else - break; - } + if (count <= num || !target) + target = itr->GetSource(); + else + break; + } - if (target) - { - AttackStart(target); - me->AddThreat(target, 500.0f); - if (me->GetEntry() == NPC_DARK_RUNE_EVOKER && urand(0,1)) - me->CastSpell(me, SPELL_RUNIC_SHIELD, false); - else if (me->GetEntry() == NPC_DARK_RUNE_CHAMPION && !urand(0,2)) - me->CastSpell(target, SPELL_CHARGE, false); - return true; - } - return false; - } + if (target) + { + AttackStart(target); + me->AddThreat(target, 500.0f); + if (me->GetEntry() == NPC_DARK_RUNE_EVOKER && urand(0,1)) + me->CastSpell(me, SPELL_RUNIC_SHIELD, false); + else if (me->GetEntry() == NPC_DARK_RUNE_CHAMPION && !urand(0,2)) + me->CastSpell(target, SPELL_CHARGE, false); + return true; + } + return false; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() && !SelectT()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() && !SelectT()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_DR_WARBRINGER_RS: - me->CastSpell(me->GetVictim(), SPELL_RUNIC_STRIKE, false); - events.RepeatEvent(8000); - break; - case EVENT_DR_EVOKER_RL: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_RUNIC_LIGHTNING, false); - events.RepeatEvent(2500); - break; - case EVENT_DR_EVOKER_RM: - if (Unit* target = DoSelectLowestHpFriendly(40.0f, 15)) - me->CastSpell(target, SPELL_RUNIC_MENDING, false); - else - me->CastSpell(me, SPELL_RUNIC_MENDING, false); - events.RepeatEvent(4000); - break; - case EVENT_DR_EVOKER_RS: - me->CastSpell(me, SPELL_RUNIC_SHIELD, false); - events.RepeatEvent(10000); - break; - case EVENT_DR_CHAMPION_CH: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_CHARGE, false); - events.RepeatEvent(12000); - break; - case EVENT_DR_CHAMPION_WH: - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED)) - me->CastSpell(me, SPELL_WHIRLWIND, false); - events.RepeatEvent(6000); - break; - case EVENT_DR_CHAMPION_MS: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); - events.RepeatEvent(8000); - break; - case EVENT_DR_COMMONER_LB: - me->CastSpell(me->GetVictim(), SPELL_LOW_BLOW, false); - events.RepeatEvent(5000); - break; - case EVENT_DR_COMMONER_PM: - me->CastSpell(me->GetVictim(), SPELL_PUMMEL, false); - events.RepeatEvent(6000); - break; - } + switch (events.GetEvent()) + { + case EVENT_DR_WARBRINGER_RS: + me->CastSpell(me->GetVictim(), SPELL_RUNIC_STRIKE, false); + events.RepeatEvent(8000); + break; + case EVENT_DR_EVOKER_RL: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_RUNIC_LIGHTNING, false); + events.RepeatEvent(2500); + break; + case EVENT_DR_EVOKER_RM: + if (Unit* target = DoSelectLowestHpFriendly(40.0f, 15)) + me->CastSpell(target, SPELL_RUNIC_MENDING, false); + else + me->CastSpell(me, SPELL_RUNIC_MENDING, false); + events.RepeatEvent(4000); + break; + case EVENT_DR_EVOKER_RS: + me->CastSpell(me, SPELL_RUNIC_SHIELD, false); + events.RepeatEvent(10000); + break; + case EVENT_DR_CHAMPION_CH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_CHARGE, false); + events.RepeatEvent(12000); + break; + case EVENT_DR_CHAMPION_WH: + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED)) + me->CastSpell(me, SPELL_WHIRLWIND, false); + events.RepeatEvent(6000); + break; + case EVENT_DR_CHAMPION_MS: + me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); + events.RepeatEvent(8000); + break; + case EVENT_DR_COMMONER_LB: + me->CastSpell(me->GetVictim(), SPELL_LOW_BLOW, false); + events.RepeatEvent(5000); + break; + case EVENT_DR_COMMONER_PM: + me->CastSpell(me->GetVictim(), SPELL_PUMMEL, false); + events.RepeatEvent(6000); + break; + } - if (!_isCaster || (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10)) - DoMeleeAttackIfReady(); - } - }; + if (!_isCaster || (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10)) + DoMeleeAttackIfReady(); + } + }; }; class go_thorim_lever : public GameObjectScript @@ -1748,14 +1748,14 @@ class go_thorim_lever : public GameObjectScript public: go_thorim_lever() : GameObjectScript("go_thorim_lever") { } - bool OnGossipHello(Player* pPlayer, GameObject* pGo) - { - if (GameObject *g = pPlayer->FindNearestGameObject(GO_ARENA_LEVER_GATE, 50)) - g->UseDoorOrButton(); + bool OnGossipHello(Player* pPlayer, GameObject* pGo) + { + if (GameObject *g = pPlayer->FindNearestGameObject(GO_ARENA_LEVER_GATE, 50)) + g->UseDoorOrButton(); - pGo->UseDoorOrButton(); - return true; - } + pGo->UseDoorOrButton(); + return true; + } }; class spell_thorim_lightning_pillar_P2 : public SpellScriptLoader @@ -1769,9 +1769,9 @@ class spell_thorim_lightning_pillar_P2 : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); - if (Unit* caster = GetCaster()) - GetUnitOwner()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + GetUnitOwner()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); } void Register() @@ -1797,9 +1797,9 @@ class spell_thorim_trash_impale : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - // deals damage until target is healed above 90% - if (GetUnitOwner()->HealthAbovePct(90)) - SetDuration(0); + // deals damage until target is healed above 90% + if (GetUnitOwner()->HealthAbovePct(90)) + SetDuration(0); } void Register() @@ -1821,11 +1821,11 @@ class achievement_thorim_stand_in_the_lightning : public AchievementCriteriaScri bool OnCheck(Player* player, Unit*) { - if (InstanceScript* instance = player->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*player, instance->GetData64(TYPE_THORIM))) - return cr->AI()->GetData(DATA_HIT_BY_LIGHTNING); - - return false; + if (InstanceScript* instance = player->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*player, instance->GetData64(TYPE_THORIM))) + return cr->AI()->GetData(DATA_HIT_BY_LIGHTNING); + + return false; } }; @@ -1836,41 +1836,41 @@ class achievement_thorim_lose_your_illusion : public AchievementCriteriaScript bool OnCheck(Player* player, Unit*) { - if (InstanceScript* instance = player->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*player, instance->GetData64(TYPE_THORIM))) - return cr->AI()->GetData(DATA_LOSE_YOUR_ILLUSION); - - return false; + if (InstanceScript* instance = player->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*player, instance->GetData64(TYPE_THORIM))) + return cr->AI()->GetData(DATA_LOSE_YOUR_ILLUSION); + + return false; } }; void AddSC_boss_thorim() { - // Main encounter - new boss_thorim(); - new boss_thorim_sif(); - new boss_thorim_lightning_orb(); - new boss_thorim_trap(); - new boss_thorim_pillar(); - new boss_thorim_sif_blizzard(); + // Main encounter + new boss_thorim(); + new boss_thorim_sif(); + new boss_thorim_lightning_orb(); + new boss_thorim_trap(); + new boss_thorim_pillar(); + new boss_thorim_sif_blizzard(); - // Trash - new boss_thorim_start_npcs(); - new boss_thorim_gauntlet_npcs(); - new boss_thorim_arena_npcs(); + // Trash + new boss_thorim_start_npcs(); + new boss_thorim_gauntlet_npcs(); + new boss_thorim_arena_npcs(); - // Mini bosses - new boss_thorim_runic_colossus(); - new boss_thorim_ancient_rune_giant(); - - // GOs - new go_thorim_lever(); + // Mini bosses + new boss_thorim_runic_colossus(); + new boss_thorim_ancient_rune_giant(); + + // GOs + new go_thorim_lever(); - // Spells - new spell_thorim_lightning_pillar_P2(); - new spell_thorim_trash_impale(); + // Spells + new spell_thorim_lightning_pillar_P2(); + new spell_thorim_trash_impale(); - // Achievements - new achievement_thorim_stand_in_the_lightning(); - new achievement_thorim_lose_your_illusion(); + // Achievements + new achievement_thorim_stand_in_the_lightning(); + new achievement_thorim_lose_your_illusion(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 791579c33..3b09163f2 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -14,96 +14,96 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum XT002Spells { - // BASIC - SPELL_GRAVITY_BOMB_10 = 63024, - SPELL_GRAVITY_BOMB_25 = 64234, - SPELL_SEARING_LIGHT_10 = 63018, - SPELL_SEARING_LIGHT_25 = 65121, - SPELL_TYMPANIC_TANTARUM = 62776, - SPELL_XT002_ENRAGE = 26662, + // BASIC + SPELL_GRAVITY_BOMB_10 = 63024, + SPELL_GRAVITY_BOMB_25 = 64234, + SPELL_SEARING_LIGHT_10 = 63018, + SPELL_SEARING_LIGHT_25 = 65121, + SPELL_TYMPANIC_TANTARUM = 62776, + SPELL_XT002_ENRAGE = 26662, - // HELPERS - SPELL_ARCING_SMASH = 8374, - SPELL_TRAMPLE = 5568, - SPELL_UPPERCUT = 10966, - SPELL_BOOM = 62834, + // HELPERS + SPELL_ARCING_SMASH = 8374, + SPELL_TRAMPLE = 5568, + SPELL_UPPERCUT = 10966, + SPELL_BOOM = 62834, - // HEARTBREAK - SPELL_HEART_OVERLOAD = 62789, - SPELL_EXPOSED_HEART = 63849, - SPELL_ENERGY_ORB = 62790, - SPELL_ENERGY_ORB_TRIGGER = 62826, - SPELL_HEARTBREAK_10 = 65737, - SPELL_HEARTBREAK_25 = 64193, + // HEARTBREAK + SPELL_HEART_OVERLOAD = 62789, + SPELL_EXPOSED_HEART = 63849, + SPELL_ENERGY_ORB = 62790, + SPELL_ENERGY_ORB_TRIGGER = 62826, + SPELL_HEARTBREAK_10 = 65737, + SPELL_HEARTBREAK_25 = 64193, - // VOID ZONE - SPELL_VOID_ZONE_SUMMON_10 = 64203, - SPELL_VOID_ZONE_SUMMON_25 = 64235, - //SPELL_VOID_ZONE_SUMMON = RAID_MODE(SPELL_VOID_ZONE_SUMMON_10, SPELL_VOID_ZONE_SUMMON_25, SPELL_VOID_ZONE_SUMMON_10, SPELL_VOID_ZONE_SUMMON_25), - SPELL_VOID_ZONE_DAMAGE = 46262, - - // SPARK - SPELL_SPARK_SUMMON = 64210, - SPELL_SPARK_DAMAGE_10 = 64227, - SPELL_SPARK_DAMAGE_25 = 64236, - SPELL_SPARK_MELEE = 64230, + // VOID ZONE + SPELL_VOID_ZONE_SUMMON_10 = 64203, + SPELL_VOID_ZONE_SUMMON_25 = 64235, + //SPELL_VOID_ZONE_SUMMON = RAID_MODE(SPELL_VOID_ZONE_SUMMON_10, SPELL_VOID_ZONE_SUMMON_25, SPELL_VOID_ZONE_SUMMON_10, SPELL_VOID_ZONE_SUMMON_25), + SPELL_VOID_ZONE_DAMAGE = 46262, + + // SPARK + SPELL_SPARK_SUMMON = 64210, + SPELL_SPARK_DAMAGE_10 = 64227, + SPELL_SPARK_DAMAGE_25 = 64236, + SPELL_SPARK_MELEE = 64230, }; -#define SPELL_GRAVITY_BOMB RAID_MODE(SPELL_GRAVITY_BOMB_10, SPELL_GRAVITY_BOMB_25) -#define SPELL_SEARING_LIGHT RAID_MODE(SPELL_SEARING_LIGHT_10, SPELL_SEARING_LIGHT_25) -#define SPELL_HEARTBREAK RAID_MODE(SPELL_HEARTBREAK_10, SPELL_HEARTBREAK_25) -#define SPELL_SPARK_DAMAGE RAID_MODE(SPELL_SPARK_DAMAGE_10, SPELL_SPARK_DAMAGE_25) +#define SPELL_GRAVITY_BOMB RAID_MODE(SPELL_GRAVITY_BOMB_10, SPELL_GRAVITY_BOMB_25) +#define SPELL_SEARING_LIGHT RAID_MODE(SPELL_SEARING_LIGHT_10, SPELL_SEARING_LIGHT_25) +#define SPELL_HEARTBREAK RAID_MODE(SPELL_HEARTBREAK_10, SPELL_HEARTBREAK_25) +#define SPELL_SPARK_DAMAGE RAID_MODE(SPELL_SPARK_DAMAGE_10, SPELL_SPARK_DAMAGE_25) enum XT002Events { - EVENT_HEALTH_CHECK = 1, - EVENT_GRAVITY_BOMB = 2, - EVENT_SEARING_LIGHT = 3, - EVENT_ENRAGE = 4, - EVENT_TYMPANIC_TANTARUM = 5, - EVENT_RESTORE = 6, - EVENT_START_SECOND_PHASE = 7, - EVENT_REMOVE_EMOTE = 8, - EVENT_CHECK_ROOM = 9, + EVENT_HEALTH_CHECK = 1, + EVENT_GRAVITY_BOMB = 2, + EVENT_SEARING_LIGHT = 3, + EVENT_ENRAGE = 4, + EVENT_TYMPANIC_TANTARUM = 5, + EVENT_RESTORE = 6, + EVENT_START_SECOND_PHASE = 7, + EVENT_REMOVE_EMOTE = 8, + EVENT_CHECK_ROOM = 9, }; enum NPCs { - NPC_VOID_ZONE = 34001, - NPC_LIFE_SPARK = 34004, - NPC_XT002_HEART = 33329, - NPC_XS013_SCRAPBOT = 33343, - NPC_XM024_PUMMELLER = 33344, - NPC_XE321_BOOMBOT = 33346, - NPC_PILE_TRIGGER = 33337, + NPC_VOID_ZONE = 34001, + NPC_LIFE_SPARK = 34004, + NPC_XT002_HEART = 33329, + NPC_XS013_SCRAPBOT = 33343, + NPC_XM024_PUMMELLER = 33344, + NPC_XE321_BOOMBOT = 33346, + NPC_PILE_TRIGGER = 33337, }; enum Sounds { - XT_SOUND_AGGRO = 15724, - XT_SOUND_HEART_OPEN = 15725, - XT_SOUND_HEART_CLOSED = 15726, - XT_SOUND_TANTARUM = 15727, - XT_SOUND_SLAY1 = 15728, - XT_SOUND_SLAY2 = 15729, - XT_SOUND_ENRAGE = 15730, - XT_SOUND_DEATH = 15731, - XT_SOUND_SUMMON = 15732, + XT_SOUND_AGGRO = 15724, + XT_SOUND_HEART_OPEN = 15725, + XT_SOUND_HEART_CLOSED = 15726, + XT_SOUND_TANTARUM = 15727, + XT_SOUND_SLAY1 = 15728, + XT_SOUND_SLAY2 = 15729, + XT_SOUND_ENRAGE = 15730, + XT_SOUND_DEATH = 15731, + XT_SOUND_SUMMON = 15732, }; enum Misc { - HEART_VEHICLE_SEAT = 0, + HEART_VEHICLE_SEAT = 0, - ACTION_AWAKEN_HEART = -5, - ACTION_HIDE_HEART = -4, - ACTION_HEART_BROKEN = -3, + ACTION_AWAKEN_HEART = -5, + ACTION_HIDE_HEART = -4, + ACTION_HEART_BROKEN = -3, - ACHIEVEMENT_MUST_DECONSTRUCT_FASTER = 21027, + ACHIEVEMENT_MUST_DECONSTRUCT_FASTER = 21027, - DATA_XT002_NERF_ENGINEERING = 50, - DATA_XT002_GRAVITY_ACHIEV = 51, + DATA_XT002_NERF_ENGINEERING = 50, + DATA_XT002_GRAVITY_ACHIEV = 51, }; @@ -117,292 +117,292 @@ public: return new boss_xt002AI (pCreature); } - struct boss_xt002AI : public ScriptedAI - { - boss_xt002AI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) - { - m_pInstance = pCreature->GetInstanceScript(); - } + struct boss_xt002AI : public ScriptedAI + { + boss_xt002AI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) + { + m_pInstance = pCreature->GetInstanceScript(); + } - InstanceScript* m_pInstance; - uint8 _healthCheck; - bool _hardMode; - bool _nerfAchievement; - bool _gravityAchievement; - EventMap events; - SummonList summons; + InstanceScript* m_pInstance; + uint8 _healthCheck; + bool _hardMode; + bool _nerfAchievement; + bool _gravityAchievement; + EventMap events; + SummonList summons; - void RescheduleEvents() - { - events.RescheduleEvent(EVENT_GRAVITY_BOMB, 1000, 1); - events.RescheduleEvent(EVENT_TYMPANIC_TANTARUM, 60000, 1); - if (!_hardMode) - events.RescheduleEvent(EVENT_HEALTH_CHECK, 2000, 1); - } + void RescheduleEvents() + { + events.RescheduleEvent(EVENT_GRAVITY_BOMB, 1000, 1); + events.RescheduleEvent(EVENT_TYMPANIC_TANTARUM, 60000, 1); + if (!_hardMode) + events.RescheduleEvent(EVENT_HEALTH_CHECK, 2000, 1); + } - void Reset() - { - summons.DespawnAll(); - events.Reset(); + void Reset() + { + summons.DespawnAll(); + events.Reset(); - me->ResetLootMode(); - me->RemoveAllAuras(); + me->ResetLootMode(); + me->RemoveAllAuras(); - // first heart expose - _healthCheck = 75; - _hardMode = false; - _nerfAchievement = true; - _gravityAchievement = true; + // first heart expose + _healthCheck = 75; + _hardMode = false; + _nerfAchievement = true; + _gravityAchievement = true; - me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND); // emerge - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(false, UNIT_STATE_STUNNED); + me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND); // emerge + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetControlled(false, UNIT_STATE_STUNNED); - if (m_pInstance) - { - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_MUST_DECONSTRUCT_FASTER); - m_pInstance->SetData(TYPE_XT002, NOT_STARTED); - if (GameObject *pGo = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_XT002_DOORS))) - pGo->SetGoState(GO_STATE_ACTIVE); - } - } + if (m_pInstance) + { + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_MUST_DECONSTRUCT_FASTER); + m_pInstance->SetData(TYPE_XT002, NOT_STARTED); + if (GameObject *pGo = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_XT002_DOORS))) + pGo->SetGoState(GO_STATE_ACTIVE); + } + } - void JustSummoned(Creature* cr) { summons.Summon(cr); } - void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } + void SummonedCreatureDespawn(Creature* cr) { summons.Despawn(cr); } - void AttachHeart() - { - if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL) - heart->SetHealth(heart->GetMaxHealth()); - else if (Creature* accessory = me->SummonCreature(NPC_XT002_HEART, *me, TEMPSUMMON_MANUAL_DESPAWN)) - { - accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); - if (!me->HandleSpellClick(accessory, 0)) - accessory->DespawnOrUnsummon(); - } - } + void AttachHeart() + { + if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL) + heart->SetHealth(heart->GetMaxHealth()); + else if (Creature* accessory = me->SummonCreature(NPC_XT002_HEART, *me, TEMPSUMMON_MANUAL_DESPAWN)) + { + accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); + if (!me->HandleSpellClick(accessory, 0)) + accessory->DespawnOrUnsummon(); + } + } - void JustReachedHome() { me->setActive(false); } + void JustReachedHome() { me->setActive(false); } - void EnterCombat(Unit*) - { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - events.ScheduleEvent(EVENT_ENRAGE, 600000, 0, 0); - events.ScheduleEvent(EVENT_CHECK_ROOM, 5000, 0, 0); - RescheduleEvents(); // Other events are scheduled here + void EnterCombat(Unit*) + { + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + events.ScheduleEvent(EVENT_ENRAGE, 600000, 0, 0); + events.ScheduleEvent(EVENT_CHECK_ROOM, 5000, 0, 0); + RescheduleEvents(); // Other events are scheduled here - me->setActive(true); - me->MonsterYell("New toys? For me? I promise I won't break them this time!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(XT_SOUND_AGGRO); + me->setActive(true); + me->MonsterYell("New toys? For me? I promise I won't break them this time!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(XT_SOUND_AGGRO); - if (m_pInstance) - { - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_MUST_DECONSTRUCT_FASTER); - m_pInstance->SetData(TYPE_XT002, IN_PROGRESS); - if (GameObject *pGo = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_XT002_DOORS))) - pGo->SetGoState(GO_STATE_READY); - } + if (m_pInstance) + { + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_MUST_DECONSTRUCT_FASTER); + m_pInstance->SetData(TYPE_XT002, IN_PROGRESS); + if (GameObject *pGo = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_XT002_DOORS))) + pGo->SetGoState(GO_STATE_READY); + } - me->CallForHelp(175); - me->SetInCombatWithZone(); - AttachHeart(); - } + me->CallForHelp(175); + me->SetInCombatWithZone(); + AttachHeart(); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER && !urand(0,2)) - { - if (urand(0,1)) - { - me->MonsterYell("I... I think I broke it.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(XT_SOUND_SLAY1); - } - else - { - me->MonsterYell("I guess it doesn't bend that way.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(XT_SOUND_SLAY2); - } - } - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER && !urand(0,2)) + { + if (urand(0,1)) + { + me->MonsterYell("I... I think I broke it.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(XT_SOUND_SLAY1); + } + else + { + me->MonsterYell("I guess it doesn't bend that way.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(XT_SOUND_SLAY2); + } + } + } - void JustDied(Unit *victim) - { - me->MonsterYell("You are bad... Toys... Very... Baaaaad!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(XT_SOUND_DEATH); + void JustDied(Unit *victim) + { + me->MonsterYell("You are bad... Toys... Very... Baaaaad!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(XT_SOUND_DEATH); - if (m_pInstance) - { - m_pInstance->SetData(TYPE_XT002, DONE); - if (GameObject *pGo = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_XT002_DOORS))) - pGo->SetGoState(GO_STATE_ACTIVE); - } + if (m_pInstance) + { + m_pInstance->SetData(TYPE_XT002, DONE); + if (GameObject *pGo = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_XT002_DOORS))) + pGo->SetGoState(GO_STATE_ACTIVE); + } - // Despawn summons - summons.DespawnAll(); - } + // Despawn summons + summons.DespawnAll(); + } - void DoAction(int32 param) - { - if (param == DATA_XT002_NERF_ENGINEERING) - { - _nerfAchievement = false; - return; - } - if (param == DATA_XT002_GRAVITY_ACHIEV) - { - _gravityAchievement = false; - return; - } - - if (!me->IsAlive() || _hardMode) - return; + void DoAction(int32 param) + { + if (param == DATA_XT002_NERF_ENGINEERING) + { + _nerfAchievement = false; + return; + } + if (param == DATA_XT002_GRAVITY_ACHIEV) + { + _gravityAchievement = false; + return; + } + + if (!me->IsAlive() || _hardMode) + return; - // heart destory - if (param == ACTION_HEART_BROKEN) - { - _hardMode = true; - me->SetLootMode(3); // hard mode + normal loot - me->SetMaxHealth(me->GetMaxHealth()); - me->SetHealth(me->GetMaxHealth()); - me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND); // emerge + // heart destory + if (param == ACTION_HEART_BROKEN) + { + _hardMode = true; + me->SetLootMode(3); // hard mode + normal loot + me->SetMaxHealth(me->GetMaxHealth()); + me->SetHealth(me->GetMaxHealth()); + me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND); // emerge - me->CastSpell(me, SPELL_HEARTBREAK, true); - - me->MonsterTextEmote("XT-002 Deconstructor's heart is severed from his body.", 0, true); - events.ScheduleEvent(EVENT_REMOVE_EMOTE, 4000); - return; - } + me->CastSpell(me, SPELL_HEARTBREAK, true); + + me->MonsterTextEmote("XT-002 Deconstructor's heart is severed from his body.", 0, true); + events.ScheduleEvent(EVENT_REMOVE_EMOTE, 4000); + return; + } - // damage from heart - if (param > 0) - { - // avoid reducing health under 1 - int32 _final = std::min(param, int32(me->GetHealth()-1)); + // damage from heart + if (param > 0) + { + // avoid reducing health under 1 + int32 _final = std::min(param, int32(me->GetHealth()-1)); - me->ModifyHealth(-_final); - me->LowerPlayerDamageReq(_final); - } - } + me->ModifyHealth(-_final); + me->LowerPlayerDamageReq(_final); + } + } - uint32 GetData(uint32 param) const - { - if (param == DATA_XT002_NERF_ENGINEERING) - return _nerfAchievement; - else if (param == DATA_XT002_GRAVITY_ACHIEV) - return _gravityAchievement; + uint32 GetData(uint32 param) const + { + if (param == DATA_XT002_NERF_ENGINEERING) + return _nerfAchievement; + else if (param == DATA_XT002_GRAVITY_ACHIEV) + return _gravityAchievement; - return 0; - } + return 0; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - // Control events - case EVENT_HEALTH_CHECK: - if (_hardMode) - { - events.PopEvent(); - return; - } + switch(events.GetEvent()) + { + // Control events + case EVENT_HEALTH_CHECK: + if (_hardMode) + { + events.PopEvent(); + return; + } - if (me->HealthBelowPct(_healthCheck)) - { - _healthCheck -= 25; - me->SetControlled(true, UNIT_STATE_STUNNED); - me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_SUBMERGED); // submerge with animation + if (me->HealthBelowPct(_healthCheck)) + { + _healthCheck -= 25; + me->SetControlled(true, UNIT_STATE_STUNNED); + me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_SUBMERGED); // submerge with animation - me->MonsterYell("So tired. I will rest for just a moment!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(XT_SOUND_HEART_OPEN); + me->MonsterYell("So tired. I will rest for just a moment!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(XT_SOUND_HEART_OPEN); - events.CancelEventGroup(1); - events.ScheduleEvent(EVENT_START_SECOND_PHASE, 5000); - return; - } - events.RepeatEvent(1000); - break; - case EVENT_CHECK_ROOM: - events.RepeatEvent(5000); - if (me->GetPositionX() < 722 || me->GetPositionX() > 987 || me->GetPositionY() < -139 || me->GetPositionY() > 124) - EnterEvadeMode(); + events.CancelEventGroup(1); + events.ScheduleEvent(EVENT_START_SECOND_PHASE, 5000); + return; + } + events.RepeatEvent(1000); + break; + case EVENT_CHECK_ROOM: + events.RepeatEvent(5000); + if (me->GetPositionX() < 722 || me->GetPositionX() > 987 || me->GetPositionY() < -139 || me->GetPositionY() > 124) + EnterEvadeMode(); - return; + return; - // Abilities events - case EVENT_GRAVITY_BOMB: - me->CastCustomSpell(SPELL_GRAVITY_BOMB, SPELLVALUE_MAX_TARGETS, 1, me, true); - events.PopEvent(); - events.ScheduleEvent(EVENT_SEARING_LIGHT, 10000, 1); - break; - case EVENT_SEARING_LIGHT: - me->CastCustomSpell(SPELL_SEARING_LIGHT, SPELLVALUE_MAX_TARGETS, 1, me, true); - events.PopEvent(); - events.ScheduleEvent(EVENT_GRAVITY_BOMB, 10000, 1); - break; - case EVENT_TYMPANIC_TANTARUM: - me->MonsterTextEmote("XT-002 Deconstructor begins to cause the earth to quake.", 0, true); - me->MonsterYell("NO! NO! NO! NO! NO!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(XT_SOUND_TANTARUM); - me->CastSpell(me, SPELL_TYMPANIC_TANTARUM, true); - events.RepeatEvent(60000); - return; - case EVENT_ENRAGE: - me->MonsterYell("I'm tired of these toys. I don't want to play anymore!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(XT_SOUND_SUMMON); - me->CastSpell(me, SPELL_XT002_ENRAGE, true); - events.PopEvent(); - break; + // Abilities events + case EVENT_GRAVITY_BOMB: + me->CastCustomSpell(SPELL_GRAVITY_BOMB, SPELLVALUE_MAX_TARGETS, 1, me, true); + events.PopEvent(); + events.ScheduleEvent(EVENT_SEARING_LIGHT, 10000, 1); + break; + case EVENT_SEARING_LIGHT: + me->CastCustomSpell(SPELL_SEARING_LIGHT, SPELLVALUE_MAX_TARGETS, 1, me, true); + events.PopEvent(); + events.ScheduleEvent(EVENT_GRAVITY_BOMB, 10000, 1); + break; + case EVENT_TYMPANIC_TANTARUM: + me->MonsterTextEmote("XT-002 Deconstructor begins to cause the earth to quake.", 0, true); + me->MonsterYell("NO! NO! NO! NO! NO!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(XT_SOUND_TANTARUM); + me->CastSpell(me, SPELL_TYMPANIC_TANTARUM, true); + events.RepeatEvent(60000); + return; + case EVENT_ENRAGE: + me->MonsterYell("I'm tired of these toys. I don't want to play anymore!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(XT_SOUND_SUMMON); + me->CastSpell(me, SPELL_XT002_ENRAGE, true); + events.PopEvent(); + break; - // Animation events - case EVENT_START_SECOND_PHASE: - me->MonsterTextEmote("XT-002 Deconstructor's heart is exposed and leaking energy.", 0, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL) - heart->GetAI()->DoAction(ACTION_AWAKEN_HEART); - - events.ScheduleEvent(EVENT_RESTORE, 30000); - events.PopEvent(); - return; - // Restore from heartbreak - case EVENT_RESTORE: - if (_hardMode) - { - events.PopEvent(); - return; - } + // Animation events + case EVENT_START_SECOND_PHASE: + me->MonsterTextEmote("XT-002 Deconstructor's heart is exposed and leaking energy.", 0, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL) + heart->GetAI()->DoAction(ACTION_AWAKEN_HEART); + + events.ScheduleEvent(EVENT_RESTORE, 30000); + events.PopEvent(); + return; + // Restore from heartbreak + case EVENT_RESTORE: + if (_hardMode) + { + events.PopEvent(); + return; + } - me->MonsterYell("I'm ready to play!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(XT_SOUND_HEART_CLOSED); - - me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND); // emerge - // Hide heart - if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL) - heart->GetAI()->DoAction(ACTION_HIDE_HEART); + me->MonsterYell("I'm ready to play!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(XT_SOUND_HEART_CLOSED); + + me->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND); // emerge + // Hide heart + if (Unit* heart = me->GetVehicleKit() ? me->GetVehicleKit()->GetPassenger(HEART_VEHICLE_SEAT) : NULL) + heart->GetAI()->DoAction(ACTION_HIDE_HEART); - events.ScheduleEvent(EVENT_REMOVE_EMOTE, 4000); - events.PopEvent(); - return; - case EVENT_REMOVE_EMOTE: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(false, UNIT_STATE_STUNNED); + events.ScheduleEvent(EVENT_REMOVE_EMOTE, 4000); + events.PopEvent(); + return; + case EVENT_REMOVE_EMOTE: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetControlled(false, UNIT_STATE_STUNNED); - RescheduleEvents(); - events.PopEvent(); - return; - } - - // Disabled by stunned state - DoMeleeAttackIfReady(); - } + RescheduleEvents(); + events.PopEvent(); + return; + } + + // Disabled by stunned state + DoMeleeAttackIfReady(); + } - }; + }; }; class npc_xt002_heart : public CreatureScript @@ -415,144 +415,144 @@ public: return new npc_xt002_heartAI (pCreature); } - struct npc_xt002_heartAI : public PassiveAI - { - npc_xt002_heartAI(Creature* pCreature) : PassiveAI(pCreature), summons(me) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - } + struct npc_xt002_heartAI : public PassiveAI + { + npc_xt002_heartAI(Creature* pCreature) : PassiveAI(pCreature), summons(me) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + } - SummonList summons; - uint32 _damageDone; - uint32 _timerSpawn; - - uint8 _spawnSelection; - uint8 _pummelerCount; + SummonList summons; + uint32 _damageDone; + uint32 _timerSpawn; + + uint8 _spawnSelection; + uint8 _pummelerCount; - void MoveInLineOfSight(Unit*) { } - void AttackStart(Unit*) { } - void JustSummoned(Creature* cr) - { - summons.Summon(cr); - if (Unit* owner = me->GetVehicleBase()) - if (owner->GetTypeId() == TYPEID_UNIT) - owner->ToCreature()->AI()->JustSummoned(cr); - } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - _damageDone += damage; - } + void MoveInLineOfSight(Unit*) { } + void AttackStart(Unit*) { } + void JustSummoned(Creature* cr) + { + summons.Summon(cr); + if (Unit* owner = me->GetVehicleBase()) + if (owner->GetTypeId() == TYPEID_UNIT) + owner->ToCreature()->AI()->JustSummoned(cr); + } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + _damageDone += damage; + } - void SummonPiles() - { - me->SummonCreature(NPC_PILE_TRIGGER, 893.290f, 66.820f, 409.81f, 4.2f); - me->SummonCreature(NPC_PILE_TRIGGER, 898.099f, -88.9115f, 409.887f, 2.23402f); - me->SummonCreature(NPC_PILE_TRIGGER, 793.096f, -95.158f, 409.887f, 0.855211f); - me->SummonCreature(NPC_PILE_TRIGGER, 794.600f, 59.660f, 409.82f, 5.34f); - } + void SummonPiles() + { + me->SummonCreature(NPC_PILE_TRIGGER, 893.290f, 66.820f, 409.81f, 4.2f); + me->SummonCreature(NPC_PILE_TRIGGER, 898.099f, -88.9115f, 409.887f, 2.23402f); + me->SummonCreature(NPC_PILE_TRIGGER, 793.096f, -95.158f, 409.887f, 0.855211f); + me->SummonCreature(NPC_PILE_TRIGGER, 794.600f, 59.660f, 409.82f, 5.34f); + } - void DoAction(int32 param) - { - if (param == ACTION_AWAKEN_HEART) - { - _pummelerCount = 0; - _spawnSelection = 0; - _damageDone = 0; - _timerSpawn = 0; - me->SetHealth(me->GetMaxHealth()); - me->CastSpell(me, SPELL_HEART_OVERLOAD, true); - me->CastSpell(me, SPELL_EXPOSED_HEART, false); // Channeled - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + void DoAction(int32 param) + { + if (param == ACTION_AWAKEN_HEART) + { + _pummelerCount = 0; + _spawnSelection = 0; + _damageDone = 0; + _timerSpawn = 0; + me->SetHealth(me->GetMaxHealth()); + me->CastSpell(me, SPELL_HEART_OVERLOAD, true); + me->CastSpell(me, SPELL_EXPOSED_HEART, false); // Channeled + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - if (!summons.HasEntry(NPC_PILE_TRIGGER)) - SummonPiles(); - } - else if (param == ACTION_HIDE_HEART) - { - if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) - if (pXT002->AI()) - { - pXT002->AI()->DoAction(_damageDone); - _damageDone = 0; - } - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - } - } + if (!summons.HasEntry(NPC_PILE_TRIGGER)) + SummonPiles(); + } + else if (param == ACTION_HIDE_HEART) + { + if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) + if (pXT002->AI()) + { + pXT002->AI()->DoAction(_damageDone); + _damageDone = 0; + } + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + } + } - void SendEnergyToCorner() - { - Unit* pile = NULL; - uint8 num = urand(1,4); - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetEntry() == NPC_PILE_TRIGGER) - { - pile = summon; - if ((--num) == 0) - break; - } + void SendEnergyToCorner() + { + Unit* pile = NULL; + uint8 num = urand(1,4); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetEntry() == NPC_PILE_TRIGGER) + { + pile = summon; + if ((--num) == 0) + break; + } - if (pile) - me->CastSpell(pile, SPELL_ENERGY_ORB, true); - } + if (pile) + me->CastSpell(pile, SPELL_ENERGY_ORB, true); + } - void SpellHitTarget(Unit *target, const SpellInfo *spellInfo) - { - // spawn not-so-random robots - if (spellInfo->Id == SPELL_ENERGY_ORB_TRIGGER && target->GetEntry() == NPC_PILE_TRIGGER) - switch (_spawnSelection) - { - case 0: - for (uint8 i = 0; i < 5; ++i) - me->SummonCreature(NPC_XS013_SCRAPBOT, target->GetPositionX()+irand(-3, 3), target->GetPositionY()+irand(-3, 3), target->GetPositionZ()+2, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); - _spawnSelection++; - break; - case 1: - me->SummonCreature(NPC_XE321_BOOMBOT, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+2, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - _spawnSelection++; - break; - case 2: - for (uint8 i = 0; i < 5; ++i) - me->SummonCreature(NPC_XS013_SCRAPBOT, target->GetPositionX()+irand(-3, 3), target->GetPositionY()+irand(-3, 3), target->GetPositionZ()+2, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); - _spawnSelection++; - break; - case 3: - if(_pummelerCount < 2) - me->SummonCreature(NPC_XM024_PUMMELLER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+2, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - - _pummelerCount++; - _spawnSelection++; - break; - case 4: - for (uint8 i = 0; i < 5; ++i) - me->SummonCreature(NPC_XS013_SCRAPBOT, target->GetPositionX()+irand(-3, 3), target->GetPositionY()+irand(-3, 3), target->GetPositionZ()+2, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); - _spawnSelection = 0; - break; - } - } + void SpellHitTarget(Unit *target, const SpellInfo *spellInfo) + { + // spawn not-so-random robots + if (spellInfo->Id == SPELL_ENERGY_ORB_TRIGGER && target->GetEntry() == NPC_PILE_TRIGGER) + switch (_spawnSelection) + { + case 0: + for (uint8 i = 0; i < 5; ++i) + me->SummonCreature(NPC_XS013_SCRAPBOT, target->GetPositionX()+irand(-3, 3), target->GetPositionY()+irand(-3, 3), target->GetPositionZ()+2, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); + _spawnSelection++; + break; + case 1: + me->SummonCreature(NPC_XE321_BOOMBOT, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+2, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + _spawnSelection++; + break; + case 2: + for (uint8 i = 0; i < 5; ++i) + me->SummonCreature(NPC_XS013_SCRAPBOT, target->GetPositionX()+irand(-3, 3), target->GetPositionY()+irand(-3, 3), target->GetPositionZ()+2, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); + _spawnSelection++; + break; + case 3: + if(_pummelerCount < 2) + me->SummonCreature(NPC_XM024_PUMMELLER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()+2, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + + _pummelerCount++; + _spawnSelection++; + break; + case 4: + for (uint8 i = 0; i < 5; ++i) + me->SummonCreature(NPC_XS013_SCRAPBOT, target->GetPositionX()+irand(-3, 3), target->GetPositionY()+irand(-3, 3), target->GetPositionZ()+2, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); + _spawnSelection = 0; + break; + } + } - void JustDied(Unit *victim) - { - me->SetVisible(false); - if (me->GetInstanceScript()) - if (Creature* XT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) - if (XT002->AI()) - XT002->AI()->DoAction(ACTION_HEART_BROKEN); - } + void JustDied(Unit *victim) + { + me->SetVisible(false); + if (me->GetInstanceScript()) + if (Creature* XT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) + if (XT002->AI()) + XT002->AI()->DoAction(ACTION_HEART_BROKEN); + } - void UpdateAI(uint32 diff) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) - { - _timerSpawn += diff; - if (_timerSpawn >= 1900) - { - SendEnergyToCorner(); - _timerSpawn -= 1900; - } - } - } - }; + void UpdateAI(uint32 diff) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) + { + _timerSpawn += diff; + if (_timerSpawn >= 1900) + { + SendEnergyToCorner(); + _timerSpawn -= 1900; + } + } + } + }; }; class npc_xt002_scrapbot : public CreatureScript @@ -565,77 +565,77 @@ public: return new npc_xt002_scrapbotAI (pCreature); } - struct npc_xt002_scrapbotAI : public PassiveAI - { - npc_xt002_scrapbotAI(Creature* pCreature) : PassiveAI(pCreature) { } + struct npc_xt002_scrapbotAI : public PassiveAI + { + npc_xt002_scrapbotAI(Creature* pCreature) : PassiveAI(pCreature) { } - bool _locked; - void Reset() - { - me->StopMoving(); - _locked = true; - me->SetWalk(true); + bool _locked; + void Reset() + { + me->StopMoving(); + _locked = true; + me->SetWalk(true); - if (me->GetInstanceScript()) - if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) - { - if (pXT002->GetPositionZ() > 411.0f) // he is on stairs... idiot cryness protection - me->GetMotionMaster()->MovePoint(0, 884.028931f, -14.593809f, 409.786987f); - else - _locked = false; - } - } + if (me->GetInstanceScript()) + if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) + { + if (pXT002->GetPositionZ() > 411.0f) // he is on stairs... idiot cryness protection + me->GetMotionMaster()->MovePoint(0, 884.028931f, -14.593809f, 409.786987f); + else + _locked = false; + } + } - void JustDied(Unit* killer) - { - // Nerf Scrapbots achievement - if (killer->GetEntry() == NPC_XE321_BOOMBOT) - if (me->GetInstanceScript()) - { - me->GetInstanceScript()->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, 65037); - me->GetInstanceScript()->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65037); - } - } + void JustDied(Unit* killer) + { + // Nerf Scrapbots achievement + if (killer->GetEntry() == NPC_XE321_BOOMBOT) + if (me->GetInstanceScript()) + { + me->GetInstanceScript()->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, 65037); + me->GetInstanceScript()->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65037); + } + } - // tc idiots, they use updateAI, while we have movementinform :) - void MovementInform(uint32 type, uint32 param) - { - if (type == POINT_MOTION_TYPE) - { - _locked = false; - return; - } + // tc idiots, they use updateAI, while we have movementinform :) + void MovementInform(uint32 type, uint32 param) + { + if (type == POINT_MOTION_TYPE) + { + _locked = false; + return; + } - // we reached the target :) - if (type == FOLLOW_MOTION_TYPE && me->GetInstanceScript()) - if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) - { - if (pXT002->IsAlive()) - { - pXT002->AI()->DoAction(DATA_XT002_NERF_ENGINEERING); - pXT002->ModifyHealth(pXT002->GetMaxHealth() * 0.01f); - } + // we reached the target :) + if (type == FOLLOW_MOTION_TYPE && me->GetInstanceScript()) + if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) + { + if (pXT002->IsAlive()) + { + pXT002->AI()->DoAction(DATA_XT002_NERF_ENGINEERING); + pXT002->ModifyHealth(pXT002->GetMaxHealth() * 0.01f); + } - if (!urand(0,2)) - me->MonsterTextEmote("XT-002 Deconstructor consumes scrap bot to repair himself.", 0, true); - - me->DespawnOrUnsummon(1); - } - } + if (!urand(0,2)) + me->MonsterTextEmote("XT-002 Deconstructor consumes scrap bot to repair himself.", 0, true); + + me->DespawnOrUnsummon(1); + } + } - void UpdateAI(uint32 diff) - { - if (!_locked) - { - if (me->GetInstanceScript()) - if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) - { - me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f); - _locked = true; - } - } - } - }; + void UpdateAI(uint32 diff) + { + if (!_locked) + { + if (me->GetInstanceScript()) + if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) + { + me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f); + _locked = true; + } + } + } + }; }; class npc_xt002_pummeller : public CreatureScript @@ -648,57 +648,57 @@ public: return new npc_xt002_pummellerAI (pCreature); } - struct npc_xt002_pummellerAI : public ScriptedAI - { - npc_xt002_pummellerAI(Creature* pCreature) : ScriptedAI(pCreature) { } + struct npc_xt002_pummellerAI : public ScriptedAI + { + npc_xt002_pummellerAI(Creature* pCreature) : ScriptedAI(pCreature) { } - int32 _arcingSmashTimer; - int32 _trampleTimer; - int32 _uppercutTimer; + int32 _arcingSmashTimer; + int32 _trampleTimer; + int32 _uppercutTimer; - void Reset() - { - _arcingSmashTimer = 0; - _trampleTimer = 0; - _uppercutTimer = 0; + void Reset() + { + _arcingSmashTimer = 0; + _trampleTimer = 0; + _uppercutTimer = 0; - if (Unit *target = SelectTargetFromPlayerList(200)) - AttackStart(target); - else - me->DespawnOrUnsummon(500); - } + if (Unit *target = SelectTargetFromPlayerList(200)) + AttackStart(target); + else + me->DespawnOrUnsummon(500); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _arcingSmashTimer += diff; - _trampleTimer += diff; - _uppercutTimer += diff; + _arcingSmashTimer += diff; + _trampleTimer += diff; + _uppercutTimer += diff; - if (_arcingSmashTimer >= 8000) - { - me->CastSpell(me->GetVictim(), SPELL_ARCING_SMASH, false); - _arcingSmashTimer = 0; - return; - } - if (_trampleTimer >= 11000) - { - me->CastSpell(me->GetVictim(), SPELL_TRAMPLE, false); - _trampleTimer = 0; - return; - } - if (_uppercutTimer >= 14000) - { - me->CastSpell(me->GetVictim(), SPELL_UPPERCUT, false); - _uppercutTimer = 0; - return; - } + if (_arcingSmashTimer >= 8000) + { + me->CastSpell(me->GetVictim(), SPELL_ARCING_SMASH, false); + _arcingSmashTimer = 0; + return; + } + if (_trampleTimer >= 11000) + { + me->CastSpell(me->GetVictim(), SPELL_TRAMPLE, false); + _trampleTimer = 0; + return; + } + if (_uppercutTimer >= 14000) + { + me->CastSpell(me->GetVictim(), SPELL_UPPERCUT, false); + _uppercutTimer = 0; + return; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class BoomEvent : public BasicEvent @@ -734,35 +734,35 @@ public: return new npc_xt002_boombotAI (pCreature); } - struct npc_xt002_boombotAI : public PassiveAI - { - npc_xt002_boombotAI(Creature* pCreature) : PassiveAI(pCreature) { } + struct npc_xt002_boombotAI : public PassiveAI + { + npc_xt002_boombotAI(Creature* pCreature) : PassiveAI(pCreature) { } - bool _locked; - bool _boomed; - void Reset() - { - me->StopMoving(); - _locked = true; - _boomed = false; - me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + bool _locked; + bool _boomed; + void Reset() + { + me->StopMoving(); + _locked = true; + _boomed = false; + me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); - if (me->GetInstanceScript()) - if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) - { - if (pXT002->GetPositionZ() > 411.0f) // he is on stairs... idiot cryness protection - me->GetMotionMaster()->MovePoint(0, 884.028931f, -14.593809f, 409.786987f); - else - _locked = false; - } - } + if (me->GetInstanceScript()) + if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) + { + if (pXT002->GetPositionZ() > 411.0f) // he is on stairs... idiot cryness protection + me->GetMotionMaster()->MovePoint(0, 884.028931f, -14.593809f, 409.786987f); + else + _locked = false; + } + } - void Explode() - { - if (_boomed) - return; + void Explode() + { + if (_boomed) + return; - _boomed = true; // Prevent recursive calls + _boomed = true; // Prevent recursive calls WorldPacket data(SMSG_SPELLINSTAKILLLOG, 8+8+4); data << uint64(me->GetGUID()); @@ -770,7 +770,7 @@ public: data << uint32(SPELL_BOOM); me->SendMessageToSet(&data, false); - Unit::Kill(me, me); + Unit::Kill(me, me); // Visual only seems to work if the instant kill event is delayed or the spell itself is delayed // Casting done from player and caster source has the same targetinfo flags, @@ -778,51 +778,51 @@ public: // See BoomEvent class // Schedule 1s delayed me->m_Events.AddEvent(new BoomEvent(me), me->m_Events.CalculateTime(1*IN_MILLISECONDS)); - } - - void JustDied(Unit*) - { - me->m_Events.AddEvent(new BoomEvent(me), me->m_Events.CalculateTime(1*IN_MILLISECONDS)); - } - - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (_boomed) - damage = 0; - - if (me->HealthBelowPctDamaged(50, damage) && !_boomed) - { - damage = 0; - Explode(); - } } - // tc idiots, they use updateAI, while we have movementinform :) - void MovementInform(uint32 type, uint32 param) - { - if (type == POINT_MOTION_TYPE) - { - _locked = false; - return; - } - // we reached the target :) - //if (type == FOLLOW_MOTION_TYPE) - // _kill = true; - } + void JustDied(Unit*) + { + me->m_Events.AddEvent(new BoomEvent(me), me->m_Events.CalculateTime(1*IN_MILLISECONDS)); + } - void UpdateAI(uint32 diff) - { - if (!_locked) - { - if (me->GetInstanceScript()) - if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) - { - me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f); - _locked = true; - } - } - } - }; + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (_boomed) + damage = 0; + + if (me->HealthBelowPctDamaged(50, damage) && !_boomed) + { + damage = 0; + Explode(); + } + } + + // tc idiots, they use updateAI, while we have movementinform :) + void MovementInform(uint32 type, uint32 param) + { + if (type == POINT_MOTION_TYPE) + { + _locked = false; + return; + } + // we reached the target :) + //if (type == FOLLOW_MOTION_TYPE) + // _kill = true; + } + + void UpdateAI(uint32 diff) + { + if (!_locked) + { + if (me->GetInstanceScript()) + if (Creature* pXT002 = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_XT002))) + { + me->GetMotionMaster()->MoveFollow(pXT002, 0.0f, 0.0f); + _locked = true; + } + } + } + }; }; class npc_xt002_life_spark : public CreatureScript @@ -835,33 +835,33 @@ public: return new npc_xt002_life_sparkAI (pCreature); } - struct npc_xt002_life_sparkAI : public ScriptedAI - { - npc_xt002_life_sparkAI(Creature* pCreature) : ScriptedAI(pCreature) - { - me->SetMaxHealth(RAID_MODE(54000, 172000)); - me->SetHealth(me->GetMaxHealth()); - me->CastSpell(me, SPELL_SPARK_DAMAGE, true); - } + struct npc_xt002_life_sparkAI : public ScriptedAI + { + npc_xt002_life_sparkAI(Creature* pCreature) : ScriptedAI(pCreature) + { + me->SetMaxHealth(RAID_MODE(54000, 172000)); + me->SetHealth(me->GetMaxHealth()); + me->CastSpell(me, SPELL_SPARK_DAMAGE, true); + } - uint32 _attackTimer; - void Reset() - { - if (Unit *target = SelectTargetFromPlayerList(200)) - AttackStart(target); - else - me->DespawnOrUnsummon(); - } + uint32 _attackTimer; + void Reset() + { + if (Unit *target = SelectTargetFromPlayerList(200)) + AttackStart(target); + else + me->DespawnOrUnsummon(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - me->CastSpell(me->GetVictim(), SPELL_SPARK_MELEE, false); - DoMeleeAttackIfReady(); - } - }; + me->CastSpell(me->GetVictim(), SPELL_SPARK_MELEE, false); + DoMeleeAttackIfReady(); + } + }; }; class spell_xt002_tympanic_tantrum : public SpellScriptLoader @@ -880,8 +880,8 @@ class spell_xt002_tympanic_tantrum : public SpellScriptLoader void RecalculateDamage() { - if (GetHitUnit()) - SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(GetHitDamage())); + if (GetHitUnit()) + SetHitDamage(GetHitUnit()->CountPctFromMaxHealth(GetHitDamage())); } void Register() @@ -912,10 +912,10 @@ class spell_xt002_gravity_bomb_aura : public SpellScriptLoader if (Unit* xt002 = GetCaster()) if (xt002->HasAura(aurEff->GetAmount())) // Heartbreak aura indicating hard mode if (Creature* cr = xt002->SummonCreature(NPC_VOID_ZONE, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000)) - { - int32 damage = GetSpellInfo()->Id == 63025 ? 5000 : 7500; - cr->CastCustomSpell(cr, SPELL_VOID_ZONE_DAMAGE, &damage, 0, 0, true); - } + { + int32 damage = GetSpellInfo()->Id == 63025 ? 5000 : 7500; + cr->CastCustomSpell(cr, SPELL_VOID_ZONE_DAMAGE, &damage, 0, 0, true); + } } void OnPeriodic(AuraEffect const* aurEff) @@ -945,14 +945,14 @@ class spell_xt002_gravity_bomb_aura : public SpellScriptLoader return new spell_xt002_gravity_bomb_aura_AuraScript(); } - class spell_xt002_gravity_bomb_aura_SpellScript : public SpellScript + class spell_xt002_gravity_bomb_aura_SpellScript : public SpellScript { PrepareSpellScript(spell_xt002_gravity_bomb_aura_SpellScript); void SelectTarget(std::list& targets) { - if (Unit* victim = GetCaster()->GetVictim()) - targets.remove_if(Trinity::ObjectGUIDCheck(victim->GetGUID(), true)); + if (Unit* victim = GetCaster()->GetVictim()) + targets.remove_if(Trinity::ObjectGUIDCheck(victim->GetGUID(), true)); } void Register() @@ -982,9 +982,9 @@ class spell_xt002_gravity_bomb_damage : public SpellScriptLoader if (!caster) return; - if (GetHitDamage() >= int32(GetHitUnit()->GetHealth())) + if (GetHitDamage() >= int32(GetHitUnit()->GetHealth())) if (caster->GetAI()) - caster->GetAI()->DoAction(DATA_XT002_GRAVITY_ACHIEV); + caster->GetAI()->DoAction(DATA_XT002_GRAVITY_ACHIEV); } void Register() @@ -1013,7 +1013,7 @@ class spell_xt002_searing_light_spawn_life_spark : public SpellScriptLoader if (Player* player = GetOwner()->ToPlayer()) if (Unit* xt002 = GetCaster()) if (xt002->HasAura(aurEff->GetAmount())) // Heartbreak aura indicating hard mode - xt002->SummonCreature(NPC_LIFE_SPARK, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); + xt002->SummonCreature(NPC_LIFE_SPARK, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); } void Register() @@ -1027,14 +1027,14 @@ class spell_xt002_searing_light_spawn_life_spark : public SpellScriptLoader return new spell_xt002_searing_light_spawn_life_spark_AuraScript(); } - class spell_xt002_searing_light_spawn_life_spark_SpellScript : public SpellScript + class spell_xt002_searing_light_spawn_life_spark_SpellScript : public SpellScript { PrepareSpellScript(spell_xt002_searing_light_spawn_life_spark_SpellScript); void SelectTarget(std::list& targets) { - if (Unit* victim = GetCaster()->GetVictim()) - targets.remove_if(Trinity::ObjectGUIDCheck(victim->GetGUID(), true)); + if (Unit* victim = GetCaster()->GetVictim()) + targets.remove_if(Trinity::ObjectGUIDCheck(victim->GetGUID(), true)); } void Register() @@ -1056,12 +1056,12 @@ class achievement_xt002_nerf_engineering : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - if (target) - if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_XT002))) - return cr->AI()->GetData(DATA_XT002_NERF_ENGINEERING); - - return false; + if (target) + if (InstanceScript* instance = target->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_XT002))) + return cr->AI()->GetData(DATA_XT002_NERF_ENGINEERING); + + return false; } }; @@ -1072,32 +1072,32 @@ class achievement_xt002_nerf_gravity_bombs : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - if (target) - if (InstanceScript* instance = target->GetInstanceScript()) - if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_XT002))) - return cr->AI()->GetData(DATA_XT002_GRAVITY_ACHIEV); - - return false; + if (target) + if (InstanceScript* instance = target->GetInstanceScript()) + if (Creature* cr = ObjectAccessor::GetCreature(*target, instance->GetData64(TYPE_XT002))) + return cr->AI()->GetData(DATA_XT002_GRAVITY_ACHIEV); + + return false; } }; void AddSC_boss_xt002() { - // Npcs + // Npcs new boss_xt002(); - new npc_xt002_heart(); - new npc_xt002_scrapbot(); - new npc_xt002_pummeller(); - new npc_xt002_boombot(); - new npc_xt002_life_spark(); + new npc_xt002_heart(); + new npc_xt002_scrapbot(); + new npc_xt002_pummeller(); + new npc_xt002_boombot(); + new npc_xt002_life_spark(); - // Spells - new spell_xt002_tympanic_tantrum(); - new spell_xt002_gravity_bomb_aura(); - new spell_xt002_gravity_bomb_damage(); - new spell_xt002_searing_light_spawn_life_spark(); + // Spells + new spell_xt002_tympanic_tantrum(); + new spell_xt002_gravity_bomb_aura(); + new spell_xt002_gravity_bomb_damage(); + new spell_xt002_searing_light_spawn_life_spark(); - // Achievements - new achievement_xt002_nerf_engineering(); - new achievement_xt002_nerf_gravity_bombs(); + // Achievements + new achievement_xt002_nerf_engineering(); + new achievement_xt002_nerf_gravity_bombs(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp index da396e914..88626d9f6 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp @@ -14,285 +14,285 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum YoggSpells { - // KEEPERS - SPELL_KEEPER_ACTIVE = 62647, - SPELL_MIMIRON_PASSIVE = 62671, - SPELL_THORIM_PASSIVE = 62702, - SPELL_HODIR_PASSIVE = 62650, - SPELL_FREYA_PASSIVE = 62670, + // KEEPERS + SPELL_KEEPER_ACTIVE = 62647, + SPELL_MIMIRON_PASSIVE = 62671, + SPELL_THORIM_PASSIVE = 62702, + SPELL_HODIR_PASSIVE = 62650, + SPELL_FREYA_PASSIVE = 62670, - SPELL_DESTABILIZATION_MATRIX = 65206, - SPELL_DESTABILIZATION_MATRIX_ATTACK = 65210, - SPELL_SANITY_WELL_VISUAL = 63288, - SPELL_SANITY_WELL_BUFF = 64169, - SPELL_PROTECTIVE_GAZE = 64174, // COOLDOWN 25 SECS BEFORE NEXT USE - SPELL_HODIR_FLASH_FREEZE = 64175, - SPELL_CONJURE_SANITY_WELL = 64170, + SPELL_DESTABILIZATION_MATRIX = 65206, + SPELL_DESTABILIZATION_MATRIX_ATTACK = 65210, + SPELL_SANITY_WELL_VISUAL = 63288, + SPELL_SANITY_WELL_BUFF = 64169, + SPELL_PROTECTIVE_GAZE = 64174, // COOLDOWN 25 SECS BEFORE NEXT USE + SPELL_HODIR_FLASH_FREEZE = 64175, + SPELL_CONJURE_SANITY_WELL = 64170, - SPELL_TITANIC_STORM_PASSIVE = 64171, - SPELL_WEAKENED = 64162, + SPELL_TITANIC_STORM_PASSIVE = 64171, + SPELL_WEAKENED = 64162, - // GLOBAL - SPELL_SANITY_BASE = 63786, - SPELL_SANITY = 63050, - SPELL_EXTINGUISH_ALL_LIFE = 64166, - SPELL_CLOUD_VISUAL = 63084, - SPELL_SUMMON_GUARDIAN_OF_YS = 63031, - SPELL_INSANE1 = 63120, - SPELL_INSANE2 = 64464, - SPELL_INSANE_PERIODIC = 64554, // this checks if player dc'ed and insanes him instantly after logging in + // GLOBAL + SPELL_SANITY_BASE = 63786, + SPELL_SANITY = 63050, + SPELL_EXTINGUISH_ALL_LIFE = 64166, + SPELL_CLOUD_VISUAL = 63084, + SPELL_SUMMON_GUARDIAN_OF_YS = 63031, + SPELL_INSANE1 = 63120, + SPELL_INSANE2 = 64464, + SPELL_INSANE_PERIODIC = 64554, // this checks if player dc'ed and insanes him instantly after logging in - // SARA P1 + // SARA P1 SPELL_SARAS_FAVOR = 63138, SPELL_SARAS_FAVOR_TARGET_SELECTOR = 63747, SPELL_SARAS_BLESSING = 63134, SPELL_SARAS_BLESSING_TARGET_SELECTOR = 63745, SPELL_SARAS_ANGER = 63147, SPELL_SARAS_ANGER_TARGET_SELECTOR = 63744, - SPELL_SHADOWY_BARRIER = 64775, + SPELL_SHADOWY_BARRIER = 64775, - // GUARDIANS OF YOGG-SARON - SPELL_SHADOW_NOVA = 62714, - SPELL_DARK_VOLLEY = 63038, + // GUARDIANS OF YOGG-SARON + SPELL_SHADOW_NOVA = 62714, + SPELL_DARK_VOLLEY = 63038, - // SARA P2 - SPELL_SARA_PSYCHOSIS_10 = 63795, - SPELL_SARA_PSYCHOSIS_25 = 65301, - SPELL_MALADY_OF_THE_MIND = 63830, - SPELL_MALADY_OF_THE_MIND_TRIGGER = 63881, - SPELL_BRAIN_LINK = 63802, - SPELL_BRAIN_LINK_DAMAGE = 63803, - SPELL_BRAIN_LINK_OK = 63804, + // SARA P2 + SPELL_SARA_PSYCHOSIS_10 = 63795, + SPELL_SARA_PSYCHOSIS_25 = 65301, + SPELL_MALADY_OF_THE_MIND = 63830, + SPELL_MALADY_OF_THE_MIND_TRIGGER = 63881, + SPELL_BRAIN_LINK = 63802, + SPELL_BRAIN_LINK_DAMAGE = 63803, + SPELL_BRAIN_LINK_OK = 63804, - SPELL_DEATH_RAY_DAMAGE_VISUAL = 63886, - SPELL_DEATH_RAY_ORIGIN_VISUAL = 63893, - SPELL_DEATH_RAY_WARNING = 63882, - SPELL_DEATH_RAY_DAMAGE = 63883, - SPELL_DEATH_RAY_DAMAGE_REAL = 63884, + SPELL_DEATH_RAY_DAMAGE_VISUAL = 63886, + SPELL_DEATH_RAY_ORIGIN_VISUAL = 63893, + SPELL_DEATH_RAY_WARNING = 63882, + SPELL_DEATH_RAY_DAMAGE = 63883, + SPELL_DEATH_RAY_DAMAGE_REAL = 63884, - // YOGG-SARON P2 - SPELL_SHADOW_BARRIER = 63894, - SPELL_KNOCK_AWAY = 64022, + // YOGG-SARON P2 + SPELL_SHADOW_BARRIER = 63894, + SPELL_KNOCK_AWAY = 64022, - // TENTACLES - SPELL_VOID_ZONE_SMALL = 64384, - SPELL_VOID_ZONE_LARGE = 64017, - SPELL_TENTACLE_ERUPT = 64144, + // TENTACLES + SPELL_VOID_ZONE_SMALL = 64384, + SPELL_VOID_ZONE_LARGE = 64017, + SPELL_TENTACLE_ERUPT = 64144, - // CRUSHER TENTACLE - SPELL_CRUSH = 64146, - SPELL_DIMINISH_POWER = 64145, - SPELL_FOCUSED_ANGER = 57688, + // CRUSHER TENTACLE + SPELL_CRUSH = 64146, + SPELL_DIMINISH_POWER = 64145, + SPELL_FOCUSED_ANGER = 57688, - // CONSTRICTOR TENTACLE - SPELL_LUNGE = 64123, - SPELL_SQUEEZE_10 = 64125, - SPELL_SQUEEZE_25 = 64126, + // CONSTRICTOR TENTACLE + SPELL_LUNGE = 64123, + SPELL_SQUEEZE_10 = 64125, + SPELL_SQUEEZE_25 = 64126, - // CORRUPTOR TENTACLE - SPELL_APATHY = 64156, - SPELL_BLACK_PLAGUE = 64153, - SPELL_CURSE_OF_DOOM = 64157, - SPELL_DRAINING_POISON = 64152, + // CORRUPTOR TENTACLE + SPELL_APATHY = 64156, + SPELL_BLACK_PLAGUE = 64153, + SPELL_CURSE_OF_DOOM = 64157, + SPELL_DRAINING_POISON = 64152, - // MISC - SPELL_REVEALED_TENTACLE = 64012, - SPELL_IN_THE_MAWS_OF_THE_OLD_GOD = 64184, + // MISC + SPELL_REVEALED_TENTACLE = 64012, + SPELL_IN_THE_MAWS_OF_THE_OLD_GOD = 64184, - // BRAIN OF YOGG-SARON - SPELL_SHATTERED_ILLUSION = 64173, - SPELL_INDUCE_MADNESS = 64059, - SPELL_BRAIN_HURT_VISUAL = 64361, + // BRAIN OF YOGG-SARON + SPELL_SHATTERED_ILLUSION = 64173, + SPELL_INDUCE_MADNESS = 64059, + SPELL_BRAIN_HURT_VISUAL = 64361, - // PORTALS - SPELL_TELEPORT_TO_CHAMBER = 63997, - SPELL_TELEPORT_TO_ICECROWN = 63998, - SPELL_TELEPORT_TO_STORMWIND = 63989, - SPELL_TELEPORT_BACK = 63992, - SPELL_CANCEL_ILLUSION_AURA = 63993, + // PORTALS + SPELL_TELEPORT_TO_CHAMBER = 63997, + SPELL_TELEPORT_TO_ICECROWN = 63998, + SPELL_TELEPORT_TO_STORMWIND = 63989, + SPELL_TELEPORT_BACK = 63992, + SPELL_CANCEL_ILLUSION_AURA = 63993, - // LAUGHING SKULL AND INFLUENCE TENTACLE AND OTHERS - SPELL_LUNATIC_GAZE = 64167, - SPELL_GRIM_REPRISAL = 63305, - SPELL_GRIM_REPRISAL_DAMAGE = 64039, - SPELL_DEATHGRASP = 63037, + // LAUGHING SKULL AND INFLUENCE TENTACLE AND OTHERS + SPELL_LUNATIC_GAZE = 64167, + SPELL_GRIM_REPRISAL = 63305, + SPELL_GRIM_REPRISAL_DAMAGE = 64039, + SPELL_DEATHGRASP = 63037, - // YOGG-SARON P3 - SPELL_LUNATIC_GAZE_YS = 64163, - SPELL_DEAFENING_ROAR = 64189, - SPELL_SHADOW_BEACON = 64465, + // YOGG-SARON P3 + SPELL_LUNATIC_GAZE_YS = 64163, + SPELL_DEAFENING_ROAR = 64189, + SPELL_SHADOW_BEACON = 64465, - // IMMORTAL GUARDIAN - SPELL_SIMPLE_TELEPORT = 64195, - SPELL_EMPOWERED = 65294, - SPELL_EMPOWERED_PASSIVE = 64161, - SPELL_DRAIN_LIFE_10 = 64159, - SPELL_DRAIN_LIFE_25 = 64160, - SPELL_RECENTLY_SPAWNED = 64497, + // IMMORTAL GUARDIAN + SPELL_SIMPLE_TELEPORT = 64195, + SPELL_EMPOWERED = 65294, + SPELL_EMPOWERED_PASSIVE = 64161, + SPELL_DRAIN_LIFE_10 = 64159, + SPELL_DRAIN_LIFE_25 = 64160, + SPELL_RECENTLY_SPAWNED = 64497, }; -#define SPELL_PSYCHOSIS RAID_MODE(SPELL_SARA_PSYCHOSIS_10, SPELL_SARA_PSYCHOSIS_25) -#define SPELL_SQUEEZE RAID_MODE(SPELL_SQUEEZE_10, SPELL_SQUEEZE_25) -#define SPELL_DRAIN_LIFE RAID_MODE(SPELL_DRAIN_LIFE_10, SPELL_DRAIN_LIFE_25) +#define SPELL_PSYCHOSIS RAID_MODE(SPELL_SARA_PSYCHOSIS_10, SPELL_SARA_PSYCHOSIS_25) +#define SPELL_SQUEEZE RAID_MODE(SPELL_SQUEEZE_10, SPELL_SQUEEZE_25) +#define SPELL_DRAIN_LIFE RAID_MODE(SPELL_DRAIN_LIFE_10, SPELL_DRAIN_LIFE_25) enum YoggEvents { - EVENT_SARA_P1_DOORS_CLOSE = 1, - EVENT_SARA_P1_SUMMON = 2, - EVENT_SARA_P1_SPELLS = 3, - EVENT_SARA_P1_BERSERK = 4, + EVENT_SARA_P1_DOORS_CLOSE = 1, + EVENT_SARA_P1_SUMMON = 2, + EVENT_SARA_P1_SPELLS = 3, + EVENT_SARA_P1_BERSERK = 4, - EVENT_SARA_P2_START = 10, - EVENT_SARA_P2_SUMMON_T1 = 11, - EVENT_SARA_P2_SUMMON_T2 = 12, - EVENT_SARA_P2_SUMMON_T3 = 13, - EVENT_SARA_P2_BRAIN_LINK = 14, - EVENT_SARA_P2_DEATH_RAY = 15, - EVENT_SARA_P2_MALADY = 16, - EVENT_SARA_P2_PSYCHOSIS = 17, - EVENT_SARA_P2_OPEN_PORTALS = 18, - EVENT_SARA_P2_REMOVE_STUN = 19, - EVENT_SARA_P2_SPAWN_START_TENTACLES = 20, + EVENT_SARA_P2_START = 10, + EVENT_SARA_P2_SUMMON_T1 = 11, + EVENT_SARA_P2_SUMMON_T2 = 12, + EVENT_SARA_P2_SUMMON_T3 = 13, + EVENT_SARA_P2_BRAIN_LINK = 14, + EVENT_SARA_P2_DEATH_RAY = 15, + EVENT_SARA_P2_MALADY = 16, + EVENT_SARA_P2_PSYCHOSIS = 17, + EVENT_SARA_P2_OPEN_PORTALS = 18, + EVENT_SARA_P2_REMOVE_STUN = 19, + EVENT_SARA_P2_SPAWN_START_TENTACLES = 20, - EVENT_YS_LUNATIC_GAZE = 30, - EVENT_YS_DEAFENING_ROAR = 31, - EVENT_YS_SUMMON_GUARDIAN = 32, - EVENT_YS_SHADOW_BEACON = 33, + EVENT_YS_LUNATIC_GAZE = 30, + EVENT_YS_DEAFENING_ROAR = 31, + EVENT_YS_SUMMON_GUARDIAN = 32, + EVENT_YS_SHADOW_BEACON = 33, }; enum NPCsGOs { - // NPCs - NPC_OMINOUS_CLOUD = 33292, - NPC_GUARDIAN_OF_YS = 33136, - NPC_SANITY_WELL = 33991, - NPC_YOGG_SARON = 33288, - NPC_VOICE_OF_YOGG_SARON = 33280, + // NPCs + NPC_OMINOUS_CLOUD = 33292, + NPC_GUARDIAN_OF_YS = 33136, + NPC_SANITY_WELL = 33991, + NPC_YOGG_SARON = 33288, + NPC_VOICE_OF_YOGG_SARON = 33280, - NPC_CRUSHER_TENTACLE = 33966, // 50 secs ? - NPC_CONSTRICTOR_TENTACLE = 33983, // 15-20 secs ? - NPC_CORRUPTOR_TENTACLE = 33985, // 30-40 secs ? + NPC_CRUSHER_TENTACLE = 33966, // 50 secs ? + NPC_CONSTRICTOR_TENTACLE = 33983, // 15-20 secs ? + NPC_CORRUPTOR_TENTACLE = 33985, // 30-40 secs ? - NPC_INFLUENCE_TENTACLE = 33943, - NPC_DEATH_ORB = 33882, - NPC_DESCEND_INTO_MADNESS = 34072, - NPC_LAUGHING_SKULL = 33990, + NPC_INFLUENCE_TENTACLE = 33943, + NPC_DEATH_ORB = 33882, + NPC_DESCEND_INTO_MADNESS = 34072, + NPC_LAUGHING_SKULL = 33990, - NPC_IMMORTAL_GUARDIAN = 33988, + NPC_IMMORTAL_GUARDIAN = 33988, - // CHAMBER ILLUSION - NPC_CONSORT_FIRST = 33716, - NPC_CONSORT_LAST = 33720, - NPC_ALEXTRASZA = 33536, - NPC_MALYGOS = 33535, - NPC_NELTHARION = 33523, - NPC_YSERA = 33495, - GO_DRAGON_SOUL = 194462, + // CHAMBER ILLUSION + NPC_CONSORT_FIRST = 33716, + NPC_CONSORT_LAST = 33720, + NPC_ALEXTRASZA = 33536, + NPC_MALYGOS = 33535, + NPC_NELTHARION = 33523, + NPC_YSERA = 33495, + GO_DRAGON_SOUL = 194462, - // ICECROWN ILLUSION - NPC_DEATHSWORN_ZEALOT = 33567, - NPC_LICH_KING = 33441, - NPC_IMMOLATED_CHAMPION = 33442, + // ICECROWN ILLUSION + NPC_DEATHSWORN_ZEALOT = 33567, + NPC_LICH_KING = 33441, + NPC_IMMOLATED_CHAMPION = 33442, - // STORMWIND ILLUSION - NPC_SUIT_OF_ARMOR = 33433, - NPC_GARONA = 33436, - NPC_KING_LLANE = 33437, + // STORMWIND ILLUSION + NPC_SUIT_OF_ARMOR = 33433, + NPC_GARONA = 33436, + NPC_KING_LLANE = 33437, - // GOs - GO_DOORS = 194773, - GO_FLEE_TO_THE_SURFACE_PORTAL = 194625, - GO_CHAMBER_ILLUSION_DOORS = 194635, - GO_ICECROWN_ILLUSION_DOORS = 194636, - GO_STORMWIND_ILLUSION_DOORS = 194637, + // GOs + GO_DOORS = 194773, + GO_FLEE_TO_THE_SURFACE_PORTAL = 194625, + GO_CHAMBER_ILLUSION_DOORS = 194635, + GO_ICECROWN_ILLUSION_DOORS = 194636, + GO_STORMWIND_ILLUSION_DOORS = 194637, - // MODELs - SARA_TRANSFORM_MODEL = 29182, + // MODELs + SARA_TRANSFORM_MODEL = 29182, }; enum YoggSaronSounds { - // SARA - SARA_AGGRO = 15775, - SARA_P1_CAST1 = 15773, - SARA_P1_CAST2 = 15774, - SARA_P1_KILL1 = 15778, - SARA_P1_KILL2 = 15779, - - SARA_P2_START = 15754, - SARA_P2_CAST1 = 15776, - SARA_P2_CAST2 = 15777, + // SARA + SARA_AGGRO = 15775, + SARA_P1_CAST1 = 15773, + SARA_P1_CAST2 = 15774, + SARA_P1_KILL1 = 15778, + SARA_P1_KILL2 = 15779, + + SARA_P2_START = 15754, + SARA_P2_CAST1 = 15776, + SARA_P2_CAST2 = 15777, - // YOGG-SARON - YS_OPEN_PORTALS = 15756, - YS_P3_START = 15755, - YS_P3_DEAFENING_ROAR = 15758, - YS_P3_DEATH = 15761, - YS_P3_LUNATIC_GAZE = 15757, + // YOGG-SARON + YS_OPEN_PORTALS = 15756, + YS_P3_START = 15755, + YS_P3_DEAFENING_ROAR = 15758, + YS_P3_DEATH = 15761, + YS_P3_LUNATIC_GAZE = 15757, - VOYS_P1_WIPE = 15780, - VOYS_INSANE1 = 15759, - VOYS_INSANE2 = 15760, + VOYS_P1_WIPE = 15780, + VOYS_INSANE1 = 15759, + VOYS_INSANE2 = 15760, - // VISIONS - // STORMWIND - YS_V1_1 = 15762, - YS_V1_2 = 15763, - YS_V1_3 = 15764, - GAR_1 = 15538, - GAR_2 = 15539, - GAR_3 = 15540, - GAR_4 = 15541, - LL_1 = 15585, + // VISIONS + // STORMWIND + YS_V1_1 = 15762, + YS_V1_2 = 15763, + YS_V1_3 = 15764, + GAR_1 = 15538, + GAR_2 = 15539, + GAR_3 = 15540, + GAR_4 = 15541, + LL_1 = 15585, - // CHAMBER - NEL_1 = 15631, - NEL_2 = 15632, - YSE_1 = 15784, - MAL_1 = 15610, - YS_V2_1 = 15765, + // CHAMBER + NEL_1 = 15631, + NEL_2 = 15632, + YSE_1 = 15784, + MAL_1 = 15610, + YS_V2_1 = 15765, - // ICECROWN - LK_1 = 15598, - LK_2 = 15599, - YS_V3_1 = 15766, - YS_V3_2 = 15767, - IC_1 = 15470, - IC_2 = 15471, + // ICECROWN + LK_1 = 15598, + LK_2 = 15599, + YS_V3_1 = 15766, + YS_V3_2 = 15767, + IC_1 = 15470, + IC_2 = 15471, }; enum Misc { - ACTION_UNSUMMON_CLOUDS = -16, - ACTION_DESPAWN_ADDS = -15, - ACTION_START_SUMMONING = -14, - ACTION_YOGG_SARON_APPEAR = -13, - ACTION_YOGG_SARON_DEATH = -12, - ACTION_YOGG_SARON_START_YELL = -11, - ACTION_YOGG_SARON_OPEN_PORTAL_YELL = -10, - ACTION_INFLUENCE_TENTACLE_DIED = -9, - ACTION_BRAIN_DAMAGED = -8, - ACTION_REMOVE_STUN = -7, - ACTION_YOGG_SARON_START_P3 = -6, - ACTION_YOGG_SARON_HARD_MODE = -5, - ACTION_YOGG_SARON_SHADOW_BEACON = -4, - ACTION_THORIM_START_STORM = -3, - ACTION_FAILED_DRIVE_ME_CRAZY = -2, + ACTION_UNSUMMON_CLOUDS = -16, + ACTION_DESPAWN_ADDS = -15, + ACTION_START_SUMMONING = -14, + ACTION_YOGG_SARON_APPEAR = -13, + ACTION_YOGG_SARON_DEATH = -12, + ACTION_YOGG_SARON_START_YELL = -11, + ACTION_YOGG_SARON_OPEN_PORTAL_YELL = -10, + ACTION_INFLUENCE_TENTACLE_DIED = -9, + ACTION_BRAIN_DAMAGED = -8, + ACTION_REMOVE_STUN = -7, + ACTION_YOGG_SARON_START_P3 = -6, + ACTION_YOGG_SARON_HARD_MODE = -5, + ACTION_YOGG_SARON_SHADOW_BEACON = -4, + ACTION_THORIM_START_STORM = -3, + ACTION_FAILED_DRIVE_ME_CRAZY = -2, - ACTION_ILLUSION_DRAGONS = 1, - ACTION_ILLUSION_ICECROWN = 2, - ACTION_ILLUSION_STORMWIND = 3, + ACTION_ILLUSION_DRAGONS = 1, + ACTION_ILLUSION_ICECROWN = 2, + ACTION_ILLUSION_STORMWIND = 3, - EVENT_PHASE_ONE = 1, - EVENT_PHASE_TWO = 2, - EVENT_PHASE_THREE = 3, + EVENT_PHASE_ONE = 1, + EVENT_PHASE_TWO = 2, + EVENT_PHASE_THREE = 3, - CRITERIA_NOT_GETTING_OLDER = 21001, + CRITERIA_NOT_GETTING_OLDER = 21001, - DATA_GET_KEEPERS_COUNT = 1, - DATA_GET_CURRENT_ILLUSION = 2, - DATA_GET_SARA_PHASE = 3, + DATA_GET_KEEPERS_COUNT = 1, + DATA_GET_CURRENT_ILLUSION = 2, + DATA_GET_SARA_PHASE = 3, }; const Position Middle = {1980.28f, -25.5868f, 329.397f}; @@ -308,548 +308,548 @@ public: return new boss_yoggsaron_saraAI (pCreature); } - struct boss_yoggsaron_saraAI : public ScriptedAI - { - boss_yoggsaron_saraAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) - { - m_pInstance = pCreature->GetInstanceScript(); - } + struct boss_yoggsaron_saraAI : public ScriptedAI + { + boss_yoggsaron_saraAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - InstanceScript* m_pInstance; - EventMap events; - SummonList summons; + InstanceScript* m_pInstance; + EventMap events; + SummonList summons; - uint32 _initFight; - uint64 _keepersGUID[4]; - uint8 _summonedGuardiansCount; - uint32 _p2TalkTimer; - bool _secondPhase; - float _summonSpeed; - uint8 _currentIllusion; - bool _isIllusionReversed; + uint32 _initFight; + uint64 _keepersGUID[4]; + uint8 _summonedGuardiansCount; + uint32 _p2TalkTimer; + bool _secondPhase; + float _summonSpeed; + uint8 _currentIllusion; + bool _isIllusionReversed; - void AttackStart(Unit*) { } - void MoveInLineOfSight(Unit*) { } + void AttackStart(Unit*) { } + void MoveInLineOfSight(Unit*) { } - void JustSummoned(Creature* cr) - { - summons.Summon(cr); - if (cr->GetEntry() >= NPC_FREYA_KEEPER && cr->GetEntry() <= NPC_THORIM_KEEPER) - { - if (cr->GetEntry() == NPC_FREYA_KEEPER) - cr->CastSpell(cr, SPELL_CONJURE_SANITY_WELL, false); - _keepersGUID[cr->GetEntry()-NPC_FREYA_KEEPER] = cr->GetGUID(); - } - else if (cr->GetEntry() == NPC_SANITY_WELL) - cr->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_SCALE, true); - } + void JustSummoned(Creature* cr) + { + summons.Summon(cr); + if (cr->GetEntry() >= NPC_FREYA_KEEPER && cr->GetEntry() <= NPC_THORIM_KEEPER) + { + if (cr->GetEntry() == NPC_FREYA_KEEPER) + cr->CastSpell(cr, SPELL_CONJURE_SANITY_WELL, false); + _keepersGUID[cr->GetEntry()-NPC_FREYA_KEEPER] = cr->GetGUID(); + } + else if (cr->GetEntry() == NPC_SANITY_WELL) + cr->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_SCALE, true); + } - void SpawnClouds() - { - for (uint8 i = 0; i < 6; ++i) - { - float Zplus = i > 2 ? (i-2)*1.6f : 0; - if (i%2) - me->SummonCreature(NPC_OMINOUS_CLOUD, me->GetPositionX()+8+i*7, me->GetPositionY()+8+i*7, 326+Zplus, 0); - else - me->SummonCreature(NPC_OMINOUS_CLOUD, me->GetPositionX()-8-i*7, me->GetPositionY()-8-i*7, 326+Zplus, 0); - } - } + void SpawnClouds() + { + for (uint8 i = 0; i < 6; ++i) + { + float Zplus = i > 2 ? (i-2)*1.6f : 0; + if (i%2) + me->SummonCreature(NPC_OMINOUS_CLOUD, me->GetPositionX()+8+i*7, me->GetPositionY()+8+i*7, 326+Zplus, 0); + else + me->SummonCreature(NPC_OMINOUS_CLOUD, me->GetPositionX()-8-i*7, me->GetPositionY()-8-i*7, 326+Zplus, 0); + } + } - void SpawnWeels() - { - me->SummonCreature(NPC_SANITY_WELL, 2042.56f, -40.3667f, 329.274f, 0.0f); - me->SummonCreature(NPC_SANITY_WELL, 1975.89f, 40.0216f, 331.1f, 0.0f); - me->SummonCreature(NPC_SANITY_WELL, 1987.12f, -91.2702f, 330.186f, 0.0f); - me->SummonCreature(NPC_SANITY_WELL, 1900.48f, -51.2386f, 332.13f, 0.0f); - me->SummonCreature(NPC_SANITY_WELL, 1899.94f, 0.330621f, 332.296f, 0.0f); - } + void SpawnWeels() + { + me->SummonCreature(NPC_SANITY_WELL, 2042.56f, -40.3667f, 329.274f, 0.0f); + me->SummonCreature(NPC_SANITY_WELL, 1975.89f, 40.0216f, 331.1f, 0.0f); + me->SummonCreature(NPC_SANITY_WELL, 1987.12f, -91.2702f, 330.186f, 0.0f); + me->SummonCreature(NPC_SANITY_WELL, 1900.48f, -51.2386f, 332.13f, 0.0f); + me->SummonCreature(NPC_SANITY_WELL, 1899.94f, 0.330621f, 332.296f, 0.0f); + } - void EnterEvadeMode() - { - if (!_EnterEvadeMode()) - return; + void EnterEvadeMode() + { + if (!_EnterEvadeMode()) + return; - Position pos; - pos = me->GetHomePosition(); - me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); - Reset(); - me->setActive(false); - } + Position pos; + pos = me->GetHomePosition(); + me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); + Reset(); + me->setActive(false); + } - void EnableSara(bool apply) - { - if (apply) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->DisableRotate(false); - me->ClearUnitState(UNIT_STATE_ROOT); - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->DisableRotate(true); - me->AddUnitState(UNIT_STATE_ROOT); - } - } + void EnableSara(bool apply) + { + if (apply) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->DisableRotate(false); + me->ClearUnitState(UNIT_STATE_ROOT); + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->DisableRotate(true); + me->AddUnitState(UNIT_STATE_ROOT); + } + } - void Reset() - { - summons.DoAction(ACTION_DESPAWN_ADDS); - events.Reset(); - summons.DespawnAll(); + void Reset() + { + summons.DoAction(ACTION_DESPAWN_ADDS); + events.Reset(); + summons.DespawnAll(); - me->SetVisible(true); - me->SetDisplayId(me->GetNativeDisplayId()); - me->SetDisableGravity(true); - EnableSara(false); - SpawnClouds(); + me->SetVisible(true); + me->SetDisplayId(me->GetNativeDisplayId()); + me->SetDisableGravity(true); + EnableSara(false); + SpawnClouds(); - _initFight = 1; - memset(_keepersGUID, 0, sizeof(_keepersGUID)); - _summonedGuardiansCount = 0; - _p2TalkTimer = 0; - _secondPhase = false; - _summonSpeed = 1.0f; - _currentIllusion = urand(1,3); - _isIllusionReversed = urand(0,1); + _initFight = 1; + memset(_keepersGUID, 0, sizeof(_keepersGUID)); + _summonedGuardiansCount = 0; + _p2TalkTimer = 0; + _secondPhase = false; + _summonSpeed = 1.0f; + _currentIllusion = urand(1,3); + _isIllusionReversed = urand(0,1); - if (m_pInstance) - { - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, CRITERIA_NOT_GETTING_OLDER); - m_pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_SANITY); - m_pInstance->SetData(TYPE_YOGGSARON, NOT_STARTED); - if (GameObject* go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_YOGG_SARON_DOORS))) - go->SetGoState(GO_STATE_ACTIVE); - } - } + if (m_pInstance) + { + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, CRITERIA_NOT_GETTING_OLDER); + m_pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_SANITY); + m_pInstance->SetData(TYPE_YOGGSARON, NOT_STARTED); + if (GameObject* go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_YOGG_SARON_DOORS))) + go->SetGoState(GO_STATE_ACTIVE); + } + } - void InitFight(Unit* target) - { - if (!m_pInstance) - return; + void InitFight(Unit* target) + { + if (!m_pInstance) + return; - // some simple hack checks - if (m_pInstance->GetData(TYPE_VEZAX) != DONE || m_pInstance->GetData(TYPE_XT002) != DONE) - return; + // some simple hack checks + if (m_pInstance->GetData(TYPE_VEZAX) != DONE || m_pInstance->GetData(TYPE_XT002) != DONE) + return; - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, CRITERIA_NOT_GETTING_OLDER); - m_pInstance->SetData(TYPE_YOGGSARON, IN_PROGRESS); - me->SetInCombatWithZone(); - AttackStart(target); + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, CRITERIA_NOT_GETTING_OLDER); + m_pInstance->SetData(TYPE_YOGGSARON, IN_PROGRESS); + me->SetInCombatWithZone(); + AttackStart(target); - me->CastSpell(me, SPELL_SANITY_BASE, true); + me->CastSpell(me, SPELL_SANITY_BASE, true); - SaveKeepers(); + SaveKeepers(); - events.ScheduleEvent(EVENT_SARA_P1_DOORS_CLOSE, 15000, 0, EVENT_PHASE_ONE); - events.ScheduleEvent(EVENT_SARA_P1_BERSERK, 900000, 0, 0); - events.ScheduleEvent(EVENT_SARA_P1_SUMMON, 0, 0, EVENT_PHASE_ONE); - events.SetPhase(EVENT_PHASE_ONE); + events.ScheduleEvent(EVENT_SARA_P1_DOORS_CLOSE, 15000, 0, EVENT_PHASE_ONE); + events.ScheduleEvent(EVENT_SARA_P1_BERSERK, 900000, 0, 0); + events.ScheduleEvent(EVENT_SARA_P1_SUMMON, 0, 0, EVENT_PHASE_ONE); + events.SetPhase(EVENT_PHASE_ONE); - me->MonsterYell("The time to strike at the head of the beast will soon be upon us! Focus your anger and hatred on his minions!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SARA_AGGRO); - me->setActive(true); - } + me->MonsterYell("The time to strike at the head of the beast will soon be upon us! Focus your anger and hatred on his minions!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SARA_AGGRO); + me->setActive(true); + } - void SaveKeepers() - { - for (uint8 i = 0; i < 4; ++i) - if (m_pInstance->GetData(TYPE_WATCHERS) & (1 << i)) - switch (i) - { - case KEEPER_FREYA: - SpawnWeels(); - me->SummonCreature(NPC_FREYA_KEEPER, 1939.32f, 42.165f, 338.415f, 5.17955f); - break; - case KEEPER_HODIR: - me->SummonCreature(NPC_HODIR_KEEPER, 1939.13f, -90.8332f, 338.415f, 1.00123f); - break; - case KEEPER_MIMIRON: - me->SummonCreature(NPC_MIMIRON_KEEPER, 2036.81f, 25.6646f, 338.415f, 3.74227f); - break; - case KEEPER_THORIM: - me->SummonCreature(NPC_THORIM_KEEPER, 2036.59f, -73.8499f, 338.415f, 2.34819f); - break; - } - } + void SaveKeepers() + { + for (uint8 i = 0; i < 4; ++i) + if (m_pInstance->GetData(TYPE_WATCHERS) & (1 << i)) + switch (i) + { + case KEEPER_FREYA: + SpawnWeels(); + me->SummonCreature(NPC_FREYA_KEEPER, 1939.32f, 42.165f, 338.415f, 5.17955f); + break; + case KEEPER_HODIR: + me->SummonCreature(NPC_HODIR_KEEPER, 1939.13f, -90.8332f, 338.415f, 1.00123f); + break; + case KEEPER_MIMIRON: + me->SummonCreature(NPC_MIMIRON_KEEPER, 2036.81f, 25.6646f, 338.415f, 3.74227f); + break; + case KEEPER_THORIM: + me->SummonCreature(NPC_THORIM_KEEPER, 2036.59f, -73.8499f, 338.415f, 2.34819f); + break; + } + } - void InformCloud() - { - Creature* cloud = NULL; - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end();) - { - Creature* summon = ObjectAccessor::GetCreature(*me, *itr); - ++itr; - if (!summon || summon->GetEntry() != NPC_OMINOUS_CLOUD || me->GetDistance(summon) < 20) - continue; + void InformCloud() + { + Creature* cloud = NULL; + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end();) + { + Creature* summon = ObjectAccessor::GetCreature(*me, *itr); + ++itr; + if (!summon || summon->GetEntry() != NPC_OMINOUS_CLOUD || me->GetDistance(summon) < 20) + continue; - if ((!cloud || urand(0,1) && !summon->HasAura(SPELL_SUMMON_GUARDIAN_OF_YS))) - cloud = summon; - } + if ((!cloud || urand(0,1) && !summon->HasAura(SPELL_SUMMON_GUARDIAN_OF_YS))) + cloud = summon; + } - if (cloud) - cloud->AI()->DoAction(ACTION_START_SUMMONING); - } + if (cloud) + cloud->AI()->DoAction(ACTION_START_SUMMONING); + } - void SpawnTentacle(uint32 entry) - { - uint32 dist = urand(38,48); - float o = rand_norm()*M_PI*2; - float Zplus = (dist-38)/6.5f; - if (Creature* cr = me->SummonCreature(entry, me->GetPositionX()+dist*cos(o), me->GetPositionY()+dist*sin(o), 327.2+Zplus, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) - { - cr->CastSpell(cr, SPELL_TENTACLE_ERUPT, true); - cr->CastSpell(cr, SPELL_VOID_ZONE_SMALL, true); - cr->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - } - } + void SpawnTentacle(uint32 entry) + { + uint32 dist = urand(38,48); + float o = rand_norm()*M_PI*2; + float Zplus = (dist-38)/6.5f; + if (Creature* cr = me->SummonCreature(entry, me->GetPositionX()+dist*cos(o), me->GetPositionY()+dist*sin(o), 327.2+Zplus, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) + { + cr->CastSpell(cr, SPELL_TENTACLE_ERUPT, true); + cr->CastSpell(cr, SPELL_VOID_ZONE_SMALL, true); + cr->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); + } + } - void SummonDeathOrbs() - { - for (uint8 i = 0; i < 4; ++i) - { - uint32 dist = urand(38,48); - float o = rand_norm()*M_PI*2; - float Zplus = (dist-38)/6.5f; - me->SummonCreature(NPC_DEATH_ORB, me->GetPositionX()+dist*cos(o), me->GetPositionY()+dist*sin(o), 327.2+Zplus, 0, TEMPSUMMON_TIMED_DESPAWN, 20000); - } - } + void SummonDeathOrbs() + { + for (uint8 i = 0; i < 4; ++i) + { + uint32 dist = urand(38,48); + float o = rand_norm()*M_PI*2; + float Zplus = (dist-38)/6.5f; + me->SummonCreature(NPC_DEATH_ORB, me->GetPositionX()+dist*cos(o), me->GetPositionY()+dist*sin(o), 327.2+Zplus, 0, TEMPSUMMON_TIMED_DESPAWN, 20000); + } + } - void AddPortals() - { - _summonSpeed -= 0.1f; - Creature* cr = NULL; + void AddPortals() + { + _summonSpeed -= 0.1f; + Creature* cr = NULL; - // Spawn Portals - for (uint8 i = 0; i < RAID_MODE(4, 10); ++i) - { - float ang = i ? (M_PI*2.0f/i) : M_PI*2.0f; - if (cr = me->SummonCreature(NPC_DESCEND_INTO_MADNESS, me->GetPositionX()+25*cos(ang), me->GetPositionY()+25*sin(ang), 326, 0, TEMPSUMMON_TIMED_DESPAWN, 15000)) - { - cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE); - cr->SetArmor(_currentIllusion); - } - } + // Spawn Portals + for (uint8 i = 0; i < RAID_MODE(4, 10); ++i) + { + float ang = i ? (M_PI*2.0f/i) : M_PI*2.0f; + if (cr = me->SummonCreature(NPC_DESCEND_INTO_MADNESS, me->GetPositionX()+25*cos(ang), me->GetPositionY()+25*sin(ang), 326, 0, TEMPSUMMON_TIMED_DESPAWN, 15000)) + { + cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE); + cr->SetArmor(_currentIllusion); + } + } - EntryCheckPredicate pred(NPC_BRAIN_OF_YOGG_SARON); - summons.DoAction(_currentIllusion, pred); + EntryCheckPredicate pred(NPC_BRAIN_OF_YOGG_SARON); + summons.DoAction(_currentIllusion, pred); - if (_isIllusionReversed) - _currentIllusion = _currentIllusion == 3 ? 1 : ++_currentIllusion; - else - _currentIllusion = _currentIllusion == 1 ? 3 : --_currentIllusion; - } + if (_isIllusionReversed) + _currentIllusion = _currentIllusion == 3 ? 1 : ++_currentIllusion; + else + _currentIllusion = _currentIllusion == 1 ? 3 : --_currentIllusion; + } - void SpellSounds() - { - if (urand(0,9)) - return; + void SpellSounds() + { + if (urand(0,9)) + return; - if (urand(0,1)) - { - me->MonsterYell(_secondPhase ? "Tremble, mortals, before the coming of the end!" : "Yes! YES! Show them no mercy! Give no pause to your attacks!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(_secondPhase ? SARA_P2_CAST2 : SARA_P1_CAST1); - } - else - { - me->MonsterYell(_secondPhase ? "Suffocate upon your own hate!" : "Let hatred and rage guide your blows!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(_secondPhase ? SARA_P2_CAST1 : SARA_P1_CAST2); - } - } - - void KilledUnit(Unit* who) - { - if (who->GetTypeId() != TYPEID_PLAYER) - return; + if (urand(0,1)) + { + me->MonsterYell(_secondPhase ? "Tremble, mortals, before the coming of the end!" : "Yes! YES! Show them no mercy! Give no pause to your attacks!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(_secondPhase ? SARA_P2_CAST2 : SARA_P1_CAST1); + } + else + { + me->MonsterYell(_secondPhase ? "Suffocate upon your own hate!" : "Let hatred and rage guide your blows!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(_secondPhase ? SARA_P2_CAST1 : SARA_P1_CAST2); + } + } + + void KilledUnit(Unit* who) + { + if (who->GetTypeId() != TYPEID_PLAYER) + return; - if (urand(0,1)) - { - me->MonsterYell("Could they have been saved?", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SARA_P1_KILL2); - } - else - { - me->MonsterYell("Powerless to act...", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SARA_P1_KILL1); - } - } + if (urand(0,1)) + { + me->MonsterYell("Could they have been saved?", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SARA_P1_KILL2); + } + else + { + me->MonsterYell("Powerless to act...", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SARA_P1_KILL1); + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_SANITY) - if (Aura* aur = target->GetAura(SPELL_SANITY)) - aur->SetStackAmount(100); - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_SANITY) + if (Aura* aur = target->GetAura(SPELL_SANITY)) + aur->SetStackAmount(100); + } - uint32 GetData(uint32 param) const - { - if (param == DATA_GET_KEEPERS_COUNT) - { - uint8 _count = 0; - for (uint8 i = 0; i < 4; ++i) - if (_keepersGUID[i]) - ++_count; + uint32 GetData(uint32 param) const + { + if (param == DATA_GET_KEEPERS_COUNT) + { + uint8 _count = 0; + for (uint8 i = 0; i < 4; ++i) + if (_keepersGUID[i]) + ++_count; - return _count; - } - else if (param == DATA_GET_SARA_PHASE) - return _secondPhase; + return _count; + } + else if (param == DATA_GET_SARA_PHASE) + return _secondPhase; - return 4; // just to be sure, return max numer of keepers - } + return 4; // just to be sure, return max numer of keepers + } - void DoAction(int32 param) - { - if (param == ACTION_BRAIN_DAMAGED) - { - summons.DoAction(ACTION_REMOVE_STUN); + void DoAction(int32 param) + { + if (param == ACTION_BRAIN_DAMAGED) + { + summons.DoAction(ACTION_REMOVE_STUN); - EntryCheckPredicate pred2(NPC_YOGG_SARON); - summons.DoAction(ACTION_YOGG_SARON_START_P3, pred2); + EntryCheckPredicate pred2(NPC_YOGG_SARON); + summons.DoAction(ACTION_YOGG_SARON_START_P3, pred2); - EntryCheckPredicate pred3(NPC_THORIM_KEEPER); - summons.DoAction(ACTION_THORIM_START_STORM, pred3); - - if (!(_keepersGUID[0] && _keepersGUID[1] && _keepersGUID[2] && _keepersGUID[3]) && me->GetMap()->Is25ManRaid()) - summons.DoAction(ACTION_YOGG_SARON_HARD_MODE, pred2); + EntryCheckPredicate pred3(NPC_THORIM_KEEPER); + summons.DoAction(ACTION_THORIM_START_STORM, pred3); + + if (!(_keepersGUID[0] && _keepersGUID[1] && _keepersGUID[2] && _keepersGUID[3]) && me->GetMap()->Is25ManRaid()) + summons.DoAction(ACTION_YOGG_SARON_HARD_MODE, pred2); - summons.DespawnEntry(NPC_DEATH_ORB); - events.SetPhase(EVENT_PHASE_THREE); + summons.DespawnEntry(NPC_DEATH_ORB); + events.SetPhase(EVENT_PHASE_THREE); - me->RemoveAllAuras(); - me->SetVisible(false); - return; - } - else if (param == ACTION_YOGG_SARON_DEATH) - { - summons.DespawnEntry(NPC_VOICE_OF_YOGG_SARON); - summons.DespawnEntry(NPC_BRAIN_OF_YOGG_SARON); - summons.DespawnEntry(NPC_MIMIRON_KEEPER); - summons.DespawnEntry(NPC_HODIR_KEEPER); - summons.DespawnEntry(NPC_FREYA_KEEPER); - summons.DespawnEntry(NPC_THORIM_KEEPER); - summons.DespawnEntry(NPC_SANITY_WELL); - Unit::Kill(me, me); - return; - } + me->RemoveAllAuras(); + me->SetVisible(false); + return; + } + else if (param == ACTION_YOGG_SARON_DEATH) + { + summons.DespawnEntry(NPC_VOICE_OF_YOGG_SARON); + summons.DespawnEntry(NPC_BRAIN_OF_YOGG_SARON); + summons.DespawnEntry(NPC_MIMIRON_KEEPER); + summons.DespawnEntry(NPC_HODIR_KEEPER); + summons.DespawnEntry(NPC_FREYA_KEEPER); + summons.DespawnEntry(NPC_THORIM_KEEPER); + summons.DespawnEntry(NPC_SANITY_WELL); + Unit::Kill(me, me); + return; + } - // Determine shatter duration - if (param <= 0) - return; + // Determine shatter duration + if (param <= 0) + return; - // Illusion shatters (param - stun time) - WorldPacket data; - ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, me, NULL, "Illusion shatters and a path to the central chamber opens!"); - me->SendMessageToSetInRange(&data, 500, false); + // Illusion shatters (param - stun time) + WorldPacket data; + ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, me, NULL, "Illusion shatters and a path to the central chamber opens!"); + me->SendMessageToSetInRange(&data, 500, false); - uint32 timer = events.GetNextEventTime(EVENT_SARA_P2_OPEN_PORTALS); - uint32 portalTime = (timer > events.GetTimer() ? timer - events.GetTimer() : 0); - events.DelayEvents(param+100); - events.RescheduleEvent(EVENT_SARA_P2_OPEN_PORTALS, portalTime, 0, EVENT_PHASE_TWO); - events.ScheduleEvent(EVENT_SARA_P2_REMOVE_STUN, param, 0, EVENT_PHASE_TWO); - me->CastSpell(me, SPELL_SHATTERED_ILLUSION, true); - } + uint32 timer = events.GetNextEventTime(EVENT_SARA_P2_OPEN_PORTALS); + uint32 portalTime = (timer > events.GetTimer() ? timer - events.GetTimer() : 0); + events.DelayEvents(param+100); + events.RescheduleEvent(EVENT_SARA_P2_OPEN_PORTALS, portalTime, 0, EVENT_PHASE_TWO); + events.ScheduleEvent(EVENT_SARA_P2_REMOVE_STUN, param, 0, EVENT_PHASE_TWO); + me->CastSpell(me, SPELL_SHATTERED_ILLUSION, true); + } - void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (who && who->GetEntry() == NPC_GUARDIAN_OF_YS && !_secondPhase) - { - damage = 25000; + void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (who && who->GetEntry() == NPC_GUARDIAN_OF_YS && !_secondPhase) + { + damage = 25000; - // START PHASE 2 - if (me->GetHealth() <= damage) - { - _secondPhase = true; - damage = 0; + // START PHASE 2 + if (me->GetHealth() <= damage) + { + _secondPhase = true; + damage = 0; - events.SetPhase(EVENT_PHASE_TWO); - me->SetHealth(me->GetMaxHealth()); + events.SetPhase(EVENT_PHASE_TWO); + me->SetHealth(me->GetMaxHealth()); - if (Creature *cr = me->SummonCreature(NPC_YOGG_SARON, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), M_PI)) - cr->SetVisible(false); + if (Creature *cr = me->SummonCreature(NPC_YOGG_SARON, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), M_PI)) + cr->SetVisible(false); - _p2TalkTimer++; - me->MonsterYell("I am the lucid dream.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(SARA_P2_START); - } - return; - } + _p2TalkTimer++; + me->MonsterYell("I am the lucid dream.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(SARA_P2_START); + } + return; + } - damage = 0; - } + damage = 0; + } - void UpdateAI(uint32 diff) - { - if (_initFight) - { - _initFight += diff; - if (_initFight > 5000) - { - if (Unit* target = SelectTargetFromPlayerList(90)) - { - _initFight = 0; - InitFight(target); - } - else - _initFight = 1; - } - return; - } + void UpdateAI(uint32 diff) + { + if (_initFight) + { + _initFight += diff; + if (_initFight > 5000) + { + if (Unit* target = SelectTargetFromPlayerList(90)) + { + _initFight = 0; + InitFight(target); + } + else + _initFight = 1; + } + return; + } - if (!SelectTargetFromPlayerList(90, SPELL_INSANE1)) - { - m_pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_INSANE1); - EnterEvadeMode(); - return; - } + if (!SelectTargetFromPlayerList(90, SPELL_INSANE1)) + { + m_pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_INSANE1); + EnterEvadeMode(); + return; + } - if (_p2TalkTimer) - { - _p2TalkTimer += diff; - if (_p2TalkTimer >= 4000 && _p2TalkTimer < 20000) - { - EntryCheckPredicate pred(NPC_OMINOUS_CLOUD); - summons.DoAction(ACTION_UNSUMMON_CLOUDS, pred); - me->MonsterYell("The monster in your nightmares.", LANG_UNIVERSAL, 0); - _p2TalkTimer = 20000; - } - else if (_p2TalkTimer >= 25000 && _p2TalkTimer < 40000) - { - summons.DespawnEntry(NPC_OMINOUS_CLOUD); - me->MonsterYell("The fiend of a thousand faces.", LANG_UNIVERSAL, 0); - _p2TalkTimer = 40000; - } - else if (_p2TalkTimer >= 44500 && _p2TalkTimer < 60000) - { - me->MonsterYell("Cower before my true form.", LANG_UNIVERSAL, 0); - _p2TalkTimer = 60000; - } - else if (_p2TalkTimer >= 64000) - { - EntryCheckPredicate pred(NPC_YOGG_SARON); - summons.DoAction(ACTION_YOGG_SARON_START_YELL, pred); - _p2TalkTimer = 0; - events.ScheduleEvent(EVENT_SARA_P2_START, 500, 0, EVENT_PHASE_TWO); - } - return; - } + if (_p2TalkTimer) + { + _p2TalkTimer += diff; + if (_p2TalkTimer >= 4000 && _p2TalkTimer < 20000) + { + EntryCheckPredicate pred(NPC_OMINOUS_CLOUD); + summons.DoAction(ACTION_UNSUMMON_CLOUDS, pred); + me->MonsterYell("The monster in your nightmares.", LANG_UNIVERSAL, 0); + _p2TalkTimer = 20000; + } + else if (_p2TalkTimer >= 25000 && _p2TalkTimer < 40000) + { + summons.DespawnEntry(NPC_OMINOUS_CLOUD); + me->MonsterYell("The fiend of a thousand faces.", LANG_UNIVERSAL, 0); + _p2TalkTimer = 40000; + } + else if (_p2TalkTimer >= 44500 && _p2TalkTimer < 60000) + { + me->MonsterYell("Cower before my true form.", LANG_UNIVERSAL, 0); + _p2TalkTimer = 60000; + } + else if (_p2TalkTimer >= 64000) + { + EntryCheckPredicate pred(NPC_YOGG_SARON); + summons.DoAction(ACTION_YOGG_SARON_START_YELL, pred); + _p2TalkTimer = 0; + events.ScheduleEvent(EVENT_SARA_P2_START, 500, 0, EVENT_PHASE_TWO); + } + return; + } - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case EVENT_SARA_P1_DOORS_CLOSE: - // Whispers of YS - me->SummonCreature(NPC_VOICE_OF_YOGG_SARON, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + switch(events.GetEvent()) + { + case EVENT_SARA_P1_DOORS_CLOSE: + // Whispers of YS + me->SummonCreature(NPC_VOICE_OF_YOGG_SARON, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - if (m_pInstance) - if (GameObject* go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_YOGG_SARON_DOORS))) - go->SetGoState(GO_STATE_READY); + if (m_pInstance) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_YOGG_SARON_DOORS))) + go->SetGoState(GO_STATE_READY); - events.ScheduleEvent(EVENT_SARA_P1_SPELLS, 0, 1, EVENT_PHASE_ONE); - events.PopEvent(); - break; - case EVENT_SARA_P1_SUMMON: - events.RepeatEvent(20000 - (std::min(_summonedGuardiansCount, (uint8)5) * 2000)); - ++_summonedGuardiansCount; - InformCloud(); - break; - case EVENT_SARA_P1_SPELLS: - { - uint32 spell = RAND(SPELL_SARAS_ANGER_TARGET_SELECTOR, SPELL_SARAS_BLESSING_TARGET_SELECTOR, SPELL_SARAS_FAVOR_TARGET_SELECTOR); - me->CastSpell(me, spell, false); - SpellSounds(); - events.RepeatEvent(me->GetMap()->Is25ManRaid() ? urand(0,3000) : 4000+urand(0,2000)); - break; - } - case EVENT_SARA_P2_START: - { - events.PopEvent(); - EntryCheckPredicate pred(NPC_YOGG_SARON); - summons.DoAction(ACTION_YOGG_SARON_APPEAR, pred); - events.RescheduleEvent(EVENT_SARA_P2_SPAWN_START_TENTACLES, 500, 0, EVENT_PHASE_TWO); - - // Spawn Brain! - me->SummonCreature(NPC_BRAIN_OF_YOGG_SARON, 1981.3f, -25.43f, 265); - break; - } - case EVENT_SARA_P2_MALADY: - me->CastCustomSpell(SPELL_MALADY_OF_THE_MIND, SPELLVALUE_MAX_TARGETS, 1, me, false); - events.RepeatEvent(20000); - break; - case EVENT_SARA_P2_PSYCHOSIS: - SpellSounds(); - me->CastCustomSpell(SPELL_PSYCHOSIS, SPELLVALUE_MAX_TARGETS, 1, me, false); - events.RepeatEvent(3500); - break; - case EVENT_SARA_P2_DEATH_RAY: - SummonDeathOrbs(); - events.RepeatEvent(20000); - break; - case EVENT_SARA_P2_SUMMON_T1: // CRUSHER - SpawnTentacle(NPC_CRUSHER_TENTACLE); - events.RepeatEvent((50000+urand(0,10000)) * _summonSpeed); - break; - case EVENT_SARA_P2_SUMMON_T2: // CONSTRICTOR - SpawnTentacle(NPC_CONSTRICTOR_TENTACLE); - events.RepeatEvent((15000+urand(0,5000)) * _summonSpeed); - break; - case EVENT_SARA_P2_SUMMON_T3: // CORRUPTOR - SpawnTentacle(NPC_CORRUPTOR_TENTACLE); - events.RepeatEvent((30000+urand(0,10000)) * _summonSpeed); - break; - case EVENT_SARA_P2_BRAIN_LINK: - me->CastCustomSpell(SPELL_BRAIN_LINK, SPELLVALUE_MAX_TARGETS, 1, me, false); - events.RepeatEvent(30000); - break; - case EVENT_SARA_P2_OPEN_PORTALS: - { - AddPortals(); - EntryCheckPredicate pred(NPC_YOGG_SARON); - summons.DoAction(ACTION_YOGG_SARON_OPEN_PORTAL_YELL, pred); - events.RepeatEvent(80000); - break; - } - case EVENT_SARA_P2_REMOVE_STUN: - { - me->RemoveAura(SPELL_SHATTERED_ILLUSION); - events.PopEvent(); - summons.DoAction(ACTION_REMOVE_STUN); - break; - } - case EVENT_SARA_P2_SPAWN_START_TENTACLES: - events.PopEvent(); + events.ScheduleEvent(EVENT_SARA_P1_SPELLS, 0, 1, EVENT_PHASE_ONE); + events.PopEvent(); + break; + case EVENT_SARA_P1_SUMMON: + events.RepeatEvent(20000 - (std::min(_summonedGuardiansCount, (uint8)5) * 2000)); + ++_summonedGuardiansCount; + InformCloud(); + break; + case EVENT_SARA_P1_SPELLS: + { + uint32 spell = RAND(SPELL_SARAS_ANGER_TARGET_SELECTOR, SPELL_SARAS_BLESSING_TARGET_SELECTOR, SPELL_SARAS_FAVOR_TARGET_SELECTOR); + me->CastSpell(me, spell, false); + SpellSounds(); + events.RepeatEvent(me->GetMap()->Is25ManRaid() ? urand(0,3000) : 4000+urand(0,2000)); + break; + } + case EVENT_SARA_P2_START: + { + events.PopEvent(); + EntryCheckPredicate pred(NPC_YOGG_SARON); + summons.DoAction(ACTION_YOGG_SARON_APPEAR, pred); + events.RescheduleEvent(EVENT_SARA_P2_SPAWN_START_TENTACLES, 500, 0, EVENT_PHASE_TWO); + + // Spawn Brain! + me->SummonCreature(NPC_BRAIN_OF_YOGG_SARON, 1981.3f, -25.43f, 265); + break; + } + case EVENT_SARA_P2_MALADY: + me->CastCustomSpell(SPELL_MALADY_OF_THE_MIND, SPELLVALUE_MAX_TARGETS, 1, me, false); + events.RepeatEvent(20000); + break; + case EVENT_SARA_P2_PSYCHOSIS: + SpellSounds(); + me->CastCustomSpell(SPELL_PSYCHOSIS, SPELLVALUE_MAX_TARGETS, 1, me, false); + events.RepeatEvent(3500); + break; + case EVENT_SARA_P2_DEATH_RAY: + SummonDeathOrbs(); + events.RepeatEvent(20000); + break; + case EVENT_SARA_P2_SUMMON_T1: // CRUSHER + SpawnTentacle(NPC_CRUSHER_TENTACLE); + events.RepeatEvent((50000+urand(0,10000)) * _summonSpeed); + break; + case EVENT_SARA_P2_SUMMON_T2: // CONSTRICTOR + SpawnTentacle(NPC_CONSTRICTOR_TENTACLE); + events.RepeatEvent((15000+urand(0,5000)) * _summonSpeed); + break; + case EVENT_SARA_P2_SUMMON_T3: // CORRUPTOR + SpawnTentacle(NPC_CORRUPTOR_TENTACLE); + events.RepeatEvent((30000+urand(0,10000)) * _summonSpeed); + break; + case EVENT_SARA_P2_BRAIN_LINK: + me->CastCustomSpell(SPELL_BRAIN_LINK, SPELLVALUE_MAX_TARGETS, 1, me, false); + events.RepeatEvent(30000); + break; + case EVENT_SARA_P2_OPEN_PORTALS: + { + AddPortals(); + EntryCheckPredicate pred(NPC_YOGG_SARON); + summons.DoAction(ACTION_YOGG_SARON_OPEN_PORTAL_YELL, pred); + events.RepeatEvent(80000); + break; + } + case EVENT_SARA_P2_REMOVE_STUN: + { + me->RemoveAura(SPELL_SHATTERED_ILLUSION); + events.PopEvent(); + summons.DoAction(ACTION_REMOVE_STUN); + break; + } + case EVENT_SARA_P2_SPAWN_START_TENTACLES: + events.PopEvent(); - me->SetOrientation(M_PI); - me->SetDisplayId(SARA_TRANSFORM_MODEL); + me->SetOrientation(M_PI); + me->SetDisplayId(SARA_TRANSFORM_MODEL); - me->SendMonsterMove(me->GetPositionX(), me->GetPositionY(), 355, 2000, SPLINEFLAG_FLYING); - me->SetPosition(me->GetPositionX(), me->GetPositionY(), 355, me->GetOrientation()); + me->SendMonsterMove(me->GetPositionX(), me->GetPositionY(), 355, 2000, SPLINEFLAG_FLYING); + me->SetPosition(me->GetPositionX(), me->GetPositionY(), 355, me->GetOrientation()); - SpawnTentacle(NPC_CRUSHER_TENTACLE); - SpawnTentacle(NPC_CONSTRICTOR_TENTACLE); - SpawnTentacle(NPC_CORRUPTOR_TENTACLE); - SpawnTentacle(NPC_CORRUPTOR_TENTACLE); + SpawnTentacle(NPC_CRUSHER_TENTACLE); + SpawnTentacle(NPC_CONSTRICTOR_TENTACLE); + SpawnTentacle(NPC_CORRUPTOR_TENTACLE); + SpawnTentacle(NPC_CORRUPTOR_TENTACLE); - events.ScheduleEvent(EVENT_SARA_P2_MALADY, 7000, 0, EVENT_PHASE_TWO); - events.ScheduleEvent(EVENT_SARA_P2_PSYCHOSIS, 3000, 0, EVENT_PHASE_TWO); - events.ScheduleEvent(EVENT_SARA_P2_DEATH_RAY, 15000, 0, EVENT_PHASE_TWO); - events.ScheduleEvent(EVENT_SARA_P2_SUMMON_T1, 50000+urand(0,10000), 0, EVENT_PHASE_TWO); - events.ScheduleEvent(EVENT_SARA_P2_SUMMON_T2, 15000+urand(0,5000) , 0, EVENT_PHASE_TWO); - events.ScheduleEvent(EVENT_SARA_P2_SUMMON_T3, 30000+urand(0,10000), 0, EVENT_PHASE_TWO); - events.ScheduleEvent(EVENT_SARA_P2_BRAIN_LINK, 0, 0, EVENT_PHASE_TWO); - events.ScheduleEvent(EVENT_SARA_P2_OPEN_PORTALS, 60000, 0, EVENT_PHASE_TWO); - break; - case EVENT_SARA_P1_BERSERK: - me->CastSpell(me, SPELL_EXTINGUISH_ALL_LIFE, true); - events.RepeatEvent(5000); - break; - } - } - }; + events.ScheduleEvent(EVENT_SARA_P2_MALADY, 7000, 0, EVENT_PHASE_TWO); + events.ScheduleEvent(EVENT_SARA_P2_PSYCHOSIS, 3000, 0, EVENT_PHASE_TWO); + events.ScheduleEvent(EVENT_SARA_P2_DEATH_RAY, 15000, 0, EVENT_PHASE_TWO); + events.ScheduleEvent(EVENT_SARA_P2_SUMMON_T1, 50000+urand(0,10000), 0, EVENT_PHASE_TWO); + events.ScheduleEvent(EVENT_SARA_P2_SUMMON_T2, 15000+urand(0,5000) , 0, EVENT_PHASE_TWO); + events.ScheduleEvent(EVENT_SARA_P2_SUMMON_T3, 30000+urand(0,10000), 0, EVENT_PHASE_TWO); + events.ScheduleEvent(EVENT_SARA_P2_BRAIN_LINK, 0, 0, EVENT_PHASE_TWO); + events.ScheduleEvent(EVENT_SARA_P2_OPEN_PORTALS, 60000, 0, EVENT_PHASE_TWO); + break; + case EVENT_SARA_P1_BERSERK: + me->CastSpell(me, SPELL_EXTINGUISH_ALL_LIFE, true); + events.RepeatEvent(5000); + break; + } + } + }; }; class boss_yoggsaron_cloud : public CreatureScript @@ -862,90 +862,90 @@ public: return new boss_yoggsaron_cloudAI (pCreature); } - struct boss_yoggsaron_cloudAI : public npc_escortAI - { - boss_yoggsaron_cloudAI(Creature* pCreature) : npc_escortAI(pCreature) - { - InitWaypoint(); - Reset(); - Start(false, true, 0, 0, false, true); - } + struct boss_yoggsaron_cloudAI : public npc_escortAI + { + boss_yoggsaron_cloudAI(Creature* pCreature) : npc_escortAI(pCreature) + { + InitWaypoint(); + Reset(); + Start(false, true, 0, 0, false, true); + } - uint32 _checkTimer; - bool _isSummoning; + uint32 _checkTimer; + bool _isSummoning; - void JustSummoned(Creature *cr) - { - cr->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); + void JustSummoned(Creature *cr) + { + cr->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); - _isSummoning = false; - if (me->GetInstanceScript()) - if (Creature* sara = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(NPC_SARA))) - sara->AI()->JustSummoned(cr); - } + _isSummoning = false; + if (me->GetInstanceScript()) + if (Creature* sara = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(NPC_SARA))) + sara->AI()->JustSummoned(cr); + } - void MoveInLineOfSight(Unit* who) {} - void AttackStart(Unit* who) {} - void WaypointReached(uint32 point) {} + void MoveInLineOfSight(Unit* who) {} + void AttackStart(Unit* who) {} + void WaypointReached(uint32 point) {} - void Reset() - { - me->CastSpell(me, SPELL_CLOUD_VISUAL, true); - _checkTimer = 0; - _isSummoning = false; - } + void Reset() + { + me->CastSpell(me, SPELL_CLOUD_VISUAL, true); + _checkTimer = 0; + _isSummoning = false; + } - void DoAction(int32 param) - { - if (param == ACTION_UNSUMMON_CLOUDS) - { - me->RemoveAllAuras(); - } - else if (param == ACTION_START_SUMMONING) - { - _isSummoning = true; - me->CastSpell(me, SPELL_SUMMON_GUARDIAN_OF_YS, true); - } - } + void DoAction(int32 param) + { + if (param == ACTION_UNSUMMON_CLOUDS) + { + me->RemoveAllAuras(); + } + else if (param == ACTION_START_SUMMONING) + { + _isSummoning = true; + me->CastSpell(me, SPELL_SUMMON_GUARDIAN_OF_YS, true); + } + } - void InitWaypoint() - { - float dist = Middle.GetExactDist(me); - if (me->GetPositionX() > Middle.GetPositionX()) - { - for (uint8 i = 0; i <= dist; ++i) - { - float angle = M_PI*2/dist*i; - AddWaypoint(i, Middle.GetPositionX()+dist*cos(angle), Middle.GetPositionY()+dist*sin(angle), me->GetPositionZ(), 0); - } - } - else - { - for (uint8 i = 0; i <= dist; ++i) - { - float angle = M_PI*2-(M_PI*2/dist*i); - AddWaypoint(i, Middle.GetPositionX()+dist*cos(angle), Middle.GetPositionY()+dist*sin(angle), me->GetPositionZ(), 0); - } - } - } + void InitWaypoint() + { + float dist = Middle.GetExactDist(me); + if (me->GetPositionX() > Middle.GetPositionX()) + { + for (uint8 i = 0; i <= dist; ++i) + { + float angle = M_PI*2/dist*i; + AddWaypoint(i, Middle.GetPositionX()+dist*cos(angle), Middle.GetPositionY()+dist*sin(angle), me->GetPositionZ(), 0); + } + } + else + { + for (uint8 i = 0; i <= dist; ++i) + { + float angle = M_PI*2-(M_PI*2/dist*i); + AddWaypoint(i, Middle.GetPositionX()+dist*cos(angle), Middle.GetPositionY()+dist*sin(angle), me->GetPositionZ(), 0); + } + } + } - void UpdateEscortAI(uint32 diff) - { - _checkTimer += diff; - if (_checkTimer >= 500 && !_isSummoning) - { - Unit* who = me->SelectNearbyTarget(NULL, 6.0f); - if (who && who->GetTypeId() == TYPEID_PLAYER && !me->HasAura(SPELL_SUMMON_GUARDIAN_OF_YS) && !who->HasAura(SPELL_HODIR_FLASH_FREEZE)) - { - _isSummoning = true; - Talk(0, who); - me->CastSpell(me, SPELL_SUMMON_GUARDIAN_OF_YS, true); - } + void UpdateEscortAI(uint32 diff) + { + _checkTimer += diff; + if (_checkTimer >= 500 && !_isSummoning) + { + Unit* who = me->SelectNearbyTarget(NULL, 6.0f); + if (who && who->GetTypeId() == TYPEID_PLAYER && !me->HasAura(SPELL_SUMMON_GUARDIAN_OF_YS) && !who->HasAura(SPELL_HODIR_FLASH_FREEZE)) + { + _isSummoning = true; + Talk(0, who); + me->CastSpell(me, SPELL_SUMMON_GUARDIAN_OF_YS, true); + } - _checkTimer = 0; - } - } - }; + _checkTimer = 0; + } + } + }; }; class boss_yoggsaron_guardian_of_ys : public CreatureScript @@ -958,38 +958,38 @@ public: return new boss_yoggsaron_guardian_of_ysAI (pCreature); } - struct boss_yoggsaron_guardian_of_ysAI : public ScriptedAI - { - boss_yoggsaron_guardian_of_ysAI(Creature* pCreature) : ScriptedAI(pCreature) { } + struct boss_yoggsaron_guardian_of_ysAI : public ScriptedAI + { + boss_yoggsaron_guardian_of_ysAI(Creature* pCreature) : ScriptedAI(pCreature) { } - uint32 _spellTimer; + uint32 _spellTimer; - void Reset() - { - _spellTimer = 0; - me->SetInCombatWithZone(); - } + void Reset() + { + _spellTimer = 0; + me->SetInCombatWithZone(); + } - void JustDied(Unit*) - { - me->CastSpell((Unit*)NULL, SPELL_SHADOW_NOVA, true); - } + void JustDied(Unit*) + { + me->CastSpell((Unit*)NULL, SPELL_SHADOW_NOVA, true); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - _spellTimer += diff; - if (_spellTimer > 8000) - { - me->CastSpell(me, SPELL_DARK_VOLLEY, false); - _spellTimer = 0; - } + _spellTimer += diff; + if (_spellTimer > 8000) + { + me->CastSpell(me, SPELL_DARK_VOLLEY, false); + _spellTimer = 0; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_yoggsaron : public CreatureScript @@ -1002,177 +1002,177 @@ public: return new boss_yoggsaronAI (pCreature); } - struct boss_yoggsaronAI : public ScriptedAI - { - boss_yoggsaronAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) - { - m_pInstance = me->GetInstanceScript(); - _thirdPhase = false; - _usedInsane = false; - summons.DespawnAll(); - events.Reset(); - - uint8 _count = 4; - me->SetLootMode(31); // 1 + 2 + 4 + 8 + 16, remove with watchers addition - if (m_pInstance) - { - for (uint8 i = 0; i < 4; ++i) - if (m_pInstance->GetData(TYPE_WATCHERS) & (1 << i)) - { - me->RemoveLootMode(1<<_count); - --_count; - } - } - } + struct boss_yoggsaronAI : public ScriptedAI + { + boss_yoggsaronAI(Creature* pCreature) : ScriptedAI(pCreature), summons(pCreature) + { + m_pInstance = me->GetInstanceScript(); + _thirdPhase = false; + _usedInsane = false; + summons.DespawnAll(); + events.Reset(); + + uint8 _count = 4; + me->SetLootMode(31); // 1 + 2 + 4 + 8 + 16, remove with watchers addition + if (m_pInstance) + { + for (uint8 i = 0; i < 4; ++i) + if (m_pInstance->GetData(TYPE_WATCHERS) & (1 << i)) + { + me->RemoveLootMode(1<<_count); + --_count; + } + } + } - InstanceScript* m_pInstance; - EventMap events; - SummonList summons; - bool _thirdPhase; - bool _usedInsane; + InstanceScript* m_pInstance; + EventMap events; + SummonList summons; + bool _thirdPhase; + bool _usedInsane; - void AttackStart(Unit*) { } + void AttackStart(Unit*) { } - void JustSummoned(Creature* cr) { summons.Summon(cr); } + void JustSummoned(Creature* cr) { summons.Summon(cr); } - void SummonImmortalGuardian() - { - uint32 dist = urand(38,48); - float o = rand_norm()*M_PI*2; - float Zplus = (dist-38)/6.5f; - me->SummonCreature(NPC_IMMORTAL_GUARDIAN, me->GetPositionX()+dist*cos(o), me->GetPositionY()+dist*sin(o), 327.2+Zplus, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - } + void SummonImmortalGuardian() + { + uint32 dist = urand(38,48); + float o = rand_norm()*M_PI*2; + float Zplus = (dist-38)/6.5f; + me->SummonCreature(NPC_IMMORTAL_GUARDIAN, me->GetPositionX()+dist*cos(o), me->GetPositionY()+dist*sin(o), 327.2+Zplus, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + } - void JustDied(Unit* who) - { - summons.DespawnAll(); - events.Reset(); - - me->MonsterYell("Your fate is sealed. The end of days is finally upon you and ALL who inhabit this miserable little seedling. Uulwi ifis halahs gag erh'ongg w'ssh.", LANG_UNIVERSAL, 0); - me->PlayDirectSound(YS_P3_DEATH); + void JustDied(Unit* who) + { + summons.DespawnAll(); + events.Reset(); + + me->MonsterYell("Your fate is sealed. The end of days is finally upon you and ALL who inhabit this miserable little seedling. Uulwi ifis halahs gag erh'ongg w'ssh.", LANG_UNIVERSAL, 0); + me->PlayDirectSound(YS_P3_DEATH); - if (m_pInstance) - { - m_pInstance->SetData(TYPE_YOGGSARON, DONE); - if (Creature* sara = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_SARA))) - sara->AI()->DoAction(ACTION_YOGG_SARON_DEATH); - if (GameObject* go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_YOGG_SARON_DOORS))) - go->SetGoState(GO_STATE_ACTIVE); - } + if (m_pInstance) + { + m_pInstance->SetData(TYPE_YOGGSARON, DONE); + if (Creature* sara = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(NPC_SARA))) + sara->AI()->DoAction(ACTION_YOGG_SARON_DEATH); + if (GameObject* go = ObjectAccessor::GetGameObject(*me, m_pInstance->GetData64(GO_YOGG_SARON_DOORS))) + go->SetGoState(GO_STATE_ACTIVE); + } - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - itr->GetSource()->RemoveAura(SPELL_SANITY); - itr->GetSource()->RemoveAura(SPELL_INSANE1); - itr->GetSource()->RemoveAura(SPELL_INSANE2); - } - } + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + itr->GetSource()->RemoveAura(SPELL_SANITY); + itr->GetSource()->RemoveAura(SPELL_INSANE1); + itr->GetSource()->RemoveAura(SPELL_INSANE2); + } + } - void DoAction(int32 param) - { - if (param == ACTION_DESPAWN_ADDS) - summons.DespawnAll(); - else if (param == ACTION_YOGG_SARON_APPEAR) - { - me->SetVisible(true); - me->CastSpell(me, SPELL_SHADOW_BARRIER, true); - me->CastSpell(me, SPELL_KNOCK_AWAY, true); - me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - me->SetInCombatWithZone(); + void DoAction(int32 param) + { + if (param == ACTION_DESPAWN_ADDS) + summons.DespawnAll(); + else if (param == ACTION_YOGG_SARON_APPEAR) + { + me->SetVisible(true); + me->CastSpell(me, SPELL_SHADOW_BARRIER, true); + me->CastSpell(me, SPELL_KNOCK_AWAY, true); + me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); + me->SetInCombatWithZone(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_PACIFIED); - } - else if (param == ACTION_YOGG_SARON_START_YELL) - { - me->MonsterYell("BOW DOWN BEFORE THE GOD OF DEATH!", LANG_UNIVERSAL, 0); - } - else if (param == ACTION_YOGG_SARON_OPEN_PORTAL_YELL) - { - me->MonsterYell("MADNESS WILL CONSUME YOU!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(YS_OPEN_PORTALS); - } - else if (param == ACTION_YOGG_SARON_START_P3) - { - me->SetHealth(me->GetMaxHealth()*0.3f); - me->LowerPlayerDamageReq(me->GetMaxHealth()*0.7f); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_PACIFIED); + } + else if (param == ACTION_YOGG_SARON_START_YELL) + { + me->MonsterYell("BOW DOWN BEFORE THE GOD OF DEATH!", LANG_UNIVERSAL, 0); + } + else if (param == ACTION_YOGG_SARON_OPEN_PORTAL_YELL) + { + me->MonsterYell("MADNESS WILL CONSUME YOU!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(YS_OPEN_PORTALS); + } + else if (param == ACTION_YOGG_SARON_START_P3) + { + me->SetHealth(me->GetMaxHealth()*0.3f); + me->LowerPlayerDamageReq(me->GetMaxHealth()*0.7f); - me->RemoveAura(SPELL_SHADOW_BARRIER); - - events.ScheduleEvent(EVENT_YS_LUNATIC_GAZE, 7000); - events.ScheduleEvent(EVENT_YS_SHADOW_BEACON, 20000); - events.ScheduleEvent(EVENT_YS_SUMMON_GUARDIAN, 0); - _thirdPhase = true; + me->RemoveAura(SPELL_SHADOW_BARRIER); + + events.ScheduleEvent(EVENT_YS_LUNATIC_GAZE, 7000); + events.ScheduleEvent(EVENT_YS_SHADOW_BEACON, 20000); + events.ScheduleEvent(EVENT_YS_SUMMON_GUARDIAN, 0); + _thirdPhase = true; - me->MonsterYell("Look upon the true face of death and know that your end comes soon!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(YS_P3_START); - } - else if (param == ACTION_YOGG_SARON_HARD_MODE) - { - events.ScheduleEvent(EVENT_YS_DEAFENING_ROAR, 50000); - } - else if (param == ACTION_YOGG_SARON_SHADOW_BEACON) - { - events.RescheduleEvent(EVENT_YS_SHADOW_BEACON, 40000); - } - else if (param == ACTION_REMOVE_STUN) - { - me->RemoveAura(SPELL_SHATTERED_ILLUSION); - me->SetControlled(true, UNIT_STATE_ROOT); - } - else if (param == ACTION_FAILED_DRIVE_ME_CRAZY) - _usedInsane = true; - } + me->MonsterYell("Look upon the true face of death and know that your end comes soon!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(YS_P3_START); + } + else if (param == ACTION_YOGG_SARON_HARD_MODE) + { + events.ScheduleEvent(EVENT_YS_DEAFENING_ROAR, 50000); + } + else if (param == ACTION_YOGG_SARON_SHADOW_BEACON) + { + events.RescheduleEvent(EVENT_YS_SHADOW_BEACON, 40000); + } + else if (param == ACTION_REMOVE_STUN) + { + me->RemoveAura(SPELL_SHATTERED_ILLUSION); + me->SetControlled(true, UNIT_STATE_ROOT); + } + else if (param == ACTION_FAILED_DRIVE_ME_CRAZY) + _usedInsane = true; + } - uint32 GetData(uint32 param) const - { - if (param == ACTION_FAILED_DRIVE_ME_CRAZY) - return !_usedInsane; + uint32 GetData(uint32 param) const + { + if (param == ACTION_FAILED_DRIVE_ME_CRAZY) + return !_usedInsane; - return 0; - } + return 0; + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_IN_THE_MAWS_OF_THE_OLD_GOD) - me->AddLootMode(32); - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_IN_THE_MAWS_OF_THE_OLD_GOD) + me->AddLootMode(32); + } - void UpdateAI(uint32 diff) - { - if (!_thirdPhase) - return; + void UpdateAI(uint32 diff) + { + if (!_thirdPhase) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_YS_LUNATIC_GAZE: - me->MonsterYell("Hoohehehahahaha... AHAHAHAHAHAHA!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(YS_P3_LUNATIC_GAZE); - me->CastSpell(me, SPELL_LUNATIC_GAZE_YS, true); - events.RepeatEvent(12000); - break; - case EVENT_YS_DEAFENING_ROAR: - me->MonsterTextEmote("Yogg-Saron opens his mouth wide!", 0, true); - me->MonsterYell("Eternal suffering awaits!", LANG_UNIVERSAL, 0); - me->PlayDirectSound(YS_P3_DEAFENING_ROAR); - me->CastSpell(me, SPELL_DEAFENING_ROAR, false); - events.RepeatEvent(50000); - break; - case EVENT_YS_SHADOW_BEACON: - events.RepeatEvent(5000); - me->CastCustomSpell(SPELL_SHADOW_BEACON, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 3), me, false); - break; - case EVENT_YS_SUMMON_GUARDIAN: - SummonImmortalGuardian(); - events.RepeatEvent(10000); - break; - } - } - }; + switch (events.GetEvent()) + { + case EVENT_YS_LUNATIC_GAZE: + me->MonsterYell("Hoohehehahahaha... AHAHAHAHAHAHA!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(YS_P3_LUNATIC_GAZE); + me->CastSpell(me, SPELL_LUNATIC_GAZE_YS, true); + events.RepeatEvent(12000); + break; + case EVENT_YS_DEAFENING_ROAR: + me->MonsterTextEmote("Yogg-Saron opens his mouth wide!", 0, true); + me->MonsterYell("Eternal suffering awaits!", LANG_UNIVERSAL, 0); + me->PlayDirectSound(YS_P3_DEAFENING_ROAR); + me->CastSpell(me, SPELL_DEAFENING_ROAR, false); + events.RepeatEvent(50000); + break; + case EVENT_YS_SHADOW_BEACON: + events.RepeatEvent(5000); + me->CastCustomSpell(SPELL_SHADOW_BEACON, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 3), me, false); + break; + case EVENT_YS_SUMMON_GUARDIAN: + SummonImmortalGuardian(); + events.RepeatEvent(10000); + break; + } + } + }; }; class boss_yoggsaron_brain : public CreatureScript @@ -1185,224 +1185,224 @@ public: return new boss_yoggsaron_brainAI (pCreature); } - struct boss_yoggsaron_brainAI : public NullCreatureAI - { - boss_yoggsaron_brainAI(Creature* pCreature) : NullCreatureAI(pCreature), summons(pCreature) - { - me->SetDisableGravity(true); - _tentacleCount = 0; - _activeIllusion = 0; - _induceTimer = 0; - _brainDamaged = false; - me->SetRegeneratingHealth(false); - } + struct boss_yoggsaron_brainAI : public NullCreatureAI + { + boss_yoggsaron_brainAI(Creature* pCreature) : NullCreatureAI(pCreature), summons(pCreature) + { + me->SetDisableGravity(true); + _tentacleCount = 0; + _activeIllusion = 0; + _induceTimer = 0; + _brainDamaged = false; + me->SetRegeneratingHealth(false); + } - bool _brainDamaged; - uint8 _tentacleCount; - uint8 _activeIllusion; - uint32 _induceTimer; - SummonList summons; + bool _brainDamaged; + uint8 _tentacleCount; + uint8 _activeIllusion; + uint32 _induceTimer; + SummonList summons; - void Reset() { } - void JustSummoned(Creature* cr) - { - if (cr->GetEntry() == NPC_INFLUENCE_TENTACLE) - { - // Dragons Illusion - if (cr->GetPositionX() > 2000.0f && cr->GetPositionX() < 2150.0f) - cr->UpdateEntry(urand(NPC_CONSORT_FIRST, NPC_CONSORT_LAST)); - // Icecrown Illusion - else if (cr->GetPositionY() > -150.0f && cr->GetPositionY() < -90.0f) - { - cr->SetStandState(UNIT_STAND_STATE_KNEEL); - cr->UpdateEntry(NPC_DEATHSWORN_ZEALOT); - } - // Stormwind Illusion - else - cr->UpdateEntry(NPC_SUIT_OF_ARMOR); - } - else if (cr->GetEntry() == NPC_LICH_KING) - cr->CastSpell(cr, SPELL_DEATHGRASP, false); + void Reset() { } + void JustSummoned(Creature* cr) + { + if (cr->GetEntry() == NPC_INFLUENCE_TENTACLE) + { + // Dragons Illusion + if (cr->GetPositionX() > 2000.0f && cr->GetPositionX() < 2150.0f) + cr->UpdateEntry(urand(NPC_CONSORT_FIRST, NPC_CONSORT_LAST)); + // Icecrown Illusion + else if (cr->GetPositionY() > -150.0f && cr->GetPositionY() < -90.0f) + { + cr->SetStandState(UNIT_STAND_STATE_KNEEL); + cr->UpdateEntry(NPC_DEATHSWORN_ZEALOT); + } + // Stormwind Illusion + else + cr->UpdateEntry(NPC_SUIT_OF_ARMOR); + } + else if (cr->GetEntry() == NPC_LICH_KING) + cr->CastSpell(cr, SPELL_DEATHGRASP, false); - summons.Summon(cr); - } + summons.Summon(cr); + } - void PrepareChamberIllusion() - { - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2126.13f, -65.488f, 239.721f, 1.99171f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2141.05f, -50.5146f, 239.751f, 2.72998f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2148.83f, -23.9568f, 239.721f, 3.04807f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2064.39f, -42.0691f, 239.719f, 0.0949586f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2064.29f, -7.13128f, 239.756f, 5.96974f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2117.31f, 14.897f, 239.731f, 4.32041f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2136.7f, 2.43262f, 239.72f, 3.90023f); + void PrepareChamberIllusion() + { + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2126.13f, -65.488f, 239.721f, 1.99171f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2141.05f, -50.5146f, 239.751f, 2.72998f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2148.83f, -23.9568f, 239.721f, 3.04807f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2064.39f, -42.0691f, 239.719f, 0.0949586f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2064.29f, -7.13128f, 239.756f, 5.96974f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2117.31f, 14.897f, 239.731f, 4.32041f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 2136.7f, 2.43262f, 239.72f, 3.90023f); - // Laughing Skulls - if (urand(0,1)) - me->SummonCreature(NPC_LAUGHING_SKULL, 2139.13f, -59.0848f, 239.728f, 2.2974f); - else - me->SummonCreature(NPC_LAUGHING_SKULL, 2083, -25.66f, 244, 0); - if (urand(0,1)) - me->SummonCreature(NPC_LAUGHING_SKULL, 2066.67f, -59.8984f, 239.72f, 0.718747f); - else - me->SummonCreature(NPC_LAUGHING_SKULL, 2126.22f, -25.86f, 244, 0); + // Laughing Skulls + if (urand(0,1)) + me->SummonCreature(NPC_LAUGHING_SKULL, 2139.13f, -59.0848f, 239.728f, 2.2974f); + else + me->SummonCreature(NPC_LAUGHING_SKULL, 2083, -25.66f, 244, 0); + if (urand(0,1)) + me->SummonCreature(NPC_LAUGHING_SKULL, 2066.67f, -59.8984f, 239.72f, 0.718747f); + else + me->SummonCreature(NPC_LAUGHING_SKULL, 2126.22f, -25.86f, 244, 0); - me->SummonCreature(NPC_LAUGHING_SKULL, 2133.09f, 15.341f, 239.72f, 4.0724f); - me->SummonCreature(NPC_LAUGHING_SKULL, 2065.83f, 12.3772f, 239.792f, 5.49789f); - - // Aspects - me->SummonCreature(NPC_ALEXTRASZA, 2091.92f, -25.8f, 242.647f, 0); - me->SummonCreature(NPC_YSERA, 2116, -25.8f, 242.647f, 3.14f); - me->SummonCreature(NPC_NELTHARION, 2103.6f, -35.8f, 242.64f, 1.5f); - me->SummonCreature(NPC_MALYGOS, 2103.6f, -15.8f, 242.64f, 4.7f); - } + me->SummonCreature(NPC_LAUGHING_SKULL, 2133.09f, 15.341f, 239.72f, 4.0724f); + me->SummonCreature(NPC_LAUGHING_SKULL, 2065.83f, 12.3772f, 239.792f, 5.49789f); + + // Aspects + me->SummonCreature(NPC_ALEXTRASZA, 2091.92f, -25.8f, 242.647f, 0); + me->SummonCreature(NPC_YSERA, 2116, -25.8f, 242.647f, 3.14f); + me->SummonCreature(NPC_NELTHARION, 2103.6f, -35.8f, 242.64f, 1.5f); + me->SummonCreature(NPC_MALYGOS, 2103.6f, -15.8f, 242.64f, 4.7f); + } - void PrepareIceCrownIllusion() - { - // Laughing Skulls - me->SummonCreature(NPC_LAUGHING_SKULL, 1931.12f, -92.702f, 239.991f, 5.2819f); - if (urand(0,1)) - me->SummonCreature(NPC_LAUGHING_SKULL, 1969.88f, -147.729f, 239.991f, 2.37593f); - else - me->SummonCreature(NPC_LAUGHING_SKULL, 1878, -93.3f, 240, 0); - if (urand(0,1)) - me->SummonCreature(NPC_LAUGHING_SKULL, 1950.78f, -167.902f, 239.991f, 2.34844f); - else - me->SummonCreature(NPC_LAUGHING_SKULL, 1938.45f, -116.5f, 240, 0); - if (urand(0,1)) - me->SummonCreature(NPC_LAUGHING_SKULL, 1896.45f, -141.469f, 239.991f, 6.12227f); - else - me->SummonCreature(NPC_LAUGHING_SKULL, 1921, -158, 240, 0); + void PrepareIceCrownIllusion() + { + // Laughing Skulls + me->SummonCreature(NPC_LAUGHING_SKULL, 1931.12f, -92.702f, 239.991f, 5.2819f); + if (urand(0,1)) + me->SummonCreature(NPC_LAUGHING_SKULL, 1969.88f, -147.729f, 239.991f, 2.37593f); + else + me->SummonCreature(NPC_LAUGHING_SKULL, 1878, -93.3f, 240, 0); + if (urand(0,1)) + me->SummonCreature(NPC_LAUGHING_SKULL, 1950.78f, -167.902f, 239.991f, 2.34844f); + else + me->SummonCreature(NPC_LAUGHING_SKULL, 1938.45f, -116.5f, 240, 0); + if (urand(0,1)) + me->SummonCreature(NPC_LAUGHING_SKULL, 1896.45f, -141.469f, 239.991f, 6.12227f); + else + me->SummonCreature(NPC_LAUGHING_SKULL, 1921, -158, 240, 0); - // Influence - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1958.29f, -128.65f, 239.99f, 3.61293f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1957.78f, -134.368f, 239.99f, 3.35375f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1953.04f, -137.843f, 239.99f, 3.55796f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1900.31f, -93.5241f, 239.99f, 4.50043f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1895.03f, -98.0773f, 239.99f, 4.88135f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1895.19f, -104.587f, 239.99f, 5.02271f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1923.31f, -125.98f, 240, 4.2f); + // Influence + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1958.29f, -128.65f, 239.99f, 3.61293f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1957.78f, -134.368f, 239.99f, 3.35375f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1953.04f, -137.843f, 239.99f, 3.55796f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1900.31f, -93.5241f, 239.99f, 4.50043f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1895.03f, -98.0773f, 239.99f, 4.88135f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1895.19f, -104.587f, 239.99f, 5.02271f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1923.31f, -125.98f, 240, 4.2f); - // Others - me->SummonCreature(NPC_LICH_KING, 1906.98f, -153, 240, 4.2f); - me->SummonCreature(NPC_IMMOLATED_CHAMPION, 1902.03f, -161.7f, 240, 1.07f); - } + // Others + me->SummonCreature(NPC_LICH_KING, 1906.98f, -153, 240, 4.2f); + me->SummonCreature(NPC_IMMOLATED_CHAMPION, 1902.03f, -161.7f, 240, 1.07f); + } - void PrepareStormwindIllusion() - { - // Laughing Skulls - if (urand(0,1)) - me->SummonCreature(NPC_LAUGHING_SKULL, 1916.36f, 28.05f, 239.666f, 1.30238f); - else - me->SummonCreature(NPC_LAUGHING_SKULL, 1966.7f, 57.8f, 239.66f, 0); - if (urand(0,1)) - me->SummonCreature(NPC_LAUGHING_SKULL, 1902, 75.1362f, 239.666f, 6.06189f); - else - me->SummonCreature(NPC_LAUGHING_SKULL, 1933, 91, 240, 0); - me->SummonCreature(NPC_LAUGHING_SKULL, 1914.42f, 90.8465f, 239.666f, 5.25294f); - me->SummonCreature(NPC_LAUGHING_SKULL, 1963.68f, 89.7549f, 239.667f, 3.70571f); + void PrepareStormwindIllusion() + { + // Laughing Skulls + if (urand(0,1)) + me->SummonCreature(NPC_LAUGHING_SKULL, 1916.36f, 28.05f, 239.666f, 1.30238f); + else + me->SummonCreature(NPC_LAUGHING_SKULL, 1966.7f, 57.8f, 239.66f, 0); + if (urand(0,1)) + me->SummonCreature(NPC_LAUGHING_SKULL, 1902, 75.1362f, 239.666f, 6.06189f); + else + me->SummonCreature(NPC_LAUGHING_SKULL, 1933, 91, 240, 0); + me->SummonCreature(NPC_LAUGHING_SKULL, 1914.42f, 90.8465f, 239.666f, 5.25294f); + me->SummonCreature(NPC_LAUGHING_SKULL, 1963.68f, 89.7549f, 239.667f, 3.70571f); - // Influence - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1931.41f, 39.0711f, 239.66f, 1.82467f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1908.67f, 45.5867f, 239.666f, 0.72119f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1897.68f, 66.1274f, 239.666f, 6.27395f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1950.73f, 49.3446f, 239.666f, 2.63756f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1923.16f, 97.5586f, 239.666f, 4.74635f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1956.16f, 72.1403f, 239.666f, 3.19518f); - me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1944.81f, 92.3154f, 239.666f, 4.03556f); + // Influence + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1931.41f, 39.0711f, 239.66f, 1.82467f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1908.67f, 45.5867f, 239.666f, 0.72119f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1897.68f, 66.1274f, 239.666f, 6.27395f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1950.73f, 49.3446f, 239.666f, 2.63756f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1923.16f, 97.5586f, 239.666f, 4.74635f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1956.16f, 72.1403f, 239.666f, 3.19518f); + me->SummonCreature(NPC_INFLUENCE_TENTACLE, 1944.81f, 92.3154f, 239.666f, 4.03556f); - // Others - me->SummonCreature(NPC_GARONA, 1928.58f, 65.64f, 242.37f, 2.1f); - me->SummonCreature(NPC_KING_LLANE, 1925.14f, 71.74f, 242.37f, 5.17f); - } + // Others + me->SummonCreature(NPC_GARONA, 1928.58f, 65.64f, 242.37f, 2.1f); + me->SummonCreature(NPC_KING_LLANE, 1925.14f, 71.74f, 242.37f, 5.17f); + } - void DoAction(int32 param) - { - if (param == ACTION_DESPAWN_ADDS) - { - summons.DespawnAll(); - return; - } - else if (param == ACTION_INFLUENCE_TENTACLE_DIED) - { - _tentacleCount++; - if (_tentacleCount >= 7 /*TENTACLES COUNT*/) - { - // Stun - if (me->GetInstanceScript()) - if(Creature* sara = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(NPC_SARA))) - sara->AI()->DoAction(MINUTE*IN_MILLISECONDS-std::min((uint32)MINUTE*IN_MILLISECONDS, _induceTimer)); + void DoAction(int32 param) + { + if (param == ACTION_DESPAWN_ADDS) + { + summons.DespawnAll(); + return; + } + else if (param == ACTION_INFLUENCE_TENTACLE_DIED) + { + _tentacleCount++; + if (_tentacleCount >= 7 /*TENTACLES COUNT*/) + { + // Stun + if (me->GetInstanceScript()) + if(Creature* sara = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(NPC_SARA))) + sara->AI()->DoAction(MINUTE*IN_MILLISECONDS-std::min((uint32)MINUTE*IN_MILLISECONDS, _induceTimer)); - _induceTimer = 0; - summons.DespawnEntry(NPC_LAUGHING_SKULL); - if (GameObject* go = me->FindNearestGameObject(GO_CHAMBER_ILLUSION_DOORS+_activeIllusion, 150.0f)) - go->SetGoState(GO_STATE_ACTIVE); - } - return; - } - else if (param == ACTION_REMOVE_STUN) - return; + _induceTimer = 0; + summons.DespawnEntry(NPC_LAUGHING_SKULL); + if (GameObject* go = me->FindNearestGameObject(GO_CHAMBER_ILLUSION_DOORS+_activeIllusion, 150.0f)) + go->SetGoState(GO_STATE_ACTIVE); + } + return; + } + else if (param == ACTION_REMOVE_STUN) + return; - summons.DespawnAll(); - switch(param) - { - case ACTION_ILLUSION_STORMWIND: PrepareStormwindIllusion(); break; - case ACTION_ILLUSION_DRAGONS: PrepareChamberIllusion(); break; - case ACTION_ILLUSION_ICECROWN: PrepareIceCrownIllusion(); break; - } + summons.DespawnAll(); + switch(param) + { + case ACTION_ILLUSION_STORMWIND: PrepareStormwindIllusion(); break; + case ACTION_ILLUSION_DRAGONS: PrepareChamberIllusion(); break; + case ACTION_ILLUSION_ICECROWN: PrepareIceCrownIllusion(); break; + } - for (uint32 i = GO_CHAMBER_ILLUSION_DOORS; i <= GO_STORMWIND_ILLUSION_DOORS; ++i) - if (GameObject* go = me->FindNearestGameObject(i, 150.0f)) - go->SetGoState(GO_STATE_READY); + for (uint32 i = GO_CHAMBER_ILLUSION_DOORS; i <= GO_STORMWIND_ILLUSION_DOORS; ++i) + if (GameObject* go = me->FindNearestGameObject(i, 150.0f)) + go->SetGoState(GO_STATE_READY); - _activeIllusion = param-1; - _tentacleCount = 0; - _induceTimer = 1; + _activeIllusion = param-1; + _tentacleCount = 0; + _induceTimer = 1; - me->CastSpell(me, SPELL_INDUCE_MADNESS, false); - } + me->CastSpell(me, SPELL_INDUCE_MADNESS, false); + } - uint32 GetData(uint32 param) const - { - if (param == DATA_GET_CURRENT_ILLUSION) - return _activeIllusion+1; + uint32 GetData(uint32 param) const + { + if (param == DATA_GET_CURRENT_ILLUSION) + return _activeIllusion+1; - return 0; - } + return 0; + } - void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (_tentacleCount < 7) // if all tentacles aren't killed - { - damage = 0; - if (who) - Unit::Kill(who, who); - return; - } + void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (_tentacleCount < 7) // if all tentacles aren't killed + { + damage = 0; + if (who) + Unit::Kill(who, who); + return; + } - if (!_brainDamaged) - { - // START PHASE 3 - if (me->HealthBelowPctDamaged(30, damage)) - { - me->SetRegeneratingHealth(false); - _EnterEvadeMode(); - _brainDamaged = true; + if (!_brainDamaged) + { + // START PHASE 3 + if (me->HealthBelowPctDamaged(30, damage)) + { + me->SetRegeneratingHealth(false); + _EnterEvadeMode(); + _brainDamaged = true; - me->CastSpell(me, SPELL_BRAIN_HURT_VISUAL, true); - if (me->GetInstanceScript()) - if(Creature* sara = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(NPC_SARA))) - sara->AI()->DoAction(ACTION_BRAIN_DAMAGED); - } - } - } + me->CastSpell(me, SPELL_BRAIN_HURT_VISUAL, true); + if (me->GetInstanceScript()) + if(Creature* sara = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(NPC_SARA))) + sara->AI()->DoAction(ACTION_BRAIN_DAMAGED); + } + } + } - void UpdateAI(uint32 diff) - { - if (_induceTimer) - _induceTimer += diff; - } - }; + void UpdateAI(uint32 diff) + { + if (_induceTimer) + _induceTimer += diff; + } + }; }; class boss_yoggsaron_death_orb : public CreatureScript @@ -1415,34 +1415,34 @@ public: return new boss_yoggsaron_death_orbAI (pCreature); } - struct boss_yoggsaron_death_orbAI : public NullCreatureAI - { - boss_yoggsaron_death_orbAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - me->CastSpell(me, SPELL_DEATH_RAY_WARNING, true); - _startTimer = 1; - } + struct boss_yoggsaron_death_orbAI : public NullCreatureAI + { + boss_yoggsaron_death_orbAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + me->CastSpell(me, SPELL_DEATH_RAY_WARNING, true); + _startTimer = 1; + } - uint32 _startTimer; + uint32 _startTimer; - void UpdateAI(uint32 diff) - { - if (_startTimer) - { - _startTimer += diff; - if (_startTimer > 4000) - { - me->CastSpell(me, SPELL_DEATH_RAY_DAMAGE_VISUAL, true); - me->CastSpell(me, SPELL_DEATH_RAY_DAMAGE, true); - - _startTimer = 0; - me->SetSpeed(MOVE_WALK, 2); - me->SetSpeed(MOVE_RUN, 2); - me->GetMotionMaster()->MoveRandom(20.0f); - } - } - } - }; + void UpdateAI(uint32 diff) + { + if (_startTimer) + { + _startTimer += diff; + if (_startTimer > 4000) + { + me->CastSpell(me, SPELL_DEATH_RAY_DAMAGE_VISUAL, true); + me->CastSpell(me, SPELL_DEATH_RAY_DAMAGE, true); + + _startTimer = 0; + me->SetSpeed(MOVE_WALK, 2); + me->SetSpeed(MOVE_RUN, 2); + me->GetMotionMaster()->MoveRandom(20.0f); + } + } + } + }; }; class boss_yoggsaron_crusher_tentacle : public CreatureScript @@ -1455,56 +1455,56 @@ public: return new boss_yoggsaron_crusher_tentacleAI (pCreature); } - struct boss_yoggsaron_crusher_tentacleAI : public ScriptedAI - { - boss_yoggsaron_crusher_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature) + struct boss_yoggsaron_crusher_tentacleAI : public ScriptedAI + { + boss_yoggsaron_crusher_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature) { SetCombatMovement(false); - me->CastSpell(me, SPELL_CRUSH, true); - me->CastSpell(me, SPELL_FOCUSED_ANGER, true); - me->CastSpell(me, SPELL_DIMINISH_POWER, false); - } + me->CastSpell(me, SPELL_CRUSH, true); + me->CastSpell(me, SPELL_FOCUSED_ANGER, true); + me->CastSpell(me, SPELL_DIMINISH_POWER, false); + } - void Reset() - { - me->SetInCombatWithZone(); - } + void Reset() + { + me->SetInCombatWithZone(); + } - void DamageTaken(Unit* who, uint32&, DamageEffectType damagetype, SpellSchoolMask) - { - if (who && damagetype == DIRECT_DAMAGE) - { - DoResetThreat(); - me->AddThreat(who, 100000); - AttackStart(who); - me->InterruptNonMeleeSpells(false); - } - } + void DamageTaken(Unit* who, uint32&, DamageEffectType damagetype, SpellSchoolMask) + { + if (who && damagetype == DIRECT_DAMAGE) + { + DoResetThreat(); + me->AddThreat(who, 100000); + AttackStart(who); + me->InterruptNonMeleeSpells(false); + } + } - void DoAction(int32 param) - { - if (param == ACTION_REMOVE_STUN) - me->RemoveAura(SPELL_SHATTERED_ILLUSION); - } + void DoAction(int32 param) + { + if (param == ACTION_REMOVE_STUN) + me->RemoveAura(SPELL_SHATTERED_ILLUSION); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if (me->IsWithinMeleeRange(me->GetVictim())) - { - DoMeleeAttackIfReady(); - return; - } + if (me->IsWithinMeleeRange(me->GetVictim())) + { + DoMeleeAttackIfReady(); + return; + } - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - me->CastSpell(me, SPELL_DIMINISH_POWER, false); - DoResetThreat(); - } - }; + me->CastSpell(me, SPELL_DIMINISH_POWER, false); + DoResetThreat(); + } + }; }; class boss_yoggsaron_corruptor_tentacle : public CreatureScript @@ -1517,51 +1517,51 @@ public: return new boss_yoggsaron_corruptor_tentacleAI (pCreature); } - struct boss_yoggsaron_corruptor_tentacleAI : public ScriptedAI - { - boss_yoggsaron_corruptor_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature) + struct boss_yoggsaron_corruptor_tentacleAI : public ScriptedAI + { + boss_yoggsaron_corruptor_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature) { SetCombatMovement(false); - } + } - void DoAction(int32 param) - { - if (param == ACTION_REMOVE_STUN) - me->RemoveAura(SPELL_SHATTERED_ILLUSION); - } + void DoAction(int32 param) + { + if (param == ACTION_REMOVE_STUN) + me->RemoveAura(SPELL_SHATTERED_ILLUSION); + } - Unit* SelectCorruptionTarget() - { - Player* target = NULL; - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - uint8 num = urand(0, pList.getSize()-1); - uint8 count = 0; - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr, ++count) - { - if (me->GetDistance(itr->GetSource()) > 200 || itr->GetSource()->GetPositionZ() < 300 || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) - continue; + Unit* SelectCorruptionTarget() + { + Player* target = NULL; + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + uint8 num = urand(0, pList.getSize()-1); + uint8 count = 0; + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr, ++count) + { + if (me->GetDistance(itr->GetSource()) > 200 || itr->GetSource()->GetPositionZ() < 300 || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) + continue; - if (count <= num || !target) - target = itr->GetSource(); - else - break; - } + if (count <= num || !target) + target = itr->GetSource(); + else + break; + } - return target; - } + return target; + } - void UpdateAI(uint32 diff) - { - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + void UpdateAI(uint32 diff) + { + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (Unit* target = SelectCorruptionTarget()) - { - uint32 spellid = RAND(SPELL_APATHY, SPELL_BLACK_PLAGUE, SPELL_DRAINING_POISON, SPELL_CURSE_OF_DOOM); - me->CastSpell(target, spellid, false); - } - } - }; + if (Unit* target = SelectCorruptionTarget()) + { + uint32 spellid = RAND(SPELL_APATHY, SPELL_BLACK_PLAGUE, SPELL_DRAINING_POISON, SPELL_CURSE_OF_DOOM); + me->CastSpell(target, spellid, false); + } + } + }; }; class boss_yoggsaron_constrictor_tentacle : public CreatureScript @@ -1574,73 +1574,73 @@ public: return new boss_yoggsaron_constrictor_tentacleAI (pCreature); } - struct boss_yoggsaron_constrictor_tentacleAI : public ScriptedAI - { - boss_yoggsaron_constrictor_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature) + struct boss_yoggsaron_constrictor_tentacleAI : public ScriptedAI + { + boss_yoggsaron_constrictor_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature) { SetCombatMovement(false); - _checkTimer = 1; - _playerGUID = 0; - } + _checkTimer = 1; + _playerGUID = 0; + } - uint32 _checkTimer; - uint64 _playerGUID; + uint32 _checkTimer; + uint64 _playerGUID; - Unit* SelectConstrictTarget() - { - Player *target = NULL; - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - uint8 num = urand(0, pList.getSize()-1); - uint8 count = 0; - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr, ++count) - { - if (me->GetDistance(itr->GetSource()) > 10 || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) - continue; - if (itr->GetSource()->HasAura(SPELL_SQUEEZE) || itr->GetSource()->HasAura(SPELL_INSANE1)) - continue; + Unit* SelectConstrictTarget() + { + Player *target = NULL; + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + uint8 num = urand(0, pList.getSize()-1); + uint8 count = 0; + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr, ++count) + { + if (me->GetDistance(itr->GetSource()) > 10 || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) + continue; + if (itr->GetSource()->HasAura(SPELL_SQUEEZE) || itr->GetSource()->HasAura(SPELL_INSANE1)) + continue; - if (count <= num || !target) - target = itr->GetSource(); - else - break; - } + if (count <= num || !target) + target = itr->GetSource(); + else + break; + } - return target; - } + return target; + } - void UpdateAI(uint32 diff) - { - if (_checkTimer) - { - _checkTimer += diff; - if (_checkTimer >= 1000 && !me->HasUnitState(UNIT_STATE_STUNNED)) - { - if (Unit* target = SelectConstrictTarget()) - { - target->CastSpell(me, SPELL_LUNGE, true); - target->CastSpell(target, SPELL_SQUEEZE, true); - _playerGUID = target->GetGUID(); - _checkTimer = 0; - return; - } + void UpdateAI(uint32 diff) + { + if (_checkTimer) + { + _checkTimer += diff; + if (_checkTimer >= 1000 && !me->HasUnitState(UNIT_STATE_STUNNED)) + { + if (Unit* target = SelectConstrictTarget()) + { + target->CastSpell(me, SPELL_LUNGE, true); + target->CastSpell(target, SPELL_SQUEEZE, true); + _playerGUID = target->GetGUID(); + _checkTimer = 0; + return; + } - _checkTimer = 1; - } - } - } + _checkTimer = 1; + } + } + } - void DoAction(int32 param) - { - if (param == ACTION_REMOVE_STUN) - me->RemoveAura(SPELL_SHATTERED_ILLUSION); - } + void DoAction(int32 param) + { + if (param == ACTION_REMOVE_STUN) + me->RemoveAura(SPELL_SHATTERED_ILLUSION); + } - void JustDied(Unit*) - { - if (Unit* player = ObjectAccessor::GetUnit(*me, _playerGUID)) - player->RemoveAura(SPELL_SQUEEZE); - } - }; + void JustDied(Unit*) + { + if (Unit* player = ObjectAccessor::GetUnit(*me, _playerGUID)) + player->RemoveAura(SPELL_SQUEEZE); + } + }; }; class boss_yoggsaron_keeper : public CreatureScript @@ -1653,42 +1653,42 @@ public: return new boss_yoggsaron_keeperAI (pCreature); } - struct boss_yoggsaron_keeperAI : public NullCreatureAI - { - boss_yoggsaron_keeperAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - _checkTimer = 0; - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_SCALE, true); - } + struct boss_yoggsaron_keeperAI : public NullCreatureAI + { + boss_yoggsaron_keeperAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + _checkTimer = 0; + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_SCALE, true); + } - uint32 _checkTimer; + uint32 _checkTimer; - void DoAction(int32 param) - { - if (me->GetEntry() == NPC_THORIM_KEEPER && param == ACTION_THORIM_START_STORM) - me->CastSpell(me, SPELL_TITANIC_STORM_PASSIVE, false); - } + void DoAction(int32 param) + { + if (me->GetEntry() == NPC_THORIM_KEEPER && param == ACTION_THORIM_START_STORM) + me->CastSpell(me, SPELL_TITANIC_STORM_PASSIVE, false); + } - void UpdateAI(uint32 diff) - { - if (me->GetInstanceScript()) - if (me->GetInstanceScript()->GetData(TYPE_YOGGSARON) != IN_PROGRESS) - return; + void UpdateAI(uint32 diff) + { + if (me->GetInstanceScript()) + if (me->GetInstanceScript()->GetData(TYPE_YOGGSARON) != IN_PROGRESS) + return; - _checkTimer += diff; - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + _checkTimer += diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (me->GetEntry() == NPC_MIMIRON_KEEPER) - { - if (_checkTimer >= 2000) - { - me->CastSpell(me, SPELL_DESTABILIZATION_MATRIX, false); - _checkTimer = 0; - } - } - } - }; + if (me->GetEntry() == NPC_MIMIRON_KEEPER) + { + if (_checkTimer >= 2000) + { + me->CastSpell(me, SPELL_DESTABILIZATION_MATRIX, false); + _checkTimer = 0; + } + } + } + }; }; class boss_yoggsaron_descend_portal : public CreatureScript @@ -1696,21 +1696,21 @@ class boss_yoggsaron_descend_portal : public CreatureScript public: boss_yoggsaron_descend_portal() : CreatureScript("boss_yoggsaron_descend_portal") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (!creature->GetUInt32Value(UNIT_NPC_FLAGS)) - return true; - switch (creature->GetArmor()) - { - case ACTION_ILLUSION_DRAGONS: player->CastSpell(player, SPELL_TELEPORT_TO_CHAMBER, true); break; - case ACTION_ILLUSION_ICECROWN: player->CastSpell(player, SPELL_TELEPORT_TO_ICECROWN, true); break; - case ACTION_ILLUSION_STORMWIND: player->CastSpell(player, SPELL_TELEPORT_TO_STORMWIND, true); break; - } - - creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); - creature->DespawnOrUnsummon(1000); - return true; - } + bool OnGossipHello(Player* player, Creature* creature) + { + if (!creature->GetUInt32Value(UNIT_NPC_FLAGS)) + return true; + switch (creature->GetArmor()) + { + case ACTION_ILLUSION_DRAGONS: player->CastSpell(player, SPELL_TELEPORT_TO_CHAMBER, true); break; + case ACTION_ILLUSION_ICECROWN: player->CastSpell(player, SPELL_TELEPORT_TO_ICECROWN, true); break; + case ACTION_ILLUSION_STORMWIND: player->CastSpell(player, SPELL_TELEPORT_TO_STORMWIND, true); break; + } + + creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); + creature->DespawnOrUnsummon(1000); + return true; + } }; class boss_yoggsaron_influence_tentacle : public CreatureScript @@ -1723,26 +1723,26 @@ public: return new boss_yoggsaron_influence_tentacleAI (pCreature); } - struct boss_yoggsaron_influence_tentacleAI : public NullCreatureAI - { - boss_yoggsaron_influence_tentacleAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - me->CastSpell(me, SPELL_GRIM_REPRISAL, true); - } + struct boss_yoggsaron_influence_tentacleAI : public NullCreatureAI + { + boss_yoggsaron_influence_tentacleAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + me->CastSpell(me, SPELL_GRIM_REPRISAL, true); + } - void DamageTaken(Unit*, uint32&, DamageEffectType, SpellSchoolMask) - { - if (me->GetEntry() != NPC_INFLUENCE_TENTACLE) - me->UpdateEntry(NPC_INFLUENCE_TENTACLE, 0, false); - } + void DamageTaken(Unit*, uint32&, DamageEffectType, SpellSchoolMask) + { + if (me->GetEntry() != NPC_INFLUENCE_TENTACLE) + me->UpdateEntry(NPC_INFLUENCE_TENTACLE, 0, false); + } - void JustDied(Unit*) - { - if (me->IsSummon()) - if (Unit* sara = me->ToTempSummon()->GetSummoner()) - sara->GetAI()->DoAction(ACTION_INFLUENCE_TENTACLE_DIED); - } - }; + void JustDied(Unit*) + { + if (me->IsSummon()) + if (Unit* sara = me->ToTempSummon()->GetSummoner()) + sara->GetAI()->DoAction(ACTION_INFLUENCE_TENTACLE_DIED); + } + }; }; class boss_yoggsaron_immortal_guardian : public CreatureScript @@ -1755,82 +1755,82 @@ public: return new boss_yoggsaron_immortal_guardianAI (pCreature); } - struct boss_yoggsaron_immortal_guardianAI : public ScriptedAI - { - boss_yoggsaron_immortal_guardianAI(Creature* pCreature) : ScriptedAI(pCreature) - { - Reset(); - } + struct boss_yoggsaron_immortal_guardianAI : public ScriptedAI + { + boss_yoggsaron_immortal_guardianAI(Creature* pCreature) : ScriptedAI(pCreature) + { + Reset(); + } - uint32 _visualTimer; - uint32 _spellTimer; + uint32 _visualTimer; + uint32 _spellTimer; - void Reset() - { - me->CastSpell(me, SPELL_RECENTLY_SPAWNED, true); - //me->CastSpell(me, SPELL_EMPOWERED_PASSIVE, true); - if (Aura* aur = me->AddAura(SPELL_EMPOWERED_PASSIVE, me)) - aur->SetStackAmount(9); + void Reset() + { + me->CastSpell(me, SPELL_RECENTLY_SPAWNED, true); + //me->CastSpell(me, SPELL_EMPOWERED_PASSIVE, true); + if (Aura* aur = me->AddAura(SPELL_EMPOWERED_PASSIVE, me)) + aur->SetStackAmount(9); - _spellTimer = 0; - _visualTimer = 1; - me->SetControlled(true, UNIT_STATE_ROOT); - me->SetInCombatWithZone(); - } + _spellTimer = 0; + _visualTimer = 1; + me->SetControlled(true, UNIT_STATE_ROOT); + me->SetInCombatWithZone(); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - damage = me->GetHealth()-1; - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + damage = me->GetHealth()-1; + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_SHADOW_BEACON) - caster->GetAI()->DoAction(ACTION_YOGG_SARON_SHADOW_BEACON); - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_SHADOW_BEACON) + caster->GetAI()->DoAction(ACTION_YOGG_SARON_SHADOW_BEACON); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - if (_visualTimer) - { - _visualTimer += diff; - if (_visualTimer >= 100 && _visualTimer < 10000 ) - { - me->CastSpell(me, SPELL_SIMPLE_TELEPORT, false); - _visualTimer = 10000; - } - else if (_visualTimer >= 11000) - { - me->SetControlled(false, UNIT_STATE_ROOT); - _visualTimer = 0; - } - } + if (_visualTimer) + { + _visualTimer += diff; + if (_visualTimer >= 100 && _visualTimer < 10000 ) + { + me->CastSpell(me, SPELL_SIMPLE_TELEPORT, false); + _visualTimer = 10000; + } + else if (_visualTimer >= 11000) + { + me->SetControlled(false, UNIT_STATE_ROOT); + _visualTimer = 0; + } + } - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - _spellTimer += diff; - if (_spellTimer >= 9500) - { - if (me->HealthBelowPct(85)) - { - if (Unit* target = SelectTargetFromPlayerList(40.0f)) - { - me->CastSpell(target, SPELL_DRAIN_LIFE, false); - _spellTimer = 0; - } - } - else - _spellTimer = 7500; - } + _spellTimer += diff; + if (_spellTimer >= 9500) + { + if (me->HealthBelowPct(85)) + { + if (Unit* target = SelectTargetFromPlayerList(40.0f)) + { + me->CastSpell(target, SPELL_DRAIN_LIFE, false); + _spellTimer = 0; + } + } + else + _spellTimer = 7500; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_yoggsaron_lich_king : public CreatureScript @@ -1843,108 +1843,108 @@ public: return new boss_yoggsaron_lich_kingAI (pCreature); } - struct boss_yoggsaron_lich_kingAI : public NullCreatureAI - { - boss_yoggsaron_lich_kingAI(Creature* c) : NullCreatureAI(c) { } + struct boss_yoggsaron_lich_kingAI : public NullCreatureAI + { + boss_yoggsaron_lich_kingAI(Creature* c) : NullCreatureAI(c) { } - bool _running; - int32 _checkTimer; - uint8 _step; - uint64 _championGUID; - uint64 _yoggGUID; + bool _running; + int32 _checkTimer; + uint8 _step; + uint64 _championGUID; + uint64 _yoggGUID; - void Reset() - { - _running = true; - _checkTimer = 0; - _step = 0; - _championGUID = 0; - if (me->GetInstanceScript()) - _yoggGUID = me->GetInstanceScript()->GetData64(TYPE_YOGGSARON); - } + void Reset() + { + _running = true; + _checkTimer = 0; + _step = 0; + _championGUID = 0; + if (me->GetInstanceScript()) + _yoggGUID = me->GetInstanceScript()->GetData64(TYPE_YOGGSARON); + } - void NextStep(const uint32 time) - { - _step++; - _checkTimer = time; - } + void NextStep(const uint32 time) + { + _step++; + _checkTimer = time; + } - void Say(std::string text, uint64 guid, bool yell, uint32 soundId) - { - Creature* creature = guid ? ObjectAccessor::GetCreature(*me, guid) : me; - if (!creature) - return; + void Say(std::string text, uint64 guid, bool yell, uint32 soundId) + { + Creature* creature = guid ? ObjectAccessor::GetCreature(*me, guid) : me; + if (!creature) + return; - WorldPacket data; - if (creature->GetGUID() != _yoggGUID) - { - ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); - creature->SendMessageToSetInRange(&data, 90, true); - } - else if (Creature* cr = me->SummonTrigger(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()-5, 0, 5000)) - { - ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); - cr->SendMessageToSetInRange(&data, 90, true); - } - else - return; + WorldPacket data; + if (creature->GetGUID() != _yoggGUID) + { + ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); + creature->SendMessageToSetInRange(&data, 90, true); + } + else if (Creature* cr = me->SummonTrigger(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()-5, 0, 5000)) + { + ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); + cr->SendMessageToSetInRange(&data, 90, true); + } + else + return; - PlaySound(soundId); - } + PlaySound(soundId); + } - void PlaySound(uint32 soundId) - { - WorldPacket data(SMSG_PLAY_SOUND, 4); - data << uint32(soundId); - me->SendMessageToSetInRange(&data, 90, false); - } + void PlaySound(uint32 soundId) + { + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << uint32(soundId); + me->SendMessageToSetInRange(&data, 90, false); + } - void UpdateAI(uint32 diff) - { - if (!_running) - return; + void UpdateAI(uint32 diff) + { + if (!_running) + return; - if (_checkTimer != 0) - { - _checkTimer -= diff; - if (_checkTimer < 0 ) - _checkTimer = 0; - } - else - switch (_step) - { - case 0: - NextStep(5000); - break; - case 1: - if (Creature* cr = me->FindNearestCreature(NPC_IMMOLATED_CHAMPION, 50)) - _championGUID = cr->GetGUID(); - Say("Your resilience is admirable.", 0, false, LK_1); - NextStep(7000); - break; - case 2: - Say("Arrrrrrgh!", _championGUID, true, IC_1); - NextStep(6000); - break; - case 3: - Say("I'm not afraid of you!", _championGUID, false, IC_2); - NextStep(6500); - break; - case 4: - Say("I will break you as I broke him.", 0, false, LK_2); - NextStep(7500); - break; - case 5: - Say("Yrr n'lyeth... shuul anagg!", _yoggGUID, false, YS_V3_1); - NextStep(5000); - break; - case 6: - Say("He will learn... no king rules forever; only death is eternal!", _yoggGUID, false, YS_V3_2); - _running = false; - break; - } - } - }; + if (_checkTimer != 0) + { + _checkTimer -= diff; + if (_checkTimer < 0 ) + _checkTimer = 0; + } + else + switch (_step) + { + case 0: + NextStep(5000); + break; + case 1: + if (Creature* cr = me->FindNearestCreature(NPC_IMMOLATED_CHAMPION, 50)) + _championGUID = cr->GetGUID(); + Say("Your resilience is admirable.", 0, false, LK_1); + NextStep(7000); + break; + case 2: + Say("Arrrrrrgh!", _championGUID, true, IC_1); + NextStep(6000); + break; + case 3: + Say("I'm not afraid of you!", _championGUID, false, IC_2); + NextStep(6500); + break; + case 4: + Say("I will break you as I broke him.", 0, false, LK_2); + NextStep(7500); + break; + case 5: + Say("Yrr n'lyeth... shuul anagg!", _yoggGUID, false, YS_V3_1); + NextStep(5000); + break; + case 6: + Say("He will learn... no king rules forever; only death is eternal!", _yoggGUID, false, YS_V3_2); + _running = false; + break; + } + } + }; }; @@ -1958,116 +1958,116 @@ public: return new boss_yoggsaron_llaneAI (pCreature); } - struct boss_yoggsaron_llaneAI : public NullCreatureAI - { - boss_yoggsaron_llaneAI(Creature* c) : NullCreatureAI(c) { } + struct boss_yoggsaron_llaneAI : public NullCreatureAI + { + boss_yoggsaron_llaneAI(Creature* c) : NullCreatureAI(c) { } - bool _running; - int32 _checkTimer; - uint8 _step; - uint64 _garonaGUID; - uint64 _yoggGUID; + bool _running; + int32 _checkTimer; + uint8 _step; + uint64 _garonaGUID; + uint64 _yoggGUID; - void Reset() - { - _running = true; - _checkTimer = 0; - _step = 0; - _garonaGUID = 0; - if (me->GetInstanceScript()) - _yoggGUID = me->GetInstanceScript()->GetData64(TYPE_YOGGSARON); - } + void Reset() + { + _running = true; + _checkTimer = 0; + _step = 0; + _garonaGUID = 0; + if (me->GetInstanceScript()) + _yoggGUID = me->GetInstanceScript()->GetData64(TYPE_YOGGSARON); + } - void NextStep(const uint32 time) - { - _step++; - _checkTimer = time; - } + void NextStep(const uint32 time) + { + _step++; + _checkTimer = time; + } - void Say(std::string text, uint64 guid, bool yell, uint32 soundId) - { - Creature* creature = guid ? ObjectAccessor::GetCreature(*me, guid) : me; - if (!creature) - return; + void Say(std::string text, uint64 guid, bool yell, uint32 soundId) + { + Creature* creature = guid ? ObjectAccessor::GetCreature(*me, guid) : me; + if (!creature) + return; - WorldPacket data; - if (creature->GetGUID() != _yoggGUID) - { - ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); - creature->SendMessageToSetInRange(&data, 90, true); - } - else if (Creature* cr = me->SummonTrigger(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()-5, 0, 5000)) - { - ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); - cr->SendMessageToSetInRange(&data, 90, true); - } - else - return; + WorldPacket data; + if (creature->GetGUID() != _yoggGUID) + { + ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); + creature->SendMessageToSetInRange(&data, 90, true); + } + else if (Creature* cr = me->SummonTrigger(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()-5, 0, 5000)) + { + ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); + cr->SendMessageToSetInRange(&data, 90, true); + } + else + return; - PlaySound(soundId); - } + PlaySound(soundId); + } - void PlaySound(uint32 soundId) - { - WorldPacket data(SMSG_PLAY_SOUND, 4); - data << uint32(soundId); - me->SendMessageToSetInRange(&data, 90, false); - } + void PlaySound(uint32 soundId) + { + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << uint32(soundId); + me->SendMessageToSetInRange(&data, 90, false); + } - void UpdateAI(uint32 diff) - { - if (!_running) - return; + void UpdateAI(uint32 diff) + { + if (!_running) + return; - if (_checkTimer != 0) - { - _checkTimer -= diff; - if (_checkTimer < 0 ) - _checkTimer = 0; - } - else - switch (_step) - { - case 0: - NextStep(5000); - break; - case 1: - if (Creature* cr = me->FindNearestCreature(NPC_GARONA, 50)) - _garonaGUID = cr->GetGUID(); - Say("Bad news sire. The clans are united under Blackhand in this assault. They will stand together until Stormwind has fallen.", _garonaGUID, false, GAR_1); - NextStep(2000); - break; - case 2: - PlaySound(GAR_2); - NextStep(6500); - break; - case 3: - Say("Gul'dan is bringing up his warlocks by nightfall. Until then, the Blackrock clan will be trying to take the Eastern Wall.", _garonaGUID, false, GAR_3); - NextStep(11000); - break; - case 4: - Say("A thousand deaths... or one murder.", _yoggGUID, false, YS_V1_1); - NextStep(2500); - break; - case 5: - PlaySound(YS_V1_2); - NextStep(2500); - break; - case 6: - Say("We will hold until the reinforcements come. As long as men with stout hearts are manning the walls and throne Stormwind will hold.", 0, false, LL_1); - NextStep(10000); - break; - case 7: - Say("The orc leaders agree with your assessment.", _garonaGUID, false, GAR_4); - NextStep(5000); - break; - case 8: - Say("Your petty quarrels only make me stronger!", _yoggGUID, false, YS_V1_3); - _running = false; - break; - } - } - }; + if (_checkTimer != 0) + { + _checkTimer -= diff; + if (_checkTimer < 0 ) + _checkTimer = 0; + } + else + switch (_step) + { + case 0: + NextStep(5000); + break; + case 1: + if (Creature* cr = me->FindNearestCreature(NPC_GARONA, 50)) + _garonaGUID = cr->GetGUID(); + Say("Bad news sire. The clans are united under Blackhand in this assault. They will stand together until Stormwind has fallen.", _garonaGUID, false, GAR_1); + NextStep(2000); + break; + case 2: + PlaySound(GAR_2); + NextStep(6500); + break; + case 3: + Say("Gul'dan is bringing up his warlocks by nightfall. Until then, the Blackrock clan will be trying to take the Eastern Wall.", _garonaGUID, false, GAR_3); + NextStep(11000); + break; + case 4: + Say("A thousand deaths... or one murder.", _yoggGUID, false, YS_V1_1); + NextStep(2500); + break; + case 5: + PlaySound(YS_V1_2); + NextStep(2500); + break; + case 6: + Say("We will hold until the reinforcements come. As long as men with stout hearts are manning the walls and throne Stormwind will hold.", 0, false, LL_1); + NextStep(10000); + break; + case 7: + Say("The orc leaders agree with your assessment.", _garonaGUID, false, GAR_4); + NextStep(5000); + break; + case 8: + Say("Your petty quarrels only make me stronger!", _yoggGUID, false, YS_V1_3); + _running = false; + break; + } + } + }; }; class boss_yoggsaron_neltharion : public CreatureScript @@ -2080,102 +2080,102 @@ public: return new boss_yoggsaron_neltharionAI (pCreature); } - struct boss_yoggsaron_neltharionAI : public ScriptedAI - { - boss_yoggsaron_neltharionAI(Creature* c) : ScriptedAI(c) { } + struct boss_yoggsaron_neltharionAI : public ScriptedAI + { + boss_yoggsaron_neltharionAI(Creature* c) : ScriptedAI(c) { } - bool _running; - int32 _checkTimer; - uint8 _step; - uint64 _yoggGUID; + bool _running; + int32 _checkTimer; + uint8 _step; + uint64 _yoggGUID; - void Reset() - { - _running = true; - _checkTimer = 0; - _step = 0; - if (me->GetInstanceScript()) - _yoggGUID = me->GetInstanceScript()->GetData64(TYPE_YOGGSARON); - } + void Reset() + { + _running = true; + _checkTimer = 0; + _step = 0; + if (me->GetInstanceScript()) + _yoggGUID = me->GetInstanceScript()->GetData64(TYPE_YOGGSARON); + } - void NextStep(const uint32 time) - { - _step++; - _checkTimer = time; - } + void NextStep(const uint32 time) + { + _step++; + _checkTimer = time; + } - void Say(std::string text, uint64 guid, bool yell, uint32 soundId) - { - Creature* creature = guid ? ObjectAccessor::GetCreature(*me, guid) : me; - if (!creature) - return; + void Say(std::string text, uint64 guid, bool yell, uint32 soundId) + { + Creature* creature = guid ? ObjectAccessor::GetCreature(*me, guid) : me; + if (!creature) + return; - WorldPacket data; - if (creature->GetGUID() != _yoggGUID) - { - ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); - creature->SendMessageToSetInRange(&data, 90, true); - } - else if (Creature* cr = me->SummonTrigger(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()-5, 0, 5000)) - { - ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); - cr->SendMessageToSetInRange(&data, 90, true); - } - else - return; + WorldPacket data; + if (creature->GetGUID() != _yoggGUID) + { + ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); + creature->SendMessageToSetInRange(&data, 90, true); + } + else if (Creature* cr = me->SummonTrigger(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()-5, 0, 5000)) + { + ChatHandler::BuildChatPacket(data, yell ? CHAT_MSG_MONSTER_YELL : CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, creature, NULL, text); + cr->SendMessageToSetInRange(&data, 90, true); + } + else + return; - PlaySound(soundId); - } + PlaySound(soundId); + } - void PlaySound(uint32 soundId) - { - WorldPacket data(SMSG_PLAY_SOUND, 4); - data << uint32(soundId); - me->SendMessageToSetInRange(&data, 90, false); - } + void PlaySound(uint32 soundId) + { + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << uint32(soundId); + me->SendMessageToSetInRange(&data, 90, false); + } - void UpdateAI(uint32 diff) - { - if (!_running) - return; + void UpdateAI(uint32 diff) + { + if (!_running) + return; - if (_checkTimer != 0) - { - _checkTimer -= diff; - if (_checkTimer < 0 ) - _checkTimer = 0; - } - else - switch (_step) - { - case 0: - NextStep(5000); - break; - case 1: - Say("It is done... All have been given that which must be given. I now seal the Dragon Soul forever...", 0, false, NEL_1); - NextStep(10000); - break; - case 2: - if (Creature* cr = me->FindNearestCreature(NPC_YSERA, 50)) - Say("That terrible glow... should that be?", cr->GetGUID(), false, YSE_1); - NextStep(4000); - break; - case 3: - Say("For it to be as it must, yes.", 0, false, NEL_2); - NextStep(4000); - break; - case 4: - if (Creature* cr = me->FindNearestCreature(NPC_MALYGOS, 50)) - Say("It is a weapon like no other. It must be like no other.", cr->GetGUID(), false, MAL_1); - NextStep(8000); - break; - case 5: - Say("His brood learned their lesson before too long, you shall soon learn yours!", _yoggGUID, false, YS_V2_1); - _running = false; - break; - } - } - }; + if (_checkTimer != 0) + { + _checkTimer -= diff; + if (_checkTimer < 0 ) + _checkTimer = 0; + } + else + switch (_step) + { + case 0: + NextStep(5000); + break; + case 1: + Say("It is done... All have been given that which must be given. I now seal the Dragon Soul forever...", 0, false, NEL_1); + NextStep(10000); + break; + case 2: + if (Creature* cr = me->FindNearestCreature(NPC_YSERA, 50)) + Say("That terrible glow... should that be?", cr->GetGUID(), false, YSE_1); + NextStep(4000); + break; + case 3: + Say("For it to be as it must, yes.", 0, false, NEL_2); + NextStep(4000); + break; + case 4: + if (Creature* cr = me->FindNearestCreature(NPC_MALYGOS, 50)) + Say("It is a weapon like no other. It must be like no other.", cr->GetGUID(), false, MAL_1); + NextStep(8000); + break; + case 5: + Say("His brood learned their lesson before too long, you shall soon learn yours!", _yoggGUID, false, YS_V2_1); + _running = false; + break; + } + } + }; }; class boss_yoggsaron_voice : public CreatureScript @@ -2188,58 +2188,58 @@ public: return new boss_yoggsaron_voiceAI (pCreature); } - struct boss_yoggsaron_voiceAI : public NullCreatureAI - { - boss_yoggsaron_voiceAI(Creature* pCreature) : NullCreatureAI(pCreature) - { - _targets.clear(); - _current = 0; - } + struct boss_yoggsaron_voiceAI : public NullCreatureAI + { + boss_yoggsaron_voiceAI(Creature* pCreature) : NullCreatureAI(pCreature) + { + _targets.clear(); + _current = 0; + } - EventMap events; - std::vector _targets; - uint32 _current; + EventMap events; + std::vector _targets; + uint32 _current; - void Reset() - { - me->CastSpell(me, SPELL_INSANE_PERIODIC, true); - } + void Reset() + { + me->CastSpell(me, SPELL_INSANE_PERIODIC, true); + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_INSANE1) - { - // Drive Me Crazy achievement failed - if (me->GetInstanceScript()) - if (Creature* yogg = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_YOGGSARON))) - yogg->AI()->DoAction(ACTION_FAILED_DRIVE_ME_CRAZY); + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_INSANE1) + { + // Drive Me Crazy achievement failed + if (me->GetInstanceScript()) + if (Creature* yogg = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(TYPE_YOGGSARON))) + yogg->AI()->DoAction(ACTION_FAILED_DRIVE_ME_CRAZY); - events.ScheduleEvent(40, 8000); - _targets.push_back(target->GetGUID()); - } - } + events.ScheduleEvent(40, 8000); + _targets.push_back(target->GetGUID()); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case 40: - { - events.PopEvent(); - uint64 _guid = _targets.at(_current); - ++_current; + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case 40: + { + events.PopEvent(); + uint64 _guid = _targets.at(_current); + ++_current; - if (Player* player = ObjectAccessor::GetPlayer(*me, _guid)) - { - me->PlayDirectSound(15760, player); - me->MonsterWhisper("Destroy them minion, your master commands it!", player, false); - } - break; - } - } - } - }; + if (Player* player = ObjectAccessor::GetPlayer(*me, _guid)) + { + me->PlayDirectSound(15760, player); + me->MonsterWhisper("Destroy them minion, your master commands it!", player, false); + } + break; + } + } + } + }; }; class spell_yogg_saron_malady_of_the_mind : public SpellScriptLoader @@ -2251,21 +2251,21 @@ class spell_yogg_saron_malady_of_the_mind : public SpellScriptLoader { PrepareAuraScript(spell_yogg_saron_malady_of_the_mind_AuraScript); - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->ApplySpellImmune(SPELL_DEATH_RAY_DAMAGE_REAL, IMMUNITY_ID, SPELL_DEATH_RAY_DAMAGE_REAL, true); - } + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->ApplySpellImmune(SPELL_DEATH_RAY_DAMAGE_REAL, IMMUNITY_ID, SPELL_DEATH_RAY_DAMAGE_REAL, true); + } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->ApplySpellImmune(SPELL_DEATH_RAY_DAMAGE_REAL, IMMUNITY_ID, SPELL_DEATH_RAY_DAMAGE_REAL, false); + GetUnitOwner()->ApplySpellImmune(SPELL_DEATH_RAY_DAMAGE_REAL, IMMUNITY_ID, SPELL_DEATH_RAY_DAMAGE_REAL, false); GetUnitOwner()->CastCustomSpell(SPELL_MALADY_OF_THE_MIND_TRIGGER, SPELLVALUE_MAX_TARGETS, 1, GetUnitOwner(), true); } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_yogg_saron_malady_of_the_mind_AuraScript::OnApply, EFFECT_1, SPELL_AURA_MOD_FEAR, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_malady_of_the_mind_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_MOD_FEAR, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_yogg_saron_malady_of_the_mind_AuraScript::OnApply, EFFECT_1, SPELL_AURA_MOD_FEAR, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_malady_of_the_mind_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_MOD_FEAR, AURA_EFFECT_HANDLE_REAL); } }; @@ -2284,57 +2284,57 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader { PrepareAuraScript(spell_yogg_saron_brain_link_AuraScript); - void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { PreventDefaultAction(); - Player* target = NULL; - Map::PlayerList const& pList = GetUnitOwner()->GetMap()->GetPlayers(); - uint8 _offset = urand(0, pList.getSize()-1); - uint8 _counter = 0; - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr, ++_counter) - { - if (itr->GetSource() == GetUnitOwner() || GetUnitOwner()->GetDistance(itr->GetSource()) > 50.0f || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) - continue; + Player* target = NULL; + Map::PlayerList const& pList = GetUnitOwner()->GetMap()->GetPlayers(); + uint8 _offset = urand(0, pList.getSize()-1); + uint8 _counter = 0; + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr, ++_counter) + { + if (itr->GetSource() == GetUnitOwner() || GetUnitOwner()->GetDistance(itr->GetSource()) > 50.0f || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster()) + continue; - if (_counter <= _offset || !target) - target = itr->GetSource(); - else - break; - } + if (_counter <= _offset || !target) + target = itr->GetSource(); + else + break; + } - if (!target) - SetDuration(0); - else - _targetGUID = target->GetGUID(); + if (!target) + SetDuration(0); + else + _targetGUID = target->GetGUID(); } void OnPeriodic(AuraEffect const* aurEff) { - Unit* owner = GetUnitOwner(); - Unit* _target = ObjectAccessor::GetUnit(*owner, _targetGUID); - if (!owner || !_target || !_target->IsAlive() || fabs(owner->GetPositionZ() - _target->GetPositionZ()) > 10.0f) // Target or owner underground - { - SetDuration(0); - return; - } + Unit* owner = GetUnitOwner(); + Unit* _target = ObjectAccessor::GetUnit(*owner, _targetGUID); + if (!owner || !_target || !_target->IsAlive() || fabs(owner->GetPositionZ() - _target->GetPositionZ()) > 10.0f) // Target or owner underground + { + SetDuration(0); + return; + } - if (owner->GetDistance(_target) > 20.0f) - { - owner->CastSpell(_target, SPELL_BRAIN_LINK_DAMAGE, true); - owner->CastSpell(owner, SPELL_BRAIN_LINK_DAMAGE, true); - } - else - owner->CastSpell(_target, SPELL_BRAIN_LINK_OK, true); - } + if (owner->GetDistance(_target) > 20.0f) + { + owner->CastSpell(_target, SPELL_BRAIN_LINK_DAMAGE, true); + owner->CastSpell(owner, SPELL_BRAIN_LINK_DAMAGE, true); + } + else + owner->CastSpell(_target, SPELL_BRAIN_LINK_OK, true); + } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_yogg_saron_brain_link_AuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_yogg_saron_brain_link_AuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); OnEffectPeriodic += AuraEffectPeriodicFn(spell_yogg_saron_brain_link_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } - protected: - uint64 _targetGUID; + protected: + uint64 _targetGUID; }; AuraScript* GetAuraScript() const @@ -2342,25 +2342,25 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader return new spell_yogg_saron_brain_link_AuraScript(); } - class spell_yogg_saron_brain_link_SpellScript : public SpellScript + class spell_yogg_saron_brain_link_SpellScript : public SpellScript { PrepareSpellScript(spell_yogg_saron_brain_link_SpellScript); void FilterTargets(std::list& targets) { - std::list tempList; + std::list tempList; for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) if ((*itr)->GetPositionZ() > 300.0f) - tempList.push_back(*itr); + tempList.push_back(*itr); - targets.clear(); - for (std::list::iterator itr = tempList.begin(); itr != tempList.end(); ++itr) - targets.push_back(*itr); + targets.clear(); + for (std::list::iterator itr = tempList.begin(); itr != tempList.end(); ++itr) + targets.push_back(*itr); } void Register() { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_brain_link_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_brain_link_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; @@ -2379,31 +2379,31 @@ class spell_yogg_saron_destabilization_matrix : public SpellScriptLoader { PrepareSpellScript(spell_yogg_saron_destabilization_matrix_SpellScript); - void HandleDummyEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, SPELL_DESTABILIZATION_MATRIX_ATTACK, false); - } + void HandleDummyEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_DESTABILIZATION_MATRIX_ATTACK, false); + } void FilterTargets(std::list& targets) { WorldObject* target = NULL; for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) if (!(*itr)->ToUnit()->HasAura(SPELL_DESTABILIZATION_MATRIX_ATTACK)) - { + { target = *itr; - break; - } + break; + } - targets.clear(); - if (target) - targets.push_back(target); + targets.clear(); + if (target) + targets.push_back(target); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_destabilization_matrix_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_destabilization_matrix_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_destabilization_matrix_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); } }; @@ -2423,31 +2423,31 @@ class spell_yogg_saron_titanic_storm : public SpellScriptLoader { PrepareSpellScript(spell_yogg_saron_titanic_storm_SpellScript); - void HandleDummyEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - Unit::Kill(GetCaster(), target); - } + void HandleDummyEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + Unit::Kill(GetCaster(), target); + } void FilterTargets(std::list& targets) { WorldObject* target = NULL; for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) if ((*itr)->ToUnit()->HasAura(SPELL_WEAKENED)) - { + { target = *itr; - break; - } + break; + } - targets.clear(); - if (target) - targets.push_back(target); + targets.clear(); + if (target) + targets.push_back(target); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_titanic_storm_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_titanic_storm_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_titanic_storm_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); } }; @@ -2542,25 +2542,25 @@ class spell_yogg_saron_empowered : public SpellScriptLoader PrepareAuraScript(spell_yogg_saron_empowered_AuraScript); void OnPeriodic(AuraEffect const* aurEff) - { - Unit* target = GetUnitOwner(); - uint8 stack = std::min(uint8(target->GetHealthPct()/10), (uint8)9); - - if (!stack) - { - target->RemoveAura(SPELL_EMPOWERED); - target->CastSpell(target, SPELL_WEAKENED, true); - } - else if (Aura* aur = target->AddAura(SPELL_EMPOWERED, target)) - { - aur->SetStackAmount(stack); - target->RemoveAurasDueToSpell(SPELL_WEAKENED); - } - } + { + Unit* target = GetUnitOwner(); + uint8 stack = std::min(uint8(target->GetHealthPct()/10), (uint8)9); + + if (!stack) + { + target->RemoveAura(SPELL_EMPOWERED); + target->CastSpell(target, SPELL_WEAKENED, true); + } + else if (Aura* aur = target->AddAura(SPELL_EMPOWERED, target)) + { + aur->SetStackAmount(stack); + target->RemoveAurasDueToSpell(SPELL_WEAKENED); + } + } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_yogg_saron_empowered_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_yogg_saron_empowered_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -2579,26 +2579,26 @@ class spell_yogg_saron_insane_periodic_trigger : public SpellScriptLoader { PrepareSpellScript(spell_yogg_saron_insane_periodic_trigger_SpellScript); - void HandleDummyEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - Player* target = GetHitPlayer(); - if (!target) - return; + void HandleDummyEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Player* target = GetHitPlayer(); + if (!target) + return; - Unit* caster = GetCaster(); - caster->PlayDirectSound(VOYS_INSANE1, target); - caster->MonsterWhisper("Your will is no longer you own...", target, false); - caster->CastSpell(target, SPELL_INSANE1, true); - target->CastSpell(target, SPELL_INSANE2, true); - } + Unit* caster = GetCaster(); + caster->PlayDirectSound(VOYS_INSANE1, target); + caster->MonsterWhisper("Your will is no longer you own...", target, false); + caster->CastSpell(target, SPELL_INSANE1, true); + target->CastSpell(target, SPELL_INSANE2, true); + } void FilterTargets(std::list& targets) { std::list tmplist; for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) if ((*itr)->GetTypeId() == TYPEID_PLAYER && !(*itr)->ToPlayer()->HasAuraType(SPELL_AURA_AOE_CHARM) && !(*itr)->ToPlayer()->HasAura(SPELL_SANITY)) - tmplist.push_back(*itr); + tmplist.push_back(*itr); targets.clear(); for (std::list::iterator itr = tmplist.begin(); itr != tmplist.end(); ++itr) @@ -2607,7 +2607,7 @@ class spell_yogg_saron_insane_periodic_trigger : public SpellScriptLoader void Register() { - OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_insane_periodic_trigger_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_insane_periodic_trigger_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_insane_periodic_trigger_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; @@ -2653,25 +2653,25 @@ class spell_yogg_saron_sanity_well : public SpellScriptLoader { PrepareAuraScript(spell_yogg_saron_sanity_well_AuraScript); - void HandleEffectCalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + void HandleEffectCalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) { isPeriodic = true; amplitude = 2*IN_MILLISECONDS; } void HandleEffectPeriodic(AuraEffect const * aurEff) - { - Unit* target = GetTarget(); - if (!target || target->GetTypeId() != TYPEID_PLAYER) - return; + { + Unit* target = GetTarget(); + if (!target || target->GetTypeId() != TYPEID_PLAYER) + return; - if (Aura* aur = target->GetAura(SPELL_SANITY)) - aur->SetStackAmount(std::min(100, aur->GetStackAmount()+20)); - } + if (Aura* aur = target->GetAura(SPELL_SANITY)) + aur->SetStackAmount(std::min(100, aur->GetStackAmount()+20)); + } void Register() { - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_yogg_saron_sanity_well_AuraScript::HandleEffectCalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_yogg_saron_sanity_well_AuraScript::HandleEffectCalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); OnEffectPeriodic += AuraEffectPeriodicFn(spell_yogg_saron_sanity_well_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); } }; @@ -2691,44 +2691,44 @@ class spell_yogg_saron_sanity_reduce : public SpellScriptLoader { PrepareSpellScript(spell_yogg_saron_sanity_reduce_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - Player* target = GetHitPlayer(); - if (!target) - return; + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Player* target = GetHitPlayer(); + if (!target) + return; - uint8 _reduceAmount = 0; - switch (GetSpellInfo()->Id) - { - case SPELL_SARA_PSYCHOSIS_10: _reduceAmount = 9; break; - case SPELL_SARA_PSYCHOSIS_25: _reduceAmount = 12; break; - case SPELL_MALADY_OF_THE_MIND: _reduceAmount = 3; break; - case SPELL_MALADY_OF_THE_MIND_TRIGGER: _reduceAmount = 3; break; - case SPELL_BRAIN_LINK_DAMAGE: _reduceAmount = 2; break; - case 64168 /*SPELL_LUNATIC_GAZE*/: _reduceAmount = 2; break; - case 64164 /*SPELL_YS_LUNATIC_GAZE*/: _reduceAmount = 4; break; - case SPELL_INDUCE_MADNESS: - // Teleported out of brain - if (target->GetPositionZ() > 300.0f) - return; - else - target->CastSpell(target, SPELL_CANCEL_ILLUSION_AURA, true); // else we are underground, remove illusion aura and teleport outside - _reduceAmount = 100; - break; - } + uint8 _reduceAmount = 0; + switch (GetSpellInfo()->Id) + { + case SPELL_SARA_PSYCHOSIS_10: _reduceAmount = 9; break; + case SPELL_SARA_PSYCHOSIS_25: _reduceAmount = 12; break; + case SPELL_MALADY_OF_THE_MIND: _reduceAmount = 3; break; + case SPELL_MALADY_OF_THE_MIND_TRIGGER: _reduceAmount = 3; break; + case SPELL_BRAIN_LINK_DAMAGE: _reduceAmount = 2; break; + case 64168 /*SPELL_LUNATIC_GAZE*/: _reduceAmount = 2; break; + case 64164 /*SPELL_YS_LUNATIC_GAZE*/: _reduceAmount = 4; break; + case SPELL_INDUCE_MADNESS: + // Teleported out of brain + if (target->GetPositionZ() > 300.0f) + return; + else + target->CastSpell(target, SPELL_CANCEL_ILLUSION_AURA, true); // else we are underground, remove illusion aura and teleport outside + _reduceAmount = 100; + break; + } - if (Aura* aur = target->GetAura(SPELL_SANITY)) - { - if ((aur->GetStackAmount()-_reduceAmount) <= 20) - target->CastSpell(target, 63752 /*SANITY_SCREEN_EFFECT*/, true); - aur->ModStackAmount(-_reduceAmount); - } - } + if (Aura* aur = target->GetAura(SPELL_SANITY)) + { + if ((aur->GetStackAmount()-_reduceAmount) <= 20) + target->CastSpell(target, 63752 /*SANITY_SCREEN_EFFECT*/, true); + aur->ModStackAmount(-_reduceAmount); + } + } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_sanity_reduce_SpellScript::HandleScriptEffect, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_sanity_reduce_SpellScript::HandleScriptEffect, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -2747,16 +2747,16 @@ class spell_yogg_saron_empowering_shadows : public SpellScriptLoader { PrepareSpellScript(spell_yogg_saron_empowering_shadows_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(target, target->GetMap()->Is25ManRaid() ? 64486 : 64468, true); // SPELL_EMPOWERING_SHADOWS_HEAL - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, target->GetMap()->Is25ManRaid() ? 64486 : 64468, true); // SPELL_EMPOWERING_SHADOWS_HEAL + } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_empowering_shadows_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_empowering_shadows_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -2777,16 +2777,16 @@ class spell_yogg_saron_in_the_maws_of_the_old_god : public SpellScriptLoader SpellCastResult CheckCast() { - if (GetCaster()->GetTypeId() != TYPEID_PLAYER) - return SPELL_FAILED_BAD_TARGETS; + if (GetCaster()->GetTypeId() != TYPEID_PLAYER) + return SPELL_FAILED_BAD_TARGETS; - Unit* target = GetCaster()->ToPlayer()->GetSelectedUnit(); - if (!target || target->GetEntry() != NPC_YOGG_SARON) - return SPELL_FAILED_BAD_TARGETS; + Unit* target = GetCaster()->ToPlayer()->GetSelectedUnit(); + if (!target || target->GetEntry() != NPC_YOGG_SARON) + return SPELL_FAILED_BAD_TARGETS; - Spell* spell = target->GetCurrentSpell(CURRENT_GENERIC_SPELL); - if (!spell || spell->GetSpellInfo()->Id != SPELL_DEAFENING_ROAR) - return SPELL_FAILED_TARGET_AURASTATE; + Spell* spell = target->GetCurrentSpell(CURRENT_GENERIC_SPELL); + if (!spell || spell->GetSpellInfo()->Id != SPELL_DEAFENING_ROAR) + return SPELL_FAILED_TARGET_AURASTATE; return SPELL_CAST_OK; } @@ -2815,10 +2815,10 @@ class spell_yogg_saron_target_selectors : public SpellScriptLoader // 63744, void HandleScript(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - { - GetCaster()->SetFacingToObject(target); + { + GetCaster()->SetFacingToObject(target); GetCaster()->CastSpell(target, uint32(GetEffectValue())); - } + } } void Register() @@ -2874,7 +2874,7 @@ class achievement_yogg_saron_drive_me_crazy : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target) { - return target && target->GetAI()->GetData(ACTION_FAILED_DRIVE_ME_CRAZY); // target = Yogg-Saron + return target && target->GetAI()->GetData(ACTION_FAILED_DRIVE_ME_CRAZY); // target = Yogg-Saron } }; @@ -2888,13 +2888,13 @@ class achievement_yogg_saron_darkness : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target /*Yogg-Saron*/) { - if (player->GetInstanceScript()) - if (Creature* sara = ObjectAccessor::GetCreature(*player, player->GetInstanceScript()->GetData64(NPC_SARA))) - return sara->GetAI()->GetData(DATA_GET_KEEPERS_COUNT) <= _keepersCount; - - return false; + if (player->GetInstanceScript()) + if (Creature* sara = ObjectAccessor::GetCreature(*player, player->GetInstanceScript()->GetData64(NPC_SARA))) + return sara->GetAI()->GetData(DATA_GET_KEEPERS_COUNT) <= _keepersCount; + + return false; } - + private: uint32 const _keepersCount; }; @@ -2909,13 +2909,13 @@ class achievement_yogg_saron_he_waits_dreaming : public AchievementCriteriaScrip bool OnCheck(Player* player, Unit* target /*Yogg-Saron*/) { - if (player->GetInstanceScript()) - if (Creature* sara = ObjectAccessor::GetCreature(*player, player->GetInstanceScript()->GetData64(NPC_BRAIN_OF_YOGG_SARON))) - return sara->GetAI()->GetData(DATA_GET_CURRENT_ILLUSION) == _requiredIllusion; - - return false; + if (player->GetInstanceScript()) + if (Creature* sara = ObjectAccessor::GetCreature(*player, player->GetInstanceScript()->GetData64(NPC_BRAIN_OF_YOGG_SARON))) + return sara->GetAI()->GetData(DATA_GET_CURRENT_ILLUSION) == _requiredIllusion; + + return false; } - + private: uint8 const _requiredIllusion; }; @@ -2928,55 +2928,55 @@ class achievement_yogg_saron_kiss_and_make_up : public AchievementCriteriaScript bool OnCheck(Player* player, Unit* target /*Sara*/) { - return target && target->GetEntry() == NPC_SARA && target->GetAI() && target->GetAI()->GetData(DATA_GET_SARA_PHASE); + return target && target->GetEntry() == NPC_SARA && target->GetAI() && target->GetAI()->GetData(DATA_GET_SARA_PHASE); } }; void AddSC_boss_yoggsaron() { - new boss_yoggsaron(); - new boss_yoggsaron_sara(); - new boss_yoggsaron_cloud(); - new boss_yoggsaron_guardian_of_ys(); - new boss_yoggsaron_brain(); - new boss_yoggsaron_death_orb(); - new boss_yoggsaron_crusher_tentacle(); - new boss_yoggsaron_corruptor_tentacle(); - new boss_yoggsaron_constrictor_tentacle(); - new boss_yoggsaron_keeper(); - new boss_yoggsaron_descend_portal(); - new boss_yoggsaron_influence_tentacle(); - new boss_yoggsaron_immortal_guardian(); - new boss_yoggsaron_lich_king(); - new boss_yoggsaron_llane(); - new boss_yoggsaron_neltharion(); - new boss_yoggsaron_voice(); + new boss_yoggsaron(); + new boss_yoggsaron_sara(); + new boss_yoggsaron_cloud(); + new boss_yoggsaron_guardian_of_ys(); + new boss_yoggsaron_brain(); + new boss_yoggsaron_death_orb(); + new boss_yoggsaron_crusher_tentacle(); + new boss_yoggsaron_corruptor_tentacle(); + new boss_yoggsaron_constrictor_tentacle(); + new boss_yoggsaron_keeper(); + new boss_yoggsaron_descend_portal(); + new boss_yoggsaron_influence_tentacle(); + new boss_yoggsaron_immortal_guardian(); + new boss_yoggsaron_lich_king(); + new boss_yoggsaron_llane(); + new boss_yoggsaron_neltharion(); + new boss_yoggsaron_voice(); - // SPELLS - new spell_yogg_saron_malady_of_the_mind(); - new spell_yogg_saron_brain_link(); - new spell_yogg_saron_destabilization_matrix(); - new spell_yogg_saron_titanic_storm(); - new spell_yogg_saron_lunatic_gaze(); - new spell_yogg_saron_protective_gaze(); - new spell_yogg_saron_empowered(); - new spell_yogg_saron_insane_periodic_trigger(); - new spell_yogg_saron_insane(); - new spell_yogg_saron_sanity_well(); - new spell_yogg_saron_sanity_reduce(); - new spell_yogg_saron_empowering_shadows(); - new spell_yogg_saron_in_the_maws_of_the_old_god(); - new spell_yogg_saron_target_selectors(); - new spell_yogg_saron_grim_reprisal(); + // SPELLS + new spell_yogg_saron_malady_of_the_mind(); + new spell_yogg_saron_brain_link(); + new spell_yogg_saron_destabilization_matrix(); + new spell_yogg_saron_titanic_storm(); + new spell_yogg_saron_lunatic_gaze(); + new spell_yogg_saron_protective_gaze(); + new spell_yogg_saron_empowered(); + new spell_yogg_saron_insane_periodic_trigger(); + new spell_yogg_saron_insane(); + new spell_yogg_saron_sanity_well(); + new spell_yogg_saron_sanity_reduce(); + new spell_yogg_saron_empowering_shadows(); + new spell_yogg_saron_in_the_maws_of_the_old_god(); + new spell_yogg_saron_target_selectors(); + new spell_yogg_saron_grim_reprisal(); - // ACHIEVEMENTS - new achievement_yogg_saron_drive_me_crazy(); - new achievement_yogg_saron_darkness("achievement_yogg_saron_three_lights_in_the_darkness", 3); - new achievement_yogg_saron_darkness("achievement_yogg_saron_two_lights_in_the_darkness", 2); - new achievement_yogg_saron_darkness("achievement_yogg_saron_one_light_in_the_darkness", 1); - new achievement_yogg_saron_darkness("achievement_yogg_saron_alone_in_the_darkness", 0); - new achievement_yogg_saron_he_waits_dreaming("achievement_yogg_saron_he_waits_dreaming_stormwind", ACTION_ILLUSION_STORMWIND); - new achievement_yogg_saron_he_waits_dreaming("achievement_yogg_saron_he_waits_dreaming_chamber", ACTION_ILLUSION_DRAGONS); - new achievement_yogg_saron_he_waits_dreaming("achievement_yogg_saron_he_waits_dreaming_icecrown", ACTION_ILLUSION_ICECROWN); - new achievement_yogg_saron_kiss_and_make_up(); + // ACHIEVEMENTS + new achievement_yogg_saron_drive_me_crazy(); + new achievement_yogg_saron_darkness("achievement_yogg_saron_three_lights_in_the_darkness", 3); + new achievement_yogg_saron_darkness("achievement_yogg_saron_two_lights_in_the_darkness", 2); + new achievement_yogg_saron_darkness("achievement_yogg_saron_one_light_in_the_darkness", 1); + new achievement_yogg_saron_darkness("achievement_yogg_saron_alone_in_the_darkness", 0); + new achievement_yogg_saron_he_waits_dreaming("achievement_yogg_saron_he_waits_dreaming_stormwind", ACTION_ILLUSION_STORMWIND); + new achievement_yogg_saron_he_waits_dreaming("achievement_yogg_saron_he_waits_dreaming_chamber", ACTION_ILLUSION_DRAGONS); + new achievement_yogg_saron_he_waits_dreaming("achievement_yogg_saron_he_waits_dreaming_icecrown", ACTION_ILLUSION_ICECROWN); + new achievement_yogg_saron_kiss_and_make_up(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index d3af367a2..1ad604980 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -25,318 +25,318 @@ public: { instance_ulduar_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 C_of_Ulduar_MASK; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 C_of_Ulduar_MASK; - // Bosses - uint64 m_uiLeviathanGUID; - uint64 m_uiIgnisGUID; - uint64 m_uiRazorscaleGUID; - uint64 m_uiXT002GUID; - uint64 m_auiAssemblyGUIDs[3]; - uint64 m_uiKologarnGUID; - uint64 m_uiAuriayaGUID; - uint64 m_uiMimironGUID; - uint64 m_uiHodirGUID; - uint64 m_uiThorimGUID; - uint64 m_uiFreyaGUID; - uint64 m_uiVezaxGUID; - uint64 m_uiYoggSaronGUID; - uint64 m_uiAlgalonGUID; + // Bosses + uint64 m_uiLeviathanGUID; + uint64 m_uiIgnisGUID; + uint64 m_uiRazorscaleGUID; + uint64 m_uiXT002GUID; + uint64 m_auiAssemblyGUIDs[3]; + uint64 m_uiKologarnGUID; + uint64 m_uiAuriayaGUID; + uint64 m_uiMimironGUID; + uint64 m_uiHodirGUID; + uint64 m_uiThorimGUID; + uint64 m_uiFreyaGUID; + uint64 m_uiVezaxGUID; + uint64 m_uiYoggSaronGUID; + uint64 m_uiAlgalonGUID; - // Flame Leviathan - uint64 m_leviathanDoorsGUID; - uint64 m_leviathanVisualTowers[4][2]; - uint64 m_RepairSGUID[2]; - uint64 m_lightningWalls[2]; - bool m_leviathanTowers[4]; - std::list _leviathanVehicles; - uint32 m_unbrokenAchievement; + // Flame Leviathan + uint64 m_leviathanDoorsGUID; + uint64 m_leviathanVisualTowers[4][2]; + uint64 m_RepairSGUID[2]; + uint64 m_lightningWalls[2]; + bool m_leviathanTowers[4]; + std::list _leviathanVehicles; + uint32 m_unbrokenAchievement; - // Razorscale - uint64 m_RazorscaleHarpoonFireStateGUID[4]; + // Razorscale + uint64 m_RazorscaleHarpoonFireStateGUID[4]; - // XT-002 - uint64 m_xt002DoorsGUID; + // XT-002 + uint64 m_xt002DoorsGUID; - // Assembly of Iron - uint64 m_assemblyDoorsGUID; - uint64 m_archivumDoorsGUID; + // Assembly of Iron + uint64 m_assemblyDoorsGUID; + uint64 m_archivumDoorsGUID; - // Thorim - uint64 m_thorimGameobjectsGUID[5]; + // Thorim + uint64 m_thorimGameobjectsGUID[5]; - // Mimiron - uint64 m_MimironDoor[3]; - uint64 m_MimironLeviathanMKIIguid; - uint64 m_MimironVX001guid; - uint64 m_MimironACUguid; + // Mimiron + uint64 m_MimironDoor[3]; + uint64 m_MimironLeviathanMKIIguid; + uint64 m_MimironVX001guid; + uint64 m_MimironACUguid; - // Freya - uint64 m_FreyaElder[3]; - uint32 m_conspeedatoryAttempt; + // Freya + uint64 m_FreyaElder[3]; + uint32 m_conspeedatoryAttempt; - // Yogg-Saron - uint64 m_saraGUID; - uint64 m_yoggsaronBrainGUID; - uint64 m_yoggsaronDoorsGUID; + // Yogg-Saron + uint64 m_saraGUID; + uint64 m_yoggsaronBrainGUID; + uint64 m_yoggsaronDoorsGUID; - // Algalon - uint64 m_algalonSigilDoorGUID[3]; + // Algalon + uint64 m_algalonSigilDoorGUID[3]; uint64 m_algalonFloorGUID[2]; uint64 m_algalonUniverseGUID; uint64 m_algalonTrapdoorGUID; uint64 m_brannBronzebeardAlgGUID; uint32 m_algalonTimer; - - // Shared - EventMap _events; - bool m_mimironTramUsed; - uint64 m_mimironTramGUID; - uint64 m_keepersgateGUID; - uint64 m_keepersGossipGUID[4]; - - - void Initialize() - { - // Bosses - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - C_of_Ulduar_MASK = 0; - memset(&m_auiAssemblyGUIDs, 0, sizeof(m_auiAssemblyGUIDs)); - m_uiLeviathanGUID = 0; - m_uiIgnisGUID = 0; - m_uiRazorscaleGUID = 0; - m_uiXT002GUID = 0; - m_uiKologarnGUID = 0; - m_uiAuriayaGUID = 0; - m_uiMimironGUID = 0; - m_uiHodirGUID = 0; - m_uiThorimGUID = 0; - m_uiFreyaGUID = 0; - m_uiVezaxGUID = 0; - m_uiYoggSaronGUID = 0; - m_uiAlgalonGUID = 0; + + // Shared + EventMap _events; + bool m_mimironTramUsed; + uint64 m_mimironTramGUID; + uint64 m_keepersgateGUID; + uint64 m_keepersGossipGUID[4]; + + + void Initialize() + { + // Bosses + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + C_of_Ulduar_MASK = 0; + memset(&m_auiAssemblyGUIDs, 0, sizeof(m_auiAssemblyGUIDs)); + m_uiLeviathanGUID = 0; + m_uiIgnisGUID = 0; + m_uiRazorscaleGUID = 0; + m_uiXT002GUID = 0; + m_uiKologarnGUID = 0; + m_uiAuriayaGUID = 0; + m_uiMimironGUID = 0; + m_uiHodirGUID = 0; + m_uiThorimGUID = 0; + m_uiFreyaGUID = 0; + m_uiVezaxGUID = 0; + m_uiYoggSaronGUID = 0; + m_uiAlgalonGUID = 0; - // Flame Leviathan - memset(&m_leviathanTowers, 1, sizeof(m_leviathanTowers)); - memset(&m_leviathanVisualTowers, 0, sizeof(m_leviathanVisualTowers)); - memset(&m_RepairSGUID, 0, sizeof(m_RepairSGUID)); - memset(&m_lightningWalls, 0, sizeof(m_lightningWalls)); - m_leviathanDoorsGUID = 0; - _leviathanVehicles.clear(); - m_unbrokenAchievement = 1; + // Flame Leviathan + memset(&m_leviathanTowers, 1, sizeof(m_leviathanTowers)); + memset(&m_leviathanVisualTowers, 0, sizeof(m_leviathanVisualTowers)); + memset(&m_RepairSGUID, 0, sizeof(m_RepairSGUID)); + memset(&m_lightningWalls, 0, sizeof(m_lightningWalls)); + m_leviathanDoorsGUID = 0; + _leviathanVehicles.clear(); + m_unbrokenAchievement = 1; - // Razorscale - memset(&m_RazorscaleHarpoonFireStateGUID, 0, sizeof(m_RazorscaleHarpoonFireStateGUID)); + // Razorscale + memset(&m_RazorscaleHarpoonFireStateGUID, 0, sizeof(m_RazorscaleHarpoonFireStateGUID)); - // XT-002 - m_xt002DoorsGUID = 0; + // XT-002 + m_xt002DoorsGUID = 0; - // Assembly of Iron - m_assemblyDoorsGUID = 0; - m_archivumDoorsGUID = 0; + // Assembly of Iron + m_assemblyDoorsGUID = 0; + m_archivumDoorsGUID = 0; - // Thorim - memset(&m_thorimGameobjectsGUID, 0, sizeof(m_thorimGameobjectsGUID)); + // Thorim + memset(&m_thorimGameobjectsGUID, 0, sizeof(m_thorimGameobjectsGUID)); - // Mimiron - memset(&m_MimironDoor, 0, sizeof(m_MimironDoor)); - m_MimironLeviathanMKIIguid = 0; - m_MimironVX001guid = 0; - m_MimironACUguid = 0; + // Mimiron + memset(&m_MimironDoor, 0, sizeof(m_MimironDoor)); + m_MimironLeviathanMKIIguid = 0; + m_MimironVX001guid = 0; + m_MimironACUguid = 0; - // Freya - memset(&m_FreyaElder, 0, sizeof(m_FreyaElder)); - m_conspeedatoryAttempt = 0; + // Freya + memset(&m_FreyaElder, 0, sizeof(m_FreyaElder)); + m_conspeedatoryAttempt = 0; - // Yogg-Saron - m_saraGUID = 0; - m_yoggsaronBrainGUID = 0; - m_yoggsaronDoorsGUID = 0; + // Yogg-Saron + m_saraGUID = 0; + m_yoggsaronBrainGUID = 0; + m_yoggsaronDoorsGUID = 0; - // Algalon - memset(&m_algalonSigilDoorGUID, 0, sizeof(m_algalonSigilDoorGUID)); - memset(&m_algalonFloorGUID, 0, sizeof(m_algalonFloorGUID)); - m_algalonUniverseGUID = 0; - m_algalonTrapdoorGUID = 0; - m_brannBronzebeardAlgGUID = 0; - m_algalonTimer = 0; - - // Shared - _events.Reset(); - memset(&m_keepersGossipGUID, 0, sizeof(m_keepersGossipGUID)); - m_mimironTramUsed = false; - m_mimironTramGUID = 0; - m_keepersgateGUID = 0; - } + // Algalon + memset(&m_algalonSigilDoorGUID, 0, sizeof(m_algalonSigilDoorGUID)); + memset(&m_algalonFloorGUID, 0, sizeof(m_algalonFloorGUID)); + m_algalonUniverseGUID = 0; + m_algalonTrapdoorGUID = 0; + m_brannBronzebeardAlgGUID = 0; + m_algalonTimer = 0; + + // Shared + _events.Reset(); + memset(&m_keepersGossipGUID, 0, sizeof(m_keepersGossipGUID)); + m_mimironTramUsed = false; + m_mimironTramGUID = 0; + m_keepersgateGUID = 0; + } - void FillInitialWorldStates(WorldPacket& packet) - { - packet << uint32(WORLD_STATE_ALGALON_TIMER_ENABLED) << uint32(m_algalonTimer && m_algalonTimer <= 60); - packet << uint32(WORLD_STATE_ALGALON_DESPAWN_TIMER) << uint32(std::min(m_algalonTimer, 60)); - } + void FillInitialWorldStates(WorldPacket& packet) + { + packet << uint32(WORLD_STATE_ALGALON_TIMER_ENABLED) << uint32(m_algalonTimer && m_algalonTimer <= 60); + packet << uint32(WORLD_STATE_ALGALON_DESPAWN_TIMER) << uint32(std::min(m_algalonTimer, 60)); + } - void OnPlayerEnter(Player* player) - { - // mimiron tram: - instance->LoadGrid(2307.0f, 284.632f); - if (GameObject* MimironTram = instance->GetGameObject(m_mimironTramGUID)) - player->UpdateVisibilityOf(MimironTram); + void OnPlayerEnter(Player* player) + { + // mimiron tram: + instance->LoadGrid(2307.0f, 284.632f); + if (GameObject* MimironTram = instance->GetGameObject(m_mimironTramGUID)) + player->UpdateVisibilityOf(MimironTram); - if (!m_uiAlgalonGUID && m_algalonTimer && (m_algalonTimer <= 60 || m_algalonTimer == TIMER_ALGALON_TO_SUMMON)) - { - TempSummon* algalon = instance->SummonCreature(NPC_ALGALON, AlgalonLandPos); - if (!algalon) - return; + if (!m_uiAlgalonGUID && m_algalonTimer && (m_algalonTimer <= 60 || m_algalonTimer == TIMER_ALGALON_TO_SUMMON)) + { + TempSummon* algalon = instance->SummonCreature(NPC_ALGALON, AlgalonLandPos); + if (!algalon) + return; if (m_algalonTimer <= 60) - { - _events.RescheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); + { + _events.RescheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); algalon->AI()->DoAction(ACTION_INIT_ALGALON); - } + } else // if (m_algalonTimer = TIMER_ALGALON_TO_SUMMON) - { - m_algalonTimer = TIMER_ALGALON_SUMMONED; + { + m_algalonTimer = TIMER_ALGALON_SUMMONED; algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - } + } } } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < (MAX_ENCOUNTER-1); ++i) - { - if (m_auiEncounter[i] == IN_PROGRESS) - return true; - } + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < (MAX_ENCOUNTER-1); ++i) + { + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + } - // Leviathan does not use IN_PROGRESS type, instead SPECIAL is set and never reset, - // Check if he is in combat. - if (Unit* l = instance->GetCreature(m_uiLeviathanGUID)) - if (l->IsInCombat()) - return true; + // Leviathan does not use IN_PROGRESS type, instead SPECIAL is set and never reset, + // Check if he is in combat. + if (Unit* l = instance->GetCreature(m_uiLeviathanGUID)) + if (l->IsInCombat()) + return true; - return false; - } + return false; + } - void ProcessEvent(WorldObject* obj, uint32 eventId) - { - // destory towers - if (eventId >= EVENT_TOWER_OF_LIFE_DESTROYED && eventId <= EVENT_TOWER_OF_FLAMES_DESTROYED) - SetData(eventId, 0); - } + void ProcessEvent(WorldObject* obj, uint32 eventId) + { + // destory towers + if (eventId >= EVENT_TOWER_OF_LIFE_DESTROYED && eventId <= EVENT_TOWER_OF_FLAMES_DESTROYED) + SetData(eventId, 0); + } - void OnCreatureCreate(Creature* creature) - { - switch(creature->GetEntry()) - { - case NPC_LEVIATHAN: - m_uiLeviathanGUID = creature->GetGUID(); - break; - case NPC_IGNIS: - m_uiIgnisGUID = creature->GetGUID(); - break; - case NPC_RAZORSCALE: - m_uiRazorscaleGUID = creature->GetGUID(); - break; - case NPC_XT002: - m_uiXT002GUID = creature->GetGUID(); - break; - case NPC_STEELBREAKER: - m_auiAssemblyGUIDs[0] = creature->GetGUID(); - break; - case NPC_MOLGEIM: - m_auiAssemblyGUIDs[1] = creature->GetGUID(); - break; - case NPC_BRUNDIR: - m_auiAssemblyGUIDs[2] = creature->GetGUID(); - break; - case NPC_KOLOGARN: - m_uiKologarnGUID = creature->GetGUID(); - if (GetData(TYPE_KOLOGARN) == DONE) - { - creature->SetDisableGravity(true); - creature->SetPosition(creature->GetHomePosition()); - creature->setDeathState(JUST_DIED); - creature->StopMovingOnCurrentPos(); - } - break; - case NPC_AURIAYA: - m_uiAuriayaGUID = creature->GetGUID(); - break; - case NPC_MIMIRON: - m_uiMimironGUID = creature->GetGUID(); - break; - case NPC_HODIR: - m_uiHodirGUID = creature->GetGUID(); - break; - case NPC_THORIM: - m_uiThorimGUID = creature->GetGUID(); - break; - case NPC_FREYA: - m_uiFreyaGUID = creature->GetGUID(); - break; - case NPC_VEZAX: - m_uiVezaxGUID = creature->GetGUID(); - break; - case NPC_YOGGSARON: - m_uiYoggSaronGUID = creature->GetGUID(); - break; - case NPC_ALGALON: - m_uiAlgalonGUID = creature->GetGUID(); - break; - case NPC_HARPOON_FIRE_STATE: - { - if( creature->GetPositionX() > 595 ) - m_RazorscaleHarpoonFireStateGUID[3] = creature->GetGUID(); - else if( creature->GetPositionX() > 585 ) - m_RazorscaleHarpoonFireStateGUID[2] = creature->GetGUID(); - else if( creature->GetPositionX() > 575 ) - m_RazorscaleHarpoonFireStateGUID[1] = creature->GetGUID(); - else - m_RazorscaleHarpoonFireStateGUID[0] = creature->GetGUID(); - } - break; - case NPC_MIMIRON_LEVIATHAN_MKII: - m_MimironLeviathanMKIIguid = creature->GetGUID(); - break; - case NPC_MIMIRON_VX001: - m_MimironVX001guid = creature->GetGUID(); - break; - case NPC_MIMIRON_ACU: - m_MimironACUguid = creature->GetGUID(); - break; - case NPC_FREYA_GOSSIP: - m_keepersGossipGUID[TYPE_FREYA-TYPE_FREYA] = creature->GetGUID(); - ShowKeeperGossip(TYPE_FREYA, creature); - break; - case NPC_HODIR_GOSSIP: - m_keepersGossipGUID[TYPE_HODIR-TYPE_FREYA] = creature->GetGUID(); - ShowKeeperGossip(TYPE_HODIR, creature); - break; - case NPC_THORIM_GOSSIP: - m_keepersGossipGUID[TYPE_THORIM-TYPE_FREYA] = creature->GetGUID(); - ShowKeeperGossip(TYPE_THORIM, creature); - break; - case NPC_MIMIRON_GOSSIP: - m_keepersGossipGUID[TYPE_MIMIRON-TYPE_FREYA] = creature->GetGUID(); - ShowKeeperGossip(TYPE_MIMIRON, creature); - break; - case NPC_ELDER_IRONBRANCH: - case NPC_ELDER_STONEBARK: - case NPC_ELDER_BRIGHTLEAF: - m_FreyaElder[creature->GetEntry()-NPC_ELDER_IRONBRANCH] = creature->GetGUID(); - break; - case NPC_SARA: - m_saraGUID = creature->GetGUID(); - break; - case NPC_BRAIN_OF_YOGG_SARON: - m_yoggsaronBrainGUID = creature->GetGUID(); - break; - case NPC_BRANN_BRONZBEARD_ALG: + void OnCreatureCreate(Creature* creature) + { + switch(creature->GetEntry()) + { + case NPC_LEVIATHAN: + m_uiLeviathanGUID = creature->GetGUID(); + break; + case NPC_IGNIS: + m_uiIgnisGUID = creature->GetGUID(); + break; + case NPC_RAZORSCALE: + m_uiRazorscaleGUID = creature->GetGUID(); + break; + case NPC_XT002: + m_uiXT002GUID = creature->GetGUID(); + break; + case NPC_STEELBREAKER: + m_auiAssemblyGUIDs[0] = creature->GetGUID(); + break; + case NPC_MOLGEIM: + m_auiAssemblyGUIDs[1] = creature->GetGUID(); + break; + case NPC_BRUNDIR: + m_auiAssemblyGUIDs[2] = creature->GetGUID(); + break; + case NPC_KOLOGARN: + m_uiKologarnGUID = creature->GetGUID(); + if (GetData(TYPE_KOLOGARN) == DONE) + { + creature->SetDisableGravity(true); + creature->SetPosition(creature->GetHomePosition()); + creature->setDeathState(JUST_DIED); + creature->StopMovingOnCurrentPos(); + } + break; + case NPC_AURIAYA: + m_uiAuriayaGUID = creature->GetGUID(); + break; + case NPC_MIMIRON: + m_uiMimironGUID = creature->GetGUID(); + break; + case NPC_HODIR: + m_uiHodirGUID = creature->GetGUID(); + break; + case NPC_THORIM: + m_uiThorimGUID = creature->GetGUID(); + break; + case NPC_FREYA: + m_uiFreyaGUID = creature->GetGUID(); + break; + case NPC_VEZAX: + m_uiVezaxGUID = creature->GetGUID(); + break; + case NPC_YOGGSARON: + m_uiYoggSaronGUID = creature->GetGUID(); + break; + case NPC_ALGALON: + m_uiAlgalonGUID = creature->GetGUID(); + break; + case NPC_HARPOON_FIRE_STATE: + { + if( creature->GetPositionX() > 595 ) + m_RazorscaleHarpoonFireStateGUID[3] = creature->GetGUID(); + else if( creature->GetPositionX() > 585 ) + m_RazorscaleHarpoonFireStateGUID[2] = creature->GetGUID(); + else if( creature->GetPositionX() > 575 ) + m_RazorscaleHarpoonFireStateGUID[1] = creature->GetGUID(); + else + m_RazorscaleHarpoonFireStateGUID[0] = creature->GetGUID(); + } + break; + case NPC_MIMIRON_LEVIATHAN_MKII: + m_MimironLeviathanMKIIguid = creature->GetGUID(); + break; + case NPC_MIMIRON_VX001: + m_MimironVX001guid = creature->GetGUID(); + break; + case NPC_MIMIRON_ACU: + m_MimironACUguid = creature->GetGUID(); + break; + case NPC_FREYA_GOSSIP: + m_keepersGossipGUID[TYPE_FREYA-TYPE_FREYA] = creature->GetGUID(); + ShowKeeperGossip(TYPE_FREYA, creature); + break; + case NPC_HODIR_GOSSIP: + m_keepersGossipGUID[TYPE_HODIR-TYPE_FREYA] = creature->GetGUID(); + ShowKeeperGossip(TYPE_HODIR, creature); + break; + case NPC_THORIM_GOSSIP: + m_keepersGossipGUID[TYPE_THORIM-TYPE_FREYA] = creature->GetGUID(); + ShowKeeperGossip(TYPE_THORIM, creature); + break; + case NPC_MIMIRON_GOSSIP: + m_keepersGossipGUID[TYPE_MIMIRON-TYPE_FREYA] = creature->GetGUID(); + ShowKeeperGossip(TYPE_MIMIRON, creature); + break; + case NPC_ELDER_IRONBRANCH: + case NPC_ELDER_STONEBARK: + case NPC_ELDER_BRIGHTLEAF: + m_FreyaElder[creature->GetEntry()-NPC_ELDER_IRONBRANCH] = creature->GetGUID(); + break; + case NPC_SARA: + m_saraGUID = creature->GetGUID(); + break; + case NPC_BRAIN_OF_YOGG_SARON: + m_yoggsaronBrainGUID = creature->GetGUID(); + break; + case NPC_BRANN_BRONZBEARD_ALG: m_brannBronzebeardAlgGUID = creature->GetGUID(); break; - //! These creatures are summoned by something else than Algalon + //! These creatures are summoned by something else than Algalon //! but need to be controlled/despawned by him - so they need to be //! registered in his summon list case NPC_ALGALON_VOID_ZONE_VISUAL_STALKER: @@ -346,10 +346,10 @@ public: if (Creature* algalon = instance->GetCreature(m_uiAlgalonGUID)) algalon->AI()->JustSummoned(creature); break; - } - } + } + } - void OnCreatureRemove(Creature* creature) + void OnCreatureRemove(Creature* creature) { switch (creature->GetEntry()) { @@ -360,165 +360,165 @@ public: } } - void OpenIfDone(uint32 encounter, GameObject *go, GOState state) - { - if (GetData(encounter) == DONE) - go->SetGoState(state); - } + void OpenIfDone(uint32 encounter, GameObject *go, GOState state) + { + if (GetData(encounter) == DONE) + go->SetGoState(state); + } - void ShowKeeperGossip(uint8 type, Creature *cr, uint64 guid = 0) - { - if (!cr) - { - cr = instance->GetCreature(guid); - if (!cr) - return; - } + void ShowKeeperGossip(uint8 type, Creature *cr, uint64 guid = 0) + { + if (!cr) + { + cr = instance->GetCreature(guid); + if (!cr) + return; + } - bool on = (GetData(type) == DONE && !(GetData(TYPE_WATCHERS) & (1 << (type-TYPE_FREYA)))); - cr->SetVisible(on ? true : false); - } + bool on = (GetData(type) == DONE && !(GetData(TYPE_WATCHERS) & (1 << (type-TYPE_FREYA)))); + cr->SetVisible(on ? true : false); + } - void OnGameObjectCreate(GameObject* gameObject) - { - switch (gameObject->GetEntry()) - { - // Flame Leviathan - case GO_REPAIR_STATION_TRAP: - { - if(m_RepairSGUID[0]) - m_RepairSGUID[1] = gameObject->GetGUID(); - else - m_RepairSGUID[0] = gameObject->GetGUID(); - break; - } - case GO_LIGHTNING_WALL1: - m_lightningWalls[0] = gameObject->GetGUID(); - OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); - break; - case GO_LIGHTNING_WALL2: - m_lightningWalls[1] = gameObject->GetGUID(); - break; - case GO_MIMIRONS_TARGETTING_CRYSTAL: - OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); - m_leviathanVisualTowers[3][0] = gameObject->GetGUID(); - break; - case GO_FREYAS_TARGETTING_CRYSTAL: - OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); - m_leviathanVisualTowers[0][0] = gameObject->GetGUID(); - break; - case GO_HODIRS_TARGETTING_CRYSTAL: - OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); - m_leviathanVisualTowers[2][0] = gameObject->GetGUID(); - break; - case GO_THORIMS_TARGETTING_CRYSTAL: - OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); - m_leviathanVisualTowers[1][0] = gameObject->GetGUID(); - break; - case GO_MIMIRONS_GENERATOR: - OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); - m_leviathanVisualTowers[3][1] = gameObject->GetGUID(); - break; - case GO_FREYAS_GENERATOR: - OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); - m_leviathanVisualTowers[0][1] = gameObject->GetGUID(); - break; - case GO_HODIRS_GENERATOR: - OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); - m_leviathanVisualTowers[2][1] = gameObject->GetGUID(); - break; - case GO_THORIMS_GENERATOR: - OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); - m_leviathanVisualTowers[1][1] = gameObject->GetGUID(); - break; - case GO_LEVIATHAN_DOORS: - if (GetData(TYPE_LEVIATHAN) >= DONE) - gameObject->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - m_leviathanDoorsGUID = gameObject->GetGUID(); - break; - // XT-002, Kologarn, Assembly of Iron - case GO_XT002_DOORS: - m_xt002DoorsGUID = gameObject->GetGUID(); - break; - case GO_KOLOGARN_BRIDGE: - OpenIfDone(TYPE_KOLOGARN, gameObject, GO_STATE_READY); - break; - case GO_ASSEMBLY_DOORS: - m_assemblyDoorsGUID = gameObject->GetGUID(); - break; - case GO_ARCHIVUM_DOORS: - m_archivumDoorsGUID = gameObject->GetGUID(); - OpenIfDone(TYPE_ASSEMBLY, gameObject, GO_STATE_ACTIVE); - break; - // Thorim - case GO_ARENA_LEVER_GATE: - m_thorimGameobjectsGUID[DATA_THORIM_LEVER_GATE-DATA_THORIM_LEVER_GATE] = gameObject->GetGUID(); - break; - case GO_ARENA_LEVER: - m_thorimGameobjectsGUID[DATA_THORIM_LEVER-DATA_THORIM_LEVER_GATE] = gameObject->GetGUID(); - break; - case GO_ARENA_FENCE: - m_thorimGameobjectsGUID[DATA_THORIM_FENCE-DATA_THORIM_LEVER_GATE] = gameObject->GetGUID(); - break; - case GO_FIRST_COLOSSUS_DOORS: - m_thorimGameobjectsGUID[DATA_THORIM_FIRST_DOORS-DATA_THORIM_LEVER_GATE] = gameObject->GetGUID(); - break; - case GO_SECOND_COLOSSUS_DOORS: - m_thorimGameobjectsGUID[DATA_THORIM_SECOND_DOORS-DATA_THORIM_LEVER_GATE] = gameObject->GetGUID(); - break; - // Yogg-Saron - case GO_YOGG_SARON_DOORS: - m_yoggsaronDoorsGUID = gameObject->GetGUID(); - break; - case GO_KEEPERS_GATE: - if (GetData(TYPE_MIMIRON) == DONE && GetData(TYPE_FREYA) == DONE && GetData(TYPE_HODIR) == DONE && GetData(TYPE_THORIM) == DONE) - { - instance->LoadGrid(1903.0f, 248.0f); - gameObject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); - } + void OnGameObjectCreate(GameObject* gameObject) + { + switch (gameObject->GetEntry()) + { + // Flame Leviathan + case GO_REPAIR_STATION_TRAP: + { + if(m_RepairSGUID[0]) + m_RepairSGUID[1] = gameObject->GetGUID(); + else + m_RepairSGUID[0] = gameObject->GetGUID(); + break; + } + case GO_LIGHTNING_WALL1: + m_lightningWalls[0] = gameObject->GetGUID(); + OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); + break; + case GO_LIGHTNING_WALL2: + m_lightningWalls[1] = gameObject->GetGUID(); + break; + case GO_MIMIRONS_TARGETTING_CRYSTAL: + OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); + m_leviathanVisualTowers[3][0] = gameObject->GetGUID(); + break; + case GO_FREYAS_TARGETTING_CRYSTAL: + OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); + m_leviathanVisualTowers[0][0] = gameObject->GetGUID(); + break; + case GO_HODIRS_TARGETTING_CRYSTAL: + OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); + m_leviathanVisualTowers[2][0] = gameObject->GetGUID(); + break; + case GO_THORIMS_TARGETTING_CRYSTAL: + OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); + m_leviathanVisualTowers[1][0] = gameObject->GetGUID(); + break; + case GO_MIMIRONS_GENERATOR: + OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); + m_leviathanVisualTowers[3][1] = gameObject->GetGUID(); + break; + case GO_FREYAS_GENERATOR: + OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); + m_leviathanVisualTowers[0][1] = gameObject->GetGUID(); + break; + case GO_HODIRS_GENERATOR: + OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); + m_leviathanVisualTowers[2][1] = gameObject->GetGUID(); + break; + case GO_THORIMS_GENERATOR: + OpenIfDone(TYPE_LEVIATHAN, gameObject, GO_STATE_ACTIVE); + m_leviathanVisualTowers[1][1] = gameObject->GetGUID(); + break; + case GO_LEVIATHAN_DOORS: + if (GetData(TYPE_LEVIATHAN) >= DONE) + gameObject->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + m_leviathanDoorsGUID = gameObject->GetGUID(); + break; + // XT-002, Kologarn, Assembly of Iron + case GO_XT002_DOORS: + m_xt002DoorsGUID = gameObject->GetGUID(); + break; + case GO_KOLOGARN_BRIDGE: + OpenIfDone(TYPE_KOLOGARN, gameObject, GO_STATE_READY); + break; + case GO_ASSEMBLY_DOORS: + m_assemblyDoorsGUID = gameObject->GetGUID(); + break; + case GO_ARCHIVUM_DOORS: + m_archivumDoorsGUID = gameObject->GetGUID(); + OpenIfDone(TYPE_ASSEMBLY, gameObject, GO_STATE_ACTIVE); + break; + // Thorim + case GO_ARENA_LEVER_GATE: + m_thorimGameobjectsGUID[DATA_THORIM_LEVER_GATE-DATA_THORIM_LEVER_GATE] = gameObject->GetGUID(); + break; + case GO_ARENA_LEVER: + m_thorimGameobjectsGUID[DATA_THORIM_LEVER-DATA_THORIM_LEVER_GATE] = gameObject->GetGUID(); + break; + case GO_ARENA_FENCE: + m_thorimGameobjectsGUID[DATA_THORIM_FENCE-DATA_THORIM_LEVER_GATE] = gameObject->GetGUID(); + break; + case GO_FIRST_COLOSSUS_DOORS: + m_thorimGameobjectsGUID[DATA_THORIM_FIRST_DOORS-DATA_THORIM_LEVER_GATE] = gameObject->GetGUID(); + break; + case GO_SECOND_COLOSSUS_DOORS: + m_thorimGameobjectsGUID[DATA_THORIM_SECOND_DOORS-DATA_THORIM_LEVER_GATE] = gameObject->GetGUID(); + break; + // Yogg-Saron + case GO_YOGG_SARON_DOORS: + m_yoggsaronDoorsGUID = gameObject->GetGUID(); + break; + case GO_KEEPERS_GATE: + if (GetData(TYPE_MIMIRON) == DONE && GetData(TYPE_FREYA) == DONE && GetData(TYPE_HODIR) == DONE && GetData(TYPE_THORIM) == DONE) + { + instance->LoadGrid(1903.0f, 248.0f); + gameObject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + } - m_keepersgateGUID = gameObject->GetGUID(); - break; - // Mimiron, Hodir, Vezax - case GO_MIMIRON_ELEVATOR: - gameObject->EnableCollision(false); - break; - case GO_MIMIRON_DOOR_1: - m_MimironDoor[0] = gameObject->GetGUID(); - break; - case GO_MIMIRON_DOOR_2: - m_MimironDoor[1] = gameObject->GetGUID(); - break; - case GO_MIMIRON_DOOR_3: - m_MimironDoor[2] = gameObject->GetGUID(); - break; - case GO_HODIR_FROZEN_DOOR: - case GO_HODIR_DOOR: - if (GetData(TYPE_HODIR) == DONE) - if( gameObject->GetGoState() != GO_STATE_ACTIVE ) - { - gameObject->SetLootState(GO_READY); - gameObject->UseDoorOrButton(0, false); - } - break; - case GO_VEZAX_DOOR: - if( GetData(TYPE_VEZAX) == DONE ) - if( gameObject->GetGoState() != GO_STATE_ACTIVE ) - { - gameObject->SetLootState(GO_READY); - gameObject->UseDoorOrButton(0, false); - } - break; - case GO_SNOW_MOUND: - gameObject->EnableCollision(false); - break; - case GO_MIMIRON_TRAM: - if (GetData(TYPE_MIMIRON) == DONE) - m_mimironTramUsed = true; + m_keepersgateGUID = gameObject->GetGUID(); + break; + // Mimiron, Hodir, Vezax + case GO_MIMIRON_ELEVATOR: + gameObject->EnableCollision(false); + break; + case GO_MIMIRON_DOOR_1: + m_MimironDoor[0] = gameObject->GetGUID(); + break; + case GO_MIMIRON_DOOR_2: + m_MimironDoor[1] = gameObject->GetGUID(); + break; + case GO_MIMIRON_DOOR_3: + m_MimironDoor[2] = gameObject->GetGUID(); + break; + case GO_HODIR_FROZEN_DOOR: + case GO_HODIR_DOOR: + if (GetData(TYPE_HODIR) == DONE) + if( gameObject->GetGoState() != GO_STATE_ACTIVE ) + { + gameObject->SetLootState(GO_READY); + gameObject->UseDoorOrButton(0, false); + } + break; + case GO_VEZAX_DOOR: + if( GetData(TYPE_VEZAX) == DONE ) + if( gameObject->GetGoState() != GO_STATE_ACTIVE ) + { + gameObject->SetLootState(GO_READY); + gameObject->UseDoorOrButton(0, false); + } + break; + case GO_SNOW_MOUND: + gameObject->EnableCollision(false); + break; + case GO_MIMIRON_TRAM: + if (GetData(TYPE_MIMIRON) == DONE) + m_mimironTramUsed = true; m_mimironTramGUID = gameObject->GetGUID(); break; - // Algalon the Observer - case GO_CELESTIAL_PLANETARIUM_ACCESS_10: + // Algalon the Observer + case GO_CELESTIAL_PLANETARIUM_ACCESS_10: case GO_CELESTIAL_PLANETARIUM_ACCESS_25: if (m_algalonTimer) gameObject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); @@ -548,423 +548,423 @@ public: case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03: m_algalonTrapdoorGUID = gameObject->GetGUID(); break; - // Herbs - case 191019: // Adder's Tongue - case 190176: // Frost Lotus - case 190171: // Lichbloom - case 190170: // Talandra's Rose - case 189973: // Goldclover - if (GetData(TYPE_FREYA) == DONE) - gameObject->SetRespawnTime(7*DAY); - break; - } - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case TYPE_LEVIATHAN: - m_auiEncounter[type] = data; - if (data == DONE) - { - Map::PlayerList const& pList = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (Vehicle* veh = itr->GetSource()->GetVehicle()) - veh->Dismiss(); - } - break; - case TYPE_IGNIS: - case TYPE_RAZORSCALE: - case TYPE_XT002: - case TYPE_AURIAYA: - case TYPE_VEZAX: - case TYPE_YOGGSARON: - case TYPE_KOLOGARN: - m_auiEncounter[type] = data; - break; - case TYPE_ASSEMBLY: - if (GameObject* go = instance->GetGameObject(m_assemblyDoorsGUID)) - go->SetGoState(data == IN_PROGRESS ? GO_STATE_READY : GO_STATE_ACTIVE); - if (GameObject* go = instance->GetGameObject(m_archivumDoorsGUID)) - go->SetGoState(data == DONE ? GO_STATE_ACTIVE : GO_STATE_READY); - - m_auiEncounter[type] = data; - break; - case TYPE_MIMIRON: - case TYPE_HODIR: - case TYPE_THORIM: - case TYPE_FREYA: - m_auiEncounter[type] = data; - ShowKeeperGossip(type, NULL, m_keepersGossipGUID[type-TYPE_FREYA]); - if (GetData(TYPE_MIMIRON) == DONE && GetData(TYPE_FREYA) == DONE && GetData(TYPE_HODIR) == DONE && GetData(TYPE_THORIM) == DONE) - { - if (GameObject* go = instance->GetGameObject(m_keepersgateGUID)) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); - } - if (type == TYPE_MIMIRON && data == IN_PROGRESS) // after reaching him without tram and starting the fight - m_mimironTramUsed = true; - break; - - case TYPE_WATCHERS: - m_auiEncounter[type] |= 1 << data; - break; - - case EVENT_TOWER_OF_LIFE_DESTROYED: - case EVENT_TOWER_OF_STORM_DESTROYED: - case EVENT_TOWER_OF_FROST_DESTROYED: - case EVENT_TOWER_OF_FLAMES_DESTROYED: - { - instance->LoadGrid(364.0f, -16.0f); //make sure leviathan is loaded - m_leviathanTowers[type-EVENT_TOWER_OF_LIFE_DESTROYED] = data; - GameObject* gobj = NULL; - if (gobj = instance->GetGameObject(m_leviathanVisualTowers[type-EVENT_TOWER_OF_LIFE_DESTROYED][0])) - gobj->SetGoState(GO_STATE_ACTIVE); - if (gobj = instance->GetGameObject(m_leviathanVisualTowers[type-EVENT_TOWER_OF_LIFE_DESTROYED][1])) - gobj->SetGoState(GO_STATE_ACTIVE); - return; - } - - case DATA_VEHICLE_SPAWN: - SpawnLeviathanEncounterVehicles(data); - return; - case DATA_UNBROKEN_ACHIEVEMENT: - m_unbrokenAchievement = data; - SaveToDB(); - return; - case DATA_DESPAWN_ALGALON: - DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1); - DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, 60); - m_algalonTimer = 60; - _events.RescheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); - SaveToDB(); - return; - case DATA_ALGALON_SUMMON_STATE: - case DATA_ALGALON_DEFEATED: - DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0); - m_algalonTimer = (type == DATA_ALGALON_DEFEATED ? TIMER_ALGALON_DEFEATED : TIMER_ALGALON_SUMMONED); - _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER); - SaveToDB(); - return; - case TYPE_ALGALON: - m_auiEncounter[type] = data; - if (GameObject* go = instance->GetGameObject(GetData64(GO_DOODAD_UL_SIGILDOOR_03))) - { - go->SetGoState(data != IN_PROGRESS ? GO_STATE_ACTIVE : GO_STATE_READY); - go->EnableCollision(false); - } - if (GameObject* go = instance->GetGameObject(GetData64(GO_DOODAD_UL_UNIVERSEFLOOR_01))) - { - go->SetGoState(data != IN_PROGRESS ? GO_STATE_ACTIVE : GO_STATE_READY); - go->EnableCollision(false); - } - if (GameObject* go = instance->GetGameObject(GetData64(GO_DOODAD_UL_UNIVERSEFLOOR_02))) - { - go->SetGoState(data == IN_PROGRESS ? GO_STATE_ACTIVE : GO_STATE_READY); - go->EnableCollision(false); - } - if (GameObject* go = instance->GetGameObject(GetData64(GO_DOODAD_UL_UNIVERSEGLOBE01))) - { - go->SetGoState(data == IN_PROGRESS ? GO_STATE_ACTIVE : GO_STATE_READY); - go->EnableCollision(false); - } - if (GameObject* go = instance->GetGameObject(GetData64(GO_DOODAD_UL_ULDUAR_TRAPDOOR_03))) - { - go->SetGoState(data == IN_PROGRESS ? GO_STATE_ACTIVE : GO_STATE_READY); - go->EnableCollision(false); - } - break; - - // Achievement - case DATA_DWARFAGEDDON: - DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, SPELL_DWARFAGEDDON); - DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_DWARFAGEDDON); - return; - case DATA_CALL_TRAM: - if (GameObject* MimironTram = instance->GetGameObject(m_mimironTramGUID)) - if (StaticTransport* t = MimironTram->ToStaticTransport()) - { - if (data == 0 && t->GetGoState() == GO_STATE_ACTIVE && t->GetPathProgress() == t->GetPauseTime()) - MimironTram->SetGoState(GO_STATE_READY); - if (data == 1 && t->GetGoState() == GO_STATE_READY && t->GetPathProgress() == 0) - MimironTram->SetGoState(GO_STATE_ACTIVE); - } + // Herbs + case 191019: // Adder's Tongue + case 190176: // Frost Lotus + case 190171: // Lichbloom + case 190170: // Talandra's Rose + case 189973: // Goldclover + if (GetData(TYPE_FREYA) == DONE) + gameObject->SetRespawnTime(7*DAY); break; - } + } + } - // take care of herbs - if (type == TYPE_FREYA && data == DONE) - { - std::list goList; - if (Creature* freya = instance->GetCreature(GetData64(TYPE_FREYA))) - { - freya->GetGameObjectListWithEntryInGrid(goList, 191019 /*Adder's Tongue*/, 333.0f); - freya->GetGameObjectListWithEntryInGrid(goList, 190176 /*Frost Lotus*/, 333.0f); - freya->GetGameObjectListWithEntryInGrid(goList, 190171 /*Lichbloom*/, 333.0f); - freya->GetGameObjectListWithEntryInGrid(goList, 190170 /*Talandra's Rose*/, 333.0f); - freya->GetGameObjectListWithEntryInGrid(goList, 189973 /*Goldclover*/, 333.0f); - - for (std::list::const_iterator itr = goList.begin(); itr != goList.end(); ++itr) - (*itr)->SetRespawnTime(7*DAY); - } - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case TYPE_LEVIATHAN: + m_auiEncounter[type] = data; + if (data == DONE) + { + Map::PlayerList const& pList = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if (Vehicle* veh = itr->GetSource()->GetVehicle()) + veh->Dismiss(); + } + break; + case TYPE_IGNIS: + case TYPE_RAZORSCALE: + case TYPE_XT002: + case TYPE_AURIAYA: + case TYPE_VEZAX: + case TYPE_YOGGSARON: + case TYPE_KOLOGARN: + m_auiEncounter[type] = data; + break; + case TYPE_ASSEMBLY: + if (GameObject* go = instance->GetGameObject(m_assemblyDoorsGUID)) + go->SetGoState(data == IN_PROGRESS ? GO_STATE_READY : GO_STATE_ACTIVE); + if (GameObject* go = instance->GetGameObject(m_archivumDoorsGUID)) + go->SetGoState(data == DONE ? GO_STATE_ACTIVE : GO_STATE_READY); - if (data == DONE || type == TYPE_LEVIATHAN || type == TYPE_WATCHERS) - SaveToDB(); + m_auiEncounter[type] = data; + break; + case TYPE_MIMIRON: + case TYPE_HODIR: + case TYPE_THORIM: + case TYPE_FREYA: + m_auiEncounter[type] = data; + ShowKeeperGossip(type, NULL, m_keepersGossipGUID[type-TYPE_FREYA]); + if (GetData(TYPE_MIMIRON) == DONE && GetData(TYPE_FREYA) == DONE && GetData(TYPE_HODIR) == DONE && GetData(TYPE_THORIM) == DONE) + { + if (GameObject* go = instance->GetGameObject(m_keepersgateGUID)) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + } + if (type == TYPE_MIMIRON && data == IN_PROGRESS) // after reaching him without tram and starting the fight + m_mimironTramUsed = true; + break; - if (type > TYPE_LEVIATHAN && type < TYPE_WATCHERS && data == IN_PROGRESS) - { - Map::PlayerList const& pList = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (Vehicle* veh = itr->GetSource()->GetVehicle()) - veh->Dismiss(); - } - } + case TYPE_WATCHERS: + m_auiEncounter[type] |= 1 << data; + break; - uint64 GetData64(uint32 data) const - { - switch(data) - { - // Bosses - case TYPE_LEVIATHAN: - return m_uiLeviathanGUID; - case TYPE_IGNIS: - return m_uiIgnisGUID; - case TYPE_RAZORSCALE: - return m_uiRazorscaleGUID; - case TYPE_XT002: - return m_uiXT002GUID; - case TYPE_KOLOGARN: - return m_uiKologarnGUID; - case TYPE_AURIAYA: - return m_uiAuriayaGUID; - case TYPE_MIMIRON: - return m_uiMimironGUID; - case TYPE_HODIR: - return m_uiHodirGUID; - case TYPE_THORIM: - return m_uiThorimGUID; - case TYPE_FREYA: - return m_uiFreyaGUID; - case TYPE_VEZAX: - return m_uiVezaxGUID; - case TYPE_YOGGSARON: - return m_uiYoggSaronGUID; - case TYPE_ALGALON: - return m_uiAlgalonGUID; - case DATA_STEELBREAKER: - return m_auiAssemblyGUIDs[0]; - case DATA_MOLGEIM: - return m_auiAssemblyGUIDs[1]; - case DATA_BRUNDIR: - return m_auiAssemblyGUIDs[2]; + case EVENT_TOWER_OF_LIFE_DESTROYED: + case EVENT_TOWER_OF_STORM_DESTROYED: + case EVENT_TOWER_OF_FROST_DESTROYED: + case EVENT_TOWER_OF_FLAMES_DESTROYED: + { + instance->LoadGrid(364.0f, -16.0f); //make sure leviathan is loaded + m_leviathanTowers[type-EVENT_TOWER_OF_LIFE_DESTROYED] = data; + GameObject* gobj = NULL; + if (gobj = instance->GetGameObject(m_leviathanVisualTowers[type-EVENT_TOWER_OF_LIFE_DESTROYED][0])) + gobj->SetGoState(GO_STATE_ACTIVE); + if (gobj = instance->GetGameObject(m_leviathanVisualTowers[type-EVENT_TOWER_OF_LIFE_DESTROYED][1])) + gobj->SetGoState(GO_STATE_ACTIVE); + return; + } - // Flame Leviathan - case DATA_REPAIR_STATION1: - return m_RepairSGUID[0]; - case DATA_REPAIR_STATION2: - return m_RepairSGUID[1]; - case DATA_LIGHTNING_WALL1: - return m_lightningWalls[0]; - case DATA_LIGHTNING_WALL2: - return m_lightningWalls[1]; - case GO_LEVIATHAN_DOORS: - return m_leviathanDoorsGUID; + case DATA_VEHICLE_SPAWN: + SpawnLeviathanEncounterVehicles(data); + return; + case DATA_UNBROKEN_ACHIEVEMENT: + m_unbrokenAchievement = data; + SaveToDB(); + return; + case DATA_DESPAWN_ALGALON: + DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1); + DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, 60); + m_algalonTimer = 60; + _events.RescheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); + SaveToDB(); + return; + case DATA_ALGALON_SUMMON_STATE: + case DATA_ALGALON_DEFEATED: + DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0); + m_algalonTimer = (type == DATA_ALGALON_DEFEATED ? TIMER_ALGALON_DEFEATED : TIMER_ALGALON_SUMMONED); + _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER); + SaveToDB(); + return; + case TYPE_ALGALON: + m_auiEncounter[type] = data; + if (GameObject* go = instance->GetGameObject(GetData64(GO_DOODAD_UL_SIGILDOOR_03))) + { + go->SetGoState(data != IN_PROGRESS ? GO_STATE_ACTIVE : GO_STATE_READY); + go->EnableCollision(false); + } + if (GameObject* go = instance->GetGameObject(GetData64(GO_DOODAD_UL_UNIVERSEFLOOR_01))) + { + go->SetGoState(data != IN_PROGRESS ? GO_STATE_ACTIVE : GO_STATE_READY); + go->EnableCollision(false); + } + if (GameObject* go = instance->GetGameObject(GetData64(GO_DOODAD_UL_UNIVERSEFLOOR_02))) + { + go->SetGoState(data == IN_PROGRESS ? GO_STATE_ACTIVE : GO_STATE_READY); + go->EnableCollision(false); + } + if (GameObject* go = instance->GetGameObject(GetData64(GO_DOODAD_UL_UNIVERSEGLOBE01))) + { + go->SetGoState(data == IN_PROGRESS ? GO_STATE_ACTIVE : GO_STATE_READY); + go->EnableCollision(false); + } + if (GameObject* go = instance->GetGameObject(GetData64(GO_DOODAD_UL_ULDUAR_TRAPDOOR_03))) + { + go->SetGoState(data == IN_PROGRESS ? GO_STATE_ACTIVE : GO_STATE_READY); + go->EnableCollision(false); + } + break; - // Razorscales Harpoon Fire State GUIDs - case DATA_HARPOON_FIRE_STATE_1: - case DATA_HARPOON_FIRE_STATE_2: - case DATA_HARPOON_FIRE_STATE_3: - case DATA_HARPOON_FIRE_STATE_4: - return m_RazorscaleHarpoonFireStateGUID[data-200]; + // Achievement + case DATA_DWARFAGEDDON: + DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, SPELL_DWARFAGEDDON); + DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_DWARFAGEDDON); + return; + case DATA_CALL_TRAM: + if (GameObject* MimironTram = instance->GetGameObject(m_mimironTramGUID)) + if (StaticTransport* t = MimironTram->ToStaticTransport()) + { + if (data == 0 && t->GetGoState() == GO_STATE_ACTIVE && t->GetPathProgress() == t->GetPauseTime()) + MimironTram->SetGoState(GO_STATE_READY); + if (data == 1 && t->GetGoState() == GO_STATE_READY && t->GetPathProgress() == 0) + MimironTram->SetGoState(GO_STATE_ACTIVE); + } + break; + } - // XT-002 - case GO_XT002_DOORS: - return m_xt002DoorsGUID; + // take care of herbs + if (type == TYPE_FREYA && data == DONE) + { + std::list goList; + if (Creature* freya = instance->GetCreature(GetData64(TYPE_FREYA))) + { + freya->GetGameObjectListWithEntryInGrid(goList, 191019 /*Adder's Tongue*/, 333.0f); + freya->GetGameObjectListWithEntryInGrid(goList, 190176 /*Frost Lotus*/, 333.0f); + freya->GetGameObjectListWithEntryInGrid(goList, 190171 /*Lichbloom*/, 333.0f); + freya->GetGameObjectListWithEntryInGrid(goList, 190170 /*Talandra's Rose*/, 333.0f); + freya->GetGameObjectListWithEntryInGrid(goList, 189973 /*Goldclover*/, 333.0f); + + for (std::list::const_iterator itr = goList.begin(); itr != goList.end(); ++itr) + (*itr)->SetRespawnTime(7*DAY); + } + } - // Thorim - case DATA_THORIM_LEVER_GATE: - case DATA_THORIM_LEVER: - case DATA_THORIM_FENCE: - case DATA_THORIM_FIRST_DOORS: - case DATA_THORIM_SECOND_DOORS: - return m_thorimGameobjectsGUID[data-DATA_THORIM_LEVER_GATE]; - break; + if (data == DONE || type == TYPE_LEVIATHAN || type == TYPE_WATCHERS) + SaveToDB(); - // Freya Elders - case NPC_ELDER_IRONBRANCH: - case NPC_ELDER_STONEBARK: - case NPC_ELDER_BRIGHTLEAF: - return m_FreyaElder[data-NPC_ELDER_IRONBRANCH]; + if (type > TYPE_LEVIATHAN && type < TYPE_WATCHERS && data == IN_PROGRESS) + { + Map::PlayerList const& pList = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if (Vehicle* veh = itr->GetSource()->GetVehicle()) + veh->Dismiss(); + } + } - // Mimiron's first vehicle (spawned by default) - case DATA_MIMIRON_LEVIATHAN_MKII: - return m_MimironLeviathanMKIIguid; - case DATA_MIMIRON_VX001: - return m_MimironVX001guid; - case DATA_MIMIRON_ACU: - return m_MimironACUguid; - case DATA_GO_MIMIRON_DOOR_1: - case DATA_GO_MIMIRON_DOOR_2: - case DATA_GO_MIMIRON_DOOR_3: - return m_MimironDoor[data-311]; + uint64 GetData64(uint32 data) const + { + switch(data) + { + // Bosses + case TYPE_LEVIATHAN: + return m_uiLeviathanGUID; + case TYPE_IGNIS: + return m_uiIgnisGUID; + case TYPE_RAZORSCALE: + return m_uiRazorscaleGUID; + case TYPE_XT002: + return m_uiXT002GUID; + case TYPE_KOLOGARN: + return m_uiKologarnGUID; + case TYPE_AURIAYA: + return m_uiAuriayaGUID; + case TYPE_MIMIRON: + return m_uiMimironGUID; + case TYPE_HODIR: + return m_uiHodirGUID; + case TYPE_THORIM: + return m_uiThorimGUID; + case TYPE_FREYA: + return m_uiFreyaGUID; + case TYPE_VEZAX: + return m_uiVezaxGUID; + case TYPE_YOGGSARON: + return m_uiYoggSaronGUID; + case TYPE_ALGALON: + return m_uiAlgalonGUID; + case DATA_STEELBREAKER: + return m_auiAssemblyGUIDs[0]; + case DATA_MOLGEIM: + return m_auiAssemblyGUIDs[1]; + case DATA_BRUNDIR: + return m_auiAssemblyGUIDs[2]; - // Yogg-Saron - case GO_YOGG_SARON_DOORS: - return m_yoggsaronDoorsGUID; - case NPC_SARA: - return m_saraGUID; - case NPC_BRAIN_OF_YOGG_SARON: - return m_yoggsaronBrainGUID; + // Flame Leviathan + case DATA_REPAIR_STATION1: + return m_RepairSGUID[0]; + case DATA_REPAIR_STATION2: + return m_RepairSGUID[1]; + case DATA_LIGHTNING_WALL1: + return m_lightningWalls[0]; + case DATA_LIGHTNING_WALL2: + return m_lightningWalls[1]; + case GO_LEVIATHAN_DOORS: + return m_leviathanDoorsGUID; - // Algalon the Observer - case GO_DOODAD_UL_SIGILDOOR_01: - return m_algalonSigilDoorGUID[0]; - case GO_DOODAD_UL_SIGILDOOR_02: - return m_algalonSigilDoorGUID[1]; - case GO_DOODAD_UL_SIGILDOOR_03: - return m_algalonSigilDoorGUID[2]; - case GO_DOODAD_UL_UNIVERSEFLOOR_01: - return m_algalonFloorGUID[0]; - case GO_DOODAD_UL_UNIVERSEFLOOR_02: - return m_algalonFloorGUID[1]; - case GO_DOODAD_UL_UNIVERSEGLOBE01: - return m_algalonUniverseGUID; - case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03: - return m_algalonTrapdoorGUID; - case NPC_BRANN_BRONZBEARD_ALG: - return m_brannBronzebeardAlgGUID; - } + // Razorscales Harpoon Fire State GUIDs + case DATA_HARPOON_FIRE_STATE_1: + case DATA_HARPOON_FIRE_STATE_2: + case DATA_HARPOON_FIRE_STATE_3: + case DATA_HARPOON_FIRE_STATE_4: + return m_RazorscaleHarpoonFireStateGUID[data-200]; - return 0; - } + // XT-002 + case GO_XT002_DOORS: + return m_xt002DoorsGUID; - uint32 GetData(uint32 type) const - { - switch(type) - { - case TYPE_LEVIATHAN: - case TYPE_IGNIS: - case TYPE_RAZORSCALE: - case TYPE_XT002: - case TYPE_ASSEMBLY: - case TYPE_KOLOGARN: - case TYPE_AURIAYA: - case TYPE_MIMIRON: - case TYPE_HODIR: - case TYPE_THORIM: - case TYPE_FREYA: - case TYPE_VEZAX: - case TYPE_YOGGSARON: - case TYPE_ALGALON: - case TYPE_WATCHERS: - return m_auiEncounter[type]; + // Thorim + case DATA_THORIM_LEVER_GATE: + case DATA_THORIM_LEVER: + case DATA_THORIM_FENCE: + case DATA_THORIM_FIRST_DOORS: + case DATA_THORIM_SECOND_DOORS: + return m_thorimGameobjectsGUID[data-DATA_THORIM_LEVER_GATE]; + break; - case EVENT_TOWER_OF_LIFE_DESTROYED: - case EVENT_TOWER_OF_STORM_DESTROYED: - case EVENT_TOWER_OF_FROST_DESTROYED: - case EVENT_TOWER_OF_FLAMES_DESTROYED: - return m_leviathanTowers[type-EVENT_TOWER_OF_LIFE_DESTROYED]; + // Freya Elders + case NPC_ELDER_IRONBRANCH: + case NPC_ELDER_STONEBARK: + case NPC_ELDER_BRIGHTLEAF: + return m_FreyaElder[data-NPC_ELDER_IRONBRANCH]; - case DATA_UNBROKEN_ACHIEVEMENT: - return m_unbrokenAchievement; + // Mimiron's first vehicle (spawned by default) + case DATA_MIMIRON_LEVIATHAN_MKII: + return m_MimironLeviathanMKIIguid; + case DATA_MIMIRON_VX001: + return m_MimironVX001guid; + case DATA_MIMIRON_ACU: + return m_MimironACUguid; + case DATA_GO_MIMIRON_DOOR_1: + case DATA_GO_MIMIRON_DOOR_2: + case DATA_GO_MIMIRON_DOOR_3: + return m_MimironDoor[data-311]; - case DATA_CALL_TRAM: - return m_mimironTramUsed; - } + // Yogg-Saron + case GO_YOGG_SARON_DOORS: + return m_yoggsaronDoorsGUID; + case NPC_SARA: + return m_saraGUID; + case NPC_BRAIN_OF_YOGG_SARON: + return m_yoggsaronBrainGUID; - return 0; - } + // Algalon the Observer + case GO_DOODAD_UL_SIGILDOOR_01: + return m_algalonSigilDoorGUID[0]; + case GO_DOODAD_UL_SIGILDOOR_02: + return m_algalonSigilDoorGUID[1]; + case GO_DOODAD_UL_SIGILDOOR_03: + return m_algalonSigilDoorGUID[2]; + case GO_DOODAD_UL_UNIVERSEFLOOR_01: + return m_algalonFloorGUID[0]; + case GO_DOODAD_UL_UNIVERSEFLOOR_02: + return m_algalonFloorGUID[1]; + case GO_DOODAD_UL_UNIVERSEGLOBE01: + return m_algalonUniverseGUID; + case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03: + return m_algalonTrapdoorGUID; + case NPC_BRANN_BRONZBEARD_ALG: + return m_brannBronzebeardAlgGUID; + } - void OnUnitDeath(Unit* unit) - { - // Feeds on Tears achievement - if (unit->GetTypeId() == TYPEID_PLAYER) - { - if (GetData(TYPE_ALGALON) == IN_PROGRESS) - if (Creature* algalon = instance->GetCreature(m_uiAlgalonGUID)) - algalon->AI()->DoAction(ACTION_FEEDS_ON_TEARS_FAILED); - } - else if (unit->GetTypeId() == TYPEID_UNIT && unit->GetAreaId() == 4656 /*Conservatory of Life*/) - { - if (time(NULL) > (m_conspeedatoryAttempt + DAY)) - { - DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21597 /*CON-SPEED-ATORY_TIMED_CRITERIA*/); - m_conspeedatoryAttempt = time(NULL); - SaveToDB(); - } - } + return 0; + } - // achievement Champion/Conqueror of Ulduar - if (unit->GetTypeId() == TYPEID_PLAYER) - for (uint8 i = 0; i <= 12; ++i) - { - bool go = false; - if (i == TYPE_LEVIATHAN) - { - if (Creature* c = instance->GetCreature(m_uiLeviathanGUID)) - if (c->IsInCombat()) - go = true; - } - else - go = (m_auiEncounter[i] == IN_PROGRESS); + uint32 GetData(uint32 type) const + { + switch(type) + { + case TYPE_LEVIATHAN: + case TYPE_IGNIS: + case TYPE_RAZORSCALE: + case TYPE_XT002: + case TYPE_ASSEMBLY: + case TYPE_KOLOGARN: + case TYPE_AURIAYA: + case TYPE_MIMIRON: + case TYPE_HODIR: + case TYPE_THORIM: + case TYPE_FREYA: + case TYPE_VEZAX: + case TYPE_YOGGSARON: + case TYPE_ALGALON: + case TYPE_WATCHERS: + return m_auiEncounter[type]; - if (go && (C_of_Ulduar_MASK & (1<GetTypeId() == TYPEID_PLAYER) + { + if (GetData(TYPE_ALGALON) == IN_PROGRESS) + if (Creature* algalon = instance->GetCreature(m_uiAlgalonGUID)) + algalon->AI()->DoAction(ACTION_FEEDS_ON_TEARS_FAILED); + } + else if (unit->GetTypeId() == TYPEID_UNIT && unit->GetAreaId() == 4656 /*Conservatory of Life*/) + { + if (time(NULL) > (m_conspeedatoryAttempt + DAY)) + { + DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21597 /*CON-SPEED-ATORY_TIMED_CRITERIA*/); + m_conspeedatoryAttempt = time(NULL); + SaveToDB(); + } + } - OUT_LOAD_INST_DATA(strIn); + // achievement Champion/Conqueror of Ulduar + if (unit->GetTypeId() == TYPEID_PLAYER) + for (uint8 i = 0; i <= 12; ++i) + { + bool go = false; + if (i == TYPE_LEVIATHAN) + { + if (Creature* c = instance->GetCreature(m_uiLeviathanGUID)) + if (c->IsInCombat()) + go = true; + } + else + go = (m_auiEncounter[i] == IN_PROGRESS); - char dataHead1, dataHead2; + if (go && (C_of_Ulduar_MASK & (1<> dataHead1 >> dataHead2; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - if (dataHead1 == 'U' && dataHead2 == 'U') - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - loadStream >> m_auiEncounter[i]; - - if (m_auiEncounter[i] == IN_PROGRESS && i != TYPE_WATCHERS) - m_auiEncounter[i] = NOT_STARTED; - } + std::ostringstream saveStream; + saveStream << "U U " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' + << m_auiEncounter[4] << ' ' << m_auiEncounter[5] << ' ' << m_auiEncounter[6] << ' ' << m_auiEncounter[7] << ' ' + << m_auiEncounter[8] << ' ' << m_auiEncounter[9] << ' ' << m_auiEncounter[10] << ' ' << m_auiEncounter[11] << ' ' + << m_auiEncounter[12] << ' ' << m_auiEncounter[13] << ' ' << m_auiEncounter[14] << ' ' << m_conspeedatoryAttempt << ' ' + << m_unbrokenAchievement << ' ' << m_algalonTimer << ' ' << C_of_Ulduar_MASK; - // Achievements - loadStream >> m_conspeedatoryAttempt; - loadStream >> m_unbrokenAchievement; + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - // Algalon + void Load(const char* strIn) + { + if (!strIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(strIn); + + char dataHead1, dataHead2; + + std::istringstream loadStream(strIn); + loadStream >> dataHead1 >> dataHead2; + + if (dataHead1 == 'U' && dataHead2 == 'U') + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + loadStream >> m_auiEncounter[i]; + + if (m_auiEncounter[i] == IN_PROGRESS && i != TYPE_WATCHERS) + m_auiEncounter[i] = NOT_STARTED; + } + + // Achievements + loadStream >> m_conspeedatoryAttempt; + loadStream >> m_unbrokenAchievement; + + // Algalon loadStream >> m_algalonTimer; - if (m_algalonTimer == TIMER_ALGALON_SUMMONED) - m_algalonTimer = TIMER_ALGALON_TO_SUMMON; + if (m_algalonTimer == TIMER_ALGALON_SUMMONED) + m_algalonTimer = TIMER_ALGALON_TO_SUMMON; if (m_algalonTimer && m_algalonTimer <= 60 && GetData(TYPE_ALGALON) != DONE) { @@ -972,12 +972,12 @@ public: DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, m_algalonTimer); } - // achievement Conqueror/Champion of Ulduar - loadStream >> C_of_Ulduar_MASK; - } + // achievement Conqueror/Champion of Ulduar + loadStream >> C_of_Ulduar_MASK; + } - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } void Update(uint32 diff) @@ -989,146 +989,146 @@ public: switch (_events.GetEvent()) { case EVENT_UPDATE_ALGALON_TIMER: - if (m_algalonTimer == TIMER_ALGALON_DEFEATED) - { - _events.PopEvent(); - return; - } + if (m_algalonTimer == TIMER_ALGALON_DEFEATED) + { + _events.PopEvent(); + return; + } SaveToDB(); DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, --m_algalonTimer); if (m_algalonTimer) - { + { _events.RepeatEvent(60000); - return; - } + return; + } - _events.PopEvent(); - SetData(DATA_ALGALON_DEFEATED, 1); + _events.PopEvent(); + SetData(DATA_ALGALON_DEFEATED, 1); if (Creature* algalon = instance->GetCreature(m_uiAlgalonGUID)) algalon->AI()->DoAction(ACTION_DESPAWN_ALGALON); } } - void SpawnLeviathanEncounterVehicles(uint8 mode); + void SpawnLeviathanEncounterVehicles(uint8 mode); - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch (criteria_id) - { - case 10042: - case 10352: - return (C_of_Ulduar_MASK & (1<::iterator itr = _leviathanVehicles.begin(); itr != _leviathanVehicles.end(); ++itr) - if (Creature* cr = instance->GetCreature(*itr)) - if (Vehicle* veh = cr->GetVehicleKit()) - veh->Dismiss(); + if (!_leviathanVehicles.empty()) + { + for (std::list::iterator itr = _leviathanVehicles.begin(); itr != _leviathanVehicles.end(); ++itr) + if (Creature* cr = instance->GetCreature(*itr)) + if (Vehicle* veh = cr->GetVehicleKit()) + veh->Dismiss(); - _leviathanVehicles.clear(); - } + _leviathanVehicles.clear(); + } - if (mode < VEHICLE_POS_NONE) - { - TempSummon* veh = NULL; - for (uint8 i = 0; i < (instance->Is25ManRaid() ? 5 : 2); ++i) - { - if (veh = instance->SummonCreature(NPC_SALVAGED_SIEGE_ENGINE, vehiclePositions[15*mode+i])) - _leviathanVehicles.push_back(veh->GetGUID()); - if (veh = instance->SummonCreature(NPC_VEHICLE_CHOPPER, vehiclePositions[15*mode+i+5])) - _leviathanVehicles.push_back(veh->GetGUID()); - if (veh = instance->SummonCreature(NPC_SALVAGED_DEMOLISHER, vehiclePositions[15*mode+i+10])) - _leviathanVehicles.push_back(veh->GetGUID()); - } - } + if (mode < VEHICLE_POS_NONE) + { + TempSummon* veh = NULL; + for (uint8 i = 0; i < (instance->Is25ManRaid() ? 5 : 2); ++i) + { + if (veh = instance->SummonCreature(NPC_SALVAGED_SIEGE_ENGINE, vehiclePositions[15*mode+i])) + _leviathanVehicles.push_back(veh->GetGUID()); + if (veh = instance->SummonCreature(NPC_VEHICLE_CHOPPER, vehiclePositions[15*mode+i+5])) + _leviathanVehicles.push_back(veh->GetGUID()); + if (veh = instance->SummonCreature(NPC_SALVAGED_DEMOLISHER, vehiclePositions[15*mode+i+10])) + _leviathanVehicles.push_back(veh->GetGUID()); + } + } } void AddSC_instance_ulduar() diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp index c15bf513e..f04bc2254 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.cpp @@ -17,443 +17,443 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! #define ANTECHAMBER 204 #define WALKWAY 205 #define CONSERVATORY 206 -#define MADNESS 207 -#define SPARK 208 +#define MADNESS 207 +#define SPARK 208 class go_ulduar_teleporter : public GameObjectScript { public: - go_ulduar_teleporter() : GameObjectScript("ulduar_teleporter") { } + go_ulduar_teleporter() : GameObjectScript("ulduar_teleporter") { } - bool OnGossipHello(Player* player, GameObject* go) - { - InstanceScript* pInstance = go->GetInstanceScript(); - if (!pInstance) - return true; + bool OnGossipHello(Player* player, GameObject* go) + { + InstanceScript* pInstance = go->GetInstanceScript(); + if (!pInstance) + return true; - player->ADD_GOSSIP_ITEM(0, "Teleport to the Expedition Base Camp.", GOSSIP_SENDER_MAIN, BASE_CAMP); - if (pInstance->GetData(TYPE_LEVIATHAN) >= DONE) // count special - { - player->ADD_GOSSIP_ITEM(0, "Teleport to the Formation Grounds.", GOSSIP_SENDER_MAIN, GROUNDS); - if (pInstance->GetData(TYPE_LEVIATHAN) == DONE) - { - player->ADD_GOSSIP_ITEM(0, "Teleport to the Colossal Forge.", GOSSIP_SENDER_MAIN, FORGE); - if (pInstance->GetData(TYPE_XT002) == DONE) - { - player->ADD_GOSSIP_ITEM(0, "Teleport to the Scrapyard.", GOSSIP_SENDER_MAIN, SCRAPYARD); - player->ADD_GOSSIP_ITEM(0, "Teleport to the Antechamber of Ulduar.", GOSSIP_SENDER_MAIN, ANTECHAMBER); - if (pInstance->GetData(TYPE_KOLOGARN) == DONE) - { - player->ADD_GOSSIP_ITEM(0, "Teleport to the Shattered Walkway.", GOSSIP_SENDER_MAIN, WALKWAY); - if (pInstance->GetData(TYPE_AURIAYA) == DONE) - { - player->ADD_GOSSIP_ITEM(0, "Teleport to the Conservatory of Life.", GOSSIP_SENDER_MAIN, CONSERVATORY); - if (pInstance->GetData(DATA_CALL_TRAM)) - player->ADD_GOSSIP_ITEM(0, "Teleport to the Spark of Imagination.", GOSSIP_SENDER_MAIN, SPARK); - if (pInstance->GetData(TYPE_VEZAX) == DONE) - player->ADD_GOSSIP_ITEM(0, "Teleport to the Prison of Yogg-Saron.", GOSSIP_SENDER_MAIN, MADNESS); - } - } - } - } - } + player->ADD_GOSSIP_ITEM(0, "Teleport to the Expedition Base Camp.", GOSSIP_SENDER_MAIN, BASE_CAMP); + if (pInstance->GetData(TYPE_LEVIATHAN) >= DONE) // count special + { + player->ADD_GOSSIP_ITEM(0, "Teleport to the Formation Grounds.", GOSSIP_SENDER_MAIN, GROUNDS); + if (pInstance->GetData(TYPE_LEVIATHAN) == DONE) + { + player->ADD_GOSSIP_ITEM(0, "Teleport to the Colossal Forge.", GOSSIP_SENDER_MAIN, FORGE); + if (pInstance->GetData(TYPE_XT002) == DONE) + { + player->ADD_GOSSIP_ITEM(0, "Teleport to the Scrapyard.", GOSSIP_SENDER_MAIN, SCRAPYARD); + player->ADD_GOSSIP_ITEM(0, "Teleport to the Antechamber of Ulduar.", GOSSIP_SENDER_MAIN, ANTECHAMBER); + if (pInstance->GetData(TYPE_KOLOGARN) == DONE) + { + player->ADD_GOSSIP_ITEM(0, "Teleport to the Shattered Walkway.", GOSSIP_SENDER_MAIN, WALKWAY); + if (pInstance->GetData(TYPE_AURIAYA) == DONE) + { + player->ADD_GOSSIP_ITEM(0, "Teleport to the Conservatory of Life.", GOSSIP_SENDER_MAIN, CONSERVATORY); + if (pInstance->GetData(DATA_CALL_TRAM)) + player->ADD_GOSSIP_ITEM(0, "Teleport to the Spark of Imagination.", GOSSIP_SENDER_MAIN, SPARK); + if (pInstance->GetData(TYPE_VEZAX) == DONE) + player->ADD_GOSSIP_ITEM(0, "Teleport to the Prison of Yogg-Saron.", GOSSIP_SENDER_MAIN, MADNESS); + } + } + } + } + } - player->SEND_GOSSIP_MENU(14424, go->GetGUID()); - return true; - } + player->SEND_GOSSIP_MENU(14424, go->GetGUID()); + return true; + } - bool OnGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action) - { - if (sender != GOSSIP_SENDER_MAIN || !player->getAttackers().empty()) - return true; + bool OnGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action) + { + if (sender != GOSSIP_SENDER_MAIN || !player->getAttackers().empty()) + return true; - switch(action) - { - case BASE_CAMP: - player->TeleportTo(603, -706.122f, -92.6024f, 429.876f, 0); - player->CLOSE_GOSSIP_MENU(); break; - case GROUNDS: - player->TeleportTo(603, 131.248f, -35.3802f, 409.804f, 0); - player->CLOSE_GOSSIP_MENU(); break; - case FORGE: - player->TeleportTo(603, 553.233f, -12.3247f, 409.679f, 0); - player->CLOSE_GOSSIP_MENU(); break; - case SCRAPYARD: - player->TeleportTo(603, 926.292f, -11.4635f, 418.595f, 0); - player->CLOSE_GOSSIP_MENU(); break; - case ANTECHAMBER: - player->TeleportTo(603, 1498.09f, -24.246f, 420.967f, 0); - player->CLOSE_GOSSIP_MENU(); break; - case WALKWAY: - player->TeleportTo(603, 1859.45f, -24.1f, 448.9f, 0); - player->CLOSE_GOSSIP_MENU(); break; - case CONSERVATORY: - player->TeleportTo(603, 2086.27f, -24.3134f, 421.239f, 0); - player->CLOSE_GOSSIP_MENU(); break; - case MADNESS: - player->TeleportTo(603, 1854.8f, -11.46f, 334.57f, 4.8f); - player->CLOSE_GOSSIP_MENU(); break; - case SPARK: - player->TeleportTo(603, 2517.9f, 2568.9f, 412.7f, 0); - player->CLOSE_GOSSIP_MENU(); break; - } + switch(action) + { + case BASE_CAMP: + player->TeleportTo(603, -706.122f, -92.6024f, 429.876f, 0); + player->CLOSE_GOSSIP_MENU(); break; + case GROUNDS: + player->TeleportTo(603, 131.248f, -35.3802f, 409.804f, 0); + player->CLOSE_GOSSIP_MENU(); break; + case FORGE: + player->TeleportTo(603, 553.233f, -12.3247f, 409.679f, 0); + player->CLOSE_GOSSIP_MENU(); break; + case SCRAPYARD: + player->TeleportTo(603, 926.292f, -11.4635f, 418.595f, 0); + player->CLOSE_GOSSIP_MENU(); break; + case ANTECHAMBER: + player->TeleportTo(603, 1498.09f, -24.246f, 420.967f, 0); + player->CLOSE_GOSSIP_MENU(); break; + case WALKWAY: + player->TeleportTo(603, 1859.45f, -24.1f, 448.9f, 0); + player->CLOSE_GOSSIP_MENU(); break; + case CONSERVATORY: + player->TeleportTo(603, 2086.27f, -24.3134f, 421.239f, 0); + player->CLOSE_GOSSIP_MENU(); break; + case MADNESS: + player->TeleportTo(603, 1854.8f, -11.46f, 334.57f, 4.8f); + player->CLOSE_GOSSIP_MENU(); break; + case SPARK: + player->TeleportTo(603, 2517.9f, 2568.9f, 412.7f, 0); + player->CLOSE_GOSSIP_MENU(); break; + } - return true; - } + return true; + } }; class npc_ulduar_keeper : public CreatureScript { public: - npc_ulduar_keeper() : CreatureScript("npc_ulduar_keeper_gossip") { } + npc_ulduar_keeper() : CreatureScript("npc_ulduar_keeper_gossip") { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Lend us your aid, keeper. Together we shall defeat Yogg-Saron.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pCreature->GetGUID()); - return true; - } + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Lend us your aid, keeper. Together we shall defeat Yogg-Saron.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pCreature->GetGUID()); + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) - { - creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); - uint8 _keeper = 0; - switch (creature->GetEntry()) - { - case NPC_FREYA_GOSSIP: - creature->MonsterYell("Eonar, your servant calls for your blessing!", LANG_UNIVERSAL, 0); - creature->PlayDirectSound(15535); - _keeper = KEEPER_FREYA; - break; - case NPC_HODIR_GOSSIP: - creature->MonsterYell("The veil of winter will protect you, champions!", LANG_UNIVERSAL, 0); - creature->PlayDirectSound(15559); - _keeper = KEEPER_HODIR; - break; - case NPC_MIMIRON_GOSSIP: - creature->MonsterYell("Combat matrix enhanced. Behold wonderous rapidity!", LANG_UNIVERSAL, 0); - creature->PlayDirectSound(15630); - _keeper = KEEPER_MIMIRON; - break; - case NPC_THORIM_GOSSIP: - creature->MonsterYell("Golganneth, lend me your strengh! Grant my mortal allies the power of thunder!", LANG_UNIVERSAL, 0); - creature->PlayDirectSound(15750); - _keeper = KEEPER_THORIM; - break; - } + bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + { + creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); + uint8 _keeper = 0; + switch (creature->GetEntry()) + { + case NPC_FREYA_GOSSIP: + creature->MonsterYell("Eonar, your servant calls for your blessing!", LANG_UNIVERSAL, 0); + creature->PlayDirectSound(15535); + _keeper = KEEPER_FREYA; + break; + case NPC_HODIR_GOSSIP: + creature->MonsterYell("The veil of winter will protect you, champions!", LANG_UNIVERSAL, 0); + creature->PlayDirectSound(15559); + _keeper = KEEPER_HODIR; + break; + case NPC_MIMIRON_GOSSIP: + creature->MonsterYell("Combat matrix enhanced. Behold wonderous rapidity!", LANG_UNIVERSAL, 0); + creature->PlayDirectSound(15630); + _keeper = KEEPER_MIMIRON; + break; + case NPC_THORIM_GOSSIP: + creature->MonsterYell("Golganneth, lend me your strengh! Grant my mortal allies the power of thunder!", LANG_UNIVERSAL, 0); + creature->PlayDirectSound(15750); + _keeper = KEEPER_THORIM; + break; + } - if (creature->GetInstanceScript()) - { - creature->GetInstanceScript()->SetData(TYPE_WATCHERS, _keeper); - creature->DespawnOrUnsummon(6000); - } + if (creature->GetInstanceScript()) + { + creature->GetInstanceScript()->SetData(TYPE_WATCHERS, _keeper); + creature->DespawnOrUnsummon(6000); + } - return true; - } + return true; + } }; class spell_ulduar_energy_sap : public SpellScriptLoader { public: - spell_ulduar_energy_sap() : SpellScriptLoader("spell_ulduar_energy_sap") { } + spell_ulduar_energy_sap() : SpellScriptLoader("spell_ulduar_energy_sap") { } - class spell_ulduar_energy_sap_AuraScript : public AuraScript - { - PrepareAuraScript(spell_ulduar_energy_sap_AuraScript) + class spell_ulduar_energy_sap_AuraScript : public AuraScript + { + PrepareAuraScript(spell_ulduar_energy_sap_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (Unit* target = GetTarget()) - target->CastSpell(target, (aurEff->GetId() == 64740) ? 64747 : 64863, true); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (Unit* target = GetTarget()) + target->CastSpell(target, (aurEff->GetId() == 64740) ? 64747 : 64863, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_ulduar_energy_sap_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_ulduar_energy_sap_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_ulduar_energy_sap_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_ulduar_energy_sap_AuraScript(); + } }; class npc_ulduar_snow_mound : public CreatureScript { public: - npc_ulduar_snow_mound() : CreatureScript("npc_ulduar_snow_mound") { } + npc_ulduar_snow_mound() : CreatureScript("npc_ulduar_snow_mound") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_snow_moundAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_snow_moundAI(pCreature); + } - struct npc_ulduar_snow_moundAI : public ScriptedAI - { - npc_ulduar_snow_moundAI(Creature* pCreature) : ScriptedAI(pCreature) - { - activated = false; - me->CastSpell(me, 64615, true); - } + struct npc_ulduar_snow_moundAI : public ScriptedAI + { + npc_ulduar_snow_moundAI(Creature* pCreature) : ScriptedAI(pCreature) + { + activated = false; + me->CastSpell(me, 64615, true); + } - bool activated; + bool activated; - void MoveInLineOfSight(Unit* who) - { - if (!activated && who->GetTypeId() == TYPEID_PLAYER) - if (me->GetExactDist2d(who) <= 25.0f && me->GetMap()->isInLineOfSight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+5.0f, who->GetPositionX(), who->GetPositionY(), who->GetPositionZ()+5.0f, 2)) - { - activated = true; - me->RemoveAura(64615); - if (GameObject* go = me->FindNearestGameObject(194907, 5.0f)) - go->Delete(); - uint8 count; - if (me->GetEntry() == 34146) count = 4; - else if (me->GetEntry() == 34150) count = 6; - else count = 8; - for (uint8 i=0; iSummonCreature(34137, me->GetPositionX()+cos(a)*d, me->GetPositionY()+sin(a)*d, me->GetPositionZ()+1.0f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000)) - c->AI()->AttackStart(who); - } - } - } + void MoveInLineOfSight(Unit* who) + { + if (!activated && who->GetTypeId() == TYPEID_PLAYER) + if (me->GetExactDist2d(who) <= 25.0f && me->GetMap()->isInLineOfSight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+5.0f, who->GetPositionX(), who->GetPositionY(), who->GetPositionZ()+5.0f, 2)) + { + activated = true; + me->RemoveAura(64615); + if (GameObject* go = me->FindNearestGameObject(194907, 5.0f)) + go->Delete(); + uint8 count; + if (me->GetEntry() == 34146) count = 4; + else if (me->GetEntry() == 34150) count = 6; + else count = 8; + for (uint8 i=0; iSummonCreature(34137, me->GetPositionX()+cos(a)*d, me->GetPositionY()+sin(a)*d, me->GetPositionZ()+1.0f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000)) + c->AI()->AttackStart(who); + } + } + } - void UpdateAI(uint32 diff) {} - }; + void UpdateAI(uint32 diff) {} + }; }; class npc_ulduar_storm_tempered_keeper : public CreatureScript { public: - npc_ulduar_storm_tempered_keeper() : CreatureScript("npc_ulduar_storm_tempered_keeper") { } + npc_ulduar_storm_tempered_keeper() : CreatureScript("npc_ulduar_storm_tempered_keeper") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_storm_tempered_keeperAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_storm_tempered_keeperAI(pCreature); + } - struct npc_ulduar_storm_tempered_keeperAI : public ScriptedAI - { - npc_ulduar_storm_tempered_keeperAI(Creature* pCreature) : ScriptedAI(pCreature) - { - otherGUID = 0; - } + struct npc_ulduar_storm_tempered_keeperAI : public ScriptedAI + { + npc_ulduar_storm_tempered_keeperAI(Creature* pCreature) : ScriptedAI(pCreature) + { + otherGUID = 0; + } - EventMap events; - uint64 otherGUID; + EventMap events; + uint64 otherGUID; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.Reset(); - events.ScheduleEvent(1, 2000); // checking Separation Anxiety, Charged Sphere - events.ScheduleEvent(2, urand(5000,8000)); // Forked Lightning - events.ScheduleEvent(3, (me->GetEntry() == 33722 ? 20000 : 50000)); // Summon Charged Sphere - if (Creature* c = me->FindNearestCreature((me->GetEntry() == 33722 ? 33699 : 33722), 30.0f, true)) - otherGUID = c->GetGUID(); - else - me->CastSpell(me, 63630, true); // Vengeful Surge - } + void EnterCombat(Unit* /*who*/) + { + events.Reset(); + events.ScheduleEvent(1, 2000); // checking Separation Anxiety, Charged Sphere + events.ScheduleEvent(2, urand(5000,8000)); // Forked Lightning + events.ScheduleEvent(3, (me->GetEntry() == 33722 ? 20000 : 50000)); // Summon Charged Sphere + if (Creature* c = me->FindNearestCreature((me->GetEntry() == 33722 ? 33699 : 33722), 30.0f, true)) + otherGUID = c->GetGUID(); + else + me->CastSpell(me, 63630, true); // Vengeful Surge + } - void JustDied(Unit* /*killer*/) - { - if (Creature* c = ObjectAccessor::GetCreature(*me, otherGUID)) - c->CastSpell(c, 63630, true); // Vengeful Surge - } + void JustDied(Unit* /*killer*/) + { + if (Creature* c = ObjectAccessor::GetCreature(*me, otherGUID)) + c->CastSpell(c, 63630, true); // Vengeful Surge + } - void JustSummoned(Creature* s) - { - if (Creature* c = ObjectAccessor::GetCreature(*me, otherGUID)) - s->GetMotionMaster()->MoveFollow(c, 0.0f, 0.0f); - } + void JustSummoned(Creature* s) + { + if (Creature* c = ObjectAccessor::GetCreature(*me, otherGUID)) + s->GetMotionMaster()->MoveFollow(c, 0.0f, 0.0f); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case 1: - if (Creature* c = ObjectAccessor::GetCreature(*me, otherGUID)) - if (c->IsAlive() && me->GetExactDist2d(c) > 45.0f) - me->CastSpell(me, 63539, true); - if (Creature* c = me->FindNearestCreature(33715, 2.0f, true)) - if (c->IsSummon()) - if (c->ToTempSummon()->GetSummonerGUID() != me->GetGUID()) - me->CastSpell(me, 63528, true); - events.RepeatEvent(2000); - break; - case 2: - me->CastSpell(me->GetVictim(), 63541, false); - events.RepeatEvent(urand(10000,14000)); - break; - case 3: - if (!me->HasAura(63630)) - me->CastSpell(me, 63527, false); - events.RepeatEvent(60000); - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case 1: + if (Creature* c = ObjectAccessor::GetCreature(*me, otherGUID)) + if (c->IsAlive() && me->GetExactDist2d(c) > 45.0f) + me->CastSpell(me, 63539, true); + if (Creature* c = me->FindNearestCreature(33715, 2.0f, true)) + if (c->IsSummon()) + if (c->ToTempSummon()->GetSummonerGUID() != me->GetGUID()) + me->CastSpell(me, 63528, true); + events.RepeatEvent(2000); + break; + case 2: + me->CastSpell(me->GetVictim(), 63541, false); + events.RepeatEvent(urand(10000,14000)); + break; + case 3: + if (!me->HasAura(63630)) + me->CastSpell(me, 63527, false); + events.RepeatEvent(60000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_ulduar_arachnopod_destroyer : public CreatureScript { public: - npc_ulduar_arachnopod_destroyer() : CreatureScript("npc_ulduar_arachnopod_destroyer") { } + npc_ulduar_arachnopod_destroyer() : CreatureScript("npc_ulduar_arachnopod_destroyer") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ulduar_arachnopod_destroyerAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ulduar_arachnopod_destroyerAI(pCreature); + } - struct npc_ulduar_arachnopod_destroyerAI : public ScriptedAI - { - npc_ulduar_arachnopod_destroyerAI(Creature* pCreature) : ScriptedAI(pCreature) - { - _spawnedMechanic = false; - me->ApplySpellImmune(0, IMMUNITY_ID, 64919, true); // Ice Nova from Ice Turret - } + struct npc_ulduar_arachnopod_destroyerAI : public ScriptedAI + { + npc_ulduar_arachnopod_destroyerAI(Creature* pCreature) : ScriptedAI(pCreature) + { + _spawnedMechanic = false; + me->ApplySpellImmune(0, IMMUNITY_ID, 64919, true); // Ice Nova from Ice Turret + } - EventMap events; - bool _spawnedMechanic; + EventMap events; + bool _spawnedMechanic; - void Reset() - { - events.Reset(); - events.ScheduleEvent(1, urand(5000, 8000)); // Flame Spray - events.ScheduleEvent(2, urand(3000, 6000)); // Machine Gun - events.ScheduleEvent(3, 1000); // Charged Leap - } + void Reset() + { + events.Reset(); + events.ScheduleEvent(1, urand(5000, 8000)); // Flame Spray + events.ScheduleEvent(2, urand(3000, 6000)); // Machine Gun + events.ScheduleEvent(3, 1000); // Charged Leap + } - void PassengerBoarded(Unit* p, int8 seat, bool apply) - { - me->setFaction(p->getFaction()); - me->SetReactState(REACT_PASSIVE); - } + void PassengerBoarded(Unit* p, int8 seat, bool apply) + { + me->setFaction(p->getFaction()); + me->SetReactState(REACT_PASSIVE); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (!_spawnedMechanic && me->HealthBelowPctDamaged(20, damage)) - { - _spawnedMechanic = true; - if (Creature* c = me->SummonCreature(34184, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0)) - c->AI()->AttackStart(me->GetVictim()); - me->InterruptNonMeleeSpells(false); - me->CombatStop(true); - me->SetReactState(REACT_PASSIVE); - me->SetRegeneratingHealth(false); - me->setFaction(31); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - me->CastSpell(me, 64770, true); - } - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (!_spawnedMechanic && me->HealthBelowPctDamaged(20, damage)) + { + _spawnedMechanic = true; + if (Creature* c = me->SummonCreature(34184, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0)) + c->AI()->AttackStart(me->GetVictim()); + me->InterruptNonMeleeSpells(false); + me->CombatStop(true); + me->SetReactState(REACT_PASSIVE); + me->SetRegeneratingHealth(false); + me->setFaction(31); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + me->CastSpell(me, 64770, true); + } + } - void AttackStart(Unit* who) - { - if (me->getFaction() == 16) - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (me->getFaction() == 16) + ScriptedAI::AttackStart(who); + } - void EnterEvadeMode() - { - if (me->getFaction() == 16) - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + if (me->getFaction() == 16) + ScriptedAI::EnterEvadeMode(); + } - void OnCharmed(bool apply) {} + void OnCharmed(bool apply) {} - void UpdateAI(uint32 diff) - { - if (me->getFaction() != 16) - { - if (me->IsAlive() && (me->GetExactDist2dSq(2058.0f, 42.0f) < 25.0f*25.0f || me->GetExactDist2dSq(2203.0f, 292.0f) < 25.0f*25.0f || me->GetExactDist2dSq(2125.0f, 170.0f) > 160.0f*160.0f)) - Unit::Kill(me, me, false); - } - else - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (me->getFaction() != 16) + { + if (me->IsAlive() && (me->GetExactDist2dSq(2058.0f, 42.0f) < 25.0f*25.0f || me->GetExactDist2dSq(2203.0f, 292.0f) < 25.0f*25.0f || me->GetExactDist2dSq(2125.0f, 170.0f) > 160.0f*160.0f)) + Unit::Kill(me, me, false); + } + else + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case 0: - break; - case 1: - me->CastSpell(me->GetVictim(), RAID_MODE(64717, 65241), false); - events.RepeatEvent(urand(15000, 25000)); - break; - case 2: - me->CastSpell(me->GetVictim(), RAID_MODE(64776, 65240), false); - events.RepeatEvent(urand(10000, 15000)); - break; - case 3: - { - float dist = me->GetDistance(me->GetVictim()); - if (dist > 10.0f && dist < 40.0f) - { - me->CastSpell(me->GetVictim(), 64779, false); - events.RepeatEvent(25000); - } - else - events.RepeatEvent(3000); - } - break; - } + switch (events.GetEvent()) + { + case 0: + break; + case 1: + me->CastSpell(me->GetVictim(), RAID_MODE(64717, 65241), false); + events.RepeatEvent(urand(15000, 25000)); + break; + case 2: + me->CastSpell(me->GetVictim(), RAID_MODE(64776, 65240), false); + events.RepeatEvent(urand(10000, 15000)); + break; + case 3: + { + float dist = me->GetDistance(me->GetVictim()); + if (dist > 10.0f && dist < 40.0f) + { + me->CastSpell(me->GetVictim(), 64779, false); + events.RepeatEvent(25000); + } + else + events.RepeatEvent(3000); + } + break; + } - DoMeleeAttackIfReady(); - } - } - }; + DoMeleeAttackIfReady(); + } + } + }; }; class spell_ulduar_arachnopod_damaged : public SpellScriptLoader { public: - spell_ulduar_arachnopod_damaged() : SpellScriptLoader("spell_ulduar_arachnopod_damaged") { } + spell_ulduar_arachnopod_damaged() : SpellScriptLoader("spell_ulduar_arachnopod_damaged") { } - class spell_ulduar_arachnopod_damaged_AuraScript : public AuraScript - { - PrepareAuraScript(spell_ulduar_arachnopod_damaged_AuraScript) + class spell_ulduar_arachnopod_damaged_AuraScript : public AuraScript + { + PrepareAuraScript(spell_ulduar_arachnopod_damaged_AuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (Unit* c = GetCaster()) - Unit::Kill(c, c, false); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (Unit* c = GetCaster()) + Unit::Kill(c, c, false); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_ulduar_arachnopod_damaged_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_ulduar_arachnopod_damaged_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_ulduar_arachnopod_damaged_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_ulduar_arachnopod_damaged_AuraScript(); + } }; class AreaTrigger_at_celestial_planetarium_enterance : public AreaTriggerScript @@ -468,9 +468,9 @@ class AreaTrigger_at_celestial_planetarium_enterance : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) { if (player->IsAlive()) - if (uint32 questId = (player->GetMap()->Is25ManRaid() ? 13816 : 13607 /*QUEST_CELESTIAL_PLANETARIUM*/)) - if (player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE) - player->AreaExploredOrEventHappens(questId); + if (uint32 questId = (player->GetMap()->Is25ManRaid() ? 13816 : 13607 /*QUEST_CELESTIAL_PLANETARIUM*/)) + if (player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE) + player->AreaExploredOrEventHappens(questId); return false; } }; @@ -505,15 +505,15 @@ public: void AddSC_ulduar() { - new go_ulduar_teleporter(); - new npc_ulduar_keeper(); + new go_ulduar_teleporter(); + new npc_ulduar_keeper(); - new spell_ulduar_energy_sap(); - new npc_ulduar_snow_mound(); - new npc_ulduar_storm_tempered_keeper(); - new npc_ulduar_arachnopod_destroyer(); - new spell_ulduar_arachnopod_damaged(); + new spell_ulduar_energy_sap(); + new npc_ulduar_snow_mound(); + new npc_ulduar_storm_tempered_keeper(); + new npc_ulduar_arachnopod_destroyer(); + new spell_ulduar_arachnopod_damaged(); - new AreaTrigger_at_celestial_planetarium_enterance(); - new go_call_tram(); + new AreaTrigger_at_celestial_planetarium_enterance(); + new go_call_tram(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index 93587b20e..cf478822b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -7,260 +7,260 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum UlduarEncounters { - MAX_ENCOUNTER = 15, + MAX_ENCOUNTER = 15, - TYPE_LEVIATHAN = 0, - TYPE_IGNIS = 1, - TYPE_RAZORSCALE = 2, - TYPE_XT002 = 3, - TYPE_ASSEMBLY = 4, - TYPE_KOLOGARN = 5, - TYPE_AURIAYA = 6, - TYPE_FREYA = 7, - TYPE_HODIR = 8, - TYPE_MIMIRON = 9, - TYPE_THORIM = 10, - TYPE_VEZAX = 11, - TYPE_YOGGSARON = 12, - TYPE_ALGALON = 13, - TYPE_WATCHERS = 14, + TYPE_LEVIATHAN = 0, + TYPE_IGNIS = 1, + TYPE_RAZORSCALE = 2, + TYPE_XT002 = 3, + TYPE_ASSEMBLY = 4, + TYPE_KOLOGARN = 5, + TYPE_AURIAYA = 6, + TYPE_FREYA = 7, + TYPE_HODIR = 8, + TYPE_MIMIRON = 9, + TYPE_THORIM = 10, + TYPE_VEZAX = 11, + TYPE_YOGGSARON = 12, + TYPE_ALGALON = 13, + TYPE_WATCHERS = 14, }; enum UlduarData { - // Flame Leviathan - DATA_VEHICLE_SPAWN = 100, - DATA_LIGHTNING_WALL1 = 101, - DATA_LIGHTNING_WALL2 = 102, - DATA_REPAIR_STATION1 = 103, - DATA_REPAIR_STATION2 = 104, - DATA_UNBROKEN_ACHIEVEMENT = 105, + // Flame Leviathan + DATA_VEHICLE_SPAWN = 100, + DATA_LIGHTNING_WALL1 = 101, + DATA_LIGHTNING_WALL2 = 102, + DATA_REPAIR_STATION1 = 103, + DATA_REPAIR_STATION2 = 104, + DATA_UNBROKEN_ACHIEVEMENT = 105, - // Razorscales Harpoon Fire State GUIDs - DATA_HARPOON_FIRE_STATE_1 = 200, - DATA_HARPOON_FIRE_STATE_2 = 201, - DATA_HARPOON_FIRE_STATE_3 = 202, - DATA_HARPOON_FIRE_STATE_4 = 203, + // Razorscales Harpoon Fire State GUIDs + DATA_HARPOON_FIRE_STATE_1 = 200, + DATA_HARPOON_FIRE_STATE_2 = 201, + DATA_HARPOON_FIRE_STATE_3 = 202, + DATA_HARPOON_FIRE_STATE_4 = 203, - // Mimiron's first vehicle (spawned by default) - DATA_MIMIRON_LEVIATHAN_MKII = 301, - DATA_MIMIRON_VX001 = 302, - DATA_MIMIRON_ACU = 303, + // Mimiron's first vehicle (spawned by default) + DATA_MIMIRON_LEVIATHAN_MKII = 301, + DATA_MIMIRON_VX001 = 302, + DATA_MIMIRON_ACU = 303, - // Mimiron's Doors - DATA_GO_MIMIRON_DOOR_1 = 311, - DATA_GO_MIMIRON_DOOR_2 = 312, - DATA_GO_MIMIRON_DOOR_3 = 313, + // Mimiron's Doors + DATA_GO_MIMIRON_DOOR_1 = 311, + DATA_GO_MIMIRON_DOOR_2 = 312, + DATA_GO_MIMIRON_DOOR_3 = 313, - // Thorim - DATA_THORIM_LEVER_GATE = 500, - DATA_THORIM_LEVER = 501, - DATA_THORIM_FENCE = 502, - DATA_THORIM_FIRST_DOORS = 503, - DATA_THORIM_SECOND_DOORS = 504, + // Thorim + DATA_THORIM_LEVER_GATE = 500, + DATA_THORIM_LEVER = 501, + DATA_THORIM_FENCE = 502, + DATA_THORIM_FIRST_DOORS = 503, + DATA_THORIM_SECOND_DOORS = 504, - // Assembly of Iron - DATA_STEELBREAKER = 20, - DATA_MOLGEIM = 21, - DATA_BRUNDIR = 22, + // Assembly of Iron + DATA_STEELBREAKER = 20, + DATA_MOLGEIM = 21, + DATA_BRUNDIR = 22, // Algalon the Observer - DATA_ALGALON_SUMMON_STATE = 600, - DATA_DESPAWN_ALGALON = 601, - DATA_ALGALON_DEFEATED = 602, + DATA_ALGALON_SUMMON_STATE = 600, + DATA_DESPAWN_ALGALON = 601, + DATA_ALGALON_DEFEATED = 602, - // Achievements - DATA_DWARFAGEDDON = 700, + // Achievements + DATA_DWARFAGEDDON = 700, - // Tram - DATA_CALL_TRAM = 710, + // Tram + DATA_CALL_TRAM = 710, }; enum UlduarNPCs { - // General - NPC_LEVIATHAN = 33113, - NPC_IGNIS = 33118, - NPC_RAZORSCALE = 33186, - NPC_XT002 = 33293, - NPC_STEELBREAKER = 32867, - NPC_MOLGEIM = 32927, - NPC_BRUNDIR = 32857, - NPC_KOLOGARN = 32930, - NPC_AURIAYA = 33515, - NPC_MIMIRON = 33350, - NPC_HODIR = 32845, - NPC_THORIM = 32865, - NPC_FREYA = 32906, - NPC_VEZAX = 33271, - NPC_SARA = 33134, - NPC_YOGGSARON = 33288, - NPC_BRAIN_OF_YOGG_SARON = 33890, - NPC_ALGALON = 32871, + // General + NPC_LEVIATHAN = 33113, + NPC_IGNIS = 33118, + NPC_RAZORSCALE = 33186, + NPC_XT002 = 33293, + NPC_STEELBREAKER = 32867, + NPC_MOLGEIM = 32927, + NPC_BRUNDIR = 32857, + NPC_KOLOGARN = 32930, + NPC_AURIAYA = 33515, + NPC_MIMIRON = 33350, + NPC_HODIR = 32845, + NPC_THORIM = 32865, + NPC_FREYA = 32906, + NPC_VEZAX = 33271, + NPC_SARA = 33134, + NPC_YOGGSARON = 33288, + NPC_BRAIN_OF_YOGG_SARON = 33890, + NPC_ALGALON = 32871, - // Razorscale - NPC_HARPOON_FIRE_STATE = 33282, + // Razorscale + NPC_HARPOON_FIRE_STATE = 33282, - // Mimiron - NPC_MIMIRON_LEVIATHAN_MKII = 33432, - NPC_MIMIRON_VX001 = 33651, - NPC_MIMIRON_ACU = 33670, + // Mimiron + NPC_MIMIRON_LEVIATHAN_MKII = 33432, + NPC_MIMIRON_VX001 = 33651, + NPC_MIMIRON_ACU = 33670, - // Freya - NPC_ELDER_BRIGHTLEAF = 32915, - NPC_ELDER_STONEBARK = 32914, - NPC_ELDER_IRONBRANCH = 32913, + // Freya + NPC_ELDER_BRIGHTLEAF = 32915, + NPC_ELDER_STONEBARK = 32914, + NPC_ELDER_IRONBRANCH = 32913, - // Yogg-Saron - NPC_FREYA_GOSSIP = 33241, - NPC_HODIR_GOSSIP = 33213, - NPC_THORIM_GOSSIP = 33242, - NPC_MIMIRON_GOSSIP = 33244, - NPC_FREYA_KEEPER = 33410, - NPC_HODIR_KEEPER = 33411, - NPC_MIMIRON_KEEPER = 33412, - NPC_THORIM_KEEPER = 33413, + // Yogg-Saron + NPC_FREYA_GOSSIP = 33241, + NPC_HODIR_GOSSIP = 33213, + NPC_THORIM_GOSSIP = 33242, + NPC_MIMIRON_GOSSIP = 33244, + NPC_FREYA_KEEPER = 33410, + NPC_HODIR_KEEPER = 33411, + NPC_MIMIRON_KEEPER = 33412, + NPC_THORIM_KEEPER = 33413, - // Flame Leviathan - NPC_SALVAGED_SIEGE_ENGINE = 33060, - NPC_SALVAGED_SIEGE_ENGINE_TURRET = 33067, - NPC_VEHICLE_CHOPPER = 33062, - NPC_SALVAGED_DEMOLISHER = 33109, - NPC_SALVAGED_DEMOLISHER_TURRET = 33167, + // Flame Leviathan + NPC_SALVAGED_SIEGE_ENGINE = 33060, + NPC_SALVAGED_SIEGE_ENGINE_TURRET = 33067, + NPC_VEHICLE_CHOPPER = 33062, + NPC_SALVAGED_DEMOLISHER = 33109, + NPC_SALVAGED_DEMOLISHER_TURRET = 33167, - + // Algalon the Observer - NPC_BRANN_BRONZBEARD_ALG = 34064, - NPC_AZEROTH = 34246, - NPC_LIVING_CONSTELLATION = 33052, - NPC_ALGALON_STALKER = 33086, - NPC_COLLAPSING_STAR = 32955, - NPC_BLACK_HOLE = 32953, - NPC_WORM_HOLE = 34099, - NPC_ALGALON_VOID_ZONE_VISUAL_STALKER = 34100, - NPC_ALGALON_STALKER_ASTEROID_TARGET_01 = 33104, - NPC_ALGALON_STALKER_ASTEROID_TARGET_02 = 33105, - NPC_UNLEASHED_DARK_MATTER = 34097, + NPC_BRANN_BRONZBEARD_ALG = 34064, + NPC_AZEROTH = 34246, + NPC_LIVING_CONSTELLATION = 33052, + NPC_ALGALON_STALKER = 33086, + NPC_COLLAPSING_STAR = 32955, + NPC_BLACK_HOLE = 32953, + NPC_WORM_HOLE = 34099, + NPC_ALGALON_VOID_ZONE_VISUAL_STALKER = 34100, + NPC_ALGALON_STALKER_ASTEROID_TARGET_01 = 33104, + NPC_ALGALON_STALKER_ASTEROID_TARGET_02 = 33105, + NPC_UNLEASHED_DARK_MATTER = 34097, }; enum UlduarGameObjects { - // Chests - GO_KOLOGARN_CHEST = 195046, - GO_KOLOGARN_CHEST_HERO = 195047, - GO_THORIM_CHEST = 194312, - GO_THORIM_CHEST_HERO = 194314, - GO_HODIR_CHEST_NORMAL = 194307, - GO_HODIR_CHEST_NORMAL_HERO = 194308, - GO_HODIR_CHEST_HARD = 194200, - GO_HODIR_CHEST_HARD_HERO = 194201, - GO_FREYA_CHEST = 194330, // Normal, -2 - elder offset - GO_FREYA_CHEST_HERO = 194331, // Hero, -2 - elder offset - GO_MIMIRON_CHEST = 194789, - GO_MIMIRON_CHEST_HARD = 194957, - GO_MIMIRON_CHEST_HERO = 194956, - GO_MIMIRON_CHEST_HERO_HARD = 194958, - GO_ALGALON_CHEST = 194821, - GO_ALGALON_CHEST_HERO = 194822, + // Chests + GO_KOLOGARN_CHEST = 195046, + GO_KOLOGARN_CHEST_HERO = 195047, + GO_THORIM_CHEST = 194312, + GO_THORIM_CHEST_HERO = 194314, + GO_HODIR_CHEST_NORMAL = 194307, + GO_HODIR_CHEST_NORMAL_HERO = 194308, + GO_HODIR_CHEST_HARD = 194200, + GO_HODIR_CHEST_HARD_HERO = 194201, + GO_FREYA_CHEST = 194330, // Normal, -2 - elder offset + GO_FREYA_CHEST_HERO = 194331, // Hero, -2 - elder offset + GO_MIMIRON_CHEST = 194789, + GO_MIMIRON_CHEST_HARD = 194957, + GO_MIMIRON_CHEST_HERO = 194956, + GO_MIMIRON_CHEST_HERO_HARD = 194958, + GO_ALGALON_CHEST = 194821, + GO_ALGALON_CHEST_HERO = 194822, - // Flame Leviathan - GO_REPAIR_STATION_TRAP = 194262, - GO_LEVIATHAN_DOORS = 194630, - GO_LIGHTNING_WALL1 = 194905, - GO_LIGHTNING_WALL2 = 194416, - GO_MIMIRONS_TARGETTING_CRYSTAL = 194705, - GO_FREYAS_TARGETTING_CRYSTAL = 194704, - GO_HODIRS_TARGETTING_CRYSTAL = 194707, - GO_THORIMS_TARGETTING_CRYSTAL = 194706, - GO_MIMIRONS_GENERATOR = 194664, - GO_FREYAS_GENERATOR = 194663, - GO_HODIRS_GENERATOR = 194665, - GO_THORIMS_GENERATOR = 194666, - GO_STORM_BEACON = 194414, + // Flame Leviathan + GO_REPAIR_STATION_TRAP = 194262, + GO_LEVIATHAN_DOORS = 194630, + GO_LIGHTNING_WALL1 = 194905, + GO_LIGHTNING_WALL2 = 194416, + GO_MIMIRONS_TARGETTING_CRYSTAL = 194705, + GO_FREYAS_TARGETTING_CRYSTAL = 194704, + GO_HODIRS_TARGETTING_CRYSTAL = 194707, + GO_THORIMS_TARGETTING_CRYSTAL = 194706, + GO_MIMIRONS_GENERATOR = 194664, + GO_FREYAS_GENERATOR = 194663, + GO_HODIRS_GENERATOR = 194665, + GO_THORIMS_GENERATOR = 194666, + GO_STORM_BEACON = 194414, - // Middle - GO_ARCHIVUM_DOORS = 194556, - GO_ASSEMBLY_DOORS = 194554, - GO_KOLOGARN_BRIDGE = 194232, - GO_KOLOGARN_DOORS = 194553, - GO_KEEPERS_GATE = 194255, - GO_XT002_DOORS = 194631, - GO_MIMIRON_TRAM = 194675, + // Middle + GO_ARCHIVUM_DOORS = 194556, + GO_ASSEMBLY_DOORS = 194554, + GO_KOLOGARN_BRIDGE = 194232, + GO_KOLOGARN_DOORS = 194553, + GO_KEEPERS_GATE = 194255, + GO_XT002_DOORS = 194631, + GO_MIMIRON_TRAM = 194675, - // Mimiron, Hodir, Vezax - GO_MIMIRON_ELEVATOR = 194749, - GO_MIMIRON_DOOR_1 = 194776, - GO_MIMIRON_DOOR_2 = 194774, - GO_MIMIRON_DOOR_3 = 194775, - GO_HODIR_FROZEN_DOOR = 194441, - GO_HODIR_DOOR = 194634, - GO_VEZAX_DOOR = 194750, + // Mimiron, Hodir, Vezax + GO_MIMIRON_ELEVATOR = 194749, + GO_MIMIRON_DOOR_1 = 194776, + GO_MIMIRON_DOOR_2 = 194774, + GO_MIMIRON_DOOR_3 = 194775, + GO_HODIR_FROZEN_DOOR = 194441, + GO_HODIR_DOOR = 194634, + GO_VEZAX_DOOR = 194750, - GO_SNOW_MOUND = 194907, + GO_SNOW_MOUND = 194907, - // Thorim - GO_ARENA_LEVER_GATE = 194560, - GO_ARENA_LEVER = 194264, - GO_ARENA_FENCE = 194559, - GO_FIRST_COLOSSUS_DOORS = 194557, - GO_SECOND_COLOSSUS_DOORS = 194558, + // Thorim + GO_ARENA_LEVER_GATE = 194560, + GO_ARENA_LEVER = 194264, + GO_ARENA_FENCE = 194559, + GO_FIRST_COLOSSUS_DOORS = 194557, + GO_SECOND_COLOSSUS_DOORS = 194558, - // Yogg-Saron - GO_YOGG_SARON_DOORS = 194773, + // Yogg-Saron + GO_YOGG_SARON_DOORS = 194773, // Algalon the Observer - GO_CELESTIAL_PLANETARIUM_ACCESS_10 = 194628, - GO_CELESTIAL_PLANETARIUM_ACCESS_25 = 194752, - GO_DOODAD_UL_SIGILDOOR_01 = 194767, - GO_DOODAD_UL_SIGILDOOR_02 = 194911, - GO_DOODAD_UL_SIGILDOOR_03 = 194910, - GO_DOODAD_UL_UNIVERSEFLOOR_01 = 194715, - GO_DOODAD_UL_UNIVERSEFLOOR_02 = 194716, - GO_DOODAD_UL_UNIVERSEGLOBE01 = 194148, - GO_DOODAD_UL_ULDUAR_TRAPDOOR_03 = 194253, - GO_GIFT_OF_THE_OBSERVER_10 = 194821, - GO_GIFT_OF_THE_OBSERVER_25 = 194822, + GO_CELESTIAL_PLANETARIUM_ACCESS_10 = 194628, + GO_CELESTIAL_PLANETARIUM_ACCESS_25 = 194752, + GO_DOODAD_UL_SIGILDOOR_01 = 194767, + GO_DOODAD_UL_SIGILDOOR_02 = 194911, + GO_DOODAD_UL_SIGILDOOR_03 = 194910, + GO_DOODAD_UL_UNIVERSEFLOOR_01 = 194715, + GO_DOODAD_UL_UNIVERSEFLOOR_02 = 194716, + GO_DOODAD_UL_UNIVERSEGLOBE01 = 194148, + GO_DOODAD_UL_ULDUAR_TRAPDOOR_03 = 194253, + GO_GIFT_OF_THE_OBSERVER_10 = 194821, + GO_GIFT_OF_THE_OBSERVER_25 = 194822, }; enum UlduarMisc { - // Flame Leviathan - VEHICLE_POS_START = 0, - VEHICLE_POS_LEVIATHAN = 1, - VEHICLE_POS_NONE = 2, + // Flame Leviathan + VEHICLE_POS_START = 0, + VEHICLE_POS_LEVIATHAN = 1, + VEHICLE_POS_NONE = 2, - EVENT_TOWER_OF_STORM_DESTROYED = 21031, - EVENT_TOWER_OF_FROST_DESTROYED = 21032, - EVENT_TOWER_OF_FLAMES_DESTROYED = 21033, - EVENT_TOWER_OF_LIFE_DESTROYED = 21030, + EVENT_TOWER_OF_STORM_DESTROYED = 21031, + EVENT_TOWER_OF_FROST_DESTROYED = 21032, + EVENT_TOWER_OF_FLAMES_DESTROYED = 21033, + EVENT_TOWER_OF_LIFE_DESTROYED = 21030, - ACTION_LEVIATHAN_REFRESH_TOWERS = -1, - ACTION_TOWER_OF_STORM_DESTROYED = 1, - ACTION_TOWER_OF_FROST_DESTROYED = 2, - ACTION_TOWER_OF_FLAMES_DESTROYED = 3, - ACTION_TOWER_OF_LIFE_DESTROYED = 4, + ACTION_LEVIATHAN_REFRESH_TOWERS = -1, + ACTION_TOWER_OF_STORM_DESTROYED = 1, + ACTION_TOWER_OF_FROST_DESTROYED = 2, + ACTION_TOWER_OF_FLAMES_DESTROYED = 3, + ACTION_TOWER_OF_LIFE_DESTROYED = 4, - // Algalon the Observer - WORLD_STATE_ALGALON_DESPAWN_TIMER = 4131, - WORLD_STATE_ALGALON_TIMER_ENABLED = 4132, + // Algalon the Observer + WORLD_STATE_ALGALON_DESPAWN_TIMER = 4131, + WORLD_STATE_ALGALON_TIMER_ENABLED = 4132, - EVENT_UPDATE_ALGALON_TIMER = 1, - ACTION_FEEDS_ON_TEARS_FAILED = 0, - ACTION_INIT_ALGALON = 1, - ACTION_DESPAWN_ALGALON = 2, + EVENT_UPDATE_ALGALON_TIMER = 1, + ACTION_FEEDS_ON_TEARS_FAILED = 0, + ACTION_INIT_ALGALON = 1, + ACTION_DESPAWN_ALGALON = 2, - TIMER_ALGALON_DEFEATED = 300, - TIMER_ALGALON_TO_SUMMON = 200, - TIMER_ALGALON_SUMMONED = 100, + TIMER_ALGALON_DEFEATED = 300, + TIMER_ALGALON_TO_SUMMON = 200, + TIMER_ALGALON_SUMMONED = 100, - KEEPER_FREYA = 0, - KEEPER_HODIR = 1, - KEEPER_MIMIRON = 2, - KEEPER_THORIM = 3, + KEEPER_FREYA = 0, + KEEPER_HODIR = 1, + KEEPER_MIMIRON = 2, + KEEPER_THORIM = 3, - // Achievement - SPELL_DWARFAGEDDON = 65387, // not exists in dbc + // Achievement + SPELL_DWARFAGEDDON = 65387, // not exists in dbc }; Position const AlgalonSummonPos = {1632.531f, -304.8516f, 450.1123f, 1.530165f}; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 73fc9dc25..6d55956dd 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -8,15 +8,15 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum eDisplayId { - DISPLAYID_DEFAULT = 21953, - DISPLAYID_UNDEAD = 26351, + DISPLAYID_DEFAULT = 21953, + DISPLAYID_UNDEAD = 26351, }; enum eNPCs { - NPC_INGVAR_UNDEAD = 23980, - NPC_ANNHYLDE = 24068, - NPC_THROW = 23997, + NPC_INGVAR_UNDEAD = 23980, + NPC_ANNHYLDE = 24068, + NPC_THROW = 23997, }; enum Yells @@ -37,361 +37,361 @@ enum Yells enum eSpells { - SPELL_SUMMON_VALKYR = 42912, - SPELL_RESURRECTION_BEAM = 42857, - SPELL_RESURRECTION_BALL = 42862, - SPELL_RESURRECTION_HEAL = 42704, - SPELL_INGVAR_TRANSFORM = 42796, + SPELL_SUMMON_VALKYR = 42912, + SPELL_RESURRECTION_BEAM = 42857, + SPELL_RESURRECTION_BALL = 42862, + SPELL_RESURRECTION_HEAL = 42704, + SPELL_INGVAR_TRANSFORM = 42796, - SPELL_STAGGERING_ROAR_N = 42708, - SPELL_STAGGERING_ROAR_H = 59708, - SPELL_CLEAVE = 42724, - SPELL_SMASH_N = 42669, - SPELL_SMASH_H = 59706, - SPELL_ENRAGE_N = 42705, - SPELL_ENRAGE_H = 59707, + SPELL_STAGGERING_ROAR_N = 42708, + SPELL_STAGGERING_ROAR_H = 59708, + SPELL_CLEAVE = 42724, + SPELL_SMASH_N = 42669, + SPELL_SMASH_H = 59706, + SPELL_ENRAGE_N = 42705, + SPELL_ENRAGE_H = 59707, - SPELL_DREADFUL_ROAR_N = 42729, - SPELL_DREADFUL_ROAR_H = 59734, - SPELL_WOE_STRIKE_N = 42730, - SPELL_WOE_STRIKE_H = 59735, - SPELL_DARK_SMASH = 42723, - SPELL_SHADOW_AXE = 42749, + SPELL_DREADFUL_ROAR_N = 42729, + SPELL_DREADFUL_ROAR_H = 59734, + SPELL_WOE_STRIKE_N = 42730, + SPELL_WOE_STRIKE_H = 59735, + SPELL_DARK_SMASH = 42723, + SPELL_SHADOW_AXE = 42749, }; -#define SPELL_STAGGERING_ROAR DUNGEON_MODE(SPELL_STAGGERING_ROAR_N, SPELL_STAGGERING_ROAR_H) -#define SPELL_DREADFUL_ROAR DUNGEON_MODE(SPELL_DREADFUL_ROAR_N, SPELL_DREADFUL_ROAR_H) -#define SPELL_WOE_STRIKE DUNGEON_MODE(SPELL_WOE_STRIKE_N, SPELL_WOE_STRIKE_H) -#define SPELL_SMASH DUNGEON_MODE(SPELL_SMASH_N, SPELL_SMASH_H) -#define SPELL_ENRAGE DUNGEON_MODE(SPELL_ENRAGE_N, SPELL_ENRAGE_H) +#define SPELL_STAGGERING_ROAR DUNGEON_MODE(SPELL_STAGGERING_ROAR_N, SPELL_STAGGERING_ROAR_H) +#define SPELL_DREADFUL_ROAR DUNGEON_MODE(SPELL_DREADFUL_ROAR_N, SPELL_DREADFUL_ROAR_H) +#define SPELL_WOE_STRIKE DUNGEON_MODE(SPELL_WOE_STRIKE_N, SPELL_WOE_STRIKE_H) +#define SPELL_SMASH DUNGEON_MODE(SPELL_SMASH_N, SPELL_SMASH_H) +#define SPELL_ENRAGE DUNGEON_MODE(SPELL_ENRAGE_N, SPELL_ENRAGE_H) enum eEvents { - EVENT_START_RESURRECTION = 1, - EVENT_YELL_DEAD_1, - EVENT_VALKYR_MOVE, - EVENT_ANNHYLDE_YELL, - EVENT_VALKYR_BEAM, - EVENT_RESURRECTION_BALL, - EVENT_RESURRECTION_HEAL, - EVENT_MORPH_TO_UNDEAD, - EVENT_START_PHASE_2, + EVENT_START_RESURRECTION = 1, + EVENT_YELL_DEAD_1, + EVENT_VALKYR_MOVE, + EVENT_ANNHYLDE_YELL, + EVENT_VALKYR_BEAM, + EVENT_RESURRECTION_BALL, + EVENT_RESURRECTION_HEAL, + EVENT_MORPH_TO_UNDEAD, + EVENT_START_PHASE_2, - EVENT_UNROOT, - EVENT_SPELL_ROAR, - EVENT_SPELL_CLEAVE_OR_WOE_STRIKE, - EVENT_SPELL_SMASH, - EVENT_SPELL_ENRAGE_OR_SHADOW_AXE, - EVENT_AXE_RETURN, - EVENT_AXE_PICKUP, + EVENT_UNROOT, + EVENT_SPELL_ROAR, + EVENT_SPELL_CLEAVE_OR_WOE_STRIKE, + EVENT_SPELL_SMASH, + EVENT_SPELL_ENRAGE_OR_SHADOW_AXE, + EVENT_AXE_RETURN, + EVENT_AXE_PICKUP, }; class boss_ingvar_the_plunderer : public CreatureScript { public: - boss_ingvar_the_plunderer() : CreatureScript("boss_ingvar_the_plunderer") { } + boss_ingvar_the_plunderer() : CreatureScript("boss_ingvar_the_plunderer") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_ingvar_the_plundererAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_ingvar_the_plundererAI(pCreature); + } - struct boss_ingvar_the_plundererAI : public ScriptedAI - { - boss_ingvar_the_plundererAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = c->GetInstanceScript(); - } + struct boss_ingvar_the_plundererAI : public ScriptedAI + { + boss_ingvar_the_plundererAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; - uint64 ValkyrGUID; - uint64 ThrowGUID; + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint64 ValkyrGUID; + uint64 ThrowGUID; - void Reset() - { - ValkyrGUID = 0; - ThrowGUID = 0; - events.Reset(); - summons.DespawnAll(); - me->SetDisplayId(DISPLAYID_DEFAULT); - me->LoadEquipment(1); - FeignDeath(false); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); + void Reset() + { + ValkyrGUID = 0; + ThrowGUID = 0; + events.Reset(); + summons.DespawnAll(); + me->SetDisplayId(DISPLAYID_DEFAULT); + me->LoadEquipment(1); + FeignDeath(false); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); - if (pInstance) - pInstance->SetData(DATA_INGVAR, NOT_STARTED); - } + if (pInstance) + pInstance->SetData(DATA_INGVAR, NOT_STARTED); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (me->GetDisplayId() == DISPLAYID_DEFAULT && damage >= me->GetHealth()) - { - damage = 0; - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - FeignDeath(true); - events.Reset(); - events.RescheduleEvent(EVENT_START_RESURRECTION, 1000); - events.RescheduleEvent(EVENT_YELL_DEAD_1, 0); - } - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (me->GetDisplayId() == DISPLAYID_DEFAULT && damage >= me->GetHealth()) + { + damage = 0; + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + FeignDeath(true); + events.Reset(); + events.RescheduleEvent(EVENT_START_RESURRECTION, 1000); + events.RescheduleEvent(EVENT_YELL_DEAD_1, 0); + } + } - void EnterCombat(Unit * /*who*/) - { - events.Reset(); - // schedule Phase 1 abilities - events.RescheduleEvent(EVENT_SPELL_ROAR, 15000); - events.RescheduleEvent(EVENT_SPELL_CLEAVE_OR_WOE_STRIKE, 2000); - events.RescheduleEvent(EVENT_SPELL_SMASH, 5000); - events.RescheduleEvent(EVENT_SPELL_ENRAGE_OR_SHADOW_AXE, 10000); + void EnterCombat(Unit * /*who*/) + { + events.Reset(); + // schedule Phase 1 abilities + events.RescheduleEvent(EVENT_SPELL_ROAR, 15000); + events.RescheduleEvent(EVENT_SPELL_CLEAVE_OR_WOE_STRIKE, 2000); + events.RescheduleEvent(EVENT_SPELL_SMASH, 5000); + events.RescheduleEvent(EVENT_SPELL_ENRAGE_OR_SHADOW_AXE, 10000); - Talk(YELL_AGGRO_1); - me->LowerPlayerDamageReq(me->GetMaxHealth()); + Talk(YELL_AGGRO_1); + me->LowerPlayerDamageReq(me->GetMaxHealth()); - if (pInstance) - pInstance->SetData(DATA_INGVAR, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(DATA_INGVAR, IN_PROGRESS); + } - void JustSummoned(Creature* s) - { - summons.Summon(s); - if (s->GetEntry() == NPC_ANNHYLDE) - { - ValkyrGUID = s->GetGUID(); - s->SetCanFly(true); - s->SetDisableGravity(true); - s->SetHover(true); - s->SetPosition(s->GetPositionX(), s->GetPositionY(), s->GetPositionZ()+35.0f, s->GetOrientation()); - s->SetFacingTo(s->GetOrientation()); - } - else if (s->GetEntry() == NPC_THROW) - { - ThrowGUID = s->GetGUID(); - if( Unit* t = SelectTarget(SELECT_TARGET_RANDOM, 0, 70.0f, true) ) - s->GetMotionMaster()->MovePoint(0, t->GetPositionX(), t->GetPositionY(), t->GetPositionZ()); - } - } + void JustSummoned(Creature* s) + { + summons.Summon(s); + if (s->GetEntry() == NPC_ANNHYLDE) + { + ValkyrGUID = s->GetGUID(); + s->SetCanFly(true); + s->SetDisableGravity(true); + s->SetHover(true); + s->SetPosition(s->GetPositionX(), s->GetPositionY(), s->GetPositionZ()+35.0f, s->GetOrientation()); + s->SetFacingTo(s->GetOrientation()); + } + else if (s->GetEntry() == NPC_THROW) + { + ThrowGUID = s->GetGUID(); + if( Unit* t = SelectTarget(SELECT_TARGET_RANDOM, 0, 70.0f, true) ) + s->GetMotionMaster()->MovePoint(0, t->GetPositionX(), t->GetPositionY(), t->GetPositionZ()); + } + } - void KilledUnit(Unit* /*who*/) - { - if (me->GetDisplayId() == DISPLAYID_DEFAULT) - Talk(YELL_KILL_2); - else - Talk(YELL_KILL_1); - } + void KilledUnit(Unit* /*who*/) + { + if (me->GetDisplayId() == DISPLAYID_DEFAULT) + Talk(YELL_KILL_2); + else + Talk(YELL_KILL_1); + } - void FeignDeath(bool apply) - { - if (apply) - { - me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); - me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - } - else - { - me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); - me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - } - } + void FeignDeath(bool apply) + { + if (apply) + { + me->SetStandState(UNIT_STAND_STATE_DEAD); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + } + else + { + me->SetStandState(UNIT_STAND_STATE_STAND); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + } + } - void JustDied(Unit* /*killer*/) - { - events.Reset(); - summons.DespawnAll(); - Talk(YELL_DEAD_2); - if (pInstance) - { - pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, NPC_INGVAR_UNDEAD, 1); // undead entry needed for achievements - pInstance->SetData(DATA_INGVAR, DONE); - } - } + void JustDied(Unit* /*killer*/) + { + events.Reset(); + summons.DespawnAll(); + Talk(YELL_DEAD_2); + if (pInstance) + { + pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, NPC_INGVAR_UNDEAD, 1); // undead entry needed for achievements + pInstance->SetData(DATA_INGVAR, DONE); + } + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + ScriptedAI::EnterEvadeMode(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_YELL_DEAD_1: - Talk(YELL_DEAD_1); - events.PopEvent(); - break; - case EVENT_START_RESURRECTION: - me->CastSpell(me, SPELL_SUMMON_VALKYR, true); - events.PopEvent(); - events.RescheduleEvent(EVENT_VALKYR_BEAM, 7000); - events.RescheduleEvent(EVENT_VALKYR_MOVE, 1); - events.RescheduleEvent(EVENT_ANNHYLDE_YELL, 3000); - break; - case EVENT_VALKYR_MOVE: - if( Creature* s = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) - s->GetMotionMaster()->MovePoint(1, s->GetPositionX(), s->GetPositionY(), s->GetPositionZ()-15.0f); - events.PopEvent(); - break; - case EVENT_ANNHYLDE_YELL: - if( Creature* s = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) - s->AI()->Talk(YELL_ANHYLDE_2); - events.PopEvent(); - break; - case EVENT_VALKYR_BEAM: - me->RemoveAura(SPELL_SUMMON_VALKYR); - if( Creature* c = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) - c->CastSpell(me, SPELL_RESURRECTION_BEAM, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_RESURRECTION_BALL, 4000); - break; - case EVENT_RESURRECTION_BALL: - me->CastSpell(me, SPELL_RESURRECTION_BALL, true); - events.PopEvent(); - events.RescheduleEvent(EVENT_RESURRECTION_HEAL, 4000); - break; - case EVENT_RESURRECTION_HEAL: - me->RemoveAura(SPELL_RESURRECTION_BALL); - me->CastSpell(me, SPELL_RESURRECTION_HEAL, true); - FeignDeath(false); - events.PopEvent(); - events.RescheduleEvent(EVENT_MORPH_TO_UNDEAD, 3000); - break; - case EVENT_MORPH_TO_UNDEAD: - me->CastSpell(me, SPELL_INGVAR_TRANSFORM, true); - events.PopEvent(); - events.RescheduleEvent(EVENT_START_PHASE_2, 1000); - break; - case EVENT_START_PHASE_2: - if( Creature* c = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) - { - c->DespawnOrUnsummon(); - summons.DespawnAll(); - } - events.PopEvent(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - AttackStart(me->GetVictim()); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - Talk(YELL_AGGRO_2); + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_YELL_DEAD_1: + Talk(YELL_DEAD_1); + events.PopEvent(); + break; + case EVENT_START_RESURRECTION: + me->CastSpell(me, SPELL_SUMMON_VALKYR, true); + events.PopEvent(); + events.RescheduleEvent(EVENT_VALKYR_BEAM, 7000); + events.RescheduleEvent(EVENT_VALKYR_MOVE, 1); + events.RescheduleEvent(EVENT_ANNHYLDE_YELL, 3000); + break; + case EVENT_VALKYR_MOVE: + if( Creature* s = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) + s->GetMotionMaster()->MovePoint(1, s->GetPositionX(), s->GetPositionY(), s->GetPositionZ()-15.0f); + events.PopEvent(); + break; + case EVENT_ANNHYLDE_YELL: + if( Creature* s = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) + s->AI()->Talk(YELL_ANHYLDE_2); + events.PopEvent(); + break; + case EVENT_VALKYR_BEAM: + me->RemoveAura(SPELL_SUMMON_VALKYR); + if( Creature* c = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) + c->CastSpell(me, SPELL_RESURRECTION_BEAM, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_RESURRECTION_BALL, 4000); + break; + case EVENT_RESURRECTION_BALL: + me->CastSpell(me, SPELL_RESURRECTION_BALL, true); + events.PopEvent(); + events.RescheduleEvent(EVENT_RESURRECTION_HEAL, 4000); + break; + case EVENT_RESURRECTION_HEAL: + me->RemoveAura(SPELL_RESURRECTION_BALL); + me->CastSpell(me, SPELL_RESURRECTION_HEAL, true); + FeignDeath(false); + events.PopEvent(); + events.RescheduleEvent(EVENT_MORPH_TO_UNDEAD, 3000); + break; + case EVENT_MORPH_TO_UNDEAD: + me->CastSpell(me, SPELL_INGVAR_TRANSFORM, true); + events.PopEvent(); + events.RescheduleEvent(EVENT_START_PHASE_2, 1000); + break; + case EVENT_START_PHASE_2: + if( Creature* c = ObjectAccessor::GetCreature(*me, ValkyrGUID) ) + { + c->DespawnOrUnsummon(); + summons.DespawnAll(); + } + events.PopEvent(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + AttackStart(me->GetVictim()); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + Talk(YELL_AGGRO_2); - // schedule Phase 2 abilities - events.RescheduleEvent(EVENT_SPELL_ROAR, 15000); - events.RescheduleEvent(EVENT_SPELL_CLEAVE_OR_WOE_STRIKE, 2000); - events.RescheduleEvent(EVENT_SPELL_SMASH, 5000); - events.RescheduleEvent(EVENT_SPELL_ENRAGE_OR_SHADOW_AXE, 10000); + // schedule Phase 2 abilities + events.RescheduleEvent(EVENT_SPELL_ROAR, 15000); + events.RescheduleEvent(EVENT_SPELL_CLEAVE_OR_WOE_STRIKE, 2000); + events.RescheduleEvent(EVENT_SPELL_SMASH, 5000); + events.RescheduleEvent(EVENT_SPELL_ENRAGE_OR_SHADOW_AXE, 10000); - break; + break; - // ABILITIES HERE: - case EVENT_UNROOT: - me->SetControlled(false, UNIT_STATE_ROOT); - me->DisableRotate(false); - events.PopEvent(); - break; - case EVENT_SPELL_ROAR: - Talk(EMOTE_ROAR); + // ABILITIES HERE: + case EVENT_UNROOT: + me->SetControlled(false, UNIT_STATE_ROOT); + me->DisableRotate(false); + events.PopEvent(); + break; + case EVENT_SPELL_ROAR: + Talk(EMOTE_ROAR); - me->_AddCreatureSpellCooldown(SPELL_STAGGERING_ROAR, 0); - me->_AddCreatureSpellCooldown(SPELL_DREADFUL_ROAR, 0); + me->_AddCreatureSpellCooldown(SPELL_STAGGERING_ROAR, 0); + me->_AddCreatureSpellCooldown(SPELL_DREADFUL_ROAR, 0); - if (me->GetDisplayId() == DISPLAYID_DEFAULT) - me->CastSpell((Unit*)NULL, SPELL_STAGGERING_ROAR, false); - else - me->CastSpell((Unit*)NULL, SPELL_DREADFUL_ROAR, false); - events.RepeatEvent(urand(15000,20000)); - break; - case EVENT_SPELL_CLEAVE_OR_WOE_STRIKE: - if( me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0 ) - { - events.RepeatEvent(3000); - break; - } - if (me->GetDisplayId() == DISPLAYID_DEFAULT) - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - else - me->CastSpell(me->GetVictim(), SPELL_WOE_STRIKE, false); - events.RepeatEvent(urand(0,4000)+3000); - break; - case EVENT_SPELL_SMASH: - if( me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0 ) - { - events.RepeatEvent(3000); - break; - } - me->SetControlled(true, UNIT_STATE_ROOT); - me->DisableRotate(true); - me->SendMovementFlagUpdate(); - if (me->GetDisplayId() == DISPLAYID_DEFAULT) - me->CastSpell((Unit*)NULL, SPELL_SMASH, false); - else - me->CastSpell((Unit*)NULL, SPELL_DARK_SMASH, false); - events.RepeatEvent(urand(9000,11000)); - events.RescheduleEvent(EVENT_UNROOT, 3750); - break; - case EVENT_SPELL_ENRAGE_OR_SHADOW_AXE: - if (me->GetDisplayId() == DISPLAYID_DEFAULT) - { - me->CastSpell(me, SPELL_ENRAGE, false); - events.RepeatEvent(10000); - } - else - { - me->CastSpell((Unit*)NULL, SPELL_SHADOW_AXE, true); - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - events.RepeatEvent(35000); - events.RescheduleEvent(EVENT_AXE_RETURN, 10000); - } - break; - case EVENT_AXE_RETURN: - if (Creature* c = ObjectAccessor::GetCreature(*me, ThrowGUID)) - c->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+0.5f); - events.PopEvent(); - events.RescheduleEvent(EVENT_AXE_PICKUP, 1500); - break; - case EVENT_AXE_PICKUP: - if (Creature* c = ObjectAccessor::GetCreature(*me, ThrowGUID)) - { - c->DestroyForNearbyPlayers(); - c->DespawnOrUnsummon(); - summons.DespawnAll(); - } - ThrowGUID = 0; - SetEquipmentSlots(true); - events.PopEvent(); - break; - } + if (me->GetDisplayId() == DISPLAYID_DEFAULT) + me->CastSpell((Unit*)NULL, SPELL_STAGGERING_ROAR, false); + else + me->CastSpell((Unit*)NULL, SPELL_DREADFUL_ROAR, false); + events.RepeatEvent(urand(15000,20000)); + break; + case EVENT_SPELL_CLEAVE_OR_WOE_STRIKE: + if( me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0 ) + { + events.RepeatEvent(3000); + break; + } + if (me->GetDisplayId() == DISPLAYID_DEFAULT) + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + else + me->CastSpell(me->GetVictim(), SPELL_WOE_STRIKE, false); + events.RepeatEvent(urand(0,4000)+3000); + break; + case EVENT_SPELL_SMASH: + if( me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) == 0 ) + { + events.RepeatEvent(3000); + break; + } + me->SetControlled(true, UNIT_STATE_ROOT); + me->DisableRotate(true); + me->SendMovementFlagUpdate(); + if (me->GetDisplayId() == DISPLAYID_DEFAULT) + me->CastSpell((Unit*)NULL, SPELL_SMASH, false); + else + me->CastSpell((Unit*)NULL, SPELL_DARK_SMASH, false); + events.RepeatEvent(urand(9000,11000)); + events.RescheduleEvent(EVENT_UNROOT, 3750); + break; + case EVENT_SPELL_ENRAGE_OR_SHADOW_AXE: + if (me->GetDisplayId() == DISPLAYID_DEFAULT) + { + me->CastSpell(me, SPELL_ENRAGE, false); + events.RepeatEvent(10000); + } + else + { + me->CastSpell((Unit*)NULL, SPELL_SHADOW_AXE, true); + SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + events.RepeatEvent(35000); + events.RescheduleEvent(EVENT_AXE_RETURN, 10000); + } + break; + case EVENT_AXE_RETURN: + if (Creature* c = ObjectAccessor::GetCreature(*me, ThrowGUID)) + c->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+0.5f); + events.PopEvent(); + events.RescheduleEvent(EVENT_AXE_PICKUP, 1500); + break; + case EVENT_AXE_PICKUP: + if (Creature* c = ObjectAccessor::GetCreature(*me, ThrowGUID)) + { + c->DestroyForNearbyPlayers(); + c->DespawnOrUnsummon(); + summons.DespawnAll(); + } + ThrowGUID = 0; + SetEquipmentSlots(true); + events.PopEvent(); + break; + } - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - DoMeleeAttackIfReady(); - } - }; + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_ingvar_the_plunderer() { - new boss_ingvar_the_plunderer(); + new boss_ingvar_the_plunderer(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 2ef053932..0a5a764c2 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -11,363 +11,363 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum eTexts { - SAY_START_COMBAT = 1, - SAY_FROST_TOMB = 3, - SAY_SUMMON_SKELETONS = 2, - SAY_FROST_TOMB_EMOTE = 4, - SAY_DEATH = 5, + SAY_START_COMBAT = 1, + SAY_FROST_TOMB = 3, + SAY_SUMMON_SKELETONS = 2, + SAY_FROST_TOMB_EMOTE = 4, + SAY_DEATH = 5, }; enum eNPCs { - NPC_FROST_TOMB = 23965, - NPC_SKELETON = 23970, + NPC_FROST_TOMB = 23965, + NPC_SKELETON = 23970, }; enum eSpells { - SPELL_FROST_TOMB = 42672, - SPELL_FROST_TOMB_SUMMON = 42714, - SPELL_FROST_TOMB_AURA = 48400, + SPELL_FROST_TOMB = 42672, + SPELL_FROST_TOMB_SUMMON = 42714, + SPELL_FROST_TOMB_AURA = 48400, - SPELL_SHADOWBOLT_N = 43667, - SPELL_SHADOWBOLT_H = 59389, + SPELL_SHADOWBOLT_N = 43667, + SPELL_SHADOWBOLT_H = 59389, }; -#define SPELL_SHADOWBOLT DUNGEON_MODE(SPELL_SHADOWBOLT_N, SPELL_SHADOWBOLT_H) +#define SPELL_SHADOWBOLT DUNGEON_MODE(SPELL_SHADOWBOLT_N, SPELL_SHADOWBOLT_H) enum eEvents { - EVENT_SPELL_SHADOWBOLT = 1, - EVENT_FROST_TOMB, - EVENT_SUMMON_SKELETONS, + EVENT_SPELL_SHADOWBOLT = 1, + EVENT_FROST_TOMB, + EVENT_SUMMON_SKELETONS, }; class npc_frost_tomb : public CreatureScript { public: - npc_frost_tomb() : CreatureScript("npc_frost_tomb") { } + npc_frost_tomb() : CreatureScript("npc_frost_tomb") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_frost_tombAI(pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_frost_tombAI(pCreature); + } - struct npc_frost_tombAI : public NullCreatureAI - { - npc_frost_tombAI(Creature *c) : NullCreatureAI(c), PrisonerGUID(0) - { - if (TempSummon* t = c->ToTempSummon()) - if (Unit* s = t->GetSummoner()) - { - PrisonerGUID = s->GetGUID(); - if( me->GetInstanceScript() && me->GetInstanceScript()->instance->IsHeroic() ) - { - const int32 dmg = 2000; - c->CastCustomSpell(s, SPELL_FROST_TOMB_AURA, NULL, &dmg, NULL, true); - } - else - c->CastSpell(s, SPELL_FROST_TOMB_AURA, true); - } - } - uint64 PrisonerGUID; + struct npc_frost_tombAI : public NullCreatureAI + { + npc_frost_tombAI(Creature *c) : NullCreatureAI(c), PrisonerGUID(0) + { + if (TempSummon* t = c->ToTempSummon()) + if (Unit* s = t->GetSummoner()) + { + PrisonerGUID = s->GetGUID(); + if( me->GetInstanceScript() && me->GetInstanceScript()->instance->IsHeroic() ) + { + const int32 dmg = 2000; + c->CastCustomSpell(s, SPELL_FROST_TOMB_AURA, NULL, &dmg, NULL, true); + } + else + c->CastSpell(s, SPELL_FROST_TOMB_AURA, true); + } + } + uint64 PrisonerGUID; - void JustDied(Unit* killer) - { - if (killer->GetGUID() != me->GetGUID()) - if (InstanceScript* pInstance = me->GetInstanceScript()) - pInstance->SetData(DATA_ON_THE_ROCKS_ACHIEV, 0); + void JustDied(Unit* killer) + { + if (killer->GetGUID() != me->GetGUID()) + if (InstanceScript* pInstance = me->GetInstanceScript()) + pInstance->SetData(DATA_ON_THE_ROCKS_ACHIEV, 0); - if (PrisonerGUID) - if (Unit* p = ObjectAccessor::GetUnit(*me, PrisonerGUID)) - p->RemoveAurasDueToSpell(SPELL_FROST_TOMB_AURA); - me->DespawnOrUnsummon(5000); - } + if (PrisonerGUID) + if (Unit* p = ObjectAccessor::GetUnit(*me, PrisonerGUID)) + p->RemoveAurasDueToSpell(SPELL_FROST_TOMB_AURA); + me->DespawnOrUnsummon(5000); + } - void UpdateAI(uint32 diff) - { - if (PrisonerGUID) - { - if (Unit* p = ObjectAccessor::GetUnit(*me, PrisonerGUID)) - { - if( !p->HasAura(SPELL_FROST_TOMB_AURA) ) - Unit::Kill(me, me); - } - else - Unit::Kill(me, me); - } - } - }; + void UpdateAI(uint32 diff) + { + if (PrisonerGUID) + { + if (Unit* p = ObjectAccessor::GetUnit(*me, PrisonerGUID)) + { + if( !p->HasAura(SPELL_FROST_TOMB_AURA) ) + Unit::Kill(me, me); + } + else + Unit::Kill(me, me); + } + } + }; }; class boss_keleseth : public CreatureScript { public: - boss_keleseth() : CreatureScript("boss_keleseth") { } + boss_keleseth() : CreatureScript("boss_keleseth") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_kelesethAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_kelesethAI (pCreature); + } - struct boss_kelesethAI : public ScriptedAI - { - boss_kelesethAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } + struct boss_kelesethAI : public ScriptedAI + { + boss_kelesethAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - if (pInstance) - pInstance->SetData(DATA_KELESETH, NOT_STARTED); - } + void Reset() + { + events.Reset(); + if (pInstance) + pInstance->SetData(DATA_KELESETH, NOT_STARTED); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - /*void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(SAY_KILL, me); - }*/ + /*void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(SAY_KILL, me); + }*/ - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_KELESETH, DONE); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(DATA_KELESETH, DONE); + } - void EnterCombat(Unit* /*who*/) - { - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_SHADOWBOLT, 0); - events.RescheduleEvent(EVENT_FROST_TOMB, 28000); - events.RescheduleEvent(EVENT_SUMMON_SKELETONS, 4000); + void EnterCombat(Unit* /*who*/) + { + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_SHADOWBOLT, 0); + events.RescheduleEvent(EVENT_FROST_TOMB, 28000); + events.RescheduleEvent(EVENT_SUMMON_SKELETONS, 4000); - Talk(SAY_START_COMBAT); - DoZoneInCombat(); + Talk(SAY_START_COMBAT); + DoZoneInCombat(); - if (pInstance) - pInstance->SetData(DATA_KELESETH, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(DATA_KELESETH, IN_PROGRESS); + } - void AttackStart(Unit* who) - { - if( !who ) - return; + void AttackStart(Unit* who) + { + if( !who ) + return; - UnitAI::AttackStartCaster(who, 12.0f); - } + UnitAI::AttackStartCaster(who, 12.0f); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + events.Update(diff); + + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_SHADOWBOLT: - me->CastSpell(me->GetVictim(), SPELL_SHADOWBOLT, false); - events.RepeatEvent(urand(4000,5000)); - break; - case EVENT_FROST_TOMB: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) ) - if( !target->HasAura(SPELL_FROST_TOMB_AURA) ) - { - Talk(SAY_FROST_TOMB_EMOTE, target); - Talk(SAY_FROST_TOMB); - me->CastSpell(target, SPELL_FROST_TOMB, false); - events.RepeatEvent(15000); - break; - } - events.RepeatEvent(1000); - break; - case EVENT_SUMMON_SKELETONS: - Talk(SAY_SUMMON_SKELETONS); - for (uint8 i = 0; i < 5; ++i) - { - float dist = rand_norm()*4+3.0f; - float angle = rand_norm()*2*M_PI; - if( Creature* c = me->SummonCreature(NPC_SKELETON, 156.2f+cos(angle)*dist, 259.1f+sin(angle)*dist, 42.9f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000) ) - if( Unit* target = c->SelectNearestTarget(250.0f) ) - { - c->AddThreat(target, 5.0f); - DoZoneInCombat(c); - } - } - events.PopEvent(); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_SHADOWBOLT: + me->CastSpell(me->GetVictim(), SPELL_SHADOWBOLT, false); + events.RepeatEvent(urand(4000,5000)); + break; + case EVENT_FROST_TOMB: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true) ) + if( !target->HasAura(SPELL_FROST_TOMB_AURA) ) + { + Talk(SAY_FROST_TOMB_EMOTE, target); + Talk(SAY_FROST_TOMB); + me->CastSpell(target, SPELL_FROST_TOMB, false); + events.RepeatEvent(15000); + break; + } + events.RepeatEvent(1000); + break; + case EVENT_SUMMON_SKELETONS: + Talk(SAY_SUMMON_SKELETONS); + for (uint8 i = 0; i < 5; ++i) + { + float dist = rand_norm()*4+3.0f; + float angle = rand_norm()*2*M_PI; + if( Creature* c = me->SummonCreature(NPC_SKELETON, 156.2f+cos(angle)*dist, 259.1f+sin(angle)*dist, 42.9f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000) ) + if( Unit* target = c->SelectNearestTarget(250.0f) ) + { + c->AddThreat(target, 5.0f); + DoZoneInCombat(c); + } + } + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum eSkeletonEnum { - SPELL_DECREPIFY = 42702, - SPELL_BONE_ARMOR = 59386, - SPELL_SCOURGE_RESURRECTION = 42704, + SPELL_DECREPIFY = 42702, + SPELL_BONE_ARMOR = 59386, + SPELL_SCOURGE_RESURRECTION = 42704, - EVENT_SPELL_DECREPIFY = 1, - EVENT_SPELL_BONE_ARMOR, - EVENT_RESURRECT, - EVENT_RESURRECT_2, + EVENT_SPELL_DECREPIFY = 1, + EVENT_SPELL_BONE_ARMOR, + EVENT_RESURRECT, + EVENT_RESURRECT_2, }; class npc_vrykul_skeleton : public CreatureScript { public: - npc_vrykul_skeleton() : CreatureScript("npc_vrykul_skeleton") { } + npc_vrykul_skeleton() : CreatureScript("npc_vrykul_skeleton") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_vrykul_skeletonAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_vrykul_skeletonAI (pCreature); + } - struct npc_vrykul_skeletonAI : public ScriptedAI - { - npc_vrykul_skeletonAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } + struct npc_vrykul_skeletonAI : public ScriptedAI + { + npc_vrykul_skeletonAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript *pInstance; - EventMap events; + InstanceScript *pInstance; + EventMap events; - void Reset() - { - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_DECREPIFY, urand(10000,20000)); - if( IsHeroic() ) - events.RescheduleEvent(EVENT_SPELL_BONE_ARMOR, urand(25000,120000)); - } + void Reset() + { + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_DECREPIFY, urand(10000,20000)); + if( IsHeroic() ) + events.RescheduleEvent(EVENT_SPELL_BONE_ARMOR, urand(25000,120000)); + } - void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - { - damage = 0; - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetControlled(true, UNIT_STATE_ROOT); - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); - me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - events.RescheduleEvent(EVENT_RESURRECT, 12000); - } - } + void DamageTaken(Unit*, uint32 &damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + { + damage = 0; + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetControlled(true, UNIT_STATE_ROOT); + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + me->SetStandState(UNIT_STAND_STATE_DEAD); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + events.RescheduleEvent(EVENT_RESURRECT, 12000); + } + } - void UpdateAI(uint32 diff) - { - if( pInstance && pInstance->GetData(DATA_KELESETH) != IN_PROGRESS ) - { - if( me->IsAlive() ) - Unit::Kill(me, me); - return; - } + void UpdateAI(uint32 diff) + { + if( pInstance && pInstance->GetData(DATA_KELESETH) != IN_PROGRESS ) + { + if( me->IsAlive() ) + Unit::Kill(me, me); + return; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_SPELL_DECREPIFY: - if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) - me->CastSpell(me->GetVictim(), SPELL_DECREPIFY, false); - events.RepeatEvent(urand(15000,25000)); - break; - case EVENT_SPELL_BONE_ARMOR: - if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) - me->CastSpell((Unit*)NULL, SPELL_BONE_ARMOR, false); - events.RepeatEvent(urand(40000,120000)); - break; - case EVENT_RESURRECT: - events.PopEvent(); - events.DelayEvents(3500); - DoCast(me, SPELL_SCOURGE_RESURRECTION, true); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); - me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - events.RescheduleEvent(EVENT_RESURRECT_2, 3000); - break; - case EVENT_RESURRECT_2: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetControlled(false, UNIT_STATE_ROOT); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - events.PopEvent(); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_SPELL_DECREPIFY: + if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) + me->CastSpell(me->GetVictim(), SPELL_DECREPIFY, false); + events.RepeatEvent(urand(15000,25000)); + break; + case EVENT_SPELL_BONE_ARMOR: + if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) + me->CastSpell((Unit*)NULL, SPELL_BONE_ARMOR, false); + events.RepeatEvent(urand(40000,120000)); + break; + case EVENT_RESURRECT: + events.PopEvent(); + events.DelayEvents(3500); + DoCast(me, SPELL_SCOURGE_RESURRECTION, true); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + events.RescheduleEvent(EVENT_RESURRECT_2, 3000); + break; + case EVENT_RESURRECT_2: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetControlled(false, UNIT_STATE_ROOT); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + events.PopEvent(); + break; + } - if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) - DoMeleeAttackIfReady(); - } - }; + if( !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) ) + DoMeleeAttackIfReady(); + } + }; }; class spell_frost_tomb : public SpellScriptLoader { - public: - spell_frost_tomb() : SpellScriptLoader("spell_frost_tomb") { } + public: + spell_frost_tomb() : SpellScriptLoader("spell_frost_tomb") { } - class spell_frost_tombAuraScript : public AuraScript - { - PrepareAuraScript(spell_frost_tombAuraScript); + class spell_frost_tombAuraScript : public AuraScript + { + PrepareAuraScript(spell_frost_tombAuraScript); - void HandleEffectPeriodic(AuraEffect const* aurEff) - { - PreventDefaultAction(); - if (aurEff->GetTickNumber()==1) - if( Unit* target = GetTarget() ) - target->CastSpell((Unit*)NULL, SPELL_FROST_TOMB_SUMMON, true); - } + void HandleEffectPeriodic(AuraEffect const* aurEff) + { + PreventDefaultAction(); + if (aurEff->GetTickNumber()==1) + if( Unit* target = GetTarget() ) + target->CastSpell((Unit*)NULL, SPELL_FROST_TOMB_SUMMON, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_frost_tombAuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_frost_tombAuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_frost_tombAuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_frost_tombAuraScript(); + } }; void AddSC_boss_keleseth() { - new boss_keleseth(); - new npc_frost_tomb(); - new npc_vrykul_skeleton(); - new spell_frost_tomb(); + new boss_keleseth(); + new npc_frost_tomb(); + new npc_vrykul_skeleton(); + new spell_frost_tomb(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp index 4b4fe8dca..1e4de9855 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp @@ -25,12 +25,12 @@ enum eTexts enum eSpells { - // Skarvald: + // Skarvald: SPELL_CHARGE = 43651, SPELL_STONE_STRIKE = 48583, SPELL_SUMMON_SKARVALD_GHOST = 48613, - // Dalronn: + // Dalronn: SPELL_SHADOW_BOLT_N = 43649, SPELL_SHADOW_BOLT_H = 59575, SPELL_DEBILITATE = 43650, @@ -38,19 +38,19 @@ enum eSpells SPELL_SUMMON_DALRONN_GHOST = 48612, }; -#define SPELL_SHADOW_BOLT DUNGEON_MODE(SPELL_SHADOW_BOLT_N, SPELL_SHADOW_BOLT_H) +#define SPELL_SHADOW_BOLT DUNGEON_MODE(SPELL_SHADOW_BOLT_N, SPELL_SHADOW_BOLT_H) enum eEvents { - EVENT_SPELL_CHARGE = 1, - EVENT_SPELL_STONE_STRIKE, + EVENT_SPELL_CHARGE = 1, + EVENT_SPELL_STONE_STRIKE, - EVENT_SPELL_SHADOW_BOLT, - EVENT_SPELL_DEBILITATE, - EVENT_SPELL_SUMMON_SKELETONS, + EVENT_SPELL_SHADOW_BOLT, + EVENT_SPELL_DEBILITATE, + EVENT_SPELL_SUMMON_SKELETONS, - EVENT_YELL_DALRONN_AGGRO, - EVENT_MATE_DIED, + EVENT_YELL_DALRONN_AGGRO, + EVENT_MATE_DIED, }; class boss_skarvald_the_constructor : public CreatureScript @@ -71,54 +71,54 @@ public: } InstanceScript* pInstance; - EventMap events; + EventMap events; void Reset() { - me->SetLootMode(0); - events.Reset(); - if( me->GetEntry() == NPC_SKARVALD ) - { - if (pInstance) - pInstance->SetData(DATA_DALRONN_AND_SKARVALD, NOT_STARTED); - } - else // NPC_SKARVALD_GHOST - if( Unit* target = me->SelectNearestTarget(50.0f) ) - { - me->AddThreat(target, 0.0f); - AttackStart(target); - } + me->SetLootMode(0); + events.Reset(); + if( me->GetEntry() == NPC_SKARVALD ) + { + if (pInstance) + pInstance->SetData(DATA_DALRONN_AND_SKARVALD, NOT_STARTED); + } + else // NPC_SKARVALD_GHOST + if( Unit* target = me->SelectNearestTarget(50.0f) ) + { + me->AddThreat(target, 0.0f); + AttackStart(target); + } } - void DoAction(int32 param) - { - switch(param) - { - case 1: - events.RescheduleEvent(EVENT_MATE_DIED, 3500); - break; - } - } + void DoAction(int32 param) + { + switch(param) + { + case 1: + events.RescheduleEvent(EVENT_MATE_DIED, 3500); + break; + } + } void EnterCombat(Unit * who) { events.Reset(); - events.RescheduleEvent(EVENT_SPELL_CHARGE, 5000); - events.RescheduleEvent(EVENT_SPELL_STONE_STRIKE, 10000); + events.RescheduleEvent(EVENT_SPELL_CHARGE, 5000); + events.RescheduleEvent(EVENT_SPELL_STONE_STRIKE, 10000); - if (me->GetEntry() == NPC_SKARVALD) - Talk(YELL_SKARVALD_AGGRO); + if (me->GetEntry() == NPC_SKARVALD) + Talk(YELL_SKARVALD_AGGRO); - if (pInstance) - { - pInstance->SetData(DATA_DALRONN_AND_SKARVALD, IN_PROGRESS); - if( Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_DALRONN)) ) - if( !c->IsInCombat() && who ) - { - c->AddThreat(who, 0.0f); - c->AI()->AttackStart(who); - } - } + if (pInstance) + { + pInstance->SetData(DATA_DALRONN_AND_SKARVALD, IN_PROGRESS); + if( Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_DALRONN)) ) + if( !c->IsInCombat() && who ) + { + c->AddThreat(who, 0.0f); + c->AI()->AttackStart(who); + } + } } void KilledUnit(Unit * /*victim*/) @@ -129,64 +129,64 @@ public: void JustDied(Unit* Killer) { - if( me->GetEntry() != NPC_SKARVALD ) - return; - if( pInstance ) - if( Creature* dalronn = pInstance->instance->GetCreature(pInstance->GetData64(DATA_DALRONN)) ) - if( dalronn->isDead() ) - { - Talk(YELL_SKARVALD_SKA_DIEDFIRST); - pInstance->SetData(DATA_DALRONN_AND_SKARVALD, DONE); - pInstance->SetData(DATA_UNLOCK_SKARVALD_LOOT, 0); - return; - } - else - { - Talk(YELL_SKARVALD_DAL_DIED); - dalronn->AI()->DoAction(1); - } - me->CastSpell((Unit*)NULL, SPELL_SUMMON_SKARVALD_GHOST, true); + if( me->GetEntry() != NPC_SKARVALD ) + return; + if( pInstance ) + if( Creature* dalronn = pInstance->instance->GetCreature(pInstance->GetData64(DATA_DALRONN)) ) + if( dalronn->isDead() ) + { + Talk(YELL_SKARVALD_SKA_DIEDFIRST); + pInstance->SetData(DATA_DALRONN_AND_SKARVALD, DONE); + pInstance->SetData(DATA_UNLOCK_SKARVALD_LOOT, 0); + return; + } + else + { + Talk(YELL_SKARVALD_DAL_DIED); + dalronn->AI()->DoAction(1); + } + me->CastSpell((Unit*)NULL, SPELL_SUMMON_SKARVALD_GHOST, true); } void UpdateAI(uint32 diff) { - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + events.Update(diff); + + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_MATE_DIED: - Talk(YELL_SKARVALD_DAL_DIEDFIRST); - events.PopEvent(); - break; - case EVENT_SPELL_CHARGE: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, (IsHeroic() ? 100.0f : 30.0f), true) ) - { - ScriptedAI::DoResetThreat(); - me->AddThreat(target, 10000.0f); - me->CastSpell(target, SPELL_CHARGE, false); - } - events.RepeatEvent(urand(5000,10000)); - break; - case EVENT_SPELL_STONE_STRIKE: - if( me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim()) ) - { - me->CastSpell(me->GetVictim(), SPELL_STONE_STRIKE, false); - events.RepeatEvent(urand(5000,10000)); - } - else - events.RepeatEvent(3000); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_MATE_DIED: + Talk(YELL_SKARVALD_DAL_DIEDFIRST); + events.PopEvent(); + break; + case EVENT_SPELL_CHARGE: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, (IsHeroic() ? 100.0f : 30.0f), true) ) + { + ScriptedAI::DoResetThreat(); + me->AddThreat(target, 10000.0f); + me->CastSpell(target, SPELL_CHARGE, false); + } + events.RepeatEvent(urand(5000,10000)); + break; + case EVENT_SPELL_STONE_STRIKE: + if( me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim()) ) + { + me->CastSpell(me->GetVictim(), SPELL_STONE_STRIKE, false); + events.RepeatEvent(urand(5000,10000)); + } + else + events.RepeatEvent(3000); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; }; @@ -209,61 +209,61 @@ public: } InstanceScript* pInstance; - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; void Reset() { - me->SetLootMode(0); - events.Reset(); - summons.DespawnAll(); - if( me->GetEntry() == NPC_DALRONN ) - { - if (pInstance) - pInstance->SetData(DATA_DALRONN_AND_SKARVALD, NOT_STARTED); - } - else // NPC_DALRONN_GHOST - if( Unit* target = me->SelectNearestTarget(50.0f) ) - { - me->AddThreat(target, 0.0f); - AttackStart(target); - } + me->SetLootMode(0); + events.Reset(); + summons.DespawnAll(); + if( me->GetEntry() == NPC_DALRONN ) + { + if (pInstance) + pInstance->SetData(DATA_DALRONN_AND_SKARVALD, NOT_STARTED); + } + else // NPC_DALRONN_GHOST + if( Unit* target = me->SelectNearestTarget(50.0f) ) + { + me->AddThreat(target, 0.0f); + AttackStart(target); + } } - void DoAction(int32 param) - { - switch(param) - { - case -1: - summons.DespawnAll(); - break; - case 1: - events.RescheduleEvent(EVENT_MATE_DIED, 3500); - break; - } - } + void DoAction(int32 param) + { + switch(param) + { + case -1: + summons.DespawnAll(); + break; + case 1: + events.RescheduleEvent(EVENT_MATE_DIED, 3500); + break; + } + } void EnterCombat(Unit * who) { events.Reset(); - events.RescheduleEvent(EVENT_SPELL_SHADOW_BOLT, 1000); - events.RescheduleEvent(EVENT_SPELL_DEBILITATE, 5000); - if( IsHeroic() ) - events.RescheduleEvent(EVENT_SPELL_SUMMON_SKELETONS, 10000); + events.RescheduleEvent(EVENT_SPELL_SHADOW_BOLT, 1000); + events.RescheduleEvent(EVENT_SPELL_DEBILITATE, 5000); + if( IsHeroic() ) + events.RescheduleEvent(EVENT_SPELL_SUMMON_SKELETONS, 10000); - if (me->GetEntry() == NPC_DALRONN) - events.RescheduleEvent(EVENT_YELL_DALRONN_AGGRO, 4999); + if (me->GetEntry() == NPC_DALRONN) + events.RescheduleEvent(EVENT_YELL_DALRONN_AGGRO, 4999); - if (pInstance) - { - pInstance->SetData(DATA_DALRONN_AND_SKARVALD, IN_PROGRESS); - if( Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SKARVALD)) ) - if( !c->IsInCombat() && who ) - { - c->AddThreat(who, 0.0f); - c->AI()->AttackStart(who); - } - } + if (pInstance) + { + pInstance->SetData(DATA_DALRONN_AND_SKARVALD, IN_PROGRESS); + if( Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SKARVALD)) ) + if( !c->IsInCombat() && who ) + { + c->AddThreat(who, 0.0f); + c->AI()->AttackStart(who); + } + } } void KilledUnit(Unit * /*victim*/) @@ -272,75 +272,75 @@ public: Talk(YELL_DALRONN_KILL); } - void JustSummoned(Creature* s) - { - summons.Summon(s); - } + void JustSummoned(Creature* s) + { + summons.Summon(s); + } void JustDied(Unit* Killer) { - if( me->GetEntry() != NPC_DALRONN ) - return; - if( pInstance ) - if( Creature* skarvald = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SKARVALD)) ) - if( skarvald->isDead() ) - { - Talk(YELL_DALRONN_DAL_DIEDFIRST); - pInstance->SetData(DATA_DALRONN_AND_SKARVALD, DONE); - pInstance->SetData(DATA_UNLOCK_DALRONN_LOOT, 0); - return; - } - else - { - Talk(YELL_DALRONN_SKA_DIED); - skarvald->AI()->DoAction(1); - } - me->CastSpell((Unit*)NULL, SPELL_SUMMON_DALRONN_GHOST, true); + if( me->GetEntry() != NPC_DALRONN ) + return; + if( pInstance ) + if( Creature* skarvald = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SKARVALD)) ) + if( skarvald->isDead() ) + { + Talk(YELL_DALRONN_DAL_DIEDFIRST); + pInstance->SetData(DATA_DALRONN_AND_SKARVALD, DONE); + pInstance->SetData(DATA_UNLOCK_DALRONN_LOOT, 0); + return; + } + else + { + Talk(YELL_DALRONN_SKA_DIED); + skarvald->AI()->DoAction(1); + } + me->CastSpell((Unit*)NULL, SPELL_SUMMON_DALRONN_GHOST, true); } void UpdateAI(uint32 diff) { - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - - if( me->HasUnitState(UNIT_STATE_CASTING) ) - return; + events.Update(diff); + + if( me->HasUnitState(UNIT_STATE_CASTING) ) + return; - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_YELL_DALRONN_AGGRO: - Talk(YELL_DALRONN_AGGRO); - events.PopEvent(); - break; - case EVENT_MATE_DIED: - Talk(YELL_DALRONN_SKA_DIEDFIRST); - events.PopEvent(); - break; - case EVENT_SPELL_SHADOW_BOLT: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 42.0f, true) ) - me->CastSpell(target, SPELL_SHADOW_BOLT, false); - events.RepeatEvent(2500); - break; - case EVENT_SPELL_DEBILITATE: - if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true) ) - { - me->CastSpell(target, SPELL_DEBILITATE, false); - events.RepeatEvent(urand(5000,10000)); - } - else - events.RepeatEvent(3000); - break; - case EVENT_SPELL_SUMMON_SKELETONS: - me->CastSpell((Unit*)NULL, SPELL_SUMMON_SKELETONS, false); - events.RepeatEvent(urand(20000,30000)); - break; - } + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_YELL_DALRONN_AGGRO: + Talk(YELL_DALRONN_AGGRO); + events.PopEvent(); + break; + case EVENT_MATE_DIED: + Talk(YELL_DALRONN_SKA_DIEDFIRST); + events.PopEvent(); + break; + case EVENT_SPELL_SHADOW_BOLT: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 42.0f, true) ) + me->CastSpell(target, SPELL_SHADOW_BOLT, false); + events.RepeatEvent(2500); + break; + case EVENT_SPELL_DEBILITATE: + if( Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true) ) + { + me->CastSpell(target, SPELL_DEBILITATE, false); + events.RepeatEvent(urand(5000,10000)); + } + else + events.RepeatEvent(3000); + break; + case EVENT_SPELL_SUMMON_SKELETONS: + me->CastSpell((Unit*)NULL, SPELL_SUMMON_SKELETONS, false); + events.RepeatEvent(urand(20000,30000)); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; }; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index 1100b79d6..c671e76f5 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -10,351 +10,351 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! class instance_utgarde_keep : public InstanceMapScript { public: - instance_utgarde_keep() : InstanceMapScript("instance_utgarde_keep", 574) { } + instance_utgarde_keep() : InstanceMapScript("instance_utgarde_keep", 574) { } - InstanceScript* GetInstanceScript(InstanceMap* pMap) const - { - return new instance_utgarde_keep_InstanceMapScript(pMap); - } + InstanceScript* GetInstanceScript(InstanceMap* pMap) const + { + return new instance_utgarde_keep_InstanceMapScript(pMap); + } - struct instance_utgarde_keep_InstanceMapScript : public InstanceScript - { - instance_utgarde_keep_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {} + struct instance_utgarde_keep_InstanceMapScript : public InstanceScript + { + instance_utgarde_keep_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {} - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 ForgeEventMask; - std::string str_data; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 ForgeEventMask; + std::string str_data; - uint64 GO_ForgeBellowGUID[3]; - uint64 GO_ForgeFireGUID[3]; - uint64 GO_ForgeAnvilGUID[3]; - uint64 GO_PortcullisGUID[2]; + uint64 GO_ForgeBellowGUID[3]; + uint64 GO_ForgeFireGUID[3]; + uint64 GO_ForgeAnvilGUID[3]; + uint64 GO_PortcullisGUID[2]; - uint64 NPC_KelesethGUID; - uint64 NPC_DalronnGUID; - uint64 NPC_SkarvaldGUID; - uint64 NPC_DalronnGhostGUID; - uint64 NPC_SkarvaldGhostGUID; - uint64 NPC_IngvarGUID; - uint64 NPC_DarkRangerMarrahGUID; - uint64 NPC_SpecialDrakeGUID; - bool bRocksAchiev; + uint64 NPC_KelesethGUID; + uint64 NPC_DalronnGUID; + uint64 NPC_SkarvaldGUID; + uint64 NPC_DalronnGhostGUID; + uint64 NPC_SkarvaldGhostGUID; + uint64 NPC_IngvarGUID; + uint64 NPC_DarkRangerMarrahGUID; + uint64 NPC_SpecialDrakeGUID; + bool bRocksAchiev; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - ForgeEventMask = 0; + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + ForgeEventMask = 0; - memset(&GO_ForgeBellowGUID, 0, sizeof(GO_ForgeBellowGUID)); - memset(&GO_ForgeFireGUID, 0, sizeof(GO_ForgeFireGUID)); - memset(&GO_ForgeAnvilGUID, 0, sizeof(GO_ForgeAnvilGUID)); - memset(&GO_PortcullisGUID, 0, sizeof(GO_PortcullisGUID)); + memset(&GO_ForgeBellowGUID, 0, sizeof(GO_ForgeBellowGUID)); + memset(&GO_ForgeFireGUID, 0, sizeof(GO_ForgeFireGUID)); + memset(&GO_ForgeAnvilGUID, 0, sizeof(GO_ForgeAnvilGUID)); + memset(&GO_PortcullisGUID, 0, sizeof(GO_PortcullisGUID)); - NPC_KelesethGUID = 0; - NPC_DalronnGUID = 0; - NPC_SkarvaldGUID = 0; - NPC_DalronnGhostGUID = 0; - NPC_SkarvaldGhostGUID = 0; - NPC_IngvarGUID = 0; - NPC_DarkRangerMarrahGUID = 0; - NPC_SpecialDrakeGUID = 0; - bRocksAchiev = true; - } + NPC_KelesethGUID = 0; + NPC_DalronnGUID = 0; + NPC_SkarvaldGUID = 0; + NPC_DalronnGhostGUID = 0; + NPC_SkarvaldGhostGUID = 0; + NPC_IngvarGUID = 0; + NPC_DarkRangerMarrahGUID = 0; + NPC_SpecialDrakeGUID = 0; + bRocksAchiev = true; + } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; - } + return false; + } - void OnPlayerEnter(Player* plr) - { - if (Creature* c = instance->GetCreature(NPC_DarkRangerMarrahGUID)) - { - c->SetReactState(REACT_PASSIVE); - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (plr && plr->GetTeamId() == TEAM_HORDE) - { - if (!c->IsVisible()) - c->SetVisible(true); - return; - } - else - if(c->IsVisible()) - c->SetVisible(false); - } - } + void OnPlayerEnter(Player* plr) + { + if (Creature* c = instance->GetCreature(NPC_DarkRangerMarrahGUID)) + { + c->SetReactState(REACT_PASSIVE); + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (plr && plr->GetTeamId() == TEAM_HORDE) + { + if (!c->IsVisible()) + c->SetVisible(true); + return; + } + else + if(c->IsVisible()) + c->SetVisible(false); + } + } - void OnCreatureCreate(Creature* creature) - { - switch(creature->GetEntry()) - { - case NPC_KELESETH: NPC_KelesethGUID = creature->GetGUID(); break; - case NPC_DALRONN: NPC_DalronnGUID = creature->GetGUID(); break; - case NPC_SKARVALD: NPC_SkarvaldGUID = creature->GetGUID(); break; - case NPC_DALRONN_GHOST: NPC_DalronnGhostGUID = creature->GetGUID(); break; - case NPC_SKARVALD_GHOST: NPC_SkarvaldGhostGUID = creature->GetGUID(); break; - case NPC_INGVAR: NPC_IngvarGUID = creature->GetGUID(); break; - case NPC_DARK_RANGER_MARRAH:NPC_DarkRangerMarrahGUID = creature->GetGUID(); break; - case NPC_ENSLAVED_PROTO_DRAKE: if (creature->GetPositionX() < 250.0f) NPC_SpecialDrakeGUID = creature->GetGUID(); break; - } - } + void OnCreatureCreate(Creature* creature) + { + switch(creature->GetEntry()) + { + case NPC_KELESETH: NPC_KelesethGUID = creature->GetGUID(); break; + case NPC_DALRONN: NPC_DalronnGUID = creature->GetGUID(); break; + case NPC_SKARVALD: NPC_SkarvaldGUID = creature->GetGUID(); break; + case NPC_DALRONN_GHOST: NPC_DalronnGhostGUID = creature->GetGUID(); break; + case NPC_SKARVALD_GHOST: NPC_SkarvaldGhostGUID = creature->GetGUID(); break; + case NPC_INGVAR: NPC_IngvarGUID = creature->GetGUID(); break; + case NPC_DARK_RANGER_MARRAH:NPC_DarkRangerMarrahGUID = creature->GetGUID(); break; + case NPC_ENSLAVED_PROTO_DRAKE: if (creature->GetPositionX() < 250.0f) NPC_SpecialDrakeGUID = creature->GetGUID(); break; + } + } - void OnGameObjectCreate(GameObject* go) - { - switch(go->GetEntry()) - { - case GO_BELLOW_1: - GO_ForgeBellowGUID[0] = go->GetGUID(); - if (ForgeEventMask & 1) HandleGameObject(0, true, go); - break; - case GO_BELLOW_2: - GO_ForgeBellowGUID[1] = go->GetGUID(); - if (ForgeEventMask & 2) HandleGameObject(0, true, go); - break; - case GO_BELLOW_3: - GO_ForgeBellowGUID[2] = go->GetGUID(); - if (ForgeEventMask & 4) HandleGameObject(0, true, go); - break; - case GO_FORGEFIRE_1: - GO_ForgeFireGUID[0] = go->GetGUID(); - if (ForgeEventMask & 1) HandleGameObject(0, true, go); - break; - case GO_FORGEFIRE_2: - GO_ForgeFireGUID[1] = go->GetGUID(); - if (ForgeEventMask & 2) HandleGameObject(0, true, go); - break; - case GO_FORGEFIRE_3: - GO_ForgeFireGUID[2] = go->GetGUID(); - if (ForgeEventMask & 4) HandleGameObject(0, true, go); - break; - case GO_GLOWING_ANVIL_1: - GO_ForgeAnvilGUID[0] = go->GetGUID(); - if (ForgeEventMask & 1) HandleGameObject(0, true, go); - break; - case GO_GLOWING_ANVIL_2: - GO_ForgeAnvilGUID[1] = go->GetGUID(); - if (ForgeEventMask & 2) HandleGameObject(0, true, go); - break; - case GO_GLOWING_ANVIL_3: - GO_ForgeAnvilGUID[2] = go->GetGUID(); - if (ForgeEventMask & 4) HandleGameObject(0, true, go); - break; - case GO_GIANT_PORTCULLIS_1: - GO_PortcullisGUID[0] = go->GetGUID(); - if (m_auiEncounter[2] == DONE) HandleGameObject(0, true, go); - break; - case GO_GIANT_PORTCULLIS_2: - GO_PortcullisGUID[1] = go->GetGUID(); - if (m_auiEncounter[2] == DONE) HandleGameObject(0, true, go); - break; - } - } + void OnGameObjectCreate(GameObject* go) + { + switch(go->GetEntry()) + { + case GO_BELLOW_1: + GO_ForgeBellowGUID[0] = go->GetGUID(); + if (ForgeEventMask & 1) HandleGameObject(0, true, go); + break; + case GO_BELLOW_2: + GO_ForgeBellowGUID[1] = go->GetGUID(); + if (ForgeEventMask & 2) HandleGameObject(0, true, go); + break; + case GO_BELLOW_3: + GO_ForgeBellowGUID[2] = go->GetGUID(); + if (ForgeEventMask & 4) HandleGameObject(0, true, go); + break; + case GO_FORGEFIRE_1: + GO_ForgeFireGUID[0] = go->GetGUID(); + if (ForgeEventMask & 1) HandleGameObject(0, true, go); + break; + case GO_FORGEFIRE_2: + GO_ForgeFireGUID[1] = go->GetGUID(); + if (ForgeEventMask & 2) HandleGameObject(0, true, go); + break; + case GO_FORGEFIRE_3: + GO_ForgeFireGUID[2] = go->GetGUID(); + if (ForgeEventMask & 4) HandleGameObject(0, true, go); + break; + case GO_GLOWING_ANVIL_1: + GO_ForgeAnvilGUID[0] = go->GetGUID(); + if (ForgeEventMask & 1) HandleGameObject(0, true, go); + break; + case GO_GLOWING_ANVIL_2: + GO_ForgeAnvilGUID[1] = go->GetGUID(); + if (ForgeEventMask & 2) HandleGameObject(0, true, go); + break; + case GO_GLOWING_ANVIL_3: + GO_ForgeAnvilGUID[2] = go->GetGUID(); + if (ForgeEventMask & 4) HandleGameObject(0, true, go); + break; + case GO_GIANT_PORTCULLIS_1: + GO_PortcullisGUID[0] = go->GetGUID(); + if (m_auiEncounter[2] == DONE) HandleGameObject(0, true, go); + break; + case GO_GIANT_PORTCULLIS_2: + GO_PortcullisGUID[1] = go->GetGUID(); + if (m_auiEncounter[2] == DONE) HandleGameObject(0, true, go); + break; + } + } - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_KELESETH: - m_auiEncounter[0] = data; - if (data == NOT_STARTED) - bRocksAchiev = true; - break; - case DATA_ON_THE_ROCKS_ACHIEV: - bRocksAchiev = false; - break; - case DATA_DALRONN_AND_SKARVALD: - if (data == NOT_STARTED) - { - if( Creature* c = instance->GetCreature(NPC_DalronnGUID) ) - if( c->isDead() ) - { - c->AI()->DoAction(-1); - c->Respawn(); - } - if( Creature* c = instance->GetCreature(NPC_SkarvaldGUID) ) - if( c->isDead() ) - c->Respawn(); - if( Creature* c = instance->GetCreature(NPC_DalronnGhostGUID) ) - { - c->AI()->DoAction(-1); - c->DespawnOrUnsummon(); - } - NPC_DalronnGhostGUID = 0; - if( Creature* c = instance->GetCreature(NPC_SkarvaldGhostGUID) ) - c->DespawnOrUnsummon(); - NPC_SkarvaldGhostGUID = 0; - } - if (data == DONE) - { - if( Creature* c = instance->GetCreature(NPC_DalronnGhostGUID) ) - { - c->AI()->DoAction(-1); - c->DespawnOrUnsummon(); - } - NPC_DalronnGhostGUID = 0; - if( Creature* c = instance->GetCreature(NPC_SkarvaldGhostGUID) ) - c->DespawnOrUnsummon(); - NPC_SkarvaldGhostGUID = 0; - } - - m_auiEncounter[1] = data; - break; - case DATA_UNLOCK_SKARVALD_LOOT: - if( Creature* c = instance->GetCreature(NPC_SkarvaldGUID) ) - { - c->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED | UNIT_DYNFLAG_TAPPED_BY_PLAYER); - c->SetLootMode(1); - c->loot.clear(); - if (uint32 lootid = c->GetCreatureTemplate()->lootid) - c->loot.FillLoot(lootid, LootTemplates_Creature, c->GetLootRecipient(), false, false, c->GetLootMode()); - if (c->GetLootMode()) - c->loot.generateMoneyLoot(c->GetCreatureTemplate()->mingold,c->GetCreatureTemplate()->maxgold); - c->DestroyForNearbyPlayers(); - c->SetVisible(true); - } - break; - case DATA_UNLOCK_DALRONN_LOOT: - if( Creature* c = instance->GetCreature(NPC_DalronnGUID) ) - { - c->AI()->DoAction(-1); - c->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED | UNIT_DYNFLAG_TAPPED_BY_PLAYER); - c->SetLootMode(1); - c->loot.clear(); - if (uint32 lootid = c->GetCreatureTemplate()->lootid) - c->loot.FillLoot(lootid, LootTemplates_Creature, c->GetLootRecipient(), false, false, c->GetLootMode()); - if (c->GetLootMode()) - c->loot.generateMoneyLoot(c->GetCreatureTemplate()->mingold,c->GetCreatureTemplate()->maxgold); - c->DestroyForNearbyPlayers(); - c->SetVisible(true); - } - break; - case DATA_INGVAR: - if (data == DONE) - { - HandleGameObject(GO_PortcullisGUID[0], true); - HandleGameObject(GO_PortcullisGUID[1], true); - } - m_auiEncounter[2] = data; - break; - case DATA_FORGE_1: - case DATA_FORGE_2: - case DATA_FORGE_3: - if (data == NOT_STARTED) - { - HandleGameObject(GO_ForgeBellowGUID[type-100], false); - HandleGameObject(GO_ForgeFireGUID[type-100], false); - HandleGameObject(GO_ForgeAnvilGUID[type-100], false); - ForgeEventMask &= ~((uint32)(1<<(type-100))); - } - else - { - HandleGameObject(GO_ForgeBellowGUID[type-100], true); - HandleGameObject(GO_ForgeFireGUID[type-100], true); - HandleGameObject(GO_ForgeAnvilGUID[type-100], true); - ForgeEventMask |= (uint32)(1<<(type-100)); - } - break; - case DATA_SPECIAL_DRAKE: - if (Creature* c = instance->GetCreature(NPC_SpecialDrakeGUID)) - c->AI()->SetData(28, 6); - break; + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_KELESETH: + m_auiEncounter[0] = data; + if (data == NOT_STARTED) + bRocksAchiev = true; + break; + case DATA_ON_THE_ROCKS_ACHIEV: + bRocksAchiev = false; + break; + case DATA_DALRONN_AND_SKARVALD: + if (data == NOT_STARTED) + { + if( Creature* c = instance->GetCreature(NPC_DalronnGUID) ) + if( c->isDead() ) + { + c->AI()->DoAction(-1); + c->Respawn(); + } + if( Creature* c = instance->GetCreature(NPC_SkarvaldGUID) ) + if( c->isDead() ) + c->Respawn(); + if( Creature* c = instance->GetCreature(NPC_DalronnGhostGUID) ) + { + c->AI()->DoAction(-1); + c->DespawnOrUnsummon(); + } + NPC_DalronnGhostGUID = 0; + if( Creature* c = instance->GetCreature(NPC_SkarvaldGhostGUID) ) + c->DespawnOrUnsummon(); + NPC_SkarvaldGhostGUID = 0; + } + if (data == DONE) + { + if( Creature* c = instance->GetCreature(NPC_DalronnGhostGUID) ) + { + c->AI()->DoAction(-1); + c->DespawnOrUnsummon(); + } + NPC_DalronnGhostGUID = 0; + if( Creature* c = instance->GetCreature(NPC_SkarvaldGhostGUID) ) + c->DespawnOrUnsummon(); + NPC_SkarvaldGhostGUID = 0; + } + + m_auiEncounter[1] = data; + break; + case DATA_UNLOCK_SKARVALD_LOOT: + if( Creature* c = instance->GetCreature(NPC_SkarvaldGUID) ) + { + c->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED | UNIT_DYNFLAG_TAPPED_BY_PLAYER); + c->SetLootMode(1); + c->loot.clear(); + if (uint32 lootid = c->GetCreatureTemplate()->lootid) + c->loot.FillLoot(lootid, LootTemplates_Creature, c->GetLootRecipient(), false, false, c->GetLootMode()); + if (c->GetLootMode()) + c->loot.generateMoneyLoot(c->GetCreatureTemplate()->mingold,c->GetCreatureTemplate()->maxgold); + c->DestroyForNearbyPlayers(); + c->SetVisible(true); + } + break; + case DATA_UNLOCK_DALRONN_LOOT: + if( Creature* c = instance->GetCreature(NPC_DalronnGUID) ) + { + c->AI()->DoAction(-1); + c->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED | UNIT_DYNFLAG_TAPPED_BY_PLAYER); + c->SetLootMode(1); + c->loot.clear(); + if (uint32 lootid = c->GetCreatureTemplate()->lootid) + c->loot.FillLoot(lootid, LootTemplates_Creature, c->GetLootRecipient(), false, false, c->GetLootMode()); + if (c->GetLootMode()) + c->loot.generateMoneyLoot(c->GetCreatureTemplate()->mingold,c->GetCreatureTemplate()->maxgold); + c->DestroyForNearbyPlayers(); + c->SetVisible(true); + } + break; + case DATA_INGVAR: + if (data == DONE) + { + HandleGameObject(GO_PortcullisGUID[0], true); + HandleGameObject(GO_PortcullisGUID[1], true); + } + m_auiEncounter[2] = data; + break; + case DATA_FORGE_1: + case DATA_FORGE_2: + case DATA_FORGE_3: + if (data == NOT_STARTED) + { + HandleGameObject(GO_ForgeBellowGUID[type-100], false); + HandleGameObject(GO_ForgeFireGUID[type-100], false); + HandleGameObject(GO_ForgeAnvilGUID[type-100], false); + ForgeEventMask &= ~((uint32)(1<<(type-100))); + } + else + { + HandleGameObject(GO_ForgeBellowGUID[type-100], true); + HandleGameObject(GO_ForgeFireGUID[type-100], true); + HandleGameObject(GO_ForgeAnvilGUID[type-100], true); + ForgeEventMask |= (uint32)(1<<(type-100)); + } + break; + case DATA_SPECIAL_DRAKE: + if (Creature* c = instance->GetCreature(NPC_SpecialDrakeGUID)) + c->AI()->SetData(28, 6); + break; } - if (data == DONE) - { - SaveToDB(); - } - } + if (data == DONE) + { + SaveToDB(); + } + } - uint64 GetData64(uint32 id) const - { - switch(id) - { - case DATA_KELESETH: return NPC_KelesethGUID; - case DATA_DALRONN: return NPC_DalronnGUID; - case DATA_SKARVALD: return NPC_SkarvaldGUID; - case DATA_INGVAR: return NPC_IngvarGUID; - } - return 0; - } + uint64 GetData64(uint32 id) const + { + switch(id) + { + case DATA_KELESETH: return NPC_KelesethGUID; + case DATA_DALRONN: return NPC_DalronnGUID; + case DATA_SKARVALD: return NPC_SkarvaldGUID; + case DATA_INGVAR: return NPC_IngvarGUID; + } + return 0; + } - uint32 GetData(uint32 id) const - { - switch(id) - { - case DATA_KELESETH: - case DATA_DALRONN_AND_SKARVALD: - case DATA_INGVAR: - return m_auiEncounter[id]; - case DATA_FORGE_1: - case DATA_FORGE_2: - case DATA_FORGE_3: - return ForgeEventMask & (uint32)(1<<(id-100)); - } - return 0; - } + uint32 GetData(uint32 id) const + { + switch(id) + { + case DATA_KELESETH: + case DATA_DALRONN_AND_SKARVALD: + case DATA_INGVAR: + return m_auiEncounter[id]; + case DATA_FORGE_1: + case DATA_FORGE_2: + case DATA_FORGE_3: + return ForgeEventMask & (uint32)(1<<(id-100)); + } + return 0; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "U K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << ForgeEventMask; + std::ostringstream saveStream; + saveStream << "U K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << ForgeEventMask; - str_data = saveStream.str(); + str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint32 data0, data1, data2, data3; + char dataHead1, dataHead2; + uint32 data0, data1, data2, data3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - if (dataHead1 == 'U' && dataHead2 == 'K') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - ForgeEventMask = data3; + if (dataHead1 == 'U' && dataHead2 == 'K') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + ForgeEventMask = data3; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case 7231: // On The Rocks - return bRocksAchiev; - } - return false; - } - }; + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case 7231: // On The Rocks + return bRocksAchiev; + } + return false; + } + }; }; void AddSC_instance_utgarde_keep() { - new instance_utgarde_keep(); + new instance_utgarde_keep(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index 4bfb30e14..c95a996b5 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -24,53 +24,53 @@ public: { pInstance = c->GetInstanceScript(); - float x = me->GetHomePosition().GetPositionX(); - float y = me->GetHomePosition().GetPositionY(); - if (x>344.0f && x<357.0f && y<-35.0f && y>-44.0f) - { - dataId = DATA_FORGE_1; - prevDataId = 0; - } - else if (x>380.0f && x<389.0f && y<-12.0f && y>-21.0f) - { - dataId = DATA_FORGE_2; - prevDataId = DATA_FORGE_1; - } - else - { - dataId = DATA_FORGE_3; - prevDataId = DATA_FORGE_2; - } + float x = me->GetHomePosition().GetPositionX(); + float y = me->GetHomePosition().GetPositionY(); + if (x>344.0f && x<357.0f && y<-35.0f && y>-44.0f) + { + dataId = DATA_FORGE_1; + prevDataId = 0; + } + else if (x>380.0f && x<389.0f && y<-12.0f && y>-21.0f) + { + dataId = DATA_FORGE_2; + prevDataId = DATA_FORGE_1; + } + else + { + dataId = DATA_FORGE_3; + prevDataId = DATA_FORGE_2; + } } InstanceScript* pInstance; uint32 dataId; - uint32 prevDataId; + uint32 prevDataId; void Reset() { if (pInstance) - pInstance->SetData(dataId, NOT_STARTED); + pInstance->SetData(dataId, NOT_STARTED); } void JustDied(Unit* /*killer*/) { if (pInstance) - pInstance->SetData(dataId, DONE); - me->SaveRespawnTime(); + pInstance->SetData(dataId, DONE); + me->SaveRespawnTime(); } void EnterCombat(Unit* /*who*/) { if (pInstance) - { - if (prevDataId && !pInstance->GetData(prevDataId)) - { - EnterEvadeMode(); - return; - } + { + if (prevDataId && !pInstance->GetData(prevDataId)) + { + EnterEvadeMode(); + return; + } pInstance->SetData(dataId, IN_PROGRESS); - } + } me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); } }; @@ -120,17 +120,17 @@ public: { if (type == WAYPOINT_MOTION_TYPE && id == POINT_LAST) { - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.25f); - if (Vehicle* v = me->GetVehicleKit()) - if (Unit* p = v->GetPassenger(0)) - if (Creature* rider = p->ToCreature()) - rider->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.25f); + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.25f); + if (Vehicle* v = me->GetVehicleKit()) + if (Unit* p = v->GetPassenger(0)) + if (Creature* rider = p->ToCreature()) + rider->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.25f); - me->SetDisableGravity(false); - me->SetHover(false); - me->SetCanFly(false); - me->SetFacingTo(0.25f); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetDisableGravity(false); + me->SetHover(false); + me->SetCanFly(false); + me->SetFacingTo(0.25f); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); } } @@ -139,9 +139,9 @@ public: if (type == TYPE_PROTODRAKE_AT && data == DATA_PROTODRAKE_MOVE && !_setData && me->IsAlive() && me->GetDistance(protodrakeCheckPos) < 10.0f) { _setData = true; - me->SetDisableGravity(true); - me->SetHover(true); - me->SetCanFly(true); + me->SetDisableGravity(true); + me->SetHover(true); + me->SetCanFly(true); me->GetMotionMaster()->MovePath(PATH_PROTODRAKE, false); } } @@ -236,5 +236,5 @@ void AddSC_utgarde_keep() new npc_dragonflayer_forge_master(); new npc_enslaved_proto_drake(); - new spell_ticking_time_bomb(); + new spell_ticking_time_bomb(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h index 680970a5f..7c41be1d5 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h @@ -7,54 +7,54 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum eData { - DATA_KELESETH, - DATA_DALRONN_AND_SKARVALD, - DATA_INGVAR, - MAX_ENCOUNTER, - DATA_FORGE_EVENT_MASK, - DATA_DALRONN, - DATA_SKARVALD, - DATA_ON_THE_ROCKS_ACHIEV, + DATA_KELESETH, + DATA_DALRONN_AND_SKARVALD, + DATA_INGVAR, + MAX_ENCOUNTER, + DATA_FORGE_EVENT_MASK, + DATA_DALRONN, + DATA_SKARVALD, + DATA_ON_THE_ROCKS_ACHIEV, - DATA_SPECIAL_DRAKE = 50, + DATA_SPECIAL_DRAKE = 50, - DATA_FORGE_1 = 100, - DATA_FORGE_2, - DATA_FORGE_3, + DATA_FORGE_1 = 100, + DATA_FORGE_2, + DATA_FORGE_3, - DATA_UNLOCK_SKARVALD_LOOT = 200, - DATA_UNLOCK_DALRONN_LOOT, + DATA_UNLOCK_SKARVALD_LOOT = 200, + DATA_UNLOCK_DALRONN_LOOT, }; enum eGameObject { - GO_BELLOW_1 = 186688, - GO_BELLOW_2 = 186689, - GO_BELLOW_3 = 186690, + GO_BELLOW_1 = 186688, + GO_BELLOW_2 = 186689, + GO_BELLOW_3 = 186690, - GO_FORGEFIRE_1 = 186692, - GO_FORGEFIRE_2 = 186693, - GO_FORGEFIRE_3 = 186691, + GO_FORGEFIRE_1 = 186692, + GO_FORGEFIRE_2 = 186693, + GO_FORGEFIRE_3 = 186691, - GO_GLOWING_ANVIL_1 = 186609, - GO_GLOWING_ANVIL_2 = 186610, - GO_GLOWING_ANVIL_3 = 186611, + GO_GLOWING_ANVIL_1 = 186609, + GO_GLOWING_ANVIL_2 = 186610, + GO_GLOWING_ANVIL_3 = 186611, - GO_GIANT_PORTCULLIS_1 = 186756, - GO_GIANT_PORTCULLIS_2 = 186694, + GO_GIANT_PORTCULLIS_1 = 186756, + GO_GIANT_PORTCULLIS_2 = 186694, }; enum eCreatures { - NPC_KELESETH = 23953, - NPC_DALRONN = 24201, - NPC_DALRONN_GHOST = 27389, - NPC_SKARVALD = 24200, - NPC_SKARVALD_GHOST = 27390, - NPC_INGVAR = 23954, + NPC_KELESETH = 23953, + NPC_DALRONN = 24201, + NPC_DALRONN_GHOST = 27389, + NPC_SKARVALD = 24200, + NPC_SKARVALD_GHOST = 27390, + NPC_INGVAR = 23954, - NPC_DARK_RANGER_MARRAH = 24137, - NPC_ENSLAVED_PROTO_DRAKE = 24083, + NPC_DARK_RANGER_MARRAH = 24137, + NPC_ENSLAVED_PROTO_DRAKE = 24083, }; #endif diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index f7f04ff76..4ec277183 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -8,86 +8,86 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Misc { - SAY_AGGRO = 0, - SAY_SLAY = 1, - SOUND_DEATH = 13467, + SAY_AGGRO = 0, + SAY_SLAY = 1, + SOUND_DEATH = 13467, - // EVENT - SPELL_ORB_VISUAL = 48044, - SPELL_ORB_CHANNEL = 48048, - NPC_ORB_TRIGGER = 22515, - SPELL_AWAKEN_SUBBOSS = 47669, + // EVENT + SPELL_ORB_VISUAL = 48044, + SPELL_ORB_CHANNEL = 48048, + NPC_ORB_TRIGGER = 22515, + SPELL_AWAKEN_SUBBOSS = 47669, - // PALEHOOF - SPELL_ARCING_SMASH = 48260, - SPELL_IMPALE_N = 48261, - SPELL_IMPALE_H = 59268, - SPELL_WITHERING_ROAR_N = 48256, - SPELL_WITHERING_ROAR_H = 59267, - SPELL_FREEZE = 16245, + // PALEHOOF + SPELL_ARCING_SMASH = 48260, + SPELL_IMPALE_N = 48261, + SPELL_IMPALE_H = 59268, + SPELL_WITHERING_ROAR_N = 48256, + SPELL_WITHERING_ROAR_H = 59267, + SPELL_FREEZE = 16245, // Massive Jormungar - SPELL_ACID_SPIT = 48132, - SPELL_ACID_SPLATTER_N = 48136, - SPELL_ACID_SPLATTER_H = 59272, - SPELL_POISON_BREATH_N = 48133, - SPELL_POISON_BREATH_H = 59271, - NPC_JORMUNGAR_WORM = 27228, + SPELL_ACID_SPIT = 48132, + SPELL_ACID_SPLATTER_N = 48136, + SPELL_ACID_SPLATTER_H = 59272, + SPELL_POISON_BREATH_N = 48133, + SPELL_POISON_BREATH_H = 59271, + NPC_JORMUNGAR_WORM = 27228, // Ferocious Rhino - SPELL_GORE_N = 48130, - SPELL_GORE_H = 59264, - SPELL_GRIEVOUS_WOUND_N = 48105, - SPELL_GRIEVOUS_WOUND_H = 59263, - SPELL_STOMP = 48131, + SPELL_GORE_N = 48130, + SPELL_GORE_H = 59264, + SPELL_GRIEVOUS_WOUND_N = 48105, + SPELL_GRIEVOUS_WOUND_H = 59263, + SPELL_STOMP = 48131, // Ravenous Furbolg - SPELL_CHAIN_LIGHTING_N = 48140, - SPELL_CHAIN_LIGHTING_H = 59273, - SPELL_CRAZED = 48139, - SPELL_TERRIFYING_ROAR = 48144, + SPELL_CHAIN_LIGHTING_N = 48140, + SPELL_CHAIN_LIGHTING_H = 59273, + SPELL_CRAZED = 48139, + SPELL_TERRIFYING_ROAR = 48144, // Frenzied Worgen - SPELL_MORTAL_WOUND_N = 48137, - SPELL_MORTAL_WOUND_H = 59265, - SPELL_ENRAGE_1 = 48138, - SPELL_ENRAGE_2 = 48142, + SPELL_MORTAL_WOUND_N = 48137, + SPELL_MORTAL_WOUND_H = 59265, + SPELL_ENRAGE_1 = 48138, + SPELL_ENRAGE_2 = 48142, - // ACTIONS - ACTION_START_EVENT = 1, - ACTION_UNFREEZE = 2, - ACTION_DESPAWN_ADDS = 3, - ACTION_MINIBOSS_DIED = 4, - ACTION_UNFREEZE2 = 5, + // ACTIONS + ACTION_START_EVENT = 1, + ACTION_UNFREEZE = 2, + ACTION_DESPAWN_ADDS = 3, + ACTION_MINIBOSS_DIED = 4, + ACTION_UNFREEZE2 = 5, }; enum Events { - EVENT_UNFREEZE_MONSTER = 1, - EVENT_START_FIGHT = 2, - EVENT_UNFREEZE_MONSTER2 = 3, + EVENT_UNFREEZE_MONSTER = 1, + EVENT_START_FIGHT = 2, + EVENT_UNFREEZE_MONSTER2 = 3, - EVENT_PALEHOOF_START = 4, - EVENT_PALEHOOF_START2 = 5, - EVENT_PALEHOOF_WITHERING_ROAR = 6, - EVENT_PALEHOOF_IMPALE = 7, - EVENT_PALEHOOF_ARCING_SMASH = 8, + EVENT_PALEHOOF_START = 4, + EVENT_PALEHOOF_START2 = 5, + EVENT_PALEHOOF_WITHERING_ROAR = 6, + EVENT_PALEHOOF_IMPALE = 7, + EVENT_PALEHOOF_ARCING_SMASH = 8, - EVENT_JORMUNGAR_ACID_SPIT = 10, - EVENT_JORMUNGAR_ACID_SPLATTER = 11, - EVENT_JORMUNGAR_POISON_BREATH = 12, + EVENT_JORMUNGAR_ACID_SPIT = 10, + EVENT_JORMUNGAR_ACID_SPLATTER = 11, + EVENT_JORMUNGAR_POISON_BREATH = 12, - EVENT_RHINO_STOMP = 20, - EVENT_RHINO_GORE = 21, - EVENT_RHINO_WOUND = 22, + EVENT_RHINO_STOMP = 20, + EVENT_RHINO_GORE = 21, + EVENT_RHINO_WOUND = 22, - EVENT_FURBOLG_CHAIN = 30, - EVENT_FURBOLG_CRAZED = 31, - EVENT_FURBOLG_ROAR = 32, + EVENT_FURBOLG_CHAIN = 30, + EVENT_FURBOLG_CRAZED = 31, + EVENT_FURBOLG_ROAR = 32, - EVENT_WORGEN_MORTAL = 40, - EVENT_WORGEN_ENRAGE1 = 41, - EVENT_WORGEN_ENRAGE2 = 42, + EVENT_WORGEN_MORTAL = 40, + EVENT_WORGEN_ENRAGE1 = 41, + EVENT_WORGEN_ENRAGE2 = 42, }; /*###### @@ -104,227 +104,227 @@ public: return new boss_palehoofAI (pCreature); } - struct boss_palehoofAI : public ScriptedAI - { - boss_palehoofAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) - { - m_pInstance = pCreature->GetInstanceScript(); - } + struct boss_palehoofAI : public ScriptedAI + { + boss_palehoofAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) + { + m_pInstance = pCreature->GetInstanceScript(); + } - InstanceScript *m_pInstance; - EventMap events; - SummonList summons; - uint64 OrbGUID; - uint8 Counter; - uint8 RandomUnfreeze[4]; + InstanceScript *m_pInstance; + EventMap events; + SummonList summons; + uint64 OrbGUID; + uint8 Counter; + uint8 RandomUnfreeze[4]; - void Reset() - { - for (uint8 i = 0; i < 4; ++i) - { - bool good; - do - { - good = true; - RandomUnfreeze[i] = urand(0,3); + void Reset() + { + for (uint8 i = 0; i < 4; ++i) + { + bool good; + do + { + good = true; + RandomUnfreeze[i] = urand(0,3); - for (uint8 j = 0; j < i; ++j) - if (RandomUnfreeze[i] == RandomUnfreeze[j]) - { - good = false; - break; - } - } - while (!good); - } - - events.Reset(); - summons.DoAction(ACTION_DESPAWN_ADDS); - summons.DespawnAll(); - OrbGUID = 0; - Counter = 0; - me->CastSpell(me, SPELL_FREEZE, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(false, UNIT_STATE_STUNNED); + for (uint8 j = 0; j < i; ++j) + if (RandomUnfreeze[i] == RandomUnfreeze[j]) + { + good = false; + break; + } + } + while (!good); + } + + events.Reset(); + summons.DoAction(ACTION_DESPAWN_ADDS); + summons.DespawnAll(); + OrbGUID = 0; + Counter = 0; + me->CastSpell(me, SPELL_FREEZE, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->SetControlled(false, UNIT_STATE_STUNNED); - if (m_pInstance) - { - m_pInstance->SetData(DATA_GORTOK_PALEHOOF, NOT_STARTED); + if (m_pInstance) + { + m_pInstance->SetData(DATA_GORTOK_PALEHOOF, NOT_STARTED); - // Reset statue - if (GameObject *statisGenerator = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(STATIS_GENERATOR))) - { - statisGenerator->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - statisGenerator->SetGoState(GO_STATE_READY); - } + // Reset statue + if (GameObject *statisGenerator = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(STATIS_GENERATOR))) + { + statisGenerator->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + statisGenerator->SetGoState(GO_STATE_READY); + } - // Reset mini bosses - for(uint8 i = 0; i < 4; ++i) - { - if(Creature *Animal = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_NPC_FRENZIED_WORGEN+i))) - { - Animal->SetPosition(Animal->GetHomePosition()); - Animal->StopMovingOnCurrentPos(); - if(Animal->isDead()) - Animal->Respawn(true); + // Reset mini bosses + for(uint8 i = 0; i < 4; ++i) + { + if(Creature *Animal = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_NPC_FRENZIED_WORGEN+i))) + { + Animal->SetPosition(Animal->GetHomePosition()); + Animal->StopMovingOnCurrentPos(); + if(Animal->isDead()) + Animal->Respawn(true); - Animal->CastSpell(Animal, SPELL_FREEZE, true); - } - } - } - } + Animal->CastSpell(Animal, SPELL_FREEZE, true); + } + } + } + } - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT) - { - if (Creature *cr = me->SummonCreature(NPC_ORB_TRIGGER, 238.608f, -460.71f, 109.567f)) - { - OrbGUID = cr->GetGUID(); - cr->AddAura(SPELL_ORB_VISUAL, cr); - summons.Summon(cr); - cr->SetDisableGravity(true); - cr->GetMotionMaster()->MovePoint(0, 275.4f, -453, 110); // ROOM CENTER - events.RescheduleEvent(EVENT_UNFREEZE_MONSTER, 10000); - me->SetInCombatWithZone(); - me->SetControlled(true, UNIT_STATE_STUNNED); - } - } - else if (param == ACTION_MINIBOSS_DIED) - { - if (Counter > (IsHeroic() ? 3 : 1)) - events.RescheduleEvent(EVENT_PALEHOOF_START, 3000); - else - events.RescheduleEvent(EVENT_UNFREEZE_MONSTER, 3000); - } - } - void EnterCombat(Unit* pWho) - { - if (m_pInstance) - m_pInstance->SetData(DATA_GORTOK_PALEHOOF, IN_PROGRESS); - } + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT) + { + if (Creature *cr = me->SummonCreature(NPC_ORB_TRIGGER, 238.608f, -460.71f, 109.567f)) + { + OrbGUID = cr->GetGUID(); + cr->AddAura(SPELL_ORB_VISUAL, cr); + summons.Summon(cr); + cr->SetDisableGravity(true); + cr->GetMotionMaster()->MovePoint(0, 275.4f, -453, 110); // ROOM CENTER + events.RescheduleEvent(EVENT_UNFREEZE_MONSTER, 10000); + me->SetInCombatWithZone(); + me->SetControlled(true, UNIT_STATE_STUNNED); + } + } + else if (param == ACTION_MINIBOSS_DIED) + { + if (Counter > (IsHeroic() ? 3 : 1)) + events.RescheduleEvent(EVENT_PALEHOOF_START, 3000); + else + events.RescheduleEvent(EVENT_UNFREEZE_MONSTER, 3000); + } + } + void EnterCombat(Unit* pWho) + { + if (m_pInstance) + m_pInstance->SetData(DATA_GORTOK_PALEHOOF, IN_PROGRESS); + } - void MoveInLineOfSight(Unit *who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + void MoveInLineOfSight(Unit *who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void JustReachedHome() - { - me->SetStandState(UNIT_STAND_STATE_STAND); - } + void JustReachedHome() + { + me->SetStandState(UNIT_STAND_STATE_STAND); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_UNFREEZE_MONSTER: - { - if (Creature *orb = ObjectAccessor::GetCreature(*me, OrbGUID)) - { - if (Creature *miniBoss = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_NPC_FRENZIED_WORGEN+RandomUnfreeze[Counter]))) - { - Counter++; - miniBoss->AI()->DoAction(ACTION_UNFREEZE); - orb->CastSpell(miniBoss, SPELL_AWAKEN_SUBBOSS, true); - events.ScheduleEvent(EVENT_UNFREEZE_MONSTER2, 6000); - } - else - EnterEvadeMode(); - } - events.PopEvent(); - break; - } - case EVENT_UNFREEZE_MONSTER2: - { - if (Creature *orb = ObjectAccessor::GetCreature(*me, OrbGUID)) - { - if (Creature *miniBoss = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_NPC_FRENZIED_WORGEN+RandomUnfreeze[Counter-1]))) - { - miniBoss->AI()->DoAction(ACTION_UNFREEZE2); - orb->RemoveAurasDueToSpell(SPELL_AWAKEN_SUBBOSS); - } - else - EnterEvadeMode(); - } - events.PopEvent(); - break; - } - case EVENT_PALEHOOF_START: - { - if (Creature *orb = ObjectAccessor::GetCreature(*me, OrbGUID)) - { - orb->CastSpell(me, SPELL_AWAKEN_SUBBOSS, true); - events.ScheduleEvent(EVENT_PALEHOOF_START2, 6000); - } - events.PopEvent(); - break; - } - case EVENT_PALEHOOF_START2: - { - Talk(SAY_AGGRO); - if (Creature *orb = ObjectAccessor::GetCreature(*me, OrbGUID)) - orb->RemoveAurasDueToSpell(SPELL_AWAKEN_SUBBOSS); + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_UNFREEZE_MONSTER: + { + if (Creature *orb = ObjectAccessor::GetCreature(*me, OrbGUID)) + { + if (Creature *miniBoss = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_NPC_FRENZIED_WORGEN+RandomUnfreeze[Counter]))) + { + Counter++; + miniBoss->AI()->DoAction(ACTION_UNFREEZE); + orb->CastSpell(miniBoss, SPELL_AWAKEN_SUBBOSS, true); + events.ScheduleEvent(EVENT_UNFREEZE_MONSTER2, 6000); + } + else + EnterEvadeMode(); + } + events.PopEvent(); + break; + } + case EVENT_UNFREEZE_MONSTER2: + { + if (Creature *orb = ObjectAccessor::GetCreature(*me, OrbGUID)) + { + if (Creature *miniBoss = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_NPC_FRENZIED_WORGEN+RandomUnfreeze[Counter-1]))) + { + miniBoss->AI()->DoAction(ACTION_UNFREEZE2); + orb->RemoveAurasDueToSpell(SPELL_AWAKEN_SUBBOSS); + } + else + EnterEvadeMode(); + } + events.PopEvent(); + break; + } + case EVENT_PALEHOOF_START: + { + if (Creature *orb = ObjectAccessor::GetCreature(*me, OrbGUID)) + { + orb->CastSpell(me, SPELL_AWAKEN_SUBBOSS, true); + events.ScheduleEvent(EVENT_PALEHOOF_START2, 6000); + } + events.PopEvent(); + break; + } + case EVENT_PALEHOOF_START2: + { + Talk(SAY_AGGRO); + if (Creature *orb = ObjectAccessor::GetCreature(*me, OrbGUID)) + orb->RemoveAurasDueToSpell(SPELL_AWAKEN_SUBBOSS); - me->RemoveAurasDueToSpell(SPELL_FREEZE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(false, UNIT_STATE_STUNNED); - // SETINCOMBATWITHZONE + me->RemoveAurasDueToSpell(SPELL_FREEZE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->SetControlled(false, UNIT_STATE_STUNNED); + // SETINCOMBATWITHZONE - // schedule combat events - events.ScheduleEvent(EVENT_PALEHOOF_WITHERING_ROAR, 10000); - events.ScheduleEvent(EVENT_PALEHOOF_IMPALE, 12000); - events.ScheduleEvent(EVENT_PALEHOOF_ARCING_SMASH, 15000); - events.PopEvent(); - break; - } - case EVENT_PALEHOOF_WITHERING_ROAR: - { - me->CastSpell(me, IsHeroic() ? SPELL_WITHERING_ROAR_H : SPELL_WITHERING_ROAR_N, false); - events.RepeatEvent(8000 + rand()%4000); - break; - } - case EVENT_PALEHOOF_IMPALE: - { - if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(tgt, IsHeroic() ? SPELL_IMPALE_H : SPELL_IMPALE_N, false); + // schedule combat events + events.ScheduleEvent(EVENT_PALEHOOF_WITHERING_ROAR, 10000); + events.ScheduleEvent(EVENT_PALEHOOF_IMPALE, 12000); + events.ScheduleEvent(EVENT_PALEHOOF_ARCING_SMASH, 15000); + events.PopEvent(); + break; + } + case EVENT_PALEHOOF_WITHERING_ROAR: + { + me->CastSpell(me, IsHeroic() ? SPELL_WITHERING_ROAR_H : SPELL_WITHERING_ROAR_N, false); + events.RepeatEvent(8000 + rand()%4000); + break; + } + case EVENT_PALEHOOF_IMPALE: + { + if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(tgt, IsHeroic() ? SPELL_IMPALE_H : SPELL_IMPALE_N, false); - events.RepeatEvent(8000 + rand()%4000); - break; - } - case EVENT_PALEHOOF_ARCING_SMASH: - { - me->CastSpell(me->GetVictim(), SPELL_ARCING_SMASH, false); - events.RepeatEvent(13000 + rand()%4000); - break; - } - } - - DoMeleeAttackIfReady(); - } + events.RepeatEvent(8000 + rand()%4000); + break; + } + case EVENT_PALEHOOF_ARCING_SMASH: + { + me->CastSpell(me->GetVictim(), SPELL_ARCING_SMASH, false); + events.RepeatEvent(13000 + rand()%4000); + break; + } + } + + DoMeleeAttackIfReady(); + } - void JustDied(Unit* pKiller) - { - me->SendPlaySound(SOUND_DEATH, false); - if(m_pInstance) - m_pInstance->SetData(DATA_GORTOK_PALEHOOF, DONE); - } + void JustDied(Unit* pKiller) + { + me->SendPlaySound(SOUND_DEATH, false); + if(m_pInstance) + m_pInstance->SetData(DATA_GORTOK_PALEHOOF, DONE); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; - Talk(SAY_SLAY); - } - }; + Talk(SAY_SLAY); + } + }; }; /*###### @@ -341,118 +341,118 @@ public: return new npc_massive_jormungarAI (pCreature); } - struct npc_massive_jormungarAI : public ScriptedAI - { - npc_massive_jormungarAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) - { - m_pInstance = pCreature->GetInstanceScript(); - } + struct npc_massive_jormungarAI : public ScriptedAI + { + npc_massive_jormungarAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) + { + m_pInstance = pCreature->GetInstanceScript(); + } - InstanceScript *m_pInstance; - EventMap events; - SummonList summons; + InstanceScript *m_pInstance; + EventMap events; + SummonList summons; - void Reset() - { - summons.DespawnAll(); - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - } + void Reset() + { + summons.DespawnAll(); + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + } - void EnterCombat(Unit *) {} + void EnterCombat(Unit *) {} - void DoAction(int32 param) - { - if (param == ACTION_UNFREEZE) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else if (param == ACTION_UNFREEZE2) - { - me->RemoveAurasDueToSpell(SPELL_FREEZE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetInCombatWithZone(); + void DoAction(int32 param) + { + if (param == ACTION_UNFREEZE) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else if (param == ACTION_UNFREEZE2) + { + me->RemoveAurasDueToSpell(SPELL_FREEZE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_JORMUNGAR_ACID_SPIT, 3000); - events.ScheduleEvent(EVENT_JORMUNGAR_ACID_SPLATTER, 12000); - events.ScheduleEvent(EVENT_JORMUNGAR_POISON_BREATH, 10000); - } - else if (param == ACTION_DESPAWN_ADDS) - summons.DespawnAll(); - } + events.ScheduleEvent(EVENT_JORMUNGAR_ACID_SPIT, 3000); + events.ScheduleEvent(EVENT_JORMUNGAR_ACID_SPLATTER, 12000); + events.ScheduleEvent(EVENT_JORMUNGAR_POISON_BREATH, 10000); + } + else if (param == ACTION_DESPAWN_ADDS) + summons.DespawnAll(); + } - void MoveInLineOfSight(Unit *who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; + void MoveInLineOfSight(Unit *who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void JustReachedHome() - { - me->SetStandState(UNIT_STAND_STATE_STAND); - } + void JustReachedHome() + { + me->SetStandState(UNIT_STAND_STATE_STAND); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_JORMUNGAR_ACID_SPIT: - { - if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(tgt, SPELL_ACID_SPIT, false); + switch (events.GetEvent()) + { + case EVENT_JORMUNGAR_ACID_SPIT: + { + if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(tgt, SPELL_ACID_SPIT, false); - events.RepeatEvent(2000 + rand()%2000); - break; - } - case EVENT_JORMUNGAR_ACID_SPLATTER: - { - me->CastSpell(me, IsHeroic() ? SPELL_ACID_SPLATTER_H : SPELL_ACID_SPLATTER_N, false); + events.RepeatEvent(2000 + rand()%2000); + break; + } + case EVENT_JORMUNGAR_ACID_SPLATTER: + { + me->CastSpell(me, IsHeroic() ? SPELL_ACID_SPLATTER_H : SPELL_ACID_SPLATTER_N, false); - // Aura summon wont work because of duration - float x, y, z; - me->GetPosition(x, y, z); - for (uint8 i = 0; i < 6; ++i) - { - if (Creature* pJormungarWorm = me->SummonCreature(NPC_JORMUNGAR_WORM, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) - { - summons.Summon(pJormungarWorm); - pJormungarWorm->SetInCombatWithZone(); - } - } - events.RepeatEvent(10000 + rand()%4000); - break; - } - case EVENT_JORMUNGAR_POISON_BREATH: - { - if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(tgt, IsHeroic() ? SPELL_POISON_BREATH_H : SPELL_POISON_BREATH_N, false); + // Aura summon wont work because of duration + float x, y, z; + me->GetPosition(x, y, z); + for (uint8 i = 0; i < 6; ++i) + { + if (Creature* pJormungarWorm = me->SummonCreature(NPC_JORMUNGAR_WORM, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) + { + summons.Summon(pJormungarWorm); + pJormungarWorm->SetInCombatWithZone(); + } + } + events.RepeatEvent(10000 + rand()%4000); + break; + } + case EVENT_JORMUNGAR_POISON_BREATH: + { + if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(tgt, IsHeroic() ? SPELL_POISON_BREATH_H : SPELL_POISON_BREATH_N, false); - events.RepeatEvent(8000 + rand()%4000); - break; - } - } + events.RepeatEvent(8000 + rand()%4000); + break; + } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* pKiller) - { - if (m_pInstance) - { - if (Creature *palehoof = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_GORTOK_PALEHOOF))) - palehoof->AI()->DoAction(ACTION_MINIBOSS_DIED); - } - } - }; + void JustDied(Unit* pKiller) + { + if (m_pInstance) + { + if (Creature *palehoof = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_MINIBOSS_DIED); + } + } + }; }; /*###### @@ -469,100 +469,100 @@ public: return new npc_ferocious_rhinoAI (pCreature); } - struct npc_ferocious_rhinoAI : public ScriptedAI - { - npc_ferocious_rhinoAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceScript(); - } + struct npc_ferocious_rhinoAI : public ScriptedAI + { + npc_ferocious_rhinoAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - InstanceScript *m_pInstance; - EventMap events; + InstanceScript *m_pInstance; + EventMap events; - void Reset() - { - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - } + void Reset() + { + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + } - void EnterCombat(Unit *) {} + void EnterCombat(Unit *) {} - void DoAction(int32 param) - { - if (param == ACTION_UNFREEZE) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else if (param == ACTION_UNFREEZE2) - { - me->RemoveAurasDueToSpell(SPELL_FREEZE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetInCombatWithZone(); + void DoAction(int32 param) + { + if (param == ACTION_UNFREEZE) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else if (param == ACTION_UNFREEZE2) + { + me->RemoveAurasDueToSpell(SPELL_FREEZE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_RHINO_STOMP, 3000); - events.ScheduleEvent(EVENT_RHINO_GORE, 12000); - events.ScheduleEvent(EVENT_RHINO_WOUND, 10000); - } - } + events.ScheduleEvent(EVENT_RHINO_STOMP, 3000); + events.ScheduleEvent(EVENT_RHINO_GORE, 12000); + events.ScheduleEvent(EVENT_RHINO_WOUND, 10000); + } + } - void MoveInLineOfSight(Unit *who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; + void MoveInLineOfSight(Unit *who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void JustReachedHome() - { - me->SetStandState(UNIT_STAND_STATE_STAND); - } + void JustReachedHome() + { + me->SetStandState(UNIT_STAND_STATE_STAND); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_RHINO_STOMP: - { - me->CastSpell(me->GetVictim(), SPELL_STOMP, false); - events.RepeatEvent(8000 + rand()%4000); - break; - } - case EVENT_RHINO_GORE: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_GORE_H : SPELL_GORE_N, false); - events.RepeatEvent(13000 + rand()%4000); - break; - } - case EVENT_RHINO_WOUND: - { - if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(tgt, IsHeroic() ? SPELL_GRIEVOUS_WOUND_H : SPELL_GRIEVOUS_WOUND_N, false); + switch (events.GetEvent()) + { + case EVENT_RHINO_STOMP: + { + me->CastSpell(me->GetVictim(), SPELL_STOMP, false); + events.RepeatEvent(8000 + rand()%4000); + break; + } + case EVENT_RHINO_GORE: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_GORE_H : SPELL_GORE_N, false); + events.RepeatEvent(13000 + rand()%4000); + break; + } + case EVENT_RHINO_WOUND: + { + if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(tgt, IsHeroic() ? SPELL_GRIEVOUS_WOUND_H : SPELL_GRIEVOUS_WOUND_N, false); - events.RepeatEvent(18000 + rand()%4000); - break; - } - } + events.RepeatEvent(18000 + rand()%4000); + break; + } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* pKiller) - { - if (m_pInstance) - { - if (Creature *palehoof = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_GORTOK_PALEHOOF))) - palehoof->AI()->DoAction(ACTION_MINIBOSS_DIED); - } - } - }; + void JustDied(Unit* pKiller) + { + if (m_pInstance) + { + if (Creature *palehoof = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_MINIBOSS_DIED); + } + } + }; }; /*###### @@ -579,98 +579,98 @@ public: return new npc_ravenous_furbolgAI (pCreature); } - struct npc_ravenous_furbolgAI : public ScriptedAI - { - npc_ravenous_furbolgAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceScript(); - } + struct npc_ravenous_furbolgAI : public ScriptedAI + { + npc_ravenous_furbolgAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - InstanceScript *m_pInstance; - EventMap events; + InstanceScript *m_pInstance; + EventMap events; - void Reset() - { - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - } + void Reset() + { + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + } - void EnterCombat(Unit *) {} + void EnterCombat(Unit *) {} - void DoAction(int32 param) - { - if (param == ACTION_UNFREEZE) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else if (param == ACTION_UNFREEZE2) - { - me->RemoveAurasDueToSpell(SPELL_FREEZE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetInCombatWithZone(); + void DoAction(int32 param) + { + if (param == ACTION_UNFREEZE) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else if (param == ACTION_UNFREEZE2) + { + me->RemoveAurasDueToSpell(SPELL_FREEZE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_FURBOLG_CHAIN, 3000); - events.ScheduleEvent(EVENT_FURBOLG_CRAZED, 12000); - events.ScheduleEvent(EVENT_FURBOLG_ROAR, 10000); - } - } + events.ScheduleEvent(EVENT_FURBOLG_CHAIN, 3000); + events.ScheduleEvent(EVENT_FURBOLG_CRAZED, 12000); + events.ScheduleEvent(EVENT_FURBOLG_ROAR, 10000); + } + } - void MoveInLineOfSight(Unit *who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; + void MoveInLineOfSight(Unit *who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void JustReachedHome() - { - me->SetStandState(UNIT_STAND_STATE_STAND); - } + void JustReachedHome() + { + me->SetStandState(UNIT_STAND_STATE_STAND); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_FURBOLG_CHAIN: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_CHAIN_LIGHTING_H : SPELL_CHAIN_LIGHTING_N, false); - events.RepeatEvent(4000 + rand()%3000); - break; - } - case EVENT_FURBOLG_CRAZED: - { - me->CastSpell(me, SPELL_CRAZED, false); - events.RepeatEvent(8000 + rand()%4000); - break; - } - case EVENT_FURBOLG_ROAR: - { - me->CastSpell(me, SPELL_TERRIFYING_ROAR, false); - events.RepeatEvent(10000 + rand()%5000); - break; - } - } + switch (events.GetEvent()) + { + case EVENT_FURBOLG_CHAIN: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_CHAIN_LIGHTING_H : SPELL_CHAIN_LIGHTING_N, false); + events.RepeatEvent(4000 + rand()%3000); + break; + } + case EVENT_FURBOLG_CRAZED: + { + me->CastSpell(me, SPELL_CRAZED, false); + events.RepeatEvent(8000 + rand()%4000); + break; + } + case EVENT_FURBOLG_ROAR: + { + me->CastSpell(me, SPELL_TERRIFYING_ROAR, false); + events.RepeatEvent(10000 + rand()%5000); + break; + } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* pKiller) - { - if (m_pInstance) - { - if (Creature *palehoof = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_GORTOK_PALEHOOF))) - palehoof->AI()->DoAction(ACTION_MINIBOSS_DIED); - } - } - }; + void JustDied(Unit* pKiller) + { + if (m_pInstance) + { + if (Creature *palehoof = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_MINIBOSS_DIED); + } + } + }; }; /*###### @@ -687,98 +687,98 @@ public: return new npc_frenzied_worgenAI (pCreature); } - struct npc_frenzied_worgenAI : public ScriptedAI - { - npc_frenzied_worgenAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceScript(); - } + struct npc_frenzied_worgenAI : public ScriptedAI + { + npc_frenzied_worgenAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - InstanceScript *m_pInstance; - EventMap events; + InstanceScript *m_pInstance; + EventMap events; - void Reset() - { - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - } + void Reset() + { + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + } - void EnterCombat(Unit *) {} + void EnterCombat(Unit *) {} - void DoAction(int32 param) - { - if (param == ACTION_UNFREEZE) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else if (param == ACTION_UNFREEZE2) - { - me->RemoveAurasDueToSpell(SPELL_FREEZE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetInCombatWithZone(); + void DoAction(int32 param) + { + if (param == ACTION_UNFREEZE) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else if (param == ACTION_UNFREEZE2) + { + me->RemoveAurasDueToSpell(SPELL_FREEZE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_WORGEN_MORTAL, 3000); - events.ScheduleEvent(EVENT_WORGEN_ENRAGE1, 12000); - events.ScheduleEvent(EVENT_WORGEN_ENRAGE2, 10000); - } - } + events.ScheduleEvent(EVENT_WORGEN_MORTAL, 3000); + events.ScheduleEvent(EVENT_WORGEN_ENRAGE1, 12000); + events.ScheduleEvent(EVENT_WORGEN_ENRAGE2, 10000); + } + } - void MoveInLineOfSight(Unit *who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; + void MoveInLineOfSight(Unit *who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; - ScriptedAI::MoveInLineOfSight(who); - } + ScriptedAI::MoveInLineOfSight(who); + } - void JustReachedHome() - { - me->SetStandState(UNIT_STAND_STATE_STAND); - } + void JustReachedHome() + { + me->SetStandState(UNIT_STAND_STATE_STAND); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_WORGEN_MORTAL: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_MORTAL_WOUND_H : SPELL_MORTAL_WOUND_H, false); - events.RepeatEvent(4000 + rand()%3000); - break; - } - case EVENT_WORGEN_ENRAGE1: - { - me->CastSpell(me, SPELL_ENRAGE_1, false); - events.RepeatEvent(15000); - break; - } - case EVENT_WORGEN_ENRAGE2: - { - me->CastSpell(me, SPELL_ENRAGE_2, false); - events.RepeatEvent(10000); - break; - } - } + switch (events.GetEvent()) + { + case EVENT_WORGEN_MORTAL: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_MORTAL_WOUND_H : SPELL_MORTAL_WOUND_H, false); + events.RepeatEvent(4000 + rand()%3000); + break; + } + case EVENT_WORGEN_ENRAGE1: + { + me->CastSpell(me, SPELL_ENRAGE_1, false); + events.RepeatEvent(15000); + break; + } + case EVENT_WORGEN_ENRAGE2: + { + me->CastSpell(me, SPELL_ENRAGE_2, false); + events.RepeatEvent(10000); + break; + } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* pKiller) - { - if (m_pInstance) - { - if (Creature *palehoof = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_GORTOK_PALEHOOF))) - palehoof->AI()->DoAction(ACTION_MINIBOSS_DIED); - } - } - }; + void JustDied(Unit* pKiller) + { + if (m_pInstance) + { + if (Creature *palehoof = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_MINIBOSS_DIED); + } + } + }; }; class go_palehoof_sphere : public GameObjectScript @@ -786,21 +786,21 @@ class go_palehoof_sphere : public GameObjectScript public: go_palehoof_sphere() : GameObjectScript("go_palehoof_sphere") { } - bool OnGossipHello(Player *pPlayer, GameObject *pGO) - { - InstanceScript *pInstance = pGO->GetInstanceScript(); + bool OnGossipHello(Player *pPlayer, GameObject *pGO) + { + InstanceScript *pInstance = pGO->GetInstanceScript(); - Creature *pPalehoof = ObjectAccessor::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) - { - // maybe these are hacks :( - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - pGO->SetGoState(GO_STATE_ACTIVE); + Creature *pPalehoof = ObjectAccessor::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->IsAlive()) + { + // maybe these are hacks :( + pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + pGO->SetGoState(GO_STATE_ACTIVE); - pPalehoof->AI()->DoAction(ACTION_START_EVENT); - } - return true; - } + pPalehoof->AI()->DoAction(ACTION_START_EVENT); + } + return true; + } }; void AddSC_boss_palehoof() @@ -810,5 +810,5 @@ void AddSC_boss_palehoof() new npc_ferocious_rhino(); new npc_ravenous_furbolg(); new npc_frenzied_worgen(); - new go_palehoof_sphere(); + new go_palehoof_sphere(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index 9bf6f4296..2e581e6c9 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -12,7 +12,7 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Misc { - // TEXTS + // TEXTS SAY_AGGRO = 0, SAY_KILL = 1, EMOTE_RANGE = 2, @@ -21,52 +21,52 @@ enum Misc EMOTE_BREATH = 5, SAY_DRAKE_BREATH = 6, - // SPELLS - SPELL_CRUSH_N = 50234, - SPELL_CRUSH_H = 59330, - SPELL_POISONED_SPEAR_N = 50255, - SPELL_POISONED_SPEAR_H = 59331, - SPELL_WHIRLWIND_N = 50228, - SPELL_WHIRLWIND_H = 50228, + // SPELLS + SPELL_CRUSH_N = 50234, + SPELL_CRUSH_H = 59330, + SPELL_POISONED_SPEAR_N = 50255, + SPELL_POISONED_SPEAR_H = 59331, + SPELL_WHIRLWIND_N = 50228, + SPELL_WHIRLWIND_H = 50228, - SPELL_FLAME_VISUAL = 47592, - SPELL_FLAME_BREATH_N = 47579, - SPELL_FLAME_BREATH_H = 60020, + SPELL_FLAME_VISUAL = 47592, + SPELL_FLAME_BREATH_N = 47579, + SPELL_FLAME_BREATH_H = 60020, - SPELL_LAUNCH_HARPOON = 48642, + SPELL_LAUNCH_HARPOON = 48642, - // NPCS - NPC_YMIRJAR_WARRIOR = 26690, - NPC_YMIRJAR_WITCH_DOCTOR = 26691, - NPC_YMIRJAR_HARPOONER = 26692, - NPC_GRAUF = 26893, - NPC_BREATH_TRIGGER = 28351, - EQUIP_MACE = 17193, + // NPCS + NPC_YMIRJAR_WARRIOR = 26690, + NPC_YMIRJAR_WITCH_DOCTOR = 26691, + NPC_YMIRJAR_HARPOONER = 26692, + NPC_GRAUF = 26893, + NPC_BREATH_TRIGGER = 28351, + EQUIP_MACE = 17193, - // ACTIONS - ACTION_START_EVENT = 1, - ACTION_REMOVE_SKADI = 2, - ACTION_PHASE2 = 3, - ACTION_MYGIRL_ACHIEVEMENT = 4, + // ACTIONS + ACTION_START_EVENT = 1, + ACTION_REMOVE_SKADI = 2, + ACTION_PHASE2 = 3, + ACTION_MYGIRL_ACHIEVEMENT = 4, - // ACHIEVEMENTS - ACHIEV_TIMED_LODI_DODI = 17726, + // ACHIEVEMENTS + ACHIEV_TIMED_LODI_DODI = 17726, }; enum Events { - // SKADI - EVENT_SKADI_START = 1, - EVENT_SKADI_CRUSH = 2, - EVENT_SKADI_SPEAR = 3, - EVENT_SKADI_WHIRLWIND = 4, + // SKADI + EVENT_SKADI_START = 1, + EVENT_SKADI_CRUSH = 2, + EVENT_SKADI_SPEAR = 3, + EVENT_SKADI_WHIRLWIND = 4, - // GRAUF - EVENT_GRAUF_START = 10, - EVENT_GRAUF_MOVE = 11, - EVENT_GRAUF_SUMMON_HELPERS = 12, - EVENT_GRAUF_CHECK = 13, - EVENT_GRAUF_REMOVE_SKADI = 14, + // GRAUF + EVENT_GRAUF_START = 10, + EVENT_GRAUF_MOVE = 11, + EVENT_GRAUF_SUMMON_HELPERS = 12, + EVENT_GRAUF_CHECK = 13, + EVENT_GRAUF_REMOVE_SKADI = 14, }; static Position TrashPosition[]= @@ -77,21 +77,21 @@ static Position TrashPosition[]= static Position SkadiPosition[] = { - {338.679f, -507.254f, 124.122f}, - {338.679f, -513.254f, 124.122f}, - {490.096f, -510.86f, 123.368f}, - {490.76f, -517.389f, 123.368f} + {338.679f, -507.254f, 124.122f}, + {338.679f, -513.254f, 124.122f}, + {490.096f, -510.86f, 123.368f}, + {490.76f, -517.389f, 123.368f} }; #define EMOTE_IN_RANGE "Skadi the Ruthless is within range of the harpoon launchers" enum phase { - PHASE_NONE, - PHASE_START, - PHASE_FLIGHT, - PHASE_LAND, - PHASE_GROUND + PHASE_NONE, + PHASE_START, + PHASE_FLIGHT, + PHASE_LAND, + PHASE_GROUND }; class boss_skadi : public CreatureScript @@ -104,156 +104,156 @@ public: return new boss_skadiAI (pCreature); } - struct boss_skadiAI : public ScriptedAI - { - boss_skadiAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) - { - m_pInstance = pCreature->GetInstanceScript(); - } + struct boss_skadiAI : public ScriptedAI + { + boss_skadiAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me) + { + m_pInstance = pCreature->GetInstanceScript(); + } - InstanceScript *m_pInstance; - EventMap events; - SummonList summons; - uint64 GraufGUID; - bool SecondPhase, EventStarted; + InstanceScript *m_pInstance; + EventMap events; + SummonList summons; + uint64 GraufGUID; + bool SecondPhase, EventStarted; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - if (Creature *cr = me->SummonCreature(NPC_GRAUF, 341.741f, -516.955f, 104.669f, 3.12414f)) - { - GraufGUID = cr->GetGUID(); - summons.Summon(cr); - } - SecondPhase = false; - EventStarted = false; + void Reset() + { + events.Reset(); + summons.DespawnAll(); + if (Creature *cr = me->SummonCreature(NPC_GRAUF, 341.741f, -516.955f, 104.669f, 3.12414f)) + { + GraufGUID = cr->GetGUID(); + summons.Summon(cr); + } + SecondPhase = false; + EventStarted = false; - me->RemoveAllAuras(); - me->SetControlled(false, UNIT_STATE_ROOT); - me->UpdatePosition(343.02f, -507.325f, 104.567f, M_PI, true); - me->StopMovingOnCurrentPos(); + me->RemoveAllAuras(); + me->SetControlled(false, UNIT_STATE_ROOT); + me->UpdatePosition(343.02f, -507.325f, 104.567f, M_PI, true); + me->StopMovingOnCurrentPos(); - if(m_pInstance) - { - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_LODI_DODI); - m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS, NOT_STARTED); - m_pInstance->SetData(SKADI_IN_RANGE, 0); - m_pInstance->SetData(SKADI_HITS, 0); - m_pInstance->SetData(DATA_SKADI_ACHIEVEMENT, false); - } - } + if(m_pInstance) + { + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_LODI_DODI); + m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS, NOT_STARTED); + m_pInstance->SetData(SKADI_IN_RANGE, 0); + m_pInstance->SetData(SKADI_HITS, 0); + m_pInstance->SetData(DATA_SKADI_ACHIEVEMENT, false); + } + } - Creature *GetGrauf() { return ObjectAccessor::GetCreature(*me, GraufGUID); } + Creature *GetGrauf() { return ObjectAccessor::GetCreature(*me, GraufGUID); } - void EnterCombat(Unit* pWho) - { - if (!EventStarted) - { - EventStarted = true; - Talk(SAY_AGGRO); - if (m_pInstance) - { - if (IsHeroic()) - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_LODI_DODI); - - m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS, IN_PROGRESS); - } + void EnterCombat(Unit* pWho) + { + if (!EventStarted) + { + EventStarted = true; + Talk(SAY_AGGRO); + if (m_pInstance) + { + if (IsHeroic()) + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_LODI_DODI); + + m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS, IN_PROGRESS); + } - me->SetControlled(true, UNIT_STATE_ROOT); - me->SetInCombatWithZone(); - events.RescheduleEvent(EVENT_SKADI_START, 2000); - } - } + me->SetControlled(true, UNIT_STATE_ROOT); + me->SetInCombatWithZone(); + events.RescheduleEvent(EVENT_SKADI_START, 2000); + } + } - void DoAction(int32 param) - { - - if (param == ACTION_PHASE2) - { - SecondPhase = true; - events.ScheduleEvent(EVENT_SKADI_CRUSH, 8000); - events.ScheduleEvent(EVENT_SKADI_SPEAR, 10000); - events.ScheduleEvent(EVENT_SKADI_WHIRLWIND, 15000); + void DoAction(int32 param) + { + + if (param == ACTION_PHASE2) + { + SecondPhase = true; + events.ScheduleEvent(EVENT_SKADI_CRUSH, 8000); + events.ScheduleEvent(EVENT_SKADI_SPEAR, 10000); + events.ScheduleEvent(EVENT_SKADI_WHIRLWIND, 15000); - if (me->GetVictim()) - me->GetMotionMaster()->MoveChase(me->GetVictim()); - else - me->SetInCombatWithZone(); - } - } + if (me->GetVictim()) + me->GetMotionMaster()->MoveChase(me->GetVictim()); + else + me->SetInCombatWithZone(); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() && SecondPhase) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() && SecondPhase) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SKADI_START: - { - me->SetControlled(false, UNIT_STATE_ROOT); - if (Creature *cr = GetGrauf()) - { - me->EnterVehicleUnattackable(cr, 0); - cr->AI()->DoAction(ACTION_START_EVENT); - } - else - EnterEvadeMode(); + switch (events.GetEvent()) + { + case EVENT_SKADI_START: + { + me->SetControlled(false, UNIT_STATE_ROOT); + if (Creature *cr = GetGrauf()) + { + me->EnterVehicleUnattackable(cr, 0); + cr->AI()->DoAction(ACTION_START_EVENT); + } + else + EnterEvadeMode(); - events.PopEvent(); - break; - } - case EVENT_SKADI_CRUSH: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_CRUSH_H : SPELL_CRUSH_N, false); - events.RepeatEvent(8000); - break; - } - case EVENT_SKADI_SPEAR: - { - if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(tgt, IsHeroic() ? SPELL_POISONED_SPEAR_H : SPELL_POISONED_SPEAR_N, false); + events.PopEvent(); + break; + } + case EVENT_SKADI_CRUSH: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_CRUSH_H : SPELL_CRUSH_N, false); + events.RepeatEvent(8000); + break; + } + case EVENT_SKADI_SPEAR: + { + if (Unit *tgt = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(tgt, IsHeroic() ? SPELL_POISONED_SPEAR_H : SPELL_POISONED_SPEAR_N, false); - events.RepeatEvent(10000); - break; - } - case EVENT_SKADI_WHIRLWIND: - { - me->CastSpell(me, IsHeroic() ? SPELL_WHIRLWIND_H : SPELL_WHIRLWIND_N, false); - events.RepeatEvent(15000 + rand()%5000); - events.DelayEvents(10000); - break; - } - } + events.RepeatEvent(10000); + break; + } + case EVENT_SKADI_WHIRLWIND: + { + me->CastSpell(me, IsHeroic() ? SPELL_WHIRLWIND_H : SPELL_WHIRLWIND_N, false); + events.RepeatEvent(15000 + rand()%5000); + events.DelayEvents(10000); + break; + } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* pKiller) - { - summons.DespawnAll(); - Talk(SAY_DEATH); + void JustDied(Unit* pKiller) + { + summons.DespawnAll(); + Talk(SAY_DEATH); - if (m_pInstance) - { - m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS, DONE); - m_pInstance->HandleGameObject(m_pInstance->GetData64(SKADI_DOOR), true); - } - } + if (m_pInstance) + { + m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS, DONE); + m_pInstance->HandleGameObject(m_pInstance->GetData64(SKADI_DOOR), true); + } + } - void KilledUnit(Unit* pVictim) - { - if (urand(0,1)) - return; + void KilledUnit(Unit* pVictim) + { + if (urand(0,1)) + return; - Talk(SAY_KILL); - } - }; + Talk(SAY_KILL); + } + }; }; class boss_skadi_grauf : public CreatureScript @@ -266,223 +266,223 @@ public: return new boss_skadi_graufAI (pCreature); } - struct boss_skadi_graufAI : public VehicleAI - { - boss_skadi_graufAI(Creature *pCreature) : VehicleAI(pCreature), summons(me) - { - m_pInstance = pCreature->GetInstanceScript(); - } + struct boss_skadi_graufAI : public VehicleAI + { + boss_skadi_graufAI(Creature *pCreature) : VehicleAI(pCreature), summons(me) + { + m_pInstance = pCreature->GetInstanceScript(); + } - InstanceScript *m_pInstance; - EventMap events; - SummonList summons; - uint8 currentPos; - uint8 AchievementHitCount; + InstanceScript *m_pInstance; + EventMap events; + SummonList summons; + uint8 currentPos; + uint8 AchievementHitCount; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - currentPos = 0; - AchievementHitCount = 0; - me->RemoveAllAuras(); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + currentPos = 0; + AchievementHitCount = 0; + me->RemoveAllAuras(); + } - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT) - { - events.RescheduleEvent(EVENT_GRAUF_CHECK, 5000); - events.RescheduleEvent(EVENT_GRAUF_START, 2000); - } - else if (param == ACTION_REMOVE_SKADI) - { - Talk(SAY_DRAKE_DEATH); - me->GetMotionMaster()->MovePoint(10, 480.0f, -513.0f, 108.0f); - events.ScheduleEvent(EVENT_GRAUF_REMOVE_SKADI, 2000); - } - else if (param == ACTION_MYGIRL_ACHIEVEMENT) - { - AchievementHitCount++; - if (AchievementHitCount >= 3 && m_pInstance) - m_pInstance->SetData(DATA_SKADI_ACHIEVEMENT, true); - - } - } + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT) + { + events.RescheduleEvent(EVENT_GRAUF_CHECK, 5000); + events.RescheduleEvent(EVENT_GRAUF_START, 2000); + } + else if (param == ACTION_REMOVE_SKADI) + { + Talk(SAY_DRAKE_DEATH); + me->GetMotionMaster()->MovePoint(10, 480.0f, -513.0f, 108.0f); + events.ScheduleEvent(EVENT_GRAUF_REMOVE_SKADI, 2000); + } + else if (param == ACTION_MYGIRL_ACHIEVEMENT) + { + AchievementHitCount++; + if (AchievementHitCount >= 3 && m_pInstance) + m_pInstance->SetData(DATA_SKADI_ACHIEVEMENT, true); + + } + } - void SpellHitTarget(Unit *target, const SpellInfo *spellInfo) - { - if (spellInfo->Id == 47593) // SPELL_FLAME_VISUAL trigger - target->CastSpell(target, me->GetMap()->IsHeroic() ? SPELL_FLAME_BREATH_H : SPELL_FLAME_BREATH_N, true); - } + void SpellHitTarget(Unit *target, const SpellInfo *spellInfo) + { + if (spellInfo->Id == 47593) // SPELL_FLAME_VISUAL trigger + target->CastSpell(target, me->GetMap()->IsHeroic() ? SPELL_FLAME_BREATH_H : SPELL_FLAME_BREATH_N, true); + } - void SpawnFlameTriggers(uint8 point) - { - for(uint8 j = 0; j < 50; ++j) - { - if (point == 1) - me->SummonCreature(NPC_BREATH_TRIGGER, 480.0f-(j*3), -518.0f+(j/16.0f), 105.0f, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); - else - me->SummonCreature(NPC_BREATH_TRIGGER, 480.0f-(j*3), -510.0f+(j/16.0f), 105.0f, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); - } - // and out of loop, cover the small room - if (point == 0) - { - Creature *cr; - if (cr = me->SummonCreature(NPC_BREATH_TRIGGER, 483, -484.9f, 105, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) - cr->CastSpell(cr, cr->GetMap()->IsHeroic() ? SPELL_FLAME_BREATH_H : SPELL_FLAME_BREATH_N, true); - if (cr = me->SummonCreature(NPC_BREATH_TRIGGER, 471.0f, -484.7f, 105, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) - cr->CastSpell(cr, cr->GetMap()->IsHeroic() ? SPELL_FLAME_BREATH_H : SPELL_FLAME_BREATH_N, true); - - for (uint8 j = 0; j < 7; j++) - if (cr = me->SummonCreature(NPC_BREATH_TRIGGER, 477.0f, -507.0f+(j*3), 105.0f, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) - cr->CastSpell(cr, cr->GetMap()->IsHeroic() ? SPELL_FLAME_BREATH_H : SPELL_FLAME_BREATH_N, true); - } - } + void SpawnFlameTriggers(uint8 point) + { + for(uint8 j = 0; j < 50; ++j) + { + if (point == 1) + me->SummonCreature(NPC_BREATH_TRIGGER, 480.0f-(j*3), -518.0f+(j/16.0f), 105.0f, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); + else + me->SummonCreature(NPC_BREATH_TRIGGER, 480.0f-(j*3), -510.0f+(j/16.0f), 105.0f, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); + } + // and out of loop, cover the small room + if (point == 0) + { + Creature *cr; + if (cr = me->SummonCreature(NPC_BREATH_TRIGGER, 483, -484.9f, 105, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) + cr->CastSpell(cr, cr->GetMap()->IsHeroic() ? SPELL_FLAME_BREATH_H : SPELL_FLAME_BREATH_N, true); + if (cr = me->SummonCreature(NPC_BREATH_TRIGGER, 471.0f, -484.7f, 105, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) + cr->CastSpell(cr, cr->GetMap()->IsHeroic() ? SPELL_FLAME_BREATH_H : SPELL_FLAME_BREATH_N, true); + + for (uint8 j = 0; j < 7; j++) + if (cr = me->SummonCreature(NPC_BREATH_TRIGGER, 477.0f, -507.0f+(j*3), 105.0f, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) + cr->CastSpell(cr, cr->GetMap()->IsHeroic() ? SPELL_FLAME_BREATH_H : SPELL_FLAME_BREATH_N, true); + } + } - void MovementInform(uint32 uiType, uint32 Id) - { - switch(Id) - { - case 0: - case 1: - me->RemoveAurasDueToSpell(SPELL_FLAME_VISUAL); - me->SetFacingTo(M_PI*2); - break; - case 2: - case 3: - if (m_pInstance) - m_pInstance->SetData(SKADI_IN_RANGE, 1); + void MovementInform(uint32 uiType, uint32 Id) + { + switch(Id) + { + case 0: + case 1: + me->RemoveAurasDueToSpell(SPELL_FLAME_VISUAL); + me->SetFacingTo(M_PI*2); + break; + case 2: + case 3: + if (m_pInstance) + m_pInstance->SetData(SKADI_IN_RANGE, 1); - me->MonsterTextEmote(EMOTE_IN_RANGE, 0, true); - me->SetFacingTo(M_PI); - break; - } - } + me->MonsterTextEmote(EMOTE_IN_RANGE, 0, true); + me->SetFacingTo(M_PI); + break; + } + } - uint8 SelectNextPos(uint8 Position) - { - switch (Position) - { - case 0: - case 1: - return 2+urand(0,1); - default: - if (me->GetPositionY() < -515.0f) - return 1; - else - return 0; - } - } + uint8 SelectNextPos(uint8 Position) + { + switch (Position) + { + case 0: + case 1: + return 2+urand(0,1); + default: + if (me->GetPositionY() < -515.0f) + return 1; + else + return 0; + } + } - void EnterCombat(Unit *) - { - me->SetInCombatWithZone(); - } + void EnterCombat(Unit *) + { + me->SetInCombatWithZone(); + } - void RemoveSkadi(bool withEvade) - { - if (Unit *skadi = me->GetVehicleKit()->GetPassenger(0)) - { - summons.DespawnAll(); - skadi->ExitVehicle(); - if (withEvade) - { - skadi->ToCreature()->AI()->EnterEvadeMode(); - skadi->UpdatePosition(343.02f, -507.325f, 104.567f, M_PI, true); - } - else - skadi->ToCreature()->AI()->DoAction(ACTION_PHASE2); + void RemoveSkadi(bool withEvade) + { + if (Unit *skadi = me->GetVehicleKit()->GetPassenger(0)) + { + summons.DespawnAll(); + skadi->ExitVehicle(); + if (withEvade) + { + skadi->ToCreature()->AI()->EnterEvadeMode(); + skadi->UpdatePosition(343.02f, -507.325f, 104.567f, M_PI, true); + } + else + skadi->ToCreature()->AI()->DoAction(ACTION_PHASE2); - skadi->StopMovingOnCurrentPos(); - } - } + skadi->StopMovingOnCurrentPos(); + } + } - void CheckPlayers() - { - Map::PlayerList const& pList = me->GetMap()->GetPlayers(); - for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - { - if (itr->GetSource()->GetPositionX() < 320.0f || itr->GetSource()->IsGameMaster() || !itr->GetSource()->IsAlive()) - continue; + void CheckPlayers() + { + Map::PlayerList const& pList = me->GetMap()->GetPlayers(); + for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { + if (itr->GetSource()->GetPositionX() < 320.0f || itr->GetSource()->IsGameMaster() || !itr->GetSource()->IsAlive()) + continue; - return; - } - - RemoveSkadi(true); - } + return; + } + + RemoveSkadi(true); + } - void SpawnHelpers(uint8 Spot) - { - if (Creature *Harpooner = me->SummonCreature(NPC_YMIRJAR_HARPOONER, TrashPosition[Spot].GetPositionX()+rand()%5, TrashPosition[Spot].GetPositionY()+rand()%5, TrashPosition[Spot].GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - { - Harpooner->SetInCombatWithZone(); - summons.Summon(Harpooner); - } - if (Creature *Second = me->SummonCreature((urand(0,1) ? NPC_YMIRJAR_WARRIOR : NPC_YMIRJAR_WITCH_DOCTOR), TrashPosition[Spot].GetPositionX()+rand()%5, TrashPosition[Spot].GetPositionY()+rand()%5, TrashPosition[Spot].GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - { - Second->SetInCombatWithZone(); - summons.Summon(Second); - } - } + void SpawnHelpers(uint8 Spot) + { + if (Creature *Harpooner = me->SummonCreature(NPC_YMIRJAR_HARPOONER, TrashPosition[Spot].GetPositionX()+rand()%5, TrashPosition[Spot].GetPositionY()+rand()%5, TrashPosition[Spot].GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + { + Harpooner->SetInCombatWithZone(); + summons.Summon(Harpooner); + } + if (Creature *Second = me->SummonCreature((urand(0,1) ? NPC_YMIRJAR_WARRIOR : NPC_YMIRJAR_WITCH_DOCTOR), TrashPosition[Spot].GetPositionX()+rand()%5, TrashPosition[Spot].GetPositionY()+rand()%5, TrashPosition[Spot].GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + { + Second->SetInCombatWithZone(); + summons.Summon(Second); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_GRAUF_CHECK: - { - CheckPlayers(); - events.RepeatEvent(2000); - break; - } - case EVENT_GRAUF_START: - { - me->GetMotionMaster()->Clear(true); - me->GetMotionMaster()->MoveTakeoff(10, SkadiPosition[0].GetPositionX(), SkadiPosition[0].GetPositionY(), SkadiPosition[0].GetPositionZ(), 3.0f); + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_GRAUF_CHECK: + { + CheckPlayers(); + events.RepeatEvent(2000); + break; + } + case EVENT_GRAUF_START: + { + me->GetMotionMaster()->Clear(true); + me->GetMotionMaster()->MoveTakeoff(10, SkadiPosition[0].GetPositionX(), SkadiPosition[0].GetPositionY(), SkadiPosition[0].GetPositionZ(), 3.0f); - SpawnHelpers(0); - SpawnHelpers(0); - events.ScheduleEvent(EVENT_GRAUF_MOVE, 15000); - events.ScheduleEvent(EVENT_GRAUF_SUMMON_HELPERS, 20000); - events.PopEvent(); - break; - } - case EVENT_GRAUF_MOVE: - { - AchievementHitCount = 0; - uint8 targetPoint = SelectNextPos(currentPos); - me->GetMotionMaster()->MovePoint(targetPoint, SkadiPosition[targetPoint].GetPositionX(), SkadiPosition[targetPoint].GetPositionY(), SkadiPosition[targetPoint].GetPositionZ()); - if (targetPoint <= 1) - { - SpawnFlameTriggers(targetPoint); - me->CastSpell(me, SPELL_FLAME_VISUAL, false); - } + SpawnHelpers(0); + SpawnHelpers(0); + events.ScheduleEvent(EVENT_GRAUF_MOVE, 15000); + events.ScheduleEvent(EVENT_GRAUF_SUMMON_HELPERS, 20000); + events.PopEvent(); + break; + } + case EVENT_GRAUF_MOVE: + { + AchievementHitCount = 0; + uint8 targetPoint = SelectNextPos(currentPos); + me->GetMotionMaster()->MovePoint(targetPoint, SkadiPosition[targetPoint].GetPositionX(), SkadiPosition[targetPoint].GetPositionY(), SkadiPosition[targetPoint].GetPositionZ()); + if (targetPoint <= 1) + { + SpawnFlameTriggers(targetPoint); + me->CastSpell(me, SPELL_FLAME_VISUAL, false); + } - if (m_pInstance) - m_pInstance->SetData(SKADI_IN_RANGE, 0); + if (m_pInstance) + m_pInstance->SetData(SKADI_IN_RANGE, 0); - currentPos = targetPoint; - events.RepeatEvent(25000); - break; - } - case EVENT_GRAUF_SUMMON_HELPERS: - { - SpawnHelpers(1); - events.RepeatEvent(15000); - break; - } - case EVENT_GRAUF_REMOVE_SKADI: - { - RemoveSkadi(false); - me->DespawnOrUnsummon(); - events.PopEvent(); - break; - } - } - } - }; + currentPos = targetPoint; + events.RepeatEvent(25000); + break; + } + case EVENT_GRAUF_SUMMON_HELPERS: + { + SpawnHelpers(1); + events.RepeatEvent(15000); + break; + } + case EVENT_GRAUF_REMOVE_SKADI: + { + RemoveSkadi(false); + me->DespawnOrUnsummon(); + events.PopEvent(); + break; + } + } + } + }; }; class go_harpoon_canon : public GameObjectScript @@ -490,35 +490,35 @@ class go_harpoon_canon : public GameObjectScript public: go_harpoon_canon() : GameObjectScript("go_harpoon_canon") { } - bool OnGossipHello(Player* pPlayer, GameObject* pGO) - { - InstanceScript *m_pInstance = pGO->GetInstanceScript(); - if (m_pInstance && m_pInstance->GetData(DATA_SKADI_THE_RUTHLESS) == IN_PROGRESS) - if (m_pInstance->GetData(SKADI_IN_RANGE) == 1) - { - uint8 count = m_pInstance->GetData(SKADI_HITS)+1; - m_pInstance->SetData(SKADI_HITS, count); + bool OnGossipHello(Player* pPlayer, GameObject* pGO) + { + InstanceScript *m_pInstance = pGO->GetInstanceScript(); + if (m_pInstance && m_pInstance->GetData(DATA_SKADI_THE_RUTHLESS) == IN_PROGRESS) + if (m_pInstance->GetData(SKADI_IN_RANGE) == 1) + { + uint8 count = m_pInstance->GetData(SKADI_HITS)+1; + m_pInstance->SetData(SKADI_HITS, count); - if (Creature *grauf = ObjectAccessor::GetCreature(*pPlayer, m_pInstance->GetData64(DATA_GRAUF))) - { - if (count >= 3) - { - m_pInstance->SetData(SKADI_IN_RANGE, 0); - grauf->AI()->DoAction(ACTION_REMOVE_SKADI); - } + if (Creature *grauf = ObjectAccessor::GetCreature(*pPlayer, m_pInstance->GetData64(DATA_GRAUF))) + { + if (count >= 3) + { + m_pInstance->SetData(SKADI_IN_RANGE, 0); + grauf->AI()->DoAction(ACTION_REMOVE_SKADI); + } - grauf->AI()->DoAction(ACTION_MYGIRL_ACHIEVEMENT); - } - pGO->CastSpell((Unit*)NULL, SPELL_LAUNCH_HARPOON); - } + grauf->AI()->DoAction(ACTION_MYGIRL_ACHIEVEMENT); + } + pGO->CastSpell((Unit*)NULL, SPELL_LAUNCH_HARPOON); + } - return true; - } + return true; + } }; void AddSC_boss_skadi() { new boss_skadi(); - new boss_skadi_grauf(); + new boss_skadi_grauf(); new go_harpoon_canon(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 8049178af..87b419761 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -11,67 +11,67 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Misc { - // SAY - TALK_INTRO_A1 = 0, - TALK_INTRO_A2 = 1, - TALK_INTRO_S1 = 0, - TALK_INTRO_S2 = 0, - TALK_INTRO_S3 = 1, + // SAY + TALK_INTRO_A1 = 0, + TALK_INTRO_A2 = 1, + TALK_INTRO_S1 = 0, + TALK_INTRO_S2 = 0, + TALK_INTRO_S3 = 1, SAY_AGGRO = 2, SAY_SLAY = 3, SAY_DEATH = 4, SAY_SACRIFICE_PLAYER = 5, - // SPELLS - // INTRO - SPELL_ARTHAS_TRANSFORMING_SVALA = 54142, - SPELL_SVALA_TRANSFORMING1 = 54205, - SPELL_SVALA_TRANSFORMING2 = 54140, + // SPELLS + // INTRO + SPELL_ARTHAS_TRANSFORMING_SVALA = 54142, + SPELL_SVALA_TRANSFORMING1 = 54205, + SPELL_SVALA_TRANSFORMING2 = 54140, - // SORROWGRAVE - SPELL_CALL_FLAMES = 48258, - SPELL_BALL_OF_FLAME = 48246, - SPELL_RITUAL_OF_THE_SWORD = 48276, - SPELL_RITUAL_STRIKE = 48331, - SPELL_SINSTER_STRIKE_N = 15667, - SPELL_SINSTER_STRIKE_H = 59409, - EQUIP_SWORD = 40343, + // SORROWGRAVE + SPELL_CALL_FLAMES = 48258, + SPELL_BALL_OF_FLAME = 48246, + SPELL_RITUAL_OF_THE_SWORD = 48276, + SPELL_RITUAL_STRIKE = 48331, + SPELL_SINSTER_STRIKE_N = 15667, + SPELL_SINSTER_STRIKE_H = 59409, + EQUIP_SWORD = 40343, - // CHANNELERS - SPELL_PARALYZE = 48278, - SPELL_SHADOWS_IN_THE_DARK = 59407, - SPELL_TELEPORT_VISUAL = 64446, + // CHANNELERS + SPELL_PARALYZE = 48278, + SPELL_SHADOWS_IN_THE_DARK = 59407, + SPELL_TELEPORT_VISUAL = 64446, - // NPCS - NPC_RITUAL_CHANNELER = 27281, - NPC_ARTHAS = 29280, - NPC_FLAME_BRAZIER = 27273, + // NPCS + NPC_RITUAL_CHANNELER = 27281, + NPC_ARTHAS = 29280, + NPC_FLAME_BRAZIER = 27273, - // ACTIONS - ACTION_START_SORROWGRAVE = 1, + // ACTIONS + ACTION_START_SORROWGRAVE = 1, }; enum Events { - // BASE EVENT START - EVENT_SVALA_START = 1, - EVENT_SVALA_TALK1 = 2, - EVENT_SVALA_TALK2 = 3, - EVENT_SVALA_TALK3 = 4, - EVENT_SVALA_TALK4 = 5, - EVENT_SVALA_TALK5 = 6, - EVENT_SVALA_TALK6 = 7, - EVENT_SVALA_TALK7 = 8, - EVENT_SVALA_TALK8 = 9, - EVENT_SVALA_TALK9 = 20, + // BASE EVENT START + EVENT_SVALA_START = 1, + EVENT_SVALA_TALK1 = 2, + EVENT_SVALA_TALK2 = 3, + EVENT_SVALA_TALK3 = 4, + EVENT_SVALA_TALK4 = 5, + EVENT_SVALA_TALK5 = 6, + EVENT_SVALA_TALK6 = 7, + EVENT_SVALA_TALK7 = 8, + EVENT_SVALA_TALK8 = 9, + EVENT_SVALA_TALK9 = 20, - // FIGHT - EVENT_SORROWGRAVE_SS = 10, - EVENT_SORROWGRAVE_FLAMES = 11, - EVENT_SORROWGRAVE_FLAMES2 = 12, - EVENT_SORROWGRAVE_RITUAL = 13, - EVENT_SORROWGRAVE_RITUAL_SPELLS = 14, - EVENT_SORROWGRAVE_FINISH_RITUAL = 15, + // FIGHT + EVENT_SORROWGRAVE_SS = 10, + EVENT_SORROWGRAVE_FLAMES = 11, + EVENT_SORROWGRAVE_FLAMES2 = 12, + EVENT_SORROWGRAVE_RITUAL = 13, + EVENT_SORROWGRAVE_RITUAL_SPELLS = 14, + EVENT_SORROWGRAVE_FINISH_RITUAL = 15, }; const Position RitualChannelerLoc[3]= @@ -95,260 +95,260 @@ public: return new boss_svalaAI (creature); } - struct boss_svalaAI : public ScriptedAI - { - boss_svalaAI(Creature* creature) : ScriptedAI(creature), summons(me) - { - instance = creature->GetInstanceScript(); - Started = false; - ArthasGUID = 0; - } + struct boss_svalaAI : public ScriptedAI + { + boss_svalaAI(Creature* creature) : ScriptedAI(creature), summons(me) + { + instance = creature->GetInstanceScript(); + Started = false; + ArthasGUID = 0; + } - uint64 ArthasGUID; - bool Started; - InstanceScript* instance; - EventMap events; - EventMap events2; - SummonList summons; + uint64 ArthasGUID; + bool Started; + InstanceScript* instance; + EventMap events; + EventMap events2; + SummonList summons; - void Reset() - { - if (instance) - { - instance->SetData(DATA_SVALA_SORROWGRAVE, NOT_STARTED); - instance->SetData(DATA_SVALA_ACHIEVEMENT, false); - } + void Reset() + { + if (instance) + { + instance->SetData(DATA_SVALA_SORROWGRAVE, NOT_STARTED); + instance->SetData(DATA_SVALA_ACHIEVEMENT, false); + } - summons.DespawnAll(); - events.Reset(); - events2.Reset(); - if (!Started) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - else - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->SetHover(true); - } - } + summons.DespawnAll(); + events.Reset(); + events2.Reset(); + if (!Started) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + else + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetHover(true); + } + } - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + ScriptedAI::EnterEvadeMode(); + } - void SetData(uint32 data, uint32 param) - { - if (data != 1 || param != 1 || Started || instance->GetData(DATA_SVALA_SORROWGRAVE) == DONE) - return; + void SetData(uint32 data, uint32 param) + { + if (data != 1 || param != 1 || Started || instance->GetData(DATA_SVALA_SORROWGRAVE) == DONE) + return; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - Started = true; - me->setActive(true); - events2.ScheduleEvent(EVENT_SVALA_START, 5000); - if (Creature* pArthas = me->SummonCreature(NPC_ARTHAS, 295.81f, -366.16f, 92.57f, 1.58f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 59000)) - ArthasGUID = pArthas->GetGUID(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + Started = true; + me->setActive(true); + events2.ScheduleEvent(EVENT_SVALA_START, 5000); + if (Creature* pArthas = me->SummonCreature(NPC_ARTHAS, 295.81f, -366.16f, 92.57f, 1.58f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 59000)) + ArthasGUID = pArthas->GetGUID(); - if (instance) - { - instance->SetData(DATA_SVALA_SORROWGRAVE, IN_PROGRESS); - if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_SVALA_MIRROR))) + if (instance) + { + instance->SetData(DATA_SVALA_SORROWGRAVE, IN_PROGRESS); + if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_SVALA_MIRROR))) mirror->SetGoState(GO_STATE_READY); - } - } + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() == NPC_RITUAL_CHANNELER) - summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() == NPC_RITUAL_CHANNELER) + summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); + } - void EnterCombat(Unit*) - { - me->SetInCombatWithZone(); - Talk(SAY_AGGRO); + void EnterCombat(Unit*) + { + me->SetInCombatWithZone(); + Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SORROWGRAVE_SS, 3000); - events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES, 11000); - events.ScheduleEvent(EVENT_SORROWGRAVE_RITUAL, 25000); + events.ScheduleEvent(EVENT_SORROWGRAVE_SS, 3000); + events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES, 11000); + events.ScheduleEvent(EVENT_SORROWGRAVE_RITUAL, 25000); - if (instance) - instance->SetData(DATA_SVALA_SORROWGRAVE, IN_PROGRESS); - } + if (instance) + instance->SetData(DATA_SVALA_SORROWGRAVE, IN_PROGRESS); + } - void JustDied(Unit*) - { - summons.DespawnAll(); - Talk(SAY_DEATH); - if(instance) - instance->SetData(DATA_SVALA_SORROWGRAVE, DONE); - } + void JustDied(Unit*) + { + summons.DespawnAll(); + Talk(SAY_DEATH); + if(instance) + instance->SetData(DATA_SVALA_SORROWGRAVE, DONE); + } - void KilledUnit(Unit* victim) - { - if (victim->GetEntry() == NPC_SCOURGE_HULK && instance) - { - instance->SetData(DATA_SVALA_ACHIEVEMENT, true); - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 26555, 1, NULL); - } + void KilledUnit(Unit* victim) + { + if (victim->GetEntry() == NPC_SCOURGE_HULK && instance) + { + instance->SetData(DATA_SVALA_ACHIEVEMENT, true); + instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 26555, 1, NULL); + } - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); - } + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } - void UpdateAI(uint32 diff) - { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_SVALA_START: - Talk(TALK_INTRO_S1); - events2.ScheduleEvent(EVENT_SVALA_TALK1, 8000); - break; - case EVENT_SVALA_TALK1: - if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) - Arthas->AI()->Talk(TALK_INTRO_A1); - events2.ScheduleEvent(EVENT_SVALA_TALK2, 9000); - break; - case EVENT_SVALA_TALK2: - if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) - Arthas->CastSpell(me, SPELL_ARTHAS_TRANSFORMING_SVALA, false); - me->CastSpell(me, SPELL_SVALA_TRANSFORMING2, true); - events2.ScheduleEvent(EVENT_SVALA_TALK3, 3000); - break; - case EVENT_SVALA_TALK3: - me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 6.0f); - me->SetHover(true); - me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - events2.ScheduleEvent(30, 1000); - events2.ScheduleEvent(EVENT_SVALA_TALK4, 9000); - break; - case 30: - { - WorldPacket data(SMSG_SPLINE_MOVE_SET_HOVER, 9); - data.append(me->GetPackGUID()); - me->SendMessageToSet(&data, false); - break; - } - case EVENT_SVALA_TALK4: - { - me->CastSpell(me, SPELL_SVALA_TRANSFORMING1, true); - me->UpdateEntry(NPC_SVALA_SORROWGRAVE); - me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 6.0f); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) - Arthas->InterruptNonMeleeSpells(false); - me->RemoveAllAuras(); - me->SetWalk(false); - events2.ScheduleEvent(EVENT_SVALA_TALK5, 2000); + void UpdateAI(uint32 diff) + { + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_SVALA_START: + Talk(TALK_INTRO_S1); + events2.ScheduleEvent(EVENT_SVALA_TALK1, 8000); + break; + case EVENT_SVALA_TALK1: + if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) + Arthas->AI()->Talk(TALK_INTRO_A1); + events2.ScheduleEvent(EVENT_SVALA_TALK2, 9000); + break; + case EVENT_SVALA_TALK2: + if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) + Arthas->CastSpell(me, SPELL_ARTHAS_TRANSFORMING_SVALA, false); + me->CastSpell(me, SPELL_SVALA_TRANSFORMING2, true); + events2.ScheduleEvent(EVENT_SVALA_TALK3, 3000); + break; + case EVENT_SVALA_TALK3: + me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 6.0f); + me->SetHover(true); + me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + events2.ScheduleEvent(30, 1000); + events2.ScheduleEvent(EVENT_SVALA_TALK4, 9000); + break; + case 30: + { + WorldPacket data(SMSG_SPLINE_MOVE_SET_HOVER, 9); + data.append(me->GetPackGUID()); + me->SendMessageToSet(&data, false); + break; + } + case EVENT_SVALA_TALK4: + { + me->CastSpell(me, SPELL_SVALA_TRANSFORMING1, true); + me->UpdateEntry(NPC_SVALA_SORROWGRAVE); + me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 6.0f); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) + Arthas->InterruptNonMeleeSpells(false); + me->RemoveAllAuras(); + me->SetWalk(false); + events2.ScheduleEvent(EVENT_SVALA_TALK5, 2000); - std::list creatureList; - me->GetCreaturesWithEntryInRange(creatureList, 100.0f, NPC_DRAGONFLAYER_SPECTATOR); - for (std::list::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) - (*itr)->AI()->SetData(1, 2); + std::list creatureList; + me->GetCreaturesWithEntryInRange(creatureList, 100.0f, NPC_DRAGONFLAYER_SPECTATOR); + for (std::list::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) + (*itr)->AI()->SetData(1, 2); - break; - } - case EVENT_SVALA_TALK5: - Talk(TALK_INTRO_S2); - events2.ScheduleEvent(EVENT_SVALA_TALK6, 12000); - break; - case EVENT_SVALA_TALK6: - if (Creature *Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) - Arthas->AI()->Talk(TALK_INTRO_A2); - events2.ScheduleEvent(EVENT_SVALA_TALK7, 9000); - break; - case EVENT_SVALA_TALK7: - me->SetFacingTo(M_PI/2.0f); - Talk(TALK_INTRO_S3); - if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_SVALA_MIRROR))) - mirror->SetGoState(GO_STATE_ACTIVE); - events2.ScheduleEvent(EVENT_SVALA_TALK8, 13000); - break; - case EVENT_SVALA_TALK8: - me->GetMotionMaster()->MoveFall(0, true); - events2.ScheduleEvent(EVENT_SVALA_TALK9, 2000); - break; - case EVENT_SVALA_TALK9: - me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 3.0f); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->LoadEquipment(1, true); - me->setActive(false); - if (Player* target = SelectTargetFromPlayerList(100.0f)) - AttackStart(target); - return; - } + break; + } + case EVENT_SVALA_TALK5: + Talk(TALK_INTRO_S2); + events2.ScheduleEvent(EVENT_SVALA_TALK6, 12000); + break; + case EVENT_SVALA_TALK6: + if (Creature *Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID)) + Arthas->AI()->Talk(TALK_INTRO_A2); + events2.ScheduleEvent(EVENT_SVALA_TALK7, 9000); + break; + case EVENT_SVALA_TALK7: + me->SetFacingTo(M_PI/2.0f); + Talk(TALK_INTRO_S3); + if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_SVALA_MIRROR))) + mirror->SetGoState(GO_STATE_ACTIVE); + events2.ScheduleEvent(EVENT_SVALA_TALK8, 13000); + break; + case EVENT_SVALA_TALK8: + me->GetMotionMaster()->MoveFall(0, true); + events2.ScheduleEvent(EVENT_SVALA_TALK9, 2000); + break; + case EVENT_SVALA_TALK9: + me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 3.0f); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->LoadEquipment(1, true); + me->setActive(false); + if (Player* target = SelectTargetFromPlayerList(100.0f)) + AttackStart(target); + return; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SORROWGRAVE_SS: - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SINSTER_STRIKE_H : SPELL_SINSTER_STRIKE_N, false); - events.ScheduleEvent(EVENT_SORROWGRAVE_SS, urand(3000, 5000)); - break; - case EVENT_SORROWGRAVE_FLAMES: - summons.DespawnAll(); - me->CastSpell(me, SPELL_CALL_FLAMES, false); - events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES2, 500); - events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES2, 1000); - events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES, urand(8000, 12000)); - break; - case EVENT_SORROWGRAVE_FLAMES2: - { - std::list braziers; - me->GetCreaturesWithEntryInRange(braziers, 100.0f, NPC_FLAME_BRAZIER); - if (!braziers.empty()) - { - for (std::list::const_iterator itr = braziers.begin(); itr != braziers.end(); ++itr) - (*itr)->CastCustomSpell(SPELL_BALL_OF_FLAME, SPELLVALUE_MAX_TARGETS, 1, (*itr), true); - } - break; - } - case EVENT_SORROWGRAVE_RITUAL: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - Talk(SAY_SACRIFICE_PLAYER); + switch (events.ExecuteEvent()) + { + case EVENT_SORROWGRAVE_SS: + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SINSTER_STRIKE_H : SPELL_SINSTER_STRIKE_N, false); + events.ScheduleEvent(EVENT_SORROWGRAVE_SS, urand(3000, 5000)); + break; + case EVENT_SORROWGRAVE_FLAMES: + summons.DespawnAll(); + me->CastSpell(me, SPELL_CALL_FLAMES, false); + events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES2, 500); + events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES2, 1000); + events.ScheduleEvent(EVENT_SORROWGRAVE_FLAMES, urand(8000, 12000)); + break; + case EVENT_SORROWGRAVE_FLAMES2: + { + std::list braziers; + me->GetCreaturesWithEntryInRange(braziers, 100.0f, NPC_FLAME_BRAZIER); + if (!braziers.empty()) + { + for (std::list::const_iterator itr = braziers.begin(); itr != braziers.end(); ++itr) + (*itr)->CastCustomSpell(SPELL_BALL_OF_FLAME, SPELLVALUE_MAX_TARGETS, 1, (*itr), true); + } + break; + } + case EVENT_SORROWGRAVE_RITUAL: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + Talk(SAY_SACRIFICE_PLAYER); - for (uint8 i = 0; i < 3; ++i) - if (Creature* cr = me->SummonCreature(NPC_RITUAL_CHANNELER, RitualChannelerLoc[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) - cr->AI()->AttackStart(target); + for (uint8 i = 0; i < 3; ++i) + if (Creature* cr = me->SummonCreature(NPC_RITUAL_CHANNELER, RitualChannelerLoc[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) + cr->AI()->AttackStart(target); - me->GetMotionMaster()->MoveIdle(); - DoTeleportPlayer(target, 296.632f, -346.075f, 90.63f, 4.6f); - me->NearTeleportTo(296.632f, -346.075f, 110.0f, 4.6f, false); - me->SetControlled(true, UNIT_STATE_ROOT); - me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + me->GetMotionMaster()->MoveIdle(); + DoTeleportPlayer(target, 296.632f, -346.075f, 90.63f, 4.6f); + me->NearTeleportTo(296.632f, -346.075f, 110.0f, 4.6f, false); + me->SetControlled(true, UNIT_STATE_ROOT); + me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE); + me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - events.DelayEvents(25001); // +1 just to be sure - events.ScheduleEvent(EVENT_SORROWGRAVE_RITUAL_SPELLS, 0); - events.ScheduleEvent(EVENT_SORROWGRAVE_FINISH_RITUAL, 25000); - return; - case EVENT_SORROWGRAVE_RITUAL_SPELLS: - //me->CastSpell(me, SPELL_RITUAL_OF_THE_SWORD, false); - me->CastSpell(me, SPELL_RITUAL_STRIKE, true); - return; - case EVENT_SORROWGRAVE_FINISH_RITUAL: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetControlled(false, UNIT_STATE_ROOT); - AttackStart(me->GetVictim()); - me->GetMotionMaster()->MoveFall(0, true); - summons.DespawnAll(); - break; - } + events.DelayEvents(25001); // +1 just to be sure + events.ScheduleEvent(EVENT_SORROWGRAVE_RITUAL_SPELLS, 0); + events.ScheduleEvent(EVENT_SORROWGRAVE_FINISH_RITUAL, 25000); + return; + case EVENT_SORROWGRAVE_RITUAL_SPELLS: + //me->CastSpell(me, SPELL_RITUAL_OF_THE_SWORD, false); + me->CastSpell(me, SPELL_RITUAL_STRIKE, true); + return; + case EVENT_SORROWGRAVE_FINISH_RITUAL: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetControlled(false, UNIT_STATE_ROOT); + AttackStart(me->GetVictim()); + me->GetMotionMaster()->MoveFall(0, true); + summons.DespawnAll(); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; /*###### @@ -365,22 +365,22 @@ public: return new npc_ritual_channelerAI (pCreature); } - struct npc_ritual_channelerAI : public NullCreatureAI - { - npc_ritual_channelerAI(Creature* pCreature) : NullCreatureAI(pCreature) {} + struct npc_ritual_channelerAI : public NullCreatureAI + { + npc_ritual_channelerAI(Creature* pCreature) : NullCreatureAI(pCreature) {} - void AttackStart(Unit* pWho) - { - if (me->GetMap()->GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC) - me->AddAura(SPELL_SHADOWS_IN_THE_DARK, me); + void AttackStart(Unit* pWho) + { + if (me->GetMap()->GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC) + me->AddAura(SPELL_SHADOWS_IN_THE_DARK, me); - if (pWho) - { - me->AddThreat(pWho, 10000000.0f); - me->CastSpell(pWho, SPELL_PARALYZE, false); - } - } - }; + if (pWho) + { + me->AddThreat(pWho, 10000000.0f); + me->CastSpell(pWho, SPELL_PARALYZE, false); + } + } + }; }; class spell_svala_ritual_strike : public SpellScriptLoader @@ -395,17 +395,17 @@ class spell_svala_ritual_strike : public SpellScriptLoader void HandleDummyEffect(SpellEffIndex /*effIndex*/) { if (Unit* unitTarget = GetHitUnit()) - { - if (unitTarget->GetTypeId() != TYPEID_UNIT) - return; + { + if (unitTarget->GetTypeId() != TYPEID_UNIT) + return; Unit::DealDamage(GetCaster(), unitTarget, 7000, NULL, DIRECT_DAMAGE); - } + } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_svala_ritual_strike_SpellScript::HandleDummyEffect, EFFECT_2, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_svala_ritual_strike_SpellScript::HandleDummyEffect, EFFECT_2, SPELL_EFFECT_DUMMY); } }; @@ -414,31 +414,31 @@ class spell_svala_ritual_strike : public SpellScriptLoader return new spell_svala_ritual_strike_SpellScript(); } - class spell_svala_ritual_strike_AuraScript : public AuraScript - { - PrepareAuraScript(spell_svala_ritual_strike_AuraScript); + class spell_svala_ritual_strike_AuraScript : public AuraScript + { + PrepareAuraScript(spell_svala_ritual_strike_AuraScript); - void CalculateAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) - { - // Set amount based on difficulty - amount = (GetCaster()->GetMap()->IsHeroic() ? 2000 : 1000); - } + void CalculateAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + { + // Set amount based on difficulty + amount = (GetCaster()->GetMap()->IsHeroic() ? 2000 : 1000); + } - void Register() - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_svala_ritual_strike_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_svala_ritual_strike_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_svala_ritual_strike_AuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_svala_ritual_strike_AuraScript(); + } }; void AddSC_boss_svala() { new boss_svala(); new npc_ritual_channeler(); - new spell_svala_ritual_strike(); + new spell_svala_ritual_strike(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index 894eb5aa2..4be999e0c 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -9,7 +9,7 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Misc { - // TEXTS + // TEXTS SAY_AGGRO = 0, SAY_SLAY = 1, SAY_DEATH = 2, @@ -18,7 +18,7 @@ enum Misc SAY_SUMMON_RANULF = 5, SAY_SUMMON_TORGYN = 6, - // SPELLS + // SPELLS SPELL_BANE_N = 48294, SPELL_BANE_H = 59301, SPELL_DARK_SLASH = 48292, @@ -39,9 +39,9 @@ enum Misc SPELL_SPIRIT_FOUNT_N = 48380, SPELL_SPIRIT_FOUNT_H = 59320, - SPELL_FLAMES = 39199, + SPELL_FLAMES = 39199, - // NPCS + // NPCS NPC_BJORN = 27303, // Near Right Boat, summon Spirit Fount NPC_BJORN_VISUAL = 27304, NPC_HALDOR = 27307, // Near Left Boat, debuff Spirit Strike on player @@ -57,21 +57,21 @@ enum Misc enum Events { - EVENT_YMIRON_HEALTH_CHECK = 1, - EVENT_YMIRON_BANE = 2, - EVENT_YMIRON_FETID_ROT = 3, - EVENT_YMIRON_DARK_SLASH = 4, - EVENT_YMIRON_ACTIVATE_BOAT = 5, - EVENT_YMIRON_BJORN_ABILITY = 6, - EVENT_YMIRON_RANULF_ABILITY = 7, - EVENT_YMIRON_HALDOR_ABILITY = 8, - EVENT_YMIRON_TORGYN_ABILITY = 9, - EVENT_YMIRON_RESTORE = 10, + EVENT_YMIRON_HEALTH_CHECK = 1, + EVENT_YMIRON_BANE = 2, + EVENT_YMIRON_FETID_ROT = 3, + EVENT_YMIRON_DARK_SLASH = 4, + EVENT_YMIRON_ACTIVATE_BOAT = 5, + EVENT_YMIRON_BJORN_ABILITY = 6, + EVENT_YMIRON_RANULF_ABILITY = 7, + EVENT_YMIRON_HALDOR_ABILITY = 8, + EVENT_YMIRON_TORGYN_ABILITY = 9, + EVENT_YMIRON_RESTORE = 10, }; struct ActiveBoatStruct { - uint32 trigger; + uint32 trigger; uint32 npc; uint32 say; float MoveX, MoveY, MoveZ, SpawnX, SpawnY, SpawnZ, SpawnO; @@ -95,244 +95,244 @@ public: return new boss_ymironAI (pCreature); } - struct boss_ymironAI : public ScriptedAI - { - boss_ymironAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me), summons2(me) - { - pInstance = pCreature->GetInstanceScript(); - } + struct boss_ymironAI : public ScriptedAI + { + boss_ymironAI(Creature *pCreature) : ScriptedAI(pCreature), summons(me), summons2(me) + { + pInstance = pCreature->GetInstanceScript(); + } - InstanceScript *pInstance; - EventMap events; - SummonList summons; - SummonList summons2; - uint8 BoatNum; - uint8 BoatOrder[4]; + InstanceScript *pInstance; + EventMap events; + SummonList summons; + SummonList summons2; + uint8 BoatNum; + uint8 BoatOrder[4]; - void Reset() - { - for (uint8 i = 0; i < 4; ++i) - { - bool good; - do - { - good = true; - BoatOrder[i] = urand(0,3); + void Reset() + { + for (uint8 i = 0; i < 4; ++i) + { + bool good; + do + { + good = true; + BoatOrder[i] = urand(0,3); - for (uint8 j = 0; j < i; ++j) - if (BoatOrder[i] == BoatOrder[j]) - { - good = false; - break; - } - } - while (!good); - } + for (uint8 j = 0; j < i; ++j) + if (BoatOrder[i] == BoatOrder[j]) + { + good = false; + break; + } + } + while (!good); + } - events.Reset(); - summons.DespawnAll(); - summons2.DespawnAll(); - BoatNum = 0; + events.Reset(); + summons.DespawnAll(); + summons2.DespawnAll(); + BoatNum = 0; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - - if(pInstance) - { - pInstance->SetData(DATA_KING_YMIRON, NOT_STARTED); - pInstance->SetData(DATA_YMIRON_ACHIEVEMENT, true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); + + if(pInstance) + { + pInstance->SetData(DATA_KING_YMIRON, NOT_STARTED); + pInstance->SetData(DATA_YMIRON_ACHIEVEMENT, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (pInstance->GetData(DATA_SKADI_THE_RUTHLESS) == DONE) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - } + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (pInstance->GetData(DATA_SKADI_THE_RUTHLESS) == DONE) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + } - void EnterEvadeMode() - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + ScriptedAI::EnterEvadeMode(); + } - void EnterCombat(Unit* pWho) - { - Talk(SAY_AGGRO); - if(pInstance) - { - pInstance->SetData(DATA_KING_YMIRON, IN_PROGRESS); - if (pInstance->GetData(DATA_SKADI_THE_RUTHLESS) == DONE) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } + void EnterCombat(Unit* pWho) + { + Talk(SAY_AGGRO); + if(pInstance) + { + pInstance->SetData(DATA_KING_YMIRON, IN_PROGRESS); + if (pInstance->GetData(DATA_SKADI_THE_RUTHLESS) == DONE) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } - events.RescheduleEvent(EVENT_YMIRON_BANE, 18000); - events.RescheduleEvent(EVENT_YMIRON_FETID_ROT, 8000); - events.RescheduleEvent(EVENT_YMIRON_DARK_SLASH, 28000); - events.RescheduleEvent(EVENT_YMIRON_HEALTH_CHECK, 1000); - } + events.RescheduleEvent(EVENT_YMIRON_BANE, 18000); + events.RescheduleEvent(EVENT_YMIRON_FETID_ROT, 8000); + events.RescheduleEvent(EVENT_YMIRON_DARK_SLASH, 28000); + events.RescheduleEvent(EVENT_YMIRON_HEALTH_CHECK, 1000); + } - void MovementInform(uint32 uiType, uint32 point) - { - if(uiType != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 uiType, uint32 point) + { + if(uiType != POINT_MOTION_TYPE) + return; - if (point == 0) - { - Talk(BoatStructure[BoatOrder[BoatNum-1]].say); - if (Creature *cr = me->FindNearestCreature(BoatStructure[BoatOrder[BoatNum-1]].trigger, 50.0f)) - me->CastSpell(cr, SPELL_CHANNEL_YMIRON_TO_SPIRIT, true); + if (point == 0) + { + Talk(BoatStructure[BoatOrder[BoatNum-1]].say); + if (Creature *cr = me->FindNearestCreature(BoatStructure[BoatOrder[BoatNum-1]].trigger, 50.0f)) + me->CastSpell(cr, SPELL_CHANNEL_YMIRON_TO_SPIRIT, true); - events.ScheduleEvent(EVENT_YMIRON_ACTIVATE_BOAT, 6000); - } - } + events.ScheduleEvent(EVENT_YMIRON_ACTIVATE_BOAT, 6000); + } + } - void SpellHitTarget(Unit *, const SpellInfo *spellInfo) - { - if (spellInfo->Id == 59302 && pInstance) // Bane trigger - pInstance->SetData(DATA_YMIRON_ACHIEVEMENT, false); - } + void SpellHitTarget(Unit *, const SpellInfo *spellInfo) + { + if (spellInfo->Id == 59302 && pInstance) // Bane trigger + pInstance->SetData(DATA_YMIRON_ACHIEVEMENT, false); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_YMIRON_HEALTH_CHECK: - { - if (me->GetHealth() < std::max(0.0f, float(me->GetMaxHealth()*(1.0f-(IsHeroic() ? 0.2f : 0.334f)*float(BoatNum+1))))) - { - events.DelayEvents(12000); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->InterruptNonMeleeSpells(true); - me->CastSpell(me, SPELL_SCREAMS_OF_THE_DEAD, true); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(0, BoatStructure[BoatOrder[BoatNum]].MoveX, BoatStructure[BoatOrder[BoatNum]].MoveY, BoatStructure[BoatOrder[BoatNum]].MoveZ); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - summons.DespawnAll(); + switch (events.GetEvent()) + { + case EVENT_YMIRON_HEALTH_CHECK: + { + if (me->GetHealth() < std::max(0.0f, float(me->GetMaxHealth()*(1.0f-(IsHeroic() ? 0.2f : 0.334f)*float(BoatNum+1))))) + { + events.DelayEvents(12000); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->InterruptNonMeleeSpells(true); + me->CastSpell(me, SPELL_SCREAMS_OF_THE_DEAD, true); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(0, BoatStructure[BoatOrder[BoatNum]].MoveX, BoatStructure[BoatOrder[BoatNum]].MoveY, BoatStructure[BoatOrder[BoatNum]].MoveZ); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + summons.DespawnAll(); - // Spawn flames in previous boat if any - if (BoatNum) // different than 0 - if (Creature *cr = me->SummonTrigger(BoatStructure[BoatOrder[BoatNum-1]].SpawnX, BoatStructure[BoatOrder[BoatNum-1]].SpawnY, BoatStructure[BoatOrder[BoatNum-1]].SpawnZ, 0, 1800000)) - { - cr->AddAura(SPELL_FLAMES, cr); - summons2.Summon(cr); - } + // Spawn flames in previous boat if any + if (BoatNum) // different than 0 + if (Creature *cr = me->SummonTrigger(BoatStructure[BoatOrder[BoatNum-1]].SpawnX, BoatStructure[BoatOrder[BoatNum-1]].SpawnY, BoatStructure[BoatOrder[BoatNum-1]].SpawnZ, 0, 1800000)) + { + cr->AddAura(SPELL_FLAMES, cr); + summons2.Summon(cr); + } - BoatNum++; - } + BoatNum++; + } - events.RepeatEvent(1000); - break; - } - case EVENT_YMIRON_BANE: - { - me->CastSpell(me, IsHeroic() ? SPELL_BANE_H : SPELL_BANE_N, false); - events.RepeatEvent(20000+rand()%5000); - break; - } - case EVENT_YMIRON_FETID_ROT: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_FETID_ROT_H : SPELL_FETID_ROT_N, false); - events.RepeatEvent(10000+rand()%3000); - break; - } - case EVENT_YMIRON_DARK_SLASH: - { - int32 dmg = me->GetVictim()->GetHealth() / 2; - me->CastCustomSpell(me->GetVictim(), SPELL_DARK_SLASH, &dmg, 0, 0, false); - events.RepeatEvent(30000+rand()%5000); - break; - } - case EVENT_YMIRON_ACTIVATE_BOAT: - { - // Spawn it! - if (Creature* king = me->SummonCreature(BoatStructure[BoatOrder[BoatNum-1]].npc, BoatStructure[BoatOrder[BoatNum-1]].SpawnX, BoatStructure[BoatOrder[BoatNum-1]].SpawnY, BoatStructure[BoatOrder[BoatNum-1]].SpawnZ, BoatStructure[BoatOrder[BoatNum-1]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0)) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - king->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true); - summons.Summon(king); - king->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - king->SetDisableGravity(true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - switch(BoatOrder[BoatNum-1]) - { - case 0: events.ScheduleEvent(EVENT_YMIRON_RANULF_ABILITY, 3000, 1); break; - case 1: events.ScheduleEvent(EVENT_YMIRON_TORGYN_ABILITY, 3000, 1); break; - case 2: events.ScheduleEvent(EVENT_YMIRON_BJORN_ABILITY, 3000, 1); break; - case 3: events.ScheduleEvent(EVENT_YMIRON_HALDOR_ABILITY, 3000, 1); break; - } - } + events.RepeatEvent(1000); + break; + } + case EVENT_YMIRON_BANE: + { + me->CastSpell(me, IsHeroic() ? SPELL_BANE_H : SPELL_BANE_N, false); + events.RepeatEvent(20000+rand()%5000); + break; + } + case EVENT_YMIRON_FETID_ROT: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_FETID_ROT_H : SPELL_FETID_ROT_N, false); + events.RepeatEvent(10000+rand()%3000); + break; + } + case EVENT_YMIRON_DARK_SLASH: + { + int32 dmg = me->GetVictim()->GetHealth() / 2; + me->CastCustomSpell(me->GetVictim(), SPELL_DARK_SLASH, &dmg, 0, 0, false); + events.RepeatEvent(30000+rand()%5000); + break; + } + case EVENT_YMIRON_ACTIVATE_BOAT: + { + // Spawn it! + if (Creature* king = me->SummonCreature(BoatStructure[BoatOrder[BoatNum-1]].npc, BoatStructure[BoatOrder[BoatNum-1]].SpawnX, BoatStructure[BoatOrder[BoatNum-1]].SpawnY, BoatStructure[BoatOrder[BoatNum-1]].SpawnZ, BoatStructure[BoatOrder[BoatNum-1]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0)) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + king->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true); + summons.Summon(king); + king->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + king->SetDisableGravity(true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + switch(BoatOrder[BoatNum-1]) + { + case 0: events.ScheduleEvent(EVENT_YMIRON_RANULF_ABILITY, 3000, 1); break; + case 1: events.ScheduleEvent(EVENT_YMIRON_TORGYN_ABILITY, 3000, 1); break; + case 2: events.ScheduleEvent(EVENT_YMIRON_BJORN_ABILITY, 3000, 1); break; + case 3: events.ScheduleEvent(EVENT_YMIRON_HALDOR_ABILITY, 3000, 1); break; + } + } - events.PopEvent(); - break; - } - case EVENT_YMIRON_BJORN_ABILITY: - { - if (Creature* sf = me->SummonCreature(NPC_SPIRIT_FOUNT, 385+rand()%10, -330+rand()%10, 104.756f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000)) - { - summons.Summon(sf); - sf->SetSpeed(MOVE_RUN, 0.4f); - sf->AddAura(IsHeroic() ? SPELL_SPIRIT_FOUNT_H : SPELL_SPIRIT_FOUNT_N, sf); - sf->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - sf->GetMotionMaster()->MoveFollow(me->GetVictim(), 0, rand_norm()*M_PI*2); - } - events.PopEvent(); - break; - } - case EVENT_YMIRON_HALDOR_ABILITY: - { - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SPIRIT_STRIKE_H : SPELL_SPIRIT_STRIKE_N, false); - events.RepeatEvent(5000); - break; - } - case EVENT_YMIRON_RANULF_ABILITY: - { - me->CastSpell(me, IsHeroic() ? SPELL_SPIRIT_BURST_H : SPELL_SPIRIT_BURST_N, false); - events.RepeatEvent(10000); - break; - } - case EVENT_YMIRON_TORGYN_ABILITY: - { - for(uint8 i = 0; i < 4; ++i) - { - if (Creature* as = me->SummonCreature(NPC_AVENGING_SPIRIT, me->GetPositionX()+rand()%10, me->GetPositionY()+rand()%10, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - { - summons.Summon(as); - as->SetInCombatWithZone(); - } - } - events.RepeatEvent(15000); - break; - } + events.PopEvent(); + break; + } + case EVENT_YMIRON_BJORN_ABILITY: + { + if (Creature* sf = me->SummonCreature(NPC_SPIRIT_FOUNT, 385+rand()%10, -330+rand()%10, 104.756f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000)) + { + summons.Summon(sf); + sf->SetSpeed(MOVE_RUN, 0.4f); + sf->AddAura(IsHeroic() ? SPELL_SPIRIT_FOUNT_H : SPELL_SPIRIT_FOUNT_N, sf); + sf->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + sf->GetMotionMaster()->MoveFollow(me->GetVictim(), 0, rand_norm()*M_PI*2); + } + events.PopEvent(); + break; + } + case EVENT_YMIRON_HALDOR_ABILITY: + { + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SPIRIT_STRIKE_H : SPELL_SPIRIT_STRIKE_N, false); + events.RepeatEvent(5000); + break; + } + case EVENT_YMIRON_RANULF_ABILITY: + { + me->CastSpell(me, IsHeroic() ? SPELL_SPIRIT_BURST_H : SPELL_SPIRIT_BURST_N, false); + events.RepeatEvent(10000); + break; + } + case EVENT_YMIRON_TORGYN_ABILITY: + { + for(uint8 i = 0; i < 4; ++i) + { + if (Creature* as = me->SummonCreature(NPC_AVENGING_SPIRIT, me->GetPositionX()+rand()%10, me->GetPositionY()+rand()%10, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + { + summons.Summon(as); + as->SetInCombatWithZone(); + } + } + events.RepeatEvent(15000); + break; + } - } + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* pKiller) - { - Talk(SAY_DEATH); - summons.DespawnAll(); - summons2.DespawnAll(); + void JustDied(Unit* pKiller) + { + Talk(SAY_DEATH); + summons.DespawnAll(); + summons2.DespawnAll(); - if(pInstance) - pInstance->SetData(DATA_KING_YMIRON, DONE); - } + if(pInstance) + pInstance->SetData(DATA_KING_YMIRON, DONE); + } - void KilledUnit(Unit* pVictim) - { - if (urand(0,1)) - return; + void KilledUnit(Unit* pVictim) + { + if (urand(0,1)) + return; - Talk(SAY_SLAY); - } - }; + Talk(SAY_SLAY); + } + }; }; void AddSC_boss_ymiron() diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp index 9fce76ce6..e38b10596 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp @@ -16,243 +16,243 @@ public: return new instance_pinnacle_InstanceMapScript(pMap); } - struct instance_pinnacle_InstanceMapScript : public InstanceScript - { - instance_pinnacle_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + struct instance_pinnacle_InstanceMapScript : public InstanceScript + { + instance_pinnacle_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint64 SvalaSorrowgrave; - uint64 GortokPalehoof; - uint64 SkadiRuthless; - uint64 KingYmiron; - uint64 FrenziedWorgen; - uint64 RavenousFurbolg; - uint64 MassiveJormungar; - uint64 FerociousRhino; - uint64 Grauf; + uint64 SvalaSorrowgrave; + uint64 GortokPalehoof; + uint64 SkadiRuthless; + uint64 KingYmiron; + uint64 FrenziedWorgen; + uint64 RavenousFurbolg; + uint64 MassiveJormungar; + uint64 FerociousRhino; + uint64 Grauf; - uint64 SvalaMirrorGUID; - uint64 SkadiRuthlessDoor; - uint64 YmironDoor; - uint64 StatisGenerator; - uint32 FightStatus; - uint32 Encounters[MAX_ENCOUNTERS]; - uint8 SkadiHits; - uint8 SkadiInRange; + uint64 SvalaMirrorGUID; + uint64 SkadiRuthlessDoor; + uint64 YmironDoor; + uint64 StatisGenerator; + uint32 FightStatus; + uint32 Encounters[MAX_ENCOUNTERS]; + uint8 SkadiHits; + uint8 SkadiInRange; - bool svalaAchievement; - bool skadiAchievement; - bool ymironAchievement; + bool svalaAchievement; + bool skadiAchievement; + bool ymironAchievement; - void Initialize() - { - SvalaSorrowgrave = 0; - GortokPalehoof = 0; - SkadiRuthless = 0; - KingYmiron = 0; - FrenziedWorgen = 0; - RavenousFurbolg = 0; - MassiveJormungar = 0; - FerociousRhino = 0; - Grauf = 0; + void Initialize() + { + SvalaSorrowgrave = 0; + GortokPalehoof = 0; + SkadiRuthless = 0; + KingYmiron = 0; + FrenziedWorgen = 0; + RavenousFurbolg = 0; + MassiveJormungar = 0; + FerociousRhino = 0; + Grauf = 0; - SvalaMirrorGUID = 0; - StatisGenerator = 0; - SkadiHits = 0; - SkadiInRange = 0; - SkadiRuthlessDoor= 0; - YmironDoor = 0; - FightStatus = 0; + SvalaMirrorGUID = 0; + StatisGenerator = 0; + SkadiHits = 0; + SkadiInRange = 0; + SkadiRuthlessDoor= 0; + YmironDoor = 0; + FightStatus = 0; - svalaAchievement = false; - skadiAchievement = false; - ymironAchievement = false; - - for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - Encounters[i] = NOT_STARTED; - } + svalaAchievement = false; + skadiAchievement = false; + ymironAchievement = false; + + for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + Encounters[i] = NOT_STARTED; + } - bool IsEncounterInProgress() const - { - for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - if(Encounters[i] == IN_PROGRESS) - return true; + bool IsEncounterInProgress() const + { + for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + if(Encounters[i] == IN_PROGRESS) + return true; - return false; - } - void OnCreatureCreate(Creature* pCreature) - { - switch(pCreature->GetEntry()) - { - case NPC_SVALA_SORROWGRAVE: SvalaSorrowgrave = pCreature->GetGUID(); break; - case NPC_GORTOK_PALEHOOF: GortokPalehoof = pCreature->GetGUID(); break; - case NPC_SKADI_THE_RUTHLESS: SkadiRuthless = pCreature->GetGUID(); break; - case NPC_KING_YMIRON: KingYmiron = pCreature->GetGUID(); break; - case NPC_FRENZIED_WORGEN: FrenziedWorgen = pCreature->GetGUID(); break; - case NPC_RAVENOUS_FURBOLG: RavenousFurbolg = pCreature->GetGUID(); break; - case NPC_MASSIVE_JORMUNGAR: MassiveJormungar = pCreature->GetGUID(); break; - case NPC_FEROCIOUS_RHINO: FerociousRhino = pCreature->GetGUID(); break; - case NPC_GARUF: Grauf = pCreature->GetGUID(); break; - } - } + return false; + } + void OnCreatureCreate(Creature* pCreature) + { + switch(pCreature->GetEntry()) + { + case NPC_SVALA_SORROWGRAVE: SvalaSorrowgrave = pCreature->GetGUID(); break; + case NPC_GORTOK_PALEHOOF: GortokPalehoof = pCreature->GetGUID(); break; + case NPC_SKADI_THE_RUTHLESS: SkadiRuthless = pCreature->GetGUID(); break; + case NPC_KING_YMIRON: KingYmiron = pCreature->GetGUID(); break; + case NPC_FRENZIED_WORGEN: FrenziedWorgen = pCreature->GetGUID(); break; + case NPC_RAVENOUS_FURBOLG: RavenousFurbolg = pCreature->GetGUID(); break; + case NPC_MASSIVE_JORMUNGAR: MassiveJormungar = pCreature->GetGUID(); break; + case NPC_FEROCIOUS_RHINO: FerociousRhino = pCreature->GetGUID(); break; + case NPC_GARUF: Grauf = pCreature->GetGUID(); break; + } + } - void OnGameObjectCreate(GameObject* pGo) - { - switch(pGo->GetEntry()) - { - case GO_SKADI_THE_RUTHLESS_DOOR: - SkadiRuthlessDoor = pGo->GetGUID(); - if (Encounters[DATA_SKADI_THE_RUTHLESS] == DONE) - HandleGameObject(0,true,pGo); - break; - case GO_KING_YMIRON_DOOR: - YmironDoor = pGo->GetGUID(); - if (Encounters[DATA_KING_YMIRON] == DONE) - HandleGameObject(0,true,pGo); - break; - case GO_GORK_PALEHOOF_SPHERE: - StatisGenerator = pGo->GetGUID(); - break; - case GO_SVALA_MIRROR: - SvalaMirrorGUID = pGo->GetGUID(); - break; - } - } + void OnGameObjectCreate(GameObject* pGo) + { + switch(pGo->GetEntry()) + { + case GO_SKADI_THE_RUTHLESS_DOOR: + SkadiRuthlessDoor = pGo->GetGUID(); + if (Encounters[DATA_SKADI_THE_RUTHLESS] == DONE) + HandleGameObject(0,true,pGo); + break; + case GO_KING_YMIRON_DOOR: + YmironDoor = pGo->GetGUID(); + if (Encounters[DATA_KING_YMIRON] == DONE) + HandleGameObject(0,true,pGo); + break; + case GO_GORK_PALEHOOF_SPHERE: + StatisGenerator = pGo->GetGUID(); + break; + case GO_SVALA_MIRROR: + SvalaMirrorGUID = pGo->GetGUID(); + break; + } + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case 7322: // The Incredible Hulk (2043) - return svalaAchievement; - case 7595: // My Girl Loves to Skadi All the Time (2156) - return skadiAchievement; - case 7598: // King's Bane (2157) - return ymironAchievement; - } - return false; - } + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case 7322: // The Incredible Hulk (2043) + return svalaAchievement; + case 7595: // My Girl Loves to Skadi All the Time (2156) + return skadiAchievement; + case 7598: // King's Bane (2157) + return ymironAchievement; + } + return false; + } - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_SVALA_SORROWGRAVE: - case DATA_GORTOK_PALEHOOF: - Encounters[type] = data; - break; - case DATA_SKADI_THE_RUTHLESS: - if (data == DONE) - { - HandleGameObject(SkadiRuthlessDoor,true); - // Make ymiron attackable - if (Creature *cr = instance->GetCreature(KingYmiron)) - cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - Encounters[type] = data; - break; - case DATA_KING_YMIRON: - if (data == DONE) - HandleGameObject(YmironDoor,true); - Encounters[type] = data; - break; - case SKADI_HITS: - SkadiHits = data; - break; - case SKADI_IN_RANGE: - SkadiInRange = data; - break; - case DATA_SVALA_ACHIEVEMENT: - svalaAchievement = (bool)data; - return; - case DATA_SKADI_ACHIEVEMENT: - skadiAchievement = (bool)data; - return; - case DATA_YMIRON_ACHIEVEMENT: - ymironAchievement = (bool)data; - return; + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_SVALA_SORROWGRAVE: + case DATA_GORTOK_PALEHOOF: + Encounters[type] = data; + break; + case DATA_SKADI_THE_RUTHLESS: + if (data == DONE) + { + HandleGameObject(SkadiRuthlessDoor,true); + // Make ymiron attackable + if (Creature *cr = instance->GetCreature(KingYmiron)) + cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + Encounters[type] = data; + break; + case DATA_KING_YMIRON: + if (data == DONE) + HandleGameObject(YmironDoor,true); + Encounters[type] = data; + break; + case SKADI_HITS: + SkadiHits = data; + break; + case SKADI_IN_RANGE: + SkadiInRange = data; + break; + case DATA_SVALA_ACHIEVEMENT: + svalaAchievement = (bool)data; + return; + case DATA_SKADI_ACHIEVEMENT: + skadiAchievement = (bool)data; + return; + case DATA_YMIRON_ACHIEVEMENT: + ymironAchievement = (bool)data; + return; - } - OUT_SAVE_INST_DATA; + } + OUT_SAVE_INST_DATA; - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; - } + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << "U P " << Encounters[0] << ' ' << Encounters[1] << ' ' << Encounters[2] << ' ' << Encounters[3]; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << "U P " << Encounters[0] << ' ' << Encounters[1] << ' ' << Encounters[2] << ' ' << Encounters[3]; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - if (dataHead1 == 'U' && dataHead2 == 'P') - { - Encounters[0] = data0; - Encounters[1] = data1; - Encounters[2] = data2; - Encounters[3] = data3; + if (dataHead1 == 'U' && dataHead2 == 'P') + { + Encounters[0] = data0; + Encounters[1] = data1; + Encounters[2] = data2; + Encounters[3] = data3; - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - if (Encounters[i] == IN_PROGRESS) - Encounters[i] = NOT_STARTED; + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) + if (Encounters[i] == IN_PROGRESS) + Encounters[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; + } else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } - uint32 GetData(uint32 type) const - { - switch(type) - { - case DATA_SVALA_SORROWGRAVE: return Encounters[0]; - case DATA_GORTOK_PALEHOOF: return Encounters[1]; - case DATA_SKADI_THE_RUTHLESS: return Encounters[2]; - case DATA_KING_YMIRON: return Encounters[3]; - case SKADI_HITS: return SkadiHits; - case SKADI_IN_RANGE: return SkadiInRange; - } - return 0; - } + uint32 GetData(uint32 type) const + { + switch(type) + { + case DATA_SVALA_SORROWGRAVE: return Encounters[0]; + case DATA_GORTOK_PALEHOOF: return Encounters[1]; + case DATA_SKADI_THE_RUTHLESS: return Encounters[2]; + case DATA_KING_YMIRON: return Encounters[3]; + case SKADI_HITS: return SkadiHits; + case SKADI_IN_RANGE: return SkadiInRange; + } + return 0; + } - uint64 GetData64(uint32 identifier) const - { - switch(identifier) - { - case DATA_SVALA_SORROWGRAVE: return SvalaSorrowgrave; - case DATA_GORTOK_PALEHOOF: return GortokPalehoof; - case DATA_SKADI_THE_RUTHLESS: return SkadiRuthless; - case DATA_KING_YMIRON: return KingYmiron; - case DATA_NPC_FRENZIED_WORGEN: return FrenziedWorgen; - case DATA_NPC_RAVENOUS_FURBOLG: return RavenousFurbolg; - case DATA_NPC_MASSIVE_JORMUNGAR: return MassiveJormungar; - case DATA_NPC_FEROCIOUS_RHINO: return FerociousRhino; - case YMIRON_DOOR: return YmironDoor; - case STATIS_GENERATOR: return StatisGenerator; - case SKADI_DOOR: return SkadiRuthlessDoor; - case DATA_GRAUF: return Grauf; - case GO_SVALA_MIRROR: return SvalaMirrorGUID; - } + uint64 GetData64(uint32 identifier) const + { + switch(identifier) + { + case DATA_SVALA_SORROWGRAVE: return SvalaSorrowgrave; + case DATA_GORTOK_PALEHOOF: return GortokPalehoof; + case DATA_SKADI_THE_RUTHLESS: return SkadiRuthless; + case DATA_KING_YMIRON: return KingYmiron; + case DATA_NPC_FRENZIED_WORGEN: return FrenziedWorgen; + case DATA_NPC_RAVENOUS_FURBOLG: return RavenousFurbolg; + case DATA_NPC_MASSIVE_JORMUNGAR: return MassiveJormungar; + case DATA_NPC_FEROCIOUS_RHINO: return FerociousRhino; + case YMIRON_DOOR: return YmironDoor; + case STATIS_GENERATOR: return StatisGenerator; + case SKADI_DOOR: return SkadiRuthlessDoor; + case DATA_GRAUF: return Grauf; + case GO_SVALA_MIRROR: return SvalaMirrorGUID; + } - return 0; - } - }; + return 0; + } + }; }; void AddSC_instance_utgarde_pinnacle() diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h index 49afd03e3..4486ed64f 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h @@ -3,51 +3,51 @@ enum Data { - DATA_SVALA_SORROWGRAVE = 0, - DATA_GORTOK_PALEHOOF = 1, - DATA_SKADI_THE_RUTHLESS = 2, - DATA_KING_YMIRON = 3, - DATA_GRAUF = 4, + DATA_SVALA_SORROWGRAVE = 0, + DATA_GORTOK_PALEHOOF = 1, + DATA_SKADI_THE_RUTHLESS = 2, + DATA_KING_YMIRON = 3, + DATA_GRAUF = 4, - DATA_NPC_FRENZIED_WORGEN = 10, - DATA_NPC_RAVENOUS_FURBOLG = 11, - DATA_NPC_MASSIVE_JORMUNGAR = 12, - DATA_NPC_FEROCIOUS_RHINO = 13, - - YMIRON_DOOR = 20, - STATIS_GENERATOR = 21, + DATA_NPC_FRENZIED_WORGEN = 10, + DATA_NPC_RAVENOUS_FURBOLG = 11, + DATA_NPC_MASSIVE_JORMUNGAR = 12, + DATA_NPC_FEROCIOUS_RHINO = 13, + + YMIRON_DOOR = 20, + STATIS_GENERATOR = 21, - SKADI_HITS = 30, - SKADI_IN_RANGE = 31, - SKADI_DOOR = 32, + SKADI_HITS = 30, + SKADI_IN_RANGE = 31, + SKADI_DOOR = 32, - MAX_ENCOUNTERS = 4, + MAX_ENCOUNTERS = 4, - DATA_SVALA_ACHIEVEMENT = 50, - DATA_SKADI_ACHIEVEMENT = 51, - DATA_YMIRON_ACHIEVEMENT = 52, + DATA_SVALA_ACHIEVEMENT = 50, + DATA_SKADI_ACHIEVEMENT = 51, + DATA_YMIRON_ACHIEVEMENT = 52, }; enum Objects { - // GOs - GO_SKADI_THE_RUTHLESS_DOOR = 192173, - GO_KING_YMIRON_DOOR = 192174, - GO_GORK_PALEHOOF_SPHERE = 188593, - GO_SVALA_MIRROR = 191745, + // GOs + GO_SKADI_THE_RUTHLESS_DOOR = 192173, + GO_KING_YMIRON_DOOR = 192174, + GO_GORK_PALEHOOF_SPHERE = 188593, + GO_SVALA_MIRROR = 191745, - // NPCs - NPC_SCOURGE_HULK = 26555, - NPC_DRAGONFLAYER_SPECTATOR = 26667, - NPC_SVALA_SORROWGRAVE = 26668, - NPC_GORTOK_PALEHOOF = 26687, - NPC_SKADI_THE_RUTHLESS = 26693, - NPC_KING_YMIRON = 26861, - NPC_FRENZIED_WORGEN = 26683, - NPC_RAVENOUS_FURBOLG = 26684, - NPC_MASSIVE_JORMUNGAR = 26685, - NPC_FEROCIOUS_RHINO = 26686, - NPC_GARUF = 26893, + // NPCs + NPC_SCOURGE_HULK = 26555, + NPC_DRAGONFLAYER_SPECTATOR = 26667, + NPC_SVALA_SORROWGRAVE = 26668, + NPC_GORTOK_PALEHOOF = 26687, + NPC_SKADI_THE_RUTHLESS = 26693, + NPC_KING_YMIRON = 26861, + NPC_FRENZIED_WORGEN = 26683, + NPC_RAVENOUS_FURBOLG = 26684, + NPC_MASSIVE_JORMUNGAR = 26685, + NPC_FEROCIOUS_RHINO = 26686, + NPC_GARUF = 26893, }; #endif \ No newline at end of file diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp index 9df355d5a..14f8f5e56 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp @@ -10,14 +10,14 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Archavon { - SPELL_ROCK_SHARDS = 58678, - SPELL_CRUSHING_LEAP_10 = 58960, - SPELL_CRUSHING_LEAP_25 = 60894, //Instant (10-80yr range) -- Leaps at an enemy, inflicting 8000 Physical damage, knocking all nearby enemies away, and creating a cloud of choking debris. - SPELL_STOMP_10 = 58663, - SPELL_STOMP_25 = 60880, - SPELL_IMPALE_10 = 58666, - SPELL_IMPALE_25 = 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. - SPELL_BERSERK = 47008, + SPELL_ROCK_SHARDS = 58678, + SPELL_CRUSHING_LEAP_10 = 58960, + SPELL_CRUSHING_LEAP_25 = 60894, //Instant (10-80yr range) -- Leaps at an enemy, inflicting 8000 Physical damage, knocking all nearby enemies away, and creating a cloud of choking debris. + SPELL_STOMP_10 = 58663, + SPELL_STOMP_25 = 60880, + SPELL_IMPALE_10 = 58666, + SPELL_IMPALE_25 = 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. + SPELL_BERSERK = 47008, }; enum @@ -44,36 +44,36 @@ class boss_archavon : public CreatureScript { boss_archavonAI(Creature* creature) : ScriptedAI(creature) { - pInstance = me->GetInstanceScript(); + pInstance = me->GetInstanceScript(); } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - if (pInstance) - { - if (pInstance->GetData(DATA_STONED)) - { - if (Aura* aur = me->AddAura(SPELL_STONED_AURA, me)) - { - aur->SetMaxDuration(60 * MINUTE* IN_MILLISECONDS); - aur->SetDuration(60 * MINUTE* IN_MILLISECONDS); - } - } - pInstance->SetData(EVENT_ARCHAVON, NOT_STARTED); - } - } + void Reset() + { + events.Reset(); + if (pInstance) + { + if (pInstance->GetData(DATA_STONED)) + { + if (Aura* aur = me->AddAura(SPELL_STONED_AURA, me)) + { + aur->SetMaxDuration(60 * MINUTE* IN_MILLISECONDS); + aur->SetDuration(60 * MINUTE* IN_MILLISECONDS); + } + } + pInstance->SetData(EVENT_ARCHAVON, NOT_STARTED); + } + } - void AttackStart(Unit* who) - { - if (me->HasAura(SPELL_STONED_AURA)) - return; + void AttackStart(Unit* who) + { + if (me->HasAura(SPELL_STONED_AURA)) + return; - ScriptedAI::AttackStart(who); - } + ScriptedAI::AttackStart(who); + } void EnterCombat(Unit* /*who*/) { @@ -81,15 +81,15 @@ class boss_archavon : public CreatureScript events.ScheduleEvent(EVENT_CHOKING_CLOUD, 30000); events.ScheduleEvent(EVENT_STOMP, 45000); events.ScheduleEvent(EVENT_BERSERK, 300000); - if (pInstance) - pInstance->SetData(EVENT_ARCHAVON, IN_PROGRESS); + if (pInstance) + pInstance->SetData(EVENT_ARCHAVON, IN_PROGRESS); } void JustDied(Unit* ) - { - if (pInstance) - pInstance->SetData(EVENT_ARCHAVON, DONE); - } + { + if (pInstance) + pInstance->SetData(EVENT_ARCHAVON, DONE); + } void UpdateAI(uint32 diff) { @@ -105,34 +105,34 @@ class boss_archavon : public CreatureScript { case EVENT_ROCK_SHARDS: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_ROCK_SHARDS, false); + me->CastSpell(target, SPELL_ROCK_SHARDS, false); - events.RepeatEvent(15000); + events.RepeatEvent(15000); break; case EVENT_CHOKING_CLOUD: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) - me->CastSpell(target, RAID_MODE(SPELL_CRUSHING_LEAP_10, SPELL_CRUSHING_LEAP_25), true); //10y~80y, ignore range + me->CastSpell(target, RAID_MODE(SPELL_CRUSHING_LEAP_10, SPELL_CRUSHING_LEAP_25), true); //10y~80y, ignore range - events.RepeatEvent(30000); + events.RepeatEvent(30000); break; case EVENT_STOMP: - { - char buffer[100]; - sprintf(buffer, "Archavon the Stone Watcher lunges for %s!", me->GetVictim()->GetName().c_str()); - me->MonsterTextEmote(buffer, 0); - me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_STOMP_10, SPELL_STOMP_25), false); + { + char buffer[100]; + sprintf(buffer, "Archavon the Stone Watcher lunges for %s!", me->GetVictim()->GetName().c_str()); + me->MonsterTextEmote(buffer, 0); + me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_STOMP_10, SPELL_STOMP_25), false); events.RepeatEvent(45000); - events.ScheduleEvent(EVENT_IMPALE, 3000); + events.ScheduleEvent(EVENT_IMPALE, 3000); break; - } + } case EVENT_IMPALE: - me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25), false); - events.PopEvent(); + me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25), false); + events.PopEvent(); break; case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); + me->CastSpell(me, SPELL_BERSERK, true); Talk(EMOTE_BERSERK); - events.PopEvent(); + events.PopEvent(); break; default: break; @@ -159,18 +159,18 @@ class spell_archavon_rock_shards : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - Unit* target = GetHitUnit(); - Unit* caster = GetOriginalCaster(); - if (target && caster && caster->GetMap()) + PreventHitDefaultEffect(effIndex); + Unit* target = GetHitUnit(); + Unit* caster = GetOriginalCaster(); + if (target && caster && caster->GetMap()) { - for (uint32 i = 0; i < 3; ++i) + for (uint32 i = 0; i < 3; ++i) { caster->CastSpell(target, 58689, true); caster->CastSpell(target, 58692, true); } - caster->CastSpell(target, caster->GetMap()->Is25ManRaid() ? 60883 : 58695, true); + caster->CastSpell(target, caster->GetMap()->Is25ManRaid() ? 60883 : 58695, true); } } @@ -190,5 +190,5 @@ class spell_archavon_rock_shards : public SpellScriptLoader void AddSC_boss_archavon() { new boss_archavon(); - new spell_archavon_rock_shards(); + new spell_archavon_rock_shards(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp index a51f429ac..66c1abef0 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp @@ -10,24 +10,24 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { - SPELL_OVERCHARGED = 64217, - SPELL_OVERCHARGED_BLAST = 64219, - SPELL_OVERCHARGE = 64218, - SPELL_BERSERK = 26662, + SPELL_OVERCHARGED = 64217, + SPELL_OVERCHARGED_BLAST = 64219, + SPELL_OVERCHARGE = 64218, + SPELL_BERSERK = 26662, - SPELL_CHAIN_LIGHTNING_10 = 64213, - SPELL_CHAIN_LIGHTNING_25 = 64215, - SPELL_LIGHTNING_NOVA_10 = 64216, - SPELL_LIGHTNING_NOVA_25 = 65279, + SPELL_CHAIN_LIGHTNING_10 = 64213, + SPELL_CHAIN_LIGHTNING_25 = 64215, + SPELL_LIGHTNING_NOVA_10 = 64216, + SPELL_LIGHTNING_NOVA_25 = 65279, }; enum Events { - EVENT_CHAIN_LIGHTNING = 1, - EVENT_LIGHTNING_NOVA = 2, - EVENT_OVERCHARGE = 3, - EVENT_BERSERK = 4, - EVENT_SUMMON_NEXT_MINION = 5, + EVENT_CHAIN_LIGHTNING = 1, + EVENT_LIGHTNING_NOVA = 2, + EVENT_OVERCHARGE = 3, + EVENT_BERSERK = 4, + EVENT_SUMMON_NEXT_MINION = 5, }; enum Misc @@ -36,8 +36,8 @@ enum Misc EMOTE_MINION_RESPAWN = 1, EMOTE_BERSERK = 2, - NPC_TEMPEST_MINION = 33998, - MAX_TEMPEST_MINIONS = 4, + NPC_TEMPEST_MINION = 33998, + MAX_TEMPEST_MINIONS = 4, }; struct Position TempestMinions[MAX_TEMPEST_MINIONS] = @@ -60,70 +60,70 @@ class boss_emalon : public CreatureScript { boss_emalonAI(Creature* creature) : ScriptedAI(creature), summons(me) { - pInstance = me->GetInstanceScript(); + pInstance = me->GetInstanceScript(); } - InstanceScript* pInstance; - EventMap events; - SummonList summons; + InstanceScript* pInstance; + EventMap events; + SummonList summons; - void ResetSummons() - { - summons.DespawnAll(); + void ResetSummons() + { + summons.DespawnAll(); for (uint8 i = 0; i < MAX_TEMPEST_MINIONS; ++i) me->SummonCreature(NPC_TEMPEST_MINION, TempestMinions[i], TEMPSUMMON_CORPSE_DESPAWN, 0); - } + } void Reset() { - events.Reset(); - ResetSummons(); + events.Reset(); + ResetSummons(); - if (pInstance) - { - if (pInstance->GetData(DATA_STONED)) - { - if (Aura* aur = me->AddAura(SPELL_STONED_AURA, me)) - { - aur->SetMaxDuration(60 * MINUTE* IN_MILLISECONDS); - aur->SetDuration(60 * MINUTE* IN_MILLISECONDS); - } - } - pInstance->SetData(EVENT_EMALON, NOT_STARTED); - } + if (pInstance) + { + if (pInstance->GetData(DATA_STONED)) + { + if (Aura* aur = me->AddAura(SPELL_STONED_AURA, me)) + { + aur->SetMaxDuration(60 * MINUTE* IN_MILLISECONDS); + aur->SetDuration(60 * MINUTE* IN_MILLISECONDS); + } + } + pInstance->SetData(EVENT_EMALON, NOT_STARTED); + } } - void AttackStart(Unit* who) - { - if (me->HasAura(SPELL_STONED_AURA)) - return; + void AttackStart(Unit* who) + { + if (me->HasAura(SPELL_STONED_AURA)) + return; - ScriptedAI::AttackStart(who); - } + ScriptedAI::AttackStart(who); + } void JustSummoned(Creature* summon) { summons.Summon(summon); } - void SummonedCreatureDies(Creature* cr, Unit*) - { - summons.Despawn(cr); - events.ScheduleEvent(EVENT_SUMMON_NEXT_MINION, 4000); - } + void SummonedCreatureDies(Creature* cr, Unit*) + { + summons.Despawn(cr); + events.ScheduleEvent(EVENT_SUMMON_NEXT_MINION, 4000); + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - // restore minions health - if (spellInfo->Id == SPELL_OVERCHARGE) - target->SetFullHealth(); - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + // restore minions health + if (spellInfo->Id == SPELL_OVERCHARGE) + target->SetFullHealth(); + } void EnterCombat(Unit* who) { - events.Reset(); - if (summons.size() < 4) - ResetSummons(); + events.Reset(); + if (summons.size() < 4) + ResetSummons(); summons.DoZoneInCombat(); @@ -132,17 +132,17 @@ class boss_emalon : public CreatureScript events.ScheduleEvent(EVENT_BERSERK, 360000); events.ScheduleEvent(EVENT_OVERCHARGE, 47000); - if (pInstance) - pInstance->SetData(EVENT_EMALON, IN_PROGRESS); + if (pInstance) + pInstance->SetData(EVENT_EMALON, IN_PROGRESS); } - void JustDied(Unit* ) - { - summons.DespawnAll(); - events.Reset(); - if (pInstance) - pInstance->SetData(EVENT_EMALON, DONE); - } + void JustDied(Unit* ) + { + summons.DespawnAll(); + events.Reset(); + if (pInstance) + pInstance->SetData(EVENT_EMALON, DONE); + } void UpdateAI(uint32 diff) { @@ -157,27 +157,27 @@ class boss_emalon : public CreatureScript { case EVENT_CHAIN_LIGHTNING: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, RAID_MODE(SPELL_CHAIN_LIGHTNING_10, SPELL_CHAIN_LIGHTNING_25), false); + me->CastSpell(target, RAID_MODE(SPELL_CHAIN_LIGHTNING_10, SPELL_CHAIN_LIGHTNING_25), false); events.RepeatEvent(25000); break; case EVENT_LIGHTNING_NOVA: - me->CastSpell(me, RAID_MODE(SPELL_LIGHTNING_NOVA_10, SPELL_LIGHTNING_NOVA_25), false); + me->CastSpell(me, RAID_MODE(SPELL_LIGHTNING_NOVA_10, SPELL_LIGHTNING_NOVA_25), false); events.RepeatEvent(40000); break; case EVENT_OVERCHARGE: - if (!summons.empty()) - me->CastCustomSpell(SPELL_OVERCHARGE, SPELLVALUE_MAX_TARGETS, 1, me, true); + if (!summons.empty()) + me->CastCustomSpell(SPELL_OVERCHARGE, SPELLVALUE_MAX_TARGETS, 1, me, true); Talk(EMOTE_OVERCHARGE); - events.RepeatEvent(40000); + events.RepeatEvent(40000); break; case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); + me->CastSpell(me, SPELL_BERSERK, true); Talk(EMOTE_BERSERK); break; - case EVENT_SUMMON_NEXT_MINION: - me->SummonCreature(NPC_TEMPEST_MINION, TempestMinions[urand(0,3)], TEMPSUMMON_CORPSE_DESPAWN, 0); - events.PopEvent(); - break; + case EVENT_SUMMON_NEXT_MINION: + me->SummonCreature(NPC_TEMPEST_MINION, TempestMinions[urand(0,3)], TEMPSUMMON_CORPSE_DESPAWN, 0); + events.PopEvent(); + break; default: break; } @@ -204,13 +204,13 @@ class spell_voa_overcharge : public SpellScriptLoader void HandlePeriodicDummy(AuraEffect const* aurEff) { Unit* target = GetTarget(); - if (target->GetTypeId() == TYPEID_UNIT && GetAura()->GetStackAmount() >= 10) - { - target->CastSpell(target, SPELL_OVERCHARGED_BLAST, true); - target->ToCreature()->DespawnOrUnsummon(500); - } + if (target->GetTypeId() == TYPEID_UNIT && GetAura()->GetStackAmount() >= 10) + { + target->CastSpell(target, SPELL_OVERCHARGED_BLAST, true); + target->ToCreature()->DespawnOrUnsummon(500); + } - PreventDefaultAction(); + PreventDefaultAction(); } void Register() @@ -236,14 +236,14 @@ class spell_voa_lightning_nova : public SpellScriptLoader void HandleOnHit() { - int32 damage = 0; - if (Unit* target = GetHitUnit()) - { - float dist = target->GetDistance(GetCaster()); - damage = int32(GetHitDamage() * (70.0f - std::min(70.0f, dist)) / 70.0f); - } + int32 damage = 0; + if (Unit* target = GetHitUnit()) + { + float dist = target->GetDistance(GetCaster()); + damage = int32(GetHitDamage() * (70.0f - std::min(70.0f, dist)) / 70.0f); + } - SetHitDamage(damage); + SetHitDamage(damage); } void Register() @@ -262,6 +262,6 @@ void AddSC_boss_emalon() { new boss_emalon(); - new spell_voa_overcharge(); - new spell_voa_lightning_nova(); + new spell_voa_overcharge(); + new spell_voa_lightning_nova(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp index d1fa39605..d945af1b0 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp @@ -11,19 +11,19 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Events { // Koralon - EVENT_BURNING_BREATH = 1, - EVENT_FLAME_CINDER = 2, - EVENT_METEOR_FISTS = 3, + EVENT_BURNING_BREATH = 1, + EVENT_FLAME_CINDER = 2, + EVENT_METEOR_FISTS = 3, }; enum Spells { SPELL_BURNING_FURY = 68168, - SPELL_BURNING_BREATH = 66665, // handled by spell_difficulty + SPELL_BURNING_BREATH = 66665, // handled by spell_difficulty SPELL_FLAMING_CINDER = 66681, - SPELL_FLAMING_CINDER_DUMMY = 66690, - SPELL_FLAMING_CINDER_MISSILE = 66682, // trigger of missile handled by spell_difficulty + SPELL_FLAMING_CINDER_DUMMY = 66690, + SPELL_FLAMING_CINDER_MISSILE = 66682, // trigger of missile handled by spell_difficulty SPELL_METEOR_FISTS = 66725, // handled by spell_difficulty SPELL_METEOR_FISTS_DAMAGE = 66765, @@ -39,38 +39,38 @@ class boss_koralon : public CreatureScript { boss_koralonAI(Creature* creature) : ScriptedAI(creature) { - pInstance = me->GetInstanceScript(); + pInstance = me->GetInstanceScript(); } - InstanceScript* pInstance; - EventMap events; - uint32 rotateTimer; + InstanceScript* pInstance; + EventMap events; + uint32 rotateTimer; - void Reset() - { - rotateTimer = 0; - events.Reset(); - if (pInstance) - { - if (pInstance->GetData(DATA_STONED)) - { - if (Aura* aur = me->AddAura(SPELL_STONED_AURA, me)) - { - aur->SetMaxDuration(60 * MINUTE* IN_MILLISECONDS); - aur->SetDuration(60 * MINUTE* IN_MILLISECONDS); - } - } - pInstance->SetData(EVENT_KORALON, NOT_STARTED); - } - } + void Reset() + { + rotateTimer = 0; + events.Reset(); + if (pInstance) + { + if (pInstance->GetData(DATA_STONED)) + { + if (Aura* aur = me->AddAura(SPELL_STONED_AURA, me)) + { + aur->SetMaxDuration(60 * MINUTE* IN_MILLISECONDS); + aur->SetDuration(60 * MINUTE* IN_MILLISECONDS); + } + } + pInstance->SetData(EVENT_KORALON, NOT_STARTED); + } + } - void AttackStart(Unit* who) - { - if (me->HasAura(SPELL_STONED_AURA)) - return; + void AttackStart(Unit* who) + { + if (me->HasAura(SPELL_STONED_AURA)) + return; - ScriptedAI::AttackStart(who); - } + ScriptedAI::AttackStart(who); + } void EnterCombat(Unit* /*who*/) { @@ -81,38 +81,38 @@ class boss_koralon : public CreatureScript events.ScheduleEvent(EVENT_FLAME_CINDER, 20000); if (pInstance) - pInstance->SetData(EVENT_KORALON, IN_PROGRESS); + pInstance->SetData(EVENT_KORALON, IN_PROGRESS); } - void JustDied(Unit* ) - { - if (pInstance) - pInstance->SetData(EVENT_KORALON, DONE); - } + void JustDied(Unit* ) + { + if (pInstance) + pInstance->SetData(EVENT_KORALON, DONE); + } void UpdateAI(uint32 diff) { - if (rotateTimer) - { - rotateTimer += diff; - if (rotateTimer >= 3000) - { - if (!me->HasUnitMovementFlag(MOVEMENTFLAG_LEFT)) - { - me->SetUnitMovementFlags(MOVEMENTFLAG_LEFT); - me->SendMovementFlagUpdate(); - rotateTimer = 1; - return; - } - else - { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEFT); - me->SendMovementFlagUpdate(); - rotateTimer = 0; - return; - } - } - } + if (rotateTimer) + { + rotateTimer += diff; + if (rotateTimer >= 3000) + { + if (!me->HasUnitMovementFlag(MOVEMENTFLAG_LEFT)) + { + me->SetUnitMovementFlags(MOVEMENTFLAG_LEFT); + me->SendMovementFlagUpdate(); + rotateTimer = 1; + return; + } + else + { + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEFT); + me->SendMovementFlagUpdate(); + rotateTimer = 0; + return; + } + } + } if (!UpdateVictim()) return; @@ -124,7 +124,7 @@ class boss_koralon : public CreatureScript switch (events.GetEvent()) { case EVENT_BURNING_BREATH: - rotateTimer = 1500; + rotateTimer = 1500; me->CastSpell(me, SPELL_BURNING_BREATH, false); events.RepeatEvent(45000); break; @@ -161,8 +161,8 @@ class spell_voa_flaming_cinder : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), SPELL_FLAMING_CINDER_MISSILE, true); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), SPELL_FLAMING_CINDER_MISSILE, true); } void Register() @@ -248,7 +248,7 @@ class spell_flame_warder_meteor_fists : public SpellScriptLoader void AddSC_boss_koralon() { new boss_koralon(); - new spell_voa_flaming_cinder(); - new spell_koralon_meteor_fists(); - new spell_flame_warder_meteor_fists(); + new spell_voa_flaming_cinder(); + new spell_koralon_meteor_fists(); + new spell_flame_warder_meteor_fists(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp index 6ef5c70d2..8ebe9bea3 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp @@ -12,30 +12,30 @@ REWRITTEN FROM SCRATCH BY XINEF, IT OWNS NOW! enum Spells { // Toravon - SPELL_FREEZING_GROUND = 72090, - SPELL_FROZEN_ORB = 72091, - SPELL_WHITEOUT = 72034, - SPELL_FROZEN_MALLET = 71993, + SPELL_FREEZING_GROUND = 72090, + SPELL_FROZEN_ORB = 72091, + SPELL_WHITEOUT = 72034, + SPELL_FROZEN_MALLET = 71993, // Frozen Orb - SPELL_FROZEN_ORB_DMG = 72081, // priodic dmg aura - SPELL_FROZEN_ORB_AURA = 72067, // make visible + SPELL_FROZEN_ORB_DMG = 72081, // priodic dmg aura + SPELL_FROZEN_ORB_AURA = 72067, // make visible // Frozen Orb Stalker - SPELL_FROZEN_ORB_STALKER_VISUAL = 72094, + SPELL_FROZEN_ORB_STALKER_VISUAL = 72094, }; enum Events { - EVENT_FREEZING_GROUND = 1, - EVENT_FROZEN_ORB_STALKER = 2, - EVENT_CHECK_SUMMONS = 3, + EVENT_FREEZING_GROUND = 1, + EVENT_FROZEN_ORB_STALKER = 2, + EVENT_CHECK_SUMMONS = 3, }; enum Misc { - NPC_FROZEN_ORB = 38456, - NPC_FROZEN_ORB_STALKER = 38461, + NPC_FROZEN_ORB = 38456, + NPC_FROZEN_ORB_STALKER = 38461, }; @@ -48,62 +48,62 @@ class boss_toravon : public CreatureScript { boss_toravonAI(Creature* creature) : ScriptedAI(creature), summons(me) { - pInstance = me->GetInstanceScript(); + pInstance = me->GetInstanceScript(); } - InstanceScript* pInstance; - EventMap events; - SummonList summons; + InstanceScript* pInstance; + EventMap events; + SummonList summons; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - if (pInstance) - { - if (pInstance->GetData(DATA_STONED)) - { - if (Aura* aur = me->AddAura(SPELL_STONED_AURA, me)) - { - aur->SetMaxDuration(60 * MINUTE* IN_MILLISECONDS); - aur->SetDuration(60 * MINUTE* IN_MILLISECONDS); - } - } - pInstance->SetData(EVENT_TORAVON, NOT_STARTED); - } - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + if (pInstance) + { + if (pInstance->GetData(DATA_STONED)) + { + if (Aura* aur = me->AddAura(SPELL_STONED_AURA, me)) + { + aur->SetMaxDuration(60 * MINUTE* IN_MILLISECONDS); + aur->SetDuration(60 * MINUTE* IN_MILLISECONDS); + } + } + pInstance->SetData(EVENT_TORAVON, NOT_STARTED); + } + } - void AttackStart(Unit* who) - { - if (me->HasAura(SPELL_STONED_AURA)) - return; + void AttackStart(Unit* who) + { + if (me->HasAura(SPELL_STONED_AURA)) + return; - ScriptedAI::AttackStart(who); - } + ScriptedAI::AttackStart(who); + } void EnterCombat(Unit* /*who*/) { - me->CastSpell(me, SPELL_FROZEN_MALLET, true); + me->CastSpell(me, SPELL_FROZEN_MALLET, true); events.ScheduleEvent(EVENT_FROZEN_ORB_STALKER, 12000); events.ScheduleEvent(EVENT_FREEZING_GROUND, 7000); - if (pInstance) - pInstance->SetData(EVENT_TORAVON, IN_PROGRESS); + if (pInstance) + pInstance->SetData(EVENT_TORAVON, IN_PROGRESS); } - void JustDied(Unit* ) - { - if (pInstance) - { - pInstance->SetData(EVENT_TORAVON, DONE); - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_WHITEOUT); - } - } + void JustDied(Unit* ) + { + if (pInstance) + { + pInstance->SetData(EVENT_TORAVON, DONE); + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_WHITEOUT); + } + } - void JustSummoned(Creature* cr) - { - summons.Summon(cr); - } + void JustSummoned(Creature* cr) + { + summons.Summon(cr); + } void UpdateAI(uint32 diff) { @@ -116,37 +116,37 @@ class boss_toravon : public CreatureScript switch (events.GetEvent()) { - case EVENT_FREEZING_GROUND: + case EVENT_FREEZING_GROUND: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) - me->CastSpell(target, SPELL_FREEZING_GROUND, false); + me->CastSpell(target, SPELL_FREEZING_GROUND, false); events.RepeatEvent(20000); break; case EVENT_FROZEN_ORB_STALKER: me->CastCustomSpell(SPELL_FROZEN_ORB, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 3), me, false); events.RepeatEvent(35000); - events.ScheduleEvent(EVENT_CHECK_SUMMONS, 10000); + events.ScheduleEvent(EVENT_CHECK_SUMMONS, 10000); + break; + case EVENT_CHECK_SUMMONS: + for (SummonList::iterator i = summons.begin(); i != summons.end();) + { + if (Creature* cr = ObjectAccessor::GetCreature(*me, *i)) + { + if (!cr->IsAlive()) + summons.erase(i++); + else + ++i; + } + else + summons.erase(i++); + } + if (summons.empty()) + { + events.PopEvent(); + me->CastSpell(me, SPELL_WHITEOUT, false); + break; + } + events.RepeatEvent(2000); break; - case EVENT_CHECK_SUMMONS: - for (SummonList::iterator i = summons.begin(); i != summons.end();) - { - if (Creature* cr = ObjectAccessor::GetCreature(*me, *i)) - { - if (!cr->IsAlive()) - summons.erase(i++); - else - ++i; - } - else - summons.erase(i++); - } - if (summons.empty()) - { - events.PopEvent(); - me->CastSpell(me, SPELL_WHITEOUT, false); - break; - } - events.RepeatEvent(2000); - break; } DoMeleeAttackIfReady(); @@ -170,13 +170,13 @@ public: { } - uint32 switchTimer; + uint32 switchTimer; void Reset() { - switchTimer = 9000; - me->CastSpell(me, SPELL_FROZEN_ORB_AURA, true); - me->CastSpell(me, SPELL_FROZEN_ORB_DMG, true); + switchTimer = 9000; + me->CastSpell(me, SPELL_FROZEN_ORB_AURA, true); + me->CastSpell(me, SPELL_FROZEN_ORB_DMG, true); } void EnterCombat(Unit* /*who*/) @@ -186,14 +186,14 @@ public: void UpdateAI(uint32 diff) { - switchTimer += diff; - if (switchTimer >= 10000) - { - switchTimer = 0; - me->getThreatManager().resetAllAggro(); - if (Player* player = SelectTargetFromPlayerList(100.0f)) - me->AddThreat(player, 100000.0f); - } + switchTimer += diff; + if (switchTimer >= 10000) + { + switchTimer = 0; + me->getThreatManager().resetAllAggro(); + if (Player* player = SelectTargetFromPlayerList(100.0f)) + me->AddThreat(player, 100000.0f); + } } }; @@ -212,20 +212,20 @@ public: { npc_frozen_orb_stalkerAI(Creature* creature) : NullCreatureAI(creature) { - } + } - void Reset() - { - me->CastSpell(me, SPELL_FROZEN_ORB_STALKER_VISUAL, true); - } + void Reset() + { + me->CastSpell(me, SPELL_FROZEN_ORB_STALKER_VISUAL, true); + } - void JustSummoned(Creature* cr) - { - if (InstanceScript* pInstance = me->GetInstanceScript()) - if (Creature* toravon = ObjectAccessor::GetCreature(*me, pInstance->GetData64(EVENT_TORAVON))) - if (toravon->AI()) - toravon->AI()->JustSummoned(cr); - } + void JustSummoned(Creature* cr) + { + if (InstanceScript* pInstance = me->GetInstanceScript()) + if (Creature* toravon = ObjectAccessor::GetCreature(*me, pInstance->GetData64(EVENT_TORAVON))) + if (toravon->AI()) + toravon->AI()->JustSummoned(cr); + } }; CreatureAI* GetAI(Creature* creature) const @@ -239,5 +239,5 @@ void AddSC_boss_toravon() { new boss_toravon(); new npc_frozen_orb(); - new npc_frozen_orb_stalker(); + new npc_frozen_orb_stalker(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp index ebb2664ad..88ec14c32 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp @@ -43,101 +43,101 @@ class instance_vault_of_archavon : public InstanceMapScript void Initialize() { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - memset(&bossGUIDs, 0, sizeof(bossGUIDs)); + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + memset(&bossGUIDs, 0, sizeof(bossGUIDs)); ArchavonDeath = 0; EmalonDeath = 0; KoralonDeath = 0; - checkTimer = 0; - stoned = false; + checkTimer = 0; + stoned = false; } - void OnPlayerEnter(Player* ) - { - if (stoned) - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (Creature* cr = instance->GetCreature(bossGUIDs[i])) - if (!cr->IsInCombat()) - cr->RemoveAllAuras(); + void OnPlayerEnter(Player* ) + { + if (stoned) + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (Creature* cr = instance->GetCreature(bossGUIDs[i])) + if (!cr->IsInCombat()) + cr->RemoveAllAuras(); - stoned = false; - } - } + stoned = false; + } + } - void Update(uint32 diff) - { - checkTimer += diff; - if (checkTimer >= 60000) - { - checkTimer -= 60000; // one minute - if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG)) - { - if (!bf->IsWarTime()) - { - if (bf->GetTimer() <= (16 * MINUTE * IN_MILLISECONDS) && bf->GetTimer() >= (15 * MINUTE * IN_MILLISECONDS)) - { - Map::PlayerList const &PlayerList = instance->GetPlayers(); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* player = i->GetSource()) - player->MonsterTextEmote("This instance will reset in 15 minutes.", 0, true); - } - else if (bf->GetTimer() <= (10 * MINUTE * IN_MILLISECONDS) && bf->GetTimer() >= (9 * MINUTE * IN_MILLISECONDS)) - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (Creature* cr = instance->GetCreature(bossGUIDs[i])) - if (!cr->IsInCombat()) - { - cr->RemoveAllAuras(); - if (Aura* aur = cr->AddAura(SPELL_STONED_AURA, cr)) - { - aur->SetMaxDuration(60 * MINUTE* IN_MILLISECONDS); - aur->SetDuration(60 * MINUTE* IN_MILLISECONDS); - } - } + void Update(uint32 diff) + { + checkTimer += diff; + if (checkTimer >= 60000) + { + checkTimer -= 60000; // one minute + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG)) + { + if (!bf->IsWarTime()) + { + if (bf->GetTimer() <= (16 * MINUTE * IN_MILLISECONDS) && bf->GetTimer() >= (15 * MINUTE * IN_MILLISECONDS)) + { + Map::PlayerList const &PlayerList = instance->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* player = i->GetSource()) + player->MonsterTextEmote("This instance will reset in 15 minutes.", 0, true); + } + else if (bf->GetTimer() <= (10 * MINUTE * IN_MILLISECONDS) && bf->GetTimer() >= (9 * MINUTE * IN_MILLISECONDS)) + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (Creature* cr = instance->GetCreature(bossGUIDs[i])) + if (!cr->IsInCombat()) + { + cr->RemoveAllAuras(); + if (Aura* aur = cr->AddAura(SPELL_STONED_AURA, cr)) + { + aur->SetMaxDuration(60 * MINUTE* IN_MILLISECONDS); + aur->SetDuration(60 * MINUTE* IN_MILLISECONDS); + } + } - stoned = true; - } - else if (bf->GetTimer() <= (2 * MINUTE * IN_MILLISECONDS) && bf->GetTimer() > (MINUTE * IN_MILLISECONDS)) - { - Map::PlayerList const &PlayerList = instance->GetPlayers(); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* player = i->GetSource()) - player->MonsterTextEmote("This instance is about to reset. Prepare to be removed.", 0, true); - } - else if (bf->GetTimer() <= MINUTE * IN_MILLISECONDS) - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (Creature* cr = instance->GetCreature(bossGUIDs[i])) - if (cr->IsInCombat() && cr->AI()) - cr->AI()->EnterEvadeMode(); + stoned = true; + } + else if (bf->GetTimer() <= (2 * MINUTE * IN_MILLISECONDS) && bf->GetTimer() > (MINUTE * IN_MILLISECONDS)) + { + Map::PlayerList const &PlayerList = instance->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* player = i->GetSource()) + player->MonsterTextEmote("This instance is about to reset. Prepare to be removed.", 0, true); + } + else if (bf->GetTimer() <= MINUTE * IN_MILLISECONDS) + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (Creature* cr = instance->GetCreature(bossGUIDs[i])) + if (cr->IsInCombat() && cr->AI()) + cr->AI()->EnterEvadeMode(); - Map::PlayerList const &PlayerList = instance->GetPlayers(); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* player = i->GetSource()) - player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation()); - } - } - } - } - } + Map::PlayerList const &PlayerList = instance->GetPlayers(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* player = i->GetSource()) + player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation()); + } + } + } + } + } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + return true; - Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (!bf || bf->IsWarTime() || bf->GetTimer() <= 10 * MINUTE * IN_MILLISECONDS) - return true; + Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!bf || bf->IsWarTime() || bf->GetTimer() <= 10 * MINUTE * IN_MILLISECONDS) + return true; - return false; - } + return false; + } void OnCreatureCreate(Creature* creature) { @@ -146,13 +146,13 @@ class instance_vault_of_archavon : public InstanceMapScript case CREATURE_TORAVON: bossGUIDs[EVENT_TORAVON] = creature->GetGUID(); break; - case CREATURE_ARCHAVON: + case CREATURE_ARCHAVON: bossGUIDs[EVENT_ARCHAVON] = creature->GetGUID(); break; - case CREATURE_KORALON: + case CREATURE_KORALON: bossGUIDs[EVENT_KORALON] = creature->GetGUID(); break; - case CREATURE_EMALON: + case CREATURE_EMALON: bossGUIDs[EVENT_EMALON] = creature->GetGUID(); break; } @@ -165,47 +165,47 @@ class instance_vault_of_archavon : public InstanceMapScript return 0; } - uint32 GetData(uint32 identifier) const - { - if (identifier == DATA_STONED) - return (uint32)stoned; - return 0; - } + uint32 GetData(uint32 identifier) const + { + if (identifier == DATA_STONED) + return (uint32)stoned; + return 0; + } - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case EVENT_ARCHAVON: - case EVENT_EMALON: - case EVENT_KORALON: - case EVENT_TORAVON: - m_auiEncounter[type] = data; - break; - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case EVENT_ARCHAVON: + case EVENT_EMALON: + case EVENT_KORALON: + case EVENT_TORAVON: + m_auiEncounter[type] = data; + break; + } - if (data == DONE) - { - SaveToDB(); - switch (type) - { - case EVENT_ARCHAVON: - ArchavonDeath = time(NULL); - break; - case EVENT_EMALON: - EmalonDeath = time(NULL); - break; - case EVENT_KORALON: - KoralonDeath = time(NULL); - break; - default: - return; - } + if (data == DONE) + { + SaveToDB(); + switch (type) + { + case EVENT_ARCHAVON: + ArchavonDeath = time(NULL); + break; + case EVENT_EMALON: + EmalonDeath = time(NULL); + break; + case EVENT_KORALON: + KoralonDeath = time(NULL); + break; + default: + return; + } - // on every death of Archavon, Emalon and Koralon check our achievement - DoCastSpellOnPlayers(SPELL_EARTH_WIND_FIRE_ACHIEVEMENT_CHECK); - } - } + // on every death of Archavon, Emalon and Koralon check our achievement + DoCastSpellOnPlayers(SPELL_EARTH_WIND_FIRE_ACHIEVEMENT_CHECK); + } + } bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) { @@ -229,55 +229,55 @@ class instance_vault_of_archavon : public InstanceMapScript return false; } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "V O A " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; + std::ostringstream saveStream; + saveStream << "V O A " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2, dataHead3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> dataHead3; + char dataHead1, dataHead2, dataHead3; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> dataHead3; - if (dataHead1 == 'V' && dataHead2 == 'O' && dataHead3 == 'A') - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - loadStream >> m_auiEncounter[i]; - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } + if (dataHead1 == 'V' && dataHead2 == 'O' && dataHead3 == 'A') + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + loadStream >> m_auiEncounter[i]; + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } - OUT_LOAD_INST_DATA_COMPLETE; - } - else - OUT_LOAD_INST_DATA_FAIL; - } + OUT_LOAD_INST_DATA_COMPLETE; + } + else + OUT_LOAD_INST_DATA_FAIL; + } - private: - time_t ArchavonDeath; - time_t EmalonDeath; - time_t KoralonDeath; - uint32 checkTimer; - bool stoned; + private: + time_t ArchavonDeath; + time_t EmalonDeath; + time_t KoralonDeath; + uint32 checkTimer; + bool stoned; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 bossGUIDs[MAX_ENCOUNTER]; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint64 bossGUIDs[MAX_ENCOUNTER]; }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h b/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h index 7c89cf967..cd09aa970 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h +++ b/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h @@ -28,12 +28,12 @@ enum Creatures enum Data { - EVENT_ARCHAVON = 0, - EVENT_EMALON = 1, - EVENT_KORALON = 2, - EVENT_TORAVON = 3, - MAX_ENCOUNTER = 4, - DATA_STONED = 5, + EVENT_ARCHAVON = 0, + EVENT_EMALON = 1, + EVENT_KORALON = 2, + EVENT_TORAVON = 3, + MAX_ENCOUNTER = 4, + DATA_STONED = 5, }; @@ -46,7 +46,7 @@ enum AchievementCriteriaIds enum AchievementSpells { SPELL_EARTH_WIND_FIRE_ACHIEVEMENT_CHECK = 68308, - SPELL_STONED_AURA = 63080, + SPELL_STONED_AURA = 63080, }; #endif diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp index 35492ed80..710af5c2a 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp @@ -20,166 +20,166 @@ enum Yells enum eSpells { - SPELL_ARCANE_VACUUM = 58694, - SPELL_BLIZZARD_N = 58693, - SPELL_BLIZZARD_H = 59369, - SPELL_MANA_DESTRUCTION = 59374, - SPELL_TAIL_SWEEP_N = 58690, - SPELL_TAIL_SWEEP_H = 59283, - SPELL_UNCONTROLLABLE_ENERGY_N = 58688, - SPELL_UNCONTROLLABLE_ENERGY_H = 59281, + SPELL_ARCANE_VACUUM = 58694, + SPELL_BLIZZARD_N = 58693, + SPELL_BLIZZARD_H = 59369, + SPELL_MANA_DESTRUCTION = 59374, + SPELL_TAIL_SWEEP_N = 58690, + SPELL_TAIL_SWEEP_H = 59283, + SPELL_UNCONTROLLABLE_ENERGY_N = 58688, + SPELL_UNCONTROLLABLE_ENERGY_H = 59281, }; -#define SPELL_BLIZZARD DUNGEON_MODE(SPELL_BLIZZARD_N, SPELL_BLIZZARD_H) -#define SPELL_TAIL_SWEEP DUNGEON_MODE(SPELL_TAIL_SWEEP_N, SPELL_TAIL_SWEEP_H) -#define SPELL_UNCONTROLLABLE_ENERGY DUNGEON_MODE(SPELL_UNCONTROLLABLE_ENERGY_N, SPELL_UNCONTROLLABLE_ENERGY_H) +#define SPELL_BLIZZARD DUNGEON_MODE(SPELL_BLIZZARD_N, SPELL_BLIZZARD_H) +#define SPELL_TAIL_SWEEP DUNGEON_MODE(SPELL_TAIL_SWEEP_N, SPELL_TAIL_SWEEP_H) +#define SPELL_UNCONTROLLABLE_ENERGY DUNGEON_MODE(SPELL_UNCONTROLLABLE_ENERGY_N, SPELL_UNCONTROLLABLE_ENERGY_H) enum eEvents { - EVENT_SPELL_ARCANE_VACUUM = 1, - EVENT_SPELL_BLIZZARD, - EVENT_SPELL_MANA_DESTRUCTION, - EVENT_SPELL_TAIL_SWEEP, - EVENT_SPELL_UNCONTROLLABLE_ENERGY, - EVENT_UNROOT, + EVENT_SPELL_ARCANE_VACUUM = 1, + EVENT_SPELL_BLIZZARD, + EVENT_SPELL_MANA_DESTRUCTION, + EVENT_SPELL_TAIL_SWEEP, + EVENT_SPELL_UNCONTROLLABLE_ENERGY, + EVENT_UNROOT, }; class boss_cyanigosa : public CreatureScript { public: - boss_cyanigosa() : CreatureScript("boss_cyanigosa") { } + boss_cyanigosa() : CreatureScript("boss_cyanigosa") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_cyanigosaAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_cyanigosaAI (pCreature); + } - struct boss_cyanigosaAI : public ScriptedAI - { - boss_cyanigosaAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } + struct boss_cyanigosaAI : public ScriptedAI + { + boss_cyanigosaAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - DoZoneInCombat(); - Talk(SAY_AGGRO); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_ARCANE_VACUUM, 30000); - events.RescheduleEvent(EVENT_SPELL_BLIZZARD, urand(5000,10000)); - events.RescheduleEvent(EVENT_SPELL_TAIL_SWEEP, urand(15000,20000)); - events.RescheduleEvent(EVENT_SPELL_UNCONTROLLABLE_ENERGY, urand(5000,8000)); - if (IsHeroic()) - events.RescheduleEvent(EVENT_SPELL_MANA_DESTRUCTION, 20000); - } + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + Talk(SAY_AGGRO); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_ARCANE_VACUUM, 30000); + events.RescheduleEvent(EVENT_SPELL_BLIZZARD, urand(5000,10000)); + events.RescheduleEvent(EVENT_SPELL_TAIL_SWEEP, urand(15000,20000)); + events.RescheduleEvent(EVENT_SPELL_UNCONTROLLABLE_ENERGY, urand(5000,8000)); + if (IsHeroic()) + events.RescheduleEvent(EVENT_SPELL_MANA_DESTRUCTION, 20000); + } - void SpellHitTarget(Unit* target, const SpellInfo* spell) - { - if (!target || !spell) - return; - switch(spell->Id) - { - case SPELL_ARCANE_VACUUM: - target->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10.0f, target->GetOrientation()); - break; - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spell) + { + if (!target || !spell) + return; + switch(spell->Id) + { + case SPELL_ARCANE_VACUUM: + target->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10.0f, target->GetOrientation()); + break; + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_ARCANE_VACUUM: - me->CastSpell((Unit*)NULL, SPELL_ARCANE_VACUUM, false); - DoResetThreat(); - me->SetControlled(true, UNIT_STATE_ROOT); - me->setAttackTimer(BASE_ATTACK, 3000); - events.RepeatEvent(30000); - events.ScheduleEvent(EVENT_UNROOT, 3000); - break; - case EVENT_UNROOT: - me->SetControlled(false, UNIT_STATE_ROOT); - events.PopEvent(); - break; - case EVENT_SPELL_BLIZZARD: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) - me->CastSpell(target, SPELL_BLIZZARD, false); - events.RepeatEvent(15000); - break; - case EVENT_SPELL_MANA_DESTRUCTION: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, SPELL_MANA_DESTRUCTION, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_TAIL_SWEEP: - me->CastSpell(me->GetVictim(), SPELL_TAIL_SWEEP, false); - events.RepeatEvent(urand(15000,20000)); - break; - case EVENT_SPELL_UNCONTROLLABLE_ENERGY: - me->CastSpell(me->GetVictim(), SPELL_UNCONTROLLABLE_ENERGY, false); - events.RepeatEvent(urand(20000,25000)); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_ARCANE_VACUUM: + me->CastSpell((Unit*)NULL, SPELL_ARCANE_VACUUM, false); + DoResetThreat(); + me->SetControlled(true, UNIT_STATE_ROOT); + me->setAttackTimer(BASE_ATTACK, 3000); + events.RepeatEvent(30000); + events.ScheduleEvent(EVENT_UNROOT, 3000); + break; + case EVENT_UNROOT: + me->SetControlled(false, UNIT_STATE_ROOT); + events.PopEvent(); + break; + case EVENT_SPELL_BLIZZARD: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) + me->CastSpell(target, SPELL_BLIZZARD, false); + events.RepeatEvent(15000); + break; + case EVENT_SPELL_MANA_DESTRUCTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, SPELL_MANA_DESTRUCTION, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_TAIL_SWEEP: + me->CastSpell(me->GetVictim(), SPELL_TAIL_SWEEP, false); + events.RepeatEvent(urand(15000,20000)); + break; + case EVENT_SPELL_UNCONTROLLABLE_ENERGY: + me->CastSpell(me->GetVictim(), SPELL_UNCONTROLLABLE_ENERGY, false); + events.RepeatEvent(urand(20000,25000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_BOSS_DIED, 0); - float h = me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+2.0f); - if (h != INVALID_HEIGHT && me->GetPositionZ()-h > 3.0f) - { - me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), h, me->GetOrientation(), true); // move to ground - me->StopMovingOnCurrentPos(); - me->DestroyForNearbyPlayers(); - } - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(DATA_BOSS_DIED, 0); + float h = me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+2.0f); + if (h != INVALID_HEIGHT && me->GetPositionZ()-h > 3.0f) + { + me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), h, me->GetOrientation(), true); // move to ground + me->StopMovingOnCurrentPos(); + me->DestroyForNearbyPlayers(); + } + } - void KilledUnit(Unit* victim) - { - if (victim && victim->GetGUID() == me->GetGUID()) + void KilledUnit(Unit* victim) + { + if (victim && victim->GetGUID() == me->GetGUID()) return; Talk(SAY_SLAY); - } + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - ScriptedAI::EnterEvadeMode(); - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pInstance) - pInstance->SetData(DATA_FAILED, 1); - } - }; + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + ScriptedAI::EnterEvadeMode(); + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pInstance) + pInstance->SetData(DATA_FAILED, 1); + } + }; }; void AddSC_boss_cyanigosa() { - new boss_cyanigosa(); + new boss_cyanigosa(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index e2678e973..e5a31ff36 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -8,21 +8,21 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum eSpells { - SPELL_BLOODLUST = 54516, - SPELL_BREAK_BONDS = 59463, - SPELL_CHAIN_HEAL_N = 54481, - SPELL_CHAIN_HEAL_H = 59473, - SPELL_EARTH_SHIELD_N = 54479, - SPELL_EARTH_SHIELD_H = 59471, - //SPELL_EARTH_SHIELD_TRIGGERED_N = 54480, - //SPELL_EARTH_SHIELD_TRIGGERED_H = 59472, - SPELL_EARTH_SHOCK = 54511, - SPELL_LIGHTNING_BOLT = 53044, - SPELL_STORMSTRIKE = 51876, + SPELL_BLOODLUST = 54516, + SPELL_BREAK_BONDS = 59463, + SPELL_CHAIN_HEAL_N = 54481, + SPELL_CHAIN_HEAL_H = 59473, + SPELL_EARTH_SHIELD_N = 54479, + SPELL_EARTH_SHIELD_H = 59471, + //SPELL_EARTH_SHIELD_TRIGGERED_N = 54480, + //SPELL_EARTH_SHIELD_TRIGGERED_H = 59472, + SPELL_EARTH_SHOCK = 54511, + SPELL_LIGHTNING_BOLT = 53044, + SPELL_STORMSTRIKE = 51876, }; -#define SPELL_CHAIN_HEAL DUNGEON_MODE(SPELL_CHAIN_HEAL_N, SPELL_CHAIN_HEAL_H) -#define SPELL_EARTH_SHIELD DUNGEON_MODE(SPELL_EARTH_SHIELD_N, SPELL_EARTH_SHIELD_H) +#define SPELL_CHAIN_HEAL DUNGEON_MODE(SPELL_CHAIN_HEAL_N, SPELL_CHAIN_HEAL_H) +#define SPELL_EARTH_SHIELD DUNGEON_MODE(SPELL_EARTH_SHIELD_N, SPELL_EARTH_SHIELD_H) enum Yells { @@ -37,265 +37,265 @@ enum Yells enum eEvents { - EVENT_SPELL_BLOODLUST = 1, - EVENT_SPELL_BREAK_BONDS, - EVENT_SPELL_CHAIN_HEAL, - EVENT_SPELL_EARTH_SHIELD, - EVENT_SPELL_EARTH_SHOCK, - EVENT_SPELL_LIGHTNING_BOLT, - EVENT_SPELL_STORMSTRIKE, + EVENT_SPELL_BLOODLUST = 1, + EVENT_SPELL_BREAK_BONDS, + EVENT_SPELL_CHAIN_HEAL, + EVENT_SPELL_EARTH_SHIELD, + EVENT_SPELL_EARTH_SHOCK, + EVENT_SPELL_LIGHTNING_BOLT, + EVENT_SPELL_STORMSTRIKE, }; class boss_erekem : public CreatureScript { public: - boss_erekem() : CreatureScript("boss_erekem") { } + boss_erekem() : CreatureScript("boss_erekem") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_erekemAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_erekemAI (pCreature); + } - struct boss_erekemAI : public ScriptedAI - { - boss_erekemAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } + struct boss_erekemAI : public ScriptedAI + { + boss_erekemAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* who) - { - DoZoneInCombat(); - Talk(SAY_AGGRO); - DoCast(me, SPELL_EARTH_SHIELD); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_BLOODLUST, 15000); - events.RescheduleEvent(EVENT_SPELL_BREAK_BONDS, urand(9000,14000)); - events.RescheduleEvent(EVENT_SPELL_CHAIN_HEAL, 0); - events.RescheduleEvent(EVENT_SPELL_EARTH_SHIELD, 20000); - events.RescheduleEvent(EVENT_SPELL_EARTH_SHOCK, urand(2000,8000)); - events.RescheduleEvent(EVENT_SPELL_LIGHTNING_BOLT, urand(5000,10000)); - if (IsHeroic()) - events.RescheduleEvent(EVENT_SPELL_STORMSTRIKE, 3000); + void EnterCombat(Unit* who) + { + DoZoneInCombat(); + Talk(SAY_AGGRO); + DoCast(me, SPELL_EARTH_SHIELD); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_BLOODLUST, 15000); + events.RescheduleEvent(EVENT_SPELL_BREAK_BONDS, urand(9000,14000)); + events.RescheduleEvent(EVENT_SPELL_CHAIN_HEAL, 0); + events.RescheduleEvent(EVENT_SPELL_EARTH_SHIELD, 20000); + events.RescheduleEvent(EVENT_SPELL_EARTH_SHOCK, urand(2000,8000)); + events.RescheduleEvent(EVENT_SPELL_LIGHTNING_BOLT, urand(5000,10000)); + if (IsHeroic()) + events.RescheduleEvent(EVENT_SPELL_STORMSTRIKE, 3000); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID))) - if (!c->IsInCombat()) - c->AI()->AttackStart(who); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID))) - if (!c->IsInCombat()) - c->AI()->AttackStart(who); - } + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID))) + if (!c->IsInCombat()) + c->AI()->AttackStart(who); + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID))) + if (!c->IsInCombat()) + c->AI()->AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_BLOODLUST: - me->CastSpell((Unit*)NULL, SPELL_BLOODLUST, false); - events.RepeatEvent(urand(35000,45000)); - break; - case EVENT_SPELL_BREAK_BONDS: - me->CastSpell((Unit*)NULL, SPELL_BREAK_BONDS, false); - events.RepeatEvent(urand(16000,22000)); - break; - case EVENT_SPELL_CHAIN_HEAL: - if (uint64 TargetGUID = GetChainHealTargetGUID()) - if (pInstance) - { - if (Creature* target = pInstance->instance->GetCreature(TargetGUID)) - me->CastSpell(target, SPELL_CHAIN_HEAL, false); + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_BLOODLUST: + me->CastSpell((Unit*)NULL, SPELL_BLOODLUST, false); + events.RepeatEvent(urand(35000,45000)); + break; + case EVENT_SPELL_BREAK_BONDS: + me->CastSpell((Unit*)NULL, SPELL_BREAK_BONDS, false); + events.RepeatEvent(urand(16000,22000)); + break; + case EVENT_SPELL_CHAIN_HEAL: + if (uint64 TargetGUID = GetChainHealTargetGUID()) + if (pInstance) + { + if (Creature* target = pInstance->instance->GetCreature(TargetGUID)) + me->CastSpell(target, SPELL_CHAIN_HEAL, false); - Creature *pGuard1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID)); - Creature *pGuard2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID)); - if (pGuard1 && !pGuard1->IsAlive() || pGuard2 && !pGuard2->IsAlive()) - { - events.RepeatEvent(urand(3000,6000)); - break; - } - } - events.RepeatEvent(urand(8000,11000)); - break; - case EVENT_SPELL_EARTH_SHIELD: - me->CastSpell(me, SPELL_EARTH_SHIELD, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_EARTH_SHOCK: - me->CastSpell(me->GetVictim(), SPELL_EARTH_SHOCK, false); - events.RepeatEvent(urand(8000,13000)); - break; - case EVENT_SPELL_LIGHTNING_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true)) - me->CastSpell(target, SPELL_LIGHTNING_BOLT, false); - events.RepeatEvent(urand(15000,25000)); - break; - case EVENT_SPELL_STORMSTRIKE: - { - Creature *pGuard1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID)); - Creature *pGuard2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID)); - if (pGuard1 && !pGuard1->IsAlive() && pGuard2 && !pGuard2->IsAlive()) // both dead - me->CastSpell(me->GetVictim(), SPELL_STORMSTRIKE, false); - events.RepeatEvent(3000); - } - break; - } + Creature *pGuard1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID)); + Creature *pGuard2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID)); + if (pGuard1 && !pGuard1->IsAlive() || pGuard2 && !pGuard2->IsAlive()) + { + events.RepeatEvent(urand(3000,6000)); + break; + } + } + events.RepeatEvent(urand(8000,11000)); + break; + case EVENT_SPELL_EARTH_SHIELD: + me->CastSpell(me, SPELL_EARTH_SHIELD, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_EARTH_SHOCK: + me->CastSpell(me->GetVictim(), SPELL_EARTH_SHOCK, false); + events.RepeatEvent(urand(8000,13000)); + break; + case EVENT_SPELL_LIGHTNING_BOLT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true)) + me->CastSpell(target, SPELL_LIGHTNING_BOLT, false); + events.RepeatEvent(urand(15000,25000)); + break; + case EVENT_SPELL_STORMSTRIKE: + { + Creature *pGuard1 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID)); + Creature *pGuard2 = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID)); + if (pGuard1 && !pGuard1->IsAlive() && pGuard2 && !pGuard2->IsAlive()) // both dead + me->CastSpell(me->GetVictim(), SPELL_STORMSTRIKE, false); + events.RepeatEvent(3000); + } + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_BOSS_DIED, 0); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + if (pInstance) + pInstance->SetData(DATA_BOSS_DIED, 0); + } - void KilledUnit(Unit* victim) - { - if (victim && victim->GetGUID() == me->GetGUID()) - return; - Talk(SAY_SLAY); - } + void KilledUnit(Unit* victim) + { + if (victim && victim->GetGUID() == me->GetGUID()) + return; + Talk(SAY_SLAY); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pInstance) - pInstance->SetData(DATA_FAILED, 1); - } + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pInstance) + pInstance->SetData(DATA_FAILED, 1); + } - uint64 GetChainHealTargetGUID() - { - if (HealthBelowPct(85)) - return me->GetGUID(); + uint64 GetChainHealTargetGUID() + { + if (HealthBelowPct(85)) + return me->GetGUID(); - if (pInstance) - { - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID))) - if (c->IsAlive() && !c->HealthAbovePct(75)) - return c->GetGUID(); + if (pInstance) + { + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_1_GUID))) + if (c->IsAlive() && !c->HealthAbovePct(75)) + return c->GetGUID(); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID))) - if (c->IsAlive() && !c->HealthAbovePct(75)) - return c->GetGUID(); - } + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUARD_2_GUID))) + if (c->IsAlive() && !c->HealthAbovePct(75)) + return c->GetGUID(); + } - return me->GetGUID(); - } - }; + return me->GetGUID(); + } + }; }; enum GuardSpells { - SPELL_GUSHING_WOUND = 39215, - SPELL_HOWLING_SCREECH = 54462, - SPELL_STRIKE = 14516 + SPELL_GUSHING_WOUND = 39215, + SPELL_HOWLING_SCREECH = 54462, + SPELL_STRIKE = 14516 }; enum eGuardEvents { - EVENT_SPELL_GUSHING_WOUND = 1, - EVENT_SPELL_HOWLING_SCREECH, - EVENT_SPELL_STRIKE + EVENT_SPELL_GUSHING_WOUND = 1, + EVENT_SPELL_HOWLING_SCREECH, + EVENT_SPELL_STRIKE }; class npc_erekem_guard : public CreatureScript { public: - npc_erekem_guard() : CreatureScript("npc_erekem_guard") { } + npc_erekem_guard() : CreatureScript("npc_erekem_guard") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_erekem_guardAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_erekem_guardAI (pCreature); + } - struct npc_erekem_guardAI : public ScriptedAI - { - npc_erekem_guardAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } + struct npc_erekem_guardAI : public ScriptedAI + { + npc_erekem_guardAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* who) - { - DoZoneInCombat(); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_GUSHING_WOUND, urand(1000,3000)); - events.RescheduleEvent(EVENT_SPELL_HOWLING_SCREECH, urand(8000, 13000)); - events.RescheduleEvent(EVENT_SPELL_STRIKE, urand(4000, 8000)); + void EnterCombat(Unit* who) + { + DoZoneInCombat(); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_GUSHING_WOUND, urand(1000,3000)); + events.RescheduleEvent(EVENT_SPELL_HOWLING_SCREECH, urand(8000, 13000)); + events.RescheduleEvent(EVENT_SPELL_STRIKE, urand(4000, 8000)); - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUID))) - if (!c->IsInCombat()) - c->AI()->AttackStart(who); - } + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_EREKEM_GUID))) + if (!c->IsInCombat()) + c->AI()->AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_GUSHING_WOUND: - me->CastSpell(me->GetVictim(), SPELL_GUSHING_WOUND, false); - events.RepeatEvent(urand(7000,12000)); - break; - case EVENT_SPELL_HOWLING_SCREECH: - me->CastSpell(me->GetVictim(), SPELL_HOWLING_SCREECH, false); - events.RepeatEvent(urand(8000,13000)); - break; - case EVENT_SPELL_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_STRIKE, false); - events.RepeatEvent(urand(4000,8000)); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_GUSHING_WOUND: + me->CastSpell(me->GetVictim(), SPELL_GUSHING_WOUND, false); + events.RepeatEvent(urand(7000,12000)); + break; + case EVENT_SPELL_HOWLING_SCREECH: + me->CastSpell(me->GetVictim(), SPELL_HOWLING_SCREECH, false); + events.RepeatEvent(urand(8000,13000)); + break; + case EVENT_SPELL_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_STRIKE, false); + events.RepeatEvent(urand(4000,8000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void MoveInLineOfSight(Unit* /*who*/) {} - }; + void MoveInLineOfSight(Unit* /*who*/) {} + }; }; void AddSC_boss_erekem() { - new boss_erekem(); - new npc_erekem_guard(); + new boss_erekem(); + new npc_erekem_guard(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp index 4be61b2e2..2aec3b5fa 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp @@ -8,17 +8,17 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! #include "Player.h" #include "SpellInfo.h" -#define ACTION_WATER_ELEMENT_HIT 1 -#define ACTION_WATER_ELEMENT_KILLED 2 +#define ACTION_WATER_ELEMENT_HIT 1 +#define ACTION_WATER_ELEMENT_KILLED 2 #define MAX_SPAWN_LOC 5 static Position SpawnLoc[MAX_SPAWN_LOC]= { - {1840.64f, 795.407f, 44.079f, 1.676f}, - {1886.24f, 757.733f, 47.750f, 5.201f}, - {1877.91f, 845.915f, 43.417f, 3.560f}, - {1918.97f, 850.645f, 47.225f, 4.136f}, - {1935.50f, 796.224f, 52.492f, 4.224f}, + {1840.64f, 795.407f, 44.079f, 1.676f}, + {1886.24f, 757.733f, 47.750f, 5.201f}, + {1877.91f, 845.915f, 43.417f, 3.560f}, + {1918.97f, 850.645f, 47.225f, 4.136f}, + {1935.50f, 796.224f, 52.492f, 4.224f}, }; enum Yells @@ -34,261 +34,261 @@ enum Yells enum eCreatures { - NPC_ICHOR_GLOBULE = 29321, + NPC_ICHOR_GLOBULE = 29321, }; enum eSpells { - SPELL_DRAINED = 59820, - SPELL_FRENZY_N = 54312, - SPELL_FRENZY_H = 59522, - SPELL_PROTECTIVE_BUBBLE = 54306, - SPELL_WATER_BLAST_N = 54237, - SPELL_WATER_BLAST_H = 59520, - SPELL_WATER_BOLT_VOLLEY_N = 54241, - SPELL_WATER_BOLT_VOLLEY_H = 59521, + SPELL_DRAINED = 59820, + SPELL_FRENZY_N = 54312, + SPELL_FRENZY_H = 59522, + SPELL_PROTECTIVE_BUBBLE = 54306, + SPELL_WATER_BLAST_N = 54237, + SPELL_WATER_BLAST_H = 59520, + SPELL_WATER_BOLT_VOLLEY_N = 54241, + SPELL_WATER_BOLT_VOLLEY_H = 59521, - SPELL_SPLASH = 59516, // casted by globule upon death - SPELL_WATER_GLOBULE = 54268, // casted when hit by visual - SPELL_CREATE_GLOBULE_VISUAL = 54260, // tar 25 + SPELL_SPLASH = 59516, // casted by globule upon death + SPELL_WATER_GLOBULE = 54268, // casted when hit by visual + SPELL_CREATE_GLOBULE_VISUAL = 54260, // tar 25 }; -#define SPELL_WATER_BLAST DUNGEON_MODE(SPELL_WATER_BLAST_N, SPELL_WATER_BLAST_H) -#define SPELL_WATER_BOLT_VOLLEY DUNGEON_MODE(SPELL_WATER_BOLT_VOLLEY_N, SPELL_WATER_BOLT_VOLLEY_H) -#define SPELL_FRENZY DUNGEON_MODE(SPELL_FRENZY_N, SPELL_FRENZY_H) +#define SPELL_WATER_BLAST DUNGEON_MODE(SPELL_WATER_BLAST_N, SPELL_WATER_BLAST_H) +#define SPELL_WATER_BOLT_VOLLEY DUNGEON_MODE(SPELL_WATER_BOLT_VOLLEY_N, SPELL_WATER_BOLT_VOLLEY_H) +#define SPELL_FRENZY DUNGEON_MODE(SPELL_FRENZY_N, SPELL_FRENZY_H) enum eEvents { - EVENT_SPELL_WATER_BOLT_VOLLEY = 1, + EVENT_SPELL_WATER_BOLT_VOLLEY = 1, }; class boss_ichoron : public CreatureScript { public: - boss_ichoron() : CreatureScript("boss_ichoron") { } + boss_ichoron() : CreatureScript("boss_ichoron") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_ichoronAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_ichoronAI (pCreature); + } - struct boss_ichoronAI : public ScriptedAI - { - boss_ichoronAI(Creature *c) : ScriptedAI(c), globules(me) - { - pInstance = c->GetInstanceScript(); - } + struct boss_ichoronAI : public ScriptedAI + { + boss_ichoronAI(Creature *c) : ScriptedAI(c), globules(me) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - SummonList globules; - bool bIsExploded; - bool bIsFrenzy; - uint32 uiWaterBoltVolleyTimer; - uint32 uiDrainedTimer; + InstanceScript* pInstance; + SummonList globules; + bool bIsExploded; + bool bIsFrenzy; + uint32 uiWaterBoltVolleyTimer; + uint32 uiDrainedTimer; - void Reset() - { - globules.DespawnAll(); - bIsExploded = false; - bIsFrenzy = false; - uiDrainedTimer = 15000; - uiWaterBoltVolleyTimer = urand(7000,12000); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(me->GetNativeDisplayId()); - } + void Reset() + { + globules.DespawnAll(); + bIsExploded = false; + bIsFrenzy = false; + uiDrainedTimer = 15000; + uiWaterBoltVolleyTimer = urand(7000,12000); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(me->GetNativeDisplayId()); + } - void DoAction(int32 param) - { - if (!me->IsAlive()) - return; + void DoAction(int32 param) + { + if (!me->IsAlive()) + return; - switch(param) - { - case ACTION_WATER_ELEMENT_HIT: - if (pInstance) - pInstance->SetData(DATA_ACHIEV, 0); - me->ModifyHealth(int32(me->CountPctFromMaxHealth(1))); - if (bIsExploded) - DoExplodeCompleted(); - break; - case ACTION_WATER_ELEMENT_KILLED: - uint32 damage = me->CountPctFromMaxHealth(3); - damage = std::min(damage, me->GetHealth()-1); - me->ModifyHealth(-int32(damage)); - me->LowerPlayerDamageReq(damage); - break; - } - } + switch(param) + { + case ACTION_WATER_ELEMENT_HIT: + if (pInstance) + pInstance->SetData(DATA_ACHIEV, 0); + me->ModifyHealth(int32(me->CountPctFromMaxHealth(1))); + if (bIsExploded) + DoExplodeCompleted(); + break; + case ACTION_WATER_ELEMENT_KILLED: + uint32 damage = me->CountPctFromMaxHealth(3); + damage = std::min(damage, me->GetHealth()-1); + me->ModifyHealth(-int32(damage)); + me->LowerPlayerDamageReq(damage); + break; + } + } - void DoExplodeCompleted() - { - bIsExploded = false; - me->RemoveAura(SPELL_DRAINED); - if (!HealthBelowPct(25)) - { - Talk(SAY_BUBBLE); - me->CastSpell(me, SPELL_PROTECTIVE_BUBBLE, true); - } + void DoExplodeCompleted() + { + bIsExploded = false; + me->RemoveAura(SPELL_DRAINED); + if (!HealthBelowPct(25)) + { + Talk(SAY_BUBBLE); + me->CastSpell(me, SPELL_PROTECTIVE_BUBBLE, true); + } - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(me->GetNativeDisplayId()); - } + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(me->GetNativeDisplayId()); + } - void IchoronDoCastToAllHostilePlayers(uint32 spellId, bool triggered) - { - Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); - if (PlayerList.isEmpty()) - return; + void IchoronDoCastToAllHostilePlayers(uint32 spellId, bool triggered) + { + Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); + if (PlayerList.isEmpty()) + return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player *plr = i->GetSource()) - me->CastSpell(plr, spellId, triggered); - } + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player *plr = i->GetSource()) + me->CastSpell(plr, spellId, triggered); + } - void EnterCombat(Unit* /*who*/) - { - bIsExploded = false; - bIsFrenzy = false; - uiDrainedTimer = 15000; - uiWaterBoltVolleyTimer = urand(7000,12000); - DoZoneInCombat(); - Talk(SAY_AGGRO); - me->CastSpell(me, SPELL_PROTECTIVE_BUBBLE, true); - if (pInstance) - pInstance->SetData(DATA_ACHIEV, 1); - } + void EnterCombat(Unit* /*who*/) + { + bIsExploded = false; + bIsFrenzy = false; + uiDrainedTimer = 15000; + uiWaterBoltVolleyTimer = urand(7000,12000); + DoZoneInCombat(); + Talk(SAY_AGGRO); + me->CastSpell(me, SPELL_PROTECTIVE_BUBBLE, true); + if (pInstance) + pInstance->SetData(DATA_ACHIEV, 1); + } - void UpdateAI(uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 uiDiff) + { + if (!UpdateVictim()) + return; - if (!bIsFrenzy && !bIsExploded && HealthBelowPct(25)) - { - Talk(SAY_ENRAGE); - me->CastSpell(me, SPELL_FRENZY, true); - bIsFrenzy = true; - } + if (!bIsFrenzy && !bIsExploded && HealthBelowPct(25)) + { + Talk(SAY_ENRAGE); + me->CastSpell(me, SPELL_FRENZY, true); + bIsFrenzy = true; + } - if (!bIsFrenzy) - { - if (!bIsExploded) - { - if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE)) - { - me->InterruptNonMeleeSpells(false); - Talk(SAY_SHATTER); - DoZoneInCombat(); - IchoronDoCastToAllHostilePlayers(SPELL_WATER_BLAST, true); - me->CastSpell(me, SPELL_DRAINED, true); - bIsExploded = true; - uiDrainedTimer = 15000; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(11686); - for (uint8 i=0; iHasAura(SPELL_PROTECTIVE_BUBBLE)) + { + me->InterruptNonMeleeSpells(false); + Talk(SAY_SHATTER); + DoZoneInCombat(); + IchoronDoCastToAllHostilePlayers(SPELL_WATER_BLAST, true); + me->CastSpell(me, SPELL_DRAINED, true); + bIsExploded = true; + uiDrainedTimer = 15000; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11686); + for (uint8 i=0; i::const_iterator itr = globules.begin(); itr != globules.end(); ++itr) - if (Creature* pTemp = ObjectAccessor::GetCreature(*me, *itr)) - if (pTemp->IsAlive()) - { - bIsWaterElementsAlive = true; - break; - } - } + bool bIsWaterElementsAlive = false; + if (!globules.empty()) + { + for (std::list::const_iterator itr = globules.begin(); itr != globules.end(); ++itr) + if (Creature* pTemp = ObjectAccessor::GetCreature(*me, *itr)) + if (pTemp->IsAlive()) + { + bIsWaterElementsAlive = true; + break; + } + } - if (!bIsWaterElementsAlive) - DoExplodeCompleted(); - } - } - } + if (!bIsWaterElementsAlive) + DoExplodeCompleted(); + } + } + } - if (!bIsExploded) - { - if (uiWaterBoltVolleyTimer <= uiDiff) - { - me->CastSpell((Unit*)NULL, SPELL_WATER_BOLT_VOLLEY, false); - uiWaterBoltVolleyTimer = urand(10000, 15000); - } - else uiWaterBoltVolleyTimer -= uiDiff; - } + if (!bIsExploded) + { + if (uiWaterBoltVolleyTimer <= uiDiff) + { + me->CastSpell((Unit*)NULL, SPELL_WATER_BOLT_VOLLEY, false); + uiWaterBoltVolleyTimer = urand(10000, 15000); + } + else uiWaterBoltVolleyTimer -= uiDiff; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustSummoned(Creature* pSummoned) - { - if (pSummoned) - { - pSummoned->SetSpeed(MOVE_RUN, 0.3f); - pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pSummoned->GetMotionMaster()->MoveFollow(me, 0, 0); - me->CastSpell(pSummoned, SPELL_CREATE_GLOBULE_VISUAL, true); // triggered should ignore los - globules.Summon(pSummoned); - if (pInstance) - pInstance->SetData64(DATA_ADD_TRASH_MOB, pSummoned->GetGUID()); - } - } + void JustSummoned(Creature* pSummoned) + { + if (pSummoned) + { + pSummoned->SetSpeed(MOVE_RUN, 0.3f); + pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pSummoned->GetMotionMaster()->MoveFollow(me, 0, 0); + me->CastSpell(pSummoned, SPELL_CREATE_GLOBULE_VISUAL, true); // triggered should ignore los + globules.Summon(pSummoned); + if (pInstance) + pInstance->SetData64(DATA_ADD_TRASH_MOB, pSummoned->GetGUID()); + } + } - void SummonedCreatureDespawn(Creature *pSummoned) - { - if (pSummoned) - { - globules.Despawn(pSummoned); - if (pInstance) - pInstance->SetData64(DATA_DELETE_TRASH_MOB, pSummoned->GetGUID()); - } - } + void SummonedCreatureDespawn(Creature *pSummoned) + { + if (pSummoned) + { + globules.Despawn(pSummoned); + if (pInstance) + pInstance->SetData64(DATA_DELETE_TRASH_MOB, pSummoned->GetGUID()); + } + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - bIsExploded = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(me->GetNativeDisplayId()); - globules.DespawnAll(); - if (pInstance) - pInstance->SetData(DATA_BOSS_DIED, 0); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + bIsExploded = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(me->GetNativeDisplayId()); + globules.DespawnAll(); + if (pInstance) + pInstance->SetData(DATA_BOSS_DIED, 0); + } - void KilledUnit(Unit * victim) - { - if (victim && victim->GetGUID() == me->GetGUID()) - return; - Talk(SAY_SLAY); - } + void KilledUnit(Unit * victim) + { + if (victim && victim->GetGUID() == me->GetGUID()) + return; + Talk(SAY_SLAY); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pInstance) - pInstance->SetData(DATA_FAILED, 1); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pInstance) + pInstance->SetData(DATA_FAILED, 1); + } + }; }; @@ -296,64 +296,64 @@ public: class npc_ichor_globule : public CreatureScript { public: - npc_ichor_globule() : CreatureScript("npc_ichor_globule") { } + npc_ichor_globule() : CreatureScript("npc_ichor_globule") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ichor_globuleAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ichor_globuleAI (pCreature); + } - struct npc_ichor_globuleAI : public ScriptedAI - { - npc_ichor_globuleAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - uiRangeCheck_Timer = 1000; - } + struct npc_ichor_globuleAI : public ScriptedAI + { + npc_ichor_globuleAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + uiRangeCheck_Timer = 1000; + } - InstanceScript* pInstance; - uint32 uiRangeCheck_Timer; + InstanceScript* pInstance; + uint32 uiRangeCheck_Timer; - void SpellHit(Unit* caster, const SpellInfo* spell) - { - if (spell->Id == SPELL_CREATE_GLOBULE_VISUAL) - me->CastSpell(me, SPELL_WATER_GLOBULE, true); - } + void SpellHit(Unit* caster, const SpellInfo* spell) + { + if (spell->Id == SPELL_CREATE_GLOBULE_VISUAL) + me->CastSpell(me, SPELL_WATER_GLOBULE, true); + } - void UpdateAI(uint32 uiDiff) - { - if (uiRangeCheck_Timer < uiDiff) - { - if (pInstance) - if (Creature* pIchoron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_ICHORON_GUID))) - if (me->IsWithinDist(pIchoron, 2.0f , false)) - { - if (pIchoron->AI()) - pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_HIT); - me->DespawnOrUnsummon(); - } - uiRangeCheck_Timer = 1000; - } - else uiRangeCheck_Timer -= uiDiff; - } + void UpdateAI(uint32 uiDiff) + { + if (uiRangeCheck_Timer < uiDiff) + { + if (pInstance) + if (Creature* pIchoron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_ICHORON_GUID))) + if (me->IsWithinDist(pIchoron, 2.0f , false)) + { + if (pIchoron->AI()) + pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_HIT); + me->DespawnOrUnsummon(); + } + uiRangeCheck_Timer = 1000; + } + else uiRangeCheck_Timer -= uiDiff; + } - void JustDied(Unit* /*killer*/) - { - me->CastSpell(me, SPELL_SPLASH, true); - if (pInstance) - if (Creature* pIchoron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_ICHORON_GUID))) - if (pIchoron->AI()) - pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED); - me->DespawnOrUnsummon(2500); - } + void JustDied(Unit* /*killer*/) + { + me->CastSpell(me, SPELL_SPLASH, true); + if (pInstance) + if (Creature* pIchoron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_ICHORON_GUID))) + if (pIchoron->AI()) + pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED); + me->DespawnOrUnsummon(2500); + } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - }; + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + }; }; void AddSC_boss_ichoron() { - new boss_ichoron(); - new npc_ichor_globule(); + new boss_ichoron(); + new npc_ichor_globule(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp index d7ef42a09..99fe854c3 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp @@ -8,117 +8,117 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum eSpells { - SPELL_CAUTERIZING_FLAMES = 59466, - SPELL_FIREBOLT_N = 54235, - SPELL_FIREBOLT_H = 59468, - SPELL_FLAME_BREATH_N = 54282, - SPELL_FLAME_BREATH_H = 59469, - SPELL_LAVA_BURN_N = 54249, - SPELL_LAVA_BURN_H = 59594, + SPELL_CAUTERIZING_FLAMES = 59466, + SPELL_FIREBOLT_N = 54235, + SPELL_FIREBOLT_H = 59468, + SPELL_FLAME_BREATH_N = 54282, + SPELL_FLAME_BREATH_H = 59469, + SPELL_LAVA_BURN_N = 54249, + SPELL_LAVA_BURN_H = 59594, }; -#define SPELL_FIREBOLT DUNGEON_MODE(SPELL_FIREBOLT_N, SPELL_FIREBOLT_H) -#define SPELL_FLAME_BREATH DUNGEON_MODE(SPELL_FLAME_BREATH_N, SPELL_FLAME_BREATH_H) -#define SPELL_LAVA_BURN DUNGEON_MODE(SPELL_LAVA_BURN_N, SPELL_LAVA_BURN_H) +#define SPELL_FIREBOLT DUNGEON_MODE(SPELL_FIREBOLT_N, SPELL_FIREBOLT_H) +#define SPELL_FLAME_BREATH DUNGEON_MODE(SPELL_FLAME_BREATH_N, SPELL_FLAME_BREATH_H) +#define SPELL_LAVA_BURN DUNGEON_MODE(SPELL_LAVA_BURN_N, SPELL_LAVA_BURN_H) enum eEvents { - EVENT_SPELL_FIREBOLT = 1, - EVENT_SPELL_FLAME_BREATH, - EVENT_SPELL_LAVA_BURN, - EVENT_SPELL_CAUTERIZING_FLAMES, + EVENT_SPELL_FIREBOLT = 1, + EVENT_SPELL_FLAME_BREATH, + EVENT_SPELL_LAVA_BURN, + EVENT_SPELL_CAUTERIZING_FLAMES, }; class boss_lavanthor : public CreatureScript { public: - boss_lavanthor() : CreatureScript("boss_lavanthor") { } + boss_lavanthor() : CreatureScript("boss_lavanthor") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_lavanthorAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_lavanthorAI (pCreature); + } - struct boss_lavanthorAI : public ScriptedAI - { - boss_lavanthorAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } + struct boss_lavanthorAI : public ScriptedAI + { + boss_lavanthorAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - DoZoneInCombat(); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_FIREBOLT, 1000); - events.RescheduleEvent(EVENT_SPELL_FLAME_BREATH, 5000); - events.RescheduleEvent(EVENT_SPELL_LAVA_BURN, 10000); - if (IsHeroic()) - events.RescheduleEvent(EVENT_SPELL_CAUTERIZING_FLAMES, 3000); - } + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_FIREBOLT, 1000); + events.RescheduleEvent(EVENT_SPELL_FLAME_BREATH, 5000); + events.RescheduleEvent(EVENT_SPELL_LAVA_BURN, 10000); + if (IsHeroic()) + events.RescheduleEvent(EVENT_SPELL_CAUTERIZING_FLAMES, 3000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_FIREBOLT: - me->CastSpell(me->GetVictim(), SPELL_FIREBOLT, false); - events.RepeatEvent(urand(5000,13000)); - break; - case EVENT_SPELL_FLAME_BREATH: - me->CastSpell(me->GetVictim(), SPELL_FLAME_BREATH, false); - events.RepeatEvent(urand(10000,15000)); - break; - case EVENT_SPELL_LAVA_BURN: - me->CastSpell(me->GetVictim(), SPELL_LAVA_BURN, false); - events.RepeatEvent(urand(14000,20000)); - break; - case EVENT_SPELL_CAUTERIZING_FLAMES: - me->CastSpell((Unit*)NULL, SPELL_FLAME_BREATH, false); - events.RepeatEvent(urand(10000,16000)); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_FIREBOLT: + me->CastSpell(me->GetVictim(), SPELL_FIREBOLT, false); + events.RepeatEvent(urand(5000,13000)); + break; + case EVENT_SPELL_FLAME_BREATH: + me->CastSpell(me->GetVictim(), SPELL_FLAME_BREATH, false); + events.RepeatEvent(urand(10000,15000)); + break; + case EVENT_SPELL_LAVA_BURN: + me->CastSpell(me->GetVictim(), SPELL_LAVA_BURN, false); + events.RepeatEvent(urand(14000,20000)); + break; + case EVENT_SPELL_CAUTERIZING_FLAMES: + me->CastSpell((Unit*)NULL, SPELL_FLAME_BREATH, false); + events.RepeatEvent(urand(10000,16000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_BOSS_DIED, 0); - } + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_BOSS_DIED, 0); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pInstance) - pInstance->SetData(DATA_FAILED, 1); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pInstance) + pInstance->SetData(DATA_FAILED, 1); + } + }; }; void AddSC_boss_lavanthor() { - new boss_lavanthor(); + new boss_lavanthor(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp index 73e38fe72..e5f73d24b 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp @@ -10,145 +10,145 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum eSpells { - SPELL_RAY_OF_SUFFERING_N = 54442, - SPELL_RAY_OF_SUFFERING_H = 59524, - //SPELL_RAY_OF_SUFFERING_TRIGGERED = 54417, + SPELL_RAY_OF_SUFFERING_N = 54442, + SPELL_RAY_OF_SUFFERING_H = 59524, + //SPELL_RAY_OF_SUFFERING_TRIGGERED = 54417, - SPELL_RAY_OF_PAIN_N = 54438, - SPELL_RAY_OF_PAIN_H = 59523, - //SPELL_RAY_OF_PAIN_TRIGGERED_N = 54416, - //SPELL_RAY_OF_PAIN_TRIGGERED_H = 59525, + SPELL_RAY_OF_PAIN_N = 54438, + SPELL_RAY_OF_PAIN_H = 59523, + //SPELL_RAY_OF_PAIN_TRIGGERED_N = 54416, + //SPELL_RAY_OF_PAIN_TRIGGERED_H = 59525, - SPELL_CORROSIVE_SALIVA = 54527, - SPELL_OPTIC_LINK = 54396, + SPELL_CORROSIVE_SALIVA = 54527, + SPELL_OPTIC_LINK = 54396, }; -#define SPELL_RAY_OF_SUFFERING DUNGEON_MODE(SPELL_RAY_OF_SUFFERING_N, SPELL_RAY_OF_SUFFERING_H) -#define SPELL_RAY_OF_PAIN DUNGEON_MODE(SPELL_RAY_OF_PAIN_N, SPELL_RAY_OF_PAIN_H) +#define SPELL_RAY_OF_SUFFERING DUNGEON_MODE(SPELL_RAY_OF_SUFFERING_N, SPELL_RAY_OF_SUFFERING_H) +#define SPELL_RAY_OF_PAIN DUNGEON_MODE(SPELL_RAY_OF_PAIN_N, SPELL_RAY_OF_PAIN_H) enum eEvents { - EVENT_SPELL_CORROSIVE_SALIVA = 1, - EVENT_SPELL_OPTIC_LINK, + EVENT_SPELL_CORROSIVE_SALIVA = 1, + EVENT_SPELL_OPTIC_LINK, }; class boss_moragg : public CreatureScript { public: - boss_moragg() : CreatureScript("boss_moragg") { } + boss_moragg() : CreatureScript("boss_moragg") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_moraggAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_moraggAI (pCreature); + } - struct boss_moraggAI : public ScriptedAI - { - boss_moraggAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceScript(); - } + struct boss_moraggAI : public ScriptedAI + { + boss_moraggAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; + InstanceScript* pInstance; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - DoZoneInCombat(); - me->CastSpell(me, SPELL_RAY_OF_SUFFERING, true); - me->CastSpell(me, SPELL_RAY_OF_PAIN, true); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_CORROSIVE_SALIVA, urand(4000,6000)); - events.RescheduleEvent(EVENT_SPELL_OPTIC_LINK, urand(10000,11000)); - } + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + me->CastSpell(me, SPELL_RAY_OF_SUFFERING, true); + me->CastSpell(me, SPELL_RAY_OF_PAIN, true); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_CORROSIVE_SALIVA, urand(4000,6000)); + events.RescheduleEvent(EVENT_SPELL_OPTIC_LINK, urand(10000,11000)); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_CORROSIVE_SALIVA: - me->CastSpell(me->GetVictim(), SPELL_CORROSIVE_SALIVA, false); - events.RepeatEvent(urand(8000,10000)); - break; - case EVENT_SPELL_OPTIC_LINK: - if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 40.0f, true)) - { - me->CastSpell(target, SPELL_OPTIC_LINK, false); - events.RepeatEvent(urand(18000,21000)); - } - else - events.RepeatEvent(5000); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_CORROSIVE_SALIVA: + me->CastSpell(me->GetVictim(), SPELL_CORROSIVE_SALIVA, false); + events.RepeatEvent(urand(8000,10000)); + break; + case EVENT_SPELL_OPTIC_LINK: + if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 40.0f, true)) + { + me->CastSpell(target, SPELL_OPTIC_LINK, false); + events.RepeatEvent(urand(18000,21000)); + } + else + events.RepeatEvent(5000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_BOSS_DIED, 0); - } + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_BOSS_DIED, 0); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pInstance) - pInstance->SetData(DATA_FAILED, 1); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pInstance) + pInstance->SetData(DATA_FAILED, 1); + } + }; }; class spell_optic_link : public SpellScriptLoader { public: - spell_optic_link() : SpellScriptLoader("spell_optic_link") { } + spell_optic_link() : SpellScriptLoader("spell_optic_link") { } - class spell_optic_linkAuraScript : public AuraScript - { - PrepareAuraScript(spell_optic_linkAuraScript) + class spell_optic_linkAuraScript : public AuraScript + { + PrepareAuraScript(spell_optic_linkAuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - if (Unit* target = GetTarget()) - if (Unit* caster = GetCaster()) - if (GetAura() && GetAura()->GetEffect(0)) - GetAura()->GetEffect(0)->SetAmount(aurEff->GetSpellInfo()->Effects[EFFECT_0].BasePoints+(((int32)target->GetExactDist(caster))*25)+(aurEff->GetTickNumber()*100)); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + if (Unit* target = GetTarget()) + if (Unit* caster = GetCaster()) + if (GetAura() && GetAura()->GetEffect(0)) + GetAura()->GetEffect(0)->SetAmount(aurEff->GetSpellInfo()->Effects[EFFECT_0].BasePoints+(((int32)target->GetExactDist(caster))*25)+(aurEff->GetTickNumber()*100)); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_optic_linkAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_optic_linkAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_optic_linkAuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_optic_linkAuraScript(); + } }; void AddSC_boss_moragg() { - new boss_moragg(); - new spell_optic_link(); + new boss_moragg(); + new spell_optic_link(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index 332ffe673..e3fe75866 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -19,165 +19,165 @@ enum Yells enum eSpells { - SPELL_ARCANE_BARRAGE_VOLLEY_N = 54202, - SPELL_ARCANE_BARRAGE_VOLLEY_H = 59483, - SPELL_ARCANE_BUFFET_N = 54226, - SPELL_ARCANE_BUFFET_H = 59485, - SPELL_SUMMON_ETHEREAL_SPHERE_1 = 54102, - SPELL_SUMMON_ETHEREAL_SPHERE_2 = 54137, - SPELL_SUMMON_ETHEREAL_SPHERE_3 = 54138, + SPELL_ARCANE_BARRAGE_VOLLEY_N = 54202, + SPELL_ARCANE_BARRAGE_VOLLEY_H = 59483, + SPELL_ARCANE_BUFFET_N = 54226, + SPELL_ARCANE_BUFFET_H = 59485, + SPELL_SUMMON_ETHEREAL_SPHERE_1 = 54102, + SPELL_SUMMON_ETHEREAL_SPHERE_2 = 54137, + SPELL_SUMMON_ETHEREAL_SPHERE_3 = 54138, - SPELL_ARCANE_POWER_N = 54160, - SPELL_ARCANE_POWER_H = 59474, - //SPELL_SUMMON_PLAYERS = 54164, // not used - //SPELL_POWER_BALL_VISUAL = 54141, + SPELL_ARCANE_POWER_N = 54160, + SPELL_ARCANE_POWER_H = 59474, + //SPELL_SUMMON_PLAYERS = 54164, // not used + //SPELL_POWER_BALL_VISUAL = 54141, }; -#define SPELL_ARCANE_BARRAGE_VOLLEY DUNGEON_MODE(SPELL_ARCANE_BARRAGE_VOLLEY_N, SPELL_ARCANE_BARRAGE_VOLLEY_H) -#define SPELL_ARCANE_BUFFET DUNGEON_MODE(SPELL_ARCANE_BUFFET_N, SPELL_ARCANE_BUFFET_H) -#define SPELL_ARCANE_POWER DUNGEON_MODE(SPELL_ARCANE_POWER_N, SPELL_ARCANE_POWER_H) +#define SPELL_ARCANE_BARRAGE_VOLLEY DUNGEON_MODE(SPELL_ARCANE_BARRAGE_VOLLEY_N, SPELL_ARCANE_BARRAGE_VOLLEY_H) +#define SPELL_ARCANE_BUFFET DUNGEON_MODE(SPELL_ARCANE_BUFFET_N, SPELL_ARCANE_BUFFET_H) +#define SPELL_ARCANE_POWER DUNGEON_MODE(SPELL_ARCANE_POWER_N, SPELL_ARCANE_POWER_H) enum eEvents { - EVENT_SPELL_ARCANE_BARRAGE_VOLLEY = 1, - EVENT_SPELL_ARCANE_BUFFET, - EVENT_SUMMON_SPHERES, - EVENT_CHECK_DISTANCE, + EVENT_SPELL_ARCANE_BARRAGE_VOLLEY = 1, + EVENT_SPELL_ARCANE_BUFFET, + EVENT_SUMMON_SPHERES, + EVENT_CHECK_DISTANCE, }; class boss_xevozz : public CreatureScript { public: - boss_xevozz() : CreatureScript("boss_xevozz") { } + boss_xevozz() : CreatureScript("boss_xevozz") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_xevozzAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_xevozzAI (pCreature); + } - struct boss_xevozzAI : public ScriptedAI - { - boss_xevozzAI(Creature *c) : ScriptedAI(c), spheres(me) - { - pInstance = c->GetInstanceScript(); - } + struct boss_xevozzAI : public ScriptedAI + { + boss_xevozzAI(Creature *c) : ScriptedAI(c), spheres(me) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList spheres; + InstanceScript* pInstance; + EventMap events; + SummonList spheres; - void Reset() - { - events.Reset(); - spheres.DespawnAll(); - } + void Reset() + { + events.Reset(); + spheres.DespawnAll(); + } - void EnterCombat(Unit* /*who*/) - { - Talk(SAY_AGGRO); - DoZoneInCombat(); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_ARCANE_BARRAGE_VOLLEY, urand(16000,20000)); - events.RescheduleEvent(EVENT_SUMMON_SPHERES, 10000); - } + void EnterCombat(Unit* /*who*/) + { + Talk(SAY_AGGRO); + DoZoneInCombat(); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_ARCANE_BARRAGE_VOLLEY, urand(16000,20000)); + events.RescheduleEvent(EVENT_SUMMON_SPHERES, 10000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_ARCANE_BARRAGE_VOLLEY: - me->CastSpell((Unit*)NULL, SPELL_ARCANE_BARRAGE_VOLLEY, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_ARCANE_BUFFET: - me->CastSpell(me->GetVictim(), SPELL_ARCANE_BUFFET, false); - events.PopEvent(); - break; - case EVENT_SUMMON_SPHERES: - { - Talk(SAY_SUMMON_ENERGY); - spheres.DespawnAll(); - uint32 entry1 = RAND(SPELL_SUMMON_ETHEREAL_SPHERE_1, SPELL_SUMMON_ETHEREAL_SPHERE_2, SPELL_SUMMON_ETHEREAL_SPHERE_3); - me->CastSpell((Unit*)NULL, entry1, true); - if (IsHeroic()) - { - uint32 entry2; - do { entry2 = RAND(SPELL_SUMMON_ETHEREAL_SPHERE_1, SPELL_SUMMON_ETHEREAL_SPHERE_2, SPELL_SUMMON_ETHEREAL_SPHERE_3); } while (entry1 == entry2); - me->CastSpell((Unit*)NULL, entry2, true); - } - events.RepeatEvent(45000); - events.RescheduleEvent(EVENT_SPELL_ARCANE_BUFFET, 5000); - events.RescheduleEvent(EVENT_CHECK_DISTANCE, 6000); - } - break; - case EVENT_CHECK_DISTANCE: - { - bool found = false; - if (pInstance) - for (std::list::iterator itr = spheres.begin(); itr != spheres.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - if (me->GetDistance(c) < 3.0f) - { - c->CastSpell(me, SPELL_ARCANE_POWER, false); - c->DespawnOrUnsummon(8000); - found = true; - } - if (found) - { - Talk(SAY_CHARGED); - events.RepeatEvent(9000); - events.RescheduleEvent(EVENT_SUMMON_SPHERES, 10000); - } - else - events.RepeatEvent(2000); - } - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_ARCANE_BARRAGE_VOLLEY: + me->CastSpell((Unit*)NULL, SPELL_ARCANE_BARRAGE_VOLLEY, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_ARCANE_BUFFET: + me->CastSpell(me->GetVictim(), SPELL_ARCANE_BUFFET, false); + events.PopEvent(); + break; + case EVENT_SUMMON_SPHERES: + { + Talk(SAY_SUMMON_ENERGY); + spheres.DespawnAll(); + uint32 entry1 = RAND(SPELL_SUMMON_ETHEREAL_SPHERE_1, SPELL_SUMMON_ETHEREAL_SPHERE_2, SPELL_SUMMON_ETHEREAL_SPHERE_3); + me->CastSpell((Unit*)NULL, entry1, true); + if (IsHeroic()) + { + uint32 entry2; + do { entry2 = RAND(SPELL_SUMMON_ETHEREAL_SPHERE_1, SPELL_SUMMON_ETHEREAL_SPHERE_2, SPELL_SUMMON_ETHEREAL_SPHERE_3); } while (entry1 == entry2); + me->CastSpell((Unit*)NULL, entry2, true); + } + events.RepeatEvent(45000); + events.RescheduleEvent(EVENT_SPELL_ARCANE_BUFFET, 5000); + events.RescheduleEvent(EVENT_CHECK_DISTANCE, 6000); + } + break; + case EVENT_CHECK_DISTANCE: + { + bool found = false; + if (pInstance) + for (std::list::iterator itr = spheres.begin(); itr != spheres.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + if (me->GetDistance(c) < 3.0f) + { + c->CastSpell(me, SPELL_ARCANE_POWER, false); + c->DespawnOrUnsummon(8000); + found = true; + } + if (found) + { + Talk(SAY_CHARGED); + events.RepeatEvent(9000); + events.RescheduleEvent(EVENT_SUMMON_SPHERES, 10000); + } + else + events.RepeatEvent(2000); + } + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } void JustSummoned(Creature* pSummoned) { - if (pSummoned) - { - pSummoned->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f); - pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - spheres.Summon(pSummoned); - if (pInstance) - pInstance->SetData64(DATA_ADD_TRASH_MOB, pSummoned->GetGUID()); - } + if (pSummoned) + { + pSummoned->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f); + pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + spheres.Summon(pSummoned); + if (pInstance) + pInstance->SetData64(DATA_ADD_TRASH_MOB, pSummoned->GetGUID()); + } } - void SummonedCreatureDespawn(Creature *pSummoned) - { - if (pSummoned) - { - spheres.Despawn(pSummoned); - if (pInstance) - pInstance->SetData64(DATA_DELETE_TRASH_MOB, pSummoned->GetGUID()); - } - } + void SummonedCreatureDespawn(Creature *pSummoned) + { + if (pSummoned) + { + spheres.Despawn(pSummoned); + if (pInstance) + pInstance->SetData64(DATA_DELETE_TRASH_MOB, pSummoned->GetGUID()); + } + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEATH); - spheres.DespawnAll(); - if (pInstance) - pInstance->SetData(DATA_BOSS_DIED, 0); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEATH); + spheres.DespawnAll(); + if (pInstance) + pInstance->SetData(DATA_BOSS_DIED, 0); + } - void KilledUnit(Unit* pVictim) + void KilledUnit(Unit* pVictim) { if (pVictim && pVictim->GetGUID() == me->GetGUID()) return; @@ -185,20 +185,20 @@ public: Talk(SAY_SLAY); } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pInstance) - pInstance->SetData(DATA_FAILED, 1); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pInstance) + pInstance->SetData(DATA_FAILED, 1); + } + }; }; void AddSC_boss_xevozz() { - new boss_xevozz(); + new boss_xevozz(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp index 1f81e04d7..b276fe2d9 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp @@ -19,230 +19,230 @@ enum Yells enum eSpells { - SPELL_SHROUD_OF_DARKNESS_N = 54524, - SPELL_SHROUD_OF_DARKNESS_H = 59745, - SPELL_VOID_SHIFT_N = 54361, - SPELL_VOID_SHIFT_H = 59743, - SPELL_SUMMON_VOID_SENTRY = 54369, - SPELL_SUMMON_VOID_SENTRY_BALL = 58650, + SPELL_SHROUD_OF_DARKNESS_N = 54524, + SPELL_SHROUD_OF_DARKNESS_H = 59745, + SPELL_VOID_SHIFT_N = 54361, + SPELL_VOID_SHIFT_H = 59743, + SPELL_SUMMON_VOID_SENTRY = 54369, + SPELL_SUMMON_VOID_SENTRY_BALL = 58650, - //SPELL_ZURAMAT_ADD_2_N = 54342, - //SPELL_ZURAMAT_ADD_2_H = 59747, + //SPELL_ZURAMAT_ADD_2_N = 54342, + //SPELL_ZURAMAT_ADD_2_H = 59747, }; -#define NPC_VOID_SENTRY_BALL 29365 -#define SPELL_SHROUD_OF_DARKNESS DUNGEON_MODE(SPELL_SHROUD_OF_DARKNESS_N, SPELL_SHROUD_OF_DARKNESS_H) -#define SPELL_VOID_SHIFT DUNGEON_MODE(SPELL_VOID_SHIFT_N, SPELL_VOID_SHIFT_H) +#define NPC_VOID_SENTRY_BALL 29365 +#define SPELL_SHROUD_OF_DARKNESS DUNGEON_MODE(SPELL_SHROUD_OF_DARKNESS_N, SPELL_SHROUD_OF_DARKNESS_H) +#define SPELL_VOID_SHIFT DUNGEON_MODE(SPELL_VOID_SHIFT_N, SPELL_VOID_SHIFT_H) enum eEvents { - EVENT_SPELL_SHROUD_OF_DARKNESS = 1, - EVENT_SPELL_VOID_SHIFT, - EVENT_SPELL_SUMMON_VOID_SENTRY, + EVENT_SPELL_SHROUD_OF_DARKNESS = 1, + EVENT_SPELL_VOID_SHIFT, + EVENT_SPELL_SUMMON_VOID_SENTRY, }; class boss_zuramat : public CreatureScript { public: - boss_zuramat() : CreatureScript("boss_zuramat") { } + boss_zuramat() : CreatureScript("boss_zuramat") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_zuramatAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_zuramatAI (pCreature); + } - struct boss_zuramatAI : public ScriptedAI - { - boss_zuramatAI(Creature *c) : ScriptedAI(c), summons(me) - { - pInstance = c->GetInstanceScript(); - } + struct boss_zuramatAI : public ScriptedAI + { + boss_zuramatAI(Creature *c) : ScriptedAI(c), summons(me) + { + pInstance = c->GetInstanceScript(); + } - InstanceScript* pInstance; - EventMap events; - SummonList summons; + InstanceScript* pInstance; + EventMap events; + SummonList summons; - void Reset() - { - events.Reset(); - summons.DespawnAll(); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + } - void EnterCombat(Unit* /*who*/) - { + void EnterCombat(Unit* /*who*/) + { Talk(SAY_AGGRO); - DoZoneInCombat(); - events.Reset(); - events.RescheduleEvent(EVENT_SPELL_SHROUD_OF_DARKNESS, urand(5000,7000)); - events.RescheduleEvent(EVENT_SPELL_VOID_SHIFT, urand(23000,25000)); - events.RescheduleEvent(EVENT_SPELL_SUMMON_VOID_SENTRY, 10000); - if (pInstance) - pInstance->SetData(DATA_ACHIEV, 1); - } + DoZoneInCombat(); + events.Reset(); + events.RescheduleEvent(EVENT_SPELL_SHROUD_OF_DARKNESS, urand(5000,7000)); + events.RescheduleEvent(EVENT_SPELL_VOID_SHIFT, urand(23000,25000)); + events.RescheduleEvent(EVENT_SPELL_SUMMON_VOID_SENTRY, 10000); + if (pInstance) + pInstance->SetData(DATA_ACHIEV, 1); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SPELL_SHROUD_OF_DARKNESS: - me->CastSpell(me, SPELL_SHROUD_OF_DARKNESS, false); - Talk(SAY_SHIELD); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_VOID_SHIFT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) - { - me->CastSpell(target, SPELL_VOID_SHIFT, false); - me->MonsterWhisper("Gaze... into the void.", target->ToPlayer(), false); - } - events.RepeatEvent(urand(18000,22000)); - break; - case EVENT_SPELL_SUMMON_VOID_SENTRY: - me->CastSpell((Unit*)NULL, SPELL_SUMMON_VOID_SENTRY, false); - events.RepeatEvent(12000); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SPELL_SHROUD_OF_DARKNESS: + me->CastSpell(me, SPELL_SHROUD_OF_DARKNESS, false); + Talk(SAY_SHIELD); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_VOID_SHIFT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) + { + me->CastSpell(target, SPELL_VOID_SHIFT, false); + me->MonsterWhisper("Gaze... into the void.", target->ToPlayer(), false); + } + events.RepeatEvent(urand(18000,22000)); + break; + case EVENT_SPELL_SUMMON_VOID_SENTRY: + me->CastSpell((Unit*)NULL, SPELL_SUMMON_VOID_SENTRY, false); + events.RepeatEvent(12000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - summons.DespawnAll(); + void JustDied(Unit* /*killer*/) + { + summons.DespawnAll(); Talk(SAY_DEATH); - if (pInstance) - pInstance->SetData(DATA_BOSS_DIED, 0); - } + if (pInstance) + pInstance->SetData(DATA_BOSS_DIED, 0); + } void KilledUnit(Unit * victim) { - if (victim && victim->GetGUID() == me->GetGUID()) + if (victim && victim->GetGUID() == me->GetGUID()) return; Talk(SAY_SLAY); } - void JustSummoned(Creature* pSummoned) - { - if (pSummoned) - { - summons.Summon(pSummoned); - pSummoned->SetPhaseMask(16, true); - if (pInstance) - pInstance->SetData64(DATA_ADD_TRASH_MOB, pSummoned->GetGUID()); - } - } + void JustSummoned(Creature* pSummoned) + { + if (pSummoned) + { + summons.Summon(pSummoned); + pSummoned->SetPhaseMask(16, true); + if (pInstance) + pInstance->SetData64(DATA_ADD_TRASH_MOB, pSummoned->GetGUID()); + } + } - void SummonedCreatureDespawn(Creature *pSummoned) - { - if (pSummoned) - { - summons.Despawn(pSummoned); - if (pSummoned->IsAIEnabled) - pSummoned->AI()->DoAction(-1337); - if (pInstance) - pInstance->SetData64(DATA_DELETE_TRASH_MOB, pSummoned->GetGUID()); - } - } + void SummonedCreatureDespawn(Creature *pSummoned) + { + if (pSummoned) + { + summons.Despawn(pSummoned); + if (pSummoned->IsAIEnabled) + pSummoned->AI()->DoAction(-1337); + if (pInstance) + pInstance->SetData64(DATA_DELETE_TRASH_MOB, pSummoned->GetGUID()); + } + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void EnterEvadeMode() - { - ScriptedAI::EnterEvadeMode(); - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pInstance) - pInstance->SetData(DATA_FAILED, 1); - } - }; + void EnterEvadeMode() + { + ScriptedAI::EnterEvadeMode(); + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pInstance) + pInstance->SetData(DATA_FAILED, 1); + } + }; }; class npc_vh_void_sentry : public CreatureScript { public: - npc_vh_void_sentry() : CreatureScript("npc_vh_void_sentry") { } + npc_vh_void_sentry() : CreatureScript("npc_vh_void_sentry") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_vh_void_sentryAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_vh_void_sentryAI (pCreature); + } - struct npc_vh_void_sentryAI : public NullCreatureAI - { - npc_vh_void_sentryAI(Creature *c) : NullCreatureAI(c) - { - pInstance = c->GetInstanceScript(); - SummonedGUID = 0; - checkTimer = 5000; - //me->CastSpell(me, SPELL_SUMMON_VOID_SENTRY_BALL, true); - if (Creature* pSummoned = me->SummonCreature(NPC_VOID_SENTRY_BALL, *me, TEMPSUMMON_TIMED_DESPAWN, 300000)) - { - pSummoned->SetPhaseMask(1, true); - SummonedGUID = pSummoned->GetGUID(); - pInstance->SetData64(DATA_ADD_TRASH_MOB, pSummoned->GetGUID()); - } - } + struct npc_vh_void_sentryAI : public NullCreatureAI + { + npc_vh_void_sentryAI(Creature *c) : NullCreatureAI(c) + { + pInstance = c->GetInstanceScript(); + SummonedGUID = 0; + checkTimer = 5000; + //me->CastSpell(me, SPELL_SUMMON_VOID_SENTRY_BALL, true); + if (Creature* pSummoned = me->SummonCreature(NPC_VOID_SENTRY_BALL, *me, TEMPSUMMON_TIMED_DESPAWN, 300000)) + { + pSummoned->SetPhaseMask(1, true); + SummonedGUID = pSummoned->GetGUID(); + pInstance->SetData64(DATA_ADD_TRASH_MOB, pSummoned->GetGUID()); + } + } - InstanceScript* pInstance; - uint64 SummonedGUID; - uint16 checkTimer; + InstanceScript* pInstance; + uint64 SummonedGUID; + uint16 checkTimer; - void DoAction(int32 a) - { - if (a == -1337) - if (Creature* c = pInstance->instance->GetCreature(SummonedGUID)) - c->DespawnOrUnsummon(); - } + void DoAction(int32 a) + { + if (a == -1337) + if (Creature* c = pInstance->instance->GetCreature(SummonedGUID)) + c->DespawnOrUnsummon(); + } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - { - pInstance->SetData(DATA_ACHIEV, 0); - if (Creature* c = pInstance->instance->GetCreature(SummonedGUID)) - c->DespawnOrUnsummon(); - } - me->DespawnOrUnsummon(5000); - } + void JustDied(Unit* /*killer*/) + { + if (pInstance) + { + pInstance->SetData(DATA_ACHIEV, 0); + if (Creature* c = pInstance->instance->GetCreature(SummonedGUID)) + c->DespawnOrUnsummon(); + } + me->DespawnOrUnsummon(5000); + } - void SummonedCreatureDespawn(Creature *pSummoned) - { - if (pSummoned) - pInstance->SetData64(DATA_DELETE_TRASH_MOB, pSummoned->GetGUID()); - } + void SummonedCreatureDespawn(Creature *pSummoned) + { + if (pSummoned) + pInstance->SetData64(DATA_DELETE_TRASH_MOB, pSummoned->GetGUID()); + } - void UpdateAI(uint32 diff) - { - if (checkTimer <= diff) - { - checkTimer = 5000; - bool good = false; - if (me->IsSummon()) - if (Unit* s = me->ToTempSummon()->GetSummoner()) - if (s->IsAlive()) - good = true; - if (!good) - Unit::Kill(me, me); - } - else - checkTimer -= diff; - } - }; + void UpdateAI(uint32 diff) + { + if (checkTimer <= diff) + { + checkTimer = 5000; + bool good = false; + if (me->IsSummon()) + if (Unit* s = me->ToTempSummon()->GetSummoner()) + if (s->IsAlive()) + good = true; + if (!good) + Unit::Kill(me, me); + } + else + checkTimer -= diff; + } + }; }; void AddSC_boss_zuramat() { - new boss_zuramat(); - new npc_vh_void_sentry(); + new boss_zuramat(); + new npc_vh_void_sentry(); } diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 0d31f1218..f843f56ca 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -7,139 +7,139 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! #include "violet_hold.h" #include "Player.h" -#define CLEANUP_CHECK_INTERVAL 5000 -#define SPAWN_TIME 20000 +#define CLEANUP_CHECK_INTERVAL 5000 +#define SPAWN_TIME 20000 enum vYells { CYANIGOSA_SAY_SPAWN = 3, - SAY_SINCLARI_1 = 0 + SAY_SINCLARI_1 = 0 }; class instance_violet_hold : public InstanceMapScript { public: - instance_violet_hold() : InstanceMapScript("instance_violet_hold", 608) { } + instance_violet_hold() : InstanceMapScript("instance_violet_hold", 608) { } - InstanceScript* GetInstanceScript(InstanceMap* pMap) const - { - return new instance_violet_hold_InstanceMapScript(pMap); - } + InstanceScript* GetInstanceScript(InstanceMap* pMap) const + { + return new instance_violet_hold_InstanceMapScript(pMap); + } - struct instance_violet_hold_InstanceMapScript : public InstanceScript - { - instance_violet_hold_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {} + struct instance_violet_hold_InstanceMapScript : public InstanceScript + { + instance_violet_hold_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {} - uint32 m_auiEncounter[MAX_ENCOUNTER]; - bool CLEANED; - uint8 EncounterStatus; - uint32 uiFirstBoss, uiSecondBoss; - std::string str_data; - EventMap events; - uint8 GateHealth; - uint8 WaveCount; - uint8 PortalLocation; - bool bAchiev; - bool bDefensesUsed; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + bool CLEANED; + uint8 EncounterStatus; + uint32 uiFirstBoss, uiSecondBoss; + std::string str_data; + EventMap events; + uint8 GateHealth; + uint8 WaveCount; + uint8 PortalLocation; + bool bAchiev; + bool bDefensesUsed; - std::vector GO_ActivationCrystalGUID; - uint64 GO_MainGateGUID; + std::vector GO_ActivationCrystalGUID; + uint64 GO_MainGateGUID; - uint64 GO_MoraggCellGUID; - uint64 GO_ErekemCellGUID; - uint64 GO_ErekemRightGuardCellGUID; - uint64 GO_ErekemLeftGuardCellGUID; - uint64 GO_IchoronCellGUID; - uint64 GO_LavanthorCellGUID; - uint64 GO_XevozzCellGUID; - uint64 GO_ZuramatCellGUID; + uint64 GO_MoraggCellGUID; + uint64 GO_ErekemCellGUID; + uint64 GO_ErekemRightGuardCellGUID; + uint64 GO_ErekemLeftGuardCellGUID; + uint64 GO_IchoronCellGUID; + uint64 GO_LavanthorCellGUID; + uint64 GO_XevozzCellGUID; + uint64 GO_ZuramatCellGUID; - std::set trashMobs; - uint64 NPC_SinclariGUID; - uint64 NPC_GuardGUID[4]; - uint64 NPC_PortalGUID; - uint64 NPC_DoorSealGUID; + std::set trashMobs; + uint64 NPC_SinclariGUID; + uint64 NPC_GuardGUID[4]; + uint64 NPC_PortalGUID; + uint64 NPC_DoorSealGUID; - uint64 NPC_MoraggGUID; - uint64 NPC_ErekemGUID; - uint64 NPC_ErekemGuardGUID[2]; - uint64 NPC_IchoronGUID; - uint64 NPC_LavanthorGUID; - uint64 NPC_XevozzGUID; - uint64 NPC_ZuramatGUID; - uint64 NPC_CyanigosaGUID; + uint64 NPC_MoraggGUID; + uint64 NPC_ErekemGUID; + uint64 NPC_ErekemGuardGUID[2]; + uint64 NPC_IchoronGUID; + uint64 NPC_LavanthorGUID; + uint64 NPC_XevozzGUID; + uint64 NPC_ZuramatGUID; + uint64 NPC_CyanigosaGUID; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - CLEANED = false; - EncounterStatus = NOT_STARTED; - uiFirstBoss = 0; - uiSecondBoss = 0; - events.Reset(); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); - GateHealth = 100; - WaveCount = 0; - PortalLocation = 0; - bDefensesUsed = false; + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + CLEANED = false; + EncounterStatus = NOT_STARTED; + uiFirstBoss = 0; + uiSecondBoss = 0; + events.Reset(); + events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); + GateHealth = 100; + WaveCount = 0; + PortalLocation = 0; + bDefensesUsed = false; - GO_ActivationCrystalGUID.clear(); - GO_MainGateGUID = 0; + GO_ActivationCrystalGUID.clear(); + GO_MainGateGUID = 0; - GO_MoraggCellGUID = 0; - GO_ErekemCellGUID = 0; - GO_ErekemRightGuardCellGUID = 0; - GO_ErekemLeftGuardCellGUID = 0; - GO_IchoronCellGUID = 0; - GO_LavanthorCellGUID = 0; - GO_XevozzCellGUID = 0; - GO_ZuramatCellGUID = 0; + GO_MoraggCellGUID = 0; + GO_ErekemCellGUID = 0; + GO_ErekemRightGuardCellGUID = 0; + GO_ErekemLeftGuardCellGUID = 0; + GO_IchoronCellGUID = 0; + GO_LavanthorCellGUID = 0; + GO_XevozzCellGUID = 0; + GO_ZuramatCellGUID = 0; - NPC_SinclariGUID = 0; - memset(&NPC_GuardGUID, 0, sizeof(NPC_GuardGUID)); - NPC_PortalGUID = 0; - NPC_DoorSealGUID = 0; + NPC_SinclariGUID = 0; + memset(&NPC_GuardGUID, 0, sizeof(NPC_GuardGUID)); + NPC_PortalGUID = 0; + NPC_DoorSealGUID = 0; - NPC_MoraggGUID = 0; - NPC_ErekemGUID = 0; - NPC_ErekemGuardGUID[0] = NPC_ErekemGuardGUID[1] = 0; - NPC_IchoronGUID = 0; - NPC_LavanthorGUID = 0; - NPC_XevozzGUID = 0; - NPC_ZuramatGUID = 0; - NPC_CyanigosaGUID = 0; - } + NPC_MoraggGUID = 0; + NPC_ErekemGUID = 0; + NPC_ErekemGuardGUID[0] = NPC_ErekemGuardGUID[1] = 0; + NPC_IchoronGUID = 0; + NPC_LavanthorGUID = 0; + NPC_XevozzGUID = 0; + NPC_ZuramatGUID = 0; + NPC_CyanigosaGUID = 0; + } - bool IsEncounterInProgress() const - { - return false; - } + bool IsEncounterInProgress() const + { + return false; + } - void OnCreatureCreate(Creature* creature) - { - switch(creature->GetEntry()) - { - case NPC_SINCLARI: - NPC_SinclariGUID = creature->GetGUID(); - break; - case NPC_VIOLET_HOLD_GUARD: - for (uint8 i=0; i<4; ++i) - if (NPC_GuardGUID[i] == 0) - { - NPC_GuardGUID[i] = creature->GetGUID(); - break; - } - break; - case NPC_DEFENSE_DUMMY_TARGET: - creature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_ARCANE_LIGHTNING, true); - break; - case NPC_TELEPORTATION_PORTAL: - NPC_PortalGUID = creature->GetGUID(); - break; - case NPC_PRISON_DOOR_SEAL: - NPC_DoorSealGUID = creature->GetGUID(); - break; - // BOSSES BELOW: + void OnCreatureCreate(Creature* creature) + { + switch(creature->GetEntry()) + { + case NPC_SINCLARI: + NPC_SinclariGUID = creature->GetGUID(); + break; + case NPC_VIOLET_HOLD_GUARD: + for (uint8 i=0; i<4; ++i) + if (NPC_GuardGUID[i] == 0) + { + NPC_GuardGUID[i] = creature->GetGUID(); + break; + } + break; + case NPC_DEFENSE_DUMMY_TARGET: + creature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_ARCANE_LIGHTNING, true); + break; + case NPC_TELEPORTATION_PORTAL: + NPC_PortalGUID = creature->GetGUID(); + break; + case NPC_PRISON_DOOR_SEAL: + NPC_DoorSealGUID = creature->GetGUID(); + break; + // BOSSES BELOW: case NPC_XEVOZZ: NPC_XevozzGUID = creature->GetGUID(); break; @@ -158,7 +158,7 @@ public: case NPC_EREKEM_GUARD: if (NPC_ErekemGuardGUID[0] == 0) NPC_ErekemGuardGUID[0] = creature->GetGUID(); - else + else NPC_ErekemGuardGUID[1] = creature->GetGUID(); break; case NPC_MORAGG: @@ -167,542 +167,542 @@ public: case NPC_CYANIGOSA: NPC_CyanigosaGUID = creature->GetGUID(); break; - } - } + } + } - void OnGameObjectCreate(GameObject* go) - { - switch(go->GetEntry()) - { - case GO_ACTIVATION_CRYSTAL: - HandleGameObject(0, false, go); // make go not used yet - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); // not useable at the beginning - GO_ActivationCrystalGUID.push_back(go->GetGUID()); - break; - case GO_MAIN_DOOR: - GO_MainGateGUID = go->GetGUID(); - break; - // BOSS GATES BELOW: - case GO_EREKEM_GUARD_1_DOOR: - GO_ErekemLeftGuardCellGUID = go->GetGUID(); - break; - case GO_EREKEM_GUARD_2_DOOR: - GO_ErekemRightGuardCellGUID = go->GetGUID(); - break; - case GO_EREKEM_DOOR: - GO_ErekemCellGUID = go->GetGUID(); - break; - case GO_ZURAMAT_DOOR: - GO_ZuramatCellGUID = go->GetGUID(); - break; - case GO_LAVANTHOR_DOOR: - GO_LavanthorCellGUID = go->GetGUID(); - break; - case GO_MORAGG_DOOR: - GO_MoraggCellGUID = go->GetGUID(); - break; - case GO_ICHORON_DOOR: - GO_IchoronCellGUID = go->GetGUID(); - break; - case GO_XEVOZZ_DOOR: - GO_XevozzCellGUID = go->GetGUID(); - break; - } - } + void OnGameObjectCreate(GameObject* go) + { + switch(go->GetEntry()) + { + case GO_ACTIVATION_CRYSTAL: + HandleGameObject(0, false, go); // make go not used yet + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); // not useable at the beginning + GO_ActivationCrystalGUID.push_back(go->GetGUID()); + break; + case GO_MAIN_DOOR: + GO_MainGateGUID = go->GetGUID(); + break; + // BOSS GATES BELOW: + case GO_EREKEM_GUARD_1_DOOR: + GO_ErekemLeftGuardCellGUID = go->GetGUID(); + break; + case GO_EREKEM_GUARD_2_DOOR: + GO_ErekemRightGuardCellGUID = go->GetGUID(); + break; + case GO_EREKEM_DOOR: + GO_ErekemCellGUID = go->GetGUID(); + break; + case GO_ZURAMAT_DOOR: + GO_ZuramatCellGUID = go->GetGUID(); + break; + case GO_LAVANTHOR_DOOR: + GO_LavanthorCellGUID = go->GetGUID(); + break; + case GO_MORAGG_DOOR: + GO_MoraggCellGUID = go->GetGUID(); + break; + case GO_ICHORON_DOOR: + GO_IchoronCellGUID = go->GetGUID(); + break; + case GO_XEVOZZ_DOOR: + GO_XevozzCellGUID = go->GetGUID(); + break; + } + } - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_ACTIVATE_DEFENSE_SYSTEM: - { - if (data) - bDefensesUsed = true; - const Position pos = {1919.09546f, 812.29724f, 86.2905f, M_PI}; - instance->SummonCreature(NPC_DEFENSE_SYSTEM, pos, 0, 6499); - } - break; - case DATA_START_INSTANCE: - if (EncounterStatus == NOT_STARTED) - { - EncounterStatus = IN_PROGRESS; - if (Creature* c = instance->GetCreature(NPC_SinclariGUID)) - c->AI()->Talk(SAY_SINCLARI_1); - events.RescheduleEvent(EVENT_GUARDS_FALL_BACK, 4000); - } - break; - case DATA_PORTAL_DEFEATED: - events.RescheduleEvent(EVENT_SUMMON_PORTAL, 3000); - break; - case DATA_PORTAL_LOCATION: - PortalLocation = data; - break; - case DATA_DECRASE_DOOR_HEALTH: - if (GateHealth>0) - --GateHealth; - if (GateHealth==0) - { - CLEANED = false; - InstanceCleanup(); - } - DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, (uint32)GateHealth); - break; - case DATA_RELEASE_BOSS: - if (WaveCount == 6) - StartBossEncounter(uiFirstBoss); - else - StartBossEncounter(uiSecondBoss); - break; - case DATA_BOSS_DIED: - if (WaveCount == 6) - m_auiEncounter[0] = DONE; - else if (WaveCount == 12) - m_auiEncounter[1] = DONE; - else if (WaveCount == 18) - { - m_auiEncounter[2] = DONE; - EncounterStatus = DONE; - HandleGameObject(GO_MainGateGUID, true); - DoUpdateWorldState(WORLD_STATE_VH_SHOW, 0); - if (Creature* c = instance->GetCreature(NPC_SinclariGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); } - } - SaveToDB(); - if (WaveCount < 18) - events.RescheduleEvent(EVENT_SUMMON_PORTAL, 35000); - break; - case DATA_FAILED: - CLEANED = false; - InstanceCleanup(); - break; - case DATA_ACHIEV: - bAchiev = data ? true : false; - break; - } - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_ACTIVATE_DEFENSE_SYSTEM: + { + if (data) + bDefensesUsed = true; + const Position pos = {1919.09546f, 812.29724f, 86.2905f, M_PI}; + instance->SummonCreature(NPC_DEFENSE_SYSTEM, pos, 0, 6499); + } + break; + case DATA_START_INSTANCE: + if (EncounterStatus == NOT_STARTED) + { + EncounterStatus = IN_PROGRESS; + if (Creature* c = instance->GetCreature(NPC_SinclariGUID)) + c->AI()->Talk(SAY_SINCLARI_1); + events.RescheduleEvent(EVENT_GUARDS_FALL_BACK, 4000); + } + break; + case DATA_PORTAL_DEFEATED: + events.RescheduleEvent(EVENT_SUMMON_PORTAL, 3000); + break; + case DATA_PORTAL_LOCATION: + PortalLocation = data; + break; + case DATA_DECRASE_DOOR_HEALTH: + if (GateHealth>0) + --GateHealth; + if (GateHealth==0) + { + CLEANED = false; + InstanceCleanup(); + } + DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, (uint32)GateHealth); + break; + case DATA_RELEASE_BOSS: + if (WaveCount == 6) + StartBossEncounter(uiFirstBoss); + else + StartBossEncounter(uiSecondBoss); + break; + case DATA_BOSS_DIED: + if (WaveCount == 6) + m_auiEncounter[0] = DONE; + else if (WaveCount == 12) + m_auiEncounter[1] = DONE; + else if (WaveCount == 18) + { + m_auiEncounter[2] = DONE; + EncounterStatus = DONE; + HandleGameObject(GO_MainGateGUID, true); + DoUpdateWorldState(WORLD_STATE_VH_SHOW, 0); + if (Creature* c = instance->GetCreature(NPC_SinclariGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); } + } + SaveToDB(); + if (WaveCount < 18) + events.RescheduleEvent(EVENT_SUMMON_PORTAL, 35000); + break; + case DATA_FAILED: + CLEANED = false; + InstanceCleanup(); + break; + case DATA_ACHIEV: + bAchiev = data ? true : false; + break; + } + } - void SetData64(uint32 type, uint64 data) - { - switch(type) - { - case DATA_ADD_TRASH_MOB: - trashMobs.insert(data); - break; - case DATA_DELETE_TRASH_MOB: - if (!CLEANED) - trashMobs.erase(data); - break; - } - } + void SetData64(uint32 type, uint64 data) + { + switch(type) + { + case DATA_ADD_TRASH_MOB: + trashMobs.insert(data); + break; + case DATA_DELETE_TRASH_MOB: + if (!CLEANED) + trashMobs.erase(data); + break; + } + } - uint32 GetData(uint32 type) const - { - switch(type) - { - case DATA_ENCOUNTER_STATUS: - return (uint32)EncounterStatus; - case DATA_WAVE_COUNT: - return (uint32)WaveCount; - case DATA_PORTAL_LOCATION: - return PortalLocation; - case DATA_FIRST_BOSS_NUMBER: - return uiFirstBoss; - case DATA_SECOND_BOSS_NUMBER: - return uiSecondBoss; - } + uint32 GetData(uint32 type) const + { + switch(type) + { + case DATA_ENCOUNTER_STATUS: + return (uint32)EncounterStatus; + case DATA_WAVE_COUNT: + return (uint32)WaveCount; + case DATA_PORTAL_LOCATION: + return PortalLocation; + case DATA_FIRST_BOSS_NUMBER: + return uiFirstBoss; + case DATA_SECOND_BOSS_NUMBER: + return uiSecondBoss; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 identifier) const - { - switch(identifier) - { - case DATA_TELEPORTATION_PORTAL_GUID: - return NPC_PortalGUID; - case DATA_DOOR_SEAL_GUID: - return NPC_DoorSealGUID; - case DATA_EREKEM_GUID: - return NPC_ErekemGUID; - case DATA_EREKEM_GUARD_1_GUID: - return NPC_ErekemGuardGUID[0]; - case DATA_EREKEM_GUARD_2_GUID: - return NPC_ErekemGuardGUID[1]; - case DATA_ICHORON_GUID: - return NPC_IchoronGUID; - } + uint64 GetData64(uint32 identifier) const + { + switch(identifier) + { + case DATA_TELEPORTATION_PORTAL_GUID: + return NPC_PortalGUID; + case DATA_DOOR_SEAL_GUID: + return NPC_DoorSealGUID; + case DATA_EREKEM_GUID: + return NPC_ErekemGUID; + case DATA_EREKEM_GUARD_1_GUID: + return NPC_ErekemGuardGUID[0]; + case DATA_EREKEM_GUARD_2_GUID: + return NPC_ErekemGuardGUID[1]; + case DATA_ICHORON_GUID: + return NPC_IchoronGUID; + } - return 0; - } + return 0; + } - void StartBossEncounter(uint8 uiBoss) - { - Creature* pBoss = NULL; + void StartBossEncounter(uint8 uiBoss) + { + Creature* pBoss = NULL; - switch(uiBoss) - { - case BOSS_MORAGG: - HandleGameObject(GO_MoraggCellGUID, true); - pBoss = instance->GetCreature(NPC_MoraggGUID); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove1); - break; - case BOSS_EREKEM: - HandleGameObject(GO_ErekemCellGUID, true); - HandleGameObject(GO_ErekemRightGuardCellGUID, true); - HandleGameObject(GO_ErekemLeftGuardCellGUID, true); - pBoss = instance->GetCreature(NPC_ErekemGUID); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove2); - if (Creature* pGuard1 = instance->GetCreature(NPC_ErekemGuardGUID[0])) - { - pGuard1->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); - pGuard1->GetMotionMaster()->MovePoint(0, BossStartMove21); - } - if (Creature* pGuard2 = instance->GetCreature(NPC_ErekemGuardGUID[1])) - { - pGuard2->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); - pGuard2->GetMotionMaster()->MovePoint(0, BossStartMove22); - } - break; - case BOSS_ICHORON: - HandleGameObject(GO_IchoronCellGUID, true); - pBoss = instance->GetCreature(NPC_IchoronGUID); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove3); - break; - case BOSS_LAVANTHOR: - HandleGameObject(GO_LavanthorCellGUID, true); - pBoss = instance->GetCreature(NPC_LavanthorGUID); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove4); - break; - case BOSS_XEVOZZ: - HandleGameObject(GO_XevozzCellGUID, true); - pBoss = instance->GetCreature(NPC_XevozzGUID); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove5); - break; - case BOSS_ZURAMAT: - HandleGameObject(GO_ZuramatCellGUID, true); - pBoss = instance->GetCreature(NPC_ZuramatGUID); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove6); - break; - } + switch(uiBoss) + { + case BOSS_MORAGG: + HandleGameObject(GO_MoraggCellGUID, true); + pBoss = instance->GetCreature(NPC_MoraggGUID); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove1); + break; + case BOSS_EREKEM: + HandleGameObject(GO_ErekemCellGUID, true); + HandleGameObject(GO_ErekemRightGuardCellGUID, true); + HandleGameObject(GO_ErekemLeftGuardCellGUID, true); + pBoss = instance->GetCreature(NPC_ErekemGUID); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove2); + if (Creature* pGuard1 = instance->GetCreature(NPC_ErekemGuardGUID[0])) + { + pGuard1->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + pGuard1->GetMotionMaster()->MovePoint(0, BossStartMove21); + } + if (Creature* pGuard2 = instance->GetCreature(NPC_ErekemGuardGUID[1])) + { + pGuard2->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + pGuard2->GetMotionMaster()->MovePoint(0, BossStartMove22); + } + break; + case BOSS_ICHORON: + HandleGameObject(GO_IchoronCellGUID, true); + pBoss = instance->GetCreature(NPC_IchoronGUID); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove3); + break; + case BOSS_LAVANTHOR: + HandleGameObject(GO_LavanthorCellGUID, true); + pBoss = instance->GetCreature(NPC_LavanthorGUID); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove4); + break; + case BOSS_XEVOZZ: + HandleGameObject(GO_XevozzCellGUID, true); + pBoss = instance->GetCreature(NPC_XevozzGUID); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove5); + break; + case BOSS_ZURAMAT: + HandleGameObject(GO_ZuramatCellGUID, true); + pBoss = instance->GetCreature(NPC_ZuramatGUID); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove6); + break; + } - if (pBoss) - { - pBoss->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); - pBoss->SetReactState(REACT_AGGRESSIVE); - if (WaveCount == 6 && m_auiEncounter[0] == DONE || WaveCount == 12 && m_auiEncounter[1] == DONE) - pBoss->SetLootMode(0); - } - } + if (pBoss) + { + pBoss->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + pBoss->SetReactState(REACT_AGGRESSIVE); + if (WaveCount == 6 && m_auiEncounter[0] == DONE || WaveCount == 12 && m_auiEncounter[1] == DONE) + pBoss->SetLootMode(0); + } + } - void Update(uint32 diff) - { - events.Update(diff); - switch( events.GetEvent() ) - { - case 0: - break; - case EVENT_CHECK_PLAYERS: - { - if( DoNeedCleanup(false) ) - InstanceCleanup(); - events.RepeatEvent(CLEANUP_CHECK_INTERVAL); - } - break; - case EVENT_GUARDS_FALL_BACK: - { - for (uint8 i=0; i<4; ++i) - if (Creature* c = instance->GetCreature(NPC_GuardGUID[i])) - { - c->SetReactState(REACT_PASSIVE); - c->CombatStop(); - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - c->GetMotionMaster()->MovePoint(0, guardMovePosition); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_GUARDS_DISAPPEAR, 5000); - } - break; - case EVENT_GUARDS_DISAPPEAR: - { - for (uint8 i=0; i<4; ++i) - if (Creature* c = instance->GetCreature(NPC_GuardGUID[i])) - c->SetVisible(false); - events.PopEvent(); - events.RescheduleEvent(EVENT_SINCLARI_FALL_BACK, 2000); - } - break; - case EVENT_SINCLARI_FALL_BACK: - { - if (Creature* c = instance->GetCreature(NPC_SinclariGUID)) - { - c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - c->GetMotionMaster()->MovePoint(0, sinclariOutsidePosition); - } - SetData(DATA_ACTIVATE_DEFENSE_SYSTEM, 0); - events.PopEvent(); - events.RescheduleEvent(EVENT_START_ENCOUNTER, 4000); - } - break; - case EVENT_START_ENCOUNTER: - { - if (Creature* c = instance->GetCreature(NPC_DoorSealGUID)) - c->RemoveAllAuras(); // just to be sure... - GateHealth = 100; - HandleGameObject(GO_MainGateGUID, false); - DoUpdateWorldState(WORLD_STATE_VH_SHOW, 1); - DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, (uint32)GateHealth); - DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, (uint32)WaveCount); + void Update(uint32 diff) + { + events.Update(diff); + switch( events.GetEvent() ) + { + case 0: + break; + case EVENT_CHECK_PLAYERS: + { + if( DoNeedCleanup(false) ) + InstanceCleanup(); + events.RepeatEvent(CLEANUP_CHECK_INTERVAL); + } + break; + case EVENT_GUARDS_FALL_BACK: + { + for (uint8 i=0; i<4; ++i) + if (Creature* c = instance->GetCreature(NPC_GuardGUID[i])) + { + c->SetReactState(REACT_PASSIVE); + c->CombatStop(); + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + c->GetMotionMaster()->MovePoint(0, guardMovePosition); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_GUARDS_DISAPPEAR, 5000); + } + break; + case EVENT_GUARDS_DISAPPEAR: + { + for (uint8 i=0; i<4; ++i) + if (Creature* c = instance->GetCreature(NPC_GuardGUID[i])) + c->SetVisible(false); + events.PopEvent(); + events.RescheduleEvent(EVENT_SINCLARI_FALL_BACK, 2000); + } + break; + case EVENT_SINCLARI_FALL_BACK: + { + if (Creature* c = instance->GetCreature(NPC_SinclariGUID)) + { + c->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + c->GetMotionMaster()->MovePoint(0, sinclariOutsidePosition); + } + SetData(DATA_ACTIVATE_DEFENSE_SYSTEM, 0); + events.PopEvent(); + events.RescheduleEvent(EVENT_START_ENCOUNTER, 4000); + } + break; + case EVENT_START_ENCOUNTER: + { + if (Creature* c = instance->GetCreature(NPC_DoorSealGUID)) + c->RemoveAllAuras(); // just to be sure... + GateHealth = 100; + HandleGameObject(GO_MainGateGUID, false); + DoUpdateWorldState(WORLD_STATE_VH_SHOW, 1); + DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, (uint32)GateHealth); + DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, (uint32)WaveCount); - for (std::vector::iterator itr = GO_ActivationCrystalGUID.begin(); itr != GO_ActivationCrystalGUID.end(); ++itr) - if (GameObject* go = instance->GetGameObject(*itr)) - { - HandleGameObject(0, false, go); // not used yet - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); // make it useable - } - events.PopEvent(); - events.RescheduleEvent(EVENT_SUMMON_PORTAL, 4000); - } - break; - case EVENT_SUMMON_PORTAL: - ++WaveCount; - DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, (uint32)WaveCount); - SetData(DATA_PORTAL_LOCATION, (GetData(DATA_PORTAL_LOCATION) + urand(1, 5))%6); - if (Creature* c = instance->GetCreature(NPC_SinclariGUID)) - { - if (WaveCount%6 != 0) - c->SummonCreature(NPC_TELEPORTATION_PORTAL, PortalLocations[GetData(DATA_PORTAL_LOCATION)], TEMPSUMMON_CORPSE_DESPAWN); - else if (WaveCount == 6 || WaveCount == 12) // first or second boss - { - if (!uiFirstBoss || !uiSecondBoss) - { - uiFirstBoss = urand(1,6); - do { uiSecondBoss = urand(1,6); } while (uiFirstBoss==uiSecondBoss); - SaveToDB(); - } - c->SummonCreature(NPC_TELEPORTATION_PORTAL, MiddleRoomPortalSaboLocation, TEMPSUMMON_CORPSE_DESPAWN); - } - else // cyanigossa - { - if (Creature* cyanigosa = c->SummonCreature(NPC_CYANIGOSA, CyanigosasSpawnLocation, TEMPSUMMON_DEAD_DESPAWN)) - { - cyanigosa->CastSpell(cyanigosa, SPELL_CYANIGOSA_BLUE_AURA, false); - cyanigosa->AI()->Talk(CYANIGOSA_SAY_SPAWN); - cyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); - } - events.RescheduleEvent(EVENT_CYANIGOSSA_TRANSFORM, 10000); - } - } - events.PopEvent(); - break; - case EVENT_CYANIGOSSA_TRANSFORM: - if (Creature* c = instance->GetCreature(NPC_CyanigosaGUID)) - { - c->RemoveAurasDueToSpell(SPELL_CYANIGOSA_BLUE_AURA); + for (std::vector::iterator itr = GO_ActivationCrystalGUID.begin(); itr != GO_ActivationCrystalGUID.end(); ++itr) + if (GameObject* go = instance->GetGameObject(*itr)) + { + HandleGameObject(0, false, go); // not used yet + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); // make it useable + } + events.PopEvent(); + events.RescheduleEvent(EVENT_SUMMON_PORTAL, 4000); + } + break; + case EVENT_SUMMON_PORTAL: + ++WaveCount; + DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, (uint32)WaveCount); + SetData(DATA_PORTAL_LOCATION, (GetData(DATA_PORTAL_LOCATION) + urand(1, 5))%6); + if (Creature* c = instance->GetCreature(NPC_SinclariGUID)) + { + if (WaveCount%6 != 0) + c->SummonCreature(NPC_TELEPORTATION_PORTAL, PortalLocations[GetData(DATA_PORTAL_LOCATION)], TEMPSUMMON_CORPSE_DESPAWN); + else if (WaveCount == 6 || WaveCount == 12) // first or second boss + { + if (!uiFirstBoss || !uiSecondBoss) + { + uiFirstBoss = urand(1,6); + do { uiSecondBoss = urand(1,6); } while (uiFirstBoss==uiSecondBoss); + SaveToDB(); + } + c->SummonCreature(NPC_TELEPORTATION_PORTAL, MiddleRoomPortalSaboLocation, TEMPSUMMON_CORPSE_DESPAWN); + } + else // cyanigossa + { + if (Creature* cyanigosa = c->SummonCreature(NPC_CYANIGOSA, CyanigosasSpawnLocation, TEMPSUMMON_DEAD_DESPAWN)) + { + cyanigosa->CastSpell(cyanigosa, SPELL_CYANIGOSA_BLUE_AURA, false); + cyanigosa->AI()->Talk(CYANIGOSA_SAY_SPAWN); + cyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); + } + events.RescheduleEvent(EVENT_CYANIGOSSA_TRANSFORM, 10000); + } + } + events.PopEvent(); + break; + case EVENT_CYANIGOSSA_TRANSFORM: + if (Creature* c = instance->GetCreature(NPC_CyanigosaGUID)) + { + c->RemoveAurasDueToSpell(SPELL_CYANIGOSA_BLUE_AURA); c->CastSpell(c, SPELL_CYANIGOSA_TRANSFORM, 0); - events.RescheduleEvent(EVENT_CYANIGOSA_ATTACK, 2500); - } - events.PopEvent(); - break; - case EVENT_CYANIGOSA_ATTACK: - if (Creature* c = instance->GetCreature(NPC_CyanigosaGUID)) - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); - events.PopEvent(); - break; - } - } + events.RescheduleEvent(EVENT_CYANIGOSA_ATTACK, 2500); + } + events.PopEvent(); + break; + case EVENT_CYANIGOSA_ATTACK: + if (Creature* c = instance->GetCreature(NPC_CyanigosaGUID)) + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); + events.PopEvent(); + break; + } + } - void OnPlayerEnter(Player* plr) - { - if( DoNeedCleanup(plr->IsAlive()) ) - InstanceCleanup(); + void OnPlayerEnter(Player* plr) + { + if( DoNeedCleanup(plr->IsAlive()) ) + InstanceCleanup(); - if (EncounterStatus == IN_PROGRESS) - { - plr->SendUpdateWorldState(WORLD_STATE_VH_SHOW, 1); - plr->SendUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, (uint32)GateHealth); - plr->SendUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, (uint32)WaveCount); - } - else - plr->SendUpdateWorldState(WORLD_STATE_VH_SHOW, 0); + if (EncounterStatus == IN_PROGRESS) + { + plr->SendUpdateWorldState(WORLD_STATE_VH_SHOW, 1); + plr->SendUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, (uint32)GateHealth); + plr->SendUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, (uint32)WaveCount); + } + else + plr->SendUpdateWorldState(WORLD_STATE_VH_SHOW, 0); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); - } + events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); + } - bool DoNeedCleanup(bool enter) - { - uint8 aliveCount = 0; - Map::PlayerList const &pl = instance->GetPlayers(); - for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) - if( Player* plr = itr->GetSource() ) - if( plr->IsAlive() && !plr->IsGameMaster() && !plr->HasAura(27827)/*spirit of redemption aura*/ ) - ++aliveCount; + bool DoNeedCleanup(bool enter) + { + uint8 aliveCount = 0; + Map::PlayerList const &pl = instance->GetPlayers(); + for( Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr ) + if( Player* plr = itr->GetSource() ) + if( plr->IsAlive() && !plr->IsGameMaster() && !plr->HasAura(27827)/*spirit of redemption aura*/ ) + ++aliveCount; - bool need = enter ? aliveCount<=1 : aliveCount==0; - if( !need && CLEANED ) - CLEANED = false; - return need; - } + bool need = enter ? aliveCount<=1 : aliveCount==0; + if( !need && CLEANED ) + CLEANED = false; + return need; + } - void InstanceCleanup() - { - if( CLEANED ) - return; - CLEANED = true; + void InstanceCleanup() + { + if( CLEANED ) + return; + CLEANED = true; - // reset defense crystals - for (std::vector::iterator itr = GO_ActivationCrystalGUID.begin(); itr != GO_ActivationCrystalGUID.end(); ++itr) - if (GameObject* go = instance->GetGameObject(*itr)) - { - HandleGameObject(0, false, go); // not used yet - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); // not useable at the beginning - } + // reset defense crystals + for (std::vector::iterator itr = GO_ActivationCrystalGUID.begin(); itr != GO_ActivationCrystalGUID.end(); ++itr) + if (GameObject* go = instance->GetGameObject(*itr)) + { + HandleGameObject(0, false, go); // not used yet + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); // not useable at the beginning + } - // reset positions of Sinclari and Guards - if (Creature* c = instance->GetCreature(NPC_SinclariGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); } - for (uint8 i=0; i<4; ++i) - if (Creature* c = instance->GetCreature(NPC_GuardGUID[i])) - { - c->DespawnOrUnsummon(); - c->SetRespawnTime(3); - if (m_auiEncounter[MAX_ENCOUNTER-1] == DONE) - c->SetVisible(false); - else - c->SetVisible(true); - c->SetReactState(REACT_AGGRESSIVE); - } + // reset positions of Sinclari and Guards + if (Creature* c = instance->GetCreature(NPC_SinclariGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); } + for (uint8 i=0; i<4; ++i) + if (Creature* c = instance->GetCreature(NPC_GuardGUID[i])) + { + c->DespawnOrUnsummon(); + c->SetRespawnTime(3); + if (m_auiEncounter[MAX_ENCOUNTER-1] == DONE) + c->SetVisible(false); + else + c->SetVisible(true); + c->SetReactState(REACT_AGGRESSIVE); + } - // remove portal if any - if (Creature* c = instance->GetCreature(NPC_PortalGUID)) - c->DespawnOrUnsummon(); - NPC_PortalGUID = 0; + // remove portal if any + if (Creature* c = instance->GetCreature(NPC_PortalGUID)) + c->DespawnOrUnsummon(); + NPC_PortalGUID = 0; - // remove trash - for (std::set::iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr) - if (Creature* c = instance->GetCreature(*itr)) - c->DespawnOrUnsummon(); - trashMobs.clear(); + // remove trash + for (std::set::iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr) + if (Creature* c = instance->GetCreature(*itr)) + c->DespawnOrUnsummon(); + trashMobs.clear(); - // clear door seal damaging auras: - if (Creature* c = instance->GetCreature(NPC_DoorSealGUID)) - c->RemoveAllAuras(); + // clear door seal damaging auras: + if (Creature* c = instance->GetCreature(NPC_DoorSealGUID)) + c->RemoveAllAuras(); - // open main gate - HandleGameObject(GO_MainGateGUID, true); - - if (m_auiEncounter[MAX_ENCOUNTER-1] != DONE) // instance not finished - { - // close all cells - HandleGameObject(GO_MoraggCellGUID, false); - HandleGameObject(GO_ErekemCellGUID, false); - HandleGameObject(GO_ErekemRightGuardCellGUID, false); - HandleGameObject(GO_ErekemLeftGuardCellGUID, false); - HandleGameObject(GO_IchoronCellGUID, false); - HandleGameObject(GO_LavanthorCellGUID, false); - HandleGameObject(GO_XevozzCellGUID, false); - HandleGameObject(GO_ZuramatCellGUID, false); + // open main gate + HandleGameObject(GO_MainGateGUID, true); + + if (m_auiEncounter[MAX_ENCOUNTER-1] != DONE) // instance not finished + { + // close all cells + HandleGameObject(GO_MoraggCellGUID, false); + HandleGameObject(GO_ErekemCellGUID, false); + HandleGameObject(GO_ErekemRightGuardCellGUID, false); + HandleGameObject(GO_ErekemLeftGuardCellGUID, false); + HandleGameObject(GO_IchoronCellGUID, false); + HandleGameObject(GO_LavanthorCellGUID, false); + HandleGameObject(GO_XevozzCellGUID, false); + HandleGameObject(GO_ZuramatCellGUID, false); - // respawn bosses - if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_ErekemGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[0])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[1])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_IchoronGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_LavanthorGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_XevozzGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_ZuramatGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } - if (Creature* c = instance->GetCreature(NPC_CyanigosaGUID)) { c->DespawnOrUnsummon(); } - } + // respawn bosses + if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } + if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } + if (Creature* c = instance->GetCreature(NPC_ErekemGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } + if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[0])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } + if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[1])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } + if (Creature* c = instance->GetCreature(NPC_IchoronGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } + if (Creature* c = instance->GetCreature(NPC_LavanthorGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } + if (Creature* c = instance->GetCreature(NPC_XevozzGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } + if (Creature* c = instance->GetCreature(NPC_ZuramatGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); } + if (Creature* c = instance->GetCreature(NPC_CyanigosaGUID)) { c->DespawnOrUnsummon(); } + } - // reinitialize variables and events - DoUpdateWorldState(WORLD_STATE_VH_SHOW, 0); - EncounterStatus = NOT_STARTED; - GateHealth = 100; - WaveCount = 0; - bDefensesUsed = false; - if (m_auiEncounter[MAX_ENCOUNTER-1] == DONE) - EncounterStatus = DONE; - events.Reset(); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); - } + // reinitialize variables and events + DoUpdateWorldState(WORLD_STATE_VH_SHOW, 0); + EncounterStatus = NOT_STARTED; + GateHealth = 100; + WaveCount = 0; + bDefensesUsed = false; + if (m_auiEncounter[MAX_ENCOUNTER-1] == DONE) + EncounterStatus = DONE; + events.Reset(); + events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); + } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case CRITERIA_DEFENSELESS: - return GateHealth == 100 && !bDefensesUsed; - case CRITERIA_A_VOID_DANCE: - case CRITERIA_DEHYDRATION: - return bAchiev; - } - return false; - } + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case CRITERIA_DEFENSELESS: + return GateHealth == 100 && !bDefensesUsed; + case CRITERIA_A_VOID_DANCE: + case CRITERIA_DEHYDRATION: + return bAchiev; + } + return false; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "V H " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << uiFirstBoss << ' ' << uiSecondBoss; - str_data = saveStream.str(); + std::ostringstream saveStream; + saveStream << "V H " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << uiFirstBoss << ' ' << uiSecondBoss; + str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - EncounterStatus = NOT_STARTED; - CLEANED = false; - events.Reset(); - events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); + void Load(const char* in) + { + EncounterStatus = NOT_STARTED; + CLEANED = false; + events.Reset(); + events.RescheduleEvent(EVENT_CHECK_PLAYERS, 0); - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint32 data0, data1, data2, data3, data4; + char dataHead1, dataHead2; + uint32 data0, data1, data2, data3, data4; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; - if (dataHead1 == 'V' && dataHead2 == 'H') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - uiFirstBoss = data3; - uiSecondBoss = data4; + if (dataHead1 == 'V' && dataHead2 == 'H') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + uiFirstBoss = data3; + uiSecondBoss = data4; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; - if (m_auiEncounter[MAX_ENCOUNTER-1] == DONE) - EncounterStatus = DONE; - } - else OUT_LOAD_INST_DATA_FAIL; + if (m_auiEncounter[MAX_ENCOUNTER-1] == DONE) + EncounterStatus = DONE; + } + else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } - }; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; }; void AddSC_instance_violet_hold() { - new instance_violet_hold(); + new instance_violet_hold(); } diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 505fd098f..f467850b9 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -18,14 +18,14 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! class go_vh_activation_crystal : public GameObjectScript { public: - go_vh_activation_crystal() : GameObjectScript("go_vh_activation_crystal") { } + go_vh_activation_crystal() : GameObjectScript("go_vh_activation_crystal") { } - bool OnGossipHello(Player* pPlayer, GameObject* pGo) - { - if (InstanceScript* pInstance = pGo->GetInstanceScript()) - pInstance->SetData(DATA_ACTIVATE_DEFENSE_SYSTEM, 1); - return true; - } + bool OnGossipHello(Player* pPlayer, GameObject* pGo) + { + if (InstanceScript* pInstance = pGo->GetInstanceScript()) + pInstance->SetData(DATA_ACTIVATE_DEFENSE_SYSTEM, 1); + return true; + } }; /*********** @@ -33,54 +33,54 @@ public: ***********/ #define GOSSIP_START_EVENT "Get your people to safety, we'll keep the Blue Dragonflight's forces at bay." -#define GOSSIP_ITEM_1 "Activate the crystals when we get in trouble, right." -#define GOSSIP_I_WANT_IN "Sorry, I'm late! Can I get in to help my friends?" +#define GOSSIP_ITEM_1 "Activate the crystals when we get in trouble, right." +#define GOSSIP_I_WANT_IN "Sorry, I'm late! Can I get in to help my friends?" class npc_vh_sinclari : public CreatureScript { public: - npc_vh_sinclari() : CreatureScript("npc_vh_sinclari") { } + npc_vh_sinclari() : CreatureScript("npc_vh_sinclari") { } - bool OnGossipHello(Player* pPlayer, Creature* pCreature) - { - if (InstanceScript* pInstance = pCreature->GetInstanceScript()) - switch (pInstance->GetData(DATA_ENCOUNTER_STATUS)) - { - case NOT_STARTED: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); - break; - case IN_PROGRESS: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_I_WANT_IN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); - break; - default: // DONE or invalid - pPlayer->SEND_GOSSIP_MENU(13910, pCreature->GetGUID()); - } - return true; - } + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + switch (pInstance->GetData(DATA_ENCOUNTER_STATUS)) + { + case NOT_STARTED: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); + break; + case IN_PROGRESS: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_I_WANT_IN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); + break; + default: // DONE or invalid + pPlayer->SEND_GOSSIP_MENU(13910, pCreature->GetGUID()); + } + return true; + } - bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) - { - pPlayer->PlayerTalkClass->ClearMenus(); - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - if (InstanceScript *pInstance = pCreature->GetInstanceScript()) - pInstance->SetData(DATA_START_INSTANCE, 1); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->SEND_GOSSIP_MENU(13854, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->NearTeleportTo(playerTeleportPosition.GetPositionX(), playerTeleportPosition.GetPositionY(), playerTeleportPosition.GetPositionZ(), playerTeleportPosition.GetOrientation(), true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - return true; - } + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + pPlayer->PlayerTalkClass->ClearMenus(); + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + if (InstanceScript *pInstance = pCreature->GetInstanceScript()) + pInstance->SetData(DATA_START_INSTANCE, 1); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->SEND_GOSSIP_MENU(13854, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->NearTeleportTo(playerTeleportPosition.GetPositionX(), playerTeleportPosition.GetPositionY(), playerTeleportPosition.GetPositionZ(), playerTeleportPosition.GetOrientation(), true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + return true; + } }; /*********** @@ -89,148 +89,148 @@ public: enum PortalEvents { - EVENT_SUMMON_KEEPER_OR_GUARDIAN = 1, - EVENT_SUMMON_KEEPER_TRASH, - EVENT_SUMMON_ELITES, - EVENT_SUMMON_SABOTEOUR, - EVENT_CHECK_DEATHS, + EVENT_SUMMON_KEEPER_OR_GUARDIAN = 1, + EVENT_SUMMON_KEEPER_TRASH, + EVENT_SUMMON_ELITES, + EVENT_SUMMON_SABOTEOUR, + EVENT_CHECK_DEATHS, }; class npc_vh_teleportation_portal : public CreatureScript { public: - npc_vh_teleportation_portal() : CreatureScript("npc_vh_teleportation_portal") { } + npc_vh_teleportation_portal() : CreatureScript("npc_vh_teleportation_portal") { } - CreatureAI* GetAI(Creature *pCreature) const - { - return new npc_vh_teleportation_portalAI(pCreature); - } + CreatureAI* GetAI(Creature *pCreature) const + { + return new npc_vh_teleportation_portalAI(pCreature); + } - struct npc_vh_teleportation_portalAI : public NullCreatureAI - { - npc_vh_teleportation_portalAI(Creature *c) : NullCreatureAI(c), listOfMobs(me) - { - pInstance = c->GetInstanceScript(); - events.Reset(); - if (pInstance) - { - wave = pInstance->GetData(DATA_WAVE_COUNT); - bKorG = false; - spawned = false; + struct npc_vh_teleportation_portalAI : public NullCreatureAI + { + npc_vh_teleportation_portalAI(Creature *c) : NullCreatureAI(c), listOfMobs(me) + { + pInstance = c->GetInstanceScript(); + events.Reset(); + if (pInstance) + { + wave = pInstance->GetData(DATA_WAVE_COUNT); + bKorG = false; + spawned = false; - if (wave < 12) - addValue = 0; - else - addValue = 1; + if (wave < 12) + addValue = 0; + else + addValue = 1; - if (wave%6 != 0) - events.RescheduleEvent(RAND(EVENT_SUMMON_KEEPER_OR_GUARDIAN,EVENT_SUMMON_ELITES), 10000); - else - events.RescheduleEvent(EVENT_SUMMON_SABOTEOUR, 3000); - } - } + if (wave%6 != 0) + events.RescheduleEvent(RAND(EVENT_SUMMON_KEEPER_OR_GUARDIAN,EVENT_SUMMON_ELITES), 10000); + else + events.RescheduleEvent(EVENT_SUMMON_SABOTEOUR, 3000); + } + } - InstanceScript *pInstance; - SummonList listOfMobs; - EventMap events; - uint8 wave; - uint8 addValue; - bool bKorG; - bool spawned; + InstanceScript *pInstance; + SummonList listOfMobs; + EventMap events; + uint8 wave; + uint8 addValue; + bool bKorG; + bool spawned; - void UpdateAI(uint32 diff) - { - if (!pInstance) - return; + void UpdateAI(uint32 diff) + { + if (!pInstance) + return; - events.Update(diff); + events.Update(diff); - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_SUMMON_KEEPER_OR_GUARDIAN: - bKorG = true; - spawned = true; - if (Creature *c = DoSummon(RAND(NPC_PORTAL_GUARDIAN, NPC_PORTAL_KEEPER), me, 2.0f, 0, TEMPSUMMON_DEAD_DESPAWN)) - me->CastSpell(c, SPELL_PORTAL_CHANNEL, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_SUMMON_KEEPER_TRASH, 20000); - break; - case EVENT_SUMMON_KEEPER_TRASH: - for (uint8 i=0; i<3+addValue; ++i) - { - uint32 entry = RAND(NPC_AZURE_INVADER_1, NPC_AZURE_INVADER_2, NPC_AZURE_SPELLBREAKER_1, NPC_AZURE_SPELLBREAKER_2, NPC_AZURE_MAGE_SLAYER_1, NPC_AZURE_MAGE_SLAYER_2, NPC_AZURE_BINDER_1, NPC_AZURE_BINDER_2); - DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); - } - events.RepeatEvent(20000); - break; - case EVENT_SUMMON_ELITES: - spawned = true; - for (uint8 i=0; i<2+addValue; ++i) - { - uint32 entry = RAND(NPC_AZURE_CAPTAIN, NPC_AZURE_RAIDER, NPC_AZURE_STALKER, NPC_AZURE_SORCEROR); - DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); - } - me->SetVisible(false); - events.PopEvent(); - break; - case EVENT_SUMMON_SABOTEOUR: - DoSummon(NPC_SABOTEOUR, me, 2.0f, 0, TEMPSUMMON_CORPSE_DESPAWN); - me->DespawnOrUnsummon(3000); - events.PopEvent(); - break; - } + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_SUMMON_KEEPER_OR_GUARDIAN: + bKorG = true; + spawned = true; + if (Creature *c = DoSummon(RAND(NPC_PORTAL_GUARDIAN, NPC_PORTAL_KEEPER), me, 2.0f, 0, TEMPSUMMON_DEAD_DESPAWN)) + me->CastSpell(c, SPELL_PORTAL_CHANNEL, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_SUMMON_KEEPER_TRASH, 20000); + break; + case EVENT_SUMMON_KEEPER_TRASH: + for (uint8 i=0; i<3+addValue; ++i) + { + uint32 entry = RAND(NPC_AZURE_INVADER_1, NPC_AZURE_INVADER_2, NPC_AZURE_SPELLBREAKER_1, NPC_AZURE_SPELLBREAKER_2, NPC_AZURE_MAGE_SLAYER_1, NPC_AZURE_MAGE_SLAYER_2, NPC_AZURE_BINDER_1, NPC_AZURE_BINDER_2); + DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); + } + events.RepeatEvent(20000); + break; + case EVENT_SUMMON_ELITES: + spawned = true; + for (uint8 i=0; i<2+addValue; ++i) + { + uint32 entry = RAND(NPC_AZURE_CAPTAIN, NPC_AZURE_RAIDER, NPC_AZURE_STALKER, NPC_AZURE_SORCEROR); + DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); + } + me->SetVisible(false); + events.PopEvent(); + break; + case EVENT_SUMMON_SABOTEOUR: + DoSummon(NPC_SABOTEOUR, me, 2.0f, 0, TEMPSUMMON_CORPSE_DESPAWN); + me->DespawnOrUnsummon(3000); + events.PopEvent(); + break; + } - if (!spawned) - return; + if (!spawned) + return; - if (bKorG) - { - if (!me->IsNonMeleeSpellCast(false)) // keeper/guardian died => channeled spell interrupted - { - // if keeper/guard lost all victims, in enterevademode linking aura is removed, restore it: - if (pInstance) - for (SummonList::iterator itr = listOfMobs.begin(); itr != listOfMobs.end(); ++itr) - if (Creature* c = pInstance->instance->GetCreature(*itr)) - if (c->IsAlive() && (c->GetEntry() == NPC_PORTAL_GUARDIAN || c->GetEntry() == NPC_PORTAL_KEEPER)) - { - me->CastSpell(c, SPELL_PORTAL_CHANNEL, false); - return; - } - Unit::Kill(me, me, false); - } - } - else - { - if (listOfMobs.empty()) - Unit::Kill(me, me, false); - } - } + if (bKorG) + { + if (!me->IsNonMeleeSpellCast(false)) // keeper/guardian died => channeled spell interrupted + { + // if keeper/guard lost all victims, in enterevademode linking aura is removed, restore it: + if (pInstance) + for (SummonList::iterator itr = listOfMobs.begin(); itr != listOfMobs.end(); ++itr) + if (Creature* c = pInstance->instance->GetCreature(*itr)) + if (c->IsAlive() && (c->GetEntry() == NPC_PORTAL_GUARDIAN || c->GetEntry() == NPC_PORTAL_KEEPER)) + { + me->CastSpell(c, SPELL_PORTAL_CHANNEL, false); + return; + } + Unit::Kill(me, me, false); + } + } + else + { + if (listOfMobs.empty()) + Unit::Kill(me, me, false); + } + } - void JustDied(Unit* /*killer*/) - { - events.Reset(); - if (wave%6 == 0) // just to be sure, shouln't occur - return; - if (pInstance) - pInstance->SetData(DATA_PORTAL_DEFEATED, 0); - } + void JustDied(Unit* /*killer*/) + { + events.Reset(); + if (wave%6 == 0) // just to be sure, shouln't occur + return; + if (pInstance) + pInstance->SetData(DATA_PORTAL_DEFEATED, 0); + } - void JustSummoned(Creature *pSummoned) - { - listOfMobs.Summon(pSummoned); - if (pSummoned) - pInstance->SetData64(DATA_ADD_TRASH_MOB, pSummoned->GetGUID()); - } + void JustSummoned(Creature *pSummoned) + { + listOfMobs.Summon(pSummoned); + if (pSummoned) + pInstance->SetData64(DATA_ADD_TRASH_MOB, pSummoned->GetGUID()); + } - void SummonedMobDied(Creature *pSummoned) - { - listOfMobs.Despawn(pSummoned); - if (pSummoned) - pInstance->SetData64(DATA_DELETE_TRASH_MOB, pSummoned->GetGUID()); - } - }; + void SummonedMobDied(Creature *pSummoned) + { + listOfMobs.Despawn(pSummoned); + if (pSummoned) + pInstance->SetData64(DATA_DELETE_TRASH_MOB, pSummoned->GetGUID()); + } + }; }; /*********** @@ -239,150 +239,150 @@ public: struct violet_hold_trashAI : public npc_escortAI { - violet_hold_trashAI(Creature *c) : npc_escortAI(c) - { - pInstance = c->GetInstanceScript(); - if (pInstance) - PLoc = pInstance->GetData(DATA_PORTAL_LOCATION); - bAddedWP = false; - bAlt = false; - } + violet_hold_trashAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + if (pInstance) + PLoc = pInstance->GetData(DATA_PORTAL_LOCATION); + bAddedWP = false; + bAlt = false; + } - InstanceScript* pInstance; - bool bAddedWP; - uint32 PLoc; - bool bAlt; + InstanceScript* pInstance; + bool bAddedWP; + uint32 PLoc; + bool bAlt; - void ClearDoorSealAura() - { - if (pInstance) - if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_DOOR_SEAL_GUID))) - c->RemoveAura(SPELL_DESTROY_DOOR_SEAL, me->GetGUID()); - } + void ClearDoorSealAura() + { + if (pInstance) + if (Creature* c = pInstance->instance->GetCreature(pInstance->GetData64(DATA_DOOR_SEAL_GUID))) + c->RemoveAura(SPELL_DESTROY_DOOR_SEAL, me->GetGUID()); + } - void EnterCombat(Unit* who) - { - if (!who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - { - me->InterruptNonMeleeSpells(false); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - } - } + void EnterCombat(Unit* who) + { + if (!who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + { + me->InterruptNonMeleeSpells(false); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + } + } - void AttackStart(Unit* who) - { - if (!who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (!who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + ScriptedAI::AttackStart(who); + } - void JustReachedHome() - { - CreatureStartAttackDoor(); - } + void JustReachedHome() + { + CreatureStartAttackDoor(); + } - void WaypointReached(uint32 id) - { - if (PLoc<6) - if (id == PLocWPCount[PLoc] -1 -(bAlt ? 1 : 0)) - CreatureStartAttackDoor(); - } + void WaypointReached(uint32 id) + { + if (PLoc<6) + if (id == PLocWPCount[PLoc] -1 -(bAlt ? 1 : 0)) + CreatureStartAttackDoor(); + } - void MoveInLineOfSight(Unit* who) - { - ScriptedAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit* who) + { + ScriptedAI::MoveInLineOfSight(who); + } - void UpdateAI(uint32 diff) - { - if (!bAddedWP) - { - bAddedWP = true; - switch(PLoc) - { - case 0: - for(int i=0;i<6;i++) - AddWaypoint(i, FirstPortalTrashWPs[i][0]+irand(-1, 1), FirstPortalTrashWPs[i][1]+irand(-1, 1), FirstPortalTrashWPs[i][2]+irand(-1, 1), 0); - me->SetHomePosition(FirstPortalTrashWPs[5][0], FirstPortalTrashWPs[5][1], FirstPortalTrashWPs[5][2], 3.149439f); - break; - case 1: - bAlt = (bool)urand(0, 1); - if (!bAlt) - { - for(int i=0;i<9;i++) - AddWaypoint(i, SecondPortalTrashWPs1[i][0]+irand(-1, 1), SecondPortalTrashWPs1[i][1]+irand(-1, 1), SecondPortalTrashWPs1[i][2], 0); - me->SetHomePosition(SecondPortalTrashWPs1[8][0]+irand(-1, 1), SecondPortalTrashWPs1[8][1]+irand(-1, 1), SecondPortalTrashWPs1[8][2]+irand(-1, 1), 3.149439f); - } - else - { - for(int i=0;i<8;i++) - AddWaypoint(i, SecondPortalTrashWPs2[i][0]+irand(-1, 1), SecondPortalTrashWPs2[i][1]+irand(-1, 1), SecondPortalTrashWPs2[i][2], 0); - me->SetHomePosition(SecondPortalTrashWPs2[7][0], SecondPortalTrashWPs2[7][1], SecondPortalTrashWPs2[7][2], 3.149439f); - } - break; - case 2: - for(int i=0;i<8;i++) - AddWaypoint(i, ThirdPortalTrashWPs[i][0]+irand(-1, 1), ThirdPortalTrashWPs[i][1]+irand(-1, 1), ThirdPortalTrashWPs[i][2], 0); - me->SetHomePosition(ThirdPortalTrashWPs[7][0], ThirdPortalTrashWPs[7][1], ThirdPortalTrashWPs[7][2], 3.149439f); - break; - case 3: - for(int i=0;i<9;i++) - AddWaypoint(i, FourthPortalTrashWPs[i][0]+irand(-1, 1), FourthPortalTrashWPs[i][1]+irand(-1, 1), FourthPortalTrashWPs[i][2], 0); - me->SetHomePosition(FourthPortalTrashWPs[8][0], FourthPortalTrashWPs[8][1], FourthPortalTrashWPs[8][2], 3.149439f); - break; - case 4: - for(int i=0;i<6;i++) - AddWaypoint(i, FifthPortalTrashWPs[i][0]+irand(-1, 1), FifthPortalTrashWPs[i][1]+irand(-1, 1), FifthPortalTrashWPs[i][2], 0); - me->SetHomePosition(FifthPortalTrashWPs[5][0], FifthPortalTrashWPs[5][1], FifthPortalTrashWPs[5][2], 3.149439f); - break; - case 5: - for(int i=0;i<4;i++) - AddWaypoint(i, SixthPoralTrashWPs[i][0]+irand(-1, 1), SixthPoralTrashWPs[i][1]+irand(-1, 1), SixthPoralTrashWPs[i][2], 0); - me->SetHomePosition(SixthPoralTrashWPs[3][0], SixthPoralTrashWPs[3][1], SixthPoralTrashWPs[3][2], 3.149439f); - break; - } - SetDespawnAtEnd(false); - Start(true, true); - } + void UpdateAI(uint32 diff) + { + if (!bAddedWP) + { + bAddedWP = true; + switch(PLoc) + { + case 0: + for(int i=0;i<6;i++) + AddWaypoint(i, FirstPortalTrashWPs[i][0]+irand(-1, 1), FirstPortalTrashWPs[i][1]+irand(-1, 1), FirstPortalTrashWPs[i][2]+irand(-1, 1), 0); + me->SetHomePosition(FirstPortalTrashWPs[5][0], FirstPortalTrashWPs[5][1], FirstPortalTrashWPs[5][2], 3.149439f); + break; + case 1: + bAlt = (bool)urand(0, 1); + if (!bAlt) + { + for(int i=0;i<9;i++) + AddWaypoint(i, SecondPortalTrashWPs1[i][0]+irand(-1, 1), SecondPortalTrashWPs1[i][1]+irand(-1, 1), SecondPortalTrashWPs1[i][2], 0); + me->SetHomePosition(SecondPortalTrashWPs1[8][0]+irand(-1, 1), SecondPortalTrashWPs1[8][1]+irand(-1, 1), SecondPortalTrashWPs1[8][2]+irand(-1, 1), 3.149439f); + } + else + { + for(int i=0;i<8;i++) + AddWaypoint(i, SecondPortalTrashWPs2[i][0]+irand(-1, 1), SecondPortalTrashWPs2[i][1]+irand(-1, 1), SecondPortalTrashWPs2[i][2], 0); + me->SetHomePosition(SecondPortalTrashWPs2[7][0], SecondPortalTrashWPs2[7][1], SecondPortalTrashWPs2[7][2], 3.149439f); + } + break; + case 2: + for(int i=0;i<8;i++) + AddWaypoint(i, ThirdPortalTrashWPs[i][0]+irand(-1, 1), ThirdPortalTrashWPs[i][1]+irand(-1, 1), ThirdPortalTrashWPs[i][2], 0); + me->SetHomePosition(ThirdPortalTrashWPs[7][0], ThirdPortalTrashWPs[7][1], ThirdPortalTrashWPs[7][2], 3.149439f); + break; + case 3: + for(int i=0;i<9;i++) + AddWaypoint(i, FourthPortalTrashWPs[i][0]+irand(-1, 1), FourthPortalTrashWPs[i][1]+irand(-1, 1), FourthPortalTrashWPs[i][2], 0); + me->SetHomePosition(FourthPortalTrashWPs[8][0], FourthPortalTrashWPs[8][1], FourthPortalTrashWPs[8][2], 3.149439f); + break; + case 4: + for(int i=0;i<6;i++) + AddWaypoint(i, FifthPortalTrashWPs[i][0]+irand(-1, 1), FifthPortalTrashWPs[i][1]+irand(-1, 1), FifthPortalTrashWPs[i][2], 0); + me->SetHomePosition(FifthPortalTrashWPs[5][0], FifthPortalTrashWPs[5][1], FifthPortalTrashWPs[5][2], 3.149439f); + break; + case 5: + for(int i=0;i<4;i++) + AddWaypoint(i, SixthPoralTrashWPs[i][0]+irand(-1, 1), SixthPoralTrashWPs[i][1]+irand(-1, 1), SixthPoralTrashWPs[i][2], 0); + me->SetHomePosition(SixthPoralTrashWPs[3][0], SixthPoralTrashWPs[3][1], SixthPoralTrashWPs[3][2], 3.149439f); + break; + } + SetDespawnAtEnd(false); + Start(true, true); + } - npc_escortAI::UpdateAI(diff); - } + npc_escortAI::UpdateAI(diff); + } - void JustDied(Unit* /*unit*/) - { - if (pInstance) - if (Creature* portal = ObjectAccessor::GetCreature((*me), pInstance->GetData64(DATA_TELEPORTATION_PORTAL_GUID))) - CAST_AI(npc_vh_teleportation_portal::npc_vh_teleportation_portalAI, portal->AI())->SummonedMobDied(me); - } + void JustDied(Unit* /*unit*/) + { + if (pInstance) + if (Creature* portal = ObjectAccessor::GetCreature((*me), pInstance->GetData64(DATA_TELEPORTATION_PORTAL_GUID))) + CAST_AI(npc_vh_teleportation_portal::npc_vh_teleportation_portalAI, portal->AI())->SummonedMobDied(me); + } - void CreatureStartAttackDoor() - { - RemoveEscortState(STATE_ESCORT_ESCORTING | STATE_ESCORT_RETURNING | STATE_ESCORT_PAUSED); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->CastSpell((Unit*)NULL, SPELL_DESTROY_DOOR_SEAL, true); - } + void CreatureStartAttackDoor() + { + RemoveEscortState(STATE_ESCORT_ESCORTING | STATE_ESCORT_RETURNING | STATE_ESCORT_PAUSED); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->CastSpell((Unit*)NULL, SPELL_DESTROY_DOOR_SEAL, true); + } - void EnterEvadeMode() - { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); - me->SetHomePosition(1845.577759f+rand_norm()*5-2.5f, 800.681152f+rand_norm()*5-2.5f, 44.104248f, M_PI); - } + void EnterEvadeMode() + { + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetHomePosition(1845.577759f+rand_norm()*5-2.5f, 800.681152f+rand_norm()*5-2.5f, 44.104248f, M_PI); + } - me->DeleteThreatList(); - me->CombatStop(true); - if (HasEscortState(STATE_ESCORT_ESCORTING)) - { - AddEscortState(STATE_ESCORT_RETURNING); - ReturnToLastPoint(); - } - else - { - me->GetMotionMaster()->MoveTargetedHome(); - Reset(); - } - me->ClearUnitState(UNIT_STATE_EVADE); - } + me->DeleteThreatList(); + me->CombatStop(true); + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + AddEscortState(STATE_ESCORT_RETURNING); + ReturnToLastPoint(); + } + else + { + me->GetMotionMaster()->MoveTargetedHome(); + Reset(); + } + me->ClearUnitState(UNIT_STATE_EVADE); + } }; /*********** @@ -390,75 +390,75 @@ struct violet_hold_trashAI : public npc_escortAI ***********/ enum AzureInvaderSpells -{ - SPELL_CLEAVE = 15496, - SPELL_IMPALE_N = 58459, - SPELL_IMPALE_H = 59256, - SPELL_BRUTAL_STRIKE = 58460, - SPELL_SUNDER_ARMOR = 58461, +{ + SPELL_CLEAVE = 15496, + SPELL_IMPALE_N = 58459, + SPELL_IMPALE_H = 59256, + SPELL_BRUTAL_STRIKE = 58460, + SPELL_SUNDER_ARMOR = 58461, }; -#define SPELL_IMPALE DUNGEON_MODE(SPELL_IMPALE_N, SPELL_IMPALE_H) +#define SPELL_IMPALE DUNGEON_MODE(SPELL_IMPALE_N, SPELL_IMPALE_H) enum AzureSpellbreakerSpells { - SPELL_ARCANE_BLAST_N = 58462, - SPELL_ARCANE_BLAST_H = 59257, - SPELL_SLOW = 25603, - SPELL_CHAINS_OF_ICE = 58464, - SPELL_CONE_OF_COLD_N = 58463, - SPELL_CONE_OF_COLD_H = 59258 + SPELL_ARCANE_BLAST_N = 58462, + SPELL_ARCANE_BLAST_H = 59257, + SPELL_SLOW = 25603, + SPELL_CHAINS_OF_ICE = 58464, + SPELL_CONE_OF_COLD_N = 58463, + SPELL_CONE_OF_COLD_H = 59258 }; -#define SPELL_ARCANE_BLAST DUNGEON_MODE(SPELL_ARCANE_BLAST_N, SPELL_ARCANE_BLAST_H) -#define SPELL_CONE_OF_COLD DUNGEON_MODE(SPELL_CONE_OF_COLD_N, SPELL_CONE_OF_COLD_H) +#define SPELL_ARCANE_BLAST DUNGEON_MODE(SPELL_ARCANE_BLAST_N, SPELL_ARCANE_BLAST_H) +#define SPELL_CONE_OF_COLD DUNGEON_MODE(SPELL_CONE_OF_COLD_N, SPELL_CONE_OF_COLD_H) enum AzureBinderSpells { - SPELL_ARCANE_BARRAGE_N = 58456, - SPELL_ARCANE_BARRAGE_H = 59248, - SPELL_ARCANE_EXPLOSION_N = 58455, - SPELL_ARCANE_EXPLOSION_H = 59245, - SPELL_FROST_NOVA_N = 58458, - SPELL_FROST_NOVA_H = 59253, - SPELL_FROSTBOLT_N = 58457, - SPELL_FROSTBOLT_H = 59251, + SPELL_ARCANE_BARRAGE_N = 58456, + SPELL_ARCANE_BARRAGE_H = 59248, + SPELL_ARCANE_EXPLOSION_N = 58455, + SPELL_ARCANE_EXPLOSION_H = 59245, + SPELL_FROST_NOVA_N = 58458, + SPELL_FROST_NOVA_H = 59253, + SPELL_FROSTBOLT_N = 58457, + SPELL_FROSTBOLT_H = 59251, }; -#define SPELL_ARCANE_BARRAGE DUNGEON_MODE(SPELL_ARCANE_BARRAGE_N, SPELL_ARCANE_BARRAGE_H) -#define SPELL_ARCANE_EXPLOSION DUNGEON_MODE(SPELL_ARCANE_EXPLOSION_N, SPELL_ARCANE_EXPLOSION_H) -#define SPELL_FROST_NOVA DUNGEON_MODE(SPELL_FROST_NOVA_N, SPELL_FROST_NOVA_H) -#define SPELL_FROSTBOLT DUNGEON_MODE(SPELL_FROSTBOLT_N, SPELL_FROSTBOLT_H) +#define SPELL_ARCANE_BARRAGE DUNGEON_MODE(SPELL_ARCANE_BARRAGE_N, SPELL_ARCANE_BARRAGE_H) +#define SPELL_ARCANE_EXPLOSION DUNGEON_MODE(SPELL_ARCANE_EXPLOSION_N, SPELL_ARCANE_EXPLOSION_H) +#define SPELL_FROST_NOVA DUNGEON_MODE(SPELL_FROST_NOVA_N, SPELL_FROST_NOVA_H) +#define SPELL_FROSTBOLT DUNGEON_MODE(SPELL_FROSTBOLT_N, SPELL_FROSTBOLT_H) enum AzureMageSlayerSpells { - SPELL_ARCANE_EMPOWERMENT = 58469, - SPELL_SPELL_LOCK = 30849 + SPELL_ARCANE_EMPOWERMENT = 58469, + SPELL_SPELL_LOCK = 30849 }; enum AzureCaptainSpells { - SPELL_MORTAL_STRIKE = 32736, - SPELL_WHIRLWIND_OF_STEEL = 41056 + SPELL_MORTAL_STRIKE = 32736, + SPELL_WHIRLWIND_OF_STEEL = 41056 }; enum AzureSorcerorSpells { - SPELL_ARCANE_STREAM_N = 60181, - SPELL_ARCANE_STREAM_H = 60204, - SPELL_MANA_DETONATION_N = 60182, - SPELL_MANA_DETONATION_H = 60205 + SPELL_ARCANE_STREAM_N = 60181, + SPELL_ARCANE_STREAM_H = 60204, + SPELL_MANA_DETONATION_N = 60182, + SPELL_MANA_DETONATION_H = 60205 }; -#define SPELL_ARCANE_STREAM DUNGEON_MODE(SPELL_ARCANE_STREAM_N, SPELL_ARCANE_STREAM_H) -#define SPELL_MANA_DETONATION DUNGEON_MODE(SPELL_MANA_DETONATION_N, SPELL_MANA_DETONATION_H) +#define SPELL_ARCANE_STREAM DUNGEON_MODE(SPELL_ARCANE_STREAM_N, SPELL_ARCANE_STREAM_H) +#define SPELL_MANA_DETONATION DUNGEON_MODE(SPELL_MANA_DETONATION_N, SPELL_MANA_DETONATION_H) enum AzureRaiderSpells { - SPELL_CONCUSSION_BLOW = 52719, - SPELL_MAGIC_REFLECTION = 60158 + SPELL_CONCUSSION_BLOW = 52719, + SPELL_MAGIC_REFLECTION = 60158 }; enum AzureStalkerSpells { - SPELL_BACKSTAB = 58471, - SPELL_TACTICAL_BLINK = 58470 + SPELL_BACKSTAB = 58471, + SPELL_TACTICAL_BLINK = 58470 }; /*********** @@ -468,72 +468,72 @@ enum AzureStalkerSpells class npc_azure_invader : public CreatureScript { public: - npc_azure_invader() : CreatureScript("npc_azure_invader") { } + npc_azure_invader() : CreatureScript("npc_azure_invader") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_azure_invaderAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_azure_invaderAI (pCreature); + } - struct npc_azure_invaderAI : public violet_hold_trashAI - { - npc_azure_invaderAI(Creature *c) : violet_hold_trashAI(c) {} + struct npc_azure_invaderAI : public violet_hold_trashAI + { + npc_azure_invaderAI(Creature *c) : violet_hold_trashAI(c) {} - uint32 uiCleaveTimer; - uint32 uiImpaleTimer; - uint32 uiBrutalStrikeTimer; - uint32 uiSunderArmorTimer; + uint32 uiCleaveTimer; + uint32 uiImpaleTimer; + uint32 uiBrutalStrikeTimer; + uint32 uiSunderArmorTimer; - void Reset() - { - uiCleaveTimer = 5000; - uiImpaleTimer = 4000; - uiBrutalStrikeTimer = 5000; - uiSunderArmorTimer = 4000; - } + void Reset() + { + uiCleaveTimer = 5000; + uiImpaleTimer = 4000; + uiBrutalStrikeTimer = 5000; + uiSunderArmorTimer = 4000; + } - void UpdateAI(uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (me->GetEntry() == NPC_AZURE_INVADER_1) - { - if (uiCleaveTimer <= diff) - { - DoCast(me->GetVictim(), SPELL_CLEAVE); - uiCleaveTimer = 5000; - } else uiCleaveTimer -= diff; + if (me->GetEntry() == NPC_AZURE_INVADER_1) + { + if (uiCleaveTimer <= diff) + { + DoCast(me->GetVictim(), SPELL_CLEAVE); + uiCleaveTimer = 5000; + } else uiCleaveTimer -= diff; - if (uiImpaleTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 5.0f, true); - if (pTarget) - DoCast(pTarget, SPELL_IMPALE); - uiImpaleTimer = 4000; - } else uiImpaleTimer -= diff; - } + if (uiImpaleTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 5.0f, true); + if (pTarget) + DoCast(pTarget, SPELL_IMPALE); + uiImpaleTimer = 4000; + } else uiImpaleTimer -= diff; + } - if (me->GetEntry() == NPC_AZURE_INVADER_2) - { - if (uiBrutalStrikeTimer <= diff) - { - DoCast(me->GetVictim(), SPELL_BRUTAL_STRIKE); - uiBrutalStrikeTimer = 5000; - } else uiBrutalStrikeTimer -= diff; + if (me->GetEntry() == NPC_AZURE_INVADER_2) + { + if (uiBrutalStrikeTimer <= diff) + { + DoCast(me->GetVictim(), SPELL_BRUTAL_STRIKE); + uiBrutalStrikeTimer = 5000; + } else uiBrutalStrikeTimer -= diff; - if (uiSunderArmorTimer <= diff) - { - DoCast(me->GetVictim(), SPELL_SUNDER_ARMOR); - uiSunderArmorTimer = urand(8000, 10000); - } else uiSunderArmorTimer -= diff; - } + if (uiSunderArmorTimer <= diff) + { + DoCast(me->GetVictim(), SPELL_SUNDER_ARMOR); + uiSunderArmorTimer = urand(8000, 10000); + } else uiSunderArmorTimer -= diff; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; @@ -541,411 +541,411 @@ public: class npc_azure_binder : public CreatureScript { public: - npc_azure_binder() : CreatureScript("npc_azure_binder") { } + npc_azure_binder() : CreatureScript("npc_azure_binder") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_azure_binderAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_azure_binderAI (pCreature); + } - struct npc_azure_binderAI : public violet_hold_trashAI - { - npc_azure_binderAI(Creature *c) : violet_hold_trashAI(c) {} + struct npc_azure_binderAI : public violet_hold_trashAI + { + npc_azure_binderAI(Creature *c) : violet_hold_trashAI(c) {} - uint32 uiArcaneExplosionTimer; - uint32 uiArcainBarrageTimer; - uint32 uiFrostNovaTimer; - uint32 uiFrostboltTimer; + uint32 uiArcaneExplosionTimer; + uint32 uiArcainBarrageTimer; + uint32 uiFrostNovaTimer; + uint32 uiFrostboltTimer; - void Reset() - { - uiArcaneExplosionTimer = 5000; - uiArcainBarrageTimer = 4000; - uiFrostNovaTimer = 5000; - uiFrostboltTimer = 4000; - } + void Reset() + { + uiArcaneExplosionTimer = 5000; + uiArcainBarrageTimer = 4000; + uiFrostNovaTimer = 5000; + uiFrostboltTimer = 4000; + } - void UpdateAI(uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (me->GetEntry() == NPC_AZURE_BINDER_1) - { - if (uiArcaneExplosionTimer <= diff) - { - DoCast(SPELL_ARCANE_EXPLOSION); - uiArcaneExplosionTimer = 5000; - } else uiArcaneExplosionTimer -= diff; + if (me->GetEntry() == NPC_AZURE_BINDER_1) + { + if (uiArcaneExplosionTimer <= diff) + { + DoCast(SPELL_ARCANE_EXPLOSION); + uiArcaneExplosionTimer = 5000; + } else uiArcaneExplosionTimer -= diff; - if (uiArcainBarrageTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); - if (pTarget) - DoCast(pTarget, SPELL_ARCANE_BARRAGE); - uiArcainBarrageTimer = 6000; - } else uiArcainBarrageTimer -= diff; - } + if (uiArcainBarrageTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); + if (pTarget) + DoCast(pTarget, SPELL_ARCANE_BARRAGE); + uiArcainBarrageTimer = 6000; + } else uiArcainBarrageTimer -= diff; + } - if (me->GetEntry() == NPC_AZURE_BINDER_2) - { - if (uiFrostNovaTimer <= diff) - { - DoCast(SPELL_FROST_NOVA); - uiFrostNovaTimer = 5000; - } else uiFrostNovaTimer -= diff; + if (me->GetEntry() == NPC_AZURE_BINDER_2) + { + if (uiFrostNovaTimer <= diff) + { + DoCast(SPELL_FROST_NOVA); + uiFrostNovaTimer = 5000; + } else uiFrostNovaTimer -= diff; - if (uiFrostboltTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true); - if (pTarget) - DoCast(pTarget, SPELL_FROSTBOLT); - uiFrostboltTimer = 6000; - } else uiFrostboltTimer -= diff; - } + if (uiFrostboltTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true); + if (pTarget) + DoCast(pTarget, SPELL_FROSTBOLT); + uiFrostboltTimer = 6000; + } else uiFrostboltTimer -= diff; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_azure_mage_slayer : public CreatureScript { public: - npc_azure_mage_slayer() : CreatureScript("npc_azure_mage_slayer") { } + npc_azure_mage_slayer() : CreatureScript("npc_azure_mage_slayer") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_azure_mage_slayerAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_azure_mage_slayerAI (pCreature); + } - struct npc_azure_mage_slayerAI : public violet_hold_trashAI - { - npc_azure_mage_slayerAI(Creature *c) : violet_hold_trashAI(c) {} + struct npc_azure_mage_slayerAI : public violet_hold_trashAI + { + npc_azure_mage_slayerAI(Creature *c) : violet_hold_trashAI(c) {} - uint32 uiArcaneEmpowermentTimer; - uint32 uiSpellLockTimer; + uint32 uiArcaneEmpowermentTimer; + uint32 uiSpellLockTimer; - void Reset() - { - uiArcaneEmpowermentTimer = 5000; - uiSpellLockTimer = 5000; - } + void Reset() + { + uiArcaneEmpowermentTimer = 5000; + uiSpellLockTimer = 5000; + } - void UpdateAI(uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (me->GetEntry() == NPC_AZURE_MAGE_SLAYER_1) - { - if (uiArcaneEmpowermentTimer <= diff) - { - DoCast(me, SPELL_ARCANE_EMPOWERMENT); - uiArcaneEmpowermentTimer = 14000; - } else uiArcaneEmpowermentTimer -= diff; - } + if (me->GetEntry() == NPC_AZURE_MAGE_SLAYER_1) + { + if (uiArcaneEmpowermentTimer <= diff) + { + DoCast(me, SPELL_ARCANE_EMPOWERMENT); + uiArcaneEmpowermentTimer = 14000; + } else uiArcaneEmpowermentTimer -= diff; + } - if (me->GetEntry() == NPC_AZURE_MAGE_SLAYER_2) - { - if (uiSpellLockTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); - if (pTarget) - DoCast(pTarget, SPELL_SPELL_LOCK); - uiSpellLockTimer = 9000; - } else uiSpellLockTimer -= diff; - } + if (me->GetEntry() == NPC_AZURE_MAGE_SLAYER_2) + { + if (uiSpellLockTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); + if (pTarget) + DoCast(pTarget, SPELL_SPELL_LOCK); + uiSpellLockTimer = 9000; + } else uiSpellLockTimer -= diff; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_azure_raider : public CreatureScript { public: - npc_azure_raider() : CreatureScript("npc_azure_raider") { } + npc_azure_raider() : CreatureScript("npc_azure_raider") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_azure_raiderAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_azure_raiderAI (pCreature); + } - struct npc_azure_raiderAI : public violet_hold_trashAI - { - npc_azure_raiderAI(Creature *c) : violet_hold_trashAI(c) {} + struct npc_azure_raiderAI : public violet_hold_trashAI + { + npc_azure_raiderAI(Creature *c) : violet_hold_trashAI(c) {} - uint32 uiConcussionBlowTimer; - uint32 uiMagicReflectionTimer; + uint32 uiConcussionBlowTimer; + uint32 uiMagicReflectionTimer; - void Reset() - { - uiConcussionBlowTimer = 5000; - uiMagicReflectionTimer = 8000; - } + void Reset() + { + uiConcussionBlowTimer = 5000; + uiMagicReflectionTimer = 8000; + } - void UpdateAI(uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (uiConcussionBlowTimer <= diff) - { - DoCast(me->GetVictim(), SPELL_CONCUSSION_BLOW); - uiConcussionBlowTimer = 5000; - } else uiConcussionBlowTimer -= diff; + if (uiConcussionBlowTimer <= diff) + { + DoCast(me->GetVictim(), SPELL_CONCUSSION_BLOW); + uiConcussionBlowTimer = 5000; + } else uiConcussionBlowTimer -= diff; - if (uiMagicReflectionTimer <= diff) - { - DoCast(SPELL_MAGIC_REFLECTION); - uiMagicReflectionTimer = urand(10000, 15000); - } else uiMagicReflectionTimer -= diff; + if (uiMagicReflectionTimer <= diff) + { + DoCast(SPELL_MAGIC_REFLECTION); + uiMagicReflectionTimer = urand(10000, 15000); + } else uiMagicReflectionTimer -= diff; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_azure_stalker : public CreatureScript { public: - npc_azure_stalker() : CreatureScript("npc_azure_stalker") { } + npc_azure_stalker() : CreatureScript("npc_azure_stalker") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_azure_stalkerAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_azure_stalkerAI (pCreature); + } - struct npc_azure_stalkerAI : public violet_hold_trashAI - { - npc_azure_stalkerAI(Creature *c) : violet_hold_trashAI(c) {} + struct npc_azure_stalkerAI : public violet_hold_trashAI + { + npc_azure_stalkerAI(Creature *c) : violet_hold_trashAI(c) {} - uint32 uiBackstabTimer; - uint32 uiTacticalBlinkTimer; - bool TacticalBlinkCasted; + uint32 uiBackstabTimer; + uint32 uiTacticalBlinkTimer; + bool TacticalBlinkCasted; - void Reset() - { - uiBackstabTimer = 1300; - uiTacticalBlinkTimer = 8000; - TacticalBlinkCasted =false; - } + void Reset() + { + uiBackstabTimer = 1300; + uiTacticalBlinkTimer = 8000; + TacticalBlinkCasted =false; + } - void UpdateAI(uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - /*if (!TacticalBlinkCasted) - { - if (uiTacticalBlinkTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true); - if (pTarget) - DoCast(pTarget, SPELL_TACTICAL_BLINK); - uiTacticalBlinkTimer = 10000; - TacticalBlinkCasted = true; - } else uiTacticalBlinkTimer -= diff; - } + /*if (!TacticalBlinkCasted) + { + if (uiTacticalBlinkTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true); + if (pTarget) + DoCast(pTarget, SPELL_TACTICAL_BLINK); + uiTacticalBlinkTimer = 10000; + TacticalBlinkCasted = true; + } else uiTacticalBlinkTimer -= diff; + } - else*/ - { - if (uiBackstabTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0, 5.0f, true); - if (pTarget && !pTarget->HasInArc(M_PI, me)) - DoCast(pTarget, SPELL_BACKSTAB); - TacticalBlinkCasted = false; - uiBackstabTimer = 4000; - } else uiBackstabTimer -= diff; - } + else*/ + { + if (uiBackstabTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0, 5.0f, true); + if (pTarget && !pTarget->HasInArc(M_PI, me)) + DoCast(pTarget, SPELL_BACKSTAB); + TacticalBlinkCasted = false; + uiBackstabTimer = 4000; + } else uiBackstabTimer -= diff; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_azure_spellbreaker : public CreatureScript { public: - npc_azure_spellbreaker() : CreatureScript("npc_azure_spellbreaker") { } + npc_azure_spellbreaker() : CreatureScript("npc_azure_spellbreaker") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_azure_spellbreakerAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_azure_spellbreakerAI (pCreature); + } - struct npc_azure_spellbreakerAI : public violet_hold_trashAI - { - npc_azure_spellbreakerAI(Creature* c) : violet_hold_trashAI(c) {} + struct npc_azure_spellbreakerAI : public violet_hold_trashAI + { + npc_azure_spellbreakerAI(Creature* c) : violet_hold_trashAI(c) {} - uint32 uiArcaneBlastTimer; - uint32 uiSlowTimer; - uint32 uiChainsOfIceTimer; - uint32 uiConeOfColdTimer; + uint32 uiArcaneBlastTimer; + uint32 uiSlowTimer; + uint32 uiChainsOfIceTimer; + uint32 uiConeOfColdTimer; - void Reset() - { - uiArcaneBlastTimer = 5000; - uiSlowTimer = 4000; - uiChainsOfIceTimer = 5000; - uiConeOfColdTimer = 4000; - } + void Reset() + { + uiArcaneBlastTimer = 5000; + uiSlowTimer = 4000; + uiChainsOfIceTimer = 5000; + uiConeOfColdTimer = 4000; + } - void UpdateAI(uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (me->GetEntry() == NPC_AZURE_SPELLBREAKER_1) - { - if (uiArcaneBlastTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); - if (pTarget) - DoCast(pTarget, SPELL_ARCANE_BLAST); - uiArcaneBlastTimer = 6000; - } else uiArcaneBlastTimer -= diff; + if (me->GetEntry() == NPC_AZURE_SPELLBREAKER_1) + { + if (uiArcaneBlastTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); + if (pTarget) + DoCast(pTarget, SPELL_ARCANE_BLAST); + uiArcaneBlastTimer = 6000; + } else uiArcaneBlastTimer -= diff; - if (uiSlowTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); - if (pTarget) - DoCast(pTarget, SPELL_SLOW); - uiSlowTimer = 5000; - } else uiSlowTimer -= diff; - } + if (uiSlowTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); + if (pTarget) + DoCast(pTarget, SPELL_SLOW); + uiSlowTimer = 5000; + } else uiSlowTimer -= diff; + } - if (me->GetEntry() == NPC_AZURE_SPELLBREAKER_2) - { - if (uiChainsOfIceTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); - if (pTarget) - DoCast(pTarget, SPELL_CHAINS_OF_ICE); - uiChainsOfIceTimer = 7000; - } else uiChainsOfIceTimer -= diff; + if (me->GetEntry() == NPC_AZURE_SPELLBREAKER_2) + { + if (uiChainsOfIceTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); + if (pTarget) + DoCast(pTarget, SPELL_CHAINS_OF_ICE); + uiChainsOfIceTimer = 7000; + } else uiChainsOfIceTimer -= diff; - if (uiConeOfColdTimer <= diff) - { - DoCast(SPELL_CONE_OF_COLD); - uiConeOfColdTimer = 5000; - } else uiConeOfColdTimer -= diff; - } + if (uiConeOfColdTimer <= diff) + { + DoCast(SPELL_CONE_OF_COLD); + uiConeOfColdTimer = 5000; + } else uiConeOfColdTimer -= diff; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_azure_captain : public CreatureScript { public: - npc_azure_captain() : CreatureScript("npc_azure_captain") { } + npc_azure_captain() : CreatureScript("npc_azure_captain") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_azure_captainAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_azure_captainAI (pCreature); + } - struct npc_azure_captainAI : public violet_hold_trashAI - { - npc_azure_captainAI(Creature *c) : violet_hold_trashAI(c) {} + struct npc_azure_captainAI : public violet_hold_trashAI + { + npc_azure_captainAI(Creature *c) : violet_hold_trashAI(c) {} - uint32 uiMortalStrikeTimer; - uint32 uiWhirlwindTimer; + uint32 uiMortalStrikeTimer; + uint32 uiWhirlwindTimer; - void Reset() - { - uiMortalStrikeTimer = 5000; - uiWhirlwindTimer = 8000; - } + void Reset() + { + uiMortalStrikeTimer = 5000; + uiWhirlwindTimer = 8000; + } - void UpdateAI(uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (uiMortalStrikeTimer <= diff) - { - DoCast(me->GetVictim(), SPELL_MORTAL_STRIKE); - uiMortalStrikeTimer = 5000; - } else uiMortalStrikeTimer -= diff; + if (uiMortalStrikeTimer <= diff) + { + DoCast(me->GetVictim(), SPELL_MORTAL_STRIKE); + uiMortalStrikeTimer = 5000; + } else uiMortalStrikeTimer -= diff; - if (uiWhirlwindTimer <= diff) - { - DoCastAOE(SPELL_WHIRLWIND_OF_STEEL); - uiWhirlwindTimer = 8000; - } else uiWhirlwindTimer -= diff; + if (uiWhirlwindTimer <= diff) + { + DoCastAOE(SPELL_WHIRLWIND_OF_STEEL); + uiWhirlwindTimer = 8000; + } else uiWhirlwindTimer -= diff; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class npc_azure_sorceror : public CreatureScript { public: - npc_azure_sorceror() : CreatureScript("npc_azure_sorceror") { } + npc_azure_sorceror() : CreatureScript("npc_azure_sorceror") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_azure_sorcerorAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_azure_sorcerorAI (pCreature); + } - struct npc_azure_sorcerorAI : public violet_hold_trashAI - { - npc_azure_sorcerorAI(Creature *c) : violet_hold_trashAI(c) {} + struct npc_azure_sorcerorAI : public violet_hold_trashAI + { + npc_azure_sorcerorAI(Creature *c) : violet_hold_trashAI(c) {} - uint32 uiArcaneStreamTimer; - uint32 uiArcaneStreamTimerStartingValueHolder; - uint32 uiManaDetonationTimer; + uint32 uiArcaneStreamTimer; + uint32 uiArcaneStreamTimerStartingValueHolder; + uint32 uiManaDetonationTimer; - void Reset() - { - uiArcaneStreamTimer = 4000; - uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; - uiManaDetonationTimer = 5000; - } + void Reset() + { + uiArcaneStreamTimer = 4000; + uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; + uiManaDetonationTimer = 5000; + } - void UpdateAI(uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (uiArcaneStreamTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true); - if (pTarget) - DoCast(pTarget, SPELL_ARCANE_STREAM); - uiArcaneStreamTimer = urand(0, 5000)+5000; - uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; - } else uiArcaneStreamTimer -= diff; + if (uiArcaneStreamTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 35.0f, true); + if (pTarget) + DoCast(pTarget, SPELL_ARCANE_STREAM); + uiArcaneStreamTimer = urand(0, 5000)+5000; + uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; + } else uiArcaneStreamTimer -= diff; - if (uiManaDetonationTimer <= diff && uiArcaneStreamTimer >=1500 && uiArcaneStreamTimer <= uiArcaneStreamTimerStartingValueHolder/2) - { - DoCastAOE(SPELL_MANA_DETONATION); - uiManaDetonationTimer = urand(2000, 6000); - } else uiManaDetonationTimer -= diff; + if (uiManaDetonationTimer <= diff && uiArcaneStreamTimer >=1500 && uiArcaneStreamTimer <= uiArcaneStreamTimerStartingValueHolder/2) + { + DoCastAOE(SPELL_MANA_DETONATION); + uiManaDetonationTimer = urand(2000, 6000); + } else uiManaDetonationTimer -= diff; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; /*********** @@ -954,9 +954,9 @@ public: enum AzureSaboteurSpells { - SABOTEUR_SHIELD_DISRUPTION = 58291, - SABOTEUR_SHIELD_EFFECT = 45775, - SPELL_TELEPORT_VISUAL = 52096, + SABOTEUR_SHIELD_DISRUPTION = 58291, + SABOTEUR_SHIELD_EFFECT = 45775, + SPELL_TELEPORT_VISUAL = 52096, }; class npc_azure_saboteur : public CreatureScript @@ -974,24 +974,24 @@ public: npc_azure_saboteurAI(Creature *c) : npc_escortAI(c) { pInstance = c->GetInstanceScript(); - uiBoss = 0; - if (pInstance) - uiBoss = pInstance->GetData(DATA_WAVE_COUNT) == 6 ? pInstance->GetData(DATA_FIRST_BOSS_NUMBER) : pInstance->GetData(DATA_SECOND_BOSS_NUMBER); + uiBoss = 0; + if (pInstance) + uiBoss = pInstance->GetData(DATA_WAVE_COUNT) == 6 ? pInstance->GetData(DATA_FIRST_BOSS_NUMBER) : pInstance->GetData(DATA_SECOND_BOSS_NUMBER); bAddedWPs = false; - bOpening = false; + bOpening = false; } InstanceScript* pInstance; bool bAddedWPs; - uint8 uiBoss; - bool bOpening; - uint32 timer; - uint8 count; + uint8 uiBoss; + bool bOpening; + uint32 timer; + uint8 count; void WaypointReached(uint32 uiWPointId) { - if (!pInstance) - return; + if (!pInstance) + return; switch(uiBoss) { @@ -1064,45 +1064,45 @@ public: Start(true, true); } - if (bOpening) - { - if (timer <= diff) - { - if (count < 2) - { - me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); - timer = 1000; - } - else if (count == 2) - { - me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); - if (pInstance) - pInstance->SetData(DATA_RELEASE_BOSS, 0); - timer = 500; - } - else - { - bOpening = false; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(11686); - me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); - me->DespawnOrUnsummon(1000); - } - ++count; - } - else timer -= diff; - } + if (bOpening) + { + if (timer <= diff) + { + if (count < 2) + { + me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); + timer = 1000; + } + else if (count == 2) + { + me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); + if (pInstance) + pInstance->SetData(DATA_RELEASE_BOSS, 0); + timer = 500; + } + else + { + bOpening = false; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11686); + me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); + me->DespawnOrUnsummon(1000); + } + ++count; + } + else timer -= diff; + } } void FinishPointReached() { - bOpening = true; - timer = 1000; - count = 0; + bOpening = true; + timer = 1000; + count = 0; me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} }; }; @@ -1113,63 +1113,63 @@ public: class spell_destroy_door_seal : public SpellScriptLoader { public: - spell_destroy_door_seal() : SpellScriptLoader("spell_destroy_door_seal") { } + spell_destroy_door_seal() : SpellScriptLoader("spell_destroy_door_seal") { } - class spell_destroy_door_sealAuraScript : public AuraScript - { - PrepareAuraScript(spell_destroy_door_sealAuraScript) + class spell_destroy_door_sealAuraScript : public AuraScript + { + PrepareAuraScript(spell_destroy_door_sealAuraScript) - void HandleEffectPeriodic(AuraEffect const * aurEff) - { - PreventDefaultAction(); - if (Unit* target = GetTarget()) - if (InstanceScript* pInstance = target->GetInstanceScript()) - pInstance->SetData(DATA_DECRASE_DOOR_HEALTH, 0); - } + void HandleEffectPeriodic(AuraEffect const * aurEff) + { + PreventDefaultAction(); + if (Unit* target = GetTarget()) + if (InstanceScript* pInstance = target->GetInstanceScript()) + pInstance->SetData(DATA_DECRASE_DOOR_HEALTH, 0); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_destroy_door_sealAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_destroy_door_sealAuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript *GetAuraScript() const - { - return new spell_destroy_door_sealAuraScript(); - } + AuraScript *GetAuraScript() const + { + return new spell_destroy_door_sealAuraScript(); + } }; class go_violet_hold_gate_lever : public GameObjectScript { public: - go_violet_hold_gate_lever() : GameObjectScript("go_violet_hold_gate_lever") { } + go_violet_hold_gate_lever() : GameObjectScript("go_violet_hold_gate_lever") { } - bool OnGossipHello(Player* plr, GameObject* go) - { - if (GameObject* gate = go->GetMap()->GetGameObject(MAKE_NEW_GUID(61606, 193019, HIGHGUID_GAMEOBJECT))) - if (gate->getLootState() == GO_READY) - gate->UseDoorOrButton(0, false, plr); - return false; - } + bool OnGossipHello(Player* plr, GameObject* go) + { + if (GameObject* gate = go->GetMap()->GetGameObject(MAKE_NEW_GUID(61606, 193019, HIGHGUID_GAMEOBJECT))) + if (gate->getLootState() == GO_READY) + gate->UseDoorOrButton(0, false, plr); + return false; + } }; void AddSC_violet_hold() { - new go_vh_activation_crystal(); - new npc_vh_sinclari(); - new npc_vh_teleportation_portal(); - new npc_azure_saboteur(); + new go_vh_activation_crystal(); + new npc_vh_sinclari(); + new npc_vh_teleportation_portal(); + new npc_azure_saboteur(); - new npc_azure_invader(); - new npc_azure_spellbreaker(); - new npc_azure_binder(); - new npc_azure_mage_slayer(); - new npc_azure_captain(); - new npc_azure_sorceror(); - new npc_azure_raider(); - new npc_azure_stalker(); + new npc_azure_invader(); + new npc_azure_spellbreaker(); + new npc_azure_binder(); + new npc_azure_mage_slayer(); + new npc_azure_captain(); + new npc_azure_sorceror(); + new npc_azure_raider(); + new npc_azure_stalker(); - new spell_destroy_door_seal(); - new go_violet_hold_gate_lever(); + new spell_destroy_door_seal(); + new go_violet_hold_gate_lever(); } diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.h b/src/server/scripts/Northrend/VioletHold/violet_hold.h index c652cba1f..8ed4fa80b 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.h +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.h @@ -9,127 +9,127 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! enum Creatures { - NPC_TELEPORTATION_PORTAL = 31011, - NPC_DEFENSE_SYSTEM = 30837, - NPC_PRISON_DOOR_SEAL = 30896, - NPC_DEFENSE_DUMMY_TARGET = 30857, + NPC_TELEPORTATION_PORTAL = 31011, + NPC_DEFENSE_SYSTEM = 30837, + NPC_PRISON_DOOR_SEAL = 30896, + NPC_DEFENSE_DUMMY_TARGET = 30857, - NPC_SINCLARI = 30658, - NPC_VIOLET_HOLD_GUARD = 30659, - NPC_SABOTEOUR = 31079, + NPC_SINCLARI = 30658, + NPC_VIOLET_HOLD_GUARD = 30659, + NPC_SABOTEOUR = 31079, - NPC_XEVOZZ = 29266, - NPC_LAVANTHOR = 29312, - NPC_ICHORON = 29313, - NPC_ZURAMAT = 29314, - NPC_EREKEM = 29315, - NPC_EREKEM_GUARD = 29395, - NPC_MORAGG = 29316, - NPC_CYANIGOSA = 31134, + NPC_XEVOZZ = 29266, + NPC_LAVANTHOR = 29312, + NPC_ICHORON = 29313, + NPC_ZURAMAT = 29314, + NPC_EREKEM = 29315, + NPC_EREKEM_GUARD = 29395, + NPC_MORAGG = 29316, + NPC_CYANIGOSA = 31134, - NPC_PORTAL_GUARDIAN = 30660, - NPC_PORTAL_KEEPER = 30695, - NPC_AZURE_INVADER_1 = 30661, - NPC_AZURE_INVADER_2 = 30961, - NPC_AZURE_SPELLBREAKER_1 = 30662, - NPC_AZURE_SPELLBREAKER_2 = 30962, - NPC_AZURE_BINDER_1 = 30663, - NPC_AZURE_BINDER_2 = 30918, - NPC_AZURE_MAGE_SLAYER_1 = 30664, - NPC_AZURE_MAGE_SLAYER_2 = 30963, - NPC_AZURE_CAPTAIN = 30666, - NPC_AZURE_SORCEROR = 30667, - NPC_AZURE_RAIDER = 30668, - NPC_AZURE_STALKER = 32191, + NPC_PORTAL_GUARDIAN = 30660, + NPC_PORTAL_KEEPER = 30695, + NPC_AZURE_INVADER_1 = 30661, + NPC_AZURE_INVADER_2 = 30961, + NPC_AZURE_SPELLBREAKER_1 = 30662, + NPC_AZURE_SPELLBREAKER_2 = 30962, + NPC_AZURE_BINDER_1 = 30663, + NPC_AZURE_BINDER_2 = 30918, + NPC_AZURE_MAGE_SLAYER_1 = 30664, + NPC_AZURE_MAGE_SLAYER_2 = 30963, + NPC_AZURE_CAPTAIN = 30666, + NPC_AZURE_SORCEROR = 30667, + NPC_AZURE_RAIDER = 30668, + NPC_AZURE_STALKER = 32191, }; enum GameObjects { - GO_MAIN_DOOR = 191723, - GO_XEVOZZ_DOOR = 191556, - GO_LAVANTHOR_DOOR = 191566, - GO_ICHORON_DOOR = 191722, - GO_ZURAMAT_DOOR = 191565, - GO_EREKEM_DOOR = 191564, - GO_EREKEM_GUARD_1_DOOR = 191563, - GO_EREKEM_GUARD_2_DOOR = 191562, - GO_MORAGG_DOOR = 191606, - GO_INTRO_ACTIVATION_CRYSTAL = 193615, - GO_ACTIVATION_CRYSTAL = 193611, + GO_MAIN_DOOR = 191723, + GO_XEVOZZ_DOOR = 191556, + GO_LAVANTHOR_DOOR = 191566, + GO_ICHORON_DOOR = 191722, + GO_ZURAMAT_DOOR = 191565, + GO_EREKEM_DOOR = 191564, + GO_EREKEM_GUARD_1_DOOR = 191563, + GO_EREKEM_GUARD_2_DOOR = 191562, + GO_MORAGG_DOOR = 191606, + GO_INTRO_ACTIVATION_CRYSTAL = 193615, + GO_ACTIVATION_CRYSTAL = 193611, }; enum Bosses { - BOSS_NONE, - BOSS_MORAGG, - BOSS_EREKEM, - BOSS_ICHORON, - BOSS_LAVANTHOR, - BOSS_XEVOZZ, - BOSS_ZURAMAT, - BOSS_CYANIGOSA + BOSS_NONE, + BOSS_MORAGG, + BOSS_EREKEM, + BOSS_ICHORON, + BOSS_LAVANTHOR, + BOSS_XEVOZZ, + BOSS_ZURAMAT, + BOSS_CYANIGOSA }; enum VHWorldStates { - WORLD_STATE_VH_SHOW = 3816, - WORLD_STATE_VH_PRISON_STATE = 3815, - WORLD_STATE_VH_WAVE_COUNT = 3810, + WORLD_STATE_VH_SHOW = 3816, + WORLD_STATE_VH_PRISON_STATE = 3815, + WORLD_STATE_VH_WAVE_COUNT = 3810, }; enum Spells { - SPELL_CONTROL_CRYSTAL_ACTIVATION= 57804, - SPELL_ARCANE_LIGHTNING = 57912, - SPELL_ARCANE_LIGHTNING_VISUAL = 57930, - SPELL_PORTAL_CHANNEL = 58012, - SPELL_DESTROY_DOOR_SEAL = 58040, - SPELL_CYANIGOSA_TRANSFORM = 58668, - SPELL_CYANIGOSA_BLUE_AURA = 45870, + SPELL_CONTROL_CRYSTAL_ACTIVATION= 57804, + SPELL_ARCANE_LIGHTNING = 57912, + SPELL_ARCANE_LIGHTNING_VISUAL = 57930, + SPELL_PORTAL_CHANNEL = 58012, + SPELL_DESTROY_DOOR_SEAL = 58040, + SPELL_CYANIGOSA_TRANSFORM = 58668, + SPELL_CYANIGOSA_BLUE_AURA = 45870, }; enum Events { - EVENT_CHECK_PLAYERS = 1, - EVENT_GUARDS_FALL_BACK, - EVENT_GUARDS_DISAPPEAR, - EVENT_SINCLARI_FALL_BACK, - EVENT_START_ENCOUNTER, - EVENT_SUMMON_PORTAL, - EVENT_CYANIGOSSA_TRANSFORM, - EVENT_CYANIGOSA_ATTACK, + EVENT_CHECK_PLAYERS = 1, + EVENT_GUARDS_FALL_BACK, + EVENT_GUARDS_DISAPPEAR, + EVENT_SINCLARI_FALL_BACK, + EVENT_START_ENCOUNTER, + EVENT_SUMMON_PORTAL, + EVENT_CYANIGOSSA_TRANSFORM, + EVENT_CYANIGOSA_ATTACK, }; enum Data { - DATA_ACTIVATE_DEFENSE_SYSTEM = 1, - DATA_ENCOUNTER_STATUS, - DATA_START_INSTANCE, - DATA_ADD_TRASH_MOB, - DATA_DELETE_TRASH_MOB, - DATA_PORTAL_DEFEATED, - DATA_WAVE_COUNT, - DATA_PORTAL_LOCATION, - DATA_TELEPORTATION_PORTAL_GUID, - DATA_DOOR_SEAL_GUID, - DATA_FIRST_BOSS_NUMBER, - DATA_SECOND_BOSS_NUMBER, - DATA_RELEASE_BOSS, - DATA_DECRASE_DOOR_HEALTH, - DATA_BOSS_DIED, - DATA_FAILED, - DATA_EREKEM_GUID, - DATA_EREKEM_GUARD_1_GUID, - DATA_EREKEM_GUARD_2_GUID, - DATA_ICHORON_GUID, - DATA_ACHIEV, + DATA_ACTIVATE_DEFENSE_SYSTEM = 1, + DATA_ENCOUNTER_STATUS, + DATA_START_INSTANCE, + DATA_ADD_TRASH_MOB, + DATA_DELETE_TRASH_MOB, + DATA_PORTAL_DEFEATED, + DATA_WAVE_COUNT, + DATA_PORTAL_LOCATION, + DATA_TELEPORTATION_PORTAL_GUID, + DATA_DOOR_SEAL_GUID, + DATA_FIRST_BOSS_NUMBER, + DATA_SECOND_BOSS_NUMBER, + DATA_RELEASE_BOSS, + DATA_DECRASE_DOOR_HEALTH, + DATA_BOSS_DIED, + DATA_FAILED, + DATA_EREKEM_GUID, + DATA_EREKEM_GUARD_1_GUID, + DATA_EREKEM_GUARD_2_GUID, + DATA_ICHORON_GUID, + DATA_ACHIEV, }; enum AchievCriteria { - CRITERIA_DEFENSELESS = 6803, - CRITERIA_A_VOID_DANCE = 7587, - CRITERIA_DEHYDRATION = 7320, + CRITERIA_DEFENSELESS = 6803, + CRITERIA_A_VOID_DANCE = 7587, + CRITERIA_DEHYDRATION = 7320, }; /************** @@ -157,12 +157,12 @@ const uint8 PLocWPCount[6] = {6,9,8,9,6,4}; const Position PortalLocations[] = { - {1877.51f, 850.104f, 44.6599f, 4.78220f}, - {1918.37f, 853.437f, 47.1624f, 4.12294f}, - {1936.07f, 803.198f, 53.3749f, 3.12414f}, - {1927.61f, 758.436f, 51.4533f, 2.20891f}, - {1890.64f, 753.471f, 48.7224f, 1.71042f}, - {1908.31f, 809.657f, 38.7037f, 3.08701f}, + {1877.51f, 850.104f, 44.6599f, 4.78220f}, + {1918.37f, 853.437f, 47.1624f, 4.12294f}, + {1936.07f, 803.198f, 53.3749f, 3.12414f}, + {1927.61f, 758.436f, 51.4533f, 2.20891f}, + {1890.64f, 753.471f, 48.7224f, 1.71042f}, + {1908.31f, 809.657f, 38.7037f, 3.08701f}, }; const float FirstPortalTrashWPs [6][3] = diff --git a/src/server/scripts/Northrend/isle_of_conquest.cpp b/src/server/scripts/Northrend/isle_of_conquest.cpp index 95ed14945..f731c4bfa 100644 --- a/src/server/scripts/Northrend/isle_of_conquest.cpp +++ b/src/server/scripts/Northrend/isle_of_conquest.cpp @@ -26,7 +26,7 @@ enum eIoCTurrent { - EVENT_RESTORE_FLAG = 1 + EVENT_RESTORE_FLAG = 1 }; class npc_isle_of_conquest_turret : public CreatureScript @@ -36,48 +36,48 @@ class npc_isle_of_conquest_turret : public CreatureScript struct npc_isle_of_conquest_turretAI : public VehicleAI { - npc_isle_of_conquest_turretAI(Creature* creature) : VehicleAI(creature), faction(0) { } + npc_isle_of_conquest_turretAI(Creature* creature) : VehicleAI(creature), faction(0) { } - uint32 faction; - EventMap events; + uint32 faction; + EventMap events; void JustDied(Unit* ) - { - if (me->GetEntry() == NPC_KEEP_CANNON) - { - faction = me->getFaction(); - me->Respawn(); - me->UpdateEntry(NPC_BROKEN_KEEP_CANNON, NULL, false); - me->RemoveVehicleKit(); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - } - } + { + if (me->GetEntry() == NPC_KEEP_CANNON) + { + faction = me->getFaction(); + me->Respawn(); + me->UpdateEntry(NPC_BROKEN_KEEP_CANNON, NULL, false); + me->RemoveVehicleKit(); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + } + } - void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) - { - if (spellInfo->Id == SPELL_REPAIR_TURRET_DUMMY && me->GetEntry() == NPC_BROKEN_KEEP_CANNON) - { - me->UpdateEntry(NPC_KEEP_CANNON, NULL, false); - if (faction) - me->setFaction(faction); - me->CreateVehicleKit(510, NPC_KEEP_CANNON); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - events.ScheduleEvent(EVENT_RESTORE_FLAG, 4000); - } - } + void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) + { + if (spellInfo->Id == SPELL_REPAIR_TURRET_DUMMY && me->GetEntry() == NPC_BROKEN_KEEP_CANNON) + { + me->UpdateEntry(NPC_KEEP_CANNON, NULL, false); + if (faction) + me->setFaction(faction); + me->CreateVehicleKit(510, NPC_KEEP_CANNON); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + events.ScheduleEvent(EVENT_RESTORE_FLAG, 4000); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_RESTORE_FLAG: - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - break; - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_RESTORE_FLAG: + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + break; + } - VehicleAI::UpdateAI(diff); - } + VehicleAI::UpdateAI(diff); + } }; CreatureAI* GetAI(Creature* creature) const @@ -125,11 +125,11 @@ class npc_four_car_garage : public CreatureScript } } - void JustDied(Unit* killer) - { - if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, me); - } + void JustDied(Unit* killer) + { + if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, me); + } }; CreatureAI* GetAI(Creature* creature) const @@ -202,18 +202,18 @@ class npc_ioc_gunship_captain : public CreatureScript enum BossIoCEvents { - EVENT_CHECK_RAGE = 1, - EVENT_BRUTAL_STRIKE = 2, - EVENT_CRUSHING_LEAP = 3, - EVENT_DAGGER_THROW = 4, + EVENT_CHECK_RAGE = 1, + EVENT_BRUTAL_STRIKE = 2, + EVENT_CRUSHING_LEAP = 3, + EVENT_DAGGER_THROW = 4, }; enum BossIoCSpells { - SPELL_IOCBOSS_BRUTAL_STRIKE = 58460, - SPELL_IOCBOSS_CRUSHING_LEAP = 68506, - SPELL_IOCBOSS_DAGGER_THROW = 67280, - SPELL_IOCBOSS_RAGE = 66776, + SPELL_IOCBOSS_BRUTAL_STRIKE = 58460, + SPELL_IOCBOSS_CRUSHING_LEAP = 68506, + SPELL_IOCBOSS_DAGGER_THROW = 67280, + SPELL_IOCBOSS_RAGE = 66776, }; class boss_isle_of_conquest : public CreatureScript @@ -225,75 +225,75 @@ class boss_isle_of_conquest : public CreatureScript { boss_isle_of_conquestAI(Creature* creature) : ScriptedAI(creature) { } - EventMap events; - bool rage; - void Reset() - { - events.Reset(); - rage = false; - } + EventMap events; + bool rage; + void Reset() + { + events.Reset(); + rage = false; + } - void CheckRageBuff() - { - if (!rage) - { - if (me->GetDistance(me->GetHomePosition()) > 40.0f) - { - rage = true; - me->CastSpell(me, SPELL_IOCBOSS_RAGE, true); - } - } - else - { - if (me->GetDistance(me->GetHomePosition()) < 40.0f && abs(me->GetPositionZ() - me->GetHomePosition().GetPositionZ()) < 5.0f) - { - rage = false; - me->RemoveAurasDueToSpell(SPELL_IOCBOSS_RAGE); - } - } - } + void CheckRageBuff() + { + if (!rage) + { + if (me->GetDistance(me->GetHomePosition()) > 40.0f) + { + rage = true; + me->CastSpell(me, SPELL_IOCBOSS_RAGE, true); + } + } + else + { + if (me->GetDistance(me->GetHomePosition()) < 40.0f && abs(me->GetPositionZ() - me->GetHomePosition().GetPositionZ()) < 5.0f) + { + rage = false; + me->RemoveAurasDueToSpell(SPELL_IOCBOSS_RAGE); + } + } + } - void EnterCombat(Unit* who) - { - events.ScheduleEvent(EVENT_CHECK_RAGE, 2000); - events.ScheduleEvent(EVENT_BRUTAL_STRIKE, 6000); - events.ScheduleEvent(EVENT_CRUSHING_LEAP, 22000); - events.ScheduleEvent(EVENT_DAGGER_THROW, 10000); - } + void EnterCombat(Unit* who) + { + events.ScheduleEvent(EVENT_CHECK_RAGE, 2000); + events.ScheduleEvent(EVENT_BRUTAL_STRIKE, 6000); + events.ScheduleEvent(EVENT_CRUSHING_LEAP, 22000); + events.ScheduleEvent(EVENT_DAGGER_THROW, 10000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_CHECK_RAGE: - CheckRageBuff(); - events.RepeatEvent(2000); - break; - case EVENT_BRUTAL_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_IOCBOSS_BRUTAL_STRIKE, false); - events.RepeatEvent(6000); - break; - case EVENT_CRUSHING_LEAP: - me->CastSpell(me, SPELL_IOCBOSS_CRUSHING_LEAP, false); - events.RepeatEvent(22000); - break; - case EVENT_DAGGER_THROW: - if (Unit* tgt = SelectTarget(SELECT_TARGET_RANDOM)) - me->CastSpell(tgt, SPELL_IOCBOSS_DAGGER_THROW, false); - - events.RepeatEvent(10000); - break; - } + switch (events.GetEvent()) + { + case EVENT_CHECK_RAGE: + CheckRageBuff(); + events.RepeatEvent(2000); + break; + case EVENT_BRUTAL_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_IOCBOSS_BRUTAL_STRIKE, false); + events.RepeatEvent(6000); + break; + case EVENT_CRUSHING_LEAP: + me->CastSpell(me, SPELL_IOCBOSS_CRUSHING_LEAP, false); + events.RepeatEvent(22000); + break; + case EVENT_DAGGER_THROW: + if (Unit* tgt = SelectTarget(SELECT_TARGET_RANDOM)) + me->CastSpell(tgt, SPELL_IOCBOSS_DAGGER_THROW, false); + + events.RepeatEvent(10000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -331,11 +331,11 @@ class spell_ioc_repair_turret : public SpellScriptLoader enum blastCriteria { - SPELL_SEAFORIUM_BLAST = 66676, - SPELL_HUGE_SEAFORIUM_BLAST = 66672, + SPELL_SEAFORIUM_BLAST = 66676, + SPELL_HUGE_SEAFORIUM_BLAST = 66672, - SPELL_BOMB_INABLE_CREDIT = 68366, - SPELL_BOMB_INATION_CREDIT = 68367, + SPELL_BOMB_INABLE_CREDIT = 68366, + SPELL_BOMB_INATION_CREDIT = 68367, }; class spell_ioc_bomb_blast_criteria : public SpellScriptLoader @@ -347,16 +347,16 @@ class spell_ioc_bomb_blast_criteria : public SpellScriptLoader { PrepareSpellScript(spell_ioc_bomb_blast_criteria_SpellScript); - void HandleGameObjectDamage(SpellEffIndex effIndex) + void HandleGameObjectDamage(SpellEffIndex effIndex) { - Unit* owner = GetCaster()->GetOwner(); - if (!owner) - return; + Unit* owner = GetCaster()->GetOwner(); + if (!owner) + return; - if (GetSpellInfo()->Id == SPELL_SEAFORIUM_BLAST) - owner->CastSpell(owner, SPELL_BOMB_INABLE_CREDIT, true); - else if (GetSpellInfo()->Id == SPELL_HUGE_SEAFORIUM_BLAST) - owner->CastSpell(owner, SPELL_BOMB_INATION_CREDIT, true); + if (GetSpellInfo()->Id == SPELL_SEAFORIUM_BLAST) + owner->CastSpell(owner, SPELL_BOMB_INABLE_CREDIT, true); + else if (GetSpellInfo()->Id == SPELL_HUGE_SEAFORIUM_BLAST) + owner->CastSpell(owner, SPELL_BOMB_INATION_CREDIT, true); } void Register() @@ -387,7 +387,7 @@ class spell_ioc_gunship_portal : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); + PreventHitDefaultEffect(effIndex); /*Player* caster = GetCaster()->ToPlayer(); /* * HACK: GetWorldLocation() returns real position and not transportposition. @@ -397,16 +397,16 @@ class spell_ioc_gunship_portal : public SpellScriptLoader * Transport Position X: 0 Y: 0 Z: 0 O: 0 * Position: X: 7.305609 Y: -0.095246 Z: 34.51022 O: 0 - caster->TeleportTo(GetHitCreature()->GetWorldLocation(), TELE_TO_NOT_LEAVE_TRANSPORT);*/ + caster->TeleportTo(GetHitCreature()->GetWorldLocation(), TELE_TO_NOT_LEAVE_TRANSPORT);*/ } void HandleScript2(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); + PreventHitDefaultEffect(effIndex); Player* caster = GetCaster()->ToPlayer(); - if (!caster->IsBeingTeleported()) - if (Battleground* bg = caster->GetBattleground()) - bg->DoAction(2 /**/, caster->GetGUID()); + if (!caster->IsBeingTeleported()) + if (Battleground* bg = caster->GetBattleground()) + bg->DoAction(2 /**/, caster->GetGUID()); } void Register() @@ -472,13 +472,13 @@ class spell_ioc_launch : public SpellScriptLoader if (Player* player = GetHitPlayer()) { player->ExitVehicle(); - player->DisableSpline(); - player->GetMap()->PlayerRelocation(player, GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ(), GetCaster()->GetOrientation()); + player->DisableSpline(); + player->GetMap()->PlayerRelocation(player, GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), GetCaster()->GetPositionZ(), GetCaster()->GetOrientation()); float dist = position->GetExactDist2d(player->GetPositionX(), player->GetPositionY()); - float elevation = GetSpell()->m_targets.GetElevation(); - float speedZ = std::max(10.0f, float(50.0f * sin(elevation))); - float speedXY = dist * 10.0f / speedZ; + float elevation = GetSpell()->m_targets.GetElevation(); + float speedZ = std::max(10.0f, float(50.0f * sin(elevation))); + float speedXY = dist * 10.0f / speedZ; player->GetMotionMaster()->MoveJump(position->GetPositionX(), position->GetPositionY(), position->GetPositionZ(), speedXY, speedZ); } @@ -499,13 +499,13 @@ class spell_ioc_launch : public SpellScriptLoader void AddSC_isle_of_conquest() { - new npc_isle_of_conquest_turret(); + new npc_isle_of_conquest_turret(); new npc_four_car_garage(); - new npc_ioc_gunship_captain(); - new boss_isle_of_conquest(); - new spell_ioc_repair_turret(); - new spell_ioc_bomb_blast_criteria(); - new spell_ioc_gunship_portal(); - new spell_ioc_parachute_ic(); - new spell_ioc_launch(); + new npc_ioc_gunship_captain(); + new boss_isle_of_conquest(); + new spell_ioc_repair_turret(); + new spell_ioc_bomb_blast_criteria(); + new spell_ioc_gunship_portal(); + new spell_ioc_parachute_ic(); + new spell_ioc_launch(); } diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 4b09d1ff9..b22630bec 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -46,8 +46,8 @@ EndContentData */ // Ours enum eDrakeHunt { - SPELL_DRAKE_HATCHLING_SUBDUED = 46691, - SPELL_SUBDUED = 46675 + SPELL_DRAKE_HATCHLING_SUBDUED = 46691, + SPELL_SUBDUED = 46675 }; class spell_q11919_q11940_drake_hunt : public SpellScriptLoader @@ -59,32 +59,32 @@ public: { PrepareAuraScript(spell_q11919_q11940_drake_hunt_AuraScript) - bool Load() - { - return GetOwner()->GetTypeId() == TYPEID_UNIT; - } - - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + bool Load() { - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE || !GetCaster()) - return; + return GetOwner()->GetTypeId() == TYPEID_UNIT; + } - Creature* owner = GetOwner()->ToCreature(); - owner->RemoveAllAurasExceptType(SPELL_AURA_DUMMY); - owner->CombatStop(true); - owner->DeleteThreatList(); - owner->GetMotionMaster()->Clear(false); - owner->GetMotionMaster()->MoveFollow(GetCaster(), 4.0f, M_PI, MOTION_SLOT_ACTIVE); - owner->CastSpell(owner, SPELL_SUBDUED, true); - GetCaster()->CastSpell(GetCaster(), SPELL_DRAKE_HATCHLING_SUBDUED, true); - owner->setFaction(35); - owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - owner->DespawnOrUnsummon(3*MINUTE*IN_MILLISECONDS); + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE || !GetCaster()) + return; + + Creature* owner = GetOwner()->ToCreature(); + owner->RemoveAllAurasExceptType(SPELL_AURA_DUMMY); + owner->CombatStop(true); + owner->DeleteThreatList(); + owner->GetMotionMaster()->Clear(false); + owner->GetMotionMaster()->MoveFollow(GetCaster(), 4.0f, M_PI, MOTION_SLOT_ACTIVE); + owner->CastSpell(owner, SPELL_SUBDUED, true); + GetCaster()->CastSpell(GetCaster(), SPELL_DRAKE_HATCHLING_SUBDUED, true); + owner->setFaction(35); + owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + owner->DespawnOrUnsummon(3*MINUTE*IN_MILLISECONDS); } void Register() { - AfterEffectRemove += AuraEffectRemoveFn(spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -140,7 +140,7 @@ public: if (player && player->GetQuestStatus(QUEST_PLUG_THE_SINKHOLES) == QUEST_STATUS_INCOMPLETE) { phase = 1; - phaseTimer = 0; + phaseTimer = 0; casterGuid = caster->GetGUID(); } } @@ -188,7 +188,7 @@ public: DoCast(me, SPELL_EXPLODE_CART, true); if (Unit* worm = me->FindNearestCreature(NPC_SCOURGED_BURROWER, 3.0f)) { - Unit::Kill(me, worm); + Unit::Kill(me, worm); worm->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } phaseTimer = 2000; @@ -202,7 +202,7 @@ public: phase = 8; break; default: - CreatureAI::EnterEvadeMode(); + CreatureAI::EnterEvadeMode(); break; } } else phaseTimer -= diff; @@ -536,7 +536,7 @@ public: if (npc_escortAI* pEscortAI = CAST_AI(npc_lurgglbr::npc_lurgglbrAI, creature->AI())) pEscortAI->Start(true, false, player->GetGUID()); - creature->setFaction(player->GetTeamId() == TEAM_ALLIANCE ? FACTION_ESCORTEE_A : FACTION_ESCORTEE_H); + creature->setFaction(player->GetTeamId() == TEAM_ALLIANCE ? FACTION_ESCORTEE_A : FACTION_ESCORTEE_H); return true; } return false; @@ -549,7 +549,7 @@ public: enum BerylSorcerer { - NPC_BERYL_SORCERER = 25316, + NPC_BERYL_SORCERER = 25316, NPC_CAPTURED_BERLY_SORCERER = 25474, NPC_LIBRARIAN_DONATHAN = 25262, @@ -571,7 +571,7 @@ public: void Reset() { - me->UpdateEntry(NPC_BERYL_SORCERER); + me->UpdateEntry(NPC_BERYL_SORCERER); me->SetReactState(REACT_AGGRESSIVE); bEnslaved = false; } @@ -591,7 +591,7 @@ public: StartFollow(pCaster->ToPlayer(), 0, NULL); me->UpdateEntry(NPC_CAPTURED_BERLY_SORCERER, NULL, false); DoCast(me, SPELL_COSMETIC_ENSLAVE_CHAINS_SELF, true); - me->DespawnOrUnsummon(45000); + me->DespawnOrUnsummon(45000); if (Player* player = pCaster->ToPlayer()) player->KilledMonsterCredit(NPC_CAPTURED_BERLY_SORCERER, 0); @@ -663,9 +663,9 @@ public: rebuff = 0; - // xinef: correct visuals - me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), 150.517f, me->GetOrientation(), true); - me->SetStandState(UNIT_STAND_STATE_SIT_MEDIUM_CHAIR); + // xinef: correct visuals + me->UpdatePosition(me->GetPositionX(), me->GetPositionY(), 150.517f, me->GetOrientation(), true); + me->SetStandState(UNIT_STAND_STATE_SIT_MEDIUM_CHAIR); } void UpdateAI(uint32 diff) @@ -765,7 +765,7 @@ public: { if (quest->GetQuestId() == QUEST_ESCAPING_THE_MIST) { - creature->setFaction(player->GetTeamId() == TEAM_ALLIANCE ? FACTION_ESCORTEE_A : FACTION_ESCORTEE_H); + creature->setFaction(player->GetTeamId() == TEAM_ALLIANCE ? FACTION_ESCORTEE_A : FACTION_ESCORTEE_H); creature->SetStandState(UNIT_STAND_STATE_STAND); creature->AI()->Talk(SAY_1, player); CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); @@ -982,9 +982,9 @@ public: struct npc_warmage_coldarraAI : public ScriptedAI { npc_warmage_coldarraAI(Creature* creature) : ScriptedAI(creature) - { - SetCombatMovement(false); - } + { + SetCombatMovement(false); + } uint32 m_uiTimer; //Timer until recast @@ -1277,10 +1277,10 @@ public: void AddSC_borean_tundra() { - // Ours - new spell_q11919_q11940_drake_hunt(); + // Ours + new spell_q11919_q11940_drake_hunt(); - // Theirs + // Theirs new npc_sinkhole_kill_credit(); new npc_khunok_the_behemoth(); new npc_corastrasza(); diff --git a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp index b6c49c018..463c12ae2 100644 --- a/src/server/scripts/Northrend/zone_crystalsong_forest.cpp +++ b/src/server/scripts/Northrend/zone_crystalsong_forest.cpp @@ -32,118 +32,118 @@ Script Data End */ enum ePreparationsForWar { - NPC_HAMMERHEAD = 30585, - NPC_CLOUDBUSTER = 30470, - TRANSPORT_ORGRIMS_HAMMER = 192241, - TRANSPORT_THE_SKYBREAKER = 192242 + NPC_HAMMERHEAD = 30585, + NPC_CLOUDBUSTER = 30470, + TRANSPORT_ORGRIMS_HAMMER = 192241, + TRANSPORT_THE_SKYBREAKER = 192242 }; class npc_preparations_for_war_vehicle : public CreatureScript { - public: - npc_preparations_for_war_vehicle() : CreatureScript("npc_preparations_for_war_vehicle") { } + public: + npc_preparations_for_war_vehicle() : CreatureScript("npc_preparations_for_war_vehicle") { } - struct npc_preparations_for_war_vehicleAI : public NullCreatureAI - { - npc_preparations_for_war_vehicleAI(Creature* creature) : NullCreatureAI(creature) - { - } + struct npc_preparations_for_war_vehicleAI : public NullCreatureAI + { + npc_preparations_for_war_vehicleAI(Creature* creature) : NullCreatureAI(creature) + { + } - uint8 pointId; - uint32 searchForShipTimer; - uint32 transportEntry; + uint8 pointId; + uint32 searchForShipTimer; + uint32 transportEntry; - void InitializeAI() - { - WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry()); - if (!path || path->empty()) - { - me->DespawnOrUnsummon(1); - return; - } + void InitializeAI() + { + WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry()); + if (!path || path->empty()) + { + me->DespawnOrUnsummon(1); + return; + } - Movement::PointsArray pathPoints; - pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + Movement::PointsArray pathPoints; + pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - uint32 wpCounter = 1; - WPPath::const_iterator itr; - while ((itr = path->find(wpCounter++)) != path->end()) - { - WayPoint* wp = itr->second; - pathPoints.push_back(G3D::Vector3(wp->x, wp->y, wp->z)); - } + uint32 wpCounter = 1; + WPPath::const_iterator itr; + while ((itr = path->find(wpCounter++)) != path->end()) + { + WayPoint* wp = itr->second; + pathPoints.push_back(G3D::Vector3(wp->x, wp->y, wp->z)); + } - me->GetMotionMaster()->MoveSplinePath(&pathPoints); - - NullCreatureAI::InitializeAI(); - pointId = 0; - searchForShipTimer = 0; - transportEntry = (me->GetEntry() == NPC_HAMMERHEAD ? TRANSPORT_ORGRIMS_HAMMER : TRANSPORT_THE_SKYBREAKER); - } + me->GetMotionMaster()->MoveSplinePath(&pathPoints); + + NullCreatureAI::InitializeAI(); + pointId = 0; + searchForShipTimer = 0; + transportEntry = (me->GetEntry() == NPC_HAMMERHEAD ? TRANSPORT_ORGRIMS_HAMMER : TRANSPORT_THE_SKYBREAKER); + } - void MovementInform(uint32 type, uint32 id) - { - if (type == ESCORT_MOTION_TYPE) - if (++pointId == 17) // path size - searchForShipTimer = 3000; - } + void MovementInform(uint32 type, uint32 id) + { + if (type == ESCORT_MOTION_TYPE) + if (++pointId == 17) // path size + searchForShipTimer = 3000; + } - void UpdateAI(uint32 diff) - { - // horde 7.55f, -0.09, 34.44, 3.13, +20 - // ally 45.18f, 0.03, 40.09, 3.14 +5 + void UpdateAI(uint32 diff) + { + // horde 7.55f, -0.09, 34.44, 3.13, +20 + // ally 45.18f, 0.03, 40.09, 3.14 +5 - if (searchForShipTimer) - { - searchForShipTimer += diff; - if (searchForShipTimer >= 3000) - { - searchForShipTimer = 1; - TransportsContainer const& transports = me->GetMap()->GetAllTransports(); - for (TransportsContainer::const_iterator itr = transports.begin(); itr != transports.end(); ++itr) - { - if ((*itr)->GetEntry() == transportEntry) - { - float x, y, z; - if (transportEntry == TRANSPORT_ORGRIMS_HAMMER) - { - x = 7.55f; - y = -0.09f; - z = 54.44f; - } - else - { - x = 45.18f; - y = 0.03f; - z = 45.09f; - } + if (searchForShipTimer) + { + searchForShipTimer += diff; + if (searchForShipTimer >= 3000) + { + searchForShipTimer = 1; + TransportsContainer const& transports = me->GetMap()->GetAllTransports(); + for (TransportsContainer::const_iterator itr = transports.begin(); itr != transports.end(); ++itr) + { + if ((*itr)->GetEntry() == transportEntry) + { + float x, y, z; + if (transportEntry == TRANSPORT_ORGRIMS_HAMMER) + { + x = 7.55f; + y = -0.09f; + z = 54.44f; + } + else + { + x = 45.18f; + y = 0.03f; + z = 45.09f; + } - (*itr)->CalculatePassengerPosition(x, y, z); + (*itr)->CalculatePassengerPosition(x, y, z); - if (me->GetDistance2d(x, y) < 10.0f) - { - me->DespawnOrUnsummon(1000); - if (Vehicle* vehicle = me->GetVehicleKit()) - if (Unit* passenger = vehicle->GetPassenger(0)) - { - passenger->NearTeleportTo(x, y, z-(transportEntry == TRANSPORT_ORGRIMS_HAMMER ? 19.0f : 4.0f), M_PI); - passenger->RemoveAurasDueToSpell(VEHICLE_SPELL_PARACHUTE); // maybe vehicle / seat flag should be responsible for parachute gain? - } - } - else - me->GetMotionMaster()->MovePoint(0, x, y, z, false, false); - break; - } - } - } - } - } - }; + if (me->GetDistance2d(x, y) < 10.0f) + { + me->DespawnOrUnsummon(1000); + if (Vehicle* vehicle = me->GetVehicleKit()) + if (Unit* passenger = vehicle->GetPassenger(0)) + { + passenger->NearTeleportTo(x, y, z-(transportEntry == TRANSPORT_ORGRIMS_HAMMER ? 19.0f : 4.0f), M_PI); + passenger->RemoveAurasDueToSpell(VEHICLE_SPELL_PARACHUTE); // maybe vehicle / seat flag should be responsible for parachute gain? + } + } + else + me->GetMotionMaster()->MovePoint(0, x, y, z, false, false); + break; + } + } + } + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_preparations_for_war_vehicleAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_preparations_for_war_vehicleAI(creature); + } }; /******************************************************* @@ -230,6 +230,6 @@ public: void AddSC_crystalsong_forest() { - new npc_preparations_for_war_vehicle(); + new npc_preparations_for_war_vehicle(); new npc_warmage_violetstand(); } diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp index 45693efc0..546c91c3c 100644 --- a/src/server/scripts/Northrend/zone_dalaran.cpp +++ b/src/server/scripts/Northrend/zone_dalaran.cpp @@ -33,50 +33,50 @@ Script Data End */ // Ours class npc_steam_powered_auctioneer : public CreatureScript { - public: - npc_steam_powered_auctioneer() : CreatureScript("npc_steam_powered_auctioneer") { } + public: + npc_steam_powered_auctioneer() : CreatureScript("npc_steam_powered_auctioneer") { } - struct npc_steam_powered_auctioneerAI : public ScriptedAI - { - npc_steam_powered_auctioneerAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_steam_powered_auctioneerAI : public ScriptedAI + { + npc_steam_powered_auctioneerAI(Creature* creature) : ScriptedAI(creature) {} - bool CanBeSeen(Player const* player) - { - if (player->GetTeamId() == TEAM_ALLIANCE) - return me->GetEntry() == 35594; - else - return me->GetEntry() == 35607; - } - }; + bool CanBeSeen(Player const* player) + { + if (player->GetTeamId() == TEAM_ALLIANCE) + return me->GetEntry() == 35594; + else + return me->GetEntry() == 35607; + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_steam_powered_auctioneerAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_steam_powered_auctioneerAI(creature); + } }; class npc_mei_francis_mount : public CreatureScript { - public: - npc_mei_francis_mount() : CreatureScript("npc_mei_francis_mount") { } + public: + npc_mei_francis_mount() : CreatureScript("npc_mei_francis_mount") { } - struct npc_mei_francis_mountAI : public ScriptedAI - { - npc_mei_francis_mountAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_mei_francis_mountAI : public ScriptedAI + { + npc_mei_francis_mountAI(Creature* creature) : ScriptedAI(creature) {} - bool CanBeSeen(Player const* player) - { - if (player->GetTeamId() == TEAM_ALLIANCE) - return me->GetEntry() == 32206 || me->GetEntry() == 32335 || me->GetEntry() == 31851; - else - return me->GetEntry() == 32207 || me->GetEntry() == 32336 || me->GetEntry() == 31852; - } - }; + bool CanBeSeen(Player const* player) + { + if (player->GetTeamId() == TEAM_ALLIANCE) + return me->GetEntry() == 32206 || me->GetEntry() == 32335 || me->GetEntry() == 31851; + else + return me->GetEntry() == 32207 || me->GetEntry() == 32336 || me->GetEntry() == 31852; + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_mei_francis_mountAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_mei_francis_mountAI(creature); + } }; /****************************************** @@ -85,37 +85,37 @@ class npc_mei_francis_mount : public CreatureScript enum DisguiseEvent { - ACTION_SHANDY_INTRO = 0, - ACTION_WATER = 1, - ACTION_SHIRTS = 2, - ACTION_PANTS = 3, - ACTION_UNMENTIONABLES = 4, + ACTION_SHANDY_INTRO = 0, + ACTION_WATER = 1, + ACTION_SHIRTS = 2, + ACTION_PANTS = 3, + ACTION_UNMENTIONABLES = 4, - EVENT_INTRO_DH1 = 1, - EVENT_INTRO_DH2 = 2, - EVENT_INTRO_DH3 = 3, - EVENT_INTRO_DH4 = 4, - EVENT_INTRO_DH5 = 5, - EVENT_INTRO_DH6 = 6, - EVENT_OUTRO_DH = 7, + EVENT_INTRO_DH1 = 1, + EVENT_INTRO_DH2 = 2, + EVENT_INTRO_DH3 = 3, + EVENT_INTRO_DH4 = 4, + EVENT_INTRO_DH5 = 5, + EVENT_INTRO_DH6 = 6, + EVENT_OUTRO_DH = 7, - SAY_SHANDY1 = 0, - SAY_SHANDY2 = 1, - SAY_SHANDY3 = 2, - SAY_SHANDY_WATER = 3, // shirts = 4, pants = 5, unmentionables = 6 - SAY_SHANDY4 = 7, - SAY_SHANDY5 = 8, - SAY_SHANDY6 = 9, + SAY_SHANDY1 = 0, + SAY_SHANDY2 = 1, + SAY_SHANDY3 = 2, + SAY_SHANDY_WATER = 3, // shirts = 4, pants = 5, unmentionables = 6 + SAY_SHANDY4 = 7, + SAY_SHANDY5 = 8, + SAY_SHANDY6 = 9, }; enum DisguiseMisc { - QUEST_SUITABLE_DISGUISE_A = 20438, - QUEST_SUITABLE_DISGUISE_H = 24556, + QUEST_SUITABLE_DISGUISE_A = 20438, + QUEST_SUITABLE_DISGUISE_H = 24556, - SPELL_EVOCATION_VISUAL = 69659, + SPELL_EVOCATION_VISUAL = 69659, - NPC_AQUANOS_ENTRY = 36851, + NPC_AQUANOS_ENTRY = 36851, }; class npc_shandy_dalaran : public CreatureScript @@ -129,8 +129,8 @@ public: void Reset() { - _events.Reset(); - _aquanosGUID = 0; + _events.Reset(); + _aquanosGUID = 0; } void SetData(uint32 type, uint32 data) @@ -138,39 +138,39 @@ public: switch(type) { case ACTION_SHANDY_INTRO: - if (Creature* aquanos = me->FindNearestCreature(NPC_AQUANOS_ENTRY, 30, true)) - _aquanosGUID = aquanos->GetGUID(); + if (Creature* aquanos = me->FindNearestCreature(NPC_AQUANOS_ENTRY, 30, true)) + _aquanosGUID = aquanos->GetGUID(); - _events.Reset(); - _lCount = 0; - _lSource = 0; - _canWash = false; + _events.Reset(); + _lCount = 0; + _lSource = 0; + _canWash = false; Talk(SAY_SHANDY1); _events.ScheduleEvent(EVENT_INTRO_DH1, 5000); - _events.ScheduleEvent(EVENT_OUTRO_DH, 10*MINUTE*IN_MILLISECONDS); + _events.ScheduleEvent(EVENT_OUTRO_DH, 10*MINUTE*IN_MILLISECONDS); break; - default: + default: if(_lSource == type && _canWash) { _canWash = false; - _events.ScheduleEvent(EVENT_INTRO_DH2, type == ACTION_UNMENTIONABLES ? 4000 : 10000); + _events.ScheduleEvent(EVENT_INTRO_DH2, type == ACTION_UNMENTIONABLES ? 4000 : 10000); Talk(SAY_SHANDY2); - if (Creature* aquanos = ObjectAccessor::GetCreature(*me, _aquanosGUID)) + if (Creature* aquanos = ObjectAccessor::GetCreature(*me, _aquanosGUID)) aquanos->CastSpell(aquanos, SPELL_EVOCATION_VISUAL, false); } break; } } - void RollTask() - { - _lSource = urand(ACTION_SHIRTS, ACTION_UNMENTIONABLES); - if (_lCount == 1 || _lCount == 4) - _lSource = ACTION_WATER; + void RollTask() + { + _lSource = urand(ACTION_SHIRTS, ACTION_UNMENTIONABLES); + if (_lCount == 1 || _lCount == 4) + _lSource = ACTION_WATER; - Talk(SAY_SHANDY_WATER + _lSource - 1); - _canWash = true; - } + Talk(SAY_SHANDY_WATER + _lSource - 1); + _canWash = true; + } void UpdateAI(uint32 diff) { @@ -180,53 +180,53 @@ public: case EVENT_INTRO_DH1: Talk(SAY_SHANDY3); _events.ScheduleEvent(EVENT_INTRO_DH2, 15000); - _events.PopEvent(); + _events.PopEvent(); break; case EVENT_INTRO_DH2: - if (_lCount++ > 6) - _events.ScheduleEvent(EVENT_INTRO_DH3, 6000); - else - RollTask(); + if (_lCount++ > 6) + _events.ScheduleEvent(EVENT_INTRO_DH3, 6000); + else + RollTask(); _events.PopEvent(); break; case EVENT_INTRO_DH3: Talk(SAY_SHANDY4); _events.ScheduleEvent(EVENT_INTRO_DH4, 20000); - _events.PopEvent(); + _events.PopEvent(); break; case EVENT_INTRO_DH4: Talk(SAY_SHANDY5); _events.ScheduleEvent(EVENT_INTRO_DH5, 3000); - _events.PopEvent(); + _events.PopEvent(); break; case EVENT_INTRO_DH5: me->SummonGameObject(201384, 5798.74f, 693.19f, 657.94f, 0.91f, 0, 0, 0, 0,90000000); _events.ScheduleEvent(EVENT_INTRO_DH6, 1000); - _events.PopEvent(); + _events.PopEvent(); break; case EVENT_INTRO_DH6: me->SetWalk(true); me->GetMotionMaster()->MovePoint(0, 5797.55f, 691.97f, 657.94f); _events.RescheduleEvent(EVENT_OUTRO_DH, 30000); - _events.PopEvent(); + _events.PopEvent(); break; case EVENT_OUTRO_DH: me->GetMotionMaster()->MoveTargetedHome(); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - _events.Reset(); + _events.Reset(); break; } } - private: - EventMap _events; - uint64 _aquanosGUID; - uint8 _lCount; - uint32 _lSource; - uint32 _resetTime; - - bool _canWash; + private: + EventMap _events; + uint64 _aquanosGUID; + uint8 _lCount; + uint32 _lSource; + uint32 _resetTime; + + bool _canWash; }; bool OnGossipHello(Player* player, Creature* creature) @@ -235,7 +235,7 @@ public: player->PrepareQuestMenu(creature->GetGUID()); if (player->GetQuestStatus(QUEST_SUITABLE_DISGUISE_A) == QUEST_STATUS_INCOMPLETE || - player->GetQuestStatus(QUEST_SUITABLE_DISGUISE_H) == QUEST_STATUS_INCOMPLETE) + player->GetQuestStatus(QUEST_SUITABLE_DISGUISE_H) == QUEST_STATUS_INCOMPLETE) { if(player->GetTeamId() == TEAM_ALLIANCE) player->ADD_GOSSIP_ITEM(0, "Arcanist Tybalin said you might be able to lend me a certain tabard.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); @@ -299,97 +299,97 @@ enum ArchmageLandalockImages class npc_archmage_landalock : public CreatureScript { - public: - npc_archmage_landalock() : CreatureScript("npc_archmage_landalock") - { - } + public: + npc_archmage_landalock() : CreatureScript("npc_archmage_landalock") + { + } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_archmage_landalockAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_archmage_landalockAI(creature); + } - struct npc_archmage_landalockAI : public ScriptedAI - { - npc_archmage_landalockAI(Creature* creature) : ScriptedAI(creature) - { - _switchImageTimer = MINUTE*IN_MILLISECONDS; - _summonGUID = 0; - } + struct npc_archmage_landalockAI : public ScriptedAI + { + npc_archmage_landalockAI(Creature* creature) : ScriptedAI(creature) + { + _switchImageTimer = MINUTE*IN_MILLISECONDS; + _summonGUID = 0; + } - uint32 GetImageEntry(uint32 QuestId) - { - switch (QuestId) - { - case QUEST_SARTHARION_MUST_DIE: - return NPC_SARTHARION_IMAGE; - case QUEST_ANUBREKHAN_MUST_DIE: - return NPC_ANUBREKHAN_IMAGE; - case QUEST_NOTH_THE_PLAGUEBINGER_MUST_DIE: - return NPC_NOTH_THE_PLAGUEBINGER_IMAGE; - case QUEST_INSTRUCTOR_RAZUVIOUS_MUST_DIE: - return NPC_INSTRUCTOR_RAZUVIOUS_IMAGE; - case QUEST_PATCHWERK_MUST_DIE: - return NPC_PATCHWERK_IMAGE; - case QUEST_MALYGOS_MUST_DIE: - return NPC_MALYGOS_IMAGE; - case QUEST_FLAME_LEVIATHAN_MUST_DIE: - return NPC_FLAME_LEVIATHAN_IMAGE; - case QUEST_RAZORSCALE_MUST_DIE: - return NPC_RAZORSCALE_IMAGE; - case QUEST_IGNIS_THE_FURNACE_MASTER_MUST_DIE: - return NPC_IGNIS_THE_FURNACE_MASTER_IMAGE; - case QUEST_XT_002_DECONSTRUCTOR_MUST_DIE: - return NPC_XT_002_DECONSTRUCTOR_IMAGE; - case QUEST_LORD_JARAXXUS_MUST_DIE: - return NPC_LORD_JARAXXUS_IMAGE; - default: //case QUEST_LORD_MARROWGAR_MUST_DIE: - return NPC_LORD_MARROWGAR_IMAGE; - } - } + uint32 GetImageEntry(uint32 QuestId) + { + switch (QuestId) + { + case QUEST_SARTHARION_MUST_DIE: + return NPC_SARTHARION_IMAGE; + case QUEST_ANUBREKHAN_MUST_DIE: + return NPC_ANUBREKHAN_IMAGE; + case QUEST_NOTH_THE_PLAGUEBINGER_MUST_DIE: + return NPC_NOTH_THE_PLAGUEBINGER_IMAGE; + case QUEST_INSTRUCTOR_RAZUVIOUS_MUST_DIE: + return NPC_INSTRUCTOR_RAZUVIOUS_IMAGE; + case QUEST_PATCHWERK_MUST_DIE: + return NPC_PATCHWERK_IMAGE; + case QUEST_MALYGOS_MUST_DIE: + return NPC_MALYGOS_IMAGE; + case QUEST_FLAME_LEVIATHAN_MUST_DIE: + return NPC_FLAME_LEVIATHAN_IMAGE; + case QUEST_RAZORSCALE_MUST_DIE: + return NPC_RAZORSCALE_IMAGE; + case QUEST_IGNIS_THE_FURNACE_MASTER_MUST_DIE: + return NPC_IGNIS_THE_FURNACE_MASTER_IMAGE; + case QUEST_XT_002_DECONSTRUCTOR_MUST_DIE: + return NPC_XT_002_DECONSTRUCTOR_IMAGE; + case QUEST_LORD_JARAXXUS_MUST_DIE: + return NPC_LORD_JARAXXUS_IMAGE; + default: //case QUEST_LORD_MARROWGAR_MUST_DIE: + return NPC_LORD_MARROWGAR_IMAGE; + } + } - void JustSummoned(Creature* image) - { - // xinef: screams like a baby - if (image->GetEntry() != NPC_ANUBREKHAN_IMAGE) - image->SetUnitMovementFlags(MOVEMENTFLAG_RIGHT); - _summonGUID = image->GetGUID(); - } + void JustSummoned(Creature* image) + { + // xinef: screams like a baby + if (image->GetEntry() != NPC_ANUBREKHAN_IMAGE) + image->SetUnitMovementFlags(MOVEMENTFLAG_RIGHT); + _summonGUID = image->GetGUID(); + } - void UpdateAI(uint32 diff) - { - ScriptedAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + ScriptedAI::UpdateAI(diff); - _switchImageTimer += diff; - if (_switchImageTimer > MINUTE*IN_MILLISECONDS) - { - _switchImageTimer = 0; - QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(me->GetEntry()); - for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i) - { - uint32 questId = i->second; - Quest const* quest = sObjectMgr->GetQuestTemplate(questId); - if (!quest || !quest->IsWeekly()) - continue; + _switchImageTimer += diff; + if (_switchImageTimer > MINUTE*IN_MILLISECONDS) + { + _switchImageTimer = 0; + QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(me->GetEntry()); + for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i) + { + uint32 questId = i->second; + Quest const* quest = sObjectMgr->GetQuestTemplate(questId); + if (!quest || !quest->IsWeekly()) + continue; - uint32 newEntry = GetImageEntry(questId); - if (GUID_ENPART(_summonGUID) != newEntry) - { - if (Creature* image = ObjectAccessor::GetCreature(*me, _summonGUID)) - image->DespawnOrUnsummon(); + uint32 newEntry = GetImageEntry(questId); + if (GUID_ENPART(_summonGUID) != newEntry) + { + if (Creature* image = ObjectAccessor::GetCreature(*me, _summonGUID)) + image->DespawnOrUnsummon(); - float z = 653.622f; - if (newEntry == NPC_MALYGOS_IMAGE || newEntry == NPC_RAZORSCALE_IMAGE || newEntry == NPC_SARTHARION_IMAGE) - z += 3.0f; - me->SummonCreature(newEntry, 5703.077f, 583.9757f, z, 3.926991f); - } - } - } - } - private: - uint32 _switchImageTimer; - uint64 _summonGUID; - }; + float z = 653.622f; + if (newEntry == NPC_MALYGOS_IMAGE || newEntry == NPC_RAZORSCALE_IMAGE || newEntry == NPC_SARTHARION_IMAGE) + z += 3.0f; + me->SummonCreature(newEntry, 5703.077f, 583.9757f, z, 3.926991f); + } + } + } + } + private: + uint32 _switchImageTimer; + uint64 _summonGUID; + }; }; // Theirs @@ -446,7 +446,7 @@ public: Player* player = who->GetCharmerOrOwnerPlayerOrPlayerItself(); - if (!player || player->IsGameMaster() || player->IsBeingTeleported() || (player->GetPositionZ() > 670 && player->GetVehicle()) || + if (!player || player->IsGameMaster() || player->IsBeingTeleported() || (player->GetPositionZ() > 670 && player->GetVehicle()) || // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass player->HasAura(SPELL_SUNREAVER_DISGUISE_FEMALE) || player->HasAura(SPELL_SUNREAVER_DISGUISE_MALE) || player->HasAura(SPELL_SILVER_COVENANT_DISGUISE_FEMALE) || player->HasAura(SPELL_SILVER_COVENANT_DISGUISE_MALE)) @@ -603,13 +603,13 @@ class npc_minigob_manabonk : public CreatureScript void AddSC_dalaran() { - // our - new npc_steam_powered_auctioneer(); - new npc_mei_francis_mount(); + // our + new npc_steam_powered_auctioneer(); + new npc_mei_francis_mount(); new npc_shandy_dalaran(); - new npc_archmage_landalock(); + new npc_archmage_landalock(); - // theirs + // theirs new npc_mageguard_dalaran(); new npc_minigob_manabonk(); } diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index ad6160bb3..09153e73b 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -63,190 +63,190 @@ public: return new npc_conversing_with_the_depths_triggerAI (pCreature); } - struct npc_conversing_with_the_depths_triggerAI : public ScriptedAI - { - npc_conversing_with_the_depths_triggerAI(Creature* c) : ScriptedAI(c) { } + struct npc_conversing_with_the_depths_triggerAI : public ScriptedAI + { + npc_conversing_with_the_depths_triggerAI(Creature* c) : ScriptedAI(c) { } - bool running; - bool secondpart; - int32 timer; - uint8 step; - uint64 pGUID; - uint64 oachanoaGUID; + bool running; + bool secondpart; + int32 timer; + uint8 step; + uint64 pGUID; + uint64 oachanoaGUID; - void Reset() - { - running = false; - secondpart = false; - timer = 0; - step = 0; - pGUID = 0; - oachanoaGUID = 0; - } + void Reset() + { + running = false; + secondpart = false; + timer = 0; + step = 0; + pGUID = 0; + oachanoaGUID = 0; + } - void NextStep(const uint32 time) - { - step++; - timer = time; - } + void NextStep(const uint32 time) + { + step++; + timer = time; + } - void Say(std::string text, bool yell) - { - Creature* c = ObjectAccessor::GetCreature(*me, oachanoaGUID); - Player* player = ObjectAccessor::GetPlayer(*me, pGUID); - if (!c || !player) - { - Reset(); - return; - } + void Say(std::string text, bool yell) + { + Creature* c = ObjectAccessor::GetCreature(*me, oachanoaGUID); + Player* player = ObjectAccessor::GetPlayer(*me, pGUID); + if (!c || !player) + { + Reset(); + return; + } - if (yell) - c->MonsterYell(text.c_str(), LANG_UNIVERSAL, player); - else - c->MonsterWhisper(text.c_str(), player, false); - } + if (yell) + c->MonsterYell(text.c_str(), LANG_UNIVERSAL, player); + else + c->MonsterWhisper(text.c_str(), player, false); + } - void DespawnOachanoa() - { - if (Creature* c = ObjectAccessor::GetCreature(*me, oachanoaGUID)) - c->DespawnOrUnsummon(); - } + void DespawnOachanoa() + { + if (Creature* c = ObjectAccessor::GetCreature(*me, oachanoaGUID)) + c->DespawnOrUnsummon(); + } - void UpdateAI(uint32 diff) - { - if( running ) - { - if( Player* p = ObjectAccessor::GetPlayer(*me, pGUID) ) - if( p->GetPositionZ() < 1.0f && !secondpart ) - { - if( p->HasAura(DEEPDIVING_PEARL_BUFF) ) - { - NextStep(500); - secondpart = true; - } - else - { - DespawnOachanoa(); - Reset(); - } - } + void UpdateAI(uint32 diff) + { + if( running ) + { + if( Player* p = ObjectAccessor::GetPlayer(*me, pGUID) ) + if( p->GetPositionZ() < 1.0f && !secondpart ) + { + if( p->HasAura(DEEPDIVING_PEARL_BUFF) ) + { + NextStep(500); + secondpart = true; + } + else + { + DespawnOachanoa(); + Reset(); + } + } - if( timer != 0 ) - { - timer -= diff; - if( timer < 0 ) - timer = 0; - } - else - switch( step ) - { - case 0: - NextStep(10000); - break; - case 1: - { - Creature* c = me->SummonCreature(NPC_OACHANOA, 2406.24f, 1701.98f, 0.1f, 0.3f, TEMPSUMMON_TIMED_DESPAWN, 90000, 0); - if( !c ) - { - Reset(); - return; - } - c->SetCanFly(true); - c->GetMotionMaster()->MovePoint(0, 2406.25f, 1701.98f, 0.1f); - oachanoaGUID = c->GetGUID(); - NextStep(3000); - break; - } - case 2: - { - Player* p = ObjectAccessor::GetPlayer(*me, pGUID); - if( !p ) - { - Reset(); - return; - } - std::string text = (OACHANOA_T_1_1 + p->GetName() + OACHANOA_T_1_2); - Say(text, true); - NextStep(6000); - break; - } - case 3: - Say(OACHANOA_T_2, true); - NextStep(6000); - break; - case 4: - { - Say(OACHANOA_T_3, true); - Player* p = ObjectAccessor::GetPlayer(*me, pGUID); - if( !p ) - { - Reset(); - return; - } - p->CastSpell(p, DEEPDIVING_PEARL_BUFF, true); - NextStep(30000); - break; - } - case 5: - DespawnOachanoa(); - Reset(); - break; - case 6: - { - Player* p = ObjectAccessor::GetPlayer(*me, pGUID); - if( !p ) - { - Reset(); - return; - } + if( timer != 0 ) + { + timer -= diff; + if( timer < 0 ) + timer = 0; + } + else + switch( step ) + { + case 0: + NextStep(10000); + break; + case 1: + { + Creature* c = me->SummonCreature(NPC_OACHANOA, 2406.24f, 1701.98f, 0.1f, 0.3f, TEMPSUMMON_TIMED_DESPAWN, 90000, 0); + if( !c ) + { + Reset(); + return; + } + c->SetCanFly(true); + c->GetMotionMaster()->MovePoint(0, 2406.25f, 1701.98f, 0.1f); + oachanoaGUID = c->GetGUID(); + NextStep(3000); + break; + } + case 2: + { + Player* p = ObjectAccessor::GetPlayer(*me, pGUID); + if( !p ) + { + Reset(); + return; + } + std::string text = (OACHANOA_T_1_1 + p->GetName() + OACHANOA_T_1_2); + Say(text, true); + NextStep(6000); + break; + } + case 3: + Say(OACHANOA_T_2, true); + NextStep(6000); + break; + case 4: + { + Say(OACHANOA_T_3, true); + Player* p = ObjectAccessor::GetPlayer(*me, pGUID); + if( !p ) + { + Reset(); + return; + } + p->CastSpell(p, DEEPDIVING_PEARL_BUFF, true); + NextStep(30000); + break; + } + case 5: + DespawnOachanoa(); + Reset(); + break; + case 6: + { + Player* p = ObjectAccessor::GetPlayer(*me, pGUID); + if( !p ) + { + Reset(); + return; + } - std::string text = (OACHANOA_T_4_1 + p->GetName() + OACHANOA_T_4_2); - Say(text, true); + std::string text = (OACHANOA_T_4_1 + p->GetName() + OACHANOA_T_4_2); + Say(text, true); - NextStep(6000); - break; - } - case 7: - Say(OACHANOA_T_5, false); - NextStep(6000); - break; - case 8: - Say(OACHANOA_T_6, false); - NextStep(6000); - break; - case 9: - { - Player* p = ObjectAccessor::GetPlayer(*me, pGUID); - if( !p ) - { - Reset(); - return; - } - const char * name_races[RACE_DRAENEI] = {"human", "orc", "dwarf", "nightelf", "undead", "tauren", "gnome", "troll", "", "bloodelf", "draenei"}; - if( p->getRace() > 11 ) - { - Reset(); - return; - } + NextStep(6000); + break; + } + case 7: + Say(OACHANOA_T_5, false); + NextStep(6000); + break; + case 8: + Say(OACHANOA_T_6, false); + NextStep(6000); + break; + case 9: + { + Player* p = ObjectAccessor::GetPlayer(*me, pGUID); + if( !p ) + { + Reset(); + return; + } + const char * name_races[RACE_DRAENEI] = {"human", "orc", "dwarf", "nightelf", "undead", "tauren", "gnome", "troll", "", "bloodelf", "draenei"}; + if( p->getRace() > 11 ) + { + Reset(); + return; + } - std::string text = (OACHANOA_T_7_1 + std::string(name_races[p->getRace()-1])); - Say(text, true); + std::string text = (OACHANOA_T_7_1 + std::string(name_races[p->getRace()-1])); + Say(text, true); - p->AreaExploredOrEventHappens(12032); + p->AreaExploredOrEventHappens(12032); - DespawnOachanoa(); - Reset(); - } - } - } - } + DespawnOachanoa(); + Reset(); + } + } + } + } - void Start(uint64 g) - { - running = true; - pGUID = g; - } - }; + void Start(uint64 g) + { + running = true; + pGUID = g; + } + }; }; class go_the_pearl_of_the_depths : public GameObjectScript @@ -254,364 +254,364 @@ class go_the_pearl_of_the_depths : public GameObjectScript public: go_the_pearl_of_the_depths() : GameObjectScript("go_the_pearl_of_the_depths") { } - bool OnGossipHello(Player* pPlayer, GameObject* pGo) - { - if( !pPlayer || !pGo ) - return true; + bool OnGossipHello(Player* pPlayer, GameObject* pGo) + { + if( !pPlayer || !pGo ) + return true; - Creature* t = pPlayer->FindNearestCreature(NPC_CONVERSING_WITH_THE_DEPTHS_TRIGGER, 10.0f, true); - if( t && t->AI() && CAST_AI(npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI, t->AI()) ) - if( !CAST_AI(npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI, t->AI())->running ) - CAST_AI(npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI, t->AI())->Start(pPlayer->GetGUID()); + Creature* t = pPlayer->FindNearestCreature(NPC_CONVERSING_WITH_THE_DEPTHS_TRIGGER, 10.0f, true); + if( t && t->AI() && CAST_AI(npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI, t->AI()) ) + if( !CAST_AI(npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI, t->AI())->running ) + CAST_AI(npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI, t->AI())->Start(pPlayer->GetGUID()); - return true; - } + return true; + } }; enum hourglass { - NPC_FUTURE_HOURGLASS = 27840, - NPC_FUTURE_YOU = 27899, + NPC_FUTURE_HOURGLASS = 27840, + NPC_FUTURE_YOU = 27899, - NPC_PAST_HOURGLASS = 32327, - NPC_PAST_YOU = 32331, + NPC_PAST_HOURGLASS = 32327, + NPC_PAST_YOU = 32331, - NPC_INFINITE_ASSAILANT = 27896, - NPC_INFINITE_CHRONO_MAGUS = 27898, - NPC_INFINITE_DESTROYER = 27897, - NPC_INFINITE_TIMERENDER = 27900, + NPC_INFINITE_ASSAILANT = 27896, + NPC_INFINITE_CHRONO_MAGUS = 27898, + NPC_INFINITE_DESTROYER = 27897, + NPC_INFINITE_TIMERENDER = 27900, - SPELL_CLONE_CASTER = 49889, - SPELL_TELEPORT_EFFECT = 52096, + SPELL_CLONE_CASTER = 49889, + SPELL_TELEPORT_EFFECT = 52096, - EVENT_START_EVENT = 1, - EVENT_FIGHT_1 = 2, - EVENT_FIGHT_2 = 3, - EVENT_CHECK_FINISH = 4, - EVENT_FINISH_EVENT = 5, + EVENT_START_EVENT = 1, + EVENT_FIGHT_1 = 2, + EVENT_FIGHT_2 = 3, + EVENT_CHECK_FINISH = 4, + EVENT_FINISH_EVENT = 5, - QUEST_MYSTERY_OF_THE_INFINITE = 12470, - QUEST_MYSTERY_OF_THE_INFINITE_REDUX = 13343, + QUEST_MYSTERY_OF_THE_INFINITE = 12470, + QUEST_MYSTERY_OF_THE_INFINITE_REDUX = 13343, }; class npc_hourglass_of_eternity : public CreatureScript { public: - npc_hourglass_of_eternity() : CreatureScript("npc_hourglass_of_eternity") { } + npc_hourglass_of_eternity() : CreatureScript("npc_hourglass_of_eternity") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_hourglass_of_eternityAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_hourglass_of_eternityAI (pCreature); + } - struct npc_hourglass_of_eternityAI : public ScriptedAI - { - npc_hourglass_of_eternityAI(Creature* c) : ScriptedAI(c) {} + struct npc_hourglass_of_eternityAI : public ScriptedAI + { + npc_hourglass_of_eternityAI(Creature* c) : ScriptedAI(c) {} - uint64 summonerGUID; - uint64 futureGUID; - EventMap events; - uint8 count[3]; - uint8 phase; + uint64 summonerGUID; + uint64 futureGUID; + EventMap events; + uint8 count[3]; + uint8 phase; - bool IsFuture() { return me->GetEntry() == NPC_FUTURE_HOURGLASS; } - void InitializeAI() - { - if (me->ToTempSummon()) - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - { - summonerGUID = summoner->GetGUID(); - float x,y,z; - me->GetNearPoint(summoner, x, y, z, me->GetCombatReach(), 0.0f, rand_norm()*2*M_PI); - if (Creature* cr = summoner->SummonCreature((IsFuture() ? NPC_FUTURE_YOU : NPC_PAST_YOU), x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 210000)) - { - futureGUID = cr->GetGUID(); - summoner->CastSpell(cr, SPELL_CLONE_CASTER, true); - cr->setFaction(summoner->getFaction()); - cr->SetReactState(REACT_AGGRESSIVE); - } - } + bool IsFuture() { return me->GetEntry() == NPC_FUTURE_HOURGLASS; } + void InitializeAI() + { + if (me->ToTempSummon()) + if (Unit* summoner = me->ToTempSummon()->GetSummoner()) + { + summonerGUID = summoner->GetGUID(); + float x,y,z; + me->GetNearPoint(summoner, x, y, z, me->GetCombatReach(), 0.0f, rand_norm()*2*M_PI); + if (Creature* cr = summoner->SummonCreature((IsFuture() ? NPC_FUTURE_YOU : NPC_PAST_YOU), x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 210000)) + { + futureGUID = cr->GetGUID(); + summoner->CastSpell(cr, SPELL_CLONE_CASTER, true); + cr->setFaction(summoner->getFaction()); + cr->SetReactState(REACT_AGGRESSIVE); + } + } - count[0] = 2; - count[1] = 2; - count[2] = 3; + count[0] = 2; + count[1] = 2; + count[2] = 3; - phase = 0; - events.Reset(); - events.ScheduleEvent(EVENT_START_EVENT, 4000); - } + phase = 0; + events.Reset(); + events.ScheduleEvent(EVENT_START_EVENT, 4000); + } - Player* getSummoner() { return ObjectAccessor::GetPlayer(*me, summonerGUID); } - Creature* getFuture() { return ObjectAccessor::GetCreature(*me, futureGUID); } + Player* getSummoner() { return ObjectAccessor::GetPlayer(*me, summonerGUID); } + Creature* getFuture() { return ObjectAccessor::GetCreature(*me, futureGUID); } - uint32 randEntry() - { - return NPC_INFINITE_ASSAILANT+urand(0,2); - } - - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_START_EVENT: - if (Creature* cr = getFuture()) - cr->MonsterWhisper(IsFuture() ? "Hey there, $N, don't be alarmed. It's me... you... from the future. I'm here to help." : "Whoa! You're me, but from the future! Hey, my equipment got an upgrade! Cool!", getSummoner()); - events.PopEvent(); - events.ScheduleEvent(EVENT_FIGHT_1, 7000); - break; - case EVENT_FIGHT_1: - if (Creature* cr = getFuture()) - cr->MonsterWhisper(IsFuture() ? "Heads up... here they come. I'll help as much as I can. Let's just keep them off the hourglass!" : "Here come the Infinites! I've got to keep the hourglass safe. Can you help?", getSummoner()); - events.PopEvent(); - events.ScheduleEvent(EVENT_FIGHT_2, 6000); - break; - case EVENT_FIGHT_2: - { - if (phase) - randomWhisper(); + uint32 randEntry() + { + return NPC_INFINITE_ASSAILANT+urand(0,2); + } + + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_START_EVENT: + if (Creature* cr = getFuture()) + cr->MonsterWhisper(IsFuture() ? "Hey there, $N, don't be alarmed. It's me... you... from the future. I'm here to help." : "Whoa! You're me, but from the future! Hey, my equipment got an upgrade! Cool!", getSummoner()); + events.PopEvent(); + events.ScheduleEvent(EVENT_FIGHT_1, 7000); + break; + case EVENT_FIGHT_1: + if (Creature* cr = getFuture()) + cr->MonsterWhisper(IsFuture() ? "Heads up... here they come. I'll help as much as I can. Let's just keep them off the hourglass!" : "Here come the Infinites! I've got to keep the hourglass safe. Can you help?", getSummoner()); + events.PopEvent(); + events.ScheduleEvent(EVENT_FIGHT_2, 6000); + break; + case EVENT_FIGHT_2: + { + if (phase) + randomWhisper(); - Creature* cr = NULL; - float x, y, z; - if (phase < 3) - { - for (uint8 i = 0; i < count[phase]; ++i) - { - me->GetNearPoint(me, x, y, z, me->GetCombatReach(), 10.0f, rand_norm()*2*M_PI); - if (cr = me->SummonCreature(randEntry(), x, y, z+2.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - { - cr->CastSpell(cr, SPELL_TELEPORT_EFFECT, true); - cr->AI()->AttackStart(me); - cr->AddThreat(me, 100.0f); - } - } - } - else if (phase == 3) - { - me->GetNearPoint(me, x, y, z, me->GetCombatReach(), 20.0f, rand_norm()*2*M_PI); - if (cr = me->SummonCreature(NPC_INFINITE_TIMERENDER, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - { - cr->CastSpell(cr, SPELL_TELEPORT_EFFECT, true); - cr->AI()->AttackStart(me); - } + Creature* cr = NULL; + float x, y, z; + if (phase < 3) + { + for (uint8 i = 0; i < count[phase]; ++i) + { + me->GetNearPoint(me, x, y, z, me->GetCombatReach(), 10.0f, rand_norm()*2*M_PI); + if (cr = me->SummonCreature(randEntry(), x, y, z+2.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + { + cr->CastSpell(cr, SPELL_TELEPORT_EFFECT, true); + cr->AI()->AttackStart(me); + cr->AddThreat(me, 100.0f); + } + } + } + else if (phase == 3) + { + me->GetNearPoint(me, x, y, z, me->GetCombatReach(), 20.0f, rand_norm()*2*M_PI); + if (cr = me->SummonCreature(NPC_INFINITE_TIMERENDER, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + { + cr->CastSpell(cr, SPELL_TELEPORT_EFFECT, true); + cr->AI()->AttackStart(me); + } - events.PopEvent(); - events.ScheduleEvent(EVENT_CHECK_FINISH, 20000); - return; - } + events.PopEvent(); + events.ScheduleEvent(EVENT_CHECK_FINISH, 20000); + return; + } - phase++; - events.PopEvent(); - events.ScheduleEvent(EVENT_FIGHT_2, 35000); - break; - } - case EVENT_CHECK_FINISH: - { - if (me->FindNearestCreature(NPC_INFINITE_TIMERENDER, 50.0f)) - { - events.RepeatEvent(5000); - return; - } + phase++; + events.PopEvent(); + events.ScheduleEvent(EVENT_FIGHT_2, 35000); + break; + } + case EVENT_CHECK_FINISH: + { + if (me->FindNearestCreature(NPC_INFINITE_TIMERENDER, 50.0f)) + { + events.RepeatEvent(5000); + return; + } - if (Player* player = getSummoner()) - player->GroupEventHappens(IsFuture() ? QUEST_MYSTERY_OF_THE_INFINITE : QUEST_MYSTERY_OF_THE_INFINITE_REDUX, me); + if (Player* player = getSummoner()) + player->GroupEventHappens(IsFuture() ? QUEST_MYSTERY_OF_THE_INFINITE : QUEST_MYSTERY_OF_THE_INFINITE_REDUX, me); - me->MonsterWhisper(IsFuture() ? "Look, $N, the hourglass has revealed Nozdormu!" : "What the heck? Nozdormu is up there!", getSummoner()); - events.PopEvent(); - events.ScheduleEvent(EVENT_FINISH_EVENT, 6000); - break; - } - case EVENT_FINISH_EVENT: - { - me->MonsterWhisper(IsFuture() ? "Farewell, $N. Keep us alive and get some better equipment!" : "I feel like I'm being pulled away through time. Thanks for the help....", getSummoner()); - events.PopEvent(); - me->DespawnOrUnsummon(500); - if (getFuture()) - getFuture()->DespawnOrUnsummon(500); - break; - } - } - } + me->MonsterWhisper(IsFuture() ? "Look, $N, the hourglass has revealed Nozdormu!" : "What the heck? Nozdormu is up there!", getSummoner()); + events.PopEvent(); + events.ScheduleEvent(EVENT_FINISH_EVENT, 6000); + break; + } + case EVENT_FINISH_EVENT: + { + me->MonsterWhisper(IsFuture() ? "Farewell, $N. Keep us alive and get some better equipment!" : "I feel like I'm being pulled away through time. Thanks for the help....", getSummoner()); + events.PopEvent(); + me->DespawnOrUnsummon(500); + if (getFuture()) + getFuture()->DespawnOrUnsummon(500); + break; + } + } + } - void randomWhisper() - { - std::string text = ""; - switch(urand(0, IsFuture() ? 7 : 5)) - { - case 0: text = IsFuture() ? "What? Am I here alone. We both have a stake at this, you know!" : "This equipment looks cool and all, but couldn't we have done a little better? Are you even raiding?"; break; - case 1: text = IsFuture() ? "No matter what, you can't die, because would mean that I would cease to exist, right? But, I was here before when I was you. I'm so confused!" : "Chromie said that if I don't do this just right, I might wink out of existence. If I go, then you go!"; break; - case 2: text = IsFuture() ? "Sorry, but Chromie said that I couldn't reveal anything about your future to you. She said that if I did, I would cease to exist." : "I just want you to know that if we get through this alive, I'm making sure that we turn out better than you. No offense."; break; - case 3: text = IsFuture() ? "Look at you fight; no wonder I turned to drinking." : "Looks like I'm an underachiever."; break; - case 4: text = IsFuture() ? "Wow, I'd forgotten how inexperienced I used to be." : "Wait a minute! If you're here, then that means that in the not-so-distant future I'm going to be you helping me? Are we stuck in a time loop?!"; break; - case 5: text = IsFuture() ? "I can't believe that I used to wear that." : "I think I'm going to turn to drinking after this."; break; - case 6: text = "Listen. I'm not supposed to tell you this, but there's going to be this party that you're invited to. Whatever you do, DO NOT DRINK THE PUNCH!"; break; - case 7: text = "Wish I could remember how many of the Infinite Dragonflight were going to try to stop you. This fight was so long ago."; break; - } + void randomWhisper() + { + std::string text = ""; + switch(urand(0, IsFuture() ? 7 : 5)) + { + case 0: text = IsFuture() ? "What? Am I here alone. We both have a stake at this, you know!" : "This equipment looks cool and all, but couldn't we have done a little better? Are you even raiding?"; break; + case 1: text = IsFuture() ? "No matter what, you can't die, because would mean that I would cease to exist, right? But, I was here before when I was you. I'm so confused!" : "Chromie said that if I don't do this just right, I might wink out of existence. If I go, then you go!"; break; + case 2: text = IsFuture() ? "Sorry, but Chromie said that I couldn't reveal anything about your future to you. She said that if I did, I would cease to exist." : "I just want you to know that if we get through this alive, I'm making sure that we turn out better than you. No offense."; break; + case 3: text = IsFuture() ? "Look at you fight; no wonder I turned to drinking." : "Looks like I'm an underachiever."; break; + case 4: text = IsFuture() ? "Wow, I'd forgotten how inexperienced I used to be." : "Wait a minute! If you're here, then that means that in the not-so-distant future I'm going to be you helping me? Are we stuck in a time loop?!"; break; + case 5: text = IsFuture() ? "I can't believe that I used to wear that." : "I think I'm going to turn to drinking after this."; break; + case 6: text = "Listen. I'm not supposed to tell you this, but there's going to be this party that you're invited to. Whatever you do, DO NOT DRINK THE PUNCH!"; break; + case 7: text = "Wish I could remember how many of the Infinite Dragonflight were going to try to stop you. This fight was so long ago."; break; + } - if (Creature* cr = getFuture()) - cr->MonsterWhisper(text.c_str(), getSummoner()); - } - }; + if (Creature* cr = getFuture()) + cr->MonsterWhisper(text.c_str(), getSummoner()); + } + }; }; class npc_future_you : public CreatureScript { public: - npc_future_you() : CreatureScript("npc_future_you") { } + npc_future_you() : CreatureScript("npc_future_you") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_future_youAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_future_youAI (pCreature); + } - struct npc_future_youAI : public ScriptedAI - { - npc_future_youAI(Creature* c) : ScriptedAI(c) {} - - void EnterEvadeMode() - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - me->ClearUnitState(UNIT_STATE_EVADE); - } + struct npc_future_youAI : public ScriptedAI + { + npc_future_youAI(Creature* c) : ScriptedAI(c) {} + + void EnterEvadeMode() + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + me->ClearUnitState(UNIT_STATE_EVADE); + } - void Reset() - { - if (me->ToTempSummon() && me->ToTempSummon()->GetSummoner()) - me->setFaction(me->ToTempSummon()->GetSummoner()->getFaction()); - } + void Reset() + { + if (me->ToTempSummon() && me->ToTempSummon()->GetSummoner()) + me->setFaction(me->ToTempSummon()->GetSummoner()->getFaction()); + } - void MoveInLineOfSight(Unit* who) - { - if (!me->GetVictim() && who->GetEntry() >= NPC_INFINITE_ASSAILANT && who->GetEntry() <= NPC_INFINITE_TIMERENDER) - AttackStart(who); - } + void MoveInLineOfSight(Unit* who) + { + if (!me->GetVictim() && who->GetEntry() >= NPC_INFINITE_ASSAILANT && who->GetEntry() <= NPC_INFINITE_TIMERENDER) + AttackStart(who); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; enum chainGun { - NPC_INJURED_7TH_LEGION_SOLDER = 27788, - SPELL_FEAR_AURA_WITH_COWER = 49774 + NPC_INJURED_7TH_LEGION_SOLDER = 27788, + SPELL_FEAR_AURA_WITH_COWER = 49774 }; class npc_mindless_ghoul : public CreatureScript { public: - npc_mindless_ghoul() : CreatureScript("npc_mindless_ghoul") { } + npc_mindless_ghoul() : CreatureScript("npc_mindless_ghoul") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_mindless_ghoulAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_mindless_ghoulAI (pCreature); + } - struct npc_mindless_ghoulAI : public ScriptedAI - { - npc_mindless_ghoulAI(Creature* c) : ScriptedAI(c) - { - me->SetCorpseDelay(1); - } + struct npc_mindless_ghoulAI : public ScriptedAI + { + npc_mindless_ghoulAI(Creature* c) : ScriptedAI(c) + { + me->SetCorpseDelay(1); + } - bool CanAIAttack(const Unit* who) const - { - return who->GetEntry() == NPC_INJURED_7TH_LEGION_SOLDER; - } + bool CanAIAttack(const Unit* who) const + { + return who->GetEntry() == NPC_INJURED_7TH_LEGION_SOLDER; + } - void JustDied(Unit*) - { - me->SetCorpseDelay(1); - } - }; + void JustDied(Unit*) + { + me->SetCorpseDelay(1); + } + }; }; class npc_injured_7th_legion_soldier : public CreatureScript { public: - npc_injured_7th_legion_soldier() : CreatureScript("npc_injured_7th_legion_soldier") { } + npc_injured_7th_legion_soldier() : CreatureScript("npc_injured_7th_legion_soldier") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_injured_7th_legion_soldierAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_injured_7th_legion_soldierAI (pCreature); + } - struct npc_injured_7th_legion_soldierAI : public NullCreatureAI - { - npc_injured_7th_legion_soldierAI(Creature* c) : NullCreatureAI(c) {} + struct npc_injured_7th_legion_soldierAI : public NullCreatureAI + { + npc_injured_7th_legion_soldierAI(Creature* c) : NullCreatureAI(c) {} - void Reset() - { - me->CastSpell(me, SPELL_FEAR_AURA_WITH_COWER, true); - me->SetWalk(false); - uint32 path = me->GetEntry()*10+urand(0,4); - if (me->GetPositionY() > -1150.0f) - path += 5; - me->GetMotionMaster()->MovePath(path, false); - } + void Reset() + { + me->CastSpell(me, SPELL_FEAR_AURA_WITH_COWER, true); + me->SetWalk(false); + uint32 path = me->GetEntry()*10+urand(0,4); + if (me->GetPositionY() > -1150.0f) + path += 5; + me->GetMotionMaster()->MovePath(path, false); + } - void MovementInform(uint32 type, uint32 point) - { - if (type != WAYPOINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 point) + { + if (type != WAYPOINT_MOTION_TYPE) + return; - if (point == 8) // max-1 - { - Talk(0); - me->RemoveAllAuras(); - me->DespawnOrUnsummon(1000); - if (TempSummon* summon = me->ToTempSummon()) - if (Unit* owner = summon->GetSummoner()) - if (Player* player = owner->ToPlayer()) - player->KilledMonsterCredit(me->GetEntry(), 0); - } - } - }; + if (point == 8) // max-1 + { + Talk(0); + me->RemoveAllAuras(); + me->DespawnOrUnsummon(1000); + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* owner = summon->GetSummoner()) + if (Player* player = owner->ToPlayer()) + player->KilledMonsterCredit(me->GetEntry(), 0); + } + } + }; }; class npc_heated_battle : public CreatureScript { public: - npc_heated_battle() : CreatureScript("npc_heated_battle") { } + npc_heated_battle() : CreatureScript("npc_heated_battle") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_heated_battleAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_heated_battleAI (pCreature); + } - struct npc_heated_battleAI : public CombatAI - { - npc_heated_battleAI(Creature* c) : CombatAI(c) {} + struct npc_heated_battleAI : public CombatAI + { + npc_heated_battleAI(Creature* c) : CombatAI(c) {} - void Reset() - { - me->SetCorpseDelay(60); - CombatAI::Reset(); - if (Unit* target = me->SelectNearestTarget(50.0f)) - AttackStart(target); - } + void Reset() + { + me->SetCorpseDelay(60); + CombatAI::Reset(); + if (Unit* target = me->SelectNearestTarget(50.0f)) + AttackStart(target); + } - void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) - { - if (who && who->GetTypeId() == TYPEID_PLAYER) - { - me->SetLootRecipient(who); - me->LowerPlayerDamageReq(me->GetMaxHealth()); - } - } - }; + void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) + { + if (who && who->GetTypeId() == TYPEID_PLAYER) + { + me->SetLootRecipient(who); + me->LowerPlayerDamageReq(me->GetMaxHealth()); + } + } + }; }; enum eFrostmourneCavern { - NPC_PRINCE_ARTHAS = 27455, + NPC_PRINCE_ARTHAS = 27455, }; class spell_q12478_frostmourne_cavern : public SpellScriptLoader @@ -626,7 +626,7 @@ public: void HandleSendEvent(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetCaster()->SummonCreature(NPC_PRINCE_ARTHAS, 4821.3f ,-580.14f, 163.541f, 4.57f); + GetCaster()->SummonCreature(NPC_PRINCE_ARTHAS, 4821.3f ,-580.14f, 163.541f, 4.57f); } void Register() @@ -652,27 +652,27 @@ class spell_q12243_fire_upon_the_waters : public SpellScriptLoader void HandleApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - std::list servants; - GetTarget()->GetCreatureListWithEntryInGrid(servants, 27233 /*NPC_ONSLAUGHT_DECKHAND*/, 40.0f); - for (std::list::const_iterator itr = servants.begin(); itr != servants.end(); ++itr) - { - (*itr)->SetSpeed(MOVE_RUN, 0.7f, true); - (*itr)->GetMotionMaster()->MoveFleeing(GetTarget(), GetDuration()); - } + std::list servants; + GetTarget()->GetCreatureListWithEntryInGrid(servants, 27233 /*NPC_ONSLAUGHT_DECKHAND*/, 40.0f); + for (std::list::const_iterator itr = servants.begin(); itr != servants.end(); ++itr) + { + (*itr)->SetSpeed(MOVE_RUN, 0.7f, true); + (*itr)->GetMotionMaster()->MoveFleeing(GetTarget(), GetDuration()); + } } - void HandleRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - std::list servants; - GetTarget()->GetCreatureListWithEntryInGrid(servants, 27233 /*NPC_ONSLAUGHT_DECKHAND*/, 100.0f); - for (std::list::const_iterator itr = servants.begin(); itr != servants.end(); ++itr) - (*itr)->SetSpeed(MOVE_RUN, 1.1f, true); + std::list servants; + GetTarget()->GetCreatureListWithEntryInGrid(servants, 27233 /*NPC_ONSLAUGHT_DECKHAND*/, 100.0f); + for (std::list::const_iterator itr = servants.begin(); itr != servants.end(); ++itr) + (*itr)->SetSpeed(MOVE_RUN, 1.1f, true); } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_q12243_fire_upon_the_waters_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_q12243_fire_upon_the_waters_AuraScript::HandleRemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_q12243_fire_upon_the_waters_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_q12243_fire_upon_the_waters_AuraScript::HandleRemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); } }; @@ -686,42 +686,42 @@ class spell_q12243_fire_upon_the_waters : public SpellScriptLoader enum eSandC { - QUEST_THE_SACRED_AND_THE_CORRUPT = 24545, - NPC_SAC_LICH_KING = 37857, - NPC_SAC_LIGHTS_VENGEANCE = 37826, - NPC_SAC_LIGHTS_VENGEANCE_VEH_1 = 37827, - NPC_SAC_LIGHTS_VENGEANCE_VEH_2 = 37952, - NPC_SAC_LIGHTS_VENGEANCE_BUNNY = 38001, - NPC_SAC_WRETCHED_GHOUL = 37881, - NPC_SAC_VEGARD_1 = 37893, - GO_SAC_LIGHTS_VENGEANCE_1 = 201844, - GO_SAC_LIGHTS_VENGEANCE_2 = 201922, - GO_SAC_LIGHTS_VENGEANCE_3 = 201937, - SPELL_SAC_STUN = 70583, - SPELL_SAC_REPEL_HAMMER = 70590, - SPELL_SAC_HOLY_ZONE_AURA = 70571, - SPELL_SAC_THROW_HAMMER = 70595, - SPELL_SAC_SUMMON_GO_1 = 70603, - SPELL_SAC_SUMMON_GHOULS_AURA = 70612, - SPELL_SAC_EMERGE = 50142, - SPELL_SAC_SHIELD_OF_THE_LICH_KING = 70692, - SPELL_SAC_ZAP_PLAYER = 70653, - SPELL_SAC_LK_DESPAWN_ANIM = 70673, - SPELL_SAC_VEGARD_SUMMON_GHOULS_AURA = 70737, - SPELL_SAC_GHOUL_AREA_AURA = 70782, - SPELL_SAC_HOLY_BOMB_VISUAL = 70785, - SPELL_SAC_HOLY_BOMB_EXPLOSION = 70786, - SPELL_SAC_ZAP_GHOULS_AURA = 70789, - SPELL_SAC_GHOUL_EXPLODE = 70787, - SPELL_SAC_KILL_VEGARD = 70792, - SPELL_SAC_SUMMON_GO_2 = 70894, - SPELL_SAC_SUMMON_VEGARD_SKELETON = 70862, - SPELL_SAC_HAMMER_SHIELD = 70970, - SPELL_SAC_SUMMON_GO_3 = 70967, + QUEST_THE_SACRED_AND_THE_CORRUPT = 24545, + NPC_SAC_LICH_KING = 37857, + NPC_SAC_LIGHTS_VENGEANCE = 37826, + NPC_SAC_LIGHTS_VENGEANCE_VEH_1 = 37827, + NPC_SAC_LIGHTS_VENGEANCE_VEH_2 = 37952, + NPC_SAC_LIGHTS_VENGEANCE_BUNNY = 38001, + NPC_SAC_WRETCHED_GHOUL = 37881, + NPC_SAC_VEGARD_1 = 37893, + GO_SAC_LIGHTS_VENGEANCE_1 = 201844, + GO_SAC_LIGHTS_VENGEANCE_2 = 201922, + GO_SAC_LIGHTS_VENGEANCE_3 = 201937, + SPELL_SAC_STUN = 70583, + SPELL_SAC_REPEL_HAMMER = 70590, + SPELL_SAC_HOLY_ZONE_AURA = 70571, + SPELL_SAC_THROW_HAMMER = 70595, + SPELL_SAC_SUMMON_GO_1 = 70603, + SPELL_SAC_SUMMON_GHOULS_AURA = 70612, + SPELL_SAC_EMERGE = 50142, + SPELL_SAC_SHIELD_OF_THE_LICH_KING = 70692, + SPELL_SAC_ZAP_PLAYER = 70653, + SPELL_SAC_LK_DESPAWN_ANIM = 70673, + SPELL_SAC_VEGARD_SUMMON_GHOULS_AURA = 70737, + SPELL_SAC_GHOUL_AREA_AURA = 70782, + SPELL_SAC_HOLY_BOMB_VISUAL = 70785, + SPELL_SAC_HOLY_BOMB_EXPLOSION = 70786, + SPELL_SAC_ZAP_GHOULS_AURA = 70789, + SPELL_SAC_GHOUL_EXPLODE = 70787, + SPELL_SAC_KILL_VEGARD = 70792, + SPELL_SAC_SUMMON_GO_2 = 70894, + SPELL_SAC_SUMMON_VEGARD_SKELETON = 70862, + SPELL_SAC_HAMMER_SHIELD = 70970, + SPELL_SAC_SUMMON_GO_3 = 70967, - // Xinef: - SPELL_SAC_BLUE_EXPLOSION = 70509, - SPELL_SAC_VEHICLE_CONTROL_AURA = 70510, + // Xinef: + SPELL_SAC_BLUE_EXPLOSION = 70509, + SPELL_SAC_VEHICLE_CONTROL_AURA = 70510, }; class WretchedGhoulCleaner @@ -729,658 +729,658 @@ class WretchedGhoulCleaner public: void operator()(Creature* creature) { - if (creature->GetEntry() == NPC_SAC_WRETCHED_GHOUL && creature->GetDisplayId() != 11686 && creature->IsAlive()) - Unit::Kill(creature, creature); + if (creature->GetEntry() == NPC_SAC_WRETCHED_GHOUL && creature->GetDisplayId() != 11686 && creature->IsAlive()) + Unit::Kill(creature, creature); } }; class npc_q24545_lich_king : public CreatureScript { public: - npc_q24545_lich_king() : CreatureScript("npc_q24545_lich_king") { } + npc_q24545_lich_king() : CreatureScript("npc_q24545_lich_king") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_q24545_lich_kingAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_q24545_lich_kingAI (pCreature); + } - struct npc_q24545_lich_kingAI : public NullCreatureAI - { - npc_q24545_lich_kingAI(Creature* c) : NullCreatureAI(c), summons(me) - { - } + struct npc_q24545_lich_kingAI : public NullCreatureAI + { + npc_q24545_lich_kingAI(Creature* c) : NullCreatureAI(c), summons(me) + { + } - EventMap events; - SummonList summons; - uint64 playerGUID; + EventMap events; + SummonList summons; + uint64 playerGUID; - void CleanAll(bool fromReset = true) - { - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_BUNNY, 150.0f, true)) - c->RemoveAllAuras(); - if (fromReset) - { - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE, 150.0f, true)) - c->DespawnOrUnsummon(1); - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) - c->RemoveAllAuras(); - } - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_2, 150.0f, true)) - c->DespawnOrUnsummon(1); - if (GameObject* go = me->FindNearestGameObject(GO_SAC_LIGHTS_VENGEANCE_1, 150.0f)) - go->Delete(); - if (GameObject* go = me->FindNearestGameObject(GO_SAC_LIGHTS_VENGEANCE_2, 150.0f)) - go->Delete(); - WretchedGhoulCleaner cleaner; - Trinity::CreatureWorker worker(me, cleaner); - me->VisitNearbyGridObject(150.0f, worker); - } + void CleanAll(bool fromReset = true) + { + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_BUNNY, 150.0f, true)) + c->RemoveAllAuras(); + if (fromReset) + { + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE, 150.0f, true)) + c->DespawnOrUnsummon(1); + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) + c->RemoveAllAuras(); + } + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_2, 150.0f, true)) + c->DespawnOrUnsummon(1); + if (GameObject* go = me->FindNearestGameObject(GO_SAC_LIGHTS_VENGEANCE_1, 150.0f)) + go->Delete(); + if (GameObject* go = me->FindNearestGameObject(GO_SAC_LIGHTS_VENGEANCE_2, 150.0f)) + go->Delete(); + WretchedGhoulCleaner cleaner; + Trinity::CreatureWorker worker(me, cleaner); + me->VisitNearbyGridObject(150.0f, worker); + } - void Reset() - { - events.Reset(); - events.ScheduleEvent(998, 10000); - events.ScheduleEvent(999, 0); - events.ScheduleEvent(1, 3000); - summons.DespawnAll(); - playerGUID = 0; + void Reset() + { + events.Reset(); + events.ScheduleEvent(998, 10000); + events.ScheduleEvent(999, 0); + events.ScheduleEvent(1, 3000); + summons.DespawnAll(); + playerGUID = 0; - CleanAll(); + CleanAll(); - me->setActive(false); - me->SetWalk(true); - me->SetVisible(false); - me->RemoveAllAuras(); - me->InterruptNonMeleeSpells(true); - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->UpdatePosition(x, y, z, o, true); - me->StopMovingOnCurrentPos(); - me->GetMotionMaster()->Clear(); - } + me->setActive(false); + me->SetWalk(true); + me->SetVisible(false); + me->RemoveAllAuras(); + me->InterruptNonMeleeSpells(true); + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->UpdatePosition(x, y, z, o, true); + me->StopMovingOnCurrentPos(); + me->GetMotionMaster()->Clear(); + } - void SetGUID(uint64 guid, int32 id) - { - if (playerGUID || events.GetNextEventTime(998) || events.GetNextEventTime(2)) - return; - me->setActive(true); - playerGUID = guid; - events.ScheduleEvent(2, 900000); - events.ScheduleEvent(3, 0); - } + void SetGUID(uint64 guid, int32 id) + { + if (playerGUID || events.GetNextEventTime(998) || events.GetNextEventTime(2)) + return; + me->setActive(true); + playerGUID = guid; + events.ScheduleEvent(2, 900000); + events.ScheduleEvent(3, 0); + } - void SetData(uint32 type, uint32 data) - { - if (!playerGUID || type != data) - return; - if (data == 1) - events.ScheduleEvent(15, 0); - else if (data == 2) - { - if (GameObject* go = me->FindNearestGameObject(GO_SAC_LIGHTS_VENGEANCE_2, 150.0f)) - go->Delete(); - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) - { - c->CastSpell(c, SPELL_SAC_HAMMER_SHIELD, true); - c->CastSpell(c, SPELL_SAC_SUMMON_GO_3, true); - if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) - p->KnockbackFrom(c->GetPositionX(), c->GetPositionY(), 5.0f, 3.0f); - } - events.ScheduleEvent(18, 3000); - } - else if (data == 3) - { - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) - { - c->RemoveAllAuras(); - c->CastSpell(c, SPELL_SAC_HOLY_ZONE_AURA, true); - if (GameObject* go = me->FindNearestGameObject(GO_SAC_LIGHTS_VENGEANCE_3, 150.0f)) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - playerGUID = 0; - events.RescheduleEvent(2, 60000); - } - } - } + void SetData(uint32 type, uint32 data) + { + if (!playerGUID || type != data) + return; + if (data == 1) + events.ScheduleEvent(15, 0); + else if (data == 2) + { + if (GameObject* go = me->FindNearestGameObject(GO_SAC_LIGHTS_VENGEANCE_2, 150.0f)) + go->Delete(); + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) + { + c->CastSpell(c, SPELL_SAC_HAMMER_SHIELD, true); + c->CastSpell(c, SPELL_SAC_SUMMON_GO_3, true); + if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) + p->KnockbackFrom(c->GetPositionX(), c->GetPositionY(), 5.0f, 3.0f); + } + events.ScheduleEvent(18, 3000); + } + else if (data == 3) + { + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) + { + c->RemoveAllAuras(); + c->CastSpell(c, SPELL_SAC_HOLY_ZONE_AURA, true); + if (GameObject* go = me->FindNearestGameObject(GO_SAC_LIGHTS_VENGEANCE_3, 150.0f)) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + playerGUID = 0; + events.RescheduleEvent(2, 60000); + } + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case 0: - break; - case 998: // ensure everything is cleaned up - CleanAll(false); - break; - case 999: // apply holy aura - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) - if (Creature* l = me->SummonCreature(NPC_SAC_LIGHTS_VENGEANCE, *c, TEMPSUMMON_MANUAL_DESPAWN)) - { - l->CastSpell(c, SPELL_SAC_VEHICLE_CONTROL_AURA, true); - c->CastSpell(c, SPELL_SAC_HOLY_ZONE_AURA, true); - } - break; - case 1: // check player - if (playerGUID) - { - bool valid = false; - if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) - if (p->IsAlive() && p->GetPhaseMask() & 2 && p->GetExactDistSq(me) < 100.0f*100.0f && !p->IsGameMaster()) - valid = true; - if (!valid) - { - Reset(); - return; - } - } - events.ScheduleEvent(1, 3000); - break; - case 2: // reset timer - Reset(); - break; - case 3: // start event - if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) - { - me->CastSpell(p, SPELL_SAC_STUN, true); - me->SetVisible(true); - Movement::PointsArray path; - path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - path.push_back(G3D::Vector3(4825.35f, -582.99f, 164.83f)); - path.push_back(G3D::Vector3(4813.38f, -580.94f, 162.62f)); - me->GetMotionMaster()->MoveSplinePath(&path); - events.ScheduleEvent(4, 10000); - } - break; - case 4: // talk 0 - Talk(0); - events.ScheduleEvent(5, 6000); - break; - case 5: // talk 1 - Talk(1); - events.ScheduleEvent(6, 4000); - events.ScheduleEvent(7, 11000); - break; - case 6: // repel hammer - me->CastSpell((Unit*)NULL, SPELL_SAC_REPEL_HAMMER, false); - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) - c->CastSpell(c, SPELL_SAC_BLUE_EXPLOSION, true); + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.ExecuteEvent()) + { + case 0: + break; + case 998: // ensure everything is cleaned up + CleanAll(false); + break; + case 999: // apply holy aura + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) + if (Creature* l = me->SummonCreature(NPC_SAC_LIGHTS_VENGEANCE, *c, TEMPSUMMON_MANUAL_DESPAWN)) + { + l->CastSpell(c, SPELL_SAC_VEHICLE_CONTROL_AURA, true); + c->CastSpell(c, SPELL_SAC_HOLY_ZONE_AURA, true); + } + break; + case 1: // check player + if (playerGUID) + { + bool valid = false; + if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) + if (p->IsAlive() && p->GetPhaseMask() & 2 && p->GetExactDistSq(me) < 100.0f*100.0f && !p->IsGameMaster()) + valid = true; + if (!valid) + { + Reset(); + return; + } + } + events.ScheduleEvent(1, 3000); + break; + case 2: // reset timer + Reset(); + break; + case 3: // start event + if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) + { + me->CastSpell(p, SPELL_SAC_STUN, true); + me->SetVisible(true); + Movement::PointsArray path; + path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + path.push_back(G3D::Vector3(4825.35f, -582.99f, 164.83f)); + path.push_back(G3D::Vector3(4813.38f, -580.94f, 162.62f)); + me->GetMotionMaster()->MoveSplinePath(&path); + events.ScheduleEvent(4, 10000); + } + break; + case 4: // talk 0 + Talk(0); + events.ScheduleEvent(5, 6000); + break; + case 5: // talk 1 + Talk(1); + events.ScheduleEvent(6, 4000); + events.ScheduleEvent(7, 11000); + break; + case 6: // repel hammer + me->CastSpell((Unit*)NULL, SPELL_SAC_REPEL_HAMMER, false); + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) + c->CastSpell(c, SPELL_SAC_BLUE_EXPLOSION, true); - events.ScheduleEvent(65, 3500); - break; - case 65: // spawn hammer go - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_BUNNY, 150.0f, true)) - { - c->CastSpell(c, SPELL_SAC_HOLY_ZONE_AURA, true); - c->CastSpell(c, SPELL_SAC_SUMMON_GO_1, true); - } - break; - case 7: // talk 2 - Talk(2); - events.ScheduleEvent(8, 8000); - events.ScheduleEvent(9, 11500); - break; - case 8: // summon ghouls - me->CastSpell((Unit*)NULL, SPELL_SAC_SUMMON_GHOULS_AURA, false); - break; - case 9: // talk 3 - Talk(3); - events.ScheduleEvent(10, 10000); - break; - case 10: // summon vegard - me->SummonCreature(NPC_SAC_VEGARD_1, 4812.12f, -586.08f, 162.49f, 3.14f, TEMPSUMMON_MANUAL_DESPAWN); - events.ScheduleEvent(11, 4000); - events.ScheduleEvent(12, 5000); - break; - case 11: // vagard shield - if (Creature* c = me->FindNearestCreature(NPC_SAC_VEGARD_1, 50.0f, true)) - c->CastSpell(c, SPELL_SAC_SHIELD_OF_THE_LICH_KING, false); - break; - case 12: // talk 4 - Talk(4); - if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) - me->CastSpell(p, SPELL_SAC_ZAP_PLAYER, false); - events.ScheduleEvent(13, 3500); - events.ScheduleEvent(14, 6000); - break; - case 13: // despawn - me->CastSpell(me, SPELL_SAC_LK_DESPAWN_ANIM, false); - break; - case 14: // vagard talk 0 - me->SetVisible(false); - me->RemoveAllAuras(); - if (Creature* c = me->FindNearestCreature(NPC_SAC_VEGARD_1, 50.0f, true)) - { - c->AI()->Talk(0); - c->CastSpell(c, SPELL_SAC_VEGARD_SUMMON_GHOULS_AURA, false); - } - if (GameObject* go = me->FindNearestGameObject(GO_SAC_LIGHTS_VENGEANCE_1, 150.0f)) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case 15: // remove light - if (Creature* x = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_2, 150.0f, true)) - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_BUNNY, 150.0f, true)) - { - c->RemoveAurasDueToSpell(SPELL_SAC_HOLY_ZONE_AURA); - if (Creature* l = me->SummonCreature(NPC_SAC_LIGHTS_VENGEANCE, *c, TEMPSUMMON_MANUAL_DESPAWN)) - { - x->SetCanFly(true); - x->SetDisableGravity(true); - x->SetHover(true); - x->NearTeleportTo(4812.09f, -585.55f, 172.03f, 3.75f); - l->EnterVehicle(x, 1); - //l->ClearUnitState(UNIT_STATE_ONVEHICLE); - l->CastSpell(l, SPELL_SAC_HOLY_BOMB_VISUAL, false); - l->AddAura(SPELL_SAC_HOLY_BOMB_VISUAL, l); - events.ScheduleEvent(16, 5000); - } - } - break; - case 16: // add aura to kill ghouls - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE, 150.0f, true)) - c->CastSpell(c, SPELL_SAC_ZAP_GHOULS_AURA, true); - if (Creature* c = me->FindNearestCreature(NPC_SAC_VEGARD_1, 50.0f, true)) - c->RemoveAurasDueToSpell(SPELL_SAC_VEGARD_SUMMON_GHOULS_AURA); - events.ScheduleEvent(17, 12000); - break; - case 17: // kill vegard - { - WretchedGhoulCleaner cleaner; - Trinity::CreatureWorker worker(me, cleaner); - me->VisitNearbyGridObject(150.0f, worker); + events.ScheduleEvent(65, 3500); + break; + case 65: // spawn hammer go + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_BUNNY, 150.0f, true)) + { + c->CastSpell(c, SPELL_SAC_HOLY_ZONE_AURA, true); + c->CastSpell(c, SPELL_SAC_SUMMON_GO_1, true); + } + break; + case 7: // talk 2 + Talk(2); + events.ScheduleEvent(8, 8000); + events.ScheduleEvent(9, 11500); + break; + case 8: // summon ghouls + me->CastSpell((Unit*)NULL, SPELL_SAC_SUMMON_GHOULS_AURA, false); + break; + case 9: // talk 3 + Talk(3); + events.ScheduleEvent(10, 10000); + break; + case 10: // summon vegard + me->SummonCreature(NPC_SAC_VEGARD_1, 4812.12f, -586.08f, 162.49f, 3.14f, TEMPSUMMON_MANUAL_DESPAWN); + events.ScheduleEvent(11, 4000); + events.ScheduleEvent(12, 5000); + break; + case 11: // vagard shield + if (Creature* c = me->FindNearestCreature(NPC_SAC_VEGARD_1, 50.0f, true)) + c->CastSpell(c, SPELL_SAC_SHIELD_OF_THE_LICH_KING, false); + break; + case 12: // talk 4 + Talk(4); + if (Player* p = ObjectAccessor::GetPlayer(*me, playerGUID)) + me->CastSpell(p, SPELL_SAC_ZAP_PLAYER, false); + events.ScheduleEvent(13, 3500); + events.ScheduleEvent(14, 6000); + break; + case 13: // despawn + me->CastSpell(me, SPELL_SAC_LK_DESPAWN_ANIM, false); + break; + case 14: // vagard talk 0 + me->SetVisible(false); + me->RemoveAllAuras(); + if (Creature* c = me->FindNearestCreature(NPC_SAC_VEGARD_1, 50.0f, true)) + { + c->AI()->Talk(0); + c->CastSpell(c, SPELL_SAC_VEGARD_SUMMON_GHOULS_AURA, false); + } + if (GameObject* go = me->FindNearestGameObject(GO_SAC_LIGHTS_VENGEANCE_1, 150.0f)) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case 15: // remove light + if (Creature* x = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_2, 150.0f, true)) + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_BUNNY, 150.0f, true)) + { + c->RemoveAurasDueToSpell(SPELL_SAC_HOLY_ZONE_AURA); + if (Creature* l = me->SummonCreature(NPC_SAC_LIGHTS_VENGEANCE, *c, TEMPSUMMON_MANUAL_DESPAWN)) + { + x->SetCanFly(true); + x->SetDisableGravity(true); + x->SetHover(true); + x->NearTeleportTo(4812.09f, -585.55f, 172.03f, 3.75f); + l->EnterVehicle(x, 1); + //l->ClearUnitState(UNIT_STATE_ONVEHICLE); + l->CastSpell(l, SPELL_SAC_HOLY_BOMB_VISUAL, false); + l->AddAura(SPELL_SAC_HOLY_BOMB_VISUAL, l); + events.ScheduleEvent(16, 5000); + } + } + break; + case 16: // add aura to kill ghouls + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE, 150.0f, true)) + c->CastSpell(c, SPELL_SAC_ZAP_GHOULS_AURA, true); + if (Creature* c = me->FindNearestCreature(NPC_SAC_VEGARD_1, 50.0f, true)) + c->RemoveAurasDueToSpell(SPELL_SAC_VEGARD_SUMMON_GHOULS_AURA); + events.ScheduleEvent(17, 12000); + break; + case 17: // kill vegard + { + WretchedGhoulCleaner cleaner; + Trinity::CreatureWorker worker(me, cleaner); + me->VisitNearbyGridObject(150.0f, worker); - if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE, 150.0f, true)) - if (Creature* v = me->FindNearestCreature(NPC_SAC_VEGARD_1, 50.0f, true)) - if (Creature* b = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) - { - c->CastSpell(v, SPELL_SAC_KILL_VEGARD, true); - v->SetDisplayId(11686); - v->DespawnOrUnsummon(1000); - b->CastSpell(b, SPELL_SAC_HOLY_BOMB_EXPLOSION, true); - b->CastSpell(b, SPELL_SAC_SUMMON_GO_2, true); - if (Unit* vb = c->GetVehicleBase()) - { - if (Unit* pass = vb->GetVehicleKit()->GetPassenger(0)) - if (pass->GetTypeId() == TYPEID_UNIT) - pass->ToCreature()->DespawnOrUnsummon(1); - vb->RemoveAllAuras(); - vb->ToCreature()->DespawnOrUnsummon(1); - } - c->ToCreature()->DespawnOrUnsummon(1); - } + if (Creature* c = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE, 150.0f, true)) + if (Creature* v = me->FindNearestCreature(NPC_SAC_VEGARD_1, 50.0f, true)) + if (Creature* b = me->FindNearestCreature(NPC_SAC_LIGHTS_VENGEANCE_VEH_1, 150.0f, true)) + { + c->CastSpell(v, SPELL_SAC_KILL_VEGARD, true); + v->SetDisplayId(11686); + v->DespawnOrUnsummon(1000); + b->CastSpell(b, SPELL_SAC_HOLY_BOMB_EXPLOSION, true); + b->CastSpell(b, SPELL_SAC_SUMMON_GO_2, true); + if (Unit* vb = c->GetVehicleBase()) + { + if (Unit* pass = vb->GetVehicleKit()->GetPassenger(0)) + if (pass->GetTypeId() == TYPEID_UNIT) + pass->ToCreature()->DespawnOrUnsummon(1); + vb->RemoveAllAuras(); + vb->ToCreature()->DespawnOrUnsummon(1); + } + c->ToCreature()->DespawnOrUnsummon(1); + } - } - break; - case 18: // summon vegard - me->CastSpell(me, SPELL_SAC_SUMMON_VEGARD_SKELETON, true); - break; - } - } + } + break; + case 18: // summon vegard + me->CastSpell(me, SPELL_SAC_SUMMON_VEGARD_SKELETON, true); + break; + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + } - void SpellHitTarget(Unit* target, SpellInfo const* spell) - { - if (spell->Id == SPELL_SAC_REPEL_HAMMER && target->GetTypeId() == TYPEID_UNIT) - { - target->CastSpell((Unit*)NULL, SPELL_SAC_THROW_HAMMER, true); - target->ToCreature()->DespawnOrUnsummon(1); - if (Unit* c = target->GetVehicleBase()) - c->RemoveAurasDueToSpell(SPELL_SAC_HOLY_ZONE_AURA); - } - } - }; + void SpellHitTarget(Unit* target, SpellInfo const* spell) + { + if (spell->Id == SPELL_SAC_REPEL_HAMMER && target->GetTypeId() == TYPEID_UNIT) + { + target->CastSpell((Unit*)NULL, SPELL_SAC_THROW_HAMMER, true); + target->ToCreature()->DespawnOrUnsummon(1); + if (Unit* c = target->GetVehicleBase()) + c->RemoveAurasDueToSpell(SPELL_SAC_HOLY_ZONE_AURA); + } + } + }; }; class at_q24545_frostmourne_cavern : public AreaTriggerScript { - public: - at_q24545_frostmourne_cavern() : AreaTriggerScript("at_q24545_frostmourne_cavern") { } + public: + at_q24545_frostmourne_cavern() : AreaTriggerScript("at_q24545_frostmourne_cavern") { } - bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) - { - if (player->GetPhaseMask() & 2) - if (Creature* c = player->FindNearestCreature(NPC_SAC_LICH_KING, 60.0f, true)) - c->AI()->SetGUID(player->GetGUID()); + bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) + { + if (player->GetPhaseMask() & 2) + if (Creature* c = player->FindNearestCreature(NPC_SAC_LICH_KING, 60.0f, true)) + c->AI()->SetGUID(player->GetGUID()); - return true; - } + return true; + } }; class SACActivateEvent : public BasicEvent { - public: - SACActivateEvent(Creature* owner) : _owner(owner) {} + public: + SACActivateEvent(Creature* owner) : _owner(owner) {} - bool Execute(uint64 /*time*/, uint32 /*diff*/) - { - if (!_owner->IsAlive()) - return true; - _owner->GetMotionMaster()->MoveRandom(5.0f); - _owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - _owner->SetReactState(REACT_AGGRESSIVE); - _owner->CastSpell(_owner, SPELL_SAC_GHOUL_AREA_AURA, true); - return true; - } + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + if (!_owner->IsAlive()) + return true; + _owner->GetMotionMaster()->MoveRandom(5.0f); + _owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + _owner->SetReactState(REACT_AGGRESSIVE); + _owner->CastSpell(_owner, SPELL_SAC_GHOUL_AREA_AURA, true); + return true; + } - private: - Creature* _owner; + private: + Creature* _owner; }; class SACDeactivateEvent : public BasicEvent { - public: - SACDeactivateEvent(Creature* owner) : _owner(owner) {} + public: + SACDeactivateEvent(Creature* owner) : _owner(owner) {} - bool Execute(uint64 /*time*/, uint32 /*diff*/) - { - _owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - _owner->SetReactState(REACT_PASSIVE); - _owner->SetDisplayId(11686); - return true; - } + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + _owner->SetReactState(REACT_PASSIVE); + _owner->SetDisplayId(11686); + return true; + } - private: - Creature* _owner; + private: + Creature* _owner; }; class npc_q24545_wretched_ghoul : public CreatureScript { public: - npc_q24545_wretched_ghoul() : CreatureScript("npc_q24545_wretched_ghoul") { } + npc_q24545_wretched_ghoul() : CreatureScript("npc_q24545_wretched_ghoul") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_q24545_wretched_ghoulAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_q24545_wretched_ghoulAI (pCreature); + } - struct npc_q24545_wretched_ghoulAI : public ScriptedAI - { - npc_q24545_wretched_ghoulAI(Creature* c) : ScriptedAI(c) - { - Deactivate(); - } + struct npc_q24545_wretched_ghoulAI : public ScriptedAI + { + npc_q24545_wretched_ghoulAI(Creature* c) : ScriptedAI(c) + { + Deactivate(); + } - void Reset() - { - me->SetCorpseDelay(3); - } + void Reset() + { + me->SetCorpseDelay(3); + } - void DoAction(int32 a) - { - if (a == -1) - Activate(); - else if (a == -2) - { - me->CastSpell(me, SPELL_SAC_GHOUL_EXPLODE, true); - Unit::Kill(me, me); - me->m_Events.KillAllEvents(true); - Deactivate(); - } - } + void DoAction(int32 a) + { + if (a == -1) + Activate(); + else if (a == -2) + { + me->CastSpell(me, SPELL_SAC_GHOUL_EXPLODE, true); + Unit::Kill(me, me); + me->m_Events.KillAllEvents(true); + Deactivate(); + } + } - void AttackStart(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return; - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + return; + ScriptedAI::AttackStart(who); + } - bool CanAIAttack(const Unit* target) const - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) || target->HasUnitState(UNIT_STATE_STUNNED) || me->GetDisplayId() == 11686) - return false; - Position homePos = me->GetHomePosition(); - return target->GetExactDistSq(&homePos) < 30.0f*30.0f; - } + bool CanAIAttack(const Unit* target) const + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) || target->HasUnitState(UNIT_STATE_STUNNED) || me->GetDisplayId() == 11686) + return false; + Position homePos = me->GetHomePosition(); + return target->GetExactDistSq(&homePos) < 30.0f*30.0f; + } - void Activate() - { - me->SetDisplayId(me->GetNativeDisplayId()); - me->CastSpell(me, SPELL_SAC_EMERGE, true); - me->m_Events.AddEvent(new SACActivateEvent(me), me->m_Events.CalculateTime(4000)); - } + void Activate() + { + me->SetDisplayId(me->GetNativeDisplayId()); + me->CastSpell(me, SPELL_SAC_EMERGE, true); + me->m_Events.AddEvent(new SACActivateEvent(me), me->m_Events.CalculateTime(4000)); + } - void Deactivate() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetReactState(REACT_PASSIVE); - me->SetDisplayId(11686); - } + void Deactivate() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_PASSIVE); + me->SetDisplayId(11686); + } - void JustDied(Unit* /*killer*/) - { - me->RemoveAurasDueToSpell(SPELL_SAC_GHOUL_AREA_AURA); - me->m_Events.AddEvent(new SACDeactivateEvent(me), me->m_Events.CalculateTime(4000)); - } + void JustDied(Unit* /*killer*/) + { + me->RemoveAurasDueToSpell(SPELL_SAC_GHOUL_AREA_AURA); + me->m_Events.AddEvent(new SACDeactivateEvent(me), me->m_Events.CalculateTime(4000)); + } - void JustRespawned() - { - Deactivate(); - } - }; + void JustRespawned() + { + Deactivate(); + } + }; }; class GhoulTargetCheck { - public: - explicit GhoulTargetCheck(bool alive) : _alive(alive) {} - bool operator()(WorldObject* object) const - { - return _alive ^ (object->GetTypeId() != TYPEID_UNIT || ((Unit*)object)->GetDisplayId() != 11686); - } - private: - bool _alive; + public: + explicit GhoulTargetCheck(bool alive) : _alive(alive) {} + bool operator()(WorldObject* object) const + { + return _alive ^ (object->GetTypeId() != TYPEID_UNIT || ((Unit*)object)->GetDisplayId() != 11686); + } + private: + bool _alive; }; class spell_q24545_aod_special : public SpellScriptLoader { - public: - spell_q24545_aod_special() : SpellScriptLoader("spell_q24545_aod_special") { } + public: + spell_q24545_aod_special() : SpellScriptLoader("spell_q24545_aod_special") { } - class spell_q24545_aod_special_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q24545_aod_special_SpellScript); + class spell_q24545_aod_special_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q24545_aod_special_SpellScript); - void FilterTargets(std::list& targets) - { - targets.remove_if(GhoulTargetCheck(GetSpellInfo()->Id == 70790)); - Trinity::Containers::RandomResizeList(targets, 2); - } + void FilterTargets(std::list& targets) + { + targets.remove_if(GhoulTargetCheck(GetSpellInfo()->Id == 70790)); + Trinity::Containers::RandomResizeList(targets, 2); + } - void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - if (target->GetTypeId() == TYPEID_UNIT) - target->ToCreature()->AI()->DoAction(GetSpellInfo()->Id == 70790 ? -2 : -1); - } + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + if (target->GetTypeId() == TYPEID_UNIT) + target->ToCreature()->AI()->DoAction(GetSpellInfo()->Id == 70790 ? -2 : -1); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_q24545_aod_special_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - OnEffectHitTarget += SpellEffectFn(spell_q24545_aod_special_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_q24545_aod_special_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnEffectHitTarget += SpellEffectFn(spell_q24545_aod_special_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_q24545_aod_special_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_q24545_aod_special_SpellScript(); + } }; class npc_q24545_vegard_dummy : public CreatureScript { public: - npc_q24545_vegard_dummy() : CreatureScript("npc_q24545_vegard_dummy") { } + npc_q24545_vegard_dummy() : CreatureScript("npc_q24545_vegard_dummy") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_q24545_vegard_dummyAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_q24545_vegard_dummyAI (pCreature); + } - struct npc_q24545_vegard_dummyAI : public NullCreatureAI - { - npc_q24545_vegard_dummyAI(Creature* c) : NullCreatureAI(c) - { - done = false; - } + struct npc_q24545_vegard_dummyAI : public NullCreatureAI + { + npc_q24545_vegard_dummyAI(Creature* c) : NullCreatureAI(c) + { + done = false; + } - bool done; + bool done; - void UpdateAI(uint32 diff) - { - if (!done) - { - done = true; - me->CastSpell(me, SPELL_SAC_EMERGE, true); - } - } + void UpdateAI(uint32 diff) + { + if (!done) + { + done = true; + me->CastSpell(me, SPELL_SAC_EMERGE, true); + } + } - }; + }; }; class npc_q24545_vegard : public CreatureScript { public: - npc_q24545_vegard() : CreatureScript("npc_q24545_vegard") { } + npc_q24545_vegard() : CreatureScript("npc_q24545_vegard") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_q24545_vegardAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_q24545_vegardAI (pCreature); + } - struct npc_q24545_vegardAI : public ScriptedAI - { - npc_q24545_vegardAI(Creature* c) : ScriptedAI(c) - { - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - events.Reset(); - events.ScheduleEvent(1, 7000); - events.ScheduleEvent(2, urand(7000, 20000)); - events.ScheduleEvent(3, urand(7000, 20000)); - events.ScheduleEvent(4, urand(7000, 20000)); - events.ScheduleEvent(5, urand(7000, 20000)); - events.ScheduleEvent(6, 1); - } + struct npc_q24545_vegardAI : public ScriptedAI + { + npc_q24545_vegardAI(Creature* c) : ScriptedAI(c) + { + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + events.Reset(); + events.ScheduleEvent(1, 7000); + events.ScheduleEvent(2, urand(7000, 20000)); + events.ScheduleEvent(3, urand(7000, 20000)); + events.ScheduleEvent(4, urand(7000, 20000)); + events.ScheduleEvent(5, urand(7000, 20000)); + events.ScheduleEvent(6, 1); + } - EventMap events; + EventMap events; - void JustDied(Unit* /*killer*/) - { - Talk(1); - me->DespawnOrUnsummon(10000); - if (Creature* c = me->FindNearestCreature(NPC_SAC_LICH_KING, 200.0f, true)) - c->AI()->SetData(3, 3); - } + void JustDied(Unit* /*killer*/) + { + Talk(1); + me->DespawnOrUnsummon(10000); + if (Creature* c = me->FindNearestCreature(NPC_SAC_LICH_KING, 200.0f, true)) + c->AI()->SetData(3, 3); + } - void KilledUnit(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER) - Talk(2); - } + void KilledUnit(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(2); + } - void UpdateAI(uint32 diff) - { - UpdateVictim(); - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - switch (events.GetEvent()) - { - case 0: - break; - case 1: - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Unit* t = me->SelectNearestTarget(50.0f)) - AttackStart(t); - events.PopEvent(); - break; - case 2: - me->CastSpell((Unit*)NULL, 70866, false); - events.RepeatEvent(urand(30000, 35000)); - break; - case 3: - if (me->GetVictim()) - me->CastSpell(me->GetVictim(), 70886, false); - events.RepeatEvent(urand(15000, 30000)); - break; - case 4: - if (me->GetVictim()) - me->CastSpell(me->GetVictim(), 71003, false); - events.RepeatEvent(urand(15000, 30000)); - break; - case 5: - if (me->GetVictim()) - me->CastSpell(me->GetVictim(), 70864, false); - events.RepeatEvent(urand(8000, 12000)); - break; - case 6: - Talk(0); - me->CastSpell(me, SPELL_SAC_EMERGE, true); - events.PopEvent(); - break; - } - DoMeleeAttackIfReady(); - } - }; + void UpdateAI(uint32 diff) + { + UpdateVictim(); + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + switch (events.GetEvent()) + { + case 0: + break; + case 1: + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (Unit* t = me->SelectNearestTarget(50.0f)) + AttackStart(t); + events.PopEvent(); + break; + case 2: + me->CastSpell((Unit*)NULL, 70866, false); + events.RepeatEvent(urand(30000, 35000)); + break; + case 3: + if (me->GetVictim()) + me->CastSpell(me->GetVictim(), 70886, false); + events.RepeatEvent(urand(15000, 30000)); + break; + case 4: + if (me->GetVictim()) + me->CastSpell(me->GetVictim(), 71003, false); + events.RepeatEvent(urand(15000, 30000)); + break; + case 5: + if (me->GetVictim()) + me->CastSpell(me->GetVictim(), 70864, false); + events.RepeatEvent(urand(8000, 12000)); + break; + case 6: + Talk(0); + me->CastSpell(me, SPELL_SAC_EMERGE, true); + events.PopEvent(); + break; + } + DoMeleeAttackIfReady(); + } + }; }; class npc_spiritual_insight : public CreatureScript { public: - npc_spiritual_insight() : CreatureScript("npc_spiritual_insight") { } + npc_spiritual_insight() : CreatureScript("npc_spiritual_insight") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_spiritual_insightAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_spiritual_insightAI (pCreature); + } - struct npc_spiritual_insightAI : public NullCreatureAI - { - npc_spiritual_insightAI(Creature* c) : NullCreatureAI(c) {} + struct npc_spiritual_insightAI : public NullCreatureAI + { + npc_spiritual_insightAI(Creature* c) : NullCreatureAI(c) {} - uint8 GetSpeachId() - { - if (me->GetDistance2d(2686, 934) < 2.0f) - return 0; - if (me->GetDistance2d(3097, 1037) < 2.0f) - return 1; - if (me->GetDistance2d(3014, 1321) < 2.0f) - return 2; - if (me->GetDistance2d(2854, 1514) < 2.0f) - return 3; - if (me->GetDistance2d(3129, 1556) < 2.0f) - return 4; + uint8 GetSpeachId() + { + if (me->GetDistance2d(2686, 934) < 2.0f) + return 0; + if (me->GetDistance2d(3097, 1037) < 2.0f) + return 1; + if (me->GetDistance2d(3014, 1321) < 2.0f) + return 2; + if (me->GetDistance2d(2854, 1514) < 2.0f) + return 3; + if (me->GetDistance2d(3129, 1556) < 2.0f) + return 4; - return 5; - } + return 5; + } - void IsSummonedBy(Unit* summoner) - { - if (!summoner || summoner->GetTypeId() != TYPEID_PLAYER) - return; + void IsSummonedBy(Unit* summoner) + { + if (!summoner || summoner->GetTypeId() != TYPEID_PLAYER) + return; - uint8 id = GetSpeachId(); - std::string const& text = sCreatureTextMgr->GetLocalizedChatString(me->GetEntry(), id, 0, LOCALE_enUS); - WorldPacket data; - ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, me->GetGUID(), summoner->GetGUID(), text, CHAT_TAG_NONE, "Toalu'u the Mystic"); - summoner->ToPlayer()->SendDirectMessage(&data); + uint8 id = GetSpeachId(); + std::string const& text = sCreatureTextMgr->GetLocalizedChatString(me->GetEntry(), id, 0, LOCALE_enUS); + WorldPacket data; + ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, me->GetGUID(), summoner->GetGUID(), text, CHAT_TAG_NONE, "Toalu'u the Mystic"); + summoner->ToPlayer()->SendDirectMessage(&data); - if (id == 1) - if (Aura* aura = summoner->GetAura(47189)) // Transform Aura - aura->SetDuration(aura->GetDuration()-MINUTE*IN_MILLISECONDS); - } - }; + if (id == 1) + if (Aura* aura = summoner->GetAura(47189)) // Transform Aura + aura->SetDuration(aura->GetDuration()-MINUTE*IN_MILLISECONDS); + } + }; }; @@ -1917,25 +1917,25 @@ class npc_torturer_lecraft : public CreatureScript void AddSC_dragonblight() { - // Ours - new npc_conversing_with_the_depths_trigger(); - new go_the_pearl_of_the_depths(); - new npc_hourglass_of_eternity(); - new npc_future_you(); - new npc_mindless_ghoul(); - new npc_injured_7th_legion_soldier(); - new npc_heated_battle(); - new spell_q12478_frostmourne_cavern(); - new spell_q12243_fire_upon_the_waters(); - new npc_q24545_lich_king(); - new at_q24545_frostmourne_cavern(); - new npc_q24545_wretched_ghoul(); - new spell_q24545_aod_special(); - new npc_q24545_vegard_dummy(); - new npc_q24545_vegard(); - new npc_spiritual_insight(); + // Ours + new npc_conversing_with_the_depths_trigger(); + new go_the_pearl_of_the_depths(); + new npc_hourglass_of_eternity(); + new npc_future_you(); + new npc_mindless_ghoul(); + new npc_injured_7th_legion_soldier(); + new npc_heated_battle(); + new spell_q12478_frostmourne_cavern(); + new spell_q12243_fire_upon_the_waters(); + new npc_q24545_lich_king(); + new at_q24545_frostmourne_cavern(); + new npc_q24545_wretched_ghoul(); + new spell_q24545_aod_special(); + new npc_q24545_vegard_dummy(); + new npc_q24545_vegard(); + new npc_spiritual_insight(); - // Theirs + // Theirs new npc_commander_eligor_dawnbringer(); new spell_q12096_q12092_dummy(); new spell_q12096_q12092_bark(); diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index d8644f8c6..e9e7619fa 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -29,9 +29,9 @@ // Ours enum qRedRocket { - SPELL_TORPEDO_EXPLODE = 49290, - SPELL_ALLIANCE_TORPEDO_KILL_CREDIT = 49510, - SPELL_HORDE_TORPEDO_KILL_CREDIT = 49340, + SPELL_TORPEDO_EXPLODE = 49290, + SPELL_ALLIANCE_TORPEDO_KILL_CREDIT = 49510, + SPELL_HORDE_TORPEDO_KILL_CREDIT = 49340, }; @@ -40,7 +40,7 @@ class npc_riding_the_red_rocket : public CreatureScript public: npc_riding_the_red_rocket() : CreatureScript("npc_riding_the_red_rocket") { } - struct npc_riding_the_red_rocketAI : public VehicleAI + struct npc_riding_the_red_rocketAI : public VehicleAI { npc_riding_the_red_rocketAI(Creature* creature) : VehicleAI(creature) {} @@ -50,30 +50,30 @@ public: void UpdateAI(uint32 diff) { - if (me->GetDistance(2763, -1596, 0) < 20.0f) // Horde ship - { - me->CastSpell(me, SPELL_ALLIANCE_TORPEDO_KILL_CREDIT, true); - if (Unit* owner = me->GetCharmerOrOwner()) - { - Position pos(me->GetHomePosition()); - owner->ExitVehicle(); - me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), false); - owner->CastSpell(owner, SPELL_TORPEDO_EXPLODE, true); - owner->KnockbackFrom(owner->GetPositionX(), owner->GetPositionY(), 5.0f, 50.0f); - } - } - else if (me->GetDistance(2545, -2242, 0) < 20.0f) // Alliance ship - { - me->CastSpell(me, SPELL_HORDE_TORPEDO_KILL_CREDIT, true); - if (Unit* owner = me->GetCharmerOrOwner()) - { - Position pos(me->GetHomePosition()); - owner->ExitVehicle(); - me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), false); - owner->CastSpell(owner, SPELL_TORPEDO_EXPLODE, true); - owner->KnockbackFrom(owner->GetPositionX(), owner->GetPositionY(), 5.0f, 50.0f); - } - } + if (me->GetDistance(2763, -1596, 0) < 20.0f) // Horde ship + { + me->CastSpell(me, SPELL_ALLIANCE_TORPEDO_KILL_CREDIT, true); + if (Unit* owner = me->GetCharmerOrOwner()) + { + Position pos(me->GetHomePosition()); + owner->ExitVehicle(); + me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), false); + owner->CastSpell(owner, SPELL_TORPEDO_EXPLODE, true); + owner->KnockbackFrom(owner->GetPositionX(), owner->GetPositionY(), 5.0f, 50.0f); + } + } + else if (me->GetDistance(2545, -2242, 0) < 20.0f) // Alliance ship + { + me->CastSpell(me, SPELL_HORDE_TORPEDO_KILL_CREDIT, true); + if (Unit* owner = me->GetCharmerOrOwner()) + { + Position pos(me->GetHomePosition()); + owner->ExitVehicle(); + me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), false); + owner->CastSpell(owner, SPELL_TORPEDO_EXPLODE, true); + owner->KnockbackFrom(owner->GetPositionX(), owner->GetPositionY(), 5.0f, 50.0f); + } + } } }; @@ -889,10 +889,10 @@ class spell_infected_worgen_bite : public SpellScriptLoader void AddSC_grizzly_hills() { - // Ours - new npc_riding_the_red_rocket(); + // Ours + new npc_riding_the_red_rocket(); - // Theirs + // Theirs new npc_emily(); new npc_mrfloppy(); new npc_outhouse_bunny(); diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp index fb3c5f909..4ce16fa6c 100644 --- a/src/server/scripts/Northrend/zone_howling_fjord.cpp +++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp @@ -39,112 +39,112 @@ EndContentData */ class npc_attracted_reef_bull : public CreatureScript { public: - npc_attracted_reef_bull() : CreatureScript("npc_attracted_reef_bull") { } + npc_attracted_reef_bull() : CreatureScript("npc_attracted_reef_bull") { } - struct npc_attracted_reef_bullAI : public NullCreatureAI - { - npc_attracted_reef_bullAI(Creature* creature) : NullCreatureAI(creature) - { - me->SetDisableGravity(true); - if (me->IsSummon()) - if (Unit* owner = me->ToTempSummon()->GetSummoner()) - me->GetMotionMaster()->MovePoint(0, *owner); - } + struct npc_attracted_reef_bullAI : public NullCreatureAI + { + npc_attracted_reef_bullAI(Creature* creature) : NullCreatureAI(creature) + { + me->SetDisableGravity(true); + if (me->IsSummon()) + if (Unit* owner = me->ToTempSummon()->GetSummoner()) + me->GetMotionMaster()->MovePoint(0, *owner); + } - void MovementInform(uint32 type, uint32 id) - { - if (Creature* cow = me->FindNearestCreature(24797, 5.0f, true)) - { - me->CastSpell(me, 44460, true); - me->DespawnOrUnsummon(10000); - cow->CastSpell(cow, 44460, true); - cow->DespawnOrUnsummon(10000); - if (me->IsSummon()) - if (Unit* owner = me->ToTempSummon()->GetSummoner()) - owner->CastSpell(owner, 44463, true); - } - } - - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (caster && spellInfo->Id == 44454) - me->GetMotionMaster()->MovePoint(0, *caster); - } - }; + void MovementInform(uint32 type, uint32 id) + { + if (Creature* cow = me->FindNearestCreature(24797, 5.0f, true)) + { + me->CastSpell(me, 44460, true); + me->DespawnOrUnsummon(10000); + cow->CastSpell(cow, 44460, true); + cow->DespawnOrUnsummon(10000); + if (me->IsSummon()) + if (Unit* owner = me->ToTempSummon()->GetSummoner()) + owner->CastSpell(owner, 44463, true); + } + } + + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (caster && spellInfo->Id == 44454) + me->GetMotionMaster()->MovePoint(0, *caster); + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_attracted_reef_bullAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_attracted_reef_bullAI(creature); + } }; class npc_your_inner_turmoil : public CreatureScript { public: - npc_your_inner_turmoil() : CreatureScript("npc_your_inner_turmoil") { } + npc_your_inner_turmoil() : CreatureScript("npc_your_inner_turmoil") { } - struct npc_your_inner_turmoilAI : public ScriptedAI - { - npc_your_inner_turmoilAI(Creature* creature) : ScriptedAI(creature) {} + struct npc_your_inner_turmoilAI : public ScriptedAI + { + npc_your_inner_turmoilAI(Creature* creature) : ScriptedAI(creature) {} - uint32 timer; - short phase; + uint32 timer; + short phase; - void Reset() - { - timer = 0; - phase = 0; - } + void Reset() + { + timer = 0; + phase = 0; + } - void UpdateAI(uint32 diff) - { - if (timer >= 6000 && phase < 4) - { - phase++; - setphase(phase); - timer = 0; - } - - timer += diff; - - DoMeleeAttackIfReady(); - } + void UpdateAI(uint32 diff) + { + if (timer >= 6000 && phase < 4) + { + phase++; + setphase(phase); + timer = 0; + } + + timer += diff; + + DoMeleeAttackIfReady(); + } - void setphase(short phase) - { - Unit* summoner = me->ToTempSummon() ? me->ToTempSummon()->GetSummoner() : NULL; - if (!summoner || summoner->GetTypeId() != TYPEID_PLAYER) - return; + void setphase(short phase) + { + Unit* summoner = me->ToTempSummon() ? me->ToTempSummon()->GetSummoner() : NULL; + if (!summoner || summoner->GetTypeId() != TYPEID_PLAYER) + return; - switch (phase) - { - case 1: - me->MonsterWhisper("You think that you can get rid of me through meditation?", summoner->ToPlayer()); - return; - case 2: - me->MonsterWhisper("Fool! I will destroy you and finally become that which has been building inside of you all these years!", summoner->ToPlayer()); - return; - case 3: - me->MonsterWhisper("You cannot defeat me. I'm an inseparable part of you!", summoner->ToPlayer()); - return; - case 4: - me->MonsterWhisper("NOOOOOOOoooooooooo!", summoner->ToPlayer()); - me->SetLevel(summoner->getLevel()); - me->setFaction(14); - if (me->GetExactDist(summoner) < 50.0f) - { - me->UpdatePosition(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ(), 0.0f, true); - summoner->CastSpell(me, 50218, true); // clone caster - AttackStart(summoner); - } - } - } - }; + switch (phase) + { + case 1: + me->MonsterWhisper("You think that you can get rid of me through meditation?", summoner->ToPlayer()); + return; + case 2: + me->MonsterWhisper("Fool! I will destroy you and finally become that which has been building inside of you all these years!", summoner->ToPlayer()); + return; + case 3: + me->MonsterWhisper("You cannot defeat me. I'm an inseparable part of you!", summoner->ToPlayer()); + return; + case 4: + me->MonsterWhisper("NOOOOOOOoooooooooo!", summoner->ToPlayer()); + me->SetLevel(summoner->getLevel()); + me->setFaction(14); + if (me->GetExactDist(summoner) < 50.0f) + { + me->UpdatePosition(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ(), 0.0f, true); + summoner->CastSpell(me, 50218, true); // clone caster + AttackStart(summoner); + } + } + } + }; - CreatureAI *GetAI(Creature* creature) const - { - return new npc_your_inner_turmoilAI(creature); - } + CreatureAI *GetAI(Creature* creature) const + { + return new npc_your_inner_turmoilAI(creature); + } }; @@ -172,7 +172,7 @@ public: { if (quest->GetQuestId() == QUEST_TRAIL_OF_FIRE) { - creature->setFaction(player->GetTeamId() == TEAM_ALLIANCE ? FACTION_ESCORTEE_A : FACTION_ESCORTEE_H); + creature->setFaction(player->GetTeamId() == TEAM_ALLIANCE ? FACTION_ESCORTEE_A : FACTION_ESCORTEE_H); CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); } return true; @@ -386,11 +386,11 @@ public: void AddSC_howling_fjord() { - // Ours - new npc_attracted_reef_bull(); - new npc_your_inner_turmoil(); + // Ours + new npc_attracted_reef_bull(); + new npc_your_inner_turmoil(); - // Theirs + // Theirs new npc_apothecary_hanes(); new npc_plaguehound_tracker(); new npc_razael_and_lyana(); diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index a057fa601..0f23cc53a 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -41,10 +41,10 @@ EndContentData */ // Ours enum eBKG { - QUEST_BLACK_KNIGHT_CURSE = 14016, + QUEST_BLACK_KNIGHT_CURSE = 14016, - NPC_CULT_ASSASSIN = 35127, - NPC_CULT_SABOTEUR = 35116, + NPC_CULT_ASSASSIN = 35127, + NPC_CULT_SABOTEUR = 35116, }; class npc_black_knight_graveyard : public CreatureScript @@ -55,19 +55,19 @@ public: struct npc_black_knight_graveyardAI : public ScriptedAI { npc_black_knight_graveyardAI(Creature* creature) : ScriptedAI(creature) - { - } + { + } void MoveInLineOfSight(Unit* who) { if (who->GetTypeId() != TYPEID_PLAYER || me->GetDistance(who) > 8.0f || who->ToPlayer()->GetQuestStatus(QUEST_BLACK_KNIGHT_CURSE) != QUEST_STATUS_INCOMPLETE) - return; + return; - if (me->FindNearestCreature(NPC_CULT_ASSASSIN, 30.0f)) - return; + if (me->FindNearestCreature(NPC_CULT_ASSASSIN, 30.0f)) + return; - me->SummonCreature(NPC_CULT_ASSASSIN, 8452.50f, 459.08f, 596.08f, 0.93f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_CULT_SABOTEUR, 8455.47f, 458.64f, 596.08f, 2.36f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_CULT_ASSASSIN, 8452.50f, 459.08f, 596.08f, 0.93f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_CULT_SABOTEUR, 8455.47f, 458.64f, 596.08f, 2.36f, TEMPSUMMON_CORPSE_DESPAWN); } }; @@ -79,31 +79,31 @@ public: enum valhalas { - QUEST_BFV_FALLEN_HEROES = 13214, - QUEST_BFV_DARK_MASTER = 13215, - QUEST_BFV_SIGRID = 13216, - QUEST_BFV_CARNAGE = 13217, - QUEST_BFV_THANE = 13218, - QUEST_BFV_FINAL = 13219, + QUEST_BFV_FALLEN_HEROES = 13214, + QUEST_BFV_DARK_MASTER = 13215, + QUEST_BFV_SIGRID = 13216, + QUEST_BFV_CARNAGE = 13217, + QUEST_BFV_THANE = 13218, + QUEST_BFV_FINAL = 13219, - EVENT_VALHALAS_FIRST = 1, - EVENT_VALHALAS_SECOND = 2, - EVENT_VALHALAS_THIRD = 3, - EVENT_VALHALAS_CHECK_PLAYER = 4, + EVENT_VALHALAS_FIRST = 1, + EVENT_VALHALAS_SECOND = 2, + EVENT_VALHALAS_THIRD = 3, + EVENT_VALHALAS_CHECK_PLAYER = 4, - // Fallen Heroes - NPC_ELDRETH = 31195, - NPC_GENESS = 31193, - NPC_JHADRAS = 31191, - NPC_MASUD = 31192, - NPC_RITH = 31196, - NPC_TALLA = 31194, + // Fallen Heroes + NPC_ELDRETH = 31195, + NPC_GENESS = 31193, + NPC_JHADRAS = 31191, + NPC_MASUD = 31192, + NPC_RITH = 31196, + NPC_TALLA = 31194, - NPC_DARK_MASTER = 31222, - NPC_SIGRID = 31242, - NPC_CARNAGE = 31271, - NPC_THANE = 31277, - NPC_PRINCE = 14688, // no mistake + NPC_DARK_MASTER = 31222, + NPC_SIGRID = 31242, + NPC_CARNAGE = 31271, + NPC_THANE = 31277, + NPC_PRINCE = 14688, // no mistake }; class npc_battle_at_valhalas : public CreatureScript @@ -115,241 +115,241 @@ public: { npc_battle_at_valhalasAI(Creature* creature) : ScriptedAI(creature), summons(me) { - playerGUID2= 0; + playerGUID2= 0; } - EventMap events; - SummonList summons; - uint64 playerGUID; - uint64 playerGUID2; - uint32 currentQuest; + EventMap events; + SummonList summons; + uint64 playerGUID; + uint64 playerGUID2; + uint32 currentQuest; - void Reset() + void Reset() { - events.Reset(); - summons.DespawnAll(); - playerGUID = 0; - currentQuest = 0; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + events.Reset(); + summons.DespawnAll(); + playerGUID = 0; + currentQuest = 0; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } - void JustSummoned(Creature* creature) - { - summons.Summon(creature); - if (creature->GetEntry() != NPC_PRINCE) - if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) - creature->AI()->AttackStart(player); - } + void JustSummoned(Creature* creature) + { + summons.Summon(creature); + if (creature->GetEntry() != NPC_PRINCE) + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) + creature->AI()->AttackStart(player); + } - void PrepareSummons() - { - switch(currentQuest) - { - case QUEST_BFV_FALLEN_HEROES: - me->SummonCreature(NPC_ELDRETH, 8245.5f, 3522.7f, 627.67f, 3.11f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_GENESS, 8217.45f, 3546.0f, 628.20f, 4.41f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_JHADRAS, 8179.99f, 3523.72f, 628.1f, 5.95f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_MASUD, 8184.97f, 3491.2f, 625.33f, 0.6f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_RITH, 8213.5f, 3478.5f, 626.79f, 1.56f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_TALLA, 8238.30f, 3485.5f, 628.5f, 2.157f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case QUEST_BFV_DARK_MASTER: - me->SummonCreature(NPC_DARK_MASTER, 8184.97f, 3491.2f, 625.33f, 0.6f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case QUEST_BFV_SIGRID: - me->SummonCreature(NPC_SIGRID, 8238.30f, 3485.5f, 628.5f, 2.157f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case QUEST_BFV_CARNAGE: - me->SummonCreature(NPC_CARNAGE, 8179.99f, 3523.72f, 628.1f, 5.95f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case QUEST_BFV_THANE: - me->SummonCreature(NPC_THANE, 8217.45f, 3546.0f, 628.20f, 4.41f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case QUEST_BFV_FINAL: - me->SummonCreature(NPC_PRINCE, 8245.5f, 3522.7f, 627.67f, 3.11f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - } - } + void PrepareSummons() + { + switch(currentQuest) + { + case QUEST_BFV_FALLEN_HEROES: + me->SummonCreature(NPC_ELDRETH, 8245.5f, 3522.7f, 627.67f, 3.11f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_GENESS, 8217.45f, 3546.0f, 628.20f, 4.41f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_JHADRAS, 8179.99f, 3523.72f, 628.1f, 5.95f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_MASUD, 8184.97f, 3491.2f, 625.33f, 0.6f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_RITH, 8213.5f, 3478.5f, 626.79f, 1.56f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_TALLA, 8238.30f, 3485.5f, 628.5f, 2.157f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case QUEST_BFV_DARK_MASTER: + me->SummonCreature(NPC_DARK_MASTER, 8184.97f, 3491.2f, 625.33f, 0.6f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case QUEST_BFV_SIGRID: + me->SummonCreature(NPC_SIGRID, 8238.30f, 3485.5f, 628.5f, 2.157f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case QUEST_BFV_CARNAGE: + me->SummonCreature(NPC_CARNAGE, 8179.99f, 3523.72f, 628.1f, 5.95f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case QUEST_BFV_THANE: + me->SummonCreature(NPC_THANE, 8217.45f, 3546.0f, 628.20f, 4.41f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case QUEST_BFV_FINAL: + me->SummonCreature(NPC_PRINCE, 8245.5f, 3522.7f, 627.67f, 3.11f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + } + } - void StartBattle(uint64 guid, uint32 questId) - { - events.ScheduleEvent(EVENT_VALHALAS_FIRST, 6000); - events.ScheduleEvent(EVENT_VALHALAS_CHECK_PLAYER, 30000); - currentQuest = questId; - playerGUID = guid; - } + void StartBattle(uint64 guid, uint32 questId) + { + events.ScheduleEvent(EVENT_VALHALAS_FIRST, 6000); + events.ScheduleEvent(EVENT_VALHALAS_CHECK_PLAYER, 30000); + currentQuest = questId; + playerGUID = guid; + } void CheckSummons() - { - bool allow = true; - for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* cr = ObjectAccessor::GetCreature(*me, *itr)) - if (cr->IsAlive()) - allow = false; + { + bool allow = true; + for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* cr = ObjectAccessor::GetCreature(*me, *itr)) + if (cr->IsAlive()) + allow = false; - if (allow) - { - uint32 quest = currentQuest; - if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) - { - switch (quest) - { - case QUEST_BFV_FALLEN_HEROES: - me->MonsterYell("$N has defeated the fallen heroes of Valhalas battles past. This is only a beginning, but it will suffice.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case QUEST_BFV_DARK_MASTER: - me->MonsterYell("Khit'rix the Dark Master has been defeated by $N and his band of companions. Let the next challenge be issued!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case QUEST_BFV_SIGRID: - me->MonsterYell("$N has defeated Sigrid Iceborn for a second time. Well, this time he did it with the help of his friends, but a win is a win!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case QUEST_BFV_CARNAGE: - me->MonsterYell("The horror known as Carnage is no more. Could it be that $N is truly worthy of battle in Valhalas? We shall see.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case QUEST_BFV_THANE: - me->MonsterYell("Thane Banahogg the Deathblow has fallen to $N and his fighting companions. He has but one challenge ahead of him. Who will it be?", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case QUEST_BFV_FINAL: - me->MonsterYell("The unthinkable has happened... $N has slain Prince Sandoval!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - } + if (allow) + { + uint32 quest = currentQuest; + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) + { + switch (quest) + { + case QUEST_BFV_FALLEN_HEROES: + me->MonsterYell("$N has defeated the fallen heroes of Valhalas battles past. This is only a beginning, but it will suffice.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case QUEST_BFV_DARK_MASTER: + me->MonsterYell("Khit'rix the Dark Master has been defeated by $N and his band of companions. Let the next challenge be issued!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case QUEST_BFV_SIGRID: + me->MonsterYell("$N has defeated Sigrid Iceborn for a second time. Well, this time he did it with the help of his friends, but a win is a win!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case QUEST_BFV_CARNAGE: + me->MonsterYell("The horror known as Carnage is no more. Could it be that $N is truly worthy of battle in Valhalas? We shall see.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case QUEST_BFV_THANE: + me->MonsterYell("Thane Banahogg the Deathblow has fallen to $N and his fighting companions. He has but one challenge ahead of him. Who will it be?", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case QUEST_BFV_FINAL: + me->MonsterYell("The unthinkable has happened... $N has slain Prince Sandoval!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + } - player->GroupEventHappens(quest, player); - } - playerGUID2 = playerGUID; - EnterEvadeMode(); - if (quest == QUEST_BFV_FINAL) - events.ScheduleEvent(EVENT_VALHALAS_THIRD, 7000); - } - } + player->GroupEventHappens(quest, player); + } + playerGUID2 = playerGUID; + EnterEvadeMode(); + if (quest == QUEST_BFV_FINAL) + events.ScheduleEvent(EVENT_VALHALAS_THIRD, 7000); + } + } void UpdateAI(uint32 diff) { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_VALHALAS_FIRST: - { - switch (currentQuest) - { - case QUEST_BFV_FALLEN_HEROES: - events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8000); - me->MonsterYell("$N and comrades in arms have chosen to accept honorable combat within the sacred confines of Valhalas.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case QUEST_BFV_DARK_MASTER: - events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8000); - me->MonsterYell("$N has accepted the challenge of Khit'rix the Dark Master. May the gods show mercy upon him for Khit'rix surely will not.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case QUEST_BFV_SIGRID: - PrepareSummons(); - me->MonsterTextEmote("Circling Valhalas, Sigrid Iceborn approaches to seek her revenge!", NULL, true); - break; - case QUEST_BFV_CARNAGE: - events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8000); - me->MonsterYell("From the bowels of the Underhalls comes Carnage. Brave and foolish $N has accepted the challenge. $N and his group stand ready to face the monstrosity.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case QUEST_BFV_THANE: - events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8000); - me->MonsterYell("Thane Banahogg returns to Valhalas for the first time in ages to prove that the vrykul are the only beings worthy to fight within its sacred ring. Will $N prove him wrong?", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - case QUEST_BFV_FINAL: - events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8000); - me->MonsterYell("From the depths of Icecrown Citadel, one of the Lich King's chosen comes to put an end to the existence of $N and his friends.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - break; - } + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_VALHALAS_FIRST: + { + switch (currentQuest) + { + case QUEST_BFV_FALLEN_HEROES: + events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8000); + me->MonsterYell("$N and comrades in arms have chosen to accept honorable combat within the sacred confines of Valhalas.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case QUEST_BFV_DARK_MASTER: + events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8000); + me->MonsterYell("$N has accepted the challenge of Khit'rix the Dark Master. May the gods show mercy upon him for Khit'rix surely will not.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case QUEST_BFV_SIGRID: + PrepareSummons(); + me->MonsterTextEmote("Circling Valhalas, Sigrid Iceborn approaches to seek her revenge!", NULL, true); + break; + case QUEST_BFV_CARNAGE: + events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8000); + me->MonsterYell("From the bowels of the Underhalls comes Carnage. Brave and foolish $N has accepted the challenge. $N and his group stand ready to face the monstrosity.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case QUEST_BFV_THANE: + events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8000); + me->MonsterYell("Thane Banahogg returns to Valhalas for the first time in ages to prove that the vrykul are the only beings worthy to fight within its sacred ring. Will $N prove him wrong?", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + case QUEST_BFV_FINAL: + events.ScheduleEvent(EVENT_VALHALAS_SECOND, 8000); + me->MonsterYell("From the depths of Icecrown Citadel, one of the Lich King's chosen comes to put an end to the existence of $N and his friends.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + break; + } - me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+20.0f); - me->SetPosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+20.0f, me->GetOrientation()); - events.PopEvent(); - break; - } - case EVENT_VALHALAS_SECOND: - { - switch (currentQuest) - { - case QUEST_BFV_FALLEN_HEROES: - me->MonsterYell("There can only be one outcome to such a battle: death for one side or the other. Let $n prove himself upon the bones of these outsiders who have fallen before!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - me->MonsterTextEmote("The fallen heroes of Valhalas emerge from the ground to do battle once more!", NULL, true); - break; - case QUEST_BFV_DARK_MASTER: - me->MonsterTextEmote("Khit'rix the Dark Master skitters into Valhalas from the southeast!", NULL, true); - break; - case QUEST_BFV_CARNAGE: - me->MonsterTextEmote("Lumbering in from the south, the smell of Carnage precedes him!", NULL, true); - break; - case QUEST_BFV_THANE: - me->MonsterTextEmote("Thane Banahogg appears upon the overlook to the southeast!", NULL, true); - break; - case QUEST_BFV_FINAL: - me->MonsterYell("Warriors of Jotunheim, I present to you, Blood Prince Sandoval!", LANG_UNIVERSAL, NULL); - me->MonsterTextEmote("Without warning, Prince Sandoval magically appears within Valhalas!", NULL, true); - break; - } + me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+20.0f); + me->SetPosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+20.0f, me->GetOrientation()); + events.PopEvent(); + break; + } + case EVENT_VALHALAS_SECOND: + { + switch (currentQuest) + { + case QUEST_BFV_FALLEN_HEROES: + me->MonsterYell("There can only be one outcome to such a battle: death for one side or the other. Let $n prove himself upon the bones of these outsiders who have fallen before!", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + me->MonsterTextEmote("The fallen heroes of Valhalas emerge from the ground to do battle once more!", NULL, true); + break; + case QUEST_BFV_DARK_MASTER: + me->MonsterTextEmote("Khit'rix the Dark Master skitters into Valhalas from the southeast!", NULL, true); + break; + case QUEST_BFV_CARNAGE: + me->MonsterTextEmote("Lumbering in from the south, the smell of Carnage precedes him!", NULL, true); + break; + case QUEST_BFV_THANE: + me->MonsterTextEmote("Thane Banahogg appears upon the overlook to the southeast!", NULL, true); + break; + case QUEST_BFV_FINAL: + me->MonsterYell("Warriors of Jotunheim, I present to you, Blood Prince Sandoval!", LANG_UNIVERSAL, NULL); + me->MonsterTextEmote("Without warning, Prince Sandoval magically appears within Valhalas!", NULL, true); + break; + } - PrepareSummons(); - events.PopEvent(); - break; - } - case EVENT_VALHALAS_THIRD: - { - events.PopEvent(); - me->MonsterYell("In defeating him, he and his fighting companions have proven themselves worthy of battle in this most sacred place of vrykul honor.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); - events.ScheduleEvent(EVENT_VALHALAS_THIRD+2, 7000); - break; - } - case EVENT_VALHALAS_THIRD+2: - { - events.PopEvent(); - me->MonsterYell("ALL HAIL $N, CHAMPION OF VALHALAS! ", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID2)); - break; - } - case EVENT_VALHALAS_CHECK_PLAYER: - { - bool fail = true; - if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) - if (me->GetDistance(player) < 100.0f) - { - fail = false; - CheckSummons(); - } + PrepareSummons(); + events.PopEvent(); + break; + } + case EVENT_VALHALAS_THIRD: + { + events.PopEvent(); + me->MonsterYell("In defeating him, he and his fighting companions have proven themselves worthy of battle in this most sacred place of vrykul honor.", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID)); + events.ScheduleEvent(EVENT_VALHALAS_THIRD+2, 7000); + break; + } + case EVENT_VALHALAS_THIRD+2: + { + events.PopEvent(); + me->MonsterYell("ALL HAIL $N, CHAMPION OF VALHALAS! ", LANG_UNIVERSAL, ObjectAccessor::GetPlayer(*me, playerGUID2)); + break; + } + case EVENT_VALHALAS_CHECK_PLAYER: + { + bool fail = true; + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) + if (me->GetDistance(player) < 100.0f) + { + fail = false; + CheckSummons(); + } - if (fail) - EnterEvadeMode(); + if (fail) + EnterEvadeMode(); - events.RepeatEvent(5000); - break; - } - } + events.RepeatEvent(5000); + break; + } + } } }; - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - if (npc_battle_at_valhalasAI* vAI = CAST_AI(npc_battle_at_valhalas::npc_battle_at_valhalasAI, creature->AI())) - vAI->StartBattle(player->GetGUID(), quest->GetQuestId()); + creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + if (npc_battle_at_valhalasAI* vAI = CAST_AI(npc_battle_at_valhalas::npc_battle_at_valhalasAI, creature->AI())) + vAI->StartBattle(player->GetGUID(), quest->GetQuestId()); - switch (quest->GetQuestId()) - { - case QUEST_BFV_FALLEN_HEROES: - creature->MonsterSay("Valhalas is yours to win or die in, $N. But whatever you do, stay within the bounds of the arena. To flee is to lose and be dishonored.", LANG_UNIVERSAL, player); - break; - case QUEST_BFV_DARK_MASTER: - creature->MonsterSay("Prepare yourself. Khit'rix will be entering Valhalas from the southeast. Remember, do not leave the ring or you will lose the battle.", LANG_UNIVERSAL, player); - break; - case QUEST_BFV_SIGRID: - creature->MonsterYell("Sigrid Iceborn has returned to the heights of Jotunheim to prove herself against $N. When last they met, $N bester her in personal combat. Let us see the outcome of this match.", LANG_UNIVERSAL, player); - break; - case QUEST_BFV_CARNAGE: - creature->MonsterSay("Carnage is coming! Remember, no matter what you do, do NOT leave the battle ring or I will disqualify you and your group.", LANG_UNIVERSAL, 0); - break; - case QUEST_BFV_THANE: - creature->MonsterSay("Look to the southeast and you will see the thane upon the platform near Gjonner the Merciless when he shows himself. Let him come down. Stay within the ring of Valhalas.", LANG_UNIVERSAL, 0); - break; - case QUEST_BFV_FINAL: - creature->MonsterSay("It's too late to run now. Do not leave the ring. Die bravely, $N!", LANG_UNIVERSAL, 0); - break; - } + switch (quest->GetQuestId()) + { + case QUEST_BFV_FALLEN_HEROES: + creature->MonsterSay("Valhalas is yours to win or die in, $N. But whatever you do, stay within the bounds of the arena. To flee is to lose and be dishonored.", LANG_UNIVERSAL, player); + break; + case QUEST_BFV_DARK_MASTER: + creature->MonsterSay("Prepare yourself. Khit'rix will be entering Valhalas from the southeast. Remember, do not leave the ring or you will lose the battle.", LANG_UNIVERSAL, player); + break; + case QUEST_BFV_SIGRID: + creature->MonsterYell("Sigrid Iceborn has returned to the heights of Jotunheim to prove herself against $N. When last they met, $N bester her in personal combat. Let us see the outcome of this match.", LANG_UNIVERSAL, player); + break; + case QUEST_BFV_CARNAGE: + creature->MonsterSay("Carnage is coming! Remember, no matter what you do, do NOT leave the battle ring or I will disqualify you and your group.", LANG_UNIVERSAL, 0); + break; + case QUEST_BFV_THANE: + creature->MonsterSay("Look to the southeast and you will see the thane upon the platform near Gjonner the Merciless when he shows himself. Let him come down. Stay within the ring of Valhalas.", LANG_UNIVERSAL, 0); + break; + case QUEST_BFV_FINAL: + creature->MonsterSay("It's too late to run now. Do not leave the ring. Die bravely, $N!", LANG_UNIVERSAL, 0); + break; + } return true; } @@ -369,41 +369,41 @@ public: { npc_llod_genericAI(Creature* pCreature) : CombatAI(pCreature) { attackTimer = 0; summonTimer = 1; } - uint32 attackTimer; - uint32 summonTimer; + uint32 attackTimer; + uint32 summonTimer; - void Reset() - { - summonTimer = 1; - CombatAI::Reset(); - } + void Reset() + { + summonTimer = 1; + CombatAI::Reset(); + } - void UpdateAI(uint32 diff) - { - attackTimer += diff; - if (attackTimer >= 1500) - { - if (!me->IsInCombat()) - if (Unit* target = me->SelectNearbyTarget(NULL, 20.0f)) - AttackStart(target); - attackTimer = 0; - } + void UpdateAI(uint32 diff) + { + attackTimer += diff; + if (attackTimer >= 1500) + { + if (!me->IsInCombat()) + if (Unit* target = me->SelectNearbyTarget(NULL, 20.0f)) + AttackStart(target); + attackTimer = 0; + } - if (summonTimer) - { - summonTimer += diff; - if (summonTimer >= 8000) - { - for (uint8 i = 0; i < 3; ++i) - me->SummonCreature(30593, me->GetPositionX()+irand(-5, 5), me->GetPositionY()+irand(-5, 5), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (roll_chance_i(10)) - me->SummonCreature(30575, me->GetPositionX()+irand(-5, 5), me->GetPositionY()+irand(-5, 5), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - summonTimer = 0; - } - } + if (summonTimer) + { + summonTimer += diff; + if (summonTimer >= 8000) + { + for (uint8 i = 0; i < 3; ++i) + me->SummonCreature(30593, me->GetPositionX()+irand(-5, 5), me->GetPositionY()+irand(-5, 5), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (roll_chance_i(10)) + me->SummonCreature(30575, me->GetPositionX()+irand(-5, 5), me->GetPositionY()+irand(-5, 5), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + summonTimer = 0; + } + } - CombatAI::UpdateAI(diff); - } + CombatAI::UpdateAI(diff); + } }; CreatureAI *GetAI(Creature *creature) const @@ -414,42 +414,42 @@ public: enum eLordArete { - SPELL_SOUL_WRACK = 27765, - SPELL_SOUL_COAX = 22966, - SPELL_SUMMON_LANDGREN_SOUL = 12600, - SPELL_TELEPORT_EFFECT = 52096, + SPELL_SOUL_WRACK = 27765, + SPELL_SOUL_COAX = 22966, + SPELL_SUMMON_LANDGREN_SOUL = 12600, + SPELL_TELEPORT_EFFECT = 52096, - NPC_LANDGREN = 29542, - NPC_LANDGREN_SOUL = 29572, + NPC_LANDGREN = 29542, + NPC_LANDGREN_SOUL = 29572, - EVENT_START = 1, - EVENT_SOUL_COAX = 2, - EVENT_SUMMON_SOUL = 3, - EVENT_SOUL_FLY = 4, - EVENT_SCENE_1 = 5, - EVENT_SCENE_2 = 6, - EVENT_SCENE_3 = 7, - EVENT_SCENE_4 = 8, - EVENT_SCENE_5 = 9, - EVENT_SCENE_6 = 10, - EVENT_SCENE_7 = 11, - EVENT_SCENE_8 = 12, - EVENT_SCENE_9 = 13, - EVENT_SCENE_10 = 14, + EVENT_START = 1, + EVENT_SOUL_COAX = 2, + EVENT_SUMMON_SOUL = 3, + EVENT_SOUL_FLY = 4, + EVENT_SCENE_1 = 5, + EVENT_SCENE_2 = 6, + EVENT_SCENE_3 = 7, + EVENT_SCENE_4 = 8, + EVENT_SCENE_5 = 9, + EVENT_SCENE_6 = 10, + EVENT_SCENE_7 = 11, + EVENT_SCENE_8 = 12, + EVENT_SCENE_9 = 13, + EVENT_SCENE_10 = 14, - SAY_ARETE_0 = 0, - SAY_ARETE_1 = 1, - SAY_ARETE_2 = 2, - SAY_ARETE_3 = 3, - SAY_ARETE_4 = 4, - SAY_ARETE_5 = 5, - SAY_ARETE_6 = 6, + SAY_ARETE_0 = 0, + SAY_ARETE_1 = 1, + SAY_ARETE_2 = 2, + SAY_ARETE_3 = 3, + SAY_ARETE_4 = 4, + SAY_ARETE_5 = 5, + SAY_ARETE_6 = 6, - SAY_SOUL_0 = 0, - SAY_SOUL_1 = 1, - SAY_SOUL_2 = 2, - SAY_SOUL_3 = 3, - SAY_SOUL_4 = 4, + SAY_SOUL_0 = 0, + SAY_SOUL_1 = 1, + SAY_SOUL_2 = 2, + SAY_SOUL_3 = 3, + SAY_SOUL_4 = 4, }; class npc_lord_arete : public CreatureScript @@ -462,129 +462,129 @@ class npc_lord_arete : public CreatureScript npc_lord_areteAI(Creature* creature) : ScriptedAI(creature) {} EventMap events; - uint64 _landgrenGUID; - uint64 _landgrenSoulGUID; + uint64 _landgrenGUID; + uint64 _landgrenSoulGUID; - void InitializeAI() + void InitializeAI() { - _landgrenGUID = 0; - _landgrenSoulGUID = 0; - + _landgrenGUID = 0; + _landgrenSoulGUID = 0; + events.Reset(); - events.RescheduleEvent(EVENT_START, 1000); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - me->SetWalk(true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->setActive(true); - me->SetReactState(REACT_PASSIVE); + events.RescheduleEvent(EVENT_START, 1000); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + me->SetWalk(true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->setActive(true); + me->SetReactState(REACT_PASSIVE); } void UpdateAI(uint32 diff) { events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_START: - Talk(SAY_ARETE_0); - me->CastSpell(me, SPELL_TELEPORT_EFFECT, true); - if (Creature* cr = me->FindNearestCreature(NPC_LANDGREN, 100.0f, false)) - { - _landgrenGUID = cr->GetGUID(); + switch (events.ExecuteEvent()) + { + case EVENT_START: + Talk(SAY_ARETE_0); + me->CastSpell(me, SPELL_TELEPORT_EFFECT, true); + if (Creature* cr = me->FindNearestCreature(NPC_LANDGREN, 100.0f, false)) + { + _landgrenGUID = cr->GetGUID(); - float o = cr->GetAngle(me); - me->GetMotionMaster()->MovePoint(1, cr->GetPositionX()+cos(o)*3, cr->GetPositionY()+sin(o)*3, cr->GetPositionZ()); - events.RescheduleEvent(EVENT_SOUL_COAX, 5000); - } - else - me->DespawnOrUnsummon(1); - break; - case EVENT_SOUL_COAX: - Talk(SAY_ARETE_1); - me->CastSpell(me, SPELL_SOUL_COAX, false); - events.ScheduleEvent(EVENT_SUMMON_SOUL, 8000); - break; - case EVENT_SUMMON_SOUL: - if (Creature* cr = ObjectAccessor::GetCreature(*me, _landgrenGUID)) - cr->CastSpell(cr, SPELL_SUMMON_LANDGREN_SOUL, true); - if (Creature* soul = me->FindNearestCreature(NPC_LANDGREN_SOUL, 100.0f)) - { - _landgrenSoulGUID = soul->GetGUID(); - soul->SetVisible(false); - } - events.ScheduleEvent(EVENT_SOUL_FLY, 3000); - break; - case EVENT_SOUL_FLY: - if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) - { - soul->SetCanFly(true); - soul->SetVisible(true); - Movement::MoveSplineInit init(soul); - init.MoveTo(soul->GetPositionX(), soul->GetPositionY(), soul->GetPositionZ()+5.0f); - init.SetVelocity(1.0f); - init.Launch(); - soul->CastSpell(soul, 64462, true); // Drown - } - events.ScheduleEvent(EVENT_SCENE_1, 6000); - break; - case EVENT_SCENE_1: - if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) - { - soul->SetPosition(soul->GetPositionX(), soul->GetPositionY(), soul->GetPositionZ()+5.0f, soul->GetOrientation()); - soul->CastSpell(soul, 64462, true); // Drown - soul->AI()->Talk(SAY_SOUL_0); - } - events.ScheduleEvent(EVENT_SCENE_2, 5000); - break; - case EVENT_SCENE_2: - Talk(SAY_ARETE_2); - events.ScheduleEvent(EVENT_SCENE_3, 5000); - break; - case EVENT_SCENE_3: - if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) - soul->AI()->Talk(SAY_SOUL_1); - events.ScheduleEvent(EVENT_SCENE_4, 3000); - break; - case EVENT_SCENE_4: - if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) - me->CastSpell(soul, SPELL_SOUL_WRACK, false); - Talk(SAY_ARETE_3); - events.ScheduleEvent(EVENT_SCENE_5, 6000); - break; - case EVENT_SCENE_5: - if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) - soul->AI()->Talk(SAY_SOUL_2); - me->InterruptNonMeleeSpells(false); - events.ScheduleEvent(EVENT_SCENE_6, 4000); - break; - case EVENT_SCENE_6: - Talk(SAY_ARETE_4); - events.ScheduleEvent(EVENT_SCENE_7, 4000); - break; - case EVENT_SCENE_7: - if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) - soul->AI()->Talk(SAY_SOUL_3); - events.ScheduleEvent(EVENT_SCENE_8, 8000); - break; - case EVENT_SCENE_8: - if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) - me->CastSpell(soul, SPELL_SOUL_WRACK, false); - Talk(SAY_ARETE_5); - events.ScheduleEvent(EVENT_SCENE_9, 6000); - break; - case EVENT_SCENE_9: - if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) - { - soul->AI()->Talk(SAY_SOUL_4); - soul->DespawnOrUnsummon(2000); - } - events.ScheduleEvent(EVENT_SCENE_10, 3000); - break; - case EVENT_SCENE_10: - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - Talk(SAY_ARETE_6); - me->DespawnOrUnsummon(60000); - break; - } + float o = cr->GetAngle(me); + me->GetMotionMaster()->MovePoint(1, cr->GetPositionX()+cos(o)*3, cr->GetPositionY()+sin(o)*3, cr->GetPositionZ()); + events.RescheduleEvent(EVENT_SOUL_COAX, 5000); + } + else + me->DespawnOrUnsummon(1); + break; + case EVENT_SOUL_COAX: + Talk(SAY_ARETE_1); + me->CastSpell(me, SPELL_SOUL_COAX, false); + events.ScheduleEvent(EVENT_SUMMON_SOUL, 8000); + break; + case EVENT_SUMMON_SOUL: + if (Creature* cr = ObjectAccessor::GetCreature(*me, _landgrenGUID)) + cr->CastSpell(cr, SPELL_SUMMON_LANDGREN_SOUL, true); + if (Creature* soul = me->FindNearestCreature(NPC_LANDGREN_SOUL, 100.0f)) + { + _landgrenSoulGUID = soul->GetGUID(); + soul->SetVisible(false); + } + events.ScheduleEvent(EVENT_SOUL_FLY, 3000); + break; + case EVENT_SOUL_FLY: + if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) + { + soul->SetCanFly(true); + soul->SetVisible(true); + Movement::MoveSplineInit init(soul); + init.MoveTo(soul->GetPositionX(), soul->GetPositionY(), soul->GetPositionZ()+5.0f); + init.SetVelocity(1.0f); + init.Launch(); + soul->CastSpell(soul, 64462, true); // Drown + } + events.ScheduleEvent(EVENT_SCENE_1, 6000); + break; + case EVENT_SCENE_1: + if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) + { + soul->SetPosition(soul->GetPositionX(), soul->GetPositionY(), soul->GetPositionZ()+5.0f, soul->GetOrientation()); + soul->CastSpell(soul, 64462, true); // Drown + soul->AI()->Talk(SAY_SOUL_0); + } + events.ScheduleEvent(EVENT_SCENE_2, 5000); + break; + case EVENT_SCENE_2: + Talk(SAY_ARETE_2); + events.ScheduleEvent(EVENT_SCENE_3, 5000); + break; + case EVENT_SCENE_3: + if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) + soul->AI()->Talk(SAY_SOUL_1); + events.ScheduleEvent(EVENT_SCENE_4, 3000); + break; + case EVENT_SCENE_4: + if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) + me->CastSpell(soul, SPELL_SOUL_WRACK, false); + Talk(SAY_ARETE_3); + events.ScheduleEvent(EVENT_SCENE_5, 6000); + break; + case EVENT_SCENE_5: + if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) + soul->AI()->Talk(SAY_SOUL_2); + me->InterruptNonMeleeSpells(false); + events.ScheduleEvent(EVENT_SCENE_6, 4000); + break; + case EVENT_SCENE_6: + Talk(SAY_ARETE_4); + events.ScheduleEvent(EVENT_SCENE_7, 4000); + break; + case EVENT_SCENE_7: + if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) + soul->AI()->Talk(SAY_SOUL_3); + events.ScheduleEvent(EVENT_SCENE_8, 8000); + break; + case EVENT_SCENE_8: + if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) + me->CastSpell(soul, SPELL_SOUL_WRACK, false); + Talk(SAY_ARETE_5); + events.ScheduleEvent(EVENT_SCENE_9, 6000); + break; + case EVENT_SCENE_9: + if (Creature* soul = ObjectAccessor::GetCreature(*me, _landgrenSoulGUID)) + { + soul->AI()->Talk(SAY_SOUL_4); + soul->DespawnOrUnsummon(2000); + } + events.ScheduleEvent(EVENT_SCENE_10, 3000); + break; + case EVENT_SCENE_10: + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + Talk(SAY_ARETE_6); + me->DespawnOrUnsummon(60000); + break; + } } }; @@ -602,33 +602,33 @@ class npc_boneguard_footman : public CreatureScript struct npc_boneguard_footmanAI : ScriptedAI { npc_boneguard_footmanAI(Creature* creature) : ScriptedAI(creature) - { - checkTimer = 0; - } + { + checkTimer = 0; + } - uint32 checkTimer; + uint32 checkTimer; void UpdateAI(uint32 diff) { - if (!me->IsInCombat()) - return; + if (!me->IsInCombat()) + return; - checkTimer += diff; - if (checkTimer >= 500) - { - checkTimer = 0; - if (Unit* victim = me->GetVictim()) - { - if (victim->GetEntry() == 33531 /*NPC_CAMPAIGN_WARHORSE*/ && me->GetDistance2d(victim) < 3.0f && victim->isMoving()) - { - me->LowerPlayerDamageReq(me->GetMaxHealth()); - Unit::Kill(victim, me); - return; - } - } - } - - ScriptedAI::UpdateAI(diff); + checkTimer += diff; + if (checkTimer >= 500) + { + checkTimer = 0; + if (Unit* victim = me->GetVictim()) + { + if (victim->GetEntry() == 33531 /*NPC_CAMPAIGN_WARHORSE*/ && me->GetDistance2d(victim) < 3.0f && victim->isMoving()) + { + me->LowerPlayerDamageReq(me->GetMaxHealth()); + Unit::Kill(victim, me); + return; + } + } + } + + ScriptedAI::UpdateAI(diff); } }; @@ -640,35 +640,35 @@ class npc_boneguard_footman : public CreatureScript enum tirionsGambit { - ACTION_START_EVENT = 1, - ACTION_SUMMON_MOVE_STRAIGHT = 2, - ACTION_SUMMON_EMOTE = 3, - ACTION_SUMMON_DESPAWN = 4, - ACTION_SUMMON_ORIENTATION = 5, - ACTION_SUMMON_TALK = 6, - ACTION_SUMMON_STAND_STATE = 7, + ACTION_START_EVENT = 1, + ACTION_SUMMON_MOVE_STRAIGHT = 2, + ACTION_SUMMON_EMOTE = 3, + ACTION_SUMMON_DESPAWN = 4, + ACTION_SUMMON_ORIENTATION = 5, + ACTION_SUMMON_TALK = 6, + ACTION_SUMMON_STAND_STATE = 7, - EVENT_START_SCENE = 1, - EVENT_SCENE_0 = 2, + EVENT_START_SCENE = 1, + EVENT_SCENE_0 = 2, - NPC_DISGUISED_CRUSADER = 32241, - NPC_GAMBIT_TIRION_FORDRING = 32239, - NPC_INVOKER_BASALEPH = 32272, - NPC_CHOSEN_ZEALOT = 32175, - NPC_TIRION_LICH_KING = 32184, - NPC_TIRION_EBON_KNIGHT = 32309, - NPC_TIRION_THASSARIAN = 32310, - NPC_TIRION_KOLTIRA = 32311, - NPC_TIRION_MOGRAINE = 32312, + NPC_DISGUISED_CRUSADER = 32241, + NPC_GAMBIT_TIRION_FORDRING = 32239, + NPC_INVOKER_BASALEPH = 32272, + NPC_CHOSEN_ZEALOT = 32175, + NPC_TIRION_LICH_KING = 32184, + NPC_TIRION_EBON_KNIGHT = 32309, + NPC_TIRION_THASSARIAN = 32310, + NPC_TIRION_KOLTIRA = 32311, + NPC_TIRION_MOGRAINE = 32312, - GO_FROZEN_HEART = 193794, - GO_ESCAPE_PORTAL = 193941, + GO_FROZEN_HEART = 193794, + GO_ESCAPE_PORTAL = 193941, - SPELL_TIRION_SMASH_HEART = 60456, - SPELL_HEART_EXPLOSION = 60484, - SPELL_HEART_EXPLOSION_EFF = 60532, - SPELL_LICH_KINGS_FURY = 60536, - SPELL_TIRIONS_GAMBIT_CREDIT = 61487, + SPELL_TIRION_SMASH_HEART = 60456, + SPELL_HEART_EXPLOSION = 60484, + SPELL_HEART_EXPLOSION_EFF = 60532, + SPELL_LICH_KINGS_FURY = 60536, + SPELL_TIRIONS_GAMBIT_CREDIT = 61487, }; class npc_tirions_gambit_tirion : public CreatureScript @@ -676,353 +676,353 @@ class npc_tirions_gambit_tirion : public CreatureScript public: npc_tirions_gambit_tirion(): CreatureScript("npc_tirions_gambit_tirion"){} - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - player->CLOSE_GOSSIP_MENU(); - creature->AI()->DoAction(ACTION_START_EVENT); - return true; - } + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) + { + player->CLOSE_GOSSIP_MENU(); + creature->AI()->DoAction(ACTION_START_EVENT); + return true; + } struct npc_tirions_gambit_tirionAI : npc_escortAI { npc_tirions_gambit_tirionAI(Creature* creature) : npc_escortAI(creature), summons(me) - { - } + { + } - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; - void Reset() - { - me->setActive(false); - me->SetStandState(UNIT_STAND_STATE_STAND); - } + void Reset() + { + me->setActive(false); + me->SetStandState(UNIT_STAND_STATE_STAND); + } - void SetData(uint32 type, uint32 data) - { - if (type == 1 && data == 1) - events.ScheduleEvent(EVENT_SCENE_0+30, 10000); - } + void SetData(uint32 type, uint32 data) + { + if (type == 1 && data == 1) + events.ScheduleEvent(EVENT_SCENE_0+30, 10000); + } - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT) - { - me->setActive(true); + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT) + { + me->setActive(true); - Talk(0); - events.Reset(); - summons.DespawnAll(); - Start(false, false); + Talk(0); + events.Reset(); + summons.DespawnAll(); + Start(false, false); - int8 i = -1; - std::list cList; - GetCreatureListWithEntryInGrid(cList, me, NPC_DISGUISED_CRUSADER, 15.0f); - for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr, ++i) - { - (*itr)->SetWalk(true); - (*itr)->GetMotionMaster()->MoveFollow(me, 1.0f, Position::NormalizeOrientation(M_PI*i/2.0f)); - summons.Summon(*itr); - } - } - } + int8 i = -1; + std::list cList; + GetCreatureListWithEntryInGrid(cList, me, NPC_DISGUISED_CRUSADER, 15.0f); + for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr, ++i) + { + (*itr)->SetWalk(true); + (*itr)->GetMotionMaster()->MoveFollow(me, 1.0f, Position::NormalizeOrientation(M_PI*i/2.0f)); + summons.Summon(*itr); + } + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() == NPC_CHOSEN_ZEALOT || summon->GetEntry() == NPC_TIRION_LICH_KING) - summon->SetWalk(true); - else if (summon->GetEntry() != NPC_INVOKER_BASALEPH) - { - summon->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - summon->GetMotionMaster()->MovePoint(4, 6135.97f, 2753.84f, 573.92f); - } - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() == NPC_CHOSEN_ZEALOT || summon->GetEntry() == NPC_TIRION_LICH_KING) + summon->SetWalk(true); + else if (summon->GetEntry() != NPC_INVOKER_BASALEPH) + { + summon->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + summon->GetMotionMaster()->MovePoint(4, 6135.97f, 2753.84f, 573.92f); + } + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + } - void WaypointReached(uint32 pointId) - { - switch (pointId) - { - case 6: - me->SummonCreature(NPC_INVOKER_BASALEPH, 6130.26f, 2764.83f, 573.92f, 5.19f, TEMPSUMMON_TIMED_DESPAWN, 10*MINUTE*IN_MILLISECONDS); - Talk(1); - break; - case 15: - { - uint8 i = 1; - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr, ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetEntry() == NPC_DISGUISED_CRUSADER) - { - summon->GetMotionMaster()->Clear(false); - summon->GetMotionMaster()->MovePoint(1, 6165.3f + 3*i, 2759.85f + 1.5f*i, 573.914f); - } - break; - } - case 17: - SetEscortPaused(true); - events.ScheduleEvent(EVENT_START_SCENE, 7000); - break; - case 19: - SetEscortPaused(true); - events.ScheduleEvent(EVENT_SCENE_0+8, 5000); - break; - } - } + void WaypointReached(uint32 pointId) + { + switch (pointId) + { + case 6: + me->SummonCreature(NPC_INVOKER_BASALEPH, 6130.26f, 2764.83f, 573.92f, 5.19f, TEMPSUMMON_TIMED_DESPAWN, 10*MINUTE*IN_MILLISECONDS); + Talk(1); + break; + case 15: + { + uint8 i = 1; + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr, ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetEntry() == NPC_DISGUISED_CRUSADER) + { + summon->GetMotionMaster()->Clear(false); + summon->GetMotionMaster()->MovePoint(1, 6165.3f + 3*i, 2759.85f + 1.5f*i, 573.914f); + } + break; + } + case 17: + SetEscortPaused(true); + events.ScheduleEvent(EVENT_START_SCENE, 7000); + break; + case 19: + SetEscortPaused(true); + events.ScheduleEvent(EVENT_SCENE_0+8, 5000); + break; + } + } - void DoSummonAction(uint32 entry, uint8 id, int32 param = 0) - { - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetEntry() == entry) - { - switch (id) - { - case ACTION_SUMMON_MOVE_STRAIGHT: - summon->GetMotionMaster()->MovePoint(1, summon->GetPositionX()-param, summon->GetPositionY()+param*2+3, summon->GetPositionZ()); - break; - case ACTION_SUMMON_EMOTE: - summon->SetUInt32Value(UNIT_NPC_EMOTESTATE, param); - break; - case ACTION_SUMMON_DESPAWN: - summon->DespawnOrUnsummon(param); - break; - case ACTION_SUMMON_ORIENTATION: - summon->SetFacingTo(param/100.0f); - break; - case ACTION_SUMMON_TALK: - summon->AI()->Talk(param); - break; - case ACTION_SUMMON_STAND_STATE: - summon->SetStandState(param); - break; - } - } - } + void DoSummonAction(uint32 entry, uint8 id, int32 param = 0) + { + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetEntry() == entry) + { + switch (id) + { + case ACTION_SUMMON_MOVE_STRAIGHT: + summon->GetMotionMaster()->MovePoint(1, summon->GetPositionX()-param, summon->GetPositionY()+param*2+3, summon->GetPositionZ()); + break; + case ACTION_SUMMON_EMOTE: + summon->SetUInt32Value(UNIT_NPC_EMOTESTATE, param); + break; + case ACTION_SUMMON_DESPAWN: + summon->DespawnOrUnsummon(param); + break; + case ACTION_SUMMON_ORIENTATION: + summon->SetFacingTo(param/100.0f); + break; + case ACTION_SUMMON_TALK: + summon->AI()->Talk(param); + break; + case ACTION_SUMMON_STAND_STATE: + summon->SetStandState(param); + break; + } + } + } void UpdateEscortAI(uint32 diff) { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_START_SCENE: - Talk(2); - DoSummonAction(NPC_DISGUISED_CRUSADER, ACTION_SUMMON_ORIENTATION, 200); + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_START_SCENE: + Talk(2); + DoSummonAction(NPC_DISGUISED_CRUSADER, ACTION_SUMMON_ORIENTATION, 200); - me->SummonCreature(NPC_CHOSEN_ZEALOT, 6160.74f, 2695.90f, 573.92f, 2.04f, TEMPSUMMON_TIMED_DESPAWN, 5*MINUTE*IN_MILLISECONDS); - me->SummonCreature(NPC_CHOSEN_ZEALOT, 6164.98f, 2697.90f, 573.92f, 2.04f, TEMPSUMMON_TIMED_DESPAWN, 5*MINUTE*IN_MILLISECONDS); - me->SummonCreature(NPC_CHOSEN_ZEALOT, 6161.26f, 2700.05f, 573.92f, 2.04f, TEMPSUMMON_TIMED_DESPAWN, 5*MINUTE*IN_MILLISECONDS); + me->SummonCreature(NPC_CHOSEN_ZEALOT, 6160.74f, 2695.90f, 573.92f, 2.04f, TEMPSUMMON_TIMED_DESPAWN, 5*MINUTE*IN_MILLISECONDS); + me->SummonCreature(NPC_CHOSEN_ZEALOT, 6164.98f, 2697.90f, 573.92f, 2.04f, TEMPSUMMON_TIMED_DESPAWN, 5*MINUTE*IN_MILLISECONDS); + me->SummonCreature(NPC_CHOSEN_ZEALOT, 6161.26f, 2700.05f, 573.92f, 2.04f, TEMPSUMMON_TIMED_DESPAWN, 5*MINUTE*IN_MILLISECONDS); - DoSummonAction(NPC_CHOSEN_ZEALOT, ACTION_SUMMON_MOVE_STRAIGHT, 27); - events.ScheduleEvent(EVENT_SCENE_0, 30000); - break; - case EVENT_SCENE_0: - DoSummonAction(NPC_CHOSEN_ZEALOT, ACTION_SUMMON_STAND_STATE, UNIT_STAND_STATE_KNEEL); - me->SummonGameObject(GO_FROZEN_HEART, 6132.38f, 2760.76f, 574.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 180); - events.ScheduleEvent(EVENT_SCENE_0+1, 10000); - break; - case EVENT_SCENE_0+1: - DoSummonAction(NPC_CHOSEN_ZEALOT, ACTION_SUMMON_STAND_STATE, UNIT_STAND_STATE_STAND); - events.ScheduleEvent(EVENT_SCENE_0+2, 2000); - break; - case EVENT_SCENE_0+2: - DoSummonAction(NPC_CHOSEN_ZEALOT, ACTION_SUMMON_MOVE_STRAIGHT, -27); - DoSummonAction(NPC_CHOSEN_ZEALOT, ACTION_SUMMON_DESPAWN, 20000); - events.ScheduleEvent(EVENT_SCENE_0+3, 2000); - break; - case EVENT_SCENE_0+3: - Talk(3); - if (Creature* cr = me->SummonCreature(NPC_TIRION_LICH_KING, 6161.26f, 2700.05f, 573.92f, 2.04f, TEMPSUMMON_TIMED_DESPAWN, 5*MINUTE*IN_MILLISECONDS)) - cr->GetMotionMaster()->MovePoint(2, 6131.93f, 2756.84f, 573.92f); - events.ScheduleEvent(EVENT_SCENE_0+4, 4000); - break; - case EVENT_SCENE_0+4: - Talk(4); - me->SetFacingTo(4.42f); - events.ScheduleEvent(EVENT_SCENE_0+5, 25000); - break; - case EVENT_SCENE_0+5: - DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_ORIENTATION, 11); - events.ScheduleEvent(EVENT_SCENE_0+6, 4000); - break; - case EVENT_SCENE_0+6: - DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 0); - me->LoadEquipment(2, true); - SetEscortPaused(false); - events.ScheduleEvent(EVENT_SCENE_0+7, 6000); - break; - case EVENT_SCENE_0+7: - DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 1); - break; - case EVENT_SCENE_0+8: - Talk(5); - events.ScheduleEvent(EVENT_SCENE_0+9, 5000); - break; - case EVENT_SCENE_0+9: - DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 2); - events.ScheduleEvent(EVENT_SCENE_0+10, 11000); - break; - case EVENT_SCENE_0+10: - Talk(6); - events.ScheduleEvent(EVENT_SCENE_0+11, 6000); - break; - case EVENT_SCENE_0+11: - DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 3); - events.ScheduleEvent(EVENT_SCENE_0+12, 7000); - break; - case EVENT_SCENE_0+12: - DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 4); - events.ScheduleEvent(EVENT_SCENE_0+13, 5000); - break; - case EVENT_SCENE_0+13: - Talk(7); - events.ScheduleEvent(EVENT_SCENE_0+14, 14000); - break; - case EVENT_SCENE_0+14: - Talk(8); - events.ScheduleEvent(EVENT_SCENE_0+15, 3000); - break; - case EVENT_SCENE_0+15: - { - me->CastSpell(me, SPELL_TIRION_SMASH_HEART, true); - events.ScheduleEvent(EVENT_SCENE_0+16, 1200); - uint8 i = 0; - for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr, ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetEntry() == NPC_DISGUISED_CRUSADER) - { - summon->SetWalk(false); - summon->GetMotionMaster()->MovePoint(2, 6132.38f + 4*cos(2*M_PI*(i/3.0)), 2760.76f + 4*sin(2*M_PI*(i/3.0)), me->GetPositionZ()); - } - break; - } - case EVENT_SCENE_0+16: - me->CastSpell(me, SPELL_HEART_EXPLOSION, true); - me->CastSpell(me, SPELL_HEART_EXPLOSION_EFF, true); - me->SetStandState(UNIT_STAND_STATE_DEAD); - DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 5); - if (GameObject* go = me->FindNearestGameObject(GO_FROZEN_HEART, 20.0f)) - go->Delete(); - events.ScheduleEvent(EVENT_SCENE_0+17, 2000); - break; - case EVENT_SCENE_0+17: - DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_STAND_STATE, UNIT_STAND_STATE_KNEEL); - events.ScheduleEvent(EVENT_SCENE_0+170, 3000); - break; - case EVENT_SCENE_0+170: - DoSummonAction(NPC_DISGUISED_CRUSADER, ACTION_SUMMON_ORIENTATION, 500); - DoSummonAction(NPC_DISGUISED_CRUSADER, ACTION_SUMMON_EMOTE, EMOTE_STATE_READY2H); - if (Creature* cr = me->FindNearestCreature(NPC_DISGUISED_CRUSADER, 10.0f)) - cr->AI()->Talk(0); - events.ScheduleEvent(EVENT_SCENE_0+18, 1000); - break; - case EVENT_SCENE_0+18: - { - DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 6); + DoSummonAction(NPC_CHOSEN_ZEALOT, ACTION_SUMMON_MOVE_STRAIGHT, 27); + events.ScheduleEvent(EVENT_SCENE_0, 30000); + break; + case EVENT_SCENE_0: + DoSummonAction(NPC_CHOSEN_ZEALOT, ACTION_SUMMON_STAND_STATE, UNIT_STAND_STATE_KNEEL); + me->SummonGameObject(GO_FROZEN_HEART, 6132.38f, 2760.76f, 574.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 180); + events.ScheduleEvent(EVENT_SCENE_0+1, 10000); + break; + case EVENT_SCENE_0+1: + DoSummonAction(NPC_CHOSEN_ZEALOT, ACTION_SUMMON_STAND_STATE, UNIT_STAND_STATE_STAND); + events.ScheduleEvent(EVENT_SCENE_0+2, 2000); + break; + case EVENT_SCENE_0+2: + DoSummonAction(NPC_CHOSEN_ZEALOT, ACTION_SUMMON_MOVE_STRAIGHT, -27); + DoSummonAction(NPC_CHOSEN_ZEALOT, ACTION_SUMMON_DESPAWN, 20000); + events.ScheduleEvent(EVENT_SCENE_0+3, 2000); + break; + case EVENT_SCENE_0+3: + Talk(3); + if (Creature* cr = me->SummonCreature(NPC_TIRION_LICH_KING, 6161.26f, 2700.05f, 573.92f, 2.04f, TEMPSUMMON_TIMED_DESPAWN, 5*MINUTE*IN_MILLISECONDS)) + cr->GetMotionMaster()->MovePoint(2, 6131.93f, 2756.84f, 573.92f); + events.ScheduleEvent(EVENT_SCENE_0+4, 4000); + break; + case EVENT_SCENE_0+4: + Talk(4); + me->SetFacingTo(4.42f); + events.ScheduleEvent(EVENT_SCENE_0+5, 25000); + break; + case EVENT_SCENE_0+5: + DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_ORIENTATION, 11); + events.ScheduleEvent(EVENT_SCENE_0+6, 4000); + break; + case EVENT_SCENE_0+6: + DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 0); + me->LoadEquipment(2, true); + SetEscortPaused(false); + events.ScheduleEvent(EVENT_SCENE_0+7, 6000); + break; + case EVENT_SCENE_0+7: + DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 1); + break; + case EVENT_SCENE_0+8: + Talk(5); + events.ScheduleEvent(EVENT_SCENE_0+9, 5000); + break; + case EVENT_SCENE_0+9: + DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 2); + events.ScheduleEvent(EVENT_SCENE_0+10, 11000); + break; + case EVENT_SCENE_0+10: + Talk(6); + events.ScheduleEvent(EVENT_SCENE_0+11, 6000); + break; + case EVENT_SCENE_0+11: + DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 3); + events.ScheduleEvent(EVENT_SCENE_0+12, 7000); + break; + case EVENT_SCENE_0+12: + DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 4); + events.ScheduleEvent(EVENT_SCENE_0+13, 5000); + break; + case EVENT_SCENE_0+13: + Talk(7); + events.ScheduleEvent(EVENT_SCENE_0+14, 14000); + break; + case EVENT_SCENE_0+14: + Talk(8); + events.ScheduleEvent(EVENT_SCENE_0+15, 3000); + break; + case EVENT_SCENE_0+15: + { + me->CastSpell(me, SPELL_TIRION_SMASH_HEART, true); + events.ScheduleEvent(EVENT_SCENE_0+16, 1200); + uint8 i = 0; + for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr, ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetEntry() == NPC_DISGUISED_CRUSADER) + { + summon->SetWalk(false); + summon->GetMotionMaster()->MovePoint(2, 6132.38f + 4*cos(2*M_PI*(i/3.0)), 2760.76f + 4*sin(2*M_PI*(i/3.0)), me->GetPositionZ()); + } + break; + } + case EVENT_SCENE_0+16: + me->CastSpell(me, SPELL_HEART_EXPLOSION, true); + me->CastSpell(me, SPELL_HEART_EXPLOSION_EFF, true); + me->SetStandState(UNIT_STAND_STATE_DEAD); + DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 5); + if (GameObject* go = me->FindNearestGameObject(GO_FROZEN_HEART, 20.0f)) + go->Delete(); + events.ScheduleEvent(EVENT_SCENE_0+17, 2000); + break; + case EVENT_SCENE_0+17: + DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_STAND_STATE, UNIT_STAND_STATE_KNEEL); + events.ScheduleEvent(EVENT_SCENE_0+170, 3000); + break; + case EVENT_SCENE_0+170: + DoSummonAction(NPC_DISGUISED_CRUSADER, ACTION_SUMMON_ORIENTATION, 500); + DoSummonAction(NPC_DISGUISED_CRUSADER, ACTION_SUMMON_EMOTE, EMOTE_STATE_READY2H); + if (Creature* cr = me->FindNearestCreature(NPC_DISGUISED_CRUSADER, 10.0f)) + cr->AI()->Talk(0); + events.ScheduleEvent(EVENT_SCENE_0+18, 1000); + break; + case EVENT_SCENE_0+18: + { + DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_TALK, 6); - std::list zealotList; - Position pos1 = {6160.0f, 2765.0f, 573.92f, 0.0f}; - Position pos2 = {6115.0f, 2742.0f, 573.92f, 0.0f}; - me->GetCreaturesWithEntryInRange(zealotList, 100.0f, NPC_CHOSEN_ZEALOT); - for (std::list::const_iterator itr = zealotList.begin(); itr != zealotList.end(); ++itr) - { - (*itr)->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY_UNARMED); - if ((*itr)->GetPositionX() > 6150.0f) - { - Position tpos = pos1; - (*itr)->MovePosition(tpos, frand(1.0f, 14.0f), frand(3.14f, 4.14f)); - (*itr)->GetMotionMaster()->MovePoint(3, tpos.GetPositionX(), tpos.GetPositionY(), tpos.GetPositionZ()); - } - else - { - Position tpos = pos2; - (*itr)->MovePosition(tpos, frand(1.0f, 14.0f), frand(0.0f, 1.0f)); - (*itr)->GetMotionMaster()->MovePoint(3, tpos.GetPositionX(), tpos.GetPositionY(), tpos.GetPositionZ()); - } - } + std::list zealotList; + Position pos1 = {6160.0f, 2765.0f, 573.92f, 0.0f}; + Position pos2 = {6115.0f, 2742.0f, 573.92f, 0.0f}; + me->GetCreaturesWithEntryInRange(zealotList, 100.0f, NPC_CHOSEN_ZEALOT); + for (std::list::const_iterator itr = zealotList.begin(); itr != zealotList.end(); ++itr) + { + (*itr)->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY_UNARMED); + if ((*itr)->GetPositionX() > 6150.0f) + { + Position tpos = pos1; + (*itr)->MovePosition(tpos, frand(1.0f, 14.0f), frand(3.14f, 4.14f)); + (*itr)->GetMotionMaster()->MovePoint(3, tpos.GetPositionX(), tpos.GetPositionY(), tpos.GetPositionZ()); + } + else + { + Position tpos = pos2; + (*itr)->MovePosition(tpos, frand(1.0f, 14.0f), frand(0.0f, 1.0f)); + (*itr)->GetMotionMaster()->MovePoint(3, tpos.GetPositionX(), tpos.GetPositionY(), tpos.GetPositionZ()); + } + } - events.ScheduleEvent(EVENT_SCENE_0+19, 3000); - break; - } - case EVENT_SCENE_0+19: - me->SummonCreatureGroup(1); - events.ScheduleEvent(EVENT_SCENE_0+20, 3700); - break; - case EVENT_SCENE_0+20: - { - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - { - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - if (summon->GetEntry() >= NPC_TIRION_EBON_KNIGHT && summon->GetEntry() <= NPC_TIRION_MOGRAINE) - { - if (summon->GetEntry() == NPC_TIRION_MOGRAINE) - summon->SetHomePosition(6135.97f, 2753.84f, 573.92f, 3.70f); - else - summon->SetHomePosition(6138.36f+frand(-2.0f, 2.0f), 2749.25f+frand(-2.0f, 2.0f), 573.92f, 2.03f); - } - } - DoSummonAction(NPC_TIRION_THASSARIAN, ACTION_SUMMON_TALK, 0); - std::list zealotList; - me->GetCreaturesWithEntryInRange(zealotList, 100.0f, NPC_CHOSEN_ZEALOT); - Unit* target = me->FindNearestCreature(NPC_TIRION_MOGRAINE, 100.0f); - for (std::list::const_iterator itr = zealotList.begin(); itr != zealotList.end(); ++itr) - { - if (!target) - target = (*itr)->SelectNearestTarget(40.0f); - if (target) - (*itr)->AI()->AttackStart(target); - } + events.ScheduleEvent(EVENT_SCENE_0+19, 3000); + break; + } + case EVENT_SCENE_0+19: + me->SummonCreatureGroup(1); + events.ScheduleEvent(EVENT_SCENE_0+20, 3700); + break; + case EVENT_SCENE_0+20: + { + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + { + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + if (summon->GetEntry() >= NPC_TIRION_EBON_KNIGHT && summon->GetEntry() <= NPC_TIRION_MOGRAINE) + { + if (summon->GetEntry() == NPC_TIRION_MOGRAINE) + summon->SetHomePosition(6135.97f, 2753.84f, 573.92f, 3.70f); + else + summon->SetHomePosition(6138.36f+frand(-2.0f, 2.0f), 2749.25f+frand(-2.0f, 2.0f), 573.92f, 2.03f); + } + } + DoSummonAction(NPC_TIRION_THASSARIAN, ACTION_SUMMON_TALK, 0); + std::list zealotList; + me->GetCreaturesWithEntryInRange(zealotList, 100.0f, NPC_CHOSEN_ZEALOT); + Unit* target = me->FindNearestCreature(NPC_TIRION_MOGRAINE, 100.0f); + for (std::list::const_iterator itr = zealotList.begin(); itr != zealotList.end(); ++itr) + { + if (!target) + target = (*itr)->SelectNearestTarget(40.0f); + if (target) + (*itr)->AI()->AttackStart(target); + } - break; - } - case EVENT_SCENE_0+30: - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetEntry() >= NPC_TIRION_EBON_KNIGHT && summon->GetEntry() <= NPC_TIRION_MOGRAINE) - { - if (summon->GetEntry() == NPC_TIRION_MOGRAINE) - summon->GetMotionMaster()->MovePoint(6, 6135.97f, 2753.84f, 573.92f); - else - summon->GetMotionMaster()->MovePoint(6, 6138.36f+frand(-2.0f, 2.0f), 2749.25f+frand(-2.0f, 2.0f), 573.92f); - } + break; + } + case EVENT_SCENE_0+30: + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetEntry() >= NPC_TIRION_EBON_KNIGHT && summon->GetEntry() <= NPC_TIRION_MOGRAINE) + { + if (summon->GetEntry() == NPC_TIRION_MOGRAINE) + summon->GetMotionMaster()->MovePoint(6, 6135.97f, 2753.84f, 573.92f); + else + summon->GetMotionMaster()->MovePoint(6, 6138.36f+frand(-2.0f, 2.0f), 2749.25f+frand(-2.0f, 2.0f), 573.92f); + } - events.ScheduleEvent(EVENT_SCENE_0+310, 4000); - break; - case EVENT_SCENE_0+310: - DoSummonAction(NPC_TIRION_MOGRAINE, ACTION_SUMMON_TALK, 0); - DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_STAND_STATE, UNIT_STAND_STATE_STAND); - me->SummonGameObject(GO_ESCAPE_PORTAL, 6133.83f, 2757.24f, 573.914f, 1.97f, 0.0f, 0.0f, 0.0f, 0.0f, 60); - me->CastSpell(me, SPELL_TIRIONS_GAMBIT_CREDIT, true); - events.ScheduleEvent(EVENT_SCENE_0+31, 6000); - DoSummonAction(NPC_DISGUISED_CRUSADER, ACTION_SUMMON_EMOTE, EMOTE_ONESHOT_NONE); - break; - case EVENT_SCENE_0+31: - DoSummonAction(NPC_TIRION_THASSARIAN, ACTION_SUMMON_TALK, 1); - events.ScheduleEvent(EVENT_SCENE_0+32, 7000); - break; - case EVENT_SCENE_0+32: - DoSummonAction(NPC_TIRION_MOGRAINE, ACTION_SUMMON_TALK, 1); - events.ScheduleEvent(EVENT_SCENE_0+33, 7000); - break; - case EVENT_SCENE_0+33: - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - { - if (summon->GetEntry() == NPC_TIRION_LICH_KING) - summon->CastSpell(summon, SPELL_LICH_KINGS_FURY, false); - summon->DespawnOrUnsummon(summon->GetEntry() == NPC_TIRION_LICH_KING ? 10000 : 4000); - } - me->DespawnOrUnsummon(10000); - break; - } + events.ScheduleEvent(EVENT_SCENE_0+310, 4000); + break; + case EVENT_SCENE_0+310: + DoSummonAction(NPC_TIRION_MOGRAINE, ACTION_SUMMON_TALK, 0); + DoSummonAction(NPC_TIRION_LICH_KING, ACTION_SUMMON_STAND_STATE, UNIT_STAND_STATE_STAND); + me->SummonGameObject(GO_ESCAPE_PORTAL, 6133.83f, 2757.24f, 573.914f, 1.97f, 0.0f, 0.0f, 0.0f, 0.0f, 60); + me->CastSpell(me, SPELL_TIRIONS_GAMBIT_CREDIT, true); + events.ScheduleEvent(EVENT_SCENE_0+31, 6000); + DoSummonAction(NPC_DISGUISED_CRUSADER, ACTION_SUMMON_EMOTE, EMOTE_ONESHOT_NONE); + break; + case EVENT_SCENE_0+31: + DoSummonAction(NPC_TIRION_THASSARIAN, ACTION_SUMMON_TALK, 1); + events.ScheduleEvent(EVENT_SCENE_0+32, 7000); + break; + case EVENT_SCENE_0+32: + DoSummonAction(NPC_TIRION_MOGRAINE, ACTION_SUMMON_TALK, 1); + events.ScheduleEvent(EVENT_SCENE_0+33, 7000); + break; + case EVENT_SCENE_0+33: + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + { + if (summon->GetEntry() == NPC_TIRION_LICH_KING) + summon->CastSpell(summon, SPELL_LICH_KINGS_FURY, false); + summon->DespawnOrUnsummon(summon->GetEntry() == NPC_TIRION_LICH_KING ? 10000 : 4000); + } + me->DespawnOrUnsummon(10000); + break; + } } }; @@ -1034,30 +1034,30 @@ class npc_tirions_gambit_tirion : public CreatureScript enum infraGreenBomberQuests { - SPELL_ENGINEERING = 59193, - SPELL_BOMBER_BAY = 59194, - SPELL_ANTI_AIR_TURRET = 59196, + SPELL_ENGINEERING = 59193, + SPELL_BOMBER_BAY = 59194, + SPELL_ANTI_AIR_TURRET = 59196, - SPELL_CHARGE_SHIELD = 59061, - SPELL_INFRA_GREEN_SHIELD = 59288, + SPELL_CHARGE_SHIELD = 59061, + SPELL_INFRA_GREEN_SHIELD = 59288, - SPELL_BURNING = 61171, - SPELL_COSMETIC_FIRE = 51195, - SPELL_EXTINGUISH_FIRE = 61172, + SPELL_BURNING = 61171, + SPELL_COSMETIC_FIRE = 51195, + SPELL_EXTINGUISH_FIRE = 61172, - SPELL_WAITING_FOR_A_BOMBER = 59563, - SPELL_FLIGHT_ORDERS = 61281, + SPELL_WAITING_FOR_A_BOMBER = 59563, + SPELL_FLIGHT_ORDERS = 61281, - EVENT_TAKE_PASSENGER = 1, - EVENT_START_FLIGHT = 2, - EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE = 3, - EVENT_SYNCHRONIZE_SHIELDS = 4, - EVENT_SPREAD_FIRE = 5, + EVENT_TAKE_PASSENGER = 1, + EVENT_START_FLIGHT = 2, + EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE = 3, + EVENT_SYNCHRONIZE_SHIELDS = 4, + EVENT_SPREAD_FIRE = 5, - SEAT_BOMBER = 0, - SEAT_TURRET = 1, - SEAT_ENGINEERING = 2 + SEAT_BOMBER = 0, + SEAT_TURRET = 1, + SEAT_ENGINEERING = 2 }; class spell_switch_infragreen_bomber_station : public SpellScriptLoader @@ -1069,40 +1069,40 @@ class spell_switch_infragreen_bomber_station : public SpellScriptLoader { PrepareSpellScript(spell_switch_infragreen_bomber_station_SpellScript) - uint8 GetSeatNumber(uint32 spellId) - { - if (spellId == SPELL_ENGINEERING) - return 2; - else if (spellId == SPELL_ANTI_AIR_TURRET) - return 1; - else - return 0; - } + uint8 GetSeatNumber(uint32 spellId) + { + if (spellId == SPELL_ENGINEERING) + return 2; + else if (spellId == SPELL_ANTI_AIR_TURRET) + return 1; + else + return 0; + } void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - Vehicle* kit = GetCaster()->GetVehicle(); - Unit* charmer = GetCaster()->GetCharmer(); // Player controlling station - if (!kit || !charmer) - return; + PreventHitDefaultEffect(effIndex); + Vehicle* kit = GetCaster()->GetVehicle(); + Unit* charmer = GetCaster()->GetCharmer(); // Player controlling station + if (!kit || !charmer) + return; - uint8 seatNumber = GetSeatNumber(GetSpellInfo()->Id); - SeatMap::iterator itr = kit->GetSeatIteratorForPassenger(GetCaster()); - if (itr == kit->Seats.end()) - return; + uint8 seatNumber = GetSeatNumber(GetSpellInfo()->Id); + SeatMap::iterator itr = kit->GetSeatIteratorForPassenger(GetCaster()); + if (itr == kit->Seats.end()) + return; - // Xinef: Same seat, no change required - if (seatNumber == itr->first) - return; + // Xinef: Same seat, no change required + if (seatNumber == itr->first) + return; - if (Unit* station = kit->GetPassenger(seatNumber)) - station->HandleSpellClick(charmer, 0); + if (Unit* station = kit->GetPassenger(seatNumber)) + station->HandleSpellClick(charmer, 0); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_switch_infragreen_bomber_station_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_switch_infragreen_bomber_station_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -1124,23 +1124,23 @@ class spell_charge_shield_bomber : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - Unit* ship = GetCaster()->GetVehicleBase(); - if (!ship) - return; + PreventHitDefaultEffect(effIndex); + Unit* ship = GetCaster()->GetVehicleBase(); + if (!ship) + return; - ship->CastSpell(ship, SPELL_INFRA_GREEN_SHIELD, true); - Aura* aura = ship->GetAura(SPELL_INFRA_GREEN_SHIELD); - if (!aura) - return; - - aura->ModStackAmount(GetEffectValue() - 1); + ship->CastSpell(ship, SPELL_INFRA_GREEN_SHIELD, true); + Aura* aura = ship->GetAura(SPELL_INFRA_GREEN_SHIELD); + if (!aura) + return; + + aura->ModStackAmount(GetEffectValue() - 1); } void Register() { - if (m_scriptSpellId == SPELL_CHARGE_SHIELD) - OnEffectHitTarget += SpellEffectFn(spell_charge_shield_bomber_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + if (m_scriptSpellId == SPELL_CHARGE_SHIELD) + OnEffectHitTarget += SpellEffectFn(spell_charge_shield_bomber_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -1162,17 +1162,17 @@ class spell_charge_shield_bomber : public SpellScriptLoader void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { uint32 absorbPct = GetStackAmount()/2; - absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); - ModStackAmount(-1); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); + ModStackAmount(-1); } void Register() { - if (m_scriptSpellId == SPELL_INFRA_GREEN_SHIELD) - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_charge_shield_bomber_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_charge_shield_bomber_AuraScript::Absorb, EFFECT_0); - } + if (m_scriptSpellId == SPELL_INFRA_GREEN_SHIELD) + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_charge_shield_bomber_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_charge_shield_bomber_AuraScript::Absorb, EFFECT_0); + } } }; @@ -1193,37 +1193,37 @@ class spell_fight_fire_bomber : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - Vehicle* kit = GetCaster()->GetVehicle(); - if (!kit) - return; + PreventHitDefaultEffect(effIndex); + Vehicle* kit = GetCaster()->GetVehicle(); + if (!kit) + return; - bool extinguished = false; - uint8 fireCount = 0; - for (uint8 seat = 3; seat <= 5; ++seat) - if (Unit* banner = kit->GetPassenger(seat)) - if (banner->HasAura(SPELL_COSMETIC_FIRE)) - { - if (!extinguished) - { - GetCaster()->CastSpell(banner, SPELL_EXTINGUISH_FIRE, true); - extinguished = true; - if (urand(0,2)) - { - banner->RemoveAurasDueToSpell(SPELL_COSMETIC_FIRE); - continue; - } - } - fireCount++; - } + bool extinguished = false; + uint8 fireCount = 0; + for (uint8 seat = 3; seat <= 5; ++seat) + if (Unit* banner = kit->GetPassenger(seat)) + if (banner->HasAura(SPELL_COSMETIC_FIRE)) + { + if (!extinguished) + { + GetCaster()->CastSpell(banner, SPELL_EXTINGUISH_FIRE, true); + extinguished = true; + if (urand(0,2)) + { + banner->RemoveAurasDueToSpell(SPELL_COSMETIC_FIRE); + continue; + } + } + fireCount++; + } - if (fireCount == 0) - GetCaster()->RemoveAurasDueToSpell(SPELL_BURNING); + if (fireCount == 0) + GetCaster()->RemoveAurasDueToSpell(SPELL_BURNING); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_fight_fire_bomber_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_fight_fire_bomber_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -1244,14 +1244,14 @@ class spell_anti_air_rocket_bomber : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - const WorldLocation* loc = GetExplTargetDest(); - GetCaster()->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), GetSpellInfo()->Effects[effIndex].CalcValue(), true); + PreventHitDefaultEffect(effIndex); + const WorldLocation* loc = GetExplTargetDest(); + GetCaster()->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), GetSpellInfo()->Effects[effIndex].CalcValue(), true); } void Register() { - OnEffectLaunch += SpellEffectFn(spell_anti_air_rocket_bomber_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectLaunch += SpellEffectFn(spell_anti_air_rocket_bomber_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -1269,159 +1269,159 @@ class npc_infra_green_bomber_generic : public CreatureScript struct npc_infra_green_bomber_genericAI : NullCreatureAI { npc_infra_green_bomber_genericAI(Creature* creature) : NullCreatureAI(creature) - { - events.Reset(); - } + { + events.Reset(); + } - Unit* GetSummoner() - { - if (TempSummon* tempSummon = me->ToTempSummon()) - return tempSummon->GetSummoner(); - return NULL; - } + Unit* GetSummoner() + { + if (TempSummon* tempSummon = me->ToTempSummon()) + return tempSummon->GetSummoner(); + return NULL; + } - void IsSummonedBy(Unit* summoner) - { - if (!summoner) - return; + void IsSummonedBy(Unit* summoner) + { + if (!summoner) + return; - summoner->CastSpell(summoner, SPELL_WAITING_FOR_A_BOMBER, true); - summoner->CastSpell(summoner, SPELL_FLIGHT_ORDERS, true); - events.ScheduleEvent(EVENT_START_FLIGHT, 0); - events.ScheduleEvent(EVENT_TAKE_PASSENGER, 3000); - me->SetCanFly(true); - me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); - me->SetSpeed(MOVE_FLIGHT, 0.1f); - me->setFaction(summoner->getFaction()); - } + summoner->CastSpell(summoner, SPELL_WAITING_FOR_A_BOMBER, true); + summoner->CastSpell(summoner, SPELL_FLIGHT_ORDERS, true); + events.ScheduleEvent(EVENT_START_FLIGHT, 0); + events.ScheduleEvent(EVENT_TAKE_PASSENGER, 3000); + me->SetCanFly(true); + me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); + me->SetSpeed(MOVE_FLIGHT, 0.1f); + me->setFaction(summoner->getFaction()); + } - void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) - { - if (who != me) - if (me->HealthBelowPct(80) && urand(0,1)) - SpreadFire(true); - } + void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) + { + if (who != me) + if (me->HealthBelowPct(80) && urand(0,1)) + SpreadFire(true); + } - void SpreadFire(bool init) - { - Vehicle* kit = me->GetVehicleKit(); - if (!kit) - return; + void SpreadFire(bool init) + { + Vehicle* kit = me->GetVehicleKit(); + if (!kit) + return; - if (Unit* passenger = kit->GetPassenger(SEAT_ENGINEERING)) - if (init && !passenger->HasAura(SPELL_BURNING)) - { - me->MonsterTextEmote("Your Vehicle is burning!", GetSummoner(), true); - passenger->AddAura(SPELL_BURNING, passenger); - } - - for (uint8 seat = 3; seat <= 5; ++seat) - if (Unit* banner = kit->GetPassenger(seat)) - if (!banner->HasAura(SPELL_COSMETIC_FIRE)) - { - banner->AddAura(SPELL_COSMETIC_FIRE, banner); - break; - } - } + if (Unit* passenger = kit->GetPassenger(SEAT_ENGINEERING)) + if (init && !passenger->HasAura(SPELL_BURNING)) + { + me->MonsterTextEmote("Your Vehicle is burning!", GetSummoner(), true); + passenger->AddAura(SPELL_BURNING, passenger); + } + + for (uint8 seat = 3; seat <= 5; ++seat) + if (Unit* banner = kit->GetPassenger(seat)) + if (!banner->HasAura(SPELL_COSMETIC_FIRE)) + { + banner->AddAura(SPELL_COSMETIC_FIRE, banner); + break; + } + } void UpdateAI(uint32 diff) { - events.Update(diff); - uint32 eventId = events.ExecuteEvent(); - switch (eventId) - { - case EVENT_TAKE_PASSENGER: - if (Unit* owner = GetSummoner()) - if (Vehicle* kit = me->GetVehicleKit()) - if (Unit* turret = kit->GetPassenger(SEAT_TURRET)) - { - me->SetSpeed(MOVE_FLIGHT, 1.2f); - owner->RemoveAurasDueToSpell(SPELL_WAITING_FOR_A_BOMBER); - turret->HandleSpellClick(owner, 0); - return; - } - me->DespawnOrUnsummon(1); - break; - case EVENT_START_FLIGHT: - { - WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry()); - if (!path || path->empty()) - { - me->DespawnOrUnsummon(1); - return; - } + events.Update(diff); + uint32 eventId = events.ExecuteEvent(); + switch (eventId) + { + case EVENT_TAKE_PASSENGER: + if (Unit* owner = GetSummoner()) + if (Vehicle* kit = me->GetVehicleKit()) + if (Unit* turret = kit->GetPassenger(SEAT_TURRET)) + { + me->SetSpeed(MOVE_FLIGHT, 1.2f); + owner->RemoveAurasDueToSpell(SPELL_WAITING_FOR_A_BOMBER); + turret->HandleSpellClick(owner, 0); + return; + } + me->DespawnOrUnsummon(1); + break; + case EVENT_START_FLIGHT: + { + WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry()); + if (!path || path->empty()) + { + me->DespawnOrUnsummon(1); + return; + } - Movement::PointsArray pathPoints; - pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + Movement::PointsArray pathPoints; + pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - uint32 wpCounter = 1; - WPPath::const_iterator itr; - while ((itr = path->find(wpCounter++)) != path->end()) - { - WayPoint* wp = itr->second; - pathPoints.push_back(G3D::Vector3(wp->x, wp->y, wp->z)); - } + uint32 wpCounter = 1; + WPPath::const_iterator itr; + while ((itr = path->find(wpCounter++)) != path->end()) + { + WayPoint* wp = itr->second; + pathPoints.push_back(G3D::Vector3(wp->x, wp->y, wp->z)); + } - me->GetMotionMaster()->MoveSplinePath(&pathPoints); - events.ScheduleEvent(EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE, 60000); - events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 5000); - break; - } - case EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE: - { - // Check if path is finished - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != ESCORT_MOTION_TYPE) - { - me->DespawnOrUnsummon(1); - return; - } + me->GetMotionMaster()->MoveSplinePath(&pathPoints); + events.ScheduleEvent(EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE, 60000); + events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 5000); + break; + } + case EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE: + { + // Check if path is finished + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != ESCORT_MOTION_TYPE) + { + me->DespawnOrUnsummon(1); + return; + } - // Check fire count - uint8 fireCount = 0; - if (Vehicle* kit = me->GetVehicleKit()) - for (uint8 seat = 3; seat <= 5; ++seat) - if (Unit* banner = kit->GetPassenger(seat)) - if (banner->HasAura(SPELL_COSMETIC_FIRE)) - fireCount++; - - if (fireCount) - Unit::DealDamage(me, me, 3000*fireCount, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE); - else // Heal - me->ModifyHealth(2000); + // Check fire count + uint8 fireCount = 0; + if (Vehicle* kit = me->GetVehicleKit()) + for (uint8 seat = 3; seat <= 5; ++seat) + if (Unit* banner = kit->GetPassenger(seat)) + if (banner->HasAura(SPELL_COSMETIC_FIRE)) + fireCount++; + + if (fireCount) + Unit::DealDamage(me, me, 3000*fireCount, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE); + else // Heal + me->ModifyHealth(2000); - events.ScheduleEvent(EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE, 4000); - break; - } - case EVENT_SYNCHRONIZE_SHIELDS: - if (Vehicle* kit = me->GetVehicleKit()) - { - // Xinef: check if we have player on any of the stations - bool playerPresent = false; - uint32 stackAmount = me->GetAuraCount(SPELL_INFRA_GREEN_SHIELD); - for (uint8 i = SEAT_BOMBER; i <= SEAT_ENGINEERING; ++i) - if (Unit* station = kit->GetPassenger(i)) - { - if (Vehicle* stationKit = station->GetVehicleKit()) - if (stationKit->GetPassenger(0)) - playerPresent = true; + events.ScheduleEvent(EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE, 4000); + break; + } + case EVENT_SYNCHRONIZE_SHIELDS: + if (Vehicle* kit = me->GetVehicleKit()) + { + // Xinef: check if we have player on any of the stations + bool playerPresent = false; + uint32 stackAmount = me->GetAuraCount(SPELL_INFRA_GREEN_SHIELD); + for (uint8 i = SEAT_BOMBER; i <= SEAT_ENGINEERING; ++i) + if (Unit* station = kit->GetPassenger(i)) + { + if (Vehicle* stationKit = station->GetVehicleKit()) + if (stationKit->GetPassenger(0)) + playerPresent = true; - if (stackAmount) - station->SetAuraStack(SPELL_INFRA_GREEN_SHIELD, station, stackAmount); - else - station->RemoveAurasDueToSpell(SPELL_INFRA_GREEN_SHIELD); - } - if (!playerPresent) - me->DespawnOrUnsummon(1); - } - events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 1000); - break; - case EVENT_SPREAD_FIRE: - break; - } + if (stackAmount) + station->SetAuraStack(SPELL_INFRA_GREEN_SHIELD, station, stackAmount); + else + station->RemoveAurasDueToSpell(SPELL_INFRA_GREEN_SHIELD); + } + if (!playerPresent) + me->DespawnOrUnsummon(1); + } + events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 1000); + break; + case EVENT_SPREAD_FIRE: + break; + } } - private: - EventMap events; + private: + EventMap events; }; @@ -2053,8 +2053,8 @@ class npc_frostbrood_skytalon : public CreatureScript void IsSummonedBy(Unit* summoner) { - if (!summoner) - return; + if (!summoner) + return; me->GetMotionMaster()->MovePoint(POINT_GRAB_DECOY, summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ()+3.0f); } @@ -2110,20 +2110,20 @@ class npc_frostbrood_skytalon : public CreatureScript void AddSC_icecrown() { - // Ours - new npc_black_knight_graveyard(); - new npc_battle_at_valhalas(); - new npc_llod_generic(); - new npc_lord_arete(); - new npc_boneguard_footman(); - new npc_tirions_gambit_tirion(); - new spell_switch_infragreen_bomber_station(); - new spell_charge_shield_bomber(); - new spell_fight_fire_bomber(); - new spell_anti_air_rocket_bomber(); - new npc_infra_green_bomber_generic(); + // Ours + new npc_black_knight_graveyard(); + new npc_battle_at_valhalas(); + new npc_llod_generic(); + new npc_lord_arete(); + new npc_boneguard_footman(); + new npc_tirions_gambit_tirion(); + new spell_switch_infragreen_bomber_station(); + new spell_charge_shield_bomber(); + new spell_fight_fire_bomber(); + new spell_anti_air_rocket_bomber(); + new npc_infra_green_bomber_generic(); - // Theirs + // Theirs new npc_guardian_pavilion(); new npc_tournament_training_dummy(); new npc_blessed_banner(); diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index d6cc6cd2c..0ec9a2141 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -41,10 +41,10 @@ EndContentData */ // Ours enum songOfWindandWater { - NPC_SOWAW_WATER_ELEMENTAL = 28999, - NPC_SOWAW_WIND_ELEMENTAL = 28985, - NPC_SOWAW_WIND_MODEL = 14516, - NPC_SOWAW_WATER_MODEL = 20076, + NPC_SOWAW_WATER_ELEMENTAL = 28999, + NPC_SOWAW_WIND_ELEMENTAL = 28985, + NPC_SOWAW_WIND_MODEL = 14516, + NPC_SOWAW_WATER_MODEL = 20076, }; class spell_q12726_song_of_wind_and_water : public SpellScriptLoader @@ -59,19 +59,19 @@ class spell_q12726_song_of_wind_and_water : public SpellScriptLoader void HandleHealPct(SpellEffIndex /*effIndex*/) { if (Creature* cr = GetHitCreature()) - { - //cr->UpdateEntry((cr->GetEntry() == NPC_SOWAW_WATER_ELEMENTAL ? NPC_SOWAW_WIND_ELEMENTAL : NPC_SOWAW_WATER_ELEMENTAL)); - cr->SetDisplayId(cr->GetDisplayId() == NPC_SOWAW_WATER_MODEL ? NPC_SOWAW_WIND_MODEL : NPC_SOWAW_WATER_MODEL); - if (Player* player = cr->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - player->KilledMonsterCredit(cr->GetDisplayId() == NPC_SOWAW_WATER_MODEL ? 29008 : 29009, 0); - CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(cr->GetDisplayId() == NPC_SOWAW_WIND_MODEL ? NPC_SOWAW_WIND_ELEMENTAL : NPC_SOWAW_WATER_ELEMENTAL); - for (uint8 i=0; i < CREATURE_MAX_SPELLS; ++i) - cr->m_spells[i] = ct->spells[i]; + { + //cr->UpdateEntry((cr->GetEntry() == NPC_SOWAW_WATER_ELEMENTAL ? NPC_SOWAW_WIND_ELEMENTAL : NPC_SOWAW_WATER_ELEMENTAL)); + cr->SetDisplayId(cr->GetDisplayId() == NPC_SOWAW_WATER_MODEL ? NPC_SOWAW_WIND_MODEL : NPC_SOWAW_WATER_MODEL); + if (Player* player = cr->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + player->KilledMonsterCredit(cr->GetDisplayId() == NPC_SOWAW_WATER_MODEL ? 29008 : 29009, 0); + CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(cr->GetDisplayId() == NPC_SOWAW_WIND_MODEL ? NPC_SOWAW_WIND_ELEMENTAL : NPC_SOWAW_WATER_ELEMENTAL); + for (uint8 i=0; i < CREATURE_MAX_SPELLS; ++i) + cr->m_spells[i] = ct->spells[i]; - player->VehicleSpellInitialize(); - } - } + player->VehicleSpellInitialize(); + } + } } void Register() @@ -88,29 +88,29 @@ class spell_q12726_song_of_wind_and_water : public SpellScriptLoader enum AHerosBurden { - SPELL_TOMB_OF_THE_HEARTLESS = 52182, - SPELL_ARTRUIS_FROST_NOVA = 11831, - SPELL_ARTRUIS_FROSTBOLT = 15530, - SPELL_ARTRUIS_ICE_LANCE = 54261, - SPELL_ARTRUIS_ICY_VEINS = 54792, - SPELL_ARTRUIS_BINDING = 52185, + SPELL_TOMB_OF_THE_HEARTLESS = 52182, + SPELL_ARTRUIS_FROST_NOVA = 11831, + SPELL_ARTRUIS_FROSTBOLT = 15530, + SPELL_ARTRUIS_ICE_LANCE = 54261, + SPELL_ARTRUIS_ICY_VEINS = 54792, + SPELL_ARTRUIS_BINDING = 52185, - NPC_JALOOT = 28667, - NPC_ZEPIK = 28668, + NPC_JALOOT = 28667, + NPC_ZEPIK = 28668, - EVENT_CAST_FROST_BOLT = 1, - EVENT_CAST_FROST_NOVA = 2, - EVENT_CAST_ICE_LANCE = 3, - EVENT_CAST_ICY_VEINS = 4, - EVENT_ARTRUIS_HP_CHECK = 5, - EVENT_ARTRUIS_TALK1 = 6, - EVENT_ARTRUIS_TALK2 = 7, - EVENT_ARTRUIS_TALK3 = 8, + EVENT_CAST_FROST_BOLT = 1, + EVENT_CAST_FROST_NOVA = 2, + EVENT_CAST_ICE_LANCE = 3, + EVENT_CAST_ICY_VEINS = 4, + EVENT_ARTRUIS_HP_CHECK = 5, + EVENT_ARTRUIS_TALK1 = 6, + EVENT_ARTRUIS_TALK2 = 7, + EVENT_ARTRUIS_TALK3 = 8, - ACTION_BIND_MINIONS = 1, - ACTION_MAKE_FRIENDLY = 2, + ACTION_BIND_MINIONS = 1, + ACTION_MAKE_FRIENDLY = 2, - GO_ARTRUIS_PHYLACTERY = 190777, + GO_ARTRUIS_PHYLACTERY = 190777, }; class npc_artruis_the_hearthless : public CreatureScript @@ -122,148 +122,148 @@ public: { npc_artruis_the_hearthlessAI(Creature* creature) : ScriptedAI(creature), summons(me) { } - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; void Reset() { - events.Reset(); - summons.DespawnAll(); - me->SetControlled(false, UNIT_STATE_STUNNED); + events.Reset(); + summons.DespawnAll(); + me->SetControlled(false, UNIT_STATE_STUNNED); - Creature *cr; - if (cr = me->SummonCreature(NPC_JALOOT, 5616.91f, 3772.67f, -94.26f, 1.78f)) - { - summons.Summon(cr); - cr->CastSpell(cr, SPELL_TOMB_OF_THE_HEARTLESS, true); - cr->setFaction(me->getFaction()); - } - if (cr = me->SummonCreature(NPC_ZEPIK, 5631.63f, 3794.36f, -92.24f, 3.45f)) - { - summons.Summon(cr); - cr->CastSpell(cr, SPELL_TOMB_OF_THE_HEARTLESS, true); - cr->setFaction(me->getFaction()); - } - } - - void MoveInLineOfSight(Unit* who) - { - if (who->GetEntry() == NPC_JALOOT || who->GetEntry() == NPC_ZEPIK) - return; - - ScriptedAI::MoveInLineOfSight(who); - } - - void EnterCombat(Unit* who) - { - me->MonsterYell("Ah, the heroes. Your little friends said you would come. This certainly saves me the trouble of hunting you down myself.", LANG_UNIVERSAL, 0); - me->CastSpell(me, SPELL_ARTRUIS_ICY_VEINS, true); - events.RescheduleEvent(EVENT_CAST_FROST_BOLT, 4000); - events.RescheduleEvent(EVENT_CAST_FROST_NOVA, 15000); - events.RescheduleEvent(EVENT_CAST_ICE_LANCE, 8500); - events.RescheduleEvent(EVENT_CAST_ICY_VEINS, 30000); - events.RescheduleEvent(EVENT_ARTRUIS_HP_CHECK, 1000); - events.RescheduleEvent(EVENT_ARTRUIS_TALK1, 6000); - } - - void JustDied(Unit* /*killer*/) - { - if (GameObject* go = me->SummonGameObject(GO_ARTRUIS_PHYLACTERY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 600000)) - me->RemoveGameObject(go, false); - } - - void SummonedCreatureDies(Creature* summon, Unit*) - { - SummonsAction(ACTION_MAKE_FRIENDLY); - me->RemoveAurasDueToSpell(SPELL_ARTRUIS_BINDING); - summon->DespawnOrUnsummon(60000); - me->SetControlled(false, UNIT_STATE_STUNNED); - } - - void SummonsAction(uint8 action) - { - if (!summons.empty()) + Creature *cr; + if (cr = me->SummonCreature(NPC_JALOOT, 5616.91f, 3772.67f, -94.26f, 1.78f)) { - if (action == ACTION_BIND_MINIONS) - me->CastSpell(me, SPELL_ARTRUIS_BINDING, true); + summons.Summon(cr); + cr->CastSpell(cr, SPELL_TOMB_OF_THE_HEARTLESS, true); + cr->setFaction(me->getFaction()); + } + if (cr = me->SummonCreature(NPC_ZEPIK, 5631.63f, 3794.36f, -92.24f, 3.45f)) + { + summons.Summon(cr); + cr->CastSpell(cr, SPELL_TOMB_OF_THE_HEARTLESS, true); + cr->setFaction(me->getFaction()); + } + } + + void MoveInLineOfSight(Unit* who) + { + if (who->GetEntry() == NPC_JALOOT || who->GetEntry() == NPC_ZEPIK) + return; + + ScriptedAI::MoveInLineOfSight(who); + } + + void EnterCombat(Unit* who) + { + me->MonsterYell("Ah, the heroes. Your little friends said you would come. This certainly saves me the trouble of hunting you down myself.", LANG_UNIVERSAL, 0); + me->CastSpell(me, SPELL_ARTRUIS_ICY_VEINS, true); + events.RescheduleEvent(EVENT_CAST_FROST_BOLT, 4000); + events.RescheduleEvent(EVENT_CAST_FROST_NOVA, 15000); + events.RescheduleEvent(EVENT_CAST_ICE_LANCE, 8500); + events.RescheduleEvent(EVENT_CAST_ICY_VEINS, 30000); + events.RescheduleEvent(EVENT_ARTRUIS_HP_CHECK, 1000); + events.RescheduleEvent(EVENT_ARTRUIS_TALK1, 6000); + } + + void JustDied(Unit* /*killer*/) + { + if (GameObject* go = me->SummonGameObject(GO_ARTRUIS_PHYLACTERY, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 600000)) + me->RemoveGameObject(go, false); + } + + void SummonedCreatureDies(Creature* summon, Unit*) + { + SummonsAction(ACTION_MAKE_FRIENDLY); + me->RemoveAurasDueToSpell(SPELL_ARTRUIS_BINDING); + summon->DespawnOrUnsummon(60000); + me->SetControlled(false, UNIT_STATE_STUNNED); + } + + void SummonsAction(uint8 action) + { + if (!summons.empty()) + { + if (action == ACTION_BIND_MINIONS) + me->CastSpell(me, SPELL_ARTRUIS_BINDING, true); for (std::list::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) { Creature *minion = ObjectAccessor::GetCreature(*me, *itr); if (minion && minion->IsAlive()) - { - if (action == ACTION_BIND_MINIONS) - { - minion->RemoveAurasDueToSpell(SPELL_TOMB_OF_THE_HEARTLESS); - if (me->GetVictim()) - minion->AI()->AttackStart(me->GetVictim()); - } - else if (action == ACTION_MAKE_FRIENDLY && me->GetVictim()) - { - minion->MonsterSay("Now you not catch us with back turned! Now we hurt you bad undead. BAD!", LANG_UNIVERSAL, 0); - minion->RemoveAurasDueToSpell(SPELL_ARTRUIS_BINDING); - minion->setFaction(me->GetVictim()->getFaction()); - minion->AddThreat(me, 100000.0f); - minion->AI()->AttackStart(me); - minion->DespawnOrUnsummon(900000); - events.RescheduleEvent(EVENT_ARTRUIS_TALK3, 5000); - } - } + { + if (action == ACTION_BIND_MINIONS) + { + minion->RemoveAurasDueToSpell(SPELL_TOMB_OF_THE_HEARTLESS); + if (me->GetVictim()) + minion->AI()->AttackStart(me->GetVictim()); + } + else if (action == ACTION_MAKE_FRIENDLY && me->GetVictim()) + { + minion->MonsterSay("Now you not catch us with back turned! Now we hurt you bad undead. BAD!", LANG_UNIVERSAL, 0); + minion->RemoveAurasDueToSpell(SPELL_ARTRUIS_BINDING); + minion->setFaction(me->GetVictim()->getFaction()); + minion->AddThreat(me, 100000.0f); + minion->AI()->AttackStart(me); + minion->DespawnOrUnsummon(900000); + events.RescheduleEvent(EVENT_ARTRUIS_TALK3, 5000); + } + } } } - } + } void UpdateAI(uint32 diff) { - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_ARTRUIS_HP_CHECK: - if (me->GetHealthPct() <= 30) - { - me->SetControlled(true, UNIT_STATE_STUNNED); - me->MonsterTextEmote("Artruis is shielded. You must choose your side quickly to break his spell.", 0, true); - SummonsAction(ACTION_BIND_MINIONS); - events.PopEvent(); - break; - } - events.RepeatEvent(1000); - break; - case EVENT_ARTRUIS_TALK1: - me->MonsterYell("I have weathered a hundred years of war and suffering. Do you truly think it wise to pit your mortal bodies against a being that cannot die? I'd venture you have more to lose.", LANG_UNIVERSAL, 0); - events.PopEvent(); - events.RescheduleEvent(EVENT_ARTRUIS_TALK2, 10000); - break; - case EVENT_ARTRUIS_TALK2: - me->MonsterYell("Even shattered into countless pieces, the crystals all around weaken me... perhaps i should not have underestimated the titans so...", LANG_UNIVERSAL, 0); - events.PopEvent(); - break; - case EVENT_ARTRUIS_TALK3: - me->MonsterYell("Arthas once mustered strength... of the very same sort... perhaps he is the path that you will follow.", LANG_UNIVERSAL, 0); - events.PopEvent(); - break; - case EVENT_CAST_FROST_BOLT: - me->CastSpell(me->GetVictim(), SPELL_ARTRUIS_FROSTBOLT, false); - events.RepeatEvent(4000); - break; - case EVENT_CAST_ICE_LANCE: - me->CastSpell(me->GetVictim(), SPELL_ARTRUIS_ICE_LANCE, false); - events.RepeatEvent(8500); - break; - case EVENT_CAST_FROST_NOVA: - me->CastSpell(me, SPELL_ARTRUIS_FROST_NOVA, false); - events.RepeatEvent(15000); - break; - case EVENT_CAST_ICY_VEINS: - me->CastSpell(me, SPELL_ARTRUIS_ICY_VEINS, false); - events.RepeatEvent(30000); - break; - } + switch (events.GetEvent()) + { + case EVENT_ARTRUIS_HP_CHECK: + if (me->GetHealthPct() <= 30) + { + me->SetControlled(true, UNIT_STATE_STUNNED); + me->MonsterTextEmote("Artruis is shielded. You must choose your side quickly to break his spell.", 0, true); + SummonsAction(ACTION_BIND_MINIONS); + events.PopEvent(); + break; + } + events.RepeatEvent(1000); + break; + case EVENT_ARTRUIS_TALK1: + me->MonsterYell("I have weathered a hundred years of war and suffering. Do you truly think it wise to pit your mortal bodies against a being that cannot die? I'd venture you have more to lose.", LANG_UNIVERSAL, 0); + events.PopEvent(); + events.RescheduleEvent(EVENT_ARTRUIS_TALK2, 10000); + break; + case EVENT_ARTRUIS_TALK2: + me->MonsterYell("Even shattered into countless pieces, the crystals all around weaken me... perhaps i should not have underestimated the titans so...", LANG_UNIVERSAL, 0); + events.PopEvent(); + break; + case EVENT_ARTRUIS_TALK3: + me->MonsterYell("Arthas once mustered strength... of the very same sort... perhaps he is the path that you will follow.", LANG_UNIVERSAL, 0); + events.PopEvent(); + break; + case EVENT_CAST_FROST_BOLT: + me->CastSpell(me->GetVictim(), SPELL_ARTRUIS_FROSTBOLT, false); + events.RepeatEvent(4000); + break; + case EVENT_CAST_ICE_LANCE: + me->CastSpell(me->GetVictim(), SPELL_ARTRUIS_ICE_LANCE, false); + events.RepeatEvent(8500); + break; + case EVENT_CAST_FROST_NOVA: + me->CastSpell(me, SPELL_ARTRUIS_FROST_NOVA, false); + events.RepeatEvent(15000); + break; + case EVENT_CAST_ICY_VEINS: + me->CastSpell(me, SPELL_ARTRUIS_ICY_VEINS, false); + events.RepeatEvent(30000); + break; + } } }; @@ -304,151 +304,151 @@ public: CreatureAI *GetAI(Creature *pCreature) const { - return new npc_still_at_it_triggerAI(pCreature); + return new npc_still_at_it_triggerAI(pCreature); } - struct npc_still_at_it_triggerAI : public NullCreatureAI - { - bool running; - bool success; - uint64 playerGUID; - uint64 thunderbrewGUID; - int32 tensecstimer; - int32 timer; - uint8 stepcount; - uint8 currentstep; - uint8 expectedaction; - uint8 playeraction; + struct npc_still_at_it_triggerAI : public NullCreatureAI + { + bool running; + bool success; + uint64 playerGUID; + uint64 thunderbrewGUID; + int32 tensecstimer; + int32 timer; + uint8 stepcount; + uint8 currentstep; + uint8 expectedaction; + uint8 playeraction; - npc_still_at_it_triggerAI(Creature* pCreature) : NullCreatureAI(pCreature) {} - - void Reset() - { - running = false; - success = false; - playerGUID = 0; - thunderbrewGUID; - tensecstimer = 0; - timer = 0; - stepcount = 0; - currentstep = 0; - expectedaction = 0; - playeraction = 0; - } + npc_still_at_it_triggerAI(Creature* pCreature) : NullCreatureAI(pCreature) {} + + void Reset() + { + running = false; + success = false; + playerGUID = 0; + thunderbrewGUID; + tensecstimer = 0; + timer = 0; + stepcount = 0; + currentstep = 0; + expectedaction = 0; + playeraction = 0; + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - damage = 0; - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + damage = 0; + } - void Say(const char* text) - { - if (Creature* th = ObjectAccessor::GetCreature(*me, thunderbrewGUID)) - th->MonsterSay(text, LANG_UNIVERSAL, 0); - else - Reset(); - } + void Say(const char* text) + { + if (Creature* th = ObjectAccessor::GetCreature(*me, thunderbrewGUID)) + th->MonsterSay(text, LANG_UNIVERSAL, 0); + else + Reset(); + } - void Start() - { - timer = 5000; - running = true; - stepcount = urand(5,10); - Say(MCM_TEXT_START); - } + void Start() + { + timer = 5000; + running = true; + stepcount = urand(5,10); + Say(MCM_TEXT_START); + } - void CheckAction(uint8 a, uint64 guid) - { - if (guid != playerGUID) - return; + void CheckAction(uint8 a, uint64 guid) + { + if (guid != playerGUID) + return; - if (a == expectedaction) - { - currentstep++; - uint8 s = urand(0,2); - - if (Creature* th = ObjectAccessor::GetCreature(*me, thunderbrewGUID)) - th->HandleEmoteCommand(EMOTE_ONESHOT_CHEER_NO_SHEATHE); + if (a == expectedaction) + { + currentstep++; + uint8 s = urand(0,2); + + if (Creature* th = ObjectAccessor::GetCreature(*me, thunderbrewGUID)) + th->HandleEmoteCommand(EMOTE_ONESHOT_CHEER_NO_SHEATHE); - switch (s) - { - case 0: Say(MCM_TEXT_CORRECT1); break; - case 1: Say(MCM_TEXT_CORRECT2); break; - default:Say(MCM_TEXT_CORRECT3); break; - } + switch (s) + { + case 0: Say(MCM_TEXT_CORRECT1); break; + case 1: Say(MCM_TEXT_CORRECT2); break; + default:Say(MCM_TEXT_CORRECT3); break; + } - if (currentstep >= stepcount) - { - Say(MCM_TEXT_SUCCESS1); - success = true; - timer = 3000; - } - else - { - expectedaction = 0; - timer = 3000; - } - } - else - { - Say(MCM_TEXT_FAILED); - Reset(); - } - } + if (currentstep >= stepcount) + { + Say(MCM_TEXT_SUCCESS1); + success = true; + timer = 3000; + } + else + { + expectedaction = 0; + timer = 3000; + } + } + else + { + Say(MCM_TEXT_FAILED); + Reset(); + } + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) // for banana(51932), orange(51931), papaya(51933) - { - if (running) - { - uint8 a = 0; - switch (spellInfo->Id) - { - case 51931: a = 4; break; - case 51932: a = 3; break; - case 51933: a = 5; break; - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) // for banana(51932), orange(51931), papaya(51933) + { + if (running) + { + uint8 a = 0; + switch (spellInfo->Id) + { + case 51931: a = 4; break; + case 51932: a = 3; break; + case 51933: a = 5; break; + } - CheckAction(a, caster->GetGUID()); - } - } + CheckAction(a, caster->GetGUID()); + } + } - void UpdateAI(uint32 diff) - { - if (running) - { - if (timer) - { - timer -= diff; - if( timer < 0 ) - timer = 0; - } - else if ( success) - { - Say(MCM_TEXT_SUCCESS2); - me->SummonGameObject(190643, 5546.55f, 5768.0f, -78.03f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 60000); - Reset(); - } - else if (expectedaction != 0) // didn't make it in 10 seconds - { - Say(MCM_TEXT_FAILED); - Reset(); - } - else // it's time to rand next move - { - expectedaction = urand(1,5); - switch (expectedaction) - { - case 1: Say(MCM_TEXT_PRESSURE); break; - case 2: Say(MCM_TEXT_HEAT); break; - case 3: Say(MCM_TEXT_BANANA); break; - case 4: Say(MCM_TEXT_ORANGE); break; - case 5: Say(MCM_TEXT_PAPAYA); break; - } - timer = 10000; - } - } - } - }; + void UpdateAI(uint32 diff) + { + if (running) + { + if (timer) + { + timer -= diff; + if( timer < 0 ) + timer = 0; + } + else if ( success) + { + Say(MCM_TEXT_SUCCESS2); + me->SummonGameObject(190643, 5546.55f, 5768.0f, -78.03f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 60000); + Reset(); + } + else if (expectedaction != 0) // didn't make it in 10 seconds + { + Say(MCM_TEXT_FAILED); + Reset(); + } + else // it's time to rand next move + { + expectedaction = urand(1,5); + switch (expectedaction) + { + case 1: Say(MCM_TEXT_PRESSURE); break; + case 2: Say(MCM_TEXT_HEAT); break; + case 3: Say(MCM_TEXT_BANANA); break; + case 4: Say(MCM_TEXT_ORANGE); break; + case 5: Say(MCM_TEXT_PAPAYA); break; + } + timer = 10000; + } + } + } + }; }; class npc_mcmanus : public CreatureScript @@ -456,41 +456,41 @@ class npc_mcmanus : public CreatureScript public: npc_mcmanus() : CreatureScript("npc_mcmanus") {} - bool OnGossipHello(Player* player, Creature* creature) - { - if (!player) - return true; + bool OnGossipHello(Player* player, Creature* creature) + { + if (!player) + return true; - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + if (creature->IsQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); - if (player->GetQuestStatus(12644) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I'm ready to start the distillation, uh, Tipsy.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (player->GetQuestStatus(12644) == QUEST_STATUS_INCOMPLETE) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I'm ready to start the distillation, uh, Tipsy.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) - { - if (!player) - return true; + bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + { + if (!player) + return true; - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - Creature* trigger = creature->FindNearestCreature(NPC_WANTS_BANANAS, 20.0f, true); - if (trigger && trigger->AI()) - if (!CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->running) - { - CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->playerGUID = player->GetGUID(); - CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->thunderbrewGUID = creature->GetGUID(); - CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->Start(); - } - } + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + Creature* trigger = creature->FindNearestCreature(NPC_WANTS_BANANAS, 20.0f, true); + if (trigger && trigger->AI()) + if (!CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->running) + { + CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->playerGUID = player->GetGUID(); + CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->thunderbrewGUID = creature->GetGUID(); + CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->Start(); + } + } - player->CLOSE_GOSSIP_MENU(); - return true; - } + player->CLOSE_GOSSIP_MENU(); + return true; + } }; class go_pressure_valve : public GameObjectScript @@ -498,18 +498,18 @@ class go_pressure_valve : public GameObjectScript public: go_pressure_valve() : GameObjectScript("go_pressure_valve") { } - bool OnGossipHello(Player* player, GameObject* go) - { - if (!player) - return true; + bool OnGossipHello(Player* player, GameObject* go) + { + if (!player) + return true; - Creature* trigger = go->FindNearestCreature(NPC_WANTS_BANANAS, 20.0f, true); - if (trigger && trigger->AI()) - if (CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->running) - CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->CheckAction(1, player->GetGUID()); + Creature* trigger = go->FindNearestCreature(NPC_WANTS_BANANAS, 20.0f, true); + if (trigger && trigger->AI()) + if (CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->running) + CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->CheckAction(1, player->GetGUID()); - return false; - } + return false; + } }; class go_brazier : public GameObjectScript @@ -517,54 +517,54 @@ class go_brazier : public GameObjectScript public: go_brazier() : GameObjectScript("go_brazier") { } - bool OnGossipHello(Player* player, GameObject* go) - { - if (!player) - return true; + bool OnGossipHello(Player* player, GameObject* go) + { + if (!player) + return true; - Creature* trigger = go->FindNearestCreature(NPC_WANTS_BANANAS, 20.0f, true); - if (trigger && trigger->AI()) - if (CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->running) - CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->CheckAction(2, player->GetGUID()); + Creature* trigger = go->FindNearestCreature(NPC_WANTS_BANANAS, 20.0f, true); + if (trigger && trigger->AI()) + if (CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->running) + CAST_AI(npc_still_at_it_trigger::npc_still_at_it_triggerAI, trigger->AI())->CheckAction(2, player->GetGUID()); - return false; - } + return false; + } }; enum Q12915MendingFences { - SPELL_SUMMON_EARTHEN = 55528 + SPELL_SUMMON_EARTHEN = 55528 }; class spell_q12915_mending_fences : public SpellScriptLoader { - public: - spell_q12915_mending_fences() : SpellScriptLoader("spell_q12915_mending_fences") { } + public: + spell_q12915_mending_fences() : SpellScriptLoader("spell_q12915_mending_fences") { } - class spell_q12915_mending_fences_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q12915_mending_fences_SpellScript); + class spell_q12915_mending_fences_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12915_mending_fences_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* target = GetHitUnit(); - if (!target) - return; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* target = GetHitUnit(); + if (!target) + return; - for (uint8 i = 0; i < 4; ++i) - GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_EARTHEN, true); - } + for (uint8 i = 0; i < 4; ++i) + GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_EARTHEN, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_q12915_mending_fences_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12915_mending_fences_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_q12915_mending_fences_SpellScript(); - }; + SpellScript* GetSpellScript() const + { + return new spell_q12915_mending_fences_SpellScript(); + }; }; @@ -624,7 +624,7 @@ public: creature->AI()->Talk(SAY_TEXTID_VEKJIK1, player); player->AreaExploredOrEventHappens(QUEST_MAKING_PEACE); //creature->CastSpell(player, SPELL_FREANZYHEARTS_FURY, true); - player->KnockbackFrom(creature->GetPositionX(), creature->GetPositionY(), 30.0f, 18.0f); + player->KnockbackFrom(creature->GetPositionX(), creature->GetPositionY(), 30.0f, 18.0f); break; } @@ -1368,28 +1368,28 @@ public: struct npc_vics_flying_machineAI : public VehicleAI { npc_vics_flying_machineAI(Creature* creature) : VehicleAI(creature) - { - pointId = 0; - } + { + pointId = 0; + } - uint8 pointId; + uint8 pointId; void PassengerBoarded(Unit* passenger, int8 /*seatId*/, bool apply) { if (apply && passenger->GetTypeId() == TYPEID_PLAYER) - { - Movement::PointsArray pathPoints; - pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + { + Movement::PointsArray pathPoints; + pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - WaypointPath const* i_path = sWaypointMgr->GetPath(NPC_PLANE); - for (uint8 i = 0; i < i_path->size(); ++i) - { - WaypointData const* node = i_path->at(i); - pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); - } + WaypointPath const* i_path = sWaypointMgr->GetPath(NPC_PLANE); + for (uint8 i = 0; i < i_path->size(); ++i) + { + WaypointData const* node = i_path->at(i); + pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); + } me->GetMotionMaster()->MoveSplinePath(&pathPoints); - } + } } void MovementInform(uint32 type, uint32 id) @@ -1398,7 +1398,7 @@ public: return; if (Vehicle* veh = me->GetVehicleKit()) - if (Unit* pilot = veh->GetPassenger(0)) + if (Unit* pilot = veh->GetPassenger(0)) switch (pointId) { case 5: @@ -1425,10 +1425,10 @@ public: case 25: Talk(PLANE_EMOTE); DoCast(AURA_ENGINE); - me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT); + me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT); break; } - pointId++; + pointId++; } void SpellHit(Unit* /*caster*/, SpellInfo const* spell) @@ -1439,7 +1439,7 @@ public: if (passenger && passenger->GetTypeId() == TYPEID_PLAYER) passenger->CastSpell(passenger, SPELL_CREDIT, true); - me->DespawnOrUnsummon(); + me->DespawnOrUnsummon(); } } }; @@ -1503,16 +1503,16 @@ public: void AddSC_sholazar_basin() { - // Ours - new spell_q12726_song_of_wind_and_water(); - new npc_artruis_the_hearthless(); - new npc_still_at_it_trigger(); - new npc_mcmanus(); - new go_pressure_valve(); - new go_brazier(); - new spell_q12915_mending_fences(); + // Ours + new spell_q12726_song_of_wind_and_water(); + new npc_artruis_the_hearthless(); + new npc_still_at_it_trigger(); + new npc_mcmanus(); + new go_pressure_valve(); + new go_brazier(); + new spell_q12915_mending_fences(); - // Theirs + // Theirs new npc_vekjik(); new npc_avatar_of_freya(); new npc_bushwhacker(); diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 02d8c7144..bf6c247e4 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -30,8 +30,8 @@ // Ours enum qSniffing { - SPELL_SUMMON_PURSUERS_PERIODIC = 54993, - SPELL_SNIFFING_CREDIT = 55477, + SPELL_SUMMON_PURSUERS_PERIODIC = 54993, + SPELL_SNIFFING_CREDIT = 55477, }; class npc_frosthound : public CreatureScript @@ -39,7 +39,7 @@ class npc_frosthound : public CreatureScript public: npc_frosthound() : CreatureScript("npc_frosthound") { } - struct npc_frosthoundAI : public npc_escortAI + struct npc_frosthoundAI : public npc_escortAI { npc_frosthoundAI(Creature* creature) : npc_escortAI(creature) {} @@ -52,11 +52,11 @@ public: if (who->GetTypeId() == TYPEID_PLAYER) { if (apply) - { - me->setFaction(who->getFaction()); - me->CastSpell(me, SPELL_SUMMON_PURSUERS_PERIODIC, true); + { + me->setFaction(who->getFaction()); + me->CastSpell(me, SPELL_SUMMON_PURSUERS_PERIODIC, true); Start(false, true, who->GetGUID()); - } + } } } @@ -76,7 +76,7 @@ public: return; } - void WaypointReached(uint32 waypointId) + void WaypointReached(uint32 waypointId) { Player* player = GetPlayerForEscort(); if (!player) @@ -84,26 +84,26 @@ public: switch (waypointId) { - case 0: - me->MonsterTextEmote("You've been seen! Use the net and Freezing elixir to keep the dwarves away!", 0, true); - break; + case 0: + me->MonsterTextEmote("You've been seen! Use the net and Freezing elixir to keep the dwarves away!", 0, true); + break; case 19: - me->MonsterTextEmote("The frosthound has located the thief's hiding place. Confront him!", 0, true); - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - summoner->ToPlayer()->KilledMonsterCredit(29677, 0); + me->MonsterTextEmote("The frosthound has located the thief's hiding place. Confront him!", 0, true); + if (Unit* summoner = me->ToTempSummon()->GetSummoner()) + summoner->ToPlayer()->KilledMonsterCredit(29677, 0); break; } } - void JustSummoned(Creature* cr) - { - cr->ToTempSummon()->SetTempSummonType(TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT); - cr->ToTempSummon()->InitStats(20000); - if (urand(0,1)) - cr->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f); - else if (cr->AI()) - cr->AI()->AttackStart(me); - } + void JustSummoned(Creature* cr) + { + cr->ToTempSummon()->SetTempSummonType(TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT); + cr->ToTempSummon()->InitStats(20000); + if (urand(0,1)) + cr->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f); + else if (cr->AI()) + cr->AI()->AttackStart(me); + } }; CreatureAI* GetAI(Creature* creature) const @@ -114,10 +114,10 @@ public: enum eIronWatcher { - SPELL_THUNDERING_STOMP = 60925, - SPELL_STORM_HAMMER = 56448, - SPELL_SHATTERED_EYES = 57290, - SPELL_STORM_HAMMER_DUMMY = 60930, + SPELL_THUNDERING_STOMP = 60925, + SPELL_STORM_HAMMER = 56448, + SPELL_SHATTERED_EYES = 57290, + SPELL_STORM_HAMMER_DUMMY = 60930, }; class npc_iron_watcher : public CreatureScript @@ -125,74 +125,74 @@ class npc_iron_watcher : public CreatureScript public: npc_iron_watcher() : CreatureScript("npc_iron_watcher") { } - struct npc_iron_watcherAI : public ScriptedAI + struct npc_iron_watcherAI : public ScriptedAI { npc_iron_watcherAI(Creature* creature) : ScriptedAI(creature) {} - uint32 spellTimer; - uint32 hpTimer; - bool charging; + uint32 spellTimer; + uint32 hpTimer; + bool charging; - void Reset() - { - spellTimer = 0; - hpTimer = 0; - charging = false; - me->SetControlled(false, UNIT_STATE_STUNNED); - } + void Reset() + { + spellTimer = 0; + hpTimer = 0; + charging = false; + me->SetControlled(false, UNIT_STATE_STUNNED); + } - void MovementInform(uint32 type, uint32 pointId) - { - if (type == POINT_MOTION_TYPE) - me->SetControlled(true, UNIT_STATE_STUNNED); - } + void MovementInform(uint32 type, uint32 pointId) + { + if (type == POINT_MOTION_TYPE) + me->SetControlled(true, UNIT_STATE_STUNNED); + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_STORM_HAMMER) - { - me->CastSpell(caster, SPELL_STORM_HAMMER_DUMMY, true); - if (charging) - { - me->RemoveAllAurasExceptType(SPELL_AURA_MECHANIC_IMMUNITY); - Talk(1); - caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(), 0); - me->DespawnOrUnsummon(8000); - me->GetMotionMaster()->MoveJump(8721.94f, -1955, 963, 70.0f, 30.0f); - } - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_STORM_HAMMER) + { + me->CastSpell(caster, SPELL_STORM_HAMMER_DUMMY, true); + if (charging) + { + me->RemoveAllAurasExceptType(SPELL_AURA_MECHANIC_IMMUNITY); + Talk(1); + caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(), 0); + me->DespawnOrUnsummon(8000); + me->GetMotionMaster()->MoveJump(8721.94f, -1955, 963, 70.0f, 30.0f); + } + } + } void UpdateAI(uint32 diff) { - if (charging) - return; + if (charging) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - spellTimer += diff; - hpTimer += diff; - if (spellTimer >= 10000) - { - me->CastSpell(me, SPELL_THUNDERING_STOMP, false); - spellTimer = 0; - } - if (hpTimer >= 1000) - { - if (me->HealthBelowPct(40)) - { - Talk(0); - me->RemoveAllAuras(); - me->CastSpell(me, SPELL_SHATTERED_EYES, true); - me->ApplySpellImmune(SPELL_SHATTERED_EYES, IMMUNITY_MECHANIC, MECHANIC_STUN, false); - me->GetMotionMaster()->MoveCharge(8548, -1956, 1467.8f); - charging = true; - } - hpTimer = 0; - } + spellTimer += diff; + hpTimer += diff; + if (spellTimer >= 10000) + { + me->CastSpell(me, SPELL_THUNDERING_STOMP, false); + spellTimer = 0; + } + if (hpTimer >= 1000) + { + if (me->HealthBelowPct(40)) + { + Talk(0); + me->RemoveAllAuras(); + me->CastSpell(me, SPELL_SHATTERED_EYES, true); + me->ApplySpellImmune(SPELL_SHATTERED_EYES, IMMUNITY_MECHANIC, MECHANIC_STUN, false); + me->GetMotionMaster()->MoveCharge(8548, -1956, 1467.8f); + charging = true; + } + hpTimer = 0; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; @@ -204,13 +204,13 @@ public: enum eTimeLost { - NPC_TIME_LOST_PROTO_DRAKE = 32491, - NPC_VYRAGOSA = 32630, + NPC_TIME_LOST_PROTO_DRAKE = 32491, + NPC_VYRAGOSA = 32630, - SPELL_TIME_SHIFT = 61084, - SPELL_TIME_LAPSE = 51020, - SPELL_FROST_BREATH = 47425, - SPELL_FROST_CLEAVE = 51857, + SPELL_TIME_SHIFT = 61084, + SPELL_TIME_LAPSE = 51020, + SPELL_FROST_BREATH = 47425, + SPELL_FROST_CLEAVE = 51857, }; class npc_time_lost_proto_drake : public CreatureScript @@ -218,95 +218,95 @@ class npc_time_lost_proto_drake : public CreatureScript public: npc_time_lost_proto_drake() : CreatureScript("npc_time_lost_proto_drake") { } - struct npc_time_lost_proto_drakeAI : public npc_escortAI + struct npc_time_lost_proto_drakeAI : public npc_escortAI { npc_time_lost_proto_drakeAI(Creature* creature) : npc_escortAI(creature) - { - rollPath = false; - setVisible = false; - me->setActive(true); - me->SetVisible(false); - } + { + rollPath = false; + setVisible = false; + me->setActive(true); + me->SetVisible(false); + } - EventMap events; - bool rollPath; - bool setVisible; + EventMap events; + bool rollPath; + bool setVisible; - void Reset() - { - npc_escortAI::Reset(); - if (me->HasUnitState(UNIT_STATE_EVADE)) - return; - me->SetVisible(false); // pussywizard: zeby nie dostawali info o npc w miejscu spawna (kampienie z addonem npc scan) - rollPath = true; - } + void Reset() + { + npc_escortAI::Reset(); + if (me->HasUnitState(UNIT_STATE_EVADE)) + return; + me->SetVisible(false); // pussywizard: zeby nie dostawali info o npc w miejscu spawna (kampienie z addonem npc scan) + rollPath = true; + } - void RollPath() - { - me->SetEntry(NPC_TIME_LOST_PROTO_DRAKE); - Start(true, true, 0, 0, false, true, true); - SetNextWaypoint(urand(0, 250), true); - me->UpdateEntry(roll_chance_i(25) ? NPC_TIME_LOST_PROTO_DRAKE : NPC_VYRAGOSA, 0, false); - } + void RollPath() + { + me->SetEntry(NPC_TIME_LOST_PROTO_DRAKE); + Start(true, true, 0, 0, false, true, true); + SetNextWaypoint(urand(0, 250), true); + me->UpdateEntry(roll_chance_i(25) ? NPC_TIME_LOST_PROTO_DRAKE : NPC_VYRAGOSA, 0, false); + } - void WaypointReached(uint32 pointId) { } + void WaypointReached(uint32 pointId) { } - void EnterCombat(Unit*) - { - events.Reset(); - if (me->GetEntry() == NPC_TIME_LOST_PROTO_DRAKE) - { - events.ScheduleEvent(SPELL_TIME_SHIFT, 10000); - events.ScheduleEvent(SPELL_TIME_LAPSE, 5000); - } - else - { - events.ScheduleEvent(SPELL_FROST_BREATH, 8000); - events.ScheduleEvent(SPELL_FROST_CLEAVE, 5000); - } - } + void EnterCombat(Unit*) + { + events.Reset(); + if (me->GetEntry() == NPC_TIME_LOST_PROTO_DRAKE) + { + events.ScheduleEvent(SPELL_TIME_SHIFT, 10000); + events.ScheduleEvent(SPELL_TIME_LAPSE, 5000); + } + else + { + events.ScheduleEvent(SPELL_FROST_BREATH, 8000); + events.ScheduleEvent(SPELL_FROST_CLEAVE, 5000); + } + } void UpdateEscortAI(uint32 diff) - { - if (rollPath) - { - RollPath(); - rollPath = false; - setVisible = true; - return; - } + { + if (rollPath) + { + RollPath(); + rollPath = false; + setVisible = true; + return; + } - if (setVisible) - { - me->SetVisible(true); - setVisible = false; - } + if (setVisible) + { + me->SetVisible(true); + setVisible = false; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - switch (events.GetEvent()) - { - case SPELL_TIME_SHIFT: - me->CastSpell(me, SPELL_TIME_SHIFT, false); - events.RepeatEvent(18000); - break; - case SPELL_TIME_LAPSE: - me->CastSpell(me->GetVictim(), SPELL_TIME_LAPSE, false); - events.RepeatEvent(12000); - break; - case SPELL_FROST_BREATH: - me->CastSpell(me->GetVictim(), SPELL_FROST_BREATH, false); - events.RepeatEvent(12000); - break; - case SPELL_FROST_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_FROST_CLEAVE, false); - events.RepeatEvent(8000); - break; - } + events.Update(diff); + switch (events.GetEvent()) + { + case SPELL_TIME_SHIFT: + me->CastSpell(me, SPELL_TIME_SHIFT, false); + events.RepeatEvent(18000); + break; + case SPELL_TIME_LAPSE: + me->CastSpell(me->GetVictim(), SPELL_TIME_LAPSE, false); + events.RepeatEvent(12000); + break; + case SPELL_FROST_BREATH: + me->CastSpell(me->GetVictim(), SPELL_FROST_BREATH, false); + events.RepeatEvent(12000); + break; + case SPELL_FROST_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_FROST_CLEAVE, false); + events.RepeatEvent(8000); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; @@ -318,17 +318,17 @@ public: enum eWildWyrm { - SPELL_FIGHT_WYRM_BASE = 56673, - SPELL_FIGHT_WYRM_NEXT = 60863, - SPELL_SPEAR_OF_HODIR = 56671, - SPELL_DODGE_CLAWS = 56704, - SPELL_WYRM_GRIP = 56689, - SPELL_GRAB_ON = 60533, - SPELL_THRUST_SPEAR = 56690, - SPELL_MIGHTY_SPEAR_THRUST = 60586, - SPELL_FATAL_STRIKE = 60587, - SPELL_PRY_JAWS_OPEN = 56706, - SPELL_JAWS_OF_DEATH = 56692, + SPELL_FIGHT_WYRM_BASE = 56673, + SPELL_FIGHT_WYRM_NEXT = 60863, + SPELL_SPEAR_OF_HODIR = 56671, + SPELL_DODGE_CLAWS = 56704, + SPELL_WYRM_GRIP = 56689, + SPELL_GRAB_ON = 60533, + SPELL_THRUST_SPEAR = 56690, + SPELL_MIGHTY_SPEAR_THRUST = 60586, + SPELL_FATAL_STRIKE = 60587, + SPELL_PRY_JAWS_OPEN = 56706, + SPELL_JAWS_OF_DEATH = 56692, }; class npc_wild_wyrm : public CreatureScript @@ -336,246 +336,246 @@ class npc_wild_wyrm : public CreatureScript public: npc_wild_wyrm() : CreatureScript("npc_wild_wyrm") { } - struct npc_wild_wyrmAI : public ScriptedAI + struct npc_wild_wyrmAI : public ScriptedAI { npc_wild_wyrmAI(Creature* creature) : ScriptedAI(creature) {} - uint64 playerGUID; - uint32 checkTimer; - uint32 announceAttackTimer; - uint32 attackTimer; - bool setCharm; - bool switching; - bool startPath; + uint64 playerGUID; + uint32 checkTimer; + uint32 announceAttackTimer; + uint32 attackTimer; + bool setCharm; + bool switching; + bool startPath; - void EnterEvadeMode() - { - if (switching || me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) - return; - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + if (switching || me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) + return; + ScriptedAI::EnterEvadeMode(); + } - void Reset() - { - me->SetRegeneratingHealth(true); - me->SetSpeed(MOVE_RUN, 1.14f, true); // ZOMG! - setCharm = false; - switching = false; - startPath = false; - checkTimer = 0; - playerGUID = 0; - attackTimer = 0; - announceAttackTimer = 0; - me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - } + void Reset() + { + me->SetRegeneratingHealth(true); + me->SetSpeed(MOVE_RUN, 1.14f, true); // ZOMG! + setCharm = false; + switching = false; + startPath = false; + checkTimer = 0; + playerGUID = 0; + attackTimer = 0; + announceAttackTimer = 0; + me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + } - void PassengerBoarded(Unit*, int8, bool apply) - { - if (!apply && me->IsAlive() && me->HasAura(SPELL_WYRM_GRIP)) - me->RemoveAurasDueToSpell(SPELL_WYRM_GRIP); - } + void PassengerBoarded(Unit*, int8, bool apply) + { + if (!apply && me->IsAlive() && me->HasAura(SPELL_WYRM_GRIP)) + me->RemoveAurasDueToSpell(SPELL_WYRM_GRIP); + } - void MovementInform(uint32 type, uint32 pointId) - { - if (type == POINT_MOTION_TYPE && pointId == 1 && !me->GetCharmerGUID()) - { - if (Player* player = GetValidPlayer()) - { - checkTimer = 1; - me->SetFullHealth(); - player->CastSpell(me, SPELL_FIGHT_WYRM_BASE, true); - me->CastSpell(me, SPELL_WYRM_GRIP, true); - me->SetRegeneratingHealth(false); - } - } - else if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized()) - startPath = true; - else if (type == EFFECT_MOTION_TYPE && pointId == me->GetEntry()) - Unit::Kill(me, me); - } + void MovementInform(uint32 type, uint32 pointId) + { + if (type == POINT_MOTION_TYPE && pointId == 1 && !me->GetCharmerGUID()) + { + if (Player* player = GetValidPlayer()) + { + checkTimer = 1; + me->SetFullHealth(); + player->CastSpell(me, SPELL_FIGHT_WYRM_BASE, true); + me->CastSpell(me, SPELL_WYRM_GRIP, true); + me->SetRegeneratingHealth(false); + } + } + else if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized()) + startPath = true; + else if (type == EFFECT_MOTION_TYPE && pointId == me->GetEntry()) + Unit::Kill(me, me); + } - void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (who != me) - { - damage = 0; - if (!GetValidPlayer()) - setCharm = true; // will enter evade on next update - } - } + void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (who != me) + { + damage = 0; + if (!GetValidPlayer()) + setCharm = true; // will enter evade on next update + } + } - void AttackStart(Unit*) { } - void MoveInLineOfSight(Unit* who) { } + void AttackStart(Unit*) { } + void MoveInLineOfSight(Unit* who) { } - void OnCharmed(bool apply) - { - if (apply) - setCharm = true; - } + void OnCharmed(bool apply) + { + if (apply) + setCharm = true; + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (!playerGUID && spellInfo->Id == SPELL_SPEAR_OF_HODIR) - { - me->GetMotionMaster()->MovePoint(1, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ()+12.0f); - playerGUID = caster->GetGUID(); - } - else if (spellInfo->Id == SPELL_GRAB_ON) - { - if (Aura* aura = me->GetAura(SPELL_WYRM_GRIP)) - aura->ModStackAmount(10); - } - else if (spellInfo->Id == SPELL_THRUST_SPEAR) - { - if (Aura* aura = me->GetAura(SPELL_WYRM_GRIP)) - aura->ModStackAmount(-5); - } - else if (spellInfo->Id == SPELL_MIGHTY_SPEAR_THRUST) - { - if (Aura* aura = me->GetAura(SPELL_WYRM_GRIP)) - aura->ModStackAmount(-15); - } - else if (spellInfo->Id == SPELL_FATAL_STRIKE) - { - if (roll_chance_i(me->GetAuraCount(SPELL_PRY_JAWS_OPEN)*10)) - { - if (Player* player = GetValidPlayer()) - { - player->KilledMonsterCredit(30415, 0); - player->RemoveAurasDueToSpell(SPELL_JAWS_OF_DEATH); - } - me->SetStandState(UNIT_STAND_STATE_DEAD); - me->GetMotionMaster()->MoveFall(me->GetEntry()); - } - else - Talk(2); + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (!playerGUID && spellInfo->Id == SPELL_SPEAR_OF_HODIR) + { + me->GetMotionMaster()->MovePoint(1, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ()+12.0f); + playerGUID = caster->GetGUID(); + } + else if (spellInfo->Id == SPELL_GRAB_ON) + { + if (Aura* aura = me->GetAura(SPELL_WYRM_GRIP)) + aura->ModStackAmount(10); + } + else if (spellInfo->Id == SPELL_THRUST_SPEAR) + { + if (Aura* aura = me->GetAura(SPELL_WYRM_GRIP)) + aura->ModStackAmount(-5); + } + else if (spellInfo->Id == SPELL_MIGHTY_SPEAR_THRUST) + { + if (Aura* aura = me->GetAura(SPELL_WYRM_GRIP)) + aura->ModStackAmount(-15); + } + else if (spellInfo->Id == SPELL_FATAL_STRIKE) + { + if (roll_chance_i(me->GetAuraCount(SPELL_PRY_JAWS_OPEN)*10)) + { + if (Player* player = GetValidPlayer()) + { + player->KilledMonsterCredit(30415, 0); + player->RemoveAurasDueToSpell(SPELL_JAWS_OF_DEATH); + } + me->SetStandState(UNIT_STAND_STATE_DEAD); + me->GetMotionMaster()->MoveFall(me->GetEntry()); + } + else + Talk(2); - } - } + } + } - Player* GetValidPlayer() - { - Player* charmer = ObjectAccessor::GetPlayer(*me, playerGUID); - if (charmer && charmer->IsAlive() && me->GetDistance(charmer) < 20.0f) - return charmer; - return NULL; - } + Player* GetValidPlayer() + { + Player* charmer = ObjectAccessor::GetPlayer(*me, playerGUID); + if (charmer && charmer->IsAlive() && me->GetDistance(charmer) < 20.0f) + return charmer; + return NULL; + } void UpdateAI(uint32 diff) { - if (startPath) - { - startPath = false; - Movement::PointsArray pathPoints; - pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + if (startPath) + { + startPath = false; + Movement::PointsArray pathPoints; + pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath()); - for (uint8 i = 0; i < i_path->size(); ++i) - { - WaypointData const* node = i_path->at(i); - pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); - } + WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath()); + for (uint8 i = 0; i < i_path->size(); ++i) + { + WaypointData const* node = i_path->at(i); + pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); + } - me->GetMotionMaster()->MoveSplinePath(&pathPoints); - } - if (setCharm) - { - setCharm = false; - - if (Player* charmer = GetValidPlayer()) - { - me->setFaction(16); - charmer->SetClientControl(me, 0, true); + me->GetMotionMaster()->MoveSplinePath(&pathPoints); + } + if (setCharm) + { + setCharm = false; + + if (Player* charmer = GetValidPlayer()) + { + me->setFaction(16); + charmer->SetClientControl(me, 0, true); - me->SetSpeed(MOVE_RUN, 2.0f, true); - startPath = true; - } - else - { - me->RemoveAllAuras(); - EnterEvadeMode(); - } - return; - } + me->SetSpeed(MOVE_RUN, 2.0f, true); + startPath = true; + } + else + { + me->RemoveAllAuras(); + EnterEvadeMode(); + } + return; + } - if (!checkTimer) - return; + if (!checkTimer) + return; - if (checkTimer < 10000) - { - checkTimer += diff; - if (checkTimer >= 2000) - { - checkTimer = 1; - if (me->HealthBelowPct(25)) - if (Player* player = GetValidPlayer()) - { - Talk(3); - switching = true; - me->RemoveAllAuras(); - me->CastSpell(me, SPELL_JAWS_OF_DEATH, true); - player->CastSpell(me, SPELL_FIGHT_WYRM_NEXT, true); - checkTimer = 10000; - return; - } - else - { - me->RemoveAllAuras(); - EnterEvadeMode(); - return; - } - } - } - else if (checkTimer < 20000) - { - checkTimer += diff; - if (checkTimer >= 13000) - { - switching = false; - checkTimer = 20000; - } - } - else if (checkTimer < 30000) - { - checkTimer += diff; - if (checkTimer >= 22000) - { - checkTimer = 20000; - Player* player = GetValidPlayer(); - if (!player) - { - me->RemoveAllAuras(); - EnterEvadeMode(); - } - } - return; - } + if (checkTimer < 10000) + { + checkTimer += diff; + if (checkTimer >= 2000) + { + checkTimer = 1; + if (me->HealthBelowPct(25)) + if (Player* player = GetValidPlayer()) + { + Talk(3); + switching = true; + me->RemoveAllAuras(); + me->CastSpell(me, SPELL_JAWS_OF_DEATH, true); + player->CastSpell(me, SPELL_FIGHT_WYRM_NEXT, true); + checkTimer = 10000; + return; + } + else + { + me->RemoveAllAuras(); + EnterEvadeMode(); + return; + } + } + } + else if (checkTimer < 20000) + { + checkTimer += diff; + if (checkTimer >= 13000) + { + switching = false; + checkTimer = 20000; + } + } + else if (checkTimer < 30000) + { + checkTimer += diff; + if (checkTimer >= 22000) + { + checkTimer = 20000; + Player* player = GetValidPlayer(); + if (!player) + { + me->RemoveAllAuras(); + EnterEvadeMode(); + } + } + return; + } - announceAttackTimer += diff; - if (announceAttackTimer >= 7000) - { - announceAttackTimer = urand(0, 3000); - Talk(0); - attackTimer = 1; - } - if (attackTimer) - { - attackTimer += diff; - if (attackTimer > 2000) - { - attackTimer = 0; - Player* player = ObjectAccessor::GetPlayer(*me, playerGUID); - if (player && player->HasAura(SPELL_DODGE_CLAWS)) - Talk(1); - else if (player) - me->AttackerStateUpdate(player); - else - { - me->RemoveAllAuras(); - EnterEvadeMode(); - } - } - } + announceAttackTimer += diff; + if (announceAttackTimer >= 7000) + { + announceAttackTimer = urand(0, 3000); + Talk(0); + attackTimer = 1; + } + if (attackTimer) + { + attackTimer += diff; + if (attackTimer > 2000) + { + attackTimer = 0; + Player* player = ObjectAccessor::GetPlayer(*me, playerGUID); + if (player && player->HasAura(SPELL_DODGE_CLAWS)) + Talk(1); + else if (player) + me->AttackerStateUpdate(player); + else + { + me->RemoveAllAuras(); + EnterEvadeMode(); + } + } + } } }; @@ -596,19 +596,19 @@ class spell_q13003_thursting_hodirs_spear : public SpellScriptLoader void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - ModStackAmount(60); + ModStackAmount(60); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Creature* creature = GetUnitOwner()->ToCreature()) - { - if (!creature->IsInEvadeMode()) - { - creature->RemoveAllAuras(); - creature->AI()->EnterEvadeMode(); - } - } + { + if (!creature->IsInEvadeMode()) + { + creature->RemoveAllAuras(); + creature->AI()->EnterEvadeMode(); + } + } } void HandlePeriodic(AuraEffect const* /* aurEff */) @@ -619,7 +619,7 @@ class spell_q13003_thursting_hodirs_spear : public SpellScriptLoader void Register() { OnEffectPeriodic += AuraEffectPeriodicFn(spell_q13003_thursting_hodirs_spear_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - OnEffectApply += AuraEffectApplyFn(spell_q13003_thursting_hodirs_spear_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_q13003_thursting_hodirs_spear_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); AfterEffectRemove += AuraEffectRemoveFn(spell_q13003_thursting_hodirs_spear_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -632,10 +632,10 @@ class spell_q13003_thursting_hodirs_spear : public SpellScriptLoader enum q13007IronColossus { - SPELL_JORMUNGAR_SUBMERGE = 56504, - SPELL_JORMUNGAR_EMERGE = 56508, - SPELL_JORMUNGAR_SUBMERGE_VISUAL = 56512, - SPELL_COLOSSUS_GROUND_SLAM = 61673 + SPELL_JORMUNGAR_SUBMERGE = 56504, + SPELL_JORMUNGAR_EMERGE = 56508, + SPELL_JORMUNGAR_SUBMERGE_VISUAL = 56512, + SPELL_COLOSSUS_GROUND_SLAM = 61673 }; class spell_q13007_iron_colossus : public SpellScriptLoader @@ -649,36 +649,36 @@ public: void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - Creature* caster = GetCaster()->ToCreature(); - if (!caster) - return; + PreventHitDefaultEffect(effIndex); + Creature* caster = GetCaster()->ToCreature(); + if (!caster) + return; - if (GetSpellInfo()->Id == SPELL_JORMUNGAR_SUBMERGE) - { - caster->CastSpell(caster, SPELL_JORMUNGAR_SUBMERGE_VISUAL, true); - caster->ApplySpellImmune(SPELL_COLOSSUS_GROUND_SLAM, IMMUNITY_ID, SPELL_COLOSSUS_GROUND_SLAM, true); - caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - caster->SetControlled(false, UNIT_STATE_ROOT); - for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) - caster->m_spells[i] = 0; + if (GetSpellInfo()->Id == SPELL_JORMUNGAR_SUBMERGE) + { + caster->CastSpell(caster, SPELL_JORMUNGAR_SUBMERGE_VISUAL, true); + caster->ApplySpellImmune(SPELL_COLOSSUS_GROUND_SLAM, IMMUNITY_ID, SPELL_COLOSSUS_GROUND_SLAM, true); + caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + caster->SetControlled(false, UNIT_STATE_ROOT); + for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) + caster->m_spells[i] = 0; - caster->m_spells[0] = SPELL_JORMUNGAR_EMERGE; - } - else - { - caster->RemoveAurasDueToSpell(SPELL_JORMUNGAR_SUBMERGE_VISUAL); - caster->ApplySpellImmune(SPELL_COLOSSUS_GROUND_SLAM, IMMUNITY_ID, SPELL_COLOSSUS_GROUND_SLAM, false); - caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - caster->SetControlled(true, UNIT_STATE_ROOT); + caster->m_spells[0] = SPELL_JORMUNGAR_EMERGE; + } + else + { + caster->RemoveAurasDueToSpell(SPELL_JORMUNGAR_SUBMERGE_VISUAL); + caster->ApplySpellImmune(SPELL_COLOSSUS_GROUND_SLAM, IMMUNITY_ID, SPELL_COLOSSUS_GROUND_SLAM, false); + caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + caster->SetControlled(true, UNIT_STATE_ROOT); - if (CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(caster->GetEntry())) - for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) - caster->m_spells[i] = ct->spells[i]; - } + if (CreatureTemplate const* ct = sObjectMgr->GetCreatureTemplate(caster->GetEntry())) + for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) + caster->m_spells[i] = ct->spells[i]; + } - if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->VehicleSpellInitialize(); + if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself()) + player->VehicleSpellInitialize(); } void Register() @@ -927,14 +927,14 @@ public: void Reset() { events.ScheduleEvent(EVENT_CHECK_AREA, 5000); - me->SetSpeed(MOVE_RUN, 2.0f); + me->SetSpeed(MOVE_RUN, 2.0f); } - void MovementInform(uint32 type, uint32 id) - { - if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized()) - events.ScheduleEvent(EVENT_REACHED_HOME, 2000); - } + void MovementInform(uint32 type, uint32 id) + { + if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized()) + events.ScheduleEvent(EVENT_REACHED_HOME, 2000); + } void UpdateAI(uint32 diff) { @@ -950,17 +950,17 @@ public: { Talk(TEXT_EMOTE, passenger); - Movement::PointsArray pathPoints; - pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + Movement::PointsArray pathPoints; + pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - WaypointPath const* i_path = sWaypointMgr->GetPath(NPC_DRAKE); - for (uint8 i = 0; i < i_path->size(); ++i) - { - WaypointData const* node = i_path->at(i); - pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); - } + WaypointPath const* i_path = sWaypointMgr->GetPath(NPC_DRAKE); + for (uint8 i = 0; i < i_path->size(); ++i) + { + WaypointData const* node = i_path->at(i); + pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); + } - me->GetMotionMaster()->MoveSplinePath(&pathPoints); + me->GetMotionMaster()->MoveSplinePath(&pathPoints); } } else @@ -1133,15 +1133,15 @@ class spell_close_rift : public SpellScriptLoader void AddSC_storm_peaks() { - // Ours - new npc_frosthound(); - new npc_iron_watcher(); - new npc_time_lost_proto_drake(); - new npc_wild_wyrm(); - new spell_q13003_thursting_hodirs_spear(); - new spell_q13007_iron_colossus(); + // Ours + new npc_frosthound(); + new npc_iron_watcher(); + new npc_time_lost_proto_drake(); + new npc_wild_wyrm(); + new spell_q13003_thursting_hodirs_spear(); + new spell_q13007_iron_colossus(); - // Theirs + // Theirs new npc_injured_goblin(); new npc_roxi_ramrocket(); new npc_brunnhildar_prisoner(); diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index 44c3ed589..8ed8d325a 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -60,11 +60,11 @@ enum Spells // Spirit guide SPELL_CHANNEL_SPIRIT_HEAL = 22011, - // RP-GG - SPELL_RP_GG_TRIGGER_MISSILE = 49769, + // RP-GG + SPELL_RP_GG_TRIGGER_MISSILE = 49769, - // Teleport to fortress - SPELL_TELEPORT_TO_FORTRESS = 59096, + // Teleport to fortress + SPELL_TELEPORT_TO_FORTRESS = 59096, }; enum CreatureIds @@ -237,8 +237,8 @@ class npc_wg_spirit_guide : public CreatureScript { npc_wg_spirit_guideAI(Creature* creature) : ScriptedAI(creature) { - me->setActive(true); - } + me->setActive(true); + } void UpdateAI(uint32 /* diff */) { @@ -255,17 +255,17 @@ class npc_wg_spirit_guide : public CreatureScript enum eWgQueue { - EVENT_ARCANIST_BRAEDIN_YELL = 1, - EVENT_MAGISTER_SURDIEL_YELL = 2, - EVENT_SPELL_FROST_ARMOR = 3, + EVENT_ARCANIST_BRAEDIN_YELL = 1, + EVENT_MAGISTER_SURDIEL_YELL = 2, + EVENT_SPELL_FROST_ARMOR = 3, - SAY_ARCANIST_BRAEDIN = 0, - SAY_MAGISTER_SURDIEL = 0, + SAY_ARCANIST_BRAEDIN = 0, + SAY_MAGISTER_SURDIEL = 0, - NPC_ARCANIST_BRAEDIN = 32169, - NPC_MAGISTER_SURDIEL = 32170, + NPC_ARCANIST_BRAEDIN = 32169, + NPC_MAGISTER_SURDIEL = 32170, - SPELL_FROST_ARMOR = 31256 + SPELL_FROST_ARMOR = 31256 }; class npc_wg_queue : public CreatureScript @@ -325,54 +325,54 @@ class npc_wg_queue : public CreatureScript { npc_wg_queueAI(Creature* creature) : ScriptedAI(creature) { - if (creature->GetEntry() == NPC_ARCANIST_BRAEDIN) - events.ScheduleEvent(EVENT_ARCANIST_BRAEDIN_YELL, 0); - else if (creature->GetEntry() == NPC_MAGISTER_SURDIEL) - events.ScheduleEvent(EVENT_MAGISTER_SURDIEL_YELL, 0); + if (creature->GetEntry() == NPC_ARCANIST_BRAEDIN) + events.ScheduleEvent(EVENT_ARCANIST_BRAEDIN_YELL, 0); + else if (creature->GetEntry() == NPC_MAGISTER_SURDIEL) + events.ScheduleEvent(EVENT_MAGISTER_SURDIEL_YELL, 0); - events.ScheduleEvent(EVENT_SPELL_FROST_ARMOR, 0); - } + events.ScheduleEvent(EVENT_SPELL_FROST_ARMOR, 0); + } - EventMap events; + EventMap events; - void UpdateAI(uint32 diff) - { - ScriptedAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + ScriptedAI::UpdateAI(diff); - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_ARCANIST_BRAEDIN_YELL: - if (Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG)) - { - if (wintergrasp->IsWarTime()) - { - Talk(SAY_ARCANIST_BRAEDIN); - events.ScheduleEvent(EVENT_ARCANIST_BRAEDIN_YELL, 240000); - break; - } - } - events.ScheduleEvent(EVENT_ARCANIST_BRAEDIN_YELL, 5000); - break; - case EVENT_MAGISTER_SURDIEL_YELL: - if (Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG)) - { - uint32 timer = wintergrasp->GetTimer() / 1000; - if (!wintergrasp->IsWarTime() && timer < 5*MINUTE && timer > 4*MINUTE) - { - Talk(SAY_MAGISTER_SURDIEL); - events.ScheduleEvent(EVENT_MAGISTER_SURDIEL_YELL, 300000); - break; - } - } - events.ScheduleEvent(EVENT_MAGISTER_SURDIEL_YELL, 5000); - break; - case EVENT_SPELL_FROST_ARMOR: - me->CastSpell(me, SPELL_FROST_ARMOR, true); - events.ScheduleEvent(EVENT_SPELL_FROST_ARMOR, 900000); - break; - } - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_ARCANIST_BRAEDIN_YELL: + if (Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG)) + { + if (wintergrasp->IsWarTime()) + { + Talk(SAY_ARCANIST_BRAEDIN); + events.ScheduleEvent(EVENT_ARCANIST_BRAEDIN_YELL, 240000); + break; + } + } + events.ScheduleEvent(EVENT_ARCANIST_BRAEDIN_YELL, 5000); + break; + case EVENT_MAGISTER_SURDIEL_YELL: + if (Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG)) + { + uint32 timer = wintergrasp->GetTimer() / 1000; + if (!wintergrasp->IsWarTime() && timer < 5*MINUTE && timer > 4*MINUTE) + { + Talk(SAY_MAGISTER_SURDIEL); + events.ScheduleEvent(EVENT_MAGISTER_SURDIEL_YELL, 300000); + break; + } + } + events.ScheduleEvent(EVENT_MAGISTER_SURDIEL_YELL, 5000); + break; + case EVENT_SPELL_FROST_ARMOR: + me->CastSpell(me, SPELL_FROST_ARMOR, true); + events.ScheduleEvent(EVENT_SPELL_FROST_ARMOR, 900000); + break; + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -415,67 +415,67 @@ class npc_wg_quest_giver : public CreatureScript // qm.AddMenuItem(quest_id, 2); } - // xinef: add att/def doubles if this quest is spawned - std::vector questRelationVector; - for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i) + // xinef: add att/def doubles if this quest is spawned + std::vector questRelationVector; + for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i) { - uint32 questId = i->second; + uint32 questId = i->second; Quest const* quest = sObjectMgr->GetQuestTemplate(questId); if (!quest) continue; - switch (questId) - { - case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_BONES_AND_ARROWS_ALLIANCE_DEF)) - continue; - questRelationVector.push_back(QUEST_BONES_AND_ARROWS_ALLIANCE_ATT); - break; - case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF)) - continue; - questRelationVector.push_back(QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT); - break; - case QUEST_A_RARE_HERB_ALLIANCE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_A_RARE_HERB_ALLIANCE_DEF)) - continue; - questRelationVector.push_back(QUEST_A_RARE_HERB_ALLIANCE_ATT); - break; - case QUEST_FUELING_THE_DEMOLISHERS_ALLIANCE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_FUELING_THE_DEMOLISHERS_ALLIANCE_DEF)) - continue; - questRelationVector.push_back(QUEST_FUELING_THE_DEMOLISHERS_ALLIANCE_ATT); - break; - case QUEST_BONES_AND_ARROWS_HORDE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_BONES_AND_ARROWS_HORDE_DEF)) - continue; - questRelationVector.push_back(QUEST_BONES_AND_ARROWS_HORDE_ATT); - break; - case QUEST_JINXING_THE_WALLS_HORDE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_WARDING_THE_WALLS_HORDE_DEF)) - continue; - questRelationVector.push_back(QUEST_JINXING_THE_WALLS_HORDE_ATT); - break; - case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF)) - continue; - questRelationVector.push_back(QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT); - break; - case QUEST_HEALING_WITH_ROSES_HORDE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_HEALING_WITH_ROSES_HORDE_DEF)) - continue; - questRelationVector.push_back(QUEST_HEALING_WITH_ROSES_HORDE_ATT); - break; - default: - questRelationVector.push_back(questId); - break; - } - } + switch (questId) + { + case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_BONES_AND_ARROWS_ALLIANCE_DEF)) + continue; + questRelationVector.push_back(QUEST_BONES_AND_ARROWS_ALLIANCE_ATT); + break; + case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF)) + continue; + questRelationVector.push_back(QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT); + break; + case QUEST_A_RARE_HERB_ALLIANCE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_A_RARE_HERB_ALLIANCE_DEF)) + continue; + questRelationVector.push_back(QUEST_A_RARE_HERB_ALLIANCE_ATT); + break; + case QUEST_FUELING_THE_DEMOLISHERS_ALLIANCE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_FUELING_THE_DEMOLISHERS_ALLIANCE_DEF)) + continue; + questRelationVector.push_back(QUEST_FUELING_THE_DEMOLISHERS_ALLIANCE_ATT); + break; + case QUEST_BONES_AND_ARROWS_HORDE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_BONES_AND_ARROWS_HORDE_DEF)) + continue; + questRelationVector.push_back(QUEST_BONES_AND_ARROWS_HORDE_ATT); + break; + case QUEST_JINXING_THE_WALLS_HORDE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_WARDING_THE_WALLS_HORDE_DEF)) + continue; + questRelationVector.push_back(QUEST_JINXING_THE_WALLS_HORDE_ATT); + break; + case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF)) + continue; + questRelationVector.push_back(QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT); + break; + case QUEST_HEALING_WITH_ROSES_HORDE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_HEALING_WITH_ROSES_HORDE_DEF)) + continue; + questRelationVector.push_back(QUEST_HEALING_WITH_ROSES_HORDE_ATT); + break; + default: + questRelationVector.push_back(questId); + break; + } + } for (std::vector::const_iterator i = questRelationVector.begin(); i != questRelationVector.end(); ++i) { uint32 questId = *i; - Quest const* quest = sObjectMgr->GetQuestTemplate(questId); + Quest const* quest = sObjectMgr->GetQuestTemplate(questId); switch (questId) { // Horde attacker @@ -563,118 +563,118 @@ class npc_wg_quest_giver : public CreatureScript return true; } - uint32 GetDialogStatus(Player* player, Creature* creature) - { - QuestRelationBounds qr = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); - QuestRelationBounds qir = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); - QuestGiverStatus result = DIALOG_STATUS_NONE; + uint32 GetDialogStatus(Player* player, Creature* creature) + { + QuestRelationBounds qr = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); + QuestRelationBounds qir = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); + QuestGiverStatus result = DIALOG_STATUS_NONE; - for (QuestRelations::const_iterator i = qir.first; i != qir.second; ++i) - { - QuestGiverStatus result2 = DIALOG_STATUS_NONE; - uint32 questId = i->second; - Quest const* quest = sObjectMgr->GetQuestTemplate(questId); - if (!quest) - continue; + for (QuestRelations::const_iterator i = qir.first; i != qir.second; ++i) + { + QuestGiverStatus result2 = DIALOG_STATUS_NONE; + uint32 questId = i->second; + Quest const* quest = sObjectMgr->GetQuestTemplate(questId); + if (!quest) + continue; - ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId()); - if (!sConditionMgr->IsObjectMeetToConditions(player, conditions)) - continue; + ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId()); + if (!sConditionMgr->IsObjectMeetToConditions(player, conditions)) + continue; - QuestStatus status = player->GetQuestStatus(questId); - if ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(questId)) || - (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))) - { - if (quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) - result2 = DIALOG_STATUS_REWARD_REP; - else - result2 = DIALOG_STATUS_REWARD; - } - else if (status == QUEST_STATUS_INCOMPLETE) - result2 = DIALOG_STATUS_INCOMPLETE; + QuestStatus status = player->GetQuestStatus(questId); + if ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(questId)) || + (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))) + { + if (quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) + result2 = DIALOG_STATUS_REWARD_REP; + else + result2 = DIALOG_STATUS_REWARD; + } + else if (status == QUEST_STATUS_INCOMPLETE) + result2 = DIALOG_STATUS_INCOMPLETE; - if (result2 > result) - result = result2; - } + if (result2 > result) + result = result2; + } - for (QuestRelations::const_iterator i = qr.first; i != qr.second; ++i) - { - QuestGiverStatus result2 = DIALOG_STATUS_NONE; - uint32 questId = i->second; - Quest const* quest = sObjectMgr->GetQuestTemplate(questId); - if (!quest) - continue; + for (QuestRelations::const_iterator i = qr.first; i != qr.second; ++i) + { + QuestGiverStatus result2 = DIALOG_STATUS_NONE; + uint32 questId = i->second; + Quest const* quest = sObjectMgr->GetQuestTemplate(questId); + if (!quest) + continue; - ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId()); - if (!sConditionMgr->IsObjectMeetToConditions(player, conditions)) - continue; + ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId()); + if (!sConditionMgr->IsObjectMeetToConditions(player, conditions)) + continue; - switch (questId) - { - case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_BONES_AND_ARROWS_ALLIANCE_DEF)) - continue; - break; - case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF)) - continue; - break; - case QUEST_A_RARE_HERB_ALLIANCE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_A_RARE_HERB_ALLIANCE_DEF)) - continue; - break; - case QUEST_FUELING_THE_DEMOLISHERS_ALLIANCE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_FUELING_THE_DEMOLISHERS_ALLIANCE_DEF)) - continue; - break; - case QUEST_BONES_AND_ARROWS_HORDE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_BONES_AND_ARROWS_HORDE_DEF)) - continue; - break; - case QUEST_JINXING_THE_WALLS_HORDE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_WARDING_THE_WALLS_HORDE_DEF)) - continue; - break; - case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF)) - continue; - break; - case QUEST_HEALING_WITH_ROSES_HORDE_ATT: - if (!sPoolMgr->IsSpawnedObject(QUEST_HEALING_WITH_ROSES_HORDE_DEF)) - continue; - break; - } + switch (questId) + { + case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_BONES_AND_ARROWS_ALLIANCE_DEF)) + continue; + break; + case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF)) + continue; + break; + case QUEST_A_RARE_HERB_ALLIANCE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_A_RARE_HERB_ALLIANCE_DEF)) + continue; + break; + case QUEST_FUELING_THE_DEMOLISHERS_ALLIANCE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_FUELING_THE_DEMOLISHERS_ALLIANCE_DEF)) + continue; + break; + case QUEST_BONES_AND_ARROWS_HORDE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_BONES_AND_ARROWS_HORDE_DEF)) + continue; + break; + case QUEST_JINXING_THE_WALLS_HORDE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_WARDING_THE_WALLS_HORDE_DEF)) + continue; + break; + case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF)) + continue; + break; + case QUEST_HEALING_WITH_ROSES_HORDE_ATT: + if (!sPoolMgr->IsSpawnedObject(QUEST_HEALING_WITH_ROSES_HORDE_DEF)) + continue; + break; + } - QuestStatus status = player->GetQuestStatus(questId); - if (status == QUEST_STATUS_NONE) - { - if (player->CanSeeStartQuest(quest)) - { - if (player->SatisfyQuestLevel(quest, false)) - { - if (quest->IsAutoComplete()) - result2 = DIALOG_STATUS_REWARD_REP; - else if (player->getLevel() <= (player->GetQuestLevel(quest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))) - { - if (quest->IsDaily()) - result2 = DIALOG_STATUS_AVAILABLE_REP; - else - result2 = DIALOG_STATUS_AVAILABLE; - } - else - result2 = DIALOG_STATUS_LOW_LEVEL_AVAILABLE; - } - else - result2 = DIALOG_STATUS_UNAVAILABLE; - } - } + QuestStatus status = player->GetQuestStatus(questId); + if (status == QUEST_STATUS_NONE) + { + if (player->CanSeeStartQuest(quest)) + { + if (player->SatisfyQuestLevel(quest, false)) + { + if (quest->IsAutoComplete()) + result2 = DIALOG_STATUS_REWARD_REP; + else if (player->getLevel() <= (player->GetQuestLevel(quest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))) + { + if (quest->IsDaily()) + result2 = DIALOG_STATUS_AVAILABLE_REP; + else + result2 = DIALOG_STATUS_AVAILABLE; + } + else + result2 = DIALOG_STATUS_LOW_LEVEL_AVAILABLE; + } + else + result2 = DIALOG_STATUS_UNAVAILABLE; + } + } - if (result2 > result) - result = result2; - } + if (result2 > result) + result = result2; + } - return result; - } + return result; + } }; class npc_wg_siege_machine : public CreatureScript @@ -686,42 +686,42 @@ class npc_wg_siege_machine : public CreatureScript { npc_wg_siege_machineAI(Creature* creature) : VehicleAI(creature) { - checkTimer = 0; - } + checkTimer = 0; + } - uint32 checkTimer; + uint32 checkTimer; - bool CanControlVehicle(Unit* passenger) - { - if (passenger->HasAura(SPELL_LIEUTENANT)) - return true; + bool CanControlVehicle(Unit* passenger) + { + if (passenger->HasAura(SPELL_LIEUTENANT)) + return true; - if (me->GetEntry() == NPC_WINTERGRASP_CATAPULT && passenger->HasAura(SPELL_CORPORAL)) - return true; + if (me->GetEntry() == NPC_WINTERGRASP_CATAPULT && passenger->HasAura(SPELL_CORPORAL)) + return true; - return false; - } + return false; + } - void UpdateAI(uint32 diff) - { - VehicleAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + VehicleAI::UpdateAI(diff); - checkTimer += diff; - if (checkTimer >= 1000) - { - checkTimer = 0; - if (me->GetVehicleKit()) - for (SeatMap::iterator itr = me->GetVehicleKit()->Seats.begin(); itr != me->GetVehicleKit()->Seats.end(); ++itr) - if (const VehicleSeatEntry* seatInfo = itr->second.SeatInfo) - if (seatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) - if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid)) - if (!CanControlVehicle(passenger)) - { - passenger->ExitVehicle(); - return; - } - } - } + checkTimer += diff; + if (checkTimer >= 1000) + { + checkTimer = 0; + if (me->GetVehicleKit()) + for (SeatMap::iterator itr = me->GetVehicleKit()->Seats.begin(); itr != me->GetVehicleKit()->Seats.end(); ++itr) + if (const VehicleSeatEntry* seatInfo = itr->second.SeatInfo) + if (seatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) + if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid)) + if (!CanControlVehicle(passenger)) + { + passenger->ExitVehicle(); + return; + } + } + } }; CreatureAI *GetAI(Creature* creature) const @@ -744,36 +744,36 @@ class go_wg_vehicle_teleporter : public GameObjectScript go_wg_vehicle_teleporterAI(GameObject* gameObject) : GameObjectAI(gameObject), _checkTimer(0) { - } + } - bool IsFriendly(Unit* passenger) - { - return ((go->GetUInt32Value(GAMEOBJECT_FACTION) == WintergraspFaction[TEAM_HORDE] && passenger->getRaceMask() & RACEMASK_HORDE) || - (go->GetUInt32Value(GAMEOBJECT_FACTION) == WintergraspFaction[TEAM_ALLIANCE] && passenger->getRaceMask() & RACEMASK_ALLIANCE)); - } + bool IsFriendly(Unit* passenger) + { + return ((go->GetUInt32Value(GAMEOBJECT_FACTION) == WintergraspFaction[TEAM_HORDE] && passenger->getRaceMask() & RACEMASK_HORDE) || + (go->GetUInt32Value(GAMEOBJECT_FACTION) == WintergraspFaction[TEAM_ALLIANCE] && passenger->getRaceMask() & RACEMASK_ALLIANCE)); + } - Creature* IsValidVehicle(Creature* cVeh) - { - if (!cVeh->HasAura(SPELL_VEHICLE_TELEPORT)) + Creature* IsValidVehicle(Creature* cVeh) + { + if (!cVeh->HasAura(SPELL_VEHICLE_TELEPORT)) if (Vehicle* vehicle = cVeh->GetVehicleKit()) if (Unit* passenger = vehicle->GetPassenger(0)) if (IsFriendly(passenger)) if (Creature* teleportTrigger = passenger->SummonTrigger(go->GetPositionX()-60.0f, go->GetPositionY(), go->GetPositionZ()+1.0f, cVeh->GetOrientation(), 1000)) - return teleportTrigger; + return teleportTrigger; - return NULL; - } + return NULL; + } void UpdateAI(uint32 diff) { - _checkTimer += diff; + _checkTimer += diff; if (_checkTimer >= 1000) { for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++) if (Creature* vehicleCreature = go->FindNearestCreature(vehiclesList[i], 3.0f, true)) - if (Creature* teleportTrigger = IsValidVehicle(vehicleCreature)) - teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); + if (Creature* teleportTrigger = IsValidVehicle(vehicleCreature)) + teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); _checkTimer = 0; } @@ -814,8 +814,8 @@ class spell_wintergrasp_force_building : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(target, GetEffectValue(), false, NULL, NULL, target->GetGUID()); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, GetEffectValue(), false, NULL, NULL, target->GetGUID()); } void Register() @@ -843,17 +843,17 @@ class spell_wintergrasp_create_vehicle : public SpellScriptLoader { PreventHitEffect(effIndex); - uint32 entry = GetSpellInfo()->Effects[effIndex].MiscValue; - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(GetSpellInfo()->Effects[effIndex].MiscValueB); - int32 duration = GetSpellInfo()->GetDuration(); - if (!GetOriginalCaster() || !properties) - return; + uint32 entry = GetSpellInfo()->Effects[effIndex].MiscValue; + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(GetSpellInfo()->Effects[effIndex].MiscValueB); + int32 duration = GetSpellInfo()->GetDuration(); + if (!GetOriginalCaster() || !properties) + return; - if (TempSummon* summon = GetCaster()->GetMap()->SummonCreature(entry, *GetHitDest(), properties, duration, GetOriginalCaster(), GetSpellInfo()->Id)) - { - summon->SetCreatorGUID(GetOriginalCaster()->GetGUID()); - summon->HandleSpellClick(GetCaster()); - } + if (TempSummon* summon = GetCaster()->GetMap()->SummonCreature(entry, *GetHitDest(), properties, duration, GetOriginalCaster(), GetSpellInfo()->Id)) + { + summon->SetCreatorGUID(GetOriginalCaster()->GetGUID()); + summon->HandleSpellClick(GetCaster()); + } } void Register() @@ -877,24 +877,24 @@ class spell_wintergrasp_rp_gg : public SpellScriptLoader { PrepareSpellScript(spell_wintergrasp_rp_gg_SpellScript); - bool handled; - bool Load() - { - handled = false; - return true; - } - - void HandleFinish() + bool handled; + bool Load() { - if (!GetExplTargetDest()) - return; + handled = false; + return true; + } - GetCaster()->CastSpell(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY(), GetExplTargetDest()->GetPositionZ(), SPELL_RP_GG_TRIGGER_MISSILE, true); + void HandleFinish() + { + if (!GetExplTargetDest()) + return; + + GetCaster()->CastSpell(GetExplTargetDest()->GetPositionX(), GetExplTargetDest()->GetPositionY(), GetExplTargetDest()->GetPositionZ(), SPELL_RP_GG_TRIGGER_MISSILE, true); } void Register() { - AfterCast += SpellCastFn(spell_wintergrasp_rp_gg_SpellScript::HandleFinish); + AfterCast += SpellCastFn(spell_wintergrasp_rp_gg_SpellScript::HandleFinish); } }; @@ -915,13 +915,13 @@ class spell_wintergrasp_portal : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - Player* target = GetHitPlayer(); - Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (!wintergrasp || !target || target->getLevel() < 75 || (wintergrasp->GetDefenderTeam() != target->GetTeamId())) - return; + PreventHitDefaultEffect(effIndex); + Player* target = GetHitPlayer(); + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!wintergrasp || !target || target->getLevel() < 75 || (wintergrasp->GetDefenderTeam() != target->GetTeamId())) + return; - target->CastSpell(target, SPELL_TELEPORT_TO_FORTRESS, true); + target->CastSpell(target, SPELL_TELEPORT_TO_FORTRESS, true); } void Register() @@ -947,8 +947,8 @@ class spell_wintergrasp_water : public SpellScriptLoader SpellCastResult CheckCast() { - Unit* target = GetCaster(); - if (!target || !target->IsVehicle()) + Unit* target = GetCaster(); + if (!target || !target->IsVehicle()) return SPELL_FAILED_DONT_REPORT; return SPELL_CAST_OK; @@ -978,10 +978,10 @@ class spell_wintergrasp_hide_small_elementals : public SpellScriptLoader void HandlePeriodicDummy(AuraEffect const* aurEff) { Unit* target = GetTarget(); - Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()); - bool enable = !Bf || !Bf->IsWarTime(); - target->SetPhaseMask(enable ? 1 : 512, true); - PreventDefaultAction(); + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()); + bool enable = !Bf || !Bf->IsWarTime(); + target->SetPhaseMask(enable ? 1 : 512, true); + PreventDefaultAction(); } void Register() @@ -1010,11 +1010,11 @@ class spell_wg_reduce_damage_by_distance : public SpellScriptLoader if (!GetExplTargetDest() || !GetHitUnit()) return; - float maxDistance = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); // Xinef: always stored in EFFECT_0 - float distance = std::min(GetHitUnit()->GetDistance(*GetExplTargetDest()), maxDistance); + float maxDistance = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); // Xinef: always stored in EFFECT_0 + float distance = std::min(GetHitUnit()->GetDistance(*GetExplTargetDest()), maxDistance); - int32 damage = std::max(0, int32(GetHitDamage() - floor(GetHitDamage() * (distance / maxDistance)))); - SetHitDamage(damage); + int32 damage = std::max(0, int32(GetHitDamage() - floor(GetHitDamage() * (distance / maxDistance)))); + SetHitDamage(damage); } void Register() @@ -1070,8 +1070,8 @@ public: if (Unit* vehicle = source->GetVehicleBase()) if (vehicle->GetEntry() == NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE || vehicle->GetEntry() == NPC_WINTERGRASP_SIEGE_ENGINE_HORDE || - vehicle->GetEntry() == NPC_WINTERGRASP_CATAPULT || vehicle->GetEntry() == NPC_WINTERGRASP_DEMOLISHER || - vehicle->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON) + vehicle->GetEntry() == NPC_WINTERGRASP_CATAPULT || vehicle->GetEntry() == NPC_WINTERGRASP_DEMOLISHER || + vehicle->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON) return true; return false; @@ -1085,37 +1085,37 @@ public: bool OnCheck(Player* source, Unit* target) { - Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (!wintergrasp) - return false; + Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); + if (!wintergrasp) + return false; - return wintergrasp->GetTimer() >= (20 * MINUTE * IN_MILLISECONDS); + return wintergrasp->GetTimer() >= (20 * MINUTE * IN_MILLISECONDS); } }; void AddSC_wintergrasp() { - // NPCs + // NPCs new npc_wg_queue(); new npc_wg_spirit_guide(); new npc_wg_demolisher_engineer(); new npc_wg_quest_giver(); - new npc_wg_siege_machine(); + new npc_wg_siege_machine(); - // GOs - new go_wg_vehicle_teleporter(); + // GOs + new go_wg_vehicle_teleporter(); - // SPELLs + // SPELLs new spell_wintergrasp_force_building(); - new spell_wintergrasp_create_vehicle(); - new spell_wintergrasp_rp_gg(); - new spell_wintergrasp_portal(); - new spell_wintergrasp_water(); - new spell_wintergrasp_hide_small_elementals(); - new spell_wg_reduce_damage_by_distance(); + new spell_wintergrasp_create_vehicle(); + new spell_wintergrasp_rp_gg(); + new spell_wintergrasp_portal(); + new spell_wintergrasp_water(); + new spell_wintergrasp_hide_small_elementals(); + new spell_wg_reduce_damage_by_distance(); - // ACHIEVEMENTs - new achievement_wg_didnt_stand_a_chance(); - new achievement_wg_vehicular_gnomeslaughter(); - new achievement_wg_within_our_grasp(); + // ACHIEVEMENTs + new achievement_wg_didnt_stand_a_chance(); + new achievement_wg_vehicular_gnomeslaughter(); + new achievement_wg_within_our_grasp(); } diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index 722d76a9a..aa7062471 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -28,8 +28,8 @@ // Ours enum AlchemistItemRequirements { - QUEST_ALCHEMIST_APPRENTICE = 12541, - NPC_FINKLESTEIN = 28205, + QUEST_ALCHEMIST_APPRENTICE = 12541, + NPC_FINKLESTEIN = 28205, }; const uint32 AA_ITEM_ENTRY[24] = {38336, 39669, 38342, 38340, 38344, 38369, 38396, 38398, 38338, 38386, 38341, 38384, 38397, 38381, 38337, 38393, 38339, 39668, 39670, 38346, 38379, 38345, 38343, 38370}; @@ -50,74 +50,74 @@ public: { npc_finklesteinAI(Creature* creature) : ScriptedAI(creature) {} - std::map questList; + std::map questList; - void ClearPlayerOnTask(uint64 guid) - { - std::map::iterator itr = questList.find(guid); - if (itr != questList.end()) - questList.erase(itr); - } + void ClearPlayerOnTask(uint64 guid) + { + std::map::iterator itr = questList.find(guid); + if (itr != questList.end()) + questList.erase(itr); + } - bool IsPlayerOnTask(uint64 guid) - { - std::map::const_iterator itr = questList.find(guid); - return itr != questList.end(); - } + bool IsPlayerOnTask(uint64 guid) + { + std::map::const_iterator itr = questList.find(guid); + return itr != questList.end(); + } - void RightClickCauldron(uint64 guid) - { - if (questList.empty()) - return; + void RightClickCauldron(uint64 guid) + { + if (questList.empty()) + return; - std::map::iterator itr = questList.find(guid); - if (itr == questList.end()) - return; + std::map::iterator itr = questList.find(guid); + if (itr == questList.end()) + return; - Player* player = ObjectAccessor::GetPlayer(*me, guid); - if (player) - { - uint32 itemCode = itr->second; + Player* player = ObjectAccessor::GetPlayer(*me, guid); + if (player) + { + uint32 itemCode = itr->second; - uint32 itemEntry = GetTaskItemEntry(itemCode); - uint32 auraId = GetTaskAura(itemCode); - uint32 counter = GetTaskCounter(itemCode); - if (player->HasAura(auraId)) - { - // player still has aura, but no item. Skip - if (!player->HasItemCount(itemEntry)) - return; + uint32 itemEntry = GetTaskItemEntry(itemCode); + uint32 auraId = GetTaskAura(itemCode); + uint32 counter = GetTaskCounter(itemCode); + if (player->HasAura(auraId)) + { + // player still has aura, but no item. Skip + if (!player->HasItemCount(itemEntry)) + return; - // if we are here, all is ok (aura and item present) - player->DestroyItemCount(itemEntry, 1, true); - player->RemoveAurasDueToSpell(auraId); + // if we are here, all is ok (aura and item present) + player->DestroyItemCount(itemEntry, 1, true); + player->RemoveAurasDueToSpell(auraId); - if (counter < 6) - { - StartNextTask(player->GetGUID(), counter+1); - return; - } - else - player->KilledMonsterCredit(28248, 0); - } - else - { - // if we are here, it means we failed :( - player->SetQuestStatus(QUEST_ALCHEMIST_APPRENTICE, QUEST_STATUS_FAILED); - } - } - questList.erase(itr); - } + if (counter < 6) + { + StartNextTask(player->GetGUID(), counter+1); + return; + } + else + player->KilledMonsterCredit(28248, 0); + } + else + { + // if we are here, it means we failed :( + player->SetQuestStatus(QUEST_ALCHEMIST_APPRENTICE, QUEST_STATUS_FAILED); + } + } + questList.erase(itr); + } // Generate a Task and announce it to the player void StartNextTask(uint64 playerGUID, uint32 counter) { - if (counter > 6) - return; + if (counter > 6) + return; - Player* player = ObjectAccessor::GetPlayer(*me, playerGUID); - if (!player) - return; + Player* player = ObjectAccessor::GetPlayer(*me, playerGUID); + if (!player) + return; // Generate Item Code uint32 itemCode = SelectRandomCode(counter); @@ -165,53 +165,53 @@ public: uint32 SelectRandomCode(uint32 counter) { return (counter * 100 + urand(0,23)); } - uint32 GetTaskCounter(uint32 itemcode) { return itemcode / 100; } + uint32 GetTaskCounter(uint32 itemcode) { return itemcode / 100; } uint32 GetTaskAura(uint32 itemcode) { return AA_AURA_ID[itemcode % 100]; } uint32 GetTaskItemEntry(uint32 itemcode) { return AA_ITEM_ENTRY[itemcode % 100]; } - const char* GetTaskItemName(uint32 itemcode) { return AA_ITEM_NAME[itemcode % 100]; } + const char* GetTaskItemName(uint32 itemcode) { return AA_ITEM_NAME[itemcode % 100]; } }; - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) - { - if (quest->GetQuestId() == QUEST_ALCHEMIST_APPRENTICE) - if (creature->AI() && CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())) - CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())->ClearPlayerOnTask(player->GetGUID()); + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) + { + if (quest->GetQuestId() == QUEST_ALCHEMIST_APPRENTICE) + if (creature->AI() && CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())) + CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())->ClearPlayerOnTask(player->GetGUID()); - return true; - } + return true; + } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + bool OnGossipHello(Player* player, Creature* creature) + { + if (creature->IsQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - if (player->GetQuestStatus(QUEST_ALCHEMIST_APPRENTICE) == QUEST_STATUS_INCOMPLETE) - { - if (creature->AI() && CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())) - if (!CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())->IsPlayerOnTask(player->GetGUID())) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I'm ready to begin. What is the first ingredient you require?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (player->GetQuestStatus(QUEST_ALCHEMIST_APPRENTICE) == QUEST_STATUS_INCOMPLETE) + { + if (creature->AI() && CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())) + if (!CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())->IsPlayerOnTask(player->GetGUID())) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I'm ready to begin. What is the first ingredient you require?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - } + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + } - return true; - } + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->CLOSE_GOSSIP_MENU(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - player->CLOSE_GOSSIP_MENU(); - if (creature->AI() && CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())) - CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())->StartNextTask(player->GetGUID(), 1); - } + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + { + player->CLOSE_GOSSIP_MENU(); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + player->CLOSE_GOSSIP_MENU(); + if (creature->AI() && CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())) + CAST_AI(npc_finklestein::npc_finklesteinAI, creature->AI())->StartNextTask(player->GetGUID(), 1); + } - return true; - } + return true; + } CreatureAI *GetAI(Creature* creature) const { @@ -225,7 +225,7 @@ public: go_finklestein_cauldron() : GameObjectScript("go_finklestein_cauldron") { } bool OnGossipHello(Player* player, GameObject* go) - { + { Creature* finklestein = go->FindNearestCreature(NPC_FINKLESTEIN, 30.0f, true); if (finklestein && finklestein->AI()) CAST_AI(npc_finklestein::npc_finklesteinAI, finklestein->AI())->RightClickCauldron(player->GetGUID()); @@ -236,7 +236,7 @@ public: enum eFeedinDaGoolz { - NPC_DECAYING_GHOUL = 28565, + NPC_DECAYING_GHOUL = 28565, GO_BOWL = 190656, }; @@ -254,119 +254,119 @@ public: { npc_feedin_da_goolzAI(Creature* creature) : NullCreatureAI(creature) { findTimer = 1; checkTimer = 0; ghoulFed = 0; } - uint32 findTimer; - uint32 checkTimer; - uint64 ghoulFed; + uint32 findTimer; + uint32 checkTimer; + uint64 ghoulFed; - void UpdateAI(uint32 diff) - { - if (findTimer) - { - findTimer += diff; - if (findTimer >= 1000) - { - if (Creature* ghoul = me->FindNearestCreature(NPC_DECAYING_GHOUL, 30.0f, true)) - { - ghoul->SetReactState(REACT_DEFENSIVE); - float o = me->GetAngle(ghoul); - ghoul->GetMotionMaster()->MovePoint(1, me->GetPositionX()+2*cos(o), me->GetPositionY()+2*sin(o), me->GetPositionZ()); - checkTimer = 1; - findTimer = 0; - } - else - findTimer = 1; - } - return; - } + void UpdateAI(uint32 diff) + { + if (findTimer) + { + findTimer += diff; + if (findTimer >= 1000) + { + if (Creature* ghoul = me->FindNearestCreature(NPC_DECAYING_GHOUL, 30.0f, true)) + { + ghoul->SetReactState(REACT_DEFENSIVE); + float o = me->GetAngle(ghoul); + ghoul->GetMotionMaster()->MovePoint(1, me->GetPositionX()+2*cos(o), me->GetPositionY()+2*sin(o), me->GetPositionZ()); + checkTimer = 1; + findTimer = 0; + } + else + findTimer = 1; + } + return; + } - if (checkTimer) - { - checkTimer += diff; - if (checkTimer >= 1500) - { - checkTimer = 1; - if (!ghoulFed) - { - if (Creature* ghoul = me->FindNearestCreature(NPC_DECAYING_GHOUL, 3.0f, true)) - { - ghoulFed = ghoul->GetGUID(); - ghoul->HandleEmoteCommand(EMOTE_ONESHOT_EAT); - } - } - else - { - if (GameObject* bowl = me->FindNearestGameObject(GO_BOWL, 10.0f)) - bowl->Delete(); + if (checkTimer) + { + checkTimer += diff; + if (checkTimer >= 1500) + { + checkTimer = 1; + if (!ghoulFed) + { + if (Creature* ghoul = me->FindNearestCreature(NPC_DECAYING_GHOUL, 3.0f, true)) + { + ghoulFed = ghoul->GetGUID(); + ghoul->HandleEmoteCommand(EMOTE_ONESHOT_EAT); + } + } + else + { + if (GameObject* bowl = me->FindNearestGameObject(GO_BOWL, 10.0f)) + bowl->Delete(); - if (Creature* ghoul = ObjectAccessor::GetCreature(*me, ghoulFed)) - { - ghoul->SetReactState(REACT_AGGRESSIVE); - ghoul->GetMotionMaster()->MoveTargetedHome(); - } + if (Creature* ghoul = ObjectAccessor::GetCreature(*me, ghoulFed)) + { + ghoul->SetReactState(REACT_AGGRESSIVE); + ghoul->GetMotionMaster()->MoveTargetedHome(); + } - if (Unit* owner = me->ToTempSummon()->GetSummoner()) - if (Player* player = owner->ToPlayer()) - player->KilledMonsterCredit(me->GetEntry(), 0); + if (Unit* owner = me->ToTempSummon()->GetSummoner()) + if (Player* player = owner->ToPlayer()) + player->KilledMonsterCredit(me->GetEntry(), 0); - me->DespawnOrUnsummon(1); - } - } - } + me->DespawnOrUnsummon(1); + } + } + } } }; }; enum overlordDrakuru { - SPELL_SHADOW_BOLT = 54113, - SPELL_SCOURGE_DISGUISE_EXPIRING = 52010, - SPELL_THROW_BRIGHT_CRYSTAL = 54087, - SPELL_TELEPORT_EFFECT = 52096, - SPELL_SCOURGE_DISGUISE = 51966, - SPELL_BLIGHT_FOG = 54104, - SPELL_THROW_PORTAL_CRYSTAL = 54209, - SPELL_ARTHAS_PORTAL = 51807, - SPELL_TOUCH_OF_DEATH = 54236, - SPELL_DRAKURU_DEATH = 54248, - SPELL_SUMMON_SKULL = 54253, + SPELL_SHADOW_BOLT = 54113, + SPELL_SCOURGE_DISGUISE_EXPIRING = 52010, + SPELL_THROW_BRIGHT_CRYSTAL = 54087, + SPELL_TELEPORT_EFFECT = 52096, + SPELL_SCOURGE_DISGUISE = 51966, + SPELL_BLIGHT_FOG = 54104, + SPELL_THROW_PORTAL_CRYSTAL = 54209, + SPELL_ARTHAS_PORTAL = 51807, + SPELL_TOUCH_OF_DEATH = 54236, + SPELL_DRAKURU_DEATH = 54248, + SPELL_SUMMON_SKULL = 54253, - QUEST_BETRAYAL = 12713, + QUEST_BETRAYAL = 12713, - NPC_BLIGHTBLOOD_TROLL = 28931, - NPC_LICH_KING = 28498, + NPC_BLIGHTBLOOD_TROLL = 28931, + NPC_LICH_KING = 28498, - EVENT_BETRAYAL_1 = 1, - EVENT_BETRAYAL_2 = 2, - EVENT_BETRAYAL_3 = 3, - EVENT_BETRAYAL_4 = 4, - EVENT_BETRAYAL_5 = 5, - EVENT_BETRAYAL_6 = 6, - EVENT_BETRAYAL_7 = 7, - EVENT_BETRAYAL_8 = 8, - EVENT_BETRAYAL_9 = 9, - EVENT_BETRAYAL_10 = 10, - EVENT_BETRAYAL_11 = 11, - EVENT_BETRAYAL_12 = 12, - EVENT_BETRAYAL_13 = 13, - EVENT_BETRAYAL_14 = 14, - EVENT_BETRAYAL_SHADOW_BOLT = 20, - EVENT_BETRAYAL_CRYSTAL = 21, - EVENT_BETRAYAL_COMBAT_TALK = 22, + EVENT_BETRAYAL_1 = 1, + EVENT_BETRAYAL_2 = 2, + EVENT_BETRAYAL_3 = 3, + EVENT_BETRAYAL_4 = 4, + EVENT_BETRAYAL_5 = 5, + EVENT_BETRAYAL_6 = 6, + EVENT_BETRAYAL_7 = 7, + EVENT_BETRAYAL_8 = 8, + EVENT_BETRAYAL_9 = 9, + EVENT_BETRAYAL_10 = 10, + EVENT_BETRAYAL_11 = 11, + EVENT_BETRAYAL_12 = 12, + EVENT_BETRAYAL_13 = 13, + EVENT_BETRAYAL_14 = 14, + EVENT_BETRAYAL_SHADOW_BOLT = 20, + EVENT_BETRAYAL_CRYSTAL = 21, + EVENT_BETRAYAL_COMBAT_TALK = 22, - SAY_DRAKURU_0 = 0, - SAY_DRAKURU_1 = 1, - SAY_DRAKURU_2 = 2, - SAY_DRAKURU_3 = 3, - SAY_DRAKURU_4 = 4, - SAY_DRAKURU_5 = 5, - SAY_DRAKURU_6 = 6, - SAY_DRAKURU_7 = 7, - SAY_LICH_7 = 7, - SAY_LICH_8 = 8, - SAY_LICH_9 = 9, - SAY_LICH_10 = 10, - SAY_LICH_11 = 11, - SAY_LICH_12 = 12, + SAY_DRAKURU_0 = 0, + SAY_DRAKURU_1 = 1, + SAY_DRAKURU_2 = 2, + SAY_DRAKURU_3 = 3, + SAY_DRAKURU_4 = 4, + SAY_DRAKURU_5 = 5, + SAY_DRAKURU_6 = 6, + SAY_DRAKURU_7 = 7, + SAY_LICH_7 = 7, + SAY_LICH_8 = 8, + SAY_LICH_9 = 9, + SAY_LICH_10 = 10, + SAY_LICH_11 = 11, + SAY_LICH_12 = 12, }; class npc_overlord_drakuru_betrayal : public CreatureScript @@ -382,242 +382,242 @@ public: struct npc_overlord_drakuru_betrayalAI : public ScriptedAI { npc_overlord_drakuru_betrayalAI(Creature* creature) : ScriptedAI(creature), summons(me) - { - } + { + } - EventMap events; - SummonList summons; - uint64 playerGUID; - uint64 lichGUID; + EventMap events; + SummonList summons; + uint64 playerGUID; + uint64 lichGUID; - void EnterEvadeMode() - { - if (playerGUID) - if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) - if (player->IsWithinDistInMap(me, 80)) - return; - me->setFaction(974); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + if (playerGUID) + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) + if (player->IsWithinDistInMap(me, 80)) + return; + me->setFaction(974); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + ScriptedAI::EnterEvadeMode(); + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - playerGUID = 0; - lichGUID = 0; - me->setFaction(974); - me->SetVisible(false); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + playerGUID = 0; + lichGUID = 0; + me->setFaction(974); + me->SetVisible(false); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - void MoveInLineOfSight(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER) - { - if (playerGUID) - { - if (who->GetGUID() != playerGUID) - { - Player* player = ObjectAccessor::GetPlayer(*me, playerGUID); - if (player && player->IsWithinDistInMap(me, 80)) - who->ToPlayer()->NearTeleportTo(6143.76f, -1969.7f, 417.57f, 2.08f); - else - { - EnterEvadeMode(); - return; - } - } - else - ScriptedAI::MoveInLineOfSight(who); - } - else if (who->ToPlayer()->GetQuestStatus(QUEST_BETRAYAL) == QUEST_STATUS_INCOMPLETE && who->HasAura(SPELL_SCOURGE_DISGUISE)) - { - me->SetVisible(true); - playerGUID = who->GetGUID(); - events.ScheduleEvent(EVENT_BETRAYAL_1, 5000); - } - } - else - ScriptedAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER) + { + if (playerGUID) + { + if (who->GetGUID() != playerGUID) + { + Player* player = ObjectAccessor::GetPlayer(*me, playerGUID); + if (player && player->IsWithinDistInMap(me, 80)) + who->ToPlayer()->NearTeleportTo(6143.76f, -1969.7f, 417.57f, 2.08f); + else + { + EnterEvadeMode(); + return; + } + } + else + ScriptedAI::MoveInLineOfSight(who); + } + else if (who->ToPlayer()->GetQuestStatus(QUEST_BETRAYAL) == QUEST_STATUS_INCOMPLETE && who->HasAura(SPELL_SCOURGE_DISGUISE)) + { + me->SetVisible(true); + playerGUID = who->GetGUID(); + events.ScheduleEvent(EVENT_BETRAYAL_1, 5000); + } + } + else + ScriptedAI::MoveInLineOfSight(who); + } - void JustSummoned(Creature* cr) - { - summons.Summon(cr); - if (cr->GetEntry() == NPC_BLIGHTBLOOD_TROLL) - cr->CastSpell(cr, SPELL_TELEPORT_EFFECT, true); - else - { - me->SetFacingToObject(cr); - lichGUID = cr->GetGUID(); - float o = me->GetAngle(cr); - cr->GetMotionMaster()->MovePoint(0, me->GetPositionX()+cos(o)*6.0f, me->GetPositionY()+sin(o)*6.0f, me->GetPositionZ()); - } - } + void JustSummoned(Creature* cr) + { + summons.Summon(cr); + if (cr->GetEntry() == NPC_BLIGHTBLOOD_TROLL) + cr->CastSpell(cr, SPELL_TELEPORT_EFFECT, true); + else + { + me->SetFacingToObject(cr); + lichGUID = cr->GetGUID(); + float o = me->GetAngle(cr); + cr->GetMotionMaster()->MovePoint(0, me->GetPositionX()+cos(o)*6.0f, me->GetPositionY()+sin(o)*6.0f, me->GetPositionZ()); + } + } - void EnterCombat(Unit*) - { - Talk(SAY_DRAKURU_3); - events.ScheduleEvent(EVENT_BETRAYAL_SHADOW_BOLT, 2000); - events.ScheduleEvent(EVENT_BETRAYAL_CRYSTAL, 5000); - events.ScheduleEvent(EVENT_BETRAYAL_COMBAT_TALK, 20000); - } + void EnterCombat(Unit*) + { + Talk(SAY_DRAKURU_3); + events.ScheduleEvent(EVENT_BETRAYAL_SHADOW_BOLT, 2000); + events.ScheduleEvent(EVENT_BETRAYAL_CRYSTAL, 5000); + events.ScheduleEvent(EVENT_BETRAYAL_COMBAT_TALK, 20000); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - { - damage = 0; - me->RemoveAllAuras(); - me->CombatStop(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setFaction(35); - events.Reset(); - events.ScheduleEvent(EVENT_BETRAYAL_4, 1000); - } - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + damage = 0; + me->RemoveAllAuras(); + me->CombatStop(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->setFaction(35); + events.Reset(); + events.ScheduleEvent(EVENT_BETRAYAL_4, 1000); + } + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_THROW_PORTAL_CRYSTAL) - if (Aura* aura = target->AddAura(SPELL_ARTHAS_PORTAL, target)) - aura->SetDuration(48000); - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_THROW_PORTAL_CRYSTAL) + if (Aura* aura = target->AddAura(SPELL_ARTHAS_PORTAL, target)) + aura->SetDuration(48000); + } - void SpellHit(Unit* caster, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_TOUCH_OF_DEATH) - { - me->CastSpell(me, SPELL_DRAKURU_DEATH, true); - me->CastSpell(me, SPELL_SUMMON_SKULL, true); - } - } + void SpellHit(Unit* caster, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_TOUCH_OF_DEATH) + { + me->CastSpell(me, SPELL_DRAKURU_DEATH, true); + me->CastSpell(me, SPELL_SUMMON_SKULL, true); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_BETRAYAL_1: - Talk(SAY_DRAKURU_0); - events.PopEvent(); - events.ScheduleEvent(EVENT_BETRAYAL_2, 5000); - break; - case EVENT_BETRAYAL_2: - me->SummonCreature(NPC_BLIGHTBLOOD_TROLL, 6184.1f, -1969.9f, 586.76f, 4.5f); - me->SummonCreature(NPC_BLIGHTBLOOD_TROLL, 6222.9f, -2026.5f, 586.76f, 2.9f); - me->SummonCreature(NPC_BLIGHTBLOOD_TROLL, 6166.2f, -2065.4f, 586.76f, 1.4f); - me->SummonCreature(NPC_BLIGHTBLOOD_TROLL, 6127.5f, -2008.7f, 586.76f, 0.0f); - events.PopEvent(); - events.ScheduleEvent(EVENT_BETRAYAL_3, 5000); - break; - case EVENT_BETRAYAL_3: - Talk(SAY_DRAKURU_1); - Talk(SAY_DRAKURU_2); - if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) - player->CastSpell(player, SPELL_SCOURGE_DISGUISE_EXPIRING, true); - if (Aura* aur = me->AddAura(SPELL_BLIGHT_FOG, me)) - aur->SetDuration(22000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_4: - Talk(SAY_DRAKURU_5); - events.ScheduleEvent(EVENT_BETRAYAL_5, 6000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_5: - Talk(SAY_DRAKURU_6); - me->CastSpell(me, SPELL_THROW_PORTAL_CRYSTAL, true); - events.ScheduleEvent(EVENT_BETRAYAL_6, 8000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_6: - me->SummonCreature(NPC_LICH_KING, 6142.9f, -2011.6f, 590.86f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 41000); - events.ScheduleEvent(EVENT_BETRAYAL_7, 8000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_7: - Talk(SAY_DRAKURU_7); - events.ScheduleEvent(EVENT_BETRAYAL_8, 5000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_8: - if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) - lich->AI()->Talk(SAY_LICH_7); - events.ScheduleEvent(EVENT_BETRAYAL_9, 6000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_9: - if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) - { - lich->AI()->Talk(SAY_LICH_8); - lich->CastSpell(me, SPELL_TOUCH_OF_DEATH, false); - } - events.ScheduleEvent(EVENT_BETRAYAL_10, 4000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_10: - me->SetVisible(false); - if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) - lich->AI()->Talk(SAY_LICH_9); - events.ScheduleEvent(EVENT_BETRAYAL_11, 4000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_11: - if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) - lich->AI()->Talk(SAY_LICH_10); - events.ScheduleEvent(EVENT_BETRAYAL_12, 6000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_12: - if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) - lich->AI()->Talk(SAY_LICH_11); - events.ScheduleEvent(EVENT_BETRAYAL_13, 3000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_13: - if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) - { - lich->AI()->Talk(SAY_LICH_12); - lich->GetMotionMaster()->MovePoint(0, 6143.8f, -2011.5f, 590.9f); - } - events.ScheduleEvent(EVENT_BETRAYAL_14, 7000); - events.PopEvent(); - break; - case EVENT_BETRAYAL_14: - playerGUID = 0; - EnterEvadeMode(); - break; - - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_BETRAYAL_1: + Talk(SAY_DRAKURU_0); + events.PopEvent(); + events.ScheduleEvent(EVENT_BETRAYAL_2, 5000); + break; + case EVENT_BETRAYAL_2: + me->SummonCreature(NPC_BLIGHTBLOOD_TROLL, 6184.1f, -1969.9f, 586.76f, 4.5f); + me->SummonCreature(NPC_BLIGHTBLOOD_TROLL, 6222.9f, -2026.5f, 586.76f, 2.9f); + me->SummonCreature(NPC_BLIGHTBLOOD_TROLL, 6166.2f, -2065.4f, 586.76f, 1.4f); + me->SummonCreature(NPC_BLIGHTBLOOD_TROLL, 6127.5f, -2008.7f, 586.76f, 0.0f); + events.PopEvent(); + events.ScheduleEvent(EVENT_BETRAYAL_3, 5000); + break; + case EVENT_BETRAYAL_3: + Talk(SAY_DRAKURU_1); + Talk(SAY_DRAKURU_2); + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) + player->CastSpell(player, SPELL_SCOURGE_DISGUISE_EXPIRING, true); + if (Aura* aur = me->AddAura(SPELL_BLIGHT_FOG, me)) + aur->SetDuration(22000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_4: + Talk(SAY_DRAKURU_5); + events.ScheduleEvent(EVENT_BETRAYAL_5, 6000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_5: + Talk(SAY_DRAKURU_6); + me->CastSpell(me, SPELL_THROW_PORTAL_CRYSTAL, true); + events.ScheduleEvent(EVENT_BETRAYAL_6, 8000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_6: + me->SummonCreature(NPC_LICH_KING, 6142.9f, -2011.6f, 590.86f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 41000); + events.ScheduleEvent(EVENT_BETRAYAL_7, 8000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_7: + Talk(SAY_DRAKURU_7); + events.ScheduleEvent(EVENT_BETRAYAL_8, 5000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_8: + if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) + lich->AI()->Talk(SAY_LICH_7); + events.ScheduleEvent(EVENT_BETRAYAL_9, 6000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_9: + if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) + { + lich->AI()->Talk(SAY_LICH_8); + lich->CastSpell(me, SPELL_TOUCH_OF_DEATH, false); + } + events.ScheduleEvent(EVENT_BETRAYAL_10, 4000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_10: + me->SetVisible(false); + if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) + lich->AI()->Talk(SAY_LICH_9); + events.ScheduleEvent(EVENT_BETRAYAL_11, 4000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_11: + if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) + lich->AI()->Talk(SAY_LICH_10); + events.ScheduleEvent(EVENT_BETRAYAL_12, 6000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_12: + if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) + lich->AI()->Talk(SAY_LICH_11); + events.ScheduleEvent(EVENT_BETRAYAL_13, 3000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_13: + if (Creature* lich = ObjectAccessor::GetCreature(*me, lichGUID)) + { + lich->AI()->Talk(SAY_LICH_12); + lich->GetMotionMaster()->MovePoint(0, 6143.8f, -2011.5f, 590.9f); + } + events.ScheduleEvent(EVENT_BETRAYAL_14, 7000); + events.PopEvent(); + break; + case EVENT_BETRAYAL_14: + playerGUID = 0; + EnterEvadeMode(); + break; + + } - if (me->getFaction() == 35 || me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_STUNNED)) - return; + if (me->getFaction() == 35 || me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_STUNNED)) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - switch (events.GetEvent()) - { - case EVENT_BETRAYAL_SHADOW_BOLT: - if (!me->IsWithinMeleeRange(me->GetVictim())) - me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); - events.RepeatEvent(2000); - break; - case EVENT_BETRAYAL_CRYSTAL: - if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) - me->CastSpell(player, SPELL_THROW_BRIGHT_CRYSTAL, true); - events.RepeatEvent(urand(6000, 15000)); - break; - case EVENT_BETRAYAL_COMBAT_TALK: - Talk(SAY_DRAKURU_4); - events.RepeatEvent(20000); - break; - } + switch (events.GetEvent()) + { + case EVENT_BETRAYAL_SHADOW_BOLT: + if (!me->IsWithinMeleeRange(me->GetVictim())) + me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); + events.RepeatEvent(2000); + break; + case EVENT_BETRAYAL_CRYSTAL: + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) + me->CastSpell(player, SPELL_THROW_BRIGHT_CRYSTAL, true); + events.RepeatEvent(urand(6000, 15000)); + break; + case EVENT_BETRAYAL_COMBAT_TALK: + Talk(SAY_DRAKURU_4); + events.RepeatEvent(20000); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } }; }; @@ -644,32 +644,32 @@ public: struct npc_drakuru_shacklesAI : public NullCreatureAI { npc_drakuru_shacklesAI(Creature* creature) : NullCreatureAI(creature) - { - _rageclawGUID = 0; - timer = 0; - } + { + _rageclawGUID = 0; + timer = 0; + } void Reset() { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void UpdateAI(uint32 diff) - { - timer += diff; - if (timer >= 2000) - { - timer = 0; - if (_rageclawGUID) - return; + void UpdateAI(uint32 diff) + { + timer += diff; + if (timer >= 2000) + { + timer = 0; + if (_rageclawGUID) + return; - if (Creature* cr = me->FindNearestCreature(NPC_RAGECLAW, 10.0f)) - { - _rageclawGUID = cr->GetGUID(); - LockRageclaw(cr); - } - } - } + if (Creature* cr = me->FindNearestCreature(NPC_RAGECLAW, 10.0f)) + { + _rageclawGUID = cr->GetGUID(); + LockRageclaw(cr); + } + } + } void LockRageclaw(Creature* rageclaw) { @@ -685,8 +685,8 @@ public: { // pointer check not needed DoCast(rageclaw, SPELL_FREE_RAGECLAW, true); - _rageclawGUID = 0; - me->DespawnOrUnsummon(1); + _rageclawGUID = 0; + me->DespawnOrUnsummon(1); } void SpellHit(Unit* caster, const SpellInfo* spell) @@ -709,7 +709,7 @@ public: private: uint64 _rageclawGUID; - uint32 timer; + uint32 timer; }; CreatureAI* GetAI(Creature* creature) const @@ -968,15 +968,15 @@ public: void AddSC_zuldrak() { - // Ours - new npc_finklestein(); - new go_finklestein_cauldron(); - new npc_feedin_da_goolz(); - new npc_overlord_drakuru_betrayal(); + // Ours + new npc_finklestein(); + new go_finklestein_cauldron(); + new npc_feedin_da_goolz(); + new npc_overlord_drakuru_betrayal(); new npc_drakuru_shackles(); new npc_captured_rageclaw(); - // Theirs + // Theirs new npc_released_offspring_harkoa(); new npc_crusade_recruit(); new go_scourge_enclosure(); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPGH.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPGH.cpp index 09d4f5dcf..8205bdc76 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPGH.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPGH.cpp @@ -34,11 +34,11 @@ bool OutdoorPvPGH::SetupOutdoorPvP() { RegisterZone(GH_ZONE); if (m_obj = new OPvPCapturePointGH(this)) - { - AddCapturePoint(m_obj); - return true; - } - return false; + { + AddCapturePoint(m_obj); + return true; + } + return false; } void OutdoorPvPGH::SendRemoveWorldStates(Player* player) @@ -95,15 +95,15 @@ void OPvPCapturePointGH::ChangeState() switch (m_State) { case OBJECTIVESTATE_ALLIANCE: - sGameEventMgr->StopEvent(GH_ALLIANCE_DEFENSE_EVENT); - sGameEventMgr->StopEvent(GH_HORDE_DEFENSE_EVENT); - sGameEventMgr->StartEvent(GH_ALLIANCE_DEFENSE_EVENT); + sGameEventMgr->StopEvent(GH_ALLIANCE_DEFENSE_EVENT); + sGameEventMgr->StopEvent(GH_HORDE_DEFENSE_EVENT); + sGameEventMgr->StartEvent(GH_ALLIANCE_DEFENSE_EVENT); artkit = 2; break; case OBJECTIVESTATE_HORDE: - sGameEventMgr->StopEvent(GH_ALLIANCE_DEFENSE_EVENT); - sGameEventMgr->StopEvent(GH_HORDE_DEFENSE_EVENT); - sGameEventMgr->StartEvent(GH_HORDE_DEFENSE_EVENT); + sGameEventMgr->StopEvent(GH_ALLIANCE_DEFENSE_EVENT); + sGameEventMgr->StopEvent(GH_HORDE_DEFENSE_EVENT); + sGameEventMgr->StartEvent(GH_HORDE_DEFENSE_EVENT); artkit = 1; break; } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPGH.h b/src/server/scripts/OutdoorPvP/OutdoorPvPGH.h index e5c2b78b7..01437b2b5 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPGH.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPGH.h @@ -22,14 +22,14 @@ enum OutdoorPvPGHenum { - GH_ALLIANCE_DEFENSE_EVENT = 65, - GH_HORDE_DEFENSE_EVENT = 66, + GH_ALLIANCE_DEFENSE_EVENT = 65, + GH_HORDE_DEFENSE_EVENT = 66, - GH_ZONE = 394, + GH_ZONE = 394, - GH_UI_SLIDER_DISPLAY = 3466, - GH_UI_SLIDER_POS = 3467, - GH_UI_SLIDER_N = 3468, + GH_UI_SLIDER_DISPLAY = 3466, + GH_UI_SLIDER_POS = 3467, + GH_UI_SLIDER_N = 3468, }; class Unit; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 8ff87d737..0c6acab61 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -35,7 +35,7 @@ void OutdoorPvPNA::HandleKillImpl(Player* player, Unit* killed) if (killed->GetTypeId() == TYPEID_PLAYER && player->GetTeamId() != killed->ToPlayer()->GetTeamId()) { player->KilledMonsterCredit(NA_CREDIT_MARKER, 0); // 0 guid, btw it isn't even used in killedmonster function :S - player->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? NA_KILL_TOKEN_ALLIANCE : NA_KILL_TOKEN_HORDE, true); + player->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? NA_KILL_TOKEN_ALLIANCE : NA_KILL_TOKEN_HORDE, true); } } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index 320d42ce8..ae17829f8 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -105,8 +105,8 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger) } UpdateWorldState(); // reward player, xinef: has no effect on characters above level 70 - if (player->getLevel() < 70) - player->CastSpell(player, SI_TRACES_OF_SILITHYST, true); + if (player->getLevel() < 70) + player->CastSpell(player, SI_TRACES_OF_SILITHYST, true); // add 19 honor player->RewardHonor(NULL, 1, 19); // add 20 cenarion circle repu @@ -131,8 +131,8 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger) } UpdateWorldState(); // reward player, xinef: has no effect on characters above level 70 - if (player->getLevel() < 70) - player->CastSpell(player, SI_TRACES_OF_SILITHYST, true); + if (player->getLevel() < 70) + player->CastSpell(player, SI_TRACES_OF_SILITHYST, true); // add 19 honor player->RewardHonor(NULL, 1, 19); // add 20 cenarion circle repu diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index 59c1845d4..b96537be4 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -22,10 +22,10 @@ enum ExarchMaladaar ENTRY_STOLEN_SOUL = 18441, - EVENT_SPELL_FEAR = 1, - EVENT_SPELL_RIBBON = 2, - EVENT_SPELL_SOUL = 3, - EVENT_CHECK_HEALTH = 4 + EVENT_SPELL_FEAR = 1, + EVENT_SPELL_RIBBON = 2, + EVENT_SPELL_SOUL = 3, + EVENT_CHECK_HEALTH = 4 }; class boss_exarch_maladaar : public CreatureScript @@ -46,7 +46,7 @@ public: } bool _talked; - EventMap events; + EventMap events; void Reset() { @@ -68,16 +68,16 @@ public: { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_FEAR, 15000); - events.ScheduleEvent(EVENT_SPELL_RIBBON, 5000); - events.ScheduleEvent(EVENT_SPELL_SOUL, 25000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 5000); + events.ScheduleEvent(EVENT_SPELL_FEAR, 15000); + events.ScheduleEvent(EVENT_SPELL_RIBBON, 5000); + events.ScheduleEvent(EVENT_SPELL_SOUL, 25000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 5000); } void KilledUnit(Unit*) { if (urand(0,1)) - Talk(SAY_SLAY); + Talk(SAY_SLAY); } void JustDied(Unit*) @@ -93,47 +93,47 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_CHECK_HEALTH: - if (HealthBelowPct(25)) - { - Talk(SAY_SUMMON); - me->CastSpell(me, SPELL_SUMMON_AVATAR, false); - events.PopEvent(); - return; - } - events.RepeatEvent(2000); - break; - case EVENT_SPELL_SOUL: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - { - Talk(SAY_ROAR); - me->CastSpell(target, SPELL_STOLEN_SOUL, false); - if (Creature* summon = me->SummonCreature(ENTRY_STOLEN_SOUL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000)) - { - summon->CastSpell(summon, SPELL_STOLEN_SOUL_VISUAL, false); - summon->SetDisplayId(target->GetDisplayId()); - summon->AI()->DoAction(target->getClass()); - summon->AI()->AttackStart(target); - } - } - events.RepeatEvent(urand(25000, 30000)); - break; - case EVENT_SPELL_RIBBON: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_RIBBON_OF_SOULS, false); - events.RepeatEvent(urand(10000, 20000)); - break; - case EVENT_SPELL_FEAR: - me->CastSpell(me, SPELL_SOUL_SCREAM, false); - events.RepeatEvent(urand(15000, 25000)); - break; - } + switch (events.GetEvent()) + { + case EVENT_CHECK_HEALTH: + if (HealthBelowPct(25)) + { + Talk(SAY_SUMMON); + me->CastSpell(me, SPELL_SUMMON_AVATAR, false); + events.PopEvent(); + return; + } + events.RepeatEvent(2000); + break; + case EVENT_SPELL_SOUL: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + { + Talk(SAY_ROAR); + me->CastSpell(target, SPELL_STOLEN_SOUL, false); + if (Creature* summon = me->SummonCreature(ENTRY_STOLEN_SOUL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000)) + { + summon->CastSpell(summon, SPELL_STOLEN_SOUL_VISUAL, false); + summon->SetDisplayId(target->GetDisplayId()); + summon->AI()->DoAction(target->getClass()); + summon->AI()->AttackStart(target); + } + } + events.RepeatEvent(urand(25000, 30000)); + break; + case EVENT_SPELL_RIBBON: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_RIBBON_OF_SOULS, false); + events.RepeatEvent(urand(10000, 20000)); + break; + case EVENT_SPELL_FEAR: + me->CastSpell(me, SPELL_SOUL_SCREAM, false); + events.RepeatEvent(urand(15000, 25000)); + break; + } DoMeleeAttackIfReady(); } @@ -142,18 +142,18 @@ public: enum stolenSoul { - SPELL_MOONFIRE = 37328, - SPELL_FIREBALL = 37329, - SPELL_MIND_FLAY = 37330, - SPELL_HEMORRHAGE = 37331, - SPELL_FROSTSHOCK = 37332, - SPELL_CURSE_OF_AGONY = 37334, - SPELL_MORTAL_STRIKE = 37335, - SPELL_FREEZING_TRAP = 37368, - SPELL_HAMMER_OF_JUSTICE = 37369, - SPELL_PLAGUE_STRIKE = 58839, + SPELL_MOONFIRE = 37328, + SPELL_FIREBALL = 37329, + SPELL_MIND_FLAY = 37330, + SPELL_HEMORRHAGE = 37331, + SPELL_FROSTSHOCK = 37332, + SPELL_CURSE_OF_AGONY = 37334, + SPELL_MORTAL_STRIKE = 37335, + SPELL_FREEZING_TRAP = 37368, + SPELL_HAMMER_OF_JUSTICE = 37369, + SPELL_PLAGUE_STRIKE = 58839, - EVENT_STOLEN_SOUL_SPELL = 1, + EVENT_STOLEN_SOUL_SPELL = 1, }; class npc_stolen_soul : public CreatureScript @@ -171,17 +171,17 @@ public: npc_stolen_soulAI(Creature* creature) : ScriptedAI(creature) {} uint8 myClass; - EventMap events; + EventMap events; void Reset() { - myClass = CLASS_WARRIOR; + myClass = CLASS_WARRIOR; events.ScheduleEvent(EVENT_STOLEN_SOUL_SPELL, 1000); } void DoAction(int32 pClass) { - myClass = pClass; + myClass = pClass; } void UpdateAI(uint32 diff) @@ -189,13 +189,13 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (events.GetEvent() == EVENT_STOLEN_SOUL_SPELL) - { + events.Update(diff); + if (events.GetEvent() == EVENT_STOLEN_SOUL_SPELL) + { switch (myClass) { case CLASS_WARRIOR: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); + me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false); events.RepeatEvent(6000); break; case CLASS_PALADIN: @@ -230,7 +230,7 @@ public: me->CastSpell(me->GetVictim(), SPELL_MOONFIRE, false); events.RepeatEvent(10000); break; - case CLASS_DEATH_KNIGHT: + case CLASS_DEATH_KNIGHT: me->CastSpell(me->GetVictim(), SPELL_PLAGUE_STRIKE, false); events.RepeatEvent(6000); break; diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index 5523f101e..3bd74a369 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -9,26 +9,26 @@ REWRITTEN BY XINEF enum eShirrak { - SPELL_INHIBIT_MAGIC = 32264, - SPELL_ATTRACT_MAGIC = 32265, - SPELL_CARNIVOROUS_BITE_N = 36383, - SPELL_CARNIVOROUS_BITE_H = 39382, + SPELL_INHIBIT_MAGIC = 32264, + SPELL_ATTRACT_MAGIC = 32265, + SPELL_CARNIVOROUS_BITE_N = 36383, + SPELL_CARNIVOROUS_BITE_H = 39382, - SPELL_FIERY_BLAST_N = 32302, - SPELL_FIERY_BLAST_H = 38382, - SPELL_FOCUS_FIRE_VISUAL = 32286, - SPELL_FOCUS_CAST = 32300, + SPELL_FIERY_BLAST_N = 32302, + SPELL_FIERY_BLAST_H = 38382, + SPELL_FOCUS_FIRE_VISUAL = 32286, + SPELL_FOCUS_CAST = 32300, - EVENT_SPELL_INHIBIT_MAGIC = 1, - EVENT_SPELL_ATTRACT_MAGIC = 2, - EVENT_SPELL_CARNIVOROUS = 3, - EVENT_SPELL_FOCUS_FIRE = 4, - EVENT_SPELL_FOCUS_FIRE_2 = 5, - EVENT_SPELL_FOCUS_FIRE_3 = 6, + EVENT_SPELL_INHIBIT_MAGIC = 1, + EVENT_SPELL_ATTRACT_MAGIC = 2, + EVENT_SPELL_CARNIVOROUS = 3, + EVENT_SPELL_FOCUS_FIRE = 4, + EVENT_SPELL_FOCUS_FIRE_2 = 5, + EVENT_SPELL_FOCUS_FIRE_3 = 6, - ENTRY_FOCUS_FIRE = 18374, + ENTRY_FOCUS_FIRE = 18374, - EMOTE_FOCUSED = 0 + EMOTE_FOCUSED = 0 }; class boss_shirrak_the_dead_watcher : public CreatureScript @@ -47,121 +47,121 @@ public: { } - EventMap events; + EventMap events; uint64 focusGUID; - void EnterEvadeMode() - { - me->SetControlled(false, UNIT_STATE_ROOT); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->SetControlled(false, UNIT_STATE_ROOT); + ScriptedAI::EnterEvadeMode(); + } void Reset() { - events.Reset(); + events.Reset(); focusGUID = 0; - me->SetControlled(false, UNIT_STATE_ROOT); + me->SetControlled(false, UNIT_STATE_ROOT); } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_SPELL_INHIBIT_MAGIC, 0); - events.ScheduleEvent(EVENT_SPELL_ATTRACT_MAGIC, 28000); - events.ScheduleEvent(EVENT_SPELL_CARNIVOROUS, 10000); - events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE, 17000); - } + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_SPELL_INHIBIT_MAGIC, 0); + events.ScheduleEvent(EVENT_SPELL_ATTRACT_MAGIC, 28000); + events.ScheduleEvent(EVENT_SPELL_CARNIVOROUS, 10000); + events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE, 17000); + } void JustSummoned(Creature* summon) { - summon->CastSpell(summon, SPELL_FOCUS_FIRE_VISUAL, true); + summon->CastSpell(summon, SPELL_FOCUS_FIRE_VISUAL, true); } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_FOCUS_CAST) - target->CastSpell(target, DUNGEON_MODE(SPELL_FIERY_BLAST_N, SPELL_FIERY_BLAST_H), false); - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_FOCUS_CAST) + target->CastSpell(target, DUNGEON_MODE(SPELL_FIERY_BLAST_N, SPELL_FIERY_BLAST_H), false); + } - uint8 getStackCount(float dist) - { - if (dist < 15) - return 4; - if (dist < 25) - return 3; - if (dist < 35) - return 2; - return 1; - } + uint8 getStackCount(float dist) + { + if (dist < 15) + return 4; + if (dist < 25) + return 3; + if (dist < 35) + return 2; + return 1; + } void UpdateAI(uint32 diff) { - events.Update(diff); - uint32 eventId = events.GetEvent(); + events.Update(diff); + uint32 eventId = events.GetEvent(); - if (eventId == EVENT_SPELL_INHIBIT_MAGIC) + if (eventId == EVENT_SPELL_INHIBIT_MAGIC) { Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if (Player* player = i->GetSource()) - { - float dist = me->GetDistance(player); + { + float dist = me->GetDistance(player); if (player->IsAlive() && dist < 45.0f) { Aura* aura = player->GetAura(SPELL_INHIBIT_MAGIC); - if (!aura) - aura = me->AddAura(SPELL_INHIBIT_MAGIC, player); - else - aura->RefreshDuration(); + if (!aura) + aura = me->AddAura(SPELL_INHIBIT_MAGIC, player); + else + aura->RefreshDuration(); - if (aura) - aura->SetStackAmount(getStackCount(dist)); + if (aura) + aura->SetStackAmount(getStackCount(dist)); } - else - player->RemoveAurasDueToSpell(SPELL_INHIBIT_MAGIC); - } - events.RepeatEvent(3000); - return; - } + else + player->RemoveAurasDueToSpell(SPELL_INHIBIT_MAGIC); + } + events.RepeatEvent(3000); + return; + } if (!UpdateVictim()) return; - switch (eventId) - { - case EVENT_SPELL_ATTRACT_MAGIC: - me->CastSpell(me, SPELL_ATTRACT_MAGIC, false); - events.RepeatEvent(30000); - events.RescheduleEvent(EVENT_SPELL_CARNIVOROUS, 1500); - break; - case EVENT_SPELL_CARNIVOROUS: - me->CastSpell(me, DUNGEON_MODE(SPELL_CARNIVOROUS_BITE_N, SPELL_CARNIVOROUS_BITE_H), false); - events.RepeatEvent(10000); - break; - case EVENT_SPELL_FOCUS_FIRE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) - { - if (Creature* cr = me->SummonCreature(ENTRY_FOCUS_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 7000)) - focusGUID = cr->GetGUID(); - Talk(EMOTE_FOCUSED, target); - } - events.RepeatEvent(urand(15000, 20000)); - events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 3000); - events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 3500); - events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 4000); - events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_3, 5000); - me->SetControlled(true, UNIT_STATE_ROOT); - break; - case EVENT_SPELL_FOCUS_FIRE_2: - if (Unit* flare = ObjectAccessor::GetCreature(*me, focusGUID)) - me->CastSpell(flare, SPELL_FOCUS_CAST, true); - events.PopEvent(); - break; - case EVENT_SPELL_FOCUS_FIRE_3: - me->SetControlled(false, UNIT_STATE_ROOT); - events.PopEvent(); - break; - } + switch (eventId) + { + case EVENT_SPELL_ATTRACT_MAGIC: + me->CastSpell(me, SPELL_ATTRACT_MAGIC, false); + events.RepeatEvent(30000); + events.RescheduleEvent(EVENT_SPELL_CARNIVOROUS, 1500); + break; + case EVENT_SPELL_CARNIVOROUS: + me->CastSpell(me, DUNGEON_MODE(SPELL_CARNIVOROUS_BITE_N, SPELL_CARNIVOROUS_BITE_H), false); + events.RepeatEvent(10000); + break; + case EVENT_SPELL_FOCUS_FIRE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) + { + if (Creature* cr = me->SummonCreature(ENTRY_FOCUS_FIRE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 7000)) + focusGUID = cr->GetGUID(); + Talk(EMOTE_FOCUSED, target); + } + events.RepeatEvent(urand(15000, 20000)); + events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 3000); + events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 3500); + events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_2, 4000); + events.ScheduleEvent(EVENT_SPELL_FOCUS_FIRE_3, 5000); + me->SetControlled(true, UNIT_STATE_ROOT); + break; + case EVENT_SPELL_FOCUS_FIRE_2: + if (Unit* flare = ObjectAccessor::GetCreature(*me, focusGUID)) + me->CastSpell(flare, SPELL_FOCUS_CAST, true); + events.PopEvent(); + break; + case EVENT_SPELL_FOCUS_FIRE_3: + me->SetControlled(false, UNIT_STATE_ROOT); + events.PopEvent(); + break; + } DoMeleeAttackIfReady(); } @@ -179,35 +179,35 @@ class spell_auchenai_possess : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Unit* caster = GetCaster()) - if (Unit* target = GetTarget()) - caster->CastSpell(target, 32830 /*POSSESS*/, true); + if (Unit* caster = GetCaster()) + if (Unit* target = GetTarget()) + caster->CastSpell(target, 32830 /*POSSESS*/, true); } - void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) - { - isPeriodic = true; - amplitude = 2000; - } + void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) + { + isPeriodic = true; + amplitude = 2000; + } - void Update(AuraEffect* effect) - { - // Xinef: Charm is removed when target is at or below 50%hp - if (Unit* owner = GetUnitOwner()) - if (owner->GetHealthPct() <= 50) - SetDuration(0); - } + void Update(AuraEffect* effect) + { + // Xinef: Charm is removed when target is at or below 50%hp + if (Unit* owner = GetUnitOwner()) + if (owner->GetHealthPct() <= 50) + SetDuration(0); + } void Register() { - // Base channel - if (m_scriptSpellId == 33401) - OnEffectRemove += AuraEffectRemoveFn(spell_auchenai_possess_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - else - { - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_auchenai_possess_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_CHARM); - OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_auchenai_possess_AuraScript::Update, EFFECT_0, SPELL_AURA_MOD_CHARM); - } + // Base channel + if (m_scriptSpellId == 33401) + OnEffectRemove += AuraEffectRemoveFn(spell_auchenai_possess_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + else + { + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_auchenai_possess_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_CHARM); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_auchenai_possess_AuraScript::Update, EFFECT_0, SPELL_AURA_MOD_CHARM); + } } }; @@ -220,5 +220,5 @@ class spell_auchenai_possess : public SpellScriptLoader void AddSC_boss_shirrak_the_dead_watcher() { new boss_shirrak_the_dead_watcher(); - new spell_auchenai_possess(); + new spell_auchenai_possess(); } diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp index 57f9b9ac4..df5a467bf 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp @@ -25,134 +25,134 @@ enum ePrince NPC_BEACON = 18431, NPC_SHAFFAR = 18344, - EVENT_SPELL_BEACON = 1, - EVENT_SPELL_FR_FI = 2, - EVENT_SPELL_FROST_NOVA = 3, - EVENT_SPELL_BLINK = 4, + EVENT_SPELL_BEACON = 1, + EVENT_SPELL_FR_FI = 2, + EVENT_SPELL_FROST_NOVA = 3, + EVENT_SPELL_BLINK = 4, }; class boss_nexusprince_shaffar : public CreatureScript { - public: - boss_nexusprince_shaffar() : CreatureScript("boss_nexusprince_shaffar") { } + public: + boss_nexusprince_shaffar() : CreatureScript("boss_nexusprince_shaffar") { } - CreatureAI* GetAI(Creature* creature) const - { - return new boss_nexusprince_shaffarAI (creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_nexusprince_shaffarAI (creature); + } - struct boss_nexusprince_shaffarAI : public ScriptedAI - { - boss_nexusprince_shaffarAI(Creature* creature) : ScriptedAI(creature), summons(me) - { - HasTaunted = false; - } + struct boss_nexusprince_shaffarAI : public ScriptedAI + { + boss_nexusprince_shaffarAI(Creature* creature) : ScriptedAI(creature), summons(me) + { + HasTaunted = false; + } - EventMap events; - SummonList summons; - bool HasTaunted; + EventMap events; + SummonList summons; + bool HasTaunted; - void Reset() - { - float dist = 8.0f; - float posX, posY, posZ, angle; - me->GetHomePosition(posX, posY, posZ, angle); + void Reset() + { + float dist = 8.0f; + float posX, posY, posZ, angle; + me->GetHomePosition(posX, posY, posZ, angle); - summons.DespawnAll(); - events.Reset(); - me->SummonCreature(NPC_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); - me->SummonCreature(NPC_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); - me->SummonCreature(NPC_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); - } + summons.DespawnAll(); + events.Reset(); + me->SummonCreature(NPC_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + me->SummonCreature(NPC_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + me->SummonCreature(NPC_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + } - void MoveInLineOfSight(Unit* who) - { - if (!HasTaunted && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f)) - { - Talk(SAY_INTRO); - HasTaunted = true; - } - } + void MoveInLineOfSight(Unit* who) + { + if (!HasTaunted && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f)) + { + Talk(SAY_INTRO); + HasTaunted = true; + } + } - void EnterCombat(Unit*) - { - Talk(SAY_AGGRO); + void EnterCombat(Unit*) + { + Talk(SAY_AGGRO); - me->SetInCombatWithZone(); - summons.DoZoneInCombat(); + me->SetInCombatWithZone(); + summons.DoZoneInCombat(); - events.ScheduleEvent(EVENT_SPELL_BEACON, 10000); - events.ScheduleEvent(EVENT_SPELL_FR_FI, 4000); - events.ScheduleEvent(EVENT_SPELL_FROST_NOVA, 15000); - } + events.ScheduleEvent(EVENT_SPELL_BEACON, 10000); + events.ScheduleEvent(EVENT_SPELL_FR_FI, 4000); + events.ScheduleEvent(EVENT_SPELL_FROST_NOVA, 15000); + } - void JustSummoned(Creature* summon) - { - if (me->IsInCombat() && summon->GetEntry() == NPC_BEACON) - { - summon->CastSpell(summon, SPELL_ETHEREAL_BEACON_VISUAL, false); - if (Unit* target = SelectTargetFromPlayerList(50.0f)) - summon->AI()->AttackStart(target); - } + void JustSummoned(Creature* summon) + { + if (me->IsInCombat() && summon->GetEntry() == NPC_BEACON) + { + summon->CastSpell(summon, SPELL_ETHEREAL_BEACON_VISUAL, false); + if (Unit* target = SelectTargetFromPlayerList(50.0f)) + summon->AI()->AttackStart(target); + } - summons.Summon(summon); - } + summons.Summon(summon); + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + } - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); - } + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } - void JustDied(Unit* /*killer*/) - { - Talk(SAY_DEAD); - summons.DespawnAll(); - } + void JustDied(Unit* /*killer*/) + { + Talk(SAY_DEAD); + summons.DespawnAll(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_FROST_NOVA: - me->CastSpell(me, SPELL_FROSTNOVA, false); - events.RepeatEvent(urand(16000, 23000)); - events.DelayEvents(1500); - events.ScheduleEvent(EVENT_SPELL_BLINK, 1500); - break; - case EVENT_SPELL_FR_FI: - me->CastSpell(me->GetVictim(), RAND(SPELL_FROSTBOLT, SPELL_FIREBALL), false); - events.RepeatEvent(urand(3000, 4000)); - break; - case EVENT_SPELL_BLINK: - me->CastSpell(me, SPELL_BLINK, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_SPELL_FR_FI, 0); - break; - case EVENT_SPELL_BEACON: - if (!urand(0, 3)) - Talk(SAY_SUMMON); + switch (events.GetEvent()) + { + case EVENT_SPELL_FROST_NOVA: + me->CastSpell(me, SPELL_FROSTNOVA, false); + events.RepeatEvent(urand(16000, 23000)); + events.DelayEvents(1500); + events.ScheduleEvent(EVENT_SPELL_BLINK, 1500); + break; + case EVENT_SPELL_FR_FI: + me->CastSpell(me->GetVictim(), RAND(SPELL_FROSTBOLT, SPELL_FIREBALL), false); + events.RepeatEvent(urand(3000, 4000)); + break; + case EVENT_SPELL_BLINK: + me->CastSpell(me, SPELL_BLINK, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_SPELL_FR_FI, 0); + break; + case EVENT_SPELL_BEACON: + if (!urand(0, 3)) + Talk(SAY_SUMMON); - me->CastSpell(me, SPELL_ETHEREAL_BEACON, true); - events.RepeatEvent(10000); - break; - } + me->CastSpell(me, SPELL_ETHEREAL_BEACON, true); + events.RepeatEvent(10000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; void AddSC_boss_nexusprince_shaffar() diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp index 631cf3296..2b2143ace 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_talon_king_ikiss.cpp @@ -8,31 +8,31 @@ REWRITTEN BY XINEF enum TailonkingIkiss { - SAY_INTRO = 0, - SAY_AGGRO = 1, - SAY_SLAY = 2, - SAY_DEATH = 3, - EMOTE_ARCANE_EXP = 4, + SAY_INTRO = 0, + SAY_AGGRO = 1, + SAY_SLAY = 2, + SAY_DEATH = 3, + EMOTE_ARCANE_EXP = 4, - SPELL_BLINK = 38194, - SPELL_BLINK_TELEPORT = 38203, - SPELL_MANA_SHIELD = 38151, - SPELL_ARCANE_BUBBLE = 9438, - SPELL_SLOW = 35032, - SPELL_POLYMORPH_N = 38245, // Difficulty data - SPELL_POLYMORPH_H = 43309, - SPELL_ARCANE_VOLLEY_N = 35059, // Difficulty data - SPELL_ARCANE_VOLLEY_H = 40424, - SPELL_ARCANE_EXPLOSION_N = 38197, // Difficulty data - SPELL_ARCANE_EXPLOSION_H = 40425, + SPELL_BLINK = 38194, + SPELL_BLINK_TELEPORT = 38203, + SPELL_MANA_SHIELD = 38151, + SPELL_ARCANE_BUBBLE = 9438, + SPELL_SLOW = 35032, + SPELL_POLYMORPH_N = 38245, // Difficulty data + SPELL_POLYMORPH_H = 43309, + SPELL_ARCANE_VOLLEY_N = 35059, // Difficulty data + SPELL_ARCANE_VOLLEY_H = 40424, + SPELL_ARCANE_EXPLOSION_N = 38197, // Difficulty data + SPELL_ARCANE_EXPLOSION_H = 40425, - EVENT_SPELL_BLINK = 1, - EVENT_SPELL_POLYMORPH = 2, - EVENT_SPELL_SLOW = 3, - EVENT_SPELL_ARCANE_VOLLEY = 4, - EVENT_SPELL_ARCANE_EXPLO = 5, - EVENT_HEALTH_CHECK = 6, - EVENT_SPELL_BLINK_2 = 7 + EVENT_SPELL_BLINK = 1, + EVENT_SPELL_POLYMORPH = 2, + EVENT_SPELL_SLOW = 3, + EVENT_SPELL_ARCANE_VOLLEY = 4, + EVENT_SPELL_ARCANE_EXPLO = 5, + EVENT_HEALTH_CHECK = 6, + EVENT_SPELL_BLINK_2 = 7 }; class boss_talon_king_ikiss : public CreatureScript @@ -51,49 +51,49 @@ public: { } - EventMap events; + EventMap events; bool _spoken; void Reset() { - _spoken = false; + _spoken = false; } void MoveInLineOfSight(Unit* who) { - if (!_spoken && who->GetTypeId() == TYPEID_PLAYER) - { - Talk(SAY_INTRO); - _spoken = true; - } + if (!_spoken && who->GetTypeId() == TYPEID_PLAYER) + { + Talk(SAY_INTRO); + _spoken = true; + } - ScriptedAI::MoveInLineOfSight(who); + ScriptedAI::MoveInLineOfSight(who); } void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_BLINK, 35000); - events.ScheduleEvent(EVENT_SPELL_ARCANE_VOLLEY, 5000); - events.ScheduleEvent(EVENT_SPELL_POLYMORPH, 8000); - events.ScheduleEvent(EVENT_HEALTH_CHECK, 2000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_SLOW, urand(15000, 25000)); + events.ScheduleEvent(EVENT_SPELL_BLINK, 35000); + events.ScheduleEvent(EVENT_SPELL_ARCANE_VOLLEY, 5000); + events.ScheduleEvent(EVENT_SPELL_POLYMORPH, 8000); + events.ScheduleEvent(EVENT_HEALTH_CHECK, 2000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_SLOW, urand(15000, 25000)); } void JustDied(Unit* /*killer*/) { Talk(SAY_DEATH); - if (InstanceScript* instance = me->GetInstanceScript()) + if (InstanceScript* instance = me->GetInstanceScript()) instance->SetData(DATA_IKISSDOOREVENT, DONE); } void KilledUnit(Unit* /*victim*/) { - if (urand(0,1)) - Talk(SAY_SLAY); + if (urand(0,1)) + Talk(SAY_SLAY); } void UpdateAI(uint32 diff) @@ -101,52 +101,52 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_ARCANE_VOLLEY: - me->CastSpell(me, SPELL_ARCANE_VOLLEY_N, false); - events.RepeatEvent(urand(7000, 12000)); - break; - case EVENT_SPELL_POLYMORPH: - if (Unit* target = (IsHeroic() ? SelectTarget(SELECT_TARGET_RANDOM, 0) : SelectTarget(SELECT_TARGET_TOPAGGRO, 1))) - me->CastSpell(target, SPELL_POLYMORPH_N, false); - events.RepeatEvent(urand(15000, 17500)); - break; - case EVENT_SPELL_SLOW: - me->CastSpell(me, SPELL_SLOW, false); + switch (events.GetEvent()) + { + case EVENT_SPELL_ARCANE_VOLLEY: + me->CastSpell(me, SPELL_ARCANE_VOLLEY_N, false); + events.RepeatEvent(urand(7000, 12000)); + break; + case EVENT_SPELL_POLYMORPH: + if (Unit* target = (IsHeroic() ? SelectTarget(SELECT_TARGET_RANDOM, 0) : SelectTarget(SELECT_TARGET_TOPAGGRO, 1))) + me->CastSpell(target, SPELL_POLYMORPH_N, false); + events.RepeatEvent(urand(15000, 17500)); + break; + case EVENT_SPELL_SLOW: + me->CastSpell(me, SPELL_SLOW, false); events.RepeatEvent(urand(15000, 30000)); - break; - case EVENT_HEALTH_CHECK: - if (me->HealthBelowPct(20)) - { - me->CastSpell(me, SPELL_MANA_SHIELD, false); - events.PopEvent(); - return; - } - events.RepeatEvent(1000); - break; - case EVENT_SPELL_BLINK: - Talk(EMOTE_ARCANE_EXP); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - me->CastSpell(target, SPELL_BLINK, false); - me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation()); + break; + case EVENT_HEALTH_CHECK: + if (me->HealthBelowPct(20)) + { + me->CastSpell(me, SPELL_MANA_SHIELD, false); + events.PopEvent(); + return; + } + events.RepeatEvent(1000); + break; + case EVENT_SPELL_BLINK: + Talk(EMOTE_ARCANE_EXP); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + me->CastSpell(target, SPELL_BLINK, false); + me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation()); - DoCast(target, SPELL_BLINK_TELEPORT); - } - events.RepeatEvent(urand(35000, 40000)); - events.DelayEvents(500); - events.ScheduleEvent(EVENT_SPELL_BLINK_2, 0); - return; - case EVENT_SPELL_BLINK_2: - me->CastSpell(me, SPELL_ARCANE_EXPLOSION_N, false); - me->CastSpell(me, SPELL_ARCANE_BUBBLE, true); - events.PopEvent(); - break; + DoCast(target, SPELL_BLINK_TELEPORT); + } + events.RepeatEvent(urand(35000, 40000)); + events.DelayEvents(500); + events.ScheduleEvent(EVENT_SPELL_BLINK_2, 0); + return; + case EVENT_SPELL_BLINK_2: + me->CastSpell(me, SPELL_ARCANE_EXPLOSION_N, false); + me->CastSpell(me, SPELL_ARCANE_BUBBLE, true); + events.PopEvent(); + break; } DoMeleeAttackIfReady(); @@ -156,21 +156,21 @@ public: enum Anzu { - SAY_ANZU_INTRO1 = 0, - SAY_ANZU_INTRO2 = 1, - SAY_SUMMON = 2, + SAY_ANZU_INTRO1 = 0, + SAY_ANZU_INTRO2 = 1, + SAY_SUMMON = 2, - SPELL_PARALYZING_SCREECH = 40184, - SPELL_SPELL_BOMB = 40303, - SPELL_CYCLONE = 40321, - SPELL_BANISH_SELF = 42354, - SPELL_SHADOWFORM = 40973, + SPELL_PARALYZING_SCREECH = 40184, + SPELL_SPELL_BOMB = 40303, + SPELL_CYCLONE = 40321, + SPELL_BANISH_SELF = 42354, + SPELL_SHADOWFORM = 40973, - EVENT_SPELL_SCREECH = 1, - EVENT_SPELL_BOMB = 2, - EVENT_SPELL_CYCLONE = 3, - EVENT_ANZU_HEALTH1 = 4, - EVENT_ANZU_HEALTH2 = 5 + EVENT_SPELL_SCREECH = 1, + EVENT_SPELL_BOMB = 2, + EVENT_SPELL_CYCLONE = 3, + EVENT_ANZU_HEALTH1 = 4, + EVENT_ANZU_HEALTH2 = 5 }; class boss_anzu : public CreatureScript @@ -187,129 +187,129 @@ public: { boss_anzuAI(Creature* creature) : ScriptedAI(creature), summons(me) { - talkTimer = 1; - me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->AddAura(SPELL_SHADOWFORM, me); + talkTimer = 1; + me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->AddAura(SPELL_SHADOWFORM, me); } - EventMap events; - SummonList summons; - uint32 talkTimer; + EventMap events; + SummonList summons; + uint32 talkTimer; void Reset() { - summons.DespawnAll(); - if (InstanceScript* instance = me->GetInstanceScript()) - if (instance->GetData(TYPE_ANZU_ENCOUNTER) != DONE) - instance->SetData(TYPE_ANZU_ENCOUNTER, NOT_STARTED); + summons.DespawnAll(); + if (InstanceScript* instance = me->GetInstanceScript()) + if (instance->GetData(TYPE_ANZU_ENCOUNTER) != DONE) + instance->SetData(TYPE_ANZU_ENCOUNTER, NOT_STARTED); } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->AI()->AttackStart(me->GetVictim()); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->AI()->AttackStart(me->GetVictim()); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - summons.RemoveNotExisting(); - if (summons.empty()) - me->RemoveAurasDueToSpell(SPELL_BANISH_SELF); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + summons.RemoveNotExisting(); + if (summons.empty()) + me->RemoveAurasDueToSpell(SPELL_BANISH_SELF); + } void EnterCombat(Unit* /*who*/) { - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_SCREECH, 14000); - events.ScheduleEvent(EVENT_SPELL_BOMB, 5000); - events.ScheduleEvent(EVENT_SPELL_CYCLONE, 8000); - events.ScheduleEvent(EVENT_ANZU_HEALTH1, 2000); - events.ScheduleEvent(EVENT_ANZU_HEALTH2, 2001); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_SCREECH, 14000); + events.ScheduleEvent(EVENT_SPELL_BOMB, 5000); + events.ScheduleEvent(EVENT_SPELL_CYCLONE, 8000); + events.ScheduleEvent(EVENT_ANZU_HEALTH1, 2000); + events.ScheduleEvent(EVENT_ANZU_HEALTH2, 2001); - if (InstanceScript* instance = me->GetInstanceScript()) + if (InstanceScript* instance = me->GetInstanceScript()) instance->SetData(TYPE_ANZU_ENCOUNTER, IN_PROGRESS); } void JustDied(Unit* /*killer*/) { - if (InstanceScript* instance = me->GetInstanceScript()) + if (InstanceScript* instance = me->GetInstanceScript()) instance->SetData(TYPE_ANZU_ENCOUNTER, DONE); } - void SummonBroods() - { - Talk(SAY_SUMMON); - me->CastSpell(me, SPELL_BANISH_SELF, true); - for (uint8 i = 0; i < 5; ++i) - me->SummonCreature(23132 /*NPC_BROOD_OF_ANZU*/, me->GetPositionX()+20*cos((float)i), me->GetPositionY()+20*sin((float)i), me->GetPositionZ()+25.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - } + void SummonBroods() + { + Talk(SAY_SUMMON); + me->CastSpell(me, SPELL_BANISH_SELF, true); + for (uint8 i = 0; i < 5; ++i) + me->SummonCreature(23132 /*NPC_BROOD_OF_ANZU*/, me->GetPositionX()+20*cos((float)i), me->GetPositionY()+20*sin((float)i), me->GetPositionZ()+25.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + } void UpdateAI(uint32 diff) { - if (talkTimer) - { - talkTimer += diff; - if (talkTimer >= 1000 && talkTimer < 10000) - { - Talk(SAY_ANZU_INTRO1); - talkTimer = 10000; - } - else if (talkTimer >= 16000) - { - me->SetUInt32Value(UNIT_FIELD_FLAGS, 0); - me->RemoveAurasDueToSpell(SPELL_SHADOWFORM); - Talk(SAY_ANZU_INTRO2); - talkTimer = 0; - } - } + if (talkTimer) + { + talkTimer += diff; + if (talkTimer >= 1000 && talkTimer < 10000) + { + Talk(SAY_ANZU_INTRO1); + talkTimer = 10000; + } + else if (talkTimer >= 16000) + { + me->SetUInt32Value(UNIT_FIELD_FLAGS, 0); + me->RemoveAurasDueToSpell(SPELL_SHADOWFORM); + Talk(SAY_ANZU_INTRO2); + talkTimer = 0; + } + } if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_STUNNED)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_STUNNED)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_SCREECH: - me->CastSpell(me, SPELL_PARALYZING_SCREECH, false); - events.RepeatEvent(23000); - events.DelayEvents(3000); - break; - case EVENT_SPELL_BOMB: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, SPELL_SPELL_BOMB, false); - events.RepeatEvent(urand(16000, 24500)); - events.DelayEvents(3000); - break; - case EVENT_SPELL_CYCLONE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 45.0f, true)) - me->CastSpell(target, SPELL_CYCLONE, false); - events.RepeatEvent(urand(22000, 27000)); - events.DelayEvents(3000); - break; - case EVENT_ANZU_HEALTH1: - if (me->HealthBelowPct(66)) - { - SummonBroods(); - events.PopEvent(); - events.DelayEvents(10000); - return; - } - events.RepeatEvent(1000); - break; - case EVENT_ANZU_HEALTH2: - if (me->HealthBelowPct(33)) - { - SummonBroods(); - events.PopEvent(); - events.DelayEvents(10000); - return; - } - events.RepeatEvent(1000); - break; + switch (events.GetEvent()) + { + case EVENT_SPELL_SCREECH: + me->CastSpell(me, SPELL_PARALYZING_SCREECH, false); + events.RepeatEvent(23000); + events.DelayEvents(3000); + break; + case EVENT_SPELL_BOMB: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, SPELL_SPELL_BOMB, false); + events.RepeatEvent(urand(16000, 24500)); + events.DelayEvents(3000); + break; + case EVENT_SPELL_CYCLONE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 45.0f, true)) + me->CastSpell(target, SPELL_CYCLONE, false); + events.RepeatEvent(urand(22000, 27000)); + events.DelayEvents(3000); + break; + case EVENT_ANZU_HEALTH1: + if (me->HealthBelowPct(66)) + { + SummonBroods(); + events.PopEvent(); + events.DelayEvents(10000); + return; + } + events.RepeatEvent(1000); + break; + case EVENT_ANZU_HEALTH2: + if (me->HealthBelowPct(33)) + { + SummonBroods(); + events.PopEvent(); + events.DelayEvents(10000); + return; + } + events.RepeatEvent(1000); + break; } DoMeleeAttackIfReady(); @@ -320,5 +320,5 @@ public: void AddSC_boss_talon_king_ikiss() { new boss_talon_king_ikiss(); - new boss_anzu(); + new boss_anzu(); } diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp index 6ed7d3605..663b4033f 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp @@ -22,33 +22,33 @@ public: uint32 AnzuEncounter; uint64 m_uiIkissDoorGUID; - uint64 _talonKingsCofferGUID; + uint64 _talonKingsCofferGUID; void Initialize() { AnzuEncounter = NOT_STARTED; m_uiIkissDoorGUID = 0; - _talonKingsCofferGUID = 0; + _talonKingsCofferGUID = 0; } void OnCreatureCreate(Creature* creature) { - if (creature->GetEntry() == NPC_ANZU || creature->GetEntry() == NPC_VOICE_OF_THE_RAVEN_GOD) + if (creature->GetEntry() == NPC_ANZU || creature->GetEntry() == NPC_VOICE_OF_THE_RAVEN_GOD) if (AnzuEncounter >= IN_PROGRESS) creature->DespawnOrUnsummon(1); } void OnGameObjectCreate(GameObject* go) { - switch (go->GetEntry()) - { - case GO_IKISS_DOOR: - m_uiIkissDoorGUID = go->GetGUID(); - break; - case GO_THE_TALON_KINGS_COFFER: - _talonKingsCofferGUID = go->GetGUID(); - break; - } + switch (go->GetEntry()) + { + case GO_IKISS_DOOR: + m_uiIkissDoorGUID = go->GetGUID(); + break; + case GO_THE_TALON_KINGS_COFFER: + _talonKingsCofferGUID = go->GetGUID(); + break; + } } void SetData(uint32 type, uint32 data) @@ -57,54 +57,54 @@ public: { case DATA_IKISSDOOREVENT: if (data == DONE) - { + { DoUseDoorOrButton(m_uiIkissDoorGUID, DAY*IN_MILLISECONDS); - if (GameObject* coffer = instance->GetGameObject(_talonKingsCofferGUID)) - coffer->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE|GO_FLAG_INTERACT_COND); - } + if (GameObject* coffer = instance->GetGameObject(_talonKingsCofferGUID)) + coffer->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE|GO_FLAG_INTERACT_COND); + } break; case TYPE_ANZU_ENCOUNTER: AnzuEncounter = data; - SaveToDB(); + SaveToDB(); break; } } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "S H " << AnzuEncounter; + std::ostringstream saveStream; + saveStream << "S H " << AnzuEncounter; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* strIn) - { - if (!strIn) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* strIn) + { + if (!strIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(strIn); + OUT_LOAD_INST_DATA(strIn); - char dataHead1, dataHead2; + char dataHead1, dataHead2; - std::istringstream loadStream(strIn); - loadStream >> dataHead1 >> dataHead2; + std::istringstream loadStream(strIn); + loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'S' && dataHead2 == 'H') - { - loadStream >> AnzuEncounter; - if (AnzuEncounter == IN_PROGRESS) - AnzuEncounter = NOT_STARTED; - } + if (dataHead1 == 'S' && dataHead2 == 'H') + { + loadStream >> AnzuEncounter; + if (AnzuEncounter == IN_PROGRESS) + AnzuEncounter = NOT_STARTED; + } - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } }; }; diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h index 76dd79981..2899bb5a4 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h @@ -13,11 +13,11 @@ enum eTypes enum eIds { - NPC_VOICE_OF_THE_RAVEN_GOD = 21851, - NPC_ANZU = 23035, + NPC_VOICE_OF_THE_RAVEN_GOD = 21851, + NPC_ANZU = 23035, - GO_IKISS_DOOR = 177203, - GO_THE_TALON_KINGS_COFFER = 187372 + GO_IKISS_DOOR = 177203, + GO_THE_TALON_KINGS_COFFER = 187372 }; #endif diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp index 9871a8d65..802c5cc7e 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp @@ -9,20 +9,20 @@ REWRITTEN BY XINEF enum eEnums { - SAY_INTRO = 0, - SAY_AGGRO = 1, - SAY_HELP = 2, - SAY_SLAY = 3, - SAY_DEATH = 4, + SAY_INTRO = 0, + SAY_AGGRO = 1, + SAY_HELP = 2, + SAY_SLAY = 3, + SAY_DEATH = 4, - SPELL_BANISH = 30231, - SPELL_CORROSIVE_ACID = 33551, - SPELL_FEAR = 33547, - SPELL_ENRAGE = 34970, + SPELL_BANISH = 30231, + SPELL_CORROSIVE_ACID = 33551, + SPELL_FEAR = 33547, + SPELL_ENRAGE = 34970, - EVENT_SPELL_CORROSIVE = 1, - EVENT_SPELL_FEAR = 2, - EVENT_SPELL_ENRAGE = 3 + EVENT_SPELL_CORROSIVE = 1, + EVENT_SPELL_FEAR = 2, + EVENT_SPELL_ENRAGE = 3 }; class boss_ambassador_hellmaw : public CreatureScript @@ -43,50 +43,50 @@ public: } InstanceScript* instance; - EventMap events; - bool isBanished; + EventMap events; + bool isBanished; - void DoAction(int32 param) - { - if (param != 1) - return; + void DoAction(int32 param) + { + if (param != 1) + return; - me->RemoveAurasDueToSpell(SPELL_BANISH); - Talk(SAY_INTRO); - Start(true, false, 0, NULL, false, true); - isBanished = false; - } + me->RemoveAurasDueToSpell(SPELL_BANISH); + Talk(SAY_INTRO); + Start(true, false, 0, NULL, false, true); + isBanished = false; + } void Reset() { events.Reset(); - isBanished = false; + isBanished = false; if (instance) { - instance->SetData(TYPE_HELLMAW, NOT_STARTED); + instance->SetData(TYPE_HELLMAW, NOT_STARTED); if (instance->GetData(TYPE_OVERSEER) != DONE) - { - isBanished = true; - me->CastSpell(me, SPELL_BANISH, true); - } - else - Start(true, false, 0, NULL, false, true); + { + isBanished = true; + me->CastSpell(me, SPELL_BANISH, true); + } + else + Start(true, false, 0, NULL, false, true); } } - void EnterCombat(Unit*) - { - if (isBanished) - return; - Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_CORROSIVE, urand(5000, 10000)); - events.ScheduleEvent(EVENT_SPELL_FEAR, urand(15000, 20000)); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 180000); + void EnterCombat(Unit*) + { + if (isBanished) + return; + Talk(SAY_AGGRO); + events.ScheduleEvent(EVENT_SPELL_CORROSIVE, urand(5000, 10000)); + events.ScheduleEvent(EVENT_SPELL_FEAR, urand(15000, 20000)); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 180000); - if (instance) + if (instance) instance->SetData(TYPE_HELLMAW, IN_PROGRESS); - } + } void MoveInLineOfSight(Unit* who) { @@ -95,7 +95,7 @@ public: npc_escortAI::MoveInLineOfSight(who); } - void AttackStart(Unit* who) + void AttackStart(Unit* who) { if (isBanished) return; @@ -108,8 +108,8 @@ public: void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && urand(0,1)) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER && urand(0,1)) + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) @@ -132,25 +132,25 @@ public: return; } - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_SPELL_CORROSIVE: - me->CastSpell(me->GetVictim(), SPELL_CORROSIVE_ACID, false); - events.RepeatEvent(urand(15000, 25000)); - break; - case EVENT_SPELL_FEAR: - me->CastSpell(me, SPELL_FEAR, false); - events.RepeatEvent(urand(20000, 35000)); - break; - case EVENT_SPELL_ENRAGE: - me->CastSpell(me->GetVictim(), SPELL_ENRAGE, false); - events.PopEvent(); - break; - } - - DoMeleeAttackIfReady(); - } + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_SPELL_CORROSIVE: + me->CastSpell(me->GetVictim(), SPELL_CORROSIVE_ACID, false); + events.RepeatEvent(urand(15000, 25000)); + break; + case EVENT_SPELL_FEAR: + me->CastSpell(me, SPELL_FEAR, false); + events.RepeatEvent(urand(20000, 35000)); + break; + case EVENT_SPELL_ENRAGE: + me->CastSpell(me->GetVictim(), SPELL_ENRAGE, false); + events.PopEvent(); + break; + } + + DoMeleeAttackIfReady(); + } }; }; diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp index cacfdf1e2..3967015f2 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp @@ -19,10 +19,10 @@ enum BlackheartTheInciter SAY_HELP = 3, SAY_DEATH = 4, - EVENT_SPELL_INCITE = 1, - EVENT_INCITE_WAIT = 2, - EVENT_SPELL_CHARGE = 3, - EVENT_SPELL_KNOCKBACK = 4 + EVENT_SPELL_INCITE = 1, + EVENT_INCITE_WAIT = 2, + EVENT_SPELL_CHARGE = 3, + EVENT_SPELL_KNOCKBACK = 4 }; class boss_blackheart_the_inciter : public CreatureScript @@ -43,7 +43,7 @@ public: } InstanceScript* instance; - EventMap events; + EventMap events; bool InciteChaos; @@ -58,8 +58,8 @@ public: void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && urand(0,1)) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER && urand(0,1)) + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) @@ -72,66 +72,66 @@ public: void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_INCITE, 20000); - events.ScheduleEvent(EVENT_INCITE_WAIT, 15000); - events.ScheduleEvent(EVENT_SPELL_CHARGE, 0); - events.ScheduleEvent(EVENT_SPELL_KNOCKBACK, 15000); + events.ScheduleEvent(EVENT_SPELL_INCITE, 20000); + events.ScheduleEvent(EVENT_INCITE_WAIT, 15000); + events.ScheduleEvent(EVENT_SPELL_CHARGE, 0); + events.ScheduleEvent(EVENT_SPELL_KNOCKBACK, 15000); if (instance) instance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, IN_PROGRESS); } - void EnterEvadeMode() - { - if (InciteChaos && SelectTargetFromPlayerList(100.0f)) - return; - CreatureAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + if (InciteChaos && SelectTargetFromPlayerList(100.0f)) + return; + CreatureAI::EnterEvadeMode(); + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_INCITE_WAIT: - InciteChaos = false; - events.PopEvent(); - break; - case EVENT_SPELL_INCITE: - { - me->CastSpell(me, SPELL_INCITE_CHAOS, false); + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_INCITE_WAIT: + InciteChaos = false; + events.PopEvent(); + break; + case EVENT_SPELL_INCITE: + { + me->CastSpell(me, SPELL_INCITE_CHAOS, false); - std::list t_list = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); - if (target && target->GetTypeId() == TYPEID_PLAYER) - me->CastSpell(target, SPELL_INCITE_CHAOS_B, true); - } + std::list t_list = me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); + if (target && target->GetTypeId() == TYPEID_PLAYER) + me->CastSpell(target, SPELL_INCITE_CHAOS_B, true); + } - DoResetThreat(); - InciteChaos = true; - events.DelayEvents(15000); - events.RepeatEvent(40000); - events.ScheduleEvent(EVENT_INCITE_WAIT, 15000); - break; - } - case EVENT_SPELL_CHARGE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_CHARGE, false); - events.RepeatEvent(urand(15000, 25000)); - break; - case EVENT_SPELL_KNOCKBACK: - me->CastSpell(me, SPELL_WAR_STOMP, false); - events.RepeatEvent(urand(18000, 24000)); - break; - } + DoResetThreat(); + InciteChaos = true; + events.DelayEvents(15000); + events.RepeatEvent(40000); + events.ScheduleEvent(EVENT_INCITE_WAIT, 15000); + break; + } + case EVENT_SPELL_CHARGE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_CHARGE, false); + events.RepeatEvent(urand(15000, 25000)); + break; + case EVENT_SPELL_KNOCKBACK: + me->CastSpell(me, SPELL_WAR_STOMP, false); + events.RepeatEvent(urand(18000, 24000)); + break; + } - if (InciteChaos) - return; + if (InciteChaos) + return; DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index 718f03aad..dc27c49a3 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -9,32 +9,32 @@ REWRITTEN BY XINEF enum GrandmasterVorpil { - SAY_INTRO = 0, - SAY_AGGRO = 1, - SAY_HELP = 2, - SAY_SLAY = 3, - SAY_DEATH = 4, + SAY_INTRO = 0, + SAY_AGGRO = 1, + SAY_HELP = 2, + SAY_SLAY = 3, + SAY_DEATH = 4, - SPELL_RAIN_OF_FIRE_N = 33617, - SPELL_RAIN_OF_FIRE_H = 39363, + SPELL_RAIN_OF_FIRE_N = 33617, + SPELL_RAIN_OF_FIRE_H = 39363, - SPELL_DRAW_SHADOWS = 33563, - SPELL_SHADOWBOLT_VOLLEY = 33841, - SPELL_BANISH = 38791, + SPELL_DRAW_SHADOWS = 33563, + SPELL_SHADOWBOLT_VOLLEY = 33841, + SPELL_BANISH = 38791, - NPC_VOID_TRAVELER = 19226, - SPELL_SACRIFICE = 33587, - SPELL_SHADOW_NOVA = 33846, - SPELL_EMPOWERING_SHADOWS_N = 33783, - SPELL_EMPOWERING_SHADOWS_H = 39364, + NPC_VOID_TRAVELER = 19226, + SPELL_SACRIFICE = 33587, + SPELL_SHADOW_NOVA = 33846, + SPELL_EMPOWERING_SHADOWS_N = 33783, + SPELL_EMPOWERING_SHADOWS_H = 39364, - NPC_VOID_PORTAL = 19224, - SPELL_VOID_PORTAL_VISUAL = 33569, + NPC_VOID_PORTAL = 19224, + SPELL_VOID_PORTAL_VISUAL = 33569, - EVENT_SPELL_SHADOWBOLT = 1, - EVENT_SPELL_DRAWSHADOWS = 2, - EVENT_SUMMON_TRAVELER = 3, - EVENT_SPELL_BANISH = 4 + EVENT_SPELL_SHADOWBOLT = 1, + EVENT_SPELL_DRAWSHADOWS = 2, + EVENT_SUMMON_TRAVELER = 3, + EVENT_SPELL_BANISH = 4 }; float VorpilPosition[3] = {-252.8820f, -264.3030f, 17.1f}; @@ -67,16 +67,16 @@ public: } InstanceScript* instance; - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; bool sayIntro, sayHelp; void Reset() { sayHelp = false; - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); if (instance) instance->SetData(DATA_GRANDMASTERVORPILEVENT, NOT_STARTED); @@ -84,8 +84,8 @@ public: void summonPortals() { - for (uint8 i = 0; i < 5; ++i) - me->SummonCreature(NPC_VOID_PORTAL, VoidPortalCoords[i][0], VoidPortalCoords[i][1], VoidPortalCoords[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 3000000); + for (uint8 i = 0; i < 5; ++i) + me->SummonCreature(NPC_VOID_PORTAL, VoidPortalCoords[i][0], VoidPortalCoords[i][1], VoidPortalCoords[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 3000000); } void spawnVoidTraveler() @@ -101,17 +101,17 @@ public: void JustSummoned(Creature* summon) { - summons.Summon(summon); + summons.Summon(summon); if (summon->GetEntry() == NPC_VOID_TRAVELER) summon->AI()->SetGUID(me->GetGUID()); - else if (summon->GetEntry() == NPC_VOID_PORTAL) - summon->CastSpell(summon, SPELL_VOID_PORTAL_VISUAL, false); + else if (summon->GetEntry() == NPC_VOID_PORTAL) + summon->CastSpell(summon, SPELL_VOID_PORTAL_VISUAL, false); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) @@ -128,11 +128,11 @@ public: Talk(SAY_AGGRO); summonPortals(); - events.ScheduleEvent(EVENT_SPELL_SHADOWBOLT, urand(7000, 14000)); - events.ScheduleEvent(EVENT_SPELL_DRAWSHADOWS, 45000); - events.ScheduleEvent(EVENT_SUMMON_TRAVELER, 5000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_BANISH, 17000); + events.ScheduleEvent(EVENT_SPELL_SHADOWBOLT, urand(7000, 14000)); + events.ScheduleEvent(EVENT_SPELL_DRAWSHADOWS, 45000); + events.ScheduleEvent(EVENT_SUMMON_TRAVELER, 5000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_BANISH, 17000); if (instance) instance->SetData(DATA_GRANDMASTERVORPILEVENT, IN_PROGRESS); @@ -154,40 +154,40 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_SPELL_SHADOWBOLT: - me->CastSpell(me, SPELL_SHADOWBOLT_VOLLEY, false); - events.RepeatEvent(urand(15000, 30000)); - break; - case EVENT_SPELL_BANISH: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, false)) - me->CastSpell(target, SPELL_BANISH, false); - events.RepeatEvent(16000); - break; - case EVENT_SUMMON_TRAVELER: - spawnVoidTraveler(); - events.RepeatEvent(HealthBelowPct(20) ? 5000: 10000); - break; - case EVENT_SPELL_DRAWSHADOWS: - { - Map* map = me->GetMap(); - Map::PlayerList const &PlayerList = map->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* player = i->GetSource()) - if (player->IsAlive() && !player->HasAura(SPELL_BANISH)) - player->TeleportTo(me->GetMapId(), VorpilPosition[0], VorpilPosition[1], VorpilPosition[2], 0, TELE_TO_NOT_LEAVE_COMBAT); + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_SPELL_SHADOWBOLT: + me->CastSpell(me, SPELL_SHADOWBOLT_VOLLEY, false); + events.RepeatEvent(urand(15000, 30000)); + break; + case EVENT_SPELL_BANISH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, false)) + me->CastSpell(target, SPELL_BANISH, false); + events.RepeatEvent(16000); + break; + case EVENT_SUMMON_TRAVELER: + spawnVoidTraveler(); + events.RepeatEvent(HealthBelowPct(20) ? 5000: 10000); + break; + case EVENT_SPELL_DRAWSHADOWS: + { + Map* map = me->GetMap(); + Map::PlayerList const &PlayerList = map->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* player = i->GetSource()) + if (player->IsAlive() && !player->HasAura(SPELL_BANISH)) + player->TeleportTo(me->GetMapId(), VorpilPosition[0], VorpilPosition[1], VorpilPosition[2], 0, TELE_TO_NOT_LEAVE_COMBAT); - me->NearTeleportTo(VorpilPosition[0], VorpilPosition[1], VorpilPosition[2], 0.0f); - me->CastSpell(me, SPELL_DRAW_SHADOWS, true); - me->CastSpell(me, SPELL_RAIN_OF_FIRE_N); + me->NearTeleportTo(VorpilPosition[0], VorpilPosition[1], VorpilPosition[2], 0.0f); + me->CastSpell(me, SPELL_DRAW_SHADOWS, true); + me->CastSpell(me, SPELL_RAIN_OF_FIRE_N); - events.RepeatEvent(24000); - events.DelayEvents(6000); - break; - } - } + events.RepeatEvent(24000); + events.DelayEvents(6000); + break; + } + } DoMeleeAttackIfReady(); } @@ -208,8 +208,8 @@ public: { npc_voidtravelerAI(Creature* creature) : ScriptedAI(creature) { - VorpilGUID = 0; - moveTimer = 1000; + VorpilGUID = 0; + moveTimer = 1000; sacrificed = false; } @@ -217,41 +217,41 @@ public: uint32 moveTimer; bool sacrificed; - void SetGUID(uint64 guid, int32) - { - VorpilGUID = guid; - } + void SetGUID(uint64 guid, int32) + { + VorpilGUID = guid; + } void UpdateAI(uint32 diff) { - moveTimer += diff; + moveTimer += diff; if (moveTimer >= 1000) { - moveTimer = 0; + moveTimer = 0; Creature* Vorpil = ObjectAccessor::GetCreature(*me, VorpilGUID); if (!Vorpil) { me->DespawnOrUnsummon(); return; } - me->GetMotionMaster()->MoveFollow(Vorpil, 0.0f, 0.0f); + me->GetMotionMaster()->MoveFollow(Vorpil, 0.0f, 0.0f); if (sacrificed) { me->AddAura(DUNGEON_MODE(SPELL_EMPOWERING_SHADOWS_N, SPELL_EMPOWERING_SHADOWS_H), Vorpil); Vorpil->ModifyHealth(int32(Vorpil->CountPctFromMaxHealth(4))); - me->CastSpell(me, SPELL_SHADOW_NOVA, true); + me->CastSpell(me, SPELL_SHADOW_NOVA, true); Unit::Kill(me, me); return; } if (me->IsWithinDist(Vorpil, 3.0f)) { - me->CastSpell(me, SPELL_SACRIFICE, false); + me->CastSpell(me, SPELL_SACRIFICE, false); sacrificed = true; moveTimer = 500; } - } + } } }; }; diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp index 9cf83b4a6..7ef1b5965 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp @@ -9,27 +9,27 @@ REWRITTEN BY XINEF enum Murmur { - EMOTE_SONIC_BOOM = 0, + EMOTE_SONIC_BOOM = 0, - SPELL_RESONANCE = 33657, - SPELL_MAGNETIC_PULL = 33689, - SPELL_SONIC_SHOCK = 38797, - SPELL_THUNDERING_STORM = 39365, + SPELL_RESONANCE = 33657, + SPELL_MAGNETIC_PULL = 33689, + SPELL_SONIC_SHOCK = 38797, + SPELL_THUNDERING_STORM = 39365, - SPELL_SONIC_BOOM_CAST_N = 33923, - SPELL_SONIC_BOOM_CAST_H = 38796, - SPELL_SONIC_BOOM_EFFECT_N = 38795, - SPELL_SONIC_BOOM_EFFECT_H = 33666, - SPELL_MURMURS_TOUCH_N = 33711, - SPELL_MURMURS_TOUCH_H = 38794, + SPELL_SONIC_BOOM_CAST_N = 33923, + SPELL_SONIC_BOOM_CAST_H = 38796, + SPELL_SONIC_BOOM_EFFECT_N = 38795, + SPELL_SONIC_BOOM_EFFECT_H = 33666, + SPELL_MURMURS_TOUCH_N = 33711, + SPELL_MURMURS_TOUCH_H = 38794, - EVENT_SPELL_SONIC_BOOM = 1, - EVENT_SPELL_SONIC_BOOM_EFFECT = 2, - EVENT_SPELL_MURMURS_TOUCH = 3, - EVENT_SPELL_RESONANCE = 4, - EVENT_SPELL_MAGNETIC = 5, - EVENT_SPELL_THUNDERING = 6, - EVENT_SPELL_SONIC_SHOCK = 7 + EVENT_SPELL_SONIC_BOOM = 1, + EVENT_SPELL_SONIC_BOOM_EFFECT = 2, + EVENT_SPELL_MURMURS_TOUCH = 3, + EVENT_SPELL_RESONANCE = 4, + EVENT_SPELL_MAGNETIC = 5, + EVENT_SPELL_THUNDERING = 6, + EVENT_SPELL_SONIC_SHOCK = 7 }; class boss_murmur : public CreatureScript @@ -47,91 +47,91 @@ public: boss_murmurAI(Creature* creature) : ScriptedAI(creature) { SetCombatMovement(false); - instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* instance; - EventMap events; + InstanceScript* instance; + EventMap events; void Reset() { - events.Reset(); + events.Reset(); me->SetHealth(me->CountPctFromMaxHealth(40)); me->ResetPlayerDamageReq(); - if (instance) - instance->SetData(DATA_MURMUREVENT, NOT_STARTED); + if (instance) + instance->SetData(DATA_MURMUREVENT, NOT_STARTED); } void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SPELL_SONIC_BOOM, 30000); - events.ScheduleEvent(EVENT_SPELL_MURMURS_TOUCH, urand(8000, 20000)); - events.ScheduleEvent(EVENT_SPELL_RESONANCE, 5000); - events.ScheduleEvent(EVENT_SPELL_MAGNETIC, urand(15000, 30000)); - if (IsHeroic()) - { - events.ScheduleEvent(EVENT_SPELL_THUNDERING, 15000); - events.ScheduleEvent(EVENT_SPELL_SONIC_SHOCK, 10000); - } + { + events.ScheduleEvent(EVENT_SPELL_SONIC_BOOM, 30000); + events.ScheduleEvent(EVENT_SPELL_MURMURS_TOUCH, urand(8000, 20000)); + events.ScheduleEvent(EVENT_SPELL_RESONANCE, 5000); + events.ScheduleEvent(EVENT_SPELL_MAGNETIC, urand(15000, 30000)); + if (IsHeroic()) + { + events.ScheduleEvent(EVENT_SPELL_THUNDERING, 15000); + events.ScheduleEvent(EVENT_SPELL_SONIC_SHOCK, 10000); + } - if (instance) - instance->SetData(DATA_MURMUREVENT, IN_PROGRESS); - } + if (instance) + instance->SetData(DATA_MURMUREVENT, IN_PROGRESS); + } - void JustDied(Unit*) - { - if (instance) - instance->SetData(DATA_MURMUREVENT, DONE); - } + void JustDied(Unit*) + { + if (instance) + instance->SetData(DATA_MURMUREVENT, DONE); + } void UpdateAI(uint32 diff) { if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING)) return; - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_SPELL_SONIC_BOOM: - Talk(EMOTE_SONIC_BOOM); - me->CastSpell(me, DUNGEON_MODE(SPELL_SONIC_BOOM_CAST_N, SPELL_SONIC_BOOM_CAST_H), false); - events.RepeatEvent(28500); - events.DelayEvents(1500); - events.ScheduleEvent(EVENT_SPELL_SONIC_BOOM_EFFECT, 0); - return; - case EVENT_SPELL_SONIC_BOOM_EFFECT: - me->CastSpell(me, DUNGEON_MODE(SPELL_SONIC_BOOM_EFFECT_N, SPELL_SONIC_BOOM_EFFECT_H), true); - events.PopEvent(); - break; - case EVENT_SPELL_MURMURS_TOUCH: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) - me->CastSpell(target, DUNGEON_MODE(SPELL_MURMURS_TOUCH_N, SPELL_MURMURS_TOUCH_H), false); - events.RepeatEvent(urand(25000, 35000)); - break; - case EVENT_SPELL_RESONANCE: - if (!me->IsWithinMeleeRange(me->GetVictim())) - me->CastSpell(me, SPELL_RESONANCE, false); - events.RepeatEvent(5000); - break; - case EVENT_SPELL_MAGNETIC: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) - { - me->CastSpell(target, SPELL_MAGNETIC_PULL, false); - events.RepeatEvent(urand(15000, 30000)); - return; - } - events.RepeatEvent(500); - break; - case EVENT_SPELL_THUNDERING: - me->CastSpell(me, SPELL_THUNDERING_STORM, true); + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_SPELL_SONIC_BOOM: + Talk(EMOTE_SONIC_BOOM); + me->CastSpell(me, DUNGEON_MODE(SPELL_SONIC_BOOM_CAST_N, SPELL_SONIC_BOOM_CAST_H), false); + events.RepeatEvent(28500); + events.DelayEvents(1500); + events.ScheduleEvent(EVENT_SPELL_SONIC_BOOM_EFFECT, 0); + return; + case EVENT_SPELL_SONIC_BOOM_EFFECT: + me->CastSpell(me, DUNGEON_MODE(SPELL_SONIC_BOOM_EFFECT_N, SPELL_SONIC_BOOM_EFFECT_H), true); + events.PopEvent(); + break; + case EVENT_SPELL_MURMURS_TOUCH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) + me->CastSpell(target, DUNGEON_MODE(SPELL_MURMURS_TOUCH_N, SPELL_MURMURS_TOUCH_H), false); + events.RepeatEvent(urand(25000, 35000)); + break; + case EVENT_SPELL_RESONANCE: + if (!me->IsWithinMeleeRange(me->GetVictim())) + me->CastSpell(me, SPELL_RESONANCE, false); + events.RepeatEvent(5000); + break; + case EVENT_SPELL_MAGNETIC: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) + { + me->CastSpell(target, SPELL_MAGNETIC_PULL, false); + events.RepeatEvent(urand(15000, 30000)); + return; + } + events.RepeatEvent(500); + break; + case EVENT_SPELL_THUNDERING: + me->CastSpell(me, SPELL_THUNDERING_STORM, true); events.RepeatEvent(15000); - break; - case EVENT_SPELL_SONIC_SHOCK: - me->CastSpell(me->GetVictim(), SPELL_SONIC_SHOCK, false); + break; + case EVENT_SPELL_SONIC_SHOCK: + me->CastSpell(me->GetVictim(), SPELL_SONIC_SHOCK, false); events.RepeatEvent(urand(10000, 20000)); - break; - } + break; + } if (!me->isAttackReady()) return; @@ -193,8 +193,8 @@ class spell_murmur_thundering_storm : public SpellScriptLoader void SelectTarget(std::list& targets) { - targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 100.0f, true)); - targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 25.0f, false)); + targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 100.0f, true)); + targets.remove_if(Trinity::AllWorldObjectsInExactRange(GetCaster(), 25.0f, false)); } void Register() @@ -212,6 +212,6 @@ class spell_murmur_thundering_storm : public SpellScriptLoader void AddSC_boss_murmur() { new boss_murmur(); - new spell_murmur_sonic_boom_effect(); - new spell_murmur_thundering_storm(); + new spell_murmur_sonic_boom_effect(); + new spell_murmur_thundering_storm(); } diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp index 54996079e..5baaee4a8 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp @@ -22,7 +22,7 @@ public: uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 m_uiHellmawGUID; + uint64 m_uiHellmawGUID; uint64 m_uiRefectoryDoorGUID; uint64 m_uiScreamingHallDoorGUID; @@ -32,7 +32,7 @@ public: { memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - m_uiHellmawGUID = 0; + m_uiHellmawGUID = 0; m_uiRefectoryDoorGUID = 0; m_uiScreamingHallDoorGUID = 0; @@ -73,9 +73,9 @@ public: if (creature->IsAlive()) ++m_uiFelOverseerCount; break; - case NPC_HELLMAW: - m_uiHellmawGUID = creature->GetGUID(); - break; + case NPC_HELLMAW: + m_uiHellmawGUID = creature->GetGUID(); + break; } } @@ -83,13 +83,13 @@ public: { switch (type) { - case TYPE_OVERSEER: + case TYPE_OVERSEER: if (!--m_uiFelOverseerCount) - { + { m_auiEncounter[type] = DONE; - if (Creature* cr = instance->GetCreature(m_uiHellmawGUID)) - cr->AI()->DoAction(1); - } + if (Creature* cr = instance->GetCreature(m_uiHellmawGUID)) + cr->AI()->DoAction(1); + } break; case DATA_BLACKHEARTTHEINCITEREVENT: @@ -105,7 +105,7 @@ public: break; case DATA_MURMUREVENT: - case TYPE_HELLMAW: + case TYPE_HELLMAW: m_auiEncounter[type] = uiData; break; } @@ -117,7 +117,7 @@ public: uint32 GetData(uint32 type) const { if (type == TYPE_OVERSEER) - return m_auiEncounter[0]; + return m_auiEncounter[0]; return 0; } @@ -140,18 +140,18 @@ public: OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; + char dataHead1, dataHead2; std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'S' && dataHead2 == 'L') - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - loadStream >> m_auiEncounter[i]; - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } - } + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + loadStream >> m_auiEncounter[i]; + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } + } OUT_LOAD_INST_DATA_COMPLETE; } diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h index 2afdb0def..731b99b3e 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h @@ -7,21 +7,21 @@ REWRITTEN BY XINEF enum slData { - TYPE_OVERSEER = 0, - TYPE_HELLMAW = 1, - DATA_BLACKHEARTTHEINCITEREVENT = 2, - DATA_GRANDMASTERVORPILEVENT = 3, - DATA_MURMUREVENT = 4, - MAX_ENCOUNTER = 5 + TYPE_OVERSEER = 0, + TYPE_HELLMAW = 1, + DATA_BLACKHEARTTHEINCITEREVENT = 2, + DATA_GRANDMASTERVORPILEVENT = 3, + DATA_MURMUREVENT = 4, + MAX_ENCOUNTER = 5 }; enum slNPCandGO { - NPC_FEL_OVERSEER = 18796, - NPC_HELLMAW = 18731, + NPC_FEL_OVERSEER = 18796, + NPC_HELLMAW = 18731, - REFECTORY_DOOR = 183296, //door opened when blackheart the inciter dies - SCREAMING_HALL_DOOR = 183295 //door opened when grandmaster vorpil dies + REFECTORY_DOOR = 183296, //door opened when blackheart the inciter dies + SCREAMING_HALL_DOOR = 183295 //door opened when grandmaster vorpil dies }; #endif diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.h b/src/server/scripts/Outland/BlackTemple/black_temple.h index 607f4c561..71b6d6255 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.h +++ b/src/server/scripts/Outland/BlackTemple/black_temple.h @@ -16,36 +16,36 @@ enum DataTypes DATA_RELIQUARY_OF_SOULS = 5, DATA_MOTHER_SHAHRAZ = 6, DATA_ILLIDARI_COUNCIL = 7, - DATA_AKAMA_FINISHED = 8, + DATA_AKAMA_FINISHED = 8, DATA_ILLIDAN_STORMRAGE = 9, - MAX_ENCOUNTERS = 10 + MAX_ENCOUNTERS = 10 }; enum CreatureIds { NPC_SHADE_OF_AKAMA = 22841, NPC_AKAMA_SHADE = 23191, - NPC_STORM_FURY = 22848, - NPC_TERON_GOREFIEND = 22871, - NPC_VENGEFUL_SPIRIT = 23109, - NPC_SHADOWY_CONSTRUCT = 23111, - NPC_ANGERED_SOUL_FRAGMENT = 23398, - NPC_HUNGERING_SOUL_FRAGMENT = 23401, - NPC_SUFFERING_SOUL_FRAGMENT = 23399, - NPC_RELIQUARY_OF_THE_LOST = 22856, - NPC_ENSLAVED_SOUL = 23469, - NPC_GATHIOS_THE_SHATTERER = 22949, - NPC_HIGH_NETHERMANCER_ZEREVOR = 22950, - NPC_LADY_MALANDE = 22951, - NPC_VERAS_DARKSHADOW = 22952, - NPC_ILLIDARI_COUNCIL = 23426, + NPC_STORM_FURY = 22848, + NPC_TERON_GOREFIEND = 22871, + NPC_VENGEFUL_SPIRIT = 23109, + NPC_SHADOWY_CONSTRUCT = 23111, + NPC_ANGERED_SOUL_FRAGMENT = 23398, + NPC_HUNGERING_SOUL_FRAGMENT = 23401, + NPC_SUFFERING_SOUL_FRAGMENT = 23399, + NPC_RELIQUARY_OF_THE_LOST = 22856, + NPC_ENSLAVED_SOUL = 23469, + NPC_GATHIOS_THE_SHATTERER = 22949, + NPC_HIGH_NETHERMANCER_ZEREVOR = 22950, + NPC_LADY_MALANDE = 22951, + NPC_VERAS_DARKSHADOW = 22952, + NPC_ILLIDARI_COUNCIL = 23426, NPC_AKAMA = 23089, NPC_ILLIDAN_STORMRAGE = 22917, - NPC_PARASITIC_SHADOWFIEND = 23498, - NPC_BLADE_OF_AZZINOTH = 22996, - NPC_FLAME_OF_AZZINOTH = 22997, + NPC_PARASITIC_SHADOWFIEND = 23498, + NPC_BLADE_OF_AZZINOTH = 22996, + NPC_FLAME_OF_AZZINOTH = 22997, - NPC_DRAGON_TURTLE = 22885 + NPC_DRAGON_TURTLE = 22885 }; enum GameObjectIds @@ -67,14 +67,14 @@ enum GameObjectIds enum MiscIds { - SPELL_CHEST_PAINS = 41356, - SPELL_WYVERN_STING = 24336, - SPELL_SHADOW_INFERNO_DAMAGE = 39646, - SPELL_CHAOTIC_CHARGE = 41033, - SPELL_DEMENTIA1 = 41406, - SPELL_DEMENTIA2 = 41409, + SPELL_CHEST_PAINS = 41356, + SPELL_WYVERN_STING = 24336, + SPELL_SHADOW_INFERNO_DAMAGE = 39646, + SPELL_CHAOTIC_CHARGE = 41033, + SPELL_DEMENTIA1 = 41406, + SPELL_DEMENTIA2 = 41409, - FACTION_ASHTONGUE = 1820 + FACTION_ASHTONGUE = 1820 }; #endif // BLACK_TEMPLE_H_ diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp index 661967e2f..fc519efb7 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp @@ -8,181 +8,181 @@ REWRITTEN BY XINEF enum Says { - SAY_AGGRO = 0, - SAY_SLAY = 1, - SAY_SPECIAL = 2, - SAY_ENRAGE = 3, - SAY_DEATH = 4 + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_SPECIAL = 2, + SAY_ENRAGE = 3, + SAY_DEATH = 4 }; enum Spells { - SPELL_ACIDIC_WOUND = 40484, - SPELL_FEL_ACID_BREATH1 = 40508, - SPELL_FEL_ACID_BREATH2 = 40595, - SPELL_ARCING_SMASH1 = 40457, - SPELL_ARCING_SMASH2 = 40599, - SPELL_EJECT1 = 40486, - SPELL_EJECT2 = 40597, - SPELL_BEWILDERING_STRIKE = 40491, - SPELL_BLOODBOIL = 42005, - SPELL_ACID_GEYSER = 40630, - SPELL_BERSERK = 45078, - SPELL_CHARGE = 40602, + SPELL_ACIDIC_WOUND = 40484, + SPELL_FEL_ACID_BREATH1 = 40508, + SPELL_FEL_ACID_BREATH2 = 40595, + SPELL_ARCING_SMASH1 = 40457, + SPELL_ARCING_SMASH2 = 40599, + SPELL_EJECT1 = 40486, + SPELL_EJECT2 = 40597, + SPELL_BEWILDERING_STRIKE = 40491, + SPELL_BLOODBOIL = 42005, + SPELL_ACID_GEYSER = 40630, + SPELL_BERSERK = 45078, + SPELL_CHARGE = 40602, - SPELL_FEL_GEYSER_SUMMON = 40569, - SPELL_FEL_GEYSER_STUN = 40591, - SPELL_FEL_GEYSER_DAMAGE = 40593, + SPELL_FEL_GEYSER_SUMMON = 40569, + SPELL_FEL_GEYSER_STUN = 40591, + SPELL_FEL_GEYSER_DAMAGE = 40593, - SPELL_FEL_RAGE_SELF = 40594, - SPELL_FEL_RAGE_TARGET = 40604, - SPELL_FEL_RAGE_2 = 40616, - SPELL_FEL_RAGE_3 = 41625, - SPELL_FEL_RAGE_SIZE = 46787, - SPELL_TAUNT_GURTOGG = 40603, - SPELL_INSIGNIFICANCE = 40618 + SPELL_FEL_RAGE_SELF = 40594, + SPELL_FEL_RAGE_TARGET = 40604, + SPELL_FEL_RAGE_2 = 40616, + SPELL_FEL_RAGE_3 = 41625, + SPELL_FEL_RAGE_SIZE = 46787, + SPELL_TAUNT_GURTOGG = 40603, + SPELL_INSIGNIFICANCE = 40618 }; enum Misc { - EVENT_SPELL_BLOOD_BOIL = 1, - EVENT_SPELL_BEWILDERING_STRIKE = 2, - EVENT_SPELL_FEL_ACID_BREATH = 3, - EVENT_SPELL_EJECT = 4, - EVENT_SPELL_ARCING_SMASH = 5, - EVENT_SPELL_CHARGE = 6, - EVENT_SPELL_BERSERK = 7, - EVENT_SPELL_FEL_GEYSER = 8, - EVENT_KILL_TALK = 9, + EVENT_SPELL_BLOOD_BOIL = 1, + EVENT_SPELL_BEWILDERING_STRIKE = 2, + EVENT_SPELL_FEL_ACID_BREATH = 3, + EVENT_SPELL_EJECT = 4, + EVENT_SPELL_ARCING_SMASH = 5, + EVENT_SPELL_CHARGE = 6, + EVENT_SPELL_BERSERK = 7, + EVENT_SPELL_FEL_GEYSER = 8, + EVENT_KILL_TALK = 9, - GROUP_DELAY = 1 + GROUP_DELAY = 1 }; class boss_gurtogg_bloodboil : public CreatureScript { - public: - boss_gurtogg_bloodboil() : CreatureScript("boss_gurtogg_bloodboil") { } + public: + boss_gurtogg_bloodboil() : CreatureScript("boss_gurtogg_bloodboil") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_gurtogg_bloodboilAI : public BossAI - { - boss_gurtogg_bloodboilAI(Creature* creature) : BossAI(creature, DATA_GURTOGG_BLOODBOIL) - { - } + struct boss_gurtogg_bloodboilAI : public BossAI + { + boss_gurtogg_bloodboilAI(Creature* creature) : BossAI(creature, DATA_GURTOGG_BLOODBOIL) + { + } - void Reset() - { - BossAI::Reset(); - } + void Reset() + { + BossAI::Reset(); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); - me->CastSpell(me, SPELL_ACIDIC_WOUND, true); - events.ScheduleEvent(EVENT_SPELL_BLOOD_BOIL, 10000); - events.ScheduleEvent(EVENT_SPELL_BEWILDERING_STRIKE, 28000, GROUP_DELAY); - events.ScheduleEvent(EVENT_SPELL_FEL_ACID_BREATH, 38000); - events.ScheduleEvent(EVENT_SPELL_EJECT, 14000); - events.ScheduleEvent(EVENT_SPELL_ARCING_SMASH, 5000); - events.ScheduleEvent(EVENT_SPELL_FEL_GEYSER, 60000); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); - } + me->CastSpell(me, SPELL_ACIDIC_WOUND, true); + events.ScheduleEvent(EVENT_SPELL_BLOOD_BOIL, 10000); + events.ScheduleEvent(EVENT_SPELL_BEWILDERING_STRIKE, 28000, GROUP_DELAY); + events.ScheduleEvent(EVENT_SPELL_FEL_ACID_BREATH, 38000); + events.ScheduleEvent(EVENT_SPELL_EJECT, 14000); + events.ScheduleEvent(EVENT_SPELL_ARCING_SMASH, 5000); + events.ScheduleEvent(EVENT_SPELL_FEL_GEYSER, 60000); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); + } - void KilledUnit(Unit* victim) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* victim) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->CastSpell(summon, SPELL_FEL_GEYSER_DAMAGE, false); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->CastSpell(summon, SPELL_FEL_GEYSER_DAMAGE, false); + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - Talk(SAY_DEATH); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + Talk(SAY_DEATH); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_BERSERK: - Talk(SAY_ENRAGE); - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_SPELL_BLOOD_BOIL: - me->CastCustomSpell(SPELL_BLOODBOIL, SPELLVALUE_MAX_TARGETS, 5, me, false); - events.ScheduleEvent(EVENT_SPELL_BLOOD_BOIL, 10000); - break; - case EVENT_SPELL_BEWILDERING_STRIKE: - me->CastSpell(me->GetVictim(), SPELL_BEWILDERING_STRIKE, false); - events.ScheduleEvent(EVENT_SPELL_BEWILDERING_STRIKE, 30000, GROUP_DELAY); - break; - case EVENT_SPELL_FEL_ACID_BREATH: - me->CastSpell(me->GetVictim(), me->HasAura(SPELL_FEL_RAGE_SELF) ? SPELL_FEL_ACID_BREATH2 : SPELL_FEL_ACID_BREATH1, false); - events.ScheduleEvent(EVENT_SPELL_FEL_ACID_BREATH, 30000); - break; - case EVENT_SPELL_EJECT: - me->CastSpell(me->GetVictim(), me->HasAura(SPELL_FEL_RAGE_SELF) ? SPELL_EJECT2 : SPELL_EJECT1, false); - events.ScheduleEvent(EVENT_SPELL_EJECT, 20000); - break; - case EVENT_SPELL_ARCING_SMASH: - me->CastSpell(me->GetVictim(), me->HasAura(SPELL_FEL_RAGE_SELF) ? SPELL_ARCING_SMASH2 : SPELL_ARCING_SMASH1, false); - events.ScheduleEvent(EVENT_SPELL_ARCING_SMASH, 15000); - break; - case EVENT_SPELL_FEL_GEYSER: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 40.0f, true)) - { - me->RemoveAurasByType(SPELL_AURA_MOD_TAUNT); - me->CastSpell(me, SPELL_FEL_RAGE_SELF, true); - me->CastSpell(target, SPELL_FEL_RAGE_TARGET, true); - me->CastSpell(target, SPELL_FEL_RAGE_2, true); - me->CastSpell(target, SPELL_FEL_RAGE_3, true); - me->CastSpell(target, SPELL_FEL_RAGE_SIZE, true); - target->CastSpell(me, SPELL_TAUNT_GURTOGG, true); + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_BERSERK: + Talk(SAY_ENRAGE); + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_SPELL_BLOOD_BOIL: + me->CastCustomSpell(SPELL_BLOODBOIL, SPELLVALUE_MAX_TARGETS, 5, me, false); + events.ScheduleEvent(EVENT_SPELL_BLOOD_BOIL, 10000); + break; + case EVENT_SPELL_BEWILDERING_STRIKE: + me->CastSpell(me->GetVictim(), SPELL_BEWILDERING_STRIKE, false); + events.ScheduleEvent(EVENT_SPELL_BEWILDERING_STRIKE, 30000, GROUP_DELAY); + break; + case EVENT_SPELL_FEL_ACID_BREATH: + me->CastSpell(me->GetVictim(), me->HasAura(SPELL_FEL_RAGE_SELF) ? SPELL_FEL_ACID_BREATH2 : SPELL_FEL_ACID_BREATH1, false); + events.ScheduleEvent(EVENT_SPELL_FEL_ACID_BREATH, 30000); + break; + case EVENT_SPELL_EJECT: + me->CastSpell(me->GetVictim(), me->HasAura(SPELL_FEL_RAGE_SELF) ? SPELL_EJECT2 : SPELL_EJECT1, false); + events.ScheduleEvent(EVENT_SPELL_EJECT, 20000); + break; + case EVENT_SPELL_ARCING_SMASH: + me->CastSpell(me->GetVictim(), me->HasAura(SPELL_FEL_RAGE_SELF) ? SPELL_ARCING_SMASH2 : SPELL_ARCING_SMASH1, false); + events.ScheduleEvent(EVENT_SPELL_ARCING_SMASH, 15000); + break; + case EVENT_SPELL_FEL_GEYSER: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 40.0f, true)) + { + me->RemoveAurasByType(SPELL_AURA_MOD_TAUNT); + me->CastSpell(me, SPELL_FEL_RAGE_SELF, true); + me->CastSpell(target, SPELL_FEL_RAGE_TARGET, true); + me->CastSpell(target, SPELL_FEL_RAGE_2, true); + me->CastSpell(target, SPELL_FEL_RAGE_3, true); + me->CastSpell(target, SPELL_FEL_RAGE_SIZE, true); + target->CastSpell(me, SPELL_TAUNT_GURTOGG, true); - me->CastSpell(target, SPELL_FEL_GEYSER_SUMMON, true); - me->CastSpell(me, SPELL_FEL_GEYSER_STUN, true); - me->CastSpell(me, SPELL_INSIGNIFICANCE, true); - events.ScheduleEvent(EVENT_SPELL_CHARGE, 2000); - events.DelayEvents(30000, GROUP_DELAY); - } - events.ScheduleEvent(EVENT_SPELL_FEL_GEYSER, 90000); - break; - case EVENT_SPELL_CHARGE: - me->CastSpell(me->GetVictim(), SPELL_CHARGE, true); - break; - } + me->CastSpell(target, SPELL_FEL_GEYSER_SUMMON, true); + me->CastSpell(me, SPELL_FEL_GEYSER_STUN, true); + me->CastSpell(me, SPELL_INSIGNIFICANCE, true); + events.ScheduleEvent(EVENT_SPELL_CHARGE, 2000); + events.DelayEvents(30000, GROUP_DELAY); + } + events.ScheduleEvent(EVENT_SPELL_FEL_GEYSER, 90000); + break; + case EVENT_SPELL_CHARGE: + me->CastSpell(me->GetVictim(), SPELL_CHARGE, true); + break; + } - DoMeleeAttackIfReady(); - EnterEvadeIfOutOfCombatArea(); - } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetHomePosition().GetExactDist2d(me) > 105.0f; - } - }; + DoMeleeAttackIfReady(); + EnterEvadeIfOutOfCombatArea(); + } + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetHomePosition().GetExactDist2d(me) > 105.0f; + } + }; }; @@ -197,16 +197,16 @@ class spell_gurtogg_bloodboil : public SpellScriptLoader void FilterTargets(std::list& targets) { - if (targets.empty()) - return; + if (targets.empty()) + return; - targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false)); - if (targets.size() > GetSpellValue()->MaxAffectedTargets) - { - std::list::iterator itr = targets.begin(); - std::advance(itr, GetSpellValue()->MaxAffectedTargets); - targets.erase(itr, targets.end()); - } + targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false)); + if (targets.size() > GetSpellValue()->MaxAffectedTargets) + { + std::list::iterator itr = targets.begin(); + std::advance(itr, GetSpellValue()->MaxAffectedTargets); + targets.erase(itr, targets.end()); + } } void Register() @@ -232,9 +232,9 @@ class spell_gurtogg_eject : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitEffect(effIndex); - if (Unit* target = GetHitUnit()) - GetCaster()->getThreatManager().modifyThreatPercent(target, -20); + PreventHitEffect(effIndex); + if (Unit* target = GetHitUnit()) + GetCaster()->getThreatManager().modifyThreatPercent(target, -20); } void Register() @@ -252,6 +252,6 @@ class spell_gurtogg_eject : public SpellScriptLoader void AddSC_boss_gurtogg_bloodboil() { new boss_gurtogg_bloodboil(); - new spell_gurtogg_bloodboil(); - new spell_gurtogg_eject(); + new spell_gurtogg_bloodboil(); + new spell_gurtogg_eject(); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 14ee6dd66..3a4385a13 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -9,1083 +9,1083 @@ REWRITTEN BY XINEF enum Says { - SAY_ILLIDAN_MINION = 0, - SAY_ILLIDAN_KILL = 1, - SAY_ILLIDAN_TAKEOFF = 2, - SAY_ILLIDAN_SUMMONFLAMES = 3, - SAY_ILLIDAN_EYE_BLAST = 4, - SAY_ILLIDAN_MORPH = 5, - SAY_ILLIDAN_ENRAGE = 6, - SAY_ILLIDAN_TAUNT = 7, - SAY_ILLIDAN_AKAMA1 = 8, - SAY_ILLIDAN_AKAMA2 = 9, - SAY_ILLIDAN_AKAMA3 = 10, - SAY_ILLIDAN_MAIEV1 = 11, - SAY_ILLIDAN_MAIEV2 = 12, - SAY_ILLIDAN_MAIEV3 = 13, - SAY_ILLIDAN_FRENZY = 14, + SAY_ILLIDAN_MINION = 0, + SAY_ILLIDAN_KILL = 1, + SAY_ILLIDAN_TAKEOFF = 2, + SAY_ILLIDAN_SUMMONFLAMES = 3, + SAY_ILLIDAN_EYE_BLAST = 4, + SAY_ILLIDAN_MORPH = 5, + SAY_ILLIDAN_ENRAGE = 6, + SAY_ILLIDAN_TAUNT = 7, + SAY_ILLIDAN_AKAMA1 = 8, + SAY_ILLIDAN_AKAMA2 = 9, + SAY_ILLIDAN_AKAMA3 = 10, + SAY_ILLIDAN_MAIEV1 = 11, + SAY_ILLIDAN_MAIEV2 = 12, + SAY_ILLIDAN_MAIEV3 = 13, + SAY_ILLIDAN_FRENZY = 14, - SAY_UDALO = 0, - SAY_OLUM = 0, - SAY_AKAMA_DOORS = 0, - SAY_AKAMA_FAIL = 1, - SAY_AKAMA_BEWARE = 2, - SAY_AKAMA_LEAVE = 3, - SAY_AKAMA_ILLIDAN1 = 4, - SAY_AKAMA_ILLIDAN2 = 5, - SAY_AKAMA_ILLIDAN3 = 6, + SAY_UDALO = 0, + SAY_OLUM = 0, + SAY_AKAMA_DOORS = 0, + SAY_AKAMA_FAIL = 1, + SAY_AKAMA_BEWARE = 2, + SAY_AKAMA_LEAVE = 3, + SAY_AKAMA_ILLIDAN1 = 4, + SAY_AKAMA_ILLIDAN2 = 5, + SAY_AKAMA_ILLIDAN3 = 6, - SAY_MAIEV_SHADOWSONG_TAUNT = 0, - SAY_MAIEV_SHADOWSONG_ILLIDAN1 = 1, - SAY_MAIEV_SHADOWSONG_ILLIDAN2 = 2, - SAY_MAIEV_SHADOWSONG_ILLIDAN3 = 3, - SAY_MAIEV_SHADOWSONG_ILLIDAN4 = 4, - SAY_MAIEV_SHADOWSONG_ILLIDAN5 = 5, + SAY_MAIEV_SHADOWSONG_TAUNT = 0, + SAY_MAIEV_SHADOWSONG_ILLIDAN1 = 1, + SAY_MAIEV_SHADOWSONG_ILLIDAN2 = 2, + SAY_MAIEV_SHADOWSONG_ILLIDAN3 = 3, + SAY_MAIEV_SHADOWSONG_ILLIDAN4 = 4, + SAY_MAIEV_SHADOWSONG_ILLIDAN5 = 5, - EMOTE_AZZINOTH_GAZE = 0 + EMOTE_AZZINOTH_GAZE = 0 }; enum Spells { - // Phase 1 - SPELL_DUAL_WIELD = 42459, - SPELL_BERSERK = 45078, - SPELL_FLAME_CRASH = 40832, - SPELL_DRAW_SOUL = 40904, - SPELL_DRAW_SOUL_HEAL = 40903, - SPELL_PARASITIC_SHADOWFIEND = 41917, - SPELL_PARASITIC_SHADOWFIEND_TRIGGER = 41914, - SPELL_SUMMON_PARASITIC_SHADOWFIENDS = 41915, + // Phase 1 + SPELL_DUAL_WIELD = 42459, + SPELL_BERSERK = 45078, + SPELL_FLAME_CRASH = 40832, + SPELL_DRAW_SOUL = 40904, + SPELL_DRAW_SOUL_HEAL = 40903, + SPELL_PARASITIC_SHADOWFIEND = 41917, + SPELL_PARASITIC_SHADOWFIEND_TRIGGER = 41914, + SPELL_SUMMON_PARASITIC_SHADOWFIENDS = 41915, - // Phase 2 - SPELL_THROW_GLAIVE = 39635, - SPELL_THROW_GLAIVE2 = 39849, - SPELL_GLAIVE_RETURNS = 39873, - SPELL_SUMMON_GLAIVE = 41466, - SPELL_FIREBALL = 40598, - SPELL_DARK_BARRAGE = 40585, - SPELL_EYE_BLAST = 39908, - SPELL_UNCAGED_WRATH = 39869, - SPELL_FLAME_BLAST = 40631, - SPELL_CHARGE = 42003, + // Phase 2 + SPELL_THROW_GLAIVE = 39635, + SPELL_THROW_GLAIVE2 = 39849, + SPELL_GLAIVE_RETURNS = 39873, + SPELL_SUMMON_GLAIVE = 41466, + SPELL_FIREBALL = 40598, + SPELL_DARK_BARRAGE = 40585, + SPELL_EYE_BLAST = 39908, + SPELL_UNCAGED_WRATH = 39869, + SPELL_FLAME_BLAST = 40631, + SPELL_CHARGE = 42003, - // Phase 3 - SPELL_AGONIZING_FLAMES = 40932, - SPELL_SUMMON_MAIEV = 40403, - SPELL_SHADOW_PRISON = 40647, - SPELL_TELEPORT_VISUAL_ONLY = 41232, + // Phase 3 + SPELL_AGONIZING_FLAMES = 40932, + SPELL_SUMMON_MAIEV = 40403, + SPELL_SHADOW_PRISON = 40647, + SPELL_TELEPORT_VISUAL_ONLY = 41232, - // Phase 4 - SPELL_DEMON_TRANSFORM_1 = 40511, - SPELL_DEMON_TRANSFORM_2 = 40398, - SPELL_DEMON_TRANSFORM_3 = 40510, - SPELL_DEMON_FORM = 40506, - SPELL_SHADOW_BLAST = 41078, - SPELL_FLAME_BURST = 41126, - SPELL_FLAME_BURST_EFFECT = 41131, - SPELL_SUMMON_SHADOW_DEMON = 41117, - SPELL_CONSUME_SOUL = 41080, - SPELL_FIND_TARGET = 41081, - - // Phase 5 - SPELL_FRENZY = 40683, - SPELL_TELEPORT_MAIEV = 41221, - SPELL_SHADOW_STRIKE = 40685, - SPELL_THROW_DAGGER = 41152, - SPELL_DEATH = 41220, + // Phase 4 + SPELL_DEMON_TRANSFORM_1 = 40511, + SPELL_DEMON_TRANSFORM_2 = 40398, + SPELL_DEMON_TRANSFORM_3 = 40510, + SPELL_DEMON_FORM = 40506, + SPELL_SHADOW_BLAST = 41078, + SPELL_FLAME_BURST = 41126, + SPELL_FLAME_BURST_EFFECT = 41131, + SPELL_SUMMON_SHADOW_DEMON = 41117, + SPELL_CONSUME_SOUL = 41080, + SPELL_FIND_TARGET = 41081, + + // Phase 5 + SPELL_FRENZY = 40683, + SPELL_TELEPORT_MAIEV = 41221, + SPELL_SHADOW_STRIKE = 40685, + SPELL_THROW_DAGGER = 41152, + SPELL_DEATH = 41220, - // Cage - SPELL_CAGED_DEBUFF = 40695, - SPELL_CAGED_SUMMON1 = 40696, - SPELL_CAGED_SUMMON8 = 40703, - SPELL_CAGE_TRAP = 40760 + // Cage + SPELL_CAGED_DEBUFF = 40695, + SPELL_CAGED_SUMMON1 = 40696, + SPELL_CAGED_SUMMON8 = 40703, + SPELL_CAGE_TRAP = 40760 }; enum Misc { - ACTION_FIGHT_MINIONS = 1, - ACTION_RETURN_BLADE = 2, - ACTION_ILLIDAN_CAGED = 3, - ACTION_ILLIDAN_DEAD = 4, - ACTION_MAIEV_SET_DIST30 = 5, - ACTION_MAIEV_SET_DIST0 = 6, - ACTION_MAIEV_OUTRO = 7, + ACTION_FIGHT_MINIONS = 1, + ACTION_RETURN_BLADE = 2, + ACTION_ILLIDAN_CAGED = 3, + ACTION_ILLIDAN_DEAD = 4, + ACTION_MAIEV_SET_DIST30 = 5, + ACTION_MAIEV_SET_DIST0 = 6, + ACTION_MAIEV_OUTRO = 7, - MAX_EYE_BEAM_POS = 4, + MAX_EYE_BEAM_POS = 4, - POINT_ILLIDAN_HOVER = 10, - POINT_ILLIDAN_MIDDLE = 11, + POINT_ILLIDAN_HOVER = 10, + POINT_ILLIDAN_MIDDLE = 11, - NPC_ILLIDAN_DB_TARGET = 23070, - NPC_MAIEV_SHADOWSONG = 23197, + NPC_ILLIDAN_DB_TARGET = 23070, + NPC_MAIEV_SHADOWSONG = 23197, - GO_CAGE_TRAP = 185916 + GO_CAGE_TRAP = 185916 }; enum Events { - EVENT_SPELL_FLAME_CRASH = 1, - EVENT_SPELL_BERSERK = 2, - EVENT_SPELL_DRAW_SOUL = 3, - EVENT_SPELL_PARASITIC_SHADOWFIEND = 4, - EVENT_SPELL_AGONIZING_FLAMES = 5, - EVENT_SPELL_FRENZY = 6, + EVENT_SPELL_FLAME_CRASH = 1, + EVENT_SPELL_BERSERK = 2, + EVENT_SPELL_DRAW_SOUL = 3, + EVENT_SPELL_PARASITIC_SHADOWFIEND = 4, + EVENT_SPELL_AGONIZING_FLAMES = 5, + EVENT_SPELL_FRENZY = 6, - EVENT_SUMMON_MINIONS = 20, - EVENT_SUMMON_MINIONS2 = 21, + EVENT_SUMMON_MINIONS = 20, + EVENT_SUMMON_MINIONS2 = 21, - EVENT_PHASE_2_START = 40, - EVENT_SPELL_FIREBALL = 41, - EVENT_SPELL_DARK_BARRAGE = 42, - EVENT_START_PHASE_2_END = 43, - EVENT_START_PHASE_2_WEAPON = 44, - EVENT_START_PHASE_3_LAND = 45, - EVENT_PHASE_2_SUMMON1 = 46, - EVENT_PHASE_2_SUMMON2 = 47, - EVENT_PHASE_2_EYE_BEAM = 48, - EVENT_PHASE_2_EYE_BEAM_START = 49, - EVENT_PHASE_2_CHANGE_POS = 50, - EVENT_PHASE_2_INTERRUPT = 51, + EVENT_PHASE_2_START = 40, + EVENT_SPELL_FIREBALL = 41, + EVENT_SPELL_DARK_BARRAGE = 42, + EVENT_START_PHASE_2_END = 43, + EVENT_START_PHASE_2_WEAPON = 44, + EVENT_START_PHASE_3_LAND = 45, + EVENT_PHASE_2_SUMMON1 = 46, + EVENT_PHASE_2_SUMMON2 = 47, + EVENT_PHASE_2_EYE_BEAM = 48, + EVENT_PHASE_2_EYE_BEAM_START = 49, + EVENT_PHASE_2_CHANGE_POS = 50, + EVENT_PHASE_2_INTERRUPT = 51, - EVENT_PHASE_4_START = 60, - EVENT_PHASE_5_START = 61, - EVENT_PHASE_5_SCENE1 = 62, - EVENT_PHASE_5_SCENE2 = 63, - EVENT_PHASE_5_SCENE3 = 64, - EVENT_PHASE_5_SCENE4 = 65, - EVENT_PHASE_5_SCENE5 = 66, + EVENT_PHASE_4_START = 60, + EVENT_PHASE_5_START = 61, + EVENT_PHASE_5_SCENE1 = 62, + EVENT_PHASE_5_SCENE2 = 63, + EVENT_PHASE_5_SCENE3 = 64, + EVENT_PHASE_5_SCENE4 = 65, + EVENT_PHASE_5_SCENE5 = 66, - EVENT_REMOVE_DEMON_FORM = 80, - EVENT_SPELL_FLAME_BURST = 81, - EVENT_SPELL_SHADOW_BLAST = 82, - EVENT_SPELL_SHADOW_DEMONS = 83, - EVENT_MOVE_MAIEV = 84, - EVENT_FINISH_TRANSFORM = 85, // Dummy, counter only + EVENT_REMOVE_DEMON_FORM = 80, + EVENT_SPELL_FLAME_BURST = 81, + EVENT_SPELL_SHADOW_BLAST = 82, + EVENT_SPELL_SHADOW_DEMONS = 83, + EVENT_MOVE_MAIEV = 84, + EVENT_FINISH_TRANSFORM = 85, // Dummy, counter only - EVENT_OUTRO_DEMON = 90, - EVENT_OUTRO_1 = 91, - EVENT_OUTRO_2 = 92, - EVENT_OUTRO_3 = 93, + EVENT_OUTRO_DEMON = 90, + EVENT_OUTRO_1 = 91, + EVENT_OUTRO_2 = 92, + EVENT_OUTRO_3 = 93, - EVENT_KILL_TALK = 100, - EVENT_SAY_TAUNT = 101, + EVENT_KILL_TALK = 100, + EVENT_SAY_TAUNT = 101, - GROUP_PHASE_2_ABILITY = 1 + GROUP_PHASE_2_ABILITY = 1 }; const Position eyeBeamPos[MAX_EYE_BEAM_POS*2] = { - {639.97f, 301.63f, 354.0f, 0.0f}, - {658.83f, 265.10f, 354.0f, 0.0f}, - {656.86f, 344.07f, 354.0f, 0.0f}, - {640.70f, 310.47f, 354.0f, 0.0f}, + {639.97f, 301.63f, 354.0f, 0.0f}, + {658.83f, 265.10f, 354.0f, 0.0f}, + {656.86f, 344.07f, 354.0f, 0.0f}, + {640.70f, 310.47f, 354.0f, 0.0f}, - {706.22f, 273.26f, 354.0f, 0.0f}, - {717.55f, 328.33f, 354.0f, 0.0f}, - {718.06f, 286.08f, 354.0f, 0.0f}, - {705.92f, 337.14f, 354.0f, 0.0f} + {706.22f, 273.26f, 354.0f, 0.0f}, + {717.55f, 328.33f, 354.0f, 0.0f}, + {718.06f, 286.08f, 354.0f, 0.0f}, + {705.92f, 337.14f, 354.0f, 0.0f} }; const Position airHoverPos[MAX_EYE_BEAM_POS] = { - {658.83f, 265.10f, 356.0f, 0.0f}, - {706.22f, 273.26f, 356.0f, 0.0f}, - {705.92f, 337.14f, 356.0f, 0.0f}, - {656.86f, 344.07f, 356.0f, 0.0f} + {658.83f, 265.10f, 356.0f, 0.0f}, + {706.22f, 273.26f, 356.0f, 0.0f}, + {705.92f, 337.14f, 356.0f, 0.0f}, + {656.86f, 344.07f, 356.0f, 0.0f} }; class boss_illidan_stormrage : public CreatureScript { - public: - boss_illidan_stormrage() : CreatureScript("boss_illidan_stormrage") { } + public: + boss_illidan_stormrage() : CreatureScript("boss_illidan_stormrage") { } - struct boss_illidan_stormrageAI : public BossAI - { - boss_illidan_stormrageAI(Creature* creature) : BossAI(creature, DATA_ILLIDAN_STORMRAGE) - { - } + struct boss_illidan_stormrageAI : public BossAI + { + boss_illidan_stormrageAI(Creature* creature) : BossAI(creature, DATA_ILLIDAN_STORMRAGE) + { + } - EventMap events2; - uint8 beamPosId; + EventMap events2; + uint8 beamPosId; - void Reset() - { - BossAI::Reset(); - events2.Reset(); - me->SetDisableGravity(false); - me->CastSpell(me, SPELL_DUAL_WIELD, true); - me->LoadEquipment(0, true); - me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - beamPosId = urand(0, 3); - } + void Reset() + { + BossAI::Reset(); + events2.Reset(); + me->SetDisableGravity(false); + me->CastSpell(me, SPELL_DUAL_WIELD, true); + me->LoadEquipment(0, true); + me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + beamPosId = urand(0, 3); + } - void EnterEvadeMode() - { - BossAI::EnterEvadeMode(); + void EnterEvadeMode() + { + BossAI::EnterEvadeMode(); - if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA))) - akama->AI()->EnterEvadeMode(); - } + if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA))) + akama->AI()->EnterEvadeMode(); + } - bool CanAIAttack(const Unit* target) const - { - return target->GetEntry() != NPC_AKAMA && target->GetEntry() != NPC_MAIEV_SHADOWSONG; - } + bool CanAIAttack(const Unit* target) const + { + return target->GetEntry() != NPC_AKAMA && target->GetEntry() != NPC_MAIEV_SHADOWSONG; + } - void DoAction(int32 param) - { - if (param == ACTION_ILLIDAN_CAGED) - { - me->RemoveAurasDueToSpell(SPELL_FRENZY); - events.Reset(); - events.ScheduleEvent(EVENT_PHASE_4_START, 16000); - } - } + void DoAction(int32 param) + { + if (param == ACTION_ILLIDAN_CAGED) + { + me->RemoveAurasDueToSpell(SPELL_FRENZY); + events.Reset(); + events.ScheduleEvent(EVENT_PHASE_4_START, 16000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() == NPC_ILLIDAN_DB_TARGET) - me->CastSpell(summon, SPELL_EYE_BLAST, false); - else if (summon->GetEntry() == NPC_MAIEV_SHADOWSONG) - { - me->SetTarget(summon->GetGUID()); - me->SetFacingToObject(summon); - summon->SetFacingToObject(me); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - summon->SetReactState(REACT_PASSIVE); - summon->CastSpell(summon, SPELL_TELEPORT_VISUAL_ONLY, true); - } - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() == NPC_ILLIDAN_DB_TARGET) + me->CastSpell(summon, SPELL_EYE_BLAST, false); + else if (summon->GetEntry() == NPC_MAIEV_SHADOWSONG) + { + me->SetTarget(summon->GetGUID()); + me->SetFacingToObject(summon); + summon->SetFacingToObject(me); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + summon->SetReactState(REACT_PASSIVE); + summon->CastSpell(summon, SPELL_TELEPORT_VISUAL_ONLY, true); + } + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; - if (id == POINT_ILLIDAN_HOVER) - { - if (events2.GetNextEventTime(EVENT_START_PHASE_2_END) == 0) - { - events.ScheduleEvent(EVENT_PHASE_2_SUMMON2, 2000); - events.ScheduleEvent(EVENT_PHASE_2_CHANGE_POS, 6000); - events.ScheduleEvent(EVENT_PHASE_2_EYE_BEAM, 15000, GROUP_PHASE_2_ABILITY); - events2.ScheduleEvent(EVENT_START_PHASE_2_END, 10000); - } - me->SetFacingTo(me->GetAngle(676.02f, 305.45f)); - } - else if (id == POINT_ILLIDAN_MIDDLE) - { + if (id == POINT_ILLIDAN_HOVER) + { + if (events2.GetNextEventTime(EVENT_START_PHASE_2_END) == 0) + { + events.ScheduleEvent(EVENT_PHASE_2_SUMMON2, 2000); + events.ScheduleEvent(EVENT_PHASE_2_CHANGE_POS, 6000); + events.ScheduleEvent(EVENT_PHASE_2_EYE_BEAM, 15000, GROUP_PHASE_2_ABILITY); + events2.ScheduleEvent(EVENT_START_PHASE_2_END, 10000); + } + me->SetFacingTo(me->GetAngle(676.02f, 305.45f)); + } + else if (id == POINT_ILLIDAN_MIDDLE) + { EntryCheckPredicate pred(NPC_BLADE_OF_AZZINOTH); - summons.DoAction(ACTION_RETURN_BLADE, pred); - events.ScheduleEvent(EVENT_START_PHASE_2_WEAPON, 1500); - events.ScheduleEvent(EVENT_START_PHASE_3_LAND, 4000); - } - } + summons.DoAction(ACTION_RETURN_BLADE, pred); + events.ScheduleEvent(EVENT_START_PHASE_2_WEAPON, 1500); + events.ScheduleEvent(EVENT_START_PHASE_3_LAND, 4000); + } + } - void ScheduleNormalEvents(uint8 phase) - { - events.ScheduleEvent(EVENT_SPELL_FLAME_CRASH, 15000); - events.ScheduleEvent(EVENT_SPELL_DRAW_SOUL, 30000); - events.ScheduleEvent(EVENT_SPELL_PARASITIC_SHADOWFIEND, 20000); - events.ScheduleEvent(EVENT_SAY_TAUNT, 40000); - if (phase >= 3) - { - events.ScheduleEvent(EVENT_PHASE_4_START, 60000); - events.ScheduleEvent(EVENT_SPELL_AGONIZING_FLAMES, 10000); - } - if (phase >= 5) - events.ScheduleEvent(EVENT_SPELL_FRENZY, 40000); - } + void ScheduleNormalEvents(uint8 phase) + { + events.ScheduleEvent(EVENT_SPELL_FLAME_CRASH, 15000); + events.ScheduleEvent(EVENT_SPELL_DRAW_SOUL, 30000); + events.ScheduleEvent(EVENT_SPELL_PARASITIC_SHADOWFIEND, 20000); + events.ScheduleEvent(EVENT_SAY_TAUNT, 40000); + if (phase >= 3) + { + events.ScheduleEvent(EVENT_PHASE_4_START, 60000); + events.ScheduleEvent(EVENT_SPELL_AGONIZING_FLAMES, 10000); + } + if (phase >= 5) + events.ScheduleEvent(EVENT_SPELL_FRENZY, 40000); + } - void EnterCombat(Unit* who) - { - summons.DespawnAll(); - BossAI::EnterCombat(who); - ScheduleNormalEvents(1); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 25*MINUTE*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_SUMMON_MINIONS, 1000); - events.ScheduleEvent(EVENT_PHASE_2_START, 1000); - } + void EnterCombat(Unit* who) + { + summons.DespawnAll(); + BossAI::EnterCombat(who); + ScheduleNormalEvents(1); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 25*MINUTE*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SUMMON_MINIONS, 1000); + events.ScheduleEvent(EVENT_PHASE_2_START, 1000); + } - void AttackStart(Unit* victim) - { - if (victim && me->Attack(victim, true)) - me->GetMotionMaster()->MoveChase(victim, events.GetNextEventTime(EVENT_REMOVE_DEMON_FORM) != 0 ? 35.0f : 0.0f); - } + void AttackStart(Unit* victim) + { + if (victim && me->Attack(victim, true)) + me->GetMotionMaster()->MoveChase(victim, events.GetNextEventTime(EVENT_REMOVE_DEMON_FORM) != 0 ? 35.0f : 0.0f); + } - void MoveInLineOfSight(Unit*) { } + void MoveInLineOfSight(Unit*) { } - void JustDied(Unit* killer) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - summons.DespawnEntry(NPC_PARASITIC_SHADOWFIEND); - instance->SetBossState(DATA_ILLIDAN_STORMRAGE, DONE); - instance->SaveToDB(); - } + void JustDied(Unit* killer) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + summons.DespawnEntry(NPC_PARASITIC_SHADOWFIEND); + instance->SetBossState(DATA_ILLIDAN_STORMRAGE, DONE); + instance->SaveToDB(); + } - void KilledUnit(Unit* victim) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_ILLIDAN_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* victim) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_ILLIDAN_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - { - damage = 0; + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + { + damage = 0; - // xinef: do not allow to start outro when transforming - if (events.GetNextEventTime(EVENT_FINISH_TRANSFORM)) - return; + // xinef: do not allow to start outro when transforming + if (events.GetNextEventTime(EVENT_FINISH_TRANSFORM)) + return; - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - { - if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) - { - maiev->StopMovingOnCurrentPos(); - maiev->GetMotionMaster()->Clear(); - maiev->SetReactState(REACT_PASSIVE); - maiev->SetFullHealth(); - maiev->RemoveAllAuras(); - maiev->CombatStop(); - } + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) + { + maiev->StopMovingOnCurrentPos(); + maiev->GetMotionMaster()->Clear(); + maiev->SetReactState(REACT_PASSIVE); + maiev->SetFullHealth(); + maiev->RemoveAllAuras(); + maiev->CombatStop(); + } - if (events.GetNextEventTime(EVENT_REMOVE_DEMON_FORM) != 0) - { - me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true); - events2.ScheduleEvent(EVENT_OUTRO_DEMON, 12000); - } - else - { - me->CastSpell(me, SPELL_TELEPORT_MAIEV, true); - me->CastSpell(me, SPELL_DEATH, true); - events2.ScheduleEvent(EVENT_OUTRO_1, 1000); - } + if (events.GetNextEventTime(EVENT_REMOVE_DEMON_FORM) != 0) + { + me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true); + events2.ScheduleEvent(EVENT_OUTRO_DEMON, 12000); + } + else + { + me->CastSpell(me, SPELL_TELEPORT_MAIEV, true); + me->CastSpell(me, SPELL_DEATH, true); + events2.ScheduleEvent(EVENT_OUTRO_1, 1000); + } - if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) - { - maiev->SetTarget(me->GetGUID()); - maiev->SetFacingToObject(me); - } + if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) + { + maiev->SetTarget(me->GetGUID()); + maiev->SetFacingToObject(me); + } - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - } - } + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + } + } - void UpdateAI(uint32 diff) - { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_SUMMON_MINIONS2: - if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA))) - akama->AI()->DoAction(ACTION_FIGHT_MINIONS); - break; - case EVENT_PHASE_2_EYE_BEAM_START: - Talk(SAY_ILLIDAN_EYE_BLAST); - if (Creature* trigger = summons.GetCreatureWithEntry(NPC_ILLIDAN_DB_TARGET)) - trigger->GetMotionMaster()->MovePoint(0, eyeBeamPos[beamPosId+MAX_EYE_BEAM_POS], false, true); - break; - case EVENT_PHASE_2_INTERRUPT: - me->InterruptNonMeleeSpells(false); - break; - case EVENT_START_PHASE_2_END: - summons.RemoveNotExisting(); - if (!summons.HasEntry(NPC_FLAME_OF_AZZINOTH)) - { - events.Reset(); - events2.Reset(); - me->InterruptNonMeleeSpells(false); - me->GetMotionMaster()->MovePoint(POINT_ILLIDAN_MIDDLE, 676.02f, 305.45f, 353.6f); - break; - } - events2.ScheduleEvent(EVENT_START_PHASE_2_END, 1000); - break; - case EVENT_OUTRO_DEMON: - me->CastSpell(me, SPELL_TELEPORT_MAIEV, true); - me->CastSpell(me, SPELL_DEATH, true); - events2.ScheduleEvent(EVENT_OUTRO_1, 1000); - break; - case EVENT_OUTRO_1: - if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) - { - maiev->SetTarget(me->GetGUID()); - maiev->SetFacingToObject(me); - maiev->AI()->DoAction(ACTION_MAIEV_OUTRO); - maiev->AI()->Talk(SAY_MAIEV_SHADOWSONG_ILLIDAN3); - } - - if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA))) - { - akama->AI()->DoAction(ACTION_ILLIDAN_DEAD); - akama->SetTarget(me->GetGUID()); - akama->GetMotionMaster()->MovePoint(0, 695.63f, 306.63f, 354.26f); - } - events2.ScheduleEvent(EVENT_OUTRO_2, 6000); - break; - case EVENT_OUTRO_2: - Talk(SAY_ILLIDAN_MAIEV3); - events2.ScheduleEvent(EVENT_OUTRO_3, 17000); - break; - case EVENT_OUTRO_3: - Unit::Kill(NULL, me); - break; - } + void UpdateAI(uint32 diff) + { + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_SUMMON_MINIONS2: + if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA))) + akama->AI()->DoAction(ACTION_FIGHT_MINIONS); + break; + case EVENT_PHASE_2_EYE_BEAM_START: + Talk(SAY_ILLIDAN_EYE_BLAST); + if (Creature* trigger = summons.GetCreatureWithEntry(NPC_ILLIDAN_DB_TARGET)) + trigger->GetMotionMaster()->MovePoint(0, eyeBeamPos[beamPosId+MAX_EYE_BEAM_POS], false, true); + break; + case EVENT_PHASE_2_INTERRUPT: + me->InterruptNonMeleeSpells(false); + break; + case EVENT_START_PHASE_2_END: + summons.RemoveNotExisting(); + if (!summons.HasEntry(NPC_FLAME_OF_AZZINOTH)) + { + events.Reset(); + events2.Reset(); + me->InterruptNonMeleeSpells(false); + me->GetMotionMaster()->MovePoint(POINT_ILLIDAN_MIDDLE, 676.02f, 305.45f, 353.6f); + break; + } + events2.ScheduleEvent(EVENT_START_PHASE_2_END, 1000); + break; + case EVENT_OUTRO_DEMON: + me->CastSpell(me, SPELL_TELEPORT_MAIEV, true); + me->CastSpell(me, SPELL_DEATH, true); + events2.ScheduleEvent(EVENT_OUTRO_1, 1000); + break; + case EVENT_OUTRO_1: + if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) + { + maiev->SetTarget(me->GetGUID()); + maiev->SetFacingToObject(me); + maiev->AI()->DoAction(ACTION_MAIEV_OUTRO); + maiev->AI()->Talk(SAY_MAIEV_SHADOWSONG_ILLIDAN3); + } + + if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA))) + { + akama->AI()->DoAction(ACTION_ILLIDAN_DEAD); + akama->SetTarget(me->GetGUID()); + akama->GetMotionMaster()->MovePoint(0, 695.63f, 306.63f, 354.26f); + } + events2.ScheduleEvent(EVENT_OUTRO_2, 6000); + break; + case EVENT_OUTRO_2: + Talk(SAY_ILLIDAN_MAIEV3); + events2.ScheduleEvent(EVENT_OUTRO_3, 17000); + break; + case EVENT_OUTRO_3: + Unit::Kill(NULL, me); + break; + } - + EnterEvadeIfOutOfCombatArea(); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (uint32 eventId = events.ExecuteEvent()) - { - case EVENT_SUMMON_MINIONS: - if (me->HealthBelowPct(90)) - { - Talk(SAY_ILLIDAN_MINION); - events2.ScheduleEvent(EVENT_SUMMON_MINIONS2, 10000); - break; - } - events.ScheduleEvent(EVENT_SUMMON_MINIONS, 1000); - break; - // /////////////////////////// - // PHASE 1, 3, 5 - // /////////////////////////// - case EVENT_SPELL_BERSERK: - Talk(SAY_ILLIDAN_ENRAGE); - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_SPELL_FLAME_CRASH: - me->CastSpell(me->GetVictim(), SPELL_FLAME_CRASH, false); - events.ScheduleEvent(EVENT_SPELL_FLAME_CRASH, 25000); - break; - case EVENT_SPELL_DRAW_SOUL: - me->CastSpell(me->GetVictim(), SPELL_DRAW_SOUL, false); - events.ScheduleEvent(EVENT_SPELL_DRAW_SOUL, 40000); - break; - case EVENT_SPELL_PARASITIC_SHADOWFIEND: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - me->CastSpell(target, SPELL_PARASITIC_SHADOWFIEND, false); - events.ScheduleEvent(EVENT_SPELL_PARASITIC_SHADOWFIEND, 30000); - break; - case EVENT_SAY_TAUNT: - Talk(SAY_ILLIDAN_TAUNT); - events.ScheduleEvent(EVENT_SAY_TAUNT, urand(30000, 60000)); - break; - case EVENT_SPELL_FRENZY: - Talk(SAY_ILLIDAN_FRENZY); - me->CastSpell(me, SPELL_FRENZY, false); - break; - case EVENT_SPELL_AGONIZING_FLAMES: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - me->CastSpell(target, SPELL_AGONIZING_FLAMES, false); - break; - case EVENT_PHASE_5_START: - if (me->HealthBelowPct(30)) - { - me->CastSpell(me, SPELL_SHADOW_PRISON, true); - me->SendMeleeAttackStop(me->GetVictim()); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - Talk(SAY_ILLIDAN_MAIEV1); - events.Reset(); - events.ScheduleEvent(EVENT_PHASE_5_SCENE1, 9000); - events.ScheduleEvent(EVENT_PHASE_5_SCENE2, 18000); - events.ScheduleEvent(EVENT_PHASE_5_SCENE3, 24000); - events.ScheduleEvent(EVENT_PHASE_5_SCENE4, 27000); - events.ScheduleEvent(EVENT_PHASE_5_SCENE5, 30000); - break; - } - events.ScheduleEvent(EVENT_PHASE_5_START, 1000); - break; - case EVENT_PHASE_5_SCENE1: - me->CastSpell(me, SPELL_SUMMON_MAIEV, true); - break; - case EVENT_PHASE_5_SCENE2: - Talk(SAY_ILLIDAN_MAIEV2); - break; - case EVENT_PHASE_5_SCENE3: - if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) - maiev->AI()->Talk(SAY_MAIEV_SHADOWSONG_ILLIDAN2); - break; - case EVENT_PHASE_5_SCENE4: - if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) - maiev->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - break; - case EVENT_PHASE_5_SCENE5: - me->SetTarget(me->GetVictim()->GetGUID()); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) - { - maiev->SetReactState(REACT_AGGRESSIVE); - maiev->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - maiev->AI()->AttackStart(me); - } - ScheduleNormalEvents(5); - break; - // /////////////////////////// - // PHASE 2 - // /////////////////////////// - case EVENT_PHASE_2_START: - if (me->HealthBelowPct(65)) - { - if (events2.GetNextEventTime(EVENT_SUMMON_MINIONS2) != 0) - events2.RescheduleEvent(EVENT_SUMMON_MINIONS2, 0); + switch (uint32 eventId = events.ExecuteEvent()) + { + case EVENT_SUMMON_MINIONS: + if (me->HealthBelowPct(90)) + { + Talk(SAY_ILLIDAN_MINION); + events2.ScheduleEvent(EVENT_SUMMON_MINIONS2, 10000); + break; + } + events.ScheduleEvent(EVENT_SUMMON_MINIONS, 1000); + break; + // /////////////////////////// + // PHASE 1, 3, 5 + // /////////////////////////// + case EVENT_SPELL_BERSERK: + Talk(SAY_ILLIDAN_ENRAGE); + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_SPELL_FLAME_CRASH: + me->CastSpell(me->GetVictim(), SPELL_FLAME_CRASH, false); + events.ScheduleEvent(EVENT_SPELL_FLAME_CRASH, 25000); + break; + case EVENT_SPELL_DRAW_SOUL: + me->CastSpell(me->GetVictim(), SPELL_DRAW_SOUL, false); + events.ScheduleEvent(EVENT_SPELL_DRAW_SOUL, 40000); + break; + case EVENT_SPELL_PARASITIC_SHADOWFIEND: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + me->CastSpell(target, SPELL_PARASITIC_SHADOWFIEND, false); + events.ScheduleEvent(EVENT_SPELL_PARASITIC_SHADOWFIEND, 30000); + break; + case EVENT_SAY_TAUNT: + Talk(SAY_ILLIDAN_TAUNT); + events.ScheduleEvent(EVENT_SAY_TAUNT, urand(30000, 60000)); + break; + case EVENT_SPELL_FRENZY: + Talk(SAY_ILLIDAN_FRENZY); + me->CastSpell(me, SPELL_FRENZY, false); + break; + case EVENT_SPELL_AGONIZING_FLAMES: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + me->CastSpell(target, SPELL_AGONIZING_FLAMES, false); + break; + case EVENT_PHASE_5_START: + if (me->HealthBelowPct(30)) + { + me->CastSpell(me, SPELL_SHADOW_PRISON, true); + me->SendMeleeAttackStop(me->GetVictim()); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + Talk(SAY_ILLIDAN_MAIEV1); + events.Reset(); + events.ScheduleEvent(EVENT_PHASE_5_SCENE1, 9000); + events.ScheduleEvent(EVENT_PHASE_5_SCENE2, 18000); + events.ScheduleEvent(EVENT_PHASE_5_SCENE3, 24000); + events.ScheduleEvent(EVENT_PHASE_5_SCENE4, 27000); + events.ScheduleEvent(EVENT_PHASE_5_SCENE5, 30000); + break; + } + events.ScheduleEvent(EVENT_PHASE_5_START, 1000); + break; + case EVENT_PHASE_5_SCENE1: + me->CastSpell(me, SPELL_SUMMON_MAIEV, true); + break; + case EVENT_PHASE_5_SCENE2: + Talk(SAY_ILLIDAN_MAIEV2); + break; + case EVENT_PHASE_5_SCENE3: + if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) + maiev->AI()->Talk(SAY_MAIEV_SHADOWSONG_ILLIDAN2); + break; + case EVENT_PHASE_5_SCENE4: + if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) + maiev->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + break; + case EVENT_PHASE_5_SCENE5: + me->SetTarget(me->GetVictim()->GetGUID()); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) + { + maiev->SetReactState(REACT_AGGRESSIVE); + maiev->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + maiev->AI()->AttackStart(me); + } + ScheduleNormalEvents(5); + break; + // /////////////////////////// + // PHASE 2 + // /////////////////////////// + case EVENT_PHASE_2_START: + if (me->HealthBelowPct(65)) + { + if (events2.GetNextEventTime(EVENT_SUMMON_MINIONS2) != 0) + events2.RescheduleEvent(EVENT_SUMMON_MINIONS2, 0); - Talk(SAY_ILLIDAN_TAKEOFF); - me->SendMeleeAttackStop(me->GetVictim()); - me->SetTarget(0); - me->GetMotionMaster()->Clear(); - me->StopMovingOnCurrentPos(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->SetDisableGravity(true); + Talk(SAY_ILLIDAN_TAKEOFF); + me->SendMeleeAttackStop(me->GetVictim()); + me->SetTarget(0); + me->GetMotionMaster()->Clear(); + me->StopMovingOnCurrentPos(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->SetDisableGravity(true); - events.Reset(); - events.ScheduleEvent(EVENT_PHASE_2_SUMMON1, 6000); - break; - } - events.ScheduleEvent(EVENT_PHASE_2_START, 1000); - break; - case EVENT_PHASE_2_SUMMON1: - me->LoadEquipment(1, true); - me->GetMotionMaster()->MovePoint(POINT_ILLIDAN_HOVER, 727.875f, 305.365f, 356.0f, false, true); - break; - case EVENT_PHASE_2_SUMMON2: - Talk(SAY_ILLIDAN_SUMMONFLAMES); - me->LoadEquipment(0, true); - me->CastSpell(me, SPELL_THROW_GLAIVE, false); - me->CastSpell(me, SPELL_THROW_GLAIVE2, false); - break; - case EVENT_PHASE_2_CHANGE_POS: - beamPosId = (++beamPosId)%MAX_EYE_BEAM_POS; - events.ScheduleEvent(EVENT_SPELL_FIREBALL, 8000, GROUP_PHASE_2_ABILITY); - events.ScheduleEvent(EVENT_SPELL_DARK_BARRAGE, 18000, GROUP_PHASE_2_ABILITY); - events.ScheduleEvent(EVENT_PHASE_2_EYE_BEAM, urand(25000, 50000), GROUP_PHASE_2_ABILITY); - me->GetMotionMaster()->MovePoint(POINT_ILLIDAN_HOVER, airHoverPos[beamPosId], false, true); - break; - case EVENT_PHASE_2_EYE_BEAM: - me->SummonCreature(NPC_ILLIDAN_DB_TARGET, eyeBeamPos[beamPosId], TEMPSUMMON_TIMED_DESPAWN, 15000); - events.CancelEventGroup(GROUP_PHASE_2_ABILITY); - events.ScheduleEvent(EVENT_PHASE_2_CHANGE_POS, 20000); + events.Reset(); + events.ScheduleEvent(EVENT_PHASE_2_SUMMON1, 6000); + break; + } + events.ScheduleEvent(EVENT_PHASE_2_START, 1000); + break; + case EVENT_PHASE_2_SUMMON1: + me->LoadEquipment(1, true); + me->GetMotionMaster()->MovePoint(POINT_ILLIDAN_HOVER, 727.875f, 305.365f, 356.0f, false, true); + break; + case EVENT_PHASE_2_SUMMON2: + Talk(SAY_ILLIDAN_SUMMONFLAMES); + me->LoadEquipment(0, true); + me->CastSpell(me, SPELL_THROW_GLAIVE, false); + me->CastSpell(me, SPELL_THROW_GLAIVE2, false); + break; + case EVENT_PHASE_2_CHANGE_POS: + beamPosId = (++beamPosId)%MAX_EYE_BEAM_POS; + events.ScheduleEvent(EVENT_SPELL_FIREBALL, 8000, GROUP_PHASE_2_ABILITY); + events.ScheduleEvent(EVENT_SPELL_DARK_BARRAGE, 18000, GROUP_PHASE_2_ABILITY); + events.ScheduleEvent(EVENT_PHASE_2_EYE_BEAM, urand(25000, 50000), GROUP_PHASE_2_ABILITY); + me->GetMotionMaster()->MovePoint(POINT_ILLIDAN_HOVER, airHoverPos[beamPosId], false, true); + break; + case EVENT_PHASE_2_EYE_BEAM: + me->SummonCreature(NPC_ILLIDAN_DB_TARGET, eyeBeamPos[beamPosId], TEMPSUMMON_TIMED_DESPAWN, 15000); + events.CancelEventGroup(GROUP_PHASE_2_ABILITY); + events.ScheduleEvent(EVENT_PHASE_2_CHANGE_POS, 20000); - events2.ScheduleEvent(EVENT_PHASE_2_EYE_BEAM_START, 2000); - events2.ScheduleEvent(EVENT_PHASE_2_INTERRUPT, 20000); - break; - case EVENT_SPELL_FIREBALL: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - me->CastSpell(target, SPELL_FIREBALL, false); - events.ScheduleEvent(EVENT_SPELL_FIREBALL, 2200, GROUP_PHASE_2_ABILITY); - break; - case EVENT_SPELL_DARK_BARRAGE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - me->CastSpell(target, SPELL_DARK_BARRAGE, false); - events.ScheduleEvent(EVENT_SPELL_DARK_BARRAGE, 30000, GROUP_PHASE_2_ABILITY); - break; - case EVENT_START_PHASE_2_WEAPON: - me->LoadEquipment(1, true); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->SetDisableGravity(false); - break; - case EVENT_START_PHASE_3_LAND: - me->getThreatManager().resetAllAggro(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetTarget(me->GetVictim()->GetGUID()); - AttackStart(me->GetVictim()); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - ScheduleNormalEvents(3); - events.ScheduleEvent(EVENT_PHASE_5_START, 1000); - break; - // /////////////////////////// - // PHASE 4 - // /////////////////////////// - case EVENT_PHASE_4_START: - me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true); - me->getThreatManager().resetAllAggro(); - me->GetMotionMaster()->MoveChase(me->GetVictim(), 35.0f); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BLAST, 11000); - events.ScheduleEvent(EVENT_MOVE_MAIEV, 5000); - events.ScheduleEvent(EVENT_FINISH_TRANSFORM, 10500); - events.ScheduleEvent(EVENT_SPELL_FLAME_BURST, 21000); - events.ScheduleEvent(EVENT_SPELL_SHADOW_DEMONS, 36000); - events.ScheduleEvent(EVENT_REMOVE_DEMON_FORM, 60000); - break; - case EVENT_SPELL_SHADOW_BLAST: - me->CastSpell(me->GetVictim(), SPELL_SHADOW_BLAST, false); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BLAST, 2200); - break; - case EVENT_SPELL_FLAME_BURST: - me->CastSpell(me, SPELL_FLAME_BURST, false); - events.ScheduleEvent(EVENT_SPELL_FLAME_BURST, 22000); - break; - case EVENT_SPELL_SHADOW_DEMONS: - me->CastSpell(me, SPELL_SUMMON_SHADOW_DEMON, false); - break; - case EVENT_REMOVE_DEMON_FORM: - me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true); - me->getThreatManager().resetAllAggro(); - events.Reset(); - if (summons.HasEntry(NPC_MAIEV_SHADOWSONG)) - { - ScheduleNormalEvents(5); - events.DelayEvents(11000); - events.ScheduleEvent(EVENT_MOVE_MAIEV, 10000); - events.ScheduleEvent(EVENT_FINISH_TRANSFORM, 10500); - } - else - { - ScheduleNormalEvents(3); - events.ScheduleEvent(EVENT_PHASE_5_START, 1000); - events.DelayEvents(11000); - events.ScheduleEvent(EVENT_FINISH_TRANSFORM, 10500); - } - break; - case EVENT_MOVE_MAIEV: - if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) - { - if (events.GetNextEventTime(EVENT_REMOVE_DEMON_FORM) != 0) - { - maiev->AI()->DoAction(ACTION_MAIEV_SET_DIST30); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -25.0f, true)) - maiev->GetMotionMaster()->MoveCharge(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 7.0f, 0); - else - maiev->GetMotionMaster()->MoveCharge(678.04f, 378.34f, 353.0f, 7.0f, 0); - } - else - { - maiev->AI()->DoAction(ACTION_MAIEV_SET_DIST0); - maiev->GetMotionMaster()->MoveChase(me, 0.0f); - } - } - break; - case EVENT_FINISH_TRANSFORM: - me->GetMotionMaster()->MoveChase(me->GetVictim(), events.GetNextEventTime(EVENT_REMOVE_DEMON_FORM) != 0 ? 35.0f : 0.0f); - break; - } + events2.ScheduleEvent(EVENT_PHASE_2_EYE_BEAM_START, 2000); + events2.ScheduleEvent(EVENT_PHASE_2_INTERRUPT, 20000); + break; + case EVENT_SPELL_FIREBALL: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + me->CastSpell(target, SPELL_FIREBALL, false); + events.ScheduleEvent(EVENT_SPELL_FIREBALL, 2200, GROUP_PHASE_2_ABILITY); + break; + case EVENT_SPELL_DARK_BARRAGE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + me->CastSpell(target, SPELL_DARK_BARRAGE, false); + events.ScheduleEvent(EVENT_SPELL_DARK_BARRAGE, 30000, GROUP_PHASE_2_ABILITY); + break; + case EVENT_START_PHASE_2_WEAPON: + me->LoadEquipment(1, true); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->SetDisableGravity(false); + break; + case EVENT_START_PHASE_3_LAND: + me->getThreatManager().resetAllAggro(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetTarget(me->GetVictim()->GetGUID()); + AttackStart(me->GetVictim()); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + ScheduleNormalEvents(3); + events.ScheduleEvent(EVENT_PHASE_5_START, 1000); + break; + // /////////////////////////// + // PHASE 4 + // /////////////////////////// + case EVENT_PHASE_4_START: + me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true); + me->getThreatManager().resetAllAggro(); + me->GetMotionMaster()->MoveChase(me->GetVictim(), 35.0f); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BLAST, 11000); + events.ScheduleEvent(EVENT_MOVE_MAIEV, 5000); + events.ScheduleEvent(EVENT_FINISH_TRANSFORM, 10500); + events.ScheduleEvent(EVENT_SPELL_FLAME_BURST, 21000); + events.ScheduleEvent(EVENT_SPELL_SHADOW_DEMONS, 36000); + events.ScheduleEvent(EVENT_REMOVE_DEMON_FORM, 60000); + break; + case EVENT_SPELL_SHADOW_BLAST: + me->CastSpell(me->GetVictim(), SPELL_SHADOW_BLAST, false); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BLAST, 2200); + break; + case EVENT_SPELL_FLAME_BURST: + me->CastSpell(me, SPELL_FLAME_BURST, false); + events.ScheduleEvent(EVENT_SPELL_FLAME_BURST, 22000); + break; + case EVENT_SPELL_SHADOW_DEMONS: + me->CastSpell(me, SPELL_SUMMON_SHADOW_DEMON, false); + break; + case EVENT_REMOVE_DEMON_FORM: + me->CastSpell(me, SPELL_DEMON_TRANSFORM_1, true); + me->getThreatManager().resetAllAggro(); + events.Reset(); + if (summons.HasEntry(NPC_MAIEV_SHADOWSONG)) + { + ScheduleNormalEvents(5); + events.DelayEvents(11000); + events.ScheduleEvent(EVENT_MOVE_MAIEV, 10000); + events.ScheduleEvent(EVENT_FINISH_TRANSFORM, 10500); + } + else + { + ScheduleNormalEvents(3); + events.ScheduleEvent(EVENT_PHASE_5_START, 1000); + events.DelayEvents(11000); + events.ScheduleEvent(EVENT_FINISH_TRANSFORM, 10500); + } + break; + case EVENT_MOVE_MAIEV: + if (Creature* maiev = summons.GetCreatureWithEntry(NPC_MAIEV_SHADOWSONG)) + { + if (events.GetNextEventTime(EVENT_REMOVE_DEMON_FORM) != 0) + { + maiev->AI()->DoAction(ACTION_MAIEV_SET_DIST30); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -25.0f, true)) + maiev->GetMotionMaster()->MoveCharge(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 7.0f, 0); + else + maiev->GetMotionMaster()->MoveCharge(678.04f, 378.34f, 353.0f, 7.0f, 0); + } + else + { + maiev->AI()->DoAction(ACTION_MAIEV_SET_DIST0); + maiev->GetMotionMaster()->MoveChase(me, 0.0f); + } + } + break; + case EVENT_FINISH_TRANSFORM: + me->GetMotionMaster()->MoveChase(me->GetVictim(), events.GetNextEventTime(EVENT_REMOVE_DEMON_FORM) != 0 ? 35.0f : 0.0f); + break; + } - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - DoMeleeAttackIfReady(); + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + DoMeleeAttackIfReady(); } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetHomePosition().GetExactDist(me) > 90.0f || !SelectTargetFromPlayerList(80.0f); - } - }; + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetHomePosition().GetExactDist(me) > 90.0f || !SelectTargetFromPlayerList(80.0f); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; enum Akama { - POINT_DOORS = 20, - POINT_ILLIDAN = 32, - POINT_FIGHT_MINIONS = 40, + POINT_DOORS = 20, + POINT_ILLIDAN = 32, + POINT_FIGHT_MINIONS = 40, - SPELL_AKAMA_DOOR_OPEN = 41268, - SPELL_AKAMA_DOOR_FAIL = 41271, - SPELL_DEATHSWORN_DOOR_OPEN = 41269, - SPELL_HEALING_POTION = 40535, - SPELL_CHAIN_LIGHTNING = 40536, + SPELL_AKAMA_DOOR_OPEN = 41268, + SPELL_AKAMA_DOOR_FAIL = 41271, + SPELL_DEATHSWORN_DOOR_OPEN = 41269, + SPELL_HEALING_POTION = 40535, + SPELL_CHAIN_LIGHTNING = 40536, - NPC_SPIRIT_OF_OLUM = 23411, - NPC_SPIRIT_OF_UDALO = 23410, - NPC_ILLIDARI_ELITE = 23226, + NPC_SPIRIT_OF_OLUM = 23411, + NPC_SPIRIT_OF_UDALO = 23410, + NPC_ILLIDARI_ELITE = 23226, - EVENT_AKAMA_SCENE_1 = 1, - EVENT_AKAMA_SCENE_2 = 2, - EVENT_AKAMA_SCENE_3 = 3, - EVENT_AKAMA_SCENE_4 = 4, - EVENT_AKAMA_SCENE_5 = 5, - EVENT_AKAMA_SCENE_6 = 6, - EVENT_AKAMA_SCENE_7 = 7, - EVENT_AKAMA_SCENE_8 = 8, - EVENT_AKAMA_SCENE_9 = 9, - EVENT_AKAMA_SCENE_10 = 10, - EVENT_AKAMA_SCENE_11 = 11, - EVENT_AKAMA_SCENE_20 = 20, - EVENT_AKAMA_SCENE_21 = 21, - EVENT_AKAMA_SCENE_22 = 22, - EVENT_AKAMA_SCENE_23 = 23, - EVENT_AKAMA_SCENE_24 = 24, - EVENT_AKAMA_SCENE_25 = 25, - EVENT_AKAMA_SCENE_26 = 26, - EVENT_AKAMA_SCENE_27 = 27, - EVENT_AKAMA_SCENE_28 = 28, - EVENT_AKAMA_SCENE_29 = 29, + EVENT_AKAMA_SCENE_1 = 1, + EVENT_AKAMA_SCENE_2 = 2, + EVENT_AKAMA_SCENE_3 = 3, + EVENT_AKAMA_SCENE_4 = 4, + EVENT_AKAMA_SCENE_5 = 5, + EVENT_AKAMA_SCENE_6 = 6, + EVENT_AKAMA_SCENE_7 = 7, + EVENT_AKAMA_SCENE_8 = 8, + EVENT_AKAMA_SCENE_9 = 9, + EVENT_AKAMA_SCENE_10 = 10, + EVENT_AKAMA_SCENE_11 = 11, + EVENT_AKAMA_SCENE_20 = 20, + EVENT_AKAMA_SCENE_21 = 21, + EVENT_AKAMA_SCENE_22 = 22, + EVENT_AKAMA_SCENE_23 = 23, + EVENT_AKAMA_SCENE_24 = 24, + EVENT_AKAMA_SCENE_25 = 25, + EVENT_AKAMA_SCENE_26 = 26, + EVENT_AKAMA_SCENE_27 = 27, + EVENT_AKAMA_SCENE_28 = 28, + EVENT_AKAMA_SCENE_29 = 29, - EVENT_AKAMA_SUMMON_ILLIDARI = 100, - EVENT_AKAMA_SPELL_CHAIN = 101, - EVENT_AKAMA_HEALTH = 102 + EVENT_AKAMA_SUMMON_ILLIDARI = 100, + EVENT_AKAMA_SPELL_CHAIN = 101, + EVENT_AKAMA_HEALTH = 102 }; class npc_akama_illidan : public CreatureScript { - public: - npc_akama_illidan() : CreatureScript("npc_akama_illidan") { } + public: + npc_akama_illidan() : CreatureScript("npc_akama_illidan") { } - struct npc_akama_illidanAI : public npc_escortAI - { - npc_akama_illidanAI(Creature* creature) : npc_escortAI(creature), summons(me) - { - instance = creature->GetInstanceScript(); - if (instance->GetBossState(DATA_AKAMA_FINISHED) == DONE) - { - me->GetMap()->LoadGrid(751.664f, 238.933f); - me->SetHomePosition(751.664f, 238.933f, 353.106f, 2.18f); - me->NearTeleportTo(751.664f, 238.933f, 353.106f, 2.18f); - } - } + struct npc_akama_illidanAI : public npc_escortAI + { + npc_akama_illidanAI(Creature* creature) : npc_escortAI(creature), summons(me) + { + instance = creature->GetInstanceScript(); + if (instance->GetBossState(DATA_AKAMA_FINISHED) == DONE) + { + me->GetMap()->LoadGrid(751.664f, 238.933f); + me->SetHomePosition(751.664f, 238.933f, 353.106f, 2.18f); + me->NearTeleportTo(751.664f, 238.933f, 353.106f, 2.18f); + } + } - void DoAction(int32 param) - { - if (param == ACTION_FIGHT_MINIONS) - { - me->CombatStop(true); - events.ScheduleEvent(EVENT_AKAMA_SUMMON_ILLIDARI, 8000); - events.ScheduleEvent(EVENT_AKAMA_SPELL_CHAIN, 7000); - events.ScheduleEvent(EVENT_AKAMA_HEALTH, 1000); - me->GetMotionMaster()->MoveCharge(741.97f, 358.74f, 353.0f, 10.0f, POINT_FIGHT_MINIONS); - Talk(SAY_AKAMA_LEAVE); - } - else if (param == ACTION_ILLIDAN_DEAD) - { - events.Reset(); - summons.DespawnAll(); - me->CombatStop(true); - } - } + void DoAction(int32 param) + { + if (param == ACTION_FIGHT_MINIONS) + { + me->CombatStop(true); + events.ScheduleEvent(EVENT_AKAMA_SUMMON_ILLIDARI, 8000); + events.ScheduleEvent(EVENT_AKAMA_SPELL_CHAIN, 7000); + events.ScheduleEvent(EVENT_AKAMA_HEALTH, 1000); + me->GetMotionMaster()->MoveCharge(741.97f, 358.74f, 353.0f, 10.0f, POINT_FIGHT_MINIONS); + Talk(SAY_AKAMA_LEAVE); + } + else if (param == ACTION_ILLIDAN_DEAD) + { + events.Reset(); + summons.DespawnAll(); + me->CombatStop(true); + } + } - void Reset() - { - me->SetReactState(REACT_AGGRESSIVE); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->setActive(false); - me->SetVisible(instance->GetBossState(DATA_ILLIDARI_COUNCIL) == DONE && instance->GetBossState(DATA_ILLIDAN_STORMRAGE) != DONE); - events.Reset(); - summons.DespawnAll(); - } + void Reset() + { + me->SetReactState(REACT_AGGRESSIVE); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->setActive(false); + me->SetVisible(instance->GetBossState(DATA_ILLIDARI_COUNCIL) == DONE && instance->GetBossState(DATA_ILLIDAN_STORMRAGE) != DONE); + events.Reset(); + summons.DespawnAll(); + } - void sGossipSelect(Player* player, uint32 /*sender*/, uint32 action) - { - player->CLOSE_GOSSIP_MENU(); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - me->setActive(true); + void sGossipSelect(Player* player, uint32 /*sender*/, uint32 action) + { + player->CLOSE_GOSSIP_MENU(); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + me->setActive(true); - if (instance->GetBossState(DATA_AKAMA_FINISHED) != DONE) - { - me->SetReactState(REACT_PASSIVE); - Start(false, true); - SetDespawnAtEnd(false); - } - else - { - me->GetMotionMaster()->MovePoint(POINT_ILLIDAN, 744.45f, 304.84f, 353.0f); - events.Reset(); - events.ScheduleEvent(EVENT_AKAMA_SCENE_20, 5000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_21, 8000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_22, 10000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_23, 23000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_24, 34000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_25, 41000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_26, 46000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_27, 49000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_28, 49200); - events.ScheduleEvent(EVENT_AKAMA_SCENE_29, 52000); - } - } + if (instance->GetBossState(DATA_AKAMA_FINISHED) != DONE) + { + me->SetReactState(REACT_PASSIVE); + Start(false, true); + SetDespawnAtEnd(false); + } + else + { + me->GetMotionMaster()->MovePoint(POINT_ILLIDAN, 744.45f, 304.84f, 353.0f); + events.Reset(); + events.ScheduleEvent(EVENT_AKAMA_SCENE_20, 5000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_21, 8000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_22, 10000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_23, 23000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_24, 34000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_25, 41000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_26, 46000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_27, 49000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_28, 49200); + events.ScheduleEvent(EVENT_AKAMA_SCENE_29, 52000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - if (summon->GetEntry() == NPC_ILLIDARI_ELITE) - { - me->AddThreat(summon, 1000000.0f); - summon->AddThreat(me, 1000000.0f); - summon->AI()->AttackStart(me); - AttackStart(summon); - } - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + if (summon->GetEntry() == NPC_ILLIDARI_ELITE) + { + me->AddThreat(summon, 1000000.0f); + summon->AddThreat(me, 1000000.0f); + summon->AI()->AttackStart(me); + AttackStart(summon); + } + } - void WaypointReached(uint32 pointId) - { - if (pointId == POINT_DOORS) - { - SetEscortPaused(true); - events.ScheduleEvent(EVENT_AKAMA_SCENE_1, 0); - events.ScheduleEvent(EVENT_AKAMA_SCENE_2, 4000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_3, 7000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_4, 17000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_5, 23000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_6, 25000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_7, 31000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_8, 40000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_9, 54000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_10, 57000); - events.ScheduleEvent(EVENT_AKAMA_SCENE_11, 62000); - } - else if (pointId == POINT_ILLIDAN) - { - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->setActive(false); - me->SetReactState(REACT_AGGRESSIVE); - } - } + void WaypointReached(uint32 pointId) + { + if (pointId == POINT_DOORS) + { + SetEscortPaused(true); + events.ScheduleEvent(EVENT_AKAMA_SCENE_1, 0); + events.ScheduleEvent(EVENT_AKAMA_SCENE_2, 4000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_3, 7000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_4, 17000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_5, 23000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_6, 25000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_7, 31000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_8, 40000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_9, 54000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_10, 57000); + events.ScheduleEvent(EVENT_AKAMA_SCENE_11, 62000); + } + else if (pointId == POINT_ILLIDAN) + { + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->setActive(false); + me->SetReactState(REACT_AGGRESSIVE); + } + } - void MoveInLineOfSight(Unit* /*who*/) { } + void MoveInLineOfSight(Unit* /*who*/) { } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - damage = 0; - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + damage = 0; + } - void UpdateEscortAI(uint32 diff) - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_AKAMA_SCENE_1: - me->SetFacingTo(0.0f); - break; - case EVENT_AKAMA_SCENE_2: - Talk(SAY_AKAMA_DOORS); - break; - case EVENT_AKAMA_SCENE_3: - me->CastSpell(me, SPELL_AKAMA_DOOR_FAIL, false); - break; - case EVENT_AKAMA_SCENE_4: - Talk(SAY_AKAMA_FAIL); - break; - case EVENT_AKAMA_SCENE_5: - me->SummonCreature(NPC_SPIRIT_OF_UDALO, me->GetPositionX()-5.0f, me->GetPositionY()+8.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); - me->SummonCreature(NPC_SPIRIT_OF_OLUM, me->GetPositionX()-5.0f, me->GetPositionY()-8.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); - break; - case EVENT_AKAMA_SCENE_6: - if (Creature* udalo = me->FindNearestCreature(NPC_SPIRIT_OF_UDALO, 15.0f)) - udalo->AI()->Talk(SAY_UDALO); - break; - case EVENT_AKAMA_SCENE_7: - if (Creature* olum = me->FindNearestCreature(NPC_SPIRIT_OF_OLUM, 15.0f)) - olum->AI()->Talk(SAY_OLUM); - break; - case EVENT_AKAMA_SCENE_8: - me->CastSpell(me, SPELL_AKAMA_DOOR_OPEN, false); - if (Creature* olum = me->FindNearestCreature(NPC_SPIRIT_OF_OLUM, 15.0f)) - olum->CastSpell(olum, SPELL_AKAMA_DOOR_OPEN, false); - if (Creature* udalo = me->FindNearestCreature(NPC_SPIRIT_OF_UDALO, 15.0f)) - udalo->CastSpell(udalo, SPELL_AKAMA_DOOR_OPEN, false); - break; - case EVENT_AKAMA_SCENE_9: - instance->SetBossState(DATA_AKAMA_FINISHED, NOT_STARTED); - instance->SetBossState(DATA_AKAMA_FINISHED, DONE); - break; - case EVENT_AKAMA_SCENE_10: - Talk(SAY_AKAMA_BEWARE); - break; - case EVENT_AKAMA_SCENE_11: - SetEscortPaused(false); - break; - case EVENT_AKAMA_SCENE_20: - if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) - illidan->SetStandState(UNIT_STAND_STATE_STAND); - break; - case EVENT_AKAMA_SCENE_21: - me->SetFacingTo(M_PI); - break; - case EVENT_AKAMA_SCENE_22: - if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) - illidan->AI()->Talk(SAY_ILLIDAN_AKAMA1); - break; - case EVENT_AKAMA_SCENE_23: - Talk(SAY_AKAMA_ILLIDAN1); - break; - case EVENT_AKAMA_SCENE_24: - if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) - illidan->AI()->Talk(SAY_ILLIDAN_AKAMA2); - break; - case EVENT_AKAMA_SCENE_25: - Talk(SAY_AKAMA_ILLIDAN2); - break; - case EVENT_AKAMA_SCENE_26: - if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) - illidan->AI()->Talk(SAY_ILLIDAN_AKAMA3); - break; - case EVENT_AKAMA_SCENE_27: - if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) - illidan->LoadEquipment(1, true); - break; - case EVENT_AKAMA_SCENE_28: - if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) - illidan->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE); - break; - case EVENT_AKAMA_SCENE_29: - if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) - { - illidan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - illidan->SetInCombatWithZone(); - AttackStart(illidan); - } - break; - case EVENT_AKAMA_SUMMON_ILLIDARI: - me->SummonCreature(NPC_ILLIDARI_ELITE, 742.55f, 359.12f, 353.0f, 4.35f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - events.ScheduleEvent(EVENT_AKAMA_SUMMON_ILLIDARI, urand(2000, 6000)); - break; - case EVENT_AKAMA_SPELL_CHAIN: - if (me->GetVictim()) - me->CastSpell(me->GetVictim(), SPELL_CHAIN_LIGHTNING, false); - events.ScheduleEvent(EVENT_AKAMA_SPELL_CHAIN, 20000); - break; - case EVENT_AKAMA_HEALTH: - if (me->HealthBelowPct(20)) - me->CastSpell(me, SPELL_HEALING_POTION, false); - events.ScheduleEvent(EVENT_AKAMA_HEALTH, 1000); - break; - } + void UpdateEscortAI(uint32 diff) + { + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_AKAMA_SCENE_1: + me->SetFacingTo(0.0f); + break; + case EVENT_AKAMA_SCENE_2: + Talk(SAY_AKAMA_DOORS); + break; + case EVENT_AKAMA_SCENE_3: + me->CastSpell(me, SPELL_AKAMA_DOOR_FAIL, false); + break; + case EVENT_AKAMA_SCENE_4: + Talk(SAY_AKAMA_FAIL); + break; + case EVENT_AKAMA_SCENE_5: + me->SummonCreature(NPC_SPIRIT_OF_UDALO, me->GetPositionX()-5.0f, me->GetPositionY()+8.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); + me->SummonCreature(NPC_SPIRIT_OF_OLUM, me->GetPositionX()-5.0f, me->GetPositionY()-8.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); + break; + case EVENT_AKAMA_SCENE_6: + if (Creature* udalo = me->FindNearestCreature(NPC_SPIRIT_OF_UDALO, 15.0f)) + udalo->AI()->Talk(SAY_UDALO); + break; + case EVENT_AKAMA_SCENE_7: + if (Creature* olum = me->FindNearestCreature(NPC_SPIRIT_OF_OLUM, 15.0f)) + olum->AI()->Talk(SAY_OLUM); + break; + case EVENT_AKAMA_SCENE_8: + me->CastSpell(me, SPELL_AKAMA_DOOR_OPEN, false); + if (Creature* olum = me->FindNearestCreature(NPC_SPIRIT_OF_OLUM, 15.0f)) + olum->CastSpell(olum, SPELL_AKAMA_DOOR_OPEN, false); + if (Creature* udalo = me->FindNearestCreature(NPC_SPIRIT_OF_UDALO, 15.0f)) + udalo->CastSpell(udalo, SPELL_AKAMA_DOOR_OPEN, false); + break; + case EVENT_AKAMA_SCENE_9: + instance->SetBossState(DATA_AKAMA_FINISHED, NOT_STARTED); + instance->SetBossState(DATA_AKAMA_FINISHED, DONE); + break; + case EVENT_AKAMA_SCENE_10: + Talk(SAY_AKAMA_BEWARE); + break; + case EVENT_AKAMA_SCENE_11: + SetEscortPaused(false); + break; + case EVENT_AKAMA_SCENE_20: + if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) + illidan->SetStandState(UNIT_STAND_STATE_STAND); + break; + case EVENT_AKAMA_SCENE_21: + me->SetFacingTo(M_PI); + break; + case EVENT_AKAMA_SCENE_22: + if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) + illidan->AI()->Talk(SAY_ILLIDAN_AKAMA1); + break; + case EVENT_AKAMA_SCENE_23: + Talk(SAY_AKAMA_ILLIDAN1); + break; + case EVENT_AKAMA_SCENE_24: + if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) + illidan->AI()->Talk(SAY_ILLIDAN_AKAMA2); + break; + case EVENT_AKAMA_SCENE_25: + Talk(SAY_AKAMA_ILLIDAN2); + break; + case EVENT_AKAMA_SCENE_26: + if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) + illidan->AI()->Talk(SAY_ILLIDAN_AKAMA3); + break; + case EVENT_AKAMA_SCENE_27: + if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) + illidan->LoadEquipment(1, true); + break; + case EVENT_AKAMA_SCENE_28: + if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) + illidan->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE); + break; + case EVENT_AKAMA_SCENE_29: + if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDAN_STORMRAGE))) + { + illidan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + illidan->SetInCombatWithZone(); + AttackStart(illidan); + } + break; + case EVENT_AKAMA_SUMMON_ILLIDARI: + me->SummonCreature(NPC_ILLIDARI_ELITE, 742.55f, 359.12f, 353.0f, 4.35f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + events.ScheduleEvent(EVENT_AKAMA_SUMMON_ILLIDARI, urand(2000, 6000)); + break; + case EVENT_AKAMA_SPELL_CHAIN: + if (me->GetVictim()) + me->CastSpell(me->GetVictim(), SPELL_CHAIN_LIGHTNING, false); + events.ScheduleEvent(EVENT_AKAMA_SPELL_CHAIN, 20000); + break; + case EVENT_AKAMA_HEALTH: + if (me->HealthBelowPct(20)) + me->CastSpell(me, SPELL_HEALING_POTION, false); + events.ScheduleEvent(EVENT_AKAMA_HEALTH, 1000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap events; - SummonList summons; - InstanceScript* instance; - }; + private: + EventMap events; + SummonList summons; + InstanceScript* instance; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; class spell_illidan_draw_soul : public SpellScriptLoader { - public: - spell_illidan_draw_soul() : SpellScriptLoader("spell_illidan_draw_soul") { } + public: + spell_illidan_draw_soul() : SpellScriptLoader("spell_illidan_draw_soul") { } - class spell_illidan_draw_soul_SpellScript : public SpellScript - { - PrepareSpellScript(spell_illidan_draw_soul_SpellScript); + class spell_illidan_draw_soul_SpellScript : public SpellScript + { + PrepareSpellScript(spell_illidan_draw_soul_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(GetCaster(), SPELL_DRAW_SOUL_HEAL, true); - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + target->CastSpell(GetCaster(), SPELL_DRAW_SOUL_HEAL, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_illidan_draw_soul_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_illidan_draw_soul_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_illidan_draw_soul_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_illidan_draw_soul_SpellScript(); + } }; class spell_illidan_parasitic_shadowfiend : public SpellScriptLoader { - public: - spell_illidan_parasitic_shadowfiend() : SpellScriptLoader("spell_illidan_parasitic_shadowfiend") { } + public: + spell_illidan_parasitic_shadowfiend() : SpellScriptLoader("spell_illidan_parasitic_shadowfiend") { } - class spell_illidan_parasitic_shadowfiend_AuraScript : public AuraScript - { - PrepareAuraScript(spell_illidan_parasitic_shadowfiend_AuraScript) + class spell_illidan_parasitic_shadowfiend_AuraScript : public AuraScript + { + PrepareAuraScript(spell_illidan_parasitic_shadowfiend_AuraScript) - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (!GetTarget()->HasAura(SPELL_SHADOW_PRISON) && GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress()) - GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_PARASITIC_SHADOWFIENDS, true); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (!GetTarget()->HasAura(SPELL_SHADOW_PRISON) && GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress()) + GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_PARASITIC_SHADOWFIENDS, true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_illidan_parasitic_shadowfiend_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_illidan_parasitic_shadowfiend_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_illidan_parasitic_shadowfiend_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_illidan_parasitic_shadowfiend_AuraScript(); + } }; class spell_illidan_parasitic_shadowfiend_trigger : public SpellScriptLoader { - public: - spell_illidan_parasitic_shadowfiend_trigger() : SpellScriptLoader("spell_illidan_parasitic_shadowfiend_trigger") { } + public: + spell_illidan_parasitic_shadowfiend_trigger() : SpellScriptLoader("spell_illidan_parasitic_shadowfiend_trigger") { } - class spell_illidan_parasitic_shadowfiend_trigger_AuraScript : public AuraScript - { - PrepareAuraScript(spell_illidan_parasitic_shadowfiend_trigger_AuraScript) + class spell_illidan_parasitic_shadowfiend_trigger_AuraScript : public AuraScript + { + PrepareAuraScript(spell_illidan_parasitic_shadowfiend_trigger_AuraScript) - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (!GetTarget()->HasAura(SPELL_SHADOW_PRISON) && GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress()) - GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_PARASITIC_SHADOWFIENDS, true); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (!GetTarget()->HasAura(SPELL_SHADOW_PRISON) && GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress()) + GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_PARASITIC_SHADOWFIENDS, true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_illidan_parasitic_shadowfiend_trigger_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_illidan_parasitic_shadowfiend_trigger_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_illidan_parasitic_shadowfiend_trigger_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_illidan_parasitic_shadowfiend_trigger_AuraScript(); + } - class spell_illidan_parasitic_shadowfiend_trigger_SpellScript : public SpellScript - { - PrepareSpellScript(spell_illidan_parasitic_shadowfiend_trigger_SpellScript); + class spell_illidan_parasitic_shadowfiend_trigger_SpellScript : public SpellScript + { + PrepareSpellScript(spell_illidan_parasitic_shadowfiend_trigger_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Creature* target = GetHitCreature()) - target->DespawnOrUnsummon(1); - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Creature* target = GetHitCreature()) + target->DespawnOrUnsummon(1); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_illidan_parasitic_shadowfiend_trigger_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_illidan_parasitic_shadowfiend_trigger_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_illidan_parasitic_shadowfiend_trigger_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_illidan_parasitic_shadowfiend_trigger_SpellScript(); + } }; class spell_illidan_glaive_throw : public SpellScriptLoader @@ -1100,13 +1100,13 @@ class spell_illidan_glaive_throw : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { PreventHitEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(target, SPELL_SUMMON_GLAIVE, true); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, SPELL_SUMMON_GLAIVE, true); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_illidan_glaive_throw_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_illidan_glaive_throw_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -1127,25 +1127,25 @@ class spell_illidan_tear_of_azzinoth_summon_channel : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); - if (Unit* caster = GetCaster()) - { - if (GetTarget()->GetDistance2d(caster) > 25.0f) - { - SetDuration(0); - GetTarget()->CastSpell(GetTarget(), SPELL_UNCAGED_WRATH, true); - } - } + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + { + if (GetTarget()->GetDistance2d(caster) > 25.0f) + { + SetDuration(0); + GetTarget()->CastSpell(GetTarget(), SPELL_UNCAGED_WRATH, true); + } + } - // xinef: ugly hax, dunno how it really works on blizz - Map::PlayerList const& pl = GetTarget()->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* player = itr->GetSource()) - if (player->GetPositionX() > 693.4f || player->GetPositionY() < 271.8f || player->GetPositionX() < 658.43f || player->GetPositionY() > 338.68f) - { - GetTarget()->CastSpell(player, SPELL_CHARGE, true); - break; - } + // xinef: ugly hax, dunno how it really works on blizz + Map::PlayerList const& pl = GetTarget()->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* player = itr->GetSource()) + if (player->GetPositionX() > 693.4f || player->GetPositionY() < 271.8f || player->GetPositionX() < 658.43f || player->GetPositionY() > 338.68f) + { + GetTarget()->CastSpell(player, SPELL_CHARGE, true); + break; + } } void Register() @@ -1157,7 +1157,7 @@ class spell_illidan_tear_of_azzinoth_summon_channel : public SpellScriptLoader AuraScript* GetAuraScript() const { return new spell_illidan_tear_of_azzinoth_summon_channel_AuraScript(); - } + } }; class spell_illidan_shadow_prison : public SpellScriptLoader @@ -1171,7 +1171,7 @@ class spell_illidan_shadow_prison : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if(PlayerOrPetCheck()); + targets.remove_if(PlayerOrPetCheck()); } void Register() @@ -1195,17 +1195,17 @@ class spell_illidan_demon_transform1 : public SpellScriptLoader { PrepareAuraScript(spell_illidan_demon_transform1_AuraScript); - bool Load() - { - return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; + } void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); - SetDuration(0); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_TRANSFORM_2, true); - GetUnitOwner()->ToCreature()->LoadEquipment(0, true); + PreventDefaultAction(); + SetDuration(0); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_TRANSFORM_2, true); + GetUnitOwner()->ToCreature()->LoadEquipment(0, true); } void Register() @@ -1229,32 +1229,32 @@ class spell_illidan_demon_transform2 : public SpellScriptLoader { PrepareAuraScript(spell_illidan_demon_transform2_AuraScript); - bool Load() - { - return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; + } void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); + PreventDefaultAction(); - if (aurEff->GetTickNumber() == 1) - { - if (GetUnitOwner()->GetDisplayId() == GetUnitOwner()->GetNativeDisplayId()) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_FORM, true); - else - GetUnitOwner()->RemoveAurasDueToSpell(SPELL_DEMON_FORM); - } - else if (aurEff->GetTickNumber() == 2) - { - SetDuration(0); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_TRANSFORM_3, true); - if (Aura* aura = GetUnitOwner()->GetAura(SPELL_DEMON_TRANSFORM_3)) - aura->SetDuration(4500); + if (aurEff->GetTickNumber() == 1) + { + if (GetUnitOwner()->GetDisplayId() == GetUnitOwner()->GetNativeDisplayId()) + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_FORM, true); + else + GetUnitOwner()->RemoveAurasDueToSpell(SPELL_DEMON_FORM); + } + else if (aurEff->GetTickNumber() == 2) + { + SetDuration(0); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DEMON_TRANSFORM_3, true); + if (Aura* aura = GetUnitOwner()->GetAura(SPELL_DEMON_TRANSFORM_3)) + aura->SetDuration(4500); - if (!GetUnitOwner()->HasAura(SPELL_DEMON_FORM)) - GetUnitOwner()->ToCreature()->LoadEquipment(1, true); - } + if (!GetUnitOwner()->HasAura(SPELL_DEMON_FORM)) + GetUnitOwner()->ToCreature()->LoadEquipment(1, true); + } } void Register() @@ -1281,13 +1281,13 @@ class spell_illidan_flame_burst : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { PreventHitEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(target, SPELL_FLAME_BURST_EFFECT, true); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, SPELL_FLAME_BURST_EFFECT, true); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_illidan_flame_burst_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_illidan_flame_burst_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -1309,17 +1309,17 @@ class spell_illidan_found_target : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { PreventHitEffect(effIndex); - if (Unit* target = GetHitUnit()) - if (GetCaster()->GetDistance(target) < 2.0f) - { - GetCaster()->CastSpell(target, SPELL_CONSUME_SOUL, true); - GetCaster()->CastSpell(GetCaster(), SPELL_FIND_TARGET, true); - } + if (Unit* target = GetHitUnit()) + if (GetCaster()->GetDistance(target) < 2.0f) + { + GetCaster()->CastSpell(target, SPELL_CONSUME_SOUL, true); + GetCaster()->CastSpell(GetCaster(), SPELL_FIND_TARGET, true); + } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_illidan_found_target_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_illidan_found_target_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -1338,28 +1338,28 @@ class spell_illidan_cage_trap : public SpellScriptLoader { PrepareSpellScript(spell_illidan_cage_trap_SpellScript); - bool Load() - { - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } void HandleScriptEffect(SpellEffIndex effIndex) { PreventHitEffect(effIndex); - if (Creature* target = GetHitCreature()) - if (GetCaster()->GetExactDist2d(target) < 4.0f) - { - target->AI()->DoAction(ACTION_ILLIDAN_CAGED); - target->CastSpell(target, SPELL_CAGE_TRAP, true); - GetCaster()->ToCreature()->DespawnOrUnsummon(1); - if (GameObject* gobject = GetCaster()->FindNearestGameObject(GO_CAGE_TRAP, 10.0f)) - gobject->SetLootState(GO_JUST_DEACTIVATED); - } + if (Creature* target = GetHitCreature()) + if (GetCaster()->GetExactDist2d(target) < 4.0f) + { + target->AI()->DoAction(ACTION_ILLIDAN_CAGED); + target->CastSpell(target, SPELL_CAGE_TRAP, true); + GetCaster()->ToCreature()->DespawnOrUnsummon(1); + if (GameObject* gobject = GetCaster()->FindNearestGameObject(GO_CAGE_TRAP, 10.0f)) + gobject->SetLootState(GO_JUST_DEACTIVATED); + } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_illidan_cage_trap_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_illidan_cage_trap_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -1380,12 +1380,12 @@ class spell_illidan_cage_trap_stun : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); - SetDuration(0); + PreventDefaultAction(); + SetDuration(0); - for (uint32 i = SPELL_CAGED_SUMMON1; i <= SPELL_CAGED_SUMMON8; ++i) - GetTarget()->CastSpell(GetTarget(), i, true); - GetTarget()->CastSpell(GetTarget(), SPELL_CAGED_DEBUFF, true); + for (uint32 i = SPELL_CAGED_SUMMON1; i <= SPELL_CAGED_SUMMON8; ++i) + GetTarget()->CastSpell(GetTarget(), i, true); + GetTarget()->CastSpell(GetTarget(), SPELL_CAGED_DEBUFF, true); } void Register() @@ -1404,16 +1404,16 @@ void AddSC_boss_illidan() { new boss_illidan_stormrage(); new npc_akama_illidan(); - new spell_illidan_draw_soul(); - new spell_illidan_parasitic_shadowfiend(); - new spell_illidan_parasitic_shadowfiend_trigger(); - new spell_illidan_glaive_throw(); - new spell_illidan_tear_of_azzinoth_summon_channel(); - new spell_illidan_shadow_prison(); - new spell_illidan_demon_transform1(); - new spell_illidan_demon_transform2(); - new spell_illidan_flame_burst(); - new spell_illidan_found_target(); - new spell_illidan_cage_trap(); - new spell_illidan_cage_trap_stun(); + new spell_illidan_draw_soul(); + new spell_illidan_parasitic_shadowfiend(); + new spell_illidan_parasitic_shadowfiend_trigger(); + new spell_illidan_glaive_throw(); + new spell_illidan_tear_of_azzinoth_summon_channel(); + new spell_illidan_shadow_prison(); + new spell_illidan_demon_transform1(); + new spell_illidan_demon_transform2(); + new spell_illidan_flame_burst(); + new spell_illidan_found_target(); + new spell_illidan_cage_trap(); + new spell_illidan_cage_trap_stun(); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index 91e42c284..4f901cf9e 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -8,153 +8,153 @@ REWRITTEN BY XINEF enum Says { - SAY_TAUNT = 0, - SAY_AGGRO = 1, - SAY_SPELL = 2, - SAY_SLAY = 3, - SAY_ENRAGE = 4, - SAY_DEATH = 5, - SAY_EMOTE_FRENZY = 6 + SAY_TAUNT = 0, + SAY_AGGRO = 1, + SAY_SPELL = 2, + SAY_SLAY = 3, + SAY_ENRAGE = 4, + SAY_DEATH = 5, + SAY_EMOTE_FRENZY = 6 }; enum Spells { - SPELL_PRISMATIC_AURA_SHADOW = 40880, - SPELL_PRISMATIC_AURA_FIRE = 40882, - SPELL_PRISMATIC_AURA_NATURE = 40883, - SPELL_PRISMATIC_AURA_ARCANE = 40891, - SPELL_PRISMATIC_AURA_FROST = 40896, - SPELL_PRISMATIC_AURA_HOLY = 40897, - SPELL_SABER_LASH_AURA = 40816, - SPELL_SABER_LASH = 40810, - SPELL_SILENCING_SHRIEK = 40823, - SPELL_RANDOM_PERIODIC = 40867, - SPELL_SINFUL_PERIODIC = 40862, - SPELL_SINISTER_PERIODIC = 40863, - SPELL_VILE_PERIODIC = 40865, - SPELL_WICKED_PERIODIC = 40866, - SPELL_FATAL_ATTRACTION = 40869, - SPELL_FATAL_ATTRACTION_AURA = 41001, - SPELL_FATAL_ATTRACTION_DAMAGE = 40871, - SPELL_ENRAGE = 45078, - SPELL_FRENZY = 40683, - SPELL_SABER_LASH_IMMUNITY = 43690 + SPELL_PRISMATIC_AURA_SHADOW = 40880, + SPELL_PRISMATIC_AURA_FIRE = 40882, + SPELL_PRISMATIC_AURA_NATURE = 40883, + SPELL_PRISMATIC_AURA_ARCANE = 40891, + SPELL_PRISMATIC_AURA_FROST = 40896, + SPELL_PRISMATIC_AURA_HOLY = 40897, + SPELL_SABER_LASH_AURA = 40816, + SPELL_SABER_LASH = 40810, + SPELL_SILENCING_SHRIEK = 40823, + SPELL_RANDOM_PERIODIC = 40867, + SPELL_SINFUL_PERIODIC = 40862, + SPELL_SINISTER_PERIODIC = 40863, + SPELL_VILE_PERIODIC = 40865, + SPELL_WICKED_PERIODIC = 40866, + SPELL_FATAL_ATTRACTION = 40869, + SPELL_FATAL_ATTRACTION_AURA = 41001, + SPELL_FATAL_ATTRACTION_DAMAGE = 40871, + SPELL_ENRAGE = 45078, + SPELL_FRENZY = 40683, + SPELL_SABER_LASH_IMMUNITY = 43690 }; enum Misc { - EVENT_KILL_TALK = 1, - EVENT_CHECK_HEALTH = 2, - EVENT_RANDOM_TALK = 3, - EVENT_SPELL_ENRAGE = 4, - EVENT_SPELL_PRISMATIC_AURA = 5, - EVENT_SPELL_SILENCING_SHRIEK = 6, - EVENT_SPELL_FATAL_ATTRACTION = 7, - EVENT_SPELL_SABER_LASH = 8 + EVENT_KILL_TALK = 1, + EVENT_CHECK_HEALTH = 2, + EVENT_RANDOM_TALK = 3, + EVENT_SPELL_ENRAGE = 4, + EVENT_SPELL_PRISMATIC_AURA = 5, + EVENT_SPELL_SILENCING_SHRIEK = 6, + EVENT_SPELL_FATAL_ATTRACTION = 7, + EVENT_SPELL_SABER_LASH = 8 }; class boss_mother_shahraz : public CreatureScript { - public: - boss_mother_shahraz() : CreatureScript("boss_mother_shahraz") { } + public: + boss_mother_shahraz() : CreatureScript("boss_mother_shahraz") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_shahrazAI : public BossAI - { - boss_shahrazAI(Creature* creature) : BossAI(creature, DATA_MOTHER_SHAHRAZ) - { - } + struct boss_shahrazAI : public BossAI + { + boss_shahrazAI(Creature* creature) : BossAI(creature, DATA_MOTHER_SHAHRAZ) + { + } - void Reset() - { - BossAI::Reset(); - } + void Reset() + { + BossAI::Reset(); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); - me->CastSpell(me, SPELL_SABER_LASH_AURA, true); - me->CastSpell(me, SPELL_RANDOM_PERIODIC, true); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - events.ScheduleEvent(EVENT_RANDOM_TALK, 60000); - events.ScheduleEvent(EVENT_SPELL_PRISMATIC_AURA, 0); - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); - events.ScheduleEvent(EVENT_SPELL_SILENCING_SHRIEK, 30000); - events.ScheduleEvent(EVENT_SPELL_FATAL_ATTRACTION, 50000); - events.ScheduleEvent(EVENT_SPELL_SABER_LASH, 4000); - } + me->CastSpell(me, SPELL_SABER_LASH_AURA, true); + me->CastSpell(me, SPELL_RANDOM_PERIODIC, true); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_RANDOM_TALK, 60000); + events.ScheduleEvent(EVENT_SPELL_PRISMATIC_AURA, 0); + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); + events.ScheduleEvent(EVENT_SPELL_SILENCING_SHRIEK, 30000); + events.ScheduleEvent(EVENT_SPELL_FATAL_ATTRACTION, 50000); + events.ScheduleEvent(EVENT_SPELL_SABER_LASH, 4000); + } - void KilledUnit(Unit* /*victim*/) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - Talk(SAY_DEATH); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + Talk(SAY_DEATH); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_HEALTH: - if (HealthBelowPct(10)) - { - me->CastSpell(me, SPELL_FRENZY, true); - Talk(SAY_EMOTE_FRENZY); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_SPELL_ENRAGE: - me->CastSpell(me, SPELL_ENRAGE, true); - Talk(SAY_ENRAGE); - break; - case EVENT_RANDOM_TALK: - Talk(SAY_TAUNT); - events.ScheduleEvent(EVENT_RANDOM_TALK, urand(60000, 120000)); - break; - case EVENT_SPELL_SABER_LASH: - me->CastSpell(me->GetVictim(), SPELL_SABER_LASH, false); - events.ScheduleEvent(EVENT_SPELL_SABER_LASH, 30000); - break; - case EVENT_SPELL_PRISMATIC_AURA: - me->CastSpell(me, RAND(SPELL_PRISMATIC_AURA_SHADOW, SPELL_PRISMATIC_AURA_FIRE, SPELL_PRISMATIC_AURA_NATURE, SPELL_PRISMATIC_AURA_ARCANE, SPELL_PRISMATIC_AURA_FROST, SPELL_PRISMATIC_AURA_HOLY), false); - events.ScheduleEvent(EVENT_SPELL_PRISMATIC_AURA, 15000); - break; - case EVENT_SPELL_SILENCING_SHRIEK: - me->CastSpell(me, SPELL_SILENCING_SHRIEK, false); - events.ScheduleEvent(EVENT_SPELL_SILENCING_SHRIEK, 30000); - break; - case EVENT_SPELL_FATAL_ATTRACTION: - Talk(SAY_SPELL); - me->CastCustomSpell(SPELL_FATAL_ATTRACTION, SPELLVALUE_MAX_TARGETS, 3, me, false); - events.ScheduleEvent(EVENT_SPELL_FATAL_ATTRACTION, 60000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_HEALTH: + if (HealthBelowPct(10)) + { + me->CastSpell(me, SPELL_FRENZY, true); + Talk(SAY_EMOTE_FRENZY); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_SPELL_ENRAGE: + me->CastSpell(me, SPELL_ENRAGE, true); + Talk(SAY_ENRAGE); + break; + case EVENT_RANDOM_TALK: + Talk(SAY_TAUNT); + events.ScheduleEvent(EVENT_RANDOM_TALK, urand(60000, 120000)); + break; + case EVENT_SPELL_SABER_LASH: + me->CastSpell(me->GetVictim(), SPELL_SABER_LASH, false); + events.ScheduleEvent(EVENT_SPELL_SABER_LASH, 30000); + break; + case EVENT_SPELL_PRISMATIC_AURA: + me->CastSpell(me, RAND(SPELL_PRISMATIC_AURA_SHADOW, SPELL_PRISMATIC_AURA_FIRE, SPELL_PRISMATIC_AURA_NATURE, SPELL_PRISMATIC_AURA_ARCANE, SPELL_PRISMATIC_AURA_FROST, SPELL_PRISMATIC_AURA_HOLY), false); + events.ScheduleEvent(EVENT_SPELL_PRISMATIC_AURA, 15000); + break; + case EVENT_SPELL_SILENCING_SHRIEK: + me->CastSpell(me, SPELL_SILENCING_SHRIEK, false); + events.ScheduleEvent(EVENT_SPELL_SILENCING_SHRIEK, 30000); + break; + case EVENT_SPELL_FATAL_ATTRACTION: + Talk(SAY_SPELL); + me->CastCustomSpell(SPELL_FATAL_ATTRACTION, SPELLVALUE_MAX_TARGETS, 3, me, false); + events.ScheduleEvent(EVENT_SPELL_FATAL_ATTRACTION, 60000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_mother_shahraz_random_periodic : public SpellScriptLoader @@ -166,16 +166,16 @@ class spell_mother_shahraz_random_periodic : public SpellScriptLoader { PrepareAuraScript(spell_mother_shahraz_random_periodic_AuraScript); - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - if (effect->GetTickNumber()%5 == 1) - GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SINFUL_PERIODIC, SPELL_SINISTER_PERIODIC, SPELL_VILE_PERIODIC, SPELL_WICKED_PERIODIC), true); - } + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + if (effect->GetTickNumber()%5 == 1) + GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SINFUL_PERIODIC, SPELL_SINISTER_PERIODIC, SPELL_VILE_PERIODIC, SPELL_WICKED_PERIODIC), true); + } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_random_periodic_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_random_periodic_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -194,16 +194,16 @@ class spell_mother_shahraz_beam_periodic : public SpellScriptLoader { PrepareAuraScript(spell_mother_shahraz_beam_periodic_AuraScript); - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0)) - GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true); - } + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0)) + GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true); + } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_beam_periodic_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_beam_periodic_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -224,20 +224,20 @@ class spell_mother_shahraz_saber_lash : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return false; + return false; } - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - if (Unit* target = GetUnitOwner()->GetVictim()) - GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true); - } + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + if (Unit* target = GetUnitOwner()->GetVictim()) + GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true); + } void Register() { DoCheckProc += AuraCheckProcFn(spell_mother_shahraz_saber_lash_AuraScript::CheckProc); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_saber_lash_AuraScript::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_saber_lash_AuraScript::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -258,27 +258,27 @@ class spell_mother_shahraz_fatal_attraction : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_SABER_LASH_IMMUNITY)); - if (targets.size() <= 1) - FinishCast(SPELL_FAILED_DONT_REPORT); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_SABER_LASH_IMMUNITY)); + if (targets.size() <= 1) + FinishCast(SPELL_FAILED_DONT_REPORT); } void SetDest(SpellDestination& dest) { - std::list const* targetsInfo = GetSpell()->GetUniqueTargetInfo(); - for (std::list::const_iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit) - if (Unit* target = ObjectAccessor::GetUnit(*GetCaster(), ihit->targetGUID)) - { - dest.Relocate(*target); - if (roll_chance_i(50)) - break; - } + std::list const* targetsInfo = GetSpell()->GetUniqueTargetInfo(); + for (std::list::const_iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit) + if (Unit* target = ObjectAccessor::GetUnit(*GetCaster(), ihit->targetGUID)) + { + dest.Relocate(*target); + if (roll_chance_i(50)) + break; + } } void HandleTeleportUnits(SpellEffIndex effIndex) { - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, SPELL_FATAL_ATTRACTION_AURA, true); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_FATAL_ATTRACTION_AURA, true); } void Register() @@ -306,12 +306,12 @@ class spell_mother_shahraz_fatal_attraction_dummy : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - if (Unit* target = GetHitUnit()) - { - target->CastSpell(target, SPELL_FATAL_ATTRACTION_DAMAGE, true); - if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_FATAL_ATTRACTION_AURA, EFFECT_1)) - aurEff->SetAmount(aurEff->GetTickNumber()); - } + if (Unit* target = GetHitUnit()) + { + target->CastSpell(target, SPELL_FATAL_ATTRACTION_DAMAGE, true); + if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_FATAL_ATTRACTION_AURA, EFFECT_1)) + aurEff->SetAmount(aurEff->GetTickNumber()); + } } void Register() @@ -335,18 +335,18 @@ class spell_mother_shahraz_fatal_attraction_aura : public SpellScriptLoader { PrepareAuraScript(spell_mother_shahraz_fatal_attraction_aura_AuraScript); - void Update(AuraEffect const* effect) - { - if (effect->GetTickNumber() > uint32(effect->GetAmount()+1)) - { - PreventDefaultAction(); - SetDuration(0); - } - } + void Update(AuraEffect const* effect) + { + if (effect->GetTickNumber() > uint32(effect->GetAmount()+1)) + { + PreventDefaultAction(); + SetDuration(0); + } + } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_fatal_attraction_aura_AuraScript::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_mother_shahraz_fatal_attraction_aura_AuraScript::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -359,10 +359,10 @@ class spell_mother_shahraz_fatal_attraction_aura : public SpellScriptLoader void AddSC_boss_mother_shahraz() { new boss_mother_shahraz(); - new spell_mother_shahraz_random_periodic(); - new spell_mother_shahraz_beam_periodic(); - new spell_mother_shahraz_saber_lash(); - new spell_mother_shahraz_fatal_attraction(); - new spell_mother_shahraz_fatal_attraction_dummy(); - new spell_mother_shahraz_fatal_attraction_aura(); + new spell_mother_shahraz_random_periodic(); + new spell_mother_shahraz_beam_periodic(); + new spell_mother_shahraz_saber_lash(); + new spell_mother_shahraz_fatal_attraction(); + new spell_mother_shahraz_fatal_attraction_dummy(); + new spell_mother_shahraz_fatal_attraction_aura(); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index 093882b49..1b82156ba 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -9,593 +9,593 @@ REWRITTEN BY XINEF enum Says { - //Suffering - SUFF_SAY_FREED = 0, - SUFF_SAY_AGGRO = 1, - SUFF_SAY_SLAY = 2, - SUFF_SAY_RECAP = 3, - SUFF_SAY_AFTER = 4, - SUFF_SAY_ENRAGE = 5, - SUFF_EMOTE_ENRAGE = 6, + //Suffering + SUFF_SAY_FREED = 0, + SUFF_SAY_AGGRO = 1, + SUFF_SAY_SLAY = 2, + SUFF_SAY_RECAP = 3, + SUFF_SAY_AFTER = 4, + SUFF_SAY_ENRAGE = 5, + SUFF_EMOTE_ENRAGE = 6, - //Desire - DESI_SAY_FREED = 0, - DESI_SAY_SLAY = 1, - DESI_SAY_SPEC = 2, - DESI_SAY_RECAP = 3, - DESI_SAY_AFTER = 4, + //Desire + DESI_SAY_FREED = 0, + DESI_SAY_SLAY = 1, + DESI_SAY_SPEC = 2, + DESI_SAY_RECAP = 3, + DESI_SAY_AFTER = 4, - //Anger - ANGER_SAY_FREED = 0, - ANGER_SAY_SLAY = 1, - ANGER_SAY_SPEC = 2, - ANGER_SAY_RECAP = 3, - ANGER_SAY_DEATH = 4 + //Anger + ANGER_SAY_FREED = 0, + ANGER_SAY_SLAY = 1, + ANGER_SAY_SPEC = 2, + ANGER_SAY_RECAP = 3, + ANGER_SAY_DEATH = 4 }; enum Spells { - SPELL_EMERGE_VISUAL = 50142, - SPELL_SUMMON_ESSENCE_OF_SUFFERING = 41488, - SPELL_SUMMON_ESSENCE_OF_DESIRE = 41493, - SPELL_SUMMON_ESSENCE_OF_ANGER = 41496, - SPELL_SUMMON_ENSLAVED_SOUL = 41537, + SPELL_EMERGE_VISUAL = 50142, + SPELL_SUMMON_ESSENCE_OF_SUFFERING = 41488, + SPELL_SUMMON_ESSENCE_OF_DESIRE = 41493, + SPELL_SUMMON_ESSENCE_OF_ANGER = 41496, + SPELL_SUMMON_ENSLAVED_SOUL = 41537, - // Suffering - SPELL_AURA_OF_SUFFERING = 41292, - SPELL_AURA_OF_SUFFERING_TRIGGER = 42017, - SPELL_ESSENCE_OF_SUFFERING_PASSIVE = 41296, - SPELL_ESSENCE_OF_SUFFERING_PASSIVE2 = 41623, - SPELL_FRENZY = 41305, - SPELL_SOUL_DRAIN = 41303, + // Suffering + SPELL_AURA_OF_SUFFERING = 41292, + SPELL_AURA_OF_SUFFERING_TRIGGER = 42017, + SPELL_ESSENCE_OF_SUFFERING_PASSIVE = 41296, + SPELL_ESSENCE_OF_SUFFERING_PASSIVE2 = 41623, + SPELL_FRENZY = 41305, + SPELL_SOUL_DRAIN = 41303, - // Desire - SPELL_AURA_OF_DESIRE = 41350, - SPELL_AURA_OF_DESIRE_DAMAGE = 41352, - SPELL_RUNE_SHIELD = 41431, - SPELL_DEADEN = 41410, - SPELL_SPIRIT_SHOCK = 41426, + // Desire + SPELL_AURA_OF_DESIRE = 41350, + SPELL_AURA_OF_DESIRE_DAMAGE = 41352, + SPELL_RUNE_SHIELD = 41431, + SPELL_DEADEN = 41410, + SPELL_SPIRIT_SHOCK = 41426, - // Anger - SPELL_AURA_OF_ANGER = 41337, - SPELL_SPITE = 41376, - SPELL_SPITE_DAMAGE = 41377, - SPELL_SOUL_SCREAM = 41545, - SPELL_SEETHE = 41364 + // Anger + SPELL_AURA_OF_ANGER = 41337, + SPELL_SPITE = 41376, + SPELL_SPITE_DAMAGE = 41377, + SPELL_SOUL_SCREAM = 41545, + SPELL_SEETHE = 41364 }; enum Misc { - ACTION_ESSENCE_OF_SUFFERING = 1, - ACTION_ESSENCE_OF_DESIRE = 2, - ACTION_ESSENCE_OF_ANGER = 3, - ACTION_ENGAGE_ESSENCE = 4, + ACTION_ESSENCE_OF_SUFFERING = 1, + ACTION_ESSENCE_OF_DESIRE = 2, + ACTION_ESSENCE_OF_ANGER = 3, + ACTION_ENGAGE_ESSENCE = 4, - EVENT_ESSENCE_OF_SUFFERING = 1, - EVENT_ESSENCE_OF_DESIRE = 2, - EVENT_ESSENCE_OF_ANGER = 3, - EVENT_ENGAGE_ESSENCE = 4, - EVENT_SPAWN_ENSLAVED_SOULS = 5, - EVENT_SPAWN_SOUL = 6, - EVENT_SUCK_ESSENCE = 7, + EVENT_ESSENCE_OF_SUFFERING = 1, + EVENT_ESSENCE_OF_DESIRE = 2, + EVENT_ESSENCE_OF_ANGER = 3, + EVENT_ENGAGE_ESSENCE = 4, + EVENT_SPAWN_ENSLAVED_SOULS = 5, + EVENT_SPAWN_SOUL = 6, + EVENT_SUCK_ESSENCE = 7, - EVENT_SUFF_FRENZY = 10, - EVENT_SUFF_FRENZY_EMOTE = 11, - EVENT_SUFF_SOUL_DRAIN = 12, + EVENT_SUFF_FRENZY = 10, + EVENT_SUFF_FRENZY_EMOTE = 11, + EVENT_SUFF_SOUL_DRAIN = 12, - EVENT_DESI_DEADEN = 20, - EVENT_DESI_SPIRIT_SHOCK = 21, - EVENT_DESI_RUNE_SHIELD = 22, + EVENT_DESI_DEADEN = 20, + EVENT_DESI_SPIRIT_SHOCK = 21, + EVENT_DESI_RUNE_SHIELD = 22, - EVENT_ANGER_SPITE = 30, - EVENT_ANGER_SOUL_SCREAM = 31, - EVENT_ANGER_SEETHE = 32, + EVENT_ANGER_SPITE = 30, + EVENT_ANGER_SOUL_SCREAM = 31, + EVENT_ANGER_SEETHE = 32, - EVENT_KILL_TALK = 100, - POINT_GO_BACK = 1 + EVENT_KILL_TALK = 100, + POINT_GO_BACK = 1 }; class SuckBackEvent : public BasicEvent { - public: - SuckBackEvent(Creature& owner, uint32 action) : BasicEvent(), _owner(owner), _action(action) { } + public: + SuckBackEvent(Creature& owner, uint32 action) : BasicEvent(), _owner(owner), _action(action) { } - bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) - { - if (_owner.IsSummon()) - if (Unit* summoner = _owner.ToTempSummon()->GetSummoner()) - { - summoner->GetAI()->DoAction(_action); - _owner.SetStandState(UNIT_STAND_STATE_SUBMERGED); - _owner.DespawnOrUnsummon(200); - } - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) + { + if (_owner.IsSummon()) + if (Unit* summoner = _owner.ToTempSummon()->GetSummoner()) + { + summoner->GetAI()->DoAction(_action); + _owner.SetStandState(UNIT_STAND_STATE_SUBMERGED); + _owner.DespawnOrUnsummon(200); + } + return true; + } - private: - Creature& _owner; - uint32 _action; + private: + Creature& _owner; + uint32 _action; }; class boss_reliquary_of_souls : public CreatureScript { - public: - boss_reliquary_of_souls() : CreatureScript("boss_reliquary_of_souls") { } + public: + boss_reliquary_of_souls() : CreatureScript("boss_reliquary_of_souls") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_reliquary_of_soulsAI : public BossAI - { - boss_reliquary_of_soulsAI(Creature* creature) : BossAI(creature, DATA_RELIQUARY_OF_SOULS) - { - } + struct boss_reliquary_of_soulsAI : public BossAI + { + boss_reliquary_of_soulsAI(Creature* creature) : BossAI(creature, DATA_RELIQUARY_OF_SOULS) + { + } - void Reset() - { - BossAI::Reset(); - me->SetStandState(UNIT_STAND_STATE_SLEEP); - } + void Reset() + { + BossAI::Reset(); + me->SetStandState(UNIT_STAND_STATE_SLEEP); + } - void MoveInLineOfSight(Unit* who) - { - if (!who || me->getStandState() != UNIT_STAND_STATE_SLEEP || who->GetTypeId() != TYPEID_PLAYER || me->GetDistance2d(who) > 90.0f || who->ToPlayer()->IsGameMaster()) - return; + void MoveInLineOfSight(Unit* who) + { + if (!who || me->getStandState() != UNIT_STAND_STATE_SLEEP || who->GetTypeId() != TYPEID_PLAYER || me->GetDistance2d(who) > 90.0f || who->ToPlayer()->IsGameMaster()) + return; - me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_ESSENCE_OF_SUFFERING, 5000); // ZOMG! 15000); - me->SetStandState(UNIT_STAND_STATE_STAND); - } + me->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_ESSENCE_OF_SUFFERING, 5000); // ZOMG! 15000); + me->SetStandState(UNIT_STAND_STATE_STAND); + } - void DoAction(int32 param) - { - if (param == ACTION_ESSENCE_OF_SUFFERING) - { - me->SetStandState(UNIT_STAND_STATE_STAND); - events.ScheduleEvent(EVENT_SUCK_ESSENCE, 1000); - events.ScheduleEvent(EVENT_SPAWN_ENSLAVED_SOULS, 8000); - events.ScheduleEvent(EVENT_ESSENCE_OF_DESIRE, 38000); - } - else if (param == ACTION_ESSENCE_OF_DESIRE) - { - me->SetStandState(UNIT_STAND_STATE_STAND); - events.ScheduleEvent(EVENT_SUCK_ESSENCE, 1000); - events.ScheduleEvent(EVENT_SPAWN_ENSLAVED_SOULS, 8000); - events.ScheduleEvent(EVENT_ESSENCE_OF_ANGER, 38000); - } - else if (param == ACTION_ESSENCE_OF_ANGER) - { - } - } + void DoAction(int32 param) + { + if (param == ACTION_ESSENCE_OF_SUFFERING) + { + me->SetStandState(UNIT_STAND_STATE_STAND); + events.ScheduleEvent(EVENT_SUCK_ESSENCE, 1000); + events.ScheduleEvent(EVENT_SPAWN_ENSLAVED_SOULS, 8000); + events.ScheduleEvent(EVENT_ESSENCE_OF_DESIRE, 38000); + } + else if (param == ACTION_ESSENCE_OF_DESIRE) + { + me->SetStandState(UNIT_STAND_STATE_STAND); + events.ScheduleEvent(EVENT_SUCK_ESSENCE, 1000); + events.ScheduleEvent(EVENT_SPAWN_ENSLAVED_SOULS, 8000); + events.ScheduleEvent(EVENT_ESSENCE_OF_ANGER, 38000); + } + else if (param == ACTION_ESSENCE_OF_ANGER) + { + } + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - } + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() == NPC_ENSLAVED_SOUL) - return; + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() == NPC_ENSLAVED_SOUL) + return; - summon->SetReactState(REACT_PASSIVE); - summon->CastSpell(summon, SPELL_EMERGE_VISUAL, true); - events.ScheduleEvent(EVENT_ENGAGE_ESSENCE, 4000); - } + summon->SetReactState(REACT_PASSIVE); + summon->CastSpell(summon, SPELL_EMERGE_VISUAL, true); + events.ScheduleEvent(EVENT_ENGAGE_ESSENCE, 4000); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + } - void AttackStart(Unit*) { } + void AttackStart(Unit*) { } - void JustDied(Unit* killer) - { - summons.clear(); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + summons.clear(); + BossAI::JustDied(killer); + } - void UpdateAI(uint32 diff) - { - if (me->getStandState() == UNIT_STAND_STATE_SLEEP) - return; + void UpdateAI(uint32 diff) + { + if (me->getStandState() == UNIT_STAND_STATE_SLEEP) + return; - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_SUCK_ESSENCE: - me->SetStandState(UNIT_STAND_STATE_STAND); - break; - case EVENT_ENGAGE_ESSENCE: - summons.DoAction(ACTION_ENGAGE_ESSENCE); - break; - case EVENT_ESSENCE_OF_SUFFERING: - me->SetStandState(UNIT_STAND_STATE_SUBMERGED); - me->CastSpell(me, SPELL_SUMMON_ESSENCE_OF_SUFFERING, false); - break; - case EVENT_ESSENCE_OF_DESIRE: - summons.DespawnAll(); - me->SetStandState(UNIT_STAND_STATE_SUBMERGED); - me->CastSpell(me, SPELL_SUMMON_ESSENCE_OF_DESIRE, false); - break; - case EVENT_ESSENCE_OF_ANGER: - summons.DespawnAll(); - me->SetStandState(UNIT_STAND_STATE_SUBMERGED); - me->CastSpell(me, SPELL_SUMMON_ESSENCE_OF_ANGER, false); - break; - case EVENT_SPAWN_ENSLAVED_SOULS: - events.ScheduleEvent(EVENT_SPAWN_SOUL, 0); - events.ScheduleEvent(EVENT_SPAWN_SOUL, 0); - for (uint8 i = 0; i < 16; ++i) - events.ScheduleEvent(EVENT_SPAWN_SOUL, i*1200); - break; - case EVENT_SPAWN_SOUL: - me->CastCustomSpell(SPELL_SUMMON_ENSLAVED_SOUL, SPELLVALUE_MAX_TARGETS, 1, me, false); - break; - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_SUCK_ESSENCE: + me->SetStandState(UNIT_STAND_STATE_STAND); + break; + case EVENT_ENGAGE_ESSENCE: + summons.DoAction(ACTION_ENGAGE_ESSENCE); + break; + case EVENT_ESSENCE_OF_SUFFERING: + me->SetStandState(UNIT_STAND_STATE_SUBMERGED); + me->CastSpell(me, SPELL_SUMMON_ESSENCE_OF_SUFFERING, false); + break; + case EVENT_ESSENCE_OF_DESIRE: + summons.DespawnAll(); + me->SetStandState(UNIT_STAND_STATE_SUBMERGED); + me->CastSpell(me, SPELL_SUMMON_ESSENCE_OF_DESIRE, false); + break; + case EVENT_ESSENCE_OF_ANGER: + summons.DespawnAll(); + me->SetStandState(UNIT_STAND_STATE_SUBMERGED); + me->CastSpell(me, SPELL_SUMMON_ESSENCE_OF_ANGER, false); + break; + case EVENT_SPAWN_ENSLAVED_SOULS: + events.ScheduleEvent(EVENT_SPAWN_SOUL, 0); + events.ScheduleEvent(EVENT_SPAWN_SOUL, 0); + for (uint8 i = 0; i < 16; ++i) + events.ScheduleEvent(EVENT_SPAWN_SOUL, i*1200); + break; + case EVENT_SPAWN_SOUL: + me->CastCustomSpell(SPELL_SUMMON_ENSLAVED_SOUL, SPELLVALUE_MAX_TARGETS, 1, me, false); + break; + } - EnterEvadeIfOutOfCombatArea(); - } - - bool CheckEvadeIfOutOfCombatArea() const - { - return !SelectTargetFromPlayerList(80.0f); - } - }; + EnterEvadeIfOutOfCombatArea(); + } + + bool CheckEvadeIfOutOfCombatArea() const + { + return !SelectTargetFromPlayerList(80.0f); + } + }; }; class boss_essence_of_suffering : public CreatureScript { - public: - boss_essence_of_suffering() : CreatureScript("boss_essence_of_suffering") { } + public: + boss_essence_of_suffering() : CreatureScript("boss_essence_of_suffering") { } - CreatureAI* GetAI(Creature* creature) const - { - return new boss_essence_of_sufferingAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_essence_of_sufferingAI(creature); + } - struct boss_essence_of_sufferingAI : public ScriptedAI - { - boss_essence_of_sufferingAI(Creature* creature) : ScriptedAI(creature) { } + struct boss_essence_of_sufferingAI : public ScriptedAI + { + boss_essence_of_sufferingAI(Creature* creature) : ScriptedAI(creature) { } - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void DoAction(int32 param) - { - if (param == ACTION_ENGAGE_ESSENCE) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetInCombatWithZone(); - } - } + void DoAction(int32 param) + { + if (param == ACTION_ENGAGE_ESSENCE) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE || id != POINT_GO_BACK) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE || id != POINT_GO_BACK) + return; - me->m_Events.AddEvent(new SuckBackEvent(*me, ACTION_ESSENCE_OF_SUFFERING), me->m_Events.CalculateTime(1500)); - me->SetTarget(0); - me->SetFacingTo(M_PI/2.0f); - } + me->m_Events.AddEvent(new SuckBackEvent(*me, ACTION_ESSENCE_OF_SUFFERING), me->m_Events.CalculateTime(1500)); + me->SetTarget(0); + me->SetFacingTo(M_PI/2.0f); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - { - damage = 0; - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - { - me->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_SUFFERING_PASSIVE); // prevent fixate from triggering - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - Talk(SUFF_SAY_RECAP); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(POINT_GO_BACK, me->GetHomePosition(), false); - events.Reset(); - } - } - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + { + damage = 0; + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + me->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_SUFFERING_PASSIVE); // prevent fixate from triggering + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + Talk(SUFF_SAY_RECAP); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(POINT_GO_BACK, me->GetHomePosition(), false); + events.Reset(); + } + } + } - void KilledUnit(Unit* /*victim*/) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SUFF_SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SUFF_SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void EnterCombat(Unit* /*who*/) - { - Talk(SUFF_SAY_FREED); - me->CastSpell(me, SPELL_AURA_OF_SUFFERING, true); - me->CastSpell(me, SPELL_ESSENCE_OF_SUFFERING_PASSIVE, true); - me->CastSpell(me, SPELL_ESSENCE_OF_SUFFERING_PASSIVE2, true); + void EnterCombat(Unit* /*who*/) + { + Talk(SUFF_SAY_FREED); + me->CastSpell(me, SPELL_AURA_OF_SUFFERING, true); + me->CastSpell(me, SPELL_ESSENCE_OF_SUFFERING_PASSIVE, true); + me->CastSpell(me, SPELL_ESSENCE_OF_SUFFERING_PASSIVE2, true); - events.ScheduleEvent(EVENT_SUFF_FRENZY, 45000); - events.ScheduleEvent(EVENT_SUFF_SOUL_DRAIN, 25000); - } + events.ScheduleEvent(EVENT_SUFF_FRENZY, 45000); + events.ScheduleEvent(EVENT_SUFF_SOUL_DRAIN, 25000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SUFF_SOUL_DRAIN: - me->CastCustomSpell(SPELL_SOUL_DRAIN, SPELLVALUE_MAX_TARGETS, 3, me, false); - events.ScheduleEvent(EVENT_SUFF_SOUL_DRAIN, 30000); - break; - case EVENT_SUFF_FRENZY: - Talk(SUFF_SAY_ENRAGE); - Talk(SUFF_EMOTE_ENRAGE); - me->CastSpell(me, SPELL_FRENZY, false); - events.ScheduleEvent(EVENT_SUFF_FRENZY, 45000); - events.ScheduleEvent(EVENT_SUFF_FRENZY_EMOTE, 3000); - break; - case EVENT_SUFF_FRENZY_EMOTE: - Talk(SUFF_EMOTE_ENRAGE); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SUFF_SOUL_DRAIN: + me->CastCustomSpell(SPELL_SOUL_DRAIN, SPELLVALUE_MAX_TARGETS, 3, me, false); + events.ScheduleEvent(EVENT_SUFF_SOUL_DRAIN, 30000); + break; + case EVENT_SUFF_FRENZY: + Talk(SUFF_SAY_ENRAGE); + Talk(SUFF_EMOTE_ENRAGE); + me->CastSpell(me, SPELL_FRENZY, false); + events.ScheduleEvent(EVENT_SUFF_FRENZY, 45000); + events.ScheduleEvent(EVENT_SUFF_FRENZY_EMOTE, 3000); + break; + case EVENT_SUFF_FRENZY_EMOTE: + Talk(SUFF_EMOTE_ENRAGE); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_essence_of_desire : public CreatureScript { - public: - boss_essence_of_desire() : CreatureScript("boss_essence_of_desire") { } + public: + boss_essence_of_desire() : CreatureScript("boss_essence_of_desire") { } - CreatureAI* GetAI(Creature* creature) const - { - return new boss_essence_of_desireAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_essence_of_desireAI(creature); + } - struct boss_essence_of_desireAI : public ScriptedAI - { - boss_essence_of_desireAI(Creature* creature) : ScriptedAI(creature) { } + struct boss_essence_of_desireAI : public ScriptedAI + { + boss_essence_of_desireAI(Creature* creature) : ScriptedAI(creature) { } - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void DoAction(int32 param) - { - if (param == ACTION_ENGAGE_ESSENCE) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetInCombatWithZone(); - } - } + void DoAction(int32 param) + { + if (param == ACTION_ENGAGE_ESSENCE) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE || id != POINT_GO_BACK) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE || id != POINT_GO_BACK) + return; - me->m_Events.AddEvent(new SuckBackEvent(*me, ACTION_ESSENCE_OF_DESIRE), me->m_Events.CalculateTime(1500)); - me->SetTarget(0); - me->SetFacingTo(M_PI/2.0f); - } + me->m_Events.AddEvent(new SuckBackEvent(*me, ACTION_ESSENCE_OF_DESIRE), me->m_Events.CalculateTime(1500)); + me->SetTarget(0); + me->SetFacingTo(M_PI/2.0f); + } - void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (damage >= me->GetHealth()) - { - damage = 0; - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - Talk(DESI_SAY_RECAP); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(POINT_GO_BACK, me->GetHomePosition(), false); - events.Reset(); - } - } - } + void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (damage >= me->GetHealth()) + { + damage = 0; + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + Talk(DESI_SAY_RECAP); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(POINT_GO_BACK, me->GetHomePosition(), false); + events.Reset(); + } + } + } - void KilledUnit(Unit* /*victim*/) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(DESI_SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(DESI_SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void EnterCombat(Unit* /*who*/) - { - Talk(DESI_SAY_FREED); - me->CastSpell(me, SPELL_AURA_OF_DESIRE, true); - - events.ScheduleEvent(EVENT_DESI_DEADEN, 28000); - events.ScheduleEvent(EVENT_DESI_SPIRIT_SHOCK, 20000); - events.ScheduleEvent(EVENT_DESI_RUNE_SHIELD, 13000); - } + void EnterCombat(Unit* /*who*/) + { + Talk(DESI_SAY_FREED); + me->CastSpell(me, SPELL_AURA_OF_DESIRE, true); + + events.ScheduleEvent(EVENT_DESI_DEADEN, 28000); + events.ScheduleEvent(EVENT_DESI_SPIRIT_SHOCK, 20000); + events.ScheduleEvent(EVENT_DESI_RUNE_SHIELD, 13000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_DESI_DEADEN: - if (roll_chance_i(50)) - Talk(DESI_SAY_SPEC); - me->CastSpell(me->GetVictim(), SPELL_DEADEN, false); - events.ScheduleEvent(EVENT_DESI_DEADEN, 31000); - break; - case EVENT_DESI_SPIRIT_SHOCK: - me->CastSpell(me->GetVictim(), SPELL_SPIRIT_SHOCK, false); - events.ScheduleEvent(EVENT_DESI_SPIRIT_SHOCK, 12000); - break; - case EVENT_DESI_RUNE_SHIELD: - me->CastSpell(me, SPELL_RUNE_SHIELD, false); - events.ScheduleEvent(EVENT_DESI_RUNE_SHIELD, 15000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_DESI_DEADEN: + if (roll_chance_i(50)) + Talk(DESI_SAY_SPEC); + me->CastSpell(me->GetVictim(), SPELL_DEADEN, false); + events.ScheduleEvent(EVENT_DESI_DEADEN, 31000); + break; + case EVENT_DESI_SPIRIT_SHOCK: + me->CastSpell(me->GetVictim(), SPELL_SPIRIT_SHOCK, false); + events.ScheduleEvent(EVENT_DESI_SPIRIT_SHOCK, 12000); + break; + case EVENT_DESI_RUNE_SHIELD: + me->CastSpell(me, SPELL_RUNE_SHIELD, false); + events.ScheduleEvent(EVENT_DESI_RUNE_SHIELD, 15000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_essence_of_anger : public CreatureScript { - public: - boss_essence_of_anger() : CreatureScript("boss_essence_of_anger") { } + public: + boss_essence_of_anger() : CreatureScript("boss_essence_of_anger") { } - CreatureAI* GetAI(Creature* creature) const - { - return new boss_essence_of_angerAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_essence_of_angerAI(creature); + } - struct boss_essence_of_angerAI : public ScriptedAI - { - boss_essence_of_angerAI(Creature* creature) : ScriptedAI(creature) { } + struct boss_essence_of_angerAI : public ScriptedAI + { + boss_essence_of_angerAI(Creature* creature) : ScriptedAI(creature) { } - EventMap events; - uint64 targetGUID; + EventMap events; + uint64 targetGUID; - void Reset() - { - targetGUID = 0; - events.Reset(); - } + void Reset() + { + targetGUID = 0; + events.Reset(); + } - void DoAction(int32 param) - { - if (param == ACTION_ENGAGE_ESSENCE) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetInCombatWithZone(); - } - } + void DoAction(int32 param) + { + if (param == ACTION_ENGAGE_ESSENCE) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + } + } - void KilledUnit(Unit* /*victim*/) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(ANGER_SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(ANGER_SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustDied(Unit* killer) - { - Talk(ANGER_SAY_DEATH); - if (me->IsSummon()) - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - Unit::Kill(summoner, summoner); - } + void JustDied(Unit* killer) + { + Talk(ANGER_SAY_DEATH); + if (me->IsSummon()) + if (Unit* summoner = me->ToTempSummon()->GetSummoner()) + Unit::Kill(summoner, summoner); + } - void EnterCombat(Unit* /*who*/) - { - Talk(ANGER_SAY_FREED); - me->CastSpell(me, SPELL_AURA_OF_ANGER, true); - - events.ScheduleEvent(EVENT_ANGER_SPITE, 15000); - events.ScheduleEvent(EVENT_ANGER_SOUL_SCREAM, 10000); - events.ScheduleEvent(EVENT_ANGER_SEETHE, 1000); - } + void EnterCombat(Unit* /*who*/) + { + Talk(ANGER_SAY_FREED); + me->CastSpell(me, SPELL_AURA_OF_ANGER, true); + + events.ScheduleEvent(EVENT_ANGER_SPITE, 15000); + events.ScheduleEvent(EVENT_ANGER_SOUL_SCREAM, 10000); + events.ScheduleEvent(EVENT_ANGER_SEETHE, 1000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ANGER_SPITE: - if (roll_chance_i(30)) - Talk(ANGER_SAY_SPEC); - me->CastCustomSpell(SPELL_SPITE, SPELLVALUE_MAX_TARGETS, 3, me, false); - events.ScheduleEvent(EVENT_ANGER_SPITE, 25000); - break; - case EVENT_ANGER_SOUL_SCREAM: - me->CastSpell(me->GetVictim(), SPELL_SOUL_SCREAM, false); - events.ScheduleEvent(EVENT_ANGER_SOUL_SCREAM, 10000); - break; - case EVENT_ANGER_SEETHE: - if (targetGUID && targetGUID != me->GetVictim()->GetGUID()) - me->CastSpell(me, SPELL_SEETHE, false); - // victim can be lost - if (me->GetVictim()) - targetGUID = me->GetVictim()->GetGUID(); - events.ScheduleEvent(EVENT_ANGER_SEETHE, 1000); - break; + switch (events.ExecuteEvent()) + { + case EVENT_ANGER_SPITE: + if (roll_chance_i(30)) + Talk(ANGER_SAY_SPEC); + me->CastCustomSpell(SPELL_SPITE, SPELLVALUE_MAX_TARGETS, 3, me, false); + events.ScheduleEvent(EVENT_ANGER_SPITE, 25000); + break; + case EVENT_ANGER_SOUL_SCREAM: + me->CastSpell(me->GetVictim(), SPELL_SOUL_SCREAM, false); + events.ScheduleEvent(EVENT_ANGER_SOUL_SCREAM, 10000); + break; + case EVENT_ANGER_SEETHE: + if (targetGUID && targetGUID != me->GetVictim()->GetGUID()) + me->CastSpell(me, SPELL_SEETHE, false); + // victim can be lost + if (me->GetVictim()) + targetGUID = me->GetVictim()->GetGUID(); + events.ScheduleEvent(EVENT_ANGER_SEETHE, 1000); + break; - } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_reliquary_of_souls_aura_of_suffering : public SpellScriptLoader { - public: - spell_reliquary_of_souls_aura_of_suffering() : SpellScriptLoader("spell_reliquary_of_souls_aura_of_suffering") { } + public: + spell_reliquary_of_souls_aura_of_suffering() : SpellScriptLoader("spell_reliquary_of_souls_aura_of_suffering") { } - class spell_reliquary_of_souls_aura_of_suffering_AuraScript : public AuraScript - { - PrepareAuraScript(spell_reliquary_of_souls_aura_of_suffering_AuraScript) + class spell_reliquary_of_souls_aura_of_suffering_AuraScript : public AuraScript + { + PrepareAuraScript(spell_reliquary_of_souls_aura_of_suffering_AuraScript) - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->CastSpell(GetTarget(), SPELL_AURA_OF_SUFFERING_TRIGGER, true); - } + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->CastSpell(GetTarget(), SPELL_AURA_OF_SUFFERING_TRIGGER, true); + } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAurasDueToSpell(SPELL_AURA_OF_SUFFERING_TRIGGER); - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(SPELL_AURA_OF_SUFFERING_TRIGGER); + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_reliquary_of_souls_aura_of_suffering_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_aura_of_suffering_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_reliquary_of_souls_aura_of_suffering_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_aura_of_suffering_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_reliquary_of_souls_aura_of_suffering_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_reliquary_of_souls_aura_of_suffering_AuraScript(); + } }; class spell_reliquary_of_souls_fixate : public SpellScriptLoader @@ -609,13 +609,13 @@ class spell_reliquary_of_souls_fixate : public SpellScriptLoader void FilterTargets(std::list& targets) { - if (targets.empty()) - return; + if (targets.empty()) + return; - targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); - WorldObject* target = targets.front(); - targets.clear(); - targets.push_back(target); + targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); + WorldObject* target = targets.front(); + targets.clear(); + targets.push_back(target); } void Register() @@ -629,26 +629,26 @@ class spell_reliquary_of_souls_fixate : public SpellScriptLoader return new spell_reliquary_of_souls_fixate_SpellScript(); } - class spell_reliquary_of_souls_fixate_AuraScript : public AuraScript - { - PrepareAuraScript(spell_reliquary_of_souls_fixate_AuraScript) + class spell_reliquary_of_souls_fixate_AuraScript : public AuraScript + { + PrepareAuraScript(spell_reliquary_of_souls_fixate_AuraScript) - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - caster->RemoveAurasDueToSpell(GetSpellInfo()->Effects[EFFECT_1].TriggerSpell, GetTarget()->GetGUID()); - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + caster->RemoveAurasDueToSpell(GetSpellInfo()->Effects[EFFECT_1].TriggerSpell, GetTarget()->GetGUID()); + } - void Register() - { - OnEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_fixate_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_fixate_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_reliquary_of_souls_fixate_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_reliquary_of_souls_fixate_AuraScript(); + } }; class spell_reliquary_of_souls_aura_of_desire : public SpellScriptLoader @@ -662,34 +662,34 @@ class spell_reliquary_of_souls_aura_of_desire : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetActor() && eventInfo.GetActionTarget(); + return eventInfo.GetActor() && eventInfo.GetActionTarget(); } void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActionTarget()->CastCustomSpell(SPELL_AURA_OF_DESIRE_DAMAGE, SPELLVALUE_BASE_POINT0, eventInfo.GetDamageInfo()->GetDamage()/2, eventInfo.GetActor(), true); + eventInfo.GetActionTarget()->CastCustomSpell(SPELL_AURA_OF_DESIRE_DAMAGE, SPELLVALUE_BASE_POINT0, eventInfo.GetDamageInfo()->GetDamage()/2, eventInfo.GetActor(), true); } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) - { - if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_2)) - amount = std::max(-100, -5*int32(effect->GetTickNumber())); - } + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_2)) + amount = std::max(-100, -5*int32(effect->GetTickNumber())); + } - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1)) - effect->RecalculateAmount(); - } + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1)) + effect->RecalculateAmount(); + } void Register() { DoCheckProc += AuraCheckProcFn(spell_reliquary_of_souls_aura_of_desire_AuraScript::CheckProc); OnEffectProc += AuraEffectProcFn(spell_reliquary_of_souls_aura_of_desire_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_desire_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_reliquary_of_souls_aura_of_desire_AuraScript::Update, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_desire_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_reliquary_of_souls_aura_of_desire_AuraScript::Update, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -708,25 +708,25 @@ class spell_reliquary_of_souls_aura_of_anger : public SpellScriptLoader { PrepareAuraScript(spell_reliquary_of_souls_aura_of_anger_AuraScript); - void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) - { - if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0)) - amount = amount*effect->GetTickNumber(); - } + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0)) + amount = amount*effect->GetTickNumber(); + } - void Update(AuraEffect const* effect) - { - if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0)) - effect->RecalculateAmount(); - if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1)) - effect->RecalculateAmount(); - } + void Update(AuraEffect const* effect) + { + if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0)) + effect->RecalculateAmount(); + if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1)) + effect->RecalculateAmount(); + } void Register() { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_anger_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_anger_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_reliquary_of_souls_aura_of_anger_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_anger_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_reliquary_of_souls_aura_of_anger_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_reliquary_of_souls_aura_of_anger_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); } }; @@ -741,26 +741,26 @@ class spell_reliquary_of_souls_spite : public SpellScriptLoader public: spell_reliquary_of_souls_spite() : SpellScriptLoader("spell_reliquary_of_souls_spite") { } - class spell_reliquary_of_souls_spite_AuraScript : public AuraScript - { - PrepareAuraScript(spell_reliquary_of_souls_spite_AuraScript) + class spell_reliquary_of_souls_spite_AuraScript : public AuraScript + { + PrepareAuraScript(spell_reliquary_of_souls_spite_AuraScript) - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - caster->CastSpell(GetTarget(), SPELL_SPITE_DAMAGE, true); - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), SPELL_SPITE_DAMAGE, true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_spite_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DAMAGE_IMMUNITY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_reliquary_of_souls_spite_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DAMAGE_IMMUNITY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_reliquary_of_souls_spite_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_reliquary_of_souls_spite_AuraScript(); + } }; void AddSC_boss_reliquary_of_souls() @@ -769,9 +769,9 @@ void AddSC_boss_reliquary_of_souls() new boss_essence_of_suffering(); new boss_essence_of_desire(); new boss_essence_of_anger(); - new spell_reliquary_of_souls_aura_of_suffering(); - new spell_reliquary_of_souls_fixate(); - new spell_reliquary_of_souls_aura_of_desire(); - new spell_reliquary_of_souls_aura_of_anger(); - new spell_reliquary_of_souls_spite(); + new spell_reliquary_of_souls_aura_of_suffering(); + new spell_reliquary_of_souls_fixate(); + new spell_reliquary_of_souls_aura_of_desire(); + new spell_reliquary_of_souls_aura_of_anger(); + new spell_reliquary_of_souls_spite(); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 8cc2a768d..397c3ed6c 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -8,22 +8,22 @@ REWRITTEN BY XINEF enum Says { - SAY_BROKEN_FREE_0 = 0, - SAY_BROKEN_FREE_1 = 1, - SAY_BROKEN_FREE_2 = 2, - SAY_BROKEN_S1 = 0, - SAY_BROKEN_S2 = 1 + SAY_BROKEN_FREE_0 = 0, + SAY_BROKEN_FREE_1 = 1, + SAY_BROKEN_FREE_2 = 2, + SAY_BROKEN_S1 = 0, + SAY_BROKEN_S2 = 1 }; enum Spells { - SPELL_STEALTH = 34189, - SPELL_AKAMA_SOUL_CHANNEL = 40447, - SPELL_SHADE_SOUL_CHANNEL = 40401, - SPELL_CHAIN_LIGHTNING = 39945, - SPELL_DESTRUCTIVE_POISON = 40874, - SPELL_SHADE_OF_AKAMA_TRIGGER = 40955, - SPELL_AKAMA_SOUL_RETRIEVE = 40902, + SPELL_STEALTH = 34189, + SPELL_AKAMA_SOUL_CHANNEL = 40447, + SPELL_SHADE_SOUL_CHANNEL = 40401, + SPELL_CHAIN_LIGHTNING = 39945, + SPELL_DESTRUCTIVE_POISON = 40874, + SPELL_SHADE_OF_AKAMA_TRIGGER = 40955, + SPELL_AKAMA_SOUL_RETRIEVE = 40902, SPELL_ASHTONGUE_WAVE_B = 42035, SPELL_SUMMON_ASHTONGUE_SORCERER = 40476, @@ -32,396 +32,396 @@ enum Spells enum Creatures { - NPC_ASHTONGUE_CHANNELER = 23421, - NPC_CREATURE_GENERATOR_AKAMA = 23210, - NPC_ASHTONGUE_SORCERER = 23215, - NPC_ASHTONGUE_BROKEN = 23319 + NPC_ASHTONGUE_CHANNELER = 23421, + NPC_CREATURE_GENERATOR_AKAMA = 23210, + NPC_ASHTONGUE_SORCERER = 23215, + NPC_ASHTONGUE_BROKEN = 23319 }; enum Misc { - SUMMON_GROUP_BROKENS = 1, + SUMMON_GROUP_BROKENS = 1, - POINT_START = 0, - POINT_CHANNEL_SOUL = 1, + POINT_START = 0, + POINT_CHANNEL_SOUL = 1, - ACTION_AKAMA_DIED = 1, - ACTION_START_ENCOUNTER = 2, - ACTION_STOP_SPAWNING = 3, - ACTION_DESPAWN_ALL = 4, - ACTION_CHANNELERS_START_CHANNEL = 5, - ACTION_KILL_CHANNELERS = 6, - ACTION_NO_SORCERERS = 7, - ACTION_SHADE_DIED = 8, + ACTION_AKAMA_DIED = 1, + ACTION_START_ENCOUNTER = 2, + ACTION_STOP_SPAWNING = 3, + ACTION_DESPAWN_ALL = 4, + ACTION_CHANNELERS_START_CHANNEL = 5, + ACTION_KILL_CHANNELERS = 6, + ACTION_NO_SORCERERS = 7, + ACTION_SHADE_DIED = 8, - EVENT_AKAMA_START_ENCOUNTER = 1, - EVENT_AKAMA_START_CHANNEL = 2, - EVENT_SPELL_CHAIN_LIGHTNING = 4, - EVENT_SPELL_DESTRUCTIVE_POISON = 5, + EVENT_AKAMA_START_ENCOUNTER = 1, + EVENT_AKAMA_START_CHANNEL = 2, + EVENT_SPELL_CHAIN_LIGHTNING = 4, + EVENT_SPELL_DESTRUCTIVE_POISON = 5, - EVENT_SHADE_CHECK_DISTANCE = 10, - EVENT_SHADE_RESET_ENCOUNTER = 11, - EVENT_SHADE_GATHER_NPCS = 12, + EVENT_SHADE_CHECK_DISTANCE = 10, + EVENT_SHADE_RESET_ENCOUNTER = 11, + EVENT_SHADE_GATHER_NPCS = 12, - EVENT_SUMMON_WAVE_B = 20, - EVENT_SUMMON_ASHTONGUE_SORCERER = 21, - EVENT_SUMMON_ASHTONGUE_DEFENDER = 22, + EVENT_SUMMON_WAVE_B = 20, + EVENT_SUMMON_ASHTONGUE_SORCERER = 21, + EVENT_SUMMON_ASHTONGUE_DEFENDER = 22, - EVENT_AKAMA_SCENE0 = 29, - EVENT_AKAMA_SCENE1 = 30, - EVENT_AKAMA_SCENE2 = 31, - EVENT_AKAMA_SCENE3 = 32, - EVENT_AKAMA_SCENE4 = 33, - EVENT_AKAMA_SCENE5 = 34, - EVENT_AKAMA_SCENE6 = 35, - EVENT_AKAMA_SCENE7 = 36 + EVENT_AKAMA_SCENE0 = 29, + EVENT_AKAMA_SCENE1 = 30, + EVENT_AKAMA_SCENE2 = 31, + EVENT_AKAMA_SCENE3 = 32, + EVENT_AKAMA_SCENE4 = 33, + EVENT_AKAMA_SCENE5 = 34, + EVENT_AKAMA_SCENE6 = 35, + EVENT_AKAMA_SCENE7 = 36 }; class boss_shade_of_akama : public CreatureScript { - public: - boss_shade_of_akama() : CreatureScript("boss_shade_of_akama") { } + public: + boss_shade_of_akama() : CreatureScript("boss_shade_of_akama") { } - struct boss_shade_of_akamaAI : public BossAI - { - boss_shade_of_akamaAI(Creature* creature) : BossAI(creature, DATA_SHADE_OF_AKAMA), summonsChanneler(me), summonsGenerator(me) - { - events2.ScheduleEvent(EVENT_SHADE_GATHER_NPCS, 1000); - } + struct boss_shade_of_akamaAI : public BossAI + { + boss_shade_of_akamaAI(Creature* creature) : BossAI(creature, DATA_SHADE_OF_AKAMA), summonsChanneler(me), summonsGenerator(me) + { + events2.ScheduleEvent(EVENT_SHADE_GATHER_NPCS, 1000); + } - SummonList summonsChanneler; - SummonList summonsGenerator; - EventMap events2; + SummonList summonsChanneler; + SummonList summonsGenerator; + EventMap events2; - void ChannelersAction(int32 action) - { - for (SummonList::const_iterator i = summonsChanneler.begin(); i != summonsChanneler.end(); ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) - { - if (action == ACTION_CHANNELERS_START_CHANNEL) - { - summon->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL, true); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - else if (action == ACTION_START_ENCOUNTER) - { - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - else if (action == ACTION_KILL_CHANNELERS) - { - Unit::Kill(me, summon); - } - } - } + void ChannelersAction(int32 action) + { + for (SummonList::const_iterator i = summonsChanneler.begin(); i != summonsChanneler.end(); ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) + { + if (action == ACTION_CHANNELERS_START_CHANNEL) + { + summon->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL, true); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + else if (action == ACTION_START_ENCOUNTER) + { + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + else if (action == ACTION_KILL_CHANNELERS) + { + Unit::Kill(me, summon); + } + } + } - void Reset() - { - BossAI::Reset(); - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE); - me->SetWalk(true); - } + void Reset() + { + BossAI::Reset(); + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE); + me->SetWalk(true); + } - void EnterEvadeMode() - { - BossAI::EnterEvadeMode(); - summonsGenerator.DoAction(ACTION_DESPAWN_ALL); - events2.ScheduleEvent(EVENT_SHADE_RESET_ENCOUNTER, 20000); - me->SetVisible(false); - ChannelersAction(ACTION_KILL_CHANNELERS); - } + void EnterEvadeMode() + { + BossAI::EnterEvadeMode(); + summonsGenerator.DoAction(ACTION_DESPAWN_ALL); + events2.ScheduleEvent(EVENT_SHADE_RESET_ENCOUNTER, 20000); + me->SetVisible(false); + ChannelersAction(ACTION_KILL_CHANNELERS); + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - summonsGenerator.DoAction(ACTION_DESPAWN_ALL); - summonsChanneler.DespawnAll(); - me->CastSpell(me, SPELL_SHADE_OF_AKAMA_TRIGGER, true); - if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE))) - { - akama->SetHomePosition(*akama); - akama->AI()->DoAction(ACTION_SHADE_DIED); - } - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + summonsGenerator.DoAction(ACTION_DESPAWN_ALL); + summonsChanneler.DespawnAll(); + me->CastSpell(me, SPELL_SHADE_OF_AKAMA_TRIGGER, true); + if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE))) + { + akama->SetHomePosition(*akama); + akama->AI()->DoAction(ACTION_SHADE_DIED); + } + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - } + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + } - void DoAction(int32 param) - { - if (param == ACTION_START_ENCOUNTER) - { - summonsGenerator.DoAction(ACTION_START_ENCOUNTER); - ChannelersAction(ACTION_START_ENCOUNTER); - events.ScheduleEvent(EVENT_SHADE_CHECK_DISTANCE, 1000); - } - else if (param == ACTION_AKAMA_DIED) - { - EnterEvadeMode(); - } - } + void DoAction(int32 param) + { + if (param == ACTION_START_ENCOUNTER) + { + summonsGenerator.DoAction(ACTION_START_ENCOUNTER); + ChannelersAction(ACTION_START_ENCOUNTER); + events.ScheduleEvent(EVENT_SHADE_CHECK_DISTANCE, 1000); + } + else if (param == ACTION_AKAMA_DIED) + { + EnterEvadeMode(); + } + } - void UpdateAI(uint32 diff) - { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_SHADE_GATHER_NPCS: - { - std::list ChannelerList; - me->GetCreaturesWithEntryInRange(ChannelerList, 100.0f, NPC_ASHTONGUE_CHANNELER); - for (std::list::const_iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr) - summonsChanneler.Summon(*itr); + void UpdateAI(uint32 diff) + { + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_SHADE_GATHER_NPCS: + { + std::list ChannelerList; + me->GetCreaturesWithEntryInRange(ChannelerList, 100.0f, NPC_ASHTONGUE_CHANNELER); + for (std::list::const_iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr) + summonsChanneler.Summon(*itr); - std::list SpawnerList; - me->GetCreaturesWithEntryInRange(SpawnerList, 100.0f, NPC_CREATURE_GENERATOR_AKAMA); - for (std::list::const_iterator itr = SpawnerList.begin(); itr != SpawnerList.end(); ++itr) - summonsGenerator.Summon(*itr); + std::list SpawnerList; + me->GetCreaturesWithEntryInRange(SpawnerList, 100.0f, NPC_CREATURE_GENERATOR_AKAMA); + for (std::list::const_iterator itr = SpawnerList.begin(); itr != SpawnerList.end(); ++itr) + summonsGenerator.Summon(*itr); - summonsChanneler.Respawn(); - summonsGenerator.Respawn(); - ChannelersAction(ACTION_CHANNELERS_START_CHANNEL); - - if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE))) - akama->Respawn(true); - break; - } - case EVENT_SHADE_RESET_ENCOUNTER: - me->SetVisible(true); - summonsGenerator.Respawn(); - summonsChanneler.Respawn(); - ChannelersAction(ACTION_CHANNELERS_START_CHANNEL); + summonsChanneler.Respawn(); + summonsGenerator.Respawn(); + ChannelersAction(ACTION_CHANNELERS_START_CHANNEL); + + if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE))) + akama->Respawn(true); + break; + } + case EVENT_SHADE_RESET_ENCOUNTER: + me->SetVisible(true); + summonsGenerator.Respawn(); + summonsChanneler.Respawn(); + ChannelersAction(ACTION_CHANNELERS_START_CHANNEL); - if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE))) - akama->Respawn(true); - break; - } + if (Creature* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE))) + akama->Respawn(true); + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SHADE_CHECK_DISTANCE: - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) - { - int32 slow = me->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED); - if (slow > -100) - { - me->SetWalk(true); - me->GetMotionMaster()->MovePoint(POINT_START, 510.0f, 400.7993f, 112.7837f); - } - } - else - { - int32 slow = me->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED); - if (slow < -100) - me->GetMotionMaster()->Clear(); - else if (slow == 0) - { - summonsGenerator.DoAction(ACTION_NO_SORCERERS); - me->SetWalk(false); - } - } + switch (events.ExecuteEvent()) + { + case EVENT_SHADE_CHECK_DISTANCE: + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) + { + int32 slow = me->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED); + if (slow > -100) + { + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(POINT_START, 510.0f, 400.7993f, 112.7837f); + } + } + else + { + int32 slow = me->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED); + if (slow < -100) + me->GetMotionMaster()->Clear(); + else if (slow == 0) + { + summonsGenerator.DoAction(ACTION_NO_SORCERERS); + me->SetWalk(false); + } + } - if (me->IsWithinMeleeRange(me->GetVictim())) - { - me->SetReactState(REACT_AGGRESSIVE); - DoResetThreat(); - me->GetVictim()->InterruptNonMeleeSpells(false); - me->AddThreat(me->GetVictim(), 1000000.0f); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE); - summonsGenerator.DoAction(ACTION_STOP_SPAWNING); - break; - } - events.ScheduleEvent(EVENT_SHADE_CHECK_DISTANCE, 1000); - break; - } + if (me->IsWithinMeleeRange(me->GetVictim())) + { + me->SetReactState(REACT_AGGRESSIVE); + DoResetThreat(); + me->GetVictim()->InterruptNonMeleeSpells(false); + me->AddThreat(me->GetVictim(), 1000000.0f); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE); + summonsGenerator.DoAction(ACTION_STOP_SPAWNING); + break; + } + events.ScheduleEvent(EVENT_SHADE_CHECK_DISTANCE, 1000); + break; + } - DoMeleeAttackIfReady(); - EnterEvadeIfOutOfCombatArea(); - } - - bool CheckEvadeIfOutOfCombatArea() const - { - return !SelectTargetFromPlayerList(120.0f); - } - }; + DoMeleeAttackIfReady(); + EnterEvadeIfOutOfCombatArea(); + } + + bool CheckEvadeIfOutOfCombatArea() const + { + return !SelectTargetFromPlayerList(120.0f); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; class npc_akama_shade : public CreatureScript { - public: - npc_akama_shade() : CreatureScript("npc_akama_shade") { } + public: + npc_akama_shade() : CreatureScript("npc_akama_shade") { } - struct npc_akamaAI : public ScriptedAI - { - npc_akamaAI(Creature* creature) : ScriptedAI(creature), summons(me) - { - instance = creature->GetInstanceScript(); - } + struct npc_akamaAI : public ScriptedAI + { + npc_akamaAI(Creature* creature) : ScriptedAI(creature), summons(me) + { + instance = creature->GetInstanceScript(); + } - InstanceScript* instance; - EventMap events; - EventMap events2; - SummonList summons; + InstanceScript* instance; + EventMap events; + EventMap events2; + SummonList summons; - void Reset() - { - if (instance->GetBossState(DATA_SHADE_OF_AKAMA) == DONE) - { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - return; - } + void Reset() + { + if (instance->GetBossState(DATA_SHADE_OF_AKAMA) == DONE) + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + return; + } - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->CastSpell(me, SPELL_STEALTH, true); - events.Reset(); - events2.Reset(); - } + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->CastSpell(me, SPELL_STEALTH, true); + events.Reset(); + events2.Reset(); + } - void MovementInform(uint32 type, uint32 point) - { - if (type != POINT_MOTION_TYPE || point != POINT_CHANNEL_SOUL) - return; + void MovementInform(uint32 type, uint32 point) + { + if (type != POINT_MOTION_TYPE || point != POINT_CHANNEL_SOUL) + return; - me->SetFacingTo(0.0f); - events2.ScheduleEvent(EVENT_AKAMA_SCENE1, 1000); - events2.ScheduleEvent(EVENT_AKAMA_SCENE2, 16500); - events2.ScheduleEvent(EVENT_AKAMA_SCENE3, 17500); - events2.ScheduleEvent(EVENT_AKAMA_SCENE4, 27000); - events2.ScheduleEvent(EVENT_AKAMA_SCENE5, 37000); - events2.ScheduleEvent(EVENT_AKAMA_SCENE6, 51000); - events2.ScheduleEvent(EVENT_AKAMA_SCENE7, 56000); - } + me->SetFacingTo(0.0f); + events2.ScheduleEvent(EVENT_AKAMA_SCENE1, 1000); + events2.ScheduleEvent(EVENT_AKAMA_SCENE2, 16500); + events2.ScheduleEvent(EVENT_AKAMA_SCENE3, 17500); + events2.ScheduleEvent(EVENT_AKAMA_SCENE4, 27000); + events2.ScheduleEvent(EVENT_AKAMA_SCENE5, 37000); + events2.ScheduleEvent(EVENT_AKAMA_SCENE6, 51000); + events2.ScheduleEvent(EVENT_AKAMA_SCENE7, 56000); + } - void DoAction(int32 param) - { - if (param == ACTION_SHADE_DIED) - events2.ScheduleEvent(EVENT_AKAMA_SCENE0, 1000); - } + void DoAction(int32 param) + { + if (param == ACTION_SHADE_DIED) + events2.ScheduleEvent(EVENT_AKAMA_SCENE0, 1000); + } - void JustDied(Unit* /*killer*/) - { - if (Creature* shade = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SHADE_OF_AKAMA))) - shade->AI()->DoAction(ACTION_AKAMA_DIED); - } + void JustDied(Unit* /*killer*/) + { + if (Creature* shade = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SHADE_OF_AKAMA))) + shade->AI()->DoAction(ACTION_AKAMA_DIED); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, 2000); - events.ScheduleEvent(EVENT_SPELL_DESTRUCTIVE_POISON, 5000); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, 2000); + events.ScheduleEvent(EVENT_SPELL_DESTRUCTIVE_POISON, 5000); + } - void JustSummoned(Creature* summon) - { - float dist = frand(30.0f, 32.0f); - summon->SetWalk(true); - summon->GetMotionMaster()->MovePoint(POINT_START, summon->GetPositionX()+dist*cos(summon->GetOrientation()), summon->GetPositionY()+dist*sin(summon->GetOrientation()), summon->GetPositionZ(), false); - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + float dist = frand(30.0f, 32.0f); + summon->SetWalk(true); + summon->GetMotionMaster()->MovePoint(POINT_START, summon->GetPositionX()+dist*cos(summon->GetOrientation()), summon->GetPositionY()+dist*sin(summon->GetOrientation()), summon->GetPositionZ(), false); + summons.Summon(summon); + } - void UpdateAI(uint32 diff) - { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_AKAMA_START_ENCOUNTER: - me->RemoveAura(SPELL_STEALTH); - me->SetWalk(true); - me->GetMotionMaster()->MovePoint(POINT_START, 517.4877f, 400.7993f, 112.7837f, false); - events2.ScheduleEvent(EVENT_AKAMA_START_CHANNEL, 11000); - break; - case EVENT_AKAMA_START_CHANNEL: - me->CastSpell(me, SPELL_AKAMA_SOUL_CHANNEL, false); - if (Creature* shade = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SHADE_OF_AKAMA))) - { - shade->AI()->AttackStart(me); - shade->GetMotionMaster()->Clear(); - shade->AI()->DoAction(ACTION_START_ENCOUNTER); - } - break; - case EVENT_AKAMA_SCENE0: - me->SetWalk(true); - me->GetMotionMaster()->MovePoint(POINT_CHANNEL_SOUL, 467.0f, 400.7993f, 118.537f); - break; - case EVENT_AKAMA_SCENE1: - me->CastSpell(me, SPELL_AKAMA_SOUL_RETRIEVE, true); - break; - case EVENT_AKAMA_SCENE2: - Talk(SAY_BROKEN_FREE_0); - break; - case EVENT_AKAMA_SCENE3: - me->SummonCreatureGroup(SUMMON_GROUP_BROKENS); - break; - case EVENT_AKAMA_SCENE4: - Talk(SAY_BROKEN_FREE_1); - break; - case EVENT_AKAMA_SCENE5: - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* broken = ObjectAccessor::GetCreature(*me, *itr)) - broken->SetStandState(UNIT_STAND_STATE_KNEEL); - Talk(SAY_BROKEN_FREE_2); - break; - case EVENT_AKAMA_SCENE6: - if (Creature* broken = summons.GetCreatureWithEntry(NPC_ASHTONGUE_BROKEN)) - broken->AI()->Talk(SAY_BROKEN_S1); - break; - case EVENT_AKAMA_SCENE7: - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* broken = ObjectAccessor::GetCreature(*me, *itr)) - broken->AI()->Talk(SAY_BROKEN_S2); - break; - } + void UpdateAI(uint32 diff) + { + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_AKAMA_START_ENCOUNTER: + me->RemoveAura(SPELL_STEALTH); + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(POINT_START, 517.4877f, 400.7993f, 112.7837f, false); + events2.ScheduleEvent(EVENT_AKAMA_START_CHANNEL, 11000); + break; + case EVENT_AKAMA_START_CHANNEL: + me->CastSpell(me, SPELL_AKAMA_SOUL_CHANNEL, false); + if (Creature* shade = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SHADE_OF_AKAMA))) + { + shade->AI()->AttackStart(me); + shade->GetMotionMaster()->Clear(); + shade->AI()->DoAction(ACTION_START_ENCOUNTER); + } + break; + case EVENT_AKAMA_SCENE0: + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(POINT_CHANNEL_SOUL, 467.0f, 400.7993f, 118.537f); + break; + case EVENT_AKAMA_SCENE1: + me->CastSpell(me, SPELL_AKAMA_SOUL_RETRIEVE, true); + break; + case EVENT_AKAMA_SCENE2: + Talk(SAY_BROKEN_FREE_0); + break; + case EVENT_AKAMA_SCENE3: + me->SummonCreatureGroup(SUMMON_GROUP_BROKENS); + break; + case EVENT_AKAMA_SCENE4: + Talk(SAY_BROKEN_FREE_1); + break; + case EVENT_AKAMA_SCENE5: + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* broken = ObjectAccessor::GetCreature(*me, *itr)) + broken->SetStandState(UNIT_STAND_STATE_KNEEL); + Talk(SAY_BROKEN_FREE_2); + break; + case EVENT_AKAMA_SCENE6: + if (Creature* broken = summons.GetCreatureWithEntry(NPC_ASHTONGUE_BROKEN)) + broken->AI()->Talk(SAY_BROKEN_S1); + break; + case EVENT_AKAMA_SCENE7: + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* broken = ObjectAccessor::GetCreature(*me, *itr)) + broken->AI()->Talk(SAY_BROKEN_S2); + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_CHAIN_LIGHTNING: - me->CastSpell(me->GetVictim(), SPELL_CHAIN_LIGHTNING, false); - events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, urand(10000, 15000)); - break; - case EVENT_SPELL_DESTRUCTIVE_POISON: - me->CastSpell(me, SPELL_DESTRUCTIVE_POISON, false); - events.ScheduleEvent(EVENT_SPELL_DESTRUCTIVE_POISON, urand(4000, 5000)); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_CHAIN_LIGHTNING: + me->CastSpell(me->GetVictim(), SPELL_CHAIN_LIGHTNING, false); + events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, urand(10000, 15000)); + break; + case EVENT_SPELL_DESTRUCTIVE_POISON: + me->CastSpell(me, SPELL_DESTRUCTIVE_POISON, false); + events.ScheduleEvent(EVENT_SPELL_DESTRUCTIVE_POISON, urand(4000, 5000)); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void sGossipSelect(Player* player, uint32 /*sender*/, uint32 action) - { - if (action == 0) - { - player->CLOSE_GOSSIP_MENU(); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - events2.ScheduleEvent(EVENT_AKAMA_START_ENCOUNTER, 0); - } - } - }; + void sGossipSelect(Player* player, uint32 /*sender*/, uint32 action) + { + if (action == 0) + { + player->CLOSE_GOSSIP_MENU(); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + events2.ScheduleEvent(EVENT_AKAMA_START_ENCOUNTER, 0); + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; // ######################################################## @@ -430,152 +430,152 @@ class npc_akama_shade : public CreatureScript class npc_creature_generator_akama : public CreatureScript { - public: - npc_creature_generator_akama() : CreatureScript("npc_creature_generator_akama") { } + public: + npc_creature_generator_akama() : CreatureScript("npc_creature_generator_akama") { } - struct npc_creature_generator_akamaAI : public NullCreatureAI - { - npc_creature_generator_akamaAI(Creature* creature) : NullCreatureAI(creature), summons(me) - { - instance = creature->GetInstanceScript(); - } + struct npc_creature_generator_akamaAI : public NullCreatureAI + { + npc_creature_generator_akamaAI(Creature* creature) : NullCreatureAI(creature), summons(me) + { + instance = creature->GetInstanceScript(); + } - void Reset() - { - events.Reset(); - summons.DespawnAll(); - } + void Reset() + { + events.Reset(); + summons.DespawnAll(); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() == NPC_ASHTONGUE_SORCERER) - { - std::list channelerList; - me->GetCreaturesWithEntryInRange(channelerList, 120.0f, NPC_ASHTONGUE_CHANNELER); - for (std::list::const_iterator itr = channelerList.begin(); itr != channelerList.end(); ++itr) - { - if ((*itr)->IsAlive() || (*itr)->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - continue; + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() == NPC_ASHTONGUE_SORCERER) + { + std::list channelerList; + me->GetCreaturesWithEntryInRange(channelerList, 120.0f, NPC_ASHTONGUE_CHANNELER); + for (std::list::const_iterator itr = channelerList.begin(); itr != channelerList.end(); ++itr) + { + if ((*itr)->IsAlive() || (*itr)->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + continue; - summon->SetInCombatWithZone(); - summon->SetReactState(REACT_PASSIVE); - summon->GetMotionMaster()->MovePoint(POINT_START, **itr); - (*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - return; - } - } + summon->SetInCombatWithZone(); + summon->SetReactState(REACT_PASSIVE); + summon->GetMotionMaster()->MovePoint(POINT_START, **itr); + (*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + return; + } + } - summon->SetInCombatWithZone(); - if (Unit* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE))) - { - summon->AddThreat(akama, 500.0f); - summon->AI()->AttackStart(akama); - } - } + summon->SetInCombatWithZone(); + if (Unit* akama = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_AKAMA_SHADE))) + { + summon->AddThreat(akama, 500.0f); + summon->AI()->AttackStart(akama); + } + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summon->DespawnOrUnsummon(10000); - summons.Despawn(summon); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summon->DespawnOrUnsummon(10000); + summons.Despawn(summon); + } - void DoAction(int32 param) - { - if (param == ACTION_STOP_SPAWNING || param == ACTION_DESPAWN_ALL) - { - events.Reset(); - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - { - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - { - if (summon->GetEntry() != NPC_ASHTONGUE_SORCERER) - continue; - summon->InterruptNonMeleeSpells(false); - summon->GetMotionMaster()->Clear(); - summon->SetInCombatWithZone(); - } - } - } - if (param == ACTION_DESPAWN_ALL) - summons.DespawnAll(); - else if (param == ACTION_NO_SORCERERS) - events.CancelEvent(EVENT_SUMMON_ASHTONGUE_SORCERER); - else if (param == ACTION_START_ENCOUNTER) - { - events.ScheduleEvent(EVENT_SUMMON_WAVE_B, 5000); - events.ScheduleEvent(EVENT_SUMMON_ASHTONGUE_DEFENDER, 20000); - events.ScheduleEvent(EVENT_SUMMON_ASHTONGUE_SORCERER, 35000); - } - } + void DoAction(int32 param) + { + if (param == ACTION_STOP_SPAWNING || param == ACTION_DESPAWN_ALL) + { + events.Reset(); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + { + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + { + if (summon->GetEntry() != NPC_ASHTONGUE_SORCERER) + continue; + summon->InterruptNonMeleeSpells(false); + summon->GetMotionMaster()->Clear(); + summon->SetInCombatWithZone(); + } + } + } + if (param == ACTION_DESPAWN_ALL) + summons.DespawnAll(); + else if (param == ACTION_NO_SORCERERS) + events.CancelEvent(EVENT_SUMMON_ASHTONGUE_SORCERER); + else if (param == ACTION_START_ENCOUNTER) + { + events.ScheduleEvent(EVENT_SUMMON_WAVE_B, 5000); + events.ScheduleEvent(EVENT_SUMMON_ASHTONGUE_DEFENDER, 20000); + events.ScheduleEvent(EVENT_SUMMON_ASHTONGUE_SORCERER, 35000); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); + void UpdateAI(uint32 diff) + { + events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_SUMMON_WAVE_B: - me->CastSpell(me, SPELL_ASHTONGUE_WAVE_B, true); - events.ScheduleEvent(EVENT_SUMMON_WAVE_B, 45000); - break; - case EVENT_SUMMON_ASHTONGUE_SORCERER: // left - me->CastSpell(me, SPELL_SUMMON_ASHTONGUE_SORCERER, true); - events.ScheduleEvent(EVENT_SUMMON_ASHTONGUE_SORCERER, 45000); - break; - case EVENT_SUMMON_ASHTONGUE_DEFENDER: // right - me->CastSpell(me, SPELL_SUMMON_ASHTONGUE_DEFENDER, true); - events.ScheduleEvent(EVENT_SUMMON_ASHTONGUE_DEFENDER, 45000); - break; - default: - break; - } - } + switch (events.ExecuteEvent()) + { + case EVENT_SUMMON_WAVE_B: + me->CastSpell(me, SPELL_ASHTONGUE_WAVE_B, true); + events.ScheduleEvent(EVENT_SUMMON_WAVE_B, 45000); + break; + case EVENT_SUMMON_ASHTONGUE_SORCERER: // left + me->CastSpell(me, SPELL_SUMMON_ASHTONGUE_SORCERER, true); + events.ScheduleEvent(EVENT_SUMMON_ASHTONGUE_SORCERER, 45000); + break; + case EVENT_SUMMON_ASHTONGUE_DEFENDER: // right + me->CastSpell(me, SPELL_SUMMON_ASHTONGUE_DEFENDER, true); + events.ScheduleEvent(EVENT_SUMMON_ASHTONGUE_DEFENDER, 45000); + break; + default: + break; + } + } - private: - EventMap events; - SummonList summons; - InstanceScript* instance; - }; + private: + EventMap events; + SummonList summons; + InstanceScript* instance; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; class spell_shade_of_akama_shade_soul_channel : public SpellScriptLoader { - public: - spell_shade_of_akama_shade_soul_channel() : SpellScriptLoader("spell_shade_of_akama_shade_soul_channel") { } + public: + spell_shade_of_akama_shade_soul_channel() : SpellScriptLoader("spell_shade_of_akama_shade_soul_channel") { } - class spell_shade_of_akama_shade_soul_channel_AuraScript : public AuraScript - { - PrepareAuraScript(spell_shade_of_akama_shade_soul_channel_AuraScript) - - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - caster->SetFacingToObject(GetTarget()); - } + class spell_shade_of_akama_shade_soul_channel_AuraScript : public AuraScript + { + PrepareAuraScript(spell_shade_of_akama_shade_soul_channel_AuraScript) + + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + caster->SetFacingToObject(GetTarget()); + } - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (Aura* aura = GetTarget()->GetAura(GetSpellInfo()->Effects[EFFECT_1].TriggerSpell)) - aura->ModStackAmount(-1); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Aura* aura = GetTarget()->GetAura(GetSpellInfo()->Effects[EFFECT_1].TriggerSpell)) + aura->ModStackAmount(-1); + } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_shade_of_akama_shade_soul_channel_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_shade_of_akama_shade_soul_channel_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_shade_of_akama_shade_soul_channel_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_shade_of_akama_shade_soul_channel_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_shade_of_akama_shade_soul_channel_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_shade_of_akama_shade_soul_channel_AuraScript(); + } }; class spell_shade_of_akama_akama_soul_expel : public SpellScriptLoader @@ -611,6 +611,6 @@ void AddSC_boss_shade_of_akama() new boss_shade_of_akama(); new npc_akama_shade(); new npc_creature_generator_akama(); - new spell_shade_of_akama_shade_soul_channel(); - new spell_shade_of_akama_akama_soul_expel(); + new spell_shade_of_akama_shade_soul_channel(); + new spell_shade_of_akama_akama_soul_expel(); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp index e0da356bd..b3070d944 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -8,187 +8,187 @@ REWRITTEN BY XINEF enum Supremus { - EMOTE_NEW_TARGET = 0, - EMOTE_PUNCH_GROUND = 1, - EMOTE_GROUND_CRACK = 2, + EMOTE_NEW_TARGET = 0, + EMOTE_PUNCH_GROUND = 1, + EMOTE_GROUND_CRACK = 2, - SPELL_SNARE_SELF = 41922, - SPELL_MOLTEN_PUNCH = 40126, - SPELL_HATEFUL_STRIKE = 41926, - SPELL_VOLCANIC_ERUPTION = 40276, - SPELL_VOLCANIC_ERUPTION_TRIGGER = 40117, - SPELL_BERSERK = 45078, - SPELL_CHARGE = 41581, + SPELL_SNARE_SELF = 41922, + SPELL_MOLTEN_PUNCH = 40126, + SPELL_HATEFUL_STRIKE = 41926, + SPELL_VOLCANIC_ERUPTION = 40276, + SPELL_VOLCANIC_ERUPTION_TRIGGER = 40117, + SPELL_BERSERK = 45078, + SPELL_CHARGE = 41581, - NPC_SUPREMUS_PUNCH_STALKER = 23095, + NPC_SUPREMUS_PUNCH_STALKER = 23095, - EVENT_SPELL_BERSERK = 1, - EVENT_SPELL_HATEFUL_STRIKE = 2, - EVENT_SPELL_MOLTEN_FLAMES = 3, - EVENT_SWITCH_PHASE = 4, - EVENT_SPELL_VOLCANIC_ERUPTION = 5, - EVENT_SWITCH_TARGET = 6, - EVENT_CHECK_DIST = 7, + EVENT_SPELL_BERSERK = 1, + EVENT_SPELL_HATEFUL_STRIKE = 2, + EVENT_SPELL_MOLTEN_FLAMES = 3, + EVENT_SWITCH_PHASE = 4, + EVENT_SPELL_VOLCANIC_ERUPTION = 5, + EVENT_SWITCH_TARGET = 6, + EVENT_CHECK_DIST = 7, - EVENT_GROUP_ABILITIES = 1 + EVENT_GROUP_ABILITIES = 1 }; class boss_supremus : public CreatureScript { - public: - boss_supremus() : CreatureScript("boss_supremus") { } + public: + boss_supremus() : CreatureScript("boss_supremus") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_supremusAI : public BossAI - { - boss_supremusAI(Creature* creature) : BossAI(creature, DATA_SUPREMUS) - { - } + struct boss_supremusAI : public BossAI + { + boss_supremusAI(Creature* creature) : BossAI(creature, DATA_SUPREMUS) + { + } - void Reset() - { - BossAI::Reset(); - } + void Reset() + { + BossAI::Reset(); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); - SchedulePhase(false); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 900000); - events.ScheduleEvent(EVENT_SPELL_MOLTEN_FLAMES, 4000); - } + SchedulePhase(false); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 900000); + events.ScheduleEvent(EVENT_SPELL_MOLTEN_FLAMES, 4000); + } - void SchedulePhase(bool run) - { - events.CancelEventGroup(EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SWITCH_PHASE, 60000); - DoResetThreat(); + void SchedulePhase(bool run) + { + events.CancelEventGroup(EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SWITCH_PHASE, 60000); + DoResetThreat(); - if (!run) - { - events.ScheduleEvent(EVENT_SPELL_HATEFUL_STRIKE, 5000, EVENT_GROUP_ABILITIES); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false); - me->RemoveAurasDueToSpell(SPELL_SNARE_SELF); - } - else - { - events.ScheduleEvent(EVENT_SPELL_VOLCANIC_ERUPTION, 5000, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SWITCH_TARGET, 0, EVENT_GROUP_ABILITIES); - events.ScheduleEvent(EVENT_CHECK_DIST, 0, EVENT_GROUP_ABILITIES); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); - me->CastSpell(me, SPELL_SNARE_SELF, true); - } - } + if (!run) + { + events.ScheduleEvent(EVENT_SPELL_HATEFUL_STRIKE, 5000, EVENT_GROUP_ABILITIES); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false); + me->RemoveAurasDueToSpell(SPELL_SNARE_SELF); + } + else + { + events.ScheduleEvent(EVENT_SPELL_VOLCANIC_ERUPTION, 5000, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SWITCH_TARGET, 0, EVENT_GROUP_ABILITIES); + events.ScheduleEvent(EVENT_CHECK_DIST, 0, EVENT_GROUP_ABILITIES); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); + me->CastSpell(me, SPELL_SNARE_SELF, true); + } + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() == NPC_SUPREMUS_PUNCH_STALKER) - { - summon->ToTempSummon()->InitStats(20000); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - summon->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); - } - else - summon->CastSpell(summon, SPELL_VOLCANIC_ERUPTION_TRIGGER, true); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() == NPC_SUPREMUS_PUNCH_STALKER) + { + summon->ToTempSummon()->InitStats(20000); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + summon->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); + } + else + summon->CastSpell(summon, SPELL_VOLCANIC_ERUPTION_TRIGGER, true); + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + } - Unit* FindHatefulStrikeTarget() - { - Unit* target = NULL; - ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); - for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) - { - Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); - if (unit && me->IsWithinMeleeRange(unit)) - if (!target || unit->GetHealth() > target->GetHealth()) - target = unit; - } + Unit* FindHatefulStrikeTarget() + { + Unit* target = NULL; + ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); + for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) + { + Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); + if (unit && me->IsWithinMeleeRange(unit)) + if (!target || unit->GetHealth() > target->GetHealth()) + target = unit; + } - return target; - } + return target; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_SPELL_HATEFUL_STRIKE: - if (Unit* target = FindHatefulStrikeTarget()) - me->CastSpell(target, SPELL_HATEFUL_STRIKE, false); - events.ScheduleEvent(EVENT_SPELL_HATEFUL_STRIKE, urand(1500, 3000), EVENT_GROUP_ABILITIES); - break; - case EVENT_SPELL_MOLTEN_FLAMES: - me->CastSpell(me, SPELL_MOLTEN_PUNCH, false); - events.ScheduleEvent(EVENT_SPELL_MOLTEN_FLAMES, 20000, EVENT_GROUP_ABILITIES); - break; - case EVENT_SWITCH_PHASE: - SchedulePhase(!me->HasAura(SPELL_SNARE_SELF)); - break; - case EVENT_SWITCH_TARGET: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - DoResetThreat(); - me->AddThreat(target, 5000000.0f); - Talk(EMOTE_NEW_TARGET); - } - events.ScheduleEvent(EVENT_SWITCH_TARGET, 10000, EVENT_GROUP_ABILITIES); - break; - case EVENT_CHECK_DIST: - if (me->GetDistance(me->GetVictim()) > 40.0f) - { - Talk(EMOTE_PUNCH_GROUND); - me->CastSpell(me->GetVictim(), SPELL_CHARGE, true); - events.ScheduleEvent(EVENT_CHECK_DIST, 5000, EVENT_GROUP_ABILITIES); - break; - } - events.ScheduleEvent(EVENT_CHECK_DIST, 1, EVENT_GROUP_ABILITIES); - break; - case EVENT_SPELL_VOLCANIC_ERUPTION: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - me->CastSpell(target, SPELL_VOLCANIC_ERUPTION, true); - Talk(EMOTE_GROUND_CRACK); - } - events.ScheduleEvent(EVENT_SPELL_VOLCANIC_ERUPTION, urand(10000, 18000), EVENT_GROUP_ABILITIES); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_SPELL_HATEFUL_STRIKE: + if (Unit* target = FindHatefulStrikeTarget()) + me->CastSpell(target, SPELL_HATEFUL_STRIKE, false); + events.ScheduleEvent(EVENT_SPELL_HATEFUL_STRIKE, urand(1500, 3000), EVENT_GROUP_ABILITIES); + break; + case EVENT_SPELL_MOLTEN_FLAMES: + me->CastSpell(me, SPELL_MOLTEN_PUNCH, false); + events.ScheduleEvent(EVENT_SPELL_MOLTEN_FLAMES, 20000, EVENT_GROUP_ABILITIES); + break; + case EVENT_SWITCH_PHASE: + SchedulePhase(!me->HasAura(SPELL_SNARE_SELF)); + break; + case EVENT_SWITCH_TARGET: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoResetThreat(); + me->AddThreat(target, 5000000.0f); + Talk(EMOTE_NEW_TARGET); + } + events.ScheduleEvent(EVENT_SWITCH_TARGET, 10000, EVENT_GROUP_ABILITIES); + break; + case EVENT_CHECK_DIST: + if (me->GetDistance(me->GetVictim()) > 40.0f) + { + Talk(EMOTE_PUNCH_GROUND); + me->CastSpell(me->GetVictim(), SPELL_CHARGE, true); + events.ScheduleEvent(EVENT_CHECK_DIST, 5000, EVENT_GROUP_ABILITIES); + break; + } + events.ScheduleEvent(EVENT_CHECK_DIST, 1, EVENT_GROUP_ABILITIES); + break; + case EVENT_SPELL_VOLCANIC_ERUPTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + me->CastSpell(target, SPELL_VOLCANIC_ERUPTION, true); + Talk(EMOTE_GROUND_CRACK); + } + events.ScheduleEvent(EVENT_SPELL_VOLCANIC_ERUPTION, urand(10000, 18000), EVENT_GROUP_ABILITIES); + break; + } - DoMeleeAttackIfReady(); - EnterEvadeIfOutOfCombatArea(); - } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetPositionX() < 565 || me->GetPositionX() > 865 || me->GetPositionY() < 545 || me->GetPositionY() > 1000; - } - }; + DoMeleeAttackIfReady(); + EnterEvadeIfOutOfCombatArea(); + } + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetPositionX() < 565 || me->GetPositionX() > 865 || me->GetPositionY() < 545 || me->GetPositionY() > 1000; + } + }; }; void AddSC_boss_supremus() diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index cbadaa954..452259735 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -8,45 +8,45 @@ REWRITTEN BY XINEF enum Says { - SAY_INTRO = 0, - SAY_AGGRO = 1, - SAY_SLAY = 2, - SAY_BLOSSOM = 3, - SAY_INCINERATE = 4, - SAY_CRUSHING = 5, - SAY_DEATH = 6 + SAY_INTRO = 0, + SAY_AGGRO = 1, + SAY_SLAY = 2, + SAY_BLOSSOM = 3, + SAY_INCINERATE = 4, + SAY_CRUSHING = 5, + SAY_DEATH = 6 }; enum Spells { - SPELL_INCINERATE = 40239, - SPELL_SUMMON_DOOM_BLOSSOM = 40188, - SPELL_CRUSHING_SHADOWS = 40243, - SPELL_SHADOW_OF_DEATH = 40251, - SPELL_SHADOW_OF_DEATH_REMOVE = 41999, - SPELL_SUMMON_SPIRIT = 40266, - SPELL_SUMMON_SKELETON1 = 40270, - SPELL_SUMMON_SKELETON2 = 41948, - SPELL_SUMMON_SKELETON3 = 41949, - SPELL_SUMMON_SKELETON4 = 41950, - SPELL_POSSESS_SPIRIT_IMMUNE = 40282, - SPELL_SPIRITUAL_VENGEANCE = 40268, - SPELL_BRIEF_STUN = 41421, + SPELL_INCINERATE = 40239, + SPELL_SUMMON_DOOM_BLOSSOM = 40188, + SPELL_CRUSHING_SHADOWS = 40243, + SPELL_SHADOW_OF_DEATH = 40251, + SPELL_SHADOW_OF_DEATH_REMOVE = 41999, + SPELL_SUMMON_SPIRIT = 40266, + SPELL_SUMMON_SKELETON1 = 40270, + SPELL_SUMMON_SKELETON2 = 41948, + SPELL_SUMMON_SKELETON3 = 41949, + SPELL_SUMMON_SKELETON4 = 41950, + SPELL_POSSESS_SPIRIT_IMMUNE = 40282, + SPELL_SPIRITUAL_VENGEANCE = 40268, + SPELL_BRIEF_STUN = 41421, - SPELL_SPIRIT_LANCE = 40157, - SPELL_SPIRIT_CHAINS = 40175, - SPELL_SPIRIT_VOLLEY = 40314 + SPELL_SPIRIT_LANCE = 40157, + SPELL_SPIRIT_CHAINS = 40175, + SPELL_SPIRIT_VOLLEY = 40314 }; enum Misc { - SET_DATA_INTRO = 1, + SET_DATA_INTRO = 1, - EVENT_SPELL_INCINERATE = 1, - EVENT_SPELL_DOOM_BLOSSOM = 2, - EVENT_SPELL_CRUSHING_SHADOWS = 3, - EVENT_SPELL_SHADOW_OF_DEATH = 4, - EVENT_TALK_KILL = 10 + EVENT_SPELL_INCINERATE = 1, + EVENT_SPELL_DOOM_BLOSSOM = 2, + EVENT_SPELL_CRUSHING_SHADOWS = 3, + EVENT_SPELL_SHADOW_OF_DEATH = 4, + EVENT_TALK_KILL = 10 }; struct ShadowOfDeathSelector : public std::unary_function @@ -59,275 +59,275 @@ struct ShadowOfDeathSelector : public std::unary_function class boss_teron_gorefiend : public CreatureScript { - public: - boss_teron_gorefiend() : CreatureScript("boss_teron_gorefiend") { } + public: + boss_teron_gorefiend() : CreatureScript("boss_teron_gorefiend") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_teron_gorefiendAI : public BossAI - { - boss_teron_gorefiendAI(Creature* creature) : BossAI(creature, DATA_TERON_GOREFIEND) - { - intro = false; - } + struct boss_teron_gorefiendAI : public BossAI + { + boss_teron_gorefiendAI(Creature* creature) : BossAI(creature, DATA_TERON_GOREFIEND) + { + intro = false; + } - bool intro; + bool intro; - void Reset() - { - BossAI::Reset(); - me->CastSpell(me, SPELL_SHADOW_OF_DEATH_REMOVE, true); - } + void Reset() + { + BossAI::Reset(); + me->CastSpell(me, SPELL_SHADOW_OF_DEATH_REMOVE, true); + } - void SetData(uint32 type, uint32 id) - { - if (type || !me->IsAlive()) - return; + void SetData(uint32 type, uint32 id) + { + if (type || !me->IsAlive()) + return; - if (id == SET_DATA_INTRO && !intro) - { - intro = true; - Talk(SAY_INTRO); - } - } + if (id == SET_DATA_INTRO && !intro) + { + intro = true; + Talk(SAY_INTRO); + } + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_INCINERATE, 24000); - events.ScheduleEvent(EVENT_SPELL_DOOM_BLOSSOM, 10000); - events.ScheduleEvent(EVENT_SPELL_CRUSHING_SHADOWS, 17000); - events.ScheduleEvent(EVENT_SPELL_SHADOW_OF_DEATH, 20000); - } + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + events.ScheduleEvent(EVENT_SPELL_INCINERATE, 24000); + events.ScheduleEvent(EVENT_SPELL_DOOM_BLOSSOM, 10000); + events.ScheduleEvent(EVENT_SPELL_CRUSHING_SHADOWS, 17000); + events.ScheduleEvent(EVENT_SPELL_SHADOW_OF_DEATH, 20000); + } - void KilledUnit(Unit* victim) - { - if (events.GetNextEventTime(EVENT_TALK_KILL) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_TALK_KILL, 6000); - } - } + void KilledUnit(Unit* victim) + { + if (events.GetNextEventTime(EVENT_TALK_KILL) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_TALK_KILL, 6000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - Talk(SAY_DEATH); - me->CastSpell(me, SPELL_SHADOW_OF_DEATH_REMOVE, true); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + Talk(SAY_DEATH); + me->CastSpell(me, SPELL_SHADOW_OF_DEATH_REMOVE, true); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() ) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() ) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_INCINERATE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - if (roll_chance_i(50)) - Talk(SAY_INCINERATE); - me->CastSpell(target, SPELL_INCINERATE, false); - } - events.ScheduleEvent(EVENT_SPELL_INCINERATE, 25000); - break; - case EVENT_SPELL_DOOM_BLOSSOM: - if (roll_chance_i(50)) - Talk(SAY_BLOSSOM); + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_INCINERATE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + if (roll_chance_i(50)) + Talk(SAY_INCINERATE); + me->CastSpell(target, SPELL_INCINERATE, false); + } + events.ScheduleEvent(EVENT_SPELL_INCINERATE, 25000); + break; + case EVENT_SPELL_DOOM_BLOSSOM: + if (roll_chance_i(50)) + Talk(SAY_BLOSSOM); - me->CastSpell(me, SPELL_SUMMON_DOOM_BLOSSOM, false); - events.ScheduleEvent(EVENT_SPELL_DOOM_BLOSSOM, 40000); - break; - case EVENT_SPELL_CRUSHING_SHADOWS: - if (roll_chance_i(20)) - Talk(SAY_CRUSHING); - me->CastCustomSpell(SPELL_CRUSHING_SHADOWS, SPELLVALUE_MAX_TARGETS, 5, me, false); - events.ScheduleEvent(EVENT_SPELL_CRUSHING_SHADOWS, 15000); - break; - case EVENT_SPELL_SHADOW_OF_DEATH: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, ShadowOfDeathSelector())) - me->CastSpell(target, SPELL_SHADOW_OF_DEATH, false); - events.ScheduleEvent(EVENT_SPELL_SHADOW_OF_DEATH, 30000); - break; - } + me->CastSpell(me, SPELL_SUMMON_DOOM_BLOSSOM, false); + events.ScheduleEvent(EVENT_SPELL_DOOM_BLOSSOM, 40000); + break; + case EVENT_SPELL_CRUSHING_SHADOWS: + if (roll_chance_i(20)) + Talk(SAY_CRUSHING); + me->CastCustomSpell(SPELL_CRUSHING_SHADOWS, SPELLVALUE_MAX_TARGETS, 5, me, false); + events.ScheduleEvent(EVENT_SPELL_CRUSHING_SHADOWS, 15000); + break; + case EVENT_SPELL_SHADOW_OF_DEATH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, ShadowOfDeathSelector())) + me->CastSpell(target, SPELL_SHADOW_OF_DEATH, false); + events.ScheduleEvent(EVENT_SPELL_SHADOW_OF_DEATH, 30000); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(); } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetDistance(me->GetHomePosition()) > 100.0f; - } - }; + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetDistance(me->GetHomePosition()) > 100.0f; + } + }; }; class spell_teron_gorefiend_shadow_of_death : public SpellScriptLoader { - public: - spell_teron_gorefiend_shadow_of_death() : SpellScriptLoader("spell_teron_gorefiend_shadow_of_death") { } + public: + spell_teron_gorefiend_shadow_of_death() : SpellScriptLoader("spell_teron_gorefiend_shadow_of_death") { } - class spell_teron_gorefiend_shadow_of_death_AuraScript : public AuraScript - { - PrepareAuraScript(spell_teron_gorefiend_shadow_of_death_AuraScript) + class spell_teron_gorefiend_shadow_of_death_AuraScript : public AuraScript + { + PrepareAuraScript(spell_teron_gorefiend_shadow_of_death_AuraScript) void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { PreventDefaultAction(); } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - InstanceScript* instance = GetTarget()->GetInstanceScript(); - if (!GetCaster() || !instance || !instance->IsEncounterInProgress()) - return; + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + InstanceScript* instance = GetTarget()->GetInstanceScript(); + if (!GetCaster() || !instance || !instance->IsEncounterInProgress()) + return; - GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SPIRIT, true); - GetTarget()->CastSpell(GetTarget(), SPELL_POSSESS_SPIRIT_IMMUNE, true); - GetTarget()->CastSpell(GetTarget(), SPELL_SPIRITUAL_VENGEANCE, true); - GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SKELETON1, true); - GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SKELETON2, true); - GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SKELETON3, true); - GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SKELETON4, true); - } + GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SPIRIT, true); + GetTarget()->CastSpell(GetTarget(), SPELL_POSSESS_SPIRIT_IMMUNE, true); + GetTarget()->CastSpell(GetTarget(), SPELL_SPIRITUAL_VENGEANCE, true); + GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SKELETON1, true); + GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SKELETON2, true); + GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SKELETON3, true); + GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SKELETON4, true); + } - void Register() - { - OnEffectAbsorb += AuraEffectAbsorbFn(spell_teron_gorefiend_shadow_of_death_AuraScript::Absorb, EFFECT_0); - AfterEffectRemove += AuraEffectRemoveFn(spell_teron_gorefiend_shadow_of_death_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectAbsorb += AuraEffectAbsorbFn(spell_teron_gorefiend_shadow_of_death_AuraScript::Absorb, EFFECT_0); + AfterEffectRemove += AuraEffectRemoveFn(spell_teron_gorefiend_shadow_of_death_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_teron_gorefiend_shadow_of_death_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_teron_gorefiend_shadow_of_death_AuraScript(); + } }; class spell_teron_gorefiend_spirit_lance : public SpellScriptLoader { - public: - spell_teron_gorefiend_spirit_lance() : SpellScriptLoader("spell_teron_gorefiend_spirit_lance") { } + public: + spell_teron_gorefiend_spirit_lance() : SpellScriptLoader("spell_teron_gorefiend_spirit_lance") { } - class spell_teron_gorefiend_spirit_lance_AuraScript : public AuraScript - { - PrepareAuraScript(spell_teron_gorefiend_spirit_lance_AuraScript); + class spell_teron_gorefiend_spirit_lance_AuraScript : public AuraScript + { + PrepareAuraScript(spell_teron_gorefiend_spirit_lance_AuraScript); - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) - { - if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_2)) - amount -= (amount / effect->GetTotalTicks()) * effect->GetTickNumber(); - } + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_2)) + amount -= (amount / effect->GetTotalTicks()) * effect->GetTickNumber(); + } - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1)) - effect->RecalculateAmount(); - } + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1)) + effect->RecalculateAmount(); + } - void Register() - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_teron_gorefiend_spirit_lance_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DECREASE_SPEED); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_teron_gorefiend_spirit_lance_AuraScript::Update, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_teron_gorefiend_spirit_lance_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DECREASE_SPEED); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_teron_gorefiend_spirit_lance_AuraScript::Update, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_teron_gorefiend_spirit_lance_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_teron_gorefiend_spirit_lance_AuraScript(); + } }; class spell_teron_gorefiend_spiritual_vengeance : public SpellScriptLoader { - public: - spell_teron_gorefiend_spiritual_vengeance() : SpellScriptLoader("spell_teron_gorefiend_spiritual_vengeance") { } + public: + spell_teron_gorefiend_spiritual_vengeance() : SpellScriptLoader("spell_teron_gorefiend_spiritual_vengeance") { } - class spell_teron_gorefiend_spiritual_vengeance_AuraScript : public AuraScript - { - PrepareAuraScript(spell_teron_gorefiend_spiritual_vengeance_AuraScript) + class spell_teron_gorefiend_spiritual_vengeance_AuraScript : public AuraScript + { + PrepareAuraScript(spell_teron_gorefiend_spiritual_vengeance_AuraScript) - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit::Kill(NULL, GetTarget()); - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit::Kill(NULL, GetTarget()); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_teron_gorefiend_spiritual_vengeance_AuraScript::HandleEffectRemove, EFFECT_2, SPELL_AURA_MOD_PACIFY_SILENCE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_teron_gorefiend_spiritual_vengeance_AuraScript::HandleEffectRemove, EFFECT_2, SPELL_AURA_MOD_PACIFY_SILENCE, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_teron_gorefiend_spiritual_vengeance_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_teron_gorefiend_spiritual_vengeance_AuraScript(); + } }; class spell_teron_gorefiend_shadowy_construct : public SpellScriptLoader { - public: - spell_teron_gorefiend_shadowy_construct() : SpellScriptLoader("spell_teron_gorefiend_shadowy_construct") { } + public: + spell_teron_gorefiend_shadowy_construct() : SpellScriptLoader("spell_teron_gorefiend_shadowy_construct") { } - class spell_teron_gorefiend_shadowy_construct_AuraScript : public AuraScript - { - PrepareAuraScript(spell_teron_gorefiend_shadowy_construct_AuraScript) + class spell_teron_gorefiend_shadowy_construct_AuraScript : public AuraScript + { + PrepareAuraScript(spell_teron_gorefiend_shadowy_construct_AuraScript) - bool Load() - { - return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; + } - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NORMAL, true); - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_ALLOW_ID, SPELL_SPIRIT_LANCE, true); - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_ALLOW_ID, SPELL_SPIRIT_CHAINS, true); - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_ALLOW_ID, SPELL_SPIRIT_VOLLEY, true); + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NORMAL, true); + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_ALLOW_ID, SPELL_SPIRIT_LANCE, true); + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_ALLOW_ID, SPELL_SPIRIT_CHAINS, true); + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_ALLOW_ID, SPELL_SPIRIT_VOLLEY, true); - GetUnitOwner()->ToCreature()->SetInCombatWithZone(); - Map::PlayerList const& playerList = GetUnitOwner()->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator i = playerList.begin(); i != playerList.end(); ++i) - if (Player* player = i->GetSource()) - { - if (GetUnitOwner()->IsValidAttackTarget(player)) - GetUnitOwner()->AddThreat(player, 1000000.0f); - } + GetUnitOwner()->ToCreature()->SetInCombatWithZone(); + Map::PlayerList const& playerList = GetUnitOwner()->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator i = playerList.begin(); i != playerList.end(); ++i) + if (Player* player = i->GetSource()) + { + if (GetUnitOwner()->IsValidAttackTarget(player)) + GetUnitOwner()->AddThreat(player, 1000000.0f); + } - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_BRIEF_STUN, true); - } + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_BRIEF_STUN, true); + } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_teron_gorefiend_shadowy_construct_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_teron_gorefiend_shadowy_construct_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_teron_gorefiend_shadowy_construct_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_teron_gorefiend_shadowy_construct_AuraScript(); + } }; void AddSC_boss_teron_gorefiend() { new boss_teron_gorefiend(); - new spell_teron_gorefiend_shadow_of_death(); - new spell_teron_gorefiend_spirit_lance(); - new spell_teron_gorefiend_spiritual_vengeance(); - new spell_teron_gorefiend_shadowy_construct(); + new spell_teron_gorefiend_shadow_of_death(); + new spell_teron_gorefiend_spirit_lance(); + new spell_teron_gorefiend_spiritual_vengeance(); + new spell_teron_gorefiend_shadowy_construct(); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index fa0e31fea..ede34accd 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -8,33 +8,33 @@ REWRITTEN BY XINEF enum Yells { - SAY_AGGRO = 0, - SAY_NEEDLE = 1, - SAY_SLAY = 2, - SAY_SPECIAL = 3, - SAY_ENRAGE = 4, - SAY_DEATH = 5 + SAY_AGGRO = 0, + SAY_NEEDLE = 1, + SAY_SLAY = 2, + SAY_SPECIAL = 3, + SAY_ENRAGE = 4, + SAY_DEATH = 5 }; enum Spells { - SPELL_NEEDLE_SPINE = 39992, - SPELL_NEEDLE_SPINE_DAMAGE = 39835, - SPELL_TIDAL_BURST = 39878, - SPELL_TIDAL_SHIELD = 39872, - SPELL_IMPALING_SPINE = 39837, - SPELL_SUMMON_IMPALING_SPINE = 39929, - SPELL_BERSERK = 26662 + SPELL_NEEDLE_SPINE = 39992, + SPELL_NEEDLE_SPINE_DAMAGE = 39835, + SPELL_TIDAL_BURST = 39878, + SPELL_TIDAL_SHIELD = 39872, + SPELL_IMPALING_SPINE = 39837, + SPELL_SUMMON_IMPALING_SPINE = 39929, + SPELL_BERSERK = 26662 }; enum Events { - EVENT_SPELL_BERSERK = 1, - EVENT_YELL = 2, - EVENT_SPELL_NEEDLE = 3, - EVENT_SPELL_SPINE = 4, - EVENT_SPELL_SHIELD = 5, - EVENT_KILL_SPEAK = 6 + EVENT_SPELL_BERSERK = 1, + EVENT_YELL = 2, + EVENT_SPELL_NEEDLE = 3, + EVENT_SPELL_SPINE = 4, + EVENT_SPELL_SHIELD = 5, + EVENT_KILL_SPEAK = 6 }; class boss_najentus : public CreatureScript @@ -55,27 +55,27 @@ public: void Reset() { - BossAI::Reset(); + BossAI::Reset(); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && events.GetNextEventTime(EVENT_KILL_SPEAK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_SPEAK, 5000); - } + if (victim->GetTypeId() == TYPEID_PLAYER && events.GetNextEventTime(EVENT_KILL_SPEAK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_SPEAK, 5000); + } } void JustDied(Unit* killer) { - BossAI::JustDied(killer); + BossAI::JustDied(killer); Talk(SAY_DEATH); } void EnterCombat(Unit* who) { - BossAI::EnterCombat(who); + BossAI::EnterCombat(who); Talk(SAY_AGGRO); events.ScheduleEvent(EVENT_SPELL_BERSERK, 480000); events.ScheduleEvent(EVENT_YELL, urand(25000, 100000)); @@ -90,29 +90,29 @@ public: return; events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; switch (events.ExecuteEvent()) { case EVENT_SPELL_SHIELD: - me->CastSpell(me, SPELL_TIDAL_SHIELD, false); + me->CastSpell(me, SPELL_TIDAL_SHIELD, false); events.DelayEvents(10000); - events.ScheduleEvent(EVENT_SPELL_SHIELD, 60000); + events.ScheduleEvent(EVENT_SPELL_SHIELD, 60000); break; case EVENT_SPELL_BERSERK: Talk(SAY_ENRAGE); me->CastSpell(me, SPELL_BERSERK, true); break; case EVENT_SPELL_NEEDLE: - me->CastCustomSpell(SPELL_NEEDLE_SPINE, SPELLVALUE_MAX_TARGETS, 3, me, false); + me->CastCustomSpell(SPELL_NEEDLE_SPINE, SPELLVALUE_MAX_TARGETS, 3, me, false); events.ScheduleEvent(EVENT_SPELL_NEEDLE, 15000); break; case EVENT_SPELL_SPINE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) { - me->CastSpell(target, SPELL_IMPALING_SPINE, false); - target->CastSpell(target, SPELL_SUMMON_IMPALING_SPINE, true); + me->CastSpell(target, SPELL_IMPALING_SPINE, false); + target->CastSpell(target, SPELL_SUMMON_IMPALING_SPINE, true); Talk(SAY_NEEDLE); } events.ScheduleEvent(EVENT_SPELL_SPINE, 20000); @@ -130,65 +130,65 @@ public: class spell_najentus_needle_spine : public SpellScriptLoader { - public: - spell_najentus_needle_spine() : SpellScriptLoader("spell_najentus_needle_spine") { } + public: + spell_najentus_needle_spine() : SpellScriptLoader("spell_najentus_needle_spine") { } - class spell_najentus_needle_spine_SpellScript : public SpellScript - { - PrepareSpellScript(spell_najentus_needle_spine_SpellScript); + class spell_najentus_needle_spine_SpellScript : public SpellScript + { + PrepareSpellScript(spell_najentus_needle_spine_SpellScript); - void HandleDummy(SpellEffIndex effIndex) - { - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, SPELL_NEEDLE_SPINE_DAMAGE, true); - } + void HandleDummy(SpellEffIndex effIndex) + { + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_NEEDLE_SPINE_DAMAGE, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_najentus_needle_spine_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_najentus_needle_spine_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_najentus_needle_spine_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_najentus_needle_spine_SpellScript(); + } }; class spell_najentus_hurl_spine : public SpellScriptLoader { - public: - spell_najentus_hurl_spine() : SpellScriptLoader("spell_najentus_hurl_spine") { } + public: + spell_najentus_hurl_spine() : SpellScriptLoader("spell_najentus_hurl_spine") { } - class spell_najentus_hurl_spine_SpellScript : public SpellScript - { - PrepareSpellScript(spell_najentus_hurl_spine_SpellScript); + class spell_najentus_hurl_spine_SpellScript : public SpellScript + { + PrepareSpellScript(spell_najentus_hurl_spine_SpellScript); - void HandleSchoolDamage(SpellEffIndex effIndex) - { - Unit* target = GetHitUnit(); - if (target && target->HasAura(SPELL_TIDAL_SHIELD)) - { - target->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD); - target->CastSpell(target, SPELL_TIDAL_BURST, true); - } - } + void HandleSchoolDamage(SpellEffIndex effIndex) + { + Unit* target = GetHitUnit(); + if (target && target->HasAura(SPELL_TIDAL_SHIELD)) + { + target->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD); + target->CastSpell(target, SPELL_TIDAL_BURST, true); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_najentus_hurl_spine_SpellScript::HandleSchoolDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_najentus_hurl_spine_SpellScript::HandleSchoolDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_najentus_hurl_spine_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_najentus_hurl_spine_SpellScript(); + } }; void AddSC_boss_najentus() { new boss_najentus(); - new spell_najentus_needle_spine(); - new spell_najentus_hurl_spine(); + new spell_najentus_needle_spine(); + new spell_najentus_hurl_spine(); } diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index e867ceddc..cc7796a3c 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -8,88 +8,88 @@ REWRITTEN BY XINEF enum Says { - SAY_COUNCIL_AGGRO = 0, - SAY_COUNCIL_ENRAGE = 1, - SAY_COUNCIL_SPECIAL = 2, - SAY_COUNCIL_SLAY = 3, - SAY_COUNCIL_DEATH = 4 + SAY_COUNCIL_AGGRO = 0, + SAY_COUNCIL_ENRAGE = 1, + SAY_COUNCIL_SPECIAL = 2, + SAY_COUNCIL_SLAY = 3, + SAY_COUNCIL_DEATH = 4 }; enum Spells { - SPELL_EMPYREAL_BALANCE = 41499, - SPELL_BERSERK = 41924, + SPELL_EMPYREAL_BALANCE = 41499, + SPELL_BERSERK = 41924, - // Gathios the Shatterer - SPELL_BLESSING_OF_PROTECTION = 41450, - SPELL_BLESSING_OF_SPELL_WARDING = 41451, - SPELL_CONSECRATION = 41541, - SPELL_HAMMER_OF_JUSTICE = 41468, - SPELL_SEAL_OF_COMMAND = 41469, - SPELL_SEAL_OF_BLOOD = 41459, - SPELL_CHROMATIC_RESISTANCE_AURA = 41453, - SPELL_DEVOTION_AURA = 41452, - SPELL_JUDGEMENT = 41467, + // Gathios the Shatterer + SPELL_BLESSING_OF_PROTECTION = 41450, + SPELL_BLESSING_OF_SPELL_WARDING = 41451, + SPELL_CONSECRATION = 41541, + SPELL_HAMMER_OF_JUSTICE = 41468, + SPELL_SEAL_OF_COMMAND = 41469, + SPELL_SEAL_OF_BLOOD = 41459, + SPELL_CHROMATIC_RESISTANCE_AURA = 41453, + SPELL_DEVOTION_AURA = 41452, + SPELL_JUDGEMENT = 41467, - // High Nethermancer Zerevor - SPELL_FLAMESTRIKE = 41481, - SPELL_BLIZZARD = 41482, - SPELL_ARCANE_BOLT = 41483, - SPELL_ARCANE_EXPLOSION = 41524, - SPELL_DAMPEN_MAGIC = 41478, + // High Nethermancer Zerevor + SPELL_FLAMESTRIKE = 41481, + SPELL_BLIZZARD = 41482, + SPELL_ARCANE_BOLT = 41483, + SPELL_ARCANE_EXPLOSION = 41524, + SPELL_DAMPEN_MAGIC = 41478, - // Lady Malande - SPELL_EMPOWERED_SMITE = 41471, - SPELL_CIRCLE_OF_HEALING = 41455, - SPELL_REFLECTIVE_SHIELD = 41475, - SPELL_REFLECTIVE_SHIELD_T = 33619, - SPELL_DIVINE_WRATH = 41472, - SPELL_HEAL_VISUAL = 24171, + // Lady Malande + SPELL_EMPOWERED_SMITE = 41471, + SPELL_CIRCLE_OF_HEALING = 41455, + SPELL_REFLECTIVE_SHIELD = 41475, + SPELL_REFLECTIVE_SHIELD_T = 33619, + SPELL_DIVINE_WRATH = 41472, + SPELL_HEAL_VISUAL = 24171, - // Veras Darkshadow - SPELL_DEADLY_STRIKE = 41480, - SPELL_DEADLY_POISON = 41485, - SPELL_ENVENOM = 41487, - SPELL_VANISH = 41476, - SPELL_VANISH_OUT = 41479, - SPELL_VANISH_VISUAL = 24222 + // Veras Darkshadow + SPELL_DEADLY_STRIKE = 41480, + SPELL_DEADLY_POISON = 41485, + SPELL_ENVENOM = 41487, + SPELL_VANISH = 41476, + SPELL_VANISH_OUT = 41479, + SPELL_VANISH_VISUAL = 24222 }; enum Misc { - ACTION_START_ENCOUNTER = 1, - ACTION_END_ENCOUNTER = 2, - ACTION_ENRAGE = 3, + ACTION_START_ENCOUNTER = 1, + ACTION_END_ENCOUNTER = 2, + ACTION_ENRAGE = 3, - EVENT_SPELL_BLESSING = 1, - EVENT_SPELL_AURA = 2, - EVENT_SPELL_SEAL = 3, - EVENT_SPELL_HAMMER_OF_JUSTICE = 4, - EVENT_SPELL_JUDGEMENT = 5, - EVENT_SPELL_CONSECRATION = 6, + EVENT_SPELL_BLESSING = 1, + EVENT_SPELL_AURA = 2, + EVENT_SPELL_SEAL = 3, + EVENT_SPELL_HAMMER_OF_JUSTICE = 4, + EVENT_SPELL_JUDGEMENT = 5, + EVENT_SPELL_CONSECRATION = 6, - EVENT_SPELL_FLAMESTRIKE = 10, - EVENT_SPELL_BLIZZARD = 11, - EVENT_SPELL_ARCANE_BOLT = 12, - EVENT_SPELL_DAMPEN_MAGIC = 13, - EVENT_SPELL_ARCANE_EXPLOSION = 14, + EVENT_SPELL_FLAMESTRIKE = 10, + EVENT_SPELL_BLIZZARD = 11, + EVENT_SPELL_ARCANE_BOLT = 12, + EVENT_SPELL_DAMPEN_MAGIC = 13, + EVENT_SPELL_ARCANE_EXPLOSION = 14, - EVENT_SPELL_REFLECTIVE_SHIELD = 20, - EVENT_SPELL_CIRCLE_OF_HEALING = 21, - EVENT_SPELL_DIVINE_WRATH = 22, - EVENT_SPELL_EMPOWERED_SMITE = 23, + EVENT_SPELL_REFLECTIVE_SHIELD = 20, + EVENT_SPELL_CIRCLE_OF_HEALING = 21, + EVENT_SPELL_DIVINE_WRATH = 22, + EVENT_SPELL_EMPOWERED_SMITE = 23, - EVENT_SPELL_VANISH = 30, - EVENT_SPELL_VANISH_OUT = 31, - EVENT_SPELL_ENRAGE = 32, + EVENT_SPELL_VANISH = 30, + EVENT_SPELL_VANISH_OUT = 31, + EVENT_SPELL_ENRAGE = 32, - EVENT_KILL_TALK = 100 + EVENT_KILL_TALK = 100 }; struct HammerOfJusticeSelector : public std::unary_function { - Unit const* _me; - HammerOfJusticeSelector(Unit* me) : _me(me) { } + Unit const* _me; + HammerOfJusticeSelector(Unit* me) : _me(me) { } bool operator()(Unit const* target) const { @@ -99,24 +99,24 @@ struct HammerOfJusticeSelector : public std::unary_function class VerasEnvenom : public BasicEvent { - public: - VerasEnvenom(Unit& owner, uint64 targetGUID) : _owner(owner), _targetGUID(targetGUID) { } + public: + VerasEnvenom(Unit& owner, uint64 targetGUID) : _owner(owner), _targetGUID(targetGUID) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - if (Player* target = ObjectAccessor::GetPlayer(_owner, _targetGUID)) - { - target->m_clientGUIDs.insert(_owner.GetGUID()); - _owner.CastSpell(target, SPELL_ENVENOM, true); - target->RemoveAurasDueToSpell(SPELL_DEADLY_POISON); - target->m_clientGUIDs.erase(_owner.GetGUID()); - } - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + if (Player* target = ObjectAccessor::GetPlayer(_owner, _targetGUID)) + { + target->m_clientGUIDs.insert(_owner.GetGUID()); + _owner.CastSpell(target, SPELL_ENVENOM, true); + target->RemoveAurasDueToSpell(SPELL_DEADLY_POISON); + target->m_clientGUIDs.erase(_owner.GetGUID()); + } + return true; + } - private: - Unit& _owner; - uint64 _targetGUID; + private: + Unit& _owner; + uint64 _targetGUID; }; class boss_illidari_council : public CreatureScript @@ -133,79 +133,79 @@ public: { boss_illidari_councilAI(Creature* creature) : BossAI(creature, DATA_ILLIDARI_COUNCIL) { - memset(councilGUIDs, 0, sizeof(councilGUIDs)); + memset(councilGUIDs, 0, sizeof(councilGUIDs)); } uint64 councilGUIDs[4]; void Reset() { - BossAI::Reset(); + BossAI::Reset(); Creature* member = NULL; for (uint8 i = 0; i < 4; ++i) if (member = ObjectAccessor::GetCreature(*me, councilGUIDs[i])) - member->AI()->EnterEvadeMode(); + member->AI()->EnterEvadeMode(); } void AttackStart(Unit*) { } void MoveInLineOfSight(Unit*) { } - void DoAction(int32 param) - { - if (!me->isActiveObject() && param == ACTION_START_ENCOUNTER) - { - me->setActive(true); - councilGUIDs[0] = instance->GetData64(NPC_GATHIOS_THE_SHATTERER); + void DoAction(int32 param) + { + if (!me->isActiveObject() && param == ACTION_START_ENCOUNTER) + { + me->setActive(true); + councilGUIDs[0] = instance->GetData64(NPC_GATHIOS_THE_SHATTERER); councilGUIDs[1] = instance->GetData64(NPC_HIGH_NETHERMANCER_ZEREVOR); councilGUIDs[2] = instance->GetData64(NPC_LADY_MALANDE); councilGUIDs[3] = instance->GetData64(NPC_VERAS_DARKSHADOW); - bool spoken = false; - for (uint8 i = 0; i < 4; ++i) + bool spoken = false; + for (uint8 i = 0; i < 4; ++i) { - if (Creature* member = ObjectAccessor::GetCreature(*me, councilGUIDs[i])) - { - if (!spoken && (roll_chance_i(33) || i == 3)) - { - spoken = true; - member->AI()->Talk(SAY_COUNCIL_AGGRO); - } - member->SetOwnerGUID(me->GetGUID()); - member->SetInCombatWithZone(); - } - } - } - else if (param == ACTION_ENRAGE) - { - Creature* member = NULL; - for (uint8 i = 0; i < 4; ++i) - if (member = ObjectAccessor::GetCreature(*me, councilGUIDs[i])) - member->AI()->DoAction(ACTION_ENRAGE); - } - else if (param == ACTION_END_ENCOUNTER) - { - me->setActive(false); - Creature* member = NULL; - for (uint8 i = 0; i < 4; ++i) - if (member = ObjectAccessor::GetCreature(*me, councilGUIDs[i])) - if (member->IsAlive()) - Unit::Kill(me, member); - Unit::Kill(me, me); - } - } + if (Creature* member = ObjectAccessor::GetCreature(*me, councilGUIDs[i])) + { + if (!spoken && (roll_chance_i(33) || i == 3)) + { + spoken = true; + member->AI()->Talk(SAY_COUNCIL_AGGRO); + } + member->SetOwnerGUID(me->GetGUID()); + member->SetInCombatWithZone(); + } + } + } + else if (param == ACTION_ENRAGE) + { + Creature* member = NULL; + for (uint8 i = 0; i < 4; ++i) + if (member = ObjectAccessor::GetCreature(*me, councilGUIDs[i])) + member->AI()->DoAction(ACTION_ENRAGE); + } + else if (param == ACTION_END_ENCOUNTER) + { + me->setActive(false); + Creature* member = NULL; + for (uint8 i = 0; i < 4; ++i) + if (member = ObjectAccessor::GetCreature(*me, councilGUIDs[i])) + if (member->IsAlive()) + Unit::Kill(me, member); + Unit::Kill(me, me); + } + } void UpdateAI(uint32 diff) { - if (!me->isActiveObject()) - return; + if (!me->isActiveObject()) + return; - if (!SelectTargetFromPlayerList(115.0f)) - { - EnterEvadeMode(); - return; - } + if (!SelectTargetFromPlayerList(115.0f)) + { + EnterEvadeMode(); + return; + } - me->CastSpell(me, SPELL_EMPYREAL_BALANCE, true); + me->CastSpell(me, SPELL_EMPYREAL_BALANCE, true); } }; @@ -213,11 +213,11 @@ public: struct boss_illidari_council_memberAI : public ScriptedAI { boss_illidari_council_memberAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } + { + instance = creature->GetInstanceScript(); + } - InstanceScript* instance; + InstanceScript* instance; EventMap events; void Reset() @@ -225,329 +225,329 @@ struct boss_illidari_council_memberAI : public ScriptedAI events.Reset(); } - void EnterEvadeMode() - { - me->SetOwnerGUID(0); - ScriptedAI::EnterEvadeMode(); - } + void EnterEvadeMode() + { + me->SetOwnerGUID(0); + ScriptedAI::EnterEvadeMode(); + } - void DoAction(int32 param) - { - if (param == ACTION_ENRAGE) - { - me->CastSpell(me, SPELL_BERSERK, true); - Talk(SAY_COUNCIL_ENRAGE); - } - } + void DoAction(int32 param) + { + if (param == ACTION_ENRAGE) + { + me->CastSpell(me, SPELL_BERSERK, true); + Talk(SAY_COUNCIL_ENRAGE); + } + } void KilledUnit(Unit*) { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_COUNCIL_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_COUNCIL_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } } void JustDied(Unit*) { Talk(SAY_COUNCIL_DEATH); - if (Creature* council = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDARI_COUNCIL))) + if (Creature* council = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDARI_COUNCIL))) council->GetAI()->DoAction(ACTION_END_ENCOUNTER); } - void EnterCombat(Unit* who) - { - if (Creature* council = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDARI_COUNCIL))) + void EnterCombat(Unit* who) + { + if (Creature* council = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDARI_COUNCIL))) council->GetAI()->DoAction(ACTION_START_ENCOUNTER); - } + } }; class boss_gathios_the_shatterer : public CreatureScript { - public: - boss_gathios_the_shatterer() : CreatureScript("boss_gathios_the_shatterer") { } + public: + boss_gathios_the_shatterer() : CreatureScript("boss_gathios_the_shatterer") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_gathios_the_shattererAI : public boss_illidari_council_memberAI - { - boss_gathios_the_shattererAI(Creature* creature) : boss_illidari_council_memberAI(creature) { } + struct boss_gathios_the_shattererAI : public boss_illidari_council_memberAI + { + boss_gathios_the_shattererAI(Creature* creature) : boss_illidari_council_memberAI(creature) { } - Creature* SelectCouncilMember() - { - if (roll_chance_i(50)) - return ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_LADY_MALANDE)); + Creature* SelectCouncilMember() + { + if (roll_chance_i(50)) + return ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_LADY_MALANDE)); - if (roll_chance_i(20)) - if (Creature* veras = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_VERAS_DARKSHADOW))) - if (!veras->HasAura(SPELL_VANISH)) - return veras; + if (roll_chance_i(20)) + if (Creature* veras = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_VERAS_DARKSHADOW))) + if (!veras->HasAura(SPELL_VANISH)) + return veras; - return ObjectAccessor::GetCreature(*me, instance->GetData64(RAND(NPC_GATHIOS_THE_SHATTERER, NPC_HIGH_NETHERMANCER_ZEREVOR))); - } + return ObjectAccessor::GetCreature(*me, instance->GetData64(RAND(NPC_GATHIOS_THE_SHATTERER, NPC_HIGH_NETHERMANCER_ZEREVOR))); + } - void EnterCombat(Unit* who) - { - boss_illidari_council_memberAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_BLESSING, 10000); - events.ScheduleEvent(EVENT_SPELL_AURA, 0); - events.ScheduleEvent(EVENT_SPELL_SEAL, 2000); - events.ScheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, 6000); - events.ScheduleEvent(EVENT_SPELL_JUDGEMENT, 8000); - events.ScheduleEvent(EVENT_SPELL_CONSECRATION, 4000); - } + void EnterCombat(Unit* who) + { + boss_illidari_council_memberAI::EnterCombat(who); + events.ScheduleEvent(EVENT_SPELL_BLESSING, 10000); + events.ScheduleEvent(EVENT_SPELL_AURA, 0); + events.ScheduleEvent(EVENT_SPELL_SEAL, 2000); + events.ScheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, 6000); + events.ScheduleEvent(EVENT_SPELL_JUDGEMENT, 8000); + events.ScheduleEvent(EVENT_SPELL_CONSECRATION, 4000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_BLESSING: - if (Unit* member = SelectCouncilMember()) - me->CastSpell(member, RAND(SPELL_BLESSING_OF_SPELL_WARDING, SPELL_BLESSING_OF_PROTECTION), false); - events.ScheduleEvent(EVENT_SPELL_BLESSING, 15000); - break; - case EVENT_SPELL_AURA: - me->CastSpell(me, RAND(SPELL_DEVOTION_AURA, SPELL_CHROMATIC_RESISTANCE_AURA), false); - events.ScheduleEvent(EVENT_SPELL_AURA, 60000); - break; - case EVENT_SPELL_CONSECRATION: - if (roll_chance_i(50)) - Talk(SAY_COUNCIL_SPECIAL); - me->CastSpell(me, SPELL_CONSECRATION, false); - events.ScheduleEvent(EVENT_SPELL_AURA, 30000); - break; - case EVENT_SPELL_HAMMER_OF_JUSTICE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, HammerOfJusticeSelector(me))) - { - me->CastSpell(target, SPELL_HAMMER_OF_JUSTICE, false); - events.ScheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, 20000); - break; - } - events.ScheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, 0); - break; - case EVENT_SPELL_SEAL: - me->CastSpell(me, RAND(SPELL_SEAL_OF_COMMAND, SPELL_SEAL_OF_BLOOD), false); - events.ScheduleEvent(EVENT_SPELL_SEAL, 20000); - break; - case EVENT_SPELL_JUDGEMENT: - me->CastSpell(me->GetVictim(), SPELL_JUDGEMENT, false); - events.ScheduleEvent(EVENT_SPELL_JUDGEMENT, 20000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_BLESSING: + if (Unit* member = SelectCouncilMember()) + me->CastSpell(member, RAND(SPELL_BLESSING_OF_SPELL_WARDING, SPELL_BLESSING_OF_PROTECTION), false); + events.ScheduleEvent(EVENT_SPELL_BLESSING, 15000); + break; + case EVENT_SPELL_AURA: + me->CastSpell(me, RAND(SPELL_DEVOTION_AURA, SPELL_CHROMATIC_RESISTANCE_AURA), false); + events.ScheduleEvent(EVENT_SPELL_AURA, 60000); + break; + case EVENT_SPELL_CONSECRATION: + if (roll_chance_i(50)) + Talk(SAY_COUNCIL_SPECIAL); + me->CastSpell(me, SPELL_CONSECRATION, false); + events.ScheduleEvent(EVENT_SPELL_AURA, 30000); + break; + case EVENT_SPELL_HAMMER_OF_JUSTICE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, HammerOfJusticeSelector(me))) + { + me->CastSpell(target, SPELL_HAMMER_OF_JUSTICE, false); + events.ScheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, 20000); + break; + } + events.ScheduleEvent(EVENT_SPELL_HAMMER_OF_JUSTICE, 0); + break; + case EVENT_SPELL_SEAL: + me->CastSpell(me, RAND(SPELL_SEAL_OF_COMMAND, SPELL_SEAL_OF_BLOOD), false); + events.ScheduleEvent(EVENT_SPELL_SEAL, 20000); + break; + case EVENT_SPELL_JUDGEMENT: + me->CastSpell(me->GetVictim(), SPELL_JUDGEMENT, false); + events.ScheduleEvent(EVENT_SPELL_JUDGEMENT, 20000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_high_nethermancer_zerevor : public CreatureScript { - public: - boss_high_nethermancer_zerevor() : CreatureScript("boss_high_nethermancer_zerevor") { } + public: + boss_high_nethermancer_zerevor() : CreatureScript("boss_high_nethermancer_zerevor") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_high_nethermancer_zerevorAI : public boss_illidari_council_memberAI - { - boss_high_nethermancer_zerevorAI(Creature* creature) : boss_illidari_council_memberAI(creature) { } + struct boss_high_nethermancer_zerevorAI : public boss_illidari_council_memberAI + { + boss_high_nethermancer_zerevorAI(Creature* creature) : boss_illidari_council_memberAI(creature) { } - void AttackStart(Unit* who) - { - if (who && me->Attack(who, true)) - me->GetMotionMaster()->MoveChase(who, 20.0f); - } + void AttackStart(Unit* who) + { + if (who && me->Attack(who, true)) + me->GetMotionMaster()->MoveChase(who, 20.0f); + } - void EnterCombat(Unit* who) - { - boss_illidari_council_memberAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 25000); - events.ScheduleEvent(EVENT_SPELL_BLIZZARD, 5000); - events.ScheduleEvent(EVENT_SPELL_ARCANE_BOLT, 15000); - events.ScheduleEvent(EVENT_SPELL_DAMPEN_MAGIC, 0); - events.ScheduleEvent(EVENT_SPELL_ARCANE_EXPLOSION, 10000); - } + void EnterCombat(Unit* who) + { + boss_illidari_council_memberAI::EnterCombat(who); + events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 25000); + events.ScheduleEvent(EVENT_SPELL_BLIZZARD, 5000); + events.ScheduleEvent(EVENT_SPELL_ARCANE_BOLT, 15000); + events.ScheduleEvent(EVENT_SPELL_DAMPEN_MAGIC, 0); + events.ScheduleEvent(EVENT_SPELL_ARCANE_EXPLOSION, 10000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_DAMPEN_MAGIC: - me->CastSpell(me, SPELL_DAMPEN_MAGIC, false); - events.ScheduleEvent(EVENT_SPELL_DAMPEN_MAGIC, 120000); - break; - case EVENT_SPELL_ARCANE_BOLT: - me->CastSpell(me->GetVictim(), SPELL_ARCANE_BOLT, false); - events.ScheduleEvent(EVENT_SPELL_ARCANE_BOLT, 3000); - break; - case EVENT_SPELL_FLAMESTRIKE: - if (roll_chance_i(50)) - Talk(SAY_COUNCIL_SPECIAL); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f)) - me->CastSpell(target, SPELL_FLAMESTRIKE, false); - events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 40000); - break; - case EVENT_SPELL_BLIZZARD: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f)) - me->CastSpell(target, SPELL_BLIZZARD, false); - events.ScheduleEvent(EVENT_SPELL_BLIZZARD, 40000); - break; - case EVENT_SPELL_ARCANE_EXPLOSION: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f)) - me->CastSpell(me, SPELL_ARCANE_EXPLOSION, false); - events.ScheduleEvent(EVENT_SPELL_ARCANE_EXPLOSION, 10000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_DAMPEN_MAGIC: + me->CastSpell(me, SPELL_DAMPEN_MAGIC, false); + events.ScheduleEvent(EVENT_SPELL_DAMPEN_MAGIC, 120000); + break; + case EVENT_SPELL_ARCANE_BOLT: + me->CastSpell(me->GetVictim(), SPELL_ARCANE_BOLT, false); + events.ScheduleEvent(EVENT_SPELL_ARCANE_BOLT, 3000); + break; + case EVENT_SPELL_FLAMESTRIKE: + if (roll_chance_i(50)) + Talk(SAY_COUNCIL_SPECIAL); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f)) + me->CastSpell(target, SPELL_FLAMESTRIKE, false); + events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 40000); + break; + case EVENT_SPELL_BLIZZARD: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f)) + me->CastSpell(target, SPELL_BLIZZARD, false); + events.ScheduleEvent(EVENT_SPELL_BLIZZARD, 40000); + break; + case EVENT_SPELL_ARCANE_EXPLOSION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f)) + me->CastSpell(me, SPELL_ARCANE_EXPLOSION, false); + events.ScheduleEvent(EVENT_SPELL_ARCANE_EXPLOSION, 10000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class boss_lady_malande : public CreatureScript { - public: - boss_lady_malande() : CreatureScript("boss_lady_malande") { } + public: + boss_lady_malande() : CreatureScript("boss_lady_malande") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_lady_malandeAI : public boss_illidari_council_memberAI - { - boss_lady_malandeAI(Creature* creature) : boss_illidari_council_memberAI(creature) { } + struct boss_lady_malandeAI : public boss_illidari_council_memberAI + { + boss_lady_malandeAI(Creature* creature) : boss_illidari_council_memberAI(creature) { } - void AttackStart(Unit* who) - { - if (who && me->Attack(who, true)) - me->GetMotionMaster()->MoveChase(who, 20.0f); - } + void AttackStart(Unit* who) + { + if (who && me->Attack(who, true)) + me->GetMotionMaster()->MoveChase(who, 20.0f); + } - void EnterCombat(Unit* who) - { - boss_illidari_council_memberAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_REFLECTIVE_SHIELD, 10000); - events.ScheduleEvent(EVENT_SPELL_CIRCLE_OF_HEALING, 20000); - events.ScheduleEvent(EVENT_SPELL_DIVINE_WRATH, 5000); - events.ScheduleEvent(EVENT_SPELL_EMPOWERED_SMITE, 15000); - } + void EnterCombat(Unit* who) + { + boss_illidari_council_memberAI::EnterCombat(who); + events.ScheduleEvent(EVENT_SPELL_REFLECTIVE_SHIELD, 10000); + events.ScheduleEvent(EVENT_SPELL_CIRCLE_OF_HEALING, 20000); + events.ScheduleEvent(EVENT_SPELL_DIVINE_WRATH, 5000); + events.ScheduleEvent(EVENT_SPELL_EMPOWERED_SMITE, 15000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_CIRCLE_OF_HEALING: - me->CastSpell(me, SPELL_CIRCLE_OF_HEALING, false); - events.ScheduleEvent(EVENT_SPELL_CIRCLE_OF_HEALING, 20000); - break; - case EVENT_SPELL_REFLECTIVE_SHIELD: - if (roll_chance_i(50)) - Talk(SAY_COUNCIL_SPECIAL); - me->CastSpell(me, SPELL_REFLECTIVE_SHIELD, false); - events.ScheduleEvent(EVENT_SPELL_REFLECTIVE_SHIELD, 40000); - break; - case EVENT_SPELL_DIVINE_WRATH: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f)) - me->CastSpell(target, SPELL_DIVINE_WRATH, false); - events.ScheduleEvent(EVENT_SPELL_DIVINE_WRATH, 20000); - break; - case EVENT_SPELL_EMPOWERED_SMITE: - me->CastSpell(me->GetVictim(), SPELL_EMPOWERED_SMITE, false); - events.ScheduleEvent(EVENT_SPELL_EMPOWERED_SMITE, 3000); - break; - } - } - }; + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_CIRCLE_OF_HEALING: + me->CastSpell(me, SPELL_CIRCLE_OF_HEALING, false); + events.ScheduleEvent(EVENT_SPELL_CIRCLE_OF_HEALING, 20000); + break; + case EVENT_SPELL_REFLECTIVE_SHIELD: + if (roll_chance_i(50)) + Talk(SAY_COUNCIL_SPECIAL); + me->CastSpell(me, SPELL_REFLECTIVE_SHIELD, false); + events.ScheduleEvent(EVENT_SPELL_REFLECTIVE_SHIELD, 40000); + break; + case EVENT_SPELL_DIVINE_WRATH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f)) + me->CastSpell(target, SPELL_DIVINE_WRATH, false); + events.ScheduleEvent(EVENT_SPELL_DIVINE_WRATH, 20000); + break; + case EVENT_SPELL_EMPOWERED_SMITE: + me->CastSpell(me->GetVictim(), SPELL_EMPOWERED_SMITE, false); + events.ScheduleEvent(EVENT_SPELL_EMPOWERED_SMITE, 3000); + break; + } + } + }; }; class boss_veras_darkshadow : public CreatureScript { - public: - boss_veras_darkshadow() : CreatureScript("boss_veras_darkshadow") { } + public: + boss_veras_darkshadow() : CreatureScript("boss_veras_darkshadow") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_veras_darkshadowAI : public boss_illidari_council_memberAI - { - boss_veras_darkshadowAI(Creature* creature) : boss_illidari_council_memberAI(creature) { } + struct boss_veras_darkshadowAI : public boss_illidari_council_memberAI + { + boss_veras_darkshadowAI(Creature* creature) : boss_illidari_council_memberAI(creature) { } - void EnterCombat(Unit* who) - { - me->SetCanDualWield(true); - boss_illidari_council_memberAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_VANISH, 10000); - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 900000); - } + void EnterCombat(Unit* who) + { + me->SetCanDualWield(true); + boss_illidari_council_memberAI::EnterCombat(who); + events.ScheduleEvent(EVENT_SPELL_VANISH, 10000); + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 900000); + } - void JustSummoned(Creature* summon) - { - summon->CastSpell(summon, SPELL_VANISH_VISUAL, true); - } + void JustSummoned(Creature* summon) + { + summon->CastSpell(summon, SPELL_VANISH_VISUAL, true); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_VANISH: - if (roll_chance_i(50)) - Talk(SAY_COUNCIL_SPECIAL); - me->CastSpell(me, SPELL_DEADLY_STRIKE, false); - me->CastSpell(me, SPELL_VANISH, false); - events.ScheduleEvent(EVENT_SPELL_VANISH, 60000); - events.ScheduleEvent(EVENT_SPELL_VANISH_OUT, 29000); - break; - case EVENT_SPELL_VANISH_OUT: - me->CastSpell(me, SPELL_VANISH_OUT, false); - break; - case EVENT_SPELL_ENRAGE: - DoResetThreat(); - if (Creature* council = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDARI_COUNCIL))) - council->GetAI()->DoAction(ACTION_ENRAGE); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_VANISH: + if (roll_chance_i(50)) + Talk(SAY_COUNCIL_SPECIAL); + me->CastSpell(me, SPELL_DEADLY_STRIKE, false); + me->CastSpell(me, SPELL_VANISH, false); + events.ScheduleEvent(EVENT_SPELL_VANISH, 60000); + events.ScheduleEvent(EVENT_SPELL_VANISH_OUT, 29000); + break; + case EVENT_SPELL_VANISH_OUT: + me->CastSpell(me, SPELL_VANISH_OUT, false); + break; + case EVENT_SPELL_ENRAGE: + DoResetThreat(); + if (Creature* council = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_ILLIDARI_COUNCIL))) + council->GetAI()->DoAction(ACTION_ENRAGE); + break; + } - if (events.GetNextEventTime(EVENT_SPELL_VANISH_OUT) == 0) - DoMeleeAttackIfReady(); - } - }; + if (events.GetNextEventTime(EVENT_SPELL_VANISH_OUT) == 0) + DoMeleeAttackIfReady(); + } + }; }; class spell_illidari_council_balance_of_power : public SpellScriptLoader @@ -586,41 +586,41 @@ class spell_illidari_council_empyreal_balance : public SpellScriptLoader { PrepareSpellScript(spell_illidari_council_empyreal_balance_SpellScript); - bool Load() - { - _sharedHealth = 0; - _sharedHealthMax = 0; - _targetCount = 0; - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + _sharedHealth = 0; + _sharedHealthMax = 0; + _targetCount = 0; + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); + PreventHitDefaultEffect(effIndex); if (Unit* target = GetHitUnit()) - { - _targetCount++; - _sharedHealth += target->GetHealth(); - _sharedHealthMax += target->GetMaxHealth(); - } + { + _targetCount++; + _sharedHealth += target->GetHealth(); + _sharedHealthMax += target->GetMaxHealth(); + } } void HandleAfterCast() { if (_targetCount != 4) - { - GetCaster()->ToCreature()->AI()->EnterEvadeMode(); - return; - } + { + GetCaster()->ToCreature()->AI()->EnterEvadeMode(); + return; + } - float pct = (_sharedHealth / _sharedHealthMax) * 100.0f; - std::list const* targetsInfo = GetSpell()->GetUniqueTargetInfo(); - for (std::list::const_iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit) - if (Creature* target = ObjectAccessor::GetCreature(*GetCaster(), ihit->targetGUID)) - { - target->LowerPlayerDamageReq(target->GetMaxHealth()); - target->SetHealth(CalculatePct(target->GetMaxHealth(), pct)); - } + float pct = (_sharedHealth / _sharedHealthMax) * 100.0f; + std::list const* targetsInfo = GetSpell()->GetUniqueTargetInfo(); + for (std::list::const_iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit) + if (Creature* target = ObjectAccessor::GetCreature(*GetCaster(), ihit->targetGUID)) + { + target->LowerPlayerDamageReq(target->GetMaxHealth()); + target->SetHealth(CalculatePct(target->GetMaxHealth(), pct)); + } } void Register() @@ -629,10 +629,10 @@ class spell_illidari_council_empyreal_balance : public SpellScriptLoader AfterCast += SpellCastFn(spell_illidari_council_empyreal_balance_SpellScript::HandleAfterCast); } - private: - float _sharedHealth; - float _sharedHealthMax; - uint8 _targetCount; + private: + float _sharedHealth; + float _sharedHealthMax; + uint8 _targetCount; }; SpellScript* GetSpellScript() const @@ -643,33 +643,33 @@ class spell_illidari_council_empyreal_balance : public SpellScriptLoader class spell_illidari_council_reflective_shield : public SpellScriptLoader { - public: - spell_illidari_council_reflective_shield() : SpellScriptLoader("spell_illidari_council_reflective_shield") { } + public: + spell_illidari_council_reflective_shield() : SpellScriptLoader("spell_illidari_council_reflective_shield") { } - class spell_illidari_council_reflective_shield_AuraScript : public AuraScript - { - PrepareAuraScript(spell_illidari_council_reflective_shield_AuraScript); + class spell_illidari_council_reflective_shield_AuraScript : public AuraScript + { + PrepareAuraScript(spell_illidari_council_reflective_shield_AuraScript); - void ReflectDamage(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) - { - Unit* target = GetTarget(); - if (dmgInfo.GetAttacker() == target) - return; + void ReflectDamage(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) + { + Unit* target = GetTarget(); + if (dmgInfo.GetAttacker() == target) + return; - int32 bp = absorbAmount / 2; - target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_T, &bp, NULL, NULL, true, NULL, aurEff); - } + int32 bp = absorbAmount / 2; + target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_REFLECTIVE_SHIELD_T, &bp, NULL, NULL, true, NULL, aurEff); + } - void Register() - { - AfterEffectAbsorb += AuraEffectAbsorbFn(spell_illidari_council_reflective_shield_AuraScript::ReflectDamage, EFFECT_0); - } - }; + void Register() + { + AfterEffectAbsorb += AuraEffectAbsorbFn(spell_illidari_council_reflective_shield_AuraScript::ReflectDamage, EFFECT_0); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_illidari_council_reflective_shield_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_illidari_council_reflective_shield_AuraScript(); + } }; class spell_illidari_council_judgement : public SpellScriptLoader @@ -689,7 +689,7 @@ class spell_illidari_council_judgement : public SpellScriptLoader if ((*i)->GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_SEAL && (*i)->GetEffIndex() == EFFECT_2) if (sSpellMgr->GetSpellInfo((*i)->GetAmount())) { - GetCaster()->CastSpell(GetHitUnit(), (*i)->GetAmount(), true); + GetCaster()->CastSpell(GetHitUnit(), (*i)->GetAmount(), true); break; } } @@ -716,19 +716,19 @@ class spell_illidari_council_deadly_strike : public SpellScriptLoader { PrepareAuraScript(spell_illidari_council_deadly_strike_AuraScript); - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - { - GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true); - GetUnitOwner()->m_Events.AddEvent(new VerasEnvenom(*GetUnitOwner(), target->GetGUID()), GetUnitOwner()->m_Events.CalculateTime(urand(1500, 3500))); - } - } + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + { + GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true); + GetUnitOwner()->m_Events.AddEvent(new VerasEnvenom(*GetUnitOwner(), target->GetGUID()), GetUnitOwner()->m_Events.CalculateTime(urand(1500, 3500))); + } + } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidari_council_deadly_strike_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_illidari_council_deadly_strike_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -745,9 +745,9 @@ void AddSC_boss_illidari_council() new boss_lady_malande(); new boss_veras_darkshadow(); new boss_high_nethermancer_zerevor(); - new spell_illidari_council_balance_of_power(); - new spell_illidari_council_empyreal_balance(); + new spell_illidari_council_balance_of_power(); + new spell_illidari_council_empyreal_balance(); new spell_illidari_council_reflective_shield(); - new spell_illidari_council_judgement(); - new spell_illidari_council_deadly_strike(); + new spell_illidari_council_judgement(); + new spell_illidari_council_deadly_strike(); } diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp index bc5cdf47d..11ba1af15 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -15,15 +15,15 @@ DoorData const doorData[] = { GO_TERON_DOOR_1, DATA_TERON_GOREFIEND, DOOR_TYPE_ROOM, BOUNDARY_NONE }, { GO_TERON_DOOR_2, DATA_TERON_GOREFIEND, DOOR_TYPE_ROOM, BOUNDARY_NONE }, { GO_GURTOGG_DOOR, DATA_GURTOGG_BLOODBOIL, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { GO_TEMPLE_DOOR, DATA_GURTOGG_BLOODBOIL, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_TEMPLE_DOOR, DATA_GURTOGG_BLOODBOIL, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, { GO_TEMPLE_DOOR, DATA_TERON_GOREFIEND, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, { GO_TEMPLE_DOOR, DATA_RELIQUARY_OF_SOULS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, { GO_MOTHER_SHAHRAZ_DOOR, DATA_MOTHER_SHAHRAZ, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, { GO_COUNCIL_DOOR_1, DATA_ILLIDARI_COUNCIL, DOOR_TYPE_ROOM, BOUNDARY_NONE }, { GO_COUNCIL_DOOR_2, DATA_ILLIDARI_COUNCIL, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - { GO_ILLIDAN_GATE, DATA_AKAMA_FINISHED, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, - { GO_ILLIDAN_DOOR_L, DATA_ILLIDAN_STORMRAGE, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - { GO_ILLIDAN_DOOR_R, DATA_ILLIDAN_STORMRAGE, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_ILLIDAN_GATE, DATA_AKAMA_FINISHED, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_ILLIDAN_DOOR_L, DATA_ILLIDAN_STORMRAGE, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_ILLIDAN_DOOR_R, DATA_ILLIDAN_STORMRAGE, DOOR_TYPE_ROOM, BOUNDARY_NONE }, { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } }; @@ -41,9 +41,9 @@ class instance_black_temple : public InstanceMapScript ShadeOfAkamaGUID = 0; AkamaShadeGUID = 0; - TeronGorefiendGUID = 0; - ReliquaryGUID = 0; - ashtongueGUIDs.clear(); + TeronGorefiendGUID = 0; + ReliquaryGUID = 0; + ashtongueGUIDs.clear(); GathiosTheShattererGUID = 0; HighNethermancerZerevorGUID = 0; LadyMalandeGUID = 0; @@ -63,12 +63,12 @@ class instance_black_temple : public InstanceMapScript case NPC_AKAMA_SHADE: AkamaShadeGUID = creature->GetGUID(); break; - case NPC_TERON_GOREFIEND: - TeronGorefiendGUID = creature->GetGUID(); - break; - case NPC_RELIQUARY_OF_THE_LOST: - ReliquaryGUID = creature->GetGUID(); - break; + case NPC_TERON_GOREFIEND: + TeronGorefiendGUID = creature->GetGUID(); + break; + case NPC_RELIQUARY_OF_THE_LOST: + ReliquaryGUID = creature->GetGUID(); + break; case NPC_GATHIOS_THE_SHATTERER: GathiosTheShattererGUID = creature->GetGUID(); break; @@ -90,34 +90,34 @@ class instance_black_temple : public InstanceMapScript case NPC_ILLIDAN_STORMRAGE: IllidanStormrageGUID = creature->GetGUID(); break; - case NPC_VENGEFUL_SPIRIT: - case NPC_SHADOWY_CONSTRUCT: - if (Creature* teron = instance->GetCreature(TeronGorefiendGUID)) - teron->AI()->JustSummoned(creature); - break; - case NPC_ENSLAVED_SOUL: - if (Creature* reliquary = instance->GetCreature(ReliquaryGUID)) - reliquary->AI()->JustSummoned(creature); - break; - case NPC_PARASITIC_SHADOWFIEND: - case NPC_BLADE_OF_AZZINOTH: - case NPC_FLAME_OF_AZZINOTH: - if (Creature* illidan = instance->GetCreature(IllidanStormrageGUID)) - illidan->AI()->JustSummoned(creature); - break; - case NPC_ANGERED_SOUL_FRAGMENT: - case NPC_HUNGERING_SOUL_FRAGMENT: - case NPC_SUFFERING_SOUL_FRAGMENT: - creature->SetCorpseDelay(5); - break; + case NPC_VENGEFUL_SPIRIT: + case NPC_SHADOWY_CONSTRUCT: + if (Creature* teron = instance->GetCreature(TeronGorefiendGUID)) + teron->AI()->JustSummoned(creature); + break; + case NPC_ENSLAVED_SOUL: + if (Creature* reliquary = instance->GetCreature(ReliquaryGUID)) + reliquary->AI()->JustSummoned(creature); + break; + case NPC_PARASITIC_SHADOWFIEND: + case NPC_BLADE_OF_AZZINOTH: + case NPC_FLAME_OF_AZZINOTH: + if (Creature* illidan = instance->GetCreature(IllidanStormrageGUID)) + illidan->AI()->JustSummoned(creature); + break; + case NPC_ANGERED_SOUL_FRAGMENT: + case NPC_HUNGERING_SOUL_FRAGMENT: + case NPC_SUFFERING_SOUL_FRAGMENT: + creature->SetCorpseDelay(5); + break; } - if (creature->GetName().find("Ashtongue") != std::string::npos || creature->GetEntry() == NPC_STORM_FURY) - { - ashtongueGUIDs.push_back(creature->GetGUID()); - if (GetBossState(DATA_SHADE_OF_AKAMA) == DONE) - creature->setFaction(FACTION_ASHTONGUE); - } + if (creature->GetName().find("Ashtongue") != std::string::npos || creature->GetEntry() == NPC_STORM_FURY) + { + ashtongueGUIDs.push_back(creature->GetGUID()); + if (GetBossState(DATA_SHADE_OF_AKAMA) == DONE) + creature->setFaction(FACTION_ASHTONGUE); + } } void OnGameObjectCreate(GameObject* go) @@ -167,7 +167,7 @@ class instance_black_temple : public InstanceMapScript uint64 GetData64(uint32 type) const { switch (type) - { + { case NPC_SHADE_OF_AKAMA: return ShadeOfAkamaGUID; case NPC_AKAMA_SHADE: @@ -182,8 +182,8 @@ class instance_black_temple : public InstanceMapScript return VerasDarkshadowGUID; case NPC_ILLIDARI_COUNCIL: return IllidariCouncilGUID; - case NPC_AKAMA: - return AkamaGUID; + case NPC_AKAMA: + return AkamaGUID; case NPC_ILLIDAN_STORMRAGE: return IllidanStormrageGUID; } @@ -196,20 +196,20 @@ class instance_black_temple : public InstanceMapScript if (!InstanceScript::SetBossState(type, state)) return false; - if (type == DATA_SHADE_OF_AKAMA && state == DONE) - { - for (std::list::const_iterator itr = ashtongueGUIDs.begin(); itr != ashtongueGUIDs.end(); ++itr) - if (Creature* ashtongue = instance->GetCreature(*itr)) - ashtongue->setFaction(FACTION_ASHTONGUE); - } - else if (type == DATA_ILLIDARI_COUNCIL && state == DONE) - { - if (Creature* akama = instance->GetCreature(AkamaGUID)) - akama->SetVisible(true); - } + if (type == DATA_SHADE_OF_AKAMA && state == DONE) + { + for (std::list::const_iterator itr = ashtongueGUIDs.begin(); itr != ashtongueGUIDs.end(); ++itr) + if (Creature* ashtongue = instance->GetCreature(*itr)) + ashtongue->setFaction(FACTION_ASHTONGUE); + } + else if (type == DATA_ILLIDARI_COUNCIL && state == DONE) + { + if (Creature* akama = instance->GetCreature(AkamaGUID)) + akama->SetVisible(true); + } - return true; - } + return true; + } std::string GetSaveData() { @@ -257,9 +257,9 @@ class instance_black_temple : public InstanceMapScript protected: uint64 ShadeOfAkamaGUID; uint64 AkamaShadeGUID; - uint64 TeronGorefiendGUID; - uint64 ReliquaryGUID; - std::list ashtongueGUIDs; + uint64 TeronGorefiendGUID; + uint64 ReliquaryGUID; + std::list ashtongueGUIDs; uint64 GathiosTheShattererGUID; uint64 HighNethermancerZerevorGUID; uint64 LadyMalandeGUID; @@ -277,246 +277,246 @@ class instance_black_temple : public InstanceMapScript class spell_black_template_harpooners_mark : public SpellScriptLoader { - public: - spell_black_template_harpooners_mark() : SpellScriptLoader("spell_black_template_harpooners_mark") { } + public: + spell_black_template_harpooners_mark() : SpellScriptLoader("spell_black_template_harpooners_mark") { } - class spell_black_template_harpooners_mark_AuraScript : public AuraScript - { - PrepareAuraScript(spell_black_template_harpooners_mark_AuraScript) + class spell_black_template_harpooners_mark_AuraScript : public AuraScript + { + PrepareAuraScript(spell_black_template_harpooners_mark_AuraScript) - bool Load() - { - _turtleSet.clear(); - return true; - } - - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - std::list creatureList; - GetUnitOwner()->GetCreaturesWithEntryInRange(creatureList, 80.0f, NPC_DRAGON_TURTLE); - for (std::list::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) - { - (*itr)->TauntApply(GetUnitOwner()); - (*itr)->AddThreat(GetUnitOwner(), 10000000.0f); - _turtleSet.insert((*itr)->GetGUID()); - } - } + bool Load() + { + _turtleSet.clear(); + return true; + } + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + std::list creatureList; + GetUnitOwner()->GetCreaturesWithEntryInRange(creatureList, 80.0f, NPC_DRAGON_TURTLE); + for (std::list::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) + { + (*itr)->TauntApply(GetUnitOwner()); + (*itr)->AddThreat(GetUnitOwner(), 10000000.0f); + _turtleSet.insert((*itr)->GetGUID()); + } + } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - for (std::set::const_iterator itr = _turtleSet.begin(); itr != _turtleSet.end(); ++itr) - if (Creature* turtle = ObjectAccessor::GetCreature(*GetUnitOwner(), *itr)) - { - turtle->TauntFadeOut(GetUnitOwner()); - turtle->AddThreat(GetUnitOwner(), -10000000.0f); - } - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + for (std::set::const_iterator itr = _turtleSet.begin(); itr != _turtleSet.end(); ++itr) + if (Creature* turtle = ObjectAccessor::GetCreature(*GetUnitOwner(), *itr)) + { + turtle->TauntFadeOut(GetUnitOwner()); + turtle->AddThreat(GetUnitOwner(), -10000000.0f); + } + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_black_template_harpooners_mark_AuraScript::HandleEffectApply, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_black_template_harpooners_mark_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); - } + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_black_template_harpooners_mark_AuraScript::HandleEffectApply, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_black_template_harpooners_mark_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + } - private: - std::set _turtleSet; - }; + private: + std::set _turtleSet; + }; - AuraScript* GetAuraScript() const - { - return new spell_black_template_harpooners_mark_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_black_template_harpooners_mark_AuraScript(); + } }; class spell_black_template_free_friend : public SpellScriptLoader { - public: - spell_black_template_free_friend() : SpellScriptLoader("spell_black_template_free_friend") { } + public: + spell_black_template_free_friend() : SpellScriptLoader("spell_black_template_free_friend") { } - class spell_black_template_free_friend_SpellScript : public SpellScript - { - PrepareSpellScript(spell_black_template_free_friend_SpellScript); + class spell_black_template_free_friend_SpellScript : public SpellScript + { + PrepareSpellScript(spell_black_template_free_friend_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - Unit* target = GetHitUnit(); - if (!target) - return; + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Unit* target = GetHitUnit(); + if (!target) + return; - target->RemoveAurasDueToSpell(SPELL_AURA_MOD_CHARM); - target->RemoveAurasDueToSpell(SPELL_AURA_MOD_STUN); - target->RemoveAurasDueToSpell(SPELL_AURA_MOD_DECREASE_SPEED); - target->RemoveAurasDueToSpell(SPELL_AURA_MOD_ROOT); - target->RemoveAurasDueToSpell(SPELL_AURA_MOD_CONFUSE); - target->RemoveAurasDueToSpell(SPELL_AURA_MOD_FEAR); - } + target->RemoveAurasDueToSpell(SPELL_AURA_MOD_CHARM); + target->RemoveAurasDueToSpell(SPELL_AURA_MOD_STUN); + target->RemoveAurasDueToSpell(SPELL_AURA_MOD_DECREASE_SPEED); + target->RemoveAurasDueToSpell(SPELL_AURA_MOD_ROOT); + target->RemoveAurasDueToSpell(SPELL_AURA_MOD_CONFUSE); + target->RemoveAurasDueToSpell(SPELL_AURA_MOD_FEAR); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_black_template_free_friend_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_black_template_free_friend_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_black_template_free_friend_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_black_template_free_friend_SpellScript(); + } }; class spell_black_temple_curse_of_the_bleakheart : public SpellScriptLoader { - public: - spell_black_temple_curse_of_the_bleakheart() : SpellScriptLoader("spell_black_temple_curse_of_the_bleakheart") { } + public: + spell_black_temple_curse_of_the_bleakheart() : SpellScriptLoader("spell_black_temple_curse_of_the_bleakheart") { } - class spell_black_temple_curse_of_the_bleakheart_AuraScript : public AuraScript - { - PrepareAuraScript(spell_black_temple_curse_of_the_bleakheart_AuraScript); + class spell_black_temple_curse_of_the_bleakheart_AuraScript : public AuraScript + { + PrepareAuraScript(spell_black_temple_curse_of_the_bleakheart_AuraScript); - void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) - { - isPeriodic = true; - amplitude = 5000; - } + void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) + { + isPeriodic = true; + amplitude = 5000; + } - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - if (roll_chance_i(20)) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_CHEST_PAINS, true); - } + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + if (roll_chance_i(20)) + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_CHEST_PAINS, true); + } - void Register() - { - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_black_temple_curse_of_the_bleakheart_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_curse_of_the_bleakheart_AuraScript::Update, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + void Register() + { + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_black_temple_curse_of_the_bleakheart_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_curse_of_the_bleakheart_AuraScript::Update, EFFECT_0, SPELL_AURA_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_black_temple_curse_of_the_bleakheart_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_black_temple_curse_of_the_bleakheart_AuraScript(); + } }; class spell_black_temple_skeleton_shot : public SpellScriptLoader { - public: - spell_black_temple_skeleton_shot() : SpellScriptLoader("spell_black_temple_skeleton_shot") { } + public: + spell_black_temple_skeleton_shot() : SpellScriptLoader("spell_black_temple_skeleton_shot") { } - class spell_black_temple_skeleton_shot_AuraScript : public AuraScript - { - PrepareAuraScript(spell_black_temple_skeleton_shot_AuraScript) + class spell_black_temple_skeleton_shot_AuraScript : public AuraScript + { + PrepareAuraScript(spell_black_temple_skeleton_shot_AuraScript) - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) - GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_2].CalcValue(), true); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) + GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_2].CalcValue(), true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_black_temple_skeleton_shot_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_black_temple_skeleton_shot_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_black_temple_skeleton_shot_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_black_temple_skeleton_shot_AuraScript(); + } }; class spell_black_temple_wyvern_sting : public SpellScriptLoader { - public: - spell_black_temple_wyvern_sting() : SpellScriptLoader("spell_black_temple_wyvern_sting") { } + public: + spell_black_temple_wyvern_sting() : SpellScriptLoader("spell_black_temple_wyvern_sting") { } - class spell_black_temple_wyvern_sting_AuraScript : public AuraScript - { - PrepareAuraScript(spell_black_temple_wyvern_sting_AuraScript) + class spell_black_temple_wyvern_sting_AuraScript : public AuraScript + { + PrepareAuraScript(spell_black_temple_wyvern_sting_AuraScript) - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - caster->CastSpell(GetTarget(), SPELL_WYVERN_STING, true); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), SPELL_WYVERN_STING, true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_black_temple_wyvern_sting_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_black_temple_wyvern_sting_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_black_temple_wyvern_sting_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_black_temple_wyvern_sting_AuraScript(); + } }; class spell_black_temple_charge_rage : public SpellScriptLoader { - public: - spell_black_temple_charge_rage() : SpellScriptLoader("spell_black_temple_charge_rage") { } + public: + spell_black_temple_charge_rage() : SpellScriptLoader("spell_black_temple_charge_rage") { } - class spell_black_temple_charge_rage_AuraScript : public AuraScript - { - PrepareAuraScript(spell_black_temple_charge_rage_AuraScript); + class spell_black_temple_charge_rage_AuraScript : public AuraScript + { + PrepareAuraScript(spell_black_temple_charge_rage_AuraScript); - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - if (Unit* target = GetUnitOwner()->SelectNearbyNoTotemTarget((Unit*)NULL, 50.0f)) - GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true); - } + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + if (Unit* target = GetUnitOwner()->SelectNearbyNoTotemTarget((Unit*)NULL, 50.0f)) + GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_charge_rage_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_charge_rage_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_black_temple_charge_rage_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_black_temple_charge_rage_AuraScript(); + } }; class spell_black_temple_shadow_inferno : public SpellScriptLoader { - public: - spell_black_temple_shadow_inferno() : SpellScriptLoader("spell_black_temple_shadow_inferno") { } + public: + spell_black_temple_shadow_inferno() : SpellScriptLoader("spell_black_temple_shadow_inferno") { } - class spell_black_temple_shadow_inferno_AuraScript : public AuraScript - { - PrepareAuraScript(spell_black_temple_shadow_inferno_AuraScript); + class spell_black_temple_shadow_inferno_AuraScript : public AuraScript + { + PrepareAuraScript(spell_black_temple_shadow_inferno_AuraScript); - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - GetUnitOwner()->CastCustomSpell(SPELL_SHADOW_INFERNO_DAMAGE, SPELLVALUE_BASE_POINT0, effect->GetAmount(), GetUnitOwner(), TRIGGERED_FULL_MASK); - GetAura()->GetEffect(effect->GetEffIndex())->SetAmount(effect->GetAmount()+500); - } + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + GetUnitOwner()->CastCustomSpell(SPELL_SHADOW_INFERNO_DAMAGE, SPELLVALUE_BASE_POINT0, effect->GetAmount(), GetUnitOwner(), TRIGGERED_FULL_MASK); + GetAura()->GetEffect(effect->GetEffIndex())->SetAmount(effect->GetAmount()+500); + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_shadow_inferno_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_shadow_inferno_AuraScript::Update, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_black_temple_shadow_inferno_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_black_temple_shadow_inferno_AuraScript(); + } }; class spell_black_temple_spell_absorption : public SpellScriptLoader { - public: - spell_black_temple_spell_absorption() : SpellScriptLoader("spell_black_temple_spell_absorption") { } + public: + spell_black_temple_spell_absorption() : SpellScriptLoader("spell_black_temple_spell_absorption") { } - class spell_black_temple_spell_absorption_AuraScript : public AuraScript - { - PrepareAuraScript(spell_black_temple_spell_absorption_AuraScript); + class spell_black_temple_spell_absorption_AuraScript : public AuraScript + { + PrepareAuraScript(spell_black_temple_spell_absorption_AuraScript); void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { @@ -526,32 +526,32 @@ class spell_black_temple_spell_absorption : public SpellScriptLoader void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { - absorbAmount = dmgInfo.GetDamage(); + absorbAmount = dmgInfo.GetDamage(); } - void Update(AuraEffect const* effect) - { - PreventDefaultAction(); - uint32 count = GetUnitOwner()->GetAuraCount(SPELL_CHAOTIC_CHARGE); - if (count == 0) - return; + void Update(AuraEffect const* effect) + { + PreventDefaultAction(); + uint32 count = GetUnitOwner()->GetAuraCount(SPELL_CHAOTIC_CHARGE); + if (count == 0) + return; - GetUnitOwner()->CastCustomSpell(GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, SPELLVALUE_BASE_POINT0, effect->GetAmount()*count, GetUnitOwner(), TRIGGERED_FULL_MASK); - GetUnitOwner()->RemoveAurasDueToSpell(SPELL_CHAOTIC_CHARGE); - } + GetUnitOwner()->CastCustomSpell(GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, SPELLVALUE_BASE_POINT0, effect->GetAmount()*count, GetUnitOwner(), TRIGGERED_FULL_MASK); + GetUnitOwner()->RemoveAurasDueToSpell(SPELL_CHAOTIC_CHARGE); + } - void Register() - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_black_temple_spell_absorption_AuraScript::CalculateAmount, EFFECT_2, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_black_temple_spell_absorption_AuraScript::Absorb, EFFECT_2); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_spell_absorption_AuraScript::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE); - } - }; + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_black_temple_spell_absorption_AuraScript::CalculateAmount, EFFECT_2, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_black_temple_spell_absorption_AuraScript::Absorb, EFFECT_2); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_black_temple_spell_absorption_AuraScript::Update, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_black_temple_spell_absorption_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_black_temple_spell_absorption_AuraScript(); + } }; class spell_black_temple_bloodbolt : public SpellScriptLoader @@ -566,13 +566,13 @@ class spell_black_temple_bloodbolt : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { PreventHitEffect(effIndex); - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, GetEffectValue(), true); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, GetEffectValue(), true); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_black_temple_bloodbolt_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_black_temple_bloodbolt_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -620,8 +620,8 @@ class spell_black_temple_curse_of_vitality : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - if (GetUnitOwner()->HealthBelowPct(50)) - SetDuration(0); + if (GetUnitOwner()->HealthBelowPct(50)) + SetDuration(0); } void Register() @@ -647,10 +647,10 @@ class spell_black_temple_dementia : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - if (roll_chance_i(50)) - GetTarget()->CastSpell(GetTarget(), SPELL_DEMENTIA1, true); - else - GetTarget()->CastSpell(GetTarget(), SPELL_DEMENTIA2, true); + if (roll_chance_i(50)) + GetTarget()->CastSpell(GetTarget(), SPELL_DEMENTIA1, true); + else + GetTarget()->CastSpell(GetTarget(), SPELL_DEMENTIA2, true); } void Register() @@ -668,16 +668,16 @@ class spell_black_temple_dementia : public SpellScriptLoader void AddSC_instance_black_temple() { new instance_black_temple(); - new spell_black_template_harpooners_mark(); - new spell_black_template_free_friend(); - new spell_black_temple_curse_of_the_bleakheart(); - new spell_black_temple_skeleton_shot(); - new spell_black_temple_wyvern_sting(); - new spell_black_temple_charge_rage(); - new spell_black_temple_shadow_inferno(); - new spell_black_temple_spell_absorption(); - new spell_black_temple_bloodbolt(); - new spell_black_temple_consuming_strikes(); - new spell_black_temple_curse_of_vitality(); - new spell_black_temple_dementia(); + new spell_black_template_harpooners_mark(); + new spell_black_template_free_friend(); + new spell_black_temple_curse_of_the_bleakheart(); + new spell_black_temple_skeleton_shot(); + new spell_black_temple_wyvern_sting(); + new spell_black_temple_charge_rage(); + new spell_black_temple_shadow_inferno(); + new spell_black_temple_spell_absorption(); + new spell_black_temple_bloodbolt(); + new spell_black_temple_consuming_strikes(); + new spell_black_temple_curse_of_vitality(); + new spell_black_temple_dementia(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 100f2b8c4..514f5debd 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -8,166 +8,166 @@ REWRITTEN BY XINEF enum Talk { - SAY_AGGRO = 0, - SAY_GAIN_BLESSING = 1, - SAY_GAIN_ABILITY1 = 2, - SAY_GAIN_ABILITY2 = 3, - SAY_GAIN_ABILITY3 = 4, - SAY_SLAY = 5, - SAY_DEATH = 6 + SAY_AGGRO = 0, + SAY_GAIN_BLESSING = 1, + SAY_GAIN_ABILITY1 = 2, + SAY_GAIN_ABILITY2 = 3, + SAY_GAIN_ABILITY3 = 4, + SAY_SLAY = 5, + SAY_DEATH = 6 }; enum Spells { - SPELL_CATACLYSMIC_BOLT = 38441, - SPELL_SEAR_NOVA = 38445, - SPELL_ENRAGE = 24318, - SPELL_BLESSING_OF_THE_TIDES = 38449 + SPELL_CATACLYSMIC_BOLT = 38441, + SPELL_SEAR_NOVA = 38445, + SPELL_ENRAGE = 24318, + SPELL_BLESSING_OF_THE_TIDES = 38449 }; enum Misc { - MAX_ADVISORS = 3, - NPC_FATHOM_GUARD_CARIBDIS = 21964, - NPC_FATHOM_GUARD_TIDALVESS = 21965, - NPC_FATHOM_GUARD_SHARKKIS = 21966, - NPC_SEER_OLUM = 22820, - GO_CAGE = 185952, + MAX_ADVISORS = 3, + NPC_FATHOM_GUARD_CARIBDIS = 21964, + NPC_FATHOM_GUARD_TIDALVESS = 21965, + NPC_FATHOM_GUARD_SHARKKIS = 21966, + NPC_SEER_OLUM = 22820, + GO_CAGE = 185952, - EVENT_SPELL_CATACLYSMIC_BOLT = 1, - EVENT_SPELL_ENRAGE = 2, - EVENT_SPELL_SEAR_NOVA = 3, - EVENT_HEALTH_CHECK = 4, - EVENT_KILL_TALK = 5 + EVENT_SPELL_CATACLYSMIC_BOLT = 1, + EVENT_SPELL_ENRAGE = 2, + EVENT_SPELL_SEAR_NOVA = 3, + EVENT_HEALTH_CHECK = 4, + EVENT_KILL_TALK = 5 }; const Position advisorsPosition[MAX_ADVISORS+2] = { - {459.61f, -534.81f, -7.54f, 3.82f}, - {463.83f, -540.23f, -7.54f, 3.15f}, - {459.94f, -547.28f, -7.54f, 2.42f}, - {448.37f, -544.71f, -7.54f, 0.00f}, - {457.37f, -544.71f, -7.54f, 0.00f} + {459.61f, -534.81f, -7.54f, 3.82f}, + {463.83f, -540.23f, -7.54f, 3.15f}, + {459.94f, -547.28f, -7.54f, 2.42f}, + {448.37f, -544.71f, -7.54f, 0.00f}, + {457.37f, -544.71f, -7.54f, 0.00f} }; class boss_fathomlord_karathress : public CreatureScript { - public: - boss_fathomlord_karathress() : CreatureScript("boss_fathomlord_karathress") { } + public: + boss_fathomlord_karathress() : CreatureScript("boss_fathomlord_karathress") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_fathomlord_karathressAI : public BossAI - { - boss_fathomlord_karathressAI(Creature* creature) : BossAI(creature, DATA_FATHOM_LORD_KARATHRESS) - { - } + struct boss_fathomlord_karathressAI : public BossAI + { + boss_fathomlord_karathressAI(Creature* creature) : BossAI(creature, DATA_FATHOM_LORD_KARATHRESS) + { + } - void Reset() - { - BossAI::Reset(); + void Reset() + { + BossAI::Reset(); - me->SummonCreature(NPC_FATHOM_GUARD_TIDALVESS, advisorsPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 600000); - me->SummonCreature(NPC_FATHOM_GUARD_SHARKKIS, advisorsPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 600000); - me->SummonCreature(NPC_FATHOM_GUARD_CARIBDIS, advisorsPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 600000); - } + me->SummonCreature(NPC_FATHOM_GUARD_TIDALVESS, advisorsPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 600000); + me->SummonCreature(NPC_FATHOM_GUARD_SHARKKIS, advisorsPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 600000); + me->SummonCreature(NPC_FATHOM_GUARD_CARIBDIS, advisorsPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 600000); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() == NPC_SEER_OLUM) - { - summon->SetWalk(true); - summon->GetMotionMaster()->MovePoint(0, advisorsPosition[MAX_ADVISORS+1], false); - } - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() == NPC_SEER_OLUM) + { + summon->SetWalk(true); + summon->GetMotionMaster()->MovePoint(0, advisorsPosition[MAX_ADVISORS+1], false); + } + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - if (summon->GetEntry() == NPC_FATHOM_GUARD_TIDALVESS) - Talk(SAY_GAIN_ABILITY1); - if (summon->GetEntry() == NPC_FATHOM_GUARD_SHARKKIS) - Talk(SAY_GAIN_ABILITY2); - if (summon->GetEntry() == NPC_FATHOM_GUARD_CARIBDIS) - Talk(SAY_GAIN_ABILITY3); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + if (summon->GetEntry() == NPC_FATHOM_GUARD_TIDALVESS) + Talk(SAY_GAIN_ABILITY1); + if (summon->GetEntry() == NPC_FATHOM_GUARD_SHARKKIS) + Talk(SAY_GAIN_ABILITY2); + if (summon->GetEntry() == NPC_FATHOM_GUARD_CARIBDIS) + Talk(SAY_GAIN_ABILITY3); + } - void KilledUnit(Unit* /*victim*/) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - me->SummonCreature(NPC_SEER_OLUM, advisorsPosition[MAX_ADVISORS], TEMPSUMMON_TIMED_DESPAWN, 3600000); - if (GameObject* gobject = me->FindNearestGameObject(GO_CAGE, 100.0f)) - gobject->SetGoState(GO_STATE_ACTIVE); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + me->SummonCreature(NPC_SEER_OLUM, advisorsPosition[MAX_ADVISORS], TEMPSUMMON_TIMED_DESPAWN, 3600000); + if (GameObject* gobject = me->FindNearestGameObject(GO_CAGE, 100.0f)) + gobject->SetGoState(GO_STATE_ACTIVE); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); - me->CallForHelp(10.0f); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); + me->CallForHelp(10.0f); - events.ScheduleEvent(EVENT_SPELL_CATACLYSMIC_BOLT, 10000); - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); - events.ScheduleEvent(EVENT_SPELL_SEAR_NOVA, 25000); - events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); - } + events.ScheduleEvent(EVENT_SPELL_CATACLYSMIC_BOLT, 10000); + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); + events.ScheduleEvent(EVENT_SPELL_SEAR_NOVA, 25000); + events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_ENRAGE: - me->CastSpell(me, SPELL_ENRAGE, true); - break; - case EVENT_SPELL_CATACLYSMIC_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, PowerUsersSelector(me, POWER_MANA, 50.0f, true))) - me->CastSpell(target, SPELL_CATACLYSMIC_BOLT, false); - events.ScheduleEvent(EVENT_SPELL_CATACLYSMIC_BOLT, 6000); - break; - case EVENT_SPELL_SEAR_NOVA: - me->CastSpell(me, SPELL_SEAR_NOVA, false); - events.ScheduleEvent(EVENT_SPELL_SEAR_NOVA, 20000+urand(0, 20000)); - break; - case EVENT_HEALTH_CHECK: - if (me->HealthBelowPct(76)) - { - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - if (summon->GetMaxHealth() > 500000) - summon->CastSpell(me, SPELL_BLESSING_OF_THE_TIDES, true); + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_ENRAGE: + me->CastSpell(me, SPELL_ENRAGE, true); + break; + case EVENT_SPELL_CATACLYSMIC_BOLT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, PowerUsersSelector(me, POWER_MANA, 50.0f, true))) + me->CastSpell(target, SPELL_CATACLYSMIC_BOLT, false); + events.ScheduleEvent(EVENT_SPELL_CATACLYSMIC_BOLT, 6000); + break; + case EVENT_SPELL_SEAR_NOVA: + me->CastSpell(me, SPELL_SEAR_NOVA, false); + events.ScheduleEvent(EVENT_SPELL_SEAR_NOVA, 20000+urand(0, 20000)); + break; + case EVENT_HEALTH_CHECK: + if (me->HealthBelowPct(76)) + { + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + if (summon->GetMaxHealth() > 500000) + summon->CastSpell(me, SPELL_BLESSING_OF_THE_TIDES, true); - if (me->HasAura(SPELL_BLESSING_OF_THE_TIDES)) - Talk(SAY_GAIN_BLESSING); - break; - } - events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); - break; - } + if (me->HasAura(SPELL_BLESSING_OF_THE_TIDES)) + Talk(SAY_GAIN_BLESSING); + break; + } + events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_karathress_power_of_caribdis : public SpellScriptLoader @@ -181,9 +181,9 @@ class spell_karathress_power_of_caribdis : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); - if (Unit* victim = GetUnitOwner()->GetVictim()) - GetUnitOwner()->CastSpell(victim, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + PreventDefaultAction(); + if (Unit* victim = GetUnitOwner()->GetVictim()) + GetUnitOwner()->CastSpell(victim, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); } void Register() @@ -201,5 +201,5 @@ class spell_karathress_power_of_caribdis : public SpellScriptLoader void AddSC_boss_fathomlord_karathress() { new boss_fathomlord_karathress(); - new spell_karathress_power_of_caribdis(); + new spell_karathress_power_of_caribdis(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp index 403a0252e..8e5813711 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp @@ -8,365 +8,365 @@ REWRITTEN BY XINEF enum Talk { - SAY_AGGRO = 0, - SAY_SWITCH_TO_CLEAN = 1, - SAY_CLEAN_SLAY = 2, - SAY_CLEAN_DEATH = 3, - SAY_SWITCH_TO_CORRUPT = 4, - SAY_CORRUPT_SLAY = 5, - SAY_CORRUPT_DEATH = 6 + SAY_AGGRO = 0, + SAY_SWITCH_TO_CLEAN = 1, + SAY_CLEAN_SLAY = 2, + SAY_CLEAN_DEATH = 3, + SAY_SWITCH_TO_CORRUPT = 4, + SAY_CORRUPT_SLAY = 5, + SAY_CORRUPT_DEATH = 6 }; enum Spells { - SPELL_CLEANSING_FIELD_AURA = 37935, - SPELL_CLEANSING_FIELD = 37934, - SPELL_BLUE_BEAM = 38015, - SPELL_ELEMENTAL_SPAWNIN = 25035, + SPELL_CLEANSING_FIELD_AURA = 37935, + SPELL_CLEANSING_FIELD = 37934, + SPELL_BLUE_BEAM = 38015, + SPELL_ELEMENTAL_SPAWNIN = 25035, - SPELL_SUMMON_CORRUPTED1 = 38188, - SPELL_SUMMON_CORRUPTED2 = 38189, - SPELL_SUMMON_CORRUPTED3 = 38190, - SPELL_SUMMON_CORRUPTED4 = 38191, - SPELL_SUMMON_PURIFIED1 = 38198, - SPELL_SUMMON_PURIFIED2 = 38199, - SPELL_SUMMON_PURIFIED3 = 38200, - SPELL_SUMMON_PURIFIED4 = 38201, + SPELL_SUMMON_CORRUPTED1 = 38188, + SPELL_SUMMON_CORRUPTED2 = 38189, + SPELL_SUMMON_CORRUPTED3 = 38190, + SPELL_SUMMON_CORRUPTED4 = 38191, + SPELL_SUMMON_PURIFIED1 = 38198, + SPELL_SUMMON_PURIFIED2 = 38199, + SPELL_SUMMON_PURIFIED3 = 38200, + SPELL_SUMMON_PURIFIED4 = 38201, - SPELL_CORRUPTION = 37961, - SPELL_WATER_TOMB = 38235, - SPELL_VILE_SLUDGE = 38246, - SPELL_ENRAGE = 27680, + SPELL_CORRUPTION = 37961, + SPELL_WATER_TOMB = 38235, + SPELL_VILE_SLUDGE = 38246, + SPELL_ENRAGE = 27680, - SPELL_MARK_OF_HYDROSS1 = 38215, - SPELL_MARK_OF_HYDROSS2 = 38216, - SPELL_MARK_OF_HYDROSS3 = 38217, - SPELL_MARK_OF_HYDROSS4 = 38218, - SPELL_MARK_OF_HYDROSS5 = 38231, - SPELL_MARK_OF_HYDROSS6 = 40584, - SPELL_MARK_OF_CORRUPTION1 = 38219, - SPELL_MARK_OF_CORRUPTION2 = 38220, - SPELL_MARK_OF_CORRUPTION3 = 38221, - SPELL_MARK_OF_CORRUPTION4 = 38222, - SPELL_MARK_OF_CORRUPTION5 = 38230, - SPELL_MARK_OF_CORRUPTION6 = 40583, + SPELL_MARK_OF_HYDROSS1 = 38215, + SPELL_MARK_OF_HYDROSS2 = 38216, + SPELL_MARK_OF_HYDROSS3 = 38217, + SPELL_MARK_OF_HYDROSS4 = 38218, + SPELL_MARK_OF_HYDROSS5 = 38231, + SPELL_MARK_OF_HYDROSS6 = 40584, + SPELL_MARK_OF_CORRUPTION1 = 38219, + SPELL_MARK_OF_CORRUPTION2 = 38220, + SPELL_MARK_OF_CORRUPTION3 = 38221, + SPELL_MARK_OF_CORRUPTION4 = 38222, + SPELL_MARK_OF_CORRUPTION5 = 38230, + SPELL_MARK_OF_CORRUPTION6 = 40583, }; enum Misc { - GROUP_ABILITIES = 1, - NPC_PURE_SPAWN_OF_HYDROSS = 22035, + GROUP_ABILITIES = 1, + NPC_PURE_SPAWN_OF_HYDROSS = 22035, - EVENT_SPELL_MARK_OF_CORRUPTION1 = 1, - EVENT_SPELL_MARK_OF_CORRUPTION2 = 2, - EVENT_SPELL_MARK_OF_CORRUPTION3 = 3, - EVENT_SPELL_MARK_OF_CORRUPTION4 = 4, - EVENT_SPELL_MARK_OF_CORRUPTION5 = 5, - EVENT_SPELL_MARK_OF_CORRUPTION6 = 6, - EVENT_SPELL_MARK_OF_HYDROSS1 = 7, - EVENT_SPELL_MARK_OF_HYDROSS2 = 8, - EVENT_SPELL_MARK_OF_HYDROSS3 = 9, - EVENT_SPELL_MARK_OF_HYDROSS4 = 10, - EVENT_SPELL_MARK_OF_HYDROSS5 = 11, - EVENT_SPELL_MARK_OF_HYDROSS6 = 12, - EVENT_SPELL_WATER_TOMB = 13, - EVENT_SPELL_VILE_SLUDGE = 14, - EVENT_SPELL_ENRAGE = 15, - EVENT_CHECK_AURA = 16, - EVENT_KILL_TALK = 17 + EVENT_SPELL_MARK_OF_CORRUPTION1 = 1, + EVENT_SPELL_MARK_OF_CORRUPTION2 = 2, + EVENT_SPELL_MARK_OF_CORRUPTION3 = 3, + EVENT_SPELL_MARK_OF_CORRUPTION4 = 4, + EVENT_SPELL_MARK_OF_CORRUPTION5 = 5, + EVENT_SPELL_MARK_OF_CORRUPTION6 = 6, + EVENT_SPELL_MARK_OF_HYDROSS1 = 7, + EVENT_SPELL_MARK_OF_HYDROSS2 = 8, + EVENT_SPELL_MARK_OF_HYDROSS3 = 9, + EVENT_SPELL_MARK_OF_HYDROSS4 = 10, + EVENT_SPELL_MARK_OF_HYDROSS5 = 11, + EVENT_SPELL_MARK_OF_HYDROSS6 = 12, + EVENT_SPELL_WATER_TOMB = 13, + EVENT_SPELL_VILE_SLUDGE = 14, + EVENT_SPELL_ENRAGE = 15, + EVENT_CHECK_AURA = 16, + EVENT_KILL_TALK = 17 }; class boss_hydross_the_unstable : public CreatureScript { - public: - boss_hydross_the_unstable() : CreatureScript("boss_hydross_the_unstable") { } + public: + boss_hydross_the_unstable() : CreatureScript("boss_hydross_the_unstable") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_hydross_the_unstableAI : public BossAI - { - boss_hydross_the_unstableAI(Creature* creature) : BossAI(creature, DATA_HYDROSS_THE_UNSTABLE) - { - } + struct boss_hydross_the_unstableAI : public BossAI + { + boss_hydross_the_unstableAI(Creature* creature) : BossAI(creature, DATA_HYDROSS_THE_UNSTABLE) + { + } - void Reset() - { - BossAI::Reset(); - } + void Reset() + { + BossAI::Reset(); + } - void JustReachedHome() - { - BossAI::JustReachedHome(); - if (!me->HasAura(SPELL_BLUE_BEAM)) - me->RemoveAurasDueToSpell(SPELL_CLEANSING_FIELD_AURA); - } + void JustReachedHome() + { + BossAI::JustReachedHome(); + if (!me->HasAura(SPELL_BLUE_BEAM)) + me->RemoveAurasDueToSpell(SPELL_CLEANSING_FIELD_AURA); + } - void SetForm(bool corrupt, bool initial) - { - events.CancelEventGroup(GROUP_ABILITIES); - DoResetThreat(); - - if (corrupt) - { - me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); - me->CastSpell(me, SPELL_CORRUPTION, true); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION1, 0, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION2, 15000, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION3, 30000, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION4, 45000, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION5, 60000, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION6, 75000, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_VILE_SLUDGE, 7000, GROUP_ABILITIES); - } - else - { - me->SetMeleeDamageSchool(SPELL_SCHOOL_FROST); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, false); - me->RemoveAurasDueToSpell(SPELL_CORRUPTION); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS1, 0, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS2, 15000, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS3, 30000, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS4, 45000, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS5, 60000, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS6, 75000, GROUP_ABILITIES); - events.ScheduleEvent(EVENT_SPELL_WATER_TOMB, 7000, GROUP_ABILITIES); - } + void SetForm(bool corrupt, bool initial) + { + events.CancelEventGroup(GROUP_ABILITIES); + DoResetThreat(); + + if (corrupt) + { + me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); + me->CastSpell(me, SPELL_CORRUPTION, true); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION1, 0, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION2, 15000, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION3, 30000, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION4, 45000, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION5, 60000, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION6, 75000, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_VILE_SLUDGE, 7000, GROUP_ABILITIES); + } + else + { + me->SetMeleeDamageSchool(SPELL_SCHOOL_FROST); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, false); + me->RemoveAurasDueToSpell(SPELL_CORRUPTION); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS1, 0, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS2, 15000, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS3, 30000, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS4, 45000, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS5, 60000, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS6, 75000, GROUP_ABILITIES); + events.ScheduleEvent(EVENT_SPELL_WATER_TOMB, 7000, GROUP_ABILITIES); + } - if (initial) - return; + if (initial) + return; - if (corrupt) - { - Talk(SAY_SWITCH_TO_CORRUPT); - for (uint32 i = SPELL_SUMMON_CORRUPTED1; i <= SPELL_SUMMON_CORRUPTED4; ++i) - me->CastSpell(me, i, true); - } - else - { - Talk(SAY_SWITCH_TO_CLEAN); - for (uint32 i = SPELL_SUMMON_PURIFIED1; i <= SPELL_SUMMON_PURIFIED4; ++i) - me->CastSpell(me, i, true); - } - } + if (corrupt) + { + Talk(SAY_SWITCH_TO_CORRUPT); + for (uint32 i = SPELL_SUMMON_CORRUPTED1; i <= SPELL_SUMMON_CORRUPTED4; ++i) + me->CastSpell(me, i, true); + } + else + { + Talk(SAY_SWITCH_TO_CLEAN); + for (uint32 i = SPELL_SUMMON_PURIFIED1; i <= SPELL_SUMMON_PURIFIED4; ++i) + me->CastSpell(me, i, true); + } + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); - events.ScheduleEvent(EVENT_CHECK_AURA, 1000); - SetForm(false, true); - } + events.ScheduleEvent(EVENT_SPELL_ENRAGE, 600000); + events.ScheduleEvent(EVENT_CHECK_AURA, 1000); + SetForm(false, true); + } - void KilledUnit(Unit* /*victim*/) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(me->HasAura(SPELL_CORRUPTION) ? SAY_CORRUPT_SLAY : SAY_CLEAN_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(me->HasAura(SPELL_CORRUPTION) ? SAY_CORRUPT_SLAY : SAY_CLEAN_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->CastSpell(summon, SPELL_ELEMENTAL_SPAWNIN, true); - summon->SetInCombatWithZone(); + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->CastSpell(summon, SPELL_ELEMENTAL_SPAWNIN, true); + summon->SetInCombatWithZone(); - if (summon->GetEntry() == NPC_PURE_SPAWN_OF_HYDROSS) - summon->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); - else - summon->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); - } + if (summon->GetEntry() == NPC_PURE_SPAWN_OF_HYDROSS) + summon->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); + else + summon->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + } - void JustDied(Unit* killer) - { - Talk(me->HasAura(SPELL_CORRUPTION) ? SAY_CORRUPT_DEATH : SAY_CLEAN_DEATH); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(me->HasAura(SPELL_CORRUPTION) ? SAY_CORRUPT_DEATH : SAY_CLEAN_DEATH); + BossAI::JustDied(killer); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_AURA: - if (me->HasAura(SPELL_BLUE_BEAM) == me->HasAura(SPELL_CORRUPTION)) - SetForm(!me->HasAura(SPELL_BLUE_BEAM), false); - events.ScheduleEvent(EVENT_CHECK_AURA, 1000); - break; - case EVENT_SPELL_ENRAGE: - me->CastSpell(me, SPELL_ENRAGE, true); - break; - case EVENT_SPELL_MARK_OF_HYDROSS1: - me->CastSpell(me, SPELL_MARK_OF_HYDROSS1, false); - break; - case EVENT_SPELL_MARK_OF_HYDROSS2: - me->CastSpell(me, SPELL_MARK_OF_HYDROSS2, false); - break; - case EVENT_SPELL_MARK_OF_HYDROSS3: - me->CastSpell(me, SPELL_MARK_OF_HYDROSS3, false); - break; - case EVENT_SPELL_MARK_OF_HYDROSS4: - me->CastSpell(me, SPELL_MARK_OF_HYDROSS4, false); - break; - case EVENT_SPELL_MARK_OF_HYDROSS5: - me->CastSpell(me, SPELL_MARK_OF_HYDROSS5, false); - break; - case EVENT_SPELL_MARK_OF_HYDROSS6: - me->CastSpell(me, SPELL_MARK_OF_HYDROSS6, false); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS6, 15000, GROUP_ABILITIES); - break; - case EVENT_SPELL_MARK_OF_CORRUPTION1: - me->CastSpell(me, SPELL_MARK_OF_CORRUPTION1, false); - break; - case EVENT_SPELL_MARK_OF_CORRUPTION2: - me->CastSpell(me, SPELL_MARK_OF_CORRUPTION2, false); - break; - case EVENT_SPELL_MARK_OF_CORRUPTION3: - me->CastSpell(me, SPELL_MARK_OF_CORRUPTION3, false); - break; - case EVENT_SPELL_MARK_OF_CORRUPTION4: - me->CastSpell(me, SPELL_MARK_OF_CORRUPTION4, false); - break; - case EVENT_SPELL_MARK_OF_CORRUPTION5: - me->CastSpell(me, SPELL_MARK_OF_CORRUPTION5, false); - break; - case EVENT_SPELL_MARK_OF_CORRUPTION6: - me->CastSpell(me, SPELL_MARK_OF_CORRUPTION6, false); - events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION6, 15000, GROUP_ABILITIES); - break; - case EVENT_SPELL_WATER_TOMB: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) - me->CastSpell(target, SPELL_WATER_TOMB, false); - events.ScheduleEvent(EVENT_SPELL_WATER_TOMB, 7000, GROUP_ABILITIES); - break; - case EVENT_SPELL_VILE_SLUDGE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) - me->CastSpell(target, SPELL_VILE_SLUDGE, false); - events.ScheduleEvent(EVENT_SPELL_VILE_SLUDGE, 15000, GROUP_ABILITIES); - break; + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_AURA: + if (me->HasAura(SPELL_BLUE_BEAM) == me->HasAura(SPELL_CORRUPTION)) + SetForm(!me->HasAura(SPELL_BLUE_BEAM), false); + events.ScheduleEvent(EVENT_CHECK_AURA, 1000); + break; + case EVENT_SPELL_ENRAGE: + me->CastSpell(me, SPELL_ENRAGE, true); + break; + case EVENT_SPELL_MARK_OF_HYDROSS1: + me->CastSpell(me, SPELL_MARK_OF_HYDROSS1, false); + break; + case EVENT_SPELL_MARK_OF_HYDROSS2: + me->CastSpell(me, SPELL_MARK_OF_HYDROSS2, false); + break; + case EVENT_SPELL_MARK_OF_HYDROSS3: + me->CastSpell(me, SPELL_MARK_OF_HYDROSS3, false); + break; + case EVENT_SPELL_MARK_OF_HYDROSS4: + me->CastSpell(me, SPELL_MARK_OF_HYDROSS4, false); + break; + case EVENT_SPELL_MARK_OF_HYDROSS5: + me->CastSpell(me, SPELL_MARK_OF_HYDROSS5, false); + break; + case EVENT_SPELL_MARK_OF_HYDROSS6: + me->CastSpell(me, SPELL_MARK_OF_HYDROSS6, false); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_HYDROSS6, 15000, GROUP_ABILITIES); + break; + case EVENT_SPELL_MARK_OF_CORRUPTION1: + me->CastSpell(me, SPELL_MARK_OF_CORRUPTION1, false); + break; + case EVENT_SPELL_MARK_OF_CORRUPTION2: + me->CastSpell(me, SPELL_MARK_OF_CORRUPTION2, false); + break; + case EVENT_SPELL_MARK_OF_CORRUPTION3: + me->CastSpell(me, SPELL_MARK_OF_CORRUPTION3, false); + break; + case EVENT_SPELL_MARK_OF_CORRUPTION4: + me->CastSpell(me, SPELL_MARK_OF_CORRUPTION4, false); + break; + case EVENT_SPELL_MARK_OF_CORRUPTION5: + me->CastSpell(me, SPELL_MARK_OF_CORRUPTION5, false); + break; + case EVENT_SPELL_MARK_OF_CORRUPTION6: + me->CastSpell(me, SPELL_MARK_OF_CORRUPTION6, false); + events.ScheduleEvent(EVENT_SPELL_MARK_OF_CORRUPTION6, 15000, GROUP_ABILITIES); + break; + case EVENT_SPELL_WATER_TOMB: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) + me->CastSpell(target, SPELL_WATER_TOMB, false); + events.ScheduleEvent(EVENT_SPELL_WATER_TOMB, 7000, GROUP_ABILITIES); + break; + case EVENT_SPELL_VILE_SLUDGE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) + me->CastSpell(target, SPELL_VILE_SLUDGE, false); + events.ScheduleEvent(EVENT_SPELL_VILE_SLUDGE, 15000, GROUP_ABILITIES); + break; - } + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_hydross_cleansing_field_aura : public SpellScriptLoader { - public: - spell_hydross_cleansing_field_aura() : SpellScriptLoader("spell_hydross_cleansing_field_aura") { } + public: + spell_hydross_cleansing_field_aura() : SpellScriptLoader("spell_hydross_cleansing_field_aura") { } - class spell_hydross_cleansing_field_aura_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hydross_cleansing_field_aura_AuraScript) + class spell_hydross_cleansing_field_aura_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hydross_cleansing_field_aura_AuraScript) - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetTarget()->GetEntry() == NPC_HYDROSS_THE_UNSTABLE) - if (Unit* caster = GetCaster()) - caster->CastSpell(caster, SPELL_CLEANSING_FIELD, true); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTarget()->GetEntry() == NPC_HYDROSS_THE_UNSTABLE) + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, SPELL_CLEANSING_FIELD, true); + } - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetTarget()->GetEntry() == NPC_HYDROSS_THE_UNSTABLE) - if (Unit* caster = GetCaster()) - caster->CastSpell(caster, SPELL_CLEANSING_FIELD, true); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTarget()->GetEntry() == NPC_HYDROSS_THE_UNSTABLE) + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, SPELL_CLEANSING_FIELD, true); + } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_hydross_cleansing_field_aura_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_hydross_cleansing_field_aura_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_hydross_cleansing_field_aura_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_hydross_cleansing_field_aura_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_hydross_cleansing_field_aura_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_hydross_cleansing_field_aura_AuraScript(); + } }; class spell_hydross_cleansing_field_command : public SpellScriptLoader { - public: - spell_hydross_cleansing_field_command() : SpellScriptLoader("spell_hydross_cleansing_field_command") { } + public: + spell_hydross_cleansing_field_command() : SpellScriptLoader("spell_hydross_cleansing_field_command") { } - class spell_hydross_cleansing_field_command_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hydross_cleansing_field_command_AuraScript) + class spell_hydross_cleansing_field_command_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hydross_cleansing_field_command_AuraScript) - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetTarget()->HasUnitState(UNIT_STATE_CASTING)) - GetTarget()->InterruptNonMeleeSpells(false); - else - GetTarget()->CastSpell(GetTarget(), SPELL_BLUE_BEAM, true); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTarget()->HasUnitState(UNIT_STATE_CASTING)) + GetTarget()->InterruptNonMeleeSpells(false); + else + GetTarget()->CastSpell(GetTarget(), SPELL_BLUE_BEAM, true); + } - void Register() - { - AfterEffectRemove += AuraEffectApplyFn(spell_hydross_cleansing_field_command_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectApplyFn(spell_hydross_cleansing_field_command_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_hydross_cleansing_field_command_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_hydross_cleansing_field_command_AuraScript(); + } }; class spell_hydross_mark_of_hydross : public SpellScriptLoader { - public: - spell_hydross_mark_of_hydross() : SpellScriptLoader("spell_hydross_mark_of_hydross") { } + public: + spell_hydross_mark_of_hydross() : SpellScriptLoader("spell_hydross_mark_of_hydross") { } - class spell_hydross_mark_of_hydross_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hydross_mark_of_hydross_AuraScript) + class spell_hydross_mark_of_hydross_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hydross_mark_of_hydross_AuraScript) - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetCasterGUID(), GetAura()); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetCasterGUID(), GetAura()); + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_hydross_mark_of_hydross_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_hydross_mark_of_hydross_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_hydross_mark_of_hydross_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_hydross_mark_of_hydross_AuraScript(); + } }; void AddSC_boss_hydross_the_unstable() { new boss_hydross_the_unstable(); - new spell_hydross_cleansing_field_aura(); - new spell_hydross_cleansing_field_command(); - new spell_hydross_mark_of_hydross(); + new spell_hydross_cleansing_field_aura(); + new spell_hydross_cleansing_field_command(); + new spell_hydross_mark_of_hydross(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index b35f0f9c2..1905cd0ab 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -11,60 +11,60 @@ REWRITTEN BY XINEF enum Says { - SAY_INTRO = 0, - SAY_AGGRO = 1, - SAY_PHASE1 = 2, - SAY_PHASE2 = 3, - SAY_PHASE3 = 4, - SAY_BOWSHOT = 5, - SAY_SLAY = 6, - SAY_DEATH = 7 + SAY_INTRO = 0, + SAY_AGGRO = 1, + SAY_PHASE1 = 2, + SAY_PHASE2 = 3, + SAY_PHASE3 = 4, + SAY_BOWSHOT = 5, + SAY_SLAY = 6, + SAY_DEATH = 7 }; enum Spells { - SPELL_SHOOT = 37770, - SPELL_MULTI_SHOT = 38310, - SPELL_SHOCK_BLAST = 38509, - SPELL_STATIC_CHARGE = 38280, - SPELL_ENTANGLE = 38316, - SPELL_MAGIC_BARRIER = 38112, - SPELL_FORKED_LIGHTNING = 38145, + SPELL_SHOOT = 37770, + SPELL_MULTI_SHOT = 38310, + SPELL_SHOCK_BLAST = 38509, + SPELL_STATIC_CHARGE = 38280, + SPELL_ENTANGLE = 38316, + SPELL_MAGIC_BARRIER = 38112, + SPELL_FORKED_LIGHTNING = 38145, - SPELL_SUMMON_ENCHANTED_ELEMENTAL= 38017, - SPELL_SUMMON_COILFANG_ELITE = 38248, - SPELL_SUMMON_COILFANG_STRIDER = 38241, - SPELL_SUMMON_TAINTED_ELEMENTAL = 38140, - SPELL_SURGE = 38044, + SPELL_SUMMON_ENCHANTED_ELEMENTAL= 38017, + SPELL_SUMMON_COILFANG_ELITE = 38248, + SPELL_SUMMON_COILFANG_STRIDER = 38241, + SPELL_SUMMON_TAINTED_ELEMENTAL = 38140, + SPELL_SURGE = 38044, - SPELL_REMOVE_TAINTED_CORES = 39495, - SPELL_SUMMON_TOXIC_SPOREBAT = 38494, - SPELL_SUMMON_SPOREBAT1 = 38489, - SPELL_SUMMON_SPOREBAT2 = 38490, - SPELL_SUMMON_SPOREBAT3 = 38492, - SPELL_SUMMON_SPOREBAT4 = 38493, - SPELL_TOXIC_SPORES = 38574 + SPELL_REMOVE_TAINTED_CORES = 39495, + SPELL_SUMMON_TOXIC_SPOREBAT = 38494, + SPELL_SUMMON_SPOREBAT1 = 38489, + SPELL_SUMMON_SPOREBAT2 = 38490, + SPELL_SUMMON_SPOREBAT3 = 38492, + SPELL_SUMMON_SPOREBAT4 = 38493, + SPELL_TOXIC_SPORES = 38574 }; enum Misc { - ITEM_TAINTED_CORE = 31088, + ITEM_TAINTED_CORE = 31088, - POINT_HOME = 1, + POINT_HOME = 1, - EVENT_SPELL_SHOCK_BLAST = 1, - EVENT_SPELL_STATIC_CHARGE = 2, - EVENT_SPELL_ENTANGLE = 3, - EVENT_CHECK_HEALTH = 4, - EVENT_SPELL_FORKED_LIGHTNING = 5, - EVENT_SUMMON_A = 6, - EVENT_SUMMON_B = 7, - EVENT_SUMMON_C = 8, - EVENT_SUMMON_D = 9, - EVENT_CHECK_HEALTH2 = 10, - EVENT_SUMMON_SPOREBAT = 11, + EVENT_SPELL_SHOCK_BLAST = 1, + EVENT_SPELL_STATIC_CHARGE = 2, + EVENT_SPELL_ENTANGLE = 3, + EVENT_CHECK_HEALTH = 4, + EVENT_SPELL_FORKED_LIGHTNING = 5, + EVENT_SUMMON_A = 6, + EVENT_SUMMON_B = 7, + EVENT_SUMMON_C = 8, + EVENT_SUMMON_D = 9, + EVENT_CHECK_HEALTH2 = 10, + EVENT_SUMMON_SPOREBAT = 11, - EVENT_KILL_TALK = 20 + EVENT_KILL_TALK = 20 }; class startFollow : public BasicEvent @@ -74,9 +74,9 @@ class startFollow : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - if (InstanceScript* instance = _owner->GetInstanceScript()) - if (Creature* vashj = ObjectAccessor::GetCreature(*_owner, instance->GetData64(NPC_LADY_VASHJ))) - _owner->GetMotionMaster()->MoveFollow(vashj, 3.0f, vashj->GetAngle(_owner), MOTION_SLOT_CONTROLLED); + if (InstanceScript* instance = _owner->GetInstanceScript()) + if (Creature* vashj = ObjectAccessor::GetCreature(*_owner, instance->GetData64(NPC_LADY_VASHJ))) + _owner->GetMotionMaster()->MoveFollow(vashj, 3.0f, vashj->GetAngle(_owner), MOTION_SLOT_CONTROLLED); return true; } @@ -86,200 +86,200 @@ class startFollow : public BasicEvent class boss_lady_vashj : public CreatureScript { - public: - boss_lady_vashj() : CreatureScript("boss_lady_vashj") { } + public: + boss_lady_vashj() : CreatureScript("boss_lady_vashj") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_lady_vashjAI : public BossAI - { - boss_lady_vashjAI(Creature* creature) : BossAI(creature, DATA_LADY_VASHJ) - { - intro = false; - } + struct boss_lady_vashjAI : public BossAI + { + boss_lady_vashjAI(Creature* creature) : BossAI(creature, DATA_LADY_VASHJ) + { + intro = false; + } - bool intro; - int32 count; + bool intro; + int32 count; - void Reset() - { - count = 0; - BossAI::Reset(); - } + void Reset() + { + count = 0; + BossAI::Reset(); + } - void KilledUnit(Unit* /*victim*/) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* /*victim*/) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); - me->CastSpell(me, SPELL_REMOVE_TAINTED_CORES, true); - events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, 10000); - events.ScheduleEvent(EVENT_SPELL_STATIC_CHARGE, 15000); - events.ScheduleEvent(EVENT_SPELL_ENTANGLE, 20000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - } + me->CastSpell(me, SPELL_REMOVE_TAINTED_CORES, true); + events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, 10000); + events.ScheduleEvent(EVENT_SPELL_STATIC_CHARGE, 15000); + events.ScheduleEvent(EVENT_SPELL_ENTANGLE, 20000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() == WORLD_TRIGGER) - summon->CastSpell(summon, SPELL_MAGIC_BARRIER, false); - else if (summon->GetEntry() == NPC_ENCHANTED_ELEMENTAL) - { - summon->SetWalk(true); - summon->m_Events.AddEvent(new startFollow(summon), summon->m_Events.CalculateTime(0)); - } - else if (summon->GetEntry() == NPC_TOXIC_SPOREBAT) - summon->GetMotionMaster()->MoveRandom(30.0f); - else if (summon->GetEntry() != NPC_TAINTED_ELEMENTAL) - summon->GetMotionMaster()->MovePoint(POINT_HOME, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), true, true); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() == WORLD_TRIGGER) + summon->CastSpell(summon, SPELL_MAGIC_BARRIER, false); + else if (summon->GetEntry() == NPC_ENCHANTED_ELEMENTAL) + { + summon->SetWalk(true); + summon->m_Events.AddEvent(new startFollow(summon), summon->m_Events.CalculateTime(0)); + } + else if (summon->GetEntry() == NPC_TOXIC_SPOREBAT) + summon->GetMotionMaster()->MoveRandom(30.0f); + else if (summon->GetEntry() != NPC_TAINTED_ELEMENTAL) + summon->GetMotionMaster()->MovePoint(POINT_HOME, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), true, true); + } - void MoveInLineOfSight(Unit* who) - { - if (!intro && who->GetTypeId() == TYPEID_PLAYER) - { - intro = true; - Talk(SAY_INTRO); - } + void MoveInLineOfSight(Unit* who) + { + if (!intro && who->GetTypeId() == TYPEID_PLAYER) + { + intro = true; + Talk(SAY_INTRO); + } - BossAI::MoveInLineOfSight(who); - } + BossAI::MoveInLineOfSight(who); + } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE || id != POINT_HOME) - return; + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE || id != POINT_HOME) + return; - me->SetFacingTo(me->GetHomePosition().GetOrientation()); - instance->SetData(DATA_ACTIVATE_SHIELD, 0); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_FORKED_LIGHTNING, 3000); - events.ScheduleEvent(EVENT_SUMMON_A, 0); - events.ScheduleEvent(EVENT_SUMMON_B, 45000); - events.ScheduleEvent(EVENT_SUMMON_C, 60000); - events.ScheduleEvent(EVENT_SUMMON_D, 50000); - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - } + me->SetFacingTo(me->GetHomePosition().GetOrientation()); + instance->SetData(DATA_ACTIVATE_SHIELD, 0); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_FORKED_LIGHTNING, 3000); + events.ScheduleEvent(EVENT_SUMMON_A, 0); + events.ScheduleEvent(EVENT_SUMMON_B, 45000); + events.ScheduleEvent(EVENT_SUMMON_C, 60000); + events.ScheduleEvent(EVENT_SUMMON_D, 50000); + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + } - void UpdateAI(uint32 diff) - { + void UpdateAI(uint32 diff) + { EnterEvadeIfOutOfCombatArea(); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_SHOCK_BLAST: - me->CastSpell(me->GetVictim(), SPELL_SHOCK_BLAST, false); - events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, urand(10000, 20000)); - break; - case EVENT_SPELL_STATIC_CHARGE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f)) - me->CastSpell(target, SPELL_STATIC_CHARGE, false); - events.ScheduleEvent(EVENT_SPELL_STATIC_CHARGE, 20000); - break; - case EVENT_SPELL_ENTANGLE: - me->CastSpell(me, SPELL_ENTANGLE, false); - events.ScheduleEvent(EVENT_SPELL_ENTANGLE, 30000); - break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(71)) - { - Talk(SAY_PHASE2); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MovePoint(POINT_HOME, me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ(), true, true); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_SPELL_FORKED_LIGHTNING: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f)) - me->CastSpell(target, SPELL_FORKED_LIGHTNING, false); - events.ScheduleEvent(EVENT_SPELL_FORKED_LIGHTNING, urand(2500, 5000)); - break; - case EVENT_SUMMON_A: - me->CastSpell(me, SPELL_SUMMON_ENCHANTED_ELEMENTAL, true); - events.ScheduleEvent(EVENT_SUMMON_A, 2500); - break; - case EVENT_SUMMON_B: - me->CastSpell(me, SPELL_SUMMON_COILFANG_ELITE, true); - events.ScheduleEvent(EVENT_SUMMON_B, 45000); - break; - case EVENT_SUMMON_C: - me->CastSpell(me, SPELL_SUMMON_COILFANG_STRIDER, true); - events.ScheduleEvent(EVENT_SUMMON_C, 60000); - break; - case EVENT_SUMMON_D: - me->CastSpell(me, SPELL_SUMMON_TAINTED_ELEMENTAL, true); - events.ScheduleEvent(EVENT_SUMMON_D, 50000); - break; - case EVENT_CHECK_HEALTH2: - if (!me->HasAura(SPELL_MAGIC_BARRIER)) - { - Talk(SAY_PHASE3); - me->SetReactState(REACT_AGGRESSIVE); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, 10000); - events.ScheduleEvent(EVENT_SPELL_STATIC_CHARGE, 15000); - events.ScheduleEvent(EVENT_SPELL_ENTANGLE, 20000); - events.ScheduleEvent(EVENT_SUMMON_SPOREBAT, 5000); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); - break; - case EVENT_SUMMON_SPOREBAT: - me->CastSpell(me, SPELL_SUMMON_TOXIC_SPOREBAT, true); - events.ScheduleEvent(EVENT_SUMMON_SPOREBAT, 20000 - 1000*std::min(count++, 16)); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_SHOCK_BLAST: + me->CastSpell(me->GetVictim(), SPELL_SHOCK_BLAST, false); + events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, urand(10000, 20000)); + break; + case EVENT_SPELL_STATIC_CHARGE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f)) + me->CastSpell(target, SPELL_STATIC_CHARGE, false); + events.ScheduleEvent(EVENT_SPELL_STATIC_CHARGE, 20000); + break; + case EVENT_SPELL_ENTANGLE: + me->CastSpell(me, SPELL_ENTANGLE, false); + events.ScheduleEvent(EVENT_SPELL_ENTANGLE, 30000); + break; + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(71)) + { + Talk(SAY_PHASE2); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MovePoint(POINT_HOME, me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ(), true, true); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_SPELL_FORKED_LIGHTNING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f)) + me->CastSpell(target, SPELL_FORKED_LIGHTNING, false); + events.ScheduleEvent(EVENT_SPELL_FORKED_LIGHTNING, urand(2500, 5000)); + break; + case EVENT_SUMMON_A: + me->CastSpell(me, SPELL_SUMMON_ENCHANTED_ELEMENTAL, true); + events.ScheduleEvent(EVENT_SUMMON_A, 2500); + break; + case EVENT_SUMMON_B: + me->CastSpell(me, SPELL_SUMMON_COILFANG_ELITE, true); + events.ScheduleEvent(EVENT_SUMMON_B, 45000); + break; + case EVENT_SUMMON_C: + me->CastSpell(me, SPELL_SUMMON_COILFANG_STRIDER, true); + events.ScheduleEvent(EVENT_SUMMON_C, 60000); + break; + case EVENT_SUMMON_D: + me->CastSpell(me, SPELL_SUMMON_TAINTED_ELEMENTAL, true); + events.ScheduleEvent(EVENT_SUMMON_D, 50000); + break; + case EVENT_CHECK_HEALTH2: + if (!me->HasAura(SPELL_MAGIC_BARRIER)) + { + Talk(SAY_PHASE3); + me->SetReactState(REACT_AGGRESSIVE); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, 10000); + events.ScheduleEvent(EVENT_SPELL_STATIC_CHARGE, 15000); + events.ScheduleEvent(EVENT_SPELL_ENTANGLE, 20000); + events.ScheduleEvent(EVENT_SUMMON_SPOREBAT, 5000); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000); + break; + case EVENT_SUMMON_SPOREBAT: + me->CastSpell(me, SPELL_SUMMON_TOXIC_SPOREBAT, true); + events.ScheduleEvent(EVENT_SUMMON_SPOREBAT, 20000 - 1000*std::min(count++, 16)); + break; + } - if (me->GetReactState() != REACT_AGGRESSIVE || !me->isAttackReady()) - return; + if (me->GetReactState() != REACT_AGGRESSIVE || !me->isAttackReady()) + return; - if (!me->IsWithinMeleeRange(me->GetVictim())) - { - me->resetAttackTimer(); - me->SetSheath(SHEATH_STATE_RANGED); - me->CastSpell(me->GetVictim(), roll_chance_i(33) ? SPELL_MULTI_SHOT : SPELL_SHOOT, false); - if (roll_chance_i(15)) - Talk(SAY_BOWSHOT); - } - else - { - me->SetSheath(SHEATH_STATE_MELEE); - DoMeleeAttackIfReady(); - } - } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetHomePosition().GetExactDist2d(me) > 80.0f || !SelectTargetFromPlayerList(100.0f); - } - }; + if (!me->IsWithinMeleeRange(me->GetVictim())) + { + me->resetAttackTimer(); + me->SetSheath(SHEATH_STATE_RANGED); + me->CastSpell(me->GetVictim(), roll_chance_i(33) ? SPELL_MULTI_SHOT : SPELL_SHOOT, false); + if (roll_chance_i(15)) + Talk(SAY_BOWSHOT); + } + else + { + me->SetSheath(SHEATH_STATE_MELEE); + DoMeleeAttackIfReady(); + } + } + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetHomePosition().GetExactDist2d(me) > 80.0f || !SelectTargetFromPlayerList(100.0f); + } + }; }; /* @@ -384,118 +384,118 @@ public: class spell_lady_vashj_magic_barrier : public SpellScriptLoader { - public: - spell_lady_vashj_magic_barrier() : SpellScriptLoader("spell_lady_vashj_magic_barrier") { } + public: + spell_lady_vashj_magic_barrier() : SpellScriptLoader("spell_lady_vashj_magic_barrier") { } - class spell_lady_vashj_magic_barrier_AuraScript : public AuraScript - { - PrepareAuraScript(spell_lady_vashj_magic_barrier_AuraScript) + class spell_lady_vashj_magic_barrier_AuraScript : public AuraScript + { + PrepareAuraScript(spell_lady_vashj_magic_barrier_AuraScript) - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - Unit::DealDamage(GetTarget(), GetTarget(), GetTarget()->CountPctFromMaxHealth(5)); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + Unit::DealDamage(GetTarget(), GetTarget(), GetTarget()->CountPctFromMaxHealth(5)); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_lady_vashj_magic_barrier_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_SCHOOL_IMMUNITY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_lady_vashj_magic_barrier_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_SCHOOL_IMMUNITY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_lady_vashj_magic_barrier_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_lady_vashj_magic_barrier_AuraScript(); + } }; class spell_lady_vashj_remove_tainted_cores : public SpellScriptLoader { - public: - spell_lady_vashj_remove_tainted_cores() : SpellScriptLoader("spell_lady_vashj_remove_tainted_cores") { } + public: + spell_lady_vashj_remove_tainted_cores() : SpellScriptLoader("spell_lady_vashj_remove_tainted_cores") { } - class spell_lady_vashj_remove_tainted_cores_SpellScript : public SpellScript - { - PrepareSpellScript(spell_lady_vashj_remove_tainted_cores_SpellScript); + class spell_lady_vashj_remove_tainted_cores_SpellScript : public SpellScript + { + PrepareSpellScript(spell_lady_vashj_remove_tainted_cores_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Player* target = GetHitPlayer()) - target->DestroyItemCount(ITEM_TAINTED_CORE, -1, true); - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Player* target = GetHitPlayer()) + target->DestroyItemCount(ITEM_TAINTED_CORE, -1, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_lady_vashj_remove_tainted_cores_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_lady_vashj_remove_tainted_cores_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_lady_vashj_remove_tainted_cores_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_lady_vashj_remove_tainted_cores_SpellScript(); + } }; class spell_lady_vashj_summon_sporebat : public SpellScriptLoader { - public: - spell_lady_vashj_summon_sporebat() : SpellScriptLoader("spell_lady_vashj_summon_sporebat") { } + public: + spell_lady_vashj_summon_sporebat() : SpellScriptLoader("spell_lady_vashj_summon_sporebat") { } - class spell_lady_vashj_summon_sporebat_SpellScript : public SpellScript - { - PrepareSpellScript(spell_lady_vashj_summon_sporebat_SpellScript); + class spell_lady_vashj_summon_sporebat_SpellScript : public SpellScript + { + PrepareSpellScript(spell_lady_vashj_summon_sporebat_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster()->CastSpell(GetCaster(), RAND(SPELL_SUMMON_SPOREBAT1, SPELL_SUMMON_SPOREBAT2, SPELL_SUMMON_SPOREBAT3, SPELL_SUMMON_SPOREBAT4), true); - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetCaster()->CastSpell(GetCaster(), RAND(SPELL_SUMMON_SPOREBAT1, SPELL_SUMMON_SPOREBAT2, SPELL_SUMMON_SPOREBAT3, SPELL_SUMMON_SPOREBAT4), true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_lady_vashj_summon_sporebat_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_lady_vashj_summon_sporebat_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_lady_vashj_summon_sporebat_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_lady_vashj_summon_sporebat_SpellScript(); + } }; class spell_lady_vashj_spore_drop_effect : public SpellScriptLoader { - public: - spell_lady_vashj_spore_drop_effect() : SpellScriptLoader("spell_lady_vashj_spore_drop_effect") { } + public: + spell_lady_vashj_spore_drop_effect() : SpellScriptLoader("spell_lady_vashj_spore_drop_effect") { } - class spell_lady_vashj_spore_drop_effect_SpellScript : public SpellScript - { - PrepareSpellScript(spell_lady_vashj_spore_drop_effect_SpellScript); + class spell_lady_vashj_spore_drop_effect_SpellScript : public SpellScript + { + PrepareSpellScript(spell_lady_vashj_spore_drop_effect_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(target, SPELL_TOXIC_SPORES, true, NULL, NULL, GetCaster()->GetGUID()); - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, SPELL_TOXIC_SPORES, true, NULL, NULL, GetCaster()->GetGUID()); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_lady_vashj_spore_drop_effect_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_lady_vashj_spore_drop_effect_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_lady_vashj_spore_drop_effect_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_lady_vashj_spore_drop_effect_SpellScript(); + } }; void AddSC_boss_lady_vashj() { new boss_lady_vashj(); - new spell_lady_vashj_magic_barrier(); - new spell_lady_vashj_remove_tainted_cores(); - new spell_lady_vashj_summon_sporebat(); - new spell_lady_vashj_spore_drop_effect(); + new spell_lady_vashj_magic_barrier(); + new spell_lady_vashj_remove_tainted_cores(); + new spell_lady_vashj_summon_sporebat(); + new spell_lady_vashj_spore_drop_effect(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 353bbb410..9ee5df353 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -9,385 +9,385 @@ REWRITTEN BY XINEF enum Talk { - SAY_AGGRO = 0, - SAY_SWITCH_TO_DEMON = 1, - SAY_INNER_DEMONS = 2, - SAY_DEMON_SLAY = 3, - SAY_NIGHTELF_SLAY = 4, - SAY_FINAL_FORM = 5, - SAY_DEATH = 6 + SAY_AGGRO = 0, + SAY_SWITCH_TO_DEMON = 1, + SAY_INNER_DEMONS = 2, + SAY_DEMON_SLAY = 3, + SAY_NIGHTELF_SLAY = 4, + SAY_FINAL_FORM = 5, + SAY_DEATH = 6 }; enum Spells { - SPELL_DUAL_WIELD = 42459, - SPELL_BANISH = 37546, - SPELL_TAUNT = 37548, - SPELL_BERSERK = 26662, - SPELL_WHIRLWIND = 37640, - SPELL_SUMMON_SHADOW_OF_LEOTHERAS = 37781, + SPELL_DUAL_WIELD = 42459, + SPELL_BANISH = 37546, + SPELL_TAUNT = 37548, + SPELL_BERSERK = 26662, + SPELL_WHIRLWIND = 37640, + SPELL_SUMMON_SHADOW_OF_LEOTHERAS = 37781, - // Demon Form - SPELL_CHAOS_BLAST = 37674, - SPELL_CHAOS_BLAST_TRIGGER = 37675, - SPELL_INSIDIOUS_WHISPER = 37676, - SPELL_METAMORPHOSIS = 37673, - SPELL_SUMMON_INNER_DEMON = 37735, - SPELL_CONSUMING_MADNESS = 37749, + // Demon Form + SPELL_CHAOS_BLAST = 37674, + SPELL_CHAOS_BLAST_TRIGGER = 37675, + SPELL_INSIDIOUS_WHISPER = 37676, + SPELL_METAMORPHOSIS = 37673, + SPELL_SUMMON_INNER_DEMON = 37735, + SPELL_CONSUMING_MADNESS = 37749, - // Other - SPELL_CLEAR_CONSUMING_MADNESS = 37750, - SPELL_SHADOW_BOLT = 39309 + // Other + SPELL_CLEAR_CONSUMING_MADNESS = 37750, + SPELL_SHADOW_BOLT = 39309 }; enum Misc { - MAX_CHANNELERS = 3, + MAX_CHANNELERS = 3, - NPC_GREYHEART_SPELLBINDER = 21806, - NPC_SHADOW_OF_LEOTHERAS = 21875, + NPC_GREYHEART_SPELLBINDER = 21806, + NPC_SHADOW_OF_LEOTHERAS = 21875, - EVENT_SPELL_BERSERK = 1, - EVENT_HEALTH_CHECK = 2, - EVENT_SWITCH_TO_DEMON = 3, - EVENT_SPELL_WHIRLWIND = 4, - EVENT_KILL_TALK = 5, - EVENT_SWITCH_TO_ELF = 6, - EVENT_SPELL_INSIDIOUS_WHISPER = 7, - EVENT_SUMMON_DEMON = 8, - EVENT_RESTORE_FIGHT = 9, + EVENT_SPELL_BERSERK = 1, + EVENT_HEALTH_CHECK = 2, + EVENT_SWITCH_TO_DEMON = 3, + EVENT_SPELL_WHIRLWIND = 4, + EVENT_KILL_TALK = 5, + EVENT_SWITCH_TO_ELF = 6, + EVENT_SPELL_INSIDIOUS_WHISPER = 7, + EVENT_SUMMON_DEMON = 8, + EVENT_RESTORE_FIGHT = 9, - EVENT_SPELL_SHADOW_BOLT = 20 + EVENT_SPELL_SHADOW_BOLT = 20 }; const Position channelersPos[MAX_CHANNELERS] = { - {367.11f, -421.48f, 29.52f, 5.0f}, - {380.11f, -435.48f, 29.52f, 2.5f}, - {362.11f, -437.48f, 29.52f, 0.9f} + {367.11f, -421.48f, 29.52f, 5.0f}, + {380.11f, -435.48f, 29.52f, 2.5f}, + {362.11f, -437.48f, 29.52f, 0.9f} }; class boss_leotheras_the_blind : public CreatureScript { - public: - boss_leotheras_the_blind() : CreatureScript("boss_leotheras_the_blind") { } + public: + boss_leotheras_the_blind() : CreatureScript("boss_leotheras_the_blind") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_leotheras_the_blindAI : public BossAI - { - boss_leotheras_the_blindAI(Creature* creature) : BossAI(creature, DATA_LEOTHERAS_THE_BLIND) - { - } + struct boss_leotheras_the_blindAI : public BossAI + { + boss_leotheras_the_blindAI(Creature* creature) : BossAI(creature, DATA_LEOTHERAS_THE_BLIND) + { + } - void Reset() - { - BossAI::Reset(); - me->CastSpell(me, SPELL_CLEAR_CONSUMING_MADNESS, true); - me->CastSpell(me, SPELL_DUAL_WIELD, true); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->LoadEquipment(0, true); - me->SetReactState(REACT_PASSIVE); - } + void Reset() + { + BossAI::Reset(); + me->CastSpell(me, SPELL_CLEAR_CONSUMING_MADNESS, true); + me->CastSpell(me, SPELL_DUAL_WIELD, true); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->LoadEquipment(0, true); + me->SetReactState(REACT_PASSIVE); + } - void InitializeAI() - { - BossAI::InitializeAI(); - SummonChannelers(); - } + void InitializeAI() + { + BossAI::InitializeAI(); + SummonChannelers(); + } - void JustReachedHome() - { - BossAI::JustReachedHome(); - SummonChannelers(); - } + void JustReachedHome() + { + BossAI::JustReachedHome(); + SummonChannelers(); + } - void SummonChannelers() - { - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, false); - me->CastSpell(me, SPELL_BANISH, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, true); + void SummonChannelers() + { + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, false); + me->CastSpell(me, SPELL_BANISH, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, true); - summons.DespawnAll(); - for (uint8 i = 0; i < MAX_CHANNELERS; ++i) - me->SummonCreature(NPC_GREYHEART_SPELLBINDER, channelersPos[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - } + summons.DespawnAll(); + for (uint8 i = 0; i < MAX_CHANNELERS; ++i) + me->SummonCreature(NPC_GREYHEART_SPELLBINDER, channelersPos[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + } - void MoveInLineOfSight(Unit* who) { } + void MoveInLineOfSight(Unit* who) { } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - me->SetInCombatWithZone(); - summons.Despawn(summon); - if (summon->GetEntry() == NPC_GREYHEART_SPELLBINDER) - if (!summons.HasEntry(NPC_GREYHEART_SPELLBINDER)) - { - me->RemoveAllAuras(); - me->LoadEquipment(); - me->SetReactState(REACT_AGGRESSIVE); - me->SetStandState(UNIT_STAND_STATE_STAND); - Talk(SAY_AGGRO); + void SummonedCreatureDies(Creature* summon, Unit*) + { + me->SetInCombatWithZone(); + summons.Despawn(summon); + if (summon->GetEntry() == NPC_GREYHEART_SPELLBINDER) + if (!summons.HasEntry(NPC_GREYHEART_SPELLBINDER)) + { + me->RemoveAllAuras(); + me->LoadEquipment(); + me->SetReactState(REACT_AGGRESSIVE); + me->SetStandState(UNIT_STAND_STATE_STAND); + Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); - events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); - events.ScheduleEvent(EVENT_SWITCH_TO_DEMON, 55000); - events.ScheduleEvent(EVENT_SPELL_WHIRLWIND, 10000); - } - } + events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); + events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); + events.ScheduleEvent(EVENT_SWITCH_TO_DEMON, 55000); + events.ScheduleEvent(EVENT_SPELL_WHIRLWIND, 10000); + } + } - void KilledUnit(Unit* victim) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(me->GetDisplayId() != me->GetNativeDisplayId() ? SAY_DEMON_SLAY : SAY_NIGHTELF_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit* victim) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(me->GetDisplayId() != me->GetNativeDisplayId() ? SAY_DEMON_SLAY : SAY_NIGHTELF_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustDied(Unit* killer) - { - me->CastSpell(me, SPELL_CLEAR_CONSUMING_MADNESS, true); - Talk(SAY_DEATH); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + me->CastSpell(me, SPELL_CLEAR_CONSUMING_MADNESS, true); + Talk(SAY_DEATH); + BossAI::JustDied(killer); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - } + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + } - void AttackStart(Unit* who) - { - if (who && me->Attack(who, true)) - me->GetMotionMaster()->MoveChase(who, me->GetDisplayId() == me->GetNativeDisplayId() ? 0.0f : 25.0f); - } + void AttackStart(Unit* who) + { + if (who && me->Attack(who, true)) + me->GetMotionMaster()->MoveChase(who, me->GetDisplayId() == me->GetNativeDisplayId() ? 0.0f : 25.0f); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_HEALTH_CHECK: - if (me->HealthBelowPct(15)) - { - if (me->GetDisplayId() != me->GetNativeDisplayId()) - { - DoResetThreat(); - me->LoadEquipment(); - me->RemoveAurasDueToSpell(SPELL_METAMORPHOSIS); - events.ScheduleEvent(EVENT_SPELL_WHIRLWIND, 10000); - } - events.CancelEvent(EVENT_SWITCH_TO_DEMON); - events.CancelEvent(EVENT_SPELL_INSIDIOUS_WHISPER); - events.DelayEvents(10000); - events.ScheduleEvent(EVENT_SUMMON_DEMON, 4000); - events.ScheduleEvent(EVENT_RESTORE_FIGHT, 6000); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->Clear(); - me->StopMoving(); - Talk(SAY_FINAL_FORM); - break; - } - events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); - break; - case EVENT_SWITCH_TO_DEMON: - DoResetThreat(); - Talk(SAY_SWITCH_TO_DEMON); - me->LoadEquipment(0, true); - me->GetMotionMaster()->MoveChase(me->GetVictim(), 25.0f); - me->CastSpell(me, SPELL_METAMORPHOSIS, true); + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_HEALTH_CHECK: + if (me->HealthBelowPct(15)) + { + if (me->GetDisplayId() != me->GetNativeDisplayId()) + { + DoResetThreat(); + me->LoadEquipment(); + me->RemoveAurasDueToSpell(SPELL_METAMORPHOSIS); + events.ScheduleEvent(EVENT_SPELL_WHIRLWIND, 10000); + } + events.CancelEvent(EVENT_SWITCH_TO_DEMON); + events.CancelEvent(EVENT_SPELL_INSIDIOUS_WHISPER); + events.DelayEvents(10000); + events.ScheduleEvent(EVENT_SUMMON_DEMON, 4000); + events.ScheduleEvent(EVENT_RESTORE_FIGHT, 6000); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->Clear(); + me->StopMoving(); + Talk(SAY_FINAL_FORM); + break; + } + events.ScheduleEvent(EVENT_HEALTH_CHECK, 1000); + break; + case EVENT_SWITCH_TO_DEMON: + DoResetThreat(); + Talk(SAY_SWITCH_TO_DEMON); + me->LoadEquipment(0, true); + me->GetMotionMaster()->MoveChase(me->GetVictim(), 25.0f); + me->CastSpell(me, SPELL_METAMORPHOSIS, true); - events.CancelEvent(EVENT_SPELL_WHIRLWIND); - events.ScheduleEvent(EVENT_SPELL_INSIDIOUS_WHISPER, 25000); - events.ScheduleEvent(EVENT_SWITCH_TO_ELF, 60000); - break; - case EVENT_SWITCH_TO_ELF: - DoResetThreat(); - me->LoadEquipment(); - me->GetMotionMaster()->MoveChase(me->GetVictim(), 0.0f); - me->RemoveAurasDueToSpell(SPELL_METAMORPHOSIS); - events.ScheduleEvent(EVENT_SWITCH_TO_DEMON, 55000); - events.ScheduleEvent(EVENT_SPELL_WHIRLWIND, 10000); - break; - case EVENT_SPELL_WHIRLWIND: - me->CastSpell(me, SPELL_WHIRLWIND, false); - events.ScheduleEvent(EVENT_SPELL_WHIRLWIND, 27000); - break; - case EVENT_SPELL_INSIDIOUS_WHISPER: - Talk(SAY_INNER_DEMONS); - me->CastCustomSpell(SPELL_INSIDIOUS_WHISPER, SPELLVALUE_MAX_TARGETS, 5, me, false); - break; - case EVENT_SUMMON_DEMON: - me->CastSpell(me, SPELL_SUMMON_SHADOW_OF_LEOTHERAS, true); - break; - case EVENT_RESTORE_FIGHT: - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetReactState(REACT_AGGRESSIVE); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - break; - } + events.CancelEvent(EVENT_SPELL_WHIRLWIND); + events.ScheduleEvent(EVENT_SPELL_INSIDIOUS_WHISPER, 25000); + events.ScheduleEvent(EVENT_SWITCH_TO_ELF, 60000); + break; + case EVENT_SWITCH_TO_ELF: + DoResetThreat(); + me->LoadEquipment(); + me->GetMotionMaster()->MoveChase(me->GetVictim(), 0.0f); + me->RemoveAurasDueToSpell(SPELL_METAMORPHOSIS); + events.ScheduleEvent(EVENT_SWITCH_TO_DEMON, 55000); + events.ScheduleEvent(EVENT_SPELL_WHIRLWIND, 10000); + break; + case EVENT_SPELL_WHIRLWIND: + me->CastSpell(me, SPELL_WHIRLWIND, false); + events.ScheduleEvent(EVENT_SPELL_WHIRLWIND, 27000); + break; + case EVENT_SPELL_INSIDIOUS_WHISPER: + Talk(SAY_INNER_DEMONS); + me->CastCustomSpell(SPELL_INSIDIOUS_WHISPER, SPELLVALUE_MAX_TARGETS, 5, me, false); + break; + case EVENT_SUMMON_DEMON: + me->CastSpell(me, SPELL_SUMMON_SHADOW_OF_LEOTHERAS, true); + break; + case EVENT_RESTORE_FIGHT: + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetReactState(REACT_AGGRESSIVE); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + break; + } - if (me->GetDisplayId() == me->GetNativeDisplayId()) - DoMeleeAttackIfReady(); - else if (me->isAttackReady(BASE_ATTACK)) - { - me->CastSpell(me->GetVictim(), SPELL_CHAOS_BLAST, false); - me->setAttackTimer(BASE_ATTACK, 2000); - } - } - }; + if (me->GetDisplayId() == me->GetNativeDisplayId()) + DoMeleeAttackIfReady(); + else if (me->isAttackReady(BASE_ATTACK)) + { + me->CastSpell(me->GetVictim(), SPELL_CHAOS_BLAST, false); + me->setAttackTimer(BASE_ATTACK, 2000); + } + } + }; }; class npc_inner_demon : public CreatureScript { - public: - npc_inner_demon() : CreatureScript("npc_inner_demon") { } + public: + npc_inner_demon() : CreatureScript("npc_inner_demon") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_inner_demonAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_inner_demonAI(creature); + } - struct npc_inner_demonAI : public ScriptedAI - { - npc_inner_demonAI(Creature* creature) : ScriptedAI(creature) - { - } + struct npc_inner_demonAI : public ScriptedAI + { + npc_inner_demonAI(Creature* creature) : ScriptedAI(creature) + { + } - uint64 ownerGUID; - EventMap events; + uint64 ownerGUID; + EventMap events; - void EnterEvadeMode() - { - me->DespawnOrUnsummon(1); - } + void EnterEvadeMode() + { + me->DespawnOrUnsummon(1); + } - void IsSummonedBy(Unit* summoner) - { - if (!summoner) - return; + void IsSummonedBy(Unit* summoner) + { + if (!summoner) + return; - ownerGUID = summoner->GetGUID(); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 4000); - } + ownerGUID = summoner->GetGUID(); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 4000); + } - void JustDied(Unit* /*killer*/) - { - if (Unit* unit = ObjectAccessor::GetUnit(*me, ownerGUID)) - unit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); - } + void JustDied(Unit* /*killer*/) + { + if (Unit* unit = ObjectAccessor::GetUnit(*me, ownerGUID)) + unit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); + } - void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (!who || who->GetGUID() != ownerGUID) - damage = 0; - } + void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (!who || who->GetGUID() != ownerGUID) + damage = 0; + } - bool CanAIAttack(const Unit* who) const - { - return who->GetGUID() == ownerGUID; - } + bool CanAIAttack(const Unit* who) const + { + return who->GetGUID() == ownerGUID; + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_SHADOW_BOLT: - me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 6000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_SHADOW_BOLT: + me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, 6000); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_leotheras_whirlwind : public SpellScriptLoader { - public: - spell_leotheras_whirlwind() : SpellScriptLoader("spell_leotheras_whirlwind") { } + public: + spell_leotheras_whirlwind() : SpellScriptLoader("spell_leotheras_whirlwind") { } - class spell_leotheras_whirlwind_SpellScript : public SpellScript - { - PrepareSpellScript(spell_leotheras_whirlwind_SpellScript); + class spell_leotheras_whirlwind_SpellScript : public SpellScript + { + PrepareSpellScript(spell_leotheras_whirlwind_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster()->getThreatManager().resetAllAggro(); + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetCaster()->getThreatManager().resetAllAggro(); - if (roll_chance_i(33)) - if (Unit* target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) - target->CastSpell(GetCaster(), SPELL_TAUNT, true); + if (roll_chance_i(33)) + if (Unit* target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + target->CastSpell(GetCaster(), SPELL_TAUNT, true); - } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_leotheras_whirlwind_SpellScript::HandleScriptEffect, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_leotheras_whirlwind_SpellScript::HandleScriptEffect, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_leotheras_whirlwind_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_leotheras_whirlwind_SpellScript(); + } }; class spell_leotheras_chaos_blast : public SpellScriptLoader { - public: - spell_leotheras_chaos_blast() : SpellScriptLoader("spell_leotheras_chaos_blast") { } + public: + spell_leotheras_chaos_blast() : SpellScriptLoader("spell_leotheras_chaos_blast") { } - class spell_leotheras_chaos_blast_SpellScript : public SpellScript - { - PrepareSpellScript(spell_leotheras_chaos_blast_SpellScript); + class spell_leotheras_chaos_blast_SpellScript : public SpellScript + { + PrepareSpellScript(spell_leotheras_chaos_blast_SpellScript); - void HandleDummy(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, SPELL_CHAOS_BLAST_TRIGGER, true); - } + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_CHAOS_BLAST_TRIGGER, true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_leotheras_chaos_blast_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_leotheras_chaos_blast_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_leotheras_chaos_blast_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_leotheras_chaos_blast_SpellScript(); + } }; class spell_leotheras_insidious_whisper : public SpellScriptLoader @@ -401,8 +401,8 @@ class spell_leotheras_insidious_whisper : public SpellScriptLoader void FilterTargets(std::list& unitList) { - if (Unit* victim = GetCaster()->GetVictim()) - unitList.remove_if(Trinity::ObjectGUIDCheck(victim->GetGUID(), true)); + if (Unit* victim = GetCaster()->GetVictim()) + unitList.remove_if(Trinity::ObjectGUIDCheck(victim->GetGUID(), true)); } void Register() @@ -416,34 +416,34 @@ class spell_leotheras_insidious_whisper : public SpellScriptLoader return new spell_leotheras_insidious_whisper_SpellScript(); } - class spell_leotheras_insidious_whisper_AuraScript : public AuraScript - { - PrepareAuraScript(spell_leotheras_insidious_whisper_AuraScript) + class spell_leotheras_insidious_whisper_AuraScript : public AuraScript + { + PrepareAuraScript(spell_leotheras_insidious_whisper_AuraScript) - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_INNER_DEMON, true); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SUMMON_INNER_DEMON, true); + } - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT) - if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript()) - if (Creature* leotheras = ObjectAccessor::GetCreature(*GetUnitOwner(), instance->GetData64(NPC_LEOTHERAS_THE_BLIND))) - leotheras->CastSpell(GetUnitOwner(), SPELL_CONSUMING_MADNESS, true); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT) + if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript()) + if (Creature* leotheras = ObjectAccessor::GetCreature(*GetUnitOwner(), instance->GetData64(NPC_LEOTHERAS_THE_BLIND))) + leotheras->CastSpell(GetUnitOwner(), SPELL_CONSUMING_MADNESS, true); + } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_leotheras_insidious_whisper_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_leotheras_insidious_whisper_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_leotheras_insidious_whisper_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_leotheras_insidious_whisper_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_leotheras_insidious_whisper_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_leotheras_insidious_whisper_AuraScript(); + } }; class spell_leotheras_demon_link : public SpellScriptLoader @@ -457,9 +457,9 @@ class spell_leotheras_demon_link : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); - if (Unit* victim = GetUnitOwner()->GetVictim()) - GetUnitOwner()->CastSpell(victim, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + PreventDefaultAction(); + if (Unit* victim = GetUnitOwner()->GetVictim()) + GetUnitOwner()->CastSpell(victim, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); } void Register() @@ -476,39 +476,39 @@ class spell_leotheras_demon_link : public SpellScriptLoader class spell_leotheras_clear_consuming_madness : public SpellScriptLoader { - public: - spell_leotheras_clear_consuming_madness() : SpellScriptLoader("spell_leotheras_clear_consuming_madness") { } + public: + spell_leotheras_clear_consuming_madness() : SpellScriptLoader("spell_leotheras_clear_consuming_madness") { } - class spell_leotheras_clear_consuming_madness_SpellScript : public SpellScript - { - PrepareSpellScript(spell_leotheras_clear_consuming_madness_SpellScript); + class spell_leotheras_clear_consuming_madness_SpellScript : public SpellScript + { + PrepareSpellScript(spell_leotheras_clear_consuming_madness_SpellScript); - void HandleScriptEffect(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - Unit::Kill(GetCaster(), target); - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + Unit::Kill(GetCaster(), target); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_leotheras_clear_consuming_madness_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_leotheras_clear_consuming_madness_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_leotheras_clear_consuming_madness_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_leotheras_clear_consuming_madness_SpellScript(); + } }; void AddSC_boss_leotheras_the_blind() { new boss_leotheras_the_blind(); new npc_inner_demon(); - new spell_leotheras_whirlwind(); - new spell_leotheras_chaos_blast(); - new spell_leotheras_insidious_whisper(); - new spell_leotheras_demon_link(); - new spell_leotheras_clear_consuming_madness(); + new spell_leotheras_whirlwind(); + new spell_leotheras_chaos_blast(); + new spell_leotheras_insidious_whisper(); + new spell_leotheras_demon_link(); + new spell_leotheras_clear_consuming_madness(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 8b198f7bc..ff7c47413 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -8,29 +8,29 @@ REWRITTEN BY XINEF enum Spells { - SPELL_WATER_BOLT = 37138, - SPELL_WHIRL = 37660, - SPELL_GEYSER = 37478, - SPELL_SPOUT_VISUAL = 37431, - SPELL_SPOUT_PERIODIC = 37430, - SPELL_LURKER_SPAWN_TRIGGER = 54587 // Needed for achievement + SPELL_WATER_BOLT = 37138, + SPELL_WHIRL = 37660, + SPELL_GEYSER = 37478, + SPELL_SPOUT_VISUAL = 37431, + SPELL_SPOUT_PERIODIC = 37430, + SPELL_LURKER_SPAWN_TRIGGER = 54587 // Needed for achievement }; enum Misc { - EMOTE_TAKE_BREATH = 0, - ACTION_START_EVENT = 1, - MAX_SUMMONS = 9, + EMOTE_TAKE_BREATH = 0, + ACTION_START_EVENT = 1, + MAX_SUMMONS = 9, - NPC_COILFANG_GUARDIAN = 21873, - NPC_COILFANG_AMBUSHER = 21865, + NPC_COILFANG_GUARDIAN = 21873, + NPC_COILFANG_AMBUSHER = 21865, - EVENT_PHASE_1 = 1, - EVENT_PHASE_2 = 2, - EVENT_SPELL_WHIRL = 3, - EVENT_SPELL_SPOUT = 4, - EVENT_SPELL_GEYSER = 5, - EVENT_SPELL_SPOUT_PERIODIC = 6 + EVENT_PHASE_1 = 1, + EVENT_PHASE_2 = 2, + EVENT_SPELL_WHIRL = 3, + EVENT_SPELL_SPOUT = 4, + EVENT_SPELL_GEYSER = 5, + EVENT_SPELL_SPOUT_PERIODIC = 6 }; const Position positions[MAX_SUMMONS] = @@ -48,150 +48,150 @@ const Position positions[MAX_SUMMONS] = class boss_the_lurker_below : public CreatureScript { - public: - boss_the_lurker_below() : CreatureScript("boss_the_lurker_below") { } + public: + boss_the_lurker_below() : CreatureScript("boss_the_lurker_below") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_the_lurker_belowAI : public BossAI - { - boss_the_lurker_belowAI(Creature* creature) : BossAI(creature, DATA_THE_LURKER_BELOW) - { - } + struct boss_the_lurker_belowAI : public BossAI + { + boss_the_lurker_belowAI(Creature* creature) : BossAI(creature, DATA_THE_LURKER_BELOW) + { + } - void Reset() - { - BossAI::Reset(); - me->SetStandState(UNIT_STAND_STATE_SUBMERGED); - me->SetVisible(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } + void Reset() + { + BossAI::Reset(); + me->SetStandState(UNIT_STAND_STATE_SUBMERGED); + me->SetVisible(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } - void JustSummoned(Creature* summon) - { - summon->SetInCombatWithZone(); - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summon->SetInCombatWithZone(); + summons.Summon(summon); + } - void DoAction(int32 param) - { - if (param == ACTION_START_EVENT) - me->SetInCombatWithZone(); - } + void DoAction(int32 param) + { + if (param == ACTION_START_EVENT) + me->SetInCombatWithZone(); + } - void JustDied(Unit* killer) - { - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + BossAI::JustDied(killer); + } - void AttackStart(Unit* who) - { - if (who && me->GetReactState() == REACT_AGGRESSIVE) - me->Attack(who, true); - } + void AttackStart(Unit* who) + { + if (who && me->GetReactState() == REACT_AGGRESSIVE) + me->Attack(who, true); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - me->setAttackTimer(BASE_ATTACK, 6000); - me->SetVisible(true); - me->UpdateObjectVisibility(true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + me->setAttackTimer(BASE_ATTACK, 6000); + me->SetVisible(true); + me->UpdateObjectVisibility(true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); - events.ScheduleEvent(EVENT_SPELL_WHIRL, 18000); - events.ScheduleEvent(EVENT_SPELL_SPOUT, 45000); - events.ScheduleEvent(EVENT_SPELL_GEYSER, 10000); - events.ScheduleEvent(EVENT_PHASE_2, 125000); - } + events.ScheduleEvent(EVENT_SPELL_WHIRL, 18000); + events.ScheduleEvent(EVENT_SPELL_SPOUT, 45000); + events.ScheduleEvent(EVENT_SPELL_GEYSER, 10000); + events.ScheduleEvent(EVENT_PHASE_2, 125000); + } - void MoveInLineOfSight(Unit* who) - { - } + void MoveInLineOfSight(Unit* who) + { + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_WHIRL: - me->CastSpell(me, SPELL_WHIRL, false); - events.ScheduleEvent(EVENT_SPELL_WHIRL, 18000); - break; - case EVENT_SPELL_GEYSER: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_GEYSER, false); - events.ScheduleEvent(EVENT_SPELL_GEYSER, 10000); - break; - case EVENT_SPELL_SPOUT: - Talk(EMOTE_TAKE_BREATH); - me->CastSpell(me, SPELL_SPOUT_VISUAL, TRIGGERED_IGNORE_SET_FACING); - me->SetReactState(REACT_PASSIVE); - me->SetFacingToObject(me->GetVictim()); - me->SetTarget(0); - events.ScheduleEvent(EVENT_SPELL_SPOUT, 60000); - events.RescheduleEvent(EVENT_SPELL_WHIRL, 18000); - events.RescheduleEvent(EVENT_SPELL_GEYSER, 25000); - events.ScheduleEvent(EVENT_SPELL_SPOUT_PERIODIC, 3000); - break; - case EVENT_SPELL_SPOUT_PERIODIC: - me->InterruptNonMeleeSpells(false); - me->CastSpell(me, SPELL_SPOUT_PERIODIC, true); - break; - case EVENT_PHASE_2: - events.Reset(); - events.ScheduleEvent(EVENT_PHASE_1, 60000); - me->SetStandState(UNIT_STAND_STATE_SUBMERGED); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - for (uint8 i = 0; i < MAX_SUMMONS; ++i) - me->SummonCreature(i < 6 ? NPC_COILFANG_AMBUSHER : NPC_COILFANG_GUARDIAN, positions[i].GetPositionX(), positions[i].GetPositionY(), positions[i].GetPositionZ(), positions[i].GetAngle(me), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - break; - case EVENT_PHASE_1: - me->setAttackTimer(BASE_ATTACK, 6000); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_WHIRL: + me->CastSpell(me, SPELL_WHIRL, false); + events.ScheduleEvent(EVENT_SPELL_WHIRL, 18000); + break; + case EVENT_SPELL_GEYSER: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_GEYSER, false); + events.ScheduleEvent(EVENT_SPELL_GEYSER, 10000); + break; + case EVENT_SPELL_SPOUT: + Talk(EMOTE_TAKE_BREATH); + me->CastSpell(me, SPELL_SPOUT_VISUAL, TRIGGERED_IGNORE_SET_FACING); + me->SetReactState(REACT_PASSIVE); + me->SetFacingToObject(me->GetVictim()); + me->SetTarget(0); + events.ScheduleEvent(EVENT_SPELL_SPOUT, 60000); + events.RescheduleEvent(EVENT_SPELL_WHIRL, 18000); + events.RescheduleEvent(EVENT_SPELL_GEYSER, 25000); + events.ScheduleEvent(EVENT_SPELL_SPOUT_PERIODIC, 3000); + break; + case EVENT_SPELL_SPOUT_PERIODIC: + me->InterruptNonMeleeSpells(false); + me->CastSpell(me, SPELL_SPOUT_PERIODIC, true); + break; + case EVENT_PHASE_2: + events.Reset(); + events.ScheduleEvent(EVENT_PHASE_1, 60000); + me->SetStandState(UNIT_STAND_STATE_SUBMERGED); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + for (uint8 i = 0; i < MAX_SUMMONS; ++i) + me->SummonCreature(i < 6 ? NPC_COILFANG_AMBUSHER : NPC_COILFANG_GUARDIAN, positions[i].GetPositionX(), positions[i].GetPositionY(), positions[i].GetPositionZ(), positions[i].GetAngle(me), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + break; + case EVENT_PHASE_1: + me->setAttackTimer(BASE_ATTACK, 6000); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_SPOUT, 10000); - events.ScheduleEvent(EVENT_PHASE_2, 120000); - break; - } + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_SPOUT, 10000); + events.ScheduleEvent(EVENT_PHASE_2, 120000); + break; + } - if (me->getStandState() != UNIT_STAND_STATE_STAND || !me->isAttackReady() || me->GetReactState() != REACT_AGGRESSIVE) - return; + if (me->getStandState() != UNIT_STAND_STATE_STAND || !me->isAttackReady() || me->GetReactState() != REACT_AGGRESSIVE) + return; - Unit* target = NULL; - if (me->IsWithinMeleeRange(me->GetVictim())) - target = me->GetVictim(); - else - { - ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList(); - for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - if (Unit* threatTarget = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) - if (me->IsWithinMeleeRange(threatTarget)) - { - target = threatTarget; - break; - } - } + Unit* target = NULL; + if (me->IsWithinMeleeRange(me->GetVictim())) + target = me->GetVictim(); + else + { + ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList(); + for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + if (Unit* threatTarget = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) + if (me->IsWithinMeleeRange(threatTarget)) + { + target = threatTarget; + break; + } + } - if (target) - me->AttackerStateUpdate(target); - else if (target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_WATER_BOLT, false); + if (target) + me->AttackerStateUpdate(target); + else if (target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_WATER_BOLT, false); - me->resetAttackTimer(); - } - }; + me->resetAttackTimer(); + } + }; }; class go_strange_pool : public GameObjectScript @@ -202,11 +202,11 @@ class go_strange_pool : public GameObjectScript bool OnGossipHello(Player* player, GameObject* go) { if (InstanceScript* instance = go->GetInstanceScript()) - if (roll_chance_i(instance->GetBossState(DATA_THE_LURKER_BELOW) != DONE ? 25 : 0) && !instance->IsEncounterInProgress()) + if (roll_chance_i(instance->GetBossState(DATA_THE_LURKER_BELOW) != DONE ? 25 : 0) && !instance->IsEncounterInProgress()) { - player->CastSpell(player, SPELL_LURKER_SPAWN_TRIGGER, true); - if (Creature* lurker = ObjectAccessor::GetCreature(*go, instance->GetData64(NPC_THE_LURKER_BELOW))) - lurker->AI()->DoAction(ACTION_START_EVENT); + player->CastSpell(player, SPELL_LURKER_SPAWN_TRIGGER, true); + if (Creature* lurker = ObjectAccessor::GetCreature(*go, instance->GetData64(NPC_THE_LURKER_BELOW))) + lurker->AI()->DoAction(ACTION_START_EVENT); return true; } @@ -223,34 +223,34 @@ class spell_lurker_below_spout : public SpellScriptLoader { PrepareAuraScript(spell_lurker_below_spout_AuraScript); - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { SetDuration(13000); } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Creature* creature = GetUnitOwner()->ToCreature()) - { - creature->resetAttackTimer(); - creature->SetReactState(REACT_AGGRESSIVE); - if (Unit* target = creature->GetVictim()) - creature->SetTarget(target->GetGUID()); - } + if (Creature* creature = GetUnitOwner()->ToCreature()) + { + creature->resetAttackTimer(); + creature->SetReactState(REACT_AGGRESSIVE); + if (Unit* target = creature->GetVictim()) + creature->SetTarget(target->GetGUID()); + } } void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); - GetUnitOwner()->SetFacingTo(Position::NormalizeOrientation(GetUnitOwner()->GetOrientation()+0.1f)); - GetUnitOwner()->CastSpell(GetUnitOwner(), aurEff->GetAmount(), true); + PreventDefaultAction(); + GetUnitOwner()->SetFacingTo(Position::NormalizeOrientation(GetUnitOwner()->GetOrientation()+0.1f)); + GetUnitOwner()->CastSpell(GetUnitOwner(), aurEff->GetAmount(), true); - } + } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_lurker_below_spout_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_lurker_below_spout_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_lurker_below_spout_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_lurker_below_spout_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); OnEffectPeriodic += AuraEffectPeriodicFn(spell_lurker_below_spout_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -263,16 +263,16 @@ class spell_lurker_below_spout : public SpellScriptLoader class HasInLineCheck { - public: - HasInLineCheck(Unit* caster) : _caster(caster) { } + public: + HasInLineCheck(Unit* caster) : _caster(caster) { } - bool operator()(WorldObject* unit) - { - return !_caster->HasInLine(unit, 5.0f) || (unit->GetTypeId() == TYPEID_UNIT && unit->ToUnit()->IsUnderWater()); - } + bool operator()(WorldObject* unit) + { + return !_caster->HasInLine(unit, 5.0f) || (unit->GetTypeId() == TYPEID_UNIT && unit->ToUnit()->IsUnderWater()); + } - private: - Unit* _caster; + private: + Unit* _caster; }; class spell_lurker_below_spout_cone : public SpellScriptLoader @@ -286,7 +286,7 @@ class spell_lurker_below_spout_cone : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if(HasInLineCheck(GetCaster())); + targets.remove_if(HasInLineCheck(GetCaster())); } void Register() @@ -305,6 +305,6 @@ void AddSC_boss_the_lurker_below() { new boss_the_lurker_below(); new go_strange_pool(); - new spell_lurker_below_spout(); - new spell_lurker_below_spout_cone(); + new spell_lurker_below_spout(); + new spell_lurker_below_spout_cone(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp index 2985aa809..7d5069f43 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp @@ -8,30 +8,30 @@ REWRITTEN BY XINEF enum Yells { - SAY_AGGRO = 0, - SAY_SUMMON = 1, - SAY_SUMMON_BUBLE = 2, - SAY_SLAY = 3, - SAY_DEATH = 4, - EMOTE_WATERY_GRAVE = 5, - EMOTE_EARTHQUAKE = 6, - EMOTE_WATERY_GLOBULES = 7 + SAY_AGGRO = 0, + SAY_SUMMON = 1, + SAY_SUMMON_BUBLE = 2, + SAY_SLAY = 3, + SAY_DEATH = 4, + EMOTE_WATERY_GRAVE = 5, + EMOTE_EARTHQUAKE = 6, + EMOTE_WATERY_GLOBULES = 7 }; enum Spells { - SPELL_TIDAL_WAVE = 37730, - SPELL_WATERY_GRAVE = 38028, - SPELL_WATERY_GRAVE_1 = 38023, - SPELL_WATERY_GRAVE_2 = 38024, - SPELL_WATERY_GRAVE_3 = 38025, - SPELL_WATERY_GRAVE_4 = 37850, - SPELL_EARTHQUAKE = 37764, - SPELL_SUMMON_MURLOC1 = 39813, - SPELL_SUMMON_WATER_GLOBULE_1 = 37854, - SPELL_SUMMON_WATER_GLOBULE_2 = 37858, - SPELL_SUMMON_WATER_GLOBULE_3 = 37860, - SPELL_SUMMON_WATER_GLOBULE_4 = 37861 + SPELL_TIDAL_WAVE = 37730, + SPELL_WATERY_GRAVE = 38028, + SPELL_WATERY_GRAVE_1 = 38023, + SPELL_WATERY_GRAVE_2 = 38024, + SPELL_WATERY_GRAVE_3 = 38025, + SPELL_WATERY_GRAVE_4 = 37850, + SPELL_EARTHQUAKE = 37764, + SPELL_SUMMON_MURLOC1 = 39813, + SPELL_SUMMON_WATER_GLOBULE_1 = 37854, + SPELL_SUMMON_WATER_GLOBULE_2 = 37858, + SPELL_SUMMON_WATER_GLOBULE_3 = 37860, + SPELL_SUMMON_WATER_GLOBULE_4 = 37861 }; enum Misc @@ -40,11 +40,11 @@ enum Misc NPC_WATER_GLOBULE = 21913, NPC_TIDEWALKER_LURKER = 21920, - EVENT_SPELL_TIDAL_WAVE = 1, - EVENT_SPELL_WATERY_GRAVE = 2, - EVENT_SPELL_EARTHQUAKE = 3, - EVENT_SUMMON_MURLOCS = 4, - EVENT_KILL_TALK = 5 + EVENT_SPELL_TIDAL_WAVE = 1, + EVENT_SPELL_WATERY_GRAVE = 2, + EVENT_SPELL_EARTHQUAKE = 3, + EVENT_SUMMON_MURLOCS = 4, + EVENT_KILL_TALK = 5 }; @@ -53,140 +53,140 @@ const uint32 waterGlobuleId[4] = {SPELL_SUMMON_WATER_GLOBULE_1, SPELL_SUMMON_WAT class boss_morogrim_tidewalker : public CreatureScript { - public: - boss_morogrim_tidewalker() : CreatureScript("boss_morogrim_tidewalker") { } + public: + boss_morogrim_tidewalker() : CreatureScript("boss_morogrim_tidewalker") { } - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } - struct boss_morogrim_tidewalkerAI : public BossAI - { - boss_morogrim_tidewalkerAI(Creature* creature) : BossAI(creature, DATA_MOROGRIM_TIDEWALKER) - { - } + struct boss_morogrim_tidewalkerAI : public BossAI + { + boss_morogrim_tidewalkerAI(Creature* creature) : BossAI(creature, DATA_MOROGRIM_TIDEWALKER) + { + } - void Reset() - { - BossAI::Reset(); - } + void Reset() + { + BossAI::Reset(); + } - void KilledUnit(Unit*) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_SLAY); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit*) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_SLAY); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->SetInCombatWithZone(); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->SetInCombatWithZone(); + } - void JustDied(Unit* killer) - { - Talk(SAY_DEATH); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DEATH); + BossAI::JustDied(killer); + } - void EnterCombat(Unit* who) - { - BossAI::EnterCombat(who); - Talk(SAY_AGGRO); + void EnterCombat(Unit* who) + { + BossAI::EnterCombat(who); + Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_TIDAL_WAVE, 10000); - events.ScheduleEvent(EVENT_SPELL_WATERY_GRAVE, 28000); - events.ScheduleEvent(EVENT_SPELL_EARTHQUAKE, 40000); - } + events.ScheduleEvent(EVENT_SPELL_TIDAL_WAVE, 10000); + events.ScheduleEvent(EVENT_SPELL_WATERY_GRAVE, 28000); + events.ScheduleEvent(EVENT_SPELL_EARTHQUAKE, 40000); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_TIDAL_WAVE: - me->CastSpell(me->GetVictim(), SPELL_TIDAL_WAVE, false); - events.ScheduleEvent(EVENT_SPELL_TIDAL_WAVE, 20000); - break; - case EVENT_SPELL_WATERY_GRAVE: - Talk(SAY_SUMMON_BUBLE); - if (me->HealthAbovePct(25)) - { - Talk(EMOTE_WATERY_GRAVE); - me->CastCustomSpell(SPELL_WATERY_GRAVE, SPELLVALUE_MAX_TARGETS, 4, me, false); - } - else - { - Talk(EMOTE_WATERY_GLOBULES); - for (uint8 i = 0; i < 4; ++i) - me->CastSpell(me, waterGlobuleId[i], true); - } - events.ScheduleEvent(EVENT_SPELL_WATERY_GRAVE, 25000); - break; - case EVENT_SPELL_EARTHQUAKE: - Talk(EMOTE_EARTHQUAKE); - me->CastSpell(me, SPELL_EARTHQUAKE, false); - events.ScheduleEvent(EVENT_SPELL_EARTHQUAKE, urand(45000, 60000)); - events.ScheduleEvent(EVENT_SUMMON_MURLOCS, 8000); - break; - case EVENT_SUMMON_MURLOCS: - Talk(SAY_SUMMON); - for (uint32 i = SPELL_SUMMON_MURLOC1; i < SPELL_SUMMON_MURLOC1+11; ++i) - me->CastSpell(me, i, true); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_TIDAL_WAVE: + me->CastSpell(me->GetVictim(), SPELL_TIDAL_WAVE, false); + events.ScheduleEvent(EVENT_SPELL_TIDAL_WAVE, 20000); + break; + case EVENT_SPELL_WATERY_GRAVE: + Talk(SAY_SUMMON_BUBLE); + if (me->HealthAbovePct(25)) + { + Talk(EMOTE_WATERY_GRAVE); + me->CastCustomSpell(SPELL_WATERY_GRAVE, SPELLVALUE_MAX_TARGETS, 4, me, false); + } + else + { + Talk(EMOTE_WATERY_GLOBULES); + for (uint8 i = 0; i < 4; ++i) + me->CastSpell(me, waterGlobuleId[i], true); + } + events.ScheduleEvent(EVENT_SPELL_WATERY_GRAVE, 25000); + break; + case EVENT_SPELL_EARTHQUAKE: + Talk(EMOTE_EARTHQUAKE); + me->CastSpell(me, SPELL_EARTHQUAKE, false); + events.ScheduleEvent(EVENT_SPELL_EARTHQUAKE, urand(45000, 60000)); + events.ScheduleEvent(EVENT_SUMMON_MURLOCS, 8000); + break; + case EVENT_SUMMON_MURLOCS: + Talk(SAY_SUMMON); + for (uint32 i = SPELL_SUMMON_MURLOC1; i < SPELL_SUMMON_MURLOC1+11; ++i) + me->CastSpell(me, i, true); + break; + } - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; }; class spell_morogrim_tidewalker_watery_grave : public SpellScriptLoader { - public: - spell_morogrim_tidewalker_watery_grave() : SpellScriptLoader("spell_morogrim_tidewalker_watery_grave") { } + public: + spell_morogrim_tidewalker_watery_grave() : SpellScriptLoader("spell_morogrim_tidewalker_watery_grave") { } - class spell_morogrim_tidewalker_watery_grave_SpellScript : public SpellScript - { - PrepareSpellScript(spell_morogrim_tidewalker_watery_grave_SpellScript); + class spell_morogrim_tidewalker_watery_grave_SpellScript : public SpellScript + { + PrepareSpellScript(spell_morogrim_tidewalker_watery_grave_SpellScript); - bool Load() - { - targetNumber = 0; - return true; - } + bool Load() + { + targetNumber = 0; + return true; + } - void HandleDummy(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - if (targetNumber < 4) - GetCaster()->CastSpell(target, wateryGraveId[targetNumber++], true); - } + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + if (targetNumber < 4) + GetCaster()->CastSpell(target, wateryGraveId[targetNumber++], true); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_morogrim_tidewalker_watery_grave_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_morogrim_tidewalker_watery_grave_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } - private: - uint8 targetNumber; - }; + private: + uint8 targetNumber; + }; - SpellScript* GetSpellScript() const - { - return new spell_morogrim_tidewalker_watery_grave_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_morogrim_tidewalker_watery_grave_SpellScript(); + } }; class spell_morogrim_tidewalker_water_globule_new_target : public SpellScriptLoader @@ -200,27 +200,27 @@ class spell_morogrim_tidewalker_water_globule_new_target : public SpellScriptLoa void FilterTargets(std::list& unitList) { - Trinity::Containers::RandomResizeList(unitList, 1); + Trinity::Containers::RandomResizeList(unitList, 1); } - void HandleDummy(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); - // Xinef: if we have target we currently follow, return - if (Unit* target = GetCaster()->GetVictim()) - if (GetCaster()->getThreatManager().getThreat(target) >= 100000.0f) - return; + // Xinef: if we have target we currently follow, return + if (Unit* target = GetCaster()->GetVictim()) + if (GetCaster()->getThreatManager().getThreat(target) >= 100000.0f) + return; - // Xinef: acquire new target - if (Unit* target = GetHitUnit()) - GetCaster()->AddThreat(target, 1000000.0f); - } + // Xinef: acquire new target + if (Unit* target = GetHitUnit()) + GetCaster()->AddThreat(target, 1000000.0f); + } void Register() { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_morogrim_tidewalker_water_globule_new_target_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_morogrim_tidewalker_water_globule_new_target_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_morogrim_tidewalker_water_globule_new_target_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -233,6 +233,6 @@ class spell_morogrim_tidewalker_water_globule_new_target : public SpellScriptLoa void AddSC_boss_morogrim_tidewalker() { new boss_morogrim_tidewalker(); - new spell_morogrim_tidewalker_watery_grave(); - new spell_morogrim_tidewalker_water_globule_new_target(); + new spell_morogrim_tidewalker_watery_grave(); + new spell_morogrim_tidewalker_water_globule_new_target(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index 38d32c554..45a280381 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -29,14 +29,14 @@ class instance_serpent_shrine : public InstanceMapScript void Initialize() { - SetBossNumber(MAX_ENCOUNTERS); + SetBossNumber(MAX_ENCOUNTERS); LoadDoorData(doorData); LadyVashjGUID = 0; memset(&ShieldGeneratorGUID, 0, sizeof(ShieldGeneratorGUID)); - AliveKeepersCount = 0; - LeotherasTheBlindGUID = 0; - LurkerBelowGUID = 0; + AliveKeepersCount = 0; + LeotherasTheBlindGUID = 0; + LurkerBelowGUID = 0; } bool SetBossState(uint32 type, EncounterState state) @@ -44,30 +44,30 @@ class instance_serpent_shrine : public InstanceMapScript if (!InstanceScript::SetBossState(type, state)) return false; - if (type == DATA_LADY_VASHJ) - for (uint8 i = 0; i < 4; ++i) - if (GameObject* gobject = instance->GetGameObject(ShieldGeneratorGUID[i])) - gobject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + if (type == DATA_LADY_VASHJ) + for (uint8 i = 0; i < 4; ++i) + if (GameObject* gobject = instance->GetGameObject(ShieldGeneratorGUID[i])) + gobject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - return true; - } + return true; + } void OnGameObjectCreate(GameObject* go) { switch (go->GetEntry()) { case GO_LADY_VASHJ_BRIDGE_CONSOLE: - case GO_COILFANG_BRIDGE1: - case GO_COILFANG_BRIDGE2: - case GO_COILFANG_BRIDGE3: + case GO_COILFANG_BRIDGE1: + case GO_COILFANG_BRIDGE2: + case GO_COILFANG_BRIDGE3: AddDoor(go, true); - break; - case GO_SHIELD_GENERATOR1: - case GO_SHIELD_GENERATOR2: - case GO_SHIELD_GENERATOR3: - case GO_SHIELD_GENERATOR4: - ShieldGeneratorGUID[go->GetEntry()-GO_SHIELD_GENERATOR1] = go->GetGUID(); - break; + break; + case GO_SHIELD_GENERATOR1: + case GO_SHIELD_GENERATOR2: + case GO_SHIELD_GENERATOR3: + case GO_SHIELD_GENERATOR4: + ShieldGeneratorGUID[go->GetEntry()-GO_SHIELD_GENERATOR1] = go->GetGUID(); + break; } } @@ -76,11 +76,11 @@ class instance_serpent_shrine : public InstanceMapScript switch (go->GetEntry()) { case GO_LADY_VASHJ_BRIDGE_CONSOLE: - case GO_COILFANG_BRIDGE1: - case GO_COILFANG_BRIDGE2: - case GO_COILFANG_BRIDGE3: + case GO_COILFANG_BRIDGE1: + case GO_COILFANG_BRIDGE2: + case GO_COILFANG_BRIDGE3: AddDoor(go, false); - break; + break; } } @@ -88,30 +88,30 @@ class instance_serpent_shrine : public InstanceMapScript { switch (creature->GetEntry()) { - case NPC_COILFANG_SHATTERER: - case NPC_COILFANG_PRIESTESS: - if (creature->GetPositionX() > -110.0f && creature->GetPositionX() < 155.0f && creature->GetPositionY() > -610.0f && creature->GetPositionY() < -280.0f) - AliveKeepersCount += creature->IsAlive() ? 0 : -1; // retarded SmartAI calls JUST_RESPAWNED in AIInit... - break; + case NPC_COILFANG_SHATTERER: + case NPC_COILFANG_PRIESTESS: + if (creature->GetPositionX() > -110.0f && creature->GetPositionX() < 155.0f && creature->GetPositionY() > -610.0f && creature->GetPositionY() < -280.0f) + AliveKeepersCount += creature->IsAlive() ? 0 : -1; // retarded SmartAI calls JUST_RESPAWNED in AIInit... + break; case NPC_THE_LURKER_BELOW: LurkerBelowGUID = creature->GetGUID(); break; case NPC_LEOTHERAS_THE_BLIND: LeotherasTheBlindGUID = creature->GetGUID(); break; - case NPC_CYCLONE_KARATHRESS: - creature->GetMotionMaster()->MoveRandom(50.0f); - break; + case NPC_CYCLONE_KARATHRESS: + creature->GetMotionMaster()->MoveRandom(50.0f); + break; case NPC_LADY_VASHJ: LadyVashjGUID = creature->GetGUID(); break; - case NPC_ENCHANTED_ELEMENTAL: - case NPC_COILFANG_ELITE: - case NPC_COILFANG_STRIDER: - case NPC_TAINTED_ELEMENTAL: - if (Creature* vashj = instance->GetCreature(LadyVashjGUID)) - vashj->AI()->JustSummoned(creature); - break; + case NPC_ENCHANTED_ELEMENTAL: + case NPC_COILFANG_ELITE: + case NPC_COILFANG_STRIDER: + case NPC_TAINTED_ELEMENTAL: + if (Creature* vashj = instance->GetCreature(LadyVashjGUID)) + vashj->AI()->JustSummoned(creature); + break; } } @@ -119,10 +119,10 @@ class instance_serpent_shrine : public InstanceMapScript { switch (identifier) { - case NPC_THE_LURKER_BELOW: - return LurkerBelowGUID; - case NPC_LEOTHERAS_THE_BLIND: - return LeotherasTheBlindGUID; + case NPC_THE_LURKER_BELOW: + return LurkerBelowGUID; + case NPC_LEOTHERAS_THE_BLIND: + return LeotherasTheBlindGUID; case NPC_LADY_VASHJ: return LadyVashjGUID; } @@ -133,32 +133,32 @@ class instance_serpent_shrine : public InstanceMapScript { switch (type) { - case DATA_PLATFORM_KEEPER_RESPAWNED: - ++AliveKeepersCount; - break; - case DATA_PLATFORM_KEEPER_DIED: - --AliveKeepersCount; - break; - case DATA_BRIDGE_ACTIVATED: - SetBossState(DATA_BRIDGE_EMERGED, NOT_STARTED); - SetBossState(DATA_BRIDGE_EMERGED, DONE); - break; - case DATA_ACTIVATE_SHIELD: - if (Creature* vashj = instance->GetCreature(LadyVashjGUID)) - for (uint8 i = 0; i < 4; ++i) - if (GameObject* gobject = instance->GetGameObject(ShieldGeneratorGUID[i])) - { - gobject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - vashj->SummonTrigger(gobject->GetPositionX(), gobject->GetPositionY(), gobject->GetPositionZ(), 0.0f, 0); - } - break; + case DATA_PLATFORM_KEEPER_RESPAWNED: + ++AliveKeepersCount; + break; + case DATA_PLATFORM_KEEPER_DIED: + --AliveKeepersCount; + break; + case DATA_BRIDGE_ACTIVATED: + SetBossState(DATA_BRIDGE_EMERGED, NOT_STARTED); + SetBossState(DATA_BRIDGE_EMERGED, DONE); + break; + case DATA_ACTIVATE_SHIELD: + if (Creature* vashj = instance->GetCreature(LadyVashjGUID)) + for (uint8 i = 0; i < 4; ++i) + if (GameObject* gobject = instance->GetGameObject(ShieldGeneratorGUID[i])) + { + gobject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + vashj->SummonTrigger(gobject->GetPositionX(), gobject->GetPositionY(), gobject->GetPositionZ(), 0.0f, 0); + } + break; } } uint32 GetData(uint32 type) const { if (type == DATA_ALIVE_KEEPERS) - return AliveKeepersCount; + return AliveKeepersCount; return 0; } @@ -208,7 +208,7 @@ class instance_serpent_shrine : public InstanceMapScript private: uint64 LadyVashjGUID; - uint64 ShieldGeneratorGUID[4]; + uint64 ShieldGeneratorGUID[4]; uint64 LurkerBelowGUID; uint64 LeotherasTheBlindGUID; int32 AliveKeepersCount; @@ -222,184 +222,184 @@ class instance_serpent_shrine : public InstanceMapScript class spell_serpentshrine_cavern_serpentshrine_parasite : public SpellScriptLoader { - public: - spell_serpentshrine_cavern_serpentshrine_parasite() : SpellScriptLoader("spell_serpentshrine_cavern_serpentshrine_parasite") { } + public: + spell_serpentshrine_cavern_serpentshrine_parasite() : SpellScriptLoader("spell_serpentshrine_cavern_serpentshrine_parasite") { } - class spell_serpentshrine_cavern_serpentshrine_parasite_AuraScript : public AuraScript - { - PrepareAuraScript(spell_serpentshrine_cavern_serpentshrine_parasite_AuraScript) + class spell_serpentshrine_cavern_serpentshrine_parasite_AuraScript : public AuraScript + { + PrepareAuraScript(spell_serpentshrine_cavern_serpentshrine_parasite_AuraScript) - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress()) - GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SERPENTSHRINE_PARASITE, true); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress()) + GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SERPENTSHRINE_PARASITE, true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_serpentshrine_cavern_serpentshrine_parasite_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_serpentshrine_cavern_serpentshrine_parasite_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_serpentshrine_cavern_serpentshrine_parasite_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_serpentshrine_cavern_serpentshrine_parasite_AuraScript(); + } }; class spell_serpentshrine_cavern_serpentshrine_parasite_trigger : public SpellScriptLoader { - public: - spell_serpentshrine_cavern_serpentshrine_parasite_trigger() : SpellScriptLoader("spell_serpentshrine_cavern_serpentshrine_parasite_trigger") { } + public: + spell_serpentshrine_cavern_serpentshrine_parasite_trigger() : SpellScriptLoader("spell_serpentshrine_cavern_serpentshrine_parasite_trigger") { } - class spell_serpentshrine_cavern_serpentshrine_parasite_trigger_AuraScript : public AuraScript - { - PrepareAuraScript(spell_serpentshrine_cavern_serpentshrine_parasite_trigger_AuraScript) + class spell_serpentshrine_cavern_serpentshrine_parasite_trigger_AuraScript : public AuraScript + { + PrepareAuraScript(spell_serpentshrine_cavern_serpentshrine_parasite_trigger_AuraScript) - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress()) - GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SERPENTSHRINE_PARASITE, true); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTarget()->GetInstanceScript() && GetTarget()->GetInstanceScript()->IsEncounterInProgress()) + GetTarget()->CastSpell(GetTarget(), SPELL_SUMMON_SERPENTSHRINE_PARASITE, true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_serpentshrine_cavern_serpentshrine_parasite_trigger_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_serpentshrine_cavern_serpentshrine_parasite_trigger_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_serpentshrine_cavern_serpentshrine_parasite_trigger_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_serpentshrine_cavern_serpentshrine_parasite_trigger_AuraScript(); + } - class spell_serpentshrine_cavern_serpentshrine_parasite_trigger_SpellScript : public SpellScript - { - PrepareSpellScript(spell_serpentshrine_cavern_serpentshrine_parasite_trigger_SpellScript); + class spell_serpentshrine_cavern_serpentshrine_parasite_trigger_SpellScript : public SpellScript + { + PrepareSpellScript(spell_serpentshrine_cavern_serpentshrine_parasite_trigger_SpellScript); - void HandleApplyAura(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Creature* target = GetHitCreature()) - target->DespawnOrUnsummon(1); - } + void HandleApplyAura(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Creature* target = GetHitCreature()) + target->DespawnOrUnsummon(1); + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_serpentshrine_cavern_serpentshrine_parasite_trigger_SpellScript::HandleApplyAura, EFFECT_0, SPELL_EFFECT_APPLY_AURA); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_serpentshrine_cavern_serpentshrine_parasite_trigger_SpellScript::HandleApplyAura, EFFECT_0, SPELL_EFFECT_APPLY_AURA); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_serpentshrine_cavern_serpentshrine_parasite_trigger_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_serpentshrine_cavern_serpentshrine_parasite_trigger_SpellScript(); + } }; class spell_serpentshrine_cavern_infection : public SpellScriptLoader { - public: - spell_serpentshrine_cavern_infection() : SpellScriptLoader("spell_serpentshrine_cavern_infection") { } + public: + spell_serpentshrine_cavern_infection() : SpellScriptLoader("spell_serpentshrine_cavern_infection") { } - class spell_serpentshrine_cavern_infection_AuraScript : public AuraScript - { - PrepareAuraScript(spell_serpentshrine_cavern_infection_AuraScript) + class spell_serpentshrine_cavern_infection_AuraScript : public AuraScript + { + PrepareAuraScript(spell_serpentshrine_cavern_infection_AuraScript) - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTarget()->GetInstanceScript()) - { - CustomSpellValues values; - values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1); - values.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount()+500); - values.AddSpellMod(SPELLVALUE_BASE_POINT1, aurEff->GetAmount()+500); - GetTarget()->CastCustomSpell(SPELL_RAMPART_INFECTION, values, GetTarget(), TRIGGERED_FULL_MASK, NULL); - } - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTarget()->GetInstanceScript()) + { + CustomSpellValues values; + values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1); + values.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount()+500); + values.AddSpellMod(SPELLVALUE_BASE_POINT1, aurEff->GetAmount()+500); + GetTarget()->CastCustomSpell(SPELL_RAMPART_INFECTION, values, GetTarget(), TRIGGERED_FULL_MASK, NULL); + } + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_serpentshrine_cavern_infection_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_serpentshrine_cavern_infection_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_serpentshrine_cavern_infection_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_serpentshrine_cavern_infection_AuraScript(); + } }; class spell_serpentshrine_cavern_coilfang_water : public SpellScriptLoader { - public: - spell_serpentshrine_cavern_coilfang_water() : SpellScriptLoader("spell_serpentshrine_cavern_coilfang_water") { } + public: + spell_serpentshrine_cavern_coilfang_water() : SpellScriptLoader("spell_serpentshrine_cavern_coilfang_water") { } - class spell_serpentshrine_cavern_coilfang_water_AuraScript : public AuraScript - { - PrepareAuraScript(spell_serpentshrine_cavern_coilfang_water_AuraScript) + class spell_serpentshrine_cavern_coilfang_water_AuraScript : public AuraScript + { + PrepareAuraScript(spell_serpentshrine_cavern_coilfang_water_AuraScript) - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript()) - if (instance->GetBossState(DATA_THE_LURKER_BELOW) != DONE) - if (instance->GetData(DATA_ALIVE_KEEPERS) == 0) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SCALDING_WATER, true); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (InstanceScript* instance = GetUnitOwner()->GetInstanceScript()) + if (instance->GetBossState(DATA_THE_LURKER_BELOW) != DONE) + if (instance->GetData(DATA_ALIVE_KEEPERS) == 0) + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SCALDING_WATER, true); + } - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->RemoveAurasDueToSpell(SPELL_SCALDING_WATER); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->RemoveAurasDueToSpell(SPELL_SCALDING_WATER); + } void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) { - InstanceScript* instance = GetUnitOwner()->GetInstanceScript(); - if (!instance || instance->GetBossState(DATA_THE_LURKER_BELOW) == DONE) - return; + InstanceScript* instance = GetUnitOwner()->GetInstanceScript(); + if (!instance || instance->GetBossState(DATA_THE_LURKER_BELOW) == DONE) + return; isPeriodic = true; amplitude = 8*IN_MILLISECONDS; } - + void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - InstanceScript* instance = GetUnitOwner()->GetInstanceScript(); - if (!instance || GetUnitOwner()->GetMapId() != 548) - { - SetDuration(0); - return; - } + InstanceScript* instance = GetUnitOwner()->GetInstanceScript(); + if (!instance || GetUnitOwner()->GetMapId() != 548) + { + SetDuration(0); + return; + } - if (instance->GetBossState(DATA_THE_LURKER_BELOW) == DONE || instance->GetData(DATA_ALIVE_KEEPERS) == 0 || GetUnitOwner()->GetPositionZ() > -20.5f || !GetUnitOwner()->IsInWater()) - return; + if (instance->GetBossState(DATA_THE_LURKER_BELOW) == DONE || instance->GetData(DATA_ALIVE_KEEPERS) == 0 || GetUnitOwner()->GetPositionZ() > -20.5f || !GetUnitOwner()->IsInWater()) + return; - for (uint8 i = 0; i < 3; ++i) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FRENZY_WATER, true); + for (uint8 i = 0; i < 3; ++i) + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FRENZY_WATER, true); } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_serpentshrine_cavern_coilfang_water_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_serpentshrine_cavern_coilfang_water_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_serpentshrine_cavern_coilfang_water_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_serpentshrine_cavern_coilfang_water_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_serpentshrine_cavern_coilfang_water_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_serpentshrine_cavern_coilfang_water_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); OnEffectPeriodic += AuraEffectPeriodicFn(spell_serpentshrine_cavern_coilfang_water_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + } + }; - AuraScript* GetAuraScript() const - { - return new spell_serpentshrine_cavern_coilfang_water_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_serpentshrine_cavern_coilfang_water_AuraScript(); + } }; void AddSC_instance_serpentshrine_cavern() { new instance_serpent_shrine(); - new spell_serpentshrine_cavern_serpentshrine_parasite(); - new spell_serpentshrine_cavern_serpentshrine_parasite_trigger(); - new spell_serpentshrine_cavern_infection(); - new spell_serpentshrine_cavern_coilfang_water(); + new spell_serpentshrine_cavern_serpentshrine_parasite(); + new spell_serpentshrine_cavern_serpentshrine_parasite_trigger(); + new spell_serpentshrine_cavern_infection(); + new spell_serpentshrine_cavern_coilfang_water(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h index 7b2f724de..18d9fab7a 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h @@ -7,58 +7,58 @@ REWRITTEN BY XINEF enum DataTypes { - DATA_HYDROSS_THE_UNSTABLE = 0, - DATA_THE_LURKER_BELOW = 1, - DATA_LEOTHERAS_THE_BLIND = 2, - DATA_FATHOM_LORD_KARATHRESS = 3, - DATA_MOROGRIM_TIDEWALKER = 4, - DATA_BRIDGE_EMERGED = 5, - DATA_LADY_VASHJ = 6, - MAX_ENCOUNTERS = 7, + DATA_HYDROSS_THE_UNSTABLE = 0, + DATA_THE_LURKER_BELOW = 1, + DATA_LEOTHERAS_THE_BLIND = 2, + DATA_FATHOM_LORD_KARATHRESS = 3, + DATA_MOROGRIM_TIDEWALKER = 4, + DATA_BRIDGE_EMERGED = 5, + DATA_LADY_VASHJ = 6, + MAX_ENCOUNTERS = 7, - DATA_PLATFORM_KEEPER_RESPAWNED = 20, - DATA_PLATFORM_KEEPER_DIED = 21, - DATA_ALIVE_KEEPERS = 22, - DATA_BRIDGE_ACTIVATED = 23, - DATA_ACTIVATE_SHIELD = 24, + DATA_PLATFORM_KEEPER_RESPAWNED = 20, + DATA_PLATFORM_KEEPER_DIED = 21, + DATA_ALIVE_KEEPERS = 22, + DATA_BRIDGE_ACTIVATED = 23, + DATA_ACTIVATE_SHIELD = 24, }; enum SSNPCs { - NPC_HYDROSS_THE_UNSTABLE = 21216, - NPC_THE_LURKER_BELOW = 21217, - NPC_LEOTHERAS_THE_BLIND = 21215, - NPC_CYCLONE_KARATHRESS = 22104, - NPC_LADY_VASHJ = 21212, + NPC_HYDROSS_THE_UNSTABLE = 21216, + NPC_THE_LURKER_BELOW = 21217, + NPC_LEOTHERAS_THE_BLIND = 21215, + NPC_CYCLONE_KARATHRESS = 22104, + NPC_LADY_VASHJ = 21212, - NPC_COILFANG_SHATTERER = 21301, - NPC_COILFANG_PRIESTESS = 21220, - - NPC_ENCHANTED_ELEMENTAL = 21958, - NPC_COILFANG_ELITE = 22055, - NPC_COILFANG_STRIDER = 22056, - NPC_TAINTED_ELEMENTAL = 22009, - NPC_TOXIC_SPOREBAT = 22140, + NPC_COILFANG_SHATTERER = 21301, + NPC_COILFANG_PRIESTESS = 21220, + + NPC_ENCHANTED_ELEMENTAL = 21958, + NPC_COILFANG_ELITE = 22055, + NPC_COILFANG_STRIDER = 22056, + NPC_TAINTED_ELEMENTAL = 22009, + NPC_TOXIC_SPOREBAT = 22140, - GO_LADY_VASHJ_BRIDGE_CONSOLE = 184568, - GO_COILFANG_BRIDGE1 = 184203, - GO_COILFANG_BRIDGE2 = 184204, - GO_COILFANG_BRIDGE3 = 184205, + GO_LADY_VASHJ_BRIDGE_CONSOLE = 184568, + GO_COILFANG_BRIDGE1 = 184203, + GO_COILFANG_BRIDGE2 = 184204, + GO_COILFANG_BRIDGE3 = 184205, - GO_SHIELD_GENERATOR1 = 185051, - GO_SHIELD_GENERATOR2 = 185052, - GO_SHIELD_GENERATOR3 = 185053, - GO_SHIELD_GENERATOR4 = 185054 + GO_SHIELD_GENERATOR1 = 185051, + GO_SHIELD_GENERATOR2 = 185052, + GO_SHIELD_GENERATOR3 = 185053, + GO_SHIELD_GENERATOR4 = 185054 }; enum SSSpells { - SPELL_SUMMON_SERPENTSHRINE_PARASITE = 39045, - SPELL_RAMPART_INFECTION = 39042, - SPELL_SCALDING_WATER = 37284, - SPELL_FRENZY_WATER = 37026 + SPELL_SUMMON_SERPENTSHRINE_PARASITE = 39045, + SPELL_RAMPART_INFECTION = 39042, + SPELL_SCALDING_WATER = 37284, + SPELL_FRENZY_WATER = 37026 }; #endif diff --git a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp index ec9851d57..bfe42ca1f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_ahune.cpp @@ -10,12 +10,12 @@ REWRITTEN FROM SCRATCH BY PUSSYWIZARD, IT OWNS NOW! #include "Group.h" #include "LFGMgr.h" -#define GOSSIP_TEXT_ID 15864 -#define QUEST_SUMMON_AHUNE 11691 -#define ITEM_MAGMA_TOTEM 34953 -#define AHUNE_DEFAULT_MODEL 23344 -#define TEXT_RETREAT "Ahune Retreats. His defenses diminish." -#define TEXT_RESURFACE "Ahune will soon resurface." +#define GOSSIP_TEXT_ID 15864 +#define QUEST_SUMMON_AHUNE 11691 +#define ITEM_MAGMA_TOTEM 34953 +#define AHUNE_DEFAULT_MODEL 23344 +#define TEXT_RETREAT "Ahune Retreats. His defenses diminish." +#define TEXT_RESURFACE "Ahune will soon resurface." const Position AhuneSummonPos = {-97.3473f, -233.139f, -1.27587f, M_PI/2}; const Position TotemPos[3] = { {-115.141f, -143.317f, -2.09467f, 4.92772f}, {-120.178f, -144.398f, -2.23786f, 4.92379f}, {-125.277f, -145.463f, -1.95209f, 4.97877f} }; @@ -23,294 +23,294 @@ const Position MinionSummonPos = {-97.154404f, -204.382675f, -1.19f, M_PI/2}; enum NPCs { - NPC_AHUNE = 25740, - NPC_FROZEN_CORE = 25865, - NPC_AHUNE_SUMMON_LOC_BUNNY = 25745, - NPC_TOTEM = 25961, - NPC_TOTEM_BUNNY_1 = 25971, - NPC_TOTEM_BUNNY_2 = 25972, - NPC_TOTEM_BUNNY_3 = 25973, + NPC_AHUNE = 25740, + NPC_FROZEN_CORE = 25865, + NPC_AHUNE_SUMMON_LOC_BUNNY = 25745, + NPC_TOTEM = 25961, + NPC_TOTEM_BUNNY_1 = 25971, + NPC_TOTEM_BUNNY_2 = 25972, + NPC_TOTEM_BUNNY_3 = 25973, }; enum EventSpells { - SPELL_STARTING_BEAM = 46593, - SPELL_MAKE_BONFIRE = 45930, - SPELL_TOTEM_BEAM = 46363, - SPELL_SELF_STUN = 46416, - SPELL_EMERGE_0 = 66947, - SPELL_SUBMERGE_0 = 37550, - SPELL_AHUNE_RESURFACES = 46402, + SPELL_STARTING_BEAM = 46593, + SPELL_MAKE_BONFIRE = 45930, + SPELL_TOTEM_BEAM = 46363, + SPELL_SELF_STUN = 46416, + SPELL_EMERGE_0 = 66947, + SPELL_SUBMERGE_0 = 37550, + SPELL_AHUNE_RESURFACES = 46402, - SPELL_AHUNES_SHIELD = 45954, - SPELL_COLD_SLAP = 46198, - SPELL_SUMMON_HAILSTONE = 45951, - SPELL_SUMMON_COLDWAVE = 45952, - SPELL_SUMMON_FROSTWIND = 45953, + SPELL_AHUNES_SHIELD = 45954, + SPELL_COLD_SLAP = 46198, + SPELL_SUMMON_HAILSTONE = 45951, + SPELL_SUMMON_COLDWAVE = 45952, + SPELL_SUMMON_FROSTWIND = 45953, - /* - SPELL_SUMMON_ICE_SPEAR_BUNNY= 46359, // any dest - SPELL_ICE_SPEAR_KNOCKBACK = 46360, // src caster - SPELL_ICE_SPEAR_SUMMON_OBJ = 46369, - SPELL_ICE_SPEAR_CONTROL_AURA= 46371, // periodic dummy - */ + /* + SPELL_SUMMON_ICE_SPEAR_BUNNY= 46359, // any dest + SPELL_ICE_SPEAR_KNOCKBACK = 46360, // src caster + SPELL_ICE_SPEAR_SUMMON_OBJ = 46369, + SPELL_ICE_SPEAR_CONTROL_AURA= 46371, // periodic dummy + */ }; enum eEvents { - EVENT_EMERGE = 1, - EVENT_INVOKER_SAY_1, - EVENT_INVOKER_SAY_2, - EVENT_INVOKER_SAY_3, - EVENT_SUMMON_TOTEMS, - EVENT_ATTACK, - EVENT_TOTEMS_ATTACK, - EVENT_SUBMERGE, - EVENT_COMBAT_EMERGE, - EVENT_EMERGE_WARNING, + EVENT_EMERGE = 1, + EVENT_INVOKER_SAY_1, + EVENT_INVOKER_SAY_2, + EVENT_INVOKER_SAY_3, + EVENT_SUMMON_TOTEMS, + EVENT_ATTACK, + EVENT_TOTEMS_ATTACK, + EVENT_SUBMERGE, + EVENT_COMBAT_EMERGE, + EVENT_EMERGE_WARNING, - EVENT_SPELL_COLD_SLAP, - EVENT_SPELL_SUMMON_HAILSTONE, - EVENT_SPELL_SUMMON_COLDWAVE, + EVENT_SPELL_COLD_SLAP, + EVENT_SPELL_SUMMON_HAILSTONE, + EVENT_SPELL_SUMMON_COLDWAVE, }; class boss_ahune : public CreatureScript { public: - boss_ahune() : CreatureScript("boss_ahune") { } + boss_ahune() : CreatureScript("boss_ahune") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new boss_ahuneAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_ahuneAI (pCreature); + } - struct boss_ahuneAI : public ScriptedAI - { - boss_ahuneAI(Creature *c) : ScriptedAI(c), summons(me) - { - SetCombatMovement(false); - SetEquipmentSlots(false, 54806, EQUIP_UNEQUIP, EQUIP_UNEQUIP); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - InvokerGUID = 0; - events.Reset(); - events.RescheduleEvent(EVENT_EMERGE, 12000); - events.RescheduleEvent(EVENT_INVOKER_SAY_1, 1000); - events.RescheduleEvent(EVENT_SUMMON_TOTEMS, 4000); - } + struct boss_ahuneAI : public ScriptedAI + { + boss_ahuneAI(Creature *c) : ScriptedAI(c), summons(me) + { + SetCombatMovement(false); + SetEquipmentSlots(false, 54806, EQUIP_UNEQUIP, EQUIP_UNEQUIP); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + InvokerGUID = 0; + events.Reset(); + events.RescheduleEvent(EVENT_EMERGE, 12000); + events.RescheduleEvent(EVENT_INVOKER_SAY_1, 1000); + events.RescheduleEvent(EVENT_SUMMON_TOTEMS, 4000); + } - EventMap events; - SummonList summons; - uint64 InvokerGUID; + EventMap events; + SummonList summons; + uint64 InvokerGUID; - void StartPhase1() - { - me->CastSpell(me, SPELL_AHUNES_SHIELD, true); - events.RescheduleEvent(EVENT_TOTEMS_ATTACK, 80000); - events.RescheduleEvent(EVENT_SPELL_COLD_SLAP, 1200); - events.RescheduleEvent(EVENT_SPELL_SUMMON_HAILSTONE, 2000); - events.RescheduleEvent(EVENT_SPELL_SUMMON_COLDWAVE, 5000); - } + void StartPhase1() + { + me->CastSpell(me, SPELL_AHUNES_SHIELD, true); + events.RescheduleEvent(EVENT_TOTEMS_ATTACK, 80000); + events.RescheduleEvent(EVENT_SPELL_COLD_SLAP, 1200); + events.RescheduleEvent(EVENT_SPELL_SUMMON_HAILSTONE, 2000); + events.RescheduleEvent(EVENT_SPELL_SUMMON_COLDWAVE, 5000); + } - void EnterCombat(Unit* /*who*/) - { - DoZoneInCombat(); - events.Reset(); - StartPhase1(); - } + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + events.Reset(); + StartPhase1(); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim() && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch(events.GetEvent()) - { - case 0: - break; - case EVENT_EMERGE: - me->SetVisible(true); - me->CastSpell(me, SPELL_EMERGE_0, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_ATTACK, 2000); - break; - case EVENT_SUMMON_TOTEMS: - for (uint8 i=0; i<3; ++i) - DoSummon(NPC_TOTEM, TotemPos[i], 10*60*1000, TEMPSUMMON_TIMED_DESPAWN); - events.PopEvent(); - break; - case EVENT_INVOKER_SAY_1: - if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID)) - { - plr->MonsterSay("The Ice Stone has melted!", LANG_UNIVERSAL, 0); - plr->CastSpell(plr, SPELL_MAKE_BONFIRE, true); - } - events.PopEvent(); - events.RescheduleEvent(EVENT_INVOKER_SAY_2, 2000); - break; - case EVENT_INVOKER_SAY_2: - if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID)) - plr->MonsterSay("Ahune, your strength grows no more!", LANG_UNIVERSAL, 0); - events.PopEvent(); - events.RescheduleEvent(EVENT_INVOKER_SAY_3, 2000); - break; - case EVENT_INVOKER_SAY_3: - if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID)) - plr->MonsterSay("Your frozen reign will not come to pass!", LANG_UNIVERSAL, 0); - events.PopEvent(); - break; - case EVENT_ATTACK: - events.Reset(); - if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID)) - AttackStart(plr); - me->SetInCombatWithZone(); - if (!me->IsInCombat()) - { - EnterEvadeMode(); - return; - } - else - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - break; - case EVENT_TOTEMS_ATTACK: - for (uint8 i=0; i<3; ++i) - if (Creature* bunny = me->FindNearestCreature(NPC_TOTEM_BUNNY_1+i, 150.0f, true)) - bunny->CastSpell(me, SPELL_TOTEM_BEAM, false); - events.PopEvent(); - events.RescheduleEvent(EVENT_SUBMERGE, 10000); - break; - case EVENT_SUBMERGE: - me->MonsterTextEmote(TEXT_RETREAT, 0, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->CastSpell(me, SPELL_SUBMERGE_0, true); - me->CastSpell(me, SPELL_SELF_STUN, true); - if (Creature* c = DoSummon(NPC_FROZEN_CORE, *me, 24000, TEMPSUMMON_TIMED_DESPAWN)) - { - c->SetHealth(me->GetHealth()); - } - events.Reset(); - events.RescheduleEvent(EVENT_COMBAT_EMERGE, 25000); - events.RescheduleEvent(EVENT_EMERGE_WARNING, 20000); - break; - case EVENT_EMERGE_WARNING: - me->MonsterTextEmote(TEXT_RESURFACE, 0, true); - events.PopEvent(); - break; - case EVENT_COMBAT_EMERGE: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveAura(SPELL_SELF_STUN); - me->CastSpell(me, SPELL_EMERGE_0, false); - // me->CastSpell(me, SPELL_AHUNE_RESURFACES, true); // done in SummonedCreatureDespawn - me->RemoveAura(SPELL_SUBMERGE_0); - events.PopEvent(); - StartPhase1(); - break; + switch(events.GetEvent()) + { + case 0: + break; + case EVENT_EMERGE: + me->SetVisible(true); + me->CastSpell(me, SPELL_EMERGE_0, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_ATTACK, 2000); + break; + case EVENT_SUMMON_TOTEMS: + for (uint8 i=0; i<3; ++i) + DoSummon(NPC_TOTEM, TotemPos[i], 10*60*1000, TEMPSUMMON_TIMED_DESPAWN); + events.PopEvent(); + break; + case EVENT_INVOKER_SAY_1: + if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID)) + { + plr->MonsterSay("The Ice Stone has melted!", LANG_UNIVERSAL, 0); + plr->CastSpell(plr, SPELL_MAKE_BONFIRE, true); + } + events.PopEvent(); + events.RescheduleEvent(EVENT_INVOKER_SAY_2, 2000); + break; + case EVENT_INVOKER_SAY_2: + if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID)) + plr->MonsterSay("Ahune, your strength grows no more!", LANG_UNIVERSAL, 0); + events.PopEvent(); + events.RescheduleEvent(EVENT_INVOKER_SAY_3, 2000); + break; + case EVENT_INVOKER_SAY_3: + if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID)) + plr->MonsterSay("Your frozen reign will not come to pass!", LANG_UNIVERSAL, 0); + events.PopEvent(); + break; + case EVENT_ATTACK: + events.Reset(); + if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID)) + AttackStart(plr); + me->SetInCombatWithZone(); + if (!me->IsInCombat()) + { + EnterEvadeMode(); + return; + } + else + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + break; + case EVENT_TOTEMS_ATTACK: + for (uint8 i=0; i<3; ++i) + if (Creature* bunny = me->FindNearestCreature(NPC_TOTEM_BUNNY_1+i, 150.0f, true)) + bunny->CastSpell(me, SPELL_TOTEM_BEAM, false); + events.PopEvent(); + events.RescheduleEvent(EVENT_SUBMERGE, 10000); + break; + case EVENT_SUBMERGE: + me->MonsterTextEmote(TEXT_RETREAT, 0, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->CastSpell(me, SPELL_SUBMERGE_0, true); + me->CastSpell(me, SPELL_SELF_STUN, true); + if (Creature* c = DoSummon(NPC_FROZEN_CORE, *me, 24000, TEMPSUMMON_TIMED_DESPAWN)) + { + c->SetHealth(me->GetHealth()); + } + events.Reset(); + events.RescheduleEvent(EVENT_COMBAT_EMERGE, 25000); + events.RescheduleEvent(EVENT_EMERGE_WARNING, 20000); + break; + case EVENT_EMERGE_WARNING: + me->MonsterTextEmote(TEXT_RESURFACE, 0, true); + events.PopEvent(); + break; + case EVENT_COMBAT_EMERGE: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveAura(SPELL_SELF_STUN); + me->CastSpell(me, SPELL_EMERGE_0, false); + // me->CastSpell(me, SPELL_AHUNE_RESURFACES, true); // done in SummonedCreatureDespawn + me->RemoveAura(SPELL_SUBMERGE_0); + events.PopEvent(); + StartPhase1(); + break; - case EVENT_SPELL_COLD_SLAP: - if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 5.0f, true)) - if (target->GetPositionZ() < me->GetPositionZ()+6.0f) - { - int32 dmg = urand(5500,6000); - me->CastCustomSpell(target, SPELL_COLD_SLAP, &dmg, NULL, NULL, false); - float x, y, z; - target->GetNearPoint(target, x, y, z, target->GetObjectSize(), 30.0f, target->GetAngle(me->GetPositionX(), me->GetPositionY()) + M_PI); - target->GetMotionMaster()->MoveJump(x, y, z+20.0f, 10.0f, 20.0f); - } - events.RepeatEvent(1500); - break; - case EVENT_SPELL_SUMMON_HAILSTONE: - { - float dist = (float)urand(3,10); - float angle = rand_norm()*2*M_PI; - me->CastSpell(MinionSummonPos.GetPositionX()+cos(angle)*dist, MinionSummonPos.GetPositionY()+sin(angle)*dist, MinionSummonPos.GetPositionZ(), SPELL_SUMMON_HAILSTONE, false); - events.RepeatEvent(30000); - } - break; - case EVENT_SPELL_SUMMON_COLDWAVE: - for (uint8 i=0; i<2; ++i) - { - float dist = (float)urand(3,10); - float angle = rand_norm()*2*M_PI; - me->CastSpell(MinionSummonPos.GetPositionX()+cos(angle)*dist, MinionSummonPos.GetPositionY()+sin(angle)*dist, MinionSummonPos.GetPositionZ(), SPELL_SUMMON_COLDWAVE, false); - } - { - float dist = (float)urand(3,10); - float angle = rand_norm()*2*M_PI; - me->CastSpell(MinionSummonPos.GetPositionX()+cos(angle)*dist, MinionSummonPos.GetPositionY()+sin(angle)*dist, MinionSummonPos.GetPositionZ(), SPELL_SUMMON_FROSTWIND, false); - } - events.RepeatEvent(6000); - break; + case EVENT_SPELL_COLD_SLAP: + if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 5.0f, true)) + if (target->GetPositionZ() < me->GetPositionZ()+6.0f) + { + int32 dmg = urand(5500,6000); + me->CastCustomSpell(target, SPELL_COLD_SLAP, &dmg, NULL, NULL, false); + float x, y, z; + target->GetNearPoint(target, x, y, z, target->GetObjectSize(), 30.0f, target->GetAngle(me->GetPositionX(), me->GetPositionY()) + M_PI); + target->GetMotionMaster()->MoveJump(x, y, z+20.0f, 10.0f, 20.0f); + } + events.RepeatEvent(1500); + break; + case EVENT_SPELL_SUMMON_HAILSTONE: + { + float dist = (float)urand(3,10); + float angle = rand_norm()*2*M_PI; + me->CastSpell(MinionSummonPos.GetPositionX()+cos(angle)*dist, MinionSummonPos.GetPositionY()+sin(angle)*dist, MinionSummonPos.GetPositionZ(), SPELL_SUMMON_HAILSTONE, false); + events.RepeatEvent(30000); + } + break; + case EVENT_SPELL_SUMMON_COLDWAVE: + for (uint8 i=0; i<2; ++i) + { + float dist = (float)urand(3,10); + float angle = rand_norm()*2*M_PI; + me->CastSpell(MinionSummonPos.GetPositionX()+cos(angle)*dist, MinionSummonPos.GetPositionY()+sin(angle)*dist, MinionSummonPos.GetPositionZ(), SPELL_SUMMON_COLDWAVE, false); + } + { + float dist = (float)urand(3,10); + float angle = rand_norm()*2*M_PI; + me->CastSpell(MinionSummonPos.GetPositionX()+cos(angle)*dist, MinionSummonPos.GetPositionY()+sin(angle)*dist, MinionSummonPos.GetPositionZ(), SPELL_SUMMON_FROSTWIND, false); + } + events.RepeatEvent(6000); + break; - default: - events.PopEvent(); - break; - } + default: + events.PopEvent(); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - void EnterEvadeMode() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - events.Reset(); - summons.DespawnAll(); - me->DespawnOrUnsummon(1); + void EnterEvadeMode() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + events.Reset(); + summons.DespawnAll(); + me->DespawnOrUnsummon(1); - ScriptedAI::EnterEvadeMode(); - } + ScriptedAI::EnterEvadeMode(); + } - void JustSummoned(Creature* summon) - { - if (summon) - { - summons.Summon(summon); - summon->SetInCombatWithZone(); - } - } + void JustSummoned(Creature* summon) + { + if (summon) + { + summons.Summon(summon); + summon->SetInCombatWithZone(); + } + } - void SummonedCreatureDespawn(Creature* summon) - { - if (summon && summon->GetEntry() == NPC_FROZEN_CORE) - { - if (summon->GetHealth() > 0) - { - me->SetHealth(summon->GetHealth()); - summon->CastSpell(summon, SPELL_AHUNE_RESURFACES, true); - } - else - Unit::Kill(me, me, false); - } - } + void SummonedCreatureDespawn(Creature* summon) + { + if (summon && summon->GetEntry() == NPC_FROZEN_CORE) + { + if (summon->GetHealth() > 0) + { + me->SetHealth(summon->GetHealth()); + summon->CastSpell(summon, SPELL_AHUNE_RESURFACES, true); + } + else + Unit::Kill(me, me, false); + } + } - void JustDied(Unit* killer) - { - summons.DespawnAll(); - me->DespawnOrUnsummon(15000); - if (GameObject* chest = me->SummonGameObject(187892, MinionSummonPos.GetPositionX(), MinionSummonPos.GetPositionY(), MinionSummonPos.GetPositionZ(), M_PI/2, 0.0f, 0.0f, 0.0f, 0.0f, 900000000)) // loot - me->RemoveGameObject(chest, false); + void JustDied(Unit* killer) + { + summons.DespawnAll(); + me->DespawnOrUnsummon(15000); + if (GameObject* chest = me->SummonGameObject(187892, MinionSummonPos.GetPositionX(), MinionSummonPos.GetPositionY(), MinionSummonPos.GetPositionZ(), M_PI/2, 0.0f, 0.0f, 0.0f, 0.0f, 900000000)) // loot + me->RemoveGameObject(chest, false); - bool finished = false; - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (!players.isEmpty()) - for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) - if (Player* player = i->GetSource()) - { - player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 25740, 1, me); - - if (player->GetGroup() && !finished) - { - finished = true; - sLFGMgr->FinishDungeon(player->GetGroup()->GetGUID(), 286, me->FindMap()); - } - } - } - }; + bool finished = false; + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (!players.isEmpty()) + for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) + if (Player* player = i->GetSource()) + { + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 25740, 1, me); + + if (player->GetGroup() && !finished) + { + finished = true; + sLFGMgr->FinishDungeon(player->GetGroup()->GetGUID(), 286, me->FindMap()); + } + } + } + }; }; class go_ahune_ice_stone : public GameObjectScript @@ -318,74 +318,74 @@ class go_ahune_ice_stone : public GameObjectScript public: go_ahune_ice_stone() : GameObjectScript("go_ahune_ice_stone") { } - bool OnGossipHello(Player *pPlayer, GameObject *pGO) - { - if (!pPlayer || !pGO) - return true; - if (!pPlayer->HasItemCount(ITEM_MAGMA_TOTEM)) - return true; - if (Creature* c = pGO->FindNearestCreature(NPC_AHUNE, 200.0f, true)) - return true; + bool OnGossipHello(Player *pPlayer, GameObject *pGO) + { + if (!pPlayer || !pGO) + return true; + if (!pPlayer->HasItemCount(ITEM_MAGMA_TOTEM)) + return true; + if (Creature* c = pGO->FindNearestCreature(NPC_AHUNE, 200.0f, true)) + return true; - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Disturb the stone and summon Lord Ahune.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1337); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_ID, pGO->GetGUID()); - return true; - } + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Disturb the stone and summon Lord Ahune.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1337); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_ID, pGO->GetGUID()); + return true; + } - bool OnGossipSelect(Player *pPlayer, GameObject *pGO, uint32 /*sender*/, uint32 action) - { - if (!pPlayer || !pGO) - return true; - if (action != GOSSIP_ACTION_INFO_DEF+1337) - return true; - if (!pPlayer->HasItemCount(ITEM_MAGMA_TOTEM)) - return true; - if (Creature* c = pGO->FindNearestCreature(NPC_AHUNE, 200.0f, true)) - return true; + bool OnGossipSelect(Player *pPlayer, GameObject *pGO, uint32 /*sender*/, uint32 action) + { + if (!pPlayer || !pGO) + return true; + if (action != GOSSIP_ACTION_INFO_DEF+1337) + return true; + if (!pPlayer->HasItemCount(ITEM_MAGMA_TOTEM)) + return true; + if (Creature* c = pGO->FindNearestCreature(NPC_AHUNE, 200.0f, true)) + return true; - if (Creature* c = pGO->SummonCreature(NPC_AHUNE, AhuneSummonPos, TEMPSUMMON_MANUAL_DESPAWN)) - { - pPlayer->DestroyItemCount(ITEM_MAGMA_TOTEM, 1, true, false); - pPlayer->AreaExploredOrEventHappens(QUEST_SUMMON_AHUNE); // auto rewarded + if (Creature* c = pGO->SummonCreature(NPC_AHUNE, AhuneSummonPos, TEMPSUMMON_MANUAL_DESPAWN)) + { + pPlayer->DestroyItemCount(ITEM_MAGMA_TOTEM, 1, true, false); + pPlayer->AreaExploredOrEventHappens(QUEST_SUMMON_AHUNE); // auto rewarded - c->SetVisible(false); - c->SetDisplayId(AHUNE_DEFAULT_MODEL); - c->SetFloatValue(UNIT_FIELD_COMBATREACH, 18.0f); - CAST_AI(boss_ahune::boss_ahuneAI, c->AI())->InvokerGUID = pPlayer->GetGUID(); - if (Creature* bunny = pGO->SummonCreature(NPC_AHUNE_SUMMON_LOC_BUNNY, AhuneSummonPos, TEMPSUMMON_TIMED_DESPAWN, 12000)) - if (Creature* crystal_trigger = pGO->SummonCreature(WORLD_TRIGGER, pGO->GetPositionX(), pGO->GetPositionY(), 5.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 12000)) - crystal_trigger->CastSpell(bunny, SPELL_STARTING_BEAM, false); - } + c->SetVisible(false); + c->SetDisplayId(AHUNE_DEFAULT_MODEL); + c->SetFloatValue(UNIT_FIELD_COMBATREACH, 18.0f); + CAST_AI(boss_ahune::boss_ahuneAI, c->AI())->InvokerGUID = pPlayer->GetGUID(); + if (Creature* bunny = pGO->SummonCreature(NPC_AHUNE_SUMMON_LOC_BUNNY, AhuneSummonPos, TEMPSUMMON_TIMED_DESPAWN, 12000)) + if (Creature* crystal_trigger = pGO->SummonCreature(WORLD_TRIGGER, pGO->GetPositionX(), pGO->GetPositionY(), 5.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 12000)) + crystal_trigger->CastSpell(bunny, SPELL_STARTING_BEAM, false); + } - pPlayer->CLOSE_GOSSIP_MENU(); - return true; - } + pPlayer->CLOSE_GOSSIP_MENU(); + return true; + } }; class npc_ahune_frozen_core : public CreatureScript { public: - npc_ahune_frozen_core() : CreatureScript("npc_ahune_frozen_core") { } + npc_ahune_frozen_core() : CreatureScript("npc_ahune_frozen_core") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_ahune_frozen_coreAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ahune_frozen_coreAI (pCreature); + } - struct npc_ahune_frozen_coreAI : public NullCreatureAI - { - npc_ahune_frozen_coreAI(Creature *c) : NullCreatureAI(c) {} + struct npc_ahune_frozen_coreAI : public NullCreatureAI + { + npc_ahune_frozen_coreAI(Creature *c) : NullCreatureAI(c) {} - void JustDied(Unit* /*killer*/) - { - me->DespawnOrUnsummon(); - } - }; + void JustDied(Unit* /*killer*/) + { + me->DespawnOrUnsummon(); + } + }; }; void AddSC_boss_ahune() { - new go_ahune_ice_stone(); - new boss_ahune(); - new npc_ahune_frozen_core(); + new go_ahune_ice_stone(); + new boss_ahune(); + new npc_ahune_frozen_core(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp index 2eb279032..1467ab12f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp @@ -8,18 +8,18 @@ REWRITTEN BY XINEF enum HydromancerThespia { - SAY_SUMMON = 0, - SAY_AGGRO = 1, - SAY_SLAY = 2, - SAY_DEAD = 3, + SAY_SUMMON = 0, + SAY_AGGRO = 1, + SAY_SLAY = 2, + SAY_DEAD = 3, - SPELL_LIGHTNING_CLOUD = 25033, - SPELL_LUNG_BURST = 31481, - SPELL_ENVELOPING_WINDS = 31718, + SPELL_LIGHTNING_CLOUD = 25033, + SPELL_LUNG_BURST = 31481, + SPELL_ENVELOPING_WINDS = 31718, - EVENT_SPELL_LIGHTNING = 1, - EVENT_SPELL_LUNG = 2, - EVENT_SPELL_ENVELOPING = 3 + EVENT_SPELL_LIGHTNING = 1, + EVENT_SPELL_LUNG = 2, + EVENT_SPELL_ENVELOPING = 3 }; class boss_hydromancer_thespia : public CreatureScript @@ -40,7 +40,7 @@ public: } InstanceScript* instance; - EventMap events; + EventMap events; void Reset() { @@ -58,16 +58,16 @@ public: void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_LIGHTNING, 15000); - events.ScheduleEvent(EVENT_SPELL_LUNG, 7000); - events.ScheduleEvent(EVENT_SPELL_ENVELOPING, 9000); + events.ScheduleEvent(EVENT_SPELL_LIGHTNING, 15000); + events.ScheduleEvent(EVENT_SPELL_LUNG, 7000); + events.ScheduleEvent(EVENT_SPELL_ENVELOPING, 9000); if (instance) instance->SetData(TYPE_HYDROMANCER_THESPIA, IN_PROGRESS); @@ -78,27 +78,27 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_SPELL_LIGHTNING: - for (uint8 i = 0; i < DUNGEON_MODE(1, 2); ++i) - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_LIGHTNING_CLOUD, false); - events.RepeatEvent(urand(15000, 25000)); - break; - case EVENT_SPELL_LUNG: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_SPELL_LIGHTNING: + for (uint8 i = 0; i < DUNGEON_MODE(1, 2); ++i) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_LIGHTNING_CLOUD, false); + events.RepeatEvent(urand(15000, 25000)); + break; + case EVENT_SPELL_LUNG: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_LUNG_BURST); - events.RepeatEvent(urand(7000, 12000)); - break; - case EVENT_SPELL_ENVELOPING: - for (uint8 i = 0; i < DUNGEON_MODE(1, 2); ++i) - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_ENVELOPING_WINDS, false); - events.RepeatEvent(urand(10000, 15000)); - break; - } + events.RepeatEvent(urand(7000, 12000)); + break; + case EVENT_SPELL_ENVELOPING: + for (uint8 i = 0; i < DUNGEON_MODE(1, 2); ++i) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_ENVELOPING_WINDS, false); + events.RepeatEvent(urand(10000, 15000)); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp index cf4304dcc..379d93c13 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp @@ -8,26 +8,26 @@ REWRITTEN BY XINEF enum MekgineerSteamrigger { - SAY_MECHANICS = 0, - SAY_AGGRO = 1, - SAY_SLAY = 2, - SAY_DEATH = 3, + SAY_MECHANICS = 0, + SAY_AGGRO = 1, + SAY_SLAY = 2, + SAY_DEATH = 3, - SPELL_SUPER_SHRINK_RAY = 31485, - SPELL_SAW_BLADE = 31486, - SPELL_ELECTRIFIED_NET = 35107, - SPELL_REPAIR_N = 31532, - SPELL_REPAIR_H = 37936, + SPELL_SUPER_SHRINK_RAY = 31485, + SPELL_SAW_BLADE = 31486, + SPELL_ELECTRIFIED_NET = 35107, + SPELL_REPAIR_N = 31532, + SPELL_REPAIR_H = 37936, - NPC_STREAMRIGGER_MECHANIC = 17951, + NPC_STREAMRIGGER_MECHANIC = 17951, - EVENT_CHECK_HP25 = 1, - EVENT_CHECK_HP50 = 2, - EVENT_CHECK_HP75 = 3, - EVENT_SPELL_SHRINK = 4, - EVENT_SPELL_SAW = 5, - EVENT_SPELL_NET = 6 - + EVENT_CHECK_HP25 = 1, + EVENT_CHECK_HP50 = 2, + EVENT_CHECK_HP75 = 3, + EVENT_SPELL_SHRINK = 4, + EVENT_SPELL_SAW = 5, + EVENT_SPELL_NET = 6 + }; class boss_mekgineer_steamrigger : public CreatureScript @@ -48,7 +48,7 @@ public: } InstanceScript* instance; - EventMap events; + EventMap events; void Reset() { @@ -66,19 +66,19 @@ public: void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_SHRINK, 20000); - events.ScheduleEvent(EVENT_SPELL_SAW, 15000); - events.ScheduleEvent(EVENT_SPELL_NET, 10000); - events.ScheduleEvent(EVENT_CHECK_HP75, 5000); - events.ScheduleEvent(EVENT_CHECK_HP50, 5000); - events.ScheduleEvent(EVENT_CHECK_HP25, 5000); + events.ScheduleEvent(EVENT_SPELL_SHRINK, 20000); + events.ScheduleEvent(EVENT_SPELL_SAW, 15000); + events.ScheduleEvent(EVENT_SPELL_NET, 10000); + events.ScheduleEvent(EVENT_CHECK_HP75, 5000); + events.ScheduleEvent(EVENT_CHECK_HP50, 5000); + events.ScheduleEvent(EVENT_CHECK_HP25, 5000); if (instance) instance->SetData(TYPE_MEKGINEER_STEAMRIGGER, IN_PROGRESS); @@ -88,54 +88,54 @@ public: { Talk(SAY_MECHANICS); - me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX()+15.0f, me->GetPositionY()+15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX()-15.0f, me->GetPositionY()+15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX()-15.0f, me->GetPositionY()-15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - if (urand(0,1)) - me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX()+15.0f, me->GetPositionY()-15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX()+15.0f, me->GetPositionY()+15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX()-15.0f, me->GetPositionY()+15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX()-15.0f, me->GetPositionY()-15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + if (urand(0,1)) + me->SummonCreature(NPC_STREAMRIGGER_MECHANIC, me->GetPositionX()+15.0f, me->GetPositionY()-15.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); } - void JustSummoned(Creature* cr) - { - cr->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f); - } + void JustSummoned(Creature* cr) + { + cr->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f); + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - switch (uint32 eventId = events.GetEvent()) - { - case EVENT_SPELL_SHRINK: - me->CastSpell(me->GetVictim(), SPELL_SUPER_SHRINK_RAY, false); - events.RepeatEvent(20000); - break; - case EVENT_SPELL_SAW: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) - me->CastSpell(target, SPELL_SAW_BLADE, false); - else - me->CastSpell(me->GetVictim(), SPELL_SAW_BLADE, false); - events.RepeatEvent(15000); - break; - case EVENT_SPELL_NET: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_ELECTRIFIED_NET, false); - events.RepeatEvent(10000); - break; - case EVENT_CHECK_HP25: - case EVENT_CHECK_HP50: - case EVENT_CHECK_HP75: - if (me->HealthBelowPct(eventId*25)) - { - SummonMechanics(); - events.PopEvent(); - return; - } - events.RepeatEvent(2000); - break; - } + events.Update(diff); + switch (uint32 eventId = events.GetEvent()) + { + case EVENT_SPELL_SHRINK: + me->CastSpell(me->GetVictim(), SPELL_SUPER_SHRINK_RAY, false); + events.RepeatEvent(20000); + break; + case EVENT_SPELL_SAW: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) + me->CastSpell(target, SPELL_SAW_BLADE, false); + else + me->CastSpell(me->GetVictim(), SPELL_SAW_BLADE, false); + events.RepeatEvent(15000); + break; + case EVENT_SPELL_NET: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_ELECTRIFIED_NET, false); + events.RepeatEvent(10000); + break; + case EVENT_CHECK_HP25: + case EVENT_CHECK_HP50: + case EVENT_CHECK_HP75: + if (me->HealthBelowPct(eventId*25)) + { + SummonMechanics(); + events.PopEvent(); + return; + } + events.RepeatEvent(2000); + break; + } DoMeleeAttackIfReady(); } @@ -159,31 +159,31 @@ public: } uint32 repairTimer; - uint64 bossGUID; + uint64 bossGUID; void Reset() { repairTimer = 0; - bossGUID = 0; - if (InstanceScript* instance = me->GetInstanceScript()) - bossGUID = instance->GetData64(TYPE_MEKGINEER_STEAMRIGGER); + bossGUID = 0; + if (InstanceScript* instance = me->GetInstanceScript()) + bossGUID = instance->GetData64(TYPE_MEKGINEER_STEAMRIGGER); } void MoveInLineOfSight(Unit* /*who*/) {} void UpdateAI(uint32 diff) { - repairTimer += diff; + repairTimer += diff; if (repairTimer >= 2000) { - repairTimer = 0; + repairTimer = 0; if (Unit* boss = ObjectAccessor::GetUnit(*me, bossGUID)) { if (me->IsWithinDistInMap(boss, 13.0f)) - if (!me->HasUnitState(UNIT_STATE_CASTING)) + if (!me->HasUnitState(UNIT_STATE_CASTING)) me->CastSpell(me, DUNGEON_MODE(SPELL_REPAIR_N, SPELL_REPAIR_H), false); } - return; + return; } if (!UpdateVictim()) diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp index d12d4df37..d30af83d2 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp @@ -21,11 +21,11 @@ enum NagaDistiller SPELL_WARLORDS_RAGE_NAGA = 31543, SPELL_WARLORDS_RAGE_PROC = 36453, - NPC_NAGA_DISTILLER = 17954, + NPC_NAGA_DISTILLER = 17954, - EVENT_SPELL_REFLECTION = 1, - EVENT_SPELL_IMPALE = 2, - EVENT_SPELL_RAGE = 3 + EVENT_SPELL_REFLECTION = 1, + EVENT_SPELL_IMPALE = 2, + EVENT_SPELL_RAGE = 3 }; class boss_warlord_kalithresh : public CreatureScript @@ -46,7 +46,7 @@ public: } InstanceScript* instance; - EventMap events; + EventMap events; void Reset() { @@ -58,9 +58,9 @@ public: void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_REFLECTION, 10000); - events.ScheduleEvent(EVENT_SPELL_IMPALE, urand(7000, 14000)); - events.ScheduleEvent(EVENT_SPELL_RAGE, 20000); + events.ScheduleEvent(EVENT_SPELL_REFLECTION, 10000); + events.ScheduleEvent(EVENT_SPELL_IMPALE, urand(7000, 14000)); + events.ScheduleEvent(EVENT_SPELL_RAGE, 20000); if (instance) instance->SetData(TYPE_WARLORD_KALITHRESH, IN_PROGRESS); @@ -68,8 +68,8 @@ public: void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) @@ -84,28 +84,28 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_SPELL_REFLECTION: - me->CastSpell(me, SPELL_SPELL_REFLECTION, false); - events.RepeatEvent(urand(15000, 20000)); - break; - case EVENT_SPELL_IMPALE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true)) - me->CastSpell(target, SPELL_IMPALE, false); - events.RepeatEvent(urand(7500, 12500)); - break; - case EVENT_SPELL_RAGE: - if (Creature* distiller = me->FindNearestCreature(NPC_NAGA_DISTILLER, 100.0f)) - { - Talk(SAY_REGEN); - //me->CastSpell(me, SPELL_WARLORDS_RAGE, false); - distiller->AI()->DoAction(1); - } - events.RepeatEvent(45000); - break; - } + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_SPELL_REFLECTION: + me->CastSpell(me, SPELL_SPELL_REFLECTION, false); + events.RepeatEvent(urand(15000, 20000)); + break; + case EVENT_SPELL_IMPALE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true)) + me->CastSpell(target, SPELL_IMPALE, false); + events.RepeatEvent(urand(7500, 12500)); + break; + case EVENT_SPELL_RAGE: + if (Creature* distiller = me->FindNearestCreature(NPC_NAGA_DISTILLER, 100.0f)) + { + Talk(SAY_REGEN); + //me->CastSpell(me, SPELL_WARLORDS_RAGE, false); + distiller->AI()->DoAction(1); + } + events.RepeatEvent(45000); + break; + } DoMeleeAttackIfReady(); } @@ -131,39 +131,39 @@ public: } InstanceScript* instance; - uint32 spellTimer; + uint32 spellTimer; void Reset() { - spellTimer = 0; + spellTimer = 0; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } void DoAction(int32 param) { - if (param != 1) - return; + if (param != 1) + return; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->CastSpell(me, SPELL_WARLORDS_RAGE_NAGA, true); - spellTimer = 1; + me->CastSpell(me, SPELL_WARLORDS_RAGE_NAGA, true); + spellTimer = 1; } void UpdateAI(uint32 diff) - { - if (spellTimer) - { - spellTimer += diff; - if (spellTimer >= 12000) - { - if (Creature* kali = me->FindNearestCreature(NPC_WARLORD_KALITHRESH, 100.0f)) - kali->CastSpell(kali, SPELL_WARLORDS_RAGE_PROC, true); - Unit::Kill(me, me); - } - } - } + { + if (spellTimer) + { + spellTimer += diff; + if (spellTimer >= 12000) + { + if (Creature* kali = me->FindNearestCreature(NPC_WARLORD_KALITHRESH, 100.0f)) + kali->CastSpell(kali, SPELL_WARLORDS_RAGE_PROC, true); + Unit::Kill(me, me); + } + } + } }; }; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index f288f500f..0c94ee147 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -18,18 +18,18 @@ public: return false; if (go->GetEntry() == GO_ACCESS_PANEL_HYDRO) - if (instance->GetData(TYPE_HYDROMANCER_THESPIA) == DONE) - { - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - instance->SetData(TYPE_HYDROMANCER_THESPIA, SPECIAL); - } + if (instance->GetData(TYPE_HYDROMANCER_THESPIA) == DONE) + { + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + instance->SetData(TYPE_HYDROMANCER_THESPIA, SPECIAL); + } if (go->GetEntry() == GO_ACCESS_PANEL_MEK) - if (instance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == DONE) - { - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - instance->SetData(TYPE_MEKGINEER_STEAMRIGGER, SPECIAL); - } + if (instance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == DONE) + { + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + instance->SetData(TYPE_MEKGINEER_STEAMRIGGER, SPECIAL); + } return true; } @@ -38,172 +38,172 @@ public: class instance_steam_vault : public InstanceMapScript { - public: - instance_steam_vault() : InstanceMapScript("instance_steam_vault", 545) { } + public: + instance_steam_vault() : InstanceMapScript("instance_steam_vault", 545) { } - InstanceScript* GetInstanceScript(InstanceMap* map) const - { - return new instance_steam_vault_InstanceMapScript(map); - } + InstanceScript* GetInstanceScript(InstanceMap* map) const + { + return new instance_steam_vault_InstanceMapScript(map); + } - struct instance_steam_vault_InstanceMapScript : public InstanceScript - { - instance_steam_vault_InstanceMapScript(Map* map) : InstanceScript(map) {} + struct instance_steam_vault_InstanceMapScript : public InstanceScript + { + instance_steam_vault_InstanceMapScript(Map* map) : InstanceScript(map) {} - uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 MekgineerGUID; - uint64 MainChambersDoor; - uint64 AccessPanelHydro; - uint64 AccessPanelMek; + uint64 MekgineerGUID; + uint64 MainChambersDoor; + uint64 AccessPanelHydro; + uint64 AccessPanelMek; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - MekgineerGUID = 0; - MainChambersDoor = 0; - AccessPanelHydro = 0; - AccessPanelMek = 0; - } + MekgineerGUID = 0; + MainChambersDoor = 0; + AccessPanelHydro = 0; + AccessPanelMek = 0; + } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + return true; - return false; - } + return false; + } - void OnCreatureCreate(Creature* creature) - { - switch (creature->GetEntry()) - { - case NPC_MEKGINEER_STEAMRIGGER: MekgineerGUID = creature->GetGUID(); break; - } - } + void OnCreatureCreate(Creature* creature) + { + switch (creature->GetEntry()) + { + case NPC_MEKGINEER_STEAMRIGGER: MekgineerGUID = creature->GetGUID(); break; + } + } - void OnGameObjectCreate(GameObject* go) - { - switch (go->GetEntry()) - { - case GO_MAIN_CHAMBERS_DOOR: - MainChambersDoor = go->GetGUID(); - if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL && GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) - HandleGameObject(0, true, go); - break; - case GO_ACCESS_PANEL_HYDRO: - AccessPanelHydro = go->GetGUID(); - if (GetData(TYPE_HYDROMANCER_THESPIA) == DONE) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - else if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL) - HandleGameObject(0, true, go); - break; - case GO_ACCESS_PANEL_MEK: - AccessPanelMek = go->GetGUID(); - if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == DONE) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - else if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) - HandleGameObject(0, true, go); - break; - } - } + void OnGameObjectCreate(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_MAIN_CHAMBERS_DOOR: + MainChambersDoor = go->GetGUID(); + if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL && GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) + HandleGameObject(0, true, go); + break; + case GO_ACCESS_PANEL_HYDRO: + AccessPanelHydro = go->GetGUID(); + if (GetData(TYPE_HYDROMANCER_THESPIA) == DONE) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + else if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL) + HandleGameObject(0, true, go); + break; + case GO_ACCESS_PANEL_MEK: + AccessPanelMek = go->GetGUID(); + if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == DONE) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + else if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) + HandleGameObject(0, true, go); + break; + } + } - void SetData(uint32 type, uint32 data) - { - switch (type) - { - case TYPE_HYDROMANCER_THESPIA: - if (data == SPECIAL) - { - if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) - HandleGameObject(MainChambersDoor, true); - } - else if (data == DONE) - { - if (GameObject* panel = instance->GetGameObject(AccessPanelHydro)) - panel->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case TYPE_HYDROMANCER_THESPIA: + if (data == SPECIAL) + { + if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) + HandleGameObject(MainChambersDoor, true); + } + else if (data == DONE) + { + if (GameObject* panel = instance->GetGameObject(AccessPanelHydro)) + panel->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } - m_auiEncounter[type] = data; - break; - case TYPE_MEKGINEER_STEAMRIGGER: - if (data == SPECIAL) - { - if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL) - HandleGameObject(MainChambersDoor, true); - } - else if (data == DONE) - { - if (GameObject* panel = instance->GetGameObject(AccessPanelMek)) - panel->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } + m_auiEncounter[type] = data; + break; + case TYPE_MEKGINEER_STEAMRIGGER: + if (data == SPECIAL) + { + if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL) + HandleGameObject(MainChambersDoor, true); + } + else if (data == DONE) + { + if (GameObject* panel = instance->GetGameObject(AccessPanelMek)) + panel->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } - m_auiEncounter[type] = data; - break; - case TYPE_WARLORD_KALITHRESH: - m_auiEncounter[type] = data; - break; - } + m_auiEncounter[type] = data; + break; + case TYPE_WARLORD_KALITHRESH: + m_auiEncounter[type] = data; + break; + } - if (data == DONE || data == SPECIAL) - SaveToDB(); - } + if (data == DONE || data == SPECIAL) + SaveToDB(); + } - uint32 GetData(uint32 type) const - { - switch (type) - { - case TYPE_HYDROMANCER_THESPIA: - case TYPE_MEKGINEER_STEAMRIGGER: - case TYPE_WARLORD_KALITHRESH: - return m_auiEncounter[type]; - } - return 0; - } + uint32 GetData(uint32 type) const + { + switch (type) + { + case TYPE_HYDROMANCER_THESPIA: + case TYPE_MEKGINEER_STEAMRIGGER: + case TYPE_WARLORD_KALITHRESH: + return m_auiEncounter[type]; + } + return 0; + } - uint64 GetData64(uint32 data) const - { - if (data == TYPE_MEKGINEER_STEAMRIGGER) - return MekgineerGUID; - return 0; - } + uint64 GetData64(uint32 data) const + { + if (data == TYPE_MEKGINEER_STEAMRIGGER) + return MekgineerGUID; + return 0; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << "S V " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; + std::ostringstream stream; + stream << "S V " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; - OUT_SAVE_INST_DATA_COMPLETE; - return stream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return stream.str(); + } - void Load(const char* strIn) - { - if (!strIn) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } + void Load(const char* strIn) + { + if (!strIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - char dataHead1, dataHead2; - std::istringstream loadStream(strIn); - loadStream >> dataHead1 >> dataHead2; + char dataHead1, dataHead2; + std::istringstream loadStream(strIn); + loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'S' && dataHead2 == 'V') - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - loadStream >> m_auiEncounter[i]; - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } + if (dataHead1 == 'S' && dataHead2 == 'V') + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + loadStream >> m_auiEncounter[i]; + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } - OUT_LOAD_INST_DATA_COMPLETE; - } - }; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; }; void AddSC_instance_steam_vault() diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h index 7a4961b4a..6f3376e24 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h @@ -7,20 +7,20 @@ REWRITTEN BY XINEF enum steamVault { - TYPE_HYDROMANCER_THESPIA = 0, - TYPE_MEKGINEER_STEAMRIGGER = 1, - TYPE_WARLORD_KALITHRESH = 2, - MAX_ENCOUNTER = 3 + TYPE_HYDROMANCER_THESPIA = 0, + TYPE_MEKGINEER_STEAMRIGGER = 1, + TYPE_WARLORD_KALITHRESH = 2, + MAX_ENCOUNTER = 3 }; enum steamVaultNPCGO { - GO_MAIN_CHAMBERS_DOOR = 183049, - GO_ACCESS_PANEL_HYDRO = 184125, - GO_ACCESS_PANEL_MEK = 184126, + GO_MAIN_CHAMBERS_DOOR = 183049, + GO_ACCESS_PANEL_HYDRO = 184125, + GO_ACCESS_PANEL_MEK = 184126, - NPC_MEKGINEER_STEAMRIGGER = 17796, - NPC_WARLORD_KALITHRESH = 17798, + NPC_MEKGINEER_STEAMRIGGER = 17796, + NPC_WARLORD_KALITHRESH = 17798, }; #endif diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp index ca3f853bd..f488d307b 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp @@ -28,23 +28,23 @@ EndScriptData */ enum eBlackStalker { - SPELL_LEVITATE = 31704, - SPELL_SUSPENSION = 31719, - SPELL_LEVITATION_PULSE = 31701, - SPELL_MAGNETIC_PULL = 31705, - SPELL_CHAIN_LIGHTNING = 31717, - SPELL_STATIC_CHARGE = 31715, - SPELL_SUMMON_SPORE_STRIDER = 38755, + SPELL_LEVITATE = 31704, + SPELL_SUSPENSION = 31719, + SPELL_LEVITATION_PULSE = 31701, + SPELL_MAGNETIC_PULL = 31705, + SPELL_CHAIN_LIGHTNING = 31717, + SPELL_STATIC_CHARGE = 31715, + SPELL_SUMMON_SPORE_STRIDER = 38755, - EVENT_LEVITATE = 1, - EVENT_SPELL_CHAIN = 2, - EVENT_SPELL_STATIC = 3, - EVENT_SPELL_SPORES = 4, - EVENT_CHECK = 5, - EVENT_LEVITATE_TARGET_1 = 6, - EVENT_LEVITATE_TARGET_2 = 7, + EVENT_LEVITATE = 1, + EVENT_SPELL_CHAIN = 2, + EVENT_SPELL_STATIC = 3, + EVENT_SPELL_SPORES = 4, + EVENT_CHECK = 5, + EVENT_LEVITATE_TARGET_1 = 6, + EVENT_LEVITATE_TARGET_2 = 7, - ENTRY_SPORE_STRIDER = 22299 + ENTRY_SPORE_STRIDER = 22299 }; class boss_the_black_stalker : public CreatureScript @@ -63,43 +63,43 @@ public: { } - EventMap events; - SummonList summons; - uint64 lTarget; + EventMap events; + SummonList summons; + uint64 lTarget; void Reset() { - events.Reset(); - summons.DespawnAll(); - lTarget = 0; + events.Reset(); + summons.DespawnAll(); + lTarget = 0; } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_LEVITATE, 12000); - events.ScheduleEvent(EVENT_SPELL_CHAIN, 6000); - events.ScheduleEvent(EVENT_SPELL_STATIC, 10000); - events.ScheduleEvent(EVENT_CHECK, 5000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_SPORES, urand(10000, 15000)); - } + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_LEVITATE, 12000); + events.ScheduleEvent(EVENT_SPELL_CHAIN, 6000); + events.ScheduleEvent(EVENT_SPELL_STATIC, 10000); + events.ScheduleEvent(EVENT_CHECK, 5000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_SPORES, urand(10000, 15000)); + } void JustSummoned(Creature* summon) { - summons.Summon(summon); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) - summon->AI()->AttackStart(target); - else if (me->GetVictim()) - summon->AI()->AttackStart(me->GetVictim()); + summons.Summon(summon); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) + summon->AI()->AttackStart(target); + else if (me->GetVictim()) + summon->AI()->AttackStart(me->GetVictim()); } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - for (uint8 i = 0; i < 3; ++i) - me->CastSpell(me, SPELL_SUMMON_SPORE_STRIDER, false); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + for (uint8 i = 0; i < 3; ++i) + me->CastSpell(me, SPELL_SUMMON_SPORE_STRIDER, false); + } void JustDied(Unit*) { @@ -111,71 +111,71 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_CHECK: - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - if (!me->IsWithinDist3d(x, y, z, 60)) - { - EnterEvadeMode(); - return; - } - events.RepeatEvent(5000); - break; - case EVENT_SPELL_SPORES: - me->CastSpell(me, SPELL_SUMMON_SPORE_STRIDER, false); - events.RepeatEvent(urand(10000, 15000)); - break; - case EVENT_SPELL_CHAIN: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false); - events.DelayEvents(3000); - events.RepeatEvent(9000); - break; - case EVENT_SPELL_STATIC: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true)) - me->CastSpell(target, SPELL_STATIC_CHARGE, false); - events.RepeatEvent(10000); - break; - case EVENT_LEVITATE: - events.RepeatEvent(15000); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) - { - me->CastSpell(target, SPELL_LEVITATE, false); - lTarget = target->GetGUID(); - events.DelayEvents(5000); - events.ScheduleEvent(EVENT_LEVITATE_TARGET_1, 2000); - } - break; - case EVENT_LEVITATE_TARGET_1: - if (Unit* target = ObjectAccessor::GetUnit(*me, lTarget)) - { - if (!target->HasAura(SPELL_LEVITATE)) - lTarget = 0; - else - { - target->CastSpell(target, SPELL_MAGNETIC_PULL, true); - events.ScheduleEvent(EVENT_LEVITATE_TARGET_2, 1500); - } - } - events.PopEvent(); - break; - case EVENT_LEVITATE_TARGET_2: - if (Unit* target = ObjectAccessor::GetUnit(*me, lTarget)) - { - if (!target->HasAura(SPELL_LEVITATE)) - lTarget = 0; - else - { - target->AddAura(SPELL_SUSPENSION, target); - lTarget = 0; - } - } - events.PopEvent(); - break; - } + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_CHECK: + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + if (!me->IsWithinDist3d(x, y, z, 60)) + { + EnterEvadeMode(); + return; + } + events.RepeatEvent(5000); + break; + case EVENT_SPELL_SPORES: + me->CastSpell(me, SPELL_SUMMON_SPORE_STRIDER, false); + events.RepeatEvent(urand(10000, 15000)); + break; + case EVENT_SPELL_CHAIN: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_CHAIN_LIGHTNING, false); + events.DelayEvents(3000); + events.RepeatEvent(9000); + break; + case EVENT_SPELL_STATIC: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true)) + me->CastSpell(target, SPELL_STATIC_CHARGE, false); + events.RepeatEvent(10000); + break; + case EVENT_LEVITATE: + events.RepeatEvent(15000); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) + { + me->CastSpell(target, SPELL_LEVITATE, false); + lTarget = target->GetGUID(); + events.DelayEvents(5000); + events.ScheduleEvent(EVENT_LEVITATE_TARGET_1, 2000); + } + break; + case EVENT_LEVITATE_TARGET_1: + if (Unit* target = ObjectAccessor::GetUnit(*me, lTarget)) + { + if (!target->HasAura(SPELL_LEVITATE)) + lTarget = 0; + else + { + target->CastSpell(target, SPELL_MAGNETIC_PULL, true); + events.ScheduleEvent(EVENT_LEVITATE_TARGET_2, 1500); + } + } + events.PopEvent(); + break; + case EVENT_LEVITATE_TARGET_2: + if (Unit* target = ObjectAccessor::GetUnit(*me, lTarget)) + { + if (!target->HasAura(SPELL_LEVITATE)) + lTarget = 0; + else + { + target->AddAura(SPELL_SUSPENSION, target); + lTarget = 0; + } + } + events.PopEvent(); + break; + } DoMeleeAttackIfReady(); } @@ -199,7 +199,7 @@ public: void Update(AuraEffect* effect) { - SetDuration(0); + SetDuration(0); } void Register() @@ -218,5 +218,5 @@ public: void AddSC_boss_the_black_stalker() { new boss_the_black_stalker(); - new spell_gen_allergies(); + new spell_gen_allergies(); } diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index 1808320b0..79d2149cd 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -33,13 +33,13 @@ enum Spells enum Events { - EVENT_GROWTH = 1, - EVENT_CAVE_IN = 2, - EVENT_GROUND_SLAM = 3, - EVENT_HURTFUL_STRIKE = 4, - EVENT_REVERBERATION = 5, - EVENT_SHATTER = 6, - EVENT_RECENTLY_SPOKEN = 7 + EVENT_GROWTH = 1, + EVENT_CAVE_IN = 2, + EVENT_GROUND_SLAM = 3, + EVENT_HURTFUL_STRIKE = 4, + EVENT_REVERBERATION = 5, + EVENT_SHATTER = 6, + EVENT_RECENTLY_SPOKEN = 7 }; class boss_gruul : public CreatureScript @@ -54,7 +54,7 @@ class boss_gruul : public CreatureScript void Reset() { _Reset(); - _caveInTimer = 29000; + _caveInTimer = 29000; } void EnterCombat(Unit* /*who*/) @@ -62,20 +62,20 @@ class boss_gruul : public CreatureScript _EnterCombat(); Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_GROWTH, 30000); - events.ScheduleEvent(EVENT_CAVE_IN, _caveInTimer); - events.ScheduleEvent(EVENT_REVERBERATION, 20000); - events.ScheduleEvent(EVENT_HURTFUL_STRIKE, 10000); - events.ScheduleEvent(EVENT_GROUND_SLAM, 35000); + events.ScheduleEvent(EVENT_GROWTH, 30000); + events.ScheduleEvent(EVENT_CAVE_IN, _caveInTimer); + events.ScheduleEvent(EVENT_REVERBERATION, 20000); + events.ScheduleEvent(EVENT_HURTFUL_STRIKE, 10000); + events.ScheduleEvent(EVENT_GROUND_SLAM, 35000); } void KilledUnit(Unit* who) { if (events.GetNextEventTime(EVENT_RECENTLY_SPOKEN) == 0) - { - events.ScheduleEvent(EVENT_RECENTLY_SPOKEN, 5000); + { + events.ScheduleEvent(EVENT_RECENTLY_SPOKEN, 5000); Talk(SAY_SLAY); - } + } } void JustDied(Unit* /*killer*/) @@ -93,46 +93,46 @@ class boss_gruul : public CreatureScript if (me->HasUnitState(UNIT_STATE_CASTING)) return; - switch (events.ExecuteEvent()) - { - case EVENT_GROWTH: - Talk(EMOTE_GROW); - DoCast(me, SPELL_GROWTH); - events.ScheduleEvent(EVENT_GROWTH, 30000); - break; - case EVENT_CAVE_IN: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_CAVE_IN, false); - _caveInTimer -= 1500; - events.ScheduleEvent(EVENT_CAVE_IN, _caveInTimer); - break; - case EVENT_REVERBERATION: - me->CastSpell(me, SPELL_REVERBERATION, false); - events.ScheduleEvent(EVENT_REVERBERATION, 22000); - break; - case EVENT_HURTFUL_STRIKE: - if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 5.0f)) - me->CastSpell(target, SPELL_HURTFUL_STRIKE, false); - events.ScheduleEvent(EVENT_HURTFUL_STRIKE, 15000); - break; - case EVENT_GROUND_SLAM: - Talk(SAY_SLAM); - me->CastSpell(me, SPELL_GROUND_SLAM, false); - events.DelayEvents(8001); - events.ScheduleEvent(EVENT_GROUND_SLAM, 60000); - events.ScheduleEvent(EVENT_SHATTER, 8000); - break; - case EVENT_SHATTER: - Talk(SAY_SHATTER); - me->CastSpell(me, SPELL_SHATTER, false); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_GROWTH: + Talk(EMOTE_GROW); + DoCast(me, SPELL_GROWTH); + events.ScheduleEvent(EVENT_GROWTH, 30000); + break; + case EVENT_CAVE_IN: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_CAVE_IN, false); + _caveInTimer -= 1500; + events.ScheduleEvent(EVENT_CAVE_IN, _caveInTimer); + break; + case EVENT_REVERBERATION: + me->CastSpell(me, SPELL_REVERBERATION, false); + events.ScheduleEvent(EVENT_REVERBERATION, 22000); + break; + case EVENT_HURTFUL_STRIKE: + if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 5.0f)) + me->CastSpell(target, SPELL_HURTFUL_STRIKE, false); + events.ScheduleEvent(EVENT_HURTFUL_STRIKE, 15000); + break; + case EVENT_GROUND_SLAM: + Talk(SAY_SLAM); + me->CastSpell(me, SPELL_GROUND_SLAM, false); + events.DelayEvents(8001); + events.ScheduleEvent(EVENT_GROUND_SLAM, 60000); + events.ScheduleEvent(EVENT_SHATTER, 8000); + break; + case EVENT_SHATTER: + Talk(SAY_SHATTER); + me->CastSpell(me, SPELL_SHATTER, false); + break; + } DoMeleeAttackIfReady(); } - private: - uint32 _caveInTimer; + private: + uint32 _caveInTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -153,7 +153,7 @@ class spell_gruul_ground_slam : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - target->KnockbackFrom(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), 15.0f, 15.0f); + target->KnockbackFrom(GetCaster()->GetPositionX(), GetCaster()->GetPositionY(), 15.0f, 15.0f); } void Register() @@ -179,8 +179,8 @@ class spell_gruul_ground_slam_trigger : public SpellScriptLoader void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (GetUnitOwner()->GetAuraCount(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell) == 5) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_STONED, true); + if (GetUnitOwner()->GetAuraCount(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell) == 5) + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_STONED, true); } void Register() @@ -207,10 +207,10 @@ class spell_gruul_shatter : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - { + { target->RemoveAurasDueToSpell(SPELL_STONED); target->CastSpell((Unit*)NULL, SPELL_SHATTER_EFFECT, true); - } + } } void Register() @@ -263,8 +263,8 @@ class spell_gruul_shatter_effect : public SpellScriptLoader void AddSC_boss_gruul() { new boss_gruul(); - new spell_gruul_ground_slam(); - new spell_gruul_ground_slam_trigger(); + new spell_gruul_ground_slam(); + new spell_gruul_ground_slam_trigger(); new spell_gruul_shatter(); new spell_gruul_shatter_effect(); } diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index a8b93d3b2..f2eb0cc62 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -48,18 +48,18 @@ enum HighKingMaulgar enum HKMEvents { - EVENT_RECENTLY_SPOKEN = 1, - EVENT_ARCING_SMASH = 2, - EVENT_MIGHTY_BLOW = 3, - EVENT_WHIRLWIND = 4, - EVENT_CHARGING = 5, - EVENT_ROAR = 6, - EVENT_CHECK_HEALTH = 7, + EVENT_RECENTLY_SPOKEN = 1, + EVENT_ARCING_SMASH = 2, + EVENT_MIGHTY_BLOW = 3, + EVENT_WHIRLWIND = 4, + EVENT_CHARGING = 5, + EVENT_ROAR = 6, + EVENT_CHECK_HEALTH = 7, - EVENT_ADD_ABILITY1 = 10, - EVENT_ADD_ABILITY2 = 11, - EVENT_ADD_ABILITY3 = 12, - EVENT_ADD_ABILITY4 = 13 + EVENT_ADD_ABILITY1 = 10, + EVENT_ADD_ABILITY2 = 11, + EVENT_ADD_ABILITY3 = 12, + EVENT_ADD_ABILITY4 = 13 }; class boss_high_king_maulgar : public CreatureScript @@ -73,52 +73,52 @@ public: void Reset() { - _Reset(); - me->SetLootMode(0); + _Reset(); + me->SetLootMode(0); } void KilledUnit(Unit* victim) { - if (events.GetNextEventTime(EVENT_RECENTLY_SPOKEN) == 0) - { - events.ScheduleEvent(EVENT_RECENTLY_SPOKEN, 5000); - Talk(SAY_SLAY); - } + if (events.GetNextEventTime(EVENT_RECENTLY_SPOKEN) == 0) + { + events.ScheduleEvent(EVENT_RECENTLY_SPOKEN, 5000); + Talk(SAY_SLAY); + } } void JustDied(Unit* /*killer*/) { Talk(SAY_DEATH); - if (instance->GetData(DATA_ADDS_KILLED) == MAX_ADD_NUMBER) - _JustDied(); + if (instance->GetData(DATA_ADDS_KILLED) == MAX_ADD_NUMBER) + _JustDied(); } void DoAction(int32 actionId) { - if (me->IsAlive()) - { + if (me->IsAlive()) + { Talk(SAY_OGRE_DEATH); - if (actionId == MAX_ADD_NUMBER) - me->SetLootMode(1); - } - else if (actionId == MAX_ADD_NUMBER) - { - me->loot.clear(); - me->loot.FillLoot(me->GetCreatureTemplate()->lootid, LootTemplates_Creature, me->GetLootRecipient(), false, false, 1); - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - _JustDied(); - } + if (actionId == MAX_ADD_NUMBER) + me->SetLootMode(1); + } + else if (actionId == MAX_ADD_NUMBER) + { + me->loot.clear(); + me->loot.FillLoot(me->GetCreatureTemplate()->lootid, LootTemplates_Creature, me->GetLootRecipient(), false, false, 1); + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + _JustDied(); + } } void EnterCombat(Unit* /*who*/) { - _EnterCombat(); + _EnterCombat(); Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_ARCING_SMASH, 6000); - events.ScheduleEvent(EVENT_MIGHTY_BLOW, 20000); - events.ScheduleEvent(EVENT_WHIRLWIND, 30000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); + events.ScheduleEvent(EVENT_ARCING_SMASH, 6000); + events.ScheduleEvent(EVENT_MIGHTY_BLOW, 20000); + events.ScheduleEvent(EVENT_WHIRLWIND, 30000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); } void UpdateAI(uint32 diff) @@ -126,46 +126,46 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ARCING_SMASH: - me->CastSpell(me->GetVictim(), SPELL_ARCING_SMASH, false); - events.ScheduleEvent(EVENT_ARCING_SMASH, 10000); - break; - case EVENT_MIGHTY_BLOW: - me->CastSpell(me->GetVictim(), SPELL_MIGHTY_BLOW, false); - events.ScheduleEvent(EVENT_MIGHTY_BLOW, 16000); - break; - case EVENT_WHIRLWIND: - events.DelayEvents(15000); - me->CastSpell(me, SPELL_WHIRLWIND, false); - events.ScheduleEvent(EVENT_WHIRLWIND, 54000); - break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(50)) - { - Talk(SAY_ENRAGE); - me->CastSpell(me, SPELL_FLURRY, true); - events.ScheduleEvent(EVENT_CHARGING, 0); - events.ScheduleEvent(EVENT_ROAR, 3000); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); - break; - case EVENT_ROAR: - me->CastSpell(me, SPELL_ROAR, false); - events.ScheduleEvent(EVENT_ROAR, 40000); - break; - case EVENT_CHARGING: + switch (events.ExecuteEvent()) + { + case EVENT_ARCING_SMASH: + me->CastSpell(me->GetVictim(), SPELL_ARCING_SMASH, false); + events.ScheduleEvent(EVENT_ARCING_SMASH, 10000); + break; + case EVENT_MIGHTY_BLOW: + me->CastSpell(me->GetVictim(), SPELL_MIGHTY_BLOW, false); + events.ScheduleEvent(EVENT_MIGHTY_BLOW, 16000); + break; + case EVENT_WHIRLWIND: + events.DelayEvents(15000); + me->CastSpell(me, SPELL_WHIRLWIND, false); + events.ScheduleEvent(EVENT_WHIRLWIND, 54000); + break; + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(50)) + { + Talk(SAY_ENRAGE); + me->CastSpell(me, SPELL_FLURRY, true); + events.ScheduleEvent(EVENT_CHARGING, 0); + events.ScheduleEvent(EVENT_ROAR, 3000); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); + break; + case EVENT_ROAR: + me->CastSpell(me, SPELL_ROAR, false); + events.ScheduleEvent(EVENT_ROAR, 40000); + break; + case EVENT_CHARGING: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) - me->CastSpell(target, SPELL_BERSERKER_C, false); - events.ScheduleEvent(EVENT_CHARGING, 35000); - break; - } + me->CastSpell(target, SPELL_BERSERKER_C, false); + events.ScheduleEvent(EVENT_CHARGING, 35000); + break; + } DoMeleeAttackIfReady(); } @@ -189,14 +189,14 @@ public: instance = creature->GetInstanceScript(); } - EventMap events; - SummonList summons; + EventMap events; + SummonList summons; InstanceScript* instance; void Reset() { - events.Reset(); - summons.DespawnAll(); + events.Reset(); + summons.DespawnAll(); instance->SetBossState(DATA_MAULGAR, NOT_STARTED); } @@ -214,46 +214,46 @@ public: me->SetInCombatWithZone(); instance->SetBossState(DATA_MAULGAR, IN_PROGRESS); - events.ScheduleEvent(EVENT_ADD_ABILITY1, 10000); - events.ScheduleEvent(EVENT_ADD_ABILITY2, 15000); - events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); + events.ScheduleEvent(EVENT_ADD_ABILITY1, 10000); + events.ScheduleEvent(EVENT_ADD_ABILITY2, 15000); + events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); } void JustDied(Unit* /*killer*/) { - instance->SetData(DATA_ADDS_KILLED, 1); + instance->SetData(DATA_ADDS_KILLED, 1); } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ADD_ABILITY1: - me->CastSpell(me->GetVictim(), SPELL_DARK_DECAY, false); - events.ScheduleEvent(EVENT_ADD_ABILITY1, 20000); - break; - case EVENT_ADD_ABILITY2: - me->CastSpell(me, SPELL_SUMMON_WFH, false); - events.ScheduleEvent(EVENT_ADD_ABILITY2, 30000); - break; - case EVENT_ADD_ABILITY3: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_DEATH_COIL, false); - events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_ADD_ABILITY1: + me->CastSpell(me->GetVictim(), SPELL_DARK_DECAY, false); + events.ScheduleEvent(EVENT_ADD_ABILITY1, 20000); + break; + case EVENT_ADD_ABILITY2: + me->CastSpell(me, SPELL_SUMMON_WFH, false); + events.ScheduleEvent(EVENT_ADD_ABILITY2, 30000); + break; + case EVENT_ADD_ABILITY3: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_DEATH_COIL, false); + events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); + break; + } DoMeleeAttackIfReady(); } @@ -291,15 +291,15 @@ public: me->SetInCombatWithZone(); instance->SetBossState(DATA_MAULGAR, IN_PROGRESS); - events.ScheduleEvent(EVENT_ADD_ABILITY1, 5000); - events.ScheduleEvent(EVENT_ADD_ABILITY2, 10000); - events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); - events.ScheduleEvent(EVENT_ADD_ABILITY4, 30000); + events.ScheduleEvent(EVENT_ADD_ABILITY1, 5000); + events.ScheduleEvent(EVENT_ADD_ABILITY2, 10000); + events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); + events.ScheduleEvent(EVENT_ADD_ABILITY4, 30000); } void JustDied(Unit* /*killer*/) { - instance->SetData(DATA_ADDS_KILLED, 1); + instance->SetData(DATA_ADDS_KILLED, 1); } void UpdateAI(uint32 diff) @@ -307,31 +307,31 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ADD_ABILITY1: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) - me->CastSpell(target, SPELL_GREATER_POLYMORPH, false); - events.ScheduleEvent(EVENT_ADD_ABILITY1, 20000); - break; - case EVENT_ADD_ABILITY2: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) - me->CastSpell(target, SPELL_LIGHTNING_BOLT, false); - events.ScheduleEvent(EVENT_ADD_ABILITY2, 15000); - break; - case EVENT_ADD_ABILITY3: - me->CastSpell(me->GetVictim(), SPELL_ARCANE_SHOCK, false); - events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); - break; - case EVENT_ADD_ABILITY4: - me->CastSpell(me, SPELL_ARCANE_EXPLOSION, false); - events.ScheduleEvent(EVENT_ADD_ABILITY4, 30000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_ADD_ABILITY1: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) + me->CastSpell(target, SPELL_GREATER_POLYMORPH, false); + events.ScheduleEvent(EVENT_ADD_ABILITY1, 20000); + break; + case EVENT_ADD_ABILITY2: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) + me->CastSpell(target, SPELL_LIGHTNING_BOLT, false); + events.ScheduleEvent(EVENT_ADD_ABILITY2, 15000); + break; + case EVENT_ADD_ABILITY3: + me->CastSpell(me->GetVictim(), SPELL_ARCANE_SHOCK, false); + events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); + break; + case EVENT_ADD_ABILITY4: + me->CastSpell(me, SPELL_ARCANE_EXPLOSION, false); + events.ScheduleEvent(EVENT_ADD_ABILITY4, 30000); + break; + } DoMeleeAttackIfReady(); } @@ -369,14 +369,14 @@ public: me->SetInCombatWithZone(); instance->SetBossState(DATA_MAULGAR, IN_PROGRESS); - events.ScheduleEvent(EVENT_ADD_ABILITY1, 5000); - events.ScheduleEvent(EVENT_ADD_ABILITY2, 10000); - events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); + events.ScheduleEvent(EVENT_ADD_ABILITY1, 5000); + events.ScheduleEvent(EVENT_ADD_ABILITY2, 10000); + events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); } void JustDied(Unit* /*killer*/) { - instance->SetData(DATA_ADDS_KILLED, 1); + instance->SetData(DATA_ADDS_KILLED, 1); } void UpdateAI(uint32 diff) @@ -384,26 +384,26 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ADD_ABILITY1: - me->CastSpell(me, SPELL_GREATER_PW_SHIELD, false); - events.ScheduleEvent(EVENT_ADD_ABILITY1, 30000); - break; - case EVENT_ADD_ABILITY2: - if (Unit* target = DoSelectLowestHpFriendly(60.0f, 50000)) - me->CastSpell(target, SPELL_HEAL, false); - events.ScheduleEvent(EVENT_ADD_ABILITY2, 25000); - break; - case EVENT_ADD_ABILITY3: - me->CastSpell(me, SPELL_PRAYER_OH, false); - events.ScheduleEvent(EVENT_ADD_ABILITY3, 30000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_ADD_ABILITY1: + me->CastSpell(me, SPELL_GREATER_PW_SHIELD, false); + events.ScheduleEvent(EVENT_ADD_ABILITY1, 30000); + break; + case EVENT_ADD_ABILITY2: + if (Unit* target = DoSelectLowestHpFriendly(60.0f, 50000)) + me->CastSpell(target, SPELL_HEAL, false); + events.ScheduleEvent(EVENT_ADD_ABILITY2, 25000); + break; + case EVENT_ADD_ABILITY3: + me->CastSpell(me, SPELL_PRAYER_OH, false); + events.ScheduleEvent(EVENT_ADD_ABILITY3, 30000); + break; + } DoMeleeAttackIfReady(); } @@ -427,12 +427,12 @@ public: instance = creature->GetInstanceScript(); } - EventMap events; + EventMap events; InstanceScript* instance; void Reset() { - events.Reset(); + events.Reset(); instance->SetBossState(DATA_MAULGAR, NOT_STARTED); } @@ -450,14 +450,14 @@ public: me->SetInCombatWithZone(); instance->SetBossState(DATA_MAULGAR, IN_PROGRESS); - events.ScheduleEvent(EVENT_ADD_ABILITY1, 1000); - events.ScheduleEvent(EVENT_ADD_ABILITY2, 5000); - events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); + events.ScheduleEvent(EVENT_ADD_ABILITY1, 1000); + events.ScheduleEvent(EVENT_ADD_ABILITY2, 5000); + events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); } void JustDied(Unit* /*killer*/) { - instance->SetData(DATA_ADDS_KILLED, 1); + instance->SetData(DATA_ADDS_KILLED, 1); } void UpdateAI(uint32 diff) @@ -465,25 +465,25 @@ public: if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ADD_ABILITY1: - me->CastSpell(me->GetVictim(), SPELL_GREATER_FIREBALL, false); - events.ScheduleEvent(EVENT_ADD_ABILITY1, 3500); - break; - case EVENT_ADD_ABILITY2: - me->CastSpell(me, SPELL_SPELLSHIELD, false); - events.ScheduleEvent(EVENT_ADD_ABILITY2, 40000); - break; - case EVENT_ADD_ABILITY3: - me->CastSpell(me, SPELL_BLAST_WAVE, false); - events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_ADD_ABILITY1: + me->CastSpell(me->GetVictim(), SPELL_GREATER_FIREBALL, false); + events.ScheduleEvent(EVENT_ADD_ABILITY1, 3500); + break; + case EVENT_ADD_ABILITY2: + me->CastSpell(me, SPELL_SPELLSHIELD, false); + events.ScheduleEvent(EVENT_ADD_ABILITY2, 40000); + break; + case EVENT_ADD_ABILITY3: + me->CastSpell(me, SPELL_BLAST_WAVE, false); + events.ScheduleEvent(EVENT_ADD_ABILITY3, 20000); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Outland/GruulsLair/gruuls_lair.h b/src/server/scripts/Outland/GruulsLair/gruuls_lair.h index b64b56ee4..751764caf 100644 --- a/src/server/scripts/Outland/GruulsLair/gruuls_lair.h +++ b/src/server/scripts/Outland/GruulsLair/gruuls_lair.h @@ -9,10 +9,10 @@ enum DataTypes { DATA_MAULGAR = 0, DATA_GRUUL = 1, - MAX_ENCOUNTER = 2, + MAX_ENCOUNTER = 2, - DATA_ADDS_KILLED = 10, - MAX_ADD_NUMBER = 4 + DATA_ADDS_KILLED = 10, + MAX_ADD_NUMBER = 4 }; enum CreatureIds diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index e78d5cae3..13dd6c0c9 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -36,7 +36,7 @@ class instance_gruuls_lair : public InstanceMapScript LoadMinionData(minionData); _maulgarGUID = 0; - _addsKilled = 0; + _addsKilled = 0; } void OnCreatureCreate(Creature* creature) @@ -91,27 +91,27 @@ class instance_gruuls_lair : public InstanceMapScript } } - bool SetBossState(uint32 id, EncounterState state) - { - if (!InstanceScript::SetBossState(id, state)) - return false; + bool SetBossState(uint32 id, EncounterState state) + { + if (!InstanceScript::SetBossState(id, state)) + return false; - if (id == DATA_MAULGAR && state == NOT_STARTED) - _addsKilled = 0; - return true; - } + if (id == DATA_MAULGAR && state == NOT_STARTED) + _addsKilled = 0; + return true; + } - void SetData(uint32 type, uint32 id) - { - if (type == DATA_ADDS_KILLED) - if (Creature* maulgar = instance->GetCreature(_maulgarGUID)) - maulgar->AI()->DoAction(++_addsKilled); - } + void SetData(uint32 type, uint32 id) + { + if (type == DATA_ADDS_KILLED) + if (Creature* maulgar = instance->GetCreature(_maulgarGUID)) + maulgar->AI()->DoAction(++_addsKilled); + } uint32 GetData(uint32 type) const { if (type == DATA_ADDS_KILLED) - return _addsKilled; + return _addsKilled; return 0; } @@ -159,7 +159,7 @@ class instance_gruuls_lair : public InstanceMapScript } protected: - uint32 _addsKilled; + uint32 _addsKilled; uint64 _maulgarGUID; }; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h index 5dbb71a40..f5aef7836 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h @@ -7,34 +7,34 @@ REWRITTEN BY XINEF enum bloodFurnace { - DATA_THE_MAKER = 0, - DATA_BROGGOK = 1, - DATA_KELIDAN = 2, - MAX_ENCOUNTER = 3, + DATA_THE_MAKER = 0, + DATA_BROGGOK = 1, + DATA_KELIDAN = 2, + MAX_ENCOUNTER = 3, - DATA_DOOR1 = 10, - DATA_DOOR2 = 11, - DATA_DOOR3 = 12, - DATA_DOOR4 = 13, - DATA_DOOR5 = 14, - DATA_DOOR6 = 15, + DATA_DOOR1 = 10, + DATA_DOOR2 = 11, + DATA_DOOR3 = 12, + DATA_DOOR4 = 13, + DATA_DOOR5 = 14, + DATA_DOOR6 = 15, - DATA_PRISON_CELL1 = 20, - DATA_PRISON_CELL2 = 21, - DATA_PRISON_CELL3 = 22, - DATA_PRISON_CELL4 = 23, + DATA_PRISON_CELL1 = 20, + DATA_PRISON_CELL2 = 21, + DATA_PRISON_CELL3 = 22, + DATA_PRISON_CELL4 = 23, - ACTION_ACTIVATE_BROGGOK = 30, - ACTION_PREPARE_BROGGOK = 31 + ACTION_ACTIVATE_BROGGOK = 30, + ACTION_PREPARE_BROGGOK = 31 }; enum bloodFurnaceNPC { - NPC_THE_MAKER = 17381, - NPC_BROGGOK = 17380, - NPC_KELIDAN = 17377, - NPC_NASCENT_FEL_ORC = 17398, - NPC_CHANNELER = 17653 + NPC_THE_MAKER = 17381, + NPC_BROGGOK = 17380, + NPC_KELIDAN = 17377, + NPC_NASCENT_FEL_ORC = 17398, + NPC_CHANNELER = 17653 }; #endif diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index 628c17662..4af468583 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -15,9 +15,9 @@ enum eEnums SPELL_POISON_BOLT = 30917, SPELL_POISON = 30914, - EVENT_SPELL_SLIME = 1, - EVENT_SPELL_POISON = 2, - EVENT_SPELL_BOLT = 3 + EVENT_SPELL_SLIME = 1, + EVENT_SPELL_POISON = 2, + EVENT_SPELL_BOLT = 3 }; class boss_broggok : public CreatureScript @@ -36,7 +36,7 @@ class boss_broggok : public CreatureScript } InstanceScript* instance; - EventMap events; + EventMap events; bool canAttack; void Reset() @@ -47,8 +47,8 @@ class boss_broggok : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); canAttack = false; - if (instance) - instance->SetData(DATA_BROGGOK, NOT_STARTED); + if (instance) + instance->SetData(DATA_BROGGOK, NOT_STARTED); } void EnterCombat(Unit* /*who*/) @@ -69,27 +69,27 @@ class boss_broggok : public CreatureScript if (!UpdateVictim() || !canAttack) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_SLIME: - me->CastSpell(me->GetVictim(), SPELL_SLIME_SPRAY, false); - events.RepeatEvent(urand(7000, 12000)); - break; - case EVENT_SPELL_BOLT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_POISON_BOLT, false); - events.RepeatEvent(urand(6000, 11000)); - break; - case EVENT_SPELL_POISON: - me->CastSpell(me, SPELL_POISON_CLOUD, false); - events.RepeatEvent(20000); - break; - - } + switch (events.GetEvent()) + { + case EVENT_SPELL_SLIME: + me->CastSpell(me->GetVictim(), SPELL_SLIME_SPRAY, false); + events.RepeatEvent(urand(7000, 12000)); + break; + case EVENT_SPELL_BOLT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_POISON_BOLT, false); + events.RepeatEvent(urand(6000, 11000)); + break; + case EVENT_SPELL_POISON: + me->CastSpell(me, SPELL_POISON_CLOUD, false); + events.RepeatEvent(20000); + break; + + } DoMeleeAttackIfReady(); } @@ -112,9 +112,9 @@ class boss_broggok : public CreatureScript me->SetInCombatWithZone(); break; case ACTION_ACTIVATE_BROGGOK: - events.ScheduleEvent(EVENT_SPELL_SLIME, 10000); - events.ScheduleEvent(EVENT_SPELL_POISON, 5000); - events.ScheduleEvent(EVENT_SPELL_BOLT, 7000); + events.ScheduleEvent(EVENT_SPELL_SLIME, 10000); + events.ScheduleEvent(EVENT_SPELL_POISON, 5000); + events.ScheduleEvent(EVENT_SPELL_BOLT, 7000); me->SetReactState(REACT_AGGRESSIVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); @@ -141,10 +141,10 @@ class go_broggok_lever : public GameObjectScript if (InstanceScript* instance = go->GetInstanceScript()) if (instance->GetData(DATA_BROGGOK) != DONE && instance->GetData(DATA_BROGGOK) != IN_PROGRESS) if (Creature* broggok = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_BROGGOK))) - { - instance->SetData(DATA_BROGGOK, IN_PROGRESS); + { + instance->SetData(DATA_BROGGOK, IN_PROGRESS); broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK); - } + } go->UseDoorOrButton(); return false; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index f681339c0..84e026ba1 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -15,7 +15,7 @@ enum eKelidan SAY_NOVA = 3, SAY_DIE = 4, - // Keldian spells + // Keldian spells SPELL_CORRUPTION = 30938, SPELL_EVOCATION = 30935, SPELL_FIRE_NOVA = 33132, @@ -23,23 +23,23 @@ enum eKelidan SPELL_BURNING_NOVA = 30940, SPELL_VORTEX = 37370, - // Channelers spells - SPELL_SHADOW_BOLT = 12739, - SPELL_SHADOW_BOLT_H = 15472, - SPELL_MARK_OF_SHADOW = 30937, - SPELL_CHANNELING = 39123, + // Channelers spells + SPELL_SHADOW_BOLT = 12739, + SPELL_SHADOW_BOLT_H = 15472, + SPELL_MARK_OF_SHADOW = 30937, + SPELL_CHANNELING = 39123, - // Events - EVENT_SPELL_VOLLEY = 1, - EVENT_SPELL_CORRUPTION = 2, - EVENT_SPELL_BURNING_NOVA = 3, - EVENT_SPELL_FIRE_NOVA = 4, - EVENT_SPELL_SHADOW_BOLT = 5, - EVENT_SPELL_MARK = 6, + // Events + EVENT_SPELL_VOLLEY = 1, + EVENT_SPELL_CORRUPTION = 2, + EVENT_SPELL_BURNING_NOVA = 3, + EVENT_SPELL_FIRE_NOVA = 4, + EVENT_SPELL_SHADOW_BOLT = 5, + EVENT_SPELL_MARK = 6, - // Actions - ACTION_CHANNELER_ENGAGED = 1, - ACTION_CHANNELER_DIED = 2, + // Actions + ACTION_CHANNELER_ENGAGED = 1, + ACTION_CHANNELER_DIED = 2, }; const float ShadowmoonChannelers[5][4] = @@ -64,22 +64,22 @@ class boss_kelidan_the_breaker : public CreatureScript boss_kelidan_the_breakerAI(Creature* creature) : ScriptedAI(creature) { instance = creature->GetInstanceScript(); - memset(&channelers, 0, sizeof(channelers)); + memset(&channelers, 0, sizeof(channelers)); } InstanceScript* instance; - EventMap events; - uint64 channelers[5]; - uint32 checkTimer; + EventMap events; + uint64 channelers[5]; + uint32 checkTimer; bool addYell; void Reset() { addYell = false; - checkTimer = 5000; + checkTimer = 5000; - events.Reset(); - ApplyImmunities(true); + events.Reset(); + ApplyImmunities(true); SummonChannelers(); me->SetReactState(REACT_PASSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); @@ -89,74 +89,74 @@ class boss_kelidan_the_breaker : public CreatureScript void EnterCombat(Unit* who) { - events.ScheduleEvent(EVENT_SPELL_VOLLEY, 1000); - events.ScheduleEvent(EVENT_SPELL_CORRUPTION, 5000); - events.ScheduleEvent(EVENT_SPELL_BURNING_NOVA, 15000); + events.ScheduleEvent(EVENT_SPELL_VOLLEY, 1000); + events.ScheduleEvent(EVENT_SPELL_CORRUPTION, 5000); + events.ScheduleEvent(EVENT_SPELL_BURNING_NOVA, 15000); - me->InterruptNonMeleeSpells(false); + me->InterruptNonMeleeSpells(false); Talk(SAY_WAKE); - if (instance) - instance->SetData(DATA_KELIDAN, IN_PROGRESS); + if (instance) + instance->SetData(DATA_KELIDAN, IN_PROGRESS); } void KilledUnit(Unit* /*victim*/) { if (urand(0,1)) - Talk(SAY_KILL); + Talk(SAY_KILL); } - void DoAction(int32 param) - { - if (param == ACTION_CHANNELER_ENGAGED) - { - if (!addYell) - { - addYell = true; - Talk(SAY_ADD_AGGRO); - - for (uint8 i = 0; i < 5; ++i) - { - Creature* channeler = ObjectAccessor::GetCreature(*me, channelers[i]); - if (channeler && !channeler->IsInCombat()) - channeler->SetInCombatWithZone(); - } - } - } - else if (param == ACTION_CHANNELER_DIED) - { - for (uint8 i = 0; i < 5; ++i) - { - Creature* channeler = ObjectAccessor::GetCreature(*me, channelers[i]); - if (channeler && channeler->IsAlive()) - return; - } - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); - if (Unit* target = me->SelectNearestPlayer(100.0f)) - AttackStart(target); - } - } + void DoAction(int32 param) + { + if (param == ACTION_CHANNELER_ENGAGED) + { + if (!addYell) + { + addYell = true; + Talk(SAY_ADD_AGGRO); + + for (uint8 i = 0; i < 5; ++i) + { + Creature* channeler = ObjectAccessor::GetCreature(*me, channelers[i]); + if (channeler && !channeler->IsInCombat()) + channeler->SetInCombatWithZone(); + } + } + } + else if (param == ACTION_CHANNELER_DIED) + { + for (uint8 i = 0; i < 5; ++i) + { + Creature* channeler = ObjectAccessor::GetCreature(*me, channelers[i]); + if (channeler && channeler->IsAlive()) + return; + } + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + if (Unit* target = me->SelectNearestPlayer(100.0f)) + AttackStart(target); + } + } void CheckChannelers() { - if (addYell) - { - if (!SelectTargetFromPlayerList(100.0f)) - EnterEvadeMode(); - return; - } + if (addYell) + { + if (!SelectTargetFromPlayerList(100.0f)) + EnterEvadeMode(); + return; + } - SummonChannelers(); + SummonChannelers(); for (uint8 i = 0; i < 5; ++i) { Creature* channeler = ObjectAccessor::GetCreature(*me, channelers[i]); if (channeler && !channeler->HasUnitState(UNIT_STATE_CASTING) && !channeler->IsInCombat()) - { - Creature* target = ObjectAccessor::GetCreature(*me, channelers[(i+2)%5]); - if (target) - channeler->CastSpell(target, SPELL_CHANNELING, false); - } + { + Creature* target = ObjectAccessor::GetCreature(*me, channelers[(i+2)%5]); + if (target) + channeler->CastSpell(target, SPELL_CHANNELING, false); + } } } @@ -165,15 +165,15 @@ class boss_kelidan_the_breaker : public CreatureScript for (uint8 i = 0; i < 5; ++i) { Creature* channeler = ObjectAccessor::GetCreature(*me, channelers[i]); - if (channeler && channeler->isDead()) - { - channeler->DespawnOrUnsummon(1); - channeler = NULL; - } + if (channeler && channeler->isDead()) + { + channeler->DespawnOrUnsummon(1); + channeler = NULL; + } if (!channeler) channeler = me->SummonCreature(NPC_CHANNELER, ShadowmoonChannelers[i][0], ShadowmoonChannelers[i][1], ShadowmoonChannelers[i][2], ShadowmoonChannelers[i][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - channelers[i] = channeler ? channeler->GetGUID() : 0; + channelers[i] = channeler ? channeler->GetGUID() : 0; } } @@ -181,86 +181,86 @@ class boss_kelidan_the_breaker : public CreatureScript { Talk(SAY_DIE); if (instance) - { - // Xinef: load grid with start doors - me->GetMap()->LoadGrid(0, -111.0f); - instance->SetData(DATA_KELIDAN, DONE); - instance->HandleGameObject(instance->GetData64(DATA_DOOR1), true); - instance->HandleGameObject(instance->GetData64(DATA_DOOR6), true); - } + { + // Xinef: load grid with start doors + me->GetMap()->LoadGrid(0, -111.0f); + instance->SetData(DATA_KELIDAN, DONE); + instance->HandleGameObject(instance->GetData64(DATA_DOOR1), true); + instance->HandleGameObject(instance->GetData64(DATA_DOOR6), true); + } } - void ApplyImmunities(bool apply) - { - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISTRACT, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FEAR, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_ROOT, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SILENCE, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_KNOCKOUT, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SHACKLE, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_TURN, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_HORROR, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DAZE, apply); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply); - } + void ApplyImmunities(bool apply) + { + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DISTRACT, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FEAR, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_ROOT, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SILENCE, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SNARE, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_KNOCKOUT, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_BANISH, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SHACKLE, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_TURN, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_HORROR, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_DAZE, apply); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply); + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) { - checkTimer += diff; + checkTimer += diff; if (checkTimer >= 5000) { - checkTimer = 0; + checkTimer = 0; CheckChannelers(); - if (!me->HasUnitState(UNIT_STATE_CASTING)) + if (!me->HasUnitState(UNIT_STATE_CASTING)) me->CastSpell(me, SPELL_EVOCATION, false); } return; } - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_VOLLEY: - me->CastSpell(me, SPELL_SHADOW_BOLT_VOLLEY, false); - events.RepeatEvent(urand(8000, 13000)); - break; - case EVENT_SPELL_CORRUPTION: - me->CastSpell(me, SPELL_CORRUPTION, false); - events.RepeatEvent(urand(30000, 50000)); - break; - case EVENT_SPELL_BURNING_NOVA: - Talk(SAY_NOVA); - - ApplyImmunities(false); - me->AddAura(SPELL_BURNING_NOVA, me); - ApplyImmunities(true); + switch (events.GetEvent()) + { + case EVENT_SPELL_VOLLEY: + me->CastSpell(me, SPELL_SHADOW_BOLT_VOLLEY, false); + events.RepeatEvent(urand(8000, 13000)); + break; + case EVENT_SPELL_CORRUPTION: + me->CastSpell(me, SPELL_CORRUPTION, false); + events.RepeatEvent(urand(30000, 50000)); + break; + case EVENT_SPELL_BURNING_NOVA: + Talk(SAY_NOVA); + + ApplyImmunities(false); + me->AddAura(SPELL_BURNING_NOVA, me); + ApplyImmunities(true); - if (IsHeroic()) - DoTeleportAll(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + if (IsHeroic()) + DoTeleportAll(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - events.DelayEvents(6000, 0); - events.RepeatEvent(urand(25000, 32000)); - events.ScheduleEvent(EVENT_SPELL_FIRE_NOVA, 5000); - break; - case EVENT_SPELL_FIRE_NOVA: - me->CastSpell(me, SPELL_FIRE_NOVA, true); - events.PopEvent(); - break; - } + events.DelayEvents(6000, 0); + events.RepeatEvent(urand(25000, 32000)); + events.ScheduleEvent(EVENT_SPELL_FIRE_NOVA, 5000); + break; + case EVENT_SPELL_FIRE_NOVA: + me->CastSpell(me, SPELL_FIRE_NOVA, true); + events.PopEvent(); + break; + } DoMeleeAttackIfReady(); } @@ -286,24 +286,24 @@ class npc_shadowmoon_channeler : public CreatureScript void Reset() { - events.Reset(); + events.Reset(); } - Creature* GetKelidan() - { - if (me->GetInstanceScript()) - return ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(DATA_KELIDAN)); - return NULL; - } + Creature* GetKelidan() + { + if (me->GetInstanceScript()) + return ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetData64(DATA_KELIDAN)); + return NULL; + } void EnterCombat(Unit* who) { if (Creature* kelidan = GetKelidan()) kelidan->AI()->DoAction(ACTION_CHANNELER_ENGAGED); - me->InterruptNonMeleeSpells(false); - events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, urand(1500, 3500)); - events.ScheduleEvent(EVENT_SPELL_MARK, urand(5000, 6500)); + me->InterruptNonMeleeSpells(false); + events.ScheduleEvent(EVENT_SPELL_SHADOW_BOLT, urand(1500, 3500)); + events.ScheduleEvent(EVENT_SPELL_MARK, urand(5000, 6500)); } void JustDied(Unit* killer) @@ -317,22 +317,22 @@ class npc_shadowmoon_channeler : public CreatureScript if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_SHADOW_BOLT: - me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SHADOW_BOLT_H : SPELL_SHADOW_BOLT, false); - events.RepeatEvent(urand(6000, 7500)); - break; - case EVENT_SPELL_MARK: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_MARK_OF_SHADOW, false); - events.RepeatEvent(urand(16000, 17500)); - break; - } + switch (events.GetEvent()) + { + case EVENT_SPELL_SHADOW_BOLT: + me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SHADOW_BOLT_H : SPELL_SHADOW_BOLT, false); + events.RepeatEvent(urand(6000, 7500)); + break; + case EVENT_SPELL_MARK: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_MARK_OF_SHADOW, false); + events.RepeatEvent(urand(16000, 17500)); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp index b8145c787..3e9fa5e75 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp @@ -17,10 +17,10 @@ enum eEnums SPELL_KNOCKDOWN = 20276, SPELL_DOMINATION = 25772, - EVENT_SPELL_ACID = 1, - EVENT_SPELL_EXPLODING = 2, - EVENT_SPELL_DOMINATION = 3, - EVENT_SPELL_KNOCKDOWN = 4, + EVENT_SPELL_ACID = 1, + EVENT_SPELL_EXPLODING = 2, + EVENT_SPELL_DOMINATION = 3, + EVENT_SPELL_KNOCKDOWN = 4, }; class boss_the_maker : public CreatureScript @@ -39,11 +39,11 @@ class boss_the_maker : public CreatureScript } InstanceScript* instance; - EventMap events; + EventMap events; void Reset() { - events.Reset(); + events.Reset(); if (!instance) return; @@ -54,10 +54,10 @@ class boss_the_maker : public CreatureScript void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SPELL_ACID, 15000); - events.ScheduleEvent(EVENT_SPELL_EXPLODING, 6000); - events.ScheduleEvent(EVENT_SPELL_DOMINATION, 120000); - events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 10000); + events.ScheduleEvent(EVENT_SPELL_ACID, 15000); + events.ScheduleEvent(EVENT_SPELL_EXPLODING, 6000); + events.ScheduleEvent(EVENT_SPELL_DOMINATION, 120000); + events.ScheduleEvent(EVENT_SPELL_KNOCKDOWN, 10000); if (!instance) return; @@ -68,8 +68,8 @@ class boss_the_maker : public CreatureScript void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && urand(0,1)) - Talk(SAY_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER && urand(0,1)) + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) @@ -90,31 +90,31 @@ class boss_the_maker : public CreatureScript if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.GetEvent()) - { - case EVENT_SPELL_ACID: - me->CastSpell(me->GetVictim(), SPELL_ACID_SPRAY, false); - events.RepeatEvent(urand(15000, 23000)); - break; - case EVENT_SPELL_EXPLODING: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_EXPLODING_BREAKER, false); - events.RepeatEvent(urand(7000, 11000)); - break; - case EVENT_SPELL_DOMINATION: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_DOMINATION, false); - events.RepeatEvent(120000); - break; - case EVENT_SPELL_KNOCKDOWN: - me->CastSpell(me->GetVictim(), SPELL_KNOCKDOWN, false); - events.RepeatEvent(urand(4000, 12000)); - break; - } + switch (events.GetEvent()) + { + case EVENT_SPELL_ACID: + me->CastSpell(me->GetVictim(), SPELL_ACID_SPRAY, false); + events.RepeatEvent(urand(15000, 23000)); + break; + case EVENT_SPELL_EXPLODING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_EXPLODING_BREAKER, false); + events.RepeatEvent(urand(7000, 11000)); + break; + case EVENT_SPELL_DOMINATION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_DOMINATION, false); + events.RepeatEvent(120000); + break; + case EVENT_SPELL_KNOCKDOWN: + me->CastSpell(me->GetVictim(), SPELL_KNOCKDOWN, false); + events.RepeatEvent(urand(4000, 12000)); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index 5191a9024..f8a2a7423 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -16,10 +16,10 @@ class instance_blood_furnace : public InstanceMapScript { instance_blood_furnace_InstanceMapScript(Map* map) : InstanceScript(map) {} - uint32 _auiEncounter[MAX_ENCOUNTER]; + uint32 _auiEncounter[MAX_ENCOUNTER]; uint64 _bossGUIDs[3]; - uint64 _doorGUIDs[6]; - uint64 _prisonGUIDs[4]; + uint64 _doorGUIDs[6]; + uint64 _prisonGUIDs[4]; std::set _prisonersCell[4]; @@ -30,13 +30,13 @@ class instance_blood_furnace : public InstanceMapScript void Initialize() { memset(&_auiEncounter, 0, sizeof(_auiEncounter)); - memset(&_bossGUIDs, 0, sizeof(_bossGUIDs)); - memset(&_doorGUIDs, 0, sizeof(_doorGUIDs)); - memset(&_prisonGUIDs, 0, sizeof(_prisonGUIDs)); - memset(&_prisonerCounter, 0, sizeof(_prisonerCounter)); + memset(&_bossGUIDs, 0, sizeof(_bossGUIDs)); + memset(&_doorGUIDs, 0, sizeof(_doorGUIDs)); + memset(&_prisonGUIDs, 0, sizeof(_prisonGUIDs)); + memset(&_prisonerCounter, 0, sizeof(_prisonerCounter)); - for (uint8 i = 0; i < 4; ++i) - _prisonersCell[i].clear(); + for (uint8 i = 0; i < 4; ++i) + _prisonersCell[i].clear(); _broggokLeverGUID = 0; } @@ -73,19 +73,19 @@ class instance_blood_furnace : public InstanceMapScript if (go->GetEntry() == 181811) //The Maker Front door _doorGUIDs[1] = go->GetGUID(); if (go->GetEntry() == 181812) //The Maker Rear door - { + { _doorGUIDs[2] = go->GetGUID(); - if (GetData(DATA_THE_MAKER) == DONE) - HandleGameObject(go->GetGUID(), true); - } + if (GetData(DATA_THE_MAKER) == DONE) + HandleGameObject(go->GetGUID(), true); + } if (go->GetEntry() == 181822) //Broggok Front door _doorGUIDs[3] = go->GetGUID(); if (go->GetEntry() == 181819) //Broggok Rear door - { + { _doorGUIDs[4] = go->GetGUID(); - if (GetData(DATA_BROGGOK) == DONE) - HandleGameObject(go->GetGUID(), true); - } + if (GetData(DATA_BROGGOK) == DONE) + HandleGameObject(go->GetGUID(), true); + } if (go->GetEntry() == 181823) //Kelidan exit door _doorGUIDs[5] = go->GetGUID(); @@ -107,9 +107,9 @@ class instance_blood_furnace : public InstanceMapScript switch (data) { case DATA_THE_MAKER: - case DATA_BROGGOK: + case DATA_BROGGOK: case DATA_KELIDAN: - return _bossGUIDs[data]; + return _bossGUIDs[data]; case DATA_DOOR1: case DATA_DOOR2: @@ -117,13 +117,13 @@ class instance_blood_furnace : public InstanceMapScript case DATA_DOOR4: case DATA_DOOR5: case DATA_DOOR6: - return _doorGUIDs[data-DATA_DOOR1]; + return _doorGUIDs[data-DATA_DOOR1]; case DATA_PRISON_CELL1: case DATA_PRISON_CELL2: case DATA_PRISON_CELL3: case DATA_PRISON_CELL4: - return _prisonGUIDs[data-DATA_PRISON_CELL1]; + return _prisonGUIDs[data-DATA_PRISON_CELL1]; } return 0; } @@ -133,37 +133,37 @@ class instance_blood_furnace : public InstanceMapScript switch (type) { case DATA_THE_MAKER: - case DATA_BROGGOK: - case DATA_KELIDAN: + case DATA_BROGGOK: + case DATA_KELIDAN: _auiEncounter[type] = data; - if (type == DATA_BROGGOK) - UpdateBroggokEvent(data); + if (type == DATA_BROGGOK) + UpdateBroggokEvent(data); break; } if (data == DONE) - SaveToDB(); - } + SaveToDB(); + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; + std::ostringstream saveStream; saveStream << "B F " << _auiEncounter[0] << ' ' << _auiEncounter[1] << ' ' << _auiEncounter[2]; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } uint32 GetData(uint32 type) const { switch (type) { - case DATA_THE_MAKER: - case DATA_BROGGOK: - case DATA_KELIDAN: - return _auiEncounter[type]; + case DATA_THE_MAKER: + case DATA_BROGGOK: + case DATA_KELIDAN: + return _auiEncounter[type]; } return 0; } @@ -176,21 +176,21 @@ class instance_blood_furnace : public InstanceMapScript return; } - OUT_LOAD_INST_DATA(strIn); + OUT_LOAD_INST_DATA(strIn); - char dataHead1, dataHead2; + char dataHead1, dataHead2; - std::istringstream loadStream(strIn); - loadStream >> dataHead1 >> dataHead2; + std::istringstream loadStream(strIn); + loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'B' && dataHead2 == 'F') - { - loadStream >> _auiEncounter[0] >> _auiEncounter[1] >> _auiEncounter[2]; + if (dataHead1 == 'B' && dataHead2 == 'F') + { + loadStream >> _auiEncounter[0] >> _auiEncounter[1] >> _auiEncounter[2]; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (_auiEncounter[i] == IN_PROGRESS || _auiEncounter[i] == FAIL) - _auiEncounter[i] = NOT_STARTED; - } + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (_auiEncounter[i] == IN_PROGRESS || _auiEncounter[i] == FAIL) + _auiEncounter[i] = NOT_STARTED; + } OUT_LOAD_INST_DATA_COMPLETE; } @@ -215,12 +215,12 @@ class instance_blood_furnace : public InstanceMapScript void ResetPrisons() { - for (uint8 i = 0; i < 4; ++i) - { - _prisonerCounter[i] = _prisonersCell[i].size(); - ResetPrisoners(_prisonersCell[i]); - HandleGameObject(_prisonGUIDs[i], false); - } + for (uint8 i = 0; i < 4; ++i) + { + _prisonerCounter[i] = _prisonersCell[i].size(); + ResetPrisoners(_prisonersCell[i]); + HandleGameObject(_prisonGUIDs[i], false); + } } void ResetPrisoners(std::set prisoners) @@ -248,13 +248,13 @@ class instance_blood_furnace : public InstanceMapScript { _prisonersCell[0].insert(creature->GetGUID()); ++_prisonerCounter[0]; - ResetPrisoner(creature); + ResetPrisoner(creature); } else if (posY >= 76.0f && posY <= 91.0f) { _prisonersCell[1].insert(creature->GetGUID()); ++_prisonerCounter[1]; - ResetPrisoner(creature); + ResetPrisoner(creature); } } else if (posX >= 490.0f && posX <= 506.0f) @@ -263,13 +263,13 @@ class instance_blood_furnace : public InstanceMapScript { _prisonersCell[2].insert(creature->GetGUID()); ++_prisonerCounter[2]; - ResetPrisoner(creature); + ResetPrisoner(creature); } else if (posY >= 76.0f && posY <= 91.0f) { _prisonersCell[3].insert(creature->GetGUID()); ++_prisonerCounter[3]; - ResetPrisoner(creature); + ResetPrisoner(creature); } } } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp index e9537e58c..644dc30cf 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp @@ -8,169 +8,169 @@ REWRITTEN BY XINEF enum Says { - SAY_AGGRO = 0, - SAY_SUMMON = 1, - SAY_CURSE = 2, - SAY_KILL = 3, - SAY_DIE = 4, - SAY_WIPE = 5 + SAY_AGGRO = 0, + SAY_SUMMON = 1, + SAY_CURSE = 2, + SAY_KILL = 3, + SAY_DIE = 4, + SAY_WIPE = 5 }; enum Spells { - SPELL_SHADOW_BOLT = 30686, - SPELL_SUMMON_FIENDISH_HOUND = 30707, - SPELL_TREACHEROUS_AURA = 30695, - SPELL_DEMONIC_SHIELD = 31901, - SPELL_ORBITAL_STRIKE = 30637, - SPELL_SHADOW_WHIP = 30638 + SPELL_SHADOW_BOLT = 30686, + SPELL_SUMMON_FIENDISH_HOUND = 30707, + SPELL_TREACHEROUS_AURA = 30695, + SPELL_DEMONIC_SHIELD = 31901, + SPELL_ORBITAL_STRIKE = 30637, + SPELL_SHADOW_WHIP = 30638 }; enum Misc { - EVENT_SUMMON1 = 1, - EVENT_SUMMON2 = 2, - EVENT_TREACHEROUS_AURA = 3, - EVENT_DEMONIC_SHIELD = 4, - EVENT_KILL_TALK = 5, - EVENT_ORBITAL_STRIKE = 6, - EVENT_SHADOW_WHIP = 7 + EVENT_SUMMON1 = 1, + EVENT_SUMMON2 = 2, + EVENT_TREACHEROUS_AURA = 3, + EVENT_DEMONIC_SHIELD = 4, + EVENT_KILL_TALK = 5, + EVENT_ORBITAL_STRIKE = 6, + EVENT_SHADOW_WHIP = 7 }; class boss_omor_the_unscarred : public CreatureScript { - public: - boss_omor_the_unscarred() : CreatureScript("boss_omor_the_unscarred") { } + public: + boss_omor_the_unscarred() : CreatureScript("boss_omor_the_unscarred") { } - struct boss_omor_the_unscarredAI : public BossAI - { - boss_omor_the_unscarredAI(Creature* creature) : BossAI(creature, DATA_OMOR_THE_UNSCARRED) - { - } + struct boss_omor_the_unscarredAI : public BossAI + { + boss_omor_the_unscarredAI(Creature* creature) : BossAI(creature, DATA_OMOR_THE_UNSCARRED) + { + } - void Reset() - { - Talk(SAY_WIPE); - BossAI::Reset(); - _targetGUID = 0; - } + void Reset() + { + Talk(SAY_WIPE); + BossAI::Reset(); + _targetGUID = 0; + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - BossAI::EnterCombat(who); + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SUMMON1, 10000); - events.ScheduleEvent(EVENT_SUMMON2, 25000); - events.ScheduleEvent(EVENT_TREACHEROUS_AURA, 6000); - events.ScheduleEvent(EVENT_DEMONIC_SHIELD, 1000); - events.ScheduleEvent(EVENT_ORBITAL_STRIKE, 20000); - } + events.ScheduleEvent(EVENT_SUMMON1, 10000); + events.ScheduleEvent(EVENT_SUMMON2, 25000); + events.ScheduleEvent(EVENT_TREACHEROUS_AURA, 6000); + events.ScheduleEvent(EVENT_DEMONIC_SHIELD, 1000); + events.ScheduleEvent(EVENT_ORBITAL_STRIKE, 20000); + } - void KilledUnit(Unit*) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit*) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustSummoned(Creature* summon) - { - Talk(SAY_SUMMON); - summons.Summon(summon); - summon->SetInCombatWithZone(); - } + void JustSummoned(Creature* summon) + { + Talk(SAY_SUMMON); + summons.Summon(summon); + summon->SetInCombatWithZone(); + } - void JustDied(Unit* killer) - { - Talk(SAY_DIE); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DIE); + BossAI::JustDied(killer); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SUMMON1: - Talk(SAY_SUMMON); - me->CastSpell(me, SPELL_SUMMON_FIENDISH_HOUND, false); - break; - case EVENT_SUMMON2: - me->CastSpell(me, SPELL_SUMMON_FIENDISH_HOUND, false); - events.ScheduleEvent(EVENT_SUMMON2, 15000); - break; - case EVENT_TREACHEROUS_AURA: - if (roll_chance_i(33)) - Talk(SAY_CURSE); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_TREACHEROUS_AURA, false); - events.ScheduleEvent(EVENT_TREACHEROUS_AURA, urand(12000, 18000)); - break; - case EVENT_DEMONIC_SHIELD: - if (me->HealthBelowPct(21)) - { - me->CastSpell(me, SPELL_DEMONIC_SHIELD, false); - events.ScheduleEvent(EVENT_DEMONIC_SHIELD, 15000); - } - else - events.ScheduleEvent(EVENT_DEMONIC_SHIELD, 1000); - break; - case EVENT_ORBITAL_STRIKE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 15.0f, true)) - { - _targetGUID = target->GetGUID(); - me->CastSpell(target, SPELL_ORBITAL_STRIKE, false); - events.DelayEvents(5000); - events.ScheduleEvent(EVENT_SHADOW_WHIP, 4000); - me->GetMotionMaster()->Clear(); - } - events.ScheduleEvent(EVENT_ORBITAL_STRIKE, 20000); - break; - case EVENT_SHADOW_WHIP: - me->GetMotionMaster()->MoveChase(me->GetVictim()); - if (Unit* target = ObjectAccessor::GetUnit(*me, _targetGUID)) - me->CastSpell(target, SPELL_SHADOW_WHIP, false); - _targetGUID = 0; - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SUMMON1: + Talk(SAY_SUMMON); + me->CastSpell(me, SPELL_SUMMON_FIENDISH_HOUND, false); + break; + case EVENT_SUMMON2: + me->CastSpell(me, SPELL_SUMMON_FIENDISH_HOUND, false); + events.ScheduleEvent(EVENT_SUMMON2, 15000); + break; + case EVENT_TREACHEROUS_AURA: + if (roll_chance_i(33)) + Talk(SAY_CURSE); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_TREACHEROUS_AURA, false); + events.ScheduleEvent(EVENT_TREACHEROUS_AURA, urand(12000, 18000)); + break; + case EVENT_DEMONIC_SHIELD: + if (me->HealthBelowPct(21)) + { + me->CastSpell(me, SPELL_DEMONIC_SHIELD, false); + events.ScheduleEvent(EVENT_DEMONIC_SHIELD, 15000); + } + else + events.ScheduleEvent(EVENT_DEMONIC_SHIELD, 1000); + break; + case EVENT_ORBITAL_STRIKE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 15.0f, true)) + { + _targetGUID = target->GetGUID(); + me->CastSpell(target, SPELL_ORBITAL_STRIKE, false); + events.DelayEvents(5000); + events.ScheduleEvent(EVENT_SHADOW_WHIP, 4000); + me->GetMotionMaster()->Clear(); + } + events.ScheduleEvent(EVENT_ORBITAL_STRIKE, 20000); + break; + case EVENT_SHADOW_WHIP: + me->GetMotionMaster()->MoveChase(me->GetVictim()); + if (Unit* target = ObjectAccessor::GetUnit(*me, _targetGUID)) + me->CastSpell(target, SPELL_SHADOW_WHIP, false); + _targetGUID = 0; + break; + } - if (!me->GetVictim() || !me->isAttackReady()) - return; + if (!me->GetVictim() || !me->isAttackReady()) + return; - if (me->IsWithinMeleeRange(me->GetVictim())) - { - me->GetMotionMaster()->MoveChase(me->GetVictim()); - DoMeleeAttackIfReady(); - } - else - { - me->GetMotionMaster()->Clear(); - me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); - me->resetAttackTimer(); - } - } + if (me->IsWithinMeleeRange(me->GetVictim())) + { + me->GetMotionMaster()->MoveChase(me->GetVictim()); + DoMeleeAttackIfReady(); + } + else + { + me->GetMotionMaster()->Clear(); + me->CastSpell(me->GetVictim(), SPELL_SHADOW_BOLT, false); + me->resetAttackTimer(); + } + } - private: - uint64 _targetGUID; - }; + private: + uint64 _targetGUID; + }; - CreatureAI* GetAI(Creature* creature) const - { - return GetInstanceAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return GetInstanceAI(creature); + } }; void AddSC_boss_omor_the_unscarred() { - new boss_omor_the_unscarred(); + new boss_omor_the_unscarred(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index 0cead4c33..f3a7724b0 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -8,307 +8,307 @@ REWRITTEN BY XINEF enum Says { - SAY_INTRO = 0, - SAY_WIPE = 0, - SAY_AGGRO = 1, - SAY_KILL = 2, - SAY_DIE = 3, - EMOTE_NAZAN = 0 + SAY_INTRO = 0, + SAY_WIPE = 0, + SAY_AGGRO = 1, + SAY_KILL = 2, + SAY_DIE = 3, + EMOTE_NAZAN = 0 }; enum Spells { - SPELL_FIREBALL = 33793, - SPELL_SUMMON_LIQUID_FIRE = 31706, - SPELL_REVENGE = 19130, - SPELL_REVENGE_H = 40392, - SPELL_CALL_NAZAN = 30693, - SPELL_BELLOWING_ROAR = 39427, - SPELL_CONE_OF_FIRE = 30926 + SPELL_FIREBALL = 33793, + SPELL_SUMMON_LIQUID_FIRE = 31706, + SPELL_REVENGE = 19130, + SPELL_REVENGE_H = 40392, + SPELL_CALL_NAZAN = 30693, + SPELL_BELLOWING_ROAR = 39427, + SPELL_CONE_OF_FIRE = 30926 }; enum Misc { - ACTION_FLY_DOWN = 0, + ACTION_FLY_DOWN = 0, - POINT_MIDDLE = 0, - POINT_FLIGHT = 1, + POINT_MIDDLE = 0, + POINT_FLIGHT = 1, - EVENT_SPELL_REVENGE = 1, - EVENT_KILL_TALK = 2, - EVENT_AGGRO_TALK = 3, - EVENT_SPELL_FIREBALL = 4, - EVENT_SPELL_CONE_OF_FIRE = 5, - EVENT_SPELL_BELLOWING_ROAR = 6, - EVENT_CHANGE_POS = 7, - EVENT_RESTORE_COMBAT = 8 + EVENT_SPELL_REVENGE = 1, + EVENT_KILL_TALK = 2, + EVENT_AGGRO_TALK = 3, + EVENT_SPELL_FIREBALL = 4, + EVENT_SPELL_CONE_OF_FIRE = 5, + EVENT_SPELL_BELLOWING_ROAR = 6, + EVENT_CHANGE_POS = 7, + EVENT_RESTORE_COMBAT = 8 }; const Position NazanPos[3] = { - {-1430.37f, 1710.03f, 111.0f, 0.0f}, - {-1428.40f, 1772.09f, 111.0f, 0.0f}, - {-1373.84f, 1771.57f, 111.0f, 0.0f} + {-1430.37f, 1710.03f, 111.0f, 0.0f}, + {-1428.40f, 1772.09f, 111.0f, 0.0f}, + {-1373.84f, 1771.57f, 111.0f, 0.0f} }; class boss_vazruden_the_herald : public CreatureScript { - public: - boss_vazruden_the_herald() : CreatureScript("boss_vazruden_the_herald") { } + public: + boss_vazruden_the_herald() : CreatureScript("boss_vazruden_the_herald") { } - struct boss_vazruden_the_heraldAI : public BossAI - { - boss_vazruden_the_heraldAI(Creature* creature) : BossAI(creature, DATA_VAZRUDEN) - { - } + struct boss_vazruden_the_heraldAI : public BossAI + { + boss_vazruden_the_heraldAI(Creature* creature) : BossAI(creature, DATA_VAZRUDEN) + { + } - void Reset() - { - BossAI::Reset(); - me->SetVisible(true); - me->SetReactState(REACT_PASSIVE); - me->SummonCreature(NPC_HELLFIRE_SENTRY, -1372.56f, 1724.31f, 82.967f, 5.3058f); - me->SummonCreature(NPC_HELLFIRE_SENTRY, -1383.39f, 1711.82f, 82.7961f, 5.67232f); - } + void Reset() + { + BossAI::Reset(); + me->SetVisible(true); + me->SetReactState(REACT_PASSIVE); + me->SummonCreature(NPC_HELLFIRE_SENTRY, -1372.56f, 1724.31f, 82.967f, 5.3058f); + me->SummonCreature(NPC_HELLFIRE_SENTRY, -1383.39f, 1711.82f, 82.7961f, 5.67232f); + } - void AttackStart(Unit*) - { - } + void AttackStart(Unit*) + { + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (summon->GetEntry() != NPC_HELLFIRE_SENTRY) - summon->SetInCombatWithZone(); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (summon->GetEntry() != NPC_HELLFIRE_SENTRY) + summon->SetInCombatWithZone(); + } - void JustDied(Unit*) - { - instance->SetBossState(DATA_VAZRUDEN, DONE); - } + void JustDied(Unit*) + { + instance->SetBossState(DATA_VAZRUDEN, DONE); + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == POINT_MIDDLE) - { - me->SetVisible(false); - me->SummonCreature(NPC_VAZRUDEN, me->GetPositionX(), me->GetPositionY(), 81.2f, 5.46f); - me->SummonCreature(NPC_NAZAN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 5.46f); - } - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == POINT_MIDDLE) + { + me->SetVisible(false); + me->SummonCreature(NPC_VAZRUDEN, me->GetPositionX(), me->GetPositionY(), 81.2f, 5.46f); + me->SummonCreature(NPC_NAZAN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 5.46f); + } + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - if (summon->GetEntry() == NPC_HELLFIRE_SENTRY && summons.size() == 0) - { - Talk(SAY_INTRO); - me->GetMotionMaster()->MovePoint(POINT_MIDDLE, -1406.5f, 1746.5f, 85.0f, false); - me->setActive(true); - } - else if (summons.size() == 0) - { - Unit::Kill(me, me); - } - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + if (summon->GetEntry() == NPC_HELLFIRE_SENTRY && summons.size() == 0) + { + Talk(SAY_INTRO); + me->GetMotionMaster()->MovePoint(POINT_MIDDLE, -1406.5f, 1746.5f, 85.0f, false); + me->setActive(true); + } + else if (summons.size() == 0) + { + Unit::Kill(me, me); + } + } - void SummonedCreatureDespawn(Creature* summon) - { - summons.Despawn(summon); - if (summon->GetEntry() != NPC_HELLFIRE_SENTRY) - BossAI::EnterEvadeMode(); - } + void SummonedCreatureDespawn(Creature* summon) + { + summons.Despawn(summon); + if (summon->GetEntry() != NPC_HELLFIRE_SENTRY) + BossAI::EnterEvadeMode(); + } - void UpdateAI(uint32 diff) - { - if (!me->IsVisible() && summons.size() == 0) - BossAI::EnterEvadeMode(); - } - }; + void UpdateAI(uint32 diff) + { + if (!me->IsVisible() && summons.size() == 0) + BossAI::EnterEvadeMode(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_vazruden_the_heraldAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_vazruden_the_heraldAI(creature); + } }; class boss_nazan : public CreatureScript { - public: - boss_nazan() : CreatureScript("boss_nazan") { } + public: + boss_nazan() : CreatureScript("boss_nazan") { } - struct boss_nazanAI : public ScriptedAI - { - boss_nazanAI(Creature* creature) : ScriptedAI(creature) - { - } + struct boss_nazanAI : public ScriptedAI + { + boss_nazanAI(Creature* creature) : ScriptedAI(creature) + { + } - void Reset() - { - me->SetCanFly(true); - me->SetDisableGravity(true); - events.Reset(); - } + void Reset() + { + me->SetCanFly(true); + me->SetDisableGravity(true); + events.Reset(); + } - void EnterEvadeMode() - { - me->DespawnOrUnsummon(1); - } + void EnterEvadeMode() + { + me->DespawnOrUnsummon(1); + } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_CHANGE_POS, 0); - events.ScheduleEvent(EVENT_SPELL_FIREBALL, 5000); - } + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_CHANGE_POS, 0); + events.ScheduleEvent(EVENT_SPELL_FIREBALL, 5000); + } - void AttackStart(Unit* who) - { - if (me->IsLevitating()) - me->Attack(who, true); - else - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + if (me->IsLevitating()) + me->Attack(who, true); + else + ScriptedAI::AttackStart(who); + } - void DoAction(int32 param) - { - if (param == ACTION_FLY_DOWN) - { - Talk(EMOTE_NAZAN); - events.Reset(); - me->GetMotionMaster()->MovePoint(POINT_MIDDLE, -1406.5f, 1746.5f, 81.2f, false); - } - } + void DoAction(int32 param) + { + if (param == ACTION_FLY_DOWN) + { + Talk(EMOTE_NAZAN); + events.Reset(); + me->GetMotionMaster()->MovePoint(POINT_MIDDLE, -1406.5f, 1746.5f, 81.2f, false); + } + } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == POINT_MIDDLE) - { - me->SetDisableGravity(false); - me->SetCanFly(false); - events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0); - events.ScheduleEvent(EVENT_SPELL_CONE_OF_FIRE, 5000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_BELLOWING_ROAR, 10000); - } - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == POINT_MIDDLE) + { + me->SetDisableGravity(false); + me->SetCanFly(false); + events.ScheduleEvent(EVENT_RESTORE_COMBAT, 0); + events.ScheduleEvent(EVENT_SPELL_CONE_OF_FIRE, 5000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_BELLOWING_ROAR, 10000); + } + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_FIREBALL: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_FIREBALL, false); - events.ScheduleEvent(EVENT_SPELL_FIREBALL, urand(4000, 6000)); - break; - case EVENT_CHANGE_POS: - me->GetMotionMaster()->MovePoint(POINT_FLIGHT, NazanPos[urand(0,2)], false); - events.DelayEvents(7000); - events.ScheduleEvent(EVENT_CHANGE_POS, 30000); - break; - case EVENT_RESTORE_COMBAT: - me->GetMotionMaster()->MoveChase(me->GetVictim()); - break; - case EVENT_SPELL_CONE_OF_FIRE: - me->CastSpell(me->GetVictim(), SPELL_CONE_OF_FIRE, false); - events.ScheduleEvent(EVENT_SPELL_CONE_OF_FIRE, 12000); - break; - case EVENT_SPELL_BELLOWING_ROAR: - me->CastSpell(me, SPELL_BELLOWING_ROAR, false); - events.ScheduleEvent(EVENT_SPELL_BELLOWING_ROAR, 30000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_FIREBALL: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_FIREBALL, false); + events.ScheduleEvent(EVENT_SPELL_FIREBALL, urand(4000, 6000)); + break; + case EVENT_CHANGE_POS: + me->GetMotionMaster()->MovePoint(POINT_FLIGHT, NazanPos[urand(0,2)], false); + events.DelayEvents(7000); + events.ScheduleEvent(EVENT_CHANGE_POS, 30000); + break; + case EVENT_RESTORE_COMBAT: + me->GetMotionMaster()->MoveChase(me->GetVictim()); + break; + case EVENT_SPELL_CONE_OF_FIRE: + me->CastSpell(me->GetVictim(), SPELL_CONE_OF_FIRE, false); + events.ScheduleEvent(EVENT_SPELL_CONE_OF_FIRE, 12000); + break; + case EVENT_SPELL_BELLOWING_ROAR: + me->CastSpell(me, SPELL_BELLOWING_ROAR, false); + events.ScheduleEvent(EVENT_SPELL_BELLOWING_ROAR, 30000); + break; + } - if (!me->IsLevitating()) - DoMeleeAttackIfReady(); - } + if (!me->IsLevitating()) + DoMeleeAttackIfReady(); + } - private: - EventMap events; - }; + private: + EventMap events; + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_nazanAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_nazanAI(creature); + } }; class boss_vazruden : public CreatureScript { - public: - boss_vazruden() : CreatureScript("boss_vazruden") { } + public: + boss_vazruden() : CreatureScript("boss_vazruden") { } - struct boss_vazrudenAI : public ScriptedAI - { - boss_vazrudenAI(Creature* creature) : ScriptedAI(creature) { } + struct boss_vazrudenAI : public ScriptedAI + { + boss_vazrudenAI(Creature* creature) : ScriptedAI(creature) { } - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterEvadeMode() - { - Talk(SAY_WIPE); - me->DespawnOrUnsummon(1); - } + void EnterEvadeMode() + { + Talk(SAY_WIPE); + me->DespawnOrUnsummon(1); + } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_AGGRO_TALK, 5000); - events.ScheduleEvent(EVENT_SPELL_REVENGE, 4000); - } + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_AGGRO_TALK, 5000); + events.ScheduleEvent(EVENT_SPELL_REVENGE, 4000); + } - void KilledUnit(Unit*) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit*) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustDied(Unit*) - { - me->CastSpell(me, SPELL_CALL_NAZAN, true); - Talk(SAY_DIE); - } + void JustDied(Unit*) + { + me->CastSpell(me, SPELL_CALL_NAZAN, true); + Talk(SAY_DIE); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_AGGRO_TALK: - Talk(SAY_AGGRO); - break; - case EVENT_SPELL_REVENGE: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_REVENGE, SPELL_REVENGE_H), false); - events.ScheduleEvent(EVENT_SPELL_REVENGE, 6000); - break; - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_AGGRO_TALK: + Talk(SAY_AGGRO); + break; + case EVENT_SPELL_REVENGE: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_REVENGE, SPELL_REVENGE_H), false); + events.ScheduleEvent(EVENT_SPELL_REVENGE, 6000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - EventMap events; - }; + private: + EventMap events; + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_vazrudenAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_vazrudenAI(creature); + } }; class spell_vazruden_fireball : public SpellScriptLoader @@ -323,7 +323,7 @@ class spell_vazruden_fireball : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - target->CastSpell(target, SPELL_SUMMON_LIQUID_FIRE, true); + target->CastSpell(target, SPELL_SUMMON_LIQUID_FIRE, true); } void Register() @@ -350,7 +350,7 @@ class spell_vazruden_call_nazan : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) - target->GetAI()->DoAction(ACTION_FLY_DOWN); + target->GetAI()->DoAction(ACTION_FLY_DOWN); } void Register() @@ -367,9 +367,9 @@ class spell_vazruden_call_nazan : public SpellScriptLoader void AddSC_boss_vazruden_the_herald() { - new boss_vazruden_the_herald(); - new boss_vazruden(); - new boss_nazan(); - new spell_vazruden_fireball(); - new spell_vazruden_call_nazan(); + new boss_vazruden_the_herald(); + new boss_vazruden(); + new boss_nazan(); + new spell_vazruden_fireball(); + new spell_vazruden_call_nazan(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp index 30b85aa1c..7b0d8b53a 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp @@ -8,146 +8,146 @@ REWRITTEN BY XINEF enum Says { - SAY_TAUNT = 0, - SAY_HEAL = 1, - SAY_SURGE = 2, - SAY_AGGRO = 3, - SAY_KILL = 4, - SAY_DIE = 5 + SAY_TAUNT = 0, + SAY_HEAL = 1, + SAY_SURGE = 2, + SAY_AGGRO = 3, + SAY_KILL = 4, + SAY_DIE = 5 }; enum Spells { - SPELL_MORTAL_WOUND = 30641, - SPELL_SURGE = 34645, - SPELL_RETALIATION = 22857 + SPELL_MORTAL_WOUND = 30641, + SPELL_SURGE = 34645, + SPELL_RETALIATION = 22857 }; enum Misc { - NPC_HELLFIRE_WATCHER = 17309, + NPC_HELLFIRE_WATCHER = 17309, - EVENT_MORTAL_WOUND = 1, - EVENT_SURGE = 2, - EVENT_RETALIATION = 3, - EVENT_KILL_TALK = 4, - EVENT_CHECK_HEALTH = 5 + EVENT_MORTAL_WOUND = 1, + EVENT_SURGE = 2, + EVENT_RETALIATION = 3, + EVENT_KILL_TALK = 4, + EVENT_CHECK_HEALTH = 5 }; class boss_watchkeeper_gargolmar : public CreatureScript { - public: - boss_watchkeeper_gargolmar() : CreatureScript("boss_watchkeeper_gargolmar") { } + public: + boss_watchkeeper_gargolmar() : CreatureScript("boss_watchkeeper_gargolmar") { } - struct boss_watchkeeper_gargolmarAI : public BossAI - { - boss_watchkeeper_gargolmarAI(Creature* creature) : BossAI(creature, DATA_WATCHKEEPER_GARGOLMAR) - { - _taunted = false; - } + struct boss_watchkeeper_gargolmarAI : public BossAI + { + boss_watchkeeper_gargolmarAI(Creature* creature) : BossAI(creature, DATA_WATCHKEEPER_GARGOLMAR) + { + _taunted = false; + } - void Reset() - { - BossAI::Reset(); - } + void Reset() + { + BossAI::Reset(); + } - void EnterCombat(Unit* who) - { - Talk(SAY_AGGRO); - BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_MORTAL_WOUND, 5000); - events.ScheduleEvent(EVENT_SURGE, 3000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - events.ScheduleEvent(EVENT_RETALIATION, 1000); - } + void EnterCombat(Unit* who) + { + Talk(SAY_AGGRO); + BossAI::EnterCombat(who); + events.ScheduleEvent(EVENT_MORTAL_WOUND, 5000); + events.ScheduleEvent(EVENT_SURGE, 3000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_RETALIATION, 1000); + } - void MoveInLineOfSight(Unit* who) - { - if (!_taunted) - { - if (who->GetTypeId() == TYPEID_PLAYER) - { - _taunted = true; - Talk(SAY_TAUNT); - } - } + void MoveInLineOfSight(Unit* who) + { + if (!_taunted) + { + if (who->GetTypeId() == TYPEID_PLAYER) + { + _taunted = true; + Talk(SAY_TAUNT); + } + } - BossAI::MoveInLineOfSight(who); - } + BossAI::MoveInLineOfSight(who); + } - void KilledUnit(Unit*) - { - if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) - { - Talk(SAY_KILL); - events.ScheduleEvent(EVENT_KILL_TALK, 6000); - } - } + void KilledUnit(Unit*) + { + if (events.GetNextEventTime(EVENT_KILL_TALK) == 0) + { + Talk(SAY_KILL); + events.ScheduleEvent(EVENT_KILL_TALK, 6000); + } + } - void JustDied(Unit* killer) - { - Talk(SAY_DIE); - BossAI::JustDied(killer); - } + void JustDied(Unit* killer) + { + Talk(SAY_DIE); + BossAI::JustDied(killer); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_MORTAL_WOUND: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); - events.ScheduleEvent(EVENT_MORTAL_WOUND, 8000); - break; - case EVENT_SURGE: - Talk(SAY_SURGE); - if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0)) - me->CastSpell(target, SPELL_SURGE, false); - events.ScheduleEvent(EVENT_SURGE, 11000); - break; - case EVENT_RETALIATION: - if (me->HealthBelowPct(20)) - { - me->CastSpell(me, SPELL_RETALIATION, false); - events.ScheduleEvent(EVENT_RETALIATION, 30000); - } - else - events.ScheduleEvent(EVENT_RETALIATION, 500); - break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(50)) - { - Talk(SAY_HEAL); - std::list clist; - me->GetCreaturesWithEntryInRange(clist, 100.0f, NPC_HELLFIRE_WATCHER); - for (std::list::const_iterator itr = clist.begin(); itr != clist.end(); ++itr) - (*itr)->AI()->SetData(NPC_HELLFIRE_WATCHER, 0); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_MORTAL_WOUND: + me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); + events.ScheduleEvent(EVENT_MORTAL_WOUND, 8000); + break; + case EVENT_SURGE: + Talk(SAY_SURGE); + if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0)) + me->CastSpell(target, SPELL_SURGE, false); + events.ScheduleEvent(EVENT_SURGE, 11000); + break; + case EVENT_RETALIATION: + if (me->HealthBelowPct(20)) + { + me->CastSpell(me, SPELL_RETALIATION, false); + events.ScheduleEvent(EVENT_RETALIATION, 30000); + } + else + events.ScheduleEvent(EVENT_RETALIATION, 500); + break; + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(50)) + { + Talk(SAY_HEAL); + std::list clist; + me->GetCreaturesWithEntryInRange(clist, 100.0f, NPC_HELLFIRE_WATCHER); + for (std::list::const_iterator itr = clist.begin(); itr != clist.end(); ++itr) + (*itr)->AI()->SetData(NPC_HELLFIRE_WATCHER, 0); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - bool _taunted; - }; + private: + bool _taunted; + }; - CreatureAI* GetAI(Creature* creature) const - { - return new boss_watchkeeper_gargolmarAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new boss_watchkeeper_gargolmarAI(creature); + } }; void AddSC_boss_watchkeeper_gargolmar() { - new boss_watchkeeper_gargolmar(); + new boss_watchkeeper_gargolmar(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h index bcc3dcc12..ae1880259 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h @@ -7,24 +7,24 @@ REWRITTEN BY XINEF enum DataTypes { - DATA_WATCHKEEPER_GARGOLMAR = 0, - DATA_OMOR_THE_UNSCARRED = 1, - DATA_VAZRUDEN = 2, - MAX_ENCOUNTERS = 3 + DATA_WATCHKEEPER_GARGOLMAR = 0, + DATA_OMOR_THE_UNSCARRED = 1, + DATA_VAZRUDEN = 2, + MAX_ENCOUNTERS = 3 }; enum CreatureIds { - NPC_HELLFIRE_SENTRY = 17517, - NPC_VAZRUDEN_HERALD = 17307, - NPC_VAZRUDEN = 17537, - NPC_NAZAN = 17536 + NPC_HELLFIRE_SENTRY = 17517, + NPC_VAZRUDEN_HERALD = 17307, + NPC_VAZRUDEN = 17537, + NPC_NAZAN = 17536 }; enum GameobjectIds { - GO_FEL_IRON_CHEST_NORMAL = 185168, - GO_FEL_IRON_CHECT_HEROIC = 185169 + GO_FEL_IRON_CHEST_NORMAL = 185168, + GO_FEL_IRON_CHECT_HEROIC = 185169 }; #endif diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp index ed28c3455..6090f3d80 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp @@ -37,9 +37,9 @@ class instance_ramparts : public InstanceMapScript if (!InstanceScript::SetBossState(type, state)) return false; - if (type == DATA_VAZRUDEN && state == DONE) + if (type == DATA_VAZRUDEN && state == DONE) if (GameObject* chest = instance->GetGameObject(felIronChestGUID)) - chest->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + chest->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); return true; } diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index 85a51f803..df0db2882 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -9,78 +9,78 @@ REWRITTEN BY XINEF enum Yells { - SAY_TAUNT = 0, - SAY_FREE = 1, - SAY_AGGRO = 2, - SAY_SLAY = 3, - SAY_BANISH = 4, - SAY_PHASE3 = 5, - SAY_DEATH = 6, + SAY_TAUNT = 0, + SAY_FREE = 1, + SAY_AGGRO = 2, + SAY_SLAY = 3, + SAY_BANISH = 4, + SAY_PHASE3 = 5, + SAY_DEATH = 6, }; enum Emotes { - SAY_EMOTE_BEGIN = 7, - SAY_EMOTE_NEARLY = 8, - SAY_EMOTE_FREE = 9, - SAY_EMOTE_NOVA = 10 + SAY_EMOTE_BEGIN = 7, + SAY_EMOTE_NEARLY = 8, + SAY_EMOTE_FREE = 9, + SAY_EMOTE_NOVA = 10 }; enum Spells { - SPELL_SHADOW_CAGE = 30205, - SPELL_BLAST_NOVA = 30616, - SPELL_CLEAVE = 30619, - SPELL_BLAZE = 30541, - SPELL_BLAZE_SUMMON = 30542, - SPELL_BERSERK = 27680, - SPELL_SHADOW_GRASP_VISUAL = 30166, - SPELL_MIND_EXHAUSTION = 44032, - SPELL_QUAKE = 30657, - SPELL_COLLAPSE_DAMAGE = 36449, - SPELL_CAMERA_SHAKE = 36455, - SPELL_DEBRIS_VISUAL = 30632, - SPELL_DEBRIS_DAMAGE = 30631 + SPELL_SHADOW_CAGE = 30205, + SPELL_BLAST_NOVA = 30616, + SPELL_CLEAVE = 30619, + SPELL_BLAZE = 30541, + SPELL_BLAZE_SUMMON = 30542, + SPELL_BERSERK = 27680, + SPELL_SHADOW_GRASP_VISUAL = 30166, + SPELL_MIND_EXHAUSTION = 44032, + SPELL_QUAKE = 30657, + SPELL_COLLAPSE_DAMAGE = 36449, + SPELL_CAMERA_SHAKE = 36455, + SPELL_DEBRIS_VISUAL = 30632, + SPELL_DEBRIS_DAMAGE = 30631 }; enum Events { - EVENT_EMOTE1 = 1, - EVENT_EMOTE2 = 2, - EVENT_EMOTE3 = 3, - EVENT_ENTER_COMBAT = 4, - EVENT_RECENTLY_SPOKEN = 5, + EVENT_EMOTE1 = 1, + EVENT_EMOTE2 = 2, + EVENT_EMOTE3 = 3, + EVENT_ENTER_COMBAT = 4, + EVENT_RECENTLY_SPOKEN = 5, - EVENT_CLEAVE = 10, - EVENT_BLAST_NOVA = 11, - EVENT_BLAZE = 12, - EVENT_ENRAGE = 13, - EVENT_QUAKE = 14, - EVENT_CHECK_HEALTH = 15, - EVENT_COLLAPSE_CEIL = 16, - EVENT_COLLAPSE_DAMAGE = 17, - EVENT_DEBRIS = 18, + EVENT_CLEAVE = 10, + EVENT_BLAST_NOVA = 11, + EVENT_BLAZE = 12, + EVENT_ENRAGE = 13, + EVENT_QUAKE = 14, + EVENT_CHECK_HEALTH = 15, + EVENT_COLLAPSE_CEIL = 16, + EVENT_COLLAPSE_DAMAGE = 17, + EVENT_DEBRIS = 18, - EVENT_RANDOM_TAUNT = 30, - EVENT_CHECK_GRASP = 31, - EVENT_CANCEL_GRASP_CHECK = 32 + EVENT_RANDOM_TAUNT = 30, + EVENT_CHECK_GRASP = 31, + EVENT_CANCEL_GRASP_CHECK = 32 }; class DealDebrisDamage : public BasicEvent { public: - DealDebrisDamage(Creature& creature, uint64 targetGUID) : _owner(creature), _targetGUID(targetGUID) { } + DealDebrisDamage(Creature& creature, uint64 targetGUID) : _owner(creature), _targetGUID(targetGUID) { } - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) - { - if (Unit* target = ObjectAccessor::GetUnit(_owner, _targetGUID)) - target->CastSpell(target, SPELL_DEBRIS_DAMAGE, true, NULL, NULL, _owner.GetGUID()); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) + { + if (Unit* target = ObjectAccessor::GetUnit(_owner, _targetGUID)) + target->CastSpell(target, SPELL_DEBRIS_DAMAGE, true, NULL, NULL, _owner.GetGUID()); + return true; + } private: - uint64 _targetGUID; - Creature& _owner; + uint64 _targetGUID; + Creature& _owner; }; class boss_magtheridon : public CreatureScript @@ -93,26 +93,26 @@ class boss_magtheridon : public CreatureScript { boss_magtheridonAI(Creature* creature) : BossAI(creature, TYPE_MAGTHERIDON) { } - EventMap events2; + EventMap events2; void Reset() { - events2.Reset(); - events2.ScheduleEvent(EVENT_RANDOM_TAUNT, 90000); - _Reset(); + events2.Reset(); + events2.ScheduleEvent(EVENT_RANDOM_TAUNT, 90000); + _Reset(); me->CastSpell(me, SPELL_SHADOW_CAGE, true); - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC); + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC); } void KilledUnit(Unit* victim) { - if (events.GetNextEventTime(EVENT_RECENTLY_SPOKEN) == 0) - { - events.ScheduleEvent(EVENT_RECENTLY_SPOKEN, 5000); - Talk(SAY_SLAY); - } + if (events.GetNextEventTime(EVENT_RECENTLY_SPOKEN) == 0) + { + events.ScheduleEvent(EVENT_RECENTLY_SPOKEN, 5000); + Talk(SAY_SLAY); + } } void JustDied(Unit* /*killer*/) @@ -125,126 +125,126 @@ class boss_magtheridon : public CreatureScript void EnterCombat(Unit* /*who*/) { - events2.Reset(); + events2.Reset(); _EnterCombat(); - events.ScheduleEvent(EVENT_EMOTE1, 0); - events.ScheduleEvent(EVENT_EMOTE2, 60000); - events.ScheduleEvent(EVENT_EMOTE3, 120000); - events.ScheduleEvent(EVENT_ENTER_COMBAT, 123000); + events.ScheduleEvent(EVENT_EMOTE1, 0); + events.ScheduleEvent(EVENT_EMOTE2, 60000); + events.ScheduleEvent(EVENT_EMOTE3, 120000); + events.ScheduleEvent(EVENT_ENTER_COMBAT, 123000); } void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_RANDOM_TAUNT: - Talk(SAY_TAUNT); - events2.ScheduleEvent(EVENT_RANDOM_TAUNT, 90000); - break; - case EVENT_CHECK_GRASP: - if (me->GetAuraCount(SPELL_SHADOW_GRASP_VISUAL) == 5) - { - Talk(SAY_BANISH); - me->InterruptNonMeleeSpells(true); - break; - } - events2.ScheduleEvent(EVENT_CHECK_GRASP, 0); - break; - } + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_RANDOM_TAUNT: + Talk(SAY_TAUNT); + events2.ScheduleEvent(EVENT_RANDOM_TAUNT, 90000); + break; + case EVENT_CHECK_GRASP: + if (me->GetAuraCount(SPELL_SHADOW_GRASP_VISUAL) == 5) + { + Talk(SAY_BANISH); + me->InterruptNonMeleeSpells(true); + break; + } + events2.ScheduleEvent(EVENT_CHECK_GRASP, 0); + break; + } if (!UpdateVictim() || !CheckInRoom()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_EMOTE1: - Talk(SAY_EMOTE_BEGIN); - break; - case EVENT_EMOTE2: - Talk(SAY_EMOTE_NEARLY); - break; - case EVENT_EMOTE3: - Talk(SAY_EMOTE_FREE); - Talk(SAY_FREE); - break; - case EVENT_ENTER_COMBAT: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_AGGRESSIVE); - events.ScheduleEvent(EVENT_CLEAVE, 9000); - events.ScheduleEvent(EVENT_BLAST_NOVA, 60000); - events.ScheduleEvent(EVENT_BLAZE, 10000); - events.ScheduleEvent(EVENT_QUAKE, 40000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); - events.ScheduleEvent(EVENT_ENRAGE, 22*MINUTE*IN_MILLISECONDS); + switch (events.ExecuteEvent()) + { + case EVENT_EMOTE1: + Talk(SAY_EMOTE_BEGIN); + break; + case EVENT_EMOTE2: + Talk(SAY_EMOTE_NEARLY); + break; + case EVENT_EMOTE3: + Talk(SAY_EMOTE_FREE); + Talk(SAY_FREE); + break; + case EVENT_ENTER_COMBAT: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC); + me->SetReactState(REACT_AGGRESSIVE); + events.ScheduleEvent(EVENT_CLEAVE, 9000); + events.ScheduleEvent(EVENT_BLAST_NOVA, 60000); + events.ScheduleEvent(EVENT_BLAZE, 10000); + events.ScheduleEvent(EVENT_QUAKE, 40000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); + events.ScheduleEvent(EVENT_ENRAGE, 22*MINUTE*IN_MILLISECONDS); - instance->SetData(DATA_ACTIVATE_CUBES, 1); - me->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE); - break; - case EVENT_CLEAVE: - me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); - events.ScheduleEvent(EVENT_CLEAVE, 10000); - break; - case EVENT_BLAST_NOVA: - me->CastSpell(me, SPELL_BLAST_NOVA, false); - events.ScheduleEvent(EVENT_BLAST_NOVA, 60000); - events.ScheduleEvent(EVENT_CANCEL_GRASP_CHECK, 12000); - events2.ScheduleEvent(EVENT_CHECK_GRASP, 0); - break; - case EVENT_BLAZE: - me->CastCustomSpell(SPELL_BLAZE, SPELLVALUE_MAX_TARGETS, 1); - events.ScheduleEvent(EVENT_BLAZE, 30000); - break; - case EVENT_ENRAGE: - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_CANCEL_GRASP_CHECK: - events2.Reset(); - break; - case EVENT_QUAKE: - me->CastSpell(me, SPELL_QUAKE, false); - events.ScheduleEvent(EVENT_QUAKE, 50000); - break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(30)) - { - Talk(SAY_PHASE3); - events.SetPhase(1); - events.DelayEvents(18000); - events.ScheduleEvent(EVENT_COLLAPSE_CEIL, 8000); - events.ScheduleEvent(EVENT_COLLAPSE_DAMAGE, 15000); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); - break; - case EVENT_COLLAPSE_CEIL: - me->CastSpell(me, SPELL_CAMERA_SHAKE, true); - instance->SetData(DATA_COLLAPSE, GO_STATE_ACTIVE); - break; - case EVENT_COLLAPSE_DAMAGE: - me->CastSpell(me, SPELL_COLLAPSE_DAMAGE, true); - me->resetAttackTimer(); - events.SetPhase(0); - events.ScheduleEvent(EVENT_DEBRIS, 20000); - break; - case EVENT_DEBRIS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) - { - target->CastSpell(target, SPELL_DEBRIS_VISUAL, true, NULL, NULL, me->GetGUID()); - me->m_Events.AddEvent(new DealDebrisDamage(*me, target->GetGUID()), me->m_Events.CalculateTime(5000)); - } - events.ScheduleEvent(EVENT_DEBRIS, 20000); - break; - } + instance->SetData(DATA_ACTIVATE_CUBES, 1); + me->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE); + break; + case EVENT_CLEAVE: + me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); + events.ScheduleEvent(EVENT_CLEAVE, 10000); + break; + case EVENT_BLAST_NOVA: + me->CastSpell(me, SPELL_BLAST_NOVA, false); + events.ScheduleEvent(EVENT_BLAST_NOVA, 60000); + events.ScheduleEvent(EVENT_CANCEL_GRASP_CHECK, 12000); + events2.ScheduleEvent(EVENT_CHECK_GRASP, 0); + break; + case EVENT_BLAZE: + me->CastCustomSpell(SPELL_BLAZE, SPELLVALUE_MAX_TARGETS, 1); + events.ScheduleEvent(EVENT_BLAZE, 30000); + break; + case EVENT_ENRAGE: + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_CANCEL_GRASP_CHECK: + events2.Reset(); + break; + case EVENT_QUAKE: + me->CastSpell(me, SPELL_QUAKE, false); + events.ScheduleEvent(EVENT_QUAKE, 50000); + break; + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(30)) + { + Talk(SAY_PHASE3); + events.SetPhase(1); + events.DelayEvents(18000); + events.ScheduleEvent(EVENT_COLLAPSE_CEIL, 8000); + events.ScheduleEvent(EVENT_COLLAPSE_DAMAGE, 15000); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 500); + break; + case EVENT_COLLAPSE_CEIL: + me->CastSpell(me, SPELL_CAMERA_SHAKE, true); + instance->SetData(DATA_COLLAPSE, GO_STATE_ACTIVE); + break; + case EVENT_COLLAPSE_DAMAGE: + me->CastSpell(me, SPELL_COLLAPSE_DAMAGE, true); + me->resetAttackTimer(); + events.SetPhase(0); + events.ScheduleEvent(EVENT_DEBRIS, 20000); + break; + case EVENT_DEBRIS: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM)) + { + target->CastSpell(target, SPELL_DEBRIS_VISUAL, true, NULL, NULL, me->GetGUID()); + me->m_Events.AddEvent(new DealDebrisDamage(*me, target->GetGUID()), me->m_Events.CalculateTime(5000)); + } + events.ScheduleEvent(EVENT_DEBRIS, 20000); + break; + } - if (!events.IsInPhase(1)) - DoMeleeAttackIfReady(); + if (!events.IsInPhase(1)) + DoMeleeAttackIfReady(); } }; @@ -290,26 +290,26 @@ public: { PrepareAuraScript(spell_magtheridon_shadow_grasp_AuraScript) - void HandleDummyApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleDummyApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->CastSpell((Unit*)NULL, SPELL_SHADOW_GRASP_VISUAL, false); + GetUnitOwner()->CastSpell((Unit*)NULL, SPELL_SHADOW_GRASP_VISUAL, false); } - - void HandleDummyRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + + void HandleDummyRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->InterruptNonMeleeSpells(true); + GetUnitOwner()->InterruptNonMeleeSpells(true); } - void HandlePeriodicRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandlePeriodicRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_MIND_EXHAUSTION, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_MIND_EXHAUSTION, true); } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_magtheridon_shadow_grasp_AuraScript::HandleDummyApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_magtheridon_shadow_grasp_AuraScript::HandleDummyRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_magtheridon_shadow_grasp_AuraScript::HandlePeriodicRemove, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_magtheridon_shadow_grasp_AuraScript::HandleDummyApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_magtheridon_shadow_grasp_AuraScript::HandleDummyRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_magtheridon_shadow_grasp_AuraScript::HandlePeriodicRemove, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); } }; @@ -322,7 +322,7 @@ public: void AddSC_boss_magtheridon() { new boss_magtheridon(); - new spell_magtheridon_blaze(); - new spell_magtheridon_shadow_grasp(); + new spell_magtheridon_blaze(); + new spell_magtheridon_shadow_grasp(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp index 66d8abc9c..0d459433b 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp @@ -22,22 +22,22 @@ MinionData const minionData[] = class instance_magtheridons_lair : public InstanceMapScript { public: - instance_magtheridons_lair() : InstanceMapScript("instance_magtheridons_lair", 544) { } + instance_magtheridons_lair() : InstanceMapScript("instance_magtheridons_lair", 544) { } struct instance_magtheridons_lair_InstanceMapScript : public InstanceScript { instance_magtheridons_lair_InstanceMapScript(Map* map) : InstanceScript(map) { - SetBossNumber(MAX_ENCOUNTER); + SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doorData); LoadMinionData(minionData); } void Initialize() { - _wardersSet.clear(); - _cubesSet.clear(); - _columnSet.clear(); + _wardersSet.clear(); + _cubesSet.clear(); + _columnSet.clear(); _magtheridonGUID = 0; } @@ -45,25 +45,25 @@ class instance_magtheridons_lair : public InstanceMapScript { switch (creature->GetEntry()) { - case NPC_MAGTHERIDON: - _magtheridonGUID = creature->GetGUID(); - break; - case NPC_HELLFIRE_CHANNELER: - AddMinion(creature, true); - break; - case NPC_HELLFIRE_WARDER: - _wardersSet.insert(creature->GetGUID()); - break; + case NPC_MAGTHERIDON: + _magtheridonGUID = creature->GetGUID(); + break; + case NPC_HELLFIRE_CHANNELER: + AddMinion(creature, true); + break; + case NPC_HELLFIRE_WARDER: + _wardersSet.insert(creature->GetGUID()); + break; } } - void OnCreatureRemove(Creature* creature) + void OnCreatureRemove(Creature* creature) { switch (creature->GetEntry()) { - case NPC_HELLFIRE_CHANNELER: - AddMinion(creature, false); - break; + case NPC_HELLFIRE_CHANNELER: + AddMinion(creature, false); + break; } } @@ -71,21 +71,21 @@ class instance_magtheridons_lair : public InstanceMapScript { switch (go->GetEntry()) { - case GO_MAGTHERIDON_DOORS: - AddDoor(go, true); - break; - case GO_MANTICRON_CUBE: - _cubesSet.insert(go->GetGUID()); - break; - case GO_MAGTHERIDON_HALL: - case GO_MAGTHERIDON_COLUMN0: - case GO_MAGTHERIDON_COLUMN1: - case GO_MAGTHERIDON_COLUMN2: - case GO_MAGTHERIDON_COLUMN3: - case GO_MAGTHERIDON_COLUMN4: - case GO_MAGTHERIDON_COLUMN5: - _columnSet.insert(go->GetGUID()); - break; + case GO_MAGTHERIDON_DOORS: + AddDoor(go, true); + break; + case GO_MANTICRON_CUBE: + _cubesSet.insert(go->GetGUID()); + break; + case GO_MAGTHERIDON_HALL: + case GO_MAGTHERIDON_COLUMN0: + case GO_MAGTHERIDON_COLUMN1: + case GO_MAGTHERIDON_COLUMN2: + case GO_MAGTHERIDON_COLUMN3: + case GO_MAGTHERIDON_COLUMN4: + case GO_MAGTHERIDON_COLUMN5: + _columnSet.insert(go->GetGUID()); + break; } } @@ -96,70 +96,70 @@ class instance_magtheridons_lair : public InstanceMapScript case GO_MAGTHERIDON_DOORS: AddDoor(go, false); break; - case GO_MANTICRON_CUBE: - _cubesSet.erase(go->GetGUID()); - break; - case GO_MAGTHERIDON_HALL: - case GO_MAGTHERIDON_COLUMN0: - case GO_MAGTHERIDON_COLUMN1: - case GO_MAGTHERIDON_COLUMN2: - case GO_MAGTHERIDON_COLUMN3: - case GO_MAGTHERIDON_COLUMN4: - case GO_MAGTHERIDON_COLUMN5: - _columnSet.erase(go->GetGUID()); - break; + case GO_MANTICRON_CUBE: + _cubesSet.erase(go->GetGUID()); + break; + case GO_MAGTHERIDON_HALL: + case GO_MAGTHERIDON_COLUMN0: + case GO_MAGTHERIDON_COLUMN1: + case GO_MAGTHERIDON_COLUMN2: + case GO_MAGTHERIDON_COLUMN3: + case GO_MAGTHERIDON_COLUMN4: + case GO_MAGTHERIDON_COLUMN5: + _columnSet.erase(go->GetGUID()); + break; } } - bool SetBossState(uint32 id, EncounterState state) - { - if (!InstanceScript::SetBossState(id, state)) - return false; + bool SetBossState(uint32 id, EncounterState state) + { + if (!InstanceScript::SetBossState(id, state)) + return false; - if (id == TYPE_MAGTHERIDON) - { - if (state == IN_PROGRESS) - { - for (std::set::const_iterator itr = _wardersSet.begin(); itr != _wardersSet.end(); ++itr) - if (Creature* warder = instance->GetCreature(*itr)) - if (warder->IsAlive()) - { - warder->InterruptNonMeleeSpells(true); - warder->SetInCombatWithZone(); - } - } - else - { - for (std::set::const_iterator itr = _cubesSet.begin(); itr != _cubesSet.end(); ++itr) - if (GameObject* cube = instance->GetGameObject(*itr)) - cube->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + if (id == TYPE_MAGTHERIDON) + { + if (state == IN_PROGRESS) + { + for (std::set::const_iterator itr = _wardersSet.begin(); itr != _wardersSet.end(); ++itr) + if (Creature* warder = instance->GetCreature(*itr)) + if (warder->IsAlive()) + { + warder->InterruptNonMeleeSpells(true); + warder->SetInCombatWithZone(); + } + } + else + { + for (std::set::const_iterator itr = _cubesSet.begin(); itr != _cubesSet.end(); ++itr) + if (GameObject* cube = instance->GetGameObject(*itr)) + cube->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - if (state == NOT_STARTED) - SetData(DATA_COLLAPSE, GO_READY); - } - } - return true; - } + if (state == NOT_STARTED) + SetData(DATA_COLLAPSE, GO_READY); + } + } + return true; + } void SetData(uint32 type, uint32 data) { switch (type) { - case DATA_CHANNELER_COMBAT: - if (GetBossState(TYPE_MAGTHERIDON) != IN_PROGRESS) - if (Creature* magtheridon = instance->GetCreature(_magtheridonGUID)) - magtheridon->SetInCombatWithZone(); - break; - case DATA_ACTIVATE_CUBES: - for (std::set::const_iterator itr = _cubesSet.begin(); itr != _cubesSet.end(); ++itr) - if (GameObject* cube = instance->GetGameObject(*itr)) - cube->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case DATA_COLLAPSE: - for (std::set::const_iterator itr = _columnSet.begin(); itr != _columnSet.end(); ++itr) - if (GameObject* column = instance->GetGameObject(*itr)) - column->SetGoState(GOState(data)); - break; + case DATA_CHANNELER_COMBAT: + if (GetBossState(TYPE_MAGTHERIDON) != IN_PROGRESS) + if (Creature* magtheridon = instance->GetCreature(_magtheridonGUID)) + magtheridon->SetInCombatWithZone(); + break; + case DATA_ACTIVATE_CUBES: + for (std::set::const_iterator itr = _cubesSet.begin(); itr != _cubesSet.end(); ++itr) + if (GameObject* cube = instance->GetGameObject(*itr)) + cube->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case DATA_COLLAPSE: + for (std::set::const_iterator itr = _columnSet.begin(); itr != _columnSet.end(); ++itr) + if (GameObject* column = instance->GetGameObject(*itr)) + column->SetGoState(GOState(data)); + break; } } @@ -206,7 +206,7 @@ class instance_magtheridons_lair : public InstanceMapScript OUT_LOAD_INST_DATA_COMPLETE; } - private: + private: uint64 _magtheridonGUID; std::set _wardersSet; std::set _cubesSet; diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h index 50ef66c6b..d82a2eb14 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h @@ -7,33 +7,33 @@ REWRITTEN BY XINEF enum DataTypes { - TYPE_MAGTHERIDON = 0, - MAX_ENCOUNTER = 1, + TYPE_MAGTHERIDON = 0, + MAX_ENCOUNTER = 1, - DATA_CHANNELER_COMBAT = 10, - DATA_ACTIVATE_CUBES = 11, - DATA_COLLAPSE = 12 + DATA_CHANNELER_COMBAT = 10, + DATA_ACTIVATE_CUBES = 11, + DATA_COLLAPSE = 12 }; enum NpcIds { - NPC_MAGTHERIDON = 17257, - NPC_HELLFIRE_CHANNELER = 17256, - NPC_HELLFIRE_WARDER = 18829 + NPC_MAGTHERIDON = 17257, + NPC_HELLFIRE_CHANNELER = 17256, + NPC_HELLFIRE_WARDER = 18829 }; enum GoIds { - GO_MAGTHERIDON_DOORS = 183847, - GO_MANTICRON_CUBE = 181713, + GO_MAGTHERIDON_DOORS = 183847, + GO_MANTICRON_CUBE = 181713, - GO_MAGTHERIDON_HALL = 184653, - GO_MAGTHERIDON_COLUMN0 = 184634, - GO_MAGTHERIDON_COLUMN1 = 184635, - GO_MAGTHERIDON_COLUMN2 = 184636, - GO_MAGTHERIDON_COLUMN3 = 184637, - GO_MAGTHERIDON_COLUMN4 = 184638, - GO_MAGTHERIDON_COLUMN5 = 184639 + GO_MAGTHERIDON_HALL = 184653, + GO_MAGTHERIDON_COLUMN0 = 184634, + GO_MAGTHERIDON_COLUMN1 = 184635, + GO_MAGTHERIDON_COLUMN2 = 184636, + GO_MAGTHERIDON_COLUMN3 = 184637, + GO_MAGTHERIDON_COLUMN4 = 184638, + GO_MAGTHERIDON_COLUMN5 = 184639 }; #endif diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp index ec954a038..ea336d9c0 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp @@ -8,37 +8,37 @@ REWRITTEN BY XINEF enum eGrandWarlockNethekurse { - SAY_INTRO = 0, - SAY_PEON_ATTACKED = 1, - SAY_PEON_DIES = 2, - SAY_TAUNT = 3, - SAY_AGGRO = 4, - SAY_SLAY = 5, - SAY_DIE = 6, + SAY_INTRO = 0, + SAY_PEON_ATTACKED = 1, + SAY_PEON_DIES = 2, + SAY_TAUNT = 3, + SAY_AGGRO = 4, + SAY_SLAY = 5, + SAY_DIE = 6, - SPELL_DEATH_COIL_N = 30741, - SPELL_DEATH_COIL_H = 30500, - SPELL_DARK_SPIN = 30502, - SPELL_SHADOW_FISSURE = 30496, - SPELL_SHADOW_CLEAVE_N = 30495, - SPELL_SHADOW_SLAM_H = 35953, - SPELL_SHADOW_SEAR = 30735, + SPELL_DEATH_COIL_N = 30741, + SPELL_DEATH_COIL_H = 30500, + SPELL_DARK_SPIN = 30502, + SPELL_SHADOW_FISSURE = 30496, + SPELL_SHADOW_CLEAVE_N = 30495, + SPELL_SHADOW_SLAM_H = 35953, + SPELL_SHADOW_SEAR = 30735, - SETDATA_DATA = 1, - SETDATA_PEON_AGGRO = 1, - SETDATA_PEON_DEATH = 2, + SETDATA_DATA = 1, + SETDATA_PEON_AGGRO = 1, + SETDATA_PEON_DEATH = 2, - EVENT_STAGE_NONE = 0, - EVENT_STAGE_INTRO = 1, - EVENT_STAGE_TAUNT = 2, - EVENT_STAGE_MAIN = 3, + EVENT_STAGE_NONE = 0, + EVENT_STAGE_INTRO = 1, + EVENT_STAGE_TAUNT = 2, + EVENT_STAGE_MAIN = 3, - EVENT_INTRO = 1, - EVENT_SPELL_DEATH_COIL = 2, - EVENT_SPELL_SHADOW_FISSURE = 3, - EVENT_SPELL_CLEAVE = 4, - EVENT_CHECK_HEALTH = 5, - EVENT_START_ATTACK = 6 + EVENT_INTRO = 1, + EVENT_SPELL_DEATH_COIL = 2, + EVENT_SPELL_SHADOW_FISSURE = 3, + EVENT_SPELL_CLEAVE = 4, + EVENT_CHECK_HEALTH = 5, + EVENT_START_ATTACK = 6 }; // ######################################################## @@ -54,30 +54,30 @@ class boss_grand_warlock_nethekurse : public CreatureScript { boss_grand_warlock_nethekurseAI(Creature* creature) : BossAI(creature, DATA_NETHEKURSE) { } - EventMap events2; - void Reset() + EventMap events2; + void Reset() { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - EventStage = EVENT_STAGE_NONE; - PeonEngagedCount = 0; + EventStage = EVENT_STAGE_NONE; + PeonEngagedCount = 0; PeonKilledCount = 0; - _Reset(); - SummonMinions(); - events2.Reset(); + _Reset(); + SummonMinions(); + events2.Reset(); } - void SummonMinions() - { - me->SummonCreature(NPC_FEL_ORC_CONVERT, 172.556f, 258.227f, -13.191f, 1.41189f); - me->SummonCreature(NPC_FEL_ORC_CONVERT, 165.181f, 261.511f, -13.1926f, 0.942743f); - me->SummonCreature(NPC_FEL_ORC_CONVERT, 182.482f, 258.635f, -13.1788f, 1.70929f); - me->SummonCreature(NPC_FEL_ORC_CONVERT, 189.616f, 259.866f, -13.1966f, 1.95748f); - } + void SummonMinions() + { + me->SummonCreature(NPC_FEL_ORC_CONVERT, 172.556f, 258.227f, -13.191f, 1.41189f); + me->SummonCreature(NPC_FEL_ORC_CONVERT, 165.181f, 261.511f, -13.1926f, 0.942743f); + me->SummonCreature(NPC_FEL_ORC_CONVERT, 182.482f, 258.635f, -13.1788f, 1.70929f); + me->SummonCreature(NPC_FEL_ORC_CONVERT, 189.616f, 259.866f, -13.1966f, 1.95748f); + } void JustDied(Unit* /*killer*/) { Talk(SAY_DIE); - _JustDied(); + _JustDied(); } void SetData(uint32 data, uint32 value) @@ -91,18 +91,18 @@ class boss_grand_warlock_nethekurse : public CreatureScript if (PeonEngagedCount >= 4) return; - if (EventStage < EVENT_STAGE_TAUNT) - Talk(SAY_PEON_ATTACKED); + if (EventStage < EVENT_STAGE_TAUNT) + Talk(SAY_PEON_ATTACKED); break; case SETDATA_PEON_DEATH: if (PeonKilledCount >= 4) return; - if (EventStage < EVENT_STAGE_TAUNT) - Talk(SAY_PEON_DIES); + if (EventStage < EVENT_STAGE_TAUNT) + Talk(SAY_PEON_DIES); if (++PeonKilledCount == 4) - events2.ScheduleEvent(EVENT_START_ATTACK, 5000); + events2.ScheduleEvent(EVENT_START_ATTACK, 5000); break; } } @@ -114,19 +114,19 @@ class boss_grand_warlock_nethekurse : public CreatureScript if (me->Attack(who, true)) { - if (me->HealthBelowPct(21)) + if (me->HealthBelowPct(21)) DoStartNoMovement(who); else DoStartMovement(who); } } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->SetReactState(REACT_DEFENSIVE); - summon->SetRegeneratingHealth(false); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->SetReactState(REACT_DEFENSIVE); + summon->SetRegeneratingHealth(false); + } void MoveInLineOfSight(Unit* who) { @@ -135,11 +135,11 @@ class boss_grand_warlock_nethekurse : public CreatureScript if (who->GetTypeId() != TYPEID_PLAYER) return; - events2.ScheduleEvent(EVENT_INTRO, 90000); + events2.ScheduleEvent(EVENT_INTRO, 90000); Talk(SAY_INTRO); EventStage = EVENT_STAGE_INTRO; instance->SetBossState(DATA_NETHEKURSE, IN_PROGRESS); - me->SetInCombatWithZone(); + me->SetInCombatWithZone(); } if (EventStage < EVENT_STAGE_MAIN) @@ -159,70 +159,70 @@ class boss_grand_warlock_nethekurse : public CreatureScript void UpdateAI(uint32 diff) { - events2.Update(diff); - uint32 eventId = events2.ExecuteEvent(); + events2.Update(diff); + uint32 eventId = events2.ExecuteEvent(); if (EventStage < EVENT_STAGE_MAIN && instance->GetBossState(DATA_NETHEKURSE) == IN_PROGRESS) - { - if (eventId == EVENT_INTRO) - { - Talk(SAY_TAUNT); - EventStage = EVENT_STAGE_TAUNT; - me->CastSpell(me, SPELL_SHADOW_SEAR, false); - } - else if (eventId == EVENT_START_ATTACK) - { - Talk(SAY_AGGRO); - EventStage = EVENT_STAGE_MAIN; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Unit* target = me->SelectNearestPlayer(50.0f)) - AttackStart(target); - - events.ScheduleEvent(EVENT_SPELL_DEATH_COIL, 20000); - events.ScheduleEvent(EVENT_SPELL_SHADOW_FISSURE, 8000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - return; + { + if (eventId == EVENT_INTRO) + { + Talk(SAY_TAUNT); + EventStage = EVENT_STAGE_TAUNT; + me->CastSpell(me, SPELL_SHADOW_SEAR, false); } - } + else if (eventId == EVENT_START_ATTACK) + { + Talk(SAY_AGGRO); + EventStage = EVENT_STAGE_MAIN; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (Unit* target = me->SelectNearestPlayer(50.0f)) + AttackStart(target); + + events.ScheduleEvent(EVENT_SPELL_DEATH_COIL, 20000); + events.ScheduleEvent(EVENT_SPELL_SHADOW_FISSURE, 8000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + return; + } + } if (!UpdateVictim()) return; - events.Update(diff); - if (EventStage < EVENT_STAGE_MAIN || me->HasUnitState(UNIT_STATE_CASTING)) + events.Update(diff); + if (EventStage < EVENT_STAGE_MAIN || me->HasUnitState(UNIT_STATE_CASTING)) return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_SHADOW_FISSURE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, SPELL_SHADOW_FISSURE, false); - events.RescheduleEvent(eventId, urand(7500, 10000)); - break; - case EVENT_SPELL_DEATH_COIL: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - me->CastSpell(target, DUNGEON_MODE(SPELL_DEATH_COIL_N, SPELL_DEATH_COIL_H), false); - events.RescheduleEvent(eventId, urand(15000, 20000)); - break; - case EVENT_SPELL_CLEAVE: - me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_SHADOW_CLEAVE_N, SPELL_SHADOW_SLAM_H), false); - events.RescheduleEvent(EVENT_SPELL_CLEAVE, urand(6000, 8000)); - break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(21)) - { - me->CastSpell(me, SPELL_DARK_SPIN, true); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_CLEAVE, 3000); - me->GetMotionMaster()->Clear(); - break; - } - events.RescheduleEvent(eventId, 1000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_SHADOW_FISSURE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, SPELL_SHADOW_FISSURE, false); + events.RescheduleEvent(eventId, urand(7500, 10000)); + break; + case EVENT_SPELL_DEATH_COIL: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + me->CastSpell(target, DUNGEON_MODE(SPELL_DEATH_COIL_N, SPELL_DEATH_COIL_H), false); + events.RescheduleEvent(eventId, urand(15000, 20000)); + break; + case EVENT_SPELL_CLEAVE: + me->CastSpell(me->GetVictim(), DUNGEON_MODE(SPELL_SHADOW_CLEAVE_N, SPELL_SHADOW_SLAM_H), false); + events.RescheduleEvent(EVENT_SPELL_CLEAVE, urand(6000, 8000)); + break; + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(21)) + { + me->CastSpell(me, SPELL_DARK_SPIN, true); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_CLEAVE, 3000); + me->GetMotionMaster()->Clear(); + break; + } + events.RescheduleEvent(eventId, 1000); + break; + } - if (!me->HealthBelowPct(21)) - DoMeleeAttackIfReady(); + if (!me->HealthBelowPct(21)) + DoMeleeAttackIfReady(); } private: @@ -248,7 +248,7 @@ class spell_tsh_shadow_sear : public SpellScriptLoader void CalculateDamageAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { - amount = 1000; + amount = 1000; } void Register() @@ -266,5 +266,5 @@ class spell_tsh_shadow_sear : public SpellScriptLoader void AddSC_boss_grand_warlock_nethekurse() { new boss_grand_warlock_nethekurse(); - new spell_tsh_shadow_sear(); + new spell_tsh_shadow_sear(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp index f1b994a16..c67335dcd 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -8,11 +8,11 @@ REWRITTEN BY XINEF enum Spells { - SPELL_BLAST_WAVE = 30600, - SPELL_FEAR = 30584, - SPELL_THUNDERCLAP = 30633, - SPELL_BURNING_MAUL_N = 30598, - SPELL_BURNING_MAUL_H = 36056, + SPELL_BLAST_WAVE = 30600, + SPELL_FEAR = 30584, + SPELL_THUNDERCLAP = 30633, + SPELL_BURNING_MAUL_N = 30598, + SPELL_BURNING_MAUL_H = 36056, }; enum Creatures @@ -23,7 +23,7 @@ enum Creatures enum Misc { - EMOTE_ENRAGE = 0, + EMOTE_ENRAGE = 0, SETDATA_DATA = 1, SETDATA_YELL = 1 @@ -31,25 +31,25 @@ enum Misc enum Events { - EVENT_AGGRO_YELL_1 = 1, - EVENT_AGGRO_YELL_2 = 2, - EVENT_AGGRO_YELL_3 = 3, + EVENT_AGGRO_YELL_1 = 1, + EVENT_AGGRO_YELL_2 = 2, + EVENT_AGGRO_YELL_3 = 3, - EVENT_THREAT_YELL_L_1 = 4, - EVENT_THREAT_YELL_L_2 = 5, - EVENT_THREAT_YELL_L_3 = 6, + EVENT_THREAT_YELL_L_1 = 4, + EVENT_THREAT_YELL_L_2 = 5, + EVENT_THREAT_YELL_L_3 = 6, - EVENT_THREAT_YELL_R_1 = 7, - - EVENT_KILL_YELL_LEFT = 8, - EVENT_KILL_YELL_RIGHT = 9, - EVENT_DEATH_YELL = 10, + EVENT_THREAT_YELL_R_1 = 7, + + EVENT_KILL_YELL_LEFT = 8, + EVENT_KILL_YELL_RIGHT = 9, + EVENT_DEATH_YELL = 10, - EVENT_SPELL_FEAR = 20, - EVENT_SPELL_BURNING_MAUL = 21, - EVENT_SPELL_THUNDER_CLAP = 22, - EVENT_RESET_THREAT = 23, - EVENT_SPELL_BLAST_WAVE = 24 + EVENT_SPELL_FEAR = 20, + EVENT_SPELL_BURNING_MAUL = 21, + EVENT_SPELL_THUNDER_CLAP = 22, + EVENT_RESET_THREAT = 23, + EVENT_SPELL_BLAST_WAVE = 24 }; // ######################################################## @@ -67,19 +67,19 @@ class boss_warbringer_omrogg : public CreatureScript { } - EventMap events2; + EventMap events2; - Creature* GetLeftHead() - { - return summons.GetCreatureWithEntry(NPC_LEFT_HEAD); - } + Creature* GetLeftHead() + { + return summons.GetCreatureWithEntry(NPC_LEFT_HEAD); + } - Creature* GetRightHead() - { - return summons.GetCreatureWithEntry(NPC_RIGHT_HEAD); - } + Creature* GetRightHead() + { + return summons.GetCreatureWithEntry(NPC_RIGHT_HEAD); + } - void EnterCombat(Unit* /*who*/) + void EnterCombat(Unit* /*who*/) { me->SummonCreature(NPC_LEFT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0); me->SummonCreature(NPC_RIGHT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0); @@ -88,52 +88,52 @@ class boss_warbringer_omrogg : public CreatureScript { uint8 aggroYell = urand(EVENT_AGGRO_YELL_1, EVENT_AGGRO_YELL_3); LeftHead->AI()->Talk(aggroYell-1); - events2.ScheduleEvent(aggroYell, 3000); + events2.ScheduleEvent(aggroYell, 3000); } _EnterCombat(); - events.ScheduleEvent(EVENT_SPELL_FEAR, 8000); - events.ScheduleEvent(EVENT_SPELL_BURNING_MAUL, 25000); - events.ScheduleEvent(EVENT_SPELL_THUNDER_CLAP, 15000); - events.ScheduleEvent(EVENT_RESET_THREAT, 30000); + events.ScheduleEvent(EVENT_SPELL_FEAR, 8000); + events.ScheduleEvent(EVENT_SPELL_BURNING_MAUL, 25000); + events.ScheduleEvent(EVENT_SPELL_THUNDER_CLAP, 15000); + events.ScheduleEvent(EVENT_RESET_THREAT, 30000); } - void JustSummoned(Creature* summoned) + void JustSummoned(Creature* summoned) { summons.Summon(summoned); } - void KilledUnit(Unit* /*victim*/) + void KilledUnit(Unit* /*victim*/) { - Creature* head = NULL; - uint32 eventId = EVENT_KILL_YELL_LEFT; - if (urand(0, 1)) - { - head = GetLeftHead(); - eventId = EVENT_KILL_YELL_LEFT; - } - else - { - head = GetRightHead(); - eventId = EVENT_KILL_YELL_RIGHT; - } + Creature* head = NULL; + uint32 eventId = EVENT_KILL_YELL_LEFT; + if (urand(0, 1)) + { + head = GetLeftHead(); + eventId = EVENT_KILL_YELL_LEFT; + } + else + { + head = GetRightHead(); + eventId = EVENT_KILL_YELL_RIGHT; + } - if (head) - head->AI()->Talk(eventId-1); + if (head) + head->AI()->Talk(eventId-1); - events2.ScheduleEvent(eventId, 3000); + events2.ScheduleEvent(eventId, 3000); } - void JustDied(Unit* /*killer*/) + void JustDied(Unit* /*killer*/) { Creature* LeftHead = GetLeftHead(); Creature* RightHead = GetRightHead(); if (!LeftHead || !RightHead) return; - LeftHead->DespawnOrUnsummon(5000); - RightHead->DespawnOrUnsummon(5000); + LeftHead->DespawnOrUnsummon(5000); + RightHead->DespawnOrUnsummon(5000); LeftHead->AI()->Talk(EVENT_DEATH_YELL-1); RightHead->AI()->SetData(SETDATA_DATA, SETDATA_YELL); @@ -143,67 +143,67 @@ class boss_warbringer_omrogg : public CreatureScript void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (uint32 eventId = events2.ExecuteEvent()) - { - case EVENT_AGGRO_YELL_1: - case EVENT_AGGRO_YELL_2: - case EVENT_AGGRO_YELL_3: - case EVENT_KILL_YELL_LEFT: - case EVENT_THREAT_YELL_L_1: - case EVENT_THREAT_YELL_L_2: - case EVENT_THREAT_YELL_L_3: - if (Creature* RightHead = GetRightHead()) - RightHead->AI()->Talk(eventId-1); - break; - case EVENT_KILL_YELL_RIGHT: - case EVENT_THREAT_YELL_R_1: - if (Creature* LeftHead = GetLeftHead()) - LeftHead->AI()->Talk(eventId-1); - break; - } + events2.Update(diff); + switch (uint32 eventId = events2.ExecuteEvent()) + { + case EVENT_AGGRO_YELL_1: + case EVENT_AGGRO_YELL_2: + case EVENT_AGGRO_YELL_3: + case EVENT_KILL_YELL_LEFT: + case EVENT_THREAT_YELL_L_1: + case EVENT_THREAT_YELL_L_2: + case EVENT_THREAT_YELL_L_3: + if (Creature* RightHead = GetRightHead()) + RightHead->AI()->Talk(eventId-1); + break; + case EVENT_KILL_YELL_RIGHT: + case EVENT_THREAT_YELL_R_1: + if (Creature* LeftHead = GetLeftHead()) + LeftHead->AI()->Talk(eventId-1); + break; + } if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_FEAR: - me->CastSpell(me, SPELL_FEAR, false); - events.ScheduleEvent(EVENT_SPELL_FEAR, 22000); - break; - case EVENT_SPELL_THUNDER_CLAP: - me->CastSpell(me, SPELL_THUNDERCLAP, false); - events.ScheduleEvent(EVENT_SPELL_THUNDER_CLAP, 25000); - break; - case EVENT_RESET_THREAT: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - uint8 threatYell = urand(EVENT_THREAT_YELL_L_1, EVENT_THREAT_YELL_R_1); - if (Creature* head = threatYell == EVENT_THREAT_YELL_R_1 ? GetRightHead() : GetLeftHead()) - head->AI()->Talk(threatYell-1); - events.ScheduleEvent(threatYell, 3000); + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_FEAR: + me->CastSpell(me, SPELL_FEAR, false); + events.ScheduleEvent(EVENT_SPELL_FEAR, 22000); + break; + case EVENT_SPELL_THUNDER_CLAP: + me->CastSpell(me, SPELL_THUNDERCLAP, false); + events.ScheduleEvent(EVENT_SPELL_THUNDER_CLAP, 25000); + break; + case EVENT_RESET_THREAT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + uint8 threatYell = urand(EVENT_THREAT_YELL_L_1, EVENT_THREAT_YELL_R_1); + if (Creature* head = threatYell == EVENT_THREAT_YELL_R_1 ? GetRightHead() : GetLeftHead()) + head->AI()->Talk(threatYell-1); + events.ScheduleEvent(threatYell, 3000); - DoResetThreat(); - me->AddThreat(target, 10.0f); - } - events.ScheduleEvent(EVENT_RESET_THREAT, 30000); - break; - case EVENT_SPELL_BURNING_MAUL: - Talk(EMOTE_ENRAGE); - me->CastSpell(me, DUNGEON_MODE(SPELL_BURNING_MAUL_N, SPELL_BURNING_MAUL_H), false); - events.ScheduleEvent(EVENT_SPELL_BURNING_MAUL, 40000); - events.ScheduleEvent(EVENT_SPELL_BLAST_WAVE, 15000); - events.ScheduleEvent(EVENT_SPELL_BLAST_WAVE, 20000); - break; - case EVENT_SPELL_BLAST_WAVE: - me->CastSpell(me, SPELL_BLAST_WAVE, false); - break; - } + DoResetThreat(); + me->AddThreat(target, 10.0f); + } + events.ScheduleEvent(EVENT_RESET_THREAT, 30000); + break; + case EVENT_SPELL_BURNING_MAUL: + Talk(EMOTE_ENRAGE); + me->CastSpell(me, DUNGEON_MODE(SPELL_BURNING_MAUL_N, SPELL_BURNING_MAUL_H), false); + events.ScheduleEvent(EVENT_SPELL_BURNING_MAUL, 40000); + events.ScheduleEvent(EVENT_SPELL_BLAST_WAVE, 15000); + events.ScheduleEvent(EVENT_SPELL_BLAST_WAVE, 20000); + break; + case EVENT_SPELL_BLAST_WAVE: + me->CastSpell(me, SPELL_BLAST_WAVE, false); + break; + } DoMeleeAttackIfReady(); } @@ -227,23 +227,23 @@ class npc_omrogg_heads : public CreatureScript void SetData(uint32 data, uint32 value) { if (data == SETDATA_DATA && value == SETDATA_YELL) - timer = 1; + timer = 1; } void UpdateAI(uint32 diff) { - if (timer) - { - timer += diff; - if (timer >= 3000) - { - timer = 0; - Talk(EVENT_DEATH_YELL-1); - } - } + if (timer) + { + timer += diff; + if (timer >= 3000) + { + timer = 0; + Talk(EVENT_DEATH_YELL-1); + } + } } - uint32 timer; + uint32 timer; }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index 80e68f6c4..afb0d64c1 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -15,9 +15,9 @@ enum Says enum Spells { - SPELL_BLADE_DANCE = 30739, - SPELL_CHARGE = 25821, - SPELL_SPRINT = 32720, + SPELL_BLADE_DANCE = 30739, + SPELL_CHARGE = 25821, + SPELL_SPRINT = 32720, }; enum Creatures @@ -34,13 +34,13 @@ float AddsEntrance[3] = { 306.036f, -84.29f, 1.93f }; enum Misc { - EVENT_CHECK_ROOM = 1, - EVENT_SUMMON_ADDS = 2, - EVENT_SUMMON_ASSASSINS = 3, - EVENT_SPELL_CHARGE = 4, - EVENT_MOVE_TO_NEXT_POINT = 5, - EVENT_BLADE_DANCE = 6, - EVENT_FINISH_BLADE_DANCE = 7 + EVENT_CHECK_ROOM = 1, + EVENT_SUMMON_ADDS = 2, + EVENT_SUMMON_ASSASSINS = 3, + EVENT_SPELL_CHARGE = 4, + EVENT_MOVE_TO_NEXT_POINT = 5, + EVENT_BLADE_DANCE = 6, + EVENT_FINISH_BLADE_DANCE = 7 }; class boss_warchief_kargath_bladefist : public CreatureScript @@ -52,42 +52,42 @@ class boss_warchief_kargath_bladefist : public CreatureScript { boss_warchief_kargath_bladefistAI(Creature* creature) : BossAI(creature, DATA_KARGATH) { } - void InitializeAI() - { - BossAI::InitializeAI(); - if (instance) - if (Creature* executioner = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EXECUTIONER))) - executioner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + void InitializeAI() + { + BossAI::InitializeAI(); + if (instance) + if (Creature* executioner = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EXECUTIONER))) + executioner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } void JustDied(Unit* /*killer*/) { Talk(SAY_DEATH); _JustDied(); - if (instance) - if (Creature* executioner = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EXECUTIONER))) - executioner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (instance) + if (Creature* executioner = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_EXECUTIONER))) + executioner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } void EnterCombat(Unit* who) { Talk(SAY_AGGRO); - _EnterCombat(); + _EnterCombat(); - events.ScheduleEvent(EVENT_CHECK_ROOM, 5000); - events.ScheduleEvent(EVENT_SUMMON_ADDS, 30000); - events.ScheduleEvent(EVENT_SUMMON_ASSASSINS, 5000); - events.ScheduleEvent(EVENT_BLADE_DANCE, 30000); - events.ScheduleEvent(EVENT_SPELL_CHARGE, 0); + events.ScheduleEvent(EVENT_CHECK_ROOM, 5000); + events.ScheduleEvent(EVENT_SUMMON_ADDS, 30000); + events.ScheduleEvent(EVENT_SUMMON_ASSASSINS, 5000); + events.ScheduleEvent(EVENT_BLADE_DANCE, 30000); + events.ScheduleEvent(EVENT_SPELL_CHARGE, 0); } void JustSummoned(Creature* summon) { if (summon->GetEntry() != NPC_SHATTERED_ASSASSIN) - summon->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0)); + summon->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0)); - summons.Summon(summon); + summons.Summon(summon); } void KilledUnit(Unit* victim) @@ -102,7 +102,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript return; me->CastSpell(me, SPELL_BLADE_DANCE, true); - events.ScheduleEvent(EVENT_MOVE_TO_NEXT_POINT, 0); + events.ScheduleEvent(EVENT_MOVE_TO_NEXT_POINT, 0); } void UpdateAI(uint32 diff) @@ -110,57 +110,57 @@ class boss_warchief_kargath_bladefist : public CreatureScript if (!UpdateVictim()) return; - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_ROOM: - if (me->GetPositionX() > 255 || me->GetPositionX() < 205) - { - EnterEvadeMode(); - return; - } - events.ScheduleEvent(EVENT_CHECK_ROOM, 5000); - break; - case EVENT_SUMMON_ASSASSINS: - me->SummonCreature(NPC_SHATTERED_ASSASSIN, AssassEntrance[0], AssassEntrance[1]+8, AssassEntrance[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_SHATTERED_ASSASSIN, AssassEntrance[0], AssassEntrance[1]-8, AssassEntrance[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_SHATTERED_ASSASSIN, AssassExit[0], AssassExit[1]+8, AssassExit[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_SHATTERED_ASSASSIN, AssassExit[0], AssassExit[1]-8, AssassExit[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case EVENT_SUMMON_ADDS: - for (uint8 i = 0; i < 2; ++i) - me->SummonCreature(NPC_HEARTHEN_GUARD+urand(0,2), AddsEntrance[0], AddsEntrance[1], AddsEntrance[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_ROOM: + if (me->GetPositionX() > 255 || me->GetPositionX() < 205) + { + EnterEvadeMode(); + return; + } + events.ScheduleEvent(EVENT_CHECK_ROOM, 5000); + break; + case EVENT_SUMMON_ASSASSINS: + me->SummonCreature(NPC_SHATTERED_ASSASSIN, AssassEntrance[0], AssassEntrance[1]+8, AssassEntrance[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_SHATTERED_ASSASSIN, AssassEntrance[0], AssassEntrance[1]-8, AssassEntrance[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_SHATTERED_ASSASSIN, AssassExit[0], AssassExit[1]+8, AssassExit[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_SHATTERED_ASSASSIN, AssassExit[0], AssassExit[1]-8, AssassExit[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case EVENT_SUMMON_ADDS: + for (uint8 i = 0; i < 2; ++i) + me->SummonCreature(NPC_HEARTHEN_GUARD+urand(0,2), AddsEntrance[0], AddsEntrance[1], AddsEntrance[2], 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - events.ScheduleEvent(EVENT_SUMMON_ADDS, 30000); - break; - case EVENT_BLADE_DANCE: - events.DelayEvents(10001); - events.ScheduleEvent(EVENT_BLADE_DANCE, 40000); - events.ScheduleEvent(EVENT_MOVE_TO_NEXT_POINT, 0); - events.ScheduleEvent(EVENT_FINISH_BLADE_DANCE, 10000); - events.SetPhase(1); - me->CastSpell(me, SPELL_SPRINT, true); - break; - case EVENT_MOVE_TO_NEXT_POINT: - { - float x = 210 + frand(0.0f, 35.0f); - float y = -65.0f - frand(0.0f, 35.0f); + events.ScheduleEvent(EVENT_SUMMON_ADDS, 30000); + break; + case EVENT_BLADE_DANCE: + events.DelayEvents(10001); + events.ScheduleEvent(EVENT_BLADE_DANCE, 40000); + events.ScheduleEvent(EVENT_MOVE_TO_NEXT_POINT, 0); + events.ScheduleEvent(EVENT_FINISH_BLADE_DANCE, 10000); + events.SetPhase(1); + me->CastSpell(me, SPELL_SPRINT, true); + break; + case EVENT_MOVE_TO_NEXT_POINT: + { + float x = 210 + frand(0.0f, 35.0f); + float y = -65.0f - frand(0.0f, 35.0f); me->GetMotionMaster()->MovePoint(1, x, y, me->GetPositionZ()); - break; - } - case EVENT_FINISH_BLADE_DANCE: - events.SetPhase(0); - me->GetMotionMaster()->Clear(); + break; + } + case EVENT_FINISH_BLADE_DANCE: + events.SetPhase(0); + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->GetVictim()); if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_CHARGE, 3000); - break; - case EVENT_SPELL_CHARGE: - me->CastSpell(me->GetVictim(), SPELL_CHARGE, false); - break; - } + events.ScheduleEvent(EVENT_SPELL_CHARGE, 3000); + break; + case EVENT_SPELL_CHARGE: + me->CastSpell(me->GetVictim(), SPELL_CHARGE, false); + break; + } - if (!events.IsInPhase(1)) + if (!events.IsInPhase(1)) DoMeleeAttackIfReady(); } }; diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp index 597a40bb6..c504dc423 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp @@ -26,19 +26,19 @@ class instance_shattered_halls : public InstanceMapScript SetBossNumber(ENCOUNTER_COUNT); nethekurseDoor1GUID = 0; nethekurseDoor2GUID = 0; - warchiefKargathGUID = 0; + warchiefKargathGUID = 0; - executionerGUID = 0; - memset(&prisonerGUID, 0, sizeof(prisonerGUID)); - TeamIdInInstance = TEAM_NEUTRAL; - RescueTimer = 100*MINUTE*IN_MILLISECONDS; + executionerGUID = 0; + memset(&prisonerGUID, 0, sizeof(prisonerGUID)); + TeamIdInInstance = TEAM_NEUTRAL; + RescueTimer = 100*MINUTE*IN_MILLISECONDS; } - void OnPlayerEnter(Player* player) + void OnPlayerEnter(Player* player) { if (TeamIdInInstance == TEAM_NEUTRAL) TeamIdInInstance = player->GetTeamId(); - } + } void OnGameObjectCreate(GameObject* go) { @@ -46,13 +46,13 @@ class instance_shattered_halls : public InstanceMapScript { case GO_GRAND_WARLOCK_CHAMBER_DOOR_1: nethekurseDoor1GUID = go->GetGUID(); - if (GetBossState(DATA_NETHEKURSE) == DONE) - HandleGameObject(0, true, go); + if (GetBossState(DATA_NETHEKURSE) == DONE) + HandleGameObject(0, true, go); break; case GO_GRAND_WARLOCK_CHAMBER_DOOR_2: nethekurseDoor2GUID = go->GetGUID(); - if (GetBossState(DATA_NETHEKURSE) == DONE) - HandleGameObject(0, true, go); + if (GetBossState(DATA_NETHEKURSE) == DONE) + HandleGameObject(0, true, go); break; } } @@ -69,29 +69,29 @@ class instance_shattered_halls : public InstanceMapScript switch (creature->GetEntry()) { - case NPC_WARCHIEF_KARGATH: - warchiefKargathGUID = creature->GetGUID(); - break; - case NPC_SHATTERED_EXECUTIONER: - if (RescueTimer > 25*MINUTE*IN_MILLISECONDS) - creature->AddLootMode(2); - executionerGUID = creature->GetGUID(); - break; - case NPC_RIFLEMAN_BROWNBEARD: - if (TeamIdInInstance == TEAM_HORDE) - creature->UpdateEntry(NPC_KORAG_PROUDMANE); - prisonerGUID[0] = creature->GetGUID(); - break; - case NPC_CAPTAIN_ALINA: - if (TeamIdInInstance == TEAM_HORDE) - creature->UpdateEntry(NPC_CAPTAIN_BONESHATTER); - prisonerGUID[1] = creature->GetGUID(); - break; - case NPC_PRIVATE_JACINT: - if (TeamIdInInstance == TEAM_HORDE) - creature->UpdateEntry(NPC_SCOUT_ORGARR); - prisonerGUID[2] = creature->GetGUID(); - break; + case NPC_WARCHIEF_KARGATH: + warchiefKargathGUID = creature->GetGUID(); + break; + case NPC_SHATTERED_EXECUTIONER: + if (RescueTimer > 25*MINUTE*IN_MILLISECONDS) + creature->AddLootMode(2); + executionerGUID = creature->GetGUID(); + break; + case NPC_RIFLEMAN_BROWNBEARD: + if (TeamIdInInstance == TEAM_HORDE) + creature->UpdateEntry(NPC_KORAG_PROUDMANE); + prisonerGUID[0] = creature->GetGUID(); + break; + case NPC_CAPTAIN_ALINA: + if (TeamIdInInstance == TEAM_HORDE) + creature->UpdateEntry(NPC_CAPTAIN_BONESHATTER); + prisonerGUID[1] = creature->GetGUID(); + break; + case NPC_PRIVATE_JACINT: + if (TeamIdInInstance == TEAM_HORDE) + creature->UpdateEntry(NPC_SCOUT_ORGARR); + prisonerGUID[2] = creature->GetGUID(); + break; } } @@ -118,64 +118,64 @@ class instance_shattered_halls : public InstanceMapScript return true; } - void SetData(uint32 type, uint32 data) - { - if (type == DATA_ENTERED_ROOM && data == DATA_ENTERED_ROOM && RescueTimer == 100*MINUTE*IN_MILLISECONDS) - { - DoCastSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_1); - instance->LoadGrid(230, -80); + void SetData(uint32 type, uint32 data) + { + if (type == DATA_ENTERED_ROOM && data == DATA_ENTERED_ROOM && RescueTimer == 100*MINUTE*IN_MILLISECONDS) + { + DoCastSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_1); + instance->LoadGrid(230, -80); - if (Creature* kargath = instance->GetCreature(warchiefKargathGUID)) - sCreatureTextMgr->SendChat(kargath, TeamIdInInstance == TEAM_ALLIANCE ? 3 : 4, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); + if (Creature* kargath = instance->GetCreature(warchiefKargathGUID)) + sCreatureTextMgr->SendChat(kargath, TeamIdInInstance == TEAM_ALLIANCE ? 3 : 4, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); - RescueTimer = 80*MINUTE*IN_MILLISECONDS; - } - } + RescueTimer = 80*MINUTE*IN_MILLISECONDS; + } + } uint64 GetData64(uint32 data) const { - switch (data) - { - case DATA_PRISONER_1: - case DATA_PRISONER_2: - case DATA_PRISONER_3: - return prisonerGUID[data-DATA_PRISONER_1]; - case DATA_EXECUTIONER: - return executionerGUID; - } + switch (data) + { + case DATA_PRISONER_1: + case DATA_PRISONER_2: + case DATA_PRISONER_3: + return prisonerGUID[data-DATA_PRISONER_1]; + case DATA_EXECUTIONER: + return executionerGUID; + } return 0; } - void Update(uint32 diff) - { - if (RescueTimer && RescueTimer < 100*MINUTE*IN_MILLISECONDS) - { - RescueTimer -= std::min(RescueTimer, diff); + void Update(uint32 diff) + { + if (RescueTimer && RescueTimer < 100*MINUTE*IN_MILLISECONDS) + { + RescueTimer -= std::min(RescueTimer, diff); - if ((RescueTimer / IN_MILLISECONDS) == 25*MINUTE) - { - DoRemoveAurasDueToSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_1); - DoCastSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_2); - if (Creature* prisoner = instance->GetCreature(prisonerGUID[0])) - Unit::Kill(prisoner, prisoner); - if (Creature* executioner = instance->GetCreature(executionerGUID)) - executioner->RemoveLootMode(2); - } - else if ((RescueTimer / IN_MILLISECONDS) == 15*MINUTE) - { - DoRemoveAurasDueToSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_2); - DoCastSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_3); - if (Creature* prisoner = instance->GetCreature(prisonerGUID[1])) - Unit::Kill(prisoner, prisoner); - } - else if ((RescueTimer / IN_MILLISECONDS) == 0) - { - DoRemoveAurasDueToSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_3); - if (Creature* prisoner = instance->GetCreature(prisonerGUID[2])) - Unit::Kill(prisoner, prisoner); - } - } - } + if ((RescueTimer / IN_MILLISECONDS) == 25*MINUTE) + { + DoRemoveAurasDueToSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_1); + DoCastSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_2); + if (Creature* prisoner = instance->GetCreature(prisonerGUID[0])) + Unit::Kill(prisoner, prisoner); + if (Creature* executioner = instance->GetCreature(executionerGUID)) + executioner->RemoveLootMode(2); + } + else if ((RescueTimer / IN_MILLISECONDS) == 15*MINUTE) + { + DoRemoveAurasDueToSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_2); + DoCastSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_3); + if (Creature* prisoner = instance->GetCreature(prisonerGUID[1])) + Unit::Kill(prisoner, prisoner); + } + else if ((RescueTimer / IN_MILLISECONDS) == 0) + { + DoRemoveAurasDueToSpellOnPlayers(SPELL_KARGATHS_EXECUTIONER_3); + if (Creature* prisoner = instance->GetCreature(prisonerGUID[2])) + Unit::Kill(prisoner, prisoner); + } + } + } std::string GetSaveData() { @@ -214,7 +214,7 @@ class instance_shattered_halls : public InstanceMapScript SetBossState(i, EncounterState(tmpState)); } - loadStream >> RescueTimer; + loadStream >> RescueTimer; } else OUT_LOAD_INST_DATA_FAIL; @@ -223,14 +223,14 @@ class instance_shattered_halls : public InstanceMapScript } protected: - uint64 warchiefKargathGUID; + uint64 warchiefKargathGUID; uint64 nethekurseDoor1GUID; uint64 nethekurseDoor2GUID; - uint64 executionerGUID; - uint64 prisonerGUID[3]; - uint32 RescueTimer; - TeamId TeamIdInInstance; + uint64 executionerGUID; + uint64 prisonerGUID[3]; + uint32 RescueTimer; + TeamId TeamIdInInstance; }; }; @@ -245,20 +245,20 @@ class spell_tsh_shoot_flame_arrow : public SpellScriptLoader void FilterTargets(std::list& unitList) { - Trinity::Containers::RandomResizeList(unitList, 1); + Trinity::Containers::RandomResizeList(unitList, 1); } - void HandleScriptEffect(SpellEffIndex effIndex) + void HandleScriptEffect(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); if (Unit* target = GetHitUnit()) - target->CastSpell(target, 30953, true); + target->CastSpell(target, 30953, true); } void Register() { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_tsh_shoot_flame_arrow_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - OnEffectHitTarget += SpellEffectFn(spell_tsh_shoot_flame_arrow_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_tsh_shoot_flame_arrow_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -270,21 +270,21 @@ class spell_tsh_shoot_flame_arrow : public SpellScriptLoader class at_shattered_halls_execution : public AreaTriggerScript { - public: - at_shattered_halls_execution() : AreaTriggerScript("at_shattered_halls_execution") { } + public: + at_shattered_halls_execution() : AreaTriggerScript("at_shattered_halls_execution") { } - bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) - { - if (InstanceScript* instanceScript = player->GetInstanceScript()) - instanceScript->SetData(DATA_ENTERED_ROOM, DATA_ENTERED_ROOM); + bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) + { + if (InstanceScript* instanceScript = player->GetInstanceScript()) + instanceScript->SetData(DATA_ENTERED_ROOM, DATA_ENTERED_ROOM); - return true; - } + return true; + } }; void AddSC_instance_shattered_halls() { new instance_shattered_halls(); - new spell_tsh_shoot_flame_arrow(); - new at_shattered_halls_execution(); + new spell_tsh_shoot_flame_arrow(); + new at_shattered_halls_execution(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h index 37d021dff..4031e21bb 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h @@ -7,45 +7,45 @@ REWRITTEN BY XINEF enum DataTypes { - DATA_NETHEKURSE = 0, - DATA_OMROGG = 1, - DATA_KARGATH = 2, - ENCOUNTER_COUNT = 3, + DATA_NETHEKURSE = 0, + DATA_OMROGG = 1, + DATA_KARGATH = 2, + ENCOUNTER_COUNT = 3, - DATA_ENTERED_ROOM = 10, - DATA_PRISONER_1 = 11, - DATA_PRISONER_2 = 12, - DATA_PRISONER_3 = 13, - DATA_EXECUTIONER = 14 + DATA_ENTERED_ROOM = 10, + DATA_PRISONER_1 = 11, + DATA_PRISONER_2 = 12, + DATA_PRISONER_3 = 13, + DATA_EXECUTIONER = 14 }; enum CreatureIds { - NPC_GRAND_WARLOCK_NETHEKURSE = 16807, - NPC_WARCHIEF_KARGATH = 16808, - NPC_FEL_ORC_CONVERT = 17083, + NPC_GRAND_WARLOCK_NETHEKURSE = 16807, + NPC_WARCHIEF_KARGATH = 16808, + NPC_FEL_ORC_CONVERT = 17083, - // Trial of the Naaru: Mercy - NPC_SHATTERED_EXECUTIONER = 17301, - NPC_RIFLEMAN_BROWNBEARD = 17289, - NPC_CAPTAIN_ALINA = 17290, - NPC_PRIVATE_JACINT = 17292, - NPC_KORAG_PROUDMANE = 17295, - NPC_CAPTAIN_BONESHATTER = 17296, - NPC_SCOUT_ORGARR = 17297, + // Trial of the Naaru: Mercy + NPC_SHATTERED_EXECUTIONER = 17301, + NPC_RIFLEMAN_BROWNBEARD = 17289, + NPC_CAPTAIN_ALINA = 17290, + NPC_PRIVATE_JACINT = 17292, + NPC_KORAG_PROUDMANE = 17295, + NPC_CAPTAIN_BONESHATTER = 17296, + NPC_SCOUT_ORGARR = 17297, }; enum GameobjectIds { - GO_GRAND_WARLOCK_CHAMBER_DOOR_1 = 182539, - GO_GRAND_WARLOCK_CHAMBER_DOOR_2 = 182540 + GO_GRAND_WARLOCK_CHAMBER_DOOR_1 = 182539, + GO_GRAND_WARLOCK_CHAMBER_DOOR_2 = 182540 }; enum SpellIds { - SPELL_KARGATHS_EXECUTIONER_1 = 39288, - SPELL_KARGATHS_EXECUTIONER_2 = 39289, - SPELL_KARGATHS_EXECUTIONER_3 = 39290 + SPELL_KARGATHS_EXECUTIONER_1 = 39288, + SPELL_KARGATHS_EXECUTIONER_2 = 39289, + SPELL_KARGATHS_EXECUTIONER_3 = 39290 }; #endif diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index e478797e7..eaa0632f3 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -10,23 +10,23 @@ REWRITTEN BY XINEF enum Spells { - SPELL_BERSERK = 45078, - SPELL_FLAME_QUILLS = 34229, - SPELL_QUILL_MISSILE_1 = 34269, // 21 - SPELL_QUILL_MISSILE_2 = 34314, // 3 - SPELL_FLAME_BUFFET = 34121, - SPELL_EMBER_BLAST = 34341, - SPELL_REBIRTH_PHASE2 = 34342, - SPELL_MELT_ARMOR = 35410, - SPELL_CHARGE = 35412, - SPELL_REBIRTH_DIVE = 35369, - SPELL_DIVE_BOMB_VISUAL = 35367, - SPELL_DIVE_BOMB = 35181 + SPELL_BERSERK = 45078, + SPELL_FLAME_QUILLS = 34229, + SPELL_QUILL_MISSILE_1 = 34269, // 21 + SPELL_QUILL_MISSILE_2 = 34314, // 3 + SPELL_FLAME_BUFFET = 34121, + SPELL_EMBER_BLAST = 34341, + SPELL_REBIRTH_PHASE2 = 34342, + SPELL_MELT_ARMOR = 35410, + SPELL_CHARGE = 35412, + SPELL_REBIRTH_DIVE = 35369, + SPELL_DIVE_BOMB_VISUAL = 35367, + SPELL_DIVE_BOMB = 35181 }; const Position alarPoints[7] = { - {340.15f, 58.65f, 17.71f, 4.60f}, + {340.15f, 58.65f, 17.71f, 4.60f}, {388.09f, 31.54f, 20.18f, 1.61f}, {388.18f, -32.85f, 20.18f, 0.52f}, {340.29f, -60.19f, 17.72f, 5.71f}, @@ -37,39 +37,39 @@ const Position alarPoints[7] = enum Misc { - DISPLAYID_INVISIBLE = 23377, - NPC_EMBER_OF_ALAR = 19551, - NPC_FLAME_PATCH = 20602, + DISPLAYID_INVISIBLE = 23377, + NPC_EMBER_OF_ALAR = 19551, + NPC_FLAME_PATCH = 20602, - POINT_PLATFORM = 0, - POINT_QUILL = 4, - POINT_MIDDLE = 5, - POINT_DIVE = 6, + POINT_PLATFORM = 0, + POINT_QUILL = 4, + POINT_MIDDLE = 5, + POINT_DIVE = 6, - EVENT_SWITCH_PLATFORM = 1, - EVENT_START_QUILLS = 2, - EVENT_RELOCATE_MIDDLE = 3, - EVENT_REBIRTH = 4, - EVENT_SPELL_MELT_ARMOR = 5, - EVENT_SPELL_FLAME_PATCH = 6, - EVENT_SPELL_CHARGE = 7, - EVENT_SPELL_DIVE_BOMB = 8, - EVENT_START_DIVE = 9, - EVENT_CAST_DIVE_BOMB = 10, - EVENT_SUMMON_DIVE_PHOENIX = 11, - EVENT_REBIRTH_DIVE = 12, - EVENT_SPELL_BERSERK = 13, + EVENT_SWITCH_PLATFORM = 1, + EVENT_START_QUILLS = 2, + EVENT_RELOCATE_MIDDLE = 3, + EVENT_REBIRTH = 4, + EVENT_SPELL_MELT_ARMOR = 5, + EVENT_SPELL_FLAME_PATCH = 6, + EVENT_SPELL_CHARGE = 7, + EVENT_SPELL_DIVE_BOMB = 8, + EVENT_START_DIVE = 9, + EVENT_CAST_DIVE_BOMB = 10, + EVENT_SUMMON_DIVE_PHOENIX = 11, + EVENT_REBIRTH_DIVE = 12, + EVENT_SPELL_BERSERK = 13, - EVENT_MOVE_TO_PHASE_2 = 20, - EVENT_FINISH_DIVE = 21 + EVENT_MOVE_TO_PHASE_2 = 20, + EVENT_FINISH_DIVE = 21 }; // Xinef: Ruse of the Ashtongue (10946) enum qruseoftheAshtongue { - SPELL_ASHTONGUE_RUSE = 42090, - QUEST_RUSE_OF_THE_ASHTONGUE = 10946, + SPELL_ASHTONGUE_RUSE = 42090, + QUEST_RUSE_OF_THE_ASHTONGUE = 10946, }; class boss_alar : public CreatureScript @@ -81,57 +81,57 @@ class boss_alar : public CreatureScript { boss_alarAI(Creature* creature) : BossAI(creature, DATA_ALAR) { - startPath = true; - SetCombatMovement(false); + startPath = true; + SetCombatMovement(false); } - uint8 platform; - uint8 noQuillTimes; - bool startPath; + uint8 platform; + uint8 noQuillTimes; + bool startPath; - void JustReachedHome() - { - BossAI::JustReachedHome(); - startPath = true; - } + void JustReachedHome() + { + BossAI::JustReachedHome(); + startPath = true; + } void Reset() { - BossAI::Reset(); - platform = 0; - noQuillTimes = 0; - me->SetModelVisible(true); + BossAI::Reset(); + platform = 0; + noQuillTimes = 0; + me->SetModelVisible(true); me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_FIRE, true); - me->SetReactState(REACT_AGGRESSIVE); + me->SetReactState(REACT_AGGRESSIVE); } void EnterCombat(Unit* who) { - BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SWITCH_PLATFORM, 0); + BossAI::EnterCombat(who); + events.ScheduleEvent(EVENT_SWITCH_PLATFORM, 0); } void JustDied(Unit* killer) { - me->SetModelVisible(true); - BossAI::JustDied(killer); + me->SetModelVisible(true); + BossAI::JustDied(killer); - // Xinef: Ruse of the Ashtongue (10946) - Map::PlayerList const& pl = me->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - { - Player* player = itr->GetSource(); - if (player->GetQuestStatus(QUEST_RUSE_OF_THE_ASHTONGUE) == QUEST_STATUS_INCOMPLETE) - if (player->HasAura(SPELL_ASHTONGUE_RUSE)) - player->AreaExploredOrEventHappens(QUEST_RUSE_OF_THE_ASHTONGUE); - } + // Xinef: Ruse of the Ashtongue (10946) + Map::PlayerList const& pl = me->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + { + Player* player = itr->GetSource(); + if (player->GetQuestStatus(QUEST_RUSE_OF_THE_ASHTONGUE) == QUEST_STATUS_INCOMPLETE) + if (player->HasAura(SPELL_ASHTONGUE_RUSE)) + player->AreaExploredOrEventHappens(QUEST_RUSE_OF_THE_ASHTONGUE); + } } void JustSummoned(Creature* summon) { - summons.Summon(summon); - if (summon->GetEntry() == NPC_EMBER_OF_ALAR) - summon->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_FIRE, true); + summons.Summon(summon); + if (summon->GetEntry() == NPC_EMBER_OF_ALAR) + summon->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_FIRE, true); } void MoveInLineOfSight(Unit* /*who*/) { } @@ -141,168 +141,168 @@ class boss_alar : public CreatureScript if (damage >= me->GetHealth() && platform < POINT_MIDDLE) { damage = 0; - if (events.GetNextEventTime(EVENT_REBIRTH) == 0) - { - me->InterruptNonMeleeSpells(false); - me->SetHealth(me->GetMaxHealth()); - me->SetReactState(REACT_PASSIVE); - me->CastSpell(me, SPELL_EMBER_BLAST, true); + if (events.GetNextEventTime(EVENT_REBIRTH) == 0) + { + me->InterruptNonMeleeSpells(false); + me->SetHealth(me->GetMaxHealth()); + me->SetReactState(REACT_PASSIVE); + me->CastSpell(me, SPELL_EMBER_BLAST, true); - me->setAttackTimer(BASE_ATTACK, 16000); - events.Reset(); - events.ScheduleEvent(EVENT_RELOCATE_MIDDLE, 8000); - events.ScheduleEvent(EVENT_MOVE_TO_PHASE_2, 12000); - events.ScheduleEvent(EVENT_REBIRTH, 16001); - } + me->setAttackTimer(BASE_ATTACK, 16000); + events.Reset(); + events.ScheduleEvent(EVENT_RELOCATE_MIDDLE, 8000); + events.ScheduleEvent(EVENT_MOVE_TO_PHASE_2, 12000); + events.ScheduleEvent(EVENT_REBIRTH, 16001); + } } } void MovementInform(uint32 type, uint32 id) { - if (type != POINT_MOTION_TYPE) - { - if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized() && !me->IsInCombat()) - startPath = true; - return; - } + if (type != POINT_MOTION_TYPE) + { + if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized() && !me->IsInCombat()) + startPath = true; + return; + } - if (id == POINT_PLATFORM) - me->setAttackTimer(BASE_ATTACK, 1000); - else if (id == POINT_QUILL) - events.ScheduleEvent(EVENT_START_QUILLS, 1000); - else if (id == POINT_DIVE) - { - events.ScheduleEvent(EVENT_START_DIVE, 1000); - events.ScheduleEvent(EVENT_CAST_DIVE_BOMB, 5000); - } + if (id == POINT_PLATFORM) + me->setAttackTimer(BASE_ATTACK, 1000); + else if (id == POINT_QUILL) + events.ScheduleEvent(EVENT_START_QUILLS, 1000); + else if (id == POINT_DIVE) + { + events.ScheduleEvent(EVENT_START_DIVE, 1000); + events.ScheduleEvent(EVENT_CAST_DIVE_BOMB, 5000); + } } void UpdateAI(uint32 diff) { - if (startPath) - { - me->StopMoving(); - startPath = false; - if (WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath())) - { - Movement::PointsArray pathPoints; - pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - for (uint8 i = 0; i < i_path->size(); ++i) - { - WaypointData const* node = i_path->at(i); - pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); - } - me->GetMotionMaster()->MoveSplinePath(&pathPoints); - } - } + if (startPath) + { + me->StopMoving(); + startPath = false; + if (WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath())) + { + Movement::PointsArray pathPoints; + pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + for (uint8 i = 0; i < i_path->size(); ++i) + { + WaypointData const* node = i_path->at(i); + pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); + } + me->GetMotionMaster()->MoveSplinePath(&pathPoints); + } + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SWITCH_PLATFORM: - if (roll_chance_i(20*noQuillTimes)) - { - noQuillTimes = 0; - platform = RAND(0, 3); - me->GetMotionMaster()->MovePoint(POINT_QUILL, alarPoints[POINT_QUILL], false, true); - events.ScheduleEvent(EVENT_SWITCH_PLATFORM, 16000); - } - else - { - if (noQuillTimes++ > 0) - { - me->SetOrientation(alarPoints[platform].GetOrientation()); - me->SummonCreature(NPC_EMBER_OF_ALAR, *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); - } - me->GetMotionMaster()->MovePoint(POINT_PLATFORM, alarPoints[platform], false, true); - platform = (++platform)%4; - events.ScheduleEvent(EVENT_SWITCH_PLATFORM, 30000); - } - me->setAttackTimer(BASE_ATTACK, 20000); - break; - case EVENT_START_QUILLS: - me->CastSpell(me, SPELL_FLAME_QUILLS, false); - break; - case EVENT_RELOCATE_MIDDLE: - me->SetPosition(alarPoints[POINT_MIDDLE]); - break; - case EVENT_MOVE_TO_PHASE_2: - me->RemoveAurasDueToSpell(SPELL_EMBER_BLAST); - me->CastSpell(me, SPELL_REBIRTH_PHASE2, false); - break; - case EVENT_REBIRTH: - me->SetReactState(REACT_AGGRESSIVE); - platform = POINT_MIDDLE; - me->GetMotionMaster()->MoveChase(me->GetVictim()); + switch (events.ExecuteEvent()) + { + case EVENT_SWITCH_PLATFORM: + if (roll_chance_i(20*noQuillTimes)) + { + noQuillTimes = 0; + platform = RAND(0, 3); + me->GetMotionMaster()->MovePoint(POINT_QUILL, alarPoints[POINT_QUILL], false, true); + events.ScheduleEvent(EVENT_SWITCH_PLATFORM, 16000); + } + else + { + if (noQuillTimes++ > 0) + { + me->SetOrientation(alarPoints[platform].GetOrientation()); + me->SummonCreature(NPC_EMBER_OF_ALAR, *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); + } + me->GetMotionMaster()->MovePoint(POINT_PLATFORM, alarPoints[platform], false, true); + platform = (++platform)%4; + events.ScheduleEvent(EVENT_SWITCH_PLATFORM, 30000); + } + me->setAttackTimer(BASE_ATTACK, 20000); + break; + case EVENT_START_QUILLS: + me->CastSpell(me, SPELL_FLAME_QUILLS, false); + break; + case EVENT_RELOCATE_MIDDLE: + me->SetPosition(alarPoints[POINT_MIDDLE]); + break; + case EVENT_MOVE_TO_PHASE_2: + me->RemoveAurasDueToSpell(SPELL_EMBER_BLAST); + me->CastSpell(me, SPELL_REBIRTH_PHASE2, false); + break; + case EVENT_REBIRTH: + me->SetReactState(REACT_AGGRESSIVE); + platform = POINT_MIDDLE; + me->GetMotionMaster()->MoveChase(me->GetVictim()); - events.ScheduleEvent(EVENT_SPELL_MELT_ARMOR, 67000); - events.ScheduleEvent(EVENT_SPELL_CHARGE, 10000); - events.ScheduleEvent(EVENT_SPELL_FLAME_PATCH, 20000); - events.ScheduleEvent(EVENT_SPELL_DIVE_BOMB, 30000); - break; - case EVENT_SPELL_MELT_ARMOR: - me->CastSpell(me->GetVictim(), SPELL_MELT_ARMOR, false); - events.ScheduleEvent(EVENT_SPELL_MELT_ARMOR, 60000); - break; - case EVENT_SPELL_CHARGE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->CastSpell(target, SPELL_CHARGE, false); - events.ScheduleEvent(EVENT_SPELL_CHARGE, 30000); - break; - case EVENT_SPELL_FLAME_PATCH: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) - me->SummonCreature(NPC_FLAME_PATCH, *target, TEMPSUMMON_TIMED_DESPAWN, 2*MINUTE*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_SPELL_FLAME_PATCH, 30000); - break; - case EVENT_SPELL_DIVE_BOMB: - me->GetMotionMaster()->MovePoint(POINT_DIVE, alarPoints[POINT_DIVE], false, true); - events.ScheduleEvent(EVENT_SPELL_DIVE_BOMB, 30000); - events.DelayEvents(15000); - me->setAttackTimer(BASE_ATTACK, 20000); - break; - case EVENT_START_DIVE: - me->CastSpell(me, SPELL_DIVE_BOMB_VISUAL, false); - break; - case EVENT_CAST_DIVE_BOMB: - events.ScheduleEvent(EVENT_SUMMON_DIVE_PHOENIX, 2000); - events.ScheduleEvent(EVENT_REBIRTH_DIVE, 6000); - events.ScheduleEvent(EVENT_FINISH_DIVE, 10000); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 90.0f, true)) - { - me->CastSpell(target, SPELL_DIVE_BOMB, false); - me->SetPosition(*target); - me->StopMovingOnCurrentPos(); - } + events.ScheduleEvent(EVENT_SPELL_MELT_ARMOR, 67000); + events.ScheduleEvent(EVENT_SPELL_CHARGE, 10000); + events.ScheduleEvent(EVENT_SPELL_FLAME_PATCH, 20000); + events.ScheduleEvent(EVENT_SPELL_DIVE_BOMB, 30000); + break; + case EVENT_SPELL_MELT_ARMOR: + me->CastSpell(me->GetVictim(), SPELL_MELT_ARMOR, false); + events.ScheduleEvent(EVENT_SPELL_MELT_ARMOR, 60000); + break; + case EVENT_SPELL_CHARGE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->CastSpell(target, SPELL_CHARGE, false); + events.ScheduleEvent(EVENT_SPELL_CHARGE, 30000); + break; + case EVENT_SPELL_FLAME_PATCH: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true)) + me->SummonCreature(NPC_FLAME_PATCH, *target, TEMPSUMMON_TIMED_DESPAWN, 2*MINUTE*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SPELL_FLAME_PATCH, 30000); + break; + case EVENT_SPELL_DIVE_BOMB: + me->GetMotionMaster()->MovePoint(POINT_DIVE, alarPoints[POINT_DIVE], false, true); + events.ScheduleEvent(EVENT_SPELL_DIVE_BOMB, 30000); + events.DelayEvents(15000); + me->setAttackTimer(BASE_ATTACK, 20000); + break; + case EVENT_START_DIVE: + me->CastSpell(me, SPELL_DIVE_BOMB_VISUAL, false); + break; + case EVENT_CAST_DIVE_BOMB: + events.ScheduleEvent(EVENT_SUMMON_DIVE_PHOENIX, 2000); + events.ScheduleEvent(EVENT_REBIRTH_DIVE, 6000); + events.ScheduleEvent(EVENT_FINISH_DIVE, 10000); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 90.0f, true)) + { + me->CastSpell(target, SPELL_DIVE_BOMB, false); + me->SetPosition(*target); + me->StopMovingOnCurrentPos(); + } - me->RemoveAurasDueToSpell(SPELL_DIVE_BOMB_VISUAL); - break; - case EVENT_SUMMON_DIVE_PHOENIX: - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true); - me->SummonCreature(NPC_EMBER_OF_ALAR, target ? *target : *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); - me->SummonCreature(NPC_EMBER_OF_ALAR, target ? *target : *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); - break; - } - case EVENT_REBIRTH_DIVE: - me->SetModelVisible(true); - me->CastSpell(me, SPELL_REBIRTH_DIVE, false); - break; - case EVENT_FINISH_DIVE: - me->GetMotionMaster()->MoveChase(me->GetVictim()); - break; - case EVENT_SPELL_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - break; - } + me->RemoveAurasDueToSpell(SPELL_DIVE_BOMB_VISUAL); + break; + case EVENT_SUMMON_DIVE_PHOENIX: + { + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 10.0f, true); + me->SummonCreature(NPC_EMBER_OF_ALAR, target ? *target : *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); + me->SummonCreature(NPC_EMBER_OF_ALAR, target ? *target : *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 6000); + break; + } + case EVENT_REBIRTH_DIVE: + me->SetModelVisible(true); + me->CastSpell(me, SPELL_REBIRTH_DIVE, false); + break; + case EVENT_FINISH_DIVE: + me->GetMotionMaster()->MoveChase(me->GetVictim()); + break; + case EVENT_SPELL_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + break; + } - if (me->isAttackReady()) - { + if (me->isAttackReady()) + { if (me->IsWithinMeleeRange(me->GetVictim())) { me->AttackerStateUpdate(me->GetVictim()); @@ -311,16 +311,16 @@ class boss_alar : public CreatureScript else { me->resetAttackTimer(); - ThreatContainer::StorageType const &threatList = me->getThreatManager().getThreatList(); - for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) - if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) - if (me->IsWithinMeleeRange(unit)) - { - me->AttackerStateUpdate(unit); - return; - } + ThreatContainer::StorageType const &threatList = me->getThreatManager().getThreatList(); + for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) + if (me->IsWithinMeleeRange(unit)) + { + me->AttackerStateUpdate(unit); + return; + } - me->CastSpell(me, SPELL_FLAME_BUFFET, false); + me->CastSpell(me, SPELL_FLAME_BUFFET, false); } } } @@ -341,13 +341,13 @@ class CastQuill : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - _caster->CastSpell(_caster, _spellId, true); + _caster->CastSpell(_caster, _spellId, true); return true; } private: Unit* _caster; - uint32 _spellId; + uint32 _spellId; }; class spell_alar_flame_quills : public SpellScriptLoader @@ -363,12 +363,12 @@ class spell_alar_flame_quills : public SpellScriptLoader { PreventDefaultAction(); - // 24 spells in total - for (uint8 i = 0; i < 21; ++i) - GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_1+i), GetUnitOwner()->m_Events.CalculateTime(i*40)); - GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2+0), GetUnitOwner()->m_Events.CalculateTime(22*40)); - GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2+1), GetUnitOwner()->m_Events.CalculateTime(23*40)); - GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2+2), GetUnitOwner()->m_Events.CalculateTime(24*40)); + // 24 spells in total + for (uint8 i = 0; i < 21; ++i) + GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_1+i), GetUnitOwner()->m_Events.CalculateTime(i*40)); + GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2+0), GetUnitOwner()->m_Events.CalculateTime(22*40)); + GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2+1), GetUnitOwner()->m_Events.CalculateTime(23*40)); + GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2+2), GetUnitOwner()->m_Events.CalculateTime(24*40)); } void Register() @@ -394,10 +394,10 @@ class spell_alar_ember_blast : public SpellScriptLoader void HandleForceCast(SpellEffIndex effIndex) { - PreventHitEffect(effIndex); - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* alar = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_ALAR))) - Unit::DealDamage(GetCaster(), alar, alar->CountPctFromMaxHealth(2)); + PreventHitEffect(effIndex); + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + if (Creature* alar = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_ALAR))) + Unit::DealDamage(GetCaster(), alar, alar->CountPctFromMaxHealth(2)); } void Register() @@ -414,78 +414,78 @@ class spell_alar_ember_blast : public SpellScriptLoader class spell_alar_ember_blast_death : public SpellScriptLoader { - public: - spell_alar_ember_blast_death() : SpellScriptLoader("spell_alar_ember_blast_death") { } + public: + spell_alar_ember_blast_death() : SpellScriptLoader("spell_alar_ember_blast_death") { } - class spell_alar_ember_blast_death_AuraScript : public AuraScript - { - PrepareAuraScript(spell_alar_ember_blast_death_AuraScript); + class spell_alar_ember_blast_death_AuraScript : public AuraScript + { + PrepareAuraScript(spell_alar_ember_blast_death_AuraScript); - void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - PreventDefaultAction(); // xinef: prevent default action after change that invisibility in instances is executed instantly even for creatures - Unit* target = GetTarget(); - InvisibilityType type = InvisibilityType(aurEff->GetMiscValue()); - target->m_invisibility.AddFlag(type); - target->m_invisibility.AddValue(type, aurEff->GetAmount()); + void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + PreventDefaultAction(); // xinef: prevent default action after change that invisibility in instances is executed instantly even for creatures + Unit* target = GetTarget(); + InvisibilityType type = InvisibilityType(aurEff->GetMiscValue()); + target->m_invisibility.AddFlag(type); + target->m_invisibility.AddValue(type, aurEff->GetAmount()); - GetUnitOwner()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - GetUnitOwner()->SetStandState(UNIT_STAND_STATE_DEAD); - GetUnitOwner()->m_last_notify_position.Relocate(0.0f, 0.0f, 0.0f); - GetUnitOwner()->m_delayed_unit_relocation_timer = 1000; - } + GetUnitOwner()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + GetUnitOwner()->SetStandState(UNIT_STAND_STATE_DEAD); + GetUnitOwner()->m_last_notify_position.Relocate(0.0f, 0.0f, 0.0f); + GetUnitOwner()->m_delayed_unit_relocation_timer = 1000; + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - GetUnitOwner()->SetStandState(UNIT_STAND_STATE_STAND); - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + GetUnitOwner()->SetStandState(UNIT_STAND_STATE_STAND); + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_alar_ember_blast_death_AuraScript::OnApply, EFFECT_2, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_alar_ember_blast_death_AuraScript::OnRemove, EFFECT_2, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_alar_ember_blast_death_AuraScript::OnApply, EFFECT_2, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_alar_ember_blast_death_AuraScript::OnRemove, EFFECT_2, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_alar_ember_blast_death_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_alar_ember_blast_death_AuraScript(); + } }; class spell_alar_dive_bomb : public SpellScriptLoader { - public: - spell_alar_dive_bomb() : SpellScriptLoader("spell_alar_dive_bomb") { } + public: + spell_alar_dive_bomb() : SpellScriptLoader("spell_alar_dive_bomb") { } - class spell_alar_dive_bomb_AuraScript : public AuraScript - { - PrepareAuraScript(spell_alar_dive_bomb_AuraScript); + class spell_alar_dive_bomb_AuraScript : public AuraScript + { + PrepareAuraScript(spell_alar_dive_bomb_AuraScript); - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->SetModelVisible(false); - GetUnitOwner()->SetDisplayId(DISPLAYID_INVISIBLE); - } + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->SetModelVisible(false); + GetUnitOwner()->SetDisplayId(DISPLAYID_INVISIBLE); + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_alar_dive_bomb_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_alar_dive_bomb_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_alar_dive_bomb_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_alar_dive_bomb_AuraScript(); + } }; void AddSC_boss_alar() { new boss_alar(); - new spell_alar_flame_quills(); - new spell_alar_ember_blast(); - new spell_alar_ember_blast_death(); - new spell_alar_dive_bomb(); + new spell_alar_flame_quills(); + new spell_alar_ember_blast(); + new spell_alar_ember_blast_death(); + new spell_alar_dive_bomb(); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 37daac804..acd4bcbef 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -19,30 +19,30 @@ enum Yells enum Spells { - SPELL_SOLARIAN_TRANSFORM = 39117, - SPELL_ARCANE_MISSILES = 33031, - SPELL_WRATH_OF_THE_ASTROMANCER = 42783, - SPELL_BLINDING_LIGHT = 33009, - SPELL_PSYCHIC_SCREAM = 34322, - SPELL_VOID_BOLT = 39329 + SPELL_SOLARIAN_TRANSFORM = 39117, + SPELL_ARCANE_MISSILES = 33031, + SPELL_WRATH_OF_THE_ASTROMANCER = 42783, + SPELL_BLINDING_LIGHT = 33009, + SPELL_PSYCHIC_SCREAM = 34322, + SPELL_VOID_BOLT = 39329 }; enum Misc { - DISPLAYID_INVISIBLE = 11686, - NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT = 18928, - NPC_SOLARIUM_AGENT = 18925, - NPC_SOLARIUM_PRIEST = 18806, + DISPLAYID_INVISIBLE = 11686, + NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT = 18928, + NPC_SOLARIUM_AGENT = 18925, + NPC_SOLARIUM_PRIEST = 18806, - EVENT_CHECK_HEALTH = 1, - EVENT_SPELL_ARCANE_MISSILES = 2, - EVENT_SPELL_WRATH_OF_ASTROMANCER = 3, - EVENT_SPELL_BLINDING_LIGHT = 4, - EVENT_SPAWN_PORTALS = 5, - EVENT_SUMMON_ADDS = 6, - EVENT_REAPPEAR = 7, - EVENT_SPELL_PSYCHIC_SCREAM = 8, - EVENT_SPELL_VOID_BOLT = 9 + EVENT_CHECK_HEALTH = 1, + EVENT_SPELL_ARCANE_MISSILES = 2, + EVENT_SPELL_WRATH_OF_ASTROMANCER = 3, + EVENT_SPELL_BLINDING_LIGHT = 4, + EVENT_SPAWN_PORTALS = 5, + EVENT_SUMMON_ADDS = 6, + EVENT_REAPPEAR = 7, + EVENT_SPELL_PSYCHIC_SCREAM = 8, + EVENT_SPELL_VOID_BOLT = 9 }; @@ -69,162 +69,162 @@ class boss_high_astromancer_solarian : public CreatureScript void Reset() { - BossAI::Reset(); - me->SetModelVisible(true); + BossAI::Reset(); + me->SetModelVisible(true); } - void AttackStart(Unit* who) - { - if (who && me->Attack(who, true)) - me->GetMotionMaster()->MoveChase(who, (events.GetNextEventTime(EVENT_SPELL_VOID_BOLT) == 0 ? 30.0f : 0.0f)); - } + void AttackStart(Unit* who) + { + if (who && me->Attack(who, true)) + me->GetMotionMaster()->MoveChase(who, (events.GetNextEventTime(EVENT_SPELL_VOID_BOLT) == 0 ? 30.0f : 0.0f)); + } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) - Talk(SAY_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) + Talk(SAY_KILL); } void JustDied(Unit* killer) { - me->SetModelVisible(true); + me->SetModelVisible(true); Talk(SAY_DEATH); - BossAI::JustDied(killer); + BossAI::JustDied(killer); } void EnterCombat(Unit* who) { Talk(SAY_AGGRO); - BossAI::EnterCombat(who); - me->CallForHelp(105.0f); + BossAI::EnterCombat(who); + me->CallForHelp(105.0f); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - events.ScheduleEvent(EVENT_SPELL_ARCANE_MISSILES, 3000); - events.ScheduleEvent(EVENT_SPELL_WRATH_OF_ASTROMANCER, 1000); - events.ScheduleEvent(EVENT_SPELL_BLINDING_LIGHT, 40000); - events.ScheduleEvent(EVENT_SPAWN_PORTALS, 50000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_SPELL_ARCANE_MISSILES, 3000); + events.ScheduleEvent(EVENT_SPELL_WRATH_OF_ASTROMANCER, 1000); + events.ScheduleEvent(EVENT_SPELL_BLINDING_LIGHT, 40000); + events.ScheduleEvent(EVENT_SPAWN_PORTALS, 50000); } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (!summon->IsTrigger()) - summon->SetInCombatWithZone(); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (!summon->IsTrigger()) + summon->SetInCombatWithZone(); + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(21)) - { - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_VOID_BOLT, 3000); - events.ScheduleEvent(EVENT_SPELL_PSYCHIC_SCREAM, 7000); - me->CastSpell(me, SPELL_SOLARIAN_TRANSFORM, true); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_SPELL_ARCANE_MISSILES: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) - me->CastSpell(target, SPELL_ARCANE_MISSILES, false); - events.ScheduleEvent(EVENT_SPELL_ARCANE_MISSILES, 3000); - break; - case EVENT_SPELL_WRATH_OF_ASTROMANCER: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - me->CastSpell(target, SPELL_WRATH_OF_THE_ASTROMANCER, false); - events.ScheduleEvent(EVENT_SPELL_WRATH_OF_ASTROMANCER, 22000); - break; - case EVENT_SPELL_BLINDING_LIGHT: - me->CastSpell(me, SPELL_BLINDING_LIGHT, false); - events.ScheduleEvent(EVENT_SPELL_BLINDING_LIGHT, 40000); - break; - case EVENT_SPAWN_PORTALS: - me->setAttackTimer(BASE_ATTACK, 21000); - me->SetModelVisible(false); - events.ScheduleEvent(EVENT_SPAWN_PORTALS, 50000); - events.DelayEvents(21000); - events.ScheduleEvent(EVENT_SUMMON_ADDS, 6000); - events.ScheduleEvent(EVENT_REAPPEAR, 20000); - for (uint8 i = 0; i < 3; ++i) - { - float o = rand_norm()*2*M_PI; - if (i == 0) - me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, CENTER_X + cos(o)*INNER_PORTAL_RADIUS, CENTER_Y + sin(o)*INNER_PORTAL_RADIUS, CENTER_Z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 26000); - else - me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, CENTER_X + cos(o)*OUTER_PORTAL_RADIUS, CENTER_Y + sin(o)*OUTER_PORTAL_RADIUS, PORTAL_Z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 26000); - } - break; - case EVENT_SUMMON_ADDS: - Talk(SAY_SUMMON1); - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - { - if (Creature* light = ObjectAccessor::GetCreature(*me, *itr)) - if (light->GetEntry() == NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT) - { - if (light->GetDistance2d(CENTER_X, CENTER_Y) < 20.0f) - { - me->SetPosition(*light); - me->StopMovingOnCurrentPos(); - } - for (uint8 j = 0; j < 4; ++j) - me->SummonCreature(NPC_SOLARIUM_AGENT, light->GetPositionX()+frand(-3.0f, 3.0f), light->GetPositionY()+frand(-3.0f, 3.0f), light->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - } - } - break; - case EVENT_REAPPEAR: - Talk(SAY_SUMMON2); - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - { - if (Creature* light = ObjectAccessor::GetCreature(*me, *itr)) - { - if (light->GetEntry() == NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT) - { - light->RemoveAllAuras(); - if (light->GetDistance2d(CENTER_X, CENTER_Y) < 20.0f) - me->SetModelVisible(true); - else - me->SummonCreature(NPC_SOLARIUM_PRIEST, light->GetPositionX()+frand(-3.0f, 3.0f), light->GetPositionY()+frand(-3.0f, 3.0f), light->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - } - } - } - // protection - if (me->GetDisplayId() != me->GetNativeDisplayId()) - { - me->SetModelVisible(true); - me->SummonCreature(NPC_SOLARIUM_PRIEST, me->GetPositionX()+frand(-3.0f, 3.0f), me->GetPositionY()+frand(-3.0f, 3.0f), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_SOLARIUM_PRIEST, me->GetPositionX()+frand(-3.0f, 3.0f), me->GetPositionY()+frand(-3.0f, 3.0f), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - } - break; - case EVENT_SPELL_VOID_BOLT: - me->CastSpell(me->GetVictim(), SPELL_VOID_BOLT, false); - events.ScheduleEvent(EVENT_SPELL_VOID_BOLT, 7000); - break; - case EVENT_SPELL_PSYCHIC_SCREAM: - me->CastSpell(me, SPELL_PSYCHIC_SCREAM, false); - events.ScheduleEvent(EVENT_SPELL_PSYCHIC_SCREAM, 12000); - break; + switch (events.ExecuteEvent()) + { + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(21)) + { + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_VOID_BOLT, 3000); + events.ScheduleEvent(EVENT_SPELL_PSYCHIC_SCREAM, 7000); + me->CastSpell(me, SPELL_SOLARIAN_TRANSFORM, true); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_SPELL_ARCANE_MISSILES: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true)) + me->CastSpell(target, SPELL_ARCANE_MISSILES, false); + events.ScheduleEvent(EVENT_SPELL_ARCANE_MISSILES, 3000); + break; + case EVENT_SPELL_WRATH_OF_ASTROMANCER: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + me->CastSpell(target, SPELL_WRATH_OF_THE_ASTROMANCER, false); + events.ScheduleEvent(EVENT_SPELL_WRATH_OF_ASTROMANCER, 22000); + break; + case EVENT_SPELL_BLINDING_LIGHT: + me->CastSpell(me, SPELL_BLINDING_LIGHT, false); + events.ScheduleEvent(EVENT_SPELL_BLINDING_LIGHT, 40000); + break; + case EVENT_SPAWN_PORTALS: + me->setAttackTimer(BASE_ATTACK, 21000); + me->SetModelVisible(false); + events.ScheduleEvent(EVENT_SPAWN_PORTALS, 50000); + events.DelayEvents(21000); + events.ScheduleEvent(EVENT_SUMMON_ADDS, 6000); + events.ScheduleEvent(EVENT_REAPPEAR, 20000); + for (uint8 i = 0; i < 3; ++i) + { + float o = rand_norm()*2*M_PI; + if (i == 0) + me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, CENTER_X + cos(o)*INNER_PORTAL_RADIUS, CENTER_Y + sin(o)*INNER_PORTAL_RADIUS, CENTER_Z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 26000); + else + me->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, CENTER_X + cos(o)*OUTER_PORTAL_RADIUS, CENTER_Y + sin(o)*OUTER_PORTAL_RADIUS, PORTAL_Z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 26000); + } + break; + case EVENT_SUMMON_ADDS: + Talk(SAY_SUMMON1); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + { + if (Creature* light = ObjectAccessor::GetCreature(*me, *itr)) + if (light->GetEntry() == NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT) + { + if (light->GetDistance2d(CENTER_X, CENTER_Y) < 20.0f) + { + me->SetPosition(*light); + me->StopMovingOnCurrentPos(); + } + for (uint8 j = 0; j < 4; ++j) + me->SummonCreature(NPC_SOLARIUM_AGENT, light->GetPositionX()+frand(-3.0f, 3.0f), light->GetPositionY()+frand(-3.0f, 3.0f), light->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + } + } + break; + case EVENT_REAPPEAR: + Talk(SAY_SUMMON2); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + { + if (Creature* light = ObjectAccessor::GetCreature(*me, *itr)) + { + if (light->GetEntry() == NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT) + { + light->RemoveAllAuras(); + if (light->GetDistance2d(CENTER_X, CENTER_Y) < 20.0f) + me->SetModelVisible(true); + else + me->SummonCreature(NPC_SOLARIUM_PRIEST, light->GetPositionX()+frand(-3.0f, 3.0f), light->GetPositionY()+frand(-3.0f, 3.0f), light->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + } + } + } + // protection + if (me->GetDisplayId() != me->GetNativeDisplayId()) + { + me->SetModelVisible(true); + me->SummonCreature(NPC_SOLARIUM_PRIEST, me->GetPositionX()+frand(-3.0f, 3.0f), me->GetPositionY()+frand(-3.0f, 3.0f), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_SOLARIUM_PRIEST, me->GetPositionX()+frand(-3.0f, 3.0f), me->GetPositionY()+frand(-3.0f, 3.0f), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + } + break; + case EVENT_SPELL_VOID_BOLT: + me->CastSpell(me->GetVictim(), SPELL_VOID_BOLT, false); + events.ScheduleEvent(EVENT_SPELL_VOID_BOLT, 7000); + break; + case EVENT_SPELL_PSYCHIC_SCREAM: + me->CastSpell(me, SPELL_PSYCHIC_SCREAM, false); + events.ScheduleEvent(EVENT_SPELL_PSYCHIC_SCREAM, 12000); + break; - } + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(); } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetDistance2d(432.59f, -371.93f) > 105.0f; - } + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetDistance2d(432.59f, -371.93f) > 105.0f; + } }; CreatureAI* GetAI(Creature* creature) const @@ -274,12 +274,12 @@ class spell_astromancer_solarian_transform : public SpellScriptLoader void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->HandleStatModifier(UnitMods(UNIT_MOD_ARMOR), TOTAL_PCT, 400.0f, true); + GetUnitOwner()->HandleStatModifier(UnitMods(UNIT_MOD_ARMOR), TOTAL_PCT, 400.0f, true); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->HandleStatModifier(UnitMods(UNIT_MOD_ARMOR), TOTAL_PCT, 400.0f, false); + GetUnitOwner()->HandleStatModifier(UnitMods(UNIT_MOD_ARMOR), TOTAL_PCT, 400.0f, false); } void Register() @@ -299,6 +299,6 @@ void AddSC_boss_high_astromancer_solarian() { new boss_high_astromancer_solarian(); new spell_astromancer_wrath_of_the_astromancer(); - new spell_astromancer_solarian_transform(); + new spell_astromancer_solarian_transform(); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index a586521d2..dbd29d51f 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -25,7 +25,7 @@ enum Yells SAY_GRAVITYLAPSE = 11, SAY_SUMMON_PHOENIX = 12, SAY_DEATH = 13, - SAY_PYROBLAST = 14, + SAY_PYROBLAST = 14, // Advisors SAY_THALADRED_AGGRO = 0, @@ -46,265 +46,265 @@ enum Spells SPELL_SUMMON_WEAPONF = 36963, SPELL_SUMMON_WEAPONG = 36964, - // Phase 3 spells - SPELL_RESURRECTION = 36450, + // Phase 3 spells + SPELL_RESURRECTION = 36450, // Phase 4 spells SPELL_FIREBALL = 36805, SPELL_ARCANE_DISRUPTION = 36834, - SPELL_PHOENIX = 36723, + SPELL_PHOENIX = 36723, SPELL_MIND_CONTROL = 36797, SPELL_SHOCK_BARRIER = 36815, SPELL_PYROBLAST = 36819, SPELL_FLAME_STRIKE = 36735, SPELL_FLAME_STRIKE_DAMAGE = 36731, - // Event - SPELL_NETHERBEAM_AURA1 = 36364, - SPELL_NETHERBEAM_AURA2 = 36370, - SPELL_NETHERBEAM_AURA3 = 36371, - SPELL_NETHERBEAM1 = 36089, - SPELL_NETHERBEAM2 = 36090, - SPELL_KAEL_GAINING_POWER = 36091, - SPELL_KAEL_EXPLODES1 = 36376, - SPELL_KAEL_EXPLODES2 = 36375, - SPELL_KAEL_EXPLODES3 = 36373, - SPELL_KAEL_EXPLODES4 = 36354, - SPELL_KAEL_EXPLODES5 = 36092, - SPELL_GROW = 36184, - SPELL_KEAL_STUNNED = 36185, - SPELL_KAEL_FULL_POWER = 36187, - SPELL_FLOATING_DROWNED = 36550, + // Event + SPELL_NETHERBEAM_AURA1 = 36364, + SPELL_NETHERBEAM_AURA2 = 36370, + SPELL_NETHERBEAM_AURA3 = 36371, + SPELL_NETHERBEAM1 = 36089, + SPELL_NETHERBEAM2 = 36090, + SPELL_KAEL_GAINING_POWER = 36091, + SPELL_KAEL_EXPLODES1 = 36376, + SPELL_KAEL_EXPLODES2 = 36375, + SPELL_KAEL_EXPLODES3 = 36373, + SPELL_KAEL_EXPLODES4 = 36354, + SPELL_KAEL_EXPLODES5 = 36092, + SPELL_GROW = 36184, + SPELL_KEAL_STUNNED = 36185, + SPELL_KAEL_FULL_POWER = 36187, + SPELL_FLOATING_DROWNED = 36550, - SPELL_PURE_NETHER_BEAM1 = 36196, - SPELL_PURE_NETHER_BEAM2 = 36197, - SPELL_PURE_NETHER_BEAM3 = 36198, + SPELL_PURE_NETHER_BEAM1 = 36196, + SPELL_PURE_NETHER_BEAM2 = 36197, + SPELL_PURE_NETHER_BEAM3 = 36198, // Phase 5 spells - SPELL_GRAVITY_LAPSE = 35941, - SPELL_GRAVITY_LAPSE_TELEPORT1 = 35966, - SPELL_GRAVITY_LAPSE_KNOCKBACK = 34480, - SPELL_GRAVITY_LAPSE_AURA = 39432, - SPELL_SUMMON_NETHER_VAPOR = 35865, - SPELL_NETHER_BEAM = 35869, - SPELL_NETHER_BEAM_DAMAGE = 35873, + SPELL_GRAVITY_LAPSE = 35941, + SPELL_GRAVITY_LAPSE_TELEPORT1 = 35966, + SPELL_GRAVITY_LAPSE_KNOCKBACK = 34480, + SPELL_GRAVITY_LAPSE_AURA = 39432, + SPELL_SUMMON_NETHER_VAPOR = 35865, + SPELL_NETHER_BEAM = 35869, + SPELL_NETHER_BEAM_DAMAGE = 35873, - SPELL_REMOTE_TOY_STUN = 37029 + SPELL_REMOTE_TOY_STUN = 37029 }; enum Misc { - POINT_MIDDLE = 1, - POINT_AIR = 2, - POINT_START_LAST_PHASE = 3, - DATA_RESURRECT_CAST = 1, - NPC_WORLD_TRIGGER = 19871, - NPC_NETHER_VAPOR = 21002, + POINT_MIDDLE = 1, + POINT_AIR = 2, + POINT_START_LAST_PHASE = 3, + DATA_RESURRECT_CAST = 1, + NPC_WORLD_TRIGGER = 19871, + NPC_NETHER_VAPOR = 21002, - PHASE_NONE = 0, - PHASE_SINGLE_ADVISOR = 1, - PHASE_WEAPONS = 2, - PHASE_ALL_ADVISORS = 3, - PHASE_FINAL = 4, + PHASE_NONE = 0, + PHASE_SINGLE_ADVISOR = 1, + PHASE_WEAPONS = 2, + PHASE_ALL_ADVISORS = 3, + PHASE_FINAL = 4, - EVENT_PREFIGHT_PHASE11 = 1, - EVENT_PREFIGHT_PHASE12 = 2, - EVENT_PREFIGHT_PHASE21 = 3, - EVENT_PREFIGHT_PHASE22 = 4, - EVENT_PREFIGHT_PHASE31 = 5, - EVENT_PREFIGHT_PHASE32 = 6, - EVENT_PREFIGHT_PHASE41 = 7, - EVENT_PREFIGHT_PHASE42 = 8, - EVENT_PREFIGHT_PHASE51 = 9, - EVENT_PREFIGHT_PHASE52 = 10, - EVENT_PREFIGHT_PHASE61 = 11, - EVENT_PREFIGHT_PHASE62 = 12, - EVENT_PREFIGHT_PHASE63 = 13, - EVENT_PREFIGHT_PHASE71 = 14, - EVENT_GATHER_ADVISORS = 15, + EVENT_PREFIGHT_PHASE11 = 1, + EVENT_PREFIGHT_PHASE12 = 2, + EVENT_PREFIGHT_PHASE21 = 3, + EVENT_PREFIGHT_PHASE22 = 4, + EVENT_PREFIGHT_PHASE31 = 5, + EVENT_PREFIGHT_PHASE32 = 6, + EVENT_PREFIGHT_PHASE41 = 7, + EVENT_PREFIGHT_PHASE42 = 8, + EVENT_PREFIGHT_PHASE51 = 9, + EVENT_PREFIGHT_PHASE52 = 10, + EVENT_PREFIGHT_PHASE61 = 11, + EVENT_PREFIGHT_PHASE62 = 12, + EVENT_PREFIGHT_PHASE63 = 13, + EVENT_PREFIGHT_PHASE71 = 14, + EVENT_GATHER_ADVISORS = 15, - EVENT_SPELL_SEQ_1 = 30, - EVENT_SPELL_SEQ_2 = 31, - EVENT_SPELL_SEQ_3 = 32, - EVENT_SPELL_FIREBALL = 33, - EVENT_SPELL_PYROBLAST = 34, - EVENT_SPELL_FLAMESTRIKE = 35, - EVENT_SPELL_ARCANE_DISRUPTION = 36, - EVENT_SPELL_MIND_CONTROL = 37, - EVENT_SPELL_SUMMON_PHOENIX = 38, - EVENT_CHECK_HEALTH = 39, - EVENT_SPELL_GRAVITY_LAPSE = 40, - EVENT_GRAVITY_LAPSE_END = 41, - EVENT_SPELL_SHOCK_BARRIER = 42, - EVENT_SPELL_NETHER_BEAM = 43, - EVENT_SPELL_NETHER_VAPOR = 44, + EVENT_SPELL_SEQ_1 = 30, + EVENT_SPELL_SEQ_2 = 31, + EVENT_SPELL_SEQ_3 = 32, + EVENT_SPELL_FIREBALL = 33, + EVENT_SPELL_PYROBLAST = 34, + EVENT_SPELL_FLAMESTRIKE = 35, + EVENT_SPELL_ARCANE_DISRUPTION = 36, + EVENT_SPELL_MIND_CONTROL = 37, + EVENT_SPELL_SUMMON_PHOENIX = 38, + EVENT_CHECK_HEALTH = 39, + EVENT_SPELL_GRAVITY_LAPSE = 40, + EVENT_GRAVITY_LAPSE_END = 41, + EVENT_SPELL_SHOCK_BARRIER = 42, + EVENT_SPELL_NETHER_BEAM = 43, + EVENT_SPELL_NETHER_VAPOR = 44, - EVENT_SCENE_1 = 50, - EVENT_SCENE_2 = 51, - EVENT_SCENE_3 = 52, - EVENT_SCENE_4 = 53, - EVENT_SCENE_5 = 54, - EVENT_SCENE_6 = 55, - EVENT_SCENE_7 = 56, - EVENT_SCENE_8 = 57, - EVENT_SCENE_9 = 58, - EVENT_SCENE_10 = 59, - EVENT_SCENE_11 = 60, - EVENT_SCENE_12 = 61, - EVENT_SCENE_13 = 62, - EVENT_SCENE_14 = 63, - EVENT_SCENE_15 = 64, - EVENT_SCENE_16 = 65 + EVENT_SCENE_1 = 50, + EVENT_SCENE_2 = 51, + EVENT_SCENE_3 = 52, + EVENT_SCENE_4 = 53, + EVENT_SCENE_5 = 54, + EVENT_SCENE_6 = 55, + EVENT_SCENE_7 = 56, + EVENT_SCENE_8 = 57, + EVENT_SCENE_9 = 58, + EVENT_SCENE_10 = 59, + EVENT_SCENE_11 = 60, + EVENT_SCENE_12 = 61, + EVENT_SCENE_13 = 62, + EVENT_SCENE_14 = 63, + EVENT_SCENE_15 = 64, + EVENT_SCENE_16 = 65 }; const Position triggersPos[6] = { - {799.11f, -38.95f, 85.0f, 0.0f}, - {800.16f, 37.65f, 85.0f, 0.0f}, - {847.64f, -16.19f, 64.05f, 0.0f}, - {847.53f, 15.01f, 63.69f, 0.0f}, - {843.44f, -7.87f, 67.14f, 0.0f}, - {843.35f, 6.35f, 67.14f, 0.0f} + {799.11f, -38.95f, 85.0f, 0.0f}, + {800.16f, 37.65f, 85.0f, 0.0f}, + {847.64f, -16.19f, 64.05f, 0.0f}, + {847.53f, 15.01f, 63.69f, 0.0f}, + {843.44f, -7.87f, 67.14f, 0.0f}, + {843.35f, 6.35f, 67.14f, 0.0f} }; class boss_kaelthas : public CreatureScript { public: - boss_kaelthas() : CreatureScript("boss_kaelthas") { } + boss_kaelthas() : CreatureScript("boss_kaelthas") { } struct boss_kaelthasAI : public BossAI { boss_kaelthasAI(Creature* creature) : BossAI(creature, DATA_KAELTHAS) { } - uint8 phase; - EventMap events2; + uint8 phase; + EventMap events2; - void PrepareAdvisors() - { - for (uint8 i = DATA_KAEL_ADVISOR1; i <= DATA_KAEL_ADVISOR4; ++i) - if (Creature* advisor = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) - { - advisor->Respawn(true); - advisor->StopMovingOnCurrentPos(); - advisor->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - advisor->SetReactState(REACT_PASSIVE); - summons.Summon(advisor); - } - } + void PrepareAdvisors() + { + for (uint8 i = DATA_KAEL_ADVISOR1; i <= DATA_KAEL_ADVISOR4; ++i) + if (Creature* advisor = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) + { + advisor->Respawn(true); + advisor->StopMovingOnCurrentPos(); + advisor->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + advisor->SetReactState(REACT_PASSIVE); + summons.Summon(advisor); + } + } - void SetData(uint32 type, uint32 data) - { - if (type == DATA_RESURRECT_CAST && data == DATA_RESURRECT_CAST) - { - for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) - if (summon->GetDBTableGUIDLow()) - { - summon->SetReactState(REACT_PASSIVE); - summon->setDeathState(JUST_RESPAWNED); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - } - } + void SetData(uint32 type, uint32 data) + { + if (type == DATA_RESURRECT_CAST && data == DATA_RESURRECT_CAST) + { + for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) + if (summon->GetDBTableGUIDLow()) + { + summon->SetReactState(REACT_PASSIVE); + summon->setDeathState(JUST_RESPAWNED); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + } + } - void SetRoomState(GOState state) - { - if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_BRIDGE_WINDOW))) - window->SetGoState(state); - if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_KAEL_STATUE_RIGHT))) - window->SetGoState(state); - if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_KAEL_STATUE_LEFT))) - window->SetGoState(state); - } + void SetRoomState(GOState state) + { + if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_BRIDGE_WINDOW))) + window->SetGoState(state); + if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_KAEL_STATUE_RIGHT))) + window->SetGoState(state); + if (GameObject* window = ObjectAccessor::GetGameObject(*me, instance->GetData64(GO_KAEL_STATUE_LEFT))) + window->SetGoState(state); + } void Reset() { - BossAI::Reset(); - events2.Reset(); - events2.ScheduleEvent(EVENT_GATHER_ADVISORS, 1000); - phase = PHASE_NONE; + BossAI::Reset(); + events2.Reset(); + events2.ScheduleEvent(EVENT_GATHER_ADVISORS, 1000); + phase = PHASE_NONE; - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_HOVER, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_HOVER, true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - SetRoomState(GO_STATE_READY); - me->SetDisableGravity(false); - me->SetWalk(false); + SetRoomState(GO_STATE_READY); + me->SetDisableGravity(false); + me->SetWalk(false); } - void AttackStart(Unit* who) - { - if (phase == PHASE_FINAL && events.GetNextEventTime(EVENT_GRAVITY_LAPSE_END) == 0) - BossAI::AttackStart(who); - } - - void MoveInLineOfSight(Unit* who) + void AttackStart(Unit* who) { - if (phase == PHASE_NONE && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who)) - { - phase = PHASE_SINGLE_ADVISOR; - me->SetInCombatWithZone(); + if (phase == PHASE_FINAL && events.GetNextEventTime(EVENT_GRAVITY_LAPSE_END) == 0) + BossAI::AttackStart(who); + } + + void MoveInLineOfSight(Unit* who) + { + if (phase == PHASE_NONE && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who)) + { + phase = PHASE_SINGLE_ADVISOR; + me->SetInCombatWithZone(); Talk(SAY_INTRO); - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE11, 23000); - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE12, 30000); - } + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE11, 23000); + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE12, 30000); + } } void EnterCombat(Unit* who) { - BossAI::EnterCombat(who); + BossAI::EnterCombat(who); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void JustSummoned(Creature* summon) { - summons.Summon(summon); - if (summon->GetEntry() == NPC_NETHER_VAPOR) - summon->GetMotionMaster()->MoveRandom(20.0f); + summons.Summon(summon); + if (summon->GetEntry() == NPC_NETHER_VAPOR) + summon->GetMotionMaster()->MoveRandom(20.0f); } void SummonedCreatureDies(Creature* summon, Unit*) { - if (phase == PHASE_FINAL) - return; + if (phase == PHASE_FINAL) + return; - if (summon->GetDBTableGUIDLow() && phase == PHASE_ALL_ADVISORS) - { - for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) - if (summon->GetDBTableGUIDLow() && summon->IsAlive()) - return; + if (summon->GetDBTableGUIDLow() && phase == PHASE_ALL_ADVISORS) + { + for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) + if (summon->GetDBTableGUIDLow() && summon->IsAlive()) + return; - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE71, 2000); - return; - } + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE71, 2000); + return; + } - if (summon->GetEntry() == NPC_THALADRED) - { - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE21, 2000); - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE22, 14500); - } - else if (summon->GetEntry() == NPC_LORD_SANGUINAR) - { - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE31, 2000); - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE32, 9000); - } - else if (summon->GetEntry() == NPC_CAPERNIAN) - { - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE41, 2000); - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE42, 10400); - } - else if (summon->GetEntry() == NPC_TELONICUS) - { - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE51, 3000); - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE52, 9000); - } + if (summon->GetEntry() == NPC_THALADRED) + { + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE21, 2000); + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE22, 14500); + } + else if (summon->GetEntry() == NPC_LORD_SANGUINAR) + { + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE31, 2000); + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE32, 9000); + } + else if (summon->GetEntry() == NPC_CAPERNIAN) + { + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE41, 2000); + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE42, 10400); + } + else if (summon->GetEntry() == NPC_TELONICUS) + { + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE51, 3000); + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE52, 9000); + } } void JustDied(Unit* killer) @@ -312,398 +312,398 @@ class boss_kaelthas : public CreatureScript me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); Talk(SAY_DEATH); - BossAI::JustDied(killer); + BossAI::JustDied(killer); } - void MovementInform(uint32 type, uint32 point) - { - if (type != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 point) + { + if (type != POINT_MOTION_TYPE) + return; - if (point == POINT_MIDDLE) - { - events2.ScheduleEvent(EVENT_SCENE_1, 0); - events2.ScheduleEvent(EVENT_SCENE_2, 2500); - events2.ScheduleEvent(EVENT_SCENE_3, 4000); - events2.ScheduleEvent(EVENT_SCENE_4, 7000); - events2.ScheduleEvent(EVENT_SCENE_5, 10000); - events2.ScheduleEvent(EVENT_SCENE_6, 14000); - events2.ScheduleEvent(EVENT_SCENE_7, 17500); - events2.ScheduleEvent(EVENT_SCENE_8, 19000); - events2.ScheduleEvent(EVENT_SCENE_9, 22000); // two first lightnings + aura - events2.ScheduleEvent(EVENT_SCENE_10, 22800); // two - events2.ScheduleEvent(EVENT_SCENE_11, 23600); // two - events2.ScheduleEvent(EVENT_SCENE_12, 24500); // two - events2.ScheduleEvent(EVENT_SCENE_13, 24800); // two - events2.ScheduleEvent(EVENT_SCENE_14, 25300); // two - events2.ScheduleEvent(EVENT_SCENE_15, 32000); // full power - events2.ScheduleEvent(EVENT_SCENE_16, 36000); // remove lightnings + aura, move down - } - else if (point == POINT_START_LAST_PHASE) - { - me->SetDisableGravity(false); - me->SetWalk(false); - me->RemoveAurasDueToSpell(SPELL_KAEL_FULL_POWER); - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - events.SetTimer(60000); - events.ScheduleEvent(EVENT_SPELL_FIREBALL, 0); - events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 10000); - events.ScheduleEvent(EVENT_SPELL_SUMMON_PHOENIX, 20000); - events.ScheduleEvent(EVENT_SPELL_GRAVITY_LAPSE, 5000); - if (me->GetVictim()) - { - me->SetTarget(me->GetVictim()->GetGUID()); - AttackStart(me->GetVictim()); - } - } - } + if (point == POINT_MIDDLE) + { + events2.ScheduleEvent(EVENT_SCENE_1, 0); + events2.ScheduleEvent(EVENT_SCENE_2, 2500); + events2.ScheduleEvent(EVENT_SCENE_3, 4000); + events2.ScheduleEvent(EVENT_SCENE_4, 7000); + events2.ScheduleEvent(EVENT_SCENE_5, 10000); + events2.ScheduleEvent(EVENT_SCENE_6, 14000); + events2.ScheduleEvent(EVENT_SCENE_7, 17500); + events2.ScheduleEvent(EVENT_SCENE_8, 19000); + events2.ScheduleEvent(EVENT_SCENE_9, 22000); // two first lightnings + aura + events2.ScheduleEvent(EVENT_SCENE_10, 22800); // two + events2.ScheduleEvent(EVENT_SCENE_11, 23600); // two + events2.ScheduleEvent(EVENT_SCENE_12, 24500); // two + events2.ScheduleEvent(EVENT_SCENE_13, 24800); // two + events2.ScheduleEvent(EVENT_SCENE_14, 25300); // two + events2.ScheduleEvent(EVENT_SCENE_15, 32000); // full power + events2.ScheduleEvent(EVENT_SCENE_16, 36000); // remove lightnings + aura, move down + } + else if (point == POINT_START_LAST_PHASE) + { + me->SetDisableGravity(false); + me->SetWalk(false); + me->RemoveAurasDueToSpell(SPELL_KAEL_FULL_POWER); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + events.SetTimer(60000); + events.ScheduleEvent(EVENT_SPELL_FIREBALL, 0); + events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 10000); + events.ScheduleEvent(EVENT_SPELL_SUMMON_PHOENIX, 20000); + events.ScheduleEvent(EVENT_SPELL_GRAVITY_LAPSE, 5000); + if (me->GetVictim()) + { + me->SetTarget(me->GetVictim()->GetGUID()); + AttackStart(me->GetVictim()); + } + } + } void UpdateAI(uint32 diff) { - if (EnterEvadeIfOutOfCombatArea()) - return; + if (EnterEvadeIfOutOfCombatArea()) + return; - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_GATHER_ADVISORS: - PrepareAdvisors(); - break; - case EVENT_PREFIGHT_PHASE11: - Talk(SAY_INTRO_THALADRED); - break; - case EVENT_PREFIGHT_PHASE12: - if (Creature* advisor = summons.GetCreatureWithEntry(NPC_THALADRED)) - { - advisor->SetReactState(REACT_AGGRESSIVE); - advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - advisor->AI()->AttackStart(target); - advisor->SetInCombatWithZone(); - advisor->AI()->Talk(SAY_THALADRED_AGGRO); - } - break; - case EVENT_PREFIGHT_PHASE21: - Talk(SAY_INTRO_SANGUINAR); - break; - case EVENT_PREFIGHT_PHASE22: - if (Creature* advisor = summons.GetCreatureWithEntry(NPC_LORD_SANGUINAR)) - { - advisor->SetReactState(REACT_AGGRESSIVE); - advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - advisor->AI()->AttackStart(target); - advisor->SetInCombatWithZone(); - advisor->AI()->Talk(SAY_SANGUINAR_AGGRO); - } - break; - case EVENT_PREFIGHT_PHASE31: - Talk(SAY_INTRO_CAPERNIAN); - break; - case EVENT_PREFIGHT_PHASE32: - if (Creature* advisor = summons.GetCreatureWithEntry(NPC_CAPERNIAN)) - { - advisor->SetReactState(REACT_AGGRESSIVE); - advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - advisor->AI()->AttackStart(target); - advisor->SetInCombatWithZone(); - advisor->AI()->Talk(SAY_CAPERNIAN_AGGRO); - } - break; - case EVENT_PREFIGHT_PHASE41: - Talk(SAY_INTRO_TELONICUS); - break; - case EVENT_PREFIGHT_PHASE42: - if (Creature* advisor = summons.GetCreatureWithEntry(NPC_TELONICUS)) - { - advisor->SetReactState(REACT_AGGRESSIVE); - advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - advisor->AI()->AttackStart(target); - advisor->SetInCombatWithZone(); - advisor->AI()->Talk(SAY_TELONICUS_AGGRO); - } - break; - case EVENT_PREFIGHT_PHASE51: - Talk(SAY_PHASE2_WEAPON); - me->CastSpell(me, SPELL_SUMMON_WEAPONS, false); - phase = PHASE_WEAPONS; - break; - case EVENT_PREFIGHT_PHASE52: - for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) - { - if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) - if (!summon->GetDBTableGUIDLow()) - { - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - summon->SetInCombatWithZone(); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - summon->AI()->AttackStart(target); - } - } - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE61, 2*MINUTE*IN_MILLISECONDS); - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE62, 2*MINUTE*IN_MILLISECONDS+6000); - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE63, 2*MINUTE*IN_MILLISECONDS+12000); - break; - case EVENT_PREFIGHT_PHASE61: - phase = PHASE_ALL_ADVISORS; - Talk(SAY_PHASE3_ADVANCE); - break; - case EVENT_PREFIGHT_PHASE62: - me->CastSpell(me, SPELL_RESURRECTION, false); - break; - case EVENT_PREFIGHT_PHASE63: - for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) - if (summon->GetDBTableGUIDLow()) - { - summon->SetReactState(REACT_AGGRESSIVE); - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - summon->SetInCombatWithZone(); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - summon->AI()->AttackStart(target); - } - events2.ScheduleEvent(EVENT_PREFIGHT_PHASE71, 3*MINUTE*IN_MILLISECONDS); - break; - case EVENT_PREFIGHT_PHASE71: - events2.CancelEvent(EVENT_PREFIGHT_PHASE71); - Talk(SAY_PHASE4_INTRO2); - phase = PHASE_FINAL; - DoResetThreat(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_GATHER_ADVISORS: + PrepareAdvisors(); + break; + case EVENT_PREFIGHT_PHASE11: + Talk(SAY_INTRO_THALADRED); + break; + case EVENT_PREFIGHT_PHASE12: + if (Creature* advisor = summons.GetCreatureWithEntry(NPC_THALADRED)) + { + advisor->SetReactState(REACT_AGGRESSIVE); + advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + advisor->AI()->AttackStart(target); + advisor->SetInCombatWithZone(); + advisor->AI()->Talk(SAY_THALADRED_AGGRO); + } + break; + case EVENT_PREFIGHT_PHASE21: + Talk(SAY_INTRO_SANGUINAR); + break; + case EVENT_PREFIGHT_PHASE22: + if (Creature* advisor = summons.GetCreatureWithEntry(NPC_LORD_SANGUINAR)) + { + advisor->SetReactState(REACT_AGGRESSIVE); + advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + advisor->AI()->AttackStart(target); + advisor->SetInCombatWithZone(); + advisor->AI()->Talk(SAY_SANGUINAR_AGGRO); + } + break; + case EVENT_PREFIGHT_PHASE31: + Talk(SAY_INTRO_CAPERNIAN); + break; + case EVENT_PREFIGHT_PHASE32: + if (Creature* advisor = summons.GetCreatureWithEntry(NPC_CAPERNIAN)) + { + advisor->SetReactState(REACT_AGGRESSIVE); + advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + advisor->AI()->AttackStart(target); + advisor->SetInCombatWithZone(); + advisor->AI()->Talk(SAY_CAPERNIAN_AGGRO); + } + break; + case EVENT_PREFIGHT_PHASE41: + Talk(SAY_INTRO_TELONICUS); + break; + case EVENT_PREFIGHT_PHASE42: + if (Creature* advisor = summons.GetCreatureWithEntry(NPC_TELONICUS)) + { + advisor->SetReactState(REACT_AGGRESSIVE); + advisor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + advisor->AI()->AttackStart(target); + advisor->SetInCombatWithZone(); + advisor->AI()->Talk(SAY_TELONICUS_AGGRO); + } + break; + case EVENT_PREFIGHT_PHASE51: + Talk(SAY_PHASE2_WEAPON); + me->CastSpell(me, SPELL_SUMMON_WEAPONS, false); + phase = PHASE_WEAPONS; + break; + case EVENT_PREFIGHT_PHASE52: + for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) + { + if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) + if (!summon->GetDBTableGUIDLow()) + { + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + summon->SetInCombatWithZone(); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + summon->AI()->AttackStart(target); + } + } + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE61, 2*MINUTE*IN_MILLISECONDS); + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE62, 2*MINUTE*IN_MILLISECONDS+6000); + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE63, 2*MINUTE*IN_MILLISECONDS+12000); + break; + case EVENT_PREFIGHT_PHASE61: + phase = PHASE_ALL_ADVISORS; + Talk(SAY_PHASE3_ADVANCE); + break; + case EVENT_PREFIGHT_PHASE62: + me->CastSpell(me, SPELL_RESURRECTION, false); + break; + case EVENT_PREFIGHT_PHASE63: + for (SummonList::const_iterator i = summons.begin(); i != summons.end(); ++i) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) + if (summon->GetDBTableGUIDLow()) + { + summon->SetReactState(REACT_AGGRESSIVE); + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + summon->SetInCombatWithZone(); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + summon->AI()->AttackStart(target); + } + events2.ScheduleEvent(EVENT_PREFIGHT_PHASE71, 3*MINUTE*IN_MILLISECONDS); + break; + case EVENT_PREFIGHT_PHASE71: + events2.CancelEvent(EVENT_PREFIGHT_PHASE71); + Talk(SAY_PHASE4_INTRO2); + phase = PHASE_FINAL; + DoResetThreat(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) AttackStart(target); - events2.Reset(); - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_FIREBALL, 1000); - events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 15000); - events.ScheduleEvent(EVENT_SPELL_SUMMON_PHOENIX, 30000); - events.ScheduleEvent(EVENT_SPELL_SEQ_1, 20000); - events.ScheduleEvent(EVENT_SPELL_SEQ_2, 40000); - events.ScheduleEvent(EVENT_SPELL_SEQ_3, 60000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_SCENE_1: - me->SetTarget(0); - me->SetFacingTo(M_PI); - me->SetWalk(true); - Talk(SAY_PHASE5_NUTS); - break; - case EVENT_SCENE_2: - me->SetTarget(0); - me->CastSpell(me, SPELL_KAEL_EXPLODES1, true); - me->CastSpell(me, SPELL_KAEL_GAINING_POWER, false); - me->SetDisableGravity(true); - break; - case EVENT_SCENE_3: - me->SetTarget(0); - for (uint8 i = 0; i < 2; ++i) - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, triggersPos[i], TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_NETHERBEAM1+i, false); - me->GetMotionMaster()->MovePoint(POINT_AIR, me->GetPositionX(), me->GetPositionY(), 76.0f, false, true); - me->CastSpell(me, SPELL_GROW, true); - break; - case EVENT_SCENE_4: - me->SetTarget(0); - me->CastSpell(me, SPELL_GROW, true); - me->CastSpell(me, SPELL_KAEL_EXPLODES2, true); - me->CastSpell(me, SPELL_NETHERBEAM_AURA1, true); - for (uint8 i = 0; i < 2; ++i) - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, triggersPos[i+2], TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_NETHERBEAM1+i, false); - break; - case EVENT_SCENE_5: - me->SetTarget(0); - me->CastSpell(me, SPELL_GROW, true); - me->CastSpell(me, SPELL_KAEL_EXPLODES3, true); - me->CastSpell(me, SPELL_NETHERBEAM_AURA2, true); - for (uint8 i = 0; i < 2; ++i) - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, triggersPos[i+4], TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_NETHERBEAM1+i, false); - break; - case EVENT_SCENE_6: - me->CastSpell(me, SPELL_GROW, true); - me->CastSpell(me, SPELL_KAEL_EXPLODES4, true); - me->CastSpell(me, SPELL_NETHERBEAM_AURA3, true); - break; - case EVENT_SCENE_7: - SetRoomState(GO_STATE_ACTIVE); - me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER|MOVEMENTFLAG_WALKING|MOVEMENTFLAG_DISABLE_GRAVITY); - me->SendMovementFlagUpdate(); - break; - case EVENT_SCENE_8: - summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveAurasDueToSpell(SPELL_NETHERBEAM_AURA1); - me->RemoveAurasDueToSpell(SPELL_NETHERBEAM_AURA2); - me->RemoveAurasDueToSpell(SPELL_NETHERBEAM_AURA3); - me->CastSpell(me, SPELL_KAEL_EXPLODES5, true); - me->CastSpell(me, SPELL_FLOATING_DROWNED, false); - //me->CastSpell(me, SPELL_KEAL_STUNNED, true); - break; - case EVENT_SCENE_9: - me->CastSpell(me, 52241, true); // WRONG VISUAL, ZOMG! - me->CastSpell(me, 34807, true); - me->SummonCreature(NPC_WORLD_TRIGGER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()+5, me->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM1, true); - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()-5, me->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM2, true); - break; - case EVENT_SCENE_10: - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM3, true); - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()+5, me->GetPositionY()+5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM1, true); - break; - case EVENT_SCENE_11: - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX(), me->GetPositionY()+5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM2, true); - break; - case EVENT_SCENE_12: - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX(), me->GetPositionY()-5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM3, true); - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()+5, me->GetPositionY()-5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM1, true); - break; - case EVENT_SCENE_13: - if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()-5, me->GetPositionY()+5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) - trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM2, true); - break; - case EVENT_SCENE_14: - //if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()-5, me->GetPositionY()+5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) - // trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM3, true); - break; - case EVENT_SCENE_15: - me->RemoveAurasDueToSpell(SPELL_FLOATING_DROWNED); - me->RemoveAurasDueToSpell(SPELL_KEAL_STUNNED); - me->CastSpell(me, SPELL_KAEL_FULL_POWER, false); - me->CastSpell(me, 36709, true); - me->CastSpell(me, 36201, true); - me->CastSpell(me, 36290, true); - me->CastSpell(me, 36291, true); - me->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY|MOVEMENTFLAG_WALKING); - me->SendMovementFlagUpdate(); - break; - case EVENT_SCENE_16: - summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveAurasDueToSpell(52241); // WRONG VISUAL, ZOMG! - me->GetMotionMaster()->MovePoint(POINT_START_LAST_PHASE, me->GetHomePosition(), false, true); - break; - } + events2.Reset(); + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_FIREBALL, 1000); + events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 15000); + events.ScheduleEvent(EVENT_SPELL_SUMMON_PHOENIX, 30000); + events.ScheduleEvent(EVENT_SPELL_SEQ_1, 20000); + events.ScheduleEvent(EVENT_SPELL_SEQ_2, 40000); + events.ScheduleEvent(EVENT_SPELL_SEQ_3, 60000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_SCENE_1: + me->SetTarget(0); + me->SetFacingTo(M_PI); + me->SetWalk(true); + Talk(SAY_PHASE5_NUTS); + break; + case EVENT_SCENE_2: + me->SetTarget(0); + me->CastSpell(me, SPELL_KAEL_EXPLODES1, true); + me->CastSpell(me, SPELL_KAEL_GAINING_POWER, false); + me->SetDisableGravity(true); + break; + case EVENT_SCENE_3: + me->SetTarget(0); + for (uint8 i = 0; i < 2; ++i) + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, triggersPos[i], TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_NETHERBEAM1+i, false); + me->GetMotionMaster()->MovePoint(POINT_AIR, me->GetPositionX(), me->GetPositionY(), 76.0f, false, true); + me->CastSpell(me, SPELL_GROW, true); + break; + case EVENT_SCENE_4: + me->SetTarget(0); + me->CastSpell(me, SPELL_GROW, true); + me->CastSpell(me, SPELL_KAEL_EXPLODES2, true); + me->CastSpell(me, SPELL_NETHERBEAM_AURA1, true); + for (uint8 i = 0; i < 2; ++i) + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, triggersPos[i+2], TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_NETHERBEAM1+i, false); + break; + case EVENT_SCENE_5: + me->SetTarget(0); + me->CastSpell(me, SPELL_GROW, true); + me->CastSpell(me, SPELL_KAEL_EXPLODES3, true); + me->CastSpell(me, SPELL_NETHERBEAM_AURA2, true); + for (uint8 i = 0; i < 2; ++i) + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, triggersPos[i+4], TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_NETHERBEAM1+i, false); + break; + case EVENT_SCENE_6: + me->CastSpell(me, SPELL_GROW, true); + me->CastSpell(me, SPELL_KAEL_EXPLODES4, true); + me->CastSpell(me, SPELL_NETHERBEAM_AURA3, true); + break; + case EVENT_SCENE_7: + SetRoomState(GO_STATE_ACTIVE); + me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER|MOVEMENTFLAG_WALKING|MOVEMENTFLAG_DISABLE_GRAVITY); + me->SendMovementFlagUpdate(); + break; + case EVENT_SCENE_8: + summons.DespawnEntry(WORLD_TRIGGER); + me->RemoveAurasDueToSpell(SPELL_NETHERBEAM_AURA1); + me->RemoveAurasDueToSpell(SPELL_NETHERBEAM_AURA2); + me->RemoveAurasDueToSpell(SPELL_NETHERBEAM_AURA3); + me->CastSpell(me, SPELL_KAEL_EXPLODES5, true); + me->CastSpell(me, SPELL_FLOATING_DROWNED, false); + //me->CastSpell(me, SPELL_KEAL_STUNNED, true); + break; + case EVENT_SCENE_9: + me->CastSpell(me, 52241, true); // WRONG VISUAL, ZOMG! + me->CastSpell(me, 34807, true); + me->SummonCreature(NPC_WORLD_TRIGGER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()+5, me->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM1, true); + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()-5, me->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM2, true); + break; + case EVENT_SCENE_10: + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM3, true); + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()+5, me->GetPositionY()+5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM1, true); + break; + case EVENT_SCENE_11: + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX(), me->GetPositionY()+5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM2, true); + break; + case EVENT_SCENE_12: + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX(), me->GetPositionY()-5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM3, true); + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()+5, me->GetPositionY()-5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM1, true); + break; + case EVENT_SCENE_13: + if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()-5, me->GetPositionY()+5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) + trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM2, true); + break; + case EVENT_SCENE_14: + //if (Creature* trigger = me->SummonCreature(WORLD_TRIGGER, me->GetPositionX()-5, me->GetPositionY()+5, me->GetPositionZ()+15.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000)) + // trigger->CastSpell(me, SPELL_PURE_NETHER_BEAM3, true); + break; + case EVENT_SCENE_15: + me->RemoveAurasDueToSpell(SPELL_FLOATING_DROWNED); + me->RemoveAurasDueToSpell(SPELL_KEAL_STUNNED); + me->CastSpell(me, SPELL_KAEL_FULL_POWER, false); + me->CastSpell(me, 36709, true); + me->CastSpell(me, 36201, true); + me->CastSpell(me, 36290, true); + me->CastSpell(me, 36291, true); + me->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY|MOVEMENTFLAG_WALKING); + me->SendMovementFlagUpdate(); + break; + case EVENT_SCENE_16: + summons.DespawnEntry(WORLD_TRIGGER); + me->RemoveAurasDueToSpell(52241); // WRONG VISUAL, ZOMG! + me->GetMotionMaster()->MovePoint(POINT_START_LAST_PHASE, me->GetHomePosition(), false, true); + break; + } - if (!events2.Empty()) - return; + if (!events2.Empty()) + return; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_SEQ_1: - events.ScheduleEvent(EVENT_SPELL_MIND_CONTROL, 0); - events.ScheduleEvent(EVENT_SPELL_ARCANE_DISRUPTION, 3000); - events.ScheduleEvent(EVENT_SPELL_SEQ_1, 50000); - break; - case EVENT_SPELL_SEQ_2: - events.ScheduleEvent(EVENT_SPELL_MIND_CONTROL, 3000); - events.ScheduleEvent(EVENT_SPELL_ARCANE_DISRUPTION, 6000); - events.ScheduleEvent(EVENT_SPELL_SEQ_2, 50000); - break; - case EVENT_SPELL_SEQ_3: - Talk(SAY_PYROBLAST); - me->CastSpell(me, SPELL_SHOCK_BARRIER, false); - events.ScheduleEvent(EVENT_SPELL_SEQ_3, 50000); - events.DelayEvents(10000); - events.ScheduleEvent(EVENT_SPELL_PYROBLAST, 0); - events.ScheduleEvent(EVENT_SPELL_PYROBLAST, 4000); - events.ScheduleEvent(EVENT_SPELL_PYROBLAST, 8000); - break; - case EVENT_SPELL_SHOCK_BARRIER: - me->CastSpell(me, SPELL_SHOCK_BARRIER, false); - break; - case EVENT_SPELL_FIREBALL: - me->CastSpell(me->GetVictim(), SPELL_FIREBALL, false); - events.ScheduleEvent(EVENT_SPELL_FIREBALL, roll_chance_i(70) ? 2000: 4000); - break; - case EVENT_SPELL_PYROBLAST: - me->CastSpell(me->GetVictim(), SPELL_PYROBLAST, false); - break; - case EVENT_SPELL_FLAMESTRIKE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - me->CastSpell(target, SPELL_FLAME_STRIKE, false); - events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 20000); - break; - case EVENT_SPELL_ARCANE_DISRUPTION: - me->CastSpell(me, SPELL_ARCANE_DISRUPTION, false); - break; - case EVENT_SPELL_MIND_CONTROL: - if (roll_chance_i(50)) - Talk(SAY_MINDCONTROL); - me->CastCustomSpell(SPELL_MIND_CONTROL, SPELLVALUE_MAX_TARGETS, 3, me, false); - break; - case EVENT_SPELL_SUMMON_PHOENIX: - Talk(SAY_SUMMON_PHOENIX); - me->CastSpell(me, SPELL_PHOENIX, false); - events.ScheduleEvent(EVENT_SPELL_SUMMON_PHOENIX, 40000); - break; - case EVENT_CHECK_HEALTH: - if (me->HealthBelowPct(51)) - { - events.Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MovePoint(POINT_MIDDLE, me->GetHomePosition(), true, true); - me->ClearUnitState(UNIT_STATE_MELEE_ATTACKING); - me->SendMeleeAttackStop(); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - case EVENT_SPELL_GRAVITY_LAPSE: - events.DelayEvents(30000); - me->setAttackTimer(BASE_ATTACK, 30000); - events.ScheduleEvent(EVENT_SPELL_GRAVITY_LAPSE, 90000); - events.ScheduleEvent(EVENT_GRAVITY_LAPSE_END, 32000); - events.ScheduleEvent(EVENT_SPELL_SHOCK_BARRIER, 20000); - events.ScheduleEvent(EVENT_SPELL_SHOCK_BARRIER, 10000); - events.ScheduleEvent(EVENT_SPELL_NETHER_BEAM, 4000); - events.ScheduleEvent(EVENT_SPELL_NETHER_VAPOR, 0); - me->CastSpell(me, SPELL_SHOCK_BARRIER, false); - me->CastSpell(me, SPELL_GRAVITY_LAPSE, false); - me->SetTarget(0); - me->GetMotionMaster()->Clear(); - me->StopMoving(); - Talk(SAY_GRAVITYLAPSE); - break; - case EVENT_SPELL_NETHER_VAPOR: - me->CastSpell(me, SPELL_SUMMON_NETHER_VAPOR, false); - break; - case EVENT_SPELL_NETHER_BEAM: - me->CastSpell(me, SPELL_NETHER_BEAM, false); - events.ScheduleEvent(EVENT_SPELL_NETHER_BEAM, 4000); - break; - case EVENT_GRAVITY_LAPSE_END: - summons.DespawnEntry(NPC_NETHER_VAPOR); - events.CancelEvent(EVENT_SPELL_NETHER_BEAM); - me->SetTarget(me->GetVictim()->GetGUID()); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_SEQ_1: + events.ScheduleEvent(EVENT_SPELL_MIND_CONTROL, 0); + events.ScheduleEvent(EVENT_SPELL_ARCANE_DISRUPTION, 3000); + events.ScheduleEvent(EVENT_SPELL_SEQ_1, 50000); + break; + case EVENT_SPELL_SEQ_2: + events.ScheduleEvent(EVENT_SPELL_MIND_CONTROL, 3000); + events.ScheduleEvent(EVENT_SPELL_ARCANE_DISRUPTION, 6000); + events.ScheduleEvent(EVENT_SPELL_SEQ_2, 50000); + break; + case EVENT_SPELL_SEQ_3: + Talk(SAY_PYROBLAST); + me->CastSpell(me, SPELL_SHOCK_BARRIER, false); + events.ScheduleEvent(EVENT_SPELL_SEQ_3, 50000); + events.DelayEvents(10000); + events.ScheduleEvent(EVENT_SPELL_PYROBLAST, 0); + events.ScheduleEvent(EVENT_SPELL_PYROBLAST, 4000); + events.ScheduleEvent(EVENT_SPELL_PYROBLAST, 8000); + break; + case EVENT_SPELL_SHOCK_BARRIER: + me->CastSpell(me, SPELL_SHOCK_BARRIER, false); + break; + case EVENT_SPELL_FIREBALL: + me->CastSpell(me->GetVictim(), SPELL_FIREBALL, false); + events.ScheduleEvent(EVENT_SPELL_FIREBALL, roll_chance_i(70) ? 2000: 4000); + break; + case EVENT_SPELL_PYROBLAST: + me->CastSpell(me->GetVictim(), SPELL_PYROBLAST, false); + break; + case EVENT_SPELL_FLAMESTRIKE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + me->CastSpell(target, SPELL_FLAME_STRIKE, false); + events.ScheduleEvent(EVENT_SPELL_FLAMESTRIKE, 20000); + break; + case EVENT_SPELL_ARCANE_DISRUPTION: + me->CastSpell(me, SPELL_ARCANE_DISRUPTION, false); + break; + case EVENT_SPELL_MIND_CONTROL: + if (roll_chance_i(50)) + Talk(SAY_MINDCONTROL); + me->CastCustomSpell(SPELL_MIND_CONTROL, SPELLVALUE_MAX_TARGETS, 3, me, false); + break; + case EVENT_SPELL_SUMMON_PHOENIX: + Talk(SAY_SUMMON_PHOENIX); + me->CastSpell(me, SPELL_PHOENIX, false); + events.ScheduleEvent(EVENT_SPELL_SUMMON_PHOENIX, 40000); + break; + case EVENT_CHECK_HEALTH: + if (me->HealthBelowPct(51)) + { + events.Reset(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MovePoint(POINT_MIDDLE, me->GetHomePosition(), true, true); + me->ClearUnitState(UNIT_STATE_MELEE_ATTACKING); + me->SendMeleeAttackStop(); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + case EVENT_SPELL_GRAVITY_LAPSE: + events.DelayEvents(30000); + me->setAttackTimer(BASE_ATTACK, 30000); + events.ScheduleEvent(EVENT_SPELL_GRAVITY_LAPSE, 90000); + events.ScheduleEvent(EVENT_GRAVITY_LAPSE_END, 32000); + events.ScheduleEvent(EVENT_SPELL_SHOCK_BARRIER, 20000); + events.ScheduleEvent(EVENT_SPELL_SHOCK_BARRIER, 10000); + events.ScheduleEvent(EVENT_SPELL_NETHER_BEAM, 4000); + events.ScheduleEvent(EVENT_SPELL_NETHER_VAPOR, 0); + me->CastSpell(me, SPELL_SHOCK_BARRIER, false); + me->CastSpell(me, SPELL_GRAVITY_LAPSE, false); + me->SetTarget(0); + me->GetMotionMaster()->Clear(); + me->StopMoving(); + Talk(SAY_GRAVITYLAPSE); + break; + case EVENT_SPELL_NETHER_VAPOR: + me->CastSpell(me, SPELL_SUMMON_NETHER_VAPOR, false); + break; + case EVENT_SPELL_NETHER_BEAM: + me->CastSpell(me, SPELL_NETHER_BEAM, false); + events.ScheduleEvent(EVENT_SPELL_NETHER_BEAM, 4000); + break; + case EVENT_GRAVITY_LAPSE_END: + summons.DespawnEntry(NPC_NETHER_VAPOR); + events.CancelEvent(EVENT_SPELL_NETHER_BEAM); + me->SetTarget(me->GetVictim()->GetGUID()); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + break; + } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); } - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetHomePosition().GetExactDist2d(me) > 165.0f || !SelectTargetFromPlayerList(165.0f); - } + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetHomePosition().GetExactDist2d(me) > 165.0f || !SelectTargetFromPlayerList(165.0f); + } }; CreatureAI* GetAI(Creature* creature) const @@ -723,11 +723,11 @@ class spell_kaelthas_kael_phase_two : public SpellScriptLoader bool Load() { - if (GetCaster()->GetTypeId() == TYPEID_UNIT) - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (Creature* kael = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_KAELTHAS))) - kael->AI()->SummonedCreatureDies(GetCaster()->ToCreature(), NULL); - return true; + if (GetCaster()->GetTypeId() == TYPEID_UNIT) + if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + if (Creature* kael = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(NPC_KAELTHAS))) + kael->AI()->SummonedCreatureDies(GetCaster()->ToCreature(), NULL); + return true; } void Register() @@ -753,8 +753,8 @@ class spell_kaelthas_remote_toy : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - if (roll_chance_i(66)) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_REMOTE_TOY_STUN, true); + if (roll_chance_i(66)) + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_REMOTE_TOY_STUN, true); } void Register() @@ -780,9 +780,9 @@ class spell_kaelthas_summon_weapons : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitEffect(effIndex); - for (uint32 i = SPELL_SUMMON_WEAPONA; i <= SPELL_SUMMON_WEAPONG; ++i) - GetCaster()->CastSpell(GetCaster(), i, true); + PreventHitEffect(effIndex); + for (uint32 i = SPELL_SUMMON_WEAPONA; i <= SPELL_SUMMON_WEAPONG; ++i) + GetCaster()->CastSpell(GetCaster(), i, true); } void Register() @@ -799,28 +799,28 @@ class spell_kaelthas_summon_weapons : public SpellScriptLoader class spell_kaelthas_resurrection : public SpellScriptLoader { - public: - spell_kaelthas_resurrection() : SpellScriptLoader("spell_kaelthas_resurrection") { } + public: + spell_kaelthas_resurrection() : SpellScriptLoader("spell_kaelthas_resurrection") { } - class spell_kaelthas_resurrection_SpellScript : public SpellScript - { - PrepareSpellScript(spell_kaelthas_resurrection_SpellScript); + class spell_kaelthas_resurrection_SpellScript : public SpellScript + { + PrepareSpellScript(spell_kaelthas_resurrection_SpellScript); - void HandleBeforeCast() - { - GetCaster()->GetAI()->SetData(DATA_RESURRECT_CAST, DATA_RESURRECT_CAST); - } + void HandleBeforeCast() + { + GetCaster()->GetAI()->SetData(DATA_RESURRECT_CAST, DATA_RESURRECT_CAST); + } - void Register() - { - BeforeCast += SpellCastFn(spell_kaelthas_resurrection_SpellScript::HandleBeforeCast); - } - }; + void Register() + { + BeforeCast += SpellCastFn(spell_kaelthas_resurrection_SpellScript::HandleBeforeCast); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_kaelthas_resurrection_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_kaelthas_resurrection_SpellScript(); + } }; class spell_kaelthas_mind_control : public SpellScriptLoader @@ -828,14 +828,14 @@ class spell_kaelthas_mind_control : public SpellScriptLoader public: spell_kaelthas_mind_control() : SpellScriptLoader("spell_kaelthas_mind_control") { } - class spell_kaelthas_mind_control_SpellScript : public SpellScript + class spell_kaelthas_mind_control_SpellScript : public SpellScript { PrepareSpellScript(spell_kaelthas_mind_control_SpellScript); void SelectTarget(std::list& targets) { - if (Unit* victim = GetCaster()->GetVictim()) - targets.remove_if(Trinity::ObjectGUIDCheck(victim->GetGUID(), true)); + if (Unit* victim = GetCaster()->GetVictim()) + targets.remove_if(Trinity::ObjectGUIDCheck(victim->GetGUID(), true)); } void Register() @@ -861,7 +861,7 @@ class spell_kaelthas_burn : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { - Unit::DealDamage(GetUnitOwner(), GetUnitOwner(), GetUnitOwner()->CountPctFromMaxHealth(5)+1); + Unit::DealDamage(GetUnitOwner(), GetUnitOwner(), GetUnitOwner()->CountPctFromMaxHealth(5)+1); } void Register() @@ -878,35 +878,35 @@ class spell_kaelthas_burn : public SpellScriptLoader class spell_kaelthas_flame_strike : public SpellScriptLoader { - public: - spell_kaelthas_flame_strike() : SpellScriptLoader("spell_kaelthas_flame_strike") { } + public: + spell_kaelthas_flame_strike() : SpellScriptLoader("spell_kaelthas_flame_strike") { } - class spell_kaelthas_flame_strike_AuraScript : public AuraScript - { - PrepareAuraScript(spell_kaelthas_flame_strike_AuraScript); + class spell_kaelthas_flame_strike_AuraScript : public AuraScript + { + PrepareAuraScript(spell_kaelthas_flame_strike_AuraScript); - bool Load() - { - return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; - } + bool Load() + { + return GetUnitOwner()->GetTypeId() == TYPEID_UNIT; + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->RemoveAllAuras(); - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FLAME_STRIKE_DAMAGE, true); - GetUnitOwner()->ToCreature()->DespawnOrUnsummon(2000); - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->RemoveAllAuras(); + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_FLAME_STRIKE_DAMAGE, true); + GetUnitOwner()->ToCreature()->DespawnOrUnsummon(2000); + } - void Register() - { - OnEffectRemove += AuraEffectRemoveFn(spell_kaelthas_flame_strike_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_kaelthas_flame_strike_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_kaelthas_flame_strike_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_kaelthas_flame_strike_AuraScript(); + } }; class lapseTeleport : public BasicEvent @@ -918,13 +918,13 @@ class lapseTeleport : public BasicEvent bool Execute(uint64 /*execTime*/, uint32 /*diff*/) { - if (_owner->IsBeingTeleportedNear()) - _owner->m_Events.AddEvent(new lapseTeleport(_owner), _owner->m_Events.CalculateTime(1)); - else if (!_owner->IsBeingTeleported()) - { - _owner->CastSpell(_owner, SPELL_GRAVITY_LAPSE_KNOCKBACK, true); - _owner->CastSpell(_owner, SPELL_GRAVITY_LAPSE_AURA, true); - } + if (_owner->IsBeingTeleportedNear()) + _owner->m_Events.AddEvent(new lapseTeleport(_owner), _owner->m_Events.CalculateTime(1)); + else if (!_owner->IsBeingTeleported()) + { + _owner->CastSpell(_owner, SPELL_GRAVITY_LAPSE_KNOCKBACK, true); + _owner->CastSpell(_owner, SPELL_GRAVITY_LAPSE_AURA, true); + } return true; } @@ -941,21 +941,21 @@ class spell_kaelthas_gravity_lapse : public SpellScriptLoader { PrepareSpellScript(spell_kaelthas_gravity_lapse_SpellScript); - bool Load() - { - _currentSpellId = SPELL_GRAVITY_LAPSE_TELEPORT1; - return true; - } + bool Load() + { + _currentSpellId = SPELL_GRAVITY_LAPSE_TELEPORT1; + return true; + } void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitEffect(effIndex); - if (_currentSpellId < SPELL_GRAVITY_LAPSE_TELEPORT1+25) - if (Player* target = GetHitPlayer()) - { - GetCaster()->CastSpell(target, _currentSpellId++, true); - target->m_Events.AddEvent(new lapseTeleport(target), target->m_Events.CalculateTime(1)); - } + PreventHitEffect(effIndex); + if (_currentSpellId < SPELL_GRAVITY_LAPSE_TELEPORT1+25) + if (Player* target = GetHitPlayer()) + { + GetCaster()->CastSpell(target, _currentSpellId++, true); + target->m_Events.AddEvent(new lapseTeleport(target), target->m_Events.CalculateTime(1)); + } } void Register() @@ -963,8 +963,8 @@ class spell_kaelthas_gravity_lapse : public SpellScriptLoader OnEffectHitTarget += SpellEffectFn(spell_kaelthas_gravity_lapse_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } - private: - uint32 _currentSpellId; + private: + uint32 _currentSpellId; }; SpellScript* GetSpellScript() const @@ -984,10 +984,10 @@ class spell_kaelthas_nether_beam : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitEffect(effIndex); - - ThreatContainer::StorageType const & ThreatList = GetCaster()-> getThreatManager().getThreatList(); - std::list targetList; + PreventHitEffect(effIndex); + + ThreatContainer::StorageType const & ThreatList = GetCaster()-> getThreatManager().getThreatList(); + std::list targetList; for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) { Unit* target = ObjectAccessor::GetUnit(*GetCaster(), (*itr)->getUnitGuid()); @@ -995,9 +995,9 @@ class spell_kaelthas_nether_beam : public SpellScriptLoader targetList.push_back(target); } - Trinity::Containers::RandomResizeList(targetList, 5); - for (std::list::const_iterator itr = targetList.begin(); itr != targetList.end(); ++itr) - GetCaster()->CastSpell(*itr, SPELL_NETHER_BEAM_DAMAGE, true); + Trinity::Containers::RandomResizeList(targetList, 5); + for (std::list::const_iterator itr = targetList.begin(); itr != targetList.end(); ++itr) + GetCaster()->CastSpell(*itr, SPELL_NETHER_BEAM_DAMAGE, true); } void Register() @@ -1023,9 +1023,9 @@ class spell_kaelthas_summon_nether_vapor : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitEffect(effIndex); - for (uint32 i = 0; i < 5; ++i) - GetCaster()->SummonCreature(NPC_NETHER_VAPOR, GetCaster()->GetPositionX()+6*cos(i/5.0f*2*M_PI), GetCaster()->GetPositionY()+6*sin(i/5.0f*2*M_PI), GetCaster()->GetPositionZ()+7.0f+i, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 30000); + PreventHitEffect(effIndex); + for (uint32 i = 0; i < 5; ++i) + GetCaster()->SummonCreature(NPC_NETHER_VAPOR, GetCaster()->GetPositionX()+6*cos(i/5.0f*2*M_PI), GetCaster()->GetPositionY()+6*sin(i/5.0f*2*M_PI), GetCaster()->GetPositionZ()+7.0f+i, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 30000); } void Register() @@ -1043,14 +1043,14 @@ class spell_kaelthas_summon_nether_vapor : public SpellScriptLoader void AddSC_boss_kaelthas() { new boss_kaelthas(); - new spell_kaelthas_kael_phase_two(); - new spell_kaelthas_remote_toy(); - new spell_kaelthas_summon_weapons(); - new spell_kaelthas_resurrection(); - new spell_kaelthas_mind_control(); - new spell_kaelthas_burn(); - new spell_kaelthas_flame_strike(); - new spell_kaelthas_gravity_lapse(); - new spell_kaelthas_nether_beam(); - new spell_kaelthas_summon_nether_vapor(); + new spell_kaelthas_kael_phase_two(); + new spell_kaelthas_remote_toy(); + new spell_kaelthas_summon_weapons(); + new spell_kaelthas_resurrection(); + new spell_kaelthas_mind_control(); + new spell_kaelthas_burn(); + new spell_kaelthas_flame_strike(); + new spell_kaelthas_gravity_lapse(); + new spell_kaelthas_nether_beam(); + new spell_kaelthas_summon_nether_vapor(); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp index b09f58c63..1b658be00 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp @@ -18,10 +18,10 @@ enum voidReaver SPELL_KNOCK_AWAY = 25778, SPELL_BERSERK = 26662, - EVENT_SPELL_POUNDING = 1, - EVENT_SPELL_ARCANEORB = 2, - EVENT_SPELL_KNOCK_AWAY = 3, - EVENT_SPELL_BERSERK = 4 + EVENT_SPELL_POUNDING = 1, + EVENT_SPELL_ARCANEORB = 2, + EVENT_SPELL_KNOCK_AWAY = 3, + EVENT_SPELL_BERSERK = 4 }; class boss_void_reaver : public CreatureScript @@ -34,40 +34,40 @@ class boss_void_reaver : public CreatureScript { boss_void_reaverAI(Creature* creature) : BossAI(creature, DATA_REAVER) { - me->ApplySpellImmune(0, IMMUNITY_DISPEL, DISPEL_POISON, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_HEALTH_LEECH, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_POWER_DRAIN, true); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_PERIODIC_LEECH, true); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_PERIODIC_MANA_LEECH, true); + me->ApplySpellImmune(0, IMMUNITY_DISPEL, DISPEL_POISON, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_HEALTH_LEECH, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_POWER_DRAIN, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_PERIODIC_LEECH, true); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_PERIODIC_MANA_LEECH, true); } void Reset() { - BossAI::Reset(); + BossAI::Reset(); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER && roll_chance_i(50)) + Talk(SAY_SLAY); } void JustDied(Unit* killer) { Talk(SAY_DEATH); - BossAI::JustDied(killer); + BossAI::JustDied(killer); } void EnterCombat(Unit* who) { Talk(SAY_AGGRO); - BossAI::EnterCombat(who); + BossAI::EnterCombat(who); - events.ScheduleEvent(EVENT_SPELL_POUNDING, 15000); - events.ScheduleEvent(EVENT_SPELL_ARCANEORB, 3000); - events.ScheduleEvent(EVENT_SPELL_KNOCK_AWAY, 30000); - events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); - me->CallForHelp(105.0f); + events.ScheduleEvent(EVENT_SPELL_POUNDING, 15000); + events.ScheduleEvent(EVENT_SPELL_ARCANEORB, 3000); + events.ScheduleEvent(EVENT_SPELL_KNOCK_AWAY, 30000); + events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000); + me->CallForHelp(105.0f); } void UpdateAI(uint32 diff) @@ -75,41 +75,41 @@ class boss_void_reaver : public CreatureScript if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_SPELL_POUNDING: - Talk(SAY_POUNDING); - me->CastSpell(me, SPELL_POUNDING, false); - events.ScheduleEvent(EVENT_SPELL_POUNDING, 15000); - break; - case EVENT_SPELL_ARCANEORB: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -18.0f, true)) - me->CastSpell(target, SPELL_ARCANE_ORB, false); - else if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true)) - me->CastSpell(target, SPELL_ARCANE_ORB, false); - events.ScheduleEvent(EVENT_SPELL_ARCANEORB, 4000); - break; - case EVENT_SPELL_KNOCK_AWAY: - me->CastSpell(me->GetVictim(), SPELL_KNOCK_AWAY, false); - events.ScheduleEvent(EVENT_SPELL_POUNDING, 25000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_SPELL_POUNDING: + Talk(SAY_POUNDING); + me->CastSpell(me, SPELL_POUNDING, false); + events.ScheduleEvent(EVENT_SPELL_POUNDING, 15000); + break; + case EVENT_SPELL_ARCANEORB: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -18.0f, true)) + me->CastSpell(target, SPELL_ARCANE_ORB, false); + else if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true)) + me->CastSpell(target, SPELL_ARCANE_ORB, false); + events.ScheduleEvent(EVENT_SPELL_ARCANEORB, 4000); + break; + case EVENT_SPELL_KNOCK_AWAY: + me->CastSpell(me->GetVictim(), SPELL_KNOCK_AWAY, false); + events.ScheduleEvent(EVENT_SPELL_POUNDING, 25000); + break; + } DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(); } - - bool CheckEvadeIfOutOfCombatArea() const - { - return me->GetDistance2d(432.59f, 371.93f) > 105.0f; - } + + bool CheckEvadeIfOutOfCombatArea() const + { + return me->GetDistance2d(432.59f, 371.93f) > 105.0f; + } }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp index 413c514cf..4c94162e1 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp @@ -20,79 +20,79 @@ class instance_the_eye : public InstanceMapScript uint64 GrandAstromancerCapernianGUID; uint64 MasterEngineerTelonicusGUID; uint64 AlarGUID; - uint64 KaelthasGUID; - uint64 BridgeWindowGUID; - uint64 KaelStateRightGUID; - uint64 KaelStateLeftGUID; + uint64 KaelthasGUID; + uint64 BridgeWindowGUID; + uint64 KaelStateRightGUID; + uint64 KaelStateLeftGUID; void Initialize() { - SetBossNumber(MAX_ENCOUNTER); - AlarGUID = 0; - KaelthasGUID = 0; + SetBossNumber(MAX_ENCOUNTER); + AlarGUID = 0; + KaelthasGUID = 0; ThaladredTheDarkenerGUID = 0; LordSanguinarGUID = 0; GrandAstromancerCapernianGUID = 0; MasterEngineerTelonicusGUID = 0; - BridgeWindowGUID = 0; - KaelStateRightGUID = 0; - KaelStateLeftGUID = 0; + BridgeWindowGUID = 0; + KaelStateRightGUID = 0; + KaelStateLeftGUID = 0; } void OnCreatureCreate(Creature* creature) { switch (creature->GetEntry()) { - case NPC_ALAR: - AlarGUID = creature->GetGUID(); - break; - case NPC_KAELTHAS: - KaelthasGUID = creature->GetGUID(); - break; - case NPC_THALADRED: - ThaladredTheDarkenerGUID = creature->GetGUID(); - break; - case NPC_TELONICUS: - MasterEngineerTelonicusGUID = creature->GetGUID(); - break; - case NPC_CAPERNIAN: - GrandAstromancerCapernianGUID = creature->GetGUID(); - break; - case NPC_LORD_SANGUINAR: - LordSanguinarGUID = creature->GetGUID(); - break; + case NPC_ALAR: + AlarGUID = creature->GetGUID(); + break; + case NPC_KAELTHAS: + KaelthasGUID = creature->GetGUID(); + break; + case NPC_THALADRED: + ThaladredTheDarkenerGUID = creature->GetGUID(); + break; + case NPC_TELONICUS: + MasterEngineerTelonicusGUID = creature->GetGUID(); + break; + case NPC_CAPERNIAN: + GrandAstromancerCapernianGUID = creature->GetGUID(); + break; + case NPC_LORD_SANGUINAR: + LordSanguinarGUID = creature->GetGUID(); + break; } } - void OnGameObjectCreate(GameObject* gobject) - { - switch (gobject->GetEntry()) - { - case GO_BRIDGE_WINDOW: - BridgeWindowGUID = gobject->GetGUID(); - break; - case GO_KAEL_STATUE_RIGHT: - KaelStateRightGUID = gobject->GetGUID(); - break; - case GO_KAEL_STATUE_LEFT: - KaelStateLeftGUID = gobject->GetGUID(); - break; - } - } + void OnGameObjectCreate(GameObject* gobject) + { + switch (gobject->GetEntry()) + { + case GO_BRIDGE_WINDOW: + BridgeWindowGUID = gobject->GetGUID(); + break; + case GO_KAEL_STATUE_RIGHT: + KaelStateRightGUID = gobject->GetGUID(); + break; + case GO_KAEL_STATUE_LEFT: + KaelStateLeftGUID = gobject->GetGUID(); + break; + } + } uint64 GetData64(uint32 identifier) const { switch (identifier) { - case GO_BRIDGE_WINDOW: return BridgeWindowGUID; - case GO_KAEL_STATUE_RIGHT: return KaelStateRightGUID; - case GO_KAEL_STATUE_LEFT: return KaelStateLeftGUID; - case NPC_ALAR: return AlarGUID; - case NPC_KAELTHAS: return KaelthasGUID; - case DATA_KAEL_ADVISOR1: return ThaladredTheDarkenerGUID; - case DATA_KAEL_ADVISOR2: return LordSanguinarGUID; - case DATA_KAEL_ADVISOR3: return GrandAstromancerCapernianGUID; - case DATA_KAEL_ADVISOR4: return MasterEngineerTelonicusGUID; + case GO_BRIDGE_WINDOW: return BridgeWindowGUID; + case GO_KAEL_STATUE_RIGHT: return KaelStateRightGUID; + case GO_KAEL_STATUE_LEFT: return KaelStateLeftGUID; + case NPC_ALAR: return AlarGUID; + case NPC_KAELTHAS: return KaelthasGUID; + case DATA_KAEL_ADVISOR1: return ThaladredTheDarkenerGUID; + case DATA_KAEL_ADVISOR2: return LordSanguinarGUID; + case DATA_KAEL_ADVISOR3: return GrandAstromancerCapernianGUID; + case DATA_KAEL_ADVISOR4: return MasterEngineerTelonicusGUID; } return 0; } @@ -139,7 +139,7 @@ class instance_the_eye : public InstanceMapScript OUT_LOAD_INST_DATA_COMPLETE; } - }; + }; InstanceScript* GetInstanceScript(InstanceMap* map) const { @@ -156,11 +156,11 @@ class spell_the_eye_countercharge : public SpellScriptLoader { PrepareAuraScript(spell_the_eye_counterchargeScript); - bool PrepareProc(ProcEventInfo& eventInfo) + bool PrepareProc(ProcEventInfo& eventInfo) { - // xinef: prevent charge drop - PreventDefaultAction(); - return true; + // xinef: prevent charge drop + PreventDefaultAction(); + return true; } void Register() @@ -178,5 +178,5 @@ class spell_the_eye_countercharge : public SpellScriptLoader void AddSC_instance_the_eye() { new instance_the_eye(); - new spell_the_eye_countercharge(); + new spell_the_eye_countercharge(); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h index 0da15938b..12d300789 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h +++ b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h @@ -7,33 +7,33 @@ REWRITTEN BY XINEF enum EyeData { - DATA_ALAR = 0, - DATA_ASTROMANCER = 1, - DATA_REAVER = 2, - DATA_KAELTHAS = 3, - MAX_ENCOUNTER = 4, + DATA_ALAR = 0, + DATA_ASTROMANCER = 1, + DATA_REAVER = 2, + DATA_KAELTHAS = 3, + MAX_ENCOUNTER = 4, - DATA_KAEL_ADVISOR1 = 10, - DATA_KAEL_ADVISOR2 = 11, - DATA_KAEL_ADVISOR3 = 12, - DATA_KAEL_ADVISOR4 = 13 + DATA_KAEL_ADVISOR1 = 10, + DATA_KAEL_ADVISOR2 = 11, + DATA_KAEL_ADVISOR3 = 12, + DATA_KAEL_ADVISOR4 = 13 }; enum EyeNPCs { - NPC_ALAR = 19514, - NPC_KAELTHAS = 19622, - NPC_THALADRED = 20064, - NPC_LORD_SANGUINAR = 20060, - NPC_CAPERNIAN = 20062, - NPC_TELONICUS = 20063 + NPC_ALAR = 19514, + NPC_KAELTHAS = 19622, + NPC_THALADRED = 20064, + NPC_LORD_SANGUINAR = 20060, + NPC_CAPERNIAN = 20062, + NPC_TELONICUS = 20063 }; enum EyeGOs { - GO_BRIDGE_WINDOW = 184069, - GO_KAEL_STATUE_RIGHT = 184596, - GO_KAEL_STATUE_LEFT = 184597 + GO_BRIDGE_WINDOW = 184069, + GO_KAEL_STATUE_RIGHT = 184596, + GO_KAEL_STATUE_LEFT = 184597 }; #endif diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp index 1bb221262..3f280b46e 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp @@ -54,8 +54,8 @@ class boss_gatewatcher_gyrokill : public CreatureScript void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void UpdateAI(uint32 diff) @@ -74,8 +74,8 @@ class boss_gatewatcher_gyrokill : public CreatureScript events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, urand(12000, 14000)); break; case EVENT_SAW_BLADE: - if (Unit* target= SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f)) - me->CastSpell(target, SPELL_SAW_BLADE, false); + if (Unit* target= SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f)) + me->CastSpell(target, SPELL_SAW_BLADE, false); Talk(SAY_SAW_BLADE); events.ScheduleEvent(EVENT_SAW_BLADE, 25000); break; diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp index e261eb024..63a5e406d 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp @@ -49,7 +49,7 @@ class boss_gatewatcher_iron_hand : public CreatureScript void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) + if (victim->GetTypeId() == TYPEID_PLAYER) Talk(SAY_SLAY); } @@ -71,17 +71,17 @@ class boss_gatewatcher_iron_hand : public CreatureScript switch (events.ExecuteEvent()) { case EVENT_STREAM_OF_MACHINE_FLUID: - me->CastSpell(me->GetVictim(), SPELL_STREAM_OF_MACHINE_FLUID, false); + me->CastSpell(me->GetVictim(), SPELL_STREAM_OF_MACHINE_FLUID, false); events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 20000); break; case EVENT_JACKHAMMER: Talk(EMOTE_HAMMER); Talk(SAY_HAMMER); - me->CastSpell(me, SPELL_JACKHAMMER, false); + me->CastSpell(me, SPELL_JACKHAMMER, false); events.ScheduleEvent(EVENT_JACKHAMMER, 40000); break; case EVENT_SHADOW_POWER: - me->CastSpell(me, SPELL_SHADOW_POWER, false); + me->CastSpell(me, SPELL_SHADOW_POWER, false); events.ScheduleEvent(EVENT_SHADOW_POWER, 25000); break; default: diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp index 603f056dc..7988a442e 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp @@ -57,13 +57,13 @@ class boss_mechano_lord_capacitus : public CreatureScript events.ScheduleEvent(EVENT_HEADCRACK, 6000); events.ScheduleEvent(EVENT_SUMMON_NETHER_CHARGE, 10000); events.ScheduleEvent(EVENT_BERSERK, 180000); - events.ScheduleEvent(IsHeroic() ? EVENT_POSITIVE_SHIFT : EVENT_REFLECTIVE_DAMAGE_SHIELD, 15000); + events.ScheduleEvent(IsHeroic() ? EVENT_POSITIVE_SHIFT : EVENT_REFLECTIVE_DAMAGE_SHIELD, 15000); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(YELL_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(YELL_KILL); } void JustDied(Unit* /*victim*/) @@ -72,11 +72,11 @@ class boss_mechano_lord_capacitus : public CreatureScript Talk(YELL_DEATH); } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - summon->GetMotionMaster()->MoveRandom(30.0f); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->GetMotionMaster()->MoveRandom(30.0f); + } void UpdateAI(uint32 diff) { @@ -90,12 +90,12 @@ class boss_mechano_lord_capacitus : public CreatureScript switch (events.ExecuteEvent()) { case EVENT_HEADCRACK: - me->CastSpell(me->GetVictim(), SPELL_HEADCRACK, false); + me->CastSpell(me->GetVictim(), SPELL_HEADCRACK, false); events.ScheduleEvent(EVENT_HEADCRACK, 20000); break; case EVENT_REFLECTIVE_DAMAGE_SHIELD: Talk(YELL_REFLECTIVE_DAMAGE_SHIELD); - me->CastSpell(me, SPELL_REFLECTIVE_DAMAGE_SHIELD, false); + me->CastSpell(me, SPELL_REFLECTIVE_DAMAGE_SHIELD, false); events.ScheduleEvent(EVENT_REFLECTIVE_MAGIE_SHIELD, 20000); break; case EVENT_REFLECTIVE_MAGIE_SHIELD: @@ -107,14 +107,14 @@ class boss_mechano_lord_capacitus : public CreatureScript Position pos; me->GetRandomNearPosition(pos, 8.0f); me->SummonCreature(NPC_NETHER_CHARGE, pos, TEMPSUMMON_TIMED_DESPAWN, 18000); - events.ScheduleEvent(EVENT_SUMMON_NETHER_CHARGE, 5000); + events.ScheduleEvent(EVENT_SUMMON_NETHER_CHARGE, 5000); break; case EVENT_POSITIVE_SHIFT: - me->CastSpell(me, SPELL_POLARITY_SHIFT, true); + me->CastSpell(me, SPELL_POLARITY_SHIFT, true); events.ScheduleEvent(EVENT_POSITIVE_SHIFT, 30000); break; case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); + me->CastSpell(me, SPELL_BERSERK, true); break; } @@ -159,7 +159,7 @@ class spell_capacitus_polarity_charge : public SpellScriptLoader if (count) { - uint32 spellId = GetSpellInfo()->Id == SPELL_POSITIVE_CHARGE ? SPELL_POSITIVE_CHARGE_STACK : SPELL_NEGATIVE_CHARGE_STACK; + uint32 spellId = GetSpellInfo()->Id == SPELL_POSITIVE_CHARGE ? SPELL_POSITIVE_CHARGE_STACK : SPELL_NEGATIVE_CHARGE_STACK; GetCaster()->SetAuraStack(spellId, GetCaster(), count); } } @@ -198,8 +198,8 @@ class spell_capacitus_polarity_shift : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetHitUnit()) - target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, NULL, NULL, GetCaster()->GetGUID()); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, NULL, NULL, GetCaster()->GetGUID()); } void Register() diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp index 809eef645..32c6d94df 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp @@ -46,39 +46,39 @@ class boss_nethermancer_sepethrea : public CreatureScript events.ScheduleEvent(EVENT_DRAGONS_BREATH, 18000); Talk(SAY_AGGRO); - me->CastSpell(me, SPELL_SUMMON_RAGIN_FLAMES, true); - } + me->CastSpell(me, SPELL_SUMMON_RAGIN_FLAMES, true); + } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - if (Unit* victim = me->GetVictim()) - { - summon->AI()->AttackStart(victim); - summon->AddThreat(victim, 1000.0f); - summon->SetInCombatWithZone(); - } - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + if (Unit* victim = me->GetVictim()) + { + summon->AI()->AttackStart(victim); + summon->AddThreat(victim, 1000.0f); + summon->SetInCombatWithZone(); + } + } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { events.Reset(); - if (instance) - { - instance->SetBossState(DATA_NETHERMANCER_SEPRETHREA, DONE); - instance->SaveToDB(); - } + if (instance) + { + instance->SetBossState(DATA_NETHERMANCER_SEPRETHREA, DONE); + instance->SaveToDB(); + } Talk(SAY_DEATH); - for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) - Unit::Kill(summon, summon); + for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr)) + Unit::Kill(summon, summon); } void UpdateAI(uint32 diff) @@ -93,15 +93,15 @@ class boss_nethermancer_sepethrea : public CreatureScript switch (events.ExecuteEvent()) { case EVENT_FROST_ATTACK: - me->CastSpell(me->GetVictim(), SPELL_FROST_ATTACK, false); + me->CastSpell(me->GetVictim(), SPELL_FROST_ATTACK, false); events.ScheduleEvent(EVENT_FROST_ATTACK, 8000); break; case EVENT_ARCANE_BLAST: - me->CastSpell(me->GetVictim(), SPELL_ARCANE_BLAST, false); + me->CastSpell(me->GetVictim(), SPELL_ARCANE_BLAST, false); events.ScheduleEvent(EVENT_ARCANE_BLAST, 12000); break; case EVENT_DRAGONS_BREATH: - me->CastSpell(me->GetVictim(), SPELL_DRAGONS_BREATH, true); + me->CastSpell(me->GetVictim(), SPELL_DRAGONS_BREATH, true); events.ScheduleEvent(EVENT_DRAGONS_BREATH, 16000); if (roll_chance_i(50)) Talk(SAY_DRAGONS_BREATH); @@ -120,12 +120,12 @@ class boss_nethermancer_sepethrea : public CreatureScript enum raginFlames { - SPELL_INFERNO = 35268, - SPELL_FIRE_TAIL = 35278, - SPELL_INFERNO_DAMAGE = 35283, + SPELL_INFERNO = 35268, + SPELL_FIRE_TAIL = 35278, + SPELL_INFERNO_DAMAGE = 35283, - EVENT_SPELL_FIRE_TAIL = 1, - EVENT_SPELL_INFERNO = 2 + EVENT_SPELL_FIRE_TAIL = 1, + EVENT_SPELL_INFERNO = 2 }; class npc_ragin_flames : public CreatureScript @@ -137,41 +137,41 @@ class npc_ragin_flames : public CreatureScript { npc_ragin_flamesAI(Creature* creature) : ScriptedAI(creature) { } - EventMap events; + EventMap events; void Reset() { me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, true); } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_SPELL_FIRE_TAIL, 500); - events.ScheduleEvent(EVENT_SPELL_INFERNO, urand(10000, 20000)); - } + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_SPELL_FIRE_TAIL, 500); + events.ScheduleEvent(EVENT_SPELL_INFERNO, urand(10000, 20000)); + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_INFERNO: - if (me->IsWithinCombatRange(me->GetVictim(), 5.0f)) - { - me->CastSpell(me, SPELL_INFERNO, true); - events.ScheduleEvent(EVENT_SPELL_INFERNO, 20000); - } - else - events.ScheduleEvent(EVENT_SPELL_INFERNO, 1000); - break; - case EVENT_SPELL_FIRE_TAIL: - me->CastSpell(me, SPELL_FIRE_TAIL, true); - events.ScheduleEvent(EVENT_SPELL_FIRE_TAIL, 500); - break; - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_INFERNO: + if (me->IsWithinCombatRange(me->GetVictim(), 5.0f)) + { + me->CastSpell(me, SPELL_INFERNO, true); + events.ScheduleEvent(EVENT_SPELL_INFERNO, 20000); + } + else + events.ScheduleEvent(EVENT_SPELL_INFERNO, 1000); + break; + case EVENT_SPELL_FIRE_TAIL: + me->CastSpell(me, SPELL_FIRE_TAIL, true); + events.ScheduleEvent(EVENT_SPELL_FIRE_TAIL, 500); + break; + } DoMeleeAttackIfReady(); } @@ -194,8 +194,8 @@ class spell_ragin_flames_inferno : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { - int32 damage = aurEff->GetAmount(); - GetUnitOwner()->CastCustomSpell(SPELL_INFERNO_DAMAGE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetUnitOwner(), TRIGGERED_FULL_MASK); + int32 damage = aurEff->GetAmount(); + GetUnitOwner()->CastCustomSpell(SPELL_INFERNO_DAMAGE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetUnitOwner(), TRIGGERED_FULL_MASK); } void Register() @@ -214,5 +214,5 @@ void AddSC_boss_nethermancer_sepethrea() { new boss_nethermancer_sepethrea(); new npc_ragin_flames(); - new spell_ragin_flames_inferno(); + new spell_ragin_flames_inferno(); } diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp index e04d92038..d34006628 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp @@ -8,36 +8,36 @@ REWRITTEN BY XINEF enum Says { - SAY_AGGRO = 0, - SAY_DOMINATION = 1, - SAY_SUMMON = 2, - SAY_ENRAGE = 3, - SAY_SLAY = 4, - SAY_DEATH = 5, - SAY_APPEAR = 6 + SAY_AGGRO = 0, + SAY_DOMINATION = 1, + SAY_SUMMON = 2, + SAY_ENRAGE = 3, + SAY_SLAY = 4, + SAY_DEATH = 5, + SAY_APPEAR = 6 }; enum Spells { - SPELL_ARCANE_EXPLOSION = 15453, - SPELL_DISGRUNTLED_ANGER = 35289, - SPELL_ARCANE_TORRENT = 36022, - SPELL_MANA_TAP = 36021, - SPELL_DOMINATION = 35280, - SPELL_SUMMON_NETHER_WRAITH_1 = 35285, - SPELL_SUMMON_NETHER_WRAITH_2 = 35286, - SPELL_SUMMON_NETHER_WRAITH_3 = 35287, - SPELL_SUMMON_NETHER_WRAITH_4 = 35288, + SPELL_ARCANE_EXPLOSION = 15453, + SPELL_DISGRUNTLED_ANGER = 35289, + SPELL_ARCANE_TORRENT = 36022, + SPELL_MANA_TAP = 36021, + SPELL_DOMINATION = 35280, + SPELL_SUMMON_NETHER_WRAITH_1 = 35285, + SPELL_SUMMON_NETHER_WRAITH_2 = 35286, + SPELL_SUMMON_NETHER_WRAITH_3 = 35287, + SPELL_SUMMON_NETHER_WRAITH_4 = 35288, }; enum Events { - EVENT_SUMMON = 1, - EVENT_MANA_TAP = 2, - EVENT_ARCANE_TORRENT = 3, - EVENT_DOMINATION = 4, - EVENT_ARCANE_EXPLOSION = 5, - EVENT_FRENZY = 6, + EVENT_SUMMON = 1, + EVENT_MANA_TAP = 2, + EVENT_ARCANE_TORRENT = 3, + EVENT_DOMINATION = 4, + EVENT_ARCANE_EXPLOSION = 5, + EVENT_FRENZY = 6, }; class boss_pathaleon_the_calculator : public CreatureScript @@ -49,21 +49,21 @@ class boss_pathaleon_the_calculator : public CreatureScript { boss_pathaleon_the_calculatorAI(Creature* creature) : BossAI(creature, DATA_PATHALEON_THE_CALCULATOR) { } - void InitializeAI() - { - BossAI::InitializeAI(); - me->SetVisible(false); - me->SetReactState(REACT_PASSIVE); - } + void InitializeAI() + { + BossAI::InitializeAI(); + me->SetVisible(false); + me->SetReactState(REACT_PASSIVE); + } - void DoAction(int32 param) - { - me->SetVisible(true); - me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); - me->SetReactState(REACT_AGGRESSIVE); - Talk(SAY_APPEAR); - } + void DoAction(int32 param) + { + me->SetVisible(true); + me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); + me->SetReactState(REACT_AGGRESSIVE); + Talk(SAY_APPEAR); + } void EnterCombat(Unit* /*who*/) { @@ -73,14 +73,14 @@ class boss_pathaleon_the_calculator : public CreatureScript events.ScheduleEvent(EVENT_ARCANE_TORRENT, 16000); events.ScheduleEvent(EVENT_DOMINATION, 25000); events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, 8000); - events.ScheduleEvent(EVENT_FRENZY, 1000); + events.ScheduleEvent(EVENT_FRENZY, 1000); Talk(SAY_AGGRO); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) @@ -101,39 +101,39 @@ class boss_pathaleon_the_calculator : public CreatureScript switch (events.ExecuteEvent()) { case EVENT_ARCANE_EXPLOSION: - me->CastSpell(me, SPELL_ARCANE_EXPLOSION, false); + me->CastSpell(me, SPELL_ARCANE_EXPLOSION, false); events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, 12000); break; case EVENT_ARCANE_TORRENT: - me->RemoveAurasDueToSpell(SPELL_MANA_TAP); - me->ModifyPower(POWER_MANA, 5000); + me->RemoveAurasDueToSpell(SPELL_MANA_TAP); + me->ModifyPower(POWER_MANA, 5000); me->CastSpell(me, SPELL_ARCANE_TORRENT, false); events.ScheduleEvent(EVENT_ARCANE_TORRENT, 15000); break; case EVENT_MANA_TAP: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, PowerUsersSelector(me, POWER_MANA, 40.0f, false))) - me->CastSpell(target, SPELL_MANA_TAP, false); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, PowerUsersSelector(me, POWER_MANA, 40.0f, false))) + me->CastSpell(target, SPELL_MANA_TAP, false); events.ScheduleEvent(EVENT_MANA_TAP, 18000); break; case EVENT_DOMINATION: Talk(SAY_DOMINATION); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 50.0f)) - me->CastSpell(target, SPELL_DOMINATION, false); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 50.0f)) + me->CastSpell(target, SPELL_DOMINATION, false); events.ScheduleEvent(EVENT_DOMINATION, 30000); break; - case EVENT_FRENZY: - if (me->HealthBelowPct(20)) - { - summons.DespawnAll(); - me->CastSpell(me, SPELL_DISGRUNTLED_ANGER, true); - Talk(SAY_ENRAGE); - break; - } - events.ScheduleEvent(EVENT_FRENZY, 1000); - break; + case EVENT_FRENZY: + if (me->HealthBelowPct(20)) + { + summons.DespawnAll(); + me->CastSpell(me, SPELL_DISGRUNTLED_ANGER, true); + Talk(SAY_ENRAGE); + break; + } + events.ScheduleEvent(EVENT_FRENZY, 1000); + break; case EVENT_SUMMON: for (uint8 i = 0; i < DUNGEON_MODE(3, 4); ++i) - me->CastSpell(me, SPELL_SUMMON_NETHER_WRAITH_1+i, true); + me->CastSpell(me, SPELL_SUMMON_NETHER_WRAITH_1+i, true); Talk(SAY_SUMMON); events.ScheduleEvent(EVENT_SUMMON, urand(30000, 45000)); diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp index f9a95ac07..6f4897bdc 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -26,10 +26,10 @@ class instance_mechanar : public InstanceMapScript SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doorData); - _pathaleonGUID = 0; - _passageEncounter = 0; - _passageTimer = 0; - _passageGUIDs.clear(); + _pathaleonGUID = 0; + _passageEncounter = 0; + _passageTimer = 0; + _passageGUIDs.clear(); } void OnGameObjectCreate(GameObject* gameObject) @@ -60,125 +60,125 @@ class instance_mechanar : public InstanceMapScript } } - void OnCreatureCreate(Creature* creature) - { - if (creature->GetEntry() == NPC_PATHALEON_THE_CALCULATOR) - _pathaleonGUID = creature->GetGUID(); - } + void OnCreatureCreate(Creature* creature) + { + if (creature->GetEntry() == NPC_PATHALEON_THE_CALCULATOR) + _pathaleonGUID = creature->GetGUID(); + } - void OnUnitDeath(Unit* unit) - { - if (unit->GetTypeId() == TYPEID_UNIT) - if (_passageEncounter > ENCOUNTER_PASSAGE_NOT_STARTED && _passageEncounter < ENCOUNTER_PASSAGE_DONE) - if (_passageGUIDs.find(unit->GetGUID()) != _passageGUIDs.end()) - _passageGUIDs.erase(unit->GetGUID()); - } + void OnUnitDeath(Unit* unit) + { + if (unit->GetTypeId() == TYPEID_UNIT) + if (_passageEncounter > ENCOUNTER_PASSAGE_NOT_STARTED && _passageEncounter < ENCOUNTER_PASSAGE_DONE) + if (_passageGUIDs.find(unit->GetGUID()) != _passageGUIDs.end()) + _passageGUIDs.erase(unit->GetGUID()); + } - Player* GetPassagePlayer(float x) - { - Map::PlayerList const& pl = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (Player* player = itr->GetSource()) - if (player->GetPositionX() < x && player->GetPositionZ() > 24.0f && player->GetPositionY() > -30.0f) - return player; - return NULL; - } + Player* GetPassagePlayer(float x) + { + Map::PlayerList const& pl = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (Player* player = itr->GetSource()) + if (player->GetPositionX() < x && player->GetPositionZ() > 24.0f && player->GetPositionY() > -30.0f) + return player; + return NULL; + } - void DoSummonAction(Creature* summon, Player* player) - { - summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); - summon->AI()->AttackStart(player); - _passageGUIDs.insert(summon->GetGUID()); - } + void DoSummonAction(Creature* summon, Player* player) + { + summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true); + summon->AI()->AttackStart(player); + _passageGUIDs.insert(summon->GetGUID()); + } - void Update(uint32 diff) - { - if (_passageEncounter == ENCOUNTER_PASSAGE_DONE) - return; + void Update(uint32 diff) + { + if (_passageEncounter == ENCOUNTER_PASSAGE_DONE) + return; - _passageTimer += diff; - if (_passageTimer >= 1000) - { - _passageTimer = 0; - if (_passageEncounter == ENCOUNTER_PASSAGE_NOT_STARTED) - { - if (Player* player = GetPassagePlayer(250.0f)) - { - _passageEncounter++; - for (uint8 i = 0; i < 4; ++i) - { - Position pos = {238.0f, -27.0f + 3.0f*i, 26.328f, 0.0f}; - if (Creature* creature = instance->SummonCreature(i==1 || i==2 ? NPC_SUNSEEKER_ASTROMAGE : NPC_BLOODWARDER_CENTURION, pos)) - DoSummonAction(creature, player); - } - } - } - - if (!_passageGUIDs.empty()) - return; + _passageTimer += diff; + if (_passageTimer >= 1000) + { + _passageTimer = 0; + if (_passageEncounter == ENCOUNTER_PASSAGE_NOT_STARTED) + { + if (Player* player = GetPassagePlayer(250.0f)) + { + _passageEncounter++; + for (uint8 i = 0; i < 4; ++i) + { + Position pos = {238.0f, -27.0f + 3.0f*i, 26.328f, 0.0f}; + if (Creature* creature = instance->SummonCreature(i==1 || i==2 ? NPC_SUNSEEKER_ASTROMAGE : NPC_BLOODWARDER_CENTURION, pos)) + DoSummonAction(creature, player); + } + } + } + + if (!_passageGUIDs.empty()) + return; - if (_passageEncounter < ENCOUNTER_PASSAGE_PHASE3) - { - if (Player* player = GetPassagePlayer(250.0f)) - { - if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE1) - { - Position pos = {214.37f, -23.5f, 24.88f, 0.0f}; - if (Creature* creature = instance->SummonCreature(NPC_TEMPEST_KEEPER_DESTROYER, pos)) - DoSummonAction(creature, player); - } - else if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE2) - { - for (uint8 i = 0; i < 3; ++i) - { - Position pos = {199.76f, -26.0f + 2.5f*i, 24.88f, 0.0f}; - if (Creature* creature = instance->SummonCreature(i==1 ? NPC_SUNSEEKER_ENGINEER : NPC_BLOODWARDER_PHYSICIAN, pos)) - DoSummonAction(creature, player); - } - } - _passageEncounter++; - SaveToDB(); - } - } - else - { - if (Player* player = GetPassagePlayer(148.0f)) - { - if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE3) - { - for (uint8 i = 0; i < 3; ++i) - { - Position pos = {135.0f + 2.5f*i, 36.76f, 24.88f}; - if (Creature* creature = instance->SummonCreature(i==1 ? NPC_SUNSEEKER_ASTROMAGE : NPC_BLOODWARDER_PHYSICIAN, pos)) - DoSummonAction(creature, player); - } - } - else if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE4) - { - Position pos = {137.62f, 62.23f, 24.88f, M_PI*1.5f}; - if (Creature* creature = instance->SummonCreature(NPC_TEMPEST_KEEPER_DESTROYER, pos)) - DoSummonAction(creature, player); - } - else if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE5) - { - for (uint8 i = 0; i < 4; ++i) - { - Position pos = {133.0f + 3.5f*i, 92.88f, 26.38f, M_PI*1.5f}; - if (Creature* creature = instance->SummonCreature(i==1||i==2 ? NPC_SUNSEEKER_ASTROMAGE : NPC_SUNSEEKER_ENGINEER, pos)) - DoSummonAction(creature, player); - } - } - else if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE6) - { - if (Creature* creature = instance->GetCreature(_pathaleonGUID)) - creature->AI()->DoAction(1); - } - _passageEncounter++; - SaveToDB(); - } - } - } - } + if (_passageEncounter < ENCOUNTER_PASSAGE_PHASE3) + { + if (Player* player = GetPassagePlayer(250.0f)) + { + if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE1) + { + Position pos = {214.37f, -23.5f, 24.88f, 0.0f}; + if (Creature* creature = instance->SummonCreature(NPC_TEMPEST_KEEPER_DESTROYER, pos)) + DoSummonAction(creature, player); + } + else if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE2) + { + for (uint8 i = 0; i < 3; ++i) + { + Position pos = {199.76f, -26.0f + 2.5f*i, 24.88f, 0.0f}; + if (Creature* creature = instance->SummonCreature(i==1 ? NPC_SUNSEEKER_ENGINEER : NPC_BLOODWARDER_PHYSICIAN, pos)) + DoSummonAction(creature, player); + } + } + _passageEncounter++; + SaveToDB(); + } + } + else + { + if (Player* player = GetPassagePlayer(148.0f)) + { + if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE3) + { + for (uint8 i = 0; i < 3; ++i) + { + Position pos = {135.0f + 2.5f*i, 36.76f, 24.88f}; + if (Creature* creature = instance->SummonCreature(i==1 ? NPC_SUNSEEKER_ASTROMAGE : NPC_BLOODWARDER_PHYSICIAN, pos)) + DoSummonAction(creature, player); + } + } + else if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE4) + { + Position pos = {137.62f, 62.23f, 24.88f, M_PI*1.5f}; + if (Creature* creature = instance->SummonCreature(NPC_TEMPEST_KEEPER_DESTROYER, pos)) + DoSummonAction(creature, player); + } + else if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE5) + { + for (uint8 i = 0; i < 4; ++i) + { + Position pos = {133.0f + 3.5f*i, 92.88f, 26.38f, M_PI*1.5f}; + if (Creature* creature = instance->SummonCreature(i==1||i==2 ? NPC_SUNSEEKER_ASTROMAGE : NPC_SUNSEEKER_ENGINEER, pos)) + DoSummonAction(creature, player); + } + } + else if (_passageEncounter == ENCOUNTER_PASSAGE_PHASE6) + { + if (Creature* creature = instance->GetCreature(_pathaleonGUID)) + creature->AI()->DoAction(1); + } + _passageEncounter++; + SaveToDB(); + } + } + } + } bool SetBossState(uint32 type, EncounterState state) { @@ -193,7 +193,7 @@ class instance_mechanar : public InstanceMapScript OUT_SAVE_INST_DATA; std::ostringstream saveStream; - // Xinef: no space needed + // Xinef: no space needed saveStream << "M E " << GetBossSaveData() << _passageEncounter; OUT_SAVE_INST_DATA_COMPLETE; @@ -226,9 +226,9 @@ class instance_mechanar : public InstanceMapScript SetBossState(i, EncounterState(tmpState)); } - loadStream >> _passageEncounter; - if (_passageEncounter == ENCOUNTER_PASSAGE_DONE) - _passageEncounter = ENCOUNTER_PASSAGE_PHASE6; + loadStream >> _passageEncounter; + if (_passageEncounter == ENCOUNTER_PASSAGE_DONE) + _passageEncounter = ENCOUNTER_PASSAGE_PHASE6; } else OUT_LOAD_INST_DATA_FAIL; @@ -236,11 +236,11 @@ class instance_mechanar : public InstanceMapScript OUT_LOAD_INST_DATA_COMPLETE; } - private: - uint64 _pathaleonGUID; - uint32 _passageTimer; - uint32 _passageEncounter; - std::set _passageGUIDs; + private: + uint64 _pathaleonGUID; + uint32 _passageTimer; + uint32 _passageEncounter; + std::set _passageGUIDs; }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h index 0b0cca021..d9074b0dd 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h @@ -12,27 +12,27 @@ enum DataTypes DATA_MECHANOLORD_CAPACITUS = 2, DATA_NETHERMANCER_SEPRETHREA = 3, DATA_PATHALEON_THE_CALCULATOR = 4, - MAX_ENCOUNTER = 5, + MAX_ENCOUNTER = 5, - ENCOUNTER_PASSAGE_NOT_STARTED = 0, - ENCOUNTER_PASSAGE_PHASE1 = 1, - ENCOUNTER_PASSAGE_PHASE2 = 2, - ENCOUNTER_PASSAGE_PHASE3 = 3, - ENCOUNTER_PASSAGE_PHASE4 = 4, - ENCOUNTER_PASSAGE_PHASE5 = 5, - ENCOUNTER_PASSAGE_PHASE6 = 6, - ENCOUNTER_PASSAGE_DONE = 7, + ENCOUNTER_PASSAGE_NOT_STARTED = 0, + ENCOUNTER_PASSAGE_PHASE1 = 1, + ENCOUNTER_PASSAGE_PHASE2 = 2, + ENCOUNTER_PASSAGE_PHASE3 = 3, + ENCOUNTER_PASSAGE_PHASE4 = 4, + ENCOUNTER_PASSAGE_PHASE5 = 5, + ENCOUNTER_PASSAGE_PHASE6 = 6, + ENCOUNTER_PASSAGE_DONE = 7, }; enum NpcIds { - NPC_SUNSEEKER_ASTROMAGE = 19168, - NPC_SUNSEEKER_ENGINEER = 20988, - NPC_BLOODWARDER_CENTURION = 19510, - NPC_BLOODWARDER_PHYSICIAN = 20990, - NPC_TEMPEST_KEEPER_DESTROYER = 19735, + NPC_SUNSEEKER_ASTROMAGE = 19168, + NPC_SUNSEEKER_ENGINEER = 20988, + NPC_BLOODWARDER_CENTURION = 19510, + NPC_BLOODWARDER_PHYSICIAN = 20990, + NPC_TEMPEST_KEEPER_DESTROYER = 19735, - NPC_PATHALEON_THE_CALCULATOR = 19220 + NPC_PATHALEON_THE_CALCULATOR = 19220 }; enum GameobjectIds @@ -44,7 +44,7 @@ enum GameobjectIds enum SpellIds { - SPELL_TELEPORT_VISUAL = 35517 + SPELL_TELEPORT_VISUAL = 35517 }; #endif diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index 91ae97cd1..6e24acb84 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -9,54 +9,54 @@ REWRITTEN BY XINEF enum MillhouseSays { - SAY_INTRO_1 = 0, - SAY_INTRO_2 = 1, - SAY_WATER = 2, - SAY_BUFFS = 3, - SAY_DRINK = 4, - SAY_READY = 5, - SAY_KILL = 6, - SAY_PYRO = 7, - SAY_ICEBLOCK = 8, - SAY_LOWHP = 9, - SAY_DEATH = 10, - SAY_COMPLETE = 11, - SAY_INTRO_3 = 12, - SAY_INTRO_4 = 13, + SAY_INTRO_1 = 0, + SAY_INTRO_2 = 1, + SAY_WATER = 2, + SAY_BUFFS = 3, + SAY_DRINK = 4, + SAY_READY = 5, + SAY_KILL = 6, + SAY_PYRO = 7, + SAY_ICEBLOCK = 8, + SAY_LOWHP = 9, + SAY_DEATH = 10, + SAY_COMPLETE = 11, + SAY_INTRO_3 = 12, + SAY_INTRO_4 = 13, }; enum MillhouseSpells { - SPELL_CONJURE_WATER = 36879, - SPELL_ARCANE_INTELLECT = 36880, - SPELL_ICE_ARMOR = 36881, - SPELL_ARCANE_MISSILES = 33832, - SPELL_CONE_OF_COLD = 12611, - SPELL_FIRE_BLAST = 13341, - SPELL_FIREBALL = 14034, - SPELL_FROSTBOLT = 15497, - SPELL_PYROBLAST = 33975, - SPELL_ICEBLOCK = 36911, + SPELL_CONJURE_WATER = 36879, + SPELL_ARCANE_INTELLECT = 36880, + SPELL_ICE_ARMOR = 36881, + SPELL_ARCANE_MISSILES = 33832, + SPELL_CONE_OF_COLD = 12611, + SPELL_FIRE_BLAST = 13341, + SPELL_FIREBALL = 14034, + SPELL_FROSTBOLT = 15497, + SPELL_PYROBLAST = 33975, + SPELL_ICEBLOCK = 36911, }; enum MillhouseEvents { - EVENT_MILLHOUSE_INTRO1 = 1, - EVENT_MILLHOUSE_INTRO2 = 2, - EVENT_MILLHOUSE_INTRO3 = 3, - EVENT_MILLHOUSE_INTRO4 = 4, - EVENT_MILLHOUSE_INTRO5 = 5, - EVENT_MILLHOUSE_INTRO6 = 6, - EVENT_MILLHOUSE_INTRO7 = 7, - EVENT_MILLHOUSE_INTRO8 = 8, - EVENT_MILLHOUSE_INTRO9 = 9, - EVENT_SEARCH_FIGHT = 10, - EVENT_TELEPORT_VISUAL = 11, + EVENT_MILLHOUSE_INTRO1 = 1, + EVENT_MILLHOUSE_INTRO2 = 2, + EVENT_MILLHOUSE_INTRO3 = 3, + EVENT_MILLHOUSE_INTRO4 = 4, + EVENT_MILLHOUSE_INTRO5 = 5, + EVENT_MILLHOUSE_INTRO6 = 6, + EVENT_MILLHOUSE_INTRO7 = 7, + EVENT_MILLHOUSE_INTRO8 = 8, + EVENT_MILLHOUSE_INTRO9 = 9, + EVENT_SEARCH_FIGHT = 10, + EVENT_TELEPORT_VISUAL = 11, - EVENT_MILL_CHECK_HEALTH = 20, - EVENT_MILL_PYROBLAST = 21, - EVENT_MILL_BASE_SPELL = 22, - EVENT_MILL_ICEBLOCK = 23 + EVENT_MILL_CHECK_HEALTH = 20, + EVENT_MILL_PYROBLAST = 21, + EVENT_MILL_BASE_SPELL = 22, + EVENT_MILL_ICEBLOCK = 23 }; class npc_millhouse_manastorm : public CreatureScript @@ -72,23 +72,23 @@ class npc_millhouse_manastorm : public CreatureScript } InstanceScript* instance; - EventMap events; - EventMap events2; + EventMap events; + EventMap events2; - void InitializeAI() - { - ScriptedAI::InitializeAI(); + void InitializeAI() + { + ScriptedAI::InitializeAI(); - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - events2.Reset(); - events2.ScheduleEvent(EVENT_TELEPORT_VISUAL, 0); - events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO1, 3000); - } + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + events2.Reset(); + events2.ScheduleEvent(EVENT_TELEPORT_VISUAL, 0); + events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO1, 3000); + } void Reset() { - events.Reset(); + events.Reset(); } void AttackStart(Unit* who) @@ -107,124 +107,124 @@ class npc_millhouse_manastorm : public CreatureScript Talk(SAY_DEATH); } - void EnterCombat(Unit*) - { - events.ScheduleEvent(EVENT_MILL_CHECK_HEALTH, 1000); - events.ScheduleEvent(EVENT_MILL_PYROBLAST, 30000); - events.ScheduleEvent(EVENT_MILL_BASE_SPELL, 2000); - events.ScheduleEvent(EVENT_MILL_ICEBLOCK, 1000); - } + void EnterCombat(Unit*) + { + events.ScheduleEvent(EVENT_MILL_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_MILL_PYROBLAST, 30000); + events.ScheduleEvent(EVENT_MILL_BASE_SPELL, 2000); + events.ScheduleEvent(EVENT_MILL_ICEBLOCK, 1000); + } void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_TELEPORT_VISUAL: - me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); - break; - case EVENT_MILLHOUSE_INTRO1: - Talk(SAY_INTRO_1); - events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO2, 18000); - break; - case EVENT_MILLHOUSE_INTRO2: - Talk(SAY_INTRO_2); - events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO3, 8000); - break; - case EVENT_MILLHOUSE_INTRO3: - Talk(SAY_INTRO_3); - events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO4, 6000); - break; - case EVENT_MILLHOUSE_INTRO4: - Talk(SAY_INTRO_4); - events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO5, 8000); - break; - case EVENT_MILLHOUSE_INTRO5: - Talk(SAY_WATER); - me->CastSpell(me, SPELL_CONJURE_WATER, false); - events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO6, 7000); - break; - case EVENT_MILLHOUSE_INTRO6: - Talk(SAY_BUFFS); - me->CastSpell(me, SPELL_ICE_ARMOR, false); - events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO7, 7000); - break; - case EVENT_MILLHOUSE_INTRO7: - Talk(SAY_DRINK); - me->CastSpell(me, SPELL_ARCANE_INTELLECT, false); - events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO8, 7000); - break; - case EVENT_MILLHOUSE_INTRO8: - Talk(SAY_READY); - me->GetMotionMaster()->MovePoint(1, 445.82f, -158.38f, 43.067f); - events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO9, 5000); - break; - case EVENT_MILLHOUSE_INTRO9: - me->SetFacingTo(M_PI*1.5f); - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), M_PI*1.5f); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->SetReactState(REACT_AGGRESSIVE); - events2.ScheduleEvent(EVENT_SEARCH_FIGHT, 1000); - break; - case EVENT_SEARCH_FIGHT: - if (!me->IsInCombat() && !me->IsInEvadeMode()) - if (Unit* target = me->SelectNearbyTarget(NULL, 30.0f)) - AttackStart(target); - events2.ScheduleEvent(EVENT_SEARCH_FIGHT, 1000); - break; + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_TELEPORT_VISUAL: + me->CastSpell(me, SPELL_TELEPORT_VISUAL, true); + break; + case EVENT_MILLHOUSE_INTRO1: + Talk(SAY_INTRO_1); + events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO2, 18000); + break; + case EVENT_MILLHOUSE_INTRO2: + Talk(SAY_INTRO_2); + events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO3, 8000); + break; + case EVENT_MILLHOUSE_INTRO3: + Talk(SAY_INTRO_3); + events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO4, 6000); + break; + case EVENT_MILLHOUSE_INTRO4: + Talk(SAY_INTRO_4); + events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO5, 8000); + break; + case EVENT_MILLHOUSE_INTRO5: + Talk(SAY_WATER); + me->CastSpell(me, SPELL_CONJURE_WATER, false); + events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO6, 7000); + break; + case EVENT_MILLHOUSE_INTRO6: + Talk(SAY_BUFFS); + me->CastSpell(me, SPELL_ICE_ARMOR, false); + events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO7, 7000); + break; + case EVENT_MILLHOUSE_INTRO7: + Talk(SAY_DRINK); + me->CastSpell(me, SPELL_ARCANE_INTELLECT, false); + events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO8, 7000); + break; + case EVENT_MILLHOUSE_INTRO8: + Talk(SAY_READY); + me->GetMotionMaster()->MovePoint(1, 445.82f, -158.38f, 43.067f); + events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO9, 5000); + break; + case EVENT_MILLHOUSE_INTRO9: + me->SetFacingTo(M_PI*1.5f); + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), M_PI*1.5f); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetReactState(REACT_AGGRESSIVE); + events2.ScheduleEvent(EVENT_SEARCH_FIGHT, 1000); + break; + case EVENT_SEARCH_FIGHT: + if (!me->IsInCombat() && !me->IsInEvadeMode()) + if (Unit* target = me->SelectNearbyTarget(NULL, 30.0f)) + AttackStart(target); + events2.ScheduleEvent(EVENT_SEARCH_FIGHT, 1000); + break; - } + } if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_MILL_CHECK_HEALTH: - if (HealthBelowPct(20)) - { - Talk(SAY_LOWHP); - break; - } - events.ScheduleEvent(EVENT_MILL_CHECK_HEALTH, 1000); - break; - case EVENT_MILL_PYROBLAST: - Talk(SAY_PYRO); - me->CastSpell(me->GetVictim(), SPELL_PYROBLAST, false); - events.ScheduleEvent(EVENT_MILL_PYROBLAST, 30000); - break; - case EVENT_MILL_ICEBLOCK: - if (me->GetDistance(me->GetVictim()) < 5.0f) - { - Talk(SAY_ICEBLOCK); - me->CastSpell(me, SPELL_ICEBLOCK, true); - break; - } - events.ScheduleEvent(EVENT_MILL_ICEBLOCK, 1000); - break; - case EVENT_MILL_BASE_SPELL: - switch (RAND(SPELL_FIREBALL, SPELL_ARCANE_MISSILES, SPELL_FROSTBOLT)) - { - case SPELL_FIREBALL: - me->CastSpell(me->GetVictim(), SPELL_FIREBALL, false); - events.ScheduleEvent(EVENT_MILL_BASE_SPELL, 4000); - break; - case SPELL_ARCANE_MISSILES: - me->CastSpell(me->GetVictim(), SPELL_ARCANE_MISSILES, false); - events.ScheduleEvent(EVENT_MILL_BASE_SPELL, 9000); - break; - case SPELL_FROSTBOLT: - me->CastSpell(me->GetVictim(), SPELL_FROSTBOLT, false); - events.ScheduleEvent(EVENT_MILL_BASE_SPELL, 4000); - break; - } - break; + switch (events.ExecuteEvent()) + { + case EVENT_MILL_CHECK_HEALTH: + if (HealthBelowPct(20)) + { + Talk(SAY_LOWHP); + break; + } + events.ScheduleEvent(EVENT_MILL_CHECK_HEALTH, 1000); + break; + case EVENT_MILL_PYROBLAST: + Talk(SAY_PYRO); + me->CastSpell(me->GetVictim(), SPELL_PYROBLAST, false); + events.ScheduleEvent(EVENT_MILL_PYROBLAST, 30000); + break; + case EVENT_MILL_ICEBLOCK: + if (me->GetDistance(me->GetVictim()) < 5.0f) + { + Talk(SAY_ICEBLOCK); + me->CastSpell(me, SPELL_ICEBLOCK, true); + break; + } + events.ScheduleEvent(EVENT_MILL_ICEBLOCK, 1000); + break; + case EVENT_MILL_BASE_SPELL: + switch (RAND(SPELL_FIREBALL, SPELL_ARCANE_MISSILES, SPELL_FROSTBOLT)) + { + case SPELL_FIREBALL: + me->CastSpell(me->GetVictim(), SPELL_FIREBALL, false); + events.ScheduleEvent(EVENT_MILL_BASE_SPELL, 4000); + break; + case SPELL_ARCANE_MISSILES: + me->CastSpell(me->GetVictim(), SPELL_ARCANE_MISSILES, false); + events.ScheduleEvent(EVENT_MILL_BASE_SPELL, 9000); + break; + case SPELL_FROSTBOLT: + me->CastSpell(me->GetVictim(), SPELL_FROSTBOLT, false); + events.ScheduleEvent(EVENT_MILL_BASE_SPELL, 4000); + break; + } + break; - } + } DoMeleeAttackIfReady(); } @@ -238,27 +238,27 @@ class npc_millhouse_manastorm : public CreatureScript enum WardenSays { - YELL_INTRO1 = 0, - YELL_INTRO2 = 1, - YELL_RELEASE1 = 2, - YELL_RELEASE2A = 3, - YELL_RELEASE2B = 4, - YELL_RELEASE3 = 5, - YELL_RELEASE4 = 6, - YELL_WELCOME = 7, + YELL_INTRO1 = 0, + YELL_INTRO2 = 1, + YELL_RELEASE1 = 2, + YELL_RELEASE2A = 3, + YELL_RELEASE2B = 4, + YELL_RELEASE3 = 5, + YELL_RELEASE4 = 6, + YELL_WELCOME = 7, - SAY_HARBINGER_INTRO = 0, + SAY_HARBINGER_INTRO = 0, }; enum WardenUnits { - NPC_TRICKSTER = 20905, - NPC_PH_HUNTER = 20906, - NPC_MILLHOUSE = 20977, - NPC_AKKIRIS = 20908, - NPC_SULFURON = 20909, - NPC_TW_DRAK = 20910, - NPC_BL_DRAK = 20911, + NPC_TRICKSTER = 20905, + NPC_PH_HUNTER = 20906, + NPC_MILLHOUSE = 20977, + NPC_AKKIRIS = 20908, + NPC_SULFURON = 20909, + NPC_TW_DRAK = 20910, + NPC_BL_DRAK = 20911, }; enum WardenSpells @@ -270,42 +270,42 @@ enum WardenSpells SPELL_TARGET_OMEGA = 36852, SPELL_BUBBLE_VISUAL = 36849, - SPELL_MIND_REND = 36859, - SPELL_QID10886 = 39564 // Trial of the Naaru: Tenacity + SPELL_MIND_REND = 36859, + SPELL_QID10886 = 39564 // Trial of the Naaru: Tenacity }; enum WardenEvents { - EVENT_WARDEN_CHECK_PLAYERS = 1, - EVENT_WARDEN_INTRO1 = 2, - EVENT_WARDEN_INTRO2, - EVENT_WARDEN_INTRO3, - EVENT_WARDEN_INTRO4, - EVENT_WARDEN_INTRO5, - EVENT_WARDEN_INTRO6, - EVENT_WARDEN_INTRO7, - EVENT_WARDEN_INTRO8, - EVENT_WARDEN_INTRO9, - EVENT_WARDEN_INTRO10, - EVENT_WARDEN_INTRO11, - EVENT_WARDEN_INTRO12, - EVENT_WARDEN_INTRO13, - EVENT_WARDEN_INTRO14, - EVENT_WARDEN_INTRO15, - EVENT_WARDEN_INTRO16, - EVENT_WARDEN_INTRO17, - EVENT_WARDEN_INTRO18, - EVENT_WARDEN_INTRO19, - EVENT_WARDEN_INTRO20, - EVENT_WARDEN_INTRO21, - EVENT_WARDEN_INTRO22, - EVENT_WARDEN_INTRO23, - EVENT_WARDEN_INTRO24, - EVENT_WARDEN_INTRO25, - EVENT_WARDEN_INTRO26, - EVENT_WARDEN_INTRO27, - EVENT_WARDEN_INTRO28, - EVENT_WARDEN_INTRO29 + EVENT_WARDEN_CHECK_PLAYERS = 1, + EVENT_WARDEN_INTRO1 = 2, + EVENT_WARDEN_INTRO2, + EVENT_WARDEN_INTRO3, + EVENT_WARDEN_INTRO4, + EVENT_WARDEN_INTRO5, + EVENT_WARDEN_INTRO6, + EVENT_WARDEN_INTRO7, + EVENT_WARDEN_INTRO8, + EVENT_WARDEN_INTRO9, + EVENT_WARDEN_INTRO10, + EVENT_WARDEN_INTRO11, + EVENT_WARDEN_INTRO12, + EVENT_WARDEN_INTRO13, + EVENT_WARDEN_INTRO14, + EVENT_WARDEN_INTRO15, + EVENT_WARDEN_INTRO16, + EVENT_WARDEN_INTRO17, + EVENT_WARDEN_INTRO18, + EVENT_WARDEN_INTRO19, + EVENT_WARDEN_INTRO20, + EVENT_WARDEN_INTRO21, + EVENT_WARDEN_INTRO22, + EVENT_WARDEN_INTRO23, + EVENT_WARDEN_INTRO24, + EVENT_WARDEN_INTRO25, + EVENT_WARDEN_INTRO26, + EVENT_WARDEN_INTRO27, + EVENT_WARDEN_INTRO28, + EVENT_WARDEN_INTRO29 }; class npc_warden_mellichar : public CreatureScript @@ -319,245 +319,245 @@ class npc_warden_mellichar : public CreatureScript { } - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + } - void SummonedCreatureDies(Creature* summon, Unit*) - { - if (summon->GetEntry() == NPC_HARBINGER_SKYRISS) - { - Unit::Kill(me, me); - me->setActive(false); - instance->SetBossState(DATA_WARDEN_MELLICHAR, DONE); - if (Creature* creature = summons.GetCreatureWithEntry(NPC_MILLHOUSE)) - { - instance->DoCastSpellOnPlayers(SPELL_QID10886); - creature->AI()->Talk(SAY_COMPLETE); - creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - } - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + if (summon->GetEntry() == NPC_HARBINGER_SKYRISS) + { + Unit::Kill(me, me); + me->setActive(false); + instance->SetBossState(DATA_WARDEN_MELLICHAR, DONE); + if (Creature* creature = summons.GetCreatureWithEntry(NPC_MILLHOUSE)) + { + instance->DoCastSpellOnPlayers(SPELL_QID10886); + creature->AI()->Talk(SAY_COMPLETE); + creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + } + } - void MoveInLineOfSight(Unit*) { } - void AttackStart(Unit*) { } - void EnterCombat(Unit*) { } + void MoveInLineOfSight(Unit*) { } + void AttackStart(Unit*) { } + void EnterCombat(Unit*) { } - void JustDied(Unit*) - { - me->setActive(false); - } + void JustDied(Unit*) + { + me->setActive(false); + } void Reset() { - _Reset(); - me->setActive(false); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + _Reset(); + me->setActive(false); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - me->CastSpell((Unit*)NULL, SPELL_TARGET_OMEGA, false); - instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), true); - instance->SetBossState(DATA_WARDEN_MELLICHAR, NOT_STARTED); + me->CastSpell((Unit*)NULL, SPELL_TARGET_OMEGA, false); + instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), true); + instance->SetBossState(DATA_WARDEN_MELLICHAR, NOT_STARTED); } - void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) - { - if (attacker && IS_PLAYER_GUID(attacker->GetCharmerOrOwnerOrOwnGUID()) && damage > 0 && !me->isActiveObject()) - { - me->setActive(true); - me->InterruptNonMeleeSpells(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - events.ScheduleEvent(EVENT_WARDEN_INTRO1, 1500); - events.ScheduleEvent(EVENT_WARDEN_CHECK_PLAYERS, 1000); - instance->SetBossState(DATA_WARDEN_MELLICHAR, IN_PROGRESS); - } - damage = 0; - } + void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType, SpellSchoolMask) + { + if (attacker && IS_PLAYER_GUID(attacker->GetCharmerOrOwnerOrOwnGUID()) && damage > 0 && !me->isActiveObject()) + { + me->setActive(true); + me->InterruptNonMeleeSpells(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + events.ScheduleEvent(EVENT_WARDEN_INTRO1, 1500); + events.ScheduleEvent(EVENT_WARDEN_CHECK_PLAYERS, 1000); + instance->SetBossState(DATA_WARDEN_MELLICHAR, IN_PROGRESS); + } + damage = 0; + } - void SetData(uint32 type, uint32 data) - { - if (data == FAIL) - { - CreatureAI::EnterEvadeMode(); - return; - } - if (data != DONE) - return; + void SetData(uint32 type, uint32 data) + { + if (data == FAIL) + { + CreatureAI::EnterEvadeMode(); + return; + } + if (data != DONE) + return; - switch (type) - { - case DATA_WARDEN_1: - events.ScheduleEvent(EVENT_WARDEN_INTRO8, 2000); - break; - case DATA_WARDEN_3: - events.ScheduleEvent(EVENT_WARDEN_INTRO19, 2000); - break; - case DATA_WARDEN_4: - events.ScheduleEvent(EVENT_WARDEN_INTRO24, 2000); - break; - } - } + switch (type) + { + case DATA_WARDEN_1: + events.ScheduleEvent(EVENT_WARDEN_INTRO8, 2000); + break; + case DATA_WARDEN_3: + events.ScheduleEvent(EVENT_WARDEN_INTRO19, 2000); + break; + case DATA_WARDEN_4: + events.ScheduleEvent(EVENT_WARDEN_INTRO24, 2000); + break; + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_WARDEN_CHECK_PLAYERS: - if (!SelectTargetFromPlayerList(100.0f)) - { - CreatureAI::EnterEvadeMode(); - return; - } - events.ScheduleEvent(EVENT_WARDEN_CHECK_PLAYERS, 1000); - break; - case EVENT_WARDEN_INTRO1: - Talk(YELL_INTRO1); - me->SetFacingTo(M_PI/2.0f); - me->CastSpell(me, SPELL_BUBBLE_VISUAL, false); - events.ScheduleEvent(EVENT_WARDEN_INTRO2, 1400); - break; - case EVENT_WARDEN_INTRO2: - instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false); - events.ScheduleEvent(EVENT_WARDEN_INTRO3, 20000); - break; - case EVENT_WARDEN_INTRO3: + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_WARDEN_CHECK_PLAYERS: + if (!SelectTargetFromPlayerList(100.0f)) + { + CreatureAI::EnterEvadeMode(); + return; + } + events.ScheduleEvent(EVENT_WARDEN_CHECK_PLAYERS, 1000); + break; + case EVENT_WARDEN_INTRO1: + Talk(YELL_INTRO1); + me->SetFacingTo(M_PI/2.0f); + me->CastSpell(me, SPELL_BUBBLE_VISUAL, false); + events.ScheduleEvent(EVENT_WARDEN_INTRO2, 1400); + break; + case EVENT_WARDEN_INTRO2: + instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false); + events.ScheduleEvent(EVENT_WARDEN_INTRO3, 20000); + break; + case EVENT_WARDEN_INTRO3: Talk(YELL_INTRO2); - events.ScheduleEvent(EVENT_WARDEN_INTRO4, 5000); - break; - case EVENT_WARDEN_INTRO4: - me->SetFacingTo(0.5f); - me->CastSpell((Unit*)NULL, SPELL_TARGET_ALPHA, false); - events.ScheduleEvent(EVENT_WARDEN_INTRO5, 2000); - break; - case EVENT_WARDEN_INTRO5: - instance->SetData(DATA_WARDEN_1, IN_PROGRESS); - events.ScheduleEvent(EVENT_WARDEN_INTRO6, 3000); - break; - case EVENT_WARDEN_INTRO6: - me->SetFacingTo(M_PI*1.5f); - me->CastSpell((Unit*)NULL, SPELL_TARGET_OMEGA, false); - events.ScheduleEvent(EVENT_WARDEN_INTRO7, 5000); - break; - case EVENT_WARDEN_INTRO7: + events.ScheduleEvent(EVENT_WARDEN_INTRO4, 5000); + break; + case EVENT_WARDEN_INTRO4: + me->SetFacingTo(0.5f); + me->CastSpell((Unit*)NULL, SPELL_TARGET_ALPHA, false); + events.ScheduleEvent(EVENT_WARDEN_INTRO5, 2000); + break; + case EVENT_WARDEN_INTRO5: + instance->SetData(DATA_WARDEN_1, IN_PROGRESS); + events.ScheduleEvent(EVENT_WARDEN_INTRO6, 3000); + break; + case EVENT_WARDEN_INTRO6: + me->SetFacingTo(M_PI*1.5f); + me->CastSpell((Unit*)NULL, SPELL_TARGET_OMEGA, false); + events.ScheduleEvent(EVENT_WARDEN_INTRO7, 5000); + break; + case EVENT_WARDEN_INTRO7: me->SummonCreature(RAND(NPC_TRICKSTER, NPC_PH_HUNTER), 478.326f, -148.505f, 42.56f, 3.19f, TEMPSUMMON_MANUAL_DESPAWN); - // Wait for kill + // Wait for kill break; - case EVENT_WARDEN_INTRO8: - Talk(YELL_RELEASE1); - me->InterruptNonMeleeSpells(false); - me->SetFacingTo(2.6f); - events.ScheduleEvent(EVENT_WARDEN_INTRO10, 4000); - break; - case EVENT_WARDEN_INTRO10: - me->CastSpell((Unit*)NULL, SPELL_TARGET_BETA, false); - events.ScheduleEvent(EVENT_WARDEN_INTRO11, 2000); - break; - case EVENT_WARDEN_INTRO11: - Talk(YELL_RELEASE2A); - instance->SetData(DATA_WARDEN_2, IN_PROGRESS); - events.ScheduleEvent(EVENT_WARDEN_INTRO12, 2000); - break; - case EVENT_WARDEN_INTRO12: - me->SetFacingTo(M_PI*1.5f); - me->CastSpell((Unit*)NULL, SPELL_TARGET_OMEGA, false); - events.ScheduleEvent(EVENT_WARDEN_INTRO13, 6000); - break; - case EVENT_WARDEN_INTRO13: + case EVENT_WARDEN_INTRO8: + Talk(YELL_RELEASE1); + me->InterruptNonMeleeSpells(false); + me->SetFacingTo(2.6f); + events.ScheduleEvent(EVENT_WARDEN_INTRO10, 4000); + break; + case EVENT_WARDEN_INTRO10: + me->CastSpell((Unit*)NULL, SPELL_TARGET_BETA, false); + events.ScheduleEvent(EVENT_WARDEN_INTRO11, 2000); + break; + case EVENT_WARDEN_INTRO11: + Talk(YELL_RELEASE2A); + instance->SetData(DATA_WARDEN_2, IN_PROGRESS); + events.ScheduleEvent(EVENT_WARDEN_INTRO12, 2000); + break; + case EVENT_WARDEN_INTRO12: + me->SetFacingTo(M_PI*1.5f); + me->CastSpell((Unit*)NULL, SPELL_TARGET_OMEGA, false); + events.ScheduleEvent(EVENT_WARDEN_INTRO13, 6000); + break; + case EVENT_WARDEN_INTRO13: me->SummonCreature(NPC_MILLHOUSE, 413.292f, -148.378f, 42.56f, 6.27f, TEMPSUMMON_MANUAL_DESPAWN); - events.ScheduleEvent(EVENT_WARDEN_INTRO14, 14000); + events.ScheduleEvent(EVENT_WARDEN_INTRO14, 14000); break; - case EVENT_WARDEN_INTRO14: - Talk(YELL_RELEASE2B); - me->InterruptNonMeleeSpells(false); - me->SetFacingTo(3.3f); - events.ScheduleEvent(EVENT_WARDEN_INTRO15, 5000); - break; - case EVENT_WARDEN_INTRO15: - me->CastSpell((Unit*)NULL, SPELL_TARGET_DELTA, false); - events.ScheduleEvent(EVENT_WARDEN_INTRO16, 2000); - break; - case EVENT_WARDEN_INTRO16: - instance->SetData(DATA_WARDEN_3, IN_PROGRESS); - events.ScheduleEvent(EVENT_WARDEN_INTRO17, 2000); - break; - case EVENT_WARDEN_INTRO17: - me->SetFacingTo(M_PI*1.5f); - me->CastSpell((Unit*)NULL, SPELL_TARGET_OMEGA, false); - events.ScheduleEvent(EVENT_WARDEN_INTRO18, 6000); - break; - case EVENT_WARDEN_INTRO18: + case EVENT_WARDEN_INTRO14: + Talk(YELL_RELEASE2B); + me->InterruptNonMeleeSpells(false); + me->SetFacingTo(3.3f); + events.ScheduleEvent(EVENT_WARDEN_INTRO15, 5000); + break; + case EVENT_WARDEN_INTRO15: + me->CastSpell((Unit*)NULL, SPELL_TARGET_DELTA, false); + events.ScheduleEvent(EVENT_WARDEN_INTRO16, 2000); + break; + case EVENT_WARDEN_INTRO16: + instance->SetData(DATA_WARDEN_3, IN_PROGRESS); + events.ScheduleEvent(EVENT_WARDEN_INTRO17, 2000); + break; + case EVENT_WARDEN_INTRO17: + me->SetFacingTo(M_PI*1.5f); + me->CastSpell((Unit*)NULL, SPELL_TARGET_OMEGA, false); + events.ScheduleEvent(EVENT_WARDEN_INTRO18, 6000); + break; + case EVENT_WARDEN_INTRO18: me->SummonCreature(RAND(NPC_AKKIRIS, NPC_SULFURON), 420.179f, -174.396f, 42.58f, 0.02f, TEMPSUMMON_MANUAL_DESPAWN); - // Wait for kill - break; - case EVENT_WARDEN_INTRO19: - Talk(YELL_RELEASE3); - me->InterruptNonMeleeSpells(false); - me->SetFacingTo(6.05f); - events.ScheduleEvent(EVENT_WARDEN_INTRO20, 4000); - break; - case EVENT_WARDEN_INTRO20: - me->CastSpell((Unit*)NULL, SPELL_TARGET_GAMMA, false); - events.ScheduleEvent(EVENT_WARDEN_INTRO21, 2000); - break; - case EVENT_WARDEN_INTRO21: - instance->SetData(DATA_WARDEN_4, IN_PROGRESS); - events.ScheduleEvent(EVENT_WARDEN_INTRO22, 2000); - break; - case EVENT_WARDEN_INTRO22: - me->SetFacingTo(M_PI*1.5f); - me->CastSpell((Unit*)NULL, SPELL_TARGET_OMEGA, false); - events.ScheduleEvent(EVENT_WARDEN_INTRO23, 6000); - break; - case EVENT_WARDEN_INTRO23: - me->SummonCreature(RAND(NPC_TW_DRAK, NPC_BL_DRAK), 471.795f, -174.58f, 42.58f, 3.06f, TEMPSUMMON_MANUAL_DESPAWN); - // Wait for kill - break; - case EVENT_WARDEN_INTRO24: - instance->SetData(DATA_WARDEN_5, IN_PROGRESS); - Talk(YELL_RELEASE4); - me->InterruptNonMeleeSpells(false); - events.ScheduleEvent(EVENT_WARDEN_INTRO25, 8000); - break; - case EVENT_WARDEN_INTRO25: - if (Creature* cr = me->SummonCreature(NPC_HARBINGER_SKYRISS, 445.763f, -191.639f, 44.64f, 1.60f, TEMPSUMMON_MANUAL_DESPAWN)) - { - cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - cr->CastSpell(cr, SPELL_TELEPORT_VISUAL, true); - } - events.ScheduleEvent(EVENT_WARDEN_INTRO26, 1000); - break; - case EVENT_WARDEN_INTRO26: - if (Creature* creature = summons.GetCreatureWithEntry(NPC_HARBINGER_SKYRISS)) - creature->AI()->Talk(SAY_HARBINGER_INTRO); - events.ScheduleEvent(EVENT_WARDEN_INTRO27, 23000); - break; - case EVENT_WARDEN_INTRO27: + // Wait for kill + break; + case EVENT_WARDEN_INTRO19: + Talk(YELL_RELEASE3); + me->InterruptNonMeleeSpells(false); + me->SetFacingTo(6.05f); + events.ScheduleEvent(EVENT_WARDEN_INTRO20, 4000); + break; + case EVENT_WARDEN_INTRO20: + me->CastSpell((Unit*)NULL, SPELL_TARGET_GAMMA, false); + events.ScheduleEvent(EVENT_WARDEN_INTRO21, 2000); + break; + case EVENT_WARDEN_INTRO21: + instance->SetData(DATA_WARDEN_4, IN_PROGRESS); + events.ScheduleEvent(EVENT_WARDEN_INTRO22, 2000); + break; + case EVENT_WARDEN_INTRO22: + me->SetFacingTo(M_PI*1.5f); + me->CastSpell((Unit*)NULL, SPELL_TARGET_OMEGA, false); + events.ScheduleEvent(EVENT_WARDEN_INTRO23, 6000); + break; + case EVENT_WARDEN_INTRO23: + me->SummonCreature(RAND(NPC_TW_DRAK, NPC_BL_DRAK), 471.795f, -174.58f, 42.58f, 3.06f, TEMPSUMMON_MANUAL_DESPAWN); + // Wait for kill + break; + case EVENT_WARDEN_INTRO24: + instance->SetData(DATA_WARDEN_5, IN_PROGRESS); + Talk(YELL_RELEASE4); + me->InterruptNonMeleeSpells(false); + events.ScheduleEvent(EVENT_WARDEN_INTRO25, 8000); + break; + case EVENT_WARDEN_INTRO25: + if (Creature* cr = me->SummonCreature(NPC_HARBINGER_SKYRISS, 445.763f, -191.639f, 44.64f, 1.60f, TEMPSUMMON_MANUAL_DESPAWN)) + { + cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + cr->CastSpell(cr, SPELL_TELEPORT_VISUAL, true); + } + events.ScheduleEvent(EVENT_WARDEN_INTRO26, 1000); + break; + case EVENT_WARDEN_INTRO26: + if (Creature* creature = summons.GetCreatureWithEntry(NPC_HARBINGER_SKYRISS)) + creature->AI()->Talk(SAY_HARBINGER_INTRO); + events.ScheduleEvent(EVENT_WARDEN_INTRO27, 23000); + break; + case EVENT_WARDEN_INTRO27: Talk(YELL_WELCOME); - events.ScheduleEvent(EVENT_WARDEN_INTRO28, 5000); - break; - case EVENT_WARDEN_INTRO28: - instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), true); - if (Creature* creature = summons.GetCreatureWithEntry(NPC_HARBINGER_SKYRISS)) - creature->CastSpell((Unit*)NULL, SPELL_MIND_REND, false); - events.ScheduleEvent(EVENT_WARDEN_INTRO29, 4000); - break; - - case EVENT_WARDEN_INTRO29: - events.Reset(); - me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - if (Creature* creature = summons.GetCreatureWithEntry(NPC_HARBINGER_SKYRISS)) - { - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - if (Player* player = SelectTargetFromPlayerList(50.0f)) - AttackStart(player); - } - break; - } - } + events.ScheduleEvent(EVENT_WARDEN_INTRO28, 5000); + break; + case EVENT_WARDEN_INTRO28: + instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), true); + if (Creature* creature = summons.GetCreatureWithEntry(NPC_HARBINGER_SKYRISS)) + creature->CastSpell((Unit*)NULL, SPELL_MIND_REND, false); + events.ScheduleEvent(EVENT_WARDEN_INTRO29, 4000); + break; + + case EVENT_WARDEN_INTRO29: + events.Reset(); + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); + if (Creature* creature = summons.GetCreatureWithEntry(NPC_HARBINGER_SKYRISS)) + { + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + if (Player* player = SelectTargetFromPlayerList(50.0f)) + AttackStart(player); + } + break; + } + } }; CreatureAI* GetAI(Creature* creature) const @@ -575,22 +575,22 @@ public: { PrepareAuraScript(spell_arcatraz_soul_steal_AuraScript) - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Unit* caster = GetCaster()) - caster->CastSpell(caster, SPELL_SOUL_STEAL, true); + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, SPELL_SOUL_STEAL, true); } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Unit* caster = GetCaster()) - caster->RemoveAurasDueToSpell(SPELL_SOUL_STEAL); + if (Unit* caster = GetCaster()) + caster->RemoveAurasDueToSpell(SPELL_SOUL_STEAL); } void Register() { OnEffectApply += AuraEffectApplyFn(spell_arcatraz_soul_steal_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_arcatraz_soul_steal_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_arcatraz_soul_steal_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL); } }; @@ -605,5 +605,5 @@ void AddSC_arcatraz() new npc_millhouse_manastorm(); new npc_warden_mellichar(); - new spell_arcatraz_soul_steal(); + new spell_arcatraz_soul_steal(); } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h index 1924a0f71..cf801c4bb 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h @@ -8,11 +8,11 @@ REWRITTEN BY XINEF enum DataTypes { // Encounter States/Boss GUIDs - DATA_ZEREKETH = 0, - DATA_DALLIAH = 1, - DATA_SOCCOTHRATES = 2, - DATA_WARDEN_MELLICHAR = 3, - MAX_ENCOUTER = 4, + DATA_ZEREKETH = 0, + DATA_DALLIAH = 1, + DATA_SOCCOTHRATES = 2, + DATA_WARDEN_MELLICHAR = 3, + MAX_ENCOUTER = 4, // Additional Data DATA_WARDEN_1 = 5, // used by SmartAI @@ -28,7 +28,7 @@ enum CreatureIds NPC_DALLIAH = 20885, NPC_SOCCOTHRATES = 20886, NPC_MELLICHAR = 20904, - NPC_HARBINGER_SKYRISS = 20912, + NPC_HARBINGER_SKYRISS = 20912, NPC_ALPHA_POD_TARGET = 21436 }; @@ -46,8 +46,8 @@ enum GameObjectIds enum SpellIds { - SPELL_TELEPORT_VISUAL = 35517, - SPELL_SOUL_STEAL = 36782 + SPELL_TELEPORT_VISUAL = 35517, + SPELL_SOUL_STEAL = 36782 }; #endif // ARCATRAZ_H diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp index a905e800d..a508cc7d3 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp @@ -37,7 +37,7 @@ enum Events EVENT_SHADOW_WAVE = 4, EVENT_ME_FIRST = 5, EVENT_SOCCOTHRATES_DEATH = 6, - EVENT_CHECK_HEALTH = 7, + EVENT_CHECK_HEALTH = 7, }; class boss_dalliah_the_doomsayer : public CreatureScript @@ -52,16 +52,16 @@ class boss_dalliah_the_doomsayer : public CreatureScript void Reset() { _Reset(); - events2.Reset(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + events2.Reset(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); } - void InitializeAI() - { - BossAI::InitializeAI(); - if (instance->GetBossState(DATA_SOCCOTHRATES) != DONE) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - } + void InitializeAI() + { + BossAI::InitializeAI(); + if (instance->GetBossState(DATA_SOCCOTHRATES) != DONE) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + } void JustDied(Unit* /*killer*/) { @@ -81,7 +81,7 @@ class boss_dalliah_the_doomsayer : public CreatureScript events.ScheduleEvent(EVENT_GIFT_OF_THE_DOOMSAYER, urand(1000, 4000)); events.ScheduleEvent(EVENT_WHIRLWIND, urand(7000, 9000)); events.ScheduleEvent(EVENT_ME_FIRST, 6000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); if (IsHeroic()) events.ScheduleEvent(EVENT_SHADOW_WAVE, urand(11000, 16000)); @@ -89,8 +89,8 @@ class boss_dalliah_the_doomsayer : public CreatureScript void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void SetData(uint32 /*type*/, uint32 data) @@ -101,13 +101,13 @@ class boss_dalliah_the_doomsayer : public CreatureScript void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { - case EVENT_SOCCOTHRATES_DEATH: - Talk(SAY_SOCCOTHRATES_DEATH); - break; - } + events2.Update(diff); + switch (events2.ExecuteEvent()) + { + case EVENT_SOCCOTHRATES_DEATH: + Talk(SAY_SOCCOTHRATES_DEATH); + break; + } if (!UpdateVictim()) return; @@ -119,21 +119,21 @@ class boss_dalliah_the_doomsayer : public CreatureScript switch (events.ExecuteEvent()) { case EVENT_GIFT_OF_THE_DOOMSAYER: - me->CastSpell(me->GetVictim(), SPELL_GIFT_OF_THE_DOOMSAYER, false); + me->CastSpell(me->GetVictim(), SPELL_GIFT_OF_THE_DOOMSAYER, false); events.ScheduleEvent(EVENT_GIFT_OF_THE_DOOMSAYER, urand(16000, 21000)); break; case EVENT_WHIRLWIND: - me->CastSpell(me, SPELL_WHIRLWIND, false); + me->CastSpell(me, SPELL_WHIRLWIND, false); Talk(SAY_WHIRLWIND); events.ScheduleEvent(EVENT_WHIRLWIND, urand(19000, 21000)); events.ScheduleEvent(EVENT_HEAL, 6000); break; case EVENT_HEAL: - me->CastSpell(me, SPELL_HEAL, false); + me->CastSpell(me, SPELL_HEAL, false); Talk(SAY_HEAL); break; case EVENT_SHADOW_WAVE: - me->CastSpell(me->GetVictim(), SPELL_SHADOW_WAVE, false); + me->CastSpell(me->GetVictim(), SPELL_SHADOW_WAVE, false); events.ScheduleEvent(EVENT_SHADOW_WAVE, urand(11000, 16000)); break; case EVENT_ME_FIRST: @@ -141,16 +141,16 @@ class boss_dalliah_the_doomsayer : public CreatureScript if (soccothrates->IsAlive() && !soccothrates->IsInCombat()) soccothrates->AI()->Talk(SAY_AGGRO_DALLIAH_FIRST); break; - case EVENT_CHECK_HEALTH: - if (HealthBelowPct(25)) - { - if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES))) - soccothrates->AI()->Talk(SAY_DALLIAH_25_PERCENT); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; - } + case EVENT_CHECK_HEALTH: + if (HealthBelowPct(25)) + { + if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES))) + soccothrates->AI()->Talk(SAY_DALLIAH_25_PERCENT); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index fc1333e82..6a4397a0a 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -8,38 +8,38 @@ REWRITTEN BY XINEF enum Says { - SAY_INTRO = 0, - SAY_AGGRO = 1, - SAY_KILL = 2, - SAY_MIND = 3, - SAY_FEAR = 4, - SAY_IMAGE = 5, - SAY_DEATH = 6 + SAY_INTRO = 0, + SAY_AGGRO = 1, + SAY_KILL = 2, + SAY_MIND = 3, + SAY_FEAR = 4, + SAY_IMAGE = 5, + SAY_DEATH = 6 }; enum Spells { - SPELL_FEAR = 39415, - SPELL_MIND_REND = 36924, - SPELL_DOMINATION = 37162, - SPELL_MANA_BURN = 39020, - SPELL_66_ILLUSION = 36931, - SPELL_33_ILLUSION = 36932, + SPELL_FEAR = 39415, + SPELL_MIND_REND = 36924, + SPELL_DOMINATION = 37162, + SPELL_MANA_BURN = 39020, + SPELL_66_ILLUSION = 36931, + SPELL_33_ILLUSION = 36932, - SPELL_MIND_REND_IMAGE = 36929, - H_SPELL_MIND_REND_IMAGE = 39021 + SPELL_MIND_REND_IMAGE = 36929, + H_SPELL_MIND_REND_IMAGE = 39021 }; enum Misc { - NPC_HARBINGER_SKYRISS_66 = 21466, + NPC_HARBINGER_SKYRISS_66 = 21466, - EVENT_SUMMON_IMAGE1 = 1, - EVENT_SUMMON_IMAGE2 = 2, - EVENT_SPELL_MIND_REND = 3, - EVENT_SPELL_FEAR = 4, - EVENT_SPELL_DOMINATION = 5, - EVENT_SPELL_MANA_BURN = 6 + EVENT_SUMMON_IMAGE1 = 1, + EVENT_SUMMON_IMAGE2 = 2, + EVENT_SPELL_MIND_REND = 3, + EVENT_SPELL_FEAR = 4, + EVENT_SPELL_DOMINATION = 5, + EVENT_SPELL_MANA_BURN = 6 }; class boss_harbinger_skyriss : public CreatureScript @@ -51,53 +51,53 @@ class boss_harbinger_skyriss : public CreatureScript { boss_harbinger_skyrissAI(Creature* creature) : ScriptedAI(creature), summons(me) { - instance = creature->GetInstanceScript(); + instance = creature->GetInstanceScript(); } - InstanceScript* instance; - SummonList summons; - EventMap events; + InstanceScript* instance; + SummonList summons; + EventMap events; void Reset() { - events.Reset(); - summons.DespawnAll(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + events.Reset(); + summons.DespawnAll(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); } void EnterCombat(Unit* /*who*/) - { - Talk(SAY_AGGRO); - me->SetInCombatWithZone(); + { + Talk(SAY_AGGRO); + me->SetInCombatWithZone(); - events.ScheduleEvent(EVENT_SUMMON_IMAGE1, 1000); - events.ScheduleEvent(EVENT_SUMMON_IMAGE2, 1000); - events.ScheduleEvent(EVENT_SPELL_MIND_REND, 10000); - events.ScheduleEvent(EVENT_SPELL_FEAR, 15000); - events.ScheduleEvent(EVENT_SPELL_DOMINATION, 30000); - if (IsHeroic()) - events.ScheduleEvent(EVENT_SPELL_MANA_BURN, 25000); - } + events.ScheduleEvent(EVENT_SUMMON_IMAGE1, 1000); + events.ScheduleEvent(EVENT_SUMMON_IMAGE2, 1000); + events.ScheduleEvent(EVENT_SPELL_MIND_REND, 10000); + events.ScheduleEvent(EVENT_SPELL_FEAR, 15000); + events.ScheduleEvent(EVENT_SPELL_DOMINATION, 30000); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SPELL_MANA_BURN, 25000); + } void JustDied(Unit* /*killer*/) { Talk(SAY_DEATH); - summons.DespawnAll(); + summons.DespawnAll(); } void JustSummoned(Creature* summon) { - summon->SetHealth(summon->CountPctFromMaxHealth(summon->GetEntry() == NPC_HARBINGER_SKYRISS_66 ? 66 : 33)); - summons.Summon(summon); - summon->SetInCombatWithZone(); - me->UpdatePosition(*summon, true); - me->SendMovementFlagUpdate(); + summon->SetHealth(summon->CountPctFromMaxHealth(summon->GetEntry() == NPC_HARBINGER_SKYRISS_66 ? 66 : 33)); + summons.Summon(summon); + summon->SetInCombatWithZone(); + me->UpdatePosition(*summon, true); + me->SendMovementFlagUpdate(); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); } void UpdateAI(uint32 diff) @@ -105,57 +105,57 @@ class boss_harbinger_skyriss : public CreatureScript if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SUMMON_IMAGE1: - if (HealthBelowPct(67)) - { - Talk(SAY_IMAGE); - me->CastSpell(me, SPELL_66_ILLUSION, false); - break; - } - events.ScheduleEvent(EVENT_SUMMON_IMAGE1, 1000); - break; - case EVENT_SUMMON_IMAGE2: - if (HealthBelowPct(34)) - { - Talk(SAY_IMAGE); - me->CastSpell(me, SPELL_33_ILLUSION, false); - break; - } - events.ScheduleEvent(EVENT_SUMMON_IMAGE2, 1000); - break; - case EVENT_SPELL_MIND_REND: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f)) - me->CastSpell(target, SPELL_MIND_REND, false); - events.ScheduleEvent(EVENT_SPELL_MIND_REND, 10000); - break; - case EVENT_SPELL_FEAR: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 20.0f)) - { - Talk(SAY_FEAR); - me->CastSpell(target, SPELL_FEAR, false); - } - events.ScheduleEvent(EVENT_SPELL_FEAR, 25000); - break; - case EVENT_SPELL_DOMINATION: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 30.0f)) - { - Talk(SAY_MIND); - me->CastSpell(target, SPELL_DOMINATION, false); - } - events.ScheduleEvent(EVENT_SPELL_DOMINATION, 30000); - break; - case EVENT_SPELL_MANA_BURN: + switch (events.ExecuteEvent()) + { + case EVENT_SUMMON_IMAGE1: + if (HealthBelowPct(67)) + { + Talk(SAY_IMAGE); + me->CastSpell(me, SPELL_66_ILLUSION, false); + break; + } + events.ScheduleEvent(EVENT_SUMMON_IMAGE1, 1000); + break; + case EVENT_SUMMON_IMAGE2: + if (HealthBelowPct(34)) + { + Talk(SAY_IMAGE); + me->CastSpell(me, SPELL_33_ILLUSION, false); + break; + } + events.ScheduleEvent(EVENT_SUMMON_IMAGE2, 1000); + break; + case EVENT_SPELL_MIND_REND: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f)) + me->CastSpell(target, SPELL_MIND_REND, false); + events.ScheduleEvent(EVENT_SPELL_MIND_REND, 10000); + break; + case EVENT_SPELL_FEAR: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 20.0f)) + { + Talk(SAY_FEAR); + me->CastSpell(target, SPELL_FEAR, false); + } + events.ScheduleEvent(EVENT_SPELL_FEAR, 25000); + break; + case EVENT_SPELL_DOMINATION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 30.0f)) + { + Talk(SAY_MIND); + me->CastSpell(target, SPELL_DOMINATION, false); + } + events.ScheduleEvent(EVENT_SPELL_DOMINATION, 30000); + break; + case EVENT_SPELL_MANA_BURN: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, PowerUsersSelector(me, POWER_MANA, 40.0f, false))) - me->CastSpell(target, SPELL_MANA_BURN, false); - events.ScheduleEvent(EVENT_SPELL_MANA_BURN, 30000); - break; - } + me->CastSpell(target, SPELL_MANA_BURN, false); + events.ScheduleEvent(EVENT_SPELL_MANA_BURN, 30000); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp index c47ad9903..fef59b753 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp @@ -52,9 +52,9 @@ enum Events EVENT_PREFIGHT_9 = 11, EVENT_ME_FIRST = 12, EVENT_DALLIAH_DEATH = 13, - EVENT_CHECK_HEALTH = 14, - EVENT_SPELL_CHARGE = 15, - EVENT_FELFIRE = 16, + EVENT_CHECK_HEALTH = 14, + EVENT_SPELL_CHARGE = 15, + EVENT_FELFIRE = 16, }; class boss_wrath_scryer_soccothrates : public CreatureScript @@ -65,24 +65,24 @@ class boss_wrath_scryer_soccothrates : public CreatureScript struct boss_wrath_scryer_soccothratesAI : public BossAI { boss_wrath_scryer_soccothratesAI(Creature* creature) : BossAI(creature, DATA_SOCCOTHRATES) - { - preFight = instance->GetBossState(DATA_DALLIAH) == DONE; - } + { + preFight = instance->GetBossState(DATA_DALLIAH) == DONE; + } void Reset() { _Reset(); - events2.Reset(); - me->CastSpell(me, SPELL_FEL_IMMOLATION, true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + events2.Reset(); + me->CastSpell(me, SPELL_FEL_IMMOLATION, true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); } - void InitializeAI() - { - BossAI::InitializeAI(); - if (!preFight) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - } + void InitializeAI() + { + BossAI::InitializeAI(); + if (!preFight) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + } void JustDied(Unit* /*killer*/) { @@ -97,18 +97,18 @@ class boss_wrath_scryer_soccothrates : public CreatureScript void EnterCombat(Unit* /*who*/) { _EnterCombat(); - events2.Reset(); + events2.Reset(); events.ScheduleEvent(EVENT_FELFIRE_SHOCK, urand(12000, 14000)); events.ScheduleEvent(EVENT_KNOCK_AWAY, urand(11000, 12000)); events.ScheduleEvent(EVENT_ME_FIRST, 6000); - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); Talk(SAY_AGGRO); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void MoveInLineOfSight(Unit* who) @@ -129,9 +129,9 @@ class boss_wrath_scryer_soccothrates : public CreatureScript void UpdateAI(uint32 diff) { - events2.Update(diff); - switch (events2.ExecuteEvent()) - { + events2.Update(diff); + switch (events2.ExecuteEvent()) + { case EVENT_PREFIGHT_1: if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) dalliah->AI()->Talk(SAY_DALLIAH_CONVO_1); @@ -172,17 +172,17 @@ class boss_wrath_scryer_soccothrates : public CreatureScript if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) { dalliah->SetFacingToObject(me); - dalliah->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + dalliah->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); me->SetFacingToObject(dalliah); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); dalliah->SetHomePosition(dalliah->GetPositionX(), dalliah->GetPositionY(), dalliah->GetPositionZ(), 1.51737f); me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 4.725722f); } break; - case EVENT_DALLIAH_DEATH: + case EVENT_DALLIAH_DEATH: Talk(SAY_DALLIAH_DEATH); break; - } + } if (!UpdateVictim()) return; @@ -194,42 +194,42 @@ class boss_wrath_scryer_soccothrates : public CreatureScript switch (events.ExecuteEvent()) { case EVENT_FELFIRE_SHOCK: - me->CastSpell(me->GetVictim(), SPELL_FELFIRE_SHOCK, false); + me->CastSpell(me->GetVictim(), SPELL_FELFIRE_SHOCK, false); events.ScheduleEvent(EVENT_FELFIRE_SHOCK, urand(12000, 14000)); break; case EVENT_KNOCK_AWAY: - me->CastSpell(me, SPELL_KNOCK_AWAY, false); + me->CastSpell(me, SPELL_KNOCK_AWAY, false); Talk(SAY_KNOCK_AWAY); events.ScheduleEvent(EVENT_KNOCK_AWAY, urand(11000, 12000)); - events.ScheduleEvent(EVENT_SPELL_CHARGE, 4600); + events.ScheduleEvent(EVENT_SPELL_CHARGE, 4600); + break; + case EVENT_SPELL_CHARGE: + me->CastSpell(me, SPELL_CHARGE, true); + me->CastSpell(me, SPELL_FELFIRE, true); + events.ScheduleEvent(EVENT_FELFIRE, 300); + events.ScheduleEvent(EVENT_FELFIRE, 600); + events.ScheduleEvent(EVENT_FELFIRE, 900); + events.ScheduleEvent(EVENT_FELFIRE, 1200); + events.ScheduleEvent(EVENT_FELFIRE, 1500); + events.ScheduleEvent(EVENT_FELFIRE, 1800); + break; + case EVENT_FELFIRE: + me->CastSpell(me, SPELL_FELFIRE, true); break; - case EVENT_SPELL_CHARGE: - me->CastSpell(me, SPELL_CHARGE, true); - me->CastSpell(me, SPELL_FELFIRE, true); - events.ScheduleEvent(EVENT_FELFIRE, 300); - events.ScheduleEvent(EVENT_FELFIRE, 600); - events.ScheduleEvent(EVENT_FELFIRE, 900); - events.ScheduleEvent(EVENT_FELFIRE, 1200); - events.ScheduleEvent(EVENT_FELFIRE, 1500); - events.ScheduleEvent(EVENT_FELFIRE, 1800); - break; - case EVENT_FELFIRE: - me->CastSpell(me, SPELL_FELFIRE, true); - break; case EVENT_ME_FIRST: if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) if (dalliah->IsAlive() && !dalliah->IsInCombat()) dalliah->AI()->Talk(SAY_AGGRO_SOCCOTHRATES_FIRST); break; - case EVENT_CHECK_HEALTH: - if (HealthBelowPct(25)) - { - if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) - dalliah->AI()->Talk(SAY_SOCCOTHRATES_25_PERCENT); - break; - } - events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); - break; + case EVENT_CHECK_HEALTH: + if (HealthBelowPct(25)) + { + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + dalliah->AI()->Talk(SAY_SOCCOTHRATES_25_PERCENT); + break; + } + events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000); + break; } DoMeleeAttackIfReady(); @@ -237,7 +237,7 @@ class boss_wrath_scryer_soccothrates : public CreatureScript private: bool preFight; - EventMap events2; + EventMap events2; }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp index b5dc06378..822c4e44e 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp @@ -55,8 +55,8 @@ class boss_zereketh_the_unbound : public CreatureScript void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void UpdateAI(uint32 diff) @@ -72,18 +72,18 @@ class boss_zereketh_the_unbound : public CreatureScript { case EVENT_VOID_ZONE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true)) - me->CastSpell(target, SPELL_VOID_ZONE, false); + me->CastSpell(target, SPELL_VOID_ZONE, false); events.ScheduleEvent(EVENT_VOID_ZONE, 15000); break; case EVENT_SHADOW_NOVA: - me->CastSpell(me, SPELL_SHADOW_NOVA, false); - if (roll_chance_i(50)) - Talk(SAY_SHADOW_NOVA); + me->CastSpell(me, SPELL_SHADOW_NOVA, false); + if (roll_chance_i(50)) + Talk(SAY_SHADOW_NOVA); events.ScheduleEvent(EVENT_SHADOW_NOVA, 12000); break; case EVENT_SEED_OF_CORRUPTION: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) - me->CastSpell(target, SPELL_SEED_OF_CORRUPTION, false); + me->CastSpell(target, SPELL_SEED_OF_CORRUPTION, false); events.ScheduleEvent(EVENT_SEED_OF_CORRUPTION, 16000); break; } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp index ff2694145..54f4d92c8 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp @@ -102,10 +102,10 @@ class instance_arcatraz : public InstanceMapScript case DATA_WARDEN_3: case DATA_WARDEN_4: case DATA_WARDEN_5: - if (data < FAIL) - HandleGameObject(StasisPodGUIDs[type - DATA_WARDEN_1], data == IN_PROGRESS); - if (Creature* warden = instance->GetCreature(MellicharGUID)) - warden->AI()->SetData(type, data); + if (data < FAIL) + HandleGameObject(StasisPodGUIDs[type - DATA_WARDEN_1], data == IN_PROGRESS); + if (Creature* warden = instance->GetCreature(MellicharGUID)) + warden->AI()->SetData(type, data); break; } } @@ -141,7 +141,7 @@ class instance_arcatraz : public InstanceMapScript SetData(DATA_WARDEN_3, NOT_STARTED); SetData(DATA_WARDEN_4, NOT_STARTED); SetData(DATA_WARDEN_5, NOT_STARTED); - HandleGameObject(WardensShieldGUID, true); + HandleGameObject(WardensShieldGUID, true); } return true; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp index 62171608b..2136e7264 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_commander_sarannis.cpp @@ -29,7 +29,7 @@ enum Events { EVENT_ARCANE_RESONANCE = 1, EVENT_ARCANE_DEVASTATION = 2, - EVENT_HEALTH_CHECK = 3 + EVENT_HEALTH_CHECK = 3 }; class boss_commander_sarannis : public CreatureScript @@ -51,13 +51,13 @@ class boss_commander_sarannis : public CreatureScript Talk(SAY_AGGRO); events.ScheduleEvent(EVENT_ARCANE_RESONANCE, 20000); events.ScheduleEvent(EVENT_ARCANE_DEVASTATION, 10000); - events.ScheduleEvent(EVENT_HEALTH_CHECK, 500); + events.ScheduleEvent(EVENT_HEALTH_CHECK, 500); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) @@ -78,27 +78,27 @@ class boss_commander_sarannis : public CreatureScript switch (events.ExecuteEvent()) { case EVENT_ARCANE_RESONANCE: - if (roll_chance_i(50)) - Talk(SAY_ARCANE_RESONANCE); + if (roll_chance_i(50)) + Talk(SAY_ARCANE_RESONANCE); me->CastSpell(me->GetVictim(), SPELL_ARCANE_RESONANCE, false); events.ScheduleEvent(EVENT_ARCANE_RESONANCE, 27000); break; case EVENT_ARCANE_DEVASTATION: - if (roll_chance_i(50)) - Talk(SAY_ARCANE_DEVASTATION); - me->CastSpell(me->GetVictim(), SPELL_ARCANE_DEVASTATION, false); + if (roll_chance_i(50)) + Talk(SAY_ARCANE_DEVASTATION); + me->CastSpell(me->GetVictim(), SPELL_ARCANE_DEVASTATION, false); events.ScheduleEvent(EVENT_ARCANE_DEVASTATION, 17000); break; - case EVENT_HEALTH_CHECK: - if (me->HealthBelowPct(50)) - { - Talk(EMOTE_SUMMON); - Talk(SAY_SUMMON); - me->CastSpell(me, SPELL_SUMMON_REINFORCEMENTS, true); - break; - } - events.ScheduleEvent(EVENT_HEALTH_CHECK, 500); - break; + case EVENT_HEALTH_CHECK: + if (me->HealthBelowPct(50)) + { + Talk(EMOTE_SUMMON); + Talk(SAY_SUMMON); + me->CastSpell(me, SPELL_SUMMON_REINFORCEMENTS, true); + break; + } + events.ScheduleEvent(EVENT_HEALTH_CHECK, 500); + break; } DoMeleeAttackIfReady(); @@ -121,8 +121,8 @@ Position const PosSummonReinforcements[4] = enum Creatures { - NPC_SUMMONED_BLOODWARDER_MENDER = 20083, - NPC_SUMMONED_BLOODWARDER_RESERVIST = 20078 + NPC_SUMMONED_BLOODWARDER_MENDER = 20083, + NPC_SUMMONED_BLOODWARDER_RESERVIST = 20078 }; class spell_commander_sarannis_summon_reinforcements : public SpellScriptLoader diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp index 82c463ed3..ec5bf5430 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp @@ -8,33 +8,33 @@ REWRITTEN BY XINEF enum Says { - SAY_AGGRO = 0, - SAY_KILL = 1, - SAY_TREE = 2, - SAY_SUMMON = 3, - SAY_DEATH = 4, - SAY_OOC_RANDOM = 5 + SAY_AGGRO = 0, + SAY_KILL = 1, + SAY_TREE = 2, + SAY_SUMMON = 3, + SAY_DEATH = 4, + SAY_OOC_RANDOM = 5 }; enum Spells { - SPELL_TRANQUILITY = 34550, - SPELL_TREE_FORM = 34551, - SPELL_SUMMON_FRAYER = 34557, - SPELL_PLANT_WHITE = 34759, - SPELL_PLANT_GREEN = 34761, - SPELL_PLANT_BLUE = 34762, - SPELL_PLANT_RED = 34763 + SPELL_TRANQUILITY = 34550, + SPELL_TREE_FORM = 34551, + SPELL_SUMMON_FRAYER = 34557, + SPELL_PLANT_WHITE = 34759, + SPELL_PLANT_GREEN = 34761, + SPELL_PLANT_BLUE = 34762, + SPELL_PLANT_RED = 34763 }; enum Misc { - NPC_FRAYER = 19953, + NPC_FRAYER = 19953, - EVENT_SUMMON_SEEDLING = 1, - EVENT_TREE_FORM = 2, - EVENT_CHECK_FRAYERS = 3, - EVENT_RESTORE_COMBAT = 4 + EVENT_SUMMON_SEEDLING = 1, + EVENT_TREE_FORM = 2, + EVENT_CHECK_FRAYERS = 3, + EVENT_RESTORE_COMBAT = 4 }; class boss_high_botanist_freywinn : public CreatureScript @@ -51,88 +51,88 @@ class boss_high_botanist_freywinn : public CreatureScript void Reset() { - _Reset(); + _Reset(); } void EnterCombat(Unit* /*who*/) { - _EnterCombat(); + _EnterCombat(); Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_SUMMON_SEEDLING, 6000); - events.ScheduleEvent(EVENT_TREE_FORM, 30000); + events.ScheduleEvent(EVENT_SUMMON_SEEDLING, 6000); + events.ScheduleEvent(EVENT_TREE_FORM, 30000); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) { Talk(SAY_DEATH); - _JustDied(); + _JustDied(); } - void SummonedCreatureDies(Creature* summon, Unit*) - { - summons.Despawn(summon); - } + void SummonedCreatureDies(Creature* summon, Unit*) + { + summons.Despawn(summon); + } void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - events.Update(diff); - if (!events.IsInPhase(1) && me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (!events.IsInPhase(1) && me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SUMMON_SEEDLING: - if (roll_chance_i(20)) - Talk(SAY_OOC_RANDOM); - me->CastSpell(me, RAND(SPELL_PLANT_WHITE, SPELL_PLANT_GREEN, SPELL_PLANT_BLUE, SPELL_PLANT_RED), false); - events.ScheduleEvent(EVENT_SUMMON_SEEDLING, 6000); - break; - case EVENT_TREE_FORM: - events.Reset(); - events.SetPhase(1); - events.ScheduleEvent(EVENT_CHECK_FRAYERS, 1000); - events.ScheduleEvent(EVENT_TREE_FORM, 75000); - events.ScheduleEvent(EVENT_RESTORE_COMBAT, 46000); + switch (events.ExecuteEvent()) + { + case EVENT_SUMMON_SEEDLING: + if (roll_chance_i(20)) + Talk(SAY_OOC_RANDOM); + me->CastSpell(me, RAND(SPELL_PLANT_WHITE, SPELL_PLANT_GREEN, SPELL_PLANT_BLUE, SPELL_PLANT_RED), false); + events.ScheduleEvent(EVENT_SUMMON_SEEDLING, 6000); + break; + case EVENT_TREE_FORM: + events.Reset(); + events.SetPhase(1); + events.ScheduleEvent(EVENT_CHECK_FRAYERS, 1000); + events.ScheduleEvent(EVENT_TREE_FORM, 75000); + events.ScheduleEvent(EVENT_RESTORE_COMBAT, 46000); - Talk(SAY_TREE); - me->RemoveAllAuras(); - me->GetMotionMaster()->MoveIdle(); - me->GetMotionMaster()->Clear(false); + Talk(SAY_TREE); + me->RemoveAllAuras(); + me->GetMotionMaster()->MoveIdle(); + me->GetMotionMaster()->Clear(false); - me->CastSpell(me, SPELL_SUMMON_FRAYER, true); - me->CastSpell(me, SPELL_TRANQUILITY, true); - me->CastSpell(me, SPELL_TREE_FORM, true); - break; - case EVENT_RESTORE_COMBAT: - events.SetPhase(0); - events.ScheduleEvent(EVENT_SUMMON_SEEDLING, 6000); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - break; - case EVENT_CHECK_FRAYERS: - if (!summons.HasEntry(NPC_FRAYER)) - { - me->InterruptNonMeleeSpells(true); + me->CastSpell(me, SPELL_SUMMON_FRAYER, true); + me->CastSpell(me, SPELL_TRANQUILITY, true); + me->CastSpell(me, SPELL_TREE_FORM, true); + break; + case EVENT_RESTORE_COMBAT: + events.SetPhase(0); + events.ScheduleEvent(EVENT_SUMMON_SEEDLING, 6000); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + break; + case EVENT_CHECK_FRAYERS: + if (!summons.HasEntry(NPC_FRAYER)) + { + me->InterruptNonMeleeSpells(true); me->RemoveAllAuras(); - events.RescheduleEvent(EVENT_RESTORE_COMBAT, 0); - events.RescheduleEvent(EVENT_TREE_FORM, 30000); - break; - } - events.ScheduleEvent(EVENT_CHECK_FRAYERS, 500); - break; - } + events.RescheduleEvent(EVENT_RESTORE_COMBAT, 0); + events.RescheduleEvent(EVENT_TREE_FORM, 30000); + break; + } + events.ScheduleEvent(EVENT_CHECK_FRAYERS, 500); + break; + } - if (!events.IsInPhase(1)) - DoMeleeAttackIfReady(); + if (!events.IsInPhase(1)) + DoMeleeAttackIfReady(); } }; diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp index 5e8ee9723..1bbde7108 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp @@ -20,11 +20,11 @@ enum Spells SPELL_SUMMON_LASHER_4 = 34688, SPELL_SUMMON_FLAYER_3 = 34690, - SPELL_DAMAGE_IMMUNE_ARCANE = 34304, - SPELL_DAMAGE_IMMUNE_FIRE = 34305, - SPELL_DAMAGE_IMMUNE_FROST = 34306, - SPELL_DAMAGE_IMMUNE_NATURE = 34308, - SPELL_DAMAGE_IMMUNE_SHADOW = 34309 + SPELL_DAMAGE_IMMUNE_ARCANE = 34304, + SPELL_DAMAGE_IMMUNE_FIRE = 34305, + SPELL_DAMAGE_IMMUNE_FROST = 34306, + SPELL_DAMAGE_IMMUNE_NATURE = 34308, + SPELL_DAMAGE_IMMUNE_SHADOW = 34309 }; enum Misc @@ -36,10 +36,10 @@ enum Misc MODEL_FROST = 14112, MODEL_NATURE = 14214, - EVENT_ALERGIC_REACTION = 1, - EVENT_TRANSFORM = 2, - EVENT_TELEPORT = 3, - EVENT_SUMMON = 4 + EVENT_ALERGIC_REACTION = 1, + EVENT_TRANSFORM = 2, + EVENT_TELEPORT = 3, + EVENT_SUMMON = 4 }; class boss_laj : public CreatureScript @@ -54,15 +54,15 @@ class boss_laj : public CreatureScript void Reset() { - _Reset(); + _Reset(); me->SetDisplayId(MODEL_DEFAULT); - _lastTransform = SPELL_DAMAGE_IMMUNE_SHADOW; - me->CastSpell(me, SPELL_DAMAGE_IMMUNE_SHADOW, true); + _lastTransform = SPELL_DAMAGE_IMMUNE_SHADOW; + me->CastSpell(me, SPELL_DAMAGE_IMMUNE_SHADOW, true); } void DoTransform() { - me->RemoveAurasDueToSpell(_lastTransform); + me->RemoveAurasDueToSpell(_lastTransform); switch (_lastTransform = RAND(SPELL_DAMAGE_IMMUNE_SHADOW, SPELL_DAMAGE_IMMUNE_FIRE, SPELL_DAMAGE_IMMUNE_FROST, SPELL_DAMAGE_IMMUNE_NATURE, SPELL_DAMAGE_IMMUNE_ARCANE)) { @@ -73,16 +73,16 @@ class boss_laj : public CreatureScript case SPELL_DAMAGE_IMMUNE_NATURE: me->SetDisplayId(MODEL_NATURE); break; } - me->CastSpell(me, _lastTransform, true); + me->CastSpell(me, _lastTransform, true); } void EnterCombat(Unit* /*who*/) { - _EnterCombat(); + _EnterCombat(); - events.ScheduleEvent(EVENT_ALERGIC_REACTION, 5000); - events.ScheduleEvent(EVENT_TRANSFORM, 30000); - events.ScheduleEvent(EVENT_TELEPORT, 20000); + events.ScheduleEvent(EVENT_ALERGIC_REACTION, 5000); + events.ScheduleEvent(EVENT_TRANSFORM, 30000); + events.ScheduleEvent(EVENT_TELEPORT, 20000); } void UpdateAI(uint32 diff) @@ -90,36 +90,36 @@ class boss_laj : public CreatureScript if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ALERGIC_REACTION: - me->CastSpell(me->GetVictim(), SPELL_ALLERGIC_REACTION, false); - events.ScheduleEvent(EVENT_ALERGIC_REACTION, 25000); - break; - case EVENT_TELEPORT: - me->CastSpell(me, SPELL_TELEPORT_SELF, false); - events.ScheduleEvent(EVENT_SUMMON, 2500); - events.ScheduleEvent(EVENT_TELEPORT, 30000); - break; - case EVENT_SUMMON: - Talk(EMOTE_SUMMON); + switch (events.ExecuteEvent()) + { + case EVENT_ALERGIC_REACTION: + me->CastSpell(me->GetVictim(), SPELL_ALLERGIC_REACTION, false); + events.ScheduleEvent(EVENT_ALERGIC_REACTION, 25000); + break; + case EVENT_TELEPORT: + me->CastSpell(me, SPELL_TELEPORT_SELF, false); + events.ScheduleEvent(EVENT_SUMMON, 2500); + events.ScheduleEvent(EVENT_TELEPORT, 30000); + break; + case EVENT_SUMMON: + Talk(EMOTE_SUMMON); me->CastSpell(me, SPELL_SUMMON_LASHER_1, true); - me->CastSpell(me, SPELL_SUMMON_FLAYER_1, true); - break; - case EVENT_TRANSFORM: - DoTransform(); - events.ScheduleEvent(EVENT_TRANSFORM, 35000); - break; - } + me->CastSpell(me, SPELL_SUMMON_FLAYER_1, true); + break; + case EVENT_TRANSFORM: + DoTransform(); + events.ScheduleEvent(EVENT_TRANSFORM, 35000); + break; + } DoMeleeAttackIfReady(); } - private: - uint32 _lastTransform; + private: + uint32 _lastTransform; }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp index 0d894b592..8c7dc3c6d 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_thorngrin_the_tender.cpp @@ -16,13 +16,13 @@ enum Says SAY_CAST_HELLFIRE = 5, SAY_DEATH = 6, EMOTE_ENRAGE = 7, - SAY_INTRO = 8 + SAY_INTRO = 8 }; enum Spells { SPELL_SACRIFICE = 34661, - SPELL_HELLFIRE = 34659, + SPELL_HELLFIRE = 34659, SPELL_ENRAGE = 34670 }; @@ -31,8 +31,8 @@ enum Events EVENT_SACRIFICE = 1, EVENT_HELLFIRE = 2, EVENT_ENRAGE = 3, - EVENT_HEALTH_CHECK_50 = 4, - EVENT_HEALTH_CHECK_20 = 5 + EVENT_HEALTH_CHECK_50 = 4, + EVENT_HEALTH_CHECK_20 = 5 }; class boss_thorngrin_the_tender : public CreatureScript @@ -42,25 +42,25 @@ class boss_thorngrin_the_tender : public CreatureScript struct boss_thorngrin_the_tenderAI : public BossAI { boss_thorngrin_the_tenderAI(Creature* creature) : BossAI(creature, DATA_THORNGRIN_THE_TENDER) - { - me->m_SightDistance = 100.0f; - _intro = false; - } + { + me->m_SightDistance = 100.0f; + _intro = false; + } void Reset() { _Reset(); } - void MoveInLineOfSight(Unit* who) - { - if (!_intro && who->GetTypeId() == TYPEID_PLAYER) - { - _intro = true; - Talk(SAY_INTRO); - } - BossAI::MoveInLineOfSight(who); - } + void MoveInLineOfSight(Unit* who) + { + if (!_intro && who->GetTypeId() == TYPEID_PLAYER) + { + _intro = true; + Talk(SAY_INTRO); + } + BossAI::MoveInLineOfSight(who); + } void EnterCombat(Unit* /*who*/) @@ -70,14 +70,14 @@ class boss_thorngrin_the_tender : public CreatureScript events.ScheduleEvent(EVENT_SACRIFICE, 6000); events.ScheduleEvent(EVENT_HELLFIRE, 18000); events.ScheduleEvent(EVENT_ENRAGE, 15000); - events.ScheduleEvent(EVENT_HEALTH_CHECK_50, 500); - events.ScheduleEvent(EVENT_HEALTH_CHECK_20, 500); + events.ScheduleEvent(EVENT_HEALTH_CHECK_50, 500); + events.ScheduleEvent(EVENT_HEALTH_CHECK_20, 500); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); } void JustDied(Unit* /*killer*/) @@ -101,44 +101,44 @@ class boss_thorngrin_the_tender : public CreatureScript if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) { Talk(SAY_CAST_SACRIFICE); - me->CastSpell(target, SPELL_SACRIFICE, false); + me->CastSpell(target, SPELL_SACRIFICE, false); } events.ScheduleEvent(EVENT_SACRIFICE, 30000); break; case EVENT_HELLFIRE: - if (roll_chance_i(50)) - Talk(SAY_CAST_HELLFIRE); - me->CastSpell(me, SPELL_HELLFIRE, false); + if (roll_chance_i(50)) + Talk(SAY_CAST_HELLFIRE); + me->CastSpell(me, SPELL_HELLFIRE, false); events.ScheduleEvent(EVENT_HELLFIRE, 22000); break; case EVENT_ENRAGE: Talk(EMOTE_ENRAGE); - me->CastSpell(me, SPELL_ENRAGE, false); + me->CastSpell(me, SPELL_ENRAGE, false); events.ScheduleEvent(EVENT_ENRAGE, 30000); break; - case EVENT_HEALTH_CHECK_50: - if (me->HealthBelowPct(50)) - { - Talk(SAY_50_PERCENT_HP); - break; - } - events.ScheduleEvent(EVENT_HEALTH_CHECK_50, 500); - break; - case EVENT_HEALTH_CHECK_20: - if (me->HealthBelowPct(20)) - { - Talk(SAY_20_PERCENT_HP); - break; - } - events.ScheduleEvent(EVENT_HEALTH_CHECK_20, 500); - break; + case EVENT_HEALTH_CHECK_50: + if (me->HealthBelowPct(50)) + { + Talk(SAY_50_PERCENT_HP); + break; + } + events.ScheduleEvent(EVENT_HEALTH_CHECK_50, 500); + break; + case EVENT_HEALTH_CHECK_20: + if (me->HealthBelowPct(20)) + { + Talk(SAY_20_PERCENT_HP); + break; + } + events.ScheduleEvent(EVENT_HEALTH_CHECK_20, 500); + break; } DoMeleeAttackIfReady(); } private: - bool _intro; + bool _intro; }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index a009d4745..f06edb364 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -8,27 +8,27 @@ REWRITTEN BY XINEF enum Says { - SAY_AGGRO = 0, - SAY_SLAY = 1, - SAY_SUMMON = 2, - SAY_DEATH = 3 + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_SUMMON = 2, + SAY_DEATH = 3 }; enum Spells { - SPELL_WAR_STOMP = 34716, - SPELL_SUMMON_TREANTS = 34730, // 34727, 34730 - 34737, 34739 - SPELL_ARCANE_VOLLEY = 36705, + SPELL_WAR_STOMP = 34716, + SPELL_SUMMON_TREANTS = 34730, // 34727, 34730 - 34737, 34739 + SPELL_ARCANE_VOLLEY = 36705, - SPELL_SUMMON_SAPLINGS_SUMMON = 34730, - SPELL_SUMMON_SAPLINGS_PERIODIC = 34741 + SPELL_SUMMON_SAPLINGS_SUMMON = 34730, + SPELL_SUMMON_SAPLINGS_PERIODIC = 34741 }; enum Misc { - EVENT_ARCANE_VOLLEY = 1, - EVENT_WAR_STOMP = 2, - EVENT_SUMMON_TREANT = 3 + EVENT_ARCANE_VOLLEY = 1, + EVENT_WAR_STOMP = 2, + EVENT_SUMMON_TREANT = 3 }; class boss_warp_splinter : public CreatureScript @@ -42,28 +42,28 @@ class boss_warp_splinter : public CreatureScript void Reset() { - _Reset(); + _Reset(); } void EnterCombat(Unit* /*who*/) { - _EnterCombat(); + _EnterCombat(); Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_ARCANE_VOLLEY, 8000); - events.ScheduleEvent(EVENT_WAR_STOMP, 15000); - events.ScheduleEvent(EVENT_SUMMON_TREANT, 20000); + events.ScheduleEvent(EVENT_ARCANE_VOLLEY, 8000); + events.ScheduleEvent(EVENT_WAR_STOMP, 15000); + events.ScheduleEvent(EVENT_SUMMON_TREANT, 20000); } void KilledUnit(Unit* victim) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_SLAY); + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } void JustDied(Unit* /*killer*/) { - _JustDied(); + _JustDied(); Talk(SAY_DEATH); } @@ -72,28 +72,28 @@ class boss_warp_splinter : public CreatureScript if (!UpdateVictim()) return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_ARCANE_VOLLEY: - me->CastSpell(me, SPELL_ARCANE_VOLLEY, false); - events.ScheduleEvent(EVENT_ARCANE_VOLLEY, 20000); - break; - case EVENT_WAR_STOMP: - me->CastSpell(me, SPELL_WAR_STOMP, false); - events.ScheduleEvent(EVENT_WAR_STOMP, 30000); - break; - case EVENT_SUMMON_TREANT: - Talk(SAY_SUMMON); - me->CastSpell(me, SPELL_SUMMON_SAPLINGS_PERIODIC, true); - for (uint8 i = 0; i < 6; ++i) - me->CastSpell(me, SPELL_SUMMON_SAPLINGS_SUMMON+i, true); - events.ScheduleEvent(EVENT_SUMMON_TREANT, 40000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_ARCANE_VOLLEY: + me->CastSpell(me, SPELL_ARCANE_VOLLEY, false); + events.ScheduleEvent(EVENT_ARCANE_VOLLEY, 20000); + break; + case EVENT_WAR_STOMP: + me->CastSpell(me, SPELL_WAR_STOMP, false); + events.ScheduleEvent(EVENT_WAR_STOMP, 30000); + break; + case EVENT_SUMMON_TREANT: + Talk(SAY_SUMMON); + me->CastSpell(me, SPELL_SUMMON_SAPLINGS_PERIODIC, true); + for (uint8 i = 0; i < 6; ++i) + me->CastSpell(me, SPELL_SUMMON_SAPLINGS_SUMMON+i, true); + events.ScheduleEvent(EVENT_SUMMON_TREANT, 40000); + break; + } DoMeleeAttackIfReady(); } diff --git a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp index 1a7e2180d..e41a934fd 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/instance_the_botanica.cpp @@ -15,7 +15,7 @@ class instance_the_botanica : public InstanceMapScript { instance_the_botanica_InstanceMapScript(Map* map) : InstanceScript(map) { - SetBossNumber(MAX_ENCOUNTER); + SetBossNumber(MAX_ENCOUNTER); } bool SetBossState(uint32 type, EncounterState state) @@ -85,42 +85,42 @@ public: { PrepareAuraScript(spell_botanica_call_of_the_falcon_AuraScript) - bool Load() - { - _falconSet.clear(); - return true; - } - - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + bool Load() { - std::list creatureList; - GetUnitOwner()->GetCreaturesWithEntryInRange(creatureList, 80.0f, NPC_BLOODFALCON); - for (std::list::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) - { - (*itr)->TauntApply(GetUnitOwner()); - (*itr)->AddThreat(GetUnitOwner(), 10000000.0f); - _falconSet.insert((*itr)->GetGUID()); - } + _falconSet.clear(); + return true; + } + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + std::list creatureList; + GetUnitOwner()->GetCreaturesWithEntryInRange(creatureList, 80.0f, NPC_BLOODFALCON); + for (std::list::const_iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) + { + (*itr)->TauntApply(GetUnitOwner()); + (*itr)->AddThreat(GetUnitOwner(), 10000000.0f); + _falconSet.insert((*itr)->GetGUID()); + } } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - for (std::set::const_iterator itr = _falconSet.begin(); itr != _falconSet.end(); ++itr) - if (Creature* falcon = ObjectAccessor::GetCreature(*GetUnitOwner(), *itr)) - { - falcon->TauntFadeOut(GetUnitOwner()); - falcon->AddThreat(GetUnitOwner(), -10000000.0f); - } + for (std::set::const_iterator itr = _falconSet.begin(); itr != _falconSet.end(); ++itr) + if (Creature* falcon = ObjectAccessor::GetCreature(*GetUnitOwner(), *itr)) + { + falcon->TauntFadeOut(GetUnitOwner()); + falcon->AddThreat(GetUnitOwner(), -10000000.0f); + } } void Register() { OnEffectApply += AuraEffectApplyFn(spell_botanica_call_of_the_falcon_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_botanica_call_of_the_falcon_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_botanica_call_of_the_falcon_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } - private: - std::set _falconSet; + private: + std::set _falconSet; }; AuraScript* GetAuraScript() const @@ -138,52 +138,52 @@ class spell_botanica_shift_form : public SpellScriptLoader { PrepareAuraScript(spell_botanica_shift_form_AuraScript); - bool Load() - { - _lastSchool = 0; - _lastForm = 0; - _swapTime = 0; - return true; - } - - bool CheckProc(ProcEventInfo& eventInfo) + bool Load() { - if (SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo()) - { - if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > time(NULL)) - return false; + _lastSchool = 0; + _lastForm = 0; + _swapTime = 0; + return true; + } - uint32 form = 0; - switch (GetFirstSchoolInMask(spellInfo->GetSchoolMask())) - { - case SPELL_SCHOOL_FIRE: form = SPELL_FIRE_FORM; break; - case SPELL_SCHOOL_FROST: form = SPELL_FROST_FORM; break; - case SPELL_SCHOOL_ARCANE: form = SPELL_ARCANE_FORM; break; - case SPELL_SCHOOL_SHADOW: form = SPELL_SHADOW_FORM; break; - } + bool CheckProc(ProcEventInfo& eventInfo) + { + if (SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo()) + { + if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > time(NULL)) + return false; - if (form) - { - _swapTime = time(NULL) + 6; - _lastSchool = spellInfo->GetSchoolMask(); - GetUnitOwner()->RemoveAurasDueToSpell(_lastForm); - _lastForm = form; - GetUnitOwner()->CastSpell(GetUnitOwner(), _lastForm, true); - } - } + uint32 form = 0; + switch (GetFirstSchoolInMask(spellInfo->GetSchoolMask())) + { + case SPELL_SCHOOL_FIRE: form = SPELL_FIRE_FORM; break; + case SPELL_SCHOOL_FROST: form = SPELL_FROST_FORM; break; + case SPELL_SCHOOL_ARCANE: form = SPELL_ARCANE_FORM; break; + case SPELL_SCHOOL_SHADOW: form = SPELL_SHADOW_FORM; break; + } - return false; + if (form) + { + _swapTime = time(NULL) + 6; + _lastSchool = spellInfo->GetSchoolMask(); + GetUnitOwner()->RemoveAurasDueToSpell(_lastForm); + _lastForm = form; + GetUnitOwner()->CastSpell(GetUnitOwner(), _lastForm, true); + } + } + + return false; } void Register() { - DoCheckProc += AuraCheckProcFn(spell_botanica_shift_form_AuraScript::CheckProc); + DoCheckProc += AuraCheckProcFn(spell_botanica_shift_form_AuraScript::CheckProc); } - private: - uint32 _lastSchool; - uint32 _lastForm; - uint32 _swapTime; + private: + uint32 _lastSchool; + uint32 _lastForm; + uint32 _swapTime; }; AuraScript* GetAuraScript() const @@ -195,6 +195,6 @@ class spell_botanica_shift_form : public SpellScriptLoader void AddSC_instance_the_botanica() { new instance_the_botanica(); - new spell_botanica_call_of_the_falcon(); - new spell_botanica_shift_form(); + new spell_botanica_call_of_the_falcon(); + new spell_botanica_shift_form(); } diff --git a/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h b/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h index b1fc8e777..386bfcf42 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h +++ b/src/server/scripts/Outland/TempestKeep/botanica/the_botanica.h @@ -12,7 +12,7 @@ enum DataTypes DATA_THORNGRIN_THE_TENDER = 2, DATA_LAJ = 3, DATA_WARP_SPLINTER = 4, - MAX_ENCOUNTER = 5 + MAX_ENCOUNTER = 5 }; enum CreatureIds @@ -23,15 +23,15 @@ enum CreatureIds NPC_LAJ = 17980, NPC_WARP_SPLINTER = 17977, - NPC_BLOODFALCON = 18155 + NPC_BLOODFALCON = 18155 }; enum SpellIds { - SPELL_ARCANE_FORM = 34204, - SPELL_FIRE_FORM = 34203, - SPELL_FROST_FORM = 34202, - SPELL_SHADOW_FORM = 34205 + SPELL_ARCANE_FORM = 34204, + SPELL_FIRE_FORM = 34203, + SPELL_FROST_FORM = 34202, + SPELL_SHADOW_FORM = 34205 }; #endif diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index 89bf0c416..eba2bf35b 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -44,12 +44,12 @@ EndContentData */ // Ours enum deathsDoorWrapGate { - SPELL_ARTILLERY_ON_THE_WRAP_GATE = 39221, - SPELL_ANTI_DEMON_FLAME_THROWER = 39222, - NPC_NORTH_GATE = 22471, - NPC_SOUTH_GATE = 22472, - NPC_NORTH_GATE_CREDIT = 22503, - NPC_SOUTH_GATE_CREDIT = 22504, + SPELL_ARTILLERY_ON_THE_WRAP_GATE = 39221, + SPELL_ANTI_DEMON_FLAME_THROWER = 39222, + NPC_NORTH_GATE = 22471, + NPC_SOUTH_GATE = 22472, + NPC_NORTH_GATE_CREDIT = 22503, + NPC_SOUTH_GATE_CREDIT = 22504, }; @@ -63,57 +63,57 @@ public: return new npc_deahts_door_wrap_gateAI(creature); } - struct npc_deahts_door_wrap_gateAI : public ScriptedAI - { - npc_deahts_door_wrap_gateAI(Creature *c) : ScriptedAI(c) - { - } + struct npc_deahts_door_wrap_gateAI : public ScriptedAI + { + npc_deahts_door_wrap_gateAI(Creature *c) : ScriptedAI(c) + { + } - uint8 count; - uint32 timer; - void Reset() { count = 0; timer = 0;} - void SpellHit(Unit* caster, SpellInfo const* spellInfo) - { - if (spellInfo->Id == SPELL_ARTILLERY_ON_THE_WRAP_GATE) - { - Player* plr = caster->GetCharmerOrOwnerPlayerOrPlayerItself(); - if (!plr) - return; + uint8 count; + uint32 timer; + void Reset() { count = 0; timer = 0;} + void SpellHit(Unit* caster, SpellInfo const* spellInfo) + { + if (spellInfo->Id == SPELL_ARTILLERY_ON_THE_WRAP_GATE) + { + Player* plr = caster->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (!plr) + return; - timer = 1; - count++; + timer = 1; + count++; - if (count >= 6) - { - if (me->GetEntry() == NPC_SOUTH_GATE) - plr->KilledMonsterCredit(NPC_SOUTH_GATE_CREDIT, 0); - else - plr->KilledMonsterCredit(NPC_NORTH_GATE_CREDIT, 0); + if (count >= 6) + { + if (me->GetEntry() == NPC_SOUTH_GATE) + plr->KilledMonsterCredit(NPC_SOUTH_GATE_CREDIT, 0); + else + plr->KilledMonsterCredit(NPC_NORTH_GATE_CREDIT, 0); - Reset(); - } - } - } + Reset(); + } + } + } - void UpdateAI(uint32 diff) - { - if (timer) - { - timer += diff; - if ((timer >= 0 && timer < 10000) || (timer >= 20000 && timer < 30000)) - { - for (uint8 i = 0; i < 3; ++i) - if (Creature* cr = me->SummonCreature((roll_chance_i(50) ? 22474 : 22500), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - if (Unit* target = cr->SelectNearbyTarget(NULL, 50.0f)) - cr->AI()->AttackStart(target); + void UpdateAI(uint32 diff) + { + if (timer) + { + timer += diff; + if ((timer >= 0 && timer < 10000) || (timer >= 20000 && timer < 30000)) + { + for (uint8 i = 0; i < 3; ++i) + if (Creature* cr = me->SummonCreature((roll_chance_i(50) ? 22474 : 22500), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + if (Unit* target = cr->SelectNearbyTarget(NULL, 50.0f)) + cr->AI()->AttackStart(target); - timer += 10000; - if (timer >= 30000) - timer = 0; - } - } - } - }; + timer += 10000; + if (timer >= 30000) + timer = 0; + } + } + } + }; }; class spell_npc22275_crystal_prison : public SpellScriptLoader @@ -127,14 +127,14 @@ class spell_npc22275_crystal_prison : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); - SetDuration(0); - GetTarget()->CastSpell(GetTarget(), 40898, true); + PreventDefaultAction(); + SetDuration(0); + GetTarget()->CastSpell(GetTarget(), 40898, true); } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_npc22275_crystal_prison_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_npc22275_crystal_prison_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -1052,11 +1052,11 @@ class spell_oscillating_field : public SpellScriptLoader void AddSC_blades_edge_mountains() { - // Ours - new npc_deahts_door_wrap_gate(); - new spell_npc22275_crystal_prison(); + // Ours + new npc_deahts_door_wrap_gate(); + new spell_npc22275_crystal_prison(); - // Theirs + // Theirs new npc_nether_drake(); new npc_daranelle(); new npc_simon_bunny(); diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index 4c6264d02..c6d428177 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -56,14 +56,14 @@ class spell_q10935_the_exorcism_of_colonel_jules : public SpellScriptLoader return; if (GetCaster()->IsHostileTo(target)) - GetCaster()->CastSpell(target, 39323 /*SPELL_HOLY_FIRE*/, true); - else - GetCaster()->CastSpell(target, 39322 /*SPELL_HEAL_BARADA*/, true); + GetCaster()->CastSpell(target, 39323 /*SPELL_HOLY_FIRE*/, true); + else + GetCaster()->CastSpell(target, 39322 /*SPELL_HEAL_BARADA*/, true); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_q10935_the_exorcism_of_colonel_jules_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_q10935_the_exorcism_of_colonel_jules_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -191,8 +191,8 @@ public: void Reset() { ryga = NULL; - me->CastSpell(me, SPELL_ANCESTRAL_WOLF_BUFF, false); - me->SetReactState(REACT_PASSIVE); + me->CastSpell(me, SPELL_ANCESTRAL_WOLF_BUFF, false); + me->SetReactState(REACT_PASSIVE); } void MoveInLineOfSight(Unit* who) @@ -207,7 +207,7 @@ public: void WaypointReached(uint32 waypointId) { - me->CastSpell(me, SPELL_ANCESTRAL_WOLF_BUFF, false); + me->CastSpell(me, SPELL_ANCESTRAL_WOLF_BUFF, false); switch (waypointId) { case 0: @@ -398,10 +398,10 @@ public: void AddSC_hellfire_peninsula() { - // Ours - new spell_q10935_the_exorcism_of_colonel_jules(); + // Ours + new spell_q10935_the_exorcism_of_colonel_jules(); - // Theirs + // Theirs new npc_aeranas(); new npc_ancestral_wolf(); new npc_wounded_blood_elf(); diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp index 6815f322e..ad039a436 100644 --- a/src/server/scripts/Outland/zone_nagrand.cpp +++ b/src/server/scripts/Outland/zone_nagrand.cpp @@ -418,7 +418,7 @@ public: bool OnQuestAccept(Player* player, Creature* creature, const Quest* quest) { if (quest->GetQuestId() == QUEST_TOTEM_KARDASH_A) - creature->AI()->SetGUID(player->GetGUID(), quest->GetQuestId()); + creature->AI()->SetGUID(player->GetGUID(), quest->GetQuestId()); return true; } @@ -436,8 +436,8 @@ public: uint32 HealTimer; uint32 FrostShockTimer; - void SetGUID(uint64 guid, int32 questId) - { + void SetGUID(uint64 guid, int32 questId) + { me->SetStandState(UNIT_STAND_STATE_STAND); Start(true, false, guid); Talk(SAY_KUR_START); @@ -445,7 +445,7 @@ public: me->SummonCreature(NPC_KUR_MURK_RAIDER, kurenaiAmbushA[0]+2.5f, kurenaiAmbushA[1]-2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 50000); me->SummonCreature(NPC_KUR_MURK_BRUTE, kurenaiAmbushA[0]-2.5f, kurenaiAmbushA[1]+2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 50000); me->SummonCreature(NPC_KUR_MURK_SCAVENGER, kurenaiAmbushA[0], kurenaiAmbushA[1], kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 50000); - } + } void Reset() { diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index 39f95e8d7..317838f15 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -40,261 +40,261 @@ EndContentData */ // Ours enum saeed { - NPC_PROTECTORATE_AVENGER = 21805, - NPC_PROTECTORATE_DEFENDER = 20984, - NPC_DIMENSIUS = 19554, + NPC_PROTECTORATE_AVENGER = 21805, + NPC_PROTECTORATE_DEFENDER = 20984, + NPC_DIMENSIUS = 19554, - EVENT_START_WALK = 1, - EVENT_START_FIGHT1 = 2, - EVENT_START_FIGHT2 = 3, + EVENT_START_WALK = 1, + EVENT_START_FIGHT1 = 2, + EVENT_START_FIGHT2 = 3, - DATA_START_ENCOUNTER = 1, - DATA_START_FIGHT = 2, + DATA_START_ENCOUNTER = 1, + DATA_START_FIGHT = 2, - SAY_SAEED_0 = 0, - SAY_SAEED_1 = 1, - SAY_SAEED_2 = 2, - SAY_SAEED_3 = 3, - SAY_DIMENSISIUS_1 = 1, + SAY_SAEED_0 = 0, + SAY_SAEED_1 = 1, + SAY_SAEED_2 = 2, + SAY_SAEED_3 = 3, + SAY_DIMENSISIUS_1 = 1, - QUEST_DIMENSIUS_DEVOURING = 10439, + QUEST_DIMENSIUS_DEVOURING = 10439, - SPELL_DIMENSIUS_TRANSFORM = 35939 + SPELL_DIMENSIUS_TRANSFORM = 35939 }; class npc_captain_saeed : public CreatureScript { - public: - npc_captain_saeed() : CreatureScript("npc_captain_saeed") { } + public: + npc_captain_saeed() : CreatureScript("npc_captain_saeed") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_captain_saeedAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_captain_saeedAI(creature); + } - struct npc_captain_saeedAI : public npc_escortAI - { - npc_captain_saeedAI(Creature* creature) : npc_escortAI(creature), summons(me) {} + struct npc_captain_saeedAI : public npc_escortAI + { + npc_captain_saeedAI(Creature* creature) : npc_escortAI(creature), summons(me) {} - SummonList summons; - EventMap events; - bool started, fight; + SummonList summons; + EventMap events; + bool started, fight; - void Reset() - { - if (!summons.empty()) - { - for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) - if (Creature* cr = ObjectAccessor::GetCreature(*me, *itr)) - { - float x, y, z, o; - cr->GetRespawnPosition(x, y, z, &o); - cr->SetHomePosition(x, y, z, o); - } - } - events.Reset(); - summons.clear(); - started = false; - fight = false; - me->RestoreFaction(); - } + void Reset() + { + if (!summons.empty()) + { + for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (Creature* cr = ObjectAccessor::GetCreature(*me, *itr)) + { + float x, y, z, o; + cr->GetRespawnPosition(x, y, z, &o); + cr->SetHomePosition(x, y, z, o); + } + } + events.Reset(); + summons.clear(); + started = false; + fight = false; + me->RestoreFaction(); + } - void MoveInLineOfSight(Unit* who) - { - if (Player* player = GetPlayerForEscort()) - if (me->GetDistance(who) < 10.0f && !me->GetVictim()) - if (player->IsValidAttackTarget(who)) - { - AttackStart(who); - return; - } + void MoveInLineOfSight(Unit* who) + { + if (Player* player = GetPlayerForEscort()) + if (me->GetDistance(who) < 10.0f && !me->GetVictim()) + if (player->IsValidAttackTarget(who)) + { + AttackStart(who); + return; + } - npc_escortAI::MoveInLineOfSight(who); - } + npc_escortAI::MoveInLineOfSight(who); + } - void SetGUID(uint64 playerGUID, int32 type) - { - if (type == DATA_START_ENCOUNTER) - { - Start(true, true, playerGUID); - SetEscortPaused(true); - started = true; + void SetGUID(uint64 playerGUID, int32 type) + { + if (type == DATA_START_ENCOUNTER) + { + Start(true, true, playerGUID); + SetEscortPaused(true); + started = true; - std::list cl; - me->GetCreaturesWithEntryInRange(cl, 20.0f, NPC_PROTECTORATE_AVENGER); - for (std::list::iterator itr = cl.begin(); itr != cl.end(); ++itr) - { - summons.Summon(*itr); - (*itr)->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - (*itr)->setFaction(250); - } - cl.clear(); - me->GetCreaturesWithEntryInRange(cl, 20.0f, NPC_PROTECTORATE_DEFENDER); - for (std::list::iterator itr = cl.begin(); itr != cl.end(); ++itr) - { - summons.Summon(*itr); - (*itr)->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - (*itr)->setFaction(250); - } + std::list cl; + me->GetCreaturesWithEntryInRange(cl, 20.0f, NPC_PROTECTORATE_AVENGER); + for (std::list::iterator itr = cl.begin(); itr != cl.end(); ++itr) + { + summons.Summon(*itr); + (*itr)->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + (*itr)->setFaction(250); + } + cl.clear(); + me->GetCreaturesWithEntryInRange(cl, 20.0f, NPC_PROTECTORATE_DEFENDER); + for (std::list::iterator itr = cl.begin(); itr != cl.end(); ++itr) + { + summons.Summon(*itr); + (*itr)->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + (*itr)->setFaction(250); + } - me->setFaction(250); - Talk(SAY_SAEED_0); - events.ScheduleEvent(EVENT_START_WALK, 3000); - } - else if (type == DATA_START_FIGHT) - { - Talk(SAY_SAEED_2); - SetEscortPaused(false); - me->SetUInt32Value(UNIT_NPC_FLAGS, 0); - } - } + me->setFaction(250); + Talk(SAY_SAEED_0); + events.ScheduleEvent(EVENT_START_WALK, 3000); + } + else if (type == DATA_START_FIGHT) + { + Talk(SAY_SAEED_2); + SetEscortPaused(false); + me->SetUInt32Value(UNIT_NPC_FLAGS, 0); + } + } - void EnterEvadeMode() - { - if (fight) - SetEscortPaused(false); + void EnterEvadeMode() + { + if (fight) + SetEscortPaused(false); - SummonsAction(NULL); - npc_escortAI::EnterEvadeMode(); - } + SummonsAction(NULL); + npc_escortAI::EnterEvadeMode(); + } - void SummonsAction(Unit* who) - { - float i = 0; - for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr, i += 1.0f) - if (Creature* cr = ObjectAccessor::GetCreature(*me, *itr)) - { - if (who == NULL) - { - cr->GetMotionMaster()->Clear(false); - cr->GetMotionMaster()->MoveFollow(me, 2.0f, M_PI/2.0f + (i / summons.size() * M_PI)); - } - else - { - cr->SetHomePosition(cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ(), cr->GetOrientation()); - cr->AI()->AttackStart(who); - } - } - } + void SummonsAction(Unit* who) + { + float i = 0; + for (std::list::iterator itr = summons.begin(); itr != summons.end(); ++itr, i += 1.0f) + if (Creature* cr = ObjectAccessor::GetCreature(*me, *itr)) + { + if (who == NULL) + { + cr->GetMotionMaster()->Clear(false); + cr->GetMotionMaster()->MoveFollow(me, 2.0f, M_PI/2.0f + (i / summons.size() * M_PI)); + } + else + { + cr->SetHomePosition(cr->GetPositionX(), cr->GetPositionY(), cr->GetPositionZ(), cr->GetOrientation()); + cr->AI()->AttackStart(who); + } + } + } - void WaypointReached(uint32 i) - { - Player* player = GetPlayerForEscort(); - if (!player) - return; + void WaypointReached(uint32 i) + { + Player* player = GetPlayerForEscort(); + if (!player) + return; - switch (i) - { - case 16: - Talk(SAY_SAEED_1); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetEscortPaused(true); - break; - case 18: - events.ScheduleEvent(EVENT_START_FIGHT1, 0); - SetEscortPaused(true); - break; - case 19: - summons.DespawnAll(); - break; - } - } + switch (i) + { + case 16: + Talk(SAY_SAEED_1); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetEscortPaused(true); + break; + case 18: + events.ScheduleEvent(EVENT_START_FIGHT1, 0); + SetEscortPaused(true); + break; + case 19: + summons.DespawnAll(); + break; + } + } - void EnterCombat(Unit* who) - { - SummonsAction(who); - } + void EnterCombat(Unit* who) + { + SummonsAction(who); + } - void JustDied(Unit* /*killer*/) - { - Player* player = GetPlayerForEscort(); - if (player) - player->FailQuest(QUEST_DIMENSIUS_DEVOURING); + void JustDied(Unit* /*killer*/) + { + Player* player = GetPlayerForEscort(); + if (player) + player->FailQuest(QUEST_DIMENSIUS_DEVOURING); - summons.DespawnAll(); - } + summons.DespawnAll(); + } - void CorpseRemoved(uint32&) - { - summons.DespawnAll(); - } + void CorpseRemoved(uint32&) + { + summons.DespawnAll(); + } - uint32 GetData(uint32 data) const - { - if (data == 1) - return (uint32)started; + uint32 GetData(uint32 data) const + { + if (data == 1) + return (uint32)started; - return 0; - } + return 0; + } - void UpdateAI(uint32 diff) - { - npc_escortAI::UpdateAI(diff); + void UpdateAI(uint32 diff) + { + npc_escortAI::UpdateAI(diff); - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_START_WALK: - SummonsAction(NULL); - SetEscortPaused(false); - break; - case EVENT_START_FIGHT1: - Talk(SAY_SAEED_3); - events.ScheduleEvent(EVENT_START_FIGHT2, 3000); - break; - case EVENT_START_FIGHT2: - if (Creature* dimensius = me->FindNearestCreature(NPC_DIMENSIUS, 50.0f)) - { - dimensius->RemoveAurasDueToSpell(SPELL_DIMENSIUS_TRANSFORM); - dimensius->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - AttackStart(dimensius); - fight = true; - } - break; - } + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_START_WALK: + SummonsAction(NULL); + SetEscortPaused(false); + break; + case EVENT_START_FIGHT1: + Talk(SAY_SAEED_3); + events.ScheduleEvent(EVENT_START_FIGHT2, 3000); + break; + case EVENT_START_FIGHT2: + if (Creature* dimensius = me->FindNearestCreature(NPC_DIMENSIUS, 50.0f)) + { + dimensius->RemoveAurasDueToSpell(SPELL_DIMENSIUS_TRANSFORM); + dimensius->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + AttackStart(dimensius); + fight = true; + } + break; + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } + }; - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) - { - player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - creature->AI()->SetGUID(player->GetGUID(), DATA_START_ENCOUNTER); - player->KilledMonsterCredit(creature->GetEntry(), 0); - } - else if (uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - creature->AI()->SetGUID(player->GetGUID(), DATA_START_FIGHT); - } + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + { + player->PlayerTalkClass->ClearMenus(); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + creature->AI()->SetGUID(player->GetGUID(), DATA_START_ENCOUNTER); + player->KilledMonsterCredit(creature->GetEntry(), 0); + } + else if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + creature->AI()->SetGUID(player->GetGUID(), DATA_START_FIGHT); + } - player->CLOSE_GOSSIP_MENU(); - return true; - } + player->CLOSE_GOSSIP_MENU(); + return true; + } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); + bool OnGossipHello(Player* player, Creature* creature) + { + if (creature->IsQuestGiver()) + player->PrepareQuestMenu(creature->GetGUID()); - if (player->GetQuestStatus(QUEST_DIMENSIUS_DEVOURING) == QUEST_STATUS_INCOMPLETE) - { - if (!creature->AI()->GetData(1)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Let's move out.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - else - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Let's start the battle.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - } + if (player->GetQuestStatus(QUEST_DIMENSIUS_DEVOURING) == QUEST_STATUS_INCOMPLETE) + { + if (!creature->AI()->GetData(1)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Let's move out.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + else + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Let's start the battle.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + } - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } + return true; + } }; @@ -783,8 +783,8 @@ enum BessyData SPAWN_SECOND = 19881, SAY_THADELL_1 = 0, SAY_THADELL_2 = 1, - SAY_BESSY_0 = 0, - SAY_BESSY_1 = 1 + SAY_BESSY_0 = 0, + SAY_BESSY_1 = 1 }; class npc_bessy : public CreatureScript @@ -798,7 +798,7 @@ public: { creature->setFaction(113); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - creature->AI()->Talk(SAY_BESSY_0); + creature->AI()->Talk(SAY_BESSY_0); CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID()); } return true; @@ -828,13 +828,13 @@ public: switch (waypointId) { case 3: //first spawn - Talk(SAY_BESSY_1); + Talk(SAY_BESSY_1); me->SummonCreature(SPAWN_FIRST, 2449.67f, 2183.11f, 96.85f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); me->SummonCreature(SPAWN_FIRST, 2449.53f, 2184.43f, 96.36f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); me->SummonCreature(SPAWN_FIRST, 2449.85f, 2186.34f, 97.57f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; case 7: - Talk(SAY_BESSY_1); + Talk(SAY_BESSY_1); me->SummonCreature(SPAWN_SECOND, 2309.64f, 2186.24f, 92.25f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); me->SummonCreature(SPAWN_SECOND, 2309.25f, 2183.46f, 91.75f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); break; @@ -858,7 +858,7 @@ public: void Reset() { me->RestoreFaction(); - me->SetReactState(REACT_PASSIVE); + me->SetReactState(REACT_PASSIVE); } }; }; @@ -968,10 +968,10 @@ public: void AddSC_netherstorm() { - // Ours - new npc_captain_saeed(); + // Ours + new npc_captain_saeed(); - // Theirs + // Theirs new npc_commander_dawnforge(); new at_commander_dawnforge(); new npc_professor_dabiri(); diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index 940ff5c27..c344234b8 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -59,36 +59,36 @@ class spell_q10612_10613_the_fel_and_the_furious : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - Player* charmer = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself(); - if (!charmer) - return; + Player* charmer = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (!charmer) + return; - std::list gList; - GetCaster()->GetGameObjectListWithEntryInGrid(gList, 184979, 30.0f); - uint8 counter = 0; - for (std::list::const_iterator itr = gList.begin(); itr != gList.end(); ++itr, ++counter) - { - if (counter >= 10) - break; - GameObject* go = *itr; - if (!go->isSpawned()) - continue; - Creature* cr2 = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ()+2.0f, 0.0f, 100); - if (cr2) - { - cr2->setFaction(14); - cr2->SetUInt32Value(UNIT_FIELD_FLAGS, 0); - GetCaster()->CastSpell(cr2, 38083, true); - } + std::list gList; + GetCaster()->GetGameObjectListWithEntryInGrid(gList, 184979, 30.0f); + uint8 counter = 0; + for (std::list::const_iterator itr = gList.begin(); itr != gList.end(); ++itr, ++counter) + { + if (counter >= 10) + break; + GameObject* go = *itr; + if (!go->isSpawned()) + continue; + Creature* cr2 = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ()+2.0f, 0.0f, 100); + if (cr2) + { + cr2->setFaction(14); + cr2->SetUInt32Value(UNIT_FIELD_FLAGS, 0); + GetCaster()->CastSpell(cr2, 38083, true); + } - go->SetLootState(GO_JUST_DEACTIVATED); - charmer->KilledMonsterCredit(21959, 0); - } + go->SetLootState(GO_JUST_DEACTIVATED); + charmer->KilledMonsterCredit(21959, 0); + } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_q10612_10613_the_fel_and_the_furious_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_q10612_10613_the_fel_and_the_furious_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -107,27 +107,27 @@ public: { PrepareAuraScript(spell_q10563_q10596_to_legion_hold_AuraScript) - void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Player* player = GetTarget()->ToPlayer()) - { - player->KilledMonsterCredit(21502, 0); - player->SetControlled(false, UNIT_STATE_STUNNED); - } + { + player->KilledMonsterCredit(21502, 0); + player->SetControlled(false, UNIT_STATE_STUNNED); + } } - void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Player* player = GetTarget()->ToPlayer()) - { - player->SetControlled(true, UNIT_STATE_STUNNED); - player->SummonCreature(21633, -3311.13f, 2946.15f, 171.1f, 4.86f, TEMPSUMMON_TIMED_DESPAWN, 64000); - } + { + player->SetControlled(true, UNIT_STATE_STUNNED); + player->SummonCreature(21633, -3311.13f, 2946.15f, 171.1f, 4.86f, TEMPSUMMON_TIMED_DESPAWN, 64000); + } } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_q10563_q10596_to_legion_hold_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_q10563_q10596_to_legion_hold_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); OnEffectRemove += AuraEffectRemoveFn(spell_q10563_q10596_to_legion_hold_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); } }; @@ -241,8 +241,8 @@ public: void IsSummonedBy(Unit* summoner) { - if (!summoner) - return; + if (!summoner) + return; if (summoner->ToCreature()) casterGUID = summoner->ToCreature()->GetGUID();; @@ -1230,10 +1230,10 @@ public: { Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (!player) - { - Failed = true; + { + Failed = true; return; - } + } if (Group* EventGroup = player->GetGroup()) { @@ -1744,11 +1744,11 @@ public: void AddSC_shadowmoon_valley() { - // Ours - new spell_q10612_10613_the_fel_and_the_furious(); - new spell_q10563_q10596_to_legion_hold(); + // Ours + new spell_q10612_10613_the_fel_and_the_furious(); + new spell_q10563_q10596_to_legion_hold(); - // Theirs + // Theirs new npc_invis_infernal_caster(); new npc_infernal_attacker(); new npc_mature_netherwing_drake(); diff --git a/src/server/scripts/Outland/zone_shattrath_city.cpp b/src/server/scripts/Outland/zone_shattrath_city.cpp index f1bacb050..89e653019 100644 --- a/src/server/scripts/Outland/zone_shattrath_city.cpp +++ b/src/server/scripts/Outland/zone_shattrath_city.cpp @@ -173,15 +173,15 @@ public: void DamageTaken(Unit* done_by, uint32 &damage, DamageEffectType, SpellSchoolMask) { - // xinef: some corrections - if (done_by) - if (Player* player = done_by->GetCharmerOrOwnerPlayerOrPlayerItself()) - if (me->HealthBelowPctDamaged(20, damage)) - { - player->GroupEventHappens(QUEST_10004, me); - damage = 0; - EnterEvadeMode(); - } + // xinef: some corrections + if (done_by) + if (Player* player = done_by->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (me->HealthBelowPctDamaged(20, damage)) + { + player->GroupEventHappens(QUEST_10004, me); + damage = 0; + EnterEvadeMode(); + } } void UpdateAI(uint32 diff) @@ -415,12 +415,12 @@ public: void IsSummonedBy(Unit* summoner) { - if (!summoner) - return; + if (!summoner) + return; Player* player = summoner->ToPlayer(); if (player && player->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) - Start(false, false, summoner->GetGUID()); + Start(false, false, summoner->GetGUID()); } void Reset() { } diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp index 359ea3083..9634dca78 100644 --- a/src/server/scripts/Outland/zone_terokkar_forest.cpp +++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp @@ -45,11 +45,11 @@ EndContentData */ // Ours enum fumping { - SPELL_SUMMON_SAND_GNOME1 = 39240, - SPELL_SUMMON_SAND_GNOME3 = 39247, - SPELL_SUMMON_MATURE_BONE_SIFTER1 = 39241, - SPELL_SUMMON_MATURE_BONE_SIFTER3 = 39245, - SPELL_SUMMON_HAISHULUD = 39248, + SPELL_SUMMON_SAND_GNOME1 = 39240, + SPELL_SUMMON_SAND_GNOME3 = 39247, + SPELL_SUMMON_MATURE_BONE_SIFTER1 = 39241, + SPELL_SUMMON_MATURE_BONE_SIFTER3 = 39245, + SPELL_SUMMON_HAISHULUD = 39248, }; class spell_q10930_big_bone_worm : public SpellScriptLoader @@ -84,10 +84,10 @@ class spell_q10930_big_bone_worm : public SpellScriptLoader void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) return; - GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true); + GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true); } void Register() @@ -154,91 +154,91 @@ class spell_q10929_fumping : SpellScriptLoader class npc_greatfather_aldrimus : public CreatureScript { - public: - npc_greatfather_aldrimus() : CreatureScript("npc_greatfather_aldrimus") { } + public: + npc_greatfather_aldrimus() : CreatureScript("npc_greatfather_aldrimus") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_greatfather_aldrimusAI(creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_greatfather_aldrimusAI(creature); + } - struct npc_greatfather_aldrimusAI : public ScriptedAI - { - npc_greatfather_aldrimusAI(Creature* c) : ScriptedAI(c) {} + struct npc_greatfather_aldrimusAI : public ScriptedAI + { + npc_greatfather_aldrimusAI(Creature* c) : ScriptedAI(c) {} - bool CanBeSeen(Player const* player) - { - return player->GetQuestStatus(10253) == QUEST_STATUS_REWARDED; - } - }; + bool CanBeSeen(Player const* player) + { + return player->GetQuestStatus(10253) == QUEST_STATUS_REWARDED; + } + }; }; enum q10036Torgos { - NPC_TORGOS = 18707 + NPC_TORGOS = 18707 }; class spell_q10036_torgos : public SpellScriptLoader { - public: - spell_q10036_torgos() : SpellScriptLoader("spell_q10036_torgos") { } + public: + spell_q10036_torgos() : SpellScriptLoader("spell_q10036_torgos") { } - class spell_q10036_torgos_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q10036_torgos_SpellScript); + class spell_q10036_torgos_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q10036_torgos_SpellScript); - void HandleSendEvent(SpellEffIndex effIndex) - { - if (Creature* torgos = GetCaster()->FindNearestCreature(NPC_TORGOS, 100.0f, true)) - torgos->GetAI()->AttackStart(GetCaster()); - } + void HandleSendEvent(SpellEffIndex effIndex) + { + if (Creature* torgos = GetCaster()->FindNearestCreature(NPC_TORGOS, 100.0f, true)) + torgos->GetAI()->AttackStart(GetCaster()); + } - void Register() - { - OnEffectLaunch += SpellEffectFn(spell_q10036_torgos_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); - } - }; + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_q10036_torgos_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_q10036_torgos_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_q10036_torgos_SpellScript(); + } }; enum eQ10923EvilDrawsNear { - SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1 = 39256, - SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2 = 39257, - SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA = 39259, + SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1 = 39256, + SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2 = 39257, + SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA = 39259, - NPC_AUCHENAI_DEATH_SPIRIT = 21967 + NPC_AUCHENAI_DEATH_SPIRIT = 21967 }; class spell_q10923_evil_draws_near_summon : public SpellScriptLoader { - public: - spell_q10923_evil_draws_near_summon() : SpellScriptLoader("spell_q10923_evil_draws_near_summon") { } + public: + spell_q10923_evil_draws_near_summon() : SpellScriptLoader("spell_q10923_evil_draws_near_summon") { } - class spell_q10923_evil_draws_near_summon_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q10923_evil_draws_near_summon_SpellScript); + class spell_q10923_evil_draws_near_summon_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q10923_evil_draws_near_summon_SpellScript); - void HandleSendEvent(SpellEffIndex effIndex) - { - if (Creature* auchenai = GetCaster()->FindNearestCreature(NPC_AUCHENAI_DEATH_SPIRIT, 10.0f, true)) - auchenai->CastSpell(auchenai, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA, true); - } + void HandleSendEvent(SpellEffIndex effIndex) + { + if (Creature* auchenai = GetCaster()->FindNearestCreature(NPC_AUCHENAI_DEATH_SPIRIT, 10.0f, true)) + auchenai->CastSpell(auchenai, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA, true); + } - void Register() - { - OnEffectLaunch += SpellEffectFn(spell_q10923_evil_draws_near_summon_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); - } - }; + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_q10923_evil_draws_near_summon_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_q10923_evil_draws_near_summon_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_q10923_evil_draws_near_summon_SpellScript(); + } }; class spell_q10923_evil_draws_near_periodic : public SpellScriptLoader @@ -253,7 +253,7 @@ class spell_q10923_evil_draws_near_periodic : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2), true); + GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2), true); } void Register() @@ -309,7 +309,7 @@ class spell_q10898_skywing : public SpellScriptLoader { // Adjust effect summon position Position const offset = { frand(-7.0f, 7.0f), frand(-7.0f, 7.0f), 11.0f, 0.0f }; - dest.Relocate(*GetCaster()); + dest.Relocate(*GetCaster()); dest.RelocateOffset(offset); } @@ -385,9 +385,9 @@ public: void DamageTaken(Unit* done_by, uint32 &damage, DamageEffectType, SpellSchoolMask) { if (!done_by) - return; + return; - Player* player = done_by->ToPlayer(); + Player* player = done_by->ToPlayer(); if (player && me->HealthBelowPctDamaged(30, damage)) { if (Group* group = player->GetGroup()) @@ -633,13 +633,13 @@ enum IslaStarmaneData GO_CAGE = 182794, SPELL_CAT = 32447, - EVENT_SPELL_WRATH = 1, - EVENT_SPELL_MOONFIRE = 2, - EVENT_SPELL_ENTANGLING_ROOTS = 3, + EVENT_SPELL_WRATH = 1, + EVENT_SPELL_MOONFIRE = 2, + EVENT_SPELL_ENTANGLING_ROOTS = 3, - SPELL_WRATH = 9739, - SPELL_MOONFIRE = 15798, - SPELL_ENTANGLING_ROOTS = 33844 + SPELL_WRATH = 9739, + SPELL_MOONFIRE = 15798, + SPELL_ENTANGLING_ROOTS = 33844 }; class npc_isla_starmane : public CreatureScript @@ -706,43 +706,43 @@ public: } } - void EnterCombat(Unit*) - { - events.Reset(); - events.ScheduleEvent(EVENT_SPELL_WRATH, 0); - events.ScheduleEvent(EVENT_SPELL_MOONFIRE, 4000); - events.ScheduleEvent(EVENT_SPELL_ENTANGLING_ROOTS, 10000); - } + void EnterCombat(Unit*) + { + events.Reset(); + events.ScheduleEvent(EVENT_SPELL_WRATH, 0); + events.ScheduleEvent(EVENT_SPELL_MOONFIRE, 4000); + events.ScheduleEvent(EVENT_SPELL_ENTANGLING_ROOTS, 10000); + } - void UpdateEscortAI(uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateEscortAI(uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - switch (events.ExecuteEvent()) - { - case EVENT_SPELL_WRATH: - me->CastSpell(me->GetVictim(), SPELL_WRATH, false); - events.ScheduleEvent(EVENT_SPELL_WRATH, 3000); - break; - case EVENT_SPELL_MOONFIRE: - me->CastSpell(me->GetVictim(), SPELL_MOONFIRE, false); - events.ScheduleEvent(EVENT_SPELL_MOONFIRE, 12000); - break; - case EVENT_SPELL_ENTANGLING_ROOTS: - me->CastSpell(me->GetVictim(), SPELL_ENTANGLING_ROOTS, false); - events.ScheduleEvent(EVENT_SPELL_ENTANGLING_ROOTS, 20000); - break; - } + switch (events.ExecuteEvent()) + { + case EVENT_SPELL_WRATH: + me->CastSpell(me->GetVictim(), SPELL_WRATH, false); + events.ScheduleEvent(EVENT_SPELL_WRATH, 3000); + break; + case EVENT_SPELL_MOONFIRE: + me->CastSpell(me->GetVictim(), SPELL_MOONFIRE, false); + events.ScheduleEvent(EVENT_SPELL_MOONFIRE, 12000); + break; + case EVENT_SPELL_ENTANGLING_ROOTS: + me->CastSpell(me->GetVictim(), SPELL_ENTANGLING_ROOTS, false); + events.ScheduleEvent(EVENT_SPELL_ENTANGLING_ROOTS, 20000); + break; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - EventMap events; + EventMap events; }; bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) @@ -857,17 +857,17 @@ public: void AddSC_terokkar_forest() { - // Ours - new spell_q10930_big_bone_worm(); - new spell_q10929_fumping(); - new npc_greatfather_aldrimus(); - new spell_q10036_torgos(); - new spell_q10923_evil_draws_near_summon(); - new spell_q10923_evil_draws_near_periodic(); - new spell_q10923_evil_draws_near_visual(); - new spell_q10898_skywing(); + // Ours + new spell_q10930_big_bone_worm(); + new spell_q10929_fumping(); + new npc_greatfather_aldrimus(); + new spell_q10036_torgos(); + new spell_q10923_evil_draws_near_summon(); + new spell_q10923_evil_draws_near_periodic(); + new spell_q10923_evil_draws_near_visual(); + new spell_q10898_skywing(); - // Theirs + // Theirs new npc_unkor_the_ruthless(); new npc_infested_root_walker(); new npc_rotting_forest_rager(); diff --git a/src/server/scripts/Outland/zone_zangarmarsh.cpp b/src/server/scripts/Outland/zone_zangarmarsh.cpp index adef6be5f..a647ce56e 100644 --- a/src/server/scripts/Outland/zone_zangarmarsh.cpp +++ b/src/server/scripts/Outland/zone_zangarmarsh.cpp @@ -42,8 +42,8 @@ EndContentData */ // Ours enum eNaturalist { - SPELL_MARK_OF_BITE = 34906, - GO_CAGE_ENTRY = 182094, + SPELL_MARK_OF_BITE = 34906, + GO_CAGE_ENTRY = 182094, }; class npc_natrualist_bite : public CreatureScript @@ -53,8 +53,8 @@ public: bool OnGossipHello(Player* player, Creature* creature) { - uint32 menuId = creature->AI()->GetData(1) ? 7540 : 7520; - player->PrepareGossipMenu(creature, menuId, false); + uint32 menuId = creature->AI()->GetData(1) ? 7540 : 7520; + player->PrepareGossipMenu(creature, menuId, false); player->SendPreparedGossip(creature); return true; } @@ -63,27 +63,27 @@ public: { player->PlayerTalkClass->ClearMenus(); player->CLOSE_GOSSIP_MENU(); - if (creature->AI()->GetData(1)) - { - creature->CastSpell(player, SPELL_MARK_OF_BITE, true); - player->KilledMonsterCredit(creature->GetEntry(), 0); - creature->DespawnOrUnsummon(1000); - } - else - { - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - Creature* cr; - if (cr = creature->SummonCreature(17957, -186, -790, 43.8f, 4.2f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - cr->AI()->AttackStart(creature); - if (cr = creature->SummonCreature(17960, -188, -783, 43.8f, 4.2f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - cr->AI()->AttackStart(player); - if (cr = creature->SummonCreature(17957, -196, -783, 43.8f, 4.4f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - cr->AI()->AttackStart(player); - if (GameObject* cage = creature->FindNearestGameObject(GO_CAGE_ENTRY, 20.0f)) - cage->SetGoState(GO_STATE_ACTIVE); - creature->SetHomePosition(-195.39f, -795.91f, 43.8f, 1.0f); - creature->AI()->Talk(1); - } + if (creature->AI()->GetData(1)) + { + creature->CastSpell(player, SPELL_MARK_OF_BITE, true); + player->KilledMonsterCredit(creature->GetEntry(), 0); + creature->DespawnOrUnsummon(1000); + } + else + { + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + Creature* cr; + if (cr = creature->SummonCreature(17957, -186, -790, 43.8f, 4.2f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + cr->AI()->AttackStart(creature); + if (cr = creature->SummonCreature(17960, -188, -783, 43.8f, 4.2f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + cr->AI()->AttackStart(player); + if (cr = creature->SummonCreature(17957, -196, -783, 43.8f, 4.4f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + cr->AI()->AttackStart(player); + if (GameObject* cage = creature->FindNearestGameObject(GO_CAGE_ENTRY, 20.0f)) + cage->SetGoState(GO_STATE_ACTIVE); + creature->SetHomePosition(-195.39f, -795.91f, 43.8f, 1.0f); + creature->AI()->Talk(1); + } return true; } @@ -91,21 +91,21 @@ public: { npc_natrualist_biteAI(Creature* creature) : ScriptedAI(creature) { - _spoken = 0; + _spoken = 0; } - uint8 _spoken; + uint8 _spoken; void MoveInLineOfSight(Unit* who) - { - if (!_spoken && !me->IsHostileTo(who)) - { - _spoken = 1; - Talk(0); - } - ScriptedAI::MoveInLineOfSight(who); - } - void EnterCombat(Unit*) { _spoken = 2; } - uint32 GetData(uint32) const { return _spoken == 2; } + { + if (!_spoken && !me->IsHostileTo(who)) + { + _spoken = 1; + Talk(0); + } + ScriptedAI::MoveInLineOfSight(who); + } + void EnterCombat(Unit*) { _spoken = 2; } + uint32 GetData(uint32) const { return _spoken == 2; } }; CreatureAI* GetAI(Creature* creature) const @@ -527,10 +527,10 @@ public: void AddSC_zangarmarsh() { - // Ours - new npc_natrualist_bite(); + // Ours + new npc_natrualist_bite(); - // Theris + // Theris new npcs_ashyen_and_keleth(); new npc_cooshcoosh(); new npc_elder_kuruti(); diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp index 162236443..0a2f02f43 100644 --- a/src/server/scripts/Pet/pet_dk.cpp +++ b/src/server/scripts/Pet/pet_dk.cpp @@ -34,8 +34,8 @@ enum DeathKnightSpells SPELL_DK_SUMMON_GARGOYLE_2 = 50514, SPELL_DK_DISMISS_GARGOYLE = 50515, SPELL_DK_SANCTUARY = 54661, - SPELL_DK_NIGHT_OF_THE_DEAD = 62137, - SPELL_DK_PET_SCALING = 61017 + SPELL_DK_NIGHT_OF_THE_DEAD = 62137, + SPELL_DK_PET_SCALING = 61017 }; class npc_pet_dk_ebon_gargoyle : public CreatureScript @@ -46,172 +46,172 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript struct npc_pet_dk_ebon_gargoyleAI : ScriptedAI { npc_pet_dk_ebon_gargoyleAI(Creature* creature) : ScriptedAI(creature) - { - _despawnTimer = 36000; // 30 secs + 4 fly out + 2 initial attack timer - _despawning = false; - _initialSelection = true; - _targetGUID = 0; - } + { + _despawnTimer = 36000; // 30 secs + 4 fly out + 2 initial attack timer + _despawning = false; + _initialSelection = true; + _targetGUID = 0; + } - void MovementInform(uint32 type, uint32 point) - { - if (type == POINT_MOTION_TYPE && point == 1) - { - me->SetCanFly(false); - me->SetDisableGravity(false); - } - } + void MovementInform(uint32 type, uint32 point) + { + if (type == POINT_MOTION_TYPE && point == 1) + { + me->SetCanFly(false); + me->SetDisableGravity(false); + } + } - void InitializeAI() - { - ScriptedAI::InitializeAI(); - Unit* owner = me->GetOwner(); - if (!owner) - return; + void InitializeAI() + { + ScriptedAI::InitializeAI(); + Unit* owner = me->GetOwner(); + if (!owner) + return; - // Xinef: Night of the Dead avoidance - if (Aura *aur = me->GetAura(SPELL_DK_NIGHT_OF_THE_DEAD)) - if (Unit* owner = me->GetOwner()) - if (AuraEffect *aurEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0)) - if (aur->GetEffect(0)) - aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue()); - - float tz = me->GetMap()->GetHeight(me->GetPhaseMask(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), true, MAX_FALL_DISTANCE); - me->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), tz, 7.0f, 1); - me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - me->SetCanFly(true); - me->SetDisableGravity(true); - _selectionTimer = 2000; - _initialCastTimer = 0; - } + // Xinef: Night of the Dead avoidance + if (Aura *aur = me->GetAura(SPELL_DK_NIGHT_OF_THE_DEAD)) + if (Unit* owner = me->GetOwner()) + if (AuraEffect *aurEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0)) + if (aur->GetEffect(0)) + aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue()); + + float tz = me->GetMap()->GetHeight(me->GetPhaseMask(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), true, MAX_FALL_DISTANCE); + me->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), tz, 7.0f, 1); + me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + me->SetCanFly(true); + me->SetDisableGravity(true); + _selectionTimer = 2000; + _initialCastTimer = 0; + } - void MySelectNextTarget() - { - Unit* owner = me->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(51963)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim()))) - { - Unit* selection = owner->ToPlayer()->GetSelectedUnit(); - if (selection && selection != me->GetVictim() && me->IsValidAttackTarget(selection)) - { - me->GetMotionMaster()->Clear(false); - SetGazeOn(selection); - } - else if (!me->GetVictim() || !owner->CanSeeOrDetect(me->GetVictim())) - { - me->CombatStop(true); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, 0.0f); - RemoveTargetAura(); - } - } - } + void MySelectNextTarget() + { + Unit* owner = me->GetOwner(); + if (owner && owner->GetTypeId() == TYPEID_PLAYER && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(51963)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim()))) + { + Unit* selection = owner->ToPlayer()->GetSelectedUnit(); + if (selection && selection != me->GetVictim() && me->IsValidAttackTarget(selection)) + { + me->GetMotionMaster()->Clear(false); + SetGazeOn(selection); + } + else if (!me->GetVictim() || !owner->CanSeeOrDetect(me->GetVictim())) + { + me->CombatStop(true); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, 0.0f); + RemoveTargetAura(); + } + } + } - void AttackStart(Unit* who) - { - RemoveTargetAura(); - _targetGUID = who->GetGUID(); - me->AddAura(SPELL_DK_SUMMON_GARGOYLE_1, who); - ScriptedAI::AttackStart(who); - } + void AttackStart(Unit* who) + { + RemoveTargetAura(); + _targetGUID = who->GetGUID(); + me->AddAura(SPELL_DK_SUMMON_GARGOYLE_1, who); + ScriptedAI::AttackStart(who); + } - void RemoveTargetAura() - { - if (Unit* target = ObjectAccessor::GetUnit(*me, _targetGUID)) - target->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetGUID()); - } + void RemoveTargetAura() + { + if (Unit* target = ObjectAccessor::GetUnit(*me, _targetGUID)) + target->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetGUID()); + } - void Reset() - { - _selectionTimer = 0; - me->SetReactState(REACT_PASSIVE); - MySelectNextTarget(); - } + void Reset() + { + _selectionTimer = 0; + me->SetReactState(REACT_PASSIVE); + MySelectNextTarget(); + } - // Fly away when dismissed - void FlyAway() - { - RemoveTargetAura(); + // Fly away when dismissed + void FlyAway() + { + RemoveTargetAura(); - // Stop Fighting - me->CombatStop(true); - me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true); + // Stop Fighting + me->CombatStop(true); + me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true); - // Sanctuary - me->CastSpell(me, SPELL_DK_SANCTUARY, true); - me->SetReactState(REACT_PASSIVE); + // Sanctuary + me->CastSpell(me, SPELL_DK_SANCTUARY, true); + me->SetReactState(REACT_PASSIVE); - me->SetSpeed(MOVE_FLIGHT, 1.0f, true); - me->SetSpeed(MOVE_RUN, 1.0f, true); - float x = me->GetPositionX() + 20 * cos(me->GetOrientation()); - float y = me->GetPositionY() + 20 * sin(me->GetOrientation()); - float z = me->GetPositionZ() + 40; - me->DisableSpline(); - me->GetMotionMaster()->Clear(false); + me->SetSpeed(MOVE_FLIGHT, 1.0f, true); + me->SetSpeed(MOVE_RUN, 1.0f, true); + float x = me->GetPositionX() + 20 * cos(me->GetOrientation()); + float y = me->GetPositionY() + 20 * sin(me->GetOrientation()); + float z = me->GetPositionZ() + 40; + me->DisableSpline(); + me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveCharge(x, y, z, 7.0f, 1); - me->SetCanFly(true); - me->SetDisableGravity(true); + me->GetMotionMaster()->MoveCharge(x, y, z, 7.0f, 1); + me->SetCanFly(true); + me->SetDisableGravity(true); - _despawning = true; - } + _despawning = true; + } - void UpdateAI(uint32 diff) - { - if (_initialSelection) - { - _initialSelection = false; - // Find victim of Summon Gargoyle spell - std::list targets; - Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 50); - Trinity::UnitListSearcher searcher(me, targets, u_check); - me->VisitNearbyObject(50, searcher); - for (std::list::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) - if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID())) - { - (*iter)->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID()); - SetGazeOn(*iter); - _targetGUID = (*iter)->GetGUID(); - break; - } - } - if (_despawnTimer > 4000) - { - _despawnTimer -= diff; - if (!UpdateVictimWithGaze()) - { - MySelectNextTarget(); - return; - } + void UpdateAI(uint32 diff) + { + if (_initialSelection) + { + _initialSelection = false; + // Find victim of Summon Gargoyle spell + std::list targets; + Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 50); + Trinity::UnitListSearcher searcher(me, targets, u_check); + me->VisitNearbyObject(50, searcher); + for (std::list::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) + if ((*iter)->GetAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID())) + { + (*iter)->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID()); + SetGazeOn(*iter); + _targetGUID = (*iter)->GetGUID(); + break; + } + } + if (_despawnTimer > 4000) + { + _despawnTimer -= diff; + if (!UpdateVictimWithGaze()) + { + MySelectNextTarget(); + return; + } - _initialCastTimer += diff; - _selectionTimer += diff; - if (_selectionTimer >= 1000) - { - MySelectNextTarget(); - _selectionTimer = 0; - } - if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE) - me->CastSpell(me->GetVictim(), 51963, false); - } - else - { - if (!_despawning) - FlyAway(); + _initialCastTimer += diff; + _selectionTimer += diff; + if (_selectionTimer >= 1000) + { + MySelectNextTarget(); + _selectionTimer = 0; + } + if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE) + me->CastSpell(me->GetVictim(), 51963, false); + } + else + { + if (!_despawning) + FlyAway(); - if (_despawnTimer > diff) - _despawnTimer -= diff; - else - me->DespawnOrUnsummon(); - } - } + if (_despawnTimer > diff) + _despawnTimer -= diff; + else + me->DespawnOrUnsummon(); + } + } private: - uint64 _targetGUID; + uint64 _targetGUID; uint32 _despawnTimer; - uint32 _selectionTimer; - uint32 _initialCastTimer; - bool _despawning; - bool _initialSelection; + uint32 _selectionTimer; + uint32 _initialCastTimer; + bool _despawning; + bool _initialSelection; }; CreatureAI* GetAI(Creature* creature) const @@ -222,81 +222,81 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript class npc_pet_dk_ghoul : public CreatureScript { - public: - npc_pet_dk_ghoul() : CreatureScript("npc_pet_dk_ghoul") { } + public: + npc_pet_dk_ghoul() : CreatureScript("npc_pet_dk_ghoul") { } - struct npc_pet_dk_ghoulAI : public CombatAI - { - npc_pet_dk_ghoulAI(Creature *c) : CombatAI(c) { } + struct npc_pet_dk_ghoulAI : public CombatAI + { + npc_pet_dk_ghoulAI(Creature *c) : CombatAI(c) { } - void JustDied(Unit *who) - { - if (me->IsGuardian() || me->IsSummon()) - me->ToTempSummon()->UnSummon(); - } - }; + void JustDied(Unit *who) + { + if (me->IsGuardian() || me->IsSummon()) + me->ToTempSummon()->UnSummon(); + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_pet_dk_ghoulAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_pet_dk_ghoulAI (pCreature); + } }; class npc_pet_dk_army_of_the_dead : public CreatureScript { - public: - npc_pet_dk_army_of_the_dead() : CreatureScript("npc_pet_dk_army_of_the_dead") { } + public: + npc_pet_dk_army_of_the_dead() : CreatureScript("npc_pet_dk_army_of_the_dead") { } - struct npc_pet_dk_army_of_the_deadAI : public CombatAI - { - npc_pet_dk_army_of_the_deadAI(Creature* creature) : CombatAI(creature) { } + struct npc_pet_dk_army_of_the_deadAI : public CombatAI + { + npc_pet_dk_army_of_the_deadAI(Creature* creature) : CombatAI(creature) { } - void InitializeAI() - { - CombatAI::InitializeAI(); - ((Minion*)me)->SetFollowAngle(rand_norm()*2*M_PI); + void InitializeAI() + { + CombatAI::InitializeAI(); + ((Minion*)me)->SetFollowAngle(rand_norm()*2*M_PI); - // Heroism / Bloodlust immunity - me->ApplySpellImmune(0, IMMUNITY_ID, 32182, true); - me->ApplySpellImmune(0, IMMUNITY_ID, 2825, true); - } - }; + // Heroism / Bloodlust immunity + me->ApplySpellImmune(0, IMMUNITY_ID, 32182, true); + me->ApplySpellImmune(0, IMMUNITY_ID, 2825, true); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_pet_dk_army_of_the_deadAI (creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_pet_dk_army_of_the_deadAI (creature); + } }; class npc_pet_dk_dancing_rune_weapon : public CreatureScript { - public: - npc_pet_dk_dancing_rune_weapon() : CreatureScript("npc_pet_dk_dancing_rune_weapon") { } + public: + npc_pet_dk_dancing_rune_weapon() : CreatureScript("npc_pet_dk_dancing_rune_weapon") { } - struct npc_pet_dk_dancing_rune_weaponAI : public NullCreatureAI - { - npc_pet_dk_dancing_rune_weaponAI(Creature* creature) : NullCreatureAI(creature) { } + struct npc_pet_dk_dancing_rune_weaponAI : public NullCreatureAI + { + npc_pet_dk_dancing_rune_weaponAI(Creature* creature) : NullCreatureAI(creature) { } - void InitializeAI() - { - // Xinef: Hit / Expertise scaling - me->AddAura(61017, me); - if (Unit* owner = me->GetOwner()) - me->GetMotionMaster()->MoveFollow(owner, 0.01f, me->GetFollowAngle(), MOTION_SLOT_CONTROLLED); - NullCreatureAI::InitializeAI(); - } - }; + void InitializeAI() + { + // Xinef: Hit / Expertise scaling + me->AddAura(61017, me); + if (Unit* owner = me->GetOwner()) + me->GetMotionMaster()->MoveFollow(owner, 0.01f, me->GetFollowAngle(), MOTION_SLOT_CONTROLLED); + NullCreatureAI::InitializeAI(); + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_pet_dk_dancing_rune_weaponAI (creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_pet_dk_dancing_rune_weaponAI (creature); + } }; void AddSC_deathknight_pet_scripts() { new npc_pet_dk_ebon_gargoyle(); - new npc_pet_dk_ghoul(); - new npc_pet_dk_army_of_the_dead(); - new npc_pet_dk_dancing_rune_weapon(); + new npc_pet_dk_ghoul(); + new npc_pet_dk_army_of_the_dead(); + new npc_pet_dk_dancing_rune_weapon(); } diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index d047f0caf..e9456d3e4 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -90,14 +90,14 @@ class npc_pet_gen_mojo : public CreatureScript enum soulTrader { - SPELL_STEAL_ESSENCE_VISUAL = 50101, - SPELL_CREATE_TOKEN = 50063, - SPELL_PROC_TRIGGER_ON_KILL_AURA = 50051, - SPELL_OWNER_KILLED_INFORM = 50050, - SPELL_EMOTE_STATE_SWIM_RUN = 47127, + SPELL_STEAL_ESSENCE_VISUAL = 50101, + SPELL_CREATE_TOKEN = 50063, + SPELL_PROC_TRIGGER_ON_KILL_AURA = 50051, + SPELL_OWNER_KILLED_INFORM = 50050, + SPELL_EMOTE_STATE_SWIM_RUN = 47127, - EVENT_INITIAL_TALK = 1, - EVENT_ADD_TOKEN = 2 + EVENT_INITIAL_TALK = 1, + EVENT_ADD_TOKEN = 2 }; class npc_pet_gen_soul_trader_beacon : public CreatureScript @@ -105,332 +105,332 @@ class npc_pet_gen_soul_trader_beacon : public CreatureScript public: npc_pet_gen_soul_trader_beacon() : CreatureScript("npc_pet_gen_soul_trader_beacon") { } - struct npc_pet_gen_soul_trader_beaconAI : public ScriptedAI - { - uint64 ownerGUID; - EventMap events; - npc_pet_gen_soul_trader_beaconAI(Creature *c) : ScriptedAI(c) - { - events.Reset(); - events.ScheduleEvent(EVENT_INITIAL_TALK, 0); - if (me->ToTempSummon()) - if (Unit* owner = me->ToTempSummon()->GetOwner()) - { - owner->CastSpell(owner, SPELL_PROC_TRIGGER_ON_KILL_AURA, true); - ownerGUID = owner->GetGUID(); - } - } + struct npc_pet_gen_soul_trader_beaconAI : public ScriptedAI + { + uint64 ownerGUID; + EventMap events; + npc_pet_gen_soul_trader_beaconAI(Creature *c) : ScriptedAI(c) + { + events.Reset(); + events.ScheduleEvent(EVENT_INITIAL_TALK, 0); + if (me->ToTempSummon()) + if (Unit* owner = me->ToTempSummon()->GetOwner()) + { + owner->CastSpell(owner, SPELL_PROC_TRIGGER_ON_KILL_AURA, true); + ownerGUID = owner->GetGUID(); + } + } - Player* GetOwner() const { return ObjectAccessor::GetPlayer(*me, ownerGUID); } + Player* GetOwner() const { return ObjectAccessor::GetPlayer(*me, ownerGUID); } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == SPELL_STEAL_ESSENCE_VISUAL && target == me) - { - Talk(1); - events.ScheduleEvent(EVENT_ADD_TOKEN, 3000); - me->CastSpell(me, SPELL_EMOTE_STATE_SWIM_RUN, true); - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == SPELL_STEAL_ESSENCE_VISUAL && target == me) + { + Talk(1); + events.ScheduleEvent(EVENT_ADD_TOKEN, 3000); + me->CastSpell(me, SPELL_EMOTE_STATE_SWIM_RUN, true); + } + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.ExecuteEvent()) - { - case EVENT_INITIAL_TALK: - Talk(0); - break; - case EVENT_ADD_TOKEN: - me->RemoveAurasDueToSpell(SPELL_EMOTE_STATE_SWIM_RUN); - me->CastSpell(me, SPELL_CREATE_TOKEN, true); - Talk(2); - break; - } - } - }; + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.ExecuteEvent()) + { + case EVENT_INITIAL_TALK: + Talk(0); + break; + case EVENT_ADD_TOKEN: + me->RemoveAurasDueToSpell(SPELL_EMOTE_STATE_SWIM_RUN); + me->CastSpell(me, SPELL_CREATE_TOKEN, true); + Talk(2); + break; + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_pet_gen_soul_trader_beaconAI (creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_pet_gen_soul_trader_beaconAI (creature); + } }; enum eArgentPony { - ARGENT_PONY_STATE_NONE = 0, - ARGENT_PONY_STATE_ENCH = 1, - ARGENT_PONY_STATE_VENDOR = 2, - ARGENT_PONY_STATE_BANK = 3, - ARGENT_PONY_STATE_MAILBOX = 4, + ARGENT_PONY_STATE_NONE = 0, + ARGENT_PONY_STATE_ENCH = 1, + ARGENT_PONY_STATE_VENDOR = 2, + ARGENT_PONY_STATE_BANK = 3, + ARGENT_PONY_STATE_MAILBOX = 4, - SPELL_PONY_MOUNT = 16083, + SPELL_PONY_MOUNT = 16083, - SPELL_AURA_POSTMAN_S = 67376, - SPELL_AURA_SHOP_S = 67377, - SPELL_AURA_BANK_S = 67368, - SPELL_AURA_TIRED_S = 67401, - - SPELL_AURA_BANK_G = 68849, - SPELL_AURA_POSTMAN_G = 68850, - SPELL_AURA_SHOP_G = 68851, - SPELL_AURA_TIRED_G = 68852, + SPELL_AURA_POSTMAN_S = 67376, + SPELL_AURA_SHOP_S = 67377, + SPELL_AURA_BANK_S = 67368, + SPELL_AURA_TIRED_S = 67401, + + SPELL_AURA_BANK_G = 68849, + SPELL_AURA_POSTMAN_G = 68850, + SPELL_AURA_SHOP_G = 68851, + SPELL_AURA_TIRED_G = 68852, - ACHIEVEMENT_PONY_UP = 3736, + ACHIEVEMENT_PONY_UP = 3736, - GOSSIP_ACTION_MAILBOX = 1001, + GOSSIP_ACTION_MAILBOX = 1001, - NPC_ARGENT_SQUIRE = 33238, - NPC_ARGENT_GRUNTLING = 33239, + NPC_ARGENT_SQUIRE = 33238, + NPC_ARGENT_GRUNTLING = 33239, }; static uint32 argentPonyService[2][3] = { - {ARGENT_PONY_STATE_MAILBOX, ARGENT_PONY_STATE_VENDOR, ARGENT_PONY_STATE_BANK}, - {ARGENT_PONY_STATE_BANK, ARGENT_PONY_STATE_MAILBOX, ARGENT_PONY_STATE_VENDOR} + {ARGENT_PONY_STATE_MAILBOX, ARGENT_PONY_STATE_VENDOR, ARGENT_PONY_STATE_BANK}, + {ARGENT_PONY_STATE_BANK, ARGENT_PONY_STATE_MAILBOX, ARGENT_PONY_STATE_VENDOR} }; struct argentPonyBanner { - uint32 achievement; - uint32 spell; - const char* text; + uint32 achievement; + uint32 spell; + const char* text; }; static argentPonyBanner argentBanners[MAX_RACES] = { - {0, 0, ""}, - {2781, 62594, "Stormwind Champion's Pennant"}, - {2783, 63433, "Orgrimmar Champion's Pennant"}, - {2780, 63427, "Ironforge Champion's Pennant"}, - {2777, 63406, "Darnassus Champion's Pennant"}, - {2787, 63430, "Forsaken Champion's Pennant"}, - {2786, 63436, "Thunder Bluff Champion's Pennant"}, - {2779, 63396, "Gnomeregan Champion's Pennant"}, - {2784, 63399, "Darkspear Champion's Pennant"}, - {0, 0, ""}, - {2785, 63403, "Silvermoon Champion's Pennant"}, - {2778, 63423, "Exodar Champion's Pennant"} + {0, 0, ""}, + {2781, 62594, "Stormwind Champion's Pennant"}, + {2783, 63433, "Orgrimmar Champion's Pennant"}, + {2780, 63427, "Ironforge Champion's Pennant"}, + {2777, 63406, "Darnassus Champion's Pennant"}, + {2787, 63430, "Forsaken Champion's Pennant"}, + {2786, 63436, "Thunder Bluff Champion's Pennant"}, + {2779, 63396, "Gnomeregan Champion's Pennant"}, + {2784, 63399, "Darkspear Champion's Pennant"}, + {0, 0, ""}, + {2785, 63403, "Silvermoon Champion's Pennant"}, + {2778, 63423, "Exodar Champion's Pennant"} }; class npc_pet_gen_argent_pony_bridle : public CreatureScript { public: - npc_pet_gen_argent_pony_bridle() : CreatureScript("npc_pet_gen_argent_pony_bridle") { } + npc_pet_gen_argent_pony_bridle() : CreatureScript("npc_pet_gen_argent_pony_bridle") { } - struct npc_pet_gen_argent_pony_bridleAI : public ScriptedAI - { - npc_pet_gen_argent_pony_bridleAI(Creature *c) : ScriptedAI(c) - { - _state = ARGENT_PONY_STATE_NONE; - _init = false; - _mountTimer = 4000; - _lastAura = 0; - memset(_banners, 0, sizeof(_banners)); - } + struct npc_pet_gen_argent_pony_bridleAI : public ScriptedAI + { + npc_pet_gen_argent_pony_bridleAI(Creature *c) : ScriptedAI(c) + { + _state = ARGENT_PONY_STATE_NONE; + _init = false; + _mountTimer = 4000; + _lastAura = 0; + memset(_banners, 0, sizeof(_banners)); + } - void EnterEvadeMode() - { - if (Unit* owner = me->GetCharmerOrOwner()) - { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); - } - } + void EnterEvadeMode() + { + if (Unit* owner = me->GetCharmerOrOwner()) + { + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); + } + } - void Reset() - { - if (_init) - return; + void Reset() + { + if (_init) + return; - _init = true; - uint32 duration = 0; - uint32 aura = 0; - me->SetUInt32Value(UNIT_NPC_FLAGS, 0); + _init = true; + uint32 duration = 0; + uint32 aura = 0; + me->SetUInt32Value(UNIT_NPC_FLAGS, 0); - if (Unit* owner = me->GetCharmerOrOwner()) - if (Player* player = owner->ToPlayer()) - if (player->HasAchieved(ACHIEVEMENT_PONY_UP)) - { - _state = ARGENT_PONY_STATE_ENCH; + if (Unit* owner = me->GetCharmerOrOwner()) + if (Player* player = owner->ToPlayer()) + if (player->HasAchieved(ACHIEVEMENT_PONY_UP)) + { + _state = ARGENT_PONY_STATE_ENCH; - aura = (player->GetTeamId() == TEAM_ALLIANCE ? SPELL_AURA_TIRED_S : SPELL_AURA_TIRED_G); - duration = player->GetSpellCooldownDelay(aura); - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + aura = (player->GetTeamId() == TEAM_ALLIANCE ? SPELL_AURA_TIRED_S : SPELL_AURA_TIRED_G); + duration = player->GetSpellCooldownDelay(aura); + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - for (uint8 i = 0; i < 3; ++i) - { - if (player->GetTeamId() == TEAM_ALLIANCE) - { - if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_POSTMAN_S+i)) - { - duration = cooldown; - aura = SPELL_AURA_POSTMAN_S+i; - _state = argentPonyService[TEAM_ALLIANCE][i]; - me->ToTempSummon()->UnSummon(duration); - break; - } - } - else - { - if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_BANK_G+i)) - { - duration = cooldown*IN_MILLISECONDS; - aura = SPELL_AURA_BANK_G+i; - _state = argentPonyService[TEAM_HORDE][i]; - me->ToTempSummon()->UnSummon(duration); - break; - } - } - } + for (uint8 i = 0; i < 3; ++i) + { + if (player->GetTeamId() == TEAM_ALLIANCE) + { + if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_POSTMAN_S+i)) + { + duration = cooldown; + aura = SPELL_AURA_POSTMAN_S+i; + _state = argentPonyService[TEAM_ALLIANCE][i]; + me->ToTempSummon()->UnSummon(duration); + break; + } + } + else + { + if (uint32 cooldown = player->GetSpellCooldownDelay(SPELL_AURA_BANK_G+i)) + { + duration = cooldown*IN_MILLISECONDS; + aura = SPELL_AURA_BANK_G+i; + _state = argentPonyService[TEAM_HORDE][i]; + me->ToTempSummon()->UnSummon(duration); + break; + } + } + } - // Generate Banners - uint32 mask = player->GetTeamId() ? RACEMASK_HORDE : RACEMASK_ALLIANCE; - for (uint8 i = 1; i < MAX_RACES; ++i) - if (mask & (1 << (i-1)) && player->HasAchieved(argentBanners[i].achievement)) - _banners[i] = true; - } + // Generate Banners + uint32 mask = player->GetTeamId() ? RACEMASK_HORDE : RACEMASK_ALLIANCE; + for (uint8 i = 1; i < MAX_RACES; ++i) + if (mask & (1 << (i-1)) && player->HasAchieved(argentBanners[i].achievement)) + _banners[i] = true; + } - if (duration && aura) - { - if (Aura* aur = me->AddAura(aura, me)) - aur->SetDuration(duration); - } - } + if (duration && aura) + { + if (Aura* aur = me->AddAura(aura, me)) + aur->SetDuration(duration); + } + } - void UpdateAI(uint32 diff) - { - _mountTimer += diff; - if (_mountTimer > 5000) - { - _mountTimer = 0; - if (_state == ARGENT_PONY_STATE_NONE) - me->SetUInt32Value(UNIT_NPC_FLAGS, 0); - else if (Unit* owner = me->GetCharmerOrOwner()) - { - if (owner->IsMounted() && !me->IsMounted()) - me->CastSpell(me, SPELL_PONY_MOUNT, false); - else if (!owner->IsMounted() && me->IsMounted()) - me->RemoveAurasDueToSpell(SPELL_PONY_MOUNT); - } - } - } + void UpdateAI(uint32 diff) + { + _mountTimer += diff; + if (_mountTimer > 5000) + { + _mountTimer = 0; + if (_state == ARGENT_PONY_STATE_NONE) + me->SetUInt32Value(UNIT_NPC_FLAGS, 0); + else if (Unit* owner = me->GetCharmerOrOwner()) + { + if (owner->IsMounted() && !me->IsMounted()) + me->CastSpell(me, SPELL_PONY_MOUNT, false); + else if (!owner->IsMounted() && me->IsMounted()) + me->RemoveAurasDueToSpell(SPELL_PONY_MOUNT); + } + } + } - uint32 GetData(uint32 param) const - { - if (param == 0) - return _state; - - return _banners[param]; - } + uint32 GetData(uint32 param) const + { + if (param == 0) + return _state; + + return _banners[param]; + } - void DoAction(int32 param) - { - if (param > 60000) - { - if (_lastAura) - me->RemoveAurasDueToSpell(_lastAura); - _lastAura = param; - return; - } + void DoAction(int32 param) + { + if (param > 60000) + { + if (_lastAura) + me->RemoveAurasDueToSpell(_lastAura); + _lastAura = param; + return; + } - _state = param; - } - - private: - bool _init; - uint8 _state; - int32 _mountTimer; - bool _banners[MAX_RACES]; - uint32 _lastAura; - }; + _state = param; + } + + private: + bool _init; + uint8 _state; + int32 _mountTimer; + bool _banners[MAX_RACES]; + uint32 _lastAura; + }; - bool OnGossipHello(Player* player, Creature* creature) - { - if (player->GetGUID() != creature->GetOwnerGUID()) - return true; + bool OnGossipHello(Player* player, Creature* creature) + { + if (player->GetGUID() != creature->GetOwnerGUID()) + return true; - if (!creature->HasAura(player->GetTeamId() ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S)) - { - uint8 _state = creature->AI()->GetData(0 /*GET_DATA_STATE*/); - if (_state == ARGENT_PONY_STATE_ENCH || _state == ARGENT_PONY_STATE_VENDOR) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Visit a trader.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (_state == ARGENT_PONY_STATE_ENCH || _state == ARGENT_PONY_STATE_BANK) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Visit a bank.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_BANK); - if (_state == ARGENT_PONY_STATE_ENCH || _state == ARGENT_PONY_STATE_MAILBOX) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Visit a mailbox.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_MAILBOX); - } + if (!creature->HasAura(player->GetTeamId() ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S)) + { + uint8 _state = creature->AI()->GetData(0 /*GET_DATA_STATE*/); + if (_state == ARGENT_PONY_STATE_ENCH || _state == ARGENT_PONY_STATE_VENDOR) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Visit a trader.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + if (_state == ARGENT_PONY_STATE_ENCH || _state == ARGENT_PONY_STATE_BANK) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Visit a bank.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_BANK); + if (_state == ARGENT_PONY_STATE_ENCH || _state == ARGENT_PONY_STATE_MAILBOX) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Visit a mailbox.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_MAILBOX); + } - for (uint8 i = RACE_HUMAN; i < MAX_RACES; ++i) - if (creature->AI()->GetData(i) == uint32(true)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, argentBanners[i].text, GOSSIP_SENDER_MAIN, argentBanners[i].spell); - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } + for (uint8 i = RACE_HUMAN; i < MAX_RACES; ++i) + if (creature->AI()->GetData(i) == uint32(true)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, argentBanners[i].text, GOSSIP_SENDER_MAIN, argentBanners[i].spell); + + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + return true; + } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 action) - { - player->CLOSE_GOSSIP_MENU(); - uint32 spellId = 0; - switch (action) - { - case GOSSIP_ACTION_TRADE: - creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR); - player->GetSession()->SendListInventory(creature->GetGUID()); - spellId = player->GetTeamId() ? SPELL_AURA_SHOP_G : SPELL_AURA_SHOP_S; - creature->AI()->DoAction(ARGENT_PONY_STATE_VENDOR); - break; - case GOSSIP_ACTION_BANK: - creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER); - player->GetSession()->SendShowBank(player->GetGUID()); - spellId = player->GetTeamId() ? SPELL_AURA_BANK_G : SPELL_AURA_BANK_S; - creature->AI()->DoAction(ARGENT_PONY_STATE_BANK); - break; - case GOSSIP_ACTION_MAILBOX: - { - creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_MAILBOX); - player->GetSession()->SendShowMailBox(creature->GetGUID()); - spellId = player->GetTeamId() ? SPELL_AURA_POSTMAN_G : SPELL_AURA_POSTMAN_S; - creature->AI()->DoAction(ARGENT_PONY_STATE_MAILBOX); - break; - } - default: - if (action > 60000) - { - creature->AI()->DoAction(action); - creature->CastSpell(creature, action, true); - } - return true; - } + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 action) + { + player->CLOSE_GOSSIP_MENU(); + uint32 spellId = 0; + switch (action) + { + case GOSSIP_ACTION_TRADE: + creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR); + player->GetSession()->SendListInventory(creature->GetGUID()); + spellId = player->GetTeamId() ? SPELL_AURA_SHOP_G : SPELL_AURA_SHOP_S; + creature->AI()->DoAction(ARGENT_PONY_STATE_VENDOR); + break; + case GOSSIP_ACTION_BANK: + creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER); + player->GetSession()->SendShowBank(player->GetGUID()); + spellId = player->GetTeamId() ? SPELL_AURA_BANK_G : SPELL_AURA_BANK_S; + creature->AI()->DoAction(ARGENT_PONY_STATE_BANK); + break; + case GOSSIP_ACTION_MAILBOX: + { + creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_MAILBOX); + player->GetSession()->SendShowMailBox(creature->GetGUID()); + spellId = player->GetTeamId() ? SPELL_AURA_POSTMAN_G : SPELL_AURA_POSTMAN_S; + creature->AI()->DoAction(ARGENT_PONY_STATE_MAILBOX); + break; + } + default: + if (action > 60000) + { + creature->AI()->DoAction(action); + creature->CastSpell(creature, action, true); + } + return true; + } - if (spellId && !creature->HasAura(spellId)) - { - creature->CastSpell(creature, spellId, true); - player->AddSpellCooldown(spellId, 0, 3*MINUTE*IN_MILLISECONDS); - player->AddSpellCooldown(player->GetTeamId() ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S, 0, 3*MINUTE*IN_MILLISECONDS + 4*HOUR*IN_MILLISECONDS); - creature->DespawnOrUnsummon(3*MINUTE*IN_MILLISECONDS); - } - return true; - } + if (spellId && !creature->HasAura(spellId)) + { + creature->CastSpell(creature, spellId, true); + player->AddSpellCooldown(spellId, 0, 3*MINUTE*IN_MILLISECONDS); + player->AddSpellCooldown(player->GetTeamId() ? SPELL_AURA_TIRED_G : SPELL_AURA_TIRED_S, 0, 3*MINUTE*IN_MILLISECONDS + 4*HOUR*IN_MILLISECONDS); + creature->DespawnOrUnsummon(3*MINUTE*IN_MILLISECONDS); + } + return true; + } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_pet_gen_argent_pony_bridleAI (creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_pet_gen_argent_pony_bridleAI (creature); + } }; enum eTargetFollowingBomb { - NPC_EXPLOSIVE_SHEEP = 2675, - SPELL_EXPLOSIVE_SHEEP = 4050, + NPC_EXPLOSIVE_SHEEP = 2675, + SPELL_EXPLOSIVE_SHEEP = 4050, - NPC_GOBLIN_BOMB = 8937, - SPELL_EXPLOSIVE_GOBLIN = 13259, + NPC_GOBLIN_BOMB = 8937, + SPELL_EXPLOSIVE_GOBLIN = 13259, - NPC_HIGH_EXPLOSIVE_SHEEP = 24715, - SPELL_HIGH_EXPLOSIVE_SHEEP = 44279, + NPC_HIGH_EXPLOSIVE_SHEEP = 24715, + SPELL_HIGH_EXPLOSIVE_SHEEP = 44279, }; class npc_pet_gen_target_following_bomb : public CreatureScript @@ -438,54 +438,54 @@ class npc_pet_gen_target_following_bomb : public CreatureScript public: npc_pet_gen_target_following_bomb() : CreatureScript("npc_pet_gen_target_following_bomb") { } - struct npc_pet_gen_target_following_bombAI : public NullCreatureAI - { - npc_pet_gen_target_following_bombAI(Creature *c) : NullCreatureAI(c) - { - checkTimer = 0; - bombSpellId = 0; + struct npc_pet_gen_target_following_bombAI : public NullCreatureAI + { + npc_pet_gen_target_following_bombAI(Creature *c) : NullCreatureAI(c) + { + checkTimer = 0; + bombSpellId = 0; - switch (me->GetEntry()) - { - case NPC_EXPLOSIVE_SHEEP: bombSpellId = SPELL_EXPLOSIVE_SHEEP; break; - case NPC_GOBLIN_BOMB: bombSpellId = SPELL_EXPLOSIVE_GOBLIN; break; - case NPC_HIGH_EXPLOSIVE_SHEEP: bombSpellId = SPELL_HIGH_EXPLOSIVE_SHEEP; break; - } - } + switch (me->GetEntry()) + { + case NPC_EXPLOSIVE_SHEEP: bombSpellId = SPELL_EXPLOSIVE_SHEEP; break; + case NPC_GOBLIN_BOMB: bombSpellId = SPELL_EXPLOSIVE_GOBLIN; break; + case NPC_HIGH_EXPLOSIVE_SHEEP: bombSpellId = SPELL_HIGH_EXPLOSIVE_SHEEP; break; + } + } - uint32 bombSpellId; - uint32 checkTimer; + uint32 bombSpellId; + uint32 checkTimer; - void UpdateAI(uint32 diff) - { - checkTimer += diff; - if (checkTimer >= 1000) - { - checkTimer = 0; - if (Unit* target = me->SelectNearestTarget(30.0f)) - { - me->GetMotionMaster()->MoveChase(target); - if (me->GetDistance(target) < 3.0f) - { - me->CastSpell(me, bombSpellId, false); - me->DespawnOrUnsummon(500); - } - } - else if (!me->HasUnitState(UNIT_STATE_FOLLOW)) - { - if (Unit* owner = me->GetCharmerOrOwner()) - { - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - } - } - } - } - }; + void UpdateAI(uint32 diff) + { + checkTimer += diff; + if (checkTimer >= 1000) + { + checkTimer = 0; + if (Unit* target = me->SelectNearestTarget(30.0f)) + { + me->GetMotionMaster()->MoveChase(target); + if (me->GetDistance(target) < 3.0f) + { + me->CastSpell(me, bombSpellId, false); + me->DespawnOrUnsummon(500); + } + } + else if (!me->HasUnitState(UNIT_STATE_FOLLOW)) + { + if (Unit* owner = me->GetCharmerOrOwner()) + { + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + } + } + } + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_pet_gen_target_following_bombAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_pet_gen_target_following_bombAI (pCreature); + } }; class npc_pet_gen_gnomish_flame_turret : public CreatureScript @@ -493,46 +493,46 @@ class npc_pet_gen_gnomish_flame_turret : public CreatureScript public: npc_pet_gen_gnomish_flame_turret() : CreatureScript("npc_pet_gen_gnomish_flame_turret") { } - struct npc_pet_gen_gnomish_flame_turretAI : public ScriptedAI - { - npc_pet_gen_gnomish_flame_turretAI(Creature *c) : ScriptedAI(c) - { - checkTimer = 0; - } + struct npc_pet_gen_gnomish_flame_turretAI : public ScriptedAI + { + npc_pet_gen_gnomish_flame_turretAI(Creature *c) : ScriptedAI(c) + { + checkTimer = 0; + } - uint32 checkTimer; + uint32 checkTimer; - void Reset() - { - me->GetMotionMaster()->Clear(false); - } + void Reset() + { + me->GetMotionMaster()->Clear(false); + } - void AttackStart(Unit* who) - { - if (!who) - return; + void AttackStart(Unit* who) + { + if (!who) + return; - if (me->Attack(who, false)) - DoStartNoMovement(who); - } + if (me->Attack(who, false)) + DoStartNoMovement(who); + } - void UpdateAI(uint32 diff) - { - if (!me->GetVictim()) - return; + void UpdateAI(uint32 diff) + { + if (!me->GetVictim()) + return; - if (Unit* target = me->SelectVictim()) - { - AttackStart(target); - DoSpellAttackIfReady(me->m_spells[0]); - } - } - }; + if (Unit* target = me->SelectVictim()) + { + AttackStart(target); + DoSpellAttackIfReady(me->m_spells[0]); + } + } + }; - CreatureAI* GetAI(Creature* creature) const - { - return new npc_pet_gen_gnomish_flame_turretAI (creature); - } + CreatureAI* GetAI(Creature* creature) const + { + return new npc_pet_gen_gnomish_flame_turretAI (creature); + } }; class npc_pet_gen_valkyr_guardian : public CreatureScript @@ -540,59 +540,59 @@ class npc_pet_gen_valkyr_guardian : public CreatureScript public: npc_pet_gen_valkyr_guardian() : CreatureScript("npc_pet_gen_valkyr_guardian") { } - struct npc_pet_gen_valkyr_guardianAI : public ScriptedAI - { - npc_pet_gen_valkyr_guardianAI(Creature *c) : ScriptedAI(c) - { - me->SetReactState(REACT_DEFENSIVE); - me->SetDisableGravity(true); - me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - targetCheck = 0; - } + struct npc_pet_gen_valkyr_guardianAI : public ScriptedAI + { + npc_pet_gen_valkyr_guardianAI(Creature *c) : ScriptedAI(c) + { + me->SetReactState(REACT_DEFENSIVE); + me->SetDisableGravity(true); + me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + targetCheck = 0; + } - uint32 targetCheck; + uint32 targetCheck; - void InitializeAI() - { - if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - if (Unit* target = owner->GetSelectedUnit()) - if (!owner->IsFriendlyTo(target)) - AttackStart(target); - } + void InitializeAI() + { + if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (Unit* target = owner->GetSelectedUnit()) + if (!owner->IsFriendlyTo(target)) + AttackStart(target); + } - void OwnerAttacked(Unit* target) - { - if (!target || (me->GetVictim() && me->GetVictim()->IsAlive() && !me->GetVictim()->HasBreakableByDamageCrowdControlAura())) - return; + void OwnerAttacked(Unit* target) + { + if (!target || (me->GetVictim() && me->GetVictim()->IsAlive() && !me->GetVictim()->HasBreakableByDamageCrowdControlAura())) + return; - AttackStart(target); - } + AttackStart(target); + } - void UpdateAI(uint32 diff) - { - if (!UpdateVictim()) - { - targetCheck += diff; - if (targetCheck > 1000) - { - targetCheck = 0; - if (Unit* owner = me->GetCharmerOrOwner()) - if (Unit* ownerVictim = owner->GetVictim()) - if (!ownerVictim->HasBreakableByDamageCrowdControlAura()) - AttackStart(ownerVictim); - } - return; - } + void UpdateAI(uint32 diff) + { + if (!UpdateVictim()) + { + targetCheck += diff; + if (targetCheck > 1000) + { + targetCheck = 0; + if (Unit* owner = me->GetCharmerOrOwner()) + if (Unit* ownerVictim = owner->GetVictim()) + if (!ownerVictim->HasBreakableByDamageCrowdControlAura()) + AttackStart(ownerVictim); + } + return; + } - if (me->isAttackReady() && !me->GetVictim()->HasBreakableByDamageCrowdControlAura()) - DoSpellAttackIfReady(me->GetCreatureTemplate()->spells[0]); - } - }; + if (me->isAttackReady() && !me->GetVictim()->HasBreakableByDamageCrowdControlAura()) + DoSpellAttackIfReady(me->GetCreatureTemplate()->spells[0]); + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_pet_gen_valkyr_guardianAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_pet_gen_valkyr_guardianAI (pCreature); + } }; class spell_pet_gen_valkyr_guardian_smite : public SpellScriptLoader @@ -606,13 +606,13 @@ class spell_pet_gen_valkyr_guardian_smite : public SpellScriptLoader void RecalculateDamage() { - if (GetHitUnit() != GetCaster()) - { - std::list* targetsInfo = GetSpell()->GetUniqueTargetInfo(); - for (std::list::iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit) - if (ihit->targetGUID == GetCaster()->GetGUID()) - ihit->damage = -int32(GetHitDamage()*0.25f); - } + if (GetHitUnit() != GetCaster()) + { + std::list* targetsInfo = GetSpell()->GetUniqueTargetInfo(); + for (std::list::iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit) + if (ihit->targetGUID == GetCaster()->GetGUID()) + ihit->damage = -int32(GetHitDamage()*0.25f); + } } void Register() @@ -632,77 +632,77 @@ class npc_pet_gen_imp_in_a_bottle : public CreatureScript public: npc_pet_gen_imp_in_a_bottle() : CreatureScript("npc_pet_gen_imp_in_a_bottle") { } - struct npc_pet_gen_imp_in_a_bottleAI : public NullCreatureAI - { - npc_pet_gen_imp_in_a_bottleAI(Creature *c) : NullCreatureAI(c) - { - _talkTimer = 0; - _ownerGUID = 0; - _hasParty = false; - } + struct npc_pet_gen_imp_in_a_bottleAI : public NullCreatureAI + { + npc_pet_gen_imp_in_a_bottleAI(Creature *c) : NullCreatureAI(c) + { + _talkTimer = 0; + _ownerGUID = 0; + _hasParty = false; + } - WorldPacket _data; - uint32 _talkTimer; - uint64 _ownerGUID; - bool _hasParty; + WorldPacket _data; + uint32 _talkTimer; + uint64 _ownerGUID; + bool _hasParty; - void InitializeAI() - { - NullCreatureAI::InitializeAI(); + void InitializeAI() + { + NullCreatureAI::InitializeAI(); - if (TempSummon* summon = me->ToTempSummon()) - if (Unit* owner = summon->GetSummoner()) - if (owner->GetTypeId() == TYPEID_PLAYER) - { - _ownerGUID = owner->GetGUID(); - if (owner->ToPlayer()->GetGroup()) - { - _hasParty = true; - std::string const& text = sCreatureTextMgr->GetLocalizedChatString(me->GetEntry(), 0 /*text group*/, urand(0, 60) /*text id*/, LOCALE_enUS); + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* owner = summon->GetSummoner()) + if (owner->GetTypeId() == TYPEID_PLAYER) + { + _ownerGUID = owner->GetGUID(); + if (owner->ToPlayer()->GetGroup()) + { + _hasParty = true; + std::string const& text = sCreatureTextMgr->GetLocalizedChatString(me->GetEntry(), 0 /*text group*/, urand(0, 60) /*text id*/, LOCALE_enUS); - _data.Initialize(SMSG_MESSAGECHAT, 200); // guess size - _data << uint8(CHAT_MSG_MONSTER_PARTY); - _data << uint32(LANG_UNIVERSAL); - _data << uint64(me->GetGUID()); - _data << uint32(0); + _data.Initialize(SMSG_MESSAGECHAT, 200); // guess size + _data << uint8(CHAT_MSG_MONSTER_PARTY); + _data << uint32(LANG_UNIVERSAL); + _data << uint64(me->GetGUID()); + _data << uint32(0); _data << uint32(me->GetName().size() + 1); - _data << me->GetName(); - _data << uint64(0); - _data << uint32(text.size()+1); - _data << text.c_str(); - _data << uint8(0); - } - } - } + _data << me->GetName(); + _data << uint64(0); + _data << uint32(text.size()+1); + _data << text.c_str(); + _data << uint8(0); + } + } + } - void UpdateAI(uint32 diff) - { - _talkTimer += diff; - if (_talkTimer >= 5000) - { - _talkTimer = 0; - me->DespawnOrUnsummon(1); - if (!_hasParty) - Talk(0, ObjectAccessor::GetPlayer(*me, _ownerGUID)); - else if (Player* player = ObjectAccessor::GetPlayer(*me, _ownerGUID)) - { - uint8 limit = 0; - if (player->GetGroup()) - for (GroupReference* itr = player->GetGroup()->GetFirstMember(); itr != NULL && limit < 4; itr = itr->next(), ++limit) - if (Player* groupPlayer = itr->GetSource()) - if (groupPlayer != player) - groupPlayer->GetSession()->SendPacket(&_data); + void UpdateAI(uint32 diff) + { + _talkTimer += diff; + if (_talkTimer >= 5000) + { + _talkTimer = 0; + me->DespawnOrUnsummon(1); + if (!_hasParty) + Talk(0, ObjectAccessor::GetPlayer(*me, _ownerGUID)); + else if (Player* player = ObjectAccessor::GetPlayer(*me, _ownerGUID)) + { + uint8 limit = 0; + if (player->GetGroup()) + for (GroupReference* itr = player->GetGroup()->GetFirstMember(); itr != NULL && limit < 4; itr = itr->next(), ++limit) + if (Player* groupPlayer = itr->GetSource()) + if (groupPlayer != player) + groupPlayer->GetSession()->SendPacket(&_data); - player->GetSession()->SendPacket(&_data); - } - } - } - }; + player->GetSession()->SendPacket(&_data); + } + } + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_pet_gen_imp_in_a_bottleAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_pet_gen_imp_in_a_bottleAI (pCreature); + } }; class npc_pet_gen_wind_rider_cub : public CreatureScript @@ -710,82 +710,82 @@ class npc_pet_gen_wind_rider_cub : public CreatureScript public: npc_pet_gen_wind_rider_cub() : CreatureScript("npc_pet_gen_wind_rider_cub") { } - struct npc_pet_gen_wind_rider_cubAI : public NullCreatureAI - { - npc_pet_gen_wind_rider_cubAI(Creature *c) : NullCreatureAI(c) - { - allowMove = true; - isFlying = true; - checkTimer = 0; - checkTimer2 = 2000; - me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - } + struct npc_pet_gen_wind_rider_cubAI : public NullCreatureAI + { + npc_pet_gen_wind_rider_cubAI(Creature *c) : NullCreatureAI(c) + { + allowMove = true; + isFlying = true; + checkTimer = 0; + checkTimer2 = 2000; + me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); + } - bool isFlying; - bool allowMove; - uint32 checkTimer; - uint32 checkTimer2; + bool isFlying; + bool allowMove; + uint32 checkTimer; + uint32 checkTimer2; - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == 1) - allowMove = true; - } + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == 1) + allowMove = true; + } - void UpdateAI(uint32 diff) - { - checkTimer2 += diff; - if (checkTimer2 > 2000) - { - checkTimer2 = 0; - if (Unit* owner = me->GetOwner()) - { - if (owner->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)) - { - isFlying = true; - me->SetCanFly(true); - me->SetDisableGravity(true); - } - else if (isFlying) - { - isFlying = false; - me->SetCanFly(false); - me->SetDisableGravity(false); - me->GetMotionMaster()->MoveFall(); - } - } - } + void UpdateAI(uint32 diff) + { + checkTimer2 += diff; + if (checkTimer2 > 2000) + { + checkTimer2 = 0; + if (Unit* owner = me->GetOwner()) + { + if (owner->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)) + { + isFlying = true; + me->SetCanFly(true); + me->SetDisableGravity(true); + } + else if (isFlying) + { + isFlying = false; + me->SetCanFly(false); + me->SetDisableGravity(false); + me->GetMotionMaster()->MoveFall(); + } + } + } - checkTimer += diff; - if (allowMove || checkTimer > 2000) - { - allowMove = false; - checkTimer = 0; - if (Unit* owner = me->GetOwner()) - { - if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE || - me->GetDistance(owner) < 1.0f) - return; - float x, y, z; - owner->GetNearPoint2D(x, y, 0.5f, owner->GetOrientation()+PET_FOLLOW_ANGLE); - z = owner->GetPositionZ() + (isFlying ? 2.5f : 0.0f); + checkTimer += diff; + if (allowMove || checkTimer > 2000) + { + allowMove = false; + checkTimer = 0; + if (Unit* owner = me->GetOwner()) + { + if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE || + me->GetDistance(owner) < 1.0f) + return; + float x, y, z; + owner->GetNearPoint2D(x, y, 0.5f, owner->GetOrientation()+PET_FOLLOW_ANGLE); + z = owner->GetPositionZ() + (isFlying ? 2.5f : 0.0f); - me->GetMotionMaster()->MovePoint(1, x, y, z); - } - } - } - }; + me->GetMotionMaster()->MovePoint(1, x, y, z); + } + } + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_pet_gen_wind_rider_cubAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_pet_gen_wind_rider_cubAI (pCreature); + } }; enum turkey { - GO_BASIC_CAMPFIRE = 29784, - SPELL_TURKEY_STARTS_TO_BURN = 61768, + GO_BASIC_CAMPFIRE = 29784, + SPELL_TURKEY_STARTS_TO_BURN = 61768, }; class npc_pet_gen_plump_turkey : public CreatureScript @@ -793,68 +793,68 @@ class npc_pet_gen_plump_turkey : public CreatureScript public: npc_pet_gen_plump_turkey() : CreatureScript("npc_pet_gen_plump_turkey") { } - struct npc_pet_gen_plump_turkeyAI : public PassiveAI - { - npc_pet_gen_plump_turkeyAI(Creature *c) : PassiveAI(c) - { - goGUID = 0; - jumpTimer = 0; - checkTimer = 0; - jumping = false; - } + struct npc_pet_gen_plump_turkeyAI : public PassiveAI + { + npc_pet_gen_plump_turkeyAI(Creature *c) : PassiveAI(c) + { + goGUID = 0; + jumpTimer = 0; + checkTimer = 0; + jumping = false; + } - uint64 goGUID; - uint32 jumpTimer; - uint32 checkTimer; - bool jumping; + uint64 goGUID; + uint32 jumpTimer; + uint32 checkTimer; + bool jumping; - void MovementInform(uint32 type, uint32 id) - { - if (type == EFFECT_MOTION_TYPE && id == 1) - { - Unit::Kill(me, me); - me->AddAura(SPELL_TURKEY_STARTS_TO_BURN, me); - } - } + void MovementInform(uint32 type, uint32 id) + { + if (type == EFFECT_MOTION_TYPE && id == 1) + { + Unit::Kill(me, me); + me->AddAura(SPELL_TURKEY_STARTS_TO_BURN, me); + } + } - void UpdateAI(uint32 diff) - { - if (jumping) - return; + void UpdateAI(uint32 diff) + { + if (jumping) + return; - if (jumpTimer) - { - jumpTimer += diff; - if (jumpTimer >= 2000) - { - if (GameObject* go = me->GetMap()->GetGameObject(goGUID)) - me->GetMotionMaster()->MoveJump(*go, 5.0f, 10.0f, 1); - jumping = true; - } - return; - } + if (jumpTimer) + { + jumpTimer += diff; + if (jumpTimer >= 2000) + { + if (GameObject* go = me->GetMap()->GetGameObject(goGUID)) + me->GetMotionMaster()->MoveJump(*go, 5.0f, 10.0f, 1); + jumping = true; + } + return; + } - checkTimer += diff; - if (checkTimer > 3000) - { - checkTimer = 0; - if (GameObject* go = me->FindNearestGameObject(GO_BASIC_CAMPFIRE, 7.0f)) - { - goGUID = go->GetGUID(); - me->StopMoving(); - me->GetMotionMaster()->Clear(false); - me->SetFacingTo(me->GetAngle(go)); - Talk(0); - jumpTimer = 1; - } - } - } - }; + checkTimer += diff; + if (checkTimer > 3000) + { + checkTimer = 0; + if (GameObject* go = me->FindNearestGameObject(GO_BASIC_CAMPFIRE, 7.0f)) + { + goGUID = go->GetGUID(); + me->StopMoving(); + me->GetMotionMaster()->Clear(false); + me->SetFacingTo(me->GetAngle(go)); + Talk(0); + jumpTimer = 1; + } + } + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_pet_gen_plump_turkeyAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_pet_gen_plump_turkeyAI (pCreature); + } }; class npc_pet_gen_toxic_wasteling : public CreatureScript @@ -862,51 +862,51 @@ class npc_pet_gen_toxic_wasteling : public CreatureScript public: npc_pet_gen_toxic_wasteling() : CreatureScript("npc_pet_gen_toxic_wasteling") { } - struct npc_pet_gen_toxic_wastelingAI : public PassiveAI - { - npc_pet_gen_toxic_wastelingAI(Creature *c) : PassiveAI(c) - { - } + struct npc_pet_gen_toxic_wastelingAI : public PassiveAI + { + npc_pet_gen_toxic_wastelingAI(Creature *c) : PassiveAI(c) + { + } - uint32 checkTimer; + uint32 checkTimer; - void Reset() { checkTimer = 3000; } + void Reset() { checkTimer = 3000; } - void EnterEvadeMode() - { - } + void EnterEvadeMode() + { + } - void MovementInform(uint32 type, uint32 id) - { - if (type == EFFECT_MOTION_TYPE && id == 1) - checkTimer = 1; - } + void MovementInform(uint32 type, uint32 id) + { + if (type == EFFECT_MOTION_TYPE && id == 1) + checkTimer = 1; + } - void UpdateAI(uint32 diff) - { - if (checkTimer) - { - if (checkTimer == 1) - me->GetMotionMaster()->MovementExpired(false); - checkTimer += diff; - if (checkTimer >= 3000) - { - if (Unit* owner = me->GetCharmerOrOwner()) - { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); - } - me->AddAura(71854, me); // Growth - checkTimer = 0; - } - } - } - }; + void UpdateAI(uint32 diff) + { + if (checkTimer) + { + if (checkTimer == 1) + me->GetMotionMaster()->MovementExpired(false); + checkTimer += diff; + if (checkTimer >= 3000) + { + if (Unit* owner = me->GetCharmerOrOwner()) + { + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); + } + me->AddAura(71854, me); // Growth + checkTimer = 0; + } + } + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_pet_gen_toxic_wastelingAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_pet_gen_toxic_wastelingAI (pCreature); + } }; class npc_pet_gen_fetch_ball : public CreatureScript @@ -914,70 +914,70 @@ class npc_pet_gen_fetch_ball : public CreatureScript public: npc_pet_gen_fetch_ball() : CreatureScript("npc_pet_gen_fetch_ball") { } - struct npc_pet_gen_fetch_ballAI : public NullCreatureAI - { - npc_pet_gen_fetch_ballAI(Creature *c) : NullCreatureAI(c) - { - } + struct npc_pet_gen_fetch_ballAI : public NullCreatureAI + { + npc_pet_gen_fetch_ballAI(Creature *c) : NullCreatureAI(c) + { + } - uint32 checkTimer; - uint64 targetGUID; + uint32 checkTimer; + uint64 targetGUID; - void IsSummonedBy(Unit* summoner) - { - if (!summoner) - return; + void IsSummonedBy(Unit* summoner) + { + if (!summoner) + return; - me->SetOwnerGUID(summoner->GetGUID()); - checkTimer = 0; - targetGUID = 0; - me->CastSpell(me, 48649 /*SPELL_PET_TOY_FETCH_BALL_COME_HERE*/, true); - } + me->SetOwnerGUID(summoner->GetGUID()); + checkTimer = 0; + targetGUID = 0; + me->CastSpell(me, 48649 /*SPELL_PET_TOY_FETCH_BALL_COME_HERE*/, true); + } - void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) - { - if (spellInfo->Id == 48649 /*SPELL_PET_TOY_FETCH_BALL_COME_HERE*/) - { - target->GetMotionMaster()->MovePoint(50, me->GetHomePosition()); - targetGUID = target->GetGUID(); - } - } + void SpellHitTarget(Unit* target, const SpellInfo* spellInfo) + { + if (spellInfo->Id == 48649 /*SPELL_PET_TOY_FETCH_BALL_COME_HERE*/) + { + target->GetMotionMaster()->MovePoint(50, me->GetHomePosition()); + targetGUID = target->GetGUID(); + } + } - void UpdateAI(uint32 diff) - { - checkTimer += diff; - if (checkTimer >= 1000) - { - checkTimer = 0; - if (Creature* target = ObjectAccessor::GetCreature(*me, targetGUID)) - if (me->GetDistance2d(target) < 2.0f) - { - target->AI()->EnterEvadeMode(); - target->CastSpell(target, 48708 /*SPELL_PET_TOY_FETCH_BALL_HAS_BALL*/, true); - me->DespawnOrUnsummon(1); - } - } - } - }; + void UpdateAI(uint32 diff) + { + checkTimer += diff; + if (checkTimer >= 1000) + { + checkTimer = 0; + if (Creature* target = ObjectAccessor::GetCreature(*me, targetGUID)) + if (me->GetDistance2d(target) < 2.0f) + { + target->AI()->EnterEvadeMode(); + target->CastSpell(target, 48708 /*SPELL_PET_TOY_FETCH_BALL_HAS_BALL*/, true); + me->DespawnOrUnsummon(1); + } + } + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_pet_gen_fetch_ballAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_pet_gen_fetch_ballAI (pCreature); + } }; void AddSC_generic_pet_scripts() { new npc_pet_gen_mojo(); - new npc_pet_gen_soul_trader_beacon(); - new npc_pet_gen_argent_pony_bridle(); - new npc_pet_gen_target_following_bomb(); - new npc_pet_gen_gnomish_flame_turret(); - new npc_pet_gen_valkyr_guardian(); - new spell_pet_gen_valkyr_guardian_smite(); - new npc_pet_gen_imp_in_a_bottle(); - new npc_pet_gen_wind_rider_cub(); - new npc_pet_gen_plump_turkey(); - new npc_pet_gen_toxic_wasteling(); - new npc_pet_gen_fetch_ball(); + new npc_pet_gen_soul_trader_beacon(); + new npc_pet_gen_argent_pony_bridle(); + new npc_pet_gen_target_following_bomb(); + new npc_pet_gen_gnomish_flame_turret(); + new npc_pet_gen_valkyr_guardian(); + new spell_pet_gen_valkyr_guardian_smite(); + new npc_pet_gen_imp_in_a_bottle(); + new npc_pet_gen_wind_rider_cub(); + new npc_pet_gen_plump_turkey(); + new npc_pet_gen_toxic_wasteling(); + new npc_pet_gen_fetch_ball(); } diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp index 046c3d7fd..66e6ba38b 100644 --- a/src/server/scripts/Pet/pet_hunter.cpp +++ b/src/server/scripts/Pet/pet_hunter.cpp @@ -28,8 +28,8 @@ enum HunterSpells SPELL_HUNTER_CRIPPLING_POISON = 30981, // Viper SPELL_HUNTER_DEADLY_POISON_PASSIVE = 34657, // Venomous Snake SPELL_HUNTER_MIND_NUMBING_POISON = 25810, // Viper - SPELL_HUNTER_GLYPH_OF_SNAKE_TRAP = 56849, - SPELL_HUNTER_PET_SCALING = 62915 + SPELL_HUNTER_GLYPH_OF_SNAKE_TRAP = 56849, + SPELL_HUNTER_PET_SCALING = 62915 }; enum HunterCreatures @@ -46,50 +46,50 @@ class npc_pet_hunter_snake_trap : public CreatureScript { npc_pet_hunter_snake_trapAI(Creature* creature) : ScriptedAI(creature) { _init = false; } - void Reset() - { - _spellTimer = urand(1500, 3000); + void Reset() + { + _spellTimer = urand(1500, 3000); - // Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target - if (!me->GetVictim()) - if (Unit *tgt = me->SelectNearestTarget(10.0f)) - { - me->AddThreat(tgt, 100000.0f); - AttackStart(tgt); - } + // Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target + if (!me->GetVictim()) + if (Unit *tgt = me->SelectNearestTarget(10.0f)) + { + me->AddThreat(tgt, 100000.0f); + AttackStart(tgt); + } } - void EnterEvadeMode() - { - // _EnterEvadeMode(); - me->DeleteThreatList(); - me->CombatStop(true); - me->LoadCreaturesAddon(true); - me->SetLootRecipient(NULL); - me->ResetPlayerDamageReq(); - me->SetLastDamagedTime(0); - - me->AddUnitState(UNIT_STATE_EVADE); - me->GetMotionMaster()->MoveTargetedHome(); + void EnterEvadeMode() + { + // _EnterEvadeMode(); + me->DeleteThreatList(); + me->CombatStop(true); + me->LoadCreaturesAddon(true); + me->SetLootRecipient(NULL); + me->ResetPlayerDamageReq(); + me->SetLastDamagedTime(0); + + me->AddUnitState(UNIT_STATE_EVADE); + me->GetMotionMaster()->MoveTargetedHome(); - Reset(); - } + Reset(); + } - //Redefined for random target selection: - void MoveInLineOfSight(Unit* who) - { - if (!me->GetVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) - { - if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) - return; + //Redefined for random target selection: + void MoveInLineOfSight(Unit* who) + { + if (!me->GetVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + { + if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + return; - if (me->IsWithinDistInMap(who, 10.0f)) - { - me->AddThreat(who, 100000.0f); - AttackStart(who); - } - } - } + if (me->IsWithinDistInMap(who, 10.0f)) + { + me->AddThreat(who, 100000.0f); + AttackStart(who); + } + } + } void UpdateAI(uint32 diff) { @@ -102,35 +102,35 @@ class npc_pet_hunter_snake_trap : public CreatureScript return; } - if (!_init) - { - _init = true; + if (!_init) + { + _init = true; - CreatureTemplate const* Info = me->GetCreatureTemplate(); - uint32 health = uint32(107 * (me->getLevel() - 40) * 0.025f); - me->SetCreateHealth(health); + CreatureTemplate const* Info = me->GetCreatureTemplate(); + uint32 health = uint32(107 * (me->getLevel() - 40) * 0.025f); + me->SetCreateHealth(health); - for (uint8 stat = 0; stat < MAX_STATS; ++stat) - { - me->SetStat(Stats(stat), 0); - me->SetCreateStat(Stats(stat), 0); - } + for (uint8 stat = 0; stat < MAX_STATS; ++stat) + { + me->SetStat(Stats(stat), 0); + me->SetCreateStat(Stats(stat), 0); + } - me->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health); - me->SetMaxHealth(health); - //Add delta to make them not all hit the same time - uint32 delta = urand(0, 700); - me->SetAttackTime(BASE_ATTACK, Info->baseattacktime + delta); - me->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , float(Info->attackpower)); - me->CastSpell(me, SPELL_HUNTER_DEADLY_POISON_PASSIVE, true); + me->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, (float)health); + me->SetMaxHealth(health); + //Add delta to make them not all hit the same time + uint32 delta = urand(0, 700); + me->SetAttackTime(BASE_ATTACK, Info->baseattacktime + delta); + me->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , float(Info->attackpower)); + me->CastSpell(me, SPELL_HUNTER_DEADLY_POISON_PASSIVE, true); - // Glyph of Snake Trap - if (Unit* owner = me->GetOwner()) - if (owner->GetAuraEffectDummy(SPELL_HUNTER_GLYPH_OF_SNAKE_TRAP)) - me->CastSpell(me, SPELL_HUNTER_PET_SCALING, true); - } + // Glyph of Snake Trap + if (Unit* owner = me->GetOwner()) + if (owner->GetAuraEffectDummy(SPELL_HUNTER_GLYPH_OF_SNAKE_TRAP)) + me->CastSpell(me, SPELL_HUNTER_PET_SCALING, true); + } - _spellTimer += diff; + _spellTimer += diff; if (_spellTimer >= 3000) { if (urand(0, 2) == 0) // 33% chance to cast diff --git a/src/server/scripts/Pet/pet_mage.cpp b/src/server/scripts/Pet/pet_mage.cpp index 6dbc401e8..4f2a32cef 100644 --- a/src/server/scripts/Pet/pet_mage.cpp +++ b/src/server/scripts/Pet/pet_mage.cpp @@ -29,26 +29,26 @@ enum MageSpells { SPELL_MAGE_CLONE_ME = 45204, SPELL_MAGE_MASTERS_THREAT_LIST = 58838, - SPELL_PET_HIT_SCALING = 61013, - SPELL_SUMMON_MIRROR_IMAGE1 = 58831, - SPELL_SUMMON_MIRROR_IMAGE2 = 58833, - SPELL_SUMMON_MIRROR_IMAGE3 = 58834, - SPELL_SUMMON_MIRROR_IMAGE_GLYPH = 65047 + SPELL_PET_HIT_SCALING = 61013, + SPELL_SUMMON_MIRROR_IMAGE1 = 58831, + SPELL_SUMMON_MIRROR_IMAGE2 = 58833, + SPELL_SUMMON_MIRROR_IMAGE3 = 58834, + SPELL_SUMMON_MIRROR_IMAGE_GLYPH = 65047 }; class DeathEvent : public BasicEvent { - public: - DeathEvent(Creature& owner) : BasicEvent(), _owner(owner) { } + public: + DeathEvent(Creature& owner) : BasicEvent(), _owner(owner) { } - bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) - { - Unit::Kill(&_owner, &_owner); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*diff*/) + { + Unit::Kill(&_owner, &_owner); + return true; + } - private: - Creature& _owner; + private: + Creature& _owner; }; class npc_pet_mage_mirror_image : public CreatureScript @@ -60,8 +60,8 @@ class npc_pet_mage_mirror_image : public CreatureScript { npc_pet_mage_mirror_imageAI(Creature* creature) : CasterAI(creature) { } - uint32 selectionTimer; - uint64 _ebonGarogyleGUID; + uint32 selectionTimer; + uint64 _ebonGarogyleGUID; void InitializeAI() { @@ -73,60 +73,60 @@ class npc_pet_mage_mirror_image : public CreatureScript // Clone Me! owner->CastSpell(me, SPELL_MAGE_CLONE_ME, true); - // xinef: Glyph of Mirror Image (4th copy) - float angle = 0.0f; - switch (me->GetUInt32Value(UNIT_CREATED_BY_SPELL)) - { - case SPELL_SUMMON_MIRROR_IMAGE1: - angle = 0.5f * M_PI; - break; - case SPELL_SUMMON_MIRROR_IMAGE2: - angle = M_PI; - break; - case SPELL_SUMMON_MIRROR_IMAGE3: - angle = 1.5f * M_PI; - break; - } + // xinef: Glyph of Mirror Image (4th copy) + float angle = 0.0f; + switch (me->GetUInt32Value(UNIT_CREATED_BY_SPELL)) + { + case SPELL_SUMMON_MIRROR_IMAGE1: + angle = 0.5f * M_PI; + break; + case SPELL_SUMMON_MIRROR_IMAGE2: + angle = M_PI; + break; + case SPELL_SUMMON_MIRROR_IMAGE3: + angle = 1.5f * M_PI; + break; + } - ((Minion*)me)->SetFollowAngle(angle); - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); - me->SetReactState(REACT_PASSIVE); + ((Minion*)me)->SetFollowAngle(angle); + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); + me->SetReactState(REACT_PASSIVE); // Xinef: Inherit Master's Threat List (not yet implemented) //owner->CastSpell((Unit*)NULL, SPELL_MAGE_MASTERS_THREAT_LIST, true); - HostileReference* ref = owner->getHostileRefManager().getFirst(); - while (ref) - { - if (Unit* unit = ref->GetSource()->GetOwner()) - unit->AddThreat(me, ref->getThreat() - ref->getTempThreatModifier()); - ref = ref->next(); - } + HostileReference* ref = owner->getHostileRefManager().getFirst(); + while (ref) + { + if (Unit* unit = ref->GetSource()->GetOwner()) + unit->AddThreat(me, ref->getThreat() - ref->getTempThreatModifier()); + ref = ref->next(); + } - _ebonGarogyleGUID = 0; + _ebonGarogyleGUID = 0; - // Xinef: copy caster auras - Unit::VisibleAuraMap const* visibleAuraMap = owner->GetVisibleAuras(); - for (Unit::VisibleAuraMap::const_iterator itr = visibleAuraMap->begin(); itr != visibleAuraMap->end(); ++itr) - if (Aura* visAura = itr->second->GetBase()) - { - // Ebon Gargoyle - if (visAura->GetId() == 49206 && me->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_SUMMON_MIRROR_IMAGE1) - { - if (Unit* garogyle = visAura->GetCaster()) - _ebonGarogyleGUID = garogyle->GetGUID(); - continue; - } - SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(visAura->GetId()); - if (bounds.first != bounds.second) - continue; - std::vector const* spellTriggered = sSpellMgr->GetSpellLinked(visAura->GetId() + SPELL_LINK_AURA); - if (!spellTriggered || !spellTriggered->empty()) - continue; - if (Aura* newAura = me->AddAura(visAura->GetId(), me)) - newAura->SetDuration(visAura->GetDuration()); - } + // Xinef: copy caster auras + Unit::VisibleAuraMap const* visibleAuraMap = owner->GetVisibleAuras(); + for (Unit::VisibleAuraMap::const_iterator itr = visibleAuraMap->begin(); itr != visibleAuraMap->end(); ++itr) + if (Aura* visAura = itr->second->GetBase()) + { + // Ebon Gargoyle + if (visAura->GetId() == 49206 && me->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_SUMMON_MIRROR_IMAGE1) + { + if (Unit* garogyle = visAura->GetCaster()) + _ebonGarogyleGUID = garogyle->GetGUID(); + continue; + } + SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(visAura->GetId()); + if (bounds.first != bounds.second) + continue; + std::vector const* spellTriggered = sSpellMgr->GetSpellLinked(visAura->GetId() + SPELL_LINK_AURA); + if (!spellTriggered || !spellTriggered->empty()) + continue; + if (Aura* newAura = me->AddAura(visAura->GetId(), me)) + newAura->SetDuration(visAura->GetDuration()); + } - me->m_Events.AddEvent(new DeathEvent(*me), me->m_Events.CalculateTime(29500)); + me->m_Events.AddEvent(new DeathEvent(*me), me->m_Events.CalculateTime(29500)); } // Do not reload Creature templates on evade mode enter - prevent visual lost @@ -141,80 +141,80 @@ class npc_pet_mage_mirror_image : public CreatureScript if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW)) { me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); } } - bool MySelectNextTarget() - { - if (_ebonGarogyleGUID) - { - if (Unit* garogyle = ObjectAccessor::GetUnit(*me, _ebonGarogyleGUID)) - garogyle->GetAI()->AttackStart(me); - _ebonGarogyleGUID = 0; - } - Unit* owner = me->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER) - { - Unit* selection = owner->ToPlayer()->GetSelectedUnit(); - if (selection && selection != me->GetVictim()) - { - // target has cc, search target without cc! - if (selection->HasBreakableByDamageCrowdControlAura() || !me->IsValidAttackTarget(selection)) - { - return false; - } + bool MySelectNextTarget() + { + if (_ebonGarogyleGUID) + { + if (Unit* garogyle = ObjectAccessor::GetUnit(*me, _ebonGarogyleGUID)) + garogyle->GetAI()->AttackStart(me); + _ebonGarogyleGUID = 0; + } + Unit* owner = me->GetOwner(); + if (owner && owner->GetTypeId() == TYPEID_PLAYER) + { + Unit* selection = owner->ToPlayer()->GetSelectedUnit(); + if (selection && selection != me->GetVictim()) + { + // target has cc, search target without cc! + if (selection->HasBreakableByDamageCrowdControlAura() || !me->IsValidAttackTarget(selection)) + { + return false; + } - me->getThreatManager().resetAllAggro(); - me->AddThreat(selection, 1000000.0f); - AttackStart(selection); - return true; - } - } - return false; - } + me->getThreatManager().resetAllAggro(); + me->AddThreat(selection, 1000000.0f); + AttackStart(selection); + return true; + } + } + return false; + } - void Reset() - { - selectionTimer = 0; - } + void Reset() + { + selectionTimer = 0; + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - if (events.GetTimer() < 1200) - return; + void UpdateAI(uint32 diff) + { + events.Update(diff); + if (events.GetTimer() < 1200) + return; - if (!me->IsInCombat() || !me->GetVictim()) - { - MySelectNextTarget(); - return; - } + if (!me->IsInCombat() || !me->GetVictim()) + { + MySelectNextTarget(); + return; + } - if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive()) - { - me->InterruptNonMeleeSpells(false); - if (!MySelectNextTarget()) - EnterEvadeMode(); - return; - } + if (me->GetVictim()->HasBreakableByDamageCrowdControlAura() || !me->GetVictim()->IsAlive()) + { + me->InterruptNonMeleeSpells(false); + if (!MySelectNextTarget()) + EnterEvadeMode(); + return; + } - selectionTimer += diff; - if (selectionTimer >= 1000) - { - MySelectNextTarget(); - selectionTimer = 0; - } + selectionTimer += diff; + if (selectionTimer >= 1000) + { + MySelectNextTarget(); + selectionTimer = 0; + } - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (uint32 spellId = events.GetEvent()) - { - events.RescheduleEvent(spellId, spellId == 59637 ? 6500 : 2500); - me->CastSpell(me->GetVictim(), spellId, false); - } - } + if (uint32 spellId = events.GetEvent()) + { + events.RescheduleEvent(spellId, spellId == 59637 ? 6500 : 2500); + me->CastSpell(me->GetVictim(), spellId, false); + } + } }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Pet/pet_priest.cpp b/src/server/scripts/Pet/pet_priest.cpp index 880f88f00..376703404 100644 --- a/src/server/scripts/Pet/pet_priest.cpp +++ b/src/server/scripts/Pet/pet_priest.cpp @@ -30,7 +30,7 @@ enum PriestSpells { SPELL_PRIEST_GLYPH_OF_SHADOWFIEND = 58228, SPELL_PRIEST_GLYPH_OF_SHADOWFIEND_MANA = 58227, - SPELL_PRIEST_SHADOWFIEND_DODGE = 8273, + SPELL_PRIEST_SHADOWFIEND_DODGE = 8273, SPELL_PRIEST_LIGHTWELL_CHARGES = 59907 }; @@ -43,19 +43,19 @@ class npc_pet_pri_lightwell : public CreatureScript { npc_pet_pri_lightwellAI(Creature* creature) : TotemAI(creature) { } - void InitializeAI() - { - if (Unit* owner = me->ToTempSummon()->GetSummoner()) - { - uint32 hp = uint32(owner->GetMaxHealth()*0.3f); - me->SetMaxHealth(hp); - me->SetHealth(hp); - me->SetLevel(owner->getLevel()); - } + void InitializeAI() + { + if (Unit* owner = me->ToTempSummon()->GetSummoner()) + { + uint32 hp = uint32(owner->GetMaxHealth()*0.3f); + me->SetMaxHealth(hp); + me->SetHealth(hp); + me->SetLevel(owner->getLevel()); + } - me->CastSpell(me, SPELL_PRIEST_LIGHTWELL_CHARGES, false); // Spell for Lightwell Charges - TotemAI::InitializeAI(); - } + me->CastSpell(me, SPELL_PRIEST_LIGHTWELL_CHARGES, false); // Spell for Lightwell Charges + TotemAI::InitializeAI(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -73,15 +73,15 @@ class npc_pet_pri_shadowfiend : public CreatureScript { npc_pet_pri_shadowfiendAI(Creature* creature) : PetAI(creature) { } - void Reset() - { - PetAI::Reset(); - if (!me->HasAura(SPELL_PRIEST_SHADOWFIEND_DODGE)) - me->AddAura(SPELL_PRIEST_SHADOWFIEND_DODGE, me); + void Reset() + { + PetAI::Reset(); + if (!me->HasAura(SPELL_PRIEST_SHADOWFIEND_DODGE)) + me->AddAura(SPELL_PRIEST_SHADOWFIEND_DODGE, me); - if (Unit* target = me->SelectNearestTarget(15.0f)) - AttackStart(target); - } + if (Unit* target = me->SelectNearestTarget(15.0f)) + AttackStart(target); + } void JustDied(Unit* /*killer*/) { diff --git a/src/server/scripts/Pet/pet_shaman.cpp b/src/server/scripts/Pet/pet_shaman.cpp index 53d5549fd..3c712a912 100644 --- a/src/server/scripts/Pet/pet_shaman.cpp +++ b/src/server/scripts/Pet/pet_shaman.cpp @@ -57,22 +57,22 @@ class npc_pet_shaman_earth_elemental : public CreatureScript _events.ScheduleEvent(EVENT_SHAMAN_ANGEREDEARTH, 0); } - void InitializeAI() - { + void InitializeAI() + { me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); - } + } void UpdateAI(uint32 diff) { - if (_initAttack) - { - if (!me->IsInCombat()) - if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - if (Unit* target = owner->GetSelectedUnit()) - if (me->_CanDetectFeignDeathOf(target) && me->CanCreatureAttack(target)) - AttackStart(target); - _initAttack = false; - } + if (_initAttack) + { + if (!me->IsInCombat()) + if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (Unit* target = owner->GetSelectedUnit()) + if (me->_CanDetectFeignDeathOf(target) && me->CanCreatureAttack(target)) + AttackStart(target); + _initAttack = false; + } if (!UpdateVictim()) return; @@ -90,7 +90,7 @@ class npc_pet_shaman_earth_elemental : public CreatureScript private: EventMap _events; - bool _initAttack; + bool _initAttack; }; CreatureAI* GetAI(Creature* creature) const @@ -108,33 +108,33 @@ class npc_pet_shaman_fire_elemental : public CreatureScript { npc_pet_shaman_fire_elementalAI(Creature* creature) : ScriptedAI(creature), _initAttack(true) { } - void InitializeAI() - { + void InitializeAI() + { me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); - } + } - void EnterCombat(Unit*) - { + void EnterCombat(Unit*) + { _events.Reset(); _events.ScheduleEvent(EVENT_SHAMAN_FIRENOVA, urand(5000, 20000)); _events.ScheduleEvent(EVENT_SHAMAN_FIREBLAST, urand(5000, 20000)); //_events.ScheduleEvent(EVENT_SHAMAN_FIRESHIELD, 0); - me->RemoveAurasDueToSpell(SPELL_SHAMAN_FIRESHIELD); - me->CastSpell(me, SPELL_SHAMAN_FIRESHIELD, true); - } + me->RemoveAurasDueToSpell(SPELL_SHAMAN_FIRESHIELD); + me->CastSpell(me, SPELL_SHAMAN_FIRESHIELD, true); + } void UpdateAI(uint32 diff) { - if (_initAttack) - { - if (!me->IsInCombat()) - if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - if (Unit* target = owner->GetSelectedUnit()) - if (me->_CanDetectFeignDeathOf(target) && me->CanCreatureAttack(target)) - AttackStart(target); - _initAttack = false; - } + if (_initAttack) + { + if (!me->IsInCombat()) + if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (Unit* target = owner->GetSelectedUnit()) + if (me->_CanDetectFeignDeathOf(target) && me->CanCreatureAttack(target)) + AttackStart(target); + _initAttack = false; + } if (!UpdateVictim()) return; @@ -145,11 +145,11 @@ class npc_pet_shaman_fire_elemental : public CreatureScript switch (eventId) { case EVENT_SHAMAN_FIRENOVA: - me->CastSpell(me, SPELL_SHAMAN_FIRENOVA, false); + me->CastSpell(me, SPELL_SHAMAN_FIRENOVA, false); _events.ScheduleEvent(EVENT_SHAMAN_FIRENOVA, urand(8000, 15000)); break; case EVENT_SHAMAN_FIREBLAST: - me->CastSpell(me->GetVictim(), SPELL_SHAMAN_FIREBLAST, false); + me->CastSpell(me->GetVictim(), SPELL_SHAMAN_FIREBLAST, false); _events.ScheduleEvent(EVENT_SHAMAN_FIREBLAST, urand(4000, 8000)); break; default: @@ -162,7 +162,7 @@ class npc_pet_shaman_fire_elemental : public CreatureScript private: EventMap _events; - bool _initAttack; + bool _initAttack; }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index fa880c1a3..dcc443f31 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -34,11 +34,11 @@ enum DeathKnightSpells // Ours SPELL_DK_DEATH_AND_DECAY_TRIGGER = 52212, SPELL_DK_GLYPH_OF_SCOURGE_STRIKE = 58642, - SPELL_DK_WANDERING_PLAGUE_TRIGGER = 50526, - SPELL_DK_GLYPH_OF_THE_GHOUL = 58686, - SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE = 71904, - SPELL_SHADOWMOURNE_SOUL_FRAGMENT = 71905, - SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF = 73422, + SPELL_DK_WANDERING_PLAGUE_TRIGGER = 50526, + SPELL_DK_GLYPH_OF_THE_GHOUL = 58686, + SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE = 71904, + SPELL_SHADOWMOURNE_SOUL_FRAGMENT = 71905, + SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF = 73422, // Theirs SPELL_DK_ANTI_MAGIC_SHELL_TALENT = 51052, @@ -98,41 +98,41 @@ class spell_dk_wandering_plague : public SpellScriptLoader void FilterTargets(std::list& targets) { - static const AuraType ccAuras[] = - { - SPELL_AURA_MOD_CONFUSE, - SPELL_AURA_MOD_FEAR, - SPELL_AURA_MOD_STUN, - SPELL_AURA_MOD_ROOT, - SPELL_AURA_TRANSFORM, - SPELL_AURA_NONE - }; + static const AuraType ccAuras[] = + { + SPELL_AURA_MOD_CONFUSE, + SPELL_AURA_MOD_FEAR, + SPELL_AURA_MOD_STUN, + SPELL_AURA_MOD_ROOT, + SPELL_AURA_TRANSFORM, + SPELL_AURA_NONE + }; for (std::list::iterator itr = targets.begin(); itr != targets.end();) { - Unit* target = (*itr)->ToUnit(); - if (!target) - { + Unit* target = (*itr)->ToUnit(); + if (!target) + { targets.erase(itr++); - continue; - } + continue; + } - bool skip = false; - for (uint8 index = 0; !skip && ccAuras[index] != SPELL_AURA_NONE; ++index) - { - Unit::AuraEffectList const& auras = target->GetAuraEffectsByType(ccAuras[index]); - for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) - if ((*i)->GetAmount()) - { - skip = true; - break; - } - } + bool skip = false; + for (uint8 index = 0; !skip && ccAuras[index] != SPELL_AURA_NONE; ++index) + { + Unit::AuraEffectList const& auras = target->GetAuraEffectsByType(ccAuras[index]); + for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) + if ((*i)->GetAmount()) + { + skip = true; + break; + } + } if (skip) targets.erase(itr++); - else - ++itr; + else + ++itr; } } @@ -160,90 +160,90 @@ class spell_dk_raise_ally : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { if (Player* unitTarget = GetHitPlayer()) - { - unitTarget->CastSpell(unitTarget, GetEffectValue(), true); - if (Unit* ghoul = unitTarget->GetCharm()) - { - //health, mana, armor and resistance - PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(ghoul->GetEntry(), ghoul->getLevel()); - if (pInfo) // exist in DB - { - ghoul->SetCreateHealth(pInfo->health); - ghoul->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, pInfo->health); - ghoul->SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(pInfo->armor)); - for (uint8 stat = 0; stat < MAX_STATS; ++stat) - ghoul->SetCreateStat(Stats(stat), float(pInfo->stats[stat])); - } + { + unitTarget->CastSpell(unitTarget, GetEffectValue(), true); + if (Unit* ghoul = unitTarget->GetCharm()) + { + //health, mana, armor and resistance + PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(ghoul->GetEntry(), ghoul->getLevel()); + if (pInfo) // exist in DB + { + ghoul->SetCreateHealth(pInfo->health); + ghoul->SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, pInfo->health); + ghoul->SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(pInfo->armor)); + for (uint8 stat = 0; stat < MAX_STATS; ++stat) + ghoul->SetCreateStat(Stats(stat), float(pInfo->stats[stat])); + } - ghoul->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(ghoul->getLevel() - (ghoul->getLevel() / 4))); - ghoul->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(ghoul->getLevel() + (ghoul->getLevel() / 4))); + ghoul->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(ghoul->getLevel() - (ghoul->getLevel() / 4))); + ghoul->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(ghoul->getLevel() + (ghoul->getLevel() / 4))); - // Avoidance, Night of the Dead - if (Aura *aur = ghoul->AddAura(62137, ghoul)) - if (AuraEffect *aurEff = GetCaster()->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0)) - if (aur->GetEffect(0)) - aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue()); + // Avoidance, Night of the Dead + if (Aura *aur = ghoul->AddAura(62137, ghoul)) + if (AuraEffect *aurEff = GetCaster()->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0)) + if (aur->GetEffect(0)) + aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue()); - // Hit / Expertise scalling, warlock / hunter pets have this by default - ghoul->AddAura(SPELL_HUNTER_PET_SCALING_04, ghoul); + // Hit / Expertise scalling, warlock / hunter pets have this by default + ghoul->AddAura(SPELL_HUNTER_PET_SCALING_04, ghoul); - // DK Ghoul haste refresh - float val = (GetCaster()->m_modAttackSpeedPct[BASE_ATTACK] - 1.0f) * 100.0f; - ghoul->m_modAttackSpeedPct[BASE_ATTACK] = GetCaster()->m_modAttackSpeedPct[BASE_ATTACK]; - ghoul->SetFloatValue(UNIT_FIELD_BASEATTACKTIME, 2000.0f); - ghoul->ApplyPercentModFloatValue(UNIT_FIELD_BASEATTACKTIME, val, true); // we want to reduce attack time + // DK Ghoul haste refresh + float val = (GetCaster()->m_modAttackSpeedPct[BASE_ATTACK] - 1.0f) * 100.0f; + ghoul->m_modAttackSpeedPct[BASE_ATTACK] = GetCaster()->m_modAttackSpeedPct[BASE_ATTACK]; + ghoul->SetFloatValue(UNIT_FIELD_BASEATTACKTIME, 2000.0f); + ghoul->ApplyPercentModFloatValue(UNIT_FIELD_BASEATTACKTIME, val, true); // we want to reduce attack time - // Strength + Stamina - for (uint8 i = STAT_STRENGTH; i <= STAT_STAMINA; ++i) - { - Stats stat = Stats(i); - if (stat != STAT_STRENGTH && stat != STAT_STAMINA) - continue; + // Strength + Stamina + for (uint8 i = STAT_STRENGTH; i <= STAT_STAMINA; ++i) + { + Stats stat = Stats(i); + if (stat != STAT_STRENGTH && stat != STAT_STAMINA) + continue; - float value = 0.0f; - float mod = (stat == STAT_STAMINA ? 0.3f : 0.7f); + float value = 0.0f; + float mod = (stat == STAT_STAMINA ? 0.3f : 0.7f); - // Check just if owner has Ravenous Dead since it's effect is not an aura - AuraEffect const* aurEff = GetCaster()->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); - if (aurEff) - { - SpellInfo const* spellInfo = aurEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value - AddPct(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale - } - // Glyph of the Ghoul - aurEff = GetCaster()->GetAuraEffect(SPELL_DK_GLYPH_OF_THE_GHOUL, EFFECT_0); - if (aurEff) - mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod + // Check just if owner has Ravenous Dead since it's effect is not an aura + AuraEffect const* aurEff = GetCaster()->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); + if (aurEff) + { + SpellInfo const* spellInfo = aurEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value + AddPct(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale + } + // Glyph of the Ghoul + aurEff = GetCaster()->GetAuraEffect(SPELL_DK_GLYPH_OF_THE_GHOUL, EFFECT_0); + if (aurEff) + mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod - value = float(GetCaster()->GetStat(stat)) * mod; - value = ghoul->GetTotalStatValue(stat, value); - ghoul->SetStat(stat, int32(value)); - ghoul->ApplyStatBuffMod(stat, value, true); - } + value = float(GetCaster()->GetStat(stat)) * mod; + value = ghoul->GetTotalStatValue(stat, value); + ghoul->SetStat(stat, int32(value)); + ghoul->ApplyStatBuffMod(stat, value, true); + } - // Attack Power - ghoul->SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, 589 + ghoul->GetStat(STAT_STRENGTH) + ghoul->GetStat(STAT_AGILITY)); - ghoul->SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)ghoul->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * ghoul->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT)); - ghoul->SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, (int32)ghoul->GetModifierValue(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE)); - ghoul->SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, ghoul->GetModifierValue(UNIT_MOD_ATTACK_POWER, TOTAL_PCT) - 1.0f); + // Attack Power + ghoul->SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, 589 + ghoul->GetStat(STAT_STRENGTH) + ghoul->GetStat(STAT_AGILITY)); + ghoul->SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)ghoul->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * ghoul->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT)); + ghoul->SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, (int32)ghoul->GetModifierValue(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE)); + ghoul->SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, ghoul->GetModifierValue(UNIT_MOD_ATTACK_POWER, TOTAL_PCT) - 1.0f); - // Health - ghoul->SetModifierValue(UNIT_MOD_HEALTH, TOTAL_VALUE, (ghoul->GetStat(STAT_STAMINA) - ghoul->GetCreateStat(STAT_STAMINA))*10.0f); + // Health + ghoul->SetModifierValue(UNIT_MOD_HEALTH, TOTAL_VALUE, (ghoul->GetStat(STAT_STAMINA) - ghoul->GetCreateStat(STAT_STAMINA))*10.0f); - // Power Energy - ghoul->SetModifierValue(UnitMods(UNIT_MOD_POWER_START+POWER_ENERGY), BASE_VALUE, ghoul->GetCreatePowers(POWER_ENERGY)); - ghoul->UpdateAllStats(); - ghoul->SetFullHealth(); + // Power Energy + ghoul->SetModifierValue(UnitMods(UNIT_MOD_POWER_START+POWER_ENERGY), BASE_VALUE, ghoul->GetCreatePowers(POWER_ENERGY)); + ghoul->UpdateAllStats(); + ghoul->SetFullHealth(); - // Aura Immunities - ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_MELEE_RANGED_HASTE, true, SPELL_BLOCK_TYPE_POSITIVE); - ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MELEE_SLOW, true, SPELL_BLOCK_TYPE_POSITIVE); - ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_STAT, true, SPELL_BLOCK_TYPE_POSITIVE); - ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); - ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER, true, SPELL_BLOCK_TYPE_POSITIVE); - ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); - } - } + // Aura Immunities + ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_MELEE_RANGED_HASTE, true, SPELL_BLOCK_TYPE_POSITIVE); + ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MELEE_SLOW, true, SPELL_BLOCK_TYPE_POSITIVE); + ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_STAT, true, SPELL_BLOCK_TYPE_POSITIVE); + ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); + ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER, true, SPELL_BLOCK_TYPE_POSITIVE); + ghoul->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); + } + } } void Register() @@ -267,16 +267,16 @@ class spell_dk_raise_ally_trigger : public SpellScriptLoader { PrepareAuraScript(spell_dk_raise_ally_trigger_AuraScript); - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* charm = GetUnitOwner()->GetCharm()) - if (charm->GetEntry() == GetSpellInfo()->Effects[EFFECT_0].MiscValue) - charm->ToCreature()->DespawnOrUnsummon(); - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* charm = GetUnitOwner()->GetCharm()) + if (charm->GetEntry() == GetSpellInfo()->Effects[EFFECT_0].MiscValue) + charm->ToCreature()->DespawnOrUnsummon(); + } void Register() { - OnEffectRemove += AuraEffectRemoveFn(spell_dk_raise_ally_trigger_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_dk_raise_ally_trigger_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -299,13 +299,13 @@ class spell_dk_aotd_taunt : public SpellScriptLoader { for (std::list::iterator itr = targets.begin(); itr != targets.end();) { - // ignore bosses + // ignore bosses if (Creature* cr = (*itr)->ToCreature()) - if (cr->isWorldBoss()) - { - targets.erase(itr++); - continue; - } + if (cr->isWorldBoss()) + { + targets.erase(itr++); + continue; + } ++itr; } @@ -334,28 +334,28 @@ class spell_dk_death_and_decay : public SpellScriptLoader void RecalculateDamage() { - Unit* caster = GetCaster(); - Unit* target = GetHitUnit(); - int32 damage = GetHitDamage(); + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + int32 damage = GetHitDamage(); - // T10P2 bonus - if (AuraEffect* aurEff = caster->GetAuraEffectDummy(70650)) - AddPct(damage, aurEff->GetAmount()); - // Glyph of Death and Decay - if (AuraEffect* aurEff = caster->GetAuraEffect(58629, EFFECT_0)) - AddPct(damage, aurEff->GetAmount()); + // T10P2 bonus + if (AuraEffect* aurEff = caster->GetAuraEffectDummy(70650)) + AddPct(damage, aurEff->GetAmount()); + // Glyph of Death and Decay + if (AuraEffect* aurEff = caster->GetAuraEffect(58629, EFFECT_0)) + AddPct(damage, aurEff->GetAmount()); - // Xinef: include AOE damage reducing auras - if (target) - damage = target->CalculateAOEDamageReduction(damage, GetSpellInfo()->SchoolMask, caster); + // Xinef: include AOE damage reducing auras + if (target) + damage = target->CalculateAOEDamageReduction(damage, GetSpellInfo()->SchoolMask, caster); - SetHitDamage(damage); + SetHitDamage(damage); } void Register() { - if (m_scriptSpellId == SPELL_DK_DEATH_AND_DECAY_TRIGGER) - OnHit += SpellHitFn(spell_dk_death_and_decay_SpellScript::RecalculateDamage); + if (m_scriptSpellId == SPELL_DK_DEATH_AND_DECAY_TRIGGER) + OnHit += SpellHitFn(spell_dk_death_and_decay_SpellScript::RecalculateDamage); } }; @@ -371,17 +371,17 @@ class spell_dk_death_and_decay : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - if (GetCaster() && GetTarget()) - { - int32 basePoints0 = aurEff->GetAmount(); - GetCaster()->CastCustomSpell(GetTarget(), SPELL_DK_DEATH_AND_DECAY_TRIGGER, &basePoints0, NULL, NULL, true, 0, aurEff); - } + if (GetCaster() && GetTarget()) + { + int32 basePoints0 = aurEff->GetAmount(); + GetCaster()->CastCustomSpell(GetTarget(), SPELL_DK_DEATH_AND_DECAY_TRIGGER, &basePoints0, NULL, NULL, true, 0, aurEff); + } } void Register() { - if (m_scriptSpellId != SPELL_DK_DEATH_AND_DECAY_TRIGGER) - OnEffectPeriodic += AuraEffectPeriodicFn(spell_dk_death_and_decay_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + if (m_scriptSpellId != SPELL_DK_DEATH_AND_DECAY_TRIGGER) + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dk_death_and_decay_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -401,23 +401,23 @@ class spell_dk_master_of_ghouls : public SpellScriptLoader PrepareAuraScript(spell_dk_master_of_ghouls_AuraScript); void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (target->GetTypeId() == TYPEID_PLAYER) - target->ToPlayer()->SetShowDKPet(true); - } + { + Unit* target = GetTarget(); + if (target->GetTypeId() == TYPEID_PLAYER) + target->ToPlayer()->SetShowDKPet(true); + } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (target->GetTypeId() == TYPEID_PLAYER) - target->ToPlayer()->SetShowDKPet(false); - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (target->GetTypeId() == TYPEID_PLAYER) + target->ToPlayer()->SetShowDKPet(false); + } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_dk_master_of_ghouls_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_ADD_FLAT_MODIFIER, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_dk_master_of_ghouls_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_ADD_FLAT_MODIFIER, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_dk_master_of_ghouls_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_ADD_FLAT_MODIFIER, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_dk_master_of_ghouls_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_ADD_FLAT_MODIFIER, AURA_EFFECT_HANDLE_REAL); } }; @@ -438,13 +438,13 @@ class spell_dk_chains_of_ice : public SpellScriptLoader void HandleAfterCast() { - if (Unit* target = GetExplTargetUnit()) - { - std::list const* targetsInfo = GetSpell()->GetUniqueTargetInfo(); - for (std::list::const_iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit) - if (ihit->missCondition == SPELL_MISS_NONE && ihit->targetGUID == target->GetGUID()) - GetCaster()->CastSpell(target, 55095 /*SPELL_FROST_FEVER*/, true); - } + if (Unit* target = GetExplTargetUnit()) + { + std::list const* targetsInfo = GetSpell()->GetUniqueTargetInfo(); + for (std::list::const_iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit) + if (ihit->missCondition == SPELL_MISS_NONE && ihit->targetGUID == target->GetGUID()) + GetCaster()->CastSpell(target, 55095 /*SPELL_FROST_FEVER*/, true); + } } void Register() @@ -458,32 +458,32 @@ class spell_dk_chains_of_ice : public SpellScriptLoader return new spell_dk_chains_of_ice_SpellScript(); } - class spell_dk_chains_of_ice_AuraScript : public AuraScript - { - PrepareAuraScript(spell_dk_chains_of_ice_AuraScript); + class spell_dk_chains_of_ice_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dk_chains_of_ice_AuraScript); - void HandlePeriodic(AuraEffect* aurEff) - { - // Get 0 effect aura - if (AuraEffect* slow = GetAura()->GetEffect(0)) + void HandlePeriodic(AuraEffect* aurEff) + { + // Get 0 effect aura + if (AuraEffect* slow = GetAura()->GetEffect(0)) { int32 newAmount = slow->GetAmount() + aurEff->GetAmount(); if (newAmount > 0) newAmount = 0; slow->ChangeAmount(newAmount); } - } + } - void Register() - { - OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dk_chains_of_ice_AuraScript::HandlePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_dk_chains_of_ice_AuraScript::HandlePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_dk_chains_of_ice_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_dk_chains_of_ice_AuraScript(); + } }; class spell_dk_bloodworms : public SpellScriptLoader @@ -497,7 +497,7 @@ class spell_dk_bloodworms : public SpellScriptLoader void HandleSummon(SpellEffIndex /*effIndex*/) { - SetEffectValue(irand(2, 4)); + SetEffectValue(irand(2, 4)); } void Register() @@ -524,8 +524,8 @@ class spell_dk_summon_gargoyle : public SpellScriptLoader void SetDest(SpellDestination& dest) { // Adjust effect summon position - if (GetCaster()->IsWithinLOS(dest._position.GetPositionX(), dest._position.GetPositionY(), dest._position.GetPositionZ()+15.0f)) - dest._position.m_positionZ += 15.0f; + if (GetCaster()->IsWithinLOS(dest._position.GetPositionX(), dest._position.GetPositionY(), dest._position.GetPositionZ()+15.0f)) + dest._position.m_positionZ += 15.0f; } void Register() @@ -551,7 +551,7 @@ class spell_dk_improved_blood_presence_proc : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetDamageInfo()->GetDamage(); + return eventInfo.GetDamageInfo()->GetDamage(); } void Register() @@ -577,23 +577,23 @@ class spell_dk_wandering_plague_aura : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); - if (!spellInfo || !eventInfo.GetActionTarget()) - return false; + const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); + if (!spellInfo || !eventInfo.GetActionTarget()) + return false; - if (!roll_chance_f(eventInfo.GetActor()->GetUnitCriticalChance(BASE_ATTACK, eventInfo.GetActionTarget()))) - return false; + if (!roll_chance_f(eventInfo.GetActor()->GetUnitCriticalChance(BASE_ATTACK, eventInfo.GetActionTarget()))) + return false; - return !eventInfo.GetActor()->HasSpellCooldown(SPELL_DK_WANDERING_PLAGUE_TRIGGER); + return !eventInfo.GetActor()->HasSpellCooldown(SPELL_DK_WANDERING_PLAGUE_TRIGGER); } - // xinef: prevent default proc with castItem passed, which applies 30 sec cooldown to procing of the aura + // xinef: prevent default proc with castItem passed, which applies 30 sec cooldown to procing of the aura void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - - eventInfo.GetActor()->AddSpellCooldown(SPELL_DK_WANDERING_PLAGUE_TRIGGER, 0, 1000); - eventInfo.GetActor()->CastCustomSpell(SPELL_DK_WANDERING_PLAGUE_TRIGGER, SPELLVALUE_BASE_POINT0, CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()), eventInfo.GetActionTarget(), TRIGGERED_FULL_MASK); + + eventInfo.GetActor()->AddSpellCooldown(SPELL_DK_WANDERING_PLAGUE_TRIGGER, 0, 1000); + eventInfo.GetActor()->CastCustomSpell(SPELL_DK_WANDERING_PLAGUE_TRIGGER, SPELLVALUE_BASE_POINT0, CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()), eventInfo.GetActionTarget(), TRIGGERED_FULL_MASK); } void Register() @@ -620,10 +620,10 @@ class spell_dk_rune_of_the_fallen_crusader : public SpellScriptLoader void RecalculateDamage() { - std::list* targetsInfo = GetSpell()->GetUniqueTargetInfo(); - for (std::list::iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit) - if (ihit->targetGUID == GetCaster()->GetGUID()) - ihit->crit = roll_chance_f(GetCaster()->GetFloatValue(PLAYER_CRIT_PERCENTAGE)); + std::list* targetsInfo = GetSpell()->GetUniqueTargetInfo(); + for (std::list::iterator ihit = targetsInfo->begin(); ihit != targetsInfo->end(); ++ihit) + if (ihit->targetGUID == GetCaster()->GetGUID()) + ihit->crit = roll_chance_f(GetCaster()->GetFloatValue(PLAYER_CRIT_PERCENTAGE)); } void Register() @@ -649,9 +649,9 @@ class spell_dk_bone_shield : public SpellScriptLoader void HandleProc(ProcEventInfo& eventInfo) { - PreventDefaultAction(); - if (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->IsTargetingArea()) - DropCharge(); + PreventDefaultAction(); + if (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->IsTargetingArea()) + DropCharge(); } void Register() @@ -677,9 +677,9 @@ class spell_dk_hungering_cold : public SpellScriptLoader void HandleProc(ProcEventInfo& eventInfo) { - PreventDefaultAction(); - if (eventInfo.GetDamageInfo()->GetDamage() > 0 && (!eventInfo.GetDamageInfo()->GetSpellInfo() || eventInfo.GetDamageInfo()->GetSpellInfo()->Dispel != DISPEL_DISEASE)) - SetDuration(0); + PreventDefaultAction(); + if (eventInfo.GetDamageInfo()->GetDamage() > 0 && (!eventInfo.GetDamageInfo()->GetSpellInfo() || eventInfo.GetDamageInfo()->GetSpellInfo()->Dispel != DISPEL_DISEASE)) + SetDuration(0); } void Register() @@ -705,29 +705,29 @@ class spell_dk_blood_caked_blade : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetActionTarget() && eventInfo.GetActionTarget()->IsAlive(); + return eventInfo.GetActionTarget() && eventInfo.GetActionTarget()->IsAlive(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true, NULL, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true, NULL, aurEff); - // Xinef: Shadowmourne hack (blood-caked blade trigger proc disabled...) - if (roll_chance_i(75) && eventInfo.GetActor()->FindMap() && !eventInfo.GetActor()->FindMap()->IsBattlegroundOrArena() && eventInfo.GetActor()->HasAura(71903) && !eventInfo.GetActor()->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) - { - eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true); + // Xinef: Shadowmourne hack (blood-caked blade trigger proc disabled...) + if (roll_chance_i(75) && eventInfo.GetActor()->FindMap() && !eventInfo.GetActor()->FindMap()->IsBattlegroundOrArena() && eventInfo.GetActor()->HasAura(71903) && !eventInfo.GetActor()->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) + { + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true); - // this can't be handled in AuraScript of SoulFragments because we need to know victim - if (Aura* soulFragments = eventInfo.GetActor()->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT)) - { - if (soulFragments->GetStackAmount() >= 10) - { - eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, NULL); - soulFragments->Remove(); - } - } - } + // this can't be handled in AuraScript of SoulFragments because we need to know victim + if (Aura* soulFragments = eventInfo.GetActor()->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT)) + { + if (soulFragments->GetStackAmount() >= 10) + { + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, NULL); + soulFragments->Remove(); + } + } + } } void Register() @@ -754,72 +754,72 @@ class spell_dk_dancing_rune_weapon : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - if (!eventInfo.GetActor() || !eventInfo.GetActionTarget() || !eventInfo.GetActionTarget()->IsAlive() || eventInfo.GetActor()->GetTypeId() != TYPEID_PLAYER) - return false; + if (!eventInfo.GetActor() || !eventInfo.GetActionTarget() || !eventInfo.GetActionTarget()->IsAlive() || eventInfo.GetActor()->GetTypeId() != TYPEID_PLAYER) + return false; - const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); - if (!spellInfo) - return true; + const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); + if (!spellInfo) + return true; - // Death Coil exception, Check if spell is from spellbook - if (spellInfo->Id != SPELL_DK_DEATH_COIL_DAMAGE && !eventInfo.GetActor()->ToPlayer()->HasActiveSpell(spellInfo->Id)) - return false; - - // Can't cast raise dead/ally, death grip, dark command, death pact, death and decay, anti-magic shell - if (spellInfo->SpellFamilyFlags.HasFlag(0x20A1220, 0x10000000, 0x0)) - return false; + // Death Coil exception, Check if spell is from spellbook + if (spellInfo->Id != SPELL_DK_DEATH_COIL_DAMAGE && !eventInfo.GetActor()->ToPlayer()->HasActiveSpell(spellInfo->Id)) + return false; + + // Can't cast raise dead/ally, death grip, dark command, death pact, death and decay, anti-magic shell + if (spellInfo->SpellFamilyFlags.HasFlag(0x20A1220, 0x10000000, 0x0)) + return false; - // AoE can be cast only once - if (spellInfo->IsTargetingArea() && eventInfo.GetActor() != eventInfo.GetActionTarget()) - return false; + // AoE can be cast only once + if (spellInfo->IsTargetingArea() && eventInfo.GetActor() != eventInfo.GetActionTarget()) + return false; - // No spells with summoning - if (spellInfo->HasEffect(SPELL_EFFECT_SUMMON)) - return false; + // No spells with summoning + if (spellInfo->HasEffect(SPELL_EFFECT_SUMMON)) + return false; - // No Positive Spells - if (spellInfo->IsPositive()) - return false; + // No Positive Spells + if (spellInfo->IsPositive()) + return false; - return true; + return true; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - Unit* player = eventInfo.GetActor(); - Unit* target = eventInfo.GetActionTarget(); - Unit* dancingRuneWeapon = NULL; - for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr) - if ((*itr)->GetEntry() == GetSpellInfo()->Effects[EFFECT_0].MiscValue) - { - dancingRuneWeapon = *itr; - break; - } - - if (!dancingRuneWeapon) - return; + Unit* player = eventInfo.GetActor(); + Unit* target = eventInfo.GetActionTarget(); + Unit* dancingRuneWeapon = NULL; + for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr) + if ((*itr)->GetEntry() == GetSpellInfo()->Effects[EFFECT_0].MiscValue) + { + dancingRuneWeapon = *itr; + break; + } + + if (!dancingRuneWeapon) + return; - dancingRuneWeapon->SetOrientation(dancingRuneWeapon->GetAngle(target)); - if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo()) + dancingRuneWeapon->SetOrientation(dancingRuneWeapon->GetAngle(target)); + if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo()) { - // xinef: ugly hack - if (!procSpell->IsAffectingArea()) - GetUnitOwner()->SetFloatValue(UNIT_FIELD_COMBATREACH, 10.0f); - dancingRuneWeapon->CastSpell(target, procSpell->Id, true, NULL, aurEff, dancingRuneWeapon->GetGUID()); - GetUnitOwner()->SetFloatValue(UNIT_FIELD_COMBATREACH, 0.01f); + // xinef: ugly hack + if (!procSpell->IsAffectingArea()) + GetUnitOwner()->SetFloatValue(UNIT_FIELD_COMBATREACH, 10.0f); + dancingRuneWeapon->CastSpell(target, procSpell->Id, true, NULL, aurEff, dancingRuneWeapon->GetGUID()); + GetUnitOwner()->SetFloatValue(UNIT_FIELD_COMBATREACH, 0.01f); } else { target = player->GetMeleeHitRedirectTarget(target); - CalcDamageInfo damageInfo; - player->CalculateMeleeDamage(target, 0, &damageInfo, eventInfo.GetDamageInfo()->GetAttackType()); - Unit::DealDamageMods(target, damageInfo.damage, &damageInfo.absorb); - damageInfo.attacker = dancingRuneWeapon; - damageInfo.damage /= 2.0f; - dancingRuneWeapon->SendAttackStateUpdate(&damageInfo); - dancingRuneWeapon->DealMeleeDamage(&damageInfo, true); + CalcDamageInfo damageInfo; + player->CalculateMeleeDamage(target, 0, &damageInfo, eventInfo.GetDamageInfo()->GetAttackType()); + Unit::DealDamageMods(target, damageInfo.damage, &damageInfo.absorb); + damageInfo.attacker = dancingRuneWeapon; + damageInfo.damage /= 2.0f; + dancingRuneWeapon->SendAttackStateUpdate(&damageInfo); + dancingRuneWeapon->DealMeleeDamage(&damageInfo, true); } } @@ -846,19 +846,19 @@ class spell_dk_dancing_rune_weapon_visual : public SpellScriptLoader PrepareAuraScript(spell_dk_dancing_rune_weapon_visual_AuraScript); void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - PreventDefaultAction(); - if (Unit* owner = GetUnitOwner()->ToTempSummon()->GetSummoner()) - { - GetUnitOwner()->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, owner->GetUInt32Value(PLAYER_VISIBLE_ITEM_16_ENTRYID)); - GetUnitOwner()->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, owner->GetUInt32Value(PLAYER_VISIBLE_ITEM_17_ENTRYID)); - GetUnitOwner()->SetFloatValue(UNIT_FIELD_COMBATREACH, 0.01f); - } - } + { + PreventDefaultAction(); + if (Unit* owner = GetUnitOwner()->ToTempSummon()->GetSummoner()) + { + GetUnitOwner()->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, owner->GetUInt32Value(PLAYER_VISIBLE_ITEM_16_ENTRYID)); + GetUnitOwner()->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, owner->GetUInt32Value(PLAYER_VISIBLE_ITEM_17_ENTRYID)); + GetUnitOwner()->SetFloatValue(UNIT_FIELD_COMBATREACH, 0.01f); + } + } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_dk_dancing_rune_weapon_visual_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_dk_dancing_rune_weapon_visual_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -879,7 +879,7 @@ class spell_dk_scent_of_blood_trigger : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return (eventInfo.GetHitMask() & (PROC_EX_DODGE|PROC_EX_PARRY)) || eventInfo.GetDamageInfo()->GetDamage(); + return (eventInfo.GetHitMask() & (PROC_EX_DODGE|PROC_EX_PARRY)) || eventInfo.GetDamageInfo()->GetDamage(); } void Register() @@ -905,134 +905,134 @@ class spell_dk_pet_scaling : public SpellScriptLoader void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - // xinef: dk ghoul inherits 70% of strength and 30% of stamina - if (GetUnitOwner()->GetEntry() != NPC_RISEN_GHOUL) - { - // xinef: ebon garogyle - inherit 30% of stamina - if (GetUnitOwner()->GetEntry() == NPC_EBON_GARGOYLE && stat == STAT_STAMINA) - if (Unit* owner = GetUnitOwner()->GetOwner()) - amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); - return; - } + // xinef: dk ghoul inherits 70% of strength and 30% of stamina + if (GetUnitOwner()->GetEntry() != NPC_RISEN_GHOUL) + { + // xinef: ebon garogyle - inherit 30% of stamina + if (GetUnitOwner()->GetEntry() == NPC_EBON_GARGOYLE && stat == STAT_STAMINA) + if (Unit* owner = GetUnitOwner()->GetOwner()) + amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); + return; + } - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 modifier = stat == STAT_STRENGTH ? 70 : 30; + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 modifier = stat == STAT_STRENGTH ? 70 : 30; - // Check just if owner has Ravenous Dead since it's effect is not an aura - if (AuraEffect const* rdEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0)) - { - SpellInfo const* spellInfo = rdEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value - AddPct(modifier, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale - } + // Check just if owner has Ravenous Dead since it's effect is not an aura + if (AuraEffect const* rdEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0)) + { + SpellInfo const* spellInfo = rdEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value + AddPct(modifier, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale + } - // xinef: Glyph of the Ghoul - if (AuraEffect const* glyphEff = owner->GetAuraEffect(SPELL_DK_GLYPH_OF_THE_GHOUL, EFFECT_0)) - modifier += glyphEff->GetAmount(); + // xinef: Glyph of the Ghoul + if (AuraEffect const* glyphEff = owner->GetAuraEffect(SPELL_DK_GLYPH_OF_THE_GHOUL, EFFECT_0)) + modifier += glyphEff->GetAmount(); - amount = CalculatePct(std::max(0, owner->GetStat(stat)), modifier); - } + amount = CalculatePct(std::max(0, owner->GetStat(stat)), modifier); + } } - void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: dk gargoyle inherits 33% of SP - if (GetUnitOwner()->GetEntry() != NPC_EBON_GARGOYLE) - return; + // xinef: dk gargoyle inherits 33% of SP + if (GetUnitOwner()->GetEntry() != NPC_EBON_GARGOYLE) + return; - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 modifier = 33; + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 modifier = 33; - // xinef: impurity - if (AuraEffect const* impurityEff = owner->GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 1986, 0)) - modifier = 40; + // xinef: impurity + if (AuraEffect const* impurityEff = owner->GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 1986, 0)) + modifier = 40; - amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier); + amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier); - // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); - } + // xinef: Update appropriate player field + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); + } } - void CalculateHasteAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateHasteAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: scale haste with owners melee haste - if (Unit* owner = GetUnitOwner()->GetOwner()) - if (owner->m_modAttackSpeedPct[BASE_ATTACK] < 1.0f) // inherit haste only - amount = std::min(100, int32(((1.0f / owner->m_modAttackSpeedPct[BASE_ATTACK]) - 1.0f) * 100.0f)); + // xinef: scale haste with owners melee haste + if (Unit* owner = GetUnitOwner()->GetOwner()) + if (owner->m_modAttackSpeedPct[BASE_ATTACK] < 1.0f) // inherit haste only + amount = std::min(100, int32(((1.0f / owner->m_modAttackSpeedPct[BASE_ATTACK]) - 1.0f) * 100.0f)); } - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (aurEff->GetAuraType() != SPELL_AURA_MELEE_SLOW) - return; - - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK, true, SPELL_BLOCK_TYPE_POSITIVE); - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_MELEE_RANGED_HASTE, true, SPELL_BLOCK_TYPE_POSITIVE); - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MELEE_SLOW, true, SPELL_BLOCK_TYPE_POSITIVE); - - if (GetUnitOwner()->IsPet()) - return; - - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_STAT, true, SPELL_BLOCK_TYPE_POSITIVE); - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER, true, SPELL_BLOCK_TYPE_POSITIVE); - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); - } - - void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (!GetUnitOwner()->IsPet()) - return; + if (aurEff->GetAuraType() != SPELL_AURA_MELEE_SLOW) + return; + + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK, true, SPELL_BLOCK_TYPE_POSITIVE); + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_MELEE_RANGED_HASTE, true, SPELL_BLOCK_TYPE_POSITIVE); + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MELEE_SLOW, true, SPELL_BLOCK_TYPE_POSITIVE); + + if (GetUnitOwner()->IsPet()) + return; + + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_STAT, true, SPELL_BLOCK_TYPE_POSITIVE); + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER, true, SPELL_BLOCK_TYPE_POSITIVE); + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); + } + + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + { + if (!GetUnitOwner()->IsPet()) + return; isPeriodic = true; amplitude = 2*IN_MILLISECONDS; } - + void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) - { - int32 currentAmount = aurEff->GetAmount(); - int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); - if (newAmount != currentAmount) - { - if (aurEff->GetMiscValue() == STAT_STAMINA) - { - uint32 actStat = GetUnitOwner()->GetHealth(); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); - } - else - { - uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); - } - } - } - else - GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) + { + int32 currentAmount = aurEff->GetAmount(); + int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); + if (newAmount != currentAmount) + { + if (aurEff->GetMiscValue() == STAT_STAMINA) + { + uint32 actStat = GetUnitOwner()->GetHealth(); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); + } + else + { + uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); + } + } + } + else + GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); } void Register() { - if (m_scriptSpellId == 54566) - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); - } + if (m_scriptSpellId == 54566) + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); + } - if (m_scriptSpellId == 51996) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_AuraScript::CalculateHasteAmount, EFFECT_ALL, SPELL_AURA_MELEE_SLOW); + if (m_scriptSpellId == 51996) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_AuraScript::CalculateHasteAmount, EFFECT_ALL, SPELL_AURA_MELEE_SLOW); - OnEffectApply += AuraEffectApplyFn(spell_dk_pet_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_dk_pet_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); + OnEffectApply += AuraEffectApplyFn(spell_dk_pet_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_dk_pet_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); OnEffectPeriodic += AuraEffectPeriodicFn(spell_dk_pet_scaling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY); } }; @@ -1131,16 +1131,16 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader } void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - target->ApplySpellImmune(GetId(), IMMUNITY_ID, 33786, true); // cyclone - } + { + Unit* target = GetTarget(); + target->ApplySpellImmune(GetId(), IMMUNITY_ID, 33786, true); // cyclone + } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - target->ApplySpellImmune(GetId(), IMMUNITY_ID, 33786, false); // cyclone - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + target->ApplySpellImmune(GetId(), IMMUNITY_ID, 33786, false); // cyclone + } void Register() { @@ -1148,8 +1148,8 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Absorb, EFFECT_0); AfterEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Trigger, EFFECT_0); - OnEffectApply += AuraEffectApplyFn(spell_dk_anti_magic_shell_self_AuraScript::HandleEffectApply, EFFECT_1, SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_dk_anti_magic_shell_self_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_dk_anti_magic_shell_self_AuraScript::HandleEffectApply, EFFECT_1, SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_dk_anti_magic_shell_self_AuraScript::HandleEffectRemove, EFFECT_1, SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL, AURA_EFFECT_HANDLE_REAL); } }; @@ -1191,7 +1191,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader if (Unit* totem = GetCaster()) if (Unit* owner = totem->ToTotem()->GetSummoner()) amount += int32(2 * owner->GetTotalAttackPowerValue(BASE_ATTACK)); - canBeRecalculated = false; + canBeRecalculated = false; } void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) @@ -1399,11 +1399,11 @@ class spell_dk_corpse_explosion : public SpellScriptLoader { if (unitTarget->IsAlive()) // Living ghoul as a target { - unitTarget->ToCreature()->m_CreatureSpellCooldowns.clear(); - if (CharmInfo* charmInfo = unitTarget->GetCharmInfo()) - charmInfo->GetGlobalCooldownMgr().CancelGlobalCooldown(sSpellMgr->GetSpellInfo(SPELL_DK_GHOUL_EXPLODE)); + unitTarget->ToCreature()->m_CreatureSpellCooldowns.clear(); + if (CharmInfo* charmInfo = unitTarget->GetCharmInfo()) + charmInfo->GetGlobalCooldownMgr().CancelGlobalCooldown(sSpellMgr->GetSpellInfo(SPELL_DK_GHOUL_EXPLODE)); - unitTarget->StopMoving(); + unitTarget->StopMoving(); unitTarget->CastSpell(unitTarget, SPELL_DK_GHOUL_EXPLODE, false); // Corpse Explosion (Suicide) and Set corpse look handled in SpellScript of SPELL_DK_GHOUL_EXPLODE } @@ -1557,54 +1557,54 @@ class spell_dk_death_grip : public SpellScriptLoader SpellCastResult CheckPvPRange() { Unit* caster = GetCaster(); - if (Unit* target = GetExplTargetUnit()) - if (target->GetTypeId() == TYPEID_PLAYER && caster->GetExactDist(target) < 8.0f) // xinef: should be 8.0f, but we have to add target size (1.5f) - return SPELL_FAILED_TOO_CLOSE; + if (Unit* target = GetExplTargetUnit()) + if (target->GetTypeId() == TYPEID_PLAYER && caster->GetExactDist(target) < 8.0f) // xinef: should be 8.0f, but we have to add target size (1.5f) + return SPELL_FAILED_TOO_CLOSE; return SPELL_CAST_OK; } - void HandleBaseDummy(SpellEffIndex /*effIndex*/) + void HandleBaseDummy(SpellEffIndex /*effIndex*/) { - Unit* caster = GetCaster(); - Unit* target = GetHitUnit(); - Unit* baseTarget = GetExplTargetUnit(); + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + Unit* baseTarget = GetExplTargetUnit(); - if (caster != target) - caster->CastSpell(target, 49560, true); - else - baseTarget->CastSpell(caster, 49560, true); + if (caster != target) + caster->CastSpell(target, 49560, true); + else + baseTarget->CastSpell(caster, 49560, true); } void HandleDummy(SpellEffIndex /*effIndex*/) { int32 damage = GetEffectValue(); - float casterZ = GetCaster()->GetPositionZ(); // for Ring of Valor + float casterZ = GetCaster()->GetPositionZ(); // for Ring of Valor WorldLocation gripPos = *GetExplTargetDest(); if (Unit* target = GetHitUnit()) if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS) || target->HasUnitState(UNIT_STATE_STUNNED)) // Deterrence - { - if (target != GetCaster()) - { - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(1766); // Rogue kick - if (!target->IsImmunedToSpellEffect(spellInfo, EFFECT_0)) - target->InterruptNonMeleeSpells(false, 0, false); - } + { + if (target != GetCaster()) + { + const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(1766); // Rogue kick + if (!target->IsImmunedToSpellEffect(spellInfo, EFFECT_0)) + target->InterruptNonMeleeSpells(false, 0, false); + } - if (target->GetMapId() == 618) // for Ring of Valor - gripPos.m_positionZ = std::max(casterZ+0.2f, 28.5f); + if (target->GetMapId() == 618) // for Ring of Valor + gripPos.m_positionZ = std::max(casterZ+0.2f, 28.5f); - target->CastSpell(gripPos.GetPositionX(), gripPos.GetPositionY(), gripPos.GetPositionZ(), 57604, true); - } + target->CastSpell(gripPos.GetPositionX(), gripPos.GetPositionY(), gripPos.GetPositionZ(), 57604, true); + } } void Register() { if (m_scriptSpellId == 49576) // xinef: base death grip, add pvp range restriction - { + { OnCheckCast += SpellCheckCastFn(spell_dk_death_grip_SpellScript::CheckPvPRange); - OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleBaseDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } + OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleBaseDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } else OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } @@ -1656,11 +1656,11 @@ class spell_dk_death_pact : public SpellScriptLoader targetList.clear(); if (target) - { - // xinef: remove all auras preventing effect execution - target->RemoveAllAurasOnDeath(); + { + // xinef: remove all auras preventing effect execution + target->RemoveAllAurasOnDeath(); targetList.push_back(target); - } + } } void Register() @@ -1979,19 +1979,19 @@ class spell_dk_pestilence : public SpellScriptLoader { PrepareSpellScript(spell_dk_pestilence_SpellScript); - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + void HandleScriptEffect(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); Unit* hitUnit = GetHitUnit(); Unit* target = GetExplTargetUnit(); - if (!target) - return; + if (!target) + return; - if (target != hitUnit || caster->GetAura(SPELL_DK_GLYPH_OF_DISEASE)) + if (target != hitUnit || caster->GetAura(SPELL_DK_GLYPH_OF_DISEASE)) { - // xinef: checked in target selection - //if (!m_targets.GetUnitTarget()->IsWithinLOSInMap(unitTarget)) - // return; + // xinef: checked in target selection + //if (!m_targets.GetUnitTarget()->IsWithinLOSInMap(unitTarget)) + // return; // And spread them on target // Blood Plague @@ -2242,8 +2242,8 @@ class spell_dk_raise_dead : public SpellScriptLoader SpellCastTargets targets; targets.SetDst(*GetHitUnit()); - GetCaster()->CastSpell(targets, spellInfo, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCaster()->GetGUID()); - GetCaster()->ToPlayer()->RemoveSpellCooldown(GetSpellInfo()->Id, true); + GetCaster()->CastSpell(targets, spellInfo, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCaster()->GetGUID()); + GetCaster()->ToPlayer()->RemoveSpellCooldown(GetSpellInfo()->Id, true); } void Register() @@ -2357,45 +2357,45 @@ class spell_dk_scourge_strike : public SpellScriptLoader } void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - if (Unit* unitTarget = GetHitUnit()) - { - uint8 mode = caster->GetAuraEffectDummy(SPELL_DK_GLYPH_OF_SCOURGE_STRIKE) ? 2 : 0; - float disease_amt = GetEffectValue(); + { + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + { + uint8 mode = caster->GetAuraEffectDummy(SPELL_DK_GLYPH_OF_SCOURGE_STRIKE) ? 2 : 0; + float disease_amt = GetEffectValue(); - // Death Knight T8 Melee 4P Bonus + // Death Knight T8 Melee 4P Bonus if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0)) AddPct(disease_amt, aurEff->GetAmount()); - multiplier = disease_amt * unitTarget->GetDiseasesByCaster(caster->GetGUID(), mode) / 100.0f; - guid = unitTarget->GetGUID(); - } - } + multiplier = disease_amt * unitTarget->GetDiseasesByCaster(caster->GetGUID(), mode) / 100.0f; + guid = unitTarget->GetGUID(); + } + } void HandleAfterHit() { Unit* caster = GetCaster(); - if (Unit *unitTarget = ObjectAccessor::GetUnit(*caster, guid)) + if (Unit *unitTarget = ObjectAccessor::GetUnit(*caster, guid)) { int32 bp = GetHitDamage() * multiplier; caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true); - // Xinef: Shadowmourne hack (scourge strike trigger proc disabled...) - if (roll_chance_i(75) && caster->FindMap() && !caster->FindMap()->IsBattlegroundOrArena() && caster->HasAura(71903) && !caster->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) - { - caster->CastSpell(caster, SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true); + // Xinef: Shadowmourne hack (scourge strike trigger proc disabled...) + if (roll_chance_i(75) && caster->FindMap() && !caster->FindMap()->IsBattlegroundOrArena() && caster->HasAura(71903) && !caster->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) + { + caster->CastSpell(caster, SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true); - // this can't be handled in AuraScript of SoulFragments because we need to know victim - if (Aura* soulFragments = caster->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT)) - { - if (soulFragments->GetStackAmount() >= 10) - { - caster->CastSpell(caster, SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, NULL); - soulFragments->Remove(); - } - } - } + // this can't be handled in AuraScript of SoulFragments because we need to know victim + if (Aura* soulFragments = caster->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT)) + { + if (soulFragments->GetStackAmount() >= 10) + { + caster->CastSpell(caster, SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, NULL); + soulFragments->Remove(); + } + } + } } } @@ -2439,9 +2439,9 @@ class spell_dk_spell_deflection : public SpellScriptLoader void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { // You have a chance equal to your Parry chance - float chance = GetTarget()->GetUnitParryChance(); - if (GetTarget()->IsNonMeleeSpellCast(false, false, true) || GetTarget()->HasUnitState(UNIT_STATE_CONTROLLED)) - chance = 0.0f; + float chance = GetTarget()->GetUnitParryChance(); + if (GetTarget()->IsNonMeleeSpellCast(false, false, true) || GetTarget()->HasUnitState(UNIT_STATE_CONTROLLED)) + chance = 0.0f; if ((dmgInfo.GetDamageType() == SPELL_DIRECT_DAMAGE) && roll_chance_f(chance)) absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); @@ -2557,28 +2557,28 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader void AddSC_deathknight_spell_scripts() { - // Ours - new spell_dk_wandering_plague(); - new spell_dk_raise_ally(); - new spell_dk_raise_ally_trigger(); - new spell_dk_aotd_taunt(); - new spell_dk_death_and_decay(); - new spell_dk_master_of_ghouls(); - new spell_dk_chains_of_ice(); - new spell_dk_bloodworms(); - new spell_dk_summon_gargoyle(); - new spell_dk_improved_blood_presence_proc(); - new spell_dk_wandering_plague_aura(); - new spell_dk_rune_of_the_fallen_crusader(); - new spell_dk_bone_shield(); - new spell_dk_hungering_cold(); - new spell_dk_blood_caked_blade(); - new spell_dk_dancing_rune_weapon(); - new spell_dk_dancing_rune_weapon_visual(); - new spell_dk_scent_of_blood_trigger(); - new spell_dk_pet_scaling(); + // Ours + new spell_dk_wandering_plague(); + new spell_dk_raise_ally(); + new spell_dk_raise_ally_trigger(); + new spell_dk_aotd_taunt(); + new spell_dk_death_and_decay(); + new spell_dk_master_of_ghouls(); + new spell_dk_chains_of_ice(); + new spell_dk_bloodworms(); + new spell_dk_summon_gargoyle(); + new spell_dk_improved_blood_presence_proc(); + new spell_dk_wandering_plague_aura(); + new spell_dk_rune_of_the_fallen_crusader(); + new spell_dk_bone_shield(); + new spell_dk_hungering_cold(); + new spell_dk_blood_caked_blade(); + new spell_dk_dancing_rune_weapon(); + new spell_dk_dancing_rune_weapon_visual(); + new spell_dk_scent_of_blood_trigger(); + new spell_dk_pet_scaling(); - // Theirs + // Theirs new spell_dk_anti_magic_shell_raid(); new spell_dk_anti_magic_shell_self(); new spell_dk_anti_magic_zone(); diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 7d6515dae..d1717a92b 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -29,20 +29,20 @@ enum DruidSpells { - // Ours - SPELL_DRUID_GLYPH_OF_WILD_GROWTH = 62970, - SPELL_DRUID_NURTURING_INSTINCT_R1 = 47179, - SPELL_DRUID_NURTURING_INSTINCT_R2 = 47180, - SPELL_DRUID_FERAL_SWIFTNESS_R1 = 17002, - SPELL_DRUID_FERAL_SWIFTNESS_R2 = 24866, - SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_1 = 24867, - SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_2 = 24864, - SPELL_DRUID_BARKSKIN = 22812, - SPELL_DRUID_GLYPH_OF_BARKSKIN = 63057, - SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER = 63058, + // Ours + SPELL_DRUID_GLYPH_OF_WILD_GROWTH = 62970, + SPELL_DRUID_NURTURING_INSTINCT_R1 = 47179, + SPELL_DRUID_NURTURING_INSTINCT_R2 = 47180, + SPELL_DRUID_FERAL_SWIFTNESS_R1 = 17002, + SPELL_DRUID_FERAL_SWIFTNESS_R2 = 24866, + SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_1 = 24867, + SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_2 = 24864, + SPELL_DRUID_BARKSKIN = 22812, + SPELL_DRUID_GLYPH_OF_BARKSKIN = 63057, + SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER = 63058, - // Theirs + // Theirs SPELL_DRUID_ENRAGE_MOD_DAMAGE = 51185, SPELL_DRUID_GLYPH_OF_TYPHOON = 62135, SPELL_DRUID_IDOL_OF_FERAL_SHADOWS = 34241, @@ -72,18 +72,18 @@ class spell_dru_t10_balance_4p_bonus : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetActor() && eventInfo.GetProcTarget(); + return eventInfo.GetActor() && eventInfo.GetProcTarget(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - uint32 triggered_spell_id = 71023; + uint32 triggered_spell_id = 71023; SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id); - int32 amount = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / triggeredSpell->GetMaxTicks(); - eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(GetTarget(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE, amount, EFFECT_0); + int32 amount = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / triggeredSpell->GetMaxTicks(); + eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(GetTarget(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE, amount, EFFECT_0); //GetTarget()->CastCustomSpell(triggered_spell_id, SPELLVALUE_BASE_POINT0, amount, eventInfo.GetProcTarget(), true, NULL, aurEff); } @@ -112,14 +112,14 @@ class spell_dru_nurturing_instinct : public SpellScriptLoader void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (Player* player = GetTarget()->ToPlayer()) - player->addSpell(GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2, SPEC_MASK_ALL, false, true); + if (Player* player = GetTarget()->ToPlayer()) + player->addSpell(GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2, SPEC_MASK_ALL, false, true); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Player* player = GetTarget()->ToPlayer()) - player->removeSpell(GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2, SPEC_MASK_ALL, true); + if (Player* player = GetTarget()->ToPlayer()) + player->removeSpell(GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2, SPEC_MASK_ALL, true); } void Register() @@ -146,9 +146,9 @@ class spell_dru_feral_swiftness : public SpellScriptLoader void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (Player* player = GetTarget()->ToPlayer()) - if (uint8 rank = player->HasTalent(SPELL_DRUID_FERAL_SWIFTNESS_R1, player->GetActiveSpec()) ? 1 : (player->HasTalent(SPELL_DRUID_FERAL_SWIFTNESS_R2, player->GetActiveSpec()) ? 2 : 0)) - player->CastSpell(player, rank == 1 ? SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_1 : SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_2, true, NULL, aurEff, GetCasterGUID()); + if (Player* player = GetTarget()->ToPlayer()) + if (uint8 rank = player->HasTalent(SPELL_DRUID_FERAL_SWIFTNESS_R1, player->GetActiveSpec()) ? 1 : (player->HasTalent(SPELL_DRUID_FERAL_SWIFTNESS_R2, player->GetActiveSpec()) ? 2 : 0)) + player->CastSpell(player, rank == 1 ? SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_1 : SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_2, true, NULL, aurEff, GetCasterGUID()); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -181,16 +181,16 @@ class spell_dru_omen_of_clarity : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); - if (!spellInfo) - return true; + const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); + if (!spellInfo) + return true; - // xinef: no mana cost - if (spellInfo->ManaCost == 0 && spellInfo->ManaCostPercentage == 0) - return false; + // xinef: no mana cost + if (spellInfo->ManaCost == 0 && spellInfo->ManaCostPercentage == 0) + return false; - // xinef: SPELL_ATTR0_CU_NO_INITIAL_THREAT and SPELL_ATTR0_CU_DIRECT_DAMAGE contains spells capable of healing and damaging + some others, but this is taken care of above - return spellInfo->HasAttribute(SpellCustomAttributes(SPELL_ATTR0_CU_DIRECT_DAMAGE|SPELL_ATTR0_CU_NO_INITIAL_THREAT)); + // xinef: SPELL_ATTR0_CU_NO_INITIAL_THREAT and SPELL_ATTR0_CU_DIRECT_DAMAGE contains spells capable of healing and damaging + some others, but this is taken care of above + return spellInfo->HasAttribute(SpellCustomAttributes(SPELL_ATTR0_CU_DIRECT_DAMAGE|SPELL_ATTR0_CU_NO_INITIAL_THREAT)); } void Register() @@ -216,31 +216,31 @@ class spell_dru_brambles_treant : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - if (Player* player = GetUnitOwner()->GetSpellModOwner()) - { - int32 amount = 0; - if (player->HasAura(SPELL_DRUID_BARKSKIN, player->GetGUID())) - player->ApplySpellMod(SPELL_DRUID_BARKSKIN, SPELLMOD_CHANCE_OF_SUCCESS, amount); + if (Player* player = GetUnitOwner()->GetSpellModOwner()) + { + int32 amount = 0; + if (player->HasAura(SPELL_DRUID_BARKSKIN, player->GetGUID())) + player->ApplySpellMod(SPELL_DRUID_BARKSKIN, SPELLMOD_CHANCE_OF_SUCCESS, amount); - return roll_chance_i(amount); - } + return roll_chance_i(amount); + } - return false; + return false; } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) - { - // xinef: chance of success stores proper amount of damage increase - // xinef: little hack because GetSpellModOwner will return NULL pointer at this point (early summoning stage) - if (GetUnitOwner()->IsSummon()) - if (Unit* owner = GetUnitOwner()->ToTempSummon()->GetSummoner()) - if (Player* player = owner->GetSpellModOwner()) - player->ApplySpellMod(SPELL_DRUID_BARKSKIN, SPELLMOD_CHANCE_OF_SUCCESS, amount); - } + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + // xinef: chance of success stores proper amount of damage increase + // xinef: little hack because GetSpellModOwner will return NULL pointer at this point (early summoning stage) + if (GetUnitOwner()->IsSummon()) + if (Unit* owner = GetUnitOwner()->ToTempSummon()->GetSummoner()) + if (Player* player = owner->GetSpellModOwner()) + player->ApplySpellMod(SPELL_DRUID_BARKSKIN, SPELLMOD_CHANCE_OF_SUCCESS, amount); + } void Register() { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_brambles_treant_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_brambles_treant_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); DoCheckProc += AuraCheckProcFn(spell_dru_brambles_treant_AuraScript::CheckProc); } }; @@ -262,13 +262,13 @@ class spell_dru_barkskin : public SpellScriptLoader void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (GetUnitOwner()->HasAura(SPELL_DRUID_GLYPH_OF_BARKSKIN, GetUnitOwner()->GetGUID())) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER, true); + if (GetUnitOwner()->HasAura(SPELL_DRUID_GLYPH_OF_BARKSKIN, GetUnitOwner()->GetGUID())) + GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER, true); } void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->RemoveAurasDueToSpell(SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER, GetUnitOwner()->GetGUID()); + GetUnitOwner()->RemoveAurasDueToSpell(SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER, GetUnitOwner()->GetGUID()); } void Register() @@ -295,77 +295,77 @@ class spell_dru_treant_scaling : public SpellScriptLoader void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: treant inherits 40% of resistance from owner and 35% of armor (guessed) - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; - amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); - } + // xinef: treant inherits 40% of resistance from owner and 35% of armor (guessed) + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; + amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); + } } void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: treant inherits 30% of intellect / stamina (guessed) - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); - } + // xinef: treant inherits 30% of intellect / stamina (guessed) + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); + } } - void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: treant inherits 105% of SP as AP - 15% of damage increase per hit - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 nature = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE); - amount = CalculatePct(std::max(0, nature), 105); + // xinef: treant inherits 105% of SP as AP - 15% of damage increase per hit + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 nature = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE); + amount = CalculatePct(std::max(0, nature), 105); - // xinef: brambles talent - if (AuraEffect const* bramblesEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DRUID, 53, 2)) - AddPct(amount, bramblesEff->GetAmount()); - } + // xinef: brambles talent + if (AuraEffect const* bramblesEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DRUID, 53, 2)) + AddPct(amount, bramblesEff->GetAmount()); + } } - void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: treant inherits 15% of SP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 nature = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE); - amount = CalculatePct(std::max(0, nature), 15); + // xinef: treant inherits 15% of SP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 nature = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE); + amount = CalculatePct(std::max(0, nature), 15); - // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); - } + // xinef: Update appropriate player field + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); + } } - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); - else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); + else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); + } void Register() { - if (m_scriptSpellId != 35669) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); + if (m_scriptSpellId != 35669) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); - if (m_scriptSpellId == 35669 || m_scriptSpellId == 35670) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); + if (m_scriptSpellId == 35669 || m_scriptSpellId == 35670) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); - if (m_scriptSpellId == 35669) - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); - } + if (m_scriptSpellId == 35669) + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); + } - OnEffectApply += AuraEffectApplyFn(spell_dru_treant_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_dru_treant_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); } }; @@ -614,20 +614,20 @@ class spell_dru_lifebloom : public SpellScriptLoader if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) return; - // final heal + // final heal int32 stack = GetStackAmount(); int32 healAmount = aurEff->GetAmount(); - const SpellInfo* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL); + const SpellInfo* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL); - if (Unit* caster = GetCaster()) - { - healAmount = caster->SpellHealingBonusDone(GetTarget(), finalHeal, healAmount, HEAL, 0.0f, stack); - healAmount = GetTarget()->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, stack); - // restore mana - int32 returnmana = (GetSpellInfo()->ManaCostPercentage * caster->GetCreateMana() / 100) * stack / 2; - caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnmana, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); - } - GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + if (Unit* caster = GetCaster()) + { + healAmount = caster->SpellHealingBonusDone(GetTarget(), finalHeal, healAmount, HEAL, 0.0f, stack); + healAmount = GetTarget()->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, stack); + // restore mana + int32 returnmana = (GetSpellInfo()->ManaCostPercentage * caster->GetCreateMana() / 100) * stack / 2; + caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnmana, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); + } + GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID()); } void HandleDispel(DispelInfo* dispelInfo) @@ -636,19 +636,19 @@ class spell_dru_lifebloom : public SpellScriptLoader { if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) { - Unit* caster = GetCaster(); - int32 healAmount = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster ? caster : target, 0, target) * dispelInfo->GetRemovedCharges(); - const SpellInfo* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL); - if (caster) - { - // healing with bonus + Unit* caster = GetCaster(); + int32 healAmount = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster ? caster : target, 0, target) * dispelInfo->GetRemovedCharges(); + const SpellInfo* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL); + if (caster) + { + // healing with bonus healAmount = caster->SpellHealingBonusDone(target, finalHeal, healAmount, HEAL, 0.0f, dispelInfo->GetRemovedCharges()); - healAmount = target->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, dispelInfo->GetRemovedCharges()); - - // mana amount - int32 mana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2; - caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &mana, NULL, NULL, true, NULL, NULL, GetCasterGUID()); - } + healAmount = target->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, dispelInfo->GetRemovedCharges()); + + // mana amount + int32 mana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2; + caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &mana, NULL, NULL, true, NULL, NULL, GetCasterGUID()); + } target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); } } @@ -1305,7 +1305,7 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader return; } - tempTargets.sort(Trinity::HealthPctOrderPred()); + tempTargets.sort(Trinity::HealthPctOrderPred()); targets.clear(); targets.push_back(tempTargets.front()); } @@ -1342,7 +1342,7 @@ class spell_dru_wild_growth : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if(Trinity::RaidCheck(GetCaster(), false)); + targets.remove_if(Trinity::RaidCheck(GetCaster(), false)); uint32 const maxTargets = GetCaster()->HasAura(SPELL_DRUID_GLYPH_OF_WILD_GROWTH) ? 6 : 5; @@ -1378,16 +1378,16 @@ class spell_dru_wild_growth : public SpellScriptLoader void AddSC_druid_spell_scripts() { - // Ours - new spell_dru_t10_balance_4p_bonus(); - new spell_dru_nurturing_instinct(); - new spell_dru_feral_swiftness(); - new spell_dru_omen_of_clarity(); - new spell_dru_brambles_treant(); - new spell_dru_barkskin(); - new spell_dru_treant_scaling(); + // Ours + new spell_dru_t10_balance_4p_bonus(); + new spell_dru_nurturing_instinct(); + new spell_dru_feral_swiftness(); + new spell_dru_omen_of_clarity(); + new spell_dru_brambles_treant(); + new spell_dru_barkskin(); + new spell_dru_treant_scaling(); - // Theirs + // Theirs new spell_dru_dash(); new spell_dru_enrage(); new spell_dru_glyph_of_starfire(); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 9dd8b42bc..3ce5c60a0 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -51,49 +51,49 @@ public: class spell_gen_model_visible_AuraScript : public AuraScript { - public: + public: PrepareAuraScript(spell_gen_model_visible_AuraScript) - bool Load() - { - memset(_itemId, 0, sizeof(_itemId)); - _modelId = 0; - _hasFlag = false; - return true; - } - - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + bool Load() { - _modelId = GetUnitOwner()->GetDisplayId(); - _hasFlag = GetUnitOwner()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - for (uint8 i = 0; i < 3; ++i) - _itemId[i] = GetUnitOwner()->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i); + memset(_itemId, 0, sizeof(_itemId)); + _modelId = 0; + _hasFlag = false; + return true; + } + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + _modelId = GetUnitOwner()->GetDisplayId(); + _hasFlag = GetUnitOwner()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + for (uint8 i = 0; i < 3; ++i) + _itemId[i] = GetUnitOwner()->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i); - GetUnitOwner()->SetDisplayId(11686); - GetUnitOwner()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - for (uint8 i = 0; i < 3; ++i) - GetUnitOwner()->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, 0); + GetUnitOwner()->SetDisplayId(11686); + GetUnitOwner()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + for (uint8 i = 0; i < 3; ++i) + GetUnitOwner()->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, 0); } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->SetDisplayId(_modelId); - if (!_hasFlag) - GetUnitOwner()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - for (uint8 i = 0; i < 3; ++i) - GetUnitOwner()->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, _itemId[i]); + GetUnitOwner()->SetDisplayId(_modelId); + if (!_hasFlag) + GetUnitOwner()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + for (uint8 i = 0; i < 3; ++i) + GetUnitOwner()->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, _itemId[i]); } void Register() { OnEffectApply += AuraEffectApplyFn(spell_gen_model_visible_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_gen_model_visible_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_model_visible_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } - private: - uint32 _itemId[3]; - uint32 _modelId; - bool _hasFlag; + private: + uint32 _itemId[3]; + uint32 _modelId; + bool _hasFlag; }; AuraScript* GetAuraScript() const @@ -104,74 +104,74 @@ public: class spell_the_flag_of_ownership : public SpellScriptLoader { - public: - spell_the_flag_of_ownership() : SpellScriptLoader("spell_the_flag_of_ownership") { } + public: + spell_the_flag_of_ownership() : SpellScriptLoader("spell_the_flag_of_ownership") { } - class spell_the_flag_of_ownership_SpellScript : public SpellScript - { - PrepareSpellScript(spell_the_flag_of_ownership_SpellScript); + class spell_the_flag_of_ownership_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_flag_of_ownership_SpellScript); - bool haveTarget; - bool Load() - { - haveTarget = false; - return true; - } + bool haveTarget; + bool Load() + { + haveTarget = false; + return true; + } - void HandleScript(SpellEffIndex effIndex) - { - Unit* caster = GetCaster(); - if (!caster || caster->GetTypeId() != TYPEID_PLAYER) - return; - Player* target = GetHitPlayer(); - if (!target) - return; - caster->CastSpell(target, 52605, true); - char buff[100]; - sprintf(buff, "%s plants the Flag of Ownership in the corpse of %s.", caster->GetName().c_str(), target->GetName().c_str()); - caster->MonsterTextEmote(buff, caster); - haveTarget = true; - } + void HandleScript(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) + return; + Player* target = GetHitPlayer(); + if (!target) + return; + caster->CastSpell(target, 52605, true); + char buff[100]; + sprintf(buff, "%s plants the Flag of Ownership in the corpse of %s.", caster->GetName().c_str(), target->GetName().c_str()); + caster->MonsterTextEmote(buff, caster); + haveTarget = true; + } - void FilterTargets(std::list& targets) - { - for( std::list::iterator itr = targets.begin(); itr != targets.end(); ) - { - if ((*itr)->GetTypeId() != TYPEID_PLAYER || (*itr)->ToPlayer()->IsAlive()) - { - targets.erase(itr); - itr = targets.begin(); - continue; - } - ++itr; - } - } + void FilterTargets(std::list& targets) + { + for( std::list::iterator itr = targets.begin(); itr != targets.end(); ) + { + if ((*itr)->GetTypeId() != TYPEID_PLAYER || (*itr)->ToPlayer()->IsAlive()) + { + targets.erase(itr); + itr = targets.begin(); + continue; + } + ++itr; + } + } - void HandleFinish() - { - Unit* caster = GetCaster(); - if (!caster || !caster->ToPlayer()) - return; + void HandleFinish() + { + Unit* caster = GetCaster(); + if (!caster || !caster->ToPlayer()) + return; - if (!haveTarget) - { - caster->ToPlayer()->RemoveSpellCooldown(GetSpellInfo()->Id, true); - Spell::SendCastResult(caster->ToPlayer(), GetSpellInfo(), 0, SPELL_FAILED_BAD_TARGETS); - } - } + if (!haveTarget) + { + caster->ToPlayer()->RemoveSpellCooldown(GetSpellInfo()->Id, true); + Spell::SendCastResult(caster->ToPlayer(), GetSpellInfo(), 0, SPELL_FAILED_BAD_TARGETS); + } + } - void Register() - { - AfterCast += SpellCastFn(spell_the_flag_of_ownership_SpellScript::HandleFinish); - OnEffectHitTarget += SpellEffectFn(spell_the_flag_of_ownership_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_flag_of_ownership_SpellScript::FilterTargets, EFFECT_0, TARGET_CORPSE_SRC_AREA_ENEMY); - } - }; + void Register() + { + AfterCast += SpellCastFn(spell_the_flag_of_ownership_SpellScript::HandleFinish); + OnEffectHitTarget += SpellEffectFn(spell_the_flag_of_ownership_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_flag_of_ownership_SpellScript::FilterTargets, EFFECT_0, TARGET_CORPSE_SRC_AREA_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_the_flag_of_ownership_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_the_flag_of_ownership_SpellScript(); + } }; class spell_gen_have_item_auras : public SpellScriptLoader @@ -183,27 +183,27 @@ public: { PrepareAuraScript(spell_gen_have_item_auras_AuraScript) - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = GetTarget(); - if (target && target->ToPlayer()) - { - uint32 entry = 0; - switch (GetSpellInfo()->Id) - { - case 51060: // Have Withered Batwing - entry = 28294; break; - case 51068: // Have Muddy Mire Maggot - entry = 28293; break; - case 51094: // Have Chilled Serpent Mucus - entry = 28296; break; - case 51088: // Have Amberseed - entry = 28295; break; - } + Unit* target = GetTarget(); + if (target && target->ToPlayer()) + { + uint32 entry = 0; + switch (GetSpellInfo()->Id) + { + case 51060: // Have Withered Batwing + entry = 28294; break; + case 51068: // Have Muddy Mire Maggot + entry = 28293; break; + case 51094: // Have Chilled Serpent Mucus + entry = 28296; break; + case 51088: // Have Amberseed + entry = 28295; break; + } - if (entry) - target->ToPlayer()->KilledMonsterCredit(entry, 0); - } + if (entry) + target->ToPlayer()->KilledMonsterCredit(entry, 0); + } } void Register() @@ -220,93 +220,93 @@ public: class spell_gen_mine_sweeper : public SpellScriptLoader { - public: - spell_gen_mine_sweeper() : SpellScriptLoader("spell_gen_mine_sweeper") { } + public: + spell_gen_mine_sweeper() : SpellScriptLoader("spell_gen_mine_sweeper") { } - class spell_gen_mine_sweeper_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_mine_sweeper_SpellScript); + class spell_gen_mine_sweeper_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_mine_sweeper_SpellScript); - void HandleSchoolDMG(SpellEffIndex effIndex) - { - Unit* caster = GetCaster(); - Player* target = GetHitPlayer(); - if (!target) - return; + void HandleSchoolDMG(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + Player* target = GetHitPlayer(); + if (!target) + return; - target->RemoveAurasByType(SPELL_AURA_MOUNTED); - caster->CastSpell(target, 54402, true); - } + target->RemoveAurasByType(SPELL_AURA_MOUNTED); + caster->CastSpell(target, 54402, true); + } - void HandleScriptEffect(SpellEffIndex effIndex) - { - if (Unit* target = GetHitPlayer()) - if (Aura* aur = target->GetAura(GetSpellInfo()->Id)) - if (aur->GetStackAmount() >= 10) - target->CastSpell(target, 57064, true); - } + void HandleScriptEffect(SpellEffIndex effIndex) + { + if (Unit* target = GetHitPlayer()) + if (Aura* aur = target->GetAura(GetSpellInfo()->Id)) + if (aur->GetStackAmount() >= 10) + target->CastSpell(target, 57064, true); + } - void Register() - { - if (m_scriptSpellId == 54355) - OnEffectHitTarget += SpellEffectFn(spell_gen_mine_sweeper_SpellScript::HandleSchoolDMG, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - else - OnEffectHitTarget += SpellEffectFn(spell_gen_mine_sweeper_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + if (m_scriptSpellId == 54355) + OnEffectHitTarget += SpellEffectFn(spell_gen_mine_sweeper_SpellScript::HandleSchoolDMG, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + else + OnEffectHitTarget += SpellEffectFn(spell_gen_mine_sweeper_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_gen_mine_sweeper_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_gen_mine_sweeper_SpellScript(); + } }; class spell_gen_reduced_above_60 : public SpellScriptLoader { - public: - spell_gen_reduced_above_60() : SpellScriptLoader("spell_gen_reduced_above_60") { } + public: + spell_gen_reduced_above_60() : SpellScriptLoader("spell_gen_reduced_above_60") { } - class spell_gen_reduced_above_60_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_reduced_above_60_SpellScript); + class spell_gen_reduced_above_60_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_reduced_above_60_SpellScript); - void RecalculateDamage() + void RecalculateDamage() { if (Unit* target = GetHitUnit()) - if (target->getLevel() > 60) - { - int32 damage = GetHitDamage(); - AddPct(damage, -4*int8(std::min(target->getLevel(), uint8(85))-60)); // prevents reduce by more than 100% - SetHitDamage(damage); - } + if (target->getLevel() > 60) + { + int32 damage = GetHitDamage(); + AddPct(damage, -4*int8(std::min(target->getLevel(), uint8(85))-60)); // prevents reduce by more than 100% + SetHitDamage(damage); + } } void Register() { OnHit += SpellHitFn(spell_gen_reduced_above_60_SpellScript::RecalculateDamage); } - }; + }; - SpellScript* GetSpellScript() const - { - return new spell_gen_reduced_above_60_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_gen_reduced_above_60_SpellScript(); + } - class spell_gen_reduced_above_60_AuraScript : public AuraScript + class spell_gen_reduced_above_60_AuraScript : public AuraScript { PrepareAuraScript(spell_gen_reduced_above_60_AuraScript); void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & canBeRecalculated) { - if (Unit* owner = GetUnitOwner()) - if (owner->getLevel() > 60) - AddPct(amount, -4*int8(std::min(owner->getLevel(), uint8(85))-60)); // prevents reduce by more than 100% + if (Unit* owner = GetUnitOwner()) + if (owner->getLevel() > 60) + AddPct(amount, -4*int8(std::min(owner->getLevel(), uint8(85))-60)); // prevents reduce by more than 100% } void Register() { - if (m_scriptSpellId != 20004) // Lifestealing enchange - no aura effect - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_reduced_above_60_AuraScript::CalculateAmount, EFFECT_ALL, SPELL_AURA_ANY); + if (m_scriptSpellId != 20004) // Lifestealing enchange - no aura effect + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_reduced_above_60_AuraScript::CalculateAmount, EFFECT_ALL, SPELL_AURA_ANY); } }; @@ -324,9 +324,9 @@ class spell_gen_relocaste_dest : public SpellScriptLoader class spell_gen_relocaste_dest_SpellScript : public SpellScript { PrepareSpellScript(spell_gen_relocaste_dest_SpellScript); - public: - spell_gen_relocaste_dest_SpellScript(float x, float y, float z, float o) : _x(x), _y(y), _z(z), _o(o) { } - + public: + spell_gen_relocaste_dest_SpellScript(float x, float y, float z, float o) : _x(x), _y(y), _z(z), _o(o) { } + void RelocateDest() { Position const offset = {_x, _y, _z, _o}; @@ -337,18 +337,18 @@ class spell_gen_relocaste_dest : public SpellScriptLoader { OnCast += SpellCastFn(spell_gen_relocaste_dest_SpellScript::RelocateDest); } - - private: - float _x, _y, _z, _o; + + private: + float _x, _y, _z, _o; }; SpellScript* GetSpellScript() const { return new spell_gen_relocaste_dest_SpellScript(_x, _y, _z, _o); } - - private: - float _x, _y, _z, _o; + + private: + float _x, _y, _z, _o; }; class spell_gen_allow_proc_from_spells_with_cost : public SpellScriptLoader @@ -360,27 +360,27 @@ class spell_gen_allow_proc_from_spells_with_cost : public SpellScriptLoader { PrepareAuraScript(spell_gen_allow_proc_from_spells_with_cost_AuraScript); - bool CheckProc(ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); - if (!spellInfo) - return false; + SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); + if (!spellInfo) + return false; - // xinef: Spells with no damage class and physical school only are not treated as spells - if ((eventInfo.GetTypeMask() & (PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG|PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && spellInfo->SchoolMask == SPELL_SCHOOL_MASK_NORMAL) - return false; + // xinef: Spells with no damage class and physical school only are not treated as spells + if ((eventInfo.GetTypeMask() & (PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG|PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && spellInfo->SchoolMask == SPELL_SCHOOL_MASK_NORMAL) + return false; - // xinef: holy nova exception - if (spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && spellInfo->SpellIconID == 1874) - return spellInfo->HasEffect(SPELL_EFFECT_HEAL); + // xinef: holy nova exception + if (spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && spellInfo->SpellIconID == 1874) + return spellInfo->HasEffect(SPELL_EFFECT_HEAL); - // xinef: Holy Shock exception... - return spellInfo->ManaCost > 0 || spellInfo->ManaCostPercentage > 0 || (spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && spellInfo->SpellIconID == 156); + // xinef: Holy Shock exception... + return spellInfo->ManaCost > 0 || spellInfo->ManaCostPercentage > 0 || (spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && spellInfo->SpellIconID == 156); } void Register() { - DoCheckProc += AuraCheckProcFn(spell_gen_allow_proc_from_spells_with_cost_AuraScript::CheckProc); + DoCheckProc += AuraCheckProcFn(spell_gen_allow_proc_from_spells_with_cost_AuraScript::CheckProc); } }; @@ -399,17 +399,17 @@ public: { PrepareAuraScript(spell_gen_bg_preparation_AuraScript) - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetTarget()->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, true); + GetTarget()->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, true); } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetTarget()->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, false); + GetTarget()->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ALL, false); } - void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) + void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) { isPeriodic = true; amplitude = 3*IN_MILLISECONDS; @@ -417,22 +417,22 @@ public: void Update(AuraEffect* effect) { - if (Player* player = GetUnitOwner()->GetCharmerOrOwnerPlayerOrPlayerItself()) - if (MapEntry const* mapEntry = sMapStore.LookupEntry(player->GetMapId())) - if ((GetId() == 32727 && mapEntry->IsBattleArena()) || (GetId() == 44521 && mapEntry->IsBattleground())) - if (Battleground* bg = player->GetBattleground()) - if (bg->GetStatus() == STATUS_WAIT_JOIN) - return; - SetMaxDuration(1); - SetDuration(1); + if (Player* player = GetUnitOwner()->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (MapEntry const* mapEntry = sMapStore.LookupEntry(player->GetMapId())) + if ((GetId() == 32727 && mapEntry->IsBattleArena()) || (GetId() == 44521 && mapEntry->IsBattleground())) + if (Battleground* bg = player->GetBattleground()) + if (bg->GetStatus() == STATUS_WAIT_JOIN) + return; + SetMaxDuration(1); + SetDuration(1); } void Register() { OnEffectApply += AuraEffectApplyFn(spell_gen_bg_preparation_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_gen_bg_preparation_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_bg_preparation_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT, AURA_EFFECT_HANDLE_REAL); - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_gen_bg_preparation_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_gen_bg_preparation_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT); OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_bg_preparation_AuraScript::Update, EFFECT_0, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT); } }; @@ -458,9 +458,9 @@ class spell_gen_disabled_above_level : public SpellScriptLoader SpellCastResult CheckRequirement() { - if (Unit* target = GetExplTargetUnit()) - if (target->getLevel() >= _level) - return SPELL_FAILED_DONT_REPORT; + if (Unit* target = GetExplTargetUnit()) + if (target->getLevel() >= _level) + return SPELL_FAILED_DONT_REPORT; return SPELL_CAST_OK; } @@ -468,7 +468,7 @@ class spell_gen_disabled_above_level : public SpellScriptLoader void Register() { OnCheckCast += SpellCheckCastFn(spell_gen_disabled_above_level_SpellScript::CheckRequirement); - } + } private: uint8 _level; @@ -485,93 +485,93 @@ class spell_gen_disabled_above_level : public SpellScriptLoader class spell_pet_hit_expertise_scalling : public SpellScriptLoader { - public: - spell_pet_hit_expertise_scalling() : SpellScriptLoader("spell_pet_hit_expertise_scalling") { } + public: + spell_pet_hit_expertise_scalling() : SpellScriptLoader("spell_pet_hit_expertise_scalling") { } - class spell_pet_hit_expertise_scalling_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pet_hit_expertise_scalling_AuraScript) + class spell_pet_hit_expertise_scalling_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pet_hit_expertise_scalling_AuraScript) - int32 CalculatePercent(float hitChance, float cap, float maxChance) - { - return (hitChance / cap) * maxChance; - } - - void CalculateHitAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) - { - if (Player* modOwner = GetUnitOwner()->GetSpellModOwner()) - { - if (modOwner->getClass() == CLASS_HUNTER) - amount = CalculatePercent(modOwner->m_modRangedHitChance, 8.0f, 8.0f); - else if (modOwner->getPowerType() == POWER_MANA) - amount = CalculatePercent(modOwner->m_modSpellHitChance, 17.0f, 8.0f); - else - amount = CalculatePercent(modOwner->m_modMeleeHitChance, 8.0f, 8.0f); - } - } + int32 CalculatePercent(float hitChance, float cap, float maxChance) + { + return (hitChance / cap) * maxChance; + } + + void CalculateHitAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Player* modOwner = GetUnitOwner()->GetSpellModOwner()) + { + if (modOwner->getClass() == CLASS_HUNTER) + amount = CalculatePercent(modOwner->m_modRangedHitChance, 8.0f, 8.0f); + else if (modOwner->getPowerType() == POWER_MANA) + amount = CalculatePercent(modOwner->m_modSpellHitChance, 17.0f, 8.0f); + else + amount = CalculatePercent(modOwner->m_modMeleeHitChance, 8.0f, 8.0f); + } + } - void CalculateSpellHitAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) - { - if (Player* modOwner = GetUnitOwner()->GetSpellModOwner()) - { - if (modOwner->getClass() == CLASS_HUNTER) - amount = CalculatePercent(modOwner->m_modRangedHitChance, 8.0f, 17.0f); - else if (modOwner->getPowerType() == POWER_MANA) - amount = CalculatePercent(modOwner->m_modSpellHitChance, 17.0f, 17.0f); - else - amount = CalculatePercent(modOwner->m_modMeleeHitChance, 8.0f, 17.0f); - } - } + void CalculateSpellHitAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Player* modOwner = GetUnitOwner()->GetSpellModOwner()) + { + if (modOwner->getClass() == CLASS_HUNTER) + amount = CalculatePercent(modOwner->m_modRangedHitChance, 8.0f, 17.0f); + else if (modOwner->getPowerType() == POWER_MANA) + amount = CalculatePercent(modOwner->m_modSpellHitChance, 17.0f, 17.0f); + else + amount = CalculatePercent(modOwner->m_modMeleeHitChance, 8.0f, 17.0f); + } + } - void CalculateExpertiseAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) - { - if (Player* modOwner = GetUnitOwner()->GetSpellModOwner()) - { - if (modOwner->getClass() == CLASS_HUNTER) - amount = CalculatePercent(modOwner->m_modRangedHitChance, 8.0f, 26.0f); - else if (modOwner->getPowerType() == POWER_MANA) - amount = CalculatePercent(modOwner->m_modSpellHitChance, 17.0f, 26.0f); - else - amount = CalculatePercent(modOwner->m_modMeleeHitChance, 8.0f, 26.0f); - } - } + void CalculateExpertiseAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Player* modOwner = GetUnitOwner()->GetSpellModOwner()) + { + if (modOwner->getClass() == CLASS_HUNTER) + amount = CalculatePercent(modOwner->m_modRangedHitChance, 8.0f, 26.0f); + else if (modOwner->getPowerType() == POWER_MANA) + amount = CalculatePercent(modOwner->m_modSpellHitChance, 17.0f, 26.0f); + else + amount = CalculatePercent(modOwner->m_modMeleeHitChance, 8.0f, 26.0f); + } + } - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->ApplySpellImmune(GetId(), IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->ApplySpellImmune(GetId(), IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); + } - void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) - { - if (!GetUnitOwner()->IsPet()) - return; + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + { + if (!GetUnitOwner()->IsPet()) + return; - isPeriodic = true; - amplitude = 3*IN_MILLISECONDS; - } - - void HandlePeriodic(AuraEffect const* aurEff) - { - PreventDefaultAction(); - GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); - } + isPeriodic = true; + amplitude = 3*IN_MILLISECONDS; + } + + void HandlePeriodic(AuraEffect const* aurEff) + { + PreventDefaultAction(); + GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); + } - void Register() - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_hit_expertise_scalling_AuraScript::CalculateHitAmount, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_hit_expertise_scalling_AuraScript::CalculateSpellHitAmount, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_hit_expertise_scalling_AuraScript::CalculateExpertiseAmount, EFFECT_2, SPELL_AURA_MOD_EXPERTISE); + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_hit_expertise_scalling_AuraScript::CalculateHitAmount, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_hit_expertise_scalling_AuraScript::CalculateSpellHitAmount, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_hit_expertise_scalling_AuraScript::CalculateExpertiseAmount, EFFECT_2, SPELL_AURA_MOD_EXPERTISE); - OnEffectApply += AuraEffectApplyFn(spell_pet_hit_expertise_scalling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_pet_hit_expertise_scalling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); + OnEffectApply += AuraEffectApplyFn(spell_pet_hit_expertise_scalling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_pet_hit_expertise_scalling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); OnEffectPeriodic += AuraEffectPeriodicFn(spell_pet_hit_expertise_scalling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY); - } - }; + } + }; - AuraScript* GetAuraScript() const - { - return new spell_pet_hit_expertise_scalling_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_pet_hit_expertise_scalling_AuraScript(); + } }; class spell_gen_grow_flower_patch : public SpellScriptLoader @@ -585,8 +585,8 @@ class spell_gen_grow_flower_patch : public SpellScriptLoader SpellCastResult CheckCast() { - if (GetCaster()->HasAuraType(SPELL_AURA_MOD_STEALTH) || GetCaster()->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) - return SPELL_FAILED_DONT_REPORT; + if (GetCaster()->HasAuraType(SPELL_AURA_MOD_STEALTH) || GetCaster()->HasAuraType(SPELL_AURA_MOD_INVISIBILITY)) + return SPELL_FAILED_DONT_REPORT; return SPELL_CAST_OK; } @@ -594,7 +594,7 @@ class spell_gen_grow_flower_patch : public SpellScriptLoader void Register() { OnCheckCast += SpellCheckCastFn(spell_gen_grow_flower_patch_SpellScript::CheckCast); - } + } }; SpellScript* GetSpellScript() const @@ -605,90 +605,90 @@ class spell_gen_grow_flower_patch : public SpellScriptLoader class spell_gen_rallying_cry_of_the_dragonslayer : public SpellScriptLoader { - public: - spell_gen_rallying_cry_of_the_dragonslayer() : SpellScriptLoader("spell_gen_rallying_cry_of_the_dragonslayer") { } + public: + spell_gen_rallying_cry_of_the_dragonslayer() : SpellScriptLoader("spell_gen_rallying_cry_of_the_dragonslayer") { } - class spell_gen_rallying_cry_of_the_dragonslayer_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_rallying_cry_of_the_dragonslayer_SpellScript); + class spell_gen_rallying_cry_of_the_dragonslayer_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_rallying_cry_of_the_dragonslayer_SpellScript); - void SelectTarget(std::list& targets) - { - targets.clear(); + void SelectTarget(std::list& targets) + { + targets.clear(); - uint32 zoneId = 1519; - if (GetCaster()->GetMapId() == 1) // Kalimdor - zoneId = 1637; + uint32 zoneId = 1519; + if (GetCaster()->GetMapId() == 1) // Kalimdor + zoneId = 1637; - Map::PlayerList const& pList = GetCaster()->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (itr->GetSource()->GetZoneId() == zoneId) - targets.push_back(itr->GetSource()); - } + Map::PlayerList const& pList = GetCaster()->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if (itr->GetSource()->GetZoneId() == zoneId) + targets.push_back(itr->GetSource()); + } void Register() { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gen_rallying_cry_of_the_dragonslayer_SpellScript::SelectTarget, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); } - }; + }; - SpellScript* GetSpellScript() const - { - return new spell_gen_rallying_cry_of_the_dragonslayer_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_gen_rallying_cry_of_the_dragonslayer_SpellScript(); + } }; class spell_gen_adals_song_of_battle : public SpellScriptLoader { - public: - spell_gen_adals_song_of_battle() : SpellScriptLoader("spell_gen_adals_song_of_battle") { } + public: + spell_gen_adals_song_of_battle() : SpellScriptLoader("spell_gen_adals_song_of_battle") { } - class spell_gen_adals_song_of_battle_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_adals_song_of_battle_SpellScript); + class spell_gen_adals_song_of_battle_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_adals_song_of_battle_SpellScript); - void SelectTarget(std::list& targets) - { - targets.clear(); - Map::PlayerList const& pList = GetCaster()->GetMap()->GetPlayers(); - for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) - if (itr->GetSource()->GetZoneId() == 3703 /*Shattrath*/) - targets.push_back(itr->GetSource()); - } + void SelectTarget(std::list& targets) + { + targets.clear(); + Map::PlayerList const& pList = GetCaster()->GetMap()->GetPlayers(); + for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + if (itr->GetSource()->GetZoneId() == 3703 /*Shattrath*/) + targets.push_back(itr->GetSource()); + } void Register() { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gen_adals_song_of_battle_SpellScript::SelectTarget, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY); } - }; + }; - SpellScript* GetSpellScript() const - { - return new spell_gen_adals_song_of_battle_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_gen_adals_song_of_battle_SpellScript(); + } }; class spell_gen_disabled_above_63 : public SpellScriptLoader { - public: - spell_gen_disabled_above_63() : SpellScriptLoader("spell_gen_disabled_above_63") { } + public: + spell_gen_disabled_above_63() : SpellScriptLoader("spell_gen_disabled_above_63") { } - class spell_gen_disabled_above_63_AuraScript : public AuraScript + class spell_gen_disabled_above_63_AuraScript : public AuraScript { PrepareAuraScript(spell_gen_disabled_above_63_AuraScript); void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & canBeRecalculated) { - Unit* target = GetUnitOwner(); - if (target->getLevel() <= 63) - amount = amount * target->getLevel() / 60; - else - SetDuration(1); + Unit* target = GetUnitOwner(); + if (target->getLevel() <= 63) + amount = amount * target->getLevel() / 60; + else + SetDuration(1); } void Register() { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_disabled_above_63_AuraScript::CalculateAmount, EFFECT_ALL, SPELL_AURA_ANY); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_disabled_above_63_AuraScript::CalculateAmount, EFFECT_ALL, SPELL_AURA_ANY); } }; @@ -707,27 +707,27 @@ class spell_gen_black_magic_enchant : public SpellScriptLoader { PrepareAuraScript(spell_gen_black_magic_enchant_AuraScript); - bool CheckProc(ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); - if (!spellInfo) - return false; + SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); + if (!spellInfo) + return false; - // Xinef: Old 'code' - if (eventInfo.GetTypeMask() & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG) - return true; + // Xinef: Old 'code' + if (eventInfo.GetTypeMask() & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG) + return true; - // Implement Black Magic enchant Bug - if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID) - if (spellInfo->SpellIconID == 2857 /*SPELL_INFECTED_WOUNDS*/ || spellInfo->SpellIconID == 147 /*SPELL_SHRED*/ || spellInfo->SpellFamilyFlags[1] & 0x400 /*SPELL_MANGLE_(CAT)*/) - return true; + // Implement Black Magic enchant Bug + if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID) + if (spellInfo->SpellIconID == 2857 /*SPELL_INFECTED_WOUNDS*/ || spellInfo->SpellIconID == 147 /*SPELL_SHRED*/ || spellInfo->SpellFamilyFlags[1] & 0x400 /*SPELL_MANGLE_(CAT)*/) + return true; - return false; + return false; } void Register() { - DoCheckProc += AuraCheckProcFn(spell_gen_black_magic_enchant_AuraScript::CheckProc); + DoCheckProc += AuraCheckProcFn(spell_gen_black_magic_enchant_AuraScript::CheckProc); } }; @@ -748,7 +748,7 @@ class spell_gen_area_aura_select_players : public SpellScriptLoader bool CheckAreaTarget(Unit* target) { - return target->GetTypeId() == TYPEID_PLAYER; + return target->GetTypeId() == TYPEID_PLAYER; } void Register() { @@ -764,40 +764,40 @@ class spell_gen_area_aura_select_players : public SpellScriptLoader class spell_gen_select_target_count : public SpellScriptLoader { - public: - spell_gen_select_target_count(const char* name, Targets effTarget, uint8 count) : SpellScriptLoader(name), _effTarget(effTarget), _count(count) { } + public: + spell_gen_select_target_count(const char* name, Targets effTarget, uint8 count) : SpellScriptLoader(name), _effTarget(effTarget), _count(count) { } - class spell_gen_select_target_count_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_select_target_count_SpellScript); + class spell_gen_select_target_count_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_select_target_count_SpellScript); - public: - spell_gen_select_target_count_SpellScript(Targets effTarget, uint8 count) : _effTarget(effTarget), _count(count) { } + public: + spell_gen_select_target_count_SpellScript(Targets effTarget, uint8 count) : _effTarget(effTarget), _count(count) { } - void FilterTargets(std::list& targets) - { - targets.remove(GetCaster()); - Trinity::Containers::RandomResizeList(targets, _count); - } + void FilterTargets(std::list& targets) + { + targets.remove(GetCaster()); + Trinity::Containers::RandomResizeList(targets, _count); + } - void Register() - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gen_select_target_count_SpellScript::FilterTargets, EFFECT_ALL, _effTarget); - } + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gen_select_target_count_SpellScript::FilterTargets, EFFECT_ALL, _effTarget); + } - private: - Targets _effTarget; - uint8 _count; - }; + private: + Targets _effTarget; + uint8 _count; + }; - SpellScript* GetSpellScript() const - { - return new spell_gen_select_target_count_SpellScript(_effTarget, _count); - } + SpellScript* GetSpellScript() const + { + return new spell_gen_select_target_count_SpellScript(_effTarget, _count); + } - private: - Targets _effTarget; - uint8 _count; + private: + Targets _effTarget; + uint8 _count; }; class spell_gen_use_spell_base_level_check : public SpellScriptLoader @@ -811,15 +811,15 @@ class spell_gen_use_spell_base_level_check : public SpellScriptLoader SpellCastResult CheckRequirement() { - if (GetCaster()->getLevel() < GetSpellInfo()->BaseLevel) - return SPELL_FAILED_LEVEL_REQUIREMENT; + if (GetCaster()->getLevel() < GetSpellInfo()->BaseLevel) + return SPELL_FAILED_LEVEL_REQUIREMENT; return SPELL_CAST_OK; } void Register() { OnCheckCast += SpellCheckCastFn(spell_gen_use_spell_base_level_check_SpellScript::CheckRequirement); - } + } }; SpellScript* GetSpellScript() const @@ -839,7 +839,7 @@ class spell_gen_proc_from_direct_damage : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return !eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->IsTargetingArea(); + return !eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->IsTargetingArea(); } void Register() @@ -865,7 +865,7 @@ class spell_gen_no_offhand_proc : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return !(eventInfo.GetTypeMask() & PROC_FLAG_DONE_OFFHAND_ATTACK); + return !(eventInfo.GetTypeMask() & PROC_FLAG_DONE_OFFHAND_ATTACK); } void Register() @@ -889,21 +889,21 @@ class spell_gen_proc_once_per_cast : public SpellScriptLoader { PrepareAuraScript(spell_gen_proc_once_per_cast_AuraScript); - bool Load() - { - _spellPointer = NULL; - return true; - } + bool Load() + { + _spellPointer = NULL; + return true; + } bool CheckProc(ProcEventInfo& eventInfo) { - if (Player* player = eventInfo.GetActor()->ToPlayer()) - { - if (player->m_spellModTakingSpell == _spellPointer) - return false; - _spellPointer = player->m_spellModTakingSpell; - } - return true; + if (Player* player = eventInfo.GetActor()->ToPlayer()) + { + if (player->m_spellModTakingSpell == _spellPointer) + return false; + _spellPointer = player->m_spellModTakingSpell; + } + return true; } void Register() @@ -911,8 +911,8 @@ class spell_gen_proc_once_per_cast : public SpellScriptLoader DoCheckProc += AuraCheckProcFn(spell_gen_proc_once_per_cast_AuraScript::CheckProc); } - private: - Spell* _spellPointer; + private: + Spell* _spellPointer; }; AuraScript* GetAuraScript() const @@ -932,7 +932,7 @@ class spell_gen_proc_on_self : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetActor() == eventInfo.GetActionTarget(); + return eventInfo.GetActor() == eventInfo.GetActionTarget(); } void Register() @@ -958,7 +958,7 @@ class spell_gen_proc_not_self : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetActor() != eventInfo.GetActionTarget(); + return eventInfo.GetActor() != eventInfo.GetActionTarget(); } void Register() @@ -984,18 +984,18 @@ class spell_gen_baby_murloc_passive : public SpellScriptLoader void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - GetAura()->GetEffect(aurEff->GetEffIndex())->SetPeriodicTimer(urand(60000, 120000)); + GetAura()->GetEffect(aurEff->GetEffIndex())->SetPeriodicTimer(urand(60000, 120000)); } void HandlePeriodicTimer(AuraEffect* aurEff) { - aurEff->SetPeriodicTimer(urand(120000, 240000)); + aurEff->SetPeriodicTimer(urand(120000, 240000)); } void Register() { OnEffectApply += AuraEffectApplyFn(spell_gen_baby_murloc_passive_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_baby_murloc_passive_AuraScript::HandlePeriodicTimer, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_baby_murloc_passive_AuraScript::HandlePeriodicTimer, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -1007,34 +1007,34 @@ class spell_gen_baby_murloc_passive : public SpellScriptLoader class spell_gen_baby_murloc : public SpellScriptLoader { - public: - spell_gen_baby_murloc() : SpellScriptLoader("spell_gen_baby_murloc") { } + public: + spell_gen_baby_murloc() : SpellScriptLoader("spell_gen_baby_murloc") { } - class spell_gen_baby_murloc_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_baby_murloc_AuraScript) - - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCE); - } + class spell_gen_baby_murloc_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_baby_murloc_AuraScript) + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCE); + } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_gen_baby_murloc_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_gen_baby_murloc_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_gen_baby_murloc_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_baby_murloc_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_gen_baby_murloc_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_gen_baby_murloc_AuraScript(); + } }; class spell_gen_fixate : public SpellScriptLoader @@ -1048,9 +1048,9 @@ class spell_gen_fixate : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(GetCaster(), GetEffectValue(), true); + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + target->CastSpell(GetCaster(), GetEffectValue(), true); } void Register() @@ -1064,26 +1064,26 @@ class spell_gen_fixate : public SpellScriptLoader return new spell_gen_fixate_SpellScript(); } - class spell_gen_fixate_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_fixate_AuraScript) + class spell_gen_fixate_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_fixate_AuraScript) - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - caster->RemoveAurasDueToSpell(GetSpellInfo()->Effects[EFFECT_2].CalcValue(), GetTarget()->GetGUID()); - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + caster->RemoveAurasDueToSpell(GetSpellInfo()->Effects[EFFECT_2].CalcValue(), GetTarget()->GetGUID()); + } - void Register() - { - OnEffectRemove += AuraEffectRemoveFn(spell_gen_fixate_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + OnEffectRemove += AuraEffectRemoveFn(spell_gen_fixate_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_gen_fixate_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_gen_fixate_AuraScript(); + } }; class spell_gen_proc_above_75 : public SpellScriptLoader @@ -1097,7 +1097,7 @@ class spell_gen_proc_above_75 : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetActor() && eventInfo.GetActor()->getLevel() >= 75; + return eventInfo.GetActor() && eventInfo.GetActor()->getLevel() >= 75; } void Register() @@ -1123,9 +1123,9 @@ class spell_gen_periodic_knock_away : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); - if (Unit* victim = GetUnitOwner()->GetVictim()) - GetUnitOwner()->CastSpell(victim, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + PreventDefaultAction(); + if (Unit* victim = GetUnitOwner()->GetVictim()) + GetUnitOwner()->CastSpell(victim, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); } void Register() @@ -1151,10 +1151,10 @@ class spell_gen_knock_away : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - if (Creature* caster = GetCaster()->ToCreature()) - caster->getThreatManager().modifyThreatPercent(target, -25); // Xinef: amount confirmed by onyxia and void reaver notes + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + if (Creature* caster = GetCaster()->ToCreature()) + caster->getThreatManager().modifyThreatPercent(target, -25); // Xinef: amount confirmed by onyxia and void reaver notes } void Register() @@ -1179,14 +1179,14 @@ class spell_gen_mod_radius_by_caster_scale : public SpellScriptLoader PrepareSpellScript(spell_gen_mod_radius_by_caster_scale_SpellScript) bool Load() - { - GetSpell()->SetSpellValue(SPELLVALUE_RADIUS_MOD, 10000.0f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X)); - return true; - } + { + GetSpell()->SetSpellValue(SPELLVALUE_RADIUS_MOD, 10000.0f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X)); + return true; + } void Register() { - } + } }; SpellScript* GetSpellScript() const @@ -1206,12 +1206,12 @@ class spell_gen_proc_reduced_above_60 : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - // Xinef: mostly its 33.(3)% reduce by 70 and 66.(6)% by 80 - if (eventInfo.GetActor() && eventInfo.GetActor()->getLevel() > 60) - if (roll_chance_f((eventInfo.GetActor()->getLevel() - 60) * 3.33f)) - return false; + // Xinef: mostly its 33.(3)% reduce by 70 and 66.(6)% by 80 + if (eventInfo.GetActor() && eventInfo.GetActor()->getLevel() > 60) + if (roll_chance_f((eventInfo.GetActor()->getLevel() - 60) * 3.33f)) + return false; - return true; + return true; } void Register() @@ -1238,13 +1238,13 @@ class spell_gen_visual_dummy_stun : public SpellScriptLoader void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - target->SetControlled(true, UNIT_STATE_STUNNED); + target->SetControlled(true, UNIT_STATE_STUNNED); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - target->SetControlled(false, UNIT_STATE_STUNNED); + target->SetControlled(false, UNIT_STATE_STUNNED); } void Register() @@ -1303,10 +1303,10 @@ class spell_gen_hate_to_zero : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - if (Creature* caster = GetCaster()->ToCreature()) - caster->getThreatManager().modifyThreatPercent(target, -100); + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + if (Creature* caster = GetCaster()->ToCreature()) + caster->getThreatManager().modifyThreatPercent(target, -100); } void Register() @@ -1332,12 +1332,12 @@ class spell_gen_focused_bursts : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (effIndex != EFFECT_0) - return; + PreventHitDefaultEffect(effIndex); + if (effIndex != EFFECT_0) + return; - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, uint32(GetSpellInfo()->Effects[EFFECT_0].BasePoints)+urand(1, 3), true); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, uint32(GetSpellInfo()->Effects[EFFECT_0].BasePoints)+urand(1, 3), true); } void Register() @@ -1354,9 +1354,9 @@ class spell_gen_focused_bursts : public SpellScriptLoader enum eFlurryOfClaws { - NPC_FRENZYHEART_RAVAGER = 28078, - NPC_FRENZYHEART_HUNTER = 28079, - SPELL_FLURRY_OF_CLAWS_DAMAGE = 53033 + NPC_FRENZYHEART_RAVAGER = 28078, + NPC_FRENZYHEART_HUNTER = 28079, + SPELL_FLURRY_OF_CLAWS_DAMAGE = 53033 }; class spell_gen_flurry_of_claws : public SpellScriptLoader @@ -1370,13 +1370,13 @@ class spell_gen_flurry_of_claws : public SpellScriptLoader void OnPeriodic(AuraEffect const* aurEff) { - PreventDefaultAction(); - if (Unit* target = GetUnitOwner()->SelectNearbyTarget(NULL, 7.0f)) - if (target->GetEntry() == NPC_FRENZYHEART_RAVAGER || target->GetEntry() == NPC_FRENZYHEART_HUNTER) - { - int32 basePoints = irand(1400, 2200); - GetUnitOwner()->CastCustomSpell(SPELL_FLURRY_OF_CLAWS_DAMAGE, SPELLVALUE_BASE_POINT0, basePoints, target, TRIGGERED_FULL_MASK); - } + PreventDefaultAction(); + if (Unit* target = GetUnitOwner()->SelectNearbyTarget(NULL, 7.0f)) + if (target->GetEntry() == NPC_FRENZYHEART_RAVAGER || target->GetEntry() == NPC_FRENZYHEART_HUNTER) + { + int32 basePoints = irand(1400, 2200); + GetUnitOwner()->CastCustomSpell(SPELL_FLURRY_OF_CLAWS_DAMAGE, SPELLVALUE_BASE_POINT0, basePoints, target, TRIGGERED_FULL_MASK); + } } void Register() @@ -1403,8 +1403,8 @@ class spell_gen_throw_back : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - target->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + if (Unit* target = GetHitUnit()) + target->CastSpell(GetCaster(), uint32(GetEffectValue()), true); } void Register() @@ -1975,7 +1975,7 @@ class spell_gen_pet_summoned : public SpellScriptLoader { Player* player = GetCaster()->ToPlayer(); if (player->GetLastPetNumber() && player->CanResummonPet(player->GetLastPetSpell())) - Pet::LoadPetFromDB(player, PET_LOAD_BG_RESURRECT, 0, player->GetLastPetNumber(), true); + Pet::LoadPetFromDB(player, PET_LOAD_BG_RESURRECT, 0, player->GetLastPetNumber(), true); } void Register() @@ -2106,7 +2106,7 @@ class spell_gen_creature_permanent_feign_death : public SpellScriptLoader Unit* target = GetTarget(); target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); if (target->GetTypeId() == TYPEID_UNIT) target->ToCreature()->SetReactState(REACT_PASSIVE); @@ -2117,7 +2117,7 @@ class spell_gen_creature_permanent_feign_death : public SpellScriptLoader Unit* target = GetTarget(); target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); if (target->GetTypeId() == TYPEID_UNIT) target->ToCreature()->SetReactState(REACT_AGGRESSIVE); @@ -2165,36 +2165,36 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader void HandleScript() { - Player* player = GetCaster()->ToPlayer(); + Player* player = GetCaster()->ToPlayer(); // This is only needed because spells cast from spell_linked_spell are triggered by default // Spell::SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD player->AddSpellAndCategoryCooldowns(GetSpellInfo(), GetCastItem() ? GetCastItem()->GetEntry() : 0, GetSpell()); - if (player->GetTeamId() == TEAM_HORDE) - if (GetSpellInfo()->Id == SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER) - { - WorldPacket data; - player->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_INCLUDE_GCD, 7744, GetSpellInfo()->CategoryRecoveryTime); // Will of the forsaken - player->GetSession()->SendPacket(&data); - } - else - { - WorldPacket data(SMSG_INITIAL_SPELLS, (1+2+2+4+2+2+4+4)); - data << uint8(0); - data << uint16(0); - data << uint16(1); - data << uint32(42292); // PvP Trinket spell - data << uint16(0); // cast item id - data << uint16(GetSpellInfo()->GetCategory()); // spell category - data << uint32(0); - data << uint32(GetSpellInfo()->CategoryRecoveryTime); - player->GetSession()->SendPacket(&data); + if (player->GetTeamId() == TEAM_HORDE) + if (GetSpellInfo()->Id == SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER) + { + WorldPacket data; + player->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_INCLUDE_GCD, 7744, GetSpellInfo()->CategoryRecoveryTime); // Will of the forsaken + player->GetSession()->SendPacket(&data); + } + else + { + WorldPacket data(SMSG_INITIAL_SPELLS, (1+2+2+4+2+2+4+4)); + data << uint8(0); + data << uint16(0); + data << uint16(1); + data << uint32(42292); // PvP Trinket spell + data << uint16(0); // cast item id + data << uint16(GetSpellInfo()->GetCategory()); // spell category + data << uint32(0); + data << uint32(GetSpellInfo()->CategoryRecoveryTime); + player->GetSession()->SendPacket(&data); - WorldPacket data2; - player->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_INCLUDE_GCD, 42292, GetSpellInfo()->CategoryRecoveryTime); // PvP Trinket spell - player->GetSession()->SendPacket(&data2); + WorldPacket data2; + player->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_INCLUDE_GCD, 42292, GetSpellInfo()->CategoryRecoveryTime); // PvP Trinket spell + player->GetSession()->SendPacket(&data2); - } + } } void Register() @@ -2575,7 +2575,7 @@ class spell_gen_seaforium_blast : public SpellScriptLoader // but in effect handling OriginalCaster can become NULL if (Unit* originalCaster = GetOriginalCaster()) if (GameObject* go = GetHitGObj()) - if (go->GetGOValue()->Building.Health > 0 && go->GetGOInfo()->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) + if (go->GetGOValue()->Building.Health > 0 && go->GetGOInfo()->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) originalCaster->CastSpell(originalCaster, SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT, true); } @@ -2605,34 +2605,34 @@ class spell_gen_turkey_marker : public SpellScriptLoader { PrepareAuraScript(spell_gen_turkey_marker_AuraScript); - bool Load() - { - _applyTimes.clear(); - stackAmount = 0; - return true; - } + bool Load() + { + _applyTimes.clear(); + stackAmount = 0; + return true; + } void OnPeriodic(AuraEffect const* aurEff) { - if (GetStackAmount() > stackAmount) - { - _applyTimes.push_back(World::GetGameTimeMS()); - stackAmount++; - } + if (GetStackAmount() > stackAmount) + { + _applyTimes.push_back(World::GetGameTimeMS()); + stackAmount++; + } // pop stack if it expired for us if (_applyTimes.front() + GetMaxDuration() < World::GetGameTimeMS()) - { - stackAmount--; + { + stackAmount--; ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE); - } + } - // dont cast this spell on every tick - if (stackAmount >= 15 && stackAmount < 40) - { - stackAmount = 40; - GetTarget()->CastSpell(GetTarget(), SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID()); - } + // dont cast this spell on every tick + if (stackAmount >= 15 && stackAmount < 40) + { + stackAmount = 40; + GetTarget()->CastSpell(GetTarget(), SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID()); + } } void Register() @@ -2641,7 +2641,7 @@ class spell_gen_turkey_marker : public SpellScriptLoader } std::list _applyTimes; - int16 stackAmount; + int16 stackAmount; }; AuraScript* GetAuraScript() const @@ -2698,8 +2698,8 @@ class spell_gen_magic_rooster : public SpellScriptLoader PreventHitDefaultEffect(effIndex); if (Player* target = GetHitPlayer()) { - uint32 petNumber = target->GetTemporaryUnsummonedPetNumber(); - target->SetTemporaryUnsummonedPetNumber(0); + uint32 petNumber = target->GetTemporaryUnsummonedPetNumber(); + target->SetTemporaryUnsummonedPetNumber(0); // prevent client crashes from stacking mounts target->RemoveAurasByType(SPELL_AURA_MOUNTED); @@ -2720,8 +2720,8 @@ class spell_gen_magic_rooster : public SpellScriptLoader } target->CastSpell(target, spellId, true); - if (petNumber) - target->SetTemporaryUnsummonedPetNumber(petNumber); + if (petNumber) + target->SetTemporaryUnsummonedPetNumber(petNumber); } } @@ -2775,16 +2775,16 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader public: spell_gen_vehicle_scaling() : SpellScriptLoader("spell_gen_vehicle_scaling") { } - class spell_gen_vehicle_scaling_SpellScript : public SpellScript + class spell_gen_vehicle_scaling_SpellScript : public SpellScript { PrepareSpellScript(spell_gen_vehicle_scaling_SpellScript); SpellCastResult CheckSeat() { - if (Vehicle* veh = GetCaster()->GetVehicle()) - if (const VehicleSeatEntry* seatEntry = veh->GetSeatForPassenger(GetCaster())) - if (seatEntry->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) - return SPELL_CAST_OK; + if (Vehicle* veh = GetCaster()->GetVehicle()) + if (const VehicleSeatEntry* seatEntry = veh->GetSeatForPassenger(GetCaster())) + if (seatEntry->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) + return SPELL_CAST_OK; return SPELL_FAILED_DONT_REPORT; } @@ -3227,7 +3227,7 @@ enum BreakShieldSpells SPELL_BREAK_SHIELD_TRIGGER_FACTION_MOUNTS = 62575, // Also on ToC5 mounts SPELL_BREAK_SHIELD_TRIGGER_CAMPAING_WARHORSE = 64595, SPELL_BREAK_SHIELD_TRIGGER_UNK = 66480, - SPELL_BREAK_SHIELD_TRIGGER_SUNDERING_THURST = 63825 + SPELL_BREAK_SHIELD_TRIGGER_SUNDERING_THURST = 63825 }; class spell_gen_break_shield: public SpellScriptLoader @@ -3256,7 +3256,7 @@ class spell_gen_break_shield: public SpellScriptLoader spellId = SPELL_BREAK_SHIELD_DAMAGE_10K; break; case SPELL_BREAK_SHIELD_TRIGGER_FACTION_MOUNTS: - case SPELL_BREAK_SHIELD_TRIGGER_SUNDERING_THURST: + case SPELL_BREAK_SHIELD_TRIGGER_SUNDERING_THURST: spellId = SPELL_BREAK_SHIELD_DAMAGE_2K; break; default: @@ -4288,9 +4288,9 @@ enum Mounts SPELL_X53_TOURING_ROCKET_280 = 75972, SPELL_X53_TOURING_ROCKET_310 = 76154, - // Big Blizzard Bear - SPELL_BIG_BLIZZARD_BEAR_60 = 58997, - SPELL_BIG_BLIZZARD_BEAR_100 = 58999 + // Big Blizzard Bear + SPELL_BIG_BLIZZARD_BEAR_60 = 58997, + SPELL_BIG_BLIZZARD_BEAR_100 = 58999 }; class spell_gen_mount : public SpellScriptLoader @@ -4330,8 +4330,8 @@ class spell_gen_mount : public SpellScriptLoader if (Player* target = GetHitPlayer()) { - uint32 petNumber = target->GetTemporaryUnsummonedPetNumber(); - target->SetTemporaryUnsummonedPetNumber(0); + uint32 petNumber = target->GetTemporaryUnsummonedPetNumber(); + target->SetTemporaryUnsummonedPetNumber(0); // Prevent stacking of mounts and client crashes upon dismounting target->RemoveAurasByType(SPELL_AURA_MOUNTED, 0, GetHitAura()); @@ -4346,9 +4346,9 @@ class spell_gen_mount : public SpellScriptLoader target->GetPosition(x, y, z); uint32 areaFlag = target->GetBaseMap()->GetAreaFlag(x, y, z); AreaTableEntry const* area = sAreaStore.LookupEntry(areaFlag); - // Xinef: add battlefield check - Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()); - if (!area || (canFly && ((area->flags & AREA_FLAG_NO_FLY_ZONE) || (Bf && !Bf->CanFlyIn())))) + // Xinef: add battlefield check + Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()); + if (!area || (canFly && ((area->flags & AREA_FLAG_NO_FLY_ZONE) || (Bf && !Bf->CanFlyIn())))) canFly = false; uint32 mount = 0; @@ -4390,8 +4390,8 @@ class spell_gen_mount : public SpellScriptLoader target->CastSpell(target, mount, true); } - if (petNumber) - target->SetTemporaryUnsummonedPetNumber(petNumber); + if (petNumber) + target->SetTemporaryUnsummonedPetNumber(petNumber); } } @@ -4596,7 +4596,7 @@ class spell_gen_replenishment : public SpellScriptLoader } } - targets.remove_if(Trinity::PowerCheck(POWER_MANA, false)); + targets.remove_if(Trinity::PowerCheck(POWER_MANA, false)); uint8 const maxTargets = 10; @@ -4774,14 +4774,14 @@ class spell_gen_eject_all_passengers : public SpellScriptLoader void RemoveVehicleAuras() { - Unit* u = NULL; + Unit* u = NULL; if (Vehicle* vehicle = GetHitUnit()->GetVehicleKit()) - { - u = vehicle->GetPassenger(0); + { + u = vehicle->GetPassenger(0); vehicle->RemoveAllPassengers(); - } - if (u) - u->RemoveAurasDueToSpell(VEHICLE_SPELL_PARACHUTE); + } + if (u) + u->RemoveAurasDueToSpell(VEHICLE_SPELL_PARACHUTE); } void Register() @@ -4835,54 +4835,54 @@ class spell_gen_eject_passenger : public SpellScriptLoader void AddSC_generic_spell_scripts() { - // ours: - new spell_gen_model_visible(); - new spell_the_flag_of_ownership(); - new spell_gen_have_item_auras(); - new spell_gen_mine_sweeper(); - new spell_gen_reduced_above_60(); - new spell_gen_relocaste_dest("spell_q10838_demoniac_scryer_visual", 0, 0, 20.0, 0); - new spell_gen_relocaste_dest("spell_q20438_q24556_aquantos_laundry", 0, 0, 7.0f, 0); - new spell_gen_allow_proc_from_spells_with_cost(); - new spell_gen_bg_preparation(); - new spell_gen_disabled_above_level("spell_gen_disabled_above_73", 73); - new spell_gen_disabled_above_level("spell_gen_disabled_above_70", 70); - new spell_pet_hit_expertise_scalling(); - new spell_gen_grow_flower_patch(); - new spell_gen_rallying_cry_of_the_dragonslayer(); - new spell_gen_adals_song_of_battle(); - new spell_gen_disabled_above_63(); - new spell_gen_black_magic_enchant(); - new spell_gen_area_aura_select_players(); - new spell_gen_mount("spell_big_blizzard_bear", 0, SPELL_BIG_BLIZZARD_BEAR_60, SPELL_BIG_BLIZZARD_BEAR_100, 0, 0); - new spell_gen_select_target_count("spell_gen_select_target_count_15_1", TARGET_UNIT_SRC_AREA_ENEMY, 1); - new spell_gen_select_target_count("spell_gen_select_target_count_15_2", TARGET_UNIT_SRC_AREA_ENEMY, 2); - new spell_gen_select_target_count("spell_gen_select_target_count_15_5", TARGET_UNIT_SRC_AREA_ENEMY, 5); - new spell_gen_select_target_count("spell_gen_select_target_count_7_1", TARGET_UNIT_SRC_AREA_ENTRY, 1); - new spell_gen_select_target_count("spell_gen_select_target_count_24_1", TARGET_UNIT_CONE_ENEMY_24, 1); - new spell_gen_select_target_count("spell_gen_select_target_count_30_1", TARGET_UNIT_SRC_AREA_ALLY, 1); - new spell_gen_use_spell_base_level_check(); - new spell_gen_proc_from_direct_damage(); - new spell_gen_no_offhand_proc(); - new spell_gen_proc_once_per_cast(); - new spell_gen_proc_on_self(); - new spell_gen_proc_not_self(); - new spell_gen_baby_murloc_passive(); - new spell_gen_baby_murloc(); - new spell_gen_fixate(); - new spell_gen_proc_above_75(); - new spell_gen_periodic_knock_away(); - new spell_gen_knock_away(); - new spell_gen_mod_radius_by_caster_scale(); - new spell_gen_proc_reduced_above_60(); - new spell_gen_visual_dummy_stun(); - new spell_gen_random_target32(); - new spell_gen_hate_to_zero(); - new spell_gen_focused_bursts(); - new spell_gen_flurry_of_claws(); - new spell_gen_throw_back(); + // ours: + new spell_gen_model_visible(); + new spell_the_flag_of_ownership(); + new spell_gen_have_item_auras(); + new spell_gen_mine_sweeper(); + new spell_gen_reduced_above_60(); + new spell_gen_relocaste_dest("spell_q10838_demoniac_scryer_visual", 0, 0, 20.0, 0); + new spell_gen_relocaste_dest("spell_q20438_q24556_aquantos_laundry", 0, 0, 7.0f, 0); + new spell_gen_allow_proc_from_spells_with_cost(); + new spell_gen_bg_preparation(); + new spell_gen_disabled_above_level("spell_gen_disabled_above_73", 73); + new spell_gen_disabled_above_level("spell_gen_disabled_above_70", 70); + new spell_pet_hit_expertise_scalling(); + new spell_gen_grow_flower_patch(); + new spell_gen_rallying_cry_of_the_dragonslayer(); + new spell_gen_adals_song_of_battle(); + new spell_gen_disabled_above_63(); + new spell_gen_black_magic_enchant(); + new spell_gen_area_aura_select_players(); + new spell_gen_mount("spell_big_blizzard_bear", 0, SPELL_BIG_BLIZZARD_BEAR_60, SPELL_BIG_BLIZZARD_BEAR_100, 0, 0); + new spell_gen_select_target_count("spell_gen_select_target_count_15_1", TARGET_UNIT_SRC_AREA_ENEMY, 1); + new spell_gen_select_target_count("spell_gen_select_target_count_15_2", TARGET_UNIT_SRC_AREA_ENEMY, 2); + new spell_gen_select_target_count("spell_gen_select_target_count_15_5", TARGET_UNIT_SRC_AREA_ENEMY, 5); + new spell_gen_select_target_count("spell_gen_select_target_count_7_1", TARGET_UNIT_SRC_AREA_ENTRY, 1); + new spell_gen_select_target_count("spell_gen_select_target_count_24_1", TARGET_UNIT_CONE_ENEMY_24, 1); + new spell_gen_select_target_count("spell_gen_select_target_count_30_1", TARGET_UNIT_SRC_AREA_ALLY, 1); + new spell_gen_use_spell_base_level_check(); + new spell_gen_proc_from_direct_damage(); + new spell_gen_no_offhand_proc(); + new spell_gen_proc_once_per_cast(); + new spell_gen_proc_on_self(); + new spell_gen_proc_not_self(); + new spell_gen_baby_murloc_passive(); + new spell_gen_baby_murloc(); + new spell_gen_fixate(); + new spell_gen_proc_above_75(); + new spell_gen_periodic_knock_away(); + new spell_gen_knock_away(); + new spell_gen_mod_radius_by_caster_scale(); + new spell_gen_proc_reduced_above_60(); + new spell_gen_visual_dummy_stun(); + new spell_gen_random_target32(); + new spell_gen_hate_to_zero(); + new spell_gen_focused_bursts(); + new spell_gen_flurry_of_claws(); + new spell_gen_throw_back(); - // theirs: + // theirs: new spell_gen_absorb0_hitlimit1(); new spell_gen_adaptive_warding(); new spell_gen_av_drekthar_presence(); @@ -4931,7 +4931,7 @@ void AddSC_generic_spell_scripts() new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); new spell_gen_count_pct_from_max_hp("spell_gen_100pct_count_pct_from_max_hp", 100); - new spell_gen_despawn_self(); + new spell_gen_despawn_self(); new spell_gen_bandage(); new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL); new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL); diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 53e82fc23..4d66c10b4 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -32,11 +32,11 @@ enum HunterSpells { - // Ours - SPELL_HUNTER_WYVERN_STING_DOT = 24131, + // Ours + SPELL_HUNTER_WYVERN_STING_DOT = 24131, - // Theirs - SPELL_HUNTER_ASPECT_OF_THE_BEAST = 13161, + // Theirs + SPELL_HUNTER_ASPECT_OF_THE_BEAST = 13161, SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET = 61669, SPELL_HUNTER_ASPECT_OF_THE_VIPER = 34074, SPELL_HUNTER_ASPECT_OF_THE_VIPER_ENERGIZE = 34075, @@ -74,21 +74,21 @@ class spell_hun_check_pet_los : public SpellScriptLoader SpellCastResult CheckCast() { - Unit* pet = GetCaster()->GetGuardianPet(); - if (!pet) - pet = GetCaster()->GetCharm(); + Unit* pet = GetCaster()->GetGuardianPet(); + if (!pet) + pet = GetCaster()->GetCharm(); - if (!pet) - return SPELL_FAILED_NO_PET; + if (!pet) + return SPELL_FAILED_NO_PET; - if (!pet->IsAlive()) - { - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_PET_IS_DEAD); + if (!pet->IsAlive()) + { + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_PET_IS_DEAD); return SPELL_FAILED_CUSTOM_ERROR; - } + } - if (!GetCaster()->IsWithinLOSInMap(pet)) - return SPELL_FAILED_LINE_OF_SIGHT; + if (!GetCaster()->IsWithinLOSInMap(pet)) + return SPELL_FAILED_LINE_OF_SIGHT; return SPELL_CAST_OK; } @@ -116,8 +116,8 @@ class spell_hun_cower : public SpellScriptLoader void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) { - if (AuraEffect* aurEff = GetUnitOwner()->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_PET, GetSpellInfo()->SpellIconID, EFFECT_0)) - AddPct(amount, aurEff->GetAmount()); + if (AuraEffect* aurEff = GetUnitOwner()->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_PET, GetSpellInfo()->SpellIconID, EFFECT_0)) + AddPct(amount, aurEff->GetAmount()); } void Register() @@ -134,29 +134,29 @@ class spell_hun_cower : public SpellScriptLoader class spell_hun_wyvern_sting : public SpellScriptLoader { - public: - spell_hun_wyvern_sting() : SpellScriptLoader("spell_hun_wyvern_sting") { } + public: + spell_hun_wyvern_sting() : SpellScriptLoader("spell_hun_wyvern_sting") { } - class spell_hun_wyvern_sting_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hun_wyvern_sting_AuraScript) + class spell_hun_wyvern_sting_AuraScript : public AuraScript + { + PrepareAuraScript(spell_hun_wyvern_sting_AuraScript) - void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (Unit* caster = GetCaster()) - caster->CastSpell(GetTarget(), sSpellMgr->GetSpellWithRank(SPELL_HUNTER_WYVERN_STING_DOT, GetSpellInfo()->GetRank()), true); - } + void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), sSpellMgr->GetSpellWithRank(SPELL_HUNTER_WYVERN_STING_DOT, GetSpellInfo()->GetRank()), true); + } - void Register() - { - AfterEffectRemove += AuraEffectRemoveFn(spell_hun_wyvern_sting_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); - } - }; + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_hun_wyvern_sting_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_hun_wyvern_sting_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_hun_wyvern_sting_AuraScript(); + } }; class spell_hun_animal_handler : public SpellScriptLoader @@ -170,10 +170,10 @@ class spell_hun_animal_handler : public SpellScriptLoader void CalculateAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - amount = 0; - if (Unit* owner = GetUnitOwner()->GetOwner()) - if (AuraEffect const* animalHandlerEff = owner->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 2234, EFFECT_1)) - amount = animalHandlerEff->GetAmount(); + amount = 0; + if (Unit* owner = GetUnitOwner()->GetOwner()) + if (AuraEffect const* animalHandlerEff = owner->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 2234, EFFECT_1)) + amount = animalHandlerEff->GetAmount(); } void Register() @@ -199,115 +199,115 @@ class spell_hun_generic_scaling : public SpellScriptLoader void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: pet inherits 40% of resistance from owner and 35% of armor - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; - amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); - } + // xinef: pet inherits 40% of resistance from owner and 35% of armor + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; + amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); + } } void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - // xinef: by default pet inherits 45% of stamina - int32 modifier = 45; + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + // xinef: by default pet inherits 45% of stamina + int32 modifier = 45; - // xinef: Wild Hunt bonus for stamina - if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_0)) - AddPct(modifier, wildHuntEff->GetAmount()); + // xinef: Wild Hunt bonus for stamina + if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_0)) + AddPct(modifier, wildHuntEff->GetAmount()); - amount = CalculatePct(std::max(0, owner->GetStat(Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue))), modifier); - } + amount = CalculatePct(std::max(0, owner->GetStat(Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue))), modifier); + } } - void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - // xinef: by default 22% of RAP - int32 modifier = 22; - - // xinef: Wild Hunt bonus for AP - if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_1)) - AddPct(modifier, wildHuntEff->GetAmount()); + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + // xinef: by default 22% of RAP + int32 modifier = 22; + + // xinef: Wild Hunt bonus for AP + if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_1)) + AddPct(modifier, wildHuntEff->GetAmount()); - float ownerAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK); + float ownerAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK); - // Xinef: Hunter vs. Wild - if (AuraEffect* HvWEff = owner->GetAuraEffect(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, SPELLFAMILY_HUNTER, 3647, EFFECT_0)) - ownerAP += CalculatePct(owner->GetStat(STAT_STAMINA), HvWEff->GetAmount()); + // Xinef: Hunter vs. Wild + if (AuraEffect* HvWEff = owner->GetAuraEffect(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, SPELLFAMILY_HUNTER, 3647, EFFECT_0)) + ownerAP += CalculatePct(owner->GetStat(STAT_STAMINA), HvWEff->GetAmount()); - amount = CalculatePct(std::max(0, ownerAP), modifier); - } + amount = CalculatePct(std::max(0, ownerAP), modifier); + } } - void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - // xinef: by default 12.87% of RAP - float modifier = 12.87f; - - // xinef: Wild Hunt bonus for AP - if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_1)) - AddPct(modifier, wildHuntEff->GetAmount()); + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + // xinef: by default 12.87% of RAP + float modifier = 12.87f; + + // xinef: Wild Hunt bonus for AP + if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_1)) + AddPct(modifier, wildHuntEff->GetAmount()); - amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(RANGED_ATTACK)), modifier); + amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(RANGED_ATTACK)), modifier); - // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); - } + // xinef: Update appropriate player field + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); + } } - void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) { isPeriodic = true; amplitude = 2*IN_MILLISECONDS; } - + void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) - { - int32 currentAmount = aurEff->GetAmount(); - int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); - if (newAmount != currentAmount) - { - if (aurEff->GetMiscValue() == STAT_STAMINA) - { - uint32 actStat = GetUnitOwner()->GetHealth(); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); - } - else - { - uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); - } - } - } - else - GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) + { + int32 currentAmount = aurEff->GetAmount(); + int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); + if (newAmount != currentAmount) + { + if (aurEff->GetMiscValue() == STAT_STAMINA) + { + uint32 actStat = GetUnitOwner()->GetHealth(); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); + } + else + { + uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); + } + } + } + else + GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); } void Register() { - if (m_scriptSpellId != 34902) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); - else - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); - } + if (m_scriptSpellId != 34902) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); + else + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); + } - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_hun_generic_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_hun_generic_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); OnEffectPeriodic += AuraEffectPeriodicFn(spell_hun_generic_scaling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY); } }; @@ -345,39 +345,39 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (GetCaster()) - if (Player* caster = GetCaster()->ToPlayer()) - if (Pet* pet = caster->GetPet()) - pet->RemoveAurasDueToSpell(SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET); + if (GetCaster()) + if (Player* caster = GetCaster()->ToPlayer()) + if (Pet* pet = caster->GetPet()) + pet->RemoveAurasDueToSpell(SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET); } void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (GetCaster()) - if (Player* caster = GetCaster()->ToPlayer()) - if (caster->GetPet()) - caster->CastSpell(caster, SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET, true); + if (GetCaster()) + if (Player* caster = GetCaster()->ToPlayer()) + if (caster->GetPet()) + caster->CastSpell(caster, SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET, true); } - void OnPetApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void OnPetApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* pet = GetUnitOwner(); - if (Unit* owner = pet->GetOwner()) - if (owner->HasAura(SPELL_HUNTER_ASPECT_OF_THE_BEAST)) - return; + Unit* pet = GetUnitOwner(); + if (Unit* owner = pet->GetOwner()) + if (owner->HasAura(SPELL_HUNTER_ASPECT_OF_THE_BEAST)) + return; - SetDuration(0); + SetDuration(0); } void Register() { - if (m_scriptSpellId == 13161) - { - AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_hun_aspect_of_the_beast_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); - } - else - AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnPetApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); + if (m_scriptSpellId == 13161) + { + AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_hun_aspect_of_the_beast_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); + } + else + AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnPetApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); } }; @@ -409,12 +409,12 @@ class spell_hun_ascpect_of_the_viper : public SpellScriptLoader return true; } - bool CheckProc(ProcEventInfo& procInfo) + bool CheckProc(ProcEventInfo& procInfo) { SpellInfo const* spellInfo = procInfo.GetDamageInfo()->GetSpellInfo(); - // Xinef: cannot proc from volley damage - if (spellInfo && (spellInfo->SpellFamilyFlags[0] & 0x2000) && spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) - return false; + // Xinef: cannot proc from volley damage + if (spellInfo && (spellInfo->SpellFamilyFlags[0] & 0x2000) && spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) + return false; return true; } @@ -521,21 +521,21 @@ class spell_hun_chimera_shot : public SpellScriptLoader } // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute. else if (familyFlag[0] & 0x00008000) - { - if (caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown - { - if (caster->ToPlayer()->HasSpellCooldown(SPELL_HUNTER_CHIMERA_SHOT_SCORPID)) - break; + { + if (caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown + { + if (caster->ToPlayer()->HasSpellCooldown(SPELL_HUNTER_CHIMERA_SHOT_SCORPID)) + break; - caster->ToPlayer()->AddSpellCooldown(SPELL_HUNTER_CHIMERA_SHOT_SCORPID, 0, 60000); - } + caster->ToPlayer()->AddSpellCooldown(SPELL_HUNTER_CHIMERA_SHOT_SCORPID, 0, 60000); + } spellId = SPELL_HUNTER_CHIMERA_SHOT_SCORPID; - } + } // Refresh aura duration aura->RefreshDuration(); - aurEff->ChangeAmount(aurEff->CalculateAmount(caster), false); + aurEff->ChangeAmount(aurEff->CalculateAmount(caster), false); } break; } @@ -736,26 +736,26 @@ class spell_hun_readiness : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - Player* caster = GetCaster()->ToPlayer(); - // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath + Player* caster = GetCaster()->ToPlayer(); + // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath - PlayerSpellMap const& spellMap = caster->GetSpellMap(); - for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && - spellInfo->Id != SPELL_HUNTER_READINESS && - spellInfo->Id != SPELL_HUNTER_BESTIAL_WRATH && - spellInfo->Id != SPELL_DRAENEI_GIFT_OF_THE_NAARU && - spellInfo->GetRecoveryTime() > 0) - { - SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id); - if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient) - caster->RemoveSpellCooldown(spellInfo->Id, true); - else - caster->RemoveSpellCooldown(spellInfo->Id, false); - } - } + PlayerSpellMap const& spellMap = caster->GetSpellMap(); + for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr) + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); + if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && + spellInfo->Id != SPELL_HUNTER_READINESS && + spellInfo->Id != SPELL_HUNTER_BESTIAL_WRATH && + spellInfo->Id != SPELL_DRAENEI_GIFT_OF_THE_NAARU && + spellInfo->GetRecoveryTime() > 0) + { + SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id); + if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient) + caster->RemoveSpellCooldown(spellInfo->Id, true); + else + caster->RemoveSpellCooldown(spellInfo->Id, false); + } + } } void Register() @@ -844,7 +844,7 @@ class spell_hun_sniper_training : public SpellScriptLoader if (Player* playerTarget = GetUnitOwner()->ToPlayer()) { int32 baseAmount = aurEff->GetBaseAmount(); - int32 amount = playerTarget->isMoving() || aurEff->GetAmount() <= 0 ? + int32 amount = playerTarget->isMoving() || aurEff->GetAmount() <= 0 ? playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) : aurEff->GetAmount() - 1; aurEff->SetAmount(amount); @@ -888,13 +888,13 @@ class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader return true; } - SpellCastResult CheckCast() + SpellCastResult CheckCast() { Unit* caster = GetCaster(); if (caster->IsAlive()) return SPELL_FAILED_TARGET_NOT_DEAD; if (caster->HasAura(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) - return SPELL_FAILED_CASTER_AURASTATE; + return SPELL_FAILED_CASTER_AURASTATE; return SPELL_CAST_OK; } @@ -1182,14 +1182,14 @@ class spell_hun_viper_attack_speed : public SpellScriptLoader void AddSC_hunter_spell_scripts() { - // Ours - new spell_hun_check_pet_los(); - new spell_hun_cower(); - new spell_hun_wyvern_sting(); - new spell_hun_animal_handler(); - new spell_hun_generic_scaling(); + // Ours + new spell_hun_check_pet_los(); + new spell_hun_cower(); + new spell_hun_wyvern_sting(); + new spell_hun_animal_handler(); + new spell_hun_generic_scaling(); - // Theirs + // Theirs new spell_hun_aspect_of_the_beast(); new spell_hun_ascpect_of_the_viper(); new spell_hun_chimera_shot(); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 1532ac7f3..17bfd1103 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -44,7 +44,7 @@ class spell_item_massive_seaforium_charge : public SpellScriptLoader return; Player* target = GetHitUnit()->ToPlayer(); - target->DestroyItemCount(39213, 1, true); + target->DestroyItemCount(39213, 1, true); } void Register() @@ -75,12 +75,12 @@ class spell_item_titanium_seal_of_dalaran : public SpellScriptLoader Unit* caster = GetCaster(); if (Player* player = caster->ToPlayer()) { - std::string name = player->GetName(); - player->TextEmote("casually flips his Titanium Seal of Dalaran"); - if (urand(0,1)) - player->TextEmote("finds the coin face down for tails!"); - else - player->TextEmote("catches the coin heads up!"); + std::string name = player->GetName(); + player->TextEmote("casually flips his Titanium Seal of Dalaran"); + if (urand(0,1)) + player->TextEmote("finds the coin face down for tails!"); + else + player->TextEmote("catches the coin heads up!"); } } @@ -98,11 +98,11 @@ class spell_item_titanium_seal_of_dalaran : public SpellScriptLoader enum AmplifyDish { - SPELL_AMPLIFY_30S = 13180, - SPELL_AMPLIFY_10S = 67799, - SPELL_MENTAL_BATTLE = 67810, - SPELL_AMPLIFY_CHARM_30S = 13181, - SPELL_AMPLIFY_CHARM_10S = 26740, + SPELL_AMPLIFY_30S = 13180, + SPELL_AMPLIFY_10S = 67799, + SPELL_MENTAL_BATTLE = 67810, + SPELL_AMPLIFY_CHARM_30S = 13181, + SPELL_AMPLIFY_CHARM_10S = 26740, }; class spell_item_mind_amplify_dish : public SpellScriptLoader @@ -120,25 +120,25 @@ class spell_item_mind_amplify_dish : public SpellScriptLoader Unit* caster = GetCaster(); if (Player* player = caster->ToPlayer()) - { - if (Unit *target = GetHitUnit()) - { - // little protection - if (target->ToCreature()) - if (target->ToCreature()->GetCreatureTemplate()->rank > CREATURE_ELITE_NORMAL) - return; + { + if (Unit *target = GetHitUnit()) + { + // little protection + if (target->ToCreature()) + if (target->ToCreature()->GetCreatureTemplate()->rank > CREATURE_ELITE_NORMAL) + return; - if (GetSpellInfo()->Id != SPELL_AMPLIFY_10S) - if (target->getLevel() > 60) - return; + if (GetSpellInfo()->Id != SPELL_AMPLIFY_10S) + if (target->getLevel() > 60) + return; - uint8 pct = std::max(0, 20+player->getLevel()-target->getLevel()); - if (roll_chance_i(pct)) - player->CastSpell(target, SPELL_MENTAL_BATTLE, true); - else if (roll_chance_i(pct)) - player->CastSpell(target, GetSpellInfo()->Id == SPELL_AMPLIFY_10S ? SPELL_AMPLIFY_CHARM_10S : SPELL_AMPLIFY_CHARM_30S, true); - } - } + uint8 pct = std::max(0, 20+player->getLevel()-target->getLevel()); + if (roll_chance_i(pct)) + player->CastSpell(target, SPELL_MENTAL_BATTLE, true); + else if (roll_chance_i(pct)) + player->CastSpell(target, GetSpellInfo()->Id == SPELL_AMPLIFY_10S ? SPELL_AMPLIFY_CHARM_10S : SPELL_AMPLIFY_CHARM_30S, true); + } + } } void Register() @@ -168,10 +168,10 @@ class spell_item_runescroll_of_fortitude : public SpellScriptLoader if (Unit* target = GetHitUnit()) { - if (target->getLevel() < 70) - return; + if (target->getLevel() < 70) + return; - target->CastSpell(target, 72590, true); // Stamina spell (Fortitude) + target->CastSpell(target, 72590, true); // Stamina spell (Fortitude) } } @@ -202,8 +202,8 @@ class spell_item_branns_communicator : public SpellScriptLoader if (Player* target = GetHitPlayer()) { - target->KilledMonsterCredit(29579, 0); // Brann's entry - target->CastSpell(target, 55038, true); // Brann summoning spell + target->KilledMonsterCredit(29579, 0); // Brann's entry + target->CastSpell(target, 55038, true); // Brann summoning spell } } @@ -236,10 +236,10 @@ public: void Update(AuraEffect* effect) { - PreventDefaultAction(); - effect->SetPeriodicTimer(urand(10*IN_MILLISECONDS, 40*IN_MILLISECONDS)); - if (Unit* owner = GetUnitOwner()) - owner->CastSpell(owner, 42755 /*Goblin Gumbo Trigger*/, true); + PreventDefaultAction(); + effect->SetPeriodicTimer(urand(10*IN_MILLISECONDS, 40*IN_MILLISECONDS)); + if (Unit* owner = GetUnitOwner()) + owner->CastSpell(owner, 42755 /*Goblin Gumbo Trigger*/, true); } void Register() @@ -257,7 +257,7 @@ public: enum mithrilSpurs { - SPELL_MITHRIL_SPEED = 59916, + SPELL_MITHRIL_SPEED = 59916, }; class spell_item_mithril_spurs : public SpellScriptLoader @@ -273,10 +273,10 @@ public: { Unit* target = GetTarget(); if (target->getLevel() <= 70) - target->AddAura(SPELL_MITHRIL_SPEED, target); + target->AddAura(SPELL_MITHRIL_SPEED, target); } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); target->RemoveAurasDueToSpell(SPELL_MITHRIL_SPEED); @@ -285,7 +285,7 @@ public: void Register() { OnEffectApply += AuraEffectApplyFn(spell_item_mithril_spurs_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_item_mithril_spurs_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_item_mithril_spurs_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -308,11 +308,11 @@ public: { Unit* target = GetTarget(); if (target->getLevel() >= 30) - { - uint8 chance = 100 - std::min(100, target->getLevel() - 30 * urand(3, 10)); - if (!roll_chance_i(chance)) - PreventDefaultAction(); - } + { + uint8 chance = 100 - std::min(100, target->getLevel() - 30 * urand(3, 10)); + if (!roll_chance_i(chance)) + PreventDefaultAction(); + } } void Register() @@ -340,7 +340,7 @@ class spell_item_toy_train_set : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); if (Unit* target = GetHitUnit()) - target->HandleEmoteCommand(EMOTE_ONESHOT_TRAIN); + target->HandleEmoteCommand(EMOTE_ONESHOT_TRAIN); } void Register() @@ -357,7 +357,7 @@ class spell_item_toy_train_set : public SpellScriptLoader enum eChicken { - SPELL_ROCKET_CHICKEN_EMOTE = 45255, + SPELL_ROCKET_CHICKEN_EMOTE = 45255, }; class spell_item_rocket_chicken : public SpellScriptLoader @@ -371,13 +371,13 @@ public: void HandleDummyTick(AuraEffect const* /*aurEff*/) { - if (roll_chance_i(5)) - { - GetTarget()->ToCreature()->DespawnOrUnsummon(8000); - GetTarget()->Kill(GetTarget(), GetTarget()); - } - else if (roll_chance_i(50)) - GetTarget()->CastSpell(GetTarget(), SPELL_ROCKET_CHICKEN_EMOTE, false); + if (roll_chance_i(5)) + { + GetTarget()->ToCreature()->DespawnOrUnsummon(8000); + GetTarget()->Kill(GetTarget(), GetTarget()); + } + else if (roll_chance_i(50)) + GetTarget()->CastSpell(GetTarget(), SPELL_ROCKET_CHICKEN_EMOTE, false); } void Register() @@ -403,18 +403,18 @@ class spell_item_sleepy_willy : public SpellScriptLoader void SelectTarget(std::list& targets) { - Creature* target = NULL; - for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) - if (Creature* creature = (*itr)->ToCreature()) - if (creature->IsCritter()) - { - target = creature; - break; - } + Creature* target = NULL; + for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + if (Creature* creature = (*itr)->ToCreature()) + if (creature->IsCritter()) + { + target = creature; + break; + } - targets.clear(); - if (target) - targets.push_back(target); + targets.clear(); + if (target) + targets.push_back(target); } void HandleScriptEffect(SpellEffIndex effIndex) @@ -430,7 +430,7 @@ class spell_item_sleepy_willy : public SpellScriptLoader void Register() { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_item_sleepy_willy_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); - OnEffectHitTarget += SpellEffectFn(spell_item_sleepy_willy_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_item_sleepy_willy_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -451,15 +451,15 @@ class spell_item_lil_phylactery : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetActionTarget() && (eventInfo.GetActionTarget()->GetTypeId() != TYPEID_UNIT || eventInfo.GetActionTarget()->ToCreature()->isWorldBoss()); + return eventInfo.GetActionTarget() && (eventInfo.GetActionTarget()->GetTypeId() != TYPEID_UNIT || eventInfo.GetActionTarget()->ToCreature()->isWorldBoss()); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - if (Unit* critter = ObjectAccessor::GetUnit(*GetUnitOwner(), GetUnitOwner()->GetCritterGUID())) - GetUnitOwner()->CastSpell(critter, 69731 /*SPELL_LICH_PET_AURA_ON_KILL*/, true); + if (Unit* critter = ObjectAccessor::GetUnit(*GetUnitOwner(), GetUnitOwner()->GetCritterGUID())) + GetUnitOwner()->CastSpell(critter, 69731 /*SPELL_LICH_PET_AURA_ON_KILL*/, true); } void Register() @@ -486,31 +486,31 @@ public: void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (GetTarget() == GetCaster()) - if (Aura* aur = GetTarget()->AddAura(45044 /*Limitless Power*/, GetTarget())) - aur->SetDuration(GetDuration()); + if (GetTarget() == GetCaster()) + if (Aura* aur = GetTarget()->AddAura(45044 /*Limitless Power*/, GetTarget())) + aur->SetDuration(GetDuration()); } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Aura* aur = GetTarget()->GetAura(45044 /*Limitless Power*/, GetTarget()->GetGUID())) - aur->SetDuration(0); + if (Aura* aur = GetTarget()->GetAura(45044 /*Limitless Power*/, GetTarget()->GetGUID())) + aur->SetDuration(0); } - void OnBaseRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void OnBaseRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetUnitOwner()->RemoveDynObject(45043); + GetUnitOwner()->RemoveDynObject(45043); } void Register() { - if (m_scriptSpellId == 45043) - { - OnEffectApply += AuraEffectApplyFn(spell_item_shifting_naaru_silver_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_item_shifting_naaru_silver_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - else - AfterEffectRemove += AuraEffectRemoveFn(spell_item_shifting_naaru_silver_AuraScript::OnBaseRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + if (m_scriptSpellId == 45043) + { + OnEffectApply += AuraEffectApplyFn(spell_item_shifting_naaru_silver_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_item_shifting_naaru_silver_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + else + AfterEffectRemove += AuraEffectRemoveFn(spell_item_shifting_naaru_silver_AuraScript::OnBaseRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -529,28 +529,28 @@ class spell_item_toxic_wasteling : public SpellScriptLoader { PrepareSpellScript(spell_item_toxic_wasteling_SpellScript); - void HandleJump(SpellEffIndex effIndex) + void HandleJump(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - if (Creature* target = GetHitCreature()) - { - GetCaster()->GetMotionMaster()->Clear(false); - GetCaster()->GetMotionMaster()->MoveIdle(); - GetCaster()->ToCreature()->SetHomePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f); - GetCaster()->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 12.0f, 3.0f, 1); - target->DespawnOrUnsummon(1500); - } + if (Creature* target = GetHitCreature()) + { + GetCaster()->GetMotionMaster()->Clear(false); + GetCaster()->GetMotionMaster()->MoveIdle(); + GetCaster()->ToCreature()->SetHomePosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f); + GetCaster()->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 12.0f, 3.0f, 1); + target->DespawnOrUnsummon(1500); + } } void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); + PreventHitDefaultEffect(effIndex); } void Register() { - OnEffectLaunchTarget += SpellEffectFn(spell_item_toxic_wasteling_SpellScript::HandleJump, EFFECT_0, SPELL_EFFECT_JUMP); - OnEffectHitTarget += SpellEffectFn(spell_item_toxic_wasteling_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectLaunchTarget += SpellEffectFn(spell_item_toxic_wasteling_SpellScript::HandleJump, EFFECT_0, SPELL_EFFECT_JUMP); + OnEffectHitTarget += SpellEffectFn(spell_item_toxic_wasteling_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -578,23 +578,23 @@ class spell_item_lil_xt : public SpellScriptLoader GetCaster()->CastSpell(target, GetEffectValue(), false); } - void HandleDummy(SpellEffIndex effIndex) + void HandleDummy(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); Creature* target = GetHitCreature(); if (!target) return; - if (GetCaster()->GetTypeId() == TYPEID_UNIT && GetCaster()->ToCreature()->AI()) - GetCaster()->ToCreature()->AI()->Talk(2); + if (GetCaster()->GetTypeId() == TYPEID_UNIT && GetCaster()->ToCreature()->AI()) + GetCaster()->ToCreature()->AI()->Talk(2); target->DespawnOrUnsummon(500); } void Register() { - if (m_scriptSpellId == 76098) - OnEffectHitTarget += SpellEffectFn(spell_item_lil_xt_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - else - OnEffectHitTarget += SpellEffectFn(spell_item_lil_xt_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + if (m_scriptSpellId == 76098) + OnEffectHitTarget += SpellEffectFn(spell_item_lil_xt_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + else + OnEffectHitTarget += SpellEffectFn(spell_item_lil_xt_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -613,18 +613,18 @@ class spell_item_essence_of_life : public SpellScriptLoader { PrepareAuraScript(spell_item_essence_of_life_AuraScript); - bool CheckProc(ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); - if (!spellInfo || !spellInfo->HasEffect(SPELL_EFFECT_HEAL)) - return false; + SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); + if (!spellInfo || !spellInfo->HasEffect(SPELL_EFFECT_HEAL)) + return false; - return spellInfo->ManaCost > 0 || spellInfo->ManaCostPercentage > 0 || (spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && spellInfo->SpellIconID == 156); + return spellInfo->ManaCost > 0 || spellInfo->ManaCostPercentage > 0 || (spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && spellInfo->SpellIconID == 156); } void Register() { - DoCheckProc += AuraCheckProcFn(spell_item_essence_of_life_AuraScript::CheckProc); + DoCheckProc += AuraCheckProcFn(spell_item_essence_of_life_AuraScript::CheckProc); } }; @@ -636,11 +636,11 @@ class spell_item_essence_of_life : public SpellScriptLoader const uint32 crazyAlchemistTable[5] = { - 53909, // Wild Magic - 53908, // Potion of Speed - 53762, // Indestructible Potion - 43185, // Runic Healing Potion - 43186 // Runic Mana Potion + 53909, // Wild Magic + 53908, // Potion of Speed + 53762, // Indestructible Potion + 43185, // Runic Healing Potion + 43186 // Runic Mana Potion }; class spell_item_crazy_alchemists_potion : public SpellScriptLoader @@ -654,14 +654,14 @@ class spell_item_crazy_alchemists_potion : public SpellScriptLoader void HandleHeal(SpellEffIndex /*effIndex*/) { - // Xinef: 20% to get additional effect, guessed + // Xinef: 20% to get additional effect, guessed if (roll_chance_i(20)) - GetCaster()->CastSpell(GetCaster(), crazyAlchemistTable[urand(0, (GetCaster()->getPowerType() == POWER_MANA ? 4 : 3))], true); + GetCaster()->CastSpell(GetCaster(), crazyAlchemistTable[urand(0, (GetCaster()->getPowerType() == POWER_MANA ? 4 : 3))], true); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_item_crazy_alchemists_potion_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + OnEffectHitTarget += SpellEffectFn(spell_item_crazy_alchemists_potion_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); } }; @@ -688,7 +688,7 @@ class spell_item_skull_of_impeding_doom : public SpellScriptLoader amount = GetCaster()->GetMaxHealth()*0.12f; // 5 ticks which reduce health by 60% } - void CalculateManaLeechAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + void CalculateManaLeechAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { if (!GetCaster() || GetCaster()->getPowerType() != POWER_MANA) return; @@ -699,7 +699,7 @@ class spell_item_skull_of_impeding_doom : public SpellScriptLoader void Register() { DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_skull_of_impeding_doom_AuraScript::CalculateDamageAmount, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_skull_of_impeding_doom_AuraScript::CalculateManaLeechAmount, EFFECT_2, SPELL_AURA_PERIODIC_MANA_LEECH); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_skull_of_impeding_doom_AuraScript::CalculateManaLeechAmount, EFFECT_2, SPELL_AURA_PERIODIC_MANA_LEECH); } }; @@ -720,22 +720,22 @@ public: void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - PreventDefaultAction(); - if (GetTarget()->getLevel() > 70) - return; - GetTarget()->CastSpell(GetTarget(), 48402, true); + PreventDefaultAction(); + if (GetTarget()->getLevel() > 70) + return; + GetTarget()->CastSpell(GetTarget(), 48402, true); } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - PreventDefaultAction(); - GetTarget()->RemoveAurasDueToSpell(48402); + PreventDefaultAction(); + GetTarget()->RemoveAurasDueToSpell(48402); } void Register() { OnEffectApply += AuraEffectApplyFn(spell_item_carrot_on_a_stick_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_item_carrot_on_a_stick_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_item_carrot_on_a_stick_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -754,20 +754,20 @@ class spell_item_fish_feast : public SpellScriptLoader { PrepareSpellScript(spell_item_fish_feast_SpellScript); - bool Load() - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } void HandleScriptEffect(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - GetCaster()->ToPlayer()->TextEmote("prepares a Fish Feast!"); + PreventHitDefaultEffect(effIndex); + GetCaster()->ToPlayer()->TextEmote("prepares a Fish Feast!"); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_item_fish_feast_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_item_fish_feast_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -788,24 +788,24 @@ class spell_item_gnomish_universal_remote : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - Unit* target = GetHitUnit(); - if (!target) - return; + Unit* target = GetHitUnit(); + if (!target) + return; - uint32 spellId = 0; - switch (urand(0,2)) - { - case 0: spellId = 8345; break; // charm - case 1: spellId = 8346; break; // root - case 2: spellId = 8347; break; // threat - } - if (spellId) - GetCaster()->CastSpell(target, spellId, true); + uint32 spellId = 0; + switch (urand(0,2)) + { + case 0: spellId = 8345; break; // charm + case 1: spellId = 8346; break; // root + case 2: spellId = 8347; break; // threat + } + if (spellId) + GetCaster()->CastSpell(target, spellId, true); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_item_gnomish_universal_remote_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_item_gnomish_universal_remote_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -826,28 +826,28 @@ class spell_item_strong_anti_venom : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - { - std::list removeList; - Unit::AuraMap const& auras = target->GetOwnedAuras(); - for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - { - Aura* aura = itr->second; - if (aura->GetSpellInfo()->SpellLevel > 35 || aura->GetSpellInfo()->Dispel != DISPEL_POISON) - continue; + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + { + std::list removeList; + Unit::AuraMap const& auras = target->GetOwnedAuras(); + for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { + Aura* aura = itr->second; + if (aura->GetSpellInfo()->SpellLevel > 35 || aura->GetSpellInfo()->Dispel != DISPEL_POISON) + continue; - removeList.push_back(aura->GetId()); - } + removeList.push_back(aura->GetId()); + } - for (std::list::const_iterator itr = removeList.begin(); itr != removeList.end(); ++itr) - target->RemoveAurasDueToSpell(*itr); - } + for (std::list::const_iterator itr = removeList.begin(); itr != removeList.end(); ++itr) + target->RemoveAurasDueToSpell(*itr); + } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_item_strong_anti_venom_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_item_strong_anti_venom_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -910,8 +910,8 @@ class spell_item_goblin_weather_machine : public SpellScriptLoader if (Unit* target = GetHitUnit()) { uint32 spellId = 46736; - if (uint8 add = urand(0, 3)) - spellId += add+1; + if (uint8 add = urand(0, 3)) + spellId += add+1; target->CastSpell(target, spellId, true); } @@ -919,8 +919,8 @@ class spell_item_goblin_weather_machine : public SpellScriptLoader void Register() { - if (m_scriptSpellId == 46203) - OnEffectHitTarget += SpellEffectFn(spell_item_goblin_weather_machine_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + if (m_scriptSpellId == 46203) + OnEffectHitTarget += SpellEffectFn(spell_item_goblin_weather_machine_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -929,26 +929,26 @@ class spell_item_goblin_weather_machine : public SpellScriptLoader return new spell_item_goblin_weather_machine_SpellScript(); } - class spell_item_goblin_weather_machine_AuraScript : public AuraScript + class spell_item_goblin_weather_machine_AuraScript : public AuraScript { PrepareAuraScript(spell_item_goblin_weather_machine_AuraScript); void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (roll_chance_i(50)) - return; + if (roll_chance_i(50)) + return; uint32 spellId = 46736; - if (uint8 add = urand(0, 3)) - spellId += add+1; + if (uint8 add = urand(0, 3)) + spellId += add+1; GetUnitOwner()->CastSpell(GetUnitOwner(), spellId, true); } void Register() { - if (m_scriptSpellId != 46203) - AfterEffectRemove += AuraEffectRemoveFn(spell_item_goblin_weather_machine_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + if (m_scriptSpellId != 46203) + AfterEffectRemove += AuraEffectRemoveFn(spell_item_goblin_weather_machine_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -969,9 +969,9 @@ class spell_item_light_lamp : public SpellScriptLoader void HandleActivateObject(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (GameObject* go = GetHitGObj()) - go->UseDoorOrButton(); + PreventHitDefaultEffect(effIndex); + if (GameObject* go = GetHitGObj()) + go->UseDoorOrButton(); } void Register() @@ -997,21 +997,21 @@ class spell_item_fetch_ball : public SpellScriptLoader void SelectTarget(std::list& targets) { - Creature* target = NULL; - for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) - if (Creature* creature = (*itr)->ToCreature()) - { - if (creature->GetOwnerGUID() == GetCaster()->GetOwnerGUID() && !creature->IsNonMeleeSpellCast(false) && - creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) - { - target = creature; - break; - } - } + Creature* target = NULL; + for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + if (Creature* creature = (*itr)->ToCreature()) + { + if (creature->GetOwnerGUID() == GetCaster()->GetOwnerGUID() && !creature->IsNonMeleeSpellCast(false) && + creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) + { + target = creature; + break; + } + } - targets.clear(); - if (target) - targets.push_back(target); + targets.clear(); + if (target) + targets.push_back(target); } void Register() @@ -1028,10 +1028,10 @@ class spell_item_fetch_ball : public SpellScriptLoader enum oracleAblutions { - SPELL_ABLUTION_RUNIC = 59812, - SPELL_ABLUTION_MANA = 59813, - SPELL_ABLUTION_RAGE = 59814, - SPELL_ABLUTION_ENERGY = 59815, + SPELL_ABLUTION_RUNIC = 59812, + SPELL_ABLUTION_MANA = 59813, + SPELL_ABLUTION_RAGE = 59814, + SPELL_ABLUTION_ENERGY = 59815, }; class spell_item_oracle_ablutions : public SpellScriptLoader @@ -1047,32 +1047,32 @@ class spell_item_oracle_ablutions : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); - switch (caster->getPowerType()) - { - case POWER_RUNIC_POWER: - caster->CastSpell(caster, SPELL_ABLUTION_RUNIC, true); - break; - case POWER_MANA: - { - int32 mana = CalculatePct(caster->GetMaxPower(POWER_MANA), 5.0f); - caster->CastCustomSpell(SPELL_ABLUTION_MANA, SPELLVALUE_BASE_POINT0, mana, caster, true); - break; - } - case POWER_RAGE: - caster->CastSpell(caster, SPELL_ABLUTION_RAGE, true); - break; - case POWER_ENERGY: - caster->CastSpell(caster, SPELL_ABLUTION_ENERGY, true); - break; - } + switch (caster->getPowerType()) + { + case POWER_RUNIC_POWER: + caster->CastSpell(caster, SPELL_ABLUTION_RUNIC, true); + break; + case POWER_MANA: + { + int32 mana = CalculatePct(caster->GetMaxPower(POWER_MANA), 5.0f); + caster->CastCustomSpell(SPELL_ABLUTION_MANA, SPELLVALUE_BASE_POINT0, mana, caster, true); + break; + } + case POWER_RAGE: + caster->CastSpell(caster, SPELL_ABLUTION_RAGE, true); + break; + case POWER_ENERGY: + caster->CastSpell(caster, SPELL_ABLUTION_ENERGY, true); + break; + } if (Player* player = caster->ToPlayer()) { - std::string name = player->GetName(); - player->TextEmote("casually flips his Titanium Seal of Dalaran"); - if (urand(0,1)) - player->TextEmote("finds the coin face down for tails!"); - else - player->TextEmote("catches the coin heads up!"); + std::string name = player->GetName(); + player->TextEmote("casually flips his Titanium Seal of Dalaran"); + if (urand(0,1)) + player->TextEmote("finds the coin face down for tails!"); + else + player->TextEmote("catches the coin heads up!"); } } @@ -1099,13 +1099,13 @@ class spell_item_trauma : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetActionTarget(); + return eventInfo.GetActionTarget(); } void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetUnitOwner()->CastSpell(eventInfo.GetActionTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true); + GetUnitOwner()->CastSpell(eventInfo.GetActionTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true); } void Register() @@ -1133,9 +1133,9 @@ class spell_item_blade_ward_enchant : public SpellScriptLoader void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { PreventDefaultAction(); - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(64442 /*SPELL_BLADE_WARDING*/); - int32 basepoints = spellInfo->Effects[EFFECT_0].CalcValue() * this->GetStackAmount(); - eventInfo.GetActionTarget()->CastCustomSpell(spellInfo->Id, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActor(), true); + const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(64442 /*SPELL_BLADE_WARDING*/); + int32 basepoints = spellInfo->Effects[EFFECT_0].CalcValue() * this->GetStackAmount(); + eventInfo.GetActionTarget()->CastCustomSpell(spellInfo->Id, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActor(), true); } void Register() @@ -1162,13 +1162,13 @@ class spell_item_blood_draining_enchant : public SpellScriptLoader void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { PreventDefaultAction(); - if ((eventInfo.GetActionTarget()->GetHealth() - eventInfo.GetDamageInfo()->GetDamage()) >= eventInfo.GetActionTarget()->CountPctFromMaxHealth(35)) - return; + if ((eventInfo.GetActionTarget()->GetHealth() - eventInfo.GetDamageInfo()->GetDamage()) >= eventInfo.GetActionTarget()->CountPctFromMaxHealth(35)) + return; - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(64569 /*SPELL_BLOOD_RESERVE*/); - int32 basepoints = spellInfo->Effects[EFFECT_0].CalcValue() * this->GetStackAmount(); - eventInfo.GetActionTarget()->CastCustomSpell(spellInfo->Id, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActionTarget(), true); - eventInfo.GetActionTarget()->RemoveAurasDueToSpell(GetSpellInfo()->Id); // Remove rest auras + const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(64569 /*SPELL_BLOOD_RESERVE*/); + int32 basepoints = spellInfo->Effects[EFFECT_0].CalcValue() * this->GetStackAmount(); + eventInfo.GetActionTarget()->CastCustomSpell(spellInfo->Id, SPELLVALUE_BASE_POINT0, basepoints, eventInfo.GetActionTarget(), true); + eventInfo.GetActionTarget()->RemoveAurasDueToSpell(GetSpellInfo()->Id); // Remove rest auras } void Register() @@ -1196,7 +1196,7 @@ class spell_item_dragon_kite_summon_lightning_bunny : public SpellScriptLoader { // Adjust effect summon position Position const offset = { 3.0f, 3.0f, 20.0f, 0.0f }; - dest.Relocate(*GetCaster()); + dest.Relocate(*GetCaster()); dest.RelocateOffset(offset); } @@ -1223,20 +1223,20 @@ public: void HandlePeriodicTick(AuraEffect const* /*aurEff*/) { - PreventDefaultAction(); - if (Unit* owner = GetTarget()->GetOwner()) - { - if (owner->isMoving()) - { - GetTarget()->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, GetTarget()->GetFollowAngle(), MOTION_SLOT_ACTIVE); - } - else - { - GetTarget()->CastSpell(GetTarget(), GetId()-1, true); - GetTarget()->GetMotionMaster()->Clear(false); - GetTarget()->GetMotionMaster()->MoveRandom(5.0f); - } - } + PreventDefaultAction(); + if (Unit* owner = GetTarget()->GetOwner()) + { + if (owner->isMoving()) + { + GetTarget()->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, GetTarget()->GetFollowAngle(), MOTION_SLOT_ACTIVE); + } + else + { + GetTarget()->CastSpell(GetTarget(), GetId()-1, true); + GetTarget()->GetMotionMaster()->Clear(false); + GetTarget()->GetMotionMaster()->MoveRandom(5.0f); + } + } } void Register() @@ -1262,15 +1262,15 @@ class spell_item_summon_or_dismiss : public SpellScriptLoader void HandleSummon(SpellEffIndex effIndex) { - for (Unit::ControlSet::iterator itr = GetCaster()->m_Controlled.begin(); itr != GetCaster()->m_Controlled.end(); ++itr) - { - if ((*itr)->GetEntry() == GetSpellInfo()->Effects[effIndex].MiscValue) - { - (*itr)->ToTempSummon()->UnSummon(); - PreventHitDefaultEffect(effIndex); - return; - } - } + for (Unit::ControlSet::iterator itr = GetCaster()->m_Controlled.begin(); itr != GetCaster()->m_Controlled.end(); ++itr) + { + if ((*itr)->GetEntry() == GetSpellInfo()->Effects[effIndex].MiscValue) + { + (*itr)->ToTempSummon()->UnSummon(); + PreventHitDefaultEffect(effIndex); + return; + } + } } void Register() @@ -1287,7 +1287,7 @@ class spell_item_summon_or_dismiss : public SpellScriptLoader enum eDreanicPaleAle { - SPELL_PINK_ELEKK = 49908 + SPELL_PINK_ELEKK = 49908 }; class spell_item_draenic_pale_ale : public SpellScriptLoader @@ -1301,26 +1301,26 @@ class spell_item_draenic_pale_ale : public SpellScriptLoader void HandleSummon(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (roll_chance_i(70)) - return; + PreventHitDefaultEffect(effIndex); + if (roll_chance_i(70)) + return; - GetCaster()->CastSpell(GetCaster(), SPELL_PINK_ELEKK, true); + GetCaster()->CastSpell(GetCaster(), SPELL_PINK_ELEKK, true); - float radius = GetSpellInfo()->Effects[effIndex].CalcRadius(); + float radius = GetSpellInfo()->Effects[effIndex].CalcRadius(); for (uint8 count = 0; count < GetEffectValue(); ++count) { Position pos = *GetCaster(); - GetCaster()->GetClosePoint(pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, radius, M_PI - 1.2f + 0.3f * urand(0, 8)); + GetCaster()->GetClosePoint(pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, radius, M_PI - 1.2f + 0.3f * urand(0, 8)); Creature* summon = GetCaster()->SummonCreature(GetSpellInfo()->Effects[effIndex].MiscValue, pos, TEMPSUMMON_TIMED_DESPAWN, GetSpellInfo()->GetDuration()); if (!summon) continue; summon->SetOwnerGUID(GetCaster()->GetGUID()); summon->setFaction(GetCaster()->getFaction()); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); - summon->SetReactState(REACT_PASSIVE); - summon->GetMotionMaster()->MoveFollow(GetCaster(), PET_FOLLOW_DIST, GetCaster()->GetAngle(summon), MOTION_SLOT_CONTROLLED); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + summon->SetReactState(REACT_PASSIVE); + summon->GetMotionMaster()->MoveFollow(GetCaster(), PET_FOLLOW_DIST, GetCaster()->GetAngle(summon), MOTION_SLOT_CONTROLLED); GetSpell()->ExecuteLogEffectSummonObject(effIndex, summon); } } @@ -1339,38 +1339,38 @@ class spell_item_draenic_pale_ale : public SpellScriptLoader enum eMoleMachine { - SPELL_MOLE_MACHINE_PORT_TO_GRIM_GUZZLER = 47523, + SPELL_MOLE_MACHINE_PORT_TO_GRIM_GUZZLER = 47523, }; class spell_item_direbrew_remote : public SpellScriptLoader { - public: - spell_item_direbrew_remote() : SpellScriptLoader("spell_item_direbrew_remote") { } + public: + spell_item_direbrew_remote() : SpellScriptLoader("spell_item_direbrew_remote") { } - class spell_item_direbrew_remote_AuraScript : public AuraScript - { - PrepareAuraScript(spell_item_direbrew_remote_AuraScript); + class spell_item_direbrew_remote_AuraScript : public AuraScript + { + PrepareAuraScript(spell_item_direbrew_remote_AuraScript); - void HandlePeriodicTick(AuraEffect const* aurEff) - { - PreventDefaultAction(); - if (aurEff->GetTickNumber() >= 2) - { - SetDuration(0); - GetTarget()->CastSpell(GetTarget(), SPELL_MOLE_MACHINE_PORT_TO_GRIM_GUZZLER, true); - } - } + void HandlePeriodicTick(AuraEffect const* aurEff) + { + PreventDefaultAction(); + if (aurEff->GetTickNumber() >= 2) + { + SetDuration(0); + GetTarget()->CastSpell(GetTarget(), SPELL_MOLE_MACHINE_PORT_TO_GRIM_GUZZLER, true); + } + } - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_direbrew_remote_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_direbrew_remote_AuraScript::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; - AuraScript* GetAuraScript() const - { - return new spell_item_direbrew_remote_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_item_direbrew_remote_AuraScript(); + } class spell_item_direbrew_remote_SpellScript : public SpellScript { @@ -1380,7 +1380,7 @@ class spell_item_direbrew_remote : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); if (Unit* target = GetHitUnit()) - target->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); + target->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); } void Register() @@ -1542,7 +1542,7 @@ class spell_item_blessing_of_ancient_kings : public SpellScriptLoader PreventDefaultAction(); int32 absorb = int32(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), 15.0f)); - // xinef: all heals contribute to one bubble + // xinef: all heals contribute to one bubble if (AuraEffect* protEff = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_PROTECTION_OF_ANCIENT_KINGS, 0/*, eventInfo.GetActor()->GetGUID()*/)) { // The shield can grow to a maximum size of 20,000 damage absorbtion @@ -2366,11 +2366,11 @@ class spell_item_unsated_craving : public SpellScriptLoader return true; } - // xinef: prevent default proc with castItem passed, which applies 30 sec cooldown to procing of the aura + // xinef: prevent default proc with castItem passed, which applies 30 sec cooldown to procing of the aura void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, TRIGGERED_FULL_MASK); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, TRIGGERED_FULL_MASK); } void Register() @@ -2454,28 +2454,28 @@ class spell_item_shadowmourne : public SpellScriptLoader if (GetTarget()->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) // cant collect shards while under effect of Chaos Bane buff return false; - // Xinef: Not on BG / Arena - if (!GetTarget()->FindMap() || GetTarget()->FindMap()->IsBattlegroundOrArena()) - return false; + // Xinef: Not on BG / Arena + if (!GetTarget()->FindMap() || GetTarget()->FindMap()->IsBattlegroundOrArena()) + return false; - if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo()) - if (!eventInfo.GetDamageInfo()->GetDamage()) - { - if (procSpell->SpellFamilyName == SPELLFAMILY_WARRIOR) - { - if (!procSpell->SpellFamilyFlags.HasFlag(0x2|0x20|0x4000, 0x0, 0x0)) - return false; - } - else if (procSpell->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT) - { - if (procSpell->Id != 55078 /*Blood Plague*/) - return false; - } - else - return false; - } + if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo()) + if (!eventInfo.GetDamageInfo()->GetDamage()) + { + if (procSpell->SpellFamilyName == SPELLFAMILY_WARRIOR) + { + if (!procSpell->SpellFamilyFlags.HasFlag(0x2|0x20|0x4000, 0x0, 0x0)) + return false; + } + else if (procSpell->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT) + { + if (procSpell->Id != 55078 /*Blood Plague*/) + return false; + } + else + return false; + } - return eventInfo.GetProcTarget() && eventInfo.GetActor() != eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); + return eventInfo.GetProcTarget() && eventInfo.GetActor() != eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -2669,10 +2669,10 @@ class spell_item_the_eye_of_diminution : public SpellScriptLoader // 59640 Underbelly Elixir enum UnderbellyElixirSpells { - SPELL_UNDERBELLY_ELIXIR_TRIGGERED1 = 59645, - SPELL_UNDERBELLY_ELIXIR_TRIGGERED2 = 59831, - SPELL_UNDERBELLY_ELIXIR_TRIGGERED3 = 59843, - AREA_UNDERBELLY = 4560, + SPELL_UNDERBELLY_ELIXIR_TRIGGERED1 = 59645, + SPELL_UNDERBELLY_ELIXIR_TRIGGERED2 = 59831, + SPELL_UNDERBELLY_ELIXIR_TRIGGERED3 = 59843, + AREA_UNDERBELLY = 4560, }; class spell_item_underbelly_elixir : public SpellScriptLoader @@ -2699,12 +2699,12 @@ class spell_item_underbelly_elixir : public SpellScriptLoader { Unit* caster = GetCaster(); uint32 spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED2; - switch (urand(1, (caster->GetPositionZ() < 637 ? 3 : 2))) + switch (urand(1, (caster->GetPositionZ() < 637 ? 3 : 2))) { case 1: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED1; break; case 2: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED3; break; } - caster->CastSpell(caster, spellId, true, GetCastItem(), NULL, caster->GetGUID()); + caster->CastSpell(caster, spellId, true, GetCastItem(), NULL, caster->GetGUID()); } void Register() @@ -3423,12 +3423,12 @@ class spell_item_impale_leviroth : public SpellScriptLoader { if (Creature* target = GetHitCreature()) if (target->GetEntry() == NPC_LEVIROTH && target->HealthAbovePct(94)) - { + { target->CastSpell(target, SPELL_LEVIROTH_SELF_IMPALE, true); - target->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 150); - target->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 200); - target->LowerPlayerDamageReq(target->GetMaxHealth()); - } + target->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 150); + target->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 200); + target->LowerPlayerDamageReq(target->GetMaxHealth()); + } } void Register() @@ -3894,44 +3894,44 @@ public: void AddSC_item_spell_scripts() { - // Ours - new spell_item_massive_seaforium_charge(); - new spell_item_titanium_seal_of_dalaran(); - new spell_item_mind_amplify_dish(); - new spell_item_runescroll_of_fortitude(); - new spell_item_branns_communicator(); - new spell_item_goblin_gumbo_kettle(); - new spell_item_mithril_spurs(); - new spell_item_magic_dust(); - new spell_item_toy_train_set(); - new spell_item_rocket_chicken(); - new spell_item_sleepy_willy(); - new spell_item_lil_phylactery(); - new spell_item_shifting_naaru_silver(); - new spell_item_toxic_wasteling(); - new spell_item_lil_xt(); - new spell_item_essence_of_life(); - new spell_item_crazy_alchemists_potion(); - new spell_item_skull_of_impeding_doom(); - new spell_item_carrot_on_a_stick(); - new spell_item_fish_feast(); - new spell_item_gnomish_universal_remote(); - new spell_item_strong_anti_venom(); - new spell_item_gnomish_shrink_ray(); - new spell_item_goblin_weather_machine(); - new spell_item_light_lamp(); - new spell_item_fetch_ball(); - new spell_item_oracle_ablutions(); - new spell_item_trauma(); - new spell_item_blade_ward_enchant(); - new spell_item_blood_draining_enchant(); - new spell_item_dragon_kite_summon_lightning_bunny(); - new spell_item_enchanted_broom_periodic(); - new spell_item_summon_or_dismiss(); - new spell_item_draenic_pale_ale(); - new spell_item_direbrew_remote(); + // Ours + new spell_item_massive_seaforium_charge(); + new spell_item_titanium_seal_of_dalaran(); + new spell_item_mind_amplify_dish(); + new spell_item_runescroll_of_fortitude(); + new spell_item_branns_communicator(); + new spell_item_goblin_gumbo_kettle(); + new spell_item_mithril_spurs(); + new spell_item_magic_dust(); + new spell_item_toy_train_set(); + new spell_item_rocket_chicken(); + new spell_item_sleepy_willy(); + new spell_item_lil_phylactery(); + new spell_item_shifting_naaru_silver(); + new spell_item_toxic_wasteling(); + new spell_item_lil_xt(); + new spell_item_essence_of_life(); + new spell_item_crazy_alchemists_potion(); + new spell_item_skull_of_impeding_doom(); + new spell_item_carrot_on_a_stick(); + new spell_item_fish_feast(); + new spell_item_gnomish_universal_remote(); + new spell_item_strong_anti_venom(); + new spell_item_gnomish_shrink_ray(); + new spell_item_goblin_weather_machine(); + new spell_item_light_lamp(); + new spell_item_fetch_ball(); + new spell_item_oracle_ablutions(); + new spell_item_trauma(); + new spell_item_blade_ward_enchant(); + new spell_item_blood_draining_enchant(); + new spell_item_dragon_kite_summon_lightning_bunny(); + new spell_item_enchanted_broom_periodic(); + new spell_item_summon_or_dismiss(); + new spell_item_draenic_pale_ale(); + new spell_item_direbrew_remote(); - // Theirs + // Theirs // 23074 Arcanite Dragonling new spell_item_trigger_spell("spell_item_arcanite_dragonling", SPELL_ARCANITE_DRAGONLING); // 23133 Gnomish Battle Chicken diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 738b3fbd3..2a6aeb28c 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -30,11 +30,11 @@ enum MageSpells { - // Ours + // Ours SPELL_MAGE_BURNOUT_TRIGGER = 44450, - SPELL_MAGE_IMPROVED_BLIZZARD_CHILLED = 12486, + SPELL_MAGE_IMPROVED_BLIZZARD_CHILLED = 12486, - // Theirs + // Theirs SPELL_MAGE_COLD_SNAP = 11958, SPELL_MAGE_FOCUS_MAGIC_PROC = 54648, SPELL_MAGE_FROST_WARDING_R1 = 11189, @@ -65,28 +65,28 @@ class spell_mage_arcane_blast : public SpellScriptLoader { PrepareSpellScript(spell_mage_arcane_blast_SpellScript); - bool Load() { _triggerSpellId = 0; return true; } + bool Load() { _triggerSpellId = 0; return true; } void HandleTriggerSpell(SpellEffIndex effIndex) { - _triggerSpellId = GetSpellInfo()->Effects[effIndex].TriggerSpell; - PreventHitDefaultEffect(effIndex); + _triggerSpellId = GetSpellInfo()->Effects[effIndex].TriggerSpell; + PreventHitDefaultEffect(effIndex); } - void HandleAfterCast() - { - GetCaster()->CastSpell(GetCaster(), _triggerSpellId, TRIGGERED_FULL_MASK); - } + void HandleAfterCast() + { + GetCaster()->CastSpell(GetCaster(), _triggerSpellId, TRIGGERED_FULL_MASK); + } void Register() { OnEffectLaunch += SpellEffectFn(spell_mage_arcane_blast_SpellScript::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL); - OnEffectLaunchTarget += SpellEffectFn(spell_mage_arcane_blast_SpellScript::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL); - AfterCast += SpellCastFn(spell_mage_arcane_blast_SpellScript::HandleAfterCast); + OnEffectLaunchTarget += SpellEffectFn(spell_mage_arcane_blast_SpellScript::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL); + AfterCast += SpellCastFn(spell_mage_arcane_blast_SpellScript::HandleAfterCast); } - private: - uint32 _triggerSpellId; + private: + uint32 _triggerSpellId; }; SpellScript* GetSpellScript() const @@ -106,11 +106,11 @@ class spell_mage_deep_freeze : public SpellScriptLoader void HandleOnHit() { - if (Unit* caster = GetCaster()) - if (Unit* target = (caster->ToPlayer() ? caster->ToPlayer()->GetSelectedUnit() : NULL)) - if (Creature* cTarget = target->ToCreature()) - if (cTarget->HasMechanicTemplateImmunity(1 << (MECHANIC_STUN - 1))) - caster->CastSpell(cTarget, 71757, true); + if (Unit* caster = GetCaster()) + if (Unit* target = (caster->ToPlayer() ? caster->ToPlayer()->GetSelectedUnit() : NULL)) + if (Creature* cTarget = target->ToCreature()) + if (cTarget->HasMechanicTemplateImmunity(1 << (MECHANIC_STUN - 1))) + caster->CastSpell(cTarget, 71757, true); } void Register() @@ -136,33 +136,33 @@ class spell_mage_burning_determination : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - if (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetActionTarget()) - return false; + if (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetActionTarget()) + return false; - // Need Interrupt or Silenced mechanic - if (!(eventInfo.GetDamageInfo()->GetSpellInfo()->GetAllEffectsMechanicMask() & ((1<GetSpellInfo()->GetAllEffectsMechanicMask() & ((1<RemoveAurasDueToSpell(54748); - return false; - } - if (Aura* aura = eventInfo.GetActionTarget()->GetAura(54748)) - { - if (aura->GetDuration() < aura->GetMaxDuration()) - eventInfo.GetActionTarget()->RemoveAurasDueToSpell(54748); - return false; - } + // Xinef: immuned effect should just eat charge + if (eventInfo.GetHitMask() & PROC_EX_IMMUNE) + { + eventInfo.GetActionTarget()->RemoveAurasDueToSpell(54748); + return false; + } + if (Aura* aura = eventInfo.GetActionTarget()->GetAura(54748)) + { + if (aura->GetDuration() < aura->GetMaxDuration()) + eventInfo.GetActionTarget()->RemoveAurasDueToSpell(54748); + return false; + } - return true; + return true; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetUnitOwner()->CastSpell(GetUnitOwner(), 54748, true); + GetUnitOwner()->CastSpell(GetUnitOwner(), 54748, true); } void Register() @@ -189,15 +189,15 @@ class spell_mage_molten_armor : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); - if (!spellInfo || (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK)) - return true; + const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); + if (!spellInfo || (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK)) + return true; - // Xinef: Molten Shields talent - if (AuraEffect* aurEff = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_MAGE, 16, EFFECT_0)) - return roll_chance_i(aurEff->GetSpellInfo()->GetRank()*50); + // Xinef: Molten Shields talent + if (AuraEffect* aurEff = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_MAGE, 16, EFFECT_0)) + return roll_chance_i(aurEff->GetSpellInfo()->GetRank()*50); - return false; + return false; } void Register() @@ -221,20 +221,20 @@ public: { PrepareAuraScript(spell_mage_mirror_image_AuraScript) - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - GetTarget()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + GetTarget()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); } - void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) + void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) { isPeriodic = false; } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_mage_mirror_image_AuraScript::HandleEffectApply, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_mirror_image_AuraScript::CalcPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY); + OnEffectApply += AuraEffectApplyFn(spell_mage_mirror_image_AuraScript::HandleEffectApply, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_mirror_image_AuraScript::CalcPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY); } }; @@ -299,12 +299,12 @@ class spell_mage_burnout_trigger : public SpellScriptLoader void HandleDummy(SpellEffIndex effIndex) { - PreventHitDefaultEffect(effIndex); - if (Unit* target = GetHitUnit()) - { - int32 newDamage = -(target->ModifyPower(POWER_MANA, -GetEffectValue())); - GetSpell()->ExecuteLogEffectTakeTargetPower(effIndex, target, POWER_MANA, newDamage, 0.0f); - } + PreventHitDefaultEffect(effIndex); + if (Unit* target = GetHitUnit()) + { + int32 newDamage = -(target->ModifyPower(POWER_MANA, -GetEffectValue())); + GetSpell()->ExecuteLogEffectTakeTargetPower(effIndex, target, POWER_MANA, newDamage, 0.0f); + } } void Register() @@ -330,108 +330,108 @@ class spell_mage_pet_scaling : public SpellScriptLoader void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: mage pet inherits 40% of resistance from owner and 35% of armor (guessed) - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; - amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); - } + // xinef: mage pet inherits 40% of resistance from owner and 35% of armor (guessed) + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; + amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); + } } void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: mage pet inherits 30% of intellect / stamina - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); - } + // xinef: mage pet inherits 30% of intellect / stamina + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); + } } - void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: mage pet inherits 0% AP + // xinef: mage pet inherits 0% AP } - void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: mage pet inherits 33% of SP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 frost = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST); - amount = CalculatePct(std::max(0, frost), 33); + // xinef: mage pet inherits 33% of SP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 frost = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST); + amount = CalculatePct(std::max(0, frost), 33); - // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); - } + // xinef: Update appropriate player field + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); + } } - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - if (GetUnitOwner()->IsPet()) - return; - - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); - else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); - } - - void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (!GetUnitOwner()->IsPet()) - return; + if (GetUnitOwner()->IsPet()) + return; + + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); + else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); + } + + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + { + if (!GetUnitOwner()->IsPet()) + return; isPeriodic = true; amplitude = 2*IN_MILLISECONDS; } - + void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) - { - int32 currentAmount = aurEff->GetAmount(); - int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); - if (newAmount != currentAmount) - { - if (aurEff->GetMiscValue() == STAT_STAMINA) - { - uint32 actStat = GetUnitOwner()->GetHealth(); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); - } - else - { - uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); - } - } - } - else - GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) + { + int32 currentAmount = aurEff->GetAmount(); + int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); + if (newAmount != currentAmount) + { + if (aurEff->GetMiscValue() == STAT_STAMINA) + { + uint32 actStat = GetUnitOwner()->GetHealth(); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); + } + else + { + uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); + } + } + } + else + GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); } void Register() { - if (m_scriptSpellId != 35657) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); + if (m_scriptSpellId != 35657) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); - if (m_scriptSpellId == 35657 || m_scriptSpellId == 35658) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); + if (m_scriptSpellId == 35657 || m_scriptSpellId == 35658) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); - if (m_scriptSpellId == 35657) - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); - } + if (m_scriptSpellId == 35657) + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); + } - OnEffectApply += AuraEffectApplyFn(spell_mage_pet_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_pet_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); + OnEffectApply += AuraEffectApplyFn(spell_mage_pet_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_pet_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); OnEffectPeriodic += AuraEffectPeriodicFn(spell_mage_pet_scaling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY); } }; @@ -453,15 +453,15 @@ class spell_mage_brain_freeze : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); - if (!spellInfo) - return false; + const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); + if (!spellInfo) + return false; - // xinef: Improved Blizzard, generic chilled check - if (spellInfo->SpellFamilyFlags[0] & 0x100000) - return spellInfo->Id == SPELL_MAGE_IMPROVED_BLIZZARD_CHILLED; + // xinef: Improved Blizzard, generic chilled check + if (spellInfo->SpellFamilyFlags[0] & 0x100000) + return spellInfo->Id == SPELL_MAGE_IMPROVED_BLIZZARD_CHILLED; - return true; + return true; } void Register() @@ -498,14 +498,14 @@ class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0)) { int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount()); - if (AuraEffect* currentAura = target->GetAuraEffect(SPELL_AURA_MOD_DAMAGE_DONE, SPELLFAMILY_MAGE, 2941, EFFECT_0)) - { - bp += int32(currentAura->GetAmount() * (currentAura->GetBase()->GetDuration() / (float)currentAura->GetBase()->GetMaxDuration())); - currentAura->ChangeAmount(bp); - currentAura->GetBase()->RefreshDuration(); - } - else - target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + if (AuraEffect* currentAura = target->GetAuraEffect(SPELL_AURA_MOD_DAMAGE_DONE, SPELLFAMILY_MAGE, 2941, EFFECT_0)) + { + bp += int32(currentAura->GetAmount() * (currentAura->GetBase()->GetDuration() / (float)currentAura->GetBase()->GetMaxDuration())); + currentAura->ChangeAmount(bp); + currentAura->GetBase()->RefreshDuration(); + } + else + target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); } } }; @@ -562,22 +562,22 @@ class spell_mage_cold_snap : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - Player* caster = GetCaster()->ToPlayer(); - // immediately finishes the cooldown on Frost spells + Player* caster = GetCaster()->ToPlayer(); + // immediately finishes the cooldown on Frost spells - PlayerSpellMap const& spellMap = caster->GetSpellMap(); - for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0) - { - SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id); - if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient) - caster->RemoveSpellCooldown(spellInfo->Id, true); - else - caster->RemoveSpellCooldown(spellInfo->Id, false); - } - } + PlayerSpellMap const& spellMap = caster->GetSpellMap(); + for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr) + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); + if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0) + { + SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id); + if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient) + caster->RemoveSpellCooldown(spellInfo->Id, true); + else + caster->RemoveSpellCooldown(spellInfo->Id, false); + } + } } void Register() @@ -640,9 +640,9 @@ class spell_mage_fire_frost_ward : public SpellScriptLoader target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); absorbAmount = 0; - // Xinef: trigger Incanters Absorbtion - uint32 damage = dmgInfo.GetDamage(); - Trigger(aurEff, dmgInfo, damage); + // Xinef: trigger Incanters Absorbtion + uint32 damage = dmgInfo.GetDamage(); + Trigger(aurEff, dmgInfo, damage); // Xinef: hack for chaos bolt if (!dmgInfo.GetSpellInfo() || dmgInfo.GetSpellInfo()->SpellIconID != 3178) @@ -724,8 +724,8 @@ class spell_mage_ice_barrier : public SpellScriptLoader public: spell_mage_ice_barrier() : SpellScriptLoader("spell_mage_ice_barrier") { } - static int32 CalculateSpellAmount(Unit* caster, int32 amount, const SpellInfo* spellInfo, const AuraEffect* aurEff) - { + static int32 CalculateSpellAmount(Unit* caster, int32 amount, const SpellInfo* spellInfo, const AuraEffect* aurEff) + { // +80.68% from sp bonus float bonus = 0.8068f; @@ -738,8 +738,8 @@ class spell_mage_ice_barrier : public SpellScriptLoader bonus *= caster->CalculateLevelPenalty(spellInfo); amount += int32(bonus); - return amount; - } + return amount; + } class spell_mage_ice_barrier_AuraScript : public spell_mage_incanters_absorbtion_base_AuraScript { @@ -749,7 +749,7 @@ class spell_mage_ice_barrier : public SpellScriptLoader { canBeRecalculated = false; if (Unit* caster = GetCaster()) - amount = CalculateSpellAmount(caster, amount, GetSpellInfo(), aurEff); + amount = CalculateSpellAmount(caster, amount, GetSpellInfo(), aurEff); } void Register() @@ -772,14 +772,14 @@ class spell_mage_ice_barrier : public SpellScriptLoader { Unit* caster = GetCaster(); - if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0)) - { - int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, NULL); - newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff); + if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0)) + { + int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, NULL); + newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff); - if (aurEff->GetAmount() > newAmount) - return SPELL_FAILED_AURA_BOUNCED; - } + if (aurEff->GetAmount() > newAmount) + return SPELL_FAILED_AURA_BOUNCED; + } return SPELL_CAST_OK; } @@ -815,15 +815,15 @@ class spell_mage_ignite : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - if (!eventInfo.GetActor() || !eventInfo.GetProcTarget()) - return false; + if (!eventInfo.GetActor() || !eventInfo.GetProcTarget()) + return false; - // Molten Armor - if (SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo()) - if (spellInfo->SpellFamilyFlags[1] & 0x8) - return false; + // Molten Armor + if (SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo()) + if (spellInfo->SpellFamilyFlags[1] & 0x8) + return false; - return true; + return true; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -835,7 +835,7 @@ class spell_mage_ignite : public SpellScriptLoader int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), pct) / igniteDot->GetMaxTicks()); - // Xinef: implement ignite bug + // Xinef: implement ignite bug eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(eventInfo.GetActor(), SPELL_MAGE_IGNITE, SPELL_AURA_PERIODIC_DAMAGE, amount); //GetTarget()->CastCustomSpell(SPELL_MAGE_IGNITE, SPELLVALUE_BASE_POINT0, amount, eventInfo.GetProcTarget(), true, NULL, aurEff); } @@ -1054,11 +1054,11 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - Unit* caster = GetCaster(); + Unit* caster = GetCaster(); - if (Creature *pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID())) - if (!pet->IsAlive()) - pet->ToTempSummon()->UnSummon(); + if (Creature *pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID())) + if (!pet->IsAlive()) + pet->ToTempSummon()->UnSummon(); // Glyph of Eternal Water if (caster->HasAura(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER)) @@ -1067,15 +1067,15 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader caster->CastSpell(caster, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY, true); - if (Creature *pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID())) - if (pet->GetCharmInfo() && caster->ToPlayer()) - { - pet->m_CreatureSpellCooldowns.clear(); - const SpellInfo* spellEntry = sSpellMgr->GetSpellInfo(31707); - pet->GetCharmInfo()->ToggleCreatureAutocast(spellEntry, true); - pet->GetCharmInfo()->SetSpellAutocast(spellEntry, true); - caster->ToPlayer()->CharmSpellInitialize(); - } + if (Creature *pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID())) + if (pet->GetCharmInfo() && caster->ToPlayer()) + { + pet->m_CreatureSpellCooldowns.clear(); + const SpellInfo* spellEntry = sSpellMgr->GetSpellInfo(31707); + pet->GetCharmInfo()->ToggleCreatureAutocast(spellEntry, true); + pet->GetCharmInfo()->SetSpellAutocast(spellEntry, true); + caster->ToPlayer()->CharmSpellInitialize(); + } } void Register() @@ -1092,18 +1092,18 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader void AddSC_mage_spell_scripts() { - // Ours - new spell_mage_arcane_blast(); - new spell_mage_deep_freeze(); - new spell_mage_burning_determination(); - new spell_mage_molten_armor(); - new spell_mage_mirror_image(); + // Ours + new spell_mage_arcane_blast(); + new spell_mage_deep_freeze(); + new spell_mage_burning_determination(); + new spell_mage_molten_armor(); + new spell_mage_mirror_image(); new spell_mage_burnout(); new spell_mage_burnout_trigger(); - new spell_mage_pet_scaling(); - new spell_mage_brain_freeze(); + new spell_mage_pet_scaling(); + new spell_mage_brain_freeze(); - // Theirs + // Theirs new spell_mage_blast_wave(); new spell_mage_cold_snap(); new spell_mage_fire_frost_ward(); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 333c53de3..22d69378c 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -99,32 +99,32 @@ class spell_pal_seal_of_command : public SpellScriptLoader { PrepareAuraScript(spell_pal_seal_of_command_AuraScript); - bool CheckProc(ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo()) - if (procSpell->SpellIconID == 3025) // Righteous Vengeance, should not proc SoC - return false; + if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo()) + if (procSpell->SpellIconID == 3025) // Righteous Vengeance, should not proc SoC + return false; return true; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - int32 targets = 3; - if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo()) - if (procSpell->IsAffectingArea()) - targets = 1; + int32 targets = 3; + if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo()) + if (procSpell->IsAffectingArea()) + targets = 1; - eventInfo.GetActor()->CastCustomSpell(aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, SPELLVALUE_MAX_TARGETS, targets, eventInfo.GetActionTarget(), false, NULL, aurEff); + eventInfo.GetActor()->CastCustomSpell(aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, SPELLVALUE_MAX_TARGETS, targets, eventInfo.GetActionTarget(), false, NULL, aurEff); } void Register() { - if (m_scriptSpellId == 20375) - { - DoCheckProc += AuraCheckProcFn(spell_pal_seal_of_command_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_pal_seal_of_command_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } + if (m_scriptSpellId == 20375) + { + DoCheckProc += AuraCheckProcFn(spell_pal_seal_of_command_AuraScript::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_pal_seal_of_command_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } } }; @@ -133,28 +133,28 @@ class spell_pal_seal_of_command : public SpellScriptLoader return new spell_pal_seal_of_command_AuraScript(); } - class spell_pal_seal_of_command_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_seal_of_command_SpellScript); + class spell_pal_seal_of_command_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pal_seal_of_command_SpellScript); - void FilterTargets(std::list& targets) - { - if (const SpellValue* spellValue = GetSpellValue()) - if (spellValue->MaxAffectedTargets == 1) - targets.clear(); - } + void FilterTargets(std::list& targets) + { + if (const SpellValue* spellValue = GetSpellValue()) + if (spellValue->MaxAffectedTargets == 1) + targets.clear(); + } - void Register() - { - if (m_scriptSpellId == 20424) - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_seal_of_command_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_TARGET_ENEMY); - } - }; + void Register() + { + if (m_scriptSpellId == 20424) + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_seal_of_command_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_TARGET_ENEMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_pal_seal_of_command_SpellScript(); - } + SpellScript* GetSpellScript() const + { + return new spell_pal_seal_of_command_SpellScript(); + } }; class spell_pal_divine_intervention : public SpellScriptLoader @@ -168,8 +168,8 @@ class spell_pal_divine_intervention : public SpellScriptLoader void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (!GetTarget()->IsInCombat() && GetTarget()->GetTypeId() == TYPEID_PLAYER) - GetTarget()->RemoveAurasDueToSpell(GetTarget()->ToPlayer()->GetTeamId() == TEAM_ALLIANCE ? 57723 : 57724); + if (!GetTarget()->IsInCombat() && GetTarget()->GetTypeId() == TYPEID_PLAYER) + GetTarget()->RemoveAurasDueToSpell(GetTarget()->ToPlayer()->GetTeamId() == TEAM_ALLIANCE ? 57723 : 57724); } void Register() @@ -195,8 +195,8 @@ class spell_pal_seal_of_light : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - // xinef: skip divine storm self hit (dummy) and righteous vengeance (0x20000000= - return eventInfo.GetActor() != eventInfo.GetProcTarget() && (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->SpellFamilyFlags.HasFlag(0x20000000)); + // xinef: skip divine storm self hit (dummy) and righteous vengeance (0x20000000= + return eventInfo.GetActor() != eventInfo.GetProcTarget() && (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->SpellFamilyFlags.HasFlag(0x20000000)); } void Register() @@ -224,13 +224,13 @@ class spell_pal_sacred_shield_base : public SpellScriptLoader { if (Unit* caster = GetCaster()) { - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell); - amount = spellInfo->Effects[EFFECT_0].CalcValue(); + const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell); + amount = spellInfo->Effects[EFFECT_0].CalcValue(); // +75.00% from sp bonus amount += CalculatePct(caster->SpellBaseDamageBonusDone(spellInfo->GetSchoolMask()), 75.0f); - // Xinef: removed divine guardian because it will affect triggered spell with increased amount + // Xinef: removed divine guardian because it will affect triggered spell with increased amount // Arena - Dampening if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0)) AddPct(amount, dampening->GetAmount()); @@ -242,53 +242,53 @@ class spell_pal_sacred_shield_base : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return !(eventInfo.GetHitMask() & PROC_EX_INTERNAL_HOT) && eventInfo.GetDamageInfo()->GetDamage() > 0; + return !(eventInfo.GetHitMask() & PROC_EX_INTERNAL_HOT) && eventInfo.GetDamageInfo()->GetDamage() > 0; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - if (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS) + if (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS) { - Unit* caster = eventInfo.GetActor(); - const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo(); - if (caster && procSpell->SpellFamilyName == SPELLFAMILY_PALADIN && - procSpell->SpellFamilyFlags.HasFlag(0x40000000) && caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_PALADIN, 3021, 0)) // need infusion of light + Unit* caster = eventInfo.GetActor(); + const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo(); + if (caster && procSpell->SpellFamilyName == SPELLFAMILY_PALADIN && + procSpell->SpellFamilyFlags.HasFlag(0x40000000) && caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_PALADIN, 3021, 0)) // need infusion of light { - int32 basepoints = int32(float(eventInfo.GetDamageInfo()->GetDamage())/12.0f); - // Item - Paladin T9 Holy 4P Bonus (Flash of Light) - if (AuraEffect const* aurEffect = caster->GetAuraEffect(67191, EFFECT_0)) - AddPct(basepoints, aurEffect->GetAmount()); + int32 basepoints = int32(float(eventInfo.GetDamageInfo()->GetDamage())/12.0f); + // Item - Paladin T9 Holy 4P Bonus (Flash of Light) + if (AuraEffect const* aurEffect = caster->GetAuraEffect(67191, EFFECT_0)) + AddPct(basepoints, aurEffect->GetAmount()); - caster->CastCustomSpell(eventInfo.GetActionTarget(), 66922, &basepoints, NULL, NULL, true, 0, aurEff, caster->GetGUID()); + caster->CastCustomSpell(eventInfo.GetActionTarget(), 66922, &basepoints, NULL, NULL, true, 0, aurEff, caster->GetGUID()); return; } return; } - uint32 triggered_spell_id = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; - if (eventInfo.GetActionTarget()->HasSpellCooldown(triggered_spell_id)) - return; + uint32 triggered_spell_id = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + if (eventInfo.GetActionTarget()->HasSpellCooldown(triggered_spell_id)) + return; - uint32 cooldown = eventInfo.GetProcCooldown(); - int32 basepoints = aurEff->GetAmount(); + uint32 cooldown = eventInfo.GetProcCooldown(); + int32 basepoints = aurEff->GetAmount(); // Item - Paladin T8 Holy 4P Bonus if (Unit* caster = aurEff->GetCaster()) if (AuraEffect const* aurEffect = caster->GetAuraEffect(64895, 0)) cooldown = aurEffect->GetAmount()*IN_MILLISECONDS; - eventInfo.GetActionTarget()->AddSpellCooldown(triggered_spell_id, 0, cooldown); - eventInfo.GetActionTarget()->CastCustomSpell(eventInfo.GetActionTarget(), triggered_spell_id, &basepoints, NULL, NULL, true, NULL, aurEff, eventInfo.GetActionTarget()->GetGUID()); + eventInfo.GetActionTarget()->AddSpellCooldown(triggered_spell_id, 0, cooldown); + eventInfo.GetActionTarget()->CastCustomSpell(eventInfo.GetActionTarget(), triggered_spell_id, &basepoints, NULL, NULL, true, NULL, aurEff, eventInfo.GetActionTarget()->GetGUID()); } void Register() { DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_sacred_shield_base_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_DUMMY); DoCheckProc += AuraCheckProcFn(spell_pal_sacred_shield_base_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_pal_sacred_shield_base_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + OnEffectProc += AuraEffectProcFn(spell_pal_sacred_shield_base_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -346,17 +346,17 @@ class spell_pal_ardent_defender : public SpellScriptLoader // Max heal when defense skill denies critical hits from raid bosses // Formula: max defense at level + 140 (raiting from gear) uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140; - float pctFromDefense = (defenseSkillValue - victim->getLevel()*5.0f) / 140.0f; - if (pctFromDefense < 0.0f) - pctFromDefense = 0.0f; - else if (pctFromDefense > 1.0f) - pctFromDefense = 1.0f; + float pctFromDefense = (defenseSkillValue - victim->getLevel()*5.0f) / 140.0f; + if (pctFromDefense < 0.0f) + pctFromDefense = 0.0f; + else if (pctFromDefense > 1.0f) + pctFromDefense = 1.0f; int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense))); - if (healAmount) - victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff); + if (healAmount) + victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff); - victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, 120000); + victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, 120000); } else if (remainingHealth < int32(allowedHealth)) { @@ -507,11 +507,11 @@ class spell_pal_blessing_of_sanctuary : public SpellScriptLoader { Unit* target = GetTarget(); if (Unit* caster = GetCaster()) - { + { // xinef: hack - int32 value = 9; + int32 value = 9; caster->CastCustomSpell(target, SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF, &value, &value, 0, true); - } + } } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) @@ -629,8 +629,8 @@ class spell_pal_divine_storm : public SpellScriptLoader void TriggerHeal() { Unit* caster = GetCaster(); - if (GetHitUnit() != caster) - caster->CastCustomSpell(SPELL_PALADIN_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, caster, true); + if (GetHitUnit() != caster) + caster->CastCustomSpell(SPELL_PALADIN_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, caster, true); } void Register() @@ -664,7 +664,7 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader void CountTargets(std::list& targetList) { - Trinity::Containers::RandomResizeList(targetList, GetSpellValue()->MaxAffectedTargets); + Trinity::Containers::RandomResizeList(targetList, GetSpellValue()->MaxAffectedTargets); _targetCount = targetList.size(); } @@ -877,29 +877,29 @@ class spell_pal_hand_of_sacrifice : public SpellScriptLoader return new spell_pal_hand_of_sacrifice_AuraScript(); } - class spell_pal_hand_of_sacrifice_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_hand_of_sacrifice_SpellScript); + class spell_pal_hand_of_sacrifice_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pal_hand_of_sacrifice_SpellScript); - SpellCastResult CheckTarget() - { - Unit* target = GetExplTargetUnit(); - if (!target || target->HasAura(SPELL_PALADIN_DIVINE_SACRIFICE)) - return SPELL_FAILED_TARGET_AURASTATE; + SpellCastResult CheckTarget() + { + Unit* target = GetExplTargetUnit(); + if (!target || target->HasAura(SPELL_PALADIN_DIVINE_SACRIFICE)) + return SPELL_FAILED_TARGET_AURASTATE; - return SPELL_CAST_OK; - } + return SPELL_CAST_OK; + } - void Register() - { - OnCheckCast += SpellCheckCastFn(spell_pal_hand_of_sacrifice_SpellScript::CheckTarget); - } - }; + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_pal_hand_of_sacrifice_SpellScript::CheckTarget); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_pal_hand_of_sacrifice_SpellScript(); - }; + SpellScript* GetSpellScript() const + { + return new spell_pal_hand_of_sacrifice_SpellScript(); + }; }; // 1038 - Hand of Salvation @@ -1157,11 +1157,11 @@ class spell_pal_lay_on_hands : public SpellScriptLoader return true; } - bool Load() - { - _manaAmount = 0; - return true; - } + bool Load() + { + _manaAmount = 0; + return true; + } SpellCastResult CheckCast() { @@ -1171,10 +1171,10 @@ class spell_pal_lay_on_hands : public SpellScriptLoader if (target->HasAura(SPELL_PALADIN_FORBEARANCE) || target->HasAura(SPELL_PALADIN_AVENGING_WRATH_MARKER) || target->HasAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER)) return SPELL_FAILED_TARGET_AURASTATE; - // Xinef: Glyph of Divinity - if (Unit* target = GetExplTargetUnit()) - if (target->getPowerType() == POWER_MANA) - _manaAmount = target->GetPower(POWER_MANA); + // Xinef: Glyph of Divinity + if (Unit* target = GetExplTargetUnit()) + if (target->getPowerType() == POWER_MANA) + _manaAmount = target->GetPower(POWER_MANA); return SPELL_CAST_OK; } @@ -1182,20 +1182,20 @@ class spell_pal_lay_on_hands : public SpellScriptLoader void HandleScript() { Unit* caster = GetCaster(); - Unit* target = GetHitUnit(); + Unit* target = GetHitUnit(); if (caster == target) { caster->CastSpell(caster, SPELL_PALADIN_FORBEARANCE, true); caster->CastSpell(caster, SPELL_PALADIN_AVENGING_WRATH_MARKER, true); caster->CastSpell(caster, SPELL_PALADIN_IMMUNE_SHIELD_MARKER, true); } - // Xinef: Glyph of Divinity - else if (target && caster->HasAura(54939) && GetSpellInfo()->Id != 633 && _manaAmount > 0) // excluding first rank - { - _manaAmount = target->GetPower(POWER_MANA) - _manaAmount; - if (_manaAmount > 0) - caster->CastCustomSpell(54986 /*Energize*/, SPELLVALUE_BASE_POINT1, _manaAmount, caster, true); - } + // Xinef: Glyph of Divinity + else if (target && caster->HasAura(54939) && GetSpellInfo()->Id != 633 && _manaAmount > 0) // excluding first rank + { + _manaAmount = target->GetPower(POWER_MANA) - _manaAmount; + if (_manaAmount > 0) + caster->CastCustomSpell(54986 /*Energize*/, SPELLVALUE_BASE_POINT1, _manaAmount, caster, true); + } } void Register() @@ -1204,7 +1204,7 @@ class spell_pal_lay_on_hands : public SpellScriptLoader AfterHit += SpellHitFn(spell_pal_lay_on_hands_SpellScript::HandleScript); } - int32 _manaAmount; + int32 _manaAmount; }; SpellScript* GetSpellScript() const @@ -1296,11 +1296,11 @@ class spell_pal_seal_of_righteousness : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - Unit* target = eventInfo.GetProcTarget(); - if (!target) - return false; + Unit* target = eventInfo.GetProcTarget(); + if (!target) + return false; - return target->IsAlive() && !eventInfo.GetTriggerAuraSpell() && (eventInfo.GetDamageInfo()->GetDamage() || (eventInfo.GetHitMask() & PROC_EX_ABSORB)); + return target->IsAlive() && !eventInfo.GetTriggerAuraSpell() && (eventInfo.GetDamageInfo()->GetDamage() || (eventInfo.GetHitMask() & PROC_EX_ABSORB)); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -1311,11 +1311,11 @@ class spell_pal_seal_of_righteousness : public SpellScriptLoader int32 holy = GetTarget()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY); holy += eventInfo.GetProcTarget()->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_HOLY); - // Xinef: Libram of Divine Purpose - if (AuraEffect* aurEff = GetTarget()->GetDummyAuraEffect(SPELLFAMILY_PALADIN, 2025, EFFECT_0)) - holy += aurEff->GetAmount(); + // Xinef: Libram of Divine Purpose + if (AuraEffect* aurEff = GetTarget()->GetDummyAuraEffect(SPELLFAMILY_PALADIN, 2025, EFFECT_0)) + holy += aurEff->GetAmount(); - int32 bp = std::max(0, int32((ap * 0.022f + 0.044f * holy) * GetTarget()->GetAttackTime(BASE_ATTACK) / 1000)); + int32 bp = std::max(0, int32((ap * 0.022f + 0.044f * holy) * GetTarget()->GetAttackTime(BASE_ATTACK) / 1000)); GetTarget()->CastCustomSpell(SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, NULL, aurEff); } @@ -1334,13 +1334,13 @@ class spell_pal_seal_of_righteousness : public SpellScriptLoader void AddSC_paladin_spell_scripts() { - // Ours - new spell_pal_seal_of_command(); - new spell_pal_divine_intervention(); - new spell_pal_seal_of_light(); - new spell_pal_sacred_shield_base(); + // Ours + new spell_pal_seal_of_command(); + new spell_pal_divine_intervention(); + new spell_pal_seal_of_light(); + new spell_pal_sacred_shield_base(); - // Theirs + // Theirs new spell_pal_ardent_defender(); new spell_pal_avenging_wrath(); new spell_pal_blessing_of_faith(); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 0204230fb..4936dd7c8 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -46,8 +46,8 @@ enum PriestSpells SPELL_PRIEST_T9_HEALING_2P = 67201, SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL = 64085, - SPELL_GENERIC_ARENA_DAMPENING = 74410, - SPELL_GENERIC_BATTLEGROUND_DAMPENING = 74411 + SPELL_GENERIC_ARENA_DAMPENING = 74410, + SPELL_GENERIC_BATTLEGROUND_DAMPENING = 74411 }; enum PriestSpellIcons @@ -69,73 +69,73 @@ class spell_pri_shadowfiend_scaling : public SpellScriptLoader void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: shadowfiend inherits 40% of resistance from owner and 35% of armor (guessed) - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; - amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); - } + // xinef: shadowfiend inherits 40% of resistance from owner and 35% of armor (guessed) + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; + amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); + } } void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: shadowfiend inherits 30% of intellect / stamina (guessed) - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); - } + // xinef: shadowfiend inherits 30% of intellect / stamina (guessed) + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); + } } - void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: shadowfiend inherits 333% of SP as AP - 35.7% of damage increase per hit - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); - amount = CalculatePct(std::max(0, shadow), 300); // xinef: deacrased to 300, including 15% from self buff - } + // xinef: shadowfiend inherits 333% of SP as AP - 35.7% of damage increase per hit + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); + amount = CalculatePct(std::max(0, shadow), 300); // xinef: deacrased to 300, including 15% from self buff + } } - void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: shadowfiend inherits 30% of SP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); - amount = CalculatePct(std::max(0, shadow), 30); + // xinef: shadowfiend inherits 30% of SP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); + amount = CalculatePct(std::max(0, shadow), 30); - // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); - } + // xinef: Update appropriate player field + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); + } } - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); - else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); + else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); + } void Register() { - if (m_scriptSpellId != 35661) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); + if (m_scriptSpellId != 35661) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); - if (m_scriptSpellId == 35661 || m_scriptSpellId == 35662) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); + if (m_scriptSpellId == 35661 || m_scriptSpellId == 35662) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); - if (m_scriptSpellId == 35661) - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); - } + if (m_scriptSpellId == 35661) + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); + } - OnEffectApply += AuraEffectApplyFn(spell_pri_shadowfiend_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_pri_shadowfiend_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); } }; @@ -166,7 +166,7 @@ class spell_pri_circle_of_healing : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if(Trinity::RaidCheck(GetCaster(), false)); + targets.remove_if(Trinity::RaidCheck(GetCaster(), false)); uint32 const maxTargets = GetCaster()->HasAura(SPELL_PRIEST_GLYPH_OF_CIRCLE_OF_HEALING) ? 6 : 5; // Glyph of Circle of Healing @@ -251,7 +251,7 @@ class spell_pri_divine_hymn : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if(Trinity::RaidCheck(GetCaster(), false)); + targets.remove_if(Trinity::RaidCheck(GetCaster(), false)); uint32 const maxTargets = 3; @@ -381,8 +381,8 @@ class spell_pri_hymn_of_hope : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if(Trinity::PowerCheck(POWER_MANA, false)); - targets.remove_if(Trinity::RaidCheck(GetCaster(), false)); + targets.remove_if(Trinity::PowerCheck(POWER_MANA, false)); + targets.remove_if(Trinity::RaidCheck(GetCaster(), false)); uint32 const maxTargets = 3; @@ -593,10 +593,10 @@ class spell_pri_pain_and_suffering_proc : public SpellScriptLoader // Refresh Shadow Word: Pain on target if (Unit* unitTarget = GetHitUnit()) if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetCaster()->GetGUID())) - { - aur->GetBase()->RefreshTimersWithMods(); + { + aur->GetBase()->RefreshTimersWithMods(); aur->ChangeAmount(aur->CalculateAmount(aur->GetCaster()), false); - } + } } void Register() @@ -700,9 +700,9 @@ class spell_pri_power_word_shield : public SpellScriptLoader public: spell_pri_power_word_shield() : SpellScriptLoader("spell_pri_power_word_shield") { } - static int32 CalculateSpellAmount(Unit* caster, int32 amount, const SpellInfo* spellInfo, const AuraEffect* aurEff) - { - // +80.68% from sp bonus + static int32 CalculateSpellAmount(Unit* caster, int32 amount, const SpellInfo* spellInfo, const AuraEffect* aurEff) + { + // +80.68% from sp bonus float bonus = 0.8068f; // Borrowed Time @@ -719,22 +719,22 @@ class spell_pri_power_word_shield : public SpellScriptLoader amount += int32(bonus); // Twin Disciplines - if (AuraEffect const* twinDisciplines = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID())) + if (AuraEffect const* twinDisciplines = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID())) AddPct(amount, twinDisciplines->GetAmount()); - // Focused Power, xinef: apply positive modifier only - if (int32 healModifier = caster->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT)) - AddPct(amount, healModifier); + // Focused Power, xinef: apply positive modifier only + if (int32 healModifier = caster->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT)) + AddPct(amount, healModifier); - // Arena - Dampening + // Arena - Dampening if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0)) AddPct(amount, dampening->GetAmount()); // Battleground - Dampening else if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0)) AddPct(amount, dampening->GetAmount()); - return amount; - } + return amount; + } class spell_pri_power_word_shield_AuraScript : public AuraScript { @@ -753,7 +753,7 @@ class spell_pri_power_word_shield : public SpellScriptLoader { canBeRecalculated = false; if (Unit* caster = GetCaster()) - amount = CalculateSpellAmount(caster, amount, GetSpellInfo(), aurEff); + amount = CalculateSpellAmount(caster, amount, GetSpellInfo(), aurEff); } void ReflectDamage(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) @@ -766,9 +766,9 @@ class spell_pri_power_word_shield : public SpellScriptLoader if (AuraEffect* talentAurEff = owner->GetAuraEffectOfRankedSpell(SPELL_PRIEST_REFLECTIVE_SHIELD_R1, EFFECT_0)) { int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount()); - // xinef: prevents infinite loop! - if (!dmgInfo.GetSpellInfo() || dmgInfo.GetSpellInfo()->Id != SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED) - target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + // xinef: prevents infinite loop! + if (!dmgInfo.GetSpellInfo() || dmgInfo.GetSpellInfo()->Id != SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED) + target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); } } @@ -792,17 +792,17 @@ class spell_pri_power_word_shield : public SpellScriptLoader { Unit* caster = GetCaster(); Unit* target = GetExplTargetUnit(); - if (!target) - return SPELL_FAILED_BAD_TARGETS; + if (!target) + return SPELL_FAILED_BAD_TARGETS; - if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0)) - { - int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, NULL); - newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff); + if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0)) + { + int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, NULL); + newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff); - if (aurEff->GetAmount() > newAmount) - return SPELL_FAILED_AURA_BOUNCED; - } + if (aurEff->GetAmount() > newAmount) + return SPELL_FAILED_AURA_BOUNCED; + } return SPELL_CAST_OK; } @@ -953,8 +953,8 @@ class spell_pri_vampiric_touch : public SpellScriptLoader if (Unit* target = GetUnitOwner()) if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) { - int32 damage = aurEff->GetBaseAmount(); - damage = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster, &damage, NULL) * 8; + int32 damage = aurEff->GetBaseAmount(); + damage = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster, &damage, NULL) * 8; // backfire damage caster->CastCustomSpell(target, SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); } @@ -962,7 +962,7 @@ class spell_pri_vampiric_touch : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetActionTarget() && eventInfo.GetActionTarget()->IsAlive() && GetOwner()->GetGUID() == eventInfo.GetActionTarget()->GetGUID(); + return eventInfo.GetActionTarget() && eventInfo.GetActionTarget()->IsAlive() && GetOwner()->GetGUID() == eventInfo.GetActionTarget()->GetGUID(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -974,7 +974,7 @@ class spell_pri_vampiric_touch : public SpellScriptLoader void Register() { AfterDispel += AuraDispelFn(spell_pri_vampiric_touch_AuraScript::HandleDispel); - DoCheckProc += AuraCheckProcFn(spell_pri_vampiric_touch_AuraScript::CheckProc); + DoCheckProc += AuraCheckProcFn(spell_pri_vampiric_touch_AuraScript::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pri_vampiric_touch_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -987,10 +987,10 @@ class spell_pri_vampiric_touch : public SpellScriptLoader void AddSC_priest_spell_scripts() { - // Ours - new spell_pri_shadowfiend_scaling(); + // Ours + new spell_pri_shadowfiend_scaling(); - // Theirs + // Theirs new spell_pri_circle_of_healing(); new spell_pri_divine_aegis(); new spell_pri_divine_hymn(); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 724942bd9..72ed85ff1 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -33,8 +33,8 @@ // Ours class spell_q11065_wrangle_some_aether_rays : public SpellScriptLoader { - public: - spell_q11065_wrangle_some_aether_rays() : SpellScriptLoader("spell_q11065_wrangle_some_aether_rays") { } + public: + spell_q11065_wrangle_some_aether_rays() : SpellScriptLoader("spell_q11065_wrangle_some_aether_rays") { } class spell_q11065_wrangle_some_aether_rays_SpellScript : public SpellScript { @@ -42,10 +42,10 @@ class spell_q11065_wrangle_some_aether_rays : public SpellScriptLoader SpellCastResult CheckCast() { - // if thane is present and not in combat - allow cast - if (Unit* target = GetExplTargetUnit()) - if (target->GetHealthPct() < 40.0f) - return SPELL_CAST_OK; + // if thane is present and not in combat - allow cast + if (Unit* target = GetExplTargetUnit()) + if (target->GetHealthPct() < 40.0f) + return SPELL_CAST_OK; return SPELL_FAILED_CASTER_AURASTATE; } @@ -61,212 +61,212 @@ class spell_q11065_wrangle_some_aether_rays : public SpellScriptLoader return new spell_q11065_wrangle_some_aether_rays_SpellScript(); } - class spell_q11065_wrangle_some_aether_rays_AuraScript : public AuraScript - { - PrepareAuraScript(spell_q11065_wrangle_some_aether_rays_AuraScript) - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* ar = GetTarget(); - if (ar && ar->ToCreature()) - { - if (GetCaster() && GetCaster()->ToPlayer()) - { - Player* player = GetCaster()->ToPlayer(); + class spell_q11065_wrangle_some_aether_rays_AuraScript : public AuraScript + { + PrepareAuraScript(spell_q11065_wrangle_some_aether_rays_AuraScript) + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* ar = GetTarget(); + if (ar && ar->ToCreature()) + { + if (GetCaster() && GetCaster()->ToPlayer()) + { + Player* player = GetCaster()->ToPlayer(); - player->KilledMonsterCredit(23343, 0); - if (Creature *cr = GetCaster()->SummonCreature(23343, ar->GetPositionX(), ar->GetPositionY(), ar->GetPositionZ(), ar->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 180000)) - { - cr->CastSpell(player, 40926, true); - cr->GetMotionMaster()->MoveFollow(player, 5.0f, 2*M_PI*rand_norm()); - ar->ToCreature()->DespawnOrUnsummon(500); - } - } - } - } + player->KilledMonsterCredit(23343, 0); + if (Creature *cr = GetCaster()->SummonCreature(23343, ar->GetPositionX(), ar->GetPositionY(), ar->GetPositionZ(), ar->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 180000)) + { + cr->CastSpell(player, 40926, true); + cr->GetMotionMaster()->MoveFollow(player, 5.0f, 2*M_PI*rand_norm()); + ar->ToCreature()->DespawnOrUnsummon(500); + } + } + } + } - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - SetDuration(5000); - } + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + SetDuration(5000); + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_q11065_wrangle_some_aether_rays_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_q11065_wrangle_some_aether_rays_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_q11065_wrangle_some_aether_rays_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_q11065_wrangle_some_aether_rays_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } - }; + }; - AuraScript* GetAuraScript() const - { - return new spell_q11065_wrangle_some_aether_rays_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_q11065_wrangle_some_aether_rays_AuraScript(); + } }; enum eDrakuru { - QUEST_SUBJECT_TO_INTERPRETATION = 11991, - QUEST_MY_HEART_IS_IN_YOUR_HANDS = 12802, + QUEST_SUBJECT_TO_INTERPRETATION = 11991, + QUEST_MY_HEART_IS_IN_YOUR_HANDS = 12802, - NPC_DRAKURU = 28016, + NPC_DRAKURU = 28016, }; class spell_image_of_drakuru_reagent_check : public SpellScriptLoader { - public: - spell_image_of_drakuru_reagent_check() : SpellScriptLoader("spell_image_of_drakuru_reagent_check") { } + public: + spell_image_of_drakuru_reagent_check() : SpellScriptLoader("spell_image_of_drakuru_reagent_check") { } - class spell_image_of_drakuru_reagent_check_SpellScript : public SpellScript - { - PrepareSpellScript(spell_image_of_drakuru_reagent_check_SpellScript); + class spell_image_of_drakuru_reagent_check_SpellScript : public SpellScript + { + PrepareSpellScript(spell_image_of_drakuru_reagent_check_SpellScript); - void HandleDummyEffect(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - if (!caster || !caster->ToPlayer()) - return; - Player* player = caster->ToPlayer(); + void HandleDummyEffect(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (!caster || !caster->ToPlayer()) + return; + Player* player = caster->ToPlayer(); - float dist = player->GetDistance(3385, -1807, 114); - if (dist < 40.0f) - { - caster->ToPlayer()->GroupEventHappens(QUEST_SUBJECT_TO_INTERPRETATION, caster); - caster->CastSpell(caster, 47118, false); - return; - } + float dist = player->GetDistance(3385, -1807, 114); + if (dist < 40.0f) + { + caster->ToPlayer()->GroupEventHappens(QUEST_SUBJECT_TO_INTERPRETATION, caster); + caster->CastSpell(caster, 47118, false); + return; + } - dist = player->GetDistance(4244, -2025, 238); - if (dist < 40.0f) - { - caster->CastSpell(caster, 47150, false); - return; - } + dist = player->GetDistance(4244, -2025, 238); + if (dist < 40.0f) + { + caster->CastSpell(caster, 47150, false); + return; + } - dist = player->GetDistance(4524, -3472, 228); - if (dist < 40.0f) - { - caster->ToPlayer()->GroupEventHappens(QUEST_MY_HEART_IS_IN_YOUR_HANDS, caster); - caster->CastSpell(caster, 47317, false); - return; - } + dist = player->GetDistance(4524, -3472, 228); + if (dist < 40.0f) + { + caster->ToPlayer()->GroupEventHappens(QUEST_MY_HEART_IS_IN_YOUR_HANDS, caster); + caster->CastSpell(caster, 47317, false); + return; + } - dist = player->GetDistance(4599, -4877, 48); - if (dist < 40.0f) - { - caster->CastSpell(caster, 47406, false); - return; - } + dist = player->GetDistance(4599, -4877, 48); + if (dist < 40.0f) + { + caster->CastSpell(caster, 47406, false); + return; + } - dist = player->GetDistance(-236, -614, 116); - if (dist < 40.0f) - { - caster->CastSpell(caster, 50440, false); - return; - } - } + dist = player->GetDistance(-236, -614, 116); + if (dist < 40.0f) + { + caster->CastSpell(caster, 50440, false); + return; + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_image_of_drakuru_reagent_check_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_image_of_drakuru_reagent_check_SpellScript::HandleDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_image_of_drakuru_reagent_check_SpellScript(); - }; + SpellScript* GetSpellScript() const + { + return new spell_image_of_drakuru_reagent_check_SpellScript(); + }; }; class spell_q12014_steady_as_a_rock : public SpellScriptLoader { - public: - spell_q12014_steady_as_a_rock() : SpellScriptLoader("spell_q12014_steady_as_a_rock") { } + public: + spell_q12014_steady_as_a_rock() : SpellScriptLoader("spell_q12014_steady_as_a_rock") { } - class spell_q12014_steady_as_a_rock_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q12014_steady_as_a_rock_SpellScript); + class spell_q12014_steady_as_a_rock_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12014_steady_as_a_rock_SpellScript); - void HandleFinish() - { - Unit* caster = GetCaster(); - if (!caster || !caster->ToPlayer()) // caster cant be null, but meh :p - return; + void HandleFinish() + { + Unit* caster = GetCaster(); + if (!caster || !caster->ToPlayer()) // caster cant be null, but meh :p + return; - if (caster->ToPlayer()->GetQuestStatus(12014 /*QUEST_STEADY_AS_A_ROCK*/) == QUEST_STATUS_INCOMPLETE) - { - float x = caster->GetPositionX() + 3.0f*cos(caster->GetOrientation()); - float y = caster->GetPositionY() + 3.0f*sin(caster->GetOrientation()); - float o = caster->GetOrientation() < M_PI ? caster->GetOrientation()+M_PI : caster->GetOrientation()-M_PI; - caster->SummonGameObject(188367, x, y, caster->GetPositionZ(), o, 0.0f, 0.0f, 0.0f, 0.0f, 60000); - } - } + if (caster->ToPlayer()->GetQuestStatus(12014 /*QUEST_STEADY_AS_A_ROCK*/) == QUEST_STATUS_INCOMPLETE) + { + float x = caster->GetPositionX() + 3.0f*cos(caster->GetOrientation()); + float y = caster->GetPositionY() + 3.0f*sin(caster->GetOrientation()); + float o = caster->GetOrientation() < M_PI ? caster->GetOrientation()+M_PI : caster->GetOrientation()-M_PI; + caster->SummonGameObject(188367, x, y, caster->GetPositionZ(), o, 0.0f, 0.0f, 0.0f, 0.0f, 60000); + } + } - void Register() - { - AfterCast += SpellCastFn(spell_q12014_steady_as_a_rock_SpellScript::HandleFinish); - } - }; + void Register() + { + AfterCast += SpellCastFn(spell_q12014_steady_as_a_rock_SpellScript::HandleFinish); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_q12014_steady_as_a_rock_SpellScript(); - }; + SpellScript* GetSpellScript() const + { + return new spell_q12014_steady_as_a_rock_SpellScript(); + }; }; class spell_q11026_a11051_banish_the_demons : public SpellScriptLoader { - public: - spell_q11026_a11051_banish_the_demons() : SpellScriptLoader("spell_q11026_a11051_banish_the_demons") { } + public: + spell_q11026_a11051_banish_the_demons() : SpellScriptLoader("spell_q11026_a11051_banish_the_demons") { } - class spell_q11026_a11051_banish_the_demons_AuraScript : public AuraScript - { - PrepareAuraScript(spell_q11026_a11051_banish_the_demons_AuraScript) + class spell_q11026_a11051_banish_the_demons_AuraScript : public AuraScript + { + PrepareAuraScript(spell_q11026_a11051_banish_the_demons_AuraScript) - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* ar = GetTarget(); - if (ar && !ar->IsAlive()) - ar->CastSpell(ar, 40828, true); // Banish kill credit - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* ar = GetTarget(); + if (ar && !ar->IsAlive()) + ar->CastSpell(ar, 40828, true); // Banish kill credit + } - void Register() - { - // aura spell only - if (m_scriptSpellId == 40825) - OnEffectRemove += AuraEffectRemoveFn(spell_q11026_a11051_banish_the_demons_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } + void Register() + { + // aura spell only + if (m_scriptSpellId == 40825) + OnEffectRemove += AuraEffectRemoveFn(spell_q11026_a11051_banish_the_demons_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } - }; + }; - AuraScript* GetAuraScript() const - { - return new spell_q11026_a11051_banish_the_demons_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_q11026_a11051_banish_the_demons_AuraScript(); + } - class spell_q11026_a11051_banish_the_demons_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q11026_a11051_banish_the_demons_SpellScript); + class spell_q11026_a11051_banish_the_demons_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q11026_a11051_banish_the_demons_SpellScript); - void HandleScriptEffect(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetHitUnit()) - if (Unit* owner = target->ToTempSummon()->GetSummoner()) - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->ToPlayer()->KilledMonsterCredit(23327, 0); // Some trigger, just count - } + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + if (Unit* owner = target->ToTempSummon()->GetSummoner()) + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->ToPlayer()->KilledMonsterCredit(23327, 0); // Some trigger, just count + } - void Register() - { - // script effect only - if (m_scriptSpellId == 40828) - OnEffectHitTarget += SpellEffectFn(spell_q11026_a11051_banish_the_demons_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void Register() + { + // script effect only + if (m_scriptSpellId == 40828) + OnEffectHitTarget += SpellEffectFn(spell_q11026_a11051_banish_the_demons_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_q11026_a11051_banish_the_demons_SpellScript(); - }; + SpellScript* GetSpellScript() const + { + return new spell_q11026_a11051_banish_the_demons_SpellScript(); + }; }; class spell_q10525_vision_guide : public SpellScriptLoader @@ -280,24 +280,24 @@ public: void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - SetDuration(75*IN_MILLISECONDS); + SetDuration(75*IN_MILLISECONDS); } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Player* target = GetTarget()->ToPlayer()) - { - target->AreaExploredOrEventHappens(10525); // Vision Guide quest - target->GetMotionMaster()->MovementExpired(); - target->CleanupAfterTaxiFlight(); - target->NearTeleportTo(2283.267f, 5987.395f, 142.4f, 3.80f); - } + if (Player* target = GetTarget()->ToPlayer()) + { + target->AreaExploredOrEventHappens(10525); // Vision Guide quest + target->GetMotionMaster()->MovementExpired(); + target->CleanupAfterTaxiFlight(); + target->NearTeleportTo(2283.267f, 5987.395f, 142.4f, 3.80f); + } } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_q10525_vision_guide_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_q10525_vision_guide_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_q10525_vision_guide_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_q10525_vision_guide_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); } }; @@ -317,16 +317,16 @@ public: { PrepareAuraScript(spell_q11322_q11317_the_cleansing_AuraScript) - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* ar = GetCaster(); - if (ar && ar->ToPlayer()) - { - if (ar->ToPlayer()->GetQuestStatus(11317) == QUEST_STATUS_INCOMPLETE || ar->ToPlayer()->GetQuestStatus(11322) == QUEST_STATUS_INCOMPLETE) - ar->SummonCreature(27959, 3032.0f, -5095.0f, 723.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - - ar->SetStandState(UNIT_STAND_STATE_SIT); - } + Unit* ar = GetCaster(); + if (ar && ar->ToPlayer()) + { + if (ar->ToPlayer()->GetQuestStatus(11317) == QUEST_STATUS_INCOMPLETE || ar->ToPlayer()->GetQuestStatus(11322) == QUEST_STATUS_INCOMPLETE) + ar->SummonCreature(27959, 3032.0f, -5095.0f, 723.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + + ar->SetStandState(UNIT_STAND_STATE_SIT); + } } void Register() @@ -346,27 +346,27 @@ class spell_q10714_on_spirits_wings : public SpellScriptLoader public: spell_q10714_on_spirits_wings() : SpellScriptLoader("spell_q10714_on_spirits_wings") { } - class spell_q10714_on_spirits_wings_SpellScript : public SpellScript + class spell_q10714_on_spirits_wings_SpellScript : public SpellScript { PrepareSpellScript(spell_q10714_on_spirits_wings_SpellScript); - uint8 count; - bool Load() - { - count = 0; - return true; - } + uint8 count; + bool Load() + { + count = 0; + return true; + } void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Creature* target = GetHitCreature()) - if (target->GetDBTableGUIDLow() == 77757 || target->GetDBTableGUIDLow() == 78693) - { - count++; - if (count == 2) - if (GetCaster() && GetCaster()->ToPlayer()) - GetCaster()->ToPlayer()->KilledMonsterCredit(22383, 0); - } + if (Creature* target = GetHitCreature()) + if (target->GetDBTableGUIDLow() == 77757 || target->GetDBTableGUIDLow() == 78693) + { + count++; + if (count == 2) + if (GetCaster() && GetCaster()->ToPlayer()) + GetCaster()->ToPlayer()->KilledMonsterCredit(22383, 0); + } } void Register() @@ -375,7 +375,7 @@ public: } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_q10714_on_spirits_wings_SpellScript(); }; @@ -386,24 +386,24 @@ class spell_q10720_the_smallest_creature : public SpellScriptLoader public: spell_q10720_the_smallest_creature() : SpellScriptLoader("spell_q10720_the_smallest_creature") { } - class spell_q10720_the_smallest_creature_SpellScript : public SpellScript + class spell_q10720_the_smallest_creature_SpellScript : public SpellScript { PrepareSpellScript(spell_q10720_the_smallest_creature_SpellScript); void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (GetCaster() && GetHitUnit()) - if (Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->KilledMonsterCredit(GetHitUnit()->GetEntry(), 0); + if (GetCaster() && GetHitUnit()) + if (Player* player = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself()) + player->KilledMonsterCredit(GetHitUnit()->GetEntry(), 0); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_q10720_the_smallest_creature_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_q10720_the_smallest_creature_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_q10720_the_smallest_creature_SpellScript(); }; @@ -418,31 +418,31 @@ class spell_q13086_last_line_of_defence : public SpellScriptLoader { PrepareSpellScript(spell_q13086_last_line_of_defence_SpellScript); - bool Load() { _triggerSpellId = 0; return true; } + bool Load() { _triggerSpellId = 0; return true; } void HandleDummy(SpellEffIndex effIndex) { - if (effIndex == EFFECT_0) - _triggerSpellId = GetSpellInfo()->Effects[effIndex].CalcValue(); + if (effIndex == EFFECT_0) + _triggerSpellId = GetSpellInfo()->Effects[effIndex].CalcValue(); - PreventHitEffect(effIndex); + PreventHitEffect(effIndex); } - void HandleAfterCast() - { - if (WorldLocation const* loc = GetExplTargetDest()) - GetCaster()->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), _triggerSpellId, true); - } + void HandleAfterCast() + { + if (WorldLocation const* loc = GetExplTargetDest()) + GetCaster()->CastSpell(loc->GetPositionX(), loc->GetPositionY(), loc->GetPositionZ(), _triggerSpellId, true); + } void Register() { OnEffectLaunch += SpellEffectFn(spell_q13086_last_line_of_defence_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - OnEffectLaunch += SpellEffectFn(spell_q13086_last_line_of_defence_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); - AfterCast += SpellCastFn(spell_q13086_last_line_of_defence_SpellScript::HandleAfterCast); + OnEffectLaunch += SpellEffectFn(spell_q13086_last_line_of_defence_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + AfterCast += SpellCastFn(spell_q13086_last_line_of_defence_SpellScript::HandleAfterCast); } - private: - uint32 _triggerSpellId; + private: + uint32 _triggerSpellId; }; SpellScript* GetSpellScript() const @@ -453,7 +453,7 @@ class spell_q13086_last_line_of_defence : public SpellScriptLoader enum eShadowVaultDecree { - NPC_THANE_UFRANG = 29919, + NPC_THANE_UFRANG = 29919, }; class spell_q12943_shadow_vault_decree : public SpellScriptLoader @@ -467,26 +467,26 @@ class spell_q12943_shadow_vault_decree : public SpellScriptLoader SpellCastResult CheckRequirement() { - // if thane is present and not in combat - allow cast + // if thane is present and not in combat - allow cast Unit* caster = GetCaster(); - if (Creature* thane = caster->FindNearestCreature(NPC_THANE_UFRANG, 30.0f)) - if (!thane->IsInCombat()) - return SPELL_CAST_OK; + if (Creature* thane = caster->FindNearestCreature(NPC_THANE_UFRANG, 30.0f)) + if (!thane->IsInCombat()) + return SPELL_CAST_OK; return SPELL_FAILED_CASTER_AURASTATE; } - void HandleScriptEffect(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - if (Creature* thane = caster->FindNearestCreature(NPC_THANE_UFRANG, 30.0f)) - thane->AI()->AttackStart(caster); - } + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Creature* thane = caster->FindNearestCreature(NPC_THANE_UFRANG, 30.0f)) + thane->AI()->AttackStart(caster); + } void Register() { OnCheckCast += SpellCheckCastFn(spell_q12943_shadow_vault_decree_SpellScript::CheckRequirement); - OnEffectHitTarget += SpellEffectFn(spell_q12943_shadow_vault_decree_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_q12943_shadow_vault_decree_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -505,57 +505,57 @@ public: { PrepareAuraScript(spell_q10769_dissension_amongst_the_ranks_AuraScript) - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* ar = GetTarget(); - if (ar) - { - if (ar->getGender() == GENDER_MALE) - ar->CastSpell(ar, 38225, true); - else - ar->CastSpell(ar, 38227, true); - } + Unit* ar = GetTarget(); + if (ar) + { + if (ar->getGender() == GENDER_MALE) + ar->CastSpell(ar, 38225, true); + else + ar->CastSpell(ar, 38227, true); + } } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* ar = GetTarget(); - if (ar) - { - if (ar->getGender() == GENDER_MALE) - ar->RemoveAurasDueToSpell(38225); - else - ar->RemoveAurasDueToSpell(38227); - } + Unit* ar = GetTarget(); + if (ar) + { + if (ar->getGender() == GENDER_MALE) + ar->RemoveAurasDueToSpell(38225); + else + ar->RemoveAurasDueToSpell(38227); + } } void Register() { - if (m_scriptSpellId == 38224) - { - OnEffectApply += AuraEffectApplyFn(spell_q10769_dissension_amongst_the_ranks_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_q10769_dissension_amongst_the_ranks_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } + if (m_scriptSpellId == 38224) + { + OnEffectApply += AuraEffectApplyFn(spell_q10769_dissension_amongst_the_ranks_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_q10769_dissension_amongst_the_ranks_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } } }; - class spell_q10769_dissension_amongst_the_ranks_SpellScript : public SpellScript + class spell_q10769_dissension_amongst_the_ranks_SpellScript : public SpellScript { PrepareSpellScript(spell_q10769_dissension_amongst_the_ranks_SpellScript); void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetHitUnit()) - if (Player* player = target->GetCharmerOrOwnerPlayerOrPlayerItself()) - if (player->HasAura(38224)) - player->KilledMonsterCredit(22051, 0); + if (Unit* target = GetHitUnit()) + if (Player* player = target->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (player->HasAura(38224)) + player->KilledMonsterCredit(22051, 0); } void Register() { - if (m_scriptSpellId == 38223) - OnEffectHitTarget += SpellEffectFn(spell_q10769_dissension_amongst_the_ranks_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + if (m_scriptSpellId == 38223) + OnEffectHitTarget += SpellEffectFn(spell_q10769_dissension_amongst_the_ranks_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; @@ -564,7 +564,7 @@ public: return new spell_q10769_dissension_amongst_the_ranks_AuraScript(); } - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_q10769_dissension_amongst_the_ranks_SpellScript(); }; @@ -572,8 +572,8 @@ public: enum q11520Roots { - GO_RAZORTHORN_DIRT_MOUNT = 187073, - SPELL_SUMMON_RAZORTHORN_ROOT = 44941, + GO_RAZORTHORN_DIRT_MOUNT = 187073, + SPELL_SUMMON_RAZORTHORN_ROOT = 44941, }; class spell_q11520_discovering_your_roots : public SpellScriptLoader @@ -581,27 +581,27 @@ class spell_q11520_discovering_your_roots : public SpellScriptLoader public: spell_q11520_discovering_your_roots() : SpellScriptLoader("spell_q11520_discovering_your_roots") { } - class spell_q11520_discovering_your_roots_SpellScript : public SpellScript + class spell_q11520_discovering_your_roots_SpellScript : public SpellScript { PrepareSpellScript(spell_q11520_discovering_your_roots_SpellScript); void HandleDummy(SpellEffIndex /*effIndex*/) { - if (GameObject* go = GetCaster()->FindNearestGameObject(GO_RAZORTHORN_DIRT_MOUNT, 20.0f)) - { - GetCaster()->GetMotionMaster()->MovePoint(0, *go); - go->SetLootState(GO_JUST_DEACTIVATED); - GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_RAZORTHORN_ROOT, true); - } - } + if (GameObject* go = GetCaster()->FindNearestGameObject(GO_RAZORTHORN_DIRT_MOUNT, 20.0f)) + { + GetCaster()->GetMotionMaster()->MovePoint(0, *go); + go->SetLootState(GO_JUST_DEACTIVATED); + GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_RAZORTHORN_ROOT, true); + } + } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_q11520_discovering_your_roots_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_q11520_discovering_your_roots_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_q11520_discovering_your_roots_SpellScript(); }; @@ -615,46 +615,46 @@ class spell_quest_dragonmaw_race_generic : public SpellScriptLoader class spell_quest_dragonmaw_race_generic_SpellScript : public SpellScript { PrepareSpellScript(spell_quest_dragonmaw_race_generic_SpellScript); - - bool Load() - { - _x = _y = _z = 0.0f; - return true; - } + + bool Load() + { + _x = _y = _z = 0.0f; + return true; + } SpellCastResult RelocateDest() { - Unit* caster = GetCaster(); - float o = Position::NormalizeOrientation(caster->GetOrientation()+frand(0.0f, 2*M_PI)); - float dist = frand(5.0f, 30.0f); - _x = caster->GetPositionX()+dist*cos(o); - _y = caster->GetPositionY()+dist*sin(o); - _z = caster->GetPositionZ()+frand(-10.0f, 15.0f); - GetSpell()->m_targets.SetDst(_x, _y, _z, 0.0f, caster->GetMapId()); - return SPELL_CAST_OK; + Unit* caster = GetCaster(); + float o = Position::NormalizeOrientation(caster->GetOrientation()+frand(0.0f, 2*M_PI)); + float dist = frand(5.0f, 30.0f); + _x = caster->GetPositionX()+dist*cos(o); + _y = caster->GetPositionY()+dist*sin(o); + _z = caster->GetPositionZ()+frand(-10.0f, 15.0f); + GetSpell()->m_targets.SetDst(_x, _y, _z, 0.0f, caster->GetMapId()); + return SPELL_CAST_OK; } - void ChangeDest(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - Unit* caster = GetCaster(); - if (Creature* trigger = caster->SummonCreature(23356, _x, _y, _z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1500)) - { - trigger->CastSpell(trigger, GetSpellInfo()->Effects[effIndex].TriggerSpell, true); - if (GetSpellInfo()->Effects[effIndex].TriggerSpell == 41064) - trigger->CastSpell(trigger, 41284, true); - } + void ChangeDest(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Unit* caster = GetCaster(); + if (Creature* trigger = caster->SummonCreature(23356, _x, _y, _z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1500)) + { + trigger->CastSpell(trigger, GetSpellInfo()->Effects[effIndex].TriggerSpell, true); + if (GetSpellInfo()->Effects[effIndex].TriggerSpell == 41064) + trigger->CastSpell(trigger, 41284, true); + } - } + } void Register() { OnCheckCast += SpellCheckCastFn(spell_quest_dragonmaw_race_generic_SpellScript::RelocateDest); - OnEffectHit += SpellEffectFn(spell_quest_dragonmaw_race_generic_SpellScript::ChangeDest, EFFECT_0, SPELL_EFFECT_TRIGGER_MISSILE); + OnEffectHit += SpellEffectFn(spell_quest_dragonmaw_race_generic_SpellScript::ChangeDest, EFFECT_0, SPELL_EFFECT_TRIGGER_MISSILE); } - private: - float _x, _y, _z; + private: + float _x, _y, _z; }; SpellScript* GetSpellScript() const @@ -668,23 +668,23 @@ class spell_q11670_it_was_the_orcs_honest : public SpellScriptLoader public: spell_q11670_it_was_the_orcs_honest() : SpellScriptLoader("spell_q11670_it_was_the_orcs_honest") { } - class spell_q11670_it_was_the_orcs_honest_SpellScript : public SpellScript + class spell_q11670_it_was_the_orcs_honest_SpellScript : public SpellScript { PrepareSpellScript(spell_q11670_it_was_the_orcs_honest_SpellScript); void HandleScriptEffect() { - if (GetSpellInfo()->Id != 45759) - return; + if (GetSpellInfo()->Id != 45759) + return; - if (Unit* caster = GetCaster()) - caster->CastSpell(caster, caster->getGender() == GENDER_MALE ? 45760 : 45762, true); + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, caster->getGender() == GENDER_MALE ? 45760 : 45762, true); } - SpellCastResult CheckTarget() + SpellCastResult CheckTarget() { - if (GetSpellInfo()->Id != 45742) - return SPELL_CAST_OK; + if (GetSpellInfo()->Id != 45742) + return SPELL_CAST_OK; if (!GetCaster() || !GetCaster()->HasAura((GetCaster()->getGender() == GENDER_MALE ? 45760 : 45762))) { @@ -697,12 +697,12 @@ public: void Register() { - OnCheckCast += SpellCheckCastFn(spell_q11670_it_was_the_orcs_honest_SpellScript::CheckTarget); + OnCheckCast += SpellCheckCastFn(spell_q11670_it_was_the_orcs_honest_SpellScript::CheckTarget); AfterHit += SpellHitFn(spell_q11670_it_was_the_orcs_honest_SpellScript::HandleScriptEffect); } }; - SpellScript* GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_q11670_it_was_the_orcs_honest_SpellScript(); }; @@ -710,37 +710,37 @@ public: enum eTestFlight { - SPELL_CANNON_CHARGING_SELF = 36860, - SPELL_TELEPORT_VISUAL = 35517, - SPELL_CANNON_CHARGING_PORT = 36801, - SPELL_CANNON_CHARGING_STATE2 = 36790, - SPELL_CANNON_CHARGING_STATE3 = 36792, - SPELL_CANNON_CHARGING_STATE4 = 36800, - SPELL_CANNON_CHANNEL = 36795, - SPELL_ZEPHYRIUM_CHARGED = 37108, + SPELL_CANNON_CHARGING_SELF = 36860, + SPELL_TELEPORT_VISUAL = 35517, + SPELL_CANNON_CHARGING_PORT = 36801, + SPELL_CANNON_CHARGING_STATE2 = 36790, + SPELL_CANNON_CHARGING_STATE3 = 36792, + SPELL_CANNON_CHARGING_STATE4 = 36800, + SPELL_CANNON_CHANNEL = 36795, + SPELL_ZEPHYRIUM_CHARGED = 37108, - SPELL_SOARING_10557 = 37910, - SPELL_SOARING_10710 = 37962, - SPELL_SOARING_10711 = 36812, - SPELL_SOARING_10712 = 37968, - SPELL_SOARING_10716 = 37940, + SPELL_SOARING_10557 = 37910, + SPELL_SOARING_10710 = 37962, + SPELL_SOARING_10711 = 36812, + SPELL_SOARING_10712 = 37968, + SPELL_SOARING_10716 = 37940, - NPC_CANNON = 21393, - NPC_CANNON_TARGET = 21394, - NPC_GNOME_SHOOTER = 21413, + NPC_CANNON = 21393, + NPC_CANNON_TARGET = 21394, + NPC_GNOME_SHOOTER = 21413, - QUEST_TF_ZEPHYRIUM_CAPACITORIUM = 10557, - QUEST_TF_SINGING_RIDGE = 10710, - QUEST_TF_RAZAANS_LANDING = 10711, - QUEST_TF_RUUAN_WEALD = 10712, + QUEST_TF_ZEPHYRIUM_CAPACITORIUM = 10557, + QUEST_TF_SINGING_RIDGE = 10710, + QUEST_TF_RAZAANS_LANDING = 10711, + QUEST_TF_RUUAN_WEALD = 10712, }; static Position ShooterPos[] = { - {1920.91f, 5579.68f, 269.23f, 1.93f}, - {1921.01f, 5585.01f, 269.23f, 4.42f}, - {1917.48f, 5583.55f, 269.23f, 5.71f}, - {1917.16f, 5581.52f, 269.23f, 0.11f}, + {1920.91f, 5579.68f, 269.23f, 1.93f}, + {1921.01f, 5585.01f, 269.23f, 4.42f}, + {1917.48f, 5583.55f, 269.23f, 5.71f}, + {1917.16f, 5581.52f, 269.23f, 0.11f}, }; class spell_quest_test_flight_charging : public SpellScriptLoader @@ -752,72 +752,72 @@ public: { PrepareAuraScript(spell_quest_test_flight_charging_AuraScript) - void OnApplySelf(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->CastSpell(GetTarget(), SPELL_TELEPORT_VISUAL, true); - GetTarget()->CastSpell(GetTarget(), SPELL_CANNON_CHARGING_PORT, true); - } - - void PerformKick() - { - if (Player* player = GetTarget()->ToPlayer()) - { - Creature* shooter = player->FindNearestCreature(NPC_GNOME_SHOOTER, 20.0f); - if (!shooter) - return; - - uint8 task = 0; - uint32 spellId = 0; - for (; task < 4; ++task) - if (shooter->GetDistance(ShooterPos[task]) < 1.0f) - break; - - switch (task) - { - case 0: spellId = SPELL_SOARING_10557; break; - case 1: spellId = SPELL_SOARING_10710; break; - case 2: spellId = SPELL_SOARING_10711; break; - case 3: spellId = SPELL_SOARING_10712; break; - } - - player->RemoveAurasDueToSpell(SPELL_CANNON_CHARGING_PORT); - shooter->CastSpell(player, spellId, true); - } - } - - void HandleEffectPeriodicSelf(AuraEffect const * aurEff) + void OnApplySelf(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (aurEff->GetTickNumber() == 1) - { - GetTarget()->SummonCreature(NPC_CANNON_TARGET, 1919.99f, 5581.97f, 272.30f, 5.27f, TEMPSUMMON_TIMED_DESPAWN, 12000); - if (Creature* cannon = GetTarget()->FindNearestCreature(NPC_CANNON, 40.0f)) - cannon->CastSpell(cannon, SPELL_CANNON_CHANNEL, false); - } - if (aurEff->GetTickNumber() == 6) - PerformKick(); + GetTarget()->CastSpell(GetTarget(), SPELL_TELEPORT_VISUAL, true); + GetTarget()->CastSpell(GetTarget(), SPELL_CANNON_CHARGING_PORT, true); } - void HandleEffectPeriodicPlatform(AuraEffect const * aurEff) + void PerformKick() { - if (aurEff->GetTickNumber() == 1) - GetTarget()->CastSpell(GetTarget(), SPELL_CANNON_CHARGING_STATE2, true); - else if (aurEff->GetTickNumber() == 2) - GetTarget()->CastSpell(GetTarget(), SPELL_CANNON_CHARGING_STATE3, true); - else if (aurEff->GetTickNumber() == 3) - GetTarget()->CastSpell(GetTarget(), SPELL_CANNON_CHARGING_STATE4, true); - else if (aurEff->GetTickNumber() == 5) - GetTarget()->CastSpell(GetTarget(), SPELL_TELEPORT_VISUAL, true); + if (Player* player = GetTarget()->ToPlayer()) + { + Creature* shooter = player->FindNearestCreature(NPC_GNOME_SHOOTER, 20.0f); + if (!shooter) + return; + + uint8 task = 0; + uint32 spellId = 0; + for (; task < 4; ++task) + if (shooter->GetDistance(ShooterPos[task]) < 1.0f) + break; + + switch (task) + { + case 0: spellId = SPELL_SOARING_10557; break; + case 1: spellId = SPELL_SOARING_10710; break; + case 2: spellId = SPELL_SOARING_10711; break; + case 3: spellId = SPELL_SOARING_10712; break; + } + + player->RemoveAurasDueToSpell(SPELL_CANNON_CHARGING_PORT); + shooter->CastSpell(player, spellId, true); + } + } + + void HandleEffectPeriodicSelf(AuraEffect const * aurEff) + { + if (aurEff->GetTickNumber() == 1) + { + GetTarget()->SummonCreature(NPC_CANNON_TARGET, 1919.99f, 5581.97f, 272.30f, 5.27f, TEMPSUMMON_TIMED_DESPAWN, 12000); + if (Creature* cannon = GetTarget()->FindNearestCreature(NPC_CANNON, 40.0f)) + cannon->CastSpell(cannon, SPELL_CANNON_CHANNEL, false); + } + if (aurEff->GetTickNumber() == 6) + PerformKick(); + } + + void HandleEffectPeriodicPlatform(AuraEffect const * aurEff) + { + if (aurEff->GetTickNumber() == 1) + GetTarget()->CastSpell(GetTarget(), SPELL_CANNON_CHARGING_STATE2, true); + else if (aurEff->GetTickNumber() == 2) + GetTarget()->CastSpell(GetTarget(), SPELL_CANNON_CHARGING_STATE3, true); + else if (aurEff->GetTickNumber() == 3) + GetTarget()->CastSpell(GetTarget(), SPELL_CANNON_CHARGING_STATE4, true); + else if (aurEff->GetTickNumber() == 5) + GetTarget()->CastSpell(GetTarget(), SPELL_TELEPORT_VISUAL, true); } void Register() { - if (m_scriptSpellId == SPELL_CANNON_CHARGING_SELF) - { - OnEffectApply += AuraEffectApplyFn(spell_quest_test_flight_charging_AuraScript::OnApplySelf, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - OnEffectPeriodic += AuraEffectPeriodicFn(spell_quest_test_flight_charging_AuraScript::HandleEffectPeriodicSelf, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - else - OnEffectPeriodic += AuraEffectPeriodicFn(spell_quest_test_flight_charging_AuraScript::HandleEffectPeriodicPlatform, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + if (m_scriptSpellId == SPELL_CANNON_CHARGING_SELF) + { + OnEffectApply += AuraEffectApplyFn(spell_quest_test_flight_charging_AuraScript::OnApplySelf, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_quest_test_flight_charging_AuraScript::HandleEffectPeriodicSelf, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + else + OnEffectPeriodic += AuraEffectPeriodicFn(spell_quest_test_flight_charging_AuraScript::HandleEffectPeriodicPlatform, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -829,7 +829,7 @@ public: enum qFallFromGrace { - SPELL_SCARLET_RAVEN_PRIEST_IMAGE_MALE = 48763, + SPELL_SCARLET_RAVEN_PRIEST_IMAGE_MALE = 48763, SPELL_SCARLET_RAVEN_PRIEST_IMAGE_FEMALE = 48761 }; @@ -882,17 +882,17 @@ public: PrepareSpellScript(spell_q13369_fate_up_against_your_will_SpellScript) void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - GetCaster()->CastSpell(GetCaster(), GetEffectValue(), true); + { + PreventHitDefaultEffect(effIndex); + GetCaster()->CastSpell(GetCaster(), GetEffectValue(), true); } - SpellCastResult CheckRequirement() + SpellCastResult CheckRequirement() { - // Fate, Up Against Your Will (13369) + // Fate, Up Against Your Will (13369) if (Unit* caster = GetCaster()) - if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->GetQuestStatus(13369) >= QUEST_STATUS_COMPLETE) - return SPELL_CAST_OK; + if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->GetQuestStatus(13369) >= QUEST_STATUS_COMPLETE) + return SPELL_CAST_OK; return SPELL_FAILED_DONT_REPORT; } @@ -919,12 +919,12 @@ public: PrepareSpellScript(spell_q11198_take_down_tethyr_SpellScript) void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - if (Unit* unit = GetHitUnit()) - if (unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) - return; - GetCaster()->CastCustomSpell(42576 /*SPELL_CANNON_BLAST*/, SPELLVALUE_BASE_POINT0, GetEffectValue(), GetCaster(), true); + { + PreventHitDefaultEffect(effIndex); + if (Unit* unit = GetHitUnit()) + if (unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) + return; + GetCaster()->CastCustomSpell(42576 /*SPELL_CANNON_BLAST*/, SPELLVALUE_BASE_POINT0, GetEffectValue(), GetCaster(), true); } void Register() @@ -949,9 +949,9 @@ public: PrepareSpellScript(spell_q11653_youre_not_so_big_now_SpellScript) void HandleScript(SpellEffIndex effIndex) - { - PreventHitDefaultEffect(effIndex); - Unit* target = GetHitUnit(); + { + PreventHitDefaultEffect(effIndex); + Unit* target = GetHitUnit(); if (!target || target->GetTypeId() != TYPEID_UNIT) return; @@ -973,10 +973,10 @@ public: 45673 // Polymorph }; - if (roll_chance_i(30)) - GetCaster()->CastSpell(GetCaster(), spellPlayer[urand(0, 4)], true); - else - target->CastSpell(target, spellTarget[urand(0, 4)], true); + if (roll_chance_i(30)) + GetCaster()->CastSpell(GetCaster(), spellPlayer[urand(0, 4)], true); + else + target->CastSpell(target, spellTarget[urand(0, 4)], true); } void Register() @@ -1000,15 +1000,15 @@ class spell_q10985_light_of_the_naaru : public SpellScriptLoader { PrepareAuraScript(spell_q10985_light_of_the_naaru_AuraScript); - bool CheckProc(ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - Unit* target = eventInfo.GetActionTarget(); - return target && target->getFaction() == 1843; // Xinef: Illidari demons faction + Unit* target = eventInfo.GetActionTarget(); + return target && target->getFaction() == 1843; // Xinef: Illidari demons faction } void Register() { - DoCheckProc += AuraCheckProcFn(spell_q10985_light_of_the_naaru_AuraScript::CheckProc); + DoCheckProc += AuraCheckProcFn(spell_q10985_light_of_the_naaru_AuraScript::CheckProc); } }; @@ -3028,29 +3028,29 @@ class spell_q12919_gymers_throw : public SpellScriptLoader void AddSC_quest_spell_scripts() { - // Ours - new spell_q11065_wrangle_some_aether_rays(); - new spell_image_of_drakuru_reagent_check(); - new spell_q12014_steady_as_a_rock(); - new spell_q11026_a11051_banish_the_demons(); - new spell_q10525_vision_guide(); - new spell_q11322_q11317_the_cleansing(); - new spell_q10714_on_spirits_wings(); - new spell_q10720_the_smallest_creature(); - new spell_q13086_last_line_of_defence(); - new spell_q12943_shadow_vault_decree(); - new spell_q10769_dissension_amongst_the_ranks(); - new spell_q11520_discovering_your_roots(); - new spell_quest_dragonmaw_race_generic(); - new spell_q11670_it_was_the_orcs_honest(); - new spell_quest_test_flight_charging(); - new spell_q12274_a_fall_from_grace_costume(); - new spell_q13369_fate_up_against_your_will(); - new spell_q11198_take_down_tethyr(); - new spell_q11653_youre_not_so_big_now(); - new spell_q10985_light_of_the_naaru(); + // Ours + new spell_q11065_wrangle_some_aether_rays(); + new spell_image_of_drakuru_reagent_check(); + new spell_q12014_steady_as_a_rock(); + new spell_q11026_a11051_banish_the_demons(); + new spell_q10525_vision_guide(); + new spell_q11322_q11317_the_cleansing(); + new spell_q10714_on_spirits_wings(); + new spell_q10720_the_smallest_creature(); + new spell_q13086_last_line_of_defence(); + new spell_q12943_shadow_vault_decree(); + new spell_q10769_dissension_amongst_the_ranks(); + new spell_q11520_discovering_your_roots(); + new spell_quest_dragonmaw_race_generic(); + new spell_q11670_it_was_the_orcs_honest(); + new spell_quest_test_flight_charging(); + new spell_q12274_a_fall_from_grace_costume(); + new spell_q13369_fate_up_against_your_will(); + new spell_q11198_take_down_tethyr(); + new spell_q11653_youre_not_so_big_now(); + new spell_q10985_light_of_the_naaru(); - // Theirs + // Theirs new spell_q55_sacred_cleansing(); new spell_q2203_thaumaturgy_channel(); new spell_q5206_test_fetid_skull(); diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 2c0eb7f90..63a3a79e6 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -32,7 +32,7 @@ enum RogueSpells { SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK = 22482, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN = 31231, - SPELL_ROGUE_CHEATING_DEATH = 45182, + SPELL_ROGUE_CHEATING_DEATH = 45182, SPELL_ROGUE_GLYPH_OF_PREPARATION = 56819, SPELL_ROGUE_KILLING_SPREE = 51690, SPELL_ROGUE_KILLING_SPREE_TELEPORT = 57840, @@ -62,12 +62,12 @@ public: void Update(AuraEffect* auraEffect) { - Unit::AuraApplicationMap const& auras = GetUnitOwner()->GetAppliedAuras(); - for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) - if (itr->second->GetBase()->GetCasterGUID() == this->GetCasterGUID() && itr->second->GetBase()->GetSpellInfo()->Dispel == DISPEL_POISON) - return; + Unit::AuraApplicationMap const& auras = GetUnitOwner()->GetAppliedAuras(); + for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + if (itr->second->GetBase()->GetCasterGUID() == this->GetCasterGUID() && itr->second->GetBase()->GetSpellInfo()->Dispel == DISPEL_POISON) + return; - SetDuration(0); + SetDuration(0); } void Register() @@ -94,7 +94,7 @@ class spell_rog_combat_potency : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetTypeMask() & PROC_FLAG_DONE_MELEE_AUTO_ATTACK; + return eventInfo.GetTypeMask() & PROC_FLAG_DONE_MELEE_AUTO_ATTACK; } void Register() @@ -137,27 +137,27 @@ class spell_rog_blade_flurry : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { Unit* _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetProcTarget()); - if (_procTarget) - _procTargetGUID = _procTarget->GetGUID(); + if (_procTarget) + _procTargetGUID = _procTarget->GetGUID(); return _procTarget; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - // Xinef: no _procTarget but checkproc passed?? - // Unit::CalculateAOEDamageReduction (this=0x0, damage=4118, schoolMask=1, caster=0x7ffdad089000) - Unit* procTarget = ObjectAccessor::GetUnit(*GetTarget(), _procTargetGUID); + // Xinef: no _procTarget but checkproc passed?? + // Unit::CalculateAOEDamageReduction (this=0x0, damage=4118, schoolMask=1, caster=0x7ffdad089000) + Unit* procTarget = ObjectAccessor::GetUnit(*GetTarget(), _procTargetGUID); if (procTarget && eventInfo.GetDamageInfo()) { int32 damage = eventInfo.GetDamageInfo()->GetDamage(); - // Xinef: Include AOE Damage Reduction auras - damage = procTarget->CalculateAOEDamageReduction(damage, SPELL_SCHOOL_MASK_NORMAL, GetTarget()); + // Xinef: Include AOE Damage Reduction auras + damage = procTarget->CalculateAOEDamageReduction(damage, SPELL_SCHOOL_MASK_NORMAL, GetTarget()); - CustomSpellValues values; - values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage); - values.AddSpellMod(SPELLVALUE_FORCED_CRIT_RESULT, int32(eventInfo.GetHitMask() & PROC_EX_CRITICAL_HIT)); - GetTarget()->CastCustomSpell(SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK, values, procTarget, TRIGGERED_FULL_MASK, NULL, aurEff); + CustomSpellValues values; + values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage); + values.AddSpellMod(SPELLVALUE_FORCED_CRIT_RESULT, int32(eventInfo.GetHitMask() & PROC_EX_CRITICAL_HIT)); + GetTarget()->CastCustomSpell(SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK, values, procTarget, TRIGGERED_FULL_MASK, NULL, aurEff); } } @@ -214,9 +214,9 @@ class spell_rog_cheat_death : public SpellScriptLoader if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance)) return; - target->CastSpell(target, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, true); - target->CastSpell(target, SPELL_ROGUE_CHEATING_DEATH, true); - target->AddSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, MINUTE*IN_MILLISECONDS); + target->CastSpell(target, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, true); + target->CastSpell(target, SPELL_ROGUE_CHEATING_DEATH, true); + target->AddSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, MINUTE*IN_MILLISECONDS); uint32 health10 = target->CountPctFromMaxHealth(10); @@ -232,7 +232,7 @@ class spell_rog_cheat_death : public SpellScriptLoader { DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_cheat_death_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_cheat_death_AuraScript::Absorb, EFFECT_0); - } + } }; AuraScript* GetAuraScript() const @@ -346,24 +346,24 @@ class spell_rog_killing_spree : public SpellScriptLoader { PrepareSpellScript(spell_rog_killing_spree_SpellScript); - SpellCastResult CheckCast() + SpellCastResult CheckCast() { - // Kologarn area, Killing Spree should not work - if (GetCaster()->GetMapId() == 603 /*Ulduar*/ && GetCaster()->GetDistance2d(1766.936f, -24.748f) < 50.0f) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - return SPELL_CAST_OK; - } + // Kologarn area, Killing Spree should not work + if (GetCaster()->GetMapId() == 603 /*Ulduar*/ && GetCaster()->GetDistance2d(1766.936f, -24.748f) < 50.0f) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + return SPELL_CAST_OK; + } void FilterTargets(std::list& targets) { if (targets.empty() || GetCaster()->GetVehicleBase() || GetCaster()->HasUnitState(UNIT_STATE_ROOT)) FinishCast(SPELL_FAILED_OUT_OF_RANGE); - else - { - // Added attribute not breaking stealth, removes auras here - GetCaster()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST); - GetCaster()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK); - } + else + { + // Added attribute not breaking stealth, removes auras here + GetCaster()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST); + GetCaster()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK); + } } void HandleDummy(SpellEffIndex /*effIndex*/) @@ -413,12 +413,12 @@ class spell_rog_killing_spree : public SpellScriptLoader uint64 guid = Trinity::Containers::SelectRandomContainerElement(_targets); if (Unit* target = ObjectAccessor::GetUnit(*GetTarget(), guid)) { - // xinef: target may be no longer valid - if (!GetTarget()->IsValidAttackTarget(target)) - { - _targets.remove(guid); - continue; - } + // xinef: target may be no longer valid + if (!GetTarget()->IsValidAttackTarget(target)) + { + _targets.remove(guid); + continue; + } GetTarget()->CastSpell(target, SPELL_ROGUE_KILLING_SPREE_TELEPORT, true); @@ -530,41 +530,41 @@ class spell_rog_preparation : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - Player* caster = GetCaster()->ToPlayer(); - //immediately finishes the cooldown on certain Rogue abilities + Player* caster = GetCaster()->ToPlayer(); + //immediately finishes the cooldown on certain Rogue abilities - bool hasGlyph = caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION); - PlayerSpellMap const& spellMap = caster->GetSpellMap(); - for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE) - { - if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep - spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint - { - SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id); - if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient) - caster->RemoveSpellCooldown(spellInfo->Id, true); - else - caster->RemoveSpellCooldown(spellInfo->Id, false); - } - else if (hasGlyph) - { - if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle - spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick - (spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry - spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY)) - { - SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id); - if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient) - caster->RemoveSpellCooldown(spellInfo->Id, true); - else - caster->RemoveSpellCooldown(spellInfo->Id, false); - } - } - } - } + bool hasGlyph = caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION); + PlayerSpellMap const& spellMap = caster->GetSpellMap(); + for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr) + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); + if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE) + { + if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep + spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint + { + SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id); + if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient) + caster->RemoveSpellCooldown(spellInfo->Id, true); + else + caster->RemoveSpellCooldown(spellInfo->Id, false); + } + else if (hasGlyph) + { + if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle + spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick + (spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry + spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY)) + { + SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id); + if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient) + caster->RemoveSpellCooldown(spellInfo->Id, true); + else + caster->RemoveSpellCooldown(spellInfo->Id, false); + } + } + } + } } void Register() @@ -600,8 +600,8 @@ class spell_rog_prey_on_the_weak : public SpellScriptLoader { Unit* target = GetTarget(); Unit* victim = target->GetVictim(); - if (!victim && target->GetTypeId() == TYPEID_PLAYER) - victim = target->ToPlayer()->GetSelectedUnit(); + if (!victim && target->GetTypeId() == TYPEID_PLAYER) + victim = target->ToPlayer()->GetSelectedUnit(); if (victim && (target->GetHealthPct() > victim->GetHealthPct())) { @@ -813,11 +813,11 @@ class spell_rog_tricks_of_the_trade_proc : public SpellScriptLoader void AddSC_rogue_spell_scripts() { - // Ours - new spell_rog_savage_combat(); - new spell_rog_combat_potency(); + // Ours + new spell_rog_savage_combat(); + new spell_rog_combat_potency(); - // Theirs + // Theirs new spell_rog_blade_flurry(); new spell_rog_cheat_death(); new spell_rog_deadly_poison(); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 7b6178f8e..e9b1dbd74 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -30,10 +30,10 @@ enum ShamanSpells { - // Ours - SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT = 63271, + // Ours + SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT = 63271, - // Theirs + // Theirs SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC = 52752, SPELL_SHAMAN_BIND_SIGHT = 6277, SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT = 52025, @@ -79,14 +79,14 @@ class spell_sha_totem_of_wrath : public SpellScriptLoader void HandleAfterCast() { - if (AuraEffect* aurEff = GetCaster()->GetAuraEffect(63280, EFFECT_0)) + if (AuraEffect* aurEff = GetCaster()->GetAuraEffect(63280, EFFECT_0)) if (Creature* totem = GetCaster()->GetMap()->GetCreature(GetCaster()->m_SummonSlot[1])) // Fire totem summon slot if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(totem->m_spells[0])) { int32 bp0 = CalculatePct(totemSpell->Effects[EFFECT_0].CalcValue(), aurEff->GetAmount()); int32 bp1 = CalculatePct(totemSpell->Effects[EFFECT_1].CalcValue(), aurEff->GetAmount()); GetCaster()->CastCustomSpell(GetCaster(), 63283, &bp0, &bp1, NULL, true); - } + } } void Register() @@ -113,8 +113,8 @@ class spell_sha_spirit_walk : public SpellScriptLoader SpellCastResult CheckCast() { if (Unit* owner = GetCaster()->GetOwner()) - if (GetCaster()->IsWithinDist(owner, GetSpellInfo()->GetMaxRange(GetSpellInfo()->IsPositive()))) - return SPELL_CAST_OK; + if (GetCaster()->IsWithinDist(owner, GetSpellInfo()->GetMaxRange(GetSpellInfo()->IsPositive()))) + return SPELL_CAST_OK; return SPELL_FAILED_OUT_OF_RANGE; } @@ -142,17 +142,17 @@ class spell_sha_t10_restoration_4p_bonus : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetActor() && eventInfo.GetProcTarget(); + return eventInfo.GetActor() && eventInfo.GetProcTarget(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - uint32 triggered_spell_id = 70809; + uint32 triggered_spell_id = 70809; SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id); - int32 amount = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / triggeredSpell->GetMaxTicks(); - eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(GetTarget(), triggered_spell_id, SPELL_AURA_PERIODIC_HEAL, amount, EFFECT_0); + int32 amount = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / triggeredSpell->GetMaxTicks(); + eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(GetTarget(), triggered_spell_id, SPELL_AURA_PERIODIC_HEAL, amount, EFFECT_0); } void Register() @@ -183,7 +183,7 @@ class spell_sha_totemic_mastery : public SpellScriptLoader for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) if (!GetTarget()->m_SummonSlot[i]) - return; + return; GetTarget()->CastSpell(GetTarget(), 38437, true); } @@ -211,111 +211,111 @@ class spell_sha_feral_spirit_scaling : public SpellScriptLoader void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: feral spirit inherits 40% of resistance from owner and 35% of armor - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; - amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); - } + // xinef: feral spirit inherits 40% of resistance from owner and 35% of armor + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; + amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); + } } void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: by default feral spirit inherits 30% of stamina - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); - } + // xinef: by default feral spirit inherits 30% of stamina + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); + } } - void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: by default feral spirit inherits 30% of AP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 modifier = 30; - if (AuraEffect const* gofsEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT, EFFECT_0)) - modifier += gofsEff->GetAmount(); + // xinef: by default feral spirit inherits 30% of AP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 modifier = 30; + if (AuraEffect const* gofsEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT, EFFECT_0)) + modifier += gofsEff->GetAmount(); - amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier); - } + amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier); + } } - void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: by default feral spirit inherits 30% of AP as SP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 modifier = 30; - if (AuraEffect const* gofsEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT, EFFECT_0)) - modifier += gofsEff->GetAmount(); + // xinef: by default feral spirit inherits 30% of AP as SP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 modifier = 30; + if (AuraEffect const* gofsEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT, EFFECT_0)) + modifier += gofsEff->GetAmount(); - amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier); + amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier); - // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); - } + // xinef: Update appropriate player field + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); + } } - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); - else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); + else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); + } - void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) { isPeriodic = true; amplitude = 1*IN_MILLISECONDS; } - + void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) - { - int32 currentAmount = aurEff->GetAmount(); - int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); - if (newAmount != currentAmount) - { - if (aurEff->GetMiscValue() == STAT_STAMINA) - { - uint32 actStat = GetUnitOwner()->GetHealth(); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); - } - else - { - uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); - } - } - } - else - GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) + { + int32 currentAmount = aurEff->GetAmount(); + int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); + if (newAmount != currentAmount) + { + if (aurEff->GetMiscValue() == STAT_STAMINA) + { + uint32 actStat = GetUnitOwner()->GetHealth(); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); + } + else + { + uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); + } + } + } + else + GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); } void Register() { - if (m_scriptSpellId == 35675 || m_scriptSpellId == 35675) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); + if (m_scriptSpellId == 35675 || m_scriptSpellId == 35675) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); - if (m_scriptSpellId == 35674) - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); - } + if (m_scriptSpellId == 35674) + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); + } - OnEffectApply += AuraEffectApplyFn(spell_sha_feral_spirit_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_sha_feral_spirit_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); + OnEffectApply += AuraEffectApplyFn(spell_sha_feral_spirit_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_sha_feral_spirit_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_feral_spirit_scaling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY); } }; @@ -337,73 +337,73 @@ class spell_sha_fire_elemental_scaling : public SpellScriptLoader void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: fire elemental inherits 40% of resistance from owner and 35% of armor - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; - amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); - } + // xinef: fire elemental inherits 40% of resistance from owner and 35% of armor + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; + amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); + } } void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: fire elemental inherits 30% of intellect / stamina - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); - } + // xinef: fire elemental inherits 30% of intellect / stamina + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + amount = CalculatePct(std::max(0, owner->GetStat(stat)), 30); + } } - void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: fire elemental inherits 300% / 150% of SP as AP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); - amount = CalculatePct(std::max(0, fire), (GetUnitOwner()->GetEntry() == NPC_FIRE_ELEMENTAL ? 300 : 150)); - } + // xinef: fire elemental inherits 300% / 150% of SP as AP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); + amount = CalculatePct(std::max(0, fire), (GetUnitOwner()->GetEntry() == NPC_FIRE_ELEMENTAL ? 300 : 150)); + } } - void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: fire elemental inherits 100% of SP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); - amount = CalculatePct(std::max(0, fire), 100); + // xinef: fire elemental inherits 100% of SP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); + amount = CalculatePct(std::max(0, fire), 100); - // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); - } + // xinef: Update appropriate player field + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); + } } - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); - else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); + else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); + } void Register() { - if (m_scriptSpellId != 35665 && m_scriptSpellId != 65225) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); + if (m_scriptSpellId != 35665 && m_scriptSpellId != 65225) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); - if (m_scriptSpellId == 35666 || m_scriptSpellId == 65226) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); + if (m_scriptSpellId == 35666 || m_scriptSpellId == 65226) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); - if (m_scriptSpellId == 35665 || m_scriptSpellId == 65225) - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); - } + if (m_scriptSpellId == 35665 || m_scriptSpellId == 65225) + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); + } - OnEffectApply += AuraEffectApplyFn(spell_sha_fire_elemental_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_sha_fire_elemental_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); } }; @@ -658,9 +658,9 @@ class spell_sha_earth_shield : public SpellScriptLoader { if (Unit* caster = GetCaster()) { - int32 baseAmount = amount; + int32 baseAmount = amount; amount = caster->SpellHealingBonusDone(GetUnitOwner(), GetSpellInfo(), amount, HEAL); - // xinef: taken should be calculated at every heal + // xinef: taken should be calculated at every heal //amount = GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, HEAL); // Glyph of Earth Shield @@ -669,17 +669,17 @@ class spell_sha_earth_shield : public SpellScriptLoader if (AuraEffect* glyphe = caster->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_EARTH_SHIELD, EFFECT_0)) AddPct(amount, glyphe->GetAmount()); - // xinef: Improved Shields - if (baseAmount = amount - baseAmount) - if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_SHAMAN, 19, EFFECT_1)) - { - ApplyPct(baseAmount, aurEff->GetAmount()); - amount += baseAmount; - } + // xinef: Improved Shields + if (baseAmount = amount - baseAmount) + if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_SHAMAN, 19, EFFECT_1)) + { + ApplyPct(baseAmount, aurEff->GetAmount()); + amount += baseAmount; + } } } - bool CheckProc(ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { return !GetTarget()->HasSpellCooldown(SPELL_SHAMAN_EARTH_SHIELD_HEAL); } @@ -1354,15 +1354,15 @@ class spell_sha_thunderstorm : public SpellScriptLoader void AddSC_shaman_spell_scripts() { - // ours - new spell_sha_totem_of_wrath(); - new spell_sha_spirit_walk(); - new spell_sha_t10_restoration_4p_bonus(); - new spell_sha_totemic_mastery(); - new spell_sha_feral_spirit_scaling(); - new spell_sha_fire_elemental_scaling(); + // ours + new spell_sha_totem_of_wrath(); + new spell_sha_spirit_walk(); + new spell_sha_t10_restoration_4p_bonus(); + new spell_sha_totemic_mastery(); + new spell_sha_feral_spirit_scaling(); + new spell_sha_fire_elemental_scaling(); - // theirs + // theirs new spell_sha_ancestral_awakening_proc(); new spell_sha_astral_shift(); new spell_sha_bloodlust(); diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 21b2aee53..22f709538 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -73,42 +73,42 @@ class spell_warl_eye_of_kilrogg : public SpellScriptLoader { PrepareAuraScript(spell_warl_eye_of_kilrogg_AuraScript); - void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - PreventDefaultAction(); + PreventDefaultAction(); if (Player* player = GetTarget()->ToPlayer()) - { + { player->UnsummonPetTemporaryIfAny(); - // Glyph of Kilrogg - if (player->HasAura(58081)) - if (Unit* charm = player->GetCharm()) - { - charm->SetSpeed(MOVE_RUN, 2.14f, true); - if (charm->GetMapId() == 530 || charm->GetMapId() == 571) - { - charm->SetCanFly(true); - charm->SetSpeed(MOVE_FLIGHT, 2.14f, true); - charm->SendMovementFlagUpdate(); - } - } - } + // Glyph of Kilrogg + if (player->HasAura(58081)) + if (Unit* charm = player->GetCharm()) + { + charm->SetSpeed(MOVE_RUN, 2.14f, true); + if (charm->GetMapId() == 530 || charm->GetMapId() == 571) + { + charm->SetCanFly(true); + charm->SetSpeed(MOVE_FLIGHT, 2.14f, true); + charm->SendMovementFlagUpdate(); + } + } + } } - void HandleAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Player* player = GetTarget()->ToPlayer()) - { - if (Unit* charm = player->GetCharm()) - charm->ToTempSummon()->UnSummon(); + { + if (Unit* charm = player->GetCharm()) + charm->ToTempSummon()->UnSummon(); player->ResummonPetTemporaryUnSummonedIfAny(); - } + } } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_warl_eye_of_kilrogg_AuraScript::HandleAuraApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_warl_eye_of_kilrogg_AuraScript::HandleAuraApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); AfterEffectRemove += AuraEffectRemoveFn(spell_warl_eye_of_kilrogg_AuraScript::HandleAuraRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -130,8 +130,8 @@ class spell_warl_shadowflame : public SpellScriptLoader void HandleSchoolDMG(SpellEffIndex /*effIndex*/) { - if (Unit* target = GetHitUnit()) - GetCaster()->CastSpell(target, (GetSpellInfo()->Id == 47897 ? 47960 : 61291), true); + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, (GetSpellInfo()->Id == 47897 ? 47960 : 61291), true); } void Register() @@ -155,24 +155,24 @@ class spell_warl_seduction : public SpellScriptLoader { PrepareAuraScript(spell_warl_seduction_AuraScript); - void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) - { - if (Unit* owner = caster->GetOwner()) - if (owner->GetAuraEffectDummy(56250)) - { - Unit* target = GetTarget(); - target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed. - target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); - target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH); - } - } + { + if (Unit* owner = caster->GetOwner()) + if (owner->GetAuraEffectDummy(56250)) + { + Unit* target = GetTarget(); + target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed. + target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); + target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH); + } + } } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_warl_seduction_AuraScript::HandleAuraApply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_warl_seduction_AuraScript::HandleAuraApply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); } }; @@ -191,10 +191,10 @@ class spell_warl_improved_demonic_tactics : public SpellScriptLoader { PrepareAuraScript(spell_warl_improved_demonic_tactics_AuraScript); - bool Load() - { - return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; - } + bool Load() + { + return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; + } void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) { @@ -204,10 +204,10 @@ class spell_warl_improved_demonic_tactics : public SpellScriptLoader void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated) { - if (aurEff->GetEffIndex() == EFFECT_0) - amount = CalculatePct(GetUnitOwner()->ToPlayer()->GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + SPELL_SCHOOL_FROST), GetSpellInfo()->Effects[EFFECT_0].CalcValue()); - else - amount = CalculatePct(GetUnitOwner()->ToPlayer()->GetFloatValue(PLAYER_CRIT_PERCENTAGE), GetSpellInfo()->Effects[EFFECT_0].CalcValue()); + if (aurEff->GetEffIndex() == EFFECT_0) + amount = CalculatePct(GetUnitOwner()->ToPlayer()->GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + SPELL_SCHOOL_FROST), GetSpellInfo()->Effects[EFFECT_0].CalcValue()); + else + amount = CalculatePct(GetUnitOwner()->ToPlayer()->GetFloatValue(PLAYER_CRIT_PERCENTAGE), GetSpellInfo()->Effects[EFFECT_0].CalcValue()); } void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod) @@ -215,7 +215,7 @@ class spell_warl_improved_demonic_tactics : public SpellScriptLoader if (!spellMod) { spellMod = new SpellModifier(aurEff->GetBase()); - spellMod->op = SpellModOp(aurEff->GetMiscValue()); + spellMod->op = SpellModOp(aurEff->GetMiscValue()); spellMod->type = SPELLMOD_FLAT; spellMod->spellId = GetId(); spellMod->mask = flag96(0x0, 0x2000, 0x0); // Pet Passive @@ -227,7 +227,7 @@ class spell_warl_improved_demonic_tactics : public SpellScriptLoader void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - GetAura()->GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); + GetAura()->GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); } void Register() @@ -256,10 +256,10 @@ class spell_warl_ritual_of_summoning : public SpellScriptLoader SpellCastResult CheckCast() { - if (GetCaster()->GetTypeId() == TYPEID_PLAYER) - if (GetCaster()->ToPlayer()->InBattleground()) - return SPELL_FAILED_NOT_IN_BATTLEGROUND; - return SPELL_CAST_OK; + if (GetCaster()->GetTypeId() == TYPEID_PLAYER) + if (GetCaster()->ToPlayer()->InBattleground()) + return SPELL_FAILED_NOT_IN_BATTLEGROUND; + return SPELL_CAST_OK; } void Register() @@ -283,15 +283,15 @@ class spell_warl_demonic_aegis : public SpellScriptLoader { PrepareAuraScript(spell_warl_demonic_aegis_AuraScript); - void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - // Remove Fel Armor and Demon Armor - GetTarget()->RemoveAurasWithFamily(SPELLFAMILY_WARLOCK, 0, 0x20000020, 0, 0); + // Remove Fel Armor and Demon Armor + GetTarget()->RemoveAurasWithFamily(SPELLFAMILY_WARLOCK, 0, 0x20000020, 0, 0); } void Register() { - OnEffectRemove += AuraEffectRemoveFn(spell_warl_demonic_aegis_AuraScript::HandleAuraApply, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_warl_demonic_aegis_AuraScript::HandleAuraApply, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER, AURA_EFFECT_HANDLE_REAL); } }; @@ -312,26 +312,26 @@ class spell_warl_demonic_knowledge : public SpellScriptLoader void CalculateAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - if (Unit* caster = GetCaster()) - amount = CalculatePct(caster->GetStat(STAT_STAMINA)+caster->GetStat(STAT_INTELLECT), aurEff->GetBaseAmount()); + if (Unit* caster = GetCaster()) + amount = CalculatePct(caster->GetStat(STAT_STAMINA)+caster->GetStat(STAT_INTELLECT), aurEff->GetBaseAmount()); } - void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) { isPeriodic = true; amplitude = 5*IN_MILLISECONDS; } - + void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); + GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); } void Register() { DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_demonic_knowledge_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE); - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_warl_demonic_knowledge_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_warl_demonic_knowledge_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE); OnEffectPeriodic += AuraEffectPeriodicFn(spell_warl_demonic_knowledge_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE); } }; @@ -353,102 +353,102 @@ class spell_warl_generic_scaling : public SpellScriptLoader void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: pet inherits 40% of resistance from owner and 35% of armor - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; - amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); - } + // xinef: pet inherits 40% of resistance from owner and 35% of armor + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; + amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); + } } void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: by default warlock pet inherits 75% of stamina and 30% of intellect - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = stat == STAT_STAMINA ? 75 : 30; - amount = CalculatePct(std::max(0, owner->GetStat(stat)), modifier); - } + // xinef: by default warlock pet inherits 75% of stamina and 30% of intellect + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = stat == STAT_STAMINA ? 75 : 30; + amount = CalculatePct(std::max(0, owner->GetStat(stat)), modifier); + } } - void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: by default warlock pet inherits 57% of max(SP FIRE, SP SHADOW) as AP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); - int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); - int32 maximum = (fire > shadow) ? fire : shadow; - amount = CalculatePct(std::max(0, maximum), 57); - } + // xinef: by default warlock pet inherits 57% of max(SP FIRE, SP SHADOW) as AP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); + int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); + int32 maximum = (fire > shadow) ? fire : shadow; + amount = CalculatePct(std::max(0, maximum), 57); + } } - void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: by default warlock pet inherits 15% of max(SP FIRE, SP SHADOW) as SP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); - int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); - int32 maximum = (fire > shadow) ? fire : shadow; - amount = CalculatePct(std::max(0, maximum), 15); + // xinef: by default warlock pet inherits 15% of max(SP FIRE, SP SHADOW) as SP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); + int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); + int32 maximum = (fire > shadow) ? fire : shadow; + amount = CalculatePct(std::max(0, maximum), 15); - // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); - } + // xinef: Update appropriate player field + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); + } } - void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) { isPeriodic = true; amplitude = 2*IN_MILLISECONDS; } - + void HandlePeriodic(AuraEffect const* aurEff) { PreventDefaultAction(); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) - { - int32 currentAmount = aurEff->GetAmount(); - int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); - if (newAmount != currentAmount) - { - if (aurEff->GetMiscValue() == STAT_STAMINA) - { - uint32 actStat = GetUnitOwner()->GetHealth(); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); - } - else - { - uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); - GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); - GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); - } - } - } - else - GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT)) + { + int32 currentAmount = aurEff->GetAmount(); + int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster()); + if (newAmount != currentAmount) + { + if (aurEff->GetMiscValue() == STAT_STAMINA) + { + uint32 actStat = GetUnitOwner()->GetHealth(); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetHealth(std::min(GetUnitOwner()->GetMaxHealth(), actStat)); + } + else + { + uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA); + GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false); + GetUnitOwner()->SetPower(POWER_MANA, std::min(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat)); + } + } + } + else + GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); } void Register() { - if (m_scriptSpellId != 34947) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); + if (m_scriptSpellId != 34947) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); - if (m_scriptSpellId == 34947 || m_scriptSpellId == 34956) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); + if (m_scriptSpellId == 34947 || m_scriptSpellId == 34956) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); - if (m_scriptSpellId == 34947) - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); - } + if (m_scriptSpellId == 34947) + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); + } - DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_warl_generic_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_warl_generic_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); OnEffectPeriodic += AuraEffectPeriodicFn(spell_warl_generic_scaling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY); } }; @@ -470,78 +470,78 @@ class spell_warl_infernal_scaling : public SpellScriptLoader void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: pet inherits 40% of resistance from owner and 35% of armor - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; - amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); - } + // xinef: pet inherits 40% of resistance from owner and 35% of armor + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40; + amount = CalculatePct(std::max(0, owner->GetResistance(schoolMask)), modifier); + } } void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: by default warlock pet inherits 75% of stamina and 30% of intellect - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); - int32 modifier = stat == STAT_STAMINA ? 75 : 30; - amount = CalculatePct(std::max(0, owner->GetStat(stat)), modifier); - } + // xinef: by default warlock pet inherits 75% of stamina and 30% of intellect + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue); + int32 modifier = stat == STAT_STAMINA ? 75 : 30; + amount = CalculatePct(std::max(0, owner->GetStat(stat)), modifier); + } } - void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: by default warlock pet inherits 57% of max(SP FIRE, SP SHADOW) as AP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); - int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); - int32 maximum = (fire > shadow) ? fire : shadow; - amount = CalculatePct(std::max(0, maximum), 57); - } + // xinef: by default warlock pet inherits 57% of max(SP FIRE, SP SHADOW) as AP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); + int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); + int32 maximum = (fire > shadow) ? fire : shadow; + amount = CalculatePct(std::max(0, maximum), 57); + } } - void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) + void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/) { - // xinef: by default warlock pet inherits 15% of max(SP FIRE, SP SHADOW) as SP - if (Unit* owner = GetUnitOwner()->GetOwner()) - { - int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); - int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); - int32 maximum = (fire > shadow) ? fire : shadow; - amount = CalculatePct(std::max(0, maximum), 15); + // xinef: by default warlock pet inherits 15% of max(SP FIRE, SP SHADOW) as SP + if (Unit* owner = GetUnitOwner()->GetOwner()) + { + int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE); + int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW); + int32 maximum = (fire > shadow) ? fire : shadow; + amount = CalculatePct(std::max(0, maximum), 15); - // xinef: Update appropriate player field - if (owner->GetTypeId() == TYPEID_PLAYER) - owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); - } + // xinef: Update appropriate player field + if (owner->GetTypeId() == TYPEID_PLAYER) + owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount); + } } - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); - if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); - else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) - GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); - } + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); + if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE); + else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT) + GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE); + } void Register() { - if (m_scriptSpellId != 36186) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); + if (m_scriptSpellId != 36186) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE); - if (m_scriptSpellId == 36186 || m_scriptSpellId == 36188) - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); + if (m_scriptSpellId == 36186 || m_scriptSpellId == 36188) + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); - if (m_scriptSpellId == 36186) - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); - } + if (m_scriptSpellId == 36186) + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); + } - OnEffectApply += AuraEffectApplyFn(spell_warl_infernal_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + OnEffectApply += AuraEffectApplyFn(spell_warl_infernal_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); } }; @@ -765,10 +765,10 @@ class spell_warl_everlasting_affliction : public SpellScriptLoader if (Unit* unitTarget = GetHitUnit()) // Refresh corruption on target if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, GetCaster()->GetGUID())) - { + { aur->GetBase()->RefreshTimersWithMods(); - aur->ChangeAmount(aur->CalculateAmount(aur->GetCaster()), false); - } + aur->ChangeAmount(aur->CalculateAmount(aur->GetCaster()), false); + } } void Register() @@ -1104,7 +1104,7 @@ class spell_warl_fel_synergy : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - // Xinef: Added charm check + // Xinef: Added charm check return (GetTarget()->GetGuardianPet() || GetTarget()->GetCharm()) && eventInfo.GetDamageInfo()->GetDamage(); } @@ -1211,8 +1211,8 @@ class spell_warl_unstable_affliction : public SpellScriptLoader if (Unit* caster = GetCaster()) if (AuraEffect const* aurEff = GetEffect(EFFECT_0)) { - int32 damage = aurEff->GetBaseAmount(); - damage = aurEff->GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, &damage, NULL) * 9; + int32 damage = aurEff->GetBaseAmount(); + damage = aurEff->GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, &damage, NULL) * 9; // backfire damage and silence caster->CastCustomSpell(dispelInfo->GetDispeller(), SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); } @@ -1394,18 +1394,18 @@ class spell_warl_glyph_of_shadowflame : public SpellScriptLoader void AddSC_warlock_spell_scripts() { - // Ours - new spell_warl_eye_of_kilrogg(); - new spell_warl_shadowflame(); - new spell_warl_seduction(); - new spell_warl_improved_demonic_tactics(); - new spell_warl_ritual_of_summoning(); - new spell_warl_demonic_aegis(); - new spell_warl_demonic_knowledge(); - new spell_warl_generic_scaling(); - new spell_warl_infernal_scaling(); + // Ours + new spell_warl_eye_of_kilrogg(); + new spell_warl_shadowflame(); + new spell_warl_seduction(); + new spell_warl_improved_demonic_tactics(); + new spell_warl_ritual_of_summoning(); + new spell_warl_demonic_aegis(); + new spell_warl_demonic_knowledge(); + new spell_warl_generic_scaling(); + new spell_warl_infernal_scaling(); - // Theirs + // Theirs new spell_warl_banish(); new spell_warl_create_healthstone(); new spell_warl_curse_of_doom(); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 7758fdb19..36b2778cc 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -29,12 +29,12 @@ enum WarriorSpells { - // Ours - SPELL_WARRIOR_INTERVENE_TRIGGER = 59667, - SPELL_WARRIOR_SPELL_REFLECTION = 23920, - SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER = 59725, + // Ours + SPELL_WARRIOR_INTERVENE_TRIGGER = 59667, + SPELL_WARRIOR_SPELL_REFLECTION = 23920, + SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER = 59725, - // Theirs + // Theirs SPELL_WARRIOR_BLOODTHIRST = 23885, SPELL_WARRIOR_BLOODTHIRST_DAMAGE = 23881, SPELL_WARRIOR_CHARGE = 34846, @@ -87,9 +87,9 @@ class spell_warr_mocking_blow : public SpellScriptLoader void HandleOnHit() { - if (Unit* target = GetHitUnit()) - if (target->IsImmunedToSpellEffect(GetSpellInfo(), EFFECT_1)) - SetHitDamage(0); + if (Unit* target = GetHitUnit()) + if (target->IsImmunedToSpellEffect(GetSpellInfo(), EFFECT_1)) + SetHitDamage(0); } void Register() @@ -140,23 +140,23 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader { PrepareAuraScript(spell_warr_improved_spell_reflection_AuraScript); - bool CheckProc(ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetDamageInfo()->GetSpellInfo() && eventInfo.GetDamageInfo()->GetSpellInfo()->Id == SPELL_WARRIOR_SPELL_REFLECTION; + return eventInfo.GetDamageInfo()->GetSpellInfo() && eventInfo.GetDamageInfo()->GetSpellInfo()->Id == SPELL_WARRIOR_SPELL_REFLECTION; } void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - CustomSpellValues values; - values.AddSpellMod(SPELLVALUE_MAX_TARGETS, aurEff->GetAmount()); - values.AddSpellMod(SPELLVALUE_RADIUS_MOD, 2000); // Base range = 100, final range = 20 value / 10000.0f = 0.2f - eventInfo.GetActor()->CastCustomSpell(SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER, values, eventInfo.GetActor(), TRIGGERED_FULL_MASK, NULL); + CustomSpellValues values; + values.AddSpellMod(SPELLVALUE_MAX_TARGETS, aurEff->GetAmount()); + values.AddSpellMod(SPELLVALUE_RADIUS_MOD, 2000); // Base range = 100, final range = 20 value / 10000.0f = 0.2f + eventInfo.GetActor()->CastCustomSpell(SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER, values, eventInfo.GetActor(), TRIGGERED_FULL_MASK, NULL); } void Register() { - DoCheckProc += AuraCheckProcFn(spell_warr_improved_spell_reflection_AuraScript::CheckProc); + DoCheckProc += AuraCheckProcFn(spell_warr_improved_spell_reflection_AuraScript::CheckProc); OnEffectProc += AuraEffectProcFn(spell_warr_improved_spell_reflection_AuraScript::OnProc, EFFECT_1, SPELL_AURA_DUMMY); } }; @@ -178,15 +178,15 @@ class spell_warr_improved_spell_reflection_trigger : public SpellScriptLoader void FilterTargets(std::list& unitList) { - GetCaster()->RemoveAurasDueToSpell(SPELL_WARRIOR_SPELL_REFLECTION); - unitList.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); - while (unitList.size() > GetSpellValue()->MaxAffectedTargets) - unitList.pop_back(); + GetCaster()->RemoveAurasDueToSpell(SPELL_WARRIOR_SPELL_REFLECTION); + unitList.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); + while (unitList.size() > GetSpellValue()->MaxAffectedTargets) + unitList.pop_back(); } void Register() { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_improved_spell_reflection_trigger_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_improved_spell_reflection_trigger_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY); } }; @@ -202,7 +202,7 @@ class spell_warr_improved_spell_reflection_trigger : public SpellScriptLoader void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes mode) { - if (!IsExpired()) + if (!IsExpired()) { // aura remove - remove auras from all party members std::list PartyMembers; @@ -210,11 +210,11 @@ class spell_warr_improved_spell_reflection_trigger : public SpellScriptLoader for (std::list::iterator itr = PartyMembers.begin(); itr != PartyMembers.end(); ++itr) { if ((*itr)->GetGUID() != GetOwner()->GetGUID()) - if (Aura* aur = (*itr)->GetAura(59725, GetCasterGUID())) - { - aur->SetDuration(0); - aur->Remove(); - } + if (Aura* aur = (*itr)->GetAura(59725, GetCasterGUID())) + { + aur->SetDuration(0); + aur->Remove(); + } } } } @@ -292,11 +292,11 @@ class spell_warr_deep_wounds : public SpellScriptLoader Unit* caster = GetCaster(); if (Unit* target = GetHitUnit()) { - // include target dependant auras - damage = target->MeleeDamageBonusTaken(caster, damage, BASE_ATTACK, GetSpellInfo()); + // include target dependant auras + damage = target->MeleeDamageBonusTaken(caster, damage, BASE_ATTACK, GetSpellInfo()); // apply percent damage mods ApplyPct(damage, 16.0f * GetSpellInfo()->GetRank() / 6.0f); - target->CastDelayedSpellWithPeriodicAmount(caster, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, SPELL_AURA_PERIODIC_DAMAGE, damage, EFFECT_0); + target->CastDelayedSpellWithPeriodicAmount(caster, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, SPELL_AURA_PERIODIC_DAMAGE, damage, EFFECT_0); //caster->CastCustomSpell(target, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); } @@ -755,7 +755,7 @@ class spell_warr_sweeping_strikes : public SpellScriptLoader void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - int32 damage = eventInfo.GetDamageInfo()->GetDamage(); + int32 damage = eventInfo.GetDamageInfo()->GetDamage(); GetTarget()->CastCustomSpell(_procTarget, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK, &damage, 0, 0, true, NULL, aurEff); } @@ -980,13 +980,13 @@ class spell_warr_retaliation : public SpellScriptLoader void AddSC_warrior_spell_scripts() { - // Ours - new spell_warr_mocking_blow(); - new spell_warr_intervene(); - new spell_warr_improved_spell_reflection(); - new spell_warr_improved_spell_reflection_trigger(); + // Ours + new spell_warr_mocking_blow(); + new spell_warr_intervene(); + new spell_warr_improved_spell_reflection(); + new spell_warr_improved_spell_reflection_trigger(); - // Theirs + // Theirs new spell_warr_bloodthirst(); new spell_warr_bloodthirst_heal(); new spell_warr_charge(); @@ -994,12 +994,12 @@ void AddSC_warrior_spell_scripts() new spell_warr_damage_shield(); new spell_warr_deep_wounds(); new spell_warr_execute(); - new spell_warr_glyph_of_sunder_armor(); + new spell_warr_glyph_of_sunder_armor(); new spell_warr_intimidating_shout(); new spell_warr_last_stand(); new spell_warr_overpower(); new spell_warr_rend(); - new spell_warr_retaliation(); + new spell_warr_retaliation(); new spell_warr_shattering_throw(); new spell_warr_slam(); new spell_warr_sweeping_strikes(); diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp index 6f424cecc..e67d12b4f 100644 --- a/src/server/scripts/World/achievement_scripts.cpp +++ b/src/server/scripts/World/achievement_scripts.cpp @@ -261,14 +261,14 @@ void AddSC_achievement_scripts() new achievement_bg_ic_resource_glut(); new achievement_bg_ic_glaive_grave(); new achievement_bg_ic_mowed_down(); - new achievement_bg_sa_artillery(); + new achievement_bg_sa_artillery(); new achievement_sickly_gazelle(); - new achievement_everything_counts(); - new achievement_bg_av_perfection(); - new achievement_arena_kills("achievement_arena_2v2_kills", ARENA_TYPE_2v2); + new achievement_everything_counts(); + new achievement_bg_av_perfection(); + new achievement_arena_kills("achievement_arena_2v2_kills", ARENA_TYPE_2v2); new achievement_arena_kills("achievement_arena_3v3_kills", ARENA_TYPE_3v3); new achievement_arena_kills("achievement_arena_5v5_kills", ARENA_TYPE_5v5); - new achievement_sa_defense_of_the_ancients(); + new achievement_sa_defense_of_the_ancients(); new achievement_tilted(); new achievement_not_even_a_scratch(); new achievement_killed_exp_or_honor_target(); diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp index 7047f9c9d..096b9c526 100644 --- a/src/server/scripts/World/areatrigger_scripts.cpp +++ b/src/server/scripts/World/areatrigger_scripts.cpp @@ -54,10 +54,10 @@ class AreaTrigger_at_voltarus_middle : public AreaTriggerScript { if (player->IsAlive() && !player->IsInCombat()) if (player->HasItemCount(39319)) // Scepter of Domination - { - player->TeleportTo(571, 6242.67f, -1972.10f, 484.783f, 0.6f); - return true; - } + { + player->TeleportTo(571, 6242.67f, -1972.10f, 484.783f, 0.6f); + return true; + } return false; } @@ -218,8 +218,8 @@ class AreaTrigger_at_last_rites : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* trigger) { - QuestStatus QLR = player->GetQuestStatus(QUEST_LAST_RITES); - QuestStatus QBT = player->GetQuestStatus(QUEST_BREAKING_THROUGH); + QuestStatus QLR = player->GetQuestStatus(QUEST_LAST_RITES); + QuestStatus QBT = player->GetQuestStatus(QUEST_BREAKING_THROUGH); if (!(QLR == QUEST_STATUS_INCOMPLETE || QLR == QUEST_STATUS_COMPLETE || QBT == QUEST_STATUS_INCOMPLETE || QBT == QUEST_STATUS_COMPLETE)) return false; @@ -237,10 +237,10 @@ class AreaTrigger_at_last_rites : public AreaTriggerScript pPosition = WorldLocation(571, 3802.38f, 3585.95f, 49.5765f, 0.0f); break; case 5340: - if (QBT == QUEST_STATUS_INCOMPLETE) - pPosition = WorldLocation(571, 3758, 3562, 345.51f, 0.0f); - else - pPosition = WorldLocation(571, 3687.91f, 3577.28f, 473.342f, 0.0f); + if (QBT == QUEST_STATUS_INCOMPLETE) + pPosition = WorldLocation(571, 3758, 3562, 345.51f, 0.0f); + else + pPosition = WorldLocation(571, 3687.91f, 3577.28f, 473.342f, 0.0f); break; default: return false; @@ -457,10 +457,10 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript void AddSC_areatrigger_scripts() { - // Ours - new AreaTrigger_at_voltarus_middle(); + // Ours + new AreaTrigger_at_voltarus_middle(); - // Theirs + // Theirs new AreaTrigger_at_coilfang_waterfall(); new AreaTrigger_at_legion_teleporter(); new AreaTrigger_at_stormwright_shelf(); diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index 716dc350b..abb8134e2 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -407,8 +407,8 @@ class npc_spirit_shade : public CreatureScript void IsSummonedBy(Unit* summoner) { - if (!summoner) - return; + if (!summoner) + return; _summonerGuid = summoner->GetGUID(); me->GetMotionMaster()->MoveFollow(summoner, 0.0f, 0.0f); @@ -682,7 +682,7 @@ class spell_dream_fog_sleep : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_SLEEP)); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_SLEEP)); } void Register() diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 3dffaca3f..329e46f4c 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -61,8 +61,8 @@ public: bool OnGossipHello(Player* player, GameObject* /*pGO*/) { - if (roll_chance_i(5)) - player->CastSpell(player, 61734, true); // SPELL NOBLEGARDEN BUNNY + if (roll_chance_i(5)) + player->CastSpell(player, 61734, true); // SPELL NOBLEGARDEN BUNNY return false; } }; @@ -74,8 +74,8 @@ public: bool OnGossipHello(Player* player, GameObject* /*pGO*/) { - if (player->GetQuestStatus(12007) == QUEST_STATUS_INCOMPLETE) - player->CastSpell(player, 47293, true); + if (player->GetQuestStatus(12007) == QUEST_STATUS_INCOMPLETE) + player->CastSpell(player, 47293, true); return true; } }; @@ -87,15 +87,15 @@ public: bool OnGossipHello(Player* pPlayer, GameObject *pGo) { - if (!pGo->FindNearestCreature(28105, 30.0f)) // Tartek - { - if (Creature *cr = pGo->SummonCreature(28105, 6708.7f, 5115.45f, -18.3f, 0.7f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - { - cr->MonsterYell("My treasure! You no steal from Tartek, dumb big-tongue traitor thing. Tartek and nasty dragon going to kill you! You so dumb.", LANG_UNIVERSAL, 0); - cr->AI()->AttackStart(pPlayer); - } - } - return false; + if (!pGo->FindNearestCreature(28105, 30.0f)) // Tartek + { + if (Creature *cr = pGo->SummonCreature(28105, 6708.7f, 5115.45f, -18.3f, 0.7f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + { + cr->MonsterYell("My treasure! You no steal from Tartek, dumb big-tongue traitor thing. Tartek and nasty dragon going to kill you! You so dumb.", LANG_UNIVERSAL, 0); + cr->AI()->AttackStart(pPlayer); + } + } + return false; } }; @@ -108,24 +108,24 @@ class go_witherbark_totem_bundle : public GameObjectScript { go_witherbark_totem_bundleAI(GameObject* gameObject) : GameObjectAI(gameObject) { - _timer = 1; - } + _timer = 1; + } - void UpdateAI(uint32 diff) - { - if (_timer) - { - _timer += diff; - if (_timer > 5000) - { - go->CastSpell(NULL, 9056); - go->DestroyForNearbyPlayers(); - _timer = 0; - } - } - } + void UpdateAI(uint32 diff) + { + if (_timer) + { + _timer += diff; + if (_timer > 5000) + { + go->CastSpell(NULL, 9056); + go->DestroyForNearbyPlayers(); + _timer = 0; + } + } + } - uint32 _timer; + uint32 _timer; }; GameObjectAI* GetAI(GameObject* go) const @@ -141,10 +141,10 @@ public: bool OnGossipHello(Player* player, GameObject *go) { - if (Battleground* bg = player->GetBattleground()) - bg->ReadyMarkerClicked(player); - - return false; + if (Battleground* bg = player->GetBattleground()) + bg->ReadyMarkerClicked(player); + + return false; } }; @@ -244,7 +244,7 @@ public: bool OnGossipHello(Player* /*player*/, GameObject* go) { - // xinef: prevent spawning hundreds of them + // xinef: prevent spawning hundreds of them if (go->GetGoType() == GAMEOBJECT_TYPE_GOOBER && !go->FindNearestCreature(NPC_GOGGEROC, 20.0f)) go->SummonCreature(NPC_GOGGEROC, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); @@ -272,50 +272,50 @@ public: { go_tadpole_cageAI(GameObject* gameObject) : GameObjectAI(gameObject) { - requireSummon = 2; - } + requireSummon = 2; + } - uint8 requireSummon; + uint8 requireSummon; - void SummonTadpoles() - { - requireSummon = 0; - int8 count = urand(1, 3); - for (int8 i = 0; i < count; ++i) - go->SummonCreature(NPC_WINTERFIN_TADPOLE, go->GetPositionX()+cos(2*M_PI*i/3.0f)*0.60f, go->GetPositionY()+sin(2*M_PI*i/3.0f)*0.60f, go->GetPositionZ()+0.5f, go->GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - } + void SummonTadpoles() + { + requireSummon = 0; + int8 count = urand(1, 3); + for (int8 i = 0; i < count; ++i) + go->SummonCreature(NPC_WINTERFIN_TADPOLE, go->GetPositionX()+cos(2*M_PI*i/3.0f)*0.60f, go->GetPositionY()+sin(2*M_PI*i/3.0f)*0.60f, go->GetPositionZ()+0.5f, go->GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + } - void OnStateChanged(uint32 state, Unit* unit) - { - if (requireSummon == 1 && state == GO_READY) - requireSummon = 2; - } + void OnStateChanged(uint32 state, Unit* unit) + { + if (requireSummon == 1 && state == GO_READY) + requireSummon = 2; + } - void UpdateAI(uint32 diff) - { - if (go->isSpawned() && requireSummon == 2) - SummonTadpoles(); - } + void UpdateAI(uint32 diff) + { + if (go->isSpawned() && requireSummon == 2) + SummonTadpoles(); + } - bool GossipHello(Player* player, bool reportUse) - { - if (requireSummon) - return false; + bool GossipHello(Player* player, bool reportUse) + { + if (requireSummon) + return false; - requireSummon = 1; - if (player->GetQuestStatus(QUEST_OH_NOES_THE_TADPOLES) == QUEST_STATUS_INCOMPLETE) - { - std::list cList; - GetCreatureListWithEntryInGrid(cList, go, NPC_WINTERFIN_TADPOLE, 5.0f); - for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr) - { - player->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE, 0); - (*itr)->DespawnOrUnsummon(urand(45000, 60000)); - (*itr)->GetMotionMaster()->MoveFollow(player, 1.0f, frand(0.0f, 2*M_PI), MOTION_SLOT_CONTROLLED); - } - } - return false; - } + requireSummon = 1; + if (player->GetQuestStatus(QUEST_OH_NOES_THE_TADPOLES) == QUEST_STATUS_INCOMPLETE) + { + std::list cList; + GetCreatureListWithEntryInGrid(cList, go, NPC_WINTERFIN_TADPOLE, 5.0f); + for (std::list::const_iterator itr = cList.begin(); itr != cList.end(); ++itr) + { + player->KilledMonsterCredit(NPC_WINTERFIN_TADPOLE, 0); + (*itr)->DespawnOrUnsummon(urand(45000, 60000)); + (*itr)->GetMotionMaster()->MoveFollow(player, 1.0f, frand(0.0f, 2*M_PI), MOTION_SLOT_CONTROLLED); + } + } + return false; + } }; GameObjectAI* GetAI(GameObject* go) const @@ -739,7 +739,7 @@ public: bool OnGossipHello(Player* player, GameObject* go) { - // xinef: prevent spawning hundreds of them + // xinef: prevent spawning hundreds of them if (player->GetQuestStatus(QUEST_PRISON_BREAK) == QUEST_STATUS_INCOMPLETE && !go->FindNearestCreature(25318, 20.0f)) { go->SummonCreature(25318, 3485.089844f, 6115.7422188f, 70.966812f, 0, TEMPSUMMON_TIMED_DESPAWN, 60000); @@ -845,27 +845,27 @@ enum InconspicuousLandmark class go_inconspicuous_landmark : public GameObjectScript { - public: - go_inconspicuous_landmark() : GameObjectScript("go_inconspicuous_landmark") - { - _lastUsedTime = time(NULL); - } + public: + go_inconspicuous_landmark() : GameObjectScript("go_inconspicuous_landmark") + { + _lastUsedTime = time(NULL); + } - bool OnGossipHello(Player* player, GameObject* /*go*/) - { - if (player->HasItemCount(ITEM_CUERGOS_KEY)) - return true; + bool OnGossipHello(Player* player, GameObject* /*go*/) + { + if (player->HasItemCount(ITEM_CUERGOS_KEY)) + return true; - if (_lastUsedTime > time(NULL)) - return true; + if (_lastUsedTime > time(NULL)) + return true; - _lastUsedTime = time(NULL) + MINUTE; - player->CastSpell(player, SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB, true); - return true; - } + _lastUsedTime = time(NULL) + MINUTE; + player->CastSpell(player, SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB, true); + return true; + } - private: - uint32 _lastUsedTime; + private: + uint32 _lastUsedTime; }; /*###### @@ -939,8 +939,8 @@ class go_soulwell : public GameObjectScript /// on the well. We have to find how to segregate REPORT_USE and USE. bool GossipHello(Player* player, bool reportUse) { - if (reportUse) - return false; + if (reportUse) + return false; Unit* owner = go->GetOwner(); if (_stoneSpell == 0 || _stoneId == 0) @@ -948,14 +948,14 @@ class go_soulwell : public GameObjectScript if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(_stoneSpell)) Spell::SendCastResult(player, spell, 0, SPELL_FAILED_ERROR); return true; - } + } if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !player->IsInSameRaidWith(owner->ToPlayer())) - { + { if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(_stoneSpell)) Spell::SendCastResult(player, spell, 0, SPELL_FAILED_TARGET_NOT_IN_RAID); return true; - } + } // Don't try to add a stone if we already have one. if (player->HasItemCount(_stoneId)) @@ -1120,9 +1120,9 @@ public: { player->SendLoot(go->GetGUID(), LOOT_CORPSE); - // xinef: prevent spawning hundreds of them - if (go->FindNearestCreature(NPC_HIVE_AMBUSHER, 20.0f)) - return true; + // xinef: prevent spawning hundreds of them + if (go->FindNearestCreature(NPC_HIVE_AMBUSHER, 20.0f)) + return true; go->SummonCreature(NPC_HIVE_AMBUSHER, go->GetPositionX()+1, go->GetPositionY(), go->GetPositionZ(), go->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); go->SummonCreature(NPC_HIVE_AMBUSHER, go->GetPositionX(), go->GetPositionY()+1, go->GetPositionZ(), go->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); @@ -1180,18 +1180,18 @@ class go_veil_skith_cage : public GameObjectScript void AddSC_go_scripts() { - // Ours - new go_noblegarden_colored_egg(); - new go_seer_of_zebhalak(); - new go_mistwhisper_treasure(); - new go_witherbark_totem_bundle(); - new go_arena_ready_marker(); - new go_ethereum_prison(); + // Ours + new go_noblegarden_colored_egg(); + new go_seer_of_zebhalak(); + new go_mistwhisper_treasure(); + new go_witherbark_totem_bundle(); + new go_arena_ready_marker(); + new go_ethereum_prison(); new go_ethereum_stasis(); new go_resonite_cask(); new go_tadpole_cage(); - // Theirs + // Theirs new go_cat_figurine(); new go_gilded_brazier(); new go_shrine_of_the_birds(); diff --git a/src/server/scripts/World/npc_innkeeper.cpp b/src/server/scripts/World/npc_innkeeper.cpp index c026ffc08..dd765a790 100644 --- a/src/server/scripts/World/npc_innkeeper.cpp +++ b/src/server/scripts/World/npc_innkeeper.cpp @@ -11,7 +11,7 @@ enum eTrickOrTreatSpells SPELL_TRICK = 24714, SPELL_TREAT = 24715, SPELL_TRICKED_OR_TREATED = 24755, - HALLOWEEN_EVENTID = 12, + HALLOWEEN_EVENTID = 12, }; class npc_innkeeper : public CreatureScript @@ -44,7 +44,7 @@ public: if (action == GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID && IsEventActive(HALLOWEEN_EVENTID) && !player->HasAura(SPELL_TRICKED_OR_TREATED)) { player->CastSpell(player, SPELL_TRICKED_OR_TREATED, true); - creature->CastSpell(player, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true); + creature->CastSpell(player, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true); player->CLOSE_GOSSIP_MENU(); return true; diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 2e3b33dd9..701874a79 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -351,7 +351,7 @@ void ProcessCastaction(Player* player, Creature* creature, uint32 spellId, uint3 player->CastSpell(player, triggeredSpellId, true); player->ModifyMoney(-cost); - // xinef: save spells! + // xinef: save spells! player->SaveToDB(false, false); } else @@ -576,29 +576,29 @@ public: //WEAPONSMITH & ARMORSMITH if (player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 225) { - if (player->GetQuestRewardStatus(5284) || player->GetQuestRewardStatus(5302) || player->GetQuestRewardStatus(5283) || player->GetQuestStatus(5301)) - { - switch (creatureId) - { - case 11145: //Myolor Sunderfury - case 11176: //Krathok Moltenfist - if (!player->HasSpell(S_ARMOR) && !player->HasSpell(S_WEAPON)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARMOR_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (!player->HasSpell(S_WEAPON) && !player->HasSpell(S_ARMOR)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEAPON_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - break; - case 11146: //Ironus Coldsteel - case 11178: //Borgosh Corebender - if (player->HasSpell(S_WEAPON)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEAPON_UNLEARN, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 3); - break; - case 5164: //Grumnus Steelshaper - case 11177: //Okothos Ironrager - if (player->HasSpell(S_ARMOR)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARMOR_UNLEARN, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 4); - break; - } - } + if (player->GetQuestRewardStatus(5284) || player->GetQuestRewardStatus(5302) || player->GetQuestRewardStatus(5283) || player->GetQuestStatus(5301)) + { + switch (creatureId) + { + case 11145: //Myolor Sunderfury + case 11176: //Krathok Moltenfist + if (!player->HasSpell(S_ARMOR) && !player->HasSpell(S_WEAPON)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARMOR_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (!player->HasSpell(S_WEAPON) && !player->HasSpell(S_ARMOR)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEAPON_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + break; + case 11146: //Ironus Coldsteel + case 11178: //Borgosh Corebender + if (player->HasSpell(S_WEAPON)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEAPON_UNLEARN, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 3); + break; + case 5164: //Grumnus Steelshaper + case 11177: //Okothos Ironrager + if (player->HasSpell(S_ARMOR)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARMOR_UNLEARN, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 4); + break; + } + } } //WEAPONSMITH SPEC if (player->HasSpell(S_WEAPON) && player->getLevel() > 49 && player->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 250) @@ -642,10 +642,10 @@ public: break; //Learn Armor/Weapon case GOSSIP_ACTION_INFO_DEF + 1: - ProcessCastaction(player, creature, S_ARMOR, S_LEARN_ARMOR, 0); + ProcessCastaction(player, creature, S_ARMOR, S_LEARN_ARMOR, 0); break; case GOSSIP_ACTION_INFO_DEF + 2: - ProcessCastaction(player, creature, S_WEAPON, S_LEARN_WEAPON, 0); + ProcessCastaction(player, creature, S_WEAPON, S_LEARN_WEAPON, 0); break; //Unlearn Armor/Weapon case GOSSIP_ACTION_INFO_DEF + 3: @@ -659,13 +659,13 @@ public: break; //Learn Hammer/Axe/Sword case GOSSIP_ACTION_INFO_DEF + 5: - ProcessCastaction(player, creature, S_HAMMER, S_LEARN_HAMMER, 0); + ProcessCastaction(player, creature, S_HAMMER, S_LEARN_HAMMER, 0); break; case GOSSIP_ACTION_INFO_DEF + 6: - ProcessCastaction(player, creature, S_AXE, S_LEARN_AXE, 0); + ProcessCastaction(player, creature, S_AXE, S_LEARN_AXE, 0); break; case GOSSIP_ACTION_INFO_DEF + 7: - ProcessCastaction(player, creature, S_SWORD, S_LEARN_SWORD, 0); + ProcessCastaction(player, creature, S_SWORD, S_LEARN_SWORD, 0); break; //Unlearn Hammer/Axe/Sword case GOSSIP_ACTION_INFO_DEF + 8: @@ -887,10 +887,10 @@ class npc_prof_leather : public CreatureScript public: npc_prof_leather() : CreatureScript("npc_prof_leather") { } - inline bool HasLeatherSpecialty(Player* player) - { - return (player->HasSpell(S_DRAGON) || player->HasSpell(S_ELEMENTAL) || player->HasSpell(S_TRIBAL)); - } + inline bool HasLeatherSpecialty(Player* player) + { + return (player->HasSpell(S_DRAGON) || player->HasSpell(S_ELEMENTAL) || player->HasSpell(S_TRIBAL)); + } bool OnGossipHello(Player* player, Creature* creature) { @@ -903,8 +903,8 @@ public: if (creature->IsTrainer()) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - // pussywizard: NO UNLEARNING! LEATHERWORKING SPECIALTY IS A PERMANENT DECISION AND CANNOT BE CHANGED IN ANY WAY! - // pussywizard: CAN RE-LEARN ONLY THE ONE FOR WHICH QUEST IS COMPLETED! + // pussywizard: NO UNLEARNING! LEATHERWORKING SPECIALTY IS A PERMANENT DECISION AND CANNOT BE CHANGED IN ANY WAY! + // pussywizard: CAN RE-LEARN ONLY THE ONE FOR WHICH QUEST IS COMPLETED! if (player->HasSkill(SKILL_LEATHERWORKING) && player->GetBaseSkillValue(SKILL_LEATHERWORKING) >= 250 && player->getLevel() > 49) { @@ -912,7 +912,7 @@ public: { case 7866: //Peter Galen case 7867: //Thorkaf Dragoneye - if (!HasLeatherSpecialty(player) && (player->GetQuestRewardStatus(5141) || player->GetQuestRewardStatus(5145))) + if (!HasLeatherSpecialty(player) && (player->GetQuestRewardStatus(5141) || player->GetQuestRewardStatus(5145))) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_DRAGON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); break; case 7868: //Sarah Tanner @@ -944,13 +944,13 @@ public: break; // Learn Leather case GOSSIP_ACTION_INFO_DEF + 1: - ProcessCastaction(player, creature, S_DRAGON, S_LEARN_DRAGON, 0); + ProcessCastaction(player, creature, S_DRAGON, S_LEARN_DRAGON, 0); break; case GOSSIP_ACTION_INFO_DEF + 2: - ProcessCastaction(player, creature, S_ELEMENTAL, S_LEARN_ELEMENTAL, 0); + ProcessCastaction(player, creature, S_ELEMENTAL, S_LEARN_ELEMENTAL, 0); break; case GOSSIP_ACTION_INFO_DEF + 3: - ProcessCastaction(player, creature, S_TRIBAL, S_LEARN_TRIBAL, 0); + ProcessCastaction(player, creature, S_TRIBAL, S_LEARN_TRIBAL, 0); break; } } @@ -1145,19 +1145,19 @@ public: { if (player->GetQuestRewardStatus(3643) || player->GetQuestRewardStatus(3641) || player->GetQuestRewardStatus(3639)) { - if (player->HasSpell(S_GOBLIN)) // Has Goblin specialization - { - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_GOBLIN, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 3, BOX_UNLEARN_ENGIN_SPEC, DoHighUnlearnCost(player), false); - } - else if (player->HasSpell(S_GNOMISH)) // Has Gnomish specialization - { - player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_GNOMISH, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 4, BOX_UNLEARN_ENGIN_SPEC, DoHighUnlearnCost(player), false); - } - else // does not have any specialization - { - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_CHAT, GOSSIP_LEARN_GOBLIN, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 1, BOX_LEARN_ENGIN_SPEC, DoLearnCost(player), false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_CHAT, GOSSIP_LEARN_GNOMISH, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 2, BOX_LEARN_ENGIN_SPEC, DoLearnCost(player), false); - } + if (player->HasSpell(S_GOBLIN)) // Has Goblin specialization + { + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_GOBLIN, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 3, BOX_UNLEARN_ENGIN_SPEC, DoHighUnlearnCost(player), false); + } + else if (player->HasSpell(S_GNOMISH)) // Has Gnomish specialization + { + player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_GNOMISH, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 4, BOX_UNLEARN_ENGIN_SPEC, DoHighUnlearnCost(player), false); + } + else // does not have any specialization + { + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_CHAT, GOSSIP_LEARN_GOBLIN, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 1, BOX_LEARN_ENGIN_SPEC, DoLearnCost(player), false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_CHAT, GOSSIP_LEARN_GNOMISH, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 2, BOX_LEARN_ENGIN_SPEC, DoLearnCost(player), false); + } } } @@ -1173,15 +1173,15 @@ public: case GOSSIP_ACTION_INFO_DEF + 1: ProcessCastaction(player, NULL, S_GOBLIN, S_LEARN_GOBLIN, DoLearnCost(player)); break; - // Learn Gnomish - case GOSSIP_ACTION_INFO_DEF + 2: + // Learn Gnomish + case GOSSIP_ACTION_INFO_DEF + 2: ProcessCastaction(player, NULL, S_GNOMISH, S_LEARN_GNOMISH, DoLearnCost(player)); break; //Unlearn Goblin case GOSSIP_ACTION_INFO_DEF + 3: - ProcessUnlearnAction(player, NULL, S_UNLEARN_GOBLIN, 0, DoHighUnlearnCost(player)); + ProcessUnlearnAction(player, NULL, S_UNLEARN_GOBLIN, 0, DoHighUnlearnCost(player)); break; - //Unlearn Gnomish + //Unlearn Gnomish case GOSSIP_ACTION_INFO_DEF + 4: ProcessUnlearnAction(player, NULL, S_UNLEARN_GNOMISH, 0, DoHighUnlearnCost(player)); break; @@ -1191,14 +1191,14 @@ public: void SendConfirmLearn(Player* player, GameObject* gameobject, uint32 uiAction) { switch (uiAction) - { - // Goblin - case GOSSIP_ACTION_INFO_DEF + 1: + { + // Goblin + case GOSSIP_ACTION_INFO_DEF + 1: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_GOBLIN, GOSSIP_SENDER_CHECK, uiAction); player->SEND_GOSSIP_MENU(player->GetGossipTextId(gameobject), gameobject->GetGUID()); break; - // Gnomish - case GOSSIP_ACTION_INFO_DEF + 2: + // Gnomish + case GOSSIP_ACTION_INFO_DEF + 2: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_GNOMISH, GOSSIP_SENDER_CHECK, uiAction); player->SEND_GOSSIP_MENU(player->GetGossipTextId(gameobject), gameobject->GetGUID()); break; @@ -1207,15 +1207,15 @@ public: void SendConfirmUnlearn(Player* player, GameObject* gameobject, uint32 uiAction) { - switch (uiAction) - { - // Goblin - case GOSSIP_ACTION_INFO_DEF + 3: + switch (uiAction) + { + // Goblin + case GOSSIP_ACTION_INFO_DEF + 3: player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_GOBLIN, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ENGIN_SPEC, DoHighUnlearnCost(player), false); player->SEND_GOSSIP_MENU(player->GetGossipTextId(gameobject), gameobject->GetGUID()); break; - // Gnomish - case GOSSIP_ACTION_INFO_DEF + 4: + // Gnomish + case GOSSIP_ACTION_INFO_DEF + 4: player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_GNOMISH, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ENGIN_SPEC, DoHighUnlearnCost(player), false); player->SEND_GOSSIP_MENU(player->GetGossipTextId(gameobject), gameobject->GetGUID()); break; @@ -1242,5 +1242,5 @@ void AddSC_npc_professions() new npc_engineering_tele_trinket(); new npc_prof_leather(); new npc_prof_tailor(); - new go_evil_book_for_dummies(); + new go_evil_book_for_dummies(); } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 56896bdb6..ed47d22d7 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -64,16 +64,16 @@ EndContentData */ enum elderClearwater { - EVENT_CLEARWATER_ANNOUNCE = 1, + EVENT_CLEARWATER_ANNOUNCE = 1, - CLEARWATER_SAY_PRE = 0, - CLEARWATER_SAY_START = 1, - CLEARWATER_SAY_WINNER = 2, - CLEARWATER_SAY_END = 3, + CLEARWATER_SAY_PRE = 0, + CLEARWATER_SAY_START = 1, + CLEARWATER_SAY_WINNER = 2, + CLEARWATER_SAY_END = 3, - QUEST_FISHING_DERBY = 24803, + QUEST_FISHING_DERBY = 24803, - DATA_DERBY_FINISHED = 1, + DATA_DERBY_FINISHED = 1, }; class npc_elder_clearwater : public CreatureScript @@ -81,146 +81,146 @@ class npc_elder_clearwater : public CreatureScript public: npc_elder_clearwater() : CreatureScript("npc_elder_clearwater") { } - struct npc_elder_clearwaterAI : public ScriptedAI - { - npc_elder_clearwaterAI(Creature *c) : ScriptedAI(c) - { - events.Reset(); - events.ScheduleEvent(EVENT_CLEARWATER_ANNOUNCE, 1000, 1, 0); - finished = false; - preWarning = false; - startWarning = false; - finishWarning = false; - } + struct npc_elder_clearwaterAI : public ScriptedAI + { + npc_elder_clearwaterAI(Creature *c) : ScriptedAI(c) + { + events.Reset(); + events.ScheduleEvent(EVENT_CLEARWATER_ANNOUNCE, 1000, 1, 0); + finished = false; + preWarning = false; + startWarning = false; + finishWarning = false; + } - EventMap events; - bool finished; - bool preWarning; - bool startWarning; - bool finishWarning; + EventMap events; + bool finished; + bool preWarning; + bool startWarning; + bool finishWarning; - uint32 GetData(uint32 type) const - { - if (type == DATA_DERBY_FINISHED) - return (uint32)finished; + uint32 GetData(uint32 type) const + { + if (type == DATA_DERBY_FINISHED) + return (uint32)finished; - return 0; - } + return 0; + } - void DoAction(int32 param) - { - if (param == DATA_DERBY_FINISHED) - finished = true; - } + void DoAction(int32 param) + { + if (param == DATA_DERBY_FINISHED) + finished = true; + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_CLEARWATER_ANNOUNCE: - { - time_t curtime = time(NULL); - tm strdate; - ACE_OS::localtime_r(&curtime, &strdate); + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_CLEARWATER_ANNOUNCE: + { + time_t curtime = time(NULL); + tm strdate; + ACE_OS::localtime_r(&curtime, &strdate); - if (!preWarning && strdate.tm_hour == 13 && strdate.tm_min == 55) - { - sCreatureTextMgr->SendChat(me, CLEARWATER_SAY_PRE, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_MAP); - preWarning = true; - } - if (!startWarning && strdate.tm_hour == 14 && strdate.tm_min == 0) - { - sCreatureTextMgr->SendChat(me, CLEARWATER_SAY_START, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_MAP); - startWarning = true; - } - if (!finishWarning && strdate.tm_hour == 15 && strdate.tm_min == 0) - { - sCreatureTextMgr->SendChat(me, CLEARWATER_SAY_END, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_MAP); - finishWarning = true; - // no one won - despawn - if (!finished) - { - me->DespawnOrUnsummon(); - events.PopEvent(); - break; - } - } + if (!preWarning && strdate.tm_hour == 13 && strdate.tm_min == 55) + { + sCreatureTextMgr->SendChat(me, CLEARWATER_SAY_PRE, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_MAP); + preWarning = true; + } + if (!startWarning && strdate.tm_hour == 14 && strdate.tm_min == 0) + { + sCreatureTextMgr->SendChat(me, CLEARWATER_SAY_START, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_MAP); + startWarning = true; + } + if (!finishWarning && strdate.tm_hour == 15 && strdate.tm_min == 0) + { + sCreatureTextMgr->SendChat(me, CLEARWATER_SAY_END, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_MAP); + finishWarning = true; + // no one won - despawn + if (!finished) + { + me->DespawnOrUnsummon(); + events.PopEvent(); + break; + } + } - events.RepeatEvent(1000); - break; - } - } - } - }; + events.RepeatEvent(1000); + break; + } + } + } + }; - bool OnGossipHello(Player* player, Creature* creature) - { - QuestRelationBounds pObjectQR; - QuestRelationBounds pObjectQIR; + bool OnGossipHello(Player* player, Creature* creature) + { + QuestRelationBounds pObjectQR; + QuestRelationBounds pObjectQIR; - // pets also can have quests - if (creature) - { - pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); - pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); - } - else - return true; + // pets also can have quests + if (creature) + { + pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); + pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); + } + else + return true; - QuestMenu &qm = player->PlayerTalkClass->GetQuestMenu(); - qm.ClearMenu(); + QuestMenu &qm = player->PlayerTalkClass->GetQuestMenu(); + qm.ClearMenu(); - for (QuestRelations::const_iterator i = pObjectQIR.first; i != pObjectQIR.second; ++i) - { - uint32 quest_id = i->second; - Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); - if (!quest) - continue; + for (QuestRelations::const_iterator i = pObjectQIR.first; i != pObjectQIR.second; ++i) + { + uint32 quest_id = i->second; + Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); + if (!quest) + continue; - if (!creature->AI()->GetData(DATA_DERBY_FINISHED)) - { - if (quest_id == QUEST_FISHING_DERBY) - player->PlayerTalkClass->SendQuestGiverRequestItems(quest, creature->GetGUID(), player->CanRewardQuest(quest, false), true); - } - else - { - if (quest_id != QUEST_FISHING_DERBY) - player->PlayerTalkClass->SendQuestGiverRequestItems(quest, creature->GetGUID(), player->CanRewardQuest(quest, false), true); - } - } + if (!creature->AI()->GetData(DATA_DERBY_FINISHED)) + { + if (quest_id == QUEST_FISHING_DERBY) + player->PlayerTalkClass->SendQuestGiverRequestItems(quest, creature->GetGUID(), player->CanRewardQuest(quest, false), true); + } + else + { + if (quest_id != QUEST_FISHING_DERBY) + player->PlayerTalkClass->SendQuestGiverRequestItems(quest, creature->GetGUID(), player->CanRewardQuest(quest, false), true); + } + } - return true; - } + return true; + } - bool OnQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt) - { - if (!creature->AI()->GetData(DATA_DERBY_FINISHED) && quest->GetQuestId() == QUEST_FISHING_DERBY) - { - creature->AI()->DoAction(DATA_DERBY_FINISHED); - sCreatureTextMgr->SendChat(creature, CLEARWATER_SAY_WINNER, player, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_MAP); - } - return true; - } + bool OnQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt) + { + if (!creature->AI()->GetData(DATA_DERBY_FINISHED) && quest->GetQuestId() == QUEST_FISHING_DERBY) + { + creature->AI()->DoAction(DATA_DERBY_FINISHED); + sCreatureTextMgr->SendChat(creature, CLEARWATER_SAY_WINNER, player, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_MAP); + } + return true; + } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_elder_clearwaterAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_elder_clearwaterAI (pCreature); + } }; enum riggleBassbait { - EVENT_RIGGLE_ANNOUNCE = 1, + EVENT_RIGGLE_ANNOUNCE = 1, - RIGGLE_SAY_START = 0, - RIGGLE_SAY_WINNER = 1, - RIGGLE_SAY_END = 2, + RIGGLE_SAY_START = 0, + RIGGLE_SAY_WINNER = 1, + RIGGLE_SAY_END = 2, - QUEST_MASTER_ANGLER = 8193, + QUEST_MASTER_ANGLER = 8193, - DATA_ANGLER_FINISHED = 1, + DATA_ANGLER_FINISHED = 1, }; class npc_riggle_bassbait : public CreatureScript @@ -228,107 +228,107 @@ class npc_riggle_bassbait : public CreatureScript public: npc_riggle_bassbait() : CreatureScript("npc_riggle_bassbait") { } - struct npc_riggle_bassbaitAI : public ScriptedAI - { - npc_riggle_bassbaitAI(Creature *c) : ScriptedAI(c) - { - events.Reset(); - events.ScheduleEvent(EVENT_RIGGLE_ANNOUNCE, 1000, 1, 0); - finished = false; - startWarning = false; - finishWarning = false; - } + struct npc_riggle_bassbaitAI : public ScriptedAI + { + npc_riggle_bassbaitAI(Creature *c) : ScriptedAI(c) + { + events.Reset(); + events.ScheduleEvent(EVENT_RIGGLE_ANNOUNCE, 1000, 1, 0); + finished = false; + startWarning = false; + finishWarning = false; + } - EventMap events; - bool finished; - bool startWarning; - bool finishWarning; + EventMap events; + bool finished; + bool startWarning; + bool finishWarning; - uint32 GetData(uint32 type) const - { - if (type == DATA_ANGLER_FINISHED) - return (uint32)finished; + uint32 GetData(uint32 type) const + { + if (type == DATA_ANGLER_FINISHED) + return (uint32)finished; - return 0; - } + return 0; + } - void DoAction(int32 param) - { - if (param == DATA_ANGLER_FINISHED) - finished = true; - } + void DoAction(int32 param) + { + if (param == DATA_ANGLER_FINISHED) + finished = true; + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_RIGGLE_ANNOUNCE: - { - time_t curtime = time(NULL); - tm strdate; - ACE_OS::localtime_r(&curtime, &strdate); - if (!startWarning && strdate.tm_hour == 14 && strdate.tm_min == 0) - { - sCreatureTextMgr->SendChat(me, RIGGLE_SAY_START, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE); - startWarning = true; - } - if (!finishWarning && strdate.tm_hour == 16 && strdate.tm_min == 0) - { - sCreatureTextMgr->SendChat(me, RIGGLE_SAY_END, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE); - finishWarning = true; - // no one won - despawn - if (!finished) - { - me->DespawnOrUnsummon(); - events.PopEvent(); - break; - } - } + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_RIGGLE_ANNOUNCE: + { + time_t curtime = time(NULL); + tm strdate; + ACE_OS::localtime_r(&curtime, &strdate); + if (!startWarning && strdate.tm_hour == 14 && strdate.tm_min == 0) + { + sCreatureTextMgr->SendChat(me, RIGGLE_SAY_START, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE); + startWarning = true; + } + if (!finishWarning && strdate.tm_hour == 16 && strdate.tm_min == 0) + { + sCreatureTextMgr->SendChat(me, RIGGLE_SAY_END, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE); + finishWarning = true; + // no one won - despawn + if (!finished) + { + me->DespawnOrUnsummon(); + events.PopEvent(); + break; + } + } - events.RepeatEvent(1000); - break; - } - } - } - }; + events.RepeatEvent(1000); + break; + } + } + } + }; - bool OnGossipHello(Player* player, Creature* creature) - { - if (!creature->AI()->GetData(DATA_ANGLER_FINISHED)) + bool OnGossipHello(Player* player, Creature* creature) + { + if (!creature->AI()->GetData(DATA_ANGLER_FINISHED)) player->PrepareQuestMenu(creature->GetGUID()); player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } + return true; + } - bool OnQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt) - { - if (!creature->AI()->GetData(DATA_ANGLER_FINISHED) && quest->GetQuestId() == QUEST_MASTER_ANGLER) - { - creature->AI()->DoAction(DATA_ANGLER_FINISHED); - sCreatureTextMgr->SendChat(creature, RIGGLE_SAY_WINNER, player, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE); - } - return true; - } + bool OnQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt) + { + if (!creature->AI()->GetData(DATA_ANGLER_FINISHED) && quest->GetQuestId() == QUEST_MASTER_ANGLER) + { + creature->AI()->DoAction(DATA_ANGLER_FINISHED); + sCreatureTextMgr->SendChat(creature, RIGGLE_SAY_WINNER, player, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE); + } + return true; + } - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_riggle_bassbaitAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_riggle_bassbaitAI (pCreature); + } }; enum shortJohnMirthil { - EVENT_SHORT_JOHN_ACTION = 1, - EVENT_SHORT_JOHN_REMOVE_WARNING = 2, - EVENT_SHORT_JOHN_MOVE_BACK = 3, + EVENT_SHORT_JOHN_ACTION = 1, + EVENT_SHORT_JOHN_REMOVE_WARNING = 2, + EVENT_SHORT_JOHN_MOVE_BACK = 3, - SAY_SHORT_JOHN_ANNOUNCE = 0, - SAY_SHORT_JOHN_BATTLE_START = 1, + SAY_SHORT_JOHN_ANNOUNCE = 0, + SAY_SHORT_JOHN_BATTLE_START = 1, - SPELL_SUMMON_PIRATE_BOOTY = 23176 + SPELL_SUMMON_PIRATE_BOOTY = 23176 }; class npc_short_john_mirthil : public CreatureScript @@ -336,110 +336,110 @@ class npc_short_john_mirthil : public CreatureScript public: npc_short_john_mirthil() : CreatureScript("npc_short_john_mirthil") { } - struct npc_short_john_mirthilAI : public NullCreatureAI - { - npc_short_john_mirthilAI(Creature *c) : NullCreatureAI(c) - { - pathPoint = 0; - startWarning = false; - events.Reset(); - events.ScheduleEvent(EVENT_SHORT_JOHN_ACTION, 1000); - } + struct npc_short_john_mirthilAI : public NullCreatureAI + { + npc_short_john_mirthilAI(Creature *c) : NullCreatureAI(c) + { + pathPoint = 0; + startWarning = false; + events.Reset(); + events.ScheduleEvent(EVENT_SHORT_JOHN_ACTION, 1000); + } - EventMap events; - bool startWarning; - uint32 pathPoint; + EventMap events; + bool startWarning; + uint32 pathPoint; - void StartMovement(bool reverse) - { - Movement::PointsArray pathPoints; - pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); - WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetEntry()); + void StartMovement(bool reverse) + { + Movement::PointsArray pathPoints; + pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ())); + WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetEntry()); - if (reverse) - { - for (uint8 i = 0; i < i_path->size(); ++i) - { - WaypointData const* node = i_path->at(i_path->size()-1-i); - pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); - } - float x, y, z, o; - me->GetRespawnPosition(x, y, z, &o); - pathPoints.push_back(G3D::Vector3(x, y, z)); - } - else - { - for (uint8 i = 0; i < i_path->size(); ++i) - { - WaypointData const* node = i_path->at(i); - pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); - } - } + if (reverse) + { + for (uint8 i = 0; i < i_path->size(); ++i) + { + WaypointData const* node = i_path->at(i_path->size()-1-i); + pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); + } + float x, y, z, o; + me->GetRespawnPosition(x, y, z, &o); + pathPoints.push_back(G3D::Vector3(x, y, z)); + } + else + { + for (uint8 i = 0; i < i_path->size(); ++i) + { + WaypointData const* node = i_path->at(i); + pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z)); + } + } - me->SetWalk(!reverse); + me->SetWalk(!reverse); me->GetMotionMaster()->MoveSplinePath(&pathPoints); - } + } - void MovementInform(uint32 type, uint32 point) - { - if (type != ESCORT_MOTION_TYPE) - return; + void MovementInform(uint32 type, uint32 point) + { + if (type != ESCORT_MOTION_TYPE) + return; - ++pathPoint; - if (pathPoint == 16) - events.ScheduleEvent(EVENT_SHORT_JOHN_MOVE_BACK, 0); - else if (pathPoint == 33) - CreatureAI::EnterEvadeMode(); - } + ++pathPoint; + if (pathPoint == 16) + events.ScheduleEvent(EVENT_SHORT_JOHN_MOVE_BACK, 0); + else if (pathPoint == 33) + CreatureAI::EnterEvadeMode(); + } - void UpdateAI(uint32 diff) - { - events.Update(diff); - switch (events.GetEvent()) - { - case EVENT_SHORT_JOHN_ACTION: - { - time_t curtime = time(NULL); - tm strdate; - ACE_OS::localtime_r(&curtime, &strdate); - if (!startWarning && strdate.tm_hour % 3 == 0 && strdate.tm_min == 0) - { - sCreatureTextMgr->SendChat(me, SAY_SHORT_JOHN_ANNOUNCE, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE); - startWarning = true; - events.ScheduleEvent(EVENT_SHORT_JOHN_REMOVE_WARNING, 150000); // 2.5 minutes, to be sure above condition fails - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + void UpdateAI(uint32 diff) + { + events.Update(diff); + switch (events.GetEvent()) + { + case EVENT_SHORT_JOHN_ACTION: + { + time_t curtime = time(NULL); + tm strdate; + ACE_OS::localtime_r(&curtime, &strdate); + if (!startWarning && strdate.tm_hour % 3 == 0 && strdate.tm_min == 0) + { + sCreatureTextMgr->SendChat(me, SAY_SHORT_JOHN_ANNOUNCE, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE); + startWarning = true; + events.ScheduleEvent(EVENT_SHORT_JOHN_REMOVE_WARNING, 150000); // 2.5 minutes, to be sure above condition fails + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - pathPoint = 0; - StartMovement(false); - } + pathPoint = 0; + StartMovement(false); + } - events.RepeatEvent(1000); - break; - } - case EVENT_SHORT_JOHN_REMOVE_WARNING: - startWarning = false; - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); - events.PopEvent(); - break; - case EVENT_SHORT_JOHN_MOVE_BACK: - me->CastSpell(me, SPELL_SUMMON_PIRATE_BOOTY, true); - sCreatureTextMgr->SendChat(me, SAY_SHORT_JOHN_BATTLE_START, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE); - StartMovement(true); - events.PopEvent(); - break; - } - } - }; + events.RepeatEvent(1000); + break; + } + case EVENT_SHORT_JOHN_REMOVE_WARNING: + startWarning = false; + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); + events.PopEvent(); + break; + case EVENT_SHORT_JOHN_MOVE_BACK: + me->CastSpell(me, SPELL_SUMMON_PIRATE_BOOTY, true); + sCreatureTextMgr->SendChat(me, SAY_SHORT_JOHN_BATTLE_START, 0, CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, TEXT_RANGE_ZONE); + StartMovement(true); + events.PopEvent(); + break; + } + } + }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_short_john_mirthilAI (pCreature); - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_short_john_mirthilAI (pCreature); + } }; enum eTrainingDummy { - SPELL_STUN_PERMANENT = 61204 + SPELL_STUN_PERMANENT = 61204 }; class npc_training_dummy : public CreatureScript @@ -510,7 +510,7 @@ public: npc_target_dummyAI(Creature* creature) : ScriptedAI(creature) { SetCombatMovement(false); - deathTimer = 15000; + deathTimer = 15000; me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); //imune to knock aways like blast wave } @@ -519,8 +519,8 @@ public: void Reset() { me->SetControlled(true, UNIT_STATE_STUNNED); //disable rotate - me->SetLootRecipient(me->GetOwner()); - me->SelectLevel(); + me->SetLootRecipient(me->GetOwner()); + me->SelectLevel(); } void EnterEvadeMode() @@ -538,9 +538,9 @@ public: if (deathTimer <= diff) { - me->SetLootRecipient(me->GetOwner()); - me->LowerPlayerDamageReq(me->GetMaxHealth()); - Unit::Kill(me, me); + me->SetLootRecipient(me->GetOwner()); + me->LowerPlayerDamageReq(me->GetMaxHealth()); + Unit::Kill(me, me); deathTimer = 600000; } else @@ -1430,7 +1430,7 @@ public: RunAwayTimer = 5000; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); me->SetStandState(UNIT_STAND_STATE_KNEEL); // expect database to have RegenHealth=0 me->SetHealth(me->CountPctFromMaxHealth(70)); @@ -2656,14 +2656,14 @@ class npc_stable_master : public CreatureScript void AddSC_npcs_special() { - // Ours - new npc_elder_clearwater(); - new npc_riggle_bassbait(); - new npc_short_john_mirthil(); - new npc_target_dummy(); - new npc_training_dummy(); + // Ours + new npc_elder_clearwater(); + new npc_riggle_bassbait(); + new npc_short_john_mirthil(); + new npc_target_dummy(); + new npc_training_dummy(); - // Theirs + // Theirs new npc_air_force_bots(); new npc_lunaclaw_spirit(); new npc_chicken_cluck(); diff --git a/src/server/shared/Common.cpp b/src/server/shared/Common.cpp index 670035304..ae40b2370 100644 --- a/src/server/shared/Common.cpp +++ b/src/server/shared/Common.cpp @@ -41,9 +41,9 @@ LocaleConstant GetLocaleByName(const std::string& name) void CleanStringForMysqlQuery(std::string& str) { - std::string::size_type n = 0; - while ((n=str.find('\\')) != str.npos) str.erase(n,1); - while ((n=str.find('"')) != str.npos) str.erase(n,1); - while ((n=str.find('\'')) != str.npos) str.erase(n,1); + std::string::size_type n = 0; + while ((n=str.find('\\')) != str.npos) str.erase(n,1); + while ((n=str.find('"')) != str.npos) str.erase(n,1); + while ((n=str.find('\'')) != str.npos) str.erase(n,1); } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index e3b9aa5be..80ef19aea 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -106,7 +106,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_SEL_CHARACTER_QUESTSTATUSREW, "SELECT quest FROM character_queststatus_rewarded WHERE guid = ? AND active = 1", CONNECTION_ASYNC); PrepareStatement(CHAR_SEL_ACCOUNT_INSTANCELOCKTIMES, "SELECT instanceId, releaseTime FROM account_instance_times WHERE accountId = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_SEL_BREW_OF_THE_MONTH, "SELECT lastEventId FROM character_brew_of_the_month WHERE guid = ?", CONNECTION_ASYNC); - PrepareStatement(CHAR_REP_BREW_OF_THE_MONTH, "REPLACE INTO character_brew_of_the_month (guid, lastEventId) VALUES (?, ?)", CONNECTION_ASYNC); + PrepareStatement(CHAR_REP_BREW_OF_THE_MONTH, "REPLACE INTO character_brew_of_the_month (guid, lastEventId) VALUES (?, ?)", CONNECTION_ASYNC); // End LoginQueryHolder content PrepareStatement(CHAR_SEL_CHARACTER_ACTIONS_SPEC, "SELECT button, action, type FROM character_action WHERE guid = ? AND spec = ? ORDER BY button", CONNECTION_ASYNC); @@ -212,8 +212,8 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_UPD_CHANNEL_USAGE, "UPDATE channels SET lastUsed = UNIX_TIMESTAMP() WHERE channelId = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_OLD_CHANNELS, "DELETE FROM channels WHERE lastUsed + ? < UNIX_TIMESTAMP()", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_OLD_CHANNELS_BANS, "DELETE cb.* FROM channels_bans cb LEFT JOIN channels cn ON cb.channelId=cn.channelId WHERE cn.channelId IS NULL OR cb.banTime <= UNIX_TIMESTAMP()", CONNECTION_ASYNC); - PrepareStatement(CHAR_INS_CHANNEL_BAN, "REPLACE INTO channels_bans VALUES (?, ?, ?)", CONNECTION_ASYNC); - PrepareStatement(CHAR_DEL_CHANNEL_BAN, "DELETE FROM channels_bans WHERE channelId = ? AND playerGUID = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_INS_CHANNEL_BAN, "REPLACE INTO channels_bans VALUES (?, ?, ?)", CONNECTION_ASYNC); + PrepareStatement(CHAR_DEL_CHANNEL_BAN, "DELETE FROM channels_bans WHERE channelId = ? AND playerGUID = ?", CONNECTION_ASYNC); // Equipmentsets PrepareStatement(CHAR_UPD_EQUIP_SET, "UPDATE character_equipmentsets SET name=?, iconname=?, ignore_mask=?, item0=?, item1=?, item2=?, item3=?, " @@ -370,7 +370,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_UPD_CHAR_INSTANCE_SET_NOT_EXTENDED, "UPDATE character_instance SET extended = 0 WHERE instance = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID, "DELETE FROM character_instance WHERE guid = ? AND instance = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_UPD_CHAR_INSTANCE, "UPDATE character_instance SET instance = ?, permanent = ?, extended = 0 WHERE guid = ? AND instance = ?", CONNECTION_ASYNC); - PrepareStatement(CHAR_UPD_CHAR_INSTANCE_EXTENDED, "UPDATE character_instance SET extended = ? WHERE guid = ? AND instance = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_UPD_CHAR_INSTANCE_EXTENDED, "UPDATE character_instance SET extended = ? WHERE guid = ? AND instance = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_INS_CHAR_INSTANCE, "INSERT INTO character_instance (guid, instance, permanent, extended) VALUES (?, ?, ?, 0)", CONNECTION_ASYNC); PrepareStatement(CHAR_INS_ARENA_LOG_FIGHT, "INSERT INTO log_arena_fights VALUES (?, NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS, "INSERT INTO log_arena_memberstats VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); @@ -511,7 +511,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_SEL_ITEMCONTAINER_ITEMS, "SELECT containerGUID, itemid, count, randomPropertyId, randomSuffix FROM item_loot_storage", CONNECTION_SYNCH); PrepareStatement(CHAR_DEL_ITEMCONTAINER_SINGLE_ITEM, "DELETE FROM item_loot_storage WHERE containerGUID = ? AND itemid = ? AND count = ? LIMIT 1", CONNECTION_ASYNC); PrepareStatement(CHAR_INS_ITEMCONTAINER_SINGLE_ITEM, "INSERT INTO item_loot_storage (containerGUID, itemid, count, randomPropertyId, randomSuffix) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC); - PrepareStatement(CHAR_DEL_ITEMCONTAINER_CONTAINER, "DELETE FROM item_loot_storage WHERE containerGUID = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_DEL_ITEMCONTAINER_CONTAINER, "DELETE FROM item_loot_storage WHERE containerGUID = ?", CONNECTION_ASYNC); // Calendar PrepareStatement(CHAR_REP_CALENDAR_EVENT, "REPLACE INTO calendar_events (id, creator, title, description, type, dungeon, eventtime, flags, time2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); @@ -552,5 +552,5 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID, "UPDATE character_pet SET slot = ? WHERE owner = ? AND id = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_CHAR_PET_BY_ID, "DELETE FROM character_pet WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_CHAR_PET_BY_SLOT, "DELETE FROM character_pet WHERE owner = ? AND (slot = ? OR slot > ?)", CONNECTION_ASYNC); - PrepareStatement(CHAR_REP_CHAR_PET, "REPLACE INTO character_pet (id, entry, owner, modelid, CreatedBySpell, PetType, level, exp, Reactstate, name, renamed, slot, curhealth, curmana, curhappiness, savetime, abdata) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PrepareStatement(CHAR_REP_CHAR_PET, "REPLACE INTO character_pet (id, entry, owner, modelid, CreatedBySpell, PetType, level, exp, Reactstate, name, renamed, slot, curhealth, curmana, curhappiness, savetime, abdata) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 6bc5fed1e..da9598e96 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -109,8 +109,8 @@ enum CharacterDatabaseStatements CHAR_SEL_CHARACTER_QUESTSTATUSREW, CHAR_SEL_ACCOUNT_INSTANCELOCKTIMES, CHAR_SEL_MAILITEMS, - CHAR_SEL_BREW_OF_THE_MONTH, - CHAR_REP_BREW_OF_THE_MONTH, + CHAR_SEL_BREW_OF_THE_MONTH, + CHAR_REP_BREW_OF_THE_MONTH, CHAR_SEL_AUCTION_ITEMS, CHAR_INS_AUCTION, CHAR_DEL_AUCTION, @@ -192,9 +192,9 @@ enum CharacterDatabaseStatements CHAR_UPD_CHANNEL, CHAR_UPD_CHANNEL_USAGE, CHAR_DEL_OLD_CHANNELS, - CHAR_DEL_OLD_CHANNELS_BANS, - CHAR_INS_CHANNEL_BAN, - CHAR_DEL_CHANNEL_BAN, + CHAR_DEL_OLD_CHANNELS_BANS, + CHAR_INS_CHANNEL_BAN, + CHAR_DEL_CHANNEL_BAN, CHAR_UPD_EQUIP_SET, CHAR_INS_EQUIP_SET, @@ -217,7 +217,7 @@ enum CharacterDatabaseStatements CHAR_INS_INSTANCE_SAVE, CHAR_UPD_INSTANCE_SAVE_DATA, - CHAR_UPD_INSTANCE_SAVE_ENCOUNTERMASK, + CHAR_UPD_INSTANCE_SAVE_ENCOUNTERMASK, CHAR_DEL_GAME_EVENT_SAVE, CHAR_INS_GAME_EVENT_SAVE, @@ -314,8 +314,8 @@ enum CharacterDatabaseStatements CHAR_UPD_CHAR_INSTANCE, CHAR_UPD_CHAR_INSTANCE_EXTENDED, CHAR_INS_CHAR_INSTANCE, - CHAR_INS_ARENA_LOG_FIGHT, - CHAR_INS_ARENA_LOG_MEMBERSTATS, + CHAR_INS_ARENA_LOG_FIGHT, + CHAR_INS_ARENA_LOG_MEMBERSTATS, CHAR_UPD_GENDER_PLAYERBYTES, CHAR_DEL_CHARACTER_SKILL, CHAR_UPD_ADD_CHARACTER_SOCIAL_FLAGS, @@ -485,12 +485,12 @@ enum CharacterDatabaseStatements CHAR_UPD_CHAR_PET_SLOT_BY_ID, CHAR_DEL_CHAR_PET_BY_ID, CHAR_DEL_CHAR_PET_BY_SLOT, - CHAR_REP_CHAR_PET, + CHAR_REP_CHAR_PET, CHAR_SEL_ITEMCONTAINER_ITEMS, CHAR_DEL_ITEMCONTAINER_SINGLE_ITEM, CHAR_INS_ITEMCONTAINER_SINGLE_ITEM, - CHAR_DEL_ITEMCONTAINER_CONTAINER, + CHAR_DEL_ITEMCONTAINER_CONTAINER, MAX_CHARACTERDATABASE_STATEMENTS }; diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 660994cfb..739df7790 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -55,8 +55,8 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_DEL_REALM_CHARACTERS, "DELETE FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_INS_REALM_CHARACTERS, "INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(LOGIN_SEL_SUM_REALM_CHARACTERS, "SELECT SUM(numchars) FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC); - PrepareStatement(LOGIN_INS_ACCOUNT, "INSERT INTO account(username, sha_pass_hash, joindate) VALUES(?, ?, NOW())", CONNECTION_ASYNC); - PrepareStatement(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC); + PrepareStatement(LOGIN_INS_ACCOUNT, "INSERT INTO account(username, sha_pass_hash, joindate) VALUES(?, ?, NOW())", CONNECTION_ASYNC); + PrepareStatement(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); @@ -85,5 +85,5 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC); - PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH); + PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH); } diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h index 8ccf28b64..2ce40e5db 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -76,7 +76,7 @@ enum LoginDatabaseStatements LOGIN_INS_REALM_CHARACTERS, LOGIN_SEL_SUM_REALM_CHARACTERS, LOGIN_INS_ACCOUNT, - LOGIN_INS_REALM_CHARACTERS_INIT, + LOGIN_INS_REALM_CHARACTERS_INIT, LOGIN_UPD_EXPANSION, LOGIN_UPD_ACCOUNT_LOCK, LOGIN_UPD_USERNAME, @@ -105,7 +105,7 @@ enum LoginDatabaseStatements LOGIN_SEL_ACCOUNT_WHOIS, LOGIN_SEL_REALMLIST_SECURITY_LEVEL, LOGIN_DEL_ACCOUNT, - LOGIN_SEL_AUTOBROADCAST, + LOGIN_SEL_AUTOBROADCAST, MAX_LOGINDATABASE_STATEMENTS }; diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 94aad4299..e6ef09947 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -964,7 +964,7 @@ void Log::outMisc(const char * str, ...) if (!str) return; - if (m_enableLogDB) + if (m_enableLogDB) { va_list ap2; va_start(ap2, str); diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index d8939d7db..edf33c4c9 100644 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -67,8 +67,8 @@ enum LogTypes LOG_TYPE_GM = 8, LOG_TYPE_CRASH = 9, LOG_TYPE_CHAT = 10, - LOG_TYPE_PERF = 11, - LOG_TYPE_MULTITH= 12, + LOG_TYPE_PERF = 11, + LOG_TYPE_MULTITH= 12, MAX_LOG_TYPES }; diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp index 0bd45d8b5..0a5823cc6 100644 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -49,8 +49,8 @@ ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size, void ByteBuffer::hexlike(bool outString) const { - if (!outString) - return; + if (!outString) + return; uint32 j = 1, k = 1; diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index cbddc5c8c..7d1cd35da 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -239,22 +239,22 @@ class ByteBuffer ByteBuffer &operator>>(float &value) { value = read(); - if (!myisfinite(value)) - { - value = 0.0f; + if (!myisfinite(value)) + { + value = 0.0f; //throw ByteBufferException(); - } + } return *this; } ByteBuffer &operator>>(double &value) { value = read(); - if (!myisfinite(value)) - { - value = 0.0f; + if (!myisfinite(value)) + { + value = 0.0f; //throw ByteBufferException(); - } + } return *this; } @@ -435,19 +435,19 @@ class ByteBuffer ASSERT(size() < 10000000); - size_t newsize = _wpos + cnt; + size_t newsize = _wpos + cnt; - if (_storage.capacity() < newsize) // pussywizard - { - if (newsize < 100) - _storage.reserve(300); - else if (newsize < 750) - _storage.reserve(2500); - else if (newsize < 6000) - _storage.reserve(10000); - else - _storage.reserve(400000); - } + if (_storage.capacity() < newsize) // pussywizard + { + if (newsize < 100) + _storage.reserve(300); + else if (newsize < 750) + _storage.reserve(2500); + else if (newsize < 6000) + _storage.reserve(10000); + else + _storage.reserve(400000); + } if (_storage.size() < newsize) _storage.resize(newsize); diff --git a/src/server/shared/Threading/DelayExecutor.cpp b/src/server/shared/Threading/DelayExecutor.cpp index 7d4859370..b64f8d65a 100644 --- a/src/server/shared/Threading/DelayExecutor.cpp +++ b/src/server/shared/Threading/DelayExecutor.cpp @@ -79,11 +79,11 @@ int DelayExecutor::start(int num_threads, ACE_Method_Request* pre_svc_hook, ACE_ queue_.queue()->activate(); - // pussywizard: - ACE_Based::ThreadPriority tp; - int _priority = tp.getPriority(ACE_Based::Highest); - if (ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE, num_threads, 0, _priority) == -1) - return -1; + // pussywizard: + ACE_Based::ThreadPriority tp; + int _priority = tp.getPriority(ACE_Based::Highest); + if (ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE, num_threads, 0, _priority) == -1) + return -1; //if (ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, num_threads) == -1) // return -1; @@ -98,10 +98,10 @@ int DelayExecutor::execute(ACE_Method_Request* new_req) if (new_req == NULL) return -1; - // pussywizard: NULL as param for enqueue - wait until the action is possible! - // new tasks are added to the queue during map update (schedule_update in MapInstanced::Update) - // the queue can be momentarily blocked by map threads constantly waiting for tasks (for (;;) { queue_.dequeue();... } in DelayExecutor::svc()) - // so just wait a moment, don't drop the task xDddd + // pussywizard: NULL as param for enqueue - wait until the action is possible! + // new tasks are added to the queue during map update (schedule_update in MapInstanced::Update) + // the queue can be momentarily blocked by map threads constantly waiting for tasks (for (;;) { queue_.dequeue();... } in DelayExecutor::svc()) + // so just wait a moment, don't drop the task xDddd if (queue_.enqueue(new_req, /*(ACE_Time_Value*)&ACE_Time_Value::zero*/ NULL) == -1) { delete new_req; diff --git a/src/server/shared/Utilities/EventProcessor.cpp b/src/server/shared/Utilities/EventProcessor.cpp index a7fe3926a..2e45e4f8a 100644 --- a/src/server/shared/Utilities/EventProcessor.cpp +++ b/src/server/shared/Utilities/EventProcessor.cpp @@ -99,5 +99,5 @@ uint64 EventProcessor::CalculateTime(uint64 t_offset) const uint64 EventProcessor::CalculateQueueTime(uint64 delay) const { - return CalculateTime(delay - (m_time % delay)); + return CalculateTime(delay - (m_time % delay)); } diff --git a/src/server/shared/Utilities/EventProcessor.h b/src/server/shared/Utilities/EventProcessor.h index b55d9b1a2..c14dffd5b 100644 --- a/src/server/shared/Utilities/EventProcessor.h +++ b/src/server/shared/Utilities/EventProcessor.h @@ -66,8 +66,8 @@ class EventProcessor void AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime = true); uint64 CalculateTime(uint64 t_offset) const; - // Xinef: calculates next queue tick time - uint64 CalculateQueueTime(uint64 delay) const; + // Xinef: calculates next queue tick time + uint64 CalculateQueueTime(uint64 delay) const; protected: uint64 m_time; diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index 933842f3d..34ad1474b 100644 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -596,10 +596,10 @@ class EventMap return _time; } - void SetTimer(uint32 time) - { - _time = time; - } + void SetTimer(uint32 time) + { + _time = time; + } /** * @name GetPhaseMask @@ -773,20 +773,20 @@ class EventMap _time = delay < _time ? _time - delay : 0; } - void DelayEventsToMax(uint32 delay, uint32 group) - { - for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();) + void DelayEventsToMax(uint32 delay, uint32 group) + { + for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();) { - if (itr->first < _time+delay && (group == 0 || ((1 << (group + 15)) & itr->second))) + if (itr->first < _time+delay && (group == 0 || ((1 << (group + 15)) & itr->second))) { - ScheduleEvent(itr->second, delay); + ScheduleEvent(itr->second, delay); _eventMap.erase(itr); itr = _eventMap.begin(); } else ++itr; } - } + } /** * @name DelayEvents diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index b01ba07a0..e4d87f32b 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -91,7 +91,7 @@ private: uint32 _delayTime; public: - FreezeDetectorRunnable(uint32 freezeDelay) : _loops(0), _lastChange(0), _delayTime(freezeDelay) {} + FreezeDetectorRunnable(uint32 freezeDelay) : _loops(0), _lastChange(0), _delayTime(freezeDelay) {} void run() { @@ -185,9 +185,9 @@ int Master::Run() ACE_Based::Thread rarThread(new RARunnable); - // pussywizard: - ACE_Based::Thread auctionLising_thread(new AuctionListingRunnable); - auctionLising_thread.setPriority(ACE_Based::High); + // pussywizard: + ACE_Based::Thread auctionLising_thread(new AuctionListingRunnable); + auctionLising_thread.setPriority(ACE_Based::High); #if defined(_WIN32) || defined(__linux__) @@ -304,11 +304,11 @@ int Master::Run() delete soapThread; } - if (freezeThread) - { - freezeThread->wait(); - delete freezeThread; - } + if (freezeThread) + { + freezeThread->wait(); + delete freezeThread; + } // set server offline LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID); diff --git a/src/server/worldserver/WorldThread/WorldRunnable.cpp b/src/server/worldserver/WorldThread/WorldRunnable.cpp index c5c23a2af..24d630263 100644 --- a/src/server/worldserver/WorldThread/WorldRunnable.cpp +++ b/src/server/worldserver/WorldThread/WorldRunnable.cpp @@ -74,7 +74,7 @@ void WorldRunnable::run() #endif } - sLog->SetLogDB(false); + sLog->SetLogDB(false); sScriptMgr->OnShutdown(); @@ -95,42 +95,42 @@ void WorldRunnable::run() void AuctionListingRunnable::run() { sLog->outString("Starting up Auction House Listing thread..."); - while (!World::IsStopped()) - { - if (AsyncAuctionListingMgr::IsAuctionListingAllowed()) - { - uint32 diff = AsyncAuctionListingMgr::GetDiff(); - AsyncAuctionListingMgr::ResetDiff(); + while (!World::IsStopped()) + { + if (AsyncAuctionListingMgr::IsAuctionListingAllowed()) + { + uint32 diff = AsyncAuctionListingMgr::GetDiff(); + AsyncAuctionListingMgr::ResetDiff(); - if (AsyncAuctionListingMgr::GetTempList().size() || AsyncAuctionListingMgr::GetList().size()) - { - TRINITY_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetLock()); + if (AsyncAuctionListingMgr::GetTempList().size() || AsyncAuctionListingMgr::GetList().size()) + { + TRINITY_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetLock()); - { - TRINITY_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetTempLock()); - for (std::list::iterator itr = AsyncAuctionListingMgr::GetTempList().begin(); itr != AsyncAuctionListingMgr::GetTempList().end(); ++itr) - AsyncAuctionListingMgr::GetList().push_back( (*itr) ); - AsyncAuctionListingMgr::GetTempList().clear(); - } + { + TRINITY_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetTempLock()); + for (std::list::iterator itr = AsyncAuctionListingMgr::GetTempList().begin(); itr != AsyncAuctionListingMgr::GetTempList().end(); ++itr) + AsyncAuctionListingMgr::GetList().push_back( (*itr) ); + AsyncAuctionListingMgr::GetTempList().clear(); + } - for (std::list::iterator itr = AsyncAuctionListingMgr::GetList().begin(); itr != AsyncAuctionListingMgr::GetList().end(); ++itr) - { - if ((*itr)._msTimer <= diff) - (*itr)._msTimer = 0; - else - (*itr)._msTimer -= diff; - } + for (std::list::iterator itr = AsyncAuctionListingMgr::GetList().begin(); itr != AsyncAuctionListingMgr::GetList().end(); ++itr) + { + if ((*itr)._msTimer <= diff) + (*itr)._msTimer = 0; + else + (*itr)._msTimer -= diff; + } - for (std::list::iterator itr = AsyncAuctionListingMgr::GetList().begin(); itr != AsyncAuctionListingMgr::GetList().end(); ++itr) - if ((*itr)._msTimer == 0) - { - if ((*itr).Execute()) - AsyncAuctionListingMgr::GetList().erase(itr); - break; - } - } - } - ACE_Based::Thread::Sleep(1); - } + for (std::list::iterator itr = AsyncAuctionListingMgr::GetList().begin(); itr != AsyncAuctionListingMgr::GetList().end(); ++itr) + if ((*itr)._msTimer == 0) + { + if ((*itr).Execute()) + AsyncAuctionListingMgr::GetList().erase(itr); + break; + } + } + } + ACE_Based::Thread::Sleep(1); + } sLog->outString("Auction House Listing thread exiting without problems."); } diff --git a/src/server/worldserver/WorldThread/WorldRunnable.h b/src/server/worldserver/WorldThread/WorldRunnable.h index 328762096..519b5fd0e 100644 --- a/src/server/worldserver/WorldThread/WorldRunnable.h +++ b/src/server/worldserver/WorldThread/WorldRunnable.h @@ -32,8 +32,8 @@ class WorldRunnable : public ACE_Based::Runnable class AuctionListingRunnable : public ACE_Based::Runnable { - public: - void run(); + public: + void run(); }; #endif /// @}